From: support Date: Fri, 25 Mar 2022 09:58:42 +0000 (+0000) Subject: Built motion from commit 076b6d01.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%2011license.mail?a=commitdiff_plain;h=a09b605c4b1d781710e01548979ffebc78e76f7f;p=motion2.git Built motion from commit 076b6d01.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 00d4e22..0880204 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-03-25T09:30:30.041Z", + "time": "2022-03-25T09:50:30.537Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0fd2ce7..f04c917 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-25T09:30:30.041Z", + "time": "2022-03-25T09:50:30.537Z", "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 8512047..7fc7ce1 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 _0xedef=['motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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','STRING'];(function(_0x42353c,_0x1eb7b7){var _0x5ba6d4=function(_0x197180){while(--_0x197180){_0x42353c['push'](_0x42353c['shift']());}};_0x5ba6d4(++_0x1eb7b7);}(_0xedef,0x83));var _0xfede=function(_0x299d68,_0x1455c8){_0x299d68=_0x299d68-0x0;var _0x427fe5=_0xedef[_0x299d68];return _0x427fe5;};'use strict';var Sequelize=require(_0xfede('0x0'));module[_0xfede('0x1')]={'name':{'type':Sequelize[_0xfede('0x2')],'get':function(_0x1dfc1d){return this[_0xfede('0x3')]('action');}},'action':{'type':Sequelize[_0xfede('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xfede('0x5'),'jscripty',_0xfede('0x6'),_0xfede('0x7'),'bot',_0xfede('0x8')]],'msg':_0xfede('0x9')}},'comment':_0xfede('0x9')},'data1':{'type':Sequelize[_0xfede('0x4')](0x1000),'comment':_0xfede('0xa')},'data2':{'type':Sequelize[_0xfede('0x4')](0x1000),'comment':_0xfede('0xb')},'data3':{'type':Sequelize[_0xfede('0x4')](0x1000),'comment':_0xfede('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xfede('0xd')},'data6':{'type':Sequelize[_0xfede('0x4')],'comments':_0xfede('0xe')},'data7':{'type':Sequelize[_0xfede('0xf')],'comments':_0xfede('0x10')}}; \ No newline at end of file +var _0x820a=['urlForward[headers],\x20browser[wsindowHeight]','sequelize','exports','getDataValue','contactManager','integration','motionbar','urlForward','bot','script','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]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x241161,_0x3589e0){var _0x4d6dfb=function(_0x36cd25){while(--_0x36cd25){_0x241161['push'](_0x241161['shift']());}};_0x4d6dfb(++_0x3589e0);}(_0x820a,0x187));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa820('0x0'));module[_0xa820('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4ae6f8){return this[_0xa820('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xa820('0x3'),_0xa820('0x4'),_0xa820('0x5'),'jscripty',_0xa820('0x6'),'browser',_0xa820('0x7'),_0xa820('0x8')]],'msg':_0xa820('0x9')}},'comment':_0xa820('0x9')},'data1':{'type':Sequelize[_0xa820('0xa')](0x1000),'comment':_0xa820('0xb')},'data2':{'type':Sequelize[_0xa820('0xa')](0x1000),'comment':_0xa820('0xc')},'data3':{'type':Sequelize[_0xa820('0xa')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xa820('0xa')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xa820('0xd')},'data6':{'type':Sequelize[_0xa820('0xa')],'comments':_0xa820('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6d9a6f5..6f8a920 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 _0x91ec=['papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','sendStatus','stack','name','body','Action','params','then','catch','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3f345d,_0x29513a){var _0x4ebfb9=function(_0x19af4b){while(--_0x19af4b){_0x3f345d['push'](_0x3f345d['shift']());}};_0x4ebfb9(++_0x29513a);}(_0x91ec,0x12b));var _0xc91e=function(_0x3f3d2b,_0x8bb927){_0x3f3d2b=_0x3f3d2b-0x0;var _0x5b12fc=_0x91ec[_0x3f3d2b];return _0x5b12fc;};'use strict';var emlformat=require(_0xc91e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc91e('0x1'));var rp=require(_0xc91e('0x2'));var moment=require(_0xc91e('0x3'));var BPromise=require(_0xc91e('0x4'));var Mustache=require(_0xc91e('0x5'));var util=require('util');var path=require(_0xc91e('0x6'));var sox=require(_0xc91e('0x7'));var csv=require(_0xc91e('0x8'));var ejs=require(_0xc91e('0x9'));var fs=require('fs');var fs_extra=require(_0xc91e('0xa'));var _=require(_0xc91e('0xb'));var squel=require(_0xc91e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc91e('0xd'));var deskjs=require(_0xc91e('0xe'));var toCsv=require(_0xc91e('0x8'));var querystring=require(_0xc91e('0xf'));var Papa=require(_0xc91e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc91e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc91e('0x12'));var logger=require(_0xc91e('0x13'))(_0xc91e('0x14'));var utils=require(_0xc91e('0x15'));var config=require(_0xc91e('0x16'));var licenseUtil=require(_0xc91e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3944f1,_0x27e646){_0x27e646=_0x27e646||0xcc;return function(_0xbefcfc){if(_0xbefcfc){return _0x3944f1['sendStatus'](_0x27e646);}return _0x3944f1[_0xc91e('0x18')](_0x27e646)[_0xc91e('0x19')]();};}function respondWithResult(_0x3b08e8,_0x53aba9){_0x53aba9=_0x53aba9||0xc8;return function(_0xd5c60a){if(_0xd5c60a){return _0x3b08e8[_0xc91e('0x18')](_0x53aba9)[_0xc91e('0x1a')](_0xd5c60a);}};}function respondWithFilteredResult(_0x30f616,_0x49734c){return function(_0x301de8){if(_0x301de8){var _0x594ccc=typeof _0x49734c[_0xc91e('0x1b')]==='undefined'&&typeof _0x49734c[_0xc91e('0x1c')]===_0xc91e('0x1d');var _0x2d4cf9=_0x301de8[_0xc91e('0x1e')];var _0x455524=_0x594ccc?0x0:_0x49734c[_0xc91e('0x1b')];var _0x16f7ae=_0x594ccc?_0x301de8[_0xc91e('0x1e')]:_0x49734c[_0xc91e('0x1b')]+_0x49734c[_0xc91e('0x1c')];var _0x307b44;if(_0x16f7ae>=_0x2d4cf9){_0x16f7ae=_0x2d4cf9;_0x307b44=0xc8;}else{_0x307b44=0xce;}_0x30f616['status'](_0x307b44);return _0x30f616[_0xc91e('0x1f')](_0xc91e('0x20'),_0x455524+'-'+_0x16f7ae+'/'+_0x2d4cf9)[_0xc91e('0x1a')](_0x301de8);}return null;};}function patchUpdates(_0x14da77){return function(_0x3e98f5){try{jsonpatch[_0xc91e('0x21')](_0x3e98f5,_0x14da77,!![]);}catch(_0x4d7a60){return BPromise[_0xc91e('0x22')](_0x4d7a60);}return _0x3e98f5[_0xc91e('0x23')]();};}function saveUpdates(_0x1b6190,_0x3bb1a7){return function(_0x11a01c){if(_0x11a01c){return _0x11a01c['update'](_0x1b6190)['then'](function(_0x36f3fa){return _0x36f3fa;});}return null;};}function removeEntity(_0x522a47,_0xdc5be8){return function(_0x350063){if(_0x350063){return _0x350063['destroy']()['then'](function(){_0x522a47[_0xc91e('0x18')](0xcc)[_0xc91e('0x19')]();});}};}function handleEntityNotFound(_0x18577f,_0x35dba8){return function(_0x2de2ad){if(!_0x2de2ad){_0x18577f[_0xc91e('0x24')](0x194);}return _0x2de2ad;};}function handleError(_0xa175ab,_0x54f026){_0x54f026=_0x54f026||0x1f4;return function(_0x51a7b9){logger['error'](_0x51a7b9[_0xc91e('0x25')]);if(_0x51a7b9['name']){delete _0x51a7b9[_0xc91e('0x26')];}_0xa175ab[_0xc91e('0x18')](_0x54f026)['send'](_0x51a7b9);};}exports['update']=function(_0x23a6ab,_0x1b2dbc){if(_0x23a6ab[_0xc91e('0x27')]['id']){delete _0x23a6ab[_0xc91e('0x27')]['id'];}return db[_0xc91e('0x28')]['find']({'where':{'id':_0x23a6ab[_0xc91e('0x29')]['id']}})[_0xc91e('0x2a')](handleEntityNotFound(_0x1b2dbc,null))[_0xc91e('0x2a')](saveUpdates(_0x23a6ab[_0xc91e('0x27')],null))[_0xc91e('0x2a')](respondWithResult(_0x1b2dbc,null))[_0xc91e('0x2b')](handleError(_0x1b2dbc,null));};exports['destroy']=function(_0x349b85,_0x29c6e9){return db[_0xc91e('0x28')][_0xc91e('0x2c')]({'where':{'id':_0x349b85[_0xc91e('0x29')]['id']}})['then'](handleEntityNotFound(_0x29c6e9,null))[_0xc91e('0x2a')](removeEntity(_0x29c6e9,null))[_0xc91e('0x2b')](handleError(_0x29c6e9,null));}; \ No newline at end of file +var _0x4c0e=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','body','find','params','then','catch','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2eade4,_0x4998e2){var _0x384fe2=function(_0x56a623){while(--_0x56a623){_0x2eade4['push'](_0x2eade4['shift']());}};_0x384fe2(++_0x4998e2);}(_0x4c0e,0xad));var _0xe4c0=function(_0x20ff64,_0x5c3677){_0x20ff64=_0x20ff64-0x0;var _0x5580db=_0x4c0e[_0x20ff64];return _0x5580db;};'use strict';var emlformat=require(_0xe4c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c0('0x1'));var jsonpatch=require(_0xe4c0('0x2'));var rp=require(_0xe4c0('0x3'));var moment=require(_0xe4c0('0x4'));var BPromise=require(_0xe4c0('0x5'));var Mustache=require('mustache');var util=require(_0xe4c0('0x6'));var path=require('path');var sox=require(_0xe4c0('0x7'));var csv=require(_0xe4c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4c0('0x9'));var squel=require(_0xe4c0('0xa'));var crypto=require(_0xe4c0('0xb'));var jsforce=require(_0xe4c0('0xc'));var deskjs=require(_0xe4c0('0xd'));var toCsv=require(_0xe4c0('0x8'));var querystring=require(_0xe4c0('0xe'));var Papa=require(_0xe4c0('0xf'));var Redis=require('ioredis');var authService=require(_0xe4c0('0x10'));var qs=require(_0xe4c0('0x11'));var as=require(_0xe4c0('0x12'));var hardwareService=require(_0xe4c0('0x13'));var logger=require(_0xe4c0('0x14'))(_0xe4c0('0x15'));var utils=require('../../config/utils');var config=require(_0xe4c0('0x16'));var licenseUtil=require(_0xe4c0('0x17'));var db=require(_0xe4c0('0x18'))['db'];function respondWithStatusCode(_0x5888a2,_0x8f278e){_0x8f278e=_0x8f278e||0xcc;return function(_0x3624c6){if(_0x3624c6){return _0x5888a2['sendStatus'](_0x8f278e);}return _0x5888a2[_0xe4c0('0x19')](_0x8f278e)['end']();};}function respondWithResult(_0x3daf05,_0x4c1642){_0x4c1642=_0x4c1642||0xc8;return function(_0x115a75){if(_0x115a75){return _0x3daf05[_0xe4c0('0x19')](_0x4c1642)[_0xe4c0('0x1a')](_0x115a75);}};}function respondWithFilteredResult(_0x43d6d0,_0x56d7c7){return function(_0x469297){if(_0x469297){var _0x1a3adc=typeof _0x56d7c7[_0xe4c0('0x1b')]===_0xe4c0('0x1c')&&typeof _0x56d7c7[_0xe4c0('0x1d')]==='undefined';var _0xdad8db=_0x469297['count'];var _0x48caa4=_0x1a3adc?0x0:_0x56d7c7[_0xe4c0('0x1b')];var _0x507692=_0x1a3adc?_0x469297['count']:_0x56d7c7[_0xe4c0('0x1b')]+_0x56d7c7['limit'];var _0x4e4e14;if(_0x507692>=_0xdad8db){_0x507692=_0xdad8db;_0x4e4e14=0xc8;}else{_0x4e4e14=0xce;}_0x43d6d0[_0xe4c0('0x19')](_0x4e4e14);return _0x43d6d0[_0xe4c0('0x1e')]('Content-Range',_0x48caa4+'-'+_0x507692+'/'+_0xdad8db)['json'](_0x469297);}return null;};}function patchUpdates(_0x864d9f){return function(_0x2f1a1f){try{jsonpatch[_0xe4c0('0x1f')](_0x2f1a1f,_0x864d9f,!![]);}catch(_0x42da93){return BPromise[_0xe4c0('0x20')](_0x42da93);}return _0x2f1a1f[_0xe4c0('0x21')]();};}function saveUpdates(_0x9634b6,_0x55ee79){return function(_0x5d19b4){if(_0x5d19b4){return _0x5d19b4[_0xe4c0('0x22')](_0x9634b6)['then'](function(_0x185d5e){return _0x185d5e;});}return null;};}function removeEntity(_0x15f0bd,_0x4e61e8){return function(_0xf3ed34){if(_0xf3ed34){return _0xf3ed34[_0xe4c0('0x23')]()['then'](function(){_0x15f0bd[_0xe4c0('0x19')](0xcc)[_0xe4c0('0x24')]();});}};}function handleEntityNotFound(_0x58736d,_0x108ebd){return function(_0x4ffc5d){if(!_0x4ffc5d){_0x58736d[_0xe4c0('0x25')](0x194);}return _0x4ffc5d;};}function handleError(_0x49af5c,_0xa9def){_0xa9def=_0xa9def||0x1f4;return function(_0x399ab6){logger[_0xe4c0('0x26')](_0x399ab6[_0xe4c0('0x27')]);if(_0x399ab6[_0xe4c0('0x28')]){delete _0x399ab6['name'];}_0x49af5c['status'](_0xa9def)['send'](_0x399ab6);};}exports['update']=function(_0x158ecc,_0x30271e){if(_0x158ecc[_0xe4c0('0x29')]['id']){delete _0x158ecc[_0xe4c0('0x29')]['id'];}return db['Action'][_0xe4c0('0x2a')]({'where':{'id':_0x158ecc[_0xe4c0('0x2b')]['id']}})[_0xe4c0('0x2c')](handleEntityNotFound(_0x30271e,null))[_0xe4c0('0x2c')](saveUpdates(_0x158ecc[_0xe4c0('0x29')],null))[_0xe4c0('0x2c')](respondWithResult(_0x30271e,null))[_0xe4c0('0x2d')](handleError(_0x30271e,null));};exports['destroy']=function(_0x583ea5,_0x2cb107){return db[_0xe4c0('0x2e')]['find']({'where':{'id':_0x583ea5[_0xe4c0('0x2b')]['id']}})[_0xe4c0('0x2c')](handleEntityNotFound(_0x2cb107,null))['then'](removeEntity(_0x2cb107,null))[_0xe4c0('0x2d')](handleError(_0x2cb107,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c3b9060..e867cd1 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 _0x4b1b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','Action','tools_actions','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4b1b,0x17f));var _0xb4b1=function(_0x50087e,_0x4c5bb2){_0x50087e=_0x50087e-0x0;var _0xd49460=_0x4b1b[_0x50087e];return _0xd49460;};'use strict';var _=require(_0xb4b1('0x0'));var util=require(_0xb4b1('0x1'));var logger=require(_0xb4b1('0x2'))(_0xb4b1('0x3'));var moment=require(_0xb4b1('0x4'));var BPromise=require(_0xb4b1('0x5'));var rp=require(_0xb4b1('0x6'));var fs=require('fs');var path=require(_0xb4b1('0x7'));var rimraf=require(_0xb4b1('0x8'));var config=require('../../config/environment');var attributes=require('./action.attributes');module['exports']=function(_0x49ddcd,_0x2b28b4){return _0x49ddcd[_0xb4b1('0x9')](_0xb4b1('0xa'),attributes,{'tableName':_0xb4b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9ed=['./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc9ed,0x12b));var _0xdc9e=function(_0x74c392,_0x29cc28){_0x74c392=_0x74c392-0x0;var _0x306791=_0xc9ed[_0x74c392];return _0x306791;};'use strict';var _=require(_0xdc9e('0x0'));var util=require(_0xdc9e('0x1'));var logger=require(_0xdc9e('0x2'))('api');var moment=require(_0xdc9e('0x3'));var BPromise=require(_0xdc9e('0x4'));var rp=require(_0xdc9e('0x5'));var fs=require('fs');var path=require(_0xdc9e('0x6'));var rimraf=require(_0xdc9e('0x7'));var config=require(_0xdc9e('0x8'));var attributes=require(_0xdc9e('0x9'));module[_0xdc9e('0xa')]=function(_0x49e145,_0x3d579c){return _0x49e145[_0xdc9e('0xb')](_0xdc9e('0xc'),attributes,{'tableName':_0xdc9e('0xd'),'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 8ef44d2..2bbde6a 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xcf22a8,_0x35d51c){var _0x1137eb=function(_0x22bdf6){while(--_0x22bdf6){_0xcf22a8['push'](_0xcf22a8['shift']());}};_0x1137eb(++_0x35d51c);}(_0x5fab,0x177));var _0xb5fa=function(_0x273517,_0x50b234){_0x273517=_0x273517-0x0;var _0x2c6334=_0x5fab[_0x273517];return _0x2c6334;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xf494,0x1c6));var _0x4f49=function(_0x5a0c65,_0x11cba1){_0x5a0c65=_0x5a0c65-0x0;var _0x4f1ccd=_0xf494[_0x5a0c65];return _0x4f1ccd;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f496c6d..7561a42 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 _0x6542=['/:id','delete','isAuthenticated','destroy','exports','express','Router','../../components/auth/service','../../config/environment','put'];(function(_0x2c47a9,_0x120e40){var _0x792f9b=function(_0x342644){while(--_0x342644){_0x2c47a9['push'](_0x2c47a9['shift']());}};_0x792f9b(++_0x120e40);}(_0x6542,0xeb));var _0x2654=function(_0x5991df,_0x9d6ea2){_0x5991df=_0x5991df-0x0;var _0x36baa1=_0x6542[_0x5991df];return _0x36baa1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2654('0x0'));var router=express[_0x2654('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x2654('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2654('0x3'));var controller=require('./action.controller');router[_0x2654('0x4')](_0x2654('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x2654('0x6')](_0x2654('0x5'),auth[_0x2654('0x7')](),controller[_0x2654('0x8')]);module[_0x2654('0x9')]=router; \ No newline at end of file +var _0x038f=['../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','path','fs-extra'];(function(_0x4b4844,_0x2f0dfb){var _0x575192=function(_0x13ee1b){while(--_0x13ee1b){_0x4b4844['push'](_0x4b4844['shift']());}};_0x575192(++_0x2f0dfb);}(_0x038f,0x1d7));var _0xf038=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x038f[_0x597484];return _0x218e64;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf038('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf038('0x1'));var auth=require(_0xf038('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf038('0x3'));var controller=require(_0xf038('0x4'));router[_0xf038('0x5')](_0xf038('0x6'),auth[_0xf038('0x7')](),controller[_0xf038('0x8')]);router['delete']('/:id',auth[_0xf038('0x7')](),controller[_0xf038('0x9')]);module[_0xf038('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c5b2c1d..9a3f865 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 _0x2eb2=['TEXT','exports','STRING'];(function(_0x3270de,_0x293830){var _0x47d908=function(_0x1e2d73){while(--_0x1e2d73){_0x3270de['push'](_0x3270de['shift']());}};_0x47d908(++_0x293830);}(_0x2eb2,0x19f));var _0x22eb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2eb2[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3560d8,_0x5d93f5){_0x3560d8=_0x3560d8-0x0;var _0x15cf4d=_0xdc97[_0x3560d8];return _0x15cf4d;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8ba993f..a90a686 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 _0x96c1=['MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','type','includes','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','operator','ValidationErrorItem','output','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','run','runReport','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table'];(function(_0x53d9ba,_0x33330c){var _0x287bd7=function(_0x26e481){while(--_0x26e481){_0x53d9ba['push'](_0x53d9ba['shift']());}};_0x287bd7(++_0x33330c);}(_0x96c1,0x174));var _0x196c=function(_0x5bea79,_0x5ea536){_0x5bea79=_0x5bea79-0x0;var _0x4bedcd=_0x96c1[_0x5bea79];return _0x4bedcd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x196c('0x0'));var zipdir=require(_0x196c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x196c('0x2'));var moment=require('moment');var BPromise=require(_0x196c('0x3'));var Mustache=require(_0x196c('0x4'));var util=require('util');var path=require(_0x196c('0x5'));var sox=require(_0x196c('0x6'));var csv=require('to-csv');var ejs=require(_0x196c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x196c('0x8'));var squel=require(_0x196c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x196c('0xa'));var toCsv=require(_0x196c('0xb'));var querystring=require(_0x196c('0xc'));var Papa=require(_0x196c('0xd'));var Redis=require(_0x196c('0xe'));var authService=require(_0x196c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x196c('0x10'));var hardwareService=require(_0x196c('0x11'));var logger=require(_0x196c('0x12'))(_0x196c('0x13'));var utils=require(_0x196c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x196c('0x15'))['db'];var dbH=require('../../mysqldb')[_0x196c('0x16')];function respondWithStatusCode(_0xcc4223,_0x3fc403){_0x3fc403=_0x3fc403||0xcc;return function(_0x2ca3be){if(_0x2ca3be){return _0xcc4223[_0x196c('0x17')](_0x3fc403);}return _0xcc4223[_0x196c('0x18')](_0x3fc403)[_0x196c('0x19')]();};}function respondWithResult(_0x46f721,_0x190b69){_0x190b69=_0x190b69||0xc8;return function(_0x228810){if(_0x228810){return _0x46f721['status'](_0x190b69)[_0x196c('0x1a')](_0x228810);}};}function respondWithFilteredResult(_0x352a27,_0x13c8bd){return function(_0x523fae){if(_0x523fae){var _0x4774a2=typeof _0x13c8bd[_0x196c('0x1b')]===_0x196c('0x1c')&&typeof _0x13c8bd[_0x196c('0x1d')]===_0x196c('0x1c');var _0x473fa4=_0x523fae[_0x196c('0x1e')];var _0xe36591=_0x4774a2?0x0:_0x13c8bd[_0x196c('0x1b')];var _0x541b5d=_0x4774a2?_0x523fae[_0x196c('0x1e')]:_0x13c8bd['offset']+_0x13c8bd[_0x196c('0x1d')];var _0x278253;if(_0x541b5d>=_0x473fa4){_0x541b5d=_0x473fa4;_0x278253=0xc8;}else{_0x278253=0xce;}_0x352a27[_0x196c('0x18')](_0x278253);return _0x352a27[_0x196c('0x1f')]('Content-Range',_0xe36591+'-'+_0x541b5d+'/'+_0x473fa4)[_0x196c('0x1a')](_0x523fae);}return null;};}function patchUpdates(_0x45178c){return function(_0xae2770){try{jsonpatch[_0x196c('0x20')](_0xae2770,_0x45178c,!![]);}catch(_0x383973){return BPromise[_0x196c('0x21')](_0x383973);}return _0xae2770['save']();};}function saveUpdates(_0xcb542b,_0x217327){return function(_0x28273f){if(_0x28273f){return _0x28273f[_0x196c('0x22')](_0xcb542b)[_0x196c('0x23')](function(_0x713478){return _0x713478;});}return null;};}function removeEntity(_0x11d5f1,_0x5c328c){return function(_0x152e75){if(_0x152e75){return _0x152e75['destroy']()[_0x196c('0x23')](function(){var _0x47a7d7=_0x152e75[_0x196c('0x24')]({'plain':!![]});var _0x1fc7e5='CustomReports';return db['UserProfileResource'][_0x196c('0x25')]({'where':{'type':_0x1fc7e5,'resourceId':_0x47a7d7['id']}})['then'](function(){return _0x152e75;});})[_0x196c('0x23')](function(){_0x11d5f1[_0x196c('0x18')](0xcc)[_0x196c('0x19')]();});}};}function handleEntityNotFound(_0xc4d939,_0x15c576){return function(_0x3f0328){if(!_0x3f0328){_0xc4d939[_0x196c('0x17')](0x194);}return _0x3f0328;};}function handleError(_0x1a4449,_0x55a3c3){_0x55a3c3=_0x55a3c3||0x1f4;return function(_0x3caa61){logger[_0x196c('0x26')](_0x3caa61[_0x196c('0x27')]);if(_0x3caa61['name']){delete _0x3caa61[_0x196c('0x28')];}_0x1a4449[_0x196c('0x18')](_0x55a3c3)[_0x196c('0x29')](_0x3caa61);};}exports[_0x196c('0x2a')]=function(_0xd9d384,_0x5371cd){var _0x30e8ba={},_0x323d93={},_0x559693={'count':0x0,'rows':[]};var _0x2abc9c=_[_0x196c('0x2b')](db[_0x196c('0x2c')][_0x196c('0x2d')],function(_0x53949d){return{'name':_0x53949d['fieldName'],'type':_0x53949d['type']['key']};});_0x323d93['model']=_['map'](_0x2abc9c,'name');_0x323d93['query']=_[_0x196c('0x2e')](_0xd9d384[_0x196c('0x2f')]);_0x323d93[_0x196c('0x30')]=_['intersection'](_0x323d93[_0x196c('0x31')],_0x323d93['query']);_0x30e8ba[_0x196c('0x32')]=_[_0x196c('0x33')](_0x323d93[_0x196c('0x31')],qs['fields'](_0xd9d384['query'][_0x196c('0x34')]));_0x30e8ba[_0x196c('0x32')]=_0x30e8ba['attributes'][_0x196c('0x35')]?_0x30e8ba[_0x196c('0x32')]:_0x323d93[_0x196c('0x31')];if(!_0xd9d384[_0x196c('0x2f')][_0x196c('0x36')]('nolimit')){_0x30e8ba[_0x196c('0x1d')]=qs[_0x196c('0x1d')](_0xd9d384['query'][_0x196c('0x1d')]);_0x30e8ba[_0x196c('0x1b')]=qs[_0x196c('0x1b')](_0xd9d384[_0x196c('0x2f')][_0x196c('0x1b')]);}_0x30e8ba[_0x196c('0x37')]=qs['sort'](_0xd9d384[_0x196c('0x2f')]['sort']);_0x30e8ba[_0x196c('0x38')]=qs[_0x196c('0x30')](_['pick'](_0xd9d384[_0x196c('0x2f')],_0x323d93['filters']),_0x2abc9c);if(_0xd9d384['query'][_0x196c('0x39')]){_0x30e8ba[_0x196c('0x38')]=_[_0x196c('0x3a')](_0x30e8ba['where'],{'$or':_[_0x196c('0x2b')](_0x2abc9c,function(_0x17c5e2){if(_0x17c5e2['type']!==_0x196c('0x3b')){var _0x463e75={};_0x463e75[_0x17c5e2[_0x196c('0x28')]]={'$like':'%'+_0xd9d384[_0x196c('0x2f')][_0x196c('0x39')]+'%'};return _0x463e75;}})});}_0x30e8ba=_[_0x196c('0x3a')]({},_0x30e8ba,_0xd9d384[_0x196c('0x3c')]);var _0x17a4b4={'where':_0x30e8ba['where']};return db[_0x196c('0x2c')][_0x196c('0x1e')](_0x17a4b4)[_0x196c('0x23')](function(_0x2af661){_0x559693[_0x196c('0x1e')]=_0x2af661;if(_0xd9d384[_0x196c('0x2f')]['includeAll']){_0x30e8ba[_0x196c('0x3d')]=[{'all':!![]}];}return db[_0x196c('0x2c')][_0x196c('0x3e')](_0x30e8ba);})[_0x196c('0x23')](function(_0x2c8b78){_0x559693[_0x196c('0x3f')]=_0x2c8b78;return _0x559693;})['then'](respondWithFilteredResult(_0x5371cd,_0x30e8ba))[_0x196c('0x40')](handleError(_0x5371cd,null));};exports[_0x196c('0x41')]=function(_0x29a823,_0x33e633){var _0x1d46bf={'raw':![],'where':{'id':_0x29a823[_0x196c('0x42')]['id']}},_0x5dd72b={};_0x5dd72b[_0x196c('0x31')]=_[_0x196c('0x2e')](db[_0x196c('0x2c')]['rawAttributes']);_0x5dd72b['query']=_[_0x196c('0x2e')](_0x29a823[_0x196c('0x2f')]);_0x5dd72b[_0x196c('0x30')]=_[_0x196c('0x33')](_0x5dd72b[_0x196c('0x31')],_0x5dd72b[_0x196c('0x2f')]);_0x1d46bf[_0x196c('0x32')]=_['intersection'](_0x5dd72b[_0x196c('0x31')],qs[_0x196c('0x34')](_0x29a823['query'][_0x196c('0x34')]));_0x1d46bf['attributes']=_0x1d46bf['attributes'][_0x196c('0x35')]?_0x1d46bf[_0x196c('0x32')]:_0x5dd72b[_0x196c('0x31')];if(_0x29a823[_0x196c('0x2f')][_0x196c('0x43')]){_0x1d46bf[_0x196c('0x3d')]=[{'all':!![]}];}_0x1d46bf=_[_0x196c('0x3a')]({},_0x1d46bf,_0x29a823[_0x196c('0x3c')]);return db[_0x196c('0x2c')][_0x196c('0x44')](_0x1d46bf)[_0x196c('0x23')](handleEntityNotFound(_0x33e633,null))[_0x196c('0x23')](respondWithResult(_0x33e633,null))[_0x196c('0x40')](handleError(_0x33e633,null));};exports[_0x196c('0x45')]=function(_0x493c4c,_0x4e9e17){return db['AnalyticCustomReport']['create'](_0x493c4c[_0x196c('0x46')],{})[_0x196c('0x23')](function(_0x2f2085){var _0x36146d=_0x493c4c['user']['get']({'plain':!![]});if(!_0x36146d)throw new Error(_0x196c('0x47'));if(_0x36146d['role']===_0x196c('0x48')){var _0x2031ee=_0x2f2085['get']({'plain':!![]});var _0x45bdf2=_0x196c('0x49');return db[_0x196c('0x4a')][_0x196c('0x44')]({'where':{'name':_0x45bdf2,'userProfileId':_0x36146d[_0x196c('0x4b')]},'raw':!![]})[_0x196c('0x23')](function(_0x18650c){if(_0x18650c&&_0x18650c[_0x196c('0x4c')]===0x0){return db[_0x196c('0x4d')][_0x196c('0x45')]({'name':_0x2031ee['name'],'resourceId':_0x2031ee['id'],'type':_0x196c('0x4e'),'sectionId':_0x18650c['id']},{})[_0x196c('0x23')](function(){return _0x2f2085;});}else{return _0x2f2085;}})['catch'](function(_0x521c01){logger['error'](_0x196c('0x4f'),_0x521c01);throw _0x521c01;});}return _0x2f2085;})[_0x196c('0x23')](respondWithResult(_0x4e9e17,0xc9))[_0x196c('0x40')](handleError(_0x4e9e17,null));};exports[_0x196c('0x22')]=function(_0x21ae91,_0x3a7019){if(_0x21ae91['body']['id']){delete _0x21ae91['body']['id'];}return db[_0x196c('0x2c')][_0x196c('0x44')]({'where':{'id':_0x21ae91['params']['id']}})[_0x196c('0x23')](handleEntityNotFound(_0x3a7019,null))[_0x196c('0x23')](saveUpdates(_0x21ae91[_0x196c('0x46')],null))[_0x196c('0x23')](respondWithResult(_0x3a7019,null))[_0x196c('0x40')](handleError(_0x3a7019,null));};exports[_0x196c('0x25')]=function(_0x3a08e9,_0x352144){return db[_0x196c('0x2c')][_0x196c('0x44')]({'where':{'id':_0x3a08e9['params']['id']}})[_0x196c('0x23')](handleEntityNotFound(_0x352144,null))[_0x196c('0x23')](removeEntity(_0x352144,null))['catch'](handleError(_0x352144,null));};exports[_0x196c('0x50')]=function(_0x494e1d,_0x423d2b){var _0x34a238=0xa;var _0x2c3967=[_0x196c('0x51'),_0x196c('0x52'),'right_join',_0x196c('0x53')];var _0x1d78af={'SUM':_0x196c('0x54'),'COUNT':_0x196c('0x55'),'COUNT DISTINCT':_0x196c('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x196c('0x57'),'GROUP_CONCAT':_0x196c('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x196c('0x59')};var _0xc82530={'SEC_TO_TIME':_0x196c('0x5a'),'DATE':_0x196c('0x5b'),'HOUR':_0x196c('0x5c'),'ROUND':_0x196c('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5418f8=function(_0x189ae5){return!_['includes']([_0x196c('0x5e'),_0x196c('0x5f'),_0x196c('0x60'),_0x196c('0x61')],_0x189ae5);};var _0x569b09=function(_0x48e340){if(!_0x48e340||!_0x48e340[_0x196c('0x62')][_0x196c('0x35')]){return'';}for(var _0x586432='(',_0x530784=0x0;_0x530784<_0x48e340['rules']['length'];_0x530784+=0x1){_0x530784>0x0&&(_0x586432+='\x20'+_0x48e340['operator']+'\x20');_0x586432+=_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x63')]?_0x569b09(_0x48e340[_0x196c('0x62')][_0x530784]['group']):_0x48e340['rules'][_0x530784][_0x196c('0x64')]+'\x20'+_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x65')]+(_0x5418f8(_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x65')])?'\x20'+_0x48e340[_0x196c('0x62')][_0x530784][_0x196c('0x66')]:'');}return _0x586432+')';};var _0x419172={'where':{'id':_0x494e1d[_0x196c('0x42')]['id']}},_0x55b6b0,_0x2e089a,_0x1444dc,_0x4ce772,_0x57a397;_0x419172=_[_0x196c('0x3a')]({},_0x419172,_0x494e1d['options']);return db[_0x196c('0x2c')][_0x196c('0x44')](_0x419172)[_0x196c('0x23')](function(_0x56ffa3){if(_0x56ffa3){_0x55b6b0=_0x56ffa3;return _0x56ffa3[_0x196c('0x67')]();}return null;})['then'](function(_0x3ff7d6){if(_0x3ff7d6){if(!_0x3ff7d6[_0x196c('0x35')]){throw new db[(_0x196c('0x68'))]['ValidationErrorItem'](_0x196c('0x69'),0x193);}_0x2e089a=_0x3ff7d6;return db[_0x196c('0x6a')][_0x196c('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x4b3500){if(_0x4b3500){_0x1444dc=_[_0x196c('0x6b')](_0x4b3500,'id');var _0xb9c690;var _0x5dc983=squel[_0x196c('0x6c')]();_0x5dc983[_0x196c('0x6d')](_0x55b6b0[_0x196c('0x6e')]);for(var _0x2ab622=0x0;_0x2ab622<_0x2e089a[_0x196c('0x35')];_0x2ab622+=0x1){_0xb9c690=_0x2e089a[_0x2ab622][_0x196c('0x6f')]?_0x1444dc[_0x2e089a[_0x2ab622][_0x196c('0x6f')]][_0x196c('0x70')]:_0x2e089a[_0x2ab622][_0x196c('0x64')];_0xb9c690=_0x2e089a[_0x2ab622][_0x196c('0x71')]?_['replace'](_0x1d78af[_0x2e089a[_0x2ab622]['function']],'%s',_0xb9c690):_0xb9c690;_0xb9c690=_0x2e089a[_0x2ab622]['format']?_[_0x196c('0x72')](_0xc82530[_0x2e089a[_0x2ab622]['format']],'%s',_0xb9c690):_0xb9c690;if(_0x2e089a[_0x2ab622][_0x196c('0x73')]){_0x5dc983[_0x196c('0x63')](_0xb9c690);}_0x2e089a[_0x2ab622][_0x196c('0x74')]&&_0x5dc983[_0x196c('0x37')](_0xb9c690,_0x2e089a[_0x2ab622]['orderBy']===_0x196c('0x75')?![]:!![]);_0x5dc983[_0x196c('0x64')](_0xb9c690,_0x2e089a[_0x2ab622][_0x196c('0x76')]||_0xb9c690);}if(_0x55b6b0[_0x196c('0x77')]){_0x55b6b0['joins']=JSON[_0x196c('0x78')](_0x55b6b0[_0x196c('0x77')]);for(var _0xdc3542=0x0;_0xdc3542<_0x55b6b0[_0x196c('0x77')]['length'];_0xdc3542+=0x1){if(_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x79')]&&_[_0x196c('0x7a')](_0x2c3967,_0x55b6b0['joins'][_0xdc3542][_0x196c('0x79')])&&_0x55b6b0[_0x196c('0x77')][_0xdc3542]['parentKey']&&_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7b')]&&_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7c')]){_0x5dc983[_0x55b6b0[_0x196c('0x77')][_0xdc3542]['type']](_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7b')],null,util[_0x196c('0x7d')](_0x196c('0x7e'),_0x55b6b0[_0x196c('0x6e')],_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7f')],_0x55b6b0[_0x196c('0x77')][_0xdc3542][_0x196c('0x7b')],_0x55b6b0[_0x196c('0x77')][_0xdc3542]['foreignKey']));}}}if(_0x55b6b0['conditions']){_0x55b6b0[_0x196c('0x80')]=JSON[_0x196c('0x78')](_0x55b6b0[_0x196c('0x80')]);_0x5dc983['where'](_0x569b09(_0x55b6b0['conditions']['group']));}_0x57a397=_0x5dc983[_0x196c('0x81')]();_0x5dc983['limit'](_0x34a238);_0x5dc983[_0x196c('0x1b')](0x0);logger[_0x196c('0x82')](_0x196c('0x83'),_0x5dc983['toString']());return dbH[_0x196c('0x84')][_0x196c('0x2f')](_0x5dc983[_0x196c('0x85')](),{'type':dbH[_0x196c('0x84')][_0x196c('0x86')][_0x196c('0x87')]});}})['then'](respondWithResult(_0x423d2b,null))['catch'](handleError(_0x423d2b,null));};function runReport(_0x4380ee,_0x1cf5a0,_0x118295){var _0x182a74=_0x1cf5a0[_0x196c('0x28')];var _0x346cc7=0xa;var _0x11b867=['join',_0x196c('0x52'),'right_join',_0x196c('0x53')];var _0x2a9442={'SUM':'SUM(%s)','COUNT':_0x196c('0x55'),'COUNT DISTINCT':_0x196c('0x56'),'MAX':_0x196c('0x88'),'MIN':_0x196c('0x89'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x196c('0x58'),'GROUP_CONCAT ASC':_0x196c('0x8a'),'GROUP_CONCAT DESC':_0x196c('0x59')};var _0x2967b8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x196c('0x5b'),'HOUR':_0x196c('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x196c('0x8b')};var _0x2eec1b=function(_0x4c2075){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x196c('0x60'),_0x196c('0x61')],_0x4c2075);};var _0x45df24=function(_0x4bde63){if(!_0x4bde63||!_0x4bde63[_0x196c('0x62')][_0x196c('0x35')]){return'';}for(var _0x24e9bd='(',_0x54f405=0x0;_0x54f405<_0x4bde63[_0x196c('0x62')][_0x196c('0x35')];_0x54f405+=0x1){_0x54f405>0x0&&(_0x24e9bd+='\x20'+_0x4bde63[_0x196c('0x8c')]+'\x20');_0x24e9bd+=_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x63')]?_0x45df24(_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x63')]):_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x64')]+'\x20'+_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x65')]+(_0x2eec1b(_0x4bde63[_0x196c('0x62')][_0x54f405][_0x196c('0x65')])?'\x20'+_0x4bde63[_0x196c('0x62')][_0x54f405]['value']:'');}return _0x24e9bd+')';};var _0x17f8ea={'where':{'id':_0x4380ee['id']}},_0x26d3ae,_0x1e03aa,_0x175d48,_0x52afd4,_0x43995a;_0x17f8ea=_['merge']({},_0x17f8ea,_0x118295);return db[_0x196c('0x2c')]['find'](_0x17f8ea)['then'](function(_0x1114ed){if(_0x1114ed){_0x26d3ae=_0x1114ed;return _0x1114ed[_0x196c('0x67')]();}return null;})['then'](function(_0x52614c){if(_0x52614c){if(!_0x52614c[_0x196c('0x35')]){throw new db[(_0x196c('0x68'))][(_0x196c('0x8d'))](_0x196c('0x69'),0x193);}_0x1e03aa=_0x52614c;return db[_0x196c('0x6a')][_0x196c('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x4c01fd){if(_0x4c01fd){_0x175d48=_[_0x196c('0x6b')](_0x4c01fd,'id');var _0x386360;var _0x276416=squel[_0x196c('0x6c')]();_0x276416['from'](_0x26d3ae[_0x196c('0x6e')]);for(var _0x5144e7=0x0;_0x5144e7<_0x1e03aa[_0x196c('0x35')];_0x5144e7+=0x1){_0x386360=_0x1e03aa[_0x5144e7]['MetricId']?_0x175d48[_0x1e03aa[_0x5144e7]['MetricId']]['metric']:_0x1e03aa[_0x5144e7][_0x196c('0x64')];_0x386360=_0x1e03aa[_0x5144e7][_0x196c('0x71')]?_[_0x196c('0x72')](_0x2a9442[_0x1e03aa[_0x5144e7][_0x196c('0x71')]],'%s',_0x386360):_0x386360;_0x386360=_0x1e03aa[_0x5144e7][_0x196c('0x7d')]?_[_0x196c('0x72')](_0x2967b8[_0x1e03aa[_0x5144e7][_0x196c('0x7d')]],'%s',_0x386360):_0x386360;if(_0x1e03aa[_0x5144e7][_0x196c('0x73')]){_0x276416['group'](_0x386360);}_0x1e03aa[_0x5144e7]['orderBy']&&_0x276416[_0x196c('0x37')](_0x386360,_0x1e03aa[_0x5144e7]['orderBy']===_0x196c('0x75')?![]:!![]);_0x276416[_0x196c('0x64')](_0x386360,_0x1e03aa[_0x5144e7][_0x196c('0x76')]||_0x386360);}if(_0x26d3ae['joins']){_0x26d3ae[_0x196c('0x77')]=JSON[_0x196c('0x78')](_0x26d3ae['joins']);for(var _0x709908=0x0;_0x709908<_0x26d3ae[_0x196c('0x77')][_0x196c('0x35')];_0x709908+=0x1){if(_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x79')]&&_[_0x196c('0x7a')](_0x11b867,_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x79')])&&_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7f')]&&_0x26d3ae['joins'][_0x709908]['foreignTable']&&_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7c')]){_0x276416[_0x26d3ae['joins'][_0x709908][_0x196c('0x79')]](_0x26d3ae['joins'][_0x709908]['foreignTable'],null,util[_0x196c('0x7d')]('%s.%s\x20=\x20%s.%s',_0x26d3ae['table'],_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7f')],_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7b')],_0x26d3ae[_0x196c('0x77')][_0x709908][_0x196c('0x7c')]));}}}if(_0x26d3ae['conditions']){_0x26d3ae[_0x196c('0x80')]=JSON[_0x196c('0x78')](_0x26d3ae['conditions']);_0x276416[_0x196c('0x38')](_0x45df24(_0x26d3ae[_0x196c('0x80')][_0x196c('0x63')]));}_0x43995a=_0x276416[_0x196c('0x81')]();_0x276416[_0x196c('0x1d')](_0x346cc7);_0x276416[_0x196c('0x1b')](0x0);return;}})['then'](function(){if(_0x1cf5a0[_0x196c('0x8e')]==='web'){return null;}var _0x1141be=_[_0x196c('0x3a')](_0x1cf5a0,{'name':_0x1cf5a0['fullPath']||_0x1cf5a0[_0x196c('0x28')]||_0x26d3ae[_0x196c('0x28')],'basename':_0x182a74,'savename':util['format'](_0x196c('0x8f'),_0x1cf5a0[_0x196c('0x28')]||_0x26d3ae[_0x196c('0x28')],require(_0x196c('0x90'))['generate'](0x4),_0x1cf5a0[_0x196c('0x8e')]||_0x196c('0x91')),'reportId':_0x26d3ae['id'],'reportType':_0x196c('0x92')});return db[_0x196c('0x93')][_0x196c('0x45')](_0x1141be,{'raw':!![]});})[_0x196c('0x23')](function(_0x452b1c){if(_0x26d3ae[_0x196c('0x6e')]===_0x196c('0x94')){_0x43995a[_0x196c('0x38')](_0x26d3ae[_0x196c('0x6e')]+_0x196c('0x95'),_0x1cf5a0[_0x196c('0x96')],_0x1cf5a0[_0x196c('0x97')]);}else{_0x43995a[_0x196c('0x38')](_0x26d3ae['table']+_0x196c('0x98'),_0x1cf5a0[_0x196c('0x96')],_0x1cf5a0[_0x196c('0x97')]);}if(_0x452b1c){logger['info'](_0x196c('0x99'),_0x43995a[_0x196c('0x85')]());require(_0x196c('0x9a'))[_0x196c('0x9b')](path['join'](__dirname,_0x196c('0x9c'),_0x452b1c[_0x196c('0x8e')]),[_0x452b1c['id'],_0x43995a['toString'](),path['join'](__dirname,_0x196c('0x9d'),_0x452b1c[_0x196c('0x9e')]),_0x182a74]);return _0x452b1c;}else{var _0x36e32f=squel[_0x196c('0x6c')]();_0x36e32f[_0x196c('0x6d')]('('+_0x43995a[_0x196c('0x85')]()+')','countTable');_0x36e32f[_0x196c('0x64')]('COUNT(*)',_0x196c('0x1e'));_0x43995a[_0x196c('0x1d')](_0x1cf5a0[_0x196c('0x1d')]||_0x346cc7);_0x43995a['offset'](_0x1cf5a0[_0x196c('0x1b')]||0x0);return dbH[_0x196c('0x84')][_0x196c('0x2f')](_0x36e32f[_0x196c('0x85')](),{'type':dbH[_0x196c('0x84')][_0x196c('0x86')][_0x196c('0x87')]})[_0x196c('0x23')](function(_0x1cc619){if(!_0x1cc619['length']){_0x52afd4=0x0;}else{_0x52afd4=_0x1cc619[0x0][_0x196c('0x1e')]||0x0;}return dbH['sequelize'][_0x196c('0x2f')](_0x43995a[_0x196c('0x85')](),{'type':dbH[_0x196c('0x84')]['QueryTypes'][_0x196c('0x87')]});})[_0x196c('0x23')](function(_0x486d48){return{'rows':_0x486d48||[],'count':_0x52afd4};});}});}exports[_0x196c('0x9f')]=function(_0x35a90,_0x212686){return runReport(_0x35a90[_0x196c('0x42')],_0x35a90[_0x196c('0x2f')],_0x35a90['options'])[_0x196c('0x23')](respondWithResult(_0x212686,null))['catch'](handleError(_0x212686,null));};exports[_0x196c('0xa0')]=runReport;exports[_0x196c('0x2f')]=function(_0x1b8f99,_0x3661e4){var _0x1aa0ca=0xa;var _0x1d8936=['join',_0x196c('0x52'),'right_join',_0x196c('0x53')];var _0x545a56={'SUM':_0x196c('0x54'),'COUNT':_0x196c('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x196c('0x88'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x196c('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4b9c10={'SEC_TO_TIME':_0x196c('0x5a'),'DATE':_0x196c('0x5b'),'HOUR':_0x196c('0x5c'),'ROUND':_0x196c('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4e6843=function(_0x3b7584){return!_['includes']([_0x196c('0x5e'),_0x196c('0x5f'),_0x196c('0x60'),_0x196c('0x61')],_0x3b7584);};var _0x346561=function(_0x5f03e4){if(!_0x5f03e4||!_0x5f03e4[_0x196c('0x62')][_0x196c('0x35')]){return'';}for(var _0x4a665f='(',_0x5ef8d4=0x0;_0x5ef8d4<_0x5f03e4[_0x196c('0x62')][_0x196c('0x35')];_0x5ef8d4+=0x1){_0x5ef8d4>0x0&&(_0x4a665f+='\x20'+_0x5f03e4[_0x196c('0x8c')]+'\x20');_0x4a665f+=_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x63')]?_0x346561(_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x63')]):_0x5f03e4[_0x196c('0x62')][_0x5ef8d4]['field']+'\x20'+_0x5f03e4[_0x196c('0x62')][_0x5ef8d4]['condition']+(_0x4e6843(_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x65')])?'\x20'+_0x5f03e4[_0x196c('0x62')][_0x5ef8d4][_0x196c('0x66')]:'');}return _0x4a665f+')';};var _0x3ed925={'where':{'id':_0x1b8f99[_0x196c('0x42')]['id']}},_0x1f8565,_0x340fcf,_0x526627,_0x830ae4,_0x27d054;_0x3ed925=_['merge']({},_0x3ed925,_0x1b8f99[_0x196c('0x3c')]);return db[_0x196c('0x2c')][_0x196c('0x44')](_0x3ed925)['then'](function(_0x1c7252){if(_0x1c7252){_0x1f8565=_0x1c7252;return _0x1c7252['getFields']();}return null;})[_0x196c('0x23')](function(_0x5b620f){if(_0x5b620f){if(!_0x5b620f[_0x196c('0x35')]){throw new db[(_0x196c('0x68'))][(_0x196c('0x8d'))](_0x196c('0x69'),0x193);}_0x340fcf=_0x5b620f;return db[_0x196c('0x6a')][_0x196c('0x3e')]({'raw':!![]});}return null;})[_0x196c('0x23')](function(_0xe511a){if(_0xe511a){_0x526627=_[_0x196c('0x6b')](_0xe511a,'id');var _0x38939a;var _0x1e9134=squel[_0x196c('0x6c')]();_0x1e9134[_0x196c('0x6d')](_0x1f8565[_0x196c('0x6e')]);for(var _0x143823=0x0;_0x143823<_0x340fcf['length'];_0x143823+=0x1){_0x38939a=_0x340fcf[_0x143823][_0x196c('0x6f')]?_0x526627[_0x340fcf[_0x143823]['MetricId']]['metric']:_0x340fcf[_0x143823][_0x196c('0x64')];_0x38939a=_0x340fcf[_0x143823][_0x196c('0x71')]?_['replace'](_0x545a56[_0x340fcf[_0x143823][_0x196c('0x71')]],'%s',_0x38939a):_0x38939a;_0x38939a=_0x340fcf[_0x143823][_0x196c('0x7d')]?_[_0x196c('0x72')](_0x4b9c10[_0x340fcf[_0x143823][_0x196c('0x7d')]],'%s',_0x38939a):_0x38939a;if(_0x340fcf[_0x143823]['groupBy']){_0x1e9134[_0x196c('0x63')](_0x38939a);}_0x340fcf[_0x143823][_0x196c('0x74')]&&_0x1e9134['order'](_0x38939a,_0x340fcf[_0x143823]['orderBy']===_0x196c('0x75')?![]:!![]);_0x1e9134[_0x196c('0x64')](_0x38939a,_0x340fcf[_0x143823]['alias']||_0x38939a);}if(_0x1f8565[_0x196c('0x77')]){_0x1f8565[_0x196c('0x77')]=JSON[_0x196c('0x78')](_0x1f8565[_0x196c('0x77')]);for(var _0x61cf23=0x0;_0x61cf23<_0x1f8565[_0x196c('0x77')][_0x196c('0x35')];_0x61cf23+=0x1){if(_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x79')]&&_[_0x196c('0x7a')](_0x1d8936,_0x1f8565['joins'][_0x61cf23]['type'])&&_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7f')]&&_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7b')]&&_0x1f8565['joins'][_0x61cf23]['foreignKey']){_0x1e9134[_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x79')]](_0x1f8565['joins'][_0x61cf23]['foreignTable'],null,util[_0x196c('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1f8565[_0x196c('0x6e')],_0x1f8565[_0x196c('0x77')][_0x61cf23]['parentKey'],_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7b')],_0x1f8565[_0x196c('0x77')][_0x61cf23][_0x196c('0x7c')]));}}}if(_0x1f8565[_0x196c('0x80')]){_0x1f8565[_0x196c('0x80')]=JSON[_0x196c('0x78')](_0x1f8565[_0x196c('0x80')]);_0x1e9134[_0x196c('0x38')](_0x346561(_0x1f8565['conditions'][_0x196c('0x63')]));}_0x27d054=_0x1e9134[_0x196c('0x81')]();_0x1e9134[_0x196c('0x1d')](_0x1aa0ca);_0x1e9134[_0x196c('0x1b')](0x0);logger[_0x196c('0x82')](_0x196c('0x83'),_0x1e9134['toString']());return dbH[_0x196c('0x84')]['query'](_0x1e9134['toString'](),{'type':dbH[_0x196c('0x84')][_0x196c('0x86')]['SELECT']});}})[_0x196c('0x23')](function(){return{'sql':_0x27d054['toString']()};})[_0x196c('0x23')](respondWithResult(_0x3661e4,null))['catch'](handleError(_0x3661e4,null));}; \ No newline at end of file +var _0xf590=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','get','CustomReports','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','keys','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','preview','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','select','table','MetricId','metric','replace','function','groupBy','orderBy','alias','joins','parse','type','includes','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','toString','sequelize','join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','value','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','web','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','SELECT','QueryTypes','run','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','options','AnalyticMetric','DESC','eml-format','zip-dir','request-promise','moment'];(function(_0x5e6871,_0x2d36a0){var _0x4f4a0a=function(_0x550926){while(--_0x550926){_0x5e6871['push'](_0x5e6871['shift']());}};_0x4f4a0a(++_0x2d36a0);}(_0xf590,0x1e2));var _0x0f59=function(_0x493376,_0x49d7f7){_0x493376=_0x493376-0x0;var _0x29520c=_0xf590[_0x493376];return _0x29520c;};'use strict';var emlformat=require(_0x0f59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f59('0x2'));var moment=require(_0x0f59('0x3'));var BPromise=require(_0x0f59('0x4'));var Mustache=require(_0x0f59('0x5'));var util=require(_0x0f59('0x6'));var path=require(_0x0f59('0x7'));var sox=require(_0x0f59('0x8'));var csv=require(_0x0f59('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f59('0xa'));var _=require(_0x0f59('0xb'));var squel=require(_0x0f59('0xc'));var crypto=require('crypto');var jsforce=require(_0x0f59('0xd'));var deskjs=require(_0x0f59('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f59('0xf'));var Papa=require(_0x0f59('0x10'));var Redis=require(_0x0f59('0x11'));var authService=require(_0x0f59('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0f59('0x13'));var hardwareService=require(_0x0f59('0x14'));var logger=require(_0x0f59('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0f59('0x16'));var licenseUtil=require(_0x0f59('0x17'));var db=require(_0x0f59('0x18'))['db'];var dbH=require(_0x0f59('0x18'))[_0x0f59('0x19')];function respondWithStatusCode(_0x54fee2,_0x4c1f86){_0x4c1f86=_0x4c1f86||0xcc;return function(_0x5e1a21){if(_0x5e1a21){return _0x54fee2[_0x0f59('0x1a')](_0x4c1f86);}return _0x54fee2[_0x0f59('0x1b')](_0x4c1f86)[_0x0f59('0x1c')]();};}function respondWithResult(_0x4ec714,_0x2b8f42){_0x2b8f42=_0x2b8f42||0xc8;return function(_0x4bad2c){if(_0x4bad2c){return _0x4ec714[_0x0f59('0x1b')](_0x2b8f42)['json'](_0x4bad2c);}};}function respondWithFilteredResult(_0x26911e,_0x190ac5){return function(_0x4ecb66){if(_0x4ecb66){var _0x14242c=typeof _0x190ac5[_0x0f59('0x1d')]===_0x0f59('0x1e')&&typeof _0x190ac5[_0x0f59('0x1f')]==='undefined';var _0x24f766=_0x4ecb66[_0x0f59('0x20')];var _0x3fe737=_0x14242c?0x0:_0x190ac5['offset'];var _0x572bcb=_0x14242c?_0x4ecb66[_0x0f59('0x20')]:_0x190ac5[_0x0f59('0x1d')]+_0x190ac5['limit'];var _0x5910ef;if(_0x572bcb>=_0x24f766){_0x572bcb=_0x24f766;_0x5910ef=0xc8;}else{_0x5910ef=0xce;}_0x26911e[_0x0f59('0x1b')](_0x5910ef);return _0x26911e[_0x0f59('0x21')](_0x0f59('0x22'),_0x3fe737+'-'+_0x572bcb+'/'+_0x24f766)[_0x0f59('0x23')](_0x4ecb66);}return null;};}function patchUpdates(_0xf5acc4){return function(_0x4f1b45){try{jsonpatch['apply'](_0x4f1b45,_0xf5acc4,!![]);}catch(_0x5a75ff){return BPromise[_0x0f59('0x24')](_0x5a75ff);}return _0x4f1b45['save']();};}function saveUpdates(_0x1651e8,_0x49bfa8){return function(_0x4020d1){if(_0x4020d1){return _0x4020d1[_0x0f59('0x25')](_0x1651e8)['then'](function(_0x3754a3){return _0x3754a3;});}return null;};}function removeEntity(_0x548362,_0x30904a){return function(_0x46b6c2){if(_0x46b6c2){return _0x46b6c2[_0x0f59('0x26')]()[_0x0f59('0x27')](function(){var _0x93d02b=_0x46b6c2[_0x0f59('0x28')]({'plain':!![]});var _0xcd1189=_0x0f59('0x29');return db[_0x0f59('0x2a')][_0x0f59('0x26')]({'where':{'type':_0xcd1189,'resourceId':_0x93d02b['id']}})['then'](function(){return _0x46b6c2;});})['then'](function(){_0x548362[_0x0f59('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1b01e,_0x43e684){return function(_0x92a83f){if(!_0x92a83f){_0xd1b01e['sendStatus'](0x194);}return _0x92a83f;};}function handleError(_0x9368b9,_0xd1b4a1){_0xd1b4a1=_0xd1b4a1||0x1f4;return function(_0x1120b3){logger['error'](_0x1120b3[_0x0f59('0x2b')]);if(_0x1120b3[_0x0f59('0x2c')]){delete _0x1120b3['name'];}_0x9368b9[_0x0f59('0x1b')](_0xd1b4a1)[_0x0f59('0x2d')](_0x1120b3);};}exports[_0x0f59('0x2e')]=function(_0x21f167,_0xca733f){var _0x31cdf8={},_0x377c63={},_0x3a8db0={'count':0x0,'rows':[]};var _0x596272=_[_0x0f59('0x2f')](db[_0x0f59('0x30')][_0x0f59('0x31')],function(_0x22ffbe){return{'name':_0x22ffbe[_0x0f59('0x32')],'type':_0x22ffbe['type'][_0x0f59('0x33')]};});_0x377c63['model']=_[_0x0f59('0x2f')](_0x596272,'name');_0x377c63[_0x0f59('0x34')]=_['keys'](_0x21f167[_0x0f59('0x34')]);_0x377c63[_0x0f59('0x35')]=_[_0x0f59('0x36')](_0x377c63[_0x0f59('0x37')],_0x377c63[_0x0f59('0x34')]);_0x31cdf8['attributes']=_['intersection'](_0x377c63[_0x0f59('0x37')],qs['fields'](_0x21f167[_0x0f59('0x34')][_0x0f59('0x38')]));_0x31cdf8[_0x0f59('0x39')]=_0x31cdf8[_0x0f59('0x39')]['length']?_0x31cdf8[_0x0f59('0x39')]:_0x377c63[_0x0f59('0x37')];if(!_0x21f167[_0x0f59('0x34')]['hasOwnProperty'](_0x0f59('0x3a'))){_0x31cdf8[_0x0f59('0x1f')]=qs[_0x0f59('0x1f')](_0x21f167['query']['limit']);_0x31cdf8[_0x0f59('0x1d')]=qs['offset'](_0x21f167[_0x0f59('0x34')][_0x0f59('0x1d')]);}_0x31cdf8[_0x0f59('0x3b')]=qs[_0x0f59('0x3c')](_0x21f167[_0x0f59('0x34')][_0x0f59('0x3c')]);_0x31cdf8[_0x0f59('0x3d')]=qs['filters'](_['pick'](_0x21f167[_0x0f59('0x34')],_0x377c63['filters']),_0x596272);if(_0x21f167['query'][_0x0f59('0x3e')]){_0x31cdf8['where']=_['merge'](_0x31cdf8['where'],{'$or':_[_0x0f59('0x2f')](_0x596272,function(_0x3cae52){if(_0x3cae52['type']!==_0x0f59('0x3f')){var _0x4906bc={};_0x4906bc[_0x3cae52[_0x0f59('0x2c')]]={'$like':'%'+_0x21f167['query'][_0x0f59('0x3e')]+'%'};return _0x4906bc;}})});}_0x31cdf8=_[_0x0f59('0x40')]({},_0x31cdf8,_0x21f167['options']);var _0x12b2ca={'where':_0x31cdf8[_0x0f59('0x3d')]};return db[_0x0f59('0x30')]['count'](_0x12b2ca)[_0x0f59('0x27')](function(_0x1ef492){_0x3a8db0['count']=_0x1ef492;if(_0x21f167[_0x0f59('0x34')][_0x0f59('0x41')]){_0x31cdf8[_0x0f59('0x42')]=[{'all':!![]}];}return db[_0x0f59('0x30')][_0x0f59('0x43')](_0x31cdf8);})[_0x0f59('0x27')](function(_0x3b2e46){_0x3a8db0[_0x0f59('0x44')]=_0x3b2e46;return _0x3a8db0;})['then'](respondWithFilteredResult(_0xca733f,_0x31cdf8))['catch'](handleError(_0xca733f,null));};exports[_0x0f59('0x45')]=function(_0x5639e6,_0x4f580b){var _0x1f6ba0={'raw':![],'where':{'id':_0x5639e6['params']['id']}},_0x537911={};_0x537911[_0x0f59('0x37')]=_[_0x0f59('0x46')](db[_0x0f59('0x30')][_0x0f59('0x31')]);_0x537911[_0x0f59('0x34')]=_[_0x0f59('0x46')](_0x5639e6[_0x0f59('0x34')]);_0x537911[_0x0f59('0x35')]=_[_0x0f59('0x36')](_0x537911[_0x0f59('0x37')],_0x537911[_0x0f59('0x34')]);_0x1f6ba0[_0x0f59('0x39')]=_[_0x0f59('0x36')](_0x537911[_0x0f59('0x37')],qs['fields'](_0x5639e6['query'][_0x0f59('0x38')]));_0x1f6ba0['attributes']=_0x1f6ba0['attributes'][_0x0f59('0x47')]?_0x1f6ba0[_0x0f59('0x39')]:_0x537911[_0x0f59('0x37')];if(_0x5639e6[_0x0f59('0x34')]['includeAll']){_0x1f6ba0[_0x0f59('0x42')]=[{'all':!![]}];}_0x1f6ba0=_['merge']({},_0x1f6ba0,_0x5639e6['options']);return db[_0x0f59('0x30')]['find'](_0x1f6ba0)['then'](handleEntityNotFound(_0x4f580b,null))[_0x0f59('0x27')](respondWithResult(_0x4f580b,null))[_0x0f59('0x48')](handleError(_0x4f580b,null));};exports['create']=function(_0x391dfe,_0x1751fa){return db[_0x0f59('0x30')][_0x0f59('0x49')](_0x391dfe[_0x0f59('0x4a')],{})[_0x0f59('0x27')](function(_0x4d173d){var _0x392b19=_0x391dfe[_0x0f59('0x4b')][_0x0f59('0x28')]({'plain':!![]});if(!_0x392b19)throw new Error(_0x0f59('0x4c'));if(_0x392b19[_0x0f59('0x4d')]===_0x0f59('0x4b')){var _0x30a54e=_0x4d173d['get']({'plain':!![]});var _0x35971c=_0x0f59('0x4e');return db[_0x0f59('0x4f')]['find']({'where':{'name':_0x35971c,'userProfileId':_0x392b19['userProfileId']},'raw':!![]})[_0x0f59('0x27')](function(_0x247a6d){if(_0x247a6d&&_0x247a6d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x30a54e[_0x0f59('0x2c')],'resourceId':_0x30a54e['id'],'type':_0x0f59('0x29'),'sectionId':_0x247a6d['id']},{})[_0x0f59('0x27')](function(){return _0x4d173d;});}else{return _0x4d173d;}})['catch'](function(_0x39eade){logger[_0x0f59('0x50')](_0x0f59('0x51'),_0x39eade);throw _0x39eade;});}return _0x4d173d;})['then'](respondWithResult(_0x1751fa,0xc9))[_0x0f59('0x48')](handleError(_0x1751fa,null));};exports[_0x0f59('0x25')]=function(_0x4d0d51,_0xa5c2c){if(_0x4d0d51[_0x0f59('0x4a')]['id']){delete _0x4d0d51[_0x0f59('0x4a')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x4d0d51[_0x0f59('0x52')]['id']}})['then'](handleEntityNotFound(_0xa5c2c,null))[_0x0f59('0x27')](saveUpdates(_0x4d0d51[_0x0f59('0x4a')],null))[_0x0f59('0x27')](respondWithResult(_0xa5c2c,null))[_0x0f59('0x48')](handleError(_0xa5c2c,null));};exports[_0x0f59('0x26')]=function(_0x307dbd,_0x604cc9){return db[_0x0f59('0x30')][_0x0f59('0x53')]({'where':{'id':_0x307dbd[_0x0f59('0x52')]['id']}})[_0x0f59('0x27')](handleEntityNotFound(_0x604cc9,null))['then'](removeEntity(_0x604cc9,null))['catch'](handleError(_0x604cc9,null));};exports[_0x0f59('0x54')]=function(_0x5d74d8,_0x345899){var _0x13a3de=0xa;var _0x3f43c6=['join',_0x0f59('0x55'),'right_join',_0x0f59('0x56')];var _0xa1c112={'SUM':_0x0f59('0x57'),'COUNT':_0x0f59('0x58'),'COUNT DISTINCT':_0x0f59('0x59'),'MAX':_0x0f59('0x5a'),'MIN':_0x0f59('0x5b'),'AVG':_0x0f59('0x5c'),'GROUP_CONCAT':_0x0f59('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x21ca6c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0f59('0x5e'),'HOUR':_0x0f59('0x5f'),'ROUND':_0x0f59('0x60'),'UNIX_TIMESTAMP':_0x0f59('0x61')};var _0x77c571=function(_0x4fee9d){return!_['includes'](['IS\x20NULL',_0x0f59('0x62'),'IS\x20EMPTY',_0x0f59('0x63')],_0x4fee9d);};var _0x1482c7=function(_0x2cc050){if(!_0x2cc050||!_0x2cc050[_0x0f59('0x64')]['length']){return'';}for(var _0x52c258='(',_0xfa80a4=0x0;_0xfa80a4<_0x2cc050[_0x0f59('0x64')][_0x0f59('0x47')];_0xfa80a4+=0x1){_0xfa80a4>0x0&&(_0x52c258+='\x20'+_0x2cc050[_0x0f59('0x65')]+'\x20');_0x52c258+=_0x2cc050[_0x0f59('0x64')][_0xfa80a4][_0x0f59('0x66')]?_0x1482c7(_0x2cc050[_0x0f59('0x64')][_0xfa80a4][_0x0f59('0x66')]):_0x2cc050[_0x0f59('0x64')][_0xfa80a4][_0x0f59('0x67')]+'\x20'+_0x2cc050['rules'][_0xfa80a4]['condition']+(_0x77c571(_0x2cc050['rules'][_0xfa80a4][_0x0f59('0x68')])?'\x20'+_0x2cc050[_0x0f59('0x64')][_0xfa80a4]['value']:'');}return _0x52c258+')';};var _0x25912b={'where':{'id':_0x5d74d8[_0x0f59('0x52')]['id']}},_0xeb5777,_0x591e82,_0x2aab89,_0x263ef9,_0x5bc1cb;_0x25912b=_[_0x0f59('0x40')]({},_0x25912b,_0x5d74d8['options']);return db['AnalyticCustomReport']['find'](_0x25912b)[_0x0f59('0x27')](function(_0x123241){if(_0x123241){_0xeb5777=_0x123241;return _0x123241[_0x0f59('0x69')]();}return null;})[_0x0f59('0x27')](function(_0x19729b){if(_0x19729b){if(!_0x19729b[_0x0f59('0x47')]){throw new db[(_0x0f59('0x6a'))][(_0x0f59('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x591e82=_0x19729b;return db['AnalyticMetric'][_0x0f59('0x43')]({'raw':!![]});}return null;})[_0x0f59('0x27')](function(_0x62cb20){if(_0x62cb20){_0x2aab89=_['keyBy'](_0x62cb20,'id');var _0xbbed75;var _0xbe25fa=squel[_0x0f59('0x6c')]();_0xbe25fa['from'](_0xeb5777[_0x0f59('0x6d')]);for(var _0xf83c28=0x0;_0xf83c28<_0x591e82[_0x0f59('0x47')];_0xf83c28+=0x1){_0xbbed75=_0x591e82[_0xf83c28][_0x0f59('0x6e')]?_0x2aab89[_0x591e82[_0xf83c28]['MetricId']][_0x0f59('0x6f')]:_0x591e82[_0xf83c28][_0x0f59('0x67')];_0xbbed75=_0x591e82[_0xf83c28]['function']?_[_0x0f59('0x70')](_0xa1c112[_0x591e82[_0xf83c28][_0x0f59('0x71')]],'%s',_0xbbed75):_0xbbed75;_0xbbed75=_0x591e82[_0xf83c28]['format']?_[_0x0f59('0x70')](_0x21ca6c[_0x591e82[_0xf83c28]['format']],'%s',_0xbbed75):_0xbbed75;if(_0x591e82[_0xf83c28][_0x0f59('0x72')]){_0xbe25fa[_0x0f59('0x66')](_0xbbed75);}_0x591e82[_0xf83c28][_0x0f59('0x73')]&&_0xbe25fa[_0x0f59('0x3b')](_0xbbed75,_0x591e82[_0xf83c28][_0x0f59('0x73')]==='DESC'?![]:!![]);_0xbe25fa[_0x0f59('0x67')](_0xbbed75,_0x591e82[_0xf83c28][_0x0f59('0x74')]||_0xbbed75);}if(_0xeb5777['joins']){_0xeb5777[_0x0f59('0x75')]=JSON[_0x0f59('0x76')](_0xeb5777[_0x0f59('0x75')]);for(var _0x144358=0x0;_0x144358<_0xeb5777[_0x0f59('0x75')][_0x0f59('0x47')];_0x144358+=0x1){if(_0xeb5777[_0x0f59('0x75')][_0x144358][_0x0f59('0x77')]&&_[_0x0f59('0x78')](_0x3f43c6,_0xeb5777[_0x0f59('0x75')][_0x144358][_0x0f59('0x77')])&&_0xeb5777[_0x0f59('0x75')][_0x144358]['parentKey']&&_0xeb5777[_0x0f59('0x75')][_0x144358][_0x0f59('0x79')]&&_0xeb5777['joins'][_0x144358][_0x0f59('0x7a')]){_0xbe25fa[_0xeb5777['joins'][_0x144358]['type']](_0xeb5777[_0x0f59('0x75')][_0x144358]['foreignTable'],null,util[_0x0f59('0x7b')](_0x0f59('0x7c'),_0xeb5777[_0x0f59('0x6d')],_0xeb5777[_0x0f59('0x75')][_0x144358][_0x0f59('0x7d')],_0xeb5777[_0x0f59('0x75')][_0x144358]['foreignTable'],_0xeb5777[_0x0f59('0x75')][_0x144358][_0x0f59('0x7a')]));}}}if(_0xeb5777['conditions']){_0xeb5777[_0x0f59('0x7e')]=JSON[_0x0f59('0x76')](_0xeb5777['conditions']);_0xbe25fa[_0x0f59('0x3d')](_0x1482c7(_0xeb5777['conditions']['group']));}_0x5bc1cb=_0xbe25fa[_0x0f59('0x7f')]();_0xbe25fa[_0x0f59('0x1f')](_0x13a3de);_0xbe25fa[_0x0f59('0x1d')](0x0);logger[_0x0f59('0x80')]('Limited\x20Query:',_0xbe25fa[_0x0f59('0x81')]());return dbH[_0x0f59('0x82')][_0x0f59('0x34')](_0xbe25fa['toString'](),{'type':dbH[_0x0f59('0x82')]['QueryTypes']['SELECT']});}})[_0x0f59('0x27')](respondWithResult(_0x345899,null))[_0x0f59('0x48')](handleError(_0x345899,null));};function runReport(_0x213140,_0x465438,_0x43542f){var _0x1e528f=_0x465438[_0x0f59('0x2c')];var _0xc45e26=0xa;var _0x11918e=[_0x0f59('0x83'),_0x0f59('0x55'),_0x0f59('0x84'),'cross_join'];var _0x1f775c={'SUM':'SUM(%s)','COUNT':_0x0f59('0x58'),'COUNT DISTINCT':_0x0f59('0x59'),'MAX':_0x0f59('0x5a'),'MIN':_0x0f59('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0f59('0x5d'),'GROUP_CONCAT ASC':_0x0f59('0x85'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc0dfe5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0f59('0x61')};var _0x5e93f3=function(_0x37a422){return!_[_0x0f59('0x78')]([_0x0f59('0x86'),_0x0f59('0x62'),'IS\x20EMPTY',_0x0f59('0x63')],_0x37a422);};var _0x20f228=function(_0x4fc2a0){if(!_0x4fc2a0||!_0x4fc2a0[_0x0f59('0x64')][_0x0f59('0x47')]){return'';}for(var _0x164fcc='(',_0x4c841b=0x0;_0x4c841b<_0x4fc2a0[_0x0f59('0x64')][_0x0f59('0x47')];_0x4c841b+=0x1){_0x4c841b>0x0&&(_0x164fcc+='\x20'+_0x4fc2a0['operator']+'\x20');_0x164fcc+=_0x4fc2a0[_0x0f59('0x64')][_0x4c841b][_0x0f59('0x66')]?_0x20f228(_0x4fc2a0[_0x0f59('0x64')][_0x4c841b][_0x0f59('0x66')]):_0x4fc2a0['rules'][_0x4c841b]['field']+'\x20'+_0x4fc2a0['rules'][_0x4c841b][_0x0f59('0x68')]+(_0x5e93f3(_0x4fc2a0[_0x0f59('0x64')][_0x4c841b][_0x0f59('0x68')])?'\x20'+_0x4fc2a0[_0x0f59('0x64')][_0x4c841b][_0x0f59('0x87')]:'');}return _0x164fcc+')';};var _0x55094c={'where':{'id':_0x213140['id']}},_0x310b22,_0x5d2449,_0x567198,_0x163214,_0x5b67b1;_0x55094c=_[_0x0f59('0x40')]({},_0x55094c,_0x43542f);return db[_0x0f59('0x30')][_0x0f59('0x53')](_0x55094c)[_0x0f59('0x27')](function(_0x59a2c0){if(_0x59a2c0){_0x310b22=_0x59a2c0;return _0x59a2c0[_0x0f59('0x69')]();}return null;})[_0x0f59('0x27')](function(_0x4e7610){if(_0x4e7610){if(!_0x4e7610[_0x0f59('0x47')]){throw new db[(_0x0f59('0x6a'))]['ValidationErrorItem'](_0x0f59('0x88'),0x193);}_0x5d2449=_0x4e7610;return db['AnalyticMetric'][_0x0f59('0x43')]({'raw':!![]});}return null;})[_0x0f59('0x27')](function(_0xdbf29b){if(_0xdbf29b){_0x567198=_[_0x0f59('0x89')](_0xdbf29b,'id');var _0x39f7fa;var _0x5e7ecc=squel[_0x0f59('0x6c')]();_0x5e7ecc[_0x0f59('0x8a')](_0x310b22[_0x0f59('0x6d')]);for(var _0x4c9f2b=0x0;_0x4c9f2b<_0x5d2449[_0x0f59('0x47')];_0x4c9f2b+=0x1){_0x39f7fa=_0x5d2449[_0x4c9f2b]['MetricId']?_0x567198[_0x5d2449[_0x4c9f2b]['MetricId']][_0x0f59('0x6f')]:_0x5d2449[_0x4c9f2b][_0x0f59('0x67')];_0x39f7fa=_0x5d2449[_0x4c9f2b]['function']?_['replace'](_0x1f775c[_0x5d2449[_0x4c9f2b]['function']],'%s',_0x39f7fa):_0x39f7fa;_0x39f7fa=_0x5d2449[_0x4c9f2b][_0x0f59('0x7b')]?_[_0x0f59('0x70')](_0xc0dfe5[_0x5d2449[_0x4c9f2b][_0x0f59('0x7b')]],'%s',_0x39f7fa):_0x39f7fa;if(_0x5d2449[_0x4c9f2b][_0x0f59('0x72')]){_0x5e7ecc['group'](_0x39f7fa);}_0x5d2449[_0x4c9f2b][_0x0f59('0x73')]&&_0x5e7ecc[_0x0f59('0x3b')](_0x39f7fa,_0x5d2449[_0x4c9f2b][_0x0f59('0x73')]==='DESC'?![]:!![]);_0x5e7ecc[_0x0f59('0x67')](_0x39f7fa,_0x5d2449[_0x4c9f2b][_0x0f59('0x74')]||_0x39f7fa);}if(_0x310b22['joins']){_0x310b22['joins']=JSON[_0x0f59('0x76')](_0x310b22['joins']);for(var _0x2c2be2=0x0;_0x2c2be2<_0x310b22['joins']['length'];_0x2c2be2+=0x1){if(_0x310b22[_0x0f59('0x75')][_0x2c2be2][_0x0f59('0x77')]&&_[_0x0f59('0x78')](_0x11918e,_0x310b22[_0x0f59('0x75')][_0x2c2be2][_0x0f59('0x77')])&&_0x310b22['joins'][_0x2c2be2][_0x0f59('0x7d')]&&_0x310b22['joins'][_0x2c2be2][_0x0f59('0x79')]&&_0x310b22[_0x0f59('0x75')][_0x2c2be2]['foreignKey']){_0x5e7ecc[_0x310b22[_0x0f59('0x75')][_0x2c2be2][_0x0f59('0x77')]](_0x310b22['joins'][_0x2c2be2][_0x0f59('0x79')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x310b22[_0x0f59('0x6d')],_0x310b22[_0x0f59('0x75')][_0x2c2be2][_0x0f59('0x7d')],_0x310b22[_0x0f59('0x75')][_0x2c2be2][_0x0f59('0x79')],_0x310b22['joins'][_0x2c2be2][_0x0f59('0x7a')]));}}}if(_0x310b22[_0x0f59('0x7e')]){_0x310b22['conditions']=JSON[_0x0f59('0x76')](_0x310b22[_0x0f59('0x7e')]);_0x5e7ecc['where'](_0x20f228(_0x310b22[_0x0f59('0x7e')][_0x0f59('0x66')]));}_0x5b67b1=_0x5e7ecc[_0x0f59('0x7f')]();_0x5e7ecc['limit'](_0xc45e26);_0x5e7ecc['offset'](0x0);return;}})[_0x0f59('0x27')](function(){if(_0x465438['output']===_0x0f59('0x8b')){return null;}var _0x208a40=_[_0x0f59('0x40')](_0x465438,{'name':_0x465438['fullPath']||_0x465438['name']||_0x310b22[_0x0f59('0x2c')],'basename':_0x1e528f,'savename':util[_0x0f59('0x7b')](_0x0f59('0x8c'),_0x465438[_0x0f59('0x2c')]||_0x310b22['name'],require(_0x0f59('0x8d'))['generate'](0x4),_0x465438['output']||_0x0f59('0x8e')),'reportId':_0x310b22['id'],'reportType':_0x0f59('0x8f')});return db['AnalyticExtractedReport']['create'](_0x208a40,{'raw':!![]});})[_0x0f59('0x27')](function(_0x211ab9){if(_0x310b22[_0x0f59('0x6d')]===_0x0f59('0x90')){_0x5b67b1['where'](_0x310b22['table']+_0x0f59('0x91'),_0x465438['startDate'],_0x465438['endDate']);}else{_0x5b67b1[_0x0f59('0x3d')](_0x310b22[_0x0f59('0x6d')]+_0x0f59('0x92'),_0x465438['startDate'],_0x465438['endDate']);}if(_0x211ab9){logger[_0x0f59('0x93')]('Run\x20Query:',_0x5b67b1['toString']());require(_0x0f59('0x94'))[_0x0f59('0x95')](path[_0x0f59('0x83')](__dirname,_0x0f59('0x96'),_0x211ab9['output']),[_0x211ab9['id'],_0x5b67b1[_0x0f59('0x81')](),path[_0x0f59('0x83')](__dirname,_0x0f59('0x97'),_0x211ab9[_0x0f59('0x98')]),_0x1e528f]);return _0x211ab9;}else{var _0x3ada0d=squel['select']();_0x3ada0d[_0x0f59('0x8a')]('('+_0x5b67b1[_0x0f59('0x81')]()+')',_0x0f59('0x99'));_0x3ada0d[_0x0f59('0x67')]('COUNT(*)',_0x0f59('0x20'));_0x5b67b1[_0x0f59('0x1f')](_0x465438[_0x0f59('0x1f')]||_0xc45e26);_0x5b67b1[_0x0f59('0x1d')](_0x465438[_0x0f59('0x1d')]||0x0);return dbH[_0x0f59('0x82')]['query'](_0x3ada0d['toString'](),{'type':dbH[_0x0f59('0x82')]['QueryTypes'][_0x0f59('0x9a')]})[_0x0f59('0x27')](function(_0x46210d){if(!_0x46210d[_0x0f59('0x47')]){_0x163214=0x0;}else{_0x163214=_0x46210d[0x0][_0x0f59('0x20')]||0x0;}return dbH[_0x0f59('0x82')][_0x0f59('0x34')](_0x5b67b1[_0x0f59('0x81')](),{'type':dbH[_0x0f59('0x82')][_0x0f59('0x9b')][_0x0f59('0x9a')]});})[_0x0f59('0x27')](function(_0xcd9e22){return{'rows':_0xcd9e22||[],'count':_0x163214};});}});}exports[_0x0f59('0x9c')]=function(_0xd8126,_0x414893){return runReport(_0xd8126[_0x0f59('0x52')],_0xd8126[_0x0f59('0x34')],_0xd8126['options'])[_0x0f59('0x27')](respondWithResult(_0x414893,null))[_0x0f59('0x48')](handleError(_0x414893,null));};exports['runReport']=runReport;exports[_0x0f59('0x34')]=function(_0x23abff,_0x2525c2){var _0x2d37b1=0xa;var _0x20d621=['join',_0x0f59('0x55'),_0x0f59('0x84'),'cross_join'];var _0x37ea60={'SUM':_0x0f59('0x57'),'COUNT':_0x0f59('0x58'),'COUNT DISTINCT':_0x0f59('0x59'),'MAX':'MAX(%s)','MIN':_0x0f59('0x5b'),'AVG':_0x0f59('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0f59('0x9d')};var _0x3d925d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0f59('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x0f59('0x60'),'UNIX_TIMESTAMP':_0x0f59('0x61')};var _0x341ebb=function(_0x2b5be1){return!_['includes'](['IS\x20NULL',_0x0f59('0x62'),_0x0f59('0x9e'),_0x0f59('0x63')],_0x2b5be1);};var _0xeb8fc2=function(_0x18a2f8){if(!_0x18a2f8||!_0x18a2f8[_0x0f59('0x64')][_0x0f59('0x47')]){return'';}for(var _0x3bd905='(',_0x468b04=0x0;_0x468b04<_0x18a2f8['rules'][_0x0f59('0x47')];_0x468b04+=0x1){_0x468b04>0x0&&(_0x3bd905+='\x20'+_0x18a2f8['operator']+'\x20');_0x3bd905+=_0x18a2f8[_0x0f59('0x64')][_0x468b04][_0x0f59('0x66')]?_0xeb8fc2(_0x18a2f8['rules'][_0x468b04][_0x0f59('0x66')]):_0x18a2f8[_0x0f59('0x64')][_0x468b04][_0x0f59('0x67')]+'\x20'+_0x18a2f8['rules'][_0x468b04][_0x0f59('0x68')]+(_0x341ebb(_0x18a2f8[_0x0f59('0x64')][_0x468b04][_0x0f59('0x68')])?'\x20'+_0x18a2f8['rules'][_0x468b04][_0x0f59('0x87')]:'');}return _0x3bd905+')';};var _0x58c72a={'where':{'id':_0x23abff[_0x0f59('0x52')]['id']}},_0x470e00,_0x40785b,_0x5d462f,_0x21bb9f,_0x3c947a;_0x58c72a=_[_0x0f59('0x40')]({},_0x58c72a,_0x23abff[_0x0f59('0x9f')]);return db[_0x0f59('0x30')]['find'](_0x58c72a)[_0x0f59('0x27')](function(_0x2b1e0c){if(_0x2b1e0c){_0x470e00=_0x2b1e0c;return _0x2b1e0c[_0x0f59('0x69')]();}return null;})[_0x0f59('0x27')](function(_0x255c39){if(_0x255c39){if(!_0x255c39['length']){throw new db[(_0x0f59('0x6a'))][(_0x0f59('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x40785b=_0x255c39;return db[_0x0f59('0xa0')][_0x0f59('0x43')]({'raw':!![]});}return null;})[_0x0f59('0x27')](function(_0x3fd4b4){if(_0x3fd4b4){_0x5d462f=_[_0x0f59('0x89')](_0x3fd4b4,'id');var _0x1468b5;var _0xdbc20a=squel[_0x0f59('0x6c')]();_0xdbc20a[_0x0f59('0x8a')](_0x470e00[_0x0f59('0x6d')]);for(var _0xf34dfb=0x0;_0xf34dfb<_0x40785b[_0x0f59('0x47')];_0xf34dfb+=0x1){_0x1468b5=_0x40785b[_0xf34dfb][_0x0f59('0x6e')]?_0x5d462f[_0x40785b[_0xf34dfb][_0x0f59('0x6e')]][_0x0f59('0x6f')]:_0x40785b[_0xf34dfb]['field'];_0x1468b5=_0x40785b[_0xf34dfb][_0x0f59('0x71')]?_[_0x0f59('0x70')](_0x37ea60[_0x40785b[_0xf34dfb][_0x0f59('0x71')]],'%s',_0x1468b5):_0x1468b5;_0x1468b5=_0x40785b[_0xf34dfb][_0x0f59('0x7b')]?_[_0x0f59('0x70')](_0x3d925d[_0x40785b[_0xf34dfb][_0x0f59('0x7b')]],'%s',_0x1468b5):_0x1468b5;if(_0x40785b[_0xf34dfb][_0x0f59('0x72')]){_0xdbc20a['group'](_0x1468b5);}_0x40785b[_0xf34dfb]['orderBy']&&_0xdbc20a[_0x0f59('0x3b')](_0x1468b5,_0x40785b[_0xf34dfb]['orderBy']===_0x0f59('0xa1')?![]:!![]);_0xdbc20a[_0x0f59('0x67')](_0x1468b5,_0x40785b[_0xf34dfb][_0x0f59('0x74')]||_0x1468b5);}if(_0x470e00[_0x0f59('0x75')]){_0x470e00['joins']=JSON[_0x0f59('0x76')](_0x470e00[_0x0f59('0x75')]);for(var _0x4752f7=0x0;_0x4752f7<_0x470e00[_0x0f59('0x75')]['length'];_0x4752f7+=0x1){if(_0x470e00[_0x0f59('0x75')][_0x4752f7]['type']&&_['includes'](_0x20d621,_0x470e00[_0x0f59('0x75')][_0x4752f7][_0x0f59('0x77')])&&_0x470e00['joins'][_0x4752f7][_0x0f59('0x7d')]&&_0x470e00[_0x0f59('0x75')][_0x4752f7][_0x0f59('0x79')]&&_0x470e00['joins'][_0x4752f7]['foreignKey']){_0xdbc20a[_0x470e00[_0x0f59('0x75')][_0x4752f7][_0x0f59('0x77')]](_0x470e00[_0x0f59('0x75')][_0x4752f7][_0x0f59('0x79')],null,util[_0x0f59('0x7b')](_0x0f59('0x7c'),_0x470e00[_0x0f59('0x6d')],_0x470e00[_0x0f59('0x75')][_0x4752f7][_0x0f59('0x7d')],_0x470e00['joins'][_0x4752f7][_0x0f59('0x79')],_0x470e00['joins'][_0x4752f7][_0x0f59('0x7a')]));}}}if(_0x470e00['conditions']){_0x470e00[_0x0f59('0x7e')]=JSON['parse'](_0x470e00[_0x0f59('0x7e')]);_0xdbc20a['where'](_0xeb8fc2(_0x470e00['conditions'][_0x0f59('0x66')]));}_0x3c947a=_0xdbc20a['clone']();_0xdbc20a['limit'](_0x2d37b1);_0xdbc20a['offset'](0x0);logger[_0x0f59('0x80')]('Limited\x20Query:',_0xdbc20a[_0x0f59('0x81')]());return dbH[_0x0f59('0x82')][_0x0f59('0x34')](_0xdbc20a[_0x0f59('0x81')](),{'type':dbH[_0x0f59('0x82')]['QueryTypes'][_0x0f59('0x9a')]});}})['then'](function(){return{'sql':_0x3c947a[_0x0f59('0x81')]()};})[_0x0f59('0x27')](respondWithResult(_0x2525c2,null))[_0x0f59('0x48')](handleError(_0x2525c2,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b5dbde8..6f7f81c 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 _0xd2ec=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment'];(function(_0x5ac7d7,_0x109040){var _0x23955f=function(_0x52a2ac){while(--_0x52a2ac){_0x5ac7d7['push'](_0x5ac7d7['shift']());}};_0x23955f(++_0x109040);}(_0xd2ec,0x17b));var _0xcd2e=function(_0x3b811c,_0x1e5435){_0x3b811c=_0x3b811c-0x0;var _0x126b18=_0xd2ec[_0x3b811c];return _0x126b18;};'use strict';var _=require(_0xcd2e('0x0'));var util=require(_0xcd2e('0x1'));var logger=require(_0xcd2e('0x2'))(_0xcd2e('0x3'));var moment=require(_0xcd2e('0x4'));var BPromise=require(_0xcd2e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd2e('0x6'));var rimraf=require(_0xcd2e('0x7'));var config=require(_0xcd2e('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xcd2e('0x9')]=function(_0x3a72b2,_0x164760){return _0x3a72b2[_0xcd2e('0xa')](_0xcd2e('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ee=['../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x57ee,0x15a));var _0xe57e=function(_0x329e24,_0x49a71d){_0x329e24=_0x329e24-0x0;var _0x382256=_0x57ee[_0x329e24];return _0x382256;};'use strict';var _=require(_0xe57e('0x0'));var util=require('util');var logger=require(_0xe57e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe57e('0x2'));var rp=require(_0xe57e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe57e('0x4'));var config=require(_0xe57e('0x5'));var attributes=require(_0xe57e('0x6'));module[_0xe57e('0x7')]=function(_0x9c1f6e,_0x4a73e0){return _0x9c1f6e['define']('AnalyticCustomReport',attributes,{'tableName':_0xe57e('0x8'),'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 e830d30..841c014 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 _0x530f=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x17323e,_0x3ed331){var _0x577592=function(_0xe72d15){while(--_0xe72d15){_0x17323e['push'](_0x17323e['shift']());}};_0x577592(++_0x3ed331);}(_0x530f,0x1a6));var _0xf530=function(_0x426dd2,_0x4b0012){_0x426dd2=_0x426dd2-0x0;var _0x4bc76c=_0x530f[_0x426dd2];return _0x4bc76c;};'use strict';var _=require(_0xf530('0x0'));var util=require(_0xf530('0x1'));var moment=require('moment');var BPromise=require(_0xf530('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf530('0x3'));var db=require(_0xf530('0x4'))['db'];var utils=require(_0xf530('0x5'));var logger=require(_0xf530('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf530('0x7'));var client=jayson[_0xf530('0x8')][_0xf530('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2a9a,_0x436ebf,_0x57dab6){return new BPromise(function(_0x33384,_0x528d25){return client[_0xf530('0xa')](_0x4b2a9a,_0x57dab6)[_0xf530('0xb')](function(_0xe85709){logger[_0xf530('0xc')](_0xf530('0xd'),_0x436ebf,_0xf530('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x436ebf,'request\x20sent',JSON['stringify'](_0xe85709));if(_0xe85709[_0xf530('0xf')]){if(_0xe85709[_0xf530('0xf')]['code']===0x1f4){logger['error'](_0xf530('0xd'),_0x436ebf,_0xe85709['error'][_0xf530('0x10')]);return _0x528d25(_0xe85709[_0xf530('0xf')][_0xf530('0x10')]);}logger[_0xf530('0xf')](_0xf530('0xd'),_0x436ebf,_0xe85709[_0xf530('0xf')][_0xf530('0x10')]);return _0x33384(_0xe85709['error']['message']);}else{logger[_0xf530('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x436ebf,_0xf530('0xe'));_0x33384(_0xe85709['result']['message']);}})[_0xf530('0x11')](function(_0x2364fc){logger[_0xf530('0xf')](_0xf530('0xd'),_0x436ebf,_0x2364fc);_0x528d25(_0x2364fc);});});} \ No newline at end of file +var _0xc89a=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xc89a,0x13a));var _0xac89=function(_0x53045d,_0xb3467c){_0x53045d=_0x53045d-0x0;var _0x20baea=_0xc89a[_0x53045d];return _0x20baea;};'use strict';var _=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var moment=require('moment');var BPromise=require(_0xac89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac89('0x3'));var db=require(_0xac89('0x4'))['db'];var utils=require(_0xac89('0x5'));var logger=require(_0xac89('0x6'))(_0xac89('0x7'));var config=require('../../config/environment');var jayson=require(_0xac89('0x8'));var client=jayson[_0xac89('0x9')][_0xac89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209532,_0x301a71,_0x3b1b22){return new BPromise(function(_0x1b61ad,_0x2eafa8){return client[_0xac89('0xb')](_0x209532,_0x3b1b22)[_0xac89('0xc')](function(_0x548be7){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x301a71,_0xac89('0xd'));logger[_0xac89('0xe')](_0xac89('0xf'),_0x301a71,_0xac89('0xd'),JSON[_0xac89('0x10')](_0x548be7));if(_0x548be7[_0xac89('0x11')]){if(_0x548be7[_0xac89('0x11')][_0xac89('0x12')]===0x1f4){logger[_0xac89('0x11')](_0xac89('0x13'),_0x301a71,_0x548be7[_0xac89('0x11')][_0xac89('0x14')]);return _0x2eafa8(_0x548be7['error'][_0xac89('0x14')]);}logger['error'](_0xac89('0x13'),_0x301a71,_0x548be7[_0xac89('0x11')]['message']);return _0x1b61ad(_0x548be7['error'][_0xac89('0x14')]);}else{logger[_0xac89('0x15')](_0xac89('0x13'),_0x301a71,_0xac89('0xd'));_0x1b61ad(_0x548be7[_0xac89('0x16')]['message']);}})[_0xac89('0x17')](function(_0x46109a){logger[_0xac89('0x11')](_0xac89('0x13'),_0x301a71,_0x46109a);_0x2eafa8(_0x46109a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c2090d7..2d95c8e 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 _0xd213=['get','isAuthenticated','index','/:id','run','query','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57a6a6,_0x170131){var _0x1d29b9=function(_0x42dc4c){while(--_0x42dc4c){_0x57a6a6['push'](_0x57a6a6['shift']());}};_0x1d29b9(++_0x170131);}(_0xd213,0xca));var _0x3d21=function(_0x3416d1,_0xb068b7){_0x3416d1=_0x3416d1-0x0;var _0x47a68b=_0xd213[_0x3416d1];return _0x47a68b;};'use strict';var multer=require(_0x3d21('0x0'));var util=require('util');var path=require(_0x3d21('0x1'));var timeout=require(_0x3d21('0x2'));var express=require('express');var router=express[_0x3d21('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3d21('0x4'));var interaction=require(_0x3d21('0x5'));var config=require(_0x3d21('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x3d21('0x7')]('/',auth[_0x3d21('0x8')](),controller[_0x3d21('0x9')]);router['get'](_0x3d21('0xa'),auth[_0x3d21('0x8')](),controller['show']);router[_0x3d21('0x7')]('/:id/preview',auth[_0x3d21('0x8')](),controller['preview']);router[_0x3d21('0x7')]('/:id/run',auth[_0x3d21('0x8')](),controller[_0x3d21('0xb')]);router[_0x3d21('0x7')]('/:id/query',auth[_0x3d21('0x8')](),controller[_0x3d21('0xc')]);router['post']('/',auth[_0x3d21('0x8')](),controller[_0x3d21('0xd')]);router[_0x3d21('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3d21('0xf')]);router[_0x3d21('0x10')](_0x3d21('0xa'),auth[_0x3d21('0x8')](),controller[_0x3d21('0x11')]);module[_0x3d21('0x12')]=router; \ No newline at end of file +var _0x3e28=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','query','put','update','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33953a,_0x2e8798){var _0x1d099f=function(_0x178d27){while(--_0x178d27){_0x33953a['push'](_0x33953a['shift']());}};_0x1d099f(++_0x2e8798);}(_0x3e28,0xf0));var _0x83e2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x3e28[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require(_0x83e2('0x0'));var util=require('util');var path=require(_0x83e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x83e2('0x2'));var router=express[_0x83e2('0x3')]();var fs_extra=require(_0x83e2('0x4'));var auth=require(_0x83e2('0x5'));var interaction=require(_0x83e2('0x6'));var config=require(_0x83e2('0x7'));var controller=require(_0x83e2('0x8'));router[_0x83e2('0x9')]('/',auth[_0x83e2('0xa')](),controller[_0x83e2('0xb')]);router[_0x83e2('0x9')](_0x83e2('0xc'),auth[_0x83e2('0xa')](),controller['show']);router[_0x83e2('0x9')](_0x83e2('0xd'),auth[_0x83e2('0xa')](),controller[_0x83e2('0xe')]);router[_0x83e2('0x9')](_0x83e2('0xf'),auth[_0x83e2('0xa')](),controller['run']);router['get']('/:id/query',auth[_0x83e2('0xa')](),controller[_0x83e2('0x10')]);router['post']('/',auth[_0x83e2('0xa')](),controller['create']);router[_0x83e2('0x11')](_0x83e2('0xc'),auth[_0x83e2('0xa')](),controller[_0x83e2('0x12')]);router['delete'](_0x83e2('0xc'),auth[_0x83e2('0xa')](),controller['destroy']);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 bfca99e..956cd2b 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x2e7b8d,_0x3c8076){var _0x14b1ca=function(_0x2863da){while(--_0x2863da){_0x2e7b8d['push'](_0x2e7b8d['shift']());}};_0x14b1ca(++_0x3c8076);}(_0x33c5,0xe6));var _0x533c=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x33c5[_0x37cc52];return _0x2b4a90;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x21172c,_0x3a2bf0){var _0x4d8591=function(_0x2fe26c){while(--_0x2fe26c){_0x21172c['push'](_0x21172c['shift']());}};_0x4d8591(++_0x3a2bf0);}(_0xe14b,0x93));var _0xbe14=function(_0xc8ef0e,_0x11d492){_0xc8ef0e=_0xc8ef0e-0x0;var _0x3df0e8=_0xe14b[_0xc8ef0e];return _0x3df0e8;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ef6c546..f12cd65 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 _0x524e=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s)','debug','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','AnalyticDefaultReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','create','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','sequelize','toString','join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','from','clone','output','web','fullPath','generate','csv','default'];(function(_0x454cc9,_0x2dc258){var _0x538d36=function(_0x1b1655){while(--_0x1b1655){_0x454cc9['push'](_0x454cc9['shift']());}};_0x538d36(++_0x2dc258);}(_0x524e,0x15e));var _0xe524=function(_0x801fea,_0x246d11){_0x801fea=_0x801fea-0x0;var _0x341147=_0x524e[_0x801fea];return _0x341147;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xfdc2a5,_0x1541d8){_0x1541d8=_0x1541d8||0xcc;return function(_0x11adbc){if(_0x11adbc){return _0xfdc2a5[_0xe524('0x1c')](_0x1541d8);}return _0xfdc2a5[_0xe524('0x1d')](_0x1541d8)['end']();};}function respondWithResult(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xc8;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x1d')](_0x51e9fe)['json'](_0x19f013);}};}function respondWithFilteredResult(_0x569660,_0x488fce){return function(_0x109795){if(_0x109795){var _0x538754=typeof _0x488fce[_0xe524('0x1e')]==='undefined'&&typeof _0x488fce['limit']==='undefined';var _0x3a4027=_0x109795['count'];var _0x11b2a1=_0x538754?0x0:_0x488fce[_0xe524('0x1e')];var _0x278de9=_0x538754?_0x109795[_0xe524('0x1f')]:_0x488fce['offset']+_0x488fce[_0xe524('0x20')];var _0x3ccb3f;if(_0x278de9>=_0x3a4027){_0x278de9=_0x3a4027;_0x3ccb3f=0xc8;}else{_0x3ccb3f=0xce;}_0x569660['status'](_0x3ccb3f);return _0x569660[_0xe524('0x21')](_0xe524('0x22'),_0x11b2a1+'-'+_0x278de9+'/'+_0x3a4027)[_0xe524('0x23')](_0x109795);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x24')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x25')](_0xbf059b);}return _0x1c4194[_0xe524('0x26')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x27')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x28')]()['then'](function(){var _0x17e245=_0x599d5d[_0xe524('0x29')]({'plain':!![]});var _0xd62772=_0xe524('0x2a');return db[_0xe524('0x2b')][_0xe524('0x28')]({'where':{'type':_0xd62772,'resourceId':_0x17e245['id']}})[_0xe524('0x27')](function(){return _0x599d5d;});})['then'](function(){_0x1ad106['status'](0xcc)[_0xe524('0x2c')]();});}};}function handleEntityNotFound(_0x45abad,_0x476572){return function(_0x109a96){if(!_0x109a96){_0x45abad[_0xe524('0x1c')](0x194);}return _0x109a96;};}function handleError(_0x5405e4,_0x52f140){_0x52f140=_0x52f140||0x1f4;return function(_0x4b1ff){logger[_0xe524('0x2d')](_0x4b1ff[_0xe524('0x2e')]);if(_0x4b1ff[_0xe524('0x2f')]){delete _0x4b1ff[_0xe524('0x2f')];}_0x5405e4['status'](_0x52f140)[_0xe524('0x30')](_0x4b1ff);};}exports[_0xe524('0x31')]=function(_0x4a4e15,_0x5b7ded){var _0x20688e={},_0x376324={},_0x5b2fc3={'count':0x0,'rows':[]};var _0x31d4a7=_['map'](db[_0xe524('0x32')]['rawAttributes'],function(_0x315e56){return{'name':_0x315e56[_0xe524('0x33')],'type':_0x315e56[_0xe524('0x34')]['key']};});_0x376324[_0xe524('0x35')]=_['map'](_0x31d4a7,_0xe524('0x2f'));_0x376324[_0xe524('0x36')]=_[_0xe524('0x37')](_0x4a4e15['query']);_0x376324[_0xe524('0x38')]=_[_0xe524('0x39')](_0x376324['model'],_0x376324[_0xe524('0x36')]);_0x20688e[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x376324[_0xe524('0x35')],qs['fields'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3b')]));_0x20688e[_0xe524('0x3a')]=_0x20688e[_0xe524('0x3a')][_0xe524('0x3c')]?_0x20688e[_0xe524('0x3a')]:_0x376324[_0xe524('0x35')];if(!_0x4a4e15[_0xe524('0x36')]['hasOwnProperty'](_0xe524('0x3d'))){_0x20688e['limit']=qs[_0xe524('0x20')](_0x4a4e15[_0xe524('0x36')]['limit']);_0x20688e[_0xe524('0x1e')]=qs['offset'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x1e')]);}_0x20688e[_0xe524('0x3e')]=qs[_0xe524('0x3f')](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3f')]);_0x20688e[_0xe524('0x40')]=qs[_0xe524('0x38')](_['pick'](_0x4a4e15[_0xe524('0x36')],_0x376324[_0xe524('0x38')]),_0x31d4a7);if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x41')]){_0x20688e[_0xe524('0x40')]=_[_0xe524('0x42')](_0x20688e[_0xe524('0x40')],{'$or':_[_0xe524('0x43')](_0x31d4a7,function(_0x5d3ea1){if(_0x5d3ea1[_0xe524('0x34')]!==_0xe524('0x44')){var _0x2e4a13={};_0x2e4a13[_0x5d3ea1['name']]={'$like':'%'+_0x4a4e15[_0xe524('0x36')]['filter']+'%'};return _0x2e4a13;}})});}_0x20688e=_[_0xe524('0x42')]({},_0x20688e,_0x4a4e15[_0xe524('0x45')]);var _0x43c314={'where':_0x20688e[_0xe524('0x40')]};return db[_0xe524('0x32')][_0xe524('0x1f')](_0x43c314)[_0xe524('0x27')](function(_0x52cd0e){_0x5b2fc3[_0xe524('0x1f')]=_0x52cd0e;if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x46')]){_0x20688e[_0xe524('0x47')]=[{'all':!![]}];}return db[_0xe524('0x32')][_0xe524('0x48')](_0x20688e);})['then'](function(_0xb694b9){_0x5b2fc3[_0xe524('0x49')]=_0xb694b9;return _0x5b2fc3;})[_0xe524('0x27')](respondWithFilteredResult(_0x5b7ded,_0x20688e))['catch'](handleError(_0x5b7ded,null));};exports[_0xe524('0x4a')]=function(_0x5209dc,_0x4e5d99){var _0x2b9b3b={'raw':!![],'where':{'id':_0x5209dc['params']['id']}},_0x33906d={};_0x33906d[_0xe524('0x35')]=_[_0xe524('0x37')](db[_0xe524('0x32')][_0xe524('0x4b')]);_0x33906d['query']=_['keys'](_0x5209dc[_0xe524('0x36')]);_0x33906d[_0xe524('0x38')]=_['intersection'](_0x33906d[_0xe524('0x35')],_0x33906d['query']);_0x2b9b3b[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x33906d[_0xe524('0x35')],qs[_0xe524('0x3b')](_0x5209dc[_0xe524('0x36')][_0xe524('0x3b')]));_0x2b9b3b[_0xe524('0x3a')]=_0x2b9b3b[_0xe524('0x3a')][_0xe524('0x3c')]?_0x2b9b3b[_0xe524('0x3a')]:_0x33906d[_0xe524('0x35')];if(_0x5209dc[_0xe524('0x36')][_0xe524('0x46')]){_0x2b9b3b[_0xe524('0x47')]=[{'all':!![]}];}_0x2b9b3b=_[_0xe524('0x42')]({},_0x2b9b3b,_0x5209dc['options']);return db[_0xe524('0x32')]['find'](_0x2b9b3b)['then'](handleEntityNotFound(_0x4e5d99,null))[_0xe524('0x27')](respondWithResult(_0x4e5d99,null))['catch'](handleError(_0x4e5d99,null));};exports[_0xe524('0x4c')]=function(_0x15d7ee,_0x561107){return db[_0xe524('0x32')]['create'](_0x15d7ee['body'],{})[_0xe524('0x27')](function(_0x1e5687){var _0x203e71=_0x15d7ee['user']['get']({'plain':!![]});if(!_0x203e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203e71['role']==='user'){var _0x5477ca=_0x1e5687[_0xe524('0x29')]({'plain':!![]});var _0x2ce5c0='Reports';return db[_0xe524('0x4d')][_0xe524('0x4e')]({'where':{'name':_0x2ce5c0,'userProfileId':_0x203e71[_0xe524('0x4f')]},'raw':!![]})[_0xe524('0x27')](function(_0x2fa143){if(_0x2fa143&&_0x2fa143['autoAssociation']===0x0){return db[_0xe524('0x2b')][_0xe524('0x4c')]({'name':_0x5477ca[_0xe524('0x2f')],'resourceId':_0x5477ca['id'],'type':'DefaultReports','sectionId':_0x2fa143['id']},{})[_0xe524('0x27')](function(){return _0x1e5687;});}else{return _0x1e5687;}})['catch'](function(_0x12e5d0){logger[_0xe524('0x2d')](_0xe524('0x50'),_0x12e5d0);throw _0x12e5d0;});}return _0x1e5687;})[_0xe524('0x27')](respondWithResult(_0x561107,0xc9))[_0xe524('0x51')](handleError(_0x561107,null));};exports[_0xe524('0x52')]=function(_0x1cec31,_0x374450){if(_0x1cec31[_0xe524('0x53')]['id']){delete _0x1cec31[_0xe524('0x53')]['id'];}return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x1cec31['params']['id']}})['then'](handleEntityNotFound(_0x374450,null))['then'](saveUpdates(_0x1cec31[_0xe524('0x53')],null))[_0xe524('0x27')](respondWithResult(_0x374450,null))[_0xe524('0x51')](handleError(_0x374450,null));};exports[_0xe524('0x28')]=function(_0x45fb0d,_0xef3d2f){return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x45fb0d[_0xe524('0x54')]['id']}})[_0xe524('0x27')](handleEntityNotFound(_0xef3d2f,null))[_0xe524('0x27')](removeEntity(_0xef3d2f,null))['catch'](handleError(_0xef3d2f,null));};exports[_0xe524('0x55')]=function(_0x1f0567,_0x4a5f4a){var _0x53da86=0xa;var _0x54adbd=['join',_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x8a2c00={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':_0xe524('0x5a'),'MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x582fbb={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x4f58ff=function(_0x5d0507){return!_[_0xe524('0x63')]([_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x67')],_0x5d0507);};var _0x474ed4=function(_0x5135f0){if(!_0x5135f0||!_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0xc3ccfd='(',_0x5d3b9c=0x0;_0x5d3b9c<_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')];_0x5d3b9c+=0x1){_0x5d3b9c>0x0&&(_0xc3ccfd+='\x20'+_0x5135f0[_0xe524('0x69')]+'\x20');_0xc3ccfd+=_0x5135f0['rules'][_0x5d3b9c]['group']?_0x474ed4(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6a')]):_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6b')]+'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c]['condition']+(_0x4f58ff(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6c')])?'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6d')]:'');}return _0xc3ccfd+')';};var _0x3ce098={'where':{'id':_0x1f0567[_0xe524('0x54')]['id']}},_0x22d06a,_0x35e6b2,_0x1e4b32,_0x27c55c,_0x7e5992;_0x3ce098=_['merge']({},_0x3ce098,_0x1f0567[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x3ce098)[_0xe524('0x27')](function(_0xeec885){if(_0xeec885){_0x22d06a=_0xeec885;return _0xeec885['getFields']();}return null;})[_0xe524('0x27')](function(_0x2341cf){if(_0x2341cf){if(!_0x2341cf[_0xe524('0x3c')]){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x35e6b2=_0x2341cf;return db[_0xe524('0x71')]['findAll']({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x245501){if(_0x245501){_0x1e4b32=_[_0xe524('0x72')](_0x245501,'id');var _0xce15f5;var _0x5ec07c=squel[_0xe524('0x73')]();_0x5ec07c['from'](_0x22d06a[_0xe524('0x74')]);for(var _0x2a88e2=0x0;_0x2a88e2<_0x35e6b2[_0xe524('0x3c')];_0x2a88e2+=0x1){_0xce15f5=_0x35e6b2[_0x2a88e2]['MetricId']?_0x1e4b32[_0x35e6b2[_0x2a88e2][_0xe524('0x75')]][_0xe524('0x76')]:_0x35e6b2[_0x2a88e2][_0xe524('0x6b')];_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x77')]?_[_0xe524('0x78')](_0x8a2c00[_0x35e6b2[_0x2a88e2]['function']],'%s',_0xce15f5):_0xce15f5;_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x79')]?_[_0xe524('0x78')](_0x582fbb[_0x35e6b2[_0x2a88e2][_0xe524('0x79')]],'%s',_0xce15f5):_0xce15f5;if(_0x35e6b2[_0x2a88e2][_0xe524('0x7a')]){_0x5ec07c[_0xe524('0x6a')](_0xce15f5);}_0x35e6b2[_0x2a88e2]['orderBy']&&_0x5ec07c[_0xe524('0x3e')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7b')]===_0xe524('0x7c')?![]:!![]);_0x5ec07c[_0xe524('0x6b')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7d')]||_0xce15f5);}if(_0x22d06a[_0xe524('0x7e')]){_0x22d06a['joins']=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x7e')]);for(var _0x1beaa2=0x0;_0x1beaa2<_0x22d06a['joins'][_0xe524('0x3c')];_0x1beaa2+=0x1){if(_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['type']&&_[_0xe524('0x63')](_0x54adbd,_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')])&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')]&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['foreignTable']&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]){_0x5ec07c[_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')]](_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x22d06a[_0xe524('0x74')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]));}}}if(_0x22d06a['conditions']){_0x22d06a[_0xe524('0x84')]=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x84')]);_0x5ec07c['where'](_0x474ed4(_0x22d06a[_0xe524('0x84')][_0xe524('0x6a')]));}_0x7e5992=_0x5ec07c['clone']();_0x5ec07c['limit'](_0x53da86);_0x5ec07c[_0xe524('0x1e')](0x0);logger['debug'](_0xe524('0x85'),_0x5ec07c['toString']());return dbH[_0xe524('0x86')][_0xe524('0x36')](_0x5ec07c[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')]['QueryTypes']['SELECT']});}})[_0xe524('0x27')](respondWithResult(_0x4a5f4a,null))[_0xe524('0x51')](handleError(_0x4a5f4a,null));};function runReport(_0x50eb96,_0x45c287,_0x449842){var _0x1f3ed1=_0x45c287['name'];var _0x19b063=0xa;var _0x140a4e=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x54385f={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':_0xe524('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1681c5={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x50f5e3=function(_0x11298c){return!_[_0xe524('0x63')]([_0xe524('0x64'),'IS\x20NOT\x20NULL',_0xe524('0x66'),_0xe524('0x67')],_0x11298c);};var _0x5603d0=function(_0x2712ac){if(!_0x2712ac||!_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0x32c9f6='(',_0x58d29e=0x0;_0x58d29e<_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')];_0x58d29e+=0x1){_0x58d29e>0x0&&(_0x32c9f6+='\x20'+_0x2712ac[_0xe524('0x69')]+'\x20');_0x32c9f6+=_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]?_0x5603d0(_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]):_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6b')]+'\x20'+_0x2712ac['rules'][_0x58d29e][_0xe524('0x6c')]+(_0x50f5e3(_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6c')])?'\x20'+_0x2712ac['rules'][_0x58d29e]['value']:'');}return _0x32c9f6+')';};var _0x334164={'where':{'id':_0x50eb96['id']}},_0x512572,_0x903e24,_0x4964c3,_0x2dc3f5,_0x246c62;_0x334164=_['merge']({},_0x334164,_0x449842);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x334164)['then'](function(_0x482b72){if(_0x482b72){_0x512572=_0x482b72;return _0x482b72[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x1b3e03){if(_0x1b3e03){if(!_0x1b3e03['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x903e24=_0x1b3e03;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x57501c){if(_0x57501c){_0x4964c3=_[_0xe524('0x72')](_0x57501c,'id');var _0x3a2834;var _0x4c7f45=squel['select']();_0x4c7f45[_0xe524('0x8c')](_0x512572[_0xe524('0x74')]);for(var _0x41f842=0x0;_0x41f842<_0x903e24[_0xe524('0x3c')];_0x41f842+=0x1){_0x3a2834=_0x903e24[_0x41f842]['MetricId']?_0x4964c3[_0x903e24[_0x41f842][_0xe524('0x75')]][_0xe524('0x76')]:_0x903e24[_0x41f842]['field'];_0x3a2834=_0x903e24[_0x41f842]['function']?_[_0xe524('0x78')](_0x54385f[_0x903e24[_0x41f842][_0xe524('0x77')]],'%s',_0x3a2834):_0x3a2834;_0x3a2834=_0x903e24[_0x41f842][_0xe524('0x79')]?_[_0xe524('0x78')](_0x1681c5[_0x903e24[_0x41f842][_0xe524('0x79')]],'%s',_0x3a2834):_0x3a2834;if(_0x903e24[_0x41f842][_0xe524('0x7a')]){_0x4c7f45['group'](_0x3a2834);}_0x903e24[_0x41f842]['orderBy']&&_0x4c7f45[_0xe524('0x3e')](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x4c7f45['field'](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7d')]||_0x3a2834);}if(_0x512572[_0xe524('0x7e')]){_0x512572[_0xe524('0x7e')]=JSON[_0xe524('0x7f')](_0x512572[_0xe524('0x7e')]);for(var _0xa820a1=0x0;_0xa820a1<_0x512572['joins']['length'];_0xa820a1+=0x1){if(_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x140a4e,_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')])&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x80')]&&_0x512572[_0xe524('0x7e')][_0xa820a1]['foreignTable']&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]){_0x4c7f45[_0x512572[_0xe524('0x7e')][_0xa820a1]['type']](_0x512572['joins'][_0xa820a1][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x512572[_0xe524('0x74')],_0x512572['joins'][_0xa820a1][_0xe524('0x80')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x82')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]));}}}if(_0x512572['conditions']){_0x512572[_0xe524('0x84')]=JSON['parse'](_0x512572[_0xe524('0x84')]);_0x4c7f45[_0xe524('0x40')](_0x5603d0(_0x512572['conditions'][_0xe524('0x6a')]));}_0x246c62=_0x4c7f45[_0xe524('0x8d')]();_0x4c7f45['limit'](_0x19b063);_0x4c7f45[_0xe524('0x1e')](0x0);return;}})['then'](function(){if(_0x45c287[_0xe524('0x8e')]===_0xe524('0x8f')){return null;}var _0x1be681=_[_0xe524('0x42')](_0x45c287,{'name':_0x45c287[_0xe524('0x90')]||_0x45c287[_0xe524('0x2f')]||_0x512572[_0xe524('0x2f')],'basename':_0x1f3ed1,'savename':util[_0xe524('0x79')]('%s-%s.%s',_0x45c287[_0xe524('0x2f')]||_0x512572['name'],require('randomstring')[_0xe524('0x91')](0x4),_0x45c287['output']||_0xe524('0x92')),'reportId':_0x512572['id'],'reportType':_0xe524('0x93')});return db[_0xe524('0x94')][_0xe524('0x4c')](_0x1be681,{'raw':!![]});})[_0xe524('0x27')](function(_0x26c802){if(_0x512572['table']==='cdr'){_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x95'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}else{_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x98'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}if(_0x26c802){logger['info'](_0xe524('0x99'),_0x246c62[_0xe524('0x87')]());require(_0xe524('0x9a'))[_0xe524('0x9b')](path[_0xe524('0x88')](__dirname,_0xe524('0x9c'),_0x26c802['output']),[_0x26c802['id'],_0x246c62[_0xe524('0x87')](),path[_0xe524('0x88')](__dirname,_0xe524('0x9d'),_0x26c802[_0xe524('0x9e')]),_0x1f3ed1]);return _0x26c802;}else{var _0x84bbd7=squel[_0xe524('0x73')]();_0x84bbd7[_0xe524('0x8c')]('('+_0x246c62[_0xe524('0x87')]()+')','countTable');_0x84bbd7['field']('COUNT(*)',_0xe524('0x1f'));_0x246c62[_0xe524('0x20')](_0x45c287['limit']||_0x19b063);_0x246c62[_0xe524('0x1e')](_0x45c287[_0xe524('0x1e')]||0x0);return dbH['sequelize'][_0xe524('0x36')](_0x84bbd7[_0xe524('0x87')](),{'type':dbH['sequelize'][_0xe524('0x9f')][_0xe524('0xa0')]})[_0xe524('0x27')](function(_0x542182){if(!_0x542182[_0xe524('0x3c')]){_0x2dc3f5=0x0;}else{_0x2dc3f5=_0x542182[0x0][_0xe524('0x1f')]||0x0;}return dbH[_0xe524('0x86')]['query'](_0x246c62[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});})['then'](function(_0x5e6a3d){return{'rows':_0x5e6a3d||[],'count':_0x2dc3f5};});}});}exports[_0xe524('0xa1')]=function(_0x33d066,_0x3ea495){return runReport(_0x33d066[_0xe524('0x54')],_0x33d066[_0xe524('0x36')],_0x33d066[_0xe524('0x45')])[_0xe524('0x27')](respondWithResult(_0x3ea495,null))[_0xe524('0x51')](handleError(_0x3ea495,null));};exports[_0xe524('0xa2')]=runReport;exports[_0xe524('0x36')]=function(_0x4505de,_0x292f14){var _0x2d24c1=0xa;var _0x483307=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x280022={'SUM':_0xe524('0xa3'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':'MIN(%s)','AVG':_0xe524('0x89'),'GROUP_CONCAT':_0xe524('0xa4'),'GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x46d6da={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x39998a=function(_0x107de8){return!_['includes']([_0xe524('0x64'),_0xe524('0x65'),'IS\x20EMPTY',_0xe524('0x67')],_0x107de8);};var _0x458e14=function(_0x4e0886){if(!_0x4e0886||!_0x4e0886['rules'][_0xe524('0x3c')]){return'';}for(var _0x3639cf='(',_0x575c14=0x0;_0x575c14<_0x4e0886['rules'][_0xe524('0x3c')];_0x575c14+=0x1){_0x575c14>0x0&&(_0x3639cf+='\x20'+_0x4e0886['operator']+'\x20');_0x3639cf+=_0x4e0886['rules'][_0x575c14]['group']?_0x458e14(_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6a')]):_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6b')]+'\x20'+_0x4e0886['rules'][_0x575c14]['condition']+(_0x39998a(_0x4e0886['rules'][_0x575c14][_0xe524('0x6c')])?'\x20'+_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6d')]:'');}return _0x3639cf+')';};var _0x289720={'where':{'id':_0x4505de[_0xe524('0x54')]['id']}},_0x3fb45c,_0x3362fe,_0x119684,_0x19e4fd,_0x4b4349;_0x289720=_[_0xe524('0x42')]({},_0x289720,_0x4505de[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x289720)[_0xe524('0x27')](function(_0x404a49){if(_0x404a49){_0x3fb45c=_0x404a49;return _0x404a49[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x8e8087){if(_0x8e8087){if(!_0x8e8087['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x3362fe=_0x8e8087;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x113a54){if(_0x113a54){_0x119684=_[_0xe524('0x72')](_0x113a54,'id');var _0x4ebca4;var _0x40043c=squel[_0xe524('0x73')]();_0x40043c[_0xe524('0x8c')](_0x3fb45c[_0xe524('0x74')]);for(var _0x19a773=0x0;_0x19a773<_0x3362fe[_0xe524('0x3c')];_0x19a773+=0x1){_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x75')]?_0x119684[_0x3362fe[_0x19a773][_0xe524('0x75')]][_0xe524('0x76')]:_0x3362fe[_0x19a773][_0xe524('0x6b')];_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x77')]?_[_0xe524('0x78')](_0x280022[_0x3362fe[_0x19a773]['function']],'%s',_0x4ebca4):_0x4ebca4;_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x79')]?_[_0xe524('0x78')](_0x46d6da[_0x3362fe[_0x19a773][_0xe524('0x79')]],'%s',_0x4ebca4):_0x4ebca4;if(_0x3362fe[_0x19a773]['groupBy']){_0x40043c['group'](_0x4ebca4);}_0x3362fe[_0x19a773][_0xe524('0x7b')]&&_0x40043c[_0xe524('0x3e')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x40043c[_0xe524('0x6b')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7d')]||_0x4ebca4);}if(_0x3fb45c[_0xe524('0x7e')]){_0x3fb45c['joins']=JSON['parse'](_0x3fb45c[_0xe524('0x7e')]);for(var _0x2a85e5=0x0;_0x2a85e5<_0x3fb45c[_0xe524('0x7e')]['length'];_0x2a85e5+=0x1){if(_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x483307,_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')])&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')]&&_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')]&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]){_0x40043c[_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]](_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')],null,util[_0xe524('0x79')]('%s.%s\x20=\x20%s.%s',_0x3fb45c[_0xe524('0x74')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x82')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]));}}}if(_0x3fb45c[_0xe524('0x84')]){_0x3fb45c[_0xe524('0x84')]=JSON['parse'](_0x3fb45c['conditions']);_0x40043c[_0xe524('0x40')](_0x458e14(_0x3fb45c[_0xe524('0x84')][_0xe524('0x6a')]));}_0x4b4349=_0x40043c[_0xe524('0x8d')]();_0x40043c[_0xe524('0x20')](_0x2d24c1);_0x40043c[_0xe524('0x1e')](0x0);logger[_0xe524('0xa5')]('Limited\x20Query:',_0x40043c['toString']());return dbH[_0xe524('0x86')]['query'](_0x40043c['toString'](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});}})[_0xe524('0x27')](function(){return{'sql':_0x4b4349[_0xe524('0x87')]()};})[_0xe524('0x27')](respondWithResult(_0x292f14,null))['catch'](handleError(_0x292f14,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xabce[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5a44f5e..104714e 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 _0xdbe7=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x357dd7,_0x431a02){var _0xcb0466=function(_0x3ab60d){while(--_0x3ab60d){_0x357dd7['push'](_0x357dd7['shift']());}};_0xcb0466(++_0x431a02);}(_0xdbe7,0xe4));var _0x7dbe=function(_0x4ae4d6,_0x2f62d5){_0x4ae4d6=_0x4ae4d6-0x0;var _0x5de416=_0xdbe7[_0x4ae4d6];return _0x5de416;};'use strict';var _=require(_0x7dbe('0x0'));var util=require('util');var logger=require(_0x7dbe('0x1'))(_0x7dbe('0x2'));var moment=require('moment');var BPromise=require(_0x7dbe('0x3'));var rp=require(_0x7dbe('0x4'));var fs=require('fs');var path=require(_0x7dbe('0x5'));var rimraf=require(_0x7dbe('0x6'));var config=require(_0x7dbe('0x7'));var attributes=require(_0x7dbe('0x8'));module[_0x7dbe('0x9')]=function(_0x5c9a55,_0x4ee1fc){return _0x5c9a55[_0x7dbe('0xa')](_0x7dbe('0xb'),attributes,{'tableName':_0x7dbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda68=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda68,0xed));var _0x8da6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8da6('0x0'));var util=require(_0x8da6('0x1'));var logger=require(_0x8da6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8da6('0x3'));var rp=require(_0x8da6('0x4'));var fs=require('fs');var path=require(_0x8da6('0x5'));var rimraf=require(_0x8da6('0x6'));var config=require(_0x8da6('0x7'));var attributes=require(_0x8da6('0x8'));module[_0x8da6('0x9')]=function(_0x5ab20d,_0x5f6ab7){return _0x5ab20d[_0x8da6('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','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 e3f4925..dadff73 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 _0xee48=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x31aed6,_0x424dcc){var _0x45ac4a=function(_0x1b5d37){while(--_0x1b5d37){_0x31aed6['push'](_0x31aed6['shift']());}};_0x45ac4a(++_0x424dcc);}(_0xee48,0x1a5));var _0x8ee4=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xee48[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x8ee4('0x0'));var util=require(_0x8ee4('0x1'));var moment=require(_0x8ee4('0x2'));var BPromise=require(_0x8ee4('0x3'));var rs=require(_0x8ee4('0x4'));var fs=require('fs');var Redis=require(_0x8ee4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ee4('0x6'));var logger=require(_0x8ee4('0x7'))(_0x8ee4('0x8'));var config=require(_0x8ee4('0x9'));var jayson=require(_0x8ee4('0xa'));var client=jayson[_0x8ee4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x774139,_0x4f03f6,_0x1e9158){return new BPromise(function(_0x4943fd,_0x3b45e4){return client[_0x8ee4('0xc')](_0x774139,_0x1e9158)[_0x8ee4('0xd')](function(_0x4e53ce){logger[_0x8ee4('0xe')](_0x8ee4('0xf'),_0x4f03f6,_0x8ee4('0x10'));logger[_0x8ee4('0x11')](_0x8ee4('0x12'),_0x4f03f6,_0x8ee4('0x10'),JSON['stringify'](_0x4e53ce));if(_0x4e53ce[_0x8ee4('0x13')]){if(_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x14')]===0x1f4){logger[_0x8ee4('0x13')](_0x8ee4('0xf'),_0x4f03f6,_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);return _0x3b45e4(_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4f03f6,_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);return _0x4943fd(_0x4e53ce[_0x8ee4('0x13')][_0x8ee4('0x15')]);}else{logger[_0x8ee4('0xe')](_0x8ee4('0xf'),_0x4f03f6,'request\x20sent');_0x4943fd(_0x4e53ce[_0x8ee4('0x16')][_0x8ee4('0x15')]);}})['catch'](function(_0x33981d){logger['error'](_0x8ee4('0xf'),_0x4f03f6,_0x33981d);_0x3b45e4(_0x33981d);});});} \ No newline at end of file +var _0x0c2f=['error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x0c2f,0xc2));var _0xf0c2=function(_0x4944f1,_0x482a52){_0x4944f1=_0x4944f1-0x0;var _0x433494=_0x0c2f[_0x4944f1];return _0x433494;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0c2('0x0'));var BPromise=require(_0xf0c2('0x1'));var rs=require(_0xf0c2('0x2'));var fs=require('fs');var Redis=require(_0xf0c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0c2('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0c2('0x5'));var jayson=require(_0xf0c2('0x6'));var client=jayson['client'][_0xf0c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dee19,_0x4812a9,_0x26b099){return new BPromise(function(_0x281c66,_0xdb4f07){return client['request'](_0x5dee19,_0x26b099)[_0xf0c2('0x8')](function(_0x452d9c){logger[_0xf0c2('0x9')](_0xf0c2('0xa'),_0x4812a9,_0xf0c2('0xb'));logger[_0xf0c2('0xc')](_0xf0c2('0xd'),_0x4812a9,_0xf0c2('0xb'),JSON[_0xf0c2('0xe')](_0x452d9c));if(_0x452d9c[_0xf0c2('0xf')]){if(_0x452d9c[_0xf0c2('0xf')][_0xf0c2('0x10')]===0x1f4){logger[_0xf0c2('0xf')](_0xf0c2('0xa'),_0x4812a9,_0x452d9c[_0xf0c2('0xf')][_0xf0c2('0x11')]);return _0xdb4f07(_0x452d9c['error'][_0xf0c2('0x11')]);}logger[_0xf0c2('0xf')](_0xf0c2('0xa'),_0x4812a9,_0x452d9c[_0xf0c2('0xf')][_0xf0c2('0x11')]);return _0x281c66(_0x452d9c[_0xf0c2('0xf')][_0xf0c2('0x11')]);}else{logger['info'](_0xf0c2('0xa'),_0x4812a9,_0xf0c2('0xb'));_0x281c66(_0x452d9c[_0xf0c2('0x12')]['message']);}})['catch'](function(_0x5cba2a){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4812a9,_0x5cba2a);_0xdb4f07(_0x5cba2a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ed90403..0665c4f 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 _0x4be7=['index','/:id','/:id/preview','preview','/:id/run','/:id/query','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x189fe1,_0x373c91){var _0x17364e=function(_0x1b5471){while(--_0x1b5471){_0x189fe1['push'](_0x189fe1['shift']());}};_0x17364e(++_0x373c91);}(_0x4be7,0x114));var _0x74be=function(_0x59ae80,_0x56b205){_0x59ae80=_0x59ae80-0x0;var _0x473bf9=_0x4be7[_0x59ae80];return _0x473bf9;};'use strict';var multer=require(_0x74be('0x0'));var util=require(_0x74be('0x1'));var path=require(_0x74be('0x2'));var timeout=require('connect-timeout');var express=require(_0x74be('0x3'));var router=express[_0x74be('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74be('0x5'));var config=require(_0x74be('0x6'));var controller=require(_0x74be('0x7'));router[_0x74be('0x8')]('/',auth[_0x74be('0x9')](),controller[_0x74be('0xa')]);router['get'](_0x74be('0xb'),auth[_0x74be('0x9')](),controller['show']);router['get'](_0x74be('0xc'),auth[_0x74be('0x9')](),controller[_0x74be('0xd')]);router[_0x74be('0x8')](_0x74be('0xe'),auth[_0x74be('0x9')](),controller['run']);router['get'](_0x74be('0xf'),auth[_0x74be('0x9')](),controller['query']);router[_0x74be('0x10')]('/',auth[_0x74be('0x9')](),controller[_0x74be('0x11')]);router[_0x74be('0x12')]('/:id',auth[_0x74be('0x9')](),controller['update']);router[_0x74be('0x13')](_0x74be('0xb'),auth[_0x74be('0x9')](),controller[_0x74be('0x14')]);module[_0x74be('0x15')]=router; \ No newline at end of file +var _0x24c6=['index','/:id','show','isAuthenticated','preview','/:id/run','/:id/query','query','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get'];(function(_0x2aa6ff,_0xa34cd9){var _0x3c040d=function(_0x2b0283){while(--_0x2b0283){_0x2aa6ff['push'](_0x2aa6ff['shift']());}};_0x3c040d(++_0xa34cd9);}(_0x24c6,0x90));var _0x624c=function(_0xd39c08,_0x5ce055){_0xd39c08=_0xd39c08-0x0;var _0x32d1fb=_0x24c6[_0xd39c08];return _0x32d1fb;};'use strict';var multer=require(_0x624c('0x0'));var util=require(_0x624c('0x1'));var path=require(_0x624c('0x2'));var timeout=require(_0x624c('0x3'));var express=require(_0x624c('0x4'));var router=express[_0x624c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x624c('0x6'));var interaction=require(_0x624c('0x7'));var config=require('../../config/environment');var controller=require(_0x624c('0x8'));router[_0x624c('0x9')]('/',auth['isAuthenticated'](),controller[_0x624c('0xa')]);router['get'](_0x624c('0xb'),auth['isAuthenticated'](),controller[_0x624c('0xc')]);router[_0x624c('0x9')]('/:id/preview',auth[_0x624c('0xd')](),controller[_0x624c('0xe')]);router['get'](_0x624c('0xf'),auth[_0x624c('0xd')](),controller['run']);router[_0x624c('0x9')](_0x624c('0x10'),auth[_0x624c('0xd')](),controller[_0x624c('0x11')]);router[_0x624c('0x12')]('/',auth[_0x624c('0xd')](),controller[_0x624c('0x13')]);router['put'](_0x624c('0xb'),auth[_0x624c('0xd')](),controller['update']);router[_0x624c('0x14')](_0x624c('0xb'),auth['isAuthenticated'](),controller[_0x624c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 28aa429..bd73dab 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 _0xba3f=['STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','moment','exports'];(function(_0x4177c6,_0x4e2e1d){var _0xb34d1f=function(_0x5dbf33){while(--_0x5dbf33){_0x4177c6['push'](_0x4177c6['shift']());}};_0xb34d1f(++_0x4e2e1d);}(_0xba3f,0x195));var _0xfba3=function(_0x46964a,_0x3a9ed5){_0x46964a=_0x46964a-0x0;var _0x2df4ad=_0xba3f[_0x46964a];return _0x2df4ad;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfba3('0x0'));module[_0xfba3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xfba3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xfba3('0x3')](_0xfba3('0x4'),_0xfba3('0x5'),_0xfba3('0x6')),'allowNull':![],'defaultValue':_0xfba3('0x4')},'savename':{'type':Sequelize[_0xfba3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xfba3('0x7')]},'endDate':{'type':Sequelize[_0xfba3('0x7')]},'status':{'type':Sequelize[_0xfba3('0x2')],'defaultValue':_0xfba3('0x8')},'type':{'type':Sequelize[_0xfba3('0x3')](_0xfba3('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xfba3('0x9')},'reportId':{'type':Sequelize[_0xfba3('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xfba3('0x2')]}}; \ No newline at end of file +var _0xc218=['DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x4e90f0,_0x3b7e3c){var _0x1a2cee=function(_0xc0c5f5){while(--_0xc0c5f5){_0x4e90f0['push'](_0x4e90f0['shift']());}};_0x1a2cee(++_0x3b7e3c);}(_0xc218,0x94));var _0x8c21=function(_0x47aa23,_0x53fb49){_0x47aa23=_0x47aa23-0x0;var _0x426742=_0xc218[_0x47aa23];return _0x426742;};'use strict';var Sequelize=require(_0x8c21('0x0'));var moment=require(_0x8c21('0x1'));module[_0x8c21('0x2')]={'name':{'type':Sequelize[_0x8c21('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x8c21('0x4')](_0x8c21('0x5'),_0x8c21('0x6'),_0x8c21('0x7')),'allowNull':![],'defaultValue':_0x8c21('0x5')},'savename':{'type':Sequelize[_0x8c21('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8c21('0x8')]},'endDate':{'type':Sequelize[_0x8c21('0x8')]},'status':{'type':Sequelize[_0x8c21('0x3')],'defaultValue':_0x8c21('0x9')},'type':{'type':Sequelize[_0x8c21('0x4')](_0x8c21('0xa'),_0x8c21('0xb')),'allowNull':![],'defaultValue':_0x8c21('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x8c21('0xc')]},'reportType':{'type':Sequelize[_0x8c21('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 90edff4..c15291e 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 _0xd25e=['offset','undefined','limit','count','Content-Range','json','apply','save','then','get','ExtractedReports','destroy','error','stack','name','map','AnalyticExtractedReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','length','find','catch','create','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x237bf7,_0xb851fc){var _0x5928ba=function(_0x14c0d0){while(--_0x14c0d0){_0x237bf7['push'](_0x237bf7['shift']());}};_0x5928ba(++_0xb851fc);}(_0xd25e,0x1c3));var _0xed25=function(_0x4eb4b0,_0x27c635){_0x4eb4b0=_0x4eb4b0-0x0;var _0x4209c9=_0xd25e[_0x4eb4b0];return _0x4209c9;};'use strict';var emlformat=require(_0xed25('0x0'));var rimraf=require(_0xed25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed25('0x2'));var rp=require(_0xed25('0x3'));var moment=require(_0xed25('0x4'));var BPromise=require(_0xed25('0x5'));var Mustache=require(_0xed25('0x6'));var util=require(_0xed25('0x7'));var path=require(_0xed25('0x8'));var sox=require(_0xed25('0x9'));var csv=require('to-csv');var ejs=require(_0xed25('0xa'));var fs=require('fs');var fs_extra=require(_0xed25('0xb'));var _=require('lodash');var squel=require(_0xed25('0xc'));var crypto=require(_0xed25('0xd'));var jsforce=require(_0xed25('0xe'));var deskjs=require(_0xed25('0xf'));var toCsv=require(_0xed25('0x10'));var querystring=require(_0xed25('0x11'));var Papa=require(_0xed25('0x12'));var Redis=require(_0xed25('0x13'));var authService=require(_0xed25('0x14'));var qs=require(_0xed25('0x15'));var as=require(_0xed25('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed25('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xed25('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xed25('0x19'))['db'];function respondWithStatusCode(_0xaee3b5,_0x231a75){_0x231a75=_0x231a75||0xcc;return function(_0x303081){if(_0x303081){return _0xaee3b5[_0xed25('0x1a')](_0x231a75);}return _0xaee3b5[_0xed25('0x1b')](_0x231a75)[_0xed25('0x1c')]();};}function respondWithResult(_0x47b11e,_0x26ef59){_0x26ef59=_0x26ef59||0xc8;return function(_0x27781c){if(_0x27781c){return _0x47b11e[_0xed25('0x1b')](_0x26ef59)['json'](_0x27781c);}};}function respondWithFilteredResult(_0x427b37,_0x47771b){return function(_0x3238fb){if(_0x3238fb){var _0x377e29=typeof _0x47771b[_0xed25('0x1d')]===_0xed25('0x1e')&&typeof _0x47771b[_0xed25('0x1f')]==='undefined';var _0xe43e3b=_0x3238fb[_0xed25('0x20')];var _0x3bc551=_0x377e29?0x0:_0x47771b[_0xed25('0x1d')];var _0x324f30=_0x377e29?_0x3238fb['count']:_0x47771b[_0xed25('0x1d')]+_0x47771b[_0xed25('0x1f')];var _0x2e7ee3;if(_0x324f30>=_0xe43e3b){_0x324f30=_0xe43e3b;_0x2e7ee3=0xc8;}else{_0x2e7ee3=0xce;}_0x427b37[_0xed25('0x1b')](_0x2e7ee3);return _0x427b37['set'](_0xed25('0x21'),_0x3bc551+'-'+_0x324f30+'/'+_0xe43e3b)[_0xed25('0x22')](_0x3238fb);}return null;};}function patchUpdates(_0x5bdff5){return function(_0x20a589){try{jsonpatch[_0xed25('0x23')](_0x20a589,_0x5bdff5,!![]);}catch(_0x60060f){return BPromise['reject'](_0x60060f);}return _0x20a589[_0xed25('0x24')]();};}function saveUpdates(_0x5d6133,_0x2aba00){return function(_0x499368){if(_0x499368){return _0x499368['update'](_0x5d6133)['then'](function(_0x1c6ce4){return _0x1c6ce4;});}return null;};}function removeEntity(_0x5a55ea,_0x11c7f4){return function(_0x392de7){if(_0x392de7){return _0x392de7['destroy']()[_0xed25('0x25')](function(){var _0x12e3f=_0x392de7[_0xed25('0x26')]({'plain':!![]});var _0x499943=_0xed25('0x27');return db['UserProfileResource'][_0xed25('0x28')]({'where':{'type':_0x499943,'resourceId':_0x12e3f['id']}})['then'](function(){return _0x392de7;});})[_0xed25('0x25')](function(){_0x5a55ea[_0xed25('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13173c,_0x5ea7eb){return function(_0x51da28){if(!_0x51da28){_0x13173c[_0xed25('0x1a')](0x194);}return _0x51da28;};}function handleError(_0x130b6c,_0x3aae3a){_0x3aae3a=_0x3aae3a||0x1f4;return function(_0x186e5c){logger[_0xed25('0x29')](_0x186e5c[_0xed25('0x2a')]);if(_0x186e5c[_0xed25('0x2b')]){delete _0x186e5c[_0xed25('0x2b')];}_0x130b6c[_0xed25('0x1b')](_0x3aae3a)['send'](_0x186e5c);};}exports['index']=function(_0x45b95b,_0x224c8e){var _0x26a14f={},_0x276a6a={},_0x3418f9={'count':0x0,'rows':[]};var _0xfb157c=_[_0xed25('0x2c')](db[_0xed25('0x2d')]['rawAttributes'],function(_0x27de92){return{'name':_0x27de92[_0xed25('0x2e')],'type':_0x27de92[_0xed25('0x2f')][_0xed25('0x30')]};});_0x276a6a[_0xed25('0x31')]=_[_0xed25('0x2c')](_0xfb157c,_0xed25('0x2b'));_0x276a6a['query']=_[_0xed25('0x32')](_0x45b95b[_0xed25('0x33')]);_0x276a6a['filters']=_[_0xed25('0x34')](_0x276a6a[_0xed25('0x31')],_0x276a6a[_0xed25('0x33')]);_0x26a14f[_0xed25('0x35')]=_['intersection'](_0x276a6a[_0xed25('0x31')],qs[_0xed25('0x36')](_0x45b95b[_0xed25('0x33')][_0xed25('0x36')]));_0x26a14f['attributes']=_0x26a14f['attributes']['length']?_0x26a14f[_0xed25('0x35')]:_0x276a6a[_0xed25('0x31')];if(!_0x45b95b['query'][_0xed25('0x37')](_0xed25('0x38'))){_0x26a14f[_0xed25('0x1f')]=qs[_0xed25('0x1f')](_0x45b95b[_0xed25('0x33')]['limit']);_0x26a14f[_0xed25('0x1d')]=qs[_0xed25('0x1d')](_0x45b95b[_0xed25('0x33')][_0xed25('0x1d')]);}_0x26a14f[_0xed25('0x39')]=qs[_0xed25('0x3a')](_0x45b95b[_0xed25('0x33')]['sort']);_0x26a14f[_0xed25('0x3b')]=qs[_0xed25('0x3c')](_[_0xed25('0x3d')](_0x45b95b[_0xed25('0x33')],_0x276a6a[_0xed25('0x3c')]),_0xfb157c);if(_0x45b95b[_0xed25('0x33')][_0xed25('0x3e')]){_0x26a14f[_0xed25('0x3b')]=_['merge'](_0x26a14f[_0xed25('0x3b')],{'$or':_[_0xed25('0x2c')](_0xfb157c,function(_0x270d82){if(_0x270d82[_0xed25('0x2f')]!==_0xed25('0x3f')){var _0x3fe677={};_0x3fe677[_0x270d82['name']]={'$like':'%'+_0x45b95b[_0xed25('0x33')][_0xed25('0x3e')]+'%'};return _0x3fe677;}})});}_0x26a14f=_[_0xed25('0x40')]({},_0x26a14f,_0x45b95b[_0xed25('0x41')]);var _0x145fef={'where':_0x26a14f[_0xed25('0x3b')]};return db[_0xed25('0x2d')][_0xed25('0x20')](_0x145fef)[_0xed25('0x25')](function(_0x30a543){_0x3418f9[_0xed25('0x20')]=_0x30a543;if(_0x45b95b[_0xed25('0x33')][_0xed25('0x42')]){_0x26a14f['include']=[{'all':!![]}];}return db[_0xed25('0x2d')][_0xed25('0x43')](_0x26a14f);})[_0xed25('0x25')](function(_0x43168b){_0x3418f9[_0xed25('0x44')]=_0x43168b;return _0x3418f9;})[_0xed25('0x25')](respondWithFilteredResult(_0x224c8e,_0x26a14f))['catch'](handleError(_0x224c8e,null));};exports[_0xed25('0x45')]=function(_0xb5b181,_0x2c501e){var _0x11dcb2={'raw':!![],'where':{'id':_0xb5b181['params']['id']}},_0x1dac52={};_0x1dac52['model']=_['keys'](db[_0xed25('0x2d')]['rawAttributes']);_0x1dac52['query']=_['keys'](_0xb5b181[_0xed25('0x33')]);_0x1dac52[_0xed25('0x3c')]=_[_0xed25('0x34')](_0x1dac52['model'],_0x1dac52[_0xed25('0x33')]);_0x11dcb2[_0xed25('0x35')]=_[_0xed25('0x34')](_0x1dac52['model'],qs[_0xed25('0x36')](_0xb5b181['query'][_0xed25('0x36')]));_0x11dcb2['attributes']=_0x11dcb2[_0xed25('0x35')][_0xed25('0x46')]?_0x11dcb2[_0xed25('0x35')]:_0x1dac52[_0xed25('0x31')];if(_0xb5b181[_0xed25('0x33')]['includeAll']){_0x11dcb2['include']=[{'all':!![]}];}_0x11dcb2=_[_0xed25('0x40')]({},_0x11dcb2,_0xb5b181[_0xed25('0x41')]);return db[_0xed25('0x2d')][_0xed25('0x47')](_0x11dcb2)[_0xed25('0x25')](handleEntityNotFound(_0x2c501e,null))[_0xed25('0x25')](respondWithResult(_0x2c501e,null))[_0xed25('0x48')](handleError(_0x2c501e,null));};exports[_0xed25('0x49')]=function(_0x1aa332,_0x3f8ec1){return db[_0xed25('0x2d')][_0xed25('0x49')](_0x1aa332['body'],{})[_0xed25('0x25')](function(_0x3f29a5){var _0x1f2352=_0x1aa332['user'][_0xed25('0x26')]({'plain':!![]});if(!_0x1f2352)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f2352[_0xed25('0x4a')]==='user'){var _0x3e8564=_0x3f29a5[_0xed25('0x26')]({'plain':!![]});var _0x5e9ae8=_0xed25('0x27');return db[_0xed25('0x4b')][_0xed25('0x47')]({'where':{'name':_0x5e9ae8,'userProfileId':_0x1f2352[_0xed25('0x4c')]},'raw':!![]})[_0xed25('0x25')](function(_0x37ec03){if(_0x37ec03&&_0x37ec03[_0xed25('0x4d')]===0x0){return db[_0xed25('0x4e')][_0xed25('0x49')]({'name':_0x3e8564[_0xed25('0x2b')],'resourceId':_0x3e8564['id'],'type':_0x37ec03[_0xed25('0x2b')],'sectionId':_0x37ec03['id']},{})[_0xed25('0x25')](function(){return _0x3f29a5;});}else{return _0x3f29a5;}})['catch'](function(_0x46702b){logger[_0xed25('0x29')](_0xed25('0x4f'),_0x46702b);throw _0x46702b;});}return _0x3f29a5;})['then'](respondWithResult(_0x3f8ec1,0xc9))[_0xed25('0x48')](handleError(_0x3f8ec1,null));};exports[_0xed25('0x50')]=function(_0x152145,_0x4cc127){if(_0x152145['body']['id']){delete _0x152145[_0xed25('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xed25('0x47')]({'where':{'id':_0x152145['params']['id']}})[_0xed25('0x25')](handleEntityNotFound(_0x4cc127,null))[_0xed25('0x25')](saveUpdates(_0x152145[_0xed25('0x51')],null))['then'](respondWithResult(_0x4cc127,null))['catch'](handleError(_0x4cc127,null));};exports[_0xed25('0x28')]=function(_0x3a28c6,_0x206078){return db['AnalyticExtractedReport'][_0xed25('0x47')]({'where':{'id':_0x3a28c6[_0xed25('0x52')]['id']}})[_0xed25('0x25')](handleEntityNotFound(_0x206078,null))[_0xed25('0x25')](removeEntity(_0x206078,null))['catch'](handleError(_0x206078,null));};exports[_0xed25('0x53')]=function(_0x43704c,_0x55f662,_0x3eb282){return db[_0xed25('0x2d')]['find']({'where':{'id':_0x43704c[_0xed25('0x52')]['id']},'attributes':[_0xed25('0x2b'),_0xed25('0x54'),_0xed25('0x55'),_0xed25('0x56')],'raw':!![]})[_0xed25('0x25')](handleEntityNotFound(_0x55f662,null))[_0xed25('0x25')](function(_0xb7a3b){if(_0xb7a3b){if(!fs[_0xed25('0x57')](path[_0xed25('0x58')](config[_0xed25('0x59')],'server/files/reports',_0xb7a3b[_0xed25('0x55')]))){throw new db[(_0xed25('0x5a'))][(_0xed25('0x5b'))](_0xed25('0x5c'));}if(_0x43704c['query'][_0xed25('0x5d')]){return _0x55f662['sendStatus'](0xc8);}return _0x55f662[_0xed25('0x53')](path[_0xed25('0x58')](config[_0xed25('0x59')],_0xed25('0x5e'),_0xb7a3b[_0xed25('0x55')]),util[_0xed25('0x5f')]('%s.%s',_0xb7a3b[_0xed25('0x54')]||_0xb7a3b[_0xed25('0x2b')],_0xb7a3b['output']['toLowerCase']()));}})[_0xed25('0x48')](handleError(_0x55f662,null));}; \ No newline at end of file +var _0xe431=['root','Sequelize','Report\x20not\x20found\x20or\x20empty','server/files/reports','savename','format','basename','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','stack','name','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','filter','merge','include','findAll','rows','params','includeAll','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','existsSync','join'];(function(_0xfeb26f,_0x53d9a7){var _0x1c43a4=function(_0x3026f2){while(--_0x3026f2){_0xfeb26f['push'](_0xfeb26f['shift']());}};_0x1c43a4(++_0x53d9a7);}(_0xe431,0xcb));var _0x1e43=function(_0x54896e,_0x31c597){_0x54896e=_0x54896e-0x0;var _0x4a8631=_0xe431[_0x54896e];return _0x4a8631;};'use strict';var emlformat=require(_0x1e43('0x0'));var rimraf=require(_0x1e43('0x1'));var zipdir=require(_0x1e43('0x2'));var jsonpatch=require(_0x1e43('0x3'));var rp=require(_0x1e43('0x4'));var moment=require(_0x1e43('0x5'));var BPromise=require(_0x1e43('0x6'));var Mustache=require(_0x1e43('0x7'));var util=require(_0x1e43('0x8'));var path=require(_0x1e43('0x9'));var sox=require(_0x1e43('0xa'));var csv=require('to-csv');var ejs=require(_0x1e43('0xb'));var fs=require('fs');var fs_extra=require(_0x1e43('0xc'));var _=require(_0x1e43('0xd'));var squel=require(_0x1e43('0xe'));var crypto=require(_0x1e43('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e43('0x10'));var Papa=require(_0x1e43('0x11'));var Redis=require(_0x1e43('0x12'));var authService=require(_0x1e43('0x13'));var qs=require(_0x1e43('0x14'));var as=require(_0x1e43('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1e43('0x16'));var licenseUtil=require(_0x1e43('0x17'));var db=require(_0x1e43('0x18'))['db'];function respondWithStatusCode(_0x255928,_0x38635e){_0x38635e=_0x38635e||0xcc;return function(_0x1eed42){if(_0x1eed42){return _0x255928[_0x1e43('0x19')](_0x38635e);}return _0x255928[_0x1e43('0x1a')](_0x38635e)[_0x1e43('0x1b')]();};}function respondWithResult(_0x3572bb,_0x14bc55){_0x14bc55=_0x14bc55||0xc8;return function(_0x39579f){if(_0x39579f){return _0x3572bb['status'](_0x14bc55)[_0x1e43('0x1c')](_0x39579f);}};}function respondWithFilteredResult(_0x11a8b9,_0x14a4e4){return function(_0x2bfd43){if(_0x2bfd43){var _0x5a3d4e=typeof _0x14a4e4[_0x1e43('0x1d')]===_0x1e43('0x1e')&&typeof _0x14a4e4[_0x1e43('0x1f')]===_0x1e43('0x1e');var _0x261712=_0x2bfd43[_0x1e43('0x20')];var _0x220da8=_0x5a3d4e?0x0:_0x14a4e4[_0x1e43('0x1d')];var _0x3c0b00=_0x5a3d4e?_0x2bfd43[_0x1e43('0x20')]:_0x14a4e4[_0x1e43('0x1d')]+_0x14a4e4[_0x1e43('0x1f')];var _0x1992c5;if(_0x3c0b00>=_0x261712){_0x3c0b00=_0x261712;_0x1992c5=0xc8;}else{_0x1992c5=0xce;}_0x11a8b9['status'](_0x1992c5);return _0x11a8b9[_0x1e43('0x21')](_0x1e43('0x22'),_0x220da8+'-'+_0x3c0b00+'/'+_0x261712)[_0x1e43('0x1c')](_0x2bfd43);}return null;};}function patchUpdates(_0x3a4875){return function(_0x2f997e){try{jsonpatch[_0x1e43('0x23')](_0x2f997e,_0x3a4875,!![]);}catch(_0x4aab5b){return BPromise[_0x1e43('0x24')](_0x4aab5b);}return _0x2f997e[_0x1e43('0x25')]();};}function saveUpdates(_0x49ddae,_0x93dbb6){return function(_0x2ed1df){if(_0x2ed1df){return _0x2ed1df[_0x1e43('0x26')](_0x49ddae)['then'](function(_0x3abfdb){return _0x3abfdb;});}return null;};}function removeEntity(_0x399c75,_0x1434e7){return function(_0x4b0457){if(_0x4b0457){return _0x4b0457[_0x1e43('0x27')]()[_0x1e43('0x28')](function(){var _0x1b0f2f=_0x4b0457[_0x1e43('0x29')]({'plain':!![]});var _0x407c26=_0x1e43('0x2a');return db['UserProfileResource'][_0x1e43('0x27')]({'where':{'type':_0x407c26,'resourceId':_0x1b0f2f['id']}})[_0x1e43('0x28')](function(){return _0x4b0457;});})[_0x1e43('0x28')](function(){_0x399c75[_0x1e43('0x1a')](0xcc)[_0x1e43('0x1b')]();});}};}function handleEntityNotFound(_0x1d7a52,_0x4c17f2){return function(_0x110ea4){if(!_0x110ea4){_0x1d7a52[_0x1e43('0x19')](0x194);}return _0x110ea4;};}function handleError(_0x4f3db8,_0x5787ee){_0x5787ee=_0x5787ee||0x1f4;return function(_0xbc34c7){logger['error'](_0xbc34c7[_0x1e43('0x2b')]);if(_0xbc34c7[_0x1e43('0x2c')]){delete _0xbc34c7[_0x1e43('0x2c')];}_0x4f3db8[_0x1e43('0x1a')](_0x5787ee)['send'](_0xbc34c7);};}exports['index']=function(_0x57d407,_0x20b7ae){var _0x5bdfef={},_0x49e84a={},_0x1dc00b={'count':0x0,'rows':[]};var _0x459e5c=_[_0x1e43('0x2d')](db[_0x1e43('0x2e')][_0x1e43('0x2f')],function(_0x589a33){return{'name':_0x589a33[_0x1e43('0x30')],'type':_0x589a33['type'][_0x1e43('0x31')]};});_0x49e84a[_0x1e43('0x32')]=_[_0x1e43('0x2d')](_0x459e5c,_0x1e43('0x2c'));_0x49e84a[_0x1e43('0x33')]=_[_0x1e43('0x34')](_0x57d407['query']);_0x49e84a[_0x1e43('0x35')]=_[_0x1e43('0x36')](_0x49e84a[_0x1e43('0x32')],_0x49e84a[_0x1e43('0x33')]);_0x5bdfef[_0x1e43('0x37')]=_[_0x1e43('0x36')](_0x49e84a[_0x1e43('0x32')],qs['fields'](_0x57d407[_0x1e43('0x33')][_0x1e43('0x38')]));_0x5bdfef[_0x1e43('0x37')]=_0x5bdfef['attributes'][_0x1e43('0x39')]?_0x5bdfef[_0x1e43('0x37')]:_0x49e84a[_0x1e43('0x32')];if(!_0x57d407[_0x1e43('0x33')][_0x1e43('0x3a')](_0x1e43('0x3b'))){_0x5bdfef[_0x1e43('0x1f')]=qs[_0x1e43('0x1f')](_0x57d407['query'][_0x1e43('0x1f')]);_0x5bdfef[_0x1e43('0x1d')]=qs[_0x1e43('0x1d')](_0x57d407[_0x1e43('0x33')][_0x1e43('0x1d')]);}_0x5bdfef[_0x1e43('0x3c')]=qs['sort'](_0x57d407[_0x1e43('0x33')]['sort']);_0x5bdfef[_0x1e43('0x3d')]=qs['filters'](_[_0x1e43('0x3e')](_0x57d407[_0x1e43('0x33')],_0x49e84a[_0x1e43('0x35')]),_0x459e5c);if(_0x57d407[_0x1e43('0x33')]['filter']){_0x5bdfef[_0x1e43('0x3d')]=_['merge'](_0x5bdfef[_0x1e43('0x3d')],{'$or':_[_0x1e43('0x2d')](_0x459e5c,function(_0x5dd06a){if(_0x5dd06a[_0x1e43('0x3f')]!=='VIRTUAL'){var _0x5be90={};_0x5be90[_0x5dd06a[_0x1e43('0x2c')]]={'$like':'%'+_0x57d407['query'][_0x1e43('0x40')]+'%'};return _0x5be90;}})});}_0x5bdfef=_[_0x1e43('0x41')]({},_0x5bdfef,_0x57d407['options']);var _0x59ffcf={'where':_0x5bdfef[_0x1e43('0x3d')]};return db['AnalyticExtractedReport'][_0x1e43('0x20')](_0x59ffcf)[_0x1e43('0x28')](function(_0x3dfddd){_0x1dc00b['count']=_0x3dfddd;if(_0x57d407[_0x1e43('0x33')]['includeAll']){_0x5bdfef[_0x1e43('0x42')]=[{'all':!![]}];}return db[_0x1e43('0x2e')][_0x1e43('0x43')](_0x5bdfef);})[_0x1e43('0x28')](function(_0x1955b8){_0x1dc00b[_0x1e43('0x44')]=_0x1955b8;return _0x1dc00b;})[_0x1e43('0x28')](respondWithFilteredResult(_0x20b7ae,_0x5bdfef))['catch'](handleError(_0x20b7ae,null));};exports['show']=function(_0x4f9daf,_0x420526){var _0x2c04d8={'raw':!![],'where':{'id':_0x4f9daf[_0x1e43('0x45')]['id']}},_0xb2d11b={};_0xb2d11b[_0x1e43('0x32')]=_[_0x1e43('0x34')](db['AnalyticExtractedReport'][_0x1e43('0x2f')]);_0xb2d11b[_0x1e43('0x33')]=_[_0x1e43('0x34')](_0x4f9daf[_0x1e43('0x33')]);_0xb2d11b[_0x1e43('0x35')]=_[_0x1e43('0x36')](_0xb2d11b['model'],_0xb2d11b[_0x1e43('0x33')]);_0x2c04d8['attributes']=_[_0x1e43('0x36')](_0xb2d11b['model'],qs[_0x1e43('0x38')](_0x4f9daf[_0x1e43('0x33')]['fields']));_0x2c04d8[_0x1e43('0x37')]=_0x2c04d8[_0x1e43('0x37')]['length']?_0x2c04d8[_0x1e43('0x37')]:_0xb2d11b[_0x1e43('0x32')];if(_0x4f9daf['query'][_0x1e43('0x46')]){_0x2c04d8[_0x1e43('0x42')]=[{'all':!![]}];}_0x2c04d8=_[_0x1e43('0x41')]({},_0x2c04d8,_0x4f9daf[_0x1e43('0x47')]);return db['AnalyticExtractedReport']['find'](_0x2c04d8)[_0x1e43('0x28')](handleEntityNotFound(_0x420526,null))[_0x1e43('0x28')](respondWithResult(_0x420526,null))[_0x1e43('0x48')](handleError(_0x420526,null));};exports[_0x1e43('0x49')]=function(_0x3a435f,_0x3fcd45){return db['AnalyticExtractedReport'][_0x1e43('0x49')](_0x3a435f['body'],{})[_0x1e43('0x28')](function(_0x722f70){var _0x52b526=_0x3a435f[_0x1e43('0x4a')][_0x1e43('0x29')]({'plain':!![]});if(!_0x52b526)throw new Error(_0x1e43('0x4b'));if(_0x52b526[_0x1e43('0x4c')]==='user'){var _0x4b18f2=_0x722f70[_0x1e43('0x29')]({'plain':!![]});var _0x5c2061='ExtractedReports';return db[_0x1e43('0x4d')][_0x1e43('0x4e')]({'where':{'name':_0x5c2061,'userProfileId':_0x52b526[_0x1e43('0x4f')]},'raw':!![]})[_0x1e43('0x28')](function(_0x28e950){if(_0x28e950&&_0x28e950[_0x1e43('0x50')]===0x0){return db[_0x1e43('0x51')]['create']({'name':_0x4b18f2['name'],'resourceId':_0x4b18f2['id'],'type':_0x28e950[_0x1e43('0x2c')],'sectionId':_0x28e950['id']},{})[_0x1e43('0x28')](function(){return _0x722f70;});}else{return _0x722f70;}})['catch'](function(_0x56c142){logger[_0x1e43('0x52')](_0x1e43('0x53'),_0x56c142);throw _0x56c142;});}return _0x722f70;})[_0x1e43('0x28')](respondWithResult(_0x3fcd45,0xc9))[_0x1e43('0x48')](handleError(_0x3fcd45,null));};exports['update']=function(_0x586694,_0x45715b){if(_0x586694[_0x1e43('0x54')]['id']){delete _0x586694['body']['id'];}return db[_0x1e43('0x2e')]['find']({'where':{'id':_0x586694[_0x1e43('0x45')]['id']}})[_0x1e43('0x28')](handleEntityNotFound(_0x45715b,null))[_0x1e43('0x28')](saveUpdates(_0x586694[_0x1e43('0x54')],null))[_0x1e43('0x28')](respondWithResult(_0x45715b,null))[_0x1e43('0x48')](handleError(_0x45715b,null));};exports['destroy']=function(_0x2adadc,_0x3b9559){return db[_0x1e43('0x2e')][_0x1e43('0x4e')]({'where':{'id':_0x2adadc[_0x1e43('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b9559,null))[_0x1e43('0x28')](removeEntity(_0x3b9559,null))['catch'](handleError(_0x3b9559,null));};exports[_0x1e43('0x55')]=function(_0x3eae44,_0x5fbf2,_0x33ceb9){return db[_0x1e43('0x2e')][_0x1e43('0x4e')]({'where':{'id':_0x3eae44[_0x1e43('0x45')]['id']},'attributes':[_0x1e43('0x2c'),'basename','savename','output'],'raw':!![]})[_0x1e43('0x28')](handleEntityNotFound(_0x5fbf2,null))[_0x1e43('0x28')](function(_0x235581){if(_0x235581){if(!fs[_0x1e43('0x56')](path[_0x1e43('0x57')](config[_0x1e43('0x58')],'server/files/reports',_0x235581['savename']))){throw new db[(_0x1e43('0x59'))]['ValidationError'](_0x1e43('0x5a'));}if(_0x3eae44[_0x1e43('0x33')]['exists']){return _0x5fbf2['sendStatus'](0xc8);}return _0x5fbf2[_0x1e43('0x55')](path['join'](config[_0x1e43('0x58')],_0x1e43('0x5b'),_0x235581[_0x1e43('0x5c')]),util[_0x1e43('0x5d')]('%s.%s',_0x235581[_0x1e43('0x5e')]||_0x235581[_0x1e43('0x2c')],_0x235581[_0x1e43('0x5f')][_0x1e43('0x60')]()));}})[_0x1e43('0x48')](handleError(_0x5fbf2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 860f4c2..7e5f3c8 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 _0x90c3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90c3,0xdb));var _0x390c=function(_0x3b06a5,_0xbbecbb){_0x3b06a5=_0x3b06a5-0x0;var _0x9ea4ea=_0x90c3[_0x3b06a5];return _0x9ea4ea;};'use strict';var _=require(_0x390c('0x0'));var util=require(_0x390c('0x1'));var logger=require(_0x390c('0x2'))('api');var moment=require(_0x390c('0x3'));var BPromise=require(_0x390c('0x4'));var rp=require(_0x390c('0x5'));var fs=require('fs');var path=require(_0x390c('0x6'));var rimraf=require(_0x390c('0x7'));var config=require(_0x390c('0x8'));var attributes=require(_0x390c('0x9'));module[_0x390c('0xa')]=function(_0x456e06,_0x51eeca){return _0x456e06['define'](_0x390c('0xb'),attributes,{'tableName':_0x390c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e97=['./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1a49a7,_0x8e8e1b){var _0x319cb1=function(_0x2f6218){while(--_0x2f6218){_0x1a49a7['push'](_0x1a49a7['shift']());}};_0x319cb1(++_0x8e8e1b);}(_0x6e97,0x117));var _0x76e9=function(_0x138330,_0x119e34){_0x138330=_0x138330-0x0;var _0x24435c=_0x6e97[_0x138330];return _0x24435c;};'use strict';var _=require(_0x76e9('0x0'));var util=require(_0x76e9('0x1'));var logger=require('../../config/logger')(_0x76e9('0x2'));var moment=require(_0x76e9('0x3'));var BPromise=require(_0x76e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76e9('0x5'));var config=require(_0x76e9('0x6'));var attributes=require(_0x76e9('0x7'));module['exports']=function(_0x1dfbb2,_0x41a5ef){return _0x1dfbb2[_0x76e9('0x8')](_0x76e9('0x9'),attributes,{'tableName':_0x76e9('0xa'),'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 e68d029..3f1f33c 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 _0x7b21=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x496af1,_0x2d5f59){var _0x5700b3=function(_0x4e346a){while(--_0x4e346a){_0x496af1['push'](_0x496af1['shift']());}};_0x5700b3(++_0x2d5f59);}(_0x7b21,0x159));var _0x17b2=function(_0x339852,_0x717220){_0x339852=_0x339852-0x0;var _0x734c8c=_0x7b21[_0x339852];return _0x734c8c;};'use strict';var _=require(_0x17b2('0x0'));var util=require(_0x17b2('0x1'));var moment=require('moment');var BPromise=require(_0x17b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17b2('0x3'))['db'];var utils=require(_0x17b2('0x4'));var logger=require(_0x17b2('0x5'))(_0x17b2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17b2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x252018,_0x225614,_0x24d9b5){return new BPromise(function(_0x2b80df,_0x38c9e9){return client[_0x17b2('0x8')](_0x252018,_0x24d9b5)[_0x17b2('0x9')](function(_0x38fd92){logger[_0x17b2('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x225614,'request\x20sent');logger['debug'](_0x17b2('0xb'),_0x225614,_0x17b2('0xc'),JSON['stringify'](_0x38fd92));if(_0x38fd92[_0x17b2('0xd')]){if(_0x38fd92[_0x17b2('0xd')][_0x17b2('0xe')]===0x1f4){logger['error'](_0x17b2('0xf'),_0x225614,_0x38fd92[_0x17b2('0xd')]['message']);return _0x38c9e9(_0x38fd92[_0x17b2('0xd')][_0x17b2('0x10')]);}logger[_0x17b2('0xd')](_0x17b2('0xf'),_0x225614,_0x38fd92[_0x17b2('0xd')][_0x17b2('0x10')]);return _0x2b80df(_0x38fd92['error'][_0x17b2('0x10')]);}else{logger[_0x17b2('0xa')](_0x17b2('0xf'),_0x225614,_0x17b2('0xc'));_0x2b80df(_0x38fd92[_0x17b2('0x11')][_0x17b2('0x10')]);}})[_0x17b2('0x12')](function(_0x953e8a){logger[_0x17b2('0xd')](_0x17b2('0xf'),_0x225614,_0x953e8a);_0x38c9e9(_0x953e8a);});});} \ No newline at end of file +var _0x7fee=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent'];(function(_0x22c2c9,_0x4ce7bb){var _0x29b7a5=function(_0x4397d5){while(--_0x4397d5){_0x22c2c9['push'](_0x22c2c9['shift']());}};_0x29b7a5(++_0x4ce7bb);}(_0x7fee,0x1a6));var _0xe7fe=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x7fee[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var moment=require(_0xe7fe('0x2'));var BPromise=require(_0xe7fe('0x3'));var rs=require(_0xe7fe('0x4'));var fs=require('fs');var Redis=require(_0xe7fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7fe('0x6'));var logger=require(_0xe7fe('0x7'))(_0xe7fe('0x8'));var config=require('../../config/environment');var jayson=require(_0xe7fe('0x9'));var client=jayson['client'][_0xe7fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeca7d9,_0x25a6a4,_0x9b55e8){return new BPromise(function(_0x1f3366,_0xf5e41b){return client[_0xe7fe('0xb')](_0xeca7d9,_0x9b55e8)['then'](function(_0x5b8d3f){logger['info'](_0xe7fe('0xc'),_0x25a6a4,'request\x20sent');logger[_0xe7fe('0xd')](_0xe7fe('0xe'),_0x25a6a4,'request\x20sent',JSON['stringify'](_0x5b8d3f));if(_0x5b8d3f[_0xe7fe('0xf')]){if(_0x5b8d3f[_0xe7fe('0xf')]['code']===0x1f4){logger[_0xe7fe('0xf')](_0xe7fe('0xc'),_0x25a6a4,_0x5b8d3f[_0xe7fe('0xf')]['message']);return _0xf5e41b(_0x5b8d3f[_0xe7fe('0xf')][_0xe7fe('0x10')]);}logger[_0xe7fe('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x25a6a4,_0x5b8d3f[_0xe7fe('0xf')][_0xe7fe('0x10')]);return _0x1f3366(_0x5b8d3f[_0xe7fe('0xf')][_0xe7fe('0x10')]);}else{logger[_0xe7fe('0x11')](_0xe7fe('0xc'),_0x25a6a4,_0xe7fe('0x12'));_0x1f3366(_0x5b8d3f[_0xe7fe('0x13')][_0xe7fe('0x10')]);}})[_0xe7fe('0x14')](function(_0x3616a6){logger[_0xe7fe('0xf')](_0xe7fe('0xc'),_0x25a6a4,_0x3616a6);_0xf5e41b(_0x3616a6);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 768450d..d5be89e 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 _0xea0b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','download','put','delete'];(function(_0x3ce7ff,_0xa8ff6){var _0x634f0d=function(_0x1e2a78){while(--_0x1e2a78){_0x3ce7ff['push'](_0x3ce7ff['shift']());}};_0x634f0d(++_0xa8ff6);}(_0xea0b,0x18e));var _0xbea0=function(_0xda8f94,_0xba9150){_0xda8f94=_0xda8f94-0x0;var _0x5ef241=_0xea0b[_0xda8f94];return _0x5ef241;};'use strict';var multer=require(_0xbea0('0x0'));var util=require('util');var path=require(_0xbea0('0x1'));var timeout=require(_0xbea0('0x2'));var express=require(_0xbea0('0x3'));var router=express[_0xbea0('0x4')]();var fs_extra=require(_0xbea0('0x5'));var auth=require(_0xbea0('0x6'));var interaction=require(_0xbea0('0x7'));var config=require(_0xbea0('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xbea0('0x9')]('/',auth[_0xbea0('0xa')](),controller[_0xbea0('0xb')]);router[_0xbea0('0x9')](_0xbea0('0xc'),auth[_0xbea0('0xa')](),controller['show']);router[_0xbea0('0x9')]('/:id/download',auth[_0xbea0('0xa')](),controller[_0xbea0('0xd')]);router['post']('/',auth[_0xbea0('0xa')](),controller['create']);router[_0xbea0('0xe')]('/:id',auth[_0xbea0('0xa')](),controller['update']);router[_0xbea0('0xf')](_0xbea0('0xc'),auth[_0xbea0('0xa')](),controller[_0xbea0('0x10')]);module[_0xbea0('0x11')]=router; \ No newline at end of file +var _0x0706=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','put','update','delete','destroy','multer','util','path'];(function(_0x1978fc,_0x398da2){var _0x1da73a=function(_0x8f23c2){while(--_0x8f23c2){_0x1978fc['push'](_0x1978fc['shift']());}};_0x1da73a(++_0x398da2);}(_0x0706,0x123));var _0x6070=function(_0x3d50a3,_0x5279e4){_0x3d50a3=_0x3d50a3-0x0;var _0x449c5b=_0x0706[_0x3d50a3];return _0x449c5b;};'use strict';var multer=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var path=require(_0x6070('0x2'));var timeout=require(_0x6070('0x3'));var express=require(_0x6070('0x4'));var router=express[_0x6070('0x5')]();var fs_extra=require(_0x6070('0x6'));var auth=require(_0x6070('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6070('0x8'));var controller=require(_0x6070('0x9'));router[_0x6070('0xa')]('/',auth[_0x6070('0xb')](),controller[_0x6070('0xc')]);router[_0x6070('0xa')](_0x6070('0xd'),auth['isAuthenticated'](),controller[_0x6070('0xe')]);router['get'](_0x6070('0xf'),auth[_0x6070('0xb')](),controller[_0x6070('0x10')]);router['post']('/',auth[_0x6070('0xb')](),controller['create']);router[_0x6070('0x11')](_0x6070('0xd'),auth[_0x6070('0xb')](),controller[_0x6070('0x12')]);router[_0x6070('0x13')](_0x6070('0xd'),auth[_0x6070('0xb')](),controller[_0x6070('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3df8881..6cc1680 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 _0x7864=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1fa4c8,_0x5d9c19){var _0x1cb245=function(_0x5acc86){while(--_0x5acc86){_0x1fa4c8['push'](_0x1fa4c8['shift']());}};_0x1cb245(++_0x5d9c19);}(_0x7864,0x9e));var _0x4786=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x7864[_0x5d80de];return _0x1c7556;};'use strict';var Sequelize=require(_0x4786('0x0'));module[_0x4786('0x1')]={'field':{'type':Sequelize[_0x4786('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x4786('0x3')]},'format':{'type':Sequelize[_0x4786('0x3')]},'groupBy':{'type':Sequelize[_0x4786('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4786('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3b6b=['BOOLEAN','STRING'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x3b6b,0x1ef));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb3b6('0x0')]},'groupBy':{'type':Sequelize[_0xb3b6('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb3b6('0x0')]},'custom':{'type':Sequelize[_0xb3b6('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b392c3c..717951a 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 _0xc832=['transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','limit','undefined','count','status','set','apply','reject','save','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','fieldName','type','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','bulkCreate','body','update','ids','addFields','findOne','sequelize'];(function(_0x31c178,_0x4a428c){var _0x2d5a9f=function(_0x367641){while(--_0x367641){_0x31c178['push'](_0x31c178['shift']());}};_0x2d5a9f(++_0x4a428c);}(_0xc832,0x1e8));var _0x2c83=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xc832[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x2c83('0x0'));var rimraf=require(_0x2c83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c83('0x2'));var rp=require(_0x2c83('0x3'));var moment=require(_0x2c83('0x4'));var BPromise=require(_0x2c83('0x5'));var Mustache=require(_0x2c83('0x6'));var util=require(_0x2c83('0x7'));var path=require('path');var sox=require(_0x2c83('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c83('0x9'));var squel=require(_0x2c83('0xa'));var crypto=require(_0x2c83('0xb'));var jsforce=require(_0x2c83('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c83('0xd'));var Papa=require(_0x2c83('0xe'));var Redis=require(_0x2c83('0xf'));var authService=require(_0x2c83('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c83('0x11'));var logger=require('../../config/logger')(_0x2c83('0x12'));var utils=require(_0x2c83('0x13'));var config=require(_0x2c83('0x14'));var licenseUtil=require(_0x2c83('0x15'));var db=require(_0x2c83('0x16'))['db'];function respondWithStatusCode(_0x4000fd,_0x18a7e9){_0x18a7e9=_0x18a7e9||0xcc;return function(_0x70565a){if(_0x70565a){return _0x4000fd[_0x2c83('0x17')](_0x18a7e9);}return _0x4000fd['status'](_0x18a7e9)['end']();};}function respondWithResult(_0x48cc96,_0x40ac5c){_0x40ac5c=_0x40ac5c||0xc8;return function(_0x360ac1){if(_0x360ac1){return _0x48cc96['status'](_0x40ac5c)['json'](_0x360ac1);}};}function respondWithFilteredResult(_0x1569f0,_0x355838){return function(_0xe35370){if(_0xe35370){var _0x42135d=typeof _0x355838[_0x2c83('0x18')]==='undefined'&&typeof _0x355838[_0x2c83('0x19')]===_0x2c83('0x1a');var _0x5ef8dc=_0xe35370[_0x2c83('0x1b')];var _0x1a6883=_0x42135d?0x0:_0x355838['offset'];var _0x51fe17=_0x42135d?_0xe35370[_0x2c83('0x1b')]:_0x355838[_0x2c83('0x18')]+_0x355838[_0x2c83('0x19')];var _0x21fa0c;if(_0x51fe17>=_0x5ef8dc){_0x51fe17=_0x5ef8dc;_0x21fa0c=0xc8;}else{_0x21fa0c=0xce;}_0x1569f0[_0x2c83('0x1c')](_0x21fa0c);return _0x1569f0[_0x2c83('0x1d')]('Content-Range',_0x1a6883+'-'+_0x51fe17+'/'+_0x5ef8dc)['json'](_0xe35370);}return null;};}function patchUpdates(_0x515ce3){return function(_0x464bd8){try{jsonpatch[_0x2c83('0x1e')](_0x464bd8,_0x515ce3,!![]);}catch(_0x1252f8){return BPromise[_0x2c83('0x1f')](_0x1252f8);}return _0x464bd8[_0x2c83('0x20')]();};}function saveUpdates(_0x31190e,_0x3b13ed){return function(_0x54b5b7){if(_0x54b5b7){return _0x54b5b7['update'](_0x31190e)[_0x2c83('0x21')](function(_0x37e2b1){return _0x37e2b1;});}return null;};}function removeEntity(_0x1fd0cf,_0x410f27){return function(_0x2d8e39){if(_0x2d8e39){return _0x2d8e39[_0x2c83('0x22')]()['then'](function(){_0x1fd0cf[_0x2c83('0x1c')](0xcc)[_0x2c83('0x23')]();});}};}function handleEntityNotFound(_0x4918a1,_0x13a92d){return function(_0x48a11e){if(!_0x48a11e){_0x4918a1['sendStatus'](0x194);}return _0x48a11e;};}function handleError(_0x1a1770,_0x52edad){_0x52edad=_0x52edad||0x1f4;return function(_0x2e92c3){logger[_0x2c83('0x24')](_0x2e92c3['stack']);if(_0x2e92c3[_0x2c83('0x25')]){delete _0x2e92c3[_0x2c83('0x25')];}_0x1a1770[_0x2c83('0x1c')](_0x52edad)[_0x2c83('0x26')](_0x2e92c3);};}exports[_0x2c83('0x27')]=function(_0x21daf9,_0x3a6ce1){var _0x3c441c={},_0x25d800={},_0x40fdbb={'count':0x0,'rows':[]};var _0x2bfdbc=_[_0x2c83('0x28')](db[_0x2c83('0x29')]['rawAttributes'],function(_0x452af0){return{'name':_0x452af0[_0x2c83('0x2a')],'type':_0x452af0[_0x2c83('0x2b')]['key']};});_0x25d800['model']=_['map'](_0x2bfdbc,_0x2c83('0x25'));_0x25d800['query']=_['keys'](_0x21daf9[_0x2c83('0x2c')]);_0x25d800[_0x2c83('0x2d')]=_[_0x2c83('0x2e')](_0x25d800['model'],_0x25d800['query']);_0x3c441c[_0x2c83('0x2f')]=_[_0x2c83('0x2e')](_0x25d800[_0x2c83('0x30')],qs[_0x2c83('0x31')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x31')]));_0x3c441c['attributes']=_0x3c441c[_0x2c83('0x2f')]['length']?_0x3c441c['attributes']:_0x25d800[_0x2c83('0x30')];if(!_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x32')](_0x2c83('0x33'))){_0x3c441c['limit']=qs[_0x2c83('0x19')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x19')]);_0x3c441c['offset']=qs[_0x2c83('0x18')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x18')]);}_0x3c441c[_0x2c83('0x34')]=qs[_0x2c83('0x35')](_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x35')]);_0x3c441c[_0x2c83('0x36')]=qs[_0x2c83('0x2d')](_[_0x2c83('0x37')](_0x21daf9[_0x2c83('0x2c')],_0x25d800[_0x2c83('0x2d')]),_0x2bfdbc);if(_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x38')]){_0x3c441c['where']=_[_0x2c83('0x39')](_0x3c441c['where'],{'$or':_[_0x2c83('0x28')](_0x2bfdbc,function(_0xc9c0ef){if(_0xc9c0ef[_0x2c83('0x2b')]!==_0x2c83('0x3a')){var _0x1685c0={};_0x1685c0[_0xc9c0ef['name']]={'$like':'%'+_0x21daf9['query'][_0x2c83('0x38')]+'%'};return _0x1685c0;}})});}_0x3c441c=_[_0x2c83('0x39')]({},_0x3c441c,_0x21daf9[_0x2c83('0x3b')]);var _0x482be3={'where':_0x3c441c['where']};return db[_0x2c83('0x29')][_0x2c83('0x1b')](_0x482be3)[_0x2c83('0x21')](function(_0x2d36fd){_0x40fdbb[_0x2c83('0x1b')]=_0x2d36fd;if(_0x21daf9[_0x2c83('0x2c')][_0x2c83('0x3c')]){_0x3c441c[_0x2c83('0x3d')]=[{'all':!![]}];}return db[_0x2c83('0x29')][_0x2c83('0x3e')](_0x3c441c);})[_0x2c83('0x21')](function(_0x52b7bc){_0x40fdbb[_0x2c83('0x3f')]=_0x52b7bc;return _0x40fdbb;})['then'](respondWithFilteredResult(_0x3a6ce1,_0x3c441c))[_0x2c83('0x40')](handleError(_0x3a6ce1,null));};exports[_0x2c83('0x41')]=function(_0x151520,_0x5ede27){var _0x324fd2={'raw':![],'where':{'id':_0x151520[_0x2c83('0x42')]['id']}},_0x27ea5e={};_0x27ea5e[_0x2c83('0x30')]=_[_0x2c83('0x43')](db[_0x2c83('0x29')][_0x2c83('0x44')]);_0x27ea5e[_0x2c83('0x2c')]=_['keys'](_0x151520[_0x2c83('0x2c')]);_0x27ea5e[_0x2c83('0x2d')]=_[_0x2c83('0x2e')](_0x27ea5e[_0x2c83('0x30')],_0x27ea5e['query']);_0x324fd2[_0x2c83('0x2f')]=_[_0x2c83('0x2e')](_0x27ea5e[_0x2c83('0x30')],qs[_0x2c83('0x31')](_0x151520['query']['fields']));_0x324fd2[_0x2c83('0x2f')]=_0x324fd2[_0x2c83('0x2f')][_0x2c83('0x45')]?_0x324fd2['attributes']:_0x27ea5e[_0x2c83('0x30')];if(_0x151520[_0x2c83('0x2c')][_0x2c83('0x3c')]){_0x324fd2[_0x2c83('0x3d')]=[{'all':!![]}];}_0x324fd2=_[_0x2c83('0x39')]({},_0x324fd2,_0x151520['options']);return db['AnalyticFieldReport'][_0x2c83('0x46')](_0x324fd2)[_0x2c83('0x21')](handleEntityNotFound(_0x5ede27,null))[_0x2c83('0x21')](respondWithResult(_0x5ede27,null))['catch'](handleError(_0x5ede27,null));};exports['create']=function(_0x466970,_0x87177c){return db[_0x2c83('0x29')][_0x2c83('0x47')](_0x466970['body'],{})['then'](respondWithResult(_0x87177c,0xc9))['catch'](handleError(_0x87177c,null));};exports[_0x2c83('0x48')]=function(_0xab3388,_0x49ccf4){return db['AnalyticFieldReport'][_0x2c83('0x48')](_0xab3388[_0x2c83('0x49')],{'raw':![],'individualHooks':!![]})[_0x2c83('0x21')](respondWithResult(_0x49ccf4,0xc9))[_0x2c83('0x40')](handleError(_0x49ccf4,null));};exports[_0x2c83('0x4a')]=function(_0x22fae2,_0x2314dc){if(_0x22fae2['body']['id']){delete _0x22fae2['body']['id'];}return db['AnalyticFieldReport'][_0x2c83('0x46')]({'where':{'id':_0x22fae2[_0x2c83('0x42')]['id']}})['then'](handleEntityNotFound(_0x2314dc,null))[_0x2c83('0x21')](saveUpdates(_0x22fae2[_0x2c83('0x49')],null))[_0x2c83('0x21')](respondWithResult(_0x2314dc,null))[_0x2c83('0x40')](handleError(_0x2314dc,null));};exports[_0x2c83('0x22')]=function(_0x4f290a,_0x488883){return db[_0x2c83('0x29')][_0x2c83('0x46')]({'where':{'id':_0x4f290a[_0x2c83('0x42')]['id']}})['then'](handleEntityNotFound(_0x488883,null))[_0x2c83('0x21')](removeEntity(_0x488883,null))[_0x2c83('0x40')](handleError(_0x488883,null));};exports['bulkDestroy']=function(_0x153320,_0x21bc93){return db['AnalyticFieldReport'][_0x2c83('0x22')]({'where':{'id':_0x153320['query'][_0x2c83('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x2c83('0x21')](respondWithResult(_0x21bc93,0xcc))[_0x2c83('0x40')](handleError(_0x21bc93,null));};exports[_0x2c83('0x4c')]=function(_0xa7d0cc,_0x96bf12,_0x3cd559){return db['AnalyticCustomReport'][_0x2c83('0x4d')]({'where':{'id':_0xa7d0cc['params']['id']}})[_0x2c83('0x21')](handleEntityNotFound(_0x96bf12,null))[_0x2c83('0x21')](function(_0x4b75d8){if(_0x4b75d8){return db[_0x2c83('0x4e')][_0x2c83('0x4f')](function(_0x50f3b2){return db[_0x2c83('0x29')][_0x2c83('0x22')]({'where':{'CustomReportId':_0xa7d0cc['params']['id']},'transaction':_0x50f3b2})[_0x2c83('0x21')](function(_0x34fa01){var _0x479037=_[_0x2c83('0x28')](_0xa7d0cc[_0x2c83('0x49')],function(_0x21ba86){delete _0x21ba86['id'];_0x21ba86[_0x2c83('0x50')]=_0xa7d0cc['params']['id'];return _0x21ba86;});return db['AnalyticFieldReport'][_0x2c83('0x48')](_0x479037,{'transaction':_0x50f3b2});});})[_0x2c83('0x21')](function(){return db[_0x2c83('0x29')][_0x2c83('0x3e')]({'where':{'CustomReportId':_0xa7d0cc[_0x2c83('0x42')]['id']}});});}})['then'](respondWithResult(_0x96bf12,null))[_0x2c83('0x40')](handleError(_0x96bf12,null));}; \ No newline at end of file +var _0x208c=['sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','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','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x208c,0x103));var _0xc208=function(_0x3be389,_0x4d9eef){_0x3be389=_0x3be389-0x0;var _0x309763=_0x208c[_0x3be389];return _0x309763;};'use strict';var emlformat=require(_0xc208('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc208('0x1'));var jsonpatch=require(_0xc208('0x2'));var rp=require(_0xc208('0x3'));var moment=require(_0xc208('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc208('0x5'));var util=require(_0xc208('0x6'));var path=require(_0xc208('0x7'));var sox=require('sox');var csv=require(_0xc208('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc208('0x9'));var crypto=require(_0xc208('0xa'));var jsforce=require(_0xc208('0xb'));var deskjs=require(_0xc208('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc208('0xd'));var Papa=require('papaparse');var Redis=require(_0xc208('0xe'));var authService=require(_0xc208('0xf'));var qs=require(_0xc208('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc208('0x11'));var logger=require(_0xc208('0x12'))(_0xc208('0x13'));var utils=require(_0xc208('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc208('0x15'));var db=require(_0xc208('0x16'))['db'];function respondWithStatusCode(_0xeba457,_0x2f534e){_0x2f534e=_0x2f534e||0xcc;return function(_0x3520f5){if(_0x3520f5){return _0xeba457[_0xc208('0x17')](_0x2f534e);}return _0xeba457[_0xc208('0x18')](_0x2f534e)[_0xc208('0x19')]();};}function respondWithResult(_0x595ef6,_0x4005d7){_0x4005d7=_0x4005d7||0xc8;return function(_0x1a5ffa){if(_0x1a5ffa){return _0x595ef6['status'](_0x4005d7)[_0xc208('0x1a')](_0x1a5ffa);}};}function respondWithFilteredResult(_0x1f9ad2,_0x42f6fc){return function(_0x1293eb){if(_0x1293eb){var _0x1a23b5=typeof _0x42f6fc['offset']===_0xc208('0x1b')&&typeof _0x42f6fc['limit']==='undefined';var _0x35dbde=_0x1293eb[_0xc208('0x1c')];var _0x257194=_0x1a23b5?0x0:_0x42f6fc[_0xc208('0x1d')];var _0x1478b2=_0x1a23b5?_0x1293eb[_0xc208('0x1c')]:_0x42f6fc[_0xc208('0x1d')]+_0x42f6fc[_0xc208('0x1e')];var _0x32dfa5;if(_0x1478b2>=_0x35dbde){_0x1478b2=_0x35dbde;_0x32dfa5=0xc8;}else{_0x32dfa5=0xce;}_0x1f9ad2[_0xc208('0x18')](_0x32dfa5);return _0x1f9ad2['set'](_0xc208('0x1f'),_0x257194+'-'+_0x1478b2+'/'+_0x35dbde)[_0xc208('0x1a')](_0x1293eb);}return null;};}function patchUpdates(_0x1ce291){return function(_0x4d80b9){try{jsonpatch[_0xc208('0x20')](_0x4d80b9,_0x1ce291,!![]);}catch(_0xeb2969){return BPromise[_0xc208('0x21')](_0xeb2969);}return _0x4d80b9[_0xc208('0x22')]();};}function saveUpdates(_0x4b99ee,_0x3ce5e8){return function(_0xd5f3d5){if(_0xd5f3d5){return _0xd5f3d5[_0xc208('0x23')](_0x4b99ee)[_0xc208('0x24')](function(_0x59f37c){return _0x59f37c;});}return null;};}function removeEntity(_0x1766a7,_0x4c7378){return function(_0x478711){if(_0x478711){return _0x478711[_0xc208('0x25')]()['then'](function(){_0x1766a7[_0xc208('0x18')](0xcc)[_0xc208('0x19')]();});}};}function handleEntityNotFound(_0x18bef3,_0x10f1e0){return function(_0x753dac){if(!_0x753dac){_0x18bef3[_0xc208('0x17')](0x194);}return _0x753dac;};}function handleError(_0x40f933,_0x3196d1){_0x3196d1=_0x3196d1||0x1f4;return function(_0x55ff6a){logger[_0xc208('0x26')](_0x55ff6a[_0xc208('0x27')]);if(_0x55ff6a[_0xc208('0x28')]){delete _0x55ff6a[_0xc208('0x28')];}_0x40f933[_0xc208('0x18')](_0x3196d1)[_0xc208('0x29')](_0x55ff6a);};}exports[_0xc208('0x2a')]=function(_0xa42b39,_0x40a5ce){var _0xb0e322={},_0x210a28={},_0x5d8a3c={'count':0x0,'rows':[]};var _0x139edd=_['map'](db[_0xc208('0x2b')][_0xc208('0x2c')],function(_0x45f100){return{'name':_0x45f100[_0xc208('0x2d')],'type':_0x45f100[_0xc208('0x2e')]['key']};});_0x210a28[_0xc208('0x2f')]=_[_0xc208('0x30')](_0x139edd,_0xc208('0x28'));_0x210a28[_0xc208('0x31')]=_[_0xc208('0x32')](_0xa42b39[_0xc208('0x31')]);_0x210a28[_0xc208('0x33')]=_[_0xc208('0x34')](_0x210a28[_0xc208('0x2f')],_0x210a28['query']);_0xb0e322[_0xc208('0x35')]=_[_0xc208('0x34')](_0x210a28[_0xc208('0x2f')],qs[_0xc208('0x36')](_0xa42b39['query'][_0xc208('0x36')]));_0xb0e322[_0xc208('0x35')]=_0xb0e322['attributes']['length']?_0xb0e322[_0xc208('0x35')]:_0x210a28[_0xc208('0x2f')];if(!_0xa42b39[_0xc208('0x31')][_0xc208('0x37')](_0xc208('0x38'))){_0xb0e322[_0xc208('0x1e')]=qs[_0xc208('0x1e')](_0xa42b39[_0xc208('0x31')][_0xc208('0x1e')]);_0xb0e322[_0xc208('0x1d')]=qs[_0xc208('0x1d')](_0xa42b39['query'][_0xc208('0x1d')]);}_0xb0e322['order']=qs[_0xc208('0x39')](_0xa42b39[_0xc208('0x31')][_0xc208('0x39')]);_0xb0e322[_0xc208('0x3a')]=qs[_0xc208('0x33')](_[_0xc208('0x3b')](_0xa42b39[_0xc208('0x31')],_0x210a28[_0xc208('0x33')]),_0x139edd);if(_0xa42b39[_0xc208('0x31')]['filter']){_0xb0e322['where']=_[_0xc208('0x3c')](_0xb0e322['where'],{'$or':_[_0xc208('0x30')](_0x139edd,function(_0x26160d){if(_0x26160d[_0xc208('0x2e')]!=='VIRTUAL'){var _0x452a1a={};_0x452a1a[_0x26160d[_0xc208('0x28')]]={'$like':'%'+_0xa42b39[_0xc208('0x31')][_0xc208('0x3d')]+'%'};return _0x452a1a;}})});}_0xb0e322=_['merge']({},_0xb0e322,_0xa42b39[_0xc208('0x3e')]);var _0x1cf0c4={'where':_0xb0e322[_0xc208('0x3a')]};return db[_0xc208('0x2b')][_0xc208('0x1c')](_0x1cf0c4)[_0xc208('0x24')](function(_0x29e82b){_0x5d8a3c[_0xc208('0x1c')]=_0x29e82b;if(_0xa42b39[_0xc208('0x31')]['includeAll']){_0xb0e322[_0xc208('0x3f')]=[{'all':!![]}];}return db[_0xc208('0x2b')][_0xc208('0x40')](_0xb0e322);})[_0xc208('0x24')](function(_0x257787){_0x5d8a3c[_0xc208('0x41')]=_0x257787;return _0x5d8a3c;})['then'](respondWithFilteredResult(_0x40a5ce,_0xb0e322))[_0xc208('0x42')](handleError(_0x40a5ce,null));};exports[_0xc208('0x43')]=function(_0x3ff1aa,_0x13b7de){var _0x3f2d4e={'raw':![],'where':{'id':_0x3ff1aa[_0xc208('0x44')]['id']}},_0x54116b={};_0x54116b[_0xc208('0x2f')]=_[_0xc208('0x32')](db[_0xc208('0x2b')][_0xc208('0x2c')]);_0x54116b[_0xc208('0x31')]=_[_0xc208('0x32')](_0x3ff1aa['query']);_0x54116b[_0xc208('0x33')]=_[_0xc208('0x34')](_0x54116b[_0xc208('0x2f')],_0x54116b[_0xc208('0x31')]);_0x3f2d4e[_0xc208('0x35')]=_['intersection'](_0x54116b[_0xc208('0x2f')],qs[_0xc208('0x36')](_0x3ff1aa['query'][_0xc208('0x36')]));_0x3f2d4e['attributes']=_0x3f2d4e[_0xc208('0x35')]['length']?_0x3f2d4e['attributes']:_0x54116b[_0xc208('0x2f')];if(_0x3ff1aa[_0xc208('0x31')][_0xc208('0x45')]){_0x3f2d4e[_0xc208('0x3f')]=[{'all':!![]}];}_0x3f2d4e=_['merge']({},_0x3f2d4e,_0x3ff1aa['options']);return db[_0xc208('0x2b')][_0xc208('0x46')](_0x3f2d4e)[_0xc208('0x24')](handleEntityNotFound(_0x13b7de,null))['then'](respondWithResult(_0x13b7de,null))[_0xc208('0x42')](handleError(_0x13b7de,null));};exports[_0xc208('0x47')]=function(_0x1f9e01,_0x2aeeaf){return db['AnalyticFieldReport'][_0xc208('0x47')](_0x1f9e01[_0xc208('0x48')],{})[_0xc208('0x24')](respondWithResult(_0x2aeeaf,0xc9))[_0xc208('0x42')](handleError(_0x2aeeaf,null));};exports[_0xc208('0x49')]=function(_0x126d16,_0x486cb7){return db['AnalyticFieldReport']['bulkCreate'](_0x126d16['body'],{'raw':![],'individualHooks':!![]})[_0xc208('0x24')](respondWithResult(_0x486cb7,0xc9))['catch'](handleError(_0x486cb7,null));};exports[_0xc208('0x23')]=function(_0x6174a5,_0x46ecfa){if(_0x6174a5['body']['id']){delete _0x6174a5[_0xc208('0x48')]['id'];}return db['AnalyticFieldReport'][_0xc208('0x46')]({'where':{'id':_0x6174a5[_0xc208('0x44')]['id']}})[_0xc208('0x24')](handleEntityNotFound(_0x46ecfa,null))[_0xc208('0x24')](saveUpdates(_0x6174a5[_0xc208('0x48')],null))[_0xc208('0x24')](respondWithResult(_0x46ecfa,null))[_0xc208('0x42')](handleError(_0x46ecfa,null));};exports[_0xc208('0x25')]=function(_0x46e69d,_0x569635){return db[_0xc208('0x2b')][_0xc208('0x46')]({'where':{'id':_0x46e69d[_0xc208('0x44')]['id']}})['then'](handleEntityNotFound(_0x569635,null))[_0xc208('0x24')](removeEntity(_0x569635,null))[_0xc208('0x42')](handleError(_0x569635,null));};exports[_0xc208('0x4a')]=function(_0x1198f3,_0x44b76f){return db[_0xc208('0x2b')][_0xc208('0x25')]({'where':{'id':_0x1198f3[_0xc208('0x31')][_0xc208('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xc208('0x24')](respondWithResult(_0x44b76f,0xcc))['catch'](handleError(_0x44b76f,null));};exports[_0xc208('0x4c')]=function(_0x206542,_0x41ef3c,_0x90c930){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x206542[_0xc208('0x44')]['id']}})[_0xc208('0x24')](handleEntityNotFound(_0x41ef3c,null))['then'](function(_0x12c437){if(_0x12c437){return db[_0xc208('0x4d')]['transaction'](function(_0x1dfd7d){return db[_0xc208('0x2b')][_0xc208('0x25')]({'where':{'CustomReportId':_0x206542[_0xc208('0x44')]['id']},'transaction':_0x1dfd7d})[_0xc208('0x24')](function(_0x28bf51){var _0x334731=_[_0xc208('0x30')](_0x206542['body'],function(_0x3c113c){delete _0x3c113c['id'];_0x3c113c[_0xc208('0x4e')]=_0x206542['params']['id'];return _0x3c113c;});return db[_0xc208('0x2b')]['bulkCreate'](_0x334731,{'transaction':_0x1dfd7d});});})[_0xc208('0x24')](function(){return db[_0xc208('0x2b')][_0xc208('0x40')]({'where':{'CustomReportId':_0x206542[_0xc208('0x44')]['id']}});});}})['then'](respondWithResult(_0x41ef3c,null))[_0xc208('0x42')](handleError(_0x41ef3c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6df9a70..ce057d6 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 _0x36f4=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment'];(function(_0x5dce5a,_0x553e15){var _0x17fd57=function(_0x39055e){while(--_0x39055e){_0x5dce5a['push'](_0x5dce5a['shift']());}};_0x17fd57(++_0x553e15);}(_0x36f4,0x163));var _0x436f=function(_0x14cbd8,_0x4c86ed){_0x14cbd8=_0x14cbd8-0x0;var _0x305443=_0x36f4[_0x14cbd8];return _0x305443;};'use strict';var _=require(_0x436f('0x0'));var util=require(_0x436f('0x1'));var logger=require(_0x436f('0x2'))(_0x436f('0x3'));var moment=require(_0x436f('0x4'));var BPromise=require(_0x436f('0x5'));var rp=require(_0x436f('0x6'));var fs=require('fs');var path=require(_0x436f('0x7'));var rimraf=require(_0x436f('0x8'));var config=require(_0x436f('0x9'));var attributes=require(_0x436f('0xa'));module[_0x436f('0xb')]=function(_0x1c0dda,_0xa70d8a){return _0x1c0dda[_0x436f('0xc')](_0x436f('0xd'),attributes,{'tableName':_0x436f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfba=['analytics_report_fields','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport'];(function(_0x59c703,_0xd196b8){var _0x45ca3f=function(_0x4924a4){while(--_0x4924a4){_0x59c703['push'](_0x59c703['shift']());}};_0x45ca3f(++_0xd196b8);}(_0xcfba,0x6f));var _0xacfb=function(_0x305e7c,_0x598a67){_0x305e7c=_0x305e7c-0x0;var _0x23a4e4=_0xcfba[_0x305e7c];return _0x23a4e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xacfb('0x0'))(_0xacfb('0x1'));var moment=require(_0xacfb('0x2'));var BPromise=require(_0xacfb('0x3'));var rp=require(_0xacfb('0x4'));var fs=require('fs');var path=require(_0xacfb('0x5'));var rimraf=require('rimraf');var config=require(_0xacfb('0x6'));var attributes=require(_0xacfb('0x7'));module['exports']=function(_0x1cc74c,_0x238456){return _0x1cc74c['define'](_0xacfb('0x8'),attributes,{'tableName':_0xacfb('0x9'),'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 267483a..ddc9629 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 _0x2316=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash','util','moment','ioredis'];(function(_0x574308,_0x447878){var _0x233bb4=function(_0x347814){while(--_0x347814){_0x574308['push'](_0x574308['shift']());}};_0x233bb4(++_0x447878);}(_0x2316,0xc4));var _0x6231=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x2316[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0x6231('0x0'));var util=require(_0x6231('0x1'));var moment=require(_0x6231('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6231('0x3'));var db=require(_0x6231('0x4'))['db'];var utils=require(_0x6231('0x5'));var logger=require(_0x6231('0x6'))('rpc');var config=require(_0x6231('0x7'));var jayson=require(_0x6231('0x8'));var client=jayson[_0x6231('0x9')][_0x6231('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf63932,_0x89e20f,_0x16dec1){return new BPromise(function(_0x9abe76,_0x5a7117){return client[_0x6231('0xb')](_0xf63932,_0x16dec1)[_0x6231('0xc')](function(_0x3f2994){logger['info'](_0x6231('0xd'),_0x89e20f,'request\x20sent');logger[_0x6231('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x89e20f,_0x6231('0xf'),JSON['stringify'](_0x3f2994));if(_0x3f2994[_0x6231('0x10')]){if(_0x3f2994[_0x6231('0x10')][_0x6231('0x11')]===0x1f4){logger[_0x6231('0x10')](_0x6231('0xd'),_0x89e20f,_0x3f2994[_0x6231('0x10')][_0x6231('0x12')]);return _0x5a7117(_0x3f2994[_0x6231('0x10')][_0x6231('0x12')]);}logger[_0x6231('0x10')](_0x6231('0xd'),_0x89e20f,_0x3f2994[_0x6231('0x10')][_0x6231('0x12')]);return _0x9abe76(_0x3f2994[_0x6231('0x10')]['message']);}else{logger[_0x6231('0x13')](_0x6231('0xd'),_0x89e20f,_0x6231('0xf'));_0x9abe76(_0x3f2994['result']['message']);}})['catch'](function(_0x196ac7){logger[_0x6231('0x10')](_0x6231('0xd'),_0x89e20f,_0x196ac7);_0x5a7117(_0x196ac7);});});} \ No newline at end of file +var _0x86a0=['http','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d69a4,_0x32935e){var _0xe0705b=function(_0x2a9344){while(--_0x2a9344){_0x2d69a4['push'](_0x2d69a4['shift']());}};_0xe0705b(++_0x32935e);}(_0x86a0,0x91));var _0x086a=function(_0x6d97f7,_0x30f226){_0x6d97f7=_0x6d97f7-0x0;var _0x473049=_0x86a0[_0x6d97f7];return _0x473049;};'use strict';var _=require('lodash');var util=require(_0x086a('0x0'));var moment=require(_0x086a('0x1'));var BPromise=require(_0x086a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x086a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x086a('0x4'));var logger=require(_0x086a('0x5'))(_0x086a('0x6'));var config=require(_0x086a('0x7'));var jayson=require(_0x086a('0x8'));var client=jayson['client'][_0x086a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d2a61,_0x3720cb,_0x359dac){return new BPromise(function(_0x1fa2f0,_0x4e9091){return client[_0x086a('0xa')](_0x2d2a61,_0x359dac)[_0x086a('0xb')](function(_0x2acd67){logger[_0x086a('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3720cb,'request\x20sent');logger[_0x086a('0xd')](_0x086a('0xe'),_0x3720cb,_0x086a('0xf'),JSON['stringify'](_0x2acd67));if(_0x2acd67[_0x086a('0x10')]){if(_0x2acd67[_0x086a('0x10')][_0x086a('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3720cb,_0x2acd67['error'][_0x086a('0x12')]);return _0x4e9091(_0x2acd67[_0x086a('0x10')][_0x086a('0x12')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3720cb,_0x2acd67[_0x086a('0x10')][_0x086a('0x12')]);return _0x1fa2f0(_0x2acd67[_0x086a('0x10')]['message']);}else{logger[_0x086a('0xc')](_0x086a('0x13'),_0x3720cb,'request\x20sent');_0x1fa2f0(_0x2acd67[_0x086a('0x14')][_0x086a('0x12')]);}})[_0x086a('0x15')](function(_0x484d7e){logger[_0x086a('0x10')](_0x086a('0x13'),_0x3720cb,_0x484d7e);_0x4e9091(_0x484d7e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a12ca20..e612065 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(_0x51c87e,_0x5dc3ea){var _0x38da34=function(_0x5cb9e5){while(--_0x5cb9e5){_0x51c87e['push'](_0x51c87e['shift']());}};_0x38da34(++_0x5dc3ea);}(_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['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(_0x4ff7b9,_0x44b182){var _0x307b5e=function(_0x5a7fcc){while(--_0x5a7fcc){_0x4ff7b9['push'](_0x4ff7b9['shift']());}};_0x307b5e(++_0x44b182);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 43d3b00..cf59269 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 _0x41bb=['TEXT','STRING','sequelize','exports','name'];(function(_0x48a91d,_0x54cdaa){var _0x288403=function(_0x72e98b){while(--_0x72e98b){_0x48a91d['push'](_0x48a91d['shift']());}};_0x288403(++_0x54cdaa);}(_0x41bb,0xc5));var _0xb41b=function(_0xe37b5,_0x5ef854){_0xe37b5=_0xe37b5-0x0;var _0x2b09ab=_0x41bb[_0xe37b5];return _0x2b09ab;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb41b('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xb41b('0x3')]},'description':{'type':Sequelize[_0xb41b('0x4')]}}; \ No newline at end of file +var _0x3c81=['name','STRING','sequelize','exports'];(function(_0xe08aff,_0x3b55ff){var _0x4ab3df=function(_0x5c6301){while(--_0x5c6301){_0xe08aff['push'](_0xe08aff['shift']());}};_0x4ab3df(++_0x3b55ff);}(_0x3c81,0x102));var _0x13c8=function(_0x28f317,_0x44cf09){_0x28f317=_0x28f317-0x0;var _0x27b7f3=_0x3c81[_0x28f317];return _0x27b7f3;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x13c8('0x2')},'table':{'type':Sequelize[_0x13c8('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fbe48e0..0445871 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 _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5552d7,_0x37c9da){var _0x5b49d6=function(_0x1a2c78){while(--_0x1a2c78){_0x5552d7['push'](_0x5552d7['shift']());}};_0x5b49d6(++_0x37c9da);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x7fbe[_0x650e11];return _0x1a9b47;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x50b53a,_0x50f7bc){var _0x116765=function(_0x7bbdc){while(--_0x7bbdc){_0x50b53a['push'](_0x50b53a['shift']());}};_0x116765(++_0x50f7bc);}(_0x55ca,0x126));var _0xa55c=function(_0x2adf4,_0x5df6de){_0x2adf4=_0x2adf4-0x0;var _0x45d47d=_0x55ca[_0x2adf4];return _0x45d47d;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2c68043..ce1c326 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 _0xc9c3=['path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xc9c3,0x96));var _0x3c9c=function(_0x191d71,_0x32ce70){_0x191d71=_0x191d71-0x0;var _0x3b6195=_0xc9c3[_0x191d71];return _0x3b6195;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c9c('0x0'))('api');var moment=require(_0x3c9c('0x1'));var BPromise=require(_0x3c9c('0x2'));var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var attributes=require(_0x3c9c('0x7'));module['exports']=function(_0x48b219,_0x5c86bd){return _0x48b219[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':_0x3c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99a0=['analytics_metrics','lodash','util','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x99a0,0x121));var _0x099a=function(_0x24cc35,_0x41eb06){_0x24cc35=_0x24cc35-0x0;var _0xce1e84=_0x99a0[_0x24cc35];return _0xce1e84;};'use strict';var _=require(_0x099a('0x0'));var util=require(_0x099a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x099a('0x2'));var fs=require('fs');var path=require(_0x099a('0x3'));var rimraf=require('rimraf');var config=require(_0x099a('0x4'));var attributes=require(_0x099a('0x5'));module[_0x099a('0x6')]=function(_0x215a07,_0x2f1aea){return _0x215a07[_0x099a('0x7')]('AnalyticMetric',attributes,{'tableName':_0x099a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 6df5731..6f2ff5a 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 _0x2bc9=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4d275c,_0x522396){var _0x55b75f=function(_0x47e6d3){while(--_0x47e6d3){_0x4d275c['push'](_0x4d275c['shift']());}};_0x55b75f(++_0x522396);}(_0x2bc9,0x151));var _0x92bc=function(_0x6a47c,_0x2cbd54){_0x6a47c=_0x6a47c-0x0;var _0x1b8c47=_0x2bc9[_0x6a47c];return _0x1b8c47;};'use strict';var _=require(_0x92bc('0x0'));var util=require(_0x92bc('0x1'));var moment=require(_0x92bc('0x2'));var BPromise=require(_0x92bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x92bc('0x5'));var logger=require(_0x92bc('0x6'))(_0x92bc('0x7'));var config=require(_0x92bc('0x8'));var jayson=require(_0x92bc('0x9'));var client=jayson[_0x92bc('0xa')][_0x92bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11dbd1,_0x55ac11,_0xca1ba8){return new BPromise(function(_0x22abc5,_0x579b83){return client[_0x92bc('0xc')](_0x11dbd1,_0xca1ba8)[_0x92bc('0xd')](function(_0x446166){logger[_0x92bc('0xe')](_0x92bc('0xf'),_0x55ac11,_0x92bc('0x10'));logger['debug'](_0x92bc('0x11'),_0x55ac11,_0x92bc('0x10'),JSON[_0x92bc('0x12')](_0x446166));if(_0x446166['error']){if(_0x446166['error'][_0x92bc('0x13')]===0x1f4){logger[_0x92bc('0x14')](_0x92bc('0xf'),_0x55ac11,_0x446166[_0x92bc('0x14')][_0x92bc('0x15')]);return _0x579b83(_0x446166[_0x92bc('0x14')][_0x92bc('0x15')]);}logger[_0x92bc('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x55ac11,_0x446166[_0x92bc('0x14')][_0x92bc('0x15')]);return _0x22abc5(_0x446166['error'][_0x92bc('0x15')]);}else{logger[_0x92bc('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x55ac11,_0x92bc('0x10'));_0x22abc5(_0x446166[_0x92bc('0x16')][_0x92bc('0x15')]);}})['catch'](function(_0x258a8c){logger[_0x92bc('0x14')](_0x92bc('0xf'),_0x55ac11,_0x258a8c);_0x579b83(_0x258a8c);});});} \ No newline at end of file +var _0x83c5=['AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','debug'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x83c5,0x197));var _0x583c=function(_0x47b6b0,_0x47afce){_0x47b6b0=_0x47b6b0-0x0;var _0x3a9bf5=_0x83c5[_0x47b6b0];return _0x3a9bf5;};'use strict';var _=require(_0x583c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x583c('0x1'))['db'];var utils=require(_0x583c('0x2'));var logger=require(_0x583c('0x3'))(_0x583c('0x4'));var config=require('../../config/environment');var jayson=require(_0x583c('0x5'));var client=jayson[_0x583c('0x6')][_0x583c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b6139,_0x5a877d,_0x1e5890){return new BPromise(function(_0x2018bc,_0x111339){return client[_0x583c('0x8')](_0x2b6139,_0x1e5890)['then'](function(_0x232217){logger[_0x583c('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x5a877d,'request\x20sent');logger[_0x583c('0xa')](_0x583c('0xb'),_0x5a877d,_0x583c('0xc'),JSON[_0x583c('0xd')](_0x232217));if(_0x232217['error']){if(_0x232217[_0x583c('0xe')]['code']===0x1f4){logger[_0x583c('0xe')](_0x583c('0xf'),_0x5a877d,_0x232217[_0x583c('0xe')][_0x583c('0x10')]);return _0x111339(_0x232217[_0x583c('0xe')][_0x583c('0x10')]);}logger[_0x583c('0xe')](_0x583c('0xf'),_0x5a877d,_0x232217[_0x583c('0xe')][_0x583c('0x10')]);return _0x2018bc(_0x232217[_0x583c('0xe')][_0x583c('0x10')]);}else{logger[_0x583c('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x5a877d,_0x583c('0xc'));_0x2018bc(_0x232217[_0x583c('0x11')]['message']);}})[_0x583c('0x12')](function(_0x1048f0){logger[_0x583c('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x5a877d,_0x1048f0);_0x111339(_0x1048f0);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index aefaad9..aa2192d 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 _0x078c=['index','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x078c,0x19f));var _0xc078=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x078c[_0x3a3758];return _0x1a9234;};'use strict';var multer=require(_0xc078('0x0'));var util=require('util');var path=require(_0xc078('0x1'));var timeout=require(_0xc078('0x2'));var express=require('express');var router=express[_0xc078('0x3')]();var fs_extra=require(_0xc078('0x4'));var auth=require(_0xc078('0x5'));var interaction=require(_0xc078('0x6'));var config=require('../../config/environment');var controller=require(_0xc078('0x7'));router[_0xc078('0x8')]('/',auth[_0xc078('0x9')](),controller[_0xc078('0xa')]);router[_0xc078('0x8')](_0xc078('0xb'),auth[_0xc078('0x9')](),controller[_0xc078('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc078('0xd')](_0xc078('0xb'),auth['isAuthenticated'](),controller[_0xc078('0xe')]);router[_0xc078('0xf')](_0xc078('0xb'),auth[_0xc078('0x9')](),controller[_0xc078('0x10')]);module['exports']=router; \ No newline at end of file +var _0x032e=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id'];(function(_0x12cdc6,_0x5c8793){var _0x3045c1=function(_0x3b3a85){while(--_0x3b3a85){_0x12cdc6['push'](_0x12cdc6['shift']());}};_0x3045c1(++_0x5c8793);}(_0x032e,0x124));var _0xe032=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x032e[_0x2b5eae];return _0x5f3ac9;};'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('0xd')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller['update']);router[_0xe032('0x10')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index feab01b..0402546 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 _0x8b80=['TEXT','sequelize','exports'];(function(_0x3dacec,_0x2c775a){var _0x20335e=function(_0x4e3e61){while(--_0x4e3e61){_0x3dacec['push'](_0x3dacec['shift']());}};_0x20335e(++_0x2c775a);}(_0x8b80,0xbb));var _0x08b8=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x8b80[_0x3ad7ad];return _0x225a60;};'use strict';var Sequelize=require(_0x08b8('0x0'));module[_0x08b8('0x1')]={'tree':{'type':Sequelize[_0x08b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2d32=['exports','TEXT','sequelize'];(function(_0x4330bc,_0x4854d7){var _0x690d8f=function(_0x57206c){while(--_0x57206c){_0x4330bc['push'](_0x4330bc['shift']());}};_0x690d8f(++_0x4854d7);}(_0x2d32,0xf5));var _0x22d3=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x2d32[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x22d3('0x0'));module[_0x22d3('0x1')]={'tree':{'type':Sequelize[_0x22d3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 440b4e6..122f226 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 _0xaca5=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','keys','find','catch','create','body','update','eml-format','rimraf','zip-dir'];(function(_0x536256,_0x237fb5){var _0x1675f7=function(_0x339198){while(--_0x339198){_0x536256['push'](_0x536256['shift']());}};_0x1675f7(++_0x237fb5);}(_0xaca5,0xe4));var _0x5aca=function(_0x225a50,_0x593a61){_0x225a50=_0x225a50-0x0;var _0xc7afb4=_0xaca5[_0x225a50];return _0xc7afb4;};'use strict';var emlformat=require(_0x5aca('0x0'));var rimraf=require(_0x5aca('0x1'));var zipdir=require(_0x5aca('0x2'));var jsonpatch=require(_0x5aca('0x3'));var rp=require(_0x5aca('0x4'));var moment=require(_0x5aca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5aca('0x6'));var util=require(_0x5aca('0x7'));var path=require(_0x5aca('0x8'));var sox=require(_0x5aca('0x9'));var csv=require(_0x5aca('0xa'));var ejs=require(_0x5aca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5aca('0xc'));var squel=require(_0x5aca('0xd'));var crypto=require('crypto');var jsforce=require(_0x5aca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5aca('0xa'));var querystring=require(_0x5aca('0xf'));var Papa=require(_0x5aca('0x10'));var Redis=require(_0x5aca('0x11'));var authService=require(_0x5aca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5aca('0x13'));var hardwareService=require(_0x5aca('0x14'));var logger=require(_0x5aca('0x15'))(_0x5aca('0x16'));var utils=require(_0x5aca('0x17'));var config=require(_0x5aca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5aca('0x19'))['db'];function respondWithStatusCode(_0x52327b,_0x160781){_0x160781=_0x160781||0xcc;return function(_0x5d1156){if(_0x5d1156){return _0x52327b[_0x5aca('0x1a')](_0x160781);}return _0x52327b[_0x5aca('0x1b')](_0x160781)[_0x5aca('0x1c')]();};}function respondWithResult(_0x5e977e,_0x586ce9){_0x586ce9=_0x586ce9||0xc8;return function(_0x2f6c54){if(_0x2f6c54){return _0x5e977e[_0x5aca('0x1b')](_0x586ce9)[_0x5aca('0x1d')](_0x2f6c54);}};}function respondWithFilteredResult(_0x2fb818,_0x396cb6){return function(_0x4b3d70){if(_0x4b3d70){var _0x4c3ab4=typeof _0x396cb6[_0x5aca('0x1e')]===_0x5aca('0x1f')&&typeof _0x396cb6[_0x5aca('0x20')]===_0x5aca('0x1f');var _0x30c95e=_0x4b3d70['count'];var _0x18ac71=_0x4c3ab4?0x0:_0x396cb6['offset'];var _0x13dae6=_0x4c3ab4?_0x4b3d70[_0x5aca('0x21')]:_0x396cb6[_0x5aca('0x1e')]+_0x396cb6[_0x5aca('0x20')];var _0x4a2cbb;if(_0x13dae6>=_0x30c95e){_0x13dae6=_0x30c95e;_0x4a2cbb=0xc8;}else{_0x4a2cbb=0xce;}_0x2fb818[_0x5aca('0x1b')](_0x4a2cbb);return _0x2fb818[_0x5aca('0x22')](_0x5aca('0x23'),_0x18ac71+'-'+_0x13dae6+'/'+_0x30c95e)['json'](_0x4b3d70);}return null;};}function patchUpdates(_0x106fc6){return function(_0x3131c3){try{jsonpatch[_0x5aca('0x24')](_0x3131c3,_0x106fc6,!![]);}catch(_0x4b241f){return BPromise[_0x5aca('0x25')](_0x4b241f);}return _0x3131c3[_0x5aca('0x26')]();};}function saveUpdates(_0x37823b,_0x3f87a4){return function(_0x34c40a){if(_0x34c40a){return _0x34c40a['update'](_0x37823b)[_0x5aca('0x27')](function(_0x5d7bd7){return _0x5d7bd7;});}return null;};}function removeEntity(_0x56da55,_0x44a1df){return function(_0x453e45){if(_0x453e45){return _0x453e45[_0x5aca('0x28')]()[_0x5aca('0x27')](function(){_0x56da55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1a327,_0x3427b5){return function(_0x2e4075){if(!_0x2e4075){_0xf1a327[_0x5aca('0x1a')](0x194);}return _0x2e4075;};}function handleError(_0x59e0a8,_0x2c9c2f){_0x2c9c2f=_0x2c9c2f||0x1f4;return function(_0x2f8944){logger[_0x5aca('0x29')](_0x2f8944[_0x5aca('0x2a')]);if(_0x2f8944[_0x5aca('0x2b')]){delete _0x2f8944[_0x5aca('0x2b')];}_0x59e0a8['status'](_0x2c9c2f)['send'](_0x2f8944);};}exports[_0x5aca('0x2c')]=function(_0x1b9894,_0x135252){var _0x271106={},_0x5068de={},_0x3a6cc7={'count':0x0,'rows':[]};var _0xf4928c=_[_0x5aca('0x2d')](db[_0x5aca('0x2e')][_0x5aca('0x2f')],function(_0x31e75e){return{'name':_0x31e75e[_0x5aca('0x30')],'type':_0x31e75e[_0x5aca('0x31')][_0x5aca('0x32')]};});_0x5068de['model']=_['map'](_0xf4928c,_0x5aca('0x2b'));_0x5068de[_0x5aca('0x33')]=_['keys'](_0x1b9894[_0x5aca('0x33')]);_0x5068de[_0x5aca('0x34')]=_[_0x5aca('0x35')](_0x5068de[_0x5aca('0x36')],_0x5068de['query']);_0x271106[_0x5aca('0x37')]=_[_0x5aca('0x35')](_0x5068de[_0x5aca('0x36')],qs['fields'](_0x1b9894['query'][_0x5aca('0x38')]));_0x271106['attributes']=_0x271106[_0x5aca('0x37')][_0x5aca('0x39')]?_0x271106['attributes']:_0x5068de[_0x5aca('0x36')];if(!_0x1b9894[_0x5aca('0x33')][_0x5aca('0x3a')](_0x5aca('0x3b'))){_0x271106[_0x5aca('0x20')]=qs[_0x5aca('0x20')](_0x1b9894[_0x5aca('0x33')][_0x5aca('0x20')]);_0x271106['offset']=qs['offset'](_0x1b9894['query']['offset']);}_0x271106[_0x5aca('0x3c')]=qs[_0x5aca('0x3d')](_0x1b9894[_0x5aca('0x33')][_0x5aca('0x3d')]);_0x271106[_0x5aca('0x3e')]=qs[_0x5aca('0x34')](_[_0x5aca('0x3f')](_0x1b9894[_0x5aca('0x33')],_0x5068de['filters']),_0xf4928c);if(_0x1b9894[_0x5aca('0x33')][_0x5aca('0x40')]){_0x271106[_0x5aca('0x3e')]=_['merge'](_0x271106[_0x5aca('0x3e')],{'$or':_[_0x5aca('0x2d')](_0xf4928c,function(_0x178f7e){if(_0x178f7e[_0x5aca('0x31')]!=='VIRTUAL'){var _0x23fb42={};_0x23fb42[_0x178f7e[_0x5aca('0x2b')]]={'$like':'%'+_0x1b9894[_0x5aca('0x33')][_0x5aca('0x40')]+'%'};return _0x23fb42;}})});}_0x271106=_[_0x5aca('0x41')]({},_0x271106,_0x1b9894[_0x5aca('0x42')]);var _0x1a04a9={'where':_0x271106[_0x5aca('0x3e')]};return db[_0x5aca('0x2e')][_0x5aca('0x21')](_0x1a04a9)[_0x5aca('0x27')](function(_0x2a8be8){_0x3a6cc7[_0x5aca('0x21')]=_0x2a8be8;if(_0x1b9894['query'][_0x5aca('0x43')]){_0x271106[_0x5aca('0x44')]=[{'all':!![]}];}return db[_0x5aca('0x2e')]['findAll'](_0x271106);})[_0x5aca('0x27')](function(_0x4325c0){_0x3a6cc7[_0x5aca('0x45')]=_0x4325c0;return _0x3a6cc7;})[_0x5aca('0x27')](respondWithFilteredResult(_0x135252,_0x271106))['catch'](handleError(_0x135252,null));};exports['show']=function(_0x28c768,_0x112980){var _0x2cd346={'raw':!![],'where':{'id':_0x28c768[_0x5aca('0x46')]['id']}},_0x1e5800={};_0x1e5800['model']=_[_0x5aca('0x47')](db['AnalyticTreeReport'][_0x5aca('0x2f')]);_0x1e5800[_0x5aca('0x33')]=_['keys'](_0x28c768[_0x5aca('0x33')]);_0x1e5800['filters']=_[_0x5aca('0x35')](_0x1e5800['model'],_0x1e5800['query']);_0x2cd346[_0x5aca('0x37')]=_['intersection'](_0x1e5800['model'],qs['fields'](_0x28c768[_0x5aca('0x33')][_0x5aca('0x38')]));_0x2cd346['attributes']=_0x2cd346[_0x5aca('0x37')][_0x5aca('0x39')]?_0x2cd346['attributes']:_0x1e5800[_0x5aca('0x36')];if(_0x28c768[_0x5aca('0x33')][_0x5aca('0x43')]){_0x2cd346[_0x5aca('0x44')]=[{'all':!![]}];}_0x2cd346=_[_0x5aca('0x41')]({},_0x2cd346,_0x28c768[_0x5aca('0x42')]);return db['AnalyticTreeReport'][_0x5aca('0x48')](_0x2cd346)[_0x5aca('0x27')](handleEntityNotFound(_0x112980,null))[_0x5aca('0x27')](respondWithResult(_0x112980,null))[_0x5aca('0x49')](handleError(_0x112980,null));};exports['create']=function(_0x4ee0d5,_0x50573d){return db[_0x5aca('0x2e')][_0x5aca('0x4a')](_0x4ee0d5[_0x5aca('0x4b')],{})['then'](respondWithResult(_0x50573d,0xc9))['catch'](handleError(_0x50573d,null));};exports[_0x5aca('0x4c')]=function(_0x2ac1eb,_0x1123b3){if(_0x2ac1eb['body']['id']){delete _0x2ac1eb['body']['id'];}return db[_0x5aca('0x2e')][_0x5aca('0x48')]({'where':{'id':_0x2ac1eb['params']['id']}})['then'](handleEntityNotFound(_0x1123b3,null))['then'](saveUpdates(_0x2ac1eb['body'],null))[_0x5aca('0x27')](respondWithResult(_0x1123b3,null))[_0x5aca('0x49')](handleError(_0x1123b3,null));};exports[_0x5aca('0x28')]=function(_0x319026,_0x117c46){return db['AnalyticTreeReport'][_0x5aca('0x48')]({'where':{'id':_0x319026['params']['id']}})['then'](handleEntityNotFound(_0x117c46,null))[_0x5aca('0x27')](removeEntity(_0x117c46,null))[_0x5aca('0x49')](handleError(_0x117c46,null));}; \ No newline at end of file +var _0x0bcc=['catch','create','body','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','AnalyticTreeReport','count','include','findAll','rows','show','params','includeAll','find'];(function(_0x398086,_0x143848){var _0xa0b4c3=function(_0x4f91aa){while(--_0x4f91aa){_0x398086['push'](_0x398086['shift']());}};_0xa0b4c3(++_0x143848);}(_0x0bcc,0x127));var _0xc0bc=function(_0x1983a9,_0x4e957a){_0x1983a9=_0x1983a9-0x0;var _0x1612b4=_0x0bcc[_0x1983a9];return _0x1612b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0bc('0x0'));var zipdir=require(_0xc0bc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0bc('0x2'));var BPromise=require(_0xc0bc('0x3'));var Mustache=require(_0xc0bc('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc0bc('0x5'));var csv=require(_0xc0bc('0x6'));var ejs=require(_0xc0bc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0bc('0x8'));var squel=require('squel');var crypto=require(_0xc0bc('0x9'));var jsforce=require(_0xc0bc('0xa'));var deskjs=require(_0xc0bc('0xb'));var toCsv=require(_0xc0bc('0x6'));var querystring=require('querystring');var Papa=require(_0xc0bc('0xc'));var Redis=require(_0xc0bc('0xd'));var authService=require(_0xc0bc('0xe'));var qs=require(_0xc0bc('0xf'));var as=require(_0xc0bc('0x10'));var hardwareService=require(_0xc0bc('0x11'));var logger=require('../../config/logger')(_0xc0bc('0x12'));var utils=require(_0xc0bc('0x13'));var config=require(_0xc0bc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0bc('0x15'))['db'];function respondWithStatusCode(_0x1927a3,_0x3843b3){_0x3843b3=_0x3843b3||0xcc;return function(_0x22ddae){if(_0x22ddae){return _0x1927a3[_0xc0bc('0x16')](_0x3843b3);}return _0x1927a3[_0xc0bc('0x17')](_0x3843b3)[_0xc0bc('0x18')]();};}function respondWithResult(_0x3e70d2,_0x447779){_0x447779=_0x447779||0xc8;return function(_0x5241ef){if(_0x5241ef){return _0x3e70d2[_0xc0bc('0x17')](_0x447779)[_0xc0bc('0x19')](_0x5241ef);}};}function respondWithFilteredResult(_0xeb119c,_0x2bda71){return function(_0x50e1ae){if(_0x50e1ae){var _0x13b1ac=typeof _0x2bda71[_0xc0bc('0x1a')]==='undefined'&&typeof _0x2bda71[_0xc0bc('0x1b')]===_0xc0bc('0x1c');var _0x4c596f=_0x50e1ae['count'];var _0x39151c=_0x13b1ac?0x0:_0x2bda71[_0xc0bc('0x1a')];var _0x2389fe=_0x13b1ac?_0x50e1ae['count']:_0x2bda71[_0xc0bc('0x1a')]+_0x2bda71['limit'];var _0x19cc2c;if(_0x2389fe>=_0x4c596f){_0x2389fe=_0x4c596f;_0x19cc2c=0xc8;}else{_0x19cc2c=0xce;}_0xeb119c[_0xc0bc('0x17')](_0x19cc2c);return _0xeb119c[_0xc0bc('0x1d')](_0xc0bc('0x1e'),_0x39151c+'-'+_0x2389fe+'/'+_0x4c596f)[_0xc0bc('0x19')](_0x50e1ae);}return null;};}function patchUpdates(_0x4a1200){return function(_0x5cea23){try{jsonpatch[_0xc0bc('0x1f')](_0x5cea23,_0x4a1200,!![]);}catch(_0x2e7506){return BPromise['reject'](_0x2e7506);}return _0x5cea23[_0xc0bc('0x20')]();};}function saveUpdates(_0x2627ff,_0x2fab41){return function(_0x3bc674){if(_0x3bc674){return _0x3bc674[_0xc0bc('0x21')](_0x2627ff)[_0xc0bc('0x22')](function(_0x43aeb1){return _0x43aeb1;});}return null;};}function removeEntity(_0x40cd3d,_0x492284){return function(_0xfb0b78){if(_0xfb0b78){return _0xfb0b78[_0xc0bc('0x23')]()[_0xc0bc('0x22')](function(){_0x40cd3d[_0xc0bc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9aa6,_0x1a4991){return function(_0x18bf97){if(!_0x18bf97){_0x2e9aa6[_0xc0bc('0x16')](0x194);}return _0x18bf97;};}function handleError(_0x3449a1,_0x10cf15){_0x10cf15=_0x10cf15||0x1f4;return function(_0x48d4c6){logger[_0xc0bc('0x24')](_0x48d4c6[_0xc0bc('0x25')]);if(_0x48d4c6[_0xc0bc('0x26')]){delete _0x48d4c6[_0xc0bc('0x26')];}_0x3449a1[_0xc0bc('0x17')](_0x10cf15)[_0xc0bc('0x27')](_0x48d4c6);};}exports['index']=function(_0x4960ff,_0x2046d6){var _0x381cd1={},_0x551d96={},_0x2b0bd={'count':0x0,'rows':[]};var _0x542ad0=_[_0xc0bc('0x28')](db['AnalyticTreeReport'][_0xc0bc('0x29')],function(_0x28c5f1){return{'name':_0x28c5f1[_0xc0bc('0x2a')],'type':_0x28c5f1[_0xc0bc('0x2b')][_0xc0bc('0x2c')]};});_0x551d96[_0xc0bc('0x2d')]=_[_0xc0bc('0x28')](_0x542ad0,_0xc0bc('0x26'));_0x551d96[_0xc0bc('0x2e')]=_[_0xc0bc('0x2f')](_0x4960ff[_0xc0bc('0x2e')]);_0x551d96['filters']=_[_0xc0bc('0x30')](_0x551d96[_0xc0bc('0x2d')],_0x551d96[_0xc0bc('0x2e')]);_0x381cd1[_0xc0bc('0x31')]=_['intersection'](_0x551d96[_0xc0bc('0x2d')],qs['fields'](_0x4960ff['query'][_0xc0bc('0x32')]));_0x381cd1[_0xc0bc('0x31')]=_0x381cd1[_0xc0bc('0x31')][_0xc0bc('0x33')]?_0x381cd1[_0xc0bc('0x31')]:_0x551d96['model'];if(!_0x4960ff['query'][_0xc0bc('0x34')]('nolimit')){_0x381cd1['limit']=qs[_0xc0bc('0x1b')](_0x4960ff[_0xc0bc('0x2e')][_0xc0bc('0x1b')]);_0x381cd1[_0xc0bc('0x1a')]=qs['offset'](_0x4960ff[_0xc0bc('0x2e')][_0xc0bc('0x1a')]);}_0x381cd1[_0xc0bc('0x35')]=qs[_0xc0bc('0x36')](_0x4960ff['query']['sort']);_0x381cd1[_0xc0bc('0x37')]=qs[_0xc0bc('0x38')](_[_0xc0bc('0x39')](_0x4960ff[_0xc0bc('0x2e')],_0x551d96[_0xc0bc('0x38')]),_0x542ad0);if(_0x4960ff[_0xc0bc('0x2e')][_0xc0bc('0x3a')]){_0x381cd1[_0xc0bc('0x37')]=_[_0xc0bc('0x3b')](_0x381cd1['where'],{'$or':_[_0xc0bc('0x28')](_0x542ad0,function(_0x321048){if(_0x321048[_0xc0bc('0x2b')]!=='VIRTUAL'){var _0x28f99f={};_0x28f99f[_0x321048[_0xc0bc('0x26')]]={'$like':'%'+_0x4960ff['query'][_0xc0bc('0x3a')]+'%'};return _0x28f99f;}})});}_0x381cd1=_[_0xc0bc('0x3b')]({},_0x381cd1,_0x4960ff[_0xc0bc('0x3c')]);var _0x35ad88={'where':_0x381cd1[_0xc0bc('0x37')]};return db[_0xc0bc('0x3d')][_0xc0bc('0x3e')](_0x35ad88)[_0xc0bc('0x22')](function(_0x1eb5fb){_0x2b0bd[_0xc0bc('0x3e')]=_0x1eb5fb;if(_0x4960ff[_0xc0bc('0x2e')]['includeAll']){_0x381cd1[_0xc0bc('0x3f')]=[{'all':!![]}];}return db[_0xc0bc('0x3d')][_0xc0bc('0x40')](_0x381cd1);})[_0xc0bc('0x22')](function(_0x86819d){_0x2b0bd[_0xc0bc('0x41')]=_0x86819d;return _0x2b0bd;})[_0xc0bc('0x22')](respondWithFilteredResult(_0x2046d6,_0x381cd1))['catch'](handleError(_0x2046d6,null));};exports[_0xc0bc('0x42')]=function(_0x1d9c06,_0x2f8084){var _0x411a6f={'raw':!![],'where':{'id':_0x1d9c06[_0xc0bc('0x43')]['id']}},_0x162d1e={};_0x162d1e['model']=_[_0xc0bc('0x2f')](db['AnalyticTreeReport'][_0xc0bc('0x29')]);_0x162d1e[_0xc0bc('0x2e')]=_[_0xc0bc('0x2f')](_0x1d9c06['query']);_0x162d1e[_0xc0bc('0x38')]=_[_0xc0bc('0x30')](_0x162d1e[_0xc0bc('0x2d')],_0x162d1e['query']);_0x411a6f[_0xc0bc('0x31')]=_[_0xc0bc('0x30')](_0x162d1e[_0xc0bc('0x2d')],qs[_0xc0bc('0x32')](_0x1d9c06[_0xc0bc('0x2e')][_0xc0bc('0x32')]));_0x411a6f[_0xc0bc('0x31')]=_0x411a6f['attributes'][_0xc0bc('0x33')]?_0x411a6f[_0xc0bc('0x31')]:_0x162d1e[_0xc0bc('0x2d')];if(_0x1d9c06['query'][_0xc0bc('0x44')]){_0x411a6f[_0xc0bc('0x3f')]=[{'all':!![]}];}_0x411a6f=_[_0xc0bc('0x3b')]({},_0x411a6f,_0x1d9c06[_0xc0bc('0x3c')]);return db[_0xc0bc('0x3d')][_0xc0bc('0x45')](_0x411a6f)[_0xc0bc('0x22')](handleEntityNotFound(_0x2f8084,null))[_0xc0bc('0x22')](respondWithResult(_0x2f8084,null))[_0xc0bc('0x46')](handleError(_0x2f8084,null));};exports[_0xc0bc('0x47')]=function(_0xaf44b5,_0x1ffceb){return db[_0xc0bc('0x3d')][_0xc0bc('0x47')](_0xaf44b5[_0xc0bc('0x48')],{})[_0xc0bc('0x22')](respondWithResult(_0x1ffceb,0xc9))[_0xc0bc('0x46')](handleError(_0x1ffceb,null));};exports[_0xc0bc('0x21')]=function(_0x4ae7f9,_0x54324e){if(_0x4ae7f9[_0xc0bc('0x48')]['id']){delete _0x4ae7f9[_0xc0bc('0x48')]['id'];}return db[_0xc0bc('0x3d')]['find']({'where':{'id':_0x4ae7f9[_0xc0bc('0x43')]['id']}})[_0xc0bc('0x22')](handleEntityNotFound(_0x54324e,null))[_0xc0bc('0x22')](saveUpdates(_0x4ae7f9['body'],null))[_0xc0bc('0x22')](respondWithResult(_0x54324e,null))['catch'](handleError(_0x54324e,null));};exports[_0xc0bc('0x23')]=function(_0x18f380,_0x2af522){return db[_0xc0bc('0x3d')][_0xc0bc('0x45')]({'where':{'id':_0x18f380[_0xc0bc('0x43')]['id']}})['then'](handleEntityNotFound(_0x2af522,null))[_0xc0bc('0x22')](removeEntity(_0x2af522,null))[_0xc0bc('0x46')](handleError(_0x2af522,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 301cb3d..70da6a3 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 _0xf1db=['exports','AnalyticTreeReport','analytics_report_trees','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x14d752,_0x40833b){var _0x225bea=function(_0x1fe54d){while(--_0x1fe54d){_0x14d752['push'](_0x14d752['shift']());}};_0x225bea(++_0x40833b);}(_0xf1db,0x83));var _0xbf1d=function(_0x3471ab,_0x513323){_0x3471ab=_0x3471ab-0x0;var _0x1f8413=_0xf1db[_0x3471ab];return _0x1f8413;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf1d('0x0'))('api');var moment=require(_0xbf1d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf1d('0x2'));var rimraf=require(_0xbf1d('0x3'));var config=require(_0xbf1d('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0xbf1d('0x5')]=function(_0x2bd3b4,_0x15fa55){return _0x2bd3b4['define'](_0xbf1d('0x6'),attributes,{'tableName':_0xbf1d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd031=['moment','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x599da4,_0x2ec53d){var _0x380805=function(_0x15d390){while(--_0x15d390){_0x599da4['push'](_0x599da4['shift']());}};_0x380805(++_0x2ec53d);}(_0xd031,0x19f));var _0x1d03=function(_0x27e390,_0x3d1837){_0x27e390=_0x27e390-0x0;var _0x3714ec=_0xd031[_0x27e390];return _0x3714ec;};'use strict';var _=require(_0x1d03('0x0'));var util=require(_0x1d03('0x1'));var logger=require(_0x1d03('0x2'))('api');var moment=require(_0x1d03('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1d03('0x4'));var config=require(_0x1d03('0x5'));var attributes=require(_0x1d03('0x6'));module[_0x1d03('0x7')]=function(_0x9835ca,_0x1da631){return _0x9835ca[_0x1d03('0x8')](_0x1d03('0x9'),attributes,{'tableName':_0x1d03('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index c71ac8a..1e04ab2 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c0a05,_0x4ba9f3){_0x4c0a05=_0x4c0a05-0x0;var _0x4ff639=_0x2ef3[_0x4c0a05];return _0x4ff639;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4eb739,_0x4a619e){var _0x3c76f9=function(_0x307f94){while(--_0x307f94){_0x4eb739['push'](_0x4eb739['shift']());}};_0x3c76f9(++_0x4a619e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b556730..e906b28 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 _0xee82=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee82,0x155));var _0x2ee8=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0xee82[_0x2136d5];return _0x3bee2e;};'use strict';var multer=require(_0x2ee8('0x0'));var util=require(_0x2ee8('0x1'));var path=require('path');var timeout=require(_0x2ee8('0x2'));var express=require('express');var router=express[_0x2ee8('0x3')]();var fs_extra=require(_0x2ee8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2ee8('0x5'));var config=require(_0x2ee8('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x2ee8('0x7')]('/',auth[_0x2ee8('0x8')](),controller[_0x2ee8('0x9')]);router[_0x2ee8('0x7')]('/:id',auth[_0x2ee8('0x8')](),controller[_0x2ee8('0xa')]);router['post']('/',auth[_0x2ee8('0x8')](),controller[_0x2ee8('0xb')]);router[_0x2ee8('0xc')](_0x2ee8('0xd'),auth[_0x2ee8('0x8')](),controller[_0x2ee8('0xe')]);router[_0x2ee8('0xf')](_0x2ee8('0xd'),auth[_0x2ee8('0x8')](),controller['destroy']);module[_0x2ee8('0x10')]=router; \ No newline at end of file +var _0xb26f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x52ca83,_0x47f3f9){var _0x4c1bee=function(_0x5a708f){while(--_0x5a708f){_0x52ca83['push'](_0x52ca83['shift']());}};_0x4c1bee(++_0x47f3f9);}(_0xb26f,0x118));var _0xfb26=function(_0x36aad0,_0x3d2e17){_0x36aad0=_0x36aad0-0x0;var _0x31e987=_0xb26f[_0x36aad0];return _0x31e987;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb26('0x0'));var timeout=require(_0xfb26('0x1'));var express=require(_0xfb26('0x2'));var router=express[_0xfb26('0x3')]();var fs_extra=require(_0xfb26('0x4'));var auth=require(_0xfb26('0x5'));var interaction=require(_0xfb26('0x6'));var config=require(_0xfb26('0x7'));var controller=require(_0xfb26('0x8'));router[_0xfb26('0x9')]('/',auth[_0xfb26('0xa')](),controller[_0xfb26('0xb')]);router[_0xfb26('0x9')](_0xfb26('0xc'),auth[_0xfb26('0xa')](),controller[_0xfb26('0xd')]);router['post']('/',auth[_0xfb26('0xa')](),controller[_0xfb26('0xe')]);router[_0xfb26('0xf')](_0xfb26('0xc'),auth[_0xfb26('0xa')](),controller[_0xfb26('0x10')]);router[_0xfb26('0x11')](_0xfb26('0xc'),auth[_0xfb26('0xa')](),controller[_0xfb26('0x12')]);module[_0xfb26('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d22404a..0f4f33b 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 _0x34e8=['sequelize','exports','STRING'];(function(_0x9d95b8,_0x4050d6){var _0x4098cc=function(_0x4350b6){while(--_0x4350b6){_0x9d95b8['push'](_0x9d95b8['shift']());}};_0x4098cc(++_0x4050d6);}(_0x34e8,0x12c));var _0x834e=function(_0x290c60,_0x2f8f66){_0x290c60=_0x290c60-0x0;var _0x332089=_0x34e8[_0x290c60];return _0x332089;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'basename':{'type':Sequelize[_0x834e('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe009=['exports','STRING','sequelize'];(function(_0x29ef52,_0x2325c9){var _0xeb6a9=function(_0x593751){while(--_0x593751){_0x29ef52['push'](_0x29ef52['shift']());}};_0xeb6a9(++_0x2325c9);}(_0xe009,0x122));var _0x9e00=function(_0x4b0d27,_0x46d18c){_0x4b0d27=_0x4b0d27-0x0;var _0x340975=_0xe009[_0x4b0d27];return _0x340975;};'use strict';var Sequelize=require(_0x9e00('0x0'));module[_0x9e00('0x1')]={'name':{'type':Sequelize[_0x9e00('0x2')]},'basename':{'type':Sequelize[_0x9e00('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 c301a92..09341cb 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 _0xdd60=['name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','merge','Attachment','includeAll','include','findAll','rows','catch','show','params','keys','options','clone','find','get','updatedAt','body','omit','createdAt','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','status','end','error'];(function(_0x58b768,_0x27c50d){var _0x17d09d=function(_0x1b9566){while(--_0x1b9566){_0x58b768['push'](_0x58b768['shift']());}};_0x17d09d(++_0x27c50d);}(_0xdd60,0xe4));var _0x0dd6=function(_0x559587,_0x53504b){_0x559587=_0x559587-0x0;var _0x21f2b0=_0xdd60[_0x559587];return _0x21f2b0;};'use strict';var emlformat=require(_0x0dd6('0x0'));var rimraf=require(_0x0dd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dd6('0x2'));var rp=require(_0x0dd6('0x3'));var moment=require(_0x0dd6('0x4'));var BPromise=require(_0x0dd6('0x5'));var Mustache=require(_0x0dd6('0x6'));var util=require(_0x0dd6('0x7'));var path=require('path');var sox=require(_0x0dd6('0x8'));var csv=require(_0x0dd6('0x9'));var ejs=require(_0x0dd6('0xa'));var fs=require('fs');var fs_extra=require(_0x0dd6('0xb'));var _=require('lodash');var squel=require(_0x0dd6('0xc'));var crypto=require(_0x0dd6('0xd'));var jsforce=require(_0x0dd6('0xe'));var deskjs=require(_0x0dd6('0xf'));var toCsv=require(_0x0dd6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0dd6('0x10'));var authService=require(_0x0dd6('0x11'));var qs=require(_0x0dd6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0dd6('0x13'));var utils=require(_0x0dd6('0x14'));var config=require(_0x0dd6('0x15'));var licenseUtil=require(_0x0dd6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4311e6,_0xd1c56b){_0xd1c56b=_0xd1c56b||0xcc;return function(_0x469a6d){if(_0x469a6d){return _0x4311e6[_0x0dd6('0x17')](_0xd1c56b);}return _0x4311e6['status'](_0xd1c56b)['end']();};}function respondWithResult(_0x44e3d3,_0x586acf){_0x586acf=_0x586acf||0xc8;return function(_0x283c82){if(_0x283c82){return _0x44e3d3['status'](_0x586acf)[_0x0dd6('0x18')](_0x283c82);}};}function respondWithFilteredResult(_0x56c8e1,_0x43e4){return function(_0x40c965){if(_0x40c965){var _0x4df0f3=typeof _0x43e4['offset']==='undefined'&&typeof _0x43e4[_0x0dd6('0x19')]===_0x0dd6('0x1a');var _0x230e26=_0x40c965[_0x0dd6('0x1b')];var _0x27b15d=_0x4df0f3?0x0:_0x43e4['offset'];var _0x2e389f=_0x4df0f3?_0x40c965[_0x0dd6('0x1b')]:_0x43e4['offset']+_0x43e4[_0x0dd6('0x19')];var _0x4260a3;if(_0x2e389f>=_0x230e26){_0x2e389f=_0x230e26;_0x4260a3=0xc8;}else{_0x4260a3=0xce;}_0x56c8e1['status'](_0x4260a3);return _0x56c8e1[_0x0dd6('0x1c')](_0x0dd6('0x1d'),_0x27b15d+'-'+_0x2e389f+'/'+_0x230e26)[_0x0dd6('0x18')](_0x40c965);}return null;};}function patchUpdates(_0x1d9a5b){return function(_0x312a95){try{jsonpatch[_0x0dd6('0x1e')](_0x312a95,_0x1d9a5b,!![]);}catch(_0x5b5042){return BPromise[_0x0dd6('0x1f')](_0x5b5042);}return _0x312a95[_0x0dd6('0x20')]();};}function saveUpdates(_0x77ec07,_0x3d1c0a){return function(_0x8ffaf5){if(_0x8ffaf5){return _0x8ffaf5[_0x0dd6('0x21')](_0x77ec07)[_0x0dd6('0x22')](function(_0xd27fb3){return _0xd27fb3;});}return null;};}function removeEntity(_0x4ef99e,_0x29030d){return function(_0x43576b){if(_0x43576b){return _0x43576b[_0x0dd6('0x23')]()['then'](function(){_0x4ef99e[_0x0dd6('0x24')](0xcc)[_0x0dd6('0x25')]();});}};}function handleEntityNotFound(_0x88381f,_0xa14859){return function(_0x171451){if(!_0x171451){_0x88381f[_0x0dd6('0x17')](0x194);}return _0x171451;};}function handleError(_0x445c6f,_0x242481){_0x242481=_0x242481||0x1f4;return function(_0x4879af){logger[_0x0dd6('0x26')](_0x4879af['stack']);if(_0x4879af[_0x0dd6('0x27')]){delete _0x4879af['name'];}_0x445c6f[_0x0dd6('0x24')](_0x242481)[_0x0dd6('0x28')](_0x4879af);};}exports['index']=function(_0x206232,_0x2f5e41){var _0x5c7581={},_0x328e3f={},_0x1e16d6={'count':0x0,'rows':[]};var _0x54fb55=_[_0x0dd6('0x29')](db['Attachment'][_0x0dd6('0x2a')],function(_0x1d64bd){return{'name':_0x1d64bd[_0x0dd6('0x2b')],'type':_0x1d64bd[_0x0dd6('0x2c')][_0x0dd6('0x2d')]};});_0x328e3f['model']=_[_0x0dd6('0x29')](_0x54fb55,_0x0dd6('0x27'));_0x328e3f[_0x0dd6('0x2e')]=_['keys'](_0x206232[_0x0dd6('0x2e')]);_0x328e3f[_0x0dd6('0x2f')]=_[_0x0dd6('0x30')](_0x328e3f[_0x0dd6('0x31')],_0x328e3f[_0x0dd6('0x2e')]);_0x5c7581['attributes']=_['intersection'](_0x328e3f['model'],qs[_0x0dd6('0x32')](_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x32')]));_0x5c7581[_0x0dd6('0x33')]=_0x5c7581[_0x0dd6('0x33')][_0x0dd6('0x34')]?_0x5c7581['attributes']:_0x328e3f[_0x0dd6('0x31')];if(!_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x35')]('nolimit')){_0x5c7581[_0x0dd6('0x19')]=qs['limit'](_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x19')]);_0x5c7581[_0x0dd6('0x36')]=qs[_0x0dd6('0x36')](_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x36')]);}_0x5c7581['order']=qs['sort'](_0x206232['query'][_0x0dd6('0x37')]);_0x5c7581[_0x0dd6('0x38')]=qs[_0x0dd6('0x2f')](_[_0x0dd6('0x39')](_0x206232[_0x0dd6('0x2e')],_0x328e3f[_0x0dd6('0x2f')]),_0x54fb55);if(_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x3a')]){_0x5c7581[_0x0dd6('0x38')]=_['merge'](_0x5c7581['where'],{'$or':_[_0x0dd6('0x29')](_0x54fb55,function(_0xbdc208){if(_0xbdc208[_0x0dd6('0x2c')]!=='VIRTUAL'){var _0x5c4e68={};_0x5c4e68[_0xbdc208['name']]={'$like':'%'+_0x206232['query'][_0x0dd6('0x3a')]+'%'};return _0x5c4e68;}})});}_0x5c7581=_[_0x0dd6('0x3b')]({},_0x5c7581,_0x206232['options']);var _0x477ecb={'where':_0x5c7581[_0x0dd6('0x38')]};return db[_0x0dd6('0x3c')][_0x0dd6('0x1b')](_0x477ecb)['then'](function(_0x4842f0){_0x1e16d6[_0x0dd6('0x1b')]=_0x4842f0;if(_0x206232[_0x0dd6('0x2e')][_0x0dd6('0x3d')]){_0x5c7581[_0x0dd6('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0x0dd6('0x3f')](_0x5c7581);})[_0x0dd6('0x22')](function(_0x223018){_0x1e16d6[_0x0dd6('0x40')]=_0x223018;return _0x1e16d6;})[_0x0dd6('0x22')](respondWithFilteredResult(_0x2f5e41,_0x5c7581))[_0x0dd6('0x41')](handleError(_0x2f5e41,null));};exports[_0x0dd6('0x42')]=function(_0x215ca9,_0xaa0c7){var _0x26270e={'raw':!![],'where':{'id':_0x215ca9[_0x0dd6('0x43')]['id']}},_0x20b0d6={};_0x20b0d6[_0x0dd6('0x31')]=_[_0x0dd6('0x44')](db['Attachment']['rawAttributes']);_0x20b0d6[_0x0dd6('0x2e')]=_[_0x0dd6('0x44')](_0x215ca9[_0x0dd6('0x2e')]);_0x20b0d6[_0x0dd6('0x2f')]=_[_0x0dd6('0x30')](_0x20b0d6[_0x0dd6('0x31')],_0x20b0d6[_0x0dd6('0x2e')]);_0x26270e[_0x0dd6('0x33')]=_['intersection'](_0x20b0d6['model'],qs[_0x0dd6('0x32')](_0x215ca9[_0x0dd6('0x2e')][_0x0dd6('0x32')]));_0x26270e[_0x0dd6('0x33')]=_0x26270e[_0x0dd6('0x33')][_0x0dd6('0x34')]?_0x26270e[_0x0dd6('0x33')]:_0x20b0d6[_0x0dd6('0x31')];if(_0x215ca9[_0x0dd6('0x2e')]['includeAll']){_0x26270e['include']=[{'all':!![]}];}_0x26270e=_[_0x0dd6('0x3b')]({},_0x26270e,_0x215ca9[_0x0dd6('0x45')]);return db[_0x0dd6('0x3c')]['find'](_0x26270e)[_0x0dd6('0x22')](handleEntityNotFound(_0xaa0c7,null))[_0x0dd6('0x22')](respondWithResult(_0xaa0c7,null))[_0x0dd6('0x41')](handleError(_0xaa0c7,null));};exports[_0x0dd6('0x46')]=function(_0x594393,_0x420c23){var _0x18818a={'where':{'id':_0x594393['params']['id']}},_0xd0a2de={};_0xd0a2de[_0x0dd6('0x31')]=_[_0x0dd6('0x44')](db[_0x0dd6('0x3c')]['rawAttributes']);_0x18818a[_0x0dd6('0x33')]=_[_0x0dd6('0x30')](_0xd0a2de[_0x0dd6('0x31')],qs[_0x0dd6('0x32')](_0x594393[_0x0dd6('0x2e')][_0x0dd6('0x32')]));_0x18818a[_0x0dd6('0x33')]=_0x18818a[_0x0dd6('0x33')][_0x0dd6('0x34')]?_0x18818a[_0x0dd6('0x33')]:_0xd0a2de[_0x0dd6('0x31')];if(_0x594393[_0x0dd6('0x2e')][_0x0dd6('0x3d')]){_0x18818a['include']=[{'all':!![]}];}_0x18818a=_['merge']({},_0x18818a,_0x594393['options']);return db['Attachment'][_0x0dd6('0x47')](_0x18818a)[_0x0dd6('0x22')](handleEntityNotFound(_0x420c23,null))[_0x0dd6('0x22')](function(_0x13a00b){if(_0x13a00b){var _0x5ac297=_0x13a00b[_0x0dd6('0x48')]({'plain':!![]});_0x5ac297=qs['omit'](_0x5ac297,['id','createdAt',_0x0dd6('0x49')]);_0x594393[_0x0dd6('0x4a')]=_[_0x0dd6('0x4b')](_0x594393[_0x0dd6('0x4a')],['id',_0x0dd6('0x4c'),'updatedAt']);return db['Attachment'][_0x0dd6('0x4d')](_[_0x0dd6('0x3b')](_0x5ac297,_0x594393['body']),{'include':_0x594393[_0x0dd6('0x2e')][_0x0dd6('0x3d')]?[{'all':!![]}]:undefined});}})[_0x0dd6('0x22')](respondWithResult(_0x420c23,0xc9))['catch'](handleError(_0x420c23,null));};exports['update']=function(_0x5850df,_0x2c3754){if(_0x5850df[_0x0dd6('0x4a')]['id']){delete _0x5850df[_0x0dd6('0x4a')]['id'];}return db[_0x0dd6('0x3c')][_0x0dd6('0x47')]({'where':{'id':_0x5850df[_0x0dd6('0x43')]['id']}})[_0x0dd6('0x22')](handleEntityNotFound(_0x2c3754,null))[_0x0dd6('0x22')](saveUpdates(_0x5850df[_0x0dd6('0x4a')],null))[_0x0dd6('0x22')](respondWithResult(_0x2c3754,null))[_0x0dd6('0x41')](handleError(_0x2c3754,null));};exports['destroy']=function(_0x35e4f2,_0xc9b9b1){return db[_0x0dd6('0x3c')]['find']({'where':{'id':_0x35e4f2[_0x0dd6('0x43')]['id']}})['then'](handleEntityNotFound(_0xc9b9b1,null))[_0x0dd6('0x22')](removeEntity(_0xc9b9b1,null))['catch'](handleError(_0xc9b9b1,null));};exports['create']=function(_0x24b1d9,_0x126f5d,_0x2342a4){_0x24b1d9[_0x0dd6('0x4a')][_0x0dd6('0x27')]=_0x24b1d9[_0x0dd6('0x4e')][_0x0dd6('0x4f')];_0x24b1d9[_0x0dd6('0x4a')][_0x0dd6('0x50')]=_0x24b1d9[_0x0dd6('0x4e')][_0x0dd6('0x51')];_0x24b1d9[_0x0dd6('0x4a')][_0x0dd6('0x2c')]=_0x24b1d9['file'][_0x0dd6('0x52')];return db[_0x0dd6('0x3c')][_0x0dd6('0x4d')](_0x24b1d9[_0x0dd6('0x4a')])[_0x0dd6('0x22')](respondWithResult(_0x126f5d,0xc9))[_0x0dd6('0x41')](handleError(_0x126f5d,null));};exports[_0x0dd6('0x53')]=function(_0x3babc0,_0x23f7db,_0x37e7d8){return db[_0x0dd6('0x3c')][_0x0dd6('0x54')]({'where':{'id':_0x3babc0[_0x0dd6('0x43')]['id']},'raw':!![]})[_0x0dd6('0x22')](handleEntityNotFound(_0x23f7db,null))[_0x0dd6('0x22')](function(_0x5cdf1e){if(_0x5cdf1e){var _0x50a2e4=_0x5cdf1e[_0x0dd6('0x55')]!==null;var _0x4023a2=path[_0x0dd6('0x56')](config['root'],_0x0dd6('0x57'));if(_0x50a2e4){_0x4023a2=path[_0x0dd6('0x56')](_0x4023a2,_0x0dd6('0x58'));}var _0x39e954=path[_0x0dd6('0x56')](_0x4023a2,_0x5cdf1e['basename']);return _0x23f7db[_0x0dd6('0x53')](_0x39e954);}})[_0x0dd6('0x41')](handleError(_0x23f7db,null));}; \ No newline at end of file +var _0x1aec=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','rows','catch','params','options','clone','include','updatedAt','body','createdAt','create','find','basename','file','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName'];(function(_0x2ad016,_0x4c3106){var _0x1589be=function(_0x176086){while(--_0x176086){_0x2ad016['push'](_0x2ad016['shift']());}};_0x1589be(++_0x4c3106);}(_0x1aec,0x86));var _0xc1ae=function(_0x478689,_0x257f1a){_0x478689=_0x478689-0x0;var _0x9e4bf1=_0x1aec[_0x478689];return _0x9e4bf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1ae('0x0'));var zipdir=require(_0xc1ae('0x1'));var jsonpatch=require(_0xc1ae('0x2'));var rp=require(_0xc1ae('0x3'));var moment=require(_0xc1ae('0x4'));var BPromise=require(_0xc1ae('0x5'));var Mustache=require(_0xc1ae('0x6'));var util=require(_0xc1ae('0x7'));var path=require(_0xc1ae('0x8'));var sox=require(_0xc1ae('0x9'));var csv=require(_0xc1ae('0xa'));var ejs=require(_0xc1ae('0xb'));var fs=require('fs');var fs_extra=require(_0xc1ae('0xc'));var _=require(_0xc1ae('0xd'));var squel=require('squel');var crypto=require(_0xc1ae('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc1ae('0xf'));var toCsv=require(_0xc1ae('0xa'));var querystring=require(_0xc1ae('0x10'));var Papa=require(_0xc1ae('0x11'));var Redis=require(_0xc1ae('0x12'));var authService=require(_0xc1ae('0x13'));var qs=require(_0xc1ae('0x14'));var as=require(_0xc1ae('0x15'));var hardwareService=require(_0xc1ae('0x16'));var logger=require('../../config/logger')(_0xc1ae('0x17'));var utils=require(_0xc1ae('0x18'));var config=require(_0xc1ae('0x19'));var licenseUtil=require(_0xc1ae('0x1a'));var db=require(_0xc1ae('0x1b'))['db'];function respondWithStatusCode(_0x428a6f,_0x558a09){_0x558a09=_0x558a09||0xcc;return function(_0x5c25e5){if(_0x5c25e5){return _0x428a6f[_0xc1ae('0x1c')](_0x558a09);}return _0x428a6f['status'](_0x558a09)[_0xc1ae('0x1d')]();};}function respondWithResult(_0x547583,_0x292ade){_0x292ade=_0x292ade||0xc8;return function(_0xc9d649){if(_0xc9d649){return _0x547583[_0xc1ae('0x1e')](_0x292ade)['json'](_0xc9d649);}};}function respondWithFilteredResult(_0x1d42f5,_0x3a2601){return function(_0x57d27f){if(_0x57d27f){var _0x5811f7=typeof _0x3a2601[_0xc1ae('0x1f')]===_0xc1ae('0x20')&&typeof _0x3a2601[_0xc1ae('0x21')]===_0xc1ae('0x20');var _0x1b7d69=_0x57d27f['count'];var _0x455fb5=_0x5811f7?0x0:_0x3a2601['offset'];var _0x26b328=_0x5811f7?_0x57d27f['count']:_0x3a2601['offset']+_0x3a2601[_0xc1ae('0x21')];var _0x3ff140;if(_0x26b328>=_0x1b7d69){_0x26b328=_0x1b7d69;_0x3ff140=0xc8;}else{_0x3ff140=0xce;}_0x1d42f5[_0xc1ae('0x1e')](_0x3ff140);return _0x1d42f5[_0xc1ae('0x22')](_0xc1ae('0x23'),_0x455fb5+'-'+_0x26b328+'/'+_0x1b7d69)[_0xc1ae('0x24')](_0x57d27f);}return null;};}function patchUpdates(_0xf1d0e9){return function(_0xbdf517){try{jsonpatch[_0xc1ae('0x25')](_0xbdf517,_0xf1d0e9,!![]);}catch(_0x297fcf){return BPromise[_0xc1ae('0x26')](_0x297fcf);}return _0xbdf517[_0xc1ae('0x27')]();};}function saveUpdates(_0x2fbb95,_0x5b9ed2){return function(_0x21d32b){if(_0x21d32b){return _0x21d32b[_0xc1ae('0x28')](_0x2fbb95)[_0xc1ae('0x29')](function(_0xd42275){return _0xd42275;});}return null;};}function removeEntity(_0x1f7884,_0x313a73){return function(_0x26a95e){if(_0x26a95e){return _0x26a95e[_0xc1ae('0x2a')]()['then'](function(){_0x1f7884[_0xc1ae('0x1e')](0xcc)[_0xc1ae('0x1d')]();});}};}function handleEntityNotFound(_0x281ce2,_0x28d763){return function(_0x5b2e1c){if(!_0x5b2e1c){_0x281ce2[_0xc1ae('0x1c')](0x194);}return _0x5b2e1c;};}function handleError(_0x2ccee2,_0x3ce0a0){_0x3ce0a0=_0x3ce0a0||0x1f4;return function(_0x22c464){logger[_0xc1ae('0x2b')](_0x22c464[_0xc1ae('0x2c')]);if(_0x22c464[_0xc1ae('0x2d')]){delete _0x22c464['name'];}_0x2ccee2[_0xc1ae('0x1e')](_0x3ce0a0)[_0xc1ae('0x2e')](_0x22c464);};}exports[_0xc1ae('0x2f')]=function(_0x3a7c2f,_0x4ab228){var _0x5b3a01={},_0x2a669e={},_0x4383ef={'count':0x0,'rows':[]};var _0x2cce23=_[_0xc1ae('0x30')](db[_0xc1ae('0x31')][_0xc1ae('0x32')],function(_0x29445c){return{'name':_0x29445c[_0xc1ae('0x33')],'type':_0x29445c[_0xc1ae('0x34')][_0xc1ae('0x35')]};});_0x2a669e[_0xc1ae('0x36')]=_['map'](_0x2cce23,'name');_0x2a669e[_0xc1ae('0x37')]=_[_0xc1ae('0x38')](_0x3a7c2f[_0xc1ae('0x37')]);_0x2a669e[_0xc1ae('0x39')]=_[_0xc1ae('0x3a')](_0x2a669e[_0xc1ae('0x36')],_0x2a669e[_0xc1ae('0x37')]);_0x5b3a01[_0xc1ae('0x3b')]=_[_0xc1ae('0x3a')](_0x2a669e[_0xc1ae('0x36')],qs[_0xc1ae('0x3c')](_0x3a7c2f[_0xc1ae('0x37')][_0xc1ae('0x3c')]));_0x5b3a01[_0xc1ae('0x3b')]=_0x5b3a01[_0xc1ae('0x3b')][_0xc1ae('0x3d')]?_0x5b3a01[_0xc1ae('0x3b')]:_0x2a669e[_0xc1ae('0x36')];if(!_0x3a7c2f[_0xc1ae('0x37')][_0xc1ae('0x3e')](_0xc1ae('0x3f'))){_0x5b3a01[_0xc1ae('0x21')]=qs[_0xc1ae('0x21')](_0x3a7c2f[_0xc1ae('0x37')]['limit']);_0x5b3a01[_0xc1ae('0x1f')]=qs[_0xc1ae('0x1f')](_0x3a7c2f[_0xc1ae('0x37')]['offset']);}_0x5b3a01[_0xc1ae('0x40')]=qs[_0xc1ae('0x41')](_0x3a7c2f[_0xc1ae('0x37')][_0xc1ae('0x41')]);_0x5b3a01['where']=qs[_0xc1ae('0x39')](_[_0xc1ae('0x42')](_0x3a7c2f['query'],_0x2a669e[_0xc1ae('0x39')]),_0x2cce23);if(_0x3a7c2f[_0xc1ae('0x37')]['filter']){_0x5b3a01[_0xc1ae('0x43')]=_[_0xc1ae('0x44')](_0x5b3a01[_0xc1ae('0x43')],{'$or':_[_0xc1ae('0x30')](_0x2cce23,function(_0x129ae0){if(_0x129ae0[_0xc1ae('0x34')]!==_0xc1ae('0x45')){var _0x235c31={};_0x235c31[_0x129ae0[_0xc1ae('0x2d')]]={'$like':'%'+_0x3a7c2f['query'][_0xc1ae('0x46')]+'%'};return _0x235c31;}})});}_0x5b3a01=_[_0xc1ae('0x44')]({},_0x5b3a01,_0x3a7c2f['options']);var _0x3b8eb3={'where':_0x5b3a01[_0xc1ae('0x43')]};return db[_0xc1ae('0x31')][_0xc1ae('0x47')](_0x3b8eb3)[_0xc1ae('0x29')](function(_0x37acf0){_0x4383ef[_0xc1ae('0x47')]=_0x37acf0;if(_0x3a7c2f[_0xc1ae('0x37')][_0xc1ae('0x48')]){_0x5b3a01['include']=[{'all':!![]}];}return db[_0xc1ae('0x31')]['findAll'](_0x5b3a01);})[_0xc1ae('0x29')](function(_0xca2e7a){_0x4383ef[_0xc1ae('0x49')]=_0xca2e7a;return _0x4383ef;})['then'](respondWithFilteredResult(_0x4ab228,_0x5b3a01))[_0xc1ae('0x4a')](handleError(_0x4ab228,null));};exports['show']=function(_0x48c04c,_0x1406dd){var _0x1d82dd={'raw':!![],'where':{'id':_0x48c04c[_0xc1ae('0x4b')]['id']}},_0x5e7702={};_0x5e7702['model']=_[_0xc1ae('0x38')](db['Attachment'][_0xc1ae('0x32')]);_0x5e7702['query']=_['keys'](_0x48c04c[_0xc1ae('0x37')]);_0x5e7702['filters']=_[_0xc1ae('0x3a')](_0x5e7702[_0xc1ae('0x36')],_0x5e7702[_0xc1ae('0x37')]);_0x1d82dd['attributes']=_[_0xc1ae('0x3a')](_0x5e7702[_0xc1ae('0x36')],qs[_0xc1ae('0x3c')](_0x48c04c[_0xc1ae('0x37')]['fields']));_0x1d82dd[_0xc1ae('0x3b')]=_0x1d82dd['attributes'][_0xc1ae('0x3d')]?_0x1d82dd['attributes']:_0x5e7702['model'];if(_0x48c04c[_0xc1ae('0x37')][_0xc1ae('0x48')]){_0x1d82dd['include']=[{'all':!![]}];}_0x1d82dd=_[_0xc1ae('0x44')]({},_0x1d82dd,_0x48c04c[_0xc1ae('0x4c')]);return db[_0xc1ae('0x31')]['find'](_0x1d82dd)[_0xc1ae('0x29')](handleEntityNotFound(_0x1406dd,null))[_0xc1ae('0x29')](respondWithResult(_0x1406dd,null))['catch'](handleError(_0x1406dd,null));};exports[_0xc1ae('0x4d')]=function(_0x3e1ac4,_0x845389){var _0xd8ad5c={'where':{'id':_0x3e1ac4['params']['id']}},_0x48b260={};_0x48b260[_0xc1ae('0x36')]=_[_0xc1ae('0x38')](db[_0xc1ae('0x31')][_0xc1ae('0x32')]);_0xd8ad5c[_0xc1ae('0x3b')]=_[_0xc1ae('0x3a')](_0x48b260['model'],qs[_0xc1ae('0x3c')](_0x3e1ac4['query'][_0xc1ae('0x3c')]));_0xd8ad5c[_0xc1ae('0x3b')]=_0xd8ad5c[_0xc1ae('0x3b')][_0xc1ae('0x3d')]?_0xd8ad5c[_0xc1ae('0x3b')]:_0x48b260[_0xc1ae('0x36')];if(_0x3e1ac4[_0xc1ae('0x37')][_0xc1ae('0x48')]){_0xd8ad5c[_0xc1ae('0x4e')]=[{'all':!![]}];}_0xd8ad5c=_['merge']({},_0xd8ad5c,_0x3e1ac4['options']);return db['Attachment']['find'](_0xd8ad5c)[_0xc1ae('0x29')](handleEntityNotFound(_0x845389,null))[_0xc1ae('0x29')](function(_0x5d3df8){if(_0x5d3df8){var _0x4431be=_0x5d3df8['get']({'plain':!![]});_0x4431be=qs['omit'](_0x4431be,['id','createdAt',_0xc1ae('0x4f')]);_0x3e1ac4['body']=_['omit'](_0x3e1ac4[_0xc1ae('0x50')],['id',_0xc1ae('0x51'),'updatedAt']);return db[_0xc1ae('0x31')][_0xc1ae('0x52')](_[_0xc1ae('0x44')](_0x4431be,_0x3e1ac4[_0xc1ae('0x50')]),{'include':_0x3e1ac4[_0xc1ae('0x37')][_0xc1ae('0x48')]?[{'all':!![]}]:undefined});}})[_0xc1ae('0x29')](respondWithResult(_0x845389,0xc9))[_0xc1ae('0x4a')](handleError(_0x845389,null));};exports['update']=function(_0x2ea1f4,_0x45757e){if(_0x2ea1f4[_0xc1ae('0x50')]['id']){delete _0x2ea1f4[_0xc1ae('0x50')]['id'];}return db[_0xc1ae('0x31')][_0xc1ae('0x53')]({'where':{'id':_0x2ea1f4[_0xc1ae('0x4b')]['id']}})[_0xc1ae('0x29')](handleEntityNotFound(_0x45757e,null))[_0xc1ae('0x29')](saveUpdates(_0x2ea1f4['body'],null))[_0xc1ae('0x29')](respondWithResult(_0x45757e,null))[_0xc1ae('0x4a')](handleError(_0x45757e,null));};exports[_0xc1ae('0x2a')]=function(_0x4958c4,_0x493012){return db[_0xc1ae('0x31')][_0xc1ae('0x53')]({'where':{'id':_0x4958c4[_0xc1ae('0x4b')]['id']}})[_0xc1ae('0x29')](handleEntityNotFound(_0x493012,null))[_0xc1ae('0x29')](removeEntity(_0x493012,null))[_0xc1ae('0x4a')](handleError(_0x493012,null));};exports[_0xc1ae('0x52')]=function(_0x33c5f6,_0x42c49c,_0x161e6c){_0x33c5f6['body'][_0xc1ae('0x2d')]=_0x33c5f6['file']['originalname'];_0x33c5f6[_0xc1ae('0x50')][_0xc1ae('0x54')]=_0x33c5f6['file']['filename'];_0x33c5f6[_0xc1ae('0x50')][_0xc1ae('0x34')]=_0x33c5f6[_0xc1ae('0x55')][_0xc1ae('0x56')];return db[_0xc1ae('0x31')][_0xc1ae('0x52')](_0x33c5f6[_0xc1ae('0x50')])['then'](respondWithResult(_0x42c49c,0xc9))['catch'](handleError(_0x42c49c,null));};exports[_0xc1ae('0x57')]=function(_0x54681c,_0x1e4f89,_0x2e1ea3){return db[_0xc1ae('0x31')]['findOne']({'where':{'id':_0x54681c[_0xc1ae('0x4b')]['id']},'raw':!![]})[_0xc1ae('0x29')](handleEntityNotFound(_0x1e4f89,null))[_0xc1ae('0x29')](function(_0xdfec13){if(_0xdfec13){var _0x25eaff=_0xdfec13[_0xc1ae('0x58')]!==null;var _0x37d833=path[_0xc1ae('0x59')](config[_0xc1ae('0x5a')],_0xc1ae('0x5b'));if(_0x25eaff){_0x37d833=path['join'](_0x37d833,_0xc1ae('0x5c'));}var _0x24fbd9=path[_0xc1ae('0x59')](_0x37d833,_0xdfec13[_0xc1ae('0x54')]);return _0x1e4f89[_0xc1ae('0x57')](_0x24fbd9);}})[_0xc1ae('0x4a')](handleError(_0x1e4f89,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f45d3ce..e631940 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 _0x3310=['path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise'];(function(_0x495c36,_0x4ada64){var _0x87e294=function(_0x3519d2){while(--_0x3519d2){_0x495c36['push'](_0x495c36['shift']());}};_0x87e294(++_0x4ada64);}(_0x3310,0x7c));var _0x0331=function(_0x2b3be8,_0x2356c3){_0x2b3be8=_0x2b3be8-0x0;var _0x5596d8=_0x3310[_0x2b3be8];return _0x5596d8;};'use strict';var _=require(_0x0331('0x0'));var util=require(_0x0331('0x1'));var logger=require('../../config/logger')(_0x0331('0x2'));var moment=require(_0x0331('0x3'));var BPromise=require(_0x0331('0x4'));var rp=require(_0x0331('0x5'));var fs=require('fs');var path=require(_0x0331('0x6'));var rimraf=require(_0x0331('0x7'));var config=require(_0x0331('0x8'));var attributes=require(_0x0331('0x9'));module['exports']=function(_0x4e5e8c,_0x541f97){return _0x4e5e8c[_0x0331('0xa')](_0x0331('0xb'),attributes,{'tableName':_0x0331('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8260=['moment','request-promise','path','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','api'];(function(_0x28c15d,_0x41ae5e){var _0x27d1e2=function(_0x5da63f){while(--_0x5da63f){_0x28c15d['push'](_0x28c15d['shift']());}};_0x27d1e2(++_0x41ae5e);}(_0x8260,0x173));var _0x0826=function(_0x4517cf,_0x3aaaca){_0x4517cf=_0x4517cf-0x0;var _0x408bf4=_0x8260[_0x4517cf];return _0x408bf4;};'use strict';var _=require(_0x0826('0x0'));var util=require(_0x0826('0x1'));var logger=require('../../config/logger')(_0x0826('0x2'));var moment=require(_0x0826('0x3'));var BPromise=require('bluebird');var rp=require(_0x0826('0x4'));var fs=require('fs');var path=require(_0x0826('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0826('0x6'));module[_0x0826('0x7')]=function(_0x57f3db,_0x211b40){return _0x57f3db[_0x0826('0x8')](_0x0826('0x9'),attributes,{'tableName':_0x0826('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 8273eea..1388f07 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 _0x8e0d=['CreateAttachment','Attachment','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Attachment,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8e0d,0x82));var _0xd8e0=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x8e0d[_0x1c5142];return _0x1268cb;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e0('0x1'));var rs=require(_0xd8e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e0('0x3'))['db'];var utils=require(_0xd8e0('0x4'));var logger=require(_0xd8e0('0x5'))(_0xd8e0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8e0('0x7')][_0xd8e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d42b,_0x1e4616,_0x5e9735){return new BPromise(function(_0xd0c45c,_0x144a8a){return client[_0xd8e0('0x9')](_0x42d42b,_0x5e9735)[_0xd8e0('0xa')](function(_0x127a32){logger['info'](_0xd8e0('0xb'),_0x1e4616,'request\x20sent');logger[_0xd8e0('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4616,'request\x20sent',JSON[_0xd8e0('0xd')](_0x127a32));if(_0x127a32[_0xd8e0('0xe')]){if(_0x127a32[_0xd8e0('0xe')]['code']===0x1f4){logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0x144a8a(_0x127a32['error']['message']);}logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0xd0c45c(_0x127a32[_0xd8e0('0xe')][_0xd8e0('0xf')]);}else{logger[_0xd8e0('0x10')](_0xd8e0('0xb'),_0x1e4616,_0xd8e0('0x11'));_0xd0c45c(_0x127a32[_0xd8e0('0x12')][_0xd8e0('0xf')]);}})[_0xd8e0('0x13')](function(_0x488ed9){logger[_0xd8e0('0xe')](_0xd8e0('0xb'),_0x1e4616,_0x488ed9);_0x144a8a(_0x488ed9);});});}exports[_0xd8e0('0x14')]=function(_0x42586f){var _0x3b28bc=this;return new Promise(function(_0x2bf195,_0x2c4eaf){return db[_0xd8e0('0x15')]['create'](_0x42586f[_0xd8e0('0x16')],{'raw':_0x42586f[_0xd8e0('0x17')]?_0x42586f['options'][_0xd8e0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ce9b){logger['info'](_0xd8e0('0x14'),_0x42586f);logger[_0xd8e0('0xc')]('CreateAttachment',_0x42586f,JSON[_0xd8e0('0xd')](_0x55ce9b));_0x2bf195(_0x55ce9b);})[_0xd8e0('0x13')](function(_0x1d31de){logger[_0xd8e0('0xe')](_0xd8e0('0x14'),_0x1d31de[_0xd8e0('0xf')],_0x42586f);_0x2c4eaf(_0x3b28bc['error'](0x1f4,_0x1d31de[_0xd8e0('0xf')]));});});}; \ No newline at end of file +var _0x0506=['catch','CreateAttachment','Attachment','raw','then','lodash','util','moment','../../config/utils','rpc','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x0506,0x1d1));var _0x6050=function(_0x5ae265,_0x4f4eb6){_0x5ae265=_0x5ae265-0x0;var _0x60dd92=_0x0506[_0x5ae265];return _0x60dd92;};'use strict';var _=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var moment=require(_0x6050('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6050('0x3'));var logger=require('../../config/logger')(_0x6050('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6050('0x5')][_0x6050('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a3644,_0x1a89fb,_0x3512ba){return new BPromise(function(_0xf64de5,_0x4068d3){return client[_0x6050('0x7')](_0x2a3644,_0x3512ba)['then'](function(_0x312217){logger['info'](_0x6050('0x8'),_0x1a89fb,_0x6050('0x9'));logger[_0x6050('0xa')](_0x6050('0xb'),_0x1a89fb,_0x6050('0x9'),JSON[_0x6050('0xc')](_0x312217));if(_0x312217[_0x6050('0xd')]){if(_0x312217[_0x6050('0xd')][_0x6050('0xe')]===0x1f4){logger[_0x6050('0xd')]('Attachment,\x20%s,\x20%s',_0x1a89fb,_0x312217[_0x6050('0xd')]['message']);return _0x4068d3(_0x312217[_0x6050('0xd')][_0x6050('0xf')]);}logger[_0x6050('0xd')](_0x6050('0x8'),_0x1a89fb,_0x312217['error'][_0x6050('0xf')]);return _0xf64de5(_0x312217['error'][_0x6050('0xf')]);}else{logger[_0x6050('0x10')](_0x6050('0x8'),_0x1a89fb,_0x6050('0x9'));_0xf64de5(_0x312217[_0x6050('0x11')][_0x6050('0xf')]);}})[_0x6050('0x12')](function(_0x388de4){logger[_0x6050('0xd')](_0x6050('0x8'),_0x1a89fb,_0x388de4);_0x4068d3(_0x388de4);});});}exports[_0x6050('0x13')]=function(_0x347899){var _0x47f33f=this;return new Promise(function(_0x1dd507,_0x3e1ef6){return db[_0x6050('0x14')]['create'](_0x347899['body'],{'raw':_0x347899['options']?_0x347899['options'][_0x6050('0x15')]===undefined?!![]:![]:!![]})[_0x6050('0x16')](function(_0x4c0270){logger[_0x6050('0x10')](_0x6050('0x13'),_0x347899);logger[_0x6050('0xa')](_0x6050('0x13'),_0x347899,JSON[_0x6050('0xc')](_0x4c0270));_0x1dd507(_0x4c0270);})[_0x6050('0x12')](function(_0x50d6f6){logger[_0x6050('0xd')](_0x6050('0x13'),_0x50d6f6[_0x6050('0xf')],_0x347899);_0x3e1ef6(_0x47f33f[_0x6050('0xd')](0x1f4,_0x50d6f6[_0x6050('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b57dc92..f55d1df 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x242711,_0x44fbd3){var _0x45d109=function(_0x251dad){while(--_0x251dad){_0x242711['push'](_0x242711['shift']());}};_0x45d109(++_0x44fbd3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f98c0,_0x4ddddf){_0x1f98c0=_0x1f98c0-0x0;var _0x1cc656=_0xb10b[_0x1f98c0];return _0x1cc656;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'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('./attachment.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['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5c15922..a08a35f 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 _0xa12e=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','agent','add','minutes','clearBlockUser','getLicense','status','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect'];(function(_0x291374,_0x1f67b3){var _0x5c62a9=function(_0x4dbf99){while(--_0x4dbf99){_0x291374['push'](_0x291374['shift']());}};_0x5c62a9(++_0x1f67b3);}(_0xa12e,0x138));var _0xea12=function(_0x14c358,_0x522070){_0x14c358=_0x14c358-0x0;var _0x33b11d=_0xa12e[_0x14c358];return _0x33b11d;};'use strict';var passport=require(_0xea12('0x0'));var LocalStrategy=require(_0xea12('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xea12('0x2'));var util=require(_0xea12('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0xea12('0x4'));var utils=require(_0xea12('0x5'));var config=require(_0xea12('0x6'));var logger=require(_0xea12('0x7'))(_0xea12('0x8'));function isActiveDirectoryConfigured(_0x2904ef){var _0x2f325a=![];if(typeof _0x2904ef[_0xea12('0x9')]!==_0xea12('0xa')){_0x2f325a=_0x2904ef[_0xea12('0x9')][_0xea12('0xb')]&&_0x2904ef[_0xea12('0x9')]['url']&&_0x2904ef[_0xea12('0x9')][_0xea12('0xc')];}return _0x2f325a;}function adAuthenticate(_0x13bf70,_0x2398c6,_0x1dd0c6){return new BPromise(function(_0x1eccaf,_0x5494b6){try{var _0x2b65d9=new ActiveDirectory(_0x13bf70);_0x2b65d9[_0xea12('0xd')](_0x2398c6,_0x1dd0c6,function(_0x41c45b,_0x400ce4){if(_0x41c45b){logger[_0xea12('0xe')](_0xea12('0xf'),_0x2398c6,util[_0xea12('0x10')](_0x41c45b,{'showHidden':![],'depth':null}));_0x5494b6(_0xea12('0x11'));}else if(!_0x400ce4){logger[_0xea12('0xe')](_0xea12('0x12'),_0x2398c6);_0x5494b6(_0xea12('0x11'));}else{_0x1eccaf(_0x400ce4);}});}catch(_0x4d3b1d){_0x5494b6(_0x4d3b1d);}});}function ActiveDirectoryAuthenticate(_0x2d3ed6,_0x34aa8f,_0x351852,_0x4f07bb){var _0x369e9b,_0x4e5177;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xea12('0x13'),_0x34aa8f);return _0x4f07bb(null,![],{'message':_0xea12('0x11')});}return db[_0xea12('0x14')][_0xea12('0x15')]({'where':{'id':0x1},'attributes':[_0xea12('0x16'),_0xea12('0x17')],'raw':!![]})[_0xea12('0x18')](function(_0x33f3a5){_0x369e9b=_0x33f3a5;if(!_0x369e9b['adSsoEnabled']){logger['error'](_0xea12('0x19'),_0x34aa8f);throw new Error(_0xea12('0x11'));}return _0x2d3ed6[_0xea12('0x15')]({'attributes':['id',_0xea12('0x1a'),_0xea12('0x1b'),_0xea12('0x1c'),_0xea12('0x1d'),_0xea12('0x1e'),_0xea12('0x1f'),_0xea12('0x20'),_0xea12('0x21')],'where':{'name':_0x34aa8f,'role':{'$or':['admin','user',_0xea12('0x22')]},'adSsoEnabled':!![]}});})[_0xea12('0x18')](function(_0x4c6c39){if(!_0x4c6c39||_0x4c6c39&&_0x4c6c39[_0xea12('0x1a')]!==_0x34aa8f){throw new Error(_0xea12('0x11'));}_0x4e5177=_0x4c6c39;var _0x3b7a01=_0x4e5177[_0xea12('0x1a')]+'@'+config[_0xea12('0x9')]['domain'];return adAuthenticate(config[_0xea12('0x9')],_0x3b7a01,_0x351852);})['then'](function(_0x48104e){if(_0x4e5177['disabled']){throw new Error(_0xea12('0x11'));}if(_0x369e9b[_0xea12('0x17')]>0x0){if(_0x4e5177[_0xea12('0x1f')]){if(moment(_0x4e5177['blockedAt'])[_0xea12('0x23')](_0x369e9b[_0xea12('0x17')],_0xea12('0x24'))>moment()){throw new Error(_0xea12('0x11'));}return utils[_0xea12('0x25')](_0x4e5177,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4e5177);})[_0xea12('0x18')](function(){return _0x4f07bb(null,_0x4e5177);});}else{return utils['getLicense'](_0x4e5177)[_0xea12('0x18')](function(){return _0x4f07bb(null,_0x4e5177);});}}else{return utils[_0xea12('0x26')](_0x4e5177)[_0xea12('0x18')](function(){return _0x4f07bb(null,_0x4e5177);});}})['catch'](function(_0x212258){return _0x4f07bb(null,![],_0x212258);});}function handleError(_0x314ca2,_0x874216,_0x281971){return _0x314ca2[_0xea12('0x27')](_0x874216||0x1f4)[_0xea12('0x28')]({'message':_0x281971?_0x281971[_0xea12('0x29')]||_0x281971:''});}exports['login']=function(_0x14c404,_0xaf7b07,_0x4cf591){passport[_0xea12('0xd')]('ad-login',function(_0x4e8d21,_0x3decbc,_0x3b2ad9){var _0x569930=_0x4e8d21||_0x3b2ad9;if(_0x569930){return handleError(_0xaf7b07,0x191,_0x569930);}if(!_0x3decbc){return handleError(_0xaf7b07,0x194,{'message':_0xea12('0x2a')});}else{var _0x2b8c7f={'payload':{'id':_0x3decbc['id'],'role':_0x3decbc[_0xea12('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xea12('0x2b')](_0x2b8c7f)[_0xea12('0x18')](function(_0x3fc39c){_0xaf7b07[_0xea12('0x2c')]({'id':_0x3decbc['id'],'token':_0x3fc39c,'statusCall':'','isAlreadyLogged':_0x3decbc['online']});});}})(_0x14c404,_0xaf7b07,_0x4cf591);};passport[_0xea12('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0xea12('0x1a'),'passwordField':_0xea12('0x1b')},function(_0xa44c3e,_0x3d2646,_0x507cb8){return ActiveDirectoryAuthenticate(db[_0xea12('0x2e')],_0xa44c3e,_0x3d2646,_0x507cb8);})); \ No newline at end of file +var _0x6d13=['../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','undefined','baseDN','url','activedirectory','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','then','password','role','disabled','blocked','admin','agent','name','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','login','ad-login','signToken','online','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util'];(function(_0x29fa8b,_0x23d89){var _0x3f6a1d=function(_0x339e4c){while(--_0x339e4c){_0x29fa8b['push'](_0x29fa8b['shift']());}};_0x3f6a1d(++_0x23d89);}(_0x6d13,0xe4));var _0x36d1=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x6d13[_0x581af1];return _0x54c22e;};'use strict';var passport=require(_0x36d1('0x0'));var LocalStrategy=require(_0x36d1('0x1'))[_0x36d1('0x2')];var moment=require(_0x36d1('0x3'));var ActiveDirectory=require(_0x36d1('0x4'));var BPromise=require(_0x36d1('0x5'));var util=require(_0x36d1('0x6'));var db=require(_0x36d1('0x7'))['db'];var authService=require(_0x36d1('0x8'));var utils=require(_0x36d1('0x9'));var config=require(_0x36d1('0xa'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x480c90){var _0x3dd357=![];if(typeof _0x480c90['activedirectory']!==_0x36d1('0xb')){_0x3dd357=_0x480c90['activedirectory'][_0x36d1('0xc')]&&_0x480c90['activedirectory'][_0x36d1('0xd')]&&_0x480c90[_0x36d1('0xe')][_0x36d1('0xf')];}return _0x3dd357;}function adAuthenticate(_0x232b58,_0x353a11,_0x2ca101){return new BPromise(function(_0x5f06dc,_0x4cf514){try{var _0x310553=new ActiveDirectory(_0x232b58);_0x310553[_0x36d1('0x10')](_0x353a11,_0x2ca101,function(_0x1ee9d4,_0x2b85a2){if(_0x1ee9d4){logger[_0x36d1('0x11')](_0x36d1('0x12'),_0x353a11,util[_0x36d1('0x13')](_0x1ee9d4,{'showHidden':![],'depth':null}));_0x4cf514('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x2b85a2){logger[_0x36d1('0x11')](_0x36d1('0x14'),_0x353a11);_0x4cf514(_0x36d1('0x15'));}else{_0x5f06dc(_0x2b85a2);}});}catch(_0x68fd5d){_0x4cf514(_0x68fd5d);}});}function ActiveDirectoryAuthenticate(_0x575b65,_0x3f6035,_0x1632a1,_0x4fb67c){var _0x252498,_0x2722a0;if(!isActiveDirectoryConfigured(config)){logger[_0x36d1('0x11')](_0x36d1('0x16'),_0x3f6035);return _0x4fb67c(null,![],{'message':_0x36d1('0x15')});}return db['Setting'][_0x36d1('0x17')]({'where':{'id':0x1},'attributes':[_0x36d1('0x18'),'blockDuration'],'raw':!![]})[_0x36d1('0x19')](function(_0x19ed9f){_0x252498=_0x19ed9f;if(!_0x252498[_0x36d1('0x18')]){logger[_0x36d1('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3f6035);throw new Error(_0x36d1('0x15'));}return _0x575b65[_0x36d1('0x17')]({'attributes':['id','name',_0x36d1('0x1a'),'salt',_0x36d1('0x1b'),_0x36d1('0x1c'),_0x36d1('0x1d'),'blockedAt','online'],'where':{'name':_0x3f6035,'role':{'$or':[_0x36d1('0x1e'),'user',_0x36d1('0x1f')]},'adSsoEnabled':!![]}});})[_0x36d1('0x19')](function(_0x48fc8f){if(!_0x48fc8f||_0x48fc8f&&_0x48fc8f[_0x36d1('0x20')]!==_0x3f6035){throw new Error(_0x36d1('0x15'));}_0x2722a0=_0x48fc8f;var _0x1fcfde=_0x2722a0[_0x36d1('0x20')]+'@'+config[_0x36d1('0xe')][_0x36d1('0xf')];return adAuthenticate(config[_0x36d1('0xe')],_0x1fcfde,_0x1632a1);})['then'](function(_0x342e42){if(_0x2722a0[_0x36d1('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x252498[_0x36d1('0x21')]>0x0){if(_0x2722a0[_0x36d1('0x1d')]){if(moment(_0x2722a0[_0x36d1('0x22')])[_0x36d1('0x23')](_0x252498[_0x36d1('0x21')],_0x36d1('0x24'))>moment()){throw new Error(_0x36d1('0x15'));}return utils[_0x36d1('0x25')](_0x2722a0,0x0,![],null)[_0x36d1('0x19')](function(){return utils[_0x36d1('0x26')](_0x2722a0);})[_0x36d1('0x19')](function(){return _0x4fb67c(null,_0x2722a0);});}else{return utils[_0x36d1('0x26')](_0x2722a0)['then'](function(){return _0x4fb67c(null,_0x2722a0);});}}else{return utils['getLicense'](_0x2722a0)[_0x36d1('0x19')](function(){return _0x4fb67c(null,_0x2722a0);});}})[_0x36d1('0x27')](function(_0x167d6f){return _0x4fb67c(null,![],_0x167d6f);});}function handleError(_0x3735ee,_0x59955e,_0xd12e83){return _0x3735ee[_0x36d1('0x28')](_0x59955e||0x1f4)[_0x36d1('0x29')]({'message':_0xd12e83?_0xd12e83['message']||_0xd12e83:''});}exports[_0x36d1('0x2a')]=function(_0x61beca,_0x252947,_0x468236){passport[_0x36d1('0x10')](_0x36d1('0x2b'),function(_0x3b0b53,_0x3432f3,_0x381637){var _0x556afe=_0x3b0b53||_0x381637;if(_0x556afe){return handleError(_0x252947,0x191,_0x556afe);}if(!_0x3432f3){return handleError(_0x252947,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2a402c={'payload':{'id':_0x3432f3['id'],'role':_0x3432f3['role']},'options':{'expiresIn':0x15180}};return authService[_0x36d1('0x2c')](_0x2a402c)[_0x36d1('0x19')](function(_0x4f1b60){_0x252947['json']({'id':_0x3432f3['id'],'token':_0x4f1b60,'statusCall':'','isAlreadyLogged':_0x3432f3[_0x36d1('0x2d')]});});}})(_0x61beca,_0x252947,_0x468236);};passport[_0x36d1('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0x36d1('0x20'),'passwordField':_0x36d1('0x1a')},function(_0x34bf66,_0x4aab03,_0x5f081d){return ActiveDirectoryAuthenticate(db['User'],_0x34bf66,_0x4aab03,_0x5f081d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ec0fafd..1fb4db0 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 _0x0d1c=['./authActiveDirectory.controller','post','login'];(function(_0x20f0b0,_0x431f47){var _0x1c94a5=function(_0x5c2757){while(--_0x5c2757){_0x20f0b0['push'](_0x20f0b0['shift']());}};_0x1c94a5(++_0x431f47);}(_0x0d1c,0xed));var _0xc0d1=function(_0x45dbd5,_0x293cc4){_0x45dbd5=_0x45dbd5-0x0;var _0x393dfe=_0x0d1c[_0x45dbd5];return _0x393dfe;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xc0d1('0x0'));router[_0xc0d1('0x1')]('/',controller[_0xc0d1('0x2')]);module['exports']=router; \ No newline at end of file +var _0x762d=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x90604a,_0x478069){var _0x5b517b=function(_0x475f05){while(--_0x475f05){_0x90604a['push'](_0x90604a['shift']());}};_0x5b517b(++_0x478069);}(_0x762d,0xd3));var _0xd762=function(_0x4b31b6,_0x5366d5){_0x4b31b6=_0x4b31b6-0x0;var _0x169a87=_0x762d[_0x4b31b6];return _0x169a87;};'use strict';var express=require(_0xd762('0x0'));var router=express[_0xd762('0x1')]();var controller=require(_0xd762('0x2'));router[_0xd762('0x3')]('/',controller[_0xd762('0x4')]);module[_0xd762('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 47d3a04..601aa6b 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x2f8801,_0x131c81){_0x2f8801=_0x2f8801-0x0;var _0x3358ea=_0x7a54[_0x2f8801];return _0x3358ea;};'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(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x7a54,0x106));var _0x47a5=function(_0x57f044,_0x2be669){_0x57f044=_0x57f044-0x0;var _0x381fb7=_0x7a54[_0x57f044];return _0x381fb7;};'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 fe5ca57..cdfc106 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 _0x1c34=['setTokenCookie','exports','express','passport','./authGoogle.controller','get','login','/callback','callback'];(function(_0x401b51,_0x5a05c1){var _0x395ae6=function(_0x1337fa){while(--_0x1337fa){_0x401b51['push'](_0x401b51['shift']());}};_0x395ae6(++_0x5a05c1);}(_0x1c34,0x65));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x41c3('0x0'));var passport=require(_0x41c3('0x1'));var router=express['Router']();var controller=require(_0x41c3('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x41c3('0x3')]('/',controller[_0x41c3('0x4')]);router[_0x41c3('0x3')](_0x41c3('0x5'),controller[_0x41c3('0x6')],authService['isMiddleware'],userController[_0x41c3('0x4')],authService[_0x41c3('0x7')]);module[_0x41c3('0x8')]=router; \ No newline at end of file +var _0x9d32=['get','/callback','callback','isMiddleware','login','passport','Router','../../components/auth/service'];(function(_0x7e8ffb,_0x272fcc){var _0x1756f6=function(_0x5edd94){while(--_0x5edd94){_0x7e8ffb['push'](_0x7e8ffb['shift']());}};_0x1756f6(++_0x272fcc);}(_0x9d32,0xd5));var _0x29d3=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x9d32[_0x4b0290];return _0x4bd9f4;};'use strict';var express=require('express');var passport=require(_0x29d3('0x0'));var router=express[_0x29d3('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x29d3('0x2'));router['get']('/',controller['login']);router[_0x29d3('0x3')](_0x29d3('0x4'),controller[_0x29d3('0x5')],authService[_0x29d3('0x6')],userController[_0x29d3('0x7')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 502a4fd..b3c36c0 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 _0x6f05=['Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','disabled','blockedAt','loginAttempts','admin','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','passwordHistoryLimit','resetPasswordToken','send','Password\x20reset!','use','util','passport'];(function(_0x14259b,_0x588942){var _0x5d87fa=function(_0x2164e9){while(--_0x2164e9){_0x14259b['push'](_0x14259b['shift']());}};_0x5d87fa(++_0x588942);}(_0x6f05,0x19d));var _0x56f0=function(_0x278ab8,_0x16c13f){_0x278ab8=_0x278ab8-0x0;var _0x3995c7=_0x6f05[_0x278ab8];return _0x3995c7;};'use strict';var util=require(_0x56f0('0x0'));var passport=require(_0x56f0('0x1'));var LocalStrategy=require('passport-local')[_0x56f0('0x2')];var jayson=require(_0x56f0('0x3'));var _=require(_0x56f0('0x4'));var rs=require(_0x56f0('0x5'));var moment=require(_0x56f0('0x6'));var db=require(_0x56f0('0x7'))['db'];var authService=require(_0x56f0('0x8'));var utils=require('../../config/utils');var client=jayson['client'][_0x56f0('0x9')]({'port':0x232b});function localAuthenticate(_0x3db8c1,_0x7a7753,_0x280863,_0x28ded5){var _0x4a9abf,_0x3891f2;return db[_0x56f0('0xa')][_0x56f0('0xb')]({'where':{'id':0x1},'attributes':[_0x56f0('0xc'),_0x56f0('0xd')],'raw':!![]})[_0x56f0('0xe')](function(_0x1a47f4){_0x4a9abf=_0x1a47f4;return _0x3db8c1[_0x56f0('0xb')]({'attributes':['id','name','password','salt','role',_0x56f0('0xf'),'blocked',_0x56f0('0x10'),_0x56f0('0x11')],'where':{'name':_0x7a7753,'role':{'$or':[_0x56f0('0x12'),'user',_0x56f0('0x13')]}}});})[_0x56f0('0xe')](function(_0x5aadc7){if(!_0x5aadc7||_0x5aadc7&&_0x5aadc7['name']!==_0x7a7753){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3891f2=_0x5aadc7;return _0x3891f2;}})[_0x56f0('0xe')](function(){_0x3891f2[_0x56f0('0x14')](_0x280863,function(_0x2be8c7,_0x4b3b7f){var _0x5add3d=_0x3891f2['loginAttempts']+0x1;if(_0x2be8c7){return _0x28ded5(_0x2be8c7);}else if(!_0x4b3b7f){if(_0x3891f2[_0x56f0('0xf')]){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else if(_0x4a9abf[_0x56f0('0xc')]>0x0){if(_0x3891f2[_0x56f0('0x16')]){if(_0x4a9abf[_0x56f0('0xd')]>0x0){if(moment(_0x3891f2['blockedAt'])['add'](_0x4a9abf[_0x56f0('0xd')],_0x56f0('0x17'))>moment()){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else{return utils[_0x56f0('0x18')](_0x3891f2,_0x5add3d,![],null)['then'](function(){return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}}else{if(_0x5add3d>=_0x4a9abf[_0x56f0('0xc')]){return utils[_0x56f0('0x18')](_0x3891f2,0x0,!![],moment())['then'](function(){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});});}else{return utils[_0x56f0('0x18')](_0x3891f2,_0x5add3d,![],null)[_0x56f0('0xe')](function(){return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3891f2['disabled']){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else if(_0x4a9abf['allowedLoginAttempts']>0x0){if(_0x3891f2[_0x56f0('0x16')]){if(_0x4a9abf[_0x56f0('0xd')]>0x0){if(moment(_0x3891f2[_0x56f0('0x10')])['add'](_0x4a9abf[_0x56f0('0xd')],_0x56f0('0x17'))>moment()){return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}else{return utils['clearBlockUser'](_0x3891f2,0x0,![],null)[_0x56f0('0xe')](function(){return utils[_0x56f0('0x19')](_0x3891f2);})[_0x56f0('0xe')](function(){return _0x28ded5(null,_0x3891f2);});}}else{return _0x28ded5(null,![],{'message':_0x56f0('0x15')});}}else{return utils[_0x56f0('0x18')](_0x3891f2,0x0,![],null)['then'](function(){return utils[_0x56f0('0x19')](_0x3891f2);})['then'](function(){return _0x28ded5(null,_0x3891f2);})[_0x56f0('0x1a')](function(_0xed53dd){return _0x28ded5(null,![],_0xed53dd);});}}else{if(_0x3891f2[_0x56f0('0x16')]){return _0x28ded5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x56f0('0x19')](_0x3891f2)[_0x56f0('0xe')](function(){return _0x28ded5(null,_0x3891f2);});}}}});})[_0x56f0('0x1a')](function(_0x4f6044){return _0x28ded5(null,![],_0x4f6044);});}function sendServiceMail(_0x1062ec){return db[_0x56f0('0x1b')][_0x56f0('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x56f0('0x1d'),_0x56f0('0x1e')],'include':[{'model':db[_0x56f0('0x1f')],'as':_0x56f0('0x20'),'include':[{'model':db[_0x56f0('0x21')],'as':'CloudProvider'}]}]})[_0x56f0('0xe')](function(_0x57646f){if(!_0x57646f){throw new Error(_0x56f0('0x22'));}var _0x4886ff=_0x57646f[_0x56f0('0x23')]();var _0x2bf235={'account':_0x4886ff,'message':_[_0x56f0('0x24')]({'from':util[_0x56f0('0x25')](_0x56f0('0x26'),_0x57646f[_0x56f0('0x1d')],_0x57646f[_0x56f0('0x1e')]||_0x57646f[_0x56f0('0x20')]['user'])},_0x1062ec)};return client[_0x56f0('0x27')]('SendMail',_0x2bf235);})[_0x56f0('0xe')](function(_0x25fd0e){if(_0x25fd0e[_0x56f0('0x28')]){throw new Error(util[_0x56f0('0x25')](_0x56f0('0x29'),_0x25fd0e[_0x56f0('0x28')][_0x56f0('0x2a')]||JSON['stringify'](_0x25fd0e[_0x56f0('0x28')])));}return!![];});}function handleError(_0x3c4a8,_0x14dd57,_0x1e6ecf){return _0x3c4a8[_0x56f0('0x2b')](_0x14dd57||0x1f4)['send']({'message':_0x1e6ecf?_0x1e6ecf[_0x56f0('0x2a')]||_0x1e6ecf:''});}exports[_0x56f0('0x2c')]=function(_0x22f597,_0x5caf6d,_0x53f5ef){passport[_0x56f0('0x14')](_0x56f0('0x2d'),function(_0x46473b,_0x2a0184,_0xff3266){var _0x14e204=_0x46473b||_0xff3266;if(_0x14e204){return handleError(_0x5caf6d,0x191,_0x14e204);}if(!_0x2a0184){return handleError(_0x5caf6d,0x194,{'message':_0x56f0('0x2e')});}else{var _0xaadca1={'payload':{'id':_0x2a0184['id'],'role':_0x2a0184[_0x56f0('0x2f')]},'options':{'expiresIn':0x15180}};return authService[_0x56f0('0x30')](_0xaadca1)[_0x56f0('0xe')](function(_0x4ada2e){_0x5caf6d['json']({'id':_0x2a0184['id'],'token':_0x4ada2e,'statusCall':'','isAlreadyLogged':_0x2a0184[_0x56f0('0x31')]});});}})(_0x22f597,_0x5caf6d,_0x53f5ef);};exports['forgot']=function(_0x34d1f2,_0x1b922f){if(!_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')]){return handleError(_0x1b922f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xe945c2=rs[_0x56f0('0x33')]();_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')]=_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')][_0x56f0('0x34')]()[_0x56f0('0x35')]();var _0x2137be;return db[_0x56f0('0xa')][_0x56f0('0xb')]({'where':{'id':0x1},'attributes':[_0x56f0('0xc'),'blockDuration'],'raw':!![]})[_0x56f0('0xe')](function(_0x1c25de){_0x2137be=_0x1c25de;return db[_0x56f0('0x36')][_0x56f0('0x1c')]({'where':{'email':_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')]}});})[_0x56f0('0xe')](function(_0x136b2f){if(!_0x136b2f){throw new Error(_0x56f0('0x37'));}if(_0x136b2f[_0x56f0('0xf')]){throw new Error(_0x56f0('0x38'));}if(_0x136b2f[_0x56f0('0x16')]){if(moment(_0x136b2f[_0x56f0('0x10')])[_0x56f0('0x39')](_0x2137be[_0x56f0('0xd')],_0x56f0('0x17'))>moment()){throw new Error(_0x56f0('0x3a'));}else{_0x136b2f['blocked']=![];_0x136b2f['blockedAt']=null;}}_0x136b2f['resetPasswordToken']=_0xe945c2;_0x136b2f[_0x56f0('0x3b')]=Date['now']()+0x36ee80;return _0x136b2f[_0x56f0('0x3c')]();})['then'](function(){return sendServiceMail({'to':_0x34d1f2[_0x56f0('0x32')][_0x56f0('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x56f0('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x56f0('0x3e')+_0x34d1f2[_0x56f0('0x3f')]['host']+_0x56f0('0x40')+_0xe945c2+'\x0a\x0a'+_0x56f0('0x41')});})['then'](function(){_0x1b922f[_0x56f0('0x2b')](0xc8)['send']({'message':_0x56f0('0x42')});})[_0x56f0('0x1a')](function(_0x5bdd2d){return handleError(_0x1b922f,0x1f4,_0x5bdd2d);});};exports[_0x56f0('0x43')]=function(_0x400ce7,_0xb433a4){return db[_0x56f0('0x36')][_0x56f0('0x1c')]({'where':{'resetPasswordToken':_0x400ce7[_0x56f0('0x44')][_0x56f0('0x45')],'resetPasswordExpires':{'$gt':Date[_0x56f0('0x46')]()}}})['then'](function(_0x1701b7){if(!_0x1701b7){throw new Error(_0x56f0('0x47'));}return db['Setting']['findOne']({'attributes':['id',_0x56f0('0x48'),_0x56f0('0x49'),'passwordHistoryLimit']})[_0x56f0('0xe')](function(_0xc19e37){if(_0xc19e37[_0x56f0('0x48')])authService[_0x56f0('0x4a')](_0x400ce7[_0x56f0('0x32')]['password']);if(!_0xc19e37['enforcePasswordHistory']||!_0x1701b7[_0x56f0('0x4b')])return _0x1701b7;authService[_0x56f0('0x4c')](_0x400ce7[_0x56f0('0x32')][_0x56f0('0x4d')],_0x1701b7['previousPasswords'],_0xc19e37[_0x56f0('0x4e')]);return _0x1701b7;})['then'](function(){_0x1701b7[_0x56f0('0x4d')]=_0x400ce7[_0x56f0('0x32')]['password'];_0x1701b7[_0x56f0('0x4f')]=null;_0x1701b7[_0x56f0('0x3b')]=null;return _0x1701b7[_0x56f0('0x3c')]();});})[_0x56f0('0xe')](function(){_0xb433a4[_0x56f0('0x2b')](0xc8)[_0x56f0('0x50')]({'message':_0x56f0('0x51')});})[_0x56f0('0x1a')](function(_0x3114e5){return handleError(_0xb433a4,0x1f4,_0x3114e5);});};passport[_0x56f0('0x52')](_0x56f0('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0x56f0('0x4d')},function(_0x4cc98b,_0x54d95b,_0x43159b){return localAuthenticate(db[_0x56f0('0x36')],_0x4cc98b,_0x54d95b,_0x43159b);})); \ No newline at end of file +var _0xfd61=['json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','status','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x5495e8,_0x588423){var _0x1aaafb=function(_0x5e7dc0){while(--_0x5e7dc0){_0x5495e8['push'](_0x5495e8['shift']());}};_0x1aaafb(++_0x588423);}(_0xfd61,0x78));var _0x1fd6=function(_0x180b71,_0x59ccec){_0x180b71=_0x180b71-0x0;var _0x57c42c=_0xfd61[_0x180b71];return _0x57c42c;};'use strict';var util=require(_0x1fd6('0x0'));var passport=require(_0x1fd6('0x1'));var LocalStrategy=require(_0x1fd6('0x2'))[_0x1fd6('0x3')];var jayson=require('jayson/promise');var _=require(_0x1fd6('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x1fd6('0x5'))['db'];var authService=require(_0x1fd6('0x6'));var utils=require(_0x1fd6('0x7'));var client=jayson[_0x1fd6('0x8')][_0x1fd6('0x9')]({'port':0x232b});function localAuthenticate(_0x26377c,_0x5f31c6,_0x3e4b68,_0x2767ea){var _0x345f73,_0x552779;return db[_0x1fd6('0xa')][_0x1fd6('0xb')]({'where':{'id':0x1},'attributes':[_0x1fd6('0xc'),_0x1fd6('0xd')],'raw':!![]})[_0x1fd6('0xe')](function(_0x36c243){_0x345f73=_0x36c243;return _0x26377c['findOne']({'attributes':['id',_0x1fd6('0xf'),_0x1fd6('0x10'),_0x1fd6('0x11'),_0x1fd6('0x12'),_0x1fd6('0x13'),'blocked',_0x1fd6('0x14'),_0x1fd6('0x15')],'where':{'name':_0x5f31c6,'role':{'$or':[_0x1fd6('0x16'),_0x1fd6('0x17'),'agent']}}});})[_0x1fd6('0xe')](function(_0x409b3b){if(!_0x409b3b||_0x409b3b&&_0x409b3b[_0x1fd6('0xf')]!==_0x5f31c6){throw new Error(_0x1fd6('0x18'));}else{_0x552779=_0x409b3b;return _0x552779;}})[_0x1fd6('0xe')](function(){_0x552779[_0x1fd6('0x19')](_0x3e4b68,function(_0x572d46,_0x14d2b8){var _0x3e84cd=_0x552779[_0x1fd6('0x15')]+0x1;if(_0x572d46){return _0x2767ea(_0x572d46);}else if(!_0x14d2b8){if(_0x552779[_0x1fd6('0x13')]){return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}else if(_0x345f73['allowedLoginAttempts']>0x0){if(_0x552779[_0x1fd6('0x1a')]){if(_0x345f73[_0x1fd6('0xd')]>0x0){if(moment(_0x552779['blockedAt'])['add'](_0x345f73[_0x1fd6('0xd')],_0x1fd6('0x1b'))>moment()){return _0x2767ea(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1fd6('0x1c')](_0x552779,_0x3e84cd,![],null)[_0x1fd6('0xe')](function(){return _0x2767ea(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}}else{if(_0x3e84cd>=_0x345f73[_0x1fd6('0xc')]){return utils[_0x1fd6('0x1c')](_0x552779,0x0,!![],moment())[_0x1fd6('0xe')](function(){return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});});}else{return utils[_0x1fd6('0x1c')](_0x552779,_0x3e84cd,![],null)[_0x1fd6('0xe')](function(){return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});});}}}else{return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}}else{if(_0x552779[_0x1fd6('0x13')]){return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}else if(_0x345f73[_0x1fd6('0xc')]>0x0){if(_0x552779['blocked']){if(_0x345f73[_0x1fd6('0xd')]>0x0){if(moment(_0x552779['blockedAt'])['add'](_0x345f73[_0x1fd6('0xd')],_0x1fd6('0x1b'))>moment()){return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}else{return utils[_0x1fd6('0x1c')](_0x552779,0x0,![],null)[_0x1fd6('0xe')](function(){return utils[_0x1fd6('0x1d')](_0x552779);})[_0x1fd6('0xe')](function(){return _0x2767ea(null,_0x552779);});}}else{return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}}else{return utils[_0x1fd6('0x1c')](_0x552779,0x0,![],null)[_0x1fd6('0xe')](function(){return utils['getLicense'](_0x552779);})['then'](function(){return _0x2767ea(null,_0x552779);})['catch'](function(_0xeeee2e){return _0x2767ea(null,![],_0xeeee2e);});}}else{if(_0x552779[_0x1fd6('0x1a')]){return _0x2767ea(null,![],{'message':_0x1fd6('0x18')});}else{return utils[_0x1fd6('0x1d')](_0x552779)[_0x1fd6('0xe')](function(){return _0x2767ea(null,_0x552779);});}}}});})[_0x1fd6('0x1e')](function(_0x569693){return _0x2767ea(null,![],_0x569693);});}function sendServiceMail(_0x7c12ec){return db[_0x1fd6('0x1f')][_0x1fd6('0x20')]({'where':{'service':!![]},'attributes':['id',_0x1fd6('0xf'),_0x1fd6('0x21')],'include':[{'model':db[_0x1fd6('0x22')],'as':_0x1fd6('0x23'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x1fd6('0xe')](function(_0x5125ae){if(!_0x5125ae){throw new Error(_0x1fd6('0x24'));}var _0x2dac9f=_0x5125ae[_0x1fd6('0x25')]();var _0x566b36={'account':_0x2dac9f,'message':_[_0x1fd6('0x26')]({'from':util[_0x1fd6('0x27')](_0x1fd6('0x28'),_0x5125ae[_0x1fd6('0xf')],_0x5125ae['email']||_0x5125ae[_0x1fd6('0x23')]['user'])},_0x7c12ec)};return client['request'](_0x1fd6('0x29'),_0x566b36);})[_0x1fd6('0xe')](function(_0x3f9cea){if(_0x3f9cea[_0x1fd6('0x2a')]){throw new Error(util[_0x1fd6('0x27')](_0x1fd6('0x2b'),_0x3f9cea[_0x1fd6('0x2a')][_0x1fd6('0x2c')]||JSON[_0x1fd6('0x2d')](_0x3f9cea['error'])));}return!![];});}function handleError(_0x31b082,_0x367386,_0x21c189){return _0x31b082['status'](_0x367386||0x1f4)[_0x1fd6('0x2e')]({'message':_0x21c189?_0x21c189[_0x1fd6('0x2c')]||_0x21c189:''});}exports[_0x1fd6('0x2f')]=function(_0x19f3de,_0x5bb4ba,_0x33e935){passport[_0x1fd6('0x19')](_0x1fd6('0x30'),function(_0xffaf34,_0x43d183,_0x1a87ef){var _0x183f64=_0xffaf34||_0x1a87ef;if(_0x183f64){return handleError(_0x5bb4ba,0x191,_0x183f64);}if(!_0x43d183){return handleError(_0x5bb4ba,0x194,{'message':_0x1fd6('0x31')});}else{var _0x2ff0e1={'payload':{'id':_0x43d183['id'],'role':_0x43d183[_0x1fd6('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2ff0e1)[_0x1fd6('0xe')](function(_0x5935db){_0x5bb4ba[_0x1fd6('0x32')]({'id':_0x43d183['id'],'token':_0x5935db,'statusCall':'','isAlreadyLogged':_0x43d183[_0x1fd6('0x33')]});});}})(_0x19f3de,_0x5bb4ba,_0x33e935);};exports[_0x1fd6('0x34')]=function(_0x393cd1,_0x4d1327){if(!_0x393cd1[_0x1fd6('0x35')][_0x1fd6('0x21')]){return handleError(_0x4d1327,0x1f4,{'message':_0x1fd6('0x36')});}var _0x15cdf9=rs['generate']();_0x393cd1[_0x1fd6('0x35')][_0x1fd6('0x21')]=_0x393cd1[_0x1fd6('0x35')][_0x1fd6('0x21')][_0x1fd6('0x37')]()[_0x1fd6('0x38')]();var _0x1e214f;return db['Setting'][_0x1fd6('0xb')]({'where':{'id':0x1},'attributes':[_0x1fd6('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x29e0ac){_0x1e214f=_0x29e0ac;return db[_0x1fd6('0x39')]['find']({'where':{'email':_0x393cd1[_0x1fd6('0x35')][_0x1fd6('0x21')]}});})['then'](function(_0x5552ba){if(!_0x5552ba){throw new Error(_0x1fd6('0x3a'));}if(_0x5552ba[_0x1fd6('0x13')]){throw new Error(_0x1fd6('0x3b'));}if(_0x5552ba['blocked']){if(moment(_0x5552ba[_0x1fd6('0x14')])[_0x1fd6('0x3c')](_0x1e214f[_0x1fd6('0xd')],_0x1fd6('0x1b'))>moment()){throw new Error(_0x1fd6('0x3d'));}else{_0x5552ba['blocked']=![];_0x5552ba[_0x1fd6('0x14')]=null;}}_0x5552ba[_0x1fd6('0x3e')]=_0x15cdf9;_0x5552ba[_0x1fd6('0x3f')]=Date[_0x1fd6('0x40')]()+0x36ee80;return _0x5552ba[_0x1fd6('0x41')]();})['then'](function(){return sendServiceMail({'to':_0x393cd1[_0x1fd6('0x35')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x1fd6('0x42')+_0x1fd6('0x43')+_0x1fd6('0x44')+_0x393cd1[_0x1fd6('0x45')][_0x1fd6('0x46')]+_0x1fd6('0x47')+_0x15cdf9+'\x0a\x0a'+_0x1fd6('0x48')});})[_0x1fd6('0xe')](function(){_0x4d1327['status'](0xc8)[_0x1fd6('0x2e')]({'message':_0x1fd6('0x49')});})[_0x1fd6('0x1e')](function(_0x15c193){return handleError(_0x4d1327,0x1f4,_0x15c193);});};exports[_0x1fd6('0x4a')]=function(_0x13d8a7,_0x113f4b){return db[_0x1fd6('0x39')]['find']({'where':{'resetPasswordToken':_0x13d8a7['params'][_0x1fd6('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x1fd6('0x40')]()}}})[_0x1fd6('0xe')](function(_0x591529){if(!_0x591529){throw new Error(_0x1fd6('0x4c'));}return db[_0x1fd6('0xa')][_0x1fd6('0xb')]({'attributes':['id',_0x1fd6('0x4d'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x1fd6('0xe')](function(_0x1495c6){if(_0x1495c6['securePassword'])authService['validatePasswordPattern'](_0x13d8a7['body'][_0x1fd6('0x10')]);if(!_0x1495c6[_0x1fd6('0x4e')]||!_0x591529['previousPasswords'])return _0x591529;authService[_0x1fd6('0x4f')](_0x13d8a7[_0x1fd6('0x35')]['password'],_0x591529[_0x1fd6('0x50')],_0x1495c6[_0x1fd6('0x51')]);return _0x591529;})[_0x1fd6('0xe')](function(){_0x591529[_0x1fd6('0x10')]=_0x13d8a7['body'][_0x1fd6('0x10')];_0x591529[_0x1fd6('0x3e')]=null;_0x591529[_0x1fd6('0x3f')]=null;return _0x591529[_0x1fd6('0x41')]();});})['then'](function(){_0x113f4b[_0x1fd6('0x52')](0xc8)[_0x1fd6('0x2e')]({'message':_0x1fd6('0x53')});})[_0x1fd6('0x1e')](function(_0x98de4b){return handleError(_0x113f4b,0x1f4,_0x98de4b);});};passport[_0x1fd6('0x54')](_0x1fd6('0x30'),new LocalStrategy({'usernameField':_0x1fd6('0xf'),'passwordField':_0x1fd6('0x10')},function(_0x3683e5,_0x1795b4,_0x224dc1){return localAuthenticate(db['User'],_0x3683e5,_0x1795b4,_0x224dc1);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e068f45..374708d 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 _0x9004=['express','Router','./authLocal.controller','post','login','/reset/:token','exports'];(function(_0x571541,_0x3b6dc0){var _0x2a729f=function(_0x12c1ee){while(--_0x12c1ee){_0x571541['push'](_0x571541['shift']());}};_0x2a729f(++_0x3b6dc0);}(_0x9004,0x196));var _0x4900=function(_0x21949d,_0x220ac2){_0x21949d=_0x21949d-0x0;var _0x3989d8=_0x9004[_0x21949d];return _0x3989d8;};'use strict';var express=require(_0x4900('0x0'));var router=express[_0x4900('0x1')]();var controller=require(_0x4900('0x2'));router[_0x4900('0x3')]('/',controller[_0x4900('0x4')]);router['post']('/forgot',controller['forgot']);router[_0x4900('0x3')](_0x4900('0x5'),controller['reset']);module[_0x4900('0x6')]=router; \ No newline at end of file +var _0x3583=['express','Router','post','login','/forgot','forgot','/reset/:token','reset','exports'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x3583,0x171));var _0x3358=function(_0x12b540,_0x344252){_0x12b540=_0x12b540-0x0;var _0x5927c7=_0x3583[_0x12b540];return _0x5927c7;};'use strict';var express=require(_0x3358('0x0'));var router=express[_0x3358('0x1')]();var controller=require('./authLocal.controller');router[_0x3358('0x2')]('/',controller[_0x3358('0x3')]);router[_0x3358('0x2')](_0x3358('0x4'),controller[_0x3358('0x5')]);router[_0x3358('0x2')](_0x3358('0x6'),controller[_0x3358('0x7')]);module[_0x3358('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 1e8430d..c00c600 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 _0xb8f4=['exports','STRING','sequelize'];(function(_0x200c4c,_0x3fb6d3){var _0x3c43c9=function(_0x2af216){while(--_0x2af216){_0x200c4c['push'](_0x200c4c['shift']());}};_0x3c43c9(++_0x3fb6d3);}(_0xb8f4,0x104));var _0x4b8f=function(_0x2fc4b4,_0x243370){_0x2fc4b4=_0x2fc4b4-0x0;var _0x346113=_0xb8f4[_0x2fc4b4];return _0x346113;};'use strict';var Sequelize=require(_0x4b8f('0x0'));module[_0x4b8f('0x1')]={'name':{'type':Sequelize[_0x4b8f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4b8f('0x2')]},'description':{'type':Sequelize[_0x4b8f('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xd181=['INTEGER','sequelize','exports','STRING'];(function(_0x5193ba,_0x228df7){var _0x1dc738=function(_0x423756){while(--_0x423756){_0x5193ba['push'](_0x5193ba['shift']());}};_0x1dc738(++_0x228df7);}(_0xd181,0x1bd));var _0x1d18=function(_0x2568d7,_0x191448){_0x2568d7=_0x2568d7-0x0;var _0x4b2bda=_0xd181[_0x2568d7];return _0x4b2bda;};'use strict';var Sequelize=require(_0x1d18('0x0'));module[_0x1d18('0x1')]={'name':{'type':Sequelize[_0x1d18('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x1d18('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1d18('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 7e2f28c..d39b541 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 _0x40c5=['merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','rawAttributes','length','find','create','body','params','addConditions','ids','getConditions','findOne','Condition','Action','addActions','omit','getActions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../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','error','stack','name','send','index','Automation','key','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x46bd4a,_0x38f47d){var _0x5bb00f=function(_0x5308d6){while(--_0x5308d6){_0x46bd4a['push'](_0x46bd4a['shift']());}};_0x5bb00f(++_0x38f47d);}(_0x40c5,0x1d2));var _0x540c=function(_0x5b4849,_0x44297b){_0x5b4849=_0x5b4849-0x0;var _0x1f3f55=_0x40c5[_0x5b4849];return _0x1f3f55;};'use strict';var emlformat=require(_0x540c('0x0'));var rimraf=require(_0x540c('0x1'));var zipdir=require(_0x540c('0x2'));var jsonpatch=require(_0x540c('0x3'));var rp=require(_0x540c('0x4'));var moment=require(_0x540c('0x5'));var BPromise=require(_0x540c('0x6'));var Mustache=require('mustache');var util=require(_0x540c('0x7'));var path=require(_0x540c('0x8'));var sox=require(_0x540c('0x9'));var csv=require(_0x540c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x540c('0xb'));var _=require(_0x540c('0xc'));var squel=require(_0x540c('0xd'));var crypto=require(_0x540c('0xe'));var jsforce=require(_0x540c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x540c('0xa'));var querystring=require(_0x540c('0x10'));var Papa=require(_0x540c('0x11'));var Redis=require('ioredis');var authService=require(_0x540c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x540c('0x13'));var logger=require(_0x540c('0x14'))(_0x540c('0x15'));var utils=require(_0x540c('0x16'));var config=require(_0x540c('0x17'));var licenseUtil=require(_0x540c('0x18'));var db=require(_0x540c('0x19'))['db'];function respondWithStatusCode(_0x369a2d,_0x49458f){_0x49458f=_0x49458f||0xcc;return function(_0x5cacee){if(_0x5cacee){return _0x369a2d[_0x540c('0x1a')](_0x49458f);}return _0x369a2d[_0x540c('0x1b')](_0x49458f)[_0x540c('0x1c')]();};}function respondWithResult(_0x48a1b1,_0x3fd3af){_0x3fd3af=_0x3fd3af||0xc8;return function(_0x1ed572){if(_0x1ed572){return _0x48a1b1['status'](_0x3fd3af)[_0x540c('0x1d')](_0x1ed572);}};}function respondWithFilteredResult(_0x42f837,_0x1d4cd2){return function(_0x44f848){if(_0x44f848){var _0x8f3852=typeof _0x1d4cd2[_0x540c('0x1e')]===_0x540c('0x1f')&&typeof _0x1d4cd2[_0x540c('0x20')]==='undefined';var _0x261a64=_0x44f848[_0x540c('0x21')];var _0xa22369=_0x8f3852?0x0:_0x1d4cd2['offset'];var _0x177a43=_0x8f3852?_0x44f848[_0x540c('0x21')]:_0x1d4cd2[_0x540c('0x1e')]+_0x1d4cd2[_0x540c('0x20')];var _0x22335f;if(_0x177a43>=_0x261a64){_0x177a43=_0x261a64;_0x22335f=0xc8;}else{_0x22335f=0xce;}_0x42f837[_0x540c('0x1b')](_0x22335f);return _0x42f837[_0x540c('0x22')](_0x540c('0x23'),_0xa22369+'-'+_0x177a43+'/'+_0x261a64)[_0x540c('0x1d')](_0x44f848);}return null;};}function patchUpdates(_0x115fa7){return function(_0x1bb88e){try{jsonpatch[_0x540c('0x24')](_0x1bb88e,_0x115fa7,!![]);}catch(_0x42efc4){return BPromise[_0x540c('0x25')](_0x42efc4);}return _0x1bb88e[_0x540c('0x26')]();};}function saveUpdates(_0x4f2e91,_0x5a149e){return function(_0x48ac36){if(_0x48ac36){return _0x48ac36[_0x540c('0x27')](_0x4f2e91)[_0x540c('0x28')](function(_0x3cf330){return _0x3cf330;});}return null;};}function removeEntity(_0x4f2f3b,_0x394694){return function(_0x31c1b2){if(_0x31c1b2){return _0x31c1b2[_0x540c('0x29')]()[_0x540c('0x28')](function(){_0x4f2f3b[_0x540c('0x1b')](0xcc)[_0x540c('0x1c')]();});}};}function handleEntityNotFound(_0x4775ad,_0x25c4a7){return function(_0x3969a7){if(!_0x3969a7){_0x4775ad[_0x540c('0x1a')](0x194);}return _0x3969a7;};}function handleError(_0x2d26e6,_0x273ecb){_0x273ecb=_0x273ecb||0x1f4;return function(_0x29953f){logger[_0x540c('0x2a')](_0x29953f[_0x540c('0x2b')]);if(_0x29953f[_0x540c('0x2c')]){delete _0x29953f['name'];}_0x2d26e6[_0x540c('0x1b')](_0x273ecb)[_0x540c('0x2d')](_0x29953f);};}exports[_0x540c('0x2e')]=function(_0x296587,_0x48dc1d){var _0x854ecd={},_0x1048ad={},_0x42d7c7={'count':0x0,'rows':[]};var _0xa6290c=_['map'](db[_0x540c('0x2f')]['rawAttributes'],function(_0x424235){return{'name':_0x424235['fieldName'],'type':_0x424235['type'][_0x540c('0x30')]};});_0x1048ad[_0x540c('0x31')]=_[_0x540c('0x32')](_0xa6290c,_0x540c('0x2c'));_0x1048ad['query']=_['keys'](_0x296587['query']);_0x1048ad[_0x540c('0x33')]=_[_0x540c('0x34')](_0x1048ad[_0x540c('0x31')],_0x1048ad[_0x540c('0x35')]);_0x854ecd[_0x540c('0x36')]=_[_0x540c('0x34')](_0x1048ad[_0x540c('0x31')],qs['fields'](_0x296587['query'][_0x540c('0x37')]));_0x854ecd[_0x540c('0x36')]=_0x854ecd[_0x540c('0x36')]['length']?_0x854ecd[_0x540c('0x36')]:_0x1048ad['model'];if(!_0x296587[_0x540c('0x35')][_0x540c('0x38')]('nolimit')){_0x854ecd['limit']=qs['limit'](_0x296587['query'][_0x540c('0x20')]);_0x854ecd['offset']=qs['offset'](_0x296587[_0x540c('0x35')]['offset']);}_0x854ecd[_0x540c('0x39')]=qs['sort'](_0x296587[_0x540c('0x35')][_0x540c('0x3a')]);_0x854ecd[_0x540c('0x3b')]=qs[_0x540c('0x33')](_[_0x540c('0x3c')](_0x296587[_0x540c('0x35')],_0x1048ad[_0x540c('0x33')]),_0xa6290c);if(_0x296587[_0x540c('0x35')][_0x540c('0x3d')]){_0x854ecd[_0x540c('0x3b')]=_[_0x540c('0x3e')](_0x854ecd[_0x540c('0x3b')],{'$or':_[_0x540c('0x32')](_0xa6290c,function(_0x4359f2){if(_0x4359f2[_0x540c('0x3f')]!==_0x540c('0x40')){var _0x285ff7={};_0x285ff7[_0x4359f2['name']]={'$like':'%'+_0x296587[_0x540c('0x35')][_0x540c('0x3d')]+'%'};return _0x285ff7;}})});}_0x854ecd=_['merge']({},_0x854ecd,_0x296587[_0x540c('0x41')]);var _0x22c819={'where':_0x854ecd[_0x540c('0x3b')]};return db[_0x540c('0x2f')][_0x540c('0x21')](_0x22c819)[_0x540c('0x28')](function(_0x4290c7){_0x42d7c7[_0x540c('0x21')]=_0x4290c7;if(_0x296587[_0x540c('0x35')][_0x540c('0x42')]){_0x854ecd[_0x540c('0x43')]=[{'all':!![]}];}return db['Automation'][_0x540c('0x44')](_0x854ecd);})[_0x540c('0x28')](function(_0xe99b09){_0x42d7c7['rows']=_0xe99b09;return _0x42d7c7;})['then'](respondWithFilteredResult(_0x48dc1d,_0x854ecd))[_0x540c('0x45')](handleError(_0x48dc1d,null));};exports[_0x540c('0x46')]=function(_0x2f8190,_0x10657d){var _0x547f50={'raw':![],'where':{'id':_0x2f8190['params']['id']}},_0x4fd719={};_0x4fd719[_0x540c('0x31')]=_[_0x540c('0x47')](db[_0x540c('0x2f')][_0x540c('0x48')]);_0x4fd719[_0x540c('0x35')]=_[_0x540c('0x47')](_0x2f8190['query']);_0x4fd719[_0x540c('0x33')]=_[_0x540c('0x34')](_0x4fd719[_0x540c('0x31')],_0x4fd719[_0x540c('0x35')]);_0x547f50['attributes']=_[_0x540c('0x34')](_0x4fd719[_0x540c('0x31')],qs[_0x540c('0x37')](_0x2f8190['query'][_0x540c('0x37')]));_0x547f50[_0x540c('0x36')]=_0x547f50['attributes'][_0x540c('0x49')]?_0x547f50[_0x540c('0x36')]:_0x4fd719[_0x540c('0x31')];if(_0x2f8190['query'][_0x540c('0x42')]){_0x547f50[_0x540c('0x43')]=[{'all':!![]}];}_0x547f50=_['merge']({},_0x547f50,_0x2f8190['options']);return db[_0x540c('0x2f')][_0x540c('0x4a')](_0x547f50)[_0x540c('0x28')](handleEntityNotFound(_0x10657d,null))[_0x540c('0x28')](respondWithResult(_0x10657d,null))[_0x540c('0x45')](handleError(_0x10657d,null));};exports[_0x540c('0x4b')]=function(_0x29178b,_0x13cb55){return db[_0x540c('0x2f')][_0x540c('0x4b')](_0x29178b[_0x540c('0x4c')],{})[_0x540c('0x28')](respondWithResult(_0x13cb55,0xc9))[_0x540c('0x45')](handleError(_0x13cb55,null));};exports['update']=function(_0x2116b1,_0x52f26d){if(_0x2116b1[_0x540c('0x4c')]['id']){delete _0x2116b1[_0x540c('0x4c')]['id'];}return db[_0x540c('0x2f')]['find']({'where':{'id':_0x2116b1['params']['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x52f26d,null))['then'](saveUpdates(_0x2116b1[_0x540c('0x4c')],null))[_0x540c('0x28')](respondWithResult(_0x52f26d,null))[_0x540c('0x45')](handleError(_0x52f26d,null));};exports[_0x540c('0x29')]=function(_0x676595,_0x11cd37){return db[_0x540c('0x2f')][_0x540c('0x4a')]({'where':{'id':_0x676595[_0x540c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x11cd37,null))[_0x540c('0x28')](removeEntity(_0x11cd37,null))['catch'](handleError(_0x11cd37,null));};exports[_0x540c('0x4e')]=function(_0xd29d6,_0x3f4e7c,_0x4e04e7){return db['Condition'][_0x540c('0x4a')]({'where':{'id':_0xd29d6['params']['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x3f4e7c,null))[_0x540c('0x28')](function(_0x97b110){if(_0x97b110){return _0x97b110[_0x540c('0x4e')](_0xd29d6['body'][_0x540c('0x4f')],_['omit'](_0xd29d6[_0x540c('0x4c')],['ids','id'])||{});}})[_0x540c('0x28')](respondWithResult(_0x3f4e7c,null))[_0x540c('0x45')](handleError(_0x3f4e7c,null));};exports[_0x540c('0x50')]=function(_0x4acb42,_0x324d0c,_0x148108){var _0x5356ec={};var _0x48fea2={};var _0x16bf81;var _0x119df4;return db[_0x540c('0x2f')][_0x540c('0x51')]({'where':{'id':_0x4acb42[_0x540c('0x4d')]['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x324d0c,null))[_0x540c('0x28')](function(_0x1eca7e){if(_0x1eca7e){_0x16bf81=_0x1eca7e;_0x48fea2[_0x540c('0x31')]=_[_0x540c('0x47')](db[_0x540c('0x52')][_0x540c('0x48')]);_0x48fea2[_0x540c('0x35')]=_[_0x540c('0x47')](_0x4acb42[_0x540c('0x35')]);_0x48fea2[_0x540c('0x33')]=_['intersection'](_0x48fea2['model'],_0x48fea2[_0x540c('0x35')]);_0x5356ec[_0x540c('0x36')]=_[_0x540c('0x34')](_0x48fea2[_0x540c('0x31')],qs[_0x540c('0x37')](_0x4acb42['query']['fields']));_0x5356ec[_0x540c('0x36')]=_0x5356ec['attributes']['length']?_0x5356ec['attributes']:_0x48fea2[_0x540c('0x31')];_0x5356ec[_0x540c('0x39')]=qs['sort'](_0x4acb42['query'][_0x540c('0x3a')]);_0x5356ec[_0x540c('0x3b')]=qs[_0x540c('0x33')](_['pick'](_0x4acb42[_0x540c('0x35')],_0x48fea2['filters']));if(_0x4acb42['query'][_0x540c('0x3d')]){_0x5356ec['where']=_[_0x540c('0x3e')](_0x5356ec[_0x540c('0x3b')],{'$or':_[_0x540c('0x32')](_0x5356ec[_0x540c('0x36')],function(_0x11bdef){var _0x3095cd={};_0x3095cd[_0x11bdef]={'$like':'%'+_0x4acb42[_0x540c('0x35')]['filter']+'%'};return _0x3095cd;})});}_0x5356ec=_[_0x540c('0x3e')]({},_0x5356ec,_0x4acb42[_0x540c('0x41')]);return _0x16bf81['getConditions'](_0x5356ec);}})[_0x540c('0x28')](function(_0x21f482){if(_0x21f482){_0x119df4=_0x21f482[_0x540c('0x49')];if(!_0x4acb42['query'][_0x540c('0x38')]('nolimit')){_0x5356ec['limit']=qs[_0x540c('0x20')](_0x4acb42[_0x540c('0x35')][_0x540c('0x20')]);_0x5356ec['offset']=qs[_0x540c('0x1e')](_0x4acb42[_0x540c('0x35')][_0x540c('0x1e')]);}return _0x16bf81[_0x540c('0x50')](_0x5356ec);}})[_0x540c('0x28')](function(_0x26d376){if(_0x26d376){return _0x26d376?{'count':_0x119df4,'rows':_0x26d376}:null;}})[_0x540c('0x28')](respondWithResult(_0x324d0c,null))[_0x540c('0x45')](handleError(_0x324d0c,null));};exports['addActions']=function(_0x5f2541,_0x48fa93,_0x2ca8c0){return db[_0x540c('0x53')][_0x540c('0x4a')]({'where':{'id':_0x5f2541[_0x540c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x48fa93,null))['then'](function(_0x171dee){if(_0x171dee){return _0x171dee[_0x540c('0x54')](_0x5f2541[_0x540c('0x4c')][_0x540c('0x4f')],_[_0x540c('0x55')](_0x5f2541['body'],[_0x540c('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x48fa93,null))['catch'](handleError(_0x48fa93,null));};exports[_0x540c('0x56')]=function(_0xd9766a,_0x38bd3f,_0x549970){var _0x429b59={};var _0x3040d1={};var _0x2d7a2f;var _0x5d0982;return db[_0x540c('0x2f')]['findOne']({'where':{'id':_0xd9766a[_0x540c('0x4d')]['id']}})[_0x540c('0x28')](handleEntityNotFound(_0x38bd3f,null))[_0x540c('0x28')](function(_0x42d485){if(_0x42d485){_0x2d7a2f=_0x42d485;_0x3040d1['model']=_['keys'](db[_0x540c('0x53')]['rawAttributes']);_0x3040d1[_0x540c('0x35')]=_[_0x540c('0x47')](_0xd9766a[_0x540c('0x35')]);_0x3040d1[_0x540c('0x33')]=_[_0x540c('0x34')](_0x3040d1[_0x540c('0x31')],_0x3040d1[_0x540c('0x35')]);_0x429b59[_0x540c('0x36')]=_[_0x540c('0x34')](_0x3040d1[_0x540c('0x31')],qs[_0x540c('0x37')](_0xd9766a[_0x540c('0x35')][_0x540c('0x37')]));_0x429b59[_0x540c('0x36')]=_0x429b59['attributes'][_0x540c('0x49')]?_0x429b59[_0x540c('0x36')]:_0x3040d1[_0x540c('0x31')];_0x429b59[_0x540c('0x39')]=qs[_0x540c('0x3a')](_0xd9766a[_0x540c('0x35')][_0x540c('0x3a')]);_0x429b59[_0x540c('0x3b')]=qs['filters'](_[_0x540c('0x3c')](_0xd9766a[_0x540c('0x35')],_0x3040d1[_0x540c('0x33')]));if(_0xd9766a['query'][_0x540c('0x3d')]){_0x429b59['where']=_[_0x540c('0x3e')](_0x429b59[_0x540c('0x3b')],{'$or':_[_0x540c('0x32')](_0x429b59[_0x540c('0x36')],function(_0x1cc799){var _0x4e6583={};_0x4e6583[_0x1cc799]={'$like':'%'+_0xd9766a[_0x540c('0x35')][_0x540c('0x3d')]+'%'};return _0x4e6583;})});}_0x429b59=_['merge']({},_0x429b59,_0xd9766a[_0x540c('0x41')]);return _0x2d7a2f[_0x540c('0x56')](_0x429b59);}})[_0x540c('0x28')](function(_0x320329){if(_0x320329){_0x5d0982=_0x320329[_0x540c('0x49')];if(!_0xd9766a[_0x540c('0x35')][_0x540c('0x38')](_0x540c('0x57'))){_0x429b59[_0x540c('0x20')]=qs[_0x540c('0x20')](_0xd9766a[_0x540c('0x35')][_0x540c('0x20')]);_0x429b59[_0x540c('0x1e')]=qs[_0x540c('0x1e')](_0xd9766a[_0x540c('0x35')][_0x540c('0x1e')]);}return _0x2d7a2f[_0x540c('0x56')](_0x429b59);}})['then'](function(_0x15fdcb){if(_0x15fdcb){return _0x15fdcb?{'count':_0x5d0982,'rows':_0x15fdcb}:null;}})[_0x540c('0x28')](respondWithResult(_0x38bd3f,null))['catch'](handleError(_0x38bd3f,null));}; \ No newline at end of file +var _0x00ce=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','map','Automation','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','include','rows','params','rawAttributes','includeAll','options','find','create','body','catch','addConditions','Condition','omit','ids','getConditions','nolimit','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x6caff4,_0x480025){var _0x358739=function(_0x2839ef){while(--_0x2839ef){_0x6caff4['push'](_0x6caff4['shift']());}};_0x358739(++_0x480025);}(_0x00ce,0x8f));var _0xe00c=function(_0x3a39e1,_0x245fb0){_0x3a39e1=_0x3a39e1-0x0;var _0x104e0e=_0x00ce[_0x3a39e1];return _0x104e0e;};'use strict';var emlformat=require(_0xe00c('0x0'));var rimraf=require(_0xe00c('0x1'));var zipdir=require(_0xe00c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe00c('0x3'));var moment=require(_0xe00c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe00c('0x5'));var util=require(_0xe00c('0x6'));var path=require(_0xe00c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe00c('0x8'));var fs=require('fs');var fs_extra=require(_0xe00c('0x9'));var _=require(_0xe00c('0xa'));var squel=require(_0xe00c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe00c('0xc'));var toCsv=require(_0xe00c('0xd'));var querystring=require(_0xe00c('0xe'));var Papa=require(_0xe00c('0xf'));var Redis=require('ioredis');var authService=require(_0xe00c('0x10'));var qs=require(_0xe00c('0x11'));var as=require(_0xe00c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe00c('0x13'))(_0xe00c('0x14'));var utils=require(_0xe00c('0x15'));var config=require(_0xe00c('0x16'));var licenseUtil=require(_0xe00c('0x17'));var db=require(_0xe00c('0x18'))['db'];function respondWithStatusCode(_0x27a853,_0x31ee1c){_0x31ee1c=_0x31ee1c||0xcc;return function(_0x37123c){if(_0x37123c){return _0x27a853[_0xe00c('0x19')](_0x31ee1c);}return _0x27a853[_0xe00c('0x1a')](_0x31ee1c)['end']();};}function respondWithResult(_0x3751a5,_0x47c98f){_0x47c98f=_0x47c98f||0xc8;return function(_0x2c0cd9){if(_0x2c0cd9){return _0x3751a5[_0xe00c('0x1a')](_0x47c98f)[_0xe00c('0x1b')](_0x2c0cd9);}};}function respondWithFilteredResult(_0x1c651e,_0x433405){return function(_0x56e9d7){if(_0x56e9d7){var _0xca2152=typeof _0x433405[_0xe00c('0x1c')]===_0xe00c('0x1d')&&typeof _0x433405[_0xe00c('0x1e')]===_0xe00c('0x1d');var _0x5084ca=_0x56e9d7[_0xe00c('0x1f')];var _0x4be67a=_0xca2152?0x0:_0x433405[_0xe00c('0x1c')];var _0x253712=_0xca2152?_0x56e9d7['count']:_0x433405['offset']+_0x433405[_0xe00c('0x1e')];var _0x66c46;if(_0x253712>=_0x5084ca){_0x253712=_0x5084ca;_0x66c46=0xc8;}else{_0x66c46=0xce;}_0x1c651e[_0xe00c('0x1a')](_0x66c46);return _0x1c651e[_0xe00c('0x20')](_0xe00c('0x21'),_0x4be67a+'-'+_0x253712+'/'+_0x5084ca)[_0xe00c('0x1b')](_0x56e9d7);}return null;};}function patchUpdates(_0x3255c0){return function(_0x54a26b){try{jsonpatch[_0xe00c('0x22')](_0x54a26b,_0x3255c0,!![]);}catch(_0x22bc9e){return BPromise['reject'](_0x22bc9e);}return _0x54a26b[_0xe00c('0x23')]();};}function saveUpdates(_0x2f4866,_0x6a15da){return function(_0x2e4eeb){if(_0x2e4eeb){return _0x2e4eeb[_0xe00c('0x24')](_0x2f4866)[_0xe00c('0x25')](function(_0x3b67e3){return _0x3b67e3;});}return null;};}function removeEntity(_0x2ccc8b,_0x405635){return function(_0x594e2b){if(_0x594e2b){return _0x594e2b[_0xe00c('0x26')]()[_0xe00c('0x25')](function(){_0x2ccc8b['status'](0xcc)[_0xe00c('0x27')]();});}};}function handleEntityNotFound(_0x45667f,_0x2ade6e){return function(_0x185eae){if(!_0x185eae){_0x45667f[_0xe00c('0x19')](0x194);}return _0x185eae;};}function handleError(_0x53bd26,_0x2b5ba4){_0x2b5ba4=_0x2b5ba4||0x1f4;return function(_0x207825){logger[_0xe00c('0x28')](_0x207825[_0xe00c('0x29')]);if(_0x207825[_0xe00c('0x2a')]){delete _0x207825[_0xe00c('0x2a')];}_0x53bd26[_0xe00c('0x1a')](_0x2b5ba4)['send'](_0x207825);};}exports['index']=function(_0x5b2b3e,_0x2ae969){var _0x2e75b4={},_0xb69f12={},_0x54538c={'count':0x0,'rows':[]};var _0x13f330=_[_0xe00c('0x2b')](db[_0xe00c('0x2c')]['rawAttributes'],function(_0x4e8c49){return{'name':_0x4e8c49[_0xe00c('0x2d')],'type':_0x4e8c49[_0xe00c('0x2e')]['key']};});_0xb69f12[_0xe00c('0x2f')]=_[_0xe00c('0x2b')](_0x13f330,_0xe00c('0x2a'));_0xb69f12[_0xe00c('0x30')]=_[_0xe00c('0x31')](_0x5b2b3e[_0xe00c('0x30')]);_0xb69f12[_0xe00c('0x32')]=_['intersection'](_0xb69f12['model'],_0xb69f12[_0xe00c('0x30')]);_0x2e75b4[_0xe00c('0x33')]=_[_0xe00c('0x34')](_0xb69f12['model'],qs['fields'](_0x5b2b3e['query'][_0xe00c('0x35')]));_0x2e75b4[_0xe00c('0x33')]=_0x2e75b4[_0xe00c('0x33')][_0xe00c('0x36')]?_0x2e75b4[_0xe00c('0x33')]:_0xb69f12[_0xe00c('0x2f')];if(!_0x5b2b3e[_0xe00c('0x30')][_0xe00c('0x37')]('nolimit')){_0x2e75b4['limit']=qs['limit'](_0x5b2b3e[_0xe00c('0x30')][_0xe00c('0x1e')]);_0x2e75b4[_0xe00c('0x1c')]=qs[_0xe00c('0x1c')](_0x5b2b3e['query'][_0xe00c('0x1c')]);}_0x2e75b4[_0xe00c('0x38')]=qs[_0xe00c('0x39')](_0x5b2b3e[_0xe00c('0x30')][_0xe00c('0x39')]);_0x2e75b4['where']=qs[_0xe00c('0x32')](_[_0xe00c('0x3a')](_0x5b2b3e[_0xe00c('0x30')],_0xb69f12['filters']),_0x13f330);if(_0x5b2b3e[_0xe00c('0x30')][_0xe00c('0x3b')]){_0x2e75b4[_0xe00c('0x3c')]=_[_0xe00c('0x3d')](_0x2e75b4[_0xe00c('0x3c')],{'$or':_['map'](_0x13f330,function(_0x56499c){if(_0x56499c[_0xe00c('0x2e')]!=='VIRTUAL'){var _0x364750={};_0x364750[_0x56499c[_0xe00c('0x2a')]]={'$like':'%'+_0x5b2b3e[_0xe00c('0x30')][_0xe00c('0x3b')]+'%'};return _0x364750;}})});}_0x2e75b4=_[_0xe00c('0x3d')]({},_0x2e75b4,_0x5b2b3e['options']);var _0x4edd01={'where':_0x2e75b4[_0xe00c('0x3c')]};return db[_0xe00c('0x2c')][_0xe00c('0x1f')](_0x4edd01)[_0xe00c('0x25')](function(_0x4c6265){_0x54538c[_0xe00c('0x1f')]=_0x4c6265;if(_0x5b2b3e[_0xe00c('0x30')]['includeAll']){_0x2e75b4[_0xe00c('0x3e')]=[{'all':!![]}];}return db[_0xe00c('0x2c')]['findAll'](_0x2e75b4);})[_0xe00c('0x25')](function(_0x41ca26){_0x54538c[_0xe00c('0x3f')]=_0x41ca26;return _0x54538c;})['then'](respondWithFilteredResult(_0x2ae969,_0x2e75b4))['catch'](handleError(_0x2ae969,null));};exports['show']=function(_0x295e6a,_0x3fdacf){var _0x4d9a16={'raw':![],'where':{'id':_0x295e6a[_0xe00c('0x40')]['id']}},_0x2042cf={};_0x2042cf[_0xe00c('0x2f')]=_[_0xe00c('0x31')](db[_0xe00c('0x2c')][_0xe00c('0x41')]);_0x2042cf[_0xe00c('0x30')]=_[_0xe00c('0x31')](_0x295e6a[_0xe00c('0x30')]);_0x2042cf[_0xe00c('0x32')]=_[_0xe00c('0x34')](_0x2042cf[_0xe00c('0x2f')],_0x2042cf[_0xe00c('0x30')]);_0x4d9a16[_0xe00c('0x33')]=_[_0xe00c('0x34')](_0x2042cf[_0xe00c('0x2f')],qs[_0xe00c('0x35')](_0x295e6a[_0xe00c('0x30')][_0xe00c('0x35')]));_0x4d9a16[_0xe00c('0x33')]=_0x4d9a16[_0xe00c('0x33')][_0xe00c('0x36')]?_0x4d9a16[_0xe00c('0x33')]:_0x2042cf[_0xe00c('0x2f')];if(_0x295e6a[_0xe00c('0x30')][_0xe00c('0x42')]){_0x4d9a16[_0xe00c('0x3e')]=[{'all':!![]}];}_0x4d9a16=_[_0xe00c('0x3d')]({},_0x4d9a16,_0x295e6a[_0xe00c('0x43')]);return db[_0xe00c('0x2c')][_0xe00c('0x44')](_0x4d9a16)[_0xe00c('0x25')](handleEntityNotFound(_0x3fdacf,null))['then'](respondWithResult(_0x3fdacf,null))['catch'](handleError(_0x3fdacf,null));};exports[_0xe00c('0x45')]=function(_0x5e5d78,_0x274fba){return db[_0xe00c('0x2c')]['create'](_0x5e5d78[_0xe00c('0x46')],{})['then'](respondWithResult(_0x274fba,0xc9))['catch'](handleError(_0x274fba,null));};exports['update']=function(_0xdc8130,_0x4f166e){if(_0xdc8130[_0xe00c('0x46')]['id']){delete _0xdc8130[_0xe00c('0x46')]['id'];}return db[_0xe00c('0x2c')][_0xe00c('0x44')]({'where':{'id':_0xdc8130[_0xe00c('0x40')]['id']}})[_0xe00c('0x25')](handleEntityNotFound(_0x4f166e,null))[_0xe00c('0x25')](saveUpdates(_0xdc8130[_0xe00c('0x46')],null))[_0xe00c('0x25')](respondWithResult(_0x4f166e,null))[_0xe00c('0x47')](handleError(_0x4f166e,null));};exports[_0xe00c('0x26')]=function(_0x278ba2,_0x49c918){return db[_0xe00c('0x2c')][_0xe00c('0x44')]({'where':{'id':_0x278ba2[_0xe00c('0x40')]['id']}})[_0xe00c('0x25')](handleEntityNotFound(_0x49c918,null))[_0xe00c('0x25')](removeEntity(_0x49c918,null))[_0xe00c('0x47')](handleError(_0x49c918,null));};exports[_0xe00c('0x48')]=function(_0x129a10,_0x26d828,_0x2e6262){return db[_0xe00c('0x49')]['find']({'where':{'id':_0x129a10[_0xe00c('0x40')]['id']}})['then'](handleEntityNotFound(_0x26d828,null))[_0xe00c('0x25')](function(_0x4cf1e4){if(_0x4cf1e4){return _0x4cf1e4[_0xe00c('0x48')](_0x129a10[_0xe00c('0x46')]['ids'],_[_0xe00c('0x4a')](_0x129a10[_0xe00c('0x46')],[_0xe00c('0x4b'),'id'])||{});}})[_0xe00c('0x25')](respondWithResult(_0x26d828,null))[_0xe00c('0x47')](handleError(_0x26d828,null));};exports['getConditions']=function(_0xb111b8,_0x994fe6,_0x341524){var _0x2fda7c={};var _0x3c1e98={};var _0x3f4a08;var _0x372a0a;return db[_0xe00c('0x2c')]['findOne']({'where':{'id':_0xb111b8['params']['id']}})[_0xe00c('0x25')](handleEntityNotFound(_0x994fe6,null))[_0xe00c('0x25')](function(_0x3f8102){if(_0x3f8102){_0x3f4a08=_0x3f8102;_0x3c1e98[_0xe00c('0x2f')]=_[_0xe00c('0x31')](db[_0xe00c('0x49')][_0xe00c('0x41')]);_0x3c1e98[_0xe00c('0x30')]=_[_0xe00c('0x31')](_0xb111b8[_0xe00c('0x30')]);_0x3c1e98[_0xe00c('0x32')]=_[_0xe00c('0x34')](_0x3c1e98[_0xe00c('0x2f')],_0x3c1e98[_0xe00c('0x30')]);_0x2fda7c[_0xe00c('0x33')]=_['intersection'](_0x3c1e98[_0xe00c('0x2f')],qs['fields'](_0xb111b8[_0xe00c('0x30')]['fields']));_0x2fda7c[_0xe00c('0x33')]=_0x2fda7c[_0xe00c('0x33')][_0xe00c('0x36')]?_0x2fda7c[_0xe00c('0x33')]:_0x3c1e98['model'];_0x2fda7c[_0xe00c('0x38')]=qs[_0xe00c('0x39')](_0xb111b8[_0xe00c('0x30')][_0xe00c('0x39')]);_0x2fda7c[_0xe00c('0x3c')]=qs[_0xe00c('0x32')](_[_0xe00c('0x3a')](_0xb111b8[_0xe00c('0x30')],_0x3c1e98[_0xe00c('0x32')]));if(_0xb111b8[_0xe00c('0x30')]['filter']){_0x2fda7c[_0xe00c('0x3c')]=_[_0xe00c('0x3d')](_0x2fda7c[_0xe00c('0x3c')],{'$or':_[_0xe00c('0x2b')](_0x2fda7c[_0xe00c('0x33')],function(_0x104fe7){var _0xcb3170={};_0xcb3170[_0x104fe7]={'$like':'%'+_0xb111b8[_0xe00c('0x30')]['filter']+'%'};return _0xcb3170;})});}_0x2fda7c=_['merge']({},_0x2fda7c,_0xb111b8[_0xe00c('0x43')]);return _0x3f4a08[_0xe00c('0x4c')](_0x2fda7c);}})['then'](function(_0x4e1b95){if(_0x4e1b95){_0x372a0a=_0x4e1b95[_0xe00c('0x36')];if(!_0xb111b8['query']['hasOwnProperty'](_0xe00c('0x4d'))){_0x2fda7c[_0xe00c('0x1e')]=qs[_0xe00c('0x1e')](_0xb111b8['query']['limit']);_0x2fda7c['offset']=qs[_0xe00c('0x1c')](_0xb111b8[_0xe00c('0x30')]['offset']);}return _0x3f4a08['getConditions'](_0x2fda7c);}})[_0xe00c('0x25')](function(_0x126785){if(_0x126785){return _0x126785?{'count':_0x372a0a,'rows':_0x126785}:null;}})[_0xe00c('0x25')](respondWithResult(_0x994fe6,null))[_0xe00c('0x47')](handleError(_0x994fe6,null));};exports[_0xe00c('0x4e')]=function(_0x5c0d87,_0x26af4f,_0x947674){return db[_0xe00c('0x4f')][_0xe00c('0x44')]({'where':{'id':_0x5c0d87[_0xe00c('0x40')]['id']}})[_0xe00c('0x25')](handleEntityNotFound(_0x26af4f,null))[_0xe00c('0x25')](function(_0x58cbb1){if(_0x58cbb1){return _0x58cbb1['addActions'](_0x5c0d87[_0xe00c('0x46')][_0xe00c('0x4b')],_[_0xe00c('0x4a')](_0x5c0d87['body'],['ids','id'])||{});}})[_0xe00c('0x25')](respondWithResult(_0x26af4f,null))['catch'](handleError(_0x26af4f,null));};exports[_0xe00c('0x50')]=function(_0x3da251,_0x2f3414,_0x46b3a0){var _0x5dc709={};var _0x5b4a74={};var _0x51cc57;var _0x315bda;return db[_0xe00c('0x2c')][_0xe00c('0x51')]({'where':{'id':_0x3da251['params']['id']}})[_0xe00c('0x25')](handleEntityNotFound(_0x2f3414,null))[_0xe00c('0x25')](function(_0x5ce7ed){if(_0x5ce7ed){_0x51cc57=_0x5ce7ed;_0x5b4a74[_0xe00c('0x2f')]=_[_0xe00c('0x31')](db[_0xe00c('0x4f')]['rawAttributes']);_0x5b4a74[_0xe00c('0x30')]=_[_0xe00c('0x31')](_0x3da251[_0xe00c('0x30')]);_0x5b4a74[_0xe00c('0x32')]=_[_0xe00c('0x34')](_0x5b4a74[_0xe00c('0x2f')],_0x5b4a74['query']);_0x5dc709[_0xe00c('0x33')]=_[_0xe00c('0x34')](_0x5b4a74[_0xe00c('0x2f')],qs[_0xe00c('0x35')](_0x3da251['query'][_0xe00c('0x35')]));_0x5dc709[_0xe00c('0x33')]=_0x5dc709[_0xe00c('0x33')]['length']?_0x5dc709['attributes']:_0x5b4a74['model'];_0x5dc709[_0xe00c('0x38')]=qs[_0xe00c('0x39')](_0x3da251[_0xe00c('0x30')][_0xe00c('0x39')]);_0x5dc709[_0xe00c('0x3c')]=qs['filters'](_[_0xe00c('0x3a')](_0x3da251[_0xe00c('0x30')],_0x5b4a74[_0xe00c('0x32')]));if(_0x3da251[_0xe00c('0x30')][_0xe00c('0x3b')]){_0x5dc709[_0xe00c('0x3c')]=_[_0xe00c('0x3d')](_0x5dc709['where'],{'$or':_[_0xe00c('0x2b')](_0x5dc709[_0xe00c('0x33')],function(_0x1d7186){var _0x1680b4={};_0x1680b4[_0x1d7186]={'$like':'%'+_0x3da251[_0xe00c('0x30')][_0xe00c('0x3b')]+'%'};return _0x1680b4;})});}_0x5dc709=_['merge']({},_0x5dc709,_0x3da251[_0xe00c('0x43')]);return _0x51cc57[_0xe00c('0x50')](_0x5dc709);}})[_0xe00c('0x25')](function(_0x1a6338){if(_0x1a6338){_0x315bda=_0x1a6338[_0xe00c('0x36')];if(!_0x3da251[_0xe00c('0x30')]['hasOwnProperty'](_0xe00c('0x4d'))){_0x5dc709[_0xe00c('0x1e')]=qs[_0xe00c('0x1e')](_0x3da251[_0xe00c('0x30')][_0xe00c('0x1e')]);_0x5dc709['offset']=qs[_0xe00c('0x1c')](_0x3da251['query'][_0xe00c('0x1c')]);}return _0x51cc57[_0xe00c('0x50')](_0x5dc709);}})[_0xe00c('0x25')](function(_0xb129c7){if(_0xb129c7){return _0xb129c7?{'count':_0x315bda,'rows':_0xb129c7}:null;}})[_0xe00c('0x25')](respondWithResult(_0x2f3414,null))[_0xe00c('0x47')](handleError(_0x2f3414,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e86ae81..df5afc4 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 _0x3320=['moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x3320,0x171));var _0x0332=function(_0x544a8b,_0x22977f){_0x544a8b=_0x544a8b-0x0;var _0x399cb2=_0x3320[_0x544a8b];return _0x399cb2;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var logger=require(_0x0332('0x2'))('api');var moment=require(_0x0332('0x3'));var BPromise=require(_0x0332('0x4'));var rp=require(_0x0332('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0332('0x6'));var config=require(_0x0332('0x7'));var attributes=require(_0x0332('0x8'));module[_0x0332('0x9')]=function(_0x104a3d,_0x12ecca){return _0x104a3d['define'](_0x0332('0xa'),attributes,{'tableName':_0x0332('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90c4=['lodash','api','moment','request-promise','path','../../config/environment','exports','define','Automation','tools_automations'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x90c4,0x190));var _0x490c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x490c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x490c('0x1'));var moment=require(_0x490c('0x2'));var BPromise=require('bluebird');var rp=require(_0x490c('0x3'));var fs=require('fs');var path=require(_0x490c('0x4'));var rimraf=require('rimraf');var config=require(_0x490c('0x5'));var attributes=require('./automation.attributes');module[_0x490c('0x6')]=function(_0x4ac109,_0x568278){return _0x4ac109[_0x490c('0x7')](_0x490c('0x8'),attributes,{'tableName':_0x490c('0x9'),'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 6a7d1ad..cecc19d 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 _0x5ed9=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Automation,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5ed9[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('Automation,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});} \ No newline at end of file +var _0x09df=['rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','Automation,\x20%s,\x20%s','message','lodash','util','bluebird','../../mysqldb'];(function(_0x48ad0e,_0x72d175){var _0x1184e3=function(_0x23496){while(--_0x23496){_0x48ad0e['push'](_0x48ad0e['shift']());}};_0x1184e3(++_0x72d175);}(_0x09df,0x164));var _0xf09d=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x09df[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('Automation,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 86f8938..c40d888 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 _0xeec3=['destroy','multer','util','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show','get','/:id/conditions','getConditions','post','create','addActions','put','update'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xeec3,0x1c3));var _0x3eec=function(_0x5dc9d9,_0x5b91c0){_0x5dc9d9=_0x5dc9d9-0x0;var _0x4824b7=_0xeec3[_0x5dc9d9];return _0x4824b7;};'use strict';var multer=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3eec('0x2'));var interaction=require(_0x3eec('0x3'));var config=require('../../config/environment');var controller=require(_0x3eec('0x4'));router['get']('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0x6')]);router['get'](_0x3eec('0x7'),auth[_0x3eec('0x5')](),controller[_0x3eec('0x8')]);router[_0x3eec('0x9')](_0x3eec('0xa'),auth[_0x3eec('0x5')](),controller[_0x3eec('0xb')]);router[_0x3eec('0x9')]('/:id/actions',auth[_0x3eec('0x5')](),controller['getActions']);router[_0x3eec('0xc')]('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0xd')]);router[_0x3eec('0xc')]('/:id/conditions',auth[_0x3eec('0x5')](),controller['addConditions']);router['post']('/:id/actions',auth[_0x3eec('0x5')](),controller[_0x3eec('0xe')]);router[_0x3eec('0xf')](_0x3eec('0x7'),auth['isAuthenticated'](),controller[_0x3eec('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3eec('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd5ec=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','post','put','update','delete','destroy','exports'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0xd5ec,0xb8));var _0xcd5e=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xd5ec[_0x49052b];return _0x48c045;};'use strict';var multer=require(_0xcd5e('0x0'));var util=require(_0xcd5e('0x1'));var path=require(_0xcd5e('0x2'));var timeout=require(_0xcd5e('0x3'));var express=require('express');var router=express[_0xcd5e('0x4')]();var fs_extra=require(_0xcd5e('0x5'));var auth=require(_0xcd5e('0x6'));var interaction=require(_0xcd5e('0x7'));var config=require(_0xcd5e('0x8'));var controller=require(_0xcd5e('0x9'));router[_0xcd5e('0xa')]('/',auth[_0xcd5e('0xb')](),controller[_0xcd5e('0xc')]);router[_0xcd5e('0xa')](_0xcd5e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcd5e('0xa')](_0xcd5e('0xe'),auth[_0xcd5e('0xb')](),controller['getConditions']);router[_0xcd5e('0xa')](_0xcd5e('0xf'),auth[_0xcd5e('0xb')](),controller[_0xcd5e('0x10')]);router['post']('/',auth[_0xcd5e('0xb')](),controller['create']);router[_0xcd5e('0x11')](_0xcd5e('0xe'),auth[_0xcd5e('0xb')](),controller['addConditions']);router[_0xcd5e('0x11')](_0xcd5e('0xf'),auth[_0xcd5e('0xb')](),controller['addActions']);router[_0xcd5e('0x12')](_0xcd5e('0xd'),auth[_0xcd5e('0xb')](),controller[_0xcd5e('0x13')]);router[_0xcd5e('0x14')](_0xcd5e('0xd'),auth['isAuthenticated'](),controller[_0xcd5e('0x15')]);module[_0xcd5e('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 461975a..140b3bc 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 _0x3441=['ENUM','ivr','STRING','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x3441,0x14b));var _0x1344=function(_0x1ef726,_0x16fdea){_0x1ef726=_0x1ef726-0x0;var _0x4c3c66=_0x3441[_0x1ef726];return _0x4c3c66;};'use strict';var Sequelize=require(_0x1344('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1344('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1344('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x1344('0x3')},'description':{'type':Sequelize[_0x1344('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1344('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1344('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1344('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1344('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'comment':_0x1344('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1344('0xd')},'dialTimezone':{'type':Sequelize[_0x1344('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1344('0x4')],'defaultValue':_0x1344('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1344('0x2')](_0x1344('0xf'),_0x1344('0x10'),_0x1344('0x11')),'defaultValue':_0x1344('0xf')},'dialAMDActive':{'type':Sequelize[_0x1344('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1344('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1344('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1344('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1344('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1344('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1344('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1344('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1344('0x2')](_0x1344('0x19'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1344('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1344('0x1a')},'dialCutDigit':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1344('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x24')}}; \ No newline at end of file +var _0x56a5=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x3d68cd,_0x466ce4){var _0x4ee014=function(_0xd07499){while(--_0xd07499){_0x3d68cd['push'](_0x3d68cd['shift']());}};_0x4ee014(++_0x466ce4);}(_0x56a5,0xbe));var _0x556a=function(_0x4add14,_0x36ff7e){_0x4add14=_0x4add14-0x0;var _0x27a57c=_0x56a5[_0x4add14];return _0x27a57c;};'use strict';var Sequelize=require(_0x556a('0x0'));module[_0x556a('0x1')]={'name':{'type':Sequelize[_0x556a('0x2')],'unique':_0x556a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x556a('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x556a('0x2')]},'active':{'type':Sequelize[_0x556a('0x5')],'defaultValue':0x0,'comment':_0x556a('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x556a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x556a('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x556a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x556a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x556a('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x556a('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'defaultValue':0x3,'comment':_0x556a('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x556a('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x556a('0x11')},'dialTimezone':{'type':Sequelize[_0x556a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x556a('0x2')],'defaultValue':_0x556a('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x556a('0x13'),_0x556a('0x14'),'onlyIfOpen'),'defaultValue':_0x556a('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x556a('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x556a('0x9')](0x9)[_0x556a('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x556a('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x556a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x556a('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x556a('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x556a('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x556a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x556a('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x556a('0x9')](0x9)[_0x556a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x556a('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x556a('0x9')](0x9)[_0x556a('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x556a('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x556a('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x556a('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x556a('0x9')](0x5)[_0x556a('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x556a('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x556a('0x9')](0x9)[_0x556a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x556a('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x556a('0x1f')]('DESC',_0x556a('0x20')),'defaultValue':_0x556a('0x21')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x556a('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x556a('0x22')},'dialCutDigit':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x556a('0x23')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0x24')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0x25')},'dialDropRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x556a('0x26')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0x27')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)[_0x556a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x556a('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x556a('0x9')](0x3)[_0x556a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x556a('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x556a('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x556a('0x2a')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f36cee3..a72e5aa 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 _0x9c02=['limit','count','set','Content-Range','apply','reject','save','then','destroy','IvrCampaigns','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','update','getHoppers','findOne','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId','cm_hopper_additional_phones','fromQuery','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0xf04221,_0x4c7328){var _0x57a74d=function(_0x5c4187){while(--_0x5c4187){_0xf04221['push'](_0xf04221['shift']());}};_0x57a74d(++_0x4c7328);}(_0x9c02,0x196));var _0x29c0=function(_0x222f1b,_0x3a8cdc){_0x222f1b=_0x222f1b-0x0;var _0x132412=_0x9c02[_0x222f1b];return _0x132412;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require(_0x29c0('0x1'));var zipdir=require(_0x29c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require(_0x29c0('0x4'));var sox=require('sox');var csv=require(_0x29c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require(_0x29c0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29c0('0x9'));var toCsv=require(_0x29c0('0x5'));var querystring=require(_0x29c0('0xa'));var Papa=require(_0x29c0('0xb'));var Redis=require(_0x29c0('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c0('0xe'))(_0x29c0('0xf'));var utils=require(_0x29c0('0x10'));var config=require(_0x29c0('0x11'));var licenseUtil=require(_0x29c0('0x12'));var db=require(_0x29c0('0x13'))['db'];function respondWithStatusCode(_0x5b4ef2,_0x7a6a5e){_0x7a6a5e=_0x7a6a5e||0xcc;return function(_0x350922){if(_0x350922){return _0x5b4ef2[_0x29c0('0x14')](_0x7a6a5e);}return _0x5b4ef2[_0x29c0('0x15')](_0x7a6a5e)[_0x29c0('0x16')]();};}function respondWithResult(_0x28cc02,_0x1e622a){_0x1e622a=_0x1e622a||0xc8;return function(_0x2947da){if(_0x2947da){return _0x28cc02[_0x29c0('0x15')](_0x1e622a)[_0x29c0('0x17')](_0x2947da);}};}function respondWithFilteredResult(_0x4721f0,_0xccb222){return function(_0x235725){if(_0x235725){var _0x1ce122=typeof _0xccb222[_0x29c0('0x18')]===_0x29c0('0x19')&&typeof _0xccb222[_0x29c0('0x1a')]===_0x29c0('0x19');var _0x4309fc=_0x235725[_0x29c0('0x1b')];var _0x627c4c=_0x1ce122?0x0:_0xccb222[_0x29c0('0x18')];var _0x2bfa71=_0x1ce122?_0x235725[_0x29c0('0x1b')]:_0xccb222[_0x29c0('0x18')]+_0xccb222[_0x29c0('0x1a')];var _0x311c9b;if(_0x2bfa71>=_0x4309fc){_0x2bfa71=_0x4309fc;_0x311c9b=0xc8;}else{_0x311c9b=0xce;}_0x4721f0['status'](_0x311c9b);return _0x4721f0[_0x29c0('0x1c')](_0x29c0('0x1d'),_0x627c4c+'-'+_0x2bfa71+'/'+_0x4309fc)[_0x29c0('0x17')](_0x235725);}return null;};}function patchUpdates(_0x3c3eb2){return function(_0x38eab0){try{jsonpatch[_0x29c0('0x1e')](_0x38eab0,_0x3c3eb2,!![]);}catch(_0x54f8f1){return BPromise[_0x29c0('0x1f')](_0x54f8f1);}return _0x38eab0[_0x29c0('0x20')]();};}function saveUpdates(_0x45a6cb,_0x26bf2e){return function(_0x1f962f){if(_0x1f962f){return _0x1f962f['update'](_0x45a6cb)[_0x29c0('0x21')](function(_0x42b082){return _0x42b082;});}return null;};}function removeEntity(_0x5846d0,_0x1114a8){return function(_0x402c54){if(_0x402c54){return _0x402c54[_0x29c0('0x22')]()['then'](function(){var _0x1993a5=_0x402c54['get']({'plain':!![]});var _0x161b39=_0x29c0('0x23');return db['UserProfileResource'][_0x29c0('0x22')]({'where':{'type':_0x161b39,'resourceId':_0x1993a5['id']}})[_0x29c0('0x21')](function(){return _0x402c54;});})[_0x29c0('0x21')](function(){_0x5846d0[_0x29c0('0x15')](0xcc)[_0x29c0('0x16')]();});}};}function handleEntityNotFound(_0x46be76,_0x4d11b3){return function(_0x531c2c){if(!_0x531c2c){_0x46be76['sendStatus'](0x194);}return _0x531c2c;};}function handleError(_0x3a684c,_0x9803d5){_0x9803d5=_0x9803d5||0x1f4;return function(_0x4cdf7c){logger['error'](_0x4cdf7c[_0x29c0('0x24')]);if(_0x4cdf7c[_0x29c0('0x25')]){delete _0x4cdf7c['name'];}_0x3a684c['status'](_0x9803d5)['send'](_0x4cdf7c);};}exports[_0x29c0('0x26')]=function(_0x193e55,_0x322c86){var _0x4edead={},_0x19dd04={},_0x291748={'count':0x0,'rows':[]};var _0x598bc4=_[_0x29c0('0x27')](db[_0x29c0('0x28')][_0x29c0('0x29')],function(_0x188910){return{'name':_0x188910[_0x29c0('0x2a')],'type':_0x188910[_0x29c0('0x2b')][_0x29c0('0x2c')]};});_0x19dd04['model']=_['map'](_0x598bc4,_0x29c0('0x25'));_0x19dd04[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x193e55['query']);_0x19dd04[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x19dd04['model'],_0x19dd04['query']);_0x4edead[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x19dd04[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x4edead[_0x29c0('0x31')]=_0x4edead['attributes'][_0x29c0('0x34')]?_0x4edead['attributes']:_0x19dd04[_0x29c0('0x32')];if(!_0x193e55[_0x29c0('0x2d')][_0x29c0('0x35')]('nolimit')){_0x4edead[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x193e55['query'][_0x29c0('0x1a')]);_0x4edead[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x4edead[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x193e55[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x4edead[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x193e55[_0x29c0('0x2d')],_0x19dd04[_0x29c0('0x2f')]),_0x598bc4);if(_0x193e55[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x4edead[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x4edead[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x598bc4,function(_0x12df6a){if(_0x12df6a[_0x29c0('0x2b')]!==_0x29c0('0x3c')){var _0x5d42f6={};_0x5d42f6[_0x12df6a[_0x29c0('0x25')]]={'$like':'%'+_0x193e55[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x5d42f6;}})});}_0x4edead=_[_0x29c0('0x3b')]({},_0x4edead,_0x193e55[_0x29c0('0x3d')]);var _0x4f1900={'where':_0x4edead[_0x29c0('0x38')]};return db[_0x29c0('0x28')][_0x29c0('0x1b')](_0x4f1900)['then'](function(_0x42d7b9){_0x291748[_0x29c0('0x1b')]=_0x42d7b9;if(_0x193e55['query'][_0x29c0('0x3e')]){_0x4edead['include']=[{'all':!![]}];}return db[_0x29c0('0x28')]['findAll'](_0x4edead);})[_0x29c0('0x21')](function(_0x406a23){_0x291748[_0x29c0('0x3f')]=_0x406a23;return _0x291748;})[_0x29c0('0x21')](respondWithFilteredResult(_0x322c86,_0x4edead))[_0x29c0('0x40')](handleError(_0x322c86,null));};exports[_0x29c0('0x41')]=function(_0x4b1d0d,_0x4a277b){var _0x2dfcb7={'raw':![],'where':{'id':_0x4b1d0d['params']['id']}},_0x44bb0d={};_0x44bb0d[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db[_0x29c0('0x28')][_0x29c0('0x29')]);_0x44bb0d[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x4b1d0d[_0x29c0('0x2d')]);_0x44bb0d[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x44bb0d[_0x29c0('0x32')],_0x44bb0d[_0x29c0('0x2d')]);_0x2dfcb7[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x44bb0d[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x4b1d0d[_0x29c0('0x2d')]['fields']));_0x2dfcb7[_0x29c0('0x31')]=_0x2dfcb7[_0x29c0('0x31')]['length']?_0x2dfcb7[_0x29c0('0x31')]:_0x44bb0d[_0x29c0('0x32')];if(_0x4b1d0d['query'][_0x29c0('0x3e')]){_0x2dfcb7['include']=[{'all':!![]}];}_0x2dfcb7=_[_0x29c0('0x3b')]({},_0x2dfcb7,_0x4b1d0d['options']);return db[_0x29c0('0x28')][_0x29c0('0x42')](_0x2dfcb7)[_0x29c0('0x21')](handleEntityNotFound(_0x4a277b,null))['then'](respondWithResult(_0x4a277b,null))[_0x29c0('0x40')](handleError(_0x4a277b,null));};exports['create']=function(_0x3e1386,_0x4bc495){return db[_0x29c0('0x28')][_0x29c0('0x43')](_0x3e1386[_0x29c0('0x44')],{})[_0x29c0('0x21')](function(_0x55b2b3){var _0x53edae=_0x3e1386[_0x29c0('0x45')][_0x29c0('0x46')]({'plain':!![]});if(!_0x53edae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53edae[_0x29c0('0x47')]===_0x29c0('0x45')){var _0x32e3ca=_0x55b2b3[_0x29c0('0x46')]({'plain':!![]});var _0x1d2578=_0x29c0('0x23');return db['UserProfileSection'][_0x29c0('0x42')]({'where':{'name':_0x1d2578,'userProfileId':_0x53edae[_0x29c0('0x48')]},'raw':!![]})['then'](function(_0x473072){if(_0x473072&&_0x473072[_0x29c0('0x49')]===0x0){return db['UserProfileResource'][_0x29c0('0x43')]({'name':_0x32e3ca['name'],'resourceId':_0x32e3ca['id'],'type':_0x473072['name'],'sectionId':_0x473072['id']},{})[_0x29c0('0x21')](function(){return _0x55b2b3;});}else{return _0x55b2b3;}})['catch'](function(_0x271709){logger[_0x29c0('0x4a')](_0x29c0('0x4b'),_0x271709);throw _0x271709;});}return _0x55b2b3;})[_0x29c0('0x21')](respondWithResult(_0x4bc495,0xc9))[_0x29c0('0x40')](handleError(_0x4bc495,null));};exports['clone']=function(_0x4f3d30,_0x2e3f93){var _0x4bfdb6={'where':{'id':_0x4f3d30[_0x29c0('0x4c')]['id']}},_0x36afb={};_0x36afb['model']=_[_0x29c0('0x2e')](db['Campaign'][_0x29c0('0x29')]);_0x4bfdb6['attributes']=_[_0x29c0('0x30')](_0x36afb[_0x29c0('0x32')],qs['fields'](_0x4f3d30['query']['fields']));_0x4bfdb6[_0x29c0('0x31')]=_0x4bfdb6[_0x29c0('0x31')]['length']?_0x4bfdb6['attributes']:_0x36afb[_0x29c0('0x32')];if(_0x4f3d30[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x4bfdb6[_0x29c0('0x4d')]=[{'all':!![]}];}_0x4bfdb6=_[_0x29c0('0x3b')]({},_0x4bfdb6,_0x4f3d30['options']);return db[_0x29c0('0x28')]['find'](_0x4bfdb6)[_0x29c0('0x21')](handleEntityNotFound(_0x2e3f93,null))[_0x29c0('0x21')](function(_0x203641){if(_0x203641){var _0x8bd093=_0x203641[_0x29c0('0x46')]({'plain':!![]});_0x8bd093=qs[_0x29c0('0x4e')](_0x8bd093,['id',_0x29c0('0x4f'),_0x29c0('0x50')]);_0x4f3d30[_0x29c0('0x44')]=_['omit'](_0x4f3d30['body'],['id',_0x29c0('0x4f'),_0x29c0('0x50')]);return db[_0x29c0('0x28')][_0x29c0('0x43')](_['merge'](_0x8bd093,_0x4f3d30['body']),{'include':_0x4f3d30[_0x29c0('0x2d')][_0x29c0('0x3e')]?[{'all':!![]}]:undefined})[_0x29c0('0x21')](function(_0x5a393d){var _0x4fc1bc=_0x4f3d30[_0x29c0('0x45')]['get']({'plain':!![]});if(!_0x4fc1bc)throw new Error(_0x29c0('0x51'));if(_0x4fc1bc[_0x29c0('0x47')]===_0x29c0('0x45')){var _0x2afda9=_0x5a393d[_0x29c0('0x46')]({'plain':!![]});var _0x1fecd8=_0x29c0('0x23');return db[_0x29c0('0x52')]['find']({'where':{'name':_0x1fecd8,'userProfileId':_0x4fc1bc[_0x29c0('0x48')]},'raw':!![]})['then'](function(_0x18f619){if(_0x18f619&&_0x18f619[_0x29c0('0x49')]===0x0){return db[_0x29c0('0x53')][_0x29c0('0x43')]({'name':_0x2afda9[_0x29c0('0x25')],'resourceId':_0x2afda9['id'],'type':_0x18f619[_0x29c0('0x25')],'sectionId':_0x18f619['id']},{})[_0x29c0('0x21')](function(){return _0x5a393d;});}else{return _0x5a393d;}})[_0x29c0('0x40')](function(_0x1a686f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a686f);throw _0x1a686f;});}return _0x5a393d;});}})[_0x29c0('0x21')](respondWithResult(_0x2e3f93,0xc9))[_0x29c0('0x40')](handleError(_0x2e3f93,null));};exports[_0x29c0('0x54')]=function(_0x28c970,_0x2006fd){if(_0x28c970[_0x29c0('0x44')]['id']){delete _0x28c970['body']['id'];}return db['Campaign'][_0x29c0('0x42')]({'where':{'id':_0x28c970['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x2006fd,null))['then'](saveUpdates(_0x28c970['body'],null))[_0x29c0('0x21')](respondWithResult(_0x2006fd,null))['catch'](handleError(_0x2006fd,null));};exports[_0x29c0('0x22')]=function(_0x4465b9,_0x19ef14){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x4465b9['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x19ef14,null))[_0x29c0('0x21')](removeEntity(_0x19ef14,null))[_0x29c0('0x40')](handleError(_0x19ef14,null));};exports[_0x29c0('0x55')]=function(_0x28fb45,_0x1acd75,_0x146a41){var _0x1001e1={'raw':!![],'where':{}};var _0x1adafe={};var _0x15eabe={'count':0x0,'rows':[]};return db['Campaign'][_0x29c0('0x56')]({'where':{'id':_0x28fb45[_0x29c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1acd75,null))[_0x29c0('0x21')](function(_0x1ab96a){if(_0x1ab96a){_0x1adafe['model']=_[_0x29c0('0x2e')](db['CmHopper']['rawAttributes']);_0x1adafe['query']=_[_0x29c0('0x2e')](_0x28fb45[_0x29c0('0x2d')]);_0x1adafe['filters']=_[_0x29c0('0x30')](_0x1adafe['model'],_0x1adafe[_0x29c0('0x2d')]);_0x1001e1[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x1adafe[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x1001e1[_0x29c0('0x31')]=_0x1001e1[_0x29c0('0x31')][_0x29c0('0x34')]?_0x1001e1[_0x29c0('0x31')]:_0x1adafe[_0x29c0('0x32')];if(!_0x28fb45['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x1001e1[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x1001e1[_0x29c0('0x18')]=qs['offset'](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x1001e1[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x1001e1['where']=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x28fb45['query'],_0x1adafe[_0x29c0('0x2f')]));_0x1001e1[_0x29c0('0x38')][_0x29c0('0x58')]=_0x1ab96a['id'];if(_0x28fb45[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x1001e1[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x1001e1[_0x29c0('0x38')],{'$or':_['map'](_0x1001e1['attributes'],function(_0x5d4097){var _0x23d4a6={};_0x23d4a6[_0x5d4097]={'$like':'%'+_0x28fb45['query']['filter']+'%'};return _0x23d4a6;})});}_0x1001e1=_['merge']({},_0x1001e1,_0x28fb45['options']);return db['CmHopper'][_0x29c0('0x1b')]({'where':_0x1001e1['where']})[_0x29c0('0x21')](function(_0xa45593){_0x15eabe[_0x29c0('0x1b')]=_0xa45593;if(_0x28fb45['query'][_0x29c0('0x3e')]){_0x1001e1['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1001e1);})[_0x29c0('0x21')](function(_0x43bad4){_0x15eabe[_0x29c0('0x3f')]=_0x43bad4;return _0x15eabe;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x1acd75,_0x1001e1))[_0x29c0('0x40')](handleError(_0x1acd75,null));};exports[_0x29c0('0x59')]=function(_0x483427,_0x7920d5,_0x237359){var _0x5ce488={'raw':!![],'where':{}};var _0x244a09={};var _0x212940={'count':0x0,'rows':[]};return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x483427[_0x29c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7920d5,null))[_0x29c0('0x21')](function(_0x1941ba){if(_0x1941ba){_0x244a09[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['CmHopperHistory'][_0x29c0('0x29')]);_0x244a09[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x483427['query']);_0x244a09['filters']=_[_0x29c0('0x30')](_0x244a09[_0x29c0('0x32')],_0x244a09[_0x29c0('0x2d')]);_0x5ce488[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x244a09[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x5ce488['attributes']=_0x5ce488['attributes'][_0x29c0('0x34')]?_0x5ce488[_0x29c0('0x31')]:_0x244a09[_0x29c0('0x32')];if(!_0x483427[_0x29c0('0x2d')][_0x29c0('0x35')](_0x29c0('0x57'))){_0x5ce488[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x5ce488['offset']=qs[_0x29c0('0x18')](_0x483427[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x5ce488['order']=qs['sort'](_0x483427[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5ce488['where']=qs['filters'](_[_0x29c0('0x39')](_0x483427[_0x29c0('0x2d')],_0x244a09[_0x29c0('0x2f')]));_0x5ce488[_0x29c0('0x38')][_0x29c0('0x58')]=_0x1941ba['id'];if(_0x483427['query'][_0x29c0('0x3a')]){_0x5ce488['where']=_[_0x29c0('0x3b')](_0x5ce488[_0x29c0('0x38')],{'$or':_['map'](_0x5ce488[_0x29c0('0x31')],function(_0x28e32e){var _0x95cb56={};_0x95cb56[_0x28e32e]={'$like':'%'+_0x483427[_0x29c0('0x2d')]['filter']+'%'};return _0x95cb56;})});}_0x5ce488=_['merge']({},_0x5ce488,_0x483427[_0x29c0('0x3d')]);return db[_0x29c0('0x5a')][_0x29c0('0x1b')]({'where':_0x5ce488[_0x29c0('0x38')]})[_0x29c0('0x21')](function(_0x308170){_0x212940['count']=_0x308170;if(_0x483427['query'][_0x29c0('0x3e')]){_0x5ce488[_0x29c0('0x4d')]=[{'all':!![]}];}return db[_0x29c0('0x5a')]['findAll'](_0x5ce488);})[_0x29c0('0x21')](function(_0x432035){_0x212940[_0x29c0('0x3f')]=_0x432035;return _0x212940;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x7920d5,_0x5ce488))[_0x29c0('0x40')](handleError(_0x7920d5,null));};exports[_0x29c0('0x5b')]=function(_0x1a68a2,_0x44d789,_0x2082c1){var _0x2350c7={'raw':!![],'where':{}};var _0x4486ab={};var _0x25bcad={'count':0x0,'rows':[]};return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x1a68a2[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x44d789,null))['then'](function(_0x4c531a){if(_0x4c531a){_0x4486ab[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['CmHopperFinal'][_0x29c0('0x29')]);_0x4486ab['query']=_[_0x29c0('0x2e')](_0x1a68a2[_0x29c0('0x2d')]);_0x4486ab[_0x29c0('0x2f')]=_['intersection'](_0x4486ab['model'],_0x4486ab[_0x29c0('0x2d')]);_0x2350c7['attributes']=_[_0x29c0('0x30')](_0x4486ab[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x2350c7[_0x29c0('0x31')]=_0x2350c7['attributes']['length']?_0x2350c7['attributes']:_0x4486ab['model'];if(!_0x1a68a2['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x2350c7[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x2350c7[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x1a68a2[_0x29c0('0x2d')]['offset']);}_0x2350c7['order']=qs[_0x29c0('0x37')](_0x1a68a2['query'][_0x29c0('0x37')]);_0x2350c7[_0x29c0('0x38')]=qs['filters'](_[_0x29c0('0x39')](_0x1a68a2['query'],_0x4486ab[_0x29c0('0x2f')]));_0x2350c7[_0x29c0('0x38')][_0x29c0('0x58')]=_0x4c531a['id'];if(_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x2350c7[_0x29c0('0x38')]=_['merge'](_0x2350c7[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x2350c7[_0x29c0('0x31')],function(_0x57b098){var _0x2dd8f6={};_0x2dd8f6[_0x57b098]={'$like':'%'+_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x2dd8f6;})});}_0x2350c7=_['merge']({},_0x2350c7,_0x1a68a2[_0x29c0('0x3d')]);return db[_0x29c0('0x5c')]['count']({'where':_0x2350c7['where']})[_0x29c0('0x21')](function(_0x22a01a){_0x25bcad[_0x29c0('0x1b')]=_0x22a01a;if(_0x1a68a2[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x2350c7[_0x29c0('0x4d')]=[{'all':!![]}];}return db[_0x29c0('0x5c')][_0x29c0('0x5d')](_0x2350c7);})['then'](function(_0x7e3d54){_0x25bcad['rows']=_0x7e3d54;return _0x25bcad;});}})['then'](respondWithFilteredResult(_0x44d789,_0x2350c7))[_0x29c0('0x40')](handleError(_0x44d789,null));};exports[_0x29c0('0x5e')]=function(_0x29f492,_0x220aa1,_0xfb92a3){var _0x5c6383={'raw':!![],'where':{}};var _0x23f63e={};var _0x4e8b5f={'count':0x0,'rows':[]};return db[_0x29c0('0x28')]['findOne']({'where':{'id':_0x29f492[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x220aa1,null))['then'](function(_0x355c5c){if(_0x355c5c){_0x23f63e[_0x29c0('0x32')]=_[_0x29c0('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x23f63e[_0x29c0('0x2d')]=_['keys'](_0x29f492[_0x29c0('0x2d')]);_0x23f63e[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x23f63e[_0x29c0('0x32')],_0x23f63e[_0x29c0('0x2d')]);_0x5c6383[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x23f63e[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x29f492[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x5c6383[_0x29c0('0x31')]=_0x5c6383[_0x29c0('0x31')][_0x29c0('0x34')]?_0x5c6383['attributes']:_0x23f63e[_0x29c0('0x32')];if(!_0x29f492['query']['hasOwnProperty'](_0x29c0('0x57'))){_0x5c6383[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x29f492['query']['limit']);_0x5c6383[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x29f492[_0x29c0('0x2d')][_0x29c0('0x18')]);}_0x5c6383[_0x29c0('0x36')]=qs[_0x29c0('0x37')](_0x29f492[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5c6383[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x29f492[_0x29c0('0x2d')],_0x23f63e[_0x29c0('0x2f')]));_0x5c6383[_0x29c0('0x38')][_0x29c0('0x58')]=_0x355c5c['id'];if(_0x29f492[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x5c6383['where']=_['merge'](_0x5c6383['where'],{'$or':_['map'](_0x5c6383[_0x29c0('0x31')],function(_0x16d5e4){var _0x427ac8={};_0x427ac8[_0x16d5e4]={'$like':'%'+_0x29f492[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x427ac8;})});}_0x5c6383=_[_0x29c0('0x3b')]({},_0x5c6383,_0x29f492[_0x29c0('0x3d')]);return db[_0x29c0('0x5f')][_0x29c0('0x1b')]({'where':_0x5c6383['where']})['then'](function(_0x52ad1e){_0x4e8b5f[_0x29c0('0x1b')]=_0x52ad1e;if(_0x29f492[_0x29c0('0x2d')][_0x29c0('0x3e')]){_0x5c6383['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x29c0('0x5d')](_0x5c6383);})['then'](function(_0x16ab77){_0x4e8b5f[_0x29c0('0x3f')]=_0x16ab77;return _0x4e8b5f;});}})[_0x29c0('0x21')](respondWithFilteredResult(_0x220aa1,_0x5c6383))[_0x29c0('0x40')](handleError(_0x220aa1,null));};exports['getLists']=function(_0x15abf4,_0x4b94bf,_0x145ce1){var _0x5cbde3={};var _0x30603f={};var _0x5a4272;var _0x22df88;return db['Campaign'][_0x29c0('0x56')]({'where':{'id':_0x15abf4[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x4b94bf,null))[_0x29c0('0x21')](function(_0x1e107d){if(_0x1e107d){_0x5a4272=_0x1e107d;_0x30603f['model']=_['keys'](db[_0x29c0('0x60')][_0x29c0('0x29')]);_0x30603f[_0x29c0('0x2d')]=_[_0x29c0('0x2e')](_0x15abf4[_0x29c0('0x2d')]);_0x30603f['filters']=_[_0x29c0('0x30')](_0x30603f['model'],_0x30603f[_0x29c0('0x2d')]);_0x5cbde3[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x30603f[_0x29c0('0x32')],qs[_0x29c0('0x33')](_0x15abf4[_0x29c0('0x2d')]['fields']));_0x5cbde3['attributes']=_0x5cbde3[_0x29c0('0x31')][_0x29c0('0x34')]?_0x5cbde3[_0x29c0('0x31')]:_0x30603f[_0x29c0('0x32')];_0x5cbde3['order']=qs[_0x29c0('0x37')](_0x15abf4[_0x29c0('0x2d')][_0x29c0('0x37')]);_0x5cbde3[_0x29c0('0x38')]=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x15abf4['query'],_0x30603f[_0x29c0('0x2f')]));if(_0x15abf4[_0x29c0('0x2d')][_0x29c0('0x3a')]){_0x5cbde3[_0x29c0('0x38')]=_[_0x29c0('0x3b')](_0x5cbde3['where'],{'$or':_['map'](_0x5cbde3[_0x29c0('0x31')],function(_0x41ee35){var _0x305e74={};_0x305e74[_0x41ee35]={'$like':'%'+_0x15abf4[_0x29c0('0x2d')]['filter']+'%'};return _0x305e74;})});}_0x5cbde3=_[_0x29c0('0x3b')]({},_0x5cbde3,_0x15abf4['options']);return _0x5a4272[_0x29c0('0x61')](_0x5cbde3);}})[_0x29c0('0x21')](function(_0x3ff7d3){if(_0x3ff7d3){_0x22df88=_0x3ff7d3[_0x29c0('0x34')];if(!_0x15abf4['query'][_0x29c0('0x35')](_0x29c0('0x57'))){_0x5cbde3[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x15abf4['query'][_0x29c0('0x1a')]);_0x5cbde3['offset']=qs[_0x29c0('0x18')](_0x15abf4[_0x29c0('0x2d')][_0x29c0('0x18')]);}return _0x5a4272['getLists'](_0x5cbde3);}})[_0x29c0('0x21')](function(_0x2dc543){if(_0x2dc543){return _0x2dc543?{'count':_0x22df88,'rows':_0x2dc543}:null;}})['then'](respondWithResult(_0x4b94bf,null))[_0x29c0('0x40')](handleError(_0x4b94bf,null));};exports['addLists']=function(_0x3a41e8,_0x5ebedc,_0x4c16af){var _0x399ff2,_0x48829e;var _0x514ec0=[];var _0x27d9d6=moment()['format'](_0x29c0('0x62'));return db[_0x29c0('0x28')]['find']({'where':{'id':_0x3a41e8[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x5ebedc,null))[_0x29c0('0x21')](function(_0x264c9e){if(_0x264c9e){_0x48829e=_0x264c9e;return _0x264c9e['addLists'](_0x3a41e8[_0x29c0('0x44')][_0x29c0('0x63')],_[_0x29c0('0x4e')](_0x3a41e8['body'],['ids','id'])||{});}return null;})['spread'](function(_0x636f97){var _0x258b93;var _0x1f2fd9;_0x399ff2=_0x636f97||[];var _0x8492f4=[];if(_0x636f97){for(var _0x4ae0ea=0x0;_0x4ae0ea<_0x636f97[_0x29c0('0x34')];_0x4ae0ea+=0x1){var _0x17dd7e=_0x636f97[_0x4ae0ea][_0x29c0('0x46')]({'plain':!![]});_0x48829e[_0x29c0('0x64')]=_0x3a41e8[_0x29c0('0x44')]['dialCheckDuplicateType']?_0x3a41e8[_0x29c0('0x44')]['dialCheckDuplicateType']:_0x48829e['dialCheckDuplicateType'];switch(_0x48829e[_0x29c0('0x64')]){case _0x29c0('0x65'):_0x258b93=squel[_0x29c0('0x66')]()[_0x29c0('0x67')](_0x29c0('0x68'))['fromQuery']([_0x29c0('0x69'),'scheduledAt',_0x29c0('0x6a'),'ListId',_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel[_0x29c0('0x6b')]()[_0x29c0('0x6c')]('phone',_0x29c0('0x69'))['field'](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x17dd7e['CmListId'][_0x29c0('0x6f')](),'ListId')['field'](_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27','createdAt')[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x71'))[_0x29c0('0x38')](_0x29c0('0x72'))[_0x29c0('0x38')](_0x29c0('0x73'),_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')]())[_0x29c0('0x38')](_0x29c0('0x75'))['where'](_0x29c0('0x76'),squel['select']()['field'](_0x29c0('0x77'))[_0x29c0('0x70')]('cm_hopper_final')['where'](_0x29c0('0x78'),_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')]()))[_0x29c0('0x38')](_0x29c0('0x76'),squel[_0x29c0('0x6b')]()[_0x29c0('0x6c')](_0x29c0('0x79'))[_0x29c0('0x70')](_0x29c0('0x68'))['where'](_0x29c0('0x78'),_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')]())))[_0x29c0('0x6f')]();break;case'onlyIfOpen':_0x258b93=squel[_0x29c0('0x66')]()['into'](_0x29c0('0x68'))['fromQuery'](['phone','scheduledAt',_0x29c0('0x6a'),_0x29c0('0x7a'),_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel['select']()[_0x29c0('0x6c')](_0x29c0('0x69'),_0x29c0('0x69'))[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x17dd7e['CmListId'][_0x29c0('0x6f')](),_0x29c0('0x7a'))[_0x29c0('0x6c')](_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))['field']('\x27'+_0x27d9d6+'\x27',_0x29c0('0x4f'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x71'))['where'](_0x29c0('0x72'))['where']('ListId\x20=\x20?',_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')]())['where'](_0x29c0('0x75'))[_0x29c0('0x38')](_0x29c0('0x76'),squel['select']()[_0x29c0('0x6c')](_0x29c0('0x79'))[_0x29c0('0x70')](_0x29c0('0x68'))[_0x29c0('0x38')](_0x29c0('0x78'),_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')]())))['toString']();break;default:_0x258b93=squel['insert']()['into'](_0x29c0('0x68'))['fromQuery']([_0x29c0('0x69'),'scheduledAt',_0x29c0('0x6a'),'ListId',_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel[_0x29c0('0x6b')]()['field'](_0x29c0('0x69'),'phone')[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')](),'ListId')[_0x29c0('0x6c')](_0x3a41e8[_0x29c0('0x4c')]['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))['field']('\x27'+_0x27d9d6+'\x27','createdAt')[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27','updatedAt')[_0x29c0('0x70')]('cm_contacts')[_0x29c0('0x38')](_0x29c0('0x72'))[_0x29c0('0x38')](_0x29c0('0x73'),_0x17dd7e[_0x29c0('0x74')][_0x29c0('0x6f')]())['where'](_0x29c0('0x75')))[_0x29c0('0x6f')]();}_0x1f2fd9=squel[_0x29c0('0x66')]()[_0x29c0('0x67')](_0x29c0('0x7b'))[_0x29c0('0x7c')]([_0x29c0('0x7d'),_0x29c0('0x6e'),_0x29c0('0x69'),_0x29c0('0x7e'),_0x29c0('0x4f'),'updatedAt'],squel[_0x29c0('0x6b')]()['field'](_0x29c0('0x7f'),'id')[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x6e'))[_0x29c0('0x6c')](_0x29c0('0x80'),_0x29c0('0x69'))[_0x29c0('0x6c')](_0x29c0('0x81'),_0x29c0('0x7e'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x4f'))[_0x29c0('0x6c')]('\x27'+_0x27d9d6+'\x27',_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x82'),'ci')[_0x29c0('0x83')](_0x29c0('0x68'),'h',_0x29c0('0x84'))[_0x29c0('0x38')](_0x29c0('0x85'),_0x17dd7e[_0x29c0('0x74')]['toString']())[_0x29c0('0x38')]('h.CampaignId=?',_0x3a41e8['params']['id'][_0x29c0('0x6f')]())[_0x29c0('0x38')](_0x29c0('0x86'),_0x27d9d6))[_0x29c0('0x6f')]();_0x8492f4[_0x29c0('0x87')](db['sequelize'][_0x29c0('0x2d')](_0x258b93));_0x514ec0['push'](db[_0x29c0('0x88')][_0x29c0('0x2d')](_0x1f2fd9));}return BPromise[_0x29c0('0x89')](_0x8492f4);}})[_0x29c0('0x21')](function(){return BPromise[_0x29c0('0x89')](_0x514ec0);})['then'](function(){return _0x399ff2;})[_0x29c0('0x21')](respondWithResult(_0x5ebedc,null))['catch'](handleError(_0x5ebedc,null));};exports['removeLists']=function(_0x4d4476,_0x348866,_0x29c329){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x4d4476[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x348866,null))[_0x29c0('0x21')](function(_0x10a565){if(_0x10a565){return _0x10a565[_0x29c0('0x8a')](_0x4d4476[_0x29c0('0x2d')][_0x29c0('0x63')]);}})['then'](function(_0x55b5ed){if(_0x55b5ed){return db['CmHopper'][_0x29c0('0x22')]({'where':{'ListId':_0x4d4476[_0x29c0('0x2d')][_0x29c0('0x63')],'CampaignId':_0x4d4476[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](function(){return _0x55b5ed;});}})[_0x29c0('0x21')](respondWithStatusCode(_0x348866,null))[_0x29c0('0x40')](handleError(_0x348866,null));};exports['getBlackLists']=function(_0x4b634e,_0x281926,_0x51934d){var _0x46c39b={};var _0x164cd4={};var _0x17d7ff;var _0x36259f;return db[_0x29c0('0x28')][_0x29c0('0x56')]({'where':{'id':_0x4b634e['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x281926,null))['then'](function(_0x59b373){if(_0x59b373){_0x17d7ff=_0x59b373;_0x164cd4['model']=_[_0x29c0('0x2e')](db[_0x29c0('0x60')][_0x29c0('0x29')]);_0x164cd4['query']=_[_0x29c0('0x2e')](_0x4b634e[_0x29c0('0x2d')]);_0x164cd4[_0x29c0('0x2f')]=_[_0x29c0('0x30')](_0x164cd4[_0x29c0('0x32')],_0x164cd4[_0x29c0('0x2d')]);_0x46c39b[_0x29c0('0x31')]=_[_0x29c0('0x30')](_0x164cd4[_0x29c0('0x32')],qs['fields'](_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x33')]));_0x46c39b[_0x29c0('0x31')]=_0x46c39b[_0x29c0('0x31')][_0x29c0('0x34')]?_0x46c39b['attributes']:_0x164cd4['model'];_0x46c39b[_0x29c0('0x36')]=qs['sort'](_0x4b634e['query'][_0x29c0('0x37')]);_0x46c39b['where']=qs[_0x29c0('0x2f')](_[_0x29c0('0x39')](_0x4b634e['query'],_0x164cd4[_0x29c0('0x2f')]));if(_0x4b634e['query'][_0x29c0('0x3a')]){_0x46c39b['where']=_[_0x29c0('0x3b')](_0x46c39b[_0x29c0('0x38')],{'$or':_[_0x29c0('0x27')](_0x46c39b[_0x29c0('0x31')],function(_0x4f959f){var _0x21ea05={};_0x21ea05[_0x4f959f]={'$like':'%'+_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x3a')]+'%'};return _0x21ea05;})});}_0x46c39b=_[_0x29c0('0x3b')]({},_0x46c39b,_0x4b634e[_0x29c0('0x3d')]);return _0x17d7ff[_0x29c0('0x8b')](_0x46c39b);}})['then'](function(_0x420713){if(_0x420713){_0x36259f=_0x420713['length'];if(!_0x4b634e['query'][_0x29c0('0x35')]('nolimit')){_0x46c39b[_0x29c0('0x1a')]=qs[_0x29c0('0x1a')](_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x1a')]);_0x46c39b[_0x29c0('0x18')]=qs[_0x29c0('0x18')](_0x4b634e[_0x29c0('0x2d')][_0x29c0('0x18')]);}return _0x17d7ff[_0x29c0('0x8b')](_0x46c39b);}})[_0x29c0('0x21')](function(_0x4c55d7){if(_0x4c55d7){return _0x4c55d7?{'count':_0x36259f,'rows':_0x4c55d7}:null;}})[_0x29c0('0x21')](respondWithResult(_0x281926,null))[_0x29c0('0x40')](handleError(_0x281926,null));};exports[_0x29c0('0x8c')]=function(_0x33120e,_0x41e898,_0x4f5d79){var _0x588549,_0x275617;var _0x3ca521=[];var _0x4f4958=moment()['format'](_0x29c0('0x62'));return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x33120e[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x41e898,null))['then'](function(_0x176631){if(_0x176631){_0x275617=_0x176631;return _0x176631[_0x29c0('0x8c')](_0x33120e[_0x29c0('0x44')]['ids'],_['omit'](_0x33120e[_0x29c0('0x44')],[_0x29c0('0x63'),'id'])||{});}return null;})[_0x29c0('0x8d')](function(_0x28b2f5){var _0xacca6c;var _0x3da0b2;_0x588549=_0x28b2f5||[];var _0x14f2e1=[];if(_0x28b2f5){for(var _0x344d78=0x0;_0x344d78<_0x28b2f5['length'];_0x344d78+=0x1){var _0x2db2fd=_0x28b2f5[_0x344d78]['get']({'plain':!![]});_0xacca6c=squel[_0x29c0('0x66')]()[_0x29c0('0x67')](_0x29c0('0x8e'))[_0x29c0('0x7c')]([_0x29c0('0x69'),'ContactId',_0x29c0('0x7a'),_0x29c0('0x58'),_0x29c0('0x4f'),_0x29c0('0x50')],squel[_0x29c0('0x6b')]()['field'](_0x29c0('0x69'),'phone')[_0x29c0('0x6c')]('id',_0x29c0('0x6a'))[_0x29c0('0x6c')](_0x2db2fd['CmListId'][_0x29c0('0x6f')](),'ListId')['field'](_0x33120e['params']['id'][_0x29c0('0x6f')](),_0x29c0('0x58'))[_0x29c0('0x6c')]('NOW()',_0x29c0('0x4f'))[_0x29c0('0x6c')](_0x29c0('0x6d'),_0x29c0('0x50'))[_0x29c0('0x70')](_0x29c0('0x71'))[_0x29c0('0x38')]('deletedAt\x20IS\x20NULL')['where'](_0x29c0('0x73'),_0x2db2fd[_0x29c0('0x74')][_0x29c0('0x6f')]())[_0x29c0('0x38')](_0x29c0('0x75')))[_0x29c0('0x6f')]();_0x14f2e1[_0x29c0('0x87')](db[_0x29c0('0x88')][_0x29c0('0x2d')](_0xacca6c));}return BPromise[_0x29c0('0x89')](_0x14f2e1);}})['then'](function(){return _0x588549;})[_0x29c0('0x21')](respondWithResult(_0x41e898,null))[_0x29c0('0x40')](handleError(_0x41e898,null));};exports['removeBlackLists']=function(_0x3a4834,_0x2d2152,_0x2d4795){return db[_0x29c0('0x28')][_0x29c0('0x42')]({'where':{'id':_0x3a4834['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x2d2152,null))[_0x29c0('0x21')](function(_0x22e791){if(_0x22e791){return _0x22e791[_0x29c0('0x8f')](_0x3a4834['query'][_0x29c0('0x63')]);}})[_0x29c0('0x21')](function(_0x463fcf){if(_0x463fcf){return db[_0x29c0('0x5f')][_0x29c0('0x22')]({'where':{'ListId':_0x3a4834['query']['ids'],'CampaignId':_0x3a4834[_0x29c0('0x4c')]['id']}})[_0x29c0('0x21')](function(){return _0x463fcf;});}})[_0x29c0('0x21')](respondWithStatusCode(_0x2d2152,null))[_0x29c0('0x40')](handleError(_0x2d2152,null));}; \ No newline at end of file +var _0x89c4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','Campaign','includeAll','include','findAll','rows','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','findOne','CmHopper','nolimit','getHopperHistories','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','field','NOW()','CmListId','toString','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','format','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x89c4,0x82));var _0x489c=function(_0x4342ea,_0x545268){_0x4342ea=_0x4342ea-0x0;var _0x25d361=_0x89c4[_0x4342ea];return _0x25d361;};'use strict';var emlformat=require(_0x489c('0x0'));var rimraf=require(_0x489c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x489c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x489c('0x3'));var Mustache=require(_0x489c('0x4'));var util=require(_0x489c('0x5'));var path=require(_0x489c('0x6'));var sox=require(_0x489c('0x7'));var csv=require(_0x489c('0x8'));var ejs=require(_0x489c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x489c('0xa'));var squel=require(_0x489c('0xb'));var crypto=require(_0x489c('0xc'));var jsforce=require(_0x489c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x489c('0xe'));var Papa=require('papaparse');var Redis=require(_0x489c('0xf'));var authService=require(_0x489c('0x10'));var qs=require(_0x489c('0x11'));var as=require(_0x489c('0x12'));var hardwareService=require(_0x489c('0x13'));var logger=require(_0x489c('0x14'))(_0x489c('0x15'));var utils=require(_0x489c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x489c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdfbcb,_0x4a9f45){_0x4a9f45=_0x4a9f45||0xcc;return function(_0x5340ce){if(_0x5340ce){return _0xfdfbcb[_0x489c('0x18')](_0x4a9f45);}return _0xfdfbcb['status'](_0x4a9f45)[_0x489c('0x19')]();};}function respondWithResult(_0x5d1b10,_0x305e40){_0x305e40=_0x305e40||0xc8;return function(_0x45983e){if(_0x45983e){return _0x5d1b10['status'](_0x305e40)[_0x489c('0x1a')](_0x45983e);}};}function respondWithFilteredResult(_0x39725a,_0x4861e2){return function(_0x4f37c3){if(_0x4f37c3){var _0x1bb98a=typeof _0x4861e2['offset']===_0x489c('0x1b')&&typeof _0x4861e2[_0x489c('0x1c')]===_0x489c('0x1b');var _0x39f9a9=_0x4f37c3[_0x489c('0x1d')];var _0x4519ce=_0x1bb98a?0x0:_0x4861e2[_0x489c('0x1e')];var _0x431782=_0x1bb98a?_0x4f37c3[_0x489c('0x1d')]:_0x4861e2[_0x489c('0x1e')]+_0x4861e2[_0x489c('0x1c')];var _0x19fb45;if(_0x431782>=_0x39f9a9){_0x431782=_0x39f9a9;_0x19fb45=0xc8;}else{_0x19fb45=0xce;}_0x39725a[_0x489c('0x1f')](_0x19fb45);return _0x39725a[_0x489c('0x20')](_0x489c('0x21'),_0x4519ce+'-'+_0x431782+'/'+_0x39f9a9)[_0x489c('0x1a')](_0x4f37c3);}return null;};}function patchUpdates(_0x14677b){return function(_0x381b56){try{jsonpatch['apply'](_0x381b56,_0x14677b,!![]);}catch(_0x4d0e03){return BPromise[_0x489c('0x22')](_0x4d0e03);}return _0x381b56[_0x489c('0x23')]();};}function saveUpdates(_0x1a1b68,_0x18cf8b){return function(_0x5b6ea3){if(_0x5b6ea3){return _0x5b6ea3[_0x489c('0x24')](_0x1a1b68)[_0x489c('0x25')](function(_0x37a59b){return _0x37a59b;});}return null;};}function removeEntity(_0x552384,_0x2a6d5c){return function(_0x1de4bf){if(_0x1de4bf){return _0x1de4bf['destroy']()[_0x489c('0x25')](function(){var _0x7914ad=_0x1de4bf['get']({'plain':!![]});var _0x35db69='IvrCampaigns';return db[_0x489c('0x26')][_0x489c('0x27')]({'where':{'type':_0x35db69,'resourceId':_0x7914ad['id']}})['then'](function(){return _0x1de4bf;});})[_0x489c('0x25')](function(){_0x552384[_0x489c('0x1f')](0xcc)[_0x489c('0x19')]();});}};}function handleEntityNotFound(_0x228c06,_0x5285e4){return function(_0x29c012){if(!_0x29c012){_0x228c06['sendStatus'](0x194);}return _0x29c012;};}function handleError(_0x2ce72c,_0x1f86cb){_0x1f86cb=_0x1f86cb||0x1f4;return function(_0x3b8f79){logger[_0x489c('0x28')](_0x3b8f79[_0x489c('0x29')]);if(_0x3b8f79[_0x489c('0x2a')]){delete _0x3b8f79['name'];}_0x2ce72c[_0x489c('0x1f')](_0x1f86cb)[_0x489c('0x2b')](_0x3b8f79);};}exports['index']=function(_0x445d7d,_0x299fcf){var _0x58b523={},_0x1fe531={},_0x21d1ec={'count':0x0,'rows':[]};var _0x222e1d=_[_0x489c('0x2c')](db['Campaign'][_0x489c('0x2d')],function(_0x335436){return{'name':_0x335436['fieldName'],'type':_0x335436[_0x489c('0x2e')][_0x489c('0x2f')]};});_0x1fe531[_0x489c('0x30')]=_['map'](_0x222e1d,_0x489c('0x2a'));_0x1fe531[_0x489c('0x31')]=_[_0x489c('0x32')](_0x445d7d[_0x489c('0x31')]);_0x1fe531[_0x489c('0x33')]=_[_0x489c('0x34')](_0x1fe531[_0x489c('0x30')],_0x1fe531[_0x489c('0x31')]);_0x58b523['attributes']=_[_0x489c('0x34')](_0x1fe531[_0x489c('0x30')],qs[_0x489c('0x35')](_0x445d7d[_0x489c('0x31')][_0x489c('0x35')]));_0x58b523[_0x489c('0x36')]=_0x58b523[_0x489c('0x36')][_0x489c('0x37')]?_0x58b523[_0x489c('0x36')]:_0x1fe531[_0x489c('0x30')];if(!_0x445d7d['query'][_0x489c('0x38')]('nolimit')){_0x58b523[_0x489c('0x1c')]=qs[_0x489c('0x1c')](_0x445d7d[_0x489c('0x31')][_0x489c('0x1c')]);_0x58b523['offset']=qs[_0x489c('0x1e')](_0x445d7d[_0x489c('0x31')][_0x489c('0x1e')]);}_0x58b523[_0x489c('0x39')]=qs[_0x489c('0x3a')](_0x445d7d[_0x489c('0x31')][_0x489c('0x3a')]);_0x58b523['where']=qs[_0x489c('0x33')](_[_0x489c('0x3b')](_0x445d7d[_0x489c('0x31')],_0x1fe531[_0x489c('0x33')]),_0x222e1d);if(_0x445d7d[_0x489c('0x31')]['filter']){_0x58b523[_0x489c('0x3c')]=_['merge'](_0x58b523[_0x489c('0x3c')],{'$or':_['map'](_0x222e1d,function(_0x410270){if(_0x410270[_0x489c('0x2e')]!==_0x489c('0x3d')){var _0xdcf742={};_0xdcf742[_0x410270[_0x489c('0x2a')]]={'$like':'%'+_0x445d7d[_0x489c('0x31')][_0x489c('0x3e')]+'%'};return _0xdcf742;}})});}_0x58b523=_[_0x489c('0x3f')]({},_0x58b523,_0x445d7d[_0x489c('0x40')]);var _0x44bf35={'where':_0x58b523[_0x489c('0x3c')]};return db[_0x489c('0x41')][_0x489c('0x1d')](_0x44bf35)[_0x489c('0x25')](function(_0x3cccca){_0x21d1ec['count']=_0x3cccca;if(_0x445d7d['query'][_0x489c('0x42')]){_0x58b523[_0x489c('0x43')]=[{'all':!![]}];}return db[_0x489c('0x41')][_0x489c('0x44')](_0x58b523);})['then'](function(_0xea1236){_0x21d1ec[_0x489c('0x45')]=_0xea1236;return _0x21d1ec;})['then'](respondWithFilteredResult(_0x299fcf,_0x58b523))[_0x489c('0x46')](handleError(_0x299fcf,null));};exports['show']=function(_0xc8ded3,_0x5d6692){var _0x2ddf07={'raw':![],'where':{'id':_0xc8ded3[_0x489c('0x47')]['id']}},_0xe374e4={};_0xe374e4[_0x489c('0x30')]=_[_0x489c('0x32')](db[_0x489c('0x41')][_0x489c('0x2d')]);_0xe374e4[_0x489c('0x31')]=_[_0x489c('0x32')](_0xc8ded3[_0x489c('0x31')]);_0xe374e4[_0x489c('0x33')]=_[_0x489c('0x34')](_0xe374e4[_0x489c('0x30')],_0xe374e4[_0x489c('0x31')]);_0x2ddf07[_0x489c('0x36')]=_[_0x489c('0x34')](_0xe374e4[_0x489c('0x30')],qs[_0x489c('0x35')](_0xc8ded3['query'][_0x489c('0x35')]));_0x2ddf07['attributes']=_0x2ddf07[_0x489c('0x36')][_0x489c('0x37')]?_0x2ddf07['attributes']:_0xe374e4[_0x489c('0x30')];if(_0xc8ded3[_0x489c('0x31')][_0x489c('0x42')]){_0x2ddf07['include']=[{'all':!![]}];}_0x2ddf07=_['merge']({},_0x2ddf07,_0xc8ded3[_0x489c('0x40')]);return db[_0x489c('0x41')]['find'](_0x2ddf07)[_0x489c('0x25')](handleEntityNotFound(_0x5d6692,null))[_0x489c('0x25')](respondWithResult(_0x5d6692,null))[_0x489c('0x46')](handleError(_0x5d6692,null));};exports[_0x489c('0x48')]=function(_0x1d4466,_0x81bc95){return db[_0x489c('0x41')][_0x489c('0x48')](_0x1d4466[_0x489c('0x49')],{})[_0x489c('0x25')](function(_0x187ae7){var _0x33ccfc=_0x1d4466[_0x489c('0x4a')][_0x489c('0x4b')]({'plain':!![]});if(!_0x33ccfc)throw new Error(_0x489c('0x4c'));if(_0x33ccfc[_0x489c('0x4d')]===_0x489c('0x4a')){var _0x547926=_0x187ae7[_0x489c('0x4b')]({'plain':!![]});var _0x26c013=_0x489c('0x4e');return db['UserProfileSection'][_0x489c('0x4f')]({'where':{'name':_0x26c013,'userProfileId':_0x33ccfc[_0x489c('0x50')]},'raw':!![]})[_0x489c('0x25')](function(_0x553b4e){if(_0x553b4e&&_0x553b4e['autoAssociation']===0x0){return db[_0x489c('0x26')][_0x489c('0x48')]({'name':_0x547926[_0x489c('0x2a')],'resourceId':_0x547926['id'],'type':_0x553b4e[_0x489c('0x2a')],'sectionId':_0x553b4e['id']},{})['then'](function(){return _0x187ae7;});}else{return _0x187ae7;}})[_0x489c('0x46')](function(_0x216f54){logger['error'](_0x489c('0x51'),_0x216f54);throw _0x216f54;});}return _0x187ae7;})['then'](respondWithResult(_0x81bc95,0xc9))['catch'](handleError(_0x81bc95,null));};exports[_0x489c('0x52')]=function(_0x219d1f,_0x3afdb3){var _0x103208={'where':{'id':_0x219d1f[_0x489c('0x47')]['id']}},_0x37cd8b={};_0x37cd8b[_0x489c('0x30')]=_[_0x489c('0x32')](db[_0x489c('0x41')][_0x489c('0x2d')]);_0x103208[_0x489c('0x36')]=_[_0x489c('0x34')](_0x37cd8b['model'],qs[_0x489c('0x35')](_0x219d1f[_0x489c('0x31')][_0x489c('0x35')]));_0x103208['attributes']=_0x103208[_0x489c('0x36')]['length']?_0x103208['attributes']:_0x37cd8b[_0x489c('0x30')];if(_0x219d1f[_0x489c('0x31')][_0x489c('0x42')]){_0x103208[_0x489c('0x43')]=[{'all':!![]}];}_0x103208=_[_0x489c('0x3f')]({},_0x103208,_0x219d1f[_0x489c('0x40')]);return db[_0x489c('0x41')][_0x489c('0x4f')](_0x103208)[_0x489c('0x25')](handleEntityNotFound(_0x3afdb3,null))[_0x489c('0x25')](function(_0x586e4b){if(_0x586e4b){var _0x3e407a=_0x586e4b[_0x489c('0x4b')]({'plain':!![]});_0x3e407a=qs[_0x489c('0x53')](_0x3e407a,['id','createdAt','updatedAt']);_0x219d1f['body']=_[_0x489c('0x53')](_0x219d1f[_0x489c('0x49')],['id',_0x489c('0x54'),_0x489c('0x55')]);return db[_0x489c('0x41')][_0x489c('0x48')](_[_0x489c('0x3f')](_0x3e407a,_0x219d1f['body']),{'include':_0x219d1f[_0x489c('0x31')][_0x489c('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x511974){var _0x75bfbb=_0x219d1f[_0x489c('0x4a')][_0x489c('0x4b')]({'plain':!![]});if(!_0x75bfbb)throw new Error(_0x489c('0x4c'));if(_0x75bfbb['role']==='user'){var _0x3af689=_0x511974['get']({'plain':!![]});var _0x394114=_0x489c('0x4e');return db[_0x489c('0x56')][_0x489c('0x4f')]({'where':{'name':_0x394114,'userProfileId':_0x75bfbb['userProfileId']},'raw':!![]})['then'](function(_0x256c94){if(_0x256c94&&_0x256c94['autoAssociation']===0x0){return db[_0x489c('0x26')][_0x489c('0x48')]({'name':_0x3af689[_0x489c('0x2a')],'resourceId':_0x3af689['id'],'type':_0x256c94[_0x489c('0x2a')],'sectionId':_0x256c94['id']},{})[_0x489c('0x25')](function(){return _0x511974;});}else{return _0x511974;}})[_0x489c('0x46')](function(_0x267bc0){logger[_0x489c('0x28')](_0x489c('0x51'),_0x267bc0);throw _0x267bc0;});}return _0x511974;});}})[_0x489c('0x25')](respondWithResult(_0x3afdb3,0xc9))[_0x489c('0x46')](handleError(_0x3afdb3,null));};exports['update']=function(_0x3cf07f,_0x5de80c){if(_0x3cf07f[_0x489c('0x49')]['id']){delete _0x3cf07f[_0x489c('0x49')]['id'];}return db['Campaign'][_0x489c('0x4f')]({'where':{'id':_0x3cf07f[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x5de80c,null))['then'](saveUpdates(_0x3cf07f[_0x489c('0x49')],null))['then'](respondWithResult(_0x5de80c,null))[_0x489c('0x46')](handleError(_0x5de80c,null));};exports['destroy']=function(_0x524c49,_0x233ef4){return db[_0x489c('0x41')][_0x489c('0x4f')]({'where':{'id':_0x524c49[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x233ef4,null))['then'](removeEntity(_0x233ef4,null))[_0x489c('0x46')](handleError(_0x233ef4,null));};exports['getHoppers']=function(_0x5f14e4,_0x561876,_0x433df1){var _0x429870={'raw':!![],'where':{}};var _0x5968cf={};var _0x250eb9={'count':0x0,'rows':[]};return db[_0x489c('0x41')][_0x489c('0x57')]({'where':{'id':_0x5f14e4[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x561876,null))[_0x489c('0x25')](function(_0x2458e4){if(_0x2458e4){_0x5968cf[_0x489c('0x30')]=_['keys'](db[_0x489c('0x58')]['rawAttributes']);_0x5968cf[_0x489c('0x31')]=_['keys'](_0x5f14e4[_0x489c('0x31')]);_0x5968cf[_0x489c('0x33')]=_['intersection'](_0x5968cf['model'],_0x5968cf[_0x489c('0x31')]);_0x429870[_0x489c('0x36')]=_['intersection'](_0x5968cf[_0x489c('0x30')],qs[_0x489c('0x35')](_0x5f14e4[_0x489c('0x31')][_0x489c('0x35')]));_0x429870[_0x489c('0x36')]=_0x429870[_0x489c('0x36')]['length']?_0x429870[_0x489c('0x36')]:_0x5968cf[_0x489c('0x30')];if(!_0x5f14e4['query'][_0x489c('0x38')](_0x489c('0x59'))){_0x429870[_0x489c('0x1c')]=qs['limit'](_0x5f14e4[_0x489c('0x31')][_0x489c('0x1c')]);_0x429870[_0x489c('0x1e')]=qs[_0x489c('0x1e')](_0x5f14e4['query'][_0x489c('0x1e')]);}_0x429870['order']=qs[_0x489c('0x3a')](_0x5f14e4[_0x489c('0x31')]['sort']);_0x429870[_0x489c('0x3c')]=qs[_0x489c('0x33')](_['pick'](_0x5f14e4[_0x489c('0x31')],_0x5968cf[_0x489c('0x33')]));_0x429870[_0x489c('0x3c')]['CampaignId']=_0x2458e4['id'];if(_0x5f14e4[_0x489c('0x31')][_0x489c('0x3e')]){_0x429870['where']=_[_0x489c('0x3f')](_0x429870[_0x489c('0x3c')],{'$or':_[_0x489c('0x2c')](_0x429870[_0x489c('0x36')],function(_0x2b483b){var _0x5edf54={};_0x5edf54[_0x2b483b]={'$like':'%'+_0x5f14e4['query']['filter']+'%'};return _0x5edf54;})});}_0x429870=_[_0x489c('0x3f')]({},_0x429870,_0x5f14e4['options']);return db[_0x489c('0x58')][_0x489c('0x1d')]({'where':_0x429870[_0x489c('0x3c')]})['then'](function(_0x5160b1){_0x250eb9[_0x489c('0x1d')]=_0x5160b1;if(_0x5f14e4[_0x489c('0x31')]['includeAll']){_0x429870[_0x489c('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x429870);})[_0x489c('0x25')](function(_0x2a673c){_0x250eb9[_0x489c('0x45')]=_0x2a673c;return _0x250eb9;});}})[_0x489c('0x25')](respondWithFilteredResult(_0x561876,_0x429870))[_0x489c('0x46')](handleError(_0x561876,null));};exports[_0x489c('0x5a')]=function(_0x3a0740,_0x1e2ed1,_0x27ea92){var _0x2b6831={'raw':!![],'where':{}};var _0x589a4c={};var _0x4a0b72={'count':0x0,'rows':[]};return db['Campaign'][_0x489c('0x57')]({'where':{'id':_0x3a0740[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x1e2ed1,null))['then'](function(_0x3e9629){if(_0x3e9629){_0x589a4c[_0x489c('0x30')]=_[_0x489c('0x32')](db['CmHopperHistory'][_0x489c('0x2d')]);_0x589a4c['query']=_[_0x489c('0x32')](_0x3a0740[_0x489c('0x31')]);_0x589a4c[_0x489c('0x33')]=_[_0x489c('0x34')](_0x589a4c[_0x489c('0x30')],_0x589a4c[_0x489c('0x31')]);_0x2b6831['attributes']=_['intersection'](_0x589a4c[_0x489c('0x30')],qs[_0x489c('0x35')](_0x3a0740[_0x489c('0x31')][_0x489c('0x35')]));_0x2b6831['attributes']=_0x2b6831[_0x489c('0x36')][_0x489c('0x37')]?_0x2b6831['attributes']:_0x589a4c[_0x489c('0x30')];if(!_0x3a0740[_0x489c('0x31')][_0x489c('0x38')]('nolimit')){_0x2b6831['limit']=qs['limit'](_0x3a0740[_0x489c('0x31')][_0x489c('0x1c')]);_0x2b6831[_0x489c('0x1e')]=qs[_0x489c('0x1e')](_0x3a0740[_0x489c('0x31')][_0x489c('0x1e')]);}_0x2b6831[_0x489c('0x39')]=qs[_0x489c('0x3a')](_0x3a0740[_0x489c('0x31')]['sort']);_0x2b6831[_0x489c('0x3c')]=qs[_0x489c('0x33')](_[_0x489c('0x3b')](_0x3a0740[_0x489c('0x31')],_0x589a4c[_0x489c('0x33')]));_0x2b6831[_0x489c('0x3c')][_0x489c('0x5b')]=_0x3e9629['id'];if(_0x3a0740[_0x489c('0x31')][_0x489c('0x3e')]){_0x2b6831['where']=_['merge'](_0x2b6831['where'],{'$or':_['map'](_0x2b6831['attributes'],function(_0x402494){var _0x4e0df0={};_0x4e0df0[_0x402494]={'$like':'%'+_0x3a0740[_0x489c('0x31')]['filter']+'%'};return _0x4e0df0;})});}_0x2b6831=_['merge']({},_0x2b6831,_0x3a0740[_0x489c('0x40')]);return db[_0x489c('0x5c')][_0x489c('0x1d')]({'where':_0x2b6831[_0x489c('0x3c')]})[_0x489c('0x25')](function(_0x4300be){_0x4a0b72[_0x489c('0x1d')]=_0x4300be;if(_0x3a0740[_0x489c('0x31')]['includeAll']){_0x2b6831[_0x489c('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x489c('0x44')](_0x2b6831);})[_0x489c('0x25')](function(_0x327c8d){_0x4a0b72[_0x489c('0x45')]=_0x327c8d;return _0x4a0b72;});}})[_0x489c('0x25')](respondWithFilteredResult(_0x1e2ed1,_0x2b6831))[_0x489c('0x46')](handleError(_0x1e2ed1,null));};exports[_0x489c('0x5d')]=function(_0x20e2a8,_0x23d90b,_0x16401d){var _0x3ee9cc={'raw':!![],'where':{}};var _0xc3ca29={};var _0x46e245={'count':0x0,'rows':[]};return db[_0x489c('0x41')]['findOne']({'where':{'id':_0x20e2a8[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x23d90b,null))[_0x489c('0x25')](function(_0x5cc38a){if(_0x5cc38a){_0xc3ca29['model']=_[_0x489c('0x32')](db['CmHopperFinal'][_0x489c('0x2d')]);_0xc3ca29['query']=_[_0x489c('0x32')](_0x20e2a8[_0x489c('0x31')]);_0xc3ca29[_0x489c('0x33')]=_[_0x489c('0x34')](_0xc3ca29[_0x489c('0x30')],_0xc3ca29[_0x489c('0x31')]);_0x3ee9cc[_0x489c('0x36')]=_[_0x489c('0x34')](_0xc3ca29['model'],qs[_0x489c('0x35')](_0x20e2a8[_0x489c('0x31')]['fields']));_0x3ee9cc[_0x489c('0x36')]=_0x3ee9cc[_0x489c('0x36')]['length']?_0x3ee9cc[_0x489c('0x36')]:_0xc3ca29[_0x489c('0x30')];if(!_0x20e2a8[_0x489c('0x31')][_0x489c('0x38')](_0x489c('0x59'))){_0x3ee9cc[_0x489c('0x1c')]=qs['limit'](_0x20e2a8['query'][_0x489c('0x1c')]);_0x3ee9cc[_0x489c('0x1e')]=qs[_0x489c('0x1e')](_0x20e2a8[_0x489c('0x31')][_0x489c('0x1e')]);}_0x3ee9cc[_0x489c('0x39')]=qs['sort'](_0x20e2a8['query'][_0x489c('0x3a')]);_0x3ee9cc[_0x489c('0x3c')]=qs[_0x489c('0x33')](_['pick'](_0x20e2a8[_0x489c('0x31')],_0xc3ca29[_0x489c('0x33')]));_0x3ee9cc[_0x489c('0x3c')]['CampaignId']=_0x5cc38a['id'];if(_0x20e2a8['query'][_0x489c('0x3e')]){_0x3ee9cc[_0x489c('0x3c')]=_[_0x489c('0x3f')](_0x3ee9cc[_0x489c('0x3c')],{'$or':_[_0x489c('0x2c')](_0x3ee9cc['attributes'],function(_0x3819ce){var _0x1ff2d2={};_0x1ff2d2[_0x3819ce]={'$like':'%'+_0x20e2a8[_0x489c('0x31')]['filter']+'%'};return _0x1ff2d2;})});}_0x3ee9cc=_[_0x489c('0x3f')]({},_0x3ee9cc,_0x20e2a8[_0x489c('0x40')]);return db[_0x489c('0x5e')]['count']({'where':_0x3ee9cc[_0x489c('0x3c')]})[_0x489c('0x25')](function(_0x273e41){_0x46e245[_0x489c('0x1d')]=_0x273e41;if(_0x20e2a8[_0x489c('0x31')][_0x489c('0x42')]){_0x3ee9cc[_0x489c('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x489c('0x44')](_0x3ee9cc);})['then'](function(_0x32a8b4){_0x46e245[_0x489c('0x45')]=_0x32a8b4;return _0x46e245;});}})['then'](respondWithFilteredResult(_0x23d90b,_0x3ee9cc))['catch'](handleError(_0x23d90b,null));};exports[_0x489c('0x5f')]=function(_0x262ee8,_0xc3ae02,_0x4672ea){var _0x24606d={'raw':!![],'where':{}};var _0x3be36={};var _0x13b52e={'count':0x0,'rows':[]};return db[_0x489c('0x41')][_0x489c('0x57')]({'where':{'id':_0x262ee8[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0xc3ae02,null))['then'](function(_0x28c651){if(_0x28c651){_0x3be36['model']=_[_0x489c('0x32')](db['CmHopperBlack']['rawAttributes']);_0x3be36[_0x489c('0x31')]=_[_0x489c('0x32')](_0x262ee8['query']);_0x3be36[_0x489c('0x33')]=_[_0x489c('0x34')](_0x3be36[_0x489c('0x30')],_0x3be36[_0x489c('0x31')]);_0x24606d[_0x489c('0x36')]=_['intersection'](_0x3be36[_0x489c('0x30')],qs['fields'](_0x262ee8[_0x489c('0x31')][_0x489c('0x35')]));_0x24606d[_0x489c('0x36')]=_0x24606d[_0x489c('0x36')]['length']?_0x24606d[_0x489c('0x36')]:_0x3be36[_0x489c('0x30')];if(!_0x262ee8[_0x489c('0x31')]['hasOwnProperty'](_0x489c('0x59'))){_0x24606d['limit']=qs[_0x489c('0x1c')](_0x262ee8[_0x489c('0x31')][_0x489c('0x1c')]);_0x24606d[_0x489c('0x1e')]=qs[_0x489c('0x1e')](_0x262ee8[_0x489c('0x31')][_0x489c('0x1e')]);}_0x24606d[_0x489c('0x39')]=qs[_0x489c('0x3a')](_0x262ee8[_0x489c('0x31')][_0x489c('0x3a')]);_0x24606d[_0x489c('0x3c')]=qs[_0x489c('0x33')](_[_0x489c('0x3b')](_0x262ee8[_0x489c('0x31')],_0x3be36[_0x489c('0x33')]));_0x24606d['where'][_0x489c('0x5b')]=_0x28c651['id'];if(_0x262ee8[_0x489c('0x31')][_0x489c('0x3e')]){_0x24606d[_0x489c('0x3c')]=_[_0x489c('0x3f')](_0x24606d[_0x489c('0x3c')],{'$or':_[_0x489c('0x2c')](_0x24606d[_0x489c('0x36')],function(_0x496f9d){var _0x17bf0a={};_0x17bf0a[_0x496f9d]={'$like':'%'+_0x262ee8[_0x489c('0x31')][_0x489c('0x3e')]+'%'};return _0x17bf0a;})});}_0x24606d=_[_0x489c('0x3f')]({},_0x24606d,_0x262ee8['options']);return db['CmHopperBlack'][_0x489c('0x1d')]({'where':_0x24606d[_0x489c('0x3c')]})['then'](function(_0xdd33bb){_0x13b52e[_0x489c('0x1d')]=_0xdd33bb;if(_0x262ee8[_0x489c('0x31')][_0x489c('0x42')]){_0x24606d[_0x489c('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x489c('0x44')](_0x24606d);})[_0x489c('0x25')](function(_0xb88642){_0x13b52e[_0x489c('0x45')]=_0xb88642;return _0x13b52e;});}})[_0x489c('0x25')](respondWithFilteredResult(_0xc3ae02,_0x24606d))[_0x489c('0x46')](handleError(_0xc3ae02,null));};exports['getLists']=function(_0x2d8c19,_0x1bc60a,_0xe67907){var _0x49472a={};var _0x2afd88={};var _0x34504e;var _0x1f09c0;return db[_0x489c('0x41')][_0x489c('0x57')]({'where':{'id':_0x2d8c19[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x1bc60a,null))[_0x489c('0x25')](function(_0x32f70f){if(_0x32f70f){_0x34504e=_0x32f70f;_0x2afd88['model']=_[_0x489c('0x32')](db[_0x489c('0x60')]['rawAttributes']);_0x2afd88['query']=_[_0x489c('0x32')](_0x2d8c19[_0x489c('0x31')]);_0x2afd88[_0x489c('0x33')]=_[_0x489c('0x34')](_0x2afd88['model'],_0x2afd88[_0x489c('0x31')]);_0x49472a[_0x489c('0x36')]=_['intersection'](_0x2afd88['model'],qs['fields'](_0x2d8c19[_0x489c('0x31')][_0x489c('0x35')]));_0x49472a[_0x489c('0x36')]=_0x49472a[_0x489c('0x36')][_0x489c('0x37')]?_0x49472a[_0x489c('0x36')]:_0x2afd88[_0x489c('0x30')];_0x49472a[_0x489c('0x39')]=qs[_0x489c('0x3a')](_0x2d8c19[_0x489c('0x31')][_0x489c('0x3a')]);_0x49472a[_0x489c('0x3c')]=qs[_0x489c('0x33')](_[_0x489c('0x3b')](_0x2d8c19[_0x489c('0x31')],_0x2afd88['filters']));if(_0x2d8c19[_0x489c('0x31')][_0x489c('0x3e')]){_0x49472a[_0x489c('0x3c')]=_[_0x489c('0x3f')](_0x49472a['where'],{'$or':_[_0x489c('0x2c')](_0x49472a[_0x489c('0x36')],function(_0x5161dc){var _0xbe0eb0={};_0xbe0eb0[_0x5161dc]={'$like':'%'+_0x2d8c19[_0x489c('0x31')][_0x489c('0x3e')]+'%'};return _0xbe0eb0;})});}_0x49472a=_[_0x489c('0x3f')]({},_0x49472a,_0x2d8c19[_0x489c('0x40')]);return _0x34504e[_0x489c('0x61')](_0x49472a);}})[_0x489c('0x25')](function(_0x5d449a){if(_0x5d449a){_0x1f09c0=_0x5d449a[_0x489c('0x37')];if(!_0x2d8c19[_0x489c('0x31')][_0x489c('0x38')](_0x489c('0x59'))){_0x49472a['limit']=qs[_0x489c('0x1c')](_0x2d8c19[_0x489c('0x31')][_0x489c('0x1c')]);_0x49472a['offset']=qs[_0x489c('0x1e')](_0x2d8c19[_0x489c('0x31')][_0x489c('0x1e')]);}return _0x34504e['getLists'](_0x49472a);}})['then'](function(_0x2a3c38){if(_0x2a3c38){return _0x2a3c38?{'count':_0x1f09c0,'rows':_0x2a3c38}:null;}})[_0x489c('0x25')](respondWithResult(_0x1bc60a,null))[_0x489c('0x46')](handleError(_0x1bc60a,null));};exports['addLists']=function(_0x1ef3b6,_0x26d261,_0x4ecf79){var _0x4ac510,_0x3b10dc;var _0x3829e9=[];var _0x579def=moment()['format'](_0x489c('0x62'));return db[_0x489c('0x41')]['find']({'where':{'id':_0x1ef3b6[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x26d261,null))[_0x489c('0x25')](function(_0x479374){if(_0x479374){_0x3b10dc=_0x479374;return _0x479374['addLists'](_0x1ef3b6[_0x489c('0x49')][_0x489c('0x63')],_[_0x489c('0x53')](_0x1ef3b6[_0x489c('0x49')],['ids','id'])||{});}return null;})[_0x489c('0x64')](function(_0x59bb21){var _0x4ef292;var _0x46a15c;_0x4ac510=_0x59bb21||[];var _0x2f8197=[];if(_0x59bb21){for(var _0x24de29=0x0;_0x24de29<_0x59bb21['length'];_0x24de29+=0x1){var _0x57b95a=_0x59bb21[_0x24de29][_0x489c('0x4b')]({'plain':!![]});_0x3b10dc['dialCheckDuplicateType']=_0x1ef3b6[_0x489c('0x49')]['dialCheckDuplicateType']?_0x1ef3b6[_0x489c('0x49')][_0x489c('0x65')]:_0x3b10dc['dialCheckDuplicateType'];switch(_0x3b10dc['dialCheckDuplicateType']){case _0x489c('0x66'):_0x4ef292=squel[_0x489c('0x67')]()[_0x489c('0x68')](_0x489c('0x69'))[_0x489c('0x6a')]([_0x489c('0x6b'),_0x489c('0x6c'),'ContactId','ListId',_0x489c('0x5b'),_0x489c('0x54'),_0x489c('0x55')],squel['select']()[_0x489c('0x6d')](_0x489c('0x6b'),_0x489c('0x6b'))[_0x489c('0x6d')](_0x489c('0x6e'),_0x489c('0x6c'))[_0x489c('0x6d')]('id','ContactId')[_0x489c('0x6d')](_0x57b95a[_0x489c('0x6f')][_0x489c('0x70')](),_0x489c('0x71'))[_0x489c('0x6d')](_0x1ef3b6[_0x489c('0x47')]['id'][_0x489c('0x70')](),_0x489c('0x5b'))[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x54'))[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x55'))['from']('cm_contacts')[_0x489c('0x3c')](_0x489c('0x72'))[_0x489c('0x3c')](_0x489c('0x73'),_0x57b95a[_0x489c('0x6f')][_0x489c('0x70')]())['where'](_0x489c('0x74'))[_0x489c('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x489c('0x6d')](_0x489c('0x75'))[_0x489c('0x76')](_0x489c('0x77'))[_0x489c('0x3c')](_0x489c('0x78'),_0x1ef3b6['params']['id'][_0x489c('0x70')]()))['where'](_0x489c('0x79'),squel[_0x489c('0x7a')]()[_0x489c('0x6d')](_0x489c('0x7b'))[_0x489c('0x76')]('cm_hopper')[_0x489c('0x3c')](_0x489c('0x78'),_0x1ef3b6[_0x489c('0x47')]['id']['toString']())))['toString']();break;case _0x489c('0x7c'):_0x4ef292=squel[_0x489c('0x67')]()[_0x489c('0x68')]('cm_hopper')['fromQuery']([_0x489c('0x6b'),_0x489c('0x6c'),'ContactId',_0x489c('0x71'),_0x489c('0x5b'),_0x489c('0x54'),_0x489c('0x55')],squel[_0x489c('0x7a')]()[_0x489c('0x6d')](_0x489c('0x6b'),_0x489c('0x6b'))[_0x489c('0x6d')](_0x489c('0x6e'),'scheduledAt')['field']('id',_0x489c('0x7d'))['field'](_0x57b95a[_0x489c('0x6f')][_0x489c('0x70')](),_0x489c('0x71'))[_0x489c('0x6d')](_0x1ef3b6['params']['id'][_0x489c('0x70')](),_0x489c('0x5b'))[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x54'))[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x55'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x489c('0x3c')](_0x489c('0x73'),_0x57b95a[_0x489c('0x6f')][_0x489c('0x70')]())[_0x489c('0x3c')](_0x489c('0x74'))[_0x489c('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x489c('0x7a')]()[_0x489c('0x6d')](_0x489c('0x7b'))[_0x489c('0x76')]('cm_hopper')[_0x489c('0x3c')](_0x489c('0x78'),_0x1ef3b6[_0x489c('0x47')]['id'][_0x489c('0x70')]())))[_0x489c('0x70')]();break;default:_0x4ef292=squel[_0x489c('0x67')]()[_0x489c('0x68')](_0x489c('0x69'))['fromQuery']([_0x489c('0x6b'),_0x489c('0x6c'),'ContactId',_0x489c('0x71'),'CampaignId',_0x489c('0x54'),_0x489c('0x55')],squel[_0x489c('0x7a')]()[_0x489c('0x6d')](_0x489c('0x6b'),_0x489c('0x6b'))[_0x489c('0x6d')](_0x489c('0x6e'),'scheduledAt')[_0x489c('0x6d')]('id','ContactId')[_0x489c('0x6d')](_0x57b95a['CmListId'][_0x489c('0x70')](),_0x489c('0x71'))[_0x489c('0x6d')](_0x1ef3b6[_0x489c('0x47')]['id']['toString'](),'CampaignId')[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x54'))[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x55'))[_0x489c('0x76')](_0x489c('0x7e'))[_0x489c('0x3c')]('deletedAt\x20IS\x20NULL')[_0x489c('0x3c')](_0x489c('0x73'),_0x57b95a[_0x489c('0x6f')][_0x489c('0x70')]())['where'](_0x489c('0x74')))[_0x489c('0x70')]();}_0x46a15c=squel[_0x489c('0x67')]()[_0x489c('0x68')](_0x489c('0x7f'))[_0x489c('0x6a')]([_0x489c('0x80'),_0x489c('0x6c'),'phone',_0x489c('0x81'),_0x489c('0x54'),_0x489c('0x55')],squel[_0x489c('0x7a')]()[_0x489c('0x6d')](_0x489c('0x82'),'id')['field'](_0x489c('0x6e'),_0x489c('0x6c'))[_0x489c('0x6d')](_0x489c('0x83'),'phone')[_0x489c('0x6d')](_0x489c('0x84'),'OrderBy')[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x54'))[_0x489c('0x6d')]('\x27'+_0x579def+'\x27',_0x489c('0x55'))['from'](_0x489c('0x85'),'ci')['join'](_0x489c('0x69'),'h',_0x489c('0x86'))[_0x489c('0x3c')](_0x489c('0x87'),_0x57b95a[_0x489c('0x6f')]['toString']())[_0x489c('0x3c')]('h.CampaignId=?',_0x1ef3b6[_0x489c('0x47')]['id']['toString']())['where'](_0x489c('0x88'),_0x579def))[_0x489c('0x70')]();_0x2f8197['push'](db[_0x489c('0x89')][_0x489c('0x31')](_0x4ef292));_0x3829e9[_0x489c('0x8a')](db['sequelize']['query'](_0x46a15c));}return BPromise[_0x489c('0x8b')](_0x2f8197);}})[_0x489c('0x25')](function(){return BPromise[_0x489c('0x8b')](_0x3829e9);})['then'](function(){return _0x4ac510;})[_0x489c('0x25')](respondWithResult(_0x26d261,null))[_0x489c('0x46')](handleError(_0x26d261,null));};exports[_0x489c('0x8c')]=function(_0x527d8a,_0x28ce58,_0x10987e){return db['Campaign']['find']({'where':{'id':_0x527d8a['params']['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x28ce58,null))[_0x489c('0x25')](function(_0x19c0b5){if(_0x19c0b5){return _0x19c0b5['removeLists'](_0x527d8a['query']['ids']);}})[_0x489c('0x25')](function(_0x34bf27){if(_0x34bf27){return db['CmHopper'][_0x489c('0x27')]({'where':{'ListId':_0x527d8a[_0x489c('0x31')][_0x489c('0x63')],'CampaignId':_0x527d8a[_0x489c('0x47')]['id']}})[_0x489c('0x25')](function(){return _0x34bf27;});}})[_0x489c('0x25')](respondWithStatusCode(_0x28ce58,null))[_0x489c('0x46')](handleError(_0x28ce58,null));};exports[_0x489c('0x8d')]=function(_0x51145d,_0x2af121,_0x3d6fee){var _0x14948e={};var _0x459660={};var _0x3aa387;var _0x487f22;return db[_0x489c('0x41')][_0x489c('0x57')]({'where':{'id':_0x51145d[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x2af121,null))[_0x489c('0x25')](function(_0x16a8a9){if(_0x16a8a9){_0x3aa387=_0x16a8a9;_0x459660[_0x489c('0x30')]=_[_0x489c('0x32')](db['CmList'][_0x489c('0x2d')]);_0x459660[_0x489c('0x31')]=_[_0x489c('0x32')](_0x51145d[_0x489c('0x31')]);_0x459660[_0x489c('0x33')]=_[_0x489c('0x34')](_0x459660[_0x489c('0x30')],_0x459660[_0x489c('0x31')]);_0x14948e[_0x489c('0x36')]=_[_0x489c('0x34')](_0x459660['model'],qs[_0x489c('0x35')](_0x51145d[_0x489c('0x31')][_0x489c('0x35')]));_0x14948e[_0x489c('0x36')]=_0x14948e[_0x489c('0x36')][_0x489c('0x37')]?_0x14948e[_0x489c('0x36')]:_0x459660['model'];_0x14948e[_0x489c('0x39')]=qs[_0x489c('0x3a')](_0x51145d[_0x489c('0x31')][_0x489c('0x3a')]);_0x14948e[_0x489c('0x3c')]=qs[_0x489c('0x33')](_['pick'](_0x51145d[_0x489c('0x31')],_0x459660[_0x489c('0x33')]));if(_0x51145d[_0x489c('0x31')][_0x489c('0x3e')]){_0x14948e[_0x489c('0x3c')]=_[_0x489c('0x3f')](_0x14948e['where'],{'$or':_[_0x489c('0x2c')](_0x14948e[_0x489c('0x36')],function(_0x36142b){var _0x443e3e={};_0x443e3e[_0x36142b]={'$like':'%'+_0x51145d[_0x489c('0x31')]['filter']+'%'};return _0x443e3e;})});}_0x14948e=_[_0x489c('0x3f')]({},_0x14948e,_0x51145d['options']);return _0x3aa387[_0x489c('0x8d')](_0x14948e);}})[_0x489c('0x25')](function(_0x2eb5a7){if(_0x2eb5a7){_0x487f22=_0x2eb5a7[_0x489c('0x37')];if(!_0x51145d[_0x489c('0x31')][_0x489c('0x38')]('nolimit')){_0x14948e[_0x489c('0x1c')]=qs[_0x489c('0x1c')](_0x51145d[_0x489c('0x31')][_0x489c('0x1c')]);_0x14948e[_0x489c('0x1e')]=qs[_0x489c('0x1e')](_0x51145d[_0x489c('0x31')][_0x489c('0x1e')]);}return _0x3aa387[_0x489c('0x8d')](_0x14948e);}})['then'](function(_0x28c367){if(_0x28c367){return _0x28c367?{'count':_0x487f22,'rows':_0x28c367}:null;}})[_0x489c('0x25')](respondWithResult(_0x2af121,null))[_0x489c('0x46')](handleError(_0x2af121,null));};exports['addBlackLists']=function(_0x685e6e,_0x2d1860,_0x1e8e0e){var _0x52a09a,_0x4c6e57;var _0x18bc2d=[];var _0x29a5ea=moment()[_0x489c('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x489c('0x41')]['find']({'where':{'id':_0x685e6e[_0x489c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d1860,null))[_0x489c('0x25')](function(_0x19fef2){if(_0x19fef2){_0x4c6e57=_0x19fef2;return _0x19fef2['addBlackLists'](_0x685e6e[_0x489c('0x49')][_0x489c('0x63')],_['omit'](_0x685e6e[_0x489c('0x49')],[_0x489c('0x63'),'id'])||{});}return null;})['spread'](function(_0x304a62){var _0x5bd9bb;var _0x3de88f;_0x52a09a=_0x304a62||[];var _0x52bbd1=[];if(_0x304a62){for(var _0x5d8e48=0x0;_0x5d8e48<_0x304a62[_0x489c('0x37')];_0x5d8e48+=0x1){var _0x2f5785=_0x304a62[_0x5d8e48][_0x489c('0x4b')]({'plain':!![]});_0x5bd9bb=squel[_0x489c('0x67')]()['into'](_0x489c('0x8f'))['fromQuery'](['phone',_0x489c('0x7d'),_0x489c('0x71'),_0x489c('0x5b'),_0x489c('0x54'),'updatedAt'],squel[_0x489c('0x7a')]()[_0x489c('0x6d')](_0x489c('0x6b'),_0x489c('0x6b'))['field']('id',_0x489c('0x7d'))[_0x489c('0x6d')](_0x2f5785[_0x489c('0x6f')][_0x489c('0x70')](),'ListId')['field'](_0x685e6e['params']['id'][_0x489c('0x70')](),_0x489c('0x5b'))[_0x489c('0x6d')](_0x489c('0x6e'),_0x489c('0x54'))['field'](_0x489c('0x6e'),_0x489c('0x55'))[_0x489c('0x76')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x489c('0x3c')](_0x489c('0x73'),_0x2f5785['CmListId'][_0x489c('0x70')]())[_0x489c('0x3c')](_0x489c('0x74')))[_0x489c('0x70')]();_0x52bbd1[_0x489c('0x8a')](db[_0x489c('0x89')][_0x489c('0x31')](_0x5bd9bb));}return BPromise[_0x489c('0x8b')](_0x52bbd1);}})[_0x489c('0x25')](function(){return _0x52a09a;})['then'](respondWithResult(_0x2d1860,null))[_0x489c('0x46')](handleError(_0x2d1860,null));};exports[_0x489c('0x90')]=function(_0x1974dc,_0x9b6d4d,_0x355fe8){return db[_0x489c('0x41')][_0x489c('0x4f')]({'where':{'id':_0x1974dc[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x9b6d4d,null))[_0x489c('0x25')](function(_0x20423c){if(_0x20423c){return _0x20423c[_0x489c('0x90')](_0x1974dc[_0x489c('0x31')][_0x489c('0x63')]);}})['then'](function(_0x4f6194){if(_0x4f6194){return db[_0x489c('0x91')][_0x489c('0x27')]({'where':{'ListId':_0x1974dc[_0x489c('0x31')]['ids'],'CampaignId':_0x1974dc[_0x489c('0x47')]['id']}})['then'](function(){return _0x4f6194;});}})[_0x489c('0x25')](respondWithStatusCode(_0x9b6d4d,null))[_0x489c('0x46')](handleError(_0x9b6d4d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3aee6d5..64b8f72 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x49684e,_0x9a24fb){var _0x54062f=function(_0x4e410a){while(--_0x4e410a){_0x49684e['push'](_0x49684e['shift']());}};_0x54062f(++_0x9a24fb);}(_0x7a54,0x106));var _0x47a5=function(_0x30a150,_0x40d8e1){_0x30a150=_0x30a150-0x0;var _0x5dfd31=_0x7a54[_0x30a150];return _0x5dfd31;};'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 +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5b9f6f4..b3652b5 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 _0x750a=['GetCampaign','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map'];(function(_0x11f1e0,_0x568eae){var _0x3369c7=function(_0x53105a){while(--_0x53105a){_0x11f1e0['push'](_0x11f1e0['shift']());}};_0x3369c7(++_0x568eae);}(_0x750a,0x140));var _0xa750=function(_0x50a75e,_0x41e663){_0x50a75e=_0x50a75e-0x0;var _0x304e15=_0x750a[_0x50a75e];return _0x304e15;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('Campaign,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetCampaign']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['Campaign']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});}; \ No newline at end of file +var _0x8d97=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','util','moment'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0x8d97,0x82));var _0x78d9=function(_0x3561d5,_0x269bb9){_0x3561d5=_0x3561d5-0x0;var _0x124ccb=_0x8d97[_0x3561d5];return _0x124ccb;};'use strict';var _=require('lodash');var util=require(_0x78d9('0x0'));var moment=require(_0x78d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x78d9('0x2'));var fs=require('fs');var Redis=require(_0x78d9('0x3'));var db=require(_0x78d9('0x4'))['db'];var utils=require(_0x78d9('0x5'));var logger=require(_0x78d9('0x6'))('rpc');var config=require(_0x78d9('0x7'));var jayson=require(_0x78d9('0x8'));var client=jayson[_0x78d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1934,_0x5b9602,_0x2a2cdb){return new BPromise(function(_0x3b3709,_0x36b8f5){return client[_0x78d9('0xa')](_0x4d1934,_0x2a2cdb)[_0x78d9('0xb')](function(_0x14ca4e){logger['info'](_0x78d9('0xc'),_0x5b9602,_0x78d9('0xd'));logger[_0x78d9('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5b9602,'request\x20sent',JSON[_0x78d9('0xf')](_0x14ca4e));if(_0x14ca4e[_0x78d9('0x10')]){if(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x11')]===0x1f4){logger[_0x78d9('0x10')](_0x78d9('0xc'),_0x5b9602,_0x14ca4e['error'][_0x78d9('0x12')]);return _0x36b8f5(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);}logger[_0x78d9('0x10')](_0x78d9('0xc'),_0x5b9602,_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);return _0x3b3709(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);}else{logger[_0x78d9('0x13')](_0x78d9('0xc'),_0x5b9602,_0x78d9('0xd'));_0x3b3709(_0x14ca4e[_0x78d9('0x14')][_0x78d9('0x12')]);}})[_0x78d9('0x15')](function(_0x156981){logger[_0x78d9('0x10')]('Campaign,\x20%s,\x20%s',_0x5b9602,_0x156981);_0x36b8f5(_0x156981);});});}exports[_0x78d9('0x16')]=function(_0x3b4dde){var _0x36f1e4=this;return new Promise(function(_0x8d0153,_0x43ea59){return db[_0x78d9('0x17')][_0x78d9('0x18')]({'raw':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1b')]||null:null,'attributes':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1c')]||null:null,'limit':_0x3b4dde['options']?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1d')]||null:null,'include':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')]['include']?_[_0x78d9('0x1e')](_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1f')],function(_0x51549d){return{'model':db[_0x51549d['model']],'as':_0x51549d['as'],'attributes':_0x51549d[_0x78d9('0x1c')],'include':_0x51549d['include']?_['map'](_0x51549d['include'],function(_0x28b7e1){return{'model':db[_0x28b7e1[_0x78d9('0x20')]],'as':_0x28b7e1['as'],'attributes':_0x28b7e1[_0x78d9('0x1c')],'include':_0x28b7e1[_0x78d9('0x1f')]?_[_0x78d9('0x1e')](_0x28b7e1[_0x78d9('0x1f')],function(_0x4e87cf){return{'model':db[_0x4e87cf[_0x78d9('0x20')]],'as':_0x4e87cf['as'],'attributes':_0x4e87cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x78d9('0xb')](function(_0x3d9a53){logger[_0x78d9('0x13')]('GetCampaign',_0x3b4dde);logger[_0x78d9('0xe')](_0x78d9('0x16'),_0x3b4dde,JSON['stringify'](_0x3d9a53));_0x8d0153(_0x3d9a53);})['catch'](function(_0x55617c){logger['error'](_0x78d9('0x16'),_0x55617c[_0x78d9('0x12')],_0x3b4dde);_0x43ea59(_0x36f1e4[_0x78d9('0x10')](0x1f4,_0x55617c[_0x78d9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e6674b6..86ffe70 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 _0xa567=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','update','destroy','delete','removeBlackLists','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0xa1e6b9,_0x484192){var _0x4db940=function(_0x39c320){while(--_0x39c320){_0xa1e6b9['push'](_0xa1e6b9['shift']());}};_0x4db940(++_0x484192);}(_0xa567,0x119));var _0x7a56=function(_0x540d28,_0x34ef0e){_0x540d28=_0x540d28-0x0;var _0x12635b=_0xa567[_0x540d28];return _0x12635b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a56('0x0'));var timeout=require(_0x7a56('0x1'));var express=require(_0x7a56('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a56('0x3'));var config=require(_0x7a56('0x4'));var controller=require('./campaign.controller');router[_0x7a56('0x5')]('/',auth['isAuthenticated'](),controller[_0x7a56('0x6')]);router['get'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x9')]);router[_0x7a56('0x5')](_0x7a56('0xa'),auth[_0x7a56('0x8')](),controller['getHoppers']);router[_0x7a56('0x5')]('/:id/hopper_histories',auth[_0x7a56('0x8')](),controller[_0x7a56('0xb')]);router[_0x7a56('0x5')](_0x7a56('0xc'),auth[_0x7a56('0x8')](),controller['getHopperFinals']);router[_0x7a56('0x5')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router['get'](_0x7a56('0xd'),auth[_0x7a56('0x8')](),controller[_0x7a56('0xe')]);router[_0x7a56('0x5')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x10')]);router[_0x7a56('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0x7a56('0x8')](),controller['clone']);router[_0x7a56('0x11')](_0x7a56('0xd'),auth['isAuthenticated'](),controller['addLists']);router[_0x7a56('0x11')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller['addBlackLists']);router['put'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x12')]);router['delete'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x13')]);router['delete'](_0x7a56('0xd'),auth[_0x7a56('0x8')](),controller['removeLists']);router[_0x7a56('0x14')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0a4b=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','post','create','clone','/:id/lists','addLists','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','show','/:id/hopper_histories','isAuthenticated'];(function(_0x1e7766,_0x4136de){var _0x9b7173=function(_0x53fdc7){while(--_0x53fdc7){_0x1e7766['push'](_0x1e7766['shift']());}};_0x9b7173(++_0x4136de);}(_0x0a4b,0x6d));var _0xb0a4=function(_0x48689f,_0x4e913f){_0x48689f=_0x48689f-0x0;var _0x43ae70=_0x0a4b[_0x48689f];return _0x43ae70;};'use strict';var multer=require(_0xb0a4('0x0'));var util=require('util');var path=require(_0xb0a4('0x1'));var timeout=require(_0xb0a4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0a4('0x3'));var config=require(_0xb0a4('0x4'));var controller=require(_0xb0a4('0x5'));router[_0xb0a4('0x6')]('/',auth['isAuthenticated'](),controller[_0xb0a4('0x7')]);router[_0xb0a4('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb0a4('0x8')]);router[_0xb0a4('0x6')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0xb0a4('0x6')](_0xb0a4('0x9'),auth[_0xb0a4('0xa')](),controller[_0xb0a4('0xb')]);router['get'](_0xb0a4('0xc'),auth[_0xb0a4('0xa')](),controller[_0xb0a4('0xd')]);router[_0xb0a4('0x6')](_0xb0a4('0xe'),auth['isAuthenticated'](),controller[_0xb0a4('0xf')]);router[_0xb0a4('0x6')]('/:id/lists',auth[_0xb0a4('0xa')](),controller['getLists']);router[_0xb0a4('0x6')](_0xb0a4('0x10'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xb0a4('0x11')]('/',auth[_0xb0a4('0xa')](),controller[_0xb0a4('0x12')]);router[_0xb0a4('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0xb0a4('0x13')]);router['post'](_0xb0a4('0x14'),auth[_0xb0a4('0xa')](),controller[_0xb0a4('0x15')]);router[_0xb0a4('0x11')]('/:id/blacklists',auth[_0xb0a4('0xa')](),controller[_0xb0a4('0x16')]);router[_0xb0a4('0x17')](_0xb0a4('0x18'),auth['isAuthenticated'](),controller[_0xb0a4('0x19')]);router[_0xb0a4('0x1a')](_0xb0a4('0x18'),auth['isAuthenticated'](),controller[_0xb0a4('0x1b')]);router[_0xb0a4('0x1a')](_0xb0a4('0x14'),auth[_0xb0a4('0xa')](),controller[_0xb0a4('0x1c')]);router[_0xb0a4('0x1a')](_0xb0a4('0x10'),auth[_0xb0a4('0xa')](),controller[_0xb0a4('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ef2fa25..74525c1 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 _0xc9aa=['VIRTUAL','sequelize','STRING','TEXT'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc9aa,0xd1));var _0xac9a=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc9aa[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0xac9a('0x0'));module['exports']={'key':{'type':Sequelize[_0xac9a('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xac9a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xac9a('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x0ea2=['sequelize','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x35fd0c,_0x57c9c4){var _0x2049cb=function(_0x4bdda0){while(--_0x4bdda0){_0x35fd0c['push'](_0x35fd0c['shift']());}};_0x2049cb(++_0x57c9c4);}(_0x0ea2,0x7e));var _0x20ea=function(_0x162053,_0xe1b6fc){_0x162053=_0x162053-0x0;var _0x5236ae=_0x0ea2[_0x162053];return _0x5236ae;};'use strict';var Sequelize=require(_0x20ea('0x0'));module['exports']={'key':{'type':Sequelize[_0x20ea('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x20ea('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x20ea('0x3')],'get':function(){return this[_0x20ea('0x4')](_0x20ea('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 71737df..89bd537 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 _0x3b7c=['then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x97b3e7,_0x19d219){var _0x4d9b45=function(_0x2b23ba){while(--_0x2b23ba){_0x97b3e7['push'](_0x97b3e7['shift']());}};_0x4d9b45(++_0x19d219);}(_0x3b7c,0x90));var _0xc3b7=function(_0x302b72,_0x483f35){_0x302b72=_0x302b72-0x0;var _0x48aa64=_0x3b7c[_0x302b72];return _0x48aa64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3b7('0x0'));var zipdir=require(_0xc3b7('0x1'));var jsonpatch=require(_0xc3b7('0x2'));var rp=require(_0xc3b7('0x3'));var moment=require('moment');var BPromise=require(_0xc3b7('0x4'));var Mustache=require(_0xc3b7('0x5'));var util=require(_0xc3b7('0x6'));var path=require('path');var sox=require(_0xc3b7('0x7'));var csv=require(_0xc3b7('0x8'));var ejs=require(_0xc3b7('0x9'));var fs=require('fs');var fs_extra=require(_0xc3b7('0xa'));var _=require(_0xc3b7('0xb'));var squel=require(_0xc3b7('0xc'));var crypto=require(_0xc3b7('0xd'));var jsforce=require(_0xc3b7('0xe'));var deskjs=require(_0xc3b7('0xf'));var toCsv=require(_0xc3b7('0x8'));var querystring=require('querystring');var Papa=require(_0xc3b7('0x10'));var Redis=require(_0xc3b7('0x11'));var authService=require(_0xc3b7('0x12'));var qs=require(_0xc3b7('0x13'));var as=require(_0xc3b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3b7('0x15'))(_0xc3b7('0x16'));var utils=require(_0xc3b7('0x17'));var config=require(_0xc3b7('0x18'));var licenseUtil=require(_0xc3b7('0x19'));var db=require(_0xc3b7('0x1a'))['db'];function respondWithStatusCode(_0x3ea339,_0x5b1344){_0x5b1344=_0x5b1344||0xcc;return function(_0x50bc8b){if(_0x50bc8b){return _0x3ea339[_0xc3b7('0x1b')](_0x5b1344);}return _0x3ea339[_0xc3b7('0x1c')](_0x5b1344)[_0xc3b7('0x1d')]();};}function respondWithResult(_0xe844f8,_0x536954){_0x536954=_0x536954||0xc8;return function(_0x227bda){if(_0x227bda){return _0xe844f8[_0xc3b7('0x1c')](_0x536954)[_0xc3b7('0x1e')](_0x227bda);}};}function respondWithFilteredResult(_0x58b203,_0x626314){return function(_0x384194){if(_0x384194){var _0x2d3789=typeof _0x626314[_0xc3b7('0x1f')]==='undefined'&&typeof _0x626314[_0xc3b7('0x20')]==='undefined';var _0x349c1e=_0x384194[_0xc3b7('0x21')];var _0x91fb29=_0x2d3789?0x0:_0x626314[_0xc3b7('0x1f')];var _0x38279b=_0x2d3789?_0x384194[_0xc3b7('0x21')]:_0x626314[_0xc3b7('0x1f')]+_0x626314[_0xc3b7('0x20')];var _0x2e0187;if(_0x38279b>=_0x349c1e){_0x38279b=_0x349c1e;_0x2e0187=0xc8;}else{_0x2e0187=0xce;}_0x58b203[_0xc3b7('0x1c')](_0x2e0187);return _0x58b203[_0xc3b7('0x22')](_0xc3b7('0x23'),_0x91fb29+'-'+_0x38279b+'/'+_0x349c1e)[_0xc3b7('0x1e')](_0x384194);}return null;};}function patchUpdates(_0x2ecea1){return function(_0x1b7a93){try{jsonpatch[_0xc3b7('0x24')](_0x1b7a93,_0x2ecea1,!![]);}catch(_0x1949c0){return BPromise[_0xc3b7('0x25')](_0x1949c0);}return _0x1b7a93[_0xc3b7('0x26')]();};}function saveUpdates(_0x5ab44e,_0x44492e){return function(_0x5824e0){if(_0x5824e0){return _0x5824e0[_0xc3b7('0x27')](_0x5ab44e)[_0xc3b7('0x28')](function(_0x206609){return _0x206609;});}return null;};}function removeEntity(_0x251990,_0x414e5c){return function(_0x27ba39){if(_0x27ba39){return _0x27ba39[_0xc3b7('0x29')]()[_0xc3b7('0x28')](function(){var _0x4ea003=_0x27ba39[_0xc3b7('0x2a')]({'plain':!![]});var _0x48ec3d='CannedAnswers';return db[_0xc3b7('0x2b')][_0xc3b7('0x29')]({'where':{'type':_0x48ec3d,'resourceId':_0x4ea003['id']}})[_0xc3b7('0x28')](function(){return _0x27ba39;});})['then'](function(){_0x251990[_0xc3b7('0x1c')](0xcc)[_0xc3b7('0x1d')]();});}};}function handleEntityNotFound(_0x35c319,_0x2f0924){return function(_0x3375fa){if(!_0x3375fa){_0x35c319[_0xc3b7('0x1b')](0x194);}return _0x3375fa;};}function handleError(_0x2808da,_0x402dee){_0x402dee=_0x402dee||0x1f4;return function(_0x1c4009){logger[_0xc3b7('0x2c')](_0x1c4009[_0xc3b7('0x2d')]);if(_0x1c4009[_0xc3b7('0x2e')]){delete _0x1c4009[_0xc3b7('0x2e')];}_0x2808da[_0xc3b7('0x1c')](_0x402dee)[_0xc3b7('0x2f')](_0x1c4009);};}exports[_0xc3b7('0x30')]=function(_0x5027e3,_0x620ce4){var _0x31cc76={},_0x3e99e5={},_0x44965b={'count':0x0,'rows':[]};var _0x1f744f=_[_0xc3b7('0x31')](db[_0xc3b7('0x32')][_0xc3b7('0x33')],function(_0x3bdcfc){return{'name':_0x3bdcfc[_0xc3b7('0x34')],'type':_0x3bdcfc[_0xc3b7('0x35')]['key']};});_0x3e99e5[_0xc3b7('0x36')]=_['map'](_0x1f744f,_0xc3b7('0x2e'));_0x3e99e5[_0xc3b7('0x37')]=_[_0xc3b7('0x38')](_0x5027e3[_0xc3b7('0x37')]);_0x3e99e5[_0xc3b7('0x39')]=_['intersection'](_0x3e99e5['model'],_0x3e99e5[_0xc3b7('0x37')]);_0x31cc76['attributes']=_[_0xc3b7('0x3a')](_0x3e99e5[_0xc3b7('0x36')],qs[_0xc3b7('0x3b')](_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x3b')]));_0x31cc76['attributes']=_0x31cc76[_0xc3b7('0x3c')][_0xc3b7('0x3d')]?_0x31cc76[_0xc3b7('0x3c')]:_0x3e99e5['model'];if(!_0x5027e3['query'][_0xc3b7('0x3e')](_0xc3b7('0x3f'))){_0x31cc76[_0xc3b7('0x20')]=qs[_0xc3b7('0x20')](_0x5027e3[_0xc3b7('0x37')]['limit']);_0x31cc76['offset']=qs['offset'](_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x1f')]);}_0x31cc76[_0xc3b7('0x40')]=qs[_0xc3b7('0x41')](_0x5027e3[_0xc3b7('0x37')]['sort']);_0x31cc76[_0xc3b7('0x42')]=qs[_0xc3b7('0x39')](_[_0xc3b7('0x43')](_0x5027e3[_0xc3b7('0x37')],_0x3e99e5[_0xc3b7('0x39')]),_0x1f744f);if(_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x44')]){_0x31cc76[_0xc3b7('0x42')]=_[_0xc3b7('0x45')](_0x31cc76[_0xc3b7('0x42')],{'$or':[{'key':{'$like':'%'+_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x44')]+'%'}},{'value':{'$like':'%'+_0x5027e3[_0xc3b7('0x37')][_0xc3b7('0x44')]+'%'}}]});}_0x31cc76=_[_0xc3b7('0x45')]({},_0x31cc76,_0x5027e3[_0xc3b7('0x46')]);var _0x142cc9={'where':_0x31cc76[_0xc3b7('0x42')]};return db[_0xc3b7('0x32')]['count'](_0x142cc9)[_0xc3b7('0x28')](function(_0x25c10e){_0x44965b['count']=_0x25c10e;if(_0x5027e3[_0xc3b7('0x37')]['includeAll']){_0x31cc76[_0xc3b7('0x47')]=[{'all':!![]}];}return db[_0xc3b7('0x32')][_0xc3b7('0x48')](_0x31cc76);})[_0xc3b7('0x28')](function(_0x407072){_0x44965b[_0xc3b7('0x49')]=_0x407072;return _0x44965b;})[_0xc3b7('0x28')](respondWithFilteredResult(_0x620ce4,_0x31cc76))[_0xc3b7('0x4a')](handleError(_0x620ce4,null));};exports[_0xc3b7('0x4b')]=function(_0xc94fa4,_0x4572c9){var _0x35b578={'raw':!![],'where':{'id':_0xc94fa4[_0xc3b7('0x4c')]['id']}},_0x2db30e={};_0x2db30e[_0xc3b7('0x36')]=_[_0xc3b7('0x38')](db['CannedAnswer']['rawAttributes']);_0x2db30e['query']=_['keys'](_0xc94fa4[_0xc3b7('0x37')]);_0x2db30e[_0xc3b7('0x39')]=_[_0xc3b7('0x3a')](_0x2db30e[_0xc3b7('0x36')],_0x2db30e[_0xc3b7('0x37')]);_0x35b578['attributes']=_['intersection'](_0x2db30e[_0xc3b7('0x36')],qs[_0xc3b7('0x3b')](_0xc94fa4['query'][_0xc3b7('0x3b')]));_0x35b578[_0xc3b7('0x3c')]=_0x35b578['attributes'][_0xc3b7('0x3d')]?_0x35b578[_0xc3b7('0x3c')]:_0x2db30e[_0xc3b7('0x36')];if(_0xc94fa4['query'][_0xc3b7('0x4d')]){_0x35b578[_0xc3b7('0x47')]=[{'all':!![]}];}_0x35b578=_[_0xc3b7('0x45')]({},_0x35b578,_0xc94fa4[_0xc3b7('0x46')]);return db[_0xc3b7('0x32')][_0xc3b7('0x4e')](_0x35b578)[_0xc3b7('0x28')](handleEntityNotFound(_0x4572c9,null))['then'](respondWithResult(_0x4572c9,null))[_0xc3b7('0x4a')](handleError(_0x4572c9,null));};exports[_0xc3b7('0x27')]=function(_0x533c81,_0x16fec0){if(_0x533c81['body']['id']){delete _0x533c81[_0xc3b7('0x4f')]['id'];}return db[_0xc3b7('0x32')]['find']({'where':{'id':_0x533c81[_0xc3b7('0x4c')]['id']}})[_0xc3b7('0x28')](handleEntityNotFound(_0x16fec0,null))['then'](saveUpdates(_0x533c81[_0xc3b7('0x4f')],null))[_0xc3b7('0x28')](respondWithResult(_0x16fec0,null))[_0xc3b7('0x4a')](handleError(_0x16fec0,null));};exports[_0xc3b7('0x29')]=function(_0x576968,_0x5098c3){return db['CannedAnswer'][_0xc3b7('0x4e')]({'where':{'id':_0x576968[_0xc3b7('0x4c')]['id']}})[_0xc3b7('0x28')](handleEntityNotFound(_0x5098c3,null))[_0xc3b7('0x28')](removeEntity(_0x5098c3,null))['catch'](handleError(_0x5098c3,null));};exports[_0xc3b7('0x50')]=function(_0x26eeb2,_0x3cef1b){var _0x7b4ba1={'key':_0x26eeb2[_0xc3b7('0x4f')]['key']};if(_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x51')]){_0x7b4ba1['MailAccountId']=_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x51')];}else if(_0x26eeb2['body'][_0xc3b7('0x52')]){_0x7b4ba1[_0xc3b7('0x52')]=_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x52')];}else if(_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x53')]){_0x7b4ba1['OpenchannelAccountId']=_0x26eeb2['body'][_0xc3b7('0x53')];}else if(_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x54')]){_0x7b4ba1[_0xc3b7('0x54')]=_0x26eeb2[_0xc3b7('0x4f')][_0xc3b7('0x54')];}return db[_0xc3b7('0x32')]['find']({'where':_0x7b4ba1})[_0xc3b7('0x28')](function(_0x280870){if(_0x280870){throw new db[(_0xc3b7('0x55'))][(_0xc3b7('0x56'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xc3b7('0x32')]['create'](_0x26eeb2['body']);})[_0xc3b7('0x28')](function(_0x280cda){var _0x4559da=_0x26eeb2[_0xc3b7('0x57')][_0xc3b7('0x2a')]({'plain':!![]});if(!_0x4559da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4559da['role']==='user'){var _0x4d693d=_0x280cda[_0xc3b7('0x2a')]({'plain':!![]});return db[_0xc3b7('0x58')][_0xc3b7('0x4e')]({'where':{'name':_0xc3b7('0x59'),'userProfileId':_0x4559da[_0xc3b7('0x5a')]},'raw':!![]})[_0xc3b7('0x28')](function(_0x1180dc){if(_0x1180dc&&_0x1180dc[_0xc3b7('0x5b')]===0x0){return db[_0xc3b7('0x2b')][_0xc3b7('0x50')]({'name':_0x4d693d[_0xc3b7('0x2e')],'resourceId':_0x4d693d['id'],'type':_0x1180dc[_0xc3b7('0x2e')],'sectionId':_0x1180dc['id']},{})[_0xc3b7('0x28')](function(){return _0x280cda;});}else{return _0x280cda;}})['catch'](function(_0x3cad8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cad8c);throw _0x3cad8c;});}return _0x280cda;})[_0xc3b7('0x28')](respondWithResult(_0x3cef1b,0xc9))[_0xc3b7('0x4a')](handleError(_0x3cef1b,null));}; \ No newline at end of file +var _0x2f5c=['../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CannedAnswers','sendStatus','error','stack','name','index','map','CannedAnswer','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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'];(function(_0x2ba24f,_0x1e67d4){var _0x564da4=function(_0x3f3c06){while(--_0x3f3c06){_0x2ba24f['push'](_0x2ba24f['shift']());}};_0x564da4(++_0x1e67d4);}(_0x2f5c,0x15d));var _0xc2f5=function(_0x2d84b1,_0x392056){_0x2d84b1=_0x2d84b1-0x0;var _0x11f92d=_0x2f5c[_0x2d84b1];return _0x11f92d;};'use strict';var emlformat=require(_0xc2f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2f5('0x1'));var jsonpatch=require(_0xc2f5('0x2'));var rp=require(_0xc2f5('0x3'));var moment=require(_0xc2f5('0x4'));var BPromise=require(_0xc2f5('0x5'));var Mustache=require(_0xc2f5('0x6'));var util=require(_0xc2f5('0x7'));var path=require(_0xc2f5('0x8'));var sox=require(_0xc2f5('0x9'));var csv=require(_0xc2f5('0xa'));var ejs=require(_0xc2f5('0xb'));var fs=require('fs');var fs_extra=require(_0xc2f5('0xc'));var _=require(_0xc2f5('0xd'));var squel=require('squel');var crypto=require(_0xc2f5('0xe'));var jsforce=require(_0xc2f5('0xf'));var deskjs=require(_0xc2f5('0x10'));var toCsv=require(_0xc2f5('0xa'));var querystring=require(_0xc2f5('0x11'));var Papa=require('papaparse');var Redis=require(_0xc2f5('0x12'));var authService=require(_0xc2f5('0x13'));var qs=require(_0xc2f5('0x14'));var as=require(_0xc2f5('0x15'));var hardwareService=require(_0xc2f5('0x16'));var logger=require(_0xc2f5('0x17'))(_0xc2f5('0x18'));var utils=require('../../config/utils');var config=require(_0xc2f5('0x19'));var licenseUtil=require(_0xc2f5('0x1a'));var db=require(_0xc2f5('0x1b'))['db'];function respondWithStatusCode(_0x1cc34c,_0x5828b4){_0x5828b4=_0x5828b4||0xcc;return function(_0x1bc5c0){if(_0x1bc5c0){return _0x1cc34c['sendStatus'](_0x5828b4);}return _0x1cc34c[_0xc2f5('0x1c')](_0x5828b4)[_0xc2f5('0x1d')]();};}function respondWithResult(_0x54be2e,_0x43e1ec){_0x43e1ec=_0x43e1ec||0xc8;return function(_0x3ddf68){if(_0x3ddf68){return _0x54be2e[_0xc2f5('0x1c')](_0x43e1ec)['json'](_0x3ddf68);}};}function respondWithFilteredResult(_0x323dfd,_0x48b14f){return function(_0x23e4fa){if(_0x23e4fa){var _0x1ee734=typeof _0x48b14f[_0xc2f5('0x1e')]===_0xc2f5('0x1f')&&typeof _0x48b14f[_0xc2f5('0x20')]===_0xc2f5('0x1f');var _0x3c473e=_0x23e4fa['count'];var _0x39c0bb=_0x1ee734?0x0:_0x48b14f[_0xc2f5('0x1e')];var _0x318650=_0x1ee734?_0x23e4fa[_0xc2f5('0x21')]:_0x48b14f[_0xc2f5('0x1e')]+_0x48b14f[_0xc2f5('0x20')];var _0x48379c;if(_0x318650>=_0x3c473e){_0x318650=_0x3c473e;_0x48379c=0xc8;}else{_0x48379c=0xce;}_0x323dfd[_0xc2f5('0x1c')](_0x48379c);return _0x323dfd[_0xc2f5('0x22')](_0xc2f5('0x23'),_0x39c0bb+'-'+_0x318650+'/'+_0x3c473e)[_0xc2f5('0x24')](_0x23e4fa);}return null;};}function patchUpdates(_0x3abe37){return function(_0x446e10){try{jsonpatch[_0xc2f5('0x25')](_0x446e10,_0x3abe37,!![]);}catch(_0x149b4c){return BPromise[_0xc2f5('0x26')](_0x149b4c);}return _0x446e10[_0xc2f5('0x27')]();};}function saveUpdates(_0x2db98a,_0x3a8eee){return function(_0x1fe2a2){if(_0x1fe2a2){return _0x1fe2a2[_0xc2f5('0x28')](_0x2db98a)['then'](function(_0x70fd4d){return _0x70fd4d;});}return null;};}function removeEntity(_0x2f09d0,_0x103e13){return function(_0x6f8632){if(_0x6f8632){return _0x6f8632[_0xc2f5('0x29')]()[_0xc2f5('0x2a')](function(){var _0x50081e=_0x6f8632[_0xc2f5('0x2b')]({'plain':!![]});var _0x56c09e=_0xc2f5('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x56c09e,'resourceId':_0x50081e['id']}})[_0xc2f5('0x2a')](function(){return _0x6f8632;});})['then'](function(){_0x2f09d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ecfd,_0x458f45){return function(_0x33015c){if(!_0x33015c){_0x39ecfd[_0xc2f5('0x2d')](0x194);}return _0x33015c;};}function handleError(_0x2b5377,_0x5bdded){_0x5bdded=_0x5bdded||0x1f4;return function(_0x46c974){logger[_0xc2f5('0x2e')](_0x46c974[_0xc2f5('0x2f')]);if(_0x46c974[_0xc2f5('0x30')]){delete _0x46c974[_0xc2f5('0x30')];}_0x2b5377['status'](_0x5bdded)['send'](_0x46c974);};}exports[_0xc2f5('0x31')]=function(_0x2e565d,_0x311ea8){var _0x52e092={},_0x1224c3={},_0x50f74a={'count':0x0,'rows':[]};var _0x38cdb9=_[_0xc2f5('0x32')](db[_0xc2f5('0x33')]['rawAttributes'],function(_0x1c9090){return{'name':_0x1c9090['fieldName'],'type':_0x1c9090[_0xc2f5('0x34')][_0xc2f5('0x35')]};});_0x1224c3[_0xc2f5('0x36')]=_['map'](_0x38cdb9,_0xc2f5('0x30'));_0x1224c3[_0xc2f5('0x37')]=_[_0xc2f5('0x38')](_0x2e565d[_0xc2f5('0x37')]);_0x1224c3['filters']=_[_0xc2f5('0x39')](_0x1224c3[_0xc2f5('0x36')],_0x1224c3[_0xc2f5('0x37')]);_0x52e092[_0xc2f5('0x3a')]=_[_0xc2f5('0x39')](_0x1224c3[_0xc2f5('0x36')],qs[_0xc2f5('0x3b')](_0x2e565d['query']['fields']));_0x52e092['attributes']=_0x52e092[_0xc2f5('0x3a')]['length']?_0x52e092[_0xc2f5('0x3a')]:_0x1224c3['model'];if(!_0x2e565d[_0xc2f5('0x37')]['hasOwnProperty']('nolimit')){_0x52e092[_0xc2f5('0x20')]=qs[_0xc2f5('0x20')](_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x20')]);_0x52e092[_0xc2f5('0x1e')]=qs[_0xc2f5('0x1e')](_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x1e')]);}_0x52e092[_0xc2f5('0x3c')]=qs[_0xc2f5('0x3d')](_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x3d')]);_0x52e092[_0xc2f5('0x3e')]=qs[_0xc2f5('0x3f')](_[_0xc2f5('0x40')](_0x2e565d['query'],_0x1224c3[_0xc2f5('0x3f')]),_0x38cdb9);if(_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x41')]){_0x52e092['where']=_[_0xc2f5('0x42')](_0x52e092[_0xc2f5('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x41')]+'%'}},{'value':{'$like':'%'+_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x41')]+'%'}}]});}_0x52e092=_[_0xc2f5('0x42')]({},_0x52e092,_0x2e565d[_0xc2f5('0x43')]);var _0x11c779={'where':_0x52e092[_0xc2f5('0x3e')]};return db[_0xc2f5('0x33')][_0xc2f5('0x21')](_0x11c779)['then'](function(_0x513598){_0x50f74a[_0xc2f5('0x21')]=_0x513598;if(_0x2e565d[_0xc2f5('0x37')][_0xc2f5('0x44')]){_0x52e092[_0xc2f5('0x45')]=[{'all':!![]}];}return db[_0xc2f5('0x33')][_0xc2f5('0x46')](_0x52e092);})[_0xc2f5('0x2a')](function(_0x54f078){_0x50f74a[_0xc2f5('0x47')]=_0x54f078;return _0x50f74a;})['then'](respondWithFilteredResult(_0x311ea8,_0x52e092))[_0xc2f5('0x48')](handleError(_0x311ea8,null));};exports[_0xc2f5('0x49')]=function(_0xbabda1,_0x428846){var _0x4d91e7={'raw':!![],'where':{'id':_0xbabda1[_0xc2f5('0x4a')]['id']}},_0x343729={};_0x343729[_0xc2f5('0x36')]=_[_0xc2f5('0x38')](db[_0xc2f5('0x33')][_0xc2f5('0x4b')]);_0x343729[_0xc2f5('0x37')]=_['keys'](_0xbabda1[_0xc2f5('0x37')]);_0x343729[_0xc2f5('0x3f')]=_['intersection'](_0x343729[_0xc2f5('0x36')],_0x343729['query']);_0x4d91e7[_0xc2f5('0x3a')]=_['intersection'](_0x343729[_0xc2f5('0x36')],qs[_0xc2f5('0x3b')](_0xbabda1[_0xc2f5('0x37')][_0xc2f5('0x3b')]));_0x4d91e7[_0xc2f5('0x3a')]=_0x4d91e7[_0xc2f5('0x3a')][_0xc2f5('0x4c')]?_0x4d91e7[_0xc2f5('0x3a')]:_0x343729[_0xc2f5('0x36')];if(_0xbabda1[_0xc2f5('0x37')][_0xc2f5('0x44')]){_0x4d91e7['include']=[{'all':!![]}];}_0x4d91e7=_['merge']({},_0x4d91e7,_0xbabda1[_0xc2f5('0x43')]);return db[_0xc2f5('0x33')][_0xc2f5('0x4d')](_0x4d91e7)['then'](handleEntityNotFound(_0x428846,null))[_0xc2f5('0x2a')](respondWithResult(_0x428846,null))[_0xc2f5('0x48')](handleError(_0x428846,null));};exports['update']=function(_0x30ace8,_0x1f792c){if(_0x30ace8['body']['id']){delete _0x30ace8[_0xc2f5('0x4e')]['id'];}return db[_0xc2f5('0x33')][_0xc2f5('0x4d')]({'where':{'id':_0x30ace8['params']['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x1f792c,null))[_0xc2f5('0x2a')](saveUpdates(_0x30ace8[_0xc2f5('0x4e')],null))[_0xc2f5('0x2a')](respondWithResult(_0x1f792c,null))['catch'](handleError(_0x1f792c,null));};exports[_0xc2f5('0x29')]=function(_0x4f9643,_0x4b44a1){return db[_0xc2f5('0x33')][_0xc2f5('0x4d')]({'where':{'id':_0x4f9643[_0xc2f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b44a1,null))[_0xc2f5('0x2a')](removeEntity(_0x4b44a1,null))[_0xc2f5('0x48')](handleError(_0x4b44a1,null));};exports[_0xc2f5('0x4f')]=function(_0x30ee67,_0x4efc02){var _0x1eb23d={'key':_0x30ee67[_0xc2f5('0x4e')]['key']};if(_0x30ee67['body'][_0xc2f5('0x50')]){_0x1eb23d[_0xc2f5('0x50')]=_0x30ee67['body']['MailAccountId'];}else if(_0x30ee67[_0xc2f5('0x4e')][_0xc2f5('0x51')]){_0x1eb23d[_0xc2f5('0x51')]=_0x30ee67[_0xc2f5('0x4e')][_0xc2f5('0x51')];}else if(_0x30ee67[_0xc2f5('0x4e')]['OpenchannelAccountId']){_0x1eb23d['OpenchannelAccountId']=_0x30ee67[_0xc2f5('0x4e')][_0xc2f5('0x52')];}else if(_0x30ee67[_0xc2f5('0x4e')]['ChatWebsiteId']){_0x1eb23d[_0xc2f5('0x53')]=_0x30ee67[_0xc2f5('0x4e')][_0xc2f5('0x53')];}return db[_0xc2f5('0x33')][_0xc2f5('0x4d')]({'where':_0x1eb23d})[_0xc2f5('0x2a')](function(_0x17d116){if(_0x17d116){throw new db['Sequelize'][(_0xc2f5('0x54'))](_0xc2f5('0x55'));}return db['CannedAnswer'][_0xc2f5('0x4f')](_0x30ee67[_0xc2f5('0x4e')]);})['then'](function(_0x3cbea1){var _0xef8233=_0x30ee67[_0xc2f5('0x56')][_0xc2f5('0x2b')]({'plain':!![]});if(!_0xef8233)throw new Error(_0xc2f5('0x57'));if(_0xef8233[_0xc2f5('0x58')]===_0xc2f5('0x56')){var _0x31ee2f=_0x3cbea1[_0xc2f5('0x2b')]({'plain':!![]});return db[_0xc2f5('0x59')]['find']({'where':{'name':_0xc2f5('0x2c'),'userProfileId':_0xef8233[_0xc2f5('0x5a')]},'raw':!![]})['then'](function(_0x5e71bc){if(_0x5e71bc&&_0x5e71bc[_0xc2f5('0x5b')]===0x0){return db[_0xc2f5('0x5c')][_0xc2f5('0x4f')]({'name':_0x31ee2f[_0xc2f5('0x30')],'resourceId':_0x31ee2f['id'],'type':_0x5e71bc[_0xc2f5('0x30')],'sectionId':_0x5e71bc['id']},{})[_0xc2f5('0x2a')](function(){return _0x3cbea1;});}else{return _0x3cbea1;}})['catch'](function(_0x2378de){logger[_0xc2f5('0x2e')](_0xc2f5('0x5d'),_0x2378de);throw _0x2378de;});}return _0x3cbea1;})[_0xc2f5('0x2a')](respondWithResult(_0x4efc02,0xc9))[_0xc2f5('0x48')](handleError(_0x4efc02,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a894512..26d5470 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 _0xa264=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x40a529,_0x1ac70a){var _0x1936a8=function(_0x1a46b8){while(--_0x1a46b8){_0x40a529['push'](_0x40a529['shift']());}};_0x1936a8(++_0x1ac70a);}(_0xa264,0x1d3));var _0x4a26=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xa264[_0x479160];return _0x47ac6d;};'use strict';var _=require(_0x4a26('0x0'));var util=require('util');var logger=require(_0x4a26('0x1'))(_0x4a26('0x2'));var moment=require('moment');var BPromise=require(_0x4a26('0x3'));var rp=require(_0x4a26('0x4'));var fs=require('fs');var path=require(_0x4a26('0x5'));var rimraf=require(_0x4a26('0x6'));var config=require(_0x4a26('0x7'));var attributes=require(_0x4a26('0x8'));module[_0x4a26('0x9')]=function(_0x528fc6,_0x4cab68){return _0x528fc6[_0x4a26('0xa')](_0x4a26('0xb'),attributes,{'tableName':_0x4a26('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a26('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa1aa=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2ccc17,_0x2c9375){var _0x37f5d4=function(_0x13cef8){while(--_0x13cef8){_0x2ccc17['push'](_0x2ccc17['shift']());}};_0x37f5d4(++_0x2c9375);}(_0xa1aa,0x81));var _0xaa1a=function(_0x3c7b8a,_0x3b0327){_0x3c7b8a=_0x3c7b8a-0x0;var _0x3d386a=_0xa1aa[_0x3c7b8a];return _0x3d386a;};'use strict';var _=require(_0xaa1a('0x0'));var util=require(_0xaa1a('0x1'));var logger=require(_0xaa1a('0x2'))('api');var moment=require(_0xaa1a('0x3'));var BPromise=require(_0xaa1a('0x4'));var rp=require(_0xaa1a('0x5'));var fs=require('fs');var path=require(_0xaa1a('0x6'));var rimraf=require(_0xaa1a('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa1a('0x8'));module[_0xaa1a('0x9')]=function(_0x4d916c,_0x1cd007){return _0x4d916c[_0xaa1a('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa1a('0xb'),'collate':_0xaa1a('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f659542..d73c8f1 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(_0x22466b,_0x266fad){var _0xa00c5e=function(_0x42c503){while(--_0x42c503){_0x22466b['push'](_0x22466b['shift']());}};_0xa00c5e(++_0x266fad);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x59c4df,_0x3b2b0f){var _0x5a4cb3=function(_0x1a8a74){while(--_0x1a8a74){_0x59c4df['push'](_0x59c4df['shift']());}};_0x5a4cb3(++_0x3b2b0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 4daa978..fb0a562 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 _0x4921=['put','update','/:id','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x5f9810,_0x1cb048){var _0x318fae=function(_0x26d5db){while(--_0x26d5db){_0x5f9810['push'](_0x5f9810['shift']());}};_0x318fae(++_0x1cb048);}(_0x4921,0x1d4));var _0x1492=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x4921[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0x1492('0x0'));var util=require(_0x1492('0x1'));var path=require('path');var timeout=require(_0x1492('0x2'));var express=require(_0x1492('0x3'));var router=express['Router']();var fs_extra=require(_0x1492('0x4'));var auth=require(_0x1492('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1492('0x6'));var controller=require('./cannedAnswer.controller');router[_0x1492('0x7')]('/',auth[_0x1492('0x8')](),controller[_0x1492('0x9')]);router[_0x1492('0x7')]('/:id',auth[_0x1492('0x8')](),controller[_0x1492('0xa')]);router[_0x1492('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1492('0xc')]('/:id',auth[_0x1492('0x8')](),controller[_0x1492('0xd')]);router['delete'](_0x1492('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x1492('0xf')]=router; \ No newline at end of file +var _0xfbbd=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x420e4d,_0x1b7e89){var _0x208c8e=function(_0x3246c0){while(--_0x3246c0){_0x420e4d['push'](_0x420e4d['shift']());}};_0x208c8e(++_0x1b7e89);}(_0xfbbd,0x154));var _0xdfbb=function(_0x41ca24,_0x5415d1){_0x41ca24=_0x41ca24-0x0;var _0xb562cf=_0xfbbd[_0x41ca24];return _0xb562cf;};'use strict';var multer=require(_0xdfbb('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(_0xdfbb('0x1'));var auth=require(_0xdfbb('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0xdfbb('0x3')]('/',auth[_0xdfbb('0x4')](),controller[_0xdfbb('0x5')]);router[_0xdfbb('0x3')](_0xdfbb('0x6'),auth[_0xdfbb('0x4')](),controller[_0xdfbb('0x7')]);router[_0xdfbb('0x8')]('/',auth[_0xdfbb('0x4')](),controller[_0xdfbb('0x9')]);router[_0xdfbb('0xa')]('/:id',auth[_0xdfbb('0x4')](),controller[_0xdfbb('0xb')]);router[_0xdfbb('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xdfbb('0xd')]);module[_0xdfbb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 43389de..57c8b84 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 _0x1bb2=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x1bb2,0x152));var _0x21bb=function(_0x55825c,_0x37b078){_0x55825c=_0x55825c-0x0;var _0x32a9ed=_0x1bb2[_0x55825c];return _0x32a9ed;};'use strict';var Sequelize=require('sequelize');module[_0x21bb('0x0')]={'calldate':{'type':Sequelize[_0x21bb('0x1')],'allowNull':![],'defaultValue':_0x21bb('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x21bb('0x3')]},'dcontext':{'type':Sequelize[_0x21bb('0x3')]},'channel':{'type':Sequelize[_0x21bb('0x3')]},'dstchannel':{'type':Sequelize[_0x21bb('0x3')]},'lastapp':{'type':Sequelize[_0x21bb('0x3')]},'lastdata':{'type':Sequelize[_0x21bb('0x3')]},'duration':{'type':Sequelize[_0x21bb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x21bb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x21bb('0x3')]},'amaflags':{'type':Sequelize[_0x21bb('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x21bb('0x3')]},'userfield':{'type':Sequelize[_0x21bb('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x21bb('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x21bb('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f0d=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x42a3d4,_0x2d5cda){var _0x102b3d=function(_0x28a3c6){while(--_0x28a3c6){_0x42a3d4['push'](_0x42a3d4['shift']());}};_0x102b3d(++_0x2d5cda);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x144345,_0x317f74){_0x144345=_0x144345-0x0;var _0x6fb2aa=_0x6f0d[_0x144345];return _0x6fb2aa;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'calldate':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![],'defaultValue':_0xd6f0('0x2')},'clid':{'type':Sequelize[_0xd6f0('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xd6f0('0x3')]},'dcontext':{'type':Sequelize[_0xd6f0('0x3')]},'channel':{'type':Sequelize[_0xd6f0('0x3')]},'dstchannel':{'type':Sequelize[_0xd6f0('0x3')]},'lastapp':{'type':Sequelize[_0xd6f0('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd6f0('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd6f0('0x3')]},'amaflags':{'type':Sequelize[_0xd6f0('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd6f0('0x3')]},'userfield':{'type':Sequelize[_0xd6f0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xd6f0('0x3')]},'peeraccount':{'type':Sequelize[_0xd6f0('0x3')]},'type':{'type':Sequelize[_0xd6f0('0x3')]},'tag':{'type':Sequelize[_0xd6f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3e2ce8d..0beff53 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 _0x8958=['describe','rimraf','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','Cdr','includeAll','include','findAll','merge','find','catch','create','body','params'];(function(_0x58ebf8,_0x416386){var _0x17f9a0=function(_0x535d42){while(--_0x535d42){_0x58ebf8['push'](_0x58ebf8['shift']());}};_0x17f9a0(++_0x416386);}(_0x8958,0x93));var _0x8895=function(_0x1105ad,_0x374846){_0x1105ad=_0x1105ad-0x0;var _0x283bfd=_0x8958[_0x1105ad];return _0x283bfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['Cdr']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['map'](_0x16b65b,_0x8895('0x26'));_0x37ac3a['query']=_[_0x8895('0x2e')](_0x5c03ea['query']);_0x37ac3a[_0x8895('0x2f')]=_[_0x8895('0x30')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a[_0x8895('0x31')]);_0x6e449d[_0x8895('0x32')]=_['intersection'](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x33')](_0x5c03ea[_0x8895('0x31')][_0x8895('0x33')]));_0x6e449d[_0x8895('0x32')]=_0x6e449d['attributes'][_0x8895('0x34')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea['query'][_0x8895('0x35')](_0x8895('0x36'))){_0x6e449d[_0x8895('0x1d')]=qs[_0x8895('0x1d')](_0x5c03ea[_0x8895('0x31')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs['offset'](_0x5c03ea[_0x8895('0x31')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x37')]=qs[_0x8895('0x38')](_0x5c03ea[_0x8895('0x31')][_0x8895('0x38')]);_0x6e449d['where']=qs[_0x8895('0x2f')](_[_0x8895('0x39')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x2f')]),_0x16b65b);if(_0x5c03ea['query'][_0x8895('0x3a')]){_0x6e449d[_0x8895('0x3b')]=_['merge'](_0x6e449d[_0x8895('0x3b')],{'$or':_[_0x8895('0x29')](_0x16b65b,function(_0x5b7204){if(_0x5b7204['type']!==_0x8895('0x3c')){var _0xf0b378={};_0xf0b378[_0x5b7204[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea[_0x8895('0x31')][_0x8895('0x3a')]+'%'};return _0xf0b378;}})});}_0x6e449d=_['merge']({},_0x6e449d,_0x5c03ea[_0x8895('0x3d')]);var _0x25c854={'where':_0x6e449d[_0x8895('0x3b')]};return db[_0x8895('0x3e')][_0x8895('0x1e')](_0x25c854)[_0x8895('0x24')](function(_0x4a7e22){_0x3fc4cc[_0x8895('0x1e')]=_0x4a7e22;if(_0x5c03ea['query'][_0x8895('0x3f')]){_0x6e449d[_0x8895('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x8895('0x41')](_0x6e449d);})['then'](function(_0x1e6395){_0x3fc4cc['rows']=_0x1e6395;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x4881d0,_0x47cf10){var _0x447ed6={'raw':!![],'where':{'id':_0x4881d0['params']['id']}},_0x206f57={};_0x206f57['model']=_[_0x8895('0x2e')](db[_0x8895('0x3e')]['rawAttributes']);_0x206f57[_0x8895('0x31')]=_[_0x8895('0x2e')](_0x4881d0[_0x8895('0x31')]);_0x206f57[_0x8895('0x2f')]=_[_0x8895('0x30')](_0x206f57['model'],_0x206f57['query']);_0x447ed6['attributes']=_[_0x8895('0x30')](_0x206f57['model'],qs[_0x8895('0x33')](_0x4881d0[_0x8895('0x31')][_0x8895('0x33')]));_0x447ed6[_0x8895('0x32')]=_0x447ed6['attributes'][_0x8895('0x34')]?_0x447ed6[_0x8895('0x32')]:_0x206f57[_0x8895('0x2d')];if(_0x4881d0[_0x8895('0x31')][_0x8895('0x3f')]){_0x447ed6[_0x8895('0x40')]=[{'all':!![]}];}_0x447ed6=_[_0x8895('0x42')]({},_0x447ed6,_0x4881d0[_0x8895('0x3d')]);return db['Cdr'][_0x8895('0x43')](_0x447ed6)[_0x8895('0x24')](handleEntityNotFound(_0x47cf10,null))['then'](respondWithResult(_0x47cf10,null))[_0x8895('0x44')](handleError(_0x47cf10,null));};exports['create']=function(_0x5829ec,_0x13546d){return db[_0x8895('0x3e')][_0x8895('0x45')](_0x5829ec['body'],{})[_0x8895('0x24')](respondWithResult(_0x13546d,0xc9))['catch'](handleError(_0x13546d,null));};exports[_0x8895('0x23')]=function(_0x152197,_0xb3ecd6){if(_0x152197[_0x8895('0x46')]['id']){delete _0x152197[_0x8895('0x46')]['id'];}return db[_0x8895('0x3e')][_0x8895('0x43')]({'where':{'id':_0x152197['params']['id']}})['then'](handleEntityNotFound(_0xb3ecd6,null))[_0x8895('0x24')](saveUpdates(_0x152197[_0x8895('0x46')],null))['then'](respondWithResult(_0xb3ecd6,null))[_0x8895('0x44')](handleError(_0xb3ecd6,null));};exports['destroy']=function(_0x4e8af3,_0x2daafe){return db['Cdr'][_0x8895('0x43')]({'where':{'id':_0x4e8af3[_0x8895('0x47')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2daafe,null))[_0x8895('0x24')](removeEntity(_0x2daafe,null))[_0x8895('0x44')](handleError(_0x2daafe,null));};exports[_0x8895('0x48')]=function(_0x306481,_0x38d6ae){return db['Cdr'][_0x8895('0x48')]()[_0x8895('0x24')](respondWithResult(_0x38d6ae,null))[_0x8895('0x44')](handleError(_0x38d6ae,null));}; \ No newline at end of file +var _0xfc17=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x539999,_0x2435a2){var _0xff9180=function(_0x3c51c2){while(--_0x3c51c2){_0x539999['push'](_0x539999['shift']());}};_0xff9180(++_0x2435a2);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x376510,_0x47a195){_0x376510=_0x376510-0x0;var _0x109fd4=_0xfc17[_0x376510];return _0x109fd4;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var jsonpatch=require(_0x7fc1('0x3'));var rp=require('request-promise');var moment=require(_0x7fc1('0x4'));var BPromise=require(_0x7fc1('0x5'));var Mustache=require(_0x7fc1('0x6'));var util=require(_0x7fc1('0x7'));var path=require(_0x7fc1('0x8'));var sox=require(_0x7fc1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fc1('0xa'));var fs=require('fs');var fs_extra=require(_0x7fc1('0xb'));var _=require(_0x7fc1('0xc'));var squel=require(_0x7fc1('0xd'));var crypto=require(_0x7fc1('0xe'));var jsforce=require(_0x7fc1('0xf'));var deskjs=require(_0x7fc1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fc1('0x11'));var Papa=require(_0x7fc1('0x12'));var Redis=require(_0x7fc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x15'))(_0x7fc1('0x16'));var utils=require(_0x7fc1('0x17'));var config=require(_0x7fc1('0x18'));var licenseUtil=require(_0x7fc1('0x19'));var db=require(_0x7fc1('0x1a'))['db'];function respondWithStatusCode(_0x53277f,_0x3a7c8e){_0x3a7c8e=_0x3a7c8e||0xcc;return function(_0x902325){if(_0x902325){return _0x53277f[_0x7fc1('0x1b')](_0x3a7c8e);}return _0x53277f[_0x7fc1('0x1c')](_0x3a7c8e)[_0x7fc1('0x1d')]();};}function respondWithResult(_0x5651f2,_0x54a204){_0x54a204=_0x54a204||0xc8;return function(_0x881462){if(_0x881462){return _0x5651f2[_0x7fc1('0x1c')](_0x54a204)[_0x7fc1('0x1e')](_0x881462);}};}function respondWithFilteredResult(_0x391de7,_0x432825){return function(_0x3c4671){if(_0x3c4671){var _0x3d8e82=typeof _0x432825[_0x7fc1('0x1f')]===_0x7fc1('0x20')&&typeof _0x432825[_0x7fc1('0x21')]==='undefined';var _0x419170=_0x3c4671['count'];var _0x30fc04=_0x3d8e82?0x0:_0x432825[_0x7fc1('0x1f')];var _0x535ae1=_0x3d8e82?_0x3c4671[_0x7fc1('0x22')]:_0x432825[_0x7fc1('0x1f')]+_0x432825['limit'];var _0x25d384;if(_0x535ae1>=_0x419170){_0x535ae1=_0x419170;_0x25d384=0xc8;}else{_0x25d384=0xce;}_0x391de7[_0x7fc1('0x1c')](_0x25d384);return _0x391de7[_0x7fc1('0x23')](_0x7fc1('0x24'),_0x30fc04+'-'+_0x535ae1+'/'+_0x419170)[_0x7fc1('0x1e')](_0x3c4671);}return null;};}function patchUpdates(_0x1c249d){return function(_0x3e7c92){try{jsonpatch[_0x7fc1('0x25')](_0x3e7c92,_0x1c249d,!![]);}catch(_0x327569){return BPromise[_0x7fc1('0x26')](_0x327569);}return _0x3e7c92['save']();};}function saveUpdates(_0x49a44f,_0x2390b8){return function(_0x5e10cd){if(_0x5e10cd){return _0x5e10cd[_0x7fc1('0x27')](_0x49a44f)[_0x7fc1('0x28')](function(_0x253ae9){return _0x253ae9;});}return null;};}function removeEntity(_0x3683f4,_0x56c5d6){return function(_0x38b5b5){if(_0x38b5b5){return _0x38b5b5[_0x7fc1('0x29')]()[_0x7fc1('0x28')](function(){_0x3683f4['status'](0xcc)[_0x7fc1('0x1d')]();});}};}function handleEntityNotFound(_0x252b18,_0x5ddc11){return function(_0x4b24d6){if(!_0x4b24d6){_0x252b18[_0x7fc1('0x1b')](0x194);}return _0x4b24d6;};}function handleError(_0x293a2a,_0x1f58ca){_0x1f58ca=_0x1f58ca||0x1f4;return function(_0x2ae7db){logger['error'](_0x2ae7db[_0x7fc1('0x2a')]);if(_0x2ae7db[_0x7fc1('0x2b')]){delete _0x2ae7db[_0x7fc1('0x2b')];}_0x293a2a[_0x7fc1('0x1c')](_0x1f58ca)['send'](_0x2ae7db);};}exports[_0x7fc1('0x2c')]=function(_0x583e60,_0x1f7fce){var _0x22a3c1={},_0x34ec70={},_0x231913={'count':0x0,'rows':[]};var _0x2317f5=_['map'](db[_0x7fc1('0x2d')]['rawAttributes'],function(_0x55b4f1){return{'name':_0x55b4f1[_0x7fc1('0x2e')],'type':_0x55b4f1[_0x7fc1('0x2f')][_0x7fc1('0x30')]};});_0x34ec70[_0x7fc1('0x31')]=_[_0x7fc1('0x32')](_0x2317f5,_0x7fc1('0x2b'));_0x34ec70[_0x7fc1('0x33')]=_[_0x7fc1('0x34')](_0x583e60[_0x7fc1('0x33')]);_0x34ec70[_0x7fc1('0x35')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],_0x34ec70[_0x7fc1('0x33')]);_0x22a3c1[_0x7fc1('0x37')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],qs['fields'](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x22a3c1[_0x7fc1('0x37')]=_0x22a3c1[_0x7fc1('0x37')][_0x7fc1('0x39')]?_0x22a3c1[_0x7fc1('0x37')]:_0x34ec70['model'];if(!_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3a')]('nolimit')){_0x22a3c1[_0x7fc1('0x21')]=qs[_0x7fc1('0x21')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x21')]);_0x22a3c1[_0x7fc1('0x1f')]=qs['offset'](_0x583e60['query'][_0x7fc1('0x1f')]);}_0x22a3c1[_0x7fc1('0x3b')]=qs[_0x7fc1('0x3c')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3c')]);_0x22a3c1[_0x7fc1('0x3d')]=qs[_0x7fc1('0x35')](_[_0x7fc1('0x3e')](_0x583e60['query'],_0x34ec70[_0x7fc1('0x35')]),_0x2317f5);if(_0x583e60[_0x7fc1('0x33')]['filter']){_0x22a3c1[_0x7fc1('0x3d')]=_[_0x7fc1('0x3f')](_0x22a3c1[_0x7fc1('0x3d')],{'$or':_['map'](_0x2317f5,function(_0x57ef4c){if(_0x57ef4c[_0x7fc1('0x2f')]!==_0x7fc1('0x40')){var _0xafc8b0={};_0xafc8b0[_0x57ef4c['name']]={'$like':'%'+_0x583e60['query']['filter']+'%'};return _0xafc8b0;}})});}_0x22a3c1=_[_0x7fc1('0x3f')]({},_0x22a3c1,_0x583e60[_0x7fc1('0x41')]);var _0x32607c={'where':_0x22a3c1[_0x7fc1('0x3d')]};return db['Cdr']['count'](_0x32607c)[_0x7fc1('0x28')](function(_0xf26d98){_0x231913[_0x7fc1('0x22')]=_0xf26d98;if(_0x583e60['query']['includeAll']){_0x22a3c1['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x22a3c1);})[_0x7fc1('0x28')](function(_0x54749f){_0x231913[_0x7fc1('0x42')]=_0x54749f;return _0x231913;})[_0x7fc1('0x28')](respondWithFilteredResult(_0x1f7fce,_0x22a3c1))['catch'](handleError(_0x1f7fce,null));};exports[_0x7fc1('0x43')]=function(_0x16ad03,_0x111d51){var _0x3282dd={'raw':!![],'where':{'id':_0x16ad03[_0x7fc1('0x44')]['id']}},_0x56b853={};_0x56b853['model']=_[_0x7fc1('0x34')](db[_0x7fc1('0x2d')][_0x7fc1('0x45')]);_0x56b853[_0x7fc1('0x33')]=_['keys'](_0x16ad03[_0x7fc1('0x33')]);_0x56b853[_0x7fc1('0x35')]=_['intersection'](_0x56b853[_0x7fc1('0x31')],_0x56b853[_0x7fc1('0x33')]);_0x3282dd['attributes']=_[_0x7fc1('0x36')](_0x56b853[_0x7fc1('0x31')],qs['fields'](_0x16ad03[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x3282dd[_0x7fc1('0x37')]=_0x3282dd['attributes'][_0x7fc1('0x39')]?_0x3282dd[_0x7fc1('0x37')]:_0x56b853[_0x7fc1('0x31')];if(_0x16ad03[_0x7fc1('0x33')]['includeAll']){_0x3282dd['include']=[{'all':!![]}];}_0x3282dd=_[_0x7fc1('0x3f')]({},_0x3282dd,_0x16ad03[_0x7fc1('0x41')]);return db[_0x7fc1('0x2d')][_0x7fc1('0x46')](_0x3282dd)[_0x7fc1('0x28')](handleEntityNotFound(_0x111d51,null))[_0x7fc1('0x28')](respondWithResult(_0x111d51,null))[_0x7fc1('0x47')](handleError(_0x111d51,null));};exports[_0x7fc1('0x48')]=function(_0x419ea1,_0x4c4606){return db['Cdr']['create'](_0x419ea1[_0x7fc1('0x49')],{})[_0x7fc1('0x28')](respondWithResult(_0x4c4606,0xc9))[_0x7fc1('0x47')](handleError(_0x4c4606,null));};exports[_0x7fc1('0x27')]=function(_0x4bcd63,_0xafd821){if(_0x4bcd63[_0x7fc1('0x49')]['id']){delete _0x4bcd63[_0x7fc1('0x49')]['id'];}return db[_0x7fc1('0x2d')]['find']({'where':{'id':_0x4bcd63[_0x7fc1('0x44')]['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0xafd821,null))[_0x7fc1('0x28')](saveUpdates(_0x4bcd63[_0x7fc1('0x49')],null))[_0x7fc1('0x28')](respondWithResult(_0xafd821,null))[_0x7fc1('0x47')](handleError(_0xafd821,null));};exports[_0x7fc1('0x29')]=function(_0x4d27db,_0x3d5f40){return db['Cdr'][_0x7fc1('0x46')]({'where':{'id':_0x4d27db['params']['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0x3d5f40,null))[_0x7fc1('0x28')](removeEntity(_0x3d5f40,null))['catch'](handleError(_0x3d5f40,null));};exports[_0x7fc1('0x4a')]=function(_0x3b492a,_0x509959){return db[_0x7fc1('0x2d')][_0x7fc1('0x4a')]()[_0x7fc1('0x28')](respondWithResult(_0x509959,null))[_0x7fc1('0x47')](handleError(_0x509959,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4cb2613..4453bc1 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(_0x53a316,_0xf26b8f){var _0x37c0df=function(_0x1220b0){while(--_0x1220b0){_0x53a316['push'](_0x53a316['shift']());}};_0x37c0df(++_0xf26b8f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4f5ca2,_0x4a3f73){var _0x3723e1=function(_0x5b0a7b){while(--_0x5b0a7b){_0x4f5ca2['push'](_0x4f5ca2['shift']());}};_0x3723e1(++_0x4a3f73);}(_0x7a54,0x106));var _0x47a5=function(_0x2b311f,_0x1ca7e3){_0x2b311f=_0x2b311f-0x0;var _0x2ff4db=_0x7a54[_0x2b311f];return _0x2ff4db;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 74d09bf..33a021f 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 _0x711a=['client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0xb2120f,_0x1e23c1){var _0x3b8dd9=function(_0xa8dafe){while(--_0xa8dafe){_0xb2120f['push'](_0xb2120f['shift']());}};_0x3b8dd9(++_0x1e23c1);}(_0x711a,0xf5));var _0xa711=function(_0x165b12,_0x4aff80){_0x165b12=_0x165b12-0x0;var _0x378222=_0x711a[_0x165b12];return _0x378222;};'use strict';var _=require('lodash');var util=require(_0xa711('0x0'));var moment=require('moment');var BPromise=require(_0xa711('0x1'));var rs=require(_0xa711('0x2'));var fs=require('fs');var Redis=require(_0xa711('0x3'));var db=require(_0xa711('0x4'))['db'];var utils=require(_0xa711('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa711('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa711('0x7')][_0xa711('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256113,_0x43080a,_0x4daae4){return new BPromise(function(_0x4f8d44,_0x19f618){return client[_0xa711('0x9')](_0x256113,_0x4daae4)[_0xa711('0xa')](function(_0x153ece){logger['info'](_0xa711('0xb'),_0x43080a,_0xa711('0xc'));logger[_0xa711('0xd')](_0xa711('0xe'),_0x43080a,'request\x20sent',JSON[_0xa711('0xf')](_0x153ece));if(_0x153ece['error']){if(_0x153ece['error'][_0xa711('0x10')]===0x1f4){logger['error'](_0xa711('0xb'),_0x43080a,_0x153ece[_0xa711('0x11')][_0xa711('0x12')]);return _0x19f618(_0x153ece['error'][_0xa711('0x12')]);}logger['error'](_0xa711('0xb'),_0x43080a,_0x153ece[_0xa711('0x11')][_0xa711('0x12')]);return _0x4f8d44(_0x153ece['error'][_0xa711('0x12')]);}else{logger[_0xa711('0x13')](_0xa711('0xb'),_0x43080a,_0xa711('0xc'));_0x4f8d44(_0x153ece[_0xa711('0x14')]['message']);}})['catch'](function(_0x105483){logger[_0xa711('0x11')]('Cdr,\x20%s,\x20%s',_0x43080a,_0x105483);_0x19f618(_0x105483);});});} \ No newline at end of file +var _0x1eae=['code','message','Cdr,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','error'];(function(_0x2ddb1d,_0x5673bd){var _0xb678f9=function(_0x43a33d){while(--_0x43a33d){_0x2ddb1d['push'](_0x2ddb1d['shift']());}};_0xb678f9(++_0x5673bd);}(_0x1eae,0x103));var _0xe1ea=function(_0x12121d,_0x215e27){_0x12121d=_0x12121d-0x0;var _0x4c42ae=_0x1eae[_0x12121d];return _0x4c42ae;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe1ea('0x5'))['db'];var utils=require(_0xe1ea('0x6'));var logger=require(_0xe1ea('0x7'))(_0xe1ea('0x8'));var config=require(_0xe1ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe1ea('0xa')][_0xe1ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3adbba,_0x591f98,_0x10124b){return new BPromise(function(_0x421b00,_0x2ce9c6){return client[_0xe1ea('0xc')](_0x3adbba,_0x10124b)[_0xe1ea('0xd')](function(_0x3db243){logger['info']('Cdr,\x20%s,\x20%s',_0x591f98,'request\x20sent');logger[_0xe1ea('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x591f98,_0xe1ea('0xf'),JSON['stringify'](_0x3db243));if(_0x3db243['error']){if(_0x3db243[_0xe1ea('0x10')][_0xe1ea('0x11')]===0x1f4){logger[_0xe1ea('0x10')]('Cdr,\x20%s,\x20%s',_0x591f98,_0x3db243[_0xe1ea('0x10')][_0xe1ea('0x12')]);return _0x2ce9c6(_0x3db243[_0xe1ea('0x10')][_0xe1ea('0x12')]);}logger[_0xe1ea('0x10')](_0xe1ea('0x13'),_0x591f98,_0x3db243[_0xe1ea('0x10')]['message']);return _0x421b00(_0x3db243[_0xe1ea('0x10')]['message']);}else{logger[_0xe1ea('0x14')](_0xe1ea('0x13'),_0x591f98,_0xe1ea('0xf'));_0x421b00(_0x3db243[_0xe1ea('0x15')][_0xe1ea('0x12')]);}})[_0xe1ea('0x16')](function(_0x28a69b){logger[_0xe1ea('0x10')](_0xe1ea('0x13'),_0x591f98,_0x28a69b);_0x2ce9c6(_0x28a69b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2b40ed0..a1d93dd 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 _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(_0x54820c,_0xd5a2f6){var _0x5c60c1=function(_0x495680){while(--_0x495680){_0x54820c['push'](_0x54820c['shift']());}};_0x5c60c1(++_0xd5a2f6);}(_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'));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 +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(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 757a463..8e16938 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 _0xe59b=['noop','TEXT','STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe59b,0x1de));var _0xbe59=function(_0x52253f,_0x1def94){_0x52253f=_0x52253f-0x0;var _0x462d99=_0xe59b[_0x52253f];return _0x462d99;};'use strict';var Sequelize=require(_0xbe59('0x0'));module[_0xbe59('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbe59('0x2')},'appdata':{'type':Sequelize[_0xbe59('0x3')]()},'description':{'type':Sequelize[_0xbe59('0x4')]},'interval':{'type':Sequelize[_0xbe59('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xdf01=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x25168b,_0x4ea135){var _0x40ef93=function(_0x46b4b3){while(--_0x46b4b3){_0x25168b['push'](_0x25168b['shift']());}};_0x40ef93(++_0x4ea135);}(_0xdf01,0xff));var _0x1df0=function(_0x1b7ec4,_0xacdff8){_0x1b7ec4=_0x1b7ec4-0x0;var _0x4ffa1c=_0xdf01[_0x1b7ec4];return _0x4ffa1c;};'use strict';var Sequelize=require('sequelize');module[_0x1df0('0x0')]={'priority':{'type':Sequelize[_0x1df0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1df0('0x2')],'allowNull':![],'defaultValue':_0x1df0('0x3')},'appdata':{'type':Sequelize[_0x1df0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1df0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1dd88ae..e53ad3e 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 _0x9c02=['destroy','error','stack','send','show','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','options','find','catch','update','body','params','eml-format','rimraf','zip-dir','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x9c02,0x196));var _0x29c0=function(_0x906146,_0x2ac357){_0x906146=_0x906146-0x0;var _0x225ecb=_0x9c02[_0x906146];return _0x225ecb;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require(_0x29c0('0x1'));var zipdir=require(_0x29c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require(_0x29c0('0x4'));var sox=require('sox');var csv=require(_0x29c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require(_0x29c0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29c0('0x9'));var toCsv=require(_0x29c0('0x5'));var querystring=require(_0x29c0('0xa'));var Papa=require(_0x29c0('0xb'));var Redis=require(_0x29c0('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c0('0xe'))(_0x29c0('0xf'));var utils=require(_0x29c0('0x10'));var config=require(_0x29c0('0x11'));var licenseUtil=require(_0x29c0('0x12'));var db=require(_0x29c0('0x13'))['db'];function respondWithStatusCode(_0x5b4ef2,_0x7a6a5e){_0x7a6a5e=_0x7a6a5e||0xcc;return function(_0x350922){if(_0x350922){return _0x5b4ef2[_0x29c0('0x14')](_0x7a6a5e);}return _0x5b4ef2[_0x29c0('0x15')](_0x7a6a5e)[_0x29c0('0x16')]();};}function respondWithResult(_0x28cc02,_0x1e622a){_0x1e622a=_0x1e622a||0xc8;return function(_0x2947da){if(_0x2947da){return _0x28cc02[_0x29c0('0x15')](_0x1e622a)[_0x29c0('0x17')](_0x2947da);}};}function respondWithFilteredResult(_0x4721f0,_0xccb222){return function(_0x235725){if(_0x235725){var _0x1ce122=typeof _0xccb222[_0x29c0('0x18')]===_0x29c0('0x19')&&typeof _0xccb222[_0x29c0('0x1a')]===_0x29c0('0x19');var _0x4309fc=_0x235725[_0x29c0('0x1b')];var _0x627c4c=_0x1ce122?0x0:_0xccb222[_0x29c0('0x18')];var _0x2bfa71=_0x1ce122?_0x235725[_0x29c0('0x1b')]:_0xccb222[_0x29c0('0x18')]+_0xccb222[_0x29c0('0x1a')];var _0x311c9b;if(_0x2bfa71>=_0x4309fc){_0x2bfa71=_0x4309fc;_0x311c9b=0xc8;}else{_0x311c9b=0xce;}_0x4721f0['status'](_0x311c9b);return _0x4721f0[_0x29c0('0x1c')](_0x29c0('0x1d'),_0x627c4c+'-'+_0x2bfa71+'/'+_0x4309fc)[_0x29c0('0x17')](_0x235725);}return null;};}function patchUpdates(_0x3c3eb2){return function(_0x38eab0){try{jsonpatch[_0x29c0('0x1e')](_0x38eab0,_0x3c3eb2,!![]);}catch(_0x54f8f1){return BPromise[_0x29c0('0x1f')](_0x54f8f1);}return _0x38eab0[_0x29c0('0x20')]();};}function saveUpdates(_0x45a6cb,_0x26bf2e){return function(_0x1f962f){if(_0x1f962f){return _0x1f962f['update'](_0x45a6cb)[_0x29c0('0x21')](function(_0x42b082){return _0x42b082;});}return null;};}function removeEntity(_0x5846d0,_0x1114a8){return function(_0x402c54){if(_0x402c54){return _0x402c54[_0x29c0('0x22')]()['then'](function(){_0x5846d0[_0x29c0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161b39,_0x140988){return function(_0x5561af){if(!_0x5561af){_0x161b39[_0x29c0('0x14')](0x194);}return _0x5561af;};}function handleError(_0xd7f9a8,_0x3946f8){_0x3946f8=_0x3946f8||0x1f4;return function(_0x184998){logger[_0x29c0('0x23')](_0x184998[_0x29c0('0x24')]);if(_0x184998['name']){delete _0x184998['name'];}_0xd7f9a8['status'](_0x3946f8)[_0x29c0('0x25')](_0x184998);};}exports[_0x29c0('0x26')]=function(_0x4cdf7c,_0x4aa6bd){var _0x208a5d={'raw':!![],'where':{'id':_0x4cdf7c['params']['id']}},_0x3eebaa={};_0x3eebaa['model']=_['keys'](db[_0x29c0('0x27')][_0x29c0('0x28')]);_0x3eebaa[_0x29c0('0x29')]=_['keys'](_0x4cdf7c[_0x29c0('0x29')]);_0x3eebaa[_0x29c0('0x2a')]=_['intersection'](_0x3eebaa[_0x29c0('0x2b')],_0x3eebaa[_0x29c0('0x29')]);_0x208a5d[_0x29c0('0x2c')]=_[_0x29c0('0x2d')](_0x3eebaa[_0x29c0('0x2b')],qs[_0x29c0('0x2e')](_0x4cdf7c[_0x29c0('0x29')]['fields']));_0x208a5d['attributes']=_0x208a5d[_0x29c0('0x2c')][_0x29c0('0x2f')]?_0x208a5d[_0x29c0('0x2c')]:_0x3eebaa['model'];if(_0x4cdf7c[_0x29c0('0x29')][_0x29c0('0x30')]){_0x208a5d['include']=[{'all':!![]}];}_0x208a5d=_['merge']({},_0x208a5d,_0x4cdf7c[_0x29c0('0x31')]);return db[_0x29c0('0x27')][_0x29c0('0x32')](_0x208a5d)[_0x29c0('0x21')](handleEntityNotFound(_0x4aa6bd,null))[_0x29c0('0x21')](respondWithResult(_0x4aa6bd,null))[_0x29c0('0x33')](handleError(_0x4aa6bd,null));};exports[_0x29c0('0x34')]=function(_0x566e0a,_0x315bca){if(_0x566e0a['body']['id']){delete _0x566e0a[_0x29c0('0x35')]['id'];}return db[_0x29c0('0x27')][_0x29c0('0x32')]({'where':{'id':_0x566e0a['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x315bca,null))[_0x29c0('0x21')](saveUpdates(_0x566e0a['body'],null))[_0x29c0('0x21')](respondWithResult(_0x315bca,null))[_0x29c0('0x33')](handleError(_0x315bca,null));};exports[_0x29c0('0x22')]=function(_0x28c919,_0x3a9b92){return db[_0x29c0('0x27')][_0x29c0('0x32')]({'where':{'id':_0x28c919[_0x29c0('0x36')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x3a9b92,null))[_0x29c0('0x21')](removeEntity(_0x3a9b92,null))[_0x29c0('0x33')](handleError(_0x3a9b92,null));}; \ No newline at end of file +var _0x4e61=['then','destroy','end','error','show','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x48734b,_0x34fc9e){var _0x378ae8=function(_0x1ae5cd){while(--_0x1ae5cd){_0x48734b['push'](_0x48734b['shift']());}};_0x378ae8(++_0x34fc9e);}(_0x4e61,0x8c));var _0x14e6=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x4e61[_0x234ce7];return _0x57c561;};'use strict';var emlformat=require(_0x14e6('0x0'));var rimraf=require(_0x14e6('0x1'));var zipdir=require(_0x14e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x14e6('0x3'));var BPromise=require(_0x14e6('0x4'));var Mustache=require(_0x14e6('0x5'));var util=require(_0x14e6('0x6'));var path=require(_0x14e6('0x7'));var sox=require(_0x14e6('0x8'));var csv=require(_0x14e6('0x9'));var ejs=require(_0x14e6('0xa'));var fs=require('fs');var fs_extra=require(_0x14e6('0xb'));var _=require(_0x14e6('0xc'));var squel=require(_0x14e6('0xd'));var crypto=require(_0x14e6('0xe'));var jsforce=require(_0x14e6('0xf'));var deskjs=require(_0x14e6('0x10'));var toCsv=require(_0x14e6('0x9'));var querystring=require(_0x14e6('0x11'));var Papa=require(_0x14e6('0x12'));var Redis=require(_0x14e6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x14e6('0x14'));var as=require(_0x14e6('0x15'));var hardwareService=require(_0x14e6('0x16'));var logger=require(_0x14e6('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x14e6('0x18'))['db'];function respondWithStatusCode(_0x5de0ea,_0x5a1ced){_0x5a1ced=_0x5a1ced||0xcc;return function(_0x128e45){if(_0x128e45){return _0x5de0ea[_0x14e6('0x19')](_0x5a1ced);}return _0x5de0ea[_0x14e6('0x1a')](_0x5a1ced)['end']();};}function respondWithResult(_0x3ea571,_0x23b860){_0x23b860=_0x23b860||0xc8;return function(_0xc8ead5){if(_0xc8ead5){return _0x3ea571[_0x14e6('0x1a')](_0x23b860)[_0x14e6('0x1b')](_0xc8ead5);}};}function respondWithFilteredResult(_0x5dba20,_0x36738d){return function(_0x353910){if(_0x353910){var _0x753064=typeof _0x36738d[_0x14e6('0x1c')]===_0x14e6('0x1d')&&typeof _0x36738d['limit']===_0x14e6('0x1d');var _0x48160f=_0x353910['count'];var _0x4f40b0=_0x753064?0x0:_0x36738d[_0x14e6('0x1c')];var _0x16b937=_0x753064?_0x353910[_0x14e6('0x1e')]:_0x36738d[_0x14e6('0x1c')]+_0x36738d['limit'];var _0x52693c;if(_0x16b937>=_0x48160f){_0x16b937=_0x48160f;_0x52693c=0xc8;}else{_0x52693c=0xce;}_0x5dba20[_0x14e6('0x1a')](_0x52693c);return _0x5dba20[_0x14e6('0x1f')](_0x14e6('0x20'),_0x4f40b0+'-'+_0x16b937+'/'+_0x48160f)[_0x14e6('0x1b')](_0x353910);}return null;};}function patchUpdates(_0x28f75f){return function(_0x2b8d5c){try{jsonpatch[_0x14e6('0x21')](_0x2b8d5c,_0x28f75f,!![]);}catch(_0x1add5e){return BPromise[_0x14e6('0x22')](_0x1add5e);}return _0x2b8d5c[_0x14e6('0x23')]();};}function saveUpdates(_0x20ea17,_0x4400e0){return function(_0x244bc7){if(_0x244bc7){return _0x244bc7[_0x14e6('0x24')](_0x20ea17)[_0x14e6('0x25')](function(_0x3aedac){return _0x3aedac;});}return null;};}function removeEntity(_0xacdf42,_0x129e50){return function(_0x320c2b){if(_0x320c2b){return _0x320c2b[_0x14e6('0x26')]()[_0x14e6('0x25')](function(){_0xacdf42['status'](0xcc)[_0x14e6('0x27')]();});}};}function handleEntityNotFound(_0x2a3807,_0x354b25){return function(_0x21266a){if(!_0x21266a){_0x2a3807[_0x14e6('0x19')](0x194);}return _0x21266a;};}function handleError(_0xb53f12,_0x477833){_0x477833=_0x477833||0x1f4;return function(_0x529bb7){logger[_0x14e6('0x28')](_0x529bb7['stack']);if(_0x529bb7['name']){delete _0x529bb7['name'];}_0xb53f12[_0x14e6('0x1a')](_0x477833)['send'](_0x529bb7);};}exports[_0x14e6('0x29')]=function(_0x1aef5d,_0x2b7336){var _0x5c6a39={'raw':!![],'where':{'id':_0x1aef5d[_0x14e6('0x2a')]['id']}},_0x3395b1={};_0x3395b1[_0x14e6('0x2b')]=_['keys'](db[_0x14e6('0x2c')][_0x14e6('0x2d')]);_0x3395b1[_0x14e6('0x2e')]=_[_0x14e6('0x2f')](_0x1aef5d['query']);_0x3395b1[_0x14e6('0x30')]=_['intersection'](_0x3395b1[_0x14e6('0x2b')],_0x3395b1[_0x14e6('0x2e')]);_0x5c6a39['attributes']=_[_0x14e6('0x31')](_0x3395b1[_0x14e6('0x2b')],qs[_0x14e6('0x32')](_0x1aef5d[_0x14e6('0x2e')]['fields']));_0x5c6a39[_0x14e6('0x33')]=_0x5c6a39[_0x14e6('0x33')][_0x14e6('0x34')]?_0x5c6a39[_0x14e6('0x33')]:_0x3395b1[_0x14e6('0x2b')];if(_0x1aef5d[_0x14e6('0x2e')][_0x14e6('0x35')]){_0x5c6a39['include']=[{'all':!![]}];}_0x5c6a39=_[_0x14e6('0x36')]({},_0x5c6a39,_0x1aef5d[_0x14e6('0x37')]);return db[_0x14e6('0x2c')][_0x14e6('0x38')](_0x5c6a39)['then'](handleEntityNotFound(_0x2b7336,null))[_0x14e6('0x25')](respondWithResult(_0x2b7336,null))[_0x14e6('0x39')](handleError(_0x2b7336,null));};exports[_0x14e6('0x24')]=function(_0xe07746,_0x3560cf){if(_0xe07746[_0x14e6('0x3a')]['id']){delete _0xe07746[_0x14e6('0x3a')]['id'];}return db[_0x14e6('0x2c')][_0x14e6('0x38')]({'where':{'id':_0xe07746[_0x14e6('0x2a')]['id']}})[_0x14e6('0x25')](handleEntityNotFound(_0x3560cf,null))[_0x14e6('0x25')](saveUpdates(_0xe07746['body'],null))[_0x14e6('0x25')](respondWithResult(_0x3560cf,null))[_0x14e6('0x39')](handleError(_0x3560cf,null));};exports[_0x14e6('0x26')]=function(_0x122466,_0x2bc334){return db[_0x14e6('0x2c')][_0x14e6('0x38')]({'where':{'id':_0x122466[_0x14e6('0x2a')]['id']}})[_0x14e6('0x25')](handleEntityNotFound(_0x2bc334,null))[_0x14e6('0x25')](removeEntity(_0x2bc334,null))[_0x14e6('0x39')](handleError(_0x2bc334,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 86f0c62..7ebaad4 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 _0xcb70=['rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','request-promise','path'];(function(_0x277ac1,_0x1b4e45){var _0x28db07=function(_0x57e0a6){while(--_0x57e0a6){_0x277ac1['push'](_0x277ac1['shift']());}};_0x28db07(++_0x1b4e45);}(_0xcb70,0xf3));var _0x0cb7=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xcb70[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x0cb7('0x0'));var util=require(_0x0cb7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0cb7('0x2'));var fs=require('fs');var path=require(_0x0cb7('0x3'));var rimraf=require(_0x0cb7('0x4'));var config=require(_0x0cb7('0x5'));var attributes=require(_0x0cb7('0x6'));module[_0x0cb7('0x7')]=function(_0x19a010,_0x4e5b82){return _0x19a010[_0x0cb7('0x8')](_0x0cb7('0x9'),attributes,{'tableName':_0x0cb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0cb7('0xb'),'collate':_0x0cb7('0xc')});}; \ No newline at end of file +var _0x1fe2=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x1fe2,0x72));var _0x21fe=function(_0x5c118c,_0x5e981a){_0x5c118c=_0x5c118c-0x0;var _0x111ae=_0x1fe2[_0x5c118c];return _0x111ae;};'use strict';var _=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var logger=require(_0x21fe('0x2'))('api');var moment=require(_0x21fe('0x3'));var BPromise=require(_0x21fe('0x4'));var rp=require(_0x21fe('0x5'));var fs=require('fs');var path=require(_0x21fe('0x6'));var rimraf=require(_0x21fe('0x7'));var config=require('../../config/environment');var attributes=require(_0x21fe('0x8'));module[_0x21fe('0x9')]=function(_0x32cb78,_0x12ac92){return _0x32cb78[_0x21fe('0xa')]('ChatApplication',attributes,{'tableName':_0x21fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21fe('0xc'),'collate':_0x21fe('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5e4d023..b4738d0 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 _0x7cb1=['ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cb1,0x141));var _0x17cb=function(_0x22c94b,_0x58862a){_0x22c94b=_0x22c94b-0x0;var _0x377849=_0x7cb1[_0x22c94b];return _0x377849;};'use strict';var _=require('lodash');var util=require(_0x17cb('0x0'));var moment=require(_0x17cb('0x1'));var BPromise=require(_0x17cb('0x2'));var rs=require(_0x17cb('0x3'));var fs=require('fs');var Redis=require(_0x17cb('0x4'));var db=require(_0x17cb('0x5'))['db'];var utils=require(_0x17cb('0x6'));var logger=require(_0x17cb('0x7'))(_0x17cb('0x8'));var config=require('../../config/environment');var jayson=require(_0x17cb('0x9'));var client=jayson[_0x17cb('0xa')][_0x17cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ef211,_0x36316a,_0x13172f){return new BPromise(function(_0x4280c2,_0xfc3c3e){return client[_0x17cb('0xc')](_0x5ef211,_0x13172f)[_0x17cb('0xd')](function(_0x2a80d9){logger[_0x17cb('0xe')](_0x17cb('0xf'),_0x36316a,'request\x20sent');logger[_0x17cb('0x10')](_0x17cb('0x11'),_0x36316a,_0x17cb('0x12'),JSON[_0x17cb('0x13')](_0x2a80d9));if(_0x2a80d9[_0x17cb('0x14')]){if(_0x2a80d9[_0x17cb('0x14')][_0x17cb('0x15')]===0x1f4){logger['error'](_0x17cb('0xf'),_0x36316a,_0x2a80d9[_0x17cb('0x14')][_0x17cb('0x16')]);return _0xfc3c3e(_0x2a80d9['error'][_0x17cb('0x16')]);}logger[_0x17cb('0x14')](_0x17cb('0xf'),_0x36316a,_0x2a80d9['error'][_0x17cb('0x16')]);return _0x4280c2(_0x2a80d9[_0x17cb('0x14')][_0x17cb('0x16')]);}else{logger[_0x17cb('0xe')](_0x17cb('0xf'),_0x36316a,_0x17cb('0x12'));_0x4280c2(_0x2a80d9[_0x17cb('0x17')][_0x17cb('0x16')]);}})['catch'](function(_0x2fa848){logger[_0x17cb('0x14')]('ChatApplication,\x20%s,\x20%s',_0x36316a,_0x2fa848);_0xfc3c3e(_0x2fa848);});});} \ No newline at end of file +var _0xcd9f=['stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x25ff42,_0x1dd28a){var _0x2b9f64=function(_0x417733){while(--_0x417733){_0x25ff42['push'](_0x25ff42['shift']());}};_0x2b9f64(++_0x1dd28a);}(_0xcd9f,0x1d0));var _0xfcd9=function(_0x513cbb,_0x5bbea5){_0x513cbb=_0x513cbb-0x0;var _0x481b9e=_0xcd9f[_0x513cbb];return _0x481b9e;};'use strict';var _=require(_0xfcd9('0x0'));var util=require('util');var moment=require(_0xfcd9('0x1'));var BPromise=require(_0xfcd9('0x2'));var rs=require(_0xfcd9('0x3'));var fs=require('fs');var Redis=require(_0xfcd9('0x4'));var db=require(_0xfcd9('0x5'))['db'];var utils=require(_0xfcd9('0x6'));var logger=require(_0xfcd9('0x7'))(_0xfcd9('0x8'));var config=require(_0xfcd9('0x9'));var jayson=require(_0xfcd9('0xa'));var client=jayson[_0xfcd9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3be72e,_0x3ddfc2,_0x4fcfb8){return new BPromise(function(_0x4d3cdf,_0x1ceb1a){return client[_0xfcd9('0xc')](_0x3be72e,_0x4fcfb8)[_0xfcd9('0xd')](function(_0x288b33){logger[_0xfcd9('0xe')](_0xfcd9('0xf'),_0x3ddfc2,'request\x20sent');logger[_0xfcd9('0x10')](_0xfcd9('0x11'),_0x3ddfc2,_0xfcd9('0x12'),JSON[_0xfcd9('0x13')](_0x288b33));if(_0x288b33[_0xfcd9('0x14')]){if(_0x288b33[_0xfcd9('0x14')]['code']===0x1f4){logger[_0xfcd9('0x14')](_0xfcd9('0xf'),_0x3ddfc2,_0x288b33[_0xfcd9('0x14')]['message']);return _0x1ceb1a(_0x288b33[_0xfcd9('0x14')][_0xfcd9('0x15')]);}logger[_0xfcd9('0x14')](_0xfcd9('0xf'),_0x3ddfc2,_0x288b33[_0xfcd9('0x14')]['message']);return _0x4d3cdf(_0x288b33['error'][_0xfcd9('0x15')]);}else{logger['info'](_0xfcd9('0xf'),_0x3ddfc2,_0xfcd9('0x12'));_0x4d3cdf(_0x288b33['result'][_0xfcd9('0x15')]);}})[_0xfcd9('0x16')](function(_0x5b6d9b){logger[_0xfcd9('0x14')]('ChatApplication,\x20%s,\x20%s',_0x3ddfc2,_0x5b6d9b);_0x1ceb1a(_0x5b6d9b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4865138..46c6ccd 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 _0xa4c2=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa4c2,0xc5));var _0x2a4c=function(_0x28ce22,_0x3dc50b){_0x28ce22=_0x28ce22-0x0;var _0x46c0df=_0xa4c2[_0x28ce22];return _0x46c0df;};'use strict';var multer=require(_0x2a4c('0x0'));var util=require(_0x2a4c('0x1'));var path=require(_0x2a4c('0x2'));var timeout=require(_0x2a4c('0x3'));var express=require(_0x2a4c('0x4'));var router=express['Router']();var fs_extra=require(_0x2a4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2a4c('0x6'));var config=require(_0x2a4c('0x7'));var controller=require(_0x2a4c('0x8'));router[_0x2a4c('0x9')]('/:id',auth[_0x2a4c('0xa')](),controller['show']);router[_0x2a4c('0xb')](_0x2a4c('0xc'),auth[_0x2a4c('0xa')](),controller[_0x2a4c('0xd')]);router['delete'](_0x2a4c('0xc'),auth['isAuthenticated'](),controller[_0x2a4c('0xe')]);module[_0x2a4c('0xf')]=router; \ No newline at end of file +var _0xa275=['isAuthenticated','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x175223,_0x757480){var _0x204e96=function(_0x5067dc){while(--_0x5067dc){_0x175223['push'](_0x175223['shift']());}};_0x204e96(++_0x757480);}(_0xa275,0x122));var _0x5a27=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa275[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x5a27('0x0'));var path=require('path');var timeout=require(_0x5a27('0x1'));var express=require(_0x5a27('0x2'));var router=express['Router']();var fs_extra=require(_0x5a27('0x3'));var auth=require(_0x5a27('0x4'));var interaction=require(_0x5a27('0x5'));var config=require(_0x5a27('0x6'));var controller=require('./chatApplication.controller');router[_0x5a27('0x7')](_0x5a27('0x8'),auth[_0x5a27('0x9')](),controller['show']);router['put'](_0x5a27('0x8'),auth[_0x5a27('0x9')](),controller[_0x5a27('0xa')]);router[_0x5a27('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5a27('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index b073c54..bf8d92e 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 _0x7510=['BOOLEAN','exports','STRING'];(function(_0x3eb789,_0x48354c){var _0x545ece=function(_0x3f1af0){while(--_0x3f1af0){_0x3eb789['push'](_0x3eb789['shift']());}};_0x545ece(++_0x48354c);}(_0x7510,0xa9));var _0x0751=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7510[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0751('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0751('0x1')]},'write':{'type':Sequelize[_0x0751('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2913=['STRING','BOOLEAN','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x2913,0x9b));var _0x3291=function(_0x2e0691,_0x5897de){_0x2e0691=_0x2e0691-0x0;var _0x25cc01=_0x2913[_0x2e0691];return _0x25cc01;};'use strict';var Sequelize=require('sequelize');module[_0x3291('0x0')]={'name':{'type':Sequelize[_0x3291('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3291('0x1')]},'write':{'type':Sequelize[_0x3291('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index bc9dbd2..d0dae4e 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 _0x91cd=['addMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','type','query','keys','model','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','hasOwnProperty','removeMembers'];(function(_0x4b7e53,_0x2d02b1){var _0x5a7bd1=function(_0x42f4f6){while(--_0x42f4f6){_0x4b7e53['push'](_0x4b7e53['shift']());}};_0x5a7bd1(++_0x2d02b1);}(_0x91cd,0x176));var _0xd91c=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x91cd[_0x3a0c4f];return _0x247049;};'use strict';var emlformat=require(_0xd91c('0x0'));var rimraf=require(_0xd91c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd91c('0x2'));var rp=require(_0xd91c('0x3'));var moment=require('moment');var BPromise=require(_0xd91c('0x4'));var Mustache=require(_0xd91c('0x5'));var util=require('util');var path=require(_0xd91c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd91c('0x7'));var _=require('lodash');var squel=require(_0xd91c('0x8'));var crypto=require(_0xd91c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd91c('0xa'));var toCsv=require(_0xd91c('0xb'));var querystring=require('querystring');var Papa=require(_0xd91c('0xc'));var Redis=require(_0xd91c('0xd'));var authService=require(_0xd91c('0xe'));var qs=require(_0xd91c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd91c('0x10'));var logger=require(_0xd91c('0x11'))(_0xd91c('0x12'));var utils=require(_0xd91c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd91c('0x14'));var db=require(_0xd91c('0x15'))['db'];config['redis']=_[_0xd91c('0x16')](config[_0xd91c('0x17')],{'host':_0xd91c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0xd91c('0x19')](socket);function respondWithStatusCode(_0x1a1821,_0x45d524){_0x45d524=_0x45d524||0xcc;return function(_0x139a59){if(_0x139a59){return _0x1a1821[_0xd91c('0x1a')](_0x45d524);}return _0x1a1821['status'](_0x45d524)[_0xd91c('0x1b')]();};}function respondWithResult(_0x3b49af,_0x31eb7a){_0x31eb7a=_0x31eb7a||0xc8;return function(_0x481e27){if(_0x481e27){return _0x3b49af[_0xd91c('0x1c')](_0x31eb7a)[_0xd91c('0x1d')](_0x481e27);}};}function respondWithFilteredResult(_0x3ec5a7,_0x248511){return function(_0x1ac413){if(_0x1ac413){var _0x2b7928=typeof _0x248511[_0xd91c('0x1e')]===_0xd91c('0x1f')&&typeof _0x248511[_0xd91c('0x20')]===_0xd91c('0x1f');var _0x19bb4d=_0x1ac413[_0xd91c('0x21')];var _0x49b907=_0x2b7928?0x0:_0x248511[_0xd91c('0x1e')];var _0xbb3b6e=_0x2b7928?_0x1ac413[_0xd91c('0x21')]:_0x248511[_0xd91c('0x1e')]+_0x248511[_0xd91c('0x20')];var _0x380f1d;if(_0xbb3b6e>=_0x19bb4d){_0xbb3b6e=_0x19bb4d;_0x380f1d=0xc8;}else{_0x380f1d=0xce;}_0x3ec5a7[_0xd91c('0x1c')](_0x380f1d);return _0x3ec5a7[_0xd91c('0x22')](_0xd91c('0x23'),_0x49b907+'-'+_0xbb3b6e+'/'+_0x19bb4d)['json'](_0x1ac413);}return null;};}function patchUpdates(_0x3543df){return function(_0x3677d4){try{jsonpatch[_0xd91c('0x24')](_0x3677d4,_0x3543df,!![]);}catch(_0x1c9dd1){return BPromise[_0xd91c('0x25')](_0x1c9dd1);}return _0x3677d4[_0xd91c('0x26')]();};}function saveUpdates(_0x48c3f9,_0x3f8b4f){return function(_0x34efcc){if(_0x34efcc){return _0x34efcc[_0xd91c('0x27')](_0x48c3f9)[_0xd91c('0x28')](function(_0x583be8){return _0x583be8;});}return null;};}function removeEntity(_0x30ba14,_0xa6316d){return function(_0x39c661){if(_0x39c661){return _0x39c661[_0xd91c('0x29')]()[_0xd91c('0x28')](function(){_0x30ba14['status'](0xcc)[_0xd91c('0x1b')]();});}};}function handleEntityNotFound(_0x5e1adc,_0x3281af){return function(_0x45aa57){if(!_0x45aa57){_0x5e1adc['sendStatus'](0x194);}return _0x45aa57;};}function handleError(_0x2b8770,_0x3dbd6b){_0x3dbd6b=_0x3dbd6b||0x1f4;return function(_0x155e18){logger[_0xd91c('0x2a')](_0x155e18[_0xd91c('0x2b')]);if(_0x155e18[_0xd91c('0x2c')]){delete _0x155e18[_0xd91c('0x2c')];}_0x2b8770[_0xd91c('0x1c')](_0x3dbd6b)['send'](_0x155e18);};}exports[_0xd91c('0x2d')]=function(_0x8f06e3,_0x45de9f){var _0x436e46={},_0x14d262={},_0x592642={'count':0x0,'rows':[]};var _0x3a1760=_[_0xd91c('0x2e')](db[_0xd91c('0x2f')][_0xd91c('0x30')],function(_0x3e7f33){return{'name':_0x3e7f33['fieldName'],'type':_0x3e7f33[_0xd91c('0x31')]['key']};});_0x14d262['model']=_[_0xd91c('0x2e')](_0x3a1760,'name');_0x14d262[_0xd91c('0x32')]=_[_0xd91c('0x33')](_0x8f06e3[_0xd91c('0x32')]);_0x14d262['filters']=_['intersection'](_0x14d262[_0xd91c('0x34')],_0x14d262['query']);_0x436e46[_0xd91c('0x35')]=_[_0xd91c('0x36')](_0x14d262[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x8f06e3[_0xd91c('0x32')]['fields']));_0x436e46[_0xd91c('0x35')]=_0x436e46[_0xd91c('0x35')][_0xd91c('0x38')]?_0x436e46[_0xd91c('0x35')]:_0x14d262['model'];if(!_0x8f06e3['query']['hasOwnProperty']('nolimit')){_0x436e46[_0xd91c('0x20')]=qs[_0xd91c('0x20')](_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x20')]);_0x436e46['offset']=qs[_0xd91c('0x1e')](_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x1e')]);}_0x436e46[_0xd91c('0x39')]=qs[_0xd91c('0x3a')](_0x8f06e3[_0xd91c('0x32')]['sort']);_0x436e46[_0xd91c('0x3b')]=qs[_0xd91c('0x3c')](_[_0xd91c('0x3d')](_0x8f06e3['query'],_0x14d262[_0xd91c('0x3c')]),_0x3a1760);if(_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x436e46[_0xd91c('0x3b')]=_[_0xd91c('0x3f')](_0x436e46[_0xd91c('0x3b')],{'$or':_['map'](_0x3a1760,function(_0x4a86d5){if(_0x4a86d5['type']!=='VIRTUAL'){var _0x2b037d={};_0x2b037d[_0x4a86d5['name']]={'$like':'%'+_0x8f06e3['query']['filter']+'%'};return _0x2b037d;}})});}_0x436e46=_[_0xd91c('0x3f')]({},_0x436e46,_0x8f06e3[_0xd91c('0x40')]);var _0x2dac74={'where':_0x436e46['where']};return db[_0xd91c('0x2f')][_0xd91c('0x21')](_0x2dac74)[_0xd91c('0x28')](function(_0x38ce51){_0x592642[_0xd91c('0x21')]=_0x38ce51;if(_0x8f06e3[_0xd91c('0x32')][_0xd91c('0x41')]){_0x436e46[_0xd91c('0x42')]=[{'all':!![]}];}return db[_0xd91c('0x2f')]['findAll'](_0x436e46);})['then'](function(_0x1408c4){_0x592642[_0xd91c('0x43')]=_0x1408c4;return _0x592642;})[_0xd91c('0x28')](respondWithFilteredResult(_0x45de9f,_0x436e46))['catch'](handleError(_0x45de9f,null));};exports[_0xd91c('0x44')]=function(_0x2373e4,_0xfc2f9f){var _0x1584d9={'raw':!![],'where':{'id':_0x2373e4[_0xd91c('0x45')]['id']}},_0x47cdf9={};_0x47cdf9[_0xd91c('0x34')]=_[_0xd91c('0x33')](db[_0xd91c('0x2f')][_0xd91c('0x30')]);_0x47cdf9[_0xd91c('0x32')]=_[_0xd91c('0x33')](_0x2373e4[_0xd91c('0x32')]);_0x47cdf9[_0xd91c('0x3c')]=_[_0xd91c('0x36')](_0x47cdf9[_0xd91c('0x34')],_0x47cdf9['query']);_0x1584d9[_0xd91c('0x35')]=_[_0xd91c('0x36')](_0x47cdf9[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x2373e4[_0xd91c('0x32')][_0xd91c('0x37')]));_0x1584d9[_0xd91c('0x35')]=_0x1584d9[_0xd91c('0x35')][_0xd91c('0x38')]?_0x1584d9[_0xd91c('0x35')]:_0x47cdf9[_0xd91c('0x34')];if(_0x2373e4[_0xd91c('0x32')]['includeAll']){_0x1584d9['include']=[{'all':!![]}];}_0x1584d9=_[_0xd91c('0x3f')]({},_0x1584d9,_0x2373e4['options']);return db['ChatGroup'][_0xd91c('0x46')](_0x1584d9)[_0xd91c('0x28')](handleEntityNotFound(_0xfc2f9f,null))[_0xd91c('0x28')](respondWithResult(_0xfc2f9f,null))[_0xd91c('0x47')](handleError(_0xfc2f9f,null));};exports[_0xd91c('0x48')]=function(_0x336c73,_0x207690){return db[_0xd91c('0x2f')][_0xd91c('0x48')](_0x336c73[_0xd91c('0x49')],{})['then'](respondWithResult(_0x207690,0xc9))[_0xd91c('0x47')](handleError(_0x207690,null));};exports[_0xd91c('0x27')]=function(_0x636151,_0x32d8bf){if(_0x636151[_0xd91c('0x49')]['id']){delete _0x636151[_0xd91c('0x49')]['id'];}return db[_0xd91c('0x2f')][_0xd91c('0x46')]({'where':{'id':_0x636151['params']['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x32d8bf,null))[_0xd91c('0x28')](saveUpdates(_0x636151[_0xd91c('0x49')],null))[_0xd91c('0x28')](respondWithResult(_0x32d8bf,null))[_0xd91c('0x47')](handleError(_0x32d8bf,null));};exports[_0xd91c('0x29')]=function(_0x3fac39,_0x1957d7){return db['ChatGroup'][_0xd91c('0x46')]({'where':{'id':_0x3fac39[_0xd91c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1957d7,null))['then'](removeEntity(_0x1957d7,null))[_0xd91c('0x47')](handleError(_0x1957d7,null));};exports[_0xd91c('0x4a')]=function(_0x234266,_0xa1d8c2){return db[_0xd91c('0x2f')][_0xd91c('0x4a')]()['then'](respondWithResult(_0xa1d8c2,null))[_0xd91c('0x47')](handleError(_0xa1d8c2,null));};exports[_0xd91c('0x4b')]=function(_0xd4a8d5,_0x4d0c9a,_0x1eb59b){return db[_0xd91c('0x4c')][_0xd91c('0x21')]({'where':{'ChatGroupId':_0xd4a8d5['params']['id'],'ToId':_0xd4a8d5[_0xd91c('0x4d')]['id'],'read':![]}})[_0xd91c('0x28')](function(_0x75a0eb){return{'id':_[_0xd91c('0x4e')](_0xd4a8d5['params']['id']),'count':_0x75a0eb};})['then'](respondWithResult(_0x4d0c9a,null))['catch'](handleError(_0x4d0c9a,null));};exports[_0xd91c('0x4f')]=function(_0x5832cf,_0x2e2ef9,_0x30568f){return db['ChatGroup']['find']({'where':{'id':_0x5832cf[_0xd91c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e2ef9,null))[_0xd91c('0x28')](function(_0x537580){if(_0x537580){return _0x537580[_0xd91c('0x4f')](_0x5832cf[_0xd91c('0x49')]['ids'],_[_0xd91c('0x50')](_0x5832cf['body'],[_0xd91c('0x51'),'id'])||{});}})[_0xd91c('0x28')](respondWithResult(_0x2e2ef9,null))['catch'](handleError(_0x2e2ef9,null));};exports[_0xd91c('0x52')]=function(_0x479924,_0x4cf8fd,_0x382161){var _0x900bcc={};var _0xe738e9={};var _0x135c47;var _0x1424b6;return db[_0xd91c('0x2f')][_0xd91c('0x53')]({'where':{'id':_0x479924[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x4cf8fd,null))['then'](function(_0x290296){if(_0x290296){_0x135c47=_0x290296;_0xe738e9[_0xd91c('0x34')]=_['keys'](db['User'][_0xd91c('0x30')]);_0xe738e9[_0xd91c('0x32')]=_['keys'](_0x479924[_0xd91c('0x32')]);_0xe738e9['filters']=_[_0xd91c('0x36')](_0xe738e9['model'],_0xe738e9[_0xd91c('0x32')]);_0x900bcc[_0xd91c('0x35')]=_['intersection'](_0xe738e9[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x479924['query']['fields']));_0x900bcc[_0xd91c('0x35')]=_0x900bcc['attributes'][_0xd91c('0x38')]?_0x900bcc[_0xd91c('0x35')]:_0xe738e9[_0xd91c('0x34')];_0x900bcc[_0xd91c('0x39')]=qs[_0xd91c('0x3a')](_0x479924[_0xd91c('0x32')][_0xd91c('0x3a')]);_0x900bcc['where']=qs['filters'](_[_0xd91c('0x3d')](_0x479924[_0xd91c('0x32')],_0xe738e9[_0xd91c('0x3c')]));if(_0x479924[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x900bcc['where']=_[_0xd91c('0x3f')](_0x900bcc[_0xd91c('0x3b')],{'$or':_[_0xd91c('0x2e')](_0x900bcc[_0xd91c('0x35')],function(_0x225f3e){var _0x11e8e7={};_0x11e8e7[_0x225f3e]={'$like':'%'+_0x479924[_0xd91c('0x32')][_0xd91c('0x3e')]+'%'};return _0x11e8e7;})});}_0x900bcc=_[_0xd91c('0x3f')]({},_0x900bcc,_0x479924['options']);return _0x135c47[_0xd91c('0x52')](_0x900bcc);}})[_0xd91c('0x28')](function(_0x58330d){if(_0x58330d){_0x1424b6=_0x58330d[_0xd91c('0x38')];if(!_0x479924[_0xd91c('0x32')][_0xd91c('0x54')]('nolimit')){_0x900bcc[_0xd91c('0x20')]=qs[_0xd91c('0x20')](_0x479924[_0xd91c('0x32')][_0xd91c('0x20')]);_0x900bcc[_0xd91c('0x1e')]=qs[_0xd91c('0x1e')](_0x479924['query'][_0xd91c('0x1e')]);}return _0x135c47['getMembers'](_0x900bcc);}})[_0xd91c('0x28')](function(_0x3b5e34){if(_0x3b5e34){return _0x3b5e34?{'count':_0x1424b6,'rows':_0x3b5e34}:null;}})['then'](respondWithResult(_0x4cf8fd,null))['catch'](handleError(_0x4cf8fd,null));};exports['removeMembers']=function(_0x27d48c,_0x533e70,_0x2ce9e5){return db[_0xd91c('0x2f')]['find']({'where':{'id':_0x27d48c[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x533e70,null))[_0xd91c('0x28')](function(_0x710e2a){if(_0x710e2a){return _0x710e2a[_0xd91c('0x55')](_0x27d48c['query'][_0xd91c('0x51')]);}})[_0xd91c('0x28')](respondWithStatusCode(_0x533e70,null))['catch'](handleError(_0x533e70,null));};exports[_0xd91c('0x56')]=function(_0x551440,_0x3596fc,_0x57a87b){if(_0x551440[_0xd91c('0x49')]['id']){delete _0x551440[_0xd91c('0x49')]['id'];}return db[_0xd91c('0x2f')]['find']({'where':{'id':_0x551440[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x3596fc,null))[_0xd91c('0x28')](function(_0x3d9afe){if(_0x3d9afe){_0x551440[_0xd91c('0x49')]['ChatGroupId']=_0x3d9afe['id'];return db[_0xd91c('0x4c')][_0xd91c('0x48')](_0x551440[_0xd91c('0x49')]);}})[_0xd91c('0x28')](respondWithResult(_0x3596fc,null))['catch'](handleError(_0x3596fc,null));};exports[_0xd91c('0x57')]=function(_0x14a291,_0x2591b0,_0x11c6a8){var _0x2fa4cb={};var _0x4c789c={};var _0x3b36ac;var _0x4a9275;return db[_0xd91c('0x2f')][_0xd91c('0x53')]({'where':{'id':_0x14a291[_0xd91c('0x45')]['id']}})[_0xd91c('0x28')](handleEntityNotFound(_0x2591b0,null))[_0xd91c('0x28')](function(_0x295208){if(_0x295208){_0x3b36ac=_0x295208;_0x4c789c['model']=_[_0xd91c('0x33')](db[_0xd91c('0x4c')][_0xd91c('0x30')]);_0x4c789c[_0xd91c('0x32')]=_[_0xd91c('0x33')](_0x14a291[_0xd91c('0x32')]);_0x4c789c[_0xd91c('0x3c')]=_[_0xd91c('0x36')](_0x4c789c['model'],_0x4c789c[_0xd91c('0x32')]);_0x2fa4cb[_0xd91c('0x35')]=_['intersection'](_0x4c789c[_0xd91c('0x34')],qs[_0xd91c('0x37')](_0x14a291[_0xd91c('0x32')]['fields']));_0x2fa4cb[_0xd91c('0x35')]=_0x2fa4cb['attributes']['length']?_0x2fa4cb[_0xd91c('0x35')]:_0x4c789c['model'];_0x2fa4cb[_0xd91c('0x39')]=qs['sort'](_0x14a291['query']['sort']);_0x2fa4cb[_0xd91c('0x3b')]=qs[_0xd91c('0x3c')](_[_0xd91c('0x3d')](_0x14a291[_0xd91c('0x32')],_0x4c789c['filters']));if(_0x14a291['query'][_0xd91c('0x3e')]){_0x2fa4cb[_0xd91c('0x3b')]=_['merge'](_0x2fa4cb['where'],{'$or':_[_0xd91c('0x2e')](_0x2fa4cb[_0xd91c('0x35')],function(_0x3c80a1){var _0x2425c3={};_0x2425c3[_0x3c80a1]={'$like':'%'+_0x14a291[_0xd91c('0x32')]['filter']+'%'};return _0x2425c3;})});}if(_0x14a291[_0xd91c('0x32')][_0xd91c('0x58')]){var _0x15ba76=_0x14a291['query'][_0xd91c('0x58')]['split'](',');var _0x5bf6f1={};_0x5bf6f1[_0x15ba76[0x0]]={'$gte':moment(_0x15ba76[0x1])[_0xd91c('0x59')](_0xd91c('0x5a'))};_0x2fa4cb[_0xd91c('0x3b')]=_['merge'](_0x2fa4cb[_0xd91c('0x3b')],_0x5bf6f1);}_0x2fa4cb=_[_0xd91c('0x3f')]({},_0x2fa4cb,_0x14a291['options']);return _0x3b36ac['getMessages'](_0x2fa4cb);}})[_0xd91c('0x28')](function(_0xcbc636){if(_0xcbc636){_0x4a9275=_0xcbc636[_0xd91c('0x38')];if(!_0x14a291[_0xd91c('0x32')]['hasOwnProperty'](_0xd91c('0x5b'))){_0x2fa4cb[_0xd91c('0x20')]=qs[_0xd91c('0x20')](_0x14a291[_0xd91c('0x32')][_0xd91c('0x20')]);_0x2fa4cb[_0xd91c('0x1e')]=qs[_0xd91c('0x1e')](_0x14a291[_0xd91c('0x32')]['offset']);}return _0x3b36ac[_0xd91c('0x57')](_0x2fa4cb);}})[_0xd91c('0x28')](function(_0x2de048){if(_0x2de048){return _0x2de048?{'count':_0x4a9275,'rows':_0x2de048}:null;}})['then'](respondWithResult(_0x2591b0,null))[_0xd91c('0x47')](handleError(_0x2591b0,null));}; \ No newline at end of file +var _0x778c=['Content-Range','apply','save','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','ChatGroup','include','catch','params','find','create','update','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x51b792,_0x188ecc){var _0x482357=function(_0x17a099){while(--_0x17a099){_0x51b792['push'](_0x51b792['shift']());}};_0x482357(++_0x188ecc);}(_0x778c,0x95));var _0xc778=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x778c[_0x35d775];return _0x59384d;};'use strict';var emlformat=require(_0xc778('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc778('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc778('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc778('0x3'));var sox=require(_0xc778('0x4'));var csv=require(_0xc778('0x5'));var ejs=require(_0xc778('0x6'));var fs=require('fs');var fs_extra=require(_0xc778('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc778('0x8'));var deskjs=require(_0xc778('0x9'));var toCsv=require(_0xc778('0x5'));var querystring=require(_0xc778('0xa'));var Papa=require('papaparse');var Redis=require(_0xc778('0xb'));var authService=require(_0xc778('0xc'));var qs=require(_0xc778('0xd'));var as=require(_0xc778('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc778('0xf'))('api');var utils=require(_0xc778('0x10'));var config=require(_0xc778('0x11'));var licenseUtil=require(_0xc778('0x12'));var db=require(_0xc778('0x13'))['db'];config[_0xc778('0x14')]=_[_0xc778('0x15')](config[_0xc778('0x14')],{'host':_0xc778('0x16'),'port':0x18eb});var socket=require(_0xc778('0x17'))(new Redis(config['redis']));require(_0xc778('0x18'))[_0xc778('0x19')](socket);function respondWithStatusCode(_0x596d01,_0x115228){_0x115228=_0x115228||0xcc;return function(_0x4d05c1){if(_0x4d05c1){return _0x596d01[_0xc778('0x1a')](_0x115228);}return _0x596d01[_0xc778('0x1b')](_0x115228)[_0xc778('0x1c')]();};}function respondWithResult(_0x16718c,_0x27b5b1){_0x27b5b1=_0x27b5b1||0xc8;return function(_0xd82444){if(_0xd82444){return _0x16718c[_0xc778('0x1b')](_0x27b5b1)[_0xc778('0x1d')](_0xd82444);}};}function respondWithFilteredResult(_0x521a2a,_0x1b2151){return function(_0x37c1b1){if(_0x37c1b1){var _0x35c030=typeof _0x1b2151['offset']===_0xc778('0x1e')&&typeof _0x1b2151[_0xc778('0x1f')]===_0xc778('0x1e');var _0x5af252=_0x37c1b1[_0xc778('0x20')];var _0x1db8ce=_0x35c030?0x0:_0x1b2151[_0xc778('0x21')];var _0x4d78bb=_0x35c030?_0x37c1b1[_0xc778('0x20')]:_0x1b2151[_0xc778('0x21')]+_0x1b2151[_0xc778('0x1f')];var _0x570643;if(_0x4d78bb>=_0x5af252){_0x4d78bb=_0x5af252;_0x570643=0xc8;}else{_0x570643=0xce;}_0x521a2a[_0xc778('0x1b')](_0x570643);return _0x521a2a[_0xc778('0x22')](_0xc778('0x23'),_0x1db8ce+'-'+_0x4d78bb+'/'+_0x5af252)[_0xc778('0x1d')](_0x37c1b1);}return null;};}function patchUpdates(_0x14a74a){return function(_0x2ea401){try{jsonpatch[_0xc778('0x24')](_0x2ea401,_0x14a74a,!![]);}catch(_0x392819){return BPromise['reject'](_0x392819);}return _0x2ea401[_0xc778('0x25')]();};}function saveUpdates(_0x130af9,_0x5191bd){return function(_0x24759b){if(_0x24759b){return _0x24759b['update'](_0x130af9)['then'](function(_0x34b80b){return _0x34b80b;});}return null;};}function removeEntity(_0x586852,_0x3abd37){return function(_0x2b7df0){if(_0x2b7df0){return _0x2b7df0[_0xc778('0x26')]()[_0xc778('0x27')](function(){_0x586852['status'](0xcc)[_0xc778('0x1c')]();});}};}function handleEntityNotFound(_0x7a53dd,_0x2ccd76){return function(_0x3f11ef){if(!_0x3f11ef){_0x7a53dd[_0xc778('0x1a')](0x194);}return _0x3f11ef;};}function handleError(_0x5cf6ea,_0x579987){_0x579987=_0x579987||0x1f4;return function(_0x36650f){logger[_0xc778('0x28')](_0x36650f[_0xc778('0x29')]);if(_0x36650f['name']){delete _0x36650f[_0xc778('0x2a')];}_0x5cf6ea[_0xc778('0x1b')](_0x579987)['send'](_0x36650f);};}exports[_0xc778('0x2b')]=function(_0x234daa,_0x48e037){var _0x4c2156={},_0x5cb0c0={},_0x2e7bd8={'count':0x0,'rows':[]};var _0x16ce8f=_[_0xc778('0x2c')](db['ChatGroup'][_0xc778('0x2d')],function(_0x4dff8a){return{'name':_0x4dff8a[_0xc778('0x2e')],'type':_0x4dff8a['type']['key']};});_0x5cb0c0[_0xc778('0x2f')]=_['map'](_0x16ce8f,'name');_0x5cb0c0[_0xc778('0x30')]=_[_0xc778('0x31')](_0x234daa[_0xc778('0x30')]);_0x5cb0c0[_0xc778('0x32')]=_[_0xc778('0x33')](_0x5cb0c0[_0xc778('0x2f')],_0x5cb0c0[_0xc778('0x30')]);_0x4c2156[_0xc778('0x34')]=_[_0xc778('0x33')](_0x5cb0c0[_0xc778('0x2f')],qs['fields'](_0x234daa[_0xc778('0x30')][_0xc778('0x35')]));_0x4c2156[_0xc778('0x34')]=_0x4c2156[_0xc778('0x34')][_0xc778('0x36')]?_0x4c2156[_0xc778('0x34')]:_0x5cb0c0[_0xc778('0x2f')];if(!_0x234daa['query'][_0xc778('0x37')](_0xc778('0x38'))){_0x4c2156[_0xc778('0x1f')]=qs[_0xc778('0x1f')](_0x234daa[_0xc778('0x30')]['limit']);_0x4c2156[_0xc778('0x21')]=qs['offset'](_0x234daa[_0xc778('0x30')][_0xc778('0x21')]);}_0x4c2156[_0xc778('0x39')]=qs[_0xc778('0x3a')](_0x234daa['query'][_0xc778('0x3a')]);_0x4c2156[_0xc778('0x3b')]=qs[_0xc778('0x32')](_[_0xc778('0x3c')](_0x234daa[_0xc778('0x30')],_0x5cb0c0[_0xc778('0x32')]),_0x16ce8f);if(_0x234daa[_0xc778('0x30')]['filter']){_0x4c2156['where']=_['merge'](_0x4c2156[_0xc778('0x3b')],{'$or':_['map'](_0x16ce8f,function(_0x4ff964){if(_0x4ff964[_0xc778('0x3d')]!==_0xc778('0x3e')){var _0x51d90d={};_0x51d90d[_0x4ff964[_0xc778('0x2a')]]={'$like':'%'+_0x234daa[_0xc778('0x30')][_0xc778('0x3f')]+'%'};return _0x51d90d;}})});}_0x4c2156=_[_0xc778('0x40')]({},_0x4c2156,_0x234daa[_0xc778('0x41')]);var _0x15e982={'where':_0x4c2156[_0xc778('0x3b')]};return db[_0xc778('0x42')]['count'](_0x15e982)[_0xc778('0x27')](function(_0x38ec3f){_0x2e7bd8[_0xc778('0x20')]=_0x38ec3f;if(_0x234daa[_0xc778('0x30')]['includeAll']){_0x4c2156[_0xc778('0x43')]=[{'all':!![]}];}return db[_0xc778('0x42')]['findAll'](_0x4c2156);})[_0xc778('0x27')](function(_0x2b811f){_0x2e7bd8['rows']=_0x2b811f;return _0x2e7bd8;})[_0xc778('0x27')](respondWithFilteredResult(_0x48e037,_0x4c2156))[_0xc778('0x44')](handleError(_0x48e037,null));};exports['show']=function(_0x3d8825,_0x4d65f8){var _0x586e57={'raw':!![],'where':{'id':_0x3d8825[_0xc778('0x45')]['id']}},_0x3005c4={};_0x3005c4[_0xc778('0x2f')]=_[_0xc778('0x31')](db[_0xc778('0x42')][_0xc778('0x2d')]);_0x3005c4[_0xc778('0x30')]=_['keys'](_0x3d8825['query']);_0x3005c4[_0xc778('0x32')]=_['intersection'](_0x3005c4[_0xc778('0x2f')],_0x3005c4[_0xc778('0x30')]);_0x586e57[_0xc778('0x34')]=_[_0xc778('0x33')](_0x3005c4[_0xc778('0x2f')],qs[_0xc778('0x35')](_0x3d8825[_0xc778('0x30')][_0xc778('0x35')]));_0x586e57[_0xc778('0x34')]=_0x586e57[_0xc778('0x34')][_0xc778('0x36')]?_0x586e57['attributes']:_0x3005c4[_0xc778('0x2f')];if(_0x3d8825['query']['includeAll']){_0x586e57[_0xc778('0x43')]=[{'all':!![]}];}_0x586e57=_[_0xc778('0x40')]({},_0x586e57,_0x3d8825['options']);return db[_0xc778('0x42')][_0xc778('0x46')](_0x586e57)['then'](handleEntityNotFound(_0x4d65f8,null))[_0xc778('0x27')](respondWithResult(_0x4d65f8,null))[_0xc778('0x44')](handleError(_0x4d65f8,null));};exports[_0xc778('0x47')]=function(_0x24f0b3,_0x5841f8){return db[_0xc778('0x42')][_0xc778('0x47')](_0x24f0b3['body'],{})[_0xc778('0x27')](respondWithResult(_0x5841f8,0xc9))[_0xc778('0x44')](handleError(_0x5841f8,null));};exports[_0xc778('0x48')]=function(_0x521d25,_0x211ca2){if(_0x521d25[_0xc778('0x49')]['id']){delete _0x521d25[_0xc778('0x49')]['id'];}return db[_0xc778('0x42')][_0xc778('0x46')]({'where':{'id':_0x521d25[_0xc778('0x45')]['id']}})[_0xc778('0x27')](handleEntityNotFound(_0x211ca2,null))[_0xc778('0x27')](saveUpdates(_0x521d25['body'],null))[_0xc778('0x27')](respondWithResult(_0x211ca2,null))['catch'](handleError(_0x211ca2,null));};exports['destroy']=function(_0x2a270d,_0x3d4885){return db['ChatGroup'][_0xc778('0x46')]({'where':{'id':_0x2a270d[_0xc778('0x45')]['id']}})[_0xc778('0x27')](handleEntityNotFound(_0x3d4885,null))[_0xc778('0x27')](removeEntity(_0x3d4885,null))[_0xc778('0x44')](handleError(_0x3d4885,null));};exports[_0xc778('0x4a')]=function(_0x5e5f0,_0x28ebcb){return db[_0xc778('0x42')][_0xc778('0x4a')]()[_0xc778('0x27')](respondWithResult(_0x28ebcb,null))[_0xc778('0x44')](handleError(_0x28ebcb,null));};exports[_0xc778('0x4b')]=function(_0x4a651f,_0x1f21e1,_0x3c89f4){return db[_0xc778('0x4c')][_0xc778('0x20')]({'where':{'ChatGroupId':_0x4a651f[_0xc778('0x45')]['id'],'ToId':_0x4a651f[_0xc778('0x4d')]['id'],'read':![]}})[_0xc778('0x27')](function(_0x2ab4cb){return{'id':_[_0xc778('0x4e')](_0x4a651f[_0xc778('0x45')]['id']),'count':_0x2ab4cb};})[_0xc778('0x27')](respondWithResult(_0x1f21e1,null))[_0xc778('0x44')](handleError(_0x1f21e1,null));};exports[_0xc778('0x4f')]=function(_0x2deb0f,_0x1872f4,_0x21aa8b){return db[_0xc778('0x42')][_0xc778('0x46')]({'where':{'id':_0x2deb0f[_0xc778('0x45')]['id']}})[_0xc778('0x27')](handleEntityNotFound(_0x1872f4,null))[_0xc778('0x27')](function(_0x1741b8){if(_0x1741b8){return _0x1741b8['addMembers'](_0x2deb0f['body'][_0xc778('0x50')],_[_0xc778('0x51')](_0x2deb0f[_0xc778('0x49')],['ids','id'])||{});}})[_0xc778('0x27')](respondWithResult(_0x1872f4,null))['catch'](handleError(_0x1872f4,null));};exports[_0xc778('0x52')]=function(_0x3dbd83,_0xc020b8,_0x173885){var _0x21ca0d={};var _0x128122={};var _0xa608b0;var _0x5cc9a4;return db[_0xc778('0x42')][_0xc778('0x53')]({'where':{'id':_0x3dbd83[_0xc778('0x45')]['id']}})[_0xc778('0x27')](handleEntityNotFound(_0xc020b8,null))[_0xc778('0x27')](function(_0x292c29){if(_0x292c29){_0xa608b0=_0x292c29;_0x128122[_0xc778('0x2f')]=_[_0xc778('0x31')](db[_0xc778('0x54')][_0xc778('0x2d')]);_0x128122[_0xc778('0x30')]=_[_0xc778('0x31')](_0x3dbd83['query']);_0x128122[_0xc778('0x32')]=_[_0xc778('0x33')](_0x128122['model'],_0x128122[_0xc778('0x30')]);_0x21ca0d[_0xc778('0x34')]=_[_0xc778('0x33')](_0x128122[_0xc778('0x2f')],qs[_0xc778('0x35')](_0x3dbd83[_0xc778('0x30')][_0xc778('0x35')]));_0x21ca0d[_0xc778('0x34')]=_0x21ca0d[_0xc778('0x34')]['length']?_0x21ca0d['attributes']:_0x128122[_0xc778('0x2f')];_0x21ca0d[_0xc778('0x39')]=qs[_0xc778('0x3a')](_0x3dbd83[_0xc778('0x30')][_0xc778('0x3a')]);_0x21ca0d[_0xc778('0x3b')]=qs[_0xc778('0x32')](_['pick'](_0x3dbd83[_0xc778('0x30')],_0x128122[_0xc778('0x32')]));if(_0x3dbd83[_0xc778('0x30')][_0xc778('0x3f')]){_0x21ca0d['where']=_[_0xc778('0x40')](_0x21ca0d['where'],{'$or':_[_0xc778('0x2c')](_0x21ca0d[_0xc778('0x34')],function(_0x139bdd){var _0x3ea87f={};_0x3ea87f[_0x139bdd]={'$like':'%'+_0x3dbd83[_0xc778('0x30')]['filter']+'%'};return _0x3ea87f;})});}_0x21ca0d=_[_0xc778('0x40')]({},_0x21ca0d,_0x3dbd83[_0xc778('0x41')]);return _0xa608b0[_0xc778('0x52')](_0x21ca0d);}})[_0xc778('0x27')](function(_0x4ebce0){if(_0x4ebce0){_0x5cc9a4=_0x4ebce0['length'];if(!_0x3dbd83[_0xc778('0x30')][_0xc778('0x37')]('nolimit')){_0x21ca0d[_0xc778('0x1f')]=qs[_0xc778('0x1f')](_0x3dbd83[_0xc778('0x30')][_0xc778('0x1f')]);_0x21ca0d[_0xc778('0x21')]=qs[_0xc778('0x21')](_0x3dbd83[_0xc778('0x30')][_0xc778('0x21')]);}return _0xa608b0[_0xc778('0x52')](_0x21ca0d);}})['then'](function(_0x59f8c0){if(_0x59f8c0){return _0x59f8c0?{'count':_0x5cc9a4,'rows':_0x59f8c0}:null;}})[_0xc778('0x27')](respondWithResult(_0xc020b8,null))[_0xc778('0x44')](handleError(_0xc020b8,null));};exports[_0xc778('0x55')]=function(_0x4638c7,_0x4206c0,_0x5d641d){return db['ChatGroup']['find']({'where':{'id':_0x4638c7[_0xc778('0x45')]['id']}})[_0xc778('0x27')](handleEntityNotFound(_0x4206c0,null))[_0xc778('0x27')](function(_0x1d7134){if(_0x1d7134){return _0x1d7134[_0xc778('0x55')](_0x4638c7['query'][_0xc778('0x50')]);}})[_0xc778('0x27')](respondWithStatusCode(_0x4206c0,null))[_0xc778('0x44')](handleError(_0x4206c0,null));};exports[_0xc778('0x56')]=function(_0x34aa37,_0x44a6d4,_0x409db2){if(_0x34aa37[_0xc778('0x49')]['id']){delete _0x34aa37['body']['id'];}return db['ChatGroup'][_0xc778('0x46')]({'where':{'id':_0x34aa37[_0xc778('0x45')]['id']}})[_0xc778('0x27')](handleEntityNotFound(_0x44a6d4,null))[_0xc778('0x27')](function(_0xd0105e){if(_0xd0105e){_0x34aa37['body'][_0xc778('0x57')]=_0xd0105e['id'];return db[_0xc778('0x4c')][_0xc778('0x47')](_0x34aa37['body']);}})['then'](respondWithResult(_0x44a6d4,null))['catch'](handleError(_0x44a6d4,null));};exports['getMessages']=function(_0x2f7b9b,_0x21d0cb,_0x5d8337){var _0x8e1305={};var _0x1bd081={};var _0x57237c;var _0x498c0b;return db['ChatGroup'][_0xc778('0x53')]({'where':{'id':_0x2f7b9b['params']['id']}})[_0xc778('0x27')](handleEntityNotFound(_0x21d0cb,null))[_0xc778('0x27')](function(_0x4b0112){if(_0x4b0112){_0x57237c=_0x4b0112;_0x1bd081[_0xc778('0x2f')]=_['keys'](db[_0xc778('0x4c')][_0xc778('0x2d')]);_0x1bd081[_0xc778('0x30')]=_[_0xc778('0x31')](_0x2f7b9b[_0xc778('0x30')]);_0x1bd081[_0xc778('0x32')]=_[_0xc778('0x33')](_0x1bd081[_0xc778('0x2f')],_0x1bd081[_0xc778('0x30')]);_0x8e1305[_0xc778('0x34')]=_['intersection'](_0x1bd081[_0xc778('0x2f')],qs[_0xc778('0x35')](_0x2f7b9b[_0xc778('0x30')][_0xc778('0x35')]));_0x8e1305[_0xc778('0x34')]=_0x8e1305[_0xc778('0x34')][_0xc778('0x36')]?_0x8e1305[_0xc778('0x34')]:_0x1bd081[_0xc778('0x2f')];_0x8e1305[_0xc778('0x39')]=qs[_0xc778('0x3a')](_0x2f7b9b[_0xc778('0x30')][_0xc778('0x3a')]);_0x8e1305[_0xc778('0x3b')]=qs[_0xc778('0x32')](_[_0xc778('0x3c')](_0x2f7b9b[_0xc778('0x30')],_0x1bd081[_0xc778('0x32')]));if(_0x2f7b9b[_0xc778('0x30')]['filter']){_0x8e1305['where']=_['merge'](_0x8e1305[_0xc778('0x3b')],{'$or':_[_0xc778('0x2c')](_0x8e1305[_0xc778('0x34')],function(_0x3d7de2){var _0x48ef3e={};_0x48ef3e[_0x3d7de2]={'$like':'%'+_0x2f7b9b[_0xc778('0x30')][_0xc778('0x3f')]+'%'};return _0x48ef3e;})});}if(_0x2f7b9b[_0xc778('0x30')]['$gte']){var _0x244bff=_0x2f7b9b[_0xc778('0x30')][_0xc778('0x58')]['split'](',');var _0x1483dc={};_0x1483dc[_0x244bff[0x0]]={'$gte':moment(_0x244bff[0x1])[_0xc778('0x59')](_0xc778('0x5a'))};_0x8e1305['where']=_[_0xc778('0x40')](_0x8e1305[_0xc778('0x3b')],_0x1483dc);}_0x8e1305=_[_0xc778('0x40')]({},_0x8e1305,_0x2f7b9b[_0xc778('0x41')]);return _0x57237c[_0xc778('0x5b')](_0x8e1305);}})[_0xc778('0x27')](function(_0x40408e){if(_0x40408e){_0x498c0b=_0x40408e['length'];if(!_0x2f7b9b['query'][_0xc778('0x37')](_0xc778('0x38'))){_0x8e1305[_0xc778('0x1f')]=qs[_0xc778('0x1f')](_0x2f7b9b[_0xc778('0x30')]['limit']);_0x8e1305[_0xc778('0x21')]=qs[_0xc778('0x21')](_0x2f7b9b[_0xc778('0x30')][_0xc778('0x21')]);}return _0x57237c['getMessages'](_0x8e1305);}})[_0xc778('0x27')](function(_0x2a5902){if(_0x2a5902){return _0x2a5902?{'count':_0x498c0b,'rows':_0x2a5902}:null;}})[_0xc778('0x27')](respondWithResult(_0x21d0cb,null))[_0xc778('0x44')](handleError(_0x21d0cb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 71bda71..ea63e80 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 _0x228d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove'];(function(_0x546ce7,_0x135234){var _0x1e1530=function(_0x4459f6){while(--_0x4459f6){_0x546ce7['push'](_0x546ce7['shift']());}};_0x1e1530(++_0x135234);}(_0x228d,0xfe));var _0xd228=function(_0xea46d,_0x254082){_0xea46d=_0xea46d-0x0;var _0x1fa4c5=_0x228d[_0xea46d];return _0x1fa4c5;};'use strict';var EventEmitter=require(_0xd228('0x0'));var ChatGroup=require(_0xd228('0x1'))['db'][_0xd228('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd228('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd228('0x4'),'afterDestroy':_0xd228('0x5')};function emitEvent(_0xa06a3f){return function(_0x560ad1,_0x42172b,_0x2c9e33){ChatGroupEvents[_0xd228('0x6')](_0xa06a3f+':'+_0x560ad1['id'],_0x560ad1);ChatGroupEvents[_0xd228('0x6')](_0xa06a3f,_0x560ad1);_0x2c9e33(null);};}for(var e in events){if(events[_0xd228('0x7')](e)){var event=events[e];ChatGroup[_0xd228('0x8')](e,emitEvent(event));}}module[_0xd228('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x2929=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2929,0x77));var _0x9292=function(_0x211a44,_0x2ecd20){_0x211a44=_0x211a44-0x0;var _0x1bc738=_0x2929[_0x211a44];return _0x1bc738;};'use strict';var EventEmitter=require(_0x9292('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9292('0x1')](0x0);var events={'afterCreate':_0x9292('0x2'),'afterUpdate':_0x9292('0x3'),'afterDestroy':_0x9292('0x4')};function emitEvent(_0xbfb6b5){return function(_0x3099ef,_0x2cd141,_0x22f161){ChatGroupEvents[_0x9292('0x5')](_0xbfb6b5+':'+_0x3099ef['id'],_0x3099ef);ChatGroupEvents[_0x9292('0x5')](_0xbfb6b5,_0x3099ef);_0x22f161(null);};}for(var e in events){if(events[_0x9292('0x6')](e)){var event=events[e];ChatGroup[_0x9292('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4014e7e..ab2607a 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 _0x8bfa=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api'];(function(_0x4b009d,_0x2817e3){var _0x77ff93=function(_0x5228af){while(--_0x5228af){_0x4b009d['push'](_0x4b009d['shift']());}};_0x77ff93(++_0x2817e3);}(_0x8bfa,0xfa));var _0xa8bf=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x8bfa[_0x33554b];return _0x256954;};'use strict';var _=require('lodash');var util=require(_0xa8bf('0x0'));var logger=require(_0xa8bf('0x1'))(_0xa8bf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa8bf('0x3'));var fs=require('fs');var path=require(_0xa8bf('0x4'));var rimraf=require('rimraf');var config=require(_0xa8bf('0x5'));var attributes=require(_0xa8bf('0x6'));module[_0xa8bf('0x7')]=function(_0x4d2fe2,_0x3953c6){return _0x4d2fe2[_0xa8bf('0x8')](_0xa8bf('0x9'),attributes,{'tableName':_0xa8bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf0c=['ChatGroup','lodash','util','../../config/logger','moment','path','../../config/environment','./chatGroup.attributes','define'];(function(_0x4e30ce,_0x2aded5){var _0x1e9a06=function(_0x4e9b83){while(--_0x4e9b83){_0x4e30ce['push'](_0x4e30ce['shift']());}};_0x1e9a06(++_0x2aded5);}(_0xcf0c,0x1e7));var _0xccf0=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xcf0c[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0xccf0('0x0'));var util=require(_0xccf0('0x1'));var logger=require(_0xccf0('0x2'))('api');var moment=require(_0xccf0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xccf0('0x4'));var rimraf=require('rimraf');var config=require(_0xccf0('0x5'));var attributes=require(_0xccf0('0x6'));module['exports']=function(_0x511c5a,_0x1366ba){return _0x511c5a[_0xccf0('0x7')](_0xccf0('0x8'),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 6b9b38d..bbf0bc1 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 _0xb2b5=['result','catch','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s'];(function(_0x30ae7b,_0x3a718f){var _0xa9d0cf=function(_0x8102a1){while(--_0x8102a1){_0x30ae7b['push'](_0x30ae7b['shift']());}};_0xa9d0cf(++_0x3a718f);}(_0xb2b5,0xa3));var _0x5b2b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb2b5[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b2b('0x0'));var fs=require('fs');var Redis=require(_0x5b2b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b2b('0x2'))(_0x5b2b('0x3'));var config=require(_0x5b2b('0x4'));var jayson=require(_0x5b2b('0x5'));var client=jayson['client'][_0x5b2b('0x6')]({'port':0x232a});config[_0x5b2b('0x7')]=_['defaults'](config['redis'],{'host':_0x5b2b('0x8'),'port':0x18eb});var socket=require(_0x5b2b('0x9'))(new Redis(config[_0x5b2b('0x7')]));require(_0x5b2b('0xa'))[_0x5b2b('0xb')](socket);function respondWithRpcPromise(_0x29d7be,_0x15425f,_0xa39fc6){return new BPromise(function(_0x52675e,_0x56c260){return client[_0x5b2b('0xc')](_0x29d7be,_0xa39fc6)['then'](function(_0x1290ed){logger[_0x5b2b('0xd')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0x5b2b('0xe'));logger[_0x5b2b('0xf')](_0x5b2b('0x10'),_0x15425f,_0x5b2b('0xe'),JSON[_0x5b2b('0x11')](_0x1290ed));if(_0x1290ed[_0x5b2b('0x12')]){if(_0x1290ed[_0x5b2b('0x12')]['code']===0x1f4){logger[_0x5b2b('0x12')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0x1290ed[_0x5b2b('0x12')][_0x5b2b('0x13')]);return _0x56c260(_0x1290ed[_0x5b2b('0x12')][_0x5b2b('0x13')]);}logger['error'](_0x5b2b('0x14'),_0x15425f,_0x1290ed['error'][_0x5b2b('0x13')]);return _0x52675e(_0x1290ed['error']['message']);}else{logger[_0x5b2b('0xd')](_0x5b2b('0x14'),_0x15425f,'request\x20sent');_0x52675e(_0x1290ed[_0x5b2b('0x15')][_0x5b2b('0x13')]);}})[_0x5b2b('0x16')](function(_0xce3474){logger[_0x5b2b('0x12')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0xce3474);_0x56c260(_0xce3474);});});} \ No newline at end of file +var _0x0c85=['info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','result','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./chatGroup.socket','request'];(function(_0x149951,_0x3ad5d2){var _0x16c08f=function(_0x4f58f7){while(--_0x4f58f7){_0x149951['push'](_0x149951['shift']());}};_0x16c08f(++_0x3ad5d2);}(_0x0c85,0x14f));var _0x50c8=function(_0x397105,_0x301b79){_0x397105=_0x397105-0x0;var _0x21d33e=_0x0c85[_0x397105];return _0x21d33e;};'use strict';var _=require(_0x50c8('0x0'));var util=require(_0x50c8('0x1'));var moment=require(_0x50c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x50c8('0x3'));var fs=require('fs');var Redis=require(_0x50c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x50c8('0x5'));var logger=require(_0x50c8('0x6'))(_0x50c8('0x7'));var config=require(_0x50c8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50c8('0x9')][_0x50c8('0xa')]({'port':0x232a});config['redis']=_[_0x50c8('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50c8('0xc')]));require(_0x50c8('0xd'))['register'](socket);function respondWithRpcPromise(_0x3ff821,_0x5c52e5,_0x465a90){return new BPromise(function(_0x11dbb3,_0x34ad08){return client[_0x50c8('0xe')](_0x3ff821,_0x465a90)['then'](function(_0x581cd3){logger[_0x50c8('0xf')](_0x50c8('0x10'),_0x5c52e5,'request\x20sent');logger[_0x50c8('0x11')](_0x50c8('0x12'),_0x5c52e5,_0x50c8('0x13'),JSON['stringify'](_0x581cd3));if(_0x581cd3[_0x50c8('0x14')]){if(_0x581cd3[_0x50c8('0x14')][_0x50c8('0x15')]===0x1f4){logger[_0x50c8('0x14')](_0x50c8('0x10'),_0x5c52e5,_0x581cd3[_0x50c8('0x14')]['message']);return _0x34ad08(_0x581cd3[_0x50c8('0x14')]['message']);}logger['error'](_0x50c8('0x10'),_0x5c52e5,_0x581cd3['error']['message']);return _0x11dbb3(_0x581cd3['error']['message']);}else{logger[_0x50c8('0xf')](_0x50c8('0x10'),_0x5c52e5,_0x50c8('0x13'));_0x11dbb3(_0x581cd3[_0x50c8('0x16')][_0x50c8('0x17')]);}})[_0x50c8('0x18')](function(_0x220ae1){logger[_0x50c8('0x14')](_0x50c8('0x10'),_0x5c52e5,_0x220ae1);_0x34ad08(_0x220ae1);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index fb0c752..62bfef3 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 _0xa314=['length','chatGroup:','./chatGroup.events','save','removeListener','register'];(function(_0x4c6500,_0xba0326){var _0x7fe60d=function(_0x436843){while(--_0x436843){_0x4c6500['push'](_0x4c6500['shift']());}};_0x7fe60d(++_0xba0326);}(_0xa314,0x152));var _0x4a31=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xa314[_0x81f000];return _0x337aa2;};'use strict';var ChatGroupEvents=require(_0x4a31('0x0'));var events=[_0x4a31('0x1'),'remove','update'];function createListener(_0x465004,_0x37e8d0){return function(_0x2ce6e9){_0x37e8d0['emit'](_0x465004,_0x2ce6e9);};}function removeListener(_0x4b57c9,_0x52c8e3){return function(){ChatGroupEvents[_0x4a31('0x2')](_0x4b57c9,_0x52c8e3);};}exports[_0x4a31('0x3')]=function(_0x5220b9){for(var _0x1edc49=0x0,_0x55c39d=events[_0x4a31('0x4')];_0x1edc49<_0x55c39d;_0x1edc49++){var _0x33e9ff=events[_0x1edc49];var _0x2816e9=createListener(_0x4a31('0x5')+_0x33e9ff,_0x5220b9);ChatGroupEvents['on'](_0x33e9ff,_0x2816e9);}}; \ No newline at end of file +var _0x495a=['remove','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x495a,0xd6));var _0xa495=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x495a[_0x15c421];return _0x5e5ed5;};'use strict';var ChatGroupEvents=require(_0xa495('0x0'));var events=[_0xa495('0x1'),_0xa495('0x2'),'update'];function createListener(_0x563963,_0x1b66ce){return function(_0x16d5cf){_0x1b66ce[_0xa495('0x3')](_0x563963,_0x16d5cf);};}function removeListener(_0x10bc4c,_0x578c4a){return function(){ChatGroupEvents[_0xa495('0x4')](_0x10bc4c,_0x578c4a);};}exports[_0xa495('0x5')]=function(_0x4b0f4b){for(var _0x1d3aa9=0x0,_0x186fba=events[_0xa495('0x6')];_0x1d3aa9<_0x186fba;_0x1d3aa9++){var _0x2c1d61=events[_0x1d3aa9];var _0x36e02a=createListener(_0xa495('0x7')+_0x2c1d61,_0x4b0f4b);ChatGroupEvents['on'](_0x2c1d61,_0x36e02a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 648acea..13ee00e 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 _0x7957=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','update','delete','removeMembers','exports','multer','path','connect-timeout','express','Router'];(function(_0x3a1e38,_0x978148){var _0x370473=function(_0x53975e){while(--_0x53975e){_0x3a1e38['push'](_0x3a1e38['shift']());}};_0x370473(++_0x978148);}(_0x7957,0x8c));var _0x7795=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x7957[_0x21205e];return _0x136ebb;};'use strict';var multer=require(_0x7795('0x0'));var util=require('util');var path=require(_0x7795('0x1'));var timeout=require(_0x7795('0x2'));var express=require(_0x7795('0x3'));var router=express[_0x7795('0x4')]();var fs_extra=require(_0x7795('0x5'));var auth=require(_0x7795('0x6'));var interaction=require(_0x7795('0x7'));var config=require('../../config/environment');var controller=require(_0x7795('0x8'));router['get']('/',auth[_0x7795('0x9')](),controller[_0x7795('0xa')]);router[_0x7795('0xb')](_0x7795('0xc'),auth[_0x7795('0x9')](),controller[_0x7795('0xd')]);router['get'](_0x7795('0xe'),auth['isAuthenticated'](),controller[_0x7795('0xf')]);router[_0x7795('0xb')](_0x7795('0x10'),auth[_0x7795('0x9')](),controller[_0x7795('0x11')]);router['get'](_0x7795('0x12'),auth[_0x7795('0x9')](),controller[_0x7795('0x13')]);router[_0x7795('0xb')](_0x7795('0x14'),auth[_0x7795('0x9')](),controller[_0x7795('0x15')]);router['post']('/',auth[_0x7795('0x9')](),controller[_0x7795('0x16')]);router[_0x7795('0x17')]('/:id/members',auth[_0x7795('0x9')](),controller[_0x7795('0x18')]);router['post'](_0x7795('0x14'),auth[_0x7795('0x9')](),controller['addMessage']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7795('0x19')]);router[_0x7795('0x1a')](_0x7795('0xe'),auth[_0x7795('0x9')](),controller['destroy']);router[_0x7795('0x1a')](_0x7795('0x12'),auth[_0x7795('0x9')](),controller[_0x7795('0x1b')]);module[_0x7795('0x1c')]=router; \ No newline at end of file +var _0xbe29=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMessage','put','update','delete','destroy','removeMembers','multer','util','path'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xbe29,0x10b));var _0x9be2=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xbe29[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0x9be2('0x0'));var util=require(_0x9be2('0x1'));var path=require(_0x9be2('0x2'));var timeout=require(_0x9be2('0x3'));var express=require(_0x9be2('0x4'));var router=express[_0x9be2('0x5')]();var fs_extra=require(_0x9be2('0x6'));var auth=require(_0x9be2('0x7'));var interaction=require(_0x9be2('0x8'));var config=require(_0x9be2('0x9'));var controller=require(_0x9be2('0xa'));router[_0x9be2('0xb')]('/',auth[_0x9be2('0xc')](),controller[_0x9be2('0xd')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9be2('0xe')]);router['get'](_0x9be2('0xf'),auth['isAuthenticated'](),controller[_0x9be2('0x10')]);router[_0x9be2('0xb')](_0x9be2('0x11'),auth[_0x9be2('0xc')](),controller[_0x9be2('0x12')]);router[_0x9be2('0xb')]('/:id/members',auth[_0x9be2('0xc')](),controller[_0x9be2('0x13')]);router[_0x9be2('0xb')](_0x9be2('0x14'),auth['isAuthenticated'](),controller[_0x9be2('0x15')]);router[_0x9be2('0x16')]('/',auth[_0x9be2('0xc')](),controller['create']);router['post'](_0x9be2('0x17'),auth[_0x9be2('0xc')](),controller['addMembers']);router[_0x9be2('0x16')](_0x9be2('0x14'),auth['isAuthenticated'](),controller[_0x9be2('0x18')]);router[_0x9be2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x9be2('0x1a')]);router[_0x9be2('0x1b')](_0x9be2('0xf'),auth[_0x9be2('0xc')](),controller[_0x9be2('0x1c')]);router['delete'](_0x9be2('0x17'),auth[_0x9be2('0xc')](),controller[_0x9be2('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c8a6692..1c22212 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 _0xba5a=['star','TEXT','STRING','long','DATE','exports','BOOLEAN','INTEGER','thumb'];(function(_0x178611,_0x5a2987){var _0x5454f5=function(_0x93af96){while(--_0x93af96){_0x178611['push'](_0x178611['shift']());}};_0x5454f5(++_0x5a2987);}(_0xba5a,0x1d0));var _0xaba5=function(_0x3cd133,_0x222fcb){_0x3cd133=_0x3cd133-0x0;var _0x2512c8=_0xba5a[_0x3cd133];return _0x2512c8;};'use strict';var Sequelize=require('sequelize');module[_0xaba5('0x0')]={'closed':{'type':Sequelize[_0xaba5('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xaba5('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0xaba5('0x3')),'defaultValue':_0xaba5('0x4')},'ratingMessage':{'type':Sequelize[_0xaba5('0x5')]},'pathTranscript':{'type':Sequelize[_0xaba5('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaba5('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xaba5('0x6')]},'browserName':{'type':Sequelize[_0xaba5('0x6')]},'browserVersion':{'type':Sequelize[_0xaba5('0x6')]},'osName':{'type':Sequelize[_0xaba5('0x6')]},'osVersion':{'type':Sequelize[_0xaba5('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xaba5('0x6')]},'deviceType':{'type':Sequelize[_0xaba5('0x6')]},'referer':{'type':Sequelize[_0xaba5('0x5')]},'customerIp':{'type':Sequelize[_0xaba5('0x6')]},'formData':{'type':Sequelize[_0xaba5('0x5')](_0xaba5('0x7'))},'read1stAt':{'type':Sequelize[_0xaba5('0x8')]},'lastMsgAt':{'type':Sequelize[_0xaba5('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xaba5('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xaba5('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe9e8=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize'];(function(_0x35134b,_0x519933){var _0xd7e4d=function(_0x45248b){while(--_0x45248b){_0x35134b['push'](_0x35134b['shift']());}};_0xd7e4d(++_0x519933);}(_0xe9e8,0x6b));var _0x8e9e=function(_0xbf837,_0x233540){_0xbf837=_0xbf837-0x0;var _0x436025=_0xe9e8[_0xbf837];return _0x436025;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'closed':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8e9e('0x3')]},'ratingType':{'type':Sequelize[_0x8e9e('0x4')](_0x8e9e('0x5'),_0x8e9e('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8e9e('0x7')]},'pathTranscript':{'type':Sequelize[_0x8e9e('0x7')]},'mailTranscript':{'type':Sequelize[_0x8e9e('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8e9e('0x8')]},'secondDisposition':{'type':Sequelize[_0x8e9e('0x8')]},'thirdDisposition':{'type':Sequelize[_0x8e9e('0x8')]},'note':{'type':Sequelize[_0x8e9e('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x8e9e('0x8')]},'osName':{'type':Sequelize[_0x8e9e('0x8')]},'osVersion':{'type':Sequelize[_0x8e9e('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x8e9e('0x8')]},'deviceType':{'type':Sequelize[_0x8e9e('0x8')]},'referer':{'type':Sequelize[_0x8e9e('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8e9e('0x7')](_0x8e9e('0x9'))},'read1stAt':{'type':Sequelize[_0x8e9e('0xa')]},'lastMsgAt':{'type':Sequelize[_0x8e9e('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x8e9e('0x4')]('in',_0x8e9e('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8e9e('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x8e9e('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d8781db..2332934 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 _0xda55=['fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','vidaooTopic','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','AbandonInteraction','file','basename','filename','Attachment','attachmentDownload','Unauthorized','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','%s%d','agentAlias','customer','Visitor','website_alias','agent_alias','System','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','sort','filter','merge','include','findAll','rows','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','views','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','bluebird','mustache','util','path','ejs','squel','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','undefined','count','limit','Content-Range','destroy','then','stack','name','send','render','body','contact','agent','interaction','account','Users','map','TagIds','split','forEach','Tags','push','waiting','unmanaged','abandoned','total','closed','UserId','talking','disposition','answered','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','keyBy','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','ChatInteractionId','all','show','params','includeAll','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooMetadata'];(function(_0x10e1d9,_0x973af7){var _0x2c0c87=function(_0x502d8b){while(--_0x502d8b){_0x10e1d9['push'](_0x10e1d9['shift']());}};_0x2c0c87(++_0x973af7);}(_0xda55,0x6d));var _0x5da5=function(_0x5353a5,_0x550668){_0x5353a5=_0x5353a5-0x0;var _0x1a856b=_0xda55[_0x5353a5];return _0x1a856b;};'use strict';var rimraf=require(_0x5da5('0x0'));var zipdir=require(_0x5da5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5da5('0x2'));var Mustache=require(_0x5da5('0x3'));var util=require(_0x5da5('0x4'));var path=require(_0x5da5('0x5'));var ejs=require(_0x5da5('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5da5('0x7'));var Redis=require('ioredis');var qs=require(_0x5da5('0x8'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5da5('0x9'));var logger=require(_0x5da5('0xa'))(_0x5da5('0xb'));var config=require(_0x5da5('0xc'));var db=require(_0x5da5('0xd'))['db'];config[_0x5da5('0xe')]=_[_0x5da5('0xf')](config[_0x5da5('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x5da5('0x10'))(new Redis(config[_0x5da5('0xe')]));require(_0x5da5('0x11'))[_0x5da5('0x12')](socket);var jayson=require(_0x5da5('0x13'));var client=jayson[_0x5da5('0x14')][_0x5da5('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x5da5('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x3b5ff9,_0x4f813b,_0x37aeb0,_0x31366e){return new BPromise(function(_0x3ced00,_0x43d526){var _0x1877d4=_0x31366e||client;return _0x1877d4[_0x5da5('0x16')](_0x3b5ff9,_0x37aeb0)['then'](function(_0x489b60){logger['info'](_0x5da5('0x17'),_0x4f813b,_0x5da5('0x18'));logger[_0x5da5('0x19')](_0x5da5('0x1a'),_0x4f813b,_0x5da5('0x18'),JSON[_0x5da5('0x1b')](_0x489b60));if(_0x489b60[_0x5da5('0x1c')]){if(_0x489b60['error'][_0x5da5('0x1d')]===0x1f4){logger[_0x5da5('0x1c')](_0x5da5('0x17'),_0x4f813b,_0x489b60[_0x5da5('0x1c')][_0x5da5('0x1e')]);return _0x43d526(_0x489b60[_0x5da5('0x1c')]['message']);}logger[_0x5da5('0x1c')](_0x5da5('0x17'),_0x4f813b,_0x489b60[_0x5da5('0x1c')][_0x5da5('0x1e')]);return _0x3ced00(_0x489b60[_0x5da5('0x1c')]['message']);}else{logger[_0x5da5('0x1f')](_0x5da5('0x17'),_0x4f813b,_0x5da5('0x18'));_0x3ced00(_0x489b60['result'][_0x5da5('0x1e')]);}})[_0x5da5('0x20')](function(_0x20c8a6){logger[_0x5da5('0x1c')](_0x5da5('0x17'),_0x4f813b,_0x20c8a6);_0x43d526(_0x20c8a6);});});}function respondWithStatusCode(_0x436960,_0x47d4e8){_0x47d4e8=_0x47d4e8||0xcc;return function(_0x1a6bd7){if(_0x1a6bd7){return _0x436960['sendStatus'](_0x47d4e8);}return _0x436960[_0x5da5('0x21')](_0x47d4e8)[_0x5da5('0x22')]();};}function respondWithResult(_0x2dd138,_0x5d983c){_0x5d983c=_0x5d983c||0xc8;return function(_0x31c6ed){if(_0x31c6ed){return _0x2dd138[_0x5da5('0x21')](_0x5d983c)[_0x5da5('0x23')](_0x31c6ed);}};}function respondWithFilteredResult(_0x21e795,_0x55d517){return function(_0x5b0b43){if(_0x5b0b43){var _0x50aadc=typeof _0x55d517[_0x5da5('0x24')]==='undefined'&&typeof _0x55d517['limit']===_0x5da5('0x25');var _0x3974d8=_0x5b0b43['count'];var _0x1798ae=_0x50aadc?0x0:_0x55d517[_0x5da5('0x24')];var _0x558b12=_0x50aadc?_0x5b0b43[_0x5da5('0x26')]:_0x55d517[_0x5da5('0x24')]+_0x55d517[_0x5da5('0x27')];var _0x42292d;if(_0x558b12>=_0x3974d8){_0x558b12=_0x3974d8;_0x42292d=0xc8;}else{_0x42292d=0xce;}_0x21e795[_0x5da5('0x21')](_0x42292d);return _0x21e795['set'](_0x5da5('0x28'),_0x1798ae+'-'+_0x558b12+'/'+_0x3974d8)[_0x5da5('0x23')](_0x5b0b43);}return null;};}function saveUpdates(_0x31cb5f){return function(_0x15a0c0){if(_0x15a0c0){return _0x15a0c0['update'](_0x31cb5f)['then'](function(_0x4cb022){return _0x4cb022;});}return null;};}function removeEntity(_0x245273){return function(_0x27ed41){if(_0x27ed41){return _0x27ed41[_0x5da5('0x29')]()[_0x5da5('0x2a')](function(){_0x245273['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e115){return function(_0x4afb58){if(!_0x4afb58){_0x24e115['sendStatus'](0x194);}return _0x4afb58;};}function handleError(_0x2dd4b6,_0x4c6cce){_0x4c6cce=_0x4c6cce||0x1f4;return function(_0x42dc92){logger[_0x5da5('0x1c')](_0x42dc92[_0x5da5('0x2b')]);if(_0x42dc92[_0x5da5('0x2c')]){delete _0x42dc92[_0x5da5('0x2c')];}_0x2dd4b6[_0x5da5('0x21')](_0x4c6cce)[_0x5da5('0x2d')](_0x42dc92);};}function getMustacheRender(_0x3dc66a,_0x52ce3c){return Mustache[_0x5da5('0x2e')](_0x3dc66a,_['merge'](_0x52ce3c[_0x5da5('0x2f')],{'contact':_0x52ce3c[_0x5da5('0x30')],'message':_0x52ce3c[_0x5da5('0x1e')],'agent':_0x52ce3c[_0x5da5('0x31')],'interaction':_0x52ce3c[_0x5da5('0x32')],'account':_0x52ce3c[_0x5da5('0x33')]}))||'';}function getInteractionUsers(_0x325ccd,_0x117610){return new BPromise(function(_0xf6c5c9,_0x1828e9){try{if(_0x117610[_0x325ccd['id']]){_0x325ccd[_0x5da5('0x34')]=_[_0x5da5('0x35')](_0x117610[_0x325ccd['id']],function(_0x3ba804){return{'id':_0x3ba804['id'],'fullname':_0x3ba804['fullname']};});}}catch(_0x43686c){_0x1828e9(_0x43686c);}_0xf6c5c9(_0x325ccd);});}function getInteractionTags(_0x4cf3ad,_0x2d6280){return new BPromise(function(_0x40f6c6,_0x29d6aa){try{if(_0x4cf3ad[_0x5da5('0x36')]){_0x4cf3ad['Tags']=[];_0x4cf3ad[_0x5da5('0x36')][_0x5da5('0x37')](',')[_0x5da5('0x38')](function(_0x56fd57){_0x4cf3ad[_0x5da5('0x39')][_0x5da5('0x3a')](_0x2d6280[_0x56fd57]);});}delete _0x4cf3ad['TagIds'];}catch(_0x18d00b){_0x29d6aa(_0x18d00b);}_0x40f6c6(_0x4cf3ad);});}function updateChatInteraction(_0xa90d5,_0xe9888e,_0x38a974){return new BPromise(function(_0x2c9b00,_0x664a8d){return getInteractionUsers(_0xa90d5,_0x38a974)['then'](function(_0x1ab02){return getInteractionTags(_0x1ab02,_0xe9888e);})[_0x5da5('0x2a')](function(_0x14c3f5){return getStateInteraction(_0x14c3f5);})[_0x5da5('0x2a')](function(_0x4466b2){_0x2c9b00(_0x4466b2);})['catch'](function(_0x472e9f){_0x664a8d(_0x472e9f);});});}function getStateInteraction(_0x21ffa1){return new BPromise(function(_0x5a189e){_0x21ffa1[_0x5da5('0x3b')]=0x0;_0x21ffa1['talking']=0x0;_0x21ffa1['answered']=0x0;_0x21ffa1[_0x5da5('0x3c')]=0x0;_0x21ffa1[_0x5da5('0x3d')]=0x0;_0x21ffa1[_0x5da5('0x3e')]=0x0;if(!_0x21ffa1[_0x5da5('0x3f')]&&!_0x21ffa1[_0x5da5('0x40')]){_0x21ffa1[_0x5da5('0x3b')]+=0x1;}if(!_0x21ffa1[_0x5da5('0x3f')]&&_0x21ffa1[_0x5da5('0x40')]){_0x21ffa1[_0x5da5('0x41')]+=0x1;if(_0x21ffa1[_0x5da5('0x3b')]){_0x21ffa1[_0x5da5('0x3b')]-=0x1;}}if(_0x21ffa1[_0x5da5('0x3f')]&&_0x21ffa1[_0x5da5('0x42')]===_0x5da5('0x3d')){_0x21ffa1[_0x5da5('0x3d')]+=0x1;if(_0x21ffa1[_0x5da5('0x3b')]){_0x21ffa1[_0x5da5('0x3b')]-=0x1;}}else if(_0x21ffa1[_0x5da5('0x3f')]&&!_0x21ffa1[_0x5da5('0x40')]&&_0x21ffa1[_0x5da5('0x42')]){_0x21ffa1['unmanaged']+=0x1;if(_0x21ffa1['waiting']){_0x21ffa1[_0x5da5('0x3b')]-=0x1;}}else if(_0x21ffa1[_0x5da5('0x3f')]&&_0x21ffa1['UserId']){_0x21ffa1[_0x5da5('0x43')]+=0x1;if(_0x21ffa1[_0x5da5('0x41')]){_0x21ffa1[_0x5da5('0x41')]-=0x1;}}_0x21ffa1[_0x5da5('0x3e')]+=0x1;_0x5a189e(_0x21ffa1);});}exports[_0x5da5('0x44')]=function(_0x207a7c,_0x2775da){var _0x362028={},_0x3cb7a9={},_0x44de08={'count':0x0,'rows':[]};var _0x4fc584=_[_0x5da5('0x35')](db['ChatInteraction']['rawAttributes'],function(_0x2a0fb6){return{'name':_0x2a0fb6[_0x5da5('0x45')],'type':_0x2a0fb6[_0x5da5('0x46')][_0x5da5('0x47')]};});_0x3cb7a9[_0x5da5('0x48')]=_[_0x5da5('0x35')](_0x4fc584,'name');_0x3cb7a9[_0x5da5('0x49')]=_['keys'](_0x207a7c['query']);_0x3cb7a9[_0x5da5('0x4a')]=_[_0x5da5('0x4b')](_0x3cb7a9['model'],_0x3cb7a9[_0x5da5('0x49')]);_0x362028[_0x5da5('0x4c')]=_[_0x5da5('0x4b')](_0x3cb7a9[_0x5da5('0x48')],qs[_0x5da5('0x4d')](_0x207a7c['query'][_0x5da5('0x4d')]));_0x362028['attributes']=_0x362028['attributes'][_0x5da5('0x4e')]?_0x362028['attributes']:_0x3cb7a9[_0x5da5('0x48')];if(!_0x207a7c[_0x5da5('0x49')][_0x5da5('0x4f')](_0x5da5('0x50'))){_0x362028[_0x5da5('0x27')]=qs[_0x5da5('0x27')](_0x207a7c['query']['limit']);_0x362028[_0x5da5('0x24')]=qs[_0x5da5('0x24')](_0x207a7c['query']['offset']);}_0x362028[_0x5da5('0x51')]=qs['sort'](_0x207a7c[_0x5da5('0x49')]['sort']);_0x362028['where']=qs[_0x5da5('0x4a')](_[_0x5da5('0x52')](_0x207a7c[_0x5da5('0x49')],_0x3cb7a9[_0x5da5('0x4a')]),_0x4fc584);var _0x4c654c=[];var _0x267b07=squel[_0x5da5('0x53')]()[_0x5da5('0x54')]('id')['field'](_0x5da5('0x2c'))[_0x5da5('0x54')](_0x5da5('0x55'))[_0x5da5('0x56')](_0x5da5('0x57'));var _0x2e6460=squel[_0x5da5('0x53')]()[_0x5da5('0x54')](_0x5da5('0x58'))[_0x5da5('0x54')](_0x5da5('0x59'))[_0x5da5('0x54')](_0x5da5('0x5a'))[_0x5da5('0x56')](_0x5da5('0x5b'),'ui')[_0x5da5('0x5c')](_0x5da5('0x5d'),'u',_0x5da5('0x5e'));var _0x191691=squel[_0x5da5('0x53')]()[_0x5da5('0x56')]('chat_interactions','i')[_0x5da5('0x5c')](_0x5da5('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x5da5('0x60'))[_0x5da5('0x5c')](_0x5da5('0x61'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x5da5('0x62'),'me',_0x5da5('0x63'))[_0x5da5('0x5c')](_0x5da5('0x64'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x5da5('0x5c')](_0x5da5('0x57'),'t',_0x5da5('0x65'));var _0x4e4ffa=squel[_0x5da5('0x66')]();var _0x5913b3=[];var _0x107211=squel[_0x5da5('0x66')]();var _0x4f0e51;if(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x67')]){_0x4f0e51=as[_0x5da5('0x68')](_0x207a7c[_0x5da5('0x49')][_0x5da5('0x67')]);var _0x1252b4=_0x4f0e51[_0x5da5('0x69')];for(var _0x2f9f72=0x0;_0x2f9f72<_0x4f0e51[_0x5da5('0x6a')][_0x5da5('0x4e')];_0x2f9f72++){var _0xb3a7a3=_0x4f0e51[_0x5da5('0x6a')][_0x2f9f72];var _0xd7f04d='i';var _0x1a7f01=_[_0x5da5('0x6b')](_0x4fc584,[_0x5da5('0x2c'),_0xb3a7a3[_0x5da5('0x54')]]);if(!_0x1a7f01){switch(_0xb3a7a3[_0x5da5('0x54')]){case'unreadMessages':if(_0xb3a7a3['value']==0x1){_0x191691[_0x5da5('0x6c')]('`'+_0xb3a7a3[_0x5da5('0x54')]+_0x5da5('0x6d'));}else{_0x191691['having']('`'+_0xb3a7a3[_0x5da5('0x54')]+_0x5da5('0x6e'));}break;case _0x5da5('0x6f'):if(_0xb3a7a3[_0x5da5('0x70')]==='$substring'){if(_0xb3a7a3[_0x5da5('0x71')]['split']('\x20')[_0x5da5('0x4e')]>0x1){_0x4e4ffa[_0x1252b4](_0x5da5('0x72'),qs[_0x5da5('0x73')](_0xb3a7a3[_0x5da5('0x71')]),null);}else{var _0x57966d='%'+_0xb3a7a3[_0x5da5('0x71')]+'%';_0x4e4ffa[_0x1252b4](_0x5da5('0x74'),_0x57966d,_0x57966d,_0x57966d);}}else{_0x1a7f01=_['find'](_0x4fc584,['name','ContactId']);_0xb3a7a3[_0x5da5('0x54')]=_0x5da5('0x75');_0x74801a=as[_0x5da5('0x76')](_0xd7f04d,_0x1a7f01[_0x5da5('0x46')],_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')]['end']);}break;case _0x5da5('0x79'):var _0x444b99=_0xb3a7a3['value']['split'](',')[_0x5da5('0x35')](function(_0x5b48e5){return Number(_0x5b48e5);});_0x444b99[_0x5da5('0x38')](function(_0x4f7e64){_0x107211['or'](_0x5da5('0x7a'),'%,'+_0x4f7e64+',%');});_0x5913b3=_[_0x5da5('0x7b')](_0x5913b3,_0x444b99);break;case _0x5da5('0x7c'):if(_0xb3a7a3[_0x5da5('0x70')]===_0x5da5('0x7d')){_0x4e4ffa[_0x1252b4](_0x5da5('0x7e'),'%'+_0xb3a7a3[_0x5da5('0x71')]+'%',null);}else{_0x1a7f01=_[_0x5da5('0x6b')](_0x4fc584,[_0x5da5('0x2c'),_0x5da5('0x40')]);_0xb3a7a3[_0x5da5('0x54')]=_0x5da5('0x40');_0x74801a=as['buildExpression'](_0xd7f04d,_0x1a7f01['type'],_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')]['end']);}break;case'body':_0x74801a=as['buildExpression']('me',null,_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x22')]);break;}}else{var _0x74801a=as[_0x5da5('0x76')](_0xd7f04d,_0x1a7f01[_0x5da5('0x46')],_0xb3a7a3);_0x4e4ffa[_0x1252b4](_0x74801a[_0x5da5('0x77')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x78')],_0x74801a[_0x5da5('0x71')][_0x5da5('0x22')]);}}}else{var _0x3852bf=_(_0x207a7c[_0x5da5('0x49')])[_0x5da5('0x7f')]()[_0x5da5('0x35')](function(_0x242ca9){return _[_0x5da5('0x80')](_0x4fc584,[_0x5da5('0x2c'),_0x242ca9])?_0x242ca9:undefined;})[_0x5da5('0x81')]()['value']();if(!_[_0x5da5('0x82')](_0x3852bf)){_0x3852bf[_0x5da5('0x38')](function(_0x3fc27e){if(_0x3fc27e===_0x5da5('0x83')){_0x191691['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x5da5('0x84')](_0x207a7c['query'][_0x3fc27e]));}else if(_0x3fc27e===_0x5da5('0x85')){var _0x2b2856=JSON[_0x5da5('0x86')](_0x207a7c[_0x5da5('0x49')][_0x3fc27e])[_0x5da5('0x87')];var _0x3b0282=JSON[_0x5da5('0x86')](_0x207a7c[_0x5da5('0x49')][_0x3fc27e])[_0x5da5('0x88')];_0x191691['where'](_0x5da5('0x89'),_0x2b2856,_0x3b0282);}else{if(_0x207a7c['query'][_0x3fc27e]===_0x5da5('0x8a')){_0x191691[_0x5da5('0x8b')]('i.'+_0x3fc27e+'\x20IS\x20NULL');}else{_0x191691[_0x5da5('0x8b')]('i.'+_0x3fc27e+'\x20=\x20?',_0x207a7c[_0x5da5('0x49')][_0x3fc27e]);}}});}if(_0x207a7c['query'][_0x5da5('0x8c')]){if(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8c')]==0x1){_0x191691[_0x5da5('0x6c')](_0x5da5('0x8d'));}else{_0x191691[_0x5da5('0x6c')](_0x5da5('0x8e'));}}if(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8f')]){_0x5913b3=_['isArray'](_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8f')])?_0x207a7c['query']['tag']:new Array(_0x207a7c[_0x5da5('0x49')][_0x5da5('0x8f')]);_0x5913b3[_0x5da5('0x38')](function(_0xcc15e9){_0x107211['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xcc15e9+',%');});}if(_0x207a7c[_0x5da5('0x49')]['filter']){var _0x26aa9f=_0x207a7c['query']['filter'][_0x5da5('0x90')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x26aa9f)){_0x4e4ffa['or'](_0x5da5('0x91'),_0x26aa9f+'%');}else{_0x4e4ffa['or'](_0x5da5('0x92'),qs[_0x5da5('0x73')](_0x26aa9f))['or'](_0x5da5('0x93'),_0x26aa9f+'%');}}}_0x191691[_0x5da5('0x8b')](_0x4e4ffa);_0x191691[_0x5da5('0x94')](_0x5da5('0x95'));var _0x2bdcc1={'type':db['Sequelize'][_0x5da5('0x96')][_0x5da5('0x97')],'raw':!![]};var _0x3fb2e9=_0x191691[_0x5da5('0x98')]();_0x3fb2e9[_0x5da5('0x54')](_0x5da5('0x95'));_0x3fb2e9[_0x5da5('0x54')](_0x5da5('0x99'),_0x5da5('0x9a'));if(_0x362028[_0x5da5('0x51')]){_0x362028[_0x5da5('0x51')][_0x5da5('0x38')](function(_0x104ae6){var _0xed45a1=_0x104ae6[0x0]===_0x5da5('0x9b')?_0x104ae6[0x0]:'i.'+_0x104ae6[0x0];_0x191691[_0x5da5('0x51')](_0xed45a1,_0x104ae6[0x1]===_0x5da5('0x9c')?![]:!![]);});}if(!_[_0x5da5('0x82')](_0x5913b3)){_0x191691[_0x5da5('0x6c')](_0x107211);_0x3fb2e9[_0x5da5('0x8b')](_0x5da5('0x9d'),_0x5913b3);}BPromise[_0x5da5('0x9e')]()[_0x5da5('0x2a')](function(){if(!_0x4f0e51){if(_0x207a7c[_0x5da5('0x49')]['ChatWebsiteId'])return;_0x3fb2e9[_0x5da5('0x8b')](_0x5da5('0x9f'));_0x191691['where'](_0x5da5('0x9f'));return;}if(_0x207a7c['user'][_0x5da5('0xa0')]!==_0x5da5('0x31'))return;return _0x207a7c[_0x5da5('0xa1')][_0x5da5('0xa2')]({'attributes':['id'],'raw':!![]})[_0x5da5('0x2a')](function(_0x16ceeb){if(_['isEmpty'](_0x16ceeb)){_0x3fb2e9[_0x5da5('0x8b')](_0x5da5('0xa3'));_0x191691['where'](_0x5da5('0xa3'));}else{_0x3fb2e9[_0x5da5('0x8b')]('i.ChatWebsiteId\x20IN\x20?',_[_0x5da5('0x35')](_0x16ceeb,'id'));_0x191691[_0x5da5('0x8b')](_0x5da5('0xa4'),_[_0x5da5('0x35')](_0x16ceeb,'id'));}});})[_0x5da5('0x2a')](function(){if(_0x207a7c[_0x5da5('0xa1')][_0x5da5('0xa0')]===_0x5da5('0x31')&&!_0x4f0e51&&!_0x207a7c[_0x5da5('0x49')][_0x5da5('0x83')])return[];return db['sequelize'][_0x5da5('0x49')](_0x3fb2e9[_0x5da5('0xa5')](),_0x2bdcc1);})[_0x5da5('0x2a')](function(_0x23c2a7){_0x44de08[_0x5da5('0x26')]=_0x23c2a7[_0x5da5('0x4e')];if(_0x44de08[_0x5da5('0x26')]===0x0)return[];return db['sequelize']['query'](_0x267b07[_0x5da5('0xa5')](),_0x2bdcc1)['then'](function(_0x5c8ec0){_0x4c654c=_[_0x5da5('0xa6')](_0x5c8ec0,'id');_0x2bdcc1=_['merge'](_0x2bdcc1,{'model':db[_0x5da5('0xa7')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x207a7c['query'][_0x5da5('0x4d')]){_0x362028[_0x5da5('0x4c')][_0x5da5('0x38')](function(_0x3b834f){_0x191691['field']('i.'+_0x3b834f);});}else{_0x191691[_0x5da5('0x54')](_0x5da5('0x99'),_0x5da5('0x9a'));_0x191691[_0x5da5('0x54')](_0x5da5('0xa8'),_0x5da5('0xa9'));_0x191691[_0x5da5('0x54')](_0x5da5('0xaa'),'Account.mandatoryDisposition');_0x191691[_0x5da5('0x54')](_0x5da5('0xab'),'contactName');_0x191691[_0x5da5('0x54')](_0x5da5('0xac'));_0x191691[_0x5da5('0x54')](_0x5da5('0xad'),'Contact.firstName');_0x191691['field'](_0x5da5('0xae'),_0x5da5('0xaf'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb0'),_0x5da5('0xb1'));_0x191691['field'](_0x5da5('0xb2'),_0x5da5('0xb3'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb4'),_0x5da5('0xb5'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb6'),_0x5da5('0xb7'));_0x191691[_0x5da5('0x54')](_0x5da5('0xb8'),_0x5da5('0xb9'));_0x191691[_0x5da5('0x54')](_0x5da5('0xba'),_0x5da5('0xbb'));_0x191691[_0x5da5('0x54')](_0x5da5('0xbc'),_0x5da5('0x36'));}if(_0x362028[_0x5da5('0x27')])_0x191691[_0x5da5('0x27')](_0x362028['limit']);if(_0x362028[_0x5da5('0x24')])_0x191691['offset'](_0x362028[_0x5da5('0x24')]);return db[_0x5da5('0xbd')][_0x5da5('0x49')](_0x191691[_0x5da5('0xa5')](),_0x2bdcc1);})[_0x5da5('0x2a')](function(_0x5b1a72){if(_0x5b1a72[_0x5da5('0x4e')]>0x0)_0x2e6460[_0x5da5('0x8b')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x5b1a72,'id'));return db[_0x5da5('0xbd')]['query'](_0x2e6460[_0x5da5('0xa5')](),_0x2bdcc1)[_0x5da5('0x2a')](function(_0x1782a6){var _0x1b555f=_[_0x5da5('0xbe')](_0x1782a6,_0x5da5('0xbf'));var _0x341587=[];_0x5b1a72['forEach'](function(_0x57b6e4){_0x341587['push'](updateChatInteraction(_0x57b6e4,_0x4c654c,_0x1b555f));});return BPromise[_0x5da5('0xc0')](_0x341587);});});})[_0x5da5('0x2a')](function(_0x101cdc){_0x44de08['rows']=_0x101cdc;return _0x44de08;})[_0x5da5('0x2a')](respondWithFilteredResult(_0x2775da,_0x362028))[_0x5da5('0x20')](handleError(_0x2775da,null));};exports[_0x5da5('0xc1')]=function(_0xbe0ade,_0x3d6503){var _0xd56fa3={'raw':![],'where':{'id':_0xbe0ade[_0x5da5('0xc2')]['id']}},_0x51a597={};_0x51a597[_0x5da5('0x48')]=_[_0x5da5('0x7f')](db['ChatInteraction']['rawAttributes']);_0x51a597[_0x5da5('0x49')]=_[_0x5da5('0x7f')](_0xbe0ade['query']);_0x51a597[_0x5da5('0x4a')]=_[_0x5da5('0x4b')](_0x51a597['model'],_0x51a597[_0x5da5('0x49')]);_0xd56fa3['attributes']=_['intersection'](_0x51a597[_0x5da5('0x48')],qs['fields'](_0xbe0ade[_0x5da5('0x49')]['fields']));_0xd56fa3[_0x5da5('0x4c')]=_0xd56fa3[_0x5da5('0x4c')]['length']?_0xd56fa3[_0x5da5('0x4c')]:_0x51a597[_0x5da5('0x48')];if(_0xbe0ade[_0x5da5('0x49')][_0x5da5('0xc3')]){_0xd56fa3['include']=[{'all':!![]}];}_0xd56fa3=_['merge']({},_0xd56fa3,_0xbe0ade[_0x5da5('0xc4')]);return db[_0x5da5('0xa7')][_0x5da5('0x6b')](_0xd56fa3)[_0x5da5('0x2a')](handleEntityNotFound(_0x3d6503,null))[_0x5da5('0x2a')](respondWithResult(_0x3d6503,null))[_0x5da5('0x20')](handleError(_0x3d6503,null));};exports['create']=function(_0x2ddbcb,_0x314e83){return db[_0x5da5('0xa7')][_0x5da5('0xc5')](_0x2ddbcb['body'],{})['then'](respondWithResult(_0x314e83,0xc9))[_0x5da5('0x20')](handleError(_0x314e83,null));};exports[_0x5da5('0xc6')]=function(_0x44a307,_0x51cd21){if(_0x44a307['body']['id']){delete _0x44a307[_0x5da5('0x2f')]['id'];}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x44a307[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x51cd21,null))['then'](saveUpdates(_0x44a307['body'],null))[_0x5da5('0x2a')](respondWithResult(_0x51cd21,null))['catch'](handleError(_0x51cd21,null));};exports[_0x5da5('0x29')]=function(_0x449379,_0x24c565){return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x449379[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x24c565,null))[_0x5da5('0x2a')](removeEntity(_0x24c565,null))[_0x5da5('0x20')](handleError(_0x24c565,null));};exports[_0x5da5('0xc7')]=function(_0x2212b1,_0x401cad){return db['ChatInteraction'][_0x5da5('0xc7')]()[_0x5da5('0x2a')](respondWithResult(_0x401cad,null))['catch'](handleError(_0x401cad,null));};exports[_0x5da5('0xc8')]=function(_0x15ccd3,_0x1971c2){var _0x3385eb=_0x15ccd3[_0x5da5('0xc2')]['id'];var _0xe36532;var _0x3568ee;var _0x2daf1d;return db[_0x5da5('0xa7')][_0x5da5('0xc9')]({'where':{'id':_0x3385eb}})['then'](function(_0x3514b3){_0xe36532=_0x3514b3;return db[_0x5da5('0xca')][_0x5da5('0xc9')]({'where':{'id':_0x3514b3['ChatWebsiteId']},'attributes':['id',_0x5da5('0xcb'),'vidaooEscalation','vidaooTopic','vidaooNote',_0x5da5('0xcc')],'raw':!![]});})[_0x5da5('0x2a')](function(_0x1f06ad){if(_0x1f06ad&&_0x1f06ad[_0x5da5('0xcb')]&&_0x1f06ad['vidaooEscalation']){_0x3568ee=_0x1f06ad;var _0x2e341c={'interaction':{'id':_0x3385eb},'agent':{'id':_0x15ccd3[_0x5da5('0xa1')]['id'],'name':_0x15ccd3[_0x5da5('0xa1')][_0x5da5('0x2c')],'fullname':_0x15ccd3[_0x5da5('0xa1')][_0x5da5('0xcd')],'email':_0x15ccd3[_0x5da5('0xa1')]['email']},'contact':_0x15ccd3[_0x5da5('0x2f')][_0x5da5('0x30')],'account':_0x15ccd3[_0x5da5('0x2f')][_0x5da5('0x33')]};var _0x5d85ff={'rejectUnauthorized':![],'method':_0x5da5('0xce'),'url':_0x5da5('0xcf'),'headers':{'X-APIKEY':_0x1f06ad['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x15ccd3[_0x5da5('0xa1')][_0x5da5('0xd0')]],'buttons':null,'topic':_0x3568ee[_0x5da5('0xd1')],'note':_[_0x5da5('0xd2')](_0x3568ee['vidaooNote'])?null:getMustacheRender(_0x3568ee['vidaooNote'],_0x2e341c),'metadata':null},'redirect':_0x5da5('0xd3'),'json':!![]};try{if(!_[_0x5da5('0xd2')](_0x3568ee[_0x5da5('0xcc')])){var _0x513dc5=getMustacheRender(_0x3568ee[_0x5da5('0xcc')],_0x2e341c);var _0x555728=JSON['parse'](_0x513dc5);_0x5d85ff[_0x5da5('0x2f')][_0x5da5('0xd4')]=_0x555728;}}catch(_0x2623e4){throw new db['Sequelize'][(_0x5da5('0xd5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5d85ff);}else{throw new db['Sequelize'][(_0x5da5('0xd5'))](_0x5da5('0xd6'));}})[_0x5da5('0x2a')](function(_0x5a1bf4){_0x2daf1d=_0x5a1bf4;if(_0x2daf1d['id']){var _0x50d000={'body':_0x2daf1d[_0x5da5('0xd7')],'ChatWebsiteId':_0x3568ee['id'],'ChatInteractionId':_0xe36532['id'],'direction':_0x5da5('0xd8'),'UserId':_0x15ccd3['user']['id']};return db['ChatMessage'][_0x5da5('0xc5')](_0x50d000,{});}else{throw new db['Sequelize'][(_0x5da5('0xd5'))](_0x5da5('0xd9'));}})[_0x5da5('0x2a')](function(){return _0xe36532[_0x5da5('0xda')]({'vidaooSessionId':_0x2daf1d['id']});})[_0x5da5('0x2a')](respondWithResult(_0x1971c2,null))[_0x5da5('0x20')](handleError(_0x1971c2,null));};exports[_0x5da5('0xdb')]=function(_0x17c226,_0x41e33d){if(_0x17c226[_0x5da5('0x2f')]['id']){delete _0x17c226[_0x5da5('0x2f')]['id'];}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x17c226[_0x5da5('0xc2')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x5da5('0x2a')](handleEntityNotFound(_0x41e33d,null))[_0x5da5('0x2a')](saveUpdates(_0x17c226[_0x5da5('0x2f')],null))[_0x5da5('0x2a')](respondWithResult(_0x41e33d,null))[_0x5da5('0x20')](handleError(_0x41e33d,null));};exports['abandon']=function(_0x165bc8,_0x21c4f6){if(_0x165bc8[_0x5da5('0x2f')]['id']){delete _0x165bc8['body']['id'];}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x165bc8[_0x5da5('0xc2')]['id']}})[_0x5da5('0x2a')](function(_0x303676){if(!_0x303676){logger[_0x5da5('0x1c')](_0x5da5('0xdc'),_0x5da5('0xdd'),0x194,_0x5da5('0xde'));_0x21c4f6[_0x5da5('0xdf')](0x194);}else{if(_0x303676[_0x5da5('0x40')]){throw new db['Sequelize'][(_0x5da5('0xd5'))](_0x5da5('0xe0'));}}return _0x303676;})[_0x5da5('0x2a')](function(_0x4baa4b){if(_0x4baa4b){return _0x4baa4b[_0x5da5('0xc6')]({'closed':_0x165bc8['body'][_0x5da5('0x3f')],'disposition':_0x165bc8[_0x5da5('0x2f')][_0x5da5('0x42')]})['then'](function(_0x562291){return _0x562291;});}})[_0x5da5('0x2a')](function(){return respondWithRpcPromise(_0x5da5('0xe1'),_0x5da5('0xdd'),_0x165bc8[_0x5da5('0x2f')],client9004);})[_0x5da5('0x2a')](respondWithResult(_0x21c4f6,null))[_0x5da5('0x20')](handleError(_0x21c4f6,null));};exports['attachmentUpload']=function(_0x222950,_0x596940){_0x222950[_0x5da5('0x2f')][_0x5da5('0x2c')]=_0x222950[_0x5da5('0xe2')]['originalname'];_0x222950['body'][_0x5da5('0xe3')]=_0x222950[_0x5da5('0xe2')][_0x5da5('0xe4')];_0x222950[_0x5da5('0x2f')][_0x5da5('0x46')]=_0x222950['file']['mimetype'];return db[_0x5da5('0xe5')]['create'](_0x222950[_0x5da5('0x2f')])[_0x5da5('0x2a')](respondWithResult(_0x596940,0xc9))[_0x5da5('0x20')](handleError(_0x596940,null));};exports[_0x5da5('0xe6')]=function(_0x340b1d,_0x22c12d){return db[_0x5da5('0xa7')]['findOne']({'where':{'id':_0x340b1d[_0x5da5('0xc2')]['id']},'raw':!![]})[_0x5da5('0x2a')](handleEntityNotFound(_0x22c12d,null))[_0x5da5('0x2a')](function(_0x416760){if(_0x416760){if(_0x416760[_0x5da5('0x3f')]){return _0x22c12d['status'](0x193)[_0x5da5('0x23')]({'status':0x193,'message':_0x5da5('0xe7')});}return db[_0x5da5('0xe5')][_0x5da5('0xc9')]({'where':{'id':_0x340b1d[_0x5da5('0x49')]['attachId']},'raw':!![]})[_0x5da5('0x2a')](handleEntityNotFound(_0x22c12d,null));}})[_0x5da5('0x2a')](function(_0x4f32d7){if(_0x4f32d7){var _0x484c7f=_0x4f32d7['ChatOfflineMessageId']!==null;var _0x15c938=path[_0x5da5('0xe8')](config[_0x5da5('0xe9')],'server/files/attachments/');if(_0x484c7f){_0x15c938=path[_0x5da5('0xe8')](_0x15c938,_0x5da5('0xea'));}var _0x480b1e=path[_0x5da5('0xe8')](_0x15c938,_0x4f32d7[_0x5da5('0xe3')]);return _0x22c12d[_0x5da5('0xeb')](_0x480b1e);}})[_0x5da5('0x20')](handleError(_0x22c12d,null));};exports['close']=function(_0x22413b,_0x5e6bb4){var _0x1cce33=null;var _0x2199f2=null;var _0x563113=null;if(_0x22413b[_0x5da5('0x2f')]['id']){delete _0x22413b[_0x5da5('0x2f')]['id'];}if(_0x22413b[_0x5da5('0x2f')][_0x5da5('0xec')]){_0x563113=path[_0x5da5('0xe8')](config[_0x5da5('0xe9')],_0x5da5('0xed'),util[_0x5da5('0xee')](_0x5da5('0xef'),Date[_0x5da5('0xf0')]()));_0x22413b[_0x5da5('0x2f')][_0x5da5('0xf1')]=_0x563113;}return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x22413b[_0x5da5('0xc2')]['id']},'include':[{'model':db[_0x5da5('0xf2')],'as':_0x5da5('0xf3'),'include':[{'model':db[_0x5da5('0x7c')],'as':_0x5da5('0x7c')}]}]})[_0x5da5('0x2a')](handleEntityNotFound(_0x5e6bb4,null))[_0x5da5('0x2a')](saveUpdates(_0x22413b[_0x5da5('0x2f')],null))[_0x5da5('0x2a')](function(_0x35b7e8){if(_0x35b7e8){_0x1cce33=_0x35b7e8;return db[_0x5da5('0xca')][_0x5da5('0x6b')]({'where':{'id':_0x1cce33[_0x5da5('0x83')]}});}})[_0x5da5('0x2a')](function(_0xafe658){if(_0xafe658){_0x2199f2=_0xafe658;return db[_0x5da5('0xf4')][_0x5da5('0x6b')]({'where':{'id':_0x1cce33[_0x5da5('0x75')]}});}})[_0x5da5('0x2a')](function(_0x2ab9ba){if(_0x2ab9ba){if(_0x563113){var _0x423431=null;for(var _0x231009=0x1;_0x231009<_0x1cce33[_0x5da5('0xf3')][_0x5da5('0x4e')];++_0x231009){_0x423431=_0x1cce33[_0x5da5('0xf3')][_0x231009];var _0x3453ce=_0x423431['UserId']?util['format'](_0x5da5('0xf5'),_0x2199f2[_0x5da5('0xf6')],_0x423431['UserId']):'System';var _0xd36fe0=_0x22413b[_0x5da5('0x2f')][_0x5da5('0xf7')]||util[_0x5da5('0xee')](_0x5da5('0xf5'),_0x5da5('0xf8'),_0x423431[_0x5da5('0x75')]);switch(_0x2199f2['agentIdentifier']){case _0x5da5('0xf9'):_0x3453ce=_0x423431[_0x5da5('0x40')]?util[_0x5da5('0xee')](_0x5da5('0xf5'),_0x2199f2[_0x5da5('0xf6')],_0x423431['UserId']):'System';break;case _0x5da5('0xfa'):_0x3453ce=_0x423431[_0x5da5('0x40')]?_0x423431['User']['alias']||_0x423431[_0x5da5('0x7c')][_0x5da5('0xcd')]:_0x5da5('0xfb');break;case'agent_fullname':_0x3453ce=_0x423431[_0x5da5('0x40')]?_0x423431[_0x5da5('0x7c')]['fullname']:'System';break;default:_0x3453ce=_0x423431[_0x5da5('0x40')]?util[_0x5da5('0xee')](_0x5da5('0xf5'),_0x2199f2[_0x5da5('0xf6')],_0x423431[_0x5da5('0x40')]):_0x5da5('0xfb');}var _0x3a5453=util['format'](_0x5da5('0xfc'),moment(_0x423431['createdAt'])[_0x5da5('0xee')](_0x5da5('0xfd')),_0x423431[_0x5da5('0xfe')]==='in'?_0xd36fe0:_0x3453ce,_0x423431[_0x5da5('0x2f')]);if(!_0x423431[_0x5da5('0xff')]){fs[_0x5da5('0x100')](_0x563113,_0x3a5453);}}return db[_0x5da5('0x101')][_0x5da5('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x5da5('0x102')],'as':_0x5da5('0x103'),'raw':!![],'include':[{'model':db[_0x5da5('0x104')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x5da5('0x2a')](function(_0x268871){if(!_0x268871||!_0x268871[_0x5da5('0x103')]||!_0x22413b['body'])return _0x1cce33;var _0x118647=_0x268871[_0x5da5('0x105')]();return respondWithRpcPromise(_0x5da5('0x106'),_0x5da5('0x107'),{'account':_0x118647,'message':{'from':util[_0x5da5('0xee')](_0x5da5('0x108'),_0x268871[_0x5da5('0x2c')],_0x268871['email']||_0x268871['Smtp'][_0x5da5('0xa1')]),'to':_0x22413b[_0x5da5('0x2f')][_0x5da5('0xec')],'subject':_0x5da5('0x109'),'text':util['format'](_0x5da5('0x10a'),_0x22413b[_0x5da5('0x2f')]['mailTranscript']),'attachments':[{'path':_0x563113}]}})[_0x5da5('0x2a')](function(){return _0x1cce33;})[_0x5da5('0x20')](function(_0xcfa153){logger['error'](_0xcfa153);});})[_0x5da5('0x2a')](respondWithStatusCode(_0x5e6bb4,0xc8))[_0x5da5('0x20')](handleError(_0x5e6bb4,null));};exports['addMessage']=function(_0x2143f0,_0x245338){return db[_0x5da5('0xf2')][_0x5da5('0x6b')]({'where':{'id':_0x2143f0[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x245338,null))[_0x5da5('0x2a')](function(_0x255556){if(_0x255556){return _0x255556[_0x5da5('0x10b')](_0x2143f0[_0x5da5('0x2f')][_0x5da5('0x10c')],_[_0x5da5('0x10d')](_0x2143f0[_0x5da5('0x2f')],['ids','id'])||{});}})['then'](respondWithResult(_0x245338,null))['catch'](handleError(_0x245338,null));};exports[_0x5da5('0x10e')]=function(_0xf685e2,_0x53f7d1){var _0x3c532e={'raw':![],'where':{}};var _0x5ab150={};var _0x58ef45={'count':0x0,'rows':[]};return db[_0x5da5('0xa7')]['findOne']({'where':{'id':_0xf685e2[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x53f7d1,null))[_0x5da5('0x2a')](function(_0x1da022){if(_0x1da022){_0x5ab150['model']=_[_0x5da5('0x7f')](db[_0x5da5('0xf2')][_0x5da5('0x10f')]);_0x5ab150[_0x5da5('0x49')]=_[_0x5da5('0x7f')](_0xf685e2[_0x5da5('0x49')]);_0x5ab150['filters']=_['intersection'](_0x5ab150[_0x5da5('0x48')],_0x5ab150[_0x5da5('0x49')]);_0x3c532e['attributes']=_[_0x5da5('0x4b')](_0x5ab150[_0x5da5('0x48')],qs[_0x5da5('0x4d')](_0xf685e2['query']['fields']));_0x3c532e['attributes']=_0x3c532e[_0x5da5('0x4c')][_0x5da5('0x4e')]?_0x3c532e[_0x5da5('0x4c')]:_0x5ab150[_0x5da5('0x48')];if(!_0xf685e2['query'][_0x5da5('0x4f')](_0x5da5('0x50'))){_0x3c532e[_0x5da5('0x27')]=qs[_0x5da5('0x27')](_0xf685e2['query']['limit']);_0x3c532e[_0x5da5('0x24')]=qs[_0x5da5('0x24')](_0xf685e2[_0x5da5('0x49')]['offset']);}_0x3c532e[_0x5da5('0x51')]=qs[_0x5da5('0x110')](_0xf685e2['query']['sort']);_0x3c532e[_0x5da5('0x8b')]=qs['filters'](_[_0x5da5('0x52')](_0xf685e2[_0x5da5('0x49')],_0x5ab150[_0x5da5('0x4a')]));_0x3c532e[_0x5da5('0x8b')]['ChatInteractionId']=_0x1da022['id'];if(_0xf685e2['query'][_0x5da5('0x111')]){_0x3c532e[_0x5da5('0x8b')]=_[_0x5da5('0x112')](_0x3c532e[_0x5da5('0x8b')],{'$or':_[_0x5da5('0x35')](_0x3c532e[_0x5da5('0x4c')],function(_0x5e81d){var _0x41cd89={};_0x41cd89[_0x5e81d]={'$like':'%'+_0xf685e2['query'][_0x5da5('0x111')]+'%'};return _0x41cd89;})});}if(_0xf685e2[_0x5da5('0x49')]['$gte']){var _0x4b0dcd=_0xf685e2[_0x5da5('0x49')][_0x5da5('0x87')]['split'](',');var _0x663647={};_0x663647[_0x4b0dcd[0x0]]={'$gte':moment(_0x4b0dcd[0x1])[_0x5da5('0xee')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c532e[_0x5da5('0x8b')]=_['merge'](_0x3c532e[_0x5da5('0x8b')],_0x663647);}_0x3c532e=_[_0x5da5('0x112')]({},_0x3c532e,_0xf685e2[_0x5da5('0xc4')]);return db[_0x5da5('0xf2')]['count']({'where':_0x3c532e[_0x5da5('0x8b')]})[_0x5da5('0x2a')](function(_0x2226d4){_0x58ef45[_0x5da5('0x26')]=_0x2226d4;if(_0xf685e2['query'][_0x5da5('0xc3')]){_0x3c532e[_0x5da5('0x113')]=[{'all':!![]}];}return db['ChatMessage'][_0x5da5('0x114')](_0x3c532e);})[_0x5da5('0x2a')](function(_0x3c2680){_0x58ef45[_0x5da5('0x115')]=_0x3c2680;return _0x58ef45;});}})[_0x5da5('0x2a')](respondWithFilteredResult(_0x53f7d1,_0x3c532e))[_0x5da5('0x20')](handleError(_0x53f7d1,null));};exports[_0x5da5('0x116')]=function(_0x455bf5,_0x3215b8){var _0x93fc22={'where':{}},_0x29a452={},_0xc0ad3b={'count':0x0,'rows':[]};return db[_0x5da5('0xa7')]['findOne']({'where':{'id':_0x455bf5['params']['id']}})['then'](handleEntityNotFound(_0x3215b8,null))['then'](function(_0x2075f8){if(_0x2075f8){_0x29a452[_0x5da5('0x48')]=_['keys'](db['ChatMessage'][_0x5da5('0x10f')]);_0x29a452['query']=_[_0x5da5('0x7f')](_0x455bf5[_0x5da5('0x49')]);_0x29a452['filters']=_[_0x5da5('0x4b')](_0x29a452['model'],_0x29a452[_0x5da5('0x49')]);_0x93fc22[_0x5da5('0x4c')]=_[_0x5da5('0x4b')](_0x29a452['model'],qs['fields'](_0x455bf5[_0x5da5('0x49')][_0x5da5('0x4d')]));_0x93fc22[_0x5da5('0x4c')]=_0x93fc22[_0x5da5('0x4c')][_0x5da5('0x4e')]?_0x93fc22[_0x5da5('0x4c')]:_0x29a452[_0x5da5('0x48')];if(!_0x455bf5[_0x5da5('0x49')][_0x5da5('0x4f')](_0x5da5('0x50'))){_0x93fc22['limit']=qs[_0x5da5('0x27')](_0x455bf5[_0x5da5('0x49')][_0x5da5('0x27')]);_0x93fc22['offset']=qs[_0x5da5('0x24')](_0x455bf5[_0x5da5('0x49')]['offset']);}_0x93fc22[_0x5da5('0x51')]=qs['sort'](_0x455bf5[_0x5da5('0x49')][_0x5da5('0x110')]);_0x93fc22[_0x5da5('0x8b')]=qs[_0x5da5('0x4a')](_[_0x5da5('0x52')](_0x455bf5[_0x5da5('0x49')],_0x29a452['filters']));_0x93fc22['where'][_0x5da5('0xbf')]=_0x2075f8['id'];if(_0x455bf5[_0x5da5('0x49')]['filter']){_0x93fc22[_0x5da5('0x8b')]=_[_0x5da5('0x112')](_0x93fc22[_0x5da5('0x8b')],{'$or':_['map'](_0x93fc22[_0x5da5('0x4c')],function(_0x5b20d9){var _0x54df1a={};_0x54df1a[_0x5b20d9]={'$like':'%'+_0x455bf5[_0x5da5('0x49')][_0x5da5('0x111')]+'%'};return _0x54df1a;})});}_0x93fc22['where'][_0x5da5('0xff')]=![];if(_0x455bf5['query']['id']){_0x93fc22[_0x5da5('0x8b')]['id']={'$gt':_0x455bf5[_0x5da5('0x49')]['id']};}_0x93fc22=_[_0x5da5('0x112')]({},_0x93fc22,_0x455bf5[_0x5da5('0xc4')]);return db['ChatMessage'][_0x5da5('0x26')]({'where':_0x93fc22[_0x5da5('0x8b')]})[_0x5da5('0x2a')](function(_0x70f31d){_0xc0ad3b[_0x5da5('0x26')]=_0x70f31d;_0x93fc22['include']=[];if(_0x455bf5[_0x5da5('0x49')][_0x5da5('0x117')]){_0x93fc22[_0x5da5('0x113')][_0x5da5('0x3a')]({'model':db[_0x5da5('0x7c')],'as':'User','attributes':['id',_0x5da5('0xcd'),'alias']});}if(_0x455bf5['query'][_0x5da5('0xc3')]){_0x93fc22['include']=[{'all':!![]}];}return db[_0x5da5('0xf2')][_0x5da5('0x114')](_0x93fc22);})[_0x5da5('0x2a')](function(_0x21d019){_0xc0ad3b[_0x5da5('0x115')]=_0x21d019;return _0xc0ad3b;});}})[_0x5da5('0x2a')](respondWithFilteredResult(_0x3215b8,_0x93fc22))[_0x5da5('0x20')](handleError(_0x3215b8,null));};exports[_0x5da5('0x118')]=function(_0x199ab0,_0x38f596){return db[_0x5da5('0xa7')][_0x5da5('0x6b')]({'where':{'id':_0x199ab0[_0x5da5('0xc2')]['id']}})['then'](handleEntityNotFound(_0x38f596,null))['then'](function(_0x5f4410){if(_0x5f4410){return _0x5f4410[_0x5da5('0x119')](_0x199ab0[_0x5da5('0x2f')][_0x5da5('0x10c')],_[_0x5da5('0x10d')](_0x199ab0[_0x5da5('0x2f')],['ids','id'])||{})[_0x5da5('0x11a')](function(){return db[_0x5da5('0x79')][_0x5da5('0x114')]({'attributes':['id',_0x5da5('0x2c'),_0x5da5('0x55')],'where':{'id':_0x199ab0['body'][_0x5da5('0x10c')]}});})[_0x5da5('0x2a')](function(_0xb897d){socket[_0x5da5('0x11b')]('chatInteractionTags:save',{'id':Number(_0x199ab0[_0x5da5('0xc2')]['id']),'tags':_0xb897d||[]});return{'id':Number(_0x199ab0[_0x5da5('0xc2')]['id']),'tags':_0xb897d||[]};});}})[_0x5da5('0x2a')](respondWithResult(_0x38f596,null))[_0x5da5('0x20')](handleError(_0x38f596,null));};exports['removeTags']=function(_0x2fd629,_0x3213c8){return db['ChatInteraction'][_0x5da5('0x6b')]({'where':{'id':_0x2fd629[_0x5da5('0xc2')]['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x3213c8,null))[_0x5da5('0x2a')](function(_0x58fe7d){if(_0x58fe7d){return _0x58fe7d[_0x5da5('0x11c')](_0x2fd629[_0x5da5('0x49')][_0x5da5('0x10c')]);}})[_0x5da5('0x2a')](respondWithStatusCode(_0x3213c8,null))[_0x5da5('0x20')](handleError(_0x3213c8,null));};exports[_0x5da5('0xeb')]=function(_0x10e296,_0x3a6962){var _0xe1a9c2=moment()[_0x5da5('0x11d')]()[_0x5da5('0xa5')]();var _0x13950f=path[_0x5da5('0xe8')](config['root'],_0x5da5('0x11e'),_0x5da5('0x11f'),_0x5da5('0x120'));var _0x1800d0=path[_0x5da5('0xe8')](config[_0x5da5('0xe9')],_0x5da5('0x11e'),_0x5da5('0x11f'),_0x5da5('0x121'));var _0x454639=path[_0x5da5('0xe8')](_0x13950f,_0xe1a9c2);var _0x1cddaf=util[_0x5da5('0xee')](_0x5da5('0x122'),_0x10e296[_0x5da5('0xc2')]['id'],_0xe1a9c2);var _0x11394e=path[_0x5da5('0xe8')](_0x13950f,_0x1cddaf);var _0x4413c3=[];_0x4413c3[_0x5da5('0x3a')]({'model':db[_0x5da5('0x7c')],'as':_0x5da5('0x7c'),'attributes':['id',_0x5da5('0xcd')],'raw':!![]});_0x4413c3[_0x5da5('0x3a')]({'model':db[_0x5da5('0xf4')],'as':_0x5da5('0x6f'),'attributes':['id',_0x5da5('0x123'),_0x5da5('0x124')],'raw':!![]});if(_0x10e296[_0x5da5('0x49')][_0x5da5('0x121')]){_0x4413c3[_0x5da5('0x3a')]({'model':db['Attachment'],'as':_0x5da5('0xe5'),'raw':!![]});}var _0x3203e7=[{'model':db[_0x5da5('0xf2')],'as':'Messages','attributes':['id',_0x5da5('0x2f'),_0x5da5('0x85'),_0x5da5('0xfe'),'secret',_0x5da5('0x8c')],'include':_0x4413c3}];_0x3203e7[_0x5da5('0x3a')]({'model':db[_0x5da5('0xca')],'as':_0x5da5('0x125'),'attributes':['id',_0x5da5('0x2c')]});_0x3203e7[_0x5da5('0x3a')]({'model':db[_0x5da5('0x7c')],'as':_0x5da5('0x126'),'attributes':['id',_0x5da5('0xcd')]});return db['ChatInteraction'][_0x5da5('0x6b')]({'where':{'id':_0x10e296[_0x5da5('0xc2')]['id']},'include':_0x3203e7})[_0x5da5('0x2a')](handleEntityNotFound(_0x3a6962,null))[_0x5da5('0x2a')](function(_0x512d10){if(_0x512d10){var _0x2b7834=_0x512d10[_0x5da5('0x127')]({'plain':!![]});fs[_0x5da5('0x128')](_0x454639);var _0x182053={'channel':_0x5da5('0x129'),'account':_0x2b7834[_0x5da5('0x125')]['name'],'agent':_0x2b7834['Owner']?_0x2b7834[_0x5da5('0x126')][_0x5da5('0xcd')]:_0x5da5('0x12a'),'createdAt':moment(_0x2b7834['createdAt'])[_0x5da5('0xee')](_0x5da5('0x12b'))[_0x5da5('0xa5')](),'closedAt':_0x2b7834[_0x5da5('0x3f')]?moment(_0x2b7834[_0x5da5('0x12c')])[_0x5da5('0xee')](_0x5da5('0x12b'))[_0x5da5('0xa5')]():'','disposition':_0x2b7834[_0x5da5('0x42')],'chatInfo':{'browser':_0x2b7834[_0x5da5('0x12d')],'os':_0x2b7834[_0x5da5('0x12e')],'referer':_0x2b7834[_0x5da5('0x12f')],'customerIp':_0x2b7834[_0x5da5('0x130')],'customerPort':_0x2b7834[_0x5da5('0x131')]?_0x2b7834[_0x5da5('0x131')]:'N.A.'},'messages':_(_0x2b7834[_0x5da5('0xf3')])[_0x5da5('0x132')]()[_0x5da5('0x111')]({'secret':![]})[_0x5da5('0x35')](function(_0x4aeb17){if(_0x4aeb17[_0x5da5('0xe5')]){var _0x35c55f=path[_0x5da5('0xe8')](_0x1800d0,_0x4aeb17['Attachment'][_0x5da5('0xe3')]);if(fs[_0x5da5('0x133')](_0x35c55f)){fs[_0x5da5('0x134')](_0x35c55f)['pipe'](fs[_0x5da5('0x135')](path['join'](_0x454639,_0x4aeb17[_0x5da5('0xe5')][_0x5da5('0xe3')])));}}return{'date':moment(_0x4aeb17[_0x5da5('0x85')])[_0x5da5('0xee')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5da5('0xa5')](),'sender':_0x4aeb17[_0x5da5('0xfe')]==='out'?_0x4aeb17[_0x5da5('0x7c')]?_0x4aeb17[_0x5da5('0x7c')][_0x5da5('0xcd')]:_0x5da5('0xfb'):_0x4aeb17[_0x5da5('0x6f')][_0x5da5('0x123')]+(_0x4aeb17[_0x5da5('0x6f')][_0x5da5('0x124')]?'\x20'+_0x4aeb17[_0x5da5('0x6f')][_0x5da5('0x124')]:''),'body':_0x4aeb17['Attachment']?_0x4aeb17[_0x5da5('0xe5')][_0x5da5('0xe3')]:_0x4aeb17['body'],'direction':_0x4aeb17[_0x5da5('0xfe')]===_0x5da5('0xd8')?'A':'C','secret':_0x4aeb17[_0x5da5('0xff')],'read':_0x4aeb17[_0x5da5('0x8c')],'attachment':_0x4aeb17['Attachment']};})[_0x5da5('0x71')]()};return ejs['renderFile'](path[_0x5da5('0xe8')](config['root'],_0x5da5('0x11e'),_0x5da5('0x136'),'downloadInteraction.ejs'),{'interaction':_0x182053})[_0x5da5('0x2a')](function(_0x4c13d8){var _0x15e4f9=path['join'](_0x454639,_0x5da5('0x137')+_0x2b7834['id']+'-'+_0xe1a9c2+'.pdf');var _0x5c31c7={'path':_0x15e4f9,'channel':_0x5da5('0x129'),'interactionId':_0x2b7834['id']};return pdf[_0x5da5('0x138')](_0x4c13d8,_0x5c31c7);})[_0x5da5('0x2a')](function(){return new Promise(function(_0x344da7,_0x44774c){zipdir(_0x454639,{'saveTo':_0x11394e},function(_0x1c3d84,_0x2e06f4){if(_0x1c3d84)return _0x44774c(_0x1c3d84);return _0x344da7(_0x2e06f4);});})[_0x5da5('0x2a')](function(){return new BPromise(function(_0xc2e222,_0x1560a5){rimraf(_0x454639,function(_0x464cd6){if(_0x464cd6)_0x1560a5(_0x464cd6);return _0xc2e222();});});})[_0x5da5('0x2a')](function(){return _0x3a6962['download'](_0x11394e,_0x1cddaf,function(_0x5bb2be){if(_0x5bb2be){logger[_0x5da5('0x1c')]('err',_0x5bb2be);}else{fs[_0x5da5('0x139')](_0x11394e);}});});});}else{return _0x3a6962[_0x5da5('0xdf')](0xc8);}})[_0x5da5('0x20')](handleError(_0x3a6962,null));}; \ No newline at end of file +var _0x34e8=['ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','undefined','count','set','json','update','then','destroy','sendStatus','stack','name','send','render','body','contact','account','Users','TagIds','split','forEach','Tags','talking','unmanaged','abandoned','UserId','waiting','closed','disposition','answered','total','index','map','ChatInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','select','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','$substring','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','follow','isNull','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','filename','mimetype','Attachment','Unauthorized','attachId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','ChatMessage','User','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','findAll','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x555fab,_0x2bd789){var _0x47dd3d=function(_0x27d026){while(--_0x27d026){_0x555fab['push'](_0x555fab['shift']());}};_0x47dd3d(++_0x2bd789);}(_0x34e8,0x12c));var _0x834e=function(_0x2e4f85,_0x53a1ce){_0x2e4f85=_0x2e4f85-0x0;var _0x1ea9e6=_0x34e8[_0x2e4f85];return _0x1ea9e6;};'use strict';var rimraf=require(_0x834e('0x0'));var zipdir=require(_0x834e('0x1'));var rp=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x834e('0x4'));var util=require(_0x834e('0x5'));var path=require(_0x834e('0x6'));var ejs=require(_0x834e('0x7'));var fs=require('fs');var _=require(_0x834e('0x8'));var squel=require(_0x834e('0x9'));var Redis=require(_0x834e('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x834e('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0x834e('0xc'))(_0x834e('0xd'));var config=require(_0x834e('0xe'));var db=require(_0x834e('0xf'))['db'];config[_0x834e('0x10')]=_[_0x834e('0x11')](config[_0x834e('0x10')],{'host':_0x834e('0x12'),'port':0x18eb});var socket=require(_0x834e('0x13'))(new Redis(config[_0x834e('0x10')]));require(_0x834e('0x14'))[_0x834e('0x15')](socket);var jayson=require(_0x834e('0x16'));var client=jayson[_0x834e('0x17')][_0x834e('0x18')]({'port':0x232b});var client9004=jayson[_0x834e('0x17')][_0x834e('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x538bb3,_0x5e5b6d,_0x6cd9b9,_0x58a27e){return new BPromise(function(_0x23848e,_0x2d95f2){var _0x28e659=_0x58a27e||client;return _0x28e659[_0x834e('0x19')](_0x538bb3,_0x6cd9b9)['then'](function(_0x43156c){logger[_0x834e('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5e5b6d,_0x834e('0x1b'));logger['debug'](_0x834e('0x1c'),_0x5e5b6d,_0x834e('0x1b'),JSON['stringify'](_0x43156c));if(_0x43156c[_0x834e('0x1d')]){if(_0x43156c[_0x834e('0x1d')][_0x834e('0x1e')]===0x1f4){logger['error'](_0x834e('0x1f'),_0x5e5b6d,_0x43156c[_0x834e('0x1d')][_0x834e('0x20')]);return _0x2d95f2(_0x43156c[_0x834e('0x1d')][_0x834e('0x20')]);}logger[_0x834e('0x1d')](_0x834e('0x1f'),_0x5e5b6d,_0x43156c['error'][_0x834e('0x20')]);return _0x23848e(_0x43156c[_0x834e('0x1d')][_0x834e('0x20')]);}else{logger[_0x834e('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5e5b6d,_0x834e('0x1b'));_0x23848e(_0x43156c[_0x834e('0x21')]['message']);}})[_0x834e('0x22')](function(_0x28d687){logger[_0x834e('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x5e5b6d,_0x28d687);_0x2d95f2(_0x28d687);});});}function respondWithStatusCode(_0x4e3f48,_0x231619){_0x231619=_0x231619||0xcc;return function(_0x34563b){if(_0x34563b){return _0x4e3f48['sendStatus'](_0x231619);}return _0x4e3f48[_0x834e('0x23')](_0x231619)[_0x834e('0x24')]();};}function respondWithResult(_0x58f4fd,_0x3bc4f7){_0x3bc4f7=_0x3bc4f7||0xc8;return function(_0x2e1983){if(_0x2e1983){return _0x58f4fd[_0x834e('0x23')](_0x3bc4f7)['json'](_0x2e1983);}};}function respondWithFilteredResult(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(_0x5e1cc5){var _0x5bef62=typeof _0x3e310f[_0x834e('0x25')]==='undefined'&&typeof _0x3e310f[_0x834e('0x26')]===_0x834e('0x27');var _0x3db026=_0x5e1cc5[_0x834e('0x28')];var _0x3cd928=_0x5bef62?0x0:_0x3e310f[_0x834e('0x25')];var _0x491919=_0x5bef62?_0x5e1cc5['count']:_0x3e310f['offset']+_0x3e310f['limit'];var _0x2c7a8d;if(_0x491919>=_0x3db026){_0x491919=_0x3db026;_0x2c7a8d=0xc8;}else{_0x2c7a8d=0xce;}_0x24fcf7[_0x834e('0x23')](_0x2c7a8d);return _0x24fcf7[_0x834e('0x29')]('Content-Range',_0x3cd928+'-'+_0x491919+'/'+_0x3db026)[_0x834e('0x2a')](_0x5e1cc5);}return null;};}function saveUpdates(_0x11f1ce){return function(_0x1f3671){if(_0x1f3671){return _0x1f3671[_0x834e('0x2b')](_0x11f1ce)[_0x834e('0x2c')](function(_0x390119){return _0x390119;});}return null;};}function removeEntity(_0x3d149d){return function(_0xfaf716){if(_0xfaf716){return _0xfaf716[_0x834e('0x2d')]()['then'](function(){_0x3d149d[_0x834e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c75c2){return function(_0x3787b0){if(!_0x3787b0){_0x2c75c2[_0x834e('0x2e')](0x194);}return _0x3787b0;};}function handleError(_0x2b3418,_0x444366){_0x444366=_0x444366||0x1f4;return function(_0x4689c2){logger[_0x834e('0x1d')](_0x4689c2[_0x834e('0x2f')]);if(_0x4689c2[_0x834e('0x30')]){delete _0x4689c2[_0x834e('0x30')];}_0x2b3418['status'](_0x444366)[_0x834e('0x31')](_0x4689c2);};}function getMustacheRender(_0x2f408a,_0x24a9df){return Mustache[_0x834e('0x32')](_0x2f408a,_['merge'](_0x24a9df[_0x834e('0x33')],{'contact':_0x24a9df[_0x834e('0x34')],'message':_0x24a9df['message'],'agent':_0x24a9df['agent'],'interaction':_0x24a9df['interaction'],'account':_0x24a9df[_0x834e('0x35')]}))||'';}function getInteractionUsers(_0x41bf4d,_0x20c6ae){return new BPromise(function(_0x34fefb,_0x339e28){try{if(_0x20c6ae[_0x41bf4d['id']]){_0x41bf4d[_0x834e('0x36')]=_['map'](_0x20c6ae[_0x41bf4d['id']],function(_0x2c2d94){return{'id':_0x2c2d94['id'],'fullname':_0x2c2d94['fullname']};});}}catch(_0xe103fe){_0x339e28(_0xe103fe);}_0x34fefb(_0x41bf4d);});}function getInteractionTags(_0x6a3ac,_0x47abed){return new BPromise(function(_0x18ac3b,_0x2f56c7){try{if(_0x6a3ac['TagIds']){_0x6a3ac['Tags']=[];_0x6a3ac[_0x834e('0x37')][_0x834e('0x38')](',')[_0x834e('0x39')](function(_0x130c23){_0x6a3ac[_0x834e('0x3a')]['push'](_0x47abed[_0x130c23]);});}delete _0x6a3ac[_0x834e('0x37')];}catch(_0x548d1d){_0x2f56c7(_0x548d1d);}_0x18ac3b(_0x6a3ac);});}function updateChatInteraction(_0x50c243,_0x1b2edf,_0x4a7f76){return new BPromise(function(_0x2e5239,_0x1ba66d){return getInteractionUsers(_0x50c243,_0x4a7f76)[_0x834e('0x2c')](function(_0x3c59af){return getInteractionTags(_0x3c59af,_0x1b2edf);})[_0x834e('0x2c')](function(_0x574ea8){return getStateInteraction(_0x574ea8);})[_0x834e('0x2c')](function(_0x26b847){_0x2e5239(_0x26b847);})[_0x834e('0x22')](function(_0x58c5fb){_0x1ba66d(_0x58c5fb);});});}function getStateInteraction(_0x35380e){return new BPromise(function(_0x16ac45){_0x35380e['waiting']=0x0;_0x35380e[_0x834e('0x3b')]=0x0;_0x35380e['answered']=0x0;_0x35380e[_0x834e('0x3c')]=0x0;_0x35380e[_0x834e('0x3d')]=0x0;_0x35380e['total']=0x0;if(!_0x35380e['closed']&&!_0x35380e[_0x834e('0x3e')]){_0x35380e[_0x834e('0x3f')]+=0x1;}if(!_0x35380e[_0x834e('0x40')]&&_0x35380e[_0x834e('0x3e')]){_0x35380e[_0x834e('0x3b')]+=0x1;if(_0x35380e[_0x834e('0x3f')]){_0x35380e[_0x834e('0x3f')]-=0x1;}}if(_0x35380e['closed']&&_0x35380e[_0x834e('0x41')]==='abandoned'){_0x35380e[_0x834e('0x3d')]+=0x1;if(_0x35380e['waiting']){_0x35380e[_0x834e('0x3f')]-=0x1;}}else if(_0x35380e['closed']&&!_0x35380e[_0x834e('0x3e')]&&_0x35380e[_0x834e('0x41')]){_0x35380e['unmanaged']+=0x1;if(_0x35380e[_0x834e('0x3f')]){_0x35380e[_0x834e('0x3f')]-=0x1;}}else if(_0x35380e[_0x834e('0x40')]&&_0x35380e[_0x834e('0x3e')]){_0x35380e[_0x834e('0x42')]+=0x1;if(_0x35380e[_0x834e('0x3b')]){_0x35380e[_0x834e('0x3b')]-=0x1;}}_0x35380e[_0x834e('0x43')]+=0x1;_0x16ac45(_0x35380e);});}exports[_0x834e('0x44')]=function(_0x279ea1,_0x5f3943){var _0x3124be={},_0x6fff27={},_0x47a8a9={'count':0x0,'rows':[]};var _0x112306=_[_0x834e('0x45')](db[_0x834e('0x46')][_0x834e('0x47')],function(_0x19b5ef){return{'name':_0x19b5ef[_0x834e('0x48')],'type':_0x19b5ef['type']['key']};});_0x6fff27[_0x834e('0x49')]=_[_0x834e('0x45')](_0x112306,_0x834e('0x30'));_0x6fff27[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x279ea1[_0x834e('0x4a')]);_0x6fff27[_0x834e('0x4c')]=_[_0x834e('0x4d')](_0x6fff27[_0x834e('0x49')],_0x6fff27[_0x834e('0x4a')]);_0x3124be[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x6fff27[_0x834e('0x49')],qs[_0x834e('0x4f')](_0x279ea1[_0x834e('0x4a')][_0x834e('0x4f')]));_0x3124be[_0x834e('0x4e')]=_0x3124be[_0x834e('0x4e')][_0x834e('0x50')]?_0x3124be[_0x834e('0x4e')]:_0x6fff27['model'];if(!_0x279ea1[_0x834e('0x4a')][_0x834e('0x51')]('nolimit')){_0x3124be[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x279ea1['query'][_0x834e('0x26')]);_0x3124be[_0x834e('0x25')]=qs[_0x834e('0x25')](_0x279ea1[_0x834e('0x4a')][_0x834e('0x25')]);}_0x3124be[_0x834e('0x52')]=qs[_0x834e('0x53')](_0x279ea1['query'][_0x834e('0x53')]);_0x3124be[_0x834e('0x54')]=qs[_0x834e('0x4c')](_[_0x834e('0x55')](_0x279ea1[_0x834e('0x4a')],_0x6fff27[_0x834e('0x4c')]),_0x112306);var _0x344b51=[];var _0x1bc975=squel['select']()[_0x834e('0x56')]('id')['field'](_0x834e('0x30'))['field'](_0x834e('0x57'))['from']('tools_tags');var _0x6c0b29=squel[_0x834e('0x58')]()['field']('u.id')[_0x834e('0x56')](_0x834e('0x59'))[_0x834e('0x56')](_0x834e('0x5a'))[_0x834e('0x5b')](_0x834e('0x5c'),'ui')[_0x834e('0x5d')](_0x834e('0x5e'),'u','u.id\x20=\x20ui.UserId');var _0x142334=squel[_0x834e('0x58')]()['from'](_0x834e('0x5f'),'i')['left_join'](_0x834e('0x60'),'c',_0x834e('0x61'))['left_join'](_0x834e('0x5e'),'o',_0x834e('0x62'))[_0x834e('0x5d')](_0x834e('0x63'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x834e('0x5d')](_0x834e('0x64'),'me',_0x834e('0x65'))['left_join'](_0x834e('0x66'),'it',_0x834e('0x67'))[_0x834e('0x5d')](_0x834e('0x68'),'t',_0x834e('0x69'));var _0x125f37=squel[_0x834e('0x6a')]();var _0x1def00=[];var _0x208c21=squel[_0x834e('0x6a')]();var _0x1e4310;if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x6b')]){_0x1e4310=as[_0x834e('0x6c')](_0x279ea1[_0x834e('0x4a')][_0x834e('0x6b')]);var _0x297cce=_0x1e4310[_0x834e('0x6d')];for(var _0x193a15=0x0;_0x193a15<_0x1e4310[_0x834e('0x6e')][_0x834e('0x50')];_0x193a15++){var _0x2cb233=_0x1e4310['conditions'][_0x193a15];var _0x2145cf='i';var _0x25d6f4=_[_0x834e('0x6f')](_0x112306,[_0x834e('0x30'),_0x2cb233['field']]);if(!_0x25d6f4){switch(_0x2cb233[_0x834e('0x56')]){case'unreadMessages':if(_0x2cb233['value']==0x1){_0x142334[_0x834e('0x70')]('`'+_0x2cb233[_0x834e('0x56')]+_0x834e('0x71'));}else{_0x142334[_0x834e('0x70')]('`'+_0x2cb233[_0x834e('0x56')]+_0x834e('0x72'));}break;case _0x834e('0x73'):if(_0x2cb233[_0x834e('0x74')]==='$substring'){if(_0x2cb233[_0x834e('0x75')]['split']('\x20')[_0x834e('0x50')]>0x1){_0x125f37[_0x297cce](_0x834e('0x76'),qs['getFullTextValue'](_0x2cb233['value']),null);}else{var _0x4a4def='%'+_0x2cb233[_0x834e('0x75')]+'%';_0x125f37[_0x297cce](_0x834e('0x77'),_0x4a4def,_0x4a4def,_0x4a4def);}}else{_0x25d6f4=_[_0x834e('0x6f')](_0x112306,[_0x834e('0x30'),'ContactId']);_0x2cb233[_0x834e('0x56')]=_0x834e('0x78');_0x11f6f0=as[_0x834e('0x79')](_0x2145cf,_0x25d6f4[_0x834e('0x7a')],_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x7c')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x24')]);}break;case _0x834e('0x7d'):var _0x5b2bf6=_0x2cb233[_0x834e('0x75')][_0x834e('0x38')](',')[_0x834e('0x45')](function(_0x5b5d6f){return Number(_0x5b5d6f);});_0x5b2bf6['forEach'](function(_0x46fa0d){_0x208c21['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46fa0d+',%');});_0x1def00=_['union'](_0x1def00,_0x5b2bf6);break;case'User':if(_0x2cb233[_0x834e('0x74')]===_0x834e('0x7e')){_0x125f37[_0x297cce]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2cb233[_0x834e('0x75')]+'%',null);}else{_0x25d6f4=_[_0x834e('0x6f')](_0x112306,['name',_0x834e('0x3e')]);_0x2cb233[_0x834e('0x56')]='UserId';_0x11f6f0=as['buildExpression'](_0x2145cf,_0x25d6f4[_0x834e('0x7a')],_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x7c')],_0x11f6f0[_0x834e('0x75')]['end']);}break;case _0x834e('0x33'):_0x11f6f0=as['buildExpression']('me',null,_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')][_0x834e('0x7c')],_0x11f6f0['value'][_0x834e('0x24')]);break;}}else{var _0x11f6f0=as['buildExpression'](_0x2145cf,_0x25d6f4[_0x834e('0x7a')],_0x2cb233);_0x125f37[_0x297cce](_0x11f6f0[_0x834e('0x7b')],_0x11f6f0[_0x834e('0x75')]['start'],_0x11f6f0[_0x834e('0x75')][_0x834e('0x24')]);}}}else{var _0x402692=_(_0x279ea1[_0x834e('0x4a')])[_0x834e('0x4b')]()[_0x834e('0x45')](function(_0x1372dd){return _[_0x834e('0x7f')](_0x112306,[_0x834e('0x30'),_0x1372dd])?_0x1372dd:undefined;})[_0x834e('0x80')]()['value']();if(!_['isEmpty'](_0x402692)){_0x402692['forEach'](function(_0x36ede9){if(_0x36ede9===_0x834e('0x81')){_0x142334[_0x834e('0x54')](_0x834e('0x82'),[][_0x834e('0x83')](_0x279ea1['query'][_0x36ede9]));}else if(_0x36ede9==='createdAt'){var _0x4520fc=JSON[_0x834e('0x84')](_0x279ea1[_0x834e('0x4a')][_0x36ede9])[_0x834e('0x85')];var _0x40a705=JSON['parse'](_0x279ea1[_0x834e('0x4a')][_0x36ede9])[_0x834e('0x86')];_0x142334[_0x834e('0x54')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4520fc,_0x40a705);}else{if(_0x279ea1[_0x834e('0x4a')][_0x36ede9]===_0x834e('0x87')){_0x142334[_0x834e('0x54')]('i.'+_0x36ede9+_0x834e('0x88'));}else{_0x142334[_0x834e('0x54')]('i.'+_0x36ede9+'\x20=\x20?',_0x279ea1['query'][_0x36ede9]);}}});}if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x89')]){if(_0x279ea1['query'][_0x834e('0x89')]==0x1){_0x142334['having'](_0x834e('0x8a'));}else{_0x142334[_0x834e('0x70')](_0x834e('0x8b'));}}if(_0x279ea1['query'][_0x834e('0x8c')]){_0x1def00=_['isArray'](_0x279ea1['query']['tag'])?_0x279ea1[_0x834e('0x4a')][_0x834e('0x8c')]:new Array(_0x279ea1[_0x834e('0x4a')][_0x834e('0x8c')]);_0x1def00[_0x834e('0x39')](function(_0x2dad55){_0x208c21['or'](_0x834e('0x8d'),'%,'+_0x2dad55+',%');});}if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x8e')]){var _0x53f6e3=_0x279ea1[_0x834e('0x4a')]['filter'][_0x834e('0x8f')]('\x5c','\x5c\x5c')[_0x834e('0x8f')](/'/g,'\x27\x27');if(qs[_0x834e('0x90')](_0x53f6e3)){_0x125f37['or'](_0x834e('0x91'),_0x53f6e3+'%');}else{_0x125f37['or'](_0x834e('0x92'),qs[_0x834e('0x93')](_0x53f6e3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x53f6e3+'%');}}}_0x142334['where'](_0x125f37);_0x142334[_0x834e('0x94')](_0x834e('0x95'));var _0x4eff8d={'type':db[_0x834e('0x96')][_0x834e('0x97')][_0x834e('0x98')],'raw':!![]};var _0x1e225f=_0x142334[_0x834e('0x99')]();_0x1e225f['field'](_0x834e('0x95'));_0x1e225f[_0x834e('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x3124be['order']){_0x3124be[_0x834e('0x52')][_0x834e('0x39')](function(_0x4f716d){var _0x23ce49=_0x4f716d[0x0]===_0x834e('0x9a')?_0x4f716d[0x0]:'i.'+_0x4f716d[0x0];_0x142334['order'](_0x23ce49,_0x4f716d[0x1]===_0x834e('0x9b')?![]:!![]);});}if(!_['isEmpty'](_0x1def00)){_0x142334['having'](_0x208c21);_0x1e225f[_0x834e('0x54')](_0x834e('0x9c'),_0x1def00);}BPromise[_0x834e('0x9d')]()[_0x834e('0x2c')](function(){if(!_0x1e4310){if(_0x279ea1['query'][_0x834e('0x81')])return;_0x1e225f[_0x834e('0x54')](_0x834e('0x9e'));_0x142334[_0x834e('0x54')](_0x834e('0x9e'));return;}if(_0x279ea1[_0x834e('0x9f')][_0x834e('0xa0')]!==_0x834e('0xa1'))return;return _0x279ea1[_0x834e('0x9f')][_0x834e('0xa2')]({'attributes':['id'],'raw':!![]})[_0x834e('0x2c')](function(_0x261e3d){if(_[_0x834e('0xa3')](_0x261e3d)){_0x1e225f[_0x834e('0x54')](_0x834e('0xa4'));_0x142334[_0x834e('0x54')](_0x834e('0xa4'));}else{_0x1e225f[_0x834e('0x54')](_0x834e('0x82'),_[_0x834e('0x45')](_0x261e3d,'id'));_0x142334[_0x834e('0x54')](_0x834e('0x82'),_['map'](_0x261e3d,'id'));}});})[_0x834e('0x2c')](function(){if(_0x279ea1[_0x834e('0x9f')][_0x834e('0xa0')]===_0x834e('0xa1')&&!_0x1e4310&&!_0x279ea1[_0x834e('0x4a')][_0x834e('0x81')])return[];return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x1e225f[_0x834e('0xa6')](),_0x4eff8d);})['then'](function(_0x5ce790){_0x47a8a9['count']=_0x5ce790[_0x834e('0x50')];if(_0x47a8a9['count']===0x0)return[];return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x1bc975[_0x834e('0xa6')](),_0x4eff8d)['then'](function(_0xae00f){_0x344b51=_[_0x834e('0xa7')](_0xae00f,'id');_0x4eff8d=_[_0x834e('0xa8')](_0x4eff8d,{'model':db[_0x834e('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x279ea1[_0x834e('0x4a')][_0x834e('0x4f')]){_0x3124be['attributes'][_0x834e('0x39')](function(_0x27bd2e){_0x142334[_0x834e('0x56')]('i.'+_0x27bd2e);});}else{_0x142334[_0x834e('0x56')](_0x834e('0xa9'),'unreadMessages');_0x142334['field']('a.key','Account.key');_0x142334[_0x834e('0x56')](_0x834e('0xaa'),'Account.mandatoryDisposition');_0x142334[_0x834e('0x56')](_0x834e('0xab'),'contactName');_0x142334[_0x834e('0x56')](_0x834e('0xac'));_0x142334[_0x834e('0x56')](_0x834e('0xad'),_0x834e('0xae'));_0x142334[_0x834e('0x56')]('c.lastName','Contact.lastName');_0x142334[_0x834e('0x56')](_0x834e('0xaf'),_0x834e('0xb0'));_0x142334['field'](_0x834e('0xb1'),_0x834e('0xb2'));_0x142334['field'](_0x834e('0xb3'),_0x834e('0xb4'));_0x142334[_0x834e('0x56')](_0x834e('0xb5'),'Contact.fax');_0x142334[_0x834e('0x56')]('o.fullname','Owner.fullname');_0x142334[_0x834e('0x56')](_0x834e('0xb6'),_0x834e('0xb7'));_0x142334[_0x834e('0x56')](_0x834e('0xb8'),_0x834e('0x37'));}if(_0x3124be['limit'])_0x142334['limit'](_0x3124be[_0x834e('0x26')]);if(_0x3124be[_0x834e('0x25')])_0x142334[_0x834e('0x25')](_0x3124be[_0x834e('0x25')]);return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x142334[_0x834e('0xa6')](),_0x4eff8d);})['then'](function(_0x435a75){if(_0x435a75[_0x834e('0x50')]>0x0)_0x6c0b29['where'](_0x834e('0xb9'),_[_0x834e('0x45')](_0x435a75,'id'));return db[_0x834e('0xa5')][_0x834e('0x4a')](_0x6c0b29[_0x834e('0xa6')](),_0x4eff8d)[_0x834e('0x2c')](function(_0x231f0b){var _0x3b44f3=_[_0x834e('0xba')](_0x231f0b,_0x834e('0xbb'));var _0x496709=[];_0x435a75[_0x834e('0x39')](function(_0x17e922){_0x496709[_0x834e('0xbc')](updateChatInteraction(_0x17e922,_0x344b51,_0x3b44f3));});return BPromise['all'](_0x496709);});});})[_0x834e('0x2c')](function(_0x20fdfd){_0x47a8a9['rows']=_0x20fdfd;return _0x47a8a9;})[_0x834e('0x2c')](respondWithFilteredResult(_0x5f3943,_0x3124be))['catch'](handleError(_0x5f3943,null));};exports[_0x834e('0xbd')]=function(_0x53c483,_0x16a42b){var _0x560d10={'raw':![],'where':{'id':_0x53c483[_0x834e('0xbe')]['id']}},_0x2b6d1={};_0x2b6d1[_0x834e('0x49')]=_[_0x834e('0x4b')](db['ChatInteraction'][_0x834e('0x47')]);_0x2b6d1[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x53c483[_0x834e('0x4a')]);_0x2b6d1[_0x834e('0x4c')]=_[_0x834e('0x4d')](_0x2b6d1[_0x834e('0x49')],_0x2b6d1[_0x834e('0x4a')]);_0x560d10[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x2b6d1[_0x834e('0x49')],qs[_0x834e('0x4f')](_0x53c483[_0x834e('0x4a')][_0x834e('0x4f')]));_0x560d10[_0x834e('0x4e')]=_0x560d10[_0x834e('0x4e')][_0x834e('0x50')]?_0x560d10['attributes']:_0x2b6d1['model'];if(_0x53c483[_0x834e('0x4a')][_0x834e('0xbf')]){_0x560d10[_0x834e('0xc0')]=[{'all':!![]}];}_0x560d10=_[_0x834e('0xa8')]({},_0x560d10,_0x53c483[_0x834e('0xc1')]);return db[_0x834e('0x46')][_0x834e('0x6f')](_0x560d10)[_0x834e('0x2c')](handleEntityNotFound(_0x16a42b,null))[_0x834e('0x2c')](respondWithResult(_0x16a42b,null))[_0x834e('0x22')](handleError(_0x16a42b,null));};exports[_0x834e('0xc2')]=function(_0x32645e,_0x513d9e){return db[_0x834e('0x46')]['create'](_0x32645e[_0x834e('0x33')],{})[_0x834e('0x2c')](respondWithResult(_0x513d9e,0xc9))[_0x834e('0x22')](handleError(_0x513d9e,null));};exports['update']=function(_0x1a65b4,_0x23a386){if(_0x1a65b4['body']['id']){delete _0x1a65b4['body']['id'];}return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0x1a65b4['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x23a386,null))[_0x834e('0x2c')](saveUpdates(_0x1a65b4[_0x834e('0x33')],null))[_0x834e('0x2c')](respondWithResult(_0x23a386,null))[_0x834e('0x22')](handleError(_0x23a386,null));};exports['destroy']=function(_0x4e7545,_0x453e58){return db['ChatInteraction']['find']({'where':{'id':_0x4e7545['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x453e58,null))[_0x834e('0x2c')](removeEntity(_0x453e58,null))['catch'](handleError(_0x453e58,null));};exports[_0x834e('0xc3')]=function(_0x66cbdc,_0x470568){return db[_0x834e('0x46')]['describe']()[_0x834e('0x2c')](respondWithResult(_0x470568,null))[_0x834e('0x22')](handleError(_0x470568,null));};exports[_0x834e('0xc4')]=function(_0x5633f4,_0x3d8af7){var _0x5f3b7d=_0x5633f4[_0x834e('0xbe')]['id'];var _0x4af2a2;var _0x461420;var _0x108100;return db['ChatInteraction'][_0x834e('0xc5')]({'where':{'id':_0x5f3b7d}})[_0x834e('0x2c')](function(_0x41e7a8){_0x4af2a2=_0x41e7a8;return db[_0x834e('0xc6')][_0x834e('0xc5')]({'where':{'id':_0x41e7a8[_0x834e('0x81')]},'attributes':['id','vidaooApiKey',_0x834e('0xc7'),_0x834e('0xc8'),_0x834e('0xc9'),_0x834e('0xca')],'raw':!![]});})[_0x834e('0x2c')](function(_0x1b8e67){if(_0x1b8e67&&_0x1b8e67['vidaooApiKey']&&_0x1b8e67[_0x834e('0xc7')]){_0x461420=_0x1b8e67;var _0x490a57={'interaction':{'id':_0x5f3b7d},'agent':{'id':_0x5633f4['user']['id'],'name':_0x5633f4[_0x834e('0x9f')]['name'],'fullname':_0x5633f4['user'][_0x834e('0xcb')],'email':_0x5633f4[_0x834e('0x9f')][_0x834e('0xcc')]},'contact':_0x5633f4[_0x834e('0x33')][_0x834e('0x34')],'account':_0x5633f4[_0x834e('0x33')][_0x834e('0x35')]};var _0x155f2d={'rejectUnauthorized':![],'method':_0x834e('0xcd'),'url':_0x834e('0xce'),'headers':{'X-APIKEY':_0x1b8e67[_0x834e('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5633f4[_0x834e('0x9f')][_0x834e('0xcc')]],'buttons':null,'topic':_0x461420[_0x834e('0xc8')],'note':_['isNull'](_0x461420[_0x834e('0xc9')])?null:getMustacheRender(_0x461420['vidaooNote'],_0x490a57),'metadata':null},'redirect':_0x834e('0xd0'),'json':!![]};try{if(!_[_0x834e('0xd1')](_0x461420[_0x834e('0xca')])){var _0x2cdbe0=getMustacheRender(_0x461420['vidaooMetadata'],_0x490a57);var _0x5f558a=JSON[_0x834e('0x84')](_0x2cdbe0);_0x155f2d[_0x834e('0x33')]['metadata']=_0x5f558a;}}catch(_0x375c35){throw new db[(_0x834e('0x96'))]['ValidationError'](_0x834e('0xd2'));}return rp(_0x155f2d);}else{throw new db[(_0x834e('0x96'))][(_0x834e('0xd3'))](_0x834e('0xd4'));}})['then'](function(_0x57ff06){_0x108100=_0x57ff06;if(_0x108100['id']){var _0x4ead1d={'body':_0x108100['join_url'],'ChatWebsiteId':_0x461420['id'],'ChatInteractionId':_0x4af2a2['id'],'direction':_0x834e('0xd5'),'UserId':_0x5633f4[_0x834e('0x9f')]['id']};return db['ChatMessage'][_0x834e('0xc2')](_0x4ead1d,{});}else{throw new db['Sequelize'][(_0x834e('0xd3'))](_0x834e('0xd6'));}})[_0x834e('0x2c')](function(){return _0x4af2a2[_0x834e('0xd7')]({'vidaooSessionId':_0x108100['id']});})[_0x834e('0x2c')](respondWithResult(_0x3d8af7,null))[_0x834e('0x22')](handleError(_0x3d8af7,null));};exports[_0x834e('0xd8')]=function(_0x4fc61d,_0x12a0f3){if(_0x4fc61d[_0x834e('0x33')]['id']){delete _0x4fc61d['body']['id'];}return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0x4fc61d['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x834e('0x2c')](handleEntityNotFound(_0x12a0f3,null))[_0x834e('0x2c')](saveUpdates(_0x4fc61d[_0x834e('0x33')],null))['then'](respondWithResult(_0x12a0f3,null))[_0x834e('0x22')](handleError(_0x12a0f3,null));};exports[_0x834e('0xd9')]=function(_0xbd0346,_0x17e729){if(_0xbd0346[_0x834e('0x33')]['id']){delete _0xbd0346[_0x834e('0x33')]['id'];}return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0xbd0346[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](function(_0x48b6c4){if(!_0x48b6c4){logger['error'](_0x834e('0xda'),_0x834e('0xd9'),0x194,_0x834e('0xdb'));_0x17e729[_0x834e('0x2e')](0x194);}else{if(_0x48b6c4[_0x834e('0x3e')]){throw new db[(_0x834e('0x96'))][(_0x834e('0xd3'))](_0x834e('0xdc'));}}return _0x48b6c4;})[_0x834e('0x2c')](function(_0x97a4b2){if(_0x97a4b2){return _0x97a4b2[_0x834e('0x2b')]({'closed':_0xbd0346[_0x834e('0x33')][_0x834e('0x40')],'disposition':_0xbd0346['body'][_0x834e('0x41')]})[_0x834e('0x2c')](function(_0x3f5b2e){return _0x3f5b2e;});}})[_0x834e('0x2c')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0xbd0346['body'],client9004);})[_0x834e('0x2c')](respondWithResult(_0x17e729,null))[_0x834e('0x22')](handleError(_0x17e729,null));};exports[_0x834e('0xdd')]=function(_0x23d7e6,_0x181ecd){_0x23d7e6[_0x834e('0x33')][_0x834e('0x30')]=_0x23d7e6[_0x834e('0xde')]['originalname'];_0x23d7e6['body']['basename']=_0x23d7e6['file'][_0x834e('0xdf')];_0x23d7e6[_0x834e('0x33')][_0x834e('0x7a')]=_0x23d7e6[_0x834e('0xde')][_0x834e('0xe0')];return db[_0x834e('0xe1')][_0x834e('0xc2')](_0x23d7e6[_0x834e('0x33')])[_0x834e('0x2c')](respondWithResult(_0x181ecd,0xc9))['catch'](handleError(_0x181ecd,null));};exports['attachmentDownload']=function(_0x4d1545,_0x5dc651){return db[_0x834e('0x46')][_0x834e('0xc5')]({'where':{'id':_0x4d1545[_0x834e('0xbe')]['id']},'raw':!![]})[_0x834e('0x2c')](handleEntityNotFound(_0x5dc651,null))[_0x834e('0x2c')](function(_0xcb9751){if(_0xcb9751){if(_0xcb9751[_0x834e('0x40')]){return _0x5dc651[_0x834e('0x23')](0x193)[_0x834e('0x2a')]({'status':0x193,'message':_0x834e('0xe2')});}return db[_0x834e('0xe1')][_0x834e('0xc5')]({'where':{'id':_0x4d1545[_0x834e('0x4a')][_0x834e('0xe3')]},'raw':!![]})[_0x834e('0x2c')](handleEntityNotFound(_0x5dc651,null));}})[_0x834e('0x2c')](function(_0x5022f2){if(_0x5022f2){var _0x13f473=_0x5022f2['ChatOfflineMessageId']!==null;var _0x1f6bb9=path[_0x834e('0xe4')](config[_0x834e('0xe5')],'server/files/attachments/');if(_0x13f473){_0x1f6bb9=path[_0x834e('0xe4')](_0x1f6bb9,_0x834e('0xe6'));}var _0x4d7fef=path['join'](_0x1f6bb9,_0x5022f2[_0x834e('0xe7')]);return _0x5dc651[_0x834e('0xe8')](_0x4d7fef);}})[_0x834e('0x22')](handleError(_0x5dc651,null));};exports[_0x834e('0xe9')]=function(_0x12d468,_0x2e9116){var _0x3eb2e8=null;var _0x239a4e=null;var _0x569a80=null;if(_0x12d468[_0x834e('0x33')]['id']){delete _0x12d468[_0x834e('0x33')]['id'];}if(_0x12d468[_0x834e('0x33')][_0x834e('0xea')]){_0x569a80=path[_0x834e('0xe4')](config[_0x834e('0xe5')],_0x834e('0xeb'),util['format'](_0x834e('0xec'),Date['now']()));_0x12d468['body'][_0x834e('0xed')]=_0x569a80;}return db[_0x834e('0x46')]['find']({'where':{'id':_0x12d468[_0x834e('0xbe')]['id']},'include':[{'model':db[_0x834e('0xee')],'as':'Messages','include':[{'model':db[_0x834e('0xef')],'as':_0x834e('0xef')}]}]})['then'](handleEntityNotFound(_0x2e9116,null))['then'](saveUpdates(_0x12d468[_0x834e('0x33')],null))[_0x834e('0x2c')](function(_0x4e6525){if(_0x4e6525){_0x3eb2e8=_0x4e6525;return db['ChatWebsite'][_0x834e('0x6f')]({'where':{'id':_0x3eb2e8[_0x834e('0x81')]}});}})['then'](function(_0x480290){if(_0x480290){_0x239a4e=_0x480290;return db['CmContact']['find']({'where':{'id':_0x3eb2e8[_0x834e('0x78')]}});}})['then'](function(_0x3be4c3){if(_0x3be4c3){if(_0x569a80){var _0x52cdcc=null;for(var _0x343348=0x1;_0x343348<_0x3eb2e8[_0x834e('0xf0')][_0x834e('0x50')];++_0x343348){_0x52cdcc=_0x3eb2e8[_0x834e('0xf0')][_0x343348];var _0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?util[_0x834e('0xf1')](_0x834e('0xf2'),_0x239a4e[_0x834e('0xf3')],_0x52cdcc[_0x834e('0x3e')]):_0x834e('0xf4');var _0x3d8abb=_0x12d468[_0x834e('0x33')][_0x834e('0xf5')]||util[_0x834e('0xf1')]('%s%d',_0x834e('0xf6'),_0x52cdcc['ContactId']);switch(_0x239a4e[_0x834e('0xf7')]){case _0x834e('0xf8'):_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?util[_0x834e('0xf1')](_0x834e('0xf2'),_0x239a4e['agentAlias'],_0x52cdcc[_0x834e('0x3e')]):'System';break;case'agent_alias':_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?_0x52cdcc[_0x834e('0xef')][_0x834e('0xf9')]||_0x52cdcc['User'][_0x834e('0xcb')]:_0x834e('0xf4');break;case _0x834e('0xfa'):_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?_0x52cdcc[_0x834e('0xef')][_0x834e('0xcb')]:_0x834e('0xf4');break;default:_0x4fabe6=_0x52cdcc[_0x834e('0x3e')]?util[_0x834e('0xf1')](_0x834e('0xf2'),_0x239a4e[_0x834e('0xf3')],_0x52cdcc['UserId']):_0x834e('0xf4');}var _0x121d87=util[_0x834e('0xf1')](_0x834e('0xfb'),moment(_0x52cdcc[_0x834e('0xfc')])[_0x834e('0xf1')]('MM/DD/YYYY\x20HH:mm:ss'),_0x52cdcc[_0x834e('0xfd')]==='in'?_0x3d8abb:_0x4fabe6,_0x52cdcc[_0x834e('0x33')]);if(!_0x52cdcc[_0x834e('0xfe')]){fs[_0x834e('0xff')](_0x569a80,_0x121d87);}}return db[_0x834e('0x100')][_0x834e('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x834e('0x101')],'as':_0x834e('0x102'),'raw':!![],'include':[{'model':db[_0x834e('0x103')],'as':_0x834e('0x103'),'raw':!![]}]}]});}}})['then'](function(_0x571645){if(!_0x571645||!_0x571645[_0x834e('0x102')]||!_0x12d468['body'])return _0x3eb2e8;var _0x4094d5=_0x571645[_0x834e('0x104')]();return respondWithRpcPromise(_0x834e('0x105'),_0x834e('0x106'),{'account':_0x4094d5,'message':{'from':util[_0x834e('0xf1')](_0x834e('0x107'),_0x571645['name'],_0x571645[_0x834e('0xcc')]||_0x571645['Smtp']['user']),'to':_0x12d468['body'][_0x834e('0xea')],'subject':_0x834e('0x108'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x12d468['body'][_0x834e('0xea')]),'attachments':[{'path':_0x569a80}]}})[_0x834e('0x2c')](function(){return _0x3eb2e8;})[_0x834e('0x22')](function(_0x5e0bfe){logger[_0x834e('0x1d')](_0x5e0bfe);});})[_0x834e('0x2c')](respondWithStatusCode(_0x2e9116,0xc8))[_0x834e('0x22')](handleError(_0x2e9116,null));};exports[_0x834e('0x109')]=function(_0xb9635a,_0x3c1a19){return db['ChatMessage']['find']({'where':{'id':_0xb9635a['params']['id']}})['then'](handleEntityNotFound(_0x3c1a19,null))[_0x834e('0x2c')](function(_0xf82ca8){if(_0xf82ca8){return _0xf82ca8[_0x834e('0x109')](_0xb9635a[_0x834e('0x33')][_0x834e('0x10a')],_[_0x834e('0x10b')](_0xb9635a[_0x834e('0x33')],[_0x834e('0x10a'),'id'])||{});}})[_0x834e('0x2c')](respondWithResult(_0x3c1a19,null))[_0x834e('0x22')](handleError(_0x3c1a19,null));};exports[_0x834e('0x10c')]=function(_0x18735a,_0x3446ff){var _0x1e11e0={'raw':![],'where':{}};var _0x38796c={};var _0x59bd0e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x834e('0xc5')]({'where':{'id':_0x18735a[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x3446ff,null))['then'](function(_0xf89b9e){if(_0xf89b9e){_0x38796c[_0x834e('0x49')]=_[_0x834e('0x4b')](db[_0x834e('0xee')][_0x834e('0x47')]);_0x38796c[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x18735a[_0x834e('0x4a')]);_0x38796c[_0x834e('0x4c')]=_['intersection'](_0x38796c[_0x834e('0x49')],_0x38796c[_0x834e('0x4a')]);_0x1e11e0[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x38796c['model'],qs[_0x834e('0x4f')](_0x18735a[_0x834e('0x4a')][_0x834e('0x4f')]));_0x1e11e0[_0x834e('0x4e')]=_0x1e11e0[_0x834e('0x4e')][_0x834e('0x50')]?_0x1e11e0[_0x834e('0x4e')]:_0x38796c[_0x834e('0x49')];if(!_0x18735a[_0x834e('0x4a')]['hasOwnProperty'](_0x834e('0x10d'))){_0x1e11e0['limit']=qs[_0x834e('0x26')](_0x18735a['query'][_0x834e('0x26')]);_0x1e11e0[_0x834e('0x25')]=qs[_0x834e('0x25')](_0x18735a[_0x834e('0x4a')][_0x834e('0x25')]);}_0x1e11e0['order']=qs[_0x834e('0x53')](_0x18735a[_0x834e('0x4a')]['sort']);_0x1e11e0['where']=qs[_0x834e('0x4c')](_['pick'](_0x18735a['query'],_0x38796c['filters']));_0x1e11e0[_0x834e('0x54')][_0x834e('0xbb')]=_0xf89b9e['id'];if(_0x18735a[_0x834e('0x4a')][_0x834e('0x8e')]){_0x1e11e0[_0x834e('0x54')]=_[_0x834e('0xa8')](_0x1e11e0[_0x834e('0x54')],{'$or':_['map'](_0x1e11e0[_0x834e('0x4e')],function(_0x278052){var _0x4a428c={};_0x4a428c[_0x278052]={'$like':'%'+_0x18735a['query'][_0x834e('0x8e')]+'%'};return _0x4a428c;})});}if(_0x18735a[_0x834e('0x4a')]['$gte']){var _0x5920f3=_0x18735a[_0x834e('0x4a')][_0x834e('0x85')][_0x834e('0x38')](',');var _0x599664={};_0x599664[_0x5920f3[0x0]]={'$gte':moment(_0x5920f3[0x1])[_0x834e('0xf1')](_0x834e('0x10e'))};_0x1e11e0[_0x834e('0x54')]=_['merge'](_0x1e11e0[_0x834e('0x54')],_0x599664);}_0x1e11e0=_['merge']({},_0x1e11e0,_0x18735a[_0x834e('0xc1')]);return db[_0x834e('0xee')][_0x834e('0x28')]({'where':_0x1e11e0[_0x834e('0x54')]})[_0x834e('0x2c')](function(_0x516a53){_0x59bd0e[_0x834e('0x28')]=_0x516a53;if(_0x18735a[_0x834e('0x4a')][_0x834e('0xbf')]){_0x1e11e0[_0x834e('0xc0')]=[{'all':!![]}];}return db[_0x834e('0xee')]['findAll'](_0x1e11e0);})['then'](function(_0x2ca127){_0x59bd0e[_0x834e('0x10f')]=_0x2ca127;return _0x59bd0e;});}})[_0x834e('0x2c')](respondWithFilteredResult(_0x3446ff,_0x1e11e0))['catch'](handleError(_0x3446ff,null));};exports[_0x834e('0x110')]=function(_0x2e3294,_0x28d9c3){var _0x386b73={'where':{}},_0x53faec={},_0x3cc563={'count':0x0,'rows':[]};return db[_0x834e('0x46')]['findOne']({'where':{'id':_0x2e3294[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x28d9c3,null))[_0x834e('0x2c')](function(_0x3e408c){if(_0x3e408c){_0x53faec['model']=_[_0x834e('0x4b')](db['ChatMessage'][_0x834e('0x47')]);_0x53faec[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x2e3294[_0x834e('0x4a')]);_0x53faec[_0x834e('0x4c')]=_[_0x834e('0x4d')](_0x53faec['model'],_0x53faec['query']);_0x386b73[_0x834e('0x4e')]=_[_0x834e('0x4d')](_0x53faec['model'],qs[_0x834e('0x4f')](_0x2e3294['query'][_0x834e('0x4f')]));_0x386b73[_0x834e('0x4e')]=_0x386b73[_0x834e('0x4e')][_0x834e('0x50')]?_0x386b73[_0x834e('0x4e')]:_0x53faec[_0x834e('0x49')];if(!_0x2e3294[_0x834e('0x4a')]['hasOwnProperty'](_0x834e('0x10d'))){_0x386b73[_0x834e('0x26')]=qs[_0x834e('0x26')](_0x2e3294[_0x834e('0x4a')][_0x834e('0x26')]);_0x386b73['offset']=qs[_0x834e('0x25')](_0x2e3294[_0x834e('0x4a')][_0x834e('0x25')]);}_0x386b73['order']=qs['sort'](_0x2e3294['query'][_0x834e('0x53')]);_0x386b73[_0x834e('0x54')]=qs[_0x834e('0x4c')](_[_0x834e('0x55')](_0x2e3294[_0x834e('0x4a')],_0x53faec[_0x834e('0x4c')]));_0x386b73[_0x834e('0x54')][_0x834e('0xbb')]=_0x3e408c['id'];if(_0x2e3294[_0x834e('0x4a')][_0x834e('0x8e')]){_0x386b73[_0x834e('0x54')]=_['merge'](_0x386b73[_0x834e('0x54')],{'$or':_[_0x834e('0x45')](_0x386b73[_0x834e('0x4e')],function(_0x26534d){var _0x4081a1={};_0x4081a1[_0x26534d]={'$like':'%'+_0x2e3294[_0x834e('0x4a')][_0x834e('0x8e')]+'%'};return _0x4081a1;})});}_0x386b73[_0x834e('0x54')]['secret']=![];if(_0x2e3294[_0x834e('0x4a')]['id']){_0x386b73[_0x834e('0x54')]['id']={'$gt':_0x2e3294['query']['id']};}_0x386b73=_[_0x834e('0xa8')]({},_0x386b73,_0x2e3294[_0x834e('0xc1')]);return db[_0x834e('0xee')][_0x834e('0x28')]({'where':_0x386b73['where']})['then'](function(_0x3d37c8){_0x3cc563['count']=_0x3d37c8;_0x386b73[_0x834e('0xc0')]=[];if(_0x2e3294[_0x834e('0x4a')][_0x834e('0x111')]){_0x386b73[_0x834e('0xc0')][_0x834e('0xbc')]({'model':db['User'],'as':_0x834e('0xef'),'attributes':['id','fullname','alias']});}if(_0x2e3294[_0x834e('0x4a')][_0x834e('0xbf')]){_0x386b73[_0x834e('0xc0')]=[{'all':!![]}];}return db[_0x834e('0xee')][_0x834e('0x112')](_0x386b73);})[_0x834e('0x2c')](function(_0x5912ee){_0x3cc563[_0x834e('0x10f')]=_0x5912ee;return _0x3cc563;});}})[_0x834e('0x2c')](respondWithFilteredResult(_0x28d9c3,_0x386b73))['catch'](handleError(_0x28d9c3,null));};exports[_0x834e('0x113')]=function(_0x3b4264,_0x4b070a){return db[_0x834e('0x46')][_0x834e('0x6f')]({'where':{'id':_0x3b4264['params']['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x4b070a,null))[_0x834e('0x2c')](function(_0x164170){if(_0x164170){return _0x164170[_0x834e('0x114')](_0x3b4264[_0x834e('0x33')][_0x834e('0x10a')],_[_0x834e('0x10b')](_0x3b4264[_0x834e('0x33')],[_0x834e('0x10a'),'id'])||{})[_0x834e('0x115')](function(){return db['Tag'][_0x834e('0x112')]({'attributes':['id',_0x834e('0x30'),_0x834e('0x57')],'where':{'id':_0x3b4264[_0x834e('0x33')][_0x834e('0x10a')]}});})[_0x834e('0x2c')](function(_0x2d61c1){socket[_0x834e('0x116')](_0x834e('0x117'),{'id':Number(_0x3b4264[_0x834e('0xbe')]['id']),'tags':_0x2d61c1||[]});return{'id':Number(_0x3b4264[_0x834e('0xbe')]['id']),'tags':_0x2d61c1||[]};});}})[_0x834e('0x2c')](respondWithResult(_0x4b070a,null))['catch'](handleError(_0x4b070a,null));};exports[_0x834e('0x118')]=function(_0x1cd122,_0x49be08){return db['ChatInteraction']['find']({'where':{'id':_0x1cd122[_0x834e('0xbe')]['id']}})[_0x834e('0x2c')](handleEntityNotFound(_0x49be08,null))[_0x834e('0x2c')](function(_0x3530bc){if(_0x3530bc){return _0x3530bc[_0x834e('0x118')](_0x1cd122[_0x834e('0x4a')][_0x834e('0x10a')]);}})['then'](respondWithStatusCode(_0x49be08,null))['catch'](handleError(_0x49be08,null));};exports['download']=function(_0x47947b,_0x684a97){var _0x3c8fc2=moment()[_0x834e('0x119')]()['toString']();var _0x5776c5=path['join'](config[_0x834e('0xe5')],'server','files',_0x834e('0x11a'));var _0x378bf3=path[_0x834e('0xe4')](config[_0x834e('0xe5')],_0x834e('0x11b'),_0x834e('0x11c'),_0x834e('0x11d'));var _0x59a706=path[_0x834e('0xe4')](_0x5776c5,_0x3c8fc2);var _0x11f472=util[_0x834e('0xf1')](_0x834e('0x11e'),_0x47947b[_0x834e('0xbe')]['id'],_0x3c8fc2);var _0x488f82=path[_0x834e('0xe4')](_0x5776c5,_0x11f472);var _0x5a3876=[];_0x5a3876[_0x834e('0xbc')]({'model':db[_0x834e('0xef')],'as':_0x834e('0xef'),'attributes':['id','fullname'],'raw':!![]});_0x5a3876['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x834e('0x11f'),_0x834e('0x120')],'raw':!![]});if(_0x47947b['query']['attachments']){_0x5a3876[_0x834e('0xbc')]({'model':db[_0x834e('0xe1')],'as':_0x834e('0xe1'),'raw':!![]});}var _0x51f527=[{'model':db[_0x834e('0xee')],'as':_0x834e('0xf0'),'attributes':['id',_0x834e('0x33'),'createdAt',_0x834e('0xfd'),_0x834e('0xfe'),_0x834e('0x89')],'include':_0x5a3876}];_0x51f527[_0x834e('0xbc')]({'model':db[_0x834e('0xc6')],'as':_0x834e('0x121'),'attributes':['id',_0x834e('0x30')]});_0x51f527['push']({'model':db[_0x834e('0xef')],'as':_0x834e('0x122'),'attributes':['id',_0x834e('0xcb')]});return db['ChatInteraction'][_0x834e('0x6f')]({'where':{'id':_0x47947b[_0x834e('0xbe')]['id']},'include':_0x51f527})[_0x834e('0x2c')](handleEntityNotFound(_0x684a97,null))[_0x834e('0x2c')](function(_0x2bbb1a){if(_0x2bbb1a){var _0x1ffed9=_0x2bbb1a[_0x834e('0x123')]({'plain':!![]});fs[_0x834e('0x124')](_0x59a706);var _0x25fa75={'channel':_0x834e('0x125'),'account':_0x1ffed9[_0x834e('0x121')][_0x834e('0x30')],'agent':_0x1ffed9['Owner']?_0x1ffed9[_0x834e('0x122')]['fullname']:_0x834e('0x126'),'createdAt':moment(_0x1ffed9['createdAt'])[_0x834e('0xf1')](_0x834e('0x10e'))[_0x834e('0xa6')](),'closedAt':_0x1ffed9[_0x834e('0x40')]?moment(_0x1ffed9[_0x834e('0x127')])[_0x834e('0xf1')](_0x834e('0x10e'))[_0x834e('0xa6')]():'','disposition':_0x1ffed9['disposition'],'chatInfo':{'browser':_0x1ffed9['browserName'],'os':_0x1ffed9['osName'],'referer':_0x1ffed9[_0x834e('0x128')],'customerIp':_0x1ffed9[_0x834e('0x129')],'customerPort':_0x1ffed9[_0x834e('0x12a')]?_0x1ffed9[_0x834e('0x12a')]:_0x834e('0x126')},'messages':_(_0x1ffed9[_0x834e('0xf0')])[_0x834e('0x12b')]()[_0x834e('0x8e')]({'secret':![]})['map'](function(_0x5a312e){if(_0x5a312e[_0x834e('0xe1')]){var _0x42e5ee=path[_0x834e('0xe4')](_0x378bf3,_0x5a312e['Attachment']['basename']);if(fs[_0x834e('0x12c')](_0x42e5ee)){fs['createReadStream'](_0x42e5ee)[_0x834e('0x12d')](fs[_0x834e('0x12e')](path[_0x834e('0xe4')](_0x59a706,_0x5a312e['Attachment'][_0x834e('0xe7')])));}}return{'date':moment(_0x5a312e[_0x834e('0xfc')])[_0x834e('0xf1')](_0x834e('0x10e'))[_0x834e('0xa6')](),'sender':_0x5a312e[_0x834e('0xfd')]===_0x834e('0xd5')?_0x5a312e['User']?_0x5a312e[_0x834e('0xef')][_0x834e('0xcb')]:_0x834e('0xf4'):_0x5a312e[_0x834e('0x73')][_0x834e('0x11f')]+(_0x5a312e[_0x834e('0x73')][_0x834e('0x120')]?'\x20'+_0x5a312e['Contact']['lastName']:''),'body':_0x5a312e[_0x834e('0xe1')]?_0x5a312e['Attachment']['basename']:_0x5a312e[_0x834e('0x33')],'direction':_0x5a312e[_0x834e('0xfd')]==='out'?'A':'C','secret':_0x5a312e[_0x834e('0xfe')],'read':_0x5a312e['read'],'attachment':_0x5a312e['Attachment']};})[_0x834e('0x75')]()};return ejs['renderFile'](path[_0x834e('0xe4')](config[_0x834e('0xe5')],_0x834e('0x11b'),_0x834e('0x12f'),_0x834e('0x130')),{'interaction':_0x25fa75})[_0x834e('0x2c')](function(_0x1a48f9){var _0x196f86=path[_0x834e('0xe4')](_0x59a706,'transcript-'+_0x1ffed9['id']+'-'+_0x3c8fc2+_0x834e('0x131'));var _0x19a42c={'path':_0x196f86,'channel':_0x834e('0x125'),'interactionId':_0x1ffed9['id']};return pdf[_0x834e('0x132')](_0x1a48f9,_0x19a42c);})['then'](function(){return new Promise(function(_0x4b1178,_0x46e533){zipdir(_0x59a706,{'saveTo':_0x488f82},function(_0x13a7e1,_0x5d801a){if(_0x13a7e1)return _0x46e533(_0x13a7e1);return _0x4b1178(_0x5d801a);});})[_0x834e('0x2c')](function(){return new BPromise(function(_0x505821,_0x2f46cf){rimraf(_0x59a706,function(_0x884f38){if(_0x884f38)_0x2f46cf(_0x884f38);return _0x505821();});});})[_0x834e('0x2c')](function(){return _0x684a97[_0x834e('0xe8')](_0x488f82,_0x11f472,function(_0xd7026f){if(_0xd7026f){logger[_0x834e('0x1d')]('err',_0xd7026f);}else{fs['unlinkSync'](_0x488f82);}});});});}else{return _0x684a97['sendStatus'](0xc8);}})[_0x834e('0x22')](handleError(_0x684a97,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 7616b10..9429105 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 _0x10cf=['catch','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','remove','setDataValue','Users','map','findAll','length','emit'];(function(_0x2cb147,_0x35d804){var _0xd5d41f=function(_0x4d8584){while(--_0x4d8584){_0x2cb147['push'](_0x2cb147['shift']());}};_0xd5d41f(++_0x35d804);}(_0x10cf,0x73));var _0xf10c=function(_0x47f5f6,_0x7aa8cd){_0x47f5f6=_0x47f5f6-0x0;var _0x3e7445=_0x10cf[_0x47f5f6];return _0x3e7445;};'use strict';var EventEmitter=require(_0xf10c('0x0'));var ChatInteraction=require(_0xf10c('0x1'))['db'][_0xf10c('0x2')];var ChatMessage=require(_0xf10c('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf10c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf10c('0x4')};function emitEvent(_0x2074ea){return function(_0x1522f9,_0x446bad,_0x2e649e){_0x1522f9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2ca25b){_0x1522f9[_0xf10c('0x5')](_0xf10c('0x6'),_0x2ca25b[_0xf10c('0x7')](function(_0x4e7b4c){return{'id':_0x4e7b4c['id']};}));return ChatMessage[_0xf10c('0x8')]({'where':{'ChatInteractionId':_0x1522f9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5992a2){_0x1522f9[_0xf10c('0x5')]('unreadMessages',_0x5992a2[_0xf10c('0x9')]);ChatInteractionEvents[_0xf10c('0xa')](_0x2074ea+':'+_0x1522f9['id'],_0x1522f9);ChatInteractionEvents[_0xf10c('0xa')](_0x2074ea,_0x1522f9);_0x2e649e(null);})[_0xf10c('0xb')](_0x2e649e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xf10c('0xc')](e,emitEvent(event));}}module[_0xf10c('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0xdc99=['ChatMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction'];(function(_0x3c6c6d,_0x272de5){var _0x548b8e=function(_0x3b90e2){while(--_0x3b90e2){_0x3c6c6d['push'](_0x3c6c6d['shift']());}};_0x548b8e(++_0x272de5);}(_0xdc99,0x184));var _0x9dc9=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xdc99[_0x95942];return _0x6d7f81;};'use strict';var EventEmitter=require(_0x9dc9('0x0'));var ChatInteraction=require(_0x9dc9('0x1'))['db'][_0x9dc9('0x2')];var ChatMessage=require(_0x9dc9('0x1'))['db'][_0x9dc9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9dc9('0x4'),'afterUpdate':'update','afterDestroy':_0x9dc9('0x5')};function emitEvent(_0x5be18b){return function(_0x13f215,_0x2e7df9,_0x4c4a4c){_0x13f215[_0x9dc9('0x6')]({'attributes':['id'],'raw':!![]})[_0x9dc9('0x7')](function(_0x51c06a){_0x13f215[_0x9dc9('0x8')](_0x9dc9('0x9'),_0x51c06a[_0x9dc9('0xa')](function(_0xd01579){return{'id':_0xd01579['id']};}));return ChatMessage[_0x9dc9('0xb')]({'where':{'ChatInteractionId':_0x13f215['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2acdf1){_0x13f215['setDataValue']('unreadMessages',_0x2acdf1['length']);ChatInteractionEvents['emit'](_0x5be18b+':'+_0x13f215['id'],_0x13f215);ChatInteractionEvents[_0x9dc9('0xc')](_0x5be18b,_0x13f215);_0x4c4a4c(null);})[_0x9dc9('0xd')](_0x4c4a4c(null));};}for(var e in events){if(events[_0x9dc9('0xe')](e)){var event=events[e];ChatInteraction[_0x9dc9('0xf')](e,emitEvent(event));}}module[_0x9dc9('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 451a956..ba938c8 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 _0x672c=['moment','bluebird','rimraf','exports','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x352ec6,_0x43fce0){var _0x221d8e=function(_0x595072){while(--_0x595072){_0x352ec6['push'](_0x352ec6['shift']());}};_0x221d8e(++_0x43fce0);}(_0x672c,0x1bf));var _0xc672=function(_0x46210b,_0x3e08fa){_0x46210b=_0x46210b-0x0;var _0x448b89=_0x672c[_0x46210b];return _0x448b89;};'use strict';var _=require(_0xc672('0x0'));var util=require(_0xc672('0x1'));var logger=require(_0xc672('0x2'))('api');var moment=require(_0xc672('0x3'));var BPromise=require(_0xc672('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc672('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0xc672('0x6')]=function(_0x8a65e9,_0x24c545){return _0x8a65e9['define'](_0xc672('0x7'),attributes,{'tableName':_0xc672('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16071a,_0x507bf1,_0x4385cc){if(_0x16071a[_0xc672('0x9')]('closed')){_0x16071a[_0xc672('0xa')]=moment()[_0xc672('0xb')](_0xc672('0xc'));}_0x4385cc(null,_0x16071a);}},'charset':_0xc672('0xd'),'collate':_0xc672('0xe')});}; \ No newline at end of file +var _0xd3ef=['path','rimraf','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3ef,0x8b));var _0xfd3e=function(_0x17b4e0,_0x28e167){_0x17b4e0=_0x17b4e0-0x0;var _0xc77cd8=_0xd3ef[_0x17b4e0];return _0xc77cd8;};'use strict';var _=require(_0xfd3e('0x0'));var util=require('util');var logger=require(_0xfd3e('0x1'))(_0xfd3e('0x2'));var moment=require('moment');var BPromise=require(_0xfd3e('0x3'));var rp=require(_0xfd3e('0x4'));var fs=require('fs');var path=require(_0xfd3e('0x5'));var rimraf=require(_0xfd3e('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x2e7ab8,_0x4f7830){return _0x2e7ab8['define']('ChatInteraction',attributes,{'tableName':_0xfd3e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cff83,_0x56526f,_0x3a16f2){if(_0x4cff83[_0xfd3e('0x8')]('closed')){_0x4cff83[_0xfd3e('0x9')]=moment()['format'](_0xfd3e('0xa'));}_0x3a16f2(null,_0x4cff83);}},'charset':_0xfd3e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 9837cc4..c969158 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 _0x21bd=['find','where','then','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','limit','AddTagsToChatInteraction'];(function(_0x4eccbe,_0x4676c7){var _0x59964a=function(_0x29513b){while(--_0x29513b){_0x4eccbe['push'](_0x4eccbe['shift']());}};_0x59964a(++_0x4676c7);}(_0x21bd,0x83));var _0xd21b=function(_0x3706e9,_0x5bafe4){_0x3706e9=_0x3706e9-0x0;var _0x4a96c1=_0x21bd[_0x3706e9];return _0x4a96c1;};'use strict';var _=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var moment=require(_0xd21b('0x2'));var BPromise=require(_0xd21b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd21b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd21b('0x5'));var logger=require(_0xd21b('0x6'))(_0xd21b('0x7'));var config=require(_0xd21b('0x8'));var jayson=require(_0xd21b('0x9'));var client=jayson[_0xd21b('0xa')]['http']({'port':0x232a});config[_0xd21b('0xb')]=_[_0xd21b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd21b('0xd'))(new Redis(config[_0xd21b('0xb')]));require(_0xd21b('0xe'))[_0xd21b('0xf')](socket);function respondWithRpcPromise(_0x367dc3,_0x16a382,_0x18bf18){return new BPromise(function(_0x741ac7,_0x2363da){return client[_0xd21b('0x10')](_0x367dc3,_0x18bf18)['then'](function(_0x372192){logger['info'](_0xd21b('0x11'),_0x16a382,'request\x20sent');logger[_0xd21b('0x12')](_0xd21b('0x13'),_0x16a382,'request\x20sent',JSON[_0xd21b('0x14')](_0x372192));if(_0x372192[_0xd21b('0x15')]){if(_0x372192[_0xd21b('0x15')]['code']===0x1f4){logger[_0xd21b('0x15')](_0xd21b('0x11'),_0x16a382,_0x372192['error'][_0xd21b('0x16')]);return _0x2363da(_0x372192[_0xd21b('0x15')][_0xd21b('0x16')]);}logger[_0xd21b('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x16a382,_0x372192[_0xd21b('0x15')]['message']);return _0x741ac7(_0x372192['error'][_0xd21b('0x16')]);}else{logger[_0xd21b('0x17')](_0xd21b('0x11'),_0x16a382,'request\x20sent');_0x741ac7(_0x372192[_0xd21b('0x18')][_0xd21b('0x16')]);}})[_0xd21b('0x19')](function(_0x5f4fbd){logger['error'](_0xd21b('0x11'),_0x16a382,_0x5f4fbd);_0x2363da(_0x5f4fbd);});});}exports[_0xd21b('0x1a')]=function(_0x3b6b51){var _0x17800d=this;return new Promise(function(_0x494c52,_0x82fcba){return db[_0xd21b('0x1b')][_0xd21b('0x1c')](_0x3b6b51['body'],{'raw':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51[_0xd21b('0x1d')][_0xd21b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51[_0xd21b('0x1d')]['where']||null:null,'attributes':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51[_0xd21b('0x1d')]['attributes']||null:null,'limit':_0x3b6b51[_0xd21b('0x1d')]?_0x3b6b51['options'][_0xd21b('0x1f')]||null:null})['then'](function(_0x4c580c){logger[_0xd21b('0x17')](_0xd21b('0x1a'),_0x3b6b51);logger[_0xd21b('0x12')](_0xd21b('0x1a'),_0x3b6b51,JSON[_0xd21b('0x14')](_0x4c580c));_0x494c52(_0x4c580c);})['catch'](function(_0x5393fe){logger[_0xd21b('0x15')](_0xd21b('0x1a'),_0x5393fe['message'],_0x3b6b51);_0x82fcba(_0x17800d['error'](0x1f4,_0x5393fe[_0xd21b('0x16')]));});});};exports[_0xd21b('0x20')]=function(_0x1b65f6){return new Promise(function(_0x8ce25d,_0x3ea1e9){return db['ChatInteraction'][_0xd21b('0x21')]({'where':_0x1b65f6['options']?_0x1b65f6[_0xd21b('0x1d')][_0xd21b('0x22')]||null:null})[_0xd21b('0x23')](function(_0x42d013){if(_0x42d013){return _0x42d013[_0xd21b('0x24')](_0x1b65f6['body'][_0xd21b('0x25')],_[_0xd21b('0x26')](_0x1b65f6[_0xd21b('0x27')],[_0xd21b('0x25'),'id'])||{});}})['spread'](function(_0x2dfcf1){logger[_0xd21b('0x17')](_0xd21b('0x28'),_0x1b65f6);logger[_0xd21b('0x12')]('AddTags',_0x1b65f6,JSON[_0xd21b('0x14')](_0x2dfcf1));_0x8ce25d(_0x2dfcf1);})[_0xd21b('0x19')](function(_0x4b8b54){logger['error'](_0xd21b('0x28'),_0x4b8b54[_0xd21b('0x16')],_0x1b65f6);_0x3ea1e9(_this[_0xd21b('0x15')](0x1f4,_0x4b8b54[_0xd21b('0x16')]));});});}; \ No newline at end of file +var _0xe7b5=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','request\x20sent','debug','stringify','error','message','ChatInteraction,\x20%s,\x20%s','result','catch','ChatInteraction','body','options','raw','where','attributes','limit','UpdateChatInteraction','find','then','addTags','ids','spread','AddTags'];(function(_0x141ec6,_0xad8345){var _0x3f2557=function(_0x2096ca){while(--_0x2096ca){_0x141ec6['push'](_0x141ec6['shift']());}};_0x3f2557(++_0xad8345);}(_0xe7b5,0x126));var _0x5e7b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe7b5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var moment=require(_0x5e7b('0x2'));var BPromise=require(_0x5e7b('0x3'));var rs=require(_0x5e7b('0x4'));var fs=require('fs');var Redis=require(_0x5e7b('0x5'));var db=require(_0x5e7b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e7b('0x7'))(_0x5e7b('0x8'));var config=require(_0x5e7b('0x9'));var jayson=require(_0x5e7b('0xa'));var client=jayson['client'][_0x5e7b('0xb')]({'port':0x232a});config[_0x5e7b('0xc')]=_[_0x5e7b('0xd')](config[_0x5e7b('0xc')],{'host':_0x5e7b('0xe'),'port':0x18eb});var socket=require(_0x5e7b('0xf'))(new Redis(config[_0x5e7b('0xc')]));require(_0x5e7b('0x10'))[_0x5e7b('0x11')](socket);function respondWithRpcPromise(_0x41ff9e,_0x1db3b2,_0x45a526){return new BPromise(function(_0x4b6756,_0x13e494){return client[_0x5e7b('0x12')](_0x41ff9e,_0x45a526)['then'](function(_0x431e7e){logger[_0x5e7b('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1db3b2,_0x5e7b('0x14'));logger[_0x5e7b('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1db3b2,_0x5e7b('0x14'),JSON[_0x5e7b('0x16')](_0x431e7e));if(_0x431e7e[_0x5e7b('0x17')]){if(_0x431e7e[_0x5e7b('0x17')]['code']===0x1f4){logger[_0x5e7b('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x1db3b2,_0x431e7e[_0x5e7b('0x17')][_0x5e7b('0x18')]);return _0x13e494(_0x431e7e['error'][_0x5e7b('0x18')]);}logger['error'](_0x5e7b('0x19'),_0x1db3b2,_0x431e7e['error']['message']);return _0x4b6756(_0x431e7e[_0x5e7b('0x17')][_0x5e7b('0x18')]);}else{logger[_0x5e7b('0x13')](_0x5e7b('0x19'),_0x1db3b2,_0x5e7b('0x14'));_0x4b6756(_0x431e7e[_0x5e7b('0x1a')]['message']);}})[_0x5e7b('0x1b')](function(_0x2992d2){logger['error'](_0x5e7b('0x19'),_0x1db3b2,_0x2992d2);_0x13e494(_0x2992d2);});});}exports['UpdateChatInteraction']=function(_0x1c37b6){var _0x2b104f=this;return new Promise(function(_0x5c9f8b,_0x107b9c){return db[_0x5e7b('0x1c')]['update'](_0x1c37b6[_0x5e7b('0x1d')],{'raw':_0x1c37b6[_0x5e7b('0x1e')]?_0x1c37b6[_0x5e7b('0x1e')][_0x5e7b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c37b6[_0x5e7b('0x1e')]?_0x1c37b6[_0x5e7b('0x1e')][_0x5e7b('0x20')]||null:null,'attributes':_0x1c37b6[_0x5e7b('0x1e')]?_0x1c37b6[_0x5e7b('0x1e')][_0x5e7b('0x21')]||null:null,'limit':_0x1c37b6[_0x5e7b('0x1e')]?_0x1c37b6[_0x5e7b('0x1e')][_0x5e7b('0x22')]||null:null})['then'](function(_0x230f41){logger[_0x5e7b('0x13')](_0x5e7b('0x23'),_0x1c37b6);logger['debug'](_0x5e7b('0x23'),_0x1c37b6,JSON[_0x5e7b('0x16')](_0x230f41));_0x5c9f8b(_0x230f41);})[_0x5e7b('0x1b')](function(_0x641b1f){logger[_0x5e7b('0x17')]('UpdateChatInteraction',_0x641b1f[_0x5e7b('0x18')],_0x1c37b6);_0x107b9c(_0x2b104f[_0x5e7b('0x17')](0x1f4,_0x641b1f[_0x5e7b('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0xbb0b92){return new Promise(function(_0x525519,_0x50f670){return db[_0x5e7b('0x1c')][_0x5e7b('0x24')]({'where':_0xbb0b92[_0x5e7b('0x1e')]?_0xbb0b92[_0x5e7b('0x1e')]['where']||null:null})[_0x5e7b('0x25')](function(_0x5ebaab){if(_0x5ebaab){return _0x5ebaab[_0x5e7b('0x26')](_0xbb0b92['body']['ids'],_['omit'](_0xbb0b92['body'],[_0x5e7b('0x27'),'id'])||{});}})[_0x5e7b('0x28')](function(_0x235ea6){logger[_0x5e7b('0x13')]('AddTags',_0xbb0b92);logger[_0x5e7b('0x15')](_0x5e7b('0x29'),_0xbb0b92,JSON[_0x5e7b('0x16')](_0x235ea6));_0x525519(_0x235ea6);})[_0x5e7b('0x1b')](function(_0x2043d6){logger[_0x5e7b('0x17')](_0x5e7b('0x29'),_0x2043d6[_0x5e7b('0x18')],_0xbb0b92);_0x50f670(_this[_0x5e7b('0x17')](0x1f4,_0x2043d6[_0x5e7b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1a42ba1..62e111e 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 _0x8cd9=['remove','update','emit','removeListener','chatInteraction:','./chatInteraction.events','save'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x8cd9,0x186));var _0x98cd=function(_0x55e773,_0x4c1e79){_0x55e773=_0x55e773-0x0;var _0xe29927=_0x8cd9[_0x55e773];return _0xe29927;};'use strict';var ChatInteractionEvents=require(_0x98cd('0x0'));var events=[_0x98cd('0x1'),_0x98cd('0x2'),_0x98cd('0x3')];function createListener(_0x46677d,_0x37c155){return function(_0x355efa){_0x37c155[_0x98cd('0x4')](_0x46677d,_0x355efa);};}function removeListener(_0x1c8b4f,_0x209fc5){return function(){ChatInteractionEvents[_0x98cd('0x5')](_0x1c8b4f,_0x209fc5);};}exports['register']=function(_0x1379b8){for(var _0x59e346=0x0,_0x386ab8=events['length'];_0x59e346<_0x386ab8;_0x59e346++){var _0x5e6cb3=events[_0x59e346];var _0xe94b8a=createListener(_0x98cd('0x6')+_0x5e6cb3,_0x1379b8);ChatInteractionEvents['on'](_0x5e6cb3,_0xe94b8a);}}; \ No newline at end of file +var _0x149c=['register','length','chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x3e5af4,_0x26df55){var _0x3ce6fa=function(_0x54e4ef){while(--_0x54e4ef){_0x3e5af4['push'](_0x3e5af4['shift']());}};_0x3ce6fa(++_0x26df55);}(_0x149c,0x143));var _0xc149=function(_0x3fd859,_0x41439d){_0x3fd859=_0x3fd859-0x0;var _0x19c4bb=_0x149c[_0x3fd859];return _0x19c4bb;};'use strict';var ChatInteractionEvents=require(_0xc149('0x0'));var events=['save',_0xc149('0x1'),_0xc149('0x2')];function createListener(_0x35e9b8,_0x4f5a90){return function(_0x3b8ac6){_0x4f5a90[_0xc149('0x3')](_0x35e9b8,_0x3b8ac6);};}function removeListener(_0x19a7cb,_0x298415){return function(){ChatInteractionEvents[_0xc149('0x4')](_0x19a7cb,_0x298415);};}exports[_0xc149('0x5')]=function(_0x3b5e34){for(var _0x5e9b5c=0x0,_0x578cec=events[_0xc149('0x6')];_0x5e9b5c<_0x578cec;_0x5e9b5c++){var _0x34710e=events[_0x5e9b5c];var _0x3a1739=createListener(_0xc149('0x7')+_0x34710e,_0x3b5e34);ChatInteractionEvents['on'](_0x34710e,_0x3a1739);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 160bdb0..bba2d95 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 _0x6b83=['put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:update'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x6b83,0xdc));var _0x36b8=function(_0x5d73b2,_0x1ea5cd){_0x5d73b2=_0x5d73b2-0x0;var _0x1e4551=_0x6b83[_0x5d73b2];return _0x1e4551;};'use strict';var multer=require(_0x36b8('0x0'));var util=require(_0x36b8('0x1'));var path=require(_0x36b8('0x2'));var timeout=require(_0x36b8('0x3'));var express=require(_0x36b8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36b8('0x5'));var config=require(_0x36b8('0x6'));var controller=require(_0x36b8('0x7'));router[_0x36b8('0x8')]('/',auth[_0x36b8('0x9')](),controller['index']);router[_0x36b8('0x8')](_0x36b8('0xa'),auth[_0x36b8('0x9')](),controller['describe']);router[_0x36b8('0x8')](_0x36b8('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x36b8('0xc')]);router[_0x36b8('0x8')](_0x36b8('0xd'),auth[_0x36b8('0xe')](),controller[_0x36b8('0xf')]);router['get'](_0x36b8('0x10'),auth['isAuthenticated'](),controller[_0x36b8('0x11')]);router[_0x36b8('0x8')](_0x36b8('0x12'),auth[_0x36b8('0xe')](),controller[_0x36b8('0x13')]);router[_0x36b8('0x8')](_0x36b8('0x14'),auth['isAuthenticated'](),controller['download']);router[_0x36b8('0x15')]('/',auth[_0x36b8('0x9')](),controller[_0x36b8('0x16')]);router[_0x36b8('0x15')](_0x36b8('0x17'),auth[_0x36b8('0x9')](),controller[_0x36b8('0x18')]);var upload=multer({'storage':multer[_0x36b8('0x19')]({'destination':function(_0xcb739d,_0x56291b,_0x794662){_0x794662(null,path[_0x36b8('0x1a')](config['root'],_0x36b8('0x1b')));},'filename':function(_0x3cf8c5,_0x2bb171,_0x56064d){_0x56064d(null,util[_0x36b8('0x1c')](_0x36b8('0x1d'),Date[_0x36b8('0x1e')](),_0x2bb171[_0x36b8('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x36b8('0x15')](_0x36b8('0x20'),upload[_0x36b8('0x21')]('file'),controller[_0x36b8('0x22')]);router[_0x36b8('0x15')](_0x36b8('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x36b8('0x23')]);router[_0x36b8('0x15')](_0x36b8('0x24'),auth[_0x36b8('0x9')](),interaction[_0x36b8('0x25')](_0x36b8('0x26'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x36b8('0xb'),auth[_0x36b8('0x9')](),interaction['tracked'](_0x36b8('0x26'),_0x36b8('0x27')),controller['update']);router[_0x36b8('0x28')](_0x36b8('0x29'),controller[_0x36b8('0x2a')]);router['put'](_0x36b8('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x36b8('0x2c')]);router[_0x36b8('0x28')](_0x36b8('0x2d'),controller[_0x36b8('0x2e')]);router[_0x36b8('0x2f')]('/:id',auth['isAuthenticated'](),interaction[_0x36b8('0x25')](_0x36b8('0x26'),_0x36b8('0x30')),controller[_0x36b8('0x31')]);router['delete'](_0x36b8('0x24'),auth[_0x36b8('0x9')](),controller[_0x36b8('0x32')]);module[_0x36b8('0x33')]=router; \ No newline at end of file +var _0xe13f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','%s-%s','now','originalname','replace','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x22c4d7,_0x519ab3){var _0x2345ec=function(_0x320a08){while(--_0x320a08){_0x22c4d7['push'](_0x22c4d7['shift']());}};_0x2345ec(++_0x519ab3);}(_0xe13f,0x1c7));var _0xfe13=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe13f[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xfe13('0x0'));var util=require(_0xfe13('0x1'));var path=require(_0xfe13('0x2'));var timeout=require(_0xfe13('0x3'));var express=require(_0xfe13('0x4'));var router=express[_0xfe13('0x5')]();var fs_extra=require(_0xfe13('0x6'));var auth=require(_0xfe13('0x7'));var interaction=require(_0xfe13('0x8'));var config=require(_0xfe13('0x9'));var controller=require('./chatInteraction.controller');router[_0xfe13('0xa')]('/',auth['isAuthenticated'](),controller[_0xfe13('0xb')]);router['get']('/describe',auth[_0xfe13('0xc')](),controller[_0xfe13('0xd')]);router[_0xfe13('0xa')](_0xfe13('0xe'),auth[_0xfe13('0xf')](),controller[_0xfe13('0x10')]);router['get'](_0xfe13('0x11'),auth[_0xfe13('0xf')](),controller[_0xfe13('0x12')]);router['get'](_0xfe13('0x13'),auth[_0xfe13('0xc')](),controller['getMessages']);router[_0xfe13('0xa')](_0xfe13('0x14'),auth[_0xfe13('0xf')](),controller[_0xfe13('0x15')]);router['get'](_0xfe13('0x16'),auth[_0xfe13('0xc')](),controller['download']);router[_0xfe13('0x17')]('/',auth[_0xfe13('0xc')](),controller['create']);router['post'](_0xfe13('0x18'),auth[_0xfe13('0xc')](),controller[_0xfe13('0x19')]);var upload=multer({'storage':multer[_0xfe13('0x1a')]({'destination':function(_0xe73ff4,_0x4b9efe,_0x32c840){_0x32c840(null,path[_0xfe13('0x1b')](config['root'],'server/files/attachments/'));},'filename':function(_0x56d48a,_0x448d1a,_0x3d0002){_0x3d0002(null,util['format'](_0xfe13('0x1c'),Date[_0xfe13('0x1d')](),_0x448d1a[_0xfe13('0x1e')][_0xfe13('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfe13('0x17')]('/:id/attachment_upload',upload['single'](_0xfe13('0x20')),controller[_0xfe13('0x21')]);router[_0xfe13('0x17')](_0xfe13('0x13'),auth[_0xfe13('0xf')](),controller[_0xfe13('0x22')]);router[_0xfe13('0x17')]('/:id/tags',auth[_0xfe13('0xc')](),interaction[_0xfe13('0x23')](_0xfe13('0x24'),_0xfe13('0x25')),controller[_0xfe13('0x26')]);router[_0xfe13('0x27')](_0xfe13('0xe'),auth[_0xfe13('0xc')](),interaction['tracked'](_0xfe13('0x24'),_0xfe13('0x28')),controller['update']);router['put'](_0xfe13('0x29'),controller[_0xfe13('0x2a')]);router[_0xfe13('0x27')](_0xfe13('0x2b'),auth[_0xfe13('0xf')](),controller['abandon']);router[_0xfe13('0x27')](_0xfe13('0x2c'),controller['close']);router[_0xfe13('0x2d')](_0xfe13('0xe'),auth[_0xfe13('0xc')](),interaction[_0xfe13('0x23')](_0xfe13('0x24'),_0xfe13('0x2e')),controller[_0xfe13('0x2f')]);router[_0xfe13('0x2d')](_0xfe13('0x30'),auth[_0xfe13('0xc')](),controller[_0xfe13('0x31')]);module[_0xfe13('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4ebaa72..a80c4b2 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 _0x82ce=['INTEGER','sequelize','exports'];(function(_0x565f06,_0x3e9246){var _0x351eb2=function(_0x15d052){while(--_0x15d052){_0x565f06['push'](_0x565f06['shift']());}};_0x351eb2(++_0x3e9246);}(_0x82ce,0x106));var _0xe82c=function(_0x337306,_0x4c72e8){_0x337306=_0x337306-0x0;var _0x4cdfa4=_0x82ce[_0x337306];return _0x4cdfa4;};'use strict';var Sequelize=require(_0xe82c('0x0'));module[_0xe82c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe82c('0x2')]}}; \ No newline at end of file +var _0xd624=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x139afd,_0x149c95){var _0x5edee6=function(_0x46b2a7){while(--_0x46b2a7){_0x139afd['push'](_0x139afd['shift']());}};_0x5edee6(++_0x149c95);}(_0xd624,0x1df));var _0x4d62=function(_0x160bbb,_0x566aa9){_0x160bbb=_0x160bbb-0x0;var _0x3e08ee=_0xd624[_0x160bbb];return _0x3e08ee;};'use strict';var Sequelize=require(_0x4d62('0x0'));module['exports']={'body':{'type':Sequelize[_0x4d62('0x1')](_0x4d62('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4d62('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4d62('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 7c261ea..730b5aa 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 _0xa095=['count','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','params','destroy','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','-createdAt','all','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','then','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x382649,_0x35867e){var _0x359910=function(_0x40914d){while(--_0x40914d){_0x382649['push'](_0x382649['shift']());}};_0x359910(++_0x35867e);}(_0xa095,0x92));var _0x5a09=function(_0x449e84,_0x505ae7){_0x449e84=_0x449e84-0x0;var _0x72d311=_0xa095[_0x449e84];return _0x72d311;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a09('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a09('0x1'));var rp=require(_0x5a09('0x2'));var moment=require(_0x5a09('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5a09('0x4'));var util=require('util');var path=require(_0x5a09('0x5'));var sox=require(_0x5a09('0x6'));var csv=require(_0x5a09('0x7'));var ejs=require(_0x5a09('0x8'));var fs=require('fs');var fs_extra=require(_0x5a09('0x9'));var _=require(_0x5a09('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a09('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5a09('0x7'));var querystring=require(_0x5a09('0xc'));var Papa=require(_0x5a09('0xd'));var Redis=require(_0x5a09('0xe'));var authService=require(_0x5a09('0xf'));var qs=require(_0x5a09('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a09('0x11'));var logger=require(_0x5a09('0x12'))(_0x5a09('0x13'));var utils=require('../../config/utils');var config=require(_0x5a09('0x14'));var licenseUtil=require(_0x5a09('0x15'));var db=require('../../mysqldb')['db'];config[_0x5a09('0x16')]=_[_0x5a09('0x17')](config[_0x5a09('0x16')],{'host':_0x5a09('0x18'),'port':0x18eb});var socket=require(_0x5a09('0x19'))(new Redis(config['redis']));require(_0x5a09('0x1a'))['register'](socket);function respondWithStatusCode(_0x503ed3,_0x70c737){_0x70c737=_0x70c737||0xcc;return function(_0x177afe){if(_0x177afe){return _0x503ed3[_0x5a09('0x1b')](_0x70c737);}return _0x503ed3[_0x5a09('0x1c')](_0x70c737)[_0x5a09('0x1d')]();};}function respondWithResult(_0xb0ec6b,_0x407baa){_0x407baa=_0x407baa||0xc8;return function(_0x2e7d23){if(_0x2e7d23){return _0xb0ec6b['status'](_0x407baa)[_0x5a09('0x1e')](_0x2e7d23);}};}function respondWithFilteredResult(_0x2f1f4d,_0xe4137a){return function(_0x52de0a){if(_0x52de0a){var _0x166d0d=typeof _0xe4137a[_0x5a09('0x1f')]==='undefined'&&typeof _0xe4137a[_0x5a09('0x20')]===_0x5a09('0x21');var _0x225437=_0x52de0a['count'];var _0x267a05=_0x166d0d?0x0:_0xe4137a['offset'];var _0x10259a=_0x166d0d?_0x52de0a['count']:_0xe4137a[_0x5a09('0x1f')]+_0xe4137a[_0x5a09('0x20')];var _0x594501;if(_0x10259a>=_0x225437){_0x10259a=_0x225437;_0x594501=0xc8;}else{_0x594501=0xce;}_0x2f1f4d[_0x5a09('0x1c')](_0x594501);return _0x2f1f4d[_0x5a09('0x22')]('Content-Range',_0x267a05+'-'+_0x10259a+'/'+_0x225437)[_0x5a09('0x1e')](_0x52de0a);}return null;};}function patchUpdates(_0x9ec7ec){return function(_0x1135f4){try{jsonpatch[_0x5a09('0x23')](_0x1135f4,_0x9ec7ec,!![]);}catch(_0x3d29db){return BPromise[_0x5a09('0x24')](_0x3d29db);}return _0x1135f4[_0x5a09('0x25')]();};}function saveUpdates(_0x15c45f,_0x43678f){return function(_0x14b017){if(_0x14b017){return _0x14b017['update'](_0x15c45f)[_0x5a09('0x26')](function(_0x21bb1c){return _0x21bb1c;});}return null;};}function removeEntity(_0x30ec8a,_0x14b217){return function(_0x592238){if(_0x592238){return _0x592238['destroy']()[_0x5a09('0x26')](function(){_0x30ec8a[_0x5a09('0x1c')](0xcc)[_0x5a09('0x1d')]();});}};}function handleEntityNotFound(_0x3a99a8,_0x3b8e12){return function(_0x525e70){if(!_0x525e70){_0x3a99a8[_0x5a09('0x1b')](0x194);}return _0x525e70;};}function handleError(_0x270264,_0x42d355){_0x42d355=_0x42d355||0x1f4;return function(_0x4cea0c){logger[_0x5a09('0x27')](_0x4cea0c[_0x5a09('0x28')]);if(_0x4cea0c[_0x5a09('0x29')]){delete _0x4cea0c[_0x5a09('0x29')];}_0x270264['status'](_0x42d355)[_0x5a09('0x2a')](_0x4cea0c);};}exports['index']=function(_0x2a1a1b,_0x597ffc){var _0xb0edec={},_0x156c66={},_0x430da7={'count':0x0,'rows':[]};var _0x32bc94=_[_0x5a09('0x2b')](db[_0x5a09('0x2c')]['rawAttributes'],function(_0x3675db){return{'name':_0x3675db[_0x5a09('0x2d')],'type':_0x3675db[_0x5a09('0x2e')][_0x5a09('0x2f')]};});_0x156c66[_0x5a09('0x30')]=_[_0x5a09('0x2b')](_0x32bc94,_0x5a09('0x29'));_0x156c66[_0x5a09('0x31')]=_[_0x5a09('0x32')](_0x2a1a1b['query']);_0x156c66[_0x5a09('0x33')]=_[_0x5a09('0x34')](_0x156c66[_0x5a09('0x30')],_0x156c66[_0x5a09('0x31')]);_0xb0edec['attributes']=_[_0x5a09('0x34')](_0x156c66[_0x5a09('0x30')],qs[_0x5a09('0x35')](_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x35')]));_0xb0edec['attributes']=_0xb0edec[_0x5a09('0x36')][_0x5a09('0x37')]?_0xb0edec[_0x5a09('0x36')]:_0x156c66[_0x5a09('0x30')];if(!_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x38')](_0x5a09('0x39'))){_0xb0edec[_0x5a09('0x20')]=qs[_0x5a09('0x20')](_0x2a1a1b[_0x5a09('0x31')]['limit']);_0xb0edec[_0x5a09('0x1f')]=qs['offset'](_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x1f')]);}_0xb0edec[_0x5a09('0x3a')]=qs[_0x5a09('0x3b')](_0x2a1a1b['query'][_0x5a09('0x3b')]);_0xb0edec[_0x5a09('0x3c')]=qs[_0x5a09('0x33')](_['pick'](_0x2a1a1b[_0x5a09('0x31')],_0x156c66['filters']),_0x32bc94);if(_0x2a1a1b['query'][_0x5a09('0x3d')]){_0xb0edec[_0x5a09('0x3c')]=_[_0x5a09('0x3e')](_0xb0edec[_0x5a09('0x3c')],{'$or':_[_0x5a09('0x2b')](_0x32bc94,function(_0x183a0b){if(_0x183a0b[_0x5a09('0x2e')]!==_0x5a09('0x3f')){var _0x21b5c8={};_0x21b5c8[_0x183a0b[_0x5a09('0x29')]]={'$like':'%'+_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x3d')]+'%'};return _0x21b5c8;}})});}_0xb0edec=_[_0x5a09('0x3e')]({},_0xb0edec,_0x2a1a1b['options']);var _0x5d9b87={'where':_0xb0edec[_0x5a09('0x3c')]};return db[_0x5a09('0x2c')][_0x5a09('0x40')](_0x5d9b87)[_0x5a09('0x26')](function(_0xd69f9f){_0x430da7['count']=_0xd69f9f;if(_0x2a1a1b[_0x5a09('0x31')][_0x5a09('0x41')]){_0xb0edec['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5a09('0x42')](_0xb0edec);})['then'](function(_0x1b5997){_0x430da7[_0x5a09('0x43')]=_0x1b5997;return _0x430da7;})[_0x5a09('0x26')](respondWithFilteredResult(_0x597ffc,_0xb0edec))[_0x5a09('0x44')](handleError(_0x597ffc,null));};exports['show']=function(_0x35b90f,_0x30e036){var _0xcaecc6={'raw':!![],'where':{'id':_0x35b90f['params']['id']}},_0x33d2a2={};_0x33d2a2[_0x5a09('0x30')]=_[_0x5a09('0x32')](db[_0x5a09('0x2c')][_0x5a09('0x45')]);_0x33d2a2[_0x5a09('0x31')]=_[_0x5a09('0x32')](_0x35b90f[_0x5a09('0x31')]);_0x33d2a2['filters']=_[_0x5a09('0x34')](_0x33d2a2[_0x5a09('0x30')],_0x33d2a2[_0x5a09('0x31')]);_0xcaecc6[_0x5a09('0x36')]=_['intersection'](_0x33d2a2[_0x5a09('0x30')],qs[_0x5a09('0x35')](_0x35b90f[_0x5a09('0x31')][_0x5a09('0x35')]));_0xcaecc6[_0x5a09('0x36')]=_0xcaecc6[_0x5a09('0x36')][_0x5a09('0x37')]?_0xcaecc6[_0x5a09('0x36')]:_0x33d2a2[_0x5a09('0x30')];if(_0x35b90f[_0x5a09('0x31')]['includeAll']){_0xcaecc6[_0x5a09('0x46')]=[{'all':!![]}];}_0xcaecc6=_[_0x5a09('0x3e')]({},_0xcaecc6,_0x35b90f['options']);return db['ChatInternalMessage'][_0x5a09('0x47')](_0xcaecc6)[_0x5a09('0x26')](handleEntityNotFound(_0x30e036,null))['then'](respondWithResult(_0x30e036,null))['catch'](handleError(_0x30e036,null));};exports[_0x5a09('0x48')]=function(_0x232e2f,_0x2415f0){return db[_0x5a09('0x2c')][_0x5a09('0x48')](_0x232e2f['body'],{})[_0x5a09('0x26')](respondWithResult(_0x2415f0,0xc9))['catch'](handleError(_0x2415f0,null));};exports['update']=function(_0x5399ce,_0x2611b3){if(_0x5399ce['body']['id']){delete _0x5399ce[_0x5a09('0x49')]['id'];}return db[_0x5a09('0x2c')][_0x5a09('0x47')]({'where':{'id':_0x5399ce[_0x5a09('0x4a')]['id']}})[_0x5a09('0x26')](handleEntityNotFound(_0x2611b3,null))[_0x5a09('0x26')](saveUpdates(_0x5399ce[_0x5a09('0x49')],null))[_0x5a09('0x26')](respondWithResult(_0x2611b3,null))['catch'](handleError(_0x2611b3,null));};exports[_0x5a09('0x4b')]=function(_0x4259f0,_0x4d10a2){return db[_0x5a09('0x2c')]['find']({'where':{'id':_0x4259f0['params']['id']}})[_0x5a09('0x26')](handleEntityNotFound(_0x4d10a2,null))[_0x5a09('0x26')](removeEntity(_0x4d10a2,null))[_0x5a09('0x44')](handleError(_0x4d10a2,null));};exports[_0x5a09('0x4c')]=function(_0x25b741,_0x508091){return db[_0x5a09('0x2c')][_0x5a09('0x4c')]()[_0x5a09('0x26')](respondWithResult(_0x508091,null))[_0x5a09('0x44')](handleError(_0x508091,null));};function wrapUser(_0x55b1f0){return function(_0x534caf){var _0x5dc435=_0x55b1f0['get']({'plain':!![]});_0x5dc435[_0x5a09('0x4d')]=[];if(_0x534caf){_0x5dc435['lastMessageAt']=_0x534caf[_0x5a09('0x4e')];_0x5dc435[_0x5a09('0x4f')]=_0x534caf;}else{_0x5dc435[_0x5a09('0x50')]=moment(0x0)['format'](_0x5a09('0x51'));_0x5dc435['lastMessage']={};}return _0x5dc435;};}exports[_0x5a09('0x52')]=function(_0x3214ac,_0x24f703,_0xd3eb21){var _0x535ccc=[];return db[_0x5a09('0x53')][_0x5a09('0x42')]({'where':{'role':['agent','admin',_0x5a09('0x54')]},'attributes':['id',_0x5a09('0x55'),_0x5a09('0x29'),_0x5a09('0x56'),_0x5a09('0x57'),_0x5a09('0x58'),'online',_0x5a09('0x59'),_0x5a09('0x5a'),_0x5a09('0x5b')],'order':qs[_0x5a09('0x3b')]('-online'),'include':[{'model':db[_0x5a09('0x5c')],'as':'VoiceQueues','attributes':['id',_0x5a09('0x29'),_0x5a09('0x2e')],'through':{'attributes':[]}}]})[_0x5a09('0x26')](function(_0x496774){if(_0x496774){var _0x513fcc=_0x3214ac[_0x5a09('0x54')]['get']({'plain':!![]});if(!_0x513fcc)throw new Error(_0x5a09('0x5d'));if(_0x513fcc[_0x5a09('0x56')]===_0x5a09('0x54')){return db['UserProfileSection']['find']({'where':{'name':_0x5a09('0x5e'),'userProfileId':_0x513fcc[_0x5a09('0x5f')]},'raw':!![]})[_0x5a09('0x26')](function(_0x4635e8){if(_0x4635e8){if(_0x4635e8[_0x5a09('0x60')]===0x0){return db[_0x5a09('0x61')]['findAll']({'where':{'sectionId':_0x4635e8['id']},'raw':!![]})[_0x5a09('0x26')](function(_0x106122){var _0x1935bc=[];if(_[_0x5a09('0x62')](_0x106122)){_0x1935bc=_['filter'](_0x496774,function(_0x33fda9){if(_0x33fda9[_0x5a09('0x56')]!=='agent'){return _0x33fda9;}});return _0x1935bc;}else{for(var _0x12f807=0x0;_0x12f807<_0x496774[_0x5a09('0x37')];_0x12f807++){var _0x460187=_0x496774[_0x12f807];if(_0x460187['role']===_0x5a09('0x63')){var _0x53099e=_[_0x5a09('0x47')](_0x106122,function(_0x5679b4){return _0x5679b4[_0x5a09('0x64')]===_0x460187['id'];});if(_0x53099e)_0x1935bc[_0x5a09('0x65')](_0x460187);}else{_0x1935bc[_0x5a09('0x65')](_0x460187);}}return _0x1935bc;}});}else{return _0x496774;}}else{var _0x423c68=_[_0x5a09('0x3d')](_0x496774,function(_0x1403d6){if(_0x1403d6[_0x5a09('0x56')]!==_0x5a09('0x63')){return _0x1403d6;}});return _0x423c68;}});}else{return _0x496774;}}})[_0x5a09('0x26')](function(_0xb2f805){var _0x226435=[];if(_0xb2f805){_0x535ccc=_0xb2f805;for(var _0x4a0fad=0x0;_0x4a0fad<_0xb2f805[_0x5a09('0x37')];_0x4a0fad+=0x1){_0x535ccc[_0x4a0fad][_0x5a09('0x4d')]=[];_0x226435[_0x5a09('0x65')](db[_0x5a09('0x2c')][_0x5a09('0x47')]({'where':{'FromId':[_0x3214ac['user']['id'],_0xb2f805[_0x4a0fad]['id']],'ToId':[_0x3214ac[_0x5a09('0x54')]['id'],_0xb2f805[_0x4a0fad]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x5a09('0x66'),'ToId','read',_0x5a09('0x49')],'order':qs[_0x5a09('0x3b')](_0x5a09('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5a09('0x26')](wrapUser(_0xb2f805[_0x4a0fad])));}return BPromise[_0x5a09('0x68')](_0x226435);}return[];})[_0x5a09('0x26')](function(_0x1eddd0){return{'rows':_0x1eddd0,'count':_0x1eddd0['length']};})['then'](respondWithResult(_0x24f703,null))[_0x5a09('0x44')](handleError(_0x24f703,null));}; \ No newline at end of file +var _0x534c=['nolimit','limit','order','sort','where','pick','filter','merge','map','type','includeAll','include','ChatInternalMessage','findAll','rows','catch','keys','create','update','body','find','params','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','length','FromId','ToId','read','-createdAt','all','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','destroy','then','error','name','index','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','fields','hasOwnProperty'];(function(_0x6b888e,_0x420fed){var _0x17d0f6=function(_0x42675a){while(--_0x42675a){_0x6b888e['push'](_0x6b888e['shift']());}};_0x17d0f6(++_0x420fed);}(_0x534c,0xa5));var _0xc534=function(_0x3642ab,_0x8a4456){_0x3642ab=_0x3642ab-0x0;var _0x5663e8=_0x534c[_0x3642ab];return _0x5663e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc534('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc534('0x1'));var moment=require(_0xc534('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc534('0x3'));var util=require(_0xc534('0x4'));var path=require(_0xc534('0x5'));var sox=require(_0xc534('0x6'));var csv=require('to-csv');var ejs=require(_0xc534('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc534('0x8'));var squel=require('squel');var crypto=require(_0xc534('0x9'));var jsforce=require(_0xc534('0xa'));var deskjs=require(_0xc534('0xb'));var toCsv=require(_0xc534('0xc'));var querystring=require('querystring');var Papa=require(_0xc534('0xd'));var Redis=require('ioredis');var authService=require(_0xc534('0xe'));var qs=require(_0xc534('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc534('0x10'));var logger=require(_0xc534('0x11'))(_0xc534('0x12'));var utils=require(_0xc534('0x13'));var config=require(_0xc534('0x14'));var licenseUtil=require(_0xc534('0x15'));var db=require('../../mysqldb')['db'];config[_0xc534('0x16')]=_['defaults'](config[_0xc534('0x16')],{'host':_0xc534('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc534('0x16')]));require(_0xc534('0x18'))[_0xc534('0x19')](socket);function respondWithStatusCode(_0x1b40a5,_0x21a559){_0x21a559=_0x21a559||0xcc;return function(_0x1662fc){if(_0x1662fc){return _0x1b40a5[_0xc534('0x1a')](_0x21a559);}return _0x1b40a5['status'](_0x21a559)[_0xc534('0x1b')]();};}function respondWithResult(_0x13bd79,_0x408de0){_0x408de0=_0x408de0||0xc8;return function(_0x2a6615){if(_0x2a6615){return _0x13bd79[_0xc534('0x1c')](_0x408de0)[_0xc534('0x1d')](_0x2a6615);}};}function respondWithFilteredResult(_0x40d417,_0x5c8cd5){return function(_0x4838c9){if(_0x4838c9){var _0x1cbcad=typeof _0x5c8cd5[_0xc534('0x1e')]===_0xc534('0x1f')&&typeof _0x5c8cd5['limit']==='undefined';var _0xd85978=_0x4838c9['count'];var _0x449eaa=_0x1cbcad?0x0:_0x5c8cd5['offset'];var _0x419c54=_0x1cbcad?_0x4838c9[_0xc534('0x20')]:_0x5c8cd5['offset']+_0x5c8cd5['limit'];var _0xa247eb;if(_0x419c54>=_0xd85978){_0x419c54=_0xd85978;_0xa247eb=0xc8;}else{_0xa247eb=0xce;}_0x40d417[_0xc534('0x1c')](_0xa247eb);return _0x40d417['set'](_0xc534('0x21'),_0x449eaa+'-'+_0x419c54+'/'+_0xd85978)[_0xc534('0x1d')](_0x4838c9);}return null;};}function patchUpdates(_0x1b80f5){return function(_0x10f0b2){try{jsonpatch[_0xc534('0x22')](_0x10f0b2,_0x1b80f5,!![]);}catch(_0x382131){return BPromise[_0xc534('0x23')](_0x382131);}return _0x10f0b2['save']();};}function saveUpdates(_0x5e6caf,_0x341262){return function(_0x2de5c1){if(_0x2de5c1){return _0x2de5c1['update'](_0x5e6caf)['then'](function(_0x3f155b){return _0x3f155b;});}return null;};}function removeEntity(_0x4b0909,_0x57d16b){return function(_0x39c859){if(_0x39c859){return _0x39c859[_0xc534('0x24')]()[_0xc534('0x25')](function(){_0x4b0909[_0xc534('0x1c')](0xcc)[_0xc534('0x1b')]();});}};}function handleEntityNotFound(_0x21e7fb,_0x216088){return function(_0x58edf4){if(!_0x58edf4){_0x21e7fb[_0xc534('0x1a')](0x194);}return _0x58edf4;};}function handleError(_0x385475,_0x4c9676){_0x4c9676=_0x4c9676||0x1f4;return function(_0x228f26){logger[_0xc534('0x26')](_0x228f26['stack']);if(_0x228f26[_0xc534('0x27')]){delete _0x228f26[_0xc534('0x27')];}_0x385475[_0xc534('0x1c')](_0x4c9676)['send'](_0x228f26);};}exports[_0xc534('0x28')]=function(_0x401997,_0x3e6bb6){var _0x2be6bb={},_0x17dedc={},_0x373ede={'count':0x0,'rows':[]};var _0x191308=_['map'](db['ChatInternalMessage'][_0xc534('0x29')],function(_0x31b8c2){return{'name':_0x31b8c2[_0xc534('0x2a')],'type':_0x31b8c2['type'][_0xc534('0x2b')]};});_0x17dedc['model']=_['map'](_0x191308,_0xc534('0x27'));_0x17dedc['query']=_['keys'](_0x401997['query']);_0x17dedc[_0xc534('0x2c')]=_[_0xc534('0x2d')](_0x17dedc[_0xc534('0x2e')],_0x17dedc[_0xc534('0x2f')]);_0x2be6bb[_0xc534('0x30')]=_[_0xc534('0x2d')](_0x17dedc['model'],qs['fields'](_0x401997[_0xc534('0x2f')][_0xc534('0x31')]));_0x2be6bb[_0xc534('0x30')]=_0x2be6bb[_0xc534('0x30')]['length']?_0x2be6bb[_0xc534('0x30')]:_0x17dedc[_0xc534('0x2e')];if(!_0x401997[_0xc534('0x2f')][_0xc534('0x32')](_0xc534('0x33'))){_0x2be6bb[_0xc534('0x34')]=qs['limit'](_0x401997[_0xc534('0x2f')][_0xc534('0x34')]);_0x2be6bb[_0xc534('0x1e')]=qs[_0xc534('0x1e')](_0x401997[_0xc534('0x2f')]['offset']);}_0x2be6bb[_0xc534('0x35')]=qs[_0xc534('0x36')](_0x401997['query'][_0xc534('0x36')]);_0x2be6bb[_0xc534('0x37')]=qs[_0xc534('0x2c')](_[_0xc534('0x38')](_0x401997[_0xc534('0x2f')],_0x17dedc[_0xc534('0x2c')]),_0x191308);if(_0x401997[_0xc534('0x2f')][_0xc534('0x39')]){_0x2be6bb[_0xc534('0x37')]=_[_0xc534('0x3a')](_0x2be6bb[_0xc534('0x37')],{'$or':_[_0xc534('0x3b')](_0x191308,function(_0xa56158){if(_0xa56158[_0xc534('0x3c')]!=='VIRTUAL'){var _0x4c443e={};_0x4c443e[_0xa56158[_0xc534('0x27')]]={'$like':'%'+_0x401997['query'][_0xc534('0x39')]+'%'};return _0x4c443e;}})});}_0x2be6bb=_[_0xc534('0x3a')]({},_0x2be6bb,_0x401997['options']);var _0x5f4ed8={'where':_0x2be6bb[_0xc534('0x37')]};return db['ChatInternalMessage'][_0xc534('0x20')](_0x5f4ed8)['then'](function(_0x2e775f){_0x373ede[_0xc534('0x20')]=_0x2e775f;if(_0x401997[_0xc534('0x2f')][_0xc534('0x3d')]){_0x2be6bb[_0xc534('0x3e')]=[{'all':!![]}];}return db[_0xc534('0x3f')][_0xc534('0x40')](_0x2be6bb);})[_0xc534('0x25')](function(_0x2e7e92){_0x373ede[_0xc534('0x41')]=_0x2e7e92;return _0x373ede;})[_0xc534('0x25')](respondWithFilteredResult(_0x3e6bb6,_0x2be6bb))[_0xc534('0x42')](handleError(_0x3e6bb6,null));};exports['show']=function(_0x21533b,_0x12d50d){var _0xf1464e={'raw':!![],'where':{'id':_0x21533b['params']['id']}},_0x27a835={};_0x27a835[_0xc534('0x2e')]=_[_0xc534('0x43')](db[_0xc534('0x3f')]['rawAttributes']);_0x27a835[_0xc534('0x2f')]=_[_0xc534('0x43')](_0x21533b[_0xc534('0x2f')]);_0x27a835[_0xc534('0x2c')]=_['intersection'](_0x27a835[_0xc534('0x2e')],_0x27a835[_0xc534('0x2f')]);_0xf1464e[_0xc534('0x30')]=_[_0xc534('0x2d')](_0x27a835['model'],qs[_0xc534('0x31')](_0x21533b['query'][_0xc534('0x31')]));_0xf1464e[_0xc534('0x30')]=_0xf1464e['attributes']['length']?_0xf1464e[_0xc534('0x30')]:_0x27a835['model'];if(_0x21533b[_0xc534('0x2f')][_0xc534('0x3d')]){_0xf1464e[_0xc534('0x3e')]=[{'all':!![]}];}_0xf1464e=_[_0xc534('0x3a')]({},_0xf1464e,_0x21533b['options']);return db[_0xc534('0x3f')]['find'](_0xf1464e)[_0xc534('0x25')](handleEntityNotFound(_0x12d50d,null))[_0xc534('0x25')](respondWithResult(_0x12d50d,null))['catch'](handleError(_0x12d50d,null));};exports[_0xc534('0x44')]=function(_0x5bebf9,_0x16b463){return db['ChatInternalMessage'][_0xc534('0x44')](_0x5bebf9['body'],{})[_0xc534('0x25')](respondWithResult(_0x16b463,0xc9))[_0xc534('0x42')](handleError(_0x16b463,null));};exports[_0xc534('0x45')]=function(_0x3427bf,_0x1fbc48){if(_0x3427bf[_0xc534('0x46')]['id']){delete _0x3427bf[_0xc534('0x46')]['id'];}return db[_0xc534('0x3f')][_0xc534('0x47')]({'where':{'id':_0x3427bf[_0xc534('0x48')]['id']}})[_0xc534('0x25')](handleEntityNotFound(_0x1fbc48,null))[_0xc534('0x25')](saveUpdates(_0x3427bf[_0xc534('0x46')],null))['then'](respondWithResult(_0x1fbc48,null))[_0xc534('0x42')](handleError(_0x1fbc48,null));};exports[_0xc534('0x24')]=function(_0x22cccc,_0x50f2b3){return db[_0xc534('0x3f')]['find']({'where':{'id':_0x22cccc[_0xc534('0x48')]['id']}})[_0xc534('0x25')](handleEntityNotFound(_0x50f2b3,null))[_0xc534('0x25')](removeEntity(_0x50f2b3,null))[_0xc534('0x42')](handleError(_0x50f2b3,null));};exports[_0xc534('0x49')]=function(_0x206294,_0x26fcf4){return db[_0xc534('0x3f')][_0xc534('0x49')]()['then'](respondWithResult(_0x26fcf4,null))['catch'](handleError(_0x26fcf4,null));};function wrapUser(_0x6529b4){return function(_0x70775c){var _0x4e8250=_0x6529b4[_0xc534('0x4a')]({'plain':!![]});_0x4e8250[_0xc534('0x4b')]=[];if(_0x70775c){_0x4e8250[_0xc534('0x4c')]=_0x70775c[_0xc534('0x4d')];_0x4e8250['lastMessage']=_0x70775c;}else{_0x4e8250['lastMessageAt']=moment(0x0)[_0xc534('0x4e')](_0xc534('0x4f'));_0x4e8250[_0xc534('0x50')]={};}return _0x4e8250;};}exports['getUsers']=function(_0x15738b,_0xbbfb8d,_0x160cba){var _0x86fe8c=[];return db[_0xc534('0x51')][_0xc534('0x40')]({'where':{'role':['agent',_0xc534('0x52'),_0xc534('0x53')]},'attributes':['id',_0xc534('0x54'),_0xc534('0x27'),'role',_0xc534('0x55'),_0xc534('0x56'),_0xc534('0x57'),_0xc534('0x58'),_0xc534('0x59'),'showWebBar'],'order':qs['sort'](_0xc534('0x5a')),'include':[{'model':db[_0xc534('0x5b')],'as':_0xc534('0x5c'),'attributes':['id',_0xc534('0x27'),'type'],'through':{'attributes':[]}}]})[_0xc534('0x25')](function(_0x3c06e8){if(_0x3c06e8){var _0x1f3d38=_0x15738b[_0xc534('0x53')][_0xc534('0x4a')]({'plain':!![]});if(!_0x1f3d38)throw new Error(_0xc534('0x5d'));if(_0x1f3d38[_0xc534('0x5e')]===_0xc534('0x53')){return db[_0xc534('0x5f')][_0xc534('0x47')]({'where':{'name':_0xc534('0x60'),'userProfileId':_0x1f3d38[_0xc534('0x61')]},'raw':!![]})[_0xc534('0x25')](function(_0x5be14c){if(_0x5be14c){if(_0x5be14c[_0xc534('0x62')]===0x0){return db[_0xc534('0x63')]['findAll']({'where':{'sectionId':_0x5be14c['id']},'raw':!![]})[_0xc534('0x25')](function(_0x22df9e){var _0x2da731=[];if(_[_0xc534('0x64')](_0x22df9e)){_0x2da731=_['filter'](_0x3c06e8,function(_0x43a909){if(_0x43a909[_0xc534('0x5e')]!==_0xc534('0x65')){return _0x43a909;}});return _0x2da731;}else{for(var _0x596f43=0x0;_0x596f43<_0x3c06e8[_0xc534('0x66')];_0x596f43++){var _0x5d93c6=_0x3c06e8[_0x596f43];if(_0x5d93c6[_0xc534('0x5e')]===_0xc534('0x65')){var _0x1ac2c6=_['find'](_0x22df9e,function(_0x563664){return _0x563664['resourceId']===_0x5d93c6['id'];});if(_0x1ac2c6)_0x2da731['push'](_0x5d93c6);}else{_0x2da731['push'](_0x5d93c6);}}return _0x2da731;}});}else{return _0x3c06e8;}}else{var _0x325202=_[_0xc534('0x39')](_0x3c06e8,function(_0x2c9d8e){if(_0x2c9d8e['role']!=='agent'){return _0x2c9d8e;}});return _0x325202;}});}else{return _0x3c06e8;}}})['then'](function(_0x28a4d0){var _0xced9ee=[];if(_0x28a4d0){_0x86fe8c=_0x28a4d0;for(var _0x49fb1c=0x0;_0x49fb1c<_0x28a4d0[_0xc534('0x66')];_0x49fb1c+=0x1){_0x86fe8c[_0x49fb1c][_0xc534('0x4b')]=[];_0xced9ee['push'](db['ChatInternalMessage'][_0xc534('0x47')]({'where':{'FromId':[_0x15738b[_0xc534('0x53')]['id'],_0x28a4d0[_0x49fb1c]['id']],'ToId':[_0x15738b[_0xc534('0x53')]['id'],_0x28a4d0[_0x49fb1c]['id']],'ChatGroupId':null},'attributes':['id',_0xc534('0x4d'),_0xc534('0x67'),_0xc534('0x68'),_0xc534('0x69'),_0xc534('0x46')],'order':qs[_0xc534('0x36')](_0xc534('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc534('0x25')](wrapUser(_0x28a4d0[_0x49fb1c])));}return BPromise[_0xc534('0x6b')](_0xced9ee);}return[];})['then'](function(_0x491d4e){return{'rows':_0x491d4e,'count':_0x491d4e['length']};})['then'](respondWithResult(_0xbbfb8d,null))['catch'](handleError(_0xbbfb8d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 21c7b07..ce93e0f 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 _0x3525=['emit','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x3a8697,_0x15a965){var _0x1da8d5=function(_0x314035){while(--_0x314035){_0x3a8697['push'](_0x3a8697['shift']());}};_0x1da8d5(++_0x15a965);}(_0x3525,0x16a));var _0x5352=function(_0x6453b,_0xd44754){_0x6453b=_0x6453b-0x0;var _0x2fd18c=_0x3525[_0x6453b];return _0x2fd18c;};'use strict';var EventEmitter=require(_0x5352('0x0'));var ChatInternalMessage=require(_0x5352('0x1'))['db'][_0x5352('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5352('0x3')](0x0);var events={'afterCreate':_0x5352('0x4'),'afterUpdate':_0x5352('0x5'),'afterDestroy':_0x5352('0x6')};function emitEvent(_0x1301b9){return function(_0x39492b,_0x537148,_0x3ef38d){ChatInternalMessageEvents[_0x5352('0x7')](_0x1301b9+':'+_0x39492b['id'],_0x39492b);ChatInternalMessageEvents[_0x5352('0x7')](_0x1301b9,_0x39492b);_0x3ef38d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x5352('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb4e4=['exports','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb4e4,0x119));var _0x4b4e=function(_0x403b76,_0x59be57){_0x403b76=_0x403b76-0x0;var _0x587d3b=_0xb4e4[_0x403b76];return _0x587d3b;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x4b4e('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4b4e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b4e('0x2'),'afterDestroy':_0x4b4e('0x3')};function emitEvent(_0x8eeddd){return function(_0x5a5adc,_0xc0fb91,_0xb84768){ChatInternalMessageEvents['emit'](_0x8eeddd+':'+_0x5a5adc['id'],_0x5a5adc);ChatInternalMessageEvents[_0x4b4e('0x4')](_0x8eeddd,_0x5a5adc);_0xb84768(null);};}for(var e in events){if(events[_0x4b4e('0x5')](e)){var event=events[e];ChatInternalMessage[_0x4b4e('0x6')](e,emitEvent(event));}}module[_0x4b4e('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5aff0b5..38a1e13 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 _0x5ab7=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes'];(function(_0x13c2d1,_0x14355e){var _0x3d1651=function(_0x271341){while(--_0x271341){_0x13c2d1['push'](_0x13c2d1['shift']());}};_0x3d1651(++_0x14355e);}(_0x5ab7,0x1bf));var _0x75ab=function(_0x4f6d01,_0x4d9f26){_0x4f6d01=_0x4f6d01-0x0;var _0x392f88=_0x5ab7[_0x4f6d01];return _0x392f88;};'use strict';var _=require(_0x75ab('0x0'));var util=require(_0x75ab('0x1'));var logger=require(_0x75ab('0x2'))(_0x75ab('0x3'));var moment=require('moment');var BPromise=require(_0x75ab('0x4'));var rp=require(_0x75ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x75ab('0x6'));var attributes=require(_0x75ab('0x7'));module[_0x75ab('0x8')]=function(_0x343554,_0x4da861){return _0x343554['define'](_0x75ab('0x9'),attributes,{'tableName':_0x75ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75ab('0xb'),'collate':_0x75ab('0xc')});}; \ No newline at end of file +var _0x14db=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14db,0x10d));var _0xb14d=function(_0x5307e5,_0x1de6c7){_0x5307e5=_0x5307e5-0x0;var _0x2c1210=_0x14db[_0x5307e5];return _0x2c1210;};'use strict';var _=require(_0xb14d('0x0'));var util=require(_0xb14d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb14d('0x2'));var BPromise=require(_0xb14d('0x3'));var rp=require(_0xb14d('0x4'));var fs=require('fs');var path=require(_0xb14d('0x5'));var rimraf=require(_0xb14d('0x6'));var config=require(_0xb14d('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xb14d('0x8')]=function(_0x35a677,_0x5b7739){return _0x35a677[_0xb14d('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 816006e..fcddd0b 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 _0xe07c=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xda0f1a,_0x42d7f6){var _0x1b8e0c=function(_0x17b3fc){while(--_0x17b3fc){_0xda0f1a['push'](_0xda0f1a['shift']());}};_0x1b8e0c(++_0x42d7f6);}(_0xe07c,0x1f3));var _0xce07=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xe07c[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xce07('0x0'));var util=require(_0xce07('0x1'));var moment=require(_0xce07('0x2'));var BPromise=require(_0xce07('0x3'));var rs=require(_0xce07('0x4'));var fs=require('fs');var Redis=require(_0xce07('0x5'));var db=require(_0xce07('0x6'))['db'];var utils=require(_0xce07('0x7'));var logger=require('../../config/logger')(_0xce07('0x8'));var config=require(_0xce07('0x9'));var jayson=require(_0xce07('0xa'));var client=jayson[_0xce07('0xb')][_0xce07('0xc')]({'port':0x232a});config[_0xce07('0xd')]=_[_0xce07('0xe')](config[_0xce07('0xd')],{'host':_0xce07('0xf'),'port':0x18eb});var socket=require(_0xce07('0x10'))(new Redis(config[_0xce07('0xd')]));require(_0xce07('0x11'))[_0xce07('0x12')](socket);function respondWithRpcPromise(_0x640036,_0x1841c8,_0x140c3e){return new BPromise(function(_0x57d108,_0x33cb49){return client[_0xce07('0x13')](_0x640036,_0x140c3e)[_0xce07('0x14')](function(_0x510afd){logger[_0xce07('0x15')](_0xce07('0x16'),_0x1841c8,_0xce07('0x17'));logger[_0xce07('0x18')](_0xce07('0x19'),_0x1841c8,'request\x20sent',JSON[_0xce07('0x1a')](_0x510afd));if(_0x510afd[_0xce07('0x1b')]){if(_0x510afd[_0xce07('0x1b')][_0xce07('0x1c')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1841c8,_0x510afd[_0xce07('0x1b')][_0xce07('0x1d')]);return _0x33cb49(_0x510afd['error'][_0xce07('0x1d')]);}logger[_0xce07('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x1841c8,_0x510afd['error'][_0xce07('0x1d')]);return _0x57d108(_0x510afd[_0xce07('0x1b')][_0xce07('0x1d')]);}else{logger['info'](_0xce07('0x16'),_0x1841c8,_0xce07('0x17'));_0x57d108(_0x510afd['result']['message']);}})[_0xce07('0x1e')](function(_0x20df84){logger[_0xce07('0x1b')](_0xce07('0x16'),_0x1841c8,_0x20df84);_0x33cb49(_0x20df84);});});} \ No newline at end of file +var _0xb8d9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x358639,_0x1a54b1){var _0x48733c=function(_0x25a801){while(--_0x25a801){_0x358639['push'](_0x358639['shift']());}};_0x48733c(++_0x1a54b1);}(_0xb8d9,0x175));var _0x9b8d=function(_0x59ad4a,_0x1f7617){_0x59ad4a=_0x59ad4a-0x0;var _0x36c834=_0xb8d9[_0x59ad4a];return _0x36c834;};'use strict';var _=require(_0x9b8d('0x0'));var util=require(_0x9b8d('0x1'));var moment=require(_0x9b8d('0x2'));var BPromise=require(_0x9b8d('0x3'));var rs=require(_0x9b8d('0x4'));var fs=require('fs');var Redis=require(_0x9b8d('0x5'));var db=require(_0x9b8d('0x6'))['db'];var utils=require(_0x9b8d('0x7'));var logger=require(_0x9b8d('0x8'))(_0x9b8d('0x9'));var config=require(_0x9b8d('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b8d('0xb')]({'port':0x232a});config[_0x9b8d('0xc')]=_['defaults'](config['redis'],{'host':_0x9b8d('0xd'),'port':0x18eb});var socket=require(_0x9b8d('0xe'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x22a296,_0x4de29d,_0x539dc4){return new BPromise(function(_0x575623,_0x16cacf){return client[_0x9b8d('0xf')](_0x22a296,_0x539dc4)[_0x9b8d('0x10')](function(_0x1bd000){logger[_0x9b8d('0x11')](_0x9b8d('0x12'),_0x4de29d,_0x9b8d('0x13'));logger[_0x9b8d('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4de29d,'request\x20sent',JSON[_0x9b8d('0x15')](_0x1bd000));if(_0x1bd000[_0x9b8d('0x16')]){if(_0x1bd000['error'][_0x9b8d('0x17')]===0x1f4){logger[_0x9b8d('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x4de29d,_0x1bd000[_0x9b8d('0x16')][_0x9b8d('0x18')]);return _0x16cacf(_0x1bd000[_0x9b8d('0x16')][_0x9b8d('0x18')]);}logger['error'](_0x9b8d('0x12'),_0x4de29d,_0x1bd000[_0x9b8d('0x16')][_0x9b8d('0x18')]);return _0x575623(_0x1bd000[_0x9b8d('0x16')]['message']);}else{logger[_0x9b8d('0x11')](_0x9b8d('0x12'),_0x4de29d,_0x9b8d('0x13'));_0x575623(_0x1bd000[_0x9b8d('0x19')]['message']);}})[_0x9b8d('0x1a')](function(_0x2dc2f4){logger[_0x9b8d('0x16')](_0x9b8d('0x12'),_0x4de29d,_0x2dc2f4);_0x16cacf(_0x2dc2f4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e6be1af..030ed01 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 _0x54b2=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x1762d,_0x3976d6){var _0x390ff0=function(_0x3962bc){while(--_0x3962bc){_0x1762d['push'](_0x1762d['shift']());}};_0x390ff0(++_0x3976d6);}(_0x54b2,0x113));var _0x254b=function(_0x328bd3,_0x5231d6){_0x328bd3=_0x328bd3-0x0;var _0x5ba7d0=_0x54b2[_0x328bd3];return _0x5ba7d0;};'use strict';var ChatInternalMessageEvents=require(_0x254b('0x0'));var events=[_0x254b('0x1'),_0x254b('0x2'),_0x254b('0x3')];function createListener(_0x50b845,_0x50e4cb){return function(_0x3ed570){_0x50e4cb[_0x254b('0x4')](_0x50b845,_0x3ed570);};}function removeListener(_0x43d5d9,_0x571f13){return function(){ChatInternalMessageEvents[_0x254b('0x5')](_0x43d5d9,_0x571f13);};}exports[_0x254b('0x6')]=function(_0x2ee395){for(var _0x507e55=0x0,_0x34122d=events[_0x254b('0x7')];_0x507e55<_0x34122d;_0x507e55++){var _0x5b5e18=events[_0x507e55];var _0x150147=createListener(_0x254b('0x8')+_0x5b5e18,_0x2ee395);ChatInternalMessageEvents['on'](_0x5b5e18,_0x150147);}}; \ No newline at end of file +var _0x1911=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x2856c6,_0x745fd1){var _0x5f23a1=function(_0x26c135){while(--_0x26c135){_0x2856c6['push'](_0x2856c6['shift']());}};_0x5f23a1(++_0x745fd1);}(_0x1911,0x143));var _0x1191=function(_0x4a0cd1,_0x23c60e){_0x4a0cd1=_0x4a0cd1-0x0;var _0x1826d3=_0x1911[_0x4a0cd1];return _0x1826d3;};'use strict';var ChatInternalMessageEvents=require(_0x1191('0x0'));var events=[_0x1191('0x1'),_0x1191('0x2'),_0x1191('0x3')];function createListener(_0x539b80,_0x26ba7c){return function(_0x2bf531){_0x26ba7c[_0x1191('0x4')](_0x539b80,_0x2bf531);};}function removeListener(_0x19fc18,_0x5d5d0a){return function(){ChatInternalMessageEvents['removeListener'](_0x19fc18,_0x5d5d0a);};}exports[_0x1191('0x5')]=function(_0xf3f14a){for(var _0x58e5d2=0x0,_0x5066dc=events[_0x1191('0x6')];_0x58e5d2<_0x5066dc;_0x58e5d2++){var _0x16ed7b=events[_0x58e5d2];var _0x580815=createListener(_0x1191('0x7')+_0x16ed7b,_0xf3f14a);ChatInternalMessageEvents['on'](_0x16ed7b,_0x580815);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b967b31..1488ad3 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 _0x2dd6=['/describe','isAuthenticated','describe','getUsers','/:id','show','post','create','destroy','exports','multer','connect-timeout','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x1aa93c,_0x18bc9b){var _0x4720e6=function(_0x1b1a97){while(--_0x1b1a97){_0x1aa93c['push'](_0x1aa93c['shift']());}};_0x4720e6(++_0x18bc9b);}(_0x2dd6,0x81));var _0x62dd=function(_0x409542,_0x5921c9){_0x409542=_0x409542-0x0;var _0x4cdf40=_0x2dd6[_0x409542];return _0x4cdf40;};'use strict';var multer=require(_0x62dd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62dd('0x1'));var express=require('express');var router=express[_0x62dd('0x2')]();var fs_extra=require(_0x62dd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x62dd('0x4'));var controller=require(_0x62dd('0x5'));router[_0x62dd('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x62dd('0x6')](_0x62dd('0x7'),auth[_0x62dd('0x8')](),controller[_0x62dd('0x9')]);router['get']('/users',auth['isAuthenticated'](),controller[_0x62dd('0xa')]);router['get'](_0x62dd('0xb'),auth['isAuthenticated'](),controller[_0x62dd('0xc')]);router[_0x62dd('0xd')]('/',auth[_0x62dd('0x8')](),controller[_0x62dd('0xe')]);router['put'](_0x62dd('0xb'),controller['update']);router['delete'](_0x62dd('0xb'),auth[_0x62dd('0x8')](),controller[_0x62dd('0xf')]);module[_0x62dd('0x10')]=router; \ No newline at end of file +var _0xaa68=['/describe','describe','/users','isAuthenticated','getUsers','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index'];(function(_0x49ab63,_0x2c0f7f){var _0x3ebd1b=function(_0x4ae47a){while(--_0x4ae47a){_0x49ab63['push'](_0x49ab63['shift']());}};_0x3ebd1b(++_0x2c0f7f);}(_0xaa68,0x109));var _0x8aa6=function(_0x1b8486,_0x459cb8){_0x1b8486=_0x1b8486-0x0;var _0x55ef1e=_0xaa68[_0x1b8486];return _0x55ef1e;};'use strict';var multer=require('multer');var util=require(_0x8aa6('0x0'));var path=require(_0x8aa6('0x1'));var timeout=require(_0x8aa6('0x2'));var express=require('express');var router=express[_0x8aa6('0x3')]();var fs_extra=require(_0x8aa6('0x4'));var auth=require(_0x8aa6('0x5'));var interaction=require(_0x8aa6('0x6'));var config=require(_0x8aa6('0x7'));var controller=require(_0x8aa6('0x8'));router[_0x8aa6('0x9')]('/',auth['isAuthenticated'](),controller[_0x8aa6('0xa')]);router['get'](_0x8aa6('0xb'),auth['isAuthenticated'](),controller[_0x8aa6('0xc')]);router[_0x8aa6('0x9')](_0x8aa6('0xd'),auth[_0x8aa6('0xe')](),controller[_0x8aa6('0xf')]);router[_0x8aa6('0x9')](_0x8aa6('0x10'),auth[_0x8aa6('0xe')](),controller['show']);router[_0x8aa6('0x11')]('/',auth[_0x8aa6('0xe')](),controller['create']);router[_0x8aa6('0x12')]('/:id',controller[_0x8aa6('0x13')]);router[_0x8aa6('0x14')](_0x8aa6('0x10'),auth[_0x8aa6('0xe')](),controller[_0x8aa6('0x15')]);module[_0x8aa6('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index cedad22..b52d90b 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 _0x2547=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x2fe986,_0x194907){var _0x360558=function(_0x4c284f){while(--_0x4c284f){_0x2fe986['push'](_0x2fe986['shift']());}};_0x360558(++_0x194907);}(_0x2547,0x1cd));var _0x7254=function(_0x471b87,_0x2e88ed){_0x471b87=_0x471b87-0x0;var _0x3a1236=_0x2547[_0x471b87];return _0x3a1236;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'body':{'type':Sequelize[_0x7254('0x1')](_0x7254('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7254('0x4')]('in',_0x7254('0x5')),'defaultValue':_0x7254('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7254('0x6')]},'providerResponse':{'type':Sequelize[_0x7254('0x1')]}}; \ No newline at end of file +var _0x676c=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x33430b,_0x44def5){var _0x4c3f39=function(_0x45e925){while(--_0x45e925){_0x33430b['push'](_0x33430b['shift']());}};_0x4c3f39(++_0x44def5);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc676('0x0'));module[_0xc676('0x1')]={'body':{'type':Sequelize[_0xc676('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc676('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc676('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc676('0x4')]('in',_0xc676('0x5')),'defaultValue':_0xc676('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc676('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc676('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index aaaca30..c86c418 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 _0xda58=['message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','accept','chat','read','format','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','UserId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','User','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','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','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c2df6,_0x3659cd){var _0x41da8c=function(_0xf03476){while(--_0xf03476){_0x2c2df6['push'](_0x2c2df6['shift']());}};_0x41da8c(++_0x3659cd);}(_0xda58,0xea));var _0x8da5=function(_0x1d08f1,_0x8c0438){_0x1d08f1=_0x1d08f1-0x0;var _0x58a254=_0xda58[_0x1d08f1];return _0x58a254;};'use strict';var emlformat=require(_0x8da5('0x0'));var rimraf=require(_0x8da5('0x1'));var zipdir=require(_0x8da5('0x2'));var jsonpatch=require(_0x8da5('0x3'));var rp=require(_0x8da5('0x4'));var moment=require(_0x8da5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8da5('0x6'));var util=require('util');var path=require(_0x8da5('0x7'));var sox=require('sox');var csv=require(_0x8da5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8da5('0x9'));var _=require(_0x8da5('0xa'));var squel=require(_0x8da5('0xb'));var crypto=require('crypto');var jsforce=require(_0x8da5('0xc'));var deskjs=require(_0x8da5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8da5('0xe'));var Papa=require(_0x8da5('0xf'));var Redis=require('ioredis');var authService=require(_0x8da5('0x10'));var qs=require(_0x8da5('0x11'));var as=require(_0x8da5('0x12'));var hardwareService=require(_0x8da5('0x13'));var logger=require(_0x8da5('0x14'))('api');var utils=require(_0x8da5('0x15'));var config=require(_0x8da5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8da5('0x17'))['db'];config[_0x8da5('0x18')]=_[_0x8da5('0x19')](config[_0x8da5('0x18')],{'host':_0x8da5('0x1a'),'port':0x18eb});var socket=require(_0x8da5('0x1b'))(new Redis(config[_0x8da5('0x18')]));require(_0x8da5('0x1c'))[_0x8da5('0x1d')](socket);var jayson=require(_0x8da5('0x1e'));var client=jayson[_0x8da5('0x1f')][_0x8da5('0x20')]({'port':0x232c});var client9002=jayson[_0x8da5('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x550fc9,_0xa27e35,_0xfe6fa2,_0x3da833){return new BPromise(function(_0x5f2933,_0xd8a76f){var _0x586c7f=_0x3da833||client;return _0x586c7f[_0x8da5('0x21')](_0x550fc9,_0xfe6fa2)[_0x8da5('0x22')](function(_0x13d522){logger[_0x8da5('0x23')](_0x8da5('0x24'),_0xa27e35,_0x8da5('0x25'));logger[_0x8da5('0x26')](_0x8da5('0x27'),_0xa27e35,_0x8da5('0x25'),JSON[_0x8da5('0x28')](_0x13d522));if(_0x13d522[_0x8da5('0x29')]){if(_0x13d522[_0x8da5('0x29')]['code']===0x1f4){logger[_0x8da5('0x29')](_0x8da5('0x24'),_0xa27e35,_0x13d522[_0x8da5('0x29')][_0x8da5('0x2a')]);return _0xd8a76f(_0x13d522['error']['message']);}logger[_0x8da5('0x29')](_0x8da5('0x24'),_0xa27e35,_0x13d522[_0x8da5('0x29')][_0x8da5('0x2a')]);return _0x5f2933(_0x13d522[_0x8da5('0x29')][_0x8da5('0x2a')]);}else{logger['info'](_0x8da5('0x24'),_0xa27e35,'request\x20sent');_0x5f2933(_0x13d522['result'][_0x8da5('0x2a')]);}})[_0x8da5('0x2b')](function(_0x2cc81b){logger[_0x8da5('0x29')](_0x8da5('0x24'),_0xa27e35,_0x2cc81b);_0xd8a76f(_0x2cc81b);});});}function respondWithStatusCode(_0x52a8c1,_0x5424f1){_0x5424f1=_0x5424f1||0xcc;return function(_0x100e9e){if(_0x100e9e){return _0x52a8c1[_0x8da5('0x2c')](_0x5424f1);}return _0x52a8c1[_0x8da5('0x2d')](_0x5424f1)['end']();};}function respondWithResult(_0x4fefcc,_0x4b4741){_0x4b4741=_0x4b4741||0xc8;return function(_0x38df30){if(_0x38df30){return _0x4fefcc['status'](_0x4b4741)[_0x8da5('0x2e')](_0x38df30);}};}function respondWithFilteredResult(_0x361b54,_0x47ef28){return function(_0x56a425){if(_0x56a425){var _0x4a5dc3=typeof _0x47ef28[_0x8da5('0x2f')]===_0x8da5('0x30')&&typeof _0x47ef28[_0x8da5('0x31')]===_0x8da5('0x30');var _0xb10b6e=_0x56a425['count'];var _0x134211=_0x4a5dc3?0x0:_0x47ef28['offset'];var _0x7d356=_0x4a5dc3?_0x56a425[_0x8da5('0x32')]:_0x47ef28[_0x8da5('0x2f')]+_0x47ef28[_0x8da5('0x31')];var _0x12883d;if(_0x7d356>=_0xb10b6e){_0x7d356=_0xb10b6e;_0x12883d=0xc8;}else{_0x12883d=0xce;}_0x361b54[_0x8da5('0x2d')](_0x12883d);return _0x361b54[_0x8da5('0x33')](_0x8da5('0x34'),_0x134211+'-'+_0x7d356+'/'+_0xb10b6e)['json'](_0x56a425);}return null;};}function patchUpdates(_0x2a3a1e){return function(_0x33a378){try{jsonpatch[_0x8da5('0x35')](_0x33a378,_0x2a3a1e,!![]);}catch(_0x2acbcf){return BPromise[_0x8da5('0x36')](_0x2acbcf);}return _0x33a378[_0x8da5('0x37')]();};}function saveUpdates(_0x446c17,_0xfa877f){return function(_0x517674){if(_0x517674){return _0x517674[_0x8da5('0x38')](_0x446c17)['then'](function(_0x9078fc){return _0x9078fc;});}return null;};}function removeEntity(_0x5239c0,_0x3df03d){return function(_0x232aa1){if(_0x232aa1){return _0x232aa1[_0x8da5('0x39')]()[_0x8da5('0x22')](function(){_0x5239c0[_0x8da5('0x2d')](0xcc)[_0x8da5('0x3a')]();});}};}function handleEntityNotFound(_0x168ff2,_0x597778){return function(_0x195aca){if(!_0x195aca){_0x168ff2['sendStatus'](0x194);}return _0x195aca;};}function handleError(_0xa878b9,_0x519869){_0x519869=_0x519869||0x1f4;return function(_0x4c6d26){logger[_0x8da5('0x29')](_0x4c6d26[_0x8da5('0x3b')]);if(_0x4c6d26['name']){delete _0x4c6d26[_0x8da5('0x3c')];}_0xa878b9[_0x8da5('0x2d')](_0x519869)[_0x8da5('0x3d')](_0x4c6d26);};}exports[_0x8da5('0x3e')]=function(_0x4d59d4,_0x4d244d){var _0x4141fd={},_0x5d8c12={},_0x4cd566={'count':0x0,'rows':[]};var _0x188f2f=_[_0x8da5('0x3f')](db[_0x8da5('0x40')][_0x8da5('0x41')],function(_0x8c0ad8){return{'name':_0x8c0ad8[_0x8da5('0x42')],'type':_0x8c0ad8['type'][_0x8da5('0x43')]};});_0x5d8c12[_0x8da5('0x44')]=_[_0x8da5('0x3f')](_0x188f2f,_0x8da5('0x3c'));_0x5d8c12[_0x8da5('0x45')]=_['keys'](_0x4d59d4[_0x8da5('0x45')]);_0x5d8c12['filters']=_[_0x8da5('0x46')](_0x5d8c12[_0x8da5('0x44')],_0x5d8c12[_0x8da5('0x45')]);_0x4141fd[_0x8da5('0x47')]=_[_0x8da5('0x46')](_0x5d8c12[_0x8da5('0x44')],qs[_0x8da5('0x48')](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x48')]));_0x4141fd['attributes']=_0x4141fd['attributes'][_0x8da5('0x49')]?_0x4141fd['attributes']:_0x5d8c12['model'];if(!_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x4a')](_0x8da5('0x4b'))){_0x4141fd[_0x8da5('0x31')]=qs['limit'](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x31')]);_0x4141fd['offset']=qs[_0x8da5('0x2f')](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x2f')]);}_0x4141fd[_0x8da5('0x4c')]=qs[_0x8da5('0x4d')](_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x4d')]);_0x4141fd[_0x8da5('0x4e')]=qs['filters'](_[_0x8da5('0x4f')](_0x4d59d4[_0x8da5('0x45')],_0x5d8c12[_0x8da5('0x50')]),_0x188f2f);if(_0x4d59d4['query'][_0x8da5('0x51')]){_0x4141fd['where']=_[_0x8da5('0x52')](_0x4141fd['where'],{'$or':_[_0x8da5('0x3f')](_0x188f2f,function(_0x1e4245){if(_0x1e4245['type']!==_0x8da5('0x53')){var _0x81663d={};_0x81663d[_0x1e4245[_0x8da5('0x3c')]]={'$like':'%'+_0x4d59d4[_0x8da5('0x45')]['filter']+'%'};return _0x81663d;}})});}_0x4141fd=_['merge']({},_0x4141fd,_0x4d59d4[_0x8da5('0x54')]);var _0x51d924={'where':_0x4141fd[_0x8da5('0x4e')]};return db[_0x8da5('0x40')]['count'](_0x51d924)[_0x8da5('0x22')](function(_0x46631c){_0x4cd566[_0x8da5('0x32')]=_0x46631c;if(_0x4d59d4[_0x8da5('0x45')][_0x8da5('0x55')]){_0x4141fd[_0x8da5('0x56')]=[{'all':!![]}];}return db[_0x8da5('0x40')][_0x8da5('0x57')](_0x4141fd);})[_0x8da5('0x22')](function(_0xa650c1){_0x4cd566[_0x8da5('0x58')]=_0xa650c1;return _0x4cd566;})[_0x8da5('0x22')](respondWithFilteredResult(_0x4d244d,_0x4141fd))[_0x8da5('0x2b')](handleError(_0x4d244d,null));};exports[_0x8da5('0x59')]=function(_0x510dc7,_0x92b997){var _0x2e16da={'raw':!![],'where':{'id':_0x510dc7[_0x8da5('0x5a')]['id']}},_0x35f038={};_0x35f038['model']=_[_0x8da5('0x5b')](db['ChatMessage'][_0x8da5('0x41')]);_0x35f038[_0x8da5('0x45')]=_[_0x8da5('0x5b')](_0x510dc7[_0x8da5('0x45')]);_0x35f038[_0x8da5('0x50')]=_[_0x8da5('0x46')](_0x35f038[_0x8da5('0x44')],_0x35f038[_0x8da5('0x45')]);_0x2e16da[_0x8da5('0x47')]=_[_0x8da5('0x46')](_0x35f038[_0x8da5('0x44')],qs[_0x8da5('0x48')](_0x510dc7[_0x8da5('0x45')][_0x8da5('0x48')]));_0x2e16da[_0x8da5('0x47')]=_0x2e16da[_0x8da5('0x47')][_0x8da5('0x49')]?_0x2e16da[_0x8da5('0x47')]:_0x35f038[_0x8da5('0x44')];if(_0x510dc7['query'][_0x8da5('0x55')]){_0x2e16da[_0x8da5('0x56')]=[{'all':!![]}];}_0x2e16da=_['merge']({},_0x2e16da,_0x510dc7['options']);return db['ChatMessage'][_0x8da5('0x5c')](_0x2e16da)[_0x8da5('0x22')](handleEntityNotFound(_0x92b997,null))[_0x8da5('0x22')](respondWithResult(_0x92b997,null))[_0x8da5('0x2b')](handleError(_0x92b997,null));};exports['create']=function(_0x5643cb,_0x11665f){return db[_0x8da5('0x40')]['create'](_0x5643cb[_0x8da5('0x5d')],{})[_0x8da5('0x22')](respondWithResult(_0x11665f,0xc9))[_0x8da5('0x2b')](handleError(_0x11665f,null));};exports[_0x8da5('0x38')]=function(_0x4cc9e2,_0x2b98df){if(_0x4cc9e2[_0x8da5('0x5d')]['id']){delete _0x4cc9e2[_0x8da5('0x5d')]['id'];}return db[_0x8da5('0x40')][_0x8da5('0x5c')]({'where':{'id':_0x4cc9e2[_0x8da5('0x5a')]['id']}})[_0x8da5('0x22')](handleEntityNotFound(_0x2b98df,null))['then'](saveUpdates(_0x4cc9e2[_0x8da5('0x5d')],null))[_0x8da5('0x22')](respondWithResult(_0x2b98df,null))[_0x8da5('0x2b')](handleError(_0x2b98df,null));};exports[_0x8da5('0x39')]=function(_0x454003,_0x42dfab){return db['ChatMessage'][_0x8da5('0x5c')]({'where':{'id':_0x454003[_0x8da5('0x5a')]['id']}})[_0x8da5('0x22')](handleEntityNotFound(_0x42dfab,null))[_0x8da5('0x22')](removeEntity(_0x42dfab,null))[_0x8da5('0x2b')](handleError(_0x42dfab,null));};exports[_0x8da5('0x5e')]=function(_0x33ad9b,_0x194bf8){return db[_0x8da5('0x40')]['describe']()[_0x8da5('0x22')](respondWithResult(_0x194bf8,null))[_0x8da5('0x2b')](handleError(_0x194bf8,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x8da5('0x5f')]=function(_0x5d6584,_0x28829c,_0x4f3f5c){var _0xcd10b0={'agent':{},'channel':_0x8da5('0x60')};if(_0x5d6584[_0x8da5('0x5d')]['id']){delete _0x5d6584[_0x8da5('0x5d')]['id'];}_0x5d6584[_0x8da5('0x5d')][_0x8da5('0x61')]=!![];_0x5d6584[_0x8da5('0x5d')]['readAt']=moment()[_0x8da5('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d6584[_0x8da5('0x5d')]['UserId']=_0x5d6584['body']['UserId']||_0x5d6584[_0x8da5('0x63')]['id'];_0xcd10b0[_0x8da5('0x64')]['id']=_0x5d6584['body']['UserId'];return db[_0x8da5('0x40')]['find']({'where':{'id':_0x5d6584[_0x8da5('0x5a')]['id'],'UserId':null}})[_0x8da5('0x22')](handleEntityNotFound(_0x28829c,null))[_0x8da5('0x22')](saveUpdates(_0x5d6584[_0x8da5('0x5d')],null))[_0x8da5('0x22')](function(_0x1b0259){if(_0x1b0259){_0xcd10b0[_0x8da5('0x2a')]=_0x1b0259['get']({'plain':!![]});return db[_0x8da5('0x65')][_0x8da5('0x5c')]({'where':{'id':_0x1b0259[_0x8da5('0x66')]}});}return null;})[_0x8da5('0x22')](handleEntityNotFound(_0x28829c,null))['then'](function(_0x2952ec){if(_0x2952ec){return _0x2952ec[_0x8da5('0x38')]({'UserId':_0x5d6584[_0x8da5('0x5d')]['UserId'],'read1stAt':_[_0x8da5('0x67')](_0x2952ec[_0x8da5('0x68')])?moment()[_0x8da5('0x62')](_0x8da5('0x69')):undefined});}return null;})['then'](function(_0x446ab8){if(_0x446ab8){_0xcd10b0[_0x8da5('0x6a')]=_0x446ab8[_0x8da5('0x6b')]({'plain':!![]});interaction_log[_0x8da5('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d6584[_0x8da5('0x63')]['id'],_0x5d6584[_0x8da5('0x63')]['name'],_0x5d6584[_0x8da5('0x63')][_0x8da5('0x6c')],_0xcd10b0[_0x8da5('0x6a')]['id'],_0x5d6584[_0x8da5('0x5d')]?JSON[_0x8da5('0x28')](_0x5d6584[_0x8da5('0x5d')]):_0x8da5('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x8da5('0x6e'),_0xcd10b0);}return null;})[_0x8da5('0x22')](function(_0x3f5007){var _0x2786d6=_0x8da5('0x6f')+_0x3f5007[_0x8da5('0x2a')][_0x8da5('0x70')];return db[_0x8da5('0x71')][_0x8da5('0x45')](_0x2786d6,{'type':db['Sequelize'][_0x8da5('0x72')][_0x8da5('0x73')],'raw':!![]})['then'](function(_0x392253){return _0x392253;});})[_0x8da5('0x22')](function(_0x4edfae){if(_0x4edfae){_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x74')]=_0x4edfae[0x0];if(!_0x5d6584[_0x8da5('0x5d')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5d6584[_0x8da5('0x5d')]['UserId'],'role':_0x8da5('0x64')},'attributes':['id',_0x8da5('0x3c'),_0x8da5('0x75'),_0x8da5('0x76'),_0x8da5('0x77')],'raw':!![]});}return null;})['then'](function(_0x503495){if(!_0x503495)return null;_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x64')]=_0x503495;return _0xcd10b0;})[_0x8da5('0x22')](function(_0x28f745){if(_0x28f745){if(_0x5d6584[_0x8da5('0x5d')][_0x8da5('0x78')]){_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x79')]=util[_0x8da5('0x62')](_0x8da5('0x7a'),_0x5d6584[_0x8da5('0x63')]['name']);_0xcd10b0[_0x8da5('0x2a')][_0x8da5('0x7b')]=_0xcd10b0['channel'];_0xcd10b0['message'][_0x8da5('0x7c')]=_0xcd10b0['channel'];_0xcd10b0['message'][_0x8da5('0x7d')]=_0x8da5('0x5f');return respondWithRpcPromise(_0x8da5('0x7e'),_0x8da5('0x7e'),{'event':_0x8da5('0x7f'),'message':_[_0x8da5('0x52')](_0xcd10b0['message'],JSON['parse'](_0xcd10b0[_0x8da5('0x6a')][_0x8da5('0x80')]))},client9002)[_0x8da5('0x22')](function(){return _0xcd10b0;});}return _0xcd10b0;}return null;})[_0x8da5('0x22')](respondWithResult(_0x28829c,null))[_0x8da5('0x2b')](handleError(_0x28829c,null));};var interaction_log=require(_0x8da5('0x14'))(_0x8da5('0x81'));exports[_0x8da5('0x36')]=function(_0x178285,_0x396201,_0x201949){var _0x51b31e={'agent':{},'channel':_0x8da5('0x60')};if(_0x178285[_0x8da5('0x5d')]['id']){delete _0x178285[_0x8da5('0x5d')]['id'];}_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')]=_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')]||_0x178285[_0x8da5('0x63')]['id'];_0x51b31e['agent']['id']=_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')];return db['ChatMessage']['find']({'where':{'id':_0x178285[_0x8da5('0x5a')]['id'],'UserId':null}})[_0x8da5('0x22')](handleEntityNotFound(_0x396201,null))['then'](function(_0x4eea3f){if(_0x4eea3f){_0x51b31e['message']=_0x4eea3f[_0x8da5('0x6b')]({'plain':!![]});return db[_0x8da5('0x65')]['find']({'where':{'id':_0x4eea3f['ChatInteractionId']}});}return null;})[_0x8da5('0x22')](handleEntityNotFound(_0x396201,null))[_0x8da5('0x22')](function(_0x13c376){if(_0x13c376){_0x51b31e[_0x8da5('0x6a')]=_0x13c376[_0x8da5('0x6b')]({'plain':!![]});interaction_log['info'](_0x8da5('0x83'),_0x178285[_0x8da5('0x63')]['id'],_0x178285[_0x8da5('0x63')][_0x8da5('0x3c')],_0x178285['user'][_0x8da5('0x6c')],_0x51b31e[_0x8da5('0x6a')]['id'],_0x178285[_0x8da5('0x5d')]?JSON[_0x8da5('0x28')](_0x178285[_0x8da5('0x5d')]):'null');return respondWithRpcPromise(_0x8da5('0x84'),_0x8da5('0x85'),_0x51b31e);}return null;})[_0x8da5('0x22')](function(_0x2bf0a0){var _0x54798b=_0x8da5('0x6f')+_0x2bf0a0[_0x8da5('0x2a')][_0x8da5('0x70')];return db[_0x8da5('0x71')][_0x8da5('0x45')](_0x54798b,{'type':db[_0x8da5('0x86')][_0x8da5('0x72')][_0x8da5('0x73')],'raw':!![]})['then'](function(_0x32037c){return _0x32037c;});})[_0x8da5('0x22')](function(_0x56fdb3){if(_0x56fdb3){_0x51b31e[_0x8da5('0x2a')]['contact']=_0x56fdb3[0x0];if(!_0x178285[_0x8da5('0x5d')][_0x8da5('0x82')])return;return db[_0x8da5('0x87')][_0x8da5('0x5c')]({'where':{'id':_0x178285[_0x8da5('0x5d')]['UserId'],'role':_0x8da5('0x64')},'attributes':['id','name',_0x8da5('0x75'),_0x8da5('0x76'),_0x8da5('0x77')],'raw':!![]});}return null;})[_0x8da5('0x22')](function(_0x2a4288){if(!_0x2a4288)return null;_0x51b31e[_0x8da5('0x2a')]['agent']=_0x2a4288;return _0x51b31e;})['then'](function(_0x399a49){if(_0x399a49){_0x399a49[_0x8da5('0x2a')]['interface']=util['format']('SIP/%s',_0x178285['user']['name']);_0x399a49[_0x8da5('0x2a')][_0x8da5('0x7b')]=_0x51b31e[_0x8da5('0x7b')];_0x399a49[_0x8da5('0x2a')][_0x8da5('0x7c')]=_0x51b31e[_0x8da5('0x7b')];_0x399a49[_0x8da5('0x2a')][_0x8da5('0x7d')]='reject';respondWithRpcPromise(_0x8da5('0x7e'),'EventManager',{'event':_0x8da5('0x88'),'message':_[_0x8da5('0x52')](_0x51b31e[_0x8da5('0x2a')],JSON[_0x8da5('0x89')](_0x51b31e[_0x8da5('0x6a')][_0x8da5('0x80')]))},client9002);return _0x51b31e;}return null;})[_0x8da5('0x22')](respondWithResult(_0x396201,null))[_0x8da5('0x2b')](handleError(_0x396201,null));}; \ No newline at end of file +var _0x7903=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','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','count','limit','set','Content-Range','json','reject','save','update','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','User','fullname','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','contact','SIP/%s','event','parse','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x375c61,_0x409703){var _0x387065=function(_0x221a05){while(--_0x221a05){_0x375c61['push'](_0x375c61['shift']());}};_0x387065(++_0x409703);}(_0x7903,0x84));var _0x3790=function(_0x5dbc9c,_0x2d2fb4){_0x5dbc9c=_0x5dbc9c-0x0;var _0x2af357=_0x7903[_0x5dbc9c];return _0x2af357;};'use strict';var emlformat=require(_0x3790('0x0'));var rimraf=require(_0x3790('0x1'));var zipdir=require(_0x3790('0x2'));var jsonpatch=require(_0x3790('0x3'));var rp=require(_0x3790('0x4'));var moment=require(_0x3790('0x5'));var BPromise=require(_0x3790('0x6'));var Mustache=require(_0x3790('0x7'));var util=require(_0x3790('0x8'));var path=require(_0x3790('0x9'));var sox=require(_0x3790('0xa'));var csv=require('to-csv');var ejs=require(_0x3790('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3790('0xc'));var squel=require(_0x3790('0xd'));var crypto=require(_0x3790('0xe'));var jsforce=require(_0x3790('0xf'));var deskjs=require(_0x3790('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3790('0x11'));var Redis=require(_0x3790('0x12'));var authService=require(_0x3790('0x13'));var qs=require(_0x3790('0x14'));var as=require(_0x3790('0x15'));var hardwareService=require(_0x3790('0x16'));var logger=require(_0x3790('0x17'))(_0x3790('0x18'));var utils=require(_0x3790('0x19'));var config=require(_0x3790('0x1a'));var licenseUtil=require(_0x3790('0x1b'));var db=require('../../mysqldb')['db'];config[_0x3790('0x1c')]=_[_0x3790('0x1d')](config[_0x3790('0x1c')],{'host':_0x3790('0x1e'),'port':0x18eb});var socket=require(_0x3790('0x1f'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x3790('0x20')](socket);var jayson=require(_0x3790('0x21'));var client=jayson[_0x3790('0x22')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x230cb6,_0x2f4063,_0x38907c,_0x5ce938){return new BPromise(function(_0x3fd7fa,_0x555173){var _0x2df783=_0x5ce938||client;return _0x2df783[_0x3790('0x23')](_0x230cb6,_0x38907c)[_0x3790('0x24')](function(_0x242010){logger[_0x3790('0x25')]('ChatMessage,\x20%s,\x20%s',_0x2f4063,_0x3790('0x26'));logger[_0x3790('0x27')](_0x3790('0x28'),_0x2f4063,_0x3790('0x26'),JSON[_0x3790('0x29')](_0x242010));if(_0x242010[_0x3790('0x2a')]){if(_0x242010['error'][_0x3790('0x2b')]===0x1f4){logger[_0x3790('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x2f4063,_0x242010[_0x3790('0x2a')][_0x3790('0x2c')]);return _0x555173(_0x242010[_0x3790('0x2a')][_0x3790('0x2c')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x2f4063,_0x242010[_0x3790('0x2a')][_0x3790('0x2c')]);return _0x3fd7fa(_0x242010[_0x3790('0x2a')][_0x3790('0x2c')]);}else{logger[_0x3790('0x25')](_0x3790('0x2d'),_0x2f4063,_0x3790('0x26'));_0x3fd7fa(_0x242010[_0x3790('0x2e')][_0x3790('0x2c')]);}})[_0x3790('0x2f')](function(_0xee79e3){logger[_0x3790('0x2a')](_0x3790('0x2d'),_0x2f4063,_0xee79e3);_0x555173(_0xee79e3);});});}function respondWithStatusCode(_0x131f34,_0x58353){_0x58353=_0x58353||0xcc;return function(_0x187511){if(_0x187511){return _0x131f34[_0x3790('0x30')](_0x58353);}return _0x131f34[_0x3790('0x31')](_0x58353)[_0x3790('0x32')]();};}function respondWithResult(_0x49f86a,_0x36b350){_0x36b350=_0x36b350||0xc8;return function(_0x13a92b){if(_0x13a92b){return _0x49f86a['status'](_0x36b350)['json'](_0x13a92b);}};}function respondWithFilteredResult(_0x95afde,_0x288a3e){return function(_0x281782){if(_0x281782){var _0x3c3b57=typeof _0x288a3e[_0x3790('0x33')]===_0x3790('0x34')&&typeof _0x288a3e['limit']==='undefined';var _0x569a83=_0x281782[_0x3790('0x35')];var _0x26b42d=_0x3c3b57?0x0:_0x288a3e['offset'];var _0x3633be=_0x3c3b57?_0x281782[_0x3790('0x35')]:_0x288a3e['offset']+_0x288a3e[_0x3790('0x36')];var _0x25a906;if(_0x3633be>=_0x569a83){_0x3633be=_0x569a83;_0x25a906=0xc8;}else{_0x25a906=0xce;}_0x95afde['status'](_0x25a906);return _0x95afde[_0x3790('0x37')](_0x3790('0x38'),_0x26b42d+'-'+_0x3633be+'/'+_0x569a83)[_0x3790('0x39')](_0x281782);}return null;};}function patchUpdates(_0x5bc8c2){return function(_0x449978){try{jsonpatch['apply'](_0x449978,_0x5bc8c2,!![]);}catch(_0x1d1f7a){return BPromise[_0x3790('0x3a')](_0x1d1f7a);}return _0x449978[_0x3790('0x3b')]();};}function saveUpdates(_0x4f540c,_0x388799){return function(_0x1e8f23){if(_0x1e8f23){return _0x1e8f23[_0x3790('0x3c')](_0x4f540c)[_0x3790('0x24')](function(_0x57e8cb){return _0x57e8cb;});}return null;};}function removeEntity(_0x1aba55,_0x4929f3){return function(_0x506ca4){if(_0x506ca4){return _0x506ca4['destroy']()[_0x3790('0x24')](function(){_0x1aba55[_0x3790('0x31')](0xcc)[_0x3790('0x32')]();});}};}function handleEntityNotFound(_0x16d1b0,_0x54120e){return function(_0x231e5d){if(!_0x231e5d){_0x16d1b0[_0x3790('0x30')](0x194);}return _0x231e5d;};}function handleError(_0x4647fa,_0x3063bd){_0x3063bd=_0x3063bd||0x1f4;return function(_0x2d2877){logger[_0x3790('0x2a')](_0x2d2877['stack']);if(_0x2d2877['name']){delete _0x2d2877[_0x3790('0x3d')];}_0x4647fa[_0x3790('0x31')](_0x3063bd)[_0x3790('0x3e')](_0x2d2877);};}exports[_0x3790('0x3f')]=function(_0x1568fa,_0x12a8df){var _0x349378={},_0x33e362={},_0x44912f={'count':0x0,'rows':[]};var _0x47eb0b=_[_0x3790('0x40')](db[_0x3790('0x41')][_0x3790('0x42')],function(_0x7ee23f){return{'name':_0x7ee23f[_0x3790('0x43')],'type':_0x7ee23f[_0x3790('0x44')][_0x3790('0x45')]};});_0x33e362[_0x3790('0x46')]=_[_0x3790('0x40')](_0x47eb0b,_0x3790('0x3d'));_0x33e362[_0x3790('0x47')]=_[_0x3790('0x48')](_0x1568fa[_0x3790('0x47')]);_0x33e362[_0x3790('0x49')]=_[_0x3790('0x4a')](_0x33e362[_0x3790('0x46')],_0x33e362[_0x3790('0x47')]);_0x349378[_0x3790('0x4b')]=_[_0x3790('0x4a')](_0x33e362['model'],qs[_0x3790('0x4c')](_0x1568fa['query']['fields']));_0x349378[_0x3790('0x4b')]=_0x349378[_0x3790('0x4b')][_0x3790('0x4d')]?_0x349378['attributes']:_0x33e362[_0x3790('0x46')];if(!_0x1568fa[_0x3790('0x47')][_0x3790('0x4e')]('nolimit')){_0x349378[_0x3790('0x36')]=qs[_0x3790('0x36')](_0x1568fa[_0x3790('0x47')][_0x3790('0x36')]);_0x349378[_0x3790('0x33')]=qs[_0x3790('0x33')](_0x1568fa['query']['offset']);}_0x349378['order']=qs[_0x3790('0x4f')](_0x1568fa[_0x3790('0x47')][_0x3790('0x4f')]);_0x349378[_0x3790('0x50')]=qs[_0x3790('0x49')](_[_0x3790('0x51')](_0x1568fa['query'],_0x33e362[_0x3790('0x49')]),_0x47eb0b);if(_0x1568fa['query'][_0x3790('0x52')]){_0x349378[_0x3790('0x50')]=_[_0x3790('0x53')](_0x349378[_0x3790('0x50')],{'$or':_[_0x3790('0x40')](_0x47eb0b,function(_0x1a26cd){if(_0x1a26cd['type']!=='VIRTUAL'){var _0x5cefe8={};_0x5cefe8[_0x1a26cd[_0x3790('0x3d')]]={'$like':'%'+_0x1568fa['query'][_0x3790('0x52')]+'%'};return _0x5cefe8;}})});}_0x349378=_['merge']({},_0x349378,_0x1568fa[_0x3790('0x54')]);var _0x15a841={'where':_0x349378['where']};return db['ChatMessage'][_0x3790('0x35')](_0x15a841)[_0x3790('0x24')](function(_0x482982){_0x44912f[_0x3790('0x35')]=_0x482982;if(_0x1568fa[_0x3790('0x47')][_0x3790('0x55')]){_0x349378[_0x3790('0x56')]=[{'all':!![]}];}return db[_0x3790('0x41')][_0x3790('0x57')](_0x349378);})['then'](function(_0xdd96bd){_0x44912f[_0x3790('0x58')]=_0xdd96bd;return _0x44912f;})['then'](respondWithFilteredResult(_0x12a8df,_0x349378))[_0x3790('0x2f')](handleError(_0x12a8df,null));};exports[_0x3790('0x59')]=function(_0x5fb02f,_0x5b0345){var _0x4bae9a={'raw':!![],'where':{'id':_0x5fb02f[_0x3790('0x5a')]['id']}},_0x38859e={};_0x38859e[_0x3790('0x46')]=_['keys'](db['ChatMessage'][_0x3790('0x42')]);_0x38859e['query']=_[_0x3790('0x48')](_0x5fb02f[_0x3790('0x47')]);_0x38859e[_0x3790('0x49')]=_[_0x3790('0x4a')](_0x38859e[_0x3790('0x46')],_0x38859e[_0x3790('0x47')]);_0x4bae9a[_0x3790('0x4b')]=_['intersection'](_0x38859e['model'],qs[_0x3790('0x4c')](_0x5fb02f['query']['fields']));_0x4bae9a[_0x3790('0x4b')]=_0x4bae9a[_0x3790('0x4b')]['length']?_0x4bae9a[_0x3790('0x4b')]:_0x38859e[_0x3790('0x46')];if(_0x5fb02f[_0x3790('0x47')]['includeAll']){_0x4bae9a[_0x3790('0x56')]=[{'all':!![]}];}_0x4bae9a=_['merge']({},_0x4bae9a,_0x5fb02f['options']);return db[_0x3790('0x41')][_0x3790('0x5b')](_0x4bae9a)['then'](handleEntityNotFound(_0x5b0345,null))[_0x3790('0x24')](respondWithResult(_0x5b0345,null))[_0x3790('0x2f')](handleError(_0x5b0345,null));};exports[_0x3790('0x5c')]=function(_0xe7bc18,_0xe2b91b){return db[_0x3790('0x41')]['create'](_0xe7bc18[_0x3790('0x5d')],{})[_0x3790('0x24')](respondWithResult(_0xe2b91b,0xc9))['catch'](handleError(_0xe2b91b,null));};exports[_0x3790('0x3c')]=function(_0x16cd6a,_0x2090e4){if(_0x16cd6a[_0x3790('0x5d')]['id']){delete _0x16cd6a[_0x3790('0x5d')]['id'];}return db[_0x3790('0x41')][_0x3790('0x5b')]({'where':{'id':_0x16cd6a[_0x3790('0x5a')]['id']}})[_0x3790('0x24')](handleEntityNotFound(_0x2090e4,null))['then'](saveUpdates(_0x16cd6a[_0x3790('0x5d')],null))['then'](respondWithResult(_0x2090e4,null))[_0x3790('0x2f')](handleError(_0x2090e4,null));};exports[_0x3790('0x5e')]=function(_0x4a0e1d,_0x1212f0){return db[_0x3790('0x41')][_0x3790('0x5b')]({'where':{'id':_0x4a0e1d[_0x3790('0x5a')]['id']}})[_0x3790('0x24')](handleEntityNotFound(_0x1212f0,null))[_0x3790('0x24')](removeEntity(_0x1212f0,null))[_0x3790('0x2f')](handleError(_0x1212f0,null));};exports[_0x3790('0x5f')]=function(_0x485ce5,_0x31536a){return db[_0x3790('0x41')]['describe']()['then'](respondWithResult(_0x31536a,null))['catch'](handleError(_0x31536a,null));};var interaction_log=require(_0x3790('0x17'))(_0x3790('0x60'));exports[_0x3790('0x61')]=function(_0x4b794c,_0x24d740,_0x29552b){var _0x416b9b={'agent':{},'channel':_0x3790('0x62')};if(_0x4b794c[_0x3790('0x5d')]['id']){delete _0x4b794c[_0x3790('0x5d')]['id'];}_0x4b794c[_0x3790('0x5d')][_0x3790('0x63')]=!![];_0x4b794c[_0x3790('0x5d')]['readAt']=moment()[_0x3790('0x64')](_0x3790('0x65'));_0x4b794c[_0x3790('0x5d')][_0x3790('0x66')]=_0x4b794c[_0x3790('0x5d')][_0x3790('0x66')]||_0x4b794c[_0x3790('0x67')]['id'];_0x416b9b[_0x3790('0x68')]['id']=_0x4b794c[_0x3790('0x5d')][_0x3790('0x66')];return db[_0x3790('0x41')]['find']({'where':{'id':_0x4b794c[_0x3790('0x5a')]['id'],'UserId':null}})[_0x3790('0x24')](handleEntityNotFound(_0x24d740,null))['then'](saveUpdates(_0x4b794c[_0x3790('0x5d')],null))[_0x3790('0x24')](function(_0x44ae18){if(_0x44ae18){_0x416b9b[_0x3790('0x2c')]=_0x44ae18[_0x3790('0x69')]({'plain':!![]});return db[_0x3790('0x6a')][_0x3790('0x5b')]({'where':{'id':_0x44ae18[_0x3790('0x6b')]}});}return null;})[_0x3790('0x24')](handleEntityNotFound(_0x24d740,null))[_0x3790('0x24')](function(_0x399436){if(_0x399436){return _0x399436[_0x3790('0x3c')]({'UserId':_0x4b794c[_0x3790('0x5d')][_0x3790('0x66')],'read1stAt':_[_0x3790('0x6c')](_0x399436[_0x3790('0x6d')])?moment()[_0x3790('0x64')](_0x3790('0x65')):undefined});}return null;})[_0x3790('0x24')](function(_0x216fcb){if(_0x216fcb){_0x416b9b[_0x3790('0x6e')]=_0x216fcb['get']({'plain':!![]});interaction_log['info'](_0x3790('0x6f'),_0x4b794c[_0x3790('0x67')]['id'],_0x4b794c[_0x3790('0x67')][_0x3790('0x3d')],_0x4b794c[_0x3790('0x67')]['role'],_0x416b9b[_0x3790('0x6e')]['id'],_0x4b794c[_0x3790('0x5d')]?JSON[_0x3790('0x29')](_0x4b794c[_0x3790('0x5d')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3790('0x70'),_0x416b9b);}return null;})[_0x3790('0x24')](function(_0x3cba51){var _0x552f47=_0x3790('0x71')+_0x3cba51[_0x3790('0x2c')][_0x3790('0x72')];return db['sequelize']['query'](_0x552f47,{'type':db[_0x3790('0x73')]['QueryTypes'][_0x3790('0x74')],'raw':!![]})['then'](function(_0x2ea8e7){return _0x2ea8e7;});})[_0x3790('0x24')](function(_0x2a75a0){if(_0x2a75a0){_0x416b9b[_0x3790('0x2c')]['contact']=_0x2a75a0[0x0];if(!_0x4b794c[_0x3790('0x5d')][_0x3790('0x66')])return;return db[_0x3790('0x75')][_0x3790('0x5b')]({'where':{'id':_0x4b794c[_0x3790('0x5d')][_0x3790('0x66')],'role':_0x3790('0x68')},'attributes':['id',_0x3790('0x3d'),_0x3790('0x76'),'email',_0x3790('0x77')],'raw':!![]});}return null;})[_0x3790('0x24')](function(_0xb96bd7){if(!_0xb96bd7)return null;_0x416b9b['message'][_0x3790('0x68')]=_0xb96bd7;return _0x416b9b;})[_0x3790('0x24')](function(_0x2bc679){if(_0x2bc679){if(_0x4b794c[_0x3790('0x5d')][_0x3790('0x78')]){_0x416b9b[_0x3790('0x2c')][_0x3790('0x79')]=util[_0x3790('0x64')]('SIP/%s',_0x4b794c[_0x3790('0x67')][_0x3790('0x3d')]);_0x416b9b[_0x3790('0x2c')][_0x3790('0x7a')]=_0x416b9b[_0x3790('0x7a')];_0x416b9b[_0x3790('0x2c')][_0x3790('0x7b')]=_0x416b9b[_0x3790('0x7a')];_0x416b9b[_0x3790('0x2c')]['event']=_0x3790('0x61');return respondWithRpcPromise(_0x3790('0x7c'),'EventManager',{'event':_0x3790('0x7d'),'message':_[_0x3790('0x53')](_0x416b9b['message'],JSON['parse'](_0x416b9b[_0x3790('0x6e')][_0x3790('0x7e')]))},client9002)[_0x3790('0x24')](function(){return _0x416b9b;});}return _0x416b9b;}return null;})[_0x3790('0x24')](respondWithResult(_0x24d740,null))[_0x3790('0x2f')](handleError(_0x24d740,null));};var interaction_log=require(_0x3790('0x17'))(_0x3790('0x60'));exports[_0x3790('0x3a')]=function(_0x3dea8d,_0x484375,_0x2ec9f6){var _0x5030be={'agent':{},'channel':_0x3790('0x62')};if(_0x3dea8d[_0x3790('0x5d')]['id']){delete _0x3dea8d['body']['id'];}_0x3dea8d['body'][_0x3790('0x66')]=_0x3dea8d['body']['UserId']||_0x3dea8d[_0x3790('0x67')]['id'];_0x5030be[_0x3790('0x68')]['id']=_0x3dea8d[_0x3790('0x5d')]['UserId'];return db[_0x3790('0x41')][_0x3790('0x5b')]({'where':{'id':_0x3dea8d[_0x3790('0x5a')]['id'],'UserId':null}})[_0x3790('0x24')](handleEntityNotFound(_0x484375,null))[_0x3790('0x24')](function(_0x2fdb47){if(_0x2fdb47){_0x5030be['message']=_0x2fdb47[_0x3790('0x69')]({'plain':!![]});return db[_0x3790('0x6a')][_0x3790('0x5b')]({'where':{'id':_0x2fdb47['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x484375,null))['then'](function(_0x30ec96){if(_0x30ec96){_0x5030be[_0x3790('0x6e')]=_0x30ec96[_0x3790('0x69')]({'plain':!![]});interaction_log[_0x3790('0x25')](_0x3790('0x7f'),_0x3dea8d[_0x3790('0x67')]['id'],_0x3dea8d['user'][_0x3790('0x3d')],_0x3dea8d[_0x3790('0x67')]['role'],_0x5030be[_0x3790('0x6e')]['id'],_0x3dea8d['body']?JSON[_0x3790('0x29')](_0x3dea8d[_0x3790('0x5d')]):_0x3790('0x80'));return respondWithRpcPromise(_0x3790('0x81'),_0x3790('0x82'),_0x5030be);}return null;})[_0x3790('0x24')](function(_0x17c7d5){var _0x64438b=_0x3790('0x71')+_0x17c7d5[_0x3790('0x2c')][_0x3790('0x72')];return db[_0x3790('0x83')][_0x3790('0x47')](_0x64438b,{'type':db[_0x3790('0x73')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x309fc0){return _0x309fc0;});})['then'](function(_0x18fb34){if(_0x18fb34){_0x5030be[_0x3790('0x2c')][_0x3790('0x84')]=_0x18fb34[0x0];if(!_0x3dea8d['body']['UserId'])return;return db['User'][_0x3790('0x5b')]({'where':{'id':_0x3dea8d['body']['UserId'],'role':_0x3790('0x68')},'attributes':['id','name',_0x3790('0x76'),'email',_0x3790('0x77')],'raw':!![]});}return null;})[_0x3790('0x24')](function(_0x1bf6c6){if(!_0x1bf6c6)return null;_0x5030be[_0x3790('0x2c')]['agent']=_0x1bf6c6;return _0x5030be;})[_0x3790('0x24')](function(_0xa0193f){if(_0xa0193f){_0xa0193f['message'][_0x3790('0x79')]=util['format'](_0x3790('0x85'),_0x3dea8d[_0x3790('0x67')]['name']);_0xa0193f[_0x3790('0x2c')]['channel']=_0x5030be[_0x3790('0x7a')];_0xa0193f['message'][_0x3790('0x7b')]=_0x5030be[_0x3790('0x7a')];_0xa0193f[_0x3790('0x2c')][_0x3790('0x86')]='reject';respondWithRpcPromise(_0x3790('0x7c'),_0x3790('0x7c'),{'event':'rejectmessage','message':_[_0x3790('0x53')](_0x5030be[_0x3790('0x2c')],JSON[_0x3790('0x87')](_0x5030be[_0x3790('0x6e')][_0x3790('0x7e')]))},client9002);return _0x5030be;}return null;})[_0x3790('0x24')](respondWithResult(_0x484375,null))[_0x3790('0x2f')](handleError(_0x484375,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5c39c8e..916ebc8 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 _0xe174=['../../mysqldb','ChatMessage','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe174,0x1b7));var _0x4e17=function(_0xee4bb8,_0x23b2ae){_0xee4bb8=_0xee4bb8-0x0;var _0xa0c0be=_0xe174[_0xee4bb8];return _0xa0c0be;};'use strict';var EventEmitter=require(_0x4e17('0x0'));var ChatMessage=require(_0x4e17('0x1'))['db'][_0x4e17('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4e17('0x3')](0x0);var events={'afterCreate':_0x4e17('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c9122){return function(_0x44f3e6,_0x2cf4bf,_0xd02cbe){ChatMessageEvents[_0x4e17('0x5')](_0x4c9122+':'+_0x44f3e6['id'],_0x44f3e6);ChatMessageEvents[_0x4e17('0x5')](_0x4c9122,_0x44f3e6);_0xd02cbe(null);};}for(var e in events){if(events[_0x4e17('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x4e17('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x5b00=['setMaxListeners','save','hasOwnProperty','hook','exports','events','ChatMessage'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0x5b00,0x101));var _0x05b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b00[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x05b0('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x05b0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x05b0('0x2')](0x0);var events={'afterCreate':_0x05b0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xa1188a){return function(_0x345f58,_0x1b371e,_0x262851){ChatMessageEvents['emit'](_0xa1188a+':'+_0x345f58['id'],_0x345f58);ChatMessageEvents['emit'](_0xa1188a,_0x345f58);_0x262851(null);};}for(var e in events){if(events[_0x05b0('0x4')](e)){var event=events[e];ChatMessage[_0x05b0('0x5')](e,emitEvent(event));}}module[_0x05b0('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f58c7ac..1144cbb 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 _0x8646=['ChatMessage','chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','findOne','ChatInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x31a8d4,_0x1f9a85){var _0x57cd33=function(_0x3ca875){while(--_0x3ca875){_0x31a8d4['push'](_0x31a8d4['shift']());}};_0x57cd33(++_0x1f9a85);}(_0x8646,0xf1));var _0x6864=function(_0x22c880,_0x392465){_0x22c880=_0x22c880-0x0;var _0x5b193d=_0x8646[_0x22c880];return _0x5b193d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6864('0x0'))(_0x6864('0x1'));var moment=require(_0x6864('0x2'));var BPromise=require(_0x6864('0x3'));var rp=require(_0x6864('0x4'));var fs=require('fs');var path=require(_0x6864('0x5'));var rimraf=require(_0x6864('0x6'));var config=require(_0x6864('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x1e0b07,_0x5a5d6b){return _0x1e0b07[_0x6864('0x8')](_0x6864('0x9'),attributes,{'tableName':_0x6864('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x6864('0xb')],'type':_0x6864('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfbc65f,_0x280c00,_0x210a24){var _0x36530f=_0x1e0b07[_0x6864('0xd')];var _0x31b709=_0xfbc65f['get']({'plain':!![]});if(_0x31b709[_0x6864('0xe')][_0x6864('0xf')]()==='in'||_0x31b709[_0x6864('0xe')]['toLowerCase']()===_0x6864('0x10')&&!_0x31b709['secret']&&!_[_0x6864('0x11')](_0x31b709[_0x6864('0x12')])){_0x36530f['ChatInteraction'][_0x6864('0x13')]({'where':{'id':_0x31b709[_0x6864('0x14')]}})['then'](function(_0x476677){if(_0x476677){_0x476677[_0x6864('0x15')]({'lastMsgAt':_0x31b709['createdAt'],'lastMsgDirection':_0x31b709[_0x6864('0xe')][_0x6864('0xf')]()});}})['catch'](function(_0x5cf9f2){console[_0x6864('0x16')](_0x5cf9f2);});}_0x210a24();}},'charset':_0x6864('0x17'),'collate':_0x6864('0x18')});}; \ No newline at end of file +var _0xe14b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x505810,_0x217166){var _0x34e8aa=function(_0x35c3a7){while(--_0x35c3a7){_0x505810['push'](_0x505810['shift']());}};_0x34e8aa(++_0x217166);}(_0xe14b,0xb8));var _0xbe14=function(_0x3435ac,_0x280230){_0x3435ac=_0x3435ac-0x0;var _0x3c7261=_0xe14b[_0x3435ac];return _0x3c7261;};'use strict';var _=require(_0xbe14('0x0'));var util=require('util');var logger=require(_0xbe14('0x1'))(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require(_0xbe14('0x4'));var rp=require(_0xbe14('0x5'));var fs=require('fs');var path=require(_0xbe14('0x6'));var rimraf=require(_0xbe14('0x7'));var config=require(_0xbe14('0x8'));var attributes=require(_0xbe14('0x9'));module[_0xbe14('0xa')]=function(_0x70e349,_0x1fc14d){return _0x70e349[_0xbe14('0xb')](_0xbe14('0xc'),attributes,{'tableName':_0xbe14('0xd'),'paranoid':![],'indexes':[{'name':_0xbe14('0xe'),'fields':[_0xbe14('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x105fda,_0x1cc188,_0x3bda94){var _0x256f1a=_0x70e349['models'];var _0x54a1ea=_0x105fda[_0xbe14('0x10')]({'plain':!![]});if(_0x54a1ea['direction']['toLowerCase']()==='in'||_0x54a1ea[_0xbe14('0x11')][_0xbe14('0x12')]()===_0xbe14('0x13')&&!_0x54a1ea[_0xbe14('0x14')]&&!_[_0xbe14('0x15')](_0x54a1ea[_0xbe14('0x16')])){_0x256f1a[_0xbe14('0x17')][_0xbe14('0x18')]({'where':{'id':_0x54a1ea[_0xbe14('0x19')]}})[_0xbe14('0x1a')](function(_0x545c9e){if(_0x545c9e){_0x545c9e[_0xbe14('0x1b')]({'lastMsgAt':_0x54a1ea[_0xbe14('0x1c')],'lastMsgDirection':_0x54a1ea[_0xbe14('0x11')][_0xbe14('0x12')]()});}})[_0xbe14('0x1d')](function(_0x4da916){console['error'](_0x4da916);});}_0x3bda94();}},'charset':'utf8mb4','collate':_0xbe14('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b5ddcbe..d79d097 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 _0x8331=['client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b4210,_0x521514){var _0x5b5b93=function(_0x2a3140){while(--_0x2a3140){_0x2b4210['push'](_0x2b4210['shift']());}};_0x5b5b93(++_0x521514);}(_0x8331,0xff));var _0x1833=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x8331[_0x454018];return _0x24697d;};'use strict';var _=require(_0x1833('0x0'));var util=require('util');var moment=require(_0x1833('0x1'));var BPromise=require(_0x1833('0x2'));var rs=require(_0x1833('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1833('0x4'));var logger=require(_0x1833('0x5'))(_0x1833('0x6'));var config=require(_0x1833('0x7'));var jayson=require(_0x1833('0x8'));var client=jayson[_0x1833('0x9')]['http']({'port':0x232a});config[_0x1833('0xa')]=_['defaults'](config[_0x1833('0xa')],{'host':_0x1833('0xb'),'port':0x18eb});var socket=require(_0x1833('0xc'))(new Redis(config[_0x1833('0xa')]));require(_0x1833('0xd'))[_0x1833('0xe')](socket);function respondWithRpcPromise(_0x2268d9,_0x6c25db,_0x147235){return new BPromise(function(_0x1c1bd4,_0x55ccbd){return client[_0x1833('0xf')](_0x2268d9,_0x147235)[_0x1833('0x10')](function(_0x1770b6){logger[_0x1833('0x11')](_0x1833('0x12'),_0x6c25db,'request\x20sent');logger[_0x1833('0x13')](_0x1833('0x14'),_0x6c25db,_0x1833('0x15'),JSON[_0x1833('0x16')](_0x1770b6));if(_0x1770b6[_0x1833('0x17')]){if(_0x1770b6['error'][_0x1833('0x18')]===0x1f4){logger[_0x1833('0x17')](_0x1833('0x12'),_0x6c25db,_0x1770b6['error']['message']);return _0x55ccbd(_0x1770b6[_0x1833('0x17')][_0x1833('0x19')]);}logger[_0x1833('0x17')](_0x1833('0x12'),_0x6c25db,_0x1770b6['error']['message']);return _0x1c1bd4(_0x1770b6[_0x1833('0x17')]['message']);}else{logger['info'](_0x1833('0x12'),_0x6c25db,_0x1833('0x15'));_0x1c1bd4(_0x1770b6[_0x1833('0x1a')]['message']);}})[_0x1833('0x1b')](function(_0x22c2b2){logger[_0x1833('0x17')]('ChatMessage,\x20%s,\x20%s',_0x6c25db,_0x22c2b2);_0x55ccbd(_0x22c2b2);});});}exports['CreateChatMessage']=function(_0x351107){var _0x4383e3=this;return new Promise(function(_0x34cd2b,_0x1c7321){return db[_0x1833('0x1c')][_0x1833('0x1d')](_0x351107[_0x1833('0x1e')],{'raw':_0x351107[_0x1833('0x1f')]?_0x351107[_0x1833('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x1833('0x10')](function(_0x3cbe6a){logger[_0x1833('0x11')](_0x1833('0x20'),_0x351107);logger[_0x1833('0x13')](_0x1833('0x20'),_0x351107,JSON[_0x1833('0x16')](_0x3cbe6a));_0x34cd2b(_0x3cbe6a);})['catch'](function(_0x582ec8){logger[_0x1833('0x17')]('CreateChatMessage',_0x582ec8['message'],_0x351107);_0x1c7321(_0x4383e3[_0x1833('0x17')](0x1f4,_0x582ec8[_0x1833('0x19')]));});});}; \ No newline at end of file +var _0xa681=['register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','CreateChatMessage','ChatMessage','body','options','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatMessage.socket'];(function(_0x2fa6ec,_0x3a59cb){var _0x59ecf7=function(_0x1d01b1){while(--_0x1d01b1){_0x2fa6ec['push'](_0x2fa6ec['shift']());}};_0x59ecf7(++_0x3a59cb);}(_0xa681,0x6a));var _0x1a68=function(_0x5a4226,_0x2f577c){_0x5a4226=_0x5a4226-0x0;var _0x1cf0e8=_0xa681[_0x5a4226];return _0x1cf0e8;};'use strict';var _=require(_0x1a68('0x0'));var util=require('util');var moment=require(_0x1a68('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a68('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a68('0x3'))['db'];var utils=require(_0x1a68('0x4'));var logger=require(_0x1a68('0x5'))(_0x1a68('0x6'));var config=require(_0x1a68('0x7'));var jayson=require(_0x1a68('0x8'));var client=jayson[_0x1a68('0x9')]['http']({'port':0x232a});config[_0x1a68('0xa')]=_[_0x1a68('0xb')](config[_0x1a68('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a68('0xc'))(new Redis(config[_0x1a68('0xa')]));require(_0x1a68('0xd'))[_0x1a68('0xe')](socket);function respondWithRpcPromise(_0x5ad57d,_0x561fc5,_0x148d5e){return new BPromise(function(_0x320000,_0x435664){return client[_0x1a68('0xf')](_0x5ad57d,_0x148d5e)['then'](function(_0x44b865){logger['info'](_0x1a68('0x10'),_0x561fc5,_0x1a68('0x11'));logger[_0x1a68('0x12')](_0x1a68('0x13'),_0x561fc5,_0x1a68('0x11'),JSON[_0x1a68('0x14')](_0x44b865));if(_0x44b865['error']){if(_0x44b865['error'][_0x1a68('0x15')]===0x1f4){logger[_0x1a68('0x16')](_0x1a68('0x10'),_0x561fc5,_0x44b865[_0x1a68('0x16')][_0x1a68('0x17')]);return _0x435664(_0x44b865[_0x1a68('0x16')][_0x1a68('0x17')]);}logger[_0x1a68('0x16')](_0x1a68('0x10'),_0x561fc5,_0x44b865[_0x1a68('0x16')]['message']);return _0x320000(_0x44b865['error'][_0x1a68('0x17')]);}else{logger[_0x1a68('0x18')](_0x1a68('0x10'),_0x561fc5,_0x1a68('0x11'));_0x320000(_0x44b865['result']['message']);}})[_0x1a68('0x19')](function(_0x60b3e3){logger[_0x1a68('0x16')](_0x1a68('0x10'),_0x561fc5,_0x60b3e3);_0x435664(_0x60b3e3);});});}exports[_0x1a68('0x1a')]=function(_0x2f4339){var _0x31dd1a=this;return new Promise(function(_0x4dd80b,_0x2f5eed){return db[_0x1a68('0x1b')]['create'](_0x2f4339[_0x1a68('0x1c')],{'raw':_0x2f4339[_0x1a68('0x1d')]?_0x2f4339[_0x1a68('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x49b911){logger['info'](_0x1a68('0x1a'),_0x2f4339);logger[_0x1a68('0x12')](_0x1a68('0x1a'),_0x2f4339,JSON['stringify'](_0x49b911));_0x4dd80b(_0x49b911);})[_0x1a68('0x19')](function(_0x21676c){logger[_0x1a68('0x16')](_0x1a68('0x1a'),_0x21676c[_0x1a68('0x17')],_0x2f4339);_0x2f5eed(_0x31dd1a['error'](0x1f4,_0x21676c[_0x1a68('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7364655..5d149f2 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 _0xa7e6=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x3ba89a,_0x34affe){var _0x50bd58=function(_0xa01b75){while(--_0xa01b75){_0x3ba89a['push'](_0x3ba89a['shift']());}};_0x50bd58(++_0x34affe);}(_0xa7e6,0x74));var _0x6a7e=function(_0x119769,_0x32865d){_0x119769=_0x119769-0x0;var _0x105c19=_0xa7e6[_0x119769];return _0x105c19;};'use strict';var ChatMessageEvents=require(_0x6a7e('0x0'));var events=[_0x6a7e('0x1'),_0x6a7e('0x2'),_0x6a7e('0x3')];function createListener(_0x67fa72,_0x21c1de){return function(_0x4c809c){_0x21c1de[_0x6a7e('0x4')](_0x67fa72,_0x4c809c);};}function removeListener(_0x8787b5,_0x1ea310){return function(){ChatMessageEvents[_0x6a7e('0x5')](_0x8787b5,_0x1ea310);};}exports[_0x6a7e('0x6')]=function(_0x599006){for(var _0x79df6f=0x0,_0x16249d=events[_0x6a7e('0x7')];_0x79df6f<_0x16249d;_0x79df6f++){var _0x342c96=events[_0x79df6f];var _0x45e92e=createListener(_0x6a7e('0x8')+_0x342c96,_0x599006);ChatMessageEvents['on'](_0x342c96,_0x45e92e);}}; \ No newline at end of file +var _0x85d0=['emit','register','length','chatMessage:'];(function(_0x28dbeb,_0x2f8c0c){var _0x4b7d7c=function(_0x24f682){while(--_0x24f682){_0x28dbeb['push'](_0x28dbeb['shift']());}};_0x4b7d7c(++_0x2f8c0c);}(_0x85d0,0x164));var _0x085d=function(_0x9002d1,_0x4eabc1){_0x9002d1=_0x9002d1-0x0;var _0xceb3a5=_0x85d0[_0x9002d1];return _0xceb3a5;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x297001,_0x1716e5){return function(_0xfd8773){_0x1716e5[_0x085d('0x0')](_0x297001,_0xfd8773);};}function removeListener(_0x231765,_0x19ae4c){return function(){ChatMessageEvents['removeListener'](_0x231765,_0x19ae4c);};}exports[_0x085d('0x1')]=function(_0x5c917f){for(var _0x364f09=0x0,_0x9acc97=events[_0x085d('0x2')];_0x364f09<_0x9acc97;_0x364f09++){var _0x4a12b7=events[_0x364f09];var _0xf65d01=createListener(_0x085d('0x3')+_0x4a12b7,_0x5c917f);ChatMessageEvents['on'](_0x4a12b7,_0xf65d01);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 46d16c4..ab1aaf1 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 _0xcf9f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','show','tracked','chat','chatmessage:create','create','put','/:id','update','/:id/accept','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5f158a,_0x380823){var _0x3ffb26=function(_0x5c71f3){while(--_0x5c71f3){_0x5f158a['push'](_0x5f158a['shift']());}};_0x3ffb26(++_0x380823);}(_0xcf9f,0x182));var _0xfcf9=function(_0x577298,_0x351f89){_0x577298=_0x577298-0x0;var _0x42c0b0=_0xcf9f[_0x577298];return _0x42c0b0;};'use strict';var multer=require(_0xfcf9('0x0'));var util=require(_0xfcf9('0x1'));var path=require(_0xfcf9('0x2'));var timeout=require(_0xfcf9('0x3'));var express=require(_0xfcf9('0x4'));var router=express[_0xfcf9('0x5')]();var fs_extra=require(_0xfcf9('0x6'));var auth=require(_0xfcf9('0x7'));var interaction=require(_0xfcf9('0x8'));var config=require('../../config/environment');var controller=require(_0xfcf9('0x9'));router[_0xfcf9('0xa')]('/',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0xc')]);router['get']('/describe',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0xd')]);router[_0xfcf9('0xa')]('/:id',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0xe')]);router['post']('/',auth[_0xfcf9('0xb')](),interaction[_0xfcf9('0xf')](_0xfcf9('0x10'),_0xfcf9('0x11')),controller[_0xfcf9('0x12')]);router[_0xfcf9('0x13')](_0xfcf9('0x14'),controller[_0xfcf9('0x15')]);router[_0xfcf9('0x13')](_0xfcf9('0x16'),auth[_0xfcf9('0xb')](),controller['accept']);router[_0xfcf9('0x13')]('/:id/reject',auth[_0xfcf9('0xb')](),controller[_0xfcf9('0x17')]);router['delete'](_0xfcf9('0x14'),auth['isAuthenticated'](),controller[_0xfcf9('0x18')]);module[_0xfcf9('0x19')]=router; \ No newline at end of file +var _0x586a=['reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','isAuthenticated','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0xd351b8,_0x410fa3){var _0x3f8a1c=function(_0x55c53e){while(--_0x55c53e){_0xd351b8['push'](_0xd351b8['shift']());}};_0x3f8a1c(++_0x410fa3);}(_0x586a,0x17e));var _0xa586=function(_0x1ad1b0,_0x1a3f63){_0x1ad1b0=_0x1ad1b0-0x0;var _0x505f3d=_0x586a[_0x1ad1b0];return _0x505f3d;};'use strict';var multer=require(_0xa586('0x0'));var util=require('util');var path=require(_0xa586('0x1'));var timeout=require(_0xa586('0x2'));var express=require('express');var router=express[_0xa586('0x3')]();var fs_extra=require(_0xa586('0x4'));var auth=require(_0xa586('0x5'));var interaction=require(_0xa586('0x6'));var config=require(_0xa586('0x7'));var controller=require(_0xa586('0x8'));router[_0xa586('0x9')]('/',auth['isAuthenticated'](),controller[_0xa586('0xa')]);router[_0xa586('0x9')]('/describe',auth[_0xa586('0xb')](),controller['describe']);router['get'](_0xa586('0xc'),auth['isAuthenticated'](),controller[_0xa586('0xd')]);router['post']('/',auth[_0xa586('0xb')](),interaction[_0xa586('0xe')](_0xa586('0xf'),_0xa586('0x10')),controller[_0xa586('0x11')]);router[_0xa586('0x12')](_0xa586('0xc'),controller[_0xa586('0x13')]);router[_0xa586('0x12')](_0xa586('0x14'),auth[_0xa586('0xb')](),controller[_0xa586('0x15')]);router[_0xa586('0x12')](_0xa586('0x16'),auth[_0xa586('0xb')](),controller[_0xa586('0x17')]);router[_0xa586('0x18')]('/:id',auth[_0xa586('0xb')](),controller[_0xa586('0x19')]);module[_0xa586('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f0239cc..d93c9bd 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0b0e,0x187));var _0xe0b0=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0x0b0e[_0x58db4e];return _0x40139a;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0x0b0e[_0x5d3903];return _0x4b8bc9;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 16f53eb..f954f7a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x7a54,0x106));var _0x47a5=function(_0x49ab41,_0x501330){_0x49ab41=_0x49ab41-0x0;var _0x5074c7=_0x7a54[_0x49ab41];return _0x5074c7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x5b071c,_0xce5722){var _0x25a469=function(_0x5ce1ed){while(--_0x5ce1ed){_0x5b071c['push'](_0x5b071c['shift']());}};_0x25a469(++_0xce5722);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['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 bccc91d..b84171e 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 _0x7850=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','update','remove'];(function(_0x3c4e48,_0x43a5eb){var _0x37fd7e=function(_0x27aa2b){while(--_0x27aa2b){_0x3c4e48['push'](_0x3c4e48['shift']());}};_0x37fd7e(++_0x43a5eb);}(_0x7850,0x1e1));var _0x0785=function(_0x4fccba,_0x594ed0){_0x4fccba=_0x4fccba-0x0;var _0x4ec9a0=_0x7850[_0x4fccba];return _0x4ec9a0;};'use strict';var EventEmitter=require(_0x0785('0x0'));var ChatOfflineMessage=require(_0x0785('0x1'))['db'][_0x0785('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0785('0x3'),'afterDestroy':_0x0785('0x4')};function emitEvent(_0x59a055){return function(_0x2e5c97,_0x24bbd3,_0x20385a){ChatOfflineMessageEvents[_0x0785('0x5')](_0x59a055+':'+_0x2e5c97['id'],_0x2e5c97);ChatOfflineMessageEvents[_0x0785('0x5')](_0x59a055,_0x2e5c97);_0x20385a(null);};}for(var e in events){if(events[_0x0785('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x0785('0x7')](e,emitEvent(event));}}module[_0x0785('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x441d=['save','update','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x39efad,_0x4d6ba9){var _0x1aa8b9=function(_0x3ebf0c){while(--_0x3ebf0c){_0x39efad['push'](_0x39efad['shift']());}};_0x1aa8b9(++_0x4d6ba9);}(_0x441d,0x17e));var _0xd441=function(_0x1b9a60,_0x4ae894){_0x1b9a60=_0x1b9a60-0x0;var _0x3a7c14=_0x441d[_0x1b9a60];return _0x3a7c14;};'use strict';var EventEmitter=require(_0xd441('0x0'));var ChatOfflineMessage=require(_0xd441('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xd441('0x2')](0x0);var events={'afterCreate':_0xd441('0x3'),'afterUpdate':_0xd441('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a8b0e){return function(_0x4824af,_0x41e1de,_0x4dd85b){ChatOfflineMessageEvents[_0xd441('0x5')](_0x3a8b0e+':'+_0x4824af['id'],_0x4824af);ChatOfflineMessageEvents[_0xd441('0x5')](_0x3a8b0e,_0x4824af);_0x4dd85b(null);};}for(var e in events){if(events[_0xd441('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 10d3d13..0ab2383 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 _0x48c0=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x10e084,_0xf761e1){var _0x4ca640=function(_0x196aa3){while(--_0x196aa3){_0x10e084['push'](_0x10e084['shift']());}};_0x4ca640(++_0xf761e1);}(_0x48c0,0x1b9));var _0x048c=function(_0x509572,_0x5c4ee9){_0x509572=_0x509572-0x0;var _0x579f64=_0x48c0[_0x509572];return _0x579f64;};'use strict';var attributes=require(_0x048c('0x0'));module[_0x048c('0x1')]=function(_0x424c4e){return _0x424c4e['define'](_0x048c('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x048c('0x3')});}; \ No newline at end of file +var _0xebb2=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','ChatOfflineMessage'];(function(_0x5e13af,_0x5461e0){var _0x3dbfa0=function(_0x44c302){while(--_0x44c302){_0x5e13af['push'](_0x5e13af['shift']());}};_0x3dbfa0(++_0x5461e0);}(_0xebb2,0x1ac));var _0x2ebb=function(_0x512c46,_0x2ab926){_0x512c46=_0x512c46-0x0;var _0x128bee=_0xebb2[_0x512c46];return _0x128bee;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x2ebb('0x0')]=function(_0x4eb01c){return _0x4eb01c['define'](_0x2ebb('0x1'),attributes,{'tableName':_0x2ebb('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ebb('0x3'),'collate':_0x2ebb('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e558b4b..b7a7859 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 _0xc3d6=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x38f5b6,_0x5f0777){var _0x43149f=function(_0x36c387){while(--_0x36c387){_0x38f5b6['push'](_0x38f5b6['shift']());}};_0x43149f(++_0x5f0777);}(_0xc3d6,0x153));var _0x6c3d=function(_0x585554,_0x1f84c7){_0x585554=_0x585554-0x0;var _0x34a185=_0xc3d6[_0x585554];return _0x34a185;};'use strict';var _=require(_0x6c3d('0x0'));var util=require(_0x6c3d('0x1'));var moment=require(_0x6c3d('0x2'));var BPromise=require(_0x6c3d('0x3'));var rs=require(_0x6c3d('0x4'));var fs=require('fs');var Redis=require(_0x6c3d('0x5'));var db=require(_0x6c3d('0x6'))['db'];var utils=require(_0x6c3d('0x7'));var logger=require(_0x6c3d('0x8'))(_0x6c3d('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c3d('0xa'));var client=jayson['client'][_0x6c3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5058e2,_0x74763,_0x35c1aa){return new BPromise(function(_0x3fbfc3,_0x7d4b89){return client[_0x6c3d('0xc')](_0x5058e2,_0x35c1aa)[_0x6c3d('0xd')](function(_0x2b251f){logger[_0x6c3d('0xe')](_0x6c3d('0xf'),_0x74763,'request\x20sent');logger[_0x6c3d('0x10')](_0x6c3d('0x11'),_0x74763,'request\x20sent',JSON[_0x6c3d('0x12')](_0x2b251f));if(_0x2b251f[_0x6c3d('0x13')]){if(_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x14')]===0x1f4){logger[_0x6c3d('0x13')](_0x6c3d('0xf'),_0x74763,_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);return _0x7d4b89(_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);}logger['error'](_0x6c3d('0xf'),_0x74763,_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);return _0x3fbfc3(_0x2b251f[_0x6c3d('0x13')][_0x6c3d('0x15')]);}else{logger[_0x6c3d('0xe')](_0x6c3d('0xf'),_0x74763,_0x6c3d('0x16'));_0x3fbfc3(_0x2b251f[_0x6c3d('0x17')][_0x6c3d('0x15')]);}})[_0x6c3d('0x18')](function(_0x5731fa){logger[_0x6c3d('0x13')](_0x6c3d('0xf'),_0x74763,_0x5731fa);_0x7d4b89(_0x5731fa);});});} \ No newline at end of file +var _0xe107=['then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x5ca78b,_0x2928fa){var _0x130d4c=function(_0x25659e){while(--_0x25659e){_0x5ca78b['push'](_0x5ca78b['shift']());}};_0x130d4c(++_0x2928fa);}(_0xe107,0xb3));var _0x7e10=function(_0x45c22c,_0x3b2fa8){_0x45c22c=_0x45c22c-0x0;var _0x4bd07f=_0xe107[_0x45c22c];return _0x4bd07f;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var moment=require(_0x7e10('0x1'));var BPromise=require(_0x7e10('0x2'));var rs=require(_0x7e10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e10('0x5'));var config=require(_0x7e10('0x6'));var jayson=require(_0x7e10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd3de,_0x7378b3,_0x156c56){return new BPromise(function(_0x3413f7,_0x493958){return client['request'](_0x1dd3de,_0x156c56)[_0x7e10('0x8')](function(_0x490a7a){logger['info'](_0x7e10('0x9'),_0x7378b3,_0x7e10('0xa'));logger[_0x7e10('0xb')](_0x7e10('0xc'),_0x7378b3,_0x7e10('0xa'),JSON['stringify'](_0x490a7a));if(_0x490a7a[_0x7e10('0xd')]){if(_0x490a7a['error'][_0x7e10('0xe')]===0x1f4){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a['error'][_0x7e10('0xf')]);return _0x493958(_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);}logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);return _0x3413f7(_0x490a7a[_0x7e10('0xd')]['message']);}else{logger[_0x7e10('0x10')](_0x7e10('0x9'),_0x7378b3,'request\x20sent');_0x3413f7(_0x490a7a['result'][_0x7e10('0xf')]);}})['catch'](function(_0xe1abd2){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0xe1abd2);_0x493958(_0xe1abd2);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 17777dc..54590d8 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 _0xecfd=['delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x5a474d,_0x3c85e2){var _0x512f2a=function(_0x2f6669){while(--_0x2f6669){_0x5a474d['push'](_0x5a474d['shift']());}};_0x512f2a(++_0x3c85e2);}(_0xecfd,0x1d6));var _0xdecf=function(_0x275709,_0x51f458){_0x275709=_0x275709-0x0;var _0x20bafb=_0xecfd[_0x275709];return _0x20bafb;};'use strict';var multer=require(_0xdecf('0x0'));var util=require(_0xdecf('0x1'));var path=require(_0xdecf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdecf('0x3'));var auth=require(_0xdecf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdecf('0x5'));var controller=require(_0xdecf('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdecf('0x7')](_0xdecf('0x8'),auth[_0xdecf('0x9')](),controller['describe']);router['get'](_0xdecf('0xa'),auth[_0xdecf('0x9')](),controller[_0xdecf('0xb')]);router[_0xdecf('0xc')]('/',auth['isAuthenticated'](),controller[_0xdecf('0xd')]);router[_0xdecf('0xe')]('/:id',auth[_0xdecf('0x9')](),controller[_0xdecf('0xf')]);router[_0xdecf('0x10')](_0xdecf('0xa'),auth[_0xdecf('0x9')](),controller[_0xdecf('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfc87=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','post','create','put','update','delete','destroy','multer'];(function(_0x4cfe90,_0x3da8fb){var _0x13591e=function(_0x3f1281){while(--_0x3f1281){_0x4cfe90['push'](_0x4cfe90['shift']());}};_0x13591e(++_0x3da8fb);}(_0xfc87,0xf1));var _0x7fc8=function(_0x373468,_0x2aefd3){_0x373468=_0x373468-0x0;var _0x4b58f7=_0xfc87[_0x373468];return _0x4b58f7;};'use strict';var multer=require(_0x7fc8('0x0'));var util=require(_0x7fc8('0x1'));var path=require(_0x7fc8('0x2'));var timeout=require(_0x7fc8('0x3'));var express=require(_0x7fc8('0x4'));var router=express[_0x7fc8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7fc8('0x6'));var interaction=require(_0x7fc8('0x7'));var config=require(_0x7fc8('0x8'));var controller=require(_0x7fc8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7fc8('0xa')]);router['get'](_0x7fc8('0xb'),auth[_0x7fc8('0xc')](),controller[_0x7fc8('0xd')]);router[_0x7fc8('0xe')](_0x7fc8('0xf'),auth[_0x7fc8('0xc')](),controller['show']);router[_0x7fc8('0x10')]('/',auth[_0x7fc8('0xc')](),controller[_0x7fc8('0x11')]);router[_0x7fc8('0x12')]('/:id',auth[_0x7fc8('0xc')](),controller[_0x7fc8('0x13')]);router[_0x7fc8('0x14')](_0x7fc8('0xf'),auth['isAuthenticated'](),controller[_0x7fc8('0x15')]);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 f4038a5..be86c9c 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 _0xd73c=['ENUM','mouseOver','INTEGER','STRING'];(function(_0x166e8d,_0x16181b){var _0x287e90=function(_0x5233a0){while(--_0x5233a0){_0x166e8d['push'](_0x166e8d['shift']());}};_0x287e90(++_0x16181b);}(_0xd73c,0x11b));var _0xcd73=function(_0x581e92,_0x34f32f){_0x581e92=_0x581e92-0x0;var _0xaf08d4=_0xd73c[_0x581e92];return _0xaf08d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcd73('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcd73('0x1')]('mouseOver','timeout'),'defaultValue':_0xcd73('0x2')},'selector':{'type':Sequelize[_0xcd73('0x0')]},'timeout':{'type':Sequelize[_0xcd73('0x3')]}}; \ No newline at end of file +var _0xffee=['STRING','mouseOver','timeout','sequelize'];(function(_0x167b70,_0x3addd4){var _0x19a768=function(_0x28053f){while(--_0x28053f){_0x167b70['push'](_0x167b70['shift']());}};_0x19a768(++_0x3addd4);}(_0xffee,0x1a3));var _0xeffe=function(_0x6320f2,_0x114d7a){_0x6320f2=_0x6320f2-0x0;var _0x588fa3=_0xffee[_0x6320f2];return _0x588fa3;};'use strict';var Sequelize=require(_0xeffe('0x0'));module['exports']={'name':{'type':Sequelize[_0xeffe('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xeffe('0x2'),_0xeffe('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xeffe('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 5250a8b..10b5d7d 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 _0x04de=['query','keys','filters','intersection','attributes','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','params','model','rawAttributes'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x04de,0x107));var _0xe04d=function(_0xf9936a,_0x3f2f70){_0xf9936a=_0xf9936a-0x0;var _0x234dee=_0x04de[_0xf9936a];return _0x234dee;};'use strict';var emlformat=require(_0xe04d('0x0'));var rimraf=require(_0xe04d('0x1'));var zipdir=require(_0xe04d('0x2'));var jsonpatch=require(_0xe04d('0x3'));var rp=require(_0xe04d('0x4'));var moment=require(_0xe04d('0x5'));var BPromise=require(_0xe04d('0x6'));var Mustache=require(_0xe04d('0x7'));var util=require(_0xe04d('0x8'));var path=require(_0xe04d('0x9'));var sox=require(_0xe04d('0xa'));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(_0xe04d('0xb'));var crypto=require(_0xe04d('0xc'));var jsforce=require(_0xe04d('0xd'));var deskjs=require(_0xe04d('0xe'));var toCsv=require(_0xe04d('0xf'));var querystring=require(_0xe04d('0x10'));var Papa=require(_0xe04d('0x11'));var Redis=require(_0xe04d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe04d('0x13'));var as=require(_0xe04d('0x14'));var hardwareService=require(_0xe04d('0x15'));var logger=require(_0xe04d('0x16'))(_0xe04d('0x17'));var utils=require(_0xe04d('0x18'));var config=require(_0xe04d('0x19'));var licenseUtil=require(_0xe04d('0x1a'));var db=require(_0xe04d('0x1b'))['db'];function respondWithStatusCode(_0x53f59a,_0x8bf2d2){_0x8bf2d2=_0x8bf2d2||0xcc;return function(_0x1d3f03){if(_0x1d3f03){return _0x53f59a[_0xe04d('0x1c')](_0x8bf2d2);}return _0x53f59a[_0xe04d('0x1d')](_0x8bf2d2)[_0xe04d('0x1e')]();};}function respondWithResult(_0xa2521,_0xf205f5){_0xf205f5=_0xf205f5||0xc8;return function(_0x143019){if(_0x143019){return _0xa2521[_0xe04d('0x1d')](_0xf205f5)[_0xe04d('0x1f')](_0x143019);}};}function respondWithFilteredResult(_0xbc5cc7,_0x1aa69b){return function(_0x5cfd5b){if(_0x5cfd5b){var _0x1f29a7=typeof _0x1aa69b['offset']===_0xe04d('0x20')&&typeof _0x1aa69b['limit']===_0xe04d('0x20');var _0xbd5fa1=_0x5cfd5b[_0xe04d('0x21')];var _0x93b107=_0x1f29a7?0x0:_0x1aa69b[_0xe04d('0x22')];var _0x35a2b4=_0x1f29a7?_0x5cfd5b[_0xe04d('0x21')]:_0x1aa69b[_0xe04d('0x22')]+_0x1aa69b[_0xe04d('0x23')];var _0x5d8a1e;if(_0x35a2b4>=_0xbd5fa1){_0x35a2b4=_0xbd5fa1;_0x5d8a1e=0xc8;}else{_0x5d8a1e=0xce;}_0xbc5cc7[_0xe04d('0x1d')](_0x5d8a1e);return _0xbc5cc7[_0xe04d('0x24')](_0xe04d('0x25'),_0x93b107+'-'+_0x35a2b4+'/'+_0xbd5fa1)[_0xe04d('0x1f')](_0x5cfd5b);}return null;};}function patchUpdates(_0x2ac847){return function(_0x34e15f){try{jsonpatch['apply'](_0x34e15f,_0x2ac847,!![]);}catch(_0x3b1f42){return BPromise[_0xe04d('0x26')](_0x3b1f42);}return _0x34e15f['save']();};}function saveUpdates(_0x4b4d8b,_0x5bcfc3){return function(_0x46fab1){if(_0x46fab1){return _0x46fab1['update'](_0x4b4d8b)['then'](function(_0x185d42){return _0x185d42;});}return null;};}function removeEntity(_0x26a869,_0x495f73){return function(_0x942d8a){if(_0x942d8a){return _0x942d8a['destroy']()[_0xe04d('0x27')](function(){_0x26a869['status'](0xcc)[_0xe04d('0x1e')]();});}};}function handleEntityNotFound(_0x456822,_0x48db4e){return function(_0x29ad33){if(!_0x29ad33){_0x456822[_0xe04d('0x1c')](0x194);}return _0x29ad33;};}function handleError(_0x51540e,_0x10aa20){_0x10aa20=_0x10aa20||0x1f4;return function(_0x3e43ca){logger[_0xe04d('0x28')](_0x3e43ca[_0xe04d('0x29')]);if(_0x3e43ca['name']){delete _0x3e43ca[_0xe04d('0x2a')];}_0x51540e[_0xe04d('0x1d')](_0x10aa20)[_0xe04d('0x2b')](_0x3e43ca);};}exports['show']=function(_0x187c29,_0x5a3899){var _0x4f5883={'raw':!![],'where':{'id':_0x187c29[_0xe04d('0x2c')]['id']}},_0x569e4b={};_0x569e4b[_0xe04d('0x2d')]=_['keys'](db['ChatProactiveAction'][_0xe04d('0x2e')]);_0x569e4b[_0xe04d('0x2f')]=_[_0xe04d('0x30')](_0x187c29['query']);_0x569e4b[_0xe04d('0x31')]=_[_0xe04d('0x32')](_0x569e4b['model'],_0x569e4b[_0xe04d('0x2f')]);_0x4f5883['attributes']=_[_0xe04d('0x32')](_0x569e4b[_0xe04d('0x2d')],qs['fields'](_0x187c29[_0xe04d('0x2f')]['fields']));_0x4f5883[_0xe04d('0x33')]=_0x4f5883[_0xe04d('0x33')][_0xe04d('0x34')]?_0x4f5883[_0xe04d('0x33')]:_0x569e4b[_0xe04d('0x2d')];if(_0x187c29[_0xe04d('0x2f')][_0xe04d('0x35')]){_0x4f5883['include']=[{'all':!![]}];}_0x4f5883=_[_0xe04d('0x36')]({},_0x4f5883,_0x187c29[_0xe04d('0x37')]);return db[_0xe04d('0x38')][_0xe04d('0x39')](_0x4f5883)[_0xe04d('0x27')](handleEntityNotFound(_0x5a3899,null))[_0xe04d('0x27')](respondWithResult(_0x5a3899,null))[_0xe04d('0x3a')](handleError(_0x5a3899,null));};exports[_0xe04d('0x3b')]=function(_0x26c6c5,_0x59ed1c){return db[_0xe04d('0x38')]['create'](_0x26c6c5[_0xe04d('0x3c')],{})['then'](respondWithResult(_0x59ed1c,0xc9))['catch'](handleError(_0x59ed1c,null));};exports[_0xe04d('0x3d')]=function(_0x9353a1,_0x261116){if(_0x9353a1[_0xe04d('0x3c')]['id']){delete _0x9353a1['body']['id'];}return db[_0xe04d('0x38')][_0xe04d('0x39')]({'where':{'id':_0x9353a1[_0xe04d('0x2c')]['id']}})[_0xe04d('0x27')](handleEntityNotFound(_0x261116,null))[_0xe04d('0x27')](saveUpdates(_0x9353a1['body'],null))['then'](respondWithResult(_0x261116,null))[_0xe04d('0x3a')](handleError(_0x261116,null));};exports['destroy']=function(_0x53c072,_0x23e4b2){return db[_0xe04d('0x38')][_0xe04d('0x39')]({'where':{'id':_0x53c072[_0xe04d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x23e4b2,null))['then'](removeEntity(_0x23e4b2,null))[_0xe04d('0x3a')](handleError(_0x23e4b2,null));}; \ No newline at end of file +var _0xac95=['fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','show','keys','ChatProactiveAction','query','filters','intersection','attributes','model','fields','includeAll','include','merge','options','find','then','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0xac95,0xa8));var _0x5ac9=function(_0x1fe027,_0x3be881){_0x1fe027=_0x1fe027-0x0;var _0x30b349=_0xac95[_0x1fe027];return _0x30b349;};'use strict';var emlformat=require(_0x5ac9('0x0'));var rimraf=require(_0x5ac9('0x1'));var zipdir=require(_0x5ac9('0x2'));var jsonpatch=require(_0x5ac9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ac9('0x4'));var Mustache=require(_0x5ac9('0x5'));var util=require('util');var path=require(_0x5ac9('0x6'));var sox=require(_0x5ac9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ac9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ac9('0x9'));var _=require(_0x5ac9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ac9('0xb'));var deskjs=require(_0x5ac9('0xc'));var toCsv=require(_0x5ac9('0xd'));var querystring=require(_0x5ac9('0xe'));var Papa=require(_0x5ac9('0xf'));var Redis=require(_0x5ac9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ac9('0x11'));var as=require(_0x5ac9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac9('0x13'))('api');var utils=require(_0x5ac9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5ac9('0x15'));var db=require(_0x5ac9('0x16'))['db'];function respondWithStatusCode(_0x371231,_0x40eb62){_0x40eb62=_0x40eb62||0xcc;return function(_0x4f9a04){if(_0x4f9a04){return _0x371231['sendStatus'](_0x40eb62);}return _0x371231[_0x5ac9('0x17')](_0x40eb62)['end']();};}function respondWithResult(_0x3a7d64,_0x364007){_0x364007=_0x364007||0xc8;return function(_0x50658c){if(_0x50658c){return _0x3a7d64[_0x5ac9('0x17')](_0x364007)[_0x5ac9('0x18')](_0x50658c);}};}function respondWithFilteredResult(_0x3f8fac,_0x122590){return function(_0x456ed9){if(_0x456ed9){var _0x2fe47e=typeof _0x122590[_0x5ac9('0x19')]===_0x5ac9('0x1a')&&typeof _0x122590[_0x5ac9('0x1b')]==='undefined';var _0x53a8db=_0x456ed9[_0x5ac9('0x1c')];var _0x193c56=_0x2fe47e?0x0:_0x122590[_0x5ac9('0x19')];var _0x4463ff=_0x2fe47e?_0x456ed9[_0x5ac9('0x1c')]:_0x122590[_0x5ac9('0x19')]+_0x122590[_0x5ac9('0x1b')];var _0x429bf3;if(_0x4463ff>=_0x53a8db){_0x4463ff=_0x53a8db;_0x429bf3=0xc8;}else{_0x429bf3=0xce;}_0x3f8fac[_0x5ac9('0x17')](_0x429bf3);return _0x3f8fac[_0x5ac9('0x1d')](_0x5ac9('0x1e'),_0x193c56+'-'+_0x4463ff+'/'+_0x53a8db)[_0x5ac9('0x18')](_0x456ed9);}return null;};}function patchUpdates(_0x2efa5f){return function(_0x479c6b){try{jsonpatch[_0x5ac9('0x1f')](_0x479c6b,_0x2efa5f,!![]);}catch(_0x1f5546){return BPromise[_0x5ac9('0x20')](_0x1f5546);}return _0x479c6b[_0x5ac9('0x21')]();};}function saveUpdates(_0x2d2ba5,_0x492679){return function(_0x45417d){if(_0x45417d){return _0x45417d[_0x5ac9('0x22')](_0x2d2ba5)['then'](function(_0x5e42a1){return _0x5e42a1;});}return null;};}function removeEntity(_0x5a4664,_0xc36d2){return function(_0x2e666b){if(_0x2e666b){return _0x2e666b['destroy']()['then'](function(){_0x5a4664[_0x5ac9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49352f,_0x2d1bb5){return function(_0x505acc){if(!_0x505acc){_0x49352f[_0x5ac9('0x23')](0x194);}return _0x505acc;};}function handleError(_0x3b77be,_0x770c48){_0x770c48=_0x770c48||0x1f4;return function(_0x3a7f68){logger[_0x5ac9('0x24')](_0x3a7f68[_0x5ac9('0x25')]);if(_0x3a7f68[_0x5ac9('0x26')]){delete _0x3a7f68[_0x5ac9('0x26')];}_0x3b77be[_0x5ac9('0x17')](_0x770c48)['send'](_0x3a7f68);};}exports[_0x5ac9('0x27')]=function(_0x14a7fe,_0x2a7db9){var _0x3a536c={'raw':!![],'where':{'id':_0x14a7fe['params']['id']}},_0x3d51ab={};_0x3d51ab['model']=_[_0x5ac9('0x28')](db[_0x5ac9('0x29')]['rawAttributes']);_0x3d51ab[_0x5ac9('0x2a')]=_['keys'](_0x14a7fe[_0x5ac9('0x2a')]);_0x3d51ab[_0x5ac9('0x2b')]=_[_0x5ac9('0x2c')](_0x3d51ab['model'],_0x3d51ab[_0x5ac9('0x2a')]);_0x3a536c[_0x5ac9('0x2d')]=_[_0x5ac9('0x2c')](_0x3d51ab[_0x5ac9('0x2e')],qs[_0x5ac9('0x2f')](_0x14a7fe[_0x5ac9('0x2a')]['fields']));_0x3a536c['attributes']=_0x3a536c[_0x5ac9('0x2d')]['length']?_0x3a536c['attributes']:_0x3d51ab[_0x5ac9('0x2e')];if(_0x14a7fe[_0x5ac9('0x2a')][_0x5ac9('0x30')]){_0x3a536c[_0x5ac9('0x31')]=[{'all':!![]}];}_0x3a536c=_[_0x5ac9('0x32')]({},_0x3a536c,_0x14a7fe[_0x5ac9('0x33')]);return db[_0x5ac9('0x29')][_0x5ac9('0x34')](_0x3a536c)[_0x5ac9('0x35')](handleEntityNotFound(_0x2a7db9,null))['then'](respondWithResult(_0x2a7db9,null))[_0x5ac9('0x36')](handleError(_0x2a7db9,null));};exports[_0x5ac9('0x37')]=function(_0x535f20,_0x598093){return db[_0x5ac9('0x29')][_0x5ac9('0x37')](_0x535f20[_0x5ac9('0x38')],{})[_0x5ac9('0x35')](respondWithResult(_0x598093,0xc9))['catch'](handleError(_0x598093,null));};exports[_0x5ac9('0x22')]=function(_0x5b55c9,_0x3c540f){if(_0x5b55c9[_0x5ac9('0x38')]['id']){delete _0x5b55c9[_0x5ac9('0x38')]['id'];}return db[_0x5ac9('0x29')][_0x5ac9('0x34')]({'where':{'id':_0x5b55c9[_0x5ac9('0x39')]['id']}})[_0x5ac9('0x35')](handleEntityNotFound(_0x3c540f,null))[_0x5ac9('0x35')](saveUpdates(_0x5b55c9[_0x5ac9('0x38')],null))[_0x5ac9('0x35')](respondWithResult(_0x3c540f,null))[_0x5ac9('0x36')](handleError(_0x3c540f,null));};exports[_0x5ac9('0x3a')]=function(_0x5eacda,_0x5d57ff){return db[_0x5ac9('0x29')][_0x5ac9('0x34')]({'where':{'id':_0x5eacda[_0x5ac9('0x39')]['id']}})[_0x5ac9('0x35')](handleEntityNotFound(_0x5d57ff,null))[_0x5ac9('0x35')](removeEntity(_0x5d57ff,null))[_0x5ac9('0x36')](handleError(_0x5d57ff,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6382068..e4ad1c1 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 _0xea97=['util','api','moment','bluebird','path','rimraf','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xea97,0xd1));var _0x7ea9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xea97[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x7ea9('0x0'));var util=require(_0x7ea9('0x1'));var logger=require('../../config/logger')(_0x7ea9('0x2'));var moment=require(_0x7ea9('0x3'));var BPromise=require(_0x7ea9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ea9('0x5'));var rimraf=require(_0x7ea9('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x7ea9('0x7')]=function(_0x291b42,_0x585fc7){return _0x291b42['define'](_0x7ea9('0x8'),attributes,{'tableName':_0x7ea9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff6=['ChatProactiveAction','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x550d41,_0xe98b2c){var _0x41f799=function(_0x111a2b){while(--_0x111a2b){_0x550d41['push'](_0x550d41['shift']());}};_0x41f799(++_0xe98b2c);}(_0x8ff6,0xc1));var _0x68ff=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8ff6[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x68ff('0x0'));var util=require('util');var logger=require(_0x68ff('0x1'))(_0x68ff('0x2'));var moment=require(_0x68ff('0x3'));var BPromise=require('bluebird');var rp=require(_0x68ff('0x4'));var fs=require('fs');var path=require(_0x68ff('0x5'));var rimraf=require(_0x68ff('0x6'));var config=require(_0x68ff('0x7'));var attributes=require(_0x68ff('0x8'));module[_0x68ff('0x9')]=function(_0x423b8,_0x1c8532){return _0x423b8[_0x68ff('0xa')](_0x68ff('0xb'),attributes,{'tableName':'chat_proactive_actions','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 da3f599..94af3fc 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 _0x805b=['message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2100f2,_0x254f79){var _0x3e265c=function(_0x6e64c0){while(--_0x6e64c0){_0x2100f2['push'](_0x2100f2['shift']());}};_0x3e265c(++_0x254f79);}(_0x805b,0x162));var _0xb805=function(_0x4df7f8,_0x28cdcf){_0x4df7f8=_0x4df7f8-0x0;var _0x24404b=_0x805b[_0x4df7f8];return _0x24404b;};'use strict';var _=require('lodash');var util=require(_0xb805('0x0'));var moment=require(_0xb805('0x1'));var BPromise=require(_0xb805('0x2'));var rs=require(_0xb805('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb805('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb805('0x5'))(_0xb805('0x6'));var config=require(_0xb805('0x7'));var jayson=require(_0xb805('0x8'));var client=jayson[_0xb805('0x9')][_0xb805('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e3c07,_0x1f4207,_0x53509a){return new BPromise(function(_0x9adfe5,_0x383575){return client[_0xb805('0xb')](_0x1e3c07,_0x53509a)[_0xb805('0xc')](function(_0x44becf){logger[_0xb805('0xd')](_0xb805('0xe'),_0x1f4207,_0xb805('0xf'));logger[_0xb805('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1f4207,_0xb805('0xf'),JSON[_0xb805('0x11')](_0x44becf));if(_0x44becf[_0xb805('0x12')]){if(_0x44becf[_0xb805('0x12')][_0xb805('0x13')]===0x1f4){logger[_0xb805('0x12')](_0xb805('0xe'),_0x1f4207,_0x44becf['error'][_0xb805('0x14')]);return _0x383575(_0x44becf[_0xb805('0x12')]['message']);}logger[_0xb805('0x12')](_0xb805('0xe'),_0x1f4207,_0x44becf[_0xb805('0x12')]['message']);return _0x9adfe5(_0x44becf[_0xb805('0x12')][_0xb805('0x14')]);}else{logger[_0xb805('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x1f4207,_0xb805('0xf'));_0x9adfe5(_0x44becf[_0xb805('0x15')][_0xb805('0x14')]);}})['catch'](function(_0x3f68f0){logger[_0xb805('0x12')](_0xb805('0xe'),_0x1f4207,_0x3f68f0);_0x383575(_0x3f68f0);});});} \ No newline at end of file +var _0xa7a9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xa7a9,0x1b5));var _0x9a7a=function(_0x6f0abb,_0x252e84){_0x6f0abb=_0x6f0abb-0x0;var _0x46e894=_0xa7a9[_0x6f0abb];return _0x46e894;};'use strict';var _=require(_0x9a7a('0x0'));var util=require(_0x9a7a('0x1'));var moment=require(_0x9a7a('0x2'));var BPromise=require(_0x9a7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a7a('0x4'));var db=require(_0x9a7a('0x5'))['db'];var utils=require(_0x9a7a('0x6'));var logger=require(_0x9a7a('0x7'))(_0x9a7a('0x8'));var config=require(_0x9a7a('0x9'));var jayson=require(_0x9a7a('0xa'));var client=jayson[_0x9a7a('0xb')][_0x9a7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dc5f2,_0x377d73,_0x19df5e){return new BPromise(function(_0x5450ed,_0x3f0340){return client[_0x9a7a('0xd')](_0x4dc5f2,_0x19df5e)[_0x9a7a('0xe')](function(_0x191388){logger[_0x9a7a('0xf')](_0x9a7a('0x10'),_0x377d73,'request\x20sent');logger[_0x9a7a('0x11')](_0x9a7a('0x12'),_0x377d73,_0x9a7a('0x13'),JSON[_0x9a7a('0x14')](_0x191388));if(_0x191388[_0x9a7a('0x15')]){if(_0x191388[_0x9a7a('0x15')][_0x9a7a('0x16')]===0x1f4){logger[_0x9a7a('0x15')](_0x9a7a('0x10'),_0x377d73,_0x191388[_0x9a7a('0x15')][_0x9a7a('0x17')]);return _0x3f0340(_0x191388[_0x9a7a('0x15')][_0x9a7a('0x17')]);}logger['error'](_0x9a7a('0x10'),_0x377d73,_0x191388[_0x9a7a('0x15')][_0x9a7a('0x17')]);return _0x5450ed(_0x191388[_0x9a7a('0x15')][_0x9a7a('0x17')]);}else{logger[_0x9a7a('0xf')](_0x9a7a('0x10'),_0x377d73,_0x9a7a('0x13'));_0x5450ed(_0x191388[_0x9a7a('0x18')][_0x9a7a('0x17')]);}})[_0x9a7a('0x19')](function(_0x595ed2){logger[_0x9a7a('0x15')](_0x9a7a('0x10'),_0x377d73,_0x595ed2);_0x3f0340(_0x595ed2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9a414d3..ef6664d 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x146ca3,_0x29a10e){var _0x30dd24=function(_0x4b4f36){while(--_0x4b4f36){_0x146ca3['push'](_0x146ca3['shift']());}};_0x30dd24(++_0x29a10e);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1064eb,_0x481da7){var _0x50a20d=function(_0x5029bf){while(--_0x5029bf){_0x1064eb['push'](_0x1064eb['shift']());}};_0x50a20d(++_0x481da7);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2bf1881..7aafb11 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 _0xee95=['STRING','rrmemory','beepall','sequelize','exports'];(function(_0x165a3c,_0x31411e){var _0x2a22eb=function(_0x43f0b2){while(--_0x43f0b2){_0x165a3c['push'](_0x165a3c['shift']());}};_0x2a22eb(++_0x31411e);}(_0xee95,0x1b1));var _0x5ee9=function(_0x141db1,_0x550580){_0x141db1=_0x141db1-0x0;var _0x1c70f7=_0xee95[_0x141db1];return _0x1c70f7;};'use strict';var Sequelize=require(_0x5ee9('0x0'));module[_0x5ee9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5ee9('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5ee9('0x3'),_0x5ee9('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xbfa1=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2da02e,_0x38aec0){var _0x43ae45=function(_0x18bd18){while(--_0x18bd18){_0x2da02e['push'](_0x2da02e['shift']());}};_0x43ae45(++_0x38aec0);}(_0xbfa1,0x130));var _0x1bfa=function(_0x490679,_0x5ab70e){_0x490679=_0x490679-0x0;var _0x400516=_0xbfa1[_0x490679];return _0x400516;};'use strict';var Sequelize=require(_0x1bfa('0x0'));module[_0x1bfa('0x1')]={'name':{'type':Sequelize[_0x1bfa('0x2')],'unique':_0x1bfa('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1bfa('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1bfa('0x4')](_0x1bfa('0x5'),_0x1bfa('0x6'),_0x1bfa('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7c82df9..ecb0785 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 _0x39e9=['push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeTeams','isEmpty','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','name','send','index','ChatQueue','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','rawAttributes','length','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','findAll','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','User','Agents','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x165e10,_0x2d686d){var _0x417ccc=function(_0x4bd53f){while(--_0x4bd53f){_0x165e10['push'](_0x165e10['shift']());}};_0x417ccc(++_0x2d686d);}(_0x39e9,0x1de));var _0x939e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x39e9[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x939e('0x0'));var rimraf=require(_0x939e('0x1'));var zipdir=require(_0x939e('0x2'));var jsonpatch=require(_0x939e('0x3'));var rp=require(_0x939e('0x4'));var moment=require(_0x939e('0x5'));var BPromise=require(_0x939e('0x6'));var Mustache=require('mustache');var util=require(_0x939e('0x7'));var path=require(_0x939e('0x8'));var sox=require('sox');var csv=require(_0x939e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x939e('0xa'));var squel=require('squel');var crypto=require(_0x939e('0xb'));var jsforce=require(_0x939e('0xc'));var deskjs=require(_0x939e('0xd'));var toCsv=require(_0x939e('0x9'));var querystring=require(_0x939e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x939e('0xf'));var qs=require(_0x939e('0x10'));var as=require(_0x939e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x939e('0x12'))(_0x939e('0x13'));var utils=require(_0x939e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x939e('0x15'));var db=require(_0x939e('0x16'))['db'];config[_0x939e('0x17')]=_[_0x939e('0x18')](config[_0x939e('0x17')],{'host':_0x939e('0x19'),'port':0x18eb});var socket=require(_0x939e('0x1a'))(new Redis(config[_0x939e('0x17')]));require(_0x939e('0x1b'))[_0x939e('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x939e('0x1d')][_0x939e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1e2ffd,_0x595c43,_0x338cce,_0x3a4dd7){return new BPromise(function(_0x4490ee,_0x18a09b){var _0xa9254e=_0x3a4dd7||client;return _0xa9254e[_0x939e('0x1f')](_0x1e2ffd,_0x338cce)[_0x939e('0x20')](function(_0x38ce24){logger[_0x939e('0x21')]('ChatQueue,\x20%s,\x20%s',_0x595c43,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x595c43,_0x939e('0x22'),JSON[_0x939e('0x23')](_0x38ce24));if(_0x38ce24[_0x939e('0x24')]){if(_0x38ce24[_0x939e('0x24')][_0x939e('0x25')]===0x1f4){logger[_0x939e('0x24')](_0x939e('0x26'),_0x595c43,_0x38ce24['error'][_0x939e('0x27')]);return _0x18a09b(_0x38ce24[_0x939e('0x24')][_0x939e('0x27')]);}logger[_0x939e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x595c43,_0x38ce24[_0x939e('0x24')][_0x939e('0x27')]);return _0x4490ee(_0x38ce24[_0x939e('0x24')]['message']);}else{logger[_0x939e('0x21')](_0x939e('0x26'),_0x595c43,_0x939e('0x22'));_0x4490ee(_0x38ce24[_0x939e('0x28')][_0x939e('0x27')]);}})[_0x939e('0x29')](function(_0x587943){logger[_0x939e('0x24')]('ChatQueue,\x20%s,\x20%s',_0x595c43,_0x587943);_0x18a09b(_0x587943);});});}function respondWithStatusCode(_0x15ed18,_0x105c47){_0x105c47=_0x105c47||0xcc;return function(_0xf34c76){if(_0xf34c76){return _0x15ed18[_0x939e('0x2a')](_0x105c47);}return _0x15ed18[_0x939e('0x2b')](_0x105c47)[_0x939e('0x2c')]();};}function respondWithResult(_0x332bbc,_0x47c1be){_0x47c1be=_0x47c1be||0xc8;return function(_0x30b8e9){if(_0x30b8e9){return _0x332bbc[_0x939e('0x2b')](_0x47c1be)[_0x939e('0x2d')](_0x30b8e9);}};}function respondWithFilteredResult(_0x16097b,_0x3a9e5e){return function(_0x1627c9){if(_0x1627c9){var _0x318ef0=typeof _0x3a9e5e[_0x939e('0x2e')]===_0x939e('0x2f')&&typeof _0x3a9e5e[_0x939e('0x30')]===_0x939e('0x2f');var _0x1a438f=_0x1627c9[_0x939e('0x31')];var _0x1a3a3a=_0x318ef0?0x0:_0x3a9e5e['offset'];var _0x16830c=_0x318ef0?_0x1627c9[_0x939e('0x31')]:_0x3a9e5e[_0x939e('0x2e')]+_0x3a9e5e[_0x939e('0x30')];var _0x702917;if(_0x16830c>=_0x1a438f){_0x16830c=_0x1a438f;_0x702917=0xc8;}else{_0x702917=0xce;}_0x16097b[_0x939e('0x2b')](_0x702917);return _0x16097b[_0x939e('0x32')]('Content-Range',_0x1a3a3a+'-'+_0x16830c+'/'+_0x1a438f)[_0x939e('0x2d')](_0x1627c9);}return null;};}function patchUpdates(_0x4ad525){return function(_0x5e8e01){try{jsonpatch[_0x939e('0x33')](_0x5e8e01,_0x4ad525,!![]);}catch(_0x3627b6){return BPromise[_0x939e('0x34')](_0x3627b6);}return _0x5e8e01['save']();};}function saveUpdates(_0x4e0388,_0x1b4e03){return function(_0x252c71){if(_0x252c71){return _0x252c71[_0x939e('0x35')](_0x4e0388)[_0x939e('0x20')](function(_0x402ecc){return _0x402ecc;});}return null;};}function removeEntity(_0x4a54fa,_0x2c3c4f){return function(_0x5a9ae9){if(_0x5a9ae9){return _0x5a9ae9[_0x939e('0x36')]()['then'](function(){var _0x2e3442=_0x5a9ae9[_0x939e('0x37')]({'plain':!![]});var _0x4e3704=_0x939e('0x38');return db[_0x939e('0x39')]['destroy']({'where':{'type':_0x4e3704,'resourceId':_0x2e3442['id']}})[_0x939e('0x20')](function(){return _0x5a9ae9;});})[_0x939e('0x20')](function(){_0x4a54fa[_0x939e('0x2b')](0xcc)[_0x939e('0x2c')]();});}};}function handleEntityNotFound(_0x420f99,_0x262ada){return function(_0xed2197){if(!_0xed2197){_0x420f99[_0x939e('0x2a')](0x194);}return _0xed2197;};}function handleError(_0x3dab99,_0x24741d){_0x24741d=_0x24741d||0x1f4;return function(_0x1656a5){logger[_0x939e('0x24')](_0x1656a5['stack']);if(_0x1656a5[_0x939e('0x3a')]){delete _0x1656a5[_0x939e('0x3a')];}_0x3dab99['status'](_0x24741d)[_0x939e('0x3b')](_0x1656a5);};}exports[_0x939e('0x3c')]=function(_0x479154,_0x47f162){var _0x1baef4={},_0x153894={},_0x59df19={'count':0x0,'rows':[]};var _0x2d60c4=_['map'](db[_0x939e('0x3d')]['rawAttributes'],function(_0xb76e29){return{'name':_0xb76e29[_0x939e('0x3e')],'type':_0xb76e29[_0x939e('0x3f')][_0x939e('0x40')]};});_0x153894[_0x939e('0x41')]=_[_0x939e('0x42')](_0x2d60c4,'name');_0x153894[_0x939e('0x43')]=_['keys'](_0x479154['query']);_0x153894[_0x939e('0x44')]=_[_0x939e('0x45')](_0x153894[_0x939e('0x41')],_0x153894['query']);_0x1baef4['attributes']=_[_0x939e('0x45')](_0x153894[_0x939e('0x41')],qs[_0x939e('0x46')](_0x479154[_0x939e('0x43')][_0x939e('0x46')]));_0x1baef4[_0x939e('0x47')]=_0x1baef4[_0x939e('0x47')]['length']?_0x1baef4[_0x939e('0x47')]:_0x153894[_0x939e('0x41')];if(!_0x479154[_0x939e('0x43')][_0x939e('0x48')](_0x939e('0x49'))){_0x1baef4[_0x939e('0x30')]=qs[_0x939e('0x30')](_0x479154[_0x939e('0x43')]['limit']);_0x1baef4['offset']=qs[_0x939e('0x2e')](_0x479154[_0x939e('0x43')]['offset']);}_0x1baef4[_0x939e('0x4a')]=qs[_0x939e('0x4b')](_0x479154[_0x939e('0x43')][_0x939e('0x4b')]);_0x1baef4[_0x939e('0x4c')]=qs[_0x939e('0x44')](_[_0x939e('0x4d')](_0x479154[_0x939e('0x43')],_0x153894[_0x939e('0x44')]),_0x2d60c4);if(_0x479154[_0x939e('0x43')][_0x939e('0x4e')]){_0x1baef4[_0x939e('0x4c')]=_[_0x939e('0x4f')](_0x1baef4[_0x939e('0x4c')],{'$or':_[_0x939e('0x42')](_0x2d60c4,function(_0x1fc5bf){if(_0x1fc5bf[_0x939e('0x3f')]!==_0x939e('0x50')){var _0x371f5e={};_0x371f5e[_0x1fc5bf['name']]={'$like':'%'+_0x479154[_0x939e('0x43')][_0x939e('0x4e')]+'%'};return _0x371f5e;}})});}_0x1baef4=_[_0x939e('0x4f')]({},_0x1baef4,_0x479154[_0x939e('0x51')]);var _0x2d7b90={'where':_0x1baef4['where']};return db['ChatQueue']['count'](_0x2d7b90)[_0x939e('0x20')](function(_0x15b08d){_0x59df19['count']=_0x15b08d;if(_0x479154[_0x939e('0x43')][_0x939e('0x52')]){_0x1baef4[_0x939e('0x53')]=[{'all':!![]}];}return db[_0x939e('0x3d')]['findAll'](_0x1baef4);})[_0x939e('0x20')](function(_0x360cb8){_0x59df19[_0x939e('0x54')]=_0x360cb8;return _0x59df19;})['then'](respondWithFilteredResult(_0x47f162,_0x1baef4))[_0x939e('0x29')](handleError(_0x47f162,null));};exports[_0x939e('0x55')]=function(_0x1f2d9b,_0x4a3515){var _0x38a000={'raw':!![],'where':{'id':_0x1f2d9b[_0x939e('0x56')]['id']}},_0x38998f={};_0x38998f[_0x939e('0x41')]=_[_0x939e('0x57')](db[_0x939e('0x3d')][_0x939e('0x58')]);_0x38998f[_0x939e('0x43')]=_[_0x939e('0x57')](_0x1f2d9b['query']);_0x38998f[_0x939e('0x44')]=_[_0x939e('0x45')](_0x38998f[_0x939e('0x41')],_0x38998f[_0x939e('0x43')]);_0x38a000[_0x939e('0x47')]=_[_0x939e('0x45')](_0x38998f[_0x939e('0x41')],qs[_0x939e('0x46')](_0x1f2d9b['query'][_0x939e('0x46')]));_0x38a000[_0x939e('0x47')]=_0x38a000['attributes'][_0x939e('0x59')]?_0x38a000[_0x939e('0x47')]:_0x38998f[_0x939e('0x41')];if(_0x1f2d9b[_0x939e('0x43')][_0x939e('0x52')]){_0x38a000[_0x939e('0x53')]=[{'all':!![]}];}_0x38a000=_[_0x939e('0x4f')]({},_0x38a000,_0x1f2d9b[_0x939e('0x51')]);return db[_0x939e('0x3d')][_0x939e('0x5a')](_0x38a000)[_0x939e('0x20')](handleEntityNotFound(_0x4a3515,null))[_0x939e('0x20')](respondWithResult(_0x4a3515,null))[_0x939e('0x29')](handleError(_0x4a3515,null));};exports[_0x939e('0x5b')]=function(_0x257e1b,_0x6913f0){return db[_0x939e('0x3d')][_0x939e('0x5b')](_0x257e1b['body'],{})[_0x939e('0x20')](function(_0x2887c2){var _0x360c5b=_0x257e1b[_0x939e('0x5c')]['get']({'plain':!![]});if(!_0x360c5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x360c5b[_0x939e('0x5d')]===_0x939e('0x5c')){var _0x535117=_0x2887c2[_0x939e('0x37')]({'plain':!![]});var _0x1e76ee=_0x939e('0x38');return db[_0x939e('0x5e')][_0x939e('0x5a')]({'where':{'name':_0x1e76ee,'userProfileId':_0x360c5b[_0x939e('0x5f')]},'raw':!![]})[_0x939e('0x20')](function(_0xb89544){if(_0xb89544&&_0xb89544['autoAssociation']===0x0){return db[_0x939e('0x39')][_0x939e('0x5b')]({'name':_0x535117[_0x939e('0x3a')],'resourceId':_0x535117['id'],'type':_0xb89544['name'],'sectionId':_0xb89544['id']},{})[_0x939e('0x20')](function(){return _0x2887c2;});}else{return _0x2887c2;}})[_0x939e('0x29')](function(_0x4aab0b){logger['error'](_0x939e('0x60'),_0x4aab0b);throw _0x4aab0b;});}return _0x2887c2;})[_0x939e('0x20')](respondWithResult(_0x6913f0,0xc9))[_0x939e('0x29')](handleError(_0x6913f0,null));};exports[_0x939e('0x35')]=function(_0x290f8c,_0x41e772){if(_0x290f8c[_0x939e('0x61')]['id']){delete _0x290f8c[_0x939e('0x61')]['id'];}return db[_0x939e('0x3d')][_0x939e('0x5a')]({'where':{'id':_0x290f8c[_0x939e('0x56')]['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x41e772,null))[_0x939e('0x20')](saveUpdates(_0x290f8c[_0x939e('0x61')],null))['then'](respondWithResult(_0x41e772,null))[_0x939e('0x29')](handleError(_0x41e772,null));};exports['destroy']=function(_0x2cff24,_0x55d38a){return db['ChatQueue'][_0x939e('0x5a')]({'where':{'id':_0x2cff24['params']['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x55d38a,null))[_0x939e('0x20')](removeEntity(_0x55d38a,null))[_0x939e('0x29')](handleError(_0x55d38a,null));};exports[_0x939e('0x62')]=function(_0x4f5581,_0x43fa55){return db['ChatQueue'][_0x939e('0x62')]()['then'](respondWithResult(_0x43fa55,null))['catch'](handleError(_0x43fa55,null));};exports[_0x939e('0x63')]=function(_0x5619b5,_0x3923ea,_0x1450ae){var _0x240ebe={'raw':!![],'where':{}},_0x352240={},_0x4adebc;return db[_0x939e('0x3d')][_0x939e('0x64')]({'where':{'id':_0x5619b5[_0x939e('0x56')]['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x3923ea,null))[_0x939e('0x20')](function(_0x25593d){if(_0x25593d){_0x4adebc=_0x25593d[_0x939e('0x37')]({'plain':!![]});_0x352240[_0x939e('0x41')]=_['keys'](db[_0x939e('0x65')][_0x939e('0x58')]);_0x352240['query']=_[_0x939e('0x57')](_0x5619b5[_0x939e('0x43')]);_0x352240['filters']=_['intersection'](_0x352240[_0x939e('0x41')],_0x352240[_0x939e('0x43')]);_0x240ebe[_0x939e('0x47')]=_['intersection'](_0x352240['model'],qs[_0x939e('0x46')](_0x5619b5[_0x939e('0x43')][_0x939e('0x46')]));_0x240ebe[_0x939e('0x47')]=_0x240ebe['attributes']['length']?_0x240ebe['attributes']:_0x352240[_0x939e('0x41')];if(!_0x5619b5['query'][_0x939e('0x48')](_0x939e('0x49'))){_0x240ebe[_0x939e('0x30')]=qs[_0x939e('0x30')](_0x5619b5[_0x939e('0x43')][_0x939e('0x30')]);_0x240ebe['offset']=qs['offset'](_0x5619b5[_0x939e('0x43')][_0x939e('0x2e')]);}_0x240ebe[_0x939e('0x4a')]=qs[_0x939e('0x4b')](_0x5619b5[_0x939e('0x43')]['sort']);_0x240ebe[_0x939e('0x4c')]=qs[_0x939e('0x44')](_['pick'](_0x5619b5['query'],_0x352240['filters']));_0x240ebe[_0x939e('0x4c')]['ChatQueueId']=_0x25593d['id'];if(_0x5619b5[_0x939e('0x43')][_0x939e('0x4e')]){_0x240ebe[_0x939e('0x4c')]=_[_0x939e('0x4f')](_0x240ebe['where'],{'$or':_['map'](_0x240ebe['attributes'],function(_0x159e34){var _0x51c233={};_0x51c233[_0x159e34]={'$like':'%'+_0x5619b5['query'][_0x939e('0x4e')]+'%'};return _0x51c233;})});}_0x240ebe=_['merge']({},_0x240ebe,_0x5619b5['options']);return db['UserChatQueue']['findAll'](_0x240ebe);}})[_0x939e('0x20')](function(_0x383dc9){if(_0x383dc9){return db['User'][_0x939e('0x66')]({'where':{'id':_['map'](_0x383dc9,_0x939e('0x67')),'role':_0x939e('0x68')},'attributes':['id',_0x939e('0x3a'),_0x939e('0x69'),_0x939e('0x6a'),_0x939e('0x6b')]});}})[_0x939e('0x20')](function(_0x3abc8f){if(_0x3abc8f){return{'count':_0x3abc8f[_0x939e('0x31')],'rows':_[_0x939e('0x42')](_0x3abc8f[_0x939e('0x54')],function(_0x52233a){return{'membername':_0x52233a['name'],'UserId':_0x52233a['id'],'queue_name':_0x4adebc[_0x939e('0x3a')],'ChatQueueId':_0x4adebc['id'],'interface':util['format'](_0x939e('0x6c'),_0x939e('0x6d'),_0x52233a[_0x939e('0x3a')]),'penalty':0x0,'paused':_0x52233a[_0x939e('0x69')],'createdAt':_0x52233a[_0x939e('0x6b')],'updatedAt':_0x52233a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x939e('0x20')](respondWithFilteredResult(_0x3923ea,_0x240ebe))[_0x939e('0x29')](handleError(_0x3923ea,null));};exports[_0x939e('0x6e')]=function(_0x82b0a7,_0x1ba4ca,_0x454789){var _0x535ee2={};var _0xcc378c={};var _0x2e7143;var _0x58eb25;return db['ChatQueue'][_0x939e('0x64')]({'where':{'id':_0x82b0a7[_0x939e('0x56')]['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x1ba4ca,null))['then'](function(_0x156b30){if(_0x156b30){_0x2e7143=_0x156b30;_0xcc378c[_0x939e('0x41')]=_[_0x939e('0x57')](db[_0x939e('0x6f')][_0x939e('0x58')]);_0xcc378c[_0x939e('0x43')]=_[_0x939e('0x57')](_0x82b0a7[_0x939e('0x43')]);_0xcc378c['filters']=_[_0x939e('0x45')](_0xcc378c['model'],_0xcc378c['query']);_0x535ee2[_0x939e('0x47')]=_[_0x939e('0x45')](_0xcc378c[_0x939e('0x41')],qs['fields'](_0x82b0a7[_0x939e('0x43')]['fields']));_0x535ee2[_0x939e('0x47')]=_0x535ee2[_0x939e('0x47')][_0x939e('0x59')]?_0x535ee2[_0x939e('0x47')]:_0xcc378c[_0x939e('0x41')];_0x535ee2[_0x939e('0x4a')]=qs[_0x939e('0x4b')](_0x82b0a7[_0x939e('0x43')][_0x939e('0x4b')]);_0x535ee2[_0x939e('0x4c')]=qs[_0x939e('0x44')](_[_0x939e('0x4d')](_0x82b0a7[_0x939e('0x43')],_0xcc378c[_0x939e('0x44')]));if(_0x82b0a7['query'][_0x939e('0x4e')]){_0x535ee2[_0x939e('0x4c')]=_[_0x939e('0x4f')](_0x535ee2[_0x939e('0x4c')],{'$or':_[_0x939e('0x42')](_0x535ee2[_0x939e('0x47')],function(_0x3308cc){var _0x585647={};_0x585647[_0x3308cc]={'$like':'%'+_0x82b0a7[_0x939e('0x43')][_0x939e('0x4e')]+'%'};return _0x585647;})});}_0x535ee2=_[_0x939e('0x4f')]({},_0x535ee2,_0x82b0a7[_0x939e('0x51')]);return _0x2e7143[_0x939e('0x6e')](_0x535ee2);}})[_0x939e('0x20')](function(_0x52bfe2){if(_0x52bfe2){_0x58eb25=_0x52bfe2[_0x939e('0x59')];if(!_0x82b0a7[_0x939e('0x43')][_0x939e('0x48')](_0x939e('0x49'))){_0x535ee2[_0x939e('0x30')]=qs[_0x939e('0x30')](_0x82b0a7[_0x939e('0x43')][_0x939e('0x30')]);_0x535ee2['offset']=qs[_0x939e('0x2e')](_0x82b0a7['query'][_0x939e('0x2e')]);}return _0x2e7143['getTeams'](_0x535ee2);}})[_0x939e('0x20')](function(_0x44ae6e){if(_0x44ae6e){return _0x44ae6e?{'count':_0x58eb25,'rows':_0x44ae6e}:null;}})['then'](respondWithResult(_0x1ba4ca,null))[_0x939e('0x29')](handleError(_0x1ba4ca,null));};exports[_0x939e('0x70')]=function(_0x464098,_0x28e304,_0x4cad7c){var _0x537d1d=_0x464098[_0x939e('0x61')][_0x939e('0x71')];return db[_0x939e('0x6f')][_0x939e('0x72')]({'where':{'id':_0x537d1d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x939e('0x3a'),_0x939e('0x73'),_0x939e('0x74'),'interface'],'raw':!![]}]})[_0x939e('0x20')](function(_0x2280c8){if(_0x2280c8){var _0x26f8d1=_[_0x939e('0x75')](_0x2280c8,function(_0x1665c6){var _0x260886=_0x1665c6[_0x939e('0x37')]({'plain':!![]});return _0x260886['Agents'];});return db[_0x939e('0x3d')][_0x939e('0x5a')]({'where':{'id':_0x464098['params']['id']}})[_0x939e('0x20')](function(_0x207d06){return db[_0x939e('0x76')][_0x939e('0x77')](function(_0x46f095){return _0x207d06[_0x939e('0x70')](_0x537d1d,{'transaction':_0x46f095})[_0x939e('0x20')](function(){return BPromise['each'](_0x26f8d1,function(_0x525992){return db[_0x939e('0x65')][_0x939e('0x78')]({'where':{'UserId':_0x525992['id'],'ChatQueueId':_0x464098['params']['id']},'transaction':_0x46f095});});})['then'](function(){_0x26f8d1[_0x939e('0x79')](function(_0x31080d){socket['emit'](_0x939e('0x7a'),{'UserId':_0x31080d['id'],'ChatQueueId':_0x207d06['id']});});});});});}})[_0x939e('0x20')](respondWithStatusCode(_0x28e304,null))[_0x939e('0x29')](handleError(_0x28e304,null));};exports['removeTeams']=function(_0x170992,_0x20f324,_0x48b83f){return db['Team']['findAll']({'where':{'id':_0x170992[_0x939e('0x43')][_0x939e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x939e('0x7b')],'as':_0x939e('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x939e('0x20')](handleEntityNotFound(_0x20f324,null))['then'](function(_0x265a27){var _0x2fede9=_[_0x939e('0x42')](_0x265a27,'id');var _0x465db6=[];var _0x14ab46=[];var _0x3885cb=squel[_0x939e('0x7d')]();_0x3885cb[_0x939e('0x7e')](_0x939e('0x7f'))['from'](_0x939e('0x80'),'tq')[_0x939e('0x81')](_0x939e('0x82'),'ut',_0x939e('0x83'))[_0x939e('0x4c')](_0x939e('0x84'),_0x170992['params']['id']);for(var _0x3581c7=0x0;_0x3581c7<_0x265a27[_0x939e('0x59')];_0x3581c7+=0x1){let _0x2142ba=_0x265a27[_0x3581c7];for(var _0x3abf86=0x0;_0x3abf86<_0x2142ba[_0x939e('0x7c')][_0x939e('0x59')];_0x3abf86+=0x1){let _0xe47c45=_0x2142ba[_0x939e('0x7c')][_0x3abf86];var _0x406a86=_0x3885cb['clone']();_0x406a86[_0x939e('0x4c')](_0x939e('0x85'),_0xe47c45['id']);_0x14ab46[_0x939e('0x86')](db['sequelize'][_0x939e('0x43')](_0x406a86[_0x939e('0x87')](),{'type':db['sequelize'][_0x939e('0x88')][_0x939e('0x89')]})[_0x939e('0x20')](function(_0x3fe875){if(_0x3fe875['length']===0x1){return _0xe47c45['id'];}else{var _0x37d977=_['every'](_[_0x939e('0x42')](_0x3fe875,_0x939e('0x8a')),function(_0x192a3f){return _[_0x939e('0x8b')](_0x2fede9,_0x192a3f);});if(_0x37d977){return _0xe47c45['id'];}}}));}}return BPromise[_0x939e('0x8c')](_0x14ab46)[_0x939e('0x20')](function(_0x58b546){_0x465db6=_(_0x465db6)[_0x939e('0x8d')](_0x58b546)[_0x939e('0x8e')]()['value']();return db[_0x939e('0x3d')][_0x939e('0x5a')]({'where':{'id':_0x170992[_0x939e('0x56')]['id']}})[_0x939e('0x20')](function(_0x3d0b6c){return db[_0x939e('0x76')][_0x939e('0x77')](function(_0x464fbd){return _0x3d0b6c[_0x939e('0x8f')](_0x170992[_0x939e('0x43')][_0x939e('0x71')],{'transaction':_0x464fbd})['then'](function(){if(!_[_0x939e('0x90')](_0x465db6)){return _0x3d0b6c['removeAgents'](_0x465db6,{'transaction':_0x464fbd});}})['then'](function(){_0x465db6[_0x939e('0x79')](function(_0x43dd5d){socket[_0x939e('0x91')](_0x939e('0x92'),{'UserId':_0x43dd5d,'ChatQueueId':_0x3d0b6c['id']});});});});});});})[_0x939e('0x20')](respondWithStatusCode(_0x20f324,null))[_0x939e('0x29')](handleError(_0x20f324,null));};exports[_0x939e('0x93')]=function(_0x37f88e,_0x1ccd68,_0x43aa86){return db['ChatQueue'][_0x939e('0x5a')]({'where':{'id':_0x37f88e['params']['id']}})['then'](handleEntityNotFound(_0x1ccd68,null))[_0x939e('0x20')](function(_0x3f19f9){if(_0x3f19f9){return _0x3f19f9[_0x939e('0x93')](_0x37f88e[_0x939e('0x61')][_0x939e('0x71')],_[_0x939e('0x94')](_0x37f88e[_0x939e('0x61')],[_0x939e('0x71'),'id'])||{})[_0x939e('0x95')](function(_0x4bd5c3){for(var _0x4ab4f6=0x0;_0x4ab4f6<_0x37f88e[_0x939e('0x61')]['ids'][_0x939e('0x59')];_0x4ab4f6+=0x1){socket[_0x939e('0x91')](_0x939e('0x7a'),{'UserId':Number(_0x37f88e[_0x939e('0x61')][_0x939e('0x71')][_0x4ab4f6]),'ChatQueueId':Number(_0x37f88e[_0x939e('0x56')]['id'])});}return _0x4bd5c3;});}})['then'](respondWithResult(_0x1ccd68,null))[_0x939e('0x29')](handleError(_0x1ccd68,null));};exports[_0x939e('0x96')]=function(_0x50e2d6,_0x5a838a,_0x18744a){return db[_0x939e('0x3d')]['find']({'where':{'id':_0x50e2d6['params']['id']}})[_0x939e('0x20')](handleEntityNotFound(_0x5a838a,null))['then'](function(_0x399ff2){if(_0x399ff2){return _0x399ff2[_0x939e('0x96')](_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')])[_0x939e('0x20')](function(){if(_[_0x939e('0x97')](_0x50e2d6['query']['ids'])){for(var _0x402b54=0x0;_0x402b54<_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')][_0x939e('0x59')];_0x402b54+=0x1){socket[_0x939e('0x91')](_0x939e('0x92'),{'UserId':Number(_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')][_0x402b54]),'ChatQueueId':Number(_0x50e2d6[_0x939e('0x56')]['id'])});}}else{socket[_0x939e('0x91')](_0x939e('0x92'),{'UserId':Number(_0x50e2d6[_0x939e('0x43')][_0x939e('0x71')]),'ChatQueueId':Number(_0x50e2d6[_0x939e('0x56')]['id'])});}});}})[_0x939e('0x20')](respondWithStatusCode(_0x5a838a,null))['catch'](handleError(_0x5a838a,null));};exports[_0x939e('0x98')]=function(_0x1af4ab,_0x435dff,_0x19d049){var _0x19d3fb={};var _0x59b99f={};var _0x1ce3e8;var _0x2592d0;return db['ChatQueue'][_0x939e('0x64')]({'where':{'id':_0x1af4ab['params']['id']}})['then'](handleEntityNotFound(_0x435dff,null))[_0x939e('0x20')](function(_0x3a155d){if(_0x3a155d){_0x1ce3e8=_0x3a155d;_0x59b99f[_0x939e('0x41')]=_[_0x939e('0x57')](db[_0x939e('0x7b')][_0x939e('0x58')]);_0x59b99f[_0x939e('0x43')]=_[_0x939e('0x57')](_0x1af4ab[_0x939e('0x43')]);_0x59b99f[_0x939e('0x44')]=_[_0x939e('0x45')](_0x59b99f[_0x939e('0x41')],_0x59b99f[_0x939e('0x43')]);_0x19d3fb[_0x939e('0x47')]=_[_0x939e('0x45')](_0x59b99f[_0x939e('0x41')],qs[_0x939e('0x46')](_0x1af4ab[_0x939e('0x43')]['fields']));_0x19d3fb['attributes']=_0x19d3fb[_0x939e('0x47')][_0x939e('0x59')]?_0x19d3fb[_0x939e('0x47')]:_0x59b99f[_0x939e('0x41')];_0x19d3fb[_0x939e('0x4a')]=qs['sort'](_0x1af4ab['query'][_0x939e('0x4b')]);_0x19d3fb[_0x939e('0x4c')]=qs[_0x939e('0x44')](_['pick'](_0x1af4ab[_0x939e('0x43')],_0x59b99f[_0x939e('0x44')]));if(_0x1af4ab[_0x939e('0x43')][_0x939e('0x4e')]){_0x19d3fb[_0x939e('0x4c')]=_['merge'](_0x19d3fb[_0x939e('0x4c')],{'$or':_[_0x939e('0x42')](_0x19d3fb['attributes'],function(_0x1aca3e){var _0x5433ac={};_0x5433ac[_0x1aca3e]={'$like':'%'+_0x1af4ab[_0x939e('0x43')][_0x939e('0x4e')]+'%'};return _0x5433ac;})});}_0x19d3fb=_[_0x939e('0x4f')]({},_0x19d3fb,_0x1af4ab[_0x939e('0x51')]);return _0x1ce3e8[_0x939e('0x98')](_0x19d3fb);}})[_0x939e('0x20')](function(_0xd046f1){if(_0xd046f1){_0x2592d0=_0xd046f1[_0x939e('0x59')];if(!_0x1af4ab['query'][_0x939e('0x48')](_0x939e('0x49'))){_0x19d3fb['limit']=qs[_0x939e('0x30')](_0x1af4ab[_0x939e('0x43')][_0x939e('0x30')]);_0x19d3fb[_0x939e('0x2e')]=qs[_0x939e('0x2e')](_0x1af4ab[_0x939e('0x43')][_0x939e('0x2e')]);}return _0x1ce3e8['getAgents'](_0x19d3fb);}})[_0x939e('0x20')](function(_0x678c32){if(_0x678c32){return _0x678c32?{'count':_0x2592d0,'rows':_0x678c32}:null;}})['then'](respondWithResult(_0x435dff,null))[_0x939e('0x29')](handleError(_0x435dff,null));}; \ No newline at end of file +var _0x5cd7=['./chatQueue.socket','register','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','ChatQueues','name','index','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueue','includeAll','findAll','rows','show','params','keys','intersection','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','User','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','each','forEach','emit','removeTeams','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','all','compact','value','isEmpty','removeAgents','addAgents','userChatQueue:save','isArray','userChatQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5cd7,0x77));var _0x75cd=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x5cd7[_0x7e918f];return _0x5b35ab;};'use strict';var emlformat=require(_0x75cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x75cd('0x1'));var rp=require(_0x75cd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x75cd('0x3'));var path=require(_0x75cd('0x4'));var sox=require(_0x75cd('0x5'));var csv=require(_0x75cd('0x6'));var ejs=require(_0x75cd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75cd('0x8'));var squel=require(_0x75cd('0x9'));var crypto=require(_0x75cd('0xa'));var jsforce=require(_0x75cd('0xb'));var deskjs=require(_0x75cd('0xc'));var toCsv=require(_0x75cd('0x6'));var querystring=require(_0x75cd('0xd'));var Papa=require('papaparse');var Redis=require(_0x75cd('0xe'));var authService=require(_0x75cd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x75cd('0x10'));var hardwareService=require(_0x75cd('0x11'));var logger=require(_0x75cd('0x12'))(_0x75cd('0x13'));var utils=require(_0x75cd('0x14'));var config=require(_0x75cd('0x15'));var licenseUtil=require(_0x75cd('0x16'));var db=require(_0x75cd('0x17'))['db'];config[_0x75cd('0x18')]=_['defaults'](config[_0x75cd('0x18')],{'host':_0x75cd('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75cd('0x18')]));require(_0x75cd('0x1a'))[_0x75cd('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x75cd('0x1c')][_0x75cd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x14a52c,_0xa3ca79,_0x228907,_0x50629d){return new BPromise(function(_0x15f253,_0x149363){var _0x6d1ee6=_0x50629d||client;return _0x6d1ee6['request'](_0x14a52c,_0x228907)[_0x75cd('0x1e')](function(_0x413897){logger[_0x75cd('0x1f')](_0x75cd('0x20'),_0xa3ca79,_0x75cd('0x21'));logger['debug'](_0x75cd('0x22'),_0xa3ca79,_0x75cd('0x21'),JSON[_0x75cd('0x23')](_0x413897));if(_0x413897[_0x75cd('0x24')]){if(_0x413897[_0x75cd('0x24')]['code']===0x1f4){logger[_0x75cd('0x24')](_0x75cd('0x20'),_0xa3ca79,_0x413897[_0x75cd('0x24')][_0x75cd('0x25')]);return _0x149363(_0x413897['error']['message']);}logger[_0x75cd('0x24')]('ChatQueue,\x20%s,\x20%s',_0xa3ca79,_0x413897['error'][_0x75cd('0x25')]);return _0x15f253(_0x413897[_0x75cd('0x24')][_0x75cd('0x25')]);}else{logger[_0x75cd('0x1f')](_0x75cd('0x20'),_0xa3ca79,_0x75cd('0x21'));_0x15f253(_0x413897[_0x75cd('0x26')][_0x75cd('0x25')]);}})[_0x75cd('0x27')](function(_0x14a53f){logger[_0x75cd('0x24')](_0x75cd('0x20'),_0xa3ca79,_0x14a53f);_0x149363(_0x14a53f);});});}function respondWithStatusCode(_0x2d34d0,_0x2e0101){_0x2e0101=_0x2e0101||0xcc;return function(_0x564db9){if(_0x564db9){return _0x2d34d0[_0x75cd('0x28')](_0x2e0101);}return _0x2d34d0[_0x75cd('0x29')](_0x2e0101)[_0x75cd('0x2a')]();};}function respondWithResult(_0x4d247d,_0x1c182c){_0x1c182c=_0x1c182c||0xc8;return function(_0x507fee){if(_0x507fee){return _0x4d247d[_0x75cd('0x29')](_0x1c182c)[_0x75cd('0x2b')](_0x507fee);}};}function respondWithFilteredResult(_0x5909da,_0x1409b5){return function(_0x1e4b9d){if(_0x1e4b9d){var _0x5d325e=typeof _0x1409b5[_0x75cd('0x2c')]===_0x75cd('0x2d')&&typeof _0x1409b5[_0x75cd('0x2e')]===_0x75cd('0x2d');var _0x2c8c1a=_0x1e4b9d[_0x75cd('0x2f')];var _0x38a641=_0x5d325e?0x0:_0x1409b5[_0x75cd('0x2c')];var _0x4b99c2=_0x5d325e?_0x1e4b9d['count']:_0x1409b5[_0x75cd('0x2c')]+_0x1409b5[_0x75cd('0x2e')];var _0x3d9327;if(_0x4b99c2>=_0x2c8c1a){_0x4b99c2=_0x2c8c1a;_0x3d9327=0xc8;}else{_0x3d9327=0xce;}_0x5909da['status'](_0x3d9327);return _0x5909da[_0x75cd('0x30')](_0x75cd('0x31'),_0x38a641+'-'+_0x4b99c2+'/'+_0x2c8c1a)[_0x75cd('0x2b')](_0x1e4b9d);}return null;};}function patchUpdates(_0x20fd1c){return function(_0x378948){try{jsonpatch[_0x75cd('0x32')](_0x378948,_0x20fd1c,!![]);}catch(_0x2c5ee5){return BPromise[_0x75cd('0x33')](_0x2c5ee5);}return _0x378948['save']();};}function saveUpdates(_0x338988,_0x3261af){return function(_0x5604f4){if(_0x5604f4){return _0x5604f4[_0x75cd('0x34')](_0x338988)[_0x75cd('0x1e')](function(_0x2aeb88){return _0x2aeb88;});}return null;};}function removeEntity(_0x15ad76,_0x5bd779){return function(_0x50c602){if(_0x50c602){return _0x50c602[_0x75cd('0x35')]()[_0x75cd('0x1e')](function(){var _0x986256=_0x50c602[_0x75cd('0x36')]({'plain':!![]});var _0x376eb3=_0x75cd('0x37');return db['UserProfileResource'][_0x75cd('0x35')]({'where':{'type':_0x376eb3,'resourceId':_0x986256['id']}})['then'](function(){return _0x50c602;});})[_0x75cd('0x1e')](function(){_0x15ad76['status'](0xcc)[_0x75cd('0x2a')]();});}};}function handleEntityNotFound(_0x12ba65,_0x181c85){return function(_0x1e0d45){if(!_0x1e0d45){_0x12ba65[_0x75cd('0x28')](0x194);}return _0x1e0d45;};}function handleError(_0x5616f5,_0x40e7af){_0x40e7af=_0x40e7af||0x1f4;return function(_0x2cd9af){logger[_0x75cd('0x24')](_0x2cd9af['stack']);if(_0x2cd9af[_0x75cd('0x38')]){delete _0x2cd9af[_0x75cd('0x38')];}_0x5616f5[_0x75cd('0x29')](_0x40e7af)['send'](_0x2cd9af);};}exports[_0x75cd('0x39')]=function(_0x5891db,_0x163eed){var _0x337257={},_0x255fd7={},_0x4e9c24={'count':0x0,'rows':[]};var _0x2fa414=_[_0x75cd('0x3a')](db['ChatQueue'][_0x75cd('0x3b')],function(_0x58a74b){return{'name':_0x58a74b['fieldName'],'type':_0x58a74b[_0x75cd('0x3c')][_0x75cd('0x3d')]};});_0x255fd7[_0x75cd('0x3e')]=_[_0x75cd('0x3a')](_0x2fa414,_0x75cd('0x38'));_0x255fd7[_0x75cd('0x3f')]=_['keys'](_0x5891db[_0x75cd('0x3f')]);_0x255fd7[_0x75cd('0x40')]=_['intersection'](_0x255fd7[_0x75cd('0x3e')],_0x255fd7[_0x75cd('0x3f')]);_0x337257[_0x75cd('0x41')]=_['intersection'](_0x255fd7[_0x75cd('0x3e')],qs[_0x75cd('0x42')](_0x5891db[_0x75cd('0x3f')][_0x75cd('0x42')]));_0x337257[_0x75cd('0x41')]=_0x337257['attributes'][_0x75cd('0x43')]?_0x337257[_0x75cd('0x41')]:_0x255fd7[_0x75cd('0x3e')];if(!_0x5891db[_0x75cd('0x3f')][_0x75cd('0x44')]('nolimit')){_0x337257[_0x75cd('0x2e')]=qs[_0x75cd('0x2e')](_0x5891db[_0x75cd('0x3f')][_0x75cd('0x2e')]);_0x337257[_0x75cd('0x2c')]=qs[_0x75cd('0x2c')](_0x5891db[_0x75cd('0x3f')]['offset']);}_0x337257[_0x75cd('0x45')]=qs['sort'](_0x5891db[_0x75cd('0x3f')][_0x75cd('0x46')]);_0x337257[_0x75cd('0x47')]=qs[_0x75cd('0x40')](_[_0x75cd('0x48')](_0x5891db[_0x75cd('0x3f')],_0x255fd7['filters']),_0x2fa414);if(_0x5891db[_0x75cd('0x3f')][_0x75cd('0x49')]){_0x337257[_0x75cd('0x47')]=_[_0x75cd('0x4a')](_0x337257[_0x75cd('0x47')],{'$or':_['map'](_0x2fa414,function(_0x3812bf){if(_0x3812bf['type']!==_0x75cd('0x4b')){var _0x4d91ce={};_0x4d91ce[_0x3812bf['name']]={'$like':'%'+_0x5891db['query']['filter']+'%'};return _0x4d91ce;}})});}_0x337257=_[_0x75cd('0x4a')]({},_0x337257,_0x5891db['options']);var _0x54af1b={'where':_0x337257['where']};return db[_0x75cd('0x4c')]['count'](_0x54af1b)[_0x75cd('0x1e')](function(_0x5a2ac6){_0x4e9c24[_0x75cd('0x2f')]=_0x5a2ac6;if(_0x5891db[_0x75cd('0x3f')][_0x75cd('0x4d')]){_0x337257['include']=[{'all':!![]}];}return db[_0x75cd('0x4c')][_0x75cd('0x4e')](_0x337257);})[_0x75cd('0x1e')](function(_0x562be0){_0x4e9c24[_0x75cd('0x4f')]=_0x562be0;return _0x4e9c24;})[_0x75cd('0x1e')](respondWithFilteredResult(_0x163eed,_0x337257))[_0x75cd('0x27')](handleError(_0x163eed,null));};exports[_0x75cd('0x50')]=function(_0x539a71,_0x59c940){var _0x3483ac={'raw':!![],'where':{'id':_0x539a71[_0x75cd('0x51')]['id']}},_0x23c090={};_0x23c090['model']=_[_0x75cd('0x52')](db[_0x75cd('0x4c')]['rawAttributes']);_0x23c090[_0x75cd('0x3f')]=_['keys'](_0x539a71[_0x75cd('0x3f')]);_0x23c090['filters']=_[_0x75cd('0x53')](_0x23c090[_0x75cd('0x3e')],_0x23c090[_0x75cd('0x3f')]);_0x3483ac[_0x75cd('0x41')]=_['intersection'](_0x23c090[_0x75cd('0x3e')],qs[_0x75cd('0x42')](_0x539a71[_0x75cd('0x3f')][_0x75cd('0x42')]));_0x3483ac[_0x75cd('0x41')]=_0x3483ac[_0x75cd('0x41')][_0x75cd('0x43')]?_0x3483ac[_0x75cd('0x41')]:_0x23c090['model'];if(_0x539a71[_0x75cd('0x3f')][_0x75cd('0x4d')]){_0x3483ac['include']=[{'all':!![]}];}_0x3483ac=_[_0x75cd('0x4a')]({},_0x3483ac,_0x539a71[_0x75cd('0x54')]);return db[_0x75cd('0x4c')][_0x75cd('0x55')](_0x3483ac)[_0x75cd('0x1e')](handleEntityNotFound(_0x59c940,null))[_0x75cd('0x1e')](respondWithResult(_0x59c940,null))[_0x75cd('0x27')](handleError(_0x59c940,null));};exports[_0x75cd('0x56')]=function(_0x34a123,_0x442e27){return db[_0x75cd('0x4c')][_0x75cd('0x56')](_0x34a123[_0x75cd('0x57')],{})[_0x75cd('0x1e')](function(_0x4c2b76){var _0xfa72cd=_0x34a123['user'][_0x75cd('0x36')]({'plain':!![]});if(!_0xfa72cd)throw new Error(_0x75cd('0x58'));if(_0xfa72cd[_0x75cd('0x59')]==='user'){var _0x53a49a=_0x4c2b76['get']({'plain':!![]});var _0x1164c9=_0x75cd('0x37');return db[_0x75cd('0x5a')][_0x75cd('0x55')]({'where':{'name':_0x1164c9,'userProfileId':_0xfa72cd[_0x75cd('0x5b')]},'raw':!![]})[_0x75cd('0x1e')](function(_0x336559){if(_0x336559&&_0x336559[_0x75cd('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x53a49a['name'],'resourceId':_0x53a49a['id'],'type':_0x336559[_0x75cd('0x38')],'sectionId':_0x336559['id']},{})[_0x75cd('0x1e')](function(){return _0x4c2b76;});}else{return _0x4c2b76;}})[_0x75cd('0x27')](function(_0x530012){logger[_0x75cd('0x24')](_0x75cd('0x5d'),_0x530012);throw _0x530012;});}return _0x4c2b76;})[_0x75cd('0x1e')](respondWithResult(_0x442e27,0xc9))['catch'](handleError(_0x442e27,null));};exports[_0x75cd('0x34')]=function(_0x52523a,_0xf89819){if(_0x52523a[_0x75cd('0x57')]['id']){delete _0x52523a['body']['id'];}return db[_0x75cd('0x4c')]['find']({'where':{'id':_0x52523a['params']['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0xf89819,null))[_0x75cd('0x1e')](saveUpdates(_0x52523a[_0x75cd('0x57')],null))['then'](respondWithResult(_0xf89819,null))[_0x75cd('0x27')](handleError(_0xf89819,null));};exports[_0x75cd('0x35')]=function(_0x352f65,_0x164421){return db[_0x75cd('0x4c')][_0x75cd('0x55')]({'where':{'id':_0x352f65['params']['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0x164421,null))[_0x75cd('0x1e')](removeEntity(_0x164421,null))[_0x75cd('0x27')](handleError(_0x164421,null));};exports[_0x75cd('0x5e')]=function(_0x5797db,_0x31257c){return db[_0x75cd('0x4c')]['describe']()[_0x75cd('0x1e')](respondWithResult(_0x31257c,null))[_0x75cd('0x27')](handleError(_0x31257c,null));};exports[_0x75cd('0x5f')]=function(_0x55d638,_0x4d0c8e,_0x1c87a6){var _0x26c24a={'raw':!![],'where':{}},_0x16574e={},_0x524cd4;return db['ChatQueue'][_0x75cd('0x60')]({'where':{'id':_0x55d638[_0x75cd('0x51')]['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0x4d0c8e,null))['then'](function(_0x3139f2){if(_0x3139f2){_0x524cd4=_0x3139f2[_0x75cd('0x36')]({'plain':!![]});_0x16574e['model']=_[_0x75cd('0x52')](db[_0x75cd('0x61')]['rawAttributes']);_0x16574e[_0x75cd('0x3f')]=_[_0x75cd('0x52')](_0x55d638['query']);_0x16574e['filters']=_['intersection'](_0x16574e[_0x75cd('0x3e')],_0x16574e[_0x75cd('0x3f')]);_0x26c24a['attributes']=_[_0x75cd('0x53')](_0x16574e['model'],qs['fields'](_0x55d638[_0x75cd('0x3f')][_0x75cd('0x42')]));_0x26c24a[_0x75cd('0x41')]=_0x26c24a[_0x75cd('0x41')][_0x75cd('0x43')]?_0x26c24a['attributes']:_0x16574e[_0x75cd('0x3e')];if(!_0x55d638[_0x75cd('0x3f')][_0x75cd('0x44')](_0x75cd('0x62'))){_0x26c24a[_0x75cd('0x2e')]=qs[_0x75cd('0x2e')](_0x55d638[_0x75cd('0x3f')]['limit']);_0x26c24a[_0x75cd('0x2c')]=qs[_0x75cd('0x2c')](_0x55d638[_0x75cd('0x3f')][_0x75cd('0x2c')]);}_0x26c24a['order']=qs['sort'](_0x55d638[_0x75cd('0x3f')][_0x75cd('0x46')]);_0x26c24a[_0x75cd('0x47')]=qs[_0x75cd('0x40')](_[_0x75cd('0x48')](_0x55d638[_0x75cd('0x3f')],_0x16574e[_0x75cd('0x40')]));_0x26c24a['where']['ChatQueueId']=_0x3139f2['id'];if(_0x55d638['query']['filter']){_0x26c24a['where']=_[_0x75cd('0x4a')](_0x26c24a[_0x75cd('0x47')],{'$or':_['map'](_0x26c24a['attributes'],function(_0xaafff0){var _0x18f685={};_0x18f685[_0xaafff0]={'$like':'%'+_0x55d638[_0x75cd('0x3f')]['filter']+'%'};return _0x18f685;})});}_0x26c24a=_[_0x75cd('0x4a')]({},_0x26c24a,_0x55d638['options']);return db['UserChatQueue'][_0x75cd('0x4e')](_0x26c24a);}})[_0x75cd('0x1e')](function(_0x3c512c){if(_0x3c512c){return db[_0x75cd('0x63')]['findAndCountAll']({'where':{'id':_[_0x75cd('0x3a')](_0x3c512c,_0x75cd('0x64')),'role':_0x75cd('0x65')},'attributes':['id',_0x75cd('0x38'),_0x75cd('0x66'),_0x75cd('0x67'),_0x75cd('0x68')]});}})[_0x75cd('0x1e')](function(_0x55b856){if(_0x55b856){return{'count':_0x55b856[_0x75cd('0x2f')],'rows':_['map'](_0x55b856['rows'],function(_0x2e8d75){return{'membername':_0x2e8d75[_0x75cd('0x38')],'UserId':_0x2e8d75['id'],'queue_name':_0x524cd4[_0x75cd('0x38')],'ChatQueueId':_0x524cd4['id'],'interface':util[_0x75cd('0x69')]('%s/%s',_0x75cd('0x6a'),_0x2e8d75[_0x75cd('0x38')]),'penalty':0x0,'paused':_0x2e8d75[_0x75cd('0x66')],'createdAt':_0x2e8d75['createdAt'],'updatedAt':_0x2e8d75[_0x75cd('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x75cd('0x1e')](respondWithFilteredResult(_0x4d0c8e,_0x26c24a))[_0x75cd('0x27')](handleError(_0x4d0c8e,null));};exports[_0x75cd('0x6b')]=function(_0x5c6f67,_0x5d2aa6,_0x186fd2){var _0x1aab0e={};var _0x53f6e5={};var _0x1a1b96;var _0x4fedcd;return db['ChatQueue'][_0x75cd('0x60')]({'where':{'id':_0x5c6f67['params']['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0x5d2aa6,null))[_0x75cd('0x1e')](function(_0x2c02ec){if(_0x2c02ec){_0x1a1b96=_0x2c02ec;_0x53f6e5['model']=_['keys'](db[_0x75cd('0x6c')][_0x75cd('0x3b')]);_0x53f6e5[_0x75cd('0x3f')]=_[_0x75cd('0x52')](_0x5c6f67['query']);_0x53f6e5[_0x75cd('0x40')]=_[_0x75cd('0x53')](_0x53f6e5[_0x75cd('0x3e')],_0x53f6e5[_0x75cd('0x3f')]);_0x1aab0e[_0x75cd('0x41')]=_[_0x75cd('0x53')](_0x53f6e5[_0x75cd('0x3e')],qs['fields'](_0x5c6f67[_0x75cd('0x3f')][_0x75cd('0x42')]));_0x1aab0e[_0x75cd('0x41')]=_0x1aab0e['attributes'][_0x75cd('0x43')]?_0x1aab0e[_0x75cd('0x41')]:_0x53f6e5[_0x75cd('0x3e')];_0x1aab0e['order']=qs['sort'](_0x5c6f67['query'][_0x75cd('0x46')]);_0x1aab0e[_0x75cd('0x47')]=qs[_0x75cd('0x40')](_[_0x75cd('0x48')](_0x5c6f67[_0x75cd('0x3f')],_0x53f6e5['filters']));if(_0x5c6f67[_0x75cd('0x3f')][_0x75cd('0x49')]){_0x1aab0e['where']=_['merge'](_0x1aab0e[_0x75cd('0x47')],{'$or':_[_0x75cd('0x3a')](_0x1aab0e[_0x75cd('0x41')],function(_0x38a2b0){var _0x99634e={};_0x99634e[_0x38a2b0]={'$like':'%'+_0x5c6f67[_0x75cd('0x3f')][_0x75cd('0x49')]+'%'};return _0x99634e;})});}_0x1aab0e=_[_0x75cd('0x4a')]({},_0x1aab0e,_0x5c6f67[_0x75cd('0x54')]);return _0x1a1b96[_0x75cd('0x6b')](_0x1aab0e);}})[_0x75cd('0x1e')](function(_0x1bcab2){if(_0x1bcab2){_0x4fedcd=_0x1bcab2['length'];if(!_0x5c6f67[_0x75cd('0x3f')][_0x75cd('0x44')](_0x75cd('0x62'))){_0x1aab0e[_0x75cd('0x2e')]=qs[_0x75cd('0x2e')](_0x5c6f67['query'][_0x75cd('0x2e')]);_0x1aab0e['offset']=qs[_0x75cd('0x2c')](_0x5c6f67[_0x75cd('0x3f')]['offset']);}return _0x1a1b96['getTeams'](_0x1aab0e);}})['then'](function(_0x1daea3){if(_0x1daea3){return _0x1daea3?{'count':_0x4fedcd,'rows':_0x1daea3}:null;}})['then'](respondWithResult(_0x5d2aa6,null))[_0x75cd('0x27')](handleError(_0x5d2aa6,null));};exports[_0x75cd('0x6d')]=function(_0x1d3fb0,_0xf42b06,_0x16a9c8){var _0x53487e=_0x1d3fb0[_0x75cd('0x57')][_0x75cd('0x6e')];return db['Team']['findAll']({'where':{'id':_0x53487e},'attributes':['id'],'include':[{'model':db[_0x75cd('0x63')],'as':'Agents','attributes':['id',_0x75cd('0x38'),_0x75cd('0x6f'),_0x75cd('0x70'),_0x75cd('0x71')],'raw':!![]}]})['then'](function(_0x4fe0eb){if(_0x4fe0eb){var _0x5a198c=_[_0x75cd('0x72')](_0x4fe0eb,function(_0x80dc88){var _0xbdeb5a=_0x80dc88[_0x75cd('0x36')]({'plain':!![]});return _0xbdeb5a[_0x75cd('0x73')];});return db[_0x75cd('0x4c')][_0x75cd('0x55')]({'where':{'id':_0x1d3fb0[_0x75cd('0x51')]['id']}})[_0x75cd('0x1e')](function(_0x4afe1c){return db['sequelize'][_0x75cd('0x74')](function(_0x26f27d){return _0x4afe1c[_0x75cd('0x6d')](_0x53487e,{'transaction':_0x26f27d})[_0x75cd('0x1e')](function(){return BPromise[_0x75cd('0x75')](_0x5a198c,function(_0x4da702){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x4da702['id'],'ChatQueueId':_0x1d3fb0[_0x75cd('0x51')]['id']},'transaction':_0x26f27d});});})[_0x75cd('0x1e')](function(){_0x5a198c[_0x75cd('0x76')](function(_0x2b0552){socket[_0x75cd('0x77')]('userChatQueue:save',{'UserId':_0x2b0552['id'],'ChatQueueId':_0x4afe1c['id']});});});});});}})[_0x75cd('0x1e')](respondWithStatusCode(_0xf42b06,null))[_0x75cd('0x27')](handleError(_0xf42b06,null));};exports[_0x75cd('0x78')]=function(_0x14b25e,_0x4c4319,_0x31ebfd){return db[_0x75cd('0x6c')]['findAll']({'where':{'id':_0x14b25e[_0x75cd('0x3f')][_0x75cd('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x75cd('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x75cd('0x1e')](handleEntityNotFound(_0x4c4319,null))[_0x75cd('0x1e')](function(_0x994c3c){var _0x1a36f4=_[_0x75cd('0x3a')](_0x994c3c,'id');var _0x3b4c5e=[];var _0x59644a=[];var _0x36dafc=squel['select']();_0x36dafc[_0x75cd('0x79')]('tq.TeamId')[_0x75cd('0x7a')](_0x75cd('0x7b'),'tq')['join'](_0x75cd('0x7c'),'ut',_0x75cd('0x7d'))[_0x75cd('0x47')](_0x75cd('0x7e'),_0x14b25e['params']['id']);for(var _0x5217d9=0x0;_0x5217d9<_0x994c3c[_0x75cd('0x43')];_0x5217d9+=0x1){let _0x5a7e25=_0x994c3c[_0x5217d9];for(var _0x547c25=0x0;_0x547c25<_0x5a7e25[_0x75cd('0x73')][_0x75cd('0x43')];_0x547c25+=0x1){let _0x493877=_0x5a7e25[_0x75cd('0x73')][_0x547c25];var _0x4e9644=_0x36dafc[_0x75cd('0x7f')]();_0x4e9644[_0x75cd('0x47')](_0x75cd('0x80'),_0x493877['id']);_0x59644a[_0x75cd('0x81')](db[_0x75cd('0x82')][_0x75cd('0x3f')](_0x4e9644[_0x75cd('0x83')](),{'type':db[_0x75cd('0x82')][_0x75cd('0x84')][_0x75cd('0x85')]})[_0x75cd('0x1e')](function(_0x649a33){if(_0x649a33['length']===0x1){return _0x493877['id'];}else{var _0x2aefe6=_[_0x75cd('0x86')](_[_0x75cd('0x3a')](_0x649a33,'TeamId'),function(_0x899192){return _['includes'](_0x1a36f4,_0x899192);});if(_0x2aefe6){return _0x493877['id'];}}}));}}return BPromise[_0x75cd('0x87')](_0x59644a)[_0x75cd('0x1e')](function(_0x158c2f){_0x3b4c5e=_(_0x3b4c5e)['union'](_0x158c2f)[_0x75cd('0x88')]()[_0x75cd('0x89')]();return db[_0x75cd('0x4c')]['find']({'where':{'id':_0x14b25e[_0x75cd('0x51')]['id']}})['then'](function(_0x56a1b7){return db[_0x75cd('0x82')][_0x75cd('0x74')](function(_0x5aa3b7){return _0x56a1b7[_0x75cd('0x78')](_0x14b25e[_0x75cd('0x3f')][_0x75cd('0x6e')],{'transaction':_0x5aa3b7})[_0x75cd('0x1e')](function(){if(!_[_0x75cd('0x8a')](_0x3b4c5e)){return _0x56a1b7[_0x75cd('0x8b')](_0x3b4c5e,{'transaction':_0x5aa3b7});}})[_0x75cd('0x1e')](function(){_0x3b4c5e[_0x75cd('0x76')](function(_0x561485){socket[_0x75cd('0x77')]('userChatQueue:remove',{'UserId':_0x561485,'ChatQueueId':_0x56a1b7['id']});});});});});});})[_0x75cd('0x1e')](respondWithStatusCode(_0x4c4319,null))['catch'](handleError(_0x4c4319,null));};exports[_0x75cd('0x8c')]=function(_0x8cf28e,_0x5e7ab0,_0xecacd3){return db['ChatQueue'][_0x75cd('0x55')]({'where':{'id':_0x8cf28e['params']['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0x5e7ab0,null))[_0x75cd('0x1e')](function(_0x4376d3){if(_0x4376d3){return _0x4376d3['addAgents'](_0x8cf28e[_0x75cd('0x57')]['ids'],_['omit'](_0x8cf28e[_0x75cd('0x57')],[_0x75cd('0x6e'),'id'])||{})['spread'](function(_0x443bd0){for(var _0x6ab44=0x0;_0x6ab44<_0x8cf28e['body'][_0x75cd('0x6e')]['length'];_0x6ab44+=0x1){socket[_0x75cd('0x77')](_0x75cd('0x8d'),{'UserId':Number(_0x8cf28e['body'][_0x75cd('0x6e')][_0x6ab44]),'ChatQueueId':Number(_0x8cf28e[_0x75cd('0x51')]['id'])});}return _0x443bd0;});}})[_0x75cd('0x1e')](respondWithResult(_0x5e7ab0,null))[_0x75cd('0x27')](handleError(_0x5e7ab0,null));};exports[_0x75cd('0x8b')]=function(_0x97075b,_0x54f24e,_0x3f8449){return db['ChatQueue']['find']({'where':{'id':_0x97075b['params']['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0x54f24e,null))[_0x75cd('0x1e')](function(_0x41ac2c){if(_0x41ac2c){return _0x41ac2c[_0x75cd('0x8b')](_0x97075b[_0x75cd('0x3f')][_0x75cd('0x6e')])['then'](function(){if(_[_0x75cd('0x8e')](_0x97075b[_0x75cd('0x3f')][_0x75cd('0x6e')])){for(var _0x1a89a9=0x0;_0x1a89a9<_0x97075b['query'][_0x75cd('0x6e')][_0x75cd('0x43')];_0x1a89a9+=0x1){socket[_0x75cd('0x77')](_0x75cd('0x8f'),{'UserId':Number(_0x97075b['query'][_0x75cd('0x6e')][_0x1a89a9]),'ChatQueueId':Number(_0x97075b[_0x75cd('0x51')]['id'])});}}else{socket[_0x75cd('0x77')]('userChatQueue:remove',{'UserId':Number(_0x97075b[_0x75cd('0x3f')][_0x75cd('0x6e')]),'ChatQueueId':Number(_0x97075b[_0x75cd('0x51')]['id'])});}});}})[_0x75cd('0x1e')](respondWithStatusCode(_0x54f24e,null))['catch'](handleError(_0x54f24e,null));};exports['getAgents']=function(_0x57991b,_0x5b2c68,_0x38d361){var _0x400c2f={};var _0x2bf2e9={};var _0x543c83;var _0xa2578d;return db['ChatQueue'][_0x75cd('0x60')]({'where':{'id':_0x57991b[_0x75cd('0x51')]['id']}})[_0x75cd('0x1e')](handleEntityNotFound(_0x5b2c68,null))[_0x75cd('0x1e')](function(_0x530e27){if(_0x530e27){_0x543c83=_0x530e27;_0x2bf2e9[_0x75cd('0x3e')]=_['keys'](db[_0x75cd('0x63')][_0x75cd('0x3b')]);_0x2bf2e9[_0x75cd('0x3f')]=_[_0x75cd('0x52')](_0x57991b['query']);_0x2bf2e9[_0x75cd('0x40')]=_[_0x75cd('0x53')](_0x2bf2e9[_0x75cd('0x3e')],_0x2bf2e9[_0x75cd('0x3f')]);_0x400c2f[_0x75cd('0x41')]=_[_0x75cd('0x53')](_0x2bf2e9[_0x75cd('0x3e')],qs[_0x75cd('0x42')](_0x57991b[_0x75cd('0x3f')]['fields']));_0x400c2f[_0x75cd('0x41')]=_0x400c2f[_0x75cd('0x41')][_0x75cd('0x43')]?_0x400c2f[_0x75cd('0x41')]:_0x2bf2e9['model'];_0x400c2f[_0x75cd('0x45')]=qs[_0x75cd('0x46')](_0x57991b[_0x75cd('0x3f')][_0x75cd('0x46')]);_0x400c2f[_0x75cd('0x47')]=qs[_0x75cd('0x40')](_[_0x75cd('0x48')](_0x57991b[_0x75cd('0x3f')],_0x2bf2e9[_0x75cd('0x40')]));if(_0x57991b['query'][_0x75cd('0x49')]){_0x400c2f[_0x75cd('0x47')]=_[_0x75cd('0x4a')](_0x400c2f[_0x75cd('0x47')],{'$or':_['map'](_0x400c2f[_0x75cd('0x41')],function(_0x51af4d){var _0x327d0b={};_0x327d0b[_0x51af4d]={'$like':'%'+_0x57991b['query'][_0x75cd('0x49')]+'%'};return _0x327d0b;})});}_0x400c2f=_[_0x75cd('0x4a')]({},_0x400c2f,_0x57991b[_0x75cd('0x54')]);return _0x543c83['getAgents'](_0x400c2f);}})[_0x75cd('0x1e')](function(_0x4803dd){if(_0x4803dd){_0xa2578d=_0x4803dd[_0x75cd('0x43')];if(!_0x57991b[_0x75cd('0x3f')][_0x75cd('0x44')](_0x75cd('0x62'))){_0x400c2f[_0x75cd('0x2e')]=qs['limit'](_0x57991b['query'][_0x75cd('0x2e')]);_0x400c2f[_0x75cd('0x2c')]=qs[_0x75cd('0x2c')](_0x57991b[_0x75cd('0x3f')][_0x75cd('0x2c')]);}return _0x543c83[_0x75cd('0x90')](_0x400c2f);}})[_0x75cd('0x1e')](function(_0x130b84){if(_0x130b84){return _0x130b84?{'count':_0xa2578d,'rows':_0x130b84}:null;}})[_0x75cd('0x1e')](respondWithResult(_0x5b2c68,null))[_0x75cd('0x27')](handleError(_0x5b2c68,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e754e52..9b74094 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 _0x0dcf=['../../mysqldb','ChatQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x21e49b,_0x3d9b77){var _0x374458=function(_0x4c25d3){while(--_0x4c25d3){_0x21e49b['push'](_0x21e49b['shift']());}};_0x374458(++_0x3d9b77);}(_0x0dcf,0x179));var _0xf0dc=function(_0x3a5e7c,_0x5cbdf3){_0x3a5e7c=_0x3a5e7c-0x0;var _0x41dc9f=_0x0dcf[_0x3a5e7c];return _0x41dc9f;};'use strict';var EventEmitter=require(_0xf0dc('0x0'));var ChatQueue=require(_0xf0dc('0x1'))['db'][_0xf0dc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0dc('0x3'),'afterUpdate':_0xf0dc('0x4'),'afterDestroy':_0xf0dc('0x5')};function emitEvent(_0x4d2705){return function(_0x4c44d2,_0x5c44eb,_0x405a46){ChatQueueEvents[_0xf0dc('0x6')](_0x4d2705+':'+_0x4c44d2['id'],_0x4c44d2);ChatQueueEvents[_0xf0dc('0x6')](_0x4d2705,_0x4c44d2);_0x405a46(null);};}for(var e in events){if(events[_0xf0dc('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xf0dc('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xb871=['hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save','emit'];(function(_0x5908d5,_0x1b50fc){var _0x58a191=function(_0x5784c3){while(--_0x5784c3){_0x5908d5['push'](_0x5908d5['shift']());}};_0x58a191(++_0x1b50fc);}(_0xb871,0x6b));var _0x1b87=function(_0x84ce83,_0x98461d){_0x84ce83=_0x84ce83-0x0;var _0x4490be=_0xb871[_0x84ce83];return _0x4490be;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x1b87('0x0'))['db'][_0x1b87('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1b87('0x2')](0x0);var events={'afterCreate':_0x1b87('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e52f5){return function(_0x27e7fa,_0x39571e,_0x107ee6){ChatQueueEvents[_0x1b87('0x4')](_0x1e52f5+':'+_0x27e7fa['id'],_0x27e7fa);ChatQueueEvents['emit'](_0x1e52f5,_0x27e7fa);_0x107ee6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x1b87('0x5')](e,emitEvent(event));}}module[_0x1b87('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1b246c3..04f1e3a 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 _0xf1a8=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0x36a1d4,_0x5c3a68){var _0x5eadb5=function(_0x5d9ca0){while(--_0x5d9ca0){_0x36a1d4['push'](_0x36a1d4['shift']());}};_0x5eadb5(++_0x5c3a68);}(_0xf1a8,0x143));var _0x8f1a=function(_0x4d0a56,_0x2a631b){_0x4d0a56=_0x4d0a56-0x0;var _0x1885b6=_0xf1a8[_0x4d0a56];return _0x1885b6;};'use strict';var _=require('lodash');var util=require(_0x8f1a('0x0'));var logger=require(_0x8f1a('0x1'))('api');var moment=require(_0x8f1a('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f1a('0x3'));var fs=require('fs');var path=require(_0x8f1a('0x4'));var rimraf=require(_0x8f1a('0x5'));var config=require(_0x8f1a('0x6'));var attributes=require(_0x8f1a('0x7'));module[_0x8f1a('0x8')]=function(_0x16c03a,_0xd98048){return _0x16c03a[_0x8f1a('0x9')](_0x8f1a('0xa'),attributes,{'tableName':_0x8f1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd42e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','api'];(function(_0x521ed8,_0x1f897f){var _0x1f9d76=function(_0x57299e){while(--_0x57299e){_0x521ed8['push'](_0x521ed8['shift']());}};_0x1f9d76(++_0x1f897f);}(_0xd42e,0x184));var _0xed42=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xd42e[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0xed42('0x0'));var util=require(_0xed42('0x1'));var logger=require(_0xed42('0x2'))(_0xed42('0x3'));var moment=require(_0xed42('0x4'));var BPromise=require(_0xed42('0x5'));var rp=require(_0xed42('0x6'));var fs=require('fs');var path=require(_0xed42('0x7'));var rimraf=require(_0xed42('0x8'));var config=require(_0xed42('0x9'));var attributes=require(_0xed42('0xa'));module[_0xed42('0xb')]=function(_0x3ca550,_0x46c645){return _0x3ca550[_0xed42('0xc')](_0xed42('0xd'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e8e8d1b..d1368da 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 _0x174b=['../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','findAll','options','where','attributes','include','map','model','then','find','raw','ShowChatQueue','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f940c,_0x1d40c0){var _0x166d58=function(_0x5b6110){while(--_0x5b6110){_0x4f940c['push'](_0x4f940c['shift']());}};_0x166d58(++_0x1d40c0);}(_0x174b,0x19d));var _0xb174=function(_0x1f658d,_0x8af0ac){_0x1f658d=_0x1f658d-0x0;var _0x266082=_0x174b[_0x1f658d];return _0x266082;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});config[_0xb174('0xa')]=_[_0xb174('0xb')](config[_0xb174('0xa')],{'host':_0xb174('0xc'),'port':0x18eb});var socket=require(_0xb174('0xd'))(new Redis(config[_0xb174('0xa')]));require(_0xb174('0xe'))['register'](socket);function respondWithRpcPromise(_0x84e738,_0x4b6dd6,_0x3a05e9){return new BPromise(function(_0x1a4775,_0x4dffab){return client[_0xb174('0xf')](_0x84e738,_0x3a05e9)['then'](function(_0x3fbd28){logger[_0xb174('0x10')]('ChatQueue,\x20%s,\x20%s',_0x4b6dd6,_0xb174('0x11'));logger[_0xb174('0x12')](_0xb174('0x13'),_0x4b6dd6,_0xb174('0x11'),JSON['stringify'](_0x3fbd28));if(_0x3fbd28[_0xb174('0x14')]){if(_0x3fbd28['error'][_0xb174('0x15')]===0x1f4){logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x3fbd28[_0xb174('0x14')]['message']);return _0x4dffab(_0x3fbd28[_0xb174('0x14')][_0xb174('0x17')]);}logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x3fbd28[_0xb174('0x14')][_0xb174('0x17')]);return _0x1a4775(_0x3fbd28['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x4b6dd6,_0xb174('0x11'));_0x1a4775(_0x3fbd28['result'][_0xb174('0x17')]);}})[_0xb174('0x18')](function(_0x5ac337){logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x5ac337);_0x4dffab(_0x5ac337);});});}exports[_0xb174('0x19')]=function(_0x3117e2){var _0x835251=this;return new Promise(function(_0x1dc03e,_0xcc8d9a){return db['ChatQueue'][_0xb174('0x1a')]({'raw':_0x3117e2[_0xb174('0x1b')]?_0x3117e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3117e2['options']?_0x3117e2[_0xb174('0x1b')][_0xb174('0x1c')]||null:null,'attributes':_0x3117e2[_0xb174('0x1b')]?_0x3117e2['options'][_0xb174('0x1d')]||null:null,'limit':_0x3117e2[_0xb174('0x1b')]?_0x3117e2[_0xb174('0x1b')]['limit']||null:null,'include':_0x3117e2[_0xb174('0x1b')]?_0x3117e2[_0xb174('0x1b')][_0xb174('0x1e')]?_[_0xb174('0x1f')](_0x3117e2[_0xb174('0x1b')]['include'],function(_0x1f6a70){return{'model':db[_0x1f6a70['model']],'as':_0x1f6a70['as'],'attributes':_0x1f6a70[_0xb174('0x1d')],'include':_0x1f6a70[_0xb174('0x1e')]?_[_0xb174('0x1f')](_0x1f6a70['include'],function(_0x59a348){return{'model':db[_0x59a348[_0xb174('0x20')]],'as':_0x59a348['as'],'attributes':_0x59a348[_0xb174('0x1d')],'include':_0x59a348['include']?_['map'](_0x59a348[_0xb174('0x1e')],function(_0x549fcf){return{'model':db[_0x549fcf[_0xb174('0x20')]],'as':_0x549fcf['as'],'attributes':_0x549fcf[_0xb174('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb174('0x21')](function(_0x2e9f7a){logger[_0xb174('0x10')](_0xb174('0x19'),_0x3117e2);logger[_0xb174('0x12')]('GetChatQueue',_0x3117e2,JSON['stringify'](_0x2e9f7a));_0x1dc03e(_0x2e9f7a);})[_0xb174('0x18')](function(_0xa46091){logger[_0xb174('0x14')](_0xb174('0x19'),_0xa46091[_0xb174('0x17')],_0x3117e2);_0xcc8d9a(_0x835251[_0xb174('0x14')](0x1f4,_0xa46091[_0xb174('0x17')]));});});};exports['ShowChatQueue']=function(_0x1517d8){var _0x3af043=this;return new Promise(function(_0x3e1659,_0x362c5c){return db['ChatQueue'][_0xb174('0x22')]({'raw':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x23')]===undefined?!![]:![]:!![],'where':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x1c')]||null:null,'attributes':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x1d')]||null:null,'include':_0x1517d8[_0xb174('0x1b')]?_0x1517d8[_0xb174('0x1b')][_0xb174('0x1e')]?_[_0xb174('0x1f')](_0x1517d8[_0xb174('0x1b')][_0xb174('0x1e')],function(_0x4a7cd8){return{'model':db[_0x4a7cd8[_0xb174('0x20')]],'as':_0x4a7cd8['as'],'attributes':_0x4a7cd8[_0xb174('0x1d')],'include':_0x4a7cd8['include']?_[_0xb174('0x1f')](_0x4a7cd8[_0xb174('0x1e')],function(_0xe3b6c3){return{'model':db[_0xe3b6c3[_0xb174('0x20')]],'as':_0xe3b6c3['as'],'attributes':_0xe3b6c3[_0xb174('0x1d')],'include':_0xe3b6c3['include']?_[_0xb174('0x1f')](_0xe3b6c3[_0xb174('0x1e')],function(_0x2857a5){return{'model':db[_0x2857a5[_0xb174('0x20')]],'as':_0x2857a5['as'],'attributes':_0x2857a5[_0xb174('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb174('0x21')](function(_0x57b823){logger[_0xb174('0x10')](_0xb174('0x24'),_0x1517d8);logger[_0xb174('0x12')]('ShowChatQueue',_0x1517d8,JSON[_0xb174('0x25')](_0x57b823));_0x3e1659(_0x57b823);})[_0xb174('0x18')](function(_0x1a9e9a){logger[_0xb174('0x14')](_0xb174('0x24'),_0x1a9e9a[_0xb174('0x17')],_0x1517d8);_0x362c5c(_0x3af043[_0xb174('0x14')](0x1f4,_0x1a9e9a[_0xb174('0x17')]));});});}; \ No newline at end of file +var _0x6215=['include','model','map','then','ShowChatQueue','find','where','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit'];(function(_0x34161e,_0x63514f){var _0x2619e7=function(_0x80d015){while(--_0x80d015){_0x34161e['push'](_0x34161e['shift']());}};_0x2619e7(++_0x63514f);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5621('0x9')]=_[_0x5621('0xa')](config[_0x5621('0x9')],{'host':_0x5621('0xb'),'port':0x18eb});var socket=require(_0x5621('0xc'))(new Redis(config['redis']));require(_0x5621('0xd'))[_0x5621('0xe')](socket);function respondWithRpcPromise(_0x3aa022,_0x418114,_0x53625c){return new BPromise(function(_0x1f4148,_0x10bb32){return client[_0x5621('0xf')](_0x3aa022,_0x53625c)['then'](function(_0x2b0f51){logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));logger[_0x5621('0x13')](_0x5621('0x14'),_0x418114,_0x5621('0x12'),JSON[_0x5621('0x15')](_0x2b0f51));if(_0x2b0f51[_0x5621('0x16')]){if(_0x2b0f51[_0x5621('0x16')]['code']===0x1f4){logger[_0x5621('0x16')](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')]['message']);return _0x10bb32(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}logger['error'](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);return _0x1f4148(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}else{logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));_0x1f4148(_0x2b0f51[_0x5621('0x18')][_0x5621('0x17')]);}})['catch'](function(_0x1111b2){logger[_0x5621('0x16')]('ChatQueue,\x20%s,\x20%s',_0x418114,_0x1111b2);_0x10bb32(_0x1111b2);});});}exports[_0x5621('0x19')]=function(_0x5647a2){var _0x3ec5f5=this;return new Promise(function(_0x1e366f,_0x179830){return db[_0x5621('0x1a')][_0x5621('0x1b')]({'raw':_0x5647a2['options']?_0x5647a2[_0x5621('0x1c')][_0x5621('0x1d')]===undefined?!![]:![]:!![],'where':_0x5647a2[_0x5621('0x1c')]?_0x5647a2[_0x5621('0x1c')]['where']||null:null,'attributes':_0x5647a2[_0x5621('0x1c')]?_0x5647a2[_0x5621('0x1c')][_0x5621('0x1e')]||null:null,'limit':_0x5647a2[_0x5621('0x1c')]?_0x5647a2[_0x5621('0x1c')][_0x5621('0x1f')]||null:null,'include':_0x5647a2[_0x5621('0x1c')]?_0x5647a2['options'][_0x5621('0x20')]?_['map'](_0x5647a2[_0x5621('0x1c')][_0x5621('0x20')],function(_0x35ea4e){return{'model':db[_0x35ea4e[_0x5621('0x21')]],'as':_0x35ea4e['as'],'attributes':_0x35ea4e[_0x5621('0x1e')],'include':_0x35ea4e[_0x5621('0x20')]?_[_0x5621('0x22')](_0x35ea4e['include'],function(_0x226d73){return{'model':db[_0x226d73[_0x5621('0x21')]],'as':_0x226d73['as'],'attributes':_0x226d73[_0x5621('0x1e')],'include':_0x226d73[_0x5621('0x20')]?_['map'](_0x226d73[_0x5621('0x20')],function(_0x2f0600){return{'model':db[_0x2f0600['model']],'as':_0x2f0600['as'],'attributes':_0x2f0600['attributes']};}):[]};}):[]};}):[]:[]})[_0x5621('0x23')](function(_0x874d8a){logger[_0x5621('0x10')](_0x5621('0x19'),_0x5647a2);logger[_0x5621('0x13')](_0x5621('0x19'),_0x5647a2,JSON[_0x5621('0x15')](_0x874d8a));_0x1e366f(_0x874d8a);})['catch'](function(_0x1cc873){logger[_0x5621('0x16')](_0x5621('0x19'),_0x1cc873[_0x5621('0x17')],_0x5647a2);_0x179830(_0x3ec5f5[_0x5621('0x16')](0x1f4,_0x1cc873['message']));});});};exports[_0x5621('0x24')]=function(_0x66aeb4){var _0xd74700=this;return new Promise(function(_0x14834c,_0x241c38){return db['ChatQueue'][_0x5621('0x25')]({'raw':_0x66aeb4['options']?_0x66aeb4[_0x5621('0x1c')][_0x5621('0x1d')]===undefined?!![]:![]:!![],'where':_0x66aeb4[_0x5621('0x1c')]?_0x66aeb4[_0x5621('0x1c')][_0x5621('0x26')]||null:null,'attributes':_0x66aeb4['options']?_0x66aeb4[_0x5621('0x1c')][_0x5621('0x1e')]||null:null,'include':_0x66aeb4[_0x5621('0x1c')]?_0x66aeb4[_0x5621('0x1c')][_0x5621('0x20')]?_['map'](_0x66aeb4[_0x5621('0x1c')][_0x5621('0x20')],function(_0x103177){return{'model':db[_0x103177['model']],'as':_0x103177['as'],'attributes':_0x103177[_0x5621('0x1e')],'include':_0x103177[_0x5621('0x20')]?_['map'](_0x103177[_0x5621('0x20')],function(_0x4018e2){return{'model':db[_0x4018e2[_0x5621('0x21')]],'as':_0x4018e2['as'],'attributes':_0x4018e2[_0x5621('0x1e')],'include':_0x4018e2[_0x5621('0x20')]?_[_0x5621('0x22')](_0x4018e2[_0x5621('0x20')],function(_0x53c9ff){return{'model':db[_0x53c9ff[_0x5621('0x21')]],'as':_0x53c9ff['as'],'attributes':_0x53c9ff[_0x5621('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5621('0x23')](function(_0x1a2a2e){logger[_0x5621('0x10')](_0x5621('0x24'),_0x66aeb4);logger['debug'](_0x5621('0x24'),_0x66aeb4,JSON[_0x5621('0x15')](_0x1a2a2e));_0x14834c(_0x1a2a2e);})[_0x5621('0x27')](function(_0x5896de){logger['error'](_0x5621('0x24'),_0x5896de['message'],_0x66aeb4);_0x241c38(_0xd74700['error'](0x1f4,_0x5896de[_0x5621('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c2ce964..68d504b 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 _0xac9d=['update','emit','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x389f87,_0x5e6f9f){var _0x5a1f4e=function(_0xf0f0b2){while(--_0xf0f0b2){_0x389f87['push'](_0x389f87['shift']());}};_0x5a1f4e(++_0x5e6f9f);}(_0xac9d,0x14d));var _0xdac9=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0xac9d[_0x211576];return _0x3ce235;};'use strict';var ChatQueueEvents=require(_0xdac9('0x0'));var events=[_0xdac9('0x1'),_0xdac9('0x2'),_0xdac9('0x3')];function createListener(_0x12390c,_0x27eb7c){return function(_0x25d1b3){_0x27eb7c[_0xdac9('0x4')](_0x12390c,_0x25d1b3);};}function removeListener(_0x51a5d7,_0x1c17a6){return function(){ChatQueueEvents['removeListener'](_0x51a5d7,_0x1c17a6);};}exports[_0xdac9('0x5')]=function(_0x1f8ff3){for(var _0x1222bb=0x0,_0x776b6c=events[_0xdac9('0x6')];_0x1222bb<_0x776b6c;_0x1222bb++){var _0x39f560=events[_0x1222bb];var _0x5531af=createListener(_0xdac9('0x7')+_0x39f560,_0x1f8ff3);ChatQueueEvents['on'](_0x39f560,_0x5531af);}}; \ No newline at end of file +var _0x3140=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x5b18e3,_0x5a69ab){var _0x45ba38=function(_0x46bb5b){while(--_0x46bb5b){_0x5b18e3['push'](_0x5b18e3['shift']());}};_0x45ba38(++_0x5a69ab);}(_0x3140,0xaf));var _0x0314=function(_0x361026,_0x2375e2){_0x361026=_0x361026-0x0;var _0x37028e=_0x3140[_0x361026];return _0x37028e;};'use strict';var ChatQueueEvents=require(_0x0314('0x0'));var events=[_0x0314('0x1'),_0x0314('0x2'),_0x0314('0x3')];function createListener(_0x4ac557,_0x4cf353){return function(_0x285be5){_0x4cf353[_0x0314('0x4')](_0x4ac557,_0x285be5);};}function removeListener(_0x1c0f66,_0x3e4284){return function(){ChatQueueEvents[_0x0314('0x5')](_0x1c0f66,_0x3e4284);};}exports[_0x0314('0x6')]=function(_0x9e308d){for(var _0xf87d26=0x0,_0x11ee94=events[_0x0314('0x7')];_0xf87d26<_0x11ee94;_0xf87d26++){var _0x176944=events[_0xf87d26];var _0x495b27=createListener(_0x0314('0x8')+_0x176944,_0x9e308d);ChatQueueEvents['on'](_0x176944,_0x495b27);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2450f13..97cf379 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0x4021fc,_0x316e5e){_0x4021fc=_0x4021fc-0x0;var _0x29b0df=_0x3e74[_0x4021fc];return _0x29b0df;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x40d839,_0x1bca38){var _0x883ea2=function(_0x542268){while(--_0x542268){_0x40d839['push'](_0x40d839['shift']());}};_0x883ea2(++_0x1bca38);}(_0xe14b,0x93));var _0xbe14=function(_0x15d10d,_0x57fec9){_0x15d10d=_0x15d10d-0x0;var _0x5498b2=_0xe14b[_0x15d10d];return _0x5498b2;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('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 9159871..6badb3b 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 _0x64ea=['exports','STRING','DATE','moment','sequelize'];(function(_0x468be0,_0x50b945){var _0x3c71ec=function(_0x40ad7c){while(--_0x40ad7c){_0x468be0['push'](_0x468be0['shift']());}};_0x3c71ec(++_0x50b945);}(_0x64ea,0x80));var _0xa64e=function(_0x4d4e87,_0x3da0bc){_0x4d4e87=_0x4d4e87-0x0;var _0x580ca3=_0x64ea[_0x4d4e87];return _0x580ca3;};'use strict';var moment=require(_0xa64e('0x0'));var Sequelize=require(_0xa64e('0x1'));module[_0xa64e('0x2')]={'uniqueid':{'type':Sequelize[_0xa64e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa64e('0x3')]},'joinAt':{'type':Sequelize[_0xa64e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa64e('0x4')]},'exitAt':{'type':Sequelize[_0xa64e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2986=['DATE','sequelize','exports'];(function(_0xf44b9,_0x99b1c3){var _0x36f2a0=function(_0x18c09c){while(--_0x18c09c){_0xf44b9['push'](_0xf44b9['shift']());}};_0x36f2a0(++_0x99b1c3);}(_0x2986,0xa9));var _0x6298=function(_0x3fb65d,_0x35c34b){_0x3fb65d=_0x3fb65d-0x0;var _0x13c78f=_0x2986[_0x3fb65d];return _0x13c78f;};'use strict';var moment=require('moment');var Sequelize=require(_0x6298('0x0'));module[_0x6298('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6298('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6298('0x2')]},'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 b84a24d..5e8dfe6 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 _0x16a6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2d8428,_0x505867){var _0x4fe776=function(_0x52e9d0){while(--_0x52e9d0){_0x2d8428['push'](_0x2d8428['shift']());}};_0x4fe776(++_0x505867);}(_0x16a6,0x15c));var _0x616a=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x16a6[_0x4bc428];return _0x3ca37f;};'use strict';var emlformat=require(_0x616a('0x0'));var rimraf=require(_0x616a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616a('0x2'));var rp=require(_0x616a('0x3'));var moment=require(_0x616a('0x4'));var BPromise=require(_0x616a('0x5'));var Mustache=require(_0x616a('0x6'));var util=require(_0x616a('0x7'));var path=require('path');var sox=require(_0x616a('0x8'));var csv=require(_0x616a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x616a('0xa'));var squel=require(_0x616a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x616a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x616a('0xd'));var Papa=require('papaparse');var Redis=require(_0x616a('0xe'));var authService=require(_0x616a('0xf'));var qs=require(_0x616a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616a('0x11'));var logger=require(_0x616a('0x12'))(_0x616a('0x13'));var utils=require(_0x616a('0x14'));var config=require(_0x616a('0x15'));var licenseUtil=require(_0x616a('0x16'));var db=require(_0x616a('0x17'))['db'];function respondWithStatusCode(_0x4122b7,_0x5755c7){_0x5755c7=_0x5755c7||0xcc;return function(_0x318dfe){if(_0x318dfe){return _0x4122b7[_0x616a('0x18')](_0x5755c7);}return _0x4122b7[_0x616a('0x19')](_0x5755c7)[_0x616a('0x1a')]();};}function respondWithResult(_0x295fc2,_0x4a33d5){_0x4a33d5=_0x4a33d5||0xc8;return function(_0x1399c1){if(_0x1399c1){return _0x295fc2[_0x616a('0x19')](_0x4a33d5)[_0x616a('0x1b')](_0x1399c1);}};}function respondWithFilteredResult(_0x18b6dc,_0x3bcf20){return function(_0x53f228){if(_0x53f228){var _0x204e68=typeof _0x3bcf20[_0x616a('0x1c')]==='undefined'&&typeof _0x3bcf20['limit']===_0x616a('0x1d');var _0x4768b2=_0x53f228[_0x616a('0x1e')];var _0x4d59e7=_0x204e68?0x0:_0x3bcf20[_0x616a('0x1c')];var _0x1f3241=_0x204e68?_0x53f228['count']:_0x3bcf20['offset']+_0x3bcf20[_0x616a('0x1f')];var _0x27e95c;if(_0x1f3241>=_0x4768b2){_0x1f3241=_0x4768b2;_0x27e95c=0xc8;}else{_0x27e95c=0xce;}_0x18b6dc[_0x616a('0x19')](_0x27e95c);return _0x18b6dc[_0x616a('0x20')]('Content-Range',_0x4d59e7+'-'+_0x1f3241+'/'+_0x4768b2)['json'](_0x53f228);}return null;};}function patchUpdates(_0x5568fd){return function(_0x5f2e80){try{jsonpatch['apply'](_0x5f2e80,_0x5568fd,!![]);}catch(_0x5ee3f2){return BPromise[_0x616a('0x21')](_0x5ee3f2);}return _0x5f2e80['save']();};}function saveUpdates(_0xb8ceeb,_0x137974){return function(_0x4f5594){if(_0x4f5594){return _0x4f5594[_0x616a('0x22')](_0xb8ceeb)[_0x616a('0x23')](function(_0x3d484b){return _0x3d484b;});}return null;};}function removeEntity(_0x100c98,_0x500c22){return function(_0x2db2bb){if(_0x2db2bb){return _0x2db2bb[_0x616a('0x24')]()[_0x616a('0x23')](function(){_0x100c98[_0x616a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e11f2,_0x4be8a8){return function(_0x30c1a){if(!_0x30c1a){_0x3e11f2[_0x616a('0x18')](0x194);}return _0x30c1a;};}function handleError(_0x5f1e6a,_0x55abc8){_0x55abc8=_0x55abc8||0x1f4;return function(_0x50c6b8){logger[_0x616a('0x25')](_0x50c6b8[_0x616a('0x26')]);if(_0x50c6b8[_0x616a('0x27')]){delete _0x50c6b8[_0x616a('0x27')];}_0x5f1e6a['status'](_0x55abc8)[_0x616a('0x28')](_0x50c6b8);};}exports[_0x616a('0x29')]=function(_0x195b73,_0x163fd0){var _0x28ca50={},_0x87db00={},_0x41a22d={'count':0x0,'rows':[]};var _0x5f3a59=_[_0x616a('0x2a')](db[_0x616a('0x2b')]['rawAttributes'],function(_0x41f722){return{'name':_0x41f722['fieldName'],'type':_0x41f722['type'][_0x616a('0x2c')]};});_0x87db00[_0x616a('0x2d')]=_[_0x616a('0x2a')](_0x5f3a59,'name');_0x87db00[_0x616a('0x2e')]=_[_0x616a('0x2f')](_0x195b73[_0x616a('0x2e')]);_0x87db00[_0x616a('0x30')]=_[_0x616a('0x31')](_0x87db00[_0x616a('0x2d')],_0x87db00['query']);_0x28ca50[_0x616a('0x32')]=_['intersection'](_0x87db00[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x195b73[_0x616a('0x2e')]['fields']));_0x28ca50[_0x616a('0x32')]=_0x28ca50[_0x616a('0x32')]['length']?_0x28ca50['attributes']:_0x87db00[_0x616a('0x2d')];if(!_0x195b73[_0x616a('0x2e')][_0x616a('0x34')](_0x616a('0x35'))){_0x28ca50['limit']=qs['limit'](_0x195b73['query'][_0x616a('0x1f')]);_0x28ca50[_0x616a('0x1c')]=qs[_0x616a('0x1c')](_0x195b73[_0x616a('0x2e')][_0x616a('0x1c')]);}_0x28ca50[_0x616a('0x36')]=qs[_0x616a('0x37')](_0x195b73[_0x616a('0x2e')][_0x616a('0x37')]);_0x28ca50[_0x616a('0x38')]=qs['filters'](_[_0x616a('0x39')](_0x195b73['query'],_0x87db00[_0x616a('0x30')]),_0x5f3a59);if(_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]){_0x28ca50[_0x616a('0x38')]=_[_0x616a('0x3b')](_0x28ca50[_0x616a('0x38')],{'$or':_[_0x616a('0x2a')](_0x5f3a59,function(_0x220c32){if(_0x220c32[_0x616a('0x3c')]!=='VIRTUAL'){var _0x304e27={};_0x304e27[_0x220c32[_0x616a('0x27')]]={'$like':'%'+_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]+'%'};return _0x304e27;}})});}_0x28ca50=_['merge']({},_0x28ca50,_0x195b73[_0x616a('0x3d')]);var _0x4c6a76={'where':_0x28ca50[_0x616a('0x38')]};return db['ChatQueueReport'][_0x616a('0x1e')](_0x4c6a76)[_0x616a('0x23')](function(_0x598085){_0x41a22d[_0x616a('0x1e')]=_0x598085;if(_0x195b73['query'][_0x616a('0x3e')]){_0x28ca50[_0x616a('0x3f')]=[{'all':!![]}];}return db[_0x616a('0x2b')][_0x616a('0x40')](_0x28ca50);})[_0x616a('0x23')](function(_0x21fd2b){_0x41a22d[_0x616a('0x41')]=_0x21fd2b;return _0x41a22d;})['then'](respondWithFilteredResult(_0x163fd0,_0x28ca50))[_0x616a('0x42')](handleError(_0x163fd0,null));};exports['show']=function(_0x409689,_0x35e3e3){var _0x199140={'raw':!![],'where':{'id':_0x409689[_0x616a('0x43')]['id']}},_0x4dbb8b={};_0x4dbb8b[_0x616a('0x2d')]=_[_0x616a('0x2f')](db[_0x616a('0x2b')][_0x616a('0x44')]);_0x4dbb8b['query']=_[_0x616a('0x2f')](_0x409689[_0x616a('0x2e')]);_0x4dbb8b[_0x616a('0x30')]=_['intersection'](_0x4dbb8b[_0x616a('0x2d')],_0x4dbb8b[_0x616a('0x2e')]);_0x199140[_0x616a('0x32')]=_[_0x616a('0x31')](_0x4dbb8b[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x409689[_0x616a('0x2e')]['fields']));_0x199140[_0x616a('0x32')]=_0x199140[_0x616a('0x32')]['length']?_0x199140['attributes']:_0x4dbb8b[_0x616a('0x2d')];if(_0x409689[_0x616a('0x2e')][_0x616a('0x3e')]){_0x199140[_0x616a('0x3f')]=[{'all':!![]}];}_0x199140=_[_0x616a('0x3b')]({},_0x199140,_0x409689[_0x616a('0x3d')]);return db['ChatQueueReport'][_0x616a('0x45')](_0x199140)[_0x616a('0x23')](handleEntityNotFound(_0x35e3e3,null))[_0x616a('0x23')](respondWithResult(_0x35e3e3,null))['catch'](handleError(_0x35e3e3,null));};exports[_0x616a('0x46')]=function(_0x507efa,_0x52d38){return db[_0x616a('0x2b')][_0x616a('0x46')](_0x507efa[_0x616a('0x47')],{})['then'](respondWithResult(_0x52d38,0xc9))[_0x616a('0x42')](handleError(_0x52d38,null));};exports[_0x616a('0x22')]=function(_0x3bea90,_0x3d42fc){if(_0x3bea90[_0x616a('0x47')]['id']){delete _0x3bea90['body']['id'];}return db[_0x616a('0x2b')][_0x616a('0x45')]({'where':{'id':_0x3bea90[_0x616a('0x43')]['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x3d42fc,null))[_0x616a('0x23')](saveUpdates(_0x3bea90[_0x616a('0x47')],null))['then'](respondWithResult(_0x3d42fc,null))[_0x616a('0x42')](handleError(_0x3d42fc,null));};exports[_0x616a('0x24')]=function(_0x349cd0,_0x16e6c2){return db['ChatQueueReport'][_0x616a('0x45')]({'where':{'id':_0x349cd0['params']['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x16e6c2,null))[_0x616a('0x23')](removeEntity(_0x16e6c2,null))['catch'](handleError(_0x16e6c2,null));};exports[_0x616a('0x48')]=function(_0x1ea086,_0x30a48e){return db['ChatQueueReport'][_0x616a('0x48')]()[_0x616a('0x23')](respondWithResult(_0x30a48e,null))[_0x616a('0x42')](handleError(_0x30a48e,null));}; \ No newline at end of file +var _0x2484=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','intersection','fields','query','attributes','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x419ec0,_0x5775ad){var _0x475500=function(_0x2dffd0){while(--_0x2dffd0){_0x419ec0['push'](_0x419ec0['shift']());}};_0x475500(++_0x5775ad);}(_0x2484,0x178));var _0x4248=function(_0x367816,_0x35633c){_0x367816=_0x367816-0x0;var _0x2cdde2=_0x2484[_0x367816];return _0x2cdde2;};'use strict';var emlformat=require(_0x4248('0x0'));var rimraf=require(_0x4248('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4248('0x2'));var rp=require(_0x4248('0x3'));var moment=require(_0x4248('0x4'));var BPromise=require(_0x4248('0x5'));var Mustache=require(_0x4248('0x6'));var util=require(_0x4248('0x7'));var path=require(_0x4248('0x8'));var sox=require('sox');var csv=require(_0x4248('0x9'));var ejs=require(_0x4248('0xa'));var fs=require('fs');var fs_extra=require(_0x4248('0xb'));var _=require(_0x4248('0xc'));var squel=require(_0x4248('0xd'));var crypto=require(_0x4248('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4248('0xf'));var toCsv=require(_0x4248('0x9'));var querystring=require(_0x4248('0x10'));var Papa=require(_0x4248('0x11'));var Redis=require(_0x4248('0x12'));var authService=require(_0x4248('0x13'));var qs=require(_0x4248('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4248('0x15'));var logger=require('../../config/logger')(_0x4248('0x16'));var utils=require(_0x4248('0x17'));var config=require(_0x4248('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb5fd1,_0x5237e9){_0x5237e9=_0x5237e9||0xcc;return function(_0x182e84){if(_0x182e84){return _0xeb5fd1[_0x4248('0x19')](_0x5237e9);}return _0xeb5fd1[_0x4248('0x1a')](_0x5237e9)[_0x4248('0x1b')]();};}function respondWithResult(_0x3a557b,_0x588077){_0x588077=_0x588077||0xc8;return function(_0x8b30bb){if(_0x8b30bb){return _0x3a557b[_0x4248('0x1a')](_0x588077)[_0x4248('0x1c')](_0x8b30bb);}};}function respondWithFilteredResult(_0x35308b,_0x3e7d0a){return function(_0x51c92e){if(_0x51c92e){var _0x46cfbb=typeof _0x3e7d0a[_0x4248('0x1d')]===_0x4248('0x1e')&&typeof _0x3e7d0a[_0x4248('0x1f')]===_0x4248('0x1e');var _0x321e92=_0x51c92e[_0x4248('0x20')];var _0x45edc6=_0x46cfbb?0x0:_0x3e7d0a[_0x4248('0x1d')];var _0xd03b87=_0x46cfbb?_0x51c92e[_0x4248('0x20')]:_0x3e7d0a[_0x4248('0x1d')]+_0x3e7d0a[_0x4248('0x1f')];var _0x1b2f10;if(_0xd03b87>=_0x321e92){_0xd03b87=_0x321e92;_0x1b2f10=0xc8;}else{_0x1b2f10=0xce;}_0x35308b[_0x4248('0x1a')](_0x1b2f10);return _0x35308b[_0x4248('0x21')](_0x4248('0x22'),_0x45edc6+'-'+_0xd03b87+'/'+_0x321e92)[_0x4248('0x1c')](_0x51c92e);}return null;};}function patchUpdates(_0x5ab53e){return function(_0x3c1c46){try{jsonpatch[_0x4248('0x23')](_0x3c1c46,_0x5ab53e,!![]);}catch(_0x2d674b){return BPromise[_0x4248('0x24')](_0x2d674b);}return _0x3c1c46['save']();};}function saveUpdates(_0x43c75d,_0x37b1b3){return function(_0x30b232){if(_0x30b232){return _0x30b232['update'](_0x43c75d)[_0x4248('0x25')](function(_0x25ffa3){return _0x25ffa3;});}return null;};}function removeEntity(_0x50f032,_0x3bfcf2){return function(_0x598681){if(_0x598681){return _0x598681[_0x4248('0x26')]()[_0x4248('0x25')](function(){_0x50f032[_0x4248('0x1a')](0xcc)[_0x4248('0x1b')]();});}};}function handleEntityNotFound(_0x5a3938,_0x1c6ade){return function(_0x205382){if(!_0x205382){_0x5a3938[_0x4248('0x19')](0x194);}return _0x205382;};}function handleError(_0xb3e0e0,_0xd758e6){_0xd758e6=_0xd758e6||0x1f4;return function(_0x429641){logger[_0x4248('0x27')](_0x429641[_0x4248('0x28')]);if(_0x429641[_0x4248('0x29')]){delete _0x429641[_0x4248('0x29')];}_0xb3e0e0[_0x4248('0x1a')](_0xd758e6)[_0x4248('0x2a')](_0x429641);};}exports[_0x4248('0x2b')]=function(_0xf72ecc,_0xf06a1a){var _0x439859={},_0x482689={},_0x346d91={'count':0x0,'rows':[]};var _0x40ca90=_[_0x4248('0x2c')](db['ChatQueueReport'][_0x4248('0x2d')],function(_0x1b4768){return{'name':_0x1b4768[_0x4248('0x2e')],'type':_0x1b4768[_0x4248('0x2f')][_0x4248('0x30')]};});_0x482689[_0x4248('0x31')]=_[_0x4248('0x2c')](_0x40ca90,'name');_0x482689['query']=_['keys'](_0xf72ecc['query']);_0x482689['filters']=_['intersection'](_0x482689['model'],_0x482689['query']);_0x439859['attributes']=_[_0x4248('0x32')](_0x482689[_0x4248('0x31')],qs[_0x4248('0x33')](_0xf72ecc[_0x4248('0x34')]['fields']));_0x439859[_0x4248('0x35')]=_0x439859['attributes'][_0x4248('0x36')]?_0x439859[_0x4248('0x35')]:_0x482689[_0x4248('0x31')];if(!_0xf72ecc[_0x4248('0x34')]['hasOwnProperty']('nolimit')){_0x439859[_0x4248('0x1f')]=qs[_0x4248('0x1f')](_0xf72ecc[_0x4248('0x34')][_0x4248('0x1f')]);_0x439859[_0x4248('0x1d')]=qs[_0x4248('0x1d')](_0xf72ecc[_0x4248('0x34')][_0x4248('0x1d')]);}_0x439859['order']=qs['sort'](_0xf72ecc['query'][_0x4248('0x37')]);_0x439859['where']=qs[_0x4248('0x38')](_[_0x4248('0x39')](_0xf72ecc[_0x4248('0x34')],_0x482689[_0x4248('0x38')]),_0x40ca90);if(_0xf72ecc[_0x4248('0x34')][_0x4248('0x3a')]){_0x439859[_0x4248('0x3b')]=_[_0x4248('0x3c')](_0x439859['where'],{'$or':_[_0x4248('0x2c')](_0x40ca90,function(_0x24a824){if(_0x24a824['type']!==_0x4248('0x3d')){var _0x38a7ab={};_0x38a7ab[_0x24a824['name']]={'$like':'%'+_0xf72ecc[_0x4248('0x34')][_0x4248('0x3a')]+'%'};return _0x38a7ab;}})});}_0x439859=_[_0x4248('0x3c')]({},_0x439859,_0xf72ecc[_0x4248('0x3e')]);var _0xb7f152={'where':_0x439859['where']};return db[_0x4248('0x3f')]['count'](_0xb7f152)['then'](function(_0x33152c){_0x346d91[_0x4248('0x20')]=_0x33152c;if(_0xf72ecc[_0x4248('0x34')][_0x4248('0x40')]){_0x439859[_0x4248('0x41')]=[{'all':!![]}];}return db[_0x4248('0x3f')][_0x4248('0x42')](_0x439859);})[_0x4248('0x25')](function(_0x267923){_0x346d91[_0x4248('0x43')]=_0x267923;return _0x346d91;})['then'](respondWithFilteredResult(_0xf06a1a,_0x439859))[_0x4248('0x44')](handleError(_0xf06a1a,null));};exports[_0x4248('0x45')]=function(_0x3b40ad,_0x4b9200){var _0x57ff44={'raw':!![],'where':{'id':_0x3b40ad[_0x4248('0x46')]['id']}},_0x4b29c1={};_0x4b29c1[_0x4248('0x31')]=_[_0x4248('0x47')](db[_0x4248('0x3f')][_0x4248('0x2d')]);_0x4b29c1[_0x4248('0x34')]=_['keys'](_0x3b40ad[_0x4248('0x34')]);_0x4b29c1[_0x4248('0x38')]=_[_0x4248('0x32')](_0x4b29c1['model'],_0x4b29c1[_0x4248('0x34')]);_0x57ff44[_0x4248('0x35')]=_[_0x4248('0x32')](_0x4b29c1['model'],qs['fields'](_0x3b40ad[_0x4248('0x34')][_0x4248('0x33')]));_0x57ff44[_0x4248('0x35')]=_0x57ff44[_0x4248('0x35')]['length']?_0x57ff44[_0x4248('0x35')]:_0x4b29c1[_0x4248('0x31')];if(_0x3b40ad['query'][_0x4248('0x40')]){_0x57ff44['include']=[{'all':!![]}];}_0x57ff44=_[_0x4248('0x3c')]({},_0x57ff44,_0x3b40ad[_0x4248('0x3e')]);return db['ChatQueueReport'][_0x4248('0x48')](_0x57ff44)['then'](handleEntityNotFound(_0x4b9200,null))[_0x4248('0x25')](respondWithResult(_0x4b9200,null))[_0x4248('0x44')](handleError(_0x4b9200,null));};exports[_0x4248('0x49')]=function(_0x20184b,_0x47b0ef){return db['ChatQueueReport']['create'](_0x20184b[_0x4248('0x4a')],{})[_0x4248('0x25')](respondWithResult(_0x47b0ef,0xc9))[_0x4248('0x44')](handleError(_0x47b0ef,null));};exports[_0x4248('0x4b')]=function(_0x4c5b11,_0x42f12a){if(_0x4c5b11[_0x4248('0x4a')]['id']){delete _0x4c5b11[_0x4248('0x4a')]['id'];}return db[_0x4248('0x3f')]['find']({'where':{'id':_0x4c5b11[_0x4248('0x46')]['id']}})[_0x4248('0x25')](handleEntityNotFound(_0x42f12a,null))[_0x4248('0x25')](saveUpdates(_0x4c5b11[_0x4248('0x4a')],null))[_0x4248('0x25')](respondWithResult(_0x42f12a,null))[_0x4248('0x44')](handleError(_0x42f12a,null));};exports[_0x4248('0x26')]=function(_0x46b2e4,_0x34a922){return db['ChatQueueReport'][_0x4248('0x48')]({'where':{'id':_0x46b2e4[_0x4248('0x46')]['id']}})[_0x4248('0x25')](handleEntityNotFound(_0x34a922,null))[_0x4248('0x25')](removeEntity(_0x34a922,null))[_0x4248('0x44')](handleError(_0x34a922,null));};exports['describe']=function(_0x548bfa,_0x27e3a5){return db[_0x4248('0x3f')][_0x4248('0x4c')]()['then'](respondWithResult(_0x27e3a5,null))['catch'](handleError(_0x27e3a5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index fcef776..18e3dc7 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5f26a6,_0x372d7e){var _0x19ce1a=function(_0x223c4b){while(--_0x223c4b){_0x5f26a6['push'](_0x5f26a6['shift']());}};_0x19ce1a(++_0x372d7e);}(_0x757a,0xde));var _0xa757=function(_0xaa9a91,_0x1469d0){_0xaa9a91=_0xaa9a91-0x0;var _0x1d5402=_0x757a[_0xaa9a91];return _0x1d5402;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x280727,_0x4432ea){var _0x5e81b8=function(_0x338d73){while(--_0x338d73){_0x280727['push'](_0x280727['shift']());}};_0x5e81b8(++_0x4432ea);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4f69e47..59c519e 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 _0x5c33=['code','message','result','catch','CreateChatQueueReport','body','options','ChatQueueReport','update','raw','limit','then','UpdateChatQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4421eb,_0x17b98f){var _0x142c50=function(_0x5ed18b){while(--_0x5ed18b){_0x4421eb['push'](_0x4421eb['shift']());}};_0x142c50(++_0x17b98f);}(_0x5c33,0x199));var _0x35c3=function(_0x135fce,_0x320c7a){_0x135fce=_0x135fce-0x0;var _0x3a8afc=_0x5c33[_0x135fce];return _0x3a8afc;};'use strict';var _=require(_0x35c3('0x0'));var util=require(_0x35c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35c3('0x2'));var fs=require('fs');var Redis=require(_0x35c3('0x3'));var db=require(_0x35c3('0x4'))['db'];var utils=require(_0x35c3('0x5'));var logger=require(_0x35c3('0x6'))(_0x35c3('0x7'));var config=require(_0x35c3('0x8'));var jayson=require(_0x35c3('0x9'));var client=jayson[_0x35c3('0xa')][_0x35c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15d474,_0x19a25d,_0x127032){return new BPromise(function(_0x6918fd,_0xf31fb4){return client[_0x35c3('0xc')](_0x15d474,_0x127032)['then'](function(_0x393606){logger[_0x35c3('0xd')](_0x35c3('0xe'),_0x19a25d,_0x35c3('0xf'));logger[_0x35c3('0x10')](_0x35c3('0x11'),_0x19a25d,_0x35c3('0xf'),JSON[_0x35c3('0x12')](_0x393606));if(_0x393606[_0x35c3('0x13')]){if(_0x393606[_0x35c3('0x13')][_0x35c3('0x14')]===0x1f4){logger[_0x35c3('0x13')](_0x35c3('0xe'),_0x19a25d,_0x393606['error']['message']);return _0xf31fb4(_0x393606[_0x35c3('0x13')][_0x35c3('0x15')]);}logger[_0x35c3('0x13')](_0x35c3('0xe'),_0x19a25d,_0x393606[_0x35c3('0x13')]['message']);return _0x6918fd(_0x393606[_0x35c3('0x13')][_0x35c3('0x15')]);}else{logger[_0x35c3('0xd')](_0x35c3('0xe'),_0x19a25d,'request\x20sent');_0x6918fd(_0x393606[_0x35c3('0x16')][_0x35c3('0x15')]);}})[_0x35c3('0x17')](function(_0xd1e1f3){logger[_0x35c3('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x19a25d,_0xd1e1f3);_0xf31fb4(_0xd1e1f3);});});}exports[_0x35c3('0x18')]=function(_0x180b5b){var _0xe1a1c6=this;return new Promise(function(_0x13ef6e,_0x577036){return db['ChatQueueReport']['create'](_0x180b5b[_0x35c3('0x19')],{'raw':_0x180b5b[_0x35c3('0x1a')]?_0x180b5b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x28a0ba){logger[_0x35c3('0xd')](_0x35c3('0x18'),_0x180b5b);logger[_0x35c3('0x10')](_0x35c3('0x18'),_0x180b5b,JSON[_0x35c3('0x12')](_0x28a0ba));_0x13ef6e(_0x28a0ba);})[_0x35c3('0x17')](function(_0x7f5297){logger[_0x35c3('0x13')](_0x35c3('0x18'),_0x7f5297[_0x35c3('0x15')],_0x180b5b);_0x577036(_0xe1a1c6[_0x35c3('0x13')](0x1f4,_0x7f5297[_0x35c3('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x290509){var _0xf3ff71=this;return new Promise(function(_0x2ca057,_0x345e33){return db[_0x35c3('0x1b')][_0x35c3('0x1c')](_0x290509[_0x35c3('0x19')],{'raw':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')][_0x35c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')]['where']||null:null,'attributes':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')]['attributes']||null:null,'limit':_0x290509[_0x35c3('0x1a')]?_0x290509[_0x35c3('0x1a')][_0x35c3('0x1e')]||null:null})[_0x35c3('0x1f')](function(_0x44ac3){logger[_0x35c3('0xd')](_0x35c3('0x20'),_0x290509);logger[_0x35c3('0x10')](_0x35c3('0x20'),_0x290509,JSON[_0x35c3('0x12')](_0x44ac3));_0x2ca057(_0x44ac3);})[_0x35c3('0x17')](function(_0x466757){logger['error'](_0x35c3('0x20'),_0x466757[_0x35c3('0x15')],_0x290509);_0x345e33(_0xf3ff71['error'](0x1f4,_0x466757['message']));});});}; \ No newline at end of file +var _0xeb82=['raw','then','UpdateChatQueueReport','update','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','code','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options'];(function(_0x146141,_0x110573){var _0x9688b0=function(_0x5e09b7){while(--_0x5e09b7){_0x146141['push'](_0x146141['shift']());}};_0x9688b0(++_0x110573);}(_0xeb82,0x127));var _0x2eb8=function(_0xd8ae29,_0x24ca4d){_0xd8ae29=_0xd8ae29-0x0;var _0x375870=_0xeb82[_0xd8ae29];return _0x375870;};'use strict';var _=require(_0x2eb8('0x0'));var util=require(_0x2eb8('0x1'));var moment=require(_0x2eb8('0x2'));var BPromise=require(_0x2eb8('0x3'));var rs=require(_0x2eb8('0x4'));var fs=require('fs');var Redis=require(_0x2eb8('0x5'));var db=require(_0x2eb8('0x6'))['db'];var utils=require(_0x2eb8('0x7'));var logger=require(_0x2eb8('0x8'))(_0x2eb8('0x9'));var config=require('../../config/environment');var jayson=require(_0x2eb8('0xa'));var client=jayson[_0x2eb8('0xb')][_0x2eb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5de141,_0x357b39,_0x1706d3){return new BPromise(function(_0x2cac70,_0x4f1af9){return client[_0x2eb8('0xd')](_0x5de141,_0x1706d3)['then'](function(_0x468e0c){logger[_0x2eb8('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x357b39,_0x2eb8('0xf'));logger[_0x2eb8('0x10')](_0x2eb8('0x11'),_0x357b39,_0x2eb8('0xf'),JSON['stringify'](_0x468e0c));if(_0x468e0c['error']){if(_0x468e0c['error'][_0x2eb8('0x12')]===0x1f4){logger[_0x2eb8('0x13')](_0x2eb8('0x14'),_0x357b39,_0x468e0c[_0x2eb8('0x13')][_0x2eb8('0x15')]);return _0x4f1af9(_0x468e0c[_0x2eb8('0x13')]['message']);}logger[_0x2eb8('0x13')](_0x2eb8('0x14'),_0x357b39,_0x468e0c[_0x2eb8('0x13')][_0x2eb8('0x15')]);return _0x2cac70(_0x468e0c['error'][_0x2eb8('0x15')]);}else{logger[_0x2eb8('0xe')](_0x2eb8('0x14'),_0x357b39,_0x2eb8('0xf'));_0x2cac70(_0x468e0c[_0x2eb8('0x16')][_0x2eb8('0x15')]);}})[_0x2eb8('0x17')](function(_0x519ed5){logger[_0x2eb8('0x13')](_0x2eb8('0x14'),_0x357b39,_0x519ed5);_0x4f1af9(_0x519ed5);});});}exports[_0x2eb8('0x18')]=function(_0x5995ef){var _0x23de92=this;return new Promise(function(_0x5f4fdc,_0x43df3c){return db[_0x2eb8('0x19')][_0x2eb8('0x1a')](_0x5995ef[_0x2eb8('0x1b')],{'raw':_0x5995ef[_0x2eb8('0x1c')]?_0x5995ef[_0x2eb8('0x1c')][_0x2eb8('0x1d')]===undefined?!![]:![]:!![]})[_0x2eb8('0x1e')](function(_0x3226f8){logger[_0x2eb8('0xe')](_0x2eb8('0x18'),_0x5995ef);logger['debug'](_0x2eb8('0x18'),_0x5995ef,JSON['stringify'](_0x3226f8));_0x5f4fdc(_0x3226f8);})['catch'](function(_0x280956){logger['error'](_0x2eb8('0x18'),_0x280956[_0x2eb8('0x15')],_0x5995ef);_0x43df3c(_0x23de92[_0x2eb8('0x13')](0x1f4,_0x280956['message']));});});};exports[_0x2eb8('0x1f')]=function(_0x33c3e4){var _0x50095e=this;return new Promise(function(_0x1342ae,_0x3a2c06){return db['ChatQueueReport'][_0x2eb8('0x20')](_0x33c3e4[_0x2eb8('0x1b')],{'raw':_0x33c3e4['options']?_0x33c3e4[_0x2eb8('0x1c')][_0x2eb8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c3e4[_0x2eb8('0x1c')]?_0x33c3e4[_0x2eb8('0x1c')][_0x2eb8('0x21')]||null:null,'attributes':_0x33c3e4[_0x2eb8('0x1c')]?_0x33c3e4['options']['attributes']||null:null,'limit':_0x33c3e4[_0x2eb8('0x1c')]?_0x33c3e4[_0x2eb8('0x1c')][_0x2eb8('0x22')]||null:null})[_0x2eb8('0x1e')](function(_0x5381f0){logger[_0x2eb8('0xe')]('UpdateChatQueueReport',_0x33c3e4);logger['debug']('UpdateChatQueueReport',_0x33c3e4,JSON[_0x2eb8('0x23')](_0x5381f0));_0x1342ae(_0x5381f0);})[_0x2eb8('0x17')](function(_0x427707){logger[_0x2eb8('0x13')](_0x2eb8('0x1f'),_0x427707['message'],_0x33c3e4);_0x3a2c06(_0x50095e[_0x2eb8('0x13')](0x1f4,_0x427707[_0x2eb8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2caab63..424ae38 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 _0x4028=['/describe','describe','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x47450d,_0x532512){var _0x3a0212=function(_0xe57f16){while(--_0xe57f16){_0x47450d['push'](_0x47450d['shift']());}};_0x3a0212(++_0x532512);}(_0x4028,0x75));var _0x8402=function(_0x332e78,_0x4ef6fc){_0x332e78=_0x332e78-0x0;var _0x507e27=_0x4028[_0x332e78];return _0x507e27;};'use strict';var multer=require('multer');var util=require(_0x8402('0x0'));var path=require(_0x8402('0x1'));var timeout=require(_0x8402('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8402('0x3'));var auth=require(_0x8402('0x4'));var interaction=require(_0x8402('0x5'));var config=require(_0x8402('0x6'));var controller=require('./chatQueueReport.controller');router[_0x8402('0x7')]('/',auth[_0x8402('0x8')](),controller['index']);router[_0x8402('0x7')](_0x8402('0x9'),auth[_0x8402('0x8')](),controller[_0x8402('0xa')]);router[_0x8402('0x7')](_0x8402('0xb'),auth[_0x8402('0x8')](),controller[_0x8402('0xc')]);router[_0x8402('0xd')]('/',auth[_0x8402('0x8')](),controller[_0x8402('0xe')]);router['put']('/:id',auth[_0x8402('0x8')](),controller[_0x8402('0xf')]);router['delete'](_0x8402('0xb'),auth['isAuthenticated'](),controller[_0x8402('0x10')]);module[_0x8402('0x11')]=router; \ No newline at end of file +var _0x0975=['../../config/environment','./chatQueueReport.controller','isAuthenticated','index','/describe','describe','get','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0975,0xad));var _0x5097=function(_0x3062e1,_0x4b920e){_0x3062e1=_0x3062e1-0x0;var _0x35aaa1=_0x0975[_0x3062e1];return _0x35aaa1;};'use strict';var multer=require(_0x5097('0x0'));var util=require(_0x5097('0x1'));var path=require(_0x5097('0x2'));var timeout=require(_0x5097('0x3'));var express=require('express');var router=express[_0x5097('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5097('0x5'));var interaction=require(_0x5097('0x6'));var config=require(_0x5097('0x7'));var controller=require(_0x5097('0x8'));router['get']('/',auth[_0x5097('0x9')](),controller[_0x5097('0xa')]);router['get'](_0x5097('0xb'),auth[_0x5097('0x9')](),controller[_0x5097('0xc')]);router[_0x5097('0xd')]('/:id',auth[_0x5097('0x9')](),controller[_0x5097('0xe')]);router[_0x5097('0xf')]('/',auth[_0x5097('0x9')](),controller['create']);router[_0x5097('0x10')](_0x5097('0x11'),auth[_0x5097('0x9')](),controller[_0x5097('0x12')]);router[_0x5097('0x13')](_0x5097('0x11'),auth[_0x5097('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f399fd0..81aa6da 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x39de23,_0x18cb62){var _0x28e3b5=function(_0xc0ebfd){while(--_0xc0ebfd){_0x39de23['push'](_0x39de23['shift']());}};_0x28e3b5(++_0x18cb62);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xcb91[_0x263f4c];return _0x3a78d3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4d4d703..c17217c 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 _0xc496=['VIRTUAL','include','findAll','catch','show','params','keys','find','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x223f23,_0x1a45da){var _0x51a4aa=function(_0x7f97ce){while(--_0x7f97ce){_0x223f23['push'](_0x223f23['shift']());}};_0x51a4aa(++_0x1a45da);}(_0xc496,0xa1));var _0x6c49=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xc496[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c49('0x1'));var rp=require('request-promise');var moment=require(_0x6c49('0x2'));var BPromise=require(_0x6c49('0x3'));var Mustache=require(_0x6c49('0x4'));var util=require(_0x6c49('0x5'));var path=require(_0x6c49('0x6'));var sox=require(_0x6c49('0x7'));var csv=require(_0x6c49('0x8'));var ejs=require(_0x6c49('0x9'));var fs=require('fs');var fs_extra=require(_0x6c49('0xa'));var _=require(_0x6c49('0xb'));var squel=require(_0x6c49('0xc'));var crypto=require(_0x6c49('0xd'));var jsforce=require(_0x6c49('0xe'));var deskjs=require(_0x6c49('0xf'));var toCsv=require(_0x6c49('0x8'));var querystring=require(_0x6c49('0x10'));var Papa=require(_0x6c49('0x11'));var Redis=require(_0x6c49('0x12'));var authService=require(_0x6c49('0x13'));var qs=require(_0x6c49('0x14'));var as=require(_0x6c49('0x15'));var hardwareService=require(_0x6c49('0x16'));var logger=require('../../config/logger')(_0x6c49('0x17'));var utils=require(_0x6c49('0x18'));var config=require(_0x6c49('0x19'));var licenseUtil=require(_0x6c49('0x1a'));var db=require(_0x6c49('0x1b'))['db'];function respondWithStatusCode(_0x3347a2,_0x10f6b1){_0x10f6b1=_0x10f6b1||0xcc;return function(_0x48d4ff){if(_0x48d4ff){return _0x3347a2[_0x6c49('0x1c')](_0x10f6b1);}return _0x3347a2[_0x6c49('0x1d')](_0x10f6b1)[_0x6c49('0x1e')]();};}function respondWithResult(_0x738849,_0x5500ed){_0x5500ed=_0x5500ed||0xc8;return function(_0x2e623c){if(_0x2e623c){return _0x738849[_0x6c49('0x1d')](_0x5500ed)[_0x6c49('0x1f')](_0x2e623c);}};}function respondWithFilteredResult(_0x44591d,_0x420389){return function(_0x69adfd){if(_0x69adfd){var _0xfc7dc6=typeof _0x420389['offset']==='undefined'&&typeof _0x420389['limit']===_0x6c49('0x20');var _0x49544c=_0x69adfd[_0x6c49('0x21')];var _0x3ef499=_0xfc7dc6?0x0:_0x420389[_0x6c49('0x22')];var _0x32c4e2=_0xfc7dc6?_0x69adfd[_0x6c49('0x21')]:_0x420389[_0x6c49('0x22')]+_0x420389[_0x6c49('0x23')];var _0x3997a5;if(_0x32c4e2>=_0x49544c){_0x32c4e2=_0x49544c;_0x3997a5=0xc8;}else{_0x3997a5=0xce;}_0x44591d[_0x6c49('0x1d')](_0x3997a5);return _0x44591d[_0x6c49('0x24')](_0x6c49('0x25'),_0x3ef499+'-'+_0x32c4e2+'/'+_0x49544c)[_0x6c49('0x1f')](_0x69adfd);}return null;};}function patchUpdates(_0x3a0426){return function(_0x2bc36f){try{jsonpatch['apply'](_0x2bc36f,_0x3a0426,!![]);}catch(_0x500a1b){return BPromise[_0x6c49('0x26')](_0x500a1b);}return _0x2bc36f[_0x6c49('0x27')]();};}function saveUpdates(_0x5d38bc,_0x208915){return function(_0x489525){if(_0x489525){return _0x489525[_0x6c49('0x28')](_0x5d38bc)['then'](function(_0x427b6a){return _0x427b6a;});}return null;};}function removeEntity(_0x353178,_0x4d718e){return function(_0x263ca5){if(_0x263ca5){return _0x263ca5[_0x6c49('0x29')]()[_0x6c49('0x2a')](function(){_0x353178[_0x6c49('0x1d')](0xcc)[_0x6c49('0x1e')]();});}};}function handleEntityNotFound(_0x1ca85d,_0x8e7c29){return function(_0x1e98e3){if(!_0x1e98e3){_0x1ca85d[_0x6c49('0x1c')](0x194);}return _0x1e98e3;};}function handleError(_0x36f605,_0x930e80){_0x930e80=_0x930e80||0x1f4;return function(_0x361c44){logger[_0x6c49('0x2b')](_0x361c44[_0x6c49('0x2c')]);if(_0x361c44['name']){delete _0x361c44['name'];}_0x36f605['status'](_0x930e80)[_0x6c49('0x2d')](_0x361c44);};}exports['index']=function(_0x161eb3,_0x20aedc){var _0x5c74dc={},_0xb8b963={},_0x2aa99d={'count':0x0,'rows':[]};var _0x4bb979=_[_0x6c49('0x2e')](db[_0x6c49('0x2f')][_0x6c49('0x30')],function(_0x1f198e){return{'name':_0x1f198e[_0x6c49('0x31')],'type':_0x1f198e[_0x6c49('0x32')][_0x6c49('0x33')]};});_0xb8b963[_0x6c49('0x34')]=_[_0x6c49('0x2e')](_0x4bb979,_0x6c49('0x35'));_0xb8b963[_0x6c49('0x36')]=_['keys'](_0x161eb3[_0x6c49('0x36')]);_0xb8b963[_0x6c49('0x37')]=_['intersection'](_0xb8b963['model'],_0xb8b963[_0x6c49('0x36')]);_0x5c74dc[_0x6c49('0x38')]=_[_0x6c49('0x39')](_0xb8b963['model'],qs[_0x6c49('0x3a')](_0x161eb3['query'][_0x6c49('0x3a')]));_0x5c74dc[_0x6c49('0x38')]=_0x5c74dc[_0x6c49('0x38')][_0x6c49('0x3b')]?_0x5c74dc['attributes']:_0xb8b963[_0x6c49('0x34')];if(!_0x161eb3[_0x6c49('0x36')][_0x6c49('0x3c')](_0x6c49('0x3d'))){_0x5c74dc[_0x6c49('0x23')]=qs[_0x6c49('0x23')](_0x161eb3[_0x6c49('0x36')][_0x6c49('0x23')]);_0x5c74dc[_0x6c49('0x22')]=qs[_0x6c49('0x22')](_0x161eb3[_0x6c49('0x36')][_0x6c49('0x22')]);}_0x5c74dc[_0x6c49('0x3e')]=qs[_0x6c49('0x3f')](_0x161eb3[_0x6c49('0x36')][_0x6c49('0x3f')]);_0x5c74dc[_0x6c49('0x40')]=qs[_0x6c49('0x37')](_[_0x6c49('0x41')](_0x161eb3[_0x6c49('0x36')],_0xb8b963[_0x6c49('0x37')]),_0x4bb979);if(_0x161eb3[_0x6c49('0x36')][_0x6c49('0x42')]){_0x5c74dc[_0x6c49('0x40')]=_['merge'](_0x5c74dc['where'],{'$or':_[_0x6c49('0x2e')](_0x4bb979,function(_0x2e8c34){if(_0x2e8c34['type']!==_0x6c49('0x43')){var _0xca9cac={};_0xca9cac[_0x2e8c34[_0x6c49('0x35')]]={'$like':'%'+_0x161eb3['query'][_0x6c49('0x42')]+'%'};return _0xca9cac;}})});}_0x5c74dc=_['merge']({},_0x5c74dc,_0x161eb3['options']);var _0x579270={'where':_0x5c74dc[_0x6c49('0x40')]};return db[_0x6c49('0x2f')][_0x6c49('0x21')](_0x579270)[_0x6c49('0x2a')](function(_0x778828){_0x2aa99d[_0x6c49('0x21')]=_0x778828;if(_0x161eb3[_0x6c49('0x36')]['includeAll']){_0x5c74dc[_0x6c49('0x44')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x6c49('0x45')](_0x5c74dc);})['then'](function(_0x173eb8){_0x2aa99d['rows']=_0x173eb8;return _0x2aa99d;})[_0x6c49('0x2a')](respondWithFilteredResult(_0x20aedc,_0x5c74dc))[_0x6c49('0x46')](handleError(_0x20aedc,null));};exports[_0x6c49('0x47')]=function(_0x31d5d3,_0x70923a){var _0x36349f={'raw':!![],'where':{'id':_0x31d5d3[_0x6c49('0x48')]['id']}},_0x1b3b48={};_0x1b3b48[_0x6c49('0x34')]=_[_0x6c49('0x49')](db[_0x6c49('0x2f')][_0x6c49('0x30')]);_0x1b3b48[_0x6c49('0x36')]=_['keys'](_0x31d5d3[_0x6c49('0x36')]);_0x1b3b48['filters']=_[_0x6c49('0x39')](_0x1b3b48[_0x6c49('0x34')],_0x1b3b48['query']);_0x36349f[_0x6c49('0x38')]=_[_0x6c49('0x39')](_0x1b3b48[_0x6c49('0x34')],qs['fields'](_0x31d5d3[_0x6c49('0x36')][_0x6c49('0x3a')]));_0x36349f[_0x6c49('0x38')]=_0x36349f['attributes'][_0x6c49('0x3b')]?_0x36349f[_0x6c49('0x38')]:_0x1b3b48['model'];if(_0x31d5d3[_0x6c49('0x36')]['includeAll']){_0x36349f[_0x6c49('0x44')]=[{'all':!![]}];}_0x36349f=_['merge']({},_0x36349f,_0x31d5d3['options']);return db['ChatTransferReport'][_0x6c49('0x4a')](_0x36349f)[_0x6c49('0x2a')](handleEntityNotFound(_0x70923a,null))['then'](respondWithResult(_0x70923a,null))[_0x6c49('0x46')](handleError(_0x70923a,null));};exports['create']=function(_0x28b1c1,_0x1e972e){return db[_0x6c49('0x2f')]['create'](_0x28b1c1[_0x6c49('0x4b')],{})[_0x6c49('0x2a')](respondWithResult(_0x1e972e,0xc9))[_0x6c49('0x46')](handleError(_0x1e972e,null));};exports['update']=function(_0x5d6971,_0x3f0754){if(_0x5d6971[_0x6c49('0x4b')]['id']){delete _0x5d6971[_0x6c49('0x4b')]['id'];}return db[_0x6c49('0x2f')]['find']({'where':{'id':_0x5d6971[_0x6c49('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f0754,null))['then'](saveUpdates(_0x5d6971['body'],null))[_0x6c49('0x2a')](respondWithResult(_0x3f0754,null))['catch'](handleError(_0x3f0754,null));};exports[_0x6c49('0x29')]=function(_0x3e7b90,_0x203831){return db[_0x6c49('0x2f')]['find']({'where':{'id':_0x3e7b90[_0x6c49('0x48')]['id']}})[_0x6c49('0x2a')](handleEntityNotFound(_0x203831,null))[_0x6c49('0x2a')](removeEntity(_0x203831,null))[_0x6c49('0x46')](handleError(_0x203831,null));};exports['describe']=function(_0x13274b,_0x45450d){return db[_0x6c49('0x2f')]['describe']()[_0x6c49('0x2a')](respondWithResult(_0x45450d,null))['catch'](handleError(_0x45450d,null));}; \ No newline at end of file +var _0xe6d0=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','end','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','include','find','create','body','params','destroy','describe','eml-format','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/utils','../../config/environment','../../config/license/util'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0xe6d0,0x1e4));var _0x0e6d=function(_0x2e955f,_0x5dcba6){_0x2e955f=_0x2e955f-0x0;var _0x576aee=_0xe6d0[_0x2e955f];return _0x576aee;};'use strict';var emlformat=require(_0x0e6d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e6d('0x1'));var rp=require(_0x0e6d('0x2'));var moment=require(_0x0e6d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e6d('0x4'));var util=require(_0x0e6d('0x5'));var path=require('path');var sox=require(_0x0e6d('0x6'));var csv=require(_0x0e6d('0x7'));var ejs=require(_0x0e6d('0x8'));var fs=require('fs');var fs_extra=require(_0x0e6d('0x9'));var _=require(_0x0e6d('0xa'));var squel=require('squel');var crypto=require(_0x0e6d('0xb'));var jsforce=require(_0x0e6d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0e6d('0x7'));var querystring=require('querystring');var Papa=require(_0x0e6d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e6d('0xe'));var as=require(_0x0e6d('0xf'));var hardwareService=require(_0x0e6d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0e6d('0x11'));var config=require(_0x0e6d('0x12'));var licenseUtil=require(_0x0e6d('0x13'));var db=require(_0x0e6d('0x14'))['db'];function respondWithStatusCode(_0x2c04cb,_0x384b88){_0x384b88=_0x384b88||0xcc;return function(_0x327e26){if(_0x327e26){return _0x2c04cb[_0x0e6d('0x15')](_0x384b88);}return _0x2c04cb['status'](_0x384b88)['end']();};}function respondWithResult(_0x5c17e7,_0x11c369){_0x11c369=_0x11c369||0xc8;return function(_0x1c61ff){if(_0x1c61ff){return _0x5c17e7[_0x0e6d('0x16')](_0x11c369)[_0x0e6d('0x17')](_0x1c61ff);}};}function respondWithFilteredResult(_0x43377e,_0x35d417){return function(_0x3ac98f){if(_0x3ac98f){var _0x650981=typeof _0x35d417[_0x0e6d('0x18')]===_0x0e6d('0x19')&&typeof _0x35d417['limit']===_0x0e6d('0x19');var _0x4aedff=_0x3ac98f[_0x0e6d('0x1a')];var _0x40ae71=_0x650981?0x0:_0x35d417[_0x0e6d('0x18')];var _0x2be3a4=_0x650981?_0x3ac98f[_0x0e6d('0x1a')]:_0x35d417[_0x0e6d('0x18')]+_0x35d417[_0x0e6d('0x1b')];var _0x291de6;if(_0x2be3a4>=_0x4aedff){_0x2be3a4=_0x4aedff;_0x291de6=0xc8;}else{_0x291de6=0xce;}_0x43377e[_0x0e6d('0x16')](_0x291de6);return _0x43377e[_0x0e6d('0x1c')]('Content-Range',_0x40ae71+'-'+_0x2be3a4+'/'+_0x4aedff)[_0x0e6d('0x17')](_0x3ac98f);}return null;};}function patchUpdates(_0x475be8){return function(_0x19ea12){try{jsonpatch[_0x0e6d('0x1d')](_0x19ea12,_0x475be8,!![]);}catch(_0x4ce17f){return BPromise['reject'](_0x4ce17f);}return _0x19ea12[_0x0e6d('0x1e')]();};}function saveUpdates(_0x588fcd,_0x489a26){return function(_0xa861ce){if(_0xa861ce){return _0xa861ce[_0x0e6d('0x1f')](_0x588fcd)[_0x0e6d('0x20')](function(_0x14756e){return _0x14756e;});}return null;};}function removeEntity(_0x3bb213,_0x472d15){return function(_0x33211a){if(_0x33211a){return _0x33211a['destroy']()[_0x0e6d('0x20')](function(){_0x3bb213['status'](0xcc)[_0x0e6d('0x21')]();});}};}function handleEntityNotFound(_0x3e0ec7,_0x1c5ead){return function(_0x3b1514){if(!_0x3b1514){_0x3e0ec7[_0x0e6d('0x15')](0x194);}return _0x3b1514;};}function handleError(_0x189f5b,_0x1c7203){_0x1c7203=_0x1c7203||0x1f4;return function(_0x1e43e1){logger[_0x0e6d('0x22')](_0x1e43e1[_0x0e6d('0x23')]);if(_0x1e43e1[_0x0e6d('0x24')]){delete _0x1e43e1['name'];}_0x189f5b[_0x0e6d('0x16')](_0x1c7203)['send'](_0x1e43e1);};}exports[_0x0e6d('0x25')]=function(_0x14f0b5,_0x1f6651){var _0x163db8={},_0x3bba06={},_0x33e4e3={'count':0x0,'rows':[]};var _0xd664ea=_[_0x0e6d('0x26')](db[_0x0e6d('0x27')][_0x0e6d('0x28')],function(_0xb15c73){return{'name':_0xb15c73[_0x0e6d('0x29')],'type':_0xb15c73[_0x0e6d('0x2a')][_0x0e6d('0x2b')]};});_0x3bba06[_0x0e6d('0x2c')]=_[_0x0e6d('0x26')](_0xd664ea,'name');_0x3bba06[_0x0e6d('0x2d')]=_['keys'](_0x14f0b5[_0x0e6d('0x2d')]);_0x3bba06[_0x0e6d('0x2e')]=_[_0x0e6d('0x2f')](_0x3bba06[_0x0e6d('0x2c')],_0x3bba06[_0x0e6d('0x2d')]);_0x163db8[_0x0e6d('0x30')]=_[_0x0e6d('0x2f')](_0x3bba06[_0x0e6d('0x2c')],qs[_0x0e6d('0x31')](_0x14f0b5['query']['fields']));_0x163db8['attributes']=_0x163db8['attributes'][_0x0e6d('0x32')]?_0x163db8[_0x0e6d('0x30')]:_0x3bba06[_0x0e6d('0x2c')];if(!_0x14f0b5[_0x0e6d('0x2d')][_0x0e6d('0x33')](_0x0e6d('0x34'))){_0x163db8[_0x0e6d('0x1b')]=qs['limit'](_0x14f0b5[_0x0e6d('0x2d')][_0x0e6d('0x1b')]);_0x163db8[_0x0e6d('0x18')]=qs[_0x0e6d('0x18')](_0x14f0b5['query'][_0x0e6d('0x18')]);}_0x163db8[_0x0e6d('0x35')]=qs['sort'](_0x14f0b5[_0x0e6d('0x2d')][_0x0e6d('0x36')]);_0x163db8['where']=qs['filters'](_[_0x0e6d('0x37')](_0x14f0b5['query'],_0x3bba06[_0x0e6d('0x2e')]),_0xd664ea);if(_0x14f0b5['query'][_0x0e6d('0x38')]){_0x163db8['where']=_[_0x0e6d('0x39')](_0x163db8[_0x0e6d('0x3a')],{'$or':_[_0x0e6d('0x26')](_0xd664ea,function(_0x48ad0a){if(_0x48ad0a['type']!==_0x0e6d('0x3b')){var _0x371fb6={};_0x371fb6[_0x48ad0a[_0x0e6d('0x24')]]={'$like':'%'+_0x14f0b5[_0x0e6d('0x2d')][_0x0e6d('0x38')]+'%'};return _0x371fb6;}})});}_0x163db8=_[_0x0e6d('0x39')]({},_0x163db8,_0x14f0b5[_0x0e6d('0x3c')]);var _0x3bf08a={'where':_0x163db8['where']};return db[_0x0e6d('0x27')][_0x0e6d('0x1a')](_0x3bf08a)['then'](function(_0x368ea7){_0x33e4e3[_0x0e6d('0x1a')]=_0x368ea7;if(_0x14f0b5['query'][_0x0e6d('0x3d')]){_0x163db8['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x0e6d('0x3e')](_0x163db8);})[_0x0e6d('0x20')](function(_0x19ef62){_0x33e4e3[_0x0e6d('0x3f')]=_0x19ef62;return _0x33e4e3;})[_0x0e6d('0x20')](respondWithFilteredResult(_0x1f6651,_0x163db8))[_0x0e6d('0x40')](handleError(_0x1f6651,null));};exports['show']=function(_0x1090a3,_0x454abd){var _0x2f8b79={'raw':!![],'where':{'id':_0x1090a3['params']['id']}},_0x648c5f={};_0x648c5f['model']=_['keys'](db[_0x0e6d('0x27')][_0x0e6d('0x28')]);_0x648c5f[_0x0e6d('0x2d')]=_['keys'](_0x1090a3[_0x0e6d('0x2d')]);_0x648c5f['filters']=_[_0x0e6d('0x2f')](_0x648c5f['model'],_0x648c5f[_0x0e6d('0x2d')]);_0x2f8b79[_0x0e6d('0x30')]=_[_0x0e6d('0x2f')](_0x648c5f[_0x0e6d('0x2c')],qs[_0x0e6d('0x31')](_0x1090a3[_0x0e6d('0x2d')][_0x0e6d('0x31')]));_0x2f8b79[_0x0e6d('0x30')]=_0x2f8b79[_0x0e6d('0x30')][_0x0e6d('0x32')]?_0x2f8b79[_0x0e6d('0x30')]:_0x648c5f['model'];if(_0x1090a3['query'][_0x0e6d('0x3d')]){_0x2f8b79[_0x0e6d('0x41')]=[{'all':!![]}];}_0x2f8b79=_[_0x0e6d('0x39')]({},_0x2f8b79,_0x1090a3['options']);return db['ChatTransferReport'][_0x0e6d('0x42')](_0x2f8b79)[_0x0e6d('0x20')](handleEntityNotFound(_0x454abd,null))[_0x0e6d('0x20')](respondWithResult(_0x454abd,null))[_0x0e6d('0x40')](handleError(_0x454abd,null));};exports[_0x0e6d('0x43')]=function(_0x3a7345,_0x576154){return db[_0x0e6d('0x27')]['create'](_0x3a7345[_0x0e6d('0x44')],{})['then'](respondWithResult(_0x576154,0xc9))[_0x0e6d('0x40')](handleError(_0x576154,null));};exports['update']=function(_0x11d6c8,_0x2e8085){if(_0x11d6c8[_0x0e6d('0x44')]['id']){delete _0x11d6c8['body']['id'];}return db[_0x0e6d('0x27')][_0x0e6d('0x42')]({'where':{'id':_0x11d6c8[_0x0e6d('0x45')]['id']}})[_0x0e6d('0x20')](handleEntityNotFound(_0x2e8085,null))[_0x0e6d('0x20')](saveUpdates(_0x11d6c8[_0x0e6d('0x44')],null))[_0x0e6d('0x20')](respondWithResult(_0x2e8085,null))[_0x0e6d('0x40')](handleError(_0x2e8085,null));};exports[_0x0e6d('0x46')]=function(_0x22f620,_0x1b7407){return db[_0x0e6d('0x27')][_0x0e6d('0x42')]({'where':{'id':_0x22f620[_0x0e6d('0x45')]['id']}})[_0x0e6d('0x20')](handleEntityNotFound(_0x1b7407,null))[_0x0e6d('0x20')](removeEntity(_0x1b7407,null))[_0x0e6d('0x40')](handleError(_0x1b7407,null));};exports[_0x0e6d('0x47')]=function(_0x5360d5,_0x2f1de2){return db['ChatTransferReport'][_0x0e6d('0x47')]()[_0x0e6d('0x20')](respondWithResult(_0x2f1de2,null))['catch'](handleError(_0x2f1de2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0b92688..27fcd68 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 _0x2722=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x2722,0x1de));var _0x2272=function(_0x5e0923,_0x51b52e){_0x5e0923=_0x5e0923-0x0;var _0x46e644=_0x2722[_0x5e0923];return _0x46e644;};'use strict';var _=require(_0x2272('0x0'));var util=require(_0x2272('0x1'));var logger=require(_0x2272('0x2'))(_0x2272('0x3'));var moment=require(_0x2272('0x4'));var BPromise=require(_0x2272('0x5'));var rp=require(_0x2272('0x6'));var fs=require('fs');var path=require(_0x2272('0x7'));var rimraf=require(_0x2272('0x8'));var config=require(_0x2272('0x9'));var attributes=require(_0x2272('0xa'));module['exports']=function(_0x5b7e9b,_0x40c104){return _0x5b7e9b[_0x2272('0xb')]('ChatTransferReport',attributes,{'tableName':_0x2272('0xc'),'paranoid':![],'indexes':[{'name':_0x2272('0xd'),'fields':[_0x2272('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04c7=['moment','bluebird','request-promise','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api'];(function(_0x4f219b,_0x841f7e){var _0x8a7718=function(_0x3e8f25){while(--_0x3e8f25){_0x4f219b['push'](_0x4f219b['shift']());}};_0x8a7718(++_0x841f7e);}(_0x04c7,0x11d));var _0x704c=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0x04c7[_0x5b87ce];return _0x597aa7;};'use strict';var _=require('lodash');var util=require(_0x704c('0x0'));var logger=require(_0x704c('0x1'))(_0x704c('0x2'));var moment=require(_0x704c('0x3'));var BPromise=require(_0x704c('0x4'));var rp=require(_0x704c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x704c('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x704c('0x7')]=function(_0x2c411c,_0x492b8c){return _0x2c411c[_0x704c('0x8')](_0x704c('0x9'),attributes,{'tableName':_0x704c('0xa'),'paranoid':![],'indexes':[{'name':_0x704c('0xb'),'fields':[_0x704c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d2d7a9a..d2d6d14 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 _0xb3bc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x49febd,_0x5f24f3){var _0x51b264=function(_0x40a4c4){while(--_0x40a4c4){_0x49febd['push'](_0x49febd['shift']());}};_0x51b264(++_0x5f24f3);}(_0xb3bc,0x1dd));var _0xcb3b=function(_0x3beff5,_0xd10aa2){_0x3beff5=_0x3beff5-0x0;var _0x7fc726=_0xb3bc[_0x3beff5];return _0x7fc726;};'use strict';var _=require('lodash');var util=require(_0xcb3b('0x0'));var moment=require(_0xcb3b('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb3b('0x2'));var fs=require('fs');var Redis=require(_0xcb3b('0x3'));var db=require(_0xcb3b('0x4'))['db'];var utils=require(_0xcb3b('0x5'));var logger=require(_0xcb3b('0x6'))(_0xcb3b('0x7'));var config=require(_0xcb3b('0x8'));var jayson=require(_0xcb3b('0x9'));var client=jayson[_0xcb3b('0xa')][_0xcb3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36fdfa,_0x18857f,_0x3b25b1){return new BPromise(function(_0x50021b,_0x43b310){return client['request'](_0x36fdfa,_0x3b25b1)['then'](function(_0x479227){logger[_0xcb3b('0xc')](_0xcb3b('0xd'),_0x18857f,_0xcb3b('0xe'));logger[_0xcb3b('0xf')](_0xcb3b('0x10'),_0x18857f,_0xcb3b('0xe'),JSON[_0xcb3b('0x11')](_0x479227));if(_0x479227['error']){if(_0x479227[_0xcb3b('0x12')][_0xcb3b('0x13')]===0x1f4){logger[_0xcb3b('0x12')](_0xcb3b('0xd'),_0x18857f,_0x479227[_0xcb3b('0x12')]['message']);return _0x43b310(_0x479227[_0xcb3b('0x12')][_0xcb3b('0x14')]);}logger[_0xcb3b('0x12')](_0xcb3b('0xd'),_0x18857f,_0x479227[_0xcb3b('0x12')]['message']);return _0x50021b(_0x479227[_0xcb3b('0x12')][_0xcb3b('0x14')]);}else{logger[_0xcb3b('0xc')](_0xcb3b('0xd'),_0x18857f,_0xcb3b('0xe'));_0x50021b(_0x479227[_0xcb3b('0x15')][_0xcb3b('0x14')]);}})[_0xcb3b('0x16')](function(_0x1b1fc8){logger[_0xcb3b('0x12')](_0xcb3b('0xd'),_0x18857f,_0x1b1fc8);_0x43b310(_0x1b1fc8);});});} \ No newline at end of file +var _0x5442=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c2d5d,_0x36bf0d){var _0x5add0f=function(_0x4cb3aa){while(--_0x4cb3aa){_0x1c2d5d['push'](_0x1c2d5d['shift']());}};_0x5add0f(++_0x36bf0d);}(_0x5442,0xcb));var _0x2544=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x5442[_0x1ebe90];return _0x447c82;};'use strict';var _=require(_0x2544('0x0'));var util=require('util');var moment=require(_0x2544('0x1'));var BPromise=require(_0x2544('0x2'));var rs=require(_0x2544('0x3'));var fs=require('fs');var Redis=require(_0x2544('0x4'));var db=require(_0x2544('0x5'))['db'];var utils=require(_0x2544('0x6'));var logger=require(_0x2544('0x7'))('rpc');var config=require(_0x2544('0x8'));var jayson=require(_0x2544('0x9'));var client=jayson[_0x2544('0xa')][_0x2544('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4939b4,_0x2cada0,_0x3c6682){return new BPromise(function(_0x384047,_0x1658d2){return client[_0x2544('0xc')](_0x4939b4,_0x3c6682)[_0x2544('0xd')](function(_0x1d79f3){logger[_0x2544('0xe')](_0x2544('0xf'),_0x2cada0,_0x2544('0x10'));logger[_0x2544('0x11')](_0x2544('0x12'),_0x2cada0,_0x2544('0x10'),JSON[_0x2544('0x13')](_0x1d79f3));if(_0x1d79f3[_0x2544('0x14')]){if(_0x1d79f3[_0x2544('0x14')][_0x2544('0x15')]===0x1f4){logger[_0x2544('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x2cada0,_0x1d79f3[_0x2544('0x14')][_0x2544('0x16')]);return _0x1658d2(_0x1d79f3['error'][_0x2544('0x16')]);}logger[_0x2544('0x14')](_0x2544('0xf'),_0x2cada0,_0x1d79f3[_0x2544('0x14')][_0x2544('0x16')]);return _0x384047(_0x1d79f3[_0x2544('0x14')][_0x2544('0x16')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x2cada0,'request\x20sent');_0x384047(_0x1d79f3[_0x2544('0x17')]['message']);}})[_0x2544('0x18')](function(_0x540fa5){logger[_0x2544('0x14')](_0x2544('0xf'),_0x2cada0,_0x540fa5);_0x1658d2(_0x540fa5);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4bbf2e9..3df1435 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 _0x21fb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21fb,0xab));var _0xb21f=function(_0x3fefaf,_0x298914){_0x3fefaf=_0x3fefaf-0x0;var _0x31bee8=_0x21fb[_0x3fefaf];return _0x31bee8;};'use strict';var multer=require('multer');var util=require(_0xb21f('0x0'));var path=require(_0xb21f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb21f('0x2'));var router=express[_0xb21f('0x3')]();var fs_extra=require(_0xb21f('0x4'));var auth=require(_0xb21f('0x5'));var interaction=require(_0xb21f('0x6'));var config=require(_0xb21f('0x7'));var controller=require(_0xb21f('0x8'));router[_0xb21f('0x9')]('/',auth[_0xb21f('0xa')](),controller[_0xb21f('0xb')]);router[_0xb21f('0x9')]('/describe',auth[_0xb21f('0xa')](),controller[_0xb21f('0xc')]);router[_0xb21f('0x9')](_0xb21f('0xd'),auth[_0xb21f('0xa')](),controller[_0xb21f('0xe')]);router[_0xb21f('0xf')]('/',auth[_0xb21f('0xa')](),controller[_0xb21f('0x10')]);router[_0xb21f('0x11')](_0xb21f('0xd'),auth[_0xb21f('0xa')](),controller[_0xb21f('0x12')]);router[_0xb21f('0x13')](_0xb21f('0xd'),auth[_0xb21f('0xa')](),controller[_0xb21f('0x14')]);module[_0xb21f('0x15')]=router; \ No newline at end of file +var _0x788d=['./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x370b7b,_0x1abf7a){var _0x56c95d=function(_0x454aa1){while(--_0x454aa1){_0x370b7b['push'](_0x370b7b['shift']());}};_0x56c95d(++_0x1abf7a);}(_0x788d,0xc1));var _0xd788=function(_0x2eea19,_0x4f73a7){_0x2eea19=_0x2eea19-0x0;var _0x1fc12b=_0x788d[_0x2eea19];return _0x1fc12b;};'use strict';var multer=require(_0xd788('0x0'));var util=require('util');var path=require(_0xd788('0x1'));var timeout=require(_0xd788('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd788('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd788('0x4'));var controller=require(_0xd788('0x5'));router['get']('/',auth[_0xd788('0x6')](),controller[_0xd788('0x7')]);router[_0xd788('0x8')](_0xd788('0x9'),auth[_0xd788('0x6')](),controller[_0xd788('0xa')]);router[_0xd788('0x8')](_0xd788('0xb'),auth[_0xd788('0x6')](),controller['show']);router['post']('/',auth[_0xd788('0x6')](),controller[_0xd788('0xc')]);router[_0xd788('0xd')](_0xd788('0xb'),auth[_0xd788('0x6')](),controller[_0xd788('0xe')]);router[_0xd788('0xf')](_0xd788('0xb'),auth[_0xd788('0x6')](),controller[_0xd788('0x10')]);module[_0xd788('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index e3d00b4..41ba631 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 _0x9c44=['input','parse','getDataValue','setDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','ENUM','star','thumb','name'];(function(_0x391df0,_0x51b2dc){var _0x30bec6=function(_0x2899b1){while(--_0x2899b1){_0x391df0['push'](_0x391df0['shift']());}};_0x30bec6(++_0x51b2dc);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x49c4('0x0')]={'name':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'unique':_0x49c4('0x2')},'description':{'type':Sequelize[_0x49c4('0x1')]},'mapKey':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x4')},'customerAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49c4('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x49c4('0x1')]},'animation':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x49c4('0x8'),_0x49c4('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xa')},'start_chat_button':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xc')},'download_transcript':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x49c4('0xf')]},'closingQuestion':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x11')},'noteTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xb')},'skipMessageButton':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x13')},'ratingType':{'type':Sequelize[_0x49c4('0x14')](_0x49c4('0x15'),_0x49c4('0x16')),'defaultValue':_0x49c4('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x49c4('0x17'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x49c4('0x18'),'props':{'title':_0x49c4('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x49c4('0x3'),'type':_0x49c4('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x49c4('0x19')](this[_0x49c4('0x1a')]('onlineForm')):{};},'set':function(_0x207358){return this[_0x49c4('0x1b')](_0x49c4('0x1c'),JSON[_0x49c4('0x1d')](_0x207358));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x49c4('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x49c4('0x3'),'type':_0x49c4('0x3')},'variable':null},{'type':_0x49c4('0x1e'),'config':{'placeholder':_0x49c4('0x1f')},'props':{'title':'Comments','helpText':_0x49c4('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x49c4('0x1a')](_0x49c4('0x21'))?JSON[_0x49c4('0x19')](this[_0x49c4('0x1a')](_0x49c4('0x21'))):{};},'set':function(_0x26ba17){return this[_0x49c4('0x1b')](_0x49c4('0x21'),JSON[_0x49c4('0x1d')](_0x26ba17));}},'token':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x49c4('0x1')]},'forwardOffline':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x49c4('0x1')]},'waitingTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x24')},'skipUnmanaged':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x49c4('0x1')]},'notificationTemplate':{'type':Sequelize[_0x49c4('0xf')],'defaultValue':function(){return _0x49c4('0x26');}},'notificationSound':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x29')},'messagesAlignment':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x49c4('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49c4('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x2c')},'systemAvatar':{'type':Sequelize[_0x49c4('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49c4('0xd')],'comment':_0x49c4('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d2510){if(!_0x2d2510)this[_0x49c4('0x1b')](_0x49c4('0x2e'),null);this[_0x49c4('0x1b')](_0x49c4('0x2f'),_0x2d2510);}},'vidaooEscalation':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x49c4('0x1')]},'vidaooTopic':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x30')},'vidaooNote':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':function(){return _0x49c4('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x49c4('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe706=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','name','text','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x776ce4,_0x28aa2b){var _0x85b0e8=function(_0x53e4e5){while(--_0x53e4e5){_0x776ce4['push'](_0x776ce4['shift']());}};_0x85b0e8(++_0x28aa2b);}(_0xe706,0xa3));var _0x6e70=function(_0x5599aa,_0x1b9ffe){_0x5599aa=_0x5599aa-0x0;var _0x4b0f34=_0xe706[_0x5599aa];return _0x4b0f34;};'use strict';var Sequelize=require(_0x6e70('0x0'));var rs=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'unique':_0x6e70('0x4')},'description':{'type':Sequelize[_0x6e70('0x3')]},'mapKey':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x5')},'key':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x6')},'customerAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6e70('0x3')]},'animation':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6e70('0xb')](_0x6e70('0xc'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xd')},'start_chat_button':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xe')},'offline_chat_button':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xf')},'header_offline':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x14')},'noteTitle':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x16')},'closingMessageButton':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x17')},'conditionAgreement':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x18')},'ratingType':{'type':Sequelize[_0x6e70('0xb')](_0x6e70('0x19'),_0x6e70('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return JSON[_0x6e70('0x1c')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6e70('0x1d'),'type':_0x6e70('0x1e'),'required':!![]},'props':{'title':_0x6e70('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x6e70('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6e70('0x1f'))?JSON[_0x6e70('0x20')](this['getDataValue'](_0x6e70('0x1f'))):{};},'set':function(_0x1196ed){return this['setDataValue'](_0x6e70('0x1f'),JSON[_0x6e70('0x1c')](_0x1196ed));}},'offlineForm':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x6e70('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6e70('0x5'),'type':_0x6e70('0x5')},'variable':null},{'type':_0x6e70('0x21'),'config':{'placeholder':_0x6e70('0x22')},'props':{'title':'Comments','helpText':_0x6e70('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6e70('0x24')](_0x6e70('0x25'))?JSON[_0x6e70('0x20')](this[_0x6e70('0x24')](_0x6e70('0x25'))):{};},'set':function(_0x3f78d2){return this[_0x6e70('0x26')](_0x6e70('0x25'),JSON[_0x6e70('0x1c')](_0x3f78d2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e70('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6e70('0x3')]},'forwardOffline':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6e70('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x28')},'waitingMessage':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x17')},'sendUnmanaged':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return _0x6e70('0x2c');}},'notificationSound':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2e')},'verticalAlignment':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2f')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6e70('0x1b')]},'showCustomerAvatar':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x31')},'systemAvatar':{'type':Sequelize[_0x6e70('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e70('0x9')],'comment':_0x6e70('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2c0bd1){if(!_0x2c0bd1)this[_0x6e70('0x26')](_0x6e70('0x33'),null);this[_0x6e70('0x26')](_0x6e70('0x34'),_0x2c0bd1);}},'vidaooEscalation':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6e70('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x6e70('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6e70('0x1b')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8f67807..e217ffd 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 _0x53c0=['No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','all','server/files/chat/iframe.ejs','remote','connection','remoteAddress','referer','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','sitepic','getLicense','custom','isNil','join','server/files/images/logos/','server/files/images/avatars/default_avatar.png','root','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','stringify','threadId','ChatInteraction','ContactId','interaction','messageId','created','push','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','files','offline-chat','basename','openNewInteraction','sequelize','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','originalname','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','attachments','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE'];(function(_0x174e9e,_0x4ece54){var _0x524f3f=function(_0x28a2ef){while(--_0x28a2ef){_0x174e9e['push'](_0x174e9e['shift']());}};_0x524f3f(++_0x4ece54);}(_0x53c0,0x15b));var _0x053c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x53c0[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require(_0x053c('0x0'));var Mustache=require(_0x053c('0x1'));var util=require(_0x053c('0x2'));var path=require(_0x053c('0x3'));var ejs=require(_0x053c('0x4'));var fs=require('fs');var fs_extra=require(_0x053c('0x5'));var _=require(_0x053c('0x6'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0x053c('0x7'));var logger=require(_0x053c('0x8'))('api');var config=require(_0x053c('0x9'));var db=require(_0x053c('0xa'))['db'];config['redis']=_[_0x053c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x053c('0xc')]));require(_0x053c('0xd'))[_0x053c('0xe')](socket);var htmlToText=require(_0x053c('0xf'));var jayson=require(_0x053c('0x10'));var client=jayson[_0x053c('0x11')]['http']({'port':0x232c});var client9002=jayson['client'][_0x053c('0x12')]({'port':0x232a});var client9003=jayson[_0x053c('0x11')][_0x053c('0x12')]({'port':0x232b});var client9001=jayson[_0x053c('0x11')][_0x053c('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x413186,_0x478b98,_0x273c70,_0xee6b4d){return new BPromise(function(_0x297af7,_0x2c0dd6){var _0x118aae=_0xee6b4d||client;return _0x118aae[_0x053c('0x13')](_0x413186,_0x273c70)[_0x053c('0x14')](function(_0x47c277){logger[_0x053c('0x15')](_0x053c('0x16'),_0x478b98,'request\x20sent');logger[_0x053c('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x478b98,'request\x20sent',JSON['stringify'](_0x47c277));if(_0x47c277[_0x053c('0x18')]){if(_0x47c277[_0x053c('0x18')]['code']===0x1f4){logger[_0x053c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x478b98,_0x47c277[_0x053c('0x18')][_0x053c('0x19')]);return _0x2c0dd6(_0x47c277[_0x053c('0x18')][_0x053c('0x19')]);}logger[_0x053c('0x18')](_0x053c('0x16'),_0x478b98,_0x47c277[_0x053c('0x18')]['message']);return _0x297af7(_0x47c277['error'][_0x053c('0x19')]);}else{logger[_0x053c('0x15')](_0x053c('0x16'),_0x478b98,'request\x20sent');_0x297af7(_0x47c277[_0x053c('0x1a')][_0x053c('0x19')]);}})[_0x053c('0x1b')](function(_0x1f4128){logger[_0x053c('0x18')](_0x053c('0x16'),_0x478b98,_0x1f4128);_0x2c0dd6(_0x1f4128);});});}function respondWithStatusCode(_0x18042c,_0x2864ed){_0x2864ed=_0x2864ed||0xcc;return function(_0x40a725){if(_0x40a725){return _0x18042c[_0x053c('0x1c')](_0x2864ed);}return _0x18042c[_0x053c('0x1d')](_0x2864ed)[_0x053c('0x1e')]();};}function respondWithResult(_0x368948,_0x2f327e){_0x2f327e=_0x2f327e||0xc8;return function(_0x523687){if(_0x523687){return _0x368948[_0x053c('0x1d')](_0x2f327e)[_0x053c('0x1f')](_0x523687);}};}function respondWithFilteredResult(_0x1372f4,_0x57630d){return function(_0x185632){if(_0x185632){var _0x20aad0=typeof _0x57630d[_0x053c('0x20')]===_0x053c('0x21')&&typeof _0x57630d[_0x053c('0x22')]===_0x053c('0x21');var _0x16cad9=_0x185632[_0x053c('0x23')];var _0x32ffbf=_0x20aad0?0x0:_0x57630d[_0x053c('0x20')];var _0x21bb05=_0x20aad0?_0x185632[_0x053c('0x23')]:_0x57630d['offset']+_0x57630d[_0x053c('0x22')];var _0x22e112;if(_0x21bb05>=_0x16cad9){_0x21bb05=_0x16cad9;_0x22e112=0xc8;}else{_0x22e112=0xce;}_0x1372f4[_0x053c('0x1d')](_0x22e112);return _0x1372f4[_0x053c('0x24')](_0x053c('0x25'),_0x32ffbf+'-'+_0x21bb05+'/'+_0x16cad9)['json'](_0x185632);}return null;};}function saveUpdates(_0x199d66){return function(_0x197707){if(_0x197707){return _0x197707[_0x053c('0x26')](_0x199d66)[_0x053c('0x14')](function(_0x1b299f){return _0x1b299f;});}return null;};}function removeEntity(_0x569300){return function(_0x4527f8){if(_0x4527f8){return _0x4527f8[_0x053c('0x27')]()[_0x053c('0x14')](function(){var _0x55f3df=_0x4527f8[_0x053c('0x28')]({'plain':!![]});var _0xb27299=_0x053c('0x29');return db[_0x053c('0x2a')][_0x053c('0x27')]({'where':{'type':_0xb27299,'resourceId':_0x55f3df['id']}})[_0x053c('0x14')](function(){return _0x4527f8;});})[_0x053c('0x14')](function(){_0x569300['status'](0xcc)[_0x053c('0x1e')]();});}};}function handleEntityNotFound(_0x14390a){return function(_0x64424d){if(!_0x64424d){_0x14390a[_0x053c('0x1c')](0x194);}return _0x64424d;};}function handleError(_0x14c66c,_0x14157a){_0x14157a=_0x14157a||0x1f4;return function(_0x260f8c){logger[_0x053c('0x18')](_0x260f8c[_0x053c('0x2b')]);if(_0x260f8c[_0x053c('0x2c')]){delete _0x260f8c[_0x053c('0x2c')];}_0x14c66c[_0x053c('0x1d')](_0x14157a)[_0x053c('0x2d')](_0x260f8c);};}exports[_0x053c('0x2e')]=function(_0x58326f,_0x5644b2){var _0x2eedb9={'include':[{'model':db[_0x053c('0x2f')],'as':_0x053c('0x30')}]},_0x3c667a={},_0x16850f={'count':0x0,'rows':[]};var _0x7af68a=_['map'](db[_0x053c('0x31')][_0x053c('0x32')],function(_0x290cea){return{'name':_0x290cea[_0x053c('0x33')],'type':_0x290cea[_0x053c('0x34')][_0x053c('0x35')]};});_0x3c667a[_0x053c('0x36')]=_[_0x053c('0x37')](_0x7af68a,'name');_0x3c667a[_0x053c('0x38')]=_[_0x053c('0x39')](_0x58326f['query']);_0x3c667a['filters']=_[_0x053c('0x3a')](_0x3c667a[_0x053c('0x36')],_0x3c667a[_0x053c('0x38')]);_0x2eedb9[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x3c667a[_0x053c('0x36')],qs['fields'](_0x58326f[_0x053c('0x38')][_0x053c('0x3c')]));_0x2eedb9[_0x053c('0x3b')]=_0x2eedb9[_0x053c('0x3b')][_0x053c('0x3d')]?_0x2eedb9['attributes']:_0x3c667a[_0x053c('0x36')];if(!_0x58326f['query'][_0x053c('0x3e')](_0x053c('0x3f'))){_0x2eedb9[_0x053c('0x22')]=qs['limit'](_0x58326f[_0x053c('0x38')][_0x053c('0x22')]);_0x2eedb9[_0x053c('0x20')]=qs[_0x053c('0x20')](_0x58326f[_0x053c('0x38')][_0x053c('0x20')]);}_0x2eedb9[_0x053c('0x40')]=qs['sort'](_0x58326f[_0x053c('0x38')][_0x053c('0x41')]);_0x2eedb9[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x58326f[_0x053c('0x38')],_0x3c667a[_0x053c('0x43')]),_0x7af68a);if(_0x58326f[_0x053c('0x38')][_0x053c('0x45')]){_0x2eedb9[_0x053c('0x42')]=_['merge'](_0x2eedb9[_0x053c('0x42')],{'$or':_['map'](_0x7af68a,function(_0x33a025){if(_0x33a025['type']!=='VIRTUAL'){var _0x16a676={};_0x16a676[_0x33a025[_0x053c('0x2c')]]={'$like':'%'+_0x58326f[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x16a676;}})});}_0x2eedb9=_[_0x053c('0x46')]({},_0x2eedb9,_0x58326f[_0x053c('0x47')]);var _0xb793b5={'where':_0x2eedb9['where']};return db['ChatWebsite'][_0x053c('0x23')](_0xb793b5)[_0x053c('0x14')](function(_0x59f94b){_0x16850f['count']=_0x59f94b;if(_0x58326f[_0x053c('0x38')]['includeAll']){_0x2eedb9[_0x053c('0x48')]=[{'all':!![]}];}return db[_0x053c('0x31')][_0x053c('0x49')](_0x2eedb9);})[_0x053c('0x14')](function(_0x476762){_0x16850f[_0x053c('0x4a')]=_0x476762;return _0x16850f;})[_0x053c('0x14')](respondWithFilteredResult(_0x5644b2,_0x2eedb9))[_0x053c('0x1b')](handleError(_0x5644b2,null));};exports[_0x053c('0x4b')]=function(_0x32eed9,_0x39fab8){var _0x50649b={'raw':![],'where':{'id':_0x32eed9['params']['id']},'include':[{'model':db['Pause'],'as':_0x053c('0x30')}]},_0x400296={};_0x400296[_0x053c('0x36')]=_['keys'](db['ChatWebsite'][_0x053c('0x32')]);_0x400296['query']=_[_0x053c('0x39')](_0x32eed9['query']);_0x400296[_0x053c('0x43')]=_['intersection'](_0x400296[_0x053c('0x36')],_0x400296[_0x053c('0x38')]);_0x50649b[_0x053c('0x3b')]=_['intersection'](_0x400296[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x32eed9[_0x053c('0x38')][_0x053c('0x3c')]));_0x50649b[_0x053c('0x3b')]=_0x50649b['attributes'][_0x053c('0x3d')]?_0x50649b[_0x053c('0x3b')]:_0x400296[_0x053c('0x36')];if(_0x32eed9['query'][_0x053c('0x4c')]){_0x50649b[_0x053c('0x48')]=[{'all':!![]}];}_0x50649b=_[_0x053c('0x46')]({},_0x50649b,_0x32eed9[_0x053c('0x47')]);return db[_0x053c('0x31')][_0x053c('0x4d')](_0x50649b)['then'](handleEntityNotFound(_0x39fab8,null))[_0x053c('0x14')](respondWithResult(_0x39fab8,null))[_0x053c('0x1b')](handleError(_0x39fab8,null));};exports[_0x053c('0x4e')]=function(_0x19c42a,_0x132515){return db[_0x053c('0x31')][_0x053c('0x4e')](_0x19c42a[_0x053c('0x4f')],{})[_0x053c('0x14')](function(_0x31b55f){var _0x25ded7=_0x19c42a[_0x053c('0x50')]['get']({'plain':!![]});if(!_0x25ded7)throw new Error(_0x053c('0x51'));if(_0x25ded7[_0x053c('0x52')]===_0x053c('0x50')){var _0x5b33ae=_0x31b55f[_0x053c('0x28')]({'plain':!![]});var _0x3ab314=_0x053c('0x29');return db[_0x053c('0x53')][_0x053c('0x4d')]({'where':{'name':_0x3ab314,'userProfileId':_0x25ded7['userProfileId']},'raw':!![]})[_0x053c('0x14')](function(_0x5aba89){if(_0x5aba89&&_0x5aba89[_0x053c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b33ae[_0x053c('0x2c')],'resourceId':_0x5b33ae['id'],'type':_0x5aba89[_0x053c('0x2c')],'sectionId':_0x5aba89['id']},{})[_0x053c('0x14')](function(){return _0x31b55f;});}else{return _0x31b55f;}})[_0x053c('0x1b')](function(_0xa54c0d){logger['error'](_0x053c('0x55'),_0xa54c0d);throw _0xa54c0d;});}return _0x31b55f;})['then'](respondWithResult(_0x132515,0xc9))[_0x053c('0x1b')](handleError(_0x132515,null));};exports['update']=function(_0x545759,_0x122926){if(_0x545759[_0x053c('0x4f')]['id']){delete _0x545759['body']['id'];}return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x545759[_0x053c('0x56')]['id']},'include':[{'model':db[_0x053c('0x2f')],'as':_0x053c('0x30')}]})[_0x053c('0x14')](handleEntityNotFound(_0x122926,null))[_0x053c('0x14')](saveUpdates(_0x545759[_0x053c('0x4f')],null))['then'](respondWithResult(_0x122926,null))['catch'](handleError(_0x122926,null));};exports[_0x053c('0x27')]=function(_0x1eeb3e,_0xcace4f){return db[_0x053c('0x31')]['find']({'where':{'id':_0x1eeb3e[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0xcace4f,null))[_0x053c('0x14')](removeEntity(_0xcace4f,null))['catch'](handleError(_0xcace4f,null));};exports['describe']=function(_0x1acc43,_0x505105){return db['ChatWebsite'][_0x053c('0x57')]()[_0x053c('0x14')](respondWithResult(_0x505105,null))[_0x053c('0x1b')](handleError(_0x505105,null));};exports[_0x053c('0x58')]=function(_0x1759ca,_0x4d3b0b){if(_0x1759ca['body']['id']){delete _0x1759ca[_0x053c('0x4f')]['id'];}return db[_0x053c('0x31')]['find']({'where':{'id':_0x1759ca[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d3b0b,null))['then'](function(_0xd486fb){if(_0xd486fb){_0x1759ca[_0x053c('0x4f')][_0x053c('0x59')]=_0xd486fb['id'];return db['Disposition'][_0x053c('0x4e')](_0x1759ca[_0x053c('0x4f')]);}})['then'](respondWithResult(_0x4d3b0b,null))[_0x053c('0x1b')](handleError(_0x4d3b0b,null));};exports['getDispositions']=function(_0x278aae,_0x132d95){var _0x3afff6={'raw':![],'where':{}};var _0x12361c={};var _0x4c7a97={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x278aae[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x132d95,null))['then'](function(_0x80cc8c){if(_0x80cc8c){_0x12361c[_0x053c('0x36')]=_['keys'](db[_0x053c('0x5a')][_0x053c('0x32')]);_0x12361c[_0x053c('0x38')]=_[_0x053c('0x39')](_0x278aae[_0x053c('0x38')]);_0x12361c[_0x053c('0x43')]=_['intersection'](_0x12361c[_0x053c('0x36')],_0x12361c[_0x053c('0x38')]);_0x3afff6[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x12361c['model'],qs[_0x053c('0x3c')](_0x278aae['query']['fields']));_0x3afff6['attributes']=_0x3afff6[_0x053c('0x3b')][_0x053c('0x3d')]?_0x3afff6[_0x053c('0x3b')]:_0x12361c['model'];if(!_0x278aae[_0x053c('0x38')]['hasOwnProperty'](_0x053c('0x3f'))){_0x3afff6[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x278aae[_0x053c('0x38')][_0x053c('0x22')]);_0x3afff6[_0x053c('0x20')]=qs['offset'](_0x278aae[_0x053c('0x38')][_0x053c('0x20')]);}_0x3afff6[_0x053c('0x40')]=qs['sort'](_0x278aae['query'][_0x053c('0x41')]);_0x3afff6[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x278aae[_0x053c('0x38')],_0x12361c[_0x053c('0x43')]));_0x3afff6['where'][_0x053c('0x59')]=_0x80cc8c['id'];if(_0x278aae['query'][_0x053c('0x45')]){_0x3afff6[_0x053c('0x42')]=_[_0x053c('0x46')](_0x3afff6[_0x053c('0x42')],{'$or':_['map'](_0x3afff6[_0x053c('0x3b')],function(_0x4b413d){var _0x508c71={};_0x508c71[_0x4b413d]={'$like':'%'+_0x278aae[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x508c71;})});}_0x3afff6=_[_0x053c('0x46')]({},_0x3afff6,_0x278aae['options']);return db[_0x053c('0x5a')]['count']({'where':_0x3afff6[_0x053c('0x42')]})[_0x053c('0x14')](function(_0x346a65){_0x4c7a97[_0x053c('0x23')]=_0x346a65;if(_0x278aae[_0x053c('0x38')][_0x053c('0x4c')]){_0x3afff6['include']=[{'all':!![]}];}return db[_0x053c('0x5a')][_0x053c('0x49')](_0x3afff6);})[_0x053c('0x14')](function(_0x1cd445){_0x4c7a97[_0x053c('0x4a')]=_0x1cd445;return _0x4c7a97;});}})[_0x053c('0x14')](respondWithFilteredResult(_0x132d95,_0x3afff6))[_0x053c('0x1b')](handleError(_0x132d95,null));};exports[_0x053c('0x5b')]=function(_0x599949,_0x5e074e){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x599949['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x5e074e,null))[_0x053c('0x14')](function(_0x507b75){if(_0x507b75){return _0x507b75[_0x053c('0x5b')](_0x599949['query'][_0x053c('0x5c')]);}})[_0x053c('0x14')](respondWithStatusCode(_0x5e074e,null))['catch'](handleError(_0x5e074e,null));};exports[_0x053c('0x5d')]=function(_0x32d7b0,_0x30d51f){if(_0x32d7b0[_0x053c('0x4f')]['id']){delete _0x32d7b0[_0x053c('0x4f')]['id'];}return db[_0x053c('0x31')]['find']({'where':{'id':_0x32d7b0[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x30d51f,null))[_0x053c('0x14')](function(_0x526ee0){if(_0x526ee0){_0x32d7b0[_0x053c('0x4f')][_0x053c('0x59')]=_0x526ee0['id'];return db[_0x053c('0x5e')][_0x053c('0x4e')](_0x32d7b0[_0x053c('0x4f')]);}})[_0x053c('0x14')](respondWithResult(_0x30d51f,null))[_0x053c('0x1b')](handleError(_0x30d51f,null));};exports[_0x053c('0x5f')]=function(_0x3691f1,_0xe45176){var _0x59d3f2={'raw':![],'where':{}};var _0x3ec0c4={};var _0x9fded0={'count':0x0,'rows':[]};return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x3691f1[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0xe45176,null))[_0x053c('0x14')](function(_0x592627){if(_0x592627){_0x3ec0c4[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0x5e')][_0x053c('0x32')]);_0x3ec0c4['query']=_['keys'](_0x3691f1[_0x053c('0x38')]);_0x3ec0c4[_0x053c('0x43')]=_['intersection'](_0x3ec0c4[_0x053c('0x36')],_0x3ec0c4['query']);_0x59d3f2['attributes']=_[_0x053c('0x3a')](_0x3ec0c4[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x3691f1[_0x053c('0x38')][_0x053c('0x3c')]));_0x59d3f2[_0x053c('0x3b')]=_0x59d3f2[_0x053c('0x3b')][_0x053c('0x3d')]?_0x59d3f2[_0x053c('0x3b')]:_0x3ec0c4[_0x053c('0x36')];if(!_0x3691f1[_0x053c('0x38')][_0x053c('0x3e')](_0x053c('0x3f'))){_0x59d3f2[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x3691f1[_0x053c('0x38')][_0x053c('0x22')]);_0x59d3f2[_0x053c('0x20')]=qs['offset'](_0x3691f1[_0x053c('0x38')][_0x053c('0x20')]);}_0x59d3f2[_0x053c('0x40')]=qs['sort'](_0x3691f1[_0x053c('0x38')]['sort']);_0x59d3f2[_0x053c('0x42')]=qs['filters'](_[_0x053c('0x44')](_0x3691f1[_0x053c('0x38')],_0x3ec0c4[_0x053c('0x43')]));_0x59d3f2[_0x053c('0x42')]['ChatWebsiteId']=_0x592627['id'];if(_0x3691f1['query'][_0x053c('0x45')]){_0x59d3f2['where']=_[_0x053c('0x46')](_0x59d3f2[_0x053c('0x42')],{'$or':_[_0x053c('0x37')](_0x59d3f2[_0x053c('0x3b')],function(_0x2c1f24){var _0x284c19={};_0x284c19[_0x2c1f24]={'$like':'%'+_0x3691f1[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x284c19;})});}_0x59d3f2=_[_0x053c('0x46')]({},_0x59d3f2,_0x3691f1[_0x053c('0x47')]);return db[_0x053c('0x5e')]['count']({'where':_0x59d3f2['where']})[_0x053c('0x14')](function(_0xd5da8d){_0x9fded0[_0x053c('0x23')]=_0xd5da8d;if(_0x3691f1[_0x053c('0x38')][_0x053c('0x4c')]){_0x59d3f2[_0x053c('0x48')]=[{'all':!![]}];}return db['CannedAnswer'][_0x053c('0x49')](_0x59d3f2);})['then'](function(_0x1778b1){_0x9fded0[_0x053c('0x4a')]=_0x1778b1;return _0x9fded0;});}})[_0x053c('0x14')](respondWithFilteredResult(_0xe45176,_0x59d3f2))[_0x053c('0x1b')](handleError(_0xe45176,null));};exports[_0x053c('0x61')]=function(_0x5442ca,_0x29399e){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x5442ca[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x29399e,null))[_0x053c('0x14')](function(_0x5dfc70){if(_0x5dfc70){return _0x5dfc70[_0x053c('0x61')](_0x5442ca[_0x053c('0x38')][_0x053c('0x5c')]);}})[_0x053c('0x14')](respondWithStatusCode(_0x29399e,null))[_0x053c('0x1b')](handleError(_0x29399e,null));};exports[_0x053c('0x62')]=function(_0x5084e8,_0x5961ea){_0x5084e8[_0x053c('0x4f')]['sitepic']=_0x5084e8[_0x053c('0x63')][_0x053c('0x64')];return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x5084e8[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x5961ea,null))[_0x053c('0x14')](saveUpdates(_0x5084e8[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x5961ea,null))[_0x053c('0x1b')](handleError(_0x5961ea,null));};exports[_0x053c('0x65')]=function(_0x220509,_0x223b9c){_0x220509[_0x053c('0x4f')][_0x053c('0x66')]=_0x220509[_0x053c('0x63')][_0x053c('0x64')];return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x220509[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x223b9c,null))[_0x053c('0x14')](saveUpdates(_0x220509[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x223b9c,null))[_0x053c('0x1b')](handleError(_0x223b9c,null));};exports[_0x053c('0x67')]=function(_0x337a6b,_0x28fe8a){_0x337a6b[_0x053c('0x4f')][_0x053c('0x68')]=_0x337a6b[_0x053c('0x63')][_0x053c('0x64')];return db[_0x053c('0x31')]['find']({'where':{'id':_0x337a6b[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x28fe8a,null))[_0x053c('0x14')](saveUpdates(_0x337a6b[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x28fe8a,null))['catch'](handleError(_0x28fe8a,null));};exports['addSystemAvatar']=function(_0x131b6b,_0x223e54){_0x131b6b[_0x053c('0x4f')]['systemAvatar']=_0x131b6b[_0x053c('0x63')]['filename'];return db[_0x053c('0x31')]['find']({'where':{'id':_0x131b6b['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x223e54,null))['then'](saveUpdates(_0x131b6b[_0x053c('0x4f')],null))[_0x053c('0x14')](respondWithResult(_0x223e54,null))['catch'](handleError(_0x223e54,null));};exports[_0x053c('0x69')]=function(_0x16dfda,_0x44c7bf){var _0x3499fa=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x590372={'where':{'id':_0x16dfda[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x6a')],'raw':!![]};var _0x5e69c6=![];return require('../../config/license/util')[_0x053c('0x6b')]()[_0x053c('0x14')](function(_0x281f71){if(_0x281f71){_0x5e69c6=_0x281f71[_0x053c('0x6c')];}})[_0x053c('0x14')](function(){return db['ChatWebsite'][_0x053c('0x4d')](_0x590372);})['then'](handleEntityNotFound(_0x44c7bf,null))['then'](function(_0x5e0424){if(_0x5e0424){if(!_[_0x053c('0x6d')](_0x5e0424['sitepic'])){if(fs['existsSync'](path[_0x053c('0x6e')](config['root'],_0x053c('0x6f'),_0x5e0424['sitepic']))&&_0x5e69c6){_0x3499fa=path[_0x053c('0x6e')](config['root'],_0x053c('0x6f'),_0x5e0424[_0x053c('0x6a')]);}}return _0x44c7bf['download'](_0x3499fa);}})[_0x053c('0x1b')](handleError(_0x44c7bf,null));};exports['getAvatar']=function(_0x56ffc2,_0x40e7eb){var _0x229431=path[_0x053c('0x6e')](config['root'],_0x053c('0x70'));var _0x3e8255={'where':{'id':_0x56ffc2[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x66')],'raw':!![]};return db[_0x053c('0x31')]['find'](_0x3e8255)['then'](handleEntityNotFound(_0x40e7eb,null))[_0x053c('0x14')](function(_0x4da076){if(_0x4da076){if(!_[_0x053c('0x6d')](_0x4da076['agentAvatar'])){if(fs['existsSync'](path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x4da076[_0x053c('0x66')]))){_0x229431=path[_0x053c('0x6e')](config['root'],'server/files/images/avatars/',_0x4da076[_0x053c('0x66')]);}}return _0x40e7eb[_0x053c('0x73')](_0x229431);}})['catch'](handleError(_0x40e7eb,null));};exports[_0x053c('0x74')]=function(_0x209153,_0x2758d9){var _0x53325b=path[_0x053c('0x6e')](config['root'],_0x053c('0x75'));var _0x3738c1={'where':{'id':_0x209153[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x68'),_0x053c('0x76')],'raw':!![]};return db[_0x053c('0x31')][_0x053c('0x4d')](_0x3738c1)[_0x053c('0x14')](handleEntityNotFound(_0x2758d9,null))['then'](function(_0x4c2a0a){if(_0x4c2a0a){if(!_['isNil'](_0x4c2a0a[_0x053c('0x68')])){if(fs[_0x053c('0x77')](path['join'](config['root'],_0x053c('0x72'),_0x4c2a0a[_0x053c('0x68')]))&&_0x4c2a0a[_0x053c('0x76')]){_0x53325b=path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x4c2a0a['customerAvatar']);}}return _0x2758d9[_0x053c('0x73')](_0x53325b);}})[_0x053c('0x1b')](handleError(_0x2758d9,null));};exports['getSystemAvatar']=function(_0x3020b6,_0x45d291){var _0x16fe65=path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x78'));var _0x2d11cb={'where':{'id':_0x3020b6[_0x053c('0x56')]['id']},'attributes':['id',_0x053c('0x79')],'raw':!![]};return db[_0x053c('0x31')][_0x053c('0x4d')](_0x2d11cb)[_0x053c('0x14')](handleEntityNotFound(_0x45d291,null))[_0x053c('0x14')](function(_0x231e11){if(_0x231e11){if(!_[_0x053c('0x6d')](_0x231e11[_0x053c('0x79')])){if(fs['existsSync'](path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x231e11[_0x053c('0x79')]))){_0x16fe65=path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x72'),_0x231e11['systemAvatar']);}}return _0x45d291[_0x053c('0x73')](_0x16fe65);}})[_0x053c('0x1b')](handleError(_0x45d291,null));};exports[_0x053c('0x7a')]=function(_0x5f554a,_0x204d87){var _0x50100e=require(_0x053c('0x7b'));var _0x2d4cb1=new _0x50100e();var _0x263d27=_0x2d4cb1['setUA'](_0x5f554a[_0x053c('0x7c')][_0x053c('0x7d')])[_0x053c('0x7e')]();var _0x8dc531={'body':_0x5f554a[_0x053c('0x4f')],'channel':_0x053c('0x7f')};var _0x56b08c=[];var _0x5a27be=[];var _0x36d753={};var _0x1b8b8a=![];return db[_0x053c('0x80')][_0x053c('0x57')]()[_0x053c('0x14')](function(_0x15adb8){if(!_0x15adb8){throw new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0x82'));}_0x56b08c=_[_0x053c('0x83')](_[_0x053c('0x39')](_0x15adb8),['createdAt',_0x053c('0x84')]);_0x5a27be=_['difference'](_[_0x053c('0x39')](_0x15adb8),[_0x053c('0x85'),_0x053c('0x84'),_0x053c('0x86'),_0x053c('0x87')]);if(_0x5f554a['body']['id']){delete _0x5f554a[_0x053c('0x4f')]['id'];}if(_[_0x053c('0x6d')](_0x5f554a[_0x053c('0x4f')][_0x053c('0x88')])){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5f554a[_0x053c('0x4f')]['body'])||_0x5f554a[_0x053c('0x4f')][_0x053c('0x4f')]===''){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))](_0x053c('0x8a'));}if(_[_0x053c('0x6d')](_0x5f554a['body'][_0x053c('0x8b')])){throw new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0x8c')+_0x5a27be);}if(!_[_0x053c('0x8d')](_0x5a27be,_0x5f554a[_0x053c('0x4f')][_0x053c('0x8b')])){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a27be);}_0x36d753[_0x5f554a[_0x053c('0x4f')][_0x053c('0x8b')]]=_0x5f554a[_0x053c('0x4f')][_0x053c('0x88')];})[_0x053c('0x14')](function(){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x5f554a[_0x053c('0x56')]['id']},'include':[{'model':db[_0x053c('0x8e')],'as':_0x053c('0x8f'),'include':[{'model':db[_0x053c('0x80')],'as':_0x053c('0x90'),'where':_0x36d753,'limit':0x1,'order':[[_0x053c('0x84'),_0x053c('0x91')]]}]},{'model':db[_0x053c('0x92')],'as':_0x053c('0x93')}]});})['then'](handleEntityNotFound(_0x204d87,null))[_0x053c('0x14')](function(_0x18a8f7){if(_0x18a8f7&&_0x18a8f7[_0x053c('0x8f')]){_0x8dc531[_0x053c('0x94')]=_0x18a8f7;_0x8dc531['applications']=_0x18a8f7[_0x053c('0x93')];_0x8dc531[_0x053c('0x95')]=_0x18a8f7['List'];_0x8dc531[_0x053c('0x96')]=_[_0x053c('0x97')](_0x8dc531['applications'],['priority'],['asc']);if(_0x8dc531[_0x053c('0x94')][_0x053c('0x93')]){delete _0x8dc531[_0x053c('0x94')][_0x053c('0x93')];}if(_0x8dc531[_0x053c('0x94')][_0x053c('0x8f')]&&_0x8dc531[_0x053c('0x94')][_0x053c('0x8f')][_0x053c('0x90')][_0x053c('0x3d')]){return _0x8dc531[_0x053c('0x94')]['List']['Contacts'][0x0];}var _0x32602f=_['defaults'](_0x5f554a['body'],{'firstName':_0x5f554a[_0x053c('0x4f')][_0x053c('0x88')],'ListId':_0x18a8f7[_0x053c('0x87')]});_0x32602f[_0x5f554a['body'][_0x053c('0x8b')]]=_0x5f554a[_0x053c('0x4f')]['from'];return db['CmContact'][_0x053c('0x4e')](_0x32602f,{'fields':_0x56b08c,'raw':!![]});}})[_0x053c('0x14')](handleEntityNotFound(_0x204d87,null))['then'](function(_0x1b356b){_0x8dc531[_0x053c('0x98')]=_0x1b356b;var _0x4ea62d=_0x5f554a['body'][_0x053c('0x99')];if(_0x5f554a[_0x053c('0x7c')][_0x053c('0x9a')]){_0x4ea62d=_0x5f554a[_0x053c('0x7c')]['cf-connecting-ip'];}else if(_0x5f554a[_0x053c('0x7c')]['x-forwarded-for']){_0x4ea62d=_[_0x053c('0x9b')](_0x5f554a[_0x053c('0x7c')][_0x053c('0x9c')]['split'](','));}if(_0x1b356b){var _0x2c83aa={'ContactId':_0x1b356b['id'],'ChatWebsiteId':_0x5f554a[_0x053c('0x56')]['id'],'from':(_0x1b356b[_0x053c('0x9d')]||'')+'\x20'+(_0x1b356b[_0x053c('0x9e')]||''),'customerIp':_0x4ea62d,'customerPort':_0x5f554a[_0x053c('0x7c')][_0x053c('0x9f')]?_0x5f554a[_0x053c('0x7c')][_0x053c('0x9f')]:null,'referer':_0x5f554a[_0x053c('0x4f')]['referer'],'browserName':_0x263d27[_0x053c('0xa0')][_0x053c('0x2c')]&&_0x263d27[_0x053c('0xa0')][_0x053c('0xa1')]?util[_0x053c('0xa2')](_0x053c('0xa3'),_0x263d27[_0x053c('0xa0')][_0x053c('0x2c')],_0x263d27['browser'][_0x053c('0xa1')]):_0x053c('0xa4'),'browserVersion':_0x263d27[_0x053c('0xa0')]['version']||'unknown','osName':util['format'](_0x053c('0xa3'),_0x263d27['os']['name'],_0x263d27['os'][_0x053c('0xa1')]),'osVersion':_0x263d27['os'][_0x053c('0xa1')],'deviceModel':_0x263d27['device'][_0x053c('0x36')]&&_0x263d27['device'][_0x053c('0xa5')]?util[_0x053c('0xa2')](_0x053c('0xa6'),_0x263d27[_0x053c('0xa7')][_0x053c('0x36')],_0x263d27[_0x053c('0xa7')][_0x053c('0xa5')],_0x263d27[_0x053c('0xa7')][_0x053c('0x34')]):null,'deviceVendor':_0x263d27[_0x053c('0xa7')][_0x053c('0xa5')],'deviceType':_0x263d27['device'][_0x053c('0x34')],'formData':JSON[_0x053c('0xa8')](_0x5f554a[_0x053c('0x4f')])};var _0x5094a7={'ChatWebsiteId':_0x5f554a[_0x053c('0x56')]['id'],'closed':![]};if(_0x5f554a[_0x053c('0x4f')][_0x053c('0xa9')]){_0x5094a7[_0x053c('0xa9')]=_0x5f554a[_0x053c('0x4f')][_0x053c('0xa9')];return db[_0x053c('0xaa')][_0x053c('0x4d')]({'where':_0x5094a7})[_0x053c('0x14')](function(_0x5d1dd5){if(_0x5d1dd5){return[_0x5d1dd5,![]];}_0x2c83aa[_0x053c('0xa9')]=_0x5f554a[_0x053c('0x4f')][_0x053c('0xa9')];_0x2c83aa['externalUrl']=_0x5f554a[_0x053c('0x4f')]['externalUrl'];return db[_0x053c('0xaa')][_0x053c('0x4e')](_0x2c83aa)[_0x053c('0x14')](function(_0x5b7594){return[_0x5b7594,!![]];});});}_0x5094a7[_0x053c('0xab')]=_0x1b356b['id'];if(_0x5f554a[_0x053c('0x4f')][_0x053c('0xac')]&&_0x5f554a[_0x053c('0x4f')][_0x053c('0xac')]['id']){_0x5094a7['id']=_0x5f554a[_0x053c('0x4f')]['interaction']['id'];return db[_0x053c('0xaa')][_0x053c('0x4d')]({'where':_0x5094a7})[_0x053c('0x14')](function(_0x26ee8a){if(_0x26ee8a){return[_0x26ee8a,![]];}return db[_0x053c('0xaa')][_0x053c('0x4e')](_0x2c83aa)[_0x053c('0x14')](function(_0x2084ef){return[_0x2084ef,!![]];});});}return db['ChatInteraction'][_0x053c('0x4e')](_0x2c83aa)[_0x053c('0x14')](function(_0x35b308){return[_0x35b308,!![]];});}})['spread'](function(_0x44156c,_0xcfa528){if(_0x44156c){_0x1b8b8a=_0xcfa528;if(!_0xcfa528){var _0x2208d6={'from':(_0x8dc531['contact'][_0x053c('0x9d')]||'')+'\x20'+(_0x8dc531[_0x053c('0x98')][_0x053c('0x9e')]||'')};if(_0x5f554a['body'][_0x053c('0xa9')]&&_0x5f554a[_0x053c('0x4f')][_0x053c('0xad')]&&_0x5f554a['body'][_0x053c('0xa9')]!=_0x5f554a[_0x053c('0x4f')][_0x053c('0xad')]){_0x2208d6[_0x053c('0xa9')]=_0x5f554a[_0x053c('0x4f')]['messageId'];}return _0x44156c[_0x053c('0x26')](_0x2208d6);}else{return _0x44156c;}}})[_0x053c('0x14')](function(_0x2504a6){_0x8dc531[_0x053c('0xac')]=_0x2504a6[_0x053c('0x28')]({'plain':!![]});_0x8dc531[_0x053c('0xac')][_0x053c('0xae')]=_0x1b8b8a;if(_0x8dc531['interaction']['created']){if(_0x8dc531['account']['autoclose']){_0x8dc531[_0x053c('0x96')][_0x053c('0xaf')]({'id':0x0,'priority':_0x8dc531['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x053c('0xb0')});}}return db['ChatMessage'][_0x053c('0x4e')]({'body':_0x5f554a[_0x053c('0x4f')][_0x053c('0x4f')],'ChatWebsiteId':_0x5f554a[_0x053c('0x56')]['id'],'ChatInteractionId':_0x2504a6['id'],'direction':'in','ContactId':_0x8dc531[_0x053c('0x98')]['id'],'AttachmentId':_0x5f554a[_0x053c('0x4f')][_0x053c('0xb1')]});})[_0x053c('0x14')](function(_0x38dfce){_0x8dc531[_0x053c('0x19')]=_0x38dfce;if(_0x8dc531[_0x053c('0xac')][_0x053c('0xb2')]){return db['User'][_0x053c('0x4d')]({'attributes':['id',_0x053c('0x2c')],'where':{'id':_0x8dc531[_0x053c('0xac')][_0x053c('0xb2')]}})['then'](function(_0x3753b2){if(_0x3753b2){_0x8dc531[_0x053c('0x96')][_0x053c('0xb3')]({'id':0x0,'priority':0x0,'app':_0x053c('0xb4'),'appdata':_0x3753b2['name']+','+(_0x8dc531[_0x053c('0x94')][_0x053c('0xb5')]||0xa),'interval':_0x053c('0xb0')});_0x8dc531[_0x053c('0xb6')]=!![];}return respondWithRpcPromise(_0x053c('0xb7'),_0x053c('0xb8'),_0x8dc531);});}return respondWithRpcPromise(_0x053c('0xb7'),_0x053c('0xb8'),_0x8dc531);})[_0x053c('0x14')](function(_0x31d282){respondWithRpcPromise(_0x053c('0xb9'),_0x053c('0xb9'),{'event':_0x053c('0x7a'),'message':_0x31d282},client9002);return _0x31d282;})['then'](respondWithResult(_0x204d87,null))[_0x053c('0x1b')](handleError(_0x204d87,null));};exports[_0x053c('0xba')]=function(_0x3d1cf3,_0x4465e0){var _0x5ba703,_0x476798,_0x26cd40;var _0x24ec5a=[];var _0x24beaa={};var _0x4cf15e=_0x3d1cf3['files']||[];var _0x10d3e2=[];var _0x5af8dd;return db[_0x053c('0x80')][_0x053c('0x57')]()['then'](function(_0x246bad){if(!_0x246bad){throw new db[(_0x053c('0x81'))][(_0x053c('0x89'))](_0x053c('0x82'));}_0x24ec5a=_[_0x053c('0x83')](_['keys'](_0x246bad),[_0x053c('0x85'),'updatedAt','CompanyId',_0x053c('0x87')]);if(_0x3d1cf3['body']['id']){delete _0x3d1cf3[_0x053c('0x4f')]['id'];}if(_['isNil'](_0x3d1cf3['body'][_0x053c('0x88')])){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0xbb')));}if(_[_0x053c('0x6d')](_0x3d1cf3['body'][_0x053c('0x4f')])||_0x3d1cf3['body'][_0x053c('0x4f')]===''){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0x8a')));}if(_['isNil'](_0x3d1cf3[_0x053c('0x4f')][_0x053c('0xbc')])){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db[(_0x053c('0x81'))]['ValidationError'](_0x053c('0xbd')+_0x24ec5a));}if(!_[_0x053c('0x8d')](_0x24ec5a,_0x3d1cf3[_0x053c('0x4f')][_0x053c('0xbc')])){throw _0x4465e0[_0x053c('0x1d')](0x1f4)[_0x053c('0x2d')](new db['Sequelize'][(_0x053c('0x89'))](_0x053c('0xbe')+_0x24ec5a));}_0x24beaa[_0x3d1cf3[_0x053c('0x4f')][_0x053c('0xbc')]]=_0x3d1cf3[_0x053c('0x4f')][_0x053c('0x88')];})[_0x053c('0x14')](function(){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x3d1cf3[_0x053c('0x56')]['id']},'include':[{'model':db[_0x053c('0x8e')],'as':_0x053c('0x8f')},{'model':db[_0x053c('0xbf')],'as':_0x053c('0xbf')}]});})[_0x053c('0x14')](handleEntityNotFound(_0x4465e0,null))['then'](function(_0x1d8862){if(_0x1d8862&&_0x1d8862[_0x053c('0x8f')]){_0x476798=_0x1d8862;var _0x3a1eaa=_[_0x053c('0xb')](_0x3d1cf3['body'],{'firstName':_0x3d1cf3[_0x053c('0x4f')][_0x053c('0x88')],'phone':_0x3d1cf3['body'][_0x053c('0x88')],'ListId':_0x1d8862[_0x053c('0x87')]});_0x3a1eaa[_0x3d1cf3['body'][_0x053c('0xbc')]]=_0x3d1cf3['body']['from'];return db[_0x053c('0x80')][_0x053c('0xc0')]({'where':_0x24beaa,'defaults':_0x3a1eaa});}})['spread'](function(_0x39c8c6){if(_0x39c8c6){_0x26cd40=_0x39c8c6;var _0x56ff95=fs['readFileSync'](path['join'](config[_0x053c('0x71')],'server/files/templates/chatOfflineMessage.ejs'),_0x053c('0xc1'));var _0x533e87=ejs[_0x053c('0xc2')](_0x56ff95,{'body':_[_0x053c('0xc3')](_0x3d1cf3[_0x053c('0x4f')]['body']),'bodyTitle':_0x476798[_0x053c('0xc4')]});return db[_0x053c('0xc5')][_0x053c('0x4e')]({'body':_0x533e87,'plainBody':htmlToText[_0x053c('0xc6')](_0x533e87),'ContactId':_0x39c8c6['id'],'ChatWebsiteId':_0x476798['id']});}})[_0x053c('0x14')](function(_0x25471c){_0x5af8dd=_0x25471c;if(_0x4cf15e[_0x053c('0x3d')]){var _0x40c1ae=_0x4cf15e[_0x053c('0x37')](function(_0x232c69){return{'name':_0x232c69['originalname'],'basename':_0x232c69['filename'],'type':_0x232c69[_0x053c('0xc7')],'ChatOfflineMessageId':_0x25471c['id']};});_0x10d3e2=_0x40c1ae['map'](_0x23848f=>{var _0x5c9a99={'filename':_0x23848f['name'],'path':path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0xc8'),_0x053c('0xc9'),'attachments',_0x053c('0xca'),_0x23848f[_0x053c('0xcb')])};return _0x5c9a99;});if(!_0x476798[_0x053c('0xcc')]){return db[_0x053c('0xcd')]['transaction'](function(_0x4264a2){return db[_0x053c('0xce')]['bulkCreate'](_0x40c1ae,{'transaction':_0x4264a2});});}}})[_0x053c('0x14')](function(){if(_0x5af8dd){_0x5ba703=_0x5af8dd;return db['MailAccount'][_0x053c('0x60')]({'where':{'service':!![]},'include':[{'model':db[_0x053c('0xcf')],'as':_0x053c('0xd0'),'raw':!![],'include':[{'model':db[_0x053c('0xd1')],'as':_0x053c('0xd1'),'raw':!![]}]}]});}})[_0x053c('0x14')](function(_0x3a6283){if(_0x3a6283&&_0x3a6283[_0x053c('0xd0')]&&_0x476798[_0x053c('0xd2')]&&_0x476798[_0x053c('0xd3')]){var _0x30883a=_0x3a6283[_0x053c('0xd4')]();return respondWithRpcPromise(_0x053c('0xd5'),_0x053c('0xd6'),{'account':_0x30883a,'message':{'from':util[_0x053c('0xa2')](_0x053c('0xd7'),_0x3a6283[_0x053c('0x2c')],_0x3a6283[_0x053c('0xd8')]||_0x3a6283[_0x053c('0xd0')][_0x053c('0x50')]),'to':_0x476798[_0x053c('0xd3')],'subject':_0x476798['offlineMessageSubject'],'html':_0x5ba703[_0x053c('0x4f')],'attachments':_0x10d3e2}},client9003)[_0x053c('0x14')](function(){return _0x5ba703;})[_0x053c('0x1b')](function(_0x29720b){logger[_0x053c('0x18')](_0x29720b);});}})['then'](function(){if(_0x476798&&_0x476798['openNewInteraction']&&_0x476798['MailAccountId']){var _0x55f1fd=[];if(_0x4cf15e[_0x053c('0x3d')]){_0x55f1fd=_0x4cf15e[_0x053c('0x37')](function(_0x548c74){return{'name':_0x548c74[_0x053c('0xd9')],'basename':_0x548c74[_0x053c('0x64')],'type':_0x548c74['mimetype'],'ChatOfflineMessageId':_0x5af8dd['id']};});}var _0x193e34;if(!_[_0x053c('0x6d')](_0x476798[_0x053c('0xda')])){var _0x368544=_[_0x053c('0x37')](_0x3d1cf3[_0x053c('0x4f')],function(_0x321880){return _0x321880;});var _0xdb27fe=_[_0x053c('0xdb')](_0x368544)[0x0];var _0x5f333e=_[_0x053c('0xdc')](_0xdb27fe,function(_0x63142d){return _0x63142d;});_0x193e34=_0x5f333e[0x1][_0x476798[_0x053c('0xda')]];}var _0x2d7bd5={'from':_0x26cd40['email'],'firstName':_0x26cd40['firstName'],'lastName':_0x26cd40[_0x053c('0x9e')],'mapKey':_0x053c('0xd8'),'message':{'from':_0x26cd40[_0x053c('0xd8')],'to':_0x476798['MailAccount']['email'],'cc':'','subject':_['isNil'](_0x193e34)?_0x476798[_0x053c('0xdd')]:_0x193e34,'messageId':'','sentAt':new Date(),'attach':_0x55f1fd[_0x053c('0x3d')],'attachments':_0x55f1fd,'originChannel':_0x053c('0xde'),'ChatWebsiteId':_0x476798['id'],'ChatOfflineMessageId':_0x5ba703['id'],'originTo':_0x476798['MailAccount'][_0x053c('0xd8')]},'body':_0x5ba703[_0x053c('0x4f')]};var _0x27c9c4={'account':{'id':_0x476798[_0x053c('0xdf')]},'body':_0x2d7bd5,'log':_0x053c('0xe0')};return respondWithRpcPromise(_0x053c('0xe0'),'notifyMail',_0x27c9c4,client9001)[_0x053c('0x14')](function(){return _0x5ba703;})[_0x053c('0x1b')](function(_0x453637){logger[_0x053c('0x18')](_0x453637);});}return;})[_0x053c('0x14')](function(){if(_0x5ba703){return _0x5ba703;}})[_0x053c('0x14')](respondWithResult(_0x4465e0,null))['catch'](function(_0x2980aa){logger['error'](_0x053c('0x1b'),_0x2980aa);for(var _0x21305c of _0x4cf15e){var _0xb4f1f1=path['join'](config['root'],'server',_0x053c('0xc9'),_0x053c('0xe1'),_0x053c('0xca'),_0x21305c[_0x053c('0x64')]);fs_extra[_0x053c('0xe2')](_0xb4f1f1)[_0x053c('0x1b')](function(_0x17c9d5){logger[_0x053c('0x18')]('Could\x20not\x20remove\x20attachment\x20file',_0xb4f1f1,_0x17c9d5);});}});};exports[_0x053c('0xe3')]=function(_0x5b19e8,_0x41bfc5){return db[_0x053c('0xaa')]['find']({'where':{'id':_0x5b19e8[_0x053c('0x56')]['id']}})['then'](handleEntityNotFound(_0x41bfc5,null))[_0x053c('0x14')](function(_0x1d12ea){if(_0x1d12ea){return _0x1d12ea[_0x053c('0xe3')](_0x5b19e8[_0x053c('0x4f')][_0x053c('0x5c')],_[_0x053c('0xe4')](_0x5b19e8['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x41bfc5,null))[_0x053c('0x1b')](handleError(_0x41bfc5,null));};exports[_0x053c('0xe5')]=function(_0x5b2e19,_0x1c750c){var _0x1801de={'raw':![],'where':{}};var _0x32033b={};var _0x3477dc={'count':0x0,'rows':[]};return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x5b2e19['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x1c750c,null))[_0x053c('0x14')](function(_0x4da8e7){if(_0x4da8e7){_0x32033b[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0xaa')]['rawAttributes']);_0x32033b[_0x053c('0x38')]=_['keys'](_0x5b2e19[_0x053c('0x38')]);_0x32033b['filters']=_['intersection'](_0x32033b['model'],_0x32033b[_0x053c('0x38')]);_0x1801de[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x32033b[_0x053c('0x36')],qs['fields'](_0x5b2e19['query'][_0x053c('0x3c')]));_0x1801de[_0x053c('0x3b')]=_0x1801de[_0x053c('0x3b')][_0x053c('0x3d')]?_0x1801de[_0x053c('0x3b')]:_0x32033b[_0x053c('0x36')];if(!_0x5b2e19[_0x053c('0x38')][_0x053c('0x3e')](_0x053c('0x3f'))){_0x1801de[_0x053c('0x22')]=qs['limit'](_0x5b2e19[_0x053c('0x38')][_0x053c('0x22')]);_0x1801de[_0x053c('0x20')]=qs[_0x053c('0x20')](_0x5b2e19[_0x053c('0x38')]['offset']);}_0x1801de['order']=qs[_0x053c('0x41')](_0x5b2e19[_0x053c('0x38')][_0x053c('0x41')]);_0x1801de['where']=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x5b2e19[_0x053c('0x38')],_0x32033b[_0x053c('0x43')]));_0x1801de[_0x053c('0x42')][_0x053c('0x59')]=_0x4da8e7['id'];if(_0x5b2e19['query']['filter']){_0x1801de[_0x053c('0x42')]=_[_0x053c('0x46')](_0x1801de['where'],{'$or':_[_0x053c('0x37')](_0x1801de['attributes'],function(_0x537078){var _0x373fa2={};_0x373fa2[_0x537078]={'$like':'%'+_0x5b2e19['query'][_0x053c('0x45')]+'%'};return _0x373fa2;})});}_0x1801de=_[_0x053c('0x46')]({},_0x1801de,_0x5b2e19[_0x053c('0x47')]);return db[_0x053c('0xaa')][_0x053c('0x23')]({'where':_0x1801de[_0x053c('0x42')]})['then'](function(_0x23846e){_0x3477dc[_0x053c('0x23')]=_0x23846e;if(_0x5b2e19[_0x053c('0x38')][_0x053c('0x4c')]){_0x1801de[_0x053c('0x48')]=[{'model':db[_0x053c('0x80')],'as':_0x053c('0xe6'),'required':![]},{'model':db[_0x053c('0xe7')],'as':_0x053c('0xe8'),'attributes':['name',_0x053c('0xe9'),_0x053c('0xea')],'required':![]},{'model':db[_0x053c('0xeb')],'as':'Tags','attributes':['id','name',_0x053c('0xec')],'where':_0x5b2e19[_0x053c('0x38')]['tag']?{'id':_0x5b2e19[_0x053c('0x38')][_0x053c('0xed')]}:undefined,'required':_0x5b2e19['query'][_0x053c('0xed')]?!![]:![]}];}return db[_0x053c('0xaa')][_0x053c('0x49')](_0x1801de);})[_0x053c('0x14')](function(_0x4859a3){_0x3477dc[_0x053c('0x4a')]=_0x4859a3;return _0x3477dc;});}})[_0x053c('0x14')](respondWithFilteredResult(_0x1c750c,_0x1801de))['catch'](handleError(_0x1c750c,null));};function iftimePromise(_0x3e46ed,_0x26c555){return respondWithRpcPromise(_0x053c('0xee'),_0x053c('0xef'),{'command':_0x26c555[_0x053c('0xf0')]?util[_0x053c('0xa2')](_0x053c('0xf1'),_0x3e46ed['interval'],_0x26c555['timezone']):util['format'](_0x053c('0xf2'),_0x3e46ed[_0x053c('0xf3')])},client9002)[_0x053c('0x14')](function(_0x2e2c87){var _0x434ea4=_0x2e2c87&&_0x2e2c87[_0x053c('0xf4')]('true')>=0x0?!![]:![];logger['info'](_0x053c('0xf5'),_0x26c555['id'],_0x3e46ed['id'],_0x3e46ed['interval'],_0x434ea4?'ONLINE':_0x053c('0xf6'),_0x26c555[_0x053c('0xf0')]?_0x26c555[_0x053c('0xf0')]:_0x053c('0xf7'));return _0x434ea4;})[_0x053c('0x1b')](function(_0x392855){logger[_0x053c('0x18')](_0x053c('0xf5'),_0x26c555['id'],_0x3e46ed['id'],_0x3e46ed[_0x053c('0xf3')],util[_0x053c('0xf8')](_0x392855,{'showHidden':![],'depth':null}),_0x26c555[_0x053c('0xf0')]?_0x26c555[_0x053c('0xf0')]:_0x053c('0xf7'));return![];});}exports[_0x053c('0xef')]=function(_0x553923,_0x1a18d1){var _0x4b9699=0x0;var _0x37106f=0x0;var _0x232d7f=![];var _0x511f61;var _0xbf99eb;return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x553923[_0x053c('0x56')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x053c('0xf9')],'as':_0x053c('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1a18d1,null))[_0x053c('0x14')](function(_0x100c30){if(_0x100c30){_0x511f61=_0x100c30;return _0x100c30[_0x053c('0xfb')]({'raw':!![]});}})['then'](function(_0x20ead2){if(_0x511f61){if(_0x20ead2){_0xbf99eb=_0x20ead2;}}return require(_0x053c('0xfc'))['getLicense']();})[_0x053c('0x14')](function(_0x3d0ade){if(_0x3d0ade){_0x37106f=_0x3d0ade[_0x053c('0xfd')];_0x232d7f=_0x3d0ade[_0x053c('0x6c')];}})[_0x053c('0x14')](function(){return db['ChatInteraction'][_0x053c('0x23')]({'where':{'closed':![]}});})[_0x053c('0x14')](function(_0x568df2){_0x4b9699=_0x568df2;if(_0x37106f&&_0x568df2>_0x37106f){return db[_0x053c('0xfe')][_0x053c('0x60')]({'where':{'id':0x1}})[_0x053c('0x14')](function(_0x4be783){if(_0x4be783){_0x4be783[_0x053c('0xff')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x511f61[_0x053c('0xf9')]&&_0x511f61['Interval'][_0x053c('0xfa')]){var _0x1f9fd7=[];for(var _0x399e46=0x0;_0x399e46<_0x511f61[_0x053c('0xf9')][_0x053c('0xfa')][_0x053c('0x3d')];_0x399e46++){var _0x292993=_0x511f61[_0x053c('0xf9')][_0x053c('0xfa')][_0x399e46][_0x053c('0x28')]({'plain':!![]});_0x1f9fd7['push'](iftimePromise(_0x292993,_0x511f61));}return BPromise[_0x053c('0x100')](_0x1f9fd7)[_0x053c('0x14')](function(_0x37ee28){return _['some'](_0x37ee28);});}else{return!![];}})[_0x053c('0x14')](function(_0x59b670){var _0x1b0a59=fs['readFileSync'](path[_0x053c('0x6e')](config[_0x053c('0x71')],_0x053c('0x101')),_0x053c('0xc1'));var _0x1153b7={'remote':_0x511f61[_0x053c('0x102')],'query':querystring[_0x053c('0xa8')](_[_0x053c('0x46')](_0x511f61['get']({'plain':!![]}),{'customerIp':_0x553923[_0x053c('0x7c')][_0x053c('0x9c')]||_0x553923[_0x053c('0x7c')]['x-real-ip']||_0x553923[_0x053c('0x103')][_0x053c('0x104')]||_0x553923['ip'],'referer':_0x553923[_0x053c('0x7c')][_0x053c('0x105')],'openedInteractions':_0x4b9699,'maxInteractions':_0x37106f,'virtual':_0x232d7f[_0x053c('0xfd')],'online':_0x59b670,'custom':_0x232d7f}))[_0x053c('0x106')](/'/g,'\x5c\x27')};_0x1a18d1[_0x053c('0x2d')](ejs[_0x053c('0xc2')](Mustache[_0x053c('0xc2')](_0x1b0a59,_0x1153b7),{'proactiveActions':_0xbf99eb,'alignment':_0x511f61[_0x053c('0x107')],'verticalAlignment':_0x511f61[_0x053c('0x108')],'div_color':_0x511f61[_0x053c('0xec')],'labelText':_0x511f61[_0x053c('0x109')],'text_color':_0x511f61[_0x053c('0x10a')],'text_button_color':_0x511f61[_0x053c('0x10b')],'button_color':_0x511f61['color_button'],'background_color':_0x511f61[_0x053c('0x10c')],'hideWhenOffline':_0x511f61['hideWhenOffline'],'interval':_0x511f61[_0x053c('0x10d')]}));})['catch'](handleError(_0x1a18d1,null));};exports['addApplications']=function(_0x2f479f,_0x5a66ae){var _0x167143=_0x2f479f['params']['id'];var _0x277c48=_0x2f479f[_0x053c('0x4f')];var _0x1b2b35=0xc8;var _0x5e4809=null;return db['sequelize'][_0x053c('0x10e')]({'isolationLevel':db[_0x053c('0xcd')][_0x053c('0x10f')][_0x053c('0x110')][_0x053c('0x111')]},function(_0xcdd2da){return db[_0x053c('0x31')]['findOne']({'where':{'id':_0x167143},'transaction':_0xcdd2da})[_0x053c('0x14')](function(_0x15cd52){if(_0x15cd52){return db[_0x053c('0x92')][_0x053c('0x27')]({'where':{'ChatWebsiteId':_0x167143},'transaction':_0xcdd2da})[_0x053c('0x14')](function(){var _0x5cb678=_['map'](_0x277c48,function(_0x200d5a){_0x200d5a['ChatWebsiteId']=_0x167143;return _0x200d5a;});return db[_0x053c('0x92')][_0x053c('0x112')](_0x5cb678,{'transaction':_0xcdd2da});});}else{_0x1b2b35=0x194;_0x5e4809=[];}});})['then'](function(){if(_0x1b2b35!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x167143},'order':_0x053c('0x113')})[_0x053c('0x14')](function(_0x1012b7){_0x5e4809=_0x1012b7;});}})['catch'](function(_0xfc639d){_0x1b2b35=0x1f4;logger[_0x053c('0x18')](_0xfc639d[_0x053c('0x2b')]);if(_0xfc639d['name']){delete _0xfc639d[_0x053c('0x2c')];}_0x5e4809=_0xfc639d;})[_0x053c('0x114')](function(){if(_0x5e4809===null){_0x5a66ae['sendStatus'](_0x1b2b35);}else{if(_0x1b2b35===0x1f4){_0x5a66ae[_0x053c('0x1d')](_0x1b2b35)[_0x053c('0x2d')](_0x5e4809);}else{_0x5a66ae['status'](_0x1b2b35)['json'](_0x5e4809);}}});};exports[_0x053c('0x115')]=function(_0x27d87b,_0x5a571c){var _0x312b95={};var _0x36e305={};var _0x49c555;var _0x2ea465;return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x27d87b[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x5a571c,null))[_0x053c('0x14')](function(_0x219c81){if(_0x219c81){_0x49c555=_0x219c81;_0x36e305[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0x92')]['rawAttributes']);_0x36e305[_0x053c('0x38')]=_['keys'](_0x27d87b[_0x053c('0x38')]);_0x36e305[_0x053c('0x43')]=_[_0x053c('0x3a')](_0x36e305[_0x053c('0x36')],_0x36e305[_0x053c('0x38')]);_0x312b95['attributes']=_['intersection'](_0x36e305[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x27d87b[_0x053c('0x38')]['fields']));_0x312b95[_0x053c('0x3b')]=_0x312b95[_0x053c('0x3b')]['length']?_0x312b95[_0x053c('0x3b')]:_0x36e305['model'];_0x312b95['order']=qs[_0x053c('0x41')](_0x27d87b[_0x053c('0x38')][_0x053c('0x41')]);_0x312b95[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x27d87b[_0x053c('0x38')],_0x36e305['filters']));if(_0x27d87b[_0x053c('0x38')][_0x053c('0x45')]){_0x312b95[_0x053c('0x42')]=_[_0x053c('0x46')](_0x312b95[_0x053c('0x42')],{'$or':_['map'](_0x312b95[_0x053c('0x3b')],function(_0x265026){var _0x4b9bbe={};_0x4b9bbe[_0x265026]={'$like':'%'+_0x27d87b['query'][_0x053c('0x45')]+'%'};return _0x4b9bbe;})});}_0x312b95=_[_0x053c('0x46')]({},_0x312b95,_0x27d87b[_0x053c('0x47')]);return _0x49c555['getApplications'](_0x312b95);}})[_0x053c('0x14')](function(_0x3e18d2){if(_0x3e18d2){_0x2ea465=_0x3e18d2['length'];if(!_0x27d87b[_0x053c('0x38')][_0x053c('0x3e')](_0x053c('0x3f'))){_0x312b95[_0x053c('0x22')]=qs['limit'](_0x27d87b[_0x053c('0x38')][_0x053c('0x22')]);_0x312b95[_0x053c('0x20')]=qs['offset'](_0x27d87b[_0x053c('0x38')]['offset']);}return _0x49c555[_0x053c('0x115')](_0x312b95);}})[_0x053c('0x14')](function(_0x3fe8a0){if(_0x3fe8a0){return _0x3fe8a0?{'count':_0x2ea465,'rows':_0x3fe8a0}:null;}})['then'](respondWithResult(_0x5a571c,null))[_0x053c('0x1b')](handleError(_0x5a571c,null));};exports['addProactiveActions']=function(_0x46174c,_0x1b2c84){return db[_0x053c('0x116')][_0x053c('0x4d')]({'where':{'id':_0x46174c[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x1b2c84,null))[_0x053c('0x14')](function(_0x115d1e){if(_0x115d1e){return _0x115d1e[_0x053c('0x117')](_0x46174c[_0x053c('0x4f')]['ids'],_[_0x053c('0xe4')](_0x46174c[_0x053c('0x4f')],['ids','id'])||{});}})[_0x053c('0x14')](respondWithResult(_0x1b2c84,null))[_0x053c('0x1b')](handleError(_0x1b2c84,null));};exports[_0x053c('0xfb')]=function(_0x1f7a54,_0x2e2f9f){var _0x19cf7e={};var _0x36fbde={};var _0x41e516;var _0x1b4cf2;return db[_0x053c('0x31')][_0x053c('0x60')]({'where':{'id':_0x1f7a54['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x2e2f9f,null))['then'](function(_0x23ff76){if(_0x23ff76){_0x41e516=_0x23ff76;_0x36fbde[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0x118')]['rawAttributes']);_0x36fbde[_0x053c('0x38')]=_['keys'](_0x1f7a54[_0x053c('0x38')]);_0x36fbde['filters']=_[_0x053c('0x3a')](_0x36fbde['model'],_0x36fbde[_0x053c('0x38')]);_0x19cf7e[_0x053c('0x3b')]=_['intersection'](_0x36fbde['model'],qs[_0x053c('0x3c')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x3c')]));_0x19cf7e[_0x053c('0x3b')]=_0x19cf7e[_0x053c('0x3b')]['length']?_0x19cf7e[_0x053c('0x3b')]:_0x36fbde[_0x053c('0x36')];_0x19cf7e['order']=qs[_0x053c('0x41')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x41')]);_0x19cf7e['where']=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x1f7a54[_0x053c('0x38')],_0x36fbde[_0x053c('0x43')]));if(_0x1f7a54[_0x053c('0x38')]['filter']){_0x19cf7e[_0x053c('0x42')]=_['merge'](_0x19cf7e['where'],{'$or':_[_0x053c('0x37')](_0x19cf7e[_0x053c('0x3b')],function(_0x1ea165){var _0x6532b7={};_0x6532b7[_0x1ea165]={'$like':'%'+_0x1f7a54[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x6532b7;})});}_0x19cf7e=_[_0x053c('0x46')]({},_0x19cf7e,_0x1f7a54[_0x053c('0x47')]);return _0x41e516[_0x053c('0xfb')](_0x19cf7e);}})[_0x053c('0x14')](function(_0x3e0da3){if(_0x3e0da3){_0x1b4cf2=_0x3e0da3[_0x053c('0x3d')];if(!_0x1f7a54['query']['hasOwnProperty']('nolimit')){_0x19cf7e[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x22')]);_0x19cf7e[_0x053c('0x20')]=qs[_0x053c('0x20')](_0x1f7a54[_0x053c('0x38')][_0x053c('0x20')]);}return _0x41e516[_0x053c('0xfb')](_0x19cf7e);}})[_0x053c('0x14')](function(_0x184c78){if(_0x184c78){return _0x184c78?{'count':_0x1b4cf2,'rows':_0x184c78}:null;}})['then'](respondWithResult(_0x2e2f9f,null))[_0x053c('0x1b')](handleError(_0x2e2f9f,null));};exports[_0x053c('0x119')]=function(_0x14473c,_0x1bb00e){var _0x15db53=_0x14473c[_0x053c('0x38')][_0x053c('0x11a')]===_0x053c('0x11b')?_0x053c('0x11c'):_0x053c('0x11d');return db[_0x053c('0x31')][_0x053c('0x4d')]({'attributes':['id',_0x15db53],'where':{'id':_0x14473c['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x1bb00e,null))[_0x053c('0x14')](function(_0x3f0b4e){if(_0x3f0b4e){var _0x5ab042=_0x3f0b4e[_0x15db53];var _0xff722e=_0x5ab042&&_0x5ab042[_0x053c('0x11e')]?_0x5ab042[_0x053c('0x11e')]:[];_0x1bb00e[_0x053c('0x2d')]({'fromKey':_['isNil'](_0x5ab042[_0x053c('0x11f')])?undefined:_0x5ab042['fromKey'],'count':_0xff722e['length'],'rows':_0xff722e});}})[_0x053c('0x1b')](handleError(_0x1bb00e,null));};exports['getOfflineMessages']=function(_0x4467a8,_0x57fd76){var _0x1d98fa={'raw':![],'where':{}};var _0x431bb7={};var _0xadae69={'count':0x0,'rows':[]};return db[_0x053c('0x31')]['findOne']({'where':{'id':_0x4467a8['params']['id']}})['then'](handleEntityNotFound(_0x57fd76,null))[_0x053c('0x14')](function(_0x417a3f){if(_0x417a3f){_0x431bb7[_0x053c('0x36')]=_[_0x053c('0x39')](db['ChatOfflineMessage']['rawAttributes']);_0x431bb7[_0x053c('0x38')]=_[_0x053c('0x39')](_0x4467a8[_0x053c('0x38')]);_0x431bb7['filters']=_[_0x053c('0x3a')](_0x431bb7['model'],_0x431bb7['query']);_0x1d98fa[_0x053c('0x3b')]=_[_0x053c('0x3a')](_0x431bb7[_0x053c('0x36')],qs[_0x053c('0x3c')](_0x4467a8[_0x053c('0x38')]['fields']));_0x1d98fa['attributes']=_0x1d98fa[_0x053c('0x3b')][_0x053c('0x3d')]?_0x1d98fa['attributes']:_0x431bb7[_0x053c('0x36')];if(!_0x4467a8['query'][_0x053c('0x3e')]('nolimit')){_0x1d98fa[_0x053c('0x22')]=qs['limit'](_0x4467a8['query'][_0x053c('0x22')]);_0x1d98fa['offset']=qs[_0x053c('0x20')](_0x4467a8['query'][_0x053c('0x20')]);}_0x1d98fa['order']=qs[_0x053c('0x41')](_0x4467a8[_0x053c('0x38')][_0x053c('0x41')]);_0x1d98fa[_0x053c('0x42')]=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x4467a8[_0x053c('0x38')],_0x431bb7[_0x053c('0x43')]));_0x1d98fa[_0x053c('0x42')][_0x053c('0x59')]=_0x417a3f['id'];if(_0x4467a8['query'][_0x053c('0x45')]){_0x1d98fa['where']=_['merge'](_0x1d98fa['where'],{'$or':_[_0x053c('0x37')](_0x1d98fa[_0x053c('0x3b')],function(_0x351b9d){var _0x1e589a={};_0x1e589a[_0x351b9d]={'$like':'%'+_0x4467a8[_0x053c('0x38')]['filter']+'%'};return _0x1e589a;})});}_0x1d98fa=_[_0x053c('0x46')]({},_0x1d98fa,_0x4467a8[_0x053c('0x47')]);return db[_0x053c('0xc5')][_0x053c('0x23')]({'where':_0x1d98fa[_0x053c('0x42')]})[_0x053c('0x14')](function(_0x3affb0){_0xadae69[_0x053c('0x23')]=_0x3affb0;if(_0x4467a8[_0x053c('0x38')][_0x053c('0x4c')]){_0x1d98fa[_0x053c('0x48')]=[{'all':!![]}];}else{_0x1d98fa[_0x053c('0x48')]=[{'model':db['CmContact'],'as':_0x053c('0xe6'),'required':![]},{'model':db[_0x053c('0xce')],'as':_0x053c('0x120'),'required':![]}];}return db['ChatOfflineMessage'][_0x053c('0x49')](_0x1d98fa);})[_0x053c('0x14')](function(_0x156c51){_0xadae69[_0x053c('0x4a')]=_0x156c51;return _0xadae69;});}})[_0x053c('0x14')](respondWithFilteredResult(_0x57fd76,_0x1d98fa))[_0x053c('0x1b')](handleError(_0x57fd76,null));};exports[_0x053c('0x121')]=function(_0x2ac09d,_0x4f231d){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0x2ac09d[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x4f231d,null))[_0x053c('0x14')](function(_0x232bda){if(_0x232bda){return _0x232bda[_0x053c('0x121')](_0x2ac09d[_0x053c('0x4f')][_0x053c('0x5c')],_['omit'](_0x2ac09d[_0x053c('0x4f')],[_0x053c('0x5c'),'id'])||{})[_0x053c('0x122')](function(_0x4619be){for(var _0x450657=0x0;_0x450657<_0x2ac09d['body'][_0x053c('0x5c')][_0x053c('0x3d')];_0x450657+=0x1){socket[_0x053c('0x123')](_0x053c('0x124'),{'UserId':Number(_0x2ac09d[_0x053c('0x4f')][_0x053c('0x5c')][_0x450657]),'ChatWebsiteId':Number(_0x2ac09d['params']['id'])});}return _0x4619be;});}})[_0x053c('0x14')](respondWithResult(_0x4f231d,null))['catch'](handleError(_0x4f231d,null));};exports['removeAgents']=function(_0xba05fb,_0x4a04ac){return db[_0x053c('0x31')][_0x053c('0x4d')]({'where':{'id':_0xba05fb['params']['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x4a04ac,null))[_0x053c('0x14')](function(_0x32c2f3){if(_0x32c2f3){return _0x32c2f3[_0x053c('0x125')](_0xba05fb['query'][_0x053c('0x5c')])[_0x053c('0x14')](function(){if(_[_0x053c('0x126')](_0xba05fb['query'][_0x053c('0x5c')])){for(var _0x242328=0x0;_0x242328<_0xba05fb[_0x053c('0x38')][_0x053c('0x5c')]['length'];_0x242328+=0x1){socket[_0x053c('0x123')](_0x053c('0x127'),{'UserId':Number(_0xba05fb[_0x053c('0x38')][_0x053c('0x5c')][_0x242328]),'ChatWebsiteId':Number(_0xba05fb[_0x053c('0x56')]['id'])});}}else{socket['emit'](_0x053c('0x127'),{'UserId':Number(_0xba05fb['query']['ids']),'ChatWebsiteId':Number(_0xba05fb[_0x053c('0x56')]['id'])});}});}})[_0x053c('0x14')](respondWithStatusCode(_0x4a04ac,null))['catch'](handleError(_0x4a04ac,null));};exports[_0x053c('0x128')]=function(_0x53f192,_0x4ce574){var _0x292cc2={};var _0x2092e0={};var _0x55fc43;var _0xbd08ad;return db['ChatWebsite'][_0x053c('0x60')]({'where':{'id':_0x53f192[_0x053c('0x56')]['id']}})[_0x053c('0x14')](handleEntityNotFound(_0x4ce574,null))[_0x053c('0x14')](function(_0x5cf81a){if(_0x5cf81a){_0x55fc43=_0x5cf81a;_0x2092e0[_0x053c('0x36')]=_[_0x053c('0x39')](db[_0x053c('0xe7')]['rawAttributes']);_0x2092e0[_0x053c('0x38')]=_[_0x053c('0x39')](_0x53f192[_0x053c('0x38')]);_0x2092e0[_0x053c('0x43')]=_[_0x053c('0x3a')](_0x2092e0[_0x053c('0x36')],_0x2092e0[_0x053c('0x38')]);_0x292cc2['attributes']=_['intersection'](_0x2092e0[_0x053c('0x36')],qs['fields'](_0x53f192[_0x053c('0x38')][_0x053c('0x3c')]));_0x292cc2[_0x053c('0x3b')]=_0x292cc2[_0x053c('0x3b')][_0x053c('0x3d')]?_0x292cc2[_0x053c('0x3b')]:_0x2092e0[_0x053c('0x36')];_0x292cc2['order']=qs[_0x053c('0x41')](_0x53f192[_0x053c('0x38')][_0x053c('0x41')]);_0x292cc2['where']=qs[_0x053c('0x43')](_[_0x053c('0x44')](_0x53f192[_0x053c('0x38')],_0x2092e0[_0x053c('0x43')]));if(_0x53f192[_0x053c('0x38')][_0x053c('0x45')]){_0x292cc2[_0x053c('0x42')]=_['merge'](_0x292cc2[_0x053c('0x42')],{'$or':_['map'](_0x292cc2[_0x053c('0x3b')],function(_0x29e90c){var _0x288d6c={};_0x288d6c[_0x29e90c]={'$like':'%'+_0x53f192[_0x053c('0x38')][_0x053c('0x45')]+'%'};return _0x288d6c;})});}_0x292cc2=_[_0x053c('0x46')]({},_0x292cc2,_0x53f192[_0x053c('0x47')]);return _0x55fc43[_0x053c('0x128')](_0x292cc2);}})[_0x053c('0x14')](function(_0x105071){if(_0x105071){_0xbd08ad=_0x105071[_0x053c('0x3d')];if(!_0x53f192['query']['hasOwnProperty'](_0x053c('0x3f'))){_0x292cc2[_0x053c('0x22')]=qs[_0x053c('0x22')](_0x53f192[_0x053c('0x38')][_0x053c('0x22')]);_0x292cc2['offset']=qs[_0x053c('0x20')](_0x53f192[_0x053c('0x38')][_0x053c('0x20')]);}return _0x55fc43[_0x053c('0x128')](_0x292cc2);}})[_0x053c('0x14')](function(_0x1a9522){if(_0x1a9522){return _0x1a9522?{'count':_0xbd08ad,'rows':_0x1a9522}:null;}})[_0x053c('0x14')](respondWithResult(_0x4ce574,null))['catch'](handleError(_0x4ce574,null));}; \ No newline at end of file +var _0x4936=['ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','autoclose','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','EventManager','offline','difference','mapKeyOffline','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','getSnippet','Interval','Intervals','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','color','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','omit','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','getAnswers','pick','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','getResult','chat','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x4936,0xa1));var _0x6493=function(_0x1126aa,_0x10ce67){_0x1126aa=_0x1126aa-0x0;var _0x1b34b4=_0x4936[_0x1126aa];return _0x1b34b4;};'use strict';var BPromise=require(_0x6493('0x0'));var Mustache=require(_0x6493('0x1'));var util=require('util');var path=require(_0x6493('0x2'));var ejs=require(_0x6493('0x3'));var fs=require('fs');var fs_extra=require(_0x6493('0x4'));var _=require(_0x6493('0x5'));var querystring=require(_0x6493('0x6'));var Redis=require(_0x6493('0x7'));var qs=require(_0x6493('0x8'));var logger=require(_0x6493('0x9'))(_0x6493('0xa'));var config=require(_0x6493('0xb'));var db=require(_0x6493('0xc'))['db'];config[_0x6493('0xd')]=_[_0x6493('0xe')](config[_0x6493('0xd')],{'host':_0x6493('0xf'),'port':0x18eb});var socket=require(_0x6493('0x10'))(new Redis(config[_0x6493('0xd')]));require(_0x6493('0x11'))['register'](socket);var htmlToText=require(_0x6493('0x12'));var jayson=require(_0x6493('0x13'));var client=jayson[_0x6493('0x14')]['http']({'port':0x232c});var client9002=jayson[_0x6493('0x14')][_0x6493('0x15')]({'port':0x232a});var client9003=jayson[_0x6493('0x14')]['http']({'port':0x232b});var client9001=jayson['client'][_0x6493('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x5c178b,_0x4bf481,_0x2df144,_0x25a8bd){return new BPromise(function(_0x2a6510,_0x464f83){var _0x4c97ad=_0x25a8bd||client;return _0x4c97ad[_0x6493('0x16')](_0x5c178b,_0x2df144)['then'](function(_0x35a127){logger[_0x6493('0x17')](_0x6493('0x18'),_0x4bf481,_0x6493('0x19'));logger[_0x6493('0x1a')](_0x6493('0x1b'),_0x4bf481,_0x6493('0x19'),JSON[_0x6493('0x1c')](_0x35a127));if(_0x35a127['error']){if(_0x35a127[_0x6493('0x1d')][_0x6493('0x1e')]===0x1f4){logger[_0x6493('0x1d')](_0x6493('0x18'),_0x4bf481,_0x35a127['error'][_0x6493('0x1f')]);return _0x464f83(_0x35a127['error'][_0x6493('0x1f')]);}logger[_0x6493('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x4bf481,_0x35a127[_0x6493('0x1d')]['message']);return _0x2a6510(_0x35a127[_0x6493('0x1d')]['message']);}else{logger[_0x6493('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x4bf481,_0x6493('0x19'));_0x2a6510(_0x35a127[_0x6493('0x20')]['message']);}})[_0x6493('0x21')](function(_0x1b590c){logger[_0x6493('0x1d')](_0x6493('0x18'),_0x4bf481,_0x1b590c);_0x464f83(_0x1b590c);});});}function respondWithStatusCode(_0x4d0359,_0x5a49e2){_0x5a49e2=_0x5a49e2||0xcc;return function(_0x599f2a){if(_0x599f2a){return _0x4d0359[_0x6493('0x22')](_0x5a49e2);}return _0x4d0359['status'](_0x5a49e2)[_0x6493('0x23')]();};}function respondWithResult(_0x21837d,_0x5f06fc){_0x5f06fc=_0x5f06fc||0xc8;return function(_0x59aabc){if(_0x59aabc){return _0x21837d[_0x6493('0x24')](_0x5f06fc)[_0x6493('0x25')](_0x59aabc);}};}function respondWithFilteredResult(_0x1fba96,_0x47a407){return function(_0x39a9ad){if(_0x39a9ad){var _0xb454da=typeof _0x47a407['offset']===_0x6493('0x26')&&typeof _0x47a407[_0x6493('0x27')]===_0x6493('0x26');var _0x5ee8de=_0x39a9ad[_0x6493('0x28')];var _0x429b4f=_0xb454da?0x0:_0x47a407[_0x6493('0x29')];var _0x19eb8e=_0xb454da?_0x39a9ad[_0x6493('0x28')]:_0x47a407[_0x6493('0x29')]+_0x47a407[_0x6493('0x27')];var _0x2c62db;if(_0x19eb8e>=_0x5ee8de){_0x19eb8e=_0x5ee8de;_0x2c62db=0xc8;}else{_0x2c62db=0xce;}_0x1fba96[_0x6493('0x24')](_0x2c62db);return _0x1fba96['set'](_0x6493('0x2a'),_0x429b4f+'-'+_0x19eb8e+'/'+_0x5ee8de)['json'](_0x39a9ad);}return null;};}function saveUpdates(_0x2278dc){return function(_0x29f7e6){if(_0x29f7e6){return _0x29f7e6[_0x6493('0x2b')](_0x2278dc)[_0x6493('0x2c')](function(_0x3b3545){return _0x3b3545;});}return null;};}function removeEntity(_0x346996){return function(_0x1c37fc){if(_0x1c37fc){return _0x1c37fc[_0x6493('0x2d')]()['then'](function(){var _0xa5e56d=_0x1c37fc['get']({'plain':!![]});var _0x2c46f7=_0x6493('0x2e');return db[_0x6493('0x2f')]['destroy']({'where':{'type':_0x2c46f7,'resourceId':_0xa5e56d['id']}})[_0x6493('0x2c')](function(){return _0x1c37fc;});})['then'](function(){_0x346996[_0x6493('0x24')](0xcc)[_0x6493('0x23')]();});}};}function handleEntityNotFound(_0x130309){return function(_0x13b8a8){if(!_0x13b8a8){_0x130309['sendStatus'](0x194);}return _0x13b8a8;};}function handleError(_0x589b60,_0x3f4012){_0x3f4012=_0x3f4012||0x1f4;return function(_0x21a055){logger['error'](_0x21a055[_0x6493('0x30')]);if(_0x21a055[_0x6493('0x31')]){delete _0x21a055[_0x6493('0x31')];}_0x589b60['status'](_0x3f4012)[_0x6493('0x32')](_0x21a055);};}exports[_0x6493('0x33')]=function(_0xc289df,_0x20958b){var _0x4df1d0={'include':[{'model':db[_0x6493('0x34')],'as':_0x6493('0x35')}]},_0x4f08d2={},_0x30cf7c={'count':0x0,'rows':[]};var _0x26afd5=_[_0x6493('0x36')](db[_0x6493('0x37')]['rawAttributes'],function(_0x410073){return{'name':_0x410073['fieldName'],'type':_0x410073['type'][_0x6493('0x38')]};});_0x4f08d2[_0x6493('0x39')]=_[_0x6493('0x36')](_0x26afd5,_0x6493('0x31'));_0x4f08d2[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0xc289df[_0x6493('0x3a')]);_0x4f08d2[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0x4f08d2[_0x6493('0x39')],_0x4f08d2[_0x6493('0x3a')]);_0x4df1d0[_0x6493('0x3e')]=_[_0x6493('0x3d')](_0x4f08d2[_0x6493('0x39')],qs[_0x6493('0x3f')](_0xc289df[_0x6493('0x3a')]['fields']));_0x4df1d0['attributes']=_0x4df1d0['attributes'][_0x6493('0x40')]?_0x4df1d0[_0x6493('0x3e')]:_0x4f08d2[_0x6493('0x39')];if(!_0xc289df[_0x6493('0x3a')][_0x6493('0x41')]('nolimit')){_0x4df1d0['limit']=qs[_0x6493('0x27')](_0xc289df[_0x6493('0x3a')]['limit']);_0x4df1d0[_0x6493('0x29')]=qs[_0x6493('0x29')](_0xc289df[_0x6493('0x3a')][_0x6493('0x29')]);}_0x4df1d0[_0x6493('0x42')]=qs[_0x6493('0x43')](_0xc289df[_0x6493('0x3a')][_0x6493('0x43')]);_0x4df1d0[_0x6493('0x44')]=qs['filters'](_['pick'](_0xc289df['query'],_0x4f08d2['filters']),_0x26afd5);if(_0xc289df[_0x6493('0x3a')][_0x6493('0x45')]){_0x4df1d0[_0x6493('0x44')]=_[_0x6493('0x46')](_0x4df1d0['where'],{'$or':_[_0x6493('0x36')](_0x26afd5,function(_0x48b970){if(_0x48b970[_0x6493('0x47')]!==_0x6493('0x48')){var _0x499e58={};_0x499e58[_0x48b970[_0x6493('0x31')]]={'$like':'%'+_0xc289df[_0x6493('0x3a')]['filter']+'%'};return _0x499e58;}})});}_0x4df1d0=_[_0x6493('0x46')]({},_0x4df1d0,_0xc289df[_0x6493('0x49')]);var _0x49c34d={'where':_0x4df1d0[_0x6493('0x44')]};return db[_0x6493('0x37')][_0x6493('0x28')](_0x49c34d)[_0x6493('0x2c')](function(_0x234d88){_0x30cf7c[_0x6493('0x28')]=_0x234d88;if(_0xc289df[_0x6493('0x3a')][_0x6493('0x4a')]){_0x4df1d0[_0x6493('0x4b')]=[{'all':!![]}];}return db[_0x6493('0x37')][_0x6493('0x4c')](_0x4df1d0);})['then'](function(_0x3cbdb4){_0x30cf7c[_0x6493('0x4d')]=_0x3cbdb4;return _0x30cf7c;})[_0x6493('0x2c')](respondWithFilteredResult(_0x20958b,_0x4df1d0))[_0x6493('0x21')](handleError(_0x20958b,null));};exports['show']=function(_0x3764cd,_0x4ed000){var _0x53108a={'raw':![],'where':{'id':_0x3764cd['params']['id']},'include':[{'model':db[_0x6493('0x34')],'as':'mandatoryDispositionPause'}]},_0x2d4a6c={};_0x2d4a6c[_0x6493('0x39')]=_[_0x6493('0x3b')](db[_0x6493('0x37')][_0x6493('0x4e')]);_0x2d4a6c[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x3764cd[_0x6493('0x3a')]);_0x2d4a6c[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0x2d4a6c[_0x6493('0x39')],_0x2d4a6c[_0x6493('0x3a')]);_0x53108a['attributes']=_[_0x6493('0x3d')](_0x2d4a6c[_0x6493('0x39')],qs[_0x6493('0x3f')](_0x3764cd[_0x6493('0x3a')][_0x6493('0x3f')]));_0x53108a['attributes']=_0x53108a[_0x6493('0x3e')][_0x6493('0x40')]?_0x53108a[_0x6493('0x3e')]:_0x2d4a6c[_0x6493('0x39')];if(_0x3764cd[_0x6493('0x3a')][_0x6493('0x4a')]){_0x53108a[_0x6493('0x4b')]=[{'all':!![]}];}_0x53108a=_[_0x6493('0x46')]({},_0x53108a,_0x3764cd['options']);return db[_0x6493('0x37')][_0x6493('0x4f')](_0x53108a)[_0x6493('0x2c')](handleEntityNotFound(_0x4ed000,null))[_0x6493('0x2c')](respondWithResult(_0x4ed000,null))[_0x6493('0x21')](handleError(_0x4ed000,null));};exports[_0x6493('0x50')]=function(_0x41299e,_0x2e9123){return db['ChatWebsite'][_0x6493('0x50')](_0x41299e[_0x6493('0x51')],{})[_0x6493('0x2c')](function(_0x308992){var _0x173c96=_0x41299e['user'][_0x6493('0x52')]({'plain':!![]});if(!_0x173c96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x173c96[_0x6493('0x53')]===_0x6493('0x54')){var _0xf53ff2=_0x308992[_0x6493('0x52')]({'plain':!![]});var _0x37947c=_0x6493('0x2e');return db[_0x6493('0x55')][_0x6493('0x4f')]({'where':{'name':_0x37947c,'userProfileId':_0x173c96[_0x6493('0x56')]},'raw':!![]})[_0x6493('0x2c')](function(_0x3d8c41){if(_0x3d8c41&&_0x3d8c41[_0x6493('0x57')]===0x0){return db[_0x6493('0x2f')]['create']({'name':_0xf53ff2[_0x6493('0x31')],'resourceId':_0xf53ff2['id'],'type':_0x3d8c41[_0x6493('0x31')],'sectionId':_0x3d8c41['id']},{})[_0x6493('0x2c')](function(){return _0x308992;});}else{return _0x308992;}})[_0x6493('0x21')](function(_0x215c2e){logger[_0x6493('0x1d')](_0x6493('0x58'),_0x215c2e);throw _0x215c2e;});}return _0x308992;})['then'](respondWithResult(_0x2e9123,0xc9))[_0x6493('0x21')](handleError(_0x2e9123,null));};exports[_0x6493('0x2b')]=function(_0xa0dd02,_0x282ebb){if(_0xa0dd02[_0x6493('0x51')]['id']){delete _0xa0dd02['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xa0dd02[_0x6493('0x59')]['id']},'include':[{'model':db[_0x6493('0x34')],'as':_0x6493('0x35')}]})['then'](handleEntityNotFound(_0x282ebb,null))['then'](saveUpdates(_0xa0dd02['body'],null))[_0x6493('0x2c')](respondWithResult(_0x282ebb,null))[_0x6493('0x21')](handleError(_0x282ebb,null));};exports[_0x6493('0x2d')]=function(_0x370c0e,_0x31a483){return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x370c0e[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x31a483,null))[_0x6493('0x2c')](removeEntity(_0x31a483,null))[_0x6493('0x21')](handleError(_0x31a483,null));};exports[_0x6493('0x5a')]=function(_0x17de4c,_0x2f27e5){return db['ChatWebsite'][_0x6493('0x5a')]()[_0x6493('0x2c')](respondWithResult(_0x2f27e5,null))[_0x6493('0x21')](handleError(_0x2f27e5,null));};exports['addDisposition']=function(_0x48ebb6,_0x578706){if(_0x48ebb6[_0x6493('0x51')]['id']){delete _0x48ebb6[_0x6493('0x51')]['id'];}return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x48ebb6[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x578706,null))[_0x6493('0x2c')](function(_0x16f5d3){if(_0x16f5d3){_0x48ebb6[_0x6493('0x51')][_0x6493('0x5b')]=_0x16f5d3['id'];return db[_0x6493('0x5c')][_0x6493('0x50')](_0x48ebb6[_0x6493('0x51')]);}})[_0x6493('0x2c')](respondWithResult(_0x578706,null))[_0x6493('0x21')](handleError(_0x578706,null));};exports[_0x6493('0x5d')]=function(_0x2d2ab5,_0x174512){var _0xb0bcb1={'raw':![],'where':{}};var _0x5877ef={};var _0x20f82a={'count':0x0,'rows':[]};return db[_0x6493('0x37')][_0x6493('0x5e')]({'where':{'id':_0x2d2ab5['params']['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x174512,null))[_0x6493('0x2c')](function(_0x50e548){if(_0x50e548){_0x5877ef['model']=_['keys'](db[_0x6493('0x5c')][_0x6493('0x4e')]);_0x5877ef[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x2d2ab5[_0x6493('0x3a')]);_0x5877ef['filters']=_['intersection'](_0x5877ef[_0x6493('0x39')],_0x5877ef[_0x6493('0x3a')]);_0xb0bcb1['attributes']=_[_0x6493('0x3d')](_0x5877ef[_0x6493('0x39')],qs['fields'](_0x2d2ab5[_0x6493('0x3a')][_0x6493('0x3f')]));_0xb0bcb1[_0x6493('0x3e')]=_0xb0bcb1[_0x6493('0x3e')][_0x6493('0x40')]?_0xb0bcb1['attributes']:_0x5877ef['model'];if(!_0x2d2ab5['query'][_0x6493('0x41')](_0x6493('0x5f'))){_0xb0bcb1[_0x6493('0x27')]=qs['limit'](_0x2d2ab5[_0x6493('0x3a')][_0x6493('0x27')]);_0xb0bcb1[_0x6493('0x29')]=qs[_0x6493('0x29')](_0x2d2ab5[_0x6493('0x3a')][_0x6493('0x29')]);}_0xb0bcb1[_0x6493('0x42')]=qs['sort'](_0x2d2ab5[_0x6493('0x3a')]['sort']);_0xb0bcb1[_0x6493('0x44')]=qs[_0x6493('0x3c')](_['pick'](_0x2d2ab5[_0x6493('0x3a')],_0x5877ef[_0x6493('0x3c')]));_0xb0bcb1['where']['ChatWebsiteId']=_0x50e548['id'];if(_0x2d2ab5[_0x6493('0x3a')][_0x6493('0x45')]){_0xb0bcb1[_0x6493('0x44')]=_[_0x6493('0x46')](_0xb0bcb1['where'],{'$or':_[_0x6493('0x36')](_0xb0bcb1[_0x6493('0x3e')],function(_0x2eef1a){var _0x5c2d57={};_0x5c2d57[_0x2eef1a]={'$like':'%'+_0x2d2ab5['query'][_0x6493('0x45')]+'%'};return _0x5c2d57;})});}_0xb0bcb1=_['merge']({},_0xb0bcb1,_0x2d2ab5['options']);return db['Disposition'][_0x6493('0x28')]({'where':_0xb0bcb1[_0x6493('0x44')]})['then'](function(_0xa51fe9){_0x20f82a['count']=_0xa51fe9;if(_0x2d2ab5[_0x6493('0x3a')][_0x6493('0x4a')]){_0xb0bcb1[_0x6493('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xb0bcb1);})[_0x6493('0x2c')](function(_0x1e1089){_0x20f82a[_0x6493('0x4d')]=_0x1e1089;return _0x20f82a;});}})[_0x6493('0x2c')](respondWithFilteredResult(_0x174512,_0xb0bcb1))['catch'](handleError(_0x174512,null));};exports[_0x6493('0x60')]=function(_0x4748e6,_0x19463f){return db['ChatWebsite']['find']({'where':{'id':_0x4748e6['params']['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x19463f,null))[_0x6493('0x2c')](function(_0x4f0147){if(_0x4f0147){return _0x4f0147[_0x6493('0x60')](_0x4748e6[_0x6493('0x3a')][_0x6493('0x61')]);}})[_0x6493('0x2c')](respondWithStatusCode(_0x19463f,null))[_0x6493('0x21')](handleError(_0x19463f,null));};exports['addAnswer']=function(_0x4648,_0x226ba0){if(_0x4648['body']['id']){delete _0x4648['body']['id'];}return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x4648[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x226ba0,null))[_0x6493('0x2c')](function(_0x5700dc){if(_0x5700dc){_0x4648[_0x6493('0x51')][_0x6493('0x5b')]=_0x5700dc['id'];return db['CannedAnswer'][_0x6493('0x50')](_0x4648[_0x6493('0x51')]);}})[_0x6493('0x2c')](respondWithResult(_0x226ba0,null))[_0x6493('0x21')](handleError(_0x226ba0,null));};exports[_0x6493('0x62')]=function(_0x430c22,_0x314c67){var _0x458473={'raw':![],'where':{}};var _0x4c4f85={};var _0x28f4ce={'count':0x0,'rows':[]};return db[_0x6493('0x37')]['findOne']({'where':{'id':_0x430c22[_0x6493('0x59')]['id']}})['then'](handleEntityNotFound(_0x314c67,null))[_0x6493('0x2c')](function(_0x232646){if(_0x232646){_0x4c4f85[_0x6493('0x39')]=_[_0x6493('0x3b')](db['CannedAnswer'][_0x6493('0x4e')]);_0x4c4f85['query']=_[_0x6493('0x3b')](_0x430c22[_0x6493('0x3a')]);_0x4c4f85[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0x4c4f85[_0x6493('0x39')],_0x4c4f85['query']);_0x458473[_0x6493('0x3e')]=_['intersection'](_0x4c4f85[_0x6493('0x39')],qs[_0x6493('0x3f')](_0x430c22[_0x6493('0x3a')][_0x6493('0x3f')]));_0x458473[_0x6493('0x3e')]=_0x458473[_0x6493('0x3e')][_0x6493('0x40')]?_0x458473['attributes']:_0x4c4f85[_0x6493('0x39')];if(!_0x430c22[_0x6493('0x3a')][_0x6493('0x41')](_0x6493('0x5f'))){_0x458473[_0x6493('0x27')]=qs[_0x6493('0x27')](_0x430c22[_0x6493('0x3a')][_0x6493('0x27')]);_0x458473['offset']=qs[_0x6493('0x29')](_0x430c22['query'][_0x6493('0x29')]);}_0x458473[_0x6493('0x42')]=qs[_0x6493('0x43')](_0x430c22['query'][_0x6493('0x43')]);_0x458473[_0x6493('0x44')]=qs[_0x6493('0x3c')](_[_0x6493('0x63')](_0x430c22['query'],_0x4c4f85[_0x6493('0x3c')]));_0x458473[_0x6493('0x44')][_0x6493('0x5b')]=_0x232646['id'];if(_0x430c22['query'][_0x6493('0x45')]){_0x458473[_0x6493('0x44')]=_['merge'](_0x458473[_0x6493('0x44')],{'$or':_[_0x6493('0x36')](_0x458473[_0x6493('0x3e')],function(_0x47adcb){var _0x1b3ba4={};_0x1b3ba4[_0x47adcb]={'$like':'%'+_0x430c22[_0x6493('0x3a')]['filter']+'%'};return _0x1b3ba4;})});}_0x458473=_[_0x6493('0x46')]({},_0x458473,_0x430c22[_0x6493('0x49')]);return db['CannedAnswer']['count']({'where':_0x458473[_0x6493('0x44')]})[_0x6493('0x2c')](function(_0x560eb4){_0x28f4ce[_0x6493('0x28')]=_0x560eb4;if(_0x430c22[_0x6493('0x3a')][_0x6493('0x4a')]){_0x458473['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x458473);})[_0x6493('0x2c')](function(_0x50ebad){_0x28f4ce[_0x6493('0x4d')]=_0x50ebad;return _0x28f4ce;});}})[_0x6493('0x2c')](respondWithFilteredResult(_0x314c67,_0x458473))[_0x6493('0x21')](handleError(_0x314c67,null));};exports[_0x6493('0x64')]=function(_0x1344d0,_0x2843fc){return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x1344d0[_0x6493('0x59')]['id']}})['then'](handleEntityNotFound(_0x2843fc,null))[_0x6493('0x2c')](function(_0x1c2f6c){if(_0x1c2f6c){return _0x1c2f6c['removeAnswers'](_0x1344d0['query'][_0x6493('0x61')]);}})['then'](respondWithStatusCode(_0x2843fc,null))['catch'](handleError(_0x2843fc,null));};exports[_0x6493('0x65')]=function(_0x1ae217,_0x3c2eef){_0x1ae217['body']['sitepic']=_0x1ae217['file'][_0x6493('0x66')];return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x1ae217['params']['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x3c2eef,null))[_0x6493('0x2c')](saveUpdates(_0x1ae217['body'],null))[_0x6493('0x2c')](respondWithResult(_0x3c2eef,null))['catch'](handleError(_0x3c2eef,null));};exports[_0x6493('0x67')]=function(_0xd7a1cf,_0xe30062){_0xd7a1cf['body'][_0x6493('0x68')]=_0xd7a1cf[_0x6493('0x69')][_0x6493('0x66')];return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0xd7a1cf[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0xe30062,null))[_0x6493('0x2c')](saveUpdates(_0xd7a1cf[_0x6493('0x51')],null))[_0x6493('0x2c')](respondWithResult(_0xe30062,null))[_0x6493('0x21')](handleError(_0xe30062,null));};exports[_0x6493('0x6a')]=function(_0x563742,_0x494100){_0x563742[_0x6493('0x51')][_0x6493('0x6b')]=_0x563742[_0x6493('0x69')][_0x6493('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x563742[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x494100,null))[_0x6493('0x2c')](saveUpdates(_0x563742[_0x6493('0x51')],null))[_0x6493('0x2c')](respondWithResult(_0x494100,null))[_0x6493('0x21')](handleError(_0x494100,null));};exports[_0x6493('0x6c')]=function(_0x5c4329,_0x1b0deb){_0x5c4329[_0x6493('0x51')]['systemAvatar']=_0x5c4329[_0x6493('0x69')][_0x6493('0x66')];return db[_0x6493('0x37')]['find']({'where':{'id':_0x5c4329[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x1b0deb,null))[_0x6493('0x2c')](saveUpdates(_0x5c4329[_0x6493('0x51')],null))['then'](respondWithResult(_0x1b0deb,null))[_0x6493('0x21')](handleError(_0x1b0deb,null));};exports[_0x6493('0x6d')]=function(_0x3478ab,_0x42f90b){var _0x521816=path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0x70'));var _0x1f1b9f={'where':{'id':_0x3478ab[_0x6493('0x59')]['id']},'attributes':['id',_0x6493('0x71')],'raw':!![]};var _0x42a62b=![];return require(_0x6493('0x72'))[_0x6493('0x73')]()['then'](function(_0x49a6bb){if(_0x49a6bb){_0x42a62b=_0x49a6bb[_0x6493('0x74')];}})[_0x6493('0x2c')](function(){return db[_0x6493('0x37')]['find'](_0x1f1b9f);})[_0x6493('0x2c')](handleEntityNotFound(_0x42f90b,null))[_0x6493('0x2c')](function(_0x3f93b7){if(_0x3f93b7){if(!_['isNil'](_0x3f93b7[_0x6493('0x71')])){if(fs[_0x6493('0x75')](path['join'](config[_0x6493('0x6f')],'server/files/images/logos/',_0x3f93b7[_0x6493('0x71')]))&&_0x42a62b){_0x521816=path[_0x6493('0x6e')](config[_0x6493('0x6f')],'server/files/images/logos/',_0x3f93b7[_0x6493('0x71')]);}}return _0x42f90b[_0x6493('0x76')](_0x521816);}})[_0x6493('0x21')](handleError(_0x42f90b,null));};exports[_0x6493('0x77')]=function(_0x13e7b8,_0x5ab3fa){var _0x9f87df=path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0x78'));var _0x1771df={'where':{'id':_0x13e7b8[_0x6493('0x59')]['id']},'attributes':['id',_0x6493('0x68')],'raw':!![]};return db['ChatWebsite'][_0x6493('0x4f')](_0x1771df)[_0x6493('0x2c')](handleEntityNotFound(_0x5ab3fa,null))[_0x6493('0x2c')](function(_0x5787a8){if(_0x5787a8){if(!_[_0x6493('0x79')](_0x5787a8[_0x6493('0x68')])){if(fs[_0x6493('0x75')](path['join'](config[_0x6493('0x6f')],'server/files/images/avatars/',_0x5787a8[_0x6493('0x68')]))){_0x9f87df=path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0x7a'),_0x5787a8[_0x6493('0x68')]);}}return _0x5ab3fa[_0x6493('0x76')](_0x9f87df);}})[_0x6493('0x21')](handleError(_0x5ab3fa,null));};exports[_0x6493('0x7b')]=function(_0x17352e,_0x15c1c){var _0x21e096=path['join'](config['root'],_0x6493('0x7c'));var _0x49f3cd={'where':{'id':_0x17352e['params']['id']},'attributes':['id',_0x6493('0x6b'),_0x6493('0x7d')],'raw':!![]};return db[_0x6493('0x37')][_0x6493('0x4f')](_0x49f3cd)[_0x6493('0x2c')](handleEntityNotFound(_0x15c1c,null))[_0x6493('0x2c')](function(_0x429888){if(_0x429888){if(!_[_0x6493('0x79')](_0x429888[_0x6493('0x6b')])){if(fs[_0x6493('0x75')](path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0x7a'),_0x429888[_0x6493('0x6b')]))&&_0x429888[_0x6493('0x7d')]){_0x21e096=path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0x7a'),_0x429888[_0x6493('0x6b')]);}}return _0x15c1c[_0x6493('0x76')](_0x21e096);}})['catch'](handleError(_0x15c1c,null));};exports[_0x6493('0x7e')]=function(_0x168274,_0x4600c6){var _0x429a20=path[_0x6493('0x6e')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x16829d={'where':{'id':_0x168274[_0x6493('0x59')]['id']},'attributes':['id',_0x6493('0x7f')],'raw':!![]};return db[_0x6493('0x37')][_0x6493('0x4f')](_0x16829d)[_0x6493('0x2c')](handleEntityNotFound(_0x4600c6,null))[_0x6493('0x2c')](function(_0x5a9fc3){if(_0x5a9fc3){if(!_[_0x6493('0x79')](_0x5a9fc3[_0x6493('0x7f')])){if(fs[_0x6493('0x75')](path['join'](config[_0x6493('0x6f')],_0x6493('0x7a'),_0x5a9fc3[_0x6493('0x7f')]))){_0x429a20=path[_0x6493('0x6e')](config[_0x6493('0x6f')],'server/files/images/avatars/',_0x5a9fc3['systemAvatar']);}}return _0x4600c6[_0x6493('0x76')](_0x429a20);}})['catch'](handleError(_0x4600c6,null));};exports[_0x6493('0x80')]=function(_0x24f30a,_0x13dd5b){var _0x8b05ca=require(_0x6493('0x81'));var _0x519353=new _0x8b05ca();var _0x4f559c=_0x519353[_0x6493('0x82')](_0x24f30a[_0x6493('0x83')]['user-agent'])[_0x6493('0x84')]();var _0x1e2f0e={'body':_0x24f30a['body'],'channel':_0x6493('0x85')};var _0x3e45e2=[];var _0x2f2b66=[];var _0x14171d={};var _0x4e6599=![];return db['CmContact'][_0x6493('0x5a')]()['then'](function(_0x29de77){if(!_0x29de77){throw new db['Sequelize'][(_0x6493('0x86'))](_0x6493('0x87'));}_0x3e45e2=_['difference'](_['keys'](_0x29de77),[_0x6493('0x88'),_0x6493('0x89')]);_0x2f2b66=_['difference'](_[_0x6493('0x3b')](_0x29de77),[_0x6493('0x88'),_0x6493('0x89'),_0x6493('0x8a'),_0x6493('0x8b')]);if(_0x24f30a[_0x6493('0x51')]['id']){delete _0x24f30a[_0x6493('0x51')]['id'];}if(_[_0x6493('0x79')](_0x24f30a[_0x6493('0x51')][_0x6493('0x8c')])){throw new db[(_0x6493('0x8d'))][(_0x6493('0x86'))](_0x6493('0x8e'));}if(_[_0x6493('0x79')](_0x24f30a[_0x6493('0x51')]['body'])||_0x24f30a['body'][_0x6493('0x51')]===''){throw new db[(_0x6493('0x8d'))][(_0x6493('0x86'))](_0x6493('0x8f'));}if(_[_0x6493('0x79')](_0x24f30a[_0x6493('0x51')]['mapKey'])){throw new db[(_0x6493('0x8d'))]['ValidationError'](_0x6493('0x90')+_0x2f2b66);}if(!_[_0x6493('0x91')](_0x2f2b66,_0x24f30a[_0x6493('0x51')][_0x6493('0x92')])){throw new db[(_0x6493('0x8d'))][(_0x6493('0x86'))](_0x6493('0x93')+_0x2f2b66);}_0x14171d[_0x24f30a[_0x6493('0x51')][_0x6493('0x92')]]=_0x24f30a[_0x6493('0x51')]['from'];})[_0x6493('0x2c')](function(){return db[_0x6493('0x37')]['find']({'where':{'id':_0x24f30a[_0x6493('0x59')]['id']},'include':[{'model':db[_0x6493('0x94')],'as':_0x6493('0x95'),'include':[{'model':db[_0x6493('0x96')],'as':_0x6493('0x97'),'where':_0x14171d,'limit':0x1,'order':[[_0x6493('0x89'),_0x6493('0x98')]]}]},{'model':db[_0x6493('0x99')],'as':_0x6493('0x9a')}]});})['then'](handleEntityNotFound(_0x13dd5b,null))['then'](function(_0x1e1da5){if(_0x1e1da5&&_0x1e1da5[_0x6493('0x95')]){_0x1e2f0e[_0x6493('0x9b')]=_0x1e1da5;_0x1e2f0e[_0x6493('0x9c')]=_0x1e1da5['Applications'];_0x1e2f0e[_0x6493('0x9d')]=_0x1e1da5[_0x6493('0x95')];_0x1e2f0e[_0x6493('0x9c')]=_['orderBy'](_0x1e2f0e[_0x6493('0x9c')],[_0x6493('0x9e')],[_0x6493('0x9f')]);if(_0x1e2f0e[_0x6493('0x9b')][_0x6493('0x9a')]){delete _0x1e2f0e[_0x6493('0x9b')][_0x6493('0x9a')];}if(_0x1e2f0e[_0x6493('0x9b')]['List']&&_0x1e2f0e[_0x6493('0x9b')][_0x6493('0x95')]['Contacts'][_0x6493('0x40')]){return _0x1e2f0e[_0x6493('0x9b')][_0x6493('0x95')][_0x6493('0x97')][0x0];}var _0x15ae70=_['defaults'](_0x24f30a[_0x6493('0x51')],{'firstName':_0x24f30a[_0x6493('0x51')][_0x6493('0x8c')],'ListId':_0x1e1da5[_0x6493('0x8b')]});_0x15ae70[_0x24f30a['body'][_0x6493('0x92')]]=_0x24f30a[_0x6493('0x51')][_0x6493('0x8c')];return db['CmContact'][_0x6493('0x50')](_0x15ae70,{'fields':_0x3e45e2,'raw':!![]});}})['then'](handleEntityNotFound(_0x13dd5b,null))[_0x6493('0x2c')](function(_0x2af234){_0x1e2f0e[_0x6493('0xa0')]=_0x2af234;var _0x339424=_0x24f30a[_0x6493('0x51')][_0x6493('0xa1')];if(_0x24f30a[_0x6493('0x83')][_0x6493('0xa2')]){_0x339424=_0x24f30a[_0x6493('0x83')][_0x6493('0xa2')];}else if(_0x24f30a[_0x6493('0x83')][_0x6493('0xa3')]){_0x339424=_['first'](_0x24f30a[_0x6493('0x83')]['x-forwarded-for'][_0x6493('0xa4')](','));}if(_0x2af234){var _0x583e77={'ContactId':_0x2af234['id'],'ChatWebsiteId':_0x24f30a[_0x6493('0x59')]['id'],'from':(_0x2af234[_0x6493('0xa5')]||'')+'\x20'+(_0x2af234[_0x6493('0xa6')]||''),'customerIp':_0x339424,'customerPort':_0x24f30a['headers'][_0x6493('0xa7')]?_0x24f30a[_0x6493('0x83')][_0x6493('0xa7')]:null,'referer':_0x24f30a[_0x6493('0x51')][_0x6493('0xa8')],'browserName':_0x4f559c[_0x6493('0xa9')][_0x6493('0x31')]&&_0x4f559c['browser'][_0x6493('0xaa')]?util[_0x6493('0xab')]('%s\x20%s',_0x4f559c[_0x6493('0xa9')][_0x6493('0x31')],_0x4f559c['browser']['version']):_0x6493('0xac'),'browserVersion':_0x4f559c['browser'][_0x6493('0xaa')]||_0x6493('0xac'),'osName':util['format'](_0x6493('0xad'),_0x4f559c['os'][_0x6493('0x31')],_0x4f559c['os'][_0x6493('0xaa')]),'osVersion':_0x4f559c['os'][_0x6493('0xaa')],'deviceModel':_0x4f559c['device'][_0x6493('0x39')]&&_0x4f559c[_0x6493('0xae')][_0x6493('0xaf')]?util['format'](_0x6493('0xb0'),_0x4f559c['device'][_0x6493('0x39')],_0x4f559c[_0x6493('0xae')][_0x6493('0xaf')],_0x4f559c[_0x6493('0xae')][_0x6493('0x47')]):null,'deviceVendor':_0x4f559c[_0x6493('0xae')][_0x6493('0xaf')],'deviceType':_0x4f559c[_0x6493('0xae')]['type'],'formData':JSON[_0x6493('0x1c')](_0x24f30a[_0x6493('0x51')])};var _0x3e9ec3={'ChatWebsiteId':_0x24f30a[_0x6493('0x59')]['id'],'closed':![]};if(_0x24f30a['body'][_0x6493('0xb1')]){_0x3e9ec3['threadId']=_0x24f30a['body'][_0x6493('0xb1')];return db[_0x6493('0xb2')][_0x6493('0x4f')]({'where':_0x3e9ec3})[_0x6493('0x2c')](function(_0x3b06b6){if(_0x3b06b6){return[_0x3b06b6,![]];}_0x583e77[_0x6493('0xb1')]=_0x24f30a[_0x6493('0x51')][_0x6493('0xb1')];_0x583e77[_0x6493('0xb3')]=_0x24f30a[_0x6493('0x51')][_0x6493('0xb3')];return db[_0x6493('0xb2')][_0x6493('0x50')](_0x583e77)['then'](function(_0x4a8e34){return[_0x4a8e34,!![]];});});}_0x3e9ec3[_0x6493('0xb4')]=_0x2af234['id'];if(_0x24f30a[_0x6493('0x51')][_0x6493('0xb5')]&&_0x24f30a[_0x6493('0x51')][_0x6493('0xb5')]['id']){_0x3e9ec3['id']=_0x24f30a[_0x6493('0x51')][_0x6493('0xb5')]['id'];return db[_0x6493('0xb2')][_0x6493('0x4f')]({'where':_0x3e9ec3})[_0x6493('0x2c')](function(_0x54e3a7){if(_0x54e3a7){return[_0x54e3a7,![]];}return db[_0x6493('0xb2')][_0x6493('0x50')](_0x583e77)[_0x6493('0x2c')](function(_0x440f20){return[_0x440f20,!![]];});});}return db[_0x6493('0xb2')][_0x6493('0x50')](_0x583e77)[_0x6493('0x2c')](function(_0x3bc7a9){return[_0x3bc7a9,!![]];});}})['spread'](function(_0x16549d,_0x5249cd){if(_0x16549d){_0x4e6599=_0x5249cd;if(!_0x5249cd){var _0x3f3a37={'from':(_0x1e2f0e[_0x6493('0xa0')][_0x6493('0xa5')]||'')+'\x20'+(_0x1e2f0e['contact'][_0x6493('0xa6')]||'')};if(_0x24f30a[_0x6493('0x51')]['threadId']&&_0x24f30a[_0x6493('0x51')]['messageId']&&_0x24f30a['body'][_0x6493('0xb1')]!=_0x24f30a[_0x6493('0x51')][_0x6493('0xb6')]){_0x3f3a37[_0x6493('0xb1')]=_0x24f30a['body']['messageId'];}return _0x16549d[_0x6493('0x2b')](_0x3f3a37);}else{return _0x16549d;}}})[_0x6493('0x2c')](function(_0x1ef8ca){_0x1e2f0e[_0x6493('0xb5')]=_0x1ef8ca[_0x6493('0x52')]({'plain':!![]});_0x1e2f0e[_0x6493('0xb5')]['created']=_0x4e6599;if(_0x1e2f0e[_0x6493('0xb5')]['created']){if(_0x1e2f0e[_0x6493('0x9b')][_0x6493('0xb7')]){_0x1e2f0e[_0x6493('0x9c')]['push']({'id':0x0,'priority':_0x1e2f0e['applications'][_0x6493('0x40')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x6493('0xb8')]['create']({'body':_0x24f30a[_0x6493('0x51')][_0x6493('0x51')],'ChatWebsiteId':_0x24f30a[_0x6493('0x59')]['id'],'ChatInteractionId':_0x1ef8ca['id'],'direction':'in','ContactId':_0x1e2f0e[_0x6493('0xa0')]['id'],'AttachmentId':_0x24f30a['body'][_0x6493('0xb9')]});})['then'](function(_0x469f5b){_0x1e2f0e[_0x6493('0x1f')]=_0x469f5b;if(_0x1e2f0e[_0x6493('0xb5')][_0x6493('0xba')]){return db[_0x6493('0xbb')][_0x6493('0x4f')]({'attributes':['id',_0x6493('0x31')],'where':{'id':_0x1e2f0e[_0x6493('0xb5')]['UserId']}})[_0x6493('0x2c')](function(_0x58bc00){if(_0x58bc00){_0x1e2f0e[_0x6493('0x9c')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6493('0xbc'),'appdata':_0x58bc00[_0x6493('0x31')]+','+(_0x1e2f0e['account'][_0x6493('0xbd')]||0xa),'interval':_0x6493('0xbe')});_0x1e2f0e[_0x6493('0xbf')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x1e2f0e);});}return respondWithRpcPromise('Start',_0x6493('0xc0'),_0x1e2f0e);})[_0x6493('0x2c')](function(_0x2354ae){respondWithRpcPromise(_0x6493('0xc1'),_0x6493('0xc1'),{'event':_0x6493('0x80'),'message':_0x2354ae},client9002);return _0x2354ae;})[_0x6493('0x2c')](respondWithResult(_0x13dd5b,null))[_0x6493('0x21')](handleError(_0x13dd5b,null));};exports[_0x6493('0xc2')]=function(_0x57d831,_0x49e6b9){var _0x1071b5,_0x2229ca,_0x4140de;var _0x2325b6=[];var _0xbc5379={};var _0xc87aa3=_0x57d831['files']||[];var _0x284c68=[];var _0x44bea7;return db[_0x6493('0x96')][_0x6493('0x5a')]()[_0x6493('0x2c')](function(_0xe8ddf3){if(!_0xe8ddf3){throw new db['Sequelize']['ValidationError'](_0x6493('0x87'));}_0x2325b6=_[_0x6493('0xc3')](_[_0x6493('0x3b')](_0xe8ddf3),['createdAt',_0x6493('0x89'),_0x6493('0x8a'),'ListId']);if(_0x57d831['body']['id']){delete _0x57d831['body']['id'];}if(_[_0x6493('0x79')](_0x57d831['body']['from'])){throw _0x49e6b9[_0x6493('0x24')](0x1f4)[_0x6493('0x32')](new db[(_0x6493('0x8d'))]['ValidationError'](_0x6493('0x8e')));}if(_[_0x6493('0x79')](_0x57d831['body']['body'])||_0x57d831[_0x6493('0x51')]['body']===''){throw _0x49e6b9['status'](0x1f4)['send'](new db[(_0x6493('0x8d'))][(_0x6493('0x86'))](_0x6493('0x8f')));}if(_[_0x6493('0x79')](_0x57d831['body']['mapKeyOffline'])){throw _0x49e6b9['status'](0x1f4)['send'](new db[(_0x6493('0x8d'))][(_0x6493('0x86'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2325b6));}if(!_[_0x6493('0x91')](_0x2325b6,_0x57d831[_0x6493('0x51')]['mapKeyOffline'])){throw _0x49e6b9[_0x6493('0x24')](0x1f4)[_0x6493('0x32')](new db[(_0x6493('0x8d'))][(_0x6493('0x86'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2325b6));}_0xbc5379[_0x57d831['body'][_0x6493('0xc4')]]=_0x57d831[_0x6493('0x51')][_0x6493('0x8c')];})[_0x6493('0x2c')](function(){return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x57d831[_0x6493('0x59')]['id']},'include':[{'model':db[_0x6493('0x94')],'as':_0x6493('0x95')},{'model':db[_0x6493('0xc5')],'as':_0x6493('0xc5')}]});})[_0x6493('0x2c')](handleEntityNotFound(_0x49e6b9,null))['then'](function(_0x46819e){if(_0x46819e&&_0x46819e['List']){_0x2229ca=_0x46819e;var _0x5dbffc=_['defaults'](_0x57d831['body'],{'firstName':_0x57d831[_0x6493('0x51')][_0x6493('0x8c')],'phone':_0x57d831[_0x6493('0x51')][_0x6493('0x8c')],'ListId':_0x46819e['ListId']});_0x5dbffc[_0x57d831['body'][_0x6493('0xc4')]]=_0x57d831[_0x6493('0x51')]['from'];return db[_0x6493('0x96')]['findOrCreate']({'where':_0xbc5379,'defaults':_0x5dbffc});}})['spread'](function(_0x5437a1){if(_0x5437a1){_0x4140de=_0x5437a1;var _0x183fd9=fs[_0x6493('0xc6')](path[_0x6493('0x6e')](config['root'],_0x6493('0xc7')),_0x6493('0xc8'));var _0x29df69=ejs['render'](_0x183fd9,{'body':_[_0x6493('0xc9')](_0x57d831['body'][_0x6493('0x51')]),'bodyTitle':_0x2229ca[_0x6493('0xca')]});return db[_0x6493('0xcb')]['create']({'body':_0x29df69,'plainBody':htmlToText[_0x6493('0xcc')](_0x29df69),'ContactId':_0x5437a1['id'],'ChatWebsiteId':_0x2229ca['id']});}})[_0x6493('0x2c')](function(_0x39fdc9){_0x44bea7=_0x39fdc9;if(_0xc87aa3[_0x6493('0x40')]){var _0x263679=_0xc87aa3[_0x6493('0x36')](function(_0x2f8fb8){return{'name':_0x2f8fb8[_0x6493('0xcd')],'basename':_0x2f8fb8[_0x6493('0x66')],'type':_0x2f8fb8[_0x6493('0xce')],'ChatOfflineMessageId':_0x39fdc9['id']};});_0x284c68=_0x263679[_0x6493('0x36')](_0x2e69f1=>{var _0x255907={'filename':_0x2e69f1[_0x6493('0x31')],'path':path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0xcf'),_0x6493('0xd0'),_0x6493('0xd1'),_0x6493('0xd2'),_0x2e69f1['basename'])};return _0x255907;});if(!_0x2229ca[_0x6493('0xd3')]){return db[_0x6493('0xd4')][_0x6493('0xd5')](function(_0x17d122){return db[_0x6493('0xd6')][_0x6493('0xd7')](_0x263679,{'transaction':_0x17d122});});}}})[_0x6493('0x2c')](function(){if(_0x44bea7){_0x1071b5=_0x44bea7;return db[_0x6493('0xc5')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x6493('0xd8')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6493('0xd9')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x53a46c){if(_0x53a46c&&_0x53a46c[_0x6493('0xda')]&&_0x2229ca['forwardOffline']&&_0x2229ca[_0x6493('0xdb')]){var _0x43aed3=_0x53a46c['getSmtpOptions']();return respondWithRpcPromise(_0x6493('0xdc'),_0x6493('0xdd'),{'account':_0x43aed3,'message':{'from':util['format'](_0x6493('0xde'),_0x53a46c[_0x6493('0x31')],_0x53a46c['email']||_0x53a46c[_0x6493('0xda')][_0x6493('0x54')]),'to':_0x2229ca[_0x6493('0xdb')],'subject':_0x2229ca[_0x6493('0xdf')],'html':_0x1071b5[_0x6493('0x51')],'attachments':_0x284c68}},client9003)[_0x6493('0x2c')](function(){return _0x1071b5;})[_0x6493('0x21')](function(_0x3e6827){logger[_0x6493('0x1d')](_0x3e6827);});}})['then'](function(){if(_0x2229ca&&_0x2229ca[_0x6493('0xd3')]&&_0x2229ca[_0x6493('0xe0')]){var _0x3de8ee=[];if(_0xc87aa3[_0x6493('0x40')]){_0x3de8ee=_0xc87aa3[_0x6493('0x36')](function(_0x50c62f){return{'name':_0x50c62f['originalname'],'basename':_0x50c62f['filename'],'type':_0x50c62f[_0x6493('0xce')],'ChatOfflineMessageId':_0x44bea7['id']};});}var _0x457564;if(!_[_0x6493('0x79')](_0x2229ca['subjectOffline'])){var _0x20c0e2=_[_0x6493('0x36')](_0x57d831[_0x6493('0x51')],function(_0x53c7fb){return _0x53c7fb;});var _0x5498f2=_[_0x6493('0xe1')](_0x20c0e2)[0x0];var _0x1217d2=_[_0x6493('0xe2')](_0x5498f2,function(_0x31d1e2){return _0x31d1e2;});_0x457564=_0x1217d2[0x1][_0x2229ca[_0x6493('0xe3')]];}var _0xc93379={'from':_0x4140de['email'],'firstName':_0x4140de['firstName'],'lastName':_0x4140de[_0x6493('0xa6')],'mapKey':_0x6493('0xe4'),'message':{'from':_0x4140de[_0x6493('0xe4')],'to':_0x2229ca[_0x6493('0xc5')][_0x6493('0xe4')],'cc':'','subject':_[_0x6493('0x79')](_0x457564)?_0x2229ca[_0x6493('0xdf')]:_0x457564,'messageId':'','sentAt':new Date(),'attach':_0x3de8ee[_0x6493('0x40')],'attachments':_0x3de8ee,'originChannel':'Chat','ChatWebsiteId':_0x2229ca['id'],'ChatOfflineMessageId':_0x1071b5['id'],'originTo':_0x2229ca[_0x6493('0xc5')][_0x6493('0xe4')]},'body':_0x1071b5[_0x6493('0x51')]};var _0x48f262={'account':{'id':_0x2229ca[_0x6493('0xe0')]},'body':_0xc93379,'log':_0x6493('0xe5')};return respondWithRpcPromise('NotifyMailAccount',_0x6493('0xe6'),_0x48f262,client9001)[_0x6493('0x2c')](function(){return _0x1071b5;})[_0x6493('0x21')](function(_0x5cd407){logger['error'](_0x5cd407);});}return;})[_0x6493('0x2c')](function(){if(_0x1071b5){return _0x1071b5;}})[_0x6493('0x2c')](respondWithResult(_0x49e6b9,null))[_0x6493('0x21')](function(_0xbac33a){logger['error'](_0x6493('0x21'),_0xbac33a);for(var _0x27079b of _0xc87aa3){var _0x3c2d3c=path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0xcf'),_0x6493('0xd0'),_0x6493('0xd1'),_0x6493('0xd2'),_0x27079b[_0x6493('0x66')]);fs_extra[_0x6493('0xe7')](_0x3c2d3c)['catch'](function(_0x3930aa){logger[_0x6493('0x1d')](_0x6493('0xe8'),_0x3c2d3c,_0x3930aa);});}});};exports[_0x6493('0xe9')]=function(_0x2bd683,_0x3632c){return db[_0x6493('0xb2')][_0x6493('0x4f')]({'where':{'id':_0x2bd683[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x3632c,null))[_0x6493('0x2c')](function(_0x1e7c42){if(_0x1e7c42){return _0x1e7c42[_0x6493('0xe9')](_0x2bd683[_0x6493('0x51')]['ids'],_['omit'](_0x2bd683[_0x6493('0x51')],[_0x6493('0x61'),'id'])||{});}})['then'](respondWithResult(_0x3632c,null))[_0x6493('0x21')](handleError(_0x3632c,null));};exports[_0x6493('0xea')]=function(_0x3cc0e7,_0x4d65d4){var _0x29600f={'raw':![],'where':{}};var _0x12be4a={};var _0x5bad5e={'count':0x0,'rows':[]};return db[_0x6493('0x37')][_0x6493('0x5e')]({'where':{'id':_0x3cc0e7[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x4d65d4,null))[_0x6493('0x2c')](function(_0x3732a7){if(_0x3732a7){_0x12be4a[_0x6493('0x39')]=_[_0x6493('0x3b')](db[_0x6493('0xb2')][_0x6493('0x4e')]);_0x12be4a[_0x6493('0x3a')]=_['keys'](_0x3cc0e7[_0x6493('0x3a')]);_0x12be4a['filters']=_[_0x6493('0x3d')](_0x12be4a[_0x6493('0x39')],_0x12be4a[_0x6493('0x3a')]);_0x29600f[_0x6493('0x3e')]=_[_0x6493('0x3d')](_0x12be4a['model'],qs[_0x6493('0x3f')](_0x3cc0e7['query']['fields']));_0x29600f[_0x6493('0x3e')]=_0x29600f[_0x6493('0x3e')][_0x6493('0x40')]?_0x29600f[_0x6493('0x3e')]:_0x12be4a[_0x6493('0x39')];if(!_0x3cc0e7['query'][_0x6493('0x41')](_0x6493('0x5f'))){_0x29600f['limit']=qs[_0x6493('0x27')](_0x3cc0e7[_0x6493('0x3a')][_0x6493('0x27')]);_0x29600f[_0x6493('0x29')]=qs[_0x6493('0x29')](_0x3cc0e7[_0x6493('0x3a')]['offset']);}_0x29600f[_0x6493('0x42')]=qs[_0x6493('0x43')](_0x3cc0e7[_0x6493('0x3a')][_0x6493('0x43')]);_0x29600f[_0x6493('0x44')]=qs['filters'](_['pick'](_0x3cc0e7[_0x6493('0x3a')],_0x12be4a[_0x6493('0x3c')]));_0x29600f[_0x6493('0x44')][_0x6493('0x5b')]=_0x3732a7['id'];if(_0x3cc0e7[_0x6493('0x3a')]['filter']){_0x29600f[_0x6493('0x44')]=_[_0x6493('0x46')](_0x29600f[_0x6493('0x44')],{'$or':_['map'](_0x29600f[_0x6493('0x3e')],function(_0x5858a3){var _0x50a799={};_0x50a799[_0x5858a3]={'$like':'%'+_0x3cc0e7[_0x6493('0x3a')][_0x6493('0x45')]+'%'};return _0x50a799;})});}_0x29600f=_[_0x6493('0x46')]({},_0x29600f,_0x3cc0e7[_0x6493('0x49')]);return db[_0x6493('0xb2')]['count']({'where':_0x29600f['where']})[_0x6493('0x2c')](function(_0x2ca5da){_0x5bad5e['count']=_0x2ca5da;if(_0x3cc0e7[_0x6493('0x3a')]['includeAll']){_0x29600f[_0x6493('0x4b')]=[{'model':db[_0x6493('0x96')],'as':_0x6493('0xeb'),'required':![]},{'model':db[_0x6493('0xbb')],'as':_0x6493('0xec'),'attributes':[_0x6493('0x31'),_0x6493('0xed'),_0x6493('0xee')],'required':![]},{'model':db[_0x6493('0xef')],'as':_0x6493('0xf0'),'attributes':['id',_0x6493('0x31'),'color'],'where':_0x3cc0e7['query'][_0x6493('0xf1')]?{'id':_0x3cc0e7['query']['tag']}:undefined,'required':_0x3cc0e7[_0x6493('0x3a')][_0x6493('0xf1')]?!![]:![]}];}return db[_0x6493('0xb2')][_0x6493('0x4c')](_0x29600f);})[_0x6493('0x2c')](function(_0x53cf5e){_0x5bad5e[_0x6493('0x4d')]=_0x53cf5e;return _0x5bad5e;});}})[_0x6493('0x2c')](respondWithFilteredResult(_0x4d65d4,_0x29600f))[_0x6493('0x21')](handleError(_0x4d65d4,null));};function iftimePromise(_0x27f8fa,_0x2eff83){return respondWithRpcPromise(_0x6493('0xf2'),'getSnippet',{'command':_0x2eff83[_0x6493('0xf3')]?util[_0x6493('0xab')]('iftime\x20%s,%s',_0x27f8fa[_0x6493('0xf4')],_0x2eff83[_0x6493('0xf3')]):util['format'](_0x6493('0xf5'),_0x27f8fa[_0x6493('0xf4')])},client9002)[_0x6493('0x2c')](function(_0x577a40){var _0x35ee81=_0x577a40&&_0x577a40['indexOf'](_0x6493('0xf6'))>=0x0?!![]:![];logger[_0x6493('0x17')](_0x6493('0xf7'),_0x2eff83['id'],_0x27f8fa['id'],_0x27f8fa[_0x6493('0xf4')],_0x35ee81?'ONLINE':'OFFLINE',_0x2eff83[_0x6493('0xf3')]?_0x2eff83[_0x6493('0xf3')]:_0x6493('0xf8'));return _0x35ee81;})[_0x6493('0x21')](function(_0x4debe1){logger[_0x6493('0x1d')](_0x6493('0xf7'),_0x2eff83['id'],_0x27f8fa['id'],_0x27f8fa[_0x6493('0xf4')],util['inspect'](_0x4debe1,{'showHidden':![],'depth':null}),_0x2eff83[_0x6493('0xf3')]?_0x2eff83['timezone']:_0x6493('0xf8'));return![];});}exports[_0x6493('0xf9')]=function(_0x1c8b44,_0xbfce57){var _0x32373a=0x0;var _0x3a5fcd=0x0;var _0x52f2a2=![];var _0x576861;var _0x1f46dc;return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x1c8b44[_0x6493('0x59')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x6493('0xfa')],'as':_0x6493('0xfb'),'attributes':['id',_0x6493('0xf4')],'raw':!![]}]}]})[_0x6493('0x2c')](handleEntityNotFound(_0xbfce57,null))['then'](function(_0x212b2c){if(_0x212b2c){_0x576861=_0x212b2c;return _0x212b2c['getProactiveActions']({'raw':!![]});}})[_0x6493('0x2c')](function(_0x465110){if(_0x576861){if(_0x465110){_0x1f46dc=_0x465110;}}return require(_0x6493('0x72'))[_0x6493('0x73')]();})[_0x6493('0x2c')](function(_0x5238cd){if(_0x5238cd){_0x3a5fcd=_0x5238cd['virtual'];_0x52f2a2=_0x5238cd[_0x6493('0x74')];}})['then'](function(){return db[_0x6493('0xb2')]['count']({'where':{'closed':![]}});})[_0x6493('0x2c')](function(_0xfdf6eb){_0x32373a=_0xfdf6eb;if(_0x3a5fcd&&_0xfdf6eb>_0x3a5fcd){return db[_0x6493('0xfc')]['findOne']({'where':{'id':0x1}})['then'](function(_0x48384a){if(_0x48384a){_0x48384a[_0x6493('0xfd')](_0x6493('0xfe'));}});}})[_0x6493('0x2c')](function(){if(_0x576861[_0x6493('0xfa')]&&_0x576861[_0x6493('0xfa')][_0x6493('0xfb')]){var _0x251830=[];for(var _0x17fcae=0x0;_0x17fcae<_0x576861[_0x6493('0xfa')][_0x6493('0xfb')][_0x6493('0x40')];_0x17fcae++){var _0x377d60=_0x576861[_0x6493('0xfa')][_0x6493('0xfb')][_0x17fcae]['get']({'plain':!![]});_0x251830[_0x6493('0xff')](iftimePromise(_0x377d60,_0x576861));}return BPromise[_0x6493('0x100')](_0x251830)['then'](function(_0x186be4){return _[_0x6493('0x101')](_0x186be4);});}else{return!![];}})[_0x6493('0x2c')](function(_0x6db96d){var _0x1db89a=fs[_0x6493('0xc6')](path[_0x6493('0x6e')](config[_0x6493('0x6f')],_0x6493('0x102')),_0x6493('0xc8'));var _0x3cb884={'remote':_0x576861[_0x6493('0x103')],'query':querystring['stringify'](_['merge'](_0x576861[_0x6493('0x52')]({'plain':!![]}),{'customerIp':_0x1c8b44['headers'][_0x6493('0xa3')]||_0x1c8b44[_0x6493('0x83')][_0x6493('0x104')]||_0x1c8b44[_0x6493('0x105')][_0x6493('0x106')]||_0x1c8b44['ip'],'referer':_0x1c8b44['headers'][_0x6493('0xa8')],'openedInteractions':_0x32373a,'maxInteractions':_0x3a5fcd,'virtual':_0x52f2a2['virtual'],'online':_0x6db96d,'custom':_0x52f2a2}))[_0x6493('0x107')](/'/g,'\x5c\x27')};_0xbfce57[_0x6493('0x32')](ejs[_0x6493('0x108')](Mustache['render'](_0x1db89a,_0x3cb884),{'proactiveActions':_0x1f46dc,'alignment':_0x576861[_0x6493('0x109')],'verticalAlignment':_0x576861[_0x6493('0x10a')],'div_color':_0x576861[_0x6493('0x10b')],'labelText':_0x576861['labelText'],'text_color':_0x576861[_0x6493('0x10c')],'text_button_color':_0x576861[_0x6493('0x10d')],'button_color':_0x576861['color_button'],'background_color':_0x576861[_0x6493('0x10e')],'hideWhenOffline':_0x576861[_0x6493('0x10f')],'interval':_0x576861[_0x6493('0x110')]}));})[_0x6493('0x21')](handleError(_0xbfce57,null));};exports[_0x6493('0x111')]=function(_0x38c6e6,_0xd291f0){var _0x4a75a6=_0x38c6e6[_0x6493('0x59')]['id'];var _0x2c6d32=_0x38c6e6['body'];var _0x4b488f=0xc8;var _0x338a6b=null;return db['sequelize'][_0x6493('0xd5')]({'isolationLevel':db[_0x6493('0xd4')][_0x6493('0x112')][_0x6493('0x113')][_0x6493('0x114')]},function(_0x62ad3b){return db[_0x6493('0x37')]['findOne']({'where':{'id':_0x4a75a6},'transaction':_0x62ad3b})['then'](function(_0x418bd7){if(_0x418bd7){return db[_0x6493('0x99')]['destroy']({'where':{'ChatWebsiteId':_0x4a75a6},'transaction':_0x62ad3b})[_0x6493('0x2c')](function(){var _0x51161c=_[_0x6493('0x36')](_0x2c6d32,function(_0x57db69){_0x57db69[_0x6493('0x5b')]=_0x4a75a6;return _0x57db69;});return db['ChatApplication']['bulkCreate'](_0x51161c,{'transaction':_0x62ad3b});});}else{_0x4b488f=0x194;_0x338a6b=[];}});})[_0x6493('0x2c')](function(){if(_0x4b488f!==0x194){return db['ChatApplication'][_0x6493('0x115')]({'where':{'ChatWebsiteId':_0x4a75a6},'order':'priority'})['then'](function(_0xd39e63){_0x338a6b=_0xd39e63;});}})[_0x6493('0x21')](function(_0x4c4f54){_0x4b488f=0x1f4;logger[_0x6493('0x1d')](_0x4c4f54[_0x6493('0x30')]);if(_0x4c4f54[_0x6493('0x31')]){delete _0x4c4f54[_0x6493('0x31')];}_0x338a6b=_0x4c4f54;})['finally'](function(){if(_0x338a6b===null){_0xd291f0[_0x6493('0x22')](_0x4b488f);}else{if(_0x4b488f===0x1f4){_0xd291f0[_0x6493('0x24')](_0x4b488f)[_0x6493('0x32')](_0x338a6b);}else{_0xd291f0[_0x6493('0x24')](_0x4b488f)[_0x6493('0x25')](_0x338a6b);}}});};exports[_0x6493('0x116')]=function(_0x1b2194,_0x117dee){var _0x1268e6={};var _0x10520f={};var _0x6d2ddd;var _0x38af51;return db[_0x6493('0x37')][_0x6493('0x5e')]({'where':{'id':_0x1b2194[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x117dee,null))[_0x6493('0x2c')](function(_0x48cb53){if(_0x48cb53){_0x6d2ddd=_0x48cb53;_0x10520f['model']=_[_0x6493('0x3b')](db[_0x6493('0x99')]['rawAttributes']);_0x10520f['query']=_[_0x6493('0x3b')](_0x1b2194[_0x6493('0x3a')]);_0x10520f[_0x6493('0x3c')]=_['intersection'](_0x10520f[_0x6493('0x39')],_0x10520f[_0x6493('0x3a')]);_0x1268e6[_0x6493('0x3e')]=_[_0x6493('0x3d')](_0x10520f[_0x6493('0x39')],qs['fields'](_0x1b2194[_0x6493('0x3a')][_0x6493('0x3f')]));_0x1268e6[_0x6493('0x3e')]=_0x1268e6['attributes'][_0x6493('0x40')]?_0x1268e6[_0x6493('0x3e')]:_0x10520f[_0x6493('0x39')];_0x1268e6[_0x6493('0x42')]=qs['sort'](_0x1b2194[_0x6493('0x3a')][_0x6493('0x43')]);_0x1268e6[_0x6493('0x44')]=qs['filters'](_[_0x6493('0x63')](_0x1b2194['query'],_0x10520f[_0x6493('0x3c')]));if(_0x1b2194['query'][_0x6493('0x45')]){_0x1268e6['where']=_[_0x6493('0x46')](_0x1268e6[_0x6493('0x44')],{'$or':_[_0x6493('0x36')](_0x1268e6[_0x6493('0x3e')],function(_0x199995){var _0x308b65={};_0x308b65[_0x199995]={'$like':'%'+_0x1b2194[_0x6493('0x3a')]['filter']+'%'};return _0x308b65;})});}_0x1268e6=_['merge']({},_0x1268e6,_0x1b2194[_0x6493('0x49')]);return _0x6d2ddd['getApplications'](_0x1268e6);}})[_0x6493('0x2c')](function(_0x267a11){if(_0x267a11){_0x38af51=_0x267a11[_0x6493('0x40')];if(!_0x1b2194[_0x6493('0x3a')][_0x6493('0x41')]('nolimit')){_0x1268e6[_0x6493('0x27')]=qs[_0x6493('0x27')](_0x1b2194['query']['limit']);_0x1268e6['offset']=qs[_0x6493('0x29')](_0x1b2194[_0x6493('0x3a')][_0x6493('0x29')]);}return _0x6d2ddd['getApplications'](_0x1268e6);}})[_0x6493('0x2c')](function(_0x41c7f2){if(_0x41c7f2){return _0x41c7f2?{'count':_0x38af51,'rows':_0x41c7f2}:null;}})[_0x6493('0x2c')](respondWithResult(_0x117dee,null))[_0x6493('0x21')](handleError(_0x117dee,null));};exports[_0x6493('0x117')]=function(_0x541abd,_0x4a3363){return db[_0x6493('0x118')][_0x6493('0x4f')]({'where':{'id':_0x541abd[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x4a3363,null))[_0x6493('0x2c')](function(_0xc85fbe){if(_0xc85fbe){return _0xc85fbe[_0x6493('0x117')](_0x541abd[_0x6493('0x51')][_0x6493('0x61')],_['omit'](_0x541abd['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4a3363,null))[_0x6493('0x21')](handleError(_0x4a3363,null));};exports[_0x6493('0x119')]=function(_0x52ae80,_0x317d67){var _0x5e4b8e={};var _0x2378f9={};var _0x1a9cac;var _0x57a743;return db[_0x6493('0x37')][_0x6493('0x5e')]({'where':{'id':_0x52ae80[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x317d67,null))[_0x6493('0x2c')](function(_0x8ddcaa){if(_0x8ddcaa){_0x1a9cac=_0x8ddcaa;_0x2378f9['model']=_[_0x6493('0x3b')](db['ChatProactiveAction'][_0x6493('0x4e')]);_0x2378f9['query']=_['keys'](_0x52ae80[_0x6493('0x3a')]);_0x2378f9[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0x2378f9[_0x6493('0x39')],_0x2378f9[_0x6493('0x3a')]);_0x5e4b8e[_0x6493('0x3e')]=_[_0x6493('0x3d')](_0x2378f9[_0x6493('0x39')],qs[_0x6493('0x3f')](_0x52ae80[_0x6493('0x3a')]['fields']));_0x5e4b8e['attributes']=_0x5e4b8e['attributes'][_0x6493('0x40')]?_0x5e4b8e['attributes']:_0x2378f9[_0x6493('0x39')];_0x5e4b8e[_0x6493('0x42')]=qs['sort'](_0x52ae80[_0x6493('0x3a')][_0x6493('0x43')]);_0x5e4b8e['where']=qs[_0x6493('0x3c')](_[_0x6493('0x63')](_0x52ae80[_0x6493('0x3a')],_0x2378f9[_0x6493('0x3c')]));if(_0x52ae80['query'][_0x6493('0x45')]){_0x5e4b8e[_0x6493('0x44')]=_[_0x6493('0x46')](_0x5e4b8e['where'],{'$or':_[_0x6493('0x36')](_0x5e4b8e[_0x6493('0x3e')],function(_0x28c628){var _0x21dc46={};_0x21dc46[_0x28c628]={'$like':'%'+_0x52ae80[_0x6493('0x3a')][_0x6493('0x45')]+'%'};return _0x21dc46;})});}_0x5e4b8e=_['merge']({},_0x5e4b8e,_0x52ae80[_0x6493('0x49')]);return _0x1a9cac[_0x6493('0x119')](_0x5e4b8e);}})[_0x6493('0x2c')](function(_0x3bd691){if(_0x3bd691){_0x57a743=_0x3bd691['length'];if(!_0x52ae80['query'][_0x6493('0x41')](_0x6493('0x5f'))){_0x5e4b8e['limit']=qs[_0x6493('0x27')](_0x52ae80[_0x6493('0x3a')][_0x6493('0x27')]);_0x5e4b8e[_0x6493('0x29')]=qs['offset'](_0x52ae80[_0x6493('0x3a')]['offset']);}return _0x1a9cac[_0x6493('0x119')](_0x5e4b8e);}})[_0x6493('0x2c')](function(_0x258c82){if(_0x258c82){return _0x258c82?{'count':_0x57a743,'rows':_0x258c82}:null;}})[_0x6493('0x2c')](respondWithResult(_0x317d67,null))[_0x6493('0x21')](handleError(_0x317d67,null));};exports[_0x6493('0x11a')]=function(_0x47ce,_0x206e49){var _0x495698=_0x47ce[_0x6493('0x3a')][_0x6493('0x11b')]===_0x6493('0x11c')?_0x6493('0x11d'):_0x6493('0x11e');return db[_0x6493('0x37')][_0x6493('0x4f')]({'attributes':['id',_0x495698],'where':{'id':_0x47ce[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x206e49,null))[_0x6493('0x2c')](function(_0x306927){if(_0x306927){var _0xd27b8=_0x306927[_0x495698];var _0x341397=_0xd27b8&&_0xd27b8[_0x6493('0x11f')]?_0xd27b8[_0x6493('0x11f')]:[];_0x206e49['send']({'fromKey':_[_0x6493('0x79')](_0xd27b8[_0x6493('0x120')])?undefined:_0xd27b8[_0x6493('0x120')],'count':_0x341397['length'],'rows':_0x341397});}})[_0x6493('0x21')](handleError(_0x206e49,null));};exports[_0x6493('0x121')]=function(_0x2bb659,_0x23bbee){var _0x2cf7cb={'raw':![],'where':{}};var _0x6b53f9={};var _0x2c2c5c={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2bb659[_0x6493('0x59')]['id']}})['then'](handleEntityNotFound(_0x23bbee,null))[_0x6493('0x2c')](function(_0x1d95a9){if(_0x1d95a9){_0x6b53f9[_0x6493('0x39')]=_['keys'](db[_0x6493('0xcb')]['rawAttributes']);_0x6b53f9['query']=_[_0x6493('0x3b')](_0x2bb659[_0x6493('0x3a')]);_0x6b53f9['filters']=_[_0x6493('0x3d')](_0x6b53f9['model'],_0x6b53f9[_0x6493('0x3a')]);_0x2cf7cb[_0x6493('0x3e')]=_[_0x6493('0x3d')](_0x6b53f9[_0x6493('0x39')],qs['fields'](_0x2bb659['query'][_0x6493('0x3f')]));_0x2cf7cb[_0x6493('0x3e')]=_0x2cf7cb[_0x6493('0x3e')][_0x6493('0x40')]?_0x2cf7cb[_0x6493('0x3e')]:_0x6b53f9[_0x6493('0x39')];if(!_0x2bb659[_0x6493('0x3a')][_0x6493('0x41')](_0x6493('0x5f'))){_0x2cf7cb[_0x6493('0x27')]=qs[_0x6493('0x27')](_0x2bb659[_0x6493('0x3a')][_0x6493('0x27')]);_0x2cf7cb['offset']=qs[_0x6493('0x29')](_0x2bb659[_0x6493('0x3a')][_0x6493('0x29')]);}_0x2cf7cb[_0x6493('0x42')]=qs[_0x6493('0x43')](_0x2bb659[_0x6493('0x3a')][_0x6493('0x43')]);_0x2cf7cb[_0x6493('0x44')]=qs[_0x6493('0x3c')](_[_0x6493('0x63')](_0x2bb659['query'],_0x6b53f9['filters']));_0x2cf7cb['where'][_0x6493('0x5b')]=_0x1d95a9['id'];if(_0x2bb659[_0x6493('0x3a')][_0x6493('0x45')]){_0x2cf7cb[_0x6493('0x44')]=_[_0x6493('0x46')](_0x2cf7cb[_0x6493('0x44')],{'$or':_[_0x6493('0x36')](_0x2cf7cb[_0x6493('0x3e')],function(_0x3ed65d){var _0x3caa19={};_0x3caa19[_0x3ed65d]={'$like':'%'+_0x2bb659['query']['filter']+'%'};return _0x3caa19;})});}_0x2cf7cb=_[_0x6493('0x46')]({},_0x2cf7cb,_0x2bb659['options']);return db[_0x6493('0xcb')]['count']({'where':_0x2cf7cb[_0x6493('0x44')]})['then'](function(_0x20bc99){_0x2c2c5c[_0x6493('0x28')]=_0x20bc99;if(_0x2bb659[_0x6493('0x3a')]['includeAll']){_0x2cf7cb[_0x6493('0x4b')]=[{'all':!![]}];}else{_0x2cf7cb[_0x6493('0x4b')]=[{'model':db[_0x6493('0x96')],'as':_0x6493('0xeb'),'required':![]},{'model':db[_0x6493('0xd6')],'as':_0x6493('0x122'),'required':![]}];}return db[_0x6493('0xcb')]['findAll'](_0x2cf7cb);})['then'](function(_0x48cefc){_0x2c2c5c[_0x6493('0x4d')]=_0x48cefc;return _0x2c2c5c;});}})['then'](respondWithFilteredResult(_0x23bbee,_0x2cf7cb))['catch'](handleError(_0x23bbee,null));};exports[_0x6493('0x123')]=function(_0x3a5984,_0x1d38e3){return db[_0x6493('0x37')]['find']({'where':{'id':_0x3a5984[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x1d38e3,null))[_0x6493('0x2c')](function(_0x2e3965){if(_0x2e3965){return _0x2e3965[_0x6493('0x123')](_0x3a5984[_0x6493('0x51')][_0x6493('0x61')],_[_0x6493('0x124')](_0x3a5984[_0x6493('0x51')],[_0x6493('0x61'),'id'])||{})[_0x6493('0x125')](function(_0x418e1e){for(var _0x35e332=0x0;_0x35e332<_0x3a5984[_0x6493('0x51')]['ids'][_0x6493('0x40')];_0x35e332+=0x1){socket[_0x6493('0x126')](_0x6493('0x127'),{'UserId':Number(_0x3a5984[_0x6493('0x51')][_0x6493('0x61')][_0x35e332]),'ChatWebsiteId':Number(_0x3a5984[_0x6493('0x59')]['id'])});}return _0x418e1e;});}})[_0x6493('0x2c')](respondWithResult(_0x1d38e3,null))[_0x6493('0x21')](handleError(_0x1d38e3,null));};exports[_0x6493('0x128')]=function(_0x250ebe,_0x389a78){return db[_0x6493('0x37')][_0x6493('0x4f')]({'where':{'id':_0x250ebe[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x389a78,null))[_0x6493('0x2c')](function(_0x28f573){if(_0x28f573){return _0x28f573[_0x6493('0x128')](_0x250ebe[_0x6493('0x3a')]['ids'])[_0x6493('0x2c')](function(){if(_[_0x6493('0x129')](_0x250ebe['query'][_0x6493('0x61')])){for(var _0x4d6b6e=0x0;_0x4d6b6e<_0x250ebe[_0x6493('0x3a')][_0x6493('0x61')][_0x6493('0x40')];_0x4d6b6e+=0x1){socket[_0x6493('0x126')](_0x6493('0x12a'),{'UserId':Number(_0x250ebe['query']['ids'][_0x4d6b6e]),'ChatWebsiteId':Number(_0x250ebe['params']['id'])});}}else{socket[_0x6493('0x126')](_0x6493('0x12a'),{'UserId':Number(_0x250ebe[_0x6493('0x3a')][_0x6493('0x61')]),'ChatWebsiteId':Number(_0x250ebe[_0x6493('0x59')]['id'])});}});}})[_0x6493('0x2c')](respondWithStatusCode(_0x389a78,null))[_0x6493('0x21')](handleError(_0x389a78,null));};exports[_0x6493('0x12b')]=function(_0x5caac0,_0x4c8f85){var _0x298904={};var _0x3b0ef9={};var _0x5c1ed6;var _0x201cd6;return db[_0x6493('0x37')][_0x6493('0x5e')]({'where':{'id':_0x5caac0[_0x6493('0x59')]['id']}})[_0x6493('0x2c')](handleEntityNotFound(_0x4c8f85,null))['then'](function(_0xdf2d76){if(_0xdf2d76){_0x5c1ed6=_0xdf2d76;_0x3b0ef9[_0x6493('0x39')]=_[_0x6493('0x3b')](db[_0x6493('0xbb')][_0x6493('0x4e')]);_0x3b0ef9[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x5caac0[_0x6493('0x3a')]);_0x3b0ef9['filters']=_[_0x6493('0x3d')](_0x3b0ef9['model'],_0x3b0ef9[_0x6493('0x3a')]);_0x298904[_0x6493('0x3e')]=_[_0x6493('0x3d')](_0x3b0ef9[_0x6493('0x39')],qs[_0x6493('0x3f')](_0x5caac0[_0x6493('0x3a')][_0x6493('0x3f')]));_0x298904[_0x6493('0x3e')]=_0x298904[_0x6493('0x3e')][_0x6493('0x40')]?_0x298904[_0x6493('0x3e')]:_0x3b0ef9[_0x6493('0x39')];_0x298904[_0x6493('0x42')]=qs[_0x6493('0x43')](_0x5caac0['query']['sort']);_0x298904[_0x6493('0x44')]=qs['filters'](_[_0x6493('0x63')](_0x5caac0[_0x6493('0x3a')],_0x3b0ef9['filters']));if(_0x5caac0['query'][_0x6493('0x45')]){_0x298904[_0x6493('0x44')]=_[_0x6493('0x46')](_0x298904[_0x6493('0x44')],{'$or':_['map'](_0x298904['attributes'],function(_0x3648b2){var _0x59526e={};_0x59526e[_0x3648b2]={'$like':'%'+_0x5caac0[_0x6493('0x3a')][_0x6493('0x45')]+'%'};return _0x59526e;})});}_0x298904=_[_0x6493('0x46')]({},_0x298904,_0x5caac0[_0x6493('0x49')]);return _0x5c1ed6[_0x6493('0x12b')](_0x298904);}})[_0x6493('0x2c')](function(_0x32a7b3){if(_0x32a7b3){_0x201cd6=_0x32a7b3[_0x6493('0x40')];if(!_0x5caac0['query']['hasOwnProperty'](_0x6493('0x5f'))){_0x298904[_0x6493('0x27')]=qs['limit'](_0x5caac0[_0x6493('0x3a')][_0x6493('0x27')]);_0x298904[_0x6493('0x29')]=qs[_0x6493('0x29')](_0x5caac0['query'][_0x6493('0x29')]);}return _0x5c1ed6['getAgents'](_0x298904);}})[_0x6493('0x2c')](function(_0x273c0f){if(_0x273c0f){return _0x273c0f?{'count':_0x201cd6,'rows':_0x273c0f}:null;}})[_0x6493('0x2c')](respondWithResult(_0x4c8f85,null))['catch'](handleError(_0x4c8f85,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e1108f6..e1c8e1d 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 _0x09f4=['update','remove','emit','exports','ChatWebsite','setMaxListeners','save'];(function(_0x3da940,_0x4bbf14){var _0x2e6abf=function(_0x1eae06){while(--_0x1eae06){_0x3da940['push'](_0x3da940['shift']());}};_0x2e6abf(++_0x4bbf14);}(_0x09f4,0xe4));var _0x409f=function(_0x3eef0d,_0x38a38b){_0x3eef0d=_0x3eef0d-0x0;var _0x2c78fc=_0x09f4[_0x3eef0d];return _0x2c78fc;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x409f('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x409f('0x1')](0x0);var events={'afterCreate':_0x409f('0x2'),'afterUpdate':_0x409f('0x3'),'afterDestroy':_0x409f('0x4')};function emitEvent(_0x13f1a1){return function(_0x1d859b,_0x3c329a,_0x13f683){ChatWebsiteEvents[_0x409f('0x5')](_0x13f1a1+':'+_0x1d859b['id'],_0x1d859b);ChatWebsiteEvents[_0x409f('0x5')](_0x13f1a1,_0x1d859b);_0x13f683(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x409f('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x34aa=['events','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x34aa,0x171));var _0xa34a=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x34aa[_0x52ea08];return _0x28d546;};'use strict';var EventEmitter=require(_0xa34a('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xa34a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa34a('0x2')](0x0);var events={'afterCreate':_0xa34a('0x3'),'afterUpdate':_0xa34a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1d7a4f){return function(_0x30f3a2,_0x284561,_0x1db413){ChatWebsiteEvents[_0xa34a('0x5')](_0x1d7a4f+':'+_0x30f3a2['id'],_0x30f3a2);ChatWebsiteEvents[_0xa34a('0x5')](_0x1d7a4f,_0x30f3a2);_0x1db413(null);};}for(var e in events){if(events[_0xa34a('0x6')](e)){var event=events[e];ChatWebsite[_0xa34a('0x7')](e,emitEvent(event));}}module[_0xa34a('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index dcecee1..224ebc6 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 _0x3a1e=['chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define'];(function(_0x2f880a,_0x4551fb){var _0x5bef2a=function(_0x30f395){while(--_0x30f395){_0x2f880a['push'](_0x2f880a['shift']());}};_0x5bef2a(++_0x4551fb);}(_0x3a1e,0xc7));var _0xe3a1=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x3a1e[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0xe3a1('0x0'));var util=require(_0xe3a1('0x1'));var logger=require(_0xe3a1('0x2'))(_0xe3a1('0x3'));var moment=require('moment');var BPromise=require(_0xe3a1('0x4'));var rp=require(_0xe3a1('0x5'));var fs=require('fs');var path=require(_0xe3a1('0x6'));var rimraf=require('rimraf');var config=require(_0xe3a1('0x7'));var attributes=require(_0xe3a1('0x8'));module['exports']=function(_0xd69498,_0xec1ea4){return _0xd69498[_0xe3a1('0x9')]('ChatWebsite',attributes,{'tableName':_0xe3a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcee4=['bluebird','request-promise','rimraf','./chatWebsite.attributes','exports','chat_websites','lodash','api','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcee4,0xcc));var _0x4cee=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcee4[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x4cee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4cee('0x1'));var moment=require(_0x4cee('0x2'));var BPromise=require(_0x4cee('0x3'));var rp=require(_0x4cee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cee('0x5'));var config=require('../../config/environment');var attributes=require(_0x4cee('0x6'));module[_0x4cee('0x7')]=function(_0x18e15a,_0x2ec812){return _0x18e15a['define']('ChatWebsite',attributes,{'tableName':_0x4cee('0x8'),'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 d41cee4..88b1320 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 _0xa3ab=['localhost','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa3ab,0x1ec));var _0xba3a=function(_0x2fa50a,_0xf02cd){_0x2fa50a=_0x2fa50a-0x0;var _0x47a58f=_0xa3ab[_0x2fa50a];return _0x47a58f;};'use strict';var _=require(_0xba3a('0x0'));var util=require(_0xba3a('0x1'));var moment=require(_0xba3a('0x2'));var BPromise=require(_0xba3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba3a('0x5'));var logger=require('../../config/logger')(_0xba3a('0x6'));var config=require(_0xba3a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3a('0x8')][_0xba3a('0x9')]({'port':0x232a});config[_0xba3a('0xa')]=_[_0xba3a('0xb')](config['redis'],{'host':_0xba3a('0xc'),'port':0x18eb});var socket=require(_0xba3a('0xd'))(new Redis(config[_0xba3a('0xa')]));require(_0xba3a('0xe'))['register'](socket);function respondWithRpcPromise(_0x460550,_0x170dd2,_0xff9490){return new BPromise(function(_0x31e8c2,_0x20bdae){return client['request'](_0x460550,_0xff9490)[_0xba3a('0xf')](function(_0x5680af){logger[_0xba3a('0x10')](_0xba3a('0x11'),_0x170dd2,_0xba3a('0x12'));logger['debug'](_0xba3a('0x13'),_0x170dd2,_0xba3a('0x12'),JSON[_0xba3a('0x14')](_0x5680af));if(_0x5680af[_0xba3a('0x15')]){if(_0x5680af['error']['code']===0x1f4){logger[_0xba3a('0x15')](_0xba3a('0x11'),_0x170dd2,_0x5680af[_0xba3a('0x15')][_0xba3a('0x16')]);return _0x20bdae(_0x5680af[_0xba3a('0x15')][_0xba3a('0x16')]);}logger['error'](_0xba3a('0x11'),_0x170dd2,_0x5680af[_0xba3a('0x15')]['message']);return _0x31e8c2(_0x5680af['error'][_0xba3a('0x16')]);}else{logger[_0xba3a('0x10')](_0xba3a('0x11'),_0x170dd2,_0xba3a('0x12'));_0x31e8c2(_0x5680af[_0xba3a('0x17')][_0xba3a('0x16')]);}})['catch'](function(_0x5b6c4b){logger[_0xba3a('0x15')](_0xba3a('0x11'),_0x170dd2,_0x5b6c4b);_0x20bdae(_0x5b6c4b);});});} \ No newline at end of file +var _0x87b7=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','error','code','ChatWebsite,\x20%s,\x20%s','message','info','request\x20sent','result','catch'];(function(_0x516c72,_0x5dda21){var _0xe1e4ff=function(_0x363c0f){while(--_0x363c0f){_0x516c72['push'](_0x516c72['shift']());}};_0xe1e4ff(++_0x5dda21);}(_0x87b7,0x90));var _0x787b=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x87b7[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x787b('0x0'));var util=require(_0x787b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x787b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x787b('0x3'))['db'];var utils=require(_0x787b('0x4'));var logger=require(_0x787b('0x5'))(_0x787b('0x6'));var config=require('../../config/environment');var jayson=require(_0x787b('0x7'));var client=jayson[_0x787b('0x8')][_0x787b('0x9')]({'port':0x232a});config[_0x787b('0xa')]=_[_0x787b('0xb')](config[_0x787b('0xa')],{'host':_0x787b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x787b('0xa')]));require('./chatWebsite.socket')[_0x787b('0xd')](socket);function respondWithRpcPromise(_0x4f3459,_0x4e215f,_0x589b49){return new BPromise(function(_0x2a0d37,_0x2f9e5f){return client[_0x787b('0xe')](_0x4f3459,_0x589b49)[_0x787b('0xf')](function(_0x573bb8){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4e215f,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4e215f,'request\x20sent',JSON['stringify'](_0x573bb8));if(_0x573bb8[_0x787b('0x10')]){if(_0x573bb8[_0x787b('0x10')][_0x787b('0x11')]===0x1f4){logger[_0x787b('0x10')](_0x787b('0x12'),_0x4e215f,_0x573bb8[_0x787b('0x10')][_0x787b('0x13')]);return _0x2f9e5f(_0x573bb8[_0x787b('0x10')][_0x787b('0x13')]);}logger[_0x787b('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x4e215f,_0x573bb8[_0x787b('0x10')][_0x787b('0x13')]);return _0x2a0d37(_0x573bb8[_0x787b('0x10')]['message']);}else{logger[_0x787b('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x4e215f,_0x787b('0x15'));_0x2a0d37(_0x573bb8[_0x787b('0x16')][_0x787b('0x13')]);}})[_0x787b('0x17')](function(_0x43d5dc){logger['error'](_0x787b('0x12'),_0x4e215f,_0x43d5dc);_0x2f9e5f(_0x43d5dc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4b5de1f..a8d988e 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 _0x5cb9=['emit','removeListener','register','length','save','remove','update'];(function(_0x2d2bbc,_0x2e5f03){var _0x4ec2e2=function(_0x520ddc){while(--_0x520ddc){_0x2d2bbc['push'](_0x2d2bbc['shift']());}};_0x4ec2e2(++_0x2e5f03);}(_0x5cb9,0x1d9));var _0x95cb=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5cb9[_0x5f0089];return _0x193892;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x95cb('0x0'),_0x95cb('0x1'),_0x95cb('0x2')];function createListener(_0x4baac6,_0x40f3b1){return function(_0x33f49a){_0x40f3b1[_0x95cb('0x3')](_0x4baac6,_0x33f49a);};}function removeListener(_0x37f3d6,_0x551e4b){return function(){ChatWebsiteEvents[_0x95cb('0x4')](_0x37f3d6,_0x551e4b);};}exports[_0x95cb('0x5')]=function(_0x2b021c){for(var _0xac6524=0x0,_0x4fe332=events[_0x95cb('0x6')];_0xac6524<_0x4fe332;_0xac6524++){var _0x21a77b=events[_0xac6524];var _0x3c2b5c=createListener('chatWebsite:'+_0x21a77b,_0x2b021c);ChatWebsiteEvents['on'](_0x21a77b,_0x3c2b5c);}}; \ No newline at end of file +var _0x3559=['update','emit','removeListener','register','./chatWebsite.events','remove'];(function(_0x365b1d,_0x25492e){var _0x15a049=function(_0xd0e0a7){while(--_0xd0e0a7){_0x365b1d['push'](_0x365b1d['shift']());}};_0x15a049(++_0x25492e);}(_0x3559,0xf4));var _0x9355=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3559[_0x4565bf];return _0x5610ba;};'use strict';var ChatWebsiteEvents=require(_0x9355('0x0'));var events=['save',_0x9355('0x1'),_0x9355('0x2')];function createListener(_0x50679f,_0x5b0b57){return function(_0x20d9f9){_0x5b0b57[_0x9355('0x3')](_0x50679f,_0x20d9f9);};}function removeListener(_0x386784,_0x5d7a2b){return function(){ChatWebsiteEvents[_0x9355('0x4')](_0x386784,_0x5d7a2b);};}exports[_0x9355('0x5')]=function(_0x40f54d){for(var _0x172b96=0x0,_0x588fd4=events['length'];_0x172b96<_0x588fd4;_0x172b96++){var _0x5ea3d9=events[_0x172b96];var _0x4bffb7=createListener('chatWebsite:'+_0x5ea3d9,_0x40f54d);ChatWebsiteEvents['on'](_0x5ea3d9,_0x4bffb7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e35beef..d24ec6e 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 _0xe5b6=['getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','originalname','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','now','format','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe5b6,0x10b));var _0x6e5b=function(_0x4bc2d7,_0x9f0153){_0x4bc2d7=_0x4bc2d7-0x0;var _0x4548dc=_0xe5b6[_0x4bc2d7];return _0x4548dc;};'use strict';var multer=require(_0x6e5b('0x0'));var util=require(_0x6e5b('0x1'));var path=require(_0x6e5b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e5b('0x3'));var auth=require(_0x6e5b('0x4'));var interaction=require(_0x6e5b('0x5'));var config=require('../../config/environment');var controller=require(_0x6e5b('0x6'));router[_0x6e5b('0x7')]('/',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x9')]);router[_0x6e5b('0x7')](_0x6e5b('0xa'),auth['isAuthenticated'](),controller[_0x6e5b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6e5b('0xc')]);router[_0x6e5b('0x7')](_0x6e5b('0xd'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0xe')]);router['get']('/:id/canned_answers',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0xf')]);router['get']('/:id/logo',controller[_0x6e5b('0x10')]);router[_0x6e5b('0x7')](_0x6e5b('0x11'),controller[_0x6e5b('0x12')]);router['get'](_0x6e5b('0x13'),controller[_0x6e5b('0x14')]);router[_0x6e5b('0x7')](_0x6e5b('0x15'),controller[_0x6e5b('0x16')]);router['get'](_0x6e5b('0x17'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x18')]);router[_0x6e5b('0x7')]('/:id/snippet',controller[_0x6e5b('0x19')]);router[_0x6e5b('0x7')](_0x6e5b('0x1a'),auth['isAuthenticated'](),controller[_0x6e5b('0x1b')]);router['get']('/:id/proactive_actions',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x1c')]);router[_0x6e5b('0x7')]('/:id/fields',controller[_0x6e5b('0x1d')]);router['get'](_0x6e5b('0x1e'),auth[_0x6e5b('0x8')](),controller['getOfflineMessages']);router[_0x6e5b('0x7')](_0x6e5b('0x1f'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x20')]);router[_0x6e5b('0x21')](_0x6e5b('0xd'),auth['isAuthenticated'](),controller[_0x6e5b('0x22')]);router['post'](_0x6e5b('0x23'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x24')]);var upload=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x4bebae,_0x3c76dd,_0x1e312f){_0x1e312f(null,path['join'](config[_0x6e5b('0x26')],_0x6e5b('0x27')));},'filename':function(_0x3698bd,_0x3f65d9,_0x390310){_0x390310(null,util['format'](_0x6e5b('0x28'),Date['now'](),_0x3f65d9[_0x6e5b('0x29')]));}})});router[_0x6e5b('0x21')](_0x6e5b('0x2a'),upload[_0x6e5b('0x2b')](_0x6e5b('0x2c')),controller[_0x6e5b('0x2d')]);var upload=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x49ca9a,_0x2618a7,_0x4733f3){_0x4733f3(null,path[_0x6e5b('0x2e')](config['root'],_0x6e5b('0x2f')));},'filename':function(_0x2f2783,_0x4ed8fe,_0x266c6e){_0x266c6e(null,util['format']('%s-%s',Date[_0x6e5b('0x30')](),_0x4ed8fe[_0x6e5b('0x29')]));}})});router[_0x6e5b('0x21')](_0x6e5b('0x11'),upload['single'](_0x6e5b('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x206426,_0x5914a9,_0x16394d){_0x16394d(null,path['join'](config[_0x6e5b('0x26')],_0x6e5b('0x2f')));},'filename':function(_0x2e5724,_0x398db7,_0xd89c61){_0xd89c61(null,util[_0x6e5b('0x31')](_0x6e5b('0x28'),Date['now'](),_0x398db7[_0x6e5b('0x29')]));}})});router[_0x6e5b('0x21')](_0x6e5b('0x13'),upload[_0x6e5b('0x2b')](_0x6e5b('0x2c')),controller[_0x6e5b('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11ab13,_0x3b622c,_0x35c0fc){_0x35c0fc(null,path[_0x6e5b('0x2e')](config['root'],_0x6e5b('0x2f')));},'filename':function(_0x43ebc9,_0x15aab3,_0x4914d9){_0x4914d9(null,util[_0x6e5b('0x31')]('%s-%s',Date[_0x6e5b('0x30')](),_0x15aab3[_0x6e5b('0x29')]));}})});router['post'](_0x6e5b('0x15'),upload[_0x6e5b('0x2b')](_0x6e5b('0x2c')),controller[_0x6e5b('0x33')]);router[_0x6e5b('0x21')](_0x6e5b('0x34'),controller[_0x6e5b('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x6e5b('0x25')]({'destination':function(_0x2a0ac8,_0x403532,_0x5b4572){const _0x4eb913=path[_0x6e5b('0x2e')](config[_0x6e5b('0x26')],_0x6e5b('0x36'),_0x6e5b('0x37'),_0x6e5b('0x38'));fs_extra[_0x6e5b('0x39')](_0x4eb913,function(){_0x5b4572(null,_0x4eb913);});},'filename':function(_0x31a137,_0x159551,_0x3a74f9){const _0x26d9ec=_0x159551['originalname'][_0x6e5b('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x902d9f=path[_0x6e5b('0x3b')](_0x26d9ec);const _0x1e7fc7=Date[_0x6e5b('0x30')]()+'-'+_0x26d9ec[_0x6e5b('0x3a')](_0x902d9f,'')+_0x902d9f;_0x3a74f9(null,_0x1e7fc7);}})});router[_0x6e5b('0x21')](_0x6e5b('0x3c'),offlineUploadMulter[_0x6e5b('0x3d')](),controller[_0x6e5b('0x3e')]);router[_0x6e5b('0x21')](_0x6e5b('0x17'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x3f')]);router['post'](_0x6e5b('0x1a'),auth['isAuthenticated'](),controller[_0x6e5b('0x40')]);router[_0x6e5b('0x21')]('/:id/proactive_actions',auth[_0x6e5b('0x8')](),controller['addProactiveActions']);router[_0x6e5b('0x21')](_0x6e5b('0x1f'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x41')]);router['put'](_0x6e5b('0x42'),auth['isAuthenticated'](),controller[_0x6e5b('0x43')]);router[_0x6e5b('0x44')](_0x6e5b('0x42'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x45')]);router[_0x6e5b('0x44')](_0x6e5b('0xd'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x46')]);router[_0x6e5b('0x44')]('/:id/canned_answers',auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x47')]);router[_0x6e5b('0x44')](_0x6e5b('0x1f'),auth[_0x6e5b('0x8')](),controller[_0x6e5b('0x48')]);module['exports']=router; \ No newline at end of file +var _0xb09d=['getAnswers','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','/:id/logo','file','server/files/images/avatars/','single','addAvatar','format','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','extname','replace','any','offline','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','delete','destroy','removeDispositions','path','express','Router','../../components/auth/service','./chatWebsite.controller','isAuthenticated','/describe','show','get','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x2d1efb,_0x59e856){var _0x143e89=function(_0x446e8b){while(--_0x446e8b){_0x2d1efb['push'](_0x2d1efb['shift']());}};_0x143e89(++_0x59e856);}(_0xb09d,0xb7));var _0xdb09=function(_0x5626ec,_0x274dd6){_0x5626ec=_0x5626ec-0x0;var _0x36cca2=_0xb09d[_0x5626ec];return _0x36cca2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb09('0x0'));var timeout=require('connect-timeout');var express=require(_0xdb09('0x1'));var router=express[_0xdb09('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdb09('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb09('0x4'));router['get']('/',auth[_0xdb09('0x5')](),controller['index']);router['get'](_0xdb09('0x6'),auth[_0xdb09('0x5')](),controller['describe']);router['get']('/:id',auth[_0xdb09('0x5')](),controller[_0xdb09('0x7')]);router[_0xdb09('0x8')](_0xdb09('0x9'),auth[_0xdb09('0x5')](),controller[_0xdb09('0xa')]);router[_0xdb09('0x8')](_0xdb09('0xb'),auth['isAuthenticated'](),controller[_0xdb09('0xc')]);router['get']('/:id/logo',controller['getLogo']);router[_0xdb09('0x8')](_0xdb09('0xd'),controller['getAvatar']);router['get'](_0xdb09('0xe'),controller[_0xdb09('0xf')]);router[_0xdb09('0x8')](_0xdb09('0x10'),controller['getSystemAvatar']);router[_0xdb09('0x8')](_0xdb09('0x11'),auth[_0xdb09('0x5')](),controller[_0xdb09('0x12')]);router[_0xdb09('0x8')](_0xdb09('0x13'),controller[_0xdb09('0x14')]);router['get'](_0xdb09('0x15'),auth[_0xdb09('0x5')](),controller[_0xdb09('0x16')]);router['get']('/:id/proactive_actions',auth[_0xdb09('0x5')](),controller[_0xdb09('0x17')]);router['get'](_0xdb09('0x18'),controller[_0xdb09('0x19')]);router[_0xdb09('0x8')]('/:id/offline_messages',auth[_0xdb09('0x5')](),controller[_0xdb09('0x1a')]);router['get'](_0xdb09('0x1b'),auth[_0xdb09('0x5')](),controller[_0xdb09('0x1c')]);router[_0xdb09('0x1d')]('/',auth[_0xdb09('0x5')](),controller[_0xdb09('0x1e')]);router[_0xdb09('0x1d')]('/:id/dispositions',auth[_0xdb09('0x5')](),controller[_0xdb09('0x1f')]);router[_0xdb09('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdb09('0x20')]);var upload=multer({'storage':multer[_0xdb09('0x21')]({'destination':function(_0x3abc9d,_0x2264e2,_0xd81b78){_0xd81b78(null,path[_0xdb09('0x22')](config[_0xdb09('0x23')],_0xdb09('0x24')));},'filename':function(_0x546fc5,_0x13f34d,_0x24bede){_0x24bede(null,util['format'](_0xdb09('0x25'),Date[_0xdb09('0x26')](),_0x13f34d[_0xdb09('0x27')]));}})});router['post'](_0xdb09('0x28'),upload['single'](_0xdb09('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0xdb09('0x21')]({'destination':function(_0x216182,_0x3ce9cc,_0x2ef048){_0x2ef048(null,path[_0xdb09('0x22')](config[_0xdb09('0x23')],_0xdb09('0x2a')));},'filename':function(_0x1fff93,_0x218a3f,_0x4d09ca){_0x4d09ca(null,util['format'](_0xdb09('0x25'),Date[_0xdb09('0x26')](),_0x218a3f[_0xdb09('0x27')]));}})});router[_0xdb09('0x1d')]('/:id/avatar',upload[_0xdb09('0x2b')]('file'),controller[_0xdb09('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4014e2,_0xb62a4f,_0x1ebc1d){_0x1ebc1d(null,path['join'](config[_0xdb09('0x23')],'server/files/images/avatars/'));},'filename':function(_0x22c404,_0x5ec44e,_0x14aa26){_0x14aa26(null,util[_0xdb09('0x2d')](_0xdb09('0x25'),Date[_0xdb09('0x26')](),_0x5ec44e[_0xdb09('0x27')]));}})});router['post'](_0xdb09('0xe'),upload[_0xdb09('0x2b')](_0xdb09('0x29')),controller[_0xdb09('0x2e')]);var upload=multer({'storage':multer[_0xdb09('0x21')]({'destination':function(_0x5bd8af,_0x51a400,_0x1fb604){_0x1fb604(null,path['join'](config['root'],_0xdb09('0x2a')));},'filename':function(_0x291fec,_0x141574,_0xfe6915){_0xfe6915(null,util[_0xdb09('0x2d')](_0xdb09('0x25'),Date[_0xdb09('0x26')](),_0x141574[_0xdb09('0x27')]));}})});router['post'](_0xdb09('0x10'),upload['single'](_0xdb09('0x29')),controller[_0xdb09('0x2f')]);router[_0xdb09('0x1d')]('/:id/notify',controller[_0xdb09('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xdb09('0x21')]({'destination':function(_0x271a23,_0x2ec24c,_0x97b17a){const _0x288456=path['join'](config['root'],'server/files',_0xdb09('0x31'),_0xdb09('0x32'));fs_extra[_0xdb09('0x33')](_0x288456,function(){_0x97b17a(null,_0x288456);});},'filename':function(_0x3e1167,_0xf4c816,_0x4dc1c9){const _0x375762=_0xf4c816[_0xdb09('0x27')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x229281=path[_0xdb09('0x34')](_0x375762);const _0x556650=Date['now']()+'-'+_0x375762[_0xdb09('0x35')](_0x229281,'')+_0x229281;_0x4dc1c9(null,_0x556650);}})});router['post']('/:id/offline',offlineUploadMulter[_0xdb09('0x36')](),controller[_0xdb09('0x37')]);router[_0xdb09('0x1d')](_0xdb09('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xdb09('0x5')](),controller[_0xdb09('0x38')]);router[_0xdb09('0x1d')](_0xdb09('0x39'),auth[_0xdb09('0x5')](),controller[_0xdb09('0x3a')]);router['post'](_0xdb09('0x1b'),auth[_0xdb09('0x5')](),controller[_0xdb09('0x3b')]);router[_0xdb09('0x3c')](_0xdb09('0x3d'),auth[_0xdb09('0x5')](),controller['update']);router[_0xdb09('0x3e')](_0xdb09('0x3d'),auth['isAuthenticated'](),controller[_0xdb09('0x3f')]);router[_0xdb09('0x3e')](_0xdb09('0x9'),auth[_0xdb09('0x5')](),controller[_0xdb09('0x40')]);router['delete'](_0xdb09('0xb'),auth[_0xdb09('0x5')](),controller['removeAnswers']);router[_0xdb09('0x3e')](_0xdb09('0x1b'),auth[_0xdb09('0x5')](),controller['removeAgents']);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 f1c196d..31eacee 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 _0xddf0=['expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x50d5f7,_0x1f531e){var _0x3bf4d4=function(_0x26f32d){while(--_0x26f32d){_0x50d5f7['push'](_0x50d5f7['shift']());}};_0x3bf4d4(++_0x1f531e);}(_0xddf0,0xac));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0x0ddf('0x0'));var express=require(_0x0ddf('0x1'));var auth=require(_0x0ddf('0x2'));var config=require(_0x0ddf('0x3'));var router=express[_0x0ddf('0x4')]();var isProduction=config[_0x0ddf('0x5')]===_0x0ddf('0x6')||![];function clientSideLogs(_0x448bf5,_0x3ac17f,_0x49a76c){var _0x1dfb7b=_0x448bf5['app'][_0x0ddf('0x7')](_0x0ddf('0x8'));if(!_0x1dfb7b){throw new Error(_0x0ddf('0x9'));}return beaverLogger[_0x0ddf('0xa')]({'uri':'/client-logs','logger':_0x1dfb7b,'enableCors':!isProduction})(_0x448bf5,_0x3ac17f,_0x49a76c);}router[_0x0ddf('0xb')](auth[_0x0ddf('0xc')](),clientSideLogs);module[_0x0ddf('0xd')]=router; \ No newline at end of file +var _0xac80=['app','get','expressEndpoint','/client-logs','use','isAuthenticated','../config/environment','Router','env','production'];(function(_0x367f6b,_0x5018ff){var _0x3b4dd3=function(_0x24e0d0){while(--_0x24e0d0){_0x367f6b['push'](_0x367f6b['shift']());}};_0x3b4dd3(++_0x5018ff);}(_0xac80,0x74));var _0x0ac8=function(_0x3f3c3c,_0x49fe3b){_0x3f3c3c=_0x3f3c3c-0x0;var _0xa71e80=_0xac80[_0x3f3c3c];return _0xa71e80;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require('../components/auth/service');var config=require(_0x0ac8('0x0'));var router=express[_0x0ac8('0x1')]();var isProduction=config[_0x0ac8('0x2')]===_0x0ac8('0x3')||![];function clientSideLogs(_0x40cf4,_0x5f3e51,_0x65c758){var _0x312289=_0x40cf4[_0x0ac8('0x4')][_0x0ac8('0x5')]('client-side-logger');if(!_0x312289){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x0ac8('0x6')]({'uri':_0x0ac8('0x7'),'logger':_0x312289,'enableCors':!isProduction})(_0x40cf4,_0x5f3e51,_0x65c758);}router[_0x0ac8('0x8')](auth[_0x0ac8('0x9')](),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 4ddb0e9..81a4fcf 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 _0x5186=['sequelize','STRING','ENUM','AmazonAWS','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x1ba22a,_0x2a568c){var _0x5ba115=function(_0x38ca3a){while(--_0x38ca3a){_0x1ba22a['push'](_0x1ba22a['shift']());}};_0x5ba115(++_0x2a568c);}(_0x5186,0x90));var _0x6518=function(_0xb74abd,_0x4ee757){_0xb74abd=_0xb74abd-0x0;var _0x1daf5f=_0x5186[_0xb74abd];return _0x1daf5f;};'use strict';var Sequelize=require(_0x6518('0x0'));module['exports']={'name':{'type':Sequelize[_0x6518('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6518('0x2')](_0x6518('0x3'),_0x6518('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x6518('0x5'))},'data1':{'type':Sequelize[_0x6518('0x1')],'comment':_0x6518('0x6')},'data2':{'type':Sequelize[_0x6518('0x1')],'comment':_0x6518('0x7')},'data3':{'type':Sequelize[_0x6518('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x6518('0x1')],'comment':_0x6518('0x8')},'data5':{'type':Sequelize[_0x6518('0x9')],'comment':_0x6518('0xa')},'data6':{'type':Sequelize[_0x6518('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x6518('0x9')],'comment':_0x6518('0xb')}}; \ No newline at end of file +var _0xcd14=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','MicrosoftAzure','Outlook365'];(function(_0x2edc94,_0x2ef48b){var _0x197824=function(_0x322040){while(--_0x322040){_0x2edc94['push'](_0x2edc94['shift']());}};_0x197824(++_0x2ef48b);}(_0xcd14,0x104));var _0x4cd1=function(_0x212f53,_0x58e075){_0x212f53=_0x212f53-0x0;var _0x3d4e6d=_0xcd14[_0x212f53];return _0x3d4e6d;};'use strict';var Sequelize=require(_0x4cd1('0x0'));module[_0x4cd1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4cd1('0x2')](_0x4cd1('0x3'),'Google',_0x4cd1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4cd1('0x2')](_0x4cd1('0x5'),_0x4cd1('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0x4cd1('0x7')},'data2':{'type':Sequelize[_0x4cd1('0x8')],'comment':_0x4cd1('0x9')},'data3':{'type':Sequelize[_0x4cd1('0x8')],'comment':_0x4cd1('0xa')},'data4':{'type':Sequelize[_0x4cd1('0x8')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x4cd1('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x4cd1('0xb')],'comment':_0x4cd1('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':_0x4cd1('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index cbea991..dc8c00d 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 _0x0d08=['name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','service','MicrosoftAzure','decryptString','data3','catch','params','length','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','update','find','oauth2MicrosoftAuthorize','findOne','sendStatus','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','id_token','Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','refresh_token','data5','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','destroy','then'];(function(_0x166780,_0xb61508){var _0x3c4bcc=function(_0x504a51){while(--_0x504a51){_0x166780['push'](_0x166780['shift']());}};_0x3c4bcc(++_0xb61508);}(_0x0d08,0x14f));var _0x80d0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0d08[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x80d0('0x0'));var Redis=require(_0x80d0('0x1'));var qs=require(_0x80d0('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x80d0('0x3'))('api');var db=require(_0x80d0('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x80d0('0x5')]=_['defaults'](config[_0x80d0('0x5')],{'host':_0x80d0('0x6'),'port':0x18eb});var socket=require(_0x80d0('0x7'))(new Redis(config[_0x80d0('0x5')]));var redis=new Redis(config[_0x80d0('0x5')]);function respondWithStatusCode(_0x43decb,_0x3bb8ef){_0x3bb8ef=_0x3bb8ef||0xcc;return function(_0x38b0f3){if(_0x38b0f3){return _0x43decb['sendStatus'](_0x3bb8ef);}return _0x43decb[_0x80d0('0x8')](_0x3bb8ef)[_0x80d0('0x9')]();};}function respondWithResult(_0x4961c6,_0x102f9f){_0x102f9f=_0x102f9f||0xc8;return function(_0x140995){if(_0x140995){return _0x4961c6[_0x80d0('0x8')](_0x102f9f)[_0x80d0('0xa')](_0x140995);}};}function respondWithFilteredResult(_0x4be65e,_0x8c3c2c){return function(_0x3afc12){if(_0x3afc12){var _0x3429b0=typeof _0x8c3c2c[_0x80d0('0xb')]===_0x80d0('0xc')&&typeof _0x8c3c2c[_0x80d0('0xd')]===_0x80d0('0xc');var _0x994aae=_0x3afc12[_0x80d0('0xe')];var _0x500f5e=_0x3429b0?0x0:_0x8c3c2c[_0x80d0('0xb')];var _0x57fa22=_0x3429b0?_0x3afc12[_0x80d0('0xe')]:_0x8c3c2c['offset']+_0x8c3c2c[_0x80d0('0xd')];var _0x185af6;if(_0x57fa22>=_0x994aae){_0x57fa22=_0x994aae;_0x185af6=0xc8;}else{_0x185af6=0xce;}_0x4be65e[_0x80d0('0x8')](_0x185af6);return _0x4be65e['set']('Content-Range',_0x500f5e+'-'+_0x57fa22+'/'+_0x994aae)[_0x80d0('0xa')](_0x3afc12);}return null;};}function saveUpdates(_0x49238c){return function(_0x37aed7){if(_0x37aed7){return _0x37aed7['update'](_0x49238c)['then'](function(_0x427434){return _0x427434;});}return null;};}function removeEntity(_0x46c5b9){return function(_0x23495f){if(_0x23495f){return _0x23495f[_0x80d0('0xf')]()[_0x80d0('0x10')](function(){_0x46c5b9[_0x80d0('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32520e){return function(_0x338fb4){if(!_0x338fb4){_0x32520e['sendStatus'](0x194);}return _0x338fb4;};}function handleError(_0x35f2cf,_0x40941b){_0x40941b=_0x40941b||0x1f4;return function(_0x5359ab){logger['error'](_0x5359ab['stack']);if(_0x5359ab[_0x80d0('0x11')]){delete _0x5359ab[_0x80d0('0x11')];}_0x35f2cf[_0x80d0('0x8')](_0x40941b)[_0x80d0('0x12')](_0x5359ab);};}function maskClientSecret(_0x4bc5af){return _[_0x80d0('0x13')](_0x4bc5af[_0x80d0('0x14')](0x0,0x3),0x14,'*');}exports[_0x80d0('0x15')]=function(_0x1eb315,_0x174bcd){var _0x20a4fd={},_0x465921={},_0x2d80dd={'count':0x0,'rows':[]};var _0x18149b=_[_0x80d0('0x16')](db[_0x80d0('0x17')][_0x80d0('0x18')],function(_0x3d7681){return{'name':_0x3d7681[_0x80d0('0x19')],'type':_0x3d7681[_0x80d0('0x1a')][_0x80d0('0x1b')]};});_0x465921[_0x80d0('0x1c')]=_[_0x80d0('0x16')](_0x18149b,_0x80d0('0x11'));_0x465921[_0x80d0('0x1d')]=_['keys'](_0x1eb315['query']);_0x465921['filters']=_[_0x80d0('0x1e')](_0x465921[_0x80d0('0x1c')],_0x465921['query']);_0x20a4fd[_0x80d0('0x1f')]=_[_0x80d0('0x1e')](_0x465921[_0x80d0('0x1c')],qs[_0x80d0('0x20')](_0x1eb315['query']['fields']));_0x20a4fd[_0x80d0('0x1f')]=_0x20a4fd[_0x80d0('0x1f')]['length']?_0x20a4fd[_0x80d0('0x1f')]:_0x465921[_0x80d0('0x1c')];if(!_0x1eb315['query'][_0x80d0('0x21')](_0x80d0('0x22'))){_0x20a4fd[_0x80d0('0xd')]=qs[_0x80d0('0xd')](_0x1eb315['query'][_0x80d0('0xd')]);_0x20a4fd[_0x80d0('0xb')]=qs[_0x80d0('0xb')](_0x1eb315[_0x80d0('0x1d')]['offset']);}_0x20a4fd[_0x80d0('0x23')]=qs[_0x80d0('0x24')](_0x1eb315[_0x80d0('0x1d')]['sort']);_0x20a4fd[_0x80d0('0x25')]=qs[_0x80d0('0x26')](_['pick'](_0x1eb315[_0x80d0('0x1d')],_0x465921[_0x80d0('0x26')]),_0x18149b);if(_0x1eb315['query']['filter']){_0x20a4fd['where']=_['merge'](_0x20a4fd[_0x80d0('0x25')],{'$or':_[_0x80d0('0x16')](_0x18149b,function(_0x24bf71){if(_0x24bf71[_0x80d0('0x1a')]!==_0x80d0('0x27')){var _0x1c046e={};_0x1c046e[_0x24bf71[_0x80d0('0x11')]]={'$like':'%'+_0x1eb315['query'][_0x80d0('0x28')]+'%'};return _0x1c046e;}})});}_0x20a4fd=_[_0x80d0('0x29')]({},_0x20a4fd,_0x1eb315[_0x80d0('0x2a')]);var _0x3c4118={'where':_0x20a4fd[_0x80d0('0x25')]};return db['CloudProvider'][_0x80d0('0xe')](_0x3c4118)[_0x80d0('0x10')](function(_0x340d3c){_0x2d80dd[_0x80d0('0xe')]=_0x340d3c;if(_0x1eb315[_0x80d0('0x1d')][_0x80d0('0x2b')]){_0x20a4fd['include']=[{'all':!![]}];}return db[_0x80d0('0x17')]['findAll'](_0x20a4fd);})[_0x80d0('0x10')](function(_0x2cba23){_0x2d80dd['rows']=_['map'](_0x2cba23,function(_0x225b5a){if(_0x225b5a[_0x80d0('0x2c')]===_0x80d0('0x2d')){var _0x58ac22=encryptor[_0x80d0('0x2e')](_0x225b5a[_0x80d0('0x2f')]);_0x225b5a['data3']=maskClientSecret(_0x58ac22);}return _0x225b5a;});return _0x2d80dd;})[_0x80d0('0x10')](respondWithFilteredResult(_0x174bcd,_0x20a4fd))[_0x80d0('0x30')](handleError(_0x174bcd,null));};exports['show']=function(_0x4a8b4d,_0x27d4cf){var _0x475269={'raw':!![],'where':{'id':_0x4a8b4d[_0x80d0('0x31')]['id']}},_0x2218c3={};_0x2218c3[_0x80d0('0x1c')]=_['keys'](db[_0x80d0('0x17')][_0x80d0('0x18')]);_0x2218c3[_0x80d0('0x1d')]=_['keys'](_0x4a8b4d[_0x80d0('0x1d')]);_0x2218c3['filters']=_[_0x80d0('0x1e')](_0x2218c3[_0x80d0('0x1c')],_0x2218c3[_0x80d0('0x1d')]);_0x475269['attributes']=_['intersection'](_0x2218c3[_0x80d0('0x1c')],qs[_0x80d0('0x20')](_0x4a8b4d[_0x80d0('0x1d')][_0x80d0('0x20')]));_0x475269[_0x80d0('0x1f')]=_0x475269['attributes'][_0x80d0('0x32')]?_0x475269[_0x80d0('0x1f')]:_0x2218c3[_0x80d0('0x1c')];if(_0x4a8b4d[_0x80d0('0x1d')][_0x80d0('0x2b')]){_0x475269['include']=[{'all':!![]}];}_0x475269=_[_0x80d0('0x29')]({},_0x475269,_0x4a8b4d[_0x80d0('0x2a')]);return db[_0x80d0('0x17')]['find'](_0x475269)['then'](handleEntityNotFound(_0x27d4cf,null))[_0x80d0('0x10')](function(_0x30d148){if(_0x30d148[_0x80d0('0x2c')]==='MicrosoftAzure'){var _0x50e0be=encryptor[_0x80d0('0x2e')](_0x30d148[_0x80d0('0x2f')]);_0x30d148[_0x80d0('0x2f')]=maskClientSecret(_0x50e0be);}return _0x30d148;})['then'](respondWithResult(_0x27d4cf,null))['catch'](handleError(_0x27d4cf,null));};exports['create']=function(_0x6686d1,_0x2041cb){if(!_0x6686d1[_0x80d0('0x33')][_0x80d0('0x11')])throw new Error(_0x80d0('0x34'));if(!_0x6686d1['body'][_0x80d0('0x2c')])throw new Error(_0x80d0('0x35'));var _0x5f0136=db[_0x80d0('0x17')]['rawAttributes'][_0x80d0('0x2c')][_0x80d0('0x36')];if(!_0x5f0136['includes'](_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2c')]))throw new Error(_0x80d0('0x37')+_0x5f0136[_0x80d0('0x38')](',\x20'));if(_0x6686d1[_0x80d0('0x33')]['service']===_0x80d0('0x2d')&&_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2f')]){_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2f')]=encryptor[_0x80d0('0x39')](_0x6686d1[_0x80d0('0x33')][_0x80d0('0x2f')]);}return db['CloudProvider'][_0x80d0('0x3a')](_0x6686d1[_0x80d0('0x33')],{})['then'](respondWithResult(_0x2041cb,0xc9))[_0x80d0('0x30')](handleError(_0x2041cb,null));};exports[_0x80d0('0x3b')]=function(_0x3f97eb,_0xa0f6a){if(_0x3f97eb['body']['id']){delete _0x3f97eb[_0x80d0('0x33')]['id'];}return db[_0x80d0('0x17')][_0x80d0('0x3c')]({'where':{'id':_0x3f97eb[_0x80d0('0x31')]['id']}})['then'](handleEntityNotFound(_0xa0f6a,null))[_0x80d0('0x10')](function(_0x3c418e){if(_0x3c418e[_0x80d0('0x2c')]==='MicrosoftAzure'&&_0x3f97eb['body'][_0x80d0('0x2f')]){_0x3f97eb[_0x80d0('0x33')][_0x80d0('0x2f')]=encryptor[_0x80d0('0x39')](_0x3f97eb[_0x80d0('0x33')]['data3']);}return _0x3c418e;})[_0x80d0('0x10')](saveUpdates(_0x3f97eb[_0x80d0('0x33')],null))[_0x80d0('0x10')](respondWithResult(_0xa0f6a,null))['catch'](handleError(_0xa0f6a,null));};exports['destroy']=function(_0x314da2,_0x370804){return db[_0x80d0('0x17')][_0x80d0('0x3c')]({'where':{'id':_0x314da2[_0x80d0('0x31')]['id']}})['then'](handleEntityNotFound(_0x370804,null))[_0x80d0('0x10')](removeEntity(_0x370804,null))['catch'](handleError(_0x370804,null));};exports[_0x80d0('0x3d')]=function(_0x7aeb88,_0x4ba18b){return db[_0x80d0('0x17')][_0x80d0('0x3e')]({'where':{'id':_0x7aeb88[_0x80d0('0x31')]['id']},'raw':!![]})[_0x80d0('0x10')](function(_0x38e31f){if(!_0x38e31f)return _0x4ba18b[_0x80d0('0x3f')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x38e31f,_0x7aeb88['user']['id'])};})[_0x80d0('0x10')](respondWithResult(_0x4ba18b,null))[_0x80d0('0x30')](handleError(_0x4ba18b,null));};exports[_0x80d0('0x40')]=function(_0x222089,_0x215ba9){var _0x1adc12=_0x222089[_0x80d0('0x33')];var _0x476643;var _0x5d7474;if(_0x1adc12['error'])throw _0x1adc12;redis[_0x80d0('0x41')](_0x1adc12[_0x80d0('0x42')])[_0x80d0('0x10')](function(_0x3b3289){if(!_0x3b3289)throw new Error(_0x80d0('0x43'));_0x476643=JSON[_0x80d0('0x44')](_0x3b3289);var _0x5453a9=Buffer[_0x80d0('0x45')](_0x1adc12[_0x80d0('0x42')],_0x80d0('0x46'))[_0x80d0('0x47')]('ascii');_0x5d7474=JSON[_0x80d0('0x44')](_0x5453a9);if(!oauth['isValidIdToken'](_0x1adc12[_0x80d0('0x48')],_0x476643['oauth2Claims']))throw new Error(_0x80d0('0x49'));redis[_0x80d0('0x4a')](_0x1adc12[_0x80d0('0x42')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1adc12[_0x80d0('0x4b')],_0x476643);})[_0x80d0('0x10')](function(_0x428083){_0x476643['data5']=_0x428083[_0x80d0('0x4c')];_0x476643[_0x80d0('0x4d')]=_0x428083[_0x80d0('0x4e')];return db[_0x80d0('0x17')][_0x80d0('0x3b')]({'data5':_0x476643[_0x80d0('0x4f')],'data6':_0x476643[_0x80d0('0x4d')]},{'where':{'id':_0x476643['id']}});})[_0x80d0('0x10')](function(){oauth['startRefreshInterval'](_0x476643);socket['emit'](_0x80d0('0x50'),{'id':_0x5d7474['id']});return;})[_0x80d0('0x10')](respondWithStatusCode(_0x215ba9,null))[_0x80d0('0x30')](function(_0x17e10b){if(_0x5d7474){socket[_0x80d0('0x51')](_0x80d0('0x52'),{'id':_0x5d7474['id']});}if(!_0x476643){logger['error'](_0x80d0('0x53'),_0x17e10b);return _0x215ba9['status'](0x1f4)['send'](_0x17e10b[_0x80d0('0x54')]);}logger[_0x80d0('0x55')](_0x80d0('0x56'),_0x476643['id'],JSON[_0x80d0('0x57')](_0x17e10b));});}; \ No newline at end of file +var _0x35e9=['Content-Range','update','destroy','then','error','stack','name','send','padEnd','index','CloudProvider','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','map','service','data3','catch','show','params','rawAttributes','find','decryptString','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','join','MicrosoftAzure','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','from','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x29e327,_0x2b6ea9){var _0x3dac9e=function(_0x5c0e02){while(--_0x5c0e02){_0x29e327['push'](_0x29e327['shift']());}};_0x3dac9e(++_0x2b6ea9);}(_0x35e9,0x1da));var _0x935e=function(_0x34d07e,_0xfa71e9){_0x34d07e=_0x34d07e-0x0;var _0x1d9e2=_0x35e9[_0x34d07e];return _0x1d9e2;};'use strict';var _=require(_0x935e('0x0'));var Redis=require(_0x935e('0x1'));var qs=require(_0x935e('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x935e('0x3'));var logger=require(_0x935e('0x4'))(_0x935e('0x5'));var db=require(_0x935e('0x6'))['db'];var oauth=require(_0x935e('0x7'));config[_0x935e('0x8')]=_[_0x935e('0x9')](config[_0x935e('0x8')],{'host':_0x935e('0xa'),'port':0x18eb});var socket=require(_0x935e('0xb'))(new Redis(config['redis']));var redis=new Redis(config[_0x935e('0x8')]);function respondWithStatusCode(_0x2c71d0,_0x5a29d9){_0x5a29d9=_0x5a29d9||0xcc;return function(_0x454848){if(_0x454848){return _0x2c71d0[_0x935e('0xc')](_0x5a29d9);}return _0x2c71d0[_0x935e('0xd')](_0x5a29d9)[_0x935e('0xe')]();};}function respondWithResult(_0x531451,_0xefbf84){_0xefbf84=_0xefbf84||0xc8;return function(_0x355a8f){if(_0x355a8f){return _0x531451[_0x935e('0xd')](_0xefbf84)[_0x935e('0xf')](_0x355a8f);}};}function respondWithFilteredResult(_0x4706fc,_0x3da5fa){return function(_0x11a78c){if(_0x11a78c){var _0x1c443f=typeof _0x3da5fa['offset']===_0x935e('0x10')&&typeof _0x3da5fa[_0x935e('0x11')]===_0x935e('0x10');var _0x2bc309=_0x11a78c[_0x935e('0x12')];var _0x155b85=_0x1c443f?0x0:_0x3da5fa[_0x935e('0x13')];var _0x29fd53=_0x1c443f?_0x11a78c[_0x935e('0x12')]:_0x3da5fa[_0x935e('0x13')]+_0x3da5fa[_0x935e('0x11')];var _0x474bad;if(_0x29fd53>=_0x2bc309){_0x29fd53=_0x2bc309;_0x474bad=0xc8;}else{_0x474bad=0xce;}_0x4706fc['status'](_0x474bad);return _0x4706fc[_0x935e('0x14')](_0x935e('0x15'),_0x155b85+'-'+_0x29fd53+'/'+_0x2bc309)[_0x935e('0xf')](_0x11a78c);}return null;};}function saveUpdates(_0x41def9){return function(_0x54295b){if(_0x54295b){return _0x54295b[_0x935e('0x16')](_0x41def9)['then'](function(_0x35cc1a){return _0x35cc1a;});}return null;};}function removeEntity(_0x375814){return function(_0x37ebe7){if(_0x37ebe7){return _0x37ebe7[_0x935e('0x17')]()[_0x935e('0x18')](function(){_0x375814[_0x935e('0xd')](0xcc)[_0x935e('0xe')]();});}};}function handleEntityNotFound(_0x198322){return function(_0x38d77d){if(!_0x38d77d){_0x198322[_0x935e('0xc')](0x194);}return _0x38d77d;};}function handleError(_0xc62049,_0x53ccea){_0x53ccea=_0x53ccea||0x1f4;return function(_0x2b5649){logger[_0x935e('0x19')](_0x2b5649[_0x935e('0x1a')]);if(_0x2b5649[_0x935e('0x1b')]){delete _0x2b5649[_0x935e('0x1b')];}_0xc62049['status'](_0x53ccea)[_0x935e('0x1c')](_0x2b5649);};}function maskClientSecret(_0x4b9e44){return _[_0x935e('0x1d')](_0x4b9e44['slice'](0x0,0x3),0x14,'*');}exports[_0x935e('0x1e')]=function(_0x2e041d,_0x4b16d8){var _0x1b7331={},_0x26143d={},_0x397862={'count':0x0,'rows':[]};var _0x1df27c=_['map'](db[_0x935e('0x1f')]['rawAttributes'],function(_0x3549cb){return{'name':_0x3549cb[_0x935e('0x20')],'type':_0x3549cb[_0x935e('0x21')][_0x935e('0x22')]};});_0x26143d['model']=_['map'](_0x1df27c,_0x935e('0x1b'));_0x26143d[_0x935e('0x23')]=_[_0x935e('0x24')](_0x2e041d[_0x935e('0x23')]);_0x26143d[_0x935e('0x25')]=_[_0x935e('0x26')](_0x26143d['model'],_0x26143d[_0x935e('0x23')]);_0x1b7331[_0x935e('0x27')]=_['intersection'](_0x26143d[_0x935e('0x28')],qs[_0x935e('0x29')](_0x2e041d[_0x935e('0x23')][_0x935e('0x29')]));_0x1b7331[_0x935e('0x27')]=_0x1b7331[_0x935e('0x27')][_0x935e('0x2a')]?_0x1b7331['attributes']:_0x26143d[_0x935e('0x28')];if(!_0x2e041d[_0x935e('0x23')]['hasOwnProperty'](_0x935e('0x2b'))){_0x1b7331[_0x935e('0x11')]=qs[_0x935e('0x11')](_0x2e041d[_0x935e('0x23')][_0x935e('0x11')]);_0x1b7331['offset']=qs[_0x935e('0x13')](_0x2e041d[_0x935e('0x23')]['offset']);}_0x1b7331[_0x935e('0x2c')]=qs['sort'](_0x2e041d[_0x935e('0x23')][_0x935e('0x2d')]);_0x1b7331['where']=qs['filters'](_[_0x935e('0x2e')](_0x2e041d['query'],_0x26143d[_0x935e('0x25')]),_0x1df27c);if(_0x2e041d[_0x935e('0x23')]['filter']){_0x1b7331[_0x935e('0x2f')]=_[_0x935e('0x30')](_0x1b7331[_0x935e('0x2f')],{'$or':_['map'](_0x1df27c,function(_0xa6b537){if(_0xa6b537[_0x935e('0x21')]!==_0x935e('0x31')){var _0x1be776={};_0x1be776[_0xa6b537[_0x935e('0x1b')]]={'$like':'%'+_0x2e041d[_0x935e('0x23')]['filter']+'%'};return _0x1be776;}})});}_0x1b7331=_['merge']({},_0x1b7331,_0x2e041d[_0x935e('0x32')]);var _0x1bea25={'where':_0x1b7331[_0x935e('0x2f')]};return db[_0x935e('0x1f')][_0x935e('0x12')](_0x1bea25)[_0x935e('0x18')](function(_0x4ce4ec){_0x397862[_0x935e('0x12')]=_0x4ce4ec;if(_0x2e041d[_0x935e('0x23')][_0x935e('0x33')]){_0x1b7331[_0x935e('0x34')]=[{'all':!![]}];}return db['CloudProvider'][_0x935e('0x35')](_0x1b7331);})[_0x935e('0x18')](function(_0x3b38c5){_0x397862['rows']=_[_0x935e('0x36')](_0x3b38c5,function(_0x1ddc38){if(_0x1ddc38[_0x935e('0x37')]==='MicrosoftAzure'){var _0x1f3d73=encryptor['decryptString'](_0x1ddc38[_0x935e('0x38')]);_0x1ddc38['data3']=maskClientSecret(_0x1f3d73);}return _0x1ddc38;});return _0x397862;})[_0x935e('0x18')](respondWithFilteredResult(_0x4b16d8,_0x1b7331))[_0x935e('0x39')](handleError(_0x4b16d8,null));};exports[_0x935e('0x3a')]=function(_0x496a63,_0x4968d4){var _0x3648cb={'raw':!![],'where':{'id':_0x496a63[_0x935e('0x3b')]['id']}},_0x11add0={};_0x11add0[_0x935e('0x28')]=_['keys'](db[_0x935e('0x1f')][_0x935e('0x3c')]);_0x11add0['query']=_['keys'](_0x496a63['query']);_0x11add0[_0x935e('0x25')]=_[_0x935e('0x26')](_0x11add0['model'],_0x11add0[_0x935e('0x23')]);_0x3648cb[_0x935e('0x27')]=_[_0x935e('0x26')](_0x11add0[_0x935e('0x28')],qs[_0x935e('0x29')](_0x496a63[_0x935e('0x23')]['fields']));_0x3648cb[_0x935e('0x27')]=_0x3648cb[_0x935e('0x27')]['length']?_0x3648cb[_0x935e('0x27')]:_0x11add0[_0x935e('0x28')];if(_0x496a63[_0x935e('0x23')][_0x935e('0x33')]){_0x3648cb[_0x935e('0x34')]=[{'all':!![]}];}_0x3648cb=_[_0x935e('0x30')]({},_0x3648cb,_0x496a63[_0x935e('0x32')]);return db[_0x935e('0x1f')][_0x935e('0x3d')](_0x3648cb)[_0x935e('0x18')](handleEntityNotFound(_0x4968d4,null))['then'](function(_0x33fe0c){if(_0x33fe0c[_0x935e('0x37')]==='MicrosoftAzure'){var _0x3c91e2=encryptor[_0x935e('0x3e')](_0x33fe0c['data3']);_0x33fe0c['data3']=maskClientSecret(_0x3c91e2);}return _0x33fe0c;})[_0x935e('0x18')](respondWithResult(_0x4968d4,null))['catch'](handleError(_0x4968d4,null));};exports[_0x935e('0x3f')]=function(_0xeb2b9d,_0x47ca8b){if(!_0xeb2b9d['body'][_0x935e('0x1b')])throw new Error(_0x935e('0x40'));if(!_0xeb2b9d[_0x935e('0x41')][_0x935e('0x37')])throw new Error(_0x935e('0x42'));var _0x27e23f=db[_0x935e('0x1f')][_0x935e('0x3c')][_0x935e('0x37')][_0x935e('0x43')];if(!_0x27e23f[_0x935e('0x44')](_0xeb2b9d[_0x935e('0x41')][_0x935e('0x37')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x27e23f[_0x935e('0x45')](',\x20'));if(_0xeb2b9d[_0x935e('0x41')][_0x935e('0x37')]===_0x935e('0x46')&&_0xeb2b9d[_0x935e('0x41')]['data3']){_0xeb2b9d['body'][_0x935e('0x38')]=encryptor[_0x935e('0x47')](_0xeb2b9d[_0x935e('0x41')][_0x935e('0x38')]);}return db[_0x935e('0x1f')][_0x935e('0x3f')](_0xeb2b9d['body'],{})['then'](respondWithResult(_0x47ca8b,0xc9))['catch'](handleError(_0x47ca8b,null));};exports[_0x935e('0x16')]=function(_0x52842a,_0x2dc697){if(_0x52842a['body']['id']){delete _0x52842a[_0x935e('0x41')]['id'];}return db[_0x935e('0x1f')][_0x935e('0x3d')]({'where':{'id':_0x52842a[_0x935e('0x3b')]['id']}})[_0x935e('0x18')](handleEntityNotFound(_0x2dc697,null))[_0x935e('0x18')](function(_0xc08cd6){if(_0xc08cd6['service']===_0x935e('0x46')&&_0x52842a[_0x935e('0x41')][_0x935e('0x38')]){_0x52842a[_0x935e('0x41')][_0x935e('0x38')]=encryptor[_0x935e('0x47')](_0x52842a[_0x935e('0x41')][_0x935e('0x38')]);}return _0xc08cd6;})[_0x935e('0x18')](saveUpdates(_0x52842a['body'],null))[_0x935e('0x18')](respondWithResult(_0x2dc697,null))[_0x935e('0x39')](handleError(_0x2dc697,null));};exports[_0x935e('0x17')]=function(_0x24eab8,_0x57fbb9){return db[_0x935e('0x1f')]['find']({'where':{'id':_0x24eab8[_0x935e('0x3b')]['id']}})[_0x935e('0x18')](handleEntityNotFound(_0x57fbb9,null))[_0x935e('0x18')](removeEntity(_0x57fbb9,null))[_0x935e('0x39')](handleError(_0x57fbb9,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4f3c9b,_0xcf671e){return db['CloudProvider'][_0x935e('0x48')]({'where':{'id':_0x4f3c9b['params']['id']},'raw':!![]})[_0x935e('0x18')](function(_0x8f568b){if(!_0x8f568b)return _0xcf671e[_0x935e('0xc')](0x194);return{'url':oauth[_0x935e('0x49')](_0x8f568b,_0x4f3c9b[_0x935e('0x4a')]['id'])};})[_0x935e('0x18')](respondWithResult(_0xcf671e,null))[_0x935e('0x39')](handleError(_0xcf671e,null));};exports['oauth2MicrosoftCallback']=function(_0x109193,_0x5d8de7){var _0x2496e7=_0x109193[_0x935e('0x41')];var _0x1385aa;var _0x9eb52;if(_0x2496e7['error'])throw _0x2496e7;redis[_0x935e('0x4b')](_0x2496e7['state'])[_0x935e('0x18')](function(_0x58f91b){if(!_0x58f91b)throw new Error(_0x935e('0x4c'));_0x1385aa=JSON['parse'](_0x58f91b);var _0xbafd4a=Buffer[_0x935e('0x4d')](_0x2496e7['state'],'base64')[_0x935e('0x4e')](_0x935e('0x4f'));_0x9eb52=JSON[_0x935e('0x50')](_0xbafd4a);if(!oauth[_0x935e('0x51')](_0x2496e7[_0x935e('0x52')],_0x1385aa[_0x935e('0x53')]))throw new Error(_0x935e('0x54'));redis[_0x935e('0x55')](_0x2496e7[_0x935e('0x56')]);return oauth['getOauth2MicrosoftAccessToken'](_0x2496e7[_0x935e('0x57')],_0x1385aa);})['then'](function(_0x252e4b){_0x1385aa[_0x935e('0x58')]=_0x252e4b[_0x935e('0x59')];_0x1385aa[_0x935e('0x5a')]=_0x252e4b[_0x935e('0x5b')];return db[_0x935e('0x1f')]['update']({'data5':_0x1385aa[_0x935e('0x58')],'data6':_0x1385aa[_0x935e('0x5a')]},{'where':{'id':_0x1385aa['id']}});})[_0x935e('0x18')](function(){oauth[_0x935e('0x5c')](_0x1385aa);socket[_0x935e('0x5d')](_0x935e('0x5e'),{'id':_0x9eb52['id']});return;})[_0x935e('0x18')](respondWithStatusCode(_0x5d8de7,null))[_0x935e('0x39')](function(_0x132b3f){if(_0x9eb52){socket[_0x935e('0x5d')](_0x935e('0x5f'),{'id':_0x9eb52['id']});}if(!_0x1385aa){logger[_0x935e('0x19')]('Invalid\x20authentication\x20state\x20parameter',_0x132b3f);return _0x5d8de7[_0x935e('0xd')](0x1f4)[_0x935e('0x1c')](_0x132b3f[_0x935e('0x60')]);}logger['error'](_0x935e('0x61'),_0x1385aa['id'],JSON[_0x935e('0x62')](_0x132b3f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ac76ece..b840971 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 _0x136b=['bluebird','rimraf','../../config/environment','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x136b,0x1eb));var _0xb136=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x136b[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xb136('0x0'));var util=require('util');var logger=require(_0xb136('0x1'))(_0xb136('0x2'));var moment=require(_0xb136('0x3'));var BPromise=require(_0xb136('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb136('0x5'));var config=require(_0xb136('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x58c72e,_0x1c4a01){return _0x58c72e['define'](_0xb136('0x7'),attributes,{'tableName':_0xb136('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a3b=['cloud_providers','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider'];(function(_0x2458ad,_0x4d6d89){var _0x2c8f40=function(_0xa67857){while(--_0xa67857){_0x2458ad['push'](_0x2458ad['shift']());}};_0x2c8f40(++_0x4d6d89);}(_0x7a3b,0xdd));var _0xb7a3=function(_0x15d6dc,_0x10b5bb){_0x15d6dc=_0x15d6dc-0x0;var _0x24a69b=_0x7a3b[_0x15d6dc];return _0x24a69b;};'use strict';var _=require(_0xb7a3('0x0'));var util=require('util');var logger=require(_0xb7a3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb7a3('0x2'));var rp=require(_0xb7a3('0x3'));var fs=require('fs');var path=require(_0xb7a3('0x4'));var rimraf=require('rimraf');var config=require(_0xb7a3('0x5'));var attributes=require(_0xb7a3('0x6'));module['exports']=function(_0x2df8b9,_0x82511f){return _0x2df8b9[_0xb7a3('0x7')](_0xb7a3('0x8'),attributes,{'tableName':_0xb7a3('0x9'),'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 b7051a2..e64ec0d 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 _0xfb7d=['data2','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','Dynamics365','push','data7','/.default','join','Outlook365','type','replace','code','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','set','payload','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}'];(function(_0x3f7396,_0x32395b){var _0x19fea7=function(_0x56d188){while(--_0x56d188){_0x3f7396['push'](_0x3f7396['shift']());}};_0x19fea7(++_0x32395b);}(_0xfb7d,0xa3));var _0xdfb7=function(_0x2fe46e,_0x5e041f){_0x2fe46e=_0x2fe46e-0x0;var _0x226f6=_0xfb7d[_0x2fe46e];return _0x226f6;};'use strict';var _=require(_0xdfb7('0x0'));var crypto=require('crypto');var jwt=require(_0xdfb7('0x1'));var moment=require(_0xdfb7('0x2'));var Redis=require(_0xdfb7('0x3'));var rp=require(_0xdfb7('0x4'));var util=require(_0xdfb7('0x5'));var encryptor=require(_0xdfb7('0x6'));var config=require('../../config/environment');var logger=require(_0xdfb7('0x7'))(_0xdfb7('0x8'));var schedule=require(_0xdfb7('0x9'));var db=require(_0xdfb7('0xa'))['db'];config[_0xdfb7('0xb')]=_['defaults'](config[_0xdfb7('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xdfb7('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xdfb7('0xd'),_0xdfb7('0xe'),'email',_0xdfb7('0xf'),_0xdfb7('0x10'),_0xdfb7('0x11'),_0xdfb7('0x12')],'Dynamics365':[_0xdfb7('0xd'),_0xdfb7('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2116cd){var _0x4777f3=_[_0xdfb7('0x13')](AZURE_AUTH_SCOPES[_0x2116cd['type']]);if(_0x2116cd['type']===_0xdfb7('0x14'))_0x4777f3[_0xdfb7('0x15')](_0x2116cd[_0xdfb7('0x16')]+_0xdfb7('0x17'));return _0x4777f3[_0xdfb7('0x18')]('\x20');}function getAccessTokenScope(_0x5ad687){if(_0x5ad687['type']===_0xdfb7('0x19'))return _0xdfb7('0x10');if(_0x5ad687[_0xdfb7('0x1a')]==='Dynamics365')return _0x5ad687[_0xdfb7('0x16')]+_0xdfb7('0x17');}function generateMicrosoftAuthorizationUrl(_0x39be36,_0x4f6af7){var _0x2783f7=MICROSOFT_AUTH_URL[_0xdfb7('0x1b')]('{TENANT_ID}',_0x39be36['data2']);var _0x4fdec5=[_0xdfb7('0x1c'),'id_token'];var _0x23b9e1=Buffer['from'](JSON[_0xdfb7('0x1d')]({'id':_0x4f6af7}))[_0xdfb7('0x1e')](_0xdfb7('0x1f'));var _0x479afc=crypto[_0xdfb7('0x20')](0x10)[_0xdfb7('0x1e')](_0xdfb7('0x21'));var _0xa07b50=getAuthorizationScopes(_0x39be36);var _0x468eec=[{'key':_0xdfb7('0x22'),'value':_0x39be36[_0xdfb7('0x23')]},{'key':_0xdfb7('0x24'),'value':encodeURIComponent(_0x4fdec5['join']('\x20'))},{'key':_0xdfb7('0x25'),'value':_0x39be36[_0xdfb7('0x26')]},{'key':_0xdfb7('0x27'),'value':'form_post'},{'key':_0xdfb7('0x28'),'value':encodeURIComponent(_0xa07b50)},{'key':_0xdfb7('0x29'),'value':_0x23b9e1},{'key':_0xdfb7('0x2a'),'value':_0x479afc},{'key':_0xdfb7('0x2b'),'value':_0xdfb7('0x2c')}];var _0x404f60=_0x2783f7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdfb7('0x13')](_0x468eec,function(_0x1be107){return _0x1be107[_0xdfb7('0x2d')]+'='+_0x1be107['value'];})[_0xdfb7('0x18')]('&');_0x39be36[_0xdfb7('0x2e')]={'issuer':_0x2783f7['replace'](_0xdfb7('0x2f'),''),'audience':_0x39be36[_0xdfb7('0x23')],'state':_0x23b9e1,'nonce':_0x479afc};redis[_0xdfb7('0x30')](_0x23b9e1,JSON[_0xdfb7('0x1d')](_0x39be36));return _0x404f60;}function isValidIdToken(_0x2a1e67,_0x36d11e){try{var _0xb8ccdb=jwt['decode'](_0x2a1e67,{'complete':!![]});var _0x55a462=_0xb8ccdb[_0xdfb7('0x31')];if(_0x55a462['iss']!==_0x36d11e['issuer'])return![];if(_0x55a462[_0xdfb7('0x32')]!==_0x36d11e[_0xdfb7('0x33')])return![];if(_0x55a462[_0xdfb7('0x2a')]!==_0x36d11e[_0xdfb7('0x2a')])return![];if(moment()[_0xdfb7('0x34')](moment[_0xdfb7('0x35')](_0x55a462[_0xdfb7('0x36')])))return![];return!![];}catch(_0x5cb3ec){throw _0x5cb3ec;}}function refreshOauth2MicrosoftAccessToken(_0x3a49fc){return Promise[_0xdfb7('0x37')]()[_0xdfb7('0x38')](function(){if(_0x3a49fc[_0xdfb7('0x39')])return _0x3a49fc;return db[_0xdfb7('0x3a')][_0xdfb7('0x3b')]({'where':{'id':_0x3a49fc['id']},'raw':!![]});})['then'](function(_0x3018e4){var _0x3468f2={'grant_type':_0xdfb7('0x3c'),'refresh_token':_0x3018e4[_0xdfb7('0x3d')],'scope':getAccessTokenScope(_0x3018e4),'redirect_uri':_0x3018e4[_0xdfb7('0x26')],'client_id':_0x3018e4[_0xdfb7('0x23')],'client_secret':encryptor[_0xdfb7('0x3e')](_0x3018e4[_0xdfb7('0x39')])};var _0xb8e1f5={'method':_0xdfb7('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xdfb7('0x40'),_0x3018e4[_0xdfb7('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3468f2,'json':!![]};return rp(_0xb8e1f5);})['then'](function(_0x593626){_0x3a49fc['data5']=_0x593626['access_token'];_0x3a49fc[_0xdfb7('0x3d')]=_0x593626['refresh_token'];return db['CloudProvider']['update']({'data5':_0x3a49fc[_0xdfb7('0x42')],'data6':_0x3a49fc[_0xdfb7('0x3d')]},{'where':{'id':_0x3a49fc['id']}});})[_0xdfb7('0x38')](function(){return _0x3a49fc;})['catch'](function(_0x310b4f){logger[_0xdfb7('0x43')](_0xdfb7('0x44'),_0x3a49fc['id'],_0x310b4f);});}function getOauth2MicrosoftAccessToken(_0x29a9dc,_0x292e1e){var _0x27184a={'grant_type':_0xdfb7('0x45'),'code':_0x29a9dc,'scope':getAccessTokenScope(_0x292e1e),'redirect_uri':_0x292e1e['data4'],'client_id':_0x292e1e[_0xdfb7('0x23')],'client_secret':encryptor[_0xdfb7('0x3e')](_0x292e1e['data3'])};var _0x44521e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xdfb7('0x1b')]('{TENANT_ID}',_0x292e1e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x27184a,'json':!![]};return rp(_0x44521e);}function startRefreshInterval(_0x45c741){var _0x5c0a9d=schedule[_0xdfb7('0x46')];if(_0x5c0a9d[_0x45c741['id']])clearInterval(_0x5c0a9d[_0x45c741['id']]);_0x5c0a9d[_0x45c741['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xdfb7('0x47')](this,{'id':_0x45c741['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5c0a9d;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xdfb7('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xdfb7('0x38')](function(_0x56d33b){var _0x4f41de=_0x56d33b['map'](function(_0x4bc4c7){return refreshOauth2MicrosoftAccessToken(_0x4bc4c7)[_0xdfb7('0x38')](function(_0x47e85a){startRefreshInterval(_0x47e85a);});});return Promise['all'](_0x4f41de);})[_0xdfb7('0x49')](function(_0x3e6046){var _0x3609cf=_0x3e6046?util['inspect'](_0x3e6046,{'showHidden':![],'depth':null}):'';logger[_0xdfb7('0x43')](_0xdfb7('0x4a'),_0x3609cf);});}module[_0xdfb7('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x6e3b=['data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','client_id','data1','response_type','data4','response_mode','form_post','state','nonce','prompt','key','value','oauth2Claims','oauth2/','set','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','data3','findOne','then','refresh_token','data6','decryptString','POST','access_token','CloudProvider','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','map','all','inspect','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','type','Dynamics365','push'];(function(_0x383aec,_0xf84268){var _0x556b35=function(_0xc87138){while(--_0xc87138){_0x383aec['push'](_0x383aec['shift']());}};_0x556b35(++_0xf84268);}(_0x6e3b,0x17b));var _0xb6e3=function(_0x37fc4a,_0x10a2a7){_0x37fc4a=_0x37fc4a-0x0;var _0x3d07d7=_0x6e3b[_0x37fc4a];return _0x3d07d7;};'use strict';var _=require(_0xb6e3('0x0'));var crypto=require(_0xb6e3('0x1'));var jwt=require(_0xb6e3('0x2'));var moment=require(_0xb6e3('0x3'));var Redis=require(_0xb6e3('0x4'));var rp=require(_0xb6e3('0x5'));var util=require(_0xb6e3('0x6'));var encryptor=require(_0xb6e3('0x7'));var config=require(_0xb6e3('0x8'));var logger=require(_0xb6e3('0x9'))(_0xb6e3('0xa'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xb6e3('0xb'))['db'];config[_0xb6e3('0xc')]=_[_0xb6e3('0xd')](config[_0xb6e3('0xc')],{'host':_0xb6e3('0xe'),'port':0x18eb});var redis=new Redis(config[_0xb6e3('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb6e3('0xf'),_0xb6e3('0x10'),'offline_access',_0xb6e3('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0xb6e3('0x12')],'Dynamics365':[_0xb6e3('0x13'),_0xb6e3('0x14')]};var MICROSOFT_AUTH_ENDPOINT=_0xb6e3('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xb6e3('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3289c9){var _0x5d1c68=_['map'](AZURE_AUTH_SCOPES[_0x3289c9[_0xb6e3('0x17')]]);if(_0x3289c9[_0xb6e3('0x17')]===_0xb6e3('0x18'))_0x5d1c68[_0xb6e3('0x19')](_0x3289c9[_0xb6e3('0x1a')]+_0xb6e3('0x1b'));return _0x5d1c68[_0xb6e3('0x1c')]('\x20');}function getAccessTokenScope(_0xf9cff){if(_0xf9cff[_0xb6e3('0x17')]===_0xb6e3('0x1d'))return _0xb6e3('0x11');if(_0xf9cff[_0xb6e3('0x17')]===_0xb6e3('0x18'))return _0xf9cff['data7']+_0xb6e3('0x1b');}function generateMicrosoftAuthorizationUrl(_0x2cda80,_0x2b7910){var _0x3929ef=MICROSOFT_AUTH_URL[_0xb6e3('0x1e')](_0xb6e3('0x1f'),_0x2cda80[_0xb6e3('0x20')]);var _0x11602a=['code',_0xb6e3('0x21')];var _0x28fa02=Buffer[_0xb6e3('0x22')](JSON[_0xb6e3('0x23')]({'id':_0x2b7910}))[_0xb6e3('0x24')](_0xb6e3('0x25'));var _0x28b32b=crypto['randomBytes'](0x10)[_0xb6e3('0x24')]('hex');var _0x2ac9f1=getAuthorizationScopes(_0x2cda80);var _0x13c061=[{'key':_0xb6e3('0x26'),'value':_0x2cda80[_0xb6e3('0x27')]},{'key':_0xb6e3('0x28'),'value':encodeURIComponent(_0x11602a[_0xb6e3('0x1c')]('\x20'))},{'key':'redirect_uri','value':_0x2cda80[_0xb6e3('0x29')]},{'key':_0xb6e3('0x2a'),'value':_0xb6e3('0x2b')},{'key':'scope','value':encodeURIComponent(_0x2ac9f1)},{'key':_0xb6e3('0x2c'),'value':_0x28fa02},{'key':_0xb6e3('0x2d'),'value':_0x28b32b},{'key':_0xb6e3('0x2e'),'value':'login'}];var _0xa94c5d=_0x3929ef+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x13c061,function(_0x1d6061){return _0x1d6061[_0xb6e3('0x2f')]+'='+_0x1d6061[_0xb6e3('0x30')];})[_0xb6e3('0x1c')]('&');_0x2cda80[_0xb6e3('0x31')]={'issuer':_0x3929ef['replace'](_0xb6e3('0x32'),''),'audience':_0x2cda80[_0xb6e3('0x27')],'state':_0x28fa02,'nonce':_0x28b32b};redis[_0xb6e3('0x33')](_0x28fa02,JSON[_0xb6e3('0x23')](_0x2cda80));return _0xa94c5d;}function isValidIdToken(_0x5eb2e0,_0x4239d4){try{var _0x572b10=jwt[_0xb6e3('0x34')](_0x5eb2e0,{'complete':!![]});var _0x447eb6=_0x572b10[_0xb6e3('0x35')];if(_0x447eb6['iss']!==_0x4239d4[_0xb6e3('0x36')])return![];if(_0x447eb6[_0xb6e3('0x37')]!==_0x4239d4[_0xb6e3('0x38')])return![];if(_0x447eb6[_0xb6e3('0x2d')]!==_0x4239d4[_0xb6e3('0x2d')])return![];if(moment()[_0xb6e3('0x39')](moment[_0xb6e3('0x3a')](_0x447eb6[_0xb6e3('0x3b')])))return![];return!![];}catch(_0x139fd4){throw _0x139fd4;}}function refreshOauth2MicrosoftAccessToken(_0xc99f8d){return Promise[_0xb6e3('0x3c')]()['then'](function(){if(_0xc99f8d[_0xb6e3('0x3d')])return _0xc99f8d;return db['CloudProvider'][_0xb6e3('0x3e')]({'where':{'id':_0xc99f8d['id']},'raw':!![]});})[_0xb6e3('0x3f')](function(_0x4373e9){var _0x182651={'grant_type':_0xb6e3('0x40'),'refresh_token':_0x4373e9[_0xb6e3('0x41')],'scope':getAccessTokenScope(_0x4373e9),'redirect_uri':_0x4373e9[_0xb6e3('0x29')],'client_id':_0x4373e9['data1'],'client_secret':encryptor[_0xb6e3('0x42')](_0x4373e9[_0xb6e3('0x3d')])};var _0x577929={'method':_0xb6e3('0x43'),'uri':MICROSOFT_AUTH_URL[_0xb6e3('0x1e')](_0xb6e3('0x1f'),_0x4373e9[_0xb6e3('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x182651,'json':!![]};return rp(_0x577929);})['then'](function(_0x295779){_0xc99f8d['data5']=_0x295779[_0xb6e3('0x44')];_0xc99f8d[_0xb6e3('0x41')]=_0x295779[_0xb6e3('0x40')];return db[_0xb6e3('0x45')][_0xb6e3('0x46')]({'data5':_0xc99f8d[_0xb6e3('0x47')],'data6':_0xc99f8d[_0xb6e3('0x41')]},{'where':{'id':_0xc99f8d['id']}});})[_0xb6e3('0x3f')](function(){return _0xc99f8d;})['catch'](function(_0x13d197){logger[_0xb6e3('0x48')](_0xb6e3('0x49'),_0xc99f8d['id'],_0x13d197);});}function getOauth2MicrosoftAccessToken(_0x3d1900,_0x113d30){var _0x12ed4c={'grant_type':'authorization_code','code':_0x3d1900,'scope':getAccessTokenScope(_0x113d30),'redirect_uri':_0x113d30[_0xb6e3('0x29')],'client_id':_0x113d30['data1'],'client_secret':encryptor[_0xb6e3('0x42')](_0x113d30[_0xb6e3('0x3d')])};var _0x14c1c9={'method':_0xb6e3('0x43'),'uri':MICROSOFT_AUTH_URL[_0xb6e3('0x1e')]('{TENANT_ID}',_0x113d30[_0xb6e3('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12ed4c,'json':!![]};return rp(_0x14c1c9);}function startRefreshInterval(_0x6c18c){var _0x5f5b25=schedule[_0xb6e3('0x4a')];if(_0x5f5b25[_0x6c18c['id']])clearInterval(_0x5f5b25[_0x6c18c['id']]);_0x5f5b25[_0x6c18c['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb6e3('0x4b')](this,{'id':_0x6c18c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb6e3('0x4a')]=_0x5f5b25;}function startAllRefreshIntervals(){return db[_0xb6e3('0x45')][_0xb6e3('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb6e3('0x3f')](function(_0x39aa74){var _0x289a60=_0x39aa74[_0xb6e3('0x4d')](function(_0x4bd95c){return refreshOauth2MicrosoftAccessToken(_0x4bd95c)[_0xb6e3('0x3f')](function(_0x509767){startRefreshInterval(_0x509767);});});return Promise[_0xb6e3('0x4e')](_0x289a60);})['catch'](function(_0x4114a7){var _0x345990=_0x4114a7?util[_0xb6e3('0x4f')](_0x4114a7,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x345990);});}module[_0xb6e3('0x50')]={'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 8c7c5cd..c8d14e1 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 _0x4b74=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x4b74,0x103));var _0x44b7=function(_0x54a9b7,_0x216841){_0x54a9b7=_0x54a9b7-0x0;var _0xc00ec4=_0x4b74[_0x54a9b7];return _0xc00ec4;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var moment=require(_0x44b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x44b7('0x3'));var fs=require('fs');var Redis=require(_0x44b7('0x4'));var db=require(_0x44b7('0x5'))['db'];var utils=require(_0x44b7('0x6'));var logger=require(_0x44b7('0x7'))(_0x44b7('0x8'));var config=require(_0x44b7('0x9'));var jayson=require(_0x44b7('0xa'));var client=jayson['client'][_0x44b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2174f2,_0x7b80e9,_0x4a582b){return new BPromise(function(_0x45dfbe,_0xabf05c){return client[_0x44b7('0xc')](_0x2174f2,_0x4a582b)['then'](function(_0x7d4b17){logger[_0x44b7('0xd')]('CloudProvider,\x20%s,\x20%s',_0x7b80e9,_0x44b7('0xe'));logger[_0x44b7('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x7b80e9,_0x44b7('0xe'),JSON[_0x44b7('0x10')](_0x7d4b17));if(_0x7d4b17[_0x44b7('0x11')]){if(_0x7d4b17['error'][_0x44b7('0x12')]===0x1f4){logger[_0x44b7('0x11')]('CloudProvider,\x20%s,\x20%s',_0x7b80e9,_0x7d4b17[_0x44b7('0x11')]['message']);return _0xabf05c(_0x7d4b17[_0x44b7('0x11')][_0x44b7('0x13')]);}logger[_0x44b7('0x11')]('CloudProvider,\x20%s,\x20%s',_0x7b80e9,_0x7d4b17['error'][_0x44b7('0x13')]);return _0x45dfbe(_0x7d4b17['error']['message']);}else{logger['info'](_0x44b7('0x14'),_0x7b80e9,_0x44b7('0xe'));_0x45dfbe(_0x7d4b17['result'][_0x44b7('0x13')]);}})[_0x44b7('0x15')](function(_0x3528c8){logger[_0x44b7('0x11')](_0x44b7('0x14'),_0x7b80e9,_0x3528c8);_0xabf05c(_0x3528c8);});});} \ No newline at end of file +var _0x5204=['rpc','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5204,0xdf));var _0x4520=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0x5204[_0x3c6b7d];return _0x1d3ed2;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f7e897f..07eb207 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x1261,0x144));var _0x1126=function(_0x558615,_0x1eb496){_0x558615=_0x558615-0x0;var _0x1e032a=_0x1261[_0x558615];return _0x1e032a;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x3e243c,_0x5eb47d){var _0x2c6aad=function(_0x2d540a){while(--_0x2d540a){_0x3e243c['push'](_0x3e243c['shift']());}};_0x2c6aad(++_0x5eb47d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a500f4b..520cde3 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 _0xfe78=['name','exports','STRING'];(function(_0x564104,_0x74c357){var _0x6dabcd=function(_0x1b3d56){while(--_0x1b3d56){_0x564104['push'](_0x564104['shift']());}};_0x6dabcd(++_0x74c357);}(_0xfe78,0x70));var _0x8fe7=function(_0x4c2c04,_0x5e38cf){_0x4c2c04=_0x4c2c04-0x0;var _0x2e7e99=_0xfe78[_0x4c2c04];return _0x2e7e99;};'use strict';var Sequelize=require('sequelize');module[_0x8fe7('0x0')]={'name':{'type':Sequelize[_0x8fe7('0x1')],'unique':_0x8fe7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x8fe7('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8fe7('0x1')]},'type':{'type':Sequelize[_0x8fe7('0x1')]},'street':{'type':Sequelize[_0x8fe7('0x1')]},'postalCode':{'type':Sequelize[_0x8fe7('0x1')]},'city':{'type':Sequelize[_0x8fe7('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8fe7('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8fe7('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8fe7('0x1')]}}; \ No newline at end of file +var _0x8962=['STRING','name','exports'];(function(_0x48ca33,_0x5f27bc){var _0x267d1a=function(_0x489d0c){while(--_0x489d0c){_0x48ca33['push'](_0x48ca33['shift']());}};_0x267d1a(++_0x5f27bc);}(_0x8962,0x1e2));var _0x2896=function(_0x34d8b0,_0x1a26ef){_0x34d8b0=_0x34d8b0-0x0;var _0x4c93ab=_0x8962[_0x34d8b0];return _0x4c93ab;};'use strict';var Sequelize=require('sequelize');module[_0x2896('0x0')]={'name':{'type':Sequelize[_0x2896('0x1')],'unique':_0x2896('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2896('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x2896('0x1')]},'phone':{'type':Sequelize[_0x2896('0x1')]},'fax':{'type':Sequelize[_0x2896('0x1')]},'type':{'type':Sequelize[_0x2896('0x1')]},'street':{'type':Sequelize[_0x2896('0x1')]},'postalCode':{'type':Sequelize[_0x2896('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2896('0x1')]},'email':{'type':Sequelize[_0x2896('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x2896('0x1')]},'sCity':{'type':Sequelize[_0x2896('0x1')]},'sCountry':{'type':Sequelize[_0x2896('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fea23ef..685f9c9 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 _0x92be=['getContacts','findOne','order','map','options','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','rows','catch','show','rawAttributes','keys','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids'];(function(_0x4c9ed,_0x4357e1){var _0x49427b=function(_0x7b6da6){while(--_0x7b6da6){_0x4c9ed['push'](_0x4c9ed['shift']());}};_0x49427b(++_0x4357e1);}(_0x92be,0x107));var _0xe92b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x92be[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xe92b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe92b('0x1'));var jsonpatch=require(_0xe92b('0x2'));var rp=require(_0xe92b('0x3'));var moment=require('moment');var BPromise=require(_0xe92b('0x4'));var Mustache=require(_0xe92b('0x5'));var util=require(_0xe92b('0x6'));var path=require(_0xe92b('0x7'));var sox=require(_0xe92b('0x8'));var csv=require(_0xe92b('0x9'));var ejs=require(_0xe92b('0xa'));var fs=require('fs');var fs_extra=require(_0xe92b('0xb'));var _=require(_0xe92b('0xc'));var squel=require(_0xe92b('0xd'));var crypto=require('crypto');var jsforce=require(_0xe92b('0xe'));var deskjs=require(_0xe92b('0xf'));var toCsv=require(_0xe92b('0x9'));var querystring=require('querystring');var Papa=require(_0xe92b('0x10'));var Redis=require(_0xe92b('0x11'));var authService=require(_0xe92b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe92b('0x13'));var logger=require('../../config/logger')(_0xe92b('0x14'));var utils=require(_0xe92b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe92b('0x16'));var db=require(_0xe92b('0x17'))['db'];function respondWithStatusCode(_0x31d5f4,_0x42b311){_0x42b311=_0x42b311||0xcc;return function(_0x5780f5){if(_0x5780f5){return _0x31d5f4[_0xe92b('0x18')](_0x42b311);}return _0x31d5f4[_0xe92b('0x19')](_0x42b311)['end']();};}function respondWithResult(_0x41c769,_0x4afeb1){_0x4afeb1=_0x4afeb1||0xc8;return function(_0x5f191e){if(_0x5f191e){return _0x41c769['status'](_0x4afeb1)[_0xe92b('0x1a')](_0x5f191e);}};}function respondWithFilteredResult(_0x17f6f6,_0x24d8b5){return function(_0x296ea6){if(_0x296ea6){var _0x424973=typeof _0x24d8b5['offset']==='undefined'&&typeof _0x24d8b5[_0xe92b('0x1b')]===_0xe92b('0x1c');var _0x19f84c=_0x296ea6[_0xe92b('0x1d')];var _0x58adba=_0x424973?0x0:_0x24d8b5[_0xe92b('0x1e')];var _0xe6d076=_0x424973?_0x296ea6[_0xe92b('0x1d')]:_0x24d8b5[_0xe92b('0x1e')]+_0x24d8b5[_0xe92b('0x1b')];var _0x133168;if(_0xe6d076>=_0x19f84c){_0xe6d076=_0x19f84c;_0x133168=0xc8;}else{_0x133168=0xce;}_0x17f6f6['status'](_0x133168);return _0x17f6f6[_0xe92b('0x1f')](_0xe92b('0x20'),_0x58adba+'-'+_0xe6d076+'/'+_0x19f84c)['json'](_0x296ea6);}return null;};}function patchUpdates(_0x5ecd53){return function(_0x250f8c){try{jsonpatch[_0xe92b('0x21')](_0x250f8c,_0x5ecd53,!![]);}catch(_0x280b7f){return BPromise[_0xe92b('0x22')](_0x280b7f);}return _0x250f8c['save']();};}function saveUpdates(_0x42d6f6,_0x395b01){return function(_0x477786){if(_0x477786){return _0x477786[_0xe92b('0x23')](_0x42d6f6)[_0xe92b('0x24')](function(_0x4ebd96){return _0x4ebd96;});}return null;};}function removeEntity(_0x518ae3,_0x26b6e9){return function(_0x291edc){if(_0x291edc){return _0x291edc[_0xe92b('0x25')]()[_0xe92b('0x24')](function(){var _0x176819=_0x291edc[_0xe92b('0x26')]({'plain':!![]});var _0x4aa530=_0xe92b('0x27');return db[_0xe92b('0x28')]['destroy']({'where':{'type':_0x4aa530,'resourceId':_0x176819['id']}})['then'](function(){return _0x291edc;});})[_0xe92b('0x24')](function(){_0x518ae3[_0xe92b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144ec5,_0x3ad8c1){return function(_0x7435f0){if(!_0x7435f0){_0x144ec5['sendStatus'](0x194);}return _0x7435f0;};}function handleError(_0x412bdc,_0x289cdd){_0x289cdd=_0x289cdd||0x1f4;return function(_0x296e12){logger[_0xe92b('0x29')](_0x296e12[_0xe92b('0x2a')]);if(_0x296e12[_0xe92b('0x2b')]){delete _0x296e12[_0xe92b('0x2b')];}_0x412bdc['status'](_0x289cdd)[_0xe92b('0x2c')](_0x296e12);};}exports['index']=function(_0x44175d,_0x4c23eb){var _0x28799a={},_0x5e1f2d={},_0x2633d1={'count':0x0,'rows':[]};return db[_0xe92b('0x2d')][_0xe92b('0x2e')]()[_0xe92b('0x24')](function(_0x45a8bf){_0x5e1f2d['model']=_['keys'](_0x45a8bf);_0x5e1f2d['query']=_['keys'](_0x44175d[_0xe92b('0x2f')]);_0x5e1f2d[_0xe92b('0x30')]=_['intersection'](_0x5e1f2d[_0xe92b('0x31')],_0x5e1f2d['query']);_0x28799a[_0xe92b('0x32')]=_[_0xe92b('0x33')](_0x5e1f2d[_0xe92b('0x31')],qs[_0xe92b('0x34')](_0x44175d[_0xe92b('0x2f')][_0xe92b('0x34')]));_0x28799a['attributes']=_0x28799a[_0xe92b('0x32')]['length']?_0x28799a[_0xe92b('0x32')]:_0x5e1f2d[_0xe92b('0x31')];if(!_0x44175d[_0xe92b('0x2f')][_0xe92b('0x35')](_0xe92b('0x36'))){_0x28799a[_0xe92b('0x1b')]=qs[_0xe92b('0x1b')](_0x44175d['query']['limit']);_0x28799a[_0xe92b('0x1e')]=qs['offset'](_0x44175d[_0xe92b('0x2f')]['offset']);}_0x28799a['order']=qs[_0xe92b('0x37')](_0x44175d['query']['sort']);_0x28799a['where']=qs[_0xe92b('0x30')](_[_0xe92b('0x38')](_0x44175d[_0xe92b('0x2f')],_0x5e1f2d[_0xe92b('0x30')]),_0x45a8bf);if(_0x44175d[_0xe92b('0x2f')][_0xe92b('0x39')]){_0x28799a[_0xe92b('0x3a')]=_[_0xe92b('0x3b')](_0x28799a['where'],{'$or':_['map'](_0x28799a[_0xe92b('0x32')],function(_0x2e7d4d){var _0x463552={};_0x463552[_0x2e7d4d]={'$like':'%'+_0x44175d[_0xe92b('0x2f')][_0xe92b('0x39')]+'%'};return _0x463552;})});}_0x28799a=_[_0xe92b('0x3b')]({},_0x28799a,_0x44175d['options']);var _0x35c35a={'where':_0x28799a[_0xe92b('0x3a')]};return db[_0xe92b('0x2d')][_0xe92b('0x1d')](_0x35c35a)[_0xe92b('0x24')](function(_0x4b7b98){_0x2633d1[_0xe92b('0x1d')]=_0x4b7b98;if(_0x44175d[_0xe92b('0x2f')][_0xe92b('0x3c')]){_0x28799a['include']=[{'all':!![]}];}return db[_0xe92b('0x2d')]['findAll'](_0x28799a);})[_0xe92b('0x24')](function(_0x30c89d){_0x2633d1[_0xe92b('0x3d')]=_0x30c89d;return _0x2633d1;})['then'](respondWithFilteredResult(_0x4c23eb,_0x28799a))[_0xe92b('0x3e')](handleError(_0x4c23eb,null));})['catch'](handleError(_0x4c23eb,null));};exports[_0xe92b('0x3f')]=function(_0x7bce32,_0x380ccb){var _0x5aa0c7={'raw':![],'where':{'id':_0x7bce32['params']['id']}},_0x4c3ac4={};_0x4c3ac4[_0xe92b('0x31')]=_['keys'](db[_0xe92b('0x2d')][_0xe92b('0x40')]);_0x4c3ac4[_0xe92b('0x2f')]=_[_0xe92b('0x41')](_0x7bce32['query']);_0x4c3ac4[_0xe92b('0x30')]=_[_0xe92b('0x33')](_0x4c3ac4[_0xe92b('0x31')],_0x4c3ac4['query']);_0x5aa0c7[_0xe92b('0x32')]=_[_0xe92b('0x33')](_0x4c3ac4[_0xe92b('0x31')],qs[_0xe92b('0x34')](_0x7bce32[_0xe92b('0x2f')][_0xe92b('0x34')]));_0x5aa0c7[_0xe92b('0x32')]=_0x5aa0c7[_0xe92b('0x32')][_0xe92b('0x42')]?_0x5aa0c7[_0xe92b('0x32')]:_0x4c3ac4['model'];if(_0x7bce32[_0xe92b('0x2f')][_0xe92b('0x3c')]){_0x5aa0c7[_0xe92b('0x43')]=[{'all':!![]}];}_0x5aa0c7=_[_0xe92b('0x3b')]({},_0x5aa0c7,_0x7bce32['options']);return db[_0xe92b('0x2d')][_0xe92b('0x44')](_0x5aa0c7)['then'](handleEntityNotFound(_0x380ccb,null))['then'](respondWithResult(_0x380ccb,null))[_0xe92b('0x3e')](handleError(_0x380ccb,null));};exports['create']=function(_0x8d38fb,_0x3f3760){return db[_0xe92b('0x2d')][_0xe92b('0x45')](_0x8d38fb['body'],{})[_0xe92b('0x24')](function(_0x210426){var _0x3c0c96=_0x8d38fb[_0xe92b('0x46')]['get']({'plain':!![]});if(!_0x3c0c96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c0c96[_0xe92b('0x47')]===_0xe92b('0x46')){var _0xd9cbf5=_0x210426[_0xe92b('0x26')]({'plain':!![]});var _0x164ad3=_0xe92b('0x27');return db[_0xe92b('0x48')][_0xe92b('0x44')]({'where':{'name':_0x164ad3,'userProfileId':_0x3c0c96[_0xe92b('0x49')]},'raw':!![]})[_0xe92b('0x24')](function(_0xbf1685){if(_0xbf1685&&_0xbf1685[_0xe92b('0x4a')]===0x0){return db[_0xe92b('0x28')]['create']({'name':_0xd9cbf5[_0xe92b('0x2b')],'resourceId':_0xd9cbf5['id'],'type':_0xbf1685[_0xe92b('0x2b')],'sectionId':_0xbf1685['id']},{})[_0xe92b('0x24')](function(){return _0x210426;});}else{return _0x210426;}})[_0xe92b('0x3e')](function(_0x13c5e1){logger[_0xe92b('0x29')](_0xe92b('0x4b'),_0x13c5e1);throw _0x13c5e1;});}return _0x210426;})[_0xe92b('0x24')](respondWithResult(_0x3f3760,0xc9))[_0xe92b('0x3e')](handleError(_0x3f3760,null));};exports[_0xe92b('0x23')]=function(_0x4212f3,_0x205bf5){if(_0x4212f3[_0xe92b('0x4c')]['id']){delete _0x4212f3[_0xe92b('0x4c')]['id'];}return db[_0xe92b('0x2d')][_0xe92b('0x44')]({'where':{'id':_0x4212f3[_0xe92b('0x4d')]['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x205bf5,null))[_0xe92b('0x24')](saveUpdates(_0x4212f3[_0xe92b('0x4c')],null))['then'](respondWithResult(_0x205bf5,null))[_0xe92b('0x3e')](handleError(_0x205bf5,null));};exports[_0xe92b('0x25')]=function(_0x288678,_0x14b593){return db[_0xe92b('0x2d')][_0xe92b('0x44')]({'where':{'id':_0x288678['params']['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x14b593,null))[_0xe92b('0x24')](removeEntity(_0x14b593,null))[_0xe92b('0x3e')](handleError(_0x14b593,null));};exports[_0xe92b('0x2e')]=function(_0x3eac60,_0x535f88){return db[_0xe92b('0x2d')]['describe']()[_0xe92b('0x24')](respondWithResult(_0x535f88,null))[_0xe92b('0x3e')](handleError(_0x535f88,null));};exports[_0xe92b('0x4e')]=function(_0x1bf1b2,_0x35c72b,_0x257d92){return db[_0xe92b('0x4f')]['find']({'where':{'id':_0x1bf1b2['params']['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x35c72b,null))[_0xe92b('0x24')](function(_0x109506){if(_0x109506){return _0x109506[_0xe92b('0x4e')](_0x1bf1b2[_0xe92b('0x4c')][_0xe92b('0x50')],_['omit'](_0x1bf1b2[_0xe92b('0x4c')],[_0xe92b('0x50'),'id'])||{});}})['then'](respondWithResult(_0x35c72b,null))['catch'](handleError(_0x35c72b,null));};exports[_0xe92b('0x51')]=function(_0x3884ae,_0x591ee2,_0x3f9c93){var _0x4c34ae={};var _0x10d909={};var _0x2ba4aa;var _0x3c069a;return db['CmCompany'][_0xe92b('0x52')]({'where':{'id':_0x3884ae[_0xe92b('0x4d')]['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x591ee2,null))['then'](function(_0x506009){if(_0x506009){_0x2ba4aa=_0x506009;_0x10d909[_0xe92b('0x31')]=_[_0xe92b('0x41')](db[_0xe92b('0x4f')][_0xe92b('0x40')]);_0x10d909[_0xe92b('0x2f')]=_[_0xe92b('0x41')](_0x3884ae[_0xe92b('0x2f')]);_0x10d909[_0xe92b('0x30')]=_[_0xe92b('0x33')](_0x10d909[_0xe92b('0x31')],_0x10d909[_0xe92b('0x2f')]);_0x4c34ae[_0xe92b('0x32')]=_[_0xe92b('0x33')](_0x10d909[_0xe92b('0x31')],qs[_0xe92b('0x34')](_0x3884ae['query']['fields']));_0x4c34ae['attributes']=_0x4c34ae[_0xe92b('0x32')]['length']?_0x4c34ae[_0xe92b('0x32')]:_0x10d909[_0xe92b('0x31')];_0x4c34ae[_0xe92b('0x53')]=qs['sort'](_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x37')]);_0x4c34ae[_0xe92b('0x3a')]=qs[_0xe92b('0x30')](_['pick'](_0x3884ae[_0xe92b('0x2f')],_0x10d909['filters']));if(_0x3884ae['query'][_0xe92b('0x39')]){_0x4c34ae[_0xe92b('0x3a')]=_[_0xe92b('0x3b')](_0x4c34ae['where'],{'$or':_[_0xe92b('0x54')](_0x4c34ae[_0xe92b('0x32')],function(_0x34627a){var _0x29b01b={};_0x29b01b[_0x34627a]={'$like':'%'+_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x39')]+'%'};return _0x29b01b;})});}_0x4c34ae=_['merge']({},_0x4c34ae,_0x3884ae[_0xe92b('0x55')]);return _0x2ba4aa[_0xe92b('0x51')](_0x4c34ae);}})[_0xe92b('0x24')](function(_0x147a86){if(_0x147a86){_0x3c069a=_0x147a86[_0xe92b('0x42')];if(!_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x35')]('nolimit')){_0x4c34ae[_0xe92b('0x1b')]=qs[_0xe92b('0x1b')](_0x3884ae['query'][_0xe92b('0x1b')]);_0x4c34ae[_0xe92b('0x1e')]=qs[_0xe92b('0x1e')](_0x3884ae[_0xe92b('0x2f')][_0xe92b('0x1e')]);}return _0x2ba4aa[_0xe92b('0x51')](_0x4c34ae);}})[_0xe92b('0x24')](function(_0x12ee6c){if(_0x12ee6c){return _0x12ee6c?{'count':_0x3c069a,'rows':_0x12ee6c}:null;}})['then'](respondWithResult(_0x591ee2,null))['catch'](handleError(_0x591ee2,null));}; \ No newline at end of file +var _0x8b7e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','UserProfileResource','error','name','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','map','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','role','Companies','userProfileId','autoAssociation','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x535db7,_0x50a83e){var _0x4b56c3=function(_0x2ec584){while(--_0x2ec584){_0x535db7['push'](_0x535db7['shift']());}};_0x4b56c3(++_0x50a83e);}(_0x8b7e,0x9a));var _0xe8b7=function(_0x51f10b,_0x35494e){_0x51f10b=_0x51f10b-0x0;var _0x301a73=_0x8b7e[_0x51f10b];return _0x301a73;};'use strict';var emlformat=require(_0xe8b7('0x0'));var rimraf=require(_0xe8b7('0x1'));var zipdir=require(_0xe8b7('0x2'));var jsonpatch=require(_0xe8b7('0x3'));var rp=require(_0xe8b7('0x4'));var moment=require(_0xe8b7('0x5'));var BPromise=require(_0xe8b7('0x6'));var Mustache=require(_0xe8b7('0x7'));var util=require(_0xe8b7('0x8'));var path=require(_0xe8b7('0x9'));var sox=require(_0xe8b7('0xa'));var csv=require(_0xe8b7('0xb'));var ejs=require(_0xe8b7('0xc'));var fs=require('fs');var fs_extra=require(_0xe8b7('0xd'));var _=require(_0xe8b7('0xe'));var squel=require('squel');var crypto=require(_0xe8b7('0xf'));var jsforce=require(_0xe8b7('0x10'));var deskjs=require(_0xe8b7('0x11'));var toCsv=require(_0xe8b7('0xb'));var querystring=require(_0xe8b7('0x12'));var Papa=require(_0xe8b7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe8b7('0x14'));var as=require(_0xe8b7('0x15'));var hardwareService=require(_0xe8b7('0x16'));var logger=require(_0xe8b7('0x17'))(_0xe8b7('0x18'));var utils=require(_0xe8b7('0x19'));var config=require(_0xe8b7('0x1a'));var licenseUtil=require(_0xe8b7('0x1b'));var db=require(_0xe8b7('0x1c'))['db'];function respondWithStatusCode(_0x33a8b1,_0x39150f){_0x39150f=_0x39150f||0xcc;return function(_0x42b20f){if(_0x42b20f){return _0x33a8b1[_0xe8b7('0x1d')](_0x39150f);}return _0x33a8b1['status'](_0x39150f)[_0xe8b7('0x1e')]();};}function respondWithResult(_0x4a1acf,_0x13d609){_0x13d609=_0x13d609||0xc8;return function(_0x5853a0){if(_0x5853a0){return _0x4a1acf[_0xe8b7('0x1f')](_0x13d609)[_0xe8b7('0x20')](_0x5853a0);}};}function respondWithFilteredResult(_0x42b58e,_0x33d87e){return function(_0x20480f){if(_0x20480f){var _0x59cb22=typeof _0x33d87e[_0xe8b7('0x21')]===_0xe8b7('0x22')&&typeof _0x33d87e[_0xe8b7('0x23')]==='undefined';var _0xad8b40=_0x20480f[_0xe8b7('0x24')];var _0x253f85=_0x59cb22?0x0:_0x33d87e['offset'];var _0x18c773=_0x59cb22?_0x20480f[_0xe8b7('0x24')]:_0x33d87e[_0xe8b7('0x21')]+_0x33d87e[_0xe8b7('0x23')];var _0x1df42b;if(_0x18c773>=_0xad8b40){_0x18c773=_0xad8b40;_0x1df42b=0xc8;}else{_0x1df42b=0xce;}_0x42b58e[_0xe8b7('0x1f')](_0x1df42b);return _0x42b58e[_0xe8b7('0x25')]('Content-Range',_0x253f85+'-'+_0x18c773+'/'+_0xad8b40)[_0xe8b7('0x20')](_0x20480f);}return null;};}function patchUpdates(_0x4ad208){return function(_0x24c03a){try{jsonpatch[_0xe8b7('0x26')](_0x24c03a,_0x4ad208,!![]);}catch(_0xf38d3d){return BPromise[_0xe8b7('0x27')](_0xf38d3d);}return _0x24c03a[_0xe8b7('0x28')]();};}function saveUpdates(_0x2fc8f8,_0x26a5b9){return function(_0x54b420){if(_0x54b420){return _0x54b420['update'](_0x2fc8f8)[_0xe8b7('0x29')](function(_0x381b41){return _0x381b41;});}return null;};}function removeEntity(_0x1a69fa,_0x3ae170){return function(_0x10ef65){if(_0x10ef65){return _0x10ef65[_0xe8b7('0x2a')]()[_0xe8b7('0x29')](function(){var _0x25f5e0=_0x10ef65[_0xe8b7('0x2b')]({'plain':!![]});var _0x633dbd='Companies';return db[_0xe8b7('0x2c')][_0xe8b7('0x2a')]({'where':{'type':_0x633dbd,'resourceId':_0x25f5e0['id']}})[_0xe8b7('0x29')](function(){return _0x10ef65;});})[_0xe8b7('0x29')](function(){_0x1a69fa[_0xe8b7('0x1f')](0xcc)[_0xe8b7('0x1e')]();});}};}function handleEntityNotFound(_0x4de16b,_0x109098){return function(_0x2ec265){if(!_0x2ec265){_0x4de16b[_0xe8b7('0x1d')](0x194);}return _0x2ec265;};}function handleError(_0x2e5325,_0x1bd43d){_0x1bd43d=_0x1bd43d||0x1f4;return function(_0x2e7313){logger[_0xe8b7('0x2d')](_0x2e7313['stack']);if(_0x2e7313[_0xe8b7('0x2e')]){delete _0x2e7313[_0xe8b7('0x2e')];}_0x2e5325['status'](_0x1bd43d)['send'](_0x2e7313);};}exports[_0xe8b7('0x2f')]=function(_0x5353c1,_0x56aa17){var _0xcae4ba={},_0x4d1c15={},_0x142a97={'count':0x0,'rows':[]};return db[_0xe8b7('0x30')][_0xe8b7('0x31')]()[_0xe8b7('0x29')](function(_0x56bd53){_0x4d1c15[_0xe8b7('0x32')]=_[_0xe8b7('0x33')](_0x56bd53);_0x4d1c15[_0xe8b7('0x34')]=_['keys'](_0x5353c1['query']);_0x4d1c15[_0xe8b7('0x35')]=_[_0xe8b7('0x36')](_0x4d1c15[_0xe8b7('0x32')],_0x4d1c15[_0xe8b7('0x34')]);_0xcae4ba['attributes']=_[_0xe8b7('0x36')](_0x4d1c15['model'],qs[_0xe8b7('0x37')](_0x5353c1['query'][_0xe8b7('0x37')]));_0xcae4ba[_0xe8b7('0x38')]=_0xcae4ba['attributes'][_0xe8b7('0x39')]?_0xcae4ba['attributes']:_0x4d1c15[_0xe8b7('0x32')];if(!_0x5353c1[_0xe8b7('0x34')][_0xe8b7('0x3a')]('nolimit')){_0xcae4ba[_0xe8b7('0x23')]=qs[_0xe8b7('0x23')](_0x5353c1[_0xe8b7('0x34')][_0xe8b7('0x23')]);_0xcae4ba['offset']=qs['offset'](_0x5353c1['query'][_0xe8b7('0x21')]);}_0xcae4ba[_0xe8b7('0x3b')]=qs[_0xe8b7('0x3c')](_0x5353c1[_0xe8b7('0x34')][_0xe8b7('0x3c')]);_0xcae4ba[_0xe8b7('0x3d')]=qs['filters'](_['pick'](_0x5353c1[_0xe8b7('0x34')],_0x4d1c15[_0xe8b7('0x35')]),_0x56bd53);if(_0x5353c1[_0xe8b7('0x34')]['filter']){_0xcae4ba[_0xe8b7('0x3d')]=_['merge'](_0xcae4ba['where'],{'$or':_[_0xe8b7('0x3e')](_0xcae4ba['attributes'],function(_0x4af68a){var _0x85500d={};_0x85500d[_0x4af68a]={'$like':'%'+_0x5353c1['query'][_0xe8b7('0x3f')]+'%'};return _0x85500d;})});}_0xcae4ba=_[_0xe8b7('0x40')]({},_0xcae4ba,_0x5353c1[_0xe8b7('0x41')]);var _0x4570f9={'where':_0xcae4ba[_0xe8b7('0x3d')]};return db[_0xe8b7('0x30')][_0xe8b7('0x24')](_0x4570f9)[_0xe8b7('0x29')](function(_0x3e3d4d){_0x142a97[_0xe8b7('0x24')]=_0x3e3d4d;if(_0x5353c1[_0xe8b7('0x34')][_0xe8b7('0x42')]){_0xcae4ba['include']=[{'all':!![]}];}return db[_0xe8b7('0x30')][_0xe8b7('0x43')](_0xcae4ba);})[_0xe8b7('0x29')](function(_0x4a939d){_0x142a97[_0xe8b7('0x44')]=_0x4a939d;return _0x142a97;})[_0xe8b7('0x29')](respondWithFilteredResult(_0x56aa17,_0xcae4ba))[_0xe8b7('0x45')](handleError(_0x56aa17,null));})[_0xe8b7('0x45')](handleError(_0x56aa17,null));};exports[_0xe8b7('0x46')]=function(_0x554f20,_0x5767da){var _0x4870aa={'raw':![],'where':{'id':_0x554f20[_0xe8b7('0x47')]['id']}},_0x308d0c={};_0x308d0c[_0xe8b7('0x32')]=_[_0xe8b7('0x33')](db[_0xe8b7('0x30')][_0xe8b7('0x48')]);_0x308d0c[_0xe8b7('0x34')]=_[_0xe8b7('0x33')](_0x554f20[_0xe8b7('0x34')]);_0x308d0c[_0xe8b7('0x35')]=_[_0xe8b7('0x36')](_0x308d0c[_0xe8b7('0x32')],_0x308d0c[_0xe8b7('0x34')]);_0x4870aa['attributes']=_[_0xe8b7('0x36')](_0x308d0c['model'],qs[_0xe8b7('0x37')](_0x554f20[_0xe8b7('0x34')][_0xe8b7('0x37')]));_0x4870aa[_0xe8b7('0x38')]=_0x4870aa[_0xe8b7('0x38')]['length']?_0x4870aa[_0xe8b7('0x38')]:_0x308d0c[_0xe8b7('0x32')];if(_0x554f20[_0xe8b7('0x34')][_0xe8b7('0x42')]){_0x4870aa[_0xe8b7('0x49')]=[{'all':!![]}];}_0x4870aa=_[_0xe8b7('0x40')]({},_0x4870aa,_0x554f20['options']);return db['CmCompany'][_0xe8b7('0x4a')](_0x4870aa)[_0xe8b7('0x29')](handleEntityNotFound(_0x5767da,null))[_0xe8b7('0x29')](respondWithResult(_0x5767da,null))['catch'](handleError(_0x5767da,null));};exports[_0xe8b7('0x4b')]=function(_0x5371ef,_0x27a076){return db[_0xe8b7('0x30')]['create'](_0x5371ef[_0xe8b7('0x4c')],{})[_0xe8b7('0x29')](function(_0x34f851){var _0x4c685f=_0x5371ef['user'][_0xe8b7('0x2b')]({'plain':!![]});if(!_0x4c685f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c685f[_0xe8b7('0x4d')]==='user'){var _0x5f5d2d=_0x34f851['get']({'plain':!![]});var _0x2b84a5=_0xe8b7('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x2b84a5,'userProfileId':_0x4c685f[_0xe8b7('0x4f')]},'raw':!![]})[_0xe8b7('0x29')](function(_0x1a00b7){if(_0x1a00b7&&_0x1a00b7[_0xe8b7('0x50')]===0x0){return db['UserProfileResource'][_0xe8b7('0x4b')]({'name':_0x5f5d2d[_0xe8b7('0x2e')],'resourceId':_0x5f5d2d['id'],'type':_0x1a00b7[_0xe8b7('0x2e')],'sectionId':_0x1a00b7['id']},{})['then'](function(){return _0x34f851;});}else{return _0x34f851;}})[_0xe8b7('0x45')](function(_0x4dcf84){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dcf84);throw _0x4dcf84;});}return _0x34f851;})[_0xe8b7('0x29')](respondWithResult(_0x27a076,0xc9))[_0xe8b7('0x45')](handleError(_0x27a076,null));};exports['update']=function(_0x254c7a,_0x38e255){if(_0x254c7a[_0xe8b7('0x4c')]['id']){delete _0x254c7a['body']['id'];}return db[_0xe8b7('0x30')][_0xe8b7('0x4a')]({'where':{'id':_0x254c7a[_0xe8b7('0x47')]['id']}})[_0xe8b7('0x29')](handleEntityNotFound(_0x38e255,null))[_0xe8b7('0x29')](saveUpdates(_0x254c7a[_0xe8b7('0x4c')],null))['then'](respondWithResult(_0x38e255,null))['catch'](handleError(_0x38e255,null));};exports[_0xe8b7('0x2a')]=function(_0x4f60af,_0x34509d){return db[_0xe8b7('0x30')][_0xe8b7('0x4a')]({'where':{'id':_0x4f60af[_0xe8b7('0x47')]['id']}})[_0xe8b7('0x29')](handleEntityNotFound(_0x34509d,null))['then'](removeEntity(_0x34509d,null))[_0xe8b7('0x45')](handleError(_0x34509d,null));};exports['describe']=function(_0xa1444f,_0x42f6e9){return db[_0xe8b7('0x30')][_0xe8b7('0x31')]()[_0xe8b7('0x29')](respondWithResult(_0x42f6e9,null))[_0xe8b7('0x45')](handleError(_0x42f6e9,null));};exports[_0xe8b7('0x51')]=function(_0x11c76b,_0x5d532f,_0xb69d84){return db[_0xe8b7('0x52')][_0xe8b7('0x4a')]({'where':{'id':_0x11c76b[_0xe8b7('0x47')]['id']}})[_0xe8b7('0x29')](handleEntityNotFound(_0x5d532f,null))[_0xe8b7('0x29')](function(_0x36b0db){if(_0x36b0db){return _0x36b0db[_0xe8b7('0x51')](_0x11c76b['body'][_0xe8b7('0x53')],_[_0xe8b7('0x54')](_0x11c76b[_0xe8b7('0x4c')],[_0xe8b7('0x53'),'id'])||{});}})[_0xe8b7('0x29')](respondWithResult(_0x5d532f,null))[_0xe8b7('0x45')](handleError(_0x5d532f,null));};exports[_0xe8b7('0x55')]=function(_0x49f297,_0x3ef483,_0x393404){var _0x176494={};var _0x49a9e6={};var _0x39eb8a;var _0x210300;return db[_0xe8b7('0x30')][_0xe8b7('0x56')]({'where':{'id':_0x49f297[_0xe8b7('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ef483,null))[_0xe8b7('0x29')](function(_0x1d0f00){if(_0x1d0f00){_0x39eb8a=_0x1d0f00;_0x49a9e6['model']=_['keys'](db[_0xe8b7('0x52')][_0xe8b7('0x48')]);_0x49a9e6[_0xe8b7('0x34')]=_[_0xe8b7('0x33')](_0x49f297['query']);_0x49a9e6[_0xe8b7('0x35')]=_[_0xe8b7('0x36')](_0x49a9e6[_0xe8b7('0x32')],_0x49a9e6[_0xe8b7('0x34')]);_0x176494[_0xe8b7('0x38')]=_[_0xe8b7('0x36')](_0x49a9e6[_0xe8b7('0x32')],qs[_0xe8b7('0x37')](_0x49f297[_0xe8b7('0x34')][_0xe8b7('0x37')]));_0x176494['attributes']=_0x176494[_0xe8b7('0x38')]['length']?_0x176494[_0xe8b7('0x38')]:_0x49a9e6['model'];_0x176494['order']=qs[_0xe8b7('0x3c')](_0x49f297[_0xe8b7('0x34')]['sort']);_0x176494['where']=qs['filters'](_['pick'](_0x49f297['query'],_0x49a9e6['filters']));if(_0x49f297[_0xe8b7('0x34')][_0xe8b7('0x3f')]){_0x176494[_0xe8b7('0x3d')]=_[_0xe8b7('0x40')](_0x176494[_0xe8b7('0x3d')],{'$or':_['map'](_0x176494[_0xe8b7('0x38')],function(_0x40ccdb){var _0x35a442={};_0x35a442[_0x40ccdb]={'$like':'%'+_0x49f297[_0xe8b7('0x34')]['filter']+'%'};return _0x35a442;})});}_0x176494=_[_0xe8b7('0x40')]({},_0x176494,_0x49f297[_0xe8b7('0x41')]);return _0x39eb8a[_0xe8b7('0x55')](_0x176494);}})['then'](function(_0x42f3dc){if(_0x42f3dc){_0x210300=_0x42f3dc['length'];if(!_0x49f297[_0xe8b7('0x34')][_0xe8b7('0x3a')]('nolimit')){_0x176494['limit']=qs['limit'](_0x49f297[_0xe8b7('0x34')]['limit']);_0x176494['offset']=qs['offset'](_0x49f297[_0xe8b7('0x34')][_0xe8b7('0x21')]);}return _0x39eb8a[_0xe8b7('0x55')](_0x176494);}})[_0xe8b7('0x29')](function(_0x25a3e2){if(_0x25a3e2){return _0x25a3e2?{'count':_0x210300,'rows':_0x25a3e2}:null;}})[_0xe8b7('0x29')](respondWithResult(_0x3ef483,null))['catch'](handleError(_0x3ef483,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index e9c4454..7918750 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 _0xdaba=['cm_companies','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x2f2763,_0x4d9637){var _0x442362=function(_0xaed4fa){while(--_0xaed4fa){_0x2f2763['push'](_0x2f2763['shift']());}};_0x442362(++_0x4d9637);}(_0xdaba,0x1c9));var _0xadab=function(_0x3729fc,_0x10a08e){_0x3729fc=_0x3729fc-0x0;var _0x1bab4f=_0xdaba[_0x3729fc];return _0x1bab4f;};'use strict';var _=require(_0xadab('0x0'));var util=require('util');var logger=require(_0xadab('0x1'))(_0xadab('0x2'));var moment=require('moment');var BPromise=require(_0xadab('0x3'));var rp=require(_0xadab('0x4'));var fs=require('fs');var path=require(_0xadab('0x5'));var rimraf=require(_0xadab('0x6'));var config=require('../../config/environment');var attributes=require(_0xadab('0x7'));module[_0xadab('0x8')]=function(_0x5913ef,_0x105895){return _0x5913ef[_0xadab('0x9')](_0xadab('0xa'),attributes,{'tableName':_0xadab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaab4=['../../config/environment','exports','define','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x12e73c,_0x2cbe1d){var _0x4c41cb=function(_0x10283b){while(--_0x10283b){_0x12e73c['push'](_0x12e73c['shift']());}};_0x4c41cb(++_0x2cbe1d);}(_0xaab4,0x67));var _0x4aab=function(_0x3a00ad,_0x2ae285){_0x3a00ad=_0x3a00ad-0x0;var _0x4a9a38=_0xaab4[_0x3a00ad];return _0x4a9a38;};'use strict';var _=require(_0x4aab('0x0'));var util=require('util');var logger=require(_0x4aab('0x1'))(_0x4aab('0x2'));var moment=require(_0x4aab('0x3'));var BPromise=require(_0x4aab('0x4'));var rp=require(_0x4aab('0x5'));var fs=require('fs');var path=require(_0x4aab('0x6'));var rimraf=require('rimraf');var config=require(_0x4aab('0x7'));var attributes=require('./cmCompany.attributes');module[_0x4aab('0x8')]=function(_0x2331eb,_0x141eeb){return _0x2331eb[_0x4aab('0x9')]('CmCompany',attributes,{'tableName':_0x4aab('0xa'),'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 7037e72..192942b 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 _0x3732=['result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x53b76e,_0x209fe3){var _0x311645=function(_0x314846){while(--_0x314846){_0x53b76e['push'](_0x53b76e['shift']());}};_0x311645(++_0x209fe3);}(_0x3732,0x19f));var _0x2373=function(_0xe2bf6f,_0x4a304f){_0xe2bf6f=_0xe2bf6f-0x0;var _0x1649ea=_0x3732[_0xe2bf6f];return _0x1649ea;};'use strict';var _=require(_0x2373('0x0'));var util=require(_0x2373('0x1'));var moment=require(_0x2373('0x2'));var BPromise=require('bluebird');var rs=require(_0x2373('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2373('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2373('0x5'))(_0x2373('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2373('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c6b6,_0x44e242,_0x6c17ea){return new BPromise(function(_0x5a1189,_0x53fe00){return client[_0x2373('0x8')](_0x14c6b6,_0x6c17ea)['then'](function(_0x512f9f){logger['info'](_0x2373('0x9'),_0x44e242,_0x2373('0xa'));logger[_0x2373('0xb')](_0x2373('0xc'),_0x44e242,_0x2373('0xa'),JSON[_0x2373('0xd')](_0x512f9f));if(_0x512f9f['error']){if(_0x512f9f[_0x2373('0xe')]['code']===0x1f4){logger['error'](_0x2373('0x9'),_0x44e242,_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);return _0x53fe00(_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);}logger['error'](_0x2373('0x9'),_0x44e242,_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);return _0x5a1189(_0x512f9f[_0x2373('0xe')][_0x2373('0xf')]);}else{logger[_0x2373('0x10')](_0x2373('0x9'),_0x44e242,_0x2373('0xa'));_0x5a1189(_0x512f9f[_0x2373('0x11')][_0x2373('0xf')]);}})['catch'](function(_0x4544ac){logger[_0x2373('0xe')](_0x2373('0x9'),_0x44e242,_0x4544ac);_0x53fe00(_0x4544ac);});});} \ No newline at end of file +var _0xec19=['../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x4b6db3,_0x4bfef8){var _0x5797ff=function(_0x574adf){while(--_0x574adf){_0x4b6db3['push'](_0x4b6db3['shift']());}};_0x5797ff(++_0x4bfef8);}(_0xec19,0xbf));var _0x9ec1=function(_0x1bedbd,_0x33a9b8){_0x1bedbd=_0x1bedbd-0x0;var _0x1166fd=_0xec19[_0x1bedbd];return _0x1166fd;};'use strict';var _=require(_0x9ec1('0x0'));var util=require(_0x9ec1('0x1'));var moment=require(_0x9ec1('0x2'));var BPromise=require(_0x9ec1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ec1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ec1('0x5'));var logger=require('../../config/logger')(_0x9ec1('0x6'));var config=require(_0x9ec1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9ec1('0x8')][_0x9ec1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b77ac,_0x58cc07,_0x38e102){return new BPromise(function(_0x21616a,_0x2d954e){return client[_0x9ec1('0xa')](_0x2b77ac,_0x38e102)[_0x9ec1('0xb')](function(_0x587dd1){logger[_0x9ec1('0xc')](_0x9ec1('0xd'),_0x58cc07,'request\x20sent');logger[_0x9ec1('0xe')](_0x9ec1('0xf'),_0x58cc07,_0x9ec1('0x10'),JSON[_0x9ec1('0x11')](_0x587dd1));if(_0x587dd1[_0x9ec1('0x12')]){if(_0x587dd1['error'][_0x9ec1('0x13')]===0x1f4){logger[_0x9ec1('0x12')](_0x9ec1('0xd'),_0x58cc07,_0x587dd1[_0x9ec1('0x12')][_0x9ec1('0x14')]);return _0x2d954e(_0x587dd1[_0x9ec1('0x12')][_0x9ec1('0x14')]);}logger[_0x9ec1('0x12')](_0x9ec1('0xd'),_0x58cc07,_0x587dd1[_0x9ec1('0x12')][_0x9ec1('0x14')]);return _0x21616a(_0x587dd1[_0x9ec1('0x12')][_0x9ec1('0x14')]);}else{logger[_0x9ec1('0xc')](_0x9ec1('0xd'),_0x58cc07,'request\x20sent');_0x21616a(_0x587dd1[_0x9ec1('0x15')]['message']);}})['catch'](function(_0x482214){logger[_0x9ec1('0x12')](_0x9ec1('0xd'),_0x58cc07,_0x482214);_0x2d954e(_0x482214);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index cf281e3..c364628 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 _0x9ec7=['./cmCompany.controller','isAuthenticated','index','get','/describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x559178,_0x2734c0){var _0x455e7f=function(_0x14aa39){while(--_0x14aa39){_0x559178['push'](_0x559178['shift']());}};_0x455e7f(++_0x2734c0);}(_0x9ec7,0x161));var _0x79ec=function(_0x4027f3,_0x4aa861){_0x4027f3=_0x4027f3-0x0;var _0x589b13=_0x9ec7[_0x4027f3];return _0x589b13;};'use strict';var multer=require(_0x79ec('0x0'));var util=require('util');var path=require(_0x79ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x79ec('0x2'));var router=express['Router']();var fs_extra=require(_0x79ec('0x3'));var auth=require(_0x79ec('0x4'));var interaction=require(_0x79ec('0x5'));var config=require(_0x79ec('0x6'));var controller=require(_0x79ec('0x7'));router['get']('/',auth[_0x79ec('0x8')](),controller[_0x79ec('0x9')]);router[_0x79ec('0xa')](_0x79ec('0xb'),auth[_0x79ec('0x8')](),controller['describe']);router[_0x79ec('0xa')](_0x79ec('0xc'),auth[_0x79ec('0x8')](),controller[_0x79ec('0xd')]);router[_0x79ec('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x79ec('0xe')]);router[_0x79ec('0xf')]('/',auth['isAuthenticated'](),controller[_0x79ec('0x10')]);router[_0x79ec('0xf')](_0x79ec('0x11'),auth['isAuthenticated'](),controller[_0x79ec('0x12')]);router[_0x79ec('0x13')](_0x79ec('0xc'),auth[_0x79ec('0x8')](),controller[_0x79ec('0x14')]);router[_0x79ec('0x15')](_0x79ec('0xc'),auth[_0x79ec('0x8')](),controller[_0x79ec('0x16')]);module[_0x79ec('0x17')]=router; \ No newline at end of file +var _0x2374=['show','getContacts','post','/:id/contacts','addContacts','put','/:id','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x28263e,_0x33fd6d){var _0x5865bf=function(_0x1b5171){while(--_0x1b5171){_0x28263e['push'](_0x28263e['shift']());}};_0x5865bf(++_0x33fd6d);}(_0x2374,0x88));var _0x4237=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2374[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x4237('0x0'));var util=require('util');var path=require(_0x4237('0x1'));var timeout=require(_0x4237('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4237('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4237('0x4'));var config=require(_0x4237('0x5'));var controller=require(_0x4237('0x6'));router[_0x4237('0x7')]('/',auth[_0x4237('0x8')](),controller[_0x4237('0x9')]);router[_0x4237('0x7')](_0x4237('0xa'),auth[_0x4237('0x8')](),controller['describe']);router[_0x4237('0x7')]('/:id',auth[_0x4237('0x8')](),controller[_0x4237('0xb')]);router['get']('/:id/contacts',auth[_0x4237('0x8')](),controller[_0x4237('0xc')]);router[_0x4237('0xd')]('/',auth[_0x4237('0x8')](),controller['create']);router[_0x4237('0xd')](_0x4237('0xe'),auth[_0x4237('0x8')](),controller[_0x4237('0xf')]);router[_0x4237('0x10')](_0x4237('0x11'),auth['isAuthenticated'](),controller[_0x4237('0x12')]);router['delete'](_0x4237('0x11'),auth['isAuthenticated'](),controller[_0x4237('0x13')]);module[_0x4237('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f3c8003..001f207 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 _0x90f3=['TEXT','UNSIGNED','DATE','NOW','INTEGER','lodash','sequelize','STRING'];(function(_0x35821c,_0x1c2c65){var _0x4ddf39=function(_0x47482d){while(--_0x47482d){_0x35821c['push'](_0x35821c['shift']());}};_0x4ddf39(++_0x1c2c65);}(_0x90f3,0x65));var _0x390f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x90f3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x390f('0x0'));var Sequelize=require(_0x390f('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x390f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x390f('0x2')]},'street':{'type':Sequelize[_0x390f('0x2')]},'postalCode':{'type':Sequelize[_0x390f('0x2')]},'city':{'type':Sequelize[_0x390f('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x390f('0x2')]},'description':{'type':Sequelize[_0x390f('0x3')]},'phone':{'type':Sequelize[_0x390f('0x2')]},'mobile':{'type':Sequelize[_0x390f('0x2')]},'fax':{'type':Sequelize[_0x390f('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x390f('0x2')]},'facebook':{'type':Sequelize[_0x390f('0x2')]},'fb_data':{'type':Sequelize[_0x390f('0x2')]},'twitter':{'type':Sequelize[_0x390f('0x2')]},'skype':{'type':Sequelize[_0x390f('0x2')]},'teams':{'type':Sequelize[_0x390f('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x390f('0x2')]},'telegram':{'type':Sequelize[_0x390f('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x390f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x390f('0x5')],'defaultValue':Sequelize[_0x390f('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x390f('0x7')]}}; \ No newline at end of file +var _0x3c81=['TEXT','INTEGER','UNSIGNED','DATE','NOW','STRING'];(function(_0x250b8b,_0x1d3b34){var _0x458585=function(_0x53147d){while(--_0x53147d){_0x250b8b['push'](_0x250b8b['shift']());}};_0x458585(++_0x1d3b34);}(_0x3c81,0x155));var _0x13c8=function(_0x90b375,_0x9b6827){_0x90b375=_0x90b375-0x0;var _0x519c07=_0x3c81[_0x90b375];return _0x519c07;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x13c8('0x0')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x13c8('0x0')]},'postalCode':{'type':Sequelize[_0x13c8('0x0')]},'city':{'type':Sequelize[_0x13c8('0x0')]},'country':{'type':Sequelize[_0x13c8('0x0')]},'dateOfBirth':{'type':Sequelize[_0x13c8('0x0')]},'description':{'type':Sequelize[_0x13c8('0x1')]},'phone':{'type':Sequelize[_0x13c8('0x0')]},'mobile':{'type':Sequelize[_0x13c8('0x0')]},'fax':{'type':Sequelize[_0x13c8('0x0')]},'email':{'type':Sequelize[_0x13c8('0x0')]},'url':{'type':Sequelize[_0x13c8('0x0')]},'facebook':{'type':Sequelize[_0x13c8('0x0')]},'fb_data':{'type':Sequelize[_0x13c8('0x0')]},'twitter':{'type':Sequelize[_0x13c8('0x0')]},'skype':{'type':Sequelize[_0x13c8('0x0')]},'teams':{'type':Sequelize[_0x13c8('0x0')]},'viber':{'type':Sequelize[_0x13c8('0x0')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x13c8('0x0')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x13c8('0x0')]},'priority':{'type':Sequelize[_0x13c8('0x2')](0x2)[_0x13c8('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x13c8('0x4')],'defaultValue':Sequelize[_0x13c8('0x5')]},'dialTimezone':{'type':Sequelize[_0x13c8('0x0')]},'utcOffset':{'type':Sequelize[_0x13c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 308e8d8..1850c75 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 _0xf378=['MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','all','show','Tag','ContactItemType','ItemType','isNil','$and','omit','format','cf_%d','pickBy','isEmpty','table','id\x20=\x20?','toParam','phone','CmHopper','rawAttributes','pick','options','getTags','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','description','ItemTypeId','PHONE','item','literal','`ItemType`.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','include','getHopperHistories','includeAll','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','file','path','parse','meta','import','binding','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','error\x20child\x20process','importUpdates','start\x20child\x20process\x20correctly!','exit','mail','chat','sms','openchannel','voice','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','starttime','endtime','duration','note','createdAt','userDisposition','UserId','fullname','findAndCountAll','startCase','Website','closedAt','disposition','thirdDisposition','Account','key','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','Interaction','flatten','sortBy','reverse','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','index','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','length','fieldType','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','field','color','tools_tags','select','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','buildExpression','text','start','end','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','resolve','user','agent','some','User','getLists','c.ListId\x20IS\x20NULL','map','ListId','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','tags','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction'];(function(_0x478643,_0x3a2230){var _0x483752=function(_0x1a14dc){while(--_0x1a14dc){_0x478643['push'](_0x478643['shift']());}};_0x483752(++_0x3a2230);}(_0xf378,0x1df));var _0x8f37=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf378[_0x88cd7b];return _0x56fcc8;};'use strict';var moment=require(_0x8f37('0x0'));var BPromise=require(_0x8f37('0x1'));var util=require(_0x8f37('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x8f37('0x3'));var squel=require(_0x8f37('0x4'));var Papa=require(_0x8f37('0x5'));var Redis=require(_0x8f37('0x6'));var qs=require(_0x8f37('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x8f37('0x8'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0x8f37('0x9'))['db'];config[_0x8f37('0xa')]=_['defaults'](config[_0x8f37('0xa')],{'host':_0x8f37('0xb'),'port':0x18eb});var socket=require(_0x8f37('0xc'))(new Redis(config[_0x8f37('0xa')]));require(_0x8f37('0xd'))[_0x8f37('0xe')](socket);function respondWithResult(_0x4a9ada,_0x1aedc5){_0x1aedc5=_0x1aedc5||0xc8;return function(_0x385da8){if(_0x385da8){return _0x4a9ada[_0x8f37('0xf')](_0x1aedc5)['json'](_0x385da8);}};}function respondWithFilteredResult(_0x439bb3,_0x56f9e5){return function(_0x45f44b){if(_0x45f44b){var _0x29f924=typeof _0x56f9e5['offset']===_0x8f37('0x10')&&typeof _0x56f9e5[_0x8f37('0x11')]==='undefined';var _0x379413=_0x45f44b[_0x8f37('0x12')];var _0x5cf473=_0x29f924?0x0:_0x56f9e5[_0x8f37('0x13')];var _0x4cd1ae=_0x29f924?_0x45f44b['count']:_0x56f9e5[_0x8f37('0x13')]+_0x56f9e5['limit'];var _0x3ff46c;if(_0x4cd1ae>=_0x379413){_0x4cd1ae=_0x379413;_0x3ff46c=0xc8;}else{_0x3ff46c=0xce;}_0x439bb3[_0x8f37('0xf')](_0x3ff46c);return _0x439bb3[_0x8f37('0x14')](_0x8f37('0x15'),_0x5cf473+'-'+_0x4cd1ae+'/'+_0x379413)[_0x8f37('0x16')](_0x45f44b);}return null;};}function saveUpdates(_0x2ca2d8){return function(_0x17e2bf){if(_0x17e2bf){return _0x17e2bf[_0x8f37('0x17')](_0x2ca2d8)[_0x8f37('0x18')](function(_0xf599f2){return _0xf599f2;});}return null;};}function removeEntity(_0x58fd8f){return function(_0xa8b629){if(_0xa8b629){return _0xa8b629[_0x8f37('0x19')]()[_0x8f37('0x18')](function(){_0x58fd8f[_0x8f37('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c8c9){return function(_0x219c8a){if(!_0x219c8a){_0x41c8c9[_0x8f37('0x1a')](0x194);}return _0x219c8a;};}function handleError(_0x1f3d3c,_0x1910b3){_0x1910b3=_0x1910b3||0x1f4;return function(_0x4ecb30){logger[_0x8f37('0x1b')](_0x4ecb30[_0x8f37('0x1c')]);if(_0x4ecb30['name']){delete _0x4ecb30[_0x8f37('0x1d')];}_0x1f3d3c['status'](_0x1910b3)['send'](_0x4ecb30);};}exports[_0x8f37('0x1e')]=function(_0x40b567,_0x5a5e8c){var _0x3bdf1c={},_0x481590={},_0x4a02dd={'count':0x0,'rows':[]};return db[_0x8f37('0x1f')][_0x8f37('0x20')]()[_0x8f37('0x18')](function(_0x33e2ce){var _0x246253=[];for(var _0x5a0b74=0x0;_0x5a0b740x1){_0x2dc294['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x531ccc),null);}else{if(qs[_0x8f37('0x5c')](_0x531ccc)){_0x2dc294['or'](_0x8f37('0x5d'),_0x531ccc+'%');_0x2dc294['or'](_0x8f37('0x5e'),_0x531ccc+'%');_0x2dc294['or'](_0x8f37('0x5f'),_0x531ccc+'%');_0x2dc294['or'](_0x8f37('0x60'),_0x531ccc+'%');}else if(qs[_0x8f37('0x61')](_0x531ccc)){_0x2dc294['or'](_0x8f37('0x62'),_0x531ccc+'%');}else{_0x2dc294['or'](_0x8f37('0x63'),'%'+_0x531ccc+'%');_0x2dc294['or']('c.lastName\x20LIKE\x20?','%'+_0x531ccc+'%');_0x2dc294['or']('c.email\x20LIKE\x20?','%'+_0x531ccc+'%');}}}}_0x8abfdf['where'](_0x2dc294);_0x8abfdf[_0x8f37('0x64')](_0x8f37('0x65'));var _0x1c8641={'type':db[_0x8f37('0x66')][_0x8f37('0x67')]['SELECT'],'raw':!![]};var _0xe918c4=_0x8abfdf[_0x8f37('0x68')]()[_0x8f37('0x35')](_0x8f37('0x65'));if(_0x3bdf1c[_0x8f37('0x31')]){_0x3bdf1c[_0x8f37('0x31')][_0x8f37('0x48')](function(_0x209c2d){_0x8abfdf['order']('c.'+_0x209c2d[0x0],_0x209c2d[0x1]===_0x8f37('0x69')?![]:!![]);});}if(!_['isEmpty'](_0x118427)){_0x8abfdf[_0x8f37('0x6a')](_0x6fd0f9);_0xe918c4[_0x8f37('0x33')](_0x8f37('0x6b'),_0x118427);}BPromise[_0x8f37('0x6c')]()[_0x8f37('0x18')](function(){if(!_0x51ad1e)return;if(_0x40b567[_0x8f37('0x6d')]['role']!==_0x8f37('0x6e'))return;if(!_[_0x8f37('0x6f')](_0x51ad1e[_0x8f37('0x44')],[_0x8f37('0x35'),_0x8f37('0x70')])){return _0x40b567[_0x8f37('0x6d')][_0x8f37('0x71')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a7277){if(_['isEmpty'](_0x5a7277)){_0xe918c4[_0x8f37('0x33')]('c.ListId\x20IS\x20NULL');_0x8abfdf[_0x8f37('0x33')](_0x8f37('0x72'));}else{_0xe918c4[_0x8f37('0x33')](_0x8f37('0x55'),_[_0x8f37('0x73')](_0x5a7277,'id'));_0x8abfdf[_0x8f37('0x33')](_0x8f37('0x55'),_[_0x8f37('0x73')](_0x5a7277,'id'));}});}})[_0x8f37('0x18')](function(){if(_0x40b567[_0x8f37('0x6d')]['role']===_0x8f37('0x6e')&&!_0x51ad1e&&!_0x40b567[_0x8f37('0x2c')][_0x8f37('0x74')])return[];return db['sequelize'][_0x8f37('0x2c')](_0xe918c4['toString'](),_0x1c8641);})[_0x8f37('0x18')](function(_0x157384){_0x4a02dd['count']=_0x157384[_0x8f37('0x28')];if(_0x4a02dd[_0x8f37('0x12')]===0x0)return[];return db[_0x8f37('0x75')][_0x8f37('0x2c')](_0x196ad9[_0x8f37('0x76')](),_0x1c8641)[_0x8f37('0x18')](function(_0x354b81){_0x360b2c=_[_0x8f37('0x77')](_0x354b81,'id');_0x1c8641=_[_0x8f37('0x78')](_0x1c8641,{'model':db[_0x8f37('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40b567['query'][_0x8f37('0x2f')]){_0x3bdf1c[_0x8f37('0x2e')][_0x8f37('0x48')](function(_0x97ac3b){_0x8abfdf[_0x8f37('0x35')]('c.'+_0x97ac3b);});}else{_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x65'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x79'));_0x8abfdf[_0x8f37('0x35')]('c.lastName');_0x8abfdf['field'](_0x8f37('0x7a'));_0x8abfdf[_0x8f37('0x35')]('c.mobile');_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x7b'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x7c'));_0x8abfdf['field'](_0x8f37('0x7d'));_0x8abfdf['field'](_0x8f37('0x7e'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x7f'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x80'));_0x8abfdf[_0x8f37('0x35')](_0x8f37('0x81'),_0x8f37('0x82'));}if(_0x3bdf1c[_0x8f37('0x11')])_0x8abfdf[_0x8f37('0x11')](_0x3bdf1c['limit']);if(_0x3bdf1c['offset'])_0x8abfdf[_0x8f37('0x13')](_0x3bdf1c[_0x8f37('0x13')]);return db[_0x8f37('0x75')]['query'](_0x8abfdf[_0x8f37('0x76')](),_0x1c8641);});})['then'](function(_0x3a4ab0){_0x3a4ab0[_0x8f37('0x48')](function(_0x4dc4e1){if(_0x4dc4e1[_0x8f37('0x82')]){_0x4dc4e1[_0x8f37('0x83')]=[];_0x4dc4e1[_0x8f37('0x82')]['split'](',')['forEach'](function(_0x13a2ac){_0x4dc4e1[_0x8f37('0x83')][_0x8f37('0x24')](_0x360b2c[_0x13a2ac]);});}delete _0x4dc4e1[_0x8f37('0x82')];});_0x4a02dd[_0x8f37('0x84')]=_0x3a4ab0;return _0x4a02dd;})[_0x8f37('0x18')](respondWithFilteredResult(_0x5a5e8c,_0x3bdf1c));})['catch'](handleError(_0x5a5e8c,null));};exports['destroy']=function(_0x3ce77f,_0x33de20){return db[_0x8f37('0x1f')][_0x8f37('0x45')]({'where':{'id':_0x3ce77f[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x33de20,null))[_0x8f37('0x18')](removeEntity(_0x33de20,null))[_0x8f37('0x86')](handleError(_0x33de20,null));};exports['describe']=function(_0x20590f,_0x2c8004){return db[_0x8f37('0x1f')][_0x8f37('0x20')]()[_0x8f37('0x18')](function(_0x4af56a){delete _0x4af56a[_0x8f37('0x87')];for(var _0x298c9e=0x0;_0x298c9e0x0){return new Promise(function(_0x834f32,_0x213787){var _0x5de421=[];for(var _0x1a821b=0x0;_0x1a821b<_0x214242[_0x8f37('0x28')];_0x1a821b++){_0x5de421[_0x8f37('0x24')](insertAdditionalPhones(_0x214242[_0x1a821b][_0x8f37('0xba')],_0x214242[_0x1a821b][_0x8f37('0xb3')]));}Promise[_0x8f37('0xbb')](_0x5de421)[_0x8f37('0x18')](function(){_0x834f32(0x1);});})['then'](function(){return{'success':_0x5a8039,'failure':_0x525918,'duplicates':_0x5cae98};});}else{return{'success':_0x5a8039,'failure':_0x525918,'duplicates':_0x5cae98};}}})[_0x8f37('0x18')](respondWithResult(_0x303666,0xc9))[_0x8f37('0x86')](handleError(_0x303666,null));};exports[_0x8f37('0xbc')]=function(_0x3cddb3,_0x271560){var _0x5cfb3c;return db['CmContact'][_0x8f37('0x20')]()[_0x8f37('0x18')](function(_0x386e2e){return db[_0x8f37('0x1f')][_0x8f37('0x45')]({'where':{'id':_0x3cddb3[_0x8f37('0x85')]['id']},'include':[{'model':db[_0x8f37('0xbd')],'as':_0x8f37('0x83'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x36')],'required':_0x3cddb3['query']['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x3cddb3[_0x8f37('0x85')]['id']},'required':![],'include':[{'model':db[_0x8f37('0xbe')],'as':_0x8f37('0xbf')}]}],'order':[db['sequelize']['literal']('Phones.OrderBy')],'attributes':_[_0x8f37('0x21')](_0x386e2e)});})[_0x8f37('0x18')](function(_0x1b22ad){if(!_[_0x8f37('0xc0')](_0x1b22ad)){_0x5cfb3c=_0x1b22ad[_0x8f37('0x90')]({'plain':!![]});var _0x5b856c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1b22ad&&_0x1b22ad[_0x8f37('0x74')]){if(_0x1b22ad['ListId']){_0x5b856c[_0x8f37('0x33')][_0x8f37('0xc1')][_0x8f37('0x24')]({'ListId':{'$ne':_0x1b22ad[_0x8f37('0x74')]}});}}return db[_0x8f37('0x25')][_0x8f37('0x8b')](_0x5b856c);}})[_0x8f37('0x18')](function(_0x40408e){if(!_[_0x8f37('0xc0')](_0x40408e)){return _[_0x8f37('0xc2')](_0x5cfb3c,_['map'](_0x40408e,function(_0x4cfa6a){return util[_0x8f37('0xc3')](_0x8f37('0xc4'),_0x4cfa6a['id']);}));}})['then'](handleEntityNotFound(_0x271560,null))[_0x8f37('0x18')](respondWithResult(_0x271560,null))[_0x8f37('0x86')](handleError(_0x271560,null));};exports[_0x8f37('0x17')]=function(_0x17a372,_0x483069){var _0x2f7b7a;if(_0x17a372[_0x8f37('0x8f')]['id']){delete _0x17a372[_0x8f37('0x8f')]['id'];}if(!_[_0x8f37('0xc0')](_0x17a372[_0x8f37('0x8f')][_0x8f37('0xb0')])){var _0x38bb21=_0x17a372[_0x8f37('0x8f')][_0x8f37('0xb0')];if(!_['isNil'](shared[_0x8f37('0xb1')][_0x38bb21]))_0x17a372['body'][_0x8f37('0xb2')]=shared['timezones'][_0x38bb21][_0x8f37('0xb2')];}return db[_0x8f37('0x1f')]['find']({'where':{'id':_0x17a372[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x483069,null))[_0x8f37('0x18')](saveUpdates(_0x17a372[_0x8f37('0x8f')],null))[_0x8f37('0x18')](function(_0x439334){_0x2f7b7a=_0x439334;var _0x5aa267={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x439334&&_0x439334['ListId']){if(_0x439334[_0x8f37('0x74')]){_0x5aa267[_0x8f37('0x33')][_0x8f37('0xc1')]['push']({'ListId':{'$ne':_0x439334[_0x8f37('0x74')]}});}}return db[_0x8f37('0x25')][_0x8f37('0x8b')](_0x5aa267);})[_0x8f37('0x18')](function(_0x408eab){if(_0x408eab){return _[_0x8f37('0xc2')](_[_0x8f37('0xc5')](_0x17a372[_0x8f37('0x8f')],function(_0x526fa4,_0x32bf2a){return _[_0x8f37('0x22')](_0x32bf2a,_0x8f37('0x23'));}),_[_0x8f37('0x73')](_0x408eab,function(_0x5eef4f){return util[_0x8f37('0xc3')]('cf_%d',_0x5eef4f['id']);}));}})[_0x8f37('0x18')](function(_0xdfd0a6){if(_0xdfd0a6&&!_[_0x8f37('0xc6')](_0xdfd0a6)){var _0x502da7=squel[_0x8f37('0x17')]()[_0x8f37('0xc7')](_0x8f37('0x3a'))['setFields'](_0xdfd0a6)[_0x8f37('0x33')](_0x8f37('0xc8'),_0x17a372[_0x8f37('0x85')]['id'])[_0x8f37('0xc9')]();return db[_0x8f37('0x75')][_0x8f37('0x2c')](_0x502da7[_0x8f37('0x51')],{'replacements':_0x502da7[_0x8f37('0x8e')]});}})[_0x8f37('0x18')](function(){if(_0x17a372['body'][_0x8f37('0xca')]&&_0x2f7b7a){return db[_0x8f37('0xcb')]['update']({'phone':_0x17a372[_0x8f37('0x8f')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x2f7b7a['id']}});}})['then'](function(){return _0x2f7b7a;})['then'](respondWithResult(_0x483069,null))[_0x8f37('0x86')](handleError(_0x483069,null));};exports['getTags']=function(_0x22686d,_0x263027){var _0x193e71={};var _0x25331d={};var _0x4bb4e1;var _0x53819d;return db[_0x8f37('0x1f')][_0x8f37('0x26')]({'where':{'id':_0x22686d[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x263027,null))[_0x8f37('0x18')](function(_0x52014a){if(_0x52014a){_0x4bb4e1=_0x52014a;_0x25331d[_0x8f37('0x2b')]=_[_0x8f37('0x21')](db['Tag'][_0x8f37('0xcc')]);_0x25331d[_0x8f37('0x2c')]=_['keys'](_0x22686d[_0x8f37('0x2c')]);_0x25331d[_0x8f37('0x34')]=_['intersection'](_0x25331d[_0x8f37('0x2b')],_0x25331d[_0x8f37('0x2c')]);_0x193e71[_0x8f37('0x2e')]=_[_0x8f37('0x2d')](_0x25331d[_0x8f37('0x2b')],qs['fields'](_0x22686d[_0x8f37('0x2c')]['fields']));_0x193e71[_0x8f37('0x2e')]=_0x193e71[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x193e71[_0x8f37('0x2e')]:_0x25331d[_0x8f37('0x2b')];_0x193e71[_0x8f37('0x31')]=qs['sort'](_0x22686d[_0x8f37('0x2c')][_0x8f37('0x32')]);_0x193e71['where']=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x22686d['query'],_0x25331d[_0x8f37('0x34')]));if(_0x22686d[_0x8f37('0x2c')][_0x8f37('0x5a')]){_0x193e71[_0x8f37('0x33')]=_[_0x8f37('0x78')](_0x193e71[_0x8f37('0x33')],{'$or':_['map'](_0x193e71['attributes'],function(_0x3f828c){var _0x262a9b={};_0x262a9b[_0x3f828c]={'$like':'%'+_0x22686d['query'][_0x8f37('0x5a')]+'%'};return _0x262a9b;})});}_0x193e71=_[_0x8f37('0x78')]({},_0x193e71,_0x22686d[_0x8f37('0xce')]);return _0x4bb4e1[_0x8f37('0xcf')](_0x193e71);}})[_0x8f37('0x18')](function(_0x4d2dad){if(_0x4d2dad){_0x53819d=_0x4d2dad[_0x8f37('0x28')];if(!_0x22686d[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x193e71['limit']=qs[_0x8f37('0x11')](_0x22686d['query'][_0x8f37('0x11')]);_0x193e71[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0x22686d[_0x8f37('0x2c')][_0x8f37('0x13')]);}return _0x4bb4e1['getTags'](_0x193e71);}})[_0x8f37('0x18')](function(_0x323d60){if(_0x323d60){return _0x323d60?{'count':_0x53819d,'rows':_0x323d60}:null;}})[_0x8f37('0x18')](respondWithResult(_0x263027,null))[_0x8f37('0x86')](handleError(_0x263027,null));};exports[_0x8f37('0xd1')]=function(_0x229473,_0x41d046){if(_0x229473[_0x8f37('0x8f')]['id']){delete _0x229473[_0x8f37('0x8f')]['id'];}return db[_0x8f37('0x1f')][_0x8f37('0x26')]({'where':{'id':_0x229473[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x41d046,null))[_0x8f37('0x18')](function(_0x5a2194){if(_0x5a2194){return _0x5a2194[_0x8f37('0xd1')](_0x229473[_0x8f37('0x8f')][_0x8f37('0xd2')]||[]);}return null;})[_0x8f37('0x18')](respondWithResult(_0x41d046,null))[_0x8f37('0x86')](handleError(_0x41d046,null));};exports[_0x8f37('0xd3')]=function(_0x35804c,_0x422e16){var _0x4fc5ee=[];_0x4fc5ee[_0x8f37('0x24')](addAdditionalPhones(_0x35804c[_0x8f37('0x8f')]));Promise[_0x8f37('0xbb')](_0x4fc5ee)[_0x8f37('0x18')](function(){_0x4fc5ee=[];_0x4fc5ee[_0x8f37('0x24')](deleteCmHopperPhones(_0x35804c[_0x8f37('0x8f')]['id']));_0x4fc5ee[_0x8f37('0x24')](addCmHopperPhones(_0x35804c[_0x8f37('0x8f')]['id']));Promise['all'](_0x4fc5ee)[_0x8f37('0x18')](function(){return[0x1];})[_0x8f37('0x18')](respondWithResult(_0x422e16,null));});};function addAdditionalPhones(_0x5548af){var _0x51499d;return new Promise(function(_0x4cbc0,_0x41cc1a){return db[_0x8f37('0xa2')]['destroy']({'where':{'CmContactId':_0x5548af['id']}})[_0x8f37('0x18')](function(){db[_0x8f37('0xbe')][_0x8f37('0x8b')]({'raw':!![],'attributes':['id',_0x8f37('0xd4')]})[_0x8f37('0x18')](function(_0xeaf9bf){var _0x4ac416=[];for(var _0x579293=0x0;_0x579293<_0x5548af[_0x8f37('0xd5')]['length'];_0x579293++){var _0x4998e5=_0x5548af['item_types']?_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd6')][_0x579293])?'':_0x5548af[_0x8f37('0xd6')][_0x579293]:_0x5548af[_0x8f37('0xd5')][_0x579293]['ItemTypeId']?_0x5548af[_0x8f37('0xd5')][_0x579293]['ItemTypeId']:'';var _0x13fa6f=_[_0x8f37('0xc0')](_0x5548af['items'][_0x579293][_0x8f37('0xd7')])?'':_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xd7')];var _0x44f4a7=_0x4998e5+':'+_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xca')]+'§'+_0x13fa6f;if(_[_0x8f37('0xc0')](_0x51499d))_0x51499d=_0x44f4a7;else _0x51499d+=';'+_0x44f4a7;var _0x177010=null;if(_0x5548af[_0x8f37('0xd6')]){if(!_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd6')][_0x579293])){var _0x23b452=_[_0x8f37('0x45')](_0xeaf9bf,function(_0x3c5ac3){return _0x3c5ac3['id']===_0x5548af[_0x8f37('0xd6')][_0x579293];});if(!_[_0x8f37('0xc0')](_0x23b452)){_0x177010=_0x23b452[_0x8f37('0xd4')];}}}else{if(!_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd5')][_0x579293])){var _0x23b452=_[_0x8f37('0x45')](_0xeaf9bf,function(_0x1c9300){return _0x1c9300['id']===_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xd8')];});if(!_[_0x8f37('0xc0')](_0x23b452)){_0x177010=_0x579293;}}}if(_[_0x8f37('0xc0')](_0x177010)){_0x177010=0x64;}_0x4ac416[_0x8f37('0x24')](addAdditionalPhone(_0x5548af['id'],_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xca')],_0x5548af[_0x8f37('0xd6')]?_[_0x8f37('0xc0')](_0x5548af[_0x8f37('0xd6')][_0x579293])?null:_0x5548af[_0x8f37('0xd6')][_0x579293]:_0x5548af[_0x8f37('0xd5')][_0x579293]['ItemTypeId']?_0x5548af[_0x8f37('0xd5')][_0x579293][_0x8f37('0xd8')]:null,_0x177010,_0x13fa6f));}Promise[_0x8f37('0xbb')](_0x4ac416)['then'](function(){db['CmContact'][_0x8f37('0x17')]({'AdditionalPhones':_0x51499d},{'where':{'id':_0x5548af['id']}})['then'](function(){_0x4cbc0(0x1);});});});});});}function addAdditionalPhone(_0x3f3db4,_0x493fc8,_0x21f1ef,_0x562208,_0x1a1a82){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x3f3db4,'item':_0x493fc8}})[_0x8f37('0x18')](function(_0x3737b1){if(_0x3737b1)logger[_0x8f37('0x94')]('contact\x20phone\x20exists',_0x3737b1);else{db[_0x8f37('0xa2')][_0x8f37('0x99')]({'CmContactId':_0x3f3db4,'item':_0x493fc8,'ItemTypeId':_0x21f1ef,'OrderBy':_0x562208,'ItemClass':_0x8f37('0xd9'),'description':_0x1a1a82});}});}function deletePhones(_0x28abb7){return db[_0x8f37('0xa2')][_0x8f37('0x19')]({'where':{'CmContactId':_0x28abb7}});}function deleteCmHopperPhones(_0x3b9a94){return new Promise(function(_0x15b2a9,_0x583a9b){return db['CmHopper'][_0x8f37('0x8b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3b9a94}})[_0x8f37('0x18')](function(_0x1449db){db['CmHopperAdditionalPhone'][_0x8f37('0x19')]({'where':{'CmHopperId':{'$in':_[_0x8f37('0x73')](_0x1449db,'id')}}});})[_0x8f37('0x18')](function(){_0x15b2a9(0x1);});});}function addCmHopperPhones(_0x22a2a0){return new Promise(function(_0x17e8db,_0x1c70a4){return db[_0x8f37('0xcb')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x22a2a0}})[_0x8f37('0x18')](function(_0x1c6a07){var _0x40c449=[];_['map'](_0x1c6a07,function(_0x394c5d){_0x40c449[_0x8f37('0x24')](createCmHopperPhone(_0x22a2a0,_0x394c5d['id']));});Promise[_0x8f37('0xbb')](_0x40c449)[_0x8f37('0x18')](function(){_0x17e8db(0x1);});});});}function createCmHopperPhone(_0x8ae25b,_0x49dd82){return new Promise(function(_0x2483dc,_0x2579dc){db['CmContactHasItem'][_0x8f37('0x8b')]({'raw':!![],'attributes':[_0x8f37('0xda'),_0x8f37('0xd4')],'where':{'CmContactId':_0x8ae25b,'ItemClass':_0x8f37('0xd9')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x8f37('0xbf')}],'order':[_0x8f37('0xd4'),db[_0x8f37('0x75')][_0x8f37('0xdb')](_0x8f37('0xdc'))]})[_0x8f37('0x18')](function(_0x231861){var _0x4b48d0=0x1;var _0x9ae709=_[_0x8f37('0x73')](_0x231861,function(_0xa732b7){_0xa732b7['CmHopperId']=_0x49dd82;_0xa732b7[_0x8f37('0xca')]=_0xa732b7['item'];_0xa732b7[_0x8f37('0xd4')]=_0x4b48d0;delete _0xa732b7['ItemType.OrderBy'];_0x4b48d0=_0x4b48d0+0x1;return _0xa732b7;});return db[_0x8f37('0xdd')]['bulkCreate'](_0x9ae709,{});})['then'](function(){_0x2483dc(0x1);});});}function insertAdditionalPhones(_0x2a60f6,_0x299bb2){return new Promise(function(_0xe8b6,_0xd9eee0){var _0x399169=[];for(var _0x1e0b1b=0x0;_0x1e0b1b<_0x299bb2[_0x8f37('0x28')];_0x1e0b1b++){var _0x375270=_0x299bb2[_0x1e0b1b];_0x399169[_0x8f37('0x24')](parseContactItemType(_0x375270));}Promise[_0x8f37('0xbb')](_0x399169)[_0x8f37('0x18')](function(){var _0x5672c1={'id':_0x2a60f6['id'],'items':_0x299bb2};return addAdditionalPhones(_0x5672c1)[_0x8f37('0x18')](function(_0x533f8c){return addCmHopperPhones(_0x2a60f6['id']);});})[_0x8f37('0x18')](function(){_0xe8b6(_0x2a60f6);});});}function parseContactItemType(_0x16bdad){return new Promise(function(_0x3db266,_0x271b9d){if(_0x16bdad[_0x8f37('0x30')](_0x8f37('0xd8'))){_0x3db266(_0x16bdad);}else{return db[_0x8f37('0xbe')]['find']({'where':{'name':_0x16bdad[_0x8f37('0xbf')]}})['then'](function(_0x356f6c){if(_['isNil'](_0x356f6c))_0x16bdad[_0x8f37('0xd8')]=null;else _0x16bdad[_0x8f37('0xd8')]=_0x356f6c['id'];_0x3db266(_0x16bdad);});}});}exports[_0x8f37('0xde')]=function(_0x361078,_0x2c97e9){return db[_0x8f37('0xa2')][_0x8f37('0x8b')]({'raw':!![],'where':{'CmContactId':_0x361078[_0x8f37('0x85')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x8f37('0xbf')}],'order':[[_0x8f37('0xd4')],[db[_0x8f37('0x75')][_0x8f37('0xdb')](_0x8f37('0xdc'))]]})[_0x8f37('0x18')](function(_0x165364){return _0x165364;})[_0x8f37('0x18')](respondWithResult(_0x2c97e9,null))[_0x8f37('0x86')](handleError(_0x2c97e9,null));};exports[_0x8f37('0xdf')]=function(_0x2ea982,_0x3be29b){return db[_0x8f37('0xa2')]['findAll']({'raw':!![],'where':{'CmContactId':_0x2ea982[_0x8f37('0x8f')][_0x8f37('0xe0')]}})['then'](function(_0x2c886c){var _0x2d24b4=_[_0x8f37('0x73')](_0x2c886c,function(_0x151944){_0x151944[_0x8f37('0xe1')]=_0x2ea982[_0x8f37('0x8f')][_0x8f37('0xe2')];return _0x151944;});return db[_0x8f37('0xa2')][_0x8f37('0xb4')](_0x2d24b4,{});})[_0x8f37('0x18')](function(_0x496f05){return addCmHopperPhones(_0x2ea982[_0x8f37('0x8f')][_0x8f37('0xe2')]);})[_0x8f37('0x18')](function(_0x5a6cfa){return['ok'];})[_0x8f37('0x18')](respondWithResult(_0x3be29b,null))[_0x8f37('0x86')](handleError(_0x3be29b,null));};exports[_0x8f37('0xe3')]=function(_0x2e1a25,_0x27fbec){var _0x3e6dee=[];_0x3e6dee[_0x8f37('0x24')](createCmHopperPhone(_0x2e1a25[_0x8f37('0x8f')]['id'],_0x2e1a25[_0x8f37('0x8f')][_0x8f37('0xe4')]));Promise[_0x8f37('0xbb')](_0x3e6dee)[_0x8f37('0x18')](function(){return[0x1];})[_0x8f37('0x18')](respondWithResult(_0x27fbec,null));};exports[_0x8f37('0xe5')]=function(_0x31ef66,_0x535b0e){var _0x31113e={'raw':![],'where':{}};var _0xe89ed6={};var _0xf5af89={'count':0x0,'rows':[]};return db['CmContact'][_0x8f37('0x26')]({'where':{'id':_0x31ef66[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x535b0e,null))[_0x8f37('0x18')](function(_0x42d20f){if(_0x42d20f){_0xe89ed6[_0x8f37('0x2b')]=_['keys'](db['CmHopper']['rawAttributes']);_0xe89ed6['query']=_[_0x8f37('0x21')](_0x31ef66[_0x8f37('0x2c')]);_0xe89ed6[_0x8f37('0x34')]=_[_0x8f37('0x2d')](_0xe89ed6[_0x8f37('0x2b')],_0xe89ed6[_0x8f37('0x2c')]);_0x31113e[_0x8f37('0x2e')]=_[_0x8f37('0x2d')](_0xe89ed6['model'],qs[_0x8f37('0x2f')](_0x31ef66[_0x8f37('0x2c')][_0x8f37('0x2f')]));_0x31113e[_0x8f37('0x2e')]=_0x31113e[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x31113e[_0x8f37('0x2e')]:_0xe89ed6['model'];if(!_0x31ef66[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x31113e[_0x8f37('0x11')]=qs[_0x8f37('0x11')](_0x31ef66[_0x8f37('0x2c')]['limit']);_0x31113e['offset']=qs[_0x8f37('0x13')](_0x31ef66['query']['offset']);}_0x31113e[_0x8f37('0x31')]=qs[_0x8f37('0x32')](_0x31ef66['query'][_0x8f37('0x32')]);_0x31113e[_0x8f37('0x33')]=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x31ef66['query'],_0xe89ed6['filters']));_0x31113e[_0x8f37('0x33')][_0x8f37('0xe6')]=_0x42d20f['id'];if(_0x31ef66['query'][_0x8f37('0x5a')]){_0x31113e[_0x8f37('0x33')]=_[_0x8f37('0x78')](_0x31113e[_0x8f37('0x33')],{'$or':_['map'](_0x31113e[_0x8f37('0x2e')],function(_0xce7053){var _0x54f256={};_0x54f256[_0xce7053]={'$like':'%'+_0x31ef66[_0x8f37('0x2c')][_0x8f37('0x5a')]+'%'};return _0x54f256;})});}_0x31113e=_['merge']({},_0x31113e,_0x31ef66[_0x8f37('0xce')]);return db[_0x8f37('0xcb')][_0x8f37('0x12')]({'where':_0x31113e[_0x8f37('0x33')]})['then'](function(_0xf566d8){_0xf5af89[_0x8f37('0x12')]=_0xf566d8;if(_0x31ef66['query']['includeAll']){_0x31113e[_0x8f37('0xe7')]=[{'all':!![]}];}return db[_0x8f37('0xcb')][_0x8f37('0x8b')](_0x31113e);})[_0x8f37('0x18')](function(_0x33c31d){_0xf5af89[_0x8f37('0x84')]=_0x33c31d;return _0xf5af89;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x535b0e,_0x31113e))['catch'](handleError(_0x535b0e,null));};exports[_0x8f37('0xe8')]=function(_0xa6fa9a,_0x4d7be4){var _0x367cd9={'raw':!![],'where':{}};var _0x3458c1={};var _0x3d9970={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa6fa9a[_0x8f37('0x85')]['id']}})[_0x8f37('0x18')](handleEntityNotFound(_0x4d7be4,null))[_0x8f37('0x18')](function(_0x1c095f){if(_0x1c095f){_0x3458c1[_0x8f37('0x2b')]=_['keys'](db[_0x8f37('0xa4')][_0x8f37('0xcc')]);_0x3458c1[_0x8f37('0x2c')]=_[_0x8f37('0x21')](_0xa6fa9a[_0x8f37('0x2c')]);_0x3458c1['filters']=_[_0x8f37('0x2d')](_0x3458c1[_0x8f37('0x2b')],_0x3458c1['query']);_0x367cd9[_0x8f37('0x2e')]=_[_0x8f37('0x2d')](_0x3458c1[_0x8f37('0x2b')],qs[_0x8f37('0x2f')](_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x2f')]));_0x367cd9[_0x8f37('0x2e')]=_0x367cd9[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x367cd9[_0x8f37('0x2e')]:_0x3458c1[_0x8f37('0x2b')];if(!_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x367cd9['limit']=qs['limit'](_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x11')]);_0x367cd9[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0xa6fa9a[_0x8f37('0x2c')]['offset']);}_0x367cd9[_0x8f37('0x31')]=qs['sort'](_0xa6fa9a[_0x8f37('0x2c')]['sort']);_0x367cd9[_0x8f37('0x33')]=qs['filters'](_[_0x8f37('0xcd')](_0xa6fa9a[_0x8f37('0x2c')],_0x3458c1[_0x8f37('0x34')]));_0x367cd9['where'][_0x8f37('0xe6')]=_0x1c095f['id'];if(_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x5a')]){_0x367cd9[_0x8f37('0x33')]=_[_0x8f37('0x78')](_0x367cd9[_0x8f37('0x33')],{'$or':_[_0x8f37('0x73')](_0x367cd9[_0x8f37('0x2e')],function(_0x508f3b){var _0x1ebe3e={};_0x1ebe3e[_0x508f3b]={'$like':'%'+_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0x5a')]+'%'};return _0x1ebe3e;})});}_0x367cd9=_['merge']({},_0x367cd9,_0xa6fa9a['options']);return db[_0x8f37('0xa4')][_0x8f37('0x12')]({'where':_0x367cd9[_0x8f37('0x33')]})[_0x8f37('0x18')](function(_0x201d3b){_0x3d9970[_0x8f37('0x12')]=_0x201d3b;if(_0xa6fa9a[_0x8f37('0x2c')][_0x8f37('0xe9')]){_0x367cd9[_0x8f37('0xe7')]=[{'all':!![]}];}return db[_0x8f37('0xa4')][_0x8f37('0x8b')](_0x367cd9);})['then'](function(_0x415ae2){_0x3d9970[_0x8f37('0x84')]=_0x415ae2;return _0x3d9970;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x4d7be4,_0x367cd9))[_0x8f37('0x86')](handleError(_0x4d7be4,null));};exports[_0x8f37('0xea')]=function(_0x589849,_0x1a70c9){var _0x51b3d0={'raw':!![],'where':{}};var _0x2a793f={};var _0x53a897={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x589849[_0x8f37('0x85')]['id']}})['then'](handleEntityNotFound(_0x1a70c9,null))[_0x8f37('0x18')](function(_0x215fac){if(_0x215fac){_0x2a793f['model']=_[_0x8f37('0x21')](db['CmHopperFinal'][_0x8f37('0xcc')]);_0x2a793f['query']=_[_0x8f37('0x21')](_0x589849[_0x8f37('0x2c')]);_0x2a793f['filters']=_[_0x8f37('0x2d')](_0x2a793f['model'],_0x2a793f[_0x8f37('0x2c')]);_0x51b3d0['attributes']=_['intersection'](_0x2a793f[_0x8f37('0x2b')],qs[_0x8f37('0x2f')](_0x589849[_0x8f37('0x2c')][_0x8f37('0x2f')]));_0x51b3d0[_0x8f37('0x2e')]=_0x51b3d0[_0x8f37('0x2e')][_0x8f37('0x28')]?_0x51b3d0[_0x8f37('0x2e')]:_0x2a793f['model'];if(!_0x589849[_0x8f37('0x2c')]['hasOwnProperty'](_0x8f37('0xd0'))){_0x51b3d0['limit']=qs[_0x8f37('0x11')](_0x589849['query']['limit']);_0x51b3d0[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0x589849[_0x8f37('0x2c')][_0x8f37('0x13')]);}_0x51b3d0[_0x8f37('0x31')]=qs[_0x8f37('0x32')](_0x589849[_0x8f37('0x2c')][_0x8f37('0x32')]);_0x51b3d0['where']=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x589849[_0x8f37('0x2c')],_0x2a793f[_0x8f37('0x34')]));_0x51b3d0[_0x8f37('0x33')][_0x8f37('0xe6')]=_0x215fac['id'];if(_0x589849['query'][_0x8f37('0x5a')]){_0x51b3d0['where']=_[_0x8f37('0x78')](_0x51b3d0[_0x8f37('0x33')],{'$or':_[_0x8f37('0x73')](_0x51b3d0[_0x8f37('0x2e')],function(_0xcae272){var _0x192a1a={};_0x192a1a[_0xcae272]={'$like':'%'+_0x589849[_0x8f37('0x2c')][_0x8f37('0x5a')]+'%'};return _0x192a1a;})});}_0x51b3d0=_[_0x8f37('0x78')]({},_0x51b3d0,_0x589849[_0x8f37('0xce')]);return db[_0x8f37('0xa3')][_0x8f37('0x12')]({'where':_0x51b3d0['where']})['then'](function(_0x8a6bc9){_0x53a897[_0x8f37('0x12')]=_0x8a6bc9;if(_0x589849[_0x8f37('0x2c')][_0x8f37('0xe9')]){_0x51b3d0[_0x8f37('0xe7')]=[{'all':!![]}];}return db[_0x8f37('0xa3')]['findAll'](_0x51b3d0);})[_0x8f37('0x18')](function(_0x505a4a){_0x53a897[_0x8f37('0x84')]=_0x505a4a;return _0x53a897;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x1a70c9,_0x51b3d0))[_0x8f37('0x86')](handleError(_0x1a70c9,null));};exports[_0x8f37('0xeb')]=function(_0x462c81,_0x287706){var _0x350c4e={'raw':!![],'where':{}};var _0x33ebf6={};var _0x125cc0={'count':0x0,'rows':[]};return db['CmContact'][_0x8f37('0x26')]({'where':{'id':_0x462c81['params']['id']}})['then'](handleEntityNotFound(_0x287706,null))[_0x8f37('0x18')](function(_0x3b8549){if(_0x3b8549){_0x33ebf6[_0x8f37('0x2b')]=_[_0x8f37('0x21')](db[_0x8f37('0xac')][_0x8f37('0xcc')]);_0x33ebf6[_0x8f37('0x2c')]=_['keys'](_0x462c81[_0x8f37('0x2c')]);_0x33ebf6['filters']=_[_0x8f37('0x2d')](_0x33ebf6[_0x8f37('0x2b')],_0x33ebf6[_0x8f37('0x2c')]);_0x350c4e['attributes']=_[_0x8f37('0x2d')](_0x33ebf6['model'],qs[_0x8f37('0x2f')](_0x462c81[_0x8f37('0x2c')]['fields']));_0x350c4e['attributes']=_0x350c4e['attributes'][_0x8f37('0x28')]?_0x350c4e['attributes']:_0x33ebf6[_0x8f37('0x2b')];if(!_0x462c81['query']['hasOwnProperty'](_0x8f37('0xd0'))){_0x350c4e[_0x8f37('0x11')]=qs[_0x8f37('0x11')](_0x462c81[_0x8f37('0x2c')]['limit']);_0x350c4e[_0x8f37('0x13')]=qs['offset'](_0x462c81[_0x8f37('0x2c')]['offset']);}_0x350c4e[_0x8f37('0x31')]=qs['sort'](_0x462c81['query']['sort']);_0x350c4e[_0x8f37('0x33')]=qs[_0x8f37('0x34')](_[_0x8f37('0xcd')](_0x462c81[_0x8f37('0x2c')],_0x33ebf6[_0x8f37('0x34')]));_0x350c4e['where'][_0x8f37('0xe6')]=_0x3b8549['id'];if(_0x462c81[_0x8f37('0x2c')][_0x8f37('0x5a')]){_0x350c4e[_0x8f37('0x33')]=_['merge'](_0x350c4e[_0x8f37('0x33')],{'$or':_[_0x8f37('0x73')](_0x350c4e[_0x8f37('0x2e')],function(_0x26cfc7){var _0x5314dd={};_0x5314dd[_0x26cfc7]={'$like':'%'+_0x462c81[_0x8f37('0x2c')]['filter']+'%'};return _0x5314dd;})});}_0x350c4e=_['merge']({},_0x350c4e,_0x462c81[_0x8f37('0xce')]);return db[_0x8f37('0xac')][_0x8f37('0x12')]({'where':_0x350c4e[_0x8f37('0x33')]})[_0x8f37('0x18')](function(_0x1a4af9){_0x125cc0['count']=_0x1a4af9;if(_0x462c81[_0x8f37('0x2c')][_0x8f37('0xe9')]){_0x350c4e[_0x8f37('0xe7')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x350c4e);})['then'](function(_0x3abd46){_0x125cc0['rows']=_0x3abd46;return _0x125cc0;});}})[_0x8f37('0x18')](respondWithFilteredResult(_0x287706,_0x350c4e))['catch'](handleError(_0x287706,null));};exports[_0x8f37('0xec')]=function(_0x4c7ae5,_0x512e80){try{if(!_0x4c7ae5[_0x8f37('0x8f')]['ListId']){throw new Error(_0x8f37('0xed'));}if(!_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xee')]){throw new Error(_0x8f37('0xef'));}if(!_0x4c7ae5['body'][_0x8f37('0xf0')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4c7ae5[_0x8f37('0x8f')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1c8b48=_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xee')][_0x8f37('0x47')](',');var _0x2832b0=_0x4c7ae5['body']['binding_values'][_0x8f37('0x47')](',');if(!_0x1c8b48[_0x8f37('0x28')]||!_0x2832b0[_0x8f37('0x28')]||_0x1c8b48[_0x8f37('0x28')]!==_0x2832b0[_0x8f37('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x2f')]=_[_0x8f37('0xf1')](_0x1c8b48,_0x2832b0);if(!_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x2f')][_0x8f37('0xca')]){throw new Error(_0x8f37('0xf2'));}if(!_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x2f')][_0x8f37('0xf3')]){throw new Error(_0x8f37('0xf4'));}var _0xd6439a=path[_0x8f37('0x93')](config['root'],'server/files/tmp',_0x4c7ae5['file'][_0x8f37('0xf5')]);fs[_0x8f37('0xf6')](_0xd6439a,parseInt(_0x8f37('0xf7'),0x8));var _0x1f4437=require(_0x8f37('0xf8'))[_0x8f37('0xf9')](path[_0x8f37('0x93')](__dirname,_0x8f37('0xfa')),[_0xd6439a,_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xee')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xf0')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0x74')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xfb')],_0x4c7ae5[_0x8f37('0x8f')][_0x8f37('0xb6')],_0x4c7ae5[_0x8f37('0x8f')]['socket_timestamp']]);return _0x512e80['status'](0xc8)['json']({'message':_0x8f37('0xfc'),'pid':_0x1f4437[_0x8f37('0xfd')]});}catch(_0x3538f6){return _0x512e80[_0x8f37('0xf')](0x1f4)[_0x8f37('0xfe')](_0x3538f6);}};exports[_0x8f37('0xff')]=function(_0x1c4556,_0x4a74e0){var _0x36f291=fs[_0x8f37('0x100')](_0x1c4556[_0x8f37('0x101')][_0x8f37('0x102')]);Papa[_0x8f37('0x103')](_0x36f291,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x25f997){return _0x4a74e0[_0x8f37('0xf')](0xc8)[_0x8f37('0x16')]({'file':_0x1c4556[_0x8f37('0x101')],'fields':_0x25f997[_0x8f37('0x104')][_0x8f37('0x2f')]});}});};exports[_0x8f37('0x105')]=function(_0x49e3aa,_0x3d5e6a){return db[_0x8f37('0x70')][_0x8f37('0x8b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8f37('0x6e')}})['then'](function(_0x35df49){var _0xbd8908=![];if(!_0x49e3aa[_0x8f37('0x8f')][_0x8f37('0x74')]){throw new Error(_0x8f37('0xed'));}if(!_0x49e3aa[_0x8f37('0x8f')][_0x8f37('0x106')]['phone']){throw new Error(_0x8f37('0xf2'));}if(!_0x49e3aa[_0x8f37('0x8f')][_0x8f37('0x106')][_0x8f37('0xf3')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x49e3aa['body'][_0x8f37('0x107')]){throw new Error(_0x8f37('0x108'));}var _0x823444=require(_0x8f37('0xf8'))[_0x8f37('0xf9')](path[_0x8f37('0x93')](__dirname,_0x8f37('0x109')),[_0x49e3aa[_0x8f37('0x85')]['id'],JSON[_0x8f37('0x10a')](_0x49e3aa[_0x8f37('0x8f')]),JSON[_0x8f37('0x10a')](_0x35df49)]);_0x823444['on'](_0x8f37('0x10b'),function(){_0xbd8908=!![];return _0x3d5e6a['status'](0xc8)[_0x8f37('0x16')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x823444[_0x8f37('0xfd')]});});_0x823444['on']('exit',function(_0x5acb0a){if(_0x5acb0a&&!_0xbd8908){return _0x3d5e6a[_0x8f37('0xf')](0x1f4)[_0x8f37('0x16')]({'message':_0x8f37('0x10c'),'pid':_0x823444[_0x8f37('0xfd')]});}});})['catch'](handleError(_0x3d5e6a,null));};exports[_0x8f37('0x10d')]=function(_0x51de0c,_0x5c8c5c,_0x413511){return db['User'][_0x8f37('0x8b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8f37('0x6e')}})[_0x8f37('0x18')](function(_0x36eb7f){var _0x3d933c=![];if(!_0x51de0c[_0x8f37('0x8f')][_0x8f37('0x74')]){throw new Error(_0x8f37('0xed'));}if(!_0x51de0c[_0x8f37('0x8f')][_0x8f37('0x106')][_0x8f37('0xca')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x51de0c[_0x8f37('0x8f')][_0x8f37('0x106')]['firstName']){throw new Error(_0x8f37('0xf4'));}if(!_0x51de0c[_0x8f37('0x8f')]['socket_timestamp']){throw new Error(_0x8f37('0x108'));}var _0x4a7617=require(_0x8f37('0xf8'))['fork'](path[_0x8f37('0x93')](__dirname,'../../components/import/cm/csvUpdates'),[_0x51de0c[_0x8f37('0x85')]['id'],JSON[_0x8f37('0x10a')](_0x51de0c[_0x8f37('0x8f')]),JSON['stringify'](_0x36eb7f)]);_0x4a7617['on']('message',function(_0x549eba){_0x3d933c=!![];return _0x5c8c5c[_0x8f37('0xf')](0xc8)[_0x8f37('0x16')]({'message':_0x8f37('0x10e'),'pid':_0x4a7617[_0x8f37('0xfd')]});});_0x4a7617['on'](_0x8f37('0x10f'),function(_0x230c85){if(_0x230c85&&!_0x3d933c){return _0x5c8c5c[_0x8f37('0xf')](0x1f4)[_0x8f37('0x16')]({'message':_0x8f37('0x10c'),'pid':_0x4a7617[_0x8f37('0xfd')]});}});})[_0x8f37('0x86')](handleError(_0x5c8c5c,null));};exports['getJourney']=function(_0x40ea5b,_0x1af941){var _0x35b8ee=[_0x8f37('0x110'),_0x8f37('0x111'),_0x8f37('0x112'),_0x8f37('0x113'),'fax','whatsapp',_0x8f37('0x114')];var _0x1010e9={'offset':0x0,'order':qs[_0x8f37('0x32')]('-createdAt')},_0x584379={'count':0x0,'rows':[]};Promise[_0x8f37('0x6c')]()[_0x8f37('0x18')](function(){if(_0x40ea5b['query'][_0x8f37('0x115')]){if(!_['includes'](_0x35b8ee,_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x115')][_0x8f37('0x116')]())){throw new Error('Invalid\x20channel');}_0x35b8ee=[_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x115')][_0x8f37('0x116')]()];}if(_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x117')]){try{var _0x3421b7=JSON[_0x8f37('0x103')](_0x40ea5b[_0x8f37('0x2c')]['range']);if(!moment(_0x3421b7['from'])['isValid']()){throw new Error(_0x8f37('0x118'));}if(!moment(_0x3421b7['to'])[_0x8f37('0x119')]()){throw new Error(_0x8f37('0x11a'));}}catch(_0x3be0d3){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x30')](_0x8f37('0xd0'))){_0x1010e9[_0x8f37('0x11')]=qs[_0x8f37('0x11')](_0x40ea5b['query']['limit']||0xa);_0x1010e9[_0x8f37('0x13')]=qs[_0x8f37('0x13')](_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x13')]);}var _0x5c358d=_0x35b8ee[_0x8f37('0x73')](function(_0x3d30b6){if(_0x3d30b6===_0x8f37('0x114')){var _0x25aad4={'attributes':['id',_0x8f37('0x11b'),_0x8f37('0x2a'),_0x8f37('0x11c'),'destination','callerid',_0x8f37('0x11d'),_0x8f37('0x11e'),_0x8f37('0x11f'),_0x8f37('0x120'),_0x8f37('0x121'),_0x8f37('0x122'),'userSecondDisposition','userThirdDisposition',_0x8f37('0x123')],'where':{'ContactId':_0x40ea5b[_0x8f37('0x85')]['id']},'include':[{'model':db[_0x8f37('0x70')],'as':_0x8f37('0x70'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x124'),_0x8f37('0x8c')]}],'order':[[_0x8f37('0x121'),_0x8f37('0x69')]]};if(_0x40ea5b[_0x8f37('0x2c')][_0x8f37('0x117')]){_0x25aad4[_0x8f37('0x33')][_0x8f37('0x121')]={'$gte':_0x3421b7[_0x8f37('0x39')],'$lte':_0x3421b7['to']};}return db[_0x8f37('0xa6')][_0x8f37('0x125')](_0x25aad4)[_0x8f37('0x18')](function(_0x5b408c){_0x584379[_0x8f37('0x12')]+=_0x5b408c[_0x8f37('0x12')];return _[_0x8f37('0x73')](_0x5b408c[_0x8f37('0x84')],function(_0x20c732){var _0x273c91=_0x20c732['get']({'plain':!![]});_0x273c91[_0x8f37('0x115')]=_0x3d30b6;if(_0x273c91[_0x8f37('0x70')]){_0x273c91['User']={'id':_0x273c91[_0x8f37('0x70')]['id'],'name':_0x273c91[_0x8f37('0x70')][_0x8f37('0x1d')],'fullname':_0x273c91[_0x8f37('0x70')][_0x8f37('0x124')],'alias':_0x273c91['User'][_0x8f37('0x8c')]};}return _0x273c91;});});}else{var _0x2e46cc=_[_0x8f37('0x126')](_0x3d30b6)+(_0x3d30b6==='chat'?_0x8f37('0x127'):'Account');var _0x4d1afa={'attributes':['id','closed',_0x8f37('0x128'),_0x8f37('0x121'),_0x8f37('0x120'),_0x8f37('0x129'),'secondDisposition',_0x8f37('0x12a'),_0x8f37('0x123'),_0x2e46cc+'Id'],'where':{'ContactId':_0x40ea5b['params']['id']},'include':[{'model':db[_0x2e46cc],'as':_0x8f37('0x12b'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x12c')]},{'model':db[_0x8f37('0x70')],'as':_0x8f37('0x12d'),'attributes':['id',_0x8f37('0x1d'),'fullname']},{'model':db[_0x8f37('0xbd')],'as':_0x8f37('0x83'),'attributes':['id',_0x8f37('0x1d'),_0x8f37('0x36')],'through':{'attributes':[]}}],'order':[['createdAt',_0x8f37('0x69')]]};if(_0x40ea5b['query'][_0x8f37('0x117')]){_0x4d1afa[_0x8f37('0x33')][_0x8f37('0x121')]={'$gte':_0x3421b7['from'],'$lte':_0x3421b7['to']};}switch(_0x3d30b6){case _0x8f37('0x111'):_0x4d1afa[_0x8f37('0x2e')][_0x8f37('0x24')](_0x8f37('0x12e'),_0x8f37('0x12f'),_0x8f37('0x130'),'deviceModel',_0x8f37('0x131'),_0x8f37('0x132'),_0x8f37('0x133'),_0x8f37('0x134'),_0x8f37('0x135'));break;case _0x8f37('0x110'):_0x4d1afa[_0x8f37('0x2e')]['push'](_0x8f37('0x136'),'substatus');break;case _0x8f37('0x113'):_0x4d1afa[_0x8f37('0x2e')][_0x8f37('0x24')](_0x8f37('0x137'),_0x8f37('0x138'));break;}return db[_[_0x8f37('0x126')](_0x3d30b6)+_0x8f37('0x139')]['findAndCountAll'](_0x4d1afa)['then'](function(_0x559b8c){_0x584379[_0x8f37('0x12')]+=_0x559b8c['count'];return _[_0x8f37('0x73')](_0x559b8c[_0x8f37('0x84')],function(_0x3d2c55){var _0x3282ed=_0x3d2c55[_0x8f37('0x90')]({'plain':!![]});_0x3282ed['channel']=_0x3d30b6;if(_0x3282ed[_0x8f37('0x12d')]){_0x3282ed['Owner']={'id':_0x3282ed['Owner']['id'],'name':_0x3282ed[_0x8f37('0x12d')][_0x8f37('0x1d')],'fullname':_0x3282ed['Owner'][_0x8f37('0x124')]};}return _0x3282ed;});});}});return Promise[_0x8f37('0xbb')](_0x5c358d);})[_0x8f37('0x18')](function(_0x221831){return _(_0x221831)[_0x8f37('0x13a')]()[_0x8f37('0x13b')](_0x8f37('0x121'))[_0x8f37('0x13c')]()['value']();})[_0x8f37('0x18')](function(_0xb0d5bc){_0x584379[_0x8f37('0x84')]=_0x1010e9['limit']?_0xb0d5bc['slice'](_0x1010e9[_0x8f37('0x13')],_0x1010e9[_0x8f37('0x13')]+_0x1010e9['limit']):_0xb0d5bc;return _0x584379;})[_0x8f37('0x18')](respondWithFilteredResult(_0x1af941,_0x1010e9))[_0x8f37('0x86')](handleError(_0x1af941,null));}; \ No newline at end of file +var _0x4b37=['[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','params','name','Phones','ContactItemType','literal','Phones.OrderBy','get','$and','cf_%d','omit','pickBy','table','setFields','values','CmHopper','phone','getTags','rawAttributes','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','getHopperHistories','getHopperFinals','ContactId','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','alias','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','Interaction','flatten','sortBy','reverse','slice','moment','util','path','squel','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','offset','limit','undefined','count','status','set','json','update','destroy','then','end','sendStatus','error','stack','send','index','CmContact','keys','length','startsWith','CmCustomField','findOne','trimStart','all','cf_','fieldType','query','intersection','model','fields','attributes','hasOwnProperty','sort','where','filters','pick','select','field','color','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','castTo','DATE','text','map','filter','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','forEach','replace','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','group','Sequelize','QueryTypes','SELECT','clone','c.id','order','DESC','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.CompanyId','TagIds','Tags','push','rows','catch','describe','tags','columnName','displayName','analytics','findAll','custom','body','mergeWith','join','info'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x4b37,0xb0));var _0x74b3=function(_0x313903,_0x338dc6){_0x313903=_0x313903-0x0;var _0x4c6d4b=_0x4b37[_0x313903];return _0x4c6d4b;};'use strict';var moment=require(_0x74b3('0x0'));var BPromise=require('bluebird');var util=require(_0x74b3('0x1'));var path=require(_0x74b3('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x74b3('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x74b3('0x4'));var logger=require(_0x74b3('0x5'))(_0x74b3('0x6'));var config=require(_0x74b3('0x7'));var shared=require(_0x74b3('0x8'));var db=require(_0x74b3('0x9'))['db'];config[_0x74b3('0xa')]=_[_0x74b3('0xb')](config[_0x74b3('0xa')],{'host':_0x74b3('0xc'),'port':0x18eb});var socket=require(_0x74b3('0xd'))(new Redis(config[_0x74b3('0xa')]));require(_0x74b3('0xe'))[_0x74b3('0xf')](socket);function respondWithResult(_0x1da85f,_0x47f067){_0x47f067=_0x47f067||0xc8;return function(_0x2031ba){if(_0x2031ba){return _0x1da85f['status'](_0x47f067)['json'](_0x2031ba);}};}function respondWithFilteredResult(_0x16f6af,_0x2f00b2){return function(_0x17f4a2){if(_0x17f4a2){var _0x52ae50=typeof _0x2f00b2[_0x74b3('0x10')]==='undefined'&&typeof _0x2f00b2[_0x74b3('0x11')]===_0x74b3('0x12');var _0x20fa01=_0x17f4a2[_0x74b3('0x13')];var _0x6eb903=_0x52ae50?0x0:_0x2f00b2[_0x74b3('0x10')];var _0x373af5=_0x52ae50?_0x17f4a2[_0x74b3('0x13')]:_0x2f00b2['offset']+_0x2f00b2[_0x74b3('0x11')];var _0x30bbe9;if(_0x373af5>=_0x20fa01){_0x373af5=_0x20fa01;_0x30bbe9=0xc8;}else{_0x30bbe9=0xce;}_0x16f6af[_0x74b3('0x14')](_0x30bbe9);return _0x16f6af[_0x74b3('0x15')]('Content-Range',_0x6eb903+'-'+_0x373af5+'/'+_0x20fa01)[_0x74b3('0x16')](_0x17f4a2);}return null;};}function saveUpdates(_0x1ce291){return function(_0x1c6ae7){if(_0x1c6ae7){return _0x1c6ae7[_0x74b3('0x17')](_0x1ce291)['then'](function(_0x4ad1ea){return _0x4ad1ea;});}return null;};}function removeEntity(_0x42944e){return function(_0x317071){if(_0x317071){return _0x317071[_0x74b3('0x18')]()[_0x74b3('0x19')](function(){_0x42944e[_0x74b3('0x14')](0xcc)[_0x74b3('0x1a')]();});}};}function handleEntityNotFound(_0x1e7407){return function(_0x649b10){if(!_0x649b10){_0x1e7407[_0x74b3('0x1b')](0x194);}return _0x649b10;};}function handleError(_0x185394,_0xd9f7e0){_0xd9f7e0=_0xd9f7e0||0x1f4;return function(_0x4ea217){logger[_0x74b3('0x1c')](_0x4ea217[_0x74b3('0x1d')]);if(_0x4ea217['name']){delete _0x4ea217['name'];}_0x185394['status'](_0xd9f7e0)[_0x74b3('0x1e')](_0x4ea217);};}exports[_0x74b3('0x1f')]=function(_0x4c85fe,_0x47e68c){var _0x76a8aa={},_0x150496={},_0x57968a={'count':0x0,'rows':[]};return db[_0x74b3('0x20')]['describe']()[_0x74b3('0x19')](function(_0x55d3dd){var _0x495f4e=[];for(var _0x1886e0=0x0;_0x1886e00x1){_0x476ca2['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x74b3('0x5c')](_0x12be04),null);}else{if(qs[_0x74b3('0x5d')](_0x12be04)){_0x476ca2['or']('c.id\x20LIKE\x20?',_0x12be04+'%');_0x476ca2['or'](_0x74b3('0x5e'),_0x12be04+'%');_0x476ca2['or'](_0x74b3('0x5f'),_0x12be04+'%');_0x476ca2['or']('c.fax\x20LIKE\x20?',_0x12be04+'%');}else if(qs[_0x74b3('0x60')](_0x12be04)){_0x476ca2['or']('c.email\x20LIKE\x20?',_0x12be04+'%');}else{_0x476ca2['or']('c.firstName\x20LIKE\x20?','%'+_0x12be04+'%');_0x476ca2['or']('c.lastName\x20LIKE\x20?','%'+_0x12be04+'%');_0x476ca2['or']('c.email\x20LIKE\x20?','%'+_0x12be04+'%');}}}}_0x3adc67['where'](_0x476ca2);_0x3adc67[_0x74b3('0x61')]('c.id');var _0x13dfbf={'type':db[_0x74b3('0x62')][_0x74b3('0x63')][_0x74b3('0x64')],'raw':!![]};var _0x465ac8=_0x3adc67[_0x74b3('0x65')]()[_0x74b3('0x35')](_0x74b3('0x66'));if(_0x76a8aa[_0x74b3('0x67')]){_0x76a8aa[_0x74b3('0x67')][_0x74b3('0x5a')](function(_0x805229){_0x3adc67[_0x74b3('0x67')]('c.'+_0x805229[0x0],_0x805229[0x1]===_0x74b3('0x68')?![]:!![]);});}if(!_[_0x74b3('0x53')](_0x501ccd)){_0x3adc67['having'](_0x2ef8e7);_0x465ac8[_0x74b3('0x31')](_0x74b3('0x69'),_0x501ccd);}BPromise[_0x74b3('0x6a')]()[_0x74b3('0x19')](function(){if(!_0xbfdbd1)return;if(_0x4c85fe[_0x74b3('0x6b')][_0x74b3('0x6c')]!==_0x74b3('0x6d'))return;if(!_[_0x74b3('0x6e')](_0xbfdbd1[_0x74b3('0x43')],['field',_0x74b3('0x49')])){return _0x4c85fe[_0x74b3('0x6b')][_0x74b3('0x6f')]({'attributes':['id'],'raw':!![]})[_0x74b3('0x19')](function(_0x594a47){if(_[_0x74b3('0x53')](_0x594a47)){_0x465ac8['where'](_0x74b3('0x70'));_0x3adc67[_0x74b3('0x31')](_0x74b3('0x70'));}else{_0x465ac8[_0x74b3('0x31')](_0x74b3('0x71'),_[_0x74b3('0x50')](_0x594a47,'id'));_0x3adc67['where'](_0x74b3('0x71'),_[_0x74b3('0x50')](_0x594a47,'id'));}});}})['then'](function(){if(_0x4c85fe[_0x74b3('0x6b')][_0x74b3('0x6c')]==='agent'&&!_0xbfdbd1&&!_0x4c85fe[_0x74b3('0x2a')][_0x74b3('0x54')])return[];return db[_0x74b3('0x72')][_0x74b3('0x2a')](_0x465ac8[_0x74b3('0x73')](),_0x13dfbf);})[_0x74b3('0x19')](function(_0x123fd6){_0x57968a[_0x74b3('0x13')]=_0x123fd6['length'];if(_0x57968a[_0x74b3('0x13')]===0x0)return[];return db['sequelize'][_0x74b3('0x2a')](_0x4b7129['toString'](),_0x13dfbf)[_0x74b3('0x19')](function(_0xeb99aa){_0x19df51=_[_0x74b3('0x74')](_0xeb99aa,'id');_0x13dfbf=_[_0x74b3('0x75')](_0x13dfbf,{'model':db[_0x74b3('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c85fe[_0x74b3('0x2a')]['fields']){_0x76a8aa[_0x74b3('0x2e')][_0x74b3('0x5a')](function(_0xf4b1e2){_0x3adc67[_0x74b3('0x35')]('c.'+_0xf4b1e2);});}else{_0x3adc67[_0x74b3('0x35')](_0x74b3('0x66'));_0x3adc67[_0x74b3('0x35')](_0x74b3('0x76'));_0x3adc67['field'](_0x74b3('0x77'));_0x3adc67[_0x74b3('0x35')](_0x74b3('0x78'));_0x3adc67[_0x74b3('0x35')](_0x74b3('0x79'));_0x3adc67[_0x74b3('0x35')](_0x74b3('0x7a'));_0x3adc67[_0x74b3('0x35')]('c.email');_0x3adc67[_0x74b3('0x35')](_0x74b3('0x7b'));_0x3adc67['field'](_0x74b3('0x7c'));_0x3adc67[_0x74b3('0x35')]('c.deletedAt');_0x3adc67['field'](_0x74b3('0x7d'));_0x3adc67[_0x74b3('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x74b3('0x7e'));}if(_0x76a8aa[_0x74b3('0x11')])_0x3adc67[_0x74b3('0x11')](_0x76a8aa[_0x74b3('0x11')]);if(_0x76a8aa['offset'])_0x3adc67['offset'](_0x76a8aa['offset']);return db[_0x74b3('0x72')][_0x74b3('0x2a')](_0x3adc67['toString'](),_0x13dfbf);});})[_0x74b3('0x19')](function(_0x56ae5d){_0x56ae5d[_0x74b3('0x5a')](function(_0x521b1c){if(_0x521b1c[_0x74b3('0x7e')]){_0x521b1c[_0x74b3('0x7f')]=[];_0x521b1c['TagIds'][_0x74b3('0x46')](',')[_0x74b3('0x5a')](function(_0x35d0a2){_0x521b1c[_0x74b3('0x7f')][_0x74b3('0x80')](_0x19df51[_0x35d0a2]);});}delete _0x521b1c[_0x74b3('0x7e')];});_0x57968a[_0x74b3('0x81')]=_0x56ae5d;return _0x57968a;})['then'](respondWithFilteredResult(_0x47e68c,_0x76a8aa));})[_0x74b3('0x82')](handleError(_0x47e68c,null));};exports[_0x74b3('0x18')]=function(_0x1f781f,_0x4f9efc){return db[_0x74b3('0x20')]['find']({'where':{'id':_0x1f781f['params']['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x4f9efc,null))[_0x74b3('0x19')](removeEntity(_0x4f9efc,null))['catch'](handleError(_0x4f9efc,null));};exports['describe']=function(_0x4577f7,_0x323f53){return db[_0x74b3('0x20')][_0x74b3('0x83')]()['then'](function(_0x43230f){delete _0x43230f[_0x74b3('0x84')];for(var _0x356f63=0x0;_0x356f630x0){return new Promise(function(_0x58b2a8,_0x4ab0c3){var _0x2cbf14=[];for(var _0x4d2a4c=0x0;_0x4d2a4c<_0x15785b[_0x74b3('0x22')];_0x4d2a4c++){_0x2cbf14[_0x74b3('0x80')](insertAdditionalPhones(_0x15785b[_0x4d2a4c]['contact'],_0x15785b[_0x4d2a4c][_0x74b3('0xa9')]));}Promise[_0x74b3('0x27')](_0x2cbf14)[_0x74b3('0x19')](function(){_0x58b2a8(0x1);});})['then'](function(){return{'success':_0x6ca8ae,'failure':_0x4ef8de,'duplicates':_0x3149fd};});}else{return{'success':_0x6ca8ae,'failure':_0x4ef8de,'duplicates':_0x3149fd};}}})[_0x74b3('0x19')](respondWithResult(_0x3d0f69,0xc9))[_0x74b3('0x82')](handleError(_0x3d0f69,null));};exports[_0x74b3('0xb0')]=function(_0x27ef5e,_0x4e7aa8){var _0x551d95;return db['CmContact'][_0x74b3('0x83')]()[_0x74b3('0x19')](function(_0x10c8c8){return db[_0x74b3('0x20')][_0x74b3('0x44')]({'where':{'id':_0x27ef5e[_0x74b3('0xb1')]['id']},'include':[{'model':db['Tag'],'as':_0x74b3('0x7f'),'attributes':['id',_0x74b3('0xb2'),'color'],'required':_0x27ef5e[_0x74b3('0x2a')][_0x74b3('0x58')]?!![]:![]},{'model':db[_0x74b3('0x9b')],'as':_0x74b3('0xb3'),'where':{'CmContactId':_0x27ef5e[_0x74b3('0xb1')]['id']},'required':![],'include':[{'model':db[_0x74b3('0xb4')],'as':'ItemType'}]}],'order':[db[_0x74b3('0x72')][_0x74b3('0xb5')](_0x74b3('0xb6'))],'attributes':_[_0x74b3('0x21')](_0x10c8c8)});})[_0x74b3('0x19')](function(_0x36d2c3){if(!_[_0x74b3('0xa6')](_0x36d2c3)){_0x551d95=_0x36d2c3[_0x74b3('0xb7')]({'plain':!![]});var _0x3cb859={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x36d2c3&&_0x36d2c3[_0x74b3('0x54')]){if(_0x36d2c3[_0x74b3('0x54')]){_0x3cb859[_0x74b3('0x31')][_0x74b3('0xb8')]['push']({'ListId':{'$ne':_0x36d2c3['ListId']}});}}return db[_0x74b3('0x24')][_0x74b3('0x88')](_0x3cb859);}})[_0x74b3('0x19')](function(_0x2eaf9f){if(!_[_0x74b3('0xa6')](_0x2eaf9f)){return _['omit'](_0x551d95,_[_0x74b3('0x50')](_0x2eaf9f,function(_0xba5679){return util['format'](_0x74b3('0xb9'),_0xba5679['id']);}));}})[_0x74b3('0x19')](handleEntityNotFound(_0x4e7aa8,null))[_0x74b3('0x19')](respondWithResult(_0x4e7aa8,null))['catch'](handleError(_0x4e7aa8,null));};exports[_0x74b3('0x17')]=function(_0x2daabe,_0x52bb93){var _0x445e37;if(_0x2daabe[_0x74b3('0x8a')]['id']){delete _0x2daabe[_0x74b3('0x8a')]['id'];}if(!_['isNil'](_0x2daabe[_0x74b3('0x8a')]['dialTimezone'])){var _0x2b6184=_0x2daabe[_0x74b3('0x8a')][_0x74b3('0xa5')];if(!_[_0x74b3('0xa6')](shared[_0x74b3('0xa7')][_0x2b6184]))_0x2daabe[_0x74b3('0x8a')][_0x74b3('0xa8')]=shared['timezones'][_0x2b6184][_0x74b3('0xa8')];}return db['CmContact']['find']({'where':{'id':_0x2daabe['params']['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x52bb93,null))['then'](saveUpdates(_0x2daabe[_0x74b3('0x8a')],null))[_0x74b3('0x19')](function(_0x259037){_0x445e37=_0x259037;var _0x1a0030={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x259037&&_0x259037[_0x74b3('0x54')]){if(_0x259037[_0x74b3('0x54')]){_0x1a0030['where'][_0x74b3('0xb8')][_0x74b3('0x80')]({'ListId':{'$ne':_0x259037[_0x74b3('0x54')]}});}}return db[_0x74b3('0x24')][_0x74b3('0x88')](_0x1a0030);})['then'](function(_0x22f01b){if(_0x22f01b){return _[_0x74b3('0xba')](_[_0x74b3('0xbb')](_0x2daabe['body'],function(_0x1f7993,_0x575d18){return _['startsWith'](_0x575d18,_0x74b3('0x28'));}),_[_0x74b3('0x50')](_0x22f01b,function(_0x212b96){return util['format'](_0x74b3('0xb9'),_0x212b96['id']);}));}})[_0x74b3('0x19')](function(_0x146a4a){if(_0x146a4a&&!_['isEmpty'](_0x146a4a)){var _0x393b2f=squel[_0x74b3('0x17')]()[_0x74b3('0xbc')](_0x74b3('0x39'))[_0x74b3('0xbd')](_0x146a4a)[_0x74b3('0x31')]('id\x20=\x20?',_0x2daabe[_0x74b3('0xb1')]['id'])['toParam']();return db[_0x74b3('0x72')][_0x74b3('0x2a')](_0x393b2f[_0x74b3('0x4f')],{'replacements':_0x393b2f[_0x74b3('0xbe')]});}})[_0x74b3('0x19')](function(){if(_0x2daabe['body']['phone']&&_0x445e37){return db[_0x74b3('0xbf')][_0x74b3('0x17')]({'phone':_0x2daabe[_0x74b3('0x8a')][_0x74b3('0xc0')],'OrderBy':0x0},{'where':{'ContactId':_0x445e37['id']}});}})[_0x74b3('0x19')](function(){return _0x445e37;})[_0x74b3('0x19')](respondWithResult(_0x52bb93,null))[_0x74b3('0x82')](handleError(_0x52bb93,null));};exports[_0x74b3('0xc1')]=function(_0x56f32d,_0x1ec836){var _0x57b039={};var _0xd7db51={};var _0xcb9a53;var _0x4142b2;return db[_0x74b3('0x20')][_0x74b3('0x25')]({'where':{'id':_0x56f32d[_0x74b3('0xb1')]['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x1ec836,null))[_0x74b3('0x19')](function(_0x105fa3){if(_0x105fa3){_0xcb9a53=_0x105fa3;_0xd7db51['model']=_[_0x74b3('0x21')](db[_0x74b3('0x45')][_0x74b3('0xc2')]);_0xd7db51[_0x74b3('0x2a')]=_['keys'](_0x56f32d['query']);_0xd7db51[_0x74b3('0x32')]=_[_0x74b3('0x2b')](_0xd7db51[_0x74b3('0x2c')],_0xd7db51[_0x74b3('0x2a')]);_0x57b039[_0x74b3('0x2e')]=_[_0x74b3('0x2b')](_0xd7db51[_0x74b3('0x2c')],qs[_0x74b3('0x2d')](_0x56f32d[_0x74b3('0x2a')][_0x74b3('0x2d')]));_0x57b039['attributes']=_0x57b039['attributes'][_0x74b3('0x22')]?_0x57b039[_0x74b3('0x2e')]:_0xd7db51[_0x74b3('0x2c')];_0x57b039['order']=qs[_0x74b3('0x30')](_0x56f32d['query'][_0x74b3('0x30')]);_0x57b039[_0x74b3('0x31')]=qs['filters'](_['pick'](_0x56f32d['query'],_0xd7db51[_0x74b3('0x32')]));if(_0x56f32d[_0x74b3('0x2a')][_0x74b3('0x51')]){_0x57b039[_0x74b3('0x31')]=_[_0x74b3('0x75')](_0x57b039[_0x74b3('0x31')],{'$or':_['map'](_0x57b039[_0x74b3('0x2e')],function(_0x2ee0b8){var _0x4088bf={};_0x4088bf[_0x2ee0b8]={'$like':'%'+_0x56f32d[_0x74b3('0x2a')]['filter']+'%'};return _0x4088bf;})});}_0x57b039=_[_0x74b3('0x75')]({},_0x57b039,_0x56f32d[_0x74b3('0xc3')]);return _0xcb9a53[_0x74b3('0xc1')](_0x57b039);}})[_0x74b3('0x19')](function(_0x5dd67e){if(_0x5dd67e){_0x4142b2=_0x5dd67e['length'];if(!_0x56f32d[_0x74b3('0x2a')][_0x74b3('0x2f')](_0x74b3('0xc4'))){_0x57b039[_0x74b3('0x11')]=qs[_0x74b3('0x11')](_0x56f32d[_0x74b3('0x2a')]['limit']);_0x57b039[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x56f32d['query'][_0x74b3('0x10')]);}return _0xcb9a53[_0x74b3('0xc1')](_0x57b039);}})[_0x74b3('0x19')](function(_0x461a38){if(_0x461a38){return _0x461a38?{'count':_0x4142b2,'rows':_0x461a38}:null;}})[_0x74b3('0x19')](respondWithResult(_0x1ec836,null))[_0x74b3('0x82')](handleError(_0x1ec836,null));};exports[_0x74b3('0xc5')]=function(_0x308a2e,_0x1ade31){if(_0x308a2e['body']['id']){delete _0x308a2e[_0x74b3('0x8a')]['id'];}return db[_0x74b3('0x20')][_0x74b3('0x25')]({'where':{'id':_0x308a2e[_0x74b3('0xb1')]['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x1ade31,null))[_0x74b3('0x19')](function(_0x2fb34c){if(_0x2fb34c){return _0x2fb34c[_0x74b3('0xc5')](_0x308a2e[_0x74b3('0x8a')][_0x74b3('0xc6')]||[]);}return null;})[_0x74b3('0x19')](respondWithResult(_0x1ade31,null))[_0x74b3('0x82')](handleError(_0x1ade31,null));};exports[_0x74b3('0xc7')]=function(_0x121ed4,_0x46d3ec){var _0x892170=[];_0x892170[_0x74b3('0x80')](addAdditionalPhones(_0x121ed4[_0x74b3('0x8a')]));Promise[_0x74b3('0x27')](_0x892170)['then'](function(){_0x892170=[];_0x892170['push'](deleteCmHopperPhones(_0x121ed4[_0x74b3('0x8a')]['id']));_0x892170[_0x74b3('0x80')](addCmHopperPhones(_0x121ed4['body']['id']));Promise['all'](_0x892170)[_0x74b3('0x19')](function(){return[0x1];})[_0x74b3('0x19')](respondWithResult(_0x46d3ec,null));});};function addAdditionalPhones(_0x44abd4){var _0x1d4eb8;return new Promise(function(_0x4a8b52,_0x3d448e){return db[_0x74b3('0x9b')][_0x74b3('0x18')]({'where':{'CmContactId':_0x44abd4['id']}})[_0x74b3('0x19')](function(){db['ContactItemType'][_0x74b3('0x88')]({'raw':!![],'attributes':['id',_0x74b3('0xc8')]})[_0x74b3('0x19')](function(_0x3c3689){var _0x1a50e5=[];for(var _0x32ce40=0x0;_0x32ce40<_0x44abd4[_0x74b3('0xc9')][_0x74b3('0x22')];_0x32ce40++){var _0x1566c4=_0x44abd4['item_types']?_['isNil'](_0x44abd4[_0x74b3('0xca')][_0x32ce40])?'':_0x44abd4[_0x74b3('0xca')][_0x32ce40]:_0x44abd4[_0x74b3('0xc9')][_0x32ce40][_0x74b3('0xcb')]?_0x44abd4['items'][_0x32ce40]['ItemTypeId']:'';var _0x462517=_[_0x74b3('0xa6')](_0x44abd4[_0x74b3('0xc9')][_0x32ce40][_0x74b3('0xcc')])?'':_0x44abd4[_0x74b3('0xc9')][_0x32ce40][_0x74b3('0xcc')];var _0x4d2c65=_0x1566c4+':'+_0x44abd4['items'][_0x32ce40][_0x74b3('0xc0')]+'§'+_0x462517;if(_[_0x74b3('0xa6')](_0x1d4eb8))_0x1d4eb8=_0x4d2c65;else _0x1d4eb8+=';'+_0x4d2c65;var _0x1983e5=null;if(_0x44abd4['item_types']){if(!_[_0x74b3('0xa6')](_0x44abd4[_0x74b3('0xca')][_0x32ce40])){var _0x45d29c=_[_0x74b3('0x44')](_0x3c3689,function(_0x9dca51){return _0x9dca51['id']===_0x44abd4[_0x74b3('0xca')][_0x32ce40];});if(!_[_0x74b3('0xa6')](_0x45d29c)){_0x1983e5=_0x45d29c[_0x74b3('0xc8')];}}}else{if(!_['isNil'](_0x44abd4[_0x74b3('0xc9')][_0x32ce40])){var _0x45d29c=_[_0x74b3('0x44')](_0x3c3689,function(_0x65720a){return _0x65720a['id']===_0x44abd4['items'][_0x32ce40][_0x74b3('0xcb')];});if(!_[_0x74b3('0xa6')](_0x45d29c)){_0x1983e5=_0x32ce40;}}}if(_[_0x74b3('0xa6')](_0x1983e5)){_0x1983e5=0x64;}_0x1a50e5['push'](addAdditionalPhone(_0x44abd4['id'],_0x44abd4['items'][_0x32ce40][_0x74b3('0xc0')],_0x44abd4[_0x74b3('0xca')]?_[_0x74b3('0xa6')](_0x44abd4[_0x74b3('0xca')][_0x32ce40])?null:_0x44abd4[_0x74b3('0xca')][_0x32ce40]:_0x44abd4[_0x74b3('0xc9')][_0x32ce40]['ItemTypeId']?_0x44abd4['items'][_0x32ce40][_0x74b3('0xcb')]:null,_0x1983e5,_0x462517));}Promise[_0x74b3('0x27')](_0x1a50e5)[_0x74b3('0x19')](function(){db[_0x74b3('0x20')][_0x74b3('0x17')]({'AdditionalPhones':_0x1d4eb8},{'where':{'id':_0x44abd4['id']}})[_0x74b3('0x19')](function(){_0x4a8b52(0x1);});});});});});}function addAdditionalPhone(_0x440120,_0x58cc0f,_0x3ef1fb,_0x855a71,_0x2655b8){return db[_0x74b3('0x9b')][_0x74b3('0x44')]({'where':{'CmContactId':_0x440120,'item':_0x58cc0f}})['then'](function(_0xb1ccd0){if(_0xb1ccd0)logger[_0x74b3('0x8d')](_0x74b3('0xcd'),_0xb1ccd0);else{db[_0x74b3('0x9b')][_0x74b3('0x92')]({'CmContactId':_0x440120,'item':_0x58cc0f,'ItemTypeId':_0x3ef1fb,'OrderBy':_0x855a71,'ItemClass':'PHONE','description':_0x2655b8});}});}function deletePhones(_0x401eb5){return db[_0x74b3('0x9b')][_0x74b3('0x18')]({'where':{'CmContactId':_0x401eb5}});}function deleteCmHopperPhones(_0x59c0fc){return new Promise(function(_0x184a82,_0x4232a0){return db[_0x74b3('0xbf')][_0x74b3('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x59c0fc}})[_0x74b3('0x19')](function(_0x55caee){db[_0x74b3('0xce')][_0x74b3('0x18')]({'where':{'CmHopperId':{'$in':_[_0x74b3('0x50')](_0x55caee,'id')}}});})['then'](function(){_0x184a82(0x1);});});}function addCmHopperPhones(_0x392847){return new Promise(function(_0xc29600,_0x3d2a5b){return db[_0x74b3('0xbf')][_0x74b3('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x392847}})['then'](function(_0xe72ed3){var _0x427410=[];_[_0x74b3('0x50')](_0xe72ed3,function(_0x270ad1){_0x427410[_0x74b3('0x80')](createCmHopperPhone(_0x392847,_0x270ad1['id']));});Promise[_0x74b3('0x27')](_0x427410)['then'](function(){_0xc29600(0x1);});});});}function createCmHopperPhone(_0x2ba93c,_0x4a2b13){return new Promise(function(_0x1676c5,_0x5586cf){db[_0x74b3('0x9b')][_0x74b3('0x88')]({'raw':!![],'attributes':[_0x74b3('0xcf'),_0x74b3('0xc8')],'where':{'CmContactId':_0x2ba93c,'ItemClass':_0x74b3('0xd0')},'include':[{'model':db[_0x74b3('0xb4')],'attributes':['OrderBy'],'as':_0x74b3('0xd1')}],'order':[_0x74b3('0xc8'),db[_0x74b3('0x72')][_0x74b3('0xb5')](_0x74b3('0xd2'))]})[_0x74b3('0x19')](function(_0x218e46){var _0x5b669f=0x1;var _0x28c48b=_[_0x74b3('0x50')](_0x218e46,function(_0xef90a){_0xef90a[_0x74b3('0xd3')]=_0x4a2b13;_0xef90a[_0x74b3('0xc0')]=_0xef90a[_0x74b3('0xcf')];_0xef90a[_0x74b3('0xc8')]=_0x5b669f;delete _0xef90a[_0x74b3('0xd4')];_0x5b669f=_0x5b669f+0x1;return _0xef90a;});return db['CmHopperAdditionalPhone'][_0x74b3('0xaa')](_0x28c48b,{});})['then'](function(){_0x1676c5(0x1);});});}function insertAdditionalPhones(_0x31ad78,_0x5eb2d7){return new Promise(function(_0x29a673,_0x58356e){var _0x2d35ba=[];for(var _0xeb1ab0=0x0;_0xeb1ab0<_0x5eb2d7[_0x74b3('0x22')];_0xeb1ab0++){var _0x1d0f15=_0x5eb2d7[_0xeb1ab0];_0x2d35ba['push'](parseContactItemType(_0x1d0f15));}Promise[_0x74b3('0x27')](_0x2d35ba)[_0x74b3('0x19')](function(){var _0x46a2ce={'id':_0x31ad78['id'],'items':_0x5eb2d7};return addAdditionalPhones(_0x46a2ce)[_0x74b3('0x19')](function(_0x3cf0b0){return addCmHopperPhones(_0x31ad78['id']);});})[_0x74b3('0x19')](function(){_0x29a673(_0x31ad78);});});}function parseContactItemType(_0x5d4f78){return new Promise(function(_0x3cb86d,_0xed7257){if(_0x5d4f78['hasOwnProperty'](_0x74b3('0xcb'))){_0x3cb86d(_0x5d4f78);}else{return db[_0x74b3('0xb4')][_0x74b3('0x44')]({'where':{'name':_0x5d4f78[_0x74b3('0xd1')]}})['then'](function(_0x33b338){if(_['isNil'](_0x33b338))_0x5d4f78[_0x74b3('0xcb')]=null;else _0x5d4f78[_0x74b3('0xcb')]=_0x33b338['id'];_0x3cb86d(_0x5d4f78);});}});}exports['getAdditionalPhones']=function(_0x4a6a61,_0x20c8b3){return db[_0x74b3('0x9b')][_0x74b3('0x88')]({'raw':!![],'where':{'CmContactId':_0x4a6a61[_0x74b3('0xb1')]['id'],'ItemClass':_0x74b3('0xd0')},'include':[{'model':db[_0x74b3('0xb4')],'as':_0x74b3('0xd1')}],'order':[[_0x74b3('0xc8')],[db[_0x74b3('0x72')][_0x74b3('0xb5')](_0x74b3('0xd2'))]]})[_0x74b3('0x19')](function(_0x549928){return _0x549928;})[_0x74b3('0x19')](respondWithResult(_0x20c8b3,null))[_0x74b3('0x82')](handleError(_0x20c8b3,null));};exports[_0x74b3('0xd5')]=function(_0x4f49d1,_0x3749de){return db[_0x74b3('0x9b')][_0x74b3('0x88')]({'raw':!![],'where':{'CmContactId':_0x4f49d1['body'][_0x74b3('0xd6')]}})[_0x74b3('0x19')](function(_0x37d4ad){var _0x57e67b=_['map'](_0x37d4ad,function(_0x3d28b8){_0x3d28b8[_0x74b3('0xd7')]=_0x4f49d1[_0x74b3('0x8a')][_0x74b3('0xd8')];return _0x3d28b8;});return db[_0x74b3('0x9b')]['bulkCreate'](_0x57e67b,{});})[_0x74b3('0x19')](function(_0x1fe6ca){return addCmHopperPhones(_0x4f49d1[_0x74b3('0x8a')][_0x74b3('0xd8')]);})[_0x74b3('0x19')](function(_0xf5bb78){return['ok'];})['then'](respondWithResult(_0x3749de,null))[_0x74b3('0x82')](handleError(_0x3749de,null));};exports[_0x74b3('0xd9')]=function(_0x35efad,_0x252a97){var _0x586b2f=[];_0x586b2f['push'](createCmHopperPhone(_0x35efad['body']['id'],_0x35efad[_0x74b3('0x8a')][_0x74b3('0xda')]));Promise['all'](_0x586b2f)[_0x74b3('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x252a97,null));};exports[_0x74b3('0xdb')]=function(_0x57dc86,_0x5ab5c9){var _0x159087={'raw':![],'where':{}};var _0x5dc3d2={};var _0x19e223={'count':0x0,'rows':[]};return db[_0x74b3('0x20')]['findOne']({'where':{'id':_0x57dc86['params']['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x5ab5c9,null))[_0x74b3('0x19')](function(_0x435f5c){if(_0x435f5c){_0x5dc3d2['model']=_[_0x74b3('0x21')](db[_0x74b3('0xbf')]['rawAttributes']);_0x5dc3d2['query']=_[_0x74b3('0x21')](_0x57dc86[_0x74b3('0x2a')]);_0x5dc3d2[_0x74b3('0x32')]=_[_0x74b3('0x2b')](_0x5dc3d2[_0x74b3('0x2c')],_0x5dc3d2['query']);_0x159087[_0x74b3('0x2e')]=_[_0x74b3('0x2b')](_0x5dc3d2['model'],qs[_0x74b3('0x2d')](_0x57dc86['query']['fields']));_0x159087['attributes']=_0x159087[_0x74b3('0x2e')][_0x74b3('0x22')]?_0x159087[_0x74b3('0x2e')]:_0x5dc3d2[_0x74b3('0x2c')];if(!_0x57dc86[_0x74b3('0x2a')][_0x74b3('0x2f')](_0x74b3('0xc4'))){_0x159087[_0x74b3('0x11')]=qs[_0x74b3('0x11')](_0x57dc86[_0x74b3('0x2a')][_0x74b3('0x11')]);_0x159087[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x57dc86['query']['offset']);}_0x159087[_0x74b3('0x67')]=qs['sort'](_0x57dc86[_0x74b3('0x2a')][_0x74b3('0x30')]);_0x159087[_0x74b3('0x31')]=qs['filters'](_[_0x74b3('0x33')](_0x57dc86[_0x74b3('0x2a')],_0x5dc3d2[_0x74b3('0x32')]));_0x159087[_0x74b3('0x31')]['ContactId']=_0x435f5c['id'];if(_0x57dc86[_0x74b3('0x2a')][_0x74b3('0x51')]){_0x159087[_0x74b3('0x31')]=_['merge'](_0x159087[_0x74b3('0x31')],{'$or':_[_0x74b3('0x50')](_0x159087[_0x74b3('0x2e')],function(_0x2d1126){var _0x30e733={};_0x30e733[_0x2d1126]={'$like':'%'+_0x57dc86[_0x74b3('0x2a')][_0x74b3('0x51')]+'%'};return _0x30e733;})});}_0x159087=_[_0x74b3('0x75')]({},_0x159087,_0x57dc86[_0x74b3('0xc3')]);return db['CmHopper']['count']({'where':_0x159087[_0x74b3('0x31')]})[_0x74b3('0x19')](function(_0x3714db){_0x19e223[_0x74b3('0x13')]=_0x3714db;if(_0x57dc86[_0x74b3('0x2a')][_0x74b3('0xdc')]){_0x159087[_0x74b3('0xdd')]=[{'all':!![]}];}return db[_0x74b3('0xbf')]['findAll'](_0x159087);})['then'](function(_0x3101d9){_0x19e223[_0x74b3('0x81')]=_0x3101d9;return _0x19e223;});}})[_0x74b3('0x19')](respondWithFilteredResult(_0x5ab5c9,_0x159087))[_0x74b3('0x82')](handleError(_0x5ab5c9,null));};exports[_0x74b3('0xde')]=function(_0xc8193c,_0x3e8e75){var _0x33fc76={'raw':!![],'where':{}};var _0x2604fd={};var _0x43616d={'count':0x0,'rows':[]};return db[_0x74b3('0x20')][_0x74b3('0x25')]({'where':{'id':_0xc8193c[_0x74b3('0xb1')]['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x3e8e75,null))[_0x74b3('0x19')](function(_0x4c1d70){if(_0x4c1d70){_0x2604fd[_0x74b3('0x2c')]=_[_0x74b3('0x21')](db[_0x74b3('0x9d')][_0x74b3('0xc2')]);_0x2604fd[_0x74b3('0x2a')]=_[_0x74b3('0x21')](_0xc8193c['query']);_0x2604fd[_0x74b3('0x32')]=_[_0x74b3('0x2b')](_0x2604fd['model'],_0x2604fd[_0x74b3('0x2a')]);_0x33fc76['attributes']=_[_0x74b3('0x2b')](_0x2604fd['model'],qs[_0x74b3('0x2d')](_0xc8193c[_0x74b3('0x2a')][_0x74b3('0x2d')]));_0x33fc76[_0x74b3('0x2e')]=_0x33fc76[_0x74b3('0x2e')][_0x74b3('0x22')]?_0x33fc76[_0x74b3('0x2e')]:_0x2604fd[_0x74b3('0x2c')];if(!_0xc8193c['query'][_0x74b3('0x2f')]('nolimit')){_0x33fc76[_0x74b3('0x11')]=qs['limit'](_0xc8193c['query']['limit']);_0x33fc76[_0x74b3('0x10')]=qs['offset'](_0xc8193c[_0x74b3('0x2a')][_0x74b3('0x10')]);}_0x33fc76['order']=qs[_0x74b3('0x30')](_0xc8193c[_0x74b3('0x2a')]['sort']);_0x33fc76[_0x74b3('0x31')]=qs[_0x74b3('0x32')](_[_0x74b3('0x33')](_0xc8193c[_0x74b3('0x2a')],_0x2604fd['filters']));_0x33fc76[_0x74b3('0x31')]['ContactId']=_0x4c1d70['id'];if(_0xc8193c['query']['filter']){_0x33fc76[_0x74b3('0x31')]=_[_0x74b3('0x75')](_0x33fc76[_0x74b3('0x31')],{'$or':_[_0x74b3('0x50')](_0x33fc76[_0x74b3('0x2e')],function(_0x48a66a){var _0x13e65d={};_0x13e65d[_0x48a66a]={'$like':'%'+_0xc8193c[_0x74b3('0x2a')][_0x74b3('0x51')]+'%'};return _0x13e65d;})});}_0x33fc76=_[_0x74b3('0x75')]({},_0x33fc76,_0xc8193c[_0x74b3('0xc3')]);return db[_0x74b3('0x9d')][_0x74b3('0x13')]({'where':_0x33fc76[_0x74b3('0x31')]})[_0x74b3('0x19')](function(_0xc09cca){_0x43616d[_0x74b3('0x13')]=_0xc09cca;if(_0xc8193c[_0x74b3('0x2a')][_0x74b3('0xdc')]){_0x33fc76[_0x74b3('0xdd')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x74b3('0x88')](_0x33fc76);})[_0x74b3('0x19')](function(_0x1e1365){_0x43616d[_0x74b3('0x81')]=_0x1e1365;return _0x43616d;});}})[_0x74b3('0x19')](respondWithFilteredResult(_0x3e8e75,_0x33fc76))['catch'](handleError(_0x3e8e75,null));};exports[_0x74b3('0xdf')]=function(_0x27d306,_0x2d1456){var _0x394f1e={'raw':!![],'where':{}};var _0x5554f5={};var _0x10ffb2={'count':0x0,'rows':[]};return db[_0x74b3('0x20')][_0x74b3('0x25')]({'where':{'id':_0x27d306[_0x74b3('0xb1')]['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x2d1456,null))[_0x74b3('0x19')](function(_0x11a73e){if(_0x11a73e){_0x5554f5[_0x74b3('0x2c')]=_[_0x74b3('0x21')](db[_0x74b3('0x9c')][_0x74b3('0xc2')]);_0x5554f5[_0x74b3('0x2a')]=_['keys'](_0x27d306[_0x74b3('0x2a')]);_0x5554f5['filters']=_[_0x74b3('0x2b')](_0x5554f5['model'],_0x5554f5[_0x74b3('0x2a')]);_0x394f1e[_0x74b3('0x2e')]=_['intersection'](_0x5554f5['model'],qs['fields'](_0x27d306[_0x74b3('0x2a')][_0x74b3('0x2d')]));_0x394f1e['attributes']=_0x394f1e[_0x74b3('0x2e')][_0x74b3('0x22')]?_0x394f1e[_0x74b3('0x2e')]:_0x5554f5['model'];if(!_0x27d306[_0x74b3('0x2a')][_0x74b3('0x2f')](_0x74b3('0xc4'))){_0x394f1e[_0x74b3('0x11')]=qs[_0x74b3('0x11')](_0x27d306[_0x74b3('0x2a')][_0x74b3('0x11')]);_0x394f1e[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x27d306[_0x74b3('0x2a')][_0x74b3('0x10')]);}_0x394f1e[_0x74b3('0x67')]=qs['sort'](_0x27d306[_0x74b3('0x2a')][_0x74b3('0x30')]);_0x394f1e['where']=qs[_0x74b3('0x32')](_[_0x74b3('0x33')](_0x27d306[_0x74b3('0x2a')],_0x5554f5[_0x74b3('0x32')]));_0x394f1e[_0x74b3('0x31')][_0x74b3('0xe0')]=_0x11a73e['id'];if(_0x27d306[_0x74b3('0x2a')]['filter']){_0x394f1e['where']=_['merge'](_0x394f1e[_0x74b3('0x31')],{'$or':_[_0x74b3('0x50')](_0x394f1e[_0x74b3('0x2e')],function(_0x40b763){var _0x2f7227={};_0x2f7227[_0x40b763]={'$like':'%'+_0x27d306[_0x74b3('0x2a')][_0x74b3('0x51')]+'%'};return _0x2f7227;})});}_0x394f1e=_[_0x74b3('0x75')]({},_0x394f1e,_0x27d306[_0x74b3('0xc3')]);return db[_0x74b3('0x9c')][_0x74b3('0x13')]({'where':_0x394f1e[_0x74b3('0x31')]})[_0x74b3('0x19')](function(_0x4c1799){_0x10ffb2[_0x74b3('0x13')]=_0x4c1799;if(_0x27d306['query'][_0x74b3('0xdc')]){_0x394f1e[_0x74b3('0xdd')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x74b3('0x88')](_0x394f1e);})['then'](function(_0x5f298e){_0x10ffb2[_0x74b3('0x81')]=_0x5f298e;return _0x10ffb2;});}})[_0x74b3('0x19')](respondWithFilteredResult(_0x2d1456,_0x394f1e))['catch'](handleError(_0x2d1456,null));};exports['getJscriptySessions']=function(_0x341c10,_0x90a818){var _0x4fde4d={'raw':!![],'where':{}};var _0x39e806={};var _0x12f93a={'count':0x0,'rows':[]};return db[_0x74b3('0x20')][_0x74b3('0x25')]({'where':{'id':_0x341c10[_0x74b3('0xb1')]['id']}})[_0x74b3('0x19')](handleEntityNotFound(_0x90a818,null))['then'](function(_0x483cd8){if(_0x483cd8){_0x39e806['model']=_[_0x74b3('0x21')](db[_0x74b3('0xe1')][_0x74b3('0xc2')]);_0x39e806[_0x74b3('0x2a')]=_['keys'](_0x341c10[_0x74b3('0x2a')]);_0x39e806[_0x74b3('0x32')]=_[_0x74b3('0x2b')](_0x39e806['model'],_0x39e806[_0x74b3('0x2a')]);_0x4fde4d[_0x74b3('0x2e')]=_[_0x74b3('0x2b')](_0x39e806[_0x74b3('0x2c')],qs[_0x74b3('0x2d')](_0x341c10[_0x74b3('0x2a')]['fields']));_0x4fde4d[_0x74b3('0x2e')]=_0x4fde4d[_0x74b3('0x2e')][_0x74b3('0x22')]?_0x4fde4d[_0x74b3('0x2e')]:_0x39e806['model'];if(!_0x341c10[_0x74b3('0x2a')][_0x74b3('0x2f')](_0x74b3('0xc4'))){_0x4fde4d['limit']=qs['limit'](_0x341c10[_0x74b3('0x2a')][_0x74b3('0x11')]);_0x4fde4d[_0x74b3('0x10')]=qs['offset'](_0x341c10[_0x74b3('0x2a')][_0x74b3('0x10')]);}_0x4fde4d['order']=qs['sort'](_0x341c10['query'][_0x74b3('0x30')]);_0x4fde4d['where']=qs[_0x74b3('0x32')](_[_0x74b3('0x33')](_0x341c10['query'],_0x39e806[_0x74b3('0x32')]));_0x4fde4d[_0x74b3('0x31')][_0x74b3('0xe0')]=_0x483cd8['id'];if(_0x341c10[_0x74b3('0x2a')][_0x74b3('0x51')]){_0x4fde4d[_0x74b3('0x31')]=_[_0x74b3('0x75')](_0x4fde4d[_0x74b3('0x31')],{'$or':_['map'](_0x4fde4d[_0x74b3('0x2e')],function(_0x28065e){var _0x119db9={};_0x119db9[_0x28065e]={'$like':'%'+_0x341c10[_0x74b3('0x2a')][_0x74b3('0x51')]+'%'};return _0x119db9;})});}_0x4fde4d=_[_0x74b3('0x75')]({},_0x4fde4d,_0x341c10['options']);return db[_0x74b3('0xe1')]['count']({'where':_0x4fde4d[_0x74b3('0x31')]})[_0x74b3('0x19')](function(_0x3ed19b){_0x12f93a[_0x74b3('0x13')]=_0x3ed19b;if(_0x341c10['query'][_0x74b3('0xdc')]){_0x4fde4d[_0x74b3('0xdd')]=[{'all':!![]}];}return db[_0x74b3('0xe1')]['findAll'](_0x4fde4d);})[_0x74b3('0x19')](function(_0x1a5702){_0x12f93a[_0x74b3('0x81')]=_0x1a5702;return _0x12f93a;});}})['then'](respondWithFilteredResult(_0x90a818,_0x4fde4d))[_0x74b3('0x82')](handleError(_0x90a818,null));};exports['uploadCsv']=function(_0x4aa08d,_0x6b204f){try{if(!_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0x54')]){throw new Error(_0x74b3('0xe2'));}if(!_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0xe3')]){throw new Error(_0x74b3('0xe4'));}if(!_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0xe5')]){throw new Error(_0x74b3('0xe6'));}if(!_0x4aa08d[_0x74b3('0x8a')]['socket_timestamp']){throw new Error(_0x74b3('0xe7'));}var _0x5b530c=_0x4aa08d['body'][_0x74b3('0xe3')]['split'](',');var _0x23ae22=_0x4aa08d['body']['binding_values'][_0x74b3('0x46')](',');if(!_0x5b530c[_0x74b3('0x22')]||!_0x23ae22[_0x74b3('0x22')]||_0x5b530c['length']!==_0x23ae22['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4aa08d[_0x74b3('0x8a')]['fields']=_[_0x74b3('0xe8')](_0x5b530c,_0x23ae22);if(!_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0x2d')][_0x74b3('0xc0')]){throw new Error(_0x74b3('0xe9'));}if(!_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0x2d')][_0x74b3('0xea')]){throw new Error(_0x74b3('0xeb'));}var _0x44e78e=path['join'](config[_0x74b3('0xec')],_0x74b3('0xed'),_0x4aa08d[_0x74b3('0xee')]['filename']);fs[_0x74b3('0xef')](_0x44e78e,parseInt('0777',0x8));var _0x2aa854=require(_0x74b3('0xf0'))[_0x74b3('0xf1')](path['join'](__dirname,_0x74b3('0xf2')),[_0x44e78e,_0x4aa08d[_0x74b3('0x8a')]['binding_keys'],_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0xe5')],_0x4aa08d['body'][_0x74b3('0x54')],_0x4aa08d['body'][_0x74b3('0xf3')],_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0xac')],_0x4aa08d[_0x74b3('0x8a')][_0x74b3('0xf4')]]);return _0x6b204f[_0x74b3('0x14')](0xc8)[_0x74b3('0x16')]({'message':_0x74b3('0xf5'),'pid':_0x2aa854[_0x74b3('0xf6')]});}catch(_0x39b1ff){return _0x6b204f[_0x74b3('0x14')](0x1f4)[_0x74b3('0x1e')](_0x39b1ff);}};exports[_0x74b3('0xf7')]=function(_0x3139c2,_0x453a76){var _0x14abfc=fs['createReadStream'](_0x3139c2[_0x74b3('0xee')][_0x74b3('0x2')]);Papa[_0x74b3('0xf8')](_0x14abfc,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x14c703){return _0x453a76['status'](0xc8)[_0x74b3('0x16')]({'file':_0x3139c2[_0x74b3('0xee')],'fields':_0x14c703[_0x74b3('0xf9')]['fields']});}});};exports[_0x74b3('0xfa')]=function(_0x4d7d46,_0x1ecbe1){return db[_0x74b3('0x49')][_0x74b3('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':_0x74b3('0x6d')}})['then'](function(_0x1cc783){var _0x4eefb7=![];if(!_0x4d7d46[_0x74b3('0x8a')][_0x74b3('0x54')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4d7d46[_0x74b3('0x8a')][_0x74b3('0xfb')][_0x74b3('0xc0')]){throw new Error(_0x74b3('0xe9'));}if(!_0x4d7d46['body'][_0x74b3('0xfb')][_0x74b3('0xea')]){throw new Error(_0x74b3('0xeb'));}if(!_0x4d7d46[_0x74b3('0x8a')][_0x74b3('0xf4')]){throw new Error(_0x74b3('0xe7'));}var _0x5c499f=require(_0x74b3('0xf0'))[_0x74b3('0xf1')](path[_0x74b3('0x8c')](__dirname,_0x74b3('0xfc')),[_0x4d7d46[_0x74b3('0xb1')]['id'],JSON[_0x74b3('0xfd')](_0x4d7d46[_0x74b3('0x8a')]),JSON['stringify'](_0x1cc783)]);_0x5c499f['on'](_0x74b3('0xfe'),function(){_0x4eefb7=!![];return _0x1ecbe1['status'](0xc8)[_0x74b3('0x16')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x5c499f[_0x74b3('0xf6')]});});_0x5c499f['on'](_0x74b3('0xff'),function(_0x1d219d){if(_0x1d219d&&!_0x4eefb7){return _0x1ecbe1[_0x74b3('0x14')](0x1f4)['json']({'message':_0x74b3('0x100'),'pid':_0x5c499f[_0x74b3('0xf6')]});}});})[_0x74b3('0x82')](handleError(_0x1ecbe1,null));};exports[_0x74b3('0x101')]=function(_0x27bda9,_0xba6593,_0x58cbb4){return db[_0x74b3('0x49')][_0x74b3('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':_0x74b3('0x6d')}})['then'](function(_0x652161){var _0x8e5721=![];if(!_0x27bda9['body']['ListId']){throw new Error(_0x74b3('0xe2'));}if(!_0x27bda9['body']['binding'][_0x74b3('0xc0')]){throw new Error(_0x74b3('0xe9'));}if(!_0x27bda9[_0x74b3('0x8a')]['binding'][_0x74b3('0xea')]){throw new Error(_0x74b3('0xeb'));}if(!_0x27bda9[_0x74b3('0x8a')][_0x74b3('0xf4')]){throw new Error(_0x74b3('0xe7'));}var _0x43db3d=require(_0x74b3('0xf0'))[_0x74b3('0xf1')](path['join'](__dirname,_0x74b3('0x102')),[_0x27bda9[_0x74b3('0xb1')]['id'],JSON['stringify'](_0x27bda9[_0x74b3('0x8a')]),JSON[_0x74b3('0xfd')](_0x652161)]);_0x43db3d['on'](_0x74b3('0xfe'),function(_0x365a03){_0x8e5721=!![];return _0xba6593[_0x74b3('0x14')](0xc8)[_0x74b3('0x16')]({'message':_0x74b3('0x103'),'pid':_0x43db3d[_0x74b3('0xf6')]});});_0x43db3d['on']('exit',function(_0x155acb){if(_0x155acb&&!_0x8e5721){return _0xba6593['status'](0x1f4)['json']({'message':_0x74b3('0x100'),'pid':_0x43db3d[_0x74b3('0xf6')]});}});})[_0x74b3('0x82')](handleError(_0xba6593,null));};exports[_0x74b3('0x104')]=function(_0x50e1ea,_0x5068e4){var _0x4e6008=[_0x74b3('0x105'),_0x74b3('0x106'),_0x74b3('0x107'),_0x74b3('0x108'),'fax',_0x74b3('0x109'),_0x74b3('0x10a')];var _0x41721d={'offset':0x0,'order':qs[_0x74b3('0x30')](_0x74b3('0x10b'))},_0x1ecb1f={'count':0x0,'rows':[]};Promise[_0x74b3('0x6a')]()[_0x74b3('0x19')](function(){if(_0x50e1ea['query'][_0x74b3('0x10c')]){if(!_[_0x74b3('0x10d')](_0x4e6008,_0x50e1ea[_0x74b3('0x2a')][_0x74b3('0x10c')][_0x74b3('0x10e')]())){throw new Error(_0x74b3('0x10f'));}_0x4e6008=[_0x50e1ea[_0x74b3('0x2a')]['channel']['toLowerCase']()];}if(_0x50e1ea[_0x74b3('0x2a')][_0x74b3('0x110')]){try{var _0x1237d2=JSON['parse'](_0x50e1ea[_0x74b3('0x2a')][_0x74b3('0x110')]);if(!moment(_0x1237d2['from'])[_0x74b3('0x111')]()){throw new Error(_0x74b3('0x112'));}if(!moment(_0x1237d2['to'])['isValid']()){throw new Error(_0x74b3('0x113'));}}catch(_0x444c50){throw new Error(_0x74b3('0x114'));}}if(!_0x50e1ea[_0x74b3('0x2a')]['hasOwnProperty']('nolimit')){_0x41721d['limit']=qs[_0x74b3('0x11')](_0x50e1ea['query'][_0x74b3('0x11')]||0xa);_0x41721d[_0x74b3('0x10')]=qs[_0x74b3('0x10')](_0x50e1ea[_0x74b3('0x2a')][_0x74b3('0x10')]);}var _0x59ac05=_0x4e6008[_0x74b3('0x50')](function(_0x17e05b){if(_0x17e05b==='voice'){var _0x562e7b={'attributes':['id',_0x74b3('0x115'),_0x74b3('0x116'),_0x74b3('0x117'),_0x74b3('0x118'),_0x74b3('0x119'),_0x74b3('0x11a'),'endtime',_0x74b3('0x11b'),_0x74b3('0x11c'),_0x74b3('0x11d'),_0x74b3('0x11e'),_0x74b3('0x11f'),'userThirdDisposition',_0x74b3('0x120')],'where':{'ContactId':_0x50e1ea[_0x74b3('0xb1')]['id']},'include':[{'model':db[_0x74b3('0x49')],'as':_0x74b3('0x49'),'attributes':['id',_0x74b3('0xb2'),_0x74b3('0x121'),_0x74b3('0x122')]}],'order':[[_0x74b3('0x11d'),'DESC']]};if(_0x50e1ea[_0x74b3('0x2a')][_0x74b3('0x110')]){_0x562e7b['where'][_0x74b3('0x11d')]={'$gte':_0x1237d2['from'],'$lte':_0x1237d2['to']};}return db['VoiceCallReport'][_0x74b3('0x123')](_0x562e7b)['then'](function(_0x4c508f){_0x1ecb1f[_0x74b3('0x13')]+=_0x4c508f[_0x74b3('0x13')];return _[_0x74b3('0x50')](_0x4c508f[_0x74b3('0x81')],function(_0x86f713){var _0xf91540=_0x86f713['get']({'plain':!![]});_0xf91540[_0x74b3('0x10c')]=_0x17e05b;if(_0xf91540[_0x74b3('0x49')]){_0xf91540[_0x74b3('0x49')]={'id':_0xf91540[_0x74b3('0x49')]['id'],'name':_0xf91540[_0x74b3('0x49')][_0x74b3('0xb2')],'fullname':_0xf91540[_0x74b3('0x49')][_0x74b3('0x121')],'alias':_0xf91540[_0x74b3('0x49')][_0x74b3('0x122')]};}return _0xf91540;});});}else{var _0x2a9e10=_[_0x74b3('0x124')](_0x17e05b)+(_0x17e05b===_0x74b3('0x106')?_0x74b3('0x125'):_0x74b3('0x126'));var _0x3db1b8={'attributes':['id',_0x74b3('0x127'),_0x74b3('0x128'),_0x74b3('0x11d'),_0x74b3('0x11c'),_0x74b3('0x129'),_0x74b3('0x12a'),_0x74b3('0x12b'),_0x74b3('0x120'),_0x2a9e10+'Id'],'where':{'ContactId':_0x50e1ea['params']['id']},'include':[{'model':db[_0x2a9e10],'as':_0x74b3('0x126'),'attributes':['id',_0x74b3('0xb2'),_0x74b3('0x12c')]},{'model':db['User'],'as':_0x74b3('0x12d'),'attributes':['id',_0x74b3('0xb2'),_0x74b3('0x121')]},{'model':db[_0x74b3('0x45')],'as':_0x74b3('0x7f'),'attributes':['id','name',_0x74b3('0x36')],'through':{'attributes':[]}}],'order':[[_0x74b3('0x11d'),_0x74b3('0x68')]]};if(_0x50e1ea['query'][_0x74b3('0x110')]){_0x3db1b8['where']['createdAt']={'$gte':_0x1237d2['from'],'$lte':_0x1237d2['to']};}switch(_0x17e05b){case _0x74b3('0x106'):_0x3db1b8[_0x74b3('0x2e')][_0x74b3('0x80')](_0x74b3('0x12e'),_0x74b3('0x12f'),_0x74b3('0x130'),_0x74b3('0x131'),_0x74b3('0x132'),_0x74b3('0x133'),_0x74b3('0x134'),_0x74b3('0x135'),_0x74b3('0x136'));break;case _0x74b3('0x105'):_0x3db1b8['attributes'][_0x74b3('0x80')](_0x74b3('0x137'),'substatus');break;case _0x74b3('0x108'):_0x3db1b8[_0x74b3('0x2e')]['push'](_0x74b3('0x138'),'threadId');break;}return db[_[_0x74b3('0x124')](_0x17e05b)+_0x74b3('0x139')][_0x74b3('0x123')](_0x3db1b8)[_0x74b3('0x19')](function(_0x512f27){_0x1ecb1f['count']+=_0x512f27[_0x74b3('0x13')];return _['map'](_0x512f27[_0x74b3('0x81')],function(_0x2c77ba){var _0x14918c=_0x2c77ba[_0x74b3('0xb7')]({'plain':!![]});_0x14918c['channel']=_0x17e05b;if(_0x14918c['Owner']){_0x14918c[_0x74b3('0x12d')]={'id':_0x14918c['Owner']['id'],'name':_0x14918c[_0x74b3('0x12d')]['name'],'fullname':_0x14918c[_0x74b3('0x12d')][_0x74b3('0x121')]};}return _0x14918c;});});}});return Promise[_0x74b3('0x27')](_0x59ac05);})[_0x74b3('0x19')](function(_0x3f78a7){return _(_0x3f78a7)[_0x74b3('0x13a')]()[_0x74b3('0x13b')](_0x74b3('0x11d'))[_0x74b3('0x13c')]()[_0x74b3('0x4c')]();})[_0x74b3('0x19')](function(_0x1696b1){_0x1ecb1f[_0x74b3('0x81')]=_0x41721d[_0x74b3('0x11')]?_0x1696b1[_0x74b3('0x13d')](_0x41721d[_0x74b3('0x10')],_0x41721d[_0x74b3('0x10')]+_0x41721d[_0x74b3('0x11')]):_0x1696b1;return _0x1ecb1f;})[_0x74b3('0x19')](respondWithFilteredResult(_0x5068e4,_0x41721d))['catch'](handleError(_0x5068e4,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index be38cf8..424df88 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 _0x9fd2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','CmContact'];(function(_0x4f47eb,_0x245b17){var _0x140dd5=function(_0x1c9669){while(--_0x1c9669){_0x4f47eb['push'](_0x4f47eb['shift']());}};_0x140dd5(++_0x245b17);}(_0x9fd2,0x15d));var _0x29fd=function(_0x458e55,_0xab3d13){_0x458e55=_0x458e55-0x0;var _0xdaed4c=_0x9fd2[_0x458e55];return _0xdaed4c;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x29fd('0x0'))['db'][_0x29fd('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x29fd('0x2')](0x0);var events={'afterCreate':_0x29fd('0x3'),'afterUpdate':_0x29fd('0x4'),'afterDestroy':_0x29fd('0x5')};function emitEvent(_0x5d786c){return function(_0x530869,_0x28ee5d,_0x32cda6){CmContactEvents[_0x29fd('0x6')](_0x5d786c+':'+_0x530869['id'],_0x530869);CmContactEvents[_0x29fd('0x6')](_0x5d786c,_0x530869);_0x32cda6(null);};}for(var e in events){if(events[_0x29fd('0x7')](e)){var event=events[e];CmContact[_0x29fd('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x6450=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6450,0x184));var _0x0645=function(_0x8dd934,_0x1b02eb){_0x8dd934=_0x8dd934-0x0;var _0x116f3f=_0x6450[_0x8dd934];return _0x116f3f;};'use strict';var EventEmitter=require(_0x0645('0x0'));var CmContact=require(_0x0645('0x1'))['db'][_0x0645('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0645('0x3'),'afterDestroy':'remove'};function emitEvent(_0x121cc3){return function(_0x4c268c,_0x3a0d11,_0x1972f3){CmContactEvents[_0x0645('0x4')](_0x121cc3+':'+_0x4c268c['id'],_0x4c268c);CmContactEvents[_0x0645('0x4')](_0x121cc3,_0x4c268c);_0x1972f3(null);};}for(var e in events){if(events[_0x0645('0x5')](e)){var event=events[e];CmContact[_0x0645('0x6')](e,emitEvent(event));}}module[_0x0645('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 fc5250c..722896e 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 _0x9f01=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','../../config/environment/shared','exports','define','CmContact','phone','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','\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','create','catch','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','VoiceQueue','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x9f01,0x123));var _0x19f0=function(_0x5d6993,_0x29374c){_0x5d6993=_0x5d6993-0x0;var _0x2f32e3=_0x9f01[_0x5d6993];return _0x2f32e3;};'use strict';var _=require(_0x19f0('0x0'));var util=require(_0x19f0('0x1'));var logger=require(_0x19f0('0x2'))(_0x19f0('0x3'));var moment=require(_0x19f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x19f0('0x5'));var fs=require('fs');var path=require(_0x19f0('0x6'));var rimraf=require('rimraf');var config=require(_0x19f0('0x7'));var shared=require(_0x19f0('0x8'));var attributes=require('./cmContact.attributes');module[_0x19f0('0x9')]=function(_0x355b42,_0x1ef90b){return _0x355b42[_0x19f0('0xa')](_0x19f0('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x19f0('0xc')]},{'name':'fti_cm_contacts','fields':['firstName',_0x19f0('0xd'),_0x19f0('0xc'),_0x19f0('0xe'),_0x19f0('0xf'),'email'],'type':_0x19f0('0x10')}],'timestamps':!![],'charset':_0x19f0('0x11'),'collate':_0x19f0('0x12'),'hooks':{'afterCreate':function(_0x14eac7,_0x53dffd,_0x39655f){var _0x5b53d1=_0x355b42[_0x19f0('0x13')];var _0x4ca327=_0x14eac7[_0x19f0('0x14')]({'plain':!![]});function _0x2a4721(){return function(_0x1d7119){logger[_0x19f0('0x15')](_0x19f0('0x16'),_0x19f0('0x17'),util[_0x19f0('0x18')](_0x1d7119,{'showHidden':![],'depth':null}));};}function _0x38dfa4(_0x3f4954,_0x1faa66){var _0x4c49dc=_0x1faa66[_0x19f0('0x19')]?_0x1faa66[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x56aaa6,_0x2514cf){if(_[_0x19f0('0x1b')](_0x1faa66[_0x19f0('0x1c')])){_0x56aaa6({'ret':_0x4c49dc});}else{_0x5b53d1['VoiceQueue'][_0x19f0('0x1d')]({'where':{'id':_0x3f4954['id']}})[_0x19f0('0x1e')](function(_0x2a0e5e){if(!_[_0x19f0('0x1b')](_0x2a0e5e)){var _0x204e59=_0x2a0e5e[_0x19f0('0x1c')];if(!_[_0x19f0('0x1b')](_0x204e59)){var _0x4439a7=shared[_0x19f0('0x1f')];var _0x43174d=_0x4439a7[_0x204e59];var _0x348fa0=_0x4439a7[_0x1faa66[_0x19f0('0x1c')]];if(!_[_0x19f0('0x1b')](_0x43174d)&&!_[_0x19f0('0x1b')](_0x348fa0)){var _0x304633=_0x43174d[_0x19f0('0x20')]-_0x348fa0[_0x19f0('0x20')];_0x4c49dc=_0x1faa66[_0x19f0('0x19')]?_0x1faa66[_0x19f0('0x19')]:moment();var _0x1e049c=moment(_0x4c49dc)[_0x19f0('0x21')](_0x304633,_0x19f0('0x22'));_0x56aaa6({'ret':_0x1e049c['format'](_0x19f0('0x23'))});}else _0x56aaa6({'ret':_0x4c49dc});}else _0x56aaa6({'ret':_0x4c49dc});}else{_0x56aaa6({'ret':_0x4c49dc});}});}});return 0xa;}var _0x118895=function(_0xea070f){return new BPromise(function(_0x575976,_0x19d37b){_0x38dfa4(_0xea070f,_0x4ca327)[_0x19f0('0x1e')](function(_0x1e619c){_0x4ca327[_0x19f0('0x19')]=_0x1e619c[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327['phone'],'VoiceQueueId':_0xea070f['id']}})[_0x19f0('0x1e')](function(_0x307c9f){if(!_[_0x19f0('0x1b')](_0x307c9f)){throw new Error(_0x19f0('0x26')+_0x4ca327[_0x19f0('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xea070f['id']);}return _0x5b53d1[_0x19f0('0x25')]['create']({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327['priority']:0x2,'scheduledat':_0x4ca327['scheduledat']?_0x4ca327[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327['callbackUniqueid']?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'VoiceQueueId':_0xea070f['id']});})['catch'](function(_0x14b3c5){_0x19d37b(_0x14b3c5);});});});};var _0x1b2198=function(_0x2aee1d){return new BPromise(function(_0x5550a0,_0x43a1d8){_0x38dfa4(_0x2aee1d,_0x4ca327)[_0x19f0('0x1e')](function(_0xd94966){_0x4ca327['scheduledat']=_0xd94966[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327[_0x19f0('0xc')],'VoiceQueueId':_0x2aee1d['id']}})['then'](function(_0x224d21){if(!_[_0x19f0('0x1b')](_0x224d21)){throw new Error(_0x19f0('0x26')+_0x4ca327['phone']+_0x19f0('0x2a')+_0x2aee1d['id']);}return _0x5b53d1[_0x19f0('0x2b')][_0x19f0('0x1d')]({'where':{'calleridnum':_0x4ca327[_0x19f0('0xc')],'VoiceQueueId':_0x2aee1d['id']}});})['then'](function(_0x58db36){if(!_['isNil'](_0x58db36)){throw new Error(_0x19f0('0x2c')+_0x4ca327['phone']+_0x19f0('0x2d')+_0x2aee1d['id']);}return _0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327[_0x19f0('0x28')]:0x2,'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327['scheduledat']:moment()[_0x19f0('0x1a')](_0x19f0('0x23')),'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'VoiceQueueId':_0x2aee1d['id']});})[_0x19f0('0x2f')](function(_0x4f0675){_0x43a1d8(_0x4f0675);});});});};function _0x4c2619(){return function(_0x44c56c){logger[_0x19f0('0x15')](_0x19f0('0x16'),_0x19f0('0x17'),util[_0x19f0('0x18')](_0x44c56c,{'showHidden':![],'depth':null}));};}function _0x29649e(_0x74e536,_0x96783f){var _0x333f46=_0x96783f[_0x19f0('0x19')]?_0x96783f[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5528a7,_0x2151c5){if(_[_0x19f0('0x1b')](_0x96783f[_0x19f0('0x1c')])){_0x5528a7({'ret':_0x333f46});}else{_0x5b53d1[_0x19f0('0x30')][_0x19f0('0x1d')]({'where':{'id':_0x74e536['id']}})[_0x19f0('0x1e')](function(_0x39e983){if(!_['isNil'](_0x39e983)){var _0x41e06c=_0x39e983[_0x19f0('0x1c')];if(!_[_0x19f0('0x1b')](_0x41e06c)){var _0x4ca47a=shared[_0x19f0('0x1f')];var _0x4df49e=_0x4ca47a[_0x41e06c];var _0x4b4bf3=_0x4ca47a[_0x96783f[_0x19f0('0x1c')]];if(!_[_0x19f0('0x1b')](_0x4df49e)&&!_[_0x19f0('0x1b')](_0x4b4bf3)){var _0x133516=_0x4df49e[_0x19f0('0x20')]-_0x4b4bf3[_0x19f0('0x20')];_0x333f46=_0x96783f[_0x19f0('0x19')]?_0x96783f[_0x19f0('0x19')]:moment();var _0x35e10d=moment(_0x333f46)[_0x19f0('0x21')](_0x133516,'minutes');_0x5528a7({'ret':_0x35e10d[_0x19f0('0x1a')](_0x19f0('0x23'))});}else _0x5528a7({'ret':_0x333f46});}else _0x5528a7({'ret':_0x333f46});}else{_0x5528a7({'ret':_0x333f46});}});}});return 0xa;}var _0x2e0e11=function(_0x434a95){return new BPromise(function(_0x4a9d6b,_0x1aef72){_0x29649e(_0x434a95,_0x4ca327)[_0x19f0('0x1e')](function(_0x135078){_0x4ca327['scheduledat']=_0x135078[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327[_0x19f0('0xc')],'CampaignId':_0x434a95['id']}})[_0x19f0('0x1e')](function(_0x472c63){if(!_['isNil'](_0x472c63)){throw new Error(_0x19f0('0x26')+_0x4ca327[_0x19f0('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x434a95['id']);}return _0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327['phone'],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'priority':_0x4ca327['priority']?_0x4ca327['priority']:0x2,'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')](_0x19f0('0x23')),'callback':_0x4ca327['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()['format'](_0x19f0('0x23')):undefined,'CampaignId':_0x434a95['id']});})['catch'](function(_0x463fba){_0x1aef72(_0x463fba);});});});};var _0x129a28=function(_0x4ee0c8){return new BPromise(function(_0x1395cf,_0x2e9bef){_0x29649e(_0x4ee0c8,_0x4ca327)[_0x19f0('0x1e')](function(_0x4edd88){_0x4ca327[_0x19f0('0x19')]=_0x4edd88[_0x19f0('0x24')];_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x1d')]({'where':{'phone':_0x4ca327['phone'],'CampaignId':_0x4ee0c8['id']}})[_0x19f0('0x1e')](function(_0x16e650){if(!_[_0x19f0('0x1b')](_0x16e650)){throw new Error(_0x19f0('0x26')+_0x4ca327[_0x19f0('0xc')]+_0x19f0('0x31')+_0x4ee0c8['id']);}return _0x5b53d1['CmHopperFinal'][_0x19f0('0x1d')]({'where':{'calleridnum':_0x4ca327[_0x19f0('0xc')],'CampaignId':_0x4ee0c8['id']}});})[_0x19f0('0x1e')](function(_0x49f2d9){if(!_[_0x19f0('0x1b')](_0x49f2d9)){throw new Error(_0x19f0('0x2c')+_0x4ca327[_0x19f0('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x4ee0c8['id']);}return _0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327['ListId'],'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327[_0x19f0('0x28')]:0x2,'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327[_0x19f0('0x19')]:moment()['format'](_0x19f0('0x23')),'callback':_0x4ca327['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327['callbackUniqueid']:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'CampaignId':_0x4ee0c8['id']});})[_0x19f0('0x2f')](function(_0xd3cc6f){_0x2e9bef(_0xd3cc6f);});});});};if(_0x4ca327[_0x19f0('0x27')]){_0x5b53d1['VoiceQueue'][_0x19f0('0x32')]({'where':{'type':_0x19f0('0x33')},'attributes':['id',_0x19f0('0x34'),'dialTimezone'],'include':[{'model':_0x5b53d1[_0x19f0('0x35')],'as':_0x19f0('0x36'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})['then'](function(_0x3aa189){if(_0x3aa189){var _0x2dd31d=[];for(var _0x5d4abf=0x0,_0x553079;_0x5d4abf<_0x3aa189[_0x19f0('0x37')];_0x5d4abf+=0x1){_0x553079=_0x3aa189[_0x5d4abf][_0x19f0('0x14')]({'plain':!![]});switch(_0x553079['dialCheckDuplicateType']){case _0x19f0('0x38'):_0x1b2198(_0x553079)[_0x19f0('0x2f')](_0x2a4721());break;case _0x19f0('0x39'):_0x118895(_0x553079)[_0x19f0('0x2f')](_0x2a4721());break;default:_0x29649e(_0x553079,_0x4ca327)[_0x19f0('0x1e')](function(_0x3badb2){_0x4ca327[_0x19f0('0x19')]=_0x3badb2[_0x19f0('0x24')];_0x5b53d1['CmHopper'][_0x19f0('0x2e')]({'phone':_0x4ca327['phone'],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327['ListId'],'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327['scheduledat']:moment()[_0x19f0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327[_0x19f0('0x28')]:0x2,'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'VoiceQueueId':_0x553079['id']})[_0x19f0('0x2f')](_0x2a4721());});}}}})[_0x19f0('0x1e')](function(){return _0x5b53d1[_0x19f0('0x3a')][_0x19f0('0x32')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5b53d1[_0x19f0('0x35')],'as':_0x19f0('0x3b'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})[_0x19f0('0x1e')](function(_0x22ca10){if(_0x22ca10){var _0x52a739=[];for(var _0x45cf4b=0x0,_0xea7973;_0x45cf4b<_0x22ca10[_0x19f0('0x37')];_0x45cf4b+=0x1){_0xea7973=_0x22ca10[_0x45cf4b][_0x19f0('0x14')]({'plain':!![]});_0x5b53d1[_0x19f0('0x3c')]['create']({'phone':_0x4ca327['phone'],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'VoiceQueueId':_0xea7973['id']})[_0x19f0('0x2f')](function(_0x3c7a7f){logger['error'](_0x19f0('0x3d'),_0x19f0('0x17'),_0x3c7a7f['message']);});}}});})[_0x19f0('0x1e')](function(){return _0x5b53d1[_0x19f0('0x30')][_0x19f0('0x32')]({'attributes':['id',_0x19f0('0x34'),_0x19f0('0x1c')],'include':[{'model':_0x5b53d1['CmList'],'as':_0x19f0('0x36'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})[_0x19f0('0x1e')](function(_0x20b4e8){if(_0x20b4e8){var _0x4c5620=[];for(var _0x3f9413=0x0,_0x471613;_0x3f9413<_0x20b4e8[_0x19f0('0x37')];_0x3f9413+=0x1){_0x471613=_0x20b4e8[_0x3f9413][_0x19f0('0x14')]({'plain':!![]});switch(_0x471613[_0x19f0('0x34')]){case'always':_0x129a28(_0x471613)[_0x19f0('0x2f')](_0x4c2619());break;case _0x19f0('0x39'):_0x2e0e11(_0x471613)['catch'](_0x4c2619());break;default:_0x5b53d1[_0x19f0('0x25')][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'scheduledat':_0x4ca327[_0x19f0('0x19')]?_0x4ca327[_0x19f0('0x19')]:moment()[_0x19f0('0x1a')](_0x19f0('0x23')),'priority':_0x4ca327[_0x19f0('0x28')]?_0x4ca327['priority']:0x2,'callback':_0x4ca327[_0x19f0('0x29')]?!![]:![],'callbackuniqueid':_0x4ca327[_0x19f0('0x29')]?_0x4ca327[_0x19f0('0x29')]:undefined,'callbackat':_0x4ca327[_0x19f0('0x29')]?moment()[_0x19f0('0x1a')](_0x19f0('0x23')):undefined,'CampaignId':_0x471613['id']})[_0x19f0('0x2f')](_0x4c2619());}}}});})['then'](function(){return _0x5b53d1[_0x19f0('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x5b53d1[_0x19f0('0x35')],'as':_0x19f0('0x3b'),'where':{'id':_0x4ca327[_0x19f0('0x27')]}}]})[_0x19f0('0x1e')](function(_0x59af84){if(_0x59af84){var _0xf73f84=[];for(var _0x31c4cd=0x0,_0xd83813;_0x31c4cd<_0x59af84[_0x19f0('0x37')];_0x31c4cd+=0x1){_0xd83813=_0x59af84[_0x31c4cd]['get']({'plain':!![]});_0x5b53d1['CmHopperBlack'][_0x19f0('0x2e')]({'phone':_0x4ca327[_0x19f0('0xc')],'ContactId':_0x4ca327['id'],'ListId':_0x4ca327[_0x19f0('0x27')],'CampaignId':_0xd83813['id']})[_0x19f0('0x2f')](function(_0x287493){logger[_0x19f0('0x15')](_0x19f0('0x3d'),'afterCreate',_0x287493['message']);});}}});})['then'](function(){_0x39655f();})['catch'](function(_0x40e2b1){logger[_0x19f0('0x15')]('cmContact,\x20%s,\x20%s',_0x19f0('0x17'),_0x40e2b1[_0x19f0('0x3e')]);_0x39655f(_0x40e2b1);});}else{_0x39655f(new Error(_0x19f0('0x3f')));}},'afterDestroy':function(_0x413a73,_0xf98803,_0x10be48){var _0x184d0f=_0x355b42['models'];var _0x49bf6a=_0x413a73['get']({'plain':!![]});return _0x184d0f[_0x19f0('0x25')][_0x19f0('0x32')]({'raw':!![],'where':{'ListId':_0x49bf6a[_0x19f0('0x27')],'ContactId':_0x49bf6a['id']}})[_0x19f0('0x1e')](function(_0x48d350){if(!_[_0x19f0('0x40')](_0x48d350)){var _0x13972e=[];for(var _0x5d066b=0x0;_0x5d066b<_0x48d350[_0x19f0('0x37')];_0x5d066b+=0x1){var _0x47e2f0=_0x184d0f[_0x19f0('0x25')][_0x19f0('0x41')]({'where':{'ListId':_0x48d350[_0x5d066b][_0x19f0('0x27')],'ContactId':_0x48d350[_0x5d066b][_0x19f0('0x42')],'VoiceQueueId':_0x48d350[_0x5d066b][_0x19f0('0x43')],'CampaignId':_0x48d350[_0x5d066b]['CampaignId']}});_0x13972e[_0x19f0('0x44')](_0x47e2f0);}return BPromise[_0x19f0('0x45')](_0x13972e);}})[_0x19f0('0x1e')](function(_0x1c0ef3){logger[_0x19f0('0x46')](_0x19f0('0x47'),util[_0x19f0('0x18')](_0x1c0ef3,{'showHidden':![],'depth':null}));_0x10be48();})[_0x19f0('0x2f')](function(_0x2d4543){logger[_0x19f0('0x15')](_0x19f0('0x48'),util[_0x19f0('0x18')](_0x2d4543,{'showHidden':![],'depth':null}));_0x10be48(_0x2d4543);});}}});}; \ No newline at end of file +var _0xfa63=['lastName','mobile','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','then','dialTimezone','timezones','utcOffset','minutes','format','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','findOne','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','always','CmList','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','onlyIfOpen','message','models','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts'];(function(_0x42022a,_0x2c009b){var _0x2de0a8=function(_0x26be68){while(--_0x26be68){_0x42022a['push'](_0x42022a['shift']());}};_0x2de0a8(++_0x2c009b);}(_0xfa63,0x1a2));var _0x3fa6=function(_0x2fe52c,_0x1048b9){_0x2fe52c=_0x2fe52c-0x0;var _0x262bd2=_0xfa63[_0x2fe52c];return _0x262bd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fa6('0x0'))(_0x3fa6('0x1'));var moment=require(_0x3fa6('0x2'));var BPromise=require(_0x3fa6('0x3'));var rp=require(_0x3fa6('0x4'));var fs=require('fs');var path=require(_0x3fa6('0x5'));var rimraf=require(_0x3fa6('0x6'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0x3fa6('0x7'));module[_0x3fa6('0x8')]=function(_0x441265,_0xdb6676){return _0x441265[_0x3fa6('0x9')](_0x3fa6('0xa'),attributes,{'tableName':_0x3fa6('0xb'),'paranoid':!![],'indexes':[{'name':_0x3fa6('0xc'),'fields':[_0x3fa6('0xc')]},{'name':_0x3fa6('0xd'),'fields':['firstName',_0x3fa6('0xe'),_0x3fa6('0xc'),_0x3fa6('0xf'),'fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0x3fa6('0x10'),'hooks':{'afterCreate':function(_0x4059ee,_0x175ac9,_0x274794){var _0x3323a0=_0x441265['models'];var _0x44ad3b=_0x4059ee[_0x3fa6('0x11')]({'plain':!![]});function _0x23f91(){return function(_0x119b48){logger[_0x3fa6('0x12')](_0x3fa6('0x13'),_0x3fa6('0x14'),util[_0x3fa6('0x15')](_0x119b48,{'showHidden':![],'depth':null}));};}function _0x1e22a7(_0x1b0ea4,_0x443049){var _0x51d538=_0x443049[_0x3fa6('0x16')]?_0x443049['scheduledat']:moment()['format'](_0x3fa6('0x17'));return new BPromise(function(_0x4b54c0,_0x1d34f7){if(_[_0x3fa6('0x18')](_0x443049['dialTimezone'])){_0x4b54c0({'ret':_0x51d538});}else{_0x3323a0['VoiceQueue']['findOne']({'where':{'id':_0x1b0ea4['id']}})[_0x3fa6('0x19')](function(_0x4a1cf7){if(!_['isNil'](_0x4a1cf7)){var _0x1917bc=_0x4a1cf7[_0x3fa6('0x1a')];if(!_[_0x3fa6('0x18')](_0x1917bc)){var _0x512c2b=shared[_0x3fa6('0x1b')];var _0x1dac59=_0x512c2b[_0x1917bc];var _0x40158c=_0x512c2b[_0x443049[_0x3fa6('0x1a')]];if(!_[_0x3fa6('0x18')](_0x1dac59)&&!_[_0x3fa6('0x18')](_0x40158c)){var _0x513702=_0x1dac59[_0x3fa6('0x1c')]-_0x40158c[_0x3fa6('0x1c')];_0x51d538=_0x443049[_0x3fa6('0x16')]?_0x443049['scheduledat']:moment();var _0x15f5c6=moment(_0x51d538)['add'](_0x513702,_0x3fa6('0x1d'));_0x4b54c0({'ret':_0x15f5c6[_0x3fa6('0x1e')](_0x3fa6('0x17'))});}else _0x4b54c0({'ret':_0x51d538});}else _0x4b54c0({'ret':_0x51d538});}else{_0x4b54c0({'ret':_0x51d538});}});}});return 0xa;}var _0x57b491=function(_0x5f2709){return new BPromise(function(_0x4230c8,_0x4e93f7){_0x1e22a7(_0x5f2709,_0x44ad3b)['then'](function(_0x2a9304){_0x44ad3b[_0x3fa6('0x16')]=_0x2a9304['ret'];_0x3323a0[_0x3fa6('0x1f')]['findOne']({'where':{'phone':_0x44ad3b['phone'],'VoiceQueueId':_0x5f2709['id']}})[_0x3fa6('0x19')](function(_0x58e853){if(!_[_0x3fa6('0x18')](_0x58e853)){throw new Error(_0x3fa6('0x20')+_0x44ad3b[_0x3fa6('0xc')]+_0x3fa6('0x21')+_0x5f2709['id']);}return _0x3323a0[_0x3fa6('0x1f')][_0x3fa6('0x22')]({'phone':_0x44ad3b[_0x3fa6('0xc')],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b[_0x3fa6('0x23')],'priority':_0x44ad3b[_0x3fa6('0x24')]?_0x44ad3b[_0x3fa6('0x24')]:0x2,'scheduledat':_0x44ad3b['scheduledat']?_0x44ad3b[_0x3fa6('0x16')]:moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')),'callback':_0x44ad3b[_0x3fa6('0x25')]?!![]:![],'callbackuniqueid':_0x44ad3b[_0x3fa6('0x25')]?_0x44ad3b[_0x3fa6('0x25')]:undefined,'callbackat':_0x44ad3b[_0x3fa6('0x25')]?moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')):undefined,'VoiceQueueId':_0x5f2709['id']});})[_0x3fa6('0x26')](function(_0x3019c3){_0x4e93f7(_0x3019c3);});});});};var _0x15c088=function(_0x44f1ad){return new BPromise(function(_0x2fa699,_0x2d4cba){_0x1e22a7(_0x44f1ad,_0x44ad3b)[_0x3fa6('0x19')](function(_0x5cbb7d){_0x44ad3b[_0x3fa6('0x16')]=_0x5cbb7d['ret'];_0x3323a0[_0x3fa6('0x1f')][_0x3fa6('0x27')]({'where':{'phone':_0x44ad3b[_0x3fa6('0xc')],'VoiceQueueId':_0x44f1ad['id']}})['then'](function(_0x3800a7){if(!_[_0x3fa6('0x18')](_0x3800a7)){throw new Error(_0x3fa6('0x20')+_0x44ad3b[_0x3fa6('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x44f1ad['id']);}return _0x3323a0[_0x3fa6('0x28')][_0x3fa6('0x27')]({'where':{'calleridnum':_0x44ad3b[_0x3fa6('0xc')],'VoiceQueueId':_0x44f1ad['id']}});})[_0x3fa6('0x19')](function(_0x3f19a3){if(!_[_0x3fa6('0x18')](_0x3f19a3)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x44ad3b[_0x3fa6('0xc')]+_0x3fa6('0x29')+_0x44f1ad['id']);}return _0x3323a0[_0x3fa6('0x1f')][_0x3fa6('0x22')]({'phone':_0x44ad3b[_0x3fa6('0xc')],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b[_0x3fa6('0x23')],'priority':_0x44ad3b[_0x3fa6('0x24')]?_0x44ad3b[_0x3fa6('0x24')]:0x2,'scheduledat':_0x44ad3b[_0x3fa6('0x16')]?_0x44ad3b[_0x3fa6('0x16')]:moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')),'callback':_0x44ad3b[_0x3fa6('0x25')]?!![]:![],'callbackuniqueid':_0x44ad3b[_0x3fa6('0x25')]?_0x44ad3b[_0x3fa6('0x25')]:undefined,'callbackat':_0x44ad3b[_0x3fa6('0x25')]?moment()['format'](_0x3fa6('0x17')):undefined,'VoiceQueueId':_0x44f1ad['id']});})['catch'](function(_0x1a8146){_0x2d4cba(_0x1a8146);});});});};function _0x4a5fbc(){return function(_0x40539c){logger[_0x3fa6('0x12')](_0x3fa6('0x13'),_0x3fa6('0x14'),util[_0x3fa6('0x15')](_0x40539c,{'showHidden':![],'depth':null}));};}function _0x2f9b75(_0x2398a0,_0x2fa2ba){var _0x28793e=_0x2fa2ba[_0x3fa6('0x16')]?_0x2fa2ba[_0x3fa6('0x16')]:moment()[_0x3fa6('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x3dd478,_0x44119e){if(_[_0x3fa6('0x18')](_0x2fa2ba['dialTimezone'])){_0x3dd478({'ret':_0x28793e});}else{_0x3323a0[_0x3fa6('0x2a')]['findOne']({'where':{'id':_0x2398a0['id']}})[_0x3fa6('0x19')](function(_0x262be0){if(!_[_0x3fa6('0x18')](_0x262be0)){var _0x2a6974=_0x262be0[_0x3fa6('0x1a')];if(!_[_0x3fa6('0x18')](_0x2a6974)){var _0x201e07=shared[_0x3fa6('0x1b')];var _0x6fce55=_0x201e07[_0x2a6974];var _0x494428=_0x201e07[_0x2fa2ba[_0x3fa6('0x1a')]];if(!_[_0x3fa6('0x18')](_0x6fce55)&&!_[_0x3fa6('0x18')](_0x494428)){var _0x2afc38=_0x6fce55[_0x3fa6('0x1c')]-_0x494428[_0x3fa6('0x1c')];_0x28793e=_0x2fa2ba[_0x3fa6('0x16')]?_0x2fa2ba['scheduledat']:moment();var _0x13b7ef=moment(_0x28793e)[_0x3fa6('0x2b')](_0x2afc38,'minutes');_0x3dd478({'ret':_0x13b7ef[_0x3fa6('0x1e')](_0x3fa6('0x17'))});}else _0x3dd478({'ret':_0x28793e});}else _0x3dd478({'ret':_0x28793e});}else{_0x3dd478({'ret':_0x28793e});}});}});return 0xa;}var _0x524189=function(_0x5053ab){return new BPromise(function(_0x2e1b9a,_0x4f8834){_0x2f9b75(_0x5053ab,_0x44ad3b)[_0x3fa6('0x19')](function(_0x57e93b){_0x44ad3b[_0x3fa6('0x16')]=_0x57e93b['ret'];_0x3323a0[_0x3fa6('0x1f')][_0x3fa6('0x27')]({'where':{'phone':_0x44ad3b[_0x3fa6('0xc')],'CampaignId':_0x5053ab['id']}})['then'](function(_0x583937){if(!_[_0x3fa6('0x18')](_0x583937)){throw new Error(_0x3fa6('0x20')+_0x44ad3b['phone']+_0x3fa6('0x2c')+_0x5053ab['id']);}return _0x3323a0['CmHopper'][_0x3fa6('0x22')]({'phone':_0x44ad3b['phone'],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b[_0x3fa6('0x23')],'priority':_0x44ad3b['priority']?_0x44ad3b[_0x3fa6('0x24')]:0x2,'scheduledat':_0x44ad3b[_0x3fa6('0x16')]?_0x44ad3b['scheduledat']:moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')),'callback':_0x44ad3b[_0x3fa6('0x25')]?!![]:![],'callbackuniqueid':_0x44ad3b[_0x3fa6('0x25')]?_0x44ad3b[_0x3fa6('0x25')]:undefined,'callbackat':_0x44ad3b[_0x3fa6('0x25')]?moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')):undefined,'CampaignId':_0x5053ab['id']});})[_0x3fa6('0x26')](function(_0x191f3c){_0x4f8834(_0x191f3c);});});});};var _0x168d51=function(_0x25d19e){return new BPromise(function(_0x26f564,_0x157ff4){_0x2f9b75(_0x25d19e,_0x44ad3b)[_0x3fa6('0x19')](function(_0x4bdcd5){_0x44ad3b[_0x3fa6('0x16')]=_0x4bdcd5[_0x3fa6('0x2d')];_0x3323a0[_0x3fa6('0x1f')]['findOne']({'where':{'phone':_0x44ad3b[_0x3fa6('0xc')],'CampaignId':_0x25d19e['id']}})[_0x3fa6('0x19')](function(_0xe3e31c){if(!_['isNil'](_0xe3e31c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x44ad3b[_0x3fa6('0xc')]+_0x3fa6('0x2e')+_0x25d19e['id']);}return _0x3323a0['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x44ad3b[_0x3fa6('0xc')],'CampaignId':_0x25d19e['id']}});})['then'](function(_0x2fa2a2){if(!_[_0x3fa6('0x18')](_0x2fa2a2)){throw new Error(_0x3fa6('0x2f')+_0x44ad3b[_0x3fa6('0xc')]+_0x3fa6('0x30')+_0x25d19e['id']);}return _0x3323a0[_0x3fa6('0x1f')][_0x3fa6('0x22')]({'phone':_0x44ad3b['phone'],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b['ListId'],'priority':_0x44ad3b[_0x3fa6('0x24')]?_0x44ad3b['priority']:0x2,'scheduledat':_0x44ad3b[_0x3fa6('0x16')]?_0x44ad3b[_0x3fa6('0x16')]:moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')),'callback':_0x44ad3b[_0x3fa6('0x25')]?!![]:![],'callbackuniqueid':_0x44ad3b[_0x3fa6('0x25')]?_0x44ad3b[_0x3fa6('0x25')]:undefined,'callbackat':_0x44ad3b[_0x3fa6('0x25')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x25d19e['id']});})['catch'](function(_0x2e0cd9){_0x157ff4(_0x2e0cd9);});});});};if(_0x44ad3b[_0x3fa6('0x23')]){_0x3323a0[_0x3fa6('0x31')][_0x3fa6('0x32')]({'where':{'type':_0x3fa6('0x33')},'attributes':['id',_0x3fa6('0x34'),_0x3fa6('0x1a')],'include':[{'model':_0x3323a0['CmList'],'as':_0x3fa6('0x35'),'where':{'id':_0x44ad3b[_0x3fa6('0x23')]}}]})[_0x3fa6('0x19')](function(_0x27ca9e){if(_0x27ca9e){var _0x3258aa=[];for(var _0x2c6ab7=0x0,_0x30924d;_0x2c6ab7<_0x27ca9e['length'];_0x2c6ab7+=0x1){_0x30924d=_0x27ca9e[_0x2c6ab7][_0x3fa6('0x11')]({'plain':!![]});switch(_0x30924d[_0x3fa6('0x34')]){case _0x3fa6('0x36'):_0x15c088(_0x30924d)[_0x3fa6('0x26')](_0x23f91());break;case'onlyIfOpen':_0x57b491(_0x30924d)['catch'](_0x23f91());break;default:_0x2f9b75(_0x30924d,_0x44ad3b)[_0x3fa6('0x19')](function(_0x58034d){_0x44ad3b['scheduledat']=_0x58034d[_0x3fa6('0x2d')];_0x3323a0['CmHopper'][_0x3fa6('0x22')]({'phone':_0x44ad3b[_0x3fa6('0xc')],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b['ListId'],'scheduledat':_0x44ad3b[_0x3fa6('0x16')]?_0x44ad3b[_0x3fa6('0x16')]:moment()['format'](_0x3fa6('0x17')),'priority':_0x44ad3b['priority']?_0x44ad3b['priority']:0x2,'callback':_0x44ad3b[_0x3fa6('0x25')]?!![]:![],'callbackuniqueid':_0x44ad3b['callbackUniqueid']?_0x44ad3b[_0x3fa6('0x25')]:undefined,'callbackat':_0x44ad3b[_0x3fa6('0x25')]?moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')):undefined,'VoiceQueueId':_0x30924d['id']})[_0x3fa6('0x26')](_0x23f91());});}}}})['then'](function(){return _0x3323a0[_0x3fa6('0x31')][_0x3fa6('0x32')]({'where':{'type':_0x3fa6('0x33')},'attributes':['id'],'include':[{'model':_0x3323a0[_0x3fa6('0x37')],'as':_0x3fa6('0x38'),'where':{'id':_0x44ad3b[_0x3fa6('0x23')]}}]})[_0x3fa6('0x19')](function(_0x2f08d0){if(_0x2f08d0){var _0x150857=[];for(var _0x203115=0x0,_0x29a6b3;_0x203115<_0x2f08d0[_0x3fa6('0x39')];_0x203115+=0x1){_0x29a6b3=_0x2f08d0[_0x203115][_0x3fa6('0x11')]({'plain':!![]});_0x3323a0[_0x3fa6('0x3a')][_0x3fa6('0x22')]({'phone':_0x44ad3b[_0x3fa6('0xc')],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b['ListId'],'VoiceQueueId':_0x29a6b3['id']})[_0x3fa6('0x26')](function(_0x154ba1){logger[_0x3fa6('0x12')](_0x3fa6('0x3b'),'afterCreate',_0x154ba1['message']);});}}});})[_0x3fa6('0x19')](function(){return _0x3323a0['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0x3fa6('0x1a')],'include':[{'model':_0x3323a0[_0x3fa6('0x37')],'as':_0x3fa6('0x35'),'where':{'id':_0x44ad3b[_0x3fa6('0x23')]}}]})[_0x3fa6('0x19')](function(_0x466589){if(_0x466589){var _0x83de00=[];for(var _0x55e933=0x0,_0x2af963;_0x55e933<_0x466589[_0x3fa6('0x39')];_0x55e933+=0x1){_0x2af963=_0x466589[_0x55e933][_0x3fa6('0x11')]({'plain':!![]});switch(_0x2af963[_0x3fa6('0x34')]){case _0x3fa6('0x36'):_0x168d51(_0x2af963)[_0x3fa6('0x26')](_0x4a5fbc());break;case _0x3fa6('0x3c'):_0x524189(_0x2af963)['catch'](_0x4a5fbc());break;default:_0x3323a0[_0x3fa6('0x1f')][_0x3fa6('0x22')]({'phone':_0x44ad3b[_0x3fa6('0xc')],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b[_0x3fa6('0x23')],'scheduledat':_0x44ad3b[_0x3fa6('0x16')]?_0x44ad3b[_0x3fa6('0x16')]:moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')),'priority':_0x44ad3b[_0x3fa6('0x24')]?_0x44ad3b[_0x3fa6('0x24')]:0x2,'callback':_0x44ad3b[_0x3fa6('0x25')]?!![]:![],'callbackuniqueid':_0x44ad3b[_0x3fa6('0x25')]?_0x44ad3b[_0x3fa6('0x25')]:undefined,'callbackat':_0x44ad3b[_0x3fa6('0x25')]?moment()[_0x3fa6('0x1e')](_0x3fa6('0x17')):undefined,'CampaignId':_0x2af963['id']})[_0x3fa6('0x26')](_0x4a5fbc());}}}});})[_0x3fa6('0x19')](function(){return _0x3323a0[_0x3fa6('0x2a')][_0x3fa6('0x32')]({'attributes':['id'],'include':[{'model':_0x3323a0[_0x3fa6('0x37')],'as':_0x3fa6('0x38'),'where':{'id':_0x44ad3b[_0x3fa6('0x23')]}}]})[_0x3fa6('0x19')](function(_0x20b1f9){if(_0x20b1f9){var _0x22a485=[];for(var _0x27cab2=0x0,_0x13703f;_0x27cab2<_0x20b1f9[_0x3fa6('0x39')];_0x27cab2+=0x1){_0x13703f=_0x20b1f9[_0x27cab2]['get']({'plain':!![]});_0x3323a0[_0x3fa6('0x3a')][_0x3fa6('0x22')]({'phone':_0x44ad3b[_0x3fa6('0xc')],'ContactId':_0x44ad3b['id'],'ListId':_0x44ad3b['ListId'],'CampaignId':_0x13703f['id']})[_0x3fa6('0x26')](function(_0x1b5caf){logger[_0x3fa6('0x12')](_0x3fa6('0x3b'),_0x3fa6('0x14'),_0x1b5caf[_0x3fa6('0x3d')]);});}}});})['then'](function(){_0x274794();})[_0x3fa6('0x26')](function(_0x115950){logger[_0x3fa6('0x12')](_0x3fa6('0x3b'),'afterCreate',_0x115950['message']);_0x274794(_0x115950);});}else{_0x274794(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x48d709,_0x27df2c,_0x3e4c0c){var _0x3c0d2f=_0x441265[_0x3fa6('0x3e')];var _0x4cfdfe=_0x48d709['get']({'plain':!![]});return _0x3c0d2f['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x4cfdfe[_0x3fa6('0x23')],'ContactId':_0x4cfdfe['id']}})['then'](function(_0x210a80){if(!_[_0x3fa6('0x3f')](_0x210a80)){var _0xce63a2=[];for(var _0x5704c0=0x0;_0x5704c0<_0x210a80[_0x3fa6('0x39')];_0x5704c0+=0x1){var _0x89a862=_0x3c0d2f[_0x3fa6('0x1f')][_0x3fa6('0x40')]({'where':{'ListId':_0x210a80[_0x5704c0][_0x3fa6('0x23')],'ContactId':_0x210a80[_0x5704c0]['ContactId'],'VoiceQueueId':_0x210a80[_0x5704c0][_0x3fa6('0x41')],'CampaignId':_0x210a80[_0x5704c0][_0x3fa6('0x42')]}});_0xce63a2[_0x3fa6('0x43')](_0x89a862);}return BPromise[_0x3fa6('0x44')](_0xce63a2);}})[_0x3fa6('0x19')](function(_0x553881){logger[_0x3fa6('0x45')](_0x3fa6('0x46'),util[_0x3fa6('0x15')](_0x553881,{'showHidden':![],'depth':null}));_0x3e4c0c();})['catch'](function(_0x354410){logger[_0x3fa6('0x12')](_0x3fa6('0x47'),util['inspect'](_0x354410,{'showHidden':![],'depth':null}));_0x3e4c0c(_0x354410);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 08b4cef..d49af31 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(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x449ac6,_0x185cd6){var _0x12e875=function(_0x255bbe){while(--_0x255bbe){_0x449ac6['push'](_0x449ac6['shift']());}};_0x12e875(++_0x185cd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 427a12f..9e6088e 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 _0x0f69=['STRING','INTEGER'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x0f69,0x173));var _0x90f6=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0f69[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x90f6('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x90f6('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x90f6('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x90f6('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x90f6('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xab3a=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab3a,0x1d3));var _0xaab3=function(_0x3137f0,_0x509d52){_0x3137f0=_0x3137f0-0x0;var _0x4c12c4=_0xab3a[_0x3137f0];return _0x4c12c4;};'use strict';var Sequelize=require(_0xaab3('0x0'));module[_0xaab3('0x1')]={'CmContactId':{'type':Sequelize[_0xaab3('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xaab3('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xaab3('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xaab3('0x3')],'defaultValue':_0xaab3('0x4')},'OrderBy':{'type':Sequelize[_0xaab3('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xaab3('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 0747a6d..02fdba7 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 _0x0b63=['sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','fields','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','update','then','destroy','UserProfileResource','error','stack','name','index','CmContactHasItem','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0b63,0x67));var _0x30b6=function(_0x5d5f14,_0x3f36c7){_0x5d5f14=_0x5d5f14-0x0;var _0x22859c=_0x0b63[_0x5d5f14];return _0x22859c;};'use strict';var emlformat=require(_0x30b6('0x0'));var rimraf=require(_0x30b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30b6('0x2'));var rp=require(_0x30b6('0x3'));var moment=require('moment');var BPromise=require(_0x30b6('0x4'));var Mustache=require(_0x30b6('0x5'));var util=require(_0x30b6('0x6'));var path=require('path');var sox=require(_0x30b6('0x7'));var csv=require(_0x30b6('0x8'));var ejs=require(_0x30b6('0x9'));var fs=require('fs');var fs_extra=require(_0x30b6('0xa'));var _=require(_0x30b6('0xb'));var squel=require(_0x30b6('0xc'));var crypto=require(_0x30b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x30b6('0xe'));var toCsv=require(_0x30b6('0x8'));var querystring=require(_0x30b6('0xf'));var Papa=require(_0x30b6('0x10'));var Redis=require('ioredis');var authService=require(_0x30b6('0x11'));var qs=require(_0x30b6('0x12'));var as=require(_0x30b6('0x13'));var hardwareService=require(_0x30b6('0x14'));var logger=require(_0x30b6('0x15'))(_0x30b6('0x16'));var utils=require(_0x30b6('0x17'));var config=require(_0x30b6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x30b6('0x19'))['db'];function respondWithStatusCode(_0x5cfec4,_0xae0777){_0xae0777=_0xae0777||0xcc;return function(_0x270e33){if(_0x270e33){return _0x5cfec4[_0x30b6('0x1a')](_0xae0777);}return _0x5cfec4[_0x30b6('0x1b')](_0xae0777)[_0x30b6('0x1c')]();};}function respondWithResult(_0x141640,_0x41704c){_0x41704c=_0x41704c||0xc8;return function(_0x258ac9){if(_0x258ac9){return _0x141640[_0x30b6('0x1b')](_0x41704c)[_0x30b6('0x1d')](_0x258ac9);}};}function respondWithFilteredResult(_0x17ab28,_0x249c56){return function(_0x25b899){if(_0x25b899){var _0x160188=typeof _0x249c56[_0x30b6('0x1e')]==='undefined'&&typeof _0x249c56[_0x30b6('0x1f')]===_0x30b6('0x20');var _0x1d3628=_0x25b899[_0x30b6('0x21')];var _0x517cb1=_0x160188?0x0:_0x249c56[_0x30b6('0x1e')];var _0x3b94fe=_0x160188?_0x25b899[_0x30b6('0x21')]:_0x249c56[_0x30b6('0x1e')]+_0x249c56[_0x30b6('0x1f')];var _0x4712d5;if(_0x3b94fe>=_0x1d3628){_0x3b94fe=_0x1d3628;_0x4712d5=0xc8;}else{_0x4712d5=0xce;}_0x17ab28[_0x30b6('0x1b')](_0x4712d5);return _0x17ab28['set']('Content-Range',_0x517cb1+'-'+_0x3b94fe+'/'+_0x1d3628)[_0x30b6('0x1d')](_0x25b899);}return null;};}function patchUpdates(_0x52466e){return function(_0x59cf55){try{jsonpatch['apply'](_0x59cf55,_0x52466e,!![]);}catch(_0x24e713){return BPromise[_0x30b6('0x22')](_0x24e713);}return _0x59cf55['save']();};}function saveUpdates(_0x3e7488,_0x4c7038){return function(_0x367620){if(_0x367620){return _0x367620[_0x30b6('0x23')](_0x3e7488)[_0x30b6('0x24')](function(_0x544a14){return _0x544a14;});}return null;};}function removeEntity(_0x3d4d28,_0x3ab7fe){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0x30b6('0x25')]()[_0x30b6('0x24')](function(){var _0x5eae15=_0x1d3022['get']({'plain':!![]});var _0x38fd2e='CmContactHasItems';return db[_0x30b6('0x26')]['destroy']({'where':{'type':_0x38fd2e,'resourceId':_0x5eae15['id']}})[_0x30b6('0x24')](function(){return _0x1d3022;});})[_0x30b6('0x24')](function(){_0x3d4d28[_0x30b6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x289648,_0x2ee021){return function(_0x566c46){if(!_0x566c46){_0x289648['sendStatus'](0x194);}return _0x566c46;};}function handleError(_0x57e26d,_0x10a39c){_0x10a39c=_0x10a39c||0x1f4;return function(_0xab8b63){logger[_0x30b6('0x27')](_0xab8b63[_0x30b6('0x28')]);if(_0xab8b63[_0x30b6('0x29')]){delete _0xab8b63[_0x30b6('0x29')];}_0x57e26d[_0x30b6('0x1b')](_0x10a39c)['send'](_0xab8b63);};}exports[_0x30b6('0x2a')]=function(_0x127a03,_0x2eafe3){var _0x20cc81={},_0xc844be={},_0x2f834e={'count':0x0,'rows':[]};var _0x392f9c=_['map'](db[_0x30b6('0x2b')][_0x30b6('0x2c')],function(_0x33d5b1){return{'name':_0x33d5b1[_0x30b6('0x2d')],'type':_0x33d5b1['type']['key']};});_0xc844be[_0x30b6('0x2e')]=_[_0x30b6('0x2f')](_0x392f9c,_0x30b6('0x29'));_0xc844be[_0x30b6('0x30')]=_[_0x30b6('0x31')](_0x127a03[_0x30b6('0x30')]);_0xc844be[_0x30b6('0x32')]=_[_0x30b6('0x33')](_0xc844be[_0x30b6('0x2e')],_0xc844be['query']);_0x20cc81[_0x30b6('0x34')]=_[_0x30b6('0x33')](_0xc844be[_0x30b6('0x2e')],qs['fields'](_0x127a03[_0x30b6('0x30')]['fields']));_0x20cc81['attributes']=_0x20cc81[_0x30b6('0x34')][_0x30b6('0x35')]?_0x20cc81[_0x30b6('0x34')]:_0xc844be[_0x30b6('0x2e')];if(!_0x127a03[_0x30b6('0x30')][_0x30b6('0x36')]('nolimit')){_0x20cc81[_0x30b6('0x1f')]=qs[_0x30b6('0x1f')](_0x127a03[_0x30b6('0x30')][_0x30b6('0x1f')]);_0x20cc81[_0x30b6('0x1e')]=qs[_0x30b6('0x1e')](_0x127a03[_0x30b6('0x30')][_0x30b6('0x1e')]);}_0x20cc81['order']=qs[_0x30b6('0x37')](_0x127a03['query'][_0x30b6('0x37')]);_0x20cc81[_0x30b6('0x38')]=qs[_0x30b6('0x32')](_[_0x30b6('0x39')](_0x127a03[_0x30b6('0x30')],_0xc844be[_0x30b6('0x32')]),_0x392f9c);if(_0x127a03['query']['filter']){_0x20cc81['where']=_[_0x30b6('0x3a')](_0x20cc81[_0x30b6('0x38')],{'$or':_[_0x30b6('0x2f')](_0x392f9c,function(_0x533d14){if(_0x533d14['type']!==_0x30b6('0x3b')){var _0x516def={};_0x516def[_0x533d14[_0x30b6('0x29')]]={'$like':'%'+_0x127a03['query'][_0x30b6('0x3c')]+'%'};return _0x516def;}})});}_0x20cc81=_[_0x30b6('0x3a')]({},_0x20cc81,_0x127a03['options']);var _0x54bdf4={'where':_0x20cc81[_0x30b6('0x38')]};return db[_0x30b6('0x2b')]['count'](_0x54bdf4)['then'](function(_0x1902d4){_0x2f834e[_0x30b6('0x21')]=_0x1902d4;if(_0x127a03[_0x30b6('0x30')][_0x30b6('0x3d')]){_0x20cc81[_0x30b6('0x3e')]=[{'all':!![]}];}return db[_0x30b6('0x2b')][_0x30b6('0x3f')](_0x20cc81);})[_0x30b6('0x24')](function(_0x756215){_0x2f834e['rows']=_0x756215;return _0x2f834e;})[_0x30b6('0x24')](respondWithFilteredResult(_0x2eafe3,_0x20cc81))['catch'](handleError(_0x2eafe3,null));};exports[_0x30b6('0x40')]=function(_0x56a446,_0x589255){var _0x2ba608={'raw':!![],'where':{'id':_0x56a446[_0x30b6('0x41')]['id']}},_0x4ab889={};_0x4ab889['model']=_[_0x30b6('0x31')](db['CmContactHasItem']['rawAttributes']);_0x4ab889[_0x30b6('0x30')]=_[_0x30b6('0x31')](_0x56a446[_0x30b6('0x30')]);_0x4ab889[_0x30b6('0x32')]=_[_0x30b6('0x33')](_0x4ab889[_0x30b6('0x2e')],_0x4ab889['query']);_0x2ba608[_0x30b6('0x34')]=_[_0x30b6('0x33')](_0x4ab889['model'],qs[_0x30b6('0x42')](_0x56a446['query'][_0x30b6('0x42')]));_0x2ba608[_0x30b6('0x34')]=_0x2ba608['attributes']['length']?_0x2ba608[_0x30b6('0x34')]:_0x4ab889['model'];if(_0x56a446[_0x30b6('0x30')][_0x30b6('0x3d')]){_0x2ba608[_0x30b6('0x3e')]=[{'all':!![]}];}_0x2ba608=_[_0x30b6('0x3a')]({},_0x2ba608,_0x56a446[_0x30b6('0x43')]);return db['CmContactHasItem']['find'](_0x2ba608)['then'](handleEntityNotFound(_0x589255,null))[_0x30b6('0x24')](respondWithResult(_0x589255,null))[_0x30b6('0x44')](handleError(_0x589255,null));};exports[_0x30b6('0x45')]=function(_0x355720,_0x2f6199){return db['CmContactHasItem'][_0x30b6('0x45')](_0x355720[_0x30b6('0x46')],{})[_0x30b6('0x24')](function(_0x3b3036){var _0x3215fb=_0x355720['user']['get']({'plain':!![]});if(!_0x3215fb)throw new Error(_0x30b6('0x47'));if(_0x3215fb[_0x30b6('0x48')]===_0x30b6('0x49')){var _0x3f0438=_0x3b3036['get']({'plain':!![]});var _0x53488b='CmContactHasItems';return db[_0x30b6('0x4a')][_0x30b6('0x4b')]({'where':{'name':_0x53488b,'userProfileId':_0x3215fb[_0x30b6('0x4c')]},'raw':!![]})[_0x30b6('0x24')](function(_0x352837){if(_0x352837&&_0x352837[_0x30b6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f0438[_0x30b6('0x29')],'resourceId':_0x3f0438['id'],'type':_0x352837[_0x30b6('0x29')],'sectionId':_0x352837['id']},{})[_0x30b6('0x24')](function(){return _0x3b3036;});}else{return _0x3b3036;}})[_0x30b6('0x44')](function(_0x89b776){logger['error'](_0x30b6('0x4e'),_0x89b776);throw _0x89b776;});}return _0x3b3036;})[_0x30b6('0x24')](respondWithResult(_0x2f6199,0xc9))['catch'](handleError(_0x2f6199,null));};exports['update']=function(_0x3d7d30,_0x4322bb){if(_0x3d7d30[_0x30b6('0x46')]['id']){delete _0x3d7d30['body']['id'];}return db[_0x30b6('0x2b')][_0x30b6('0x4b')]({'where':{'id':_0x3d7d30['params']['id']}})[_0x30b6('0x24')](handleEntityNotFound(_0x4322bb,null))[_0x30b6('0x24')](saveUpdates(_0x3d7d30[_0x30b6('0x46')],null))[_0x30b6('0x24')](respondWithResult(_0x4322bb,null))['catch'](handleError(_0x4322bb,null));};exports[_0x30b6('0x25')]=function(_0x17a00f,_0x131316){return db[_0x30b6('0x2b')][_0x30b6('0x4b')]({'where':{'id':_0x17a00f[_0x30b6('0x41')]['id']}})[_0x30b6('0x24')](handleEntityNotFound(_0x131316,null))['then'](removeEntity(_0x131316,null))['catch'](handleError(_0x131316,null));}; \ No newline at end of file +var _0x6dd4=['CmContactHasItems','UserProfileResource','destroy','error','name','send','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmContactHasItem','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','get'];(function(_0x5d1114,_0x3c4b87){var _0x3783a0=function(_0x45fdf1){while(--_0x45fdf1){_0x5d1114['push'](_0x5d1114['shift']());}};_0x3783a0(++_0x3c4b87);}(_0x6dd4,0xcd));var _0x46dd=function(_0x53b48e,_0x3d1415){_0x53b48e=_0x53b48e-0x0;var _0x4902ff=_0x6dd4[_0x53b48e];return _0x4902ff;};'use strict';var emlformat=require(_0x46dd('0x0'));var rimraf=require(_0x46dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46dd('0x2'));var moment=require('moment');var BPromise=require(_0x46dd('0x3'));var Mustache=require('mustache');var util=require(_0x46dd('0x4'));var path=require(_0x46dd('0x5'));var sox=require('sox');var csv=require(_0x46dd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46dd('0x7'));var _=require(_0x46dd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x46dd('0x9'));var deskjs=require(_0x46dd('0xa'));var toCsv=require(_0x46dd('0x6'));var querystring=require(_0x46dd('0xb'));var Papa=require(_0x46dd('0xc'));var Redis=require('ioredis');var authService=require(_0x46dd('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x46dd('0xe'));var hardwareService=require(_0x46dd('0xf'));var logger=require(_0x46dd('0x10'))('api');var utils=require(_0x46dd('0x11'));var config=require(_0x46dd('0x12'));var licenseUtil=require(_0x46dd('0x13'));var db=require(_0x46dd('0x14'))['db'];function respondWithStatusCode(_0x4faf35,_0x110600){_0x110600=_0x110600||0xcc;return function(_0x1d4e20){if(_0x1d4e20){return _0x4faf35[_0x46dd('0x15')](_0x110600);}return _0x4faf35[_0x46dd('0x16')](_0x110600)[_0x46dd('0x17')]();};}function respondWithResult(_0x23e9c1,_0x2b443a){_0x2b443a=_0x2b443a||0xc8;return function(_0x128d4b){if(_0x128d4b){return _0x23e9c1[_0x46dd('0x16')](_0x2b443a)[_0x46dd('0x18')](_0x128d4b);}};}function respondWithFilteredResult(_0x53e5aa,_0x3582f2){return function(_0x4229bd){if(_0x4229bd){var _0x32890d=typeof _0x3582f2[_0x46dd('0x19')]===_0x46dd('0x1a')&&typeof _0x3582f2['limit']===_0x46dd('0x1a');var _0x4456f9=_0x4229bd['count'];var _0x386fb8=_0x32890d?0x0:_0x3582f2[_0x46dd('0x19')];var _0x25e104=_0x32890d?_0x4229bd[_0x46dd('0x1b')]:_0x3582f2[_0x46dd('0x19')]+_0x3582f2[_0x46dd('0x1c')];var _0x4f8ede;if(_0x25e104>=_0x4456f9){_0x25e104=_0x4456f9;_0x4f8ede=0xc8;}else{_0x4f8ede=0xce;}_0x53e5aa[_0x46dd('0x16')](_0x4f8ede);return _0x53e5aa[_0x46dd('0x1d')](_0x46dd('0x1e'),_0x386fb8+'-'+_0x25e104+'/'+_0x4456f9)[_0x46dd('0x18')](_0x4229bd);}return null;};}function patchUpdates(_0x5be445){return function(_0xba3061){try{jsonpatch['apply'](_0xba3061,_0x5be445,!![]);}catch(_0x415db1){return BPromise['reject'](_0x415db1);}return _0xba3061[_0x46dd('0x1f')]();};}function saveUpdates(_0x1152e6,_0xe2389a){return function(_0x1b6f9d){if(_0x1b6f9d){return _0x1b6f9d[_0x46dd('0x20')](_0x1152e6)[_0x46dd('0x21')](function(_0x1e6176){return _0x1e6176;});}return null;};}function removeEntity(_0x4b115b,_0x5c652b){return function(_0x3d2044){if(_0x3d2044){return _0x3d2044['destroy']()['then'](function(){var _0xa5f46=_0x3d2044[_0x46dd('0x22')]({'plain':!![]});var _0x317ec3=_0x46dd('0x23');return db[_0x46dd('0x24')][_0x46dd('0x25')]({'where':{'type':_0x317ec3,'resourceId':_0xa5f46['id']}})[_0x46dd('0x21')](function(){return _0x3d2044;});})[_0x46dd('0x21')](function(){_0x4b115b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3799e4,_0x1b6c6d){return function(_0x496112){if(!_0x496112){_0x3799e4['sendStatus'](0x194);}return _0x496112;};}function handleError(_0xfcb69b,_0x4b34bd){_0x4b34bd=_0x4b34bd||0x1f4;return function(_0x216f08){logger[_0x46dd('0x26')](_0x216f08['stack']);if(_0x216f08[_0x46dd('0x27')]){delete _0x216f08[_0x46dd('0x27')];}_0xfcb69b['status'](_0x4b34bd)[_0x46dd('0x28')](_0x216f08);};}exports['index']=function(_0x3de07b,_0x5cddbc){var _0x1aa370={},_0x46d6f5={},_0x1cd0af={'count':0x0,'rows':[]};var _0x49c69f=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x22eebf){return{'name':_0x22eebf[_0x46dd('0x29')],'type':_0x22eebf[_0x46dd('0x2a')][_0x46dd('0x2b')]};});_0x46d6f5[_0x46dd('0x2c')]=_[_0x46dd('0x2d')](_0x49c69f,_0x46dd('0x27'));_0x46d6f5['query']=_[_0x46dd('0x2e')](_0x3de07b[_0x46dd('0x2f')]);_0x46d6f5[_0x46dd('0x30')]=_[_0x46dd('0x31')](_0x46d6f5[_0x46dd('0x2c')],_0x46d6f5['query']);_0x1aa370[_0x46dd('0x32')]=_[_0x46dd('0x31')](_0x46d6f5[_0x46dd('0x2c')],qs['fields'](_0x3de07b[_0x46dd('0x2f')][_0x46dd('0x33')]));_0x1aa370[_0x46dd('0x32')]=_0x1aa370[_0x46dd('0x32')][_0x46dd('0x34')]?_0x1aa370[_0x46dd('0x32')]:_0x46d6f5[_0x46dd('0x2c')];if(!_0x3de07b[_0x46dd('0x2f')][_0x46dd('0x35')]('nolimit')){_0x1aa370['limit']=qs[_0x46dd('0x1c')](_0x3de07b['query'][_0x46dd('0x1c')]);_0x1aa370[_0x46dd('0x19')]=qs['offset'](_0x3de07b[_0x46dd('0x2f')]['offset']);}_0x1aa370[_0x46dd('0x36')]=qs[_0x46dd('0x37')](_0x3de07b[_0x46dd('0x2f')][_0x46dd('0x37')]);_0x1aa370[_0x46dd('0x38')]=qs['filters'](_[_0x46dd('0x39')](_0x3de07b[_0x46dd('0x2f')],_0x46d6f5[_0x46dd('0x30')]),_0x49c69f);if(_0x3de07b[_0x46dd('0x2f')][_0x46dd('0x3a')]){_0x1aa370['where']=_[_0x46dd('0x3b')](_0x1aa370[_0x46dd('0x38')],{'$or':_[_0x46dd('0x2d')](_0x49c69f,function(_0x6f01c9){if(_0x6f01c9[_0x46dd('0x2a')]!==_0x46dd('0x3c')){var _0x36c5b5={};_0x36c5b5[_0x6f01c9['name']]={'$like':'%'+_0x3de07b[_0x46dd('0x2f')]['filter']+'%'};return _0x36c5b5;}})});}_0x1aa370=_[_0x46dd('0x3b')]({},_0x1aa370,_0x3de07b[_0x46dd('0x3d')]);var _0x72868c={'where':_0x1aa370[_0x46dd('0x38')]};return db['CmContactHasItem'][_0x46dd('0x1b')](_0x72868c)[_0x46dd('0x21')](function(_0x473a17){_0x1cd0af['count']=_0x473a17;if(_0x3de07b[_0x46dd('0x2f')][_0x46dd('0x3e')]){_0x1aa370[_0x46dd('0x3f')]=[{'all':!![]}];}return db[_0x46dd('0x40')][_0x46dd('0x41')](_0x1aa370);})['then'](function(_0x26968c){_0x1cd0af[_0x46dd('0x42')]=_0x26968c;return _0x1cd0af;})['then'](respondWithFilteredResult(_0x5cddbc,_0x1aa370))[_0x46dd('0x43')](handleError(_0x5cddbc,null));};exports[_0x46dd('0x44')]=function(_0xeacc01,_0x3bc1c1){var _0x5296ef={'raw':!![],'where':{'id':_0xeacc01[_0x46dd('0x45')]['id']}},_0x4862f9={};_0x4862f9[_0x46dd('0x2c')]=_[_0x46dd('0x2e')](db[_0x46dd('0x40')][_0x46dd('0x46')]);_0x4862f9[_0x46dd('0x2f')]=_[_0x46dd('0x2e')](_0xeacc01[_0x46dd('0x2f')]);_0x4862f9[_0x46dd('0x30')]=_['intersection'](_0x4862f9[_0x46dd('0x2c')],_0x4862f9[_0x46dd('0x2f')]);_0x5296ef[_0x46dd('0x32')]=_['intersection'](_0x4862f9[_0x46dd('0x2c')],qs[_0x46dd('0x33')](_0xeacc01[_0x46dd('0x2f')][_0x46dd('0x33')]));_0x5296ef['attributes']=_0x5296ef['attributes'][_0x46dd('0x34')]?_0x5296ef['attributes']:_0x4862f9[_0x46dd('0x2c')];if(_0xeacc01[_0x46dd('0x2f')]['includeAll']){_0x5296ef['include']=[{'all':!![]}];}_0x5296ef=_[_0x46dd('0x3b')]({},_0x5296ef,_0xeacc01[_0x46dd('0x3d')]);return db[_0x46dd('0x40')][_0x46dd('0x47')](_0x5296ef)[_0x46dd('0x21')](handleEntityNotFound(_0x3bc1c1,null))['then'](respondWithResult(_0x3bc1c1,null))['catch'](handleError(_0x3bc1c1,null));};exports[_0x46dd('0x48')]=function(_0x15341a,_0x2f2b51){return db['CmContactHasItem'][_0x46dd('0x48')](_0x15341a[_0x46dd('0x49')],{})['then'](function(_0x2cca5d){var _0x5f12ce=_0x15341a[_0x46dd('0x4a')][_0x46dd('0x22')]({'plain':!![]});if(!_0x5f12ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f12ce[_0x46dd('0x4b')]===_0x46dd('0x4a')){var _0x1f2a8a=_0x2cca5d[_0x46dd('0x22')]({'plain':!![]});var _0xaa578d='CmContactHasItems';return db[_0x46dd('0x4c')][_0x46dd('0x47')]({'where':{'name':_0xaa578d,'userProfileId':_0x5f12ce[_0x46dd('0x4d')]},'raw':!![]})[_0x46dd('0x21')](function(_0x306c35){if(_0x306c35&&_0x306c35[_0x46dd('0x4e')]===0x0){return db[_0x46dd('0x24')][_0x46dd('0x48')]({'name':_0x1f2a8a[_0x46dd('0x27')],'resourceId':_0x1f2a8a['id'],'type':_0x306c35[_0x46dd('0x27')],'sectionId':_0x306c35['id']},{})[_0x46dd('0x21')](function(){return _0x2cca5d;});}else{return _0x2cca5d;}})[_0x46dd('0x43')](function(_0x15d90d){logger[_0x46dd('0x26')](_0x46dd('0x4f'),_0x15d90d);throw _0x15d90d;});}return _0x2cca5d;})['then'](respondWithResult(_0x2f2b51,0xc9))[_0x46dd('0x43')](handleError(_0x2f2b51,null));};exports['update']=function(_0x1b9e1f,_0x3313eb){if(_0x1b9e1f[_0x46dd('0x49')]['id']){delete _0x1b9e1f[_0x46dd('0x49')]['id'];}return db['CmContactHasItem'][_0x46dd('0x47')]({'where':{'id':_0x1b9e1f[_0x46dd('0x45')]['id']}})['then'](handleEntityNotFound(_0x3313eb,null))['then'](saveUpdates(_0x1b9e1f[_0x46dd('0x49')],null))[_0x46dd('0x21')](respondWithResult(_0x3313eb,null))[_0x46dd('0x43')](handleError(_0x3313eb,null));};exports[_0x46dd('0x25')]=function(_0x5ce9cd,_0x40f781){return db[_0x46dd('0x40')][_0x46dd('0x47')]({'where':{'id':_0x5ce9cd[_0x46dd('0x45')]['id']}})[_0x46dd('0x21')](handleEntityNotFound(_0x40f781,null))[_0x46dd('0x21')](removeEntity(_0x40f781,null))[_0x46dd('0x43')](handleError(_0x40f781,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e418c57..c0f87b4 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 _0x34be=['../../config/logger','bluebird','request-promise','path','exports','define','CmContactHasItem','lodash'];(function(_0x23def4,_0x52c2b5){var _0x62b53=function(_0x591e2b){while(--_0x591e2b){_0x23def4['push'](_0x23def4['shift']());}};_0x62b53(++_0x52c2b5);}(_0x34be,0x177));var _0xe34b=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x34be[_0x47e549];return _0x251374;};'use strict';var _=require(_0xe34b('0x0'));var util=require('util');var logger=require(_0xe34b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe34b('0x2'));var rp=require(_0xe34b('0x3'));var fs=require('fs');var path=require(_0xe34b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xe34b('0x5')]=function(_0x107414,_0x26ecdc){return _0x107414[_0xe34b('0x6')](_0xe34b('0x7'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45e6=['bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','cm_contact_has_items','util','api','moment'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x45e6,0x1d1));var _0x645e=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x45e6[_0x280f4a];return _0x1bb157;};'use strict';var _=require('lodash');var util=require(_0x645e('0x0'));var logger=require('../../config/logger')(_0x645e('0x1'));var moment=require(_0x645e('0x2'));var BPromise=require(_0x645e('0x3'));var rp=require(_0x645e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x645e('0x5'));var config=require(_0x645e('0x6'));var attributes=require(_0x645e('0x7'));module['exports']=function(_0x1f75c8,_0x278cd0){return _0x1f75c8['define']('CmContactHasItem',attributes,{'tableName':_0x645e('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 be6e6b5..1abd4ac 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 _0x7b46=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','error','code','CmContactHasItem,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1108c4,_0x2ac837){var _0x5831ae=function(_0x119ec2){while(--_0x119ec2){_0x1108c4['push'](_0x1108c4['shift']());}};_0x5831ae(++_0x2ac837);}(_0x7b46,0x1c6));var _0x67b4=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7b46[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x67b4('0x0'));var util=require(_0x67b4('0x1'));var moment=require(_0x67b4('0x2'));var BPromise=require(_0x67b4('0x3'));var rs=require(_0x67b4('0x4'));var fs=require('fs');var Redis=require(_0x67b4('0x5'));var db=require(_0x67b4('0x6'))['db'];var utils=require(_0x67b4('0x7'));var logger=require(_0x67b4('0x8'))(_0x67b4('0x9'));var config=require(_0x67b4('0xa'));var jayson=require(_0x67b4('0xb'));var client=jayson['client'][_0x67b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b1908,_0x2d9079,_0x5e3d36){return new BPromise(function(_0x16a2fd,_0x11891c){return client[_0x67b4('0xd')](_0x4b1908,_0x5e3d36)['then'](function(_0x14b375){logger[_0x67b4('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2d9079,_0x67b4('0xf'));logger[_0x67b4('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2d9079,_0x67b4('0xf'),JSON['stringify'](_0x14b375));if(_0x14b375[_0x67b4('0x11')]){if(_0x14b375['error'][_0x67b4('0x12')]===0x1f4){logger[_0x67b4('0x11')](_0x67b4('0x13'),_0x2d9079,_0x14b375[_0x67b4('0x11')][_0x67b4('0x14')]);return _0x11891c(_0x14b375[_0x67b4('0x11')]['message']);}logger[_0x67b4('0x11')](_0x67b4('0x13'),_0x2d9079,_0x14b375[_0x67b4('0x11')][_0x67b4('0x14')]);return _0x16a2fd(_0x14b375[_0x67b4('0x11')]['message']);}else{logger['info'](_0x67b4('0x13'),_0x2d9079,'request\x20sent');_0x16a2fd(_0x14b375['result'][_0x67b4('0x14')]);}})['catch'](function(_0x1cb9fa){logger[_0x67b4('0x11')](_0x67b4('0x13'),_0x2d9079,_0x1cb9fa);_0x11891c(_0x1cb9fa);});});} \ No newline at end of file +var _0xe7a9=['rpc','../../config/environment','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x51539c,_0x25f587){var _0x4f7914=function(_0x4c666e){while(--_0x4c666e){_0x51539c['push'](_0x51539c['shift']());}};_0x4f7914(++_0x25f587);}(_0xe7a9,0x19a));var _0x9e7a=function(_0xf5a834,_0x52c74c){_0xf5a834=_0xf5a834-0x0;var _0x1a9cc6=_0xe7a9[_0xf5a834];return _0x1a9cc6;};'use strict';var _=require(_0x9e7a('0x0'));var util=require(_0x9e7a('0x1'));var moment=require('moment');var BPromise=require(_0x9e7a('0x2'));var rs=require(_0x9e7a('0x3'));var fs=require('fs');var Redis=require(_0x9e7a('0x4'));var db=require(_0x9e7a('0x5'))['db'];var utils=require(_0x9e7a('0x6'));var logger=require(_0x9e7a('0x7'))(_0x9e7a('0x8'));var config=require(_0x9e7a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9e7a('0xa')][_0x9e7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30b972,_0x315916,_0x5826d0){return new BPromise(function(_0x3f668c,_0x225c6d){return client[_0x9e7a('0xc')](_0x30b972,_0x5826d0)['then'](function(_0x5a4936){logger[_0x9e7a('0xd')](_0x9e7a('0xe'),_0x315916,_0x9e7a('0xf'));logger[_0x9e7a('0x10')](_0x9e7a('0x11'),_0x315916,_0x9e7a('0xf'),JSON['stringify'](_0x5a4936));if(_0x5a4936[_0x9e7a('0x12')]){if(_0x5a4936['error'][_0x9e7a('0x13')]===0x1f4){logger[_0x9e7a('0x12')](_0x9e7a('0xe'),_0x315916,_0x5a4936['error'][_0x9e7a('0x14')]);return _0x225c6d(_0x5a4936[_0x9e7a('0x12')][_0x9e7a('0x14')]);}logger[_0x9e7a('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x315916,_0x5a4936[_0x9e7a('0x12')][_0x9e7a('0x14')]);return _0x3f668c(_0x5a4936[_0x9e7a('0x12')][_0x9e7a('0x14')]);}else{logger[_0x9e7a('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x315916,_0x9e7a('0xf'));_0x3f668c(_0x5a4936['result'][_0x9e7a('0x14')]);}})[_0x9e7a('0x15')](function(_0x2af2c9){logger[_0x9e7a('0x12')](_0x9e7a('0xe'),_0x315916,_0x2af2c9);_0x225c6d(_0x2af2c9);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index fb418cb..8dd779e 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 _0x1a20=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','update'];(function(_0x23f91e,_0x4eca56){var _0x4d0cb6=function(_0x413d19){while(--_0x413d19){_0x23f91e['push'](_0x23f91e['shift']());}};_0x4d0cb6(++_0x4eca56);}(_0x1a20,0x1d2));var _0x01a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1a20[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x01a2('0x0'));var path=require(_0x01a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x01a2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x01a2('0x3'));var interaction=require(_0x01a2('0x4'));var config=require(_0x01a2('0x5'));var controller=require(_0x01a2('0x6'));router[_0x01a2('0x7')]('/',auth[_0x01a2('0x8')](),controller[_0x01a2('0x9')]);router[_0x01a2('0x7')](_0x01a2('0xa'),auth[_0x01a2('0x8')](),controller[_0x01a2('0xb')]);router[_0x01a2('0xc')]('/',auth[_0x01a2('0x8')](),controller['create']);router['put']('/:id',auth[_0x01a2('0x8')](),controller[_0x01a2('0xd')]);router['delete'](_0x01a2('0xa'),auth[_0x01a2('0x8')](),controller['destroy']);module[_0x01a2('0xe')]=router; \ No newline at end of file +var _0xf4a0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xf4a0,0x1f2));var _0x0f4a=function(_0x2e75c7,_0x5d2ebe){_0x2e75c7=_0x2e75c7-0x0;var _0x4ec88b=_0xf4a0[_0x2e75c7];return _0x4ec88b;};'use strict';var multer=require(_0x0f4a('0x0'));var util=require(_0x0f4a('0x1'));var path=require(_0x0f4a('0x2'));var timeout=require(_0x0f4a('0x3'));var express=require(_0x0f4a('0x4'));var router=express[_0x0f4a('0x5')]();var fs_extra=require(_0x0f4a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0f4a('0x7'));var config=require(_0x0f4a('0x8'));var controller=require(_0x0f4a('0x9'));router['get']('/',auth[_0x0f4a('0xa')](),controller[_0x0f4a('0xb')]);router['get'](_0x0f4a('0xc'),auth[_0x0f4a('0xa')](),controller[_0x0f4a('0xd')]);router[_0x0f4a('0xe')]('/',auth['isAuthenticated'](),controller[_0x0f4a('0xf')]);router[_0x0f4a('0x10')]('/:id',auth[_0x0f4a('0xa')](),controller[_0x0f4a('0x11')]);router['delete'](_0x0f4a('0xc'),auth[_0x0f4a('0xa')](),controller[_0x0f4a('0x12')]);module[_0x0f4a('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5962e8d..81f9831 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 _0xfe5f=['type','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfe5f,0x19e));var _0xffe5=function(_0x4ed936,_0x53b8bf){_0x4ed936=_0x4ed936-0x0;var _0x3ce469=_0xfe5f[_0x4ed936];return _0x3ce469;};'use strict';var Sequelize=require(_0xffe5('0x0'));var _=require(_0xffe5('0x1'));module[_0xffe5('0x2')]={'name':{'type':Sequelize[_0xffe5('0x3')],'get':function(_0x18bc4c){return this[_0xffe5('0x4')](_0xffe5('0x5'));}},'alias':{'type':Sequelize[_0xffe5('0x6')],'allowNull':![],'set':function(_0x5688a1){this[_0xffe5('0x7')](_0xffe5('0x5'),_0x5688a1?_0x5688a1:this['getDataValue'](_0xffe5('0x8')));}},'type':{'type':Sequelize[_0xffe5('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xffe5('0x9')](_0xffe5('0xa')),'get':function(){if(this[_0xffe5('0x4')](_0xffe5('0xb'))==='select'){return JSON[_0xffe5('0xc')](this['getDataValue'](_0xffe5('0xd')));}else{return this[_0xffe5('0x4')](_0xffe5('0xd'));}},'set':function(_0x16c79b){if(Array[_0xffe5('0xe')](_0x16c79b)){this[_0xffe5('0x7')]('values',JSON[_0xffe5('0xf')](_0x16c79b));}else{this[_0xffe5('0x7')](_0xffe5('0xd'),_0x16c79b);}}},'required':{'type':Sequelize[_0xffe5('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xffe5('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x3c35=['stringify','BOOLEAN','voice','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','values','isArray'];(function(_0x4ff0dd,_0x5425a1){var _0x17c597=function(_0x5dcb02){while(--_0x5dcb02){_0x4ff0dd['push'](_0x4ff0dd['shift']());}};_0x17c597(++_0x5425a1);}(_0x3c35,0x17a));var _0x53c3=function(_0x4da245,_0x49edaf){_0x4da245=_0x4da245-0x0;var _0x1cb125=_0x3c35[_0x4da245];return _0x1cb125;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x53c3('0x0')]={'name':{'type':Sequelize[_0x53c3('0x1')],'get':function(_0x54cb65){return this[_0x53c3('0x2')](_0x53c3('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xe0a17b){this[_0x53c3('0x4')]('alias',_0xe0a17b?_0xe0a17b:this[_0x53c3('0x2')](_0x53c3('0x5')));}},'type':{'type':Sequelize[_0x53c3('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x53c3('0x7')](_0x53c3('0x8')),'get':function(){if(this['getDataValue'](_0x53c3('0x9'))==='select'){return JSON['parse'](this['getDataValue'](_0x53c3('0xa')));}else{return this[_0x53c3('0x2')]('values');}},'set':function(_0x276e2b){if(Array[_0x53c3('0xb')](_0x276e2b)){this[_0x53c3('0x4')]('values',JSON[_0x53c3('0xc')](_0x276e2b));}else{this[_0x53c3('0x4')](_0x53c3('0xa'),_0x276e2b);}}},'required':{'type':Sequelize[_0x53c3('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x53c3('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x53c3('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 68cd368..1634c6a 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 _0xf318=['to-csv','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','create','sequelize','transaction','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1f1921,_0x4c6841){var _0x5d6f8d=function(_0x47fc64){while(--_0x47fc64){_0x1f1921['push'](_0x1f1921['shift']());}};_0x5d6f8d(++_0x4c6841);}(_0xf318,0x155));var _0x8f31=function(_0x211b21,_0x511d07){_0x211b21=_0x211b21-0x0;var _0x45a067=_0xf318[_0x211b21];return _0x45a067;};'use strict';var emlformat=require(_0x8f31('0x0'));var rimraf=require(_0x8f31('0x1'));var zipdir=require(_0x8f31('0x2'));var jsonpatch=require(_0x8f31('0x3'));var rp=require(_0x8f31('0x4'));var moment=require(_0x8f31('0x5'));var BPromise=require(_0x8f31('0x6'));var Mustache=require(_0x8f31('0x7'));var util=require(_0x8f31('0x8'));var path=require(_0x8f31('0x9'));var sox=require(_0x8f31('0xa'));var csv=require(_0x8f31('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f31('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8f31('0xd'));var deskjs=require(_0x8f31('0xe'));var toCsv=require(_0x8f31('0xb'));var querystring=require(_0x8f31('0xf'));var Papa=require('papaparse');var Redis=require(_0x8f31('0x10'));var authService=require(_0x8f31('0x11'));var qs=require(_0x8f31('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f31('0x13'));var logger=require(_0x8f31('0x14'))(_0x8f31('0x15'));var utils=require('../../config/utils');var config=require(_0x8f31('0x16'));var licenseUtil=require(_0x8f31('0x17'));var db=require(_0x8f31('0x18'))['db'];function respondWithStatusCode(_0x599ff8,_0x1cc0c6){_0x1cc0c6=_0x1cc0c6||0xcc;return function(_0x267880){if(_0x267880){return _0x599ff8[_0x8f31('0x19')](_0x1cc0c6);}return _0x599ff8[_0x8f31('0x1a')](_0x1cc0c6)['end']();};}function respondWithResult(_0x5e816c,_0x4d26df){_0x4d26df=_0x4d26df||0xc8;return function(_0x3c35c4){if(_0x3c35c4){return _0x5e816c[_0x8f31('0x1a')](_0x4d26df)['json'](_0x3c35c4);}};}function respondWithFilteredResult(_0x55b8c3,_0x3efec6){return function(_0x3074d8){if(_0x3074d8){var _0x17a2d7=typeof _0x3efec6[_0x8f31('0x1b')]===_0x8f31('0x1c')&&typeof _0x3efec6[_0x8f31('0x1d')]===_0x8f31('0x1c');var _0x477378=_0x3074d8[_0x8f31('0x1e')];var _0x1198e3=_0x17a2d7?0x0:_0x3efec6[_0x8f31('0x1b')];var _0x47cae6=_0x17a2d7?_0x3074d8[_0x8f31('0x1e')]:_0x3efec6[_0x8f31('0x1b')]+_0x3efec6[_0x8f31('0x1d')];var _0x4f55f3;if(_0x47cae6>=_0x477378){_0x47cae6=_0x477378;_0x4f55f3=0xc8;}else{_0x4f55f3=0xce;}_0x55b8c3[_0x8f31('0x1a')](_0x4f55f3);return _0x55b8c3['set'](_0x8f31('0x1f'),_0x1198e3+'-'+_0x47cae6+'/'+_0x477378)[_0x8f31('0x20')](_0x3074d8);}return null;};}function patchUpdates(_0x34b17d){return function(_0xb8ed55){try{jsonpatch[_0x8f31('0x21')](_0xb8ed55,_0x34b17d,!![]);}catch(_0x58d149){return BPromise[_0x8f31('0x22')](_0x58d149);}return _0xb8ed55[_0x8f31('0x23')]();};}function saveUpdates(_0x3efabb,_0x50853f){return function(_0x1fa846){if(_0x1fa846){return _0x1fa846[_0x8f31('0x24')](_0x3efabb)[_0x8f31('0x25')](function(_0x766cc3){return _0x766cc3;});}return null;};}function removeEntity(_0x424574,_0x5089d1){return function(_0x5811c7){if(_0x5811c7){return _0x5811c7[_0x8f31('0x26')]()[_0x8f31('0x25')](function(){_0x424574[_0x8f31('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1694,_0xd1e4ac){return function(_0x3d8556){if(!_0x3d8556){_0x4d1694[_0x8f31('0x19')](0x194);}return _0x3d8556;};}function handleError(_0x496b67,_0x2e39da){_0x2e39da=_0x2e39da||0x1f4;return function(_0x5b87b8){logger[_0x8f31('0x27')](_0x5b87b8[_0x8f31('0x28')]);if(_0x5b87b8[_0x8f31('0x29')]){delete _0x5b87b8[_0x8f31('0x29')];}_0x496b67[_0x8f31('0x1a')](_0x2e39da)[_0x8f31('0x2a')](_0x5b87b8);};}exports[_0x8f31('0x2b')]=function(_0x5d7b39,_0x364d4c){var _0x1899fd={},_0x56a015={},_0x4170d7={'count':0x0,'rows':[]};var _0x330c1a=_[_0x8f31('0x2c')](db[_0x8f31('0x2d')][_0x8f31('0x2e')],function(_0x5b69c2){return{'name':_0x5b69c2[_0x8f31('0x2f')],'type':_0x5b69c2[_0x8f31('0x30')][_0x8f31('0x31')]};});_0x56a015[_0x8f31('0x32')]=_['differenceBy'](_[_0x8f31('0x2c')](_0x330c1a,_0x8f31('0x29')),['name']);_0x56a015['query']=_[_0x8f31('0x33')](_0x5d7b39[_0x8f31('0x34')]);_0x56a015[_0x8f31('0x35')]=_['intersection'](_0x56a015[_0x8f31('0x32')],_0x56a015['query']);_0x1899fd[_0x8f31('0x36')]=_[_0x8f31('0x37')](_0x56a015[_0x8f31('0x32')],qs['fields'](_0x5d7b39['query'][_0x8f31('0x38')]));_0x1899fd[_0x8f31('0x36')]=_0x1899fd[_0x8f31('0x36')][_0x8f31('0x39')]?_0x1899fd['attributes']:_0x56a015['model'];if(!_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x3a')](_0x8f31('0x3b'))){_0x1899fd[_0x8f31('0x1d')]=qs[_0x8f31('0x1d')](_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x1d')]);_0x1899fd[_0x8f31('0x1b')]=qs[_0x8f31('0x1b')](_0x5d7b39['query']['offset']);}_0x1899fd['order']=qs[_0x8f31('0x3c')](_0x5d7b39[_0x8f31('0x34')]['sort']);_0x1899fd[_0x8f31('0x3d')]=qs[_0x8f31('0x35')](_[_0x8f31('0x3e')](_0x5d7b39[_0x8f31('0x34')],_0x56a015[_0x8f31('0x35')]),_0x330c1a);if(_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x3f')]){_0x1899fd[_0x8f31('0x3d')]=_['merge'](_0x1899fd[_0x8f31('0x3d')],{'$or':_['map'](_0x330c1a,function(_0x11e2c0){if(_0x11e2c0['type']!==_0x8f31('0x40')){var _0xc8bee3={};_0xc8bee3[_0x11e2c0[_0x8f31('0x29')]]={'$like':'%'+_0x5d7b39['query'][_0x8f31('0x3f')]+'%'};return _0xc8bee3;}})});}_0x1899fd=_[_0x8f31('0x41')]({},_0x1899fd,_0x5d7b39[_0x8f31('0x42')]);var _0x3725b4={'where':_0x1899fd['where']};return db[_0x8f31('0x2d')][_0x8f31('0x1e')](_0x3725b4)[_0x8f31('0x25')](function(_0x16a1ae){_0x4170d7[_0x8f31('0x1e')]=_0x16a1ae;if(_0x5d7b39[_0x8f31('0x34')][_0x8f31('0x43')]){_0x1899fd['include']=[{'all':!![]}];}return db['CmCustomField'][_0x8f31('0x44')](_0x1899fd);})[_0x8f31('0x25')](function(_0xab3d13){_0x4170d7[_0x8f31('0x45')]=_0xab3d13;return _0x4170d7;})[_0x8f31('0x25')](respondWithFilteredResult(_0x364d4c,_0x1899fd))[_0x8f31('0x46')](handleError(_0x364d4c,null));};exports[_0x8f31('0x47')]=function(_0xe765c1,_0x2056ce){var _0x4bb0b3={'raw':!![],'where':{'id':_0xe765c1[_0x8f31('0x48')]['id']}},_0x53129f={};_0x53129f[_0x8f31('0x32')]=_[_0x8f31('0x33')](db['CmCustomField']['rawAttributes']);_0x53129f[_0x8f31('0x34')]=_[_0x8f31('0x33')](_0xe765c1['query']);_0x53129f[_0x8f31('0x35')]=_['intersection'](_0x53129f[_0x8f31('0x32')],_0x53129f['query']);_0x4bb0b3[_0x8f31('0x36')]=_[_0x8f31('0x37')](_0x53129f[_0x8f31('0x32')],qs[_0x8f31('0x38')](_0xe765c1[_0x8f31('0x34')][_0x8f31('0x38')]));_0x4bb0b3[_0x8f31('0x36')]=_0x4bb0b3[_0x8f31('0x36')]['length']?_0x4bb0b3[_0x8f31('0x36')]:_0x53129f[_0x8f31('0x32')];if(_0xe765c1['query']['includeAll']){_0x4bb0b3[_0x8f31('0x49')]=[{'all':!![]}];}_0x4bb0b3=_['merge']({},_0x4bb0b3,_0xe765c1[_0x8f31('0x42')]);return db[_0x8f31('0x2d')][_0x8f31('0x4a')](_0x4bb0b3)[_0x8f31('0x25')](handleEntityNotFound(_0x2056ce,null))['then'](respondWithResult(_0x2056ce,null))['catch'](handleError(_0x2056ce,null));};exports[_0x8f31('0x24')]=function(_0x2c2ed5,_0x1ed263){if(_0x2c2ed5[_0x8f31('0x4b')]['id']){delete _0x2c2ed5[_0x8f31('0x4b')]['id'];}return db[_0x8f31('0x2d')][_0x8f31('0x4a')]({'where':{'id':_0x2c2ed5[_0x8f31('0x48')]['id']}})[_0x8f31('0x25')](handleEntityNotFound(_0x1ed263,null))[_0x8f31('0x25')](saveUpdates(_0x2c2ed5[_0x8f31('0x4b')],null))[_0x8f31('0x25')](respondWithResult(_0x1ed263,null))[_0x8f31('0x46')](handleError(_0x1ed263,null));};exports[_0x8f31('0x26')]=function(_0x184d9b,_0x2eed3c){return db[_0x8f31('0x2d')][_0x8f31('0x4a')]({'where':{'id':_0x184d9b[_0x8f31('0x48')]['id']}})[_0x8f31('0x25')](handleEntityNotFound(_0x2eed3c,null))['then'](removeEntity(_0x2eed3c,null))['catch'](handleError(_0x2eed3c,null));};exports[_0x8f31('0x4c')]=function(_0x47937f,_0x1442b6){var _0x3909ea;return db[_0x8f31('0x4d')][_0x8f31('0x4e')](function(_0x5e77c7){return db[_0x8f31('0x2d')][_0x8f31('0x4c')](_0x47937f['body'],{'transaction':_0x5e77c7})[_0x8f31('0x25')](function(_0x5a2e31){_0x3909ea=_0x5a2e31;var _0x492926={'type':db[_0x8f31('0x4f')]['TEXT'],'transaction':_0x5e77c7};switch(_0x47937f[_0x8f31('0x4b')]['type']){case'text':_0x492926['type']=db[_0x8f31('0x4f')][_0x8f31('0x50')];break;case _0x8f31('0x51'):_0x492926[_0x8f31('0x30')]=db[_0x8f31('0x4f')]['INTEGER'];break;case _0x8f31('0x52'):_0x492926[_0x8f31('0x30')]=db['Sequelize'][_0x8f31('0x53')];_0x492926[_0x8f31('0x54')]=![];break;default:}return db[_0x8f31('0x4d')][_0x8f31('0x55')]['addColumn'](_0x8f31('0x56'),util[_0x8f31('0x57')]('cf_%d',_0x3909ea['id']),_0x492926);})['then'](function(){return _0x3909ea;});})[_0x8f31('0x25')](respondWithResult(_0x1442b6,0xc9))[_0x8f31('0x46')](handleError(_0x1442b6,null));}; \ No newline at end of file +var _0x8b95=['create','sequelize','TEXT','Sequelize','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','include','body'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8b95,0x114));var _0x58b9=function(_0x4bdc26,_0x47bd16){_0x4bdc26=_0x4bdc26-0x0;var _0x3a0b72=_0x8b95[_0x4bdc26];return _0x3a0b72;};'use strict';var emlformat=require(_0x58b9('0x0'));var rimraf=require(_0x58b9('0x1'));var zipdir=require(_0x58b9('0x2'));var jsonpatch=require(_0x58b9('0x3'));var rp=require(_0x58b9('0x4'));var moment=require(_0x58b9('0x5'));var BPromise=require(_0x58b9('0x6'));var Mustache=require(_0x58b9('0x7'));var util=require(_0x58b9('0x8'));var path=require(_0x58b9('0x9'));var sox=require(_0x58b9('0xa'));var csv=require(_0x58b9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58b9('0xc'));var _=require(_0x58b9('0xd'));var squel=require('squel');var crypto=require(_0x58b9('0xe'));var jsforce=require(_0x58b9('0xf'));var deskjs=require(_0x58b9('0x10'));var toCsv=require(_0x58b9('0xb'));var querystring=require(_0x58b9('0x11'));var Papa=require('papaparse');var Redis=require(_0x58b9('0x12'));var authService=require(_0x58b9('0x13'));var qs=require(_0x58b9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58b9('0x15'));var logger=require(_0x58b9('0x16'))(_0x58b9('0x17'));var utils=require(_0x58b9('0x18'));var config=require(_0x58b9('0x19'));var licenseUtil=require(_0x58b9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c8169,_0x45130c){_0x45130c=_0x45130c||0xcc;return function(_0x74c238){if(_0x74c238){return _0x5c8169['sendStatus'](_0x45130c);}return _0x5c8169[_0x58b9('0x1b')](_0x45130c)[_0x58b9('0x1c')]();};}function respondWithResult(_0x4b3c5f,_0xc871fb){_0xc871fb=_0xc871fb||0xc8;return function(_0x16b1e8){if(_0x16b1e8){return _0x4b3c5f[_0x58b9('0x1b')](_0xc871fb)[_0x58b9('0x1d')](_0x16b1e8);}};}function respondWithFilteredResult(_0x200ef1,_0x4f9264){return function(_0x3cb5fe){if(_0x3cb5fe){var _0x9dac24=typeof _0x4f9264['offset']===_0x58b9('0x1e')&&typeof _0x4f9264[_0x58b9('0x1f')]==='undefined';var _0x5f20d0=_0x3cb5fe['count'];var _0xaeef0d=_0x9dac24?0x0:_0x4f9264['offset'];var _0x58cbf1=_0x9dac24?_0x3cb5fe[_0x58b9('0x20')]:_0x4f9264['offset']+_0x4f9264[_0x58b9('0x1f')];var _0xbf512f;if(_0x58cbf1>=_0x5f20d0){_0x58cbf1=_0x5f20d0;_0xbf512f=0xc8;}else{_0xbf512f=0xce;}_0x200ef1[_0x58b9('0x1b')](_0xbf512f);return _0x200ef1['set'](_0x58b9('0x21'),_0xaeef0d+'-'+_0x58cbf1+'/'+_0x5f20d0)['json'](_0x3cb5fe);}return null;};}function patchUpdates(_0x4206c9){return function(_0x3a8b73){try{jsonpatch[_0x58b9('0x22')](_0x3a8b73,_0x4206c9,!![]);}catch(_0x2f3aa1){return BPromise['reject'](_0x2f3aa1);}return _0x3a8b73[_0x58b9('0x23')]();};}function saveUpdates(_0x4965d6,_0x520802){return function(_0x107544){if(_0x107544){return _0x107544[_0x58b9('0x24')](_0x4965d6)['then'](function(_0x2f812d){return _0x2f812d;});}return null;};}function removeEntity(_0x1e0807,_0x1631bd){return function(_0x2d8011){if(_0x2d8011){return _0x2d8011[_0x58b9('0x25')]()['then'](function(){_0x1e0807['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x161f9b,_0x352357){return function(_0x2a0662){if(!_0x2a0662){_0x161f9b[_0x58b9('0x26')](0x194);}return _0x2a0662;};}function handleError(_0x2d3969,_0x2aaae4){_0x2aaae4=_0x2aaae4||0x1f4;return function(_0x2e78ab){logger[_0x58b9('0x27')](_0x2e78ab[_0x58b9('0x28')]);if(_0x2e78ab[_0x58b9('0x29')]){delete _0x2e78ab[_0x58b9('0x29')];}_0x2d3969[_0x58b9('0x1b')](_0x2aaae4)[_0x58b9('0x2a')](_0x2e78ab);};}exports[_0x58b9('0x2b')]=function(_0x348061,_0x2b5da0){var _0x43311c={},_0x388e9e={},_0x2c9d07={'count':0x0,'rows':[]};var _0x304b49=_[_0x58b9('0x2c')](db[_0x58b9('0x2d')]['rawAttributes'],function(_0x547b4d){return{'name':_0x547b4d[_0x58b9('0x2e')],'type':_0x547b4d[_0x58b9('0x2f')][_0x58b9('0x30')]};});_0x388e9e['model']=_[_0x58b9('0x31')](_[_0x58b9('0x2c')](_0x304b49,_0x58b9('0x29')),['name']);_0x388e9e[_0x58b9('0x32')]=_[_0x58b9('0x33')](_0x348061['query']);_0x388e9e[_0x58b9('0x34')]=_[_0x58b9('0x35')](_0x388e9e[_0x58b9('0x36')],_0x388e9e['query']);_0x43311c[_0x58b9('0x37')]=_['intersection'](_0x388e9e[_0x58b9('0x36')],qs[_0x58b9('0x38')](_0x348061[_0x58b9('0x32')][_0x58b9('0x38')]));_0x43311c[_0x58b9('0x37')]=_0x43311c['attributes'][_0x58b9('0x39')]?_0x43311c[_0x58b9('0x37')]:_0x388e9e[_0x58b9('0x36')];if(!_0x348061[_0x58b9('0x32')][_0x58b9('0x3a')](_0x58b9('0x3b'))){_0x43311c[_0x58b9('0x1f')]=qs['limit'](_0x348061[_0x58b9('0x32')][_0x58b9('0x1f')]);_0x43311c[_0x58b9('0x3c')]=qs[_0x58b9('0x3c')](_0x348061[_0x58b9('0x32')][_0x58b9('0x3c')]);}_0x43311c[_0x58b9('0x3d')]=qs['sort'](_0x348061[_0x58b9('0x32')][_0x58b9('0x3e')]);_0x43311c[_0x58b9('0x3f')]=qs[_0x58b9('0x34')](_[_0x58b9('0x40')](_0x348061[_0x58b9('0x32')],_0x388e9e[_0x58b9('0x34')]),_0x304b49);if(_0x348061[_0x58b9('0x32')][_0x58b9('0x41')]){_0x43311c['where']=_['merge'](_0x43311c[_0x58b9('0x3f')],{'$or':_[_0x58b9('0x2c')](_0x304b49,function(_0x522348){if(_0x522348[_0x58b9('0x2f')]!==_0x58b9('0x42')){var _0x4da4d1={};_0x4da4d1[_0x522348[_0x58b9('0x29')]]={'$like':'%'+_0x348061['query'][_0x58b9('0x41')]+'%'};return _0x4da4d1;}})});}_0x43311c=_[_0x58b9('0x43')]({},_0x43311c,_0x348061[_0x58b9('0x44')]);var _0xcad948={'where':_0x43311c[_0x58b9('0x3f')]};return db[_0x58b9('0x2d')][_0x58b9('0x20')](_0xcad948)[_0x58b9('0x45')](function(_0x23097c){_0x2c9d07[_0x58b9('0x20')]=_0x23097c;if(_0x348061[_0x58b9('0x32')][_0x58b9('0x46')]){_0x43311c['include']=[{'all':!![]}];}return db['CmCustomField'][_0x58b9('0x47')](_0x43311c);})[_0x58b9('0x45')](function(_0x37f86a){_0x2c9d07[_0x58b9('0x48')]=_0x37f86a;return _0x2c9d07;})[_0x58b9('0x45')](respondWithFilteredResult(_0x2b5da0,_0x43311c))[_0x58b9('0x49')](handleError(_0x2b5da0,null));};exports['show']=function(_0xa618c9,_0x13c4ec){var _0x2df591={'raw':!![],'where':{'id':_0xa618c9['params']['id']}},_0x36bf9d={};_0x36bf9d['model']=_[_0x58b9('0x33')](db['CmCustomField']['rawAttributes']);_0x36bf9d[_0x58b9('0x32')]=_[_0x58b9('0x33')](_0xa618c9['query']);_0x36bf9d[_0x58b9('0x34')]=_[_0x58b9('0x35')](_0x36bf9d[_0x58b9('0x36')],_0x36bf9d[_0x58b9('0x32')]);_0x2df591[_0x58b9('0x37')]=_[_0x58b9('0x35')](_0x36bf9d[_0x58b9('0x36')],qs[_0x58b9('0x38')](_0xa618c9[_0x58b9('0x32')][_0x58b9('0x38')]));_0x2df591[_0x58b9('0x37')]=_0x2df591['attributes'][_0x58b9('0x39')]?_0x2df591[_0x58b9('0x37')]:_0x36bf9d[_0x58b9('0x36')];if(_0xa618c9[_0x58b9('0x32')][_0x58b9('0x46')]){_0x2df591[_0x58b9('0x4a')]=[{'all':!![]}];}_0x2df591=_[_0x58b9('0x43')]({},_0x2df591,_0xa618c9[_0x58b9('0x44')]);return db['CmCustomField']['find'](_0x2df591)[_0x58b9('0x45')](handleEntityNotFound(_0x13c4ec,null))[_0x58b9('0x45')](respondWithResult(_0x13c4ec,null))[_0x58b9('0x49')](handleError(_0x13c4ec,null));};exports[_0x58b9('0x24')]=function(_0x1bfa4b,_0x49bb3c){if(_0x1bfa4b[_0x58b9('0x4b')]['id']){delete _0x1bfa4b[_0x58b9('0x4b')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x1bfa4b['params']['id']}})[_0x58b9('0x45')](handleEntityNotFound(_0x49bb3c,null))[_0x58b9('0x45')](saveUpdates(_0x1bfa4b[_0x58b9('0x4b')],null))[_0x58b9('0x45')](respondWithResult(_0x49bb3c,null))['catch'](handleError(_0x49bb3c,null));};exports[_0x58b9('0x25')]=function(_0x998b04,_0x2a4301){return db[_0x58b9('0x2d')]['find']({'where':{'id':_0x998b04['params']['id']}})[_0x58b9('0x45')](handleEntityNotFound(_0x2a4301,null))['then'](removeEntity(_0x2a4301,null))[_0x58b9('0x49')](handleError(_0x2a4301,null));};exports[_0x58b9('0x4c')]=function(_0x4e9fca,_0x4fa181){var _0x166290;return db[_0x58b9('0x4d')]['transaction'](function(_0x5a143b){return db['CmCustomField'][_0x58b9('0x4c')](_0x4e9fca[_0x58b9('0x4b')],{'transaction':_0x5a143b})['then'](function(_0x42934c){_0x166290=_0x42934c;var _0x42059b={'type':db['Sequelize'][_0x58b9('0x4e')],'transaction':_0x5a143b};switch(_0x4e9fca[_0x58b9('0x4b')][_0x58b9('0x2f')]){case'text':_0x42059b['type']=db[_0x58b9('0x4f')]['TEXT'];break;case'number':_0x42059b[_0x58b9('0x2f')]=db[_0x58b9('0x4f')]['INTEGER'];break;case _0x58b9('0x50'):_0x42059b['type']=db['Sequelize'][_0x58b9('0x51')];_0x42059b[_0x58b9('0x52')]=![];break;default:}return db[_0x58b9('0x4d')][_0x58b9('0x53')][_0x58b9('0x54')](_0x58b9('0x55'),util[_0x58b9('0x56')](_0x58b9('0x57'),_0x166290['id']),_0x42059b);})[_0x58b9('0x45')](function(){return _0x166290;});})[_0x58b9('0x45')](respondWithResult(_0x4fa181,0xc9))[_0x58b9('0x49')](handleError(_0x4fa181,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fb0504e..2aaef22 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 _0x820e=['../../config/environment','./cmCustomField.attributes','define','CmCustomField','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x820e,0x180));var _0xe820=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x820e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe820('0x0'));var moment=require(_0xe820('0x1'));var BPromise=require(_0xe820('0x2'));var rp=require(_0xe820('0x3'));var fs=require('fs');var path=require(_0xe820('0x4'));var rimraf=require(_0xe820('0x5'));var config=require(_0xe820('0x6'));var attributes=require(_0xe820('0x7'));module['exports']=function(_0x15360c,_0x32a3e6){return _0x15360c[_0xe820('0x8')](_0xe820('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcbb=['path','../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xdcbb,0x92));var _0xbdcb=function(_0x265229,_0x18282d){_0x265229=_0x265229-0x0;var _0x40fa48=_0xdcbb[_0x265229];return _0x40fa48;};'use strict';var _=require(_0xbdcb('0x0'));var util=require(_0xbdcb('0x1'));var logger=require(_0xbdcb('0x2'))(_0xbdcb('0x3'));var moment=require(_0xbdcb('0x4'));var BPromise=require(_0xbdcb('0x5'));var rp=require(_0xbdcb('0x6'));var fs=require('fs');var path=require(_0xbdcb('0x7'));var rimraf=require('rimraf');var config=require(_0xbdcb('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x14a2d0,_0x187a7e){return _0x14a2d0['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 1a24de4..feb18be 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 _0x1848=['../../config/environment','client','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','CmCustomField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19717d,_0x54123a){var _0x51234f=function(_0x266eb0){while(--_0x266eb0){_0x19717d['push'](_0x19717d['shift']());}};_0x51234f(++_0x54123a);}(_0x1848,0x147));var _0x8184=function(_0x1544b6,_0x599d4e){_0x1544b6=_0x1544b6-0x0;var _0x53c273=_0x1848[_0x1544b6];return _0x53c273;};'use strict';var _=require(_0x8184('0x0'));var util=require(_0x8184('0x1'));var moment=require('moment');var BPromise=require(_0x8184('0x2'));var rs=require(_0x8184('0x3'));var fs=require('fs');var Redis=require(_0x8184('0x4'));var db=require(_0x8184('0x5'))['db'];var utils=require(_0x8184('0x6'));var logger=require(_0x8184('0x7'))(_0x8184('0x8'));var config=require(_0x8184('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8184('0xa')][_0x8184('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1970db,_0x205001,_0x2ecad6){return new BPromise(function(_0x3405af,_0x4968ea){return client['request'](_0x1970db,_0x2ecad6)[_0x8184('0xc')](function(_0x25a6ee){logger[_0x8184('0xd')]('CmCustomField,\x20%s,\x20%s',_0x205001,_0x8184('0xe'));logger[_0x8184('0xf')](_0x8184('0x10'),_0x205001,_0x8184('0xe'),JSON['stringify'](_0x25a6ee));if(_0x25a6ee['error']){if(_0x25a6ee[_0x8184('0x11')]['code']===0x1f4){logger[_0x8184('0x11')](_0x8184('0x12'),_0x205001,_0x25a6ee[_0x8184('0x11')][_0x8184('0x13')]);return _0x4968ea(_0x25a6ee['error']['message']);}logger['error'](_0x8184('0x12'),_0x205001,_0x25a6ee['error'][_0x8184('0x13')]);return _0x3405af(_0x25a6ee[_0x8184('0x11')][_0x8184('0x13')]);}else{logger[_0x8184('0xd')](_0x8184('0x12'),_0x205001,_0x8184('0xe'));_0x3405af(_0x25a6ee['result'][_0x8184('0x13')]);}})[_0x8184('0x14')](function(_0x16c2ff){logger[_0x8184('0x11')](_0x8184('0x12'),_0x205001,_0x16c2ff);_0x4968ea(_0x16c2ff);});});} \ No newline at end of file +var _0x8451=['CmCustomField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24491e,_0x14aff2){var _0x405570=function(_0xa02171){while(--_0xa02171){_0x24491e['push'](_0x24491e['shift']());}};_0x405570(++_0x14aff2);}(_0x8451,0x100));var _0x1845=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8451[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x1845('0x0'));var util=require(_0x1845('0x1'));var moment=require(_0x1845('0x2'));var BPromise=require('bluebird');var rs=require(_0x1845('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1845('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1845('0x5'))('rpc');var config=require(_0x1845('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1845('0x7')][_0x1845('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dfd85,_0x4d4d63,_0xcd566f){return new BPromise(function(_0x120bec,_0x554c9f){return client[_0x1845('0x9')](_0x3dfd85,_0xcd566f)['then'](function(_0x451163){logger[_0x1845('0xa')](_0x1845('0xb'),_0x4d4d63,_0x1845('0xc'));logger[_0x1845('0xd')](_0x1845('0xe'),_0x4d4d63,_0x1845('0xc'),JSON['stringify'](_0x451163));if(_0x451163['error']){if(_0x451163[_0x1845('0xf')]['code']===0x1f4){logger[_0x1845('0xf')](_0x1845('0xb'),_0x4d4d63,_0x451163[_0x1845('0xf')][_0x1845('0x10')]);return _0x554c9f(_0x451163[_0x1845('0xf')][_0x1845('0x10')]);}logger[_0x1845('0xf')](_0x1845('0xb'),_0x4d4d63,_0x451163[_0x1845('0xf')][_0x1845('0x10')]);return _0x120bec(_0x451163[_0x1845('0xf')][_0x1845('0x10')]);}else{logger['info'](_0x1845('0xb'),_0x4d4d63,'request\x20sent');_0x120bec(_0x451163[_0x1845('0x11')][_0x1845('0x10')]);}})['catch'](function(_0x521ca3){logger[_0x1845('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4d4d63,_0x521ca3);_0x554c9f(_0x521ca3);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2d1e699..67af102 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 _0xd90b=['delete','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x502428,_0x347712){var _0x1081f7=function(_0x29303){while(--_0x29303){_0x502428['push'](_0x502428['shift']());}};_0x1081f7(++_0x347712);}(_0xd90b,0xbd));var _0xbd90=function(_0x2a4da7,_0x59fd72){_0x2a4da7=_0x2a4da7-0x0;var _0x5ae44c=_0xd90b[_0x2a4da7];return _0x5ae44c;};'use strict';var multer=require(_0xbd90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd90('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd90('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x3'));var config=require(_0xbd90('0x4'));var controller=require(_0xbd90('0x5'));router[_0xbd90('0x6')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0x8')]);router['get'](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xa')]);router[_0xbd90('0xb')]('/',auth[_0xbd90('0x7')](),controller[_0xbd90('0xc')]);router[_0xbd90('0xd')](_0xbd90('0x9'),auth[_0xbd90('0x7')](),controller[_0xbd90('0xe')]);router[_0xbd90('0xf')]('/:id',auth[_0xbd90('0x7')](),controller[_0xbd90('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbfe8=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x4e1bd3,_0xda464d){var _0x234e83=function(_0x144f4d){while(--_0x144f4d){_0x4e1bd3['push'](_0x4e1bd3['shift']());}};_0x234e83(++_0xda464d);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x212c79,_0x53f2b1){_0x212c79=_0x212c79-0x0;var _0x5954a6=_0xbfe8[_0x212c79];return _0x5954a6;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bfe('0x3'));var interaction=require(_0x8bfe('0x4'));var config=require('../../config/environment');var controller=require(_0x8bfe('0x5'));router[_0x8bfe('0x6')]('/',auth[_0x8bfe('0x7')](),controller['index']);router[_0x8bfe('0x6')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0xa')]('/',auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0xc')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 93564a2..ffc61ea 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 _0x03ed=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','BOOLEAN','DATE','format'];(function(_0x451bfc,_0x13d3eb){var _0x317b49=function(_0x30ab83){while(--_0x30ab83){_0x451bfc['push'](_0x451bfc['shift']());}};_0x317b49(++_0x13d3eb);}(_0x03ed,0x1c6));var _0xd03e=function(_0x52a1ef,_0x21e7c9){_0x52a1ef=_0x52a1ef-0x0;var _0x5ab751=_0x03ed[_0x52a1ef];return _0x5ab751;};'use strict';var moment=require(_0xd03e('0x0'));var Sequelize=require(_0xd03e('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xd03e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd03e('0x3')],'defaultValue':moment()[_0xd03e('0x4')](_0xd03e('0x5'))},'countbusyretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd03e('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd03e('0x3')]},'priority':{'type':Sequelize[_0xd03e('0x6')](0x2)[_0xd03e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd03e('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd03e('0x6')],'unique':_0xd03e('0x8')},'ListId':{'type':Sequelize[_0xd03e('0x6')],'unique':_0xd03e('0x8')},'UserId':{'type':Sequelize[_0xd03e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xd03e('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xd03e('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd03e('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd03e('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xd03e('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa5a6=['INTEGER','contactListQueue','moment','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x28f173,_0x4bbb3f){var _0x4e267d=function(_0x4ee832){while(--_0x4ee832){_0x28f173['push'](_0x28f173['shift']());}};_0x4e267d(++_0x4bbb3f);}(_0xa5a6,0x6b));var _0x6a5a=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xa5a6[_0x53b199];return _0x1ba42d;};'use strict';var moment=require(_0x6a5a('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x6a5a('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x6a5a('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6a5a('0x3')],'defaultValue':moment()['format'](_0x6a5a('0x4'))},'countbusyretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6a5a('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6a5a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6a5a('0x3')]},'priority':{'type':Sequelize[_0x6a5a('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6a5a('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6a5a('0x5')],'unique':_0x6a5a('0x6')},'ListId':{'type':Sequelize[_0x6a5a('0x5')],'unique':_0x6a5a('0x6')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x6a5a('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6a5a('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6a5a('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6a5a('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6a5a('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index bc8254d..f6eed7f 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 _0x06f4=['CmHopperFinal','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','LOCK','CmCompany','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','index','map','CmHopper','fieldName','key','query','intersection','model','concat','$and','$or','$gt','$gte','$lt','$eq','$between','$notBetween','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally'];(function(_0x171f56,_0x5cc378){var _0x54ad98=function(_0x5663e0){while(--_0x5663e0){_0x171f56['push'](_0x171f56['shift']());}};_0x54ad98(++_0x5cc378);}(_0x06f4,0x136));var _0x406f=function(_0x31c6c6,_0x31b802){_0x31c6c6=_0x31c6c6-0x0;var _0x22c13e=_0x06f4[_0x31c6c6];return _0x22c13e;};'use strict';var moment=require(_0x406f('0x0'));var _=require(_0x406f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x406f('0x2'))(_0x406f('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3a4ff0,_0x5ed32f){_0x5ed32f=_0x5ed32f||0xc8;return function(_0x32abfd){if(_0x32abfd){return _0x3a4ff0[_0x406f('0x4')](_0x5ed32f)[_0x406f('0x5')](_0x32abfd);}};}function respondWithFilteredResult(_0x32b2bd,_0x59821c){return function(_0x1d2886){if(_0x1d2886){var _0x5bec4f=typeof _0x59821c[_0x406f('0x6')]===_0x406f('0x7')&&typeof _0x59821c[_0x406f('0x8')]==='undefined';var _0x407936=_0x1d2886['count'];var _0x5b46bf=_0x5bec4f?0x0:_0x59821c[_0x406f('0x6')];var _0x56edc2=_0x5bec4f?_0x1d2886[_0x406f('0x9')]:_0x59821c['offset']+_0x59821c[_0x406f('0x8')];var _0x5af7cd;if(_0x56edc2>=_0x407936){_0x56edc2=_0x407936;_0x5af7cd=0xc8;}else{_0x5af7cd=0xce;}_0x32b2bd[_0x406f('0x4')](_0x5af7cd);return _0x32b2bd[_0x406f('0xa')]('Content-Range',_0x5b46bf+'-'+_0x56edc2+'/'+_0x407936)[_0x406f('0x5')](_0x1d2886);}return null;};}function saveUpdates(_0x380382,_0x451592){return function(_0x163de4){if(_0x163de4){return _0x163de4[_0x406f('0xb')](_0x380382)[_0x406f('0xc')](function(_0x29aef9){return _0x29aef9;});}return null;};}function handleEntityNotFound(_0xcc1d6,_0x4522b2){return function(_0x5045e8){if(!_0x5045e8){_0xcc1d6[_0x406f('0xd')](0x194);}return _0x5045e8;};}function handleError(_0x489445,_0x1bf795){_0x1bf795=_0x1bf795||0x1f4;return function(_0x28fda6){logger[_0x406f('0xe')](_0x28fda6['stack']);if(_0x28fda6[_0x406f('0xf')]){delete _0x28fda6[_0x406f('0xf')];}_0x489445['status'](_0x1bf795)['send'](_0x28fda6);};}exports[_0x406f('0x10')]=function(_0x4357e3,_0x509bae){var _0x2e4409={},_0x57d93a={},_0xe186fb={'count':0x0,'rows':[]};var _0x3ad3fe=_[_0x406f('0x11')](db[_0x406f('0x12')]['rawAttributes'],function(_0x492c68){return{'name':_0x492c68[_0x406f('0x13')],'type':_0x492c68['type'][_0x406f('0x14')]};});_0x57d93a['model']=_[_0x406f('0x11')](_0x3ad3fe,_0x406f('0xf'));_0x57d93a[_0x406f('0x15')]=_['keys'](_0x4357e3['query']);_0x57d93a['filters']=_[_0x406f('0x16')](_0x57d93a[_0x406f('0x17')],_0x57d93a[_0x406f('0x15')]);_0x57d93a['filters']=_[_0x406f('0x18')](_0x57d93a['filters'],[_0x406f('0x19'),_0x406f('0x1a'),_0x406f('0x1b'),_0x406f('0x1c'),_0x406f('0x1d'),'$lte','$ne',_0x406f('0x1e'),'$not',_0x406f('0x1f'),_0x406f('0x20'),'$in','$notIn',_0x406f('0x21'),'$notLike',_0x406f('0x22'),_0x406f('0x23'),_0x406f('0x21'),_0x406f('0x24'),_0x406f('0x25'),_0x406f('0x26'),_0x406f('0x27')]);_0x2e4409[_0x406f('0x28')]=_['intersection'](_0x57d93a['model'],qs[_0x406f('0x29')](_0x4357e3[_0x406f('0x15')][_0x406f('0x29')]));_0x2e4409[_0x406f('0x28')]=_0x2e4409['attributes']['length']?_0x2e4409[_0x406f('0x28')]:_0x57d93a[_0x406f('0x17')];if(!_0x4357e3['query']['hasOwnProperty'](_0x406f('0x2a'))){_0x2e4409[_0x406f('0x8')]=qs[_0x406f('0x8')](_0x4357e3[_0x406f('0x15')][_0x406f('0x8')]);_0x2e4409[_0x406f('0x6')]=qs[_0x406f('0x6')](_0x4357e3[_0x406f('0x15')][_0x406f('0x6')]);}_0x2e4409[_0x406f('0x2b')]=qs[_0x406f('0x2c')](_0x4357e3[_0x406f('0x15')][_0x406f('0x2c')]);_0x2e4409['where']=qs[_0x406f('0x2d')](_[_0x406f('0x2e')](_0x4357e3[_0x406f('0x15')],_0x57d93a[_0x406f('0x2d')]),_0x3ad3fe);if(_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]){_0x2e4409[_0x406f('0x30')]=_[_0x406f('0x31')](_0x2e4409[_0x406f('0x30')],{'$or':_[_0x406f('0x11')](_0x3ad3fe,function(_0x52b465){if(_0x52b465[_0x406f('0x32')]!==_0x406f('0x33')){var _0x36a17a={};_0x36a17a[_0x52b465[_0x406f('0xf')]]={'$like':'%'+_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]+'%'};return _0x36a17a;}})});}_0x2e4409=_['merge']({},_0x2e4409,_0x4357e3['options']);var _0x44c63a={'where':_0x2e4409[_0x406f('0x30')]};return db['CmHopper'][_0x406f('0x9')](_0x44c63a)['then'](function(_0x43fb4f){_0xe186fb[_0x406f('0x9')]=_0x43fb4f;if(_0x4357e3[_0x406f('0x15')]['includeAll']){_0x2e4409[_0x406f('0x34')]=[{'all':!![]}];}return db[_0x406f('0x12')][_0x406f('0x35')](_0x2e4409);})[_0x406f('0xc')](function(_0x224e9d){_0xe186fb[_0x406f('0x36')]=_0x224e9d;return _0xe186fb;})[_0x406f('0xc')](respondWithFilteredResult(_0x509bae,_0x2e4409))[_0x406f('0x37')](handleError(_0x509bae,null));};exports[_0x406f('0x38')]=function(_0x14c27f,_0x17f217){var _0x37c4d2={'raw':!![],'where':{'id':_0x14c27f[_0x406f('0x39')]['id']}},_0x279e9e={};_0x279e9e[_0x406f('0x17')]=_['keys'](db['CmHopper']['rawAttributes']);_0x279e9e[_0x406f('0x15')]=_[_0x406f('0x3a')](_0x14c27f[_0x406f('0x15')]);_0x279e9e['filters']=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],_0x279e9e[_0x406f('0x15')]);_0x37c4d2[_0x406f('0x28')]=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],qs['fields'](_0x14c27f[_0x406f('0x15')][_0x406f('0x29')]));_0x37c4d2['attributes']=_0x37c4d2[_0x406f('0x28')]['length']?_0x37c4d2['attributes']:_0x279e9e[_0x406f('0x17')];if(_0x14c27f[_0x406f('0x15')][_0x406f('0x3b')]){_0x37c4d2[_0x406f('0x34')]=[{'all':!![]}];}_0x37c4d2=_[_0x406f('0x31')]({},_0x37c4d2,_0x14c27f[_0x406f('0x3c')]);return db['CmHopper']['find'](_0x37c4d2)[_0x406f('0xc')](handleEntityNotFound(_0x17f217,null))[_0x406f('0xc')](respondWithResult(_0x17f217,null))[_0x406f('0x37')](handleError(_0x17f217,null));};exports[_0x406f('0x3d')]=function(_0x453289,_0x2b226e){return db[_0x406f('0x12')]['create'](_0x453289[_0x406f('0x3e')],{})[_0x406f('0xc')](respondWithResult(_0x2b226e,0xc9))[_0x406f('0x37')](handleError(_0x2b226e,null));};exports[_0x406f('0xb')]=function(_0x792ac9,_0x17c499){if(_0x792ac9[_0x406f('0x3e')]['id']){delete _0x792ac9[_0x406f('0x3e')]['id'];}return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x792ac9[_0x406f('0x39')]['id']}})['then'](handleEntityNotFound(_0x17c499,null))[_0x406f('0xc')](saveUpdates(_0x792ac9[_0x406f('0x3e')],null))['then'](respondWithResult(_0x17c499,null))['catch'](handleError(_0x17c499,null));};exports[_0x406f('0x40')]=function(_0x3eb55b,_0x2a13c3){return db[_0x406f('0x12')]['describe']()[_0x406f('0xc')](respondWithResult(_0x2a13c3,null))['catch'](handleError(_0x2a13c3,null));};exports[_0x406f('0x41')]=function(_0x351d2f,_0x5b1143){var _0x5a91dd;var _0x1bdb59=_0x351d2f[_0x406f('0x39')]['id'];return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x351d2f['params']['id']}})[_0x406f('0xc')](handleEntityNotFound(_0x5b1143,null))[_0x406f('0xc')](function(_0x8ef14b){if(_0x8ef14b){return _0x8ef14b[_0x406f('0x41')]()['then'](function(_0x5d4041){return _0x5d4041;});}})[_0x406f('0xc')](function(_0x244fcf){_0x5a91dd=_0x244fcf;if(_0x244fcf){if(_0x244fcf[_0x406f('0x42')]||_0x244fcf[_0x406f('0x43')]){return db[_0x244fcf[_0x406f('0x42')]?'VoiceQueue':_0x406f('0x44')][_0x406f('0x3f')]({'where':{'id':_0x244fcf['VoiceQueueId']?_0x244fcf['VoiceQueueId']:_0x244fcf[_0x406f('0x43')]},'attributes':['id',_0x406f('0xf')],'raw':!![]});}}})[_0x406f('0xc')](function(_0x4b0b19){var _0x1a99b9={};if(_0x4b0b19){_[_0x406f('0x31')](_0x1a99b9,_[_0x406f('0x45')](_0x5a91dd[_0x406f('0x46')],[_0x406f('0x47'),_0x406f('0x48'),'id']));_0x1a99b9[_0x406f('0x49')]=0x15;_0x1a99b9[_0x406f('0x4a')]=_0x406f('0x4b');_0x1a99b9['campaign']=_0x4b0b19['name'];_0x1a99b9[_0x406f('0x4c')]=_0x351d2f[_0x406f('0x4d')][_0x406f('0xf')];_0x1a99b9[_0x406f('0x4e')]=_0x351d2f[_0x406f('0x4d')]['id'];_0x1a99b9[_0x406f('0x4b')]=!![];_0x1a99b9[_0x406f('0x4f')]=moment()[_0x406f('0x50')](_0x406f('0x51'));_0x1a99b9[_0x406f('0x52')]=_0x5a91dd['phone'];_0x1a99b9['campaigntype']=_0x5a91dd[_0x406f('0x42')]?_0x406f('0x53'):_0x406f('0x54');return db[_0x406f('0x55')][_0x406f('0x3f')]({'where':{'id':_0x1a99b9[_0x406f('0x56')]},'attributes':['firstName',_0x406f('0x57')]})[_0x406f('0xc')](function(_0x39f7f6){if(!_[_0x406f('0x58')](_0x5b1143)&&!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x59')])){_0x1a99b9[_0x406f('0x5a')]=_0x39f7f6[_0x406f('0x59')];if(!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x57')])){_0x1a99b9['calleridname']+='\x20'+_0x39f7f6[_0x406f('0x57')];}}})[_0x406f('0x5b')](function(){return db[_0x406f('0x5c')]['create'](_0x1a99b9);});}})[_0x406f('0xc')](function(_0x538517){return db['CmHopperAdditionalPhone'][_0x406f('0x41')]({'where':{'CmHopperId':_0x1bdb59}});})[_0x406f('0xc')](function(){return _0x5b1143['status'](0xcc)[_0x406f('0x5d')]();})['catch'](handleError(_0x5b1143,null));};exports[_0x406f('0x5e')]=function(_0x4a4bf8,_0x2c3881){var _0x48bca4=[];return db[_0x406f('0x55')][_0x406f('0x40')]()['then'](function(_0x5dd1e8){_0x48bca4=_[_0x406f('0x3a')](_0x5dd1e8);return _0x4a4bf8[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x406f('0x61'),_0x406f('0x62')],'raw':!![]});})[_0x406f('0xc')](function(_0x41839a){if(_0x41839a&&_0x41839a[_0x406f('0x63')]){return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x5c1a91){var _0x44297b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x406f('0x51'))},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x41839a,'id')},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x55cac0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x41839a)[_0x406f('0x2f')]([_0x406f('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x468e2b={'$or':[_0x44297b,_0x55cac0]};var _0x4a150b=[];if(_0x4a4bf8['body']['direction']&&_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x66')]===_0x406f('0x67')){if(!_['isEmpty'](_0x4a4bf8['body'][_0x406f('0x68')])){_0x468e2b['id']={'$in':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6a')],['scheduledAt',_0x41839a[0x0][_0x406f('0x61')]===_0x406f('0x6a')?_0x406f('0x6b'):_0x406f('0x6a')],db[_0x406f('0x64')][_0x406f('0x6c')](_0x406f('0x6d')),['id',_0x406f('0x6b')]];}else{if(!_[_0x406f('0x6e')](_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')])){_0x468e2b['id']={'$notIn':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6b')],[_0x406f('0x6f'),_0x41839a[0x0][_0x406f('0x61')]],db['sequelize'][_0x406f('0x6c')](_0x406f('0x70')),['id',_0x406f('0x6a')]];}return db['CmHopper'][_0x406f('0x71')]({'attributes':['id',_0x406f('0x72'),'phone',_0x406f('0x73')],'where':_0x468e2b,'order':_0x4a150b,'transaction':_0x5c1a91,'lock':_0x5c1a91['LOCK']['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x48bca4,'include':[{'model':db['CmCompany'],'as':_0x406f('0x75'),'attributes':['id','name']}]},{'model':db[_0x406f('0x76')],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x3e9e31){if(_0x3e9e31){return _0x3e9e31['update']({'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']},{'transaction':_0x5c1a91});}});});}})['then'](handleEntityNotFound(_0x2c3881,null))[_0x406f('0xc')](respondWithResult(_0x2c3881,null))['catch'](handleError(_0x2c3881,null));};exports['getPreviewRecall']=function(_0x519cd9,_0x14ce45,_0x3f0e29){var _0x2bb105=[];var _0x156fa5=_0x519cd9[_0x406f('0x39')]['id'];var _0x552db1=_0x519cd9['user']['id'];return db['CmContact'][_0x406f('0x40')]()['then'](function(_0x31212a){_0x2bb105=_[_0x406f('0x3a')](_0x31212a);return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x238912){const _0x1b2e3c={'id':_0x156fa5};return db['CmHopper']['findOne']({'attributes':['id',_0x406f('0x72'),_0x406f('0x73')],'where':_0x1b2e3c,'transaction':_0x238912,'lock':_0x238912[_0x406f('0x7b')]['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x2bb105,'include':[{'model':db[_0x406f('0x7c')],'as':_0x406f('0x75'),'attributes':['id',_0x406f('0xf')]}]},{'model':db['CmList'],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x23ae6b){if(_0x23ae6b){return _0x23ae6b['update']({'UserId':_0x552db1},{'transaction':_0x238912});}});});})['then'](handleEntityNotFound(_0x14ce45,null))['then'](respondWithResult(_0x14ce45,null))[_0x406f('0x37')](handleError(_0x14ce45,null));};exports['getOpenContacts']=function(_0x5ec137,_0x2c032b){return _0x5ec137[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':_0x406f('0x7d')},'attributes':['id'],'raw':!![]})['then'](function(_0x58206a){if(_0x58206a&&_0x58206a[_0x406f('0x63')]){return db[_0x406f('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x406f('0x50')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x58206a,'id')},'$or':[{'UserId':null},{'UserId':_0x5ec137[_0x406f('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x110072){if(!_[_0x406f('0x58')](_0x110072)&&_[_0x406f('0x7e')](_0x110072)){return _0x2c032b[_0x406f('0x4')](0xc8)[_0x406f('0x5')]({'contacts':_0x110072});}else{logger[_0x406f('0xe')](_0x406f('0x7f'),_0x406f('0x80'),0x194,_0x406f('0x81'));_0x2c032b[_0x406f('0xd')](0x194);}})[_0x406f('0x37')](handleError(_0x2c032b,null));};exports['getTimezones']=function(_0x35968c,_0x16791a){var _0x169662=shared[_0x406f('0x82')];var _0x2bf211=[];_[_0x406f('0x11')](_0x169662,function(_0x115736){_0x2bf211[_0x406f('0x83')]({'id':_0x115736[_0x406f('0xf')],'name':_0x115736['name'],'utcOffset':_0x115736[_0x406f('0x84')]});});return _0x16791a[_0x406f('0x4')](0xc8)['json']({'tz':_0x2bf211});};exports[_0x406f('0x85')]=function(_0x2213b4,_0x39fe38){var _0x42a297=shared[_0x406f('0x82')];var _0x2178ac={};if(!_['isNil'](_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']]))_0x2178ac=_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']];return _0x39fe38['status'](0xc8)[_0x406f('0x5')](_0x2178ac);}; \ No newline at end of file +var _0x98a8=['preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','hopperIds','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','LOCK','CmCompany','outbound','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','sendStatus','stack','name','send','CmHopper','rawAttributes','type','key','model','map','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','catch','show','params','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','deleted','deletedat','calleridnum','phone','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues'];(function(_0x7dc397,_0x42d668){var _0x14e534=function(_0x4543a1){while(--_0x4543a1){_0x7dc397['push'](_0x7dc397['shift']());}};_0x14e534(++_0x42d668);}(_0x98a8,0x12c));var _0x898a=function(_0x2339a8,_0x480b13){_0x2339a8=_0x2339a8-0x0;var _0x1b8bd9=_0x98a8[_0x2339a8];return _0x1b8bd9;};'use strict';var moment=require(_0x898a('0x0'));var _=require(_0x898a('0x1'));var qs=require(_0x898a('0x2'));var logger=require(_0x898a('0x3'))(_0x898a('0x4'));var shared=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];function respondWithResult(_0x4a0836,_0x2bb3e2){_0x2bb3e2=_0x2bb3e2||0xc8;return function(_0xf84a19){if(_0xf84a19){return _0x4a0836[_0x898a('0x7')](_0x2bb3e2)[_0x898a('0x8')](_0xf84a19);}};}function respondWithFilteredResult(_0x3e7ddd,_0x5d7e59){return function(_0x3aadc2){if(_0x3aadc2){var _0x564583=typeof _0x5d7e59[_0x898a('0x9')]==='undefined'&&typeof _0x5d7e59[_0x898a('0xa')]===_0x898a('0xb');var _0x2101b3=_0x3aadc2[_0x898a('0xc')];var _0x3150df=_0x564583?0x0:_0x5d7e59[_0x898a('0x9')];var _0x42faa4=_0x564583?_0x3aadc2[_0x898a('0xc')]:_0x5d7e59[_0x898a('0x9')]+_0x5d7e59['limit'];var _0x3e1867;if(_0x42faa4>=_0x2101b3){_0x42faa4=_0x2101b3;_0x3e1867=0xc8;}else{_0x3e1867=0xce;}_0x3e7ddd['status'](_0x3e1867);return _0x3e7ddd[_0x898a('0xd')]('Content-Range',_0x3150df+'-'+_0x42faa4+'/'+_0x2101b3)[_0x898a('0x8')](_0x3aadc2);}return null;};}function saveUpdates(_0x2c76b7,_0x364a23){return function(_0x5f5e06){if(_0x5f5e06){return _0x5f5e06['update'](_0x2c76b7)['then'](function(_0x373d53){return _0x373d53;});}return null;};}function handleEntityNotFound(_0x1f5be4,_0xb24335){return function(_0x116fbe){if(!_0x116fbe){_0x1f5be4[_0x898a('0xe')](0x194);}return _0x116fbe;};}function handleError(_0x15177d,_0x506023){_0x506023=_0x506023||0x1f4;return function(_0x47033c){logger['error'](_0x47033c[_0x898a('0xf')]);if(_0x47033c['name']){delete _0x47033c[_0x898a('0x10')];}_0x15177d['status'](_0x506023)[_0x898a('0x11')](_0x47033c);};}exports['index']=function(_0xee4408,_0x3197f7){var _0x28cc63={},_0x4ddd4d={},_0x1faf4c={'count':0x0,'rows':[]};var _0x5960e0=_['map'](db[_0x898a('0x12')][_0x898a('0x13')],function(_0x58c3ab){return{'name':_0x58c3ab['fieldName'],'type':_0x58c3ab[_0x898a('0x14')][_0x898a('0x15')]};});_0x4ddd4d[_0x898a('0x16')]=_[_0x898a('0x17')](_0x5960e0,_0x898a('0x10'));_0x4ddd4d[_0x898a('0x18')]=_[_0x898a('0x19')](_0xee4408['query']);_0x4ddd4d[_0x898a('0x1a')]=_[_0x898a('0x1b')](_0x4ddd4d[_0x898a('0x16')],_0x4ddd4d[_0x898a('0x18')]);_0x4ddd4d[_0x898a('0x1a')]=_[_0x898a('0x1c')](_0x4ddd4d['filters'],[_0x898a('0x1d'),_0x898a('0x1e'),_0x898a('0x1f'),_0x898a('0x20'),_0x898a('0x21'),_0x898a('0x22'),'$ne',_0x898a('0x23'),'$not','$between','$notBetween',_0x898a('0x24'),_0x898a('0x25'),_0x898a('0x26'),_0x898a('0x27'),_0x898a('0x28'),_0x898a('0x29'),_0x898a('0x26'),_0x898a('0x2a'),_0x898a('0x2b'),'$contained','$any']);_0x28cc63['attributes']=_[_0x898a('0x1b')](_0x4ddd4d[_0x898a('0x16')],qs[_0x898a('0x2c')](_0xee4408[_0x898a('0x18')][_0x898a('0x2c')]));_0x28cc63[_0x898a('0x2d')]=_0x28cc63[_0x898a('0x2d')][_0x898a('0x2e')]?_0x28cc63[_0x898a('0x2d')]:_0x4ddd4d[_0x898a('0x16')];if(!_0xee4408[_0x898a('0x18')][_0x898a('0x2f')]('nolimit')){_0x28cc63[_0x898a('0xa')]=qs[_0x898a('0xa')](_0xee4408[_0x898a('0x18')][_0x898a('0xa')]);_0x28cc63[_0x898a('0x9')]=qs['offset'](_0xee4408['query'][_0x898a('0x9')]);}_0x28cc63[_0x898a('0x30')]=qs[_0x898a('0x31')](_0xee4408['query'][_0x898a('0x31')]);_0x28cc63[_0x898a('0x32')]=qs[_0x898a('0x1a')](_[_0x898a('0x33')](_0xee4408[_0x898a('0x18')],_0x4ddd4d[_0x898a('0x1a')]),_0x5960e0);if(_0xee4408[_0x898a('0x18')][_0x898a('0x34')]){_0x28cc63['where']=_[_0x898a('0x35')](_0x28cc63['where'],{'$or':_['map'](_0x5960e0,function(_0x14e2dc){if(_0x14e2dc['type']!==_0x898a('0x36')){var _0x4b3aac={};_0x4b3aac[_0x14e2dc[_0x898a('0x10')]]={'$like':'%'+_0xee4408['query'][_0x898a('0x34')]+'%'};return _0x4b3aac;}})});}_0x28cc63=_[_0x898a('0x35')]({},_0x28cc63,_0xee4408[_0x898a('0x37')]);var _0x50c0e4={'where':_0x28cc63['where']};return db['CmHopper'][_0x898a('0xc')](_0x50c0e4)[_0x898a('0x38')](function(_0x5a228f){_0x1faf4c[_0x898a('0xc')]=_0x5a228f;if(_0xee4408[_0x898a('0x18')][_0x898a('0x39')]){_0x28cc63[_0x898a('0x3a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x28cc63);})[_0x898a('0x38')](function(_0x454c8c){_0x1faf4c['rows']=_0x454c8c;return _0x1faf4c;})['then'](respondWithFilteredResult(_0x3197f7,_0x28cc63))[_0x898a('0x3b')](handleError(_0x3197f7,null));};exports[_0x898a('0x3c')]=function(_0x181cc8,_0xa45405){var _0x51681f={'raw':!![],'where':{'id':_0x181cc8[_0x898a('0x3d')]['id']}},_0x67114b={};_0x67114b['model']=_['keys'](db['CmHopper'][_0x898a('0x13')]);_0x67114b[_0x898a('0x18')]=_[_0x898a('0x19')](_0x181cc8[_0x898a('0x18')]);_0x67114b[_0x898a('0x1a')]=_[_0x898a('0x1b')](_0x67114b[_0x898a('0x16')],_0x67114b[_0x898a('0x18')]);_0x51681f[_0x898a('0x2d')]=_[_0x898a('0x1b')](_0x67114b[_0x898a('0x16')],qs[_0x898a('0x2c')](_0x181cc8[_0x898a('0x18')][_0x898a('0x2c')]));_0x51681f[_0x898a('0x2d')]=_0x51681f['attributes'][_0x898a('0x2e')]?_0x51681f[_0x898a('0x2d')]:_0x67114b[_0x898a('0x16')];if(_0x181cc8['query'][_0x898a('0x39')]){_0x51681f[_0x898a('0x3a')]=[{'all':!![]}];}_0x51681f=_[_0x898a('0x35')]({},_0x51681f,_0x181cc8[_0x898a('0x37')]);return db[_0x898a('0x12')][_0x898a('0x3e')](_0x51681f)[_0x898a('0x38')](handleEntityNotFound(_0xa45405,null))[_0x898a('0x38')](respondWithResult(_0xa45405,null))['catch'](handleError(_0xa45405,null));};exports[_0x898a('0x3f')]=function(_0x1a874a,_0x3d4aa3){return db[_0x898a('0x12')]['create'](_0x1a874a[_0x898a('0x40')],{})[_0x898a('0x38')](respondWithResult(_0x3d4aa3,0xc9))['catch'](handleError(_0x3d4aa3,null));};exports[_0x898a('0x41')]=function(_0x4ce00e,_0x56a40c){if(_0x4ce00e['body']['id']){delete _0x4ce00e['body']['id'];}return db[_0x898a('0x12')]['find']({'where':{'id':_0x4ce00e[_0x898a('0x3d')]['id']}})[_0x898a('0x38')](handleEntityNotFound(_0x56a40c,null))['then'](saveUpdates(_0x4ce00e[_0x898a('0x40')],null))[_0x898a('0x38')](respondWithResult(_0x56a40c,null))['catch'](handleError(_0x56a40c,null));};exports[_0x898a('0x42')]=function(_0x199437,_0x11a0a3){return db[_0x898a('0x12')]['describe']()[_0x898a('0x38')](respondWithResult(_0x11a0a3,null))[_0x898a('0x3b')](handleError(_0x11a0a3,null));};exports['destroy']=function(_0x25adcc,_0x1d8c16){var _0x4ab441;var _0x28525b=_0x25adcc['params']['id'];return db[_0x898a('0x12')][_0x898a('0x3e')]({'where':{'id':_0x25adcc[_0x898a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1d8c16,null))[_0x898a('0x38')](function(_0x1b09da){if(_0x1b09da){return _0x1b09da[_0x898a('0x43')]()[_0x898a('0x38')](function(_0x5a8a2c){return _0x5a8a2c;});}})[_0x898a('0x38')](function(_0x529d7c){_0x4ab441=_0x529d7c;if(_0x529d7c){if(_0x529d7c[_0x898a('0x44')]||_0x529d7c[_0x898a('0x45')]){return db[_0x529d7c[_0x898a('0x44')]?'VoiceQueue':_0x898a('0x46')][_0x898a('0x3e')]({'where':{'id':_0x529d7c[_0x898a('0x44')]?_0x529d7c['VoiceQueueId']:_0x529d7c['CampaignId']},'attributes':['id',_0x898a('0x10')],'raw':!![]});}}})[_0x898a('0x38')](function(_0x13b3ed){var _0x295f1e={};if(_0x13b3ed){_[_0x898a('0x35')](_0x295f1e,_[_0x898a('0x47')](_0x4ab441[_0x898a('0x48')],[_0x898a('0x49'),_0x898a('0x4a'),'id']));_0x295f1e[_0x898a('0x4b')]=0x15;_0x295f1e[_0x898a('0x4c')]='deleted';_0x295f1e[_0x898a('0x4d')]=_0x13b3ed[_0x898a('0x10')];_0x295f1e['membername']=_0x25adcc[_0x898a('0x4e')]['name'];_0x295f1e['UserId']=_0x25adcc[_0x898a('0x4e')]['id'];_0x295f1e[_0x898a('0x4f')]=!![];_0x295f1e[_0x898a('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x295f1e[_0x898a('0x51')]=_0x4ab441[_0x898a('0x52')];_0x295f1e['campaigntype']=_0x4ab441[_0x898a('0x44')]?_0x898a('0x53'):'ivr';return db[_0x898a('0x54')][_0x898a('0x3e')]({'where':{'id':_0x295f1e[_0x898a('0x55')]},'attributes':['firstName',_0x898a('0x56')]})[_0x898a('0x38')](function(_0x9c25ee){if(!_[_0x898a('0x57')](_0x1d8c16)&&!_[_0x898a('0x57')](_0x9c25ee[_0x898a('0x58')])){_0x295f1e['calleridname']=_0x9c25ee[_0x898a('0x58')];if(!_['isNil'](_0x9c25ee[_0x898a('0x56')])){_0x295f1e[_0x898a('0x59')]+='\x20'+_0x9c25ee[_0x898a('0x56')];}}})[_0x898a('0x5a')](function(){return db[_0x898a('0x5b')][_0x898a('0x3f')](_0x295f1e);});}})[_0x898a('0x38')](function(_0x75ff57){return db[_0x898a('0x5c')]['destroy']({'where':{'CmHopperId':_0x28525b}});})[_0x898a('0x38')](function(){return _0x1d8c16[_0x898a('0x7')](0xcc)[_0x898a('0x5d')]();})[_0x898a('0x3b')](handleError(_0x1d8c16,null));};exports[_0x898a('0x5e')]=function(_0x2a1345,_0x9d8b4e){var _0x68fd81=[];return db[_0x898a('0x54')][_0x898a('0x42')]()[_0x898a('0x38')](function(_0x217dda){_0x68fd81=_[_0x898a('0x19')](_0x217dda);return _0x2a1345[_0x898a('0x4e')][_0x898a('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x898a('0x60')},'attributes':['id',_0x898a('0x61'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x898a('0x38')](function(_0x4583a1){if(_0x4583a1&&_0x4583a1['length']){return db[_0x898a('0x62')][_0x898a('0x63')](function(_0x21f0f8){var _0x1f3f5b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x898a('0x64'))},'VoiceQueueId':{'$in':_[_0x898a('0x17')](_0x4583a1,'id')},'$or':[{'UserId':null},{'UserId':_0x2a1345[_0x898a('0x4e')]['id']}]};var _0xf86633={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4583a1)['filter']([_0x898a('0x65'),0x0])[_0x898a('0x17')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2a1345[_0x898a('0x4e')]['id']}]};var _0x3c0bf6={'$or':[_0x1f3f5b,_0xf86633]};var _0x5b7019=[];if(_0x2a1345[_0x898a('0x40')]['direction']&&_0x2a1345[_0x898a('0x40')]['direction']==='prev'){if(!_['isEmpty'](_0x2a1345[_0x898a('0x40')][_0x898a('0x66')])){_0x3c0bf6['id']={'$in':_0x2a1345[_0x898a('0x40')][_0x898a('0x66')]};}_0x5b7019=[['priority','ASC'],[_0x898a('0x67'),_0x4583a1[0x0][_0x898a('0x61')]===_0x898a('0x68')?_0x898a('0x69'):_0x898a('0x68')],db[_0x898a('0x62')][_0x898a('0x6a')](_0x898a('0x6b')),['id','DESC']];}else{if(!_[_0x898a('0x6c')](_0x2a1345[_0x898a('0x40')]['hopperIds'])){_0x3c0bf6['id']={'$notIn':_0x2a1345[_0x898a('0x40')][_0x898a('0x66')]};}_0x5b7019=[[_0x898a('0x6d'),_0x898a('0x69')],[_0x898a('0x67'),_0x4583a1[0x0][_0x898a('0x61')]],db[_0x898a('0x62')][_0x898a('0x6a')](_0x898a('0x6e')),['id',_0x898a('0x68')]];}return db[_0x898a('0x12')][_0x898a('0x6f')]({'attributes':['id',_0x898a('0x70'),'phone',_0x898a('0x71')],'where':_0x3c0bf6,'order':_0x5b7019,'transaction':_0x21f0f8,'lock':_0x21f0f8['LOCK'][_0x898a('0x72')],'include':[{'model':db[_0x898a('0x54')],'as':_0x898a('0x73'),'attributes':_0x68fd81,'include':[{'model':db['CmCompany'],'as':_0x898a('0x74'),'attributes':['id',_0x898a('0x10')]}]},{'model':db[_0x898a('0x75')],'as':_0x898a('0x76'),'attributes':['id',_0x898a('0x10')]},{'model':db['VoiceQueue'],'as':_0x898a('0x77'),'attributes':['id',_0x898a('0x10'),_0x898a('0x78')]}]})[_0x898a('0x38')](function(_0xc1c3fe){if(_0xc1c3fe){return _0xc1c3fe['update']({'UserId':_0x2a1345[_0x898a('0x4e')]['id']},{'transaction':_0x21f0f8});}});});}})[_0x898a('0x38')](handleEntityNotFound(_0x9d8b4e,null))[_0x898a('0x38')](respondWithResult(_0x9d8b4e,null))[_0x898a('0x3b')](handleError(_0x9d8b4e,null));};exports[_0x898a('0x79')]=function(_0x420347,_0x1fd617,_0x1b0c09){var _0x51836c=[];var _0x32a207=_0x420347[_0x898a('0x3d')]['id'];var _0x558f13=_0x420347[_0x898a('0x4e')]['id'];return db['CmContact'][_0x898a('0x42')]()['then'](function(_0x2471d8){_0x51836c=_[_0x898a('0x19')](_0x2471d8);return db[_0x898a('0x62')][_0x898a('0x63')](function(_0x109064){const _0x2c7e30={'id':_0x32a207};return db[_0x898a('0x12')][_0x898a('0x6f')]({'attributes':['id',_0x898a('0x70'),'recallme'],'where':_0x2c7e30,'transaction':_0x109064,'lock':_0x109064[_0x898a('0x7a')][_0x898a('0x72')],'include':[{'model':db[_0x898a('0x54')],'as':_0x898a('0x73'),'attributes':_0x51836c,'include':[{'model':db[_0x898a('0x7b')],'as':_0x898a('0x74'),'attributes':['id',_0x898a('0x10')]}]},{'model':db[_0x898a('0x75')],'as':_0x898a('0x76'),'attributes':['id',_0x898a('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x898a('0x10'),_0x898a('0x78')]}]})['then'](function(_0x5710a0){if(_0x5710a0){return _0x5710a0[_0x898a('0x41')]({'UserId':_0x558f13},{'transaction':_0x109064});}});});})['then'](handleEntityNotFound(_0x1fd617,null))[_0x898a('0x38')](respondWithResult(_0x1fd617,null))[_0x898a('0x3b')](handleError(_0x1fd617,null));};exports['getOpenContacts']=function(_0x3f6815,_0x1c782e){return _0x3f6815[_0x898a('0x4e')][_0x898a('0x5f')]({'where':{'type':_0x898a('0x7c'),'dialActive':!![],'dialMethod':_0x898a('0x60')},'attributes':['id'],'raw':!![]})[_0x898a('0x38')](function(_0x49f8ac){if(_0x49f8ac&&_0x49f8ac[_0x898a('0x2e')]){return db[_0x898a('0x12')][_0x898a('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x898a('0x64'))},'VoiceQueueId':{'$in':_[_0x898a('0x17')](_0x49f8ac,'id')},'$or':[{'UserId':null},{'UserId':_0x3f6815['user']['id']}]}});}return 0x0;})[_0x898a('0x38')](function(_0x532c26){if(!_['isNil'](_0x532c26)&&_['isNumber'](_0x532c26)){return _0x1c782e[_0x898a('0x7')](0xc8)[_0x898a('0x8')]({'contacts':_0x532c26});}else{logger[_0x898a('0x7d')](_0x898a('0x7e'),_0x898a('0x7f'),0x194,_0x898a('0x80'));_0x1c782e[_0x898a('0xe')](0x194);}})['catch'](handleError(_0x1c782e,null));};exports[_0x898a('0x81')]=function(_0x4f29b6,_0x456288){var _0x3da2c1=shared['timezones'];var _0x24670c=[];_[_0x898a('0x17')](_0x3da2c1,function(_0x126ca1){_0x24670c[_0x898a('0x82')]({'id':_0x126ca1[_0x898a('0x10')],'name':_0x126ca1['name'],'utcOffset':_0x126ca1['utcOffset']});});return _0x456288['status'](0xc8)[_0x898a('0x8')]({'tz':_0x24670c});};exports[_0x898a('0x83')]=function(_0x18caad,_0x5c2243){var _0x224746=shared['timezones'];var _0x5c0aed={};if(!_[_0x898a('0x57')](_0x224746[_0x18caad[_0x898a('0x40')]['id']]))_0x5c0aed=_0x224746[_0x18caad[_0x898a('0x40')]['id']];return _0x5c2243[_0x898a('0x7')](0xc8)[_0x898a('0x8')](_0x5c0aed);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7e1dd2f..d58ce8f 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 _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x57c601,_0x3293a2){var _0x10d301=function(_0x37c889){while(--_0x37c889){_0x57c601['push'](_0x57c601['shift']());}};_0x10d301(++_0x3293a2);}(_0xba34,0x119));var _0x4ba3=function(_0x234110,_0x488d95){_0x234110=_0x234110-0x0;var _0x4c9648=_0xba34[_0x234110];return _0x4c9648;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x90b1,0x1bb));var _0x190b=function(_0x2fe299,_0x2e1408){_0x2fe299=_0x2fe299-0x0;var _0x3e7659=_0x90b1[_0x2fe299];return _0x3e7659;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4940ef4..db92143 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 _0xaa1b=['transaction','order','LOCK','UPDATE','Contact','Agent','name','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','describe','GetCmHopperPreview','keys','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','lodash','util','moment','../../mysqldb','rpc','jayson/promise','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize'];(function(_0x33ccd1,_0x140b6b){var _0x35367e=function(_0x571e9c){while(--_0x571e9c){_0x33ccd1['push'](_0x33ccd1['shift']());}};_0x35367e(++_0x140b6b);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var moment=require(_0xbaa1('0x2'));var BPromise=require('bluebird');var db=require(_0xbaa1('0x3'))['db'];var logger=require('../../config/logger')(_0xbaa1('0x4'));var jayson=require(_0xbaa1('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ceeaa,_0xc14e75,_0x27b99c){return new BPromise(function(_0x4a5735,_0x22516a){return client['request'](_0x5ceeaa,_0x27b99c)[_0xbaa1('0x6')](function(_0x15b968){logger[_0xbaa1('0x7')](_0xbaa1('0x8'),_0xc14e75,_0xbaa1('0x9'));logger[_0xbaa1('0xa')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc14e75,_0xbaa1('0x9'),JSON[_0xbaa1('0xb')](_0x15b968));if(_0x15b968[_0xbaa1('0xc')]){if(_0x15b968[_0xbaa1('0xc')][_0xbaa1('0xd')]===0x1f4){logger[_0xbaa1('0xc')](_0xbaa1('0x8'),_0xc14e75,_0x15b968[_0xbaa1('0xc')][_0xbaa1('0xe')]);return _0x22516a(_0x15b968[_0xbaa1('0xc')][_0xbaa1('0xe')]);}logger[_0xbaa1('0xc')]('CmHopper,\x20%s,\x20%s',_0xc14e75,_0x15b968['error']['message']);return _0x4a5735(_0x15b968['error'][_0xbaa1('0xe')]);}else{logger[_0xbaa1('0x7')](_0xbaa1('0x8'),_0xc14e75,_0xbaa1('0x9'));_0x4a5735(_0x15b968[_0xbaa1('0xf')][_0xbaa1('0xe')]);}})[_0xbaa1('0x10')](function(_0xdbaa8b){logger[_0xbaa1('0xc')](_0xbaa1('0x8'),_0xc14e75,_0xdbaa8b);_0x22516a(_0xdbaa8b);});});}exports[_0xbaa1('0x11')]=function(_0x42f360){var _0x449dfc=this;return new Promise(function(_0x16725c,_0xa9883f){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'raw':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x42f360['options']?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x17')]||null:null,'include':_0x42f360[_0xbaa1('0x14')]?_0x42f360[_0xbaa1('0x14')][_0xbaa1('0x18')]?_['map'](_0x42f360['options'][_0xbaa1('0x18')],function(_0x24427a){return{'model':db[_0x24427a[_0xbaa1('0x19')]],'as':_0x24427a['as'],'attributes':_0x24427a[_0xbaa1('0x16')],'include':_0x24427a[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x24427a['include'],function(_0x243eeb){return{'model':db[_0x243eeb[_0xbaa1('0x19')]],'as':_0x243eeb['as'],'attributes':_0x243eeb[_0xbaa1('0x16')],'include':_0x243eeb[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x243eeb[_0xbaa1('0x18')],function(_0x39e3ce){return{'model':db[_0x39e3ce[_0xbaa1('0x19')]],'as':_0x39e3ce['as'],'attributes':_0x39e3ce[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b80a4){logger[_0xbaa1('0x7')](_0xbaa1('0x11'),_0x42f360);logger[_0xbaa1('0xa')](_0xbaa1('0x11'),_0x42f360,JSON[_0xbaa1('0xb')](_0x2b80a4));_0x16725c(_0x2b80a4);})['catch'](function(_0x49803c){logger[_0xbaa1('0xc')](_0xbaa1('0x11'),_0x49803c[_0xbaa1('0xe')],_0x42f360);_0xa9883f(_0x449dfc['error'](0x1f4,_0x49803c[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x1b')]=function(_0x4f3e27){var _0x1312d2=this;return new Promise(function(_0x57a4b4,_0x158437){return db[_0xbaa1('0x12')][_0xbaa1('0x1c')]({'raw':_0x4f3e27['options']?_0x4f3e27['options'][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f3e27[_0xbaa1('0x14')]?_0x4f3e27[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x4f3e27[_0xbaa1('0x14')]?_0x4f3e27[_0xbaa1('0x14')]['attributes']||null:null,'include':_0x4f3e27[_0xbaa1('0x14')]?_0x4f3e27[_0xbaa1('0x14')][_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x4f3e27['options'][_0xbaa1('0x18')],function(_0x584ca6){return{'model':db[_0x584ca6[_0xbaa1('0x19')]],'as':_0x584ca6['as'],'attributes':_0x584ca6[_0xbaa1('0x16')],'include':_0x584ca6[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x584ca6['include'],function(_0x2cf50a){return{'model':db[_0x2cf50a[_0xbaa1('0x19')]],'as':_0x2cf50a['as'],'attributes':_0x2cf50a[_0xbaa1('0x16')],'include':_0x2cf50a['include']?_[_0xbaa1('0x1a')](_0x2cf50a[_0xbaa1('0x18')],function(_0x5e093e){return{'model':db[_0x5e093e[_0xbaa1('0x19')]],'as':_0x5e093e['as'],'attributes':_0x5e093e[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbaa1('0x6')](function(_0x4837cc){logger[_0xbaa1('0x7')]('ShowCmHopper',_0x4f3e27);logger['debug'](_0xbaa1('0x1b'),_0x4f3e27,JSON['stringify'](_0x4837cc));_0x57a4b4(_0x4837cc);})[_0xbaa1('0x10')](function(_0x19328f){logger[_0xbaa1('0xc')]('ShowCmHopper',_0x19328f[_0xbaa1('0xe')],_0x4f3e27);_0x158437(_0x1312d2[_0xbaa1('0xc')](0x1f4,_0x19328f['message']));});});};exports[_0xbaa1('0x1e')]=function(_0x46cff8){var _0x2ffe91=this;return new Promise(function(_0x314001,_0x203fb1){return db[_0xbaa1('0x12')][_0xbaa1('0x1f')](_0x46cff8[_0xbaa1('0x20')],{'raw':_0x46cff8['options']?_0x46cff8[_0xbaa1('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xbaa1('0x6')](function(_0x3ba6bf){logger[_0xbaa1('0x7')]('CreateCmHopper',_0x46cff8);logger[_0xbaa1('0xa')]('CreateCmHopper',_0x46cff8,JSON['stringify'](_0x3ba6bf));_0x314001(_0x3ba6bf);})[_0xbaa1('0x10')](function(_0x5245a9){logger[_0xbaa1('0xc')]('CreateCmHopper',_0x5245a9['message'],_0x46cff8);_0x203fb1(_0x2ffe91[_0xbaa1('0xc')](0x1f4,_0x5245a9[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x21')]=function(_0x2443e3){var _0x2c0984=this;return new Promise(function(_0x28cde4,_0x309950){return db[_0xbaa1('0x12')][_0xbaa1('0x22')](_0x2443e3[_0xbaa1('0x20')],{'raw':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3['options']['where']||null:null,'attributes':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x2443e3[_0xbaa1('0x14')]?_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x17')]||null:null})[_0xbaa1('0x6')](function(_0xe83273){logger['info'](_0xbaa1('0x21'),_0x2443e3);logger[_0xbaa1('0x7')](_0xbaa1('0x23'),JSON[_0xbaa1('0xb')](_0x2443e3[_0xbaa1('0x14')][_0xbaa1('0x15')]),_0x2443e3['body']['active']);logger[_0xbaa1('0xa')]('UpdateCmHopper',_0x2443e3,JSON[_0xbaa1('0xb')](_0xe83273));_0x28cde4(_0xe83273);})[_0xbaa1('0x10')](function(_0x22f4db){logger['error'](_0xbaa1('0x21'),_0x22f4db[_0xbaa1('0xe')],_0x2443e3);_0x309950(_0x2c0984[_0xbaa1('0xc')](0x1f4,_0x22f4db[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x24')]=function(_0x5f54cf){var _0x550073=this;return new Promise(function(_0x32677a,_0x2627ae){return db[_0xbaa1('0x12')][_0xbaa1('0x25')]({'where':_0x5f54cf[_0xbaa1('0x14')]?_0x5f54cf[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null})[_0xbaa1('0x6')](function(_0xa4dd12){logger[_0xbaa1('0x7')](_0xbaa1('0x24'),_0x5f54cf);logger['debug'](_0xbaa1('0x24'),_0x5f54cf,JSON[_0xbaa1('0xb')](_0xa4dd12));_0x32677a(_0xa4dd12);})[_0xbaa1('0x10')](function(_0x216336){logger[_0xbaa1('0xc')](_0xbaa1('0x24'),_0x216336[_0xbaa1('0xe')],_0x5f54cf);_0x2627ae(_0x550073['error'](0x1f4,_0x216336[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x26')]=function(_0x56aeda){var _0x18e207=this;return new Promise(function(_0xbac747,_0x6e733a){return db[_0xbaa1('0x27')]['describe']()[_0xbaa1('0x6')](function(_0x4d70f1){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x5afdab){return db[_0xbaa1('0x12')]['findAll']({'where':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')]['limit']||null:null,'order':_0x56aeda[_0xbaa1('0x14')]?_0x56aeda[_0xbaa1('0x14')][_0xbaa1('0x2a')]||null:null,'transaction':_0x5afdab,'lock':_0x5afdab[_0xbaa1('0x2b')][_0xbaa1('0x2c')],'include':[{'model':db[_0xbaa1('0x27')],'as':_0xbaa1('0x2d'),'attributes':_['keys'](_0x4d70f1)},{'model':db['User'],'as':_0xbaa1('0x2e'),'attributes':['id',_0xbaa1('0x2f'),'voicePause']}]})[_0xbaa1('0x6')](function(_0x2cea6b){var _0x3eca07=[];var _0x51097c=[];for(var _0x207b6f=0x0;_0x207b6f<_0x2cea6b[_0xbaa1('0x30')];_0x207b6f+=0x1){var _0x2dd2bd=_0x2cea6b[_0x207b6f][_0xbaa1('0x31')];if(_0x2dd2bd===null){_0x3eca07[_0xbaa1('0x32')](_0x2cea6b[_0x207b6f][_0xbaa1('0x22')](_0x56aeda['body'],{'transaction':_0x5afdab}));}else if(!_0x51097c[_0xbaa1('0x33')](_0x2dd2bd)){_0x51097c[_0xbaa1('0x32')](_0x2dd2bd);_0x3eca07['push'](_0x2cea6b[_0x207b6f]['update'](_0x56aeda[_0xbaa1('0x20')],{'transaction':_0x5afdab}));}}return BPromise['all'](_0x3eca07);});})[_0xbaa1('0x6')](function(_0x2c56ef){logger[_0xbaa1('0x7')]('GetContactDialer',_0x56aeda);if(_0x2c56ef[_0xbaa1('0x30')]>0x0){logger[_0xbaa1('0x7')](_0xbaa1('0x34'),_0x2c56ef[0x0][_0xbaa1('0x35')]['id'],_0x2c56ef[0x0]['dataValues'][_0xbaa1('0x36')],_0x2c56ef[0x0][_0xbaa1('0x35')][_0xbaa1('0x37')]);}logger[_0xbaa1('0xa')](_0xbaa1('0x26'),_0x56aeda,JSON[_0xbaa1('0xb')](_0x2c56ef));_0xbac747(_0x2c56ef);})[_0xbaa1('0x10')](function(_0x3585cf){logger[_0xbaa1('0xc')](_0xbaa1('0x26'),_0x3585cf[_0xbaa1('0xe')],_0x56aeda);_0x6e733a(_0x18e207[_0xbaa1('0xc')](0x1f4,_0x3585cf[_0xbaa1('0xe')]));});});});};exports['MoveContactManagedDialer']=function(_0x42e6af){var _0x1aa65a=this;return new Promise(function(_0x17675a,_0x5a1cb4){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x424b4e){return db[_0xbaa1('0x38')][_0xbaa1('0x1f')](_0x42e6af[_0xbaa1('0x20')],{'raw':_0x42e6af[_0xbaa1('0x14')]?_0x42e6af[_0xbaa1('0x14')][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'transaction':_0x424b4e})[_0xbaa1('0x6')](function(){logger[_0xbaa1('0x7')](_0xbaa1('0x39'),JSON[_0xbaa1('0xb')](_0x42e6af['options']['where']),_0x42e6af[_0xbaa1('0x14')][_0xbaa1('0x15')][_0xbaa1('0x37')]);return db[_0xbaa1('0x12')][_0xbaa1('0x25')]({'where':_0x42e6af[_0xbaa1('0x14')]?_0x42e6af['options'][_0xbaa1('0x15')]||null:null,'transaction':_0x424b4e});});})[_0xbaa1('0x6')](function(_0x5b2c22){logger['info']('MoveContactManagedDialer',_0x42e6af);logger[_0xbaa1('0xa')]('MoveContactManagedDialer',_0x42e6af,JSON[_0xbaa1('0xb')](_0x5b2c22));_0x17675a(_0x5b2c22);})['catch'](function(_0x7c6f20){logger[_0xbaa1('0xc')](_0xbaa1('0x3a'),_0x7c6f20[_0xbaa1('0xe')],_0x42e6af);_0x5a1cb4(_0x1aa65a['error'](0x1f4,_0x7c6f20[_0xbaa1('0xe')]));});});};exports['CountReScheduled']=function(_0x3be487){var _0x455f54=this;return new Promise(function(_0x1432b9,_0x3ec6a5){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'raw':_0x3be487['options']?_0x3be487[_0xbaa1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3be487[_0xbaa1('0x14')]?_0x3be487[_0xbaa1('0x14')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xbaa1('0x3b'),db[_0xbaa1('0x28')]['fn']('IF',db['sequelize'][_0xbaa1('0x3c')]('`scheduledat`\x20>=\x20'+util['format'](_0xbaa1('0x3d'),moment()[_0xbaa1('0x3e')](_0xbaa1('0x3f')))+_0xbaa1('0x40')))),'contactsRescheduled']]})['then'](function(_0x240716){logger['info'](_0xbaa1('0x41'),_0x3be487);logger[_0xbaa1('0xa')]('CountReScheduled',_0x3be487,JSON[_0xbaa1('0xb')](_0x240716));_0x1432b9(_0x240716);})[_0xbaa1('0x10')](function(_0xcc1022){logger[_0xbaa1('0xc')](_0xbaa1('0x41'),_0xcc1022['message'],_0x3be487);_0x3ec6a5(_0x455f54[_0xbaa1('0xc')](0x1f4,_0xcc1022['message']));});});};exports[_0xbaa1('0x42')]=function(_0x153628){var _0x456f3f=this;return new Promise(function(_0x209ee2,_0x55df63){return db[_0xbaa1('0x27')][_0xbaa1('0x43')]()[_0xbaa1('0x6')](function(_0x5686a8){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x41a41e){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'where':_0x153628['options']?_0x153628['options'][_0xbaa1('0x15')]||null:null,'attributes':_0x153628[_0xbaa1('0x14')]?_0x153628['options'][_0xbaa1('0x16')]||null:null,'limit':0x1,'order':_0x153628[_0xbaa1('0x14')]?_0x153628['options']['order']||null:null,'group':db[_0xbaa1('0x12')][_0xbaa1('0x31')],'transaction':_0x41a41e,'lock':_0x41a41e['LOCK'][_0xbaa1('0x2c')],'include':_0x153628[_0xbaa1('0x14')]?_0x153628['options']['include']?_[_0xbaa1('0x1a')](_0x153628[_0xbaa1('0x14')][_0xbaa1('0x18')],function(_0x306e66){return{'model':db[_0x306e66[_0xbaa1('0x19')]],'as':_0x306e66['as'],'attributes':_0x306e66[_0xbaa1('0x16')],'include':_0x306e66['include']?_['map'](_0x306e66['include'],function(_0x1989cf){return{'model':db[_0x1989cf[_0xbaa1('0x19')]],'as':_0x1989cf['as'],'attributes':_0x1989cf[_0xbaa1('0x16')],'include':_0x1989cf[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x1989cf['include'],function(_0x288b3b){return{'model':db[_0x288b3b[_0xbaa1('0x19')]],'as':_0x288b3b['as'],'attributes':_0x288b3b[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbaa1('0x6')](function(_0x2212be){var _0x44b751=[];for(var _0x18ffe9=0x0;_0x18ffe9<_0x2212be[_0xbaa1('0x30')];_0x18ffe9+=0x1){_0x44b751['push'](_0x2212be[_0x18ffe9][_0xbaa1('0x22')](_0x153628[_0xbaa1('0x20')],{'transaction':_0x41a41e}));}return BPromise['all'](_0x44b751);});})[_0xbaa1('0x6')](function(_0x411e5a){logger[_0xbaa1('0x7')](_0xbaa1('0x42'),_0x153628);logger[_0xbaa1('0xa')](_0xbaa1('0x42'),_0x153628,JSON[_0xbaa1('0xb')](_0x411e5a));_0x209ee2(_0x411e5a);})['catch'](function(_0x82e9a5){logger[_0xbaa1('0xc')](_0xbaa1('0x42'),_0x82e9a5[_0xbaa1('0xe')],_0x153628);_0x55df63(_0x456f3f[_0xbaa1('0xc')](0x1f4,_0x82e9a5['message']));});});});};exports[_0xbaa1('0x44')]=function(_0x19327f){var _0x156997=this;return new Promise(function(_0x5068d8,_0x4fdc80){db['CmContact']['describe']()[_0xbaa1('0x6')](function(_0x510281){return db[_0xbaa1('0x12')][_0xbaa1('0x13')]({'raw':_0x19327f[_0xbaa1('0x14')]?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x1d')]===undefined?!![]:![]:!![],'where':_0x19327f[_0xbaa1('0x14')]?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x15')]||null:null,'attributes':_0x19327f[_0xbaa1('0x14')]?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x16')]||null:null,'limit':_0x19327f['options']?_0x19327f[_0xbaa1('0x14')][_0xbaa1('0x17')]||null:null,'include':_0x19327f[_0xbaa1('0x14')]?_0x19327f['options'][_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x19327f['options'][_0xbaa1('0x18')],function(_0x44737c){return{'model':db[_0x44737c['model']],'as':_0x44737c['as'],'attributes':_0x44737c['as']===_0xbaa1('0x2d')?_[_0xbaa1('0x45')](_0x510281):_0x44737c[_0xbaa1('0x16')],'include':_0x44737c[_0xbaa1('0x18')]?_['map'](_0x44737c[_0xbaa1('0x18')],function(_0x6e15d4){return{'model':db[_0x6e15d4['model']],'as':_0x6e15d4['as'],'attributes':_0x6e15d4['attributes'],'include':_0x6e15d4[_0xbaa1('0x18')]?_[_0xbaa1('0x1a')](_0x6e15d4['include'],function(_0x49b4a2){return{'model':db[_0x49b4a2['model']],'as':_0x49b4a2['as'],'attributes':_0x49b4a2[_0xbaa1('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbaa1('0x6')](function(_0xaa3603){logger['info']('GetCmHopper',_0x19327f);logger['debug'](_0xbaa1('0x11'),_0x19327f,JSON[_0xbaa1('0xb')](_0xaa3603));_0x5068d8(_0xaa3603);})['catch'](function(_0x505b21){logger[_0xbaa1('0xc')](_0xbaa1('0x11'),_0x505b21[_0xbaa1('0xe')],_0x19327f);_0x4fdc80(_0x156997[_0xbaa1('0xc')](0x1f4,_0x505b21[_0xbaa1('0xe')]));});});});};exports['GetContactByPhone']=function(_0x2619cd){var _0x3708b6=this;return new Promise(function(_0x4fc6da,_0x293458){return db[_0xbaa1('0x27')][_0xbaa1('0x46')]({'raw':!![],'where':{'phone':_0x2619cd[_0xbaa1('0x14')][_0xbaa1('0x15')]['phone']},'attributes':['id',_0xbaa1('0x47')],'order':[['id',_0xbaa1('0x48')]]})[_0xbaa1('0x6')](function(_0x3e9a91){logger['info'](_0xbaa1('0x49'),_0x2619cd);logger[_0xbaa1('0xa')](_0xbaa1('0x49'),_0x2619cd,JSON[_0xbaa1('0xb')](_0x3e9a91));_0x4fc6da(_0x3e9a91);})[_0xbaa1('0x10')](function(_0x15fb4d){logger[_0xbaa1('0xc')](_0xbaa1('0x49'),_0x15fb4d[_0xbaa1('0xe')],_0x2619cd);_0x293458(_0x3708b6[_0xbaa1('0xc')](0x1f4,_0x15fb4d[_0xbaa1('0xe')]));});});};exports[_0xbaa1('0x4a')]=function(_0x593c96){var _0xea8b67=this;return new Promise(function(_0x1f5351,_0x7f86e){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x479f39){return db[_0xbaa1('0x12')][_0xbaa1('0x22')]({'active':![]},{'where':{},'transaction':_0x479f39})[_0xbaa1('0x6')](function(_0x53515d){logger[_0xbaa1('0x7')](_0xbaa1('0x4a'),_0x593c96);logger[_0xbaa1('0xa')](_0xbaa1('0x4a'),_0x593c96,JSON[_0xbaa1('0xb')](_0x53515d));_0x1f5351(_0x53515d);})['catch'](function(_0x29fe90){logger[_0xbaa1('0xc')](_0xbaa1('0x4a'),_0x29fe90['message'],_0x593c96);_0x7f86e(_0xea8b67['error'](0x1f4,_0x29fe90[_0xbaa1('0xe')]));});});});};exports[_0xbaa1('0x4b')]=function(_0x35e555){var _0x1f3b72=this;var _0x561f25=_0x35e555['body'][_0xbaa1('0x15')][_0xbaa1('0x4c')];var _0x50de9d=_0x35e555['body'][_0xbaa1('0x15')]['interval'];var _0x31ab82=_0x35e555[_0xbaa1('0x20')][_0xbaa1('0x15')]['availableAgentsIds'];return new Promise(function(_0x3b9c15,_0x10a4dc){return db[_0xbaa1('0x12')]['findAll']({'where':{'voiceQueueId':{'$in':_0x561f25},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xbaa1('0x28')]['literal'](_0xbaa1('0x4d')+_0x50de9d+_0xbaa1('0x4e')),'$gt':db[_0xbaa1('0x28')]['literal'](_0xbaa1('0x4f'))}},'UserId':{'$in':_0x31ab82}},'include':[{'model':db['CmContact'],'as':_0xbaa1('0x2d')},{'model':db[_0xbaa1('0x50')],'as':'Agent','attributes':['id',_0xbaa1('0x2f'),'voicePause']},{'model':db[_0xbaa1('0x51')],'as':_0xbaa1('0x52')}]})[_0xbaa1('0x6')](function(_0x118bf5){if(_0x118bf5[_0xbaa1('0x30')]>0x0){return db[_0xbaa1('0x28')][_0xbaa1('0x29')](function(_0x49e25a){return db[_0xbaa1('0x12')]['update']({'recallmeNotifiedDate':db[_0xbaa1('0x28')]['literal'](_0xbaa1('0x4f'))},{'where':{'id':{'$in':_[_0xbaa1('0x1a')](_0x118bf5,'id')}},'transaction':_0x49e25a})[_0xbaa1('0x6')](function(){_0x3b9c15(_0x118bf5);})[_0xbaa1('0x10')](function(_0x4f18c1){logger[_0xbaa1('0xc')]('CmHopperHandlePreviewRecallNotifications',_0x4f18c1[_0xbaa1('0xe')],_0x35e555);_0x10a4dc(_0x1f3b72[_0xbaa1('0xc')](0x1f4,_0x4f18c1['message']));});})[_0xbaa1('0x10')](function(_0x401667){logger[_0xbaa1('0xc')]('CmHopperHandlePreviewRecallNotifications',_0x401667[_0xbaa1('0xe')],_0x35e555);_0x10a4dc(_0x1f3b72[_0xbaa1('0xc')](0x1f4,_0x401667[_0xbaa1('0xe')]));});}else{_0x3b9c15(_0x118bf5);}});});}; \ No newline at end of file +var _0x553e=['`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','UserId','LOCK','UPDATE','GetCmHopperPreview','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetCmHopper','CmHopper','options','attributes','limit','include','map','model','debug','ShowCmHopper','find','where','create','raw','CreateCmHopper','UpdateCmHopper','update','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','Contact','keys','User','Agent','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x553e,0x10f));var _0xe553=function(_0x24550b,_0x414138){_0x24550b=_0x24550b-0x0;var _0x57296a=_0x553e[_0x24550b];return _0x57296a;};'use strict';var _=require(_0xe553('0x0'));var util=require(_0xe553('0x1'));var moment=require(_0xe553('0x2'));var BPromise=require(_0xe553('0x3'));var db=require(_0xe553('0x4'))['db'];var logger=require(_0xe553('0x5'))('rpc');var jayson=require(_0xe553('0x6'));var client=jayson[_0xe553('0x7')][_0xe553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc16183,_0x13dce3,_0x1c2149){return new BPromise(function(_0x325813,_0x4c7741){return client[_0xe553('0x9')](_0xc16183,_0x1c2149)[_0xe553('0xa')](function(_0x2edbc5){logger[_0xe553('0xb')](_0xe553('0xc'),_0x13dce3,'request\x20sent');logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x13dce3,'request\x20sent',JSON[_0xe553('0xd')](_0x2edbc5));if(_0x2edbc5[_0xe553('0xe')]){if(_0x2edbc5[_0xe553('0xe')][_0xe553('0xf')]===0x1f4){logger[_0xe553('0xe')]('CmHopper,\x20%s,\x20%s',_0x13dce3,_0x2edbc5[_0xe553('0xe')]['message']);return _0x4c7741(_0x2edbc5['error'][_0xe553('0x10')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x13dce3,_0x2edbc5['error']['message']);return _0x325813(_0x2edbc5[_0xe553('0xe')][_0xe553('0x10')]);}else{logger[_0xe553('0xb')](_0xe553('0xc'),_0x13dce3,_0xe553('0x11'));_0x325813(_0x2edbc5[_0xe553('0x12')][_0xe553('0x10')]);}})[_0xe553('0x13')](function(_0x23fbee){logger['error']('CmHopper,\x20%s,\x20%s',_0x13dce3,_0x23fbee);_0x4c7741(_0x23fbee);});});}exports[_0xe553('0x14')]=function(_0x48bff4){var _0x323f08=this;return new Promise(function(_0x464e1a,_0x2776c0){return db[_0xe553('0x15')]['findAll']({'raw':_0x48bff4[_0xe553('0x16')]?_0x48bff4[_0xe553('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x48bff4[_0xe553('0x16')]?_0x48bff4[_0xe553('0x16')]['where']||null:null,'attributes':_0x48bff4[_0xe553('0x16')]?_0x48bff4[_0xe553('0x16')][_0xe553('0x17')]||null:null,'limit':_0x48bff4['options']?_0x48bff4['options'][_0xe553('0x18')]||null:null,'include':_0x48bff4[_0xe553('0x16')]?_0x48bff4[_0xe553('0x16')][_0xe553('0x19')]?_[_0xe553('0x1a')](_0x48bff4[_0xe553('0x16')][_0xe553('0x19')],function(_0x507727){return{'model':db[_0x507727[_0xe553('0x1b')]],'as':_0x507727['as'],'attributes':_0x507727[_0xe553('0x17')],'include':_0x507727['include']?_[_0xe553('0x1a')](_0x507727[_0xe553('0x19')],function(_0xbf68a){return{'model':db[_0xbf68a[_0xe553('0x1b')]],'as':_0xbf68a['as'],'attributes':_0xbf68a[_0xe553('0x17')],'include':_0xbf68a['include']?_[_0xe553('0x1a')](_0xbf68a[_0xe553('0x19')],function(_0x5dc12f){return{'model':db[_0x5dc12f[_0xe553('0x1b')]],'as':_0x5dc12f['as'],'attributes':_0x5dc12f[_0xe553('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe553('0xa')](function(_0x33e8f0){logger[_0xe553('0xb')](_0xe553('0x14'),_0x48bff4);logger[_0xe553('0x1c')](_0xe553('0x14'),_0x48bff4,JSON[_0xe553('0xd')](_0x33e8f0));_0x464e1a(_0x33e8f0);})['catch'](function(_0x585f59){logger['error'](_0xe553('0x14'),_0x585f59['message'],_0x48bff4);_0x2776c0(_0x323f08['error'](0x1f4,_0x585f59[_0xe553('0x10')]));});});};exports[_0xe553('0x1d')]=function(_0x35c7c1){var _0x2f453a=this;return new Promise(function(_0x40f7af,_0x1aeccd){return db[_0xe553('0x15')][_0xe553('0x1e')]({'raw':_0x35c7c1['options']?_0x35c7c1['options']['raw']===undefined?!![]:![]:!![],'where':_0x35c7c1['options']?_0x35c7c1[_0xe553('0x16')][_0xe553('0x1f')]||null:null,'attributes':_0x35c7c1[_0xe553('0x16')]?_0x35c7c1[_0xe553('0x16')][_0xe553('0x17')]||null:null,'include':_0x35c7c1[_0xe553('0x16')]?_0x35c7c1['options'][_0xe553('0x19')]?_[_0xe553('0x1a')](_0x35c7c1[_0xe553('0x16')][_0xe553('0x19')],function(_0x4b435e){return{'model':db[_0x4b435e['model']],'as':_0x4b435e['as'],'attributes':_0x4b435e[_0xe553('0x17')],'include':_0x4b435e['include']?_[_0xe553('0x1a')](_0x4b435e[_0xe553('0x19')],function(_0x13bfe0){return{'model':db[_0x13bfe0[_0xe553('0x1b')]],'as':_0x13bfe0['as'],'attributes':_0x13bfe0['attributes'],'include':_0x13bfe0[_0xe553('0x19')]?_[_0xe553('0x1a')](_0x13bfe0['include'],function(_0x98b039){return{'model':db[_0x98b039['model']],'as':_0x98b039['as'],'attributes':_0x98b039['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22f668){logger[_0xe553('0xb')]('ShowCmHopper',_0x35c7c1);logger[_0xe553('0x1c')](_0xe553('0x1d'),_0x35c7c1,JSON[_0xe553('0xd')](_0x22f668));_0x40f7af(_0x22f668);})['catch'](function(_0xbab493){logger[_0xe553('0xe')](_0xe553('0x1d'),_0xbab493[_0xe553('0x10')],_0x35c7c1);_0x1aeccd(_0x2f453a[_0xe553('0xe')](0x1f4,_0xbab493[_0xe553('0x10')]));});});};exports['CreateCmHopper']=function(_0x213d27){var _0x45aad2=this;return new Promise(function(_0xc25654,_0x510bf1){return db['CmHopper'][_0xe553('0x20')](_0x213d27['body'],{'raw':_0x213d27[_0xe553('0x16')]?_0x213d27[_0xe553('0x16')][_0xe553('0x21')]===undefined?!![]:![]:!![]})[_0xe553('0xa')](function(_0x4e6e6a){logger[_0xe553('0xb')]('CreateCmHopper',_0x213d27);logger['debug'](_0xe553('0x22'),_0x213d27,JSON[_0xe553('0xd')](_0x4e6e6a));_0xc25654(_0x4e6e6a);})[_0xe553('0x13')](function(_0x4a50cb){logger[_0xe553('0xe')](_0xe553('0x22'),_0x4a50cb[_0xe553('0x10')],_0x213d27);_0x510bf1(_0x45aad2[_0xe553('0xe')](0x1f4,_0x4a50cb[_0xe553('0x10')]));});});};exports[_0xe553('0x23')]=function(_0x132338){var _0x111b68=this;return new Promise(function(_0x949189,_0x310b0c){return db[_0xe553('0x15')][_0xe553('0x24')](_0x132338[_0xe553('0x25')],{'raw':_0x132338[_0xe553('0x16')]?_0x132338[_0xe553('0x16')][_0xe553('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132338[_0xe553('0x16')]?_0x132338[_0xe553('0x16')][_0xe553('0x1f')]||null:null,'attributes':_0x132338['options']?_0x132338[_0xe553('0x16')][_0xe553('0x17')]||null:null,'limit':_0x132338['options']?_0x132338[_0xe553('0x16')][_0xe553('0x18')]||null:null})[_0xe553('0xa')](function(_0xda9897){logger['info'](_0xe553('0x23'),_0x132338);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xe553('0xd')](_0x132338[_0xe553('0x16')][_0xe553('0x1f')]),_0x132338['body'][_0xe553('0x26')]);logger[_0xe553('0x1c')](_0xe553('0x23'),_0x132338,JSON['stringify'](_0xda9897));_0x949189(_0xda9897);})[_0xe553('0x13')](function(_0x2e200f){logger[_0xe553('0xe')](_0xe553('0x23'),_0x2e200f[_0xe553('0x10')],_0x132338);_0x310b0c(_0x111b68[_0xe553('0xe')](0x1f4,_0x2e200f[_0xe553('0x10')]));});});};exports[_0xe553('0x27')]=function(_0x36cb31){var _0x2d4f0b=this;return new Promise(function(_0x370fa2,_0x4e3102){return db[_0xe553('0x15')][_0xe553('0x28')]({'where':_0x36cb31[_0xe553('0x16')]?_0x36cb31[_0xe553('0x16')][_0xe553('0x1f')]||null:null})['then'](function(_0x3df08d){logger['info'](_0xe553('0x27'),_0x36cb31);logger[_0xe553('0x1c')]('DestroyCmHopper',_0x36cb31,JSON[_0xe553('0xd')](_0x3df08d));_0x370fa2(_0x3df08d);})[_0xe553('0x13')](function(_0x40989a){logger[_0xe553('0xe')](_0xe553('0x27'),_0x40989a[_0xe553('0x10')],_0x36cb31);_0x4e3102(_0x2d4f0b[_0xe553('0xe')](0x1f4,_0x40989a[_0xe553('0x10')]));});});};exports[_0xe553('0x29')]=function(_0x1953e){var _0x45d24a=this;return new Promise(function(_0x3a8fc7,_0x2d1510){return db[_0xe553('0x2a')][_0xe553('0x2b')]()[_0xe553('0xa')](function(_0x26c27d){return db[_0xe553('0x2c')][_0xe553('0x2d')](function(_0x2e278b){return db['CmHopper'][_0xe553('0x2e')]({'where':_0x1953e[_0xe553('0x16')]?_0x1953e[_0xe553('0x16')][_0xe553('0x1f')]||null:null,'attributes':_0x1953e['options']?_0x1953e[_0xe553('0x16')][_0xe553('0x17')]||null:null,'limit':_0x1953e['options']?_0x1953e[_0xe553('0x16')][_0xe553('0x18')]||null:null,'order':_0x1953e['options']?_0x1953e[_0xe553('0x16')][_0xe553('0x2f')]||null:null,'transaction':_0x2e278b,'lock':_0x2e278b['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xe553('0x30'),'attributes':_[_0xe553('0x31')](_0x26c27d)},{'model':db[_0xe553('0x32')],'as':_0xe553('0x33'),'attributes':['id','name',_0xe553('0x34')]}]})[_0xe553('0xa')](function(_0x1e86cf){var _0x5e69cf=[];var _0x4969ef=[];for(var _0x5f5a7b=0x0;_0x5f5a7b<_0x1e86cf[_0xe553('0x35')];_0x5f5a7b+=0x1){var _0x28e0b4=_0x1e86cf[_0x5f5a7b]['UserId'];if(_0x28e0b4===null){_0x5e69cf['push'](_0x1e86cf[_0x5f5a7b]['update'](_0x1953e[_0xe553('0x25')],{'transaction':_0x2e278b}));}else if(!_0x4969ef[_0xe553('0x36')](_0x28e0b4)){_0x4969ef[_0xe553('0x37')](_0x28e0b4);_0x5e69cf[_0xe553('0x37')](_0x1e86cf[_0x5f5a7b]['update'](_0x1953e[_0xe553('0x25')],{'transaction':_0x2e278b}));}}return BPromise[_0xe553('0x38')](_0x5e69cf);});})['then'](function(_0x2eb073){logger[_0xe553('0xb')](_0xe553('0x29'),_0x1953e);if(_0x2eb073[_0xe553('0x35')]>0x0){logger[_0xe553('0xb')](_0xe553('0x39'),_0x2eb073[0x0][_0xe553('0x3a')]['id'],_0x2eb073[0x0][_0xe553('0x3a')]['ContactId'],_0x2eb073[0x0][_0xe553('0x3a')][_0xe553('0x26')]);}logger[_0xe553('0x1c')]('GetContactDialer',_0x1953e,JSON[_0xe553('0xd')](_0x2eb073));_0x3a8fc7(_0x2eb073);})[_0xe553('0x13')](function(_0x48dc00){logger['error'](_0xe553('0x29'),_0x48dc00['message'],_0x1953e);_0x2d1510(_0x45d24a[_0xe553('0xe')](0x1f4,_0x48dc00['message']));});});});};exports[_0xe553('0x3b')]=function(_0x32883d){var _0x1fd83d=this;return new Promise(function(_0x53bd7e,_0x4a3451){return db[_0xe553('0x2c')]['transaction'](function(_0x35054c){return db[_0xe553('0x3c')][_0xe553('0x20')](_0x32883d['body'],{'raw':_0x32883d[_0xe553('0x16')]?_0x32883d['options'][_0xe553('0x21')]===undefined?!![]:![]:!![],'transaction':_0x35054c})[_0xe553('0xa')](function(){logger['info'](_0xe553('0x3d'),JSON['stringify'](_0x32883d[_0xe553('0x16')][_0xe553('0x1f')]),_0x32883d[_0xe553('0x16')][_0xe553('0x1f')][_0xe553('0x26')]);return db[_0xe553('0x15')]['destroy']({'where':_0x32883d['options']?_0x32883d[_0xe553('0x16')][_0xe553('0x1f')]||null:null,'transaction':_0x35054c});});})[_0xe553('0xa')](function(_0x273685){logger[_0xe553('0xb')]('MoveContactManagedDialer',_0x32883d);logger[_0xe553('0x1c')](_0xe553('0x3b'),_0x32883d,JSON[_0xe553('0xd')](_0x273685));_0x53bd7e(_0x273685);})[_0xe553('0x13')](function(_0x1143c4){logger[_0xe553('0xe')](_0xe553('0x3b'),_0x1143c4[_0xe553('0x10')],_0x32883d);_0x4a3451(_0x1fd83d[_0xe553('0xe')](0x1f4,_0x1143c4['message']));});});};exports[_0xe553('0x3e')]=function(_0x25f4b0){var _0x1f3372=this;return new Promise(function(_0x365d14,_0xf8e557){return db[_0xe553('0x15')]['findAll']({'raw':_0x25f4b0['options']?_0x25f4b0[_0xe553('0x16')][_0xe553('0x21')]===undefined?!![]:![]:!![],'where':_0x25f4b0[_0xe553('0x16')]?_0x25f4b0['options']['where']||null:null,'attributes':[[db[_0xe553('0x2c')]['fn'](_0xe553('0x3f'),db[_0xe553('0x2c')]['fn']('IF',db[_0xe553('0x2c')][_0xe553('0x40')](_0xe553('0x41')+util['format']('\x22%s\x22',moment()[_0xe553('0x42')](_0xe553('0x43')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x4e0f98){logger[_0xe553('0xb')]('CountReScheduled',_0x25f4b0);logger[_0xe553('0x1c')]('CountReScheduled',_0x25f4b0,JSON[_0xe553('0xd')](_0x4e0f98));_0x365d14(_0x4e0f98);})[_0xe553('0x13')](function(_0x3d8d40){logger[_0xe553('0xe')](_0xe553('0x3e'),_0x3d8d40['message'],_0x25f4b0);_0xf8e557(_0x1f3372[_0xe553('0xe')](0x1f4,_0x3d8d40[_0xe553('0x10')]));});});};exports[_0xe553('0x44')]=function(_0x346df9){var _0x30aaa4=this;return new Promise(function(_0x255cf3,_0x952c14){return db[_0xe553('0x2a')][_0xe553('0x2b')]()['then'](function(_0x54a14b){return db[_0xe553('0x2c')][_0xe553('0x2d')](function(_0x5f1062){return db[_0xe553('0x15')][_0xe553('0x2e')]({'where':_0x346df9[_0xe553('0x16')]?_0x346df9['options'][_0xe553('0x1f')]||null:null,'attributes':_0x346df9[_0xe553('0x16')]?_0x346df9[_0xe553('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x346df9[_0xe553('0x16')]?_0x346df9[_0xe553('0x16')][_0xe553('0x2f')]||null:null,'group':db[_0xe553('0x15')][_0xe553('0x45')],'transaction':_0x5f1062,'lock':_0x5f1062[_0xe553('0x46')][_0xe553('0x47')],'include':_0x346df9[_0xe553('0x16')]?_0x346df9[_0xe553('0x16')][_0xe553('0x19')]?_[_0xe553('0x1a')](_0x346df9[_0xe553('0x16')][_0xe553('0x19')],function(_0x581090){return{'model':db[_0x581090[_0xe553('0x1b')]],'as':_0x581090['as'],'attributes':_0x581090[_0xe553('0x17')],'include':_0x581090[_0xe553('0x19')]?_[_0xe553('0x1a')](_0x581090['include'],function(_0x11d9eb){return{'model':db[_0x11d9eb['model']],'as':_0x11d9eb['as'],'attributes':_0x11d9eb[_0xe553('0x17')],'include':_0x11d9eb[_0xe553('0x19')]?_[_0xe553('0x1a')](_0x11d9eb[_0xe553('0x19')],function(_0x5cd55e){return{'model':db[_0x5cd55e[_0xe553('0x1b')]],'as':_0x5cd55e['as'],'attributes':_0x5cd55e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe553('0xa')](function(_0x2934c8){var _0x57c8b4=[];for(var _0x499708=0x0;_0x499708<_0x2934c8[_0xe553('0x35')];_0x499708+=0x1){_0x57c8b4['push'](_0x2934c8[_0x499708]['update'](_0x346df9[_0xe553('0x25')],{'transaction':_0x5f1062}));}return BPromise[_0xe553('0x38')](_0x57c8b4);});})[_0xe553('0xa')](function(_0x2fd802){logger[_0xe553('0xb')](_0xe553('0x44'),_0x346df9);logger[_0xe553('0x1c')](_0xe553('0x44'),_0x346df9,JSON[_0xe553('0xd')](_0x2fd802));_0x255cf3(_0x2fd802);})['catch'](function(_0x2a48de){logger[_0xe553('0xe')](_0xe553('0x44'),_0x2a48de[_0xe553('0x10')],_0x346df9);_0x952c14(_0x30aaa4[_0xe553('0xe')](0x1f4,_0x2a48de[_0xe553('0x10')]));});});});};exports[_0xe553('0x48')]=function(_0x136ab8){var _0x36ec50=this;return new Promise(function(_0x31fcab,_0x476eca){db['CmContact'][_0xe553('0x2b')]()[_0xe553('0xa')](function(_0x42ee92){return db[_0xe553('0x15')][_0xe553('0x2e')]({'raw':_0x136ab8[_0xe553('0x16')]?_0x136ab8['options'][_0xe553('0x21')]===undefined?!![]:![]:!![],'where':_0x136ab8[_0xe553('0x16')]?_0x136ab8['options'][_0xe553('0x1f')]||null:null,'attributes':_0x136ab8[_0xe553('0x16')]?_0x136ab8[_0xe553('0x16')]['attributes']||null:null,'limit':_0x136ab8[_0xe553('0x16')]?_0x136ab8['options']['limit']||null:null,'include':_0x136ab8['options']?_0x136ab8['options']['include']?_['map'](_0x136ab8[_0xe553('0x16')][_0xe553('0x19')],function(_0x16d039){return{'model':db[_0x16d039['model']],'as':_0x16d039['as'],'attributes':_0x16d039['as']==='Contact'?_[_0xe553('0x31')](_0x42ee92):_0x16d039['attributes'],'include':_0x16d039[_0xe553('0x19')]?_['map'](_0x16d039['include'],function(_0x315004){return{'model':db[_0x315004[_0xe553('0x1b')]],'as':_0x315004['as'],'attributes':_0x315004[_0xe553('0x17')],'include':_0x315004[_0xe553('0x19')]?_[_0xe553('0x1a')](_0x315004[_0xe553('0x19')],function(_0xb679f1){return{'model':db[_0xb679f1['model']],'as':_0xb679f1['as'],'attributes':_0xb679f1[_0xe553('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe553('0xa')](function(_0x4ca2ac){logger[_0xe553('0xb')]('GetCmHopper',_0x136ab8);logger['debug'](_0xe553('0x14'),_0x136ab8,JSON[_0xe553('0xd')](_0x4ca2ac));_0x31fcab(_0x4ca2ac);})[_0xe553('0x13')](function(_0x4245b4){logger[_0xe553('0xe')](_0xe553('0x14'),_0x4245b4['message'],_0x136ab8);_0x476eca(_0x36ec50[_0xe553('0xe')](0x1f4,_0x4245b4['message']));});});});};exports['GetContactByPhone']=function(_0x3504f6){var _0x422cce=this;return new Promise(function(_0x1c6289,_0x4862c3){return db['CmContact'][_0xe553('0x49')]({'raw':!![],'where':{'phone':_0x3504f6[_0xe553('0x16')][_0xe553('0x1f')][_0xe553('0x4a')]},'attributes':['id','dialTimezone'],'order':[['id',_0xe553('0x4b')]]})['then'](function(_0x119fa1){logger['info'](_0xe553('0x4c'),_0x3504f6);logger[_0xe553('0x1c')]('getContactByPhone',_0x3504f6,JSON[_0xe553('0xd')](_0x119fa1));_0x1c6289(_0x119fa1);})['catch'](function(_0x410451){logger[_0xe553('0xe')](_0xe553('0x4c'),_0x410451[_0xe553('0x10')],_0x3504f6);_0x4862c3(_0x422cce[_0xe553('0xe')](0x1f4,_0x410451['message']));});});};exports[_0xe553('0x4d')]=function(_0x9abc23){var _0x402967=this;return new Promise(function(_0x35da7f,_0x34fe37){return db[_0xe553('0x2c')][_0xe553('0x2d')](function(_0x49f6c3){return db[_0xe553('0x15')][_0xe553('0x24')]({'active':![]},{'where':{},'transaction':_0x49f6c3})[_0xe553('0xa')](function(_0x553f83){logger[_0xe553('0xb')](_0xe553('0x4d'),_0x9abc23);logger[_0xe553('0x1c')](_0xe553('0x4d'),_0x9abc23,JSON[_0xe553('0xd')](_0x553f83));_0x35da7f(_0x553f83);})[_0xe553('0x13')](function(_0x56f8d8){logger[_0xe553('0xe')]('ResetActiveCalls',_0x56f8d8[_0xe553('0x10')],_0x9abc23);_0x34fe37(_0x402967[_0xe553('0xe')](0x1f4,_0x56f8d8['message']));});});});};exports[_0xe553('0x4e')]=function(_0x305ef6){var _0x25dcaf=this;var _0x31eda5=_0x305ef6[_0xe553('0x25')][_0xe553('0x1f')]['voiceQueueIds'];var _0x54ab72=_0x305ef6['body']['where']['interval'];var _0x2e7365=_0x305ef6[_0xe553('0x25')][_0xe553('0x1f')][_0xe553('0x4f')];return new Promise(function(_0x4f0e2e,_0x192d42){return db['CmHopper'][_0xe553('0x2e')]({'where':{'voiceQueueId':{'$in':_0x31eda5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe553('0x2c')]['literal'](_0xe553('0x50')+_0x54ab72+_0xe553('0x51')),'$gt':db[_0xe553('0x2c')][_0xe553('0x40')](_0xe553('0x52'))}},'UserId':{'$in':_0x2e7365}},'include':[{'model':db[_0xe553('0x2a')],'as':_0xe553('0x30')},{'model':db[_0xe553('0x32')],'as':'Agent','attributes':['id',_0xe553('0x53'),'voicePause']},{'model':db['CmList'],'as':'List'}]})['then'](function(_0x47117b){if(_0x47117b[_0xe553('0x35')]>0x0){return db[_0xe553('0x2c')][_0xe553('0x2d')](function(_0x221019){return db[_0xe553('0x15')]['update']({'recallmeNotifiedDate':db[_0xe553('0x2c')]['literal'](_0xe553('0x52'))},{'where':{'id':{'$in':_['map'](_0x47117b,'id')}},'transaction':_0x221019})[_0xe553('0xa')](function(){_0x4f0e2e(_0x47117b);})[_0xe553('0x13')](function(_0x39217f){logger[_0xe553('0xe')](_0xe553('0x4e'),_0x39217f[_0xe553('0x10')],_0x305ef6);_0x192d42(_0x25dcaf[_0xe553('0xe')](0x1f4,_0x39217f['message']));});})[_0xe553('0x13')](function(_0x286baa){logger[_0xe553('0xe')]('CmHopperHandlePreviewRecallNotifications',_0x286baa['message'],_0x305ef6);_0x192d42(_0x25dcaf['error'](0x1f4,_0x286baa['message']));});}else{_0x4f0e2e(_0x47117b);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 942dd8e..2cfe584 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 _0x87f8=['/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','/timezones','getTimezones','/:id','show'];(function(_0x94c271,_0x2a198f){var _0x5cad1e=function(_0x5eeca1){while(--_0x5eeca1){_0x94c271['push'](_0x94c271['shift']());}};_0x5cad1e(++_0x2a198f);}(_0x87f8,0x11f));var _0x887f=function(_0x51b707,_0xdd6c8c){_0x51b707=_0x51b707-0x0;var _0x2b679e=_0x87f8[_0x51b707];return _0x2b679e;};'use strict';var express=require(_0x887f('0x0'));var router=express[_0x887f('0x1')]();var auth=require(_0x887f('0x2'));var controller=require(_0x887f('0x3'));router[_0x887f('0x4')]('/',auth[_0x887f('0x5')](),controller[_0x887f('0x6')]);router[_0x887f('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x887f('0x4')](_0x887f('0x7'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x887f('0x8'),auth['isAuthenticated'](),controller[_0x887f('0x9')]);router[_0x887f('0x4')](_0x887f('0xa'),auth[_0x887f('0x5')](),controller[_0x887f('0xb')]);router['get'](_0x887f('0xc'),auth['isAuthenticated'](),controller[_0x887f('0xd')]);router[_0x887f('0xe')]('/',auth[_0x887f('0x5')](),controller[_0x887f('0xf')]);router[_0x887f('0xe')](_0x887f('0x10'),auth['isAuthenticated'](),controller[_0x887f('0x11')]);router[_0x887f('0xe')]('/timezone',auth[_0x887f('0x5')](),controller[_0x887f('0x12')]);router[_0x887f('0x13')](_0x887f('0xa'),auth[_0x887f('0x5')](),controller[_0x887f('0x14')]);router[_0x887f('0x15')](_0x887f('0xa'),auth[_0x887f('0x5')](),controller['destroy']);module[_0x887f('0x16')]=router; \ No newline at end of file +var _0x8df8=['/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','post','/preview','getPreview','getTimezone','update','delete','destroy','exports','Router','isAuthenticated','index','get','/describe'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8df8,0x67));var _0x88df=function(_0x2ea356,_0x4c373b){_0x2ea356=_0x2ea356-0x0;var _0x1439d5=_0x8df8[_0x2ea356];return _0x1439d5;};'use strict';var express=require('express');var router=express[_0x88df('0x0')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router['get']('/',auth[_0x88df('0x1')](),controller[_0x88df('0x2')]);router[_0x88df('0x3')](_0x88df('0x4'),auth[_0x88df('0x1')](),controller['describe']);router[_0x88df('0x3')](_0x88df('0x5'),auth[_0x88df('0x1')](),controller[_0x88df('0x6')]);router['get'](_0x88df('0x7'),auth[_0x88df('0x1')](),controller[_0x88df('0x8')]);router[_0x88df('0x3')](_0x88df('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/previewrecall',auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x88df('0xa')]('/',auth[_0x88df('0x1')](),controller['create']);router['post'](_0x88df('0xb'),auth[_0x88df('0x1')](),controller[_0x88df('0xc')]);router[_0x88df('0xa')]('/timezone',auth[_0x88df('0x1')](),controller[_0x88df('0xd')]);router['put'](_0x88df('0x9'),auth[_0x88df('0x1')](),controller[_0x88df('0xe')]);router[_0x88df('0xf')](_0x88df('0x9'),auth[_0x88df('0x1')](),controller[_0x88df('0x10')]);module[_0x88df('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index afd6250..854fb93 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 _0x7ca0=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x3e71f4,_0x243f07){var _0x3a144f=function(_0x5e8f7b){while(--_0x5e8f7b){_0x3e71f4['push'](_0x3e71f4['shift']());}};_0x3a144f(++_0x243f07);}(_0x7ca0,0x19d));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x07ca('0x0'));var Sequelize=require(_0x07ca('0x1'));module[_0x07ca('0x2')]={'CmHopperId':{'type':Sequelize[_0x07ca('0x3')]},'phone':{'type':Sequelize[_0x07ca('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x07ca('0x5')],'defaultValue':moment()[_0x07ca('0x6')](_0x07ca('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x07ca('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf1d8=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x47b3a2,_0x2bbb40){var _0xb35a80=function(_0x24f914){while(--_0x24f914){_0x47b3a2['push'](_0x47b3a2['shift']());}};_0xb35a80(++_0x2bbb40);}(_0xf1d8,0x17a));var _0x8f1d=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xf1d8[_0xc77819];return _0x1c9434;};'use strict';var moment=require('moment');var Sequelize=require(_0x8f1d('0x0'));module[_0x8f1d('0x1')]={'CmHopperId':{'type':Sequelize[_0x8f1d('0x2')]},'phone':{'type':Sequelize[_0x8f1d('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8f1d('0x4')],'defaultValue':moment()['format'](_0x8f1d('0x5'))},'countbusyretry':{'type':Sequelize[_0x8f1d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f1d('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8f1d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f1d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f1d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f1d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 00cd282..da95752 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 _0x8884=['index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','send'];(function(_0x390da7,_0x180e6b){var _0x38c027=function(_0x58d7b3){while(--_0x58d7b3){_0x390da7['push'](_0x390da7['shift']());}};_0x38c027(++_0x180e6b);}(_0x8884,0xcd));var _0x4888=function(_0x41c315,_0x247d26){_0x41c315=_0x41c315-0x0;var _0x4ebd35=_0x8884[_0x41c315];return _0x4ebd35;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4888('0x0'));var jsonpatch=require(_0x4888('0x1'));var rp=require(_0x4888('0x2'));var moment=require(_0x4888('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4888('0x4'));var util=require(_0x4888('0x5'));var path=require(_0x4888('0x6'));var sox=require(_0x4888('0x7'));var csv=require(_0x4888('0x8'));var ejs=require(_0x4888('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4888('0xa'));var squel=require(_0x4888('0xb'));var crypto=require('crypto');var jsforce=require(_0x4888('0xc'));var deskjs=require(_0x4888('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4888('0xe'));var Papa=require(_0x4888('0xf'));var Redis=require(_0x4888('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4888('0x11'));var as=require(_0x4888('0x12'));var hardwareService=require(_0x4888('0x13'));var logger=require(_0x4888('0x14'))(_0x4888('0x15'));var utils=require(_0x4888('0x16'));var config=require(_0x4888('0x17'));var licenseUtil=require(_0x4888('0x18'));var db=require(_0x4888('0x19'))['db'];function respondWithStatusCode(_0x2fc607,_0x1049ea){_0x1049ea=_0x1049ea||0xcc;return function(_0x9ab1fa){if(_0x9ab1fa){return _0x2fc607[_0x4888('0x1a')](_0x1049ea);}return _0x2fc607[_0x4888('0x1b')](_0x1049ea)[_0x4888('0x1c')]();};}function respondWithResult(_0x595384,_0x1f1990){_0x1f1990=_0x1f1990||0xc8;return function(_0x4831eb){if(_0x4831eb){return _0x595384['status'](_0x1f1990)[_0x4888('0x1d')](_0x4831eb);}};}function respondWithFilteredResult(_0x5d67e4,_0x269a00){return function(_0x4475b0){if(_0x4475b0){var _0x2552af=typeof _0x269a00[_0x4888('0x1e')]===_0x4888('0x1f')&&typeof _0x269a00[_0x4888('0x20')]===_0x4888('0x1f');var _0x49b6b9=_0x4475b0[_0x4888('0x21')];var _0x320e5c=_0x2552af?0x0:_0x269a00[_0x4888('0x1e')];var _0x5bd95a=_0x2552af?_0x4475b0['count']:_0x269a00[_0x4888('0x1e')]+_0x269a00[_0x4888('0x20')];var _0x16b772;if(_0x5bd95a>=_0x49b6b9){_0x5bd95a=_0x49b6b9;_0x16b772=0xc8;}else{_0x16b772=0xce;}_0x5d67e4['status'](_0x16b772);return _0x5d67e4[_0x4888('0x22')](_0x4888('0x23'),_0x320e5c+'-'+_0x5bd95a+'/'+_0x49b6b9)[_0x4888('0x1d')](_0x4475b0);}return null;};}function patchUpdates(_0x5ef57e){return function(_0x5725a2){try{jsonpatch[_0x4888('0x24')](_0x5725a2,_0x5ef57e,!![]);}catch(_0x378f06){return BPromise[_0x4888('0x25')](_0x378f06);}return _0x5725a2['save']();};}function saveUpdates(_0x15dcae,_0x20d2be){return function(_0x2e0f15){if(_0x2e0f15){return _0x2e0f15['update'](_0x15dcae)[_0x4888('0x26')](function(_0x315636){return _0x315636;});}return null;};}function removeEntity(_0x388cf0,_0x44b8d6){return function(_0x4bd62e){if(_0x4bd62e){return _0x4bd62e[_0x4888('0x27')]()[_0x4888('0x26')](function(){var _0x23ac19=_0x4bd62e[_0x4888('0x28')]({'plain':!![]});var _0x14acec='CmHopperAdditionalPhones';return db[_0x4888('0x29')][_0x4888('0x27')]({'where':{'type':_0x14acec,'resourceId':_0x23ac19['id']}})[_0x4888('0x26')](function(){return _0x4bd62e;});})[_0x4888('0x26')](function(){_0x388cf0[_0x4888('0x1b')](0xcc)[_0x4888('0x1c')]();});}};}function handleEntityNotFound(_0x18fe43,_0x4e4910){return function(_0x27f75a){if(!_0x27f75a){_0x18fe43['sendStatus'](0x194);}return _0x27f75a;};}function handleError(_0x2ddce9,_0x16ef5f){_0x16ef5f=_0x16ef5f||0x1f4;return function(_0x44e85d){logger[_0x4888('0x2a')](_0x44e85d['stack']);if(_0x44e85d['name']){delete _0x44e85d['name'];}_0x2ddce9['status'](_0x16ef5f)[_0x4888('0x2b')](_0x44e85d);};}exports[_0x4888('0x2c')]=function(_0x4e65f5,_0x499899){var _0x532e7e={},_0x362103={},_0x1d7d45={'count':0x0,'rows':[]};var _0x3d0c8e=_[_0x4888('0x2d')](db[_0x4888('0x2e')][_0x4888('0x2f')],function(_0x1697fb){return{'name':_0x1697fb[_0x4888('0x30')],'type':_0x1697fb['type']['key']};});_0x362103[_0x4888('0x31')]=_[_0x4888('0x2d')](_0x3d0c8e,'name');_0x362103[_0x4888('0x32')]=_[_0x4888('0x33')](_0x4e65f5[_0x4888('0x32')]);_0x362103[_0x4888('0x34')]=_[_0x4888('0x35')](_0x362103[_0x4888('0x31')],_0x362103[_0x4888('0x32')]);_0x532e7e[_0x4888('0x36')]=_[_0x4888('0x35')](_0x362103[_0x4888('0x31')],qs['fields'](_0x4e65f5['query']['fields']));_0x532e7e['attributes']=_0x532e7e[_0x4888('0x36')][_0x4888('0x37')]?_0x532e7e[_0x4888('0x36')]:_0x362103[_0x4888('0x31')];if(!_0x4e65f5['query'][_0x4888('0x38')]('nolimit')){_0x532e7e[_0x4888('0x20')]=qs[_0x4888('0x20')](_0x4e65f5[_0x4888('0x32')][_0x4888('0x20')]);_0x532e7e[_0x4888('0x1e')]=qs[_0x4888('0x1e')](_0x4e65f5[_0x4888('0x32')][_0x4888('0x1e')]);}_0x532e7e[_0x4888('0x39')]=qs['sort'](_0x4e65f5[_0x4888('0x32')][_0x4888('0x3a')]);_0x532e7e['where']=qs[_0x4888('0x34')](_[_0x4888('0x3b')](_0x4e65f5['query'],_0x362103[_0x4888('0x34')]),_0x3d0c8e);if(_0x4e65f5[_0x4888('0x32')][_0x4888('0x3c')]){_0x532e7e[_0x4888('0x3d')]=_[_0x4888('0x3e')](_0x532e7e[_0x4888('0x3d')],{'$or':_['map'](_0x3d0c8e,function(_0x46d67f){if(_0x46d67f['type']!==_0x4888('0x3f')){var _0x33d77e={};_0x33d77e[_0x46d67f['name']]={'$like':'%'+_0x4e65f5['query'][_0x4888('0x3c')]+'%'};return _0x33d77e;}})});}_0x532e7e=_[_0x4888('0x3e')]({},_0x532e7e,_0x4e65f5[_0x4888('0x40')]);var _0x4ce190={'where':_0x532e7e[_0x4888('0x3d')]};return db[_0x4888('0x2e')][_0x4888('0x21')](_0x4ce190)[_0x4888('0x26')](function(_0x4ec468){_0x1d7d45[_0x4888('0x21')]=_0x4ec468;if(_0x4e65f5[_0x4888('0x32')][_0x4888('0x41')]){_0x532e7e['include']=[{'all':!![]}];}return db[_0x4888('0x2e')][_0x4888('0x42')](_0x532e7e);})[_0x4888('0x26')](function(_0x354a7b){_0x1d7d45[_0x4888('0x43')]=_0x354a7b;return _0x1d7d45;})[_0x4888('0x26')](respondWithFilteredResult(_0x499899,_0x532e7e))[_0x4888('0x44')](handleError(_0x499899,null));};exports[_0x4888('0x45')]=function(_0x405d55,_0x2196c8){var _0x24fb17={'raw':!![],'where':{'id':_0x405d55[_0x4888('0x46')]['id']}},_0xbebf27={};_0xbebf27['model']=_[_0x4888('0x33')](db['CmHopperAdditionalPhone'][_0x4888('0x2f')]);_0xbebf27[_0x4888('0x32')]=_[_0x4888('0x33')](_0x405d55[_0x4888('0x32')]);_0xbebf27[_0x4888('0x34')]=_['intersection'](_0xbebf27[_0x4888('0x31')],_0xbebf27[_0x4888('0x32')]);_0x24fb17[_0x4888('0x36')]=_[_0x4888('0x35')](_0xbebf27['model'],qs[_0x4888('0x47')](_0x405d55['query'][_0x4888('0x47')]));_0x24fb17[_0x4888('0x36')]=_0x24fb17[_0x4888('0x36')][_0x4888('0x37')]?_0x24fb17[_0x4888('0x36')]:_0xbebf27[_0x4888('0x31')];if(_0x405d55[_0x4888('0x32')][_0x4888('0x41')]){_0x24fb17[_0x4888('0x48')]=[{'all':!![]}];}_0x24fb17=_[_0x4888('0x3e')]({},_0x24fb17,_0x405d55[_0x4888('0x40')]);return db[_0x4888('0x2e')][_0x4888('0x49')](_0x24fb17)[_0x4888('0x26')](handleEntityNotFound(_0x2196c8,null))['then'](respondWithResult(_0x2196c8,null))[_0x4888('0x44')](handleError(_0x2196c8,null));};exports[_0x4888('0x4a')]=function(_0x416478,_0x5dc26d){return db[_0x4888('0x2e')][_0x4888('0x4a')](_0x416478[_0x4888('0x4b')],{})[_0x4888('0x26')](function(_0x5c58a5){var _0x3cfa36=_0x416478['user'][_0x4888('0x28')]({'plain':!![]});if(!_0x3cfa36)throw new Error(_0x4888('0x4c'));if(_0x3cfa36[_0x4888('0x4d')]==='user'){var _0x25f8dc=_0x5c58a5['get']({'plain':!![]});var _0x4dd1fd='CmHopperAdditionalPhones';return db[_0x4888('0x4e')][_0x4888('0x49')]({'where':{'name':_0x4dd1fd,'userProfileId':_0x3cfa36[_0x4888('0x4f')]},'raw':!![]})[_0x4888('0x26')](function(_0x1268a4){if(_0x1268a4&&_0x1268a4['autoAssociation']===0x0){return db[_0x4888('0x29')][_0x4888('0x4a')]({'name':_0x25f8dc[_0x4888('0x50')],'resourceId':_0x25f8dc['id'],'type':_0x1268a4[_0x4888('0x50')],'sectionId':_0x1268a4['id']},{})[_0x4888('0x26')](function(){return _0x5c58a5;});}else{return _0x5c58a5;}})[_0x4888('0x44')](function(_0x25e0e1){logger[_0x4888('0x2a')](_0x4888('0x51'),_0x25e0e1);throw _0x25e0e1;});}return _0x5c58a5;})[_0x4888('0x26')](respondWithResult(_0x5dc26d,0xc9))[_0x4888('0x44')](handleError(_0x5dc26d,null));};exports[_0x4888('0x52')]=function(_0x4a722c,_0x3083e9){if(_0x4a722c[_0x4888('0x4b')]['id']){delete _0x4a722c[_0x4888('0x4b')]['id'];}return db[_0x4888('0x2e')]['find']({'where':{'id':_0x4a722c[_0x4888('0x46')]['id']}})[_0x4888('0x26')](handleEntityNotFound(_0x3083e9,null))[_0x4888('0x26')](saveUpdates(_0x4a722c[_0x4888('0x4b')],null))[_0x4888('0x26')](respondWithResult(_0x3083e9,null))[_0x4888('0x44')](handleError(_0x3083e9,null));};exports[_0x4888('0x27')]=function(_0x13843a,_0x3de4a7){return db[_0x4888('0x2e')]['find']({'where':{'id':_0x13843a['params']['id']}})[_0x4888('0x26')](handleEntityNotFound(_0x3de4a7,null))[_0x4888('0x26')](removeEntity(_0x3de4a7,null))['catch'](handleError(_0x3de4a7,null));}; \ No newline at end of file +var _0x1ded=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1ded,0xf7));var _0xd1de=function(_0x3f44c4,_0x16d23a){_0x3f44c4=_0x3f44c4-0x0;var _0xd4c102=_0x1ded[_0x3f44c4];return _0xd4c102;};'use strict';var emlformat=require(_0xd1de('0x0'));var rimraf=require(_0xd1de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1de('0x2'));var rp=require(_0xd1de('0x3'));var moment=require(_0xd1de('0x4'));var BPromise=require(_0xd1de('0x5'));var Mustache=require(_0xd1de('0x6'));var util=require('util');var path=require(_0xd1de('0x7'));var sox=require(_0xd1de('0x8'));var csv=require(_0xd1de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1de('0xa'));var _=require(_0xd1de('0xb'));var squel=require(_0xd1de('0xc'));var crypto=require('crypto');var jsforce=require(_0xd1de('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd1de('0x9'));var querystring=require(_0xd1de('0xe'));var Papa=require(_0xd1de('0xf'));var Redis=require(_0xd1de('0x10'));var authService=require(_0xd1de('0x11'));var qs=require(_0xd1de('0x12'));var as=require(_0xd1de('0x13'));var hardwareService=require(_0xd1de('0x14'));var logger=require(_0xd1de('0x15'))(_0xd1de('0x16'));var utils=require('../../config/utils');var config=require(_0xd1de('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1de('0x18'))['db'];function respondWithStatusCode(_0x345b21,_0x557387){_0x557387=_0x557387||0xcc;return function(_0x2a4078){if(_0x2a4078){return _0x345b21[_0xd1de('0x19')](_0x557387);}return _0x345b21['status'](_0x557387)[_0xd1de('0x1a')]();};}function respondWithResult(_0x1e008e,_0x5ea0c5){_0x5ea0c5=_0x5ea0c5||0xc8;return function(_0x52e78d){if(_0x52e78d){return _0x1e008e['status'](_0x5ea0c5)[_0xd1de('0x1b')](_0x52e78d);}};}function respondWithFilteredResult(_0x3bcf7e,_0x493e72){return function(_0x40636c){if(_0x40636c){var _0x2dd4ab=typeof _0x493e72[_0xd1de('0x1c')]==='undefined'&&typeof _0x493e72['limit']===_0xd1de('0x1d');var _0x2e684d=_0x40636c['count'];var _0x5714c1=_0x2dd4ab?0x0:_0x493e72[_0xd1de('0x1c')];var _0x4ccb6d=_0x2dd4ab?_0x40636c[_0xd1de('0x1e')]:_0x493e72[_0xd1de('0x1c')]+_0x493e72[_0xd1de('0x1f')];var _0x196a81;if(_0x4ccb6d>=_0x2e684d){_0x4ccb6d=_0x2e684d;_0x196a81=0xc8;}else{_0x196a81=0xce;}_0x3bcf7e[_0xd1de('0x20')](_0x196a81);return _0x3bcf7e[_0xd1de('0x21')](_0xd1de('0x22'),_0x5714c1+'-'+_0x4ccb6d+'/'+_0x2e684d)[_0xd1de('0x1b')](_0x40636c);}return null;};}function patchUpdates(_0x49dfdc){return function(_0x1eb86e){try{jsonpatch[_0xd1de('0x23')](_0x1eb86e,_0x49dfdc,!![]);}catch(_0x2e5a4e){return BPromise[_0xd1de('0x24')](_0x2e5a4e);}return _0x1eb86e[_0xd1de('0x25')]();};}function saveUpdates(_0x40309c,_0x56560b){return function(_0x48bf8d){if(_0x48bf8d){return _0x48bf8d[_0xd1de('0x26')](_0x40309c)[_0xd1de('0x27')](function(_0x16f3a5){return _0x16f3a5;});}return null;};}function removeEntity(_0x2ec50f,_0x1ffc78){return function(_0x2e94a7){if(_0x2e94a7){return _0x2e94a7[_0xd1de('0x28')]()[_0xd1de('0x27')](function(){var _0x1f844c=_0x2e94a7[_0xd1de('0x29')]({'plain':!![]});var _0x57adba=_0xd1de('0x2a');return db[_0xd1de('0x2b')][_0xd1de('0x28')]({'where':{'type':_0x57adba,'resourceId':_0x1f844c['id']}})[_0xd1de('0x27')](function(){return _0x2e94a7;});})[_0xd1de('0x27')](function(){_0x2ec50f[_0xd1de('0x20')](0xcc)[_0xd1de('0x1a')]();});}};}function handleEntityNotFound(_0x5c0c42,_0x1e56ba){return function(_0x8c0ce1){if(!_0x8c0ce1){_0x5c0c42['sendStatus'](0x194);}return _0x8c0ce1;};}function handleError(_0x487487,_0x48f5df){_0x48f5df=_0x48f5df||0x1f4;return function(_0x54cfdd){logger[_0xd1de('0x2c')](_0x54cfdd[_0xd1de('0x2d')]);if(_0x54cfdd[_0xd1de('0x2e')]){delete _0x54cfdd[_0xd1de('0x2e')];}_0x487487[_0xd1de('0x20')](_0x48f5df)[_0xd1de('0x2f')](_0x54cfdd);};}exports[_0xd1de('0x30')]=function(_0x444eda,_0x5045a9){var _0x4e1047={},_0x84d426={},_0x353f85={'count':0x0,'rows':[]};var _0x50a1be=_[_0xd1de('0x31')](db[_0xd1de('0x32')][_0xd1de('0x33')],function(_0x3cb3b2){return{'name':_0x3cb3b2[_0xd1de('0x34')],'type':_0x3cb3b2[_0xd1de('0x35')][_0xd1de('0x36')]};});_0x84d426[_0xd1de('0x37')]=_[_0xd1de('0x31')](_0x50a1be,_0xd1de('0x2e'));_0x84d426[_0xd1de('0x38')]=_[_0xd1de('0x39')](_0x444eda[_0xd1de('0x38')]);_0x84d426[_0xd1de('0x3a')]=_[_0xd1de('0x3b')](_0x84d426['model'],_0x84d426[_0xd1de('0x38')]);_0x4e1047[_0xd1de('0x3c')]=_['intersection'](_0x84d426[_0xd1de('0x37')],qs['fields'](_0x444eda['query'][_0xd1de('0x3d')]));_0x4e1047['attributes']=_0x4e1047[_0xd1de('0x3c')][_0xd1de('0x3e')]?_0x4e1047[_0xd1de('0x3c')]:_0x84d426['model'];if(!_0x444eda[_0xd1de('0x38')][_0xd1de('0x3f')](_0xd1de('0x40'))){_0x4e1047['limit']=qs[_0xd1de('0x1f')](_0x444eda[_0xd1de('0x38')][_0xd1de('0x1f')]);_0x4e1047[_0xd1de('0x1c')]=qs[_0xd1de('0x1c')](_0x444eda['query'][_0xd1de('0x1c')]);}_0x4e1047[_0xd1de('0x41')]=qs['sort'](_0x444eda[_0xd1de('0x38')][_0xd1de('0x42')]);_0x4e1047[_0xd1de('0x43')]=qs['filters'](_[_0xd1de('0x44')](_0x444eda[_0xd1de('0x38')],_0x84d426[_0xd1de('0x3a')]),_0x50a1be);if(_0x444eda[_0xd1de('0x38')][_0xd1de('0x45')]){_0x4e1047[_0xd1de('0x43')]=_[_0xd1de('0x46')](_0x4e1047[_0xd1de('0x43')],{'$or':_[_0xd1de('0x31')](_0x50a1be,function(_0x380223){if(_0x380223[_0xd1de('0x35')]!==_0xd1de('0x47')){var _0x34b560={};_0x34b560[_0x380223[_0xd1de('0x2e')]]={'$like':'%'+_0x444eda['query'][_0xd1de('0x45')]+'%'};return _0x34b560;}})});}_0x4e1047=_[_0xd1de('0x46')]({},_0x4e1047,_0x444eda['options']);var _0x167ad7={'where':_0x4e1047[_0xd1de('0x43')]};return db['CmHopperAdditionalPhone'][_0xd1de('0x1e')](_0x167ad7)[_0xd1de('0x27')](function(_0x335ab0){_0x353f85['count']=_0x335ab0;if(_0x444eda[_0xd1de('0x38')][_0xd1de('0x48')]){_0x4e1047[_0xd1de('0x49')]=[{'all':!![]}];}return db[_0xd1de('0x32')][_0xd1de('0x4a')](_0x4e1047);})[_0xd1de('0x27')](function(_0x2cdea9){_0x353f85['rows']=_0x2cdea9;return _0x353f85;})['then'](respondWithFilteredResult(_0x5045a9,_0x4e1047))[_0xd1de('0x4b')](handleError(_0x5045a9,null));};exports['show']=function(_0x143d6c,_0x25f069){var _0x41d309={'raw':!![],'where':{'id':_0x143d6c[_0xd1de('0x4c')]['id']}},_0x1dd45f={};_0x1dd45f[_0xd1de('0x37')]=_[_0xd1de('0x39')](db[_0xd1de('0x32')][_0xd1de('0x33')]);_0x1dd45f[_0xd1de('0x38')]=_[_0xd1de('0x39')](_0x143d6c[_0xd1de('0x38')]);_0x1dd45f['filters']=_[_0xd1de('0x3b')](_0x1dd45f['model'],_0x1dd45f[_0xd1de('0x38')]);_0x41d309[_0xd1de('0x3c')]=_[_0xd1de('0x3b')](_0x1dd45f[_0xd1de('0x37')],qs[_0xd1de('0x3d')](_0x143d6c[_0xd1de('0x38')]['fields']));_0x41d309[_0xd1de('0x3c')]=_0x41d309[_0xd1de('0x3c')]['length']?_0x41d309[_0xd1de('0x3c')]:_0x1dd45f[_0xd1de('0x37')];if(_0x143d6c[_0xd1de('0x38')]['includeAll']){_0x41d309[_0xd1de('0x49')]=[{'all':!![]}];}_0x41d309=_[_0xd1de('0x46')]({},_0x41d309,_0x143d6c[_0xd1de('0x4d')]);return db['CmHopperAdditionalPhone'][_0xd1de('0x4e')](_0x41d309)['then'](handleEntityNotFound(_0x25f069,null))['then'](respondWithResult(_0x25f069,null))[_0xd1de('0x4b')](handleError(_0x25f069,null));};exports[_0xd1de('0x4f')]=function(_0x1a28df,_0x328235){return db[_0xd1de('0x32')][_0xd1de('0x4f')](_0x1a28df[_0xd1de('0x50')],{})[_0xd1de('0x27')](function(_0x4ce222){var _0x13ff53=_0x1a28df['user'][_0xd1de('0x29')]({'plain':!![]});if(!_0x13ff53)throw new Error(_0xd1de('0x51'));if(_0x13ff53[_0xd1de('0x52')]==='user'){var _0x5698f7=_0x4ce222[_0xd1de('0x29')]({'plain':!![]});var _0x490e9b=_0xd1de('0x2a');return db[_0xd1de('0x53')][_0xd1de('0x4e')]({'where':{'name':_0x490e9b,'userProfileId':_0x13ff53[_0xd1de('0x54')]},'raw':!![]})['then'](function(_0x5c83a9){if(_0x5c83a9&&_0x5c83a9[_0xd1de('0x55')]===0x0){return db['UserProfileResource'][_0xd1de('0x4f')]({'name':_0x5698f7[_0xd1de('0x2e')],'resourceId':_0x5698f7['id'],'type':_0x5c83a9[_0xd1de('0x2e')],'sectionId':_0x5c83a9['id']},{})[_0xd1de('0x27')](function(){return _0x4ce222;});}else{return _0x4ce222;}})[_0xd1de('0x4b')](function(_0x4687f1){logger['error'](_0xd1de('0x56'),_0x4687f1);throw _0x4687f1;});}return _0x4ce222;})['then'](respondWithResult(_0x328235,0xc9))[_0xd1de('0x4b')](handleError(_0x328235,null));};exports[_0xd1de('0x26')]=function(_0x248e3b,_0xebef43){if(_0x248e3b[_0xd1de('0x50')]['id']){delete _0x248e3b[_0xd1de('0x50')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x248e3b[_0xd1de('0x4c')]['id']}})[_0xd1de('0x27')](handleEntityNotFound(_0xebef43,null))[_0xd1de('0x27')](saveUpdates(_0x248e3b[_0xd1de('0x50')],null))[_0xd1de('0x27')](respondWithResult(_0xebef43,null))[_0xd1de('0x4b')](handleError(_0xebef43,null));};exports[_0xd1de('0x28')]=function(_0x3e7371,_0x315d2b){return db[_0xd1de('0x32')][_0xd1de('0x4e')]({'where':{'id':_0x3e7371['params']['id']}})[_0xd1de('0x27')](handleEntityNotFound(_0x315d2b,null))[_0xd1de('0x27')](removeEntity(_0x315d2b,null))[_0xd1de('0x4b')](handleError(_0x315d2b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 2bf1338..4e59cd3 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 _0xea2f=['moment','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','api'];(function(_0x57eb2d,_0x5e4918){var _0xd8e18=function(_0x189389){while(--_0x189389){_0x57eb2d['push'](_0x57eb2d['shift']());}};_0xd8e18(++_0x5e4918);}(_0xea2f,0x165));var _0xfea2=function(_0x335835,_0x65f2ae){_0x335835=_0x335835-0x0;var _0x48fb7c=_0xea2f[_0x335835];return _0x48fb7c;};'use strict';var _=require(_0xfea2('0x0'));var util=require(_0xfea2('0x1'));var logger=require('../../config/logger')(_0xfea2('0x2'));var moment=require(_0xfea2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfea2('0x4'));var rimraf=require('rimraf');var config=require(_0xfea2('0x5'));var attributes=require(_0xfea2('0x6'));module[_0xfea2('0x7')]=function(_0x424cef,_0x44a27d){return _0x424cef[_0xfea2('0x8')](_0xfea2('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe29e=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x2cefa7,_0x3b2163){var _0x1b3c67=function(_0x1c4662){while(--_0x1c4662){_0x2cefa7['push'](_0x2cefa7['shift']());}};_0x1b3c67(++_0x3b2163);}(_0xe29e,0xed));var _0xee29=function(_0x598aa9,_0x32aefe){_0x598aa9=_0x598aa9-0x0;var _0x54436b=_0xe29e[_0x598aa9];return _0x54436b;};'use strict';var _=require(_0xee29('0x0'));var util=require(_0xee29('0x1'));var logger=require(_0xee29('0x2'))(_0xee29('0x3'));var moment=require(_0xee29('0x4'));var BPromise=require('bluebird');var rp=require(_0xee29('0x5'));var fs=require('fs');var path=require(_0xee29('0x6'));var rimraf=require(_0xee29('0x7'));var config=require('../../config/environment');var attributes=require(_0xee29('0x8'));module[_0xee29('0x9')]=function(_0x38a7bb,_0x13b0f3){return _0x38a7bb[_0xee29('0xa')](_0xee29('0xb'),attributes,{'tableName':_0xee29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 31ea64d..ab99d76 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 _0xaa51=['countabandonedretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','countcongestionretry','countnosuchnumberretry'];(function(_0x145c97,_0x2af644){var _0xe98349=function(_0x5e841e){while(--_0x5e841e){_0x145c97['push'](_0x145c97['shift']());}};_0xe98349(++_0x2af644);}(_0xaa51,0xf8));var _0x1aa5=function(_0x21319e,_0x4036fa){_0x21319e=_0x21319e-0x0;var _0x903915=_0xaa51[_0x21319e];return _0x903915;};'use strict';var _=require(_0x1aa5('0x0'));var util=require(_0x1aa5('0x1'));var moment=require('moment');var BPromise=require(_0x1aa5('0x2'));var rs=require(_0x1aa5('0x3'));var fs=require('fs');var Redis=require(_0x1aa5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1aa5('0x5'));var logger=require(_0x1aa5('0x6'))(_0x1aa5('0x7'));var config=require('../../config/environment');var jayson=require(_0x1aa5('0x8'));var client=jayson[_0x1aa5('0x9')][_0x1aa5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x62703e,_0x4ae37a,_0x158740){return new BPromise(function(_0x380abd,_0x11d9d6){return client['request'](_0x62703e,_0x158740)[_0x1aa5('0xb')](function(_0x45c1cd){logger[_0x1aa5('0xc')](_0x1aa5('0xd'),_0x4ae37a,'request\x20sent');logger['debug'](_0x1aa5('0xe'),_0x4ae37a,_0x1aa5('0xf'),JSON[_0x1aa5('0x10')](_0x45c1cd));if(_0x45c1cd[_0x1aa5('0x11')]){if(_0x45c1cd['error'][_0x1aa5('0x12')]===0x1f4){logger[_0x1aa5('0x11')](_0x1aa5('0xd'),_0x4ae37a,_0x45c1cd[_0x1aa5('0x11')]['message']);return _0x11d9d6(_0x45c1cd[_0x1aa5('0x11')][_0x1aa5('0x13')]);}logger[_0x1aa5('0x11')](_0x1aa5('0xd'),_0x4ae37a,_0x45c1cd[_0x1aa5('0x11')][_0x1aa5('0x13')]);return _0x380abd(_0x45c1cd[_0x1aa5('0x11')][_0x1aa5('0x13')]);}else{logger['info'](_0x1aa5('0xd'),_0x4ae37a,_0x1aa5('0xf'));_0x380abd(_0x45c1cd[_0x1aa5('0x14')]['message']);}})[_0x1aa5('0x15')](function(_0xd412e5){logger['error'](_0x1aa5('0xd'),_0x4ae37a,_0xd412e5);_0x11d9d6(_0xd412e5);});});}exports[_0x1aa5('0x16')]=function(_0x425d08){var _0x14c1d8=this;return new Promise(function(_0x3b4e25,_0x2fe485){return db[_0x1aa5('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x19')],'ListId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x1a')],'VoiceQueueId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x1b')]===undefined?null:_0x425d08[_0x1aa5('0x18')]['VoiceQueueId'],'CampaignId':_0x425d08[_0x1aa5('0x18')][_0x1aa5('0x1c')]===undefined?null:_0x425d08[_0x1aa5('0x18')]['CampaignId']}})[_0x1aa5('0xb')](function(_0x4475e7){if(_0x4475e7!=null){return db[_0x1aa5('0x1d')][_0x1aa5('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4475e7['id'],'OrderBy':{'$gt':_0x4475e7[_0x1aa5('0x1f')]}},'order':[[_0x1aa5('0x1f'),_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x2bdd19){var _0x40739e=0x0;if(_0x2bdd19){if(_0x2bdd19['countbusyretry']+_0x2bdd19['countcongestionretry']+_0x2bdd19[_0x1aa5('0x21')]+_0x2bdd19['countnosuchnumberretry']+_0x2bdd19[_0x1aa5('0x22')]+_0x2bdd19['countabandonedretry']+_0x2bdd19[_0x1aa5('0x23')]+_0x2bdd19[_0x1aa5('0x24')]<_0x425d08[_0x1aa5('0x25')][_0x1aa5('0x26')])_0x40739e=0x1;_0x3b4e25({'additional':_0x40739e});}else{return db[_0x1aa5('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4475e7['id']},'order':[[_0x1aa5('0x1f'),_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x4a8efd){var _0x5683e8=0x0;if(_0x4a8efd){if(_0x4a8efd[_0x1aa5('0x27')]+_0x4a8efd[_0x1aa5('0x28')]+_0x4a8efd[_0x1aa5('0x21')]+_0x4a8efd[_0x1aa5('0x29')]+_0x4a8efd[_0x1aa5('0x22')]+_0x4a8efd[_0x1aa5('0x2a')]+_0x4a8efd['countmachineretry']+_0x4a8efd['countagentrejectretry']<_0x425d08[_0x1aa5('0x25')][_0x1aa5('0x26')])_0x5683e8=0x1;_0x3b4e25({'additional':_0x5683e8});}else{_0x3b4e25({'additional':0x0});}})[_0x1aa5('0x15')](function(_0x449f60){logger[_0x1aa5('0x11')](_0x1aa5('0x16'),_0x449f60[_0x1aa5('0x13')]);_0x2fe485(_0x14c1d8[_0x1aa5('0x11')](0x1f4,_0x449f60[_0x1aa5('0x13')]));});}})['catch'](function(_0x1f5a49){logger[_0x1aa5('0x11')](_0x1aa5('0x16'),_0x1f5a49[_0x1aa5('0x13')]);_0x2fe485(_0x14c1d8[_0x1aa5('0x11')](0x1f4,_0x1f5a49[_0x1aa5('0x13')]));});}else _0x3b4e25({'additional':0x0});});});};exports[_0x1aa5('0x2b')]=function(_0x29d903){var _0x189aff=this;return new Promise(function(_0x4c3d22,_0x93935d){return db[_0x1aa5('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x29d903[_0x1aa5('0x18')][_0x1aa5('0x19')],'ListId':_0x29d903['body'][_0x1aa5('0x1a')],'VoiceQueueId':_0x29d903[_0x1aa5('0x18')][_0x1aa5('0x1b')]===undefined?null:_0x29d903['body']['VoiceQueueId'],'CampaignId':_0x29d903['body'][_0x1aa5('0x1c')]===undefined?null:_0x29d903[_0x1aa5('0x18')][_0x1aa5('0x1c')]}})[_0x1aa5('0xb')](function(_0x31a872){if(_0x31a872!=null){return db[_0x1aa5('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31a872['id'],'OrderBy':{'$gte':_0x31a872[_0x1aa5('0x1f')]}},'order':[[_0x1aa5('0x1f'),_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x4ebbd6){if(_0x4ebbd6)return activateAdditionalPhone(_0x31a872,_0x29d903[_0x1aa5('0x18')],_0x4ebbd6,_0x29d903[_0x1aa5('0x2c')],_0x29d903['waitTime'])[_0x1aa5('0xb')](function(_0x380b52){_0x4c3d22(_0x380b52);});else{return db[_0x1aa5('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x31a872['id']},'order':[['OrderBy',_0x1aa5('0x20')]]})[_0x1aa5('0xb')](function(_0x2b1668){if(_0x2b1668)return activateAdditionalPhone(_0x31a872,_0x29d903[_0x1aa5('0x18')],_0x2b1668,_0x29d903[_0x1aa5('0x2c')],_0x29d903[_0x1aa5('0x2d')])[_0x1aa5('0xb')](function(_0x12ad7a){_0x4c3d22(_0x12ad7a);});else{_0x4c3d22({'id':_0x31a872['id'],'phone':''});}})[_0x1aa5('0x15')](function(_0x4714e5){logger[_0x1aa5('0x11')](_0x1aa5('0x16'),_0x4714e5[_0x1aa5('0x13')]);_0x93935d(_0x189aff[_0x1aa5('0x11')](0x1f4,_0x4714e5[_0x1aa5('0x13')]));});}})[_0x1aa5('0x15')](function(_0x1bff11){logger[_0x1aa5('0x11')]('VerifyAdditionalPhones',_0x1bff11[_0x1aa5('0x13')]);_0x93935d(_0x189aff[_0x1aa5('0x11')](0x1f4,_0x1bff11[_0x1aa5('0x13')]));});}else _0x4c3d22(0x1);});});};function activateAdditionalPhone(_0x5bd65a,_0x4b3b6e,_0x1b333c,_0x490fe0,_0x5636c3){return new Promise(function(_0x31fcf6,_0x30588b){var _0x2f09ad;if(_[_0x1aa5('0x2e')](_0x1b333c[_0x1aa5('0x2f')])){_0x1b333c[_0x1aa5('0x2f')]=moment();}if(moment()>moment(_0x1b333c[_0x1aa5('0x2f')])){_0x2f09ad=moment()[_0x1aa5('0x30')](_0x5636c3||0x3,'minutes');}else{if(_0x1b333c[_0x1aa5('0x1f')]==0x0){_0x2f09ad=moment(_0x1b333c[_0x1aa5('0x2f')]);}else{_0x2f09ad=moment()[_0x1aa5('0x30')](_0x5636c3||0x3,'minutes');}}if(_[_0x1aa5('0x2e')](_0x2f09ad)){_0x2f09ad=moment()['add'](_0x5636c3||0x3,_0x1aa5('0x31'));}var _0xf3c0c8={'phone':_0x5bd65a['phone'],'active':0x0,'OrderBy':_[_0x1aa5('0x2e')](_0x5bd65a[_0x1aa5('0x1f')])?0x0:_0x5bd65a[_0x1aa5('0x1f')],'scheduledat':moment()[_0x1aa5('0x30')](_0x490fe0||0x1,_0x1aa5('0x31')),'countbusyretry':_0x4b3b6e['countbusyretry'],'countcongestionretry':_0x4b3b6e[_0x1aa5('0x28')],'countnoanswerretry':_0x4b3b6e['countnoanswerretry'],'countnosuchnumberretry':_0x4b3b6e[_0x1aa5('0x29')],'countdropretry':_0x4b3b6e[_0x1aa5('0x22')],'countabandonedretry':_0x4b3b6e[_0x1aa5('0x2a')],'countmachineretry':_0x4b3b6e['countmachineretry'],'countagentrejectretry':_0x4b3b6e[_0x1aa5('0x24')],'createdAt':_0x4b3b6e[_0x1aa5('0x32')],'updatedAt':_0x4b3b6e[_0x1aa5('0x33')]};var _0x4fa78d={'CmHopperId':_0x5bd65a['id'],'phone':_0x1b333c[_0x1aa5('0x34')],'active':0x0,'OrderBy':_[_0x1aa5('0x2e')](_0x1b333c['OrderBy'])?0x0:_0x1b333c[_0x1aa5('0x1f')],'scheduledat':_0x2f09ad,'countbusyretry':_0x1b333c[_0x1aa5('0x27')],'countcongestionretry':_0x1b333c['countcongestionretry'],'countnoanswerretry':_0x1b333c[_0x1aa5('0x21')],'countnosuchnumberretry':_0x1b333c[_0x1aa5('0x29')],'countdropretry':_0x1b333c[_0x1aa5('0x22')],'countabandonedretry':_0x1b333c[_0x1aa5('0x2a')],'countmachineretry':_0x1b333c[_0x1aa5('0x23')],'countagentrejectretry':_0x1b333c['countagentrejectretry'],'createdAt':_0x1b333c[_0x1aa5('0x32')],'updatedAt':_0x1b333c[_0x1aa5('0x33')]};return db[_0x1aa5('0x35')][_0x1aa5('0x36')](function(_0x59ae28){return db[_0x1aa5('0x1d')][_0x1aa5('0x37')](_0xf3c0c8,{'where':{'id':_0x1b333c['id']}},{'transaction':_0x59ae28})[_0x1aa5('0xb')](function(){return db[_0x1aa5('0x17')][_0x1aa5('0x37')](_0x4fa78d,{'where':{'id':_0x5bd65a['id']}},{'transaction':_0x59ae28});});})[_0x1aa5('0xb')](function(_0x2fdbb6){_0x31fcf6({'id':_0x5bd65a['id'],'phone':_0x1b333c[_0x1aa5('0x34')]});})['catch'](function(_0x195772){logger['error'](_0x1aa5('0x38'),_0x195772[_0x1aa5('0x13')]);_0x30588b({'error':_0x195772['message']});});});}exports[_0x1aa5('0x39')]=function(_0xc2f3ca){var _0x4115fe=this;return new Promise(function(_0x3caafd,_0x550c3b){return db[_0x1aa5('0x17')]['update'](_0xc2f3ca['body']['field'],{'where':{'id':_0xc2f3ca[_0x1aa5('0x18')]['id']}})[_0x1aa5('0xb')](function(_0x254d69){_0x3caafd(_0x254d69);})['catch'](function(_0x1e584e){logger[_0x1aa5('0x11')]('IncrementPreviewCounters',_0x1e584e['message']);_0x550c3b(_0x4115fe[_0x1aa5('0x11')](0x1f4,_0x1e584e[_0x1aa5('0x13')]));});});}; \ No newline at end of file +var _0x9cfa=['add','minutes','phone','createdAt','updatedAt','sequelize','transaction','CmHopper','activateAdditionalPhone','IncrementPreviewCounters','update','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','info','result','catch','VerifyAdditionalPhones','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','countnosuchnumberretry','countmachineretry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat'];(function(_0x2e5a8c,_0x35f4bf){var _0x5816ec=function(_0x27cf55){while(--_0x27cf55){_0x2e5a8c['push'](_0x2e5a8c['shift']());}};_0x5816ec(++_0x35f4bf);}(_0x9cfa,0xfc));var _0xa9cf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9cfa[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa9cf('0x0'));var moment=require(_0xa9cf('0x1'));var BPromise=require(_0xa9cf('0x2'));var rs=require(_0xa9cf('0x3'));var fs=require('fs');var Redis=require(_0xa9cf('0x4'));var db=require(_0xa9cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9cf('0x6'));var config=require(_0xa9cf('0x7'));var jayson=require(_0xa9cf('0x8'));var client=jayson[_0xa9cf('0x9')][_0xa9cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x316c3b,_0x48cd71,_0x42e1b8){return new BPromise(function(_0x14ef20,_0x3d499b){return client[_0xa9cf('0xb')](_0x316c3b,_0x42e1b8)[_0xa9cf('0xc')](function(_0x32d536){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x48cd71,_0xa9cf('0xd'));logger[_0xa9cf('0xe')](_0xa9cf('0xf'),_0x48cd71,'request\x20sent',JSON[_0xa9cf('0x10')](_0x32d536));if(_0x32d536[_0xa9cf('0x11')]){if(_0x32d536[_0xa9cf('0x11')][_0xa9cf('0x12')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x48cd71,_0x32d536[_0xa9cf('0x11')][_0xa9cf('0x13')]);return _0x3d499b(_0x32d536[_0xa9cf('0x11')][_0xa9cf('0x13')]);}logger[_0xa9cf('0x11')](_0xa9cf('0x14'),_0x48cd71,_0x32d536['error'][_0xa9cf('0x13')]);return _0x14ef20(_0x32d536[_0xa9cf('0x11')][_0xa9cf('0x13')]);}else{logger[_0xa9cf('0x15')](_0xa9cf('0x14'),_0x48cd71,_0xa9cf('0xd'));_0x14ef20(_0x32d536[_0xa9cf('0x16')]['message']);}})[_0xa9cf('0x17')](function(_0x127795){logger['error'](_0xa9cf('0x14'),_0x48cd71,_0x127795);_0x3d499b(_0x127795);});});}exports[_0xa9cf('0x18')]=function(_0x1429cd){var _0x202bfe=this;return new Promise(function(_0x25ad64,_0x130d47){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x1429cd[_0xa9cf('0x19')]['ContactId'],'ListId':_0x1429cd['body'][_0xa9cf('0x1a')],'VoiceQueueId':_0x1429cd['body']['VoiceQueueId']===undefined?null:_0x1429cd['body'][_0xa9cf('0x1b')],'CampaignId':_0x1429cd[_0xa9cf('0x19')][_0xa9cf('0x1c')]===undefined?null:_0x1429cd[_0xa9cf('0x19')]['CampaignId']}})[_0xa9cf('0xc')](function(_0x3ed492){if(_0x3ed492!=null){return db[_0xa9cf('0x1d')][_0xa9cf('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x3ed492['id'],'OrderBy':{'$gt':_0x3ed492[_0xa9cf('0x1f')]}},'order':[[_0xa9cf('0x1f'),_0xa9cf('0x20')]]})['then'](function(_0x47777c){var _0x3d9968=0x0;if(_0x47777c){if(_0x47777c['countbusyretry']+_0x47777c[_0xa9cf('0x21')]+_0x47777c[_0xa9cf('0x22')]+_0x47777c['countnosuchnumberretry']+_0x47777c['countdropretry']+_0x47777c[_0xa9cf('0x23')]+_0x47777c['countmachineretry']+_0x47777c[_0xa9cf('0x24')]<_0x1429cd[_0xa9cf('0x25')][_0xa9cf('0x26')])_0x3d9968=0x1;_0x25ad64({'additional':_0x3d9968});}else{return db[_0xa9cf('0x1d')][_0xa9cf('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x3ed492['id']},'order':[[_0xa9cf('0x1f'),_0xa9cf('0x20')]]})['then'](function(_0xb76900){var _0x358c77=0x0;if(_0xb76900){if(_0xb76900[_0xa9cf('0x27')]+_0xb76900[_0xa9cf('0x21')]+_0xb76900[_0xa9cf('0x22')]+_0xb76900[_0xa9cf('0x28')]+_0xb76900['countdropretry']+_0xb76900[_0xa9cf('0x23')]+_0xb76900[_0xa9cf('0x29')]+_0xb76900['countagentrejectretry']<_0x1429cd[_0xa9cf('0x25')][_0xa9cf('0x26')])_0x358c77=0x1;_0x25ad64({'additional':_0x358c77});}else{_0x25ad64({'additional':0x0});}})[_0xa9cf('0x17')](function(_0x1b9061){logger[_0xa9cf('0x11')]('VerifyAdditionalPhones',_0x1b9061[_0xa9cf('0x13')]);_0x130d47(_0x202bfe[_0xa9cf('0x11')](0x1f4,_0x1b9061[_0xa9cf('0x13')]));});}})[_0xa9cf('0x17')](function(_0x26c6d8){logger[_0xa9cf('0x11')]('VerifyAdditionalPhones',_0x26c6d8['message']);_0x130d47(_0x202bfe[_0xa9cf('0x11')](0x1f4,_0x26c6d8[_0xa9cf('0x13')]));});}else _0x25ad64({'additional':0x0});});});};exports[_0xa9cf('0x2a')]=function(_0x579190){var _0x1615f4=this;return new Promise(function(_0x59583c,_0x53801d){return db['CmHopper'][_0xa9cf('0x1e')]({'raw':!![],'where':{'ContactId':_0x579190[_0xa9cf('0x19')][_0xa9cf('0x2b')],'ListId':_0x579190[_0xa9cf('0x19')]['ListId'],'VoiceQueueId':_0x579190[_0xa9cf('0x19')][_0xa9cf('0x1b')]===undefined?null:_0x579190['body'][_0xa9cf('0x1b')],'CampaignId':_0x579190[_0xa9cf('0x19')][_0xa9cf('0x1c')]===undefined?null:_0x579190[_0xa9cf('0x19')][_0xa9cf('0x1c')]}})['then'](function(_0xe0b5a8){if(_0xe0b5a8!=null){return db[_0xa9cf('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xe0b5a8['id'],'OrderBy':{'$gte':_0xe0b5a8[_0xa9cf('0x1f')]}},'order':[[_0xa9cf('0x1f'),_0xa9cf('0x20')]]})[_0xa9cf('0xc')](function(_0x35d121){if(_0x35d121)return activateAdditionalPhone(_0xe0b5a8,_0x579190[_0xa9cf('0x19')],_0x35d121,_0x579190[_0xa9cf('0x2c')],_0x579190[_0xa9cf('0x2d')])['then'](function(_0x2aff43){_0x59583c(_0x2aff43);});else{return db['CmHopperAdditionalPhone'][_0xa9cf('0x1e')]({'raw':!![],'where':{'CmHopperId':_0xe0b5a8['id']},'order':[[_0xa9cf('0x1f'),_0xa9cf('0x20')]]})[_0xa9cf('0xc')](function(_0x29ae3d){if(_0x29ae3d)return activateAdditionalPhone(_0xe0b5a8,_0x579190['body'],_0x29ae3d,_0x579190[_0xa9cf('0x2c')],_0x579190[_0xa9cf('0x2d')])[_0xa9cf('0xc')](function(_0x5f3034){_0x59583c(_0x5f3034);});else{_0x59583c({'id':_0xe0b5a8['id'],'phone':''});}})[_0xa9cf('0x17')](function(_0x129056){logger[_0xa9cf('0x11')](_0xa9cf('0x18'),_0x129056['message']);_0x53801d(_0x1615f4['error'](0x1f4,_0x129056[_0xa9cf('0x13')]));});}})['catch'](function(_0x2fa189){logger[_0xa9cf('0x11')](_0xa9cf('0x18'),_0x2fa189[_0xa9cf('0x13')]);_0x53801d(_0x1615f4[_0xa9cf('0x11')](0x1f4,_0x2fa189[_0xa9cf('0x13')]));});}else _0x59583c(0x1);});});};function activateAdditionalPhone(_0x1a61a2,_0x28c689,_0x56e012,_0x3a16b0,_0x28aecd){return new Promise(function(_0x4bfc33,_0x47511b){var _0x4f51b3;if(_[_0xa9cf('0x2e')](_0x56e012[_0xa9cf('0x2f')])){_0x56e012[_0xa9cf('0x2f')]=moment();}if(moment()>moment(_0x56e012[_0xa9cf('0x2f')])){_0x4f51b3=moment()[_0xa9cf('0x30')](_0x28aecd||0x3,'minutes');}else{if(_0x56e012[_0xa9cf('0x1f')]==0x0){_0x4f51b3=moment(_0x56e012[_0xa9cf('0x2f')]);}else{_0x4f51b3=moment()[_0xa9cf('0x30')](_0x28aecd||0x3,_0xa9cf('0x31'));}}if(_[_0xa9cf('0x2e')](_0x4f51b3)){_0x4f51b3=moment()[_0xa9cf('0x30')](_0x28aecd||0x3,'minutes');}var _0x2952ed={'phone':_0x1a61a2[_0xa9cf('0x32')],'active':0x0,'OrderBy':_[_0xa9cf('0x2e')](_0x1a61a2[_0xa9cf('0x1f')])?0x0:_0x1a61a2[_0xa9cf('0x1f')],'scheduledat':moment()[_0xa9cf('0x30')](_0x3a16b0||0x1,_0xa9cf('0x31')),'countbusyretry':_0x28c689[_0xa9cf('0x27')],'countcongestionretry':_0x28c689[_0xa9cf('0x21')],'countnoanswerretry':_0x28c689[_0xa9cf('0x22')],'countnosuchnumberretry':_0x28c689[_0xa9cf('0x28')],'countdropretry':_0x28c689['countdropretry'],'countabandonedretry':_0x28c689[_0xa9cf('0x23')],'countmachineretry':_0x28c689[_0xa9cf('0x29')],'countagentrejectretry':_0x28c689[_0xa9cf('0x24')],'createdAt':_0x28c689[_0xa9cf('0x33')],'updatedAt':_0x28c689[_0xa9cf('0x34')]};var _0xdea6e4={'CmHopperId':_0x1a61a2['id'],'phone':_0x56e012['phone'],'active':0x0,'OrderBy':_[_0xa9cf('0x2e')](_0x56e012[_0xa9cf('0x1f')])?0x0:_0x56e012['OrderBy'],'scheduledat':_0x4f51b3,'countbusyretry':_0x56e012[_0xa9cf('0x27')],'countcongestionretry':_0x56e012[_0xa9cf('0x21')],'countnoanswerretry':_0x56e012['countnoanswerretry'],'countnosuchnumberretry':_0x56e012[_0xa9cf('0x28')],'countdropretry':_0x56e012['countdropretry'],'countabandonedretry':_0x56e012[_0xa9cf('0x23')],'countmachineretry':_0x56e012[_0xa9cf('0x29')],'countagentrejectretry':_0x56e012[_0xa9cf('0x24')],'createdAt':_0x56e012[_0xa9cf('0x33')],'updatedAt':_0x56e012['updatedAt']};return db[_0xa9cf('0x35')][_0xa9cf('0x36')](function(_0xaeb3f7){return db['CmHopperAdditionalPhone']['update'](_0x2952ed,{'where':{'id':_0x56e012['id']}},{'transaction':_0xaeb3f7})['then'](function(){return db[_0xa9cf('0x37')]['update'](_0xdea6e4,{'where':{'id':_0x1a61a2['id']}},{'transaction':_0xaeb3f7});});})[_0xa9cf('0xc')](function(_0x496da5){_0x4bfc33({'id':_0x1a61a2['id'],'phone':_0x56e012['phone']});})['catch'](function(_0x2c04b4){logger['error'](_0xa9cf('0x38'),_0x2c04b4['message']);_0x47511b({'error':_0x2c04b4[_0xa9cf('0x13')]});});});}exports[_0xa9cf('0x39')]=function(_0x258738){var _0x3bac70=this;return new Promise(function(_0x44e402,_0x4007e9){return db['CmHopper'][_0xa9cf('0x3a')](_0x258738[_0xa9cf('0x19')][_0xa9cf('0x3b')],{'where':{'id':_0x258738[_0xa9cf('0x19')]['id']}})[_0xa9cf('0xc')](function(_0x2d21fd){_0x44e402(_0x2d21fd);})[_0xa9cf('0x17')](function(_0x33fea6){logger[_0xa9cf('0x11')](_0xa9cf('0x39'),_0x33fea6[_0xa9cf('0x13')]);_0x4007e9(_0x3bac70[_0xa9cf('0x11')](0x1f4,_0x33fea6[_0xa9cf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 024b8ac..9853c93 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 _0x675c=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x2914fd,_0x280d0c){var _0xbbf214=function(_0x45a22c){while(--_0x45a22c){_0x2914fd['push'](_0x2914fd['shift']());}};_0xbbf214(++_0x280d0c);}(_0x675c,0x72));var _0xc675=function(_0x5892fd,_0x1bd063){_0x5892fd=_0x5892fd-0x0;var _0x4a460b=_0x675c[_0x5892fd];return _0x4a460b;};'use strict';var multer=require(_0xc675('0x0'));var util=require(_0xc675('0x1'));var path=require(_0xc675('0x2'));var timeout=require(_0xc675('0x3'));var express=require('express');var router=express[_0xc675('0x4')]();var fs_extra=require(_0xc675('0x5'));var auth=require(_0xc675('0x6'));var interaction=require(_0xc675('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xc675('0x8')]('/',auth[_0xc675('0x9')](),controller[_0xc675('0xa')]);router['get'](_0xc675('0xb'),auth[_0xc675('0x9')](),controller[_0xc675('0xc')]);router[_0xc675('0xd')]('/',auth[_0xc675('0x9')](),controller[_0xc675('0xe')]);router['put'](_0xc675('0xb'),auth[_0xc675('0x9')](),controller[_0xc675('0xf')]);router[_0xc675('0x10')](_0xc675('0xb'),auth['isAuthenticated'](),controller[_0xc675('0x11')]);module[_0xc675('0x12')]=router; \ No newline at end of file +var _0x5630=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x440093,_0x1a874f){var _0x1d1cda=function(_0x578caf){while(--_0x578caf){_0x440093['push'](_0x440093['shift']());}};_0x1d1cda(++_0x1a874f);}(_0x5630,0xc3));var _0x0563=function(_0x585634,_0x22747b){_0x585634=_0x585634-0x0;var _0x30d54a=_0x5630[_0x585634];return _0x30d54a;};'use strict';var multer=require(_0x0563('0x0'));var util=require(_0x0563('0x1'));var path=require(_0x0563('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0563('0x3'));var auth=require(_0x0563('0x4'));var interaction=require(_0x0563('0x5'));var config=require(_0x0563('0x6'));var controller=require(_0x0563('0x7'));router[_0x0563('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0563('0x8')](_0x0563('0x9'),auth[_0x0563('0xa')](),controller[_0x0563('0xb')]);router['post']('/',auth[_0x0563('0xa')](),controller[_0x0563('0xc')]);router[_0x0563('0xd')](_0x0563('0x9'),auth[_0x0563('0xa')](),controller[_0x0563('0xe')]);router[_0x0563('0xf')](_0x0563('0x9'),auth['isAuthenticated'](),controller[_0x0563('0x10')]);module[_0x0563('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f03ed69..08a6fac 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 _0x5687=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5687,0x1ce));var _0x7568=function(_0x3238df,_0x262443){_0x3238df=_0x3238df-0x0;var _0x427b84=_0x5687[_0x3238df];return _0x427b84;};'use strict';var moment=require(_0x7568('0x0'));var Sequelize=require(_0x7568('0x1'));module[_0x7568('0x2')]={'phone':{'type':Sequelize[_0x7568('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7568('0x4')],'unique':_0x7568('0x5')},'ListId':{'type':Sequelize[_0x7568('0x4')],'unique':_0x7568('0x5')},'VoiceQueueId':{'type':Sequelize[_0x7568('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x9a14=['contactListQueue','INTEGER','sequelize','exports','STRING'];(function(_0x381668,_0x1a48e7){var _0xba7a8e=function(_0x5dc1ce){while(--_0x5dc1ce){_0x381668['push'](_0x381668['shift']());}};_0xba7a8e(++_0x1a48e7);}(_0x9a14,0x1d3));var _0x49a1=function(_0x2a4ee6,_0x540a27){_0x2a4ee6=_0x2a4ee6-0x0;var _0x1bcd7d=_0x9a14[_0x2a4ee6];return _0x1bcd7d;};'use strict';var moment=require('moment');var Sequelize=require(_0x49a1('0x0'));module[_0x49a1('0x1')]={'phone':{'type':Sequelize[_0x49a1('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x49a1('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x49a1('0x3')},'VoiceQueueId':{'type':Sequelize[_0x49a1('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 944eea4..85262e2 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 _0x05e7=['fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','save','then','destroy','error','name','send','index','map','CmHopperBlack','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x12f7f7,_0x39895e){var _0xdc54b6=function(_0x4ad778){while(--_0x4ad778){_0x12f7f7['push'](_0x12f7f7['shift']());}};_0xdc54b6(++_0x39895e);}(_0x05e7,0x15f));var _0x705e=function(_0x15bab5,_0x150ed5){_0x15bab5=_0x15bab5-0x0;var _0x4cd7f0=_0x05e7[_0x15bab5];return _0x4cd7f0;};'use strict';var emlformat=require(_0x705e('0x0'));var rimraf=require(_0x705e('0x1'));var zipdir=require(_0x705e('0x2'));var jsonpatch=require(_0x705e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x705e('0x4'));var Mustache=require(_0x705e('0x5'));var util=require(_0x705e('0x6'));var path=require(_0x705e('0x7'));var sox=require(_0x705e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x705e('0x9'));var _=require('lodash');var squel=require(_0x705e('0xa'));var crypto=require('crypto');var jsforce=require(_0x705e('0xb'));var deskjs=require(_0x705e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x705e('0xd'));var Papa=require('papaparse');var Redis=require(_0x705e('0xe'));var authService=require(_0x705e('0xf'));var qs=require(_0x705e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x705e('0x11'));var logger=require(_0x705e('0x12'))(_0x705e('0x13'));var utils=require(_0x705e('0x14'));var config=require(_0x705e('0x15'));var licenseUtil=require(_0x705e('0x16'));var db=require(_0x705e('0x17'))['db'];function respondWithStatusCode(_0x4ba092,_0x11e81c){_0x11e81c=_0x11e81c||0xcc;return function(_0xecf137){if(_0xecf137){return _0x4ba092[_0x705e('0x18')](_0x11e81c);}return _0x4ba092[_0x705e('0x19')](_0x11e81c)[_0x705e('0x1a')]();};}function respondWithResult(_0x4c7fb8,_0x417d27){_0x417d27=_0x417d27||0xc8;return function(_0x3f2b0f){if(_0x3f2b0f){return _0x4c7fb8[_0x705e('0x19')](_0x417d27)[_0x705e('0x1b')](_0x3f2b0f);}};}function respondWithFilteredResult(_0x111324,_0x4b99bf){return function(_0x310f55){if(_0x310f55){var _0x644d47=typeof _0x4b99bf['offset']===_0x705e('0x1c')&&typeof _0x4b99bf['limit']===_0x705e('0x1c');var _0x212f49=_0x310f55[_0x705e('0x1d')];var _0x22ff1c=_0x644d47?0x0:_0x4b99bf[_0x705e('0x1e')];var _0x492b53=_0x644d47?_0x310f55['count']:_0x4b99bf[_0x705e('0x1e')]+_0x4b99bf['limit'];var _0x4c4f52;if(_0x492b53>=_0x212f49){_0x492b53=_0x212f49;_0x4c4f52=0xc8;}else{_0x4c4f52=0xce;}_0x111324['status'](_0x4c4f52);return _0x111324['set']('Content-Range',_0x22ff1c+'-'+_0x492b53+'/'+_0x212f49)[_0x705e('0x1b')](_0x310f55);}return null;};}function patchUpdates(_0xe967){return function(_0x124506){try{jsonpatch['apply'](_0x124506,_0xe967,!![]);}catch(_0x2cb851){return BPromise['reject'](_0x2cb851);}return _0x124506[_0x705e('0x1f')]();};}function saveUpdates(_0x47886d,_0x4abdee){return function(_0x1686b8){if(_0x1686b8){return _0x1686b8['update'](_0x47886d)[_0x705e('0x20')](function(_0x5a73ac){return _0x5a73ac;});}return null;};}function removeEntity(_0x551b7c,_0x37c894){return function(_0x39b2b5){if(_0x39b2b5){return _0x39b2b5[_0x705e('0x21')]()[_0x705e('0x20')](function(){_0x551b7c[_0x705e('0x19')](0xcc)[_0x705e('0x1a')]();});}};}function handleEntityNotFound(_0x4950cb,_0x1cd6df){return function(_0x3de241){if(!_0x3de241){_0x4950cb[_0x705e('0x18')](0x194);}return _0x3de241;};}function handleError(_0x29218f,_0x1c17af){_0x1c17af=_0x1c17af||0x1f4;return function(_0x19b9fc){logger[_0x705e('0x22')](_0x19b9fc['stack']);if(_0x19b9fc['name']){delete _0x19b9fc[_0x705e('0x23')];}_0x29218f[_0x705e('0x19')](_0x1c17af)[_0x705e('0x24')](_0x19b9fc);};}exports[_0x705e('0x25')]=function(_0x228356,_0x388624){var _0x3bc452={},_0x28cd2f={},_0x4b87a1={'count':0x0,'rows':[]};var _0x29e704=_[_0x705e('0x26')](db[_0x705e('0x27')]['rawAttributes'],function(_0x19ed5f){return{'name':_0x19ed5f[_0x705e('0x28')],'type':_0x19ed5f['type'][_0x705e('0x29')]};});_0x28cd2f[_0x705e('0x2a')]=_[_0x705e('0x26')](_0x29e704,_0x705e('0x23'));_0x28cd2f[_0x705e('0x2b')]=_['keys'](_0x228356[_0x705e('0x2b')]);_0x28cd2f[_0x705e('0x2c')]=_[_0x705e('0x2d')](_0x28cd2f[_0x705e('0x2a')],_0x28cd2f['query']);_0x3bc452[_0x705e('0x2e')]=_[_0x705e('0x2d')](_0x28cd2f[_0x705e('0x2a')],qs['fields'](_0x228356[_0x705e('0x2b')][_0x705e('0x2f')]));_0x3bc452['attributes']=_0x3bc452[_0x705e('0x2e')][_0x705e('0x30')]?_0x3bc452[_0x705e('0x2e')]:_0x28cd2f['model'];if(!_0x228356[_0x705e('0x2b')]['hasOwnProperty'](_0x705e('0x31'))){_0x3bc452[_0x705e('0x32')]=qs[_0x705e('0x32')](_0x228356[_0x705e('0x2b')][_0x705e('0x32')]);_0x3bc452['offset']=qs[_0x705e('0x1e')](_0x228356['query'][_0x705e('0x1e')]);}_0x3bc452[_0x705e('0x33')]=qs[_0x705e('0x34')](_0x228356[_0x705e('0x2b')]['sort']);_0x3bc452[_0x705e('0x35')]=qs[_0x705e('0x2c')](_[_0x705e('0x36')](_0x228356[_0x705e('0x2b')],_0x28cd2f[_0x705e('0x2c')]),_0x29e704);if(_0x228356[_0x705e('0x2b')]['filter']){_0x3bc452['where']=_[_0x705e('0x37')](_0x3bc452[_0x705e('0x35')],{'$or':_['map'](_0x29e704,function(_0x2edf93){if(_0x2edf93['type']!==_0x705e('0x38')){var _0x47dbbf={};_0x47dbbf[_0x2edf93['name']]={'$like':'%'+_0x228356[_0x705e('0x2b')][_0x705e('0x39')]+'%'};return _0x47dbbf;}})});}_0x3bc452=_[_0x705e('0x37')]({},_0x3bc452,_0x228356[_0x705e('0x3a')]);var _0x181555={'where':_0x3bc452[_0x705e('0x35')]};return db['CmHopperBlack'][_0x705e('0x1d')](_0x181555)['then'](function(_0x8e3bf1){_0x4b87a1['count']=_0x8e3bf1;if(_0x228356['query'][_0x705e('0x3b')]){_0x3bc452[_0x705e('0x3c')]=[{'all':!![]}];}return db[_0x705e('0x27')][_0x705e('0x3d')](_0x3bc452);})[_0x705e('0x20')](function(_0x50ace9){_0x4b87a1[_0x705e('0x3e')]=_0x50ace9;return _0x4b87a1;})['then'](respondWithFilteredResult(_0x388624,_0x3bc452))['catch'](handleError(_0x388624,null));};exports[_0x705e('0x3f')]=function(_0x5e5b2b,_0x3eacd2){var _0x242a4f={'raw':!![],'where':{'id':_0x5e5b2b[_0x705e('0x40')]['id']}},_0x1a9dce={};_0x1a9dce[_0x705e('0x2a')]=_[_0x705e('0x41')](db[_0x705e('0x27')][_0x705e('0x42')]);_0x1a9dce[_0x705e('0x2b')]=_[_0x705e('0x41')](_0x5e5b2b[_0x705e('0x2b')]);_0x1a9dce[_0x705e('0x2c')]=_[_0x705e('0x2d')](_0x1a9dce[_0x705e('0x2a')],_0x1a9dce[_0x705e('0x2b')]);_0x242a4f[_0x705e('0x2e')]=_[_0x705e('0x2d')](_0x1a9dce[_0x705e('0x2a')],qs[_0x705e('0x2f')](_0x5e5b2b[_0x705e('0x2b')][_0x705e('0x2f')]));_0x242a4f[_0x705e('0x2e')]=_0x242a4f[_0x705e('0x2e')][_0x705e('0x30')]?_0x242a4f['attributes']:_0x1a9dce['model'];if(_0x5e5b2b['query'][_0x705e('0x3b')]){_0x242a4f[_0x705e('0x3c')]=[{'all':!![]}];}_0x242a4f=_[_0x705e('0x37')]({},_0x242a4f,_0x5e5b2b[_0x705e('0x3a')]);return db['CmHopperBlack'][_0x705e('0x43')](_0x242a4f)[_0x705e('0x20')](handleEntityNotFound(_0x3eacd2,null))['then'](respondWithResult(_0x3eacd2,null))[_0x705e('0x44')](handleError(_0x3eacd2,null));};exports[_0x705e('0x45')]=function(_0x9a1a68,_0x408c37){if(_0x9a1a68[_0x705e('0x46')]['id']){delete _0x9a1a68['body']['id'];}return db[_0x705e('0x27')]['find']({'where':{'id':_0x9a1a68[_0x705e('0x40')]['id']}})[_0x705e('0x20')](handleEntityNotFound(_0x408c37,null))[_0x705e('0x20')](saveUpdates(_0x9a1a68[_0x705e('0x46')],null))[_0x705e('0x20')](respondWithResult(_0x408c37,null))['catch'](handleError(_0x408c37,null));};exports['destroy']=function(_0x1fea74,_0x4f175b){return db[_0x705e('0x27')][_0x705e('0x43')]({'where':{'id':_0x1fea74[_0x705e('0x40')]['id']}})[_0x705e('0x20')](handleEntityNotFound(_0x4f175b,null))[_0x705e('0x20')](removeEntity(_0x4f175b,null))[_0x705e('0x44')](handleError(_0x4f175b,null));};exports[_0x705e('0x47')]=function(_0x595c34,_0x2875b4){return db[_0x705e('0x27')][_0x705e('0x47')]()['then'](respondWithResult(_0x2875b4,null))[_0x705e('0x44')](handleError(_0x2875b4,null));}; \ No newline at end of file +var _0xf375=['VIRTUAL','merge','options','includeAll','include','CmHopperBlack','catch','show','find','body','params','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','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','Content-Range','apply','reject','save','update','then','end','index','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type'];(function(_0x44b827,_0x1bb1aa){var _0x527342=function(_0x481338){while(--_0x481338){_0x44b827['push'](_0x44b827['shift']());}};_0x527342(++_0x1bb1aa);}(_0xf375,0x19f));var _0x5f37=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf375[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f37('0x0'));var rp=require(_0x5f37('0x1'));var moment=require(_0x5f37('0x2'));var BPromise=require(_0x5f37('0x3'));var Mustache=require(_0x5f37('0x4'));var util=require(_0x5f37('0x5'));var path=require(_0x5f37('0x6'));var sox=require(_0x5f37('0x7'));var csv=require(_0x5f37('0x8'));var ejs=require(_0x5f37('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5f37('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5f37('0x8'));var querystring=require('querystring');var Papa=require(_0x5f37('0xb'));var Redis=require(_0x5f37('0xc'));var authService=require(_0x5f37('0xd'));var qs=require(_0x5f37('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f37('0xf'));var logger=require('../../config/logger')(_0x5f37('0x10'));var utils=require(_0x5f37('0x11'));var config=require(_0x5f37('0x12'));var licenseUtil=require(_0x5f37('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5469df,_0x22a5e6){_0x22a5e6=_0x22a5e6||0xcc;return function(_0x109b90){if(_0x109b90){return _0x5469df[_0x5f37('0x14')](_0x22a5e6);}return _0x5469df[_0x5f37('0x15')](_0x22a5e6)['end']();};}function respondWithResult(_0x5d8e6a,_0x22cfe7){_0x22cfe7=_0x22cfe7||0xc8;return function(_0x275067){if(_0x275067){return _0x5d8e6a[_0x5f37('0x15')](_0x22cfe7)[_0x5f37('0x16')](_0x275067);}};}function respondWithFilteredResult(_0x64d82b,_0x360f88){return function(_0x38e605){if(_0x38e605){var _0x3743be=typeof _0x360f88['offset']===_0x5f37('0x17')&&typeof _0x360f88[_0x5f37('0x18')]===_0x5f37('0x17');var _0x55c64c=_0x38e605[_0x5f37('0x19')];var _0x2ce3c3=_0x3743be?0x0:_0x360f88[_0x5f37('0x1a')];var _0x39ab2c=_0x3743be?_0x38e605[_0x5f37('0x19')]:_0x360f88['offset']+_0x360f88[_0x5f37('0x18')];var _0x56abde;if(_0x39ab2c>=_0x55c64c){_0x39ab2c=_0x55c64c;_0x56abde=0xc8;}else{_0x56abde=0xce;}_0x64d82b[_0x5f37('0x15')](_0x56abde);return _0x64d82b['set'](_0x5f37('0x1b'),_0x2ce3c3+'-'+_0x39ab2c+'/'+_0x55c64c)[_0x5f37('0x16')](_0x38e605);}return null;};}function patchUpdates(_0x52d05c){return function(_0x31f451){try{jsonpatch[_0x5f37('0x1c')](_0x31f451,_0x52d05c,!![]);}catch(_0x2a2809){return BPromise[_0x5f37('0x1d')](_0x2a2809);}return _0x31f451[_0x5f37('0x1e')]();};}function saveUpdates(_0x60f329,_0x6ad1ef){return function(_0x2f94c5){if(_0x2f94c5){return _0x2f94c5[_0x5f37('0x1f')](_0x60f329)[_0x5f37('0x20')](function(_0x15cbe0){return _0x15cbe0;});}return null;};}function removeEntity(_0x1f4918,_0x257720){return function(_0x308461){if(_0x308461){return _0x308461['destroy']()[_0x5f37('0x20')](function(){_0x1f4918[_0x5f37('0x15')](0xcc)[_0x5f37('0x21')]();});}};}function handleEntityNotFound(_0x15f90e,_0x5a70e8){return function(_0x4968b3){if(!_0x4968b3){_0x15f90e['sendStatus'](0x194);}return _0x4968b3;};}function handleError(_0x4f5bdc,_0x190c48){_0x190c48=_0x190c48||0x1f4;return function(_0x3848d6){logger['error'](_0x3848d6['stack']);if(_0x3848d6['name']){delete _0x3848d6['name'];}_0x4f5bdc[_0x5f37('0x15')](_0x190c48)['send'](_0x3848d6);};}exports[_0x5f37('0x22')]=function(_0x5468ba,_0x193bfc){var _0x3133a5={},_0x343b76={},_0x4382af={'count':0x0,'rows':[]};var _0x168b31=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0x584492){return{'name':_0x584492['fieldName'],'type':_0x584492['type'][_0x5f37('0x23')]};});_0x343b76[_0x5f37('0x24')]=_[_0x5f37('0x25')](_0x168b31,_0x5f37('0x26'));_0x343b76['query']=_[_0x5f37('0x27')](_0x5468ba[_0x5f37('0x28')]);_0x343b76[_0x5f37('0x29')]=_[_0x5f37('0x2a')](_0x343b76['model'],_0x343b76[_0x5f37('0x28')]);_0x3133a5[_0x5f37('0x2b')]=_[_0x5f37('0x2a')](_0x343b76[_0x5f37('0x24')],qs[_0x5f37('0x2c')](_0x5468ba[_0x5f37('0x28')][_0x5f37('0x2c')]));_0x3133a5[_0x5f37('0x2b')]=_0x3133a5[_0x5f37('0x2b')][_0x5f37('0x2d')]?_0x3133a5[_0x5f37('0x2b')]:_0x343b76[_0x5f37('0x24')];if(!_0x5468ba[_0x5f37('0x28')][_0x5f37('0x2e')](_0x5f37('0x2f'))){_0x3133a5[_0x5f37('0x18')]=qs[_0x5f37('0x18')](_0x5468ba[_0x5f37('0x28')][_0x5f37('0x18')]);_0x3133a5[_0x5f37('0x1a')]=qs['offset'](_0x5468ba[_0x5f37('0x28')][_0x5f37('0x1a')]);}_0x3133a5[_0x5f37('0x30')]=qs['sort'](_0x5468ba[_0x5f37('0x28')][_0x5f37('0x31')]);_0x3133a5[_0x5f37('0x32')]=qs[_0x5f37('0x29')](_[_0x5f37('0x33')](_0x5468ba[_0x5f37('0x28')],_0x343b76[_0x5f37('0x29')]),_0x168b31);if(_0x5468ba[_0x5f37('0x28')][_0x5f37('0x34')]){_0x3133a5['where']=_['merge'](_0x3133a5[_0x5f37('0x32')],{'$or':_[_0x5f37('0x25')](_0x168b31,function(_0x14fda8){if(_0x14fda8[_0x5f37('0x35')]!==_0x5f37('0x36')){var _0x5de503={};_0x5de503[_0x14fda8[_0x5f37('0x26')]]={'$like':'%'+_0x5468ba[_0x5f37('0x28')][_0x5f37('0x34')]+'%'};return _0x5de503;}})});}_0x3133a5=_[_0x5f37('0x37')]({},_0x3133a5,_0x5468ba[_0x5f37('0x38')]);var _0x3365b3={'where':_0x3133a5[_0x5f37('0x32')]};return db['CmHopperBlack']['count'](_0x3365b3)[_0x5f37('0x20')](function(_0x5159e9){_0x4382af['count']=_0x5159e9;if(_0x5468ba[_0x5f37('0x28')][_0x5f37('0x39')]){_0x3133a5[_0x5f37('0x3a')]=[{'all':!![]}];}return db[_0x5f37('0x3b')]['findAll'](_0x3133a5);})[_0x5f37('0x20')](function(_0x382646){_0x4382af['rows']=_0x382646;return _0x4382af;})[_0x5f37('0x20')](respondWithFilteredResult(_0x193bfc,_0x3133a5))[_0x5f37('0x3c')](handleError(_0x193bfc,null));};exports[_0x5f37('0x3d')]=function(_0x272f8f,_0x9e1a37){var _0x3e9b1a={'raw':!![],'where':{'id':_0x272f8f['params']['id']}},_0x43e9e2={};_0x43e9e2['model']=_[_0x5f37('0x27')](db['CmHopperBlack']['rawAttributes']);_0x43e9e2[_0x5f37('0x28')]=_[_0x5f37('0x27')](_0x272f8f[_0x5f37('0x28')]);_0x43e9e2['filters']=_[_0x5f37('0x2a')](_0x43e9e2[_0x5f37('0x24')],_0x43e9e2['query']);_0x3e9b1a[_0x5f37('0x2b')]=_[_0x5f37('0x2a')](_0x43e9e2['model'],qs['fields'](_0x272f8f[_0x5f37('0x28')]['fields']));_0x3e9b1a[_0x5f37('0x2b')]=_0x3e9b1a[_0x5f37('0x2b')][_0x5f37('0x2d')]?_0x3e9b1a[_0x5f37('0x2b')]:_0x43e9e2['model'];if(_0x272f8f[_0x5f37('0x28')]['includeAll']){_0x3e9b1a['include']=[{'all':!![]}];}_0x3e9b1a=_['merge']({},_0x3e9b1a,_0x272f8f['options']);return db[_0x5f37('0x3b')][_0x5f37('0x3e')](_0x3e9b1a)[_0x5f37('0x20')](handleEntityNotFound(_0x9e1a37,null))['then'](respondWithResult(_0x9e1a37,null))[_0x5f37('0x3c')](handleError(_0x9e1a37,null));};exports[_0x5f37('0x1f')]=function(_0x3e2c16,_0x389843){if(_0x3e2c16[_0x5f37('0x3f')]['id']){delete _0x3e2c16[_0x5f37('0x3f')]['id'];}return db[_0x5f37('0x3b')][_0x5f37('0x3e')]({'where':{'id':_0x3e2c16[_0x5f37('0x40')]['id']}})[_0x5f37('0x20')](handleEntityNotFound(_0x389843,null))[_0x5f37('0x20')](saveUpdates(_0x3e2c16[_0x5f37('0x3f')],null))[_0x5f37('0x20')](respondWithResult(_0x389843,null))['catch'](handleError(_0x389843,null));};exports[_0x5f37('0x41')]=function(_0x47adf5,_0x613dfb){return db[_0x5f37('0x3b')]['find']({'where':{'id':_0x47adf5[_0x5f37('0x40')]['id']}})[_0x5f37('0x20')](handleEntityNotFound(_0x613dfb,null))[_0x5f37('0x20')](removeEntity(_0x613dfb,null))[_0x5f37('0x3c')](handleError(_0x613dfb,null));};exports[_0x5f37('0x42')]=function(_0xa9b1fe,_0x2cdee0){return db[_0x5f37('0x3b')][_0x5f37('0x42')]()[_0x5f37('0x20')](respondWithResult(_0x2cdee0,null))[_0x5f37('0x3c')](handleError(_0x2cdee0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 50ae628..43a4d94 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 _0xef03=['cm_hopper_black','util','api','moment','bluebird','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef03,0xdd));var _0x3ef0=function(_0x1e0084,_0x2dd44b){_0x1e0084=_0x1e0084-0x0;var _0x2ed6e2=_0xef03[_0x1e0084];return _0x2ed6e2;};'use strict';var _=require('lodash');var util=require(_0x3ef0('0x0'));var logger=require('../../config/logger')(_0x3ef0('0x1'));var moment=require(_0x3ef0('0x2'));var BPromise=require(_0x3ef0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ef0('0x4'));var config=require('../../config/environment');var attributes=require(_0x3ef0('0x5'));module[_0x3ef0('0x6')]=function(_0x22e3d4,_0x14dd3f){return _0x22e3d4[_0x3ef0('0x7')](_0x3ef0('0x8'),attributes,{'tableName':_0x3ef0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f2=['request-promise','path','../../config/environment','exports','define','CmHopperBlack','lodash','util','api','moment'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe9f2,0x1e6));var _0x2e9f=function(_0x3be1bf,_0x1cc0ff){_0x3be1bf=_0x3be1bf-0x0;var _0x32cdeb=_0xe9f2[_0x3be1bf];return _0x32cdeb;};'use strict';var _=require(_0x2e9f('0x0'));var util=require(_0x2e9f('0x1'));var logger=require('../../config/logger')(_0x2e9f('0x2'));var moment=require(_0x2e9f('0x3'));var BPromise=require('bluebird');var rp=require(_0x2e9f('0x4'));var fs=require('fs');var path=require(_0x2e9f('0x5'));var rimraf=require('rimraf');var config=require(_0x2e9f('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x2e9f('0x7')]=function(_0x46542c,_0x44968c){return _0x46542c[_0x2e9f('0x8')](_0x2e9f('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index ff4b9fb..6d72ba1 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 _0xb14e=['http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','request\x20sent','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','include','map','model','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x151835,_0x466f81){var _0x5219e0=function(_0x4d7a7e){while(--_0x4d7a7e){_0x151835['push'](_0x151835['shift']());}};_0x5219e0(++_0x466f81);}(_0xb14e,0xa7));var _0xeb14=function(_0xb67e18,_0xa04ef5){_0xb67e18=_0xb67e18-0x0;var _0x51ea80=_0xb14e[_0xb67e18];return _0x51ea80;};'use strict';var _=require('lodash');var util=require(_0xeb14('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb14('0x1'));var fs=require('fs');var Redis=require(_0xeb14('0x2'));var db=require(_0xeb14('0x3'))['db'];var utils=require(_0xeb14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xeb14('0x5'));var jayson=require(_0xeb14('0x6'));var client=jayson[_0xeb14('0x7')][_0xeb14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dc107,_0x4ef045,_0x48b73b){return new BPromise(function(_0x1a379f,_0x54c70b){return client[_0xeb14('0x9')](_0x5dc107,_0x48b73b)[_0xeb14('0xa')](function(_0x13463d){logger[_0xeb14('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x4ef045,'request\x20sent');logger[_0xeb14('0xc')](_0xeb14('0xd'),_0x4ef045,'request\x20sent',JSON[_0xeb14('0xe')](_0x13463d));if(_0x13463d[_0xeb14('0xf')]){if(_0x13463d[_0xeb14('0xf')][_0xeb14('0x10')]===0x1f4){logger[_0xeb14('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x4ef045,_0x13463d[_0xeb14('0xf')][_0xeb14('0x11')]);return _0x54c70b(_0x13463d['error'][_0xeb14('0x11')]);}logger[_0xeb14('0xf')](_0xeb14('0x12'),_0x4ef045,_0x13463d['error'][_0xeb14('0x11')]);return _0x1a379f(_0x13463d[_0xeb14('0xf')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x4ef045,_0xeb14('0x13'));_0x1a379f(_0x13463d['result'][_0xeb14('0x11')]);}})[_0xeb14('0x14')](function(_0x4e483b){logger[_0xeb14('0xf')](_0xeb14('0x12'),_0x4ef045,_0x4e483b);_0x54c70b(_0x4e483b);});});}exports[_0xeb14('0x15')]=function(_0x297b79){var _0x1f6a3a=this;return new Promise(function(_0x67322f,_0x133182){return db[_0xeb14('0x16')][_0xeb14('0x17')]({'raw':_0x297b79['options']?_0x297b79['options']['raw']===undefined?!![]:![]:!![],'where':_0x297b79[_0xeb14('0x18')]?_0x297b79['options'][_0xeb14('0x19')]||null:null,'attributes':_0x297b79[_0xeb14('0x18')]?_0x297b79[_0xeb14('0x18')][_0xeb14('0x1a')]||null:null,'limit':_0x297b79[_0xeb14('0x18')]?_0x297b79[_0xeb14('0x18')]['limit']||null:null,'include':_0x297b79[_0xeb14('0x18')]?_0x297b79[_0xeb14('0x18')][_0xeb14('0x1b')]?_[_0xeb14('0x1c')](_0x297b79[_0xeb14('0x18')]['include'],function(_0xff6011){return{'model':db[_0xff6011[_0xeb14('0x1d')]],'as':_0xff6011['as'],'attributes':_0xff6011['attributes'],'include':_0xff6011[_0xeb14('0x1b')]?_[_0xeb14('0x1c')](_0xff6011[_0xeb14('0x1b')],function(_0x5d8736){return{'model':db[_0x5d8736[_0xeb14('0x1d')]],'as':_0x5d8736['as'],'attributes':_0x5d8736['attributes'],'include':_0x5d8736[_0xeb14('0x1b')]?_[_0xeb14('0x1c')](_0x5d8736['include'],function(_0x132db0){return{'model':db[_0x132db0['model']],'as':_0x132db0['as'],'attributes':_0x132db0[_0xeb14('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c549e){logger[_0xeb14('0xb')](_0xeb14('0x15'),_0x297b79);logger[_0xeb14('0xc')]('GetCmHopperBlack',_0x297b79,JSON[_0xeb14('0xe')](_0x3c549e));_0x67322f(_0x3c549e);})[_0xeb14('0x14')](function(_0x4b8dab){logger[_0xeb14('0xf')](_0xeb14('0x15'),_0x4b8dab[_0xeb14('0x11')],_0x297b79);_0x133182(_0x1f6a3a[_0xeb14('0xf')](0x1f4,_0x4b8dab['message']));});});};exports[_0xeb14('0x1e')]=function(_0x54c8da){var _0x29fa4b=this;return new Promise(function(_0x2c22c3,_0x52b2ee){return db[_0xeb14('0x16')][_0xeb14('0x1f')](_0x54c8da[_0xeb14('0x20')],{'raw':_0x54c8da[_0xeb14('0x18')]?_0x54c8da['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c8da[_0xeb14('0x18')]?_0x54c8da[_0xeb14('0x18')][_0xeb14('0x19')]||null:null,'attributes':_0x54c8da[_0xeb14('0x18')]?_0x54c8da[_0xeb14('0x18')][_0xeb14('0x1a')]||null:null,'limit':_0x54c8da[_0xeb14('0x18')]?_0x54c8da[_0xeb14('0x18')]['limit']||null:null})[_0xeb14('0xa')](function(_0x56b968){logger[_0xeb14('0xb')](_0xeb14('0x1e'),_0x54c8da);logger[_0xeb14('0xc')](_0xeb14('0x1e'),_0x54c8da,JSON[_0xeb14('0xe')](_0x56b968));_0x2c22c3(_0x56b968);})[_0xeb14('0x14')](function(_0x1bc4aa){logger['error'](_0xeb14('0x1e'),_0x1bc4aa[_0xeb14('0x11')],_0x54c8da);_0x52b2ee(_0x29fa4b[_0xeb14('0xf')](0x1f4,_0x1bc4aa['message']));});});};exports['DestroyCmHopperBlack']=function(_0x193b9b){var _0x11c829=this;return new Promise(function(_0x30c87a,_0x2b2429){return db[_0xeb14('0x16')][_0xeb14('0x21')]({'where':_0x193b9b['options']?_0x193b9b[_0xeb14('0x18')][_0xeb14('0x19')]||null:null})[_0xeb14('0xa')](function(_0x17514d){logger[_0xeb14('0xb')](_0xeb14('0x22'),_0x193b9b);logger[_0xeb14('0xc')](_0xeb14('0x22'),_0x193b9b,JSON[_0xeb14('0xe')](_0x17514d));_0x30c87a(_0x17514d);})[_0xeb14('0x14')](function(_0x2893dc){logger['error'](_0xeb14('0x22'),_0x2893dc[_0xeb14('0x11')],_0x193b9b);_0x2b2429(_0x11c829[_0xeb14('0xf')](0x1f4,_0x2893dc[_0xeb14('0x11')]));});});}; \ No newline at end of file +var _0xfe3d=['error','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x34cd31,_0x110f96){var _0x2728ed=function(_0x5c0c97){while(--_0x5c0c97){_0x34cd31['push'](_0x34cd31['shift']());}};_0x2728ed(++_0x110f96);}(_0xfe3d,0x1e7));var _0xdfe3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xfe3d[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xdfe3('0x0'));var util=require(_0xdfe3('0x1'));var moment=require(_0xdfe3('0x2'));var BPromise=require('bluebird');var rs=require(_0xdfe3('0x3'));var fs=require('fs');var Redis=require(_0xdfe3('0x4'));var db=require(_0xdfe3('0x5'))['db'];var utils=require(_0xdfe3('0x6'));var logger=require(_0xdfe3('0x7'))(_0xdfe3('0x8'));var config=require('../../config/environment');var jayson=require(_0xdfe3('0x9'));var client=jayson['client'][_0xdfe3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x258c4c,_0x561511,_0x1c5e1f){return new BPromise(function(_0x5ca2b9,_0x38c8a3){return client[_0xdfe3('0xb')](_0x258c4c,_0x1c5e1f)[_0xdfe3('0xc')](function(_0xefa59c){logger[_0xdfe3('0xd')](_0xdfe3('0xe'),_0x561511,_0xdfe3('0xf'));logger[_0xdfe3('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x561511,_0xdfe3('0xf'),JSON['stringify'](_0xefa59c));if(_0xefa59c[_0xdfe3('0x11')]){if(_0xefa59c['error']['code']===0x1f4){logger[_0xdfe3('0x11')](_0xdfe3('0xe'),_0x561511,_0xefa59c['error'][_0xdfe3('0x12')]);return _0x38c8a3(_0xefa59c[_0xdfe3('0x11')][_0xdfe3('0x12')]);}logger[_0xdfe3('0x11')](_0xdfe3('0xe'),_0x561511,_0xefa59c[_0xdfe3('0x11')][_0xdfe3('0x12')]);return _0x5ca2b9(_0xefa59c[_0xdfe3('0x11')]['message']);}else{logger[_0xdfe3('0xd')](_0xdfe3('0xe'),_0x561511,_0xdfe3('0xf'));_0x5ca2b9(_0xefa59c[_0xdfe3('0x13')]['message']);}})[_0xdfe3('0x14')](function(_0x2f0e64){logger[_0xdfe3('0x11')](_0xdfe3('0xe'),_0x561511,_0x2f0e64);_0x38c8a3(_0x2f0e64);});});}exports[_0xdfe3('0x15')]=function(_0x3d416a){var _0x1cb9e4=this;return new Promise(function(_0x4d4690,_0x2cb846){return db[_0xdfe3('0x16')]['findAll']({'raw':_0x3d416a[_0xdfe3('0x17')]?_0x3d416a[_0xdfe3('0x17')][_0xdfe3('0x18')]===undefined?!![]:![]:!![],'where':_0x3d416a[_0xdfe3('0x17')]?_0x3d416a[_0xdfe3('0x17')][_0xdfe3('0x19')]||null:null,'attributes':_0x3d416a['options']?_0x3d416a['options'][_0xdfe3('0x1a')]||null:null,'limit':_0x3d416a['options']?_0x3d416a[_0xdfe3('0x17')][_0xdfe3('0x1b')]||null:null,'include':_0x3d416a[_0xdfe3('0x17')]?_0x3d416a['options'][_0xdfe3('0x1c')]?_['map'](_0x3d416a[_0xdfe3('0x17')][_0xdfe3('0x1c')],function(_0x547be9){return{'model':db[_0x547be9[_0xdfe3('0x1d')]],'as':_0x547be9['as'],'attributes':_0x547be9['attributes'],'include':_0x547be9[_0xdfe3('0x1c')]?_[_0xdfe3('0x1e')](_0x547be9[_0xdfe3('0x1c')],function(_0x2d4f0a){return{'model':db[_0x2d4f0a[_0xdfe3('0x1d')]],'as':_0x2d4f0a['as'],'attributes':_0x2d4f0a[_0xdfe3('0x1a')],'include':_0x2d4f0a[_0xdfe3('0x1c')]?_[_0xdfe3('0x1e')](_0x2d4f0a[_0xdfe3('0x1c')],function(_0x2c812c){return{'model':db[_0x2c812c[_0xdfe3('0x1d')]],'as':_0x2c812c['as'],'attributes':_0x2c812c[_0xdfe3('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xca85e4){logger[_0xdfe3('0xd')](_0xdfe3('0x15'),_0x3d416a);logger[_0xdfe3('0x10')](_0xdfe3('0x15'),_0x3d416a,JSON[_0xdfe3('0x1f')](_0xca85e4));_0x4d4690(_0xca85e4);})[_0xdfe3('0x14')](function(_0x129ef6){logger[_0xdfe3('0x11')](_0xdfe3('0x15'),_0x129ef6['message'],_0x3d416a);_0x2cb846(_0x1cb9e4[_0xdfe3('0x11')](0x1f4,_0x129ef6[_0xdfe3('0x12')]));});});};exports[_0xdfe3('0x20')]=function(_0x270a9e){var _0x1a42b9=this;return new Promise(function(_0xa8803d,_0x22ff08){return db[_0xdfe3('0x16')][_0xdfe3('0x21')](_0x270a9e[_0xdfe3('0x22')],{'raw':_0x270a9e['options']?_0x270a9e[_0xdfe3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270a9e[_0xdfe3('0x17')]?_0x270a9e[_0xdfe3('0x17')]['where']||null:null,'attributes':_0x270a9e['options']?_0x270a9e[_0xdfe3('0x17')]['attributes']||null:null,'limit':_0x270a9e[_0xdfe3('0x17')]?_0x270a9e[_0xdfe3('0x17')][_0xdfe3('0x1b')]||null:null})[_0xdfe3('0xc')](function(_0x41ec30){logger['info']('UpdateCmHopperBlack',_0x270a9e);logger['debug'](_0xdfe3('0x20'),_0x270a9e,JSON[_0xdfe3('0x1f')](_0x41ec30));_0xa8803d(_0x41ec30);})[_0xdfe3('0x14')](function(_0x16939d){logger['error']('UpdateCmHopperBlack',_0x16939d[_0xdfe3('0x12')],_0x270a9e);_0x22ff08(_0x1a42b9[_0xdfe3('0x11')](0x1f4,_0x16939d['message']));});});};exports['DestroyCmHopperBlack']=function(_0x51904c){var _0x7ec531=this;return new Promise(function(_0x1b7368,_0x165885){return db[_0xdfe3('0x16')]['destroy']({'where':_0x51904c['options']?_0x51904c[_0xdfe3('0x17')][_0xdfe3('0x19')]||null:null})[_0xdfe3('0xc')](function(_0x42bddb){logger[_0xdfe3('0xd')]('DestroyCmHopperBlack',_0x51904c);logger['debug'](_0xdfe3('0x23'),_0x51904c,JSON[_0xdfe3('0x1f')](_0x42bddb));_0x1b7368(_0x42bddb);})['catch'](function(_0x56095c){logger[_0xdfe3('0x11')](_0xdfe3('0x23'),_0x56095c[_0xdfe3('0x12')],_0x51904c);_0x165885(_0x7ec531[_0xdfe3('0x11')](0x1f4,_0x56095c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2fa0f61..b1e75be 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 _0xe3da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')](_0xae3d('0x12'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x13')]);router[_0xae3d('0x14')]('/:id',auth[_0xae3d('0xc')](),controller['destroy']);module[_0xae3d('0x15')]=router; \ No newline at end of file +var _0xc2c7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0xc2c7,0x134));var _0x7c2c=function(_0xd17ed9,_0x908409){_0xd17ed9=_0xd17ed9-0x0;var _0x4d8950=_0xc2c7[_0xd17ed9];return _0x4d8950;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['put'](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);module[_0x7c2c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 3ca7aa6..c487f66 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 _0xdd53=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x3451b2,_0x19cdb6){var _0x5c515a=function(_0x3e344c){while(--_0x3e344c){_0x3451b2['push'](_0x3451b2['shift']());}};_0x5c515a(++_0x19cdb6);}(_0xdd53,0x6c));var _0x3dd5=function(_0x232aa9,_0x1dc221){_0x232aa9=_0x232aa9-0x0;var _0x135acd=_0xdd53[_0x232aa9];return _0x135acd;};'use strict';var Sequelize=require(_0x3dd5('0x0'));var moment=require(_0x3dd5('0x1'));module['exports']={'state':{'type':Sequelize[_0x3dd5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3dd5('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3dd5('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x3dd5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3dd5('0x3')]},'starttime':{'type':Sequelize[_0x3dd5('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3dd5('0x4')]},'droptime':{'type':Sequelize[_0x3dd5('0x4')]},'endtime':{'type':Sequelize[_0x3dd5('0x4')]},'ringtime':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3dd5('0x3')]},'campaign':{'type':Sequelize[_0x3dd5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3dd5('0x3')]},'reason':{'type':Sequelize[_0x3dd5('0x3')]},'disposition':{'type':Sequelize[_0x3dd5('0x3')]},'secondDisposition':{'type':Sequelize[_0x3dd5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3dd5('0x3')]},'dispositionat':{'type':Sequelize[_0x3dd5('0x4')],'set':function(_0x5875a3){var _0x26bb47=this[_0x3dd5('0x5')](_0x3dd5('0x6'));if(_0x26bb47&&_0x5875a3){this[_0x3dd5('0x7')]('followuptime',moment(_0x5875a3)[_0x3dd5('0x8')](moment(_0x26bb47),_0x3dd5('0x9')));}}},'amd':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3dd5('0x4')]},'callback':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3dd5('0x4')]},'deleted':{'type':Sequelize[_0x3dd5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3dd5('0x4')]},'recallme':{'type':Sequelize[_0x3dd5('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3dd5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3dd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x058d=['diff','BOOLEAN','STRING','DATE','INTEGER','getDataValue','endtime','followuptime'];(function(_0x53976e,_0x313deb){var _0x330aae=function(_0x4bc250){while(--_0x4bc250){_0x53976e['push'](_0x53976e['shift']());}};_0x330aae(++_0x313deb);}(_0x058d,0x16a));var _0xd058=function(_0x36e855,_0x5aa495){_0x36e855=_0x36e855-0x0;var _0x2d9dd3=_0x058d[_0x36e855];return _0x2d9dd3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd058('0x0')]},'scheduledat':{'type':Sequelize[_0xd058('0x1')]},'countbusyretry':{'type':Sequelize[_0xd058('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd058('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd058('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd058('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd058('0x0')]},'originatecalleridname':{'type':Sequelize[_0xd058('0x0')]},'calleridnum':{'type':Sequelize[_0xd058('0x0')]},'calleridname':{'type':Sequelize[_0xd058('0x0')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd058('0x1')]},'answertime':{'type':Sequelize[_0xd058('0x1')]},'droptime':{'type':Sequelize[_0xd058('0x1')]},'endtime':{'type':Sequelize[_0xd058('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd058('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd058('0x0')]},'campaign':{'type':Sequelize[_0xd058('0x0')]},'campaigntype':{'type':Sequelize[_0xd058('0x0')]},'membername':{'type':Sequelize[_0xd058('0x0')]},'reason':{'type':Sequelize[_0xd058('0x0')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd058('0x0')]},'thirdDisposition':{'type':Sequelize[_0xd058('0x0')]},'dispositionat':{'type':Sequelize[_0xd058('0x1')],'set':function(_0x253df3){var _0x26c7de=this[_0xd058('0x3')](_0xd058('0x4'));if(_0x26c7de&&_0x253df3){this['setDataValue'](_0xd058('0x5'),moment(_0x253df3)[_0xd058('0x6')](moment(_0x26c7de),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd058('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd058('0x1')]},'callback':{'type':Sequelize[_0xd058('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd058('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd058('0x1')]},'recallme':{'type':Sequelize[_0xd058('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd058('0x1')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd058('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd058('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 ce4214b..f56dc89 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 _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x581cb5,_0xaf407b){var _0x1d31e8=function(_0x380985){while(--_0x380985){_0x581cb5['push'](_0x581cb5['shift']());}};_0x1d31e8(++_0xaf407b);}(_0x1883,0xab));var _0x3188=function(_0x5a1017,_0x4ca6bf){_0x5a1017=_0x5a1017-0x0;var _0x1fb1a4=_0x1883[_0x5a1017];return _0x1fb1a4;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file +var _0xeda8=['calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','select'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xeda8,0x104));var _0x8eda=function(_0x53476e,_0x17122e){_0x53476e=_0x53476e-0x0;var _0x78cd63=_0xeda8[_0x53476e];return _0x78cd63;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['describe']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['describe']()[_0x8eda('0x24')](respondWithResult(_0x52b026,null))['catch'](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0x3aca19,_0xf445){if(_0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')]){delete _0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'uniqueid':_0x3aca19[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0xf445,null))[_0x8eda('0x24')](saveUpdates(_0x3aca19['body'],null))[_0x8eda('0x24')](respondWithResult(_0xf445,null))[_0x8eda('0x40')](handleError(_0xf445,null));};exports[_0x8eda('0x48')]=function(_0x3259de,_0x33ba39,_0x389399){return db[_0x8eda('0x2a')][_0x8eda('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x3259de[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),'noAnswerContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x8eda('0x4f')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x50')))),'congestionContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x53')))),'abandonedContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x8eda('0x54')],[db['sequelize']['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x55')))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x33ba39,null))['then'](respondWithResult(_0x33ba39,null))[_0x8eda('0x40')](handleError(_0x33ba39,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdd71ce,_0x4ba827,_0xfb98bf){return db['CmHopperFinal'][_0x8eda('0x49')]({'raw':![],'where':{'CampaignId':_0xdd71ce[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),_0x8eda('0x57')],[db['sequelize']['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x58')))),'busyContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eda('0x59')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')]['literal'](_0x8eda('0x53')))),_0x8eda('0x5a')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x8eda('0x5b')))),_0x8eda('0x54')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x4ba827,null))['then'](respondWithResult(_0x4ba827,null))[_0x8eda('0x40')](handleError(_0x4ba827,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x47f57c,_0x49d1a1,_0x5e66cd){return db[_0x8eda('0x5c')][_0x8eda('0x45')]({'where':{'id':_0x47f57c[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x49d1a1,null))[_0x8eda('0x24')](function(_0xe5d324){var _0x589c2f;if(_0xe5d324){_0x589c2f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')](['phone',_0x8eda('0x61'),_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),_0x8eda('0x65'),_0x8eda('0x66')],squel['select']()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),_0x8eda('0x61'))[_0x8eda('0x67')](_0x8eda('0x6b'),_0x8eda('0x62'))[_0x8eda('0x67')](_0x8eda('0x6c'),_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x6d'),'VoiceQueueId')['field'](_0x8eda('0x6a'),_0x8eda('0x65'))[_0x8eda('0x67')](_0x8eda('0x6a'),'updatedAt')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x70'),_0x47f57c['params']['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x47f57c['body'][_0x8eda('0x73')][_0x8eda('0x71')]())[_0x8eda('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')]('phone')['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c[_0x8eda('0x42')]['id']['toString']()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x76'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c['params']['id']['toString']())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x589c2f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x49d1a1,null))[_0x8eda('0x40')](handleError(_0x49d1a1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbe8b,_0x437c6f,_0x1006b1){return db['Campaign'][_0x8eda('0x45')]({'where':{'id':_0x1bbe8b[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x437c6f,null))[_0x8eda('0x24')](function(_0x33350e){var _0x3e245f;if(_0x33350e){_0x3e245f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')]([_0x8eda('0x69'),'scheduledAt',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x79'),_0x8eda('0x65'),_0x8eda('0x66')],squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x8eda('0x62'))[_0x8eda('0x67')]('ANY_VALUE(ListId)',_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x7a'),'CampaignId')[_0x8eda('0x67')]('NOW()',_0x8eda('0x65'))['field'](_0x8eda('0x6a'),_0x8eda('0x66'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x1bbe8b[_0x8eda('0x46')][_0x8eda('0x73')][_0x8eda('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x69'))['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()['field']('calleridnum')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x3e245f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x437c6f,null))['catch'](handleError(_0x437c6f,null));};exports[_0x8eda('0x7c')]=function(_0x11f734,_0x4cb4e6,_0x5d8512){return db['CmHopper'][_0x8eda('0x7d')]({'where':{'VoiceQueueId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x64')],'CampaignId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x79')],'ContactId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x62')]}})[_0x8eda('0x24')](handleEntityNotFound(_0x4cb4e6,null))[_0x8eda('0x24')](function(_0x1a3993){if(_0x1a3993){return _0x1a3993;}return null;})[_0x8eda('0x24')](respondWithResult(_0x4cb4e6,null))[_0x8eda('0x40')](handleError(_0x4cb4e6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 083228d..4930573 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 _0x40c8=['./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x40c8,0x10f));var _0x840c=function(_0x24399a,_0x1deb50){_0x24399a=_0x24399a-0x0;var _0x5e58f2=_0x40c8[_0x24399a];return _0x5e58f2;};'use strict';var _=require(_0x840c('0x0'));var util=require(_0x840c('0x1'));var logger=require(_0x840c('0x2'))(_0x840c('0x3'));var moment=require(_0x840c('0x4'));var BPromise=require(_0x840c('0x5'));var rp=require(_0x840c('0x6'));var fs=require('fs');var path=require(_0x840c('0x7'));var rimraf=require('rimraf');var config=require(_0x840c('0x8'));var attributes=require(_0x840c('0x9'));module['exports']=function(_0x244a31,_0x288f5d){return _0x244a31[_0x840c('0xa')]('CmHopperFinal',attributes,{'tableName':_0x840c('0xb'),'paranoid':![],'indexes':[{'name':_0x840c('0xc'),'fields':[_0x840c('0xc')]},{'name':_0x840c('0xd'),'fields':[_0x840c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bdc=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bdc,0x67));var _0xc4bd=function(_0x3664e1,_0x5bce75){_0x3664e1=_0x3664e1-0x0;var _0x3a6efa=_0x4bdc[_0x3664e1];return _0x3a6efa;};'use strict';var _=require(_0xc4bd('0x0'));var util=require(_0xc4bd('0x1'));var logger=require(_0xc4bd('0x2'))(_0xc4bd('0x3'));var moment=require('moment');var BPromise=require(_0xc4bd('0x4'));var rp=require(_0xc4bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4bd('0x6'));var config=require(_0xc4bd('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0xc4bd('0x8')]=function(_0x380fe4,_0x2104d3){return _0x380fe4['define'](_0xc4bd('0x9'),attributes,{'tableName':_0xc4bd('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xc4bd('0xb')]},{'name':_0xc4bd('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index fbdad70..bf9bec1 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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3eabc2,_0x2b981b){var _0x2e0863=function(_0x2ebafa){while(--_0x2ebafa){_0x3eabc2['push'](_0x3eabc2['shift']());}};_0x2e0863(++_0x2b981b);}(_0xb10b,0x12a));var _0xbb10=function(_0x15c23e,_0x162305){_0x15c23e=_0x15c23e-0x0;var _0x4ed7d1=_0xb10b[_0x15c23e];return _0x4ed7d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +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(_0x4811a5,_0x17624b){var _0x5e6219=function(_0x298fdb){while(--_0x298fdb){_0x4811a5['push'](_0x4811a5['shift']());}};_0x5e6219(++_0x17624b);}(_0x7a54,0x106));var _0x47a5=function(_0x51cff8,_0x464e27){_0x51cff8=_0x51cff8-0x0;var _0x17702b=_0x7a54[_0x51cff8];return _0x17702b;};'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 e787147..9ad8622 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 _0x3823=['../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e9aca,_0x1bfeeb){var _0x22b7c2=function(_0x3dfdbc){while(--_0x3dfdbc){_0x5e9aca['push'](_0x5e9aca['shift']());}};_0x22b7c2(++_0x1bfeeb);}(_0x3823,0xb0));var _0x3382=function(_0x570b17,_0x3e25d4){_0x570b17=_0x570b17-0x0;var _0x230b47=_0x3823[_0x570b17];return _0x230b47;};'use strict';var multer=require('multer');var util=require(_0x3382('0x0'));var path=require(_0x3382('0x1'));var timeout=require(_0x3382('0x2'));var express=require('express');var router=express[_0x3382('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3382('0x4'));var interaction=require(_0x3382('0x5'));var config=require(_0x3382('0x6'));var controller=require(_0x3382('0x7'));router['get']('/',auth[_0x3382('0x8')](),controller[_0x3382('0x9')]);router[_0x3382('0xa')](_0x3382('0xb'),auth[_0x3382('0x8')](),controller[_0x3382('0xc')]);router[_0x3382('0xa')](_0x3382('0xd'),auth[_0x3382('0x8')](),controller[_0x3382('0xe')]);router[_0x3382('0xa')](_0x3382('0xf'),auth[_0x3382('0x8')](),controller[_0x3382('0x10')]);router[_0x3382('0xa')](_0x3382('0x11'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x3382('0x12')](_0x3382('0x13'),auth[_0x3382('0x8')](),controller[_0x3382('0x14')]);router[_0x3382('0x12')](_0x3382('0x15'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x3382('0x12')](_0x3382('0x16'),auth[_0x3382('0x8')](),controller[_0x3382('0x17')]);router[_0x3382('0x18')](_0x3382('0xd'),auth[_0x3382('0x8')](),controller['update']);module[_0x3382('0x19')]=router; \ No newline at end of file +var _0xc2f2=['/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x8e14cd,_0x5c26c7){var _0x23d8af=function(_0x462947){while(--_0x462947){_0x8e14cd['push'](_0x8e14cd['shift']());}};_0x23d8af(++_0x5c26c7);}(_0xc2f2,0xb9));var _0x2c2f=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0xc2f2[_0x187d80];return _0x498a77;};'use strict';var multer=require(_0x2c2f('0x0'));var util=require('util');var path=require(_0x2c2f('0x1'));var timeout=require(_0x2c2f('0x2'));var express=require(_0x2c2f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2c2f('0x4'));var interaction=require(_0x2c2f('0x5'));var config=require(_0x2c2f('0x6'));var controller=require('./cmHopperFinal.controller');router[_0x2c2f('0x7')]('/',auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x9')]);router['get']('/describe',auth[_0x2c2f('0x8')](),controller[_0x2c2f('0xa')]);router['get'](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0xc')]);router[_0x2c2f('0x7')](_0x2c2f('0xd'),auth[_0x2c2f('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x2c2f('0xe')]);router[_0x2c2f('0xf')](_0x2c2f('0x10'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x11')]);router[_0x2c2f('0xf')]('/voice/campaign/moveContacts/:id',auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x12')]);router[_0x2c2f('0xf')](_0x2c2f('0x13'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x14')]);router[_0x2c2f('0x15')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7fc6dab..76fe5ef 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 _0xdb1c=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x42b324,_0x321cae){var _0x2896c3=function(_0x2018d4){while(--_0x2018d4){_0x42b324['push'](_0x42b324['shift']());}};_0x2896c3(++_0x321cae);}(_0xdb1c,0xcf));var _0xcdb1=function(_0xe6aba1,_0x4ff2b4){_0xe6aba1=_0xe6aba1-0x0;var _0x56482c=_0xdb1c[_0xe6aba1];return _0x56482c;};'use strict';var Sequelize=require(_0xcdb1('0x0'));module[_0xcdb1('0x1')]={'state':{'type':Sequelize[_0xcdb1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcdb1('0x3')]},'scheduledat':{'type':Sequelize[_0xcdb1('0x4')]},'countbusyretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcdb1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xcdb1('0x3')]},'originatecalleridname':{'type':Sequelize[_0xcdb1('0x3')]},'calleridnum':{'type':Sequelize[_0xcdb1('0x3')]},'calleridname':{'type':Sequelize[_0xcdb1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcdb1('0x4')]},'answertime':{'type':Sequelize[_0xcdb1('0x4')]},'droptime':{'type':Sequelize[_0xcdb1('0x4')]},'endtime':{'type':Sequelize[_0xcdb1('0x4')]},'ringtime':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcdb1('0x3')]},'campaign':{'type':Sequelize[_0xcdb1('0x3')]},'campaigntype':{'type':Sequelize[_0xcdb1('0x3')]},'membername':{'type':Sequelize[_0xcdb1('0x3')]},'reason':{'type':Sequelize[_0xcdb1('0x3')]},'amd':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcdb1('0x4')]},'recallme':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcdb1('0x4')]},'edited':{'type':Sequelize[_0xcdb1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcdb1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc033=['BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0x5434e5,_0x166613){var _0x656ff8=function(_0x120744){while(--_0x120744){_0x5434e5['push'](_0x5434e5['shift']());}};_0x656ff8(++_0x166613);}(_0xc033,0xd3));var _0x3c03=function(_0x37586b,_0x138bec){_0x37586b=_0x37586b-0x0;var _0x57a956=_0xc033[_0x37586b];return _0x57a956;};'use strict';var Sequelize=require(_0x3c03('0x0'));module[_0x3c03('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3c03('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3c03('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x3c03('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3c03('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x3c03('0x2')]},'responsetime':{'type':Sequelize[_0x3c03('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3c03('0x2')]},'endtime':{'type':Sequelize[_0x3c03('0x2')]},'ringtime':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3c03('0x4')]},'campaign':{'type':Sequelize[_0x3c03('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3c03('0x4')]},'reason':{'type':Sequelize[_0x3c03('0x4')]},'amd':{'type':Sequelize[_0x3c03('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3c03('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3c03('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3c03('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3c03('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x3c03('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3c03('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3c03('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 922e11c..ffffbd0 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 _0xd7b6=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','CmHopperHistory','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','rawAttributes','find','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x35c718,_0x33a696){var _0x5c3099=function(_0x2810cd){while(--_0x2810cd){_0x35c718['push'](_0x35c718['shift']());}};_0x5c3099(++_0x33a696);}(_0xd7b6,0xe1));var _0x6d7b=function(_0x9b2bb,_0x254d3c){_0x9b2bb=_0x9b2bb-0x0;var _0x402f9d=_0xd7b6[_0x9b2bb];return _0x402f9d;};'use strict';var emlformat=require(_0x6d7b('0x0'));var rimraf=require(_0x6d7b('0x1'));var zipdir=require(_0x6d7b('0x2'));var jsonpatch=require(_0x6d7b('0x3'));var rp=require('request-promise');var moment=require(_0x6d7b('0x4'));var BPromise=require(_0x6d7b('0x5'));var Mustache=require(_0x6d7b('0x6'));var util=require(_0x6d7b('0x7'));var path=require(_0x6d7b('0x8'));var sox=require(_0x6d7b('0x9'));var csv=require(_0x6d7b('0xa'));var ejs=require(_0x6d7b('0xb'));var fs=require('fs');var fs_extra=require(_0x6d7b('0xc'));var _=require(_0x6d7b('0xd'));var squel=require(_0x6d7b('0xe'));var crypto=require(_0x6d7b('0xf'));var jsforce=require(_0x6d7b('0x10'));var deskjs=require(_0x6d7b('0x11'));var toCsv=require(_0x6d7b('0xa'));var querystring=require(_0x6d7b('0x12'));var Papa=require(_0x6d7b('0x13'));var Redis=require(_0x6d7b('0x14'));var authService=require(_0x6d7b('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d7b('0x16'));var logger=require(_0x6d7b('0x17'))(_0x6d7b('0x18'));var utils=require('../../config/utils');var config=require(_0x6d7b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d7b('0x1a'))['db'];function respondWithStatusCode(_0x456bd9,_0x1e8ca8){_0x1e8ca8=_0x1e8ca8||0xcc;return function(_0x61cecc){if(_0x61cecc){return _0x456bd9[_0x6d7b('0x1b')](_0x1e8ca8);}return _0x456bd9[_0x6d7b('0x1c')](_0x1e8ca8)[_0x6d7b('0x1d')]();};}function respondWithResult(_0x3c8f10,_0x5eeb72){_0x5eeb72=_0x5eeb72||0xc8;return function(_0x4578d2){if(_0x4578d2){return _0x3c8f10['status'](_0x5eeb72)[_0x6d7b('0x1e')](_0x4578d2);}};}function respondWithFilteredResult(_0x4f1761,_0x6edc03){return function(_0x5b688a){if(_0x5b688a){var _0x308e69=typeof _0x6edc03['offset']===_0x6d7b('0x1f')&&typeof _0x6edc03[_0x6d7b('0x20')]===_0x6d7b('0x1f');var _0x4a5a2e=_0x5b688a[_0x6d7b('0x21')];var _0x5ead55=_0x308e69?0x0:_0x6edc03[_0x6d7b('0x22')];var _0x9474df=_0x308e69?_0x5b688a[_0x6d7b('0x21')]:_0x6edc03[_0x6d7b('0x22')]+_0x6edc03[_0x6d7b('0x20')];var _0x2c7dc6;if(_0x9474df>=_0x4a5a2e){_0x9474df=_0x4a5a2e;_0x2c7dc6=0xc8;}else{_0x2c7dc6=0xce;}_0x4f1761['status'](_0x2c7dc6);return _0x4f1761[_0x6d7b('0x23')](_0x6d7b('0x24'),_0x5ead55+'-'+_0x9474df+'/'+_0x4a5a2e)[_0x6d7b('0x1e')](_0x5b688a);}return null;};}function patchUpdates(_0x5c0ee1){return function(_0x274126){try{jsonpatch[_0x6d7b('0x25')](_0x274126,_0x5c0ee1,!![]);}catch(_0x31e5c7){return BPromise['reject'](_0x31e5c7);}return _0x274126[_0x6d7b('0x26')]();};}function saveUpdates(_0x4d1a52,_0x4f0475){return function(_0x5b3d84){if(_0x5b3d84){return _0x5b3d84[_0x6d7b('0x27')](_0x4d1a52)[_0x6d7b('0x28')](function(_0x54fa7e){return _0x54fa7e;});}return null;};}function removeEntity(_0x1237f2,_0x1cd7f9){return function(_0x22898d){if(_0x22898d){return _0x22898d['destroy']()[_0x6d7b('0x28')](function(){_0x1237f2[_0x6d7b('0x1c')](0xcc)[_0x6d7b('0x1d')]();});}};}function handleEntityNotFound(_0x1fbbec,_0x148118){return function(_0x3589b3){if(!_0x3589b3){_0x1fbbec[_0x6d7b('0x1b')](0x194);}return _0x3589b3;};}function handleError(_0x3ab218,_0x460543){_0x460543=_0x460543||0x1f4;return function(_0x32b7a6){logger[_0x6d7b('0x29')](_0x32b7a6[_0x6d7b('0x2a')]);if(_0x32b7a6[_0x6d7b('0x2b')]){delete _0x32b7a6['name'];}_0x3ab218[_0x6d7b('0x1c')](_0x460543)['send'](_0x32b7a6);};}exports[_0x6d7b('0x2c')]=function(_0x31915f,_0x5f4fb2){var _0x1e9433={},_0x21f4f7={},_0x3a7af4={'count':0x0,'rows':[]};var _0x22c3a9=_[_0x6d7b('0x2d')](db[_0x6d7b('0x2e')]['rawAttributes'],function(_0x4f5386){return{'name':_0x4f5386[_0x6d7b('0x2f')],'type':_0x4f5386[_0x6d7b('0x30')][_0x6d7b('0x31')]};});_0x21f4f7[_0x6d7b('0x32')]=_[_0x6d7b('0x2d')](_0x22c3a9,_0x6d7b('0x2b'));_0x21f4f7[_0x6d7b('0x33')]=_[_0x6d7b('0x34')](_0x31915f[_0x6d7b('0x33')]);_0x21f4f7['filters']=_[_0x6d7b('0x35')](_0x21f4f7[_0x6d7b('0x32')],_0x21f4f7[_0x6d7b('0x33')]);_0x1e9433[_0x6d7b('0x36')]=_[_0x6d7b('0x35')](_0x21f4f7[_0x6d7b('0x32')],qs[_0x6d7b('0x37')](_0x31915f['query'][_0x6d7b('0x37')]));_0x1e9433[_0x6d7b('0x36')]=_0x1e9433[_0x6d7b('0x36')][_0x6d7b('0x38')]?_0x1e9433['attributes']:_0x21f4f7[_0x6d7b('0x32')];if(!_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x39')](_0x6d7b('0x3a'))){_0x1e9433['limit']=qs[_0x6d7b('0x20')](_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x20')]);_0x1e9433['offset']=qs[_0x6d7b('0x22')](_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x22')]);}_0x1e9433[_0x6d7b('0x3b')]=qs[_0x6d7b('0x3c')](_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x3c')]);_0x1e9433[_0x6d7b('0x3d')]=qs[_0x6d7b('0x3e')](_[_0x6d7b('0x3f')](_0x31915f[_0x6d7b('0x33')],_0x21f4f7['filters']),_0x22c3a9);if(_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x40')]){_0x1e9433[_0x6d7b('0x3d')]=_['merge'](_0x1e9433[_0x6d7b('0x3d')],{'$or':_[_0x6d7b('0x2d')](_0x22c3a9,function(_0x22d905){if(_0x22d905['type']!==_0x6d7b('0x41')){var _0x2a40a2={};_0x2a40a2[_0x22d905[_0x6d7b('0x2b')]]={'$like':'%'+_0x31915f[_0x6d7b('0x33')]['filter']+'%'};return _0x2a40a2;}})});}_0x1e9433=_[_0x6d7b('0x42')]({},_0x1e9433,_0x31915f[_0x6d7b('0x43')]);var _0x7c4f6e={'where':_0x1e9433[_0x6d7b('0x3d')]};return db[_0x6d7b('0x2e')][_0x6d7b('0x21')](_0x7c4f6e)['then'](function(_0x2bfb95){_0x3a7af4[_0x6d7b('0x21')]=_0x2bfb95;if(_0x31915f[_0x6d7b('0x33')][_0x6d7b('0x44')]){_0x1e9433[_0x6d7b('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6d7b('0x46')](_0x1e9433);})[_0x6d7b('0x28')](function(_0x4d3e49){_0x3a7af4['rows']=_0x4d3e49;return _0x3a7af4;})['then'](respondWithFilteredResult(_0x5f4fb2,_0x1e9433))[_0x6d7b('0x47')](handleError(_0x5f4fb2,null));};exports['show']=function(_0x382a20,_0x230435){var _0x21da2c={'raw':!![],'where':{'id':_0x382a20['params']['id']}},_0x3e6ec6={};_0x3e6ec6[_0x6d7b('0x32')]=_[_0x6d7b('0x34')](db['CmHopperHistory'][_0x6d7b('0x48')]);_0x3e6ec6['query']=_[_0x6d7b('0x34')](_0x382a20[_0x6d7b('0x33')]);_0x3e6ec6[_0x6d7b('0x3e')]=_[_0x6d7b('0x35')](_0x3e6ec6[_0x6d7b('0x32')],_0x3e6ec6['query']);_0x21da2c['attributes']=_['intersection'](_0x3e6ec6[_0x6d7b('0x32')],qs['fields'](_0x382a20[_0x6d7b('0x33')][_0x6d7b('0x37')]));_0x21da2c[_0x6d7b('0x36')]=_0x21da2c[_0x6d7b('0x36')][_0x6d7b('0x38')]?_0x21da2c[_0x6d7b('0x36')]:_0x3e6ec6[_0x6d7b('0x32')];if(_0x382a20[_0x6d7b('0x33')][_0x6d7b('0x44')]){_0x21da2c[_0x6d7b('0x45')]=[{'all':!![]}];}_0x21da2c=_['merge']({},_0x21da2c,_0x382a20[_0x6d7b('0x43')]);return db[_0x6d7b('0x2e')][_0x6d7b('0x49')](_0x21da2c)[_0x6d7b('0x28')](handleEntityNotFound(_0x230435,null))[_0x6d7b('0x28')](respondWithResult(_0x230435,null))[_0x6d7b('0x47')](handleError(_0x230435,null));};exports['create']=function(_0x37b3e2,_0xc1b81c){return db['CmHopperHistory']['create'](_0x37b3e2[_0x6d7b('0x4a')],{})[_0x6d7b('0x28')](respondWithResult(_0xc1b81c,0xc9))[_0x6d7b('0x47')](handleError(_0xc1b81c,null));};exports[_0x6d7b('0x4b')]=function(_0x533902,_0xd18daf){return db[_0x6d7b('0x2e')]['describe']()[_0x6d7b('0x28')](respondWithResult(_0xd18daf,null))[_0x6d7b('0x47')](handleError(_0xd18daf,null));};exports[_0x6d7b('0x27')]=function(_0x79aad6,_0x31a312){if(_0x79aad6[_0x6d7b('0x4a')]['uniqueid']){delete _0x79aad6[_0x6d7b('0x4a')][_0x6d7b('0x4c')];}return db[_0x6d7b('0x2e')][_0x6d7b('0x49')]({'where':{'uniqueid':_0x79aad6[_0x6d7b('0x4d')]['id']}})[_0x6d7b('0x28')](handleEntityNotFound(_0x31a312,null))[_0x6d7b('0x28')](saveUpdates(_0x79aad6['body'],null))['then'](respondWithResult(_0x31a312,null))[_0x6d7b('0x47')](handleError(_0x31a312,null));}; \ No newline at end of file +var _0xd3b9=['rimraf','zip-dir','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','uniqueid','eml-format'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xd3b9,0x1c7));var _0x9d3b=function(_0x1901f3,_0x2c020b){_0x1901f3=_0x1901f3-0x0;var _0x27bf9d=_0xd3b9[_0x1901f3];return _0x27bf9d;};'use strict';var emlformat=require(_0x9d3b('0x0'));var rimraf=require(_0x9d3b('0x1'));var zipdir=require(_0x9d3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d3b('0x3'));var moment=require('moment');var BPromise=require(_0x9d3b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d3b('0x5'));var sox=require('sox');var csv=require(_0x9d3b('0x6'));var ejs=require(_0x9d3b('0x7'));var fs=require('fs');var fs_extra=require(_0x9d3b('0x8'));var _=require('lodash');var squel=require(_0x9d3b('0x9'));var crypto=require(_0x9d3b('0xa'));var jsforce=require(_0x9d3b('0xb'));var deskjs=require(_0x9d3b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d3b('0xd'));var Redis=require('ioredis');var authService=require(_0x9d3b('0xe'));var qs=require(_0x9d3b('0xf'));var as=require(_0x9d3b('0x10'));var hardwareService=require(_0x9d3b('0x11'));var logger=require(_0x9d3b('0x12'))(_0x9d3b('0x13'));var utils=require(_0x9d3b('0x14'));var config=require(_0x9d3b('0x15'));var licenseUtil=require(_0x9d3b('0x16'));var db=require(_0x9d3b('0x17'))['db'];function respondWithStatusCode(_0x24b3a1,_0x3dafa1){_0x3dafa1=_0x3dafa1||0xcc;return function(_0x4d372e){if(_0x4d372e){return _0x24b3a1['sendStatus'](_0x3dafa1);}return _0x24b3a1[_0x9d3b('0x18')](_0x3dafa1)[_0x9d3b('0x19')]();};}function respondWithResult(_0x5e201e,_0x4848e7){_0x4848e7=_0x4848e7||0xc8;return function(_0x39b353){if(_0x39b353){return _0x5e201e[_0x9d3b('0x18')](_0x4848e7)['json'](_0x39b353);}};}function respondWithFilteredResult(_0x5cc18b,_0xc69306){return function(_0x3e04cd){if(_0x3e04cd){var _0x1207f8=typeof _0xc69306[_0x9d3b('0x1a')]===_0x9d3b('0x1b')&&typeof _0xc69306[_0x9d3b('0x1c')]===_0x9d3b('0x1b');var _0x1e3580=_0x3e04cd[_0x9d3b('0x1d')];var _0x157eed=_0x1207f8?0x0:_0xc69306[_0x9d3b('0x1a')];var _0x156aa1=_0x1207f8?_0x3e04cd[_0x9d3b('0x1d')]:_0xc69306['offset']+_0xc69306['limit'];var _0x371bb3;if(_0x156aa1>=_0x1e3580){_0x156aa1=_0x1e3580;_0x371bb3=0xc8;}else{_0x371bb3=0xce;}_0x5cc18b['status'](_0x371bb3);return _0x5cc18b[_0x9d3b('0x1e')](_0x9d3b('0x1f'),_0x157eed+'-'+_0x156aa1+'/'+_0x1e3580)[_0x9d3b('0x20')](_0x3e04cd);}return null;};}function patchUpdates(_0x2d1e36){return function(_0x52bda3){try{jsonpatch[_0x9d3b('0x21')](_0x52bda3,_0x2d1e36,!![]);}catch(_0x7eb902){return BPromise['reject'](_0x7eb902);}return _0x52bda3[_0x9d3b('0x22')]();};}function saveUpdates(_0x863e82,_0x586a1b){return function(_0x1f8273){if(_0x1f8273){return _0x1f8273[_0x9d3b('0x23')](_0x863e82)[_0x9d3b('0x24')](function(_0x5c1627){return _0x5c1627;});}return null;};}function removeEntity(_0x47f247,_0xe4d640){return function(_0x51a31c){if(_0x51a31c){return _0x51a31c[_0x9d3b('0x25')]()[_0x9d3b('0x24')](function(){_0x47f247[_0x9d3b('0x18')](0xcc)[_0x9d3b('0x19')]();});}};}function handleEntityNotFound(_0x496773,_0x5a72e7){return function(_0x1c5c01){if(!_0x1c5c01){_0x496773[_0x9d3b('0x26')](0x194);}return _0x1c5c01;};}function handleError(_0x235910,_0xd15367){_0xd15367=_0xd15367||0x1f4;return function(_0x595eca){logger[_0x9d3b('0x27')](_0x595eca[_0x9d3b('0x28')]);if(_0x595eca[_0x9d3b('0x29')]){delete _0x595eca[_0x9d3b('0x29')];}_0x235910[_0x9d3b('0x18')](_0xd15367)[_0x9d3b('0x2a')](_0x595eca);};}exports[_0x9d3b('0x2b')]=function(_0x292d7f,_0x1aea3b){var _0x5cb05e={},_0x34bcec={},_0xd9d6f8={'count':0x0,'rows':[]};var _0x33f1e1=_[_0x9d3b('0x2c')](db[_0x9d3b('0x2d')]['rawAttributes'],function(_0x31fccc){return{'name':_0x31fccc['fieldName'],'type':_0x31fccc['type'][_0x9d3b('0x2e')]};});_0x34bcec[_0x9d3b('0x2f')]=_[_0x9d3b('0x2c')](_0x33f1e1,_0x9d3b('0x29'));_0x34bcec[_0x9d3b('0x30')]=_[_0x9d3b('0x31')](_0x292d7f[_0x9d3b('0x30')]);_0x34bcec[_0x9d3b('0x32')]=_[_0x9d3b('0x33')](_0x34bcec[_0x9d3b('0x2f')],_0x34bcec[_0x9d3b('0x30')]);_0x5cb05e['attributes']=_[_0x9d3b('0x33')](_0x34bcec[_0x9d3b('0x2f')],qs[_0x9d3b('0x34')](_0x292d7f[_0x9d3b('0x30')]['fields']));_0x5cb05e[_0x9d3b('0x35')]=_0x5cb05e[_0x9d3b('0x35')][_0x9d3b('0x36')]?_0x5cb05e[_0x9d3b('0x35')]:_0x34bcec[_0x9d3b('0x2f')];if(!_0x292d7f[_0x9d3b('0x30')][_0x9d3b('0x37')](_0x9d3b('0x38'))){_0x5cb05e[_0x9d3b('0x1c')]=qs['limit'](_0x292d7f[_0x9d3b('0x30')]['limit']);_0x5cb05e[_0x9d3b('0x1a')]=qs[_0x9d3b('0x1a')](_0x292d7f['query'][_0x9d3b('0x1a')]);}_0x5cb05e[_0x9d3b('0x39')]=qs[_0x9d3b('0x3a')](_0x292d7f[_0x9d3b('0x30')][_0x9d3b('0x3a')]);_0x5cb05e['where']=qs[_0x9d3b('0x32')](_['pick'](_0x292d7f[_0x9d3b('0x30')],_0x34bcec[_0x9d3b('0x32')]),_0x33f1e1);if(_0x292d7f[_0x9d3b('0x30')][_0x9d3b('0x3b')]){_0x5cb05e[_0x9d3b('0x3c')]=_[_0x9d3b('0x3d')](_0x5cb05e[_0x9d3b('0x3c')],{'$or':_['map'](_0x33f1e1,function(_0x46468d){if(_0x46468d[_0x9d3b('0x3e')]!==_0x9d3b('0x3f')){var _0xd97453={};_0xd97453[_0x46468d[_0x9d3b('0x29')]]={'$like':'%'+_0x292d7f[_0x9d3b('0x30')][_0x9d3b('0x3b')]+'%'};return _0xd97453;}})});}_0x5cb05e=_['merge']({},_0x5cb05e,_0x292d7f[_0x9d3b('0x40')]);var _0x40dd91={'where':_0x5cb05e['where']};return db['CmHopperHistory'][_0x9d3b('0x1d')](_0x40dd91)[_0x9d3b('0x24')](function(_0x43e031){_0xd9d6f8[_0x9d3b('0x1d')]=_0x43e031;if(_0x292d7f[_0x9d3b('0x30')][_0x9d3b('0x41')]){_0x5cb05e[_0x9d3b('0x42')]=[{'all':!![]}];}return db[_0x9d3b('0x2d')][_0x9d3b('0x43')](_0x5cb05e);})[_0x9d3b('0x24')](function(_0x4d0961){_0xd9d6f8[_0x9d3b('0x44')]=_0x4d0961;return _0xd9d6f8;})[_0x9d3b('0x24')](respondWithFilteredResult(_0x1aea3b,_0x5cb05e))['catch'](handleError(_0x1aea3b,null));};exports['show']=function(_0x34aecd,_0x8227cb){var _0x156ac8={'raw':!![],'where':{'id':_0x34aecd[_0x9d3b('0x45')]['id']}},_0x17eaed={};_0x17eaed[_0x9d3b('0x2f')]=_[_0x9d3b('0x31')](db[_0x9d3b('0x2d')]['rawAttributes']);_0x17eaed['query']=_[_0x9d3b('0x31')](_0x34aecd['query']);_0x17eaed['filters']=_[_0x9d3b('0x33')](_0x17eaed[_0x9d3b('0x2f')],_0x17eaed[_0x9d3b('0x30')]);_0x156ac8[_0x9d3b('0x35')]=_[_0x9d3b('0x33')](_0x17eaed['model'],qs[_0x9d3b('0x34')](_0x34aecd[_0x9d3b('0x30')]['fields']));_0x156ac8[_0x9d3b('0x35')]=_0x156ac8[_0x9d3b('0x35')]['length']?_0x156ac8['attributes']:_0x17eaed[_0x9d3b('0x2f')];if(_0x34aecd['query']['includeAll']){_0x156ac8[_0x9d3b('0x42')]=[{'all':!![]}];}_0x156ac8=_['merge']({},_0x156ac8,_0x34aecd['options']);return db[_0x9d3b('0x2d')][_0x9d3b('0x46')](_0x156ac8)[_0x9d3b('0x24')](handleEntityNotFound(_0x8227cb,null))['then'](respondWithResult(_0x8227cb,null))[_0x9d3b('0x47')](handleError(_0x8227cb,null));};exports[_0x9d3b('0x48')]=function(_0xb2565b,_0x3a9d70){return db[_0x9d3b('0x2d')]['create'](_0xb2565b[_0x9d3b('0x49')],{})[_0x9d3b('0x24')](respondWithResult(_0x3a9d70,0xc9))[_0x9d3b('0x47')](handleError(_0x3a9d70,null));};exports[_0x9d3b('0x4a')]=function(_0x1e6753,_0x23d861){return db['CmHopperHistory']['describe']()[_0x9d3b('0x24')](respondWithResult(_0x23d861,null))['catch'](handleError(_0x23d861,null));};exports[_0x9d3b('0x23')]=function(_0x1fcfa2,_0x270612){if(_0x1fcfa2['body']['uniqueid']){delete _0x1fcfa2['body'][_0x9d3b('0x4b')];}return db[_0x9d3b('0x2d')][_0x9d3b('0x46')]({'where':{'uniqueid':_0x1fcfa2[_0x9d3b('0x45')]['id']}})[_0x9d3b('0x24')](handleEntityNotFound(_0x270612,null))['then'](saveUpdates(_0x1fcfa2[_0x9d3b('0x49')],null))[_0x9d3b('0x24')](respondWithResult(_0x270612,null))['catch'](handleError(_0x270612,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3512887..0786152 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 _0x75dd=['../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x75dd,0x1c9));var _0xd75d=function(_0x4515f7,_0x5576a0){_0x4515f7=_0x4515f7-0x0;var _0xfc0b27=_0x75dd[_0x4515f7];return _0xfc0b27;};'use strict';var _=require(_0xd75d('0x0'));var util=require(_0xd75d('0x1'));var logger=require(_0xd75d('0x2'))(_0xd75d('0x3'));var moment=require(_0xd75d('0x4'));var BPromise=require(_0xd75d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd75d('0x6'));var rimraf=require(_0xd75d('0x7'));var config=require(_0xd75d('0x8'));var attributes=require(_0xd75d('0x9'));module[_0xd75d('0xa')]=function(_0xc3ab73,_0x272588){return _0xc3ab73[_0xd75d('0xb')]('CmHopperHistory',attributes,{'tableName':_0xd75d('0xc'),'paranoid':![],'indexes':[{'name':_0xd75d('0xd'),'fields':[_0xd75d('0xd')]},{'name':_0xd75d('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4c9=['moment','request-promise','path','rimraf','./cmHopperHistory.attributes','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf4c9[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var logger=require(_0x9f4c('0x2'))('api');var moment=require(_0x9f4c('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f4c('0x4'));var fs=require('fs');var path=require(_0x9f4c('0x5'));var rimraf=require(_0x9f4c('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f4c('0x7'));module['exports']=function(_0x42cd40,_0x48dc53){return _0x42cd40['define']('CmHopperHistory',attributes,{'tableName':_0x9f4c('0x8'),'paranoid':![],'indexes':[{'name':_0x9f4c('0x9'),'fields':[_0x9f4c('0x9')]},{'name':_0x9f4c('0xa'),'fields':[_0x9f4c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b17c296..973b4b6 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 _0x8ce3=['catch','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','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=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperHistory','create','body','options','raw','then','info','CreateCmHopperHistory'];(function(_0x4a95a9,_0x1a6241){var _0xb6c65=function(_0x10fe90){while(--_0x10fe90){_0x4a95a9['push'](_0x4a95a9['shift']());}};_0xb6c65(++_0x1a6241);}(_0x8ce3,0xc3));var _0x38ce=function(_0x9f897b,_0x2bc0f7){_0x9f897b=_0x9f897b-0x0;var _0x595177=_0x8ce3[_0x9f897b];return _0x595177;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});}exports['CreateCmHopperHistory']=function(_0xe4099a){var _0x2efd6f=this;return new Promise(function(_0x3df527,_0x311734){return db[_0x38ce('0x16')][_0x38ce('0x17')](_0xe4099a[_0x38ce('0x18')],{'raw':_0xe4099a['options']?_0xe4099a[_0x38ce('0x19')][_0x38ce('0x1a')]===undefined?!![]:![]:!![]})[_0x38ce('0x1b')](function(_0x303391){logger[_0x38ce('0x1c')](_0x38ce('0x1d'),_0xe4099a);logger[_0x38ce('0xf')](_0x38ce('0x1d'),_0xe4099a,JSON[_0x38ce('0x11')](_0x303391));_0x3df527(_0x303391);})[_0x38ce('0x1e')](function(_0x1aace7){logger['error'](_0x38ce('0x1d'),_0x1aace7[_0x38ce('0x14')],_0xe4099a);_0x311734(_0x2efd6f[_0x38ce('0x12')](0x1f4,_0x1aace7[_0x38ce('0x14')]));});});};exports['AvgHandleTime']=function(_0x2c85e6){var _0x1d192d=this;return new Promise(function(_0x5ae8f8,_0xe0af00){return db[_0x38ce('0x16')][_0x38ce('0x1f')]({'raw':_0x2c85e6['options']?_0x2c85e6['options'][_0x38ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c85e6[_0x38ce('0x19')]?_0x2c85e6[_0x38ce('0x19')][_0x38ce('0x20')]||null:null,'attributes':[[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')][_0x38ce('0x23')]('id')),_0x38ce('0x24')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x26')))),'predictiveIntervalAnsweredCalls'],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')]('`state`\x20=\x2010,\x201,\x20null'))),_0x38ce('0x27')],[db['sequelize']['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x28')))),_0x38ce('0x29')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x2a'),db['sequelize']['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x2b')))),_0x38ce('0x2c')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x2a'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x2d')))),_0x38ce('0x2e')]]})[_0x38ce('0x1b')](function(_0x231268){logger[_0x38ce('0x1c')]('AvgHandleTime',_0x2c85e6);logger[_0x38ce('0xf')](_0x38ce('0x2f'),_0x2c85e6,JSON['stringify'](_0x231268));_0x5ae8f8(_0x231268);})[_0x38ce('0x1e')](function(_0x190000){logger[_0x38ce('0x12')](_0x38ce('0x2f'),_0x190000[_0x38ce('0x14')],_0x2c85e6);_0xe0af00(_0x1d192d[_0x38ce('0x12')](0x1f4,_0x190000[_0x38ce('0x14')]));});});};exports[_0x38ce('0x30')]=function(_0x4b779b){var _0x3d2c8c=this;return new Promise(function(_0x185e8f,_0x2314a2){return db[_0x38ce('0x16')]['findAll']({'raw':_0x4b779b[_0x38ce('0x19')]?_0x4b779b['options'][_0x38ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b779b[_0x38ce('0x19')]?_0x4b779b[_0x38ce('0x19')][_0x38ce('0x20')]||null:null,'attributes':[[_0x38ce('0x31'),_0x38ce('0x32')],[db['sequelize']['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x33')))),_0x38ce('0x34')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x35')))),_0x38ce('0x36')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x26')))),_0x38ce('0x37')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x38')))),_0x38ce('0x39')],[db['sequelize']['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x3a')))),_0x38ce('0x3b')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x3c')))),_0x38ce('0x3d')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal'](_0x38ce('0x3e')))),_0x38ce('0x3f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x38ce('0x21')]['fn']('COUNT',db[_0x38ce('0x21')]['fn']('IF',db['sequelize'][_0x38ce('0x25')](_0x38ce('0x40')))),'outboundBlacklistCallsDay'],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x41')))),_0x38ce('0x42')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db['sequelize']['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0x38ce('0x43')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x44')))),'outboundAnswerAgiCallsDay'],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x45')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')][_0x38ce('0x25')](_0x38ce('0x46')))),_0x38ce('0x47')]],'group':['campaign']})['then'](function(_0x199c5b){logger['info']('GetVoiceQueueHopperHistory',_0x4b779b);logger[_0x38ce('0xf')](_0x38ce('0x30'),_0x4b779b,JSON[_0x38ce('0x11')](_0x199c5b));_0x185e8f(_0x199c5b);})[_0x38ce('0x1e')](function(_0xd031c0){logger['error'](_0x38ce('0x30'),_0xd031c0[_0x38ce('0x14')],_0x4b779b);_0x2314a2(_0x3d2c8c[_0x38ce('0x12')](0x1f4,_0xd031c0[_0x38ce('0x14')]));});});};exports[_0x38ce('0x48')]=function(_0x2c353a){var _0x1d7a6b=this;return new Promise(function(_0x1c26b9,_0xdc8304){return db[_0x38ce('0x16')][_0x38ce('0x1f')]({'raw':_0x2c353a['options']?_0x2c353a['options'][_0x38ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c353a[_0x38ce('0x19')]?_0x2c353a[_0x38ce('0x19')][_0x38ce('0x20')]||null:null,'attributes':[['campaign',_0x38ce('0x32')],[db[_0x38ce('0x21')]['fn'](_0x38ce('0x22'),db[_0x38ce('0x21')][_0x38ce('0x23')]('id')),_0x38ce('0x49')],[db[_0x38ce('0x21')]['fn']('COUNT',db[_0x38ce('0x21')]['fn']('IF',db[_0x38ce('0x21')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x38ce('0x4a')]],'group':[_0x38ce('0x31')]})[_0x38ce('0x1b')](function(_0x55e7ea){logger['info'](_0x38ce('0x48'),_0x2c353a);logger['debug'](_0x38ce('0x48'),_0x2c353a,JSON[_0x38ce('0x11')](_0x55e7ea));_0x1c26b9(_0x55e7ea);})[_0x38ce('0x1e')](function(_0x2b3982){logger['error'](_0x38ce('0x48'),_0x2b3982[_0x38ce('0x14')],_0x2c353a);_0xdc8304(_0x1d7a6b[_0x38ce('0x12')](0x1f4,_0x2b3982['message']));});});}; \ No newline at end of file +var _0xf958=['`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','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x4aa902,_0xc6d1b4){var _0x2ec26f=function(_0x17f614){while(--_0x17f614){_0x4aa902['push'](_0x4aa902['shift']());}};_0x2ec26f(++_0xc6d1b4);}(_0xf958,0xe6));var _0x8f95=function(_0x2c4caa,_0x1a6deb){_0x2c4caa=_0x2c4caa-0x0;var _0x4625a5=_0xf958[_0x2c4caa];return _0x4625a5;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c2af8,_0x5cfc04,_0x1ae9c4){return new BPromise(function(_0x109bed,_0x435b5b){return client[_0x8f95('0x9')](_0x5c2af8,_0x1ae9c4)[_0x8f95('0xa')](function(_0x585025){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5cfc04,'request\x20sent');logger[_0x8f95('0xd')](_0x8f95('0xe'),_0x5cfc04,_0x8f95('0xf'),JSON['stringify'](_0x585025));if(_0x585025[_0x8f95('0x10')]){if(_0x585025[_0x8f95('0x10')][_0x8f95('0x11')]===0x1f4){logger['error'](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x435b5b(_0x585025['error'][_0x8f95('0x12')]);}logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x109bed(_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x5cfc04,'request\x20sent');_0x109bed(_0x585025['result']['message']);}})[_0x8f95('0x13')](function(_0x2f01cd){logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x2f01cd);_0x435b5b(_0x2f01cd);});});}exports['CreateCmHopperHistory']=function(_0x5da758){var _0x14d21f=this;return new Promise(function(_0x17b85b,_0x55ba7f){return db[_0x8f95('0x14')][_0x8f95('0x15')](_0x5da758[_0x8f95('0x16')],{'raw':_0x5da758[_0x8f95('0x17')]?_0x5da758['options'][_0x8f95('0x18')]===undefined?!![]:![]:!![]})[_0x8f95('0xa')](function(_0x2b90bf){logger[_0x8f95('0xb')]('CreateCmHopperHistory',_0x5da758);logger['debug'](_0x8f95('0x19'),_0x5da758,JSON[_0x8f95('0x1a')](_0x2b90bf));_0x17b85b(_0x2b90bf);})[_0x8f95('0x13')](function(_0x1c7a29){logger[_0x8f95('0x10')]('CreateCmHopperHistory',_0x1c7a29[_0x8f95('0x12')],_0x5da758);_0x55ba7f(_0x14d21f[_0x8f95('0x10')](0x1f4,_0x1c7a29['message']));});});};exports[_0x8f95('0x1b')]=function(_0x284eb7){var _0x4da2ea=this;return new Promise(function(_0x28d48b,_0x4c96eb){return db[_0x8f95('0x14')][_0x8f95('0x1c')]({'raw':_0x284eb7['options']?_0x284eb7[_0x8f95('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x284eb7['options']?_0x284eb7[_0x8f95('0x17')]['where']||null:null,'attributes':[[db[_0x8f95('0x1d')]['fn']('COUNT',db['sequelize'][_0x8f95('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0x8f95('0x1d')]['fn']('COUNT',db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x20')))),_0x8f95('0x21')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8f95('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x8f95('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x25')))),_0x8f95('0x26')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x27'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x28')))),'predictiveIntervalAvgTalktime']]})[_0x8f95('0xa')](function(_0x53e273){logger[_0x8f95('0xb')](_0x8f95('0x1b'),_0x284eb7);logger[_0x8f95('0xd')](_0x8f95('0x1b'),_0x284eb7,JSON['stringify'](_0x53e273));_0x28d48b(_0x53e273);})[_0x8f95('0x13')](function(_0xe5ad99){logger[_0x8f95('0x10')]('AvgHandleTime',_0xe5ad99['message'],_0x284eb7);_0x4c96eb(_0x4da2ea[_0x8f95('0x10')](0x1f4,_0xe5ad99[_0x8f95('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2c21c2){var _0x17071c=this;return new Promise(function(_0x26843d,_0x21391f){return db[_0x8f95('0x14')][_0x8f95('0x1c')]({'raw':_0x2c21c2[_0x8f95('0x17')]?_0x2c21c2[_0x8f95('0x17')][_0x8f95('0x18')]===undefined?!![]:![]:!![],'where':_0x2c21c2[_0x8f95('0x17')]?_0x2c21c2[_0x8f95('0x17')][_0x8f95('0x29')]||null:null,'attributes':[[_0x8f95('0x2a'),_0x8f95('0x2b')],[db['sequelize']['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x2c')))),_0x8f95('0x2d')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x2e')))),_0x8f95('0x2f')],[db[_0x8f95('0x1d')]['fn']('COUNT',db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x20')))),_0x8f95('0x30')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db['sequelize'][_0x8f95('0x1f')](_0x8f95('0x31')))),_0x8f95('0x32')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db['sequelize'][_0x8f95('0x1f')](_0x8f95('0x33')))),_0x8f95('0x34')],[db[_0x8f95('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8f95('0x1f')](_0x8f95('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x8f95('0x1d')]['fn']('COUNT',db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')]['literal'](_0x8f95('0x36')))),_0x8f95('0x37')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x38')))),_0x8f95('0x39')],[db[_0x8f95('0x1d')]['fn']('COUNT',db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x3a')))),_0x8f95('0x3b')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x3c')))),_0x8f95('0x3d')],[db['sequelize']['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x3e')))),_0x8f95('0x3f')],[db[_0x8f95('0x1d')]['fn']('COUNT',db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')](_0x8f95('0x40')))),_0x8f95('0x41')],[db['sequelize']['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')][_0x8f95('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x8f95('0x3f')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db['sequelize'][_0x8f95('0x1f')](_0x8f95('0x42')))),_0x8f95('0x43')]],'group':[_0x8f95('0x2a')]})[_0x8f95('0xa')](function(_0x43b175){logger[_0x8f95('0xb')](_0x8f95('0x44'),_0x2c21c2);logger[_0x8f95('0xd')](_0x8f95('0x44'),_0x2c21c2,JSON[_0x8f95('0x1a')](_0x43b175));_0x26843d(_0x43b175);})['catch'](function(_0x4aaa74){logger[_0x8f95('0x10')](_0x8f95('0x44'),_0x4aaa74['message'],_0x2c21c2);_0x21391f(_0x17071c[_0x8f95('0x10')](0x1f4,_0x4aaa74['message']));});});};exports[_0x8f95('0x45')]=function(_0x1997a7){var _0x4b3c05=this;return new Promise(function(_0x5cff7a,_0x1c2860){return db[_0x8f95('0x14')]['findAll']({'raw':_0x1997a7[_0x8f95('0x17')]?_0x1997a7['options'][_0x8f95('0x18')]===undefined?!![]:![]:!![],'where':_0x1997a7[_0x8f95('0x17')]?_0x1997a7['options'][_0x8f95('0x29')]||null:null,'attributes':[[_0x8f95('0x2a'),_0x8f95('0x2b')],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')][_0x8f95('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0x8f95('0x1d')]['fn'](_0x8f95('0x22'),db[_0x8f95('0x1d')]['fn']('IF',db[_0x8f95('0x1d')]['literal'](_0x8f95('0x20')))),_0x8f95('0x46')]],'group':[_0x8f95('0x2a')]})[_0x8f95('0xa')](function(_0xf7fdff){logger['info'](_0x8f95('0x45'),_0x1997a7);logger[_0x8f95('0xd')](_0x8f95('0x45'),_0x1997a7,JSON[_0x8f95('0x1a')](_0xf7fdff));_0x5cff7a(_0xf7fdff);})[_0x8f95('0x13')](function(_0x18b368){logger[_0x8f95('0x10')](_0x8f95('0x45'),_0x18b368[_0x8f95('0x12')],_0x1997a7);_0x1c2860(_0x4b3c05['error'](0x1f4,_0x18b368[_0x8f95('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 56e5277..c5e6e3d 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 _0xbf9d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','describe','get','/:id','post','put','exports'];(function(_0x171a8a,_0x2c6407){var _0x178cbc=function(_0x17cec0){while(--_0x17cec0){_0x171a8a['push'](_0x171a8a['shift']());}};_0x178cbc(++_0x2c6407);}(_0xbf9d,0x170));var _0xdbf9=function(_0x3a5d40,_0x592d19){_0x3a5d40=_0x3a5d40-0x0;var _0x2021cd=_0xbf9d[_0x3a5d40];return _0x2021cd;};'use strict';var multer=require('multer');var util=require(_0xdbf9('0x0'));var path=require(_0xdbf9('0x1'));var timeout=require(_0xdbf9('0x2'));var express=require(_0xdbf9('0x3'));var router=express[_0xdbf9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbf9('0x5'));var interaction=require(_0xdbf9('0x6'));var config=require('../../config/environment');var controller=require(_0xdbf9('0x7'));router['get']('/',auth[_0xdbf9('0x8')](),controller[_0xdbf9('0x9')]);router['get']('/describe',auth[_0xdbf9('0x8')](),controller[_0xdbf9('0xa')]);router[_0xdbf9('0xb')](_0xdbf9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdbf9('0xd')]('/',auth[_0xdbf9('0x8')](),controller['create']);router[_0xdbf9('0xe')](_0xdbf9('0xc'),auth[_0xdbf9('0x8')](),controller['update']);module[_0xdbf9('0xf')]=router; \ No newline at end of file +var _0xdca3=['show','create','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','/describe','get','/:id'];(function(_0x385ed5,_0x449f76){var _0x27f199=function(_0x47d08f){while(--_0x47d08f){_0x385ed5['push'](_0x385ed5['shift']());}};_0x27f199(++_0x449f76);}(_0xdca3,0x71));var _0x3dca=function(_0x37760a,_0x26ac10){_0x37760a=_0x37760a-0x0;var _0x6840c7=_0xdca3[_0x37760a];return _0x6840c7;};'use strict';var multer=require(_0x3dca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3dca('0x1'));var express=require(_0x3dca('0x2'));var router=express[_0x3dca('0x3')]();var fs_extra=require(_0x3dca('0x4'));var auth=require(_0x3dca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3dca('0x6'));var controller=require(_0x3dca('0x7'));router['get']('/',auth[_0x3dca('0x8')](),controller[_0x3dca('0x9')]);router['get'](_0x3dca('0xa'),auth[_0x3dca('0x8')](),controller['describe']);router[_0x3dca('0xb')](_0x3dca('0xc'),auth[_0x3dca('0x8')](),controller[_0x3dca('0xd')]);router['post']('/',auth[_0x3dca('0x8')](),controller[_0x3dca('0xe')]);router[_0x3dca('0xf')](_0x3dca('0xc'),auth[_0x3dca('0x8')](),controller[_0x3dca('0x10')]);module[_0x3dca('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6442e47..b829e48 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 _0x078c=['name','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x078c,0x19f));var _0xc078=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0x078c[_0x434783];return _0x13efcf;};'use strict';var Sequelize=require(_0xc078('0x0'));module['exports']={'name':{'type':Sequelize[_0xc078('0x1')],'unique':_0xc078('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xc078('0x1')]}}; \ No newline at end of file +var _0xe107=['STRING','name','sequelize'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xe107,0xb3));var _0x7e10=function(_0x7e406d,_0x28d0f8){_0x7e406d=_0x7e406d-0x0;var _0x5064da=_0xe107[_0x7e406d];return _0x5064da;};'use strict';var Sequelize=require(_0x7e10('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e10('0x1')],'unique':_0x7e10('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7e10('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ec5e407..2b66795 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 _0x0aae=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','length','find','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','order','pick','findAll','rows','removeDispositions','ids','addContacts','isArray','tags','join','push','each','CmContact','omit','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','raw','getContacts','getContactsCsv','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','findOne','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0aae,0x139));var _0xe0aa=function(_0x20bfcf,_0x6c476d){_0x20bfcf=_0x20bfcf-0x0;var _0x27e303=_0x0aae[_0x20bfcf];return _0x27e303;};'use strict';var emlformat=require(_0xe0aa('0x0'));var rimraf=require(_0xe0aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0aa('0x2'));var rp=require(_0xe0aa('0x3'));var moment=require(_0xe0aa('0x4'));var BPromise=require(_0xe0aa('0x5'));var Mustache=require(_0xe0aa('0x6'));var util=require('util');var path=require(_0xe0aa('0x7'));var sox=require('sox');var csv=require(_0xe0aa('0x8'));var ejs=require(_0xe0aa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0aa('0xa'));var squel=require(_0xe0aa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe0aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0aa('0xd'));var Papa=require(_0xe0aa('0xe'));var Redis=require('ioredis');var authService=require(_0xe0aa('0xf'));var qs=require(_0xe0aa('0x10'));var as=require(_0xe0aa('0x11'));var hardwareService=require(_0xe0aa('0x12'));var logger=require('../../config/logger')(_0xe0aa('0x13'));var utils=require(_0xe0aa('0x14'));var config=require(_0xe0aa('0x15'));var licenseUtil=require(_0xe0aa('0x16'));var db=require(_0xe0aa('0x17'))['db'];var csv_results;config['redis']=_[_0xe0aa('0x18')](config[_0xe0aa('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0aa('0x1a'))(new Redis(config[_0xe0aa('0x19')]));require('./cmList.socket')[_0xe0aa('0x1b')](socket);function respondWithStatusCode(_0x39025b,_0x150284){_0x150284=_0x150284||0xcc;return function(_0x4086d9){if(_0x4086d9){return _0x39025b[_0xe0aa('0x1c')](_0x150284);}return _0x39025b[_0xe0aa('0x1d')](_0x150284)[_0xe0aa('0x1e')]();};}function respondWithResult(_0x576483,_0x20ecde){_0x20ecde=_0x20ecde||0xc8;return function(_0xace722){if(_0xace722){return _0x576483[_0xe0aa('0x1d')](_0x20ecde)[_0xe0aa('0x1f')](_0xace722);}};}function respondWithFilteredResult(_0x30b8a2,_0x46e1c5){return function(_0x539872){if(_0x539872){var _0x1a60de=typeof _0x46e1c5[_0xe0aa('0x20')]===_0xe0aa('0x21')&&typeof _0x46e1c5[_0xe0aa('0x22')]===_0xe0aa('0x21');var _0x2f43bb=_0x539872[_0xe0aa('0x23')];var _0xb5d5d9=_0x1a60de?0x0:_0x46e1c5[_0xe0aa('0x20')];var _0x27c124=_0x1a60de?_0x539872[_0xe0aa('0x23')]:_0x46e1c5[_0xe0aa('0x20')]+_0x46e1c5[_0xe0aa('0x22')];var _0x446f32;if(_0x27c124>=_0x2f43bb){_0x27c124=_0x2f43bb;_0x446f32=0xc8;}else{_0x446f32=0xce;}_0x30b8a2[_0xe0aa('0x1d')](_0x446f32);return _0x30b8a2[_0xe0aa('0x24')]('Content-Range',_0xb5d5d9+'-'+_0x27c124+'/'+_0x2f43bb)['json'](_0x539872);}return null;};}function patchUpdates(_0x7786a){return function(_0x3416bb){try{jsonpatch[_0xe0aa('0x25')](_0x3416bb,_0x7786a,!![]);}catch(_0x4ea23a){return BPromise[_0xe0aa('0x26')](_0x4ea23a);}return _0x3416bb[_0xe0aa('0x27')]();};}function saveUpdates(_0x46afbb,_0xcde337){return function(_0x25c83e){if(_0x25c83e){return _0x25c83e['update'](_0x46afbb)[_0xe0aa('0x28')](function(_0x479de2){return _0x479de2;});}return null;};}function removeEntity(_0x35c0b3,_0x159d7e){return function(_0x4a46db){if(_0x4a46db){return _0x4a46db[_0xe0aa('0x29')]()[_0xe0aa('0x28')](function(){var _0xe498e6=_0x4a46db['get']({'plain':!![]});var _0x5094be=_0xe0aa('0x2a');return db[_0xe0aa('0x2b')][_0xe0aa('0x29')]({'where':{'type':_0x5094be,'resourceId':_0xe498e6['id']}})[_0xe0aa('0x28')](function(){return _0x4a46db;});})['then'](function(){_0x35c0b3[_0xe0aa('0x1d')](0xcc)[_0xe0aa('0x1e')]();});}};}function handleEntityNotFound(_0x3d1bba,_0x20d847){return function(_0x143cc5){if(!_0x143cc5){_0x3d1bba['sendStatus'](0x194);}return _0x143cc5;};}function handleError(_0x176557,_0x4a1f17){_0x4a1f17=_0x4a1f17||0x1f4;return function(_0x4a9dd1){logger[_0xe0aa('0x2c')](_0x4a9dd1[_0xe0aa('0x2d')]);if(_0x4a9dd1[_0xe0aa('0x2e')]){delete _0x4a9dd1['name'];}_0x176557[_0xe0aa('0x1d')](_0x4a1f17)[_0xe0aa('0x2f')](_0x4a9dd1);};}exports[_0xe0aa('0x30')]=function(_0x5b86b2,_0x165e6b){var _0x3de205={},_0x1d6f90={},_0x2bb093={'count':0x0,'rows':[]};var _0x34048e=_[_0xe0aa('0x31')](db[_0xe0aa('0x32')][_0xe0aa('0x33')],function(_0x1974e5){return{'name':_0x1974e5[_0xe0aa('0x34')],'type':_0x1974e5['type'][_0xe0aa('0x35')]};});_0x1d6f90[_0xe0aa('0x36')]=_[_0xe0aa('0x31')](_0x34048e,_0xe0aa('0x2e'));_0x1d6f90['query']=_['keys'](_0x5b86b2[_0xe0aa('0x37')]);_0x1d6f90[_0xe0aa('0x38')]=_[_0xe0aa('0x39')](_0x1d6f90['model'],_0x1d6f90[_0xe0aa('0x37')]);_0x3de205[_0xe0aa('0x3a')]=_['intersection'](_0x1d6f90[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x3b')]));_0x3de205[_0xe0aa('0x3a')]=_0x3de205['attributes']['length']?_0x3de205[_0xe0aa('0x3a')]:_0x1d6f90[_0xe0aa('0x36')];if(!_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x3c')](_0xe0aa('0x3d'))){_0x3de205['limit']=qs['limit'](_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x3de205[_0xe0aa('0x20')]=qs[_0xe0aa('0x20')](_0x5b86b2[_0xe0aa('0x37')]['offset']);}_0x3de205['order']=qs['sort'](_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x3e')]);_0x3de205[_0xe0aa('0x3f')]=qs[_0xe0aa('0x38')](_['pick'](_0x5b86b2['query'],_0x1d6f90[_0xe0aa('0x38')]),_0x34048e);if(_0x5b86b2['query'][_0xe0aa('0x40')]){_0x3de205[_0xe0aa('0x3f')]=_['merge'](_0x3de205['where'],{'$or':_[_0xe0aa('0x31')](_0x34048e,function(_0x23241d){if(_0x23241d[_0xe0aa('0x41')]!==_0xe0aa('0x42')){var _0x6d8c1d={};_0x6d8c1d[_0x23241d['name']]={'$like':'%'+_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x40')]+'%'};return _0x6d8c1d;}})});}_0x3de205=_[_0xe0aa('0x43')]({},_0x3de205,_0x5b86b2[_0xe0aa('0x44')]);var _0xc9ed8c={'where':_0x3de205[_0xe0aa('0x3f')]};return db[_0xe0aa('0x32')][_0xe0aa('0x23')](_0xc9ed8c)[_0xe0aa('0x28')](function(_0x16d88e){_0x2bb093[_0xe0aa('0x23')]=_0x16d88e;if(_0x5b86b2[_0xe0aa('0x37')][_0xe0aa('0x45')]){_0x3de205[_0xe0aa('0x46')]=[{'all':!![]}];}return db[_0xe0aa('0x32')]['findAll'](_0x3de205);})[_0xe0aa('0x28')](function(_0x1561a0){_0x2bb093['rows']=_0x1561a0;return _0x2bb093;})[_0xe0aa('0x28')](respondWithFilteredResult(_0x165e6b,_0x3de205))[_0xe0aa('0x47')](handleError(_0x165e6b,null));};exports[_0xe0aa('0x48')]=function(_0x56cc40,_0x10f240){var _0x43ec73={'raw':![],'where':{'id':_0x56cc40[_0xe0aa('0x49')]['id']}},_0x26e0b5={};_0x26e0b5[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db[_0xe0aa('0x32')][_0xe0aa('0x33')]);_0x26e0b5[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x56cc40['query']);_0x26e0b5[_0xe0aa('0x38')]=_[_0xe0aa('0x39')](_0x26e0b5['model'],_0x26e0b5[_0xe0aa('0x37')]);_0x43ec73[_0xe0aa('0x3a')]=_[_0xe0aa('0x39')](_0x26e0b5[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x56cc40['query'][_0xe0aa('0x3b')]));_0x43ec73[_0xe0aa('0x3a')]=_0x43ec73[_0xe0aa('0x3a')][_0xe0aa('0x4b')]?_0x43ec73['attributes']:_0x26e0b5['model'];if(_0x56cc40[_0xe0aa('0x37')][_0xe0aa('0x45')]){_0x43ec73[_0xe0aa('0x46')]=[{'all':!![]}];}_0x43ec73=_[_0xe0aa('0x43')]({},_0x43ec73,_0x56cc40[_0xe0aa('0x44')]);return db[_0xe0aa('0x32')][_0xe0aa('0x4c')](_0x43ec73)[_0xe0aa('0x28')](handleEntityNotFound(_0x10f240,null))[_0xe0aa('0x28')](respondWithResult(_0x10f240,null))[_0xe0aa('0x47')](handleError(_0x10f240,null));};exports[_0xe0aa('0x4d')]=function(_0x45bdbd,_0x290684){return db[_0xe0aa('0x32')]['create'](_0x45bdbd[_0xe0aa('0x4e')],{})[_0xe0aa('0x28')](function(_0x1e9a12){var _0x491e05=_0x45bdbd['user'][_0xe0aa('0x4f')]({'plain':!![]});if(!_0x491e05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x491e05['role']===_0xe0aa('0x50')){var _0xf5dab5=_0x1e9a12['get']({'plain':!![]});var _0x474a7b=_0xe0aa('0x2a');return db[_0xe0aa('0x51')]['find']({'where':{'name':_0x474a7b,'userProfileId':_0x491e05[_0xe0aa('0x52')]},'raw':!![]})[_0xe0aa('0x28')](function(_0x133e6e){if(_0x133e6e&&_0x133e6e[_0xe0aa('0x53')]===0x0){return db[_0xe0aa('0x2b')][_0xe0aa('0x4d')]({'name':_0xf5dab5[_0xe0aa('0x2e')],'resourceId':_0xf5dab5['id'],'type':_0x133e6e[_0xe0aa('0x2e')],'sectionId':_0x133e6e['id']},{})[_0xe0aa('0x28')](function(){return _0x1e9a12;});}else{return _0x1e9a12;}})[_0xe0aa('0x47')](function(_0x24629b){logger['error'](_0xe0aa('0x54'),_0x24629b);throw _0x24629b;});}return _0x1e9a12;})[_0xe0aa('0x28')](respondWithResult(_0x290684,0xc9))[_0xe0aa('0x47')](handleError(_0x290684,null));};exports[_0xe0aa('0x55')]=function(_0x246b1b,_0x5915a3){if(_0x246b1b['body']['id']){delete _0x246b1b[_0xe0aa('0x4e')]['id'];}return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x246b1b['params']['id']}})['then'](handleEntityNotFound(_0x5915a3,null))[_0xe0aa('0x28')](saveUpdates(_0x246b1b['body'],null))[_0xe0aa('0x28')](respondWithResult(_0x5915a3,null))[_0xe0aa('0x47')](handleError(_0x5915a3,null));};exports['destroy']=function(_0x504515,_0x3c436e){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x504515[_0xe0aa('0x49')]['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x3c436e,null))['then'](removeEntity(_0x3c436e,null))[_0xe0aa('0x47')](handleError(_0x3c436e,null));};exports['describe']=function(_0x17c3b8,_0x1fe23f){return db['CmList'][_0xe0aa('0x56')]()[_0xe0aa('0x28')](respondWithResult(_0x1fe23f,null))[_0xe0aa('0x47')](handleError(_0x1fe23f,null));};exports[_0xe0aa('0x57')]=function(_0x3c23f2,_0x1720e7,_0x4b4c19){if(_0x3c23f2[_0xe0aa('0x4e')]['id']){delete _0x3c23f2[_0xe0aa('0x4e')]['id'];}return db[_0xe0aa('0x32')]['find']({'where':{'id':_0x3c23f2[_0xe0aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x1720e7,null))[_0xe0aa('0x28')](function(_0x3a8f6b){if(_0x3a8f6b){_0x3c23f2['body'][_0xe0aa('0x58')]=_0x3a8f6b['id'];return db[_0xe0aa('0x59')][_0xe0aa('0x4d')](_0x3c23f2[_0xe0aa('0x4e')]);}})[_0xe0aa('0x28')](respondWithResult(_0x1720e7,null))[_0xe0aa('0x47')](handleError(_0x1720e7,null));};exports[_0xe0aa('0x5a')]=function(_0x585103,_0x5ddeab,_0x4607da){var _0x38b08b={'raw':![],'where':{}};var _0x1c7ced={};var _0x500e30={'count':0x0,'rows':[]};return db[_0xe0aa('0x32')]['findOne']({'where':{'id':_0x585103[_0xe0aa('0x49')]['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x5ddeab,null))[_0xe0aa('0x28')](function(_0x23f5a7){if(_0x23f5a7){_0x1c7ced[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db['Disposition'][_0xe0aa('0x33')]);_0x1c7ced[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x585103[_0xe0aa('0x37')]);_0x1c7ced['filters']=_[_0xe0aa('0x39')](_0x1c7ced[_0xe0aa('0x36')],_0x1c7ced['query']);_0x38b08b[_0xe0aa('0x3a')]=_[_0xe0aa('0x39')](_0x1c7ced['model'],qs['fields'](_0x585103[_0xe0aa('0x37')][_0xe0aa('0x3b')]));_0x38b08b[_0xe0aa('0x3a')]=_0x38b08b['attributes'][_0xe0aa('0x4b')]?_0x38b08b[_0xe0aa('0x3a')]:_0x1c7ced['model'];if(!_0x585103[_0xe0aa('0x37')][_0xe0aa('0x3c')]('nolimit')){_0x38b08b[_0xe0aa('0x22')]=qs['limit'](_0x585103[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x38b08b[_0xe0aa('0x20')]=qs[_0xe0aa('0x20')](_0x585103['query'][_0xe0aa('0x20')]);}_0x38b08b[_0xe0aa('0x5b')]=qs[_0xe0aa('0x3e')](_0x585103[_0xe0aa('0x37')]['sort']);_0x38b08b[_0xe0aa('0x3f')]=qs[_0xe0aa('0x38')](_[_0xe0aa('0x5c')](_0x585103[_0xe0aa('0x37')],_0x1c7ced[_0xe0aa('0x38')]));_0x38b08b[_0xe0aa('0x3f')][_0xe0aa('0x58')]=_0x23f5a7['id'];if(_0x585103[_0xe0aa('0x37')]['filter']){_0x38b08b[_0xe0aa('0x3f')]=_['merge'](_0x38b08b['where'],{'$or':_[_0xe0aa('0x31')](_0x38b08b[_0xe0aa('0x3a')],function(_0x189080){var _0x40f039={};_0x40f039[_0x189080]={'$like':'%'+_0x585103['query'][_0xe0aa('0x40')]+'%'};return _0x40f039;})});}_0x38b08b=_[_0xe0aa('0x43')]({},_0x38b08b,_0x585103[_0xe0aa('0x44')]);return db[_0xe0aa('0x59')]['count']({'where':_0x38b08b['where']})['then'](function(_0x129ec4){_0x500e30[_0xe0aa('0x23')]=_0x129ec4;if(_0x585103[_0xe0aa('0x37')][_0xe0aa('0x45')]){_0x38b08b[_0xe0aa('0x46')]=[{'all':!![]}];}return db[_0xe0aa('0x59')][_0xe0aa('0x5d')](_0x38b08b);})[_0xe0aa('0x28')](function(_0x2e4143){_0x500e30[_0xe0aa('0x5e')]=_0x2e4143;return _0x500e30;});}})[_0xe0aa('0x28')](respondWithFilteredResult(_0x5ddeab,_0x38b08b))[_0xe0aa('0x47')](handleError(_0x5ddeab,null));};exports['removeDispositions']=function(_0xea3f45,_0x33727e,_0x1c3f59){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0xea3f45['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x33727e,null))['then'](function(_0x32a7e9){if(_0x32a7e9){return _0x32a7e9[_0xe0aa('0x5f')](_0xea3f45[_0xe0aa('0x37')][_0xe0aa('0x60')]);}})[_0xe0aa('0x28')](respondWithStatusCode(_0x33727e,null))['catch'](handleError(_0x33727e,null));};exports[_0xe0aa('0x61')]=function(_0x3cefb2,_0x35d9f7,_0x47d339){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x3cefb2[_0xe0aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x35d9f7,null))[_0xe0aa('0x28')](function(_0x36289e){if(_0x36289e){var _0x10a0b4=[];var _0x286d15={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xe0aa('0x28')](function(_0xc1131a){if(_0x3cefb2[_0xe0aa('0x4e')]['tags']&&_[_0xe0aa('0x62')](_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')])){if(_0x3cefb2[_0xe0aa('0x4e')]['tags'][_0xe0aa('0x4b')]){_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')]=_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')][_0xe0aa('0x64')](';')+';';}else{_0x3cefb2['body'][_0xe0aa('0x63')]=null;}}else{_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x63')]=null;}if(_0x3cefb2['body']&&_[_0xe0aa('0x62')](_0x3cefb2['body'])){for(var _0x4d307f=0x0;_0x4d307f<_0x3cefb2[_0xe0aa('0x4e')][_0xe0aa('0x4b')];_0x4d307f+=0x1){_0x3cefb2[_0xe0aa('0x4e')][_0x4d307f]['ListId']=_0x3cefb2[_0xe0aa('0x49')]['id'];_0x10a0b4[_0xe0aa('0x65')](_0x3cefb2[_0xe0aa('0x4e')][_0x4d307f]);}return BPromise[_0xe0aa('0x66')](_0x10a0b4,function(_0x2b2658){return db[_0xe0aa('0x67')][_0xe0aa('0x4d')](_[_0xe0aa('0x68')](_0x2b2658,[_0xe0aa('0x60'),'id'])||{},{'fields':_[_0xe0aa('0x4a')](_0xc1131a),'raw':!![]})[_0xe0aa('0x28')](function(_0x3a2d50){_0x286d15['success']['push'](_0x3a2d50[_0xe0aa('0x69')]);})['catch'](function(_0x562e53){_0x286d15[_0xe0aa('0x6a')]['push']({'data':_0x2b2658,'error':_0x562e53['message']});});})[_0xe0aa('0x28')](function(_0x946773){return _0x286d15;})['catch'](function(_0x4f9349){return _0x4f9349;});}else{_0x35d9f7[_0xe0aa('0x1d')](0x190)[_0xe0aa('0x1f')]({'message':_0xe0aa('0x6b')});}});}})[_0xe0aa('0x28')](respondWithResult(_0x35d9f7,null))[_0xe0aa('0x47')](handleError(_0x35d9f7,null));};exports['getContacts']=function(_0x34b8a1,_0x5d0f08,_0x2de68a){var _0x25c64c;return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x34b8a1['params']['id']},'include':[{'model':db[_0xe0aa('0x6c')],'as':_0xe0aa('0x6d')}]})[_0xe0aa('0x28')](handleEntityNotFound(_0x5d0f08,null))[_0xe0aa('0x28')](function(_0x4f5795){if(_0x4f5795){_0x25c64c=_0x4f5795;return db[_0xe0aa('0x67')]['rawAttributes'];}})[_0xe0aa('0x28')](function(_0x4546a2){if(_0x4546a2){var _0x1495ca={};var _0x23a234={};_0x23a234[_0xe0aa('0x36')]=_[_0xe0aa('0x6e')](_[_0xe0aa('0x4a')](_0x4546a2),_[_0xe0aa('0x31')](_0x25c64c[_0xe0aa('0x6d')],function(_0x56cbcf){return util[_0xe0aa('0x6f')]('cf_%d',_0x56cbcf['id']);}));_0x23a234[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x34b8a1[_0xe0aa('0x37')]);_0x23a234['filters']=_['intersection'](_0x23a234[_0xe0aa('0x36')],_0x23a234[_0xe0aa('0x37')]);_0x1495ca['attributes']=_[_0xe0aa('0x39')](_0x23a234['model'],qs[_0xe0aa('0x3b')](_0x34b8a1[_0xe0aa('0x37')]['fields']));_0x1495ca[_0xe0aa('0x3a')]=_0x1495ca[_0xe0aa('0x3a')][_0xe0aa('0x4b')]?_0x1495ca[_0xe0aa('0x3a')]:_0x23a234[_0xe0aa('0x36')];if(!_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x3c')](_0xe0aa('0x3d'))){_0x1495ca[_0xe0aa('0x22')]=qs[_0xe0aa('0x22')](_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x1495ca['offset']=qs[_0xe0aa('0x20')](_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x20')]);}_0x1495ca[_0xe0aa('0x5b')]=qs['sort'](_0x34b8a1[_0xe0aa('0x37')]['sort']);_0x1495ca[_0xe0aa('0x3f')]=qs['filters'](_['pick'](_0x34b8a1[_0xe0aa('0x37')],_0x23a234[_0xe0aa('0x38')]));_0x1495ca[_0xe0aa('0x70')]=!![];if(_0x34b8a1['query'][_0xe0aa('0x40')]){_0x1495ca['where']=_[_0xe0aa('0x43')](_0x1495ca[_0xe0aa('0x3f')],{'$or':_[_0xe0aa('0x31')](_0x1495ca[_0xe0aa('0x3a')],function(_0x52f76f){var _0x44c8a1={};_0x44c8a1[_0x52f76f]={'$like':'%'+_0x34b8a1[_0xe0aa('0x37')][_0xe0aa('0x40')]+'%'};return _0x44c8a1;})});}_0x1495ca=_[_0xe0aa('0x43')]({},_0x1495ca,_0x34b8a1[_0xe0aa('0x44')]);return _0x25c64c[_0xe0aa('0x71')](_0x1495ca);}})[_0xe0aa('0x28')](respondWithResult(_0x5d0f08,null))[_0xe0aa('0x47')](handleError(_0x5d0f08,null));};exports[_0xe0aa('0x72')]=function(_0x2bbd77,_0x42361e,_0x273468){var _0xfaf17d;var _0x1d971c;var _0x225fff;var _0x23bf23=_0x2bbd77[_0xe0aa('0x49')]['id'];csv_results=[];return db['ContactItemType'][_0xe0aa('0x5d')]({'attributes':['id',_0xe0aa('0x2e')],'raw':!![],'order':[_0xe0aa('0x73')]})['then'](function(_0x3ada06){_0xfaf17d=_0x3ada06;var _0x320eac=_['keys'](db[_0xe0aa('0x67')][_0xe0aa('0x33')]);return db['CmCustomField'][_0xe0aa('0x5d')]({'raw':!![],'attributes':['id','alias']})[_0xe0aa('0x28')](function(_0x39e773){_0x1d971c=_0x39e773;var _0x172e47=squel[_0xe0aa('0x74')]()['fields'](_0x320eac)[_0xe0aa('0x75')](_0xe0aa('0x76'),'c')['where']('c.ListId\x20=\x20?',_0x23bf23)[_0xe0aa('0x3f')](_0xe0aa('0x77'))[_0xe0aa('0x78')]();for(var _0x5262b8=0x0;_0x5262b8<_0x1d971c[_0xe0aa('0x4b')];_0x5262b8++){_0x172e47[_0xe0aa('0x79')](_0xe0aa('0x7a')+_0x1d971c[_0x5262b8]['id'],_0xe0aa('0x7b')+_0x1d971c[_0x5262b8]['alias']);}for(var _0x5262b8=0x0;_0x5262b8<_0xfaf17d[_0xe0aa('0x4b')];_0x5262b8++){_0x172e47[_0xe0aa('0x79')](squel['select']()[_0xe0aa('0x79')](_0xe0aa('0x7c'))[_0xe0aa('0x75')](_0xe0aa('0x7d'))[_0xe0aa('0x3f')](_0xe0aa('0x7e'),_0xfaf17d[_0x5262b8]['id'])[_0xe0aa('0x3f')](_0xe0aa('0x7f')),_0xe0aa('0x80')+_0xfaf17d[_0x5262b8][_0xe0aa('0x2e')]);_0x172e47['field'](squel['select']()[_0xe0aa('0x79')](_0xe0aa('0x81'))[_0xe0aa('0x75')]('cm_contact_has_items')['where'](_0xe0aa('0x7e'),_0xfaf17d[_0x5262b8]['id'])[_0xe0aa('0x3f')](_0xe0aa('0x7f')),_0xe0aa('0x82')+_0xfaf17d[_0x5262b8]['name']);}var _0x4d71c1=[];_0x4d71c1[_0xe0aa('0x65')](_0x172e47['toString']());BPromise[_0xe0aa('0x66')](_0x4d71c1,handleQuery)[_0xe0aa('0x28')](function(_0x17f4d9){handleQuery(_0x172e47[_0xe0aa('0x83')]());var _0x1d56cc=csv_results[0x0];if(!_[_0xe0aa('0x84')](_0x1d56cc)){var _0x2d3fce=toCsv(_0x1d56cc);var _0x45abce=Date['now']();fs[_0xe0aa('0x85')](util[_0xe0aa('0x6f')](_0xe0aa('0x86'),_0x23bf23,_0x45abce),_0x2d3fce);_0x42361e[_0xe0aa('0x87')](_0xe0aa('0x88'),'attachment;\x20filename='+util[_0xe0aa('0x6f')](_0xe0aa('0x89'),_0x23bf23,_0x45abce));_0x42361e[_0xe0aa('0x87')](_0xe0aa('0x8a'),_0xe0aa('0x8b'));return _0x42361e[_0xe0aa('0x8c')](util[_0xe0aa('0x6f')](_0xe0aa('0x86'),_0x23bf23,_0x45abce));}else{return _0x42361e[_0xe0aa('0x1c')](0xcc);}});});});};exports[_0xe0aa('0x8d')]=function(_0x306e4b,_0x4cd759,_0x2b984c){var _0xae5b10;delete _0x306e4b['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x306e4b[_0xe0aa('0x49')]['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x4cd759,null))[_0xe0aa('0x28')](function(_0x15268a){if(_0x15268a){return db['sequelize'][_0xe0aa('0x8e')](function(_0x38c8ab){return db[_0xe0aa('0x6c')]['create'](_0x306e4b[_0xe0aa('0x4e')],{'transaction':_0x38c8ab})['then'](function(_0x46c0d1){_0xae5b10=_0x46c0d1;return _0x15268a[_0xe0aa('0x8f')](_0x46c0d1,{'transaction':_0x38c8ab});})[_0xe0aa('0x28')](function(){var _0x2c26fc={'type':db[_0xe0aa('0x90')][_0xe0aa('0x91')],'transaction':_0x38c8ab};switch(_0x306e4b[_0xe0aa('0x4e')][_0xe0aa('0x41')]){case _0xe0aa('0x92'):_0x2c26fc[_0xe0aa('0x41')]=db[_0xe0aa('0x90')][_0xe0aa('0x91')];break;case _0xe0aa('0x93'):_0x2c26fc[_0xe0aa('0x41')]=db[_0xe0aa('0x90')][_0xe0aa('0x94')];break;case'switch':_0x2c26fc[_0xe0aa('0x41')]=db[_0xe0aa('0x90')][_0xe0aa('0x95')];_0x2c26fc[_0xe0aa('0x96')]=![];break;default:}return db[_0xe0aa('0x97')][_0xe0aa('0x98')][_0xe0aa('0x99')](_0xe0aa('0x76'),util[_0xe0aa('0x6f')](_0xe0aa('0x9a'),_0xae5b10['id']),_0x2c26fc);})['then'](function(){return _0xae5b10;});});}})[_0xe0aa('0x28')](respondWithResult(_0x4cd759,null))[_0xe0aa('0x47')](handleError(_0x4cd759,null));};exports['getCustomFields']=function(_0x2ebcae,_0x3dd12f,_0x2d6b58){var _0x543a39={};var _0x4e0468={};var _0x2527f3;var _0x4490df;return db['CmList'][_0xe0aa('0x9b')]({'where':{'id':_0x2ebcae['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x3dd12f,null))[_0xe0aa('0x28')](function(_0x2b14ec){if(_0x2b14ec){_0x2527f3=_0x2b14ec;_0x4e0468[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db[_0xe0aa('0x6c')][_0xe0aa('0x33')]);_0x4e0468[_0xe0aa('0x37')]=_[_0xe0aa('0x4a')](_0x2ebcae[_0xe0aa('0x37')]);_0x4e0468[_0xe0aa('0x38')]=_[_0xe0aa('0x39')](_0x4e0468['model'],_0x4e0468['query']);_0x543a39[_0xe0aa('0x3a')]=_[_0xe0aa('0x39')](_0x4e0468[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x2ebcae['query'][_0xe0aa('0x3b')]));_0x543a39[_0xe0aa('0x3a')]=_0x543a39[_0xe0aa('0x3a')][_0xe0aa('0x4b')]?_0x543a39[_0xe0aa('0x3a')]:_0x4e0468['model'];_0x543a39[_0xe0aa('0x5b')]=qs[_0xe0aa('0x3e')](_0x2ebcae[_0xe0aa('0x37')][_0xe0aa('0x3e')]);_0x543a39[_0xe0aa('0x3f')]=qs[_0xe0aa('0x38')](_[_0xe0aa('0x5c')](_0x2ebcae[_0xe0aa('0x37')],_0x4e0468[_0xe0aa('0x38')]));_0x543a39[_0xe0aa('0x3f')]=_[_0xe0aa('0x43')](_0x543a39[_0xe0aa('0x3f')],{'$or':[{'ListId':_0x2b14ec['id']},{'ListId':null}]});if(_0x2ebcae[_0xe0aa('0x37')][_0xe0aa('0x40')]){_0x543a39['where']=_[_0xe0aa('0x43')](_0x543a39[_0xe0aa('0x3f')],{'$or':_['map'](_0x543a39[_0xe0aa('0x3a')],function(_0x4eaa87){var _0x576933={};_0x576933[_0x4eaa87]={'$like':'%'+_0x2ebcae['query'][_0xe0aa('0x40')]+'%'};return _0x576933;})});}_0x543a39=_['merge']({},_0x543a39,_0x2ebcae['options']);return db[_0xe0aa('0x6c')][_0xe0aa('0x9c')](_0x543a39);}})[_0xe0aa('0x28')](respondWithResult(_0x3dd12f,null))[_0xe0aa('0x47')](handleError(_0x3dd12f,null));};exports['getGlobalCustomFields']=function(_0x48b0dc,_0x91508c){return db[_0xe0aa('0x6c')][_0xe0aa('0x9c')]({'where':{'ListId':null}})[_0xe0aa('0x28')](handleEntityNotFound(_0x91508c,null))[_0xe0aa('0x28')](function(_0x4313a8){return _0x4313a8;})['then'](respondWithResult(_0x91508c,null))[_0xe0aa('0x47')](handleError(_0x91508c,null));};exports[_0xe0aa('0x9d')]=function(_0x13c38b,_0xf4c0a0,_0x4a5186){return db[_0xe0aa('0x32')][_0xe0aa('0x4c')]({'where':{'id':_0x13c38b['params']['id']}})['then'](handleEntityNotFound(_0xf4c0a0,null))[_0xe0aa('0x28')](function(_0x2f90d9){if(_0x2f90d9){return _0x2f90d9[_0xe0aa('0x9d')](_0x13c38b['body'][_0xe0aa('0x60')],_[_0xe0aa('0x68')](_0x13c38b[_0xe0aa('0x4e')],[_0xe0aa('0x60'),'id'])||{})[_0xe0aa('0x9e')](function(_0x1d2b08){for(var _0x441857=0x0;_0x441857<_0x13c38b[_0xe0aa('0x4e')][_0xe0aa('0x60')][_0xe0aa('0x4b')];_0x441857+=0x1){socket[_0xe0aa('0x9f')]('userCmList:save',{'UserId':Number(_0x13c38b[_0xe0aa('0x4e')][_0xe0aa('0x60')][_0x441857]),'CmListId':Number(_0x13c38b[_0xe0aa('0x49')]['id'])});}return _0x1d2b08;});}})[_0xe0aa('0x28')](respondWithResult(_0xf4c0a0,null))['catch'](handleError(_0xf4c0a0,null));};exports[_0xe0aa('0xa0')]=function(_0x54bc3c,_0x3010b8,_0x5db630){return db['CmList'][_0xe0aa('0x4c')]({'where':{'id':_0x54bc3c['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x3010b8,null))[_0xe0aa('0x28')](function(_0x51ff9e){if(_0x51ff9e){return _0x51ff9e[_0xe0aa('0xa0')](_0x54bc3c[_0xe0aa('0x37')][_0xe0aa('0x60')])[_0xe0aa('0x28')](function(){if(_[_0xe0aa('0x62')](_0x54bc3c[_0xe0aa('0x37')]['ids'])){for(var _0x1b6778=0x0;_0x1b6778<_0x54bc3c[_0xe0aa('0x37')][_0xe0aa('0x60')]['length'];_0x1b6778+=0x1){socket[_0xe0aa('0x9f')](_0xe0aa('0xa1'),{'UserId':Number(_0x54bc3c[_0xe0aa('0x37')]['ids'][_0x1b6778]),'CmListId':Number(_0x54bc3c[_0xe0aa('0x49')]['id'])});}}else{socket[_0xe0aa('0x9f')]('userCmList:remove',{'UserId':Number(_0x54bc3c[_0xe0aa('0x37')][_0xe0aa('0x60')]),'CmListId':Number(_0x54bc3c[_0xe0aa('0x49')]['id'])});}});}})[_0xe0aa('0x28')](respondWithStatusCode(_0x3010b8,null))['catch'](handleError(_0x3010b8,null));};exports[_0xe0aa('0xa2')]=function(_0x2cc340,_0x17357e,_0x332947){var _0x3d3501={};var _0x35fb38={};var _0x239994;var _0x3516af;return db[_0xe0aa('0x32')]['findOne']({'where':{'id':_0x2cc340['params']['id']}})[_0xe0aa('0x28')](handleEntityNotFound(_0x17357e,null))[_0xe0aa('0x28')](function(_0x133a93){if(_0x133a93){_0x239994=_0x133a93;_0x35fb38[_0xe0aa('0x36')]=_[_0xe0aa('0x4a')](db[_0xe0aa('0xa3')][_0xe0aa('0x33')]);_0x35fb38[_0xe0aa('0x37')]=_['keys'](_0x2cc340[_0xe0aa('0x37')]);_0x35fb38[_0xe0aa('0x38')]=_['intersection'](_0x35fb38['model'],_0x35fb38[_0xe0aa('0x37')]);_0x3d3501['attributes']=_[_0xe0aa('0x39')](_0x35fb38[_0xe0aa('0x36')],qs[_0xe0aa('0x3b')](_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x3b')]));_0x3d3501[_0xe0aa('0x3a')]=_0x3d3501['attributes'][_0xe0aa('0x4b')]?_0x3d3501[_0xe0aa('0x3a')]:_0x35fb38[_0xe0aa('0x36')];_0x3d3501[_0xe0aa('0x5b')]=qs[_0xe0aa('0x3e')](_0x2cc340['query'][_0xe0aa('0x3e')]);_0x3d3501[_0xe0aa('0x3f')]=qs['filters'](_[_0xe0aa('0x5c')](_0x2cc340[_0xe0aa('0x37')],_0x35fb38[_0xe0aa('0x38')]));if(_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x40')]){_0x3d3501[_0xe0aa('0x3f')]=_[_0xe0aa('0x43')](_0x3d3501[_0xe0aa('0x3f')],{'$or':_[_0xe0aa('0x31')](_0x3d3501[_0xe0aa('0x3a')],function(_0x2784fb){var _0x4a683c={};_0x4a683c[_0x2784fb]={'$like':'%'+_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x40')]+'%'};return _0x4a683c;})});}_0x3d3501=_[_0xe0aa('0x43')]({},_0x3d3501,_0x2cc340[_0xe0aa('0x44')]);return _0x239994[_0xe0aa('0xa2')](_0x3d3501);}})['then'](function(_0x39f243){if(_0x39f243){_0x3516af=_0x39f243[_0xe0aa('0x4b')];if(!_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x3c')](_0xe0aa('0x3d'))){_0x3d3501[_0xe0aa('0x22')]=qs['limit'](_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x22')]);_0x3d3501['offset']=qs[_0xe0aa('0x20')](_0x2cc340[_0xe0aa('0x37')][_0xe0aa('0x20')]);}return _0x239994[_0xe0aa('0xa2')](_0x3d3501);}})['then'](function(_0x44c7e7){if(_0x44c7e7){return _0x44c7e7?{'count':_0x3516af,'rows':_0x44c7e7}:null;}})['then'](respondWithResult(_0x17357e,null))[_0xe0aa('0x47')](handleError(_0x17357e,null));};function handleQuery(_0x2528f4){logger[_0xe0aa('0xa4')](_0x2528f4);return db['sequelize'][_0xe0aa('0x37')](_0x2528f4)[_0xe0aa('0x9e')](function(_0x58b2d5){csv_results[_0xe0aa('0x65')](_0x58b2d5);})['catch'](function(_0x55bbb0){logger[_0xe0aa('0x2c')](_0x55bbb0['message']);});} \ No newline at end of file +var _0xf2f6=['merge','findAll','rows','catch','show','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','autoAssociation','UserProfileResource','update','params','describe','addDisposition','ListId','Disposition','getDispositions','pick','options','includeAll','removeDispositions','ids','addContacts','tags','isArray','join','each','CmContact','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','ContactItemType','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','type','text','Sequelize','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','error','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','stack','name','send','map','CmList','rawAttributes','fieldName','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x342f03,_0x9dd2e1){var _0x185f83=function(_0x36fb1f){while(--_0x36fb1f){_0x342f03['push'](_0x342f03['shift']());}};_0x185f83(++_0x9dd2e1);}(_0xf2f6,0x110));var _0x6f2f=function(_0x1010a2,_0x51e21d){_0x1010a2=_0x1010a2-0x0;var _0x1d313f=_0xf2f6[_0x1010a2];return _0x1d313f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f2f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f2f('0x1'));var rp=require('request-promise');var moment=require(_0x6f2f('0x2'));var BPromise=require(_0x6f2f('0x3'));var Mustache=require(_0x6f2f('0x4'));var util=require(_0x6f2f('0x5'));var path=require('path');var sox=require(_0x6f2f('0x6'));var csv=require(_0x6f2f('0x7'));var ejs=require(_0x6f2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6f2f('0x9'));var crypto=require(_0x6f2f('0xa'));var jsforce=require(_0x6f2f('0xb'));var deskjs=require(_0x6f2f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6f2f('0xd'));var Papa=require(_0x6f2f('0xe'));var Redis=require(_0x6f2f('0xf'));var authService=require(_0x6f2f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6f2f('0x11'));var hardwareService=require(_0x6f2f('0x12'));var logger=require('../../config/logger')(_0x6f2f('0x13'));var utils=require(_0x6f2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6f2f('0x15'));var db=require(_0x6f2f('0x16'))['db'];var csv_results;config[_0x6f2f('0x17')]=_['defaults'](config[_0x6f2f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f2f('0x18'))(new Redis(config['redis']));require(_0x6f2f('0x19'))[_0x6f2f('0x1a')](socket);function respondWithStatusCode(_0x16de7b,_0x493860){_0x493860=_0x493860||0xcc;return function(_0x3d7b4b){if(_0x3d7b4b){return _0x16de7b[_0x6f2f('0x1b')](_0x493860);}return _0x16de7b[_0x6f2f('0x1c')](_0x493860)[_0x6f2f('0x1d')]();};}function respondWithResult(_0x3ebbe1,_0x178836){_0x178836=_0x178836||0xc8;return function(_0x24e865){if(_0x24e865){return _0x3ebbe1['status'](_0x178836)['json'](_0x24e865);}};}function respondWithFilteredResult(_0x5cbc64,_0x967169){return function(_0xc7a49a){if(_0xc7a49a){var _0x234d5f=typeof _0x967169[_0x6f2f('0x1e')]===_0x6f2f('0x1f')&&typeof _0x967169[_0x6f2f('0x20')]===_0x6f2f('0x1f');var _0x1d3eba=_0xc7a49a[_0x6f2f('0x21')];var _0x3aa97d=_0x234d5f?0x0:_0x967169[_0x6f2f('0x1e')];var _0x2ba246=_0x234d5f?_0xc7a49a[_0x6f2f('0x21')]:_0x967169[_0x6f2f('0x1e')]+_0x967169[_0x6f2f('0x20')];var _0xbfdabf;if(_0x2ba246>=_0x1d3eba){_0x2ba246=_0x1d3eba;_0xbfdabf=0xc8;}else{_0xbfdabf=0xce;}_0x5cbc64['status'](_0xbfdabf);return _0x5cbc64[_0x6f2f('0x22')](_0x6f2f('0x23'),_0x3aa97d+'-'+_0x2ba246+'/'+_0x1d3eba)[_0x6f2f('0x24')](_0xc7a49a);}return null;};}function patchUpdates(_0xa11b7){return function(_0x14d584){try{jsonpatch[_0x6f2f('0x25')](_0x14d584,_0xa11b7,!![]);}catch(_0x122581){return BPromise[_0x6f2f('0x26')](_0x122581);}return _0x14d584[_0x6f2f('0x27')]();};}function saveUpdates(_0x163ce5,_0x5d381d){return function(_0x32258d){if(_0x32258d){return _0x32258d['update'](_0x163ce5)[_0x6f2f('0x28')](function(_0x11fff4){return _0x11fff4;});}return null;};}function removeEntity(_0x1fafa9,_0x3c1b22){return function(_0x340180){if(_0x340180){return _0x340180[_0x6f2f('0x29')]()[_0x6f2f('0x28')](function(){var _0x45b1b2=_0x340180[_0x6f2f('0x2a')]({'plain':!![]});var _0x1cade4='Lists';return db['UserProfileResource'][_0x6f2f('0x29')]({'where':{'type':_0x1cade4,'resourceId':_0x45b1b2['id']}})[_0x6f2f('0x28')](function(){return _0x340180;});})['then'](function(){_0x1fafa9['status'](0xcc)[_0x6f2f('0x1d')]();});}};}function handleEntityNotFound(_0x2f1fa3,_0x36c01e){return function(_0x3e6f1b){if(!_0x3e6f1b){_0x2f1fa3[_0x6f2f('0x1b')](0x194);}return _0x3e6f1b;};}function handleError(_0x498ad6,_0x36c3bb){_0x36c3bb=_0x36c3bb||0x1f4;return function(_0x3fa866){logger['error'](_0x3fa866[_0x6f2f('0x2b')]);if(_0x3fa866[_0x6f2f('0x2c')]){delete _0x3fa866[_0x6f2f('0x2c')];}_0x498ad6[_0x6f2f('0x1c')](_0x36c3bb)[_0x6f2f('0x2d')](_0x3fa866);};}exports['index']=function(_0x40b0ec,_0x2d14ca){var _0x569f4a={},_0x511260={},_0x368d8b={'count':0x0,'rows':[]};var _0xfa129d=_[_0x6f2f('0x2e')](db[_0x6f2f('0x2f')][_0x6f2f('0x30')],function(_0x3b0937){return{'name':_0x3b0937[_0x6f2f('0x31')],'type':_0x3b0937['type'][_0x6f2f('0x32')]};});_0x511260['model']=_[_0x6f2f('0x2e')](_0xfa129d,_0x6f2f('0x2c'));_0x511260[_0x6f2f('0x33')]=_[_0x6f2f('0x34')](_0x40b0ec[_0x6f2f('0x33')]);_0x511260[_0x6f2f('0x35')]=_['intersection'](_0x511260[_0x6f2f('0x36')],_0x511260['query']);_0x569f4a['attributes']=_['intersection'](_0x511260[_0x6f2f('0x36')],qs['fields'](_0x40b0ec['query'][_0x6f2f('0x37')]));_0x569f4a[_0x6f2f('0x38')]=_0x569f4a[_0x6f2f('0x38')][_0x6f2f('0x39')]?_0x569f4a[_0x6f2f('0x38')]:_0x511260['model'];if(!_0x40b0ec[_0x6f2f('0x33')][_0x6f2f('0x3a')](_0x6f2f('0x3b'))){_0x569f4a[_0x6f2f('0x20')]=qs[_0x6f2f('0x20')](_0x40b0ec[_0x6f2f('0x33')][_0x6f2f('0x20')]);_0x569f4a[_0x6f2f('0x1e')]=qs[_0x6f2f('0x1e')](_0x40b0ec[_0x6f2f('0x33')][_0x6f2f('0x1e')]);}_0x569f4a[_0x6f2f('0x3c')]=qs[_0x6f2f('0x3d')](_0x40b0ec[_0x6f2f('0x33')][_0x6f2f('0x3d')]);_0x569f4a[_0x6f2f('0x3e')]=qs[_0x6f2f('0x35')](_['pick'](_0x40b0ec['query'],_0x511260[_0x6f2f('0x35')]),_0xfa129d);if(_0x40b0ec[_0x6f2f('0x33')][_0x6f2f('0x3f')]){_0x569f4a[_0x6f2f('0x3e')]=_[_0x6f2f('0x40')](_0x569f4a[_0x6f2f('0x3e')],{'$or':_['map'](_0xfa129d,function(_0x110f3a){if(_0x110f3a['type']!=='VIRTUAL'){var _0x2273b6={};_0x2273b6[_0x110f3a['name']]={'$like':'%'+_0x40b0ec[_0x6f2f('0x33')][_0x6f2f('0x3f')]+'%'};return _0x2273b6;}})});}_0x569f4a=_[_0x6f2f('0x40')]({},_0x569f4a,_0x40b0ec['options']);var _0x5b219d={'where':_0x569f4a[_0x6f2f('0x3e')]};return db[_0x6f2f('0x2f')][_0x6f2f('0x21')](_0x5b219d)[_0x6f2f('0x28')](function(_0x471752){_0x368d8b[_0x6f2f('0x21')]=_0x471752;if(_0x40b0ec[_0x6f2f('0x33')]['includeAll']){_0x569f4a['include']=[{'all':!![]}];}return db[_0x6f2f('0x2f')][_0x6f2f('0x41')](_0x569f4a);})[_0x6f2f('0x28')](function(_0x219cdd){_0x368d8b[_0x6f2f('0x42')]=_0x219cdd;return _0x368d8b;})[_0x6f2f('0x28')](respondWithFilteredResult(_0x2d14ca,_0x569f4a))[_0x6f2f('0x43')](handleError(_0x2d14ca,null));};exports[_0x6f2f('0x44')]=function(_0x5c7e3f,_0x419c4f){var _0x19d3db={'raw':![],'where':{'id':_0x5c7e3f['params']['id']}},_0xf1215f={};_0xf1215f[_0x6f2f('0x36')]=_[_0x6f2f('0x34')](db[_0x6f2f('0x2f')][_0x6f2f('0x30')]);_0xf1215f['query']=_[_0x6f2f('0x34')](_0x5c7e3f[_0x6f2f('0x33')]);_0xf1215f[_0x6f2f('0x35')]=_['intersection'](_0xf1215f[_0x6f2f('0x36')],_0xf1215f[_0x6f2f('0x33')]);_0x19d3db[_0x6f2f('0x38')]=_[_0x6f2f('0x45')](_0xf1215f[_0x6f2f('0x36')],qs[_0x6f2f('0x37')](_0x5c7e3f['query'][_0x6f2f('0x37')]));_0x19d3db[_0x6f2f('0x38')]=_0x19d3db[_0x6f2f('0x38')][_0x6f2f('0x39')]?_0x19d3db[_0x6f2f('0x38')]:_0xf1215f[_0x6f2f('0x36')];if(_0x5c7e3f[_0x6f2f('0x33')]['includeAll']){_0x19d3db[_0x6f2f('0x46')]=[{'all':!![]}];}_0x19d3db=_['merge']({},_0x19d3db,_0x5c7e3f['options']);return db[_0x6f2f('0x2f')]['find'](_0x19d3db)[_0x6f2f('0x28')](handleEntityNotFound(_0x419c4f,null))[_0x6f2f('0x28')](respondWithResult(_0x419c4f,null))['catch'](handleError(_0x419c4f,null));};exports[_0x6f2f('0x47')]=function(_0x3e8354,_0x48f7cc){return db['CmList'][_0x6f2f('0x47')](_0x3e8354[_0x6f2f('0x48')],{})[_0x6f2f('0x28')](function(_0x537a3e){var _0x35597e=_0x3e8354[_0x6f2f('0x49')][_0x6f2f('0x2a')]({'plain':!![]});if(!_0x35597e)throw new Error(_0x6f2f('0x4a'));if(_0x35597e[_0x6f2f('0x4b')]===_0x6f2f('0x49')){var _0x50beb0=_0x537a3e['get']({'plain':!![]});var _0x144fa8=_0x6f2f('0x4c');return db[_0x6f2f('0x4d')][_0x6f2f('0x4e')]({'where':{'name':_0x144fa8,'userProfileId':_0x35597e['userProfileId']},'raw':!![]})[_0x6f2f('0x28')](function(_0x208ab7){if(_0x208ab7&&_0x208ab7[_0x6f2f('0x4f')]===0x0){return db[_0x6f2f('0x50')][_0x6f2f('0x47')]({'name':_0x50beb0[_0x6f2f('0x2c')],'resourceId':_0x50beb0['id'],'type':_0x208ab7[_0x6f2f('0x2c')],'sectionId':_0x208ab7['id']},{})[_0x6f2f('0x28')](function(){return _0x537a3e;});}else{return _0x537a3e;}})[_0x6f2f('0x43')](function(_0x331386){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x331386);throw _0x331386;});}return _0x537a3e;})['then'](respondWithResult(_0x48f7cc,0xc9))['catch'](handleError(_0x48f7cc,null));};exports[_0x6f2f('0x51')]=function(_0x3d942c,_0x4d479a){if(_0x3d942c['body']['id']){delete _0x3d942c['body']['id'];}return db[_0x6f2f('0x2f')][_0x6f2f('0x4e')]({'where':{'id':_0x3d942c[_0x6f2f('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d479a,null))[_0x6f2f('0x28')](saveUpdates(_0x3d942c['body'],null))[_0x6f2f('0x28')](respondWithResult(_0x4d479a,null))[_0x6f2f('0x43')](handleError(_0x4d479a,null));};exports['destroy']=function(_0x2c8d37,_0x389f99){return db[_0x6f2f('0x2f')]['find']({'where':{'id':_0x2c8d37[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x389f99,null))[_0x6f2f('0x28')](removeEntity(_0x389f99,null))[_0x6f2f('0x43')](handleError(_0x389f99,null));};exports['describe']=function(_0x407a44,_0x38e110){return db[_0x6f2f('0x2f')][_0x6f2f('0x53')]()[_0x6f2f('0x28')](respondWithResult(_0x38e110,null))[_0x6f2f('0x43')](handleError(_0x38e110,null));};exports[_0x6f2f('0x54')]=function(_0x3d2a29,_0x17bcfb,_0x3bfa4b){if(_0x3d2a29[_0x6f2f('0x48')]['id']){delete _0x3d2a29[_0x6f2f('0x48')]['id'];}return db[_0x6f2f('0x2f')][_0x6f2f('0x4e')]({'where':{'id':_0x3d2a29[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x17bcfb,null))[_0x6f2f('0x28')](function(_0x2a63e4){if(_0x2a63e4){_0x3d2a29[_0x6f2f('0x48')][_0x6f2f('0x55')]=_0x2a63e4['id'];return db[_0x6f2f('0x56')][_0x6f2f('0x47')](_0x3d2a29[_0x6f2f('0x48')]);}})['then'](respondWithResult(_0x17bcfb,null))['catch'](handleError(_0x17bcfb,null));};exports[_0x6f2f('0x57')]=function(_0x102261,_0x2a1232,_0x654d96){var _0x37ca06={'raw':![],'where':{}};var _0x9ae211={};var _0x5975b0={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x102261['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x2a1232,null))[_0x6f2f('0x28')](function(_0x4b1467){if(_0x4b1467){_0x9ae211[_0x6f2f('0x36')]=_[_0x6f2f('0x34')](db[_0x6f2f('0x56')][_0x6f2f('0x30')]);_0x9ae211[_0x6f2f('0x33')]=_[_0x6f2f('0x34')](_0x102261[_0x6f2f('0x33')]);_0x9ae211[_0x6f2f('0x35')]=_['intersection'](_0x9ae211[_0x6f2f('0x36')],_0x9ae211[_0x6f2f('0x33')]);_0x37ca06[_0x6f2f('0x38')]=_[_0x6f2f('0x45')](_0x9ae211[_0x6f2f('0x36')],qs[_0x6f2f('0x37')](_0x102261[_0x6f2f('0x33')][_0x6f2f('0x37')]));_0x37ca06[_0x6f2f('0x38')]=_0x37ca06[_0x6f2f('0x38')][_0x6f2f('0x39')]?_0x37ca06['attributes']:_0x9ae211[_0x6f2f('0x36')];if(!_0x102261['query'][_0x6f2f('0x3a')]('nolimit')){_0x37ca06[_0x6f2f('0x20')]=qs['limit'](_0x102261[_0x6f2f('0x33')][_0x6f2f('0x20')]);_0x37ca06[_0x6f2f('0x1e')]=qs[_0x6f2f('0x1e')](_0x102261[_0x6f2f('0x33')][_0x6f2f('0x1e')]);}_0x37ca06[_0x6f2f('0x3c')]=qs[_0x6f2f('0x3d')](_0x102261['query'][_0x6f2f('0x3d')]);_0x37ca06[_0x6f2f('0x3e')]=qs[_0x6f2f('0x35')](_[_0x6f2f('0x58')](_0x102261['query'],_0x9ae211[_0x6f2f('0x35')]));_0x37ca06[_0x6f2f('0x3e')][_0x6f2f('0x55')]=_0x4b1467['id'];if(_0x102261['query']['filter']){_0x37ca06[_0x6f2f('0x3e')]=_[_0x6f2f('0x40')](_0x37ca06['where'],{'$or':_[_0x6f2f('0x2e')](_0x37ca06[_0x6f2f('0x38')],function(_0x4c5cc2){var _0x19af59={};_0x19af59[_0x4c5cc2]={'$like':'%'+_0x102261[_0x6f2f('0x33')]['filter']+'%'};return _0x19af59;})});}_0x37ca06=_[_0x6f2f('0x40')]({},_0x37ca06,_0x102261[_0x6f2f('0x59')]);return db[_0x6f2f('0x56')][_0x6f2f('0x21')]({'where':_0x37ca06[_0x6f2f('0x3e')]})['then'](function(_0x1f36b6){_0x5975b0[_0x6f2f('0x21')]=_0x1f36b6;if(_0x102261['query'][_0x6f2f('0x5a')]){_0x37ca06['include']=[{'all':!![]}];}return db[_0x6f2f('0x56')]['findAll'](_0x37ca06);})[_0x6f2f('0x28')](function(_0x8e42ed){_0x5975b0[_0x6f2f('0x42')]=_0x8e42ed;return _0x5975b0;});}})[_0x6f2f('0x28')](respondWithFilteredResult(_0x2a1232,_0x37ca06))[_0x6f2f('0x43')](handleError(_0x2a1232,null));};exports[_0x6f2f('0x5b')]=function(_0x2f1fa6,_0x5acd29,_0x2fb82c){return db[_0x6f2f('0x2f')][_0x6f2f('0x4e')]({'where':{'id':_0x2f1fa6['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x5acd29,null))[_0x6f2f('0x28')](function(_0x3bc69f){if(_0x3bc69f){return _0x3bc69f[_0x6f2f('0x5b')](_0x2f1fa6[_0x6f2f('0x33')][_0x6f2f('0x5c')]);}})['then'](respondWithStatusCode(_0x5acd29,null))[_0x6f2f('0x43')](handleError(_0x5acd29,null));};exports[_0x6f2f('0x5d')]=function(_0x49898b,_0x44bf65,_0x29dc82){return db[_0x6f2f('0x2f')][_0x6f2f('0x4e')]({'where':{'id':_0x49898b[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x44bf65,null))[_0x6f2f('0x28')](function(_0x4d8697){if(_0x4d8697){var _0x1ed5c6=[];var _0x515764={'success':[],'errors':[]};return db['CmContact'][_0x6f2f('0x53')]()[_0x6f2f('0x28')](function(_0xd17055){if(_0x49898b[_0x6f2f('0x48')][_0x6f2f('0x5e')]&&_[_0x6f2f('0x5f')](_0x49898b['body'][_0x6f2f('0x5e')])){if(_0x49898b[_0x6f2f('0x48')][_0x6f2f('0x5e')][_0x6f2f('0x39')]){_0x49898b[_0x6f2f('0x48')][_0x6f2f('0x5e')]=_0x49898b['body'][_0x6f2f('0x5e')][_0x6f2f('0x60')](';')+';';}else{_0x49898b[_0x6f2f('0x48')][_0x6f2f('0x5e')]=null;}}else{_0x49898b[_0x6f2f('0x48')][_0x6f2f('0x5e')]=null;}if(_0x49898b[_0x6f2f('0x48')]&&_[_0x6f2f('0x5f')](_0x49898b['body'])){for(var _0x3f5427=0x0;_0x3f5427<_0x49898b[_0x6f2f('0x48')][_0x6f2f('0x39')];_0x3f5427+=0x1){_0x49898b[_0x6f2f('0x48')][_0x3f5427]['ListId']=_0x49898b['params']['id'];_0x1ed5c6['push'](_0x49898b[_0x6f2f('0x48')][_0x3f5427]);}return BPromise[_0x6f2f('0x61')](_0x1ed5c6,function(_0x45716d){return db[_0x6f2f('0x62')][_0x6f2f('0x47')](_[_0x6f2f('0x63')](_0x45716d,['ids','id'])||{},{'fields':_[_0x6f2f('0x34')](_0xd17055),'raw':!![]})[_0x6f2f('0x28')](function(_0x2a82bf){_0x515764[_0x6f2f('0x64')][_0x6f2f('0x65')](_0x2a82bf[_0x6f2f('0x66')]);})[_0x6f2f('0x43')](function(_0x505ed8){_0x515764[_0x6f2f('0x67')]['push']({'data':_0x45716d,'error':_0x505ed8[_0x6f2f('0x68')]});});})[_0x6f2f('0x28')](function(_0x2b3057){return _0x515764;})[_0x6f2f('0x43')](function(_0x586785){return _0x586785;});}else{_0x44bf65[_0x6f2f('0x1c')](0x190)[_0x6f2f('0x24')]({'message':_0x6f2f('0x69')});}});}})['then'](respondWithResult(_0x44bf65,null))[_0x6f2f('0x43')](handleError(_0x44bf65,null));};exports[_0x6f2f('0x6a')]=function(_0x4a430e,_0x5a8a2c,_0x442ec8){var _0x161ef5;return db[_0x6f2f('0x2f')]['find']({'where':{'id':_0x4a430e[_0x6f2f('0x52')]['id']},'include':[{'model':db[_0x6f2f('0x6b')],'as':_0x6f2f('0x6c')}]})[_0x6f2f('0x28')](handleEntityNotFound(_0x5a8a2c,null))[_0x6f2f('0x28')](function(_0x414d19){if(_0x414d19){_0x161ef5=_0x414d19;return db[_0x6f2f('0x62')][_0x6f2f('0x30')];}})[_0x6f2f('0x28')](function(_0x2e2396){if(_0x2e2396){var _0x43a671={};var _0x2d0955={};_0x2d0955[_0x6f2f('0x36')]=_[_0x6f2f('0x6d')](_[_0x6f2f('0x34')](_0x2e2396),_[_0x6f2f('0x2e')](_0x161ef5[_0x6f2f('0x6c')],function(_0x347836){return util[_0x6f2f('0x6e')](_0x6f2f('0x6f'),_0x347836['id']);}));_0x2d0955['query']=_[_0x6f2f('0x34')](_0x4a430e[_0x6f2f('0x33')]);_0x2d0955[_0x6f2f('0x35')]=_[_0x6f2f('0x45')](_0x2d0955[_0x6f2f('0x36')],_0x2d0955[_0x6f2f('0x33')]);_0x43a671[_0x6f2f('0x38')]=_[_0x6f2f('0x45')](_0x2d0955[_0x6f2f('0x36')],qs['fields'](_0x4a430e[_0x6f2f('0x33')]['fields']));_0x43a671[_0x6f2f('0x38')]=_0x43a671['attributes']['length']?_0x43a671[_0x6f2f('0x38')]:_0x2d0955[_0x6f2f('0x36')];if(!_0x4a430e[_0x6f2f('0x33')][_0x6f2f('0x3a')](_0x6f2f('0x3b'))){_0x43a671[_0x6f2f('0x20')]=qs[_0x6f2f('0x20')](_0x4a430e[_0x6f2f('0x33')][_0x6f2f('0x20')]);_0x43a671[_0x6f2f('0x1e')]=qs[_0x6f2f('0x1e')](_0x4a430e[_0x6f2f('0x33')][_0x6f2f('0x1e')]);}_0x43a671[_0x6f2f('0x3c')]=qs[_0x6f2f('0x3d')](_0x4a430e[_0x6f2f('0x33')][_0x6f2f('0x3d')]);_0x43a671[_0x6f2f('0x3e')]=qs[_0x6f2f('0x35')](_[_0x6f2f('0x58')](_0x4a430e['query'],_0x2d0955[_0x6f2f('0x35')]));_0x43a671[_0x6f2f('0x70')]=!![];if(_0x4a430e[_0x6f2f('0x33')]['filter']){_0x43a671[_0x6f2f('0x3e')]=_[_0x6f2f('0x40')](_0x43a671[_0x6f2f('0x3e')],{'$or':_[_0x6f2f('0x2e')](_0x43a671[_0x6f2f('0x38')],function(_0x44a7c5){var _0x2c1c98={};_0x2c1c98[_0x44a7c5]={'$like':'%'+_0x4a430e[_0x6f2f('0x33')][_0x6f2f('0x3f')]+'%'};return _0x2c1c98;})});}_0x43a671=_[_0x6f2f('0x40')]({},_0x43a671,_0x4a430e[_0x6f2f('0x59')]);return _0x161ef5[_0x6f2f('0x6a')](_0x43a671);}})[_0x6f2f('0x28')](respondWithResult(_0x5a8a2c,null))[_0x6f2f('0x43')](handleError(_0x5a8a2c,null));};exports['getContactsCsv']=function(_0x22a222,_0x52ccc0,_0x157ef6){var _0x4670cd;var _0x46592d;var _0x5e0125;var _0x21b6d8=_0x22a222[_0x6f2f('0x52')]['id'];csv_results=[];return db[_0x6f2f('0x71')]['findAll']({'attributes':['id',_0x6f2f('0x2c')],'raw':!![],'order':[_0x6f2f('0x72')]})[_0x6f2f('0x28')](function(_0x451544){_0x4670cd=_0x451544;var _0x4836ee=_[_0x6f2f('0x34')](db[_0x6f2f('0x62')][_0x6f2f('0x30')]);return db[_0x6f2f('0x6b')][_0x6f2f('0x41')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x5422e1){_0x46592d=_0x5422e1;var _0x1e049c=squel[_0x6f2f('0x73')]()[_0x6f2f('0x37')](_0x4836ee)[_0x6f2f('0x74')](_0x6f2f('0x75'),'c')[_0x6f2f('0x3e')](_0x6f2f('0x76'),_0x21b6d8)[_0x6f2f('0x3e')](_0x6f2f('0x77'))[_0x6f2f('0x78')]();for(var _0x2d0236=0x0;_0x2d0236<_0x46592d['length'];_0x2d0236++){_0x1e049c[_0x6f2f('0x79')](_0x6f2f('0x7a')+_0x46592d[_0x2d0236]['id'],_0x6f2f('0x7b')+_0x46592d[_0x2d0236][_0x6f2f('0x7c')]);}for(var _0x2d0236=0x0;_0x2d0236<_0x4670cd[_0x6f2f('0x39')];_0x2d0236++){_0x1e049c[_0x6f2f('0x79')](squel['select']()[_0x6f2f('0x79')](_0x6f2f('0x7d'))[_0x6f2f('0x74')](_0x6f2f('0x7e'))[_0x6f2f('0x3e')](_0x6f2f('0x7f'),_0x4670cd[_0x2d0236]['id'])[_0x6f2f('0x3e')]('CmContactId\x20=\x20c.id'),_0x6f2f('0x80')+_0x4670cd[_0x2d0236][_0x6f2f('0x2c')]);_0x1e049c[_0x6f2f('0x79')](squel[_0x6f2f('0x73')]()['field'](_0x6f2f('0x81'))['from'](_0x6f2f('0x7e'))['where']('ItemTypeId\x20=\x20?',_0x4670cd[_0x2d0236]['id'])[_0x6f2f('0x3e')](_0x6f2f('0x82')),_0x6f2f('0x83')+_0x4670cd[_0x2d0236][_0x6f2f('0x2c')]);}var _0x5336ab=[];_0x5336ab[_0x6f2f('0x65')](_0x1e049c['toString']());BPromise[_0x6f2f('0x61')](_0x5336ab,handleQuery)[_0x6f2f('0x28')](function(_0x160bf9){handleQuery(_0x1e049c[_0x6f2f('0x84')]());var _0x3a0c3=csv_results[0x0];if(!_['isEmpty'](_0x3a0c3)){var _0x3a9402=toCsv(_0x3a0c3);var _0x3a09c4=Date[_0x6f2f('0x85')]();fs[_0x6f2f('0x86')](util[_0x6f2f('0x6e')](_0x6f2f('0x87'),_0x21b6d8,_0x3a09c4),_0x3a9402);_0x52ccc0[_0x6f2f('0x88')](_0x6f2f('0x89'),_0x6f2f('0x8a')+util[_0x6f2f('0x6e')](_0x6f2f('0x8b'),_0x21b6d8,_0x3a09c4));_0x52ccc0[_0x6f2f('0x88')](_0x6f2f('0x8c'),_0x6f2f('0x8d'));return _0x52ccc0[_0x6f2f('0x8e')](util[_0x6f2f('0x6e')](_0x6f2f('0x87'),_0x21b6d8,_0x3a09c4));}else{return _0x52ccc0[_0x6f2f('0x1b')](0xcc);}});});});};exports[_0x6f2f('0x8f')]=function(_0x2724d7,_0x44e051,_0x90ef37){var _0x53af0c;delete _0x2724d7[_0x6f2f('0x48')]['id'];return db[_0x6f2f('0x2f')]['findOne']({'where':{'id':_0x2724d7[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x44e051,null))[_0x6f2f('0x28')](function(_0x2b9ac8){if(_0x2b9ac8){return db[_0x6f2f('0x90')][_0x6f2f('0x91')](function(_0x2b9335){return db['CmCustomField'][_0x6f2f('0x47')](_0x2724d7[_0x6f2f('0x48')],{'transaction':_0x2b9335})[_0x6f2f('0x28')](function(_0x159d5b){_0x53af0c=_0x159d5b;return _0x2b9ac8[_0x6f2f('0x92')](_0x159d5b,{'transaction':_0x2b9335});})['then'](function(){var _0x1c40c3={'type':db['Sequelize'][_0x6f2f('0x93')],'transaction':_0x2b9335};switch(_0x2724d7['body'][_0x6f2f('0x94')]){case _0x6f2f('0x95'):_0x1c40c3[_0x6f2f('0x94')]=db[_0x6f2f('0x96')]['TEXT'];break;case'number':_0x1c40c3[_0x6f2f('0x94')]=db[_0x6f2f('0x96')]['INTEGER'];break;case'switch':_0x1c40c3['type']=db[_0x6f2f('0x96')][_0x6f2f('0x97')];_0x1c40c3[_0x6f2f('0x98')]=![];break;default:}return db[_0x6f2f('0x90')][_0x6f2f('0x99')][_0x6f2f('0x9a')](_0x6f2f('0x75'),util[_0x6f2f('0x6e')]('cf_%s',_0x53af0c['id']),_0x1c40c3);})['then'](function(){return _0x53af0c;});});}})[_0x6f2f('0x28')](respondWithResult(_0x44e051,null))[_0x6f2f('0x43')](handleError(_0x44e051,null));};exports[_0x6f2f('0x9b')]=function(_0x2fcfc8,_0x2de733,_0x226cf3){var _0x46f009={};var _0x200b8d={};var _0x98713c;var _0x3142a2;return db['CmList'][_0x6f2f('0x9c')]({'where':{'id':_0x2fcfc8['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x2de733,null))['then'](function(_0x359293){if(_0x359293){_0x98713c=_0x359293;_0x200b8d[_0x6f2f('0x36')]=_['keys'](db[_0x6f2f('0x6b')][_0x6f2f('0x30')]);_0x200b8d[_0x6f2f('0x33')]=_[_0x6f2f('0x34')](_0x2fcfc8['query']);_0x200b8d[_0x6f2f('0x35')]=_[_0x6f2f('0x45')](_0x200b8d[_0x6f2f('0x36')],_0x200b8d[_0x6f2f('0x33')]);_0x46f009[_0x6f2f('0x38')]=_[_0x6f2f('0x45')](_0x200b8d['model'],qs['fields'](_0x2fcfc8[_0x6f2f('0x33')]['fields']));_0x46f009[_0x6f2f('0x38')]=_0x46f009[_0x6f2f('0x38')][_0x6f2f('0x39')]?_0x46f009[_0x6f2f('0x38')]:_0x200b8d[_0x6f2f('0x36')];_0x46f009['order']=qs[_0x6f2f('0x3d')](_0x2fcfc8[_0x6f2f('0x33')]['sort']);_0x46f009[_0x6f2f('0x3e')]=qs[_0x6f2f('0x35')](_[_0x6f2f('0x58')](_0x2fcfc8[_0x6f2f('0x33')],_0x200b8d[_0x6f2f('0x35')]));_0x46f009[_0x6f2f('0x3e')]=_['merge'](_0x46f009[_0x6f2f('0x3e')],{'$or':[{'ListId':_0x359293['id']},{'ListId':null}]});if(_0x2fcfc8[_0x6f2f('0x33')][_0x6f2f('0x3f')]){_0x46f009['where']=_[_0x6f2f('0x40')](_0x46f009[_0x6f2f('0x3e')],{'$or':_['map'](_0x46f009[_0x6f2f('0x38')],function(_0x5358f1){var _0x167269={};_0x167269[_0x5358f1]={'$like':'%'+_0x2fcfc8['query'][_0x6f2f('0x3f')]+'%'};return _0x167269;})});}_0x46f009=_[_0x6f2f('0x40')]({},_0x46f009,_0x2fcfc8[_0x6f2f('0x59')]);return db[_0x6f2f('0x6b')][_0x6f2f('0x9d')](_0x46f009);}})[_0x6f2f('0x28')](respondWithResult(_0x2de733,null))[_0x6f2f('0x43')](handleError(_0x2de733,null));};exports[_0x6f2f('0x9e')]=function(_0x410bb0,_0x280c0f){return db[_0x6f2f('0x6b')][_0x6f2f('0x9d')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x280c0f,null))[_0x6f2f('0x28')](function(_0x51ac95){return _0x51ac95;})[_0x6f2f('0x28')](respondWithResult(_0x280c0f,null))[_0x6f2f('0x43')](handleError(_0x280c0f,null));};exports[_0x6f2f('0x9f')]=function(_0x873ad1,_0xa9d775,_0x106a4c){return db['CmList'][_0x6f2f('0x4e')]({'where':{'id':_0x873ad1[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0xa9d775,null))[_0x6f2f('0x28')](function(_0x30a7b9){if(_0x30a7b9){return _0x30a7b9['addAgents'](_0x873ad1[_0x6f2f('0x48')][_0x6f2f('0x5c')],_[_0x6f2f('0x63')](_0x873ad1[_0x6f2f('0x48')],[_0x6f2f('0x5c'),'id'])||{})[_0x6f2f('0xa0')](function(_0x1c71fe){for(var _0x3f7cde=0x0;_0x3f7cde<_0x873ad1['body'][_0x6f2f('0x5c')][_0x6f2f('0x39')];_0x3f7cde+=0x1){socket[_0x6f2f('0xa1')](_0x6f2f('0xa2'),{'UserId':Number(_0x873ad1[_0x6f2f('0x48')][_0x6f2f('0x5c')][_0x3f7cde]),'CmListId':Number(_0x873ad1[_0x6f2f('0x52')]['id'])});}return _0x1c71fe;});}})[_0x6f2f('0x28')](respondWithResult(_0xa9d775,null))[_0x6f2f('0x43')](handleError(_0xa9d775,null));};exports[_0x6f2f('0xa3')]=function(_0x3f5a99,_0x5cd9fc,_0x4c686b){return db['CmList'][_0x6f2f('0x4e')]({'where':{'id':_0x3f5a99[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x5cd9fc,null))['then'](function(_0x4b6dc3){if(_0x4b6dc3){return _0x4b6dc3[_0x6f2f('0xa3')](_0x3f5a99['query'][_0x6f2f('0x5c')])['then'](function(){if(_[_0x6f2f('0x5f')](_0x3f5a99['query']['ids'])){for(var _0x5e1748=0x0;_0x5e1748<_0x3f5a99[_0x6f2f('0x33')][_0x6f2f('0x5c')][_0x6f2f('0x39')];_0x5e1748+=0x1){socket['emit'](_0x6f2f('0xa4'),{'UserId':Number(_0x3f5a99['query']['ids'][_0x5e1748]),'CmListId':Number(_0x3f5a99[_0x6f2f('0x52')]['id'])});}}else{socket[_0x6f2f('0xa1')](_0x6f2f('0xa4'),{'UserId':Number(_0x3f5a99[_0x6f2f('0x33')][_0x6f2f('0x5c')]),'CmListId':Number(_0x3f5a99[_0x6f2f('0x52')]['id'])});}});}})[_0x6f2f('0x28')](respondWithStatusCode(_0x5cd9fc,null))[_0x6f2f('0x43')](handleError(_0x5cd9fc,null));};exports[_0x6f2f('0xa5')]=function(_0x53bb4f,_0x264375,_0x1ef67b){var _0x86b437={};var _0x4fc8e6={};var _0x1d8ead;var _0x57cd27;return db[_0x6f2f('0x2f')][_0x6f2f('0x9c')]({'where':{'id':_0x53bb4f[_0x6f2f('0x52')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x264375,null))[_0x6f2f('0x28')](function(_0x3a8bc7){if(_0x3a8bc7){_0x1d8ead=_0x3a8bc7;_0x4fc8e6['model']=_['keys'](db['User'][_0x6f2f('0x30')]);_0x4fc8e6[_0x6f2f('0x33')]=_[_0x6f2f('0x34')](_0x53bb4f[_0x6f2f('0x33')]);_0x4fc8e6[_0x6f2f('0x35')]=_['intersection'](_0x4fc8e6[_0x6f2f('0x36')],_0x4fc8e6['query']);_0x86b437[_0x6f2f('0x38')]=_[_0x6f2f('0x45')](_0x4fc8e6[_0x6f2f('0x36')],qs[_0x6f2f('0x37')](_0x53bb4f[_0x6f2f('0x33')]['fields']));_0x86b437[_0x6f2f('0x38')]=_0x86b437[_0x6f2f('0x38')][_0x6f2f('0x39')]?_0x86b437[_0x6f2f('0x38')]:_0x4fc8e6[_0x6f2f('0x36')];_0x86b437[_0x6f2f('0x3c')]=qs['sort'](_0x53bb4f['query'][_0x6f2f('0x3d')]);_0x86b437[_0x6f2f('0x3e')]=qs['filters'](_[_0x6f2f('0x58')](_0x53bb4f[_0x6f2f('0x33')],_0x4fc8e6[_0x6f2f('0x35')]));if(_0x53bb4f[_0x6f2f('0x33')][_0x6f2f('0x3f')]){_0x86b437[_0x6f2f('0x3e')]=_['merge'](_0x86b437['where'],{'$or':_[_0x6f2f('0x2e')](_0x86b437[_0x6f2f('0x38')],function(_0x3b9ff4){var _0x8c1936={};_0x8c1936[_0x3b9ff4]={'$like':'%'+_0x53bb4f['query']['filter']+'%'};return _0x8c1936;})});}_0x86b437=_[_0x6f2f('0x40')]({},_0x86b437,_0x53bb4f[_0x6f2f('0x59')]);return _0x1d8ead[_0x6f2f('0xa5')](_0x86b437);}})[_0x6f2f('0x28')](function(_0x3d5a3a){if(_0x3d5a3a){_0x57cd27=_0x3d5a3a[_0x6f2f('0x39')];if(!_0x53bb4f[_0x6f2f('0x33')][_0x6f2f('0x3a')](_0x6f2f('0x3b'))){_0x86b437[_0x6f2f('0x20')]=qs[_0x6f2f('0x20')](_0x53bb4f[_0x6f2f('0x33')]['limit']);_0x86b437['offset']=qs[_0x6f2f('0x1e')](_0x53bb4f[_0x6f2f('0x33')]['offset']);}return _0x1d8ead[_0x6f2f('0xa5')](_0x86b437);}})[_0x6f2f('0x28')](function(_0xd340c2){if(_0xd340c2){return _0xd340c2?{'count':_0x57cd27,'rows':_0xd340c2}:null;}})[_0x6f2f('0x28')](respondWithResult(_0x264375,null))[_0x6f2f('0x43')](handleError(_0x264375,null));};function handleQuery(_0x498d2d){logger[_0x6f2f('0xa6')](_0x498d2d);return db[_0x6f2f('0x90')][_0x6f2f('0x33')](_0x498d2d)[_0x6f2f('0xa0')](function(_0x51b3b5){csv_results[_0x6f2f('0x65')](_0x51b3b5);})['catch'](function(_0x5d2ecd){logger[_0x6f2f('0xa7')](_0x5d2ecd[_0x6f2f('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a50ab7a..0067938 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 _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(_0x305787,_0x3ae1c2){_0x305787=_0x305787-0x0;var _0x163cc3=_0x3e74[_0x305787];return _0x163cc3;};'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 +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x2cf195,_0x611c9b){_0x2cf195=_0x2cf195-0x0;var _0x1fa5b3=_0xe14b[_0x2cf195];return _0x1fa5b3;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b66bd9d..f9146bb 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x35ee6e,_0x34830b){var _0x277d36=function(_0x3abb36){while(--_0x3abb36){_0x35ee6e['push'](_0x35ee6e['shift']());}};_0x277d36(++_0x34830b);}(_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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x743ad3,_0x5ab237){var _0x286352=function(_0x18e4dc){while(--_0x18e4dc){_0x743ad3['push'](_0x743ad3['shift']());}};_0x286352(++_0x5ab237);}(_0x702d,0x147));var _0xd702=function(_0x1996b8,_0x17ea1e){_0x1996b8=_0x1996b8-0x0;var _0x5d9a4a=_0x702d[_0x1996b8];return _0x5d9a4a;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 168b0fd..37469bd 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 _0x2ae7=['request\x20sent','result','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./cmList.socket','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','CmList,\x20%s,\x20%s'];(function(_0x3a869c,_0x2866e3){var _0x96f520=function(_0x2df05d){while(--_0x2df05d){_0x3a869c['push'](_0x3a869c['shift']());}};_0x96f520(++_0x2866e3);}(_0x2ae7,0x19b));var _0x72ae=function(_0x2a0d88,_0x248e33){_0x2a0d88=_0x2a0d88-0x0;var _0x5c09e0=_0x2ae7[_0x2a0d88];return _0x5c09e0;};'use strict';var _=require('lodash');var util=require(_0x72ae('0x0'));var moment=require(_0x72ae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72ae('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x72ae('0x3'));var logger=require('../../config/logger')(_0x72ae('0x4'));var config=require(_0x72ae('0x5'));var jayson=require(_0x72ae('0x6'));var client=jayson['client'][_0x72ae('0x7')]({'port':0x232a});config[_0x72ae('0x8')]=_[_0x72ae('0x9')](config[_0x72ae('0x8')],{'host':_0x72ae('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72ae('0x8')]));require(_0x72ae('0xb'))['register'](socket);function respondWithRpcPromise(_0x220f5d,_0x2e0641,_0x32a060){return new BPromise(function(_0x589524,_0x1d510a){return client[_0x72ae('0xc')](_0x220f5d,_0x32a060)[_0x72ae('0xd')](function(_0x4b6ca5){logger[_0x72ae('0xe')]('CmList,\x20%s,\x20%s',_0x2e0641,'request\x20sent');logger[_0x72ae('0xf')](_0x72ae('0x10'),_0x2e0641,'request\x20sent',JSON[_0x72ae('0x11')](_0x4b6ca5));if(_0x4b6ca5[_0x72ae('0x12')]){if(_0x4b6ca5['error']['code']===0x1f4){logger[_0x72ae('0x12')]('CmList,\x20%s,\x20%s',_0x2e0641,_0x4b6ca5[_0x72ae('0x12')][_0x72ae('0x13')]);return _0x1d510a(_0x4b6ca5['error'][_0x72ae('0x13')]);}logger[_0x72ae('0x12')](_0x72ae('0x14'),_0x2e0641,_0x4b6ca5[_0x72ae('0x12')][_0x72ae('0x13')]);return _0x589524(_0x4b6ca5['error'][_0x72ae('0x13')]);}else{logger[_0x72ae('0xe')](_0x72ae('0x14'),_0x2e0641,_0x72ae('0x15'));_0x589524(_0x4b6ca5[_0x72ae('0x16')][_0x72ae('0x13')]);}})[_0x72ae('0x17')](function(_0x59e9b3){logger[_0x72ae('0x12')](_0x72ae('0x14'),_0x2e0641,_0x59e9b3);_0x1d510a(_0x59e9b3);});});} \ No newline at end of file +var _0xf567=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./cmList.socket','register','request','then','info','debug','stringify','error','code','message','CmList,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x333b4b,_0x595ac5){var _0x3d3f5b=function(_0x1ccb2d){while(--_0x1ccb2d){_0x333b4b['push'](_0x333b4b['shift']());}};_0x3d3f5b(++_0x595ac5);}(_0xf567,0xa8));var _0x7f56=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf567[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var moment=require(_0x7f56('0x2'));var BPromise=require(_0x7f56('0x3'));var rs=require(_0x7f56('0x4'));var fs=require('fs');var Redis=require(_0x7f56('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f56('0x6'));var logger=require(_0x7f56('0x7'))(_0x7f56('0x8'));var config=require(_0x7f56('0x9'));var jayson=require(_0x7f56('0xa'));var client=jayson[_0x7f56('0xb')][_0x7f56('0xc')]({'port':0x232a});config['redis']=_[_0x7f56('0xd')](config[_0x7f56('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f56('0xe')]));require(_0x7f56('0xf'))[_0x7f56('0x10')](socket);function respondWithRpcPromise(_0x5167e6,_0x425456,_0x2f5406){return new BPromise(function(_0x31eda8,_0xb483a9){return client[_0x7f56('0x11')](_0x5167e6,_0x2f5406)[_0x7f56('0x12')](function(_0x2ca773){logger[_0x7f56('0x13')]('CmList,\x20%s,\x20%s',_0x425456,'request\x20sent');logger[_0x7f56('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x425456,'request\x20sent',JSON[_0x7f56('0x15')](_0x2ca773));if(_0x2ca773[_0x7f56('0x16')]){if(_0x2ca773['error'][_0x7f56('0x17')]===0x1f4){logger[_0x7f56('0x16')]('CmList,\x20%s,\x20%s',_0x425456,_0x2ca773['error'][_0x7f56('0x18')]);return _0xb483a9(_0x2ca773[_0x7f56('0x16')]['message']);}logger[_0x7f56('0x16')](_0x7f56('0x19'),_0x425456,_0x2ca773[_0x7f56('0x16')][_0x7f56('0x18')]);return _0x31eda8(_0x2ca773[_0x7f56('0x16')]['message']);}else{logger[_0x7f56('0x13')](_0x7f56('0x19'),_0x425456,_0x7f56('0x1a'));_0x31eda8(_0x2ca773[_0x7f56('0x1b')][_0x7f56('0x18')]);}})[_0x7f56('0x1c')](function(_0x92cc7f){logger[_0x7f56('0x16')](_0x7f56('0x19'),_0x425456,_0x92cc7f);_0xb483a9(_0x92cc7f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 84a14a8..488684a 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 _0xbccd=['emit','removeListener','register','length','cmList:','./cmList.events','update'];(function(_0x4e1ac0,_0x17ce8d){var _0x2432a8=function(_0x4a3b20){while(--_0x4a3b20){_0x4e1ac0['push'](_0x4e1ac0['shift']());}};_0x2432a8(++_0x17ce8d);}(_0xbccd,0x1b0));var _0xdbcc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xbccd[_0xa1e3e3];return _0xc980e9;};'use strict';var CmListEvents=require(_0xdbcc('0x0'));var events=['save','remove',_0xdbcc('0x1')];function createListener(_0x1c6fb5,_0x39bff4){return function(_0x193088){_0x39bff4[_0xdbcc('0x2')](_0x1c6fb5,_0x193088);};}function removeListener(_0x33b260,_0x4bd11a){return function(){CmListEvents[_0xdbcc('0x3')](_0x33b260,_0x4bd11a);};}exports[_0xdbcc('0x4')]=function(_0x9cca7a){for(var _0x2997fd=0x0,_0x7fe600=events[_0xdbcc('0x5')];_0x2997fd<_0x7fe600;_0x2997fd++){var _0x216289=events[_0x2997fd];var _0x22d783=createListener(_0xdbcc('0x6')+_0x216289,_0x9cca7a);CmListEvents['on'](_0x216289,_0x22d783);}}; \ No newline at end of file +var _0x7a20=['length','cmList:','save','remove','emit','removeListener','register'];(function(_0x3902fd,_0x5ab635){var _0x1e0990=function(_0x27a081){while(--_0x27a081){_0x3902fd['push'](_0x3902fd['shift']());}};_0x1e0990(++_0x5ab635);}(_0x7a20,0xf7));var _0x07a2=function(_0x4edeed,_0x24ecfc){_0x4edeed=_0x4edeed-0x0;var _0x25c10d=_0x7a20[_0x4edeed];return _0x25c10d;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x07a2('0x0'),_0x07a2('0x1'),'update'];function createListener(_0xb131db,_0x20054d){return function(_0xcb0eb5){_0x20054d[_0x07a2('0x2')](_0xb131db,_0xcb0eb5);};}function removeListener(_0x2b9fbf,_0x38125d){return function(){CmListEvents[_0x07a2('0x3')](_0x2b9fbf,_0x38125d);};}exports[_0x07a2('0x4')]=function(_0x739d90){for(var _0x2dc238=0x0,_0x24383e=events[_0x07a2('0x5')];_0x2dc238<_0x24383e;_0x2dc238++){var _0x19af72=events[_0x2dc238];var _0x2ba067=createListener(_0x07a2('0x6')+_0x19af72,_0x739d90);CmListEvents['on'](_0x19af72,_0x2ba067);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1f27396..1e0405a 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 _0xe630=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','addDisposition','/:id/fields','addCustomField','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x3775ea,_0x46eed3){var _0x12c74d=function(_0x3af009){while(--_0x3af009){_0x3775ea['push'](_0x3775ea['shift']());}};_0x12c74d(++_0x46eed3);}(_0xe630,0x149));var _0x0e63=function(_0x18e8c8,_0x5b6b81){_0x18e8c8=_0x18e8c8-0x0;var _0x1fa76e=_0xe630[_0x18e8c8];return _0x1fa76e;};'use strict';var multer=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var timeout=require(_0x0e63('0x2'));var express=require(_0x0e63('0x3'));var router=express[_0x0e63('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e63('0x5'));var interaction=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var controller=require('./cmList.controller');router[_0x0e63('0x8')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xa')]);router[_0x0e63('0x8')](_0x0e63('0xb'),auth['isAuthenticated'](),controller[_0x0e63('0xc')]);router[_0x0e63('0x8')](_0x0e63('0xd'),auth[_0x0e63('0x9')](),controller[_0x0e63('0xe')]);router[_0x0e63('0x8')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x10')]);router[_0x0e63('0x8')](_0x0e63('0x11'),auth['isAuthenticated'](),controller[_0x0e63('0x12')]);router[_0x0e63('0x8')](_0x0e63('0x13'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x14')]);router[_0x0e63('0x8')](_0x0e63('0x15'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x16')]);router['get']('/:id/fields',auth[_0x0e63('0x9')](),controller[_0x0e63('0x17')]);router[_0x0e63('0x8')](_0x0e63('0x18'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x19')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0e63('0x11'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x1a')]);router['post']('/:id/contacts',auth[_0x0e63('0x9')](),controller['addContacts']);router['post'](_0x0e63('0x1b'),auth['isAuthenticated'](),controller[_0x0e63('0x1c')]);router[_0x0e63('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x0e63('0x1e')]);router[_0x0e63('0x1f')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x20')]);router[_0x0e63('0x21')]('/:id',auth[_0x0e63('0x9')](),controller[_0x0e63('0x22')]);router[_0x0e63('0x21')](_0x0e63('0x11'),auth[_0x0e63('0x9')](),controller['removeDispositions']);router['delete'](_0x0e63('0x18'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x23')]);module[_0x0e63('0x24')]=router; \ No newline at end of file +var _0x306d=['/:id/fields','/:id/users','post','create','addDisposition','addCustomField','addAgents','put','delete','removeAgents','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','get','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv'];(function(_0x5898be,_0x440612){var _0x574a42=function(_0x54db1c){while(--_0x54db1c){_0x5898be['push'](_0x5898be['shift']());}};_0x574a42(++_0x440612);}(_0x306d,0x176));var _0xd306=function(_0xee74b3,_0x1b5bc2){_0xee74b3=_0xee74b3-0x0;var _0x490bb0=_0x306d[_0xee74b3];return _0x490bb0;};'use strict';var multer=require(_0xd306('0x0'));var util=require(_0xd306('0x1'));var path=require(_0xd306('0x2'));var timeout=require('connect-timeout');var express=require(_0xd306('0x3'));var router=express['Router']();var fs_extra=require(_0xd306('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd306('0x5'));var config=require(_0xd306('0x6'));var controller=require(_0xd306('0x7'));router['get']('/',auth[_0xd306('0x8')](),controller[_0xd306('0x9')]);router['get'](_0xd306('0xa'),auth[_0xd306('0x8')](),controller[_0xd306('0xb')]);router[_0xd306('0xc')]('/global_fields',auth[_0xd306('0x8')](),controller[_0xd306('0xd')]);router[_0xd306('0xc')](_0xd306('0xe'),auth['isAuthenticated'](),controller[_0xd306('0xf')]);router[_0xd306('0xc')](_0xd306('0x10'),auth[_0xd306('0x8')](),controller[_0xd306('0x11')]);router[_0xd306('0xc')](_0xd306('0x12'),auth[_0xd306('0x8')](),controller[_0xd306('0x13')]);router['get'](_0xd306('0x14'),auth[_0xd306('0x8')](),controller[_0xd306('0x15')]);router['get'](_0xd306('0x16'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0xd306('0x17'),auth[_0xd306('0x8')](),controller['getAgents']);router[_0xd306('0x18')]('/',auth[_0xd306('0x8')](),controller[_0xd306('0x19')]);router[_0xd306('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd306('0x1a')]);router[_0xd306('0x18')](_0xd306('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0xd306('0x18')](_0xd306('0x16'),auth[_0xd306('0x8')](),controller[_0xd306('0x1b')]);router[_0xd306('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xd306('0x1c')]);router[_0xd306('0x1d')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd306('0x1e')]('/:id',auth[_0xd306('0x8')](),controller['destroy']);router['delete'](_0xd306('0x10'),auth[_0xd306('0x8')](),controller['removeDispositions']);router[_0xd306('0x1e')](_0xd306('0x17'),auth['isAuthenticated'](),controller[_0xd306('0x1f')]);module[_0xd306('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 05e2b7c..dec9a11 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 _0xd7f3=['STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xd7f3,0x1a9));var _0x3d7f=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0xd7f3[_0x371f33];return _0x246c96;};'use strict';var Sequelize=require(_0x3d7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d7f('0x1')],'get':function(_0x2ade8e){return this[_0x3d7f('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x3d7f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x3d7f('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x2e7b=['getDataValue','field','STRING','sequelize','exports'];(function(_0x518cfb,_0x5ef8d9){var _0x2adae6=function(_0x31da82){while(--_0x31da82){_0x518cfb['push'](_0x518cfb['shift']());}};_0x2adae6(++_0x5ef8d9);}(_0x2e7b,0x1ca));var _0xb2e7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2e7b[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xb2e7('0x0'));module[_0xb2e7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c94c1){return this[_0xb2e7('0x2')](_0xb2e7('0x3'));}},'field':{'type':Sequelize[_0xb2e7('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xb2e7('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xb2e7('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 5c9383b..dca5ba8 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x688f88,_0x4275ec){var _0x162c4e=function(_0x47bf6b){while(--_0x47bf6b){_0x688f88['push'](_0x688f88['shift']());}};_0x162c4e(++_0x4275ec);}(_0x7a54,0x106));var _0x47a5=function(_0x56c2a9,_0x5e7e76){_0x56c2a9=_0x56c2a9-0x0;var _0x146023=_0x7a54[_0x56c2a9];return _0x146023;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x14b5d0,_0x444ae1){var _0x5ee6f7=function(_0x9b5e22){while(--_0x9b5e22){_0x14b5d0['push'](_0x14b5d0['shift']());}};_0x5ee6f7(++_0x444ae1);}(_0x7a54,0x106));var _0x47a5=function(_0x237b0b,_0xbd1982){_0x237b0b=_0x237b0b-0x0;var _0x1c2cb2=_0x7a54[_0x237b0b];return _0x1c2cb2;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 59d1721..8a7f66e 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 _0x402e=['request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x402e,0xcb));var _0xe402=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x402e[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xe402('0x0'));var util=require(_0xe402('0x1'));var logger=require('../../config/logger')(_0xe402('0x2'));var moment=require(_0xe402('0x3'));var BPromise=require(_0xe402('0x4'));var rp=require(_0xe402('0x5'));var fs=require('fs');var path=require(_0xe402('0x6'));var rimraf=require(_0xe402('0x7'));var config=require(_0xe402('0x8'));var attributes=require(_0xe402('0x9'));module[_0xe402('0xa')]=function(_0x5a6a89,_0x408e56){return _0x5a6a89[_0xe402('0xb')](_0xe402('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd27c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define','tools_conditions','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd27c,0xe1));var _0xcd27=function(_0x59ec7a,_0x1eb345){_0x59ec7a=_0x59ec7a-0x0;var _0x8535ed=_0xd27c[_0x59ec7a];return _0x8535ed;};'use strict';var _=require('lodash');var util=require(_0xcd27('0x0'));var logger=require(_0xcd27('0x1'))(_0xcd27('0x2'));var moment=require(_0xcd27('0x3'));var BPromise=require(_0xcd27('0x4'));var rp=require(_0xcd27('0x5'));var fs=require('fs');var path=require(_0xcd27('0x6'));var rimraf=require(_0xcd27('0x7'));var config=require(_0xcd27('0x8'));var attributes=require(_0xcd27('0x9'));module['exports']=function(_0x37c73e,_0x1a5d28){return _0x37c73e[_0xcd27('0xa')]('Condition',attributes,{'tableName':_0xcd27('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 ff5569b..f08d2db 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 _0x7f34=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xc69530,_0x57c174){var _0x148a92=function(_0x409d97){while(--_0x409d97){_0xc69530['push'](_0xc69530['shift']());}};_0x148a92(++_0x57c174);}(_0x7f34,0x13f));var _0x47f3=function(_0x438d7f,_0x50fd81){_0x438d7f=_0x438d7f-0x0;var _0x5c7589=_0x7f34[_0x438d7f];return _0x5c7589;};'use strict';var _=require(_0x47f3('0x0'));var util=require('util');var moment=require(_0x47f3('0x1'));var BPromise=require(_0x47f3('0x2'));var rs=require(_0x47f3('0x3'));var fs=require('fs');var Redis=require(_0x47f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x47f3('0x5'))(_0x47f3('0x6'));var config=require(_0x47f3('0x7'));var jayson=require(_0x47f3('0x8'));var client=jayson[_0x47f3('0x9')][_0x47f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37cf99,_0x1a2890,_0x5263b2){return new BPromise(function(_0x5499a0,_0x93466b){return client['request'](_0x37cf99,_0x5263b2)['then'](function(_0x514143){logger['info'](_0x47f3('0xb'),_0x1a2890,_0x47f3('0xc'));logger[_0x47f3('0xd')](_0x47f3('0xe'),_0x1a2890,'request\x20sent',JSON[_0x47f3('0xf')](_0x514143));if(_0x514143['error']){if(_0x514143['error'][_0x47f3('0x10')]===0x1f4){logger['error'](_0x47f3('0xb'),_0x1a2890,_0x514143['error'][_0x47f3('0x11')]);return _0x93466b(_0x514143[_0x47f3('0x12')][_0x47f3('0x11')]);}logger[_0x47f3('0x12')](_0x47f3('0xb'),_0x1a2890,_0x514143[_0x47f3('0x12')][_0x47f3('0x11')]);return _0x5499a0(_0x514143['error'][_0x47f3('0x11')]);}else{logger[_0x47f3('0x13')](_0x47f3('0xb'),_0x1a2890,'request\x20sent');_0x5499a0(_0x514143[_0x47f3('0x14')][_0x47f3('0x11')]);}})[_0x47f3('0x15')](function(_0x30f83f){logger[_0x47f3('0x12')](_0x47f3('0xb'),_0x1a2890,_0x30f83f);_0x93466b(_0x30f83f);});});} \ No newline at end of file +var _0xe9af=['Condition,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3a634e,_0x273db2){var _0x2ecddb=function(_0x3a9d2d){while(--_0x3a9d2d){_0x3a634e['push'](_0x3a634e['shift']());}};_0x2ecddb(++_0x273db2);}(_0xe9af,0x169));var _0xfe9a=function(_0x187730,_0x19cc8d){_0x187730=_0x187730-0x0;var _0x1181a4=_0xe9af[_0x187730];return _0x1181a4;};'use strict';var _=require(_0xfe9a('0x0'));var util=require(_0xfe9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe9a('0x2'));var fs=require('fs');var Redis=require(_0xfe9a('0x3'));var db=require(_0xfe9a('0x4'))['db'];var utils=require(_0xfe9a('0x5'));var logger=require('../../config/logger')(_0xfe9a('0x6'));var config=require(_0xfe9a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfe9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50e9ec,_0x133233,_0x3a9707){return new BPromise(function(_0x1752a0,_0x221fbb){return client[_0xfe9a('0x9')](_0x50e9ec,_0x3a9707)[_0xfe9a('0xa')](function(_0x466b1c){logger['info']('Condition,\x20%s,\x20%s',_0x133233,_0xfe9a('0xb'));logger[_0xfe9a('0xc')](_0xfe9a('0xd'),_0x133233,_0xfe9a('0xb'),JSON[_0xfe9a('0xe')](_0x466b1c));if(_0x466b1c[_0xfe9a('0xf')]){if(_0x466b1c[_0xfe9a('0xf')][_0xfe9a('0x10')]===0x1f4){logger[_0xfe9a('0xf')](_0xfe9a('0x11'),_0x133233,_0x466b1c['error'][_0xfe9a('0x12')]);return _0x221fbb(_0x466b1c[_0xfe9a('0xf')][_0xfe9a('0x12')]);}logger[_0xfe9a('0xf')](_0xfe9a('0x11'),_0x133233,_0x466b1c[_0xfe9a('0xf')][_0xfe9a('0x12')]);return _0x1752a0(_0x466b1c[_0xfe9a('0xf')][_0xfe9a('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x133233,_0xfe9a('0xb'));_0x1752a0(_0x466b1c[_0xfe9a('0x13')][_0xfe9a('0x12')]);}})[_0xfe9a('0x14')](function(_0xa4069c){logger[_0xfe9a('0xf')](_0xfe9a('0x11'),_0x133233,_0xa4069c);_0x221fbb(_0xa4069c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 255d379..0ccab59 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 _0x6860=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x52ca63,_0x3b3267){var _0xa1126a=function(_0x20d45d){while(--_0x20d45d){_0x52ca63['push'](_0x52ca63['shift']());}};_0xa1126a(++_0x3b3267);}(_0x6860,0x179));var _0x0686=function(_0x2e140e,_0xcc1351){_0x2e140e=_0x2e140e-0x0;var _0x2c4c8c=_0x6860[_0x2e140e];return _0x2c4c8c;};'use strict';var multer=require(_0x0686('0x0'));var util=require(_0x0686('0x1'));var path=require(_0x0686('0x2'));var timeout=require(_0x0686('0x3'));var express=require(_0x0686('0x4'));var router=express[_0x0686('0x5')]();var fs_extra=require(_0x0686('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0686('0x7'));var config=require(_0x0686('0x8'));var controller=require('./condition.controller');router[_0x0686('0x9')](_0x0686('0xa'),auth[_0x0686('0xb')](),controller[_0x0686('0xc')]);router[_0x0686('0xd')]('/:id',auth[_0x0686('0xb')](),controller[_0x0686('0xe')]);module[_0x0686('0xf')]=router; \ No newline at end of file +var _0x5d32=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','exports','path','express','fs-extra'];(function(_0x113ff0,_0x40137d){var _0x4e1fcf=function(_0xf2776b){while(--_0xf2776b){_0x113ff0['push'](_0x113ff0['shift']());}};_0x4e1fcf(++_0x40137d);}(_0x5d32,0x1b9));var _0x25d3=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x5d32[_0x3f6e26];return _0x474345;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x25d3('0x0'));var timeout=require('connect-timeout');var express=require(_0x25d3('0x1'));var router=express['Router']();var fs_extra=require(_0x25d3('0x2'));var auth=require(_0x25d3('0x3'));var interaction=require(_0x25d3('0x4'));var config=require(_0x25d3('0x5'));var controller=require(_0x25d3('0x6'));router[_0x25d3('0x7')](_0x25d3('0x8'),auth['isAuthenticated'](),controller[_0x25d3('0x9')]);router[_0x25d3('0xa')](_0x25d3('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x25d3('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 034caa1..b7ff51b 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 _0x8a6c=['STRING','sequelize','exports','name','INTEGER'];(function(_0x2a12e1,_0x17ba71){var _0x5723c1=function(_0x102e73){while(--_0x102e73){_0x2a12e1['push'](_0x2a12e1['shift']());}};_0x5723c1(++_0x17ba71);}(_0x8a6c,0x6f));var _0xc8a6=function(_0x3e1c59,_0x4eff25){_0x3e1c59=_0x3e1c59-0x0;var _0x42e558=_0x8a6c[_0x3e1c59];return _0x42e558;};'use strict';var Sequelize=require(_0xc8a6('0x0'));module[_0xc8a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc8a6('0x2')},'OrderBy':{'type':Sequelize[_0xc8a6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc8a6('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x0e83=['STRING','name','INTEGER','sequelize','exports'];(function(_0x106ee3,_0x3c221b){var _0x26d614=function(_0x443767){while(--_0x443767){_0x106ee3['push'](_0x106ee3['shift']());}};_0x26d614(++_0x3c221b);}(_0x0e83,0xad));var _0x30e8=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x0e83[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0x30e8('0x0'));module[_0x30e8('0x1')]={'name':{'type':Sequelize[_0x30e8('0x2')],'allowNull':![],'unique':_0x30e8('0x3')},'OrderBy':{'type':Sequelize[_0x30e8('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x30e8('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4eae219..737b4db 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 _0xfff0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1b8a1d,_0x40c7dc){var _0x39ad6b=function(_0x1e3456){while(--_0x1e3456){_0x1b8a1d['push'](_0x1b8a1d['shift']());}};_0x39ad6b(++_0x40c7dc);}(_0xfff0,0x139));var _0x0fff=function(_0x4e4a4c,_0x2ba475){_0x4e4a4c=_0x4e4a4c-0x0;var _0x10ad62=_0xfff0[_0x4e4a4c];return _0x10ad62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x24cd18=_0x6a116c[_0x0fff('0x28')]({'plain':!![]});var _0x23d9f8='ContactItemTypes';return db[_0x0fff('0x29')][_0x0fff('0x27')]({'where':{'type':_0x23d9f8,'resourceId':_0x24cd18['id']}})[_0x0fff('0x26')](function(){return _0x6a116c;});})[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x27bd76,_0x3e6fef){return function(_0x44e54a){if(!_0x44e54a){_0x27bd76[_0x0fff('0x2a')](0x194);}return _0x44e54a;};}function handleError(_0x40651c,_0x2c39e3){_0x2c39e3=_0x2c39e3||0x1f4;return function(_0x495734){logger[_0x0fff('0x2b')](_0x495734[_0x0fff('0x2c')]);if(_0x495734[_0x0fff('0x2d')]){delete _0x495734[_0x0fff('0x2d')];}_0x40651c[_0x0fff('0x19')](_0x2c39e3)[_0x0fff('0x2e')](_0x495734);};}exports['index']=function(_0x31f9a4,_0xa16c29){var _0x351102={},_0x48f1d1={},_0x1016fa={'count':0x0,'rows':[]};var _0x3fa6fc=_['map'](db[_0x0fff('0x2f')][_0x0fff('0x30')],function(_0x15bb46){return{'name':_0x15bb46[_0x0fff('0x31')],'type':_0x15bb46[_0x0fff('0x32')][_0x0fff('0x33')]};});_0x48f1d1[_0x0fff('0x34')]=_[_0x0fff('0x35')](_0x3fa6fc,_0x0fff('0x2d'));_0x48f1d1[_0x0fff('0x36')]=_['keys'](_0x31f9a4[_0x0fff('0x36')]);_0x48f1d1[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x48f1d1[_0x0fff('0x34')],_0x48f1d1[_0x0fff('0x36')]);_0x351102['attributes']=_['intersection'](_0x48f1d1[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x39')]));_0x351102['attributes']=_0x351102[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x351102[_0x0fff('0x3a')]:_0x48f1d1[_0x0fff('0x34')];if(!_0x31f9a4['query'][_0x0fff('0x3c')](_0x0fff('0x3d'))){_0x351102[_0x0fff('0x1d')]=qs[_0x0fff('0x1d')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1d')]);_0x351102[_0x0fff('0x1c')]=qs[_0x0fff('0x1c')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1c')]);}_0x351102[_0x0fff('0x3e')]=qs[_0x0fff('0x3f')](_0x31f9a4['query'][_0x0fff('0x3f')]);_0x351102[_0x0fff('0x40')]=qs[_0x0fff('0x37')](_[_0x0fff('0x41')](_0x31f9a4[_0x0fff('0x36')],_0x48f1d1[_0x0fff('0x37')]),_0x3fa6fc);if(_0x31f9a4['query'][_0x0fff('0x42')]){_0x351102[_0x0fff('0x40')]=_[_0x0fff('0x43')](_0x351102[_0x0fff('0x40')],{'$or':_[_0x0fff('0x35')](_0x3fa6fc,function(_0x101151){if(_0x101151[_0x0fff('0x32')]!==_0x0fff('0x44')){var _0x28e0aa={};_0x28e0aa[_0x101151['name']]={'$like':'%'+_0x31f9a4[_0x0fff('0x36')]['filter']+'%'};return _0x28e0aa;}})});}_0x351102=_[_0x0fff('0x43')]({},_0x351102,_0x31f9a4[_0x0fff('0x45')]);var _0x126f6a={'where':_0x351102['where']};return db['ContactItemType'][_0x0fff('0x1f')](_0x126f6a)[_0x0fff('0x26')](function(_0x311348){_0x1016fa['count']=_0x311348;if(_0x31f9a4['query'][_0x0fff('0x46')]){_0x351102['include']=[{'all':!![]}];}return db[_0x0fff('0x2f')][_0x0fff('0x47')](_0x351102);})[_0x0fff('0x26')](function(_0x309d75){_0x1016fa[_0x0fff('0x48')]=_0x309d75;return _0x1016fa;})[_0x0fff('0x26')](respondWithFilteredResult(_0xa16c29,_0x351102))['catch'](handleError(_0xa16c29,null));};exports[_0x0fff('0x49')]=function(_0x39b829,_0x2a8c5e){var _0x41b4d5={'raw':!![],'where':{'id':_0x39b829[_0x0fff('0x4a')]['id']}},_0x7157e5={};_0x7157e5[_0x0fff('0x34')]=_['keys'](db[_0x0fff('0x2f')][_0x0fff('0x30')]);_0x7157e5[_0x0fff('0x36')]=_['keys'](_0x39b829[_0x0fff('0x36')]);_0x7157e5[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],_0x7157e5[_0x0fff('0x36')]);_0x41b4d5[_0x0fff('0x3a')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x39b829[_0x0fff('0x36')][_0x0fff('0x39')]));_0x41b4d5['attributes']=_0x41b4d5[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x41b4d5['attributes']:_0x7157e5[_0x0fff('0x34')];if(_0x39b829[_0x0fff('0x36')][_0x0fff('0x46')]){_0x41b4d5['include']=[{'all':!![]}];}_0x41b4d5=_['merge']({},_0x41b4d5,_0x39b829[_0x0fff('0x45')]);return db['ContactItemType']['find'](_0x41b4d5)[_0x0fff('0x26')](handleEntityNotFound(_0x2a8c5e,null))[_0x0fff('0x26')](respondWithResult(_0x2a8c5e,null))[_0x0fff('0x4b')](handleError(_0x2a8c5e,null));};exports[_0x0fff('0x4c')]=function(_0x3b4b8e,_0x1a7677){return db['ContactItemType'][_0x0fff('0x4c')](_0x3b4b8e[_0x0fff('0x4d')],{})[_0x0fff('0x26')](function(_0x32568a){var _0x30c4d6=_0x3b4b8e[_0x0fff('0x4e')]['get']({'plain':!![]});if(!_0x30c4d6)throw new Error(_0x0fff('0x4f'));if(_0x30c4d6[_0x0fff('0x50')]==='user'){var _0x1fc872=_0x32568a['get']({'plain':!![]});var _0x5f1943='ContactItemTypes';return db[_0x0fff('0x51')][_0x0fff('0x52')]({'where':{'name':_0x5f1943,'userProfileId':_0x30c4d6[_0x0fff('0x53')]},'raw':!![]})[_0x0fff('0x26')](function(_0x579291){if(_0x579291&&_0x579291['autoAssociation']===0x0){return db[_0x0fff('0x29')][_0x0fff('0x4c')]({'name':_0x1fc872[_0x0fff('0x2d')],'resourceId':_0x1fc872['id'],'type':_0x579291[_0x0fff('0x2d')],'sectionId':_0x579291['id']},{})[_0x0fff('0x26')](function(){return _0x32568a;});}else{return _0x32568a;}})['catch'](function(_0x3b401c){logger[_0x0fff('0x2b')](_0x0fff('0x54'),_0x3b401c);throw _0x3b401c;});}return _0x32568a;})[_0x0fff('0x26')](respondWithResult(_0x1a7677,0xc9))[_0x0fff('0x4b')](handleError(_0x1a7677,null));};exports[_0x0fff('0x25')]=function(_0x1af59f,_0x236da3){if(_0x1af59f[_0x0fff('0x4d')]['id']){delete _0x1af59f[_0x0fff('0x4d')]['id'];}return db[_0x0fff('0x2f')][_0x0fff('0x52')]({'where':{'id':_0x1af59f[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x236da3,null))[_0x0fff('0x26')](saveUpdates(_0x1af59f[_0x0fff('0x4d')],null))[_0x0fff('0x26')](respondWithResult(_0x236da3,null))[_0x0fff('0x4b')](handleError(_0x236da3,null));};exports[_0x0fff('0x27')]=function(_0x398513,_0x18c853){return db['ContactItemType'][_0x0fff('0x52')]({'where':{'id':_0x398513[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x18c853,null))[_0x0fff('0x26')](db['CmContactHasItem'][_0x0fff('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x398513['params']['id']}}))[_0x0fff('0x26')](removeEntity(_0x18c853,null))[_0x0fff('0x4b')](handleError(_0x18c853,null));}; \ No newline at end of file +var _0x66fa=['map','ContactItemType','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','catch','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name'];(function(_0x166feb,_0x1dd207){var _0x468e02=function(_0x1a2ec3){while(--_0x1a2ec3){_0x166feb['push'](_0x166feb['shift']());}};_0x468e02(++_0x1dd207);}(_0x66fa,0x117));var _0xa66f=function(_0x87733d,_0xca91a5){_0x87733d=_0x87733d-0x0;var _0x3809f3=_0x66fa[_0x87733d];return _0x3809f3;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){var _0x502e21=_0x473822['get']({'plain':!![]});var _0xed98b9='ContactItemTypes';return db[_0xa66f('0x24')][_0xa66f('0x23')]({'where':{'type':_0xed98b9,'resourceId':_0x502e21['id']}})[_0xa66f('0x22')](function(){return _0x473822;});})['then'](function(){_0x5cbd82[_0xa66f('0x16')](0xcc)[_0xa66f('0x15')]();});}};}function handleEntityNotFound(_0x13495f,_0x238eb2){return function(_0x17c103){if(!_0x17c103){_0x13495f[_0xa66f('0x25')](0x194);}return _0x17c103;};}function handleError(_0x1eb86a,_0xea2c89){_0xea2c89=_0xea2c89||0x1f4;return function(_0x20ee67){logger[_0xa66f('0x26')](_0x20ee67[_0xa66f('0x27')]);if(_0x20ee67[_0xa66f('0x28')]){delete _0x20ee67[_0xa66f('0x28')];}_0x1eb86a[_0xa66f('0x16')](_0xea2c89)['send'](_0x20ee67);};}exports['index']=function(_0x38daac,_0x27ceae){var _0x55f309={},_0x44c79a={},_0x2de5f3={'count':0x0,'rows':[]};var _0x4cd7f2=_[_0xa66f('0x29')](db[_0xa66f('0x2a')][_0xa66f('0x2b')],function(_0x2c2ace){return{'name':_0x2c2ace[_0xa66f('0x2c')],'type':_0x2c2ace['type'][_0xa66f('0x2d')]};});_0x44c79a['model']=_[_0xa66f('0x29')](_0x4cd7f2,_0xa66f('0x28'));_0x44c79a[_0xa66f('0x2e')]=_['keys'](_0x38daac[_0xa66f('0x2e')]);_0x44c79a[_0xa66f('0x2f')]=_['intersection'](_0x44c79a[_0xa66f('0x30')],_0x44c79a[_0xa66f('0x2e')]);_0x55f309[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x44c79a[_0xa66f('0x30')],qs[_0xa66f('0x33')](_0x38daac[_0xa66f('0x2e')][_0xa66f('0x33')]));_0x55f309[_0xa66f('0x31')]=_0x55f309[_0xa66f('0x31')]['length']?_0x55f309[_0xa66f('0x31')]:_0x44c79a['model'];if(!_0x38daac[_0xa66f('0x2e')][_0xa66f('0x34')](_0xa66f('0x35'))){_0x55f309[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x38daac[_0xa66f('0x2e')][_0xa66f('0x19')]);_0x55f309[_0xa66f('0x1b')]=qs['offset'](_0x38daac[_0xa66f('0x2e')]['offset']);}_0x55f309[_0xa66f('0x36')]=qs[_0xa66f('0x37')](_0x38daac[_0xa66f('0x2e')]['sort']);_0x55f309['where']=qs[_0xa66f('0x2f')](_[_0xa66f('0x38')](_0x38daac[_0xa66f('0x2e')],_0x44c79a[_0xa66f('0x2f')]),_0x4cd7f2);if(_0x38daac[_0xa66f('0x2e')]['filter']){_0x55f309['where']=_['merge'](_0x55f309[_0xa66f('0x39')],{'$or':_['map'](_0x4cd7f2,function(_0x4d2d27){if(_0x4d2d27['type']!==_0xa66f('0x3a')){var _0x5051b2={};_0x5051b2[_0x4d2d27[_0xa66f('0x28')]]={'$like':'%'+_0x38daac[_0xa66f('0x2e')][_0xa66f('0x3b')]+'%'};return _0x5051b2;}})});}_0x55f309=_[_0xa66f('0x3c')]({},_0x55f309,_0x38daac[_0xa66f('0x3d')]);var _0x360e61={'where':_0x55f309[_0xa66f('0x39')]};return db[_0xa66f('0x2a')][_0xa66f('0x1a')](_0x360e61)[_0xa66f('0x22')](function(_0x3a7929){_0x2de5f3[_0xa66f('0x1a')]=_0x3a7929;if(_0x38daac[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x55f309['include']=[{'all':!![]}];}return db[_0xa66f('0x2a')][_0xa66f('0x3f')](_0x55f309);})['then'](function(_0x248587){_0x2de5f3['rows']=_0x248587;return _0x2de5f3;})[_0xa66f('0x22')](respondWithFilteredResult(_0x27ceae,_0x55f309))[_0xa66f('0x40')](handleError(_0x27ceae,null));};exports['show']=function(_0x1ddd2f,_0xa42041){var _0x2126e8={'raw':!![],'where':{'id':_0x1ddd2f[_0xa66f('0x41')]['id']}},_0x5276ea={};_0x5276ea['model']=_[_0xa66f('0x42')](db[_0xa66f('0x2a')][_0xa66f('0x2b')]);_0x5276ea[_0xa66f('0x2e')]=_[_0xa66f('0x42')](_0x1ddd2f[_0xa66f('0x2e')]);_0x5276ea[_0xa66f('0x2f')]=_['intersection'](_0x5276ea[_0xa66f('0x30')],_0x5276ea[_0xa66f('0x2e')]);_0x2126e8[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x5276ea[_0xa66f('0x30')],qs['fields'](_0x1ddd2f['query'][_0xa66f('0x33')]));_0x2126e8[_0xa66f('0x31')]=_0x2126e8[_0xa66f('0x31')][_0xa66f('0x43')]?_0x2126e8[_0xa66f('0x31')]:_0x5276ea[_0xa66f('0x30')];if(_0x1ddd2f['query'][_0xa66f('0x3e')]){_0x2126e8[_0xa66f('0x44')]=[{'all':!![]}];}_0x2126e8=_[_0xa66f('0x3c')]({},_0x2126e8,_0x1ddd2f['options']);return db['ContactItemType'][_0xa66f('0x45')](_0x2126e8)[_0xa66f('0x22')](handleEntityNotFound(_0xa42041,null))[_0xa66f('0x22')](respondWithResult(_0xa42041,null))['catch'](handleError(_0xa42041,null));};exports['create']=function(_0x52054e,_0x19e7ce){return db[_0xa66f('0x2a')][_0xa66f('0x46')](_0x52054e[_0xa66f('0x47')],{})[_0xa66f('0x22')](function(_0x3edf84){var _0x164242=_0x52054e[_0xa66f('0x48')]['get']({'plain':!![]});if(!_0x164242)throw new Error(_0xa66f('0x49'));if(_0x164242[_0xa66f('0x4a')]===_0xa66f('0x48')){var _0x393755=_0x3edf84[_0xa66f('0x4b')]({'plain':!![]});var _0x33cdc7='ContactItemTypes';return db[_0xa66f('0x4c')][_0xa66f('0x45')]({'where':{'name':_0x33cdc7,'userProfileId':_0x164242[_0xa66f('0x4d')]},'raw':!![]})[_0xa66f('0x22')](function(_0x20d6be){if(_0x20d6be&&_0x20d6be['autoAssociation']===0x0){return db[_0xa66f('0x24')]['create']({'name':_0x393755[_0xa66f('0x28')],'resourceId':_0x393755['id'],'type':_0x20d6be['name'],'sectionId':_0x20d6be['id']},{})['then'](function(){return _0x3edf84;});}else{return _0x3edf84;}})[_0xa66f('0x40')](function(_0x31233b){logger[_0xa66f('0x26')](_0xa66f('0x4e'),_0x31233b);throw _0x31233b;});}return _0x3edf84;})[_0xa66f('0x22')](respondWithResult(_0x19e7ce,0xc9))[_0xa66f('0x40')](handleError(_0x19e7ce,null));};exports['update']=function(_0x30ea28,_0x13822b){if(_0x30ea28[_0xa66f('0x47')]['id']){delete _0x30ea28[_0xa66f('0x47')]['id'];}return db['ContactItemType'][_0xa66f('0x45')]({'where':{'id':_0x30ea28['params']['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x13822b,null))[_0xa66f('0x22')](saveUpdates(_0x30ea28[_0xa66f('0x47')],null))[_0xa66f('0x22')](respondWithResult(_0x13822b,null))[_0xa66f('0x40')](handleError(_0x13822b,null));};exports[_0xa66f('0x23')]=function(_0x44ea10,_0x56b860){return db[_0xa66f('0x2a')][_0xa66f('0x45')]({'where':{'id':_0x44ea10[_0xa66f('0x41')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x56b860,null))[_0xa66f('0x22')](db[_0xa66f('0x4f')][_0xa66f('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x44ea10[_0xa66f('0x41')]['id']}}))[_0xa66f('0x22')](removeEntity(_0x56b860,null))['catch'](handleError(_0x56b860,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2ead3d0..b9fbd06 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 _0x2355=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','api'];(function(_0x31ea28,_0x2aae30){var _0x43f03d=function(_0x3241b0){while(--_0x3241b0){_0x31ea28['push'](_0x31ea28['shift']());}};_0x43f03d(++_0x2aae30);}(_0x2355,0x99));var _0x5235=function(_0x3d4983,_0x3abe3c){_0x3d4983=_0x3d4983-0x0;var _0x5077d6=_0x2355[_0x3d4983];return _0x5077d6;};'use strict';var _=require(_0x5235('0x0'));var util=require(_0x5235('0x1'));var logger=require('../../config/logger')(_0x5235('0x2'));var moment=require(_0x5235('0x3'));var BPromise=require(_0x5235('0x4'));var rp=require(_0x5235('0x5'));var fs=require('fs');var path=require(_0x5235('0x6'));var rimraf=require(_0x5235('0x7'));var config=require(_0x5235('0x8'));var attributes=require(_0x5235('0x9'));module[_0x5235('0xa')]=function(_0x3135eb,_0x11b707){return _0x3135eb['define'](_0x5235('0xb'),attributes,{'tableName':_0x5235('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf192=['ContactItemType','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./contactItemType.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf192,0xdd));var _0x2f19=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xf192[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x2f19('0x0'));var util=require(_0x2f19('0x1'));var logger=require(_0x2f19('0x2'))(_0x2f19('0x3'));var moment=require(_0x2f19('0x4'));var BPromise=require(_0x2f19('0x5'));var rp=require(_0x2f19('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f19('0x7'));var attributes=require(_0x2f19('0x8'));module[_0x2f19('0x9')]=function(_0x110657,_0x7b2f5e){return _0x110657['define'](_0x2f19('0xa'),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 47ecc7b..0030b57 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 _0x79ea=['request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0x79ea,0xbb));var _0xa79e=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0x79ea[_0x451735];return _0x41d1e2;};'use strict';var _=require(_0xa79e('0x0'));var util=require(_0xa79e('0x1'));var moment=require(_0xa79e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa79e('0x3'));var fs=require('fs');var Redis=require(_0xa79e('0x4'));var db=require(_0xa79e('0x5'))['db'];var utils=require(_0xa79e('0x6'));var logger=require(_0xa79e('0x7'))(_0xa79e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa79e('0x9')][_0xa79e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b017f,_0x197777,_0x6cc776){return new BPromise(function(_0xa88b0d,_0xb12a75){return client[_0xa79e('0xb')](_0x6b017f,_0x6cc776)[_0xa79e('0xc')](function(_0x59eb79){logger['info'](_0xa79e('0xd'),_0x197777,_0xa79e('0xe'));logger['debug'](_0xa79e('0xf'),_0x197777,_0xa79e('0xe'),JSON['stringify'](_0x59eb79));if(_0x59eb79[_0xa79e('0x10')]){if(_0x59eb79[_0xa79e('0x10')][_0xa79e('0x11')]===0x1f4){logger['error'](_0xa79e('0xd'),_0x197777,_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);return _0xb12a75(_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);}logger[_0xa79e('0x10')]('ContactItemType,\x20%s,\x20%s',_0x197777,_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);return _0xa88b0d(_0x59eb79[_0xa79e('0x10')][_0xa79e('0x12')]);}else{logger[_0xa79e('0x13')](_0xa79e('0xd'),_0x197777,_0xa79e('0xe'));_0xa88b0d(_0x59eb79[_0xa79e('0x14')]['message']);}})[_0xa79e('0x15')](function(_0x2c7bee){logger[_0xa79e('0x10')]('ContactItemType,\x20%s,\x20%s',_0x197777,_0x2c7bee);_0xb12a75(_0x2c7bee);});});} \ No newline at end of file +var _0xfcef=['code','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcef,0x74));var _0xffce=function(_0x5bf929,_0x257a8e){_0x5bf929=_0x5bf929-0x0;var _0x22d69a=_0xfcef[_0x5bf929];return _0x22d69a;};'use strict';var _=require(_0xffce('0x0'));var util=require(_0xffce('0x1'));var moment=require(_0xffce('0x2'));var BPromise=require('bluebird');var rs=require(_0xffce('0x3'));var fs=require('fs');var Redis=require(_0xffce('0x4'));var db=require(_0xffce('0x5'))['db'];var utils=require(_0xffce('0x6'));var logger=require(_0xffce('0x7'))(_0xffce('0x8'));var config=require(_0xffce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xffce('0xa')][_0xffce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x339c0d,_0x4e9b06,_0x10364c){return new BPromise(function(_0x1eb45f,_0xe69949){return client['request'](_0x339c0d,_0x10364c)['then'](function(_0x26a4fa){logger[_0xffce('0xc')](_0xffce('0xd'),_0x4e9b06,_0xffce('0xe'));logger['debug'](_0xffce('0xf'),_0x4e9b06,'request\x20sent',JSON['stringify'](_0x26a4fa));if(_0x26a4fa['error']){if(_0x26a4fa[_0xffce('0x10')][_0xffce('0x11')]===0x1f4){logger[_0xffce('0x10')]('ContactItemType,\x20%s,\x20%s',_0x4e9b06,_0x26a4fa[_0xffce('0x10')]['message']);return _0xe69949(_0x26a4fa['error']['message']);}logger[_0xffce('0x10')](_0xffce('0xd'),_0x4e9b06,_0x26a4fa[_0xffce('0x10')]['message']);return _0x1eb45f(_0x26a4fa[_0xffce('0x10')]['message']);}else{logger[_0xffce('0xc')](_0xffce('0xd'),_0x4e9b06,_0xffce('0xe'));_0x1eb45f(_0x26a4fa[_0xffce('0x12')]['message']);}})['catch'](function(_0x51c28b){logger[_0xffce('0x10')]('ContactItemType,\x20%s,\x20%s',_0x4e9b06,_0x51c28b);_0xe69949(_0x51c28b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7b19ee2..2a8de00 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 _0x3f20=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f20,0x1a4));var _0x03f2=function(_0x3cb789,_0x51fbf1){_0x3cb789=_0x3cb789-0x0;var _0x6aa6f=_0x3f20[_0x3cb789];return _0x6aa6f;};'use strict';var multer=require(_0x03f2('0x0'));var util=require(_0x03f2('0x1'));var path=require(_0x03f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x03f2('0x3'));var router=express[_0x03f2('0x4')]();var fs_extra=require(_0x03f2('0x5'));var auth=require(_0x03f2('0x6'));var interaction=require(_0x03f2('0x7'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router['get']('/',auth[_0x03f2('0x8')](),controller['index']);router[_0x03f2('0x9')](_0x03f2('0xa'),auth[_0x03f2('0x8')](),controller[_0x03f2('0xb')]);router[_0x03f2('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x03f2('0xd')]('/:id',auth[_0x03f2('0x8')](),controller[_0x03f2('0xe')]);router[_0x03f2('0xf')](_0x03f2('0xa'),auth[_0x03f2('0x8')](),controller[_0x03f2('0x10')]);module[_0x03f2('0x11')]=router; \ No newline at end of file +var _0x2740=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2740,0xe9));var _0x0274=function(_0x2c9f69,_0x594071){_0x2c9f69=_0x2c9f69-0x0;var _0x245eb6=_0x2740[_0x2c9f69];return _0x245eb6;};'use strict';var multer=require(_0x0274('0x0'));var util=require(_0x0274('0x1'));var path=require(_0x0274('0x2'));var timeout=require(_0x0274('0x3'));var express=require(_0x0274('0x4'));var router=express[_0x0274('0x5')]();var fs_extra=require(_0x0274('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0274('0x7'));var config=require(_0x0274('0x8'));var controller=require(_0x0274('0x9'));router[_0x0274('0xa')]('/',auth[_0x0274('0xb')](),controller[_0x0274('0xc')]);router[_0x0274('0xa')](_0x0274('0xd'),auth[_0x0274('0xb')](),controller[_0x0274('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0274('0xf')]);router[_0x0274('0x10')](_0x0274('0xd'),auth[_0x0274('0xb')](),controller['update']);router[_0x0274('0x11')]('/:id',auth[_0x0274('0xb')](),controller[_0x0274('0x12')]);module[_0x0274('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9039b8f..47de425 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 _0xb10b=['name','sequelize','STRING'];(function(_0x2300be,_0x63e837){var _0x27c6b8=function(_0x16d53b){while(--_0x16d53b){_0x2300be['push'](_0x2300be['shift']());}};_0x27c6b8(++_0x63e837);}(_0xb10b,0x12a));var _0xbb10=function(_0x372ee1,_0x45c637){_0x372ee1=_0x372ee1-0x0;var _0x31ea06=_0xb10b[_0x372ee1];return _0x31ea06;};'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 +var _0xd8b0=['exports','sequelize'];(function(_0x5334bc,_0x3c146b){var _0x4d0abf=function(_0x468ee7){while(--_0x468ee7){_0x5334bc['push'](_0x5334bc['shift']());}};_0x4d0abf(++_0x3c146b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e072f28..ad172d0 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 _0x4151=['redis','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','Dashboard','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','createdAt','updatedAt','omit','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4151,0xe8));var _0x1415=function(_0x5a07a2,_0x32f99c){_0x5a07a2=_0x5a07a2-0x0;var _0x2238fe=_0x4151[_0x5a07a2];return _0x2238fe;};'use strict';var emlformat=require(_0x1415('0x0'));var rimraf=require(_0x1415('0x1'));var zipdir=require(_0x1415('0x2'));var jsonpatch=require(_0x1415('0x3'));var rp=require(_0x1415('0x4'));var moment=require(_0x1415('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1415('0x6'));var sox=require(_0x1415('0x7'));var csv=require(_0x1415('0x8'));var ejs=require(_0x1415('0x9'));var fs=require('fs');var fs_extra=require(_0x1415('0xa'));var _=require(_0x1415('0xb'));var squel=require(_0x1415('0xc'));var crypto=require(_0x1415('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1415('0xe'));var toCsv=require(_0x1415('0x8'));var querystring=require(_0x1415('0xf'));var Papa=require(_0x1415('0x10'));var Redis=require(_0x1415('0x11'));var authService=require(_0x1415('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1415('0x13'));var logger=require(_0x1415('0x14'))('api');var utils=require(_0x1415('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1415('0x16'));var db=require(_0x1415('0x17'))['db'];config['redis']=_['defaults'](config[_0x1415('0x18')],{'host':_0x1415('0x19'),'port':0x18eb});var socket=require(_0x1415('0x1a'))(new Redis(config['redis']));require(_0x1415('0x1b'))[_0x1415('0x1c')](socket);function respondWithStatusCode(_0x1b06fe,_0x502364){_0x502364=_0x502364||0xcc;return function(_0x26ccea){if(_0x26ccea){return _0x1b06fe['sendStatus'](_0x502364);}return _0x1b06fe['status'](_0x502364)[_0x1415('0x1d')]();};}function respondWithResult(_0x5c252b,_0x46ce06){_0x46ce06=_0x46ce06||0xc8;return function(_0x3df99d){if(_0x3df99d){return _0x5c252b[_0x1415('0x1e')](_0x46ce06)[_0x1415('0x1f')](_0x3df99d);}};}function respondWithFilteredResult(_0x4123c7,_0xa1d210){return function(_0x187c96){if(_0x187c96){var _0x110483=typeof _0xa1d210[_0x1415('0x20')]===_0x1415('0x21')&&typeof _0xa1d210['limit']===_0x1415('0x21');var _0x3b5bd9=_0x187c96[_0x1415('0x22')];var _0x225e46=_0x110483?0x0:_0xa1d210[_0x1415('0x20')];var _0x10b202=_0x110483?_0x187c96[_0x1415('0x22')]:_0xa1d210[_0x1415('0x20')]+_0xa1d210[_0x1415('0x23')];var _0x373968;if(_0x10b202>=_0x3b5bd9){_0x10b202=_0x3b5bd9;_0x373968=0xc8;}else{_0x373968=0xce;}_0x4123c7[_0x1415('0x1e')](_0x373968);return _0x4123c7[_0x1415('0x24')](_0x1415('0x25'),_0x225e46+'-'+_0x10b202+'/'+_0x3b5bd9)['json'](_0x187c96);}return null;};}function patchUpdates(_0x57d0ea){return function(_0x1273a6){try{jsonpatch['apply'](_0x1273a6,_0x57d0ea,!![]);}catch(_0xe57652){return BPromise[_0x1415('0x26')](_0xe57652);}return _0x1273a6[_0x1415('0x27')]();};}function saveUpdates(_0x30a352,_0x3c3931){return function(_0x4a3617){if(_0x4a3617){return _0x4a3617[_0x1415('0x28')](_0x30a352)[_0x1415('0x29')](function(_0x49bacd){return _0x49bacd;});}return null;};}function removeEntity(_0x507dcc,_0x108b78){return function(_0x3b4e4b){if(_0x3b4e4b){return _0x3b4e4b[_0x1415('0x2a')]()[_0x1415('0x29')](function(){var _0x1274b9=_0x3b4e4b['get']({'plain':!![]});var _0x3e3f06=_0x1415('0x2b');return db[_0x1415('0x2c')]['destroy']({'where':{'type':_0x3e3f06,'resourceId':_0x1274b9['id']}})['then'](function(){return _0x3b4e4b;});})[_0x1415('0x29')](function(){_0x507dcc[_0x1415('0x1e')](0xcc)[_0x1415('0x1d')]();});}};}function handleEntityNotFound(_0x35dbfd,_0x349b07){return function(_0x2f5c26){if(!_0x2f5c26){_0x35dbfd[_0x1415('0x2d')](0x194);}return _0x2f5c26;};}function handleError(_0x219998,_0x18aeb3){_0x18aeb3=_0x18aeb3||0x1f4;return function(_0xe45d8e){logger[_0x1415('0x2e')](_0xe45d8e[_0x1415('0x2f')]);if(_0xe45d8e[_0x1415('0x30')]){delete _0xe45d8e[_0x1415('0x30')];}_0x219998[_0x1415('0x1e')](_0x18aeb3)[_0x1415('0x31')](_0xe45d8e);};}exports[_0x1415('0x32')]=function(_0x3d66e9,_0x393a8b){var _0x445d83={},_0x5c5105={},_0x391fda={'count':0x0,'rows':[]};var _0x155301=_['map'](db[_0x1415('0x33')][_0x1415('0x34')],function(_0x428e23){return{'name':_0x428e23['fieldName'],'type':_0x428e23[_0x1415('0x35')]['key']};});_0x5c5105[_0x1415('0x36')]=_[_0x1415('0x37')](_0x155301,_0x1415('0x30'));_0x5c5105['query']=_['keys'](_0x3d66e9[_0x1415('0x38')]);_0x5c5105[_0x1415('0x39')]=_[_0x1415('0x3a')](_0x5c5105[_0x1415('0x36')],_0x5c5105[_0x1415('0x38')]);_0x445d83[_0x1415('0x3b')]=_[_0x1415('0x3a')](_0x5c5105[_0x1415('0x36')],qs[_0x1415('0x3c')](_0x3d66e9[_0x1415('0x38')][_0x1415('0x3c')]));_0x445d83[_0x1415('0x3b')]=_0x445d83[_0x1415('0x3b')][_0x1415('0x3d')]?_0x445d83[_0x1415('0x3b')]:_0x5c5105['model'];if(!_0x3d66e9[_0x1415('0x38')]['hasOwnProperty']('nolimit')){_0x445d83[_0x1415('0x23')]=qs['limit'](_0x3d66e9[_0x1415('0x38')]['limit']);_0x445d83[_0x1415('0x20')]=qs[_0x1415('0x20')](_0x3d66e9['query'][_0x1415('0x20')]);}_0x445d83[_0x1415('0x3e')]=qs['sort'](_0x3d66e9['query'][_0x1415('0x3f')]);_0x445d83['where']=qs[_0x1415('0x39')](_[_0x1415('0x40')](_0x3d66e9[_0x1415('0x38')],_0x5c5105[_0x1415('0x39')]),_0x155301);if(_0x3d66e9[_0x1415('0x38')]['filter']){_0x445d83[_0x1415('0x41')]=_[_0x1415('0x42')](_0x445d83['where'],{'$or':_[_0x1415('0x37')](_0x155301,function(_0x70f8fe){if(_0x70f8fe['type']!=='VIRTUAL'){var _0x21b6b0={};_0x21b6b0[_0x70f8fe[_0x1415('0x30')]]={'$like':'%'+_0x3d66e9['query'][_0x1415('0x43')]+'%'};return _0x21b6b0;}})});}_0x445d83=_[_0x1415('0x42')]({},_0x445d83,_0x3d66e9[_0x1415('0x44')]);var _0x5345ba={'where':_0x445d83[_0x1415('0x41')]};return db[_0x1415('0x33')]['count'](_0x5345ba)[_0x1415('0x29')](function(_0x416035){_0x391fda[_0x1415('0x22')]=_0x416035;if(_0x3d66e9[_0x1415('0x38')][_0x1415('0x45')]){_0x445d83['include']=[{'all':!![]}];}return db[_0x1415('0x33')][_0x1415('0x46')](_0x445d83);})[_0x1415('0x29')](function(_0x2de498){_0x391fda[_0x1415('0x47')]=_0x2de498;return _0x391fda;})['then'](respondWithFilteredResult(_0x393a8b,_0x445d83))[_0x1415('0x48')](handleError(_0x393a8b,null));};exports[_0x1415('0x49')]=function(_0x12455a,_0x12ed3c){var _0x55d5b4={'raw':![],'where':{'id':_0x12455a['params']['id']}},_0xc18cbc={};_0xc18cbc[_0x1415('0x36')]=_[_0x1415('0x4a')](db[_0x1415('0x33')][_0x1415('0x34')]);_0xc18cbc[_0x1415('0x38')]=_['keys'](_0x12455a[_0x1415('0x38')]);_0xc18cbc[_0x1415('0x39')]=_[_0x1415('0x3a')](_0xc18cbc['model'],_0xc18cbc['query']);_0x55d5b4[_0x1415('0x3b')]=_[_0x1415('0x3a')](_0xc18cbc[_0x1415('0x36')],qs[_0x1415('0x3c')](_0x12455a[_0x1415('0x38')]['fields']));_0x55d5b4[_0x1415('0x3b')]=_0x55d5b4[_0x1415('0x3b')]['length']?_0x55d5b4[_0x1415('0x3b')]:_0xc18cbc[_0x1415('0x36')];if(_0x12455a[_0x1415('0x38')]['includeAll']){_0x55d5b4['include']=[{'all':!![]}];}_0x55d5b4=_['merge']({},_0x55d5b4,_0x12455a[_0x1415('0x44')]);return db['Dashboard'][_0x1415('0x4b')](_0x55d5b4)[_0x1415('0x29')](handleEntityNotFound(_0x12ed3c,null))[_0x1415('0x29')](respondWithResult(_0x12ed3c,null))[_0x1415('0x48')](handleError(_0x12ed3c,null));};exports[_0x1415('0x4c')]=function(_0x539c11,_0x55b31e){return db['Dashboard']['create'](_0x539c11[_0x1415('0x4d')],{})['then'](function(_0x18ebc9){var _0x15b039=_0x539c11['user'][_0x1415('0x4e')]({'plain':!![]});if(!_0x15b039)throw new Error(_0x1415('0x4f'));if(_0x15b039[_0x1415('0x50')]==='user'){var _0x2d5db5=_0x18ebc9[_0x1415('0x4e')]({'plain':!![]});var _0x4c3c7a=_0x1415('0x2b');return db[_0x1415('0x51')][_0x1415('0x4b')]({'where':{'name':_0x4c3c7a,'userProfileId':_0x15b039[_0x1415('0x52')]},'raw':!![]})[_0x1415('0x29')](function(_0x2ce760){if(_0x2ce760&&_0x2ce760[_0x1415('0x53')]===0x0){return db[_0x1415('0x2c')][_0x1415('0x4c')]({'name':_0x2d5db5['name'],'resourceId':_0x2d5db5['id'],'type':_0x2ce760['name'],'sectionId':_0x2ce760['id']},{})[_0x1415('0x29')](function(){return _0x18ebc9;});}else{return _0x18ebc9;}})[_0x1415('0x48')](function(_0x4026e4){logger['error'](_0x1415('0x54'),_0x4026e4);throw _0x4026e4;});}return _0x18ebc9;})[_0x1415('0x29')](respondWithResult(_0x55b31e,0xc9))['catch'](handleError(_0x55b31e,null));};exports[_0x1415('0x55')]=function(_0x4c48ef,_0x5372d6){var _0x2fcef4={'where':{'id':_0x4c48ef[_0x1415('0x56')]['id']}},_0xb7307e={};_0xb7307e[_0x1415('0x36')]=_[_0x1415('0x4a')](db[_0x1415('0x33')][_0x1415('0x34')]);_0x2fcef4['attributes']=_['intersection'](_0xb7307e['model'],qs['fields'](_0x4c48ef[_0x1415('0x38')][_0x1415('0x3c')]));_0x2fcef4[_0x1415('0x3b')]=_0x2fcef4['attributes'][_0x1415('0x3d')]?_0x2fcef4['attributes']:_0xb7307e[_0x1415('0x36')];if(_0x4c48ef['query'][_0x1415('0x45')]){_0x2fcef4[_0x1415('0x57')]=[{'all':!![]}];}_0x2fcef4=_['merge']({},_0x2fcef4,_0x4c48ef[_0x1415('0x44')]);return db[_0x1415('0x33')]['find'](_0x2fcef4)[_0x1415('0x29')](handleEntityNotFound(_0x5372d6,null))['then'](function(_0x4f93bc){if(_0x4f93bc){var _0xdbafe=_0x4f93bc['get']({'plain':!![]});_0xdbafe=qs['omit'](_0xdbafe,['id',_0x1415('0x58'),_0x1415('0x59')]);_0x4c48ef['body']=_[_0x1415('0x5a')](_0x4c48ef[_0x1415('0x4d')],['id',_0x1415('0x58'),_0x1415('0x59')]);return db[_0x1415('0x33')][_0x1415('0x4c')](_['merge'](_0xdbafe,_0x4c48ef['body']),{'include':_0x4c48ef[_0x1415('0x38')][_0x1415('0x45')]?[{'all':!![]}]:undefined})[_0x1415('0x29')](function(_0xce451a){var _0x223449=_0x4c48ef['user'][_0x1415('0x4e')]({'plain':!![]});if(!_0x223449)throw new Error(_0x1415('0x4f'));if(_0x223449[_0x1415('0x50')]==='user'){var _0x170371=_0xce451a[_0x1415('0x4e')]({'plain':!![]});var _0x509b0a=_0x1415('0x2b');return db[_0x1415('0x51')][_0x1415('0x4b')]({'where':{'name':_0x509b0a,'userProfileId':_0x223449[_0x1415('0x52')]},'raw':!![]})[_0x1415('0x29')](function(_0x38e6a3){if(_0x38e6a3&&_0x38e6a3['autoAssociation']===0x0){return db[_0x1415('0x2c')][_0x1415('0x4c')]({'name':_0x170371[_0x1415('0x30')],'resourceId':_0x170371['id'],'type':_0x38e6a3[_0x1415('0x30')],'sectionId':_0x38e6a3['id']},{})[_0x1415('0x29')](function(){return _0xce451a;});}else{return _0xce451a;}})[_0x1415('0x48')](function(_0x2a9882){logger[_0x1415('0x2e')](_0x1415('0x54'),_0x2a9882);throw _0x2a9882;});}return _0xce451a;});}})['then'](respondWithResult(_0x5372d6,0xc9))[_0x1415('0x48')](handleError(_0x5372d6,null));};exports['update']=function(_0x3f20af,_0x184cf5){if(_0x3f20af[_0x1415('0x4d')]['id']){delete _0x3f20af['body']['id'];}return db[_0x1415('0x33')][_0x1415('0x4b')]({'where':{'id':_0x3f20af['params']['id']}})[_0x1415('0x29')](handleEntityNotFound(_0x184cf5,null))[_0x1415('0x29')](saveUpdates(_0x3f20af['body'],null))['then'](respondWithResult(_0x184cf5,null))['catch'](handleError(_0x184cf5,null));};exports[_0x1415('0x2a')]=function(_0x42bc13,_0x57f570){return db[_0x1415('0x33')]['find']({'where':{'id':_0x42bc13[_0x1415('0x56')]['id']}})[_0x1415('0x29')](handleEntityNotFound(_0x57f570,null))['then'](removeEntity(_0x57f570,null))['catch'](handleError(_0x57f570,null));};function widgetAttributes(_0x5d0572){try{switch(_0x5d0572[_0x1415('0x35')]){case'iframe':return[{'name':_0x1415('0x5b'),'value':_0x5d0572[_0x1415('0x5b')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0]['value']:undefined)||_0x1415('0x5d')}];case'custom':return[{'name':'attrPath','value':_0x5d0572[_0x1415('0x5e')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||''}];case _0x1415('0x60'):return[{'name':'attrHourFormat','value':_0x5d0572[_0x1415('0x61')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||_0x1415('0x62')},{'name':_0x1415('0x63'),'value':_0x5d0572[_0x1415('0x63')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572[_0x1415('0x5c')][0x1][_0x1415('0x5f')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5d0572[_0x1415('0x64')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x2]?_0x5d0572[_0x1415('0x5c')][0x2][_0x1415('0x5f')]:undefined)||0xc}];case _0x1415('0x65'):return[{'name':_0x1415('0x66'),'value':_0x5d0572[_0x1415('0x66')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572['attrs'][0x0][_0x1415('0x5f')]:undefined)||_0x1415('0x67')},{'name':_0x1415('0x68'),'value':_0x5d0572[_0x1415('0x68')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572['attrs'][0x1][_0x1415('0x5f')]:undefined)||[]},{'name':_0x1415('0x64'),'value':_0x5d0572['attrFontSize']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x2]?_0x5d0572[_0x1415('0x5c')][0x2][_0x1415('0x5f')]:undefined)||0x14},{'name':_0x1415('0x69'),'value':_0x5d0572[_0x1415('0x69')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x3]?_0x5d0572[_0x1415('0x5c')][0x3][_0x1415('0x5f')]:undefined)||_0x1415('0x6a')},{'name':_0x1415('0x6b'),'value':_0x5d0572['attrEmailAccounts']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x4]?_0x5d0572[_0x1415('0x5c')][0x4][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6c'),'value':_0x5d0572[_0x1415('0x6c')]||(_0x5d0572['attrs']&&_0x5d0572['attrs'][0x5]?_0x5d0572[_0x1415('0x5c')][0x5][_0x1415('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5d0572[_0x1415('0x6d')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x6]?_0x5d0572[_0x1415('0x5c')][0x6][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6e'),'value':_0x5d0572['attrOpenchannelAccounts']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x7]?_0x5d0572['attrs'][0x7][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6f'),'value':_0x5d0572[_0x1415('0x6f')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x8]?_0x5d0572['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5d0572[_0x1415('0x70')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x9]?_0x5d0572[_0x1415('0x5c')][0x9]['value']:undefined)||''}];case _0x1415('0x71'):case _0x1415('0x72'):return[{'name':_0x1415('0x73'),'value':_0x5d0572[_0x1415('0x73')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||_0x1415('0x67')},{'name':_0x1415('0x74'),'value':_0x5d0572[_0x1415('0x74')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5d0572[_0x1415('0x75')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x2]?_0x5d0572[_0x1415('0x5c')][0x2][_0x1415('0x5f')]:undefined)||null},{'name':_0x1415('0x68'),'value':_0x5d0572[_0x1415('0x68')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x3]?_0x5d0572[_0x1415('0x5c')][0x3][_0x1415('0x5f')]:undefined)||[]},{'name':'attrChannel','value':_0x5d0572[_0x1415('0x69')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x4]?_0x5d0572[_0x1415('0x5c')][0x4][_0x1415('0x5f')]:undefined)||_0x1415('0x6a')},{'name':_0x1415('0x6b'),'value':_0x5d0572[_0x1415('0x6b')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x5]?_0x5d0572[_0x1415('0x5c')][0x5][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6c'),'value':_0x5d0572[_0x1415('0x6c')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x6]?_0x5d0572[_0x1415('0x5c')][0x6][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x6d'),'value':_0x5d0572[_0x1415('0x6d')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x7]?_0x5d0572['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d0572['attrOpenchannelAccounts']||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x8]?_0x5d0572['attrs'][0x8][_0x1415('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d0572['attrWhatsappAccounts']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x9]?_0x5d0572[_0x1415('0x5c')][0x9][_0x1415('0x5f')]:undefined)||''},{'name':_0x1415('0x70'),'value':_0x5d0572['attrChatWebsites']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0xa]?_0x5d0572[_0x1415('0x5c')][0xa]['value']:undefined)||''}];case _0x1415('0x76'):return[{'name':'attrReport','type':_0x5d0572[_0x1415('0x77')]||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572['attrs'][0x0]?_0x5d0572['attrs'][0x0][_0x1415('0x35')]:undefined)||null,'value':_0x5d0572[_0x1415('0x78')]||(_0x5d0572['attrs']&&_0x5d0572[_0x1415('0x5c')][0x0]?_0x5d0572[_0x1415('0x5c')][0x0][_0x1415('0x5f')]:undefined)||null},{'name':_0x1415('0x79'),'value':_0x5d0572['attrRefresh']||(_0x5d0572[_0x1415('0x5c')]&&_0x5d0572[_0x1415('0x5c')][0x1]?_0x5d0572[_0x1415('0x5c')][0x1][_0x1415('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x5605b2){logger[_0x1415('0x2e')](_0x1415('0x7a'),JSON[_0x1415('0x7b')](_0x5605b2));return[];}}exports[_0x1415('0x7c')]=function(_0x672788,_0x37f223,_0x359408){if(_0x672788['body']['id']){delete _0x672788['body']['id'];}return db[_0x1415('0x33')][_0x1415('0x4b')]({'where':{'id':_0x672788[_0x1415('0x56')]['id']}})[_0x1415('0x29')](handleEntityNotFound(_0x37f223,null))[_0x1415('0x29')](function(_0x192aea){if(_0x192aea){_0x672788[_0x1415('0x4d')]['DashboardId']=_0x192aea['id'];_0x672788[_0x1415('0x4d')][_0x1415('0x5c')]=widgetAttributes(_0x672788[_0x1415('0x4d')]);return db[_0x1415('0x7d')][_0x1415('0x4c')](_0x672788['body']);}})[_0x1415('0x29')](respondWithResult(_0x37f223,null))[_0x1415('0x48')](handleError(_0x37f223,null));};exports[_0x1415('0x7e')]=function(_0x158527,_0x1a4dae,_0x4efe4a){var _0x192d8f={};var _0x56ff6d={};var _0x4a10c1;var _0x51bfe4;return db['Dashboard']['findOne']({'where':{'id':_0x158527[_0x1415('0x56')]['id']}})['then'](handleEntityNotFound(_0x1a4dae,null))[_0x1415('0x29')](function(_0x23b0a4){if(_0x23b0a4){_0x4a10c1=_0x23b0a4;_0x56ff6d['model']=_['keys'](db[_0x1415('0x7d')]['rawAttributes']);_0x56ff6d[_0x1415('0x38')]=_['keys'](_0x158527[_0x1415('0x38')]);_0x56ff6d['filters']=_[_0x1415('0x3a')](_0x56ff6d['model'],_0x56ff6d[_0x1415('0x38')]);_0x192d8f[_0x1415('0x3b')]=_[_0x1415('0x3a')](_0x56ff6d[_0x1415('0x36')],qs[_0x1415('0x3c')](_0x158527[_0x1415('0x38')][_0x1415('0x3c')]));_0x192d8f[_0x1415('0x3b')]=_0x192d8f[_0x1415('0x3b')][_0x1415('0x3d')]?_0x192d8f[_0x1415('0x3b')]:_0x56ff6d['model'];_0x192d8f[_0x1415('0x3e')]=qs['sort'](_0x158527[_0x1415('0x38')][_0x1415('0x3f')]);_0x192d8f['where']=qs['filters'](_[_0x1415('0x40')](_0x158527[_0x1415('0x38')],_0x56ff6d['filters']));if(_0x158527[_0x1415('0x38')][_0x1415('0x43')]){_0x192d8f['where']=_[_0x1415('0x42')](_0x192d8f[_0x1415('0x41')],{'$or':_[_0x1415('0x37')](_0x192d8f[_0x1415('0x3b')],function(_0x5b77a5){var _0x1210ab={};_0x1210ab[_0x5b77a5]={'$like':'%'+_0x158527[_0x1415('0x38')]['filter']+'%'};return _0x1210ab;})});}_0x192d8f=_[_0x1415('0x42')]({},_0x192d8f,_0x158527['options']);return _0x4a10c1['getItems'](_0x192d8f);}})['then'](function(_0x38230e){if(_0x38230e){_0x51bfe4=_0x38230e[_0x1415('0x3d')];if(!_0x158527[_0x1415('0x38')]['hasOwnProperty'](_0x1415('0x7f'))){_0x192d8f[_0x1415('0x23')]=qs[_0x1415('0x23')](_0x158527[_0x1415('0x38')][_0x1415('0x23')]);_0x192d8f[_0x1415('0x20')]=qs[_0x1415('0x20')](_0x158527[_0x1415('0x38')][_0x1415('0x20')]);}return _0x4a10c1[_0x1415('0x7e')](_0x192d8f);}})[_0x1415('0x29')](function(_0x351d55){if(_0x351d55){return _0x351d55?{'count':_0x51bfe4,'rows':_0x351d55}:null;}})['then'](respondWithResult(_0x1a4dae,null))[_0x1415('0x48')](handleError(_0x1a4dae,null));}; \ No newline at end of file +var _0xd0be=['attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','DashboardItem','getItems','pick','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','type','options','includeAll','include','rows','show','params','Dashboard','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','UserProfileSection','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','attrTimezone','value','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x399a25,_0x1ae4c2){var _0x58bb4c=function(_0x47639b){while(--_0x47639b){_0x399a25['push'](_0x399a25['shift']());}};_0x58bb4c(++_0x1ae4c2);}(_0xd0be,0x110));var _0xed0b=function(_0x553a8e,_0x22f669){_0x553a8e=_0x553a8e-0x0;var _0x378498=_0xd0be[_0x553a8e];return _0x378498;};'use strict';var emlformat=require(_0xed0b('0x0'));var rimraf=require(_0xed0b('0x1'));var zipdir=require(_0xed0b('0x2'));var jsonpatch=require(_0xed0b('0x3'));var rp=require(_0xed0b('0x4'));var moment=require(_0xed0b('0x5'));var BPromise=require(_0xed0b('0x6'));var Mustache=require(_0xed0b('0x7'));var util=require(_0xed0b('0x8'));var path=require(_0xed0b('0x9'));var sox=require(_0xed0b('0xa'));var csv=require(_0xed0b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed0b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xed0b('0xb'));var querystring=require(_0xed0b('0xe'));var Papa=require(_0xed0b('0xf'));var Redis=require(_0xed0b('0x10'));var authService=require(_0xed0b('0x11'));var qs=require(_0xed0b('0x12'));var as=require(_0xed0b('0x13'));var hardwareService=require(_0xed0b('0x14'));var logger=require(_0xed0b('0x15'))(_0xed0b('0x16'));var utils=require(_0xed0b('0x17'));var config=require(_0xed0b('0x18'));var licenseUtil=require(_0xed0b('0x19'));var db=require(_0xed0b('0x1a'))['db'];config[_0xed0b('0x1b')]=_[_0xed0b('0x1c')](config['redis'],{'host':_0xed0b('0x1d'),'port':0x18eb});var socket=require(_0xed0b('0x1e'))(new Redis(config[_0xed0b('0x1b')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x1aa6e5,_0x1b0954){_0x1b0954=_0x1b0954||0xcc;return function(_0x44f9d0){if(_0x44f9d0){return _0x1aa6e5[_0xed0b('0x1f')](_0x1b0954);}return _0x1aa6e5['status'](_0x1b0954)[_0xed0b('0x20')]();};}function respondWithResult(_0xae0357,_0x576310){_0x576310=_0x576310||0xc8;return function(_0x39c213){if(_0x39c213){return _0xae0357[_0xed0b('0x21')](_0x576310)[_0xed0b('0x22')](_0x39c213);}};}function respondWithFilteredResult(_0x35c5ec,_0x3d54ab){return function(_0x4b8d97){if(_0x4b8d97){var _0x5dd66a=typeof _0x3d54ab[_0xed0b('0x23')]===_0xed0b('0x24')&&typeof _0x3d54ab['limit']===_0xed0b('0x24');var _0x59c142=_0x4b8d97[_0xed0b('0x25')];var _0x2a8efb=_0x5dd66a?0x0:_0x3d54ab['offset'];var _0x4e32d5=_0x5dd66a?_0x4b8d97['count']:_0x3d54ab[_0xed0b('0x23')]+_0x3d54ab['limit'];var _0x499647;if(_0x4e32d5>=_0x59c142){_0x4e32d5=_0x59c142;_0x499647=0xc8;}else{_0x499647=0xce;}_0x35c5ec[_0xed0b('0x21')](_0x499647);return _0x35c5ec[_0xed0b('0x26')]('Content-Range',_0x2a8efb+'-'+_0x4e32d5+'/'+_0x59c142)[_0xed0b('0x22')](_0x4b8d97);}return null;};}function patchUpdates(_0x4bd4bc){return function(_0xe0107c){try{jsonpatch[_0xed0b('0x27')](_0xe0107c,_0x4bd4bc,!![]);}catch(_0x1cf14c){return BPromise[_0xed0b('0x28')](_0x1cf14c);}return _0xe0107c[_0xed0b('0x29')]();};}function saveUpdates(_0x26b810,_0x36badc){return function(_0x3c592c){if(_0x3c592c){return _0x3c592c[_0xed0b('0x2a')](_0x26b810)[_0xed0b('0x2b')](function(_0x53219b){return _0x53219b;});}return null;};}function removeEntity(_0x57d3dc,_0x39efc6){return function(_0x396318){if(_0x396318){return _0x396318[_0xed0b('0x2c')]()['then'](function(){var _0x4ca412=_0x396318[_0xed0b('0x2d')]({'plain':!![]});var _0x44ca7d=_0xed0b('0x2e');return db[_0xed0b('0x2f')][_0xed0b('0x2c')]({'where':{'type':_0x44ca7d,'resourceId':_0x4ca412['id']}})['then'](function(){return _0x396318;});})[_0xed0b('0x2b')](function(){_0x57d3dc[_0xed0b('0x21')](0xcc)[_0xed0b('0x20')]();});}};}function handleEntityNotFound(_0x3d47d6,_0x11d2fb){return function(_0x5b5d42){if(!_0x5b5d42){_0x3d47d6[_0xed0b('0x1f')](0x194);}return _0x5b5d42;};}function handleError(_0x1834a4,_0x43c06a){_0x43c06a=_0x43c06a||0x1f4;return function(_0x11d324){logger[_0xed0b('0x30')](_0x11d324[_0xed0b('0x31')]);if(_0x11d324[_0xed0b('0x32')]){delete _0x11d324[_0xed0b('0x32')];}_0x1834a4[_0xed0b('0x21')](_0x43c06a)['send'](_0x11d324);};}exports['index']=function(_0x10d602,_0x305c65){var _0x1d1a7a={},_0x364f8f={},_0x15611f={'count':0x0,'rows':[]};var _0x309975=_['map'](db['Dashboard'][_0xed0b('0x33')],function(_0x2eba60){return{'name':_0x2eba60[_0xed0b('0x34')],'type':_0x2eba60['type'][_0xed0b('0x35')]};});_0x364f8f[_0xed0b('0x36')]=_[_0xed0b('0x37')](_0x309975,_0xed0b('0x32'));_0x364f8f[_0xed0b('0x38')]=_[_0xed0b('0x39')](_0x10d602[_0xed0b('0x38')]);_0x364f8f['filters']=_['intersection'](_0x364f8f[_0xed0b('0x36')],_0x364f8f[_0xed0b('0x38')]);_0x1d1a7a[_0xed0b('0x3a')]=_[_0xed0b('0x3b')](_0x364f8f[_0xed0b('0x36')],qs['fields'](_0x10d602[_0xed0b('0x38')][_0xed0b('0x3c')]));_0x1d1a7a[_0xed0b('0x3a')]=_0x1d1a7a['attributes'][_0xed0b('0x3d')]?_0x1d1a7a[_0xed0b('0x3a')]:_0x364f8f[_0xed0b('0x36')];if(!_0x10d602[_0xed0b('0x38')][_0xed0b('0x3e')](_0xed0b('0x3f'))){_0x1d1a7a[_0xed0b('0x40')]=qs['limit'](_0x10d602['query'][_0xed0b('0x40')]);_0x1d1a7a['offset']=qs[_0xed0b('0x23')](_0x10d602[_0xed0b('0x38')][_0xed0b('0x23')]);}_0x1d1a7a[_0xed0b('0x41')]=qs[_0xed0b('0x42')](_0x10d602['query'][_0xed0b('0x42')]);_0x1d1a7a[_0xed0b('0x43')]=qs[_0xed0b('0x44')](_['pick'](_0x10d602[_0xed0b('0x38')],_0x364f8f['filters']),_0x309975);if(_0x10d602[_0xed0b('0x38')]['filter']){_0x1d1a7a[_0xed0b('0x43')]=_[_0xed0b('0x45')](_0x1d1a7a[_0xed0b('0x43')],{'$or':_[_0xed0b('0x37')](_0x309975,function(_0x3a83c0){if(_0x3a83c0[_0xed0b('0x46')]!=='VIRTUAL'){var _0x4b3bfd={};_0x4b3bfd[_0x3a83c0[_0xed0b('0x32')]]={'$like':'%'+_0x10d602[_0xed0b('0x38')]['filter']+'%'};return _0x4b3bfd;}})});}_0x1d1a7a=_['merge']({},_0x1d1a7a,_0x10d602[_0xed0b('0x47')]);var _0x493da4={'where':_0x1d1a7a[_0xed0b('0x43')]};return db['Dashboard']['count'](_0x493da4)[_0xed0b('0x2b')](function(_0x13a0b6){_0x15611f[_0xed0b('0x25')]=_0x13a0b6;if(_0x10d602[_0xed0b('0x38')][_0xed0b('0x48')]){_0x1d1a7a[_0xed0b('0x49')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x1d1a7a);})[_0xed0b('0x2b')](function(_0xdba670){_0x15611f[_0xed0b('0x4a')]=_0xdba670;return _0x15611f;})[_0xed0b('0x2b')](respondWithFilteredResult(_0x305c65,_0x1d1a7a))['catch'](handleError(_0x305c65,null));};exports[_0xed0b('0x4b')]=function(_0x115709,_0x271273){var _0xc943f1={'raw':![],'where':{'id':_0x115709[_0xed0b('0x4c')]['id']}},_0x423efd={};_0x423efd[_0xed0b('0x36')]=_['keys'](db[_0xed0b('0x4d')]['rawAttributes']);_0x423efd[_0xed0b('0x38')]=_[_0xed0b('0x39')](_0x115709[_0xed0b('0x38')]);_0x423efd[_0xed0b('0x44')]=_['intersection'](_0x423efd['model'],_0x423efd['query']);_0xc943f1[_0xed0b('0x3a')]=_[_0xed0b('0x3b')](_0x423efd[_0xed0b('0x36')],qs[_0xed0b('0x3c')](_0x115709['query'][_0xed0b('0x3c')]));_0xc943f1[_0xed0b('0x3a')]=_0xc943f1[_0xed0b('0x3a')][_0xed0b('0x3d')]?_0xc943f1[_0xed0b('0x3a')]:_0x423efd[_0xed0b('0x36')];if(_0x115709['query'][_0xed0b('0x48')]){_0xc943f1[_0xed0b('0x49')]=[{'all':!![]}];}_0xc943f1=_[_0xed0b('0x45')]({},_0xc943f1,_0x115709[_0xed0b('0x47')]);return db['Dashboard'][_0xed0b('0x4e')](_0xc943f1)[_0xed0b('0x2b')](handleEntityNotFound(_0x271273,null))[_0xed0b('0x2b')](respondWithResult(_0x271273,null))[_0xed0b('0x4f')](handleError(_0x271273,null));};exports[_0xed0b('0x50')]=function(_0x4975e5,_0x3dd170){return db['Dashboard']['create'](_0x4975e5[_0xed0b('0x51')],{})[_0xed0b('0x2b')](function(_0x3185de){var _0x4d1e96=_0x4975e5[_0xed0b('0x52')][_0xed0b('0x2d')]({'plain':!![]});if(!_0x4d1e96)throw new Error(_0xed0b('0x53'));if(_0x4d1e96[_0xed0b('0x54')]===_0xed0b('0x52')){var _0x3af10f=_0x3185de[_0xed0b('0x2d')]({'plain':!![]});var _0x3c2f38='CustomDashboards';return db['UserProfileSection'][_0xed0b('0x4e')]({'where':{'name':_0x3c2f38,'userProfileId':_0x4d1e96[_0xed0b('0x55')]},'raw':!![]})[_0xed0b('0x2b')](function(_0x26a670){if(_0x26a670&&_0x26a670[_0xed0b('0x56')]===0x0){return db[_0xed0b('0x2f')]['create']({'name':_0x3af10f['name'],'resourceId':_0x3af10f['id'],'type':_0x26a670[_0xed0b('0x32')],'sectionId':_0x26a670['id']},{})[_0xed0b('0x2b')](function(){return _0x3185de;});}else{return _0x3185de;}})[_0xed0b('0x4f')](function(_0x351980){logger[_0xed0b('0x30')](_0xed0b('0x57'),_0x351980);throw _0x351980;});}return _0x3185de;})[_0xed0b('0x2b')](respondWithResult(_0x3dd170,0xc9))[_0xed0b('0x4f')](handleError(_0x3dd170,null));};exports[_0xed0b('0x58')]=function(_0xbe52f8,_0x1f5f94){var _0x96f98d={'where':{'id':_0xbe52f8[_0xed0b('0x4c')]['id']}},_0x26e752={};_0x26e752[_0xed0b('0x36')]=_['keys'](db['Dashboard'][_0xed0b('0x33')]);_0x96f98d['attributes']=_['intersection'](_0x26e752[_0xed0b('0x36')],qs[_0xed0b('0x3c')](_0xbe52f8[_0xed0b('0x38')][_0xed0b('0x3c')]));_0x96f98d[_0xed0b('0x3a')]=_0x96f98d[_0xed0b('0x3a')][_0xed0b('0x3d')]?_0x96f98d['attributes']:_0x26e752[_0xed0b('0x36')];if(_0xbe52f8[_0xed0b('0x38')][_0xed0b('0x48')]){_0x96f98d[_0xed0b('0x49')]=[{'all':!![]}];}_0x96f98d=_[_0xed0b('0x45')]({},_0x96f98d,_0xbe52f8[_0xed0b('0x47')]);return db[_0xed0b('0x4d')][_0xed0b('0x4e')](_0x96f98d)['then'](handleEntityNotFound(_0x1f5f94,null))['then'](function(_0x45787f){if(_0x45787f){var _0x58b2f5=_0x45787f[_0xed0b('0x2d')]({'plain':!![]});_0x58b2f5=qs['omit'](_0x58b2f5,['id',_0xed0b('0x59'),_0xed0b('0x5a')]);_0xbe52f8[_0xed0b('0x51')]=_[_0xed0b('0x5b')](_0xbe52f8[_0xed0b('0x51')],['id','createdAt','updatedAt']);return db[_0xed0b('0x4d')]['create'](_[_0xed0b('0x45')](_0x58b2f5,_0xbe52f8[_0xed0b('0x51')]),{'include':_0xbe52f8[_0xed0b('0x38')][_0xed0b('0x48')]?[{'all':!![]}]:undefined})[_0xed0b('0x2b')](function(_0xa9e19f){var _0x251736=_0xbe52f8[_0xed0b('0x52')][_0xed0b('0x2d')]({'plain':!![]});if(!_0x251736)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x251736['role']===_0xed0b('0x52')){var _0x21de4e=_0xa9e19f[_0xed0b('0x2d')]({'plain':!![]});var _0x314f89=_0xed0b('0x2e');return db[_0xed0b('0x5c')][_0xed0b('0x4e')]({'where':{'name':_0x314f89,'userProfileId':_0x251736[_0xed0b('0x55')]},'raw':!![]})[_0xed0b('0x2b')](function(_0x29a43c){if(_0x29a43c&&_0x29a43c[_0xed0b('0x56')]===0x0){return db['UserProfileResource'][_0xed0b('0x50')]({'name':_0x21de4e[_0xed0b('0x32')],'resourceId':_0x21de4e['id'],'type':_0x29a43c[_0xed0b('0x32')],'sectionId':_0x29a43c['id']},{})[_0xed0b('0x2b')](function(){return _0xa9e19f;});}else{return _0xa9e19f;}})['catch'](function(_0x31176e){logger['error'](_0xed0b('0x57'),_0x31176e);throw _0x31176e;});}return _0xa9e19f;});}})['then'](respondWithResult(_0x1f5f94,0xc9))[_0xed0b('0x4f')](handleError(_0x1f5f94,null));};exports[_0xed0b('0x2a')]=function(_0x5033f8,_0x126447){if(_0x5033f8[_0xed0b('0x51')]['id']){delete _0x5033f8[_0xed0b('0x51')]['id'];}return db[_0xed0b('0x4d')][_0xed0b('0x4e')]({'where':{'id':_0x5033f8['params']['id']}})['then'](handleEntityNotFound(_0x126447,null))[_0xed0b('0x2b')](saveUpdates(_0x5033f8[_0xed0b('0x51')],null))[_0xed0b('0x2b')](respondWithResult(_0x126447,null))[_0xed0b('0x4f')](handleError(_0x126447,null));};exports[_0xed0b('0x2c')]=function(_0x2ff25e,_0x298b90){return db[_0xed0b('0x4d')][_0xed0b('0x4e')]({'where':{'id':_0x2ff25e['params']['id']}})[_0xed0b('0x2b')](handleEntityNotFound(_0x298b90,null))[_0xed0b('0x2b')](removeEntity(_0x298b90,null))[_0xed0b('0x4f')](handleError(_0x298b90,null));};function widgetAttributes(_0x41240e){try{switch(_0x41240e['type']){case'iframe':return[{'name':_0xed0b('0x5d'),'value':_0x41240e['attrUrl']||(_0x41240e['attrs']&&_0x41240e['attrs'][0x0]?_0x41240e[_0xed0b('0x5e')][0x0]['value']:undefined)||_0xed0b('0x5f')}];case'custom':return[{'name':_0xed0b('0x60'),'value':_0x41240e[_0xed0b('0x60')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x0]?_0x41240e[_0xed0b('0x5e')][0x0]['value']:undefined)||''}];case _0xed0b('0x61'):return[{'name':_0xed0b('0x62'),'value':_0x41240e[_0xed0b('0x62')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e['attrs'][0x0]?_0x41240e[_0xed0b('0x5e')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xed0b('0x63'),'value':_0x41240e[_0xed0b('0x63')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x1]?_0x41240e['attrs'][0x1][_0xed0b('0x64')]:undefined)||_0xed0b('0x65')},{'name':_0xed0b('0x66'),'value':_0x41240e[_0xed0b('0x66')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x2]?_0x41240e[_0xed0b('0x5e')][0x2][_0xed0b('0x64')]:undefined)||0xc}];case'counter':return[{'name':_0xed0b('0x67'),'value':_0x41240e[_0xed0b('0x67')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x0]?_0x41240e[_0xed0b('0x5e')][0x0]['value']:undefined)||'total'},{'name':_0xed0b('0x68'),'value':_0x41240e[_0xed0b('0x68')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x1]?_0x41240e[_0xed0b('0x5e')][0x1][_0xed0b('0x64')]:undefined)||[]},{'name':_0xed0b('0x66'),'value':_0x41240e[_0xed0b('0x66')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x2]?_0x41240e[_0xed0b('0x5e')][0x2][_0xed0b('0x64')]:undefined)||0x14},{'name':_0xed0b('0x69'),'value':_0x41240e[_0xed0b('0x69')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e['attrs'][0x3]?_0x41240e[_0xed0b('0x5e')][0x3][_0xed0b('0x64')]:undefined)||_0xed0b('0x6a')},{'name':_0xed0b('0x6b'),'value':_0x41240e[_0xed0b('0x6b')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x4]?_0x41240e[_0xed0b('0x5e')][0x4][_0xed0b('0x64')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x41240e[_0xed0b('0x6c')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x5]?_0x41240e[_0xed0b('0x5e')][0x5][_0xed0b('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x41240e[_0xed0b('0x6d')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x6]?_0x41240e['attrs'][0x6]['value']:undefined)||''},{'name':_0xed0b('0x6e'),'value':_0x41240e[_0xed0b('0x6e')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x7]?_0x41240e[_0xed0b('0x5e')][0x7][_0xed0b('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x41240e[_0xed0b('0x6f')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x8]?_0x41240e[_0xed0b('0x5e')][0x8]['value']:undefined)||''},{'name':_0xed0b('0x70'),'value':_0x41240e[_0xed0b('0x70')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x9]?_0x41240e[_0xed0b('0x5e')][0x9][_0xed0b('0x64')]:undefined)||''}];case _0xed0b('0x71'):case _0xed0b('0x72'):return[{'name':_0xed0b('0x73'),'value':_0x41240e['attrSerie1']||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x0]?_0x41240e['attrs'][0x0]['value']:undefined)||_0xed0b('0x74')},{'name':_0xed0b('0x75'),'value':_0x41240e['attrSerie2']||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x1]?_0x41240e[_0xed0b('0x5e')][0x1][_0xed0b('0x64')]:undefined)||null},{'name':_0xed0b('0x76'),'value':_0x41240e[_0xed0b('0x76')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x2]?_0x41240e[_0xed0b('0x5e')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x41240e[_0xed0b('0x68')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x3]?_0x41240e['attrs'][0x3][_0xed0b('0x64')]:undefined)||[]},{'name':_0xed0b('0x69'),'value':_0x41240e[_0xed0b('0x69')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x4]?_0x41240e[_0xed0b('0x5e')][0x4]['value']:undefined)||'voice'},{'name':_0xed0b('0x6b'),'value':_0x41240e[_0xed0b('0x6b')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x5]?_0x41240e[_0xed0b('0x5e')][0x5][_0xed0b('0x64')]:undefined)||''},{'name':_0xed0b('0x6c'),'value':_0x41240e['attrFaxAccounts']||(_0x41240e['attrs']&&_0x41240e['attrs'][0x6]?_0x41240e[_0xed0b('0x5e')][0x6][_0xed0b('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x41240e[_0xed0b('0x6d')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e['attrs'][0x7]?_0x41240e[_0xed0b('0x5e')][0x7]['value']:undefined)||''},{'name':_0xed0b('0x6e'),'value':_0x41240e[_0xed0b('0x6e')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x8]?_0x41240e[_0xed0b('0x5e')][0x8][_0xed0b('0x64')]:undefined)||''},{'name':_0xed0b('0x6f'),'value':_0x41240e[_0xed0b('0x6f')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x9]?_0x41240e[_0xed0b('0x5e')][0x9]['value']:undefined)||''},{'name':_0xed0b('0x70'),'value':_0x41240e[_0xed0b('0x70')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0xa]?_0x41240e[_0xed0b('0x5e')][0xa][_0xed0b('0x64')]:undefined)||''}];case _0xed0b('0x77'):return[{'name':'attrReport','type':_0x41240e[_0xed0b('0x78')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x0]?_0x41240e[_0xed0b('0x5e')][0x0]['type']:undefined)||null,'value':_0x41240e[_0xed0b('0x79')]||(_0x41240e['attrs']&&_0x41240e[_0xed0b('0x5e')][0x0]?_0x41240e[_0xed0b('0x5e')][0x0][_0xed0b('0x64')]:undefined)||null},{'name':_0xed0b('0x7a'),'value':_0x41240e[_0xed0b('0x7a')]||(_0x41240e[_0xed0b('0x5e')]&&_0x41240e[_0xed0b('0x5e')][0x1]?_0x41240e[_0xed0b('0x5e')][0x1][_0xed0b('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x12f97d){logger['error']('widgetAttributes:\x20%s',JSON[_0xed0b('0x7b')](_0x12f97d));return[];}}exports['addItem']=function(_0x399b99,_0xdea6a7,_0xbaf22d){if(_0x399b99[_0xed0b('0x51')]['id']){delete _0x399b99[_0xed0b('0x51')]['id'];}return db['Dashboard'][_0xed0b('0x4e')]({'where':{'id':_0x399b99[_0xed0b('0x4c')]['id']}})[_0xed0b('0x2b')](handleEntityNotFound(_0xdea6a7,null))[_0xed0b('0x2b')](function(_0x4313c0){if(_0x4313c0){_0x399b99[_0xed0b('0x51')]['DashboardId']=_0x4313c0['id'];_0x399b99[_0xed0b('0x51')][_0xed0b('0x5e')]=widgetAttributes(_0x399b99[_0xed0b('0x51')]);return db[_0xed0b('0x7c')]['create'](_0x399b99[_0xed0b('0x51')]);}})['then'](respondWithResult(_0xdea6a7,null))[_0xed0b('0x4f')](handleError(_0xdea6a7,null));};exports[_0xed0b('0x7d')]=function(_0x1225ba,_0x3cf828,_0x50a19f){var _0x13a8e6={};var _0x4c2c62={};var _0x3af203;var _0x32df9d;return db[_0xed0b('0x4d')]['findOne']({'where':{'id':_0x1225ba['params']['id']}})[_0xed0b('0x2b')](handleEntityNotFound(_0x3cf828,null))[_0xed0b('0x2b')](function(_0x1574e2){if(_0x1574e2){_0x3af203=_0x1574e2;_0x4c2c62[_0xed0b('0x36')]=_['keys'](db[_0xed0b('0x7c')]['rawAttributes']);_0x4c2c62['query']=_['keys'](_0x1225ba[_0xed0b('0x38')]);_0x4c2c62['filters']=_[_0xed0b('0x3b')](_0x4c2c62['model'],_0x4c2c62[_0xed0b('0x38')]);_0x13a8e6['attributes']=_['intersection'](_0x4c2c62['model'],qs[_0xed0b('0x3c')](_0x1225ba[_0xed0b('0x38')][_0xed0b('0x3c')]));_0x13a8e6['attributes']=_0x13a8e6['attributes'][_0xed0b('0x3d')]?_0x13a8e6['attributes']:_0x4c2c62['model'];_0x13a8e6['order']=qs[_0xed0b('0x42')](_0x1225ba[_0xed0b('0x38')][_0xed0b('0x42')]);_0x13a8e6[_0xed0b('0x43')]=qs['filters'](_[_0xed0b('0x7e')](_0x1225ba['query'],_0x4c2c62[_0xed0b('0x44')]));if(_0x1225ba[_0xed0b('0x38')][_0xed0b('0x7f')]){_0x13a8e6[_0xed0b('0x43')]=_['merge'](_0x13a8e6[_0xed0b('0x43')],{'$or':_['map'](_0x13a8e6['attributes'],function(_0x285f44){var _0x2addca={};_0x2addca[_0x285f44]={'$like':'%'+_0x1225ba[_0xed0b('0x38')]['filter']+'%'};return _0x2addca;})});}_0x13a8e6=_[_0xed0b('0x45')]({},_0x13a8e6,_0x1225ba[_0xed0b('0x47')]);return _0x3af203[_0xed0b('0x7d')](_0x13a8e6);}})['then'](function(_0x19cd19){if(_0x19cd19){_0x32df9d=_0x19cd19[_0xed0b('0x3d')];if(!_0x1225ba[_0xed0b('0x38')][_0xed0b('0x3e')]('nolimit')){_0x13a8e6[_0xed0b('0x40')]=qs[_0xed0b('0x40')](_0x1225ba[_0xed0b('0x38')]['limit']);_0x13a8e6[_0xed0b('0x23')]=qs['offset'](_0x1225ba[_0xed0b('0x38')][_0xed0b('0x23')]);}return _0x3af203['getItems'](_0x13a8e6);}})[_0xed0b('0x2b')](function(_0x42e43f){if(_0x42e43f){return _0x42e43f?{'count':_0x32df9d,'rows':_0x42e43f}:null;}})['then'](respondWithResult(_0x3cf828,null))['catch'](handleError(_0x3cf828,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index da62bcc..66b4e5d 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 _0x397b=['hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','emit'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x397b,0x15b));var _0xb397=function(_0x2b20e2,_0x18f513){_0x2b20e2=_0x2b20e2-0x0;var _0xd90eae=_0x397b[_0x2b20e2];return _0xd90eae;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xb397('0x0'))['db'][_0xb397('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb397('0x2')](0x0);var events={'afterCreate':_0xb397('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x119150){return function(_0x412060,_0x39ef6e,_0x57333f){DashboardEvents[_0xb397('0x4')](_0x119150+':'+_0x412060['id'],_0x412060);DashboardEvents[_0xb397('0x4')](_0x119150,_0x412060);_0x57333f(null);};}for(var e in events){if(events[_0xb397('0x5')](e)){var event=events[e];Dashboard[_0xb397('0x6')](e,emitEvent(event));}}module[_0xb397('0x7')]=DashboardEvents; \ No newline at end of file +var _0x8107=['hook','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4a7bba,_0x1daa93){var _0x206ea6=function(_0xef2a47){while(--_0xef2a47){_0x4a7bba['push'](_0x4a7bba['shift']());}};_0x206ea6(++_0x1daa93);}(_0x8107,0x1f1));var _0x7810=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0x8107[_0x4cc280];return _0x16ed24;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x7810('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7810('0x1')](0x0);var events={'afterCreate':_0x7810('0x2'),'afterUpdate':_0x7810('0x3'),'afterDestroy':_0x7810('0x4')};function emitEvent(_0x1eacd0){return function(_0xf21a5d,_0x171c12,_0x7fe30e){DashboardEvents[_0x7810('0x5')](_0x1eacd0+':'+_0xf21a5d['id'],_0xf21a5d);DashboardEvents[_0x7810('0x5')](_0x1eacd0,_0xf21a5d);_0x7fe30e(null);};}for(var e in events){if(events[_0x7810('0x6')](e)){var event=events[e];Dashboard[_0x7810('0x7')](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 df8d9bb..61b2ad0 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 _0x5d59=['rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','api','moment'];(function(_0x4f046a,_0x26972f){var _0x19b845=function(_0x44b1c8){while(--_0x44b1c8){_0x4f046a['push'](_0x4f046a['shift']());}};_0x19b845(++_0x26972f);}(_0x5d59,0xb0));var _0x95d5=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0x5d59[_0x25d4e5];return _0x44d116;};'use strict';var _=require(_0x95d5('0x0'));var util=require(_0x95d5('0x1'));var logger=require('../../config/logger')(_0x95d5('0x2'));var moment=require(_0x95d5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95d5('0x4'));var config=require(_0x95d5('0x5'));var attributes=require(_0x95d5('0x6'));module[_0x95d5('0x7')]=function(_0x4bba73,_0x75eb1a){return _0x4bba73['define'](_0x95d5('0x8'),attributes,{'tableName':_0x95d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dfc=['define','dashboards','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b8655,_0x485d9a){var _0x3b483b=function(_0x595a6c){while(--_0x595a6c){_0x4b8655['push'](_0x4b8655['shift']());}};_0x3b483b(++_0x485d9a);}(_0x4dfc,0xda));var _0xc4df=function(_0xb4947e,_0x39de27){_0xb4947e=_0xb4947e-0x0;var _0x2af6df=_0x4dfc[_0xb4947e];return _0x2af6df;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc4df('0x0'));var moment=require(_0xc4df('0x1'));var BPromise=require(_0xc4df('0x2'));var rp=require(_0xc4df('0x3'));var fs=require('fs');var path=require(_0xc4df('0x4'));var rimraf=require(_0xc4df('0x5'));var config=require(_0xc4df('0x6'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x5814de,_0x27d2b2){return _0x5814de[_0xc4df('0x7')]('Dashboard',attributes,{'tableName':_0xc4df('0x8'),'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 935a20c..4988106 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 _0xb77b=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./dashboard.socket','register','request'];(function(_0x1291ee,_0x2d9572){var _0x3a8ed3=function(_0x9ca443){while(--_0x9ca443){_0x1291ee['push'](_0x1291ee['shift']());}};_0x3a8ed3(++_0x2d9572);}(_0xb77b,0x81));var _0xbb77=function(_0x3f7e8b,_0x7291d1){_0x3f7e8b=_0x3f7e8b-0x0;var _0x4eb892=_0xb77b[_0x3f7e8b];return _0x4eb892;};'use strict';var _=require(_0xbb77('0x0'));var util=require('util');var moment=require(_0xbb77('0x1'));var BPromise=require(_0xbb77('0x2'));var rs=require(_0xbb77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb77('0x4'))['db'];var utils=require(_0xbb77('0x5'));var logger=require(_0xbb77('0x6'))(_0xbb77('0x7'));var config=require(_0xbb77('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb77('0x9')]['http']({'port':0x232a});config[_0xbb77('0xa')]=_[_0xbb77('0xb')](config[_0xbb77('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb77('0xa')]));require(_0xbb77('0xc'))[_0xbb77('0xd')](socket);function respondWithRpcPromise(_0xf3670b,_0x5bf9c4,_0x972730){return new BPromise(function(_0x52f1db,_0x554224){return client[_0xbb77('0xe')](_0xf3670b,_0x972730)[_0xbb77('0xf')](function(_0x32268d){logger[_0xbb77('0x10')](_0xbb77('0x11'),_0x5bf9c4,_0xbb77('0x12'));logger[_0xbb77('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5bf9c4,_0xbb77('0x12'),JSON[_0xbb77('0x14')](_0x32268d));if(_0x32268d['error']){if(_0x32268d[_0xbb77('0x15')]['code']===0x1f4){logger[_0xbb77('0x15')](_0xbb77('0x11'),_0x5bf9c4,_0x32268d[_0xbb77('0x15')][_0xbb77('0x16')]);return _0x554224(_0x32268d[_0xbb77('0x15')][_0xbb77('0x16')]);}logger[_0xbb77('0x15')](_0xbb77('0x11'),_0x5bf9c4,_0x32268d[_0xbb77('0x15')][_0xbb77('0x16')]);return _0x52f1db(_0x32268d[_0xbb77('0x15')]['message']);}else{logger[_0xbb77('0x10')]('Dashboard,\x20%s,\x20%s',_0x5bf9c4,_0xbb77('0x12'));_0x52f1db(_0x32268d[_0xbb77('0x17')][_0xbb77('0x16')]);}})['catch'](function(_0x91624){logger[_0xbb77('0x15')](_0xbb77('0x11'),_0x5bf9c4,_0x91624);_0x554224(_0x91624);});});} \ No newline at end of file +var _0x7abd=['request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','./dashboard.socket','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7abd,0xbb));var _0xd7ab=function(_0x31a116,_0x5b75b0){_0x31a116=_0x31a116-0x0;var _0x5f31ce=_0x7abd[_0x31a116];return _0x5f31ce;};'use strict';var _=require('lodash');var util=require(_0xd7ab('0x0'));var moment=require(_0xd7ab('0x1'));var BPromise=require('bluebird');var rs=require(_0xd7ab('0x2'));var fs=require('fs');var Redis=require(_0xd7ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7ab('0x4'));var logger=require(_0xd7ab('0x5'))(_0xd7ab('0x6'));var config=require('../../config/environment');var jayson=require(_0xd7ab('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xd7ab('0x8')]=_[_0xd7ab('0x9')](config[_0xd7ab('0x8')],{'host':_0xd7ab('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7ab('0x8')]));require(_0xd7ab('0xb'))[_0xd7ab('0xc')](socket);function respondWithRpcPromise(_0x455ab0,_0x316532,_0x3336fc){return new BPromise(function(_0x44089e,_0x12d230){return client[_0xd7ab('0xd')](_0x455ab0,_0x3336fc)['then'](function(_0x16643c){logger[_0xd7ab('0xe')](_0xd7ab('0xf'),_0x316532,_0xd7ab('0x10'));logger[_0xd7ab('0x11')](_0xd7ab('0x12'),_0x316532,_0xd7ab('0x10'),JSON[_0xd7ab('0x13')](_0x16643c));if(_0x16643c[_0xd7ab('0x14')]){if(_0x16643c[_0xd7ab('0x14')][_0xd7ab('0x15')]===0x1f4){logger[_0xd7ab('0x14')](_0xd7ab('0xf'),_0x316532,_0x16643c[_0xd7ab('0x14')][_0xd7ab('0x16')]);return _0x12d230(_0x16643c[_0xd7ab('0x14')][_0xd7ab('0x16')]);}logger[_0xd7ab('0x14')](_0xd7ab('0xf'),_0x316532,_0x16643c[_0xd7ab('0x14')]['message']);return _0x44089e(_0x16643c[_0xd7ab('0x14')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x316532,'request\x20sent');_0x44089e(_0x16643c[_0xd7ab('0x17')][_0xd7ab('0x16')]);}})[_0xd7ab('0x18')](function(_0x1fcf81){logger['error'](_0xd7ab('0xf'),_0x316532,_0x1fcf81);_0x12d230(_0x1fcf81);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0ef2bbf..aa28f28 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 _0xaa76=['dashboard:','./dashboard.events','removeListener','length'];(function(_0x4ef0a1,_0x35e1a9){var _0x5f54c3=function(_0x14dbf2){while(--_0x14dbf2){_0x4ef0a1['push'](_0x4ef0a1['shift']());}};_0x5f54c3(++_0x35e1a9);}(_0xaa76,0x85));var _0x6aa7=function(_0x421867,_0x5c83c9){_0x421867=_0x421867-0x0;var _0x2ff3ee=_0xaa76[_0x421867];return _0x2ff3ee;};'use strict';var DashboardEvents=require(_0x6aa7('0x0'));var events=['save','remove','update'];function createListener(_0x1829bb,_0x2b99cc){return function(_0x4cc45b){_0x2b99cc['emit'](_0x1829bb,_0x4cc45b);};}function removeListener(_0xaded95,_0x38a8d4){return function(){DashboardEvents[_0x6aa7('0x1')](_0xaded95,_0x38a8d4);};}exports['register']=function(_0x326244){for(var _0x38eafc=0x0,_0xe56a6a=events[_0x6aa7('0x2')];_0x38eafc<_0xe56a6a;_0x38eafc++){var _0x1fe905=events[_0x38eafc];var _0x129bb5=createListener(_0x6aa7('0x3')+_0x1fe905,_0x326244);DashboardEvents['on'](_0x1fe905,_0x129bb5);}}; \ No newline at end of file +var _0xaeff=['remove','update','emit','register','length','./dashboard.events','save'];(function(_0x2b55cd,_0x333cf7){var _0x6dfb14=function(_0x5dec0d){while(--_0x5dec0d){_0x2b55cd['push'](_0x2b55cd['shift']());}};_0x6dfb14(++_0x333cf7);}(_0xaeff,0x1e1));var _0xfaef=function(_0x34f31c,_0x40ab5b){_0x34f31c=_0x34f31c-0x0;var _0x1b4650=_0xaeff[_0x34f31c];return _0x1b4650;};'use strict';var DashboardEvents=require(_0xfaef('0x0'));var events=[_0xfaef('0x1'),_0xfaef('0x2'),_0xfaef('0x3')];function createListener(_0x1d0344,_0x21cd9b){return function(_0x581e47){_0x21cd9b[_0xfaef('0x4')](_0x1d0344,_0x581e47);};}function removeListener(_0x3fa23c,_0x4e55e4){return function(){DashboardEvents['removeListener'](_0x3fa23c,_0x4e55e4);};}exports[_0xfaef('0x5')]=function(_0x26cc6b){for(var _0x31c3b8=0x0,_0x4edee6=events[_0xfaef('0x6')];_0x31c3b8<_0x4edee6;_0x31c3b8++){var _0x289815=events[_0x31c3b8];var _0x261863=createListener('dashboard:'+_0x289815,_0x26cc6b);DashboardEvents['on'](_0x289815,_0x261863);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2fa1654..9c9b866 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 _0x484b=['update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','addItem','/:id'];(function(_0xc34843,_0x28147e){var _0x56221d=function(_0x352c1d){while(--_0x352c1d){_0xc34843['push'](_0xc34843['shift']());}};_0x56221d(++_0x28147e);}(_0x484b,0x81));var _0xb484=function(_0x41f7c5,_0x57ef4c){_0x41f7c5=_0x41f7c5-0x0;var _0x57e18c=_0x484b[_0x41f7c5];return _0x57e18c;};'use strict';var multer=require(_0xb484('0x0'));var util=require(_0xb484('0x1'));var path=require(_0xb484('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb484('0x3')]();var fs_extra=require(_0xb484('0x4'));var auth=require(_0xb484('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb484('0x6'));var controller=require(_0xb484('0x7'));router[_0xb484('0x8')]('/',auth[_0xb484('0x9')](),controller['index']);router['get']('/:id',auth[_0xb484('0x9')](),controller[_0xb484('0xa')]);router[_0xb484('0x8')](_0xb484('0xb'),auth[_0xb484('0x9')](),controller[_0xb484('0xc')]);router[_0xb484('0xd')]('/',auth[_0xb484('0x9')](),controller[_0xb484('0xe')]);router['post'](_0xb484('0xf'),auth[_0xb484('0x9')](),controller['clone']);router[_0xb484('0xd')](_0xb484('0xb'),auth[_0xb484('0x9')](),controller[_0xb484('0x10')]);router['put'](_0xb484('0x11'),auth[_0xb484('0x9')](),controller[_0xb484('0x12')]);router[_0xb484('0x13')](_0xb484('0x11'),auth['isAuthenticated'](),controller[_0xb484('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2473=['/:id','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put'];(function(_0x4cb9c2,_0x27102f){var _0x1b2b50=function(_0xa482b1){while(--_0xa482b1){_0x4cb9c2['push'](_0x4cb9c2['shift']());}};_0x1b2b50(++_0x27102f);}(_0x2473,0xca));var _0x3247=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2473[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x3247('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3247('0x1'));var express=require(_0x3247('0x2'));var router=express['Router']();var fs_extra=require(_0x3247('0x3'));var auth=require(_0x3247('0x4'));var interaction=require(_0x3247('0x5'));var config=require(_0x3247('0x6'));var controller=require('./dashboard.controller');router[_0x3247('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3247('0x8')](),controller[_0x3247('0x9')]);router[_0x3247('0x7')](_0x3247('0xa'),auth[_0x3247('0x8')](),controller[_0x3247('0xb')]);router['post']('/',auth[_0x3247('0x8')](),controller[_0x3247('0xc')]);router[_0x3247('0xd')](_0x3247('0xe'),auth[_0x3247('0x8')](),controller[_0x3247('0xf')]);router['post'](_0x3247('0xa'),auth[_0x3247('0x8')](),controller[_0x3247('0x10')]);router[_0x3247('0x11')](_0x3247('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x3247('0x13')](_0x3247('0x12'),auth[_0x3247('0x8')](),controller[_0x3247('0x14')]);module[_0x3247('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index db45c32..4af8524 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 _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5496,0x175));var _0x6549=function(_0x26e6c4,_0x163fc6){_0x26e6c4=_0x26e6c4-0x0;var _0x558868=_0x5496[_0x26e6c4];return _0x558868;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x507fa1,_0x57f744){var _0x2e028c=function(_0x4a7602){while(--_0x4a7602){_0x507fa1['push'](_0x507fa1['shift']());}};_0x2e028c(++_0x57f744);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ffd0074..4ff34de 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 _0x5078=['attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','reportType','attrReport','attrRefresh','stringify','body','create','update','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','show','params','DashboardItem','query','keys','model','attributes','intersection','fields','length','includeAll','merge','options','catch','find','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5078,0x148));var _0x8507=function(_0x4c5708,_0x34b1f9){_0x4c5708=_0x4c5708-0x0;var _0x37fa9b=_0x5078[_0x4c5708];return _0x37fa9b;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require(_0x8507('0x1'));var zipdir=require(_0x8507('0x2'));var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require(_0x8507('0x8'));var path=require(_0x8507('0x9'));var sox=require(_0x8507('0xa'));var csv=require(_0x8507('0xb'));var ejs=require(_0x8507('0xc'));var fs=require('fs');var fs_extra=require(_0x8507('0xd'));var _=require(_0x8507('0xe'));var squel=require(_0x8507('0xf'));var crypto=require('crypto');var jsforce=require(_0x8507('0x10'));var deskjs=require(_0x8507('0x11'));var toCsv=require(_0x8507('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8507('0x12'));var authService=require(_0x8507('0x13'));var qs=require(_0x8507('0x14'));var as=require(_0x8507('0x15'));var hardwareService=require(_0x8507('0x16'));var logger=require(_0x8507('0x17'))(_0x8507('0x18'));var utils=require('../../config/utils');var config=require(_0x8507('0x19'));var licenseUtil=require(_0x8507('0x1a'));var db=require(_0x8507('0x1b'))['db'];config[_0x8507('0x1c')]=_[_0x8507('0x1d')](config[_0x8507('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x8507('0x1e'))(new Redis(config[_0x8507('0x1c')]));require(_0x8507('0x1f'))[_0x8507('0x20')](socket);function respondWithStatusCode(_0x2ea0e1,_0x4351b2){_0x4351b2=_0x4351b2||0xcc;return function(_0x5ae6af){if(_0x5ae6af){return _0x2ea0e1['sendStatus'](_0x4351b2);}return _0x2ea0e1[_0x8507('0x21')](_0x4351b2)[_0x8507('0x22')]();};}function respondWithResult(_0x3f1ed1,_0x565000){_0x565000=_0x565000||0xc8;return function(_0x3cb554){if(_0x3cb554){return _0x3f1ed1[_0x8507('0x21')](_0x565000)[_0x8507('0x23')](_0x3cb554);}};}function respondWithFilteredResult(_0x412aee,_0x38a1a7){return function(_0x13b285){if(_0x13b285){var _0x569632=typeof _0x38a1a7[_0x8507('0x24')]==='undefined'&&typeof _0x38a1a7['limit']===_0x8507('0x25');var _0xc556a4=_0x13b285[_0x8507('0x26')];var _0x45435c=_0x569632?0x0:_0x38a1a7[_0x8507('0x24')];var _0x5750fd=_0x569632?_0x13b285[_0x8507('0x26')]:_0x38a1a7[_0x8507('0x24')]+_0x38a1a7[_0x8507('0x27')];var _0x192f1c;if(_0x5750fd>=_0xc556a4){_0x5750fd=_0xc556a4;_0x192f1c=0xc8;}else{_0x192f1c=0xce;}_0x412aee[_0x8507('0x21')](_0x192f1c);return _0x412aee[_0x8507('0x28')](_0x8507('0x29'),_0x45435c+'-'+_0x5750fd+'/'+_0xc556a4)[_0x8507('0x23')](_0x13b285);}return null;};}function patchUpdates(_0x539cf9){return function(_0x60c651){try{jsonpatch[_0x8507('0x2a')](_0x60c651,_0x539cf9,!![]);}catch(_0x37fd9c){return BPromise[_0x8507('0x2b')](_0x37fd9c);}return _0x60c651[_0x8507('0x2c')]();};}function saveUpdates(_0x438001,_0xd2f703){return function(_0x358e50){if(_0x358e50){return _0x358e50['update'](_0x438001)[_0x8507('0x2d')](function(_0x24fc61){return _0x24fc61;});}return null;};}function removeEntity(_0x188ae0,_0x5a559e){return function(_0x6f5ab2){if(_0x6f5ab2){return _0x6f5ab2[_0x8507('0x2e')]()[_0x8507('0x2d')](function(){_0x188ae0[_0x8507('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc48bf5,_0xbf4337){return function(_0x2bd833){if(!_0x2bd833){_0xc48bf5[_0x8507('0x2f')](0x194);}return _0x2bd833;};}function handleError(_0x11c8d5,_0x5f0e81){_0x5f0e81=_0x5f0e81||0x1f4;return function(_0x23c6e1){logger[_0x8507('0x30')](_0x23c6e1[_0x8507('0x31')]);if(_0x23c6e1[_0x8507('0x32')]){delete _0x23c6e1[_0x8507('0x32')];}_0x11c8d5[_0x8507('0x21')](_0x5f0e81)[_0x8507('0x33')](_0x23c6e1);};}exports[_0x8507('0x34')]=function(_0xa3642,_0x6e9a38){var _0x25a7d1={'raw':![],'where':{'id':_0xa3642[_0x8507('0x35')]['id']}},_0x32f500={};_0x32f500['model']=_['keys'](db[_0x8507('0x36')]['rawAttributes']);_0x32f500[_0x8507('0x37')]=_[_0x8507('0x38')](_0xa3642['query']);_0x32f500['filters']=_['intersection'](_0x32f500[_0x8507('0x39')],_0x32f500[_0x8507('0x37')]);_0x25a7d1[_0x8507('0x3a')]=_[_0x8507('0x3b')](_0x32f500[_0x8507('0x39')],qs[_0x8507('0x3c')](_0xa3642['query']['fields']));_0x25a7d1[_0x8507('0x3a')]=_0x25a7d1[_0x8507('0x3a')][_0x8507('0x3d')]?_0x25a7d1['attributes']:_0x32f500['model'];if(_0xa3642[_0x8507('0x37')][_0x8507('0x3e')]){_0x25a7d1['include']=[{'all':!![]}];}_0x25a7d1=_[_0x8507('0x3f')]({},_0x25a7d1,_0xa3642[_0x8507('0x40')]);return db['DashboardItem']['find'](_0x25a7d1)['then'](handleEntityNotFound(_0x6e9a38,null))[_0x8507('0x2d')](respondWithResult(_0x6e9a38,null))[_0x8507('0x41')](handleError(_0x6e9a38,null));};exports[_0x8507('0x2e')]=function(_0x4225d7,_0x56c610){return db['DashboardItem'][_0x8507('0x42')]({'where':{'id':_0x4225d7[_0x8507('0x35')]['id']}})['then'](handleEntityNotFound(_0x56c610,null))[_0x8507('0x2d')](removeEntity(_0x56c610,null))[_0x8507('0x41')](handleError(_0x56c610,null));};function widgetAttributes(_0x38edbd){try{switch(_0x38edbd['type']){case _0x8507('0x43'):return[{'name':_0x8507('0x44'),'value':_0x38edbd[_0x8507('0x44')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['value']:undefined)||_0x8507('0x46')}];case _0x8507('0x47'):return[{'name':'attrPath','value':_0x38edbd[_0x8507('0x48')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['value']:undefined)||''}];case _0x8507('0x49'):return[{'name':_0x8507('0x4a'),'value':_0x38edbd['attrHourFormat']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x0]?_0x38edbd[_0x8507('0x45')][0x0][_0x8507('0x4b')]:undefined)||_0x8507('0x4c')},{'name':_0x8507('0x4d'),'value':_0x38edbd[_0x8507('0x4d')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x1]?_0x38edbd[_0x8507('0x45')][0x1][_0x8507('0x4b')]:undefined)||_0x8507('0x4e')},{'name':_0x8507('0x4f'),'value':_0x38edbd['attrFontSize']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x2]?_0x38edbd['attrs'][0x2][_0x8507('0x4b')]:undefined)||0xc}];case _0x8507('0x50'):return[{'name':_0x8507('0x51'),'value':_0x38edbd['attrMetric']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x0]?_0x38edbd[_0x8507('0x45')][0x0][_0x8507('0x4b')]:undefined)||_0x8507('0x52')},{'name':_0x8507('0x53'),'value':_0x38edbd['attrVoiceQueues']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x1]?_0x38edbd[_0x8507('0x45')][0x1][_0x8507('0x4b')]:undefined)||[]},{'name':'attrFontSize','value':_0x38edbd['attrFontSize']||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x2]?_0x38edbd[_0x8507('0x45')][0x2][_0x8507('0x4b')]:undefined)||0x14},{'name':_0x8507('0x54'),'value':_0x38edbd[_0x8507('0x54')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x3]?_0x38edbd[_0x8507('0x45')][0x3][_0x8507('0x4b')]:undefined)||'voice'},{'name':_0x8507('0x55'),'value':_0x38edbd[_0x8507('0x55')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x4]?_0x38edbd[_0x8507('0x45')][0x4][_0x8507('0x4b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38edbd['attrFaxAccounts']||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x5]?_0x38edbd[_0x8507('0x45')][0x5][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x56'),'value':_0x38edbd[_0x8507('0x56')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x6]?_0x38edbd[_0x8507('0x45')][0x6][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x57'),'value':_0x38edbd[_0x8507('0x57')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x7]?_0x38edbd['attrs'][0x7]['value']:undefined)||''},{'name':_0x8507('0x58'),'value':_0x38edbd[_0x8507('0x58')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x8]?_0x38edbd['attrs'][0x8][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x59'),'value':_0x38edbd['attrChatWebsites']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x9]?_0x38edbd['attrs'][0x9][_0x8507('0x4b')]:undefined)||''}];case _0x8507('0x5a'):case _0x8507('0x5b'):return[{'name':_0x8507('0x5c'),'value':_0x38edbd[_0x8507('0x5c')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd['attrs'][0x0][_0x8507('0x4b')]:undefined)||_0x8507('0x52')},{'name':_0x8507('0x5d'),'value':_0x38edbd['attrSerie2']||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd['attrs'][0x1]?_0x38edbd['attrs'][0x1][_0x8507('0x4b')]:undefined)||null},{'name':'attrSerie3','value':_0x38edbd[_0x8507('0x5e')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x2]?_0x38edbd[_0x8507('0x45')][0x2][_0x8507('0x4b')]:undefined)||null},{'name':_0x8507('0x53'),'value':_0x38edbd[_0x8507('0x53')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x3]?_0x38edbd['attrs'][0x3][_0x8507('0x4b')]:undefined)||[]},{'name':_0x8507('0x54'),'value':_0x38edbd[_0x8507('0x54')]||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x4]?_0x38edbd[_0x8507('0x45')][0x4][_0x8507('0x4b')]:undefined)||_0x8507('0x5f')},{'name':_0x8507('0x55'),'value':_0x38edbd[_0x8507('0x55')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x5]?_0x38edbd['attrs'][0x5][_0x8507('0x4b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38edbd[_0x8507('0x60')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x6]?_0x38edbd[_0x8507('0x45')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x38edbd[_0x8507('0x56')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x7]?_0x38edbd[_0x8507('0x45')][0x7][_0x8507('0x4b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38edbd[_0x8507('0x57')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x8]?_0x38edbd[_0x8507('0x45')][0x8][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x58'),'value':_0x38edbd[_0x8507('0x58')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x9]?_0x38edbd[_0x8507('0x45')][0x9][_0x8507('0x4b')]:undefined)||''},{'name':_0x8507('0x59'),'value':_0x38edbd[_0x8507('0x59')]||(_0x38edbd['attrs']&&_0x38edbd['attrs'][0xa]?_0x38edbd[_0x8507('0x45')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x38edbd[_0x8507('0x61')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['type']:undefined)||null,'value':_0x38edbd[_0x8507('0x62')]||(_0x38edbd['attrs']&&_0x38edbd[_0x8507('0x45')][0x0]?_0x38edbd[_0x8507('0x45')][0x0]['value']:undefined)||null},{'name':_0x8507('0x63'),'value':_0x38edbd[_0x8507('0x63')]||(_0x38edbd[_0x8507('0x45')]&&_0x38edbd[_0x8507('0x45')][0x1]?_0x38edbd['attrs'][0x1][_0x8507('0x4b')]:undefined)||0x0}];default:return[];}}catch(_0x40497c){logger[_0x8507('0x30')]('widgetAttributes:\x20%s',JSON[_0x8507('0x64')](_0x40497c));return[];}}exports['create']=function(_0x325feb,_0xa7b882){if(_0x325feb[_0x8507('0x65')]){_0x325feb['body'][_0x8507('0x45')]=widgetAttributes(_0x325feb[_0x8507('0x65')]);}return db[_0x8507('0x36')][_0x8507('0x66')](_0x325feb[_0x8507('0x65')],{})['then'](respondWithResult(_0xa7b882,0xc9))[_0x8507('0x41')](handleError(_0xa7b882,null));};exports[_0x8507('0x67')]=function(_0x12bbf3,_0xfb5942){if(_0x12bbf3[_0x8507('0x65')]['id']){delete _0x12bbf3['body']['id'];}_0x12bbf3[_0x8507('0x65')][_0x8507('0x45')]=widgetAttributes(_0x12bbf3[_0x8507('0x65')]);return db[_0x8507('0x36')][_0x8507('0x42')]({'where':{'id':_0x12bbf3[_0x8507('0x35')]['id']}})[_0x8507('0x2d')](handleEntityNotFound(_0xfb5942,null))['then'](saveUpdates(_0x12bbf3[_0x8507('0x65')],null))[_0x8507('0x2d')](respondWithResult(_0xfb5942,null))['catch'](handleError(_0xfb5942,null));}; \ No newline at end of file +var _0x5334=['type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','DashboardItem','find','catch'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x5334,0x84));var _0x4533=function(_0xfab950,_0x2be2b8){_0xfab950=_0xfab950-0x0;var _0x25d29c=_0x5334[_0xfab950];return _0x25d29c;};'use strict';var emlformat=require(_0x4533('0x0'));var rimraf=require(_0x4533('0x1'));var zipdir=require(_0x4533('0x2'));var jsonpatch=require(_0x4533('0x3'));var rp=require(_0x4533('0x4'));var moment=require('moment');var BPromise=require(_0x4533('0x5'));var Mustache=require('mustache');var util=require(_0x4533('0x6'));var path=require(_0x4533('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4533('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4533('0x15'))['db'];config[_0x4533('0x16')]=_[_0x4533('0x17')](config[_0x4533('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x4533('0x18'))(new Redis(config[_0x4533('0x16')]));require(_0x4533('0x19'))[_0x4533('0x1a')](socket);function respondWithStatusCode(_0x533a26,_0xe47213){_0xe47213=_0xe47213||0xcc;return function(_0x573d84){if(_0x573d84){return _0x533a26['sendStatus'](_0xe47213);}return _0x533a26[_0x4533('0x1b')](_0xe47213)[_0x4533('0x1c')]();};}function respondWithResult(_0x5da8b8,_0x30c68c){_0x30c68c=_0x30c68c||0xc8;return function(_0x1e6a1a){if(_0x1e6a1a){return _0x5da8b8[_0x4533('0x1b')](_0x30c68c)['json'](_0x1e6a1a);}};}function respondWithFilteredResult(_0x3ed873,_0x4f732e){return function(_0x3ddb36){if(_0x3ddb36){var _0x3d16a2=typeof _0x4f732e['offset']===_0x4533('0x1d')&&typeof _0x4f732e['limit']==='undefined';var _0x1c5cdd=_0x3ddb36[_0x4533('0x1e')];var _0x49fb91=_0x3d16a2?0x0:_0x4f732e['offset'];var _0x1abe1d=_0x3d16a2?_0x3ddb36[_0x4533('0x1e')]:_0x4f732e[_0x4533('0x1f')]+_0x4f732e[_0x4533('0x20')];var _0x6766eb;if(_0x1abe1d>=_0x1c5cdd){_0x1abe1d=_0x1c5cdd;_0x6766eb=0xc8;}else{_0x6766eb=0xce;}_0x3ed873[_0x4533('0x1b')](_0x6766eb);return _0x3ed873[_0x4533('0x21')]('Content-Range',_0x49fb91+'-'+_0x1abe1d+'/'+_0x1c5cdd)[_0x4533('0x22')](_0x3ddb36);}return null;};}function patchUpdates(_0xd55c04){return function(_0x2901f1){try{jsonpatch['apply'](_0x2901f1,_0xd55c04,!![]);}catch(_0x513011){return BPromise[_0x4533('0x23')](_0x513011);}return _0x2901f1[_0x4533('0x24')]();};}function saveUpdates(_0x4c640c,_0x5dcfd2){return function(_0x307bdd){if(_0x307bdd){return _0x307bdd[_0x4533('0x25')](_0x4c640c)[_0x4533('0x26')](function(_0x4d8189){return _0x4d8189;});}return null;};}function removeEntity(_0x44786f,_0x39b261){return function(_0x43eaa8){if(_0x43eaa8){return _0x43eaa8[_0x4533('0x27')]()[_0x4533('0x26')](function(){_0x44786f[_0x4533('0x1b')](0xcc)[_0x4533('0x1c')]();});}};}function handleEntityNotFound(_0x27b653,_0x45ad98){return function(_0x5f16bb){if(!_0x5f16bb){_0x27b653['sendStatus'](0x194);}return _0x5f16bb;};}function handleError(_0xa2e602,_0x5aaf2d){_0x5aaf2d=_0x5aaf2d||0x1f4;return function(_0x3fd76a){logger['error'](_0x3fd76a[_0x4533('0x28')]);if(_0x3fd76a[_0x4533('0x29')]){delete _0x3fd76a[_0x4533('0x29')];}_0xa2e602[_0x4533('0x1b')](_0x5aaf2d)[_0x4533('0x2a')](_0x3fd76a);};}exports[_0x4533('0x2b')]=function(_0xe584a2,_0xa58dd1){var _0x130566={'raw':![],'where':{'id':_0xe584a2[_0x4533('0x2c')]['id']}},_0x43682f={};_0x43682f[_0x4533('0x2d')]=_[_0x4533('0x2e')](db['DashboardItem'][_0x4533('0x2f')]);_0x43682f['query']=_[_0x4533('0x2e')](_0xe584a2[_0x4533('0x30')]);_0x43682f[_0x4533('0x31')]=_[_0x4533('0x32')](_0x43682f[_0x4533('0x2d')],_0x43682f[_0x4533('0x30')]);_0x130566[_0x4533('0x33')]=_[_0x4533('0x32')](_0x43682f[_0x4533('0x2d')],qs[_0x4533('0x34')](_0xe584a2[_0x4533('0x30')][_0x4533('0x34')]));_0x130566['attributes']=_0x130566[_0x4533('0x33')][_0x4533('0x35')]?_0x130566[_0x4533('0x33')]:_0x43682f[_0x4533('0x2d')];if(_0xe584a2[_0x4533('0x30')]['includeAll']){_0x130566[_0x4533('0x36')]=[{'all':!![]}];}_0x130566=_[_0x4533('0x37')]({},_0x130566,_0xe584a2[_0x4533('0x38')]);return db[_0x4533('0x39')][_0x4533('0x3a')](_0x130566)[_0x4533('0x26')](handleEntityNotFound(_0xa58dd1,null))['then'](respondWithResult(_0xa58dd1,null))[_0x4533('0x3b')](handleError(_0xa58dd1,null));};exports[_0x4533('0x27')]=function(_0x5d21f2,_0x3b6f10){return db[_0x4533('0x39')][_0x4533('0x3a')]({'where':{'id':_0x5d21f2[_0x4533('0x2c')]['id']}})[_0x4533('0x26')](handleEntityNotFound(_0x3b6f10,null))[_0x4533('0x26')](removeEntity(_0x3b6f10,null))[_0x4533('0x3b')](handleError(_0x3b6f10,null));};function widgetAttributes(_0x603753){try{switch(_0x603753[_0x4533('0x3c')]){case _0x4533('0x3d'):return[{'name':'attrUrl','value':_0x603753[_0x4533('0x3e')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x41')}];case _0x4533('0x42'):return[{'name':_0x4533('0x43'),'value':_0x603753[_0x4533('0x43')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x4533('0x44'),'value':_0x603753['attrHourFormat']||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x45')},{'name':_0x4533('0x46'),'value':_0x603753[_0x4533('0x46')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||_0x4533('0x47')},{'name':_0x4533('0x48'),'value':_0x603753['attrFontSize']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x2]?_0x603753['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4533('0x49'),'value':_0x603753[_0x4533('0x49')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753['attrs'][0x0][_0x4533('0x40')]:undefined)||_0x4533('0x4a')},{'name':_0x4533('0x4b'),'value':_0x603753[_0x4533('0x4b')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1]['value']:undefined)||[]},{'name':_0x4533('0x48'),'value':_0x603753['attrFontSize']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x2]?_0x603753[_0x4533('0x3f')][0x2][_0x4533('0x40')]:undefined)||0x14},{'name':_0x4533('0x4c'),'value':_0x603753['attrChannel']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x3]?_0x603753['attrs'][0x3][_0x4533('0x40')]:undefined)||_0x4533('0x4d')},{'name':'attrEmailAccounts','value':_0x603753['attrEmailAccounts']||(_0x603753['attrs']&&_0x603753['attrs'][0x4]?_0x603753['attrs'][0x4][_0x4533('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x603753[_0x4533('0x4e')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x5]?_0x603753['attrs'][0x5]['value']:undefined)||''},{'name':_0x4533('0x4f'),'value':_0x603753['attrSmsAccounts']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x6]?_0x603753[_0x4533('0x3f')][0x6][_0x4533('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x603753[_0x4533('0x50')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x7]?_0x603753[_0x4533('0x3f')][0x7][_0x4533('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x603753[_0x4533('0x51')]||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x8]?_0x603753[_0x4533('0x3f')][0x8][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x52'),'value':_0x603753[_0x4533('0x52')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x9]?_0x603753[_0x4533('0x3f')][0x9][_0x4533('0x40')]:undefined)||''}];case _0x4533('0x53'):case _0x4533('0x54'):return[{'name':_0x4533('0x55'),'value':_0x603753[_0x4533('0x55')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0][_0x4533('0x40')]:undefined)||'total'},{'name':_0x4533('0x56'),'value':_0x603753['attrSerie2']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||null},{'name':_0x4533('0x57'),'value':_0x603753['attrSerie3']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x2]?_0x603753['attrs'][0x2][_0x4533('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x603753[_0x4533('0x4b')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x3]?_0x603753[_0x4533('0x3f')][0x3][_0x4533('0x40')]:undefined)||[]},{'name':_0x4533('0x4c'),'value':_0x603753[_0x4533('0x4c')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x4]?_0x603753[_0x4533('0x3f')][0x4][_0x4533('0x40')]:undefined)||'voice'},{'name':_0x4533('0x58'),'value':_0x603753[_0x4533('0x58')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x5]?_0x603753[_0x4533('0x3f')][0x5][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x4e'),'value':_0x603753[_0x4533('0x4e')]||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x6]?_0x603753['attrs'][0x6]['value']:undefined)||''},{'name':_0x4533('0x4f'),'value':_0x603753[_0x4533('0x4f')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x7]?_0x603753[_0x4533('0x3f')][0x7][_0x4533('0x40')]:undefined)||''},{'name':_0x4533('0x50'),'value':_0x603753[_0x4533('0x50')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x8]?_0x603753[_0x4533('0x3f')][0x8]['value']:undefined)||''},{'name':_0x4533('0x51'),'value':_0x603753['attrWhatsappAccounts']||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x9]?_0x603753[_0x4533('0x3f')][0x9]['value']:undefined)||''},{'name':_0x4533('0x52'),'value':_0x603753[_0x4533('0x52')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0xa]?_0x603753[_0x4533('0x3f')][0xa][_0x4533('0x40')]:undefined)||''}];case _0x4533('0x59'):return[{'name':_0x4533('0x5a'),'type':_0x603753['reportType']||(_0x603753['attrs']&&_0x603753[_0x4533('0x3f')][0x0]?_0x603753[_0x4533('0x3f')][0x0]['type']:undefined)||null,'value':_0x603753[_0x4533('0x5a')]||(_0x603753[_0x4533('0x3f')]&&_0x603753['attrs'][0x0]?_0x603753['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x603753[_0x4533('0x5b')]||(_0x603753[_0x4533('0x3f')]&&_0x603753[_0x4533('0x3f')][0x1]?_0x603753[_0x4533('0x3f')][0x1][_0x4533('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xbf35f7){logger[_0x4533('0x5c')](_0x4533('0x5d'),JSON['stringify'](_0xbf35f7));return[];}}exports[_0x4533('0x5e')]=function(_0x1bd2da,_0x1b0414){if(_0x1bd2da[_0x4533('0x5f')]){_0x1bd2da['body']['attrs']=widgetAttributes(_0x1bd2da['body']);}return db[_0x4533('0x39')]['create'](_0x1bd2da[_0x4533('0x5f')],{})[_0x4533('0x26')](respondWithResult(_0x1b0414,0xc9))[_0x4533('0x3b')](handleError(_0x1b0414,null));};exports['update']=function(_0x31b10f,_0x50497f){if(_0x31b10f[_0x4533('0x5f')]['id']){delete _0x31b10f['body']['id'];}_0x31b10f[_0x4533('0x5f')][_0x4533('0x3f')]=widgetAttributes(_0x31b10f[_0x4533('0x5f')]);return db[_0x4533('0x39')][_0x4533('0x3a')]({'where':{'id':_0x31b10f['params']['id']}})[_0x4533('0x26')](handleEntityNotFound(_0x50497f,null))['then'](saveUpdates(_0x31b10f[_0x4533('0x5f')],null))[_0x4533('0x26')](respondWithResult(_0x50497f,null))['catch'](handleError(_0x50497f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d311471..03ea5b3 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 _0x64ff=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x2093be,_0x44cf8f){var _0x5a609e=function(_0x59e247){while(--_0x59e247){_0x2093be['push'](_0x2093be['shift']());}};_0x5a609e(++_0x44cf8f);}(_0x64ff,0x9f));var _0xf64f=function(_0x4266a2,_0x2634de){_0x4266a2=_0x4266a2-0x0;var _0x2e5b45=_0x64ff[_0x4266a2];return _0x2e5b45;};'use strict';var EventEmitter=require(_0xf64f('0x0'));var DashboardItem=require(_0xf64f('0x1'))['db'][_0xf64f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf64f('0x3')](0x0);var events={'afterCreate':_0xf64f('0x4'),'afterUpdate':_0xf64f('0x5'),'afterDestroy':_0xf64f('0x6')};function emitEvent(_0x56228d){return function(_0x3ad83a,_0x4a1c6f,_0x13fbc6){DashboardItemEvents[_0xf64f('0x7')](_0x56228d+':'+_0x3ad83a['id'],_0x3ad83a);DashboardItemEvents[_0xf64f('0x7')](_0x56228d,_0x3ad83a);_0x13fbc6(null);};}for(var e in events){if(events[_0xf64f('0x8')](e)){var event=events[e];DashboardItem[_0xf64f('0x9')](e,emitEvent(event));}}module[_0xf64f('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x69d9=['events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x69d9,0x120));var _0x969d=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x69d9[_0x919445];return _0x511b3e;};'use strict';var EventEmitter=require(_0x969d('0x0'));var DashboardItem=require(_0x969d('0x1'))['db'][_0x969d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x969d('0x3')](0x0);var events={'afterCreate':_0x969d('0x4'),'afterUpdate':'update','afterDestroy':_0x969d('0x5')};function emitEvent(_0xf08f6c){return function(_0x36a15c,_0x5ba932,_0x4af266){DashboardItemEvents[_0x969d('0x6')](_0xf08f6c+':'+_0x36a15c['id'],_0x36a15c);DashboardItemEvents[_0x969d('0x6')](_0xf08f6c,_0x36a15c);_0x4af266(null);};}for(var e in events){if(events[_0x969d('0x7')](e)){var event=events[e];DashboardItem[_0x969d('0x8')](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 58a16c5..ccb4e48 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 _0x62dd=['exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4b6887,_0x96c4b7){var _0x2bf120=function(_0x9c70c){while(--_0x9c70c){_0x4b6887['push'](_0x4b6887['shift']());}};_0x2bf120(++_0x96c4b7);}(_0x62dd,0x6c));var _0xd62d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var logger=require(_0xd62d('0x2'))(_0xd62d('0x3'));var moment=require(_0xd62d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd62d('0x5'));var fs=require('fs');var path=require(_0xd62d('0x6'));var rimraf=require(_0xd62d('0x7'));var config=require(_0xd62d('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xd62d('0x9')]=function(_0x5326fa,_0x11adaf){return _0x5326fa[_0xd62d('0xa')](_0xd62d('0xb'),attributes,{'tableName':_0xd62d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27f6=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x5473fb,_0xed1069){var _0x4f4e6a=function(_0x47ee32){while(--_0x47ee32){_0x5473fb['push'](_0x5473fb['shift']());}};_0x4f4e6a(++_0xed1069);}(_0x27f6,0x170));var _0x627f=function(_0x364d4e,_0x47cb7d){_0x364d4e=_0x364d4e-0x0;var _0x51ade2=_0x27f6[_0x364d4e];return _0x51ade2;};'use strict';var _=require('lodash');var util=require(_0x627f('0x0'));var logger=require(_0x627f('0x1'))('api');var moment=require(_0x627f('0x2'));var BPromise=require(_0x627f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x627f('0x4'));var rimraf=require(_0x627f('0x5'));var config=require(_0x627f('0x6'));var attributes=require(_0x627f('0x7'));module[_0x627f('0x8')]=function(_0x180513,_0x250ddf){return _0x180513[_0x627f('0x9')](_0x627f('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 89f19f3..1e7a3e6 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 _0x96ce=['socket.io-emitter','./dashboardItem.socket','register','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x4b4eb5,_0xfa1419){var _0x12b8ad=function(_0x3e8dd5){while(--_0x3e8dd5){_0x4b4eb5['push'](_0x4b4eb5['shift']());}};_0x12b8ad(++_0xfa1419);}(_0x96ce,0x1a4));var _0xe96c=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x96ce[_0x33154d];return _0x3b2f03;};'use strict';var _=require(_0xe96c('0x0'));var util=require('util');var moment=require(_0xe96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe96c('0x2'));var fs=require('fs');var Redis=require(_0xe96c('0x3'));var db=require(_0xe96c('0x4'))['db'];var utils=require(_0xe96c('0x5'));var logger=require(_0xe96c('0x6'))(_0xe96c('0x7'));var config=require(_0xe96c('0x8'));var jayson=require(_0xe96c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe96c('0xa')]=_[_0xe96c('0xb')](config[_0xe96c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe96c('0xc'))(new Redis(config[_0xe96c('0xa')]));require(_0xe96c('0xd'))[_0xe96c('0xe')](socket);function respondWithRpcPromise(_0x1c6aff,_0x3b7b32,_0x38185e){return new BPromise(function(_0x51065c,_0x1dbd3c){return client['request'](_0x1c6aff,_0x38185e)[_0xe96c('0xf')](function(_0x56d19a){logger['info'](_0xe96c('0x10'),_0x3b7b32,'request\x20sent');logger[_0xe96c('0x11')](_0xe96c('0x12'),_0x3b7b32,'request\x20sent',JSON[_0xe96c('0x13')](_0x56d19a));if(_0x56d19a['error']){if(_0x56d19a[_0xe96c('0x14')]['code']===0x1f4){logger[_0xe96c('0x14')](_0xe96c('0x10'),_0x3b7b32,_0x56d19a[_0xe96c('0x14')][_0xe96c('0x15')]);return _0x1dbd3c(_0x56d19a[_0xe96c('0x14')][_0xe96c('0x15')]);}logger['error'](_0xe96c('0x10'),_0x3b7b32,_0x56d19a[_0xe96c('0x14')]['message']);return _0x51065c(_0x56d19a[_0xe96c('0x14')][_0xe96c('0x15')]);}else{logger['info'](_0xe96c('0x10'),_0x3b7b32,_0xe96c('0x16'));_0x51065c(_0x56d19a['result'][_0xe96c('0x15')]);}})[_0xe96c('0x17')](function(_0x230a25){logger['error'](_0xe96c('0x10'),_0x3b7b32,_0x230a25);_0x1dbd3c(_0x230a25);});});} \ No newline at end of file +var _0xdddf=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0xdddf,0x10d));var _0xfddd=function(_0x59f58c,_0x6a6330){_0x59f58c=_0x59f58c-0x0;var _0x56b89c=_0xdddf[_0x59f58c];return _0x56b89c;};'use strict';var _=require('lodash');var util=require(_0xfddd('0x0'));var moment=require(_0xfddd('0x1'));var BPromise=require(_0xfddd('0x2'));var rs=require(_0xfddd('0x3'));var fs=require('fs');var Redis=require(_0xfddd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfddd('0x5'));var logger=require(_0xfddd('0x6'))(_0xfddd('0x7'));var config=require('../../config/environment');var jayson=require(_0xfddd('0x8'));var client=jayson[_0xfddd('0x9')][_0xfddd('0xa')]({'port':0x232a});config[_0xfddd('0xb')]=_[_0xfddd('0xc')](config[_0xfddd('0xb')],{'host':_0xfddd('0xd'),'port':0x18eb});var socket=require(_0xfddd('0xe'))(new Redis(config['redis']));require(_0xfddd('0xf'))[_0xfddd('0x10')](socket);function respondWithRpcPromise(_0x5a8eb2,_0x104533,_0x4cdb81){return new BPromise(function(_0x2a1fd9,_0x5c3033){return client[_0xfddd('0x11')](_0x5a8eb2,_0x4cdb81)[_0xfddd('0x12')](function(_0x421bfd){logger[_0xfddd('0x13')](_0xfddd('0x14'),_0x104533,_0xfddd('0x15'));logger[_0xfddd('0x16')](_0xfddd('0x17'),_0x104533,_0xfddd('0x15'),JSON[_0xfddd('0x18')](_0x421bfd));if(_0x421bfd[_0xfddd('0x19')]){if(_0x421bfd[_0xfddd('0x19')][_0xfddd('0x1a')]===0x1f4){logger[_0xfddd('0x19')](_0xfddd('0x14'),_0x104533,_0x421bfd[_0xfddd('0x19')][_0xfddd('0x1b')]);return _0x5c3033(_0x421bfd[_0xfddd('0x19')]['message']);}logger[_0xfddd('0x19')]('DashboardItem,\x20%s,\x20%s',_0x104533,_0x421bfd['error'][_0xfddd('0x1b')]);return _0x2a1fd9(_0x421bfd[_0xfddd('0x19')][_0xfddd('0x1b')]);}else{logger[_0xfddd('0x13')](_0xfddd('0x14'),_0x104533,_0xfddd('0x15'));_0x2a1fd9(_0x421bfd['result'][_0xfddd('0x1b')]);}})[_0xfddd('0x1c')](function(_0x3bff43){logger['error'](_0xfddd('0x14'),_0x104533,_0x3bff43);_0x5c3033(_0x3bff43);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 2e02c16..3f03d79 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 _0x7e3d=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x1dc708,_0x440805){var _0x8e7554=function(_0xa20f7){while(--_0xa20f7){_0x1dc708['push'](_0x1dc708['shift']());}};_0x8e7554(++_0x440805);}(_0x7e3d,0x1ab));var _0xd7e3=function(_0x22b64b,_0x5de02f){_0x22b64b=_0x22b64b-0x0;var _0x2b24de=_0x7e3d[_0x22b64b];return _0x2b24de;};'use strict';var DashboardItemEvents=require(_0xd7e3('0x0'));var events=[_0xd7e3('0x1'),_0xd7e3('0x2'),_0xd7e3('0x3')];function createListener(_0x48ed29,_0x3a1197){return function(_0x41b88f){_0x3a1197[_0xd7e3('0x4')](_0x48ed29,_0x41b88f);};}function removeListener(_0x2f5775,_0x4bc3bb){return function(){DashboardItemEvents[_0xd7e3('0x5')](_0x2f5775,_0x4bc3bb);};}exports[_0xd7e3('0x6')]=function(_0x4412fd){for(var _0x36b263=0x0,_0x311468=events[_0xd7e3('0x7')];_0x36b263<_0x311468;_0x36b263++){var _0x33c04f=events[_0x36b263];var _0x21b37b=createListener(_0xd7e3('0x8')+_0x33c04f,_0x4412fd);DashboardItemEvents['on'](_0x33c04f,_0x21b37b);}}; \ No newline at end of file +var _0x1a1f=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a1f,0xf4));var _0xf1a1=function(_0x1ee45a,_0x5c1772){_0x1ee45a=_0x1ee45a-0x0;var _0x20a630=_0x1a1f[_0x1ee45a];return _0x20a630;};'use strict';var DashboardItemEvents=require(_0xf1a1('0x0'));var events=['save',_0xf1a1('0x1'),_0xf1a1('0x2')];function createListener(_0x12e8d5,_0x19dea6){return function(_0x3e1a21){_0x19dea6['emit'](_0x12e8d5,_0x3e1a21);};}function removeListener(_0x17294f,_0x2c20e6){return function(){DashboardItemEvents[_0xf1a1('0x3')](_0x17294f,_0x2c20e6);};}exports[_0xf1a1('0x4')]=function(_0x40993e){for(var _0x3afe35=0x0,_0x3e67ba=events[_0xf1a1('0x5')];_0x3afe35<_0x3e67ba;_0x3afe35++){var _0x190016=events[_0x3afe35];var _0x42b99c=createListener(_0xf1a1('0x6')+_0x190016,_0x40993e);DashboardItemEvents['on'](_0x190016,_0x42b99c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 8385375..1709af0 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 _0x8303=['../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x411f4a,_0x3a9c88){var _0x5a43ba=function(_0x22edd7){while(--_0x22edd7){_0x411f4a['push'](_0x411f4a['shift']());}};_0x5a43ba(++_0x3a9c88);}(_0x8303,0x160));var _0x3830=function(_0x10e44b,_0x4f791b){_0x10e44b=_0x10e44b-0x0;var _0x50e33d=_0x8303[_0x10e44b];return _0x50e33d;};'use strict';var multer=require(_0x3830('0x0'));var util=require(_0x3830('0x1'));var path=require(_0x3830('0x2'));var timeout=require(_0x3830('0x3'));var express=require(_0x3830('0x4'));var router=express['Router']();var fs_extra=require(_0x3830('0x5'));var auth=require(_0x3830('0x6'));var interaction=require(_0x3830('0x7'));var config=require(_0x3830('0x8'));var controller=require(_0x3830('0x9'));router[_0x3830('0xa')](_0x3830('0xb'),auth['isAuthenticated'](),controller[_0x3830('0xc')]);router[_0x3830('0xd')]('/',auth[_0x3830('0xe')](),controller[_0x3830('0xf')]);router[_0x3830('0x10')](_0x3830('0xb'),auth[_0x3830('0xe')](),controller[_0x3830('0x11')]);router['delete'](_0x3830('0xb'),auth['isAuthenticated'](),controller[_0x3830('0x12')]);module[_0x3830('0x13')]=router; \ No newline at end of file +var _0xe9d2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','destroy','exports','connect-timeout','express'];(function(_0x3dc7b6,_0x46ef61){var _0x12b8d7=function(_0x30489e){while(--_0x30489e){_0x3dc7b6['push'](_0x3dc7b6['shift']());}};_0x12b8d7(++_0x46ef61);}(_0xe9d2,0x191));var _0x2e9d=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xe9d2[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2e9d('0x0'));var express=require(_0x2e9d('0x1'));var router=express[_0x2e9d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2e9d('0x3'));var interaction=require(_0x2e9d('0x4'));var config=require(_0x2e9d('0x5'));var controller=require('./dashboardItem.controller');router['get'](_0x2e9d('0x6'),auth[_0x2e9d('0x7')](),controller[_0x2e9d('0x8')]);router[_0x2e9d('0x9')]('/',auth['isAuthenticated'](),controller[_0x2e9d('0xa')]);router['put'](_0x2e9d('0x6'),auth[_0x2e9d('0x7')](),controller['update']);router['delete']('/:id',auth[_0x2e9d('0x7')](),controller[_0x2e9d('0xb')]);module[_0x2e9d('0xc')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 11b03de..7ba9bb4 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 _0x7084=['first','second','third','STRING','exports'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7084,0xf4));var _0x4708=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x7084[_0x282320];return _0x271d54;};'use strict';var Sequelize=require('sequelize');module[_0x4708('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4708('0x1'),_0x4708('0x2'),_0x4708('0x3')),'allowNull':![],'defaultValue':_0x4708('0x1')},'description':{'type':Sequelize[_0x4708('0x4')]}}; \ No newline at end of file +var _0x5bf1=['STRING','sequelize','exports','ENUM','second','third'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0x5bf1,0xa9));var _0x15bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bf1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x15bf('0x0'));module[_0x15bf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x15bf('0x2')]('first',_0x15bf('0x3'),_0x15bf('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x15bf('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1765f3e..e15f9e5 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 _0x2cd3=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','body','role','user','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x2d5934,_0x1acc4f){var _0x5807c8=function(_0x326cc5){while(--_0x326cc5){_0x2d5934['push'](_0x2d5934['shift']());}};_0x5807c8(++_0x1acc4f);}(_0x2cd3,0xf1));var _0x32cd=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x2cd3[_0x1e2321];return _0x1d346d;};'use strict';var emlformat=require(_0x32cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32cd('0x1'));var jsonpatch=require(_0x32cd('0x2'));var rp=require(_0x32cd('0x3'));var moment=require(_0x32cd('0x4'));var BPromise=require(_0x32cd('0x5'));var Mustache=require(_0x32cd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x32cd('0x7'));var csv=require(_0x32cd('0x8'));var ejs=require(_0x32cd('0x9'));var fs=require('fs');var fs_extra=require(_0x32cd('0xa'));var _=require(_0x32cd('0xb'));var squel=require(_0x32cd('0xc'));var crypto=require(_0x32cd('0xd'));var jsforce=require(_0x32cd('0xe'));var deskjs=require(_0x32cd('0xf'));var toCsv=require(_0x32cd('0x8'));var querystring=require(_0x32cd('0x10'));var Papa=require(_0x32cd('0x11'));var Redis=require(_0x32cd('0x12'));var authService=require(_0x32cd('0x13'));var qs=require(_0x32cd('0x14'));var as=require(_0x32cd('0x15'));var hardwareService=require(_0x32cd('0x16'));var logger=require(_0x32cd('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x32cd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27db2b,_0x4610ed){_0x4610ed=_0x4610ed||0xcc;return function(_0x459f80){if(_0x459f80){return _0x27db2b[_0x32cd('0x19')](_0x4610ed);}return _0x27db2b[_0x32cd('0x1a')](_0x4610ed)[_0x32cd('0x1b')]();};}function respondWithResult(_0x3ce589,_0x542a02){_0x542a02=_0x542a02||0xc8;return function(_0x51b452){if(_0x51b452){return _0x3ce589[_0x32cd('0x1a')](_0x542a02)[_0x32cd('0x1c')](_0x51b452);}};}function respondWithFilteredResult(_0x149448,_0x440984){return function(_0x4a14b5){if(_0x4a14b5){var _0x3a542b=typeof _0x440984['offset']==='undefined'&&typeof _0x440984[_0x32cd('0x1d')]===_0x32cd('0x1e');var _0x3f9c9c=_0x4a14b5[_0x32cd('0x1f')];var _0x4690c9=_0x3a542b?0x0:_0x440984[_0x32cd('0x20')];var _0x4bfabf=_0x3a542b?_0x4a14b5[_0x32cd('0x1f')]:_0x440984[_0x32cd('0x20')]+_0x440984[_0x32cd('0x1d')];var _0x5d36c9;if(_0x4bfabf>=_0x3f9c9c){_0x4bfabf=_0x3f9c9c;_0x5d36c9=0xc8;}else{_0x5d36c9=0xce;}_0x149448['status'](_0x5d36c9);return _0x149448[_0x32cd('0x21')](_0x32cd('0x22'),_0x4690c9+'-'+_0x4bfabf+'/'+_0x3f9c9c)[_0x32cd('0x1c')](_0x4a14b5);}return null;};}function patchUpdates(_0x19ab29){return function(_0x14b3fe){try{jsonpatch['apply'](_0x14b3fe,_0x19ab29,!![]);}catch(_0x4311cb){return BPromise[_0x32cd('0x23')](_0x4311cb);}return _0x14b3fe[_0x32cd('0x24')]();};}function saveUpdates(_0x1a50a6,_0x3bc9c8){return function(_0x192b1d){if(_0x192b1d){return _0x192b1d[_0x32cd('0x25')](_0x1a50a6)[_0x32cd('0x26')](function(_0x575f97){return _0x575f97;});}return null;};}function removeEntity(_0x3eb73c,_0x5ddfaa){return function(_0x4c7f55){if(_0x4c7f55){return _0x4c7f55[_0x32cd('0x27')]()['then'](function(){var _0x5c0dc1=_0x4c7f55[_0x32cd('0x28')]({'plain':!![]});var _0x57782c='Dispositions';return db['UserProfileResource'][_0x32cd('0x27')]({'where':{'type':_0x57782c,'resourceId':_0x5c0dc1['id']}})[_0x32cd('0x26')](function(){return _0x4c7f55;});})[_0x32cd('0x26')](function(){_0x3eb73c[_0x32cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a5c8,_0x4b9ee1){return function(_0x321d71){if(!_0x321d71){_0x58a5c8[_0x32cd('0x19')](0x194);}return _0x321d71;};}function handleError(_0x5ef889,_0x39fd04){_0x39fd04=_0x39fd04||0x1f4;return function(_0x35f798){logger[_0x32cd('0x29')](_0x35f798[_0x32cd('0x2a')]);if(_0x35f798[_0x32cd('0x2b')]){delete _0x35f798[_0x32cd('0x2b')];}_0x5ef889['status'](_0x39fd04)[_0x32cd('0x2c')](_0x35f798);};}exports[_0x32cd('0x2d')]=function(_0x9d4aaa,_0x20365c){var _0x387f2a={},_0x1232f1={},_0x5053ff={'count':0x0,'rows':[]};var _0x576cb2=_[_0x32cd('0x2e')](db[_0x32cd('0x2f')][_0x32cd('0x30')],function(_0x42385a){return{'name':_0x42385a[_0x32cd('0x31')],'type':_0x42385a['type'][_0x32cd('0x32')]};});_0x1232f1[_0x32cd('0x33')]=_['map'](_0x576cb2,_0x32cd('0x2b'));_0x1232f1[_0x32cd('0x34')]=_[_0x32cd('0x35')](_0x9d4aaa[_0x32cd('0x34')]);_0x1232f1[_0x32cd('0x36')]=_[_0x32cd('0x37')](_0x1232f1[_0x32cd('0x33')],_0x1232f1[_0x32cd('0x34')]);_0x387f2a[_0x32cd('0x38')]=_[_0x32cd('0x37')](_0x1232f1[_0x32cd('0x33')],qs[_0x32cd('0x39')](_0x9d4aaa[_0x32cd('0x34')]['fields']));_0x387f2a[_0x32cd('0x38')]=_0x387f2a[_0x32cd('0x38')][_0x32cd('0x3a')]?_0x387f2a[_0x32cd('0x38')]:_0x1232f1['model'];if(!_0x9d4aaa['query'][_0x32cd('0x3b')](_0x32cd('0x3c'))){_0x387f2a[_0x32cd('0x1d')]=qs['limit'](_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x1d')]);_0x387f2a[_0x32cd('0x20')]=qs[_0x32cd('0x20')](_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x20')]);}_0x387f2a[_0x32cd('0x3d')]=qs[_0x32cd('0x3e')](_0x9d4aaa[_0x32cd('0x34')]['sort']);_0x387f2a[_0x32cd('0x3f')]=qs['filters'](_[_0x32cd('0x40')](_0x9d4aaa[_0x32cd('0x34')],_0x1232f1[_0x32cd('0x36')]),_0x576cb2);if(_0x9d4aaa[_0x32cd('0x34')]['filter']){_0x387f2a[_0x32cd('0x3f')]=_[_0x32cd('0x41')](_0x387f2a[_0x32cd('0x3f')],{'$or':_[_0x32cd('0x2e')](_0x576cb2,function(_0x3a06e5){if(_0x3a06e5[_0x32cd('0x42')]!==_0x32cd('0x43')){var _0x7c62e0={};_0x7c62e0[_0x3a06e5[_0x32cd('0x2b')]]={'$like':'%'+_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x44')]+'%'};return _0x7c62e0;}})});}_0x387f2a=_[_0x32cd('0x41')]({},_0x387f2a,_0x9d4aaa[_0x32cd('0x45')]);var _0xdf4d2={'where':_0x387f2a[_0x32cd('0x3f')]};return db[_0x32cd('0x2f')][_0x32cd('0x1f')](_0xdf4d2)['then'](function(_0x285a48){_0x5053ff[_0x32cd('0x1f')]=_0x285a48;if(_0x9d4aaa['query'][_0x32cd('0x46')]){_0x387f2a[_0x32cd('0x47')]=[{'all':!![]}];}return db[_0x32cd('0x2f')]['findAll'](_0x387f2a);})['then'](function(_0x469fa2){_0x5053ff[_0x32cd('0x48')]=_0x469fa2;return _0x5053ff;})[_0x32cd('0x26')](respondWithFilteredResult(_0x20365c,_0x387f2a))[_0x32cd('0x49')](handleError(_0x20365c,null));};exports['show']=function(_0x2f1acd,_0x3c34b9){var _0x2f4eec={'raw':!![],'where':{'id':_0x2f1acd[_0x32cd('0x4a')]['id']}},_0x1d4f10={};_0x1d4f10[_0x32cd('0x33')]=_[_0x32cd('0x35')](db['Disposition'][_0x32cd('0x30')]);_0x1d4f10[_0x32cd('0x34')]=_['keys'](_0x2f1acd[_0x32cd('0x34')]);_0x1d4f10[_0x32cd('0x36')]=_['intersection'](_0x1d4f10[_0x32cd('0x33')],_0x1d4f10[_0x32cd('0x34')]);_0x2f4eec['attributes']=_[_0x32cd('0x37')](_0x1d4f10[_0x32cd('0x33')],qs[_0x32cd('0x39')](_0x2f1acd['query'][_0x32cd('0x39')]));_0x2f4eec[_0x32cd('0x38')]=_0x2f4eec[_0x32cd('0x38')]['length']?_0x2f4eec[_0x32cd('0x38')]:_0x1d4f10[_0x32cd('0x33')];if(_0x2f1acd[_0x32cd('0x34')][_0x32cd('0x46')]){_0x2f4eec[_0x32cd('0x47')]=[{'all':!![]}];}_0x2f4eec=_[_0x32cd('0x41')]({},_0x2f4eec,_0x2f1acd[_0x32cd('0x45')]);return db['Disposition'][_0x32cd('0x4b')](_0x2f4eec)['then'](handleEntityNotFound(_0x3c34b9,null))[_0x32cd('0x26')](respondWithResult(_0x3c34b9,null))[_0x32cd('0x49')](handleError(_0x3c34b9,null));};exports['create']=function(_0x88b34b,_0x27aabc){return db[_0x32cd('0x2f')][_0x32cd('0x4c')](_0x88b34b[_0x32cd('0x4d')],{})[_0x32cd('0x26')](function(_0x3360cb){var _0xa145df=_0x88b34b['user'][_0x32cd('0x28')]({'plain':!![]});if(!_0xa145df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa145df[_0x32cd('0x4e')]===_0x32cd('0x4f')){var _0x45f485=_0x3360cb[_0x32cd('0x28')]({'plain':!![]});var _0x31f5db=_0x32cd('0x50');return db[_0x32cd('0x51')][_0x32cd('0x4b')]({'where':{'name':_0x31f5db,'userProfileId':_0xa145df['userProfileId']},'raw':!![]})[_0x32cd('0x26')](function(_0xd5f7d9){if(_0xd5f7d9&&_0xd5f7d9[_0x32cd('0x52')]===0x0){return db['UserProfileResource'][_0x32cd('0x4c')]({'name':_0x45f485[_0x32cd('0x2b')],'resourceId':_0x45f485['id'],'type':_0xd5f7d9[_0x32cd('0x2b')],'sectionId':_0xd5f7d9['id']},{})['then'](function(){return _0x3360cb;});}else{return _0x3360cb;}})['catch'](function(_0x300baf){logger['error'](_0x32cd('0x53'),_0x300baf);throw _0x300baf;});}return _0x3360cb;})[_0x32cd('0x26')](respondWithResult(_0x27aabc,0xc9))['catch'](handleError(_0x27aabc,null));};exports['update']=function(_0x4a036f,_0x1c7b25){if(_0x4a036f['body']['id']){delete _0x4a036f['body']['id'];}return db[_0x32cd('0x2f')][_0x32cd('0x4b')]({'where':{'id':_0x4a036f[_0x32cd('0x4a')]['id']}})[_0x32cd('0x26')](handleEntityNotFound(_0x1c7b25,null))[_0x32cd('0x26')](saveUpdates(_0x4a036f[_0x32cd('0x4d')],null))[_0x32cd('0x26')](respondWithResult(_0x1c7b25,null))[_0x32cd('0x49')](handleError(_0x1c7b25,null));};exports['destroy']=function(_0x4d217e,_0x3bccbf){return db[_0x32cd('0x2f')]['find']({'where':{'id':_0x4d217e[_0x32cd('0x4a')]['id']}})[_0x32cd('0x26')](handleEntityNotFound(_0x3bccbf,null))['then'](removeEntity(_0x3bccbf,null))[_0x32cd('0x49')](handleError(_0x3bccbf,null));}; \ No newline at end of file +var _0x4f80=['destroy','then','get','Dispositions','UserProfileResource','end','name','send','index','map','Disposition','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x4f80,0xcb));var _0x04f8=function(_0x3c5fec,_0x4fecdf){_0x3c5fec=_0x3c5fec-0x0;var _0x47eafa=_0x4f80[_0x3c5fec];return _0x47eafa;};'use strict';var emlformat=require(_0x04f8('0x0'));var rimraf=require(_0x04f8('0x1'));var zipdir=require(_0x04f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04f8('0x3'));var moment=require(_0x04f8('0x4'));var BPromise=require(_0x04f8('0x5'));var Mustache=require(_0x04f8('0x6'));var util=require(_0x04f8('0x7'));var path=require(_0x04f8('0x8'));var sox=require('sox');var csv=require(_0x04f8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04f8('0xa'));var squel=require('squel');var crypto=require(_0x04f8('0xb'));var jsforce=require(_0x04f8('0xc'));var deskjs=require(_0x04f8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x04f8('0xe'));var Redis=require(_0x04f8('0xf'));var authService=require(_0x04f8('0x10'));var qs=require(_0x04f8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04f8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x04f8('0x13'));var config=require(_0x04f8('0x14'));var licenseUtil=require(_0x04f8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ecaa9,_0x3bb767){_0x3bb767=_0x3bb767||0xcc;return function(_0x227442){if(_0x227442){return _0x5ecaa9[_0x04f8('0x16')](_0x3bb767);}return _0x5ecaa9[_0x04f8('0x17')](_0x3bb767)['end']();};}function respondWithResult(_0x19f1d2,_0x2e994c){_0x2e994c=_0x2e994c||0xc8;return function(_0x631325){if(_0x631325){return _0x19f1d2[_0x04f8('0x17')](_0x2e994c)[_0x04f8('0x18')](_0x631325);}};}function respondWithFilteredResult(_0xb9dbdd,_0x27c2c1){return function(_0x304e76){if(_0x304e76){var _0x3809d0=typeof _0x27c2c1[_0x04f8('0x19')]===_0x04f8('0x1a')&&typeof _0x27c2c1[_0x04f8('0x1b')]===_0x04f8('0x1a');var _0x3d75bd=_0x304e76[_0x04f8('0x1c')];var _0x1cd7c6=_0x3809d0?0x0:_0x27c2c1['offset'];var _0x3a10d1=_0x3809d0?_0x304e76[_0x04f8('0x1c')]:_0x27c2c1[_0x04f8('0x19')]+_0x27c2c1[_0x04f8('0x1b')];var _0x421a8c;if(_0x3a10d1>=_0x3d75bd){_0x3a10d1=_0x3d75bd;_0x421a8c=0xc8;}else{_0x421a8c=0xce;}_0xb9dbdd['status'](_0x421a8c);return _0xb9dbdd[_0x04f8('0x1d')](_0x04f8('0x1e'),_0x1cd7c6+'-'+_0x3a10d1+'/'+_0x3d75bd)['json'](_0x304e76);}return null;};}function patchUpdates(_0x50bc5e){return function(_0x22bd46){try{jsonpatch[_0x04f8('0x1f')](_0x22bd46,_0x50bc5e,!![]);}catch(_0xe02074){return BPromise['reject'](_0xe02074);}return _0x22bd46[_0x04f8('0x20')]();};}function saveUpdates(_0xb7477b,_0x3cebfe){return function(_0x1ef3cc){if(_0x1ef3cc){return _0x1ef3cc[_0x04f8('0x21')](_0xb7477b)['then'](function(_0x29d6c4){return _0x29d6c4;});}return null;};}function removeEntity(_0x38e678,_0x59cbec){return function(_0x3edd6f){if(_0x3edd6f){return _0x3edd6f[_0x04f8('0x22')]()[_0x04f8('0x23')](function(){var _0x401a57=_0x3edd6f[_0x04f8('0x24')]({'plain':!![]});var _0x7d8616=_0x04f8('0x25');return db[_0x04f8('0x26')]['destroy']({'where':{'type':_0x7d8616,'resourceId':_0x401a57['id']}})[_0x04f8('0x23')](function(){return _0x3edd6f;});})[_0x04f8('0x23')](function(){_0x38e678[_0x04f8('0x17')](0xcc)[_0x04f8('0x27')]();});}};}function handleEntityNotFound(_0x16eea1,_0x5a8c66){return function(_0x53ebe2){if(!_0x53ebe2){_0x16eea1['sendStatus'](0x194);}return _0x53ebe2;};}function handleError(_0x526c05,_0x24533e){_0x24533e=_0x24533e||0x1f4;return function(_0x21c7c2){logger['error'](_0x21c7c2['stack']);if(_0x21c7c2[_0x04f8('0x28')]){delete _0x21c7c2[_0x04f8('0x28')];}_0x526c05[_0x04f8('0x17')](_0x24533e)[_0x04f8('0x29')](_0x21c7c2);};}exports[_0x04f8('0x2a')]=function(_0x272166,_0x3876a2){var _0x12f706={},_0x5cb637={},_0x59e7d7={'count':0x0,'rows':[]};var _0x2e507d=_[_0x04f8('0x2b')](db[_0x04f8('0x2c')]['rawAttributes'],function(_0x16c88e){return{'name':_0x16c88e['fieldName'],'type':_0x16c88e[_0x04f8('0x2d')][_0x04f8('0x2e')]};});_0x5cb637['model']=_[_0x04f8('0x2b')](_0x2e507d,_0x04f8('0x28'));_0x5cb637['query']=_[_0x04f8('0x2f')](_0x272166[_0x04f8('0x30')]);_0x5cb637[_0x04f8('0x31')]=_['intersection'](_0x5cb637[_0x04f8('0x32')],_0x5cb637[_0x04f8('0x30')]);_0x12f706[_0x04f8('0x33')]=_[_0x04f8('0x34')](_0x5cb637[_0x04f8('0x32')],qs[_0x04f8('0x35')](_0x272166[_0x04f8('0x30')][_0x04f8('0x35')]));_0x12f706[_0x04f8('0x33')]=_0x12f706[_0x04f8('0x33')][_0x04f8('0x36')]?_0x12f706[_0x04f8('0x33')]:_0x5cb637['model'];if(!_0x272166['query'][_0x04f8('0x37')](_0x04f8('0x38'))){_0x12f706[_0x04f8('0x1b')]=qs[_0x04f8('0x1b')](_0x272166[_0x04f8('0x30')][_0x04f8('0x1b')]);_0x12f706['offset']=qs['offset'](_0x272166['query']['offset']);}_0x12f706[_0x04f8('0x39')]=qs[_0x04f8('0x3a')](_0x272166[_0x04f8('0x30')][_0x04f8('0x3a')]);_0x12f706[_0x04f8('0x3b')]=qs[_0x04f8('0x31')](_[_0x04f8('0x3c')](_0x272166['query'],_0x5cb637[_0x04f8('0x31')]),_0x2e507d);if(_0x272166[_0x04f8('0x30')]['filter']){_0x12f706[_0x04f8('0x3b')]=_['merge'](_0x12f706['where'],{'$or':_[_0x04f8('0x2b')](_0x2e507d,function(_0x361746){if(_0x361746[_0x04f8('0x2d')]!==_0x04f8('0x3d')){var _0x292c1e={};_0x292c1e[_0x361746[_0x04f8('0x28')]]={'$like':'%'+_0x272166[_0x04f8('0x30')][_0x04f8('0x3e')]+'%'};return _0x292c1e;}})});}_0x12f706=_['merge']({},_0x12f706,_0x272166['options']);var _0x54d332={'where':_0x12f706[_0x04f8('0x3b')]};return db[_0x04f8('0x2c')][_0x04f8('0x1c')](_0x54d332)[_0x04f8('0x23')](function(_0x3d2783){_0x59e7d7['count']=_0x3d2783;if(_0x272166[_0x04f8('0x30')][_0x04f8('0x3f')]){_0x12f706['include']=[{'all':!![]}];}return db[_0x04f8('0x2c')][_0x04f8('0x40')](_0x12f706);})['then'](function(_0x1a29bf){_0x59e7d7[_0x04f8('0x41')]=_0x1a29bf;return _0x59e7d7;})[_0x04f8('0x23')](respondWithFilteredResult(_0x3876a2,_0x12f706))[_0x04f8('0x42')](handleError(_0x3876a2,null));};exports[_0x04f8('0x43')]=function(_0x336e4f,_0x245071){var _0x5e8d7d={'raw':!![],'where':{'id':_0x336e4f[_0x04f8('0x44')]['id']}},_0x2464bd={};_0x2464bd[_0x04f8('0x32')]=_[_0x04f8('0x2f')](db[_0x04f8('0x2c')][_0x04f8('0x45')]);_0x2464bd[_0x04f8('0x30')]=_[_0x04f8('0x2f')](_0x336e4f[_0x04f8('0x30')]);_0x2464bd[_0x04f8('0x31')]=_[_0x04f8('0x34')](_0x2464bd[_0x04f8('0x32')],_0x2464bd['query']);_0x5e8d7d[_0x04f8('0x33')]=_[_0x04f8('0x34')](_0x2464bd[_0x04f8('0x32')],qs['fields'](_0x336e4f[_0x04f8('0x30')][_0x04f8('0x35')]));_0x5e8d7d[_0x04f8('0x33')]=_0x5e8d7d[_0x04f8('0x33')][_0x04f8('0x36')]?_0x5e8d7d[_0x04f8('0x33')]:_0x2464bd['model'];if(_0x336e4f[_0x04f8('0x30')][_0x04f8('0x3f')]){_0x5e8d7d['include']=[{'all':!![]}];}_0x5e8d7d=_[_0x04f8('0x46')]({},_0x5e8d7d,_0x336e4f[_0x04f8('0x47')]);return db['Disposition'][_0x04f8('0x48')](_0x5e8d7d)[_0x04f8('0x23')](handleEntityNotFound(_0x245071,null))[_0x04f8('0x23')](respondWithResult(_0x245071,null))[_0x04f8('0x42')](handleError(_0x245071,null));};exports[_0x04f8('0x49')]=function(_0xab1f59,_0x5cc35f){return db[_0x04f8('0x2c')][_0x04f8('0x49')](_0xab1f59[_0x04f8('0x4a')],{})[_0x04f8('0x23')](function(_0x1f045c){var _0x505e54=_0xab1f59['user'][_0x04f8('0x24')]({'plain':!![]});if(!_0x505e54)throw new Error(_0x04f8('0x4b'));if(_0x505e54['role']===_0x04f8('0x4c')){var _0x20784e=_0x1f045c['get']({'plain':!![]});var _0x33eee9=_0x04f8('0x25');return db[_0x04f8('0x4d')]['find']({'where':{'name':_0x33eee9,'userProfileId':_0x505e54[_0x04f8('0x4e')]},'raw':!![]})[_0x04f8('0x23')](function(_0x317627){if(_0x317627&&_0x317627['autoAssociation']===0x0){return db[_0x04f8('0x26')][_0x04f8('0x49')]({'name':_0x20784e[_0x04f8('0x28')],'resourceId':_0x20784e['id'],'type':_0x317627['name'],'sectionId':_0x317627['id']},{})[_0x04f8('0x23')](function(){return _0x1f045c;});}else{return _0x1f045c;}})['catch'](function(_0x2cb5eb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cb5eb);throw _0x2cb5eb;});}return _0x1f045c;})[_0x04f8('0x23')](respondWithResult(_0x5cc35f,0xc9))['catch'](handleError(_0x5cc35f,null));};exports[_0x04f8('0x21')]=function(_0x292406,_0x1eea9b){if(_0x292406[_0x04f8('0x4a')]['id']){delete _0x292406[_0x04f8('0x4a')]['id'];}return db['Disposition'][_0x04f8('0x48')]({'where':{'id':_0x292406[_0x04f8('0x44')]['id']}})[_0x04f8('0x23')](handleEntityNotFound(_0x1eea9b,null))[_0x04f8('0x23')](saveUpdates(_0x292406[_0x04f8('0x4a')],null))[_0x04f8('0x23')](respondWithResult(_0x1eea9b,null))[_0x04f8('0x42')](handleError(_0x1eea9b,null));};exports[_0x04f8('0x22')]=function(_0x31c87d,_0x2b4378){return db[_0x04f8('0x2c')][_0x04f8('0x48')]({'where':{'id':_0x31c87d['params']['id']}})['then'](handleEntityNotFound(_0x2b4378,null))[_0x04f8('0x23')](removeEntity(_0x2b4378,null))['catch'](handleError(_0x2b4378,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c1f3861..7aa46f1 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 _0xb3e6=['name','ListId','ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','Disposition','tools_dispositions','name_voice'];(function(_0x4d7ebe,_0xa00e2c){var _0x42e7f2=function(_0x3ca2d7){while(--_0x3ca2d7){_0x4d7ebe['push'](_0x4d7ebe['shift']());}};_0x42e7f2(++_0xa00e2c);}(_0xb3e6,0x73));var _0x6b3e=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xb3e6[_0x541a67];return _0x45da2a;};'use strict';var _=require('lodash');var util=require(_0x6b3e('0x0'));var logger=require(_0x6b3e('0x1'))(_0x6b3e('0x2'));var moment=require(_0x6b3e('0x3'));var BPromise=require(_0x6b3e('0x4'));var rp=require(_0x6b3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b3e('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x6b3e('0x7')]=function(_0x4137e5,_0x4f7403){return _0x4137e5['define'](_0x6b3e('0x8'),attributes,{'tableName':_0x6b3e('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6b3e('0xa'),'fields':[_0x6b3e('0xb'),_0x6b3e('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x6b3e('0xb'),_0x6b3e('0xd')]},{'unique':!![],'name':_0x6b3e('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x6b3e('0xb'),_0x6b3e('0xf')]},{'unique':!![],'name':_0x6b3e('0x10'),'fields':[_0x6b3e('0xb'),_0x6b3e('0x11')]},{'unique':!![],'name':_0x6b3e('0x12'),'fields':[_0x6b3e('0xb'),_0x6b3e('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x6b3e('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5dd2=['../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e4151,_0x470174){var _0x1dc64c=function(_0x481112){while(--_0x481112){_0x1e4151['push'](_0x1e4151['shift']());}};_0x1dc64c(++_0x470174);}(_0x5dd2,0x19e));var _0x25dd=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x5dd2[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0x25dd('0x0'));var logger=require(_0x25dd('0x1'))(_0x25dd('0x2'));var moment=require(_0x25dd('0x3'));var BPromise=require(_0x25dd('0x4'));var rp=require(_0x25dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x25dd('0x6'));var attributes=require(_0x25dd('0x7'));module[_0x25dd('0x8')]=function(_0x3e5db5,_0x5d9386){return _0x3e5db5[_0x25dd('0x9')]('Disposition',attributes,{'tableName':_0x25dd('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x25dd('0xb'),'fields':[_0x25dd('0xc'),'ListId']},{'unique':!![],'name':_0x25dd('0xd'),'fields':[_0x25dd('0xc'),_0x25dd('0xe')]},{'unique':!![],'name':_0x25dd('0xf'),'fields':['name',_0x25dd('0x10')]},{'unique':!![],'name':_0x25dd('0x11'),'fields':[_0x25dd('0xc'),_0x25dd('0x12')]},{'unique':!![],'name':_0x25dd('0x13'),'fields':[_0x25dd('0xc'),_0x25dd('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x25dd('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x25dd('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 52d6a73..d903593 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(_0x2b93ce,_0x3d5674){var _0x12ac85=function(_0x36c51f){while(--_0x36c51f){_0x2b93ce['push'](_0x2b93ce['shift']());}};_0x12ac85(++_0x3d5674);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x93e105,_0x3dd3e4){var _0x145b96=function(_0x58610b){while(--_0x58610b){_0x93e105['push'](_0x93e105['shift']());}};_0x145b96(++_0x3dd3e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 62c3db4..24193e6 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 _0x6cbe=['post','create','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','show'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6cbe,0x1aa));var _0xe6cb=function(_0x6fdef4,_0x8e3c05){_0x6fdef4=_0x6fdef4-0x0;var _0x478dda=_0x6cbe[_0x6fdef4];return _0x478dda;};'use strict';var multer=require(_0xe6cb('0x0'));var util=require('util');var path=require(_0xe6cb('0x1'));var timeout=require(_0xe6cb('0x2'));var express=require(_0xe6cb('0x3'));var router=express[_0xe6cb('0x4')]();var fs_extra=require(_0xe6cb('0x5'));var auth=require(_0xe6cb('0x6'));var interaction=require(_0xe6cb('0x7'));var config=require(_0xe6cb('0x8'));var controller=require(_0xe6cb('0x9'));router['get']('/',auth[_0xe6cb('0xa')](),controller[_0xe6cb('0xb')]);router[_0xe6cb('0xc')]('/:id',auth[_0xe6cb('0xa')](),controller[_0xe6cb('0xd')]);router[_0xe6cb('0xe')]('/',auth[_0xe6cb('0xa')](),controller[_0xe6cb('0xf')]);router[_0xe6cb('0x10')](_0xe6cb('0x11'),auth['isAuthenticated'](),controller[_0xe6cb('0x12')]);router['delete'](_0xe6cb('0x11'),auth['isAuthenticated'](),controller[_0xe6cb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x939d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports','multer','util'];(function(_0x5d6a37,_0x3aa9c1){var _0xb28173=function(_0x519105){while(--_0x519105){_0x5d6a37['push'](_0x5d6a37['shift']());}};_0xb28173(++_0x3aa9c1);}(_0x939d,0x1d9));var _0xd939=function(_0x1b0fd3,_0x3173df){_0x1b0fd3=_0x1b0fd3-0x0;var _0xa47af4=_0x939d[_0x1b0fd3];return _0xa47af4;};'use strict';var multer=require(_0xd939('0x0'));var util=require(_0xd939('0x1'));var path=require(_0xd939('0x2'));var timeout=require('connect-timeout');var express=require(_0xd939('0x3'));var router=express[_0xd939('0x4')]();var fs_extra=require(_0xd939('0x5'));var auth=require(_0xd939('0x6'));var interaction=require(_0xd939('0x7'));var config=require(_0xd939('0x8'));var controller=require(_0xd939('0x9'));router[_0xd939('0xa')]('/',auth[_0xd939('0xb')](),controller['index']);router[_0xd939('0xa')](_0xd939('0xc'),auth[_0xd939('0xb')](),controller['show']);router[_0xd939('0xd')]('/',auth[_0xd939('0xb')](),controller[_0xd939('0xe')]);router[_0xd939('0xf')](_0xd939('0xc'),auth[_0xd939('0xb')](),controller[_0xd939('0x10')]);router[_0xd939('0x11')](_0xd939('0xc'),auth[_0xd939('0xb')](),controller['destroy']);module[_0xd939('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index bfd7031..30f2467 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 _0xc0fc=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','BOOLEAN'];(function(_0x1868c7,_0x25f9a6){var _0x2c84eb=function(_0x3c1329){while(--_0x3c1329){_0x1868c7['push'](_0x1868c7['shift']());}};_0x2c84eb(++_0x25f9a6);}(_0xc0fc,0x146));var _0xcc0f=function(_0x2fa2ad,_0x103fe0){_0x2fa2ad=_0x2fa2ad-0x0;var _0x120c95=_0xc0fc[_0x2fa2ad];return _0x120c95;};'use strict';var Sequelize=require('sequelize');module[_0xcc0f('0x0')]={'name':{'type':Sequelize[_0xcc0f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcc0f('0x1')]},'ecm':{'type':Sequelize[_0xcc0f('0x2')](_0xcc0f('0x3'),'no'),'defaultValue':_0xcc0f('0x3')},'headerinfo':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':_0xcc0f('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xcc0f('0x5')},'minrate':{'type':Sequelize[_0xcc0f('0x2')]('2400',_0xcc0f('0x6'),_0xcc0f('0x7'),_0xcc0f('0x8'),_0xcc0f('0x9'),_0xcc0f('0xa')),'defaultValue':_0xcc0f('0x6')},'maxrate':{'type':Sequelize[_0xcc0f('0x2')](_0xcc0f('0xb'),_0xcc0f('0x6'),_0xcc0f('0x7'),_0xcc0f('0x8'),_0xcc0f('0x9'),'14400'),'defaultValue':_0xcc0f('0xa')},'modem':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':_0xcc0f('0xc')},'gateway':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xcc0f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xcc0f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xcc0f('0x2')]('SIP',_0xcc0f('0xe'),_0xcc0f('0xf'),_0xcc0f('0x10')),'defaultValue':_0xcc0f('0x11')},'key':{'type':Sequelize[_0xcc0f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcc0f('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xcc0f('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xcc0f('0x12')],'defaultValue':![],'comment':_0xcc0f('0x14'),'set':function(_0x23f239){if(!_0x23f239)this[_0xcc0f('0x15')]('mandatoryDispositionPauseId',null);this[_0xcc0f('0x15')](_0xcc0f('0x16'),_0x23f239);}}}; \ No newline at end of file +var _0xa861=['yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','4800','7200','14400','v17,v27,v29','INTEGER','SIP','DADHI','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x41d01d,_0x577e6d){var _0x356164=function(_0x1d429f){while(--_0x1d429f){_0x41d01d['push'](_0x41d01d['shift']());}};_0x356164(++_0x577e6d);}(_0xa861,0x1c4));var _0x1a86=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xa861[_0x576d8a];return _0x3dc3ef;};'use strict';var Sequelize=require(_0x1a86('0x0'));module[_0x1a86('0x1')]={'name':{'type':Sequelize[_0x1a86('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x1a86('0x3')](_0x1a86('0x4'),'no'),'defaultValue':_0x1a86('0x4')},'headerinfo':{'type':Sequelize[_0x1a86('0x2')],'defaultValue':_0x1a86('0x5')},'localstationid':{'type':Sequelize[_0x1a86('0x2')],'unique':_0x1a86('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x1a86('0x7'),'4800','7200',_0x1a86('0x8'),_0x1a86('0x9'),'14400'),'defaultValue':_0x1a86('0xa')},'maxrate':{'type':Sequelize[_0x1a86('0x3')](_0x1a86('0x7'),_0x1a86('0xa'),_0x1a86('0xb'),_0x1a86('0x8'),_0x1a86('0x9'),_0x1a86('0xc')),'defaultValue':_0x1a86('0xc')},'modem':{'type':Sequelize[_0x1a86('0x2')],'defaultValue':_0x1a86('0xd')},'gateway':{'type':Sequelize[_0x1a86('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1a86('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1a86('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1a86('0x3')](_0x1a86('0xf'),'IAX',_0x1a86('0x10'),'KHOMP'),'defaultValue':_0x1a86('0xf')},'key':{'type':Sequelize[_0x1a86('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a86('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1a86('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a86('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a86('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a86('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a86('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a86('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a86('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x1a86('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x1a86('0x12')],'defaultValue':![],'comment':_0x1a86('0x14'),'set':function(_0x3820bf){if(!_0x3820bf)this[_0x1a86('0x15')](_0x1a86('0x16'),null);this['setDataValue'](_0x1a86('0x17'),_0x3820bf);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 40cf095..70b675c 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 _0x0618=['CannedAnswer','getAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','join','root','CheckAfterSend','isNil','from','format','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','sort','removeDispositions','ids','addAnswer'];(function(_0x57e300,_0x527935){var _0x9e16dc=function(_0x4d7344){while(--_0x4d7344){_0x57e300['push'](_0x57e300['shift']());}};_0x9e16dc(++_0x527935);}(_0x0618,0x1ee));var _0x8061=function(_0x1166d3,_0x5b8f38){_0x1166d3=_0x1166d3-0x0;var _0x2b0a5b=_0x0618[_0x1166d3];return _0x2b0a5b;};'use strict';var emlformat=require(_0x8061('0x0'));var rimraf=require(_0x8061('0x1'));var zipdir=require(_0x8061('0x2'));var jsonpatch=require(_0x8061('0x3'));var rp=require('request-promise');var moment=require(_0x8061('0x4'));var BPromise=require(_0x8061('0x5'));var Mustache=require(_0x8061('0x6'));var util=require(_0x8061('0x7'));var path=require(_0x8061('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8061('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8061('0xa'));var squel=require(_0x8061('0xb'));var crypto=require(_0x8061('0xc'));var jsforce=require(_0x8061('0xd'));var deskjs=require(_0x8061('0xe'));var toCsv=require(_0x8061('0xf'));var querystring=require(_0x8061('0x10'));var Papa=require(_0x8061('0x11'));var Redis=require(_0x8061('0x12'));var authService=require(_0x8061('0x13'));var qs=require(_0x8061('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8061('0x15'));var logger=require(_0x8061('0x16'))(_0x8061('0x17'));var utils=require(_0x8061('0x18'));var config=require(_0x8061('0x19'));var licenseUtil=require(_0x8061('0x1a'));var db=require(_0x8061('0x1b'))['db'];config[_0x8061('0x1c')]=_[_0x8061('0x1d')](config[_0x8061('0x1c')],{'host':_0x8061('0x1e'),'port':0x18eb});var socket=require(_0x8061('0x1f'))(new Redis(config['redis']));require(_0x8061('0x20'))['register'](socket);var jayson=require(_0x8061('0x21'));var client=jayson[_0x8061('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x8061('0x22')][_0x8061('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2974fc,_0x2936ee,_0x44fdd5,_0x4b1771){return new BPromise(function(_0x85c29c,_0x438ccb){var _0x2278af=_0x4b1771||client;return _0x2278af[_0x8061('0x24')](_0x2974fc,_0x44fdd5)[_0x8061('0x25')](function(_0x26a094){logger[_0x8061('0x26')]('FaxAccount,\x20%s,\x20%s',_0x2936ee,_0x8061('0x27'));logger[_0x8061('0x28')](_0x8061('0x29'),_0x2936ee,_0x8061('0x27'),JSON[_0x8061('0x2a')](_0x26a094));if(_0x26a094[_0x8061('0x2b')]){if(_0x26a094[_0x8061('0x2b')]['code']===0x1f4){logger['error'](_0x8061('0x2c'),_0x2936ee,_0x26a094[_0x8061('0x2b')]['message']);return _0x438ccb(_0x26a094['error'][_0x8061('0x2d')]);}logger[_0x8061('0x2b')](_0x8061('0x2c'),_0x2936ee,_0x26a094[_0x8061('0x2b')][_0x8061('0x2d')]);return _0x85c29c(_0x26a094['error'][_0x8061('0x2d')]);}else{logger[_0x8061('0x26')](_0x8061('0x2c'),_0x2936ee,'request\x20sent');_0x85c29c(_0x26a094[_0x8061('0x2e')][_0x8061('0x2d')]);}})['catch'](function(_0x53c312){logger[_0x8061('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x2936ee,_0x53c312);_0x438ccb(_0x53c312);});});}function respondWithStatusCode(_0x93832,_0x365d30){_0x365d30=_0x365d30||0xcc;return function(_0x3d19be){if(_0x3d19be){return _0x93832[_0x8061('0x2f')](_0x365d30);}return _0x93832[_0x8061('0x30')](_0x365d30)[_0x8061('0x31')]();};}function respondWithResult(_0x1978a5,_0x32bdef){_0x32bdef=_0x32bdef||0xc8;return function(_0x5ccd56){if(_0x5ccd56){return _0x1978a5[_0x8061('0x30')](_0x32bdef)[_0x8061('0x32')](_0x5ccd56);}};}function respondWithFilteredResult(_0xfa2988,_0x1e0c6a){return function(_0x8a4fa9){if(_0x8a4fa9){var _0x151a5a=typeof _0x1e0c6a[_0x8061('0x33')]===_0x8061('0x34')&&typeof _0x1e0c6a[_0x8061('0x35')]===_0x8061('0x34');var _0x3974d4=_0x8a4fa9['count'];var _0x3b4c62=_0x151a5a?0x0:_0x1e0c6a[_0x8061('0x33')];var _0x11f9c0=_0x151a5a?_0x8a4fa9[_0x8061('0x36')]:_0x1e0c6a[_0x8061('0x33')]+_0x1e0c6a[_0x8061('0x35')];var _0x12c334;if(_0x11f9c0>=_0x3974d4){_0x11f9c0=_0x3974d4;_0x12c334=0xc8;}else{_0x12c334=0xce;}_0xfa2988[_0x8061('0x30')](_0x12c334);return _0xfa2988[_0x8061('0x37')](_0x8061('0x38'),_0x3b4c62+'-'+_0x11f9c0+'/'+_0x3974d4)['json'](_0x8a4fa9);}return null;};}function patchUpdates(_0x569654){return function(_0x5c53c0){try{jsonpatch[_0x8061('0x39')](_0x5c53c0,_0x569654,!![]);}catch(_0x4a9014){return BPromise['reject'](_0x4a9014);}return _0x5c53c0[_0x8061('0x3a')]();};}function saveUpdates(_0x118235,_0x3c083b){return function(_0x4f5fca){if(_0x4f5fca){return _0x4f5fca[_0x8061('0x3b')](_0x118235)['then'](function(_0x3ed83f){return _0x3ed83f;});}return null;};}function removeEntity(_0x58fe49,_0x543878){return function(_0x4fbe6c){if(_0x4fbe6c){return _0x4fbe6c['destroy']()[_0x8061('0x25')](function(){var _0x18b0bc=_0x4fbe6c[_0x8061('0x3c')]({'plain':!![]});var _0x5058a7=_0x8061('0x3d');return db[_0x8061('0x3e')][_0x8061('0x3f')]({'where':{'type':_0x5058a7,'resourceId':_0x18b0bc['id']}})[_0x8061('0x25')](function(){return _0x4fbe6c;});})['then'](function(){_0x58fe49['status'](0xcc)[_0x8061('0x31')]();});}};}function handleEntityNotFound(_0xfb9c08,_0x593a1c){return function(_0x18c25a){if(!_0x18c25a){_0xfb9c08[_0x8061('0x2f')](0x194);}return _0x18c25a;};}function handleError(_0x428e8f,_0x1b2154){_0x1b2154=_0x1b2154||0x1f4;return function(_0x2270db){logger['error'](_0x2270db[_0x8061('0x40')]);if(_0x2270db[_0x8061('0x41')]){delete _0x2270db['name'];}_0x428e8f['status'](_0x1b2154)[_0x8061('0x42')](_0x2270db);};}exports[_0x8061('0x43')]=function(_0x3a73d2,_0x3143ab){var _0x551ed3={'include':[{'model':db[_0x8061('0x44')],'as':'mandatoryDispositionPause'}]},_0x357c93={},_0x32a089={'count':0x0,'rows':[]};var _0x527e3a=_['map'](db[_0x8061('0x45')][_0x8061('0x46')],function(_0x2c6839){return{'name':_0x2c6839[_0x8061('0x47')],'type':_0x2c6839[_0x8061('0x48')][_0x8061('0x49')]};});_0x357c93['model']=_[_0x8061('0x4a')](_0x527e3a,_0x8061('0x41'));_0x357c93[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x3a73d2[_0x8061('0x4b')]);_0x357c93['filters']=_[_0x8061('0x4d')](_0x357c93[_0x8061('0x4e')],_0x357c93[_0x8061('0x4b')]);_0x551ed3[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x357c93['model'],qs[_0x8061('0x50')](_0x3a73d2['query'][_0x8061('0x50')]));_0x551ed3[_0x8061('0x4f')]=_0x551ed3['attributes'][_0x8061('0x51')]?_0x551ed3[_0x8061('0x4f')]:_0x357c93[_0x8061('0x4e')];if(!_0x3a73d2[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x551ed3[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x3a73d2[_0x8061('0x4b')]['limit']);_0x551ed3[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x3a73d2[_0x8061('0x4b')][_0x8061('0x33')]);}_0x551ed3['order']=qs['sort'](_0x3a73d2[_0x8061('0x4b')]['sort']);_0x551ed3[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x3a73d2['query'],_0x357c93[_0x8061('0x55')]),_0x527e3a);if(_0x3a73d2[_0x8061('0x4b')]['filter']){_0x551ed3[_0x8061('0x54')]=_['merge'](_0x551ed3[_0x8061('0x54')],{'$or':_['map'](_0x527e3a,function(_0x5d6de0){if(_0x5d6de0[_0x8061('0x48')]!=='VIRTUAL'){var _0x46a7a0={};_0x46a7a0[_0x5d6de0[_0x8061('0x41')]]={'$like':'%'+_0x3a73d2['query'][_0x8061('0x57')]+'%'};return _0x46a7a0;}})});}_0x551ed3=_[_0x8061('0x58')]({},_0x551ed3,_0x3a73d2['options']);var _0x19dc95={'where':_0x551ed3[_0x8061('0x54')]};return db[_0x8061('0x45')]['count'](_0x19dc95)['then'](function(_0x589259){_0x32a089[_0x8061('0x36')]=_0x589259;if(_0x3a73d2['query'][_0x8061('0x59')]){_0x551ed3[_0x8061('0x5a')]=[{'all':!![]}];}return db[_0x8061('0x45')][_0x8061('0x5b')](_0x551ed3);})['then'](function(_0x53222c){_0x32a089['rows']=_0x53222c;return _0x32a089;})[_0x8061('0x25')](respondWithFilteredResult(_0x3143ab,_0x551ed3))[_0x8061('0x5c')](handleError(_0x3143ab,null));};exports[_0x8061('0x5d')]=function(_0xa2cbe,_0x5d7787){var _0x6a4cd2={'raw':![],'where':{'id':_0xa2cbe[_0x8061('0x5e')]['id']},'include':[{'model':db[_0x8061('0x44')],'as':_0x8061('0x5f')}]},_0x1f99dd={};_0x1f99dd['model']=_[_0x8061('0x4c')](db[_0x8061('0x45')]['rawAttributes']);_0x1f99dd['query']=_[_0x8061('0x4c')](_0xa2cbe[_0x8061('0x4b')]);_0x1f99dd[_0x8061('0x55')]=_[_0x8061('0x4d')](_0x1f99dd[_0x8061('0x4e')],_0x1f99dd[_0x8061('0x4b')]);_0x6a4cd2['attributes']=_[_0x8061('0x4d')](_0x1f99dd[_0x8061('0x4e')],qs[_0x8061('0x50')](_0xa2cbe[_0x8061('0x4b')][_0x8061('0x50')]));_0x6a4cd2[_0x8061('0x4f')]=_0x6a4cd2[_0x8061('0x4f')][_0x8061('0x51')]?_0x6a4cd2['attributes']:_0x1f99dd['model'];if(_0xa2cbe[_0x8061('0x4b')][_0x8061('0x59')]){_0x6a4cd2[_0x8061('0x5a')]=[{'all':!![]}];}_0x6a4cd2=_[_0x8061('0x58')]({},_0x6a4cd2,_0xa2cbe[_0x8061('0x60')]);return db[_0x8061('0x45')][_0x8061('0x61')](_0x6a4cd2)[_0x8061('0x25')](handleEntityNotFound(_0x5d7787,null))[_0x8061('0x25')](respondWithResult(_0x5d7787,null))[_0x8061('0x5c')](handleError(_0x5d7787,null));};exports['create']=function(_0x5924c9,_0x3fb434){return db[_0x8061('0x45')][_0x8061('0x62')](_0x5924c9[_0x8061('0x63')],{})[_0x8061('0x25')](function(_0x31b7c4){var _0x1e3e0c=_0x5924c9[_0x8061('0x64')][_0x8061('0x3c')]({'plain':!![]});if(!_0x1e3e0c)throw new Error(_0x8061('0x65'));if(_0x1e3e0c[_0x8061('0x66')]===_0x8061('0x64')){var _0x3ffa9d=_0x31b7c4[_0x8061('0x3c')]({'plain':!![]});var _0x7893b6=_0x8061('0x3d');return db[_0x8061('0x67')][_0x8061('0x61')]({'where':{'name':_0x7893b6,'userProfileId':_0x1e3e0c['userProfileId']},'raw':!![]})[_0x8061('0x25')](function(_0x348bcc){if(_0x348bcc&&_0x348bcc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ffa9d[_0x8061('0x41')],'resourceId':_0x3ffa9d['id'],'type':_0x348bcc[_0x8061('0x41')],'sectionId':_0x348bcc['id']},{})[_0x8061('0x25')](function(){return _0x31b7c4;});}else{return _0x31b7c4;}})['catch'](function(_0x5a9906){logger[_0x8061('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a9906);throw _0x5a9906;});}return _0x31b7c4;})[_0x8061('0x25')](respondWithResult(_0x3fb434,0xc9))[_0x8061('0x5c')](handleError(_0x3fb434,null));};exports[_0x8061('0x3b')]=function(_0x2453d2,_0x4b9543){if(_0x2453d2[_0x8061('0x63')]['id']){delete _0x2453d2[_0x8061('0x63')]['id'];}return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x2453d2[_0x8061('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x8061('0x5f')}]})[_0x8061('0x25')](handleEntityNotFound(_0x4b9543,null))[_0x8061('0x25')](saveUpdates(_0x2453d2[_0x8061('0x63')],null))[_0x8061('0x25')](respondWithResult(_0x4b9543,null))[_0x8061('0x5c')](handleError(_0x4b9543,null));};exports[_0x8061('0x3f')]=function(_0x431d2b,_0x59c09e){return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x431d2b[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x59c09e,null))[_0x8061('0x25')](removeEntity(_0x59c09e,null))[_0x8061('0x5c')](handleError(_0x59c09e,null));};exports['describe']=function(_0x38657f,_0x465977){return db['FaxAccount'][_0x8061('0x68')]()[_0x8061('0x25')](respondWithResult(_0x465977,null))[_0x8061('0x5c')](handleError(_0x465977,null));};exports[_0x8061('0x69')]=function(_0x3160d8,_0x1fbd5c,_0x45a11a){if(_0x3160d8[_0x8061('0x63')]['id']){delete _0x3160d8['body']['id'];}return db['FaxAccount'][_0x8061('0x61')]({'where':{'id':_0x3160d8['params']['id']}})['then'](handleEntityNotFound(_0x1fbd5c,null))[_0x8061('0x25')](function(_0x554aac){if(_0x554aac){_0x3160d8[_0x8061('0x63')][_0x8061('0x6a')]=_0x554aac['id'];return db[_0x8061('0x6b')][_0x8061('0x62')](_0x3160d8[_0x8061('0x63')]);}})['then'](respondWithResult(_0x1fbd5c,null))['catch'](handleError(_0x1fbd5c,null));};exports[_0x8061('0x6c')]=function(_0x16988e,_0x17b571,_0x29814c){var _0x459f59={'raw':![],'where':{}};var _0x1e29f5={};var _0xbf0da1={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x16988e['params']['id']}})['then'](handleEntityNotFound(_0x17b571,null))[_0x8061('0x25')](function(_0xcb1f6f){if(_0xcb1f6f){_0x1e29f5[_0x8061('0x4e')]=_['keys'](db[_0x8061('0x6b')]['rawAttributes']);_0x1e29f5['query']=_[_0x8061('0x4c')](_0x16988e[_0x8061('0x4b')]);_0x1e29f5[_0x8061('0x55')]=_[_0x8061('0x4d')](_0x1e29f5[_0x8061('0x4e')],_0x1e29f5['query']);_0x459f59['attributes']=_[_0x8061('0x4d')](_0x1e29f5['model'],qs[_0x8061('0x50')](_0x16988e[_0x8061('0x4b')][_0x8061('0x50')]));_0x459f59['attributes']=_0x459f59['attributes'][_0x8061('0x51')]?_0x459f59[_0x8061('0x4f')]:_0x1e29f5[_0x8061('0x4e')];if(!_0x16988e[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x459f59[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x16988e['query'][_0x8061('0x35')]);_0x459f59[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x16988e[_0x8061('0x4b')][_0x8061('0x33')]);}_0x459f59[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x16988e[_0x8061('0x4b')]['sort']);_0x459f59[_0x8061('0x54')]=qs[_0x8061('0x55')](_['pick'](_0x16988e['query'],_0x1e29f5['filters']));_0x459f59[_0x8061('0x54')]['FaxAccountId']=_0xcb1f6f['id'];if(_0x16988e[_0x8061('0x4b')][_0x8061('0x57')]){_0x459f59[_0x8061('0x54')]=_[_0x8061('0x58')](_0x459f59[_0x8061('0x54')],{'$or':_['map'](_0x459f59[_0x8061('0x4f')],function(_0x21d659){var _0x37d2a0={};_0x37d2a0[_0x21d659]={'$like':'%'+_0x16988e[_0x8061('0x4b')]['filter']+'%'};return _0x37d2a0;})});}_0x459f59=_[_0x8061('0x58')]({},_0x459f59,_0x16988e[_0x8061('0x60')]);return db['Disposition'][_0x8061('0x36')]({'where':_0x459f59['where']})['then'](function(_0x3fa077){_0xbf0da1['count']=_0x3fa077;if(_0x16988e[_0x8061('0x4b')]['includeAll']){_0x459f59['include']=[{'all':!![]}];}return db[_0x8061('0x6b')][_0x8061('0x5b')](_0x459f59);})[_0x8061('0x25')](function(_0x99888c){_0xbf0da1['rows']=_0x99888c;return _0xbf0da1;});}})[_0x8061('0x25')](respondWithFilteredResult(_0x17b571,_0x459f59))[_0x8061('0x5c')](handleError(_0x17b571,null));};exports[_0x8061('0x70')]=function(_0x38e738,_0x104a3a,_0x183fef){return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x38e738[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x104a3a,null))['then'](function(_0x2274e7){if(_0x2274e7){return _0x2274e7['removeDispositions'](_0x38e738['query'][_0x8061('0x71')]);}})['then'](respondWithStatusCode(_0x104a3a,null))['catch'](handleError(_0x104a3a,null));};exports[_0x8061('0x72')]=function(_0x1ced8e,_0x4bbf39,_0x5e5d68){if(_0x1ced8e[_0x8061('0x63')]['id']){delete _0x1ced8e[_0x8061('0x63')]['id'];}return db[_0x8061('0x45')]['find']({'where':{'id':_0x1ced8e[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x4bbf39,null))[_0x8061('0x25')](function(_0x274f60){if(_0x274f60){_0x1ced8e[_0x8061('0x63')][_0x8061('0x6a')]=_0x274f60['id'];return db[_0x8061('0x73')][_0x8061('0x62')](_0x1ced8e[_0x8061('0x63')]);}})[_0x8061('0x25')](respondWithResult(_0x4bbf39,null))[_0x8061('0x5c')](handleError(_0x4bbf39,null));};exports[_0x8061('0x74')]=function(_0x235a64,_0x442084,_0x56a2f8){var _0x20a6c7={'raw':![],'where':{}};var _0x574732={};var _0x1c5ed1={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x235a64['params']['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x442084,null))['then'](function(_0x3ccd4a){if(_0x3ccd4a){_0x574732[_0x8061('0x4e')]=_[_0x8061('0x4c')](db[_0x8061('0x73')]['rawAttributes']);_0x574732['query']=_['keys'](_0x235a64[_0x8061('0x4b')]);_0x574732[_0x8061('0x55')]=_['intersection'](_0x574732[_0x8061('0x4e')],_0x574732[_0x8061('0x4b')]);_0x20a6c7[_0x8061('0x4f')]=_['intersection'](_0x574732[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x235a64[_0x8061('0x4b')][_0x8061('0x50')]));_0x20a6c7[_0x8061('0x4f')]=_0x20a6c7[_0x8061('0x4f')][_0x8061('0x51')]?_0x20a6c7[_0x8061('0x4f')]:_0x574732['model'];if(!_0x235a64['query'][_0x8061('0x52')]('nolimit')){_0x20a6c7[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x235a64['query']['limit']);_0x20a6c7[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x235a64['query'][_0x8061('0x33')]);}_0x20a6c7[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x235a64[_0x8061('0x4b')]['sort']);_0x20a6c7[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x235a64[_0x8061('0x4b')],_0x574732[_0x8061('0x55')]));_0x20a6c7[_0x8061('0x54')][_0x8061('0x6a')]=_0x3ccd4a['id'];if(_0x235a64[_0x8061('0x4b')][_0x8061('0x57')]){_0x20a6c7['where']=_[_0x8061('0x58')](_0x20a6c7[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x20a6c7[_0x8061('0x4f')],function(_0x35a02e){var _0x396ee8={};_0x396ee8[_0x35a02e]={'$like':'%'+_0x235a64[_0x8061('0x4b')][_0x8061('0x57')]+'%'};return _0x396ee8;})});}_0x20a6c7=_[_0x8061('0x58')]({},_0x20a6c7,_0x235a64['options']);return db[_0x8061('0x73')][_0x8061('0x36')]({'where':_0x20a6c7[_0x8061('0x54')]})[_0x8061('0x25')](function(_0x1dda5a){_0x1c5ed1['count']=_0x1dda5a;if(_0x235a64[_0x8061('0x4b')][_0x8061('0x59')]){_0x20a6c7[_0x8061('0x5a')]=[{'all':!![]}];}return db[_0x8061('0x73')][_0x8061('0x5b')](_0x20a6c7);})[_0x8061('0x25')](function(_0x54a826){_0x1c5ed1['rows']=_0x54a826;return _0x1c5ed1;});}})[_0x8061('0x25')](respondWithFilteredResult(_0x442084,_0x20a6c7))[_0x8061('0x5c')](handleError(_0x442084,null));};exports['removeAnswers']=function(_0xd71d2f,_0x5909b3,_0x34899f){return db[_0x8061('0x45')]['find']({'where':{'id':_0xd71d2f[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x5909b3,null))[_0x8061('0x25')](function(_0x19c901){if(_0x19c901){return _0x19c901['removeAnswers'](_0xd71d2f[_0x8061('0x4b')][_0x8061('0x71')]);}})[_0x8061('0x25')](respondWithStatusCode(_0x5909b3,null))[_0x8061('0x5c')](handleError(_0x5909b3,null));};exports[_0x8061('0x75')]=function(_0x40209f,_0x5bad0f,_0x131c33){return db[_0x8061('0x76')][_0x8061('0x61')]({'where':{'id':_0x40209f['params']['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x5bad0f,null))[_0x8061('0x25')](function(_0x1fb76d){if(_0x1fb76d){return _0x1fb76d[_0x8061('0x75')](_0x40209f['body'][_0x8061('0x71')],_[_0x8061('0x77')](_0x40209f['body'],[_0x8061('0x71'),'id'])||{});}})['then'](respondWithResult(_0x5bad0f,null))[_0x8061('0x5c')](handleError(_0x5bad0f,null));};exports[_0x8061('0x78')]=function(_0x125969,_0x6daafb,_0x2923d2){var _0x56081e={'raw':![],'where':{}};var _0x29bf50={};var _0x1d531c={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x125969['params']['id']}})['then'](handleEntityNotFound(_0x6daafb,null))[_0x8061('0x25')](function(_0x43fc62){if(_0x43fc62){_0x29bf50[_0x8061('0x4e')]=_[_0x8061('0x4c')](db[_0x8061('0x76')][_0x8061('0x46')]);_0x29bf50[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x125969['query']);_0x29bf50[_0x8061('0x55')]=_[_0x8061('0x4d')](_0x29bf50[_0x8061('0x4e')],_0x29bf50[_0x8061('0x4b')]);_0x56081e[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x29bf50[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x125969[_0x8061('0x4b')][_0x8061('0x50')]));_0x56081e['attributes']=_0x56081e[_0x8061('0x4f')][_0x8061('0x51')]?_0x56081e[_0x8061('0x4f')]:_0x29bf50['model'];if(!_0x125969[_0x8061('0x4b')][_0x8061('0x52')]('nolimit')){_0x56081e['limit']=qs[_0x8061('0x35')](_0x125969[_0x8061('0x4b')][_0x8061('0x35')]);_0x56081e[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x125969[_0x8061('0x4b')]['offset']);}_0x56081e[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x125969[_0x8061('0x4b')][_0x8061('0x6f')]);_0x56081e['where']=qs[_0x8061('0x55')](_['pick'](_0x125969[_0x8061('0x4b')],_0x29bf50[_0x8061('0x55')]));_0x56081e['where'][_0x8061('0x6a')]=_0x43fc62['id'];if(_0x125969[_0x8061('0x4b')][_0x8061('0x57')]){_0x56081e[_0x8061('0x54')]=_[_0x8061('0x58')](_0x56081e[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x56081e[_0x8061('0x4f')],function(_0xfd06b3){var _0x255a6f={};_0x255a6f[_0xfd06b3]={'$like':'%'+_0x125969[_0x8061('0x4b')][_0x8061('0x57')]+'%'};return _0x255a6f;})});}_0x56081e=_[_0x8061('0x58')]({},_0x56081e,_0x125969[_0x8061('0x60')]);return db['FaxInteraction'][_0x8061('0x36')]({'where':_0x56081e['where']})[_0x8061('0x25')](function(_0x37891f){_0x1d531c[_0x8061('0x36')]=_0x37891f;if(_0x125969[_0x8061('0x4b')][_0x8061('0x59')]){_0x56081e[_0x8061('0x5a')]=[{'model':db[_0x8061('0x79')],'as':'Contact','required':![]},{'model':db[_0x8061('0x7a')],'as':_0x8061('0x7b'),'attributes':['name',_0x8061('0x7c'),_0x8061('0x7d')],'required':![]},{'model':db[_0x8061('0x7e')],'as':_0x8061('0x7f'),'attributes':['id','name',_0x8061('0x80')],'where':_0x125969[_0x8061('0x4b')]['tag']?{'id':_0x125969[_0x8061('0x4b')][_0x8061('0x81')]}:undefined,'required':_0x125969[_0x8061('0x4b')]['tag']?!![]:![]}];}return db[_0x8061('0x76')][_0x8061('0x5b')](_0x56081e);})[_0x8061('0x25')](function(_0x4f1485){_0x1d531c['rows']=_0x4f1485;return _0x1d531c;});}})[_0x8061('0x25')](respondWithFilteredResult(_0x6daafb,_0x56081e))['catch'](handleError(_0x6daafb,null));};exports[_0x8061('0x82')]=function(_0x5dc213,_0x407adc){var _0x47e036=_0x5dc213['params']['id'];var _0x25c636=_0x5dc213[_0x8061('0x63')];var _0x546965=0xc8;var _0x47728f=null;return db[_0x8061('0x83')][_0x8061('0x84')]({'isolationLevel':db[_0x8061('0x83')]['Transaction'][_0x8061('0x85')]['READ_COMMITTED']},function(_0x54c7bf){return db['FaxAccount']['findOne']({'where':{'id':_0x47e036},'transaction':_0x54c7bf})[_0x8061('0x25')](function(_0x3ab269){if(_0x3ab269){return db[_0x8061('0x86')][_0x8061('0x3f')]({'where':{'FaxAccountId':_0x47e036},'transaction':_0x54c7bf})['then'](function(){var _0x278a93=_[_0x8061('0x4a')](_0x25c636,function(_0x46fa99){_0x46fa99[_0x8061('0x6a')]=_0x47e036;return _0x46fa99;});return db[_0x8061('0x86')][_0x8061('0x87')](_0x278a93,{'transaction':_0x54c7bf});});}else{_0x546965=0x194;_0x47728f=[];}});})[_0x8061('0x25')](function(){if(_0x546965!==0x194){return db[_0x8061('0x86')][_0x8061('0x88')]({'where':{'FaxAccountId':_0x47e036},'order':_0x8061('0x89')})['then'](function(_0x1ee840){_0x47728f=_0x1ee840;});}})[_0x8061('0x5c')](function(_0x21b028){_0x546965=0x1f4;logger[_0x8061('0x2b')](_0x21b028[_0x8061('0x40')]);if(_0x21b028[_0x8061('0x41')]){delete _0x21b028[_0x8061('0x41')];}_0x47728f=_0x21b028;})[_0x8061('0x8a')](function(){if(_0x47728f===null){_0x407adc[_0x8061('0x2f')](_0x546965);}else{if(_0x546965===0x1f4){_0x407adc[_0x8061('0x30')](_0x546965)[_0x8061('0x42')](_0x47728f);}else{_0x407adc[_0x8061('0x30')](_0x546965)[_0x8061('0x32')](_0x47728f);}}});};exports[_0x8061('0x8b')]=function(_0x2ab4a9,_0x36b1a,_0x28b864){var _0x4ebcb0={};var _0x1b89ca={};var _0x1a49ca;var _0x4af02b;return db['FaxAccount']['findOne']({'where':{'id':_0x2ab4a9[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0x36b1a,null))[_0x8061('0x25')](function(_0x593eae){if(_0x593eae){_0x1a49ca=_0x593eae;_0x1b89ca[_0x8061('0x4e')]=_[_0x8061('0x4c')](db[_0x8061('0x86')][_0x8061('0x46')]);_0x1b89ca[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x2ab4a9[_0x8061('0x4b')]);_0x1b89ca['filters']=_['intersection'](_0x1b89ca[_0x8061('0x4e')],_0x1b89ca[_0x8061('0x4b')]);_0x4ebcb0['attributes']=_[_0x8061('0x4d')](_0x1b89ca[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x50')]));_0x4ebcb0[_0x8061('0x4f')]=_0x4ebcb0[_0x8061('0x4f')]['length']?_0x4ebcb0[_0x8061('0x4f')]:_0x1b89ca[_0x8061('0x4e')];_0x4ebcb0[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x6f')]);_0x4ebcb0[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x2ab4a9[_0x8061('0x4b')],_0x1b89ca['filters']));if(_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x57')]){_0x4ebcb0[_0x8061('0x54')]=_['merge'](_0x4ebcb0[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x4ebcb0[_0x8061('0x4f')],function(_0x3016f0){var _0x1a8de2={};_0x1a8de2[_0x3016f0]={'$like':'%'+_0x2ab4a9['query']['filter']+'%'};return _0x1a8de2;})});}_0x4ebcb0=_[_0x8061('0x58')]({},_0x4ebcb0,_0x2ab4a9[_0x8061('0x60')]);return _0x1a49ca[_0x8061('0x8b')](_0x4ebcb0);}})[_0x8061('0x25')](function(_0x24c8f1){if(_0x24c8f1){_0x4af02b=_0x24c8f1['length'];if(!_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x4ebcb0[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x35')]);_0x4ebcb0[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x2ab4a9[_0x8061('0x4b')][_0x8061('0x33')]);}return _0x1a49ca['getApplications'](_0x4ebcb0);}})[_0x8061('0x25')](function(_0x21c54b){if(_0x21c54b){return _0x21c54b?{'count':_0x4af02b,'rows':_0x21c54b}:null;}})[_0x8061('0x25')](respondWithResult(_0x36b1a,null))[_0x8061('0x5c')](handleError(_0x36b1a,null));};function Extension(_0x121175,_0xcbc687,_0x13735a,_0x150baf){this[_0x8061('0x8c')]=_0x8061('0x8d');this[_0x8061('0x8e')]=_0x121175[_0x8061('0x8f')];this['app']=_0x150baf;this['type']='system';this[_0x8061('0x90')]=_0x8061('0x91');this[_0x8061('0x6a')]=_0x121175['id'];this[_0x8061('0x89')]=_0xcbc687;this[_0x8061('0x92')]=_0x13735a;}function createExtensionsReciveFax(_0x35240a){var _0x37eff4=0x1;var _0x5d3acc=[];_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,'',_0x8061('0x94')));_0x37eff4+=0x1;_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,'CDR(type)=inbound-fax',_0x8061('0x95')));_0x37eff4+=0x1;for(var _0x2ca6fe in _0x35240a){if(_0x35240a[_0x8061('0x52')](_0x2ca6fe)&&(_0x2ca6fe===_0x8061('0x96')||_0x2ca6fe===_0x8061('0x8f')||_0x2ca6fe===_0x8061('0x97')||_0x2ca6fe==='faxdetect'||_0x2ca6fe===_0x8061('0x98')||_0x2ca6fe===_0x8061('0x99')||_0x2ca6fe===_0x8061('0x9a')||_0x2ca6fe===_0x8061('0x9b')||_0x2ca6fe===_0x8061('0x9c'))){_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,_0x8061('0x9d')+_0x2ca6fe+')='+_0x35240a[_0x2ca6fe],_0x8061('0x95')));_0x37eff4+=0x1;}}_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,'6',_0x8061('0x9e')));_0x37eff4+=0x1;_0x5d3acc[_0x8061('0x93')](new Extension(_0x35240a,_0x37eff4,_0x8061('0x9f'),_0x8061('0xa0')));_0x37eff4=0x0;return _0x5d3acc;}exports[_0x8061('0xa1')]=function(_0x2132df,_0x4ffbaa,_0x3cf730){var _0x1de562;return db['sequelize']['transaction'](function(_0x58b08e){return db[_0x8061('0x45')][_0x8061('0x62')](_0x2132df[_0x8061('0x63')],{'transaction':_0x58b08e})[_0x8061('0x25')](function(_0x1e228d){_0x1de562=_0x1e228d[_0x8061('0x3c')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1de562),{'transaction':_0x58b08e});});})[_0x8061('0x25')](function(){return _0x1de562;})['then'](respondWithResult(_0x4ffbaa,null))[_0x8061('0x5c')](handleError(_0x4ffbaa,null));};exports[_0x8061('0xa2')]=function(_0x25db2c,_0x54ca38,_0x49d841){var _0x1a88dc;return db[_0x8061('0x83')]['transaction'](function(_0x2d2dad){return db[_0x8061('0x45')]['update'](_0x25db2c[_0x8061('0x63')],{'where':{'id':_0x25db2c[_0x8061('0x63')]['id']},'transaction':_0x2d2dad})['then'](function(_0x488ec9){return db[_0x8061('0xa3')][_0x8061('0x3f')]({'where':{'FaxAccountId':_0x25db2c[_0x8061('0x63')]['id']},'transaction':_0x2d2dad})[_0x8061('0x25')](function(_0x26c7dc){return db[_0x8061('0xa3')]['bulkCreate'](createExtensionsReciveFax(_[_0x8061('0x77')](_0x25db2c[_0x8061('0x63')],['tech','key',_0x8061('0xa4'),'updatedAt',_0x8061('0xa5'),_0x8061('0xa6')])),{'transaction':_0x2d2dad});});});})['then'](function(){return db[_0x8061('0x45')][_0x8061('0xa7')](_0x25db2c[_0x8061('0x63')]['id']);})[_0x8061('0x25')](respondWithResult(_0x54ca38,null))[_0x8061('0x5c')](handleError(_0x54ca38,null));};exports[_0x8061('0xa8')]=function(_0x5ced0b,_0xf1eb5c,_0x16aee3){var _0x549edb={'raw':!![],'where':{}};var _0x572169={};var _0x339d11={'count':0x0,'rows':[]};return db[_0x8061('0x45')][_0x8061('0x6d')]({'where':{'id':_0x5ced0b[_0x8061('0x5e')]['id']}})[_0x8061('0x25')](handleEntityNotFound(_0xf1eb5c,null))[_0x8061('0x25')](function(_0x4c56f3){if(_0x4c56f3){_0x572169['model']=_['keys'](db[_0x8061('0xa9')]['rawAttributes']);_0x572169[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x5ced0b['query']);_0x572169['filters']=_['intersection'](_0x572169[_0x8061('0x4e')],_0x572169[_0x8061('0x4b')]);_0x549edb[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x572169[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x5ced0b[_0x8061('0x4b')][_0x8061('0x50')]));_0x549edb[_0x8061('0x4f')]=_0x549edb['attributes']['length']?_0x549edb[_0x8061('0x4f')]:_0x572169[_0x8061('0x4e')];if(!_0x5ced0b[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x549edb[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x5ced0b[_0x8061('0x4b')][_0x8061('0x35')]);_0x549edb[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x5ced0b[_0x8061('0x4b')]['offset']);}_0x549edb[_0x8061('0x6e')]=qs[_0x8061('0x6f')](_0x5ced0b[_0x8061('0x4b')]['sort']);_0x549edb[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x5ced0b[_0x8061('0x4b')],_0x572169[_0x8061('0x55')]));_0x549edb[_0x8061('0x54')][_0x8061('0x6a')]=_0x4c56f3['id'];if(_0x5ced0b[_0x8061('0x4b')][_0x8061('0x57')]){_0x549edb[_0x8061('0x54')]=_[_0x8061('0x58')](_0x549edb[_0x8061('0x54')],{'$or':_[_0x8061('0x4a')](_0x549edb[_0x8061('0x4f')],function(_0x271873){var _0x2cd3d7={};_0x2cd3d7[_0x271873]={'$like':'%'+_0x5ced0b[_0x8061('0x4b')]['filter']+'%'};return _0x2cd3d7;})});}if(_0x5ced0b['query'][_0x8061('0xaa')]){var _0x185b19=_0x5ced0b[_0x8061('0x4b')][_0x8061('0xaa')][_0x8061('0xab')](',');var _0x19cd35={};_0x19cd35[_0x185b19[0x0]]={'$gte':moment(_0x185b19[0x1])['format'](_0x8061('0xac'))};_0x549edb[_0x8061('0x54')]=_[_0x8061('0x58')](_0x549edb[_0x8061('0x54')],_0x19cd35);}_0x549edb=_[_0x8061('0x58')]({},_0x549edb,_0x5ced0b[_0x8061('0x60')]);return db[_0x8061('0xa9')]['count']({'where':_0x549edb[_0x8061('0x54')]})[_0x8061('0x25')](function(_0x807bc0){_0x339d11[_0x8061('0x36')]=_0x807bc0;if(_0x5ced0b[_0x8061('0x4b')][_0x8061('0x59')]){_0x549edb[_0x8061('0x5a')]=[{'all':!![]}];}return db[_0x8061('0xa9')][_0x8061('0x5b')](_0x549edb);})[_0x8061('0x25')](function(_0x439c23){_0x339d11['rows']=_0x439c23;return _0x339d11;});}})[_0x8061('0x25')](respondWithFilteredResult(_0xf1eb5c,_0x549edb))[_0x8061('0x5c')](handleError(_0xf1eb5c,null));};exports['send']=function(_0x39186b,_0x5f3b9f,_0x3c6bb5){var _0xd43ee0,_0x534deb={},_0x4af2ec;if(_0x39186b[_0x8061('0x63')]['to']){_0x4af2ec=_0x39186b[_0x8061('0x63')]['to'][0x0];}return db[_0x8061('0x45')][_0x8061('0x61')]({'where':{'id':_0x39186b['params']['id']},'include':[{'model':db[_0x8061('0xad')],'as':_0x8061('0xae'),'include':[{'model':db[_0x8061('0x79')],'as':'Contacts','where':{'fax':_0x4af2ec},'limit':0x1,'order':[[_0x8061('0xaf'),_0x8061('0xb0')]]}]}]})[_0x8061('0x25')](handleEntityNotFound(_0x5f3b9f,null))[_0x8061('0x25')](function(_0x12c74d){_0xd43ee0=_0x12c74d;if(_0x39186b['body'][_0x8061('0xb1')]&&_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][_0x8061('0x51')]){for(var _0x4cea1c=0x0;_0x4cea1c<_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][_0x8061('0x51')];_0x4cea1c+=0x1){_0x39186b[_0x8061('0x63')]['attachments'][_0x4cea1c]={'filename':_0x39186b['body'][_0x8061('0xb1')][_0x4cea1c][_0x8061('0x41')],'id':_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][_0x4cea1c]['id'],'path':path[_0x8061('0xb2')](config[_0x8061('0xb3')],'server/files/attachments',_0x39186b[_0x8061('0x63')]['attachments'][_0x4cea1c]['basename'])};}}return respondWithRpcPromise(_0x8061('0xb4'),_0x8061('0xb4'),{'FaxAccountId':_['isNil'](_0x39186b['params']['id'])?undefined:_0x39186b[_0x8061('0x5e')]['id'],'path':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')]['attachments'][0x0][_0x8061('0x8')])?undefined:_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0][_0x8061('0x8')],'fax':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')]['to'][0x0])?undefined:_0x39186b[_0x8061('0x63')]['to'][0x0]},client9002);})[_0x8061('0x25')](function(){if(_0xd43ee0){if(_[_0x8061('0xb5')](_0x39186b['body'][_0x8061('0xb6')])){_0x39186b[_0x8061('0x63')]['from']=util[_0x8061('0xb7')]('\x22%s\x22\x20<%s>',_0xd43ee0[_0x8061('0x41')],_0xd43ee0[_0x8061('0xb8')]);}if(_0xd43ee0[_0x8061('0xae')]){if(_0xd43ee0['List'][_0x8061('0xb9')][_0x8061('0x51')]){return _0xd43ee0[_0x8061('0xae')][_0x8061('0xb9')][0x0];}else{return db['CmContact'][_0x8061('0x62')](_[_0x8061('0x1d')](_0x39186b[_0x8061('0x63')],{'firstName':_0x39186b[_0x8061('0x63')]['to'][0x0],'phone':_0x39186b[_0x8061('0x63')]['to'][0x0],'fax':_0x39186b[_0x8061('0x63')]['to'][0x0],'ListId':_0xd43ee0['ListId']}));}}else{throw new Error(_0x8061('0xba'));}}else{throw new Error(_0x8061('0xbb'));}})[_0x8061('0x25')](function(_0x51a302){if(_0x51a302){return db[_0x8061('0x76')]['find']({'where':{'ContactId':_0x51a302['id'],'closed':![],'FaxAccountId':_0xd43ee0['id']}})[_0x8061('0x25')](function(_0x373569){if(_0x373569){return[_0x373569,![]];}return db[_0x8061('0x76')][_0x8061('0x62')]({'UserId':_0x39186b[_0x8061('0x64')]['id'],'ContactId':_0x51a302['id'],'FaxAccountId':_0xd43ee0['id'],'fax':_0x39186b[_0x8061('0x63')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x39186b['body'],{'read':![],'body':_0x39186b['body'][_0x8061('0xb1')][0x0][_0x8061('0xbc')],'FaxAccountId':_0xd43ee0['id'],'UserId':_0x39186b[_0x8061('0x64')]['id'],'ContactId':_0x51a302['id'],'AttachmentId':_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0]['id']})]},{'include':[{'model':db[_0x8061('0xa9')],'as':'Messages'}]})[_0x8061('0x25')](function(_0x3e79e3){return[_0x3e79e3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8061('0xbd')](function(_0x42d0db,_0x6b9105){if(_0x6b9105){return _0x42d0db;}return db[_0x8061('0xa9')][_0x8061('0x62')]({'direction':_0x8061('0xbe'),'read':![],'body':_0x39186b['body'][_0x8061('0xb1')][0x0][_0x8061('0xbc')],'FaxAccountId':_0xd43ee0['id'],'FaxInteractionId':_0x42d0db['id'],'UserId':_0x39186b[_0x8061('0x64')]['id'],'ContactId':_0x42d0db[_0x8061('0xbf')],'AttachmentId':_0x39186b['body']['attachments'][0x0]['id']})[_0x8061('0x25')](function(_0x445caa){_0x42d0db[_0x8061('0xc0')][_0x8061('0xc1')]=[];_0x42d0db[_0x8061('0xc0')][_0x8061('0xc1')][_0x8061('0x93')](_0x445caa[_0x8061('0xc0')]);return _0x42d0db;});})['then'](function(_0x286122){respondWithRpcPromise(_0x8061('0xc2'),_0x8061('0xc2'),{'FaxAccountId':_['isNil'](_0x39186b[_0x8061('0x5e')]['id'])?undefined:_0x39186b[_0x8061('0x5e')]['id'],'path':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0]['path'])?undefined:_0x39186b[_0x8061('0x63')][_0x8061('0xb1')][0x0][_0x8061('0x8')],'fax':_[_0x8061('0xb5')](_0x39186b[_0x8061('0x63')]['to'][0x0])?undefined:_0x39186b['body']['to'][0x0],'AttachmentId':_0x39186b['body'][_0x8061('0xb1')][0x0]['id']},client9002)['then'](function(_0x18aca2){logger[_0x8061('0x26')](_0x8061('0xc3'),_0x18aca2);})['catch'](function(_0x2f2602){logger[_0x8061('0x26')]('SendFaxRpc,\x20%s',_0x2f2602);});return _0x286122;})[_0x8061('0x25')](respondWithResult(_0x5f3b9f,null))[_0x8061('0x5c')](handleError(_0x5f3b9f,null));};exports[_0x8061('0xc4')]=function(_0x466919,_0x511b7e,_0x109ae0){return db['FaxAccount']['find']({'where':{'id':_0x466919[_0x8061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x511b7e,null))[_0x8061('0x25')](function(_0x1cec09){if(_0x1cec09){return _0x1cec09[_0x8061('0xc4')](_0x466919[_0x8061('0x63')][_0x8061('0x71')],_[_0x8061('0x77')](_0x466919[_0x8061('0x63')],[_0x8061('0x71'),'id'])||{})[_0x8061('0xbd')](function(_0x2d9e21){for(var _0x19ca26=0x0;_0x19ca26<_0x466919[_0x8061('0x63')][_0x8061('0x71')][_0x8061('0x51')];_0x19ca26+=0x1){socket[_0x8061('0xc5')](_0x8061('0xc6'),{'UserId':Number(_0x466919[_0x8061('0x63')]['ids'][_0x19ca26]),'FaxAccountId':Number(_0x466919[_0x8061('0x5e')]['id'])});}return _0x2d9e21;});}})['then'](respondWithResult(_0x511b7e,null))['catch'](handleError(_0x511b7e,null));};exports[_0x8061('0xc7')]=function(_0x36c340,_0x454f36,_0x10194c){return db[_0x8061('0x45')]['find']({'where':{'id':_0x36c340[_0x8061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x454f36,null))['then'](function(_0x4f0418){if(_0x4f0418){return _0x4f0418[_0x8061('0xc7')](_0x36c340[_0x8061('0x4b')][_0x8061('0x71')])[_0x8061('0x25')](function(){if(_[_0x8061('0xc8')](_0x36c340[_0x8061('0x4b')][_0x8061('0x71')])){for(var _0x4eb5e4=0x0;_0x4eb5e4<_0x36c340['query'][_0x8061('0x71')][_0x8061('0x51')];_0x4eb5e4+=0x1){socket[_0x8061('0xc5')](_0x8061('0xc9'),{'UserId':Number(_0x36c340[_0x8061('0x4b')][_0x8061('0x71')][_0x4eb5e4]),'FaxAccountId':Number(_0x36c340[_0x8061('0x5e')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x36c340[_0x8061('0x4b')][_0x8061('0x71')]),'FaxAccountId':Number(_0x36c340[_0x8061('0x5e')]['id'])});}});}})[_0x8061('0x25')](respondWithStatusCode(_0x454f36,null))[_0x8061('0x5c')](handleError(_0x454f36,null));};exports[_0x8061('0xca')]=function(_0x733afa,_0x4b7f31,_0x527a47){var _0x152ed4={};var _0x129a85={};var _0xe84fff;var _0x7b3571;return db[_0x8061('0x45')]['findOne']({'where':{'id':_0x733afa[_0x8061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4b7f31,null))[_0x8061('0x25')](function(_0x4454c8){if(_0x4454c8){_0xe84fff=_0x4454c8;_0x129a85[_0x8061('0x4e')]=_['keys'](db[_0x8061('0x7a')][_0x8061('0x46')]);_0x129a85[_0x8061('0x4b')]=_[_0x8061('0x4c')](_0x733afa[_0x8061('0x4b')]);_0x129a85['filters']=_[_0x8061('0x4d')](_0x129a85[_0x8061('0x4e')],_0x129a85[_0x8061('0x4b')]);_0x152ed4[_0x8061('0x4f')]=_[_0x8061('0x4d')](_0x129a85[_0x8061('0x4e')],qs[_0x8061('0x50')](_0x733afa[_0x8061('0x4b')][_0x8061('0x50')]));_0x152ed4[_0x8061('0x4f')]=_0x152ed4[_0x8061('0x4f')][_0x8061('0x51')]?_0x152ed4['attributes']:_0x129a85[_0x8061('0x4e')];_0x152ed4[_0x8061('0x6e')]=qs['sort'](_0x733afa[_0x8061('0x4b')][_0x8061('0x6f')]);_0x152ed4[_0x8061('0x54')]=qs[_0x8061('0x55')](_[_0x8061('0x56')](_0x733afa[_0x8061('0x4b')],_0x129a85[_0x8061('0x55')]));if(_0x733afa[_0x8061('0x4b')]['filter']){_0x152ed4['where']=_[_0x8061('0x58')](_0x152ed4[_0x8061('0x54')],{'$or':_['map'](_0x152ed4[_0x8061('0x4f')],function(_0x3894f6){var _0x290fbb={};_0x290fbb[_0x3894f6]={'$like':'%'+_0x733afa[_0x8061('0x4b')][_0x8061('0x57')]+'%'};return _0x290fbb;})});}_0x152ed4=_[_0x8061('0x58')]({},_0x152ed4,_0x733afa[_0x8061('0x60')]);return _0xe84fff[_0x8061('0xca')](_0x152ed4);}})[_0x8061('0x25')](function(_0x286e7e){if(_0x286e7e){_0x7b3571=_0x286e7e['length'];if(!_0x733afa[_0x8061('0x4b')][_0x8061('0x52')](_0x8061('0x53'))){_0x152ed4[_0x8061('0x35')]=qs[_0x8061('0x35')](_0x733afa[_0x8061('0x4b')]['limit']);_0x152ed4[_0x8061('0x33')]=qs[_0x8061('0x33')](_0x733afa['query'][_0x8061('0x33')]);}return _0xe84fff[_0x8061('0xca')](_0x152ed4);}})[_0x8061('0x25')](function(_0x1d03e0){if(_0x1d03e0){return _0x1d03e0?{'count':_0x7b3571,'rows':_0x1d03e0}:null;}})[_0x8061('0x25')](respondWithResult(_0x4b7f31,null))[_0x8061('0x5c')](handleError(_0x4b7f31,null));}; \ No newline at end of file +var _0x335d=['name','send','index','Pause','map','FaxAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','FaxAccountId','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','sendStatus','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','fs-extra','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','defaults','redis','socket.io-emitter','./faxAccount.socket','jayson/promise','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','FaxAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x335d,0x90));var _0xd335=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x335d[_0x4b6830];return _0x239e4a;};'use strict';var emlformat=require(_0xd335('0x0'));var rimraf=require(_0xd335('0x1'));var zipdir=require(_0xd335('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd335('0x3'));var Mustache=require('mustache');var util=require(_0xd335('0x4'));var path=require(_0xd335('0x5'));var sox=require(_0xd335('0x6'));var csv=require('to-csv');var ejs=require(_0xd335('0x7'));var fs=require('fs');var fs_extra=require(_0xd335('0x8'));var _=require(_0xd335('0x9'));var squel=require(_0xd335('0xa'));var crypto=require('crypto');var jsforce=require(_0xd335('0xb'));var deskjs=require(_0xd335('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd335('0xd'));var Papa=require('papaparse');var Redis=require(_0xd335('0xe'));var authService=require(_0xd335('0xf'));var qs=require(_0xd335('0x10'));var as=require(_0xd335('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd335('0x12'))(_0xd335('0x13'));var utils=require(_0xd335('0x14'));var config=require(_0xd335('0x15'));var licenseUtil=require(_0xd335('0x16'));var db=require(_0xd335('0x17'))['db'];config['redis']=_[_0xd335('0x18')](config[_0xd335('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd335('0x1a'))(new Redis(config[_0xd335('0x19')]));require(_0xd335('0x1b'))['register'](socket);var jayson=require(_0xd335('0x1c'));var client=jayson['client'][_0xd335('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x475123,_0x2f5811,_0x51df34,_0x329678){return new BPromise(function(_0x482bf1,_0x241c3b){var _0x48de34=_0x329678||client;return _0x48de34['request'](_0x475123,_0x51df34)[_0xd335('0x1e')](function(_0x2129ec){logger[_0xd335('0x1f')](_0xd335('0x20'),_0x2f5811,_0xd335('0x21'));logger[_0xd335('0x22')](_0xd335('0x23'),_0x2f5811,_0xd335('0x21'),JSON['stringify'](_0x2129ec));if(_0x2129ec[_0xd335('0x24')]){if(_0x2129ec[_0xd335('0x24')][_0xd335('0x25')]===0x1f4){logger[_0xd335('0x24')](_0xd335('0x20'),_0x2f5811,_0x2129ec['error'][_0xd335('0x26')]);return _0x241c3b(_0x2129ec[_0xd335('0x24')][_0xd335('0x26')]);}logger[_0xd335('0x24')]('FaxAccount,\x20%s,\x20%s',_0x2f5811,_0x2129ec[_0xd335('0x24')][_0xd335('0x26')]);return _0x482bf1(_0x2129ec[_0xd335('0x24')][_0xd335('0x26')]);}else{logger[_0xd335('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x2f5811,_0xd335('0x21'));_0x482bf1(_0x2129ec[_0xd335('0x27')][_0xd335('0x26')]);}})['catch'](function(_0x20fc21){logger['error'](_0xd335('0x20'),_0x2f5811,_0x20fc21);_0x241c3b(_0x20fc21);});});}function respondWithStatusCode(_0x31fd80,_0x582ae4){_0x582ae4=_0x582ae4||0xcc;return function(_0x1df5ea){if(_0x1df5ea){return _0x31fd80['sendStatus'](_0x582ae4);}return _0x31fd80[_0xd335('0x28')](_0x582ae4)[_0xd335('0x29')]();};}function respondWithResult(_0x37b88b,_0x524896){_0x524896=_0x524896||0xc8;return function(_0xfa6362){if(_0xfa6362){return _0x37b88b[_0xd335('0x28')](_0x524896)[_0xd335('0x2a')](_0xfa6362);}};}function respondWithFilteredResult(_0x2cb696,_0x13f26a){return function(_0x3226ad){if(_0x3226ad){var _0x5cd81e=typeof _0x13f26a[_0xd335('0x2b')]==='undefined'&&typeof _0x13f26a[_0xd335('0x2c')]===_0xd335('0x2d');var _0x1a15ae=_0x3226ad[_0xd335('0x2e')];var _0x8ea45c=_0x5cd81e?0x0:_0x13f26a[_0xd335('0x2b')];var _0x5adb41=_0x5cd81e?_0x3226ad[_0xd335('0x2e')]:_0x13f26a[_0xd335('0x2b')]+_0x13f26a[_0xd335('0x2c')];var _0x29a6ff;if(_0x5adb41>=_0x1a15ae){_0x5adb41=_0x1a15ae;_0x29a6ff=0xc8;}else{_0x29a6ff=0xce;}_0x2cb696[_0xd335('0x28')](_0x29a6ff);return _0x2cb696[_0xd335('0x2f')](_0xd335('0x30'),_0x8ea45c+'-'+_0x5adb41+'/'+_0x1a15ae)[_0xd335('0x2a')](_0x3226ad);}return null;};}function patchUpdates(_0x420a19){return function(_0x18ddd6){try{jsonpatch[_0xd335('0x31')](_0x18ddd6,_0x420a19,!![]);}catch(_0x56d704){return BPromise[_0xd335('0x32')](_0x56d704);}return _0x18ddd6[_0xd335('0x33')]();};}function saveUpdates(_0x53a3dc,_0x5aa291){return function(_0x4fcd7a){if(_0x4fcd7a){return _0x4fcd7a['update'](_0x53a3dc)[_0xd335('0x1e')](function(_0x5ba27a){return _0x5ba27a;});}return null;};}function removeEntity(_0x23e00a,_0x49a6ad){return function(_0xbdcec8){if(_0xbdcec8){return _0xbdcec8[_0xd335('0x34')]()[_0xd335('0x1e')](function(){var _0x3b6418=_0xbdcec8['get']({'plain':!![]});var _0x2c776b=_0xd335('0x35');return db['UserProfileResource'][_0xd335('0x34')]({'where':{'type':_0x2c776b,'resourceId':_0x3b6418['id']}})[_0xd335('0x1e')](function(){return _0xbdcec8;});})[_0xd335('0x1e')](function(){_0x23e00a[_0xd335('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54adca,_0x3e8880){return function(_0x351ae2){if(!_0x351ae2){_0x54adca['sendStatus'](0x194);}return _0x351ae2;};}function handleError(_0x3024fa,_0x351975){_0x351975=_0x351975||0x1f4;return function(_0x3b4c4c){logger[_0xd335('0x24')](_0x3b4c4c['stack']);if(_0x3b4c4c[_0xd335('0x36')]){delete _0x3b4c4c[_0xd335('0x36')];}_0x3024fa[_0xd335('0x28')](_0x351975)[_0xd335('0x37')](_0x3b4c4c);};}exports[_0xd335('0x38')]=function(_0x4a53b6,_0x2fc916){var _0x43a717={'include':[{'model':db[_0xd335('0x39')],'as':'mandatoryDispositionPause'}]},_0x50989c={},_0x29d740={'count':0x0,'rows':[]};var _0x43ba4e=_[_0xd335('0x3a')](db[_0xd335('0x3b')]['rawAttributes'],function(_0x354eff){return{'name':_0x354eff[_0xd335('0x3c')],'type':_0x354eff[_0xd335('0x3d')][_0xd335('0x3e')]};});_0x50989c[_0xd335('0x3f')]=_[_0xd335('0x3a')](_0x43ba4e,_0xd335('0x36'));_0x50989c[_0xd335('0x40')]=_['keys'](_0x4a53b6[_0xd335('0x40')]);_0x50989c['filters']=_[_0xd335('0x41')](_0x50989c[_0xd335('0x3f')],_0x50989c[_0xd335('0x40')]);_0x43a717[_0xd335('0x42')]=_[_0xd335('0x41')](_0x50989c[_0xd335('0x3f')],qs[_0xd335('0x43')](_0x4a53b6[_0xd335('0x40')]['fields']));_0x43a717[_0xd335('0x42')]=_0x43a717[_0xd335('0x42')][_0xd335('0x44')]?_0x43a717['attributes']:_0x50989c[_0xd335('0x3f')];if(!_0x4a53b6[_0xd335('0x40')]['hasOwnProperty'](_0xd335('0x45'))){_0x43a717['limit']=qs[_0xd335('0x2c')](_0x4a53b6[_0xd335('0x40')][_0xd335('0x2c')]);_0x43a717['offset']=qs[_0xd335('0x2b')](_0x4a53b6[_0xd335('0x40')][_0xd335('0x2b')]);}_0x43a717['order']=qs[_0xd335('0x46')](_0x4a53b6['query'][_0xd335('0x46')]);_0x43a717[_0xd335('0x47')]=qs[_0xd335('0x48')](_[_0xd335('0x49')](_0x4a53b6[_0xd335('0x40')],_0x50989c['filters']),_0x43ba4e);if(_0x4a53b6['query']['filter']){_0x43a717[_0xd335('0x47')]=_['merge'](_0x43a717[_0xd335('0x47')],{'$or':_[_0xd335('0x3a')](_0x43ba4e,function(_0x2b241a){if(_0x2b241a[_0xd335('0x3d')]!==_0xd335('0x4a')){var _0x30607a={};_0x30607a[_0x2b241a[_0xd335('0x36')]]={'$like':'%'+_0x4a53b6[_0xd335('0x40')][_0xd335('0x4b')]+'%'};return _0x30607a;}})});}_0x43a717=_[_0xd335('0x4c')]({},_0x43a717,_0x4a53b6[_0xd335('0x4d')]);var _0x41a799={'where':_0x43a717[_0xd335('0x47')]};return db[_0xd335('0x3b')][_0xd335('0x2e')](_0x41a799)[_0xd335('0x1e')](function(_0x3d663d){_0x29d740[_0xd335('0x2e')]=_0x3d663d;if(_0x4a53b6[_0xd335('0x40')][_0xd335('0x4e')]){_0x43a717['include']=[{'all':!![]}];}return db['FaxAccount'][_0xd335('0x4f')](_0x43a717);})['then'](function(_0x43a3b4){_0x29d740[_0xd335('0x50')]=_0x43a3b4;return _0x29d740;})[_0xd335('0x1e')](respondWithFilteredResult(_0x2fc916,_0x43a717))[_0xd335('0x51')](handleError(_0x2fc916,null));};exports[_0xd335('0x52')]=function(_0x5bfe7c,_0x1811ea){var _0x4305a2={'raw':![],'where':{'id':_0x5bfe7c[_0xd335('0x53')]['id']},'include':[{'model':db[_0xd335('0x39')],'as':_0xd335('0x54')}]},_0x20d1ad={};_0x20d1ad[_0xd335('0x3f')]=_[_0xd335('0x55')](db['FaxAccount'][_0xd335('0x56')]);_0x20d1ad[_0xd335('0x40')]=_['keys'](_0x5bfe7c[_0xd335('0x40')]);_0x20d1ad[_0xd335('0x48')]=_[_0xd335('0x41')](_0x20d1ad['model'],_0x20d1ad[_0xd335('0x40')]);_0x4305a2[_0xd335('0x42')]=_[_0xd335('0x41')](_0x20d1ad['model'],qs['fields'](_0x5bfe7c['query'][_0xd335('0x43')]));_0x4305a2['attributes']=_0x4305a2[_0xd335('0x42')][_0xd335('0x44')]?_0x4305a2[_0xd335('0x42')]:_0x20d1ad[_0xd335('0x3f')];if(_0x5bfe7c[_0xd335('0x40')][_0xd335('0x4e')]){_0x4305a2[_0xd335('0x57')]=[{'all':!![]}];}_0x4305a2=_[_0xd335('0x4c')]({},_0x4305a2,_0x5bfe7c[_0xd335('0x4d')]);return db[_0xd335('0x3b')][_0xd335('0x58')](_0x4305a2)[_0xd335('0x1e')](handleEntityNotFound(_0x1811ea,null))['then'](respondWithResult(_0x1811ea,null))[_0xd335('0x51')](handleError(_0x1811ea,null));};exports[_0xd335('0x59')]=function(_0x4c183b,_0x2548c8){return db[_0xd335('0x3b')][_0xd335('0x59')](_0x4c183b[_0xd335('0x5a')],{})[_0xd335('0x1e')](function(_0x13e8a1){var _0x29aafa=_0x4c183b[_0xd335('0x5b')][_0xd335('0x5c')]({'plain':!![]});if(!_0x29aafa)throw new Error(_0xd335('0x5d'));if(_0x29aafa['role']==='user'){var _0x2ffe97=_0x13e8a1[_0xd335('0x5c')]({'plain':!![]});var _0x67649f=_0xd335('0x35');return db[_0xd335('0x5e')]['find']({'where':{'name':_0x67649f,'userProfileId':_0x29aafa[_0xd335('0x5f')]},'raw':!![]})[_0xd335('0x1e')](function(_0x2cfa45){if(_0x2cfa45&&_0x2cfa45[_0xd335('0x60')]===0x0){return db[_0xd335('0x61')]['create']({'name':_0x2ffe97[_0xd335('0x36')],'resourceId':_0x2ffe97['id'],'type':_0x2cfa45[_0xd335('0x36')],'sectionId':_0x2cfa45['id']},{})[_0xd335('0x1e')](function(){return _0x13e8a1;});}else{return _0x13e8a1;}})[_0xd335('0x51')](function(_0x397721){logger[_0xd335('0x24')](_0xd335('0x62'),_0x397721);throw _0x397721;});}return _0x13e8a1;})[_0xd335('0x1e')](respondWithResult(_0x2548c8,0xc9))['catch'](handleError(_0x2548c8,null));};exports[_0xd335('0x63')]=function(_0xb5812a,_0x4a4727){if(_0xb5812a['body']['id']){delete _0xb5812a[_0xd335('0x5a')]['id'];}return db['FaxAccount'][_0xd335('0x58')]({'where':{'id':_0xb5812a[_0xd335('0x53')]['id']},'include':[{'model':db[_0xd335('0x39')],'as':_0xd335('0x54')}]})[_0xd335('0x1e')](handleEntityNotFound(_0x4a4727,null))['then'](saveUpdates(_0xb5812a[_0xd335('0x5a')],null))[_0xd335('0x1e')](respondWithResult(_0x4a4727,null))['catch'](handleError(_0x4a4727,null));};exports[_0xd335('0x34')]=function(_0x2ccf77,_0x593a24){return db[_0xd335('0x3b')]['find']({'where':{'id':_0x2ccf77['params']['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x593a24,null))['then'](removeEntity(_0x593a24,null))[_0xd335('0x51')](handleError(_0x593a24,null));};exports[_0xd335('0x64')]=function(_0x2cc4da,_0x2fc3a7){return db['FaxAccount']['describe']()[_0xd335('0x1e')](respondWithResult(_0x2fc3a7,null))['catch'](handleError(_0x2fc3a7,null));};exports[_0xd335('0x65')]=function(_0x4bdbae,_0x2532e6,_0x347fcf){if(_0x4bdbae[_0xd335('0x5a')]['id']){delete _0x4bdbae[_0xd335('0x5a')]['id'];}return db[_0xd335('0x3b')]['find']({'where':{'id':_0x4bdbae[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x2532e6,null))[_0xd335('0x1e')](function(_0x397da4){if(_0x397da4){_0x4bdbae[_0xd335('0x5a')]['FaxAccountId']=_0x397da4['id'];return db[_0xd335('0x66')]['create'](_0x4bdbae['body']);}})['then'](respondWithResult(_0x2532e6,null))[_0xd335('0x51')](handleError(_0x2532e6,null));};exports[_0xd335('0x67')]=function(_0x96e581,_0x5c22e3,_0x288719){var _0x4de1fb={'raw':![],'where':{}};var _0x4634bd={};var _0x40da64={'count':0x0,'rows':[]};return db[_0xd335('0x3b')][_0xd335('0x68')]({'where':{'id':_0x96e581['params']['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x5c22e3,null))[_0xd335('0x1e')](function(_0x5d3602){if(_0x5d3602){_0x4634bd[_0xd335('0x3f')]=_[_0xd335('0x55')](db[_0xd335('0x66')]['rawAttributes']);_0x4634bd[_0xd335('0x40')]=_['keys'](_0x96e581[_0xd335('0x40')]);_0x4634bd[_0xd335('0x48')]=_[_0xd335('0x41')](_0x4634bd[_0xd335('0x3f')],_0x4634bd[_0xd335('0x40')]);_0x4de1fb['attributes']=_['intersection'](_0x4634bd['model'],qs[_0xd335('0x43')](_0x96e581['query']['fields']));_0x4de1fb[_0xd335('0x42')]=_0x4de1fb['attributes'][_0xd335('0x44')]?_0x4de1fb['attributes']:_0x4634bd[_0xd335('0x3f')];if(!_0x96e581[_0xd335('0x40')][_0xd335('0x69')](_0xd335('0x45'))){_0x4de1fb[_0xd335('0x2c')]=qs[_0xd335('0x2c')](_0x96e581[_0xd335('0x40')]['limit']);_0x4de1fb[_0xd335('0x2b')]=qs[_0xd335('0x2b')](_0x96e581[_0xd335('0x40')]['offset']);}_0x4de1fb[_0xd335('0x6a')]=qs['sort'](_0x96e581[_0xd335('0x40')][_0xd335('0x46')]);_0x4de1fb[_0xd335('0x47')]=qs['filters'](_[_0xd335('0x49')](_0x96e581['query'],_0x4634bd[_0xd335('0x48')]));_0x4de1fb['where']['FaxAccountId']=_0x5d3602['id'];if(_0x96e581[_0xd335('0x40')][_0xd335('0x4b')]){_0x4de1fb[_0xd335('0x47')]=_[_0xd335('0x4c')](_0x4de1fb[_0xd335('0x47')],{'$or':_[_0xd335('0x3a')](_0x4de1fb[_0xd335('0x42')],function(_0x45fb60){var _0x26ac73={};_0x26ac73[_0x45fb60]={'$like':'%'+_0x96e581['query'][_0xd335('0x4b')]+'%'};return _0x26ac73;})});}_0x4de1fb=_['merge']({},_0x4de1fb,_0x96e581[_0xd335('0x4d')]);return db[_0xd335('0x66')][_0xd335('0x2e')]({'where':_0x4de1fb['where']})[_0xd335('0x1e')](function(_0x1faacb){_0x40da64[_0xd335('0x2e')]=_0x1faacb;if(_0x96e581[_0xd335('0x40')][_0xd335('0x4e')]){_0x4de1fb[_0xd335('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xd335('0x4f')](_0x4de1fb);})[_0xd335('0x1e')](function(_0x30dcd5){_0x40da64['rows']=_0x30dcd5;return _0x40da64;});}})['then'](respondWithFilteredResult(_0x5c22e3,_0x4de1fb))[_0xd335('0x51')](handleError(_0x5c22e3,null));};exports[_0xd335('0x6b')]=function(_0x5d6373,_0x1b1d22,_0xbc53fa){return db[_0xd335('0x3b')][_0xd335('0x58')]({'where':{'id':_0x5d6373[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x1b1d22,null))[_0xd335('0x1e')](function(_0x3df49f){if(_0x3df49f){return _0x3df49f[_0xd335('0x6b')](_0x5d6373['query']['ids']);}})[_0xd335('0x1e')](respondWithStatusCode(_0x1b1d22,null))[_0xd335('0x51')](handleError(_0x1b1d22,null));};exports['addAnswer']=function(_0x4a6f20,_0x2528e5,_0x35609c){if(_0x4a6f20[_0xd335('0x5a')]['id']){delete _0x4a6f20['body']['id'];}return db['FaxAccount'][_0xd335('0x58')]({'where':{'id':_0x4a6f20['params']['id']}})['then'](handleEntityNotFound(_0x2528e5,null))[_0xd335('0x1e')](function(_0x2f5b7b){if(_0x2f5b7b){_0x4a6f20[_0xd335('0x5a')][_0xd335('0x6c')]=_0x2f5b7b['id'];return db['CannedAnswer'][_0xd335('0x59')](_0x4a6f20[_0xd335('0x5a')]);}})[_0xd335('0x1e')](respondWithResult(_0x2528e5,null))['catch'](handleError(_0x2528e5,null));};exports[_0xd335('0x6d')]=function(_0x453a86,_0x2739d5,_0x22fbfc){var _0x63a9e9={'raw':![],'where':{}};var _0x5d306c={};var _0x3ed0ef={'count':0x0,'rows':[]};return db[_0xd335('0x3b')]['findOne']({'where':{'id':_0x453a86[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x2739d5,null))[_0xd335('0x1e')](function(_0x18e64c){if(_0x18e64c){_0x5d306c[_0xd335('0x3f')]=_[_0xd335('0x55')](db['CannedAnswer']['rawAttributes']);_0x5d306c[_0xd335('0x40')]=_[_0xd335('0x55')](_0x453a86[_0xd335('0x40')]);_0x5d306c['filters']=_[_0xd335('0x41')](_0x5d306c[_0xd335('0x3f')],_0x5d306c[_0xd335('0x40')]);_0x63a9e9[_0xd335('0x42')]=_['intersection'](_0x5d306c[_0xd335('0x3f')],qs[_0xd335('0x43')](_0x453a86['query'][_0xd335('0x43')]));_0x63a9e9['attributes']=_0x63a9e9[_0xd335('0x42')]['length']?_0x63a9e9[_0xd335('0x42')]:_0x5d306c[_0xd335('0x3f')];if(!_0x453a86[_0xd335('0x40')][_0xd335('0x69')]('nolimit')){_0x63a9e9[_0xd335('0x2c')]=qs[_0xd335('0x2c')](_0x453a86[_0xd335('0x40')][_0xd335('0x2c')]);_0x63a9e9[_0xd335('0x2b')]=qs[_0xd335('0x2b')](_0x453a86['query']['offset']);}_0x63a9e9[_0xd335('0x6a')]=qs[_0xd335('0x46')](_0x453a86['query'][_0xd335('0x46')]);_0x63a9e9[_0xd335('0x47')]=qs[_0xd335('0x48')](_[_0xd335('0x49')](_0x453a86['query'],_0x5d306c[_0xd335('0x48')]));_0x63a9e9[_0xd335('0x47')]['FaxAccountId']=_0x18e64c['id'];if(_0x453a86[_0xd335('0x40')]['filter']){_0x63a9e9[_0xd335('0x47')]=_['merge'](_0x63a9e9[_0xd335('0x47')],{'$or':_[_0xd335('0x3a')](_0x63a9e9['attributes'],function(_0x29ae3c){var _0xad03bc={};_0xad03bc[_0x29ae3c]={'$like':'%'+_0x453a86[_0xd335('0x40')][_0xd335('0x4b')]+'%'};return _0xad03bc;})});}_0x63a9e9=_[_0xd335('0x4c')]({},_0x63a9e9,_0x453a86[_0xd335('0x4d')]);return db['CannedAnswer'][_0xd335('0x2e')]({'where':_0x63a9e9[_0xd335('0x47')]})[_0xd335('0x1e')](function(_0x1c5a15){_0x3ed0ef[_0xd335('0x2e')]=_0x1c5a15;if(_0x453a86['query'][_0xd335('0x4e')]){_0x63a9e9['include']=[{'all':!![]}];}return db[_0xd335('0x6e')][_0xd335('0x4f')](_0x63a9e9);})[_0xd335('0x1e')](function(_0x5df51d){_0x3ed0ef[_0xd335('0x50')]=_0x5df51d;return _0x3ed0ef;});}})[_0xd335('0x1e')](respondWithFilteredResult(_0x2739d5,_0x63a9e9))[_0xd335('0x51')](handleError(_0x2739d5,null));};exports[_0xd335('0x6f')]=function(_0x599cee,_0x4511b4,_0x1fb90b){return db[_0xd335('0x3b')][_0xd335('0x58')]({'where':{'id':_0x599cee[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x4511b4,null))['then'](function(_0xa3e2bb){if(_0xa3e2bb){return _0xa3e2bb['removeAnswers'](_0x599cee[_0xd335('0x40')][_0xd335('0x70')]);}})[_0xd335('0x1e')](respondWithStatusCode(_0x4511b4,null))[_0xd335('0x51')](handleError(_0x4511b4,null));};exports[_0xd335('0x71')]=function(_0x349fb0,_0x4af22f,_0x4a555e){return db[_0xd335('0x72')][_0xd335('0x58')]({'where':{'id':_0x349fb0[_0xd335('0x53')]['id']}})['then'](handleEntityNotFound(_0x4af22f,null))['then'](function(_0x51b903){if(_0x51b903){return _0x51b903[_0xd335('0x71')](_0x349fb0[_0xd335('0x5a')][_0xd335('0x70')],_[_0xd335('0x73')](_0x349fb0[_0xd335('0x5a')],[_0xd335('0x70'),'id'])||{});}})['then'](respondWithResult(_0x4af22f,null))['catch'](handleError(_0x4af22f,null));};exports['getInteractions']=function(_0x341cb8,_0x1fb1d4,_0x4ce3bb){var _0x13eb45={'raw':![],'where':{}};var _0x51a808={};var _0x301129={'count':0x0,'rows':[]};return db[_0xd335('0x3b')][_0xd335('0x68')]({'where':{'id':_0x341cb8[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x1fb1d4,null))[_0xd335('0x1e')](function(_0x5785a1){if(_0x5785a1){_0x51a808[_0xd335('0x3f')]=_[_0xd335('0x55')](db['FaxInteraction']['rawAttributes']);_0x51a808[_0xd335('0x40')]=_[_0xd335('0x55')](_0x341cb8[_0xd335('0x40')]);_0x51a808[_0xd335('0x48')]=_[_0xd335('0x41')](_0x51a808[_0xd335('0x3f')],_0x51a808[_0xd335('0x40')]);_0x13eb45[_0xd335('0x42')]=_[_0xd335('0x41')](_0x51a808[_0xd335('0x3f')],qs[_0xd335('0x43')](_0x341cb8['query'][_0xd335('0x43')]));_0x13eb45[_0xd335('0x42')]=_0x13eb45[_0xd335('0x42')]['length']?_0x13eb45['attributes']:_0x51a808['model'];if(!_0x341cb8['query'][_0xd335('0x69')](_0xd335('0x45'))){_0x13eb45[_0xd335('0x2c')]=qs[_0xd335('0x2c')](_0x341cb8[_0xd335('0x40')][_0xd335('0x2c')]);_0x13eb45[_0xd335('0x2b')]=qs[_0xd335('0x2b')](_0x341cb8[_0xd335('0x40')][_0xd335('0x2b')]);}_0x13eb45[_0xd335('0x6a')]=qs[_0xd335('0x46')](_0x341cb8['query'][_0xd335('0x46')]);_0x13eb45['where']=qs[_0xd335('0x48')](_[_0xd335('0x49')](_0x341cb8[_0xd335('0x40')],_0x51a808[_0xd335('0x48')]));_0x13eb45[_0xd335('0x47')]['FaxAccountId']=_0x5785a1['id'];if(_0x341cb8['query']['filter']){_0x13eb45[_0xd335('0x47')]=_['merge'](_0x13eb45[_0xd335('0x47')],{'$or':_[_0xd335('0x3a')](_0x13eb45[_0xd335('0x42')],function(_0x1a753b){var _0x4a605f={};_0x4a605f[_0x1a753b]={'$like':'%'+_0x341cb8['query']['filter']+'%'};return _0x4a605f;})});}_0x13eb45=_[_0xd335('0x4c')]({},_0x13eb45,_0x341cb8[_0xd335('0x4d')]);return db['FaxInteraction'][_0xd335('0x2e')]({'where':_0x13eb45[_0xd335('0x47')]})['then'](function(_0x730cf4){_0x301129[_0xd335('0x2e')]=_0x730cf4;if(_0x341cb8[_0xd335('0x40')][_0xd335('0x4e')]){_0x13eb45[_0xd335('0x57')]=[{'model':db['CmContact'],'as':_0xd335('0x74'),'required':![]},{'model':db[_0xd335('0x75')],'as':_0xd335('0x76'),'attributes':['name',_0xd335('0x77'),_0xd335('0x78')],'required':![]},{'model':db['Tag'],'as':_0xd335('0x79'),'attributes':['id','name',_0xd335('0x7a')],'where':_0x341cb8['query']['tag']?{'id':_0x341cb8[_0xd335('0x40')][_0xd335('0x7b')]}:undefined,'required':_0x341cb8[_0xd335('0x40')][_0xd335('0x7b')]?!![]:![]}];}return db[_0xd335('0x72')][_0xd335('0x4f')](_0x13eb45);})['then'](function(_0x45750c){_0x301129['rows']=_0x45750c;return _0x301129;});}})['then'](respondWithFilteredResult(_0x1fb1d4,_0x13eb45))['catch'](handleError(_0x1fb1d4,null));};exports[_0xd335('0x7c')]=function(_0x4a5fc5,_0x1a3455){var _0x28a4ac=_0x4a5fc5[_0xd335('0x53')]['id'];var _0x2f1b05=_0x4a5fc5['body'];var _0x4b662c=0xc8;var _0x8107b9=null;return db[_0xd335('0x7d')][_0xd335('0x7e')]({'isolationLevel':db['sequelize'][_0xd335('0x7f')][_0xd335('0x80')][_0xd335('0x81')]},function(_0x110866){return db[_0xd335('0x3b')][_0xd335('0x68')]({'where':{'id':_0x28a4ac},'transaction':_0x110866})['then'](function(_0x3ccc61){if(_0x3ccc61){return db['FaxApplication'][_0xd335('0x34')]({'where':{'FaxAccountId':_0x28a4ac},'transaction':_0x110866})[_0xd335('0x1e')](function(){var _0x49da22=_['map'](_0x2f1b05,function(_0x43fabd){_0x43fabd[_0xd335('0x6c')]=_0x28a4ac;return _0x43fabd;});return db[_0xd335('0x82')][_0xd335('0x83')](_0x49da22,{'transaction':_0x110866});});}else{_0x4b662c=0x194;_0x8107b9=[];}});})[_0xd335('0x1e')](function(){if(_0x4b662c!==0x194){return db['FaxApplication'][_0xd335('0x84')]({'where':{'FaxAccountId':_0x28a4ac},'order':_0xd335('0x85')})[_0xd335('0x1e')](function(_0xdfe969){_0x8107b9=_0xdfe969;});}})['catch'](function(_0x5dcac9){_0x4b662c=0x1f4;logger[_0xd335('0x24')](_0x5dcac9[_0xd335('0x86')]);if(_0x5dcac9[_0xd335('0x36')]){delete _0x5dcac9[_0xd335('0x36')];}_0x8107b9=_0x5dcac9;})[_0xd335('0x87')](function(){if(_0x8107b9===null){_0x1a3455[_0xd335('0x88')](_0x4b662c);}else{if(_0x4b662c===0x1f4){_0x1a3455[_0xd335('0x28')](_0x4b662c)[_0xd335('0x37')](_0x8107b9);}else{_0x1a3455['status'](_0x4b662c)[_0xd335('0x2a')](_0x8107b9);}}});};exports['getApplications']=function(_0x21bdb5,_0x553d5e,_0x450025){var _0x5b48db={};var _0x58eb0e={};var _0x5f57f4;var _0x3ba4d5;return db[_0xd335('0x3b')][_0xd335('0x68')]({'where':{'id':_0x21bdb5[_0xd335('0x53')]['id']}})['then'](handleEntityNotFound(_0x553d5e,null))['then'](function(_0x4c1c4e){if(_0x4c1c4e){_0x5f57f4=_0x4c1c4e;_0x58eb0e[_0xd335('0x3f')]=_[_0xd335('0x55')](db[_0xd335('0x82')][_0xd335('0x56')]);_0x58eb0e[_0xd335('0x40')]=_[_0xd335('0x55')](_0x21bdb5[_0xd335('0x40')]);_0x58eb0e['filters']=_[_0xd335('0x41')](_0x58eb0e['model'],_0x58eb0e[_0xd335('0x40')]);_0x5b48db['attributes']=_[_0xd335('0x41')](_0x58eb0e[_0xd335('0x3f')],qs[_0xd335('0x43')](_0x21bdb5['query'][_0xd335('0x43')]));_0x5b48db['attributes']=_0x5b48db[_0xd335('0x42')][_0xd335('0x44')]?_0x5b48db['attributes']:_0x58eb0e['model'];_0x5b48db[_0xd335('0x6a')]=qs[_0xd335('0x46')](_0x21bdb5['query'][_0xd335('0x46')]);_0x5b48db[_0xd335('0x47')]=qs['filters'](_[_0xd335('0x49')](_0x21bdb5[_0xd335('0x40')],_0x58eb0e['filters']));if(_0x21bdb5[_0xd335('0x40')][_0xd335('0x4b')]){_0x5b48db[_0xd335('0x47')]=_[_0xd335('0x4c')](_0x5b48db['where'],{'$or':_[_0xd335('0x3a')](_0x5b48db[_0xd335('0x42')],function(_0x47f4ff){var _0x550497={};_0x550497[_0x47f4ff]={'$like':'%'+_0x21bdb5[_0xd335('0x40')][_0xd335('0x4b')]+'%'};return _0x550497;})});}_0x5b48db=_['merge']({},_0x5b48db,_0x21bdb5[_0xd335('0x4d')]);return _0x5f57f4['getApplications'](_0x5b48db);}})[_0xd335('0x1e')](function(_0x437533){if(_0x437533){_0x3ba4d5=_0x437533['length'];if(!_0x21bdb5[_0xd335('0x40')]['hasOwnProperty'](_0xd335('0x45'))){_0x5b48db[_0xd335('0x2c')]=qs[_0xd335('0x2c')](_0x21bdb5[_0xd335('0x40')][_0xd335('0x2c')]);_0x5b48db[_0xd335('0x2b')]=qs[_0xd335('0x2b')](_0x21bdb5[_0xd335('0x40')][_0xd335('0x2b')]);}return _0x5f57f4['getApplications'](_0x5b48db);}})['then'](function(_0x33206c){if(_0x33206c){return _0x33206c?{'count':_0x3ba4d5,'rows':_0x33206c}:null;}})[_0xd335('0x1e')](respondWithResult(_0x553d5e,null))[_0xd335('0x51')](handleError(_0x553d5e,null));};function Extension(_0x430260,_0x47deb3,_0x127e23,_0x60065f){this['context']='from-voip-provider';this[_0xd335('0x89')]=_0x430260[_0xd335('0x8a')];this[_0xd335('0x8b')]=_0x60065f;this[_0xd335('0x3d')]=_0xd335('0x8c');this['description']=_0xd335('0x8d');this[_0xd335('0x6c')]=_0x430260['id'];this[_0xd335('0x85')]=_0x47deb3;this[_0xd335('0x8e')]=_0x127e23;}function createExtensionsReciveFax(_0x5c79d5){var _0x17bfda=0x1;var _0x4aff18=[];_0x4aff18[_0xd335('0x8f')](new Extension(_0x5c79d5,_0x17bfda,'',_0xd335('0x90')));_0x17bfda+=0x1;_0x4aff18[_0xd335('0x8f')](new Extension(_0x5c79d5,_0x17bfda,'CDR(type)=inbound-fax',_0xd335('0x91')));_0x17bfda+=0x1;for(var _0x4ac669 in _0x5c79d5){if(_0x5c79d5['hasOwnProperty'](_0x4ac669)&&(_0x4ac669===_0xd335('0x92')||_0x4ac669===_0xd335('0x8a')||_0x4ac669===_0xd335('0x93')||_0x4ac669===_0xd335('0x94')||_0x4ac669==='headerinfo'||_0x4ac669===_0xd335('0x95')||_0x4ac669==='minrate'||_0x4ac669==='modem'||_0x4ac669===_0xd335('0x96'))){_0x4aff18['push'](new Extension(_0x5c79d5,_0x17bfda,_0xd335('0x97')+_0x4ac669+')='+_0x5c79d5[_0x4ac669],_0xd335('0x91')));_0x17bfda+=0x1;}}_0x4aff18[_0xd335('0x8f')](new Extension(_0x5c79d5,_0x17bfda,'6',_0xd335('0x98')));_0x17bfda+=0x1;_0x4aff18[_0xd335('0x8f')](new Extension(_0x5c79d5,_0x17bfda,_0xd335('0x99'),_0xd335('0x9a')));_0x17bfda=0x0;return _0x4aff18;}exports['addAccountApplications']=function(_0xc25508,_0x5b3b4b,_0x480bad){var _0x20a752;return db[_0xd335('0x7d')][_0xd335('0x7e')](function(_0x1aff61){return db[_0xd335('0x3b')]['create'](_0xc25508[_0xd335('0x5a')],{'transaction':_0x1aff61})[_0xd335('0x1e')](function(_0xe66db9){_0x20a752=_0xe66db9[_0xd335('0x5c')]({'plain':!![]});return db[_0xd335('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x20a752),{'transaction':_0x1aff61});});})['then'](function(){return _0x20a752;})['then'](respondWithResult(_0x5b3b4b,null))[_0xd335('0x51')](handleError(_0x5b3b4b,null));};exports['updateAccountApplications']=function(_0x5dd25b,_0x2321f8,_0x5b0351){var _0x2d113a;return db[_0xd335('0x7d')][_0xd335('0x7e')](function(_0x4a3dea){return db[_0xd335('0x3b')][_0xd335('0x63')](_0x5dd25b[_0xd335('0x5a')],{'where':{'id':_0x5dd25b[_0xd335('0x5a')]['id']},'transaction':_0x4a3dea})[_0xd335('0x1e')](function(_0x492f45){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x5dd25b[_0xd335('0x5a')]['id']},'transaction':_0x4a3dea})[_0xd335('0x1e')](function(_0x251df4){return db[_0xd335('0x9b')][_0xd335('0x83')](createExtensionsReciveFax(_['omit'](_0x5dd25b[_0xd335('0x5a')],[_0xd335('0x9c'),_0xd335('0x3e'),_0xd335('0x9d'),_0xd335('0x9e'),_0xd335('0x9f'),_0xd335('0xa0')])),{'transaction':_0x4a3dea});});});})[_0xd335('0x1e')](function(){return db['FaxAccount'][_0xd335('0xa1')](_0x5dd25b['body']['id']);})[_0xd335('0x1e')](respondWithResult(_0x2321f8,null))[_0xd335('0x51')](handleError(_0x2321f8,null));};exports[_0xd335('0xa2')]=function(_0x5aed60,_0x3c5736,_0x279dd2){var _0x5f0dcd={'raw':!![],'where':{}};var _0x2828fd={};var _0x119966={'count':0x0,'rows':[]};return db[_0xd335('0x3b')][_0xd335('0x68')]({'where':{'id':_0x5aed60[_0xd335('0x53')]['id']}})['then'](handleEntityNotFound(_0x3c5736,null))[_0xd335('0x1e')](function(_0x108804){if(_0x108804){_0x2828fd[_0xd335('0x3f')]=_[_0xd335('0x55')](db[_0xd335('0xa3')][_0xd335('0x56')]);_0x2828fd[_0xd335('0x40')]=_['keys'](_0x5aed60[_0xd335('0x40')]);_0x2828fd['filters']=_['intersection'](_0x2828fd[_0xd335('0x3f')],_0x2828fd[_0xd335('0x40')]);_0x5f0dcd[_0xd335('0x42')]=_[_0xd335('0x41')](_0x2828fd['model'],qs[_0xd335('0x43')](_0x5aed60[_0xd335('0x40')][_0xd335('0x43')]));_0x5f0dcd[_0xd335('0x42')]=_0x5f0dcd[_0xd335('0x42')][_0xd335('0x44')]?_0x5f0dcd[_0xd335('0x42')]:_0x2828fd[_0xd335('0x3f')];if(!_0x5aed60['query']['hasOwnProperty']('nolimit')){_0x5f0dcd[_0xd335('0x2c')]=qs[_0xd335('0x2c')](_0x5aed60[_0xd335('0x40')][_0xd335('0x2c')]);_0x5f0dcd['offset']=qs[_0xd335('0x2b')](_0x5aed60[_0xd335('0x40')][_0xd335('0x2b')]);}_0x5f0dcd[_0xd335('0x6a')]=qs['sort'](_0x5aed60[_0xd335('0x40')]['sort']);_0x5f0dcd[_0xd335('0x47')]=qs[_0xd335('0x48')](_[_0xd335('0x49')](_0x5aed60['query'],_0x2828fd[_0xd335('0x48')]));_0x5f0dcd[_0xd335('0x47')][_0xd335('0x6c')]=_0x108804['id'];if(_0x5aed60[_0xd335('0x40')][_0xd335('0x4b')]){_0x5f0dcd[_0xd335('0x47')]=_[_0xd335('0x4c')](_0x5f0dcd[_0xd335('0x47')],{'$or':_['map'](_0x5f0dcd['attributes'],function(_0x9668fb){var _0xeee128={};_0xeee128[_0x9668fb]={'$like':'%'+_0x5aed60['query'][_0xd335('0x4b')]+'%'};return _0xeee128;})});}if(_0x5aed60[_0xd335('0x40')][_0xd335('0xa4')]){var _0x3251=_0x5aed60[_0xd335('0x40')]['$gte'][_0xd335('0xa5')](',');var _0x1c423f={};_0x1c423f[_0x3251[0x0]]={'$gte':moment(_0x3251[0x1])['format'](_0xd335('0xa6'))};_0x5f0dcd[_0xd335('0x47')]=_[_0xd335('0x4c')](_0x5f0dcd[_0xd335('0x47')],_0x1c423f);}_0x5f0dcd=_['merge']({},_0x5f0dcd,_0x5aed60[_0xd335('0x4d')]);return db[_0xd335('0xa3')][_0xd335('0x2e')]({'where':_0x5f0dcd[_0xd335('0x47')]})['then'](function(_0x3bff0b){_0x119966['count']=_0x3bff0b;if(_0x5aed60[_0xd335('0x40')][_0xd335('0x4e')]){_0x5f0dcd[_0xd335('0x57')]=[{'all':!![]}];}return db[_0xd335('0xa3')][_0xd335('0x4f')](_0x5f0dcd);})['then'](function(_0x333e4c){_0x119966[_0xd335('0x50')]=_0x333e4c;return _0x119966;});}})[_0xd335('0x1e')](respondWithFilteredResult(_0x3c5736,_0x5f0dcd))[_0xd335('0x51')](handleError(_0x3c5736,null));};exports['send']=function(_0x33ff81,_0x4c5aff,_0xabff6){var _0x539a79,_0x5d194a={},_0xf99ce6;if(_0x33ff81[_0xd335('0x5a')]['to']){_0xf99ce6=_0x33ff81['body']['to'][0x0];}return db[_0xd335('0x3b')]['find']({'where':{'id':_0x33ff81[_0xd335('0x53')]['id']},'include':[{'model':db[_0xd335('0xa7')],'as':'List','include':[{'model':db[_0xd335('0xa8')],'as':_0xd335('0xa9'),'where':{'fax':_0xf99ce6},'limit':0x1,'order':[[_0xd335('0x9e'),_0xd335('0xaa')]]}]}]})[_0xd335('0x1e')](handleEntityNotFound(_0x4c5aff,null))[_0xd335('0x1e')](function(_0x1e6405){_0x539a79=_0x1e6405;if(_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')]&&_0x33ff81[_0xd335('0x5a')]['attachments'][_0xd335('0x44')]){for(var _0x54cb47=0x0;_0x54cb47<_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][_0xd335('0x44')];_0x54cb47+=0x1){_0x33ff81['body'][_0xd335('0xab')][_0x54cb47]={'filename':_0x33ff81[_0xd335('0x5a')]['attachments'][_0x54cb47]['name'],'id':_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][_0x54cb47]['id'],'path':path[_0xd335('0xac')](config[_0xd335('0xad')],_0xd335('0xae'),_0x33ff81['body'][_0xd335('0xab')][_0x54cb47][_0xd335('0xaf')])};}}return respondWithRpcPromise(_0xd335('0xb0'),_0xd335('0xb0'),{'FaxAccountId':_[_0xd335('0xb1')](_0x33ff81['params']['id'])?undefined:_0x33ff81[_0xd335('0x53')]['id'],'path':_[_0xd335('0xb1')](_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][0x0]['path'])?undefined:_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][0x0]['path'],'fax':_['isNil'](_0x33ff81['body']['to'][0x0])?undefined:_0x33ff81[_0xd335('0x5a')]['to'][0x0]},client9002);})[_0xd335('0x1e')](function(){if(_0x539a79){if(_['isNil'](_0x33ff81[_0xd335('0x5a')][_0xd335('0xb2')])){_0x33ff81[_0xd335('0x5a')][_0xd335('0xb2')]=util[_0xd335('0xb3')](_0xd335('0xb4'),_0x539a79[_0xd335('0x36')],_0x539a79[_0xd335('0xb5')]);}if(_0x539a79[_0xd335('0xb6')]){if(_0x539a79['List'][_0xd335('0xa9')][_0xd335('0x44')]){return _0x539a79[_0xd335('0xb6')]['Contacts'][0x0];}else{return db[_0xd335('0xa8')][_0xd335('0x59')](_['defaults'](_0x33ff81[_0xd335('0x5a')],{'firstName':_0x33ff81[_0xd335('0x5a')]['to'][0x0],'phone':_0x33ff81['body']['to'][0x0],'fax':_0x33ff81[_0xd335('0x5a')]['to'][0x0],'ListId':_0x539a79['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xd335('0xb7'));}})[_0xd335('0x1e')](function(_0x1823f5){if(_0x1823f5){return db[_0xd335('0x72')][_0xd335('0x58')]({'where':{'ContactId':_0x1823f5['id'],'closed':![],'FaxAccountId':_0x539a79['id']}})[_0xd335('0x1e')](function(_0x264510){if(_0x264510){return[_0x264510,![]];}return db['FaxInteraction'][_0xd335('0x59')]({'UserId':_0x33ff81[_0xd335('0x5b')]['id'],'ContactId':_0x1823f5['id'],'FaxAccountId':_0x539a79['id'],'fax':_0x33ff81[_0xd335('0x5a')]['to'][0x0],'firstMsgDirection':_0xd335('0xb8'),'Messages':[_['merge'](_0x33ff81[_0xd335('0x5a')],{'read':![],'body':_0x33ff81['body'][_0xd335('0xab')][0x0][_0xd335('0xb9')],'FaxAccountId':_0x539a79['id'],'UserId':_0x33ff81[_0xd335('0x5b')]['id'],'ContactId':_0x1823f5['id'],'AttachmentId':_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xd335('0x1e')](function(_0x353ccb){return[_0x353ccb,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd335('0xba')](function(_0x78adbe,_0x2ca3b9){if(_0x2ca3b9){return _0x78adbe;}return db[_0xd335('0xa3')][_0xd335('0x59')]({'direction':_0xd335('0xb8'),'read':![],'body':_0x33ff81['body'][_0xd335('0xab')][0x0][_0xd335('0xb9')],'FaxAccountId':_0x539a79['id'],'FaxInteractionId':_0x78adbe['id'],'UserId':_0x33ff81[_0xd335('0x5b')]['id'],'ContactId':_0x78adbe[_0xd335('0xbb')],'AttachmentId':_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][0x0]['id']})[_0xd335('0x1e')](function(_0x21c8ea){_0x78adbe[_0xd335('0xbc')][_0xd335('0xbd')]=[];_0x78adbe[_0xd335('0xbc')][_0xd335('0xbd')][_0xd335('0x8f')](_0x21c8ea[_0xd335('0xbc')]);return _0x78adbe;});})[_0xd335('0x1e')](function(_0x104781){respondWithRpcPromise(_0xd335('0xbe'),_0xd335('0xbe'),{'FaxAccountId':_[_0xd335('0xb1')](_0x33ff81[_0xd335('0x53')]['id'])?undefined:_0x33ff81[_0xd335('0x53')]['id'],'path':_[_0xd335('0xb1')](_0x33ff81['body']['attachments'][0x0][_0xd335('0x5')])?undefined:_0x33ff81['body']['attachments'][0x0][_0xd335('0x5')],'fax':_[_0xd335('0xb1')](_0x33ff81['body']['to'][0x0])?undefined:_0x33ff81[_0xd335('0x5a')]['to'][0x0],'AttachmentId':_0x33ff81[_0xd335('0x5a')][_0xd335('0xab')][0x0]['id']},client9002)[_0xd335('0x1e')](function(_0x42f9b0){logger[_0xd335('0x1f')]('SendFaxRpc,\x20%s',_0x42f9b0);})[_0xd335('0x51')](function(_0x44914b){logger['info'](_0xd335('0xbf'),_0x44914b);});return _0x104781;})[_0xd335('0x1e')](respondWithResult(_0x4c5aff,null))[_0xd335('0x51')](handleError(_0x4c5aff,null));};exports[_0xd335('0xc0')]=function(_0x5737b0,_0x1e08da,_0x8bb901){return db[_0xd335('0x3b')][_0xd335('0x58')]({'where':{'id':_0x5737b0['params']['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x1e08da,null))[_0xd335('0x1e')](function(_0x17d4ea){if(_0x17d4ea){return _0x17d4ea['addAgents'](_0x5737b0[_0xd335('0x5a')][_0xd335('0x70')],_[_0xd335('0x73')](_0x5737b0[_0xd335('0x5a')],[_0xd335('0x70'),'id'])||{})[_0xd335('0xba')](function(_0x434972){for(var _0x2fe82e=0x0;_0x2fe82e<_0x5737b0['body']['ids'][_0xd335('0x44')];_0x2fe82e+=0x1){socket[_0xd335('0xc1')](_0xd335('0xc2'),{'UserId':Number(_0x5737b0['body'][_0xd335('0x70')][_0x2fe82e]),'FaxAccountId':Number(_0x5737b0['params']['id'])});}return _0x434972;});}})[_0xd335('0x1e')](respondWithResult(_0x1e08da,null))[_0xd335('0x51')](handleError(_0x1e08da,null));};exports[_0xd335('0xc3')]=function(_0x4d73b3,_0x4171df,_0x500821){return db['FaxAccount']['find']({'where':{'id':_0x4d73b3[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x4171df,null))['then'](function(_0x365d74){if(_0x365d74){return _0x365d74[_0xd335('0xc3')](_0x4d73b3[_0xd335('0x40')][_0xd335('0x70')])[_0xd335('0x1e')](function(){if(_['isArray'](_0x4d73b3['query'][_0xd335('0x70')])){for(var _0x2b0a5c=0x0;_0x2b0a5c<_0x4d73b3['query'][_0xd335('0x70')]['length'];_0x2b0a5c+=0x1){socket[_0xd335('0xc1')](_0xd335('0xc4'),{'UserId':Number(_0x4d73b3[_0xd335('0x40')][_0xd335('0x70')][_0x2b0a5c]),'FaxAccountId':Number(_0x4d73b3['params']['id'])});}}else{socket[_0xd335('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x4d73b3[_0xd335('0x40')][_0xd335('0x70')]),'FaxAccountId':Number(_0x4d73b3[_0xd335('0x53')]['id'])});}});}})[_0xd335('0x1e')](respondWithStatusCode(_0x4171df,null))['catch'](handleError(_0x4171df,null));};exports[_0xd335('0xc5')]=function(_0x1edb04,_0x31436d,_0x37b33f){var _0x573505={};var _0x30d7fa={};var _0x446090;var _0x1ede9b;return db[_0xd335('0x3b')][_0xd335('0x68')]({'where':{'id':_0x1edb04[_0xd335('0x53')]['id']}})[_0xd335('0x1e')](handleEntityNotFound(_0x31436d,null))['then'](function(_0xcde6a9){if(_0xcde6a9){_0x446090=_0xcde6a9;_0x30d7fa[_0xd335('0x3f')]=_['keys'](db[_0xd335('0x75')][_0xd335('0x56')]);_0x30d7fa[_0xd335('0x40')]=_['keys'](_0x1edb04[_0xd335('0x40')]);_0x30d7fa[_0xd335('0x48')]=_[_0xd335('0x41')](_0x30d7fa[_0xd335('0x3f')],_0x30d7fa[_0xd335('0x40')]);_0x573505['attributes']=_['intersection'](_0x30d7fa[_0xd335('0x3f')],qs[_0xd335('0x43')](_0x1edb04[_0xd335('0x40')][_0xd335('0x43')]));_0x573505['attributes']=_0x573505[_0xd335('0x42')]['length']?_0x573505[_0xd335('0x42')]:_0x30d7fa['model'];_0x573505[_0xd335('0x6a')]=qs[_0xd335('0x46')](_0x1edb04[_0xd335('0x40')][_0xd335('0x46')]);_0x573505[_0xd335('0x47')]=qs[_0xd335('0x48')](_[_0xd335('0x49')](_0x1edb04[_0xd335('0x40')],_0x30d7fa['filters']));if(_0x1edb04[_0xd335('0x40')][_0xd335('0x4b')]){_0x573505[_0xd335('0x47')]=_[_0xd335('0x4c')](_0x573505[_0xd335('0x47')],{'$or':_[_0xd335('0x3a')](_0x573505[_0xd335('0x42')],function(_0x3a036b){var _0x1c47a2={};_0x1c47a2[_0x3a036b]={'$like':'%'+_0x1edb04[_0xd335('0x40')]['filter']+'%'};return _0x1c47a2;})});}_0x573505=_[_0xd335('0x4c')]({},_0x573505,_0x1edb04[_0xd335('0x4d')]);return _0x446090[_0xd335('0xc5')](_0x573505);}})['then'](function(_0x46febc){if(_0x46febc){_0x1ede9b=_0x46febc[_0xd335('0x44')];if(!_0x1edb04[_0xd335('0x40')]['hasOwnProperty'](_0xd335('0x45'))){_0x573505[_0xd335('0x2c')]=qs[_0xd335('0x2c')](_0x1edb04['query']['limit']);_0x573505[_0xd335('0x2b')]=qs[_0xd335('0x2b')](_0x1edb04['query'][_0xd335('0x2b')]);}return _0x446090[_0xd335('0xc5')](_0x573505);}})['then'](function(_0x51c422){if(_0x51c422){return _0x51c422?{'count':_0x1ede9b,'rows':_0x51c422}:null;}})[_0xd335('0x1e')](respondWithResult(_0x31436d,null))[_0xd335('0x51')](handleError(_0x31436d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3624f23..964848c 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 _0x8983=['events','../../mysqldb','FaxAccount','save','update','emit','hook'];(function(_0x3a124b,_0x5c6269){var _0x260616=function(_0x269f8a){while(--_0x269f8a){_0x3a124b['push'](_0x3a124b['shift']());}};_0x260616(++_0x5c6269);}(_0x8983,0x16c));var _0x3898=function(_0x3fec78,_0x409cfd){_0x3fec78=_0x3fec78-0x0;var _0x2407eb=_0x8983[_0x3fec78];return _0x2407eb;};'use strict';var EventEmitter=require(_0x3898('0x0'));var FaxAccount=require(_0x3898('0x1'))['db'][_0x3898('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3898('0x3'),'afterUpdate':_0x3898('0x4'),'afterDestroy':'remove'};function emitEvent(_0x154422){return function(_0xe3e69c,_0x556da3,_0x10c453){FaxAccountEvents[_0x3898('0x5')](_0x154422+':'+_0xe3e69c['id'],_0xe3e69c);FaxAccountEvents['emit'](_0x154422,_0xe3e69c);_0x10c453(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3898('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xc82e=['emit','hook','exports','events','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x3bfc68,_0x2bcbb6){var _0x28318a=function(_0x334008){while(--_0x334008){_0x3bfc68['push'](_0x3bfc68['shift']());}};_0x28318a(++_0x2bcbb6);}(_0xc82e,0xd2));var _0xec82=function(_0x238caa,_0xc685a1){_0x238caa=_0x238caa-0x0;var _0x5b0829=_0xc82e[_0x238caa];return _0x5b0829;};'use strict';var EventEmitter=require(_0xec82('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xec82('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xec82('0x2')](0x0);var events={'afterCreate':_0xec82('0x3'),'afterUpdate':_0xec82('0x4'),'afterDestroy':_0xec82('0x5')};function emitEvent(_0x583a62){return function(_0x3249bc,_0x4626a,_0x149161){FaxAccountEvents[_0xec82('0x6')](_0x583a62+':'+_0x3249bc['id'],_0x3249bc);FaxAccountEvents['emit'](_0x583a62,_0x3249bc);_0x149161(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xec82('0x7')](e,emitEvent(event));}}module[_0xec82('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 176dc14..25c626f 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 _0x7fc3=['moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fc3,0xec));var _0x37fc=function(_0x1c3455,_0xf2c961){_0x1c3455=_0x1c3455-0x0;var _0x4fd855=_0x7fc3[_0x1c3455];return _0x4fd855;};'use strict';var _=require(_0x37fc('0x0'));var util=require(_0x37fc('0x1'));var logger=require(_0x37fc('0x2'))(_0x37fc('0x3'));var moment=require(_0x37fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x37fc('0x5'));var fs=require('fs');var path=require(_0x37fc('0x6'));var rimraf=require(_0x37fc('0x7'));var config=require(_0x37fc('0x8'));var attributes=require(_0x37fc('0x9'));module['exports']=function(_0x4be1f7,_0x54a60a){return _0x4be1f7[_0x37fc('0xa')]('FaxAccount',attributes,{'tableName':_0x37fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fc4=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x37b229,_0x1ff75f){var _0x3162c4=function(_0x2db4f4){while(--_0x2db4f4){_0x37b229['push'](_0x37b229['shift']());}};_0x3162c4(++_0x1ff75f);}(_0x8fc4,0x88));var _0x48fc=function(_0x211dab,_0x9f8286){_0x211dab=_0x211dab-0x0;var _0x43162d=_0x8fc4[_0x211dab];return _0x43162d;};'use strict';var _=require(_0x48fc('0x0'));var util=require(_0x48fc('0x1'));var logger=require(_0x48fc('0x2'))('api');var moment=require(_0x48fc('0x3'));var BPromise=require(_0x48fc('0x4'));var rp=require(_0x48fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48fc('0x6'));var config=require(_0x48fc('0x7'));var attributes=require(_0x48fc('0x8'));module[_0x48fc('0x9')]=function(_0x2bcf58,_0x44f6fe){return _0x2bcf58[_0x48fc('0xa')](_0x48fc('0xb'),attributes,{'tableName':_0x48fc('0xc'),'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 3b302b2..c7c3a5e 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 _0xa394=['FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc','defaults','contact','find','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa394,0x7e));var _0x4a39=function(_0x194d63,_0xc3b38a){_0x194d63=_0x194d63-0x0;var _0x1e6998=_0xa394[_0x194d63];return _0x1e6998;};'use strict';var _=require(_0x4a39('0x0'));var util=require(_0x4a39('0x1'));var moment=require(_0x4a39('0x2'));var BPromise=require(_0x4a39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a39('0x4'));var db=require(_0x4a39('0x5'))['db'];var utils=require(_0x4a39('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a39('0x8')][_0x4a39('0x9')]({'port':0x232c});config[_0x4a39('0xa')]=_['defaults'](config[_0x4a39('0xa')],{'host':_0x4a39('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a39('0xa')]));require(_0x4a39('0xc'))[_0x4a39('0xd')](socket);function respondWithRpcPromise(_0x33de87,_0x589709,_0x139860){return new BPromise(function(_0x441974,_0x3b6bb5){return client[_0x4a39('0xe')](_0x33de87,_0x139860)[_0x4a39('0xf')](function(_0x4dc8ad){logger[_0x4a39('0x10')](_0x4a39('0x11'),_0x589709,_0x4a39('0x12'));logger[_0x4a39('0x13')](_0x4a39('0x14'),_0x589709,_0x4a39('0x12'),JSON[_0x4a39('0x15')](_0x4dc8ad));if(_0x4dc8ad['error']){if(_0x4dc8ad['error'][_0x4a39('0x16')]===0x1f4){logger[_0x4a39('0x17')](_0x4a39('0x11'),_0x589709,_0x4dc8ad[_0x4a39('0x17')]['message']);return _0x3b6bb5(_0x4dc8ad[_0x4a39('0x17')][_0x4a39('0x18')]);}logger[_0x4a39('0x17')](_0x4a39('0x11'),_0x589709,_0x4dc8ad['error'][_0x4a39('0x18')]);return _0x441974(_0x4dc8ad[_0x4a39('0x17')][_0x4a39('0x18')]);}else{logger['info'](_0x4a39('0x11'),_0x589709,_0x4a39('0x12'));_0x441974(_0x4dc8ad[_0x4a39('0x19')][_0x4a39('0x18')]);}})[_0x4a39('0x1a')](function(_0x54fd2e){logger[_0x4a39('0x17')](_0x4a39('0x11'),_0x589709,_0x54fd2e);_0x3b6bb5(_0x54fd2e);});});}exports[_0x4a39('0x1b')]=function(_0x2a95cf){var _0x3a9a1b=this;return new Promise(function(_0x844a2a,_0x29dd84){return db[_0x4a39('0x1c')]['findAll']({'raw':_0x2a95cf[_0x4a39('0x1d')]?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a95cf['options']?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x1f')]||null:null,'attributes':_0x2a95cf['options']?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x20')]||null:null,'limit':_0x2a95cf[_0x4a39('0x1d')]?_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x21')]||null:null,'include':_0x2a95cf[_0x4a39('0x1d')]?_0x2a95cf['options'][_0x4a39('0x22')]?_[_0x4a39('0x23')](_0x2a95cf[_0x4a39('0x1d')][_0x4a39('0x22')],function(_0x1f14bb){return{'model':db[_0x1f14bb[_0x4a39('0x24')]],'as':_0x1f14bb['as'],'attributes':_0x1f14bb[_0x4a39('0x20')],'include':_0x1f14bb[_0x4a39('0x22')]?_[_0x4a39('0x23')](_0x1f14bb[_0x4a39('0x22')],function(_0xf5843d){return{'model':db[_0xf5843d[_0x4a39('0x24')]],'as':_0xf5843d['as'],'attributes':_0xf5843d['attributes'],'include':_0xf5843d[_0x4a39('0x22')]?_[_0x4a39('0x23')](_0xf5843d[_0x4a39('0x22')],function(_0xbb71d0){return{'model':db[_0xbb71d0[_0x4a39('0x24')]],'as':_0xbb71d0['as'],'attributes':_0xbb71d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a39('0xf')](function(_0x29a841){logger[_0x4a39('0x10')](_0x4a39('0x1b'),_0x2a95cf);logger[_0x4a39('0x13')](_0x4a39('0x1b'),_0x2a95cf,JSON[_0x4a39('0x15')](_0x29a841));_0x844a2a(_0x29a841);})[_0x4a39('0x1a')](function(_0x577486){logger[_0x4a39('0x17')](_0x4a39('0x1b'),_0x577486['message'],_0x2a95cf);_0x29dd84(_0x3a9a1b[_0x4a39('0x17')](0x1f4,_0x577486[_0x4a39('0x18')]));});});};exports[_0x4a39('0x25')]=function(_0x2e8220,_0x32f577,_0x4ef687){var _0x417f66=this;return new Promise(function(_0x141d50,_0x1eb097){var _0x564a94={'body':_0x2e8220[_0x4a39('0x26')],'channel':_0x4a39('0x27')};var _0x20365b=[];var _0x3f1cb6=[];var _0xf5a5e7={};return db[_0x4a39('0x28')]['describe']()['then'](function(_0x3369f1){if(!_0x3369f1){throw new db[(_0x4a39('0x29'))][(_0x4a39('0x2a'))](_0x4a39('0x2b'));}_0x20365b=_[_0x4a39('0x2c')](_[_0x4a39('0x2d')](_0x3369f1),[_0x4a39('0x2e'),_0x4a39('0x2f')]);_0x3f1cb6=_[_0x4a39('0x2c')](_[_0x4a39('0x2d')](_0x3369f1),[_0x4a39('0x2e'),'updatedAt',_0x4a39('0x30'),_0x4a39('0x31')]);if(_0x2e8220['body']['id']){delete _0x2e8220['body']['id'];}if(_['isNil'](_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')])){throw new db['Sequelize'][(_0x4a39('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x4a39('0x33')](_0x2e8220[_0x4a39('0x26')][_0x4a39('0x26')])||_0x2e8220[_0x4a39('0x26')][_0x4a39('0x26')]===''){throw new db[(_0x4a39('0x29'))][(_0x4a39('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2e8220[_0x4a39('0x26')]['mapKey'])){throw new db[(_0x4a39('0x29'))]['ValidationError'](_0x4a39('0x34')+_0x3f1cb6);}if(!_[_0x4a39('0x35')](_0x3f1cb6,_0x2e8220[_0x4a39('0x26')][_0x4a39('0x36')])){throw new db[(_0x4a39('0x29'))][(_0x4a39('0x2a'))](_0x4a39('0x37')+_0x3f1cb6);}_0xf5a5e7[_0x2e8220[_0x4a39('0x26')][_0x4a39('0x36')]]=_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')];})[_0x4a39('0xf')](function(){return db[_0x4a39('0x1c')]['find']({'where':{'id':_0x2e8220['account']['id']},'include':[{'model':db[_0x4a39('0x38')],'as':_0x4a39('0x39'),'include':[{'model':db[_0x4a39('0x28')],'as':_0x4a39('0x3a'),'where':_0xf5a5e7,'limit':0x1,'order':[[_0x4a39('0x2f'),_0x4a39('0x3b')]]}]},{'model':db[_0x4a39('0x3c')],'as':_0x4a39('0x3d')}]});})[_0x4a39('0xf')](function(_0x48d0c6){if(_0x48d0c6&&_0x48d0c6[_0x4a39('0x39')]){var _0x3568c0=_0x48d0c6[_0x4a39('0x3e')]({'plain':!![]});_0x564a94[_0x4a39('0x3f')]=_0x3568c0;_0x564a94[_0x4a39('0x40')]=_0x3568c0['Applications'];_0x564a94[_0x4a39('0x41')]=_0x3568c0[_0x4a39('0x39')];_0x564a94[_0x4a39('0x40')]=_[_0x4a39('0x42')](_0x564a94[_0x4a39('0x40')],[_0x4a39('0x43')],[_0x4a39('0x44')]);if(_0x564a94[_0x4a39('0x3f')][_0x4a39('0x3d')]){delete _0x564a94[_0x4a39('0x3f')][_0x4a39('0x3d')];}if(_0x564a94['account']['List']&&_0x564a94[_0x4a39('0x3f')][_0x4a39('0x39')][_0x4a39('0x3a')]['length']){return _0x564a94['account']['List'][_0x4a39('0x3a')][0x0];}var _0x382981=_[_0x4a39('0x45')](_0x2e8220[_0x4a39('0x26')],{'firstName':_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')],'ListId':_0x3568c0[_0x4a39('0x31')]});_0x382981[_0x2e8220[_0x4a39('0x26')]['mapKey']]=_0x2e8220[_0x4a39('0x26')][_0x4a39('0x32')];return db[_0x4a39('0x28')]['create'](_0x382981,{'fields':_0x20365b,'raw':!![]});}})[_0x4a39('0xf')](function(_0x4137d2){_0x564a94[_0x4a39('0x46')]=_0x4137d2;if(_0x4137d2){var _0x45d6ec={'ContactId':_0x4137d2['id'],'FaxAccountId':_0x2e8220['account']['id'],'fax':_0x4137d2['fax']};return db['FaxInteraction'][_0x4a39('0x47')]({'where':{'ContactId':_0x4137d2['id'],'closed':![],'FaxAccountId':_0x2e8220['account']['id']}})[_0x4a39('0xf')](function(_0x2e5069){if(_0x2e5069){return[_0x2e5069,![]];}return db[_0x4a39('0x48')][_0x4a39('0x49')](_0x45d6ec)[_0x4a39('0xf')](function(_0x4ab802){return[_0x4ab802,!![]];});});}else{throw new Error(_0x4a39('0x4a'));}})['spread'](function(_0x36ad33,_0x48a440){var _0x402e68=_0x36ad33['get']({'plain':!![]});if(_0x48a440){if(_0x564a94[_0x4a39('0x3f')][_0x4a39('0x4b')]){_0x564a94[_0x4a39('0x40')][_0x4a39('0x4c')]({'id':0x0,'priority':_0x564a94[_0x4a39('0x40')][_0x4a39('0x4d')]+0x1,'app':_0x4a39('0x4e'),'appdata':_0x4a39('0x4f'),'interval':_0x4a39('0x50')});}_0x402e68['created']=!![];}else{_0x402e68[_0x4a39('0x51')]=![];}_0x564a94[_0x4a39('0x52')]=_0x402e68;return db[_0x4a39('0x53')][_0x4a39('0x49')]({'body':_0x2e8220[_0x4a39('0x26')][_0x4a39('0x26')],'FaxAccountId':_0x2e8220[_0x4a39('0x3f')]['id'],'FaxInteractionId':_0x36ad33['id'],'direction':'in','ContactId':_0x36ad33[_0x4a39('0x54')],'AttachmentId':_0x2e8220[_0x4a39('0x26')][_0x4a39('0x55')]});})['then'](function(_0x4f91d2){_0x564a94['message']=_0x4f91d2;if(_0x564a94[_0x4a39('0x52')][_0x4a39('0x56')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x564a94[_0x4a39('0x52')]['UserId']}})[_0x4a39('0xf')](function(_0xf18819){if(_0xf18819){_0x564a94['applications'][_0x4a39('0x57')]({'id':0x0,'priority':0x0,'app':_0x4a39('0x58'),'appdata':_0xf18819[_0x4a39('0x59')]+','+(_0x564a94['account'][_0x4a39('0x5a')]||0xa),'interval':_0x4a39('0x50')});}return respondWithRpcPromise(_0x4a39('0x5b'),_0x4a39('0x5c'),_0x564a94);});}return respondWithRpcPromise(_0x4a39('0x5b'),_0x4a39('0x5c'),_0x564a94);})[_0x4a39('0xf')](function(_0x36ec0d){_0x141d50(_0x36ec0d);})['catch'](function(_0x58ba4a){_0x1eb097(_0x417f66[_0x4a39('0x17')](0x1f4,_0x58ba4a[_0x4a39('0x18')]));});});}; \ No newline at end of file +var _0x218b=['ContactId','name','UserId','unshift','agent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','options','raw','where','limit','include','model','map','attributes','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','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','FaxAccount','find','account','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','ListId','create','contact','FaxInteraction','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage'];(function(_0x240757,_0x447def){var _0x2fc8fb=function(_0x440bda){while(--_0x440bda){_0x240757['push'](_0x240757['shift']());}};_0x2fc8fb(++_0x447def);}(_0x218b,0xbb));var _0xb218=function(_0x5b2a79,_0x2f3afe){_0x5b2a79=_0x5b2a79-0x0;var _0x3f201f=_0x218b[_0x5b2a79];return _0x3f201f;};'use strict';var _=require(_0xb218('0x0'));var util=require('util');var moment=require(_0xb218('0x1'));var BPromise=require(_0xb218('0x2'));var rs=require(_0xb218('0x3'));var fs=require('fs');var Redis=require(_0xb218('0x4'));var db=require(_0xb218('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb218('0x6'))(_0xb218('0x7'));var config=require(_0xb218('0x8'));var jayson=require(_0xb218('0x9'));var client=jayson[_0xb218('0xa')][_0xb218('0xb')]({'port':0x232c});config['redis']=_[_0xb218('0xc')](config[_0xb218('0xd')],{'host':_0xb218('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xb218('0xf')](socket);function respondWithRpcPromise(_0x2a241b,_0x3e4323,_0x250015){return new BPromise(function(_0x109909,_0x261c21){return client['request'](_0x2a241b,_0x250015)[_0xb218('0x10')](function(_0x347615){logger[_0xb218('0x11')](_0xb218('0x12'),_0x3e4323,_0xb218('0x13'));logger[_0xb218('0x14')](_0xb218('0x15'),_0x3e4323,_0xb218('0x13'),JSON[_0xb218('0x16')](_0x347615));if(_0x347615[_0xb218('0x17')]){if(_0x347615[_0xb218('0x17')][_0xb218('0x18')]===0x1f4){logger[_0xb218('0x17')](_0xb218('0x12'),_0x3e4323,_0x347615[_0xb218('0x17')]['message']);return _0x261c21(_0x347615[_0xb218('0x17')][_0xb218('0x19')]);}logger[_0xb218('0x17')](_0xb218('0x12'),_0x3e4323,_0x347615[_0xb218('0x17')][_0xb218('0x19')]);return _0x109909(_0x347615['error'][_0xb218('0x19')]);}else{logger[_0xb218('0x11')](_0xb218('0x12'),_0x3e4323,'request\x20sent');_0x109909(_0x347615[_0xb218('0x1a')]['message']);}})[_0xb218('0x1b')](function(_0x58e2ae){logger[_0xb218('0x17')]('FaxAccount,\x20%s,\x20%s',_0x3e4323,_0x58e2ae);_0x261c21(_0x58e2ae);});});}exports[_0xb218('0x1c')]=function(_0xd6ad){var _0x34b338=this;return new Promise(function(_0x471349,_0x1b47b1){return db['FaxAccount']['findAll']({'raw':_0xd6ad[_0xb218('0x1d')]?_0xd6ad[_0xb218('0x1d')][_0xb218('0x1e')]===undefined?!![]:![]:!![],'where':_0xd6ad[_0xb218('0x1d')]?_0xd6ad[_0xb218('0x1d')][_0xb218('0x1f')]||null:null,'attributes':_0xd6ad['options']?_0xd6ad[_0xb218('0x1d')]['attributes']||null:null,'limit':_0xd6ad['options']?_0xd6ad['options'][_0xb218('0x20')]||null:null,'include':_0xd6ad[_0xb218('0x1d')]?_0xd6ad['options']['include']?_['map'](_0xd6ad['options'][_0xb218('0x21')],function(_0x52048d){return{'model':db[_0x52048d[_0xb218('0x22')]],'as':_0x52048d['as'],'attributes':_0x52048d['attributes'],'include':_0x52048d['include']?_[_0xb218('0x23')](_0x52048d[_0xb218('0x21')],function(_0x1e8b17){return{'model':db[_0x1e8b17[_0xb218('0x22')]],'as':_0x1e8b17['as'],'attributes':_0x1e8b17['attributes'],'include':_0x1e8b17[_0xb218('0x21')]?_[_0xb218('0x23')](_0x1e8b17[_0xb218('0x21')],function(_0x1ad284){return{'model':db[_0x1ad284['model']],'as':_0x1ad284['as'],'attributes':_0x1ad284[_0xb218('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb218('0x10')](function(_0x26717c){logger[_0xb218('0x11')]('GetFaxAccount',_0xd6ad);logger['debug'](_0xb218('0x1c'),_0xd6ad,JSON[_0xb218('0x16')](_0x26717c));_0x471349(_0x26717c);})[_0xb218('0x1b')](function(_0x337d7e){logger['error'](_0xb218('0x1c'),_0x337d7e['message'],_0xd6ad);_0x1b47b1(_0x34b338['error'](0x1f4,_0x337d7e[_0xb218('0x19')]));});});};exports[_0xb218('0x25')]=function(_0x16a0ad,_0x3bdb54,_0x5be1e3){var _0xbf0985=this;return new Promise(function(_0x31c962,_0x3beab0){var _0x38bc66={'body':_0x16a0ad[_0xb218('0x26')],'channel':_0xb218('0x27')};var _0x600b67=[];var _0x319be9=[];var _0x17cbe9={};return db['CmContact'][_0xb218('0x28')]()[_0xb218('0x10')](function(_0x4afaa7){if(!_0x4afaa7){throw new db[(_0xb218('0x29'))][(_0xb218('0x2a'))](_0xb218('0x2b'));}_0x600b67=_['difference'](_[_0xb218('0x2c')](_0x4afaa7),[_0xb218('0x2d'),'updatedAt']);_0x319be9=_['difference'](_[_0xb218('0x2c')](_0x4afaa7),['createdAt',_0xb218('0x2e'),'CompanyId','ListId']);if(_0x16a0ad[_0xb218('0x26')]['id']){delete _0x16a0ad[_0xb218('0x26')]['id'];}if(_[_0xb218('0x2f')](_0x16a0ad[_0xb218('0x26')][_0xb218('0x30')])){throw new db[(_0xb218('0x29'))][(_0xb218('0x2a'))](_0xb218('0x31'));}if(_[_0xb218('0x2f')](_0x16a0ad[_0xb218('0x26')]['body'])||_0x16a0ad[_0xb218('0x26')][_0xb218('0x26')]===''){throw new db[(_0xb218('0x29'))][(_0xb218('0x2a'))](_0xb218('0x32'));}if(_['isNil'](_0x16a0ad[_0xb218('0x26')][_0xb218('0x33')])){throw new db[(_0xb218('0x29'))]['ValidationError'](_0xb218('0x34')+_0x319be9);}if(!_[_0xb218('0x35')](_0x319be9,_0x16a0ad[_0xb218('0x26')]['mapKey'])){throw new db[(_0xb218('0x29'))][(_0xb218('0x2a'))](_0xb218('0x36')+_0x319be9);}_0x17cbe9[_0x16a0ad[_0xb218('0x26')][_0xb218('0x33')]]=_0x16a0ad[_0xb218('0x26')][_0xb218('0x30')];})[_0xb218('0x10')](function(){return db[_0xb218('0x37')][_0xb218('0x38')]({'where':{'id':_0x16a0ad[_0xb218('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xb218('0x3a'),'include':[{'model':db[_0xb218('0x3b')],'as':_0xb218('0x3c'),'where':_0x17cbe9,'limit':0x1,'order':[['updatedAt',_0xb218('0x3d')]]}]},{'model':db[_0xb218('0x3e')],'as':_0xb218('0x3f')}]});})[_0xb218('0x10')](function(_0x123e67){if(_0x123e67&&_0x123e67[_0xb218('0x3a')]){var _0x459b88=_0x123e67[_0xb218('0x40')]({'plain':!![]});_0x38bc66[_0xb218('0x39')]=_0x459b88;_0x38bc66[_0xb218('0x41')]=_0x459b88['Applications'];_0x38bc66[_0xb218('0x42')]=_0x459b88[_0xb218('0x3a')];_0x38bc66[_0xb218('0x41')]=_[_0xb218('0x43')](_0x38bc66[_0xb218('0x41')],[_0xb218('0x44')],[_0xb218('0x45')]);if(_0x38bc66[_0xb218('0x39')][_0xb218('0x3f')]){delete _0x38bc66[_0xb218('0x39')][_0xb218('0x3f')];}if(_0x38bc66[_0xb218('0x39')][_0xb218('0x3a')]&&_0x38bc66[_0xb218('0x39')]['List'][_0xb218('0x3c')][_0xb218('0x46')]){return _0x38bc66[_0xb218('0x39')][_0xb218('0x3a')]['Contacts'][0x0];}var _0x41aa6a=_[_0xb218('0xc')](_0x16a0ad[_0xb218('0x26')],{'firstName':_0x16a0ad[_0xb218('0x26')][_0xb218('0x30')],'ListId':_0x459b88[_0xb218('0x47')]});_0x41aa6a[_0x16a0ad['body'][_0xb218('0x33')]]=_0x16a0ad[_0xb218('0x26')][_0xb218('0x30')];return db[_0xb218('0x3b')][_0xb218('0x48')](_0x41aa6a,{'fields':_0x600b67,'raw':!![]});}})['then'](function(_0xb9c46a){_0x38bc66[_0xb218('0x49')]=_0xb9c46a;if(_0xb9c46a){var _0x2f6aa7={'ContactId':_0xb9c46a['id'],'FaxAccountId':_0x16a0ad[_0xb218('0x39')]['id'],'fax':_0xb9c46a[_0xb218('0x27')]};return db[_0xb218('0x4a')]['find']({'where':{'ContactId':_0xb9c46a['id'],'closed':![],'FaxAccountId':_0x16a0ad[_0xb218('0x39')]['id']}})[_0xb218('0x10')](function(_0x51848d){if(_0x51848d){return[_0x51848d,![]];}return db['FaxInteraction'][_0xb218('0x48')](_0x2f6aa7)['then'](function(_0xba4a56){return[_0xba4a56,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb218('0x4b')](function(_0x2b9e38,_0x156717){var _0x562e55=_0x2b9e38[_0xb218('0x40')]({'plain':!![]});if(_0x156717){if(_0x38bc66[_0xb218('0x39')][_0xb218('0x4c')]){_0x38bc66[_0xb218('0x41')][_0xb218('0x4d')]({'id':0x0,'priority':_0x38bc66[_0xb218('0x41')][_0xb218('0x46')]+0x1,'app':'close','appdata':_0xb218('0x4e'),'interval':_0xb218('0x4f')});}_0x562e55[_0xb218('0x50')]=!![];}else{_0x562e55[_0xb218('0x50')]=![];}_0x38bc66[_0xb218('0x51')]=_0x562e55;return db[_0xb218('0x52')][_0xb218('0x48')]({'body':_0x16a0ad['body'][_0xb218('0x26')],'FaxAccountId':_0x16a0ad[_0xb218('0x39')]['id'],'FaxInteractionId':_0x2b9e38['id'],'direction':'in','ContactId':_0x2b9e38[_0xb218('0x53')],'AttachmentId':_0x16a0ad['body']['AttachmentId']});})[_0xb218('0x10')](function(_0x2e1d92){_0x38bc66[_0xb218('0x19')]=_0x2e1d92;if(_0x38bc66[_0xb218('0x51')]['UserId']){return db['User'][_0xb218('0x38')]({'attributes':['id',_0xb218('0x54')],'where':{'id':_0x38bc66[_0xb218('0x51')][_0xb218('0x55')]}})['then'](function(_0x59079a){if(_0x59079a){_0x38bc66[_0xb218('0x41')][_0xb218('0x56')]({'id':0x0,'priority':0x0,'app':_0xb218('0x57'),'appdata':_0x59079a[_0xb218('0x54')]+','+(_0x38bc66[_0xb218('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0xb218('0x4f')});}return respondWithRpcPromise(_0xb218('0x58'),'startRouting',_0x38bc66);});}return respondWithRpcPromise('Start',_0xb218('0x59'),_0x38bc66);})[_0xb218('0x10')](function(_0x4f6fb4){_0x31c962(_0x4f6fb4);})['catch'](function(_0xcb3781){_0x3beab0(_0xbf0985[_0xb218('0x17')](0x1f4,_0xcb3781['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5cf9344..7a68143 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 _0xb98b=['length','faxAccount:','save','remove','emit','register'];(function(_0x3f4948,_0x205e64){var _0x477033=function(_0x4fd305){while(--_0x4fd305){_0x3f4948['push'](_0x3f4948['shift']());}};_0x477033(++_0x205e64);}(_0xb98b,0x128));var _0xbb98=function(_0x185dfa,_0x153d72){_0x185dfa=_0x185dfa-0x0;var _0x538992=_0xb98b[_0x185dfa];return _0x538992;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xbb98('0x0'),_0xbb98('0x1'),'update'];function createListener(_0xa5af0f,_0x59a353){return function(_0x52ca36){_0x59a353[_0xbb98('0x2')](_0xa5af0f,_0x52ca36);};}function removeListener(_0x1bc4f3,_0x1763d5){return function(){FaxAccountEvents['removeListener'](_0x1bc4f3,_0x1763d5);};}exports[_0xbb98('0x3')]=function(_0x309503){for(var _0x2e8d1a=0x0,_0x35e329=events[_0xbb98('0x4')];_0x2e8d1a<_0x35e329;_0x2e8d1a++){var _0x174eca=events[_0x2e8d1a];var _0x5cbd9c=createListener(_0xbb98('0x5')+_0x174eca,_0x309503);FaxAccountEvents['on'](_0x174eca,_0x5cbd9c);}}; \ No newline at end of file +var _0x4de6=['save','removeListener','length','faxAccount:','./faxAccount.events'];(function(_0x5bfd00,_0x3e3371){var _0x440238=function(_0x32cf59){while(--_0x32cf59){_0x5bfd00['push'](_0x5bfd00['shift']());}};_0x440238(++_0x3e3371);}(_0x4de6,0xd1));var _0x64de=function(_0xe4df76,_0xa0223b){_0xe4df76=_0xe4df76-0x0;var _0x52a130=_0x4de6[_0xe4df76];return _0x52a130;};'use strict';var FaxAccountEvents=require(_0x64de('0x0'));var events=[_0x64de('0x1'),'remove','update'];function createListener(_0xb040c4,_0x5f1dbf){return function(_0x30e811){_0x5f1dbf['emit'](_0xb040c4,_0x30e811);};}function removeListener(_0x4518f6,_0x154f2f){return function(){FaxAccountEvents[_0x64de('0x2')](_0x4518f6,_0x154f2f);};}exports['register']=function(_0x121bf1){for(var _0x4684ac=0x0,_0xc24b77=events[_0x64de('0x3')];_0x4684ac<_0xc24b77;_0x4684ac++){var _0x4d7ee4=events[_0x4684ac];var _0x299fd8=createListener(_0x64de('0x4')+_0x4d7ee4,_0x121bf1);FaxAccountEvents['on'](_0x4d7ee4,_0x299fd8);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c420316..8da2580 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x41b16f,_0x4afe01){var _0xb84a94=function(_0x43f03a){while(--_0x43f03a){_0x41b16f['push'](_0x41b16f['shift']());}};_0xb84a94(++_0x4afe01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3ebdee,_0x1cf5ca){var _0x3eb0f9=function(_0x37312f){while(--_0x37312f){_0x3ebdee['push'](_0x3ebdee['shift']());}};_0x3eb0f9(++_0x1cf5ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index df54b67..a650764 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 _0x8bf0=['exports','INTEGER','noop','TEXT','sequelize'];(function(_0x23cc2d,_0xd02450){var _0x3dd47d=function(_0x26c771){while(--_0x26c771){_0x23cc2d['push'](_0x23cc2d['shift']());}};_0x3dd47d(++_0xd02450);}(_0x8bf0,0x95));var _0x08bf=function(_0x386111,_0x13bc6e){_0x386111=_0x386111-0x0;var _0x52f3c2=_0x8bf0[_0x386111];return _0x52f3c2;};'use strict';var Sequelize=require(_0x08bf('0x0'));module[_0x08bf('0x1')]={'priority':{'type':Sequelize[_0x08bf('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x08bf('0x3')},'appdata':{'type':Sequelize[_0x08bf('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc600=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x14d866,_0x2da407){var _0x34ca21=function(_0x1386ed){while(--_0x1386ed){_0x14d866['push'](_0x14d866['shift']());}};_0x34ca21(++_0x2da407);}(_0xc600,0xef));var _0x0c60=function(_0x36d824,_0x28c308){_0x36d824=_0x36d824-0x0;var _0x2031fd=_0xc600[_0x36d824];return _0x2031fd;};'use strict';var Sequelize=require(_0x0c60('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0c60('0x1')],'allowNull':![],'defaultValue':_0x0c60('0x2')},'appdata':{'type':Sequelize[_0x0c60('0x3')]()},'description':{'type':Sequelize[_0x0c60('0x1')]},'interval':{'type':Sequelize[_0x0c60('0x1')],'defaultValue':_0x0c60('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2d95120..5f06412 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 _0x4524=['set','Content-Range','reject','save','update','then','destroy','error','send','index','map','FaxApplication','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','keys','includeAll','include','find','catch','create','body','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4e681f,_0x295471){var _0x1f4d28=function(_0x1dfa4d){while(--_0x1dfa4d){_0x4e681f['push'](_0x4e681f['shift']());}};_0x1f4d28(++_0x295471);}(_0x4524,0x19f));var _0x4452=function(_0x629f6f,_0x4d0186){_0x629f6f=_0x629f6f-0x0;var _0x15c5a3=_0x4524[_0x629f6f];return _0x15c5a3;};'use strict';var emlformat=require(_0x4452('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4452('0x1'));var rp=require('request-promise');var moment=require(_0x4452('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4452('0x3'));var util=require(_0x4452('0x4'));var path=require('path');var sox=require(_0x4452('0x5'));var csv=require(_0x4452('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4452('0x7'));var _=require(_0x4452('0x8'));var squel=require(_0x4452('0x9'));var crypto=require(_0x4452('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4452('0xb'));var Redis=require(_0x4452('0xc'));var authService=require(_0x4452('0xd'));var qs=require(_0x4452('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4452('0xf'));var logger=require(_0x4452('0x10'))(_0x4452('0x11'));var utils=require(_0x4452('0x12'));var config=require(_0x4452('0x13'));var licenseUtil=require(_0x4452('0x14'));var db=require(_0x4452('0x15'))['db'];function respondWithStatusCode(_0x664681,_0x1cb560){_0x1cb560=_0x1cb560||0xcc;return function(_0x47828f){if(_0x47828f){return _0x664681[_0x4452('0x16')](_0x1cb560);}return _0x664681[_0x4452('0x17')](_0x1cb560)[_0x4452('0x18')]();};}function respondWithResult(_0x21442e,_0x1c61c8){_0x1c61c8=_0x1c61c8||0xc8;return function(_0xa9e0f1){if(_0xa9e0f1){return _0x21442e[_0x4452('0x17')](_0x1c61c8)[_0x4452('0x19')](_0xa9e0f1);}};}function respondWithFilteredResult(_0x2ef664,_0x3c7f0b){return function(_0x391279){if(_0x391279){var _0xdd28d0=typeof _0x3c7f0b[_0x4452('0x1a')]===_0x4452('0x1b')&&typeof _0x3c7f0b[_0x4452('0x1c')]===_0x4452('0x1b');var _0x481dca=_0x391279['count'];var _0x4f52ce=_0xdd28d0?0x0:_0x3c7f0b[_0x4452('0x1a')];var _0x3490fa=_0xdd28d0?_0x391279['count']:_0x3c7f0b[_0x4452('0x1a')]+_0x3c7f0b[_0x4452('0x1c')];var _0x3d7603;if(_0x3490fa>=_0x481dca){_0x3490fa=_0x481dca;_0x3d7603=0xc8;}else{_0x3d7603=0xce;}_0x2ef664['status'](_0x3d7603);return _0x2ef664[_0x4452('0x1d')](_0x4452('0x1e'),_0x4f52ce+'-'+_0x3490fa+'/'+_0x481dca)[_0x4452('0x19')](_0x391279);}return null;};}function patchUpdates(_0x4cc030){return function(_0x1e53e2){try{jsonpatch['apply'](_0x1e53e2,_0x4cc030,!![]);}catch(_0x3f2c42){return BPromise[_0x4452('0x1f')](_0x3f2c42);}return _0x1e53e2[_0x4452('0x20')]();};}function saveUpdates(_0x42f9e1,_0xbbaaeb){return function(_0x13506f){if(_0x13506f){return _0x13506f[_0x4452('0x21')](_0x42f9e1)[_0x4452('0x22')](function(_0xc356b2){return _0xc356b2;});}return null;};}function removeEntity(_0x4d474f,_0x23e779){return function(_0xb8cf14){if(_0xb8cf14){return _0xb8cf14[_0x4452('0x23')]()[_0x4452('0x22')](function(){_0x4d474f[_0x4452('0x17')](0xcc)[_0x4452('0x18')]();});}};}function handleEntityNotFound(_0xb3ce58,_0x49a033){return function(_0x15835b){if(!_0x15835b){_0xb3ce58[_0x4452('0x16')](0x194);}return _0x15835b;};}function handleError(_0x3c7f72,_0x4a94d7){_0x4a94d7=_0x4a94d7||0x1f4;return function(_0x4d9cdf){logger[_0x4452('0x24')](_0x4d9cdf['stack']);if(_0x4d9cdf['name']){delete _0x4d9cdf['name'];}_0x3c7f72['status'](_0x4a94d7)[_0x4452('0x25')](_0x4d9cdf);};}exports[_0x4452('0x26')]=function(_0x27f714,_0x234cea){var _0x40507d={},_0xfa06bc={},_0x3bd7f1={'count':0x0,'rows':[]};var _0xb02b32=_[_0x4452('0x27')](db[_0x4452('0x28')]['rawAttributes'],function(_0x1ce162){return{'name':_0x1ce162[_0x4452('0x29')],'type':_0x1ce162[_0x4452('0x2a')][_0x4452('0x2b')]};});_0xfa06bc[_0x4452('0x2c')]=_[_0x4452('0x27')](_0xb02b32,_0x4452('0x2d'));_0xfa06bc[_0x4452('0x2e')]=_['keys'](_0x27f714[_0x4452('0x2e')]);_0xfa06bc['filters']=_[_0x4452('0x2f')](_0xfa06bc[_0x4452('0x2c')],_0xfa06bc[_0x4452('0x2e')]);_0x40507d['attributes']=_[_0x4452('0x2f')](_0xfa06bc['model'],qs[_0x4452('0x30')](_0x27f714[_0x4452('0x2e')][_0x4452('0x30')]));_0x40507d[_0x4452('0x31')]=_0x40507d[_0x4452('0x31')][_0x4452('0x32')]?_0x40507d[_0x4452('0x31')]:_0xfa06bc[_0x4452('0x2c')];if(!_0x27f714[_0x4452('0x2e')][_0x4452('0x33')](_0x4452('0x34'))){_0x40507d[_0x4452('0x1c')]=qs['limit'](_0x27f714[_0x4452('0x2e')][_0x4452('0x1c')]);_0x40507d[_0x4452('0x1a')]=qs[_0x4452('0x1a')](_0x27f714[_0x4452('0x2e')][_0x4452('0x1a')]);}_0x40507d['order']=qs['sort'](_0x27f714[_0x4452('0x2e')][_0x4452('0x35')]);_0x40507d[_0x4452('0x36')]=qs['filters'](_[_0x4452('0x37')](_0x27f714[_0x4452('0x2e')],_0xfa06bc[_0x4452('0x38')]),_0xb02b32);if(_0x27f714[_0x4452('0x2e')][_0x4452('0x39')]){_0x40507d['where']=_[_0x4452('0x3a')](_0x40507d[_0x4452('0x36')],{'$or':_[_0x4452('0x27')](_0xb02b32,function(_0x29262b){if(_0x29262b['type']!==_0x4452('0x3b')){var _0x22a830={};_0x22a830[_0x29262b[_0x4452('0x2d')]]={'$like':'%'+_0x27f714[_0x4452('0x2e')]['filter']+'%'};return _0x22a830;}})});}_0x40507d=_[_0x4452('0x3a')]({},_0x40507d,_0x27f714[_0x4452('0x3c')]);var _0x2f0758={'where':_0x40507d[_0x4452('0x36')]};return db['FaxApplication'][_0x4452('0x3d')](_0x2f0758)[_0x4452('0x22')](function(_0x245855){_0x3bd7f1[_0x4452('0x3d')]=_0x245855;if(_0x27f714[_0x4452('0x2e')]['includeAll']){_0x40507d['include']=[{'all':!![]}];}return db[_0x4452('0x28')][_0x4452('0x3e')](_0x40507d);})[_0x4452('0x22')](function(_0xd3c43b){_0x3bd7f1[_0x4452('0x3f')]=_0xd3c43b;return _0x3bd7f1;})[_0x4452('0x22')](respondWithFilteredResult(_0x234cea,_0x40507d))['catch'](handleError(_0x234cea,null));};exports[_0x4452('0x40')]=function(_0x5b65c5,_0x35cbeb){var _0x478343={'raw':!![],'where':{'id':_0x5b65c5[_0x4452('0x41')]['id']}},_0x155a6b={};_0x155a6b['model']=_['keys'](db[_0x4452('0x28')][_0x4452('0x42')]);_0x155a6b['query']=_[_0x4452('0x43')](_0x5b65c5[_0x4452('0x2e')]);_0x155a6b['filters']=_[_0x4452('0x2f')](_0x155a6b[_0x4452('0x2c')],_0x155a6b[_0x4452('0x2e')]);_0x478343['attributes']=_[_0x4452('0x2f')](_0x155a6b[_0x4452('0x2c')],qs[_0x4452('0x30')](_0x5b65c5[_0x4452('0x2e')][_0x4452('0x30')]));_0x478343['attributes']=_0x478343[_0x4452('0x31')][_0x4452('0x32')]?_0x478343[_0x4452('0x31')]:_0x155a6b[_0x4452('0x2c')];if(_0x5b65c5[_0x4452('0x2e')][_0x4452('0x44')]){_0x478343[_0x4452('0x45')]=[{'all':!![]}];}_0x478343=_[_0x4452('0x3a')]({},_0x478343,_0x5b65c5[_0x4452('0x3c')]);return db['FaxApplication'][_0x4452('0x46')](_0x478343)[_0x4452('0x22')](handleEntityNotFound(_0x35cbeb,null))[_0x4452('0x22')](respondWithResult(_0x35cbeb,null))[_0x4452('0x47')](handleError(_0x35cbeb,null));};exports['create']=function(_0x438148,_0x221a63){return db[_0x4452('0x28')][_0x4452('0x48')](_0x438148[_0x4452('0x49')],{})[_0x4452('0x22')](respondWithResult(_0x221a63,0xc9))['catch'](handleError(_0x221a63,null));};exports[_0x4452('0x21')]=function(_0x14e94b,_0x35d420){if(_0x14e94b[_0x4452('0x49')]['id']){delete _0x14e94b[_0x4452('0x49')]['id'];}return db[_0x4452('0x28')][_0x4452('0x46')]({'where':{'id':_0x14e94b[_0x4452('0x41')]['id']}})[_0x4452('0x22')](handleEntityNotFound(_0x35d420,null))[_0x4452('0x22')](saveUpdates(_0x14e94b[_0x4452('0x49')],null))[_0x4452('0x22')](respondWithResult(_0x35d420,null))[_0x4452('0x47')](handleError(_0x35d420,null));};exports['destroy']=function(_0x570295,_0x1dd15c){return db[_0x4452('0x28')]['find']({'where':{'id':_0x570295[_0x4452('0x41')]['id']}})[_0x4452('0x22')](handleEntityNotFound(_0x1dd15c,null))[_0x4452('0x22')](removeEntity(_0x1dd15c,null))['catch'](handleError(_0x1dd15c,null));}; \ No newline at end of file +var _0xe1c4=['offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','FaxApplication','rawAttributes','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x37b624,_0x45ef04){var _0x4724a3=function(_0x4f80c0){while(--_0x4f80c0){_0x37b624['push'](_0x37b624['shift']());}};_0x4724a3(++_0x45ef04);}(_0xe1c4,0x14e));var _0x4e1c=function(_0x329a5d,_0x4a886d){_0x329a5d=_0x329a5d-0x0;var _0x56d83d=_0xe1c4[_0x329a5d];return _0x56d83d;};'use strict';var emlformat=require(_0x4e1c('0x0'));var rimraf=require(_0x4e1c('0x1'));var zipdir=require(_0x4e1c('0x2'));var jsonpatch=require(_0x4e1c('0x3'));var rp=require(_0x4e1c('0x4'));var moment=require('moment');var BPromise=require(_0x4e1c('0x5'));var Mustache=require(_0x4e1c('0x6'));var util=require('util');var path=require(_0x4e1c('0x7'));var sox=require(_0x4e1c('0x8'));var csv=require(_0x4e1c('0x9'));var ejs=require(_0x4e1c('0xa'));var fs=require('fs');var fs_extra=require(_0x4e1c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e1c('0xc'));var jsforce=require(_0x4e1c('0xd'));var deskjs=require(_0x4e1c('0xe'));var toCsv=require(_0x4e1c('0x9'));var querystring=require(_0x4e1c('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e1c('0x10'));var authService=require(_0x4e1c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e1c('0x12'))(_0x4e1c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4e1c('0x14'));var db=require(_0x4e1c('0x15'))['db'];function respondWithStatusCode(_0x14ebb4,_0x4b3f54){_0x4b3f54=_0x4b3f54||0xcc;return function(_0x5c1579){if(_0x5c1579){return _0x14ebb4[_0x4e1c('0x16')](_0x4b3f54);}return _0x14ebb4[_0x4e1c('0x17')](_0x4b3f54)[_0x4e1c('0x18')]();};}function respondWithResult(_0x2172fe,_0x1ea103){_0x1ea103=_0x1ea103||0xc8;return function(_0x342cb5){if(_0x342cb5){return _0x2172fe['status'](_0x1ea103)[_0x4e1c('0x19')](_0x342cb5);}};}function respondWithFilteredResult(_0x5bd21c,_0x4c2a41){return function(_0x24732c){if(_0x24732c){var _0x59b6e9=typeof _0x4c2a41[_0x4e1c('0x1a')]==='undefined'&&typeof _0x4c2a41['limit']===_0x4e1c('0x1b');var _0x5a83c1=_0x24732c[_0x4e1c('0x1c')];var _0x58525f=_0x59b6e9?0x0:_0x4c2a41[_0x4e1c('0x1a')];var _0xf07ed5=_0x59b6e9?_0x24732c[_0x4e1c('0x1c')]:_0x4c2a41[_0x4e1c('0x1a')]+_0x4c2a41[_0x4e1c('0x1d')];var _0xc53691;if(_0xf07ed5>=_0x5a83c1){_0xf07ed5=_0x5a83c1;_0xc53691=0xc8;}else{_0xc53691=0xce;}_0x5bd21c['status'](_0xc53691);return _0x5bd21c[_0x4e1c('0x1e')](_0x4e1c('0x1f'),_0x58525f+'-'+_0xf07ed5+'/'+_0x5a83c1)[_0x4e1c('0x19')](_0x24732c);}return null;};}function patchUpdates(_0x4cde74){return function(_0x4413a0){try{jsonpatch[_0x4e1c('0x20')](_0x4413a0,_0x4cde74,!![]);}catch(_0x59126f){return BPromise['reject'](_0x59126f);}return _0x4413a0[_0x4e1c('0x21')]();};}function saveUpdates(_0x1531fd,_0xbe3ba9){return function(_0x22044d){if(_0x22044d){return _0x22044d[_0x4e1c('0x22')](_0x1531fd)['then'](function(_0xe1e975){return _0xe1e975;});}return null;};}function removeEntity(_0x1be206,_0x4ca89e){return function(_0x1f83cc){if(_0x1f83cc){return _0x1f83cc['destroy']()[_0x4e1c('0x23')](function(){_0x1be206['status'](0xcc)[_0x4e1c('0x18')]();});}};}function handleEntityNotFound(_0x304162,_0xc3068b){return function(_0x26b6fb){if(!_0x26b6fb){_0x304162[_0x4e1c('0x16')](0x194);}return _0x26b6fb;};}function handleError(_0x5299af,_0x231e36){_0x231e36=_0x231e36||0x1f4;return function(_0x5dbfd5){logger[_0x4e1c('0x24')](_0x5dbfd5['stack']);if(_0x5dbfd5[_0x4e1c('0x25')]){delete _0x5dbfd5[_0x4e1c('0x25')];}_0x5299af[_0x4e1c('0x17')](_0x231e36)[_0x4e1c('0x26')](_0x5dbfd5);};}exports[_0x4e1c('0x27')]=function(_0x5bd7f8,_0x26e59f){var _0x23f203={},_0x3389e0={},_0x291379={'count':0x0,'rows':[]};var _0x34b717=_[_0x4e1c('0x28')](db[_0x4e1c('0x29')][_0x4e1c('0x2a')],function(_0x5639fc){return{'name':_0x5639fc['fieldName'],'type':_0x5639fc['type'][_0x4e1c('0x2b')]};});_0x3389e0[_0x4e1c('0x2c')]=_['map'](_0x34b717,_0x4e1c('0x25'));_0x3389e0[_0x4e1c('0x2d')]=_[_0x4e1c('0x2e')](_0x5bd7f8[_0x4e1c('0x2d')]);_0x3389e0[_0x4e1c('0x2f')]=_['intersection'](_0x3389e0[_0x4e1c('0x2c')],_0x3389e0[_0x4e1c('0x2d')]);_0x23f203['attributes']=_['intersection'](_0x3389e0['model'],qs[_0x4e1c('0x30')](_0x5bd7f8[_0x4e1c('0x2d')][_0x4e1c('0x30')]));_0x23f203[_0x4e1c('0x31')]=_0x23f203[_0x4e1c('0x31')][_0x4e1c('0x32')]?_0x23f203[_0x4e1c('0x31')]:_0x3389e0[_0x4e1c('0x2c')];if(!_0x5bd7f8[_0x4e1c('0x2d')][_0x4e1c('0x33')](_0x4e1c('0x34'))){_0x23f203['limit']=qs[_0x4e1c('0x1d')](_0x5bd7f8[_0x4e1c('0x2d')][_0x4e1c('0x1d')]);_0x23f203['offset']=qs['offset'](_0x5bd7f8[_0x4e1c('0x2d')][_0x4e1c('0x1a')]);}_0x23f203[_0x4e1c('0x35')]=qs[_0x4e1c('0x36')](_0x5bd7f8['query'][_0x4e1c('0x36')]);_0x23f203[_0x4e1c('0x37')]=qs['filters'](_[_0x4e1c('0x38')](_0x5bd7f8[_0x4e1c('0x2d')],_0x3389e0[_0x4e1c('0x2f')]),_0x34b717);if(_0x5bd7f8[_0x4e1c('0x2d')][_0x4e1c('0x39')]){_0x23f203[_0x4e1c('0x37')]=_[_0x4e1c('0x3a')](_0x23f203[_0x4e1c('0x37')],{'$or':_[_0x4e1c('0x28')](_0x34b717,function(_0x1770f9){if(_0x1770f9[_0x4e1c('0x3b')]!==_0x4e1c('0x3c')){var _0x49147d={};_0x49147d[_0x1770f9['name']]={'$like':'%'+_0x5bd7f8['query'][_0x4e1c('0x39')]+'%'};return _0x49147d;}})});}_0x23f203=_['merge']({},_0x23f203,_0x5bd7f8[_0x4e1c('0x3d')]);var _0x373147={'where':_0x23f203[_0x4e1c('0x37')]};return db['FaxApplication'][_0x4e1c('0x1c')](_0x373147)[_0x4e1c('0x23')](function(_0x173d93){_0x291379[_0x4e1c('0x1c')]=_0x173d93;if(_0x5bd7f8[_0x4e1c('0x2d')][_0x4e1c('0x3e')]){_0x23f203['include']=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x23f203);})[_0x4e1c('0x23')](function(_0x4aa826){_0x291379[_0x4e1c('0x3f')]=_0x4aa826;return _0x291379;})['then'](respondWithFilteredResult(_0x26e59f,_0x23f203))[_0x4e1c('0x40')](handleError(_0x26e59f,null));};exports[_0x4e1c('0x41')]=function(_0x4cc9ea,_0x113e08){var _0x49ccec={'raw':!![],'where':{'id':_0x4cc9ea[_0x4e1c('0x42')]['id']}},_0x5e1262={};_0x5e1262[_0x4e1c('0x2c')]=_[_0x4e1c('0x2e')](db[_0x4e1c('0x29')][_0x4e1c('0x2a')]);_0x5e1262[_0x4e1c('0x2d')]=_[_0x4e1c('0x2e')](_0x4cc9ea[_0x4e1c('0x2d')]);_0x5e1262[_0x4e1c('0x2f')]=_[_0x4e1c('0x43')](_0x5e1262[_0x4e1c('0x2c')],_0x5e1262[_0x4e1c('0x2d')]);_0x49ccec['attributes']=_[_0x4e1c('0x43')](_0x5e1262[_0x4e1c('0x2c')],qs[_0x4e1c('0x30')](_0x4cc9ea[_0x4e1c('0x2d')]['fields']));_0x49ccec[_0x4e1c('0x31')]=_0x49ccec[_0x4e1c('0x31')][_0x4e1c('0x32')]?_0x49ccec[_0x4e1c('0x31')]:_0x5e1262[_0x4e1c('0x2c')];if(_0x4cc9ea[_0x4e1c('0x2d')]['includeAll']){_0x49ccec[_0x4e1c('0x44')]=[{'all':!![]}];}_0x49ccec=_['merge']({},_0x49ccec,_0x4cc9ea[_0x4e1c('0x3d')]);return db[_0x4e1c('0x29')][_0x4e1c('0x45')](_0x49ccec)[_0x4e1c('0x23')](handleEntityNotFound(_0x113e08,null))[_0x4e1c('0x23')](respondWithResult(_0x113e08,null))[_0x4e1c('0x40')](handleError(_0x113e08,null));};exports[_0x4e1c('0x46')]=function(_0x5e47f2,_0x2781bd){return db[_0x4e1c('0x29')][_0x4e1c('0x46')](_0x5e47f2[_0x4e1c('0x47')],{})[_0x4e1c('0x23')](respondWithResult(_0x2781bd,0xc9))[_0x4e1c('0x40')](handleError(_0x2781bd,null));};exports[_0x4e1c('0x22')]=function(_0x53e133,_0x992229){if(_0x53e133[_0x4e1c('0x47')]['id']){delete _0x53e133['body']['id'];}return db[_0x4e1c('0x29')][_0x4e1c('0x45')]({'where':{'id':_0x53e133[_0x4e1c('0x42')]['id']}})[_0x4e1c('0x23')](handleEntityNotFound(_0x992229,null))[_0x4e1c('0x23')](saveUpdates(_0x53e133[_0x4e1c('0x47')],null))[_0x4e1c('0x23')](respondWithResult(_0x992229,null))['catch'](handleError(_0x992229,null));};exports['destroy']=function(_0x206187,_0x5e8b9e){return db[_0x4e1c('0x29')]['find']({'where':{'id':_0x206187[_0x4e1c('0x42')]['id']}})[_0x4e1c('0x23')](handleEntityNotFound(_0x5e8b9e,null))[_0x4e1c('0x23')](removeEntity(_0x5e8b9e,null))['catch'](handleError(_0x5e8b9e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 290a730..aa46bb1 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 _0xe4e8=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x22ba97,_0x166d5a){var _0x10bebf=function(_0x5425c5){while(--_0x5425c5){_0x22ba97['push'](_0x22ba97['shift']());}};_0x10bebf(++_0x166d5a);}(_0xe4e8,0x121));var _0x8e4e=function(_0x137ade,_0x36e463){_0x137ade=_0x137ade-0x0;var _0x59f856=_0xe4e8[_0x137ade];return _0x59f856;};'use strict';var _=require(_0x8e4e('0x0'));var util=require('util');var logger=require(_0x8e4e('0x1'))(_0x8e4e('0x2'));var moment=require(_0x8e4e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e4e('0x4'));var rimraf=require('rimraf');var config=require(_0x8e4e('0x5'));var attributes=require(_0x8e4e('0x6'));module['exports']=function(_0x56e2d1,_0x21e9e1){return _0x56e2d1[_0x8e4e('0x7')](_0x8e4e('0x8'),attributes,{'tableName':_0x8e4e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e4e('0xa'),'collate':_0x8e4e('0xb')});}; \ No newline at end of file +var _0xe836=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications'];(function(_0x3e9137,_0x50f4c6){var _0x34220d=function(_0x4ec3c3){while(--_0x4ec3c3){_0x3e9137['push'](_0x3e9137['shift']());}};_0x34220d(++_0x50f4c6);}(_0xe836,0x9c));var _0x6e83=function(_0xa66c3a,_0x1706af){_0xa66c3a=_0xa66c3a-0x0;var _0x1aeb43=_0xe836[_0xa66c3a];return _0x1aeb43;};'use strict';var _=require(_0x6e83('0x0'));var util=require(_0x6e83('0x1'));var logger=require(_0x6e83('0x2'))(_0x6e83('0x3'));var moment=require(_0x6e83('0x4'));var BPromise=require('bluebird');var rp=require(_0x6e83('0x5'));var fs=require('fs');var path=require(_0x6e83('0x6'));var rimraf=require('rimraf');var config=require(_0x6e83('0x7'));var attributes=require(_0x6e83('0x8'));module['exports']=function(_0x5fa340,_0x5a2392){return _0x5fa340[_0x6e83('0x9')](_0x6e83('0xa'),attributes,{'tableName':_0x6e83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6e83('0xc'),'collate':_0x6e83('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0cbfad4..eff95cc 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 _0xc222=['request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1fe7c3,_0x2f7c6e){var _0x490542=function(_0x1f9859){while(--_0x1f9859){_0x1fe7c3['push'](_0x1fe7c3['shift']());}};_0x490542(++_0x2f7c6e);}(_0xc222,0x144));var _0x2c22=function(_0x1d8051,_0x32d218){_0x1d8051=_0x1d8051-0x0;var _0x16a680=_0xc222[_0x1d8051];return _0x16a680;};'use strict';var _=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var moment=require(_0x2c22('0x2'));var BPromise=require(_0x2c22('0x3'));var rs=require(_0x2c22('0x4'));var fs=require('fs');var Redis=require(_0x2c22('0x5'));var db=require(_0x2c22('0x6'))['db'];var utils=require(_0x2c22('0x7'));var logger=require(_0x2c22('0x8'))(_0x2c22('0x9'));var config=require('../../config/environment');var jayson=require(_0x2c22('0xa'));var client=jayson[_0x2c22('0xb')][_0x2c22('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x580c28,_0x5144a0,_0x1ad987){return new BPromise(function(_0x5e8253,_0x2da1c5){return client[_0x2c22('0xd')](_0x580c28,_0x1ad987)[_0x2c22('0xe')](function(_0x30548b){logger[_0x2c22('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5144a0,_0x2c22('0x10'));logger[_0x2c22('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5144a0,_0x2c22('0x10'),JSON[_0x2c22('0x12')](_0x30548b));if(_0x30548b[_0x2c22('0x13')]){if(_0x30548b[_0x2c22('0x13')][_0x2c22('0x14')]===0x1f4){logger[_0x2c22('0x13')](_0x2c22('0x15'),_0x5144a0,_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);return _0x2da1c5(_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);}logger[_0x2c22('0x13')]('FaxApplication,\x20%s,\x20%s',_0x5144a0,_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);return _0x5e8253(_0x30548b[_0x2c22('0x13')][_0x2c22('0x16')]);}else{logger[_0x2c22('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5144a0,_0x2c22('0x10'));_0x5e8253(_0x30548b[_0x2c22('0x17')][_0x2c22('0x16')]);}})[_0x2c22('0x18')](function(_0x470de4){logger[_0x2c22('0x13')](_0x2c22('0x15'),_0x5144a0,_0x470de4);_0x2da1c5(_0x470de4);});});}exports['UpdateFaxApplication']=function(_0x3f6858){var _0x42439e=this;return new Promise(function(_0x4db004,_0x4d7b05){return db[_0x2c22('0x19')][_0x2c22('0x1a')](_0x3f6858[_0x2c22('0x1b')],{'raw':_0x3f6858['options']?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6858[_0x2c22('0x1c')]?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x1e')]||null:null,'attributes':_0x3f6858[_0x2c22('0x1c')]?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x1f')]||null:null,'limit':_0x3f6858[_0x2c22('0x1c')]?_0x3f6858[_0x2c22('0x1c')][_0x2c22('0x20')]||null:null})['then'](function(_0x3e8796){logger['info'](_0x2c22('0x21'),_0x3f6858);logger[_0x2c22('0x11')](_0x2c22('0x21'),_0x3f6858,JSON[_0x2c22('0x12')](_0x3e8796));_0x4db004(_0x3e8796);})[_0x2c22('0x18')](function(_0x4e2e37){logger[_0x2c22('0x13')]('UpdateFaxApplication',_0x4e2e37[_0x2c22('0x16')],_0x3f6858);_0x4d7b05(_0x42439e['error'](0x1f4,_0x4e2e37[_0x2c22('0x16')]));});});}; \ No newline at end of file +var _0xfe5d=['update','body','options','raw','where','attributes','limit','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x3bc034,_0x236d66){var _0x6aa458=function(_0xee694e){while(--_0xee694e){_0x3bc034['push'](_0x3bc034['shift']());}};_0x6aa458(++_0x236d66);}(_0xfe5d,0x1ba));var _0xdfe5=function(_0x3f3dd6,_0x3176d5){_0x3f3dd6=_0x3f3dd6-0x0;var _0x56cb4e=_0xfe5d[_0x3f3dd6];return _0x56cb4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdfe5('0x0'));var BPromise=require('bluebird');var rs=require(_0xdfe5('0x1'));var fs=require('fs');var Redis=require(_0xdfe5('0x2'));var db=require(_0xdfe5('0x3'))['db'];var utils=require(_0xdfe5('0x4'));var logger=require(_0xdfe5('0x5'))(_0xdfe5('0x6'));var config=require(_0xdfe5('0x7'));var jayson=require(_0xdfe5('0x8'));var client=jayson[_0xdfe5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e595c,_0x82d109,_0x175cd5){return new BPromise(function(_0x425484,_0x1a33a7){return client['request'](_0x1e595c,_0x175cd5)[_0xdfe5('0xa')](function(_0x27c63a){logger[_0xdfe5('0xb')](_0xdfe5('0xc'),_0x82d109,_0xdfe5('0xd'));logger['debug'](_0xdfe5('0xe'),_0x82d109,_0xdfe5('0xd'),JSON[_0xdfe5('0xf')](_0x27c63a));if(_0x27c63a[_0xdfe5('0x10')]){if(_0x27c63a[_0xdfe5('0x10')][_0xdfe5('0x11')]===0x1f4){logger[_0xdfe5('0x10')](_0xdfe5('0xc'),_0x82d109,_0x27c63a[_0xdfe5('0x10')]['message']);return _0x1a33a7(_0x27c63a[_0xdfe5('0x10')]['message']);}logger['error'](_0xdfe5('0xc'),_0x82d109,_0x27c63a[_0xdfe5('0x10')]['message']);return _0x425484(_0x27c63a[_0xdfe5('0x10')][_0xdfe5('0x12')]);}else{logger[_0xdfe5('0xb')](_0xdfe5('0xc'),_0x82d109,_0xdfe5('0xd'));_0x425484(_0x27c63a[_0xdfe5('0x13')][_0xdfe5('0x12')]);}})[_0xdfe5('0x14')](function(_0x16a5d8){logger[_0xdfe5('0x10')](_0xdfe5('0xc'),_0x82d109,_0x16a5d8);_0x1a33a7(_0x16a5d8);});});}exports[_0xdfe5('0x15')]=function(_0x346655){var _0x294296=this;return new Promise(function(_0x295608,_0x10a380){return db[_0xdfe5('0x16')][_0xdfe5('0x17')](_0x346655[_0xdfe5('0x18')],{'raw':_0x346655[_0xdfe5('0x19')]?_0x346655[_0xdfe5('0x19')][_0xdfe5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346655['options']?_0x346655[_0xdfe5('0x19')][_0xdfe5('0x1b')]||null:null,'attributes':_0x346655[_0xdfe5('0x19')]?_0x346655[_0xdfe5('0x19')][_0xdfe5('0x1c')]||null:null,'limit':_0x346655[_0xdfe5('0x19')]?_0x346655['options'][_0xdfe5('0x1d')]||null:null})['then'](function(_0x398e55){logger[_0xdfe5('0xb')](_0xdfe5('0x15'),_0x346655);logger[_0xdfe5('0x1e')](_0xdfe5('0x15'),_0x346655,JSON[_0xdfe5('0xf')](_0x398e55));_0x295608(_0x398e55);})[_0xdfe5('0x14')](function(_0x4e707){logger[_0xdfe5('0x10')](_0xdfe5('0x15'),_0x4e707[_0xdfe5('0x12')],_0x346655);_0x10a380(_0x294296[_0xdfe5('0x10')](0x1f4,_0x4e707['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 508cdbb..32f3536 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 _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','multer'];(function(_0x15b516,_0x53b695){var _0x8a07eb=function(_0x255d6a){while(--_0x255d6a){_0x15b516['push'](_0x15b516['shift']());}};_0x8a07eb(++_0x53b695);}(_0x9348,0x10d));var _0x8934=function(_0x5aee68,_0x15d937){_0x5aee68=_0x5aee68-0x0;var _0x5bf097=_0x9348[_0x5aee68];return _0x5bf097;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8934('0xa')](),controller['update']);router[_0x8934('0xe')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);module[_0x8934('0x11')]=router; \ No newline at end of file +var _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0xf7b4,0x152));var _0x4f7b=function(_0x3fe210,_0x3cdd84){_0x3fe210=_0x3fe210-0x0;var _0x293b52=_0xf7b4[_0x3fe210];return _0x293b52;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index f8fde2e..f81feeb 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 _0xd9f1=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x563c0b,_0x391c64){var _0x2ed720=function(_0x4ed8d8){while(--_0x4ed8d8){_0x563c0b['push'](_0x563c0b['shift']());}};_0x2ed720(++_0x391c64);}(_0xd9f1,0xc9));var _0x1d9f=function(_0x265adb,_0x44ef5c){_0x265adb=_0x265adb-0x0;var _0x119773=_0xd9f1[_0x265adb];return _0x119773;};'use strict';var Sequelize=require(_0x1d9f('0x0'));module[_0x1d9f('0x1')]={'closed':{'type':Sequelize[_0x1d9f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1d9f('0x3')]},'disposition':{'type':Sequelize[_0x1d9f('0x4')]},'secondDisposition':{'type':Sequelize[_0x1d9f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1d9f('0x4')]},'note':{'type':Sequelize[_0x1d9f('0x4')]},'read1stAt':{'type':Sequelize[_0x1d9f('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1d9f('0x5')]('in',_0x1d9f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1d9f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1d9f('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xdb6e=['STRING','ENUM','out','DATE','exports','BOOLEAN'];(function(_0x28a010,_0x3ab272){var _0x4cf972=function(_0x30135b){while(--_0x30135b){_0x28a010['push'](_0x28a010['shift']());}};_0x4cf972(++_0x3ab272);}(_0xdb6e,0x10c));var _0xedb6=function(_0x184cfe,_0x1b1785){_0x184cfe=_0x184cfe-0x0;var _0x24b8e4=_0xdb6e[_0x184cfe];return _0x24b8e4;};'use strict';var Sequelize=require('sequelize');module[_0xedb6('0x0')]={'closed':{'type':Sequelize[_0xedb6('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xedb6('0x2')]},'secondDisposition':{'type':Sequelize[_0xedb6('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xedb6('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xedb6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xedb6('0x3')]('in',_0xedb6('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xedb6('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xedb6('0x3')]('in',_0xedb6('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ab837f1..99c963f 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 _0xc297=['o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','start','body','keys','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','unreadMessages','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','Tag','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','format','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','total','UserId','closed','index','FaxInteraction','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL'];(function(_0xc8a16d,_0x313953){var _0x481cd7=function(_0x3f35f4){while(--_0x3f35f4){_0xc8a16d['push'](_0xc8a16d['shift']());}};_0x481cd7(++_0x313953);}(_0xc297,0x84));var _0x7c29=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xc297[_0x56e4e7];return _0x383618;};'use strict';var emlformat=require(_0x7c29('0x0'));var rimraf=require(_0x7c29('0x1'));var zipdir=require(_0x7c29('0x2'));var jsonpatch=require(_0x7c29('0x3'));var rp=require(_0x7c29('0x4'));var moment=require(_0x7c29('0x5'));var BPromise=require(_0x7c29('0x6'));var Mustache=require(_0x7c29('0x7'));var util=require(_0x7c29('0x8'));var path=require(_0x7c29('0x9'));var sox=require(_0x7c29('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c29('0xb'));var _=require(_0x7c29('0xc'));var squel=require('squel');var crypto=require(_0x7c29('0xd'));var jsforce=require(_0x7c29('0xe'));var deskjs=require(_0x7c29('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c29('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7c29('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c29('0x12'))(_0x7c29('0x13'));var utils=require(_0x7c29('0x14'));var config=require(_0x7c29('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7c29('0x16')](config[_0x7c29('0x17')],{'host':_0x7c29('0x18'),'port':0x18eb});var socket=require(_0x7c29('0x19'))(new Redis(config['redis']));require(_0x7c29('0x1a'))['register'](socket);function respondWithStatusCode(_0x47a82a,_0x107a81){_0x107a81=_0x107a81||0xcc;return function(_0x390e33){if(_0x390e33){return _0x47a82a['sendStatus'](_0x107a81);}return _0x47a82a['status'](_0x107a81)['end']();};}function respondWithResult(_0x2ae24a,_0x50dfe1){_0x50dfe1=_0x50dfe1||0xc8;return function(_0x72daa){if(_0x72daa){return _0x2ae24a[_0x7c29('0x1b')](_0x50dfe1)[_0x7c29('0x1c')](_0x72daa);}};}function respondWithFilteredResult(_0x5950d5,_0x229656){return function(_0x1edccb){if(_0x1edccb){var _0x2fd81b=typeof _0x229656[_0x7c29('0x1d')]==='undefined'&&typeof _0x229656[_0x7c29('0x1e')]==='undefined';var _0x3046aa=_0x1edccb[_0x7c29('0x1f')];var _0x48d222=_0x2fd81b?0x0:_0x229656[_0x7c29('0x1d')];var _0x2ec635=_0x2fd81b?_0x1edccb['count']:_0x229656[_0x7c29('0x1d')]+_0x229656[_0x7c29('0x1e')];var _0x1cabdb;if(_0x2ec635>=_0x3046aa){_0x2ec635=_0x3046aa;_0x1cabdb=0xc8;}else{_0x1cabdb=0xce;}_0x5950d5['status'](_0x1cabdb);return _0x5950d5[_0x7c29('0x20')](_0x7c29('0x21'),_0x48d222+'-'+_0x2ec635+'/'+_0x3046aa)[_0x7c29('0x1c')](_0x1edccb);}return null;};}function patchUpdates(_0x1fbc46){return function(_0x527bdb){try{jsonpatch[_0x7c29('0x22')](_0x527bdb,_0x1fbc46,!![]);}catch(_0xe9f125){return BPromise[_0x7c29('0x23')](_0xe9f125);}return _0x527bdb[_0x7c29('0x24')]();};}function saveUpdates(_0x1c9969,_0x4adf6b){return function(_0x1415e5){if(_0x1415e5){return _0x1415e5[_0x7c29('0x25')](_0x1c9969)[_0x7c29('0x26')](function(_0xf0b69a){return _0xf0b69a;});}return null;};}function removeEntity(_0x511cd2,_0x2182ce){return function(_0x4b2dd1){if(_0x4b2dd1){return _0x4b2dd1[_0x7c29('0x27')]()[_0x7c29('0x26')](function(){_0x511cd2['status'](0xcc)[_0x7c29('0x28')]();});}};}function handleEntityNotFound(_0x3293ff,_0x585106){return function(_0x4f75b2){if(!_0x4f75b2){_0x3293ff['sendStatus'](0x194);}return _0x4f75b2;};}function handleError(_0x49784c,_0x1fccba){_0x1fccba=_0x1fccba||0x1f4;return function(_0x5b9e5e){logger[_0x7c29('0x29')](_0x5b9e5e[_0x7c29('0x2a')]);if(_0x5b9e5e[_0x7c29('0x2b')]){delete _0x5b9e5e['name'];}_0x49784c[_0x7c29('0x1b')](_0x1fccba)[_0x7c29('0x2c')](_0x5b9e5e);};}function getInteractionUsers(_0x2a259e,_0xbfbd61){return new BPromise(function(_0x1c93d3,_0x550952){try{if(_0xbfbd61[_0x2a259e['id']]){_0x2a259e[_0x7c29('0x2d')]=_['map'](_0xbfbd61[_0x2a259e['id']],function(_0x276788){return{'id':_0x276788['id'],'fullname':_0x276788[_0x7c29('0x2e')]};});}}catch(_0x11e933){_0x550952(_0x11e933);}_0x1c93d3(_0x2a259e);});}function getInteractionTags(_0x34f46d,_0x37ba86){return new BPromise(function(_0x4e4d8c,_0x338287){try{if(_0x34f46d[_0x7c29('0x2f')]){_0x34f46d[_0x7c29('0x30')]=[];_0x34f46d['TagIds'][_0x7c29('0x31')](',')[_0x7c29('0x32')](function(_0x26fe3d){_0x34f46d[_0x7c29('0x30')][_0x7c29('0x33')](_0x37ba86[_0x26fe3d]);});}delete _0x34f46d[_0x7c29('0x2f')];}catch(_0x4b35b9){_0x338287(_0x4b35b9);}_0x4e4d8c(_0x34f46d);});}function updateFaxInteraction(_0x2bc3ee,_0x51d78b,_0x558b01){return new BPromise(function(_0x47eab8,_0x490741){return getInteractionUsers(_0x2bc3ee,_0x558b01)[_0x7c29('0x26')](function(_0x128370){return getInteractionTags(_0x128370,_0x51d78b);})[_0x7c29('0x26')](function(_0x6b85ff){return getStateInteraction(_0x6b85ff);})[_0x7c29('0x26')](function(_0x5243b4){_0x47eab8(_0x5243b4);})[_0x7c29('0x34')](function(_0x3241a1){_0x490741(_0x3241a1);});});}function getStateInteraction(_0x2d9b84){return new BPromise(function(_0x50229f){_0x2d9b84[_0x7c29('0x35')]=0x0;_0x2d9b84[_0x7c29('0x36')]=0x0;_0x2d9b84[_0x7c29('0x37')]=0x0;_0x2d9b84['unmanaged']=0x0;_0x2d9b84[_0x7c29('0x38')]=0x0;if(!_0x2d9b84['closed']&&!_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84[_0x7c29('0x35')]+=0x1;}if(!_0x2d9b84[_0x7c29('0x3a')]&&_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84['talking']+=0x1;if(_0x2d9b84[_0x7c29('0x35')]){_0x2d9b84[_0x7c29('0x35')]-=0x1;}}if(_0x2d9b84['closed']&&_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84['answered']+=0x1;if(_0x2d9b84['talking']){_0x2d9b84[_0x7c29('0x36')]-=0x1;}}if(_0x2d9b84[_0x7c29('0x3a')]&&!_0x2d9b84[_0x7c29('0x39')]){_0x2d9b84['unmanaged']+=0x1;if(_0x2d9b84[_0x7c29('0x35')]){_0x2d9b84[_0x7c29('0x35')]-=0x1;}}_0x2d9b84[_0x7c29('0x38')]+=0x1;_0x50229f(_0x2d9b84);});}exports[_0x7c29('0x3b')]=function(_0x11cee2,_0x349587){var _0x316aba={},_0x12efc8={},_0x2f1bc6={'count':0x0,'rows':[]};var _0x15a731=_['map'](db[_0x7c29('0x3c')]['rawAttributes'],function(_0x5bfa27){return{'name':_0x5bfa27['fieldName'],'type':_0x5bfa27['type'][_0x7c29('0x3d')]};});_0x12efc8[_0x7c29('0x3e')]=_[_0x7c29('0x3f')](_0x15a731,_0x7c29('0x2b'));_0x12efc8[_0x7c29('0x40')]=_['keys'](_0x11cee2[_0x7c29('0x40')]);_0x12efc8[_0x7c29('0x41')]=_[_0x7c29('0x42')](_0x12efc8[_0x7c29('0x3e')],_0x12efc8[_0x7c29('0x40')]);_0x316aba[_0x7c29('0x43')]=_['intersection'](_0x12efc8[_0x7c29('0x3e')],qs['fields'](_0x11cee2['query'][_0x7c29('0x44')]));_0x316aba['attributes']=_0x316aba[_0x7c29('0x43')][_0x7c29('0x45')]?_0x316aba[_0x7c29('0x43')]:_0x12efc8['model'];if(!_0x11cee2['query'][_0x7c29('0x46')](_0x7c29('0x47'))){_0x316aba['limit']=qs[_0x7c29('0x1e')](_0x11cee2[_0x7c29('0x40')]['limit']);_0x316aba[_0x7c29('0x1d')]=qs[_0x7c29('0x1d')](_0x11cee2[_0x7c29('0x40')][_0x7c29('0x1d')]);}_0x316aba[_0x7c29('0x48')]=qs[_0x7c29('0x49')](_0x11cee2['query'][_0x7c29('0x49')]);_0x316aba['where']=qs['filters'](_['pick'](_0x11cee2['query'],_0x12efc8[_0x7c29('0x41')]),_0x15a731);var _0x4f526a=[];var _0xddccb4=squel[_0x7c29('0x4a')]()[_0x7c29('0x4b')]('id')[_0x7c29('0x4b')](_0x7c29('0x2b'))[_0x7c29('0x4b')](_0x7c29('0x4c'))[_0x7c29('0x4d')](_0x7c29('0x4e'));var _0x4918ad=squel['select']()[_0x7c29('0x4b')](_0x7c29('0x4f'))['field'](_0x7c29('0x50'))['field'](_0x7c29('0x51'))[_0x7c29('0x4d')](_0x7c29('0x52'),'ui')[_0x7c29('0x53')](_0x7c29('0x54'),'u',_0x7c29('0x55'));var _0x4bf7f5=squel[_0x7c29('0x4a')]()[_0x7c29('0x4d')](_0x7c29('0x56'),'i')[_0x7c29('0x53')]('cm_contacts','c',_0x7c29('0x57'))[_0x7c29('0x53')](_0x7c29('0x54'),'o',_0x7c29('0x58'))['left_join'](_0x7c29('0x59'),'a','a.id\x20=\x20i.FaxAccountId')[_0x7c29('0x53')](_0x7c29('0x5a'),'me',_0x7c29('0x5b'))['left_join']('fax_interaction_has_tags','it',_0x7c29('0x5c'))[_0x7c29('0x53')](_0x7c29('0x4e'),'t',_0x7c29('0x5d'));var _0x532885=squel['expr']();var _0x5c7bbb=[];var _0x54d81a=squel['expr']();var _0x525614;if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x5e')]){_0x525614=as[_0x7c29('0x5f')](_0x11cee2['query'][_0x7c29('0x5e')]);var _0x4085de=_0x525614[_0x7c29('0x60')];for(var _0x2ff7fc=0x0;_0x2ff7fc<_0x525614['conditions']['length'];_0x2ff7fc++){var _0x5648e4=_0x525614[_0x7c29('0x61')][_0x2ff7fc];var _0x148b70='i';var _0x4aad13=_[_0x7c29('0x62')](_0x15a731,[_0x7c29('0x2b'),_0x5648e4[_0x7c29('0x4b')]]);if(!_0x4aad13){switch(_0x5648e4[_0x7c29('0x4b')]){case'unreadMessages':if(_0x5648e4[_0x7c29('0x63')]==0x1){_0x4bf7f5['having']('`'+_0x5648e4['field']+_0x7c29('0x64'));}else{_0x4bf7f5[_0x7c29('0x65')]('`'+_0x5648e4[_0x7c29('0x4b')]+_0x7c29('0x66'));}break;case _0x7c29('0x67'):if(_0x5648e4[_0x7c29('0x68')]===_0x7c29('0x69')){if(_0x5648e4[_0x7c29('0x63')][_0x7c29('0x31')]('\x20')[_0x7c29('0x45')]>0x1){_0x532885[_0x4085de](_0x7c29('0x6a'),qs[_0x7c29('0x6b')](_0x5648e4[_0x7c29('0x63')]),null);}else{var _0x46dba1='%'+_0x5648e4[_0x7c29('0x63')]+'%';_0x532885[_0x4085de](_0x7c29('0x6c'),_0x46dba1,_0x46dba1,_0x46dba1);}}else{_0x4aad13=_[_0x7c29('0x62')](_0x15a731,['name','ContactId']);_0x5648e4[_0x7c29('0x4b')]='ContactId';_0x2570cc=as[_0x7c29('0x6d')](_0x148b70,_0x4aad13[_0x7c29('0x6e')],_0x5648e4);_0x532885[_0x4085de](_0x2570cc[_0x7c29('0x6f')],_0x2570cc[_0x7c29('0x63')]['start'],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x28')]);}break;case'Tag':var _0x3e12f1=_0x5648e4[_0x7c29('0x63')]['split'](',')['map'](function(_0x49af01){return Number(_0x49af01);});_0x3e12f1[_0x7c29('0x32')](function(_0x16db44){_0x54d81a['or'](_0x7c29('0x70'),'%,'+_0x16db44+',%');});_0x5c7bbb=_[_0x7c29('0x71')](_0x5c7bbb,_0x3e12f1);break;case'User':if(_0x5648e4['operator']===_0x7c29('0x69')){_0x532885[_0x4085de]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5648e4[_0x7c29('0x63')]+'%',null);}else{_0x4aad13=_[_0x7c29('0x62')](_0x15a731,[_0x7c29('0x2b'),_0x7c29('0x39')]);_0x5648e4[_0x7c29('0x4b')]=_0x7c29('0x39');_0x2570cc=as[_0x7c29('0x6d')](_0x148b70,_0x4aad13[_0x7c29('0x6e')],_0x5648e4);_0x532885[_0x4085de](_0x2570cc['text'],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x72')],_0x2570cc['value'][_0x7c29('0x28')]);}break;case _0x7c29('0x73'):_0x2570cc=as[_0x7c29('0x6d')]('me',null,_0x5648e4);_0x532885[_0x4085de](_0x2570cc[_0x7c29('0x6f')],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x72')],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x28')]);break;}}else{var _0x2570cc=as[_0x7c29('0x6d')](_0x148b70,_0x4aad13[_0x7c29('0x6e')],_0x5648e4);_0x532885[_0x4085de](_0x2570cc[_0x7c29('0x6f')],_0x2570cc['value']['start'],_0x2570cc[_0x7c29('0x63')][_0x7c29('0x28')]);}}}else{var _0x3371ea=_(_0x11cee2[_0x7c29('0x40')])[_0x7c29('0x74')]()[_0x7c29('0x3f')](function(_0x18fa9d){return _[_0x7c29('0x75')](_0x15a731,['name',_0x18fa9d])?_0x18fa9d:undefined;})[_0x7c29('0x76')]()[_0x7c29('0x63')]();if(!_[_0x7c29('0x77')](_0x3371ea)){_0x3371ea[_0x7c29('0x32')](function(_0x3e86c2){if(_0x3e86c2===_0x7c29('0x78')){_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x7a'),[][_0x7c29('0x7b')](_0x11cee2[_0x7c29('0x40')][_0x3e86c2]));}else if(_0x3e86c2===_0x7c29('0x7c')){var _0x2a8e0b=JSON[_0x7c29('0x7d')](_0x11cee2[_0x7c29('0x40')][_0x3e86c2])['$gte'];var _0x13d0eb=JSON[_0x7c29('0x7d')](_0x11cee2[_0x7c29('0x40')][_0x3e86c2])['$lte'];_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x7e'),_0x2a8e0b,_0x13d0eb);}else{if(_0x11cee2[_0x7c29('0x40')][_0x3e86c2]==='null'){_0x4bf7f5[_0x7c29('0x79')]('i.'+_0x3e86c2+_0x7c29('0x7f'));}else{_0x4bf7f5[_0x7c29('0x79')]('i.'+_0x3e86c2+_0x7c29('0x80'),_0x11cee2[_0x7c29('0x40')][_0x3e86c2]);}}});}if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x81')]){if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x81')]==0x1){_0x4bf7f5[_0x7c29('0x65')]('`unreadMessages`\x20=\x200');}else{_0x4bf7f5[_0x7c29('0x65')](_0x7c29('0x82'));}}if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x83')]){_0x5c7bbb=_[_0x7c29('0x84')](_0x11cee2[_0x7c29('0x40')][_0x7c29('0x83')])?_0x11cee2[_0x7c29('0x40')][_0x7c29('0x83')]:new Array(_0x11cee2['query']['tag']);_0x5c7bbb[_0x7c29('0x32')](function(_0x8bc62c){_0x54d81a['or'](_0x7c29('0x70'),'%,'+_0x8bc62c+',%');});}if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x85')]){var _0x241e75=_0x11cee2[_0x7c29('0x40')]['filter']['replace']('\x5c','\x5c\x5c')[_0x7c29('0x86')](/'/g,'\x27\x27');if(qs[_0x7c29('0x87')](_0x241e75)){_0x532885['or'](_0x7c29('0x88'),_0x241e75+'%')['or']('i.fax\x20LIKE\x20?',_0x241e75+'%');}_0x532885['or'](_0x7c29('0x89'),_0x241e75+'%');}}_0x4bf7f5[_0x7c29('0x79')](_0x532885);_0x4bf7f5[_0x7c29('0x8a')]('i.id');var _0x2fd515={'type':db[_0x7c29('0x8b')][_0x7c29('0x8c')][_0x7c29('0x8d')],'raw':!![]};var _0x15ff99=_0x4bf7f5['clone']();_0x15ff99[_0x7c29('0x4b')](_0x7c29('0x8e'));_0x15ff99['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7c29('0x8f'));if(_0x316aba[_0x7c29('0x48')]){_0x316aba[_0x7c29('0x48')][_0x7c29('0x32')](function(_0x161df6){var _0x564ff1=_0x161df6[0x0]===_0x7c29('0x90')?_0x161df6[0x0]:'i.'+_0x161df6[0x0];_0x4bf7f5[_0x7c29('0x48')](_0x564ff1,_0x161df6[0x1]===_0x7c29('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x5c7bbb)){_0x4bf7f5['having'](_0x54d81a);_0x15ff99[_0x7c29('0x79')]('t.id\x20IN\x20?',_0x5c7bbb);}BPromise[_0x7c29('0x92')]()[_0x7c29('0x26')](function(){if(!_0x525614){if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x78')])return;_0x15ff99['where'](_0x7c29('0x93'));_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x93'));return;}if(_0x11cee2[_0x7c29('0x94')][_0x7c29('0x95')]!=='agent')return;return _0x11cee2[_0x7c29('0x94')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0275){if(_[_0x7c29('0x77')](_0x1c0275)){_0x15ff99[_0x7c29('0x79')]('i.FaxAccountId\x20IS\x20NULL');_0x4bf7f5['where'](_0x7c29('0x96'));}else{_0x15ff99[_0x7c29('0x79')](_0x7c29('0x7a'),_[_0x7c29('0x3f')](_0x1c0275,'id'));_0x4bf7f5[_0x7c29('0x79')](_0x7c29('0x7a'),_[_0x7c29('0x3f')](_0x1c0275,'id'));}});})[_0x7c29('0x26')](function(){if(_0x11cee2[_0x7c29('0x94')][_0x7c29('0x95')]===_0x7c29('0x97')&&!_0x525614&&!_0x11cee2[_0x7c29('0x40')][_0x7c29('0x78')])return[];return db[_0x7c29('0x98')][_0x7c29('0x40')](_0x15ff99[_0x7c29('0x99')](),_0x2fd515);})['then'](function(_0x50a3ec){_0x2f1bc6[_0x7c29('0x1f')]=_0x50a3ec[_0x7c29('0x45')];if(_0x2f1bc6[_0x7c29('0x1f')]===0x0)return[];return db[_0x7c29('0x98')][_0x7c29('0x40')](_0xddccb4[_0x7c29('0x99')](),_0x2fd515)['then'](function(_0x356343){_0x4f526a=_[_0x7c29('0x9a')](_0x356343,'id');_0x2fd515=_[_0x7c29('0x9b')](_0x2fd515,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x11cee2[_0x7c29('0x40')][_0x7c29('0x44')]){_0x316aba[_0x7c29('0x43')][_0x7c29('0x32')](function(_0x15acd2){_0x4bf7f5[_0x7c29('0x4b')]('i.'+_0x15acd2);});}else{_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0x9c'),'unreadMessages');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0x9d'),_0x7c29('0x9e'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0x9f'),_0x7c29('0xa0'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa1'),'contactName');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa2'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa3'),'Contact.firstName');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa4'),_0x7c29('0xa5'));_0x4bf7f5[_0x7c29('0x4b')]('c.email',_0x7c29('0xa6'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa7'),'Contact.phone');_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xa8'),_0x7c29('0xa9'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xaa'),_0x7c29('0xab'));_0x4bf7f5['field']('o.fullname',_0x7c29('0xac'));_0x4bf7f5[_0x7c29('0x4b')](_0x7c29('0xad'),_0x7c29('0xae'));_0x4bf7f5['field'](_0x7c29('0xaf'),_0x7c29('0x2f'));}if(_0x316aba[_0x7c29('0x1e')])_0x4bf7f5[_0x7c29('0x1e')](_0x316aba['limit']);if(_0x316aba[_0x7c29('0x1d')])_0x4bf7f5['offset'](_0x316aba[_0x7c29('0x1d')]);return db['sequelize'][_0x7c29('0x40')](_0x4bf7f5[_0x7c29('0x99')](),_0x2fd515);})[_0x7c29('0x26')](function(_0x316950){if(_0x316950[_0x7c29('0x45')]>0x0)_0x4918ad[_0x7c29('0x79')](_0x7c29('0xb0'),_[_0x7c29('0x3f')](_0x316950,'id'));return db[_0x7c29('0x98')][_0x7c29('0x40')](_0x4918ad['toString'](),_0x2fd515)[_0x7c29('0x26')](function(_0x43c405){var _0x3d9873=_['groupBy'](_0x43c405,'FaxInteractionId');var _0x4096f3=[];_0x316950[_0x7c29('0x32')](function(_0x5107f7){_0x4096f3['push'](updateFaxInteraction(_0x5107f7,_0x4f526a,_0x3d9873));});return BPromise['all'](_0x4096f3);});});})[_0x7c29('0x26')](function(_0xfb5fdd){_0x2f1bc6[_0x7c29('0xb1')]=_0xfb5fdd;return _0x2f1bc6;})[_0x7c29('0x26')](respondWithFilteredResult(_0x349587,_0x316aba))['catch'](handleError(_0x349587,null));};exports[_0x7c29('0xb2')]=function(_0x2eab39,_0x3fa747){var _0x2501f9={'raw':![],'where':{'id':_0x2eab39['params']['id']}},_0x32f1c7={};_0x32f1c7[_0x7c29('0x3e')]=_[_0x7c29('0x74')](db[_0x7c29('0x3c')][_0x7c29('0xb3')]);_0x32f1c7[_0x7c29('0x40')]=_[_0x7c29('0x74')](_0x2eab39[_0x7c29('0x40')]);_0x32f1c7[_0x7c29('0x41')]=_['intersection'](_0x32f1c7[_0x7c29('0x3e')],_0x32f1c7[_0x7c29('0x40')]);_0x2501f9[_0x7c29('0x43')]=_[_0x7c29('0x42')](_0x32f1c7[_0x7c29('0x3e')],qs['fields'](_0x2eab39[_0x7c29('0x40')][_0x7c29('0x44')]));_0x2501f9[_0x7c29('0x43')]=_0x2501f9[_0x7c29('0x43')]['length']?_0x2501f9[_0x7c29('0x43')]:_0x32f1c7[_0x7c29('0x3e')];if(_0x2eab39[_0x7c29('0x40')][_0x7c29('0xb4')]){_0x2501f9[_0x7c29('0xb5')]=[{'all':!![]}];}_0x2501f9=_['merge']({},_0x2501f9,_0x2eab39[_0x7c29('0xb6')]);return db[_0x7c29('0x3c')][_0x7c29('0x62')](_0x2501f9)[_0x7c29('0x26')](handleEntityNotFound(_0x3fa747,null))[_0x7c29('0x26')](respondWithResult(_0x3fa747,null))[_0x7c29('0x34')](handleError(_0x3fa747,null));};exports[_0x7c29('0xb7')]=function(_0x4db460,_0x5db364){return db[_0x7c29('0x3c')][_0x7c29('0xb7')](_0x4db460[_0x7c29('0x73')],{})[_0x7c29('0x26')](respondWithResult(_0x5db364,0xc9))[_0x7c29('0x34')](handleError(_0x5db364,null));};exports['update']=function(_0x512fa3,_0x11ec3a){if(_0x512fa3[_0x7c29('0x73')]['id']){delete _0x512fa3[_0x7c29('0x73')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x512fa3[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0x11ec3a,null))[_0x7c29('0x26')](saveUpdates(_0x512fa3[_0x7c29('0x73')],null))[_0x7c29('0x26')](respondWithResult(_0x11ec3a,null))[_0x7c29('0x34')](handleError(_0x11ec3a,null));};exports['destroy']=function(_0x6a3efe,_0xe53118){return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x6a3efe[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0xe53118,null))[_0x7c29('0x26')](removeEntity(_0xe53118,null))[_0x7c29('0x34')](handleError(_0xe53118,null));};exports[_0x7c29('0xb9')]=function(_0x41cd26,_0x39e0ab){return db[_0x7c29('0x3c')][_0x7c29('0xb9')]()['then'](respondWithResult(_0x39e0ab,null))['catch'](handleError(_0x39e0ab,null));};exports[_0x7c29('0xba')]=function(_0x411094,_0x50c4f,_0x4faeee){return db[_0x7c29('0xbb')][_0x7c29('0x62')]({'where':{'id':_0x411094[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0x50c4f,null))[_0x7c29('0x26')](function(_0x354c90){if(_0x354c90){return _0x354c90[_0x7c29('0xba')](_0x411094[_0x7c29('0x73')][_0x7c29('0xbc')],_[_0x7c29('0xbd')](_0x411094['body'],[_0x7c29('0xbc'),'id'])||{});}})[_0x7c29('0x26')](respondWithResult(_0x50c4f,null))['catch'](handleError(_0x50c4f,null));};exports[_0x7c29('0xbe')]=function(_0x55462c,_0xec8737,_0x395072){var _0x13fb39={'raw':![],'where':{}};var _0x1a6365={};var _0x3185ab={'count':0x0,'rows':[]};return db[_0x7c29('0x3c')]['findOne']({'where':{'id':_0x55462c[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0xec8737,null))['then'](function(_0x4c5523){if(_0x4c5523){_0x1a6365[_0x7c29('0x3e')]=_[_0x7c29('0x74')](db[_0x7c29('0xbb')][_0x7c29('0xb3')]);_0x1a6365[_0x7c29('0x40')]=_['keys'](_0x55462c[_0x7c29('0x40')]);_0x1a6365['filters']=_[_0x7c29('0x42')](_0x1a6365[_0x7c29('0x3e')],_0x1a6365[_0x7c29('0x40')]);_0x13fb39[_0x7c29('0x43')]=_[_0x7c29('0x42')](_0x1a6365[_0x7c29('0x3e')],qs[_0x7c29('0x44')](_0x55462c[_0x7c29('0x40')][_0x7c29('0x44')]));_0x13fb39[_0x7c29('0x43')]=_0x13fb39['attributes'][_0x7c29('0x45')]?_0x13fb39['attributes']:_0x1a6365[_0x7c29('0x3e')];if(!_0x55462c[_0x7c29('0x40')][_0x7c29('0x46')]('nolimit')){_0x13fb39[_0x7c29('0x1e')]=qs[_0x7c29('0x1e')](_0x55462c['query'][_0x7c29('0x1e')]);_0x13fb39['offset']=qs[_0x7c29('0x1d')](_0x55462c[_0x7c29('0x40')][_0x7c29('0x1d')]);}_0x13fb39[_0x7c29('0x48')]=qs['sort'](_0x55462c['query'][_0x7c29('0x49')]);_0x13fb39['where']=qs[_0x7c29('0x41')](_[_0x7c29('0xbf')](_0x55462c['query'],_0x1a6365[_0x7c29('0x41')]));_0x13fb39['where']['FaxInteractionId']=_0x4c5523['id'];if(_0x55462c[_0x7c29('0x40')][_0x7c29('0x85')]){_0x13fb39[_0x7c29('0x79')]=_[_0x7c29('0x9b')](_0x13fb39[_0x7c29('0x79')],{'$or':_['map'](_0x13fb39[_0x7c29('0x43')],function(_0x2fb5df){var _0x2b29be={};_0x2b29be[_0x2fb5df]={'$like':'%'+_0x55462c['query'][_0x7c29('0x85')]+'%'};return _0x2b29be;})});}if(_0x55462c[_0x7c29('0x40')][_0x7c29('0xc0')]){var _0x57e4a5=_0x55462c['query'][_0x7c29('0xc0')][_0x7c29('0x31')](',');var _0x5257a6={};_0x5257a6[_0x57e4a5[0x0]]={'$gte':moment(_0x57e4a5[0x1])['format'](_0x7c29('0xc1'))};_0x13fb39[_0x7c29('0x79')]=_[_0x7c29('0x9b')](_0x13fb39[_0x7c29('0x79')],_0x5257a6);}_0x13fb39=_[_0x7c29('0x9b')]({},_0x13fb39,_0x55462c['options']);return db[_0x7c29('0xbb')]['count']({'where':_0x13fb39[_0x7c29('0x79')]})[_0x7c29('0x26')](function(_0x5b6f9a){_0x3185ab[_0x7c29('0x1f')]=_0x5b6f9a;if(_0x55462c['query'][_0x7c29('0xb4')]){_0x13fb39[_0x7c29('0xb5')]=[{'all':!![]}];}return db[_0x7c29('0xbb')][_0x7c29('0xc2')](_0x13fb39);})['then'](function(_0x585fbd){_0x3185ab[_0x7c29('0xb1')]=_0x585fbd;return _0x3185ab;});}})[_0x7c29('0x26')](respondWithFilteredResult(_0xec8737,_0x13fb39))[_0x7c29('0x34')](handleError(_0xec8737,null));};exports[_0x7c29('0xc3')]=function(_0x152ddf,_0x4f1884,_0x2234c7){return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x152ddf[_0x7c29('0xb8')]['id']}})['then'](handleEntityNotFound(_0x4f1884,null))[_0x7c29('0x26')](function(_0x1523db){if(_0x1523db){return _0x1523db['setTags'](_0x152ddf[_0x7c29('0x73')][_0x7c29('0xbc')],_[_0x7c29('0xbd')](_0x152ddf[_0x7c29('0x73')],['ids','id'])||{})[_0x7c29('0xc4')](function(){return db[_0x7c29('0xc5')]['findAll']({'attributes':['id',_0x7c29('0x2b'),_0x7c29('0x4c')],'where':{'id':_0x152ddf[_0x7c29('0x73')]['ids']}});})['then'](function(_0x2274d8){socket[_0x7c29('0xc6')](_0x7c29('0xc7'),{'id':Number(_0x152ddf[_0x7c29('0xb8')]['id']),'tags':_0x2274d8||[]});return{'id':Number(_0x152ddf[_0x7c29('0xb8')]['id']),'tags':_0x2274d8||[]};});}})[_0x7c29('0x26')](respondWithResult(_0x4f1884,null))[_0x7c29('0x34')](handleError(_0x4f1884,null));};exports[_0x7c29('0xc8')]=function(_0x1d5a9a,_0x14de2f,_0x225737){return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x1d5a9a[_0x7c29('0xb8')]['id']}})[_0x7c29('0x26')](handleEntityNotFound(_0x14de2f,null))[_0x7c29('0x26')](function(_0x433402){if(_0x433402){return _0x433402[_0x7c29('0xc8')](_0x1d5a9a[_0x7c29('0x40')][_0x7c29('0xbc')]);}})[_0x7c29('0x26')](respondWithStatusCode(_0x14de2f,null))[_0x7c29('0x34')](handleError(_0x14de2f,null));};exports['download']=function(_0x13f498,_0x4d13d3){var _0x447904=moment()[_0x7c29('0xc9')]()[_0x7c29('0x99')]();var _0x2356cc=path[_0x7c29('0xca')](config[_0x7c29('0xcb')],_0x7c29('0xcc'),_0x7c29('0xcd'),_0x7c29('0xce'));var _0x38c961=path[_0x7c29('0xca')](config['root'],_0x7c29('0xcc'),_0x7c29('0xcd'),'attachments');var _0x4f4959=path[_0x7c29('0xca')](_0x2356cc,_0x447904);var _0x507f42=util[_0x7c29('0xcf')](_0x7c29('0xd0'),_0x13f498['params']['id'],_0x447904);var _0x30dc5f=path[_0x7c29('0xca')](_0x2356cc,_0x507f42);var _0x2678ec=[];_0x2678ec['push']({'model':db[_0x7c29('0xd1')],'as':_0x7c29('0xd1'),'raw':!![]});var _0x225744=[{'model':db[_0x7c29('0xbb')],'as':_0x7c29('0xd2'),'attributes':['id','body',_0x7c29('0x7c')],'include':_0x2678ec}];return db[_0x7c29('0x3c')][_0x7c29('0x62')]({'where':{'id':_0x13f498[_0x7c29('0xb8')]['id']},'include':_0x225744})[_0x7c29('0x26')](handleEntityNotFound(_0x4d13d3,null))[_0x7c29('0x26')](function(_0x4a6897){if(_0x4a6897&&_0x4a6897['Messages']){var _0x786b2b=_0x4a6897[_0x7c29('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x4f4959);for(var _0x4f0cc0=0x0;_0x4f0cc0<_0x786b2b['Messages'][_0x7c29('0x45')];_0x4f0cc0++){var _0x5ac950=_0x786b2b[_0x7c29('0xd2')][_0x4f0cc0][_0x7c29('0xd1')];if(_0x5ac950){var _0xa64814=path[_0x7c29('0xca')](_0x38c961,_0x5ac950[_0x7c29('0xd4')]);if(fs[_0x7c29('0xd5')](_0xa64814)){fs['createReadStream'](_0xa64814)[_0x7c29('0xd6')](fs[_0x7c29('0xd7')](path[_0x7c29('0xca')](_0x4f4959,_0x5ac950[_0x7c29('0xd4')])));}}}return BPromise[_0x7c29('0x92')]()[_0x7c29('0x26')](function(){return new BPromise(function(_0x8f59f3,_0x1676af){zipdir(_0x4f4959,{'saveTo':_0x30dc5f},function(_0xe368fb,_0x29eda2){if(_0xe368fb)return _0x1676af(_0xe368fb);return _0x8f59f3(_0x29eda2);});})[_0x7c29('0x26')](function(){return new BPromise(function(_0x13ca3d,_0x14a89f){rimraf(_0x4f4959,function(_0x1d53c6){if(_0x1d53c6)_0x14a89f(_0x1d53c6);return _0x13ca3d();});});})[_0x7c29('0x26')](function(){return _0x4d13d3[_0x7c29('0xd8')](_0x30dc5f,_0x507f42,function(_0x4afe7b){if(_0x4afe7b){console[_0x7c29('0xd9')](_0x7c29('0xda'),_0x4afe7b);}else{fs[_0x7c29('0xdb')](_0x30dc5f);}});});});}else{return _0x4d13d3['sendStatus'](0xc8);}})[_0x7c29('0x34')](handleError(_0x4d13d3,null));}; \ No newline at end of file +var _0x2ab3=['find','ContactId','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','some','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','unreadMessages','isEmpty','t.id\x20IN\x20?','resolve','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','show','params','includeAll','options','create','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','format','addTags','setTags','findAll','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','Content-Range','reject','save','then','destroy','error','stack','name','Users','Tags','TagIds','forEach','push','catch','waiting','talking','total','closed','UserId','answered','unmanaged','index','map','FaxInteraction','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x123942,_0x198650){var _0x42304f=function(_0x353af2){while(--_0x353af2){_0x123942['push'](_0x123942['shift']());}};_0x42304f(++_0x198650);}(_0x2ab3,0x14d));var _0x32ab=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x2ab3[_0x1d5400];return _0x21d9fe;};'use strict';var emlformat=require(_0x32ab('0x0'));var rimraf=require(_0x32ab('0x1'));var zipdir=require(_0x32ab('0x2'));var jsonpatch=require(_0x32ab('0x3'));var rp=require(_0x32ab('0x4'));var moment=require('moment');var BPromise=require(_0x32ab('0x5'));var Mustache=require(_0x32ab('0x6'));var util=require(_0x32ab('0x7'));var path=require(_0x32ab('0x8'));var sox=require('sox');var csv=require(_0x32ab('0x9'));var ejs=require(_0x32ab('0xa'));var fs=require('fs');var fs_extra=require(_0x32ab('0xb'));var _=require(_0x32ab('0xc'));var squel=require(_0x32ab('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32ab('0xe'));var toCsv=require(_0x32ab('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x32ab('0xf'));var authService=require(_0x32ab('0x10'));var qs=require(_0x32ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ab('0x12'));var logger=require(_0x32ab('0x13'))(_0x32ab('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x32ab('0x15'));var db=require(_0x32ab('0x16'))['db'];config[_0x32ab('0x17')]=_[_0x32ab('0x18')](config[_0x32ab('0x17')],{'host':_0x32ab('0x19'),'port':0x18eb});var socket=require(_0x32ab('0x1a'))(new Redis(config[_0x32ab('0x17')]));require(_0x32ab('0x1b'))[_0x32ab('0x1c')](socket);function respondWithStatusCode(_0x59c84b,_0x208b4a){_0x208b4a=_0x208b4a||0xcc;return function(_0x4125b7){if(_0x4125b7){return _0x59c84b[_0x32ab('0x1d')](_0x208b4a);}return _0x59c84b[_0x32ab('0x1e')](_0x208b4a)[_0x32ab('0x1f')]();};}function respondWithResult(_0x2bc5b9,_0x2728cd){_0x2728cd=_0x2728cd||0xc8;return function(_0x5e785e){if(_0x5e785e){return _0x2bc5b9[_0x32ab('0x1e')](_0x2728cd)['json'](_0x5e785e);}};}function respondWithFilteredResult(_0x10a4b0,_0x2a83d1){return function(_0x34ef3d){if(_0x34ef3d){var _0x400d8a=typeof _0x2a83d1[_0x32ab('0x20')]===_0x32ab('0x21')&&typeof _0x2a83d1[_0x32ab('0x22')]===_0x32ab('0x21');var _0x2d7c90=_0x34ef3d['count'];var _0x376534=_0x400d8a?0x0:_0x2a83d1[_0x32ab('0x20')];var _0x6d081f=_0x400d8a?_0x34ef3d['count']:_0x2a83d1[_0x32ab('0x20')]+_0x2a83d1[_0x32ab('0x22')];var _0x2accf0;if(_0x6d081f>=_0x2d7c90){_0x6d081f=_0x2d7c90;_0x2accf0=0xc8;}else{_0x2accf0=0xce;}_0x10a4b0[_0x32ab('0x1e')](_0x2accf0);return _0x10a4b0['set'](_0x32ab('0x23'),_0x376534+'-'+_0x6d081f+'/'+_0x2d7c90)['json'](_0x34ef3d);}return null;};}function patchUpdates(_0x277603){return function(_0x183385){try{jsonpatch['apply'](_0x183385,_0x277603,!![]);}catch(_0x3832ac){return BPromise[_0x32ab('0x24')](_0x3832ac);}return _0x183385[_0x32ab('0x25')]();};}function saveUpdates(_0x577e6c,_0x3d5386){return function(_0x57f32c){if(_0x57f32c){return _0x57f32c['update'](_0x577e6c)[_0x32ab('0x26')](function(_0x4591b5){return _0x4591b5;});}return null;};}function removeEntity(_0x2b259c,_0x27c007){return function(_0x2b58db){if(_0x2b58db){return _0x2b58db[_0x32ab('0x27')]()['then'](function(){_0x2b259c[_0x32ab('0x1e')](0xcc)[_0x32ab('0x1f')]();});}};}function handleEntityNotFound(_0x312aa0,_0x2f909a){return function(_0x191859){if(!_0x191859){_0x312aa0['sendStatus'](0x194);}return _0x191859;};}function handleError(_0x431fbb,_0x26211d){_0x26211d=_0x26211d||0x1f4;return function(_0x396480){logger[_0x32ab('0x28')](_0x396480[_0x32ab('0x29')]);if(_0x396480[_0x32ab('0x2a')]){delete _0x396480[_0x32ab('0x2a')];}_0x431fbb[_0x32ab('0x1e')](_0x26211d)['send'](_0x396480);};}function getInteractionUsers(_0x3987c3,_0x1fc036){return new BPromise(function(_0x12afcd,_0x3b7477){try{if(_0x1fc036[_0x3987c3['id']]){_0x3987c3[_0x32ab('0x2b')]=_['map'](_0x1fc036[_0x3987c3['id']],function(_0x1b36aa){return{'id':_0x1b36aa['id'],'fullname':_0x1b36aa['fullname']};});}}catch(_0x3f2aa7){_0x3b7477(_0x3f2aa7);}_0x12afcd(_0x3987c3);});}function getInteractionTags(_0x46602c,_0x1243d0){return new BPromise(function(_0xa319c8,_0x1373fe){try{if(_0x46602c['TagIds']){_0x46602c[_0x32ab('0x2c')]=[];_0x46602c[_0x32ab('0x2d')]['split'](',')[_0x32ab('0x2e')](function(_0x38c2b9){_0x46602c[_0x32ab('0x2c')][_0x32ab('0x2f')](_0x1243d0[_0x38c2b9]);});}delete _0x46602c[_0x32ab('0x2d')];}catch(_0x2677a4){_0x1373fe(_0x2677a4);}_0xa319c8(_0x46602c);});}function updateFaxInteraction(_0x44a267,_0x7268d2,_0x4fe605){return new BPromise(function(_0x193e1e,_0x3a8fb2){return getInteractionUsers(_0x44a267,_0x4fe605)[_0x32ab('0x26')](function(_0x5da732){return getInteractionTags(_0x5da732,_0x7268d2);})['then'](function(_0x11a487){return getStateInteraction(_0x11a487);})[_0x32ab('0x26')](function(_0x56d044){_0x193e1e(_0x56d044);})[_0x32ab('0x30')](function(_0x188c90){_0x3a8fb2(_0x188c90);});});}function getStateInteraction(_0x1989d2){return new BPromise(function(_0x20e019){_0x1989d2[_0x32ab('0x31')]=0x0;_0x1989d2[_0x32ab('0x32')]=0x0;_0x1989d2['answered']=0x0;_0x1989d2['unmanaged']=0x0;_0x1989d2[_0x32ab('0x33')]=0x0;if(!_0x1989d2[_0x32ab('0x34')]&&!_0x1989d2['UserId']){_0x1989d2[_0x32ab('0x31')]+=0x1;}if(!_0x1989d2[_0x32ab('0x34')]&&_0x1989d2[_0x32ab('0x35')]){_0x1989d2[_0x32ab('0x32')]+=0x1;if(_0x1989d2['waiting']){_0x1989d2[_0x32ab('0x31')]-=0x1;}}if(_0x1989d2[_0x32ab('0x34')]&&_0x1989d2['UserId']){_0x1989d2[_0x32ab('0x36')]+=0x1;if(_0x1989d2[_0x32ab('0x32')]){_0x1989d2[_0x32ab('0x32')]-=0x1;}}if(_0x1989d2['closed']&&!_0x1989d2[_0x32ab('0x35')]){_0x1989d2[_0x32ab('0x37')]+=0x1;if(_0x1989d2[_0x32ab('0x31')]){_0x1989d2[_0x32ab('0x31')]-=0x1;}}_0x1989d2['total']+=0x1;_0x20e019(_0x1989d2);});}exports[_0x32ab('0x38')]=function(_0x3780cc,_0x427b01){var _0x27e389={},_0x54bc54={},_0x5c465d={'count':0x0,'rows':[]};var _0x3dabe2=_[_0x32ab('0x39')](db[_0x32ab('0x3a')][_0x32ab('0x3b')],function(_0x4b5de2){return{'name':_0x4b5de2[_0x32ab('0x3c')],'type':_0x4b5de2[_0x32ab('0x3d')]['key']};});_0x54bc54[_0x32ab('0x3e')]=_[_0x32ab('0x39')](_0x3dabe2,_0x32ab('0x2a'));_0x54bc54['query']=_[_0x32ab('0x3f')](_0x3780cc[_0x32ab('0x40')]);_0x54bc54[_0x32ab('0x41')]=_['intersection'](_0x54bc54[_0x32ab('0x3e')],_0x54bc54['query']);_0x27e389[_0x32ab('0x42')]=_[_0x32ab('0x43')](_0x54bc54['model'],qs[_0x32ab('0x44')](_0x3780cc['query'][_0x32ab('0x44')]));_0x27e389[_0x32ab('0x42')]=_0x27e389['attributes']['length']?_0x27e389[_0x32ab('0x42')]:_0x54bc54['model'];if(!_0x3780cc[_0x32ab('0x40')][_0x32ab('0x45')](_0x32ab('0x46'))){_0x27e389[_0x32ab('0x22')]=qs[_0x32ab('0x22')](_0x3780cc['query'][_0x32ab('0x22')]);_0x27e389[_0x32ab('0x20')]=qs[_0x32ab('0x20')](_0x3780cc[_0x32ab('0x40')][_0x32ab('0x20')]);}_0x27e389[_0x32ab('0x47')]=qs['sort'](_0x3780cc['query'][_0x32ab('0x48')]);_0x27e389[_0x32ab('0x49')]=qs[_0x32ab('0x41')](_[_0x32ab('0x4a')](_0x3780cc['query'],_0x54bc54[_0x32ab('0x41')]),_0x3dabe2);var _0x1ad9a8=[];var _0x3d1de6=squel[_0x32ab('0x4b')]()[_0x32ab('0x4c')]('id')[_0x32ab('0x4c')](_0x32ab('0x2a'))['field'](_0x32ab('0x4d'))['from'](_0x32ab('0x4e'));var _0x2c05de=squel['select']()[_0x32ab('0x4c')](_0x32ab('0x4f'))['field']('u.fullname')[_0x32ab('0x4c')](_0x32ab('0x50'))[_0x32ab('0x51')](_0x32ab('0x52'),'ui')[_0x32ab('0x53')]('users','u','u.id\x20=\x20ui.UserId');var _0x123c2c=squel[_0x32ab('0x4b')]()[_0x32ab('0x51')](_0x32ab('0x54'),'i')[_0x32ab('0x53')](_0x32ab('0x55'),'c',_0x32ab('0x56'))[_0x32ab('0x53')](_0x32ab('0x57'),'o','o.id\x20=\x20i.UserId')[_0x32ab('0x53')](_0x32ab('0x58'),'a',_0x32ab('0x59'))[_0x32ab('0x53')](_0x32ab('0x5a'),'me',_0x32ab('0x5b'))[_0x32ab('0x53')]('fax_interaction_has_tags','it',_0x32ab('0x5c'))[_0x32ab('0x53')](_0x32ab('0x4e'),'t',_0x32ab('0x5d'));var _0x406c5a=squel[_0x32ab('0x5e')]();var _0x54a132=[];var _0x214c23=squel[_0x32ab('0x5e')]();var _0x496a22;if(_0x3780cc['query']['search']){_0x496a22=as[_0x32ab('0x5f')](_0x3780cc['query'][_0x32ab('0x60')]);var _0x2ba55d=_0x496a22['sqlOperator'];for(var _0x3f54c2=0x0;_0x3f54c2<_0x496a22[_0x32ab('0x61')]['length'];_0x3f54c2++){var _0x2e65ee=_0x496a22[_0x32ab('0x61')][_0x3f54c2];var _0x1f3869='i';var _0x833a31=_['find'](_0x3dabe2,[_0x32ab('0x2a'),_0x2e65ee[_0x32ab('0x4c')]]);if(!_0x833a31){switch(_0x2e65ee[_0x32ab('0x4c')]){case'unreadMessages':if(_0x2e65ee[_0x32ab('0x62')]==0x1){_0x123c2c[_0x32ab('0x63')]('`'+_0x2e65ee[_0x32ab('0x4c')]+_0x32ab('0x64'));}else{_0x123c2c['having']('`'+_0x2e65ee[_0x32ab('0x4c')]+_0x32ab('0x65'));}break;case _0x32ab('0x66'):if(_0x2e65ee[_0x32ab('0x67')]===_0x32ab('0x68')){if(_0x2e65ee['value']['split']('\x20')[_0x32ab('0x69')]>0x1){_0x406c5a[_0x2ba55d](_0x32ab('0x6a'),qs[_0x32ab('0x6b')](_0x2e65ee[_0x32ab('0x62')]),null);}else{var _0x54aaed='%'+_0x2e65ee[_0x32ab('0x62')]+'%';_0x406c5a[_0x2ba55d](_0x32ab('0x6c'),_0x54aaed,_0x54aaed,_0x54aaed);}}else{_0x833a31=_[_0x32ab('0x6d')](_0x3dabe2,[_0x32ab('0x2a'),_0x32ab('0x6e')]);_0x2e65ee[_0x32ab('0x4c')]=_0x32ab('0x6e');_0x506ede=as['buildExpression'](_0x1f3869,_0x833a31[_0x32ab('0x3d')],_0x2e65ee);_0x406c5a[_0x2ba55d](_0x506ede['text'],_0x506ede['value'][_0x32ab('0x6f')],_0x506ede['value'][_0x32ab('0x1f')]);}break;case _0x32ab('0x70'):var _0xd3e37d=_0x2e65ee['value'][_0x32ab('0x71')](',')[_0x32ab('0x39')](function(_0x4a99fd){return Number(_0x4a99fd);});_0xd3e37d[_0x32ab('0x2e')](function(_0x3500cc){_0x214c23['or'](_0x32ab('0x72'),'%,'+_0x3500cc+',%');});_0x54a132=_['union'](_0x54a132,_0xd3e37d);break;case _0x32ab('0x73'):if(_0x2e65ee[_0x32ab('0x67')]===_0x32ab('0x68')){_0x406c5a[_0x2ba55d](_0x32ab('0x74'),'%'+_0x2e65ee[_0x32ab('0x62')]+'%',null);}else{_0x833a31=_[_0x32ab('0x6d')](_0x3dabe2,[_0x32ab('0x2a'),_0x32ab('0x35')]);_0x2e65ee[_0x32ab('0x4c')]=_0x32ab('0x35');_0x506ede=as[_0x32ab('0x75')](_0x1f3869,_0x833a31['type'],_0x2e65ee);_0x406c5a[_0x2ba55d](_0x506ede[_0x32ab('0x76')],_0x506ede[_0x32ab('0x62')][_0x32ab('0x6f')],_0x506ede['value'][_0x32ab('0x1f')]);}break;case _0x32ab('0x77'):_0x506ede=as[_0x32ab('0x75')]('me',null,_0x2e65ee);_0x406c5a[_0x2ba55d](_0x506ede[_0x32ab('0x76')],_0x506ede['value'][_0x32ab('0x6f')],_0x506ede[_0x32ab('0x62')]['end']);break;}}else{var _0x506ede=as[_0x32ab('0x75')](_0x1f3869,_0x833a31[_0x32ab('0x3d')],_0x2e65ee);_0x406c5a[_0x2ba55d](_0x506ede['text'],_0x506ede[_0x32ab('0x62')][_0x32ab('0x6f')],_0x506ede[_0x32ab('0x62')]['end']);}}}else{var _0x1152b3=_(_0x3780cc[_0x32ab('0x40')])[_0x32ab('0x3f')]()[_0x32ab('0x39')](function(_0xa86011){return _[_0x32ab('0x78')](_0x3dabe2,[_0x32ab('0x2a'),_0xa86011])?_0xa86011:undefined;})['compact']()[_0x32ab('0x62')]();if(!_['isEmpty'](_0x1152b3)){_0x1152b3['forEach'](function(_0x4d83b2){if(_0x4d83b2===_0x32ab('0x79')){_0x123c2c[_0x32ab('0x49')](_0x32ab('0x7a'),[][_0x32ab('0x7b')](_0x3780cc[_0x32ab('0x40')][_0x4d83b2]));}else if(_0x4d83b2==='createdAt'){var _0x531383=JSON[_0x32ab('0x7c')](_0x3780cc[_0x32ab('0x40')][_0x4d83b2])[_0x32ab('0x7d')];var _0x3564de=JSON[_0x32ab('0x7c')](_0x3780cc[_0x32ab('0x40')][_0x4d83b2])[_0x32ab('0x7e')];_0x123c2c['where'](_0x32ab('0x7f'),_0x531383,_0x3564de);}else{if(_0x3780cc['query'][_0x4d83b2]==='null'){_0x123c2c[_0x32ab('0x49')]('i.'+_0x4d83b2+_0x32ab('0x80'));}else{_0x123c2c[_0x32ab('0x49')]('i.'+_0x4d83b2+_0x32ab('0x81'),_0x3780cc[_0x32ab('0x40')][_0x4d83b2]);}}});}if(_0x3780cc[_0x32ab('0x40')][_0x32ab('0x82')]){if(_0x3780cc[_0x32ab('0x40')][_0x32ab('0x82')]==0x1){_0x123c2c[_0x32ab('0x63')](_0x32ab('0x83'));}else{_0x123c2c[_0x32ab('0x63')](_0x32ab('0x84'));}}if(_0x3780cc[_0x32ab('0x40')][_0x32ab('0x85')]){_0x54a132=_['isArray'](_0x3780cc[_0x32ab('0x40')][_0x32ab('0x85')])?_0x3780cc['query'][_0x32ab('0x85')]:new Array(_0x3780cc[_0x32ab('0x40')][_0x32ab('0x85')]);_0x54a132[_0x32ab('0x2e')](function(_0x55c386){_0x214c23['or'](_0x32ab('0x72'),'%,'+_0x55c386+',%');});}if(_0x3780cc[_0x32ab('0x40')][_0x32ab('0x86')]){var _0x1717c4=_0x3780cc['query'][_0x32ab('0x86')][_0x32ab('0x87')]('\x5c','\x5c\x5c')[_0x32ab('0x87')](/'/g,'\x27\x27');if(qs[_0x32ab('0x88')](_0x1717c4)){_0x406c5a['or'](_0x32ab('0x89'),_0x1717c4+'%')['or']('i.fax\x20LIKE\x20?',_0x1717c4+'%');}_0x406c5a['or'](_0x32ab('0x8a'),_0x1717c4+'%');}}_0x123c2c[_0x32ab('0x49')](_0x406c5a);_0x123c2c[_0x32ab('0x8b')](_0x32ab('0x8c'));var _0xf9c50f={'type':db[_0x32ab('0x8d')][_0x32ab('0x8e')]['SELECT'],'raw':!![]};var _0x3bd40d=_0x123c2c[_0x32ab('0x8f')]();_0x3bd40d['field']('i.id');_0x3bd40d[_0x32ab('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x32ab('0x90'));if(_0x27e389[_0x32ab('0x47')]){_0x27e389['order']['forEach'](function(_0x545616){var _0x1116dc=_0x545616[0x0]==='contactName'?_0x545616[0x0]:'i.'+_0x545616[0x0];_0x123c2c['order'](_0x1116dc,_0x545616[0x1]==='DESC'?![]:!![]);});}if(!_[_0x32ab('0x91')](_0x54a132)){_0x123c2c['having'](_0x214c23);_0x3bd40d['where'](_0x32ab('0x92'),_0x54a132);}BPromise[_0x32ab('0x93')]()[_0x32ab('0x26')](function(){if(!_0x496a22){if(_0x3780cc[_0x32ab('0x40')]['FaxAccountId'])return;_0x3bd40d['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x123c2c[_0x32ab('0x49')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3780cc[_0x32ab('0x94')][_0x32ab('0x95')]!==_0x32ab('0x96'))return;return _0x3780cc[_0x32ab('0x94')][_0x32ab('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4f4c37){if(_[_0x32ab('0x91')](_0x4f4c37)){_0x3bd40d[_0x32ab('0x49')](_0x32ab('0x98'));_0x123c2c[_0x32ab('0x49')](_0x32ab('0x98'));}else{_0x3bd40d[_0x32ab('0x49')]('i.FaxAccountId\x20IN\x20?',_[_0x32ab('0x39')](_0x4f4c37,'id'));_0x123c2c[_0x32ab('0x49')](_0x32ab('0x7a'),_[_0x32ab('0x39')](_0x4f4c37,'id'));}});})['then'](function(){if(_0x3780cc[_0x32ab('0x94')][_0x32ab('0x95')]===_0x32ab('0x96')&&!_0x496a22&&!_0x3780cc[_0x32ab('0x40')][_0x32ab('0x79')])return[];return db[_0x32ab('0x99')][_0x32ab('0x40')](_0x3bd40d[_0x32ab('0x9a')](),_0xf9c50f);})[_0x32ab('0x26')](function(_0x29b9d8){_0x5c465d[_0x32ab('0x9b')]=_0x29b9d8['length'];if(_0x5c465d[_0x32ab('0x9b')]===0x0)return[];return db[_0x32ab('0x99')][_0x32ab('0x40')](_0x3d1de6[_0x32ab('0x9a')](),_0xf9c50f)[_0x32ab('0x26')](function(_0x3df678){_0x1ad9a8=_[_0x32ab('0x9c')](_0x3df678,'id');_0xf9c50f=_[_0x32ab('0x9d')](_0xf9c50f,{'model':db[_0x32ab('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3780cc['query'][_0x32ab('0x44')]){_0x27e389['attributes'][_0x32ab('0x2e')](function(_0x3dd516){_0x123c2c[_0x32ab('0x4c')]('i.'+_0x3dd516);});}else{_0x123c2c[_0x32ab('0x4c')](_0x32ab('0x9e'),_0x32ab('0x90'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0x9f'),_0x32ab('0xa0'));_0x123c2c[_0x32ab('0x4c')]('a.mandatoryDisposition',_0x32ab('0xa1'));_0x123c2c[_0x32ab('0x4c')]('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',_0x32ab('0xa2'));_0x123c2c['field'](_0x32ab('0xa3'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0xa4'),_0x32ab('0xa5'));_0x123c2c['field'](_0x32ab('0xa6'),_0x32ab('0xa7'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0xa8'),_0x32ab('0xa9'));_0x123c2c['field'](_0x32ab('0xaa'),_0x32ab('0xab'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0xac'),_0x32ab('0xad'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0xae'),_0x32ab('0xaf'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0xb0'),_0x32ab('0xb1'));_0x123c2c[_0x32ab('0x4c')]('o.internal',_0x32ab('0xb2'));_0x123c2c[_0x32ab('0x4c')](_0x32ab('0xb3'),_0x32ab('0x2d'));}if(_0x27e389['limit'])_0x123c2c[_0x32ab('0x22')](_0x27e389[_0x32ab('0x22')]);if(_0x27e389[_0x32ab('0x20')])_0x123c2c[_0x32ab('0x20')](_0x27e389[_0x32ab('0x20')]);return db[_0x32ab('0x99')][_0x32ab('0x40')](_0x123c2c[_0x32ab('0x9a')](),_0xf9c50f);})['then'](function(_0x4a0f29){if(_0x4a0f29[_0x32ab('0x69')]>0x0)_0x2c05de[_0x32ab('0x49')](_0x32ab('0xb4'),_[_0x32ab('0x39')](_0x4a0f29,'id'));return db['sequelize'][_0x32ab('0x40')](_0x2c05de['toString'](),_0xf9c50f)[_0x32ab('0x26')](function(_0x456715){var _0x130716=_['groupBy'](_0x456715,_0x32ab('0xb5'));var _0x591721=[];_0x4a0f29[_0x32ab('0x2e')](function(_0x332fa3){_0x591721['push'](updateFaxInteraction(_0x332fa3,_0x1ad9a8,_0x130716));});return BPromise[_0x32ab('0xb6')](_0x591721);});});})[_0x32ab('0x26')](function(_0x27b4af){_0x5c465d[_0x32ab('0xb7')]=_0x27b4af;return _0x5c465d;})[_0x32ab('0x26')](respondWithFilteredResult(_0x427b01,_0x27e389))[_0x32ab('0x30')](handleError(_0x427b01,null));};exports[_0x32ab('0xb8')]=function(_0x1223ad,_0x37bce1){var _0x23456d={'raw':![],'where':{'id':_0x1223ad[_0x32ab('0xb9')]['id']}},_0x521261={};_0x521261['model']=_['keys'](db[_0x32ab('0x3a')][_0x32ab('0x3b')]);_0x521261[_0x32ab('0x40')]=_[_0x32ab('0x3f')](_0x1223ad['query']);_0x521261['filters']=_['intersection'](_0x521261[_0x32ab('0x3e')],_0x521261[_0x32ab('0x40')]);_0x23456d[_0x32ab('0x42')]=_[_0x32ab('0x43')](_0x521261[_0x32ab('0x3e')],qs[_0x32ab('0x44')](_0x1223ad[_0x32ab('0x40')][_0x32ab('0x44')]));_0x23456d[_0x32ab('0x42')]=_0x23456d[_0x32ab('0x42')][_0x32ab('0x69')]?_0x23456d['attributes']:_0x521261[_0x32ab('0x3e')];if(_0x1223ad[_0x32ab('0x40')][_0x32ab('0xba')]){_0x23456d['include']=[{'all':!![]}];}_0x23456d=_[_0x32ab('0x9d')]({},_0x23456d,_0x1223ad[_0x32ab('0xbb')]);return db[_0x32ab('0x3a')]['find'](_0x23456d)[_0x32ab('0x26')](handleEntityNotFound(_0x37bce1,null))[_0x32ab('0x26')](respondWithResult(_0x37bce1,null))['catch'](handleError(_0x37bce1,null));};exports['create']=function(_0x17530b,_0x252a64){return db[_0x32ab('0x3a')][_0x32ab('0xbc')](_0x17530b[_0x32ab('0x77')],{})['then'](respondWithResult(_0x252a64,0xc9))[_0x32ab('0x30')](handleError(_0x252a64,null));};exports[_0x32ab('0xbd')]=function(_0x42685b,_0x1bb84d){if(_0x42685b[_0x32ab('0x77')]['id']){delete _0x42685b[_0x32ab('0x77')]['id'];}return db[_0x32ab('0x3a')][_0x32ab('0x6d')]({'where':{'id':_0x42685b[_0x32ab('0xb9')]['id']}})[_0x32ab('0x26')](handleEntityNotFound(_0x1bb84d,null))[_0x32ab('0x26')](saveUpdates(_0x42685b[_0x32ab('0x77')],null))[_0x32ab('0x26')](respondWithResult(_0x1bb84d,null))['catch'](handleError(_0x1bb84d,null));};exports[_0x32ab('0x27')]=function(_0x3d76ff,_0x3bf65a){return db[_0x32ab('0x3a')]['find']({'where':{'id':_0x3d76ff[_0x32ab('0xb9')]['id']}})[_0x32ab('0x26')](handleEntityNotFound(_0x3bf65a,null))[_0x32ab('0x26')](removeEntity(_0x3bf65a,null))[_0x32ab('0x30')](handleError(_0x3bf65a,null));};exports['describe']=function(_0x3f23e0,_0x4f2e3a){return db[_0x32ab('0x3a')][_0x32ab('0xbe')]()['then'](respondWithResult(_0x4f2e3a,null))[_0x32ab('0x30')](handleError(_0x4f2e3a,null));};exports[_0x32ab('0xbf')]=function(_0x42d71e,_0x2b9889,_0x8d7f49){return db[_0x32ab('0xc0')][_0x32ab('0x6d')]({'where':{'id':_0x42d71e[_0x32ab('0xb9')]['id']}})['then'](handleEntityNotFound(_0x2b9889,null))[_0x32ab('0x26')](function(_0x1438c1){if(_0x1438c1){return _0x1438c1[_0x32ab('0xbf')](_0x42d71e[_0x32ab('0x77')]['ids'],_[_0x32ab('0xc1')](_0x42d71e[_0x32ab('0x77')],[_0x32ab('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x2b9889,null))[_0x32ab('0x30')](handleError(_0x2b9889,null));};exports[_0x32ab('0xc3')]=function(_0x4c932c,_0x5b2ae9,_0x2c379a){var _0x4cefea={'raw':![],'where':{}};var _0x2d7a15={};var _0x2632e2={'count':0x0,'rows':[]};return db[_0x32ab('0x3a')][_0x32ab('0xc4')]({'where':{'id':_0x4c932c[_0x32ab('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5b2ae9,null))[_0x32ab('0x26')](function(_0x3a9a37){if(_0x3a9a37){_0x2d7a15[_0x32ab('0x3e')]=_[_0x32ab('0x3f')](db[_0x32ab('0xc0')][_0x32ab('0x3b')]);_0x2d7a15[_0x32ab('0x40')]=_['keys'](_0x4c932c['query']);_0x2d7a15[_0x32ab('0x41')]=_[_0x32ab('0x43')](_0x2d7a15[_0x32ab('0x3e')],_0x2d7a15[_0x32ab('0x40')]);_0x4cefea[_0x32ab('0x42')]=_[_0x32ab('0x43')](_0x2d7a15[_0x32ab('0x3e')],qs[_0x32ab('0x44')](_0x4c932c[_0x32ab('0x40')][_0x32ab('0x44')]));_0x4cefea[_0x32ab('0x42')]=_0x4cefea['attributes'][_0x32ab('0x69')]?_0x4cefea[_0x32ab('0x42')]:_0x2d7a15['model'];if(!_0x4c932c[_0x32ab('0x40')][_0x32ab('0x45')](_0x32ab('0x46'))){_0x4cefea[_0x32ab('0x22')]=qs[_0x32ab('0x22')](_0x4c932c[_0x32ab('0x40')]['limit']);_0x4cefea[_0x32ab('0x20')]=qs[_0x32ab('0x20')](_0x4c932c['query']['offset']);}_0x4cefea[_0x32ab('0x47')]=qs['sort'](_0x4c932c[_0x32ab('0x40')][_0x32ab('0x48')]);_0x4cefea['where']=qs[_0x32ab('0x41')](_[_0x32ab('0x4a')](_0x4c932c[_0x32ab('0x40')],_0x2d7a15[_0x32ab('0x41')]));_0x4cefea['where'][_0x32ab('0xb5')]=_0x3a9a37['id'];if(_0x4c932c[_0x32ab('0x40')][_0x32ab('0x86')]){_0x4cefea[_0x32ab('0x49')]=_['merge'](_0x4cefea[_0x32ab('0x49')],{'$or':_['map'](_0x4cefea[_0x32ab('0x42')],function(_0x565a68){var _0x55e9c1={};_0x55e9c1[_0x565a68]={'$like':'%'+_0x4c932c[_0x32ab('0x40')][_0x32ab('0x86')]+'%'};return _0x55e9c1;})});}if(_0x4c932c['query'][_0x32ab('0x7d')]){var _0xf49d22=_0x4c932c[_0x32ab('0x40')][_0x32ab('0x7d')][_0x32ab('0x71')](',');var _0x167218={};_0x167218[_0xf49d22[0x0]]={'$gte':moment(_0xf49d22[0x1])[_0x32ab('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cefea[_0x32ab('0x49')]=_[_0x32ab('0x9d')](_0x4cefea['where'],_0x167218);}_0x4cefea=_[_0x32ab('0x9d')]({},_0x4cefea,_0x4c932c[_0x32ab('0xbb')]);return db[_0x32ab('0xc0')]['count']({'where':_0x4cefea[_0x32ab('0x49')]})[_0x32ab('0x26')](function(_0x59176b){_0x2632e2['count']=_0x59176b;if(_0x4c932c[_0x32ab('0x40')][_0x32ab('0xba')]){_0x4cefea['include']=[{'all':!![]}];}return db[_0x32ab('0xc0')]['findAll'](_0x4cefea);})[_0x32ab('0x26')](function(_0x5bd88c){_0x2632e2['rows']=_0x5bd88c;return _0x2632e2;});}})[_0x32ab('0x26')](respondWithFilteredResult(_0x5b2ae9,_0x4cefea))[_0x32ab('0x30')](handleError(_0x5b2ae9,null));};exports[_0x32ab('0xc6')]=function(_0x41e6d1,_0x254e73,_0x38f086){return db[_0x32ab('0x3a')][_0x32ab('0x6d')]({'where':{'id':_0x41e6d1['params']['id']}})['then'](handleEntityNotFound(_0x254e73,null))[_0x32ab('0x26')](function(_0x2a8cbf){if(_0x2a8cbf){return _0x2a8cbf[_0x32ab('0xc7')](_0x41e6d1['body'][_0x32ab('0xc2')],_[_0x32ab('0xc1')](_0x41e6d1['body'],[_0x32ab('0xc2'),'id'])||{})['spread'](function(){return db['Tag'][_0x32ab('0xc8')]({'attributes':['id',_0x32ab('0x2a'),_0x32ab('0x4d')],'where':{'id':_0x41e6d1[_0x32ab('0x77')][_0x32ab('0xc2')]}});})[_0x32ab('0x26')](function(_0xad9850){socket[_0x32ab('0xc9')]('faxInteractionTags:save',{'id':Number(_0x41e6d1[_0x32ab('0xb9')]['id']),'tags':_0xad9850||[]});return{'id':Number(_0x41e6d1['params']['id']),'tags':_0xad9850||[]};});}})[_0x32ab('0x26')](respondWithResult(_0x254e73,null))[_0x32ab('0x30')](handleError(_0x254e73,null));};exports[_0x32ab('0xca')]=function(_0x2cf38d,_0x1c2aa6,_0x14a47a){return db[_0x32ab('0x3a')]['find']({'where':{'id':_0x2cf38d[_0x32ab('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1c2aa6,null))[_0x32ab('0x26')](function(_0x2006b8){if(_0x2006b8){return _0x2006b8[_0x32ab('0xca')](_0x2cf38d[_0x32ab('0x40')][_0x32ab('0xc2')]);}})['then'](respondWithStatusCode(_0x1c2aa6,null))[_0x32ab('0x30')](handleError(_0x1c2aa6,null));};exports[_0x32ab('0xcb')]=function(_0x4f107e,_0x1cdd54){var _0x48f882=moment()['unix']()[_0x32ab('0x9a')]();var _0x4d1e23=path[_0x32ab('0xcc')](config[_0x32ab('0xcd')],_0x32ab('0xce'),_0x32ab('0xcf'),'tmp');var _0x3482ca=path[_0x32ab('0xcc')](config['root'],_0x32ab('0xce'),_0x32ab('0xcf'),_0x32ab('0xd0'));var _0x1b9011=path[_0x32ab('0xcc')](_0x4d1e23,_0x48f882);var _0x4d2c9f=util['format'](_0x32ab('0xd1'),_0x4f107e[_0x32ab('0xb9')]['id'],_0x48f882);var _0x167a3f=path[_0x32ab('0xcc')](_0x4d1e23,_0x4d2c9f);var _0x138596=[];_0x138596[_0x32ab('0x2f')]({'model':db[_0x32ab('0xd2')],'as':_0x32ab('0xd2'),'raw':!![]});var _0x45cdf7=[{'model':db[_0x32ab('0xc0')],'as':_0x32ab('0xd3'),'attributes':['id',_0x32ab('0x77'),_0x32ab('0xd4')],'include':_0x138596}];return db[_0x32ab('0x3a')][_0x32ab('0x6d')]({'where':{'id':_0x4f107e['params']['id']},'include':_0x45cdf7})['then'](handleEntityNotFound(_0x1cdd54,null))['then'](function(_0xb4f98d){if(_0xb4f98d&&_0xb4f98d[_0x32ab('0xd3')]){var _0x154355=_0xb4f98d[_0x32ab('0xd5')]({'plain':!![]});fs[_0x32ab('0xd6')](_0x1b9011);for(var _0x105878=0x0;_0x105878<_0x154355[_0x32ab('0xd3')]['length'];_0x105878++){var _0x423309=_0x154355[_0x32ab('0xd3')][_0x105878]['Attachment'];if(_0x423309){var _0x3b4d6e=path[_0x32ab('0xcc')](_0x3482ca,_0x423309[_0x32ab('0xd7')]);if(fs[_0x32ab('0xd8')](_0x3b4d6e)){fs[_0x32ab('0xd9')](_0x3b4d6e)['pipe'](fs[_0x32ab('0xda')](path[_0x32ab('0xcc')](_0x1b9011,_0x423309[_0x32ab('0xd7')])));}}}return BPromise['resolve']()[_0x32ab('0x26')](function(){return new BPromise(function(_0x3bfe7f,_0x6b9d79){zipdir(_0x1b9011,{'saveTo':_0x167a3f},function(_0x24319a,_0x57c2b8){if(_0x24319a)return _0x6b9d79(_0x24319a);return _0x3bfe7f(_0x57c2b8);});})[_0x32ab('0x26')](function(){return new BPromise(function(_0x11a4b2,_0x2720ee){rimraf(_0x1b9011,function(_0x2228be){if(_0x2228be)_0x2720ee(_0x2228be);return _0x11a4b2();});});})[_0x32ab('0x26')](function(){return _0x1cdd54[_0x32ab('0xcb')](_0x167a3f,_0x4d2c9f,function(_0x1559c5){if(_0x1559c5){console[_0x32ab('0xdb')](_0x32ab('0xdc'),_0x1559c5);}else{fs['unlinkSync'](_0x167a3f);}});});});}else{return _0x1cdd54[_0x32ab('0x1d')](0xc8);}})['catch'](handleError(_0x1cdd54,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 59a8b3d..f219ea1 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 _0xa281=['hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x583955,_0x26969f){var _0xe53127=function(_0x371c3e){while(--_0x371c3e){_0x583955['push'](_0x583955['shift']());}};_0xe53127(++_0x26969f);}(_0xa281,0x123));var _0x1a28=function(_0x112130,_0x390676){_0x112130=_0x112130-0x0;var _0x2cef9b=_0xa281[_0x112130];return _0x2cef9b;};'use strict';var EventEmitter=require(_0x1a28('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x1a28('0x1')];var FaxMessage=require(_0x1a28('0x2'))['db'][_0x1a28('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1a28('0x4')](0x0);var events={'afterCreate':_0x1a28('0x5'),'afterUpdate':'update','afterDestroy':_0x1a28('0x6')};function emitEvent(_0x2161cb){return function(_0x570f14,_0x273b91,_0x2e23a3){_0x570f14[_0x1a28('0x7')]({'attributes':['id'],'raw':!![]})[_0x1a28('0x8')](function(_0x2ecad4){_0x570f14[_0x1a28('0x9')](_0x1a28('0xa'),_0x2ecad4[_0x1a28('0xb')](function(_0x3a377c){return{'id':_0x3a377c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x570f14['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a28('0x8')](function(_0xdd351c){_0x570f14[_0x1a28('0x9')](_0x1a28('0xc'),_0xdd351c['length']);FaxInteractionEvents[_0x1a28('0xd')](_0x2161cb+':'+_0x570f14['id'],_0x570f14);FaxInteractionEvents[_0x1a28('0xd')](_0x2161cb,_0x570f14);_0x2e23a3(null);})[_0x1a28('0xe')](_0x2e23a3(null));};}for(var e in events){if(events[_0x1a28('0xf')](e)){var event=events[e];FaxInteraction[_0x1a28('0x10')](e,emitEvent(event));}}module[_0x1a28('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x7b41=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','update','getUsers','then','setDataValue','Users','map'];(function(_0x47b7f6,_0x1bcee6){var _0x2a19fd=function(_0x23cf74){while(--_0x23cf74){_0x47b7f6['push'](_0x47b7f6['shift']());}};_0x2a19fd(++_0x1bcee6);}(_0x7b41,0x107));var _0x17b4=function(_0x17ed7b,_0x3b98e){_0x17ed7b=_0x17ed7b-0x0;var _0x37e2c5=_0x7b41[_0x17ed7b];return _0x37e2c5;};'use strict';var EventEmitter=require(_0x17b4('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x17b4('0x1')];var FaxMessage=require(_0x17b4('0x2'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x17b4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x218a0a){return function(_0x2c840b,_0x5e2e71,_0x5c6eca){_0x2c840b[_0x17b4('0x4')]({'attributes':['id'],'raw':!![]})[_0x17b4('0x5')](function(_0x4fb796){_0x2c840b[_0x17b4('0x6')](_0x17b4('0x7'),_0x4fb796[_0x17b4('0x8')](function(_0x3e67d0){return{'id':_0x3e67d0['id']};}));return FaxMessage[_0x17b4('0x9')]({'where':{'FaxInteractionId':_0x2c840b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x39898b){_0x2c840b['setDataValue'](_0x17b4('0xa'),_0x39898b[_0x17b4('0xb')]);FaxInteractionEvents[_0x17b4('0xc')](_0x218a0a+':'+_0x2c840b['id'],_0x2c840b);FaxInteractionEvents['emit'](_0x218a0a,_0x2c840b);_0x5c6eca(null);})[_0x17b4('0xd')](_0x5c6eca(null));};}for(var e in events){if(events[_0x17b4('0xe')](e)){var event=events[e];FaxInteraction[_0x17b4('0xf')](e,emitEvent(event));}}module[_0x17b4('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c1b8318..c07fb78 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 _0x4f81=['format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed'];(function(_0x1a83c2,_0x28fbb9){var _0xd1a13d=function(_0x4f8df6){while(--_0x4f8df6){_0x1a83c2['push'](_0x1a83c2['shift']());}};_0xd1a13d(++_0x28fbb9);}(_0x4f81,0x1e3));var _0x14f8=function(_0x374bd1,_0x465eeb){_0x374bd1=_0x374bd1-0x0;var _0x3425c8=_0x4f81[_0x374bd1];return _0x3425c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14f8('0x0'))('api');var moment=require(_0x14f8('0x1'));var BPromise=require(_0x14f8('0x2'));var rp=require(_0x14f8('0x3'));var fs=require('fs');var path=require(_0x14f8('0x4'));var rimraf=require(_0x14f8('0x5'));var config=require(_0x14f8('0x6'));var attributes=require(_0x14f8('0x7'));module['exports']=function(_0x33baf0,_0x510822){return _0x33baf0[_0x14f8('0x8')](_0x14f8('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x429066,_0x4169c3,_0x501190){if(_0x429066[_0x14f8('0xa')]('closed')){_0x429066['closedAt']=moment()[_0x14f8('0xb')](_0x14f8('0xc'));}_0x501190(null,_0x429066);}}});}; \ No newline at end of file +var _0x6072=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','fax_interactions','changed','closed','closedAt','format'];(function(_0x3665de,_0x27a4e8){var _0x585e50=function(_0x16d56f){while(--_0x16d56f){_0x3665de['push'](_0x3665de['shift']());}};_0x585e50(++_0x27a4e8);}(_0x6072,0x17b));var _0x2607=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6072[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2607('0x0'));var util=require(_0x2607('0x1'));var logger=require(_0x2607('0x2'))(_0x2607('0x3'));var moment=require(_0x2607('0x4'));var BPromise=require(_0x2607('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2607('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x2607('0x7')]=function(_0x447083,_0x25055c){return _0x447083['define']('FaxInteraction',attributes,{'tableName':_0x2607('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1db297,_0x183d04,_0x2eaded){if(_0x1db297[_0x2607('0x9')](_0x2607('0xa'))){_0x1db297[_0x2607('0xb')]=moment()[_0x2607('0xc')](_0x2607('0xd'));}_0x2eaded(null,_0x1db297);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f487299..7116e39 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 _0x8d2b=['error','code','message','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','AddTagsToFaxInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x40fa1d,_0x27c0bb){var _0x4d56b2=function(_0x3a8645){while(--_0x3a8645){_0x40fa1d['push'](_0x40fa1d['shift']());}};_0x4d56b2(++_0x27c0bb);}(_0x8d2b,0x82));var _0xb8d2=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x8d2b[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xb8d2('0x0'));var util=require(_0xb8d2('0x1'));var moment=require('moment');var BPromise=require(_0xb8d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8d2('0x3'));var db=require(_0xb8d2('0x4'))['db'];var utils=require(_0xb8d2('0x5'));var logger=require(_0xb8d2('0x6'))('rpc');var config=require(_0xb8d2('0x7'));var jayson=require(_0xb8d2('0x8'));var client=jayson[_0xb8d2('0x9')][_0xb8d2('0xa')]({'port':0x232a});config['redis']=_[_0xb8d2('0xb')](config[_0xb8d2('0xc')],{'host':_0xb8d2('0xd'),'port':0x18eb});var socket=require(_0xb8d2('0xe'))(new Redis(config[_0xb8d2('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x52a12b,_0x9555b0,_0xbb78ae){return new BPromise(function(_0x5b6fa8,_0x22a507){return client[_0xb8d2('0xf')](_0x52a12b,_0xbb78ae)[_0xb8d2('0x10')](function(_0x18732d){logger[_0xb8d2('0x11')](_0xb8d2('0x12'),_0x9555b0,_0xb8d2('0x13'));logger[_0xb8d2('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x9555b0,_0xb8d2('0x13'),JSON[_0xb8d2('0x15')](_0x18732d));if(_0x18732d[_0xb8d2('0x16')]){if(_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x17')]===0x1f4){logger[_0xb8d2('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x9555b0,_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x18')]);return _0x22a507(_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x18')]);}logger[_0xb8d2('0x16')](_0xb8d2('0x12'),_0x9555b0,_0x18732d['error']['message']);return _0x5b6fa8(_0x18732d[_0xb8d2('0x16')][_0xb8d2('0x18')]);}else{logger[_0xb8d2('0x11')](_0xb8d2('0x12'),_0x9555b0,'request\x20sent');_0x5b6fa8(_0x18732d['result'][_0xb8d2('0x18')]);}})['catch'](function(_0x47ff22){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x9555b0,_0x47ff22);_0x22a507(_0x47ff22);});});}exports[_0xb8d2('0x19')]=function(_0x58a942){var _0x23ba47=this;return new Promise(function(_0x54cf87,_0x25c07f){return db[_0xb8d2('0x1a')][_0xb8d2('0x1b')](_0x58a942[_0xb8d2('0x1c')],{'raw':_0x58a942['options']?_0x58a942['options'][_0xb8d2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a942['options']?_0x58a942[_0xb8d2('0x1e')]['where']||null:null,'attributes':_0x58a942[_0xb8d2('0x1e')]?_0x58a942['options']['attributes']||null:null,'limit':_0x58a942[_0xb8d2('0x1e')]?_0x58a942[_0xb8d2('0x1e')]['limit']||null:null})[_0xb8d2('0x10')](function(_0x3f3b43){logger[_0xb8d2('0x11')](_0xb8d2('0x19'),_0x58a942);logger[_0xb8d2('0x14')](_0xb8d2('0x19'),_0x58a942,JSON[_0xb8d2('0x15')](_0x3f3b43));_0x54cf87(_0x3f3b43);})['catch'](function(_0x5b878a){logger[_0xb8d2('0x16')](_0xb8d2('0x19'),_0x5b878a['message'],_0x58a942);_0x25c07f(_0x23ba47[_0xb8d2('0x16')](0x1f4,_0x5b878a[_0xb8d2('0x18')]));});});};exports[_0xb8d2('0x1f')]=function(_0x55bef2){return new Promise(function(_0x223949,_0x2511fe){return db[_0xb8d2('0x1a')]['find']({'where':_0x55bef2[_0xb8d2('0x1e')]?_0x55bef2[_0xb8d2('0x1e')][_0xb8d2('0x20')]||null:null})['then'](function(_0x230601){if(_0x230601){return _0x230601[_0xb8d2('0x21')](_0x55bef2[_0xb8d2('0x1c')][_0xb8d2('0x22')],_[_0xb8d2('0x23')](_0x55bef2['body'],[_0xb8d2('0x22'),'id'])||{});}})[_0xb8d2('0x24')](function(_0x1695ba){logger[_0xb8d2('0x11')](_0xb8d2('0x25'),_0x55bef2);logger['debug'](_0xb8d2('0x25'),_0x55bef2,JSON['stringify'](_0x1695ba));_0x223949(_0x1695ba);})['catch'](function(_0x177323){logger[_0xb8d2('0x16')](_0xb8d2('0x25'),_0x177323[_0xb8d2('0x18')],_0x55bef2);_0x2511fe(_this[_0xb8d2('0x16')](0x1f4,_0x177323[_0xb8d2('0x18')]));});});}; \ No newline at end of file +var _0x19c3=['update','options','where','catch','AddTagsToFaxInteraction','body','ids','omit','spread','debug','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','UpdateFaxInteraction','FaxInteraction'];(function(_0x404b35,_0x1f1db5){var _0x58ac40=function(_0x5e1d90){while(--_0x5e1d90){_0x404b35['push'](_0x404b35['shift']());}};_0x58ac40(++_0x1f1db5);}(_0x19c3,0x173));var _0x319c=function(_0x45c63c,_0x3061ae){_0x45c63c=_0x45c63c-0x0;var _0x475aed=_0x19c3[_0x45c63c];return _0x475aed;};'use strict';var _=require(_0x319c('0x0'));var util=require(_0x319c('0x1'));var moment=require(_0x319c('0x2'));var BPromise=require('bluebird');var rs=require(_0x319c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x319c('0x4'))['db'];var utils=require(_0x319c('0x5'));var logger=require(_0x319c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x319c('0x7'));var client=jayson['client'][_0x319c('0x8')]({'port':0x232a});config[_0x319c('0x9')]=_[_0x319c('0xa')](config[_0x319c('0x9')],{'host':_0x319c('0xb'),'port':0x18eb});var socket=require(_0x319c('0xc'))(new Redis(config[_0x319c('0x9')]));require(_0x319c('0xd'))[_0x319c('0xe')](socket);function respondWithRpcPromise(_0xa182b5,_0x931e7e,_0x1959a2){return new BPromise(function(_0x377d1a,_0x12ce67){return client['request'](_0xa182b5,_0x1959a2)[_0x319c('0xf')](function(_0x39673){logger[_0x319c('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x931e7e,_0x319c('0x11'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x931e7e,_0x319c('0x11'),JSON[_0x319c('0x12')](_0x39673));if(_0x39673[_0x319c('0x13')]){if(_0x39673[_0x319c('0x13')][_0x319c('0x14')]===0x1f4){logger[_0x319c('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x931e7e,_0x39673[_0x319c('0x13')][_0x319c('0x15')]);return _0x12ce67(_0x39673[_0x319c('0x13')][_0x319c('0x15')]);}logger[_0x319c('0x13')](_0x319c('0x16'),_0x931e7e,_0x39673[_0x319c('0x13')]['message']);return _0x377d1a(_0x39673[_0x319c('0x13')][_0x319c('0x15')]);}else{logger[_0x319c('0x10')](_0x319c('0x16'),_0x931e7e,'request\x20sent');_0x377d1a(_0x39673['result'][_0x319c('0x15')]);}})['catch'](function(_0x3d27ea){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x931e7e,_0x3d27ea);_0x12ce67(_0x3d27ea);});});}exports[_0x319c('0x17')]=function(_0x1b70fe){var _0xb46c6f=this;return new Promise(function(_0xa5c0b2,_0x56af36){return db[_0x319c('0x18')][_0x319c('0x19')](_0x1b70fe['body'],{'raw':_0x1b70fe['options']?_0x1b70fe[_0x319c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b70fe[_0x319c('0x1a')]?_0x1b70fe[_0x319c('0x1a')][_0x319c('0x1b')]||null:null,'attributes':_0x1b70fe[_0x319c('0x1a')]?_0x1b70fe[_0x319c('0x1a')]['attributes']||null:null,'limit':_0x1b70fe[_0x319c('0x1a')]?_0x1b70fe['options']['limit']||null:null})[_0x319c('0xf')](function(_0x437a63){logger['info'](_0x319c('0x17'),_0x1b70fe);logger['debug']('UpdateFaxInteraction',_0x1b70fe,JSON[_0x319c('0x12')](_0x437a63));_0xa5c0b2(_0x437a63);})[_0x319c('0x1c')](function(_0x574dd3){logger[_0x319c('0x13')](_0x319c('0x17'),_0x574dd3[_0x319c('0x15')],_0x1b70fe);_0x56af36(_0xb46c6f[_0x319c('0x13')](0x1f4,_0x574dd3[_0x319c('0x15')]));});});};exports[_0x319c('0x1d')]=function(_0x3bb15f){return new Promise(function(_0x352b46,_0x4ced22){return db[_0x319c('0x18')]['find']({'where':_0x3bb15f[_0x319c('0x1a')]?_0x3bb15f[_0x319c('0x1a')][_0x319c('0x1b')]||null:null})['then'](function(_0x1035db){if(_0x1035db){return _0x1035db['addTags'](_0x3bb15f[_0x319c('0x1e')][_0x319c('0x1f')],_[_0x319c('0x20')](_0x3bb15f[_0x319c('0x1e')],[_0x319c('0x1f'),'id'])||{});}})[_0x319c('0x21')](function(_0x6d45cb){logger[_0x319c('0x10')]('AddTags',_0x3bb15f);logger[_0x319c('0x22')](_0x319c('0x23'),_0x3bb15f,JSON['stringify'](_0x6d45cb));_0x352b46(_0x6d45cb);})[_0x319c('0x1c')](function(_0x1bdc6c){logger[_0x319c('0x13')](_0x319c('0x23'),_0x1bdc6c['message'],_0x3bb15f);_0x4ced22(_this[_0x319c('0x13')](0x1f4,_0x1bdc6c[_0x319c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 199ccc1..bd34040 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 _0xb939=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x46eceb,_0x5acdba){var _0x20213c=function(_0x51e897){while(--_0x51e897){_0x46eceb['push'](_0x46eceb['shift']());}};_0x20213c(++_0x5acdba);}(_0xb939,0xc7));var _0x9b93=function(_0x4f83dc,_0x217adf){_0x4f83dc=_0x4f83dc-0x0;var _0x4a6883=_0xb939[_0x4f83dc];return _0x4a6883;};'use strict';var FaxInteractionEvents=require(_0x9b93('0x0'));var events=[_0x9b93('0x1'),_0x9b93('0x2'),_0x9b93('0x3')];function createListener(_0x390481,_0xcdca4b){return function(_0x5beb96){_0xcdca4b[_0x9b93('0x4')](_0x390481,_0x5beb96);};}function removeListener(_0x18082c,_0x14cfe8){return function(){FaxInteractionEvents[_0x9b93('0x5')](_0x18082c,_0x14cfe8);};}exports[_0x9b93('0x6')]=function(_0x2df3f1){for(var _0x1cdba5=0x0,_0x1854c0=events[_0x9b93('0x7')];_0x1cdba5<_0x1854c0;_0x1cdba5++){var _0x47e655=events[_0x1cdba5];var _0x439dc9=createListener(_0x9b93('0x8')+_0x47e655,_0x2df3f1);FaxInteractionEvents['on'](_0x47e655,_0x439dc9);}}; \ No newline at end of file +var _0x8683=['remove','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x2e6bbd,_0x2590f2){var _0x42d17c=function(_0x49bc5a){while(--_0x49bc5a){_0x2e6bbd['push'](_0x2e6bbd['shift']());}};_0x42d17c(++_0x2590f2);}(_0x8683,0x1e5));var _0x3868=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x8683[_0x5b561d];return _0x431060;};'use strict';var FaxInteractionEvents=require(_0x3868('0x0'));var events=['save',_0x3868('0x1'),_0x3868('0x2')];function createListener(_0x1c1682,_0x1d048f){return function(_0x33f438){_0x1d048f['emit'](_0x1c1682,_0x33f438);};}function removeListener(_0x10b682,_0x40effd){return function(){FaxInteractionEvents['removeListener'](_0x10b682,_0x40effd);};}exports[_0x3868('0x3')]=function(_0xb4c9c){for(var _0x5313ae=0x0,_0x53d04e=events[_0x3868('0x4')];_0x5313ae<_0x53d04e;_0x5313ae++){var _0x389fc9=events[_0x5313ae];var _0x2241e4=createListener(_0x3868('0x5')+_0x389fc9,_0xb4c9c);FaxInteractionEvents['on'](_0x389fc9,_0x2241e4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 28316cc..323d74a 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 _0x8a3a=['./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','fax','addTags','put','faxinteraction:update','update','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x8a3a,0x10f));var _0xa8a3=function(_0x162ffe,_0x4a74d8){_0x162ffe=_0x162ffe-0x0;var _0x4f4842=_0x8a3a[_0x162ffe];return _0x4f4842;};'use strict';var multer=require(_0xa8a3('0x0'));var util=require(_0xa8a3('0x1'));var path=require(_0xa8a3('0x2'));var timeout=require(_0xa8a3('0x3'));var express=require(_0xa8a3('0x4'));var router=express['Router']();var fs_extra=require(_0xa8a3('0x5'));var auth=require(_0xa8a3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8a3('0x7'));var controller=require(_0xa8a3('0x8'));router[_0xa8a3('0x9')]('/',auth[_0xa8a3('0xa')](),controller['index']);router[_0xa8a3('0x9')](_0xa8a3('0xb'),auth['isAuthenticated'](),controller[_0xa8a3('0xc')]);router[_0xa8a3('0x9')](_0xa8a3('0xd'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0xe')]);router[_0xa8a3('0x9')](_0xa8a3('0xf'),auth[_0xa8a3('0xa')](),controller['getMessages']);router[_0xa8a3('0x9')](_0xa8a3('0x10'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x11')]);router[_0xa8a3('0x12')]('/',auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x13')]);router[_0xa8a3('0x12')](_0xa8a3('0xf'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x14')]);router[_0xa8a3('0x12')]('/:id/tags',auth[_0xa8a3('0xa')](),interaction[_0xa8a3('0x15')](_0xa8a3('0x16'),'faxinteraction:addtags'),controller[_0xa8a3('0x17')]);router[_0xa8a3('0x18')](_0xa8a3('0xd'),auth['isAuthenticated'](),interaction[_0xa8a3('0x15')](_0xa8a3('0x16'),_0xa8a3('0x19')),controller[_0xa8a3('0x1a')]);router['delete']('/:id',auth[_0xa8a3('0xa')](),interaction[_0xa8a3('0x15')](_0xa8a3('0x16'),'faxinteraction:destroy'),controller[_0xa8a3('0x1b')]);router['delete'](_0xa8a3('0x1c'),auth[_0xa8a3('0xa')](),controller[_0xa8a3('0x1d')]);module[_0xa8a3('0x1e')]=router; \ No newline at end of file +var _0x17fd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','post','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy','/:id/tags','exports','multer','util','path'];(function(_0x34584e,_0x6616f4){var _0x570a60=function(_0x284957){while(--_0x284957){_0x34584e['push'](_0x34584e['shift']());}};_0x570a60(++_0x6616f4);}(_0x17fd,0x1aa));var _0xd17f=function(_0x1d6948,_0xdbc746){_0x1d6948=_0x1d6948-0x0;var _0x114db0=_0x17fd[_0x1d6948];return _0x114db0;};'use strict';var multer=require(_0xd17f('0x0'));var util=require(_0xd17f('0x1'));var path=require(_0xd17f('0x2'));var timeout=require(_0xd17f('0x3'));var express=require(_0xd17f('0x4'));var router=express[_0xd17f('0x5')]();var fs_extra=require(_0xd17f('0x6'));var auth=require(_0xd17f('0x7'));var interaction=require(_0xd17f('0x8'));var config=require(_0xd17f('0x9'));var controller=require(_0xd17f('0xa'));router['get']('/',auth[_0xd17f('0xb')](),controller[_0xd17f('0xc')]);router['get'](_0xd17f('0xd'),auth[_0xd17f('0xb')](),controller[_0xd17f('0xe')]);router[_0xd17f('0xf')](_0xd17f('0x10'),auth[_0xd17f('0xb')](),controller[_0xd17f('0x11')]);router[_0xd17f('0xf')](_0xd17f('0x12'),auth[_0xd17f('0xb')](),controller[_0xd17f('0x13')]);router[_0xd17f('0xf')]('/:id/download',auth[_0xd17f('0xb')](),controller['download']);router[_0xd17f('0x14')]('/',auth[_0xd17f('0xb')](),controller['create']);router['post'](_0xd17f('0x12'),auth[_0xd17f('0xb')](),controller[_0xd17f('0x15')]);router[_0xd17f('0x14')]('/:id/tags',auth[_0xd17f('0xb')](),interaction['tracked'](_0xd17f('0x16'),_0xd17f('0x17')),controller[_0xd17f('0x18')]);router[_0xd17f('0x19')](_0xd17f('0x10'),auth[_0xd17f('0xb')](),interaction[_0xd17f('0x1a')](_0xd17f('0x16'),_0xd17f('0x1b')),controller[_0xd17f('0x1c')]);router['delete'](_0xd17f('0x10'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xd17f('0x1d')),controller[_0xd17f('0x1e')]);router['delete'](_0xd17f('0x1f'),auth['isAuthenticated'](),controller['removeTags']);module[_0xd17f('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d0157d4..20f2ce6 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 _0xb7cf=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x4a2193,_0x312076){var _0x634e78=function(_0x35b0b7){while(--_0x35b0b7){_0x4a2193['push'](_0x4a2193['shift']());}};_0x634e78(++_0x312076);}(_0xb7cf,0xca));var _0xfb7c=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0xb7cf[_0x14e9f0];return _0xa63f7e;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'body':{'type':Sequelize[_0xfb7c('0x2')](_0xfb7c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfb7c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfb7c('0x5')),'defaultValue':_0xfb7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfb7c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfb7c('0x6')]}}; \ No newline at end of file +var _0x79a8=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_0x79a8,0x1d0));var _0x879a=function(_0xc34e78,_0x19638f){_0xc34e78=_0xc34e78-0x0;var _0x205de5=_0x79a8[_0xc34e78];return _0x205de5;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'body':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x879a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x879a('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x879a('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c4331e5..7b4bdb6 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 _0xb5c0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','params','intersection','options','find','update','body','fax-interactions','accept','fax','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','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','fullname','email','internal','interface','motionChannel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','sequelize','QueryTypes','contact','channel','rejectmessage','create','CmContact','findOne','ContactId','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','server','files','attachments','download','basename','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'];(function(_0x120427,_0x2fb0b1){var _0x2f320b=function(_0x17da4e){while(--_0x17da4e){_0x120427['push'](_0x120427['shift']());}};_0x2f320b(++_0x2fb0b1);}(_0xb5c0,0x84));var _0x0b5c=function(_0x17cb30,_0x51f68c){_0x17cb30=_0x17cb30-0x0;var _0x26a0d4=_0xb5c0[_0x17cb30];return _0x26a0d4;};'use strict';var emlformat=require(_0x0b5c('0x0'));var rimraf=require(_0x0b5c('0x1'));var zipdir=require(_0x0b5c('0x2'));var jsonpatch=require(_0x0b5c('0x3'));var rp=require(_0x0b5c('0x4'));var moment=require(_0x0b5c('0x5'));var BPromise=require(_0x0b5c('0x6'));var Mustache=require(_0x0b5c('0x7'));var util=require(_0x0b5c('0x8'));var path=require(_0x0b5c('0x9'));var sox=require(_0x0b5c('0xa'));var csv=require(_0x0b5c('0xb'));var ejs=require(_0x0b5c('0xc'));var fs=require('fs');var fs_extra=require(_0x0b5c('0xd'));var _=require(_0x0b5c('0xe'));var squel=require(_0x0b5c('0xf'));var crypto=require(_0x0b5c('0x10'));var jsforce=require(_0x0b5c('0x11'));var deskjs=require(_0x0b5c('0x12'));var toCsv=require(_0x0b5c('0xb'));var querystring=require(_0x0b5c('0x13'));var Papa=require(_0x0b5c('0x14'));var Redis=require(_0x0b5c('0x15'));var authService=require(_0x0b5c('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x0b5c('0x17'));var hardwareService=require(_0x0b5c('0x18'));var logger=require(_0x0b5c('0x19'))(_0x0b5c('0x1a'));var utils=require('../../config/utils');var config=require(_0x0b5c('0x1b'));var licenseUtil=require(_0x0b5c('0x1c'));var db=require(_0x0b5c('0x1d'))['db'];config[_0x0b5c('0x1e')]=_[_0x0b5c('0x1f')](config[_0x0b5c('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b5c('0x20'))(new Redis(config[_0x0b5c('0x1e')]));require(_0x0b5c('0x21'))[_0x0b5c('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b5c('0x23')][_0x0b5c('0x24')]({'port':0x232c});var client9002=jayson['client'][_0x0b5c('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x517024,_0xf513ea,_0xc44950,_0xcf1a54){return new BPromise(function(_0x1f7c5d,_0x32b7eb){var _0x45d1ac=_0xcf1a54||client;return _0x45d1ac[_0x0b5c('0x25')](_0x517024,_0xc44950)[_0x0b5c('0x26')](function(_0x5aff07){logger[_0x0b5c('0x27')](_0x0b5c('0x28'),_0xf513ea,_0x0b5c('0x29'));logger[_0x0b5c('0x2a')](_0x0b5c('0x2b'),_0xf513ea,_0x0b5c('0x29'),JSON[_0x0b5c('0x2c')](_0x5aff07));if(_0x5aff07['error']){if(_0x5aff07['error'][_0x0b5c('0x2d')]===0x1f4){logger[_0x0b5c('0x2e')](_0x0b5c('0x28'),_0xf513ea,_0x5aff07[_0x0b5c('0x2e')][_0x0b5c('0x2f')]);return _0x32b7eb(_0x5aff07[_0x0b5c('0x2e')][_0x0b5c('0x2f')]);}logger[_0x0b5c('0x2e')](_0x0b5c('0x28'),_0xf513ea,_0x5aff07[_0x0b5c('0x2e')][_0x0b5c('0x2f')]);return _0x1f7c5d(_0x5aff07['error'][_0x0b5c('0x2f')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0xf513ea,_0x0b5c('0x29'));_0x1f7c5d(_0x5aff07[_0x0b5c('0x30')][_0x0b5c('0x2f')]);}})[_0x0b5c('0x31')](function(_0x411dbd){logger[_0x0b5c('0x2e')](_0x0b5c('0x28'),_0xf513ea,_0x411dbd);_0x32b7eb(_0x411dbd);});});}function respondWithStatusCode(_0x3bd723,_0x15a5e8){_0x15a5e8=_0x15a5e8||0xcc;return function(_0xd17f40){if(_0xd17f40){return _0x3bd723['sendStatus'](_0x15a5e8);}return _0x3bd723[_0x0b5c('0x32')](_0x15a5e8)[_0x0b5c('0x33')]();};}function respondWithResult(_0x149ac8,_0x51996f){_0x51996f=_0x51996f||0xc8;return function(_0x37ce41){if(_0x37ce41){return _0x149ac8[_0x0b5c('0x32')](_0x51996f)[_0x0b5c('0x34')](_0x37ce41);}};}function respondWithFilteredResult(_0x25be83,_0x24a252){return function(_0x167042){if(_0x167042){var _0x4be337=typeof _0x24a252[_0x0b5c('0x35')]===_0x0b5c('0x36')&&typeof _0x24a252['limit']==='undefined';var _0x3d05ec=_0x167042[_0x0b5c('0x37')];var _0x51dfd6=_0x4be337?0x0:_0x24a252[_0x0b5c('0x35')];var _0xeaae95=_0x4be337?_0x167042[_0x0b5c('0x37')]:_0x24a252[_0x0b5c('0x35')]+_0x24a252[_0x0b5c('0x38')];var _0x333662;if(_0xeaae95>=_0x3d05ec){_0xeaae95=_0x3d05ec;_0x333662=0xc8;}else{_0x333662=0xce;}_0x25be83[_0x0b5c('0x32')](_0x333662);return _0x25be83[_0x0b5c('0x39')](_0x0b5c('0x3a'),_0x51dfd6+'-'+_0xeaae95+'/'+_0x3d05ec)['json'](_0x167042);}return null;};}function patchUpdates(_0x26daad){return function(_0x288c7f){try{jsonpatch[_0x0b5c('0x3b')](_0x288c7f,_0x26daad,!![]);}catch(_0x20ed45){return BPromise['reject'](_0x20ed45);}return _0x288c7f[_0x0b5c('0x3c')]();};}function saveUpdates(_0x14e28b,_0x459de3){return function(_0x3408b3){if(_0x3408b3){return _0x3408b3['update'](_0x14e28b)[_0x0b5c('0x26')](function(_0x54f48b){return _0x54f48b;});}return null;};}function removeEntity(_0x205186,_0x5d1cf6){return function(_0x2cc5f8){if(_0x2cc5f8){return _0x2cc5f8[_0x0b5c('0x3d')]()[_0x0b5c('0x26')](function(){_0x205186[_0x0b5c('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1d192,_0x2b65c9){return function(_0xa7f4e4){if(!_0xa7f4e4){_0xd1d192[_0x0b5c('0x3e')](0x194);}return _0xa7f4e4;};}function handleError(_0x6881f3,_0x422e25){_0x422e25=_0x422e25||0x1f4;return function(_0x1eae2d){logger['error'](_0x1eae2d[_0x0b5c('0x3f')]);if(_0x1eae2d[_0x0b5c('0x40')]){delete _0x1eae2d[_0x0b5c('0x40')];}_0x6881f3[_0x0b5c('0x32')](_0x422e25)[_0x0b5c('0x41')](_0x1eae2d);};}exports[_0x0b5c('0x42')]=function(_0x4b4e95,_0x3ae208){var _0x205d62={},_0x1ffb10={},_0x2c6155={'count':0x0,'rows':[]};var _0x1ebfad=_[_0x0b5c('0x43')](db[_0x0b5c('0x44')][_0x0b5c('0x45')],function(_0x379784){return{'name':_0x379784[_0x0b5c('0x46')],'type':_0x379784[_0x0b5c('0x47')]['key']};});_0x1ffb10[_0x0b5c('0x48')]=_['map'](_0x1ebfad,_0x0b5c('0x40'));_0x1ffb10[_0x0b5c('0x49')]=_[_0x0b5c('0x4a')](_0x4b4e95['query']);_0x1ffb10['filters']=_['intersection'](_0x1ffb10[_0x0b5c('0x48')],_0x1ffb10['query']);_0x205d62[_0x0b5c('0x4b')]=_['intersection'](_0x1ffb10[_0x0b5c('0x48')],qs[_0x0b5c('0x4c')](_0x4b4e95[_0x0b5c('0x49')]['fields']));_0x205d62['attributes']=_0x205d62[_0x0b5c('0x4b')][_0x0b5c('0x4d')]?_0x205d62['attributes']:_0x1ffb10[_0x0b5c('0x48')];if(!_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x4e')](_0x0b5c('0x4f'))){_0x205d62[_0x0b5c('0x38')]=qs[_0x0b5c('0x38')](_0x4b4e95['query'][_0x0b5c('0x38')]);_0x205d62[_0x0b5c('0x35')]=qs['offset'](_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x35')]);}_0x205d62['order']=qs[_0x0b5c('0x50')](_0x4b4e95['query'][_0x0b5c('0x50')]);_0x205d62[_0x0b5c('0x51')]=qs[_0x0b5c('0x52')](_[_0x0b5c('0x53')](_0x4b4e95[_0x0b5c('0x49')],_0x1ffb10[_0x0b5c('0x52')]),_0x1ebfad);if(_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x54')]){_0x205d62[_0x0b5c('0x51')]=_['merge'](_0x205d62[_0x0b5c('0x51')],{'$or':_[_0x0b5c('0x43')](_0x1ebfad,function(_0xa44a7a){if(_0xa44a7a[_0x0b5c('0x47')]!==_0x0b5c('0x55')){var _0x4740a6={};_0x4740a6[_0xa44a7a[_0x0b5c('0x40')]]={'$like':'%'+_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x54')]+'%'};return _0x4740a6;}})});}_0x205d62=_['merge']({},_0x205d62,_0x4b4e95['options']);var _0x122b7f={'where':_0x205d62['where']};return db[_0x0b5c('0x44')][_0x0b5c('0x37')](_0x122b7f)[_0x0b5c('0x26')](function(_0xda5f07){_0x2c6155[_0x0b5c('0x37')]=_0xda5f07;if(_0x4b4e95[_0x0b5c('0x49')][_0x0b5c('0x56')]){_0x205d62[_0x0b5c('0x57')]=[{'all':!![]}];}return db[_0x0b5c('0x44')][_0x0b5c('0x58')](_0x205d62);})[_0x0b5c('0x26')](function(_0x2d9772){_0x2c6155[_0x0b5c('0x59')]=_0x2d9772;return _0x2c6155;})[_0x0b5c('0x26')](respondWithFilteredResult(_0x3ae208,_0x205d62))[_0x0b5c('0x31')](handleError(_0x3ae208,null));};exports['show']=function(_0x8ca21a,_0x588a79){var _0x29067b={'raw':!![],'where':{'id':_0x8ca21a[_0x0b5c('0x5a')]['id']}},_0xd4d26f={};_0xd4d26f[_0x0b5c('0x48')]=_[_0x0b5c('0x4a')](db[_0x0b5c('0x44')]['rawAttributes']);_0xd4d26f['query']=_[_0x0b5c('0x4a')](_0x8ca21a[_0x0b5c('0x49')]);_0xd4d26f[_0x0b5c('0x52')]=_[_0x0b5c('0x5b')](_0xd4d26f[_0x0b5c('0x48')],_0xd4d26f['query']);_0x29067b[_0x0b5c('0x4b')]=_[_0x0b5c('0x5b')](_0xd4d26f[_0x0b5c('0x48')],qs[_0x0b5c('0x4c')](_0x8ca21a[_0x0b5c('0x49')]['fields']));_0x29067b['attributes']=_0x29067b[_0x0b5c('0x4b')][_0x0b5c('0x4d')]?_0x29067b['attributes']:_0xd4d26f[_0x0b5c('0x48')];if(_0x8ca21a[_0x0b5c('0x49')]['includeAll']){_0x29067b[_0x0b5c('0x57')]=[{'all':!![]}];}_0x29067b=_['merge']({},_0x29067b,_0x8ca21a[_0x0b5c('0x5c')]);return db[_0x0b5c('0x44')][_0x0b5c('0x5d')](_0x29067b)[_0x0b5c('0x26')](handleEntityNotFound(_0x588a79,null))[_0x0b5c('0x26')](respondWithResult(_0x588a79,null))[_0x0b5c('0x31')](handleError(_0x588a79,null));};exports[_0x0b5c('0x5e')]=function(_0x86b8e6,_0x22cf7b){if(_0x86b8e6[_0x0b5c('0x5f')]['id']){delete _0x86b8e6[_0x0b5c('0x5f')]['id'];}return db[_0x0b5c('0x44')][_0x0b5c('0x5d')]({'where':{'id':_0x86b8e6[_0x0b5c('0x5a')]['id']}})[_0x0b5c('0x26')](handleEntityNotFound(_0x22cf7b,null))['then'](saveUpdates(_0x86b8e6[_0x0b5c('0x5f')],null))[_0x0b5c('0x26')](respondWithResult(_0x22cf7b,null))['catch'](handleError(_0x22cf7b,null));};exports['destroy']=function(_0x839cb5,_0x50171b){return db[_0x0b5c('0x44')]['find']({'where':{'id':_0x839cb5[_0x0b5c('0x5a')]['id']}})[_0x0b5c('0x26')](handleEntityNotFound(_0x50171b,null))[_0x0b5c('0x26')](removeEntity(_0x50171b,null))[_0x0b5c('0x31')](handleError(_0x50171b,null));};exports['describe']=function(_0x2eee21,_0x4474f4){return db[_0x0b5c('0x44')]['describe']()[_0x0b5c('0x26')](respondWithResult(_0x4474f4,null))[_0x0b5c('0x31')](handleError(_0x4474f4,null));};var interaction_log=require('../../config/logger')(_0x0b5c('0x60'));exports[_0x0b5c('0x61')]=function(_0x2a6d1d,_0x55b4f6,_0x4a6223){var _0x3eeb3f={'agent':{},'channel':_0x0b5c('0x62')};if(_0x2a6d1d[_0x0b5c('0x5f')]['id']){delete _0x2a6d1d[_0x0b5c('0x5f')]['id'];}_0x2a6d1d[_0x0b5c('0x5f')]['read']=!![];_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x63')]=moment()[_0x0b5c('0x64')](_0x0b5c('0x65'));_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x66')]=_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x66')]||_0x2a6d1d['user']['id'];_0x3eeb3f['agent']['id']=_0x2a6d1d['body'][_0x0b5c('0x66')];return db['FaxMessage']['find']({'where':{'id':_0x2a6d1d[_0x0b5c('0x5a')]['id'],'UserId':null}})[_0x0b5c('0x26')](handleEntityNotFound(_0x55b4f6,null))[_0x0b5c('0x26')](saveUpdates(_0x2a6d1d[_0x0b5c('0x5f')],null))[_0x0b5c('0x26')](function(_0x535568){if(_0x535568){_0x3eeb3f[_0x0b5c('0x2f')]=_0x535568[_0x0b5c('0x67')]({'plain':!![]});return db[_0x0b5c('0x68')][_0x0b5c('0x5d')]({'where':{'id':_0x535568[_0x0b5c('0x69')]}});}return null;})[_0x0b5c('0x26')](handleEntityNotFound(_0x55b4f6,null))[_0x0b5c('0x26')](function(_0x2bb1cc){if(_0x2bb1cc){return _0x2bb1cc[_0x0b5c('0x5e')]({'UserId':_0x2a6d1d[_0x0b5c('0x5f')]['UserId'],'read1stAt':_[_0x0b5c('0x6a')](_0x2bb1cc[_0x0b5c('0x6b')])?moment()[_0x0b5c('0x64')](_0x0b5c('0x65')):undefined});}return null;})[_0x0b5c('0x26')](function(_0xd84e06){if(_0xd84e06){_0x3eeb3f['interaction']=_0xd84e06[_0x0b5c('0x67')]({'plain':!![]});interaction_log[_0x0b5c('0x27')](_0x0b5c('0x6c'),_0x2a6d1d['user']['id'],_0x2a6d1d['user'][_0x0b5c('0x40')],_0x2a6d1d[_0x0b5c('0x6d')]['role'],_0x3eeb3f[_0x0b5c('0x6e')]['id'],_0x2a6d1d[_0x0b5c('0x5f')]?JSON[_0x0b5c('0x2c')](_0x2a6d1d[_0x0b5c('0x5f')]):_0x0b5c('0x6f'));return respondWithRpcPromise(_0x0b5c('0x70'),_0x0b5c('0x71'),_0x3eeb3f);}return null;})['then'](function(_0x38dc53){var _0x391552=_0x0b5c('0x72')+_0x38dc53['message']['ContactId'];return db['sequelize'][_0x0b5c('0x49')](_0x391552,{'type':db[_0x0b5c('0x73')]['QueryTypes'][_0x0b5c('0x74')],'raw':!![]})[_0x0b5c('0x26')](function(_0x31d454){return _0x31d454;});})[_0x0b5c('0x26')](function(_0xd13f73){if(_0xd13f73){_0x3eeb3f[_0x0b5c('0x2f')]['contact']=_0xd13f73[0x0];if(!_0x2a6d1d['body']['UserId'])return;return db[_0x0b5c('0x75')][_0x0b5c('0x5d')]({'where':{'id':_0x2a6d1d[_0x0b5c('0x5f')][_0x0b5c('0x66')],'role':'agent'},'attributes':['id',_0x0b5c('0x40'),_0x0b5c('0x76'),_0x0b5c('0x77'),_0x0b5c('0x78')],'raw':!![]});}return null;})[_0x0b5c('0x26')](function(_0x35e2b4){if(!_0x35e2b4)return null;_0x3eeb3f['message']['agent']=_0x35e2b4;return _0x3eeb3f;})[_0x0b5c('0x26')](function(_0x4fce9b){if(_0x4fce9b){if(_0x2a6d1d[_0x0b5c('0x5f')]['manual']){_0x3eeb3f['message'][_0x0b5c('0x79')]=util[_0x0b5c('0x64')]('SIP/%s',_0x2a6d1d['user']['name']);_0x3eeb3f[_0x0b5c('0x2f')]['channel']=_0x3eeb3f['channel'];_0x3eeb3f[_0x0b5c('0x2f')][_0x0b5c('0x7a')]=_0x3eeb3f['channel'];_0x3eeb3f[_0x0b5c('0x2f')][_0x0b5c('0x7b')]=_0x0b5c('0x61');return respondWithRpcPromise(_0x0b5c('0x7c'),_0x0b5c('0x7c'),{'event':_0x0b5c('0x7d'),'message':_0x3eeb3f[_0x0b5c('0x2f')]},client9002)[_0x0b5c('0x26')](function(){return _0x3eeb3f;});}return _0x3eeb3f;}return null;})[_0x0b5c('0x26')](respondWithResult(_0x55b4f6,null))[_0x0b5c('0x31')](handleError(_0x55b4f6,null));};var interaction_log=require(_0x0b5c('0x19'))(_0x0b5c('0x60'));exports[_0x0b5c('0x7e')]=function(_0x180cc4,_0x5c6e2f,_0x2b9826){var _0x442da1={'agent':{},'channel':_0x0b5c('0x62')};if(_0x180cc4['body']['id']){delete _0x180cc4[_0x0b5c('0x5f')]['id'];}_0x180cc4[_0x0b5c('0x5f')][_0x0b5c('0x66')]=_0x180cc4['body']['UserId']||_0x180cc4[_0x0b5c('0x6d')]['id'];_0x442da1[_0x0b5c('0x7f')]['id']=_0x180cc4[_0x0b5c('0x5f')][_0x0b5c('0x66')];return db[_0x0b5c('0x44')][_0x0b5c('0x5d')]({'where':{'id':_0x180cc4[_0x0b5c('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c6e2f,null))[_0x0b5c('0x26')](function(_0x16f80b){if(_0x16f80b){_0x442da1[_0x0b5c('0x2f')]=_0x16f80b[_0x0b5c('0x67')]({'plain':!![]});return db[_0x0b5c('0x68')][_0x0b5c('0x5d')]({'where':{'id':_0x16f80b[_0x0b5c('0x69')]}});}return null;})[_0x0b5c('0x26')](handleEntityNotFound(_0x5c6e2f,null))['then'](function(_0x36064b){if(_0x36064b){_0x442da1[_0x0b5c('0x6e')]=_0x36064b[_0x0b5c('0x67')]({'plain':!![]});interaction_log[_0x0b5c('0x27')](_0x0b5c('0x80'),_0x180cc4[_0x0b5c('0x6d')]['id'],_0x180cc4[_0x0b5c('0x6d')][_0x0b5c('0x40')],_0x180cc4[_0x0b5c('0x6d')][_0x0b5c('0x81')],_0x442da1[_0x0b5c('0x6e')]['id'],_0x180cc4[_0x0b5c('0x5f')]?JSON['stringify'](_0x180cc4[_0x0b5c('0x5f')]):_0x0b5c('0x6f'));return respondWithRpcPromise(_0x0b5c('0x82'),'rejectMessage',_0x442da1);}return null;})[_0x0b5c('0x26')](function(_0x45c794){var _0x2d00f2=_0x0b5c('0x72')+_0x45c794[_0x0b5c('0x2f')]['ContactId'];return db[_0x0b5c('0x83')][_0x0b5c('0x49')](_0x2d00f2,{'type':db[_0x0b5c('0x73')][_0x0b5c('0x84')][_0x0b5c('0x74')],'raw':!![]})[_0x0b5c('0x26')](function(_0x2eab88){return _0x2eab88;});})[_0x0b5c('0x26')](function(_0x4eb03d){if(_0x4eb03d){_0x442da1[_0x0b5c('0x2f')][_0x0b5c('0x85')]=_0x4eb03d[0x0];if(!_0x180cc4['body'][_0x0b5c('0x66')])return;return db[_0x0b5c('0x75')][_0x0b5c('0x5d')]({'where':{'id':_0x180cc4[_0x0b5c('0x5f')]['UserId'],'role':'agent'},'attributes':['id',_0x0b5c('0x40'),_0x0b5c('0x76'),'email',_0x0b5c('0x78')],'raw':!![]});}return null;})[_0x0b5c('0x26')](function(_0x3386ab){if(!_0x3386ab)return null;_0x442da1[_0x0b5c('0x2f')][_0x0b5c('0x7f')]=_0x3386ab;return _0x442da1;})['then'](function(_0x547562){if(_0x547562){_0x547562[_0x0b5c('0x2f')]['interface']=util[_0x0b5c('0x64')]('SIP/%s',_0x180cc4[_0x0b5c('0x6d')]['name']);_0x547562[_0x0b5c('0x2f')][_0x0b5c('0x86')]=_0x442da1['channel'];_0x547562[_0x0b5c('0x2f')][_0x0b5c('0x7a')]=_0x442da1[_0x0b5c('0x86')];_0x547562[_0x0b5c('0x2f')]['event']=_0x0b5c('0x7e');respondWithRpcPromise(_0x0b5c('0x7c'),_0x0b5c('0x7c'),{'event':_0x0b5c('0x87'),'message':_0x547562[_0x0b5c('0x2f')]},client9002);return _0x442da1;}return null;})[_0x0b5c('0x26')](respondWithResult(_0x5c6e2f,null))[_0x0b5c('0x31')](handleError(_0x5c6e2f,null));};exports[_0x0b5c('0x88')]=function(_0x26da11,_0x1aae12){var _0x1ff6ab;return db[_0x0b5c('0x44')][_0x0b5c('0x88')](_0x26da11['body'],{})[_0x0b5c('0x26')](function(_0x436635){_0x1ff6ab=_0x436635;return db[_0x0b5c('0x89')][_0x0b5c('0x8a')]({'where':{'id':_0x1ff6ab[_0x0b5c('0x8b')]}});})[_0x0b5c('0x26')](function(_0x325c78){if(_['isNil'](_0x325c78)){return;}else{_0x1ff6ab['fax']=_0x325c78['fax'];return db[_0x0b5c('0x8c')][_0x0b5c('0x8a')]({'where':{'id':_0x1ff6ab['AttachmentId']}});}})[_0x0b5c('0x26')](function(_0x1d48b9){return respondWithRpcPromise('SendFax',_0x0b5c('0x8d'),{'FaxAccountId':_[_0x0b5c('0x6a')](_0x26da11[_0x0b5c('0x5f')])?undefined:_0x26da11[_0x0b5c('0x5f')][_0x0b5c('0x8e')],'path':_[_0x0b5c('0x6a')](_0x1d48b9)?undefined:util['format'](_0x0b5c('0x8f'),_0x1d48b9['basename']),'fax':_[_0x0b5c('0x6a')](_0x1ff6ab[_0x0b5c('0x62')])?undefined:_0x1ff6ab[_0x0b5c('0x62')],'AttachmentId':_0x1ff6ab[_0x0b5c('0x90')]},client9002);})[_0x0b5c('0x26')](respondWithResult(_0x1aae12,0xc9))[_0x0b5c('0x31')](handleError(_0x1aae12,null));};exports['download']=function(_0xbecf06,_0x136e3d){var _0x832e58=path[_0x0b5c('0x91')](config[_0x0b5c('0x92')],_0x0b5c('0x93'),_0x0b5c('0x94'),_0x0b5c('0x95'));return db[_0x0b5c('0x44')]['find']({'where':{'id':_0xbecf06[_0x0b5c('0x5a')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x0b5c('0x26')](handleEntityNotFound(_0x136e3d,null))[_0x0b5c('0x26')](function(_0x1da94e){if(_0x1da94e){return _0x136e3d[_0x0b5c('0x96')](path[_0x0b5c('0x91')](_0x832e58,_0x1da94e[_0x0b5c('0x8c')][_0x0b5c('0x97')]));}})[_0x0b5c('0x31')](handleError(_0x136e3d,null));}; \ No newline at end of file +var _0xc1b6=['stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','FaxMessage','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','rawAttributes','options','find','body','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','isNil','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','join','root','server','files','attachments','download','Attachment','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug'];(function(_0x3a335a,_0x401d39){var _0x512716=function(_0x31f358){while(--_0x31f358){_0x3a335a['push'](_0x3a335a['shift']());}};_0x512716(++_0x401d39);}(_0xc1b6,0x183));var _0x6c1b=function(_0x4eeece,_0x5d0f4c){_0x4eeece=_0x4eeece-0x0;var _0xc5062e=_0xc1b6[_0x4eeece];return _0xc5062e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c1b('0x0'));var zipdir=require(_0x6c1b('0x1'));var jsonpatch=require(_0x6c1b('0x2'));var rp=require(_0x6c1b('0x3'));var moment=require(_0x6c1b('0x4'));var BPromise=require(_0x6c1b('0x5'));var Mustache=require(_0x6c1b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c1b('0x7'));var csv=require(_0x6c1b('0x8'));var ejs=require(_0x6c1b('0x9'));var fs=require('fs');var fs_extra=require(_0x6c1b('0xa'));var _=require(_0x6c1b('0xb'));var squel=require(_0x6c1b('0xc'));var crypto=require(_0x6c1b('0xd'));var jsforce=require(_0x6c1b('0xe'));var deskjs=require(_0x6c1b('0xf'));var toCsv=require(_0x6c1b('0x8'));var querystring=require(_0x6c1b('0x10'));var Papa=require(_0x6c1b('0x11'));var Redis=require(_0x6c1b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c1b('0x13'));var as=require(_0x6c1b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c1b('0x15'))(_0x6c1b('0x16'));var utils=require(_0x6c1b('0x17'));var config=require(_0x6c1b('0x18'));var licenseUtil=require(_0x6c1b('0x19'));var db=require(_0x6c1b('0x1a'))['db'];config[_0x6c1b('0x1b')]=_[_0x6c1b('0x1c')](config[_0x6c1b('0x1b')],{'host':_0x6c1b('0x1d'),'port':0x18eb});var socket=require(_0x6c1b('0x1e'))(new Redis(config[_0x6c1b('0x1b')]));require('./faxMessage.socket')[_0x6c1b('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6c1b('0x20')][_0x6c1b('0x21')]({'port':0x232c});var client9002=jayson[_0x6c1b('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250b8c,_0x102d3b,_0x2a6b37,_0x2ab498){return new BPromise(function(_0x3dbcb7,_0x25d9cb){var _0x522cb0=_0x2ab498||client;return _0x522cb0[_0x6c1b('0x22')](_0x250b8c,_0x2a6b37)[_0x6c1b('0x23')](function(_0x598050){logger[_0x6c1b('0x24')]('FaxMessage,\x20%s,\x20%s',_0x102d3b,_0x6c1b('0x25'));logger[_0x6c1b('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x102d3b,_0x6c1b('0x25'),JSON[_0x6c1b('0x27')](_0x598050));if(_0x598050[_0x6c1b('0x28')]){if(_0x598050['error']['code']===0x1f4){logger[_0x6c1b('0x28')](_0x6c1b('0x29'),_0x102d3b,_0x598050[_0x6c1b('0x28')][_0x6c1b('0x2a')]);return _0x25d9cb(_0x598050[_0x6c1b('0x28')][_0x6c1b('0x2a')]);}logger[_0x6c1b('0x28')](_0x6c1b('0x29'),_0x102d3b,_0x598050[_0x6c1b('0x28')][_0x6c1b('0x2a')]);return _0x3dbcb7(_0x598050['error'][_0x6c1b('0x2a')]);}else{logger[_0x6c1b('0x24')](_0x6c1b('0x29'),_0x102d3b,'request\x20sent');_0x3dbcb7(_0x598050[_0x6c1b('0x2b')][_0x6c1b('0x2a')]);}})[_0x6c1b('0x2c')](function(_0x276f08){logger[_0x6c1b('0x28')](_0x6c1b('0x29'),_0x102d3b,_0x276f08);_0x25d9cb(_0x276f08);});});}function respondWithStatusCode(_0x1ed7f5,_0x3146f5){_0x3146f5=_0x3146f5||0xcc;return function(_0x302b74){if(_0x302b74){return _0x1ed7f5[_0x6c1b('0x2d')](_0x3146f5);}return _0x1ed7f5[_0x6c1b('0x2e')](_0x3146f5)[_0x6c1b('0x2f')]();};}function respondWithResult(_0x5e89c4,_0x222ae7){_0x222ae7=_0x222ae7||0xc8;return function(_0x3139db){if(_0x3139db){return _0x5e89c4[_0x6c1b('0x2e')](_0x222ae7)[_0x6c1b('0x30')](_0x3139db);}};}function respondWithFilteredResult(_0x3564ca,_0x5b4caf){return function(_0x26627d){if(_0x26627d){var _0x7070b4=typeof _0x5b4caf[_0x6c1b('0x31')]===_0x6c1b('0x32')&&typeof _0x5b4caf['limit']===_0x6c1b('0x32');var _0x483aba=_0x26627d[_0x6c1b('0x33')];var _0x1dd282=_0x7070b4?0x0:_0x5b4caf[_0x6c1b('0x31')];var _0x2f3785=_0x7070b4?_0x26627d[_0x6c1b('0x33')]:_0x5b4caf['offset']+_0x5b4caf['limit'];var _0x311249;if(_0x2f3785>=_0x483aba){_0x2f3785=_0x483aba;_0x311249=0xc8;}else{_0x311249=0xce;}_0x3564ca[_0x6c1b('0x2e')](_0x311249);return _0x3564ca['set'](_0x6c1b('0x34'),_0x1dd282+'-'+_0x2f3785+'/'+_0x483aba)[_0x6c1b('0x30')](_0x26627d);}return null;};}function patchUpdates(_0x5cd5fa){return function(_0x1f08d8){try{jsonpatch[_0x6c1b('0x35')](_0x1f08d8,_0x5cd5fa,!![]);}catch(_0xac2701){return BPromise[_0x6c1b('0x36')](_0xac2701);}return _0x1f08d8[_0x6c1b('0x37')]();};}function saveUpdates(_0x3adb23,_0xa6e1c9){return function(_0x3f745c){if(_0x3f745c){return _0x3f745c[_0x6c1b('0x38')](_0x3adb23)[_0x6c1b('0x23')](function(_0x4466dc){return _0x4466dc;});}return null;};}function removeEntity(_0x3c06aa,_0x174dda){return function(_0x41b6f1){if(_0x41b6f1){return _0x41b6f1[_0x6c1b('0x39')]()['then'](function(){_0x3c06aa[_0x6c1b('0x2e')](0xcc)[_0x6c1b('0x2f')]();});}};}function handleEntityNotFound(_0x48dc7b,_0x4294f6){return function(_0x1f07c0){if(!_0x1f07c0){_0x48dc7b[_0x6c1b('0x2d')](0x194);}return _0x1f07c0;};}function handleError(_0x4ed32e,_0x11275d){_0x11275d=_0x11275d||0x1f4;return function(_0xcc2f78){logger[_0x6c1b('0x28')](_0xcc2f78[_0x6c1b('0x3a')]);if(_0xcc2f78[_0x6c1b('0x3b')]){delete _0xcc2f78[_0x6c1b('0x3b')];}_0x4ed32e[_0x6c1b('0x2e')](_0x11275d)[_0x6c1b('0x3c')](_0xcc2f78);};}exports['index']=function(_0x427094,_0x10905e){var _0xcfd9a2={},_0x33279e={},_0x2e966c={'count':0x0,'rows':[]};var _0x29667a=_[_0x6c1b('0x3d')](db[_0x6c1b('0x3e')]['rawAttributes'],function(_0x3205af){return{'name':_0x3205af['fieldName'],'type':_0x3205af[_0x6c1b('0x3f')][_0x6c1b('0x40')]};});_0x33279e['model']=_['map'](_0x29667a,_0x6c1b('0x3b'));_0x33279e[_0x6c1b('0x41')]=_[_0x6c1b('0x42')](_0x427094[_0x6c1b('0x41')]);_0x33279e[_0x6c1b('0x43')]=_[_0x6c1b('0x44')](_0x33279e['model'],_0x33279e[_0x6c1b('0x41')]);_0xcfd9a2[_0x6c1b('0x45')]=_['intersection'](_0x33279e[_0x6c1b('0x46')],qs[_0x6c1b('0x47')](_0x427094[_0x6c1b('0x41')]['fields']));_0xcfd9a2['attributes']=_0xcfd9a2['attributes'][_0x6c1b('0x48')]?_0xcfd9a2[_0x6c1b('0x45')]:_0x33279e[_0x6c1b('0x46')];if(!_0x427094['query']['hasOwnProperty'](_0x6c1b('0x49'))){_0xcfd9a2['limit']=qs['limit'](_0x427094[_0x6c1b('0x41')][_0x6c1b('0x4a')]);_0xcfd9a2[_0x6c1b('0x31')]=qs[_0x6c1b('0x31')](_0x427094[_0x6c1b('0x41')]['offset']);}_0xcfd9a2['order']=qs[_0x6c1b('0x4b')](_0x427094[_0x6c1b('0x41')][_0x6c1b('0x4b')]);_0xcfd9a2[_0x6c1b('0x4c')]=qs[_0x6c1b('0x43')](_['pick'](_0x427094[_0x6c1b('0x41')],_0x33279e[_0x6c1b('0x43')]),_0x29667a);if(_0x427094[_0x6c1b('0x41')][_0x6c1b('0x4d')]){_0xcfd9a2['where']=_['merge'](_0xcfd9a2[_0x6c1b('0x4c')],{'$or':_[_0x6c1b('0x3d')](_0x29667a,function(_0x585257){if(_0x585257[_0x6c1b('0x3f')]!==_0x6c1b('0x4e')){var _0x44f31d={};_0x44f31d[_0x585257['name']]={'$like':'%'+_0x427094['query'][_0x6c1b('0x4d')]+'%'};return _0x44f31d;}})});}_0xcfd9a2=_[_0x6c1b('0x4f')]({},_0xcfd9a2,_0x427094['options']);var _0x43775c={'where':_0xcfd9a2['where']};return db[_0x6c1b('0x3e')]['count'](_0x43775c)['then'](function(_0x5c9216){_0x2e966c[_0x6c1b('0x33')]=_0x5c9216;if(_0x427094['query'][_0x6c1b('0x50')]){_0xcfd9a2[_0x6c1b('0x51')]=[{'all':!![]}];}return db[_0x6c1b('0x3e')][_0x6c1b('0x52')](_0xcfd9a2);})['then'](function(_0x1aaeb8){_0x2e966c[_0x6c1b('0x53')]=_0x1aaeb8;return _0x2e966c;})['then'](respondWithFilteredResult(_0x10905e,_0xcfd9a2))[_0x6c1b('0x2c')](handleError(_0x10905e,null));};exports['show']=function(_0x2460f3,_0x149a86){var _0x56032a={'raw':!![],'where':{'id':_0x2460f3[_0x6c1b('0x54')]['id']}},_0x46a26a={};_0x46a26a[_0x6c1b('0x46')]=_[_0x6c1b('0x42')](db[_0x6c1b('0x3e')][_0x6c1b('0x55')]);_0x46a26a[_0x6c1b('0x41')]=_[_0x6c1b('0x42')](_0x2460f3[_0x6c1b('0x41')]);_0x46a26a[_0x6c1b('0x43')]=_['intersection'](_0x46a26a[_0x6c1b('0x46')],_0x46a26a[_0x6c1b('0x41')]);_0x56032a[_0x6c1b('0x45')]=_[_0x6c1b('0x44')](_0x46a26a[_0x6c1b('0x46')],qs['fields'](_0x2460f3['query'][_0x6c1b('0x47')]));_0x56032a[_0x6c1b('0x45')]=_0x56032a['attributes'][_0x6c1b('0x48')]?_0x56032a[_0x6c1b('0x45')]:_0x46a26a[_0x6c1b('0x46')];if(_0x2460f3[_0x6c1b('0x41')][_0x6c1b('0x50')]){_0x56032a['include']=[{'all':!![]}];}_0x56032a=_[_0x6c1b('0x4f')]({},_0x56032a,_0x2460f3[_0x6c1b('0x56')]);return db[_0x6c1b('0x3e')][_0x6c1b('0x57')](_0x56032a)[_0x6c1b('0x23')](handleEntityNotFound(_0x149a86,null))['then'](respondWithResult(_0x149a86,null))[_0x6c1b('0x2c')](handleError(_0x149a86,null));};exports[_0x6c1b('0x38')]=function(_0xca3c55,_0x2d3c33){if(_0xca3c55[_0x6c1b('0x58')]['id']){delete _0xca3c55['body']['id'];}return db[_0x6c1b('0x3e')][_0x6c1b('0x57')]({'where':{'id':_0xca3c55[_0x6c1b('0x54')]['id']}})['then'](handleEntityNotFound(_0x2d3c33,null))[_0x6c1b('0x23')](saveUpdates(_0xca3c55[_0x6c1b('0x58')],null))['then'](respondWithResult(_0x2d3c33,null))[_0x6c1b('0x2c')](handleError(_0x2d3c33,null));};exports[_0x6c1b('0x39')]=function(_0x420aa2,_0x5ede03){return db[_0x6c1b('0x3e')][_0x6c1b('0x57')]({'where':{'id':_0x420aa2[_0x6c1b('0x54')]['id']}})[_0x6c1b('0x23')](handleEntityNotFound(_0x5ede03,null))[_0x6c1b('0x23')](removeEntity(_0x5ede03,null))['catch'](handleError(_0x5ede03,null));};exports['describe']=function(_0x659bc1,_0x369f59){return db[_0x6c1b('0x3e')]['describe']()[_0x6c1b('0x23')](respondWithResult(_0x369f59,null))[_0x6c1b('0x2c')](handleError(_0x369f59,null));};var interaction_log=require('../../config/logger')(_0x6c1b('0x59'));exports[_0x6c1b('0x5a')]=function(_0x90cfe7,_0x8684ba,_0x13014e){var _0x184f18={'agent':{},'channel':_0x6c1b('0x5b')};if(_0x90cfe7[_0x6c1b('0x58')]['id']){delete _0x90cfe7[_0x6c1b('0x58')]['id'];}_0x90cfe7[_0x6c1b('0x58')][_0x6c1b('0x5c')]=!![];_0x90cfe7[_0x6c1b('0x58')][_0x6c1b('0x5d')]=moment()[_0x6c1b('0x5e')](_0x6c1b('0x5f'));_0x90cfe7[_0x6c1b('0x58')][_0x6c1b('0x60')]=_0x90cfe7[_0x6c1b('0x58')]['UserId']||_0x90cfe7[_0x6c1b('0x61')]['id'];_0x184f18['agent']['id']=_0x90cfe7[_0x6c1b('0x58')][_0x6c1b('0x60')];return db['FaxMessage'][_0x6c1b('0x57')]({'where':{'id':_0x90cfe7[_0x6c1b('0x54')]['id'],'UserId':null}})[_0x6c1b('0x23')](handleEntityNotFound(_0x8684ba,null))[_0x6c1b('0x23')](saveUpdates(_0x90cfe7[_0x6c1b('0x58')],null))[_0x6c1b('0x23')](function(_0xc84a63){if(_0xc84a63){_0x184f18[_0x6c1b('0x2a')]=_0xc84a63[_0x6c1b('0x62')]({'plain':!![]});return db[_0x6c1b('0x63')][_0x6c1b('0x57')]({'where':{'id':_0xc84a63['FaxInteractionId']}});}return null;})[_0x6c1b('0x23')](handleEntityNotFound(_0x8684ba,null))['then'](function(_0x15e191){if(_0x15e191){return _0x15e191[_0x6c1b('0x38')]({'UserId':_0x90cfe7['body'][_0x6c1b('0x60')],'read1stAt':_[_0x6c1b('0x64')](_0x15e191['read1stAt'])?moment()[_0x6c1b('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1e388a){if(_0x1e388a){_0x184f18[_0x6c1b('0x65')]=_0x1e388a[_0x6c1b('0x62')]({'plain':!![]});interaction_log[_0x6c1b('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x90cfe7[_0x6c1b('0x61')]['id'],_0x90cfe7[_0x6c1b('0x61')][_0x6c1b('0x3b')],_0x90cfe7[_0x6c1b('0x61')][_0x6c1b('0x66')],_0x184f18['interaction']['id'],_0x90cfe7['body']?JSON[_0x6c1b('0x27')](_0x90cfe7[_0x6c1b('0x58')]):_0x6c1b('0x67'));return respondWithRpcPromise(_0x6c1b('0x68'),_0x6c1b('0x69'),_0x184f18);}return null;})[_0x6c1b('0x23')](function(_0x142322){var _0x7e4fe6=_0x6c1b('0x6a')+_0x142322[_0x6c1b('0x2a')][_0x6c1b('0x6b')];return db[_0x6c1b('0x6c')][_0x6c1b('0x41')](_0x7e4fe6,{'type':db[_0x6c1b('0x6d')][_0x6c1b('0x6e')][_0x6c1b('0x6f')],'raw':!![]})[_0x6c1b('0x23')](function(_0x4834fa){return _0x4834fa;});})[_0x6c1b('0x23')](function(_0x59404f){if(_0x59404f){_0x184f18[_0x6c1b('0x2a')][_0x6c1b('0x70')]=_0x59404f[0x0];if(!_0x90cfe7[_0x6c1b('0x58')][_0x6c1b('0x60')])return;return db[_0x6c1b('0x71')][_0x6c1b('0x57')]({'where':{'id':_0x90cfe7[_0x6c1b('0x58')]['UserId'],'role':_0x6c1b('0x72')},'attributes':['id','name',_0x6c1b('0x73'),_0x6c1b('0x74'),_0x6c1b('0x75')],'raw':!![]});}return null;})[_0x6c1b('0x23')](function(_0x2c8fcb){if(!_0x2c8fcb)return null;_0x184f18[_0x6c1b('0x2a')][_0x6c1b('0x72')]=_0x2c8fcb;return _0x184f18;})[_0x6c1b('0x23')](function(_0xa4c18f){if(_0xa4c18f){if(_0x90cfe7[_0x6c1b('0x58')]['manual']){_0x184f18['message'][_0x6c1b('0x76')]=util['format'](_0x6c1b('0x77'),_0x90cfe7['user'][_0x6c1b('0x3b')]);_0x184f18[_0x6c1b('0x2a')][_0x6c1b('0x78')]=_0x184f18[_0x6c1b('0x78')];_0x184f18[_0x6c1b('0x2a')][_0x6c1b('0x79')]=_0x184f18[_0x6c1b('0x78')];_0x184f18[_0x6c1b('0x2a')][_0x6c1b('0x7a')]=_0x6c1b('0x5a');return respondWithRpcPromise(_0x6c1b('0x7b'),_0x6c1b('0x7b'),{'event':'acceptmessage','message':_0x184f18[_0x6c1b('0x2a')]},client9002)['then'](function(){return _0x184f18;});}return _0x184f18;}return null;})['then'](respondWithResult(_0x8684ba,null))['catch'](handleError(_0x8684ba,null));};var interaction_log=require(_0x6c1b('0x15'))(_0x6c1b('0x59'));exports['reject']=function(_0x526a4a,_0x1eeaa2,_0x3090ab){var _0x46d196={'agent':{},'channel':_0x6c1b('0x5b')};if(_0x526a4a['body']['id']){delete _0x526a4a['body']['id'];}_0x526a4a[_0x6c1b('0x58')][_0x6c1b('0x60')]=_0x526a4a['body'][_0x6c1b('0x60')]||_0x526a4a[_0x6c1b('0x61')]['id'];_0x46d196[_0x6c1b('0x72')]['id']=_0x526a4a['body'][_0x6c1b('0x60')];return db[_0x6c1b('0x3e')][_0x6c1b('0x57')]({'where':{'id':_0x526a4a['params']['id'],'UserId':null}})[_0x6c1b('0x23')](handleEntityNotFound(_0x1eeaa2,null))['then'](function(_0x5ba119){if(_0x5ba119){_0x46d196[_0x6c1b('0x2a')]=_0x5ba119[_0x6c1b('0x62')]({'plain':!![]});return db[_0x6c1b('0x63')][_0x6c1b('0x57')]({'where':{'id':_0x5ba119[_0x6c1b('0x7c')]}});}return null;})[_0x6c1b('0x23')](handleEntityNotFound(_0x1eeaa2,null))[_0x6c1b('0x23')](function(_0x314adb){if(_0x314adb){_0x46d196[_0x6c1b('0x65')]=_0x314adb[_0x6c1b('0x62')]({'plain':!![]});interaction_log[_0x6c1b('0x24')](_0x6c1b('0x7d'),_0x526a4a[_0x6c1b('0x61')]['id'],_0x526a4a['user'][_0x6c1b('0x3b')],_0x526a4a['user'][_0x6c1b('0x66')],_0x46d196[_0x6c1b('0x65')]['id'],_0x526a4a[_0x6c1b('0x58')]?JSON[_0x6c1b('0x27')](_0x526a4a[_0x6c1b('0x58')]):'null');return respondWithRpcPromise(_0x6c1b('0x7e'),_0x6c1b('0x7f'),_0x46d196);}return null;})[_0x6c1b('0x23')](function(_0xeb7bfd){var _0x161bd6=_0x6c1b('0x6a')+_0xeb7bfd['message'][_0x6c1b('0x6b')];return db[_0x6c1b('0x6c')]['query'](_0x161bd6,{'type':db[_0x6c1b('0x6d')][_0x6c1b('0x6e')][_0x6c1b('0x6f')],'raw':!![]})[_0x6c1b('0x23')](function(_0x1a6c35){return _0x1a6c35;});})[_0x6c1b('0x23')](function(_0xa9ed5b){if(_0xa9ed5b){_0x46d196[_0x6c1b('0x2a')][_0x6c1b('0x70')]=_0xa9ed5b[0x0];if(!_0x526a4a[_0x6c1b('0x58')]['UserId'])return;return db[_0x6c1b('0x71')][_0x6c1b('0x57')]({'where':{'id':_0x526a4a['body'][_0x6c1b('0x60')],'role':_0x6c1b('0x72')},'attributes':['id',_0x6c1b('0x3b'),_0x6c1b('0x73'),_0x6c1b('0x74'),_0x6c1b('0x75')],'raw':!![]});}return null;})[_0x6c1b('0x23')](function(_0x21b1f2){if(!_0x21b1f2)return null;_0x46d196[_0x6c1b('0x2a')][_0x6c1b('0x72')]=_0x21b1f2;return _0x46d196;})[_0x6c1b('0x23')](function(_0x18ecab){if(_0x18ecab){_0x18ecab[_0x6c1b('0x2a')][_0x6c1b('0x76')]=util[_0x6c1b('0x5e')]('SIP/%s',_0x526a4a[_0x6c1b('0x61')][_0x6c1b('0x3b')]);_0x18ecab[_0x6c1b('0x2a')][_0x6c1b('0x78')]=_0x46d196[_0x6c1b('0x78')];_0x18ecab['message'][_0x6c1b('0x79')]=_0x46d196[_0x6c1b('0x78')];_0x18ecab[_0x6c1b('0x2a')]['event']=_0x6c1b('0x36');respondWithRpcPromise(_0x6c1b('0x7b'),_0x6c1b('0x7b'),{'event':_0x6c1b('0x80'),'message':_0x18ecab[_0x6c1b('0x2a')]},client9002);return _0x46d196;}return null;})[_0x6c1b('0x23')](respondWithResult(_0x1eeaa2,null))[_0x6c1b('0x2c')](handleError(_0x1eeaa2,null));};exports['create']=function(_0x152602,_0x59bde1){var _0x37169c;return db[_0x6c1b('0x3e')][_0x6c1b('0x81')](_0x152602['body'],{})[_0x6c1b('0x23')](function(_0x48fa25){_0x37169c=_0x48fa25;return db[_0x6c1b('0x82')]['findOne']({'where':{'id':_0x37169c['ContactId']}});})['then'](function(_0x4e531f){if(_['isNil'](_0x4e531f)){return;}else{_0x37169c[_0x6c1b('0x5b')]=_0x4e531f[_0x6c1b('0x5b')];return db['Attachment'][_0x6c1b('0x83')]({'where':{'id':_0x37169c[_0x6c1b('0x84')]}});}})[_0x6c1b('0x23')](function(_0x357d42){return respondWithRpcPromise('SendFax',_0x6c1b('0x85'),{'FaxAccountId':_[_0x6c1b('0x64')](_0x152602[_0x6c1b('0x58')])?undefined:_0x152602[_0x6c1b('0x58')][_0x6c1b('0x86')],'path':_['isNil'](_0x357d42)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x357d42['basename']),'fax':_[_0x6c1b('0x64')](_0x37169c[_0x6c1b('0x5b')])?undefined:_0x37169c[_0x6c1b('0x5b')],'AttachmentId':_0x37169c[_0x6c1b('0x84')]},client9002);})[_0x6c1b('0x23')](respondWithResult(_0x59bde1,0xc9))[_0x6c1b('0x2c')](handleError(_0x59bde1,null));};exports['download']=function(_0x55797d,_0x4b8063){var _0x287bc6=path[_0x6c1b('0x87')](config[_0x6c1b('0x88')],_0x6c1b('0x89'),_0x6c1b('0x8a'),_0x6c1b('0x8b'));return db[_0x6c1b('0x3e')][_0x6c1b('0x57')]({'where':{'id':_0x55797d[_0x6c1b('0x54')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x6c1b('0x23')](handleEntityNotFound(_0x4b8063,null))[_0x6c1b('0x23')](function(_0x4bb724){if(_0x4bb724){return _0x4b8063[_0x6c1b('0x8c')](path[_0x6c1b('0x87')](_0x287bc6,_0x4bb724[_0x6c1b('0x8d')]['basename']));}})[_0x6c1b('0x2c')](handleError(_0x4b8063,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ad9e792..2b461d8 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 _0x7fd6=['FaxMessage','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0xcb74e4,_0x478662){var _0x39b9f3=function(_0x50e7a3){while(--_0x50e7a3){_0xcb74e4['push'](_0xcb74e4['shift']());}};_0x39b9f3(++_0x478662);}(_0x7fd6,0x157));var _0x67fd=function(_0x1fbbda,_0x3049d7){_0x1fbbda=_0x1fbbda-0x0;var _0x55d989=_0x7fd6[_0x1fbbda];return _0x55d989;};'use strict';var EventEmitter=require(_0x67fd('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x67fd('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x67fd('0x2')](0x0);var events={'afterCreate':_0x67fd('0x3'),'afterUpdate':_0x67fd('0x4'),'afterDestroy':_0x67fd('0x5')};function emitEvent(_0xbdd0c0){return function(_0x4f52bc,_0x187f3e,_0x50238d){FaxMessageEvents['emit'](_0xbdd0c0+':'+_0x4f52bc['id'],_0x4f52bc);FaxMessageEvents['emit'](_0xbdd0c0,_0x4f52bc);_0x50238d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x67fd('0x6')](e,emitEvent(event));}}module[_0x67fd('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x2525=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2575cd,_0x570e95){var _0x52c789=function(_0x5e50c6){while(--_0x5e50c6){_0x2575cd['push'](_0x2575cd['shift']());}};_0x52c789(++_0x570e95);}(_0x2525,0x1f0));var _0x5252=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2525[_0x376b45];return _0x2341b3;};'use strict';var EventEmitter=require(_0x5252('0x0'));var FaxMessage=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){FaxMessageEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);FaxMessageEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];FaxMessage[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 1630af6..62ec230 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 _0x468c=['FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x561f69,_0x1a6fd1){var _0x564eca=function(_0x4e37b1){while(--_0x4e37b1){_0x561f69['push'](_0x561f69['shift']());}};_0x564eca(++_0x1a6fd1);}(_0x468c,0x127));var _0xc468=function(_0x16ddd7,_0x382221){_0x16ddd7=_0x16ddd7-0x0;var _0x7b63d4=_0x468c[_0x16ddd7];return _0x7b63d4;};'use strict';var _=require(_0xc468('0x0'));var util=require(_0xc468('0x1'));var logger=require(_0xc468('0x2'))(_0xc468('0x3'));var moment=require(_0xc468('0x4'));var BPromise=require(_0xc468('0x5'));var rp=require(_0xc468('0x6'));var fs=require('fs');var path=require(_0xc468('0x7'));var rimraf=require(_0xc468('0x8'));var config=require(_0xc468('0x9'));var attributes=require(_0xc468('0xa'));module[_0xc468('0xb')]=function(_0x56243b,_0x57839c){return _0x56243b['define'](_0xc468('0xc'),attributes,{'tableName':_0xc468('0xd'),'paranoid':![],'indexes':[{'name':_0xc468('0xe'),'fields':[_0xc468('0xf')],'type':_0xc468('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33db27,_0x3a4f1f,_0x3703a3){var _0x54488e=_0x56243b['models'];var _0x35142e=_0x33db27[_0xc468('0x11')]({'plain':!![]});if(_0x35142e[_0xc468('0x12')]['toLowerCase']()==='in'||_0x35142e[_0xc468('0x12')][_0xc468('0x13')]()===_0xc468('0x14')&&!_0x35142e[_0xc468('0x15')]&&!_[_0xc468('0x16')](_0x35142e[_0xc468('0x17')])){_0x54488e['FaxInteraction'][_0xc468('0x18')]({'where':{'id':_0x35142e[_0xc468('0x19')]}})[_0xc468('0x1a')](function(_0x342c7a){if(_0x342c7a){_0x342c7a[_0xc468('0x1b')]({'lastMsgAt':_0x35142e['createdAt'],'lastMsgDirection':_0x35142e[_0xc468('0x12')][_0xc468('0x13')]()});}})[_0xc468('0x1c')](function(_0x1a98ed){console[_0xc468('0x1d')](_0x1a98ed);});}_0x3703a3();}},'charset':_0xc468('0x1e'),'collate':_0xc468('0x1f')});}; \ No newline at end of file +var _0x33c2=['direction','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','createdAt'];(function(_0x4bfedd,_0xddfbf8){var _0x2e925c=function(_0x3937da){while(--_0x3937da){_0x4bfedd['push'](_0x4bfedd['shift']());}};_0x2e925c(++_0xddfbf8);}(_0x33c2,0x7f));var _0x233c=function(_0x2f8a7c,_0x3f65fd){_0x2f8a7c=_0x2f8a7c-0x0;var _0x257e01=_0x33c2[_0x2f8a7c];return _0x257e01;};'use strict';var _=require(_0x233c('0x0'));var util=require(_0x233c('0x1'));var logger=require(_0x233c('0x2'))(_0x233c('0x3'));var moment=require(_0x233c('0x4'));var BPromise=require(_0x233c('0x5'));var rp=require(_0x233c('0x6'));var fs=require('fs');var path=require(_0x233c('0x7'));var rimraf=require(_0x233c('0x8'));var config=require(_0x233c('0x9'));var attributes=require(_0x233c('0xa'));module[_0x233c('0xb')]=function(_0x5167b4,_0xefdf3){return _0x5167b4[_0x233c('0xc')](_0x233c('0xd'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x233c('0xe'),'fields':['body'],'type':_0x233c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x255989,_0x24fe16,_0x52f9af){var _0x5885de=_0x5167b4['models'];var _0x35e35e=_0x255989['get']({'plain':!![]});if(_0x35e35e['direction']['toLowerCase']()==='in'||_0x35e35e['direction']['toLowerCase']()==='out'&&!_0x35e35e[_0x233c('0x10')]&&!_[_0x233c('0x11')](_0x35e35e[_0x233c('0x12')])){_0x5885de[_0x233c('0x13')][_0x233c('0x14')]({'where':{'id':_0x35e35e[_0x233c('0x15')]}})['then'](function(_0x27cce6){if(_0x27cce6){_0x27cce6['update']({'lastMsgAt':_0x35e35e[_0x233c('0x16')],'lastMsgDirection':_0x35e35e[_0x233c('0x17')]['toLowerCase']()});}})['catch'](function(_0x1979ed){console['error'](_0x1979ed);});}_0x52f9af();}},'charset':_0x233c('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3bd483b..69e697f 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 _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x2b0fe2,_0x2ef9fa){var _0x3371e2=function(_0x353771){while(--_0x353771){_0x2b0fe2['push'](_0x2b0fe2['shift']());}};_0x3371e2(++_0x2ef9fa);}(_0xac9d,0x14d));var _0xdac9=function(_0x476c6c,_0x434db8){_0x476c6c=_0x476c6c-0x0;var _0xbb94db=_0xac9d[_0x476c6c];return _0xbb94db;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bae,0x13b));var _0xe7ba=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x7bae[_0x257642];return _0x3d813b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d5b8692..a7fa6c9 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 _0x87a7=['faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x146fa1,_0x92e55c){var _0x41217e=function(_0x4be890){while(--_0x4be890){_0x146fa1['push'](_0x146fa1['shift']());}};_0x41217e(++_0x92e55c);}(_0x87a7,0x151));var _0x787a=function(_0x49481d,_0xd95b74){_0x49481d=_0x49481d-0x0;var _0x27dd6e=_0x87a7[_0x49481d];return _0x27dd6e;};'use strict';var FaxMessageEvents=require(_0x787a('0x0'));var events=[_0x787a('0x1'),_0x787a('0x2'),_0x787a('0x3')];function createListener(_0xba229d,_0x126fbd){return function(_0x51b8aa){_0x126fbd[_0x787a('0x4')](_0xba229d,_0x51b8aa);};}function removeListener(_0x41c0c6,_0x25fc58){return function(){FaxMessageEvents['removeListener'](_0x41c0c6,_0x25fc58);};}exports['register']=function(_0x595c52){for(var _0x4e3819=0x0,_0x5b31b4=events['length'];_0x4e3819<_0x5b31b4;_0x4e3819++){var _0x65745c=events[_0x4e3819];var _0xa8da06=createListener(_0x787a('0x5')+_0x65745c,_0x595c52);FaxMessageEvents['on'](_0x65745c,_0xa8da06);}}; \ No newline at end of file +var _0x8f04=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x497d39,_0x168b9f){var _0x42d35=function(_0x396104){while(--_0x396104){_0x497d39['push'](_0x497d39['shift']());}};_0x42d35(++_0x168b9f);}(_0x8f04,0x75));var _0x48f0=function(_0x8db845,_0xb998ff){_0x8db845=_0x8db845-0x0;var _0x45546f=_0x8f04[_0x8db845];return _0x45546f;};'use strict';var FaxMessageEvents=require(_0x48f0('0x0'));var events=[_0x48f0('0x1'),_0x48f0('0x2'),'update'];function createListener(_0x29ed67,_0x22ea9b){return function(_0x3d5cfa){_0x22ea9b[_0x48f0('0x3')](_0x29ed67,_0x3d5cfa);};}function removeListener(_0x1c0151,_0x3afbef){return function(){FaxMessageEvents[_0x48f0('0x4')](_0x1c0151,_0x3afbef);};}exports[_0x48f0('0x5')]=function(_0x1318e3){for(var _0x27500c=0x0,_0x7c9054=events[_0x48f0('0x6')];_0x27500c<_0x7c9054;_0x27500c++){var _0xf18c3d=events[_0x27500c];var _0x14ed22=createListener(_0x48f0('0x7')+_0xf18c3d,_0x1318e3);FaxMessageEvents['on'](_0xf18c3d,_0x14ed22);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ecaaf34..40c2a94 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(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x0102,0x186));var _0x2010=function(_0x3b4038,_0x7ffba5){_0x3b4038=_0x3b4038-0x0;var _0x34d5a6=_0x0102[_0x3b4038];return _0x34d5a6;};'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 _0xeffd=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','tracked','fax','faxmessage:create','create','/:id','put','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x129d61,_0xe631ae){var _0x48aa96=function(_0x5ec48b){while(--_0x5ec48b){_0x129d61['push'](_0x129d61['shift']());}};_0x48aa96(++_0xe631ae);}(_0xeffd,0x6b));var _0xdeff=function(_0x97c243,_0x24bb0e){_0x97c243=_0x97c243-0x0;var _0x4a2025=_0xeffd[_0x97c243];return _0x4a2025;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var fs_extra=require(_0xdeff('0x5'));var auth=require(_0xdeff('0x6'));var interaction=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var controller=require(_0xdeff('0x9'));router[_0xdeff('0xa')]('/',auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xa')](_0xdeff('0xd'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xa')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0xf')]);router[_0xdeff('0xa')]('/:id/download',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);router[_0xdeff('0x11')]('/',auth[_0xdeff('0xb')](),interaction[_0xdeff('0x12')](_0xdeff('0x13'),_0xdeff('0x14')),controller[_0xdeff('0x15')]);router['put'](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller['update']);router[_0xdeff('0x17')]('/:id/accept',auth['isAuthenticated'](),controller[_0xdeff('0x18')]);router[_0xdeff('0x17')](_0xdeff('0x19'),auth[_0xdeff('0xb')](),controller['reject']);router[_0xdeff('0x1a')](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller[_0xdeff('0x1b')]);module[_0xdeff('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 452dc8f..ac115ac 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 _0x598a=['rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x293a24,_0x2406e6){var _0x23d1cf=function(_0x1130d4){while(--_0x1130d4){_0x293a24['push'](_0x293a24['shift']());}};_0x23d1cf(++_0x2406e6);}(_0x598a,0x1c9));var _0xa598=function(_0x488918,_0x1ae69d){_0x488918=_0x488918-0x0;var _0x223529=_0x598a[_0x488918];return _0x223529;};'use strict';var Sequelize=require(_0xa598('0x0'));module[_0xa598('0x1')]={'name':{'type':Sequelize[_0xa598('0x2')],'unique':_0xa598('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa598('0x2')]},'timeout':{'type':Sequelize[_0xa598('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa598('0x5'),_0xa598('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa598('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1622=['exports','STRING','name','INTEGER','rrmemory'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0x1622,0x18b));var _0x2162=function(_0x30a78e,_0x2f4fa9){_0x30a78e=_0x30a78e-0x0;var _0x1079bb=_0x1622[_0x30a78e];return _0x1079bb;};'use strict';var Sequelize=require('sequelize');module[_0x2162('0x0')]={'name':{'type':Sequelize[_0x2162('0x1')],'unique':_0x2162('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2162('0x1')]},'timeout':{'type':Sequelize[_0x2162('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2162('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2162('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 abfaa60..1229110 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 _0x6e88=['ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','merge','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','interface','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams'];(function(_0x5243ce,_0x31b461){var _0x2121f2=function(_0x1623d7){while(--_0x1623d7){_0x5243ce['push'](_0x5243ce['shift']());}};_0x2121f2(++_0x31b461);}(_0x6e88,0x1c0));var _0x86e8=function(_0x3a67d9,_0x504bbb){_0x3a67d9=_0x3a67d9-0x0;var _0x16e06a=_0x6e88[_0x3a67d9];return _0x16e06a;};'use strict';var emlformat=require(_0x86e8('0x0'));var rimraf=require(_0x86e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86e8('0x2'));var rp=require('request-promise');var moment=require(_0x86e8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x86e8('0x4'));var path=require(_0x86e8('0x5'));var sox=require(_0x86e8('0x6'));var csv=require('to-csv');var ejs=require(_0x86e8('0x7'));var fs=require('fs');var fs_extra=require(_0x86e8('0x8'));var _=require(_0x86e8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86e8('0xa'));var deskjs=require(_0x86e8('0xb'));var toCsv=require(_0x86e8('0xc'));var querystring=require('querystring');var Papa=require(_0x86e8('0xd'));var Redis=require(_0x86e8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x86e8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86e8('0x10'));var logger=require(_0x86e8('0x11'))(_0x86e8('0x12'));var utils=require('../../config/utils');var config=require(_0x86e8('0x13'));var licenseUtil=require(_0x86e8('0x14'));var db=require(_0x86e8('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x86e8('0x16'),'port':0x18eb});var socket=require(_0x86e8('0x17'))(new Redis(config[_0x86e8('0x18')]));require(_0x86e8('0x19'))['register'](socket);function respondWithStatusCode(_0x25a895,_0x3aaf5e){_0x3aaf5e=_0x3aaf5e||0xcc;return function(_0x39c087){if(_0x39c087){return _0x25a895[_0x86e8('0x1a')](_0x3aaf5e);}return _0x25a895[_0x86e8('0x1b')](_0x3aaf5e)[_0x86e8('0x1c')]();};}function respondWithResult(_0x201584,_0x332cc3){_0x332cc3=_0x332cc3||0xc8;return function(_0x3209e2){if(_0x3209e2){return _0x201584['status'](_0x332cc3)[_0x86e8('0x1d')](_0x3209e2);}};}function respondWithFilteredResult(_0x37df27,_0x205ba5){return function(_0x25117d){if(_0x25117d){var _0x3913de=typeof _0x205ba5[_0x86e8('0x1e')]===_0x86e8('0x1f')&&typeof _0x205ba5[_0x86e8('0x20')]==='undefined';var _0x260de2=_0x25117d['count'];var _0x59a363=_0x3913de?0x0:_0x205ba5[_0x86e8('0x1e')];var _0x20cd98=_0x3913de?_0x25117d['count']:_0x205ba5[_0x86e8('0x1e')]+_0x205ba5[_0x86e8('0x20')];var _0x4c1e17;if(_0x20cd98>=_0x260de2){_0x20cd98=_0x260de2;_0x4c1e17=0xc8;}else{_0x4c1e17=0xce;}_0x37df27[_0x86e8('0x1b')](_0x4c1e17);return _0x37df27['set'](_0x86e8('0x21'),_0x59a363+'-'+_0x20cd98+'/'+_0x260de2)['json'](_0x25117d);}return null;};}function patchUpdates(_0x3b786b){return function(_0x4db279){try{jsonpatch[_0x86e8('0x22')](_0x4db279,_0x3b786b,!![]);}catch(_0x3f541d){return BPromise[_0x86e8('0x23')](_0x3f541d);}return _0x4db279[_0x86e8('0x24')]();};}function saveUpdates(_0xeacad,_0x5eed79){return function(_0x44f3c3){if(_0x44f3c3){return _0x44f3c3[_0x86e8('0x25')](_0xeacad)[_0x86e8('0x26')](function(_0x5dbe6c){return _0x5dbe6c;});}return null;};}function removeEntity(_0x16458e,_0x3e7cd4){return function(_0x193a4f){if(_0x193a4f){return _0x193a4f['destroy']()[_0x86e8('0x26')](function(){var _0x290312=_0x193a4f[_0x86e8('0x27')]({'plain':!![]});var _0x24c68b=_0x86e8('0x28');return db[_0x86e8('0x29')][_0x86e8('0x2a')]({'where':{'type':_0x24c68b,'resourceId':_0x290312['id']}})[_0x86e8('0x26')](function(){return _0x193a4f;});})[_0x86e8('0x26')](function(){_0x16458e[_0x86e8('0x1b')](0xcc)[_0x86e8('0x1c')]();});}};}function handleEntityNotFound(_0x557b41,_0x17b122){return function(_0x44ef89){if(!_0x44ef89){_0x557b41[_0x86e8('0x1a')](0x194);}return _0x44ef89;};}function handleError(_0x3106e7,_0x24f2e9){_0x24f2e9=_0x24f2e9||0x1f4;return function(_0x3f2ee9){logger[_0x86e8('0x2b')](_0x3f2ee9[_0x86e8('0x2c')]);if(_0x3f2ee9['name']){delete _0x3f2ee9['name'];}_0x3106e7['status'](_0x24f2e9)[_0x86e8('0x2d')](_0x3f2ee9);};}exports[_0x86e8('0x2e')]=function(_0x433b5a,_0x4f8b21){var _0x3a0336={},_0x2f3e08={},_0x55022a={'count':0x0,'rows':[]};var _0x44ec91=_['map'](db[_0x86e8('0x2f')][_0x86e8('0x30')],function(_0x4f0fbb){return{'name':_0x4f0fbb[_0x86e8('0x31')],'type':_0x4f0fbb[_0x86e8('0x32')][_0x86e8('0x33')]};});_0x2f3e08[_0x86e8('0x34')]=_[_0x86e8('0x35')](_0x44ec91,_0x86e8('0x36'));_0x2f3e08['query']=_['keys'](_0x433b5a[_0x86e8('0x37')]);_0x2f3e08[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x2f3e08['model'],_0x2f3e08[_0x86e8('0x37')]);_0x3a0336[_0x86e8('0x3a')]=_[_0x86e8('0x39')](_0x2f3e08['model'],qs[_0x86e8('0x3b')](_0x433b5a[_0x86e8('0x37')]['fields']));_0x3a0336[_0x86e8('0x3a')]=_0x3a0336[_0x86e8('0x3a')][_0x86e8('0x3c')]?_0x3a0336['attributes']:_0x2f3e08[_0x86e8('0x34')];if(!_0x433b5a[_0x86e8('0x37')][_0x86e8('0x3d')](_0x86e8('0x3e'))){_0x3a0336['limit']=qs[_0x86e8('0x20')](_0x433b5a[_0x86e8('0x37')][_0x86e8('0x20')]);_0x3a0336[_0x86e8('0x1e')]=qs[_0x86e8('0x1e')](_0x433b5a[_0x86e8('0x37')]['offset']);}_0x3a0336[_0x86e8('0x3f')]=qs[_0x86e8('0x40')](_0x433b5a[_0x86e8('0x37')][_0x86e8('0x40')]);_0x3a0336[_0x86e8('0x41')]=qs[_0x86e8('0x38')](_[_0x86e8('0x42')](_0x433b5a['query'],_0x2f3e08[_0x86e8('0x38')]),_0x44ec91);if(_0x433b5a[_0x86e8('0x37')][_0x86e8('0x43')]){_0x3a0336[_0x86e8('0x41')]=_['merge'](_0x3a0336[_0x86e8('0x41')],{'$or':_[_0x86e8('0x35')](_0x44ec91,function(_0x162968){if(_0x162968[_0x86e8('0x32')]!==_0x86e8('0x44')){var _0x292eed={};_0x292eed[_0x162968['name']]={'$like':'%'+_0x433b5a['query'][_0x86e8('0x43')]+'%'};return _0x292eed;}})});}_0x3a0336=_['merge']({},_0x3a0336,_0x433b5a['options']);var _0x439088={'where':_0x3a0336[_0x86e8('0x41')]};return db[_0x86e8('0x2f')][_0x86e8('0x45')](_0x439088)[_0x86e8('0x26')](function(_0x329301){_0x55022a[_0x86e8('0x45')]=_0x329301;if(_0x433b5a['query'][_0x86e8('0x46')]){_0x3a0336[_0x86e8('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0x86e8('0x48')](_0x3a0336);})[_0x86e8('0x26')](function(_0x752705){_0x55022a[_0x86e8('0x49')]=_0x752705;return _0x55022a;})[_0x86e8('0x26')](respondWithFilteredResult(_0x4f8b21,_0x3a0336))[_0x86e8('0x4a')](handleError(_0x4f8b21,null));};exports[_0x86e8('0x4b')]=function(_0x255d8a,_0x2b7467){var _0x1046fb={'raw':!![],'where':{'id':_0x255d8a[_0x86e8('0x4c')]['id']}},_0x3b0deb={};_0x3b0deb['model']=_[_0x86e8('0x4d')](db[_0x86e8('0x2f')][_0x86e8('0x30')]);_0x3b0deb[_0x86e8('0x37')]=_[_0x86e8('0x4d')](_0x255d8a[_0x86e8('0x37')]);_0x3b0deb[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x3b0deb[_0x86e8('0x34')],_0x3b0deb[_0x86e8('0x37')]);_0x1046fb[_0x86e8('0x3a')]=_['intersection'](_0x3b0deb['model'],qs[_0x86e8('0x3b')](_0x255d8a[_0x86e8('0x37')][_0x86e8('0x3b')]));_0x1046fb[_0x86e8('0x3a')]=_0x1046fb[_0x86e8('0x3a')][_0x86e8('0x3c')]?_0x1046fb[_0x86e8('0x3a')]:_0x3b0deb['model'];if(_0x255d8a[_0x86e8('0x37')][_0x86e8('0x46')]){_0x1046fb['include']=[{'all':!![]}];}_0x1046fb=_['merge']({},_0x1046fb,_0x255d8a[_0x86e8('0x4e')]);return db[_0x86e8('0x2f')][_0x86e8('0x4f')](_0x1046fb)[_0x86e8('0x26')](handleEntityNotFound(_0x2b7467,null))[_0x86e8('0x26')](respondWithResult(_0x2b7467,null))['catch'](handleError(_0x2b7467,null));};exports[_0x86e8('0x50')]=function(_0x45aa71,_0x8e1e05){return db['FaxQueue'][_0x86e8('0x50')](_0x45aa71[_0x86e8('0x51')],{})[_0x86e8('0x26')](function(_0x1cebba){var _0x317721=_0x45aa71[_0x86e8('0x52')][_0x86e8('0x27')]({'plain':!![]});if(!_0x317721)throw new Error(_0x86e8('0x53'));if(_0x317721['role']==='user'){var _0x4db2c6=_0x1cebba['get']({'plain':!![]});var _0x21084e=_0x86e8('0x28');return db[_0x86e8('0x54')][_0x86e8('0x4f')]({'where':{'name':_0x21084e,'userProfileId':_0x317721[_0x86e8('0x55')]},'raw':!![]})[_0x86e8('0x26')](function(_0x12fa9e){if(_0x12fa9e&&_0x12fa9e[_0x86e8('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x4db2c6['name'],'resourceId':_0x4db2c6['id'],'type':_0x12fa9e[_0x86e8('0x36')],'sectionId':_0x12fa9e['id']},{})[_0x86e8('0x26')](function(){return _0x1cebba;});}else{return _0x1cebba;}})[_0x86e8('0x4a')](function(_0x199df4){logger[_0x86e8('0x2b')](_0x86e8('0x57'),_0x199df4);throw _0x199df4;});}return _0x1cebba;})[_0x86e8('0x26')](respondWithResult(_0x8e1e05,0xc9))['catch'](handleError(_0x8e1e05,null));};exports['update']=function(_0x38d4fb,_0x55aa55){if(_0x38d4fb['body']['id']){delete _0x38d4fb[_0x86e8('0x51')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x38d4fb[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0x55aa55,null))[_0x86e8('0x26')](saveUpdates(_0x38d4fb[_0x86e8('0x51')],null))['then'](respondWithResult(_0x55aa55,null))[_0x86e8('0x4a')](handleError(_0x55aa55,null));};exports['destroy']=function(_0x33522a,_0x3604bf){return db[_0x86e8('0x2f')][_0x86e8('0x4f')]({'where':{'id':_0x33522a['params']['id']}})['then'](handleEntityNotFound(_0x3604bf,null))[_0x86e8('0x26')](removeEntity(_0x3604bf,null))['catch'](handleError(_0x3604bf,null));};exports['describe']=function(_0x1a356e,_0x27e48d){return db[_0x86e8('0x2f')][_0x86e8('0x58')]()[_0x86e8('0x26')](respondWithResult(_0x27e48d,null))[_0x86e8('0x4a')](handleError(_0x27e48d,null));};exports[_0x86e8('0x59')]=function(_0x1831cc,_0x5a4a3a,_0x2b9704){var _0xaa942b={'raw':!![],'where':{}},_0x42bd91={},_0x565079;return db[_0x86e8('0x2f')]['findOne']({'where':{'id':_0x1831cc[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0x5a4a3a,null))['then'](function(_0x9434c3){if(_0x9434c3){_0x565079=_0x9434c3[_0x86e8('0x27')]({'plain':!![]});_0x42bd91[_0x86e8('0x34')]=_[_0x86e8('0x4d')](db['UserFaxQueue'][_0x86e8('0x30')]);_0x42bd91[_0x86e8('0x37')]=_[_0x86e8('0x4d')](_0x1831cc[_0x86e8('0x37')]);_0x42bd91[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x42bd91[_0x86e8('0x34')],_0x42bd91[_0x86e8('0x37')]);_0xaa942b[_0x86e8('0x3a')]=_[_0x86e8('0x39')](_0x42bd91[_0x86e8('0x34')],qs[_0x86e8('0x3b')](_0x1831cc[_0x86e8('0x37')][_0x86e8('0x3b')]));_0xaa942b[_0x86e8('0x3a')]=_0xaa942b['attributes']['length']?_0xaa942b['attributes']:_0x42bd91[_0x86e8('0x34')];if(!_0x1831cc[_0x86e8('0x37')]['hasOwnProperty'](_0x86e8('0x3e'))){_0xaa942b[_0x86e8('0x20')]=qs[_0x86e8('0x20')](_0x1831cc[_0x86e8('0x37')][_0x86e8('0x20')]);_0xaa942b[_0x86e8('0x1e')]=qs[_0x86e8('0x1e')](_0x1831cc[_0x86e8('0x37')]['offset']);}_0xaa942b[_0x86e8('0x3f')]=qs[_0x86e8('0x40')](_0x1831cc[_0x86e8('0x37')]['sort']);_0xaa942b[_0x86e8('0x41')]=qs['filters'](_['pick'](_0x1831cc['query'],_0x42bd91[_0x86e8('0x38')]));_0xaa942b[_0x86e8('0x41')]['FaxQueueId']=_0x9434c3['id'];if(_0x1831cc[_0x86e8('0x37')][_0x86e8('0x43')]){_0xaa942b[_0x86e8('0x41')]=_[_0x86e8('0x5a')](_0xaa942b[_0x86e8('0x41')],{'$or':_[_0x86e8('0x35')](_0xaa942b[_0x86e8('0x3a')],function(_0x442f6b){var _0xdbb8b9={};_0xdbb8b9[_0x442f6b]={'$like':'%'+_0x1831cc[_0x86e8('0x37')][_0x86e8('0x43')]+'%'};return _0xdbb8b9;})});}_0xaa942b=_['merge']({},_0xaa942b,_0x1831cc[_0x86e8('0x4e')]);return db[_0x86e8('0x5b')]['findAll'](_0xaa942b);}})[_0x86e8('0x26')](function(_0xee1027){if(_0xee1027){return db[_0x86e8('0x5c')][_0x86e8('0x5d')]({'where':{'id':_[_0x86e8('0x35')](_0xee1027,_0x86e8('0x5e')),'role':'agent'},'attributes':['id',_0x86e8('0x36'),_0x86e8('0x5f'),_0x86e8('0x60'),_0x86e8('0x61')]});}})['then'](function(_0x40caf0){if(_0x40caf0){return{'count':_0x40caf0[_0x86e8('0x45')],'rows':_['map'](_0x40caf0[_0x86e8('0x49')],function(_0x186342){return{'membername':_0x186342['name'],'UserId':_0x186342['id'],'queue_name':_0x565079[_0x86e8('0x36')],'FaxQueueId':_0x565079['id'],'interface':util[_0x86e8('0x62')]('%s/%s',_0x86e8('0x63'),_0x186342[_0x86e8('0x36')]),'penalty':0x0,'paused':_0x186342['faxPause'],'createdAt':_0x186342[_0x86e8('0x61')],'updatedAt':_0x186342[_0x86e8('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x86e8('0x26')](respondWithFilteredResult(_0x5a4a3a,_0xaa942b))[_0x86e8('0x4a')](handleError(_0x5a4a3a,null));};exports['getTeams']=function(_0x148001,_0x4784ef,_0x31e288){var _0x232398={};var _0x414e16={};var _0x24e6a6;var _0x4efc75;return db[_0x86e8('0x2f')]['findOne']({'where':{'id':_0x148001[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0x4784ef,null))['then'](function(_0x5b3f44){if(_0x5b3f44){_0x24e6a6=_0x5b3f44;_0x414e16['model']=_[_0x86e8('0x4d')](db[_0x86e8('0x64')][_0x86e8('0x30')]);_0x414e16[_0x86e8('0x37')]=_[_0x86e8('0x4d')](_0x148001['query']);_0x414e16[_0x86e8('0x38')]=_[_0x86e8('0x39')](_0x414e16['model'],_0x414e16[_0x86e8('0x37')]);_0x232398['attributes']=_[_0x86e8('0x39')](_0x414e16['model'],qs[_0x86e8('0x3b')](_0x148001[_0x86e8('0x37')][_0x86e8('0x3b')]));_0x232398['attributes']=_0x232398[_0x86e8('0x3a')]['length']?_0x232398['attributes']:_0x414e16[_0x86e8('0x34')];_0x232398['order']=qs[_0x86e8('0x40')](_0x148001['query']['sort']);_0x232398[_0x86e8('0x41')]=qs['filters'](_[_0x86e8('0x42')](_0x148001[_0x86e8('0x37')],_0x414e16[_0x86e8('0x38')]));if(_0x148001[_0x86e8('0x37')][_0x86e8('0x43')]){_0x232398[_0x86e8('0x41')]=_[_0x86e8('0x5a')](_0x232398[_0x86e8('0x41')],{'$or':_[_0x86e8('0x35')](_0x232398['attributes'],function(_0x10f1c5){var _0x501257={};_0x501257[_0x10f1c5]={'$like':'%'+_0x148001['query'][_0x86e8('0x43')]+'%'};return _0x501257;})});}_0x232398=_[_0x86e8('0x5a')]({},_0x232398,_0x148001[_0x86e8('0x4e')]);return _0x24e6a6[_0x86e8('0x65')](_0x232398);}})[_0x86e8('0x26')](function(_0x3f915e){if(_0x3f915e){_0x4efc75=_0x3f915e['length'];if(!_0x148001[_0x86e8('0x37')][_0x86e8('0x3d')]('nolimit')){_0x232398[_0x86e8('0x20')]=qs[_0x86e8('0x20')](_0x148001[_0x86e8('0x37')][_0x86e8('0x20')]);_0x232398[_0x86e8('0x1e')]=qs['offset'](_0x148001[_0x86e8('0x37')]['offset']);}return _0x24e6a6['getTeams'](_0x232398);}})['then'](function(_0x39a472){if(_0x39a472){return _0x39a472?{'count':_0x4efc75,'rows':_0x39a472}:null;}})[_0x86e8('0x26')](respondWithResult(_0x4784ef,null))[_0x86e8('0x4a')](handleError(_0x4784ef,null));};exports[_0x86e8('0x66')]=function(_0x1c4378,_0x378e0f,_0xb80922){var _0x50d5f0=_0x1c4378[_0x86e8('0x51')][_0x86e8('0x67')];return db[_0x86e8('0x64')][_0x86e8('0x48')]({'where':{'id':_0x50d5f0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x86e8('0x68'),'attributes':['id',_0x86e8('0x36'),'online','voicePause',_0x86e8('0x69')],'raw':!![]}]})[_0x86e8('0x26')](function(_0x416fc2){if(_0x416fc2){var _0x38ed35=_['flatMap'](_0x416fc2,function(_0x2b7f61){var _0x38cfc2=_0x2b7f61[_0x86e8('0x27')]({'plain':!![]});return _0x38cfc2['Agents'];});return db[_0x86e8('0x2f')][_0x86e8('0x4f')]({'where':{'id':_0x1c4378[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](function(_0x5def7e){return db[_0x86e8('0x6a')]['transaction'](function(_0x3e88ef){return _0x5def7e[_0x86e8('0x66')](_0x50d5f0,{'transaction':_0x3e88ef})[_0x86e8('0x26')](function(){return BPromise[_0x86e8('0x6b')](_0x38ed35,function(_0x18a10d){return db[_0x86e8('0x5b')][_0x86e8('0x6c')]({'where':{'UserId':_0x18a10d['id'],'FaxQueueId':_0x1c4378[_0x86e8('0x4c')]['id']},'transaction':_0x3e88ef});});})['then'](function(){_0x38ed35[_0x86e8('0x6d')](function(_0x1a144f){socket[_0x86e8('0x6e')](_0x86e8('0x6f'),{'UserId':_0x1a144f['id'],'FaxQueueId':_0x5def7e['id']});});});});});}})[_0x86e8('0x26')](respondWithStatusCode(_0x378e0f,null))['catch'](handleError(_0x378e0f,null));};exports[_0x86e8('0x70')]=function(_0x5a1d54,_0x194ddc,_0x2a492f){return db[_0x86e8('0x64')][_0x86e8('0x48')]({'where':{'id':_0x5a1d54[_0x86e8('0x37')][_0x86e8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x86e8('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x194ddc,null))[_0x86e8('0x26')](function(_0x186c1c){var _0x30bba2=_['map'](_0x186c1c,'id');var _0x57f9f2=[];var _0x478bbe=[];var _0x218485=squel[_0x86e8('0x71')]();_0x218485[_0x86e8('0x72')](_0x86e8('0x73'))[_0x86e8('0x74')](_0x86e8('0x75'),'tq')[_0x86e8('0x76')](_0x86e8('0x77'),'ut',_0x86e8('0x78'))[_0x86e8('0x41')](_0x86e8('0x79'),_0x5a1d54[_0x86e8('0x4c')]['id']);for(var _0x284c71=0x0;_0x284c71<_0x186c1c[_0x86e8('0x3c')];_0x284c71+=0x1){let _0x593370=_0x186c1c[_0x284c71];for(var _0x7850dd=0x0;_0x7850dd<_0x593370[_0x86e8('0x68')][_0x86e8('0x3c')];_0x7850dd+=0x1){let _0x500b5d=_0x593370[_0x86e8('0x68')][_0x7850dd];var _0x3c180f=_0x218485['clone']();_0x3c180f[_0x86e8('0x41')](_0x86e8('0x7a'),_0x500b5d['id']);_0x478bbe[_0x86e8('0x7b')](db['sequelize'][_0x86e8('0x37')](_0x3c180f[_0x86e8('0x7c')](),{'type':db[_0x86e8('0x6a')][_0x86e8('0x7d')][_0x86e8('0x7e')]})[_0x86e8('0x26')](function(_0x1dbfbd){if(_0x1dbfbd[_0x86e8('0x3c')]===0x1){return _0x500b5d['id'];}else{var _0x26a7fd=_[_0x86e8('0x7f')](_[_0x86e8('0x35')](_0x1dbfbd,_0x86e8('0x80')),function(_0x2a18a8){return _[_0x86e8('0x81')](_0x30bba2,_0x2a18a8);});if(_0x26a7fd){return _0x500b5d['id'];}}}));}}return BPromise[_0x86e8('0x82')](_0x478bbe)[_0x86e8('0x26')](function(_0x5a9863){_0x57f9f2=_(_0x57f9f2)[_0x86e8('0x83')](_0x5a9863)[_0x86e8('0x84')]()[_0x86e8('0x85')]();return db[_0x86e8('0x2f')]['find']({'where':{'id':_0x5a1d54[_0x86e8('0x4c')]['id']}})['then'](function(_0x4fe971){return db['sequelize']['transaction'](function(_0x52af6c){return _0x4fe971['removeTeams'](_0x5a1d54[_0x86e8('0x37')][_0x86e8('0x67')],{'transaction':_0x52af6c})['then'](function(){if(!_[_0x86e8('0x86')](_0x57f9f2)){return _0x4fe971['removeAgents'](_0x57f9f2,{'transaction':_0x52af6c});}})[_0x86e8('0x26')](function(){_0x57f9f2[_0x86e8('0x6d')](function(_0x5e0c85){socket[_0x86e8('0x6e')](_0x86e8('0x87'),{'UserId':_0x5e0c85,'FaxQueueId':_0x4fe971['id']});});});});});});})[_0x86e8('0x26')](respondWithStatusCode(_0x194ddc,null))[_0x86e8('0x4a')](handleError(_0x194ddc,null));};exports[_0x86e8('0x88')]=function(_0x5dfe63,_0xffe9ef,_0x428de4){return db[_0x86e8('0x2f')][_0x86e8('0x4f')]({'where':{'id':_0x5dfe63[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0xffe9ef,null))['then'](function(_0x157e96){if(_0x157e96){return _0x157e96['addAgents'](_0x5dfe63[_0x86e8('0x51')][_0x86e8('0x67')],_[_0x86e8('0x89')](_0x5dfe63[_0x86e8('0x51')],[_0x86e8('0x67'),'id'])||{})[_0x86e8('0x8a')](function(_0x15bafc){for(var _0x533b2b=0x0;_0x533b2b<_0x5dfe63[_0x86e8('0x51')]['ids'][_0x86e8('0x3c')];_0x533b2b+=0x1){socket[_0x86e8('0x6e')]('userFaxQueue:save',{'UserId':Number(_0x5dfe63['body'][_0x86e8('0x67')][_0x533b2b]),'FaxQueueId':Number(_0x5dfe63[_0x86e8('0x4c')]['id'])});}return _0x15bafc;});}})[_0x86e8('0x26')](respondWithResult(_0xffe9ef,null))[_0x86e8('0x4a')](handleError(_0xffe9ef,null));};exports['removeAgents']=function(_0x280fba,_0xd6c361,_0x129c2e){return db[_0x86e8('0x2f')]['find']({'where':{'id':_0x280fba[_0x86e8('0x4c')]['id']}})[_0x86e8('0x26')](handleEntityNotFound(_0xd6c361,null))[_0x86e8('0x26')](function(_0x4aa1f3){if(_0x4aa1f3){return _0x4aa1f3[_0x86e8('0x8b')](_0x280fba[_0x86e8('0x37')][_0x86e8('0x67')])['then'](function(){if(_[_0x86e8('0x8c')](_0x280fba['query'][_0x86e8('0x67')])){for(var _0x1e83e2=0x0;_0x1e83e2<_0x280fba[_0x86e8('0x37')][_0x86e8('0x67')][_0x86e8('0x3c')];_0x1e83e2+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x280fba['query'][_0x86e8('0x67')][_0x1e83e2]),'FaxQueueId':Number(_0x280fba[_0x86e8('0x4c')]['id'])});}}else{socket['emit'](_0x86e8('0x87'),{'UserId':Number(_0x280fba[_0x86e8('0x37')][_0x86e8('0x67')]),'FaxQueueId':Number(_0x280fba[_0x86e8('0x4c')]['id'])});}});}})[_0x86e8('0x26')](respondWithStatusCode(_0xd6c361,null))[_0x86e8('0x4a')](handleError(_0xd6c361,null));};exports['getAgents']=function(_0x245f2b,_0x1af080,_0x170880){var _0xa8475d={};var _0x184047={};var _0xa56867;var _0x5b6696;return db[_0x86e8('0x2f')]['findOne']({'where':{'id':_0x245f2b['params']['id']}})['then'](handleEntityNotFound(_0x1af080,null))['then'](function(_0x1ca71a){if(_0x1ca71a){_0xa56867=_0x1ca71a;_0x184047['model']=_[_0x86e8('0x4d')](db[_0x86e8('0x5c')][_0x86e8('0x30')]);_0x184047[_0x86e8('0x37')]=_['keys'](_0x245f2b[_0x86e8('0x37')]);_0x184047[_0x86e8('0x38')]=_['intersection'](_0x184047[_0x86e8('0x34')],_0x184047['query']);_0xa8475d['attributes']=_[_0x86e8('0x39')](_0x184047[_0x86e8('0x34')],qs['fields'](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x3b')]));_0xa8475d[_0x86e8('0x3a')]=_0xa8475d[_0x86e8('0x3a')][_0x86e8('0x3c')]?_0xa8475d[_0x86e8('0x3a')]:_0x184047[_0x86e8('0x34')];_0xa8475d[_0x86e8('0x3f')]=qs[_0x86e8('0x40')](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x40')]);_0xa8475d['where']=qs['filters'](_[_0x86e8('0x42')](_0x245f2b[_0x86e8('0x37')],_0x184047['filters']));if(_0x245f2b['query'][_0x86e8('0x43')]){_0xa8475d['where']=_[_0x86e8('0x5a')](_0xa8475d[_0x86e8('0x41')],{'$or':_['map'](_0xa8475d[_0x86e8('0x3a')],function(_0x457192){var _0x3490b0={};_0x3490b0[_0x457192]={'$like':'%'+_0x245f2b[_0x86e8('0x37')][_0x86e8('0x43')]+'%'};return _0x3490b0;})});}_0xa8475d=_['merge']({},_0xa8475d,_0x245f2b[_0x86e8('0x4e')]);return _0xa56867['getAgents'](_0xa8475d);}})['then'](function(_0x2d37fc){if(_0x2d37fc){_0x5b6696=_0x2d37fc[_0x86e8('0x3c')];if(!_0x245f2b[_0x86e8('0x37')][_0x86e8('0x3d')]('nolimit')){_0xa8475d[_0x86e8('0x20')]=qs[_0x86e8('0x20')](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x20')]);_0xa8475d['offset']=qs['offset'](_0x245f2b[_0x86e8('0x37')][_0x86e8('0x1e')]);}return _0xa56867[_0x86e8('0x8d')](_0xa8475d);}})[_0x86e8('0x26')](function(_0x9148fe){if(_0x9148fe){return _0x9148fe?{'count':_0x5b6696,'rows':_0x9148fe}:null;}})[_0x86e8('0x26')](respondWithResult(_0x1af080,null))[_0x86e8('0x4a')](handleError(_0x1af080,null));}; \ No newline at end of file +var _0x2f41=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','catch','create','role','user','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','updatedAt','createdAt','format','SIP','faxPause','getTeams','addTeams','Team','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x254bbe,_0x44612d){var _0x42aae4=function(_0x32e80e){while(--_0x32e80e){_0x254bbe['push'](_0x254bbe['shift']());}};_0x42aae4(++_0x44612d);}(_0x2f41,0x101));var _0x12f4=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x2f41[_0x58efa6];return _0x5d643c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12f4('0x0'));var zipdir=require(_0x12f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12f4('0x2'));var moment=require(_0x12f4('0x3'));var BPromise=require(_0x12f4('0x4'));var Mustache=require(_0x12f4('0x5'));var util=require(_0x12f4('0x6'));var path=require('path');var sox=require(_0x12f4('0x7'));var csv=require(_0x12f4('0x8'));var ejs=require(_0x12f4('0x9'));var fs=require('fs');var fs_extra=require(_0x12f4('0xa'));var _=require(_0x12f4('0xb'));var squel=require('squel');var crypto=require(_0x12f4('0xc'));var jsforce=require(_0x12f4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x12f4('0x8'));var querystring=require(_0x12f4('0xe'));var Papa=require('papaparse');var Redis=require(_0x12f4('0xf'));var authService=require(_0x12f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x12f4('0x11'));var hardwareService=require(_0x12f4('0x12'));var logger=require('../../config/logger')(_0x12f4('0x13'));var utils=require('../../config/utils');var config=require(_0x12f4('0x14'));var licenseUtil=require(_0x12f4('0x15'));var db=require(_0x12f4('0x16'))['db'];config[_0x12f4('0x17')]=_[_0x12f4('0x18')](config['redis'],{'host':_0x12f4('0x19'),'port':0x18eb});var socket=require(_0x12f4('0x1a'))(new Redis(config[_0x12f4('0x17')]));require('./faxQueue.socket')[_0x12f4('0x1b')](socket);function respondWithStatusCode(_0x3435c2,_0x1e78d3){_0x1e78d3=_0x1e78d3||0xcc;return function(_0x37e517){if(_0x37e517){return _0x3435c2[_0x12f4('0x1c')](_0x1e78d3);}return _0x3435c2[_0x12f4('0x1d')](_0x1e78d3)[_0x12f4('0x1e')]();};}function respondWithResult(_0x1c4b1c,_0x2ac7b2){_0x2ac7b2=_0x2ac7b2||0xc8;return function(_0x35aab9){if(_0x35aab9){return _0x1c4b1c[_0x12f4('0x1d')](_0x2ac7b2)[_0x12f4('0x1f')](_0x35aab9);}};}function respondWithFilteredResult(_0x4e3792,_0x297c77){return function(_0x5285f1){if(_0x5285f1){var _0x3b0ad5=typeof _0x297c77[_0x12f4('0x20')]===_0x12f4('0x21')&&typeof _0x297c77[_0x12f4('0x22')]===_0x12f4('0x21');var _0x3700dc=_0x5285f1[_0x12f4('0x23')];var _0x57a0dd=_0x3b0ad5?0x0:_0x297c77[_0x12f4('0x20')];var _0x562ee2=_0x3b0ad5?_0x5285f1['count']:_0x297c77[_0x12f4('0x20')]+_0x297c77['limit'];var _0x244644;if(_0x562ee2>=_0x3700dc){_0x562ee2=_0x3700dc;_0x244644=0xc8;}else{_0x244644=0xce;}_0x4e3792[_0x12f4('0x1d')](_0x244644);return _0x4e3792['set'](_0x12f4('0x24'),_0x57a0dd+'-'+_0x562ee2+'/'+_0x3700dc)[_0x12f4('0x1f')](_0x5285f1);}return null;};}function patchUpdates(_0x29086d){return function(_0x102d30){try{jsonpatch[_0x12f4('0x25')](_0x102d30,_0x29086d,!![]);}catch(_0x472ef3){return BPromise[_0x12f4('0x26')](_0x472ef3);}return _0x102d30['save']();};}function saveUpdates(_0x1b4dcb,_0x3b7939){return function(_0x2ef2b5){if(_0x2ef2b5){return _0x2ef2b5[_0x12f4('0x27')](_0x1b4dcb)['then'](function(_0x22589e){return _0x22589e;});}return null;};}function removeEntity(_0x1b982b,_0x1eed5f){return function(_0x171073){if(_0x171073){return _0x171073[_0x12f4('0x28')]()[_0x12f4('0x29')](function(){var _0x2ad97c=_0x171073[_0x12f4('0x2a')]({'plain':!![]});var _0x1fe329='FaxQueues';return db[_0x12f4('0x2b')][_0x12f4('0x28')]({'where':{'type':_0x1fe329,'resourceId':_0x2ad97c['id']}})[_0x12f4('0x29')](function(){return _0x171073;});})[_0x12f4('0x29')](function(){_0x1b982b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e660a,_0x310f04){return function(_0x54f55b){if(!_0x54f55b){_0x1e660a[_0x12f4('0x1c')](0x194);}return _0x54f55b;};}function handleError(_0x18e8c5,_0x5898f3){_0x5898f3=_0x5898f3||0x1f4;return function(_0x5ee636){logger[_0x12f4('0x2c')](_0x5ee636[_0x12f4('0x2d')]);if(_0x5ee636[_0x12f4('0x2e')]){delete _0x5ee636[_0x12f4('0x2e')];}_0x18e8c5[_0x12f4('0x1d')](_0x5898f3)[_0x12f4('0x2f')](_0x5ee636);};}exports['index']=function(_0x2f5a6d,_0xd92d91){var _0x3ef58f={},_0x4979e3={},_0x1e91c3={'count':0x0,'rows':[]};var _0xd4ee50=_[_0x12f4('0x30')](db[_0x12f4('0x31')][_0x12f4('0x32')],function(_0x9b9f27){return{'name':_0x9b9f27[_0x12f4('0x33')],'type':_0x9b9f27[_0x12f4('0x34')][_0x12f4('0x35')]};});_0x4979e3[_0x12f4('0x36')]=_[_0x12f4('0x30')](_0xd4ee50,'name');_0x4979e3['query']=_[_0x12f4('0x37')](_0x2f5a6d[_0x12f4('0x38')]);_0x4979e3[_0x12f4('0x39')]=_['intersection'](_0x4979e3[_0x12f4('0x36')],_0x4979e3[_0x12f4('0x38')]);_0x3ef58f[_0x12f4('0x3a')]=_[_0x12f4('0x3b')](_0x4979e3[_0x12f4('0x36')],qs[_0x12f4('0x3c')](_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x3c')]));_0x3ef58f[_0x12f4('0x3a')]=_0x3ef58f[_0x12f4('0x3a')][_0x12f4('0x3d')]?_0x3ef58f[_0x12f4('0x3a')]:_0x4979e3['model'];if(!_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x3e')](_0x12f4('0x3f'))){_0x3ef58f[_0x12f4('0x22')]=qs['limit'](_0x2f5a6d['query'][_0x12f4('0x22')]);_0x3ef58f[_0x12f4('0x20')]=qs[_0x12f4('0x20')](_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x20')]);}_0x3ef58f[_0x12f4('0x40')]=qs['sort'](_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x41')]);_0x3ef58f[_0x12f4('0x42')]=qs['filters'](_[_0x12f4('0x43')](_0x2f5a6d[_0x12f4('0x38')],_0x4979e3['filters']),_0xd4ee50);if(_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x44')]){_0x3ef58f[_0x12f4('0x42')]=_['merge'](_0x3ef58f['where'],{'$or':_[_0x12f4('0x30')](_0xd4ee50,function(_0x5f301e){if(_0x5f301e[_0x12f4('0x34')]!=='VIRTUAL'){var _0x837f86={};_0x837f86[_0x5f301e[_0x12f4('0x2e')]]={'$like':'%'+_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x44')]+'%'};return _0x837f86;}})});}_0x3ef58f=_[_0x12f4('0x45')]({},_0x3ef58f,_0x2f5a6d[_0x12f4('0x46')]);var _0xc6668b={'where':_0x3ef58f[_0x12f4('0x42')]};return db[_0x12f4('0x31')][_0x12f4('0x23')](_0xc6668b)[_0x12f4('0x29')](function(_0x61629c){_0x1e91c3['count']=_0x61629c;if(_0x2f5a6d[_0x12f4('0x38')][_0x12f4('0x47')]){_0x3ef58f['include']=[{'all':!![]}];}return db[_0x12f4('0x31')][_0x12f4('0x48')](_0x3ef58f);})[_0x12f4('0x29')](function(_0xa0727){_0x1e91c3[_0x12f4('0x49')]=_0xa0727;return _0x1e91c3;})[_0x12f4('0x29')](respondWithFilteredResult(_0xd92d91,_0x3ef58f))['catch'](handleError(_0xd92d91,null));};exports[_0x12f4('0x4a')]=function(_0x4977e3,_0x41ebdf){var _0x1d8d66={'raw':!![],'where':{'id':_0x4977e3[_0x12f4('0x4b')]['id']}},_0x4e8d5d={};_0x4e8d5d[_0x12f4('0x36')]=_['keys'](db[_0x12f4('0x31')][_0x12f4('0x32')]);_0x4e8d5d[_0x12f4('0x38')]=_[_0x12f4('0x37')](_0x4977e3[_0x12f4('0x38')]);_0x4e8d5d[_0x12f4('0x39')]=_[_0x12f4('0x3b')](_0x4e8d5d['model'],_0x4e8d5d[_0x12f4('0x38')]);_0x1d8d66[_0x12f4('0x3a')]=_[_0x12f4('0x3b')](_0x4e8d5d[_0x12f4('0x36')],qs[_0x12f4('0x3c')](_0x4977e3[_0x12f4('0x38')]['fields']));_0x1d8d66[_0x12f4('0x3a')]=_0x1d8d66[_0x12f4('0x3a')][_0x12f4('0x3d')]?_0x1d8d66[_0x12f4('0x3a')]:_0x4e8d5d['model'];if(_0x4977e3[_0x12f4('0x38')]['includeAll']){_0x1d8d66[_0x12f4('0x4c')]=[{'all':!![]}];}_0x1d8d66=_['merge']({},_0x1d8d66,_0x4977e3[_0x12f4('0x46')]);return db[_0x12f4('0x31')]['find'](_0x1d8d66)[_0x12f4('0x29')](handleEntityNotFound(_0x41ebdf,null))[_0x12f4('0x29')](respondWithResult(_0x41ebdf,null))[_0x12f4('0x4d')](handleError(_0x41ebdf,null));};exports[_0x12f4('0x4e')]=function(_0xd07446,_0x461eab){return db[_0x12f4('0x31')][_0x12f4('0x4e')](_0xd07446['body'],{})[_0x12f4('0x29')](function(_0x55e010){var _0x2385a3=_0xd07446['user']['get']({'plain':!![]});if(!_0x2385a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2385a3[_0x12f4('0x4f')]===_0x12f4('0x50')){var _0xa80674=_0x55e010[_0x12f4('0x2a')]({'plain':!![]});var _0x2d33ab=_0x12f4('0x51');return db[_0x12f4('0x52')]['find']({'where':{'name':_0x2d33ab,'userProfileId':_0x2385a3[_0x12f4('0x53')]},'raw':!![]})[_0x12f4('0x29')](function(_0x58dc66){if(_0x58dc66&&_0x58dc66[_0x12f4('0x54')]===0x0){return db[_0x12f4('0x2b')][_0x12f4('0x4e')]({'name':_0xa80674['name'],'resourceId':_0xa80674['id'],'type':_0x58dc66[_0x12f4('0x2e')],'sectionId':_0x58dc66['id']},{})[_0x12f4('0x29')](function(){return _0x55e010;});}else{return _0x55e010;}})[_0x12f4('0x4d')](function(_0x25ccd2){logger[_0x12f4('0x2c')](_0x12f4('0x55'),_0x25ccd2);throw _0x25ccd2;});}return _0x55e010;})[_0x12f4('0x29')](respondWithResult(_0x461eab,0xc9))[_0x12f4('0x4d')](handleError(_0x461eab,null));};exports['update']=function(_0x18994b,_0x277b4a){if(_0x18994b[_0x12f4('0x56')]['id']){delete _0x18994b[_0x12f4('0x56')]['id'];}return db['FaxQueue'][_0x12f4('0x57')]({'where':{'id':_0x18994b[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](handleEntityNotFound(_0x277b4a,null))['then'](saveUpdates(_0x18994b[_0x12f4('0x56')],null))[_0x12f4('0x29')](respondWithResult(_0x277b4a,null))[_0x12f4('0x4d')](handleError(_0x277b4a,null));};exports[_0x12f4('0x28')]=function(_0x312504,_0x29a1ba){return db['FaxQueue']['find']({'where':{'id':_0x312504['params']['id']}})[_0x12f4('0x29')](handleEntityNotFound(_0x29a1ba,null))[_0x12f4('0x29')](removeEntity(_0x29a1ba,null))[_0x12f4('0x4d')](handleError(_0x29a1ba,null));};exports[_0x12f4('0x58')]=function(_0x24ab31,_0x3533ee){return db[_0x12f4('0x31')][_0x12f4('0x58')]()[_0x12f4('0x29')](respondWithResult(_0x3533ee,null))[_0x12f4('0x4d')](handleError(_0x3533ee,null));};exports['getMembers']=function(_0x2777fc,_0x2abd08,_0x42564c){var _0x3e0d20={'raw':!![],'where':{}},_0x516b42={},_0x1ea188;return db[_0x12f4('0x31')][_0x12f4('0x59')]({'where':{'id':_0x2777fc[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](handleEntityNotFound(_0x2abd08,null))['then'](function(_0x2a1872){if(_0x2a1872){_0x1ea188=_0x2a1872[_0x12f4('0x2a')]({'plain':!![]});_0x516b42[_0x12f4('0x36')]=_[_0x12f4('0x37')](db[_0x12f4('0x5a')][_0x12f4('0x32')]);_0x516b42['query']=_[_0x12f4('0x37')](_0x2777fc[_0x12f4('0x38')]);_0x516b42[_0x12f4('0x39')]=_[_0x12f4('0x3b')](_0x516b42[_0x12f4('0x36')],_0x516b42[_0x12f4('0x38')]);_0x3e0d20[_0x12f4('0x3a')]=_[_0x12f4('0x3b')](_0x516b42[_0x12f4('0x36')],qs[_0x12f4('0x3c')](_0x2777fc[_0x12f4('0x38')]['fields']));_0x3e0d20[_0x12f4('0x3a')]=_0x3e0d20[_0x12f4('0x3a')][_0x12f4('0x3d')]?_0x3e0d20[_0x12f4('0x3a')]:_0x516b42['model'];if(!_0x2777fc['query'][_0x12f4('0x3e')](_0x12f4('0x3f'))){_0x3e0d20['limit']=qs[_0x12f4('0x22')](_0x2777fc[_0x12f4('0x38')][_0x12f4('0x22')]);_0x3e0d20['offset']=qs[_0x12f4('0x20')](_0x2777fc['query'][_0x12f4('0x20')]);}_0x3e0d20[_0x12f4('0x40')]=qs['sort'](_0x2777fc[_0x12f4('0x38')][_0x12f4('0x41')]);_0x3e0d20[_0x12f4('0x42')]=qs[_0x12f4('0x39')](_[_0x12f4('0x43')](_0x2777fc[_0x12f4('0x38')],_0x516b42['filters']));_0x3e0d20[_0x12f4('0x42')][_0x12f4('0x5b')]=_0x2a1872['id'];if(_0x2777fc[_0x12f4('0x38')][_0x12f4('0x44')]){_0x3e0d20[_0x12f4('0x42')]=_[_0x12f4('0x45')](_0x3e0d20[_0x12f4('0x42')],{'$or':_[_0x12f4('0x30')](_0x3e0d20[_0x12f4('0x3a')],function(_0x3a984c){var _0x4c82b7={};_0x4c82b7[_0x3a984c]={'$like':'%'+_0x2777fc[_0x12f4('0x38')]['filter']+'%'};return _0x4c82b7;})});}_0x3e0d20=_['merge']({},_0x3e0d20,_0x2777fc[_0x12f4('0x46')]);return db[_0x12f4('0x5a')]['findAll'](_0x3e0d20);}})[_0x12f4('0x29')](function(_0x506f0e){if(_0x506f0e){return db[_0x12f4('0x5c')]['findAndCountAll']({'where':{'id':_[_0x12f4('0x30')](_0x506f0e,_0x12f4('0x5d')),'role':_0x12f4('0x5e')},'attributes':['id',_0x12f4('0x2e'),'faxPause',_0x12f4('0x5f'),_0x12f4('0x60')]});}})[_0x12f4('0x29')](function(_0x441933){if(_0x441933){return{'count':_0x441933[_0x12f4('0x23')],'rows':_[_0x12f4('0x30')](_0x441933[_0x12f4('0x49')],function(_0x1f5192){return{'membername':_0x1f5192[_0x12f4('0x2e')],'UserId':_0x1f5192['id'],'queue_name':_0x1ea188[_0x12f4('0x2e')],'FaxQueueId':_0x1ea188['id'],'interface':util[_0x12f4('0x61')]('%s/%s',_0x12f4('0x62'),_0x1f5192['name']),'penalty':0x0,'paused':_0x1f5192[_0x12f4('0x63')],'createdAt':_0x1f5192[_0x12f4('0x60')],'updatedAt':_0x1f5192['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x12f4('0x29')](respondWithFilteredResult(_0x2abd08,_0x3e0d20))[_0x12f4('0x4d')](handleError(_0x2abd08,null));};exports[_0x12f4('0x64')]=function(_0x380d90,_0x2c7be1,_0x43d8e8){var _0x496dc2={};var _0x3b8f59={};var _0x45e2e2;var _0x44b7dc;return db[_0x12f4('0x31')][_0x12f4('0x59')]({'where':{'id':_0x380d90[_0x12f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c7be1,null))[_0x12f4('0x29')](function(_0x577313){if(_0x577313){_0x45e2e2=_0x577313;_0x3b8f59[_0x12f4('0x36')]=_[_0x12f4('0x37')](db['Team'][_0x12f4('0x32')]);_0x3b8f59[_0x12f4('0x38')]=_[_0x12f4('0x37')](_0x380d90['query']);_0x3b8f59[_0x12f4('0x39')]=_[_0x12f4('0x3b')](_0x3b8f59[_0x12f4('0x36')],_0x3b8f59[_0x12f4('0x38')]);_0x496dc2[_0x12f4('0x3a')]=_[_0x12f4('0x3b')](_0x3b8f59[_0x12f4('0x36')],qs[_0x12f4('0x3c')](_0x380d90[_0x12f4('0x38')]['fields']));_0x496dc2[_0x12f4('0x3a')]=_0x496dc2[_0x12f4('0x3a')][_0x12f4('0x3d')]?_0x496dc2['attributes']:_0x3b8f59[_0x12f4('0x36')];_0x496dc2[_0x12f4('0x40')]=qs[_0x12f4('0x41')](_0x380d90[_0x12f4('0x38')][_0x12f4('0x41')]);_0x496dc2[_0x12f4('0x42')]=qs['filters'](_[_0x12f4('0x43')](_0x380d90[_0x12f4('0x38')],_0x3b8f59[_0x12f4('0x39')]));if(_0x380d90[_0x12f4('0x38')][_0x12f4('0x44')]){_0x496dc2['where']=_[_0x12f4('0x45')](_0x496dc2[_0x12f4('0x42')],{'$or':_[_0x12f4('0x30')](_0x496dc2[_0x12f4('0x3a')],function(_0x321a1d){var _0x42407c={};_0x42407c[_0x321a1d]={'$like':'%'+_0x380d90[_0x12f4('0x38')][_0x12f4('0x44')]+'%'};return _0x42407c;})});}_0x496dc2=_[_0x12f4('0x45')]({},_0x496dc2,_0x380d90[_0x12f4('0x46')]);return _0x45e2e2['getTeams'](_0x496dc2);}})[_0x12f4('0x29')](function(_0x1f94b7){if(_0x1f94b7){_0x44b7dc=_0x1f94b7[_0x12f4('0x3d')];if(!_0x380d90[_0x12f4('0x38')][_0x12f4('0x3e')](_0x12f4('0x3f'))){_0x496dc2['limit']=qs[_0x12f4('0x22')](_0x380d90['query'][_0x12f4('0x22')]);_0x496dc2['offset']=qs[_0x12f4('0x20')](_0x380d90[_0x12f4('0x38')][_0x12f4('0x20')]);}return _0x45e2e2[_0x12f4('0x64')](_0x496dc2);}})[_0x12f4('0x29')](function(_0x248b4a){if(_0x248b4a){return _0x248b4a?{'count':_0x44b7dc,'rows':_0x248b4a}:null;}})['then'](respondWithResult(_0x2c7be1,null))[_0x12f4('0x4d')](handleError(_0x2c7be1,null));};exports[_0x12f4('0x65')]=function(_0x7a139,_0x20d4dc,_0x30fabd){var _0x1055f7=_0x7a139[_0x12f4('0x56')]['ids'];return db[_0x12f4('0x66')]['findAll']({'where':{'id':_0x1055f7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x12f4('0x67'),'attributes':['id',_0x12f4('0x2e'),_0x12f4('0x68'),_0x12f4('0x69'),_0x12f4('0x6a')],'raw':!![]}]})[_0x12f4('0x29')](function(_0xb52552){if(_0xb52552){var _0x4c8c61=_['flatMap'](_0xb52552,function(_0x3c2fda){var _0x1c5b0f=_0x3c2fda[_0x12f4('0x2a')]({'plain':!![]});return _0x1c5b0f['Agents'];});return db[_0x12f4('0x31')]['find']({'where':{'id':_0x7a139[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](function(_0x542d50){return db[_0x12f4('0x6b')][_0x12f4('0x6c')](function(_0x25dea4){return _0x542d50[_0x12f4('0x65')](_0x1055f7,{'transaction':_0x25dea4})[_0x12f4('0x29')](function(){return BPromise[_0x12f4('0x6d')](_0x4c8c61,function(_0x3b6151){return db['UserFaxQueue'][_0x12f4('0x6e')]({'where':{'UserId':_0x3b6151['id'],'FaxQueueId':_0x7a139[_0x12f4('0x4b')]['id']},'transaction':_0x25dea4});});})['then'](function(){_0x4c8c61[_0x12f4('0x6f')](function(_0x5b81a1){socket['emit'](_0x12f4('0x70'),{'UserId':_0x5b81a1['id'],'FaxQueueId':_0x542d50['id']});});});});});}})[_0x12f4('0x29')](respondWithStatusCode(_0x20d4dc,null))[_0x12f4('0x4d')](handleError(_0x20d4dc,null));};exports[_0x12f4('0x71')]=function(_0x395517,_0x3578c0,_0x5aac2d){return db[_0x12f4('0x66')][_0x12f4('0x48')]({'where':{'id':_0x395517[_0x12f4('0x38')][_0x12f4('0x72')]},'attributes':['id'],'include':[{'model':db[_0x12f4('0x5c')],'as':_0x12f4('0x67'),'attributes':['id'],'raw':!![]}]})[_0x12f4('0x29')](handleEntityNotFound(_0x3578c0,null))[_0x12f4('0x29')](function(_0x17d0cb){var _0x37ee0d=_[_0x12f4('0x30')](_0x17d0cb,'id');var _0x54e3d2=[];var _0x505633=[];var _0x3f78d4=squel[_0x12f4('0x73')]();_0x3f78d4[_0x12f4('0x74')](_0x12f4('0x75'))[_0x12f4('0x76')](_0x12f4('0x77'),'tq')['join'](_0x12f4('0x78'),'ut',_0x12f4('0x79'))['where']('FaxQueueId\x20=\x20?',_0x395517['params']['id']);for(var _0x1d3367=0x0;_0x1d3367<_0x17d0cb[_0x12f4('0x3d')];_0x1d3367+=0x1){let _0x39ba97=_0x17d0cb[_0x1d3367];for(var _0x3b7a7a=0x0;_0x3b7a7a<_0x39ba97[_0x12f4('0x67')][_0x12f4('0x3d')];_0x3b7a7a+=0x1){let _0x3395de=_0x39ba97[_0x12f4('0x67')][_0x3b7a7a];var _0x52b3f2=_0x3f78d4[_0x12f4('0x7a')]();_0x52b3f2[_0x12f4('0x42')]('ut.UserId\x20=\x20?',_0x3395de['id']);_0x505633[_0x12f4('0x7b')](db[_0x12f4('0x6b')][_0x12f4('0x38')](_0x52b3f2[_0x12f4('0x7c')](),{'type':db[_0x12f4('0x6b')][_0x12f4('0x7d')][_0x12f4('0x7e')]})[_0x12f4('0x29')](function(_0xe43fdf){if(_0xe43fdf[_0x12f4('0x3d')]===0x1){return _0x3395de['id'];}else{var _0x2dade8=_[_0x12f4('0x7f')](_[_0x12f4('0x30')](_0xe43fdf,_0x12f4('0x80')),function(_0x5f3081){return _[_0x12f4('0x81')](_0x37ee0d,_0x5f3081);});if(_0x2dade8){return _0x3395de['id'];}}}));}}return BPromise[_0x12f4('0x82')](_0x505633)[_0x12f4('0x29')](function(_0x328119){_0x54e3d2=_(_0x54e3d2)['union'](_0x328119)['compact']()[_0x12f4('0x83')]();return db[_0x12f4('0x31')]['find']({'where':{'id':_0x395517[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](function(_0x52a696){return db[_0x12f4('0x6b')][_0x12f4('0x6c')](function(_0x409ce2){return _0x52a696[_0x12f4('0x71')](_0x395517['query']['ids'],{'transaction':_0x409ce2})[_0x12f4('0x29')](function(){if(!_[_0x12f4('0x84')](_0x54e3d2)){return _0x52a696['removeAgents'](_0x54e3d2,{'transaction':_0x409ce2});}})[_0x12f4('0x29')](function(){_0x54e3d2['forEach'](function(_0x4d19ab){socket[_0x12f4('0x85')](_0x12f4('0x86'),{'UserId':_0x4d19ab,'FaxQueueId':_0x52a696['id']});});});});});});})[_0x12f4('0x29')](respondWithStatusCode(_0x3578c0,null))[_0x12f4('0x4d')](handleError(_0x3578c0,null));};exports[_0x12f4('0x87')]=function(_0x1e1d26,_0x56c6a5,_0x15284b){return db['FaxQueue'][_0x12f4('0x57')]({'where':{'id':_0x1e1d26[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](handleEntityNotFound(_0x56c6a5,null))[_0x12f4('0x29')](function(_0xa3fa75){if(_0xa3fa75){return _0xa3fa75[_0x12f4('0x87')](_0x1e1d26[_0x12f4('0x56')][_0x12f4('0x72')],_[_0x12f4('0x88')](_0x1e1d26['body'],[_0x12f4('0x72'),'id'])||{})[_0x12f4('0x89')](function(_0x5bb897){for(var _0xbeb5cf=0x0;_0xbeb5cf<_0x1e1d26[_0x12f4('0x56')][_0x12f4('0x72')][_0x12f4('0x3d')];_0xbeb5cf+=0x1){socket[_0x12f4('0x85')](_0x12f4('0x70'),{'UserId':Number(_0x1e1d26['body'][_0x12f4('0x72')][_0xbeb5cf]),'FaxQueueId':Number(_0x1e1d26[_0x12f4('0x4b')]['id'])});}return _0x5bb897;});}})[_0x12f4('0x29')](respondWithResult(_0x56c6a5,null))[_0x12f4('0x4d')](handleError(_0x56c6a5,null));};exports['removeAgents']=function(_0x528fa8,_0x37bfe3,_0x322f7b){return db[_0x12f4('0x31')]['find']({'where':{'id':_0x528fa8[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](handleEntityNotFound(_0x37bfe3,null))['then'](function(_0x401462){if(_0x401462){return _0x401462['removeAgents'](_0x528fa8[_0x12f4('0x38')][_0x12f4('0x72')])[_0x12f4('0x29')](function(){if(_[_0x12f4('0x8a')](_0x528fa8[_0x12f4('0x38')][_0x12f4('0x72')])){for(var _0x50c37e=0x0;_0x50c37e<_0x528fa8[_0x12f4('0x38')][_0x12f4('0x72')][_0x12f4('0x3d')];_0x50c37e+=0x1){socket[_0x12f4('0x85')](_0x12f4('0x86'),{'UserId':Number(_0x528fa8['query']['ids'][_0x50c37e]),'FaxQueueId':Number(_0x528fa8[_0x12f4('0x4b')]['id'])});}}else{socket[_0x12f4('0x85')]('userFaxQueue:remove',{'UserId':Number(_0x528fa8[_0x12f4('0x38')][_0x12f4('0x72')]),'FaxQueueId':Number(_0x528fa8[_0x12f4('0x4b')]['id'])});}});}})[_0x12f4('0x29')](respondWithStatusCode(_0x37bfe3,null))[_0x12f4('0x4d')](handleError(_0x37bfe3,null));};exports[_0x12f4('0x8b')]=function(_0x4a6f03,_0x2d7c05,_0x4c072e){var _0x57791d={};var _0x32dd6e={};var _0x346f40;var _0x40e9de;return db[_0x12f4('0x31')][_0x12f4('0x59')]({'where':{'id':_0x4a6f03[_0x12f4('0x4b')]['id']}})[_0x12f4('0x29')](handleEntityNotFound(_0x2d7c05,null))[_0x12f4('0x29')](function(_0x27d1d0){if(_0x27d1d0){_0x346f40=_0x27d1d0;_0x32dd6e[_0x12f4('0x36')]=_[_0x12f4('0x37')](db[_0x12f4('0x5c')][_0x12f4('0x32')]);_0x32dd6e[_0x12f4('0x38')]=_['keys'](_0x4a6f03[_0x12f4('0x38')]);_0x32dd6e[_0x12f4('0x39')]=_[_0x12f4('0x3b')](_0x32dd6e[_0x12f4('0x36')],_0x32dd6e[_0x12f4('0x38')]);_0x57791d[_0x12f4('0x3a')]=_[_0x12f4('0x3b')](_0x32dd6e[_0x12f4('0x36')],qs['fields'](_0x4a6f03[_0x12f4('0x38')]['fields']));_0x57791d[_0x12f4('0x3a')]=_0x57791d[_0x12f4('0x3a')]['length']?_0x57791d[_0x12f4('0x3a')]:_0x32dd6e[_0x12f4('0x36')];_0x57791d['order']=qs[_0x12f4('0x41')](_0x4a6f03[_0x12f4('0x38')][_0x12f4('0x41')]);_0x57791d[_0x12f4('0x42')]=qs['filters'](_[_0x12f4('0x43')](_0x4a6f03[_0x12f4('0x38')],_0x32dd6e[_0x12f4('0x39')]));if(_0x4a6f03['query'][_0x12f4('0x44')]){_0x57791d['where']=_[_0x12f4('0x45')](_0x57791d[_0x12f4('0x42')],{'$or':_[_0x12f4('0x30')](_0x57791d['attributes'],function(_0x5a6cab){var _0x4ade0d={};_0x4ade0d[_0x5a6cab]={'$like':'%'+_0x4a6f03['query'][_0x12f4('0x44')]+'%'};return _0x4ade0d;})});}_0x57791d=_[_0x12f4('0x45')]({},_0x57791d,_0x4a6f03[_0x12f4('0x46')]);return _0x346f40[_0x12f4('0x8b')](_0x57791d);}})[_0x12f4('0x29')](function(_0x1cb224){if(_0x1cb224){_0x40e9de=_0x1cb224[_0x12f4('0x3d')];if(!_0x4a6f03[_0x12f4('0x38')][_0x12f4('0x3e')]('nolimit')){_0x57791d[_0x12f4('0x22')]=qs[_0x12f4('0x22')](_0x4a6f03[_0x12f4('0x38')][_0x12f4('0x22')]);_0x57791d[_0x12f4('0x20')]=qs[_0x12f4('0x20')](_0x4a6f03['query']['offset']);}return _0x346f40[_0x12f4('0x8b')](_0x57791d);}})[_0x12f4('0x29')](function(_0x275abb){if(_0x275abb){return _0x275abb?{'count':_0x40e9de,'rows':_0x275abb}:null;}})[_0x12f4('0x29')](respondWithResult(_0x2d7c05,null))[_0x12f4('0x4d')](handleError(_0x2d7c05,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5eb882b..366c7de 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 _0xf2a0=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0xf2a0,0x126));var _0x0f2a=function(_0x3e1a10,_0x6aeaf2){_0x3e1a10=_0x3e1a10-0x0;var _0x2fb8ee=_0xf2a0[_0x3e1a10];return _0x2fb8ee;};'use strict';var EventEmitter=require(_0x0f2a('0x0'));var FaxQueue=require(_0x0f2a('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0f2a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0f2a('0x3')};function emitEvent(_0x11ae4f){return function(_0x471f75,_0x3f3b67,_0x5c3b99){FaxQueueEvents[_0x0f2a('0x4')](_0x11ae4f+':'+_0x471f75['id'],_0x471f75);FaxQueueEvents['emit'](_0x11ae4f,_0x471f75);_0x5c3b99(null);};}for(var e in events){if(events[_0x0f2a('0x5')](e)){var event=events[e];FaxQueue[_0x0f2a('0x6')](e,emitEvent(event));}}module[_0x0f2a('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x32d5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','FaxQueue'];(function(_0x18bf25,_0x1d8405){var _0x568540=function(_0x3fd485){while(--_0x3fd485){_0x18bf25['push'](_0x18bf25['shift']());}};_0x568540(++_0x1d8405);}(_0x32d5,0x6e));var _0x532d=function(_0x41e219,_0x1e8307){_0x41e219=_0x41e219-0x0;var _0x54b011=_0x32d5[_0x41e219];return _0x54b011;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x532d('0x0'))['db'][_0x532d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x532d('0x2')](0x0);var events={'afterCreate':_0x532d('0x3'),'afterUpdate':_0x532d('0x4'),'afterDestroy':_0x532d('0x5')};function emitEvent(_0x2999f5){return function(_0x3881ed,_0xf727d1,_0xc3f900){FaxQueueEvents['emit'](_0x2999f5+':'+_0x3881ed['id'],_0x3881ed);FaxQueueEvents[_0x532d('0x6')](_0x2999f5,_0x3881ed);_0xc3f900(null);};}for(var e in events){if(events[_0x532d('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 43fa3b5..da868cc 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 _0xe586=['api','moment','bluebird','request-promise','path','rimraf','exports','define','lodash','util'];(function(_0x4282aa,_0xe66504){var _0x5085f0=function(_0x73b59e){while(--_0x73b59e){_0x4282aa['push'](_0x4282aa['shift']());}};_0x5085f0(++_0xe66504);}(_0xe586,0xb2));var _0x6e58=function(_0x214994,_0x26ac5f){_0x214994=_0x214994-0x0;var _0x23be80=_0xe586[_0x214994];return _0x23be80;};'use strict';var _=require(_0x6e58('0x0'));var util=require(_0x6e58('0x1'));var logger=require('../../config/logger')(_0x6e58('0x2'));var moment=require(_0x6e58('0x3'));var BPromise=require(_0x6e58('0x4'));var rp=require(_0x6e58('0x5'));var fs=require('fs');var path=require(_0x6e58('0x6'));var rimraf=require(_0x6e58('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x6e58('0x8')]=function(_0x48be10,_0x4abe5e){return _0x48be10[_0x6e58('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa978=['api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash'];(function(_0x55c3c7,_0x548541){var _0x762ab3=function(_0x272e8a){while(--_0x272e8a){_0x55c3c7['push'](_0x55c3c7['shift']());}};_0x762ab3(++_0x548541);}(_0xa978,0xdb));var _0x8a97=function(_0x395a89,_0xf2bb91){_0x395a89=_0x395a89-0x0;var _0x2b6a94=_0xa978[_0x395a89];return _0x2b6a94;};'use strict';var _=require(_0x8a97('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8a97('0x1'));var moment=require(_0x8a97('0x2'));var BPromise=require(_0x8a97('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a97('0x4'));var rimraf=require(_0x8a97('0x5'));var config=require(_0x8a97('0x6'));var attributes=require(_0x8a97('0x7'));module[_0x8a97('0x8')]=function(_0x105ddc,_0x48f617){return _0x105ddc['define'](_0x8a97('0x9'),attributes,{'tableName':_0x8a97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ab6c46a..9f36512 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 _0xaf27=['request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','map','include','model','info','stringify','find','raw','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xaf27,0x6e));var _0x7af2=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xaf27[_0xaaf2e2];return _0x28bc36;};'use strict';var _=require(_0x7af2('0x0'));var util=require(_0x7af2('0x1'));var moment=require(_0x7af2('0x2'));var BPromise=require(_0x7af2('0x3'));var rs=require(_0x7af2('0x4'));var fs=require('fs');var Redis=require(_0x7af2('0x5'));var db=require(_0x7af2('0x6'))['db'];var utils=require(_0x7af2('0x7'));var logger=require(_0x7af2('0x8'))(_0x7af2('0x9'));var config=require(_0x7af2('0xa'));var jayson=require(_0x7af2('0xb'));var client=jayson[_0x7af2('0xc')][_0x7af2('0xd')]({'port':0x232a});config['redis']=_[_0x7af2('0xe')](config[_0x7af2('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x7af2('0x10'))(new Redis(config[_0x7af2('0xf')]));require(_0x7af2('0x11'))[_0x7af2('0x12')](socket);function respondWithRpcPromise(_0x334445,_0x49b2e8,_0x4571da){return new BPromise(function(_0x351c05,_0x15295b){return client[_0x7af2('0x13')](_0x334445,_0x4571da)[_0x7af2('0x14')](function(_0x2af75c){logger['info'](_0x7af2('0x15'),_0x49b2e8,_0x7af2('0x16'));logger[_0x7af2('0x17')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x49b2e8,_0x7af2('0x16'),JSON['stringify'](_0x2af75c));if(_0x2af75c[_0x7af2('0x18')]){if(_0x2af75c[_0x7af2('0x18')][_0x7af2('0x19')]===0x1f4){logger[_0x7af2('0x18')](_0x7af2('0x15'),_0x49b2e8,_0x2af75c[_0x7af2('0x18')][_0x7af2('0x1a')]);return _0x15295b(_0x2af75c[_0x7af2('0x18')][_0x7af2('0x1a')]);}logger[_0x7af2('0x18')](_0x7af2('0x15'),_0x49b2e8,_0x2af75c['error']['message']);return _0x351c05(_0x2af75c['error'][_0x7af2('0x1a')]);}else{logger['info'](_0x7af2('0x15'),_0x49b2e8,'request\x20sent');_0x351c05(_0x2af75c[_0x7af2('0x1b')][_0x7af2('0x1a')]);}})[_0x7af2('0x1c')](function(_0x5ca9a4){logger[_0x7af2('0x18')](_0x7af2('0x15'),_0x49b2e8,_0x5ca9a4);_0x15295b(_0x5ca9a4);});});}exports[_0x7af2('0x1d')]=function(_0x5199a4){var _0x14d8f0=this;return new Promise(function(_0x42494e,_0x52307a){return db[_0x7af2('0x1e')][_0x7af2('0x1f')]({'raw':_0x5199a4[_0x7af2('0x20')]?_0x5199a4['options']['raw']===undefined?!![]:![]:!![],'where':_0x5199a4[_0x7af2('0x20')]?_0x5199a4['options'][_0x7af2('0x21')]||null:null,'attributes':_0x5199a4[_0x7af2('0x20')]?_0x5199a4['options'][_0x7af2('0x22')]||null:null,'limit':_0x5199a4['options']?_0x5199a4[_0x7af2('0x20')]['limit']||null:null,'include':_0x5199a4['options']?_0x5199a4[_0x7af2('0x20')]['include']?_[_0x7af2('0x23')](_0x5199a4[_0x7af2('0x20')][_0x7af2('0x24')],function(_0x1a3684){return{'model':db[_0x1a3684['model']],'as':_0x1a3684['as'],'attributes':_0x1a3684[_0x7af2('0x22')],'include':_0x1a3684[_0x7af2('0x24')]?_[_0x7af2('0x23')](_0x1a3684['include'],function(_0x59b493){return{'model':db[_0x59b493[_0x7af2('0x25')]],'as':_0x59b493['as'],'attributes':_0x59b493[_0x7af2('0x22')],'include':_0x59b493[_0x7af2('0x24')]?_[_0x7af2('0x23')](_0x59b493[_0x7af2('0x24')],function(_0x5a46bb){return{'model':db[_0x5a46bb['model']],'as':_0x5a46bb['as'],'attributes':_0x5a46bb[_0x7af2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7af2('0x14')](function(_0x49fc4a){logger[_0x7af2('0x26')]('GetFaxQueue',_0x5199a4);logger[_0x7af2('0x17')]('GetFaxQueue',_0x5199a4,JSON[_0x7af2('0x27')](_0x49fc4a));_0x42494e(_0x49fc4a);})[_0x7af2('0x1c')](function(_0x4f3028){logger[_0x7af2('0x18')](_0x7af2('0x1d'),_0x4f3028[_0x7af2('0x1a')],_0x5199a4);_0x52307a(_0x14d8f0[_0x7af2('0x18')](0x1f4,_0x4f3028[_0x7af2('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x5b88ca){var _0x1728b0=this;return new Promise(function(_0x5a6d33,_0x83bfae){return db[_0x7af2('0x1e')][_0x7af2('0x28')]({'raw':_0x5b88ca[_0x7af2('0x20')]?_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x29')]===undefined?!![]:![]:!![],'where':_0x5b88ca[_0x7af2('0x20')]?_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x21')]||null:null,'attributes':_0x5b88ca['options']?_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x22')]||null:null,'include':_0x5b88ca[_0x7af2('0x20')]?_0x5b88ca[_0x7af2('0x20')]['include']?_[_0x7af2('0x23')](_0x5b88ca[_0x7af2('0x20')][_0x7af2('0x24')],function(_0x19f058){return{'model':db[_0x19f058[_0x7af2('0x25')]],'as':_0x19f058['as'],'attributes':_0x19f058[_0x7af2('0x22')],'include':_0x19f058[_0x7af2('0x24')]?_['map'](_0x19f058[_0x7af2('0x24')],function(_0x33b989){return{'model':db[_0x33b989[_0x7af2('0x25')]],'as':_0x33b989['as'],'attributes':_0x33b989[_0x7af2('0x22')],'include':_0x33b989['include']?_[_0x7af2('0x23')](_0x33b989['include'],function(_0x13eee8){return{'model':db[_0x13eee8[_0x7af2('0x25')]],'as':_0x13eee8['as'],'attributes':_0x13eee8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ab15){logger[_0x7af2('0x26')](_0x7af2('0x2a'),_0x5b88ca);logger[_0x7af2('0x17')](_0x7af2('0x2a'),_0x5b88ca,JSON[_0x7af2('0x27')](_0x19ab15));_0x5a6d33(_0x19ab15);})[_0x7af2('0x1c')](function(_0x8c3c5){logger['error'](_0x7af2('0x2a'),_0x8c3c5[_0x7af2('0x1a')],_0x5b88ca);_0x83bfae(_0x1728b0[_0x7af2('0x18')](0x1f4,_0x8c3c5['message']));});});}; \ No newline at end of file +var _0xa0c0=['stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','attributes','limit','include','map','model','ShowFaxQueue','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x315de3,_0x47fb12){var _0x1d1889=function(_0x54b385){while(--_0x54b385){_0x315de3['push'](_0x315de3['shift']());}};_0x1d1889(++_0x47fb12);}(_0xa0c0,0x139));var _0x0a0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0c0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0a0c('0x0'));var util=require(_0x0a0c('0x1'));var moment=require(_0x0a0c('0x2'));var BPromise=require(_0x0a0c('0x3'));var rs=require(_0x0a0c('0x4'));var fs=require('fs');var Redis=require(_0x0a0c('0x5'));var db=require(_0x0a0c('0x6'))['db'];var utils=require(_0x0a0c('0x7'));var logger=require(_0x0a0c('0x8'))(_0x0a0c('0x9'));var config=require('../../config/environment');var jayson=require(_0x0a0c('0xa'));var client=jayson[_0x0a0c('0xb')][_0x0a0c('0xc')]({'port':0x232a});config[_0x0a0c('0xd')]=_[_0x0a0c('0xe')](config[_0x0a0c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a0c('0xf'))(new Redis(config[_0x0a0c('0xd')]));require(_0x0a0c('0x10'))[_0x0a0c('0x11')](socket);function respondWithRpcPromise(_0x546839,_0x51e18f,_0x13ed70){return new BPromise(function(_0x1180af,_0xdf3f10){return client[_0x0a0c('0x12')](_0x546839,_0x13ed70)['then'](function(_0x6f4df7){logger[_0x0a0c('0x13')](_0x0a0c('0x14'),_0x51e18f,'request\x20sent');logger[_0x0a0c('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x51e18f,_0x0a0c('0x16'),JSON[_0x0a0c('0x17')](_0x6f4df7));if(_0x6f4df7['error']){if(_0x6f4df7[_0x0a0c('0x18')][_0x0a0c('0x19')]===0x1f4){logger[_0x0a0c('0x18')](_0x0a0c('0x14'),_0x51e18f,_0x6f4df7[_0x0a0c('0x18')][_0x0a0c('0x1a')]);return _0xdf3f10(_0x6f4df7[_0x0a0c('0x18')][_0x0a0c('0x1a')]);}logger['error'](_0x0a0c('0x14'),_0x51e18f,_0x6f4df7[_0x0a0c('0x18')][_0x0a0c('0x1a')]);return _0x1180af(_0x6f4df7[_0x0a0c('0x18')]['message']);}else{logger[_0x0a0c('0x13')]('FaxQueue,\x20%s,\x20%s',_0x51e18f,'request\x20sent');_0x1180af(_0x6f4df7[_0x0a0c('0x1b')][_0x0a0c('0x1a')]);}})[_0x0a0c('0x1c')](function(_0x1cbf91){logger[_0x0a0c('0x18')](_0x0a0c('0x14'),_0x51e18f,_0x1cbf91);_0xdf3f10(_0x1cbf91);});});}exports[_0x0a0c('0x1d')]=function(_0x4e79a1){var _0x5297bd=this;return new Promise(function(_0x1eb2c6,_0x2d46b4){return db['FaxQueue'][_0x0a0c('0x1e')]({'raw':_0x4e79a1[_0x0a0c('0x1f')]?_0x4e79a1[_0x0a0c('0x1f')][_0x0a0c('0x20')]===undefined?!![]:![]:!![],'where':_0x4e79a1[_0x0a0c('0x1f')]?_0x4e79a1[_0x0a0c('0x1f')]['where']||null:null,'attributes':_0x4e79a1['options']?_0x4e79a1[_0x0a0c('0x1f')][_0x0a0c('0x21')]||null:null,'limit':_0x4e79a1[_0x0a0c('0x1f')]?_0x4e79a1['options'][_0x0a0c('0x22')]||null:null,'include':_0x4e79a1['options']?_0x4e79a1['options'][_0x0a0c('0x23')]?_[_0x0a0c('0x24')](_0x4e79a1['options']['include'],function(_0x27004e){return{'model':db[_0x27004e['model']],'as':_0x27004e['as'],'attributes':_0x27004e[_0x0a0c('0x21')],'include':_0x27004e[_0x0a0c('0x23')]?_['map'](_0x27004e['include'],function(_0x3b7713){return{'model':db[_0x3b7713[_0x0a0c('0x25')]],'as':_0x3b7713['as'],'attributes':_0x3b7713[_0x0a0c('0x21')],'include':_0x3b7713[_0x0a0c('0x23')]?_[_0x0a0c('0x24')](_0x3b7713[_0x0a0c('0x23')],function(_0x1a3f22){return{'model':db[_0x1a3f22['model']],'as':_0x1a3f22['as'],'attributes':_0x1a3f22[_0x0a0c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32fd1b){logger[_0x0a0c('0x13')](_0x0a0c('0x1d'),_0x4e79a1);logger[_0x0a0c('0x15')](_0x0a0c('0x1d'),_0x4e79a1,JSON['stringify'](_0x32fd1b));_0x1eb2c6(_0x32fd1b);})['catch'](function(_0x4a2ab0){logger['error']('GetFaxQueue',_0x4a2ab0[_0x0a0c('0x1a')],_0x4e79a1);_0x2d46b4(_0x5297bd[_0x0a0c('0x18')](0x1f4,_0x4a2ab0[_0x0a0c('0x1a')]));});});};exports[_0x0a0c('0x26')]=function(_0x37c5b6){var _0x2bd738=this;return new Promise(function(_0x18bf4d,_0x2bf1e5){return db['FaxQueue'][_0x0a0c('0x27')]({'raw':_0x37c5b6[_0x0a0c('0x1f')]?_0x37c5b6['options'][_0x0a0c('0x20')]===undefined?!![]:![]:!![],'where':_0x37c5b6[_0x0a0c('0x1f')]?_0x37c5b6[_0x0a0c('0x1f')][_0x0a0c('0x28')]||null:null,'attributes':_0x37c5b6['options']?_0x37c5b6[_0x0a0c('0x1f')]['attributes']||null:null,'include':_0x37c5b6['options']?_0x37c5b6['options'][_0x0a0c('0x23')]?_[_0x0a0c('0x24')](_0x37c5b6[_0x0a0c('0x1f')][_0x0a0c('0x23')],function(_0x245313){return{'model':db[_0x245313['model']],'as':_0x245313['as'],'attributes':_0x245313[_0x0a0c('0x21')],'include':_0x245313[_0x0a0c('0x23')]?_[_0x0a0c('0x24')](_0x245313['include'],function(_0x498097){return{'model':db[_0x498097[_0x0a0c('0x25')]],'as':_0x498097['as'],'attributes':_0x498097['attributes'],'include':_0x498097[_0x0a0c('0x23')]?_[_0x0a0c('0x24')](_0x498097['include'],function(_0x1afa39){return{'model':db[_0x1afa39[_0x0a0c('0x25')]],'as':_0x1afa39['as'],'attributes':_0x1afa39['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a0c('0x29')](function(_0x25b96d){logger[_0x0a0c('0x13')]('ShowFaxQueue',_0x37c5b6);logger[_0x0a0c('0x15')](_0x0a0c('0x26'),_0x37c5b6,JSON['stringify'](_0x25b96d));_0x18bf4d(_0x25b96d);})[_0x0a0c('0x1c')](function(_0x2bc70d){logger[_0x0a0c('0x18')]('ShowFaxQueue',_0x2bc70d[_0x0a0c('0x1a')],_0x37c5b6);_0x2bf1e5(_0x2bd738['error'](0x1f4,_0x2bc70d[_0x0a0c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 9fe2368..db3cc33 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 _0xf8db=['emit','removeListener','register','./faxQueue.events','remove','update'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xf8db,0x16b));var _0xbf8d=function(_0x40d897,_0x1ebe61){_0x40d897=_0x40d897-0x0;var _0x361118=_0xf8db[_0x40d897];return _0x361118;};'use strict';var FaxQueueEvents=require(_0xbf8d('0x0'));var events=['save',_0xbf8d('0x1'),_0xbf8d('0x2')];function createListener(_0xfb4d27,_0x202b30){return function(_0xc6e9d6){_0x202b30[_0xbf8d('0x3')](_0xfb4d27,_0xc6e9d6);};}function removeListener(_0x4a0446,_0x8c17d1){return function(){FaxQueueEvents[_0xbf8d('0x4')](_0x4a0446,_0x8c17d1);};}exports[_0xbf8d('0x5')]=function(_0x44c765){for(var _0x288269=0x0,_0x12f40d=events['length'];_0x288269<_0x12f40d;_0x288269++){var _0x3b5a99=events[_0x288269];var _0x4f9a83=createListener('faxQueue:'+_0x3b5a99,_0x44c765);FaxQueueEvents['on'](_0x3b5a99,_0x4f9a83);}}; \ No newline at end of file +var _0x9a8b=['update','emit','removeListener','length','./faxQueue.events','save'];(function(_0xbb126b,_0x402157){var _0x3a113b=function(_0x3fb31b){while(--_0x3fb31b){_0xbb126b['push'](_0xbb126b['shift']());}};_0x3a113b(++_0x402157);}(_0x9a8b,0x1ba));var _0xb9a8=function(_0x451a9b,_0x36e9ff){_0x451a9b=_0x451a9b-0x0;var _0x22ee4a=_0x9a8b[_0x451a9b];return _0x22ee4a;};'use strict';var FaxQueueEvents=require(_0xb9a8('0x0'));var events=[_0xb9a8('0x1'),'remove',_0xb9a8('0x2')];function createListener(_0x248a9e,_0x46b660){return function(_0xc0e200){_0x46b660[_0xb9a8('0x3')](_0x248a9e,_0xc0e200);};}function removeListener(_0x1c4a69,_0x5a4662){return function(){FaxQueueEvents[_0xb9a8('0x4')](_0x1c4a69,_0x5a4662);};}exports['register']=function(_0x57c844){for(var _0x291982=0x0,_0xa76cf0=events[_0xb9a8('0x5')];_0x291982<_0xa76cf0;_0x291982++){var _0xdd1394=events[_0x291982];var _0x5301fa=createListener('faxQueue:'+_0xdd1394,_0x57c844);FaxQueueEvents['on'](_0xdd1394,_0x5301fa);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 26c68cd..d3bcbe3 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 _0x741c=['getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1e0522,_0x2a41fa){var _0x2608cf=function(_0x3f855a){while(--_0x3f855a){_0x1e0522['push'](_0x1e0522['shift']());}};_0x2608cf(++_0x2a41fa);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['get']('/:id/members',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0x8')](_0xc741('0xf'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc741('0x11')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0x12')]);router[_0xc741('0x11')](_0xc741('0xf'),auth['isAuthenticated'](),controller[_0xc741('0x13')]);router[_0xc741('0x11')]('/:id/users',auth[_0xc741('0x9')](),controller[_0xc741('0x14')]);router[_0xc741('0x15')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller['update']);router['delete'](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0x16')]);router[_0xc741('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc741('0x18')]);router[_0xc741('0x17')](_0xc741('0x19'),auth['isAuthenticated'](),controller[_0xc741('0x1a')]);module[_0xc741('0x1b')]=router; \ No newline at end of file +var _0xfcf0=['/:id/teams','getTeams','getAgents','create','post','/:id/users','put','update','destroy','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x1817e0,_0x1f535c){var _0x1e529c=function(_0x2b2b45){while(--_0x2b2b45){_0x1817e0['push'](_0x1817e0['shift']());}};_0x1e529c(++_0x1f535c);}(_0xfcf0,0x138));var _0x0fcf=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0xfcf0[_0x43941d];return _0x27b82a;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['get']('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x14')]);router['post']('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x15')]);router[_0x0fcf('0x16')](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller['addTeams']);router[_0x0fcf('0x16')](_0x0fcf('0x17'),auth[_0x0fcf('0xa')](),controller['addAgents']);router[_0x0fcf('0x18')](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x19')]);router['delete'](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1a')]);router[_0x0fcf('0x1b')](_0x0fcf('0x12'),auth['isAuthenticated'](),controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x1b')]('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1d')]);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 567a838..c05e1b0 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 _0xbd3c=['sequelize','exports','STRING','DATE'];(function(_0x542dad,_0x358935){var _0x1e1488=function(_0x106f7b){while(--_0x106f7b){_0x542dad['push'](_0x542dad['shift']());}};_0x1e1488(++_0x358935);}(_0xbd3c,0x184));var _0xcbd3=function(_0x1b50cb,_0x3fcc5b){_0x1b50cb=_0x1b50cb-0x0;var _0x39ce00=_0xbd3c[_0x1b50cb];return _0x39ce00;};'use strict';var moment=require('moment');var Sequelize=require(_0xcbd3('0x0'));module[_0xcbd3('0x1')]={'uniqueid':{'type':Sequelize[_0xcbd3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcbd3('0x2')]},'joinAt':{'type':Sequelize[_0xcbd3('0x3')]},'leaveAt':{'type':Sequelize[_0xcbd3('0x3')]},'acceptAt':{'type':Sequelize[_0xcbd3('0x3')]},'exitAt':{'type':Sequelize[_0xcbd3('0x3')]},'reason':{'type':Sequelize[_0xcbd3('0x2')]}}; \ No newline at end of file +var _0x14b3=['moment','sequelize','exports','STRING','DATE'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x14b3,0xcd));var _0x314b=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x14b3[_0x91d019];return _0x19de1f;};'use strict';var moment=require(_0x314b('0x0'));var Sequelize=require(_0x314b('0x1'));module[_0x314b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x314b('0x3')]},'joinAt':{'type':Sequelize[_0x314b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x314b('0x4')]},'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 e774d74..9bc8201 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 _0xb16f=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','FaxQueueReport','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName'];(function(_0x3b0b2d,_0x4bdcb1){var _0x33dfdf=function(_0x2a83ff){while(--_0x2a83ff){_0x3b0b2d['push'](_0x3b0b2d['shift']());}};_0x33dfdf(++_0x4bdcb1);}(_0xb16f,0xf6));var _0xfb16=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0xb16f[_0x1c6efd];return _0x53a918;};'use strict';var emlformat=require(_0xfb16('0x0'));var rimraf=require(_0xfb16('0x1'));var zipdir=require(_0xfb16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb16('0x3'));var moment=require(_0xfb16('0x4'));var BPromise=require(_0xfb16('0x5'));var Mustache=require(_0xfb16('0x6'));var util=require('util');var path=require(_0xfb16('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb16('0x8'));var squel=require('squel');var crypto=require(_0xfb16('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfb16('0xa'));var toCsv=require(_0xfb16('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb16('0xc'));var qs=require(_0xfb16('0xd'));var as=require(_0xfb16('0xe'));var hardwareService=require(_0xfb16('0xf'));var logger=require(_0xfb16('0x10'))(_0xfb16('0x11'));var utils=require(_0xfb16('0x12'));var config=require(_0xfb16('0x13'));var licenseUtil=require(_0xfb16('0x14'));var db=require(_0xfb16('0x15'))['db'];function respondWithStatusCode(_0x3a8de2,_0x4f3a00){_0x4f3a00=_0x4f3a00||0xcc;return function(_0xd6eeee){if(_0xd6eeee){return _0x3a8de2['sendStatus'](_0x4f3a00);}return _0x3a8de2['status'](_0x4f3a00)[_0xfb16('0x16')]();};}function respondWithResult(_0x89a4b8,_0x4cdc87){_0x4cdc87=_0x4cdc87||0xc8;return function(_0x507bcc){if(_0x507bcc){return _0x89a4b8[_0xfb16('0x17')](_0x4cdc87)[_0xfb16('0x18')](_0x507bcc);}};}function respondWithFilteredResult(_0x4708c2,_0x1643cc){return function(_0x28cb87){if(_0x28cb87){var _0xcf5a5=typeof _0x1643cc[_0xfb16('0x19')]===_0xfb16('0x1a')&&typeof _0x1643cc[_0xfb16('0x1b')]===_0xfb16('0x1a');var _0x1748fb=_0x28cb87[_0xfb16('0x1c')];var _0x3b0064=_0xcf5a5?0x0:_0x1643cc[_0xfb16('0x19')];var _0x51078f=_0xcf5a5?_0x28cb87[_0xfb16('0x1c')]:_0x1643cc[_0xfb16('0x19')]+_0x1643cc[_0xfb16('0x1b')];var _0x5af84a;if(_0x51078f>=_0x1748fb){_0x51078f=_0x1748fb;_0x5af84a=0xc8;}else{_0x5af84a=0xce;}_0x4708c2['status'](_0x5af84a);return _0x4708c2[_0xfb16('0x1d')](_0xfb16('0x1e'),_0x3b0064+'-'+_0x51078f+'/'+_0x1748fb)[_0xfb16('0x18')](_0x28cb87);}return null;};}function patchUpdates(_0x5394a8){return function(_0x193162){try{jsonpatch[_0xfb16('0x1f')](_0x193162,_0x5394a8,!![]);}catch(_0x17bdd0){return BPromise['reject'](_0x17bdd0);}return _0x193162['save']();};}function saveUpdates(_0x544b4b,_0x27203c){return function(_0x354ef4){if(_0x354ef4){return _0x354ef4[_0xfb16('0x20')](_0x544b4b)[_0xfb16('0x21')](function(_0x502d60){return _0x502d60;});}return null;};}function removeEntity(_0x5814e9,_0x8ef26c){return function(_0x2aea90){if(_0x2aea90){return _0x2aea90[_0xfb16('0x22')]()[_0xfb16('0x21')](function(){_0x5814e9[_0xfb16('0x17')](0xcc)[_0xfb16('0x16')]();});}};}function handleEntityNotFound(_0x15b3b8,_0x239633){return function(_0x1335a3){if(!_0x1335a3){_0x15b3b8[_0xfb16('0x23')](0x194);}return _0x1335a3;};}function handleError(_0x177b67,_0x4c194a){_0x4c194a=_0x4c194a||0x1f4;return function(_0x1ca17b){logger[_0xfb16('0x24')](_0x1ca17b[_0xfb16('0x25')]);if(_0x1ca17b[_0xfb16('0x26')]){delete _0x1ca17b[_0xfb16('0x26')];}_0x177b67['status'](_0x4c194a)[_0xfb16('0x27')](_0x1ca17b);};}exports['index']=function(_0x407379,_0x21822b){var _0xe1a799={},_0x1a92ce={},_0x19fb63={'count':0x0,'rows':[]};var _0x49d03e=_[_0xfb16('0x28')](db['FaxQueueReport']['rawAttributes'],function(_0x4f40ce){return{'name':_0x4f40ce[_0xfb16('0x29')],'type':_0x4f40ce['type']['key']};});_0x1a92ce['model']=_[_0xfb16('0x28')](_0x49d03e,_0xfb16('0x26'));_0x1a92ce[_0xfb16('0x2a')]=_[_0xfb16('0x2b')](_0x407379[_0xfb16('0x2a')]);_0x1a92ce[_0xfb16('0x2c')]=_[_0xfb16('0x2d')](_0x1a92ce[_0xfb16('0x2e')],_0x1a92ce['query']);_0xe1a799[_0xfb16('0x2f')]=_[_0xfb16('0x2d')](_0x1a92ce[_0xfb16('0x2e')],qs['fields'](_0x407379[_0xfb16('0x2a')][_0xfb16('0x30')]));_0xe1a799[_0xfb16('0x2f')]=_0xe1a799[_0xfb16('0x2f')]['length']?_0xe1a799[_0xfb16('0x2f')]:_0x1a92ce['model'];if(!_0x407379[_0xfb16('0x2a')][_0xfb16('0x31')](_0xfb16('0x32'))){_0xe1a799['limit']=qs[_0xfb16('0x1b')](_0x407379[_0xfb16('0x2a')][_0xfb16('0x1b')]);_0xe1a799[_0xfb16('0x19')]=qs['offset'](_0x407379['query'][_0xfb16('0x19')]);}_0xe1a799['order']=qs[_0xfb16('0x33')](_0x407379[_0xfb16('0x2a')][_0xfb16('0x33')]);_0xe1a799[_0xfb16('0x34')]=qs['filters'](_[_0xfb16('0x35')](_0x407379['query'],_0x1a92ce[_0xfb16('0x2c')]),_0x49d03e);if(_0x407379[_0xfb16('0x2a')][_0xfb16('0x36')]){_0xe1a799[_0xfb16('0x34')]=_['merge'](_0xe1a799[_0xfb16('0x34')],{'$or':_[_0xfb16('0x28')](_0x49d03e,function(_0x48f23b){if(_0x48f23b[_0xfb16('0x37')]!=='VIRTUAL'){var _0x2191b0={};_0x2191b0[_0x48f23b[_0xfb16('0x26')]]={'$like':'%'+_0x407379[_0xfb16('0x2a')][_0xfb16('0x36')]+'%'};return _0x2191b0;}})});}_0xe1a799=_[_0xfb16('0x38')]({},_0xe1a799,_0x407379[_0xfb16('0x39')]);var _0x450e16={'where':_0xe1a799['where']};return db['FaxQueueReport'][_0xfb16('0x1c')](_0x450e16)['then'](function(_0x186e5a){_0x19fb63[_0xfb16('0x1c')]=_0x186e5a;if(_0x407379[_0xfb16('0x2a')]['includeAll']){_0xe1a799['include']=[{'all':!![]}];}return db[_0xfb16('0x3a')][_0xfb16('0x3b')](_0xe1a799);})[_0xfb16('0x21')](function(_0x52eafd){_0x19fb63[_0xfb16('0x3c')]=_0x52eafd;return _0x19fb63;})[_0xfb16('0x21')](respondWithFilteredResult(_0x21822b,_0xe1a799))[_0xfb16('0x3d')](handleError(_0x21822b,null));};exports[_0xfb16('0x3e')]=function(_0x33df7e,_0x37266a){var _0x554c5b={'raw':!![],'where':{'id':_0x33df7e[_0xfb16('0x3f')]['id']}},_0x223045={};_0x223045[_0xfb16('0x2e')]=_['keys'](db['FaxQueueReport'][_0xfb16('0x40')]);_0x223045[_0xfb16('0x2a')]=_['keys'](_0x33df7e[_0xfb16('0x2a')]);_0x223045['filters']=_[_0xfb16('0x2d')](_0x223045['model'],_0x223045[_0xfb16('0x2a')]);_0x554c5b['attributes']=_['intersection'](_0x223045[_0xfb16('0x2e')],qs[_0xfb16('0x30')](_0x33df7e[_0xfb16('0x2a')]['fields']));_0x554c5b['attributes']=_0x554c5b[_0xfb16('0x2f')][_0xfb16('0x41')]?_0x554c5b[_0xfb16('0x2f')]:_0x223045[_0xfb16('0x2e')];if(_0x33df7e[_0xfb16('0x2a')][_0xfb16('0x42')]){_0x554c5b[_0xfb16('0x43')]=[{'all':!![]}];}_0x554c5b=_['merge']({},_0x554c5b,_0x33df7e['options']);return db[_0xfb16('0x3a')][_0xfb16('0x44')](_0x554c5b)[_0xfb16('0x21')](handleEntityNotFound(_0x37266a,null))[_0xfb16('0x21')](respondWithResult(_0x37266a,null))['catch'](handleError(_0x37266a,null));};exports[_0xfb16('0x45')]=function(_0x7a90b6,_0x44a792){return db[_0xfb16('0x3a')]['create'](_0x7a90b6[_0xfb16('0x46')],{})[_0xfb16('0x21')](respondWithResult(_0x44a792,0xc9))[_0xfb16('0x3d')](handleError(_0x44a792,null));};exports[_0xfb16('0x20')]=function(_0x131e4d,_0x3820d6){if(_0x131e4d[_0xfb16('0x46')]['id']){delete _0x131e4d[_0xfb16('0x46')]['id'];}return db[_0xfb16('0x3a')][_0xfb16('0x44')]({'where':{'id':_0x131e4d[_0xfb16('0x3f')]['id']}})[_0xfb16('0x21')](handleEntityNotFound(_0x3820d6,null))['then'](saveUpdates(_0x131e4d[_0xfb16('0x46')],null))[_0xfb16('0x21')](respondWithResult(_0x3820d6,null))['catch'](handleError(_0x3820d6,null));};exports[_0xfb16('0x22')]=function(_0x279620,_0x3ac1f9){return db[_0xfb16('0x3a')][_0xfb16('0x44')]({'where':{'id':_0x279620[_0xfb16('0x3f')]['id']}})[_0xfb16('0x21')](handleEntityNotFound(_0x3ac1f9,null))[_0xfb16('0x21')](removeEntity(_0x3ac1f9,null))[_0xfb16('0x3d')](handleError(_0x3ac1f9,null));};exports[_0xfb16('0x47')]=function(_0x7ca35c,_0x260076){return db['FaxQueueReport'][_0xfb16('0x47')]()[_0xfb16('0x21')](respondWithResult(_0x260076,null))[_0xfb16('0x3d')](handleError(_0x260076,null));}; \ No newline at end of file +var _0x8d9b=['offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count'];(function(_0x124fbe,_0x5a9dfe){var _0x4700d5=function(_0x1829cb){while(--_0x1829cb){_0x124fbe['push'](_0x124fbe['shift']());}};_0x4700d5(++_0x5a9dfe);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb8d9('0x0'));var rimraf=require(_0xb8d9('0x1'));var zipdir=require(_0xb8d9('0x2'));var jsonpatch=require(_0xb8d9('0x3'));var rp=require(_0xb8d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8d9('0x5'));var util=require('util');var path=require(_0xb8d9('0x6'));var sox=require(_0xb8d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8d9('0x9'));var toCsv=require(_0xb8d9('0xa'));var querystring=require(_0xb8d9('0xb'));var Papa=require(_0xb8d9('0xc'));var Redis=require(_0xb8d9('0xd'));var authService=require(_0xb8d9('0xe'));var qs=require(_0xb8d9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d9('0x10'));var logger=require('../../config/logger')(_0xb8d9('0x11'));var utils=require(_0xb8d9('0x12'));var config=require(_0xb8d9('0x13'));var licenseUtil=require(_0xb8d9('0x14'));var db=require(_0xb8d9('0x15'))['db'];function respondWithStatusCode(_0x13b1d8,_0x10b7fe){_0x10b7fe=_0x10b7fe||0xcc;return function(_0x265472){if(_0x265472){return _0x13b1d8[_0xb8d9('0x16')](_0x10b7fe);}return _0x13b1d8[_0xb8d9('0x17')](_0x10b7fe)[_0xb8d9('0x18')]();};}function respondWithResult(_0x4b0f9,_0x1bcb02){_0x1bcb02=_0x1bcb02||0xc8;return function(_0xb3fa68){if(_0xb3fa68){return _0x4b0f9['status'](_0x1bcb02)[_0xb8d9('0x19')](_0xb3fa68);}};}function respondWithFilteredResult(_0x2c5265,_0x513edf){return function(_0x24f33a){if(_0x24f33a){var _0x283780=typeof _0x513edf['offset']==='undefined'&&typeof _0x513edf['limit']===_0xb8d9('0x1a');var _0x2d1b34=_0x24f33a[_0xb8d9('0x1b')];var _0x1183e4=_0x283780?0x0:_0x513edf['offset'];var _0x31b33f=_0x283780?_0x24f33a['count']:_0x513edf[_0xb8d9('0x1c')]+_0x513edf[_0xb8d9('0x1d')];var _0x447367;if(_0x31b33f>=_0x2d1b34){_0x31b33f=_0x2d1b34;_0x447367=0xc8;}else{_0x447367=0xce;}_0x2c5265[_0xb8d9('0x17')](_0x447367);return _0x2c5265[_0xb8d9('0x1e')]('Content-Range',_0x1183e4+'-'+_0x31b33f+'/'+_0x2d1b34)['json'](_0x24f33a);}return null;};}function patchUpdates(_0x5444a5){return function(_0x42f600){try{jsonpatch[_0xb8d9('0x1f')](_0x42f600,_0x5444a5,!![]);}catch(_0x15495f){return BPromise[_0xb8d9('0x20')](_0x15495f);}return _0x42f600[_0xb8d9('0x21')]();};}function saveUpdates(_0x48c504,_0x963afa){return function(_0x430794){if(_0x430794){return _0x430794[_0xb8d9('0x22')](_0x48c504)[_0xb8d9('0x23')](function(_0x3cefe3){return _0x3cefe3;});}return null;};}function removeEntity(_0x1d94aa,_0x3f4b9d){return function(_0x3d1659){if(_0x3d1659){return _0x3d1659[_0xb8d9('0x24')]()[_0xb8d9('0x23')](function(){_0x1d94aa['status'](0xcc)[_0xb8d9('0x18')]();});}};}function handleEntityNotFound(_0x49380d,_0x52b730){return function(_0x1eb6ee){if(!_0x1eb6ee){_0x49380d[_0xb8d9('0x16')](0x194);}return _0x1eb6ee;};}function handleError(_0x43c9f1,_0x33c75e){_0x33c75e=_0x33c75e||0x1f4;return function(_0x30b346){logger['error'](_0x30b346[_0xb8d9('0x25')]);if(_0x30b346[_0xb8d9('0x26')]){delete _0x30b346[_0xb8d9('0x26')];}_0x43c9f1['status'](_0x33c75e)[_0xb8d9('0x27')](_0x30b346);};}exports[_0xb8d9('0x28')]=function(_0x336918,_0x4ecdaa){var _0x24a9cf={},_0x12a043={},_0x523e6c={'count':0x0,'rows':[]};var _0x344e27=_[_0xb8d9('0x29')](db[_0xb8d9('0x2a')][_0xb8d9('0x2b')],function(_0x358e4d){return{'name':_0x358e4d[_0xb8d9('0x2c')],'type':_0x358e4d[_0xb8d9('0x2d')][_0xb8d9('0x2e')]};});_0x12a043[_0xb8d9('0x2f')]=_[_0xb8d9('0x29')](_0x344e27,'name');_0x12a043[_0xb8d9('0x30')]=_[_0xb8d9('0x31')](_0x336918[_0xb8d9('0x30')]);_0x12a043['filters']=_[_0xb8d9('0x32')](_0x12a043[_0xb8d9('0x2f')],_0x12a043[_0xb8d9('0x30')]);_0x24a9cf[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x12a043[_0xb8d9('0x2f')],qs['fields'](_0x336918['query'][_0xb8d9('0x34')]));_0x24a9cf[_0xb8d9('0x33')]=_0x24a9cf[_0xb8d9('0x33')][_0xb8d9('0x35')]?_0x24a9cf[_0xb8d9('0x33')]:_0x12a043[_0xb8d9('0x2f')];if(!_0x336918['query']['hasOwnProperty'](_0xb8d9('0x36'))){_0x24a9cf[_0xb8d9('0x1d')]=qs[_0xb8d9('0x1d')](_0x336918['query'][_0xb8d9('0x1d')]);_0x24a9cf['offset']=qs[_0xb8d9('0x1c')](_0x336918[_0xb8d9('0x30')][_0xb8d9('0x1c')]);}_0x24a9cf['order']=qs[_0xb8d9('0x37')](_0x336918[_0xb8d9('0x30')]['sort']);_0x24a9cf['where']=qs[_0xb8d9('0x38')](_[_0xb8d9('0x39')](_0x336918[_0xb8d9('0x30')],_0x12a043[_0xb8d9('0x38')]),_0x344e27);if(_0x336918[_0xb8d9('0x30')][_0xb8d9('0x3a')]){_0x24a9cf[_0xb8d9('0x3b')]=_[_0xb8d9('0x3c')](_0x24a9cf[_0xb8d9('0x3b')],{'$or':_[_0xb8d9('0x29')](_0x344e27,function(_0x307936){if(_0x307936[_0xb8d9('0x2d')]!==_0xb8d9('0x3d')){var _0x328b78={};_0x328b78[_0x307936['name']]={'$like':'%'+_0x336918['query'][_0xb8d9('0x3a')]+'%'};return _0x328b78;}})});}_0x24a9cf=_[_0xb8d9('0x3c')]({},_0x24a9cf,_0x336918[_0xb8d9('0x3e')]);var _0x7da436={'where':_0x24a9cf['where']};return db['FaxQueueReport'][_0xb8d9('0x1b')](_0x7da436)['then'](function(_0x639f96){_0x523e6c['count']=_0x639f96;if(_0x336918[_0xb8d9('0x30')]['includeAll']){_0x24a9cf[_0xb8d9('0x3f')]=[{'all':!![]}];}return db[_0xb8d9('0x2a')][_0xb8d9('0x40')](_0x24a9cf);})['then'](function(_0x40fd3e){_0x523e6c[_0xb8d9('0x41')]=_0x40fd3e;return _0x523e6c;})[_0xb8d9('0x23')](respondWithFilteredResult(_0x4ecdaa,_0x24a9cf))['catch'](handleError(_0x4ecdaa,null));};exports['show']=function(_0x580d4f,_0x587c34){var _0x4f7393={'raw':!![],'where':{'id':_0x580d4f[_0xb8d9('0x42')]['id']}},_0xc1816a={};_0xc1816a[_0xb8d9('0x2f')]=_['keys'](db['FaxQueueReport'][_0xb8d9('0x2b')]);_0xc1816a['query']=_[_0xb8d9('0x31')](_0x580d4f[_0xb8d9('0x30')]);_0xc1816a[_0xb8d9('0x38')]=_[_0xb8d9('0x32')](_0xc1816a[_0xb8d9('0x2f')],_0xc1816a['query']);_0x4f7393[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0xc1816a['model'],qs[_0xb8d9('0x34')](_0x580d4f[_0xb8d9('0x30')]['fields']));_0x4f7393['attributes']=_0x4f7393[_0xb8d9('0x33')][_0xb8d9('0x35')]?_0x4f7393[_0xb8d9('0x33')]:_0xc1816a[_0xb8d9('0x2f')];if(_0x580d4f[_0xb8d9('0x30')]['includeAll']){_0x4f7393[_0xb8d9('0x3f')]=[{'all':!![]}];}_0x4f7393=_[_0xb8d9('0x3c')]({},_0x4f7393,_0x580d4f[_0xb8d9('0x3e')]);return db[_0xb8d9('0x2a')][_0xb8d9('0x43')](_0x4f7393)[_0xb8d9('0x23')](handleEntityNotFound(_0x587c34,null))['then'](respondWithResult(_0x587c34,null))[_0xb8d9('0x44')](handleError(_0x587c34,null));};exports[_0xb8d9('0x45')]=function(_0xa034ce,_0xc65f27){return db[_0xb8d9('0x2a')][_0xb8d9('0x45')](_0xa034ce['body'],{})[_0xb8d9('0x23')](respondWithResult(_0xc65f27,0xc9))[_0xb8d9('0x44')](handleError(_0xc65f27,null));};exports['update']=function(_0x212310,_0x41f38b){if(_0x212310['body']['id']){delete _0x212310['body']['id'];}return db[_0xb8d9('0x2a')][_0xb8d9('0x43')]({'where':{'id':_0x212310[_0xb8d9('0x42')]['id']}})[_0xb8d9('0x23')](handleEntityNotFound(_0x41f38b,null))[_0xb8d9('0x23')](saveUpdates(_0x212310[_0xb8d9('0x46')],null))[_0xb8d9('0x23')](respondWithResult(_0x41f38b,null))['catch'](handleError(_0x41f38b,null));};exports[_0xb8d9('0x24')]=function(_0x431c21,_0x341d9d){return db['FaxQueueReport'][_0xb8d9('0x43')]({'where':{'id':_0x431c21[_0xb8d9('0x42')]['id']}})['then'](handleEntityNotFound(_0x341d9d,null))['then'](removeEntity(_0x341d9d,null))[_0xb8d9('0x44')](handleError(_0x341d9d,null));};exports[_0xb8d9('0x47')]=function(_0x4e9a10,_0x1825f7){return db[_0xb8d9('0x2a')][_0xb8d9('0x47')]()[_0xb8d9('0x23')](respondWithResult(_0x1825f7,null))['catch'](handleError(_0x1825f7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 895bd57..5eecdc0 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31f5ee,_0x2b48dd){var _0x2c788a=function(_0x5db45e){while(--_0x5db45e){_0x31f5ee['push'](_0x31f5ee['shift']());}};_0x2c788a(++_0x2b48dd);}(_0x53ec,0x192));var _0xc53e=function(_0x40c6a7,_0x4fc99d){_0x40c6a7=_0x40c6a7-0x0;var _0x37f57d=_0x53ec[_0x40c6a7];return _0x37f57d;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x2c682c,_0x2c7805){var _0x3726bf=function(_0x48058c){while(--_0x48058c){_0x2c682c['push'](_0x2c682c['shift']());}};_0x3726bf(++_0x2c7805);}(_0x5fc3,0xa8));var _0x35fc=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x5fc3[_0x31a576];return _0x30b1d3;};'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')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 c4534f5..e374276 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 _0x434f=['UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x434f,0x1d2));var _0xf434=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x434f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf434('0x0'));var util=require(_0xf434('0x1'));var moment=require(_0xf434('0x2'));var BPromise=require(_0xf434('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf434('0x4'));var db=require(_0xf434('0x5'))['db'];var utils=require(_0xf434('0x6'));var logger=require(_0xf434('0x7'))(_0xf434('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf434('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1df1fa,_0x243d40,_0x416fbb){return new BPromise(function(_0x5ab108,_0xcdb129){return client[_0xf434('0xa')](_0x1df1fa,_0x416fbb)['then'](function(_0x24e222){logger[_0xf434('0xb')](_0xf434('0xc'),_0x243d40,_0xf434('0xd'));logger[_0xf434('0xe')](_0xf434('0xf'),_0x243d40,_0xf434('0xd'),JSON[_0xf434('0x10')](_0x24e222));if(_0x24e222['error']){if(_0x24e222['error'][_0xf434('0x11')]===0x1f4){logger[_0xf434('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x243d40,_0x24e222['error'][_0xf434('0x13')]);return _0xcdb129(_0x24e222[_0xf434('0x12')][_0xf434('0x13')]);}logger[_0xf434('0x12')](_0xf434('0xc'),_0x243d40,_0x24e222[_0xf434('0x12')][_0xf434('0x13')]);return _0x5ab108(_0x24e222[_0xf434('0x12')][_0xf434('0x13')]);}else{logger['info'](_0xf434('0xc'),_0x243d40,_0xf434('0xd'));_0x5ab108(_0x24e222[_0xf434('0x14')][_0xf434('0x13')]);}})['catch'](function(_0x42324a){logger[_0xf434('0x12')](_0xf434('0xc'),_0x243d40,_0x42324a);_0xcdb129(_0x42324a);});});}exports[_0xf434('0x15')]=function(_0x81b65d){var _0x58d03c=this;return new Promise(function(_0x5e5641,_0x257a52){return db[_0xf434('0x16')][_0xf434('0x17')](_0x81b65d[_0xf434('0x18')],{'raw':_0x81b65d[_0xf434('0x19')]?_0x81b65d[_0xf434('0x19')][_0xf434('0x1a')]===undefined?!![]:![]:!![]})[_0xf434('0x1b')](function(_0x5d34c4){logger['info']('CreateFaxQueueReport',_0x81b65d);logger[_0xf434('0xe')](_0xf434('0x15'),_0x81b65d,JSON[_0xf434('0x10')](_0x5d34c4));_0x5e5641(_0x5d34c4);})[_0xf434('0x1c')](function(_0x2502b9){logger[_0xf434('0x12')](_0xf434('0x15'),_0x2502b9['message'],_0x81b65d);_0x257a52(_0x58d03c['error'](0x1f4,_0x2502b9[_0xf434('0x13')]));});});};exports[_0xf434('0x1d')]=function(_0x101fd0){var _0x2ff156=this;return new Promise(function(_0x4226d1,_0x4e6884){return db[_0xf434('0x16')]['update'](_0x101fd0[_0xf434('0x18')],{'raw':_0x101fd0[_0xf434('0x19')]?_0x101fd0[_0xf434('0x19')][_0xf434('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101fd0['options']?_0x101fd0[_0xf434('0x19')][_0xf434('0x1e')]||null:null,'attributes':_0x101fd0['options']?_0x101fd0[_0xf434('0x19')][_0xf434('0x1f')]||null:null,'limit':_0x101fd0[_0xf434('0x19')]?_0x101fd0[_0xf434('0x19')][_0xf434('0x20')]||null:null})[_0xf434('0x1b')](function(_0x2097d9){logger['info'](_0xf434('0x1d'),_0x101fd0);logger[_0xf434('0xe')](_0xf434('0x1d'),_0x101fd0,JSON[_0xf434('0x10')](_0x2097d9));_0x4226d1(_0x2097d9);})['catch'](function(_0x229273){logger[_0xf434('0x12')](_0xf434('0x1d'),_0x229273['message'],_0x101fd0);_0x4e6884(_0x2ff156[_0xf434('0x12')](0x1f4,_0x229273['message']));});});}; \ No newline at end of file +var _0x76c8=['error','message','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','catch','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x369ad2,_0x3d1a69){var _0x380c57=function(_0x2ce12c){while(--_0x2ce12c){_0x369ad2['push'](_0x369ad2['shift']());}};_0x380c57(++_0x3d1a69);}(_0x76c8,0xe1));var _0x876c=function(_0x32b05a,_0x1291c2){_0x32b05a=_0x32b05a-0x0;var _0x4eaffc=_0x76c8[_0x32b05a];return _0x4eaffc;};'use strict';var _=require(_0x876c('0x0'));var util=require(_0x876c('0x1'));var moment=require(_0x876c('0x2'));var BPromise=require(_0x876c('0x3'));var rs=require(_0x876c('0x4'));var fs=require('fs');var Redis=require(_0x876c('0x5'));var db=require(_0x876c('0x6'))['db'];var utils=require(_0x876c('0x7'));var logger=require(_0x876c('0x8'))(_0x876c('0x9'));var config=require('../../config/environment');var jayson=require(_0x876c('0xa'));var client=jayson[_0x876c('0xb')][_0x876c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b6d26,_0x1fa811,_0x26b102){return new BPromise(function(_0x47b6db,_0x2e51cd){return client[_0x876c('0xd')](_0x4b6d26,_0x26b102)[_0x876c('0xe')](function(_0x2c4ef2){logger[_0x876c('0xf')](_0x876c('0x10'),_0x1fa811,'request\x20sent');logger['debug'](_0x876c('0x11'),_0x1fa811,_0x876c('0x12'),JSON[_0x876c('0x13')](_0x2c4ef2));if(_0x2c4ef2[_0x876c('0x14')]){if(_0x2c4ef2[_0x876c('0x14')]['code']===0x1f4){logger[_0x876c('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x1fa811,_0x2c4ef2[_0x876c('0x14')][_0x876c('0x15')]);return _0x2e51cd(_0x2c4ef2[_0x876c('0x14')][_0x876c('0x15')]);}logger[_0x876c('0x14')](_0x876c('0x10'),_0x1fa811,_0x2c4ef2['error'][_0x876c('0x15')]);return _0x47b6db(_0x2c4ef2['error']['message']);}else{logger[_0x876c('0xf')](_0x876c('0x10'),_0x1fa811,_0x876c('0x12'));_0x47b6db(_0x2c4ef2['result'][_0x876c('0x15')]);}})['catch'](function(_0x257907){logger[_0x876c('0x14')](_0x876c('0x10'),_0x1fa811,_0x257907);_0x2e51cd(_0x257907);});});}exports['CreateFaxQueueReport']=function(_0x5b809f){var _0xa51d00=this;return new Promise(function(_0x554673,_0x7fa3a0){return db[_0x876c('0x16')][_0x876c('0x17')](_0x5b809f[_0x876c('0x18')],{'raw':_0x5b809f[_0x876c('0x19')]?_0x5b809f['options'][_0x876c('0x1a')]===undefined?!![]:![]:!![]})[_0x876c('0xe')](function(_0x152f04){logger[_0x876c('0xf')](_0x876c('0x1b'),_0x5b809f);logger[_0x876c('0x1c')]('CreateFaxQueueReport',_0x5b809f,JSON[_0x876c('0x13')](_0x152f04));_0x554673(_0x152f04);})[_0x876c('0x1d')](function(_0x4fafd7){logger[_0x876c('0x14')](_0x876c('0x1b'),_0x4fafd7[_0x876c('0x15')],_0x5b809f);_0x7fa3a0(_0xa51d00[_0x876c('0x14')](0x1f4,_0x4fafd7[_0x876c('0x15')]));});});};exports[_0x876c('0x1e')]=function(_0x135711){var _0x36f055=this;return new Promise(function(_0x312ca7,_0x2ad224){return db[_0x876c('0x16')][_0x876c('0x1f')](_0x135711[_0x876c('0x18')],{'raw':_0x135711[_0x876c('0x19')]?_0x135711[_0x876c('0x19')][_0x876c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135711[_0x876c('0x19')]?_0x135711[_0x876c('0x19')][_0x876c('0x20')]||null:null,'attributes':_0x135711[_0x876c('0x19')]?_0x135711[_0x876c('0x19')][_0x876c('0x21')]||null:null,'limit':_0x135711[_0x876c('0x19')]?_0x135711['options'][_0x876c('0x22')]||null:null})[_0x876c('0xe')](function(_0x41eec6){logger[_0x876c('0xf')](_0x876c('0x1e'),_0x135711);logger[_0x876c('0x1c')]('UpdateFaxQueueReport',_0x135711,JSON['stringify'](_0x41eec6));_0x312ca7(_0x41eec6);})[_0x876c('0x1d')](function(_0x13fd4f){logger['error'](_0x876c('0x1e'),_0x13fd4f['message'],_0x135711);_0x2ad224(_0x36f055[_0x876c('0x14')](0x1f4,_0x13fd4f[_0x876c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0369726..cf113d3 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 _0x2927=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0x2927,0x192));var _0x7292=function(_0x5c5a34,_0x4207e2){_0x5c5a34=_0x5c5a34-0x0;var _0x5dabc1=_0x2927[_0x5c5a34];return _0x5dabc1;};'use strict';var multer=require('multer');var util=require(_0x7292('0x0'));var path=require(_0x7292('0x1'));var timeout=require(_0x7292('0x2'));var express=require(_0x7292('0x3'));var router=express[_0x7292('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7292('0x5'));var config=require(_0x7292('0x6'));var controller=require(_0x7292('0x7'));router[_0x7292('0x8')]('/',auth[_0x7292('0x9')](),controller['index']);router[_0x7292('0x8')]('/describe',auth[_0x7292('0x9')](),controller[_0x7292('0xa')]);router[_0x7292('0x8')](_0x7292('0xb'),auth['isAuthenticated'](),controller[_0x7292('0xc')]);router[_0x7292('0xd')]('/',auth[_0x7292('0x9')](),controller[_0x7292('0xe')]);router[_0x7292('0xf')](_0x7292('0xb'),auth[_0x7292('0x9')](),controller[_0x7292('0x10')]);router[_0x7292('0x11')](_0x7292('0xb'),auth[_0x7292('0x9')](),controller[_0x7292('0x12')]);module[_0x7292('0x13')]=router; \ No newline at end of file +var _0x0ed2=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0ed2,0x15a));var _0x20ed=function(_0x20526f,_0x378c77){_0x20526f=_0x20526f-0x0;var _0x359ff7=_0x0ed2[_0x20526f];return _0x359ff7;};'use strict';var multer=require(_0x20ed('0x0'));var util=require(_0x20ed('0x1'));var path=require(_0x20ed('0x2'));var timeout=require(_0x20ed('0x3'));var express=require(_0x20ed('0x4'));var router=express[_0x20ed('0x5')]();var fs_extra=require(_0x20ed('0x6'));var auth=require(_0x20ed('0x7'));var interaction=require(_0x20ed('0x8'));var config=require(_0x20ed('0x9'));var controller=require(_0x20ed('0xa'));router[_0x20ed('0xb')]('/',auth[_0x20ed('0xc')](),controller[_0x20ed('0xd')]);router[_0x20ed('0xb')](_0x20ed('0xe'),auth[_0x20ed('0xc')](),controller[_0x20ed('0xf')]);router[_0x20ed('0xb')](_0x20ed('0x10'),auth['isAuthenticated'](),controller[_0x20ed('0x11')]);router[_0x20ed('0x12')]('/',auth['isAuthenticated'](),controller[_0x20ed('0x13')]);router[_0x20ed('0x14')](_0x20ed('0x10'),auth[_0x20ed('0xc')](),controller[_0x20ed('0x15')]);router[_0x20ed('0x16')](_0x20ed('0x10'),auth['isAuthenticated'](),controller[_0x20ed('0x17')]);module[_0x20ed('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 890f271..b24d27f 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4eeca4,_0x5901c9){var _0x430031=function(_0x237ed7){while(--_0x237ed7){_0x4eeca4['push'](_0x4eeca4['shift']());}};_0x430031(++_0x5901c9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x4b84[_0x452968];return _0xb6f9ae;};'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(_0x154940,_0x1b13bb){var _0x3741af=function(_0x4786d0){while(--_0x4786d0){_0x154940['push'](_0x154940['shift']());}};_0x3741af(++_0x1b13bb);}(_0x008c,0x188));var _0xc008=function(_0x255b94,_0x352b45){_0x255b94=_0x255b94-0x0;var _0xc5806b=_0x008c[_0x255b94];return _0xc5806b;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3d2b3cb..1b977f7 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 _0xe0a0=['then','stack','name','send','index','map','FaxTransferReport','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update'];(function(_0xb4d1ca,_0x25d013){var _0x4e0986=function(_0x2d457e){while(--_0x2d457e){_0xb4d1ca['push'](_0xb4d1ca['shift']());}};_0x4e0986(++_0x25d013);}(_0xe0a0,0x1b8));var _0x0e0a=function(_0x1c23e0,_0x447fda){_0x1c23e0=_0x1c23e0-0x0;var _0x9c54c2=_0xe0a0[_0x1c23e0];return _0x9c54c2;};'use strict';var emlformat=require(_0x0e0a('0x0'));var rimraf=require(_0x0e0a('0x1'));var zipdir=require(_0x0e0a('0x2'));var jsonpatch=require(_0x0e0a('0x3'));var rp=require(_0x0e0a('0x4'));var moment=require(_0x0e0a('0x5'));var BPromise=require(_0x0e0a('0x6'));var Mustache=require(_0x0e0a('0x7'));var util=require(_0x0e0a('0x8'));var path=require(_0x0e0a('0x9'));var sox=require(_0x0e0a('0xa'));var csv=require(_0x0e0a('0xb'));var ejs=require(_0x0e0a('0xc'));var fs=require('fs');var fs_extra=require(_0x0e0a('0xd'));var _=require('lodash');var squel=require(_0x0e0a('0xe'));var crypto=require('crypto');var jsforce=require(_0x0e0a('0xf'));var deskjs=require(_0x0e0a('0x10'));var toCsv=require(_0x0e0a('0xb'));var querystring=require(_0x0e0a('0x11'));var Papa=require(_0x0e0a('0x12'));var Redis=require(_0x0e0a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0e0a('0x14'));var as=require(_0x0e0a('0x15'));var hardwareService=require(_0x0e0a('0x16'));var logger=require('../../config/logger')(_0x0e0a('0x17'));var utils=require(_0x0e0a('0x18'));var config=require(_0x0e0a('0x19'));var licenseUtil=require(_0x0e0a('0x1a'));var db=require(_0x0e0a('0x1b'))['db'];function respondWithStatusCode(_0x30e79a,_0xff46e){_0xff46e=_0xff46e||0xcc;return function(_0x30ded4){if(_0x30ded4){return _0x30e79a[_0x0e0a('0x1c')](_0xff46e);}return _0x30e79a[_0x0e0a('0x1d')](_0xff46e)[_0x0e0a('0x1e')]();};}function respondWithResult(_0x6f66b7,_0x247e29){_0x247e29=_0x247e29||0xc8;return function(_0x34958b){if(_0x34958b){return _0x6f66b7[_0x0e0a('0x1d')](_0x247e29)[_0x0e0a('0x1f')](_0x34958b);}};}function respondWithFilteredResult(_0x14eec1,_0x33ff68){return function(_0x75fb7a){if(_0x75fb7a){var _0x31ce45=typeof _0x33ff68[_0x0e0a('0x20')]==='undefined'&&typeof _0x33ff68[_0x0e0a('0x21')]===_0x0e0a('0x22');var _0xe548e1=_0x75fb7a[_0x0e0a('0x23')];var _0x39e642=_0x31ce45?0x0:_0x33ff68[_0x0e0a('0x20')];var _0x568ded=_0x31ce45?_0x75fb7a[_0x0e0a('0x23')]:_0x33ff68['offset']+_0x33ff68['limit'];var _0x466110;if(_0x568ded>=_0xe548e1){_0x568ded=_0xe548e1;_0x466110=0xc8;}else{_0x466110=0xce;}_0x14eec1[_0x0e0a('0x1d')](_0x466110);return _0x14eec1['set'](_0x0e0a('0x24'),_0x39e642+'-'+_0x568ded+'/'+_0xe548e1)['json'](_0x75fb7a);}return null;};}function patchUpdates(_0x452083){return function(_0x3e73e1){try{jsonpatch[_0x0e0a('0x25')](_0x3e73e1,_0x452083,!![]);}catch(_0x1dac6c){return BPromise[_0x0e0a('0x26')](_0x1dac6c);}return _0x3e73e1['save']();};}function saveUpdates(_0xb971a4,_0x2bfaf5){return function(_0x1bb9d3){if(_0x1bb9d3){return _0x1bb9d3[_0x0e0a('0x27')](_0xb971a4)[_0x0e0a('0x28')](function(_0x5eaf38){return _0x5eaf38;});}return null;};}function removeEntity(_0x199bfe,_0x28b8ae){return function(_0xbfc04e){if(_0xbfc04e){return _0xbfc04e['destroy']()[_0x0e0a('0x28')](function(){_0x199bfe[_0x0e0a('0x1d')](0xcc)[_0x0e0a('0x1e')]();});}};}function handleEntityNotFound(_0x3d16d7,_0x47f1be){return function(_0x436212){if(!_0x436212){_0x3d16d7[_0x0e0a('0x1c')](0x194);}return _0x436212;};}function handleError(_0x15646d,_0x8c4e96){_0x8c4e96=_0x8c4e96||0x1f4;return function(_0x3d1948){logger['error'](_0x3d1948[_0x0e0a('0x29')]);if(_0x3d1948[_0x0e0a('0x2a')]){delete _0x3d1948[_0x0e0a('0x2a')];}_0x15646d[_0x0e0a('0x1d')](_0x8c4e96)[_0x0e0a('0x2b')](_0x3d1948);};}exports[_0x0e0a('0x2c')]=function(_0x3447b3,_0x14bb42){var _0x15b028={},_0x18dad2={},_0x4bbea1={'count':0x0,'rows':[]};var _0x20eb9b=_[_0x0e0a('0x2d')](db[_0x0e0a('0x2e')][_0x0e0a('0x2f')],function(_0x24357f){return{'name':_0x24357f['fieldName'],'type':_0x24357f['type'][_0x0e0a('0x30')]};});_0x18dad2[_0x0e0a('0x31')]=_[_0x0e0a('0x2d')](_0x20eb9b,_0x0e0a('0x2a'));_0x18dad2[_0x0e0a('0x32')]=_[_0x0e0a('0x33')](_0x3447b3['query']);_0x18dad2['filters']=_['intersection'](_0x18dad2[_0x0e0a('0x31')],_0x18dad2[_0x0e0a('0x32')]);_0x15b028[_0x0e0a('0x34')]=_[_0x0e0a('0x35')](_0x18dad2[_0x0e0a('0x31')],qs[_0x0e0a('0x36')](_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x36')]));_0x15b028[_0x0e0a('0x34')]=_0x15b028['attributes'][_0x0e0a('0x37')]?_0x15b028[_0x0e0a('0x34')]:_0x18dad2[_0x0e0a('0x31')];if(!_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x38')](_0x0e0a('0x39'))){_0x15b028[_0x0e0a('0x21')]=qs[_0x0e0a('0x21')](_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x21')]);_0x15b028[_0x0e0a('0x20')]=qs[_0x0e0a('0x20')](_0x3447b3['query'][_0x0e0a('0x20')]);}_0x15b028[_0x0e0a('0x3a')]=qs['sort'](_0x3447b3['query'][_0x0e0a('0x3b')]);_0x15b028['where']=qs[_0x0e0a('0x3c')](_[_0x0e0a('0x3d')](_0x3447b3['query'],_0x18dad2[_0x0e0a('0x3c')]),_0x20eb9b);if(_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x3e')]){_0x15b028[_0x0e0a('0x3f')]=_[_0x0e0a('0x40')](_0x15b028[_0x0e0a('0x3f')],{'$or':_[_0x0e0a('0x2d')](_0x20eb9b,function(_0x197c5b){if(_0x197c5b[_0x0e0a('0x41')]!==_0x0e0a('0x42')){var _0x26995f={};_0x26995f[_0x197c5b[_0x0e0a('0x2a')]]={'$like':'%'+_0x3447b3[_0x0e0a('0x32')][_0x0e0a('0x3e')]+'%'};return _0x26995f;}})});}_0x15b028=_[_0x0e0a('0x40')]({},_0x15b028,_0x3447b3[_0x0e0a('0x43')]);var _0xd9f11e={'where':_0x15b028['where']};return db['FaxTransferReport'][_0x0e0a('0x23')](_0xd9f11e)[_0x0e0a('0x28')](function(_0x1b4a49){_0x4bbea1['count']=_0x1b4a49;if(_0x3447b3['query']['includeAll']){_0x15b028[_0x0e0a('0x44')]=[{'all':!![]}];}return db[_0x0e0a('0x2e')][_0x0e0a('0x45')](_0x15b028);})[_0x0e0a('0x28')](function(_0x21daff){_0x4bbea1[_0x0e0a('0x46')]=_0x21daff;return _0x4bbea1;})['then'](respondWithFilteredResult(_0x14bb42,_0x15b028))[_0x0e0a('0x47')](handleError(_0x14bb42,null));};exports[_0x0e0a('0x48')]=function(_0x3140f1,_0x5af7ad){var _0x5c3652={'raw':!![],'where':{'id':_0x3140f1[_0x0e0a('0x49')]['id']}},_0x4fe481={};_0x4fe481['model']=_[_0x0e0a('0x33')](db[_0x0e0a('0x2e')][_0x0e0a('0x2f')]);_0x4fe481['query']=_[_0x0e0a('0x33')](_0x3140f1[_0x0e0a('0x32')]);_0x4fe481['filters']=_[_0x0e0a('0x35')](_0x4fe481[_0x0e0a('0x31')],_0x4fe481[_0x0e0a('0x32')]);_0x5c3652[_0x0e0a('0x34')]=_[_0x0e0a('0x35')](_0x4fe481['model'],qs[_0x0e0a('0x36')](_0x3140f1[_0x0e0a('0x32')]['fields']));_0x5c3652['attributes']=_0x5c3652[_0x0e0a('0x34')][_0x0e0a('0x37')]?_0x5c3652[_0x0e0a('0x34')]:_0x4fe481['model'];if(_0x3140f1[_0x0e0a('0x32')][_0x0e0a('0x4a')]){_0x5c3652[_0x0e0a('0x44')]=[{'all':!![]}];}_0x5c3652=_[_0x0e0a('0x40')]({},_0x5c3652,_0x3140f1[_0x0e0a('0x43')]);return db['FaxTransferReport'][_0x0e0a('0x4b')](_0x5c3652)[_0x0e0a('0x28')](handleEntityNotFound(_0x5af7ad,null))[_0x0e0a('0x28')](respondWithResult(_0x5af7ad,null))['catch'](handleError(_0x5af7ad,null));};exports[_0x0e0a('0x4c')]=function(_0x33bdb1,_0x5c7257){return db[_0x0e0a('0x2e')][_0x0e0a('0x4c')](_0x33bdb1[_0x0e0a('0x4d')],{})[_0x0e0a('0x28')](respondWithResult(_0x5c7257,0xc9))[_0x0e0a('0x47')](handleError(_0x5c7257,null));};exports['update']=function(_0x8c8812,_0xf728d8){if(_0x8c8812['body']['id']){delete _0x8c8812[_0x0e0a('0x4d')]['id'];}return db[_0x0e0a('0x2e')]['find']({'where':{'id':_0x8c8812[_0x0e0a('0x49')]['id']}})[_0x0e0a('0x28')](handleEntityNotFound(_0xf728d8,null))[_0x0e0a('0x28')](saveUpdates(_0x8c8812['body'],null))[_0x0e0a('0x28')](respondWithResult(_0xf728d8,null))[_0x0e0a('0x47')](handleError(_0xf728d8,null));};exports[_0x0e0a('0x4e')]=function(_0x4e6be4,_0x4da279){return db[_0x0e0a('0x2e')]['find']({'where':{'id':_0x4e6be4[_0x0e0a('0x49')]['id']}})['then'](handleEntityNotFound(_0x4da279,null))[_0x0e0a('0x28')](removeEntity(_0x4da279,null))[_0x0e0a('0x47')](handleError(_0x4da279,null));};exports[_0x0e0a('0x4f')]=function(_0x2c3363,_0x4919ad){return db[_0x0e0a('0x2e')][_0x0e0a('0x4f')]()[_0x0e0a('0x28')](respondWithResult(_0x4919ad,null))[_0x0e0a('0x47')](handleError(_0x4919ad,null));}; \ No newline at end of file +var _0x3ad1=['type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','update','destroy','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName'];(function(_0x296094,_0x7f7bee){var _0x48d8d9=function(_0x42b9ac){while(--_0x42b9ac){_0x296094['push'](_0x296094['shift']());}};_0x48d8d9(++_0x7f7bee);}(_0x3ad1,0x195));var _0x13ad=function(_0x4f278b,_0x1a62c7){_0x4f278b=_0x4f278b-0x0;var _0x4924c9=_0x3ad1[_0x4f278b];return _0x4924c9;};'use strict';var emlformat=require(_0x13ad('0x0'));var rimraf=require(_0x13ad('0x1'));var zipdir=require(_0x13ad('0x2'));var jsonpatch=require(_0x13ad('0x3'));var rp=require('request-promise');var moment=require(_0x13ad('0x4'));var BPromise=require(_0x13ad('0x5'));var Mustache=require(_0x13ad('0x6'));var util=require(_0x13ad('0x7'));var path=require(_0x13ad('0x8'));var sox=require(_0x13ad('0x9'));var csv=require(_0x13ad('0xa'));var ejs=require(_0x13ad('0xb'));var fs=require('fs');var fs_extra=require(_0x13ad('0xc'));var _=require(_0x13ad('0xd'));var squel=require('squel');var crypto=require(_0x13ad('0xe'));var jsforce=require(_0x13ad('0xf'));var deskjs=require(_0x13ad('0x10'));var toCsv=require(_0x13ad('0xa'));var querystring=require('querystring');var Papa=require(_0x13ad('0x11'));var Redis=require(_0x13ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x13ad('0x13'));var as=require(_0x13ad('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13ad('0x15'))(_0x13ad('0x16'));var utils=require(_0x13ad('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x13ad('0x18'))['db'];function respondWithStatusCode(_0x36d2b4,_0x5b7ca9){_0x5b7ca9=_0x5b7ca9||0xcc;return function(_0x1f6fbd){if(_0x1f6fbd){return _0x36d2b4[_0x13ad('0x19')](_0x5b7ca9);}return _0x36d2b4[_0x13ad('0x1a')](_0x5b7ca9)[_0x13ad('0x1b')]();};}function respondWithResult(_0x58031a,_0x2120b9){_0x2120b9=_0x2120b9||0xc8;return function(_0x1e1f95){if(_0x1e1f95){return _0x58031a[_0x13ad('0x1a')](_0x2120b9)[_0x13ad('0x1c')](_0x1e1f95);}};}function respondWithFilteredResult(_0x340386,_0x423ce9){return function(_0x261113){if(_0x261113){var _0x5906d2=typeof _0x423ce9['offset']===_0x13ad('0x1d')&&typeof _0x423ce9['limit']===_0x13ad('0x1d');var _0x36d31f=_0x261113[_0x13ad('0x1e')];var _0x295606=_0x5906d2?0x0:_0x423ce9[_0x13ad('0x1f')];var _0x5d75c7=_0x5906d2?_0x261113['count']:_0x423ce9[_0x13ad('0x1f')]+_0x423ce9['limit'];var _0x1f7e59;if(_0x5d75c7>=_0x36d31f){_0x5d75c7=_0x36d31f;_0x1f7e59=0xc8;}else{_0x1f7e59=0xce;}_0x340386[_0x13ad('0x1a')](_0x1f7e59);return _0x340386[_0x13ad('0x20')](_0x13ad('0x21'),_0x295606+'-'+_0x5d75c7+'/'+_0x36d31f)[_0x13ad('0x1c')](_0x261113);}return null;};}function patchUpdates(_0x1592f7){return function(_0x3c8e8a){try{jsonpatch[_0x13ad('0x22')](_0x3c8e8a,_0x1592f7,!![]);}catch(_0x26c81c){return BPromise['reject'](_0x26c81c);}return _0x3c8e8a['save']();};}function saveUpdates(_0x57f7ca,_0x570f6f){return function(_0x1048ab){if(_0x1048ab){return _0x1048ab[_0x13ad('0x23')](_0x57f7ca)['then'](function(_0x4ae6cb){return _0x4ae6cb;});}return null;};}function removeEntity(_0x41ad82,_0x41d36c){return function(_0x2ff1b5){if(_0x2ff1b5){return _0x2ff1b5[_0x13ad('0x24')]()['then'](function(){_0x41ad82[_0x13ad('0x1a')](0xcc)[_0x13ad('0x1b')]();});}};}function handleEntityNotFound(_0x5aeef1,_0x4af30f){return function(_0x465178){if(!_0x465178){_0x5aeef1[_0x13ad('0x19')](0x194);}return _0x465178;};}function handleError(_0x3f19ba,_0x9ccfe0){_0x9ccfe0=_0x9ccfe0||0x1f4;return function(_0x420051){logger['error'](_0x420051[_0x13ad('0x25')]);if(_0x420051[_0x13ad('0x26')]){delete _0x420051[_0x13ad('0x26')];}_0x3f19ba['status'](_0x9ccfe0)[_0x13ad('0x27')](_0x420051);};}exports[_0x13ad('0x28')]=function(_0x46e385,_0x6dc252){var _0x5ab454={},_0x27f1c1={},_0x596353={'count':0x0,'rows':[]};var _0x3cf968=_[_0x13ad('0x29')](db[_0x13ad('0x2a')][_0x13ad('0x2b')],function(_0x4ce95d){return{'name':_0x4ce95d[_0x13ad('0x2c')],'type':_0x4ce95d[_0x13ad('0x2d')][_0x13ad('0x2e')]};});_0x27f1c1['model']=_[_0x13ad('0x29')](_0x3cf968,_0x13ad('0x26'));_0x27f1c1[_0x13ad('0x2f')]=_['keys'](_0x46e385['query']);_0x27f1c1['filters']=_[_0x13ad('0x30')](_0x27f1c1[_0x13ad('0x31')],_0x27f1c1['query']);_0x5ab454[_0x13ad('0x32')]=_[_0x13ad('0x30')](_0x27f1c1[_0x13ad('0x31')],qs[_0x13ad('0x33')](_0x46e385['query']['fields']));_0x5ab454[_0x13ad('0x32')]=_0x5ab454[_0x13ad('0x32')][_0x13ad('0x34')]?_0x5ab454['attributes']:_0x27f1c1[_0x13ad('0x31')];if(!_0x46e385[_0x13ad('0x2f')][_0x13ad('0x35')](_0x13ad('0x36'))){_0x5ab454[_0x13ad('0x37')]=qs[_0x13ad('0x37')](_0x46e385[_0x13ad('0x2f')][_0x13ad('0x37')]);_0x5ab454['offset']=qs[_0x13ad('0x1f')](_0x46e385[_0x13ad('0x2f')][_0x13ad('0x1f')]);}_0x5ab454[_0x13ad('0x38')]=qs[_0x13ad('0x39')](_0x46e385['query']['sort']);_0x5ab454[_0x13ad('0x3a')]=qs[_0x13ad('0x3b')](_[_0x13ad('0x3c')](_0x46e385[_0x13ad('0x2f')],_0x27f1c1['filters']),_0x3cf968);if(_0x46e385[_0x13ad('0x2f')][_0x13ad('0x3d')]){_0x5ab454['where']=_[_0x13ad('0x3e')](_0x5ab454['where'],{'$or':_[_0x13ad('0x29')](_0x3cf968,function(_0x347741){if(_0x347741[_0x13ad('0x2d')]!==_0x13ad('0x3f')){var _0x5db2d6={};_0x5db2d6[_0x347741['name']]={'$like':'%'+_0x46e385[_0x13ad('0x2f')]['filter']+'%'};return _0x5db2d6;}})});}_0x5ab454=_[_0x13ad('0x3e')]({},_0x5ab454,_0x46e385['options']);var _0x44946b={'where':_0x5ab454[_0x13ad('0x3a')]};return db[_0x13ad('0x2a')][_0x13ad('0x1e')](_0x44946b)[_0x13ad('0x40')](function(_0x3daa85){_0x596353[_0x13ad('0x1e')]=_0x3daa85;if(_0x46e385[_0x13ad('0x2f')][_0x13ad('0x41')]){_0x5ab454[_0x13ad('0x42')]=[{'all':!![]}];}return db[_0x13ad('0x2a')][_0x13ad('0x43')](_0x5ab454);})['then'](function(_0x12e2ee){_0x596353['rows']=_0x12e2ee;return _0x596353;})['then'](respondWithFilteredResult(_0x6dc252,_0x5ab454))[_0x13ad('0x44')](handleError(_0x6dc252,null));};exports['show']=function(_0x4fb9f6,_0x453fec){var _0x3ac72b={'raw':!![],'where':{'id':_0x4fb9f6[_0x13ad('0x45')]['id']}},_0x39edc8={};_0x39edc8[_0x13ad('0x31')]=_[_0x13ad('0x46')](db['FaxTransferReport'][_0x13ad('0x2b')]);_0x39edc8[_0x13ad('0x2f')]=_[_0x13ad('0x46')](_0x4fb9f6[_0x13ad('0x2f')]);_0x39edc8['filters']=_[_0x13ad('0x30')](_0x39edc8['model'],_0x39edc8[_0x13ad('0x2f')]);_0x3ac72b['attributes']=_[_0x13ad('0x30')](_0x39edc8[_0x13ad('0x31')],qs[_0x13ad('0x33')](_0x4fb9f6['query'][_0x13ad('0x33')]));_0x3ac72b[_0x13ad('0x32')]=_0x3ac72b[_0x13ad('0x32')][_0x13ad('0x34')]?_0x3ac72b['attributes']:_0x39edc8[_0x13ad('0x31')];if(_0x4fb9f6[_0x13ad('0x2f')]['includeAll']){_0x3ac72b[_0x13ad('0x42')]=[{'all':!![]}];}_0x3ac72b=_[_0x13ad('0x3e')]({},_0x3ac72b,_0x4fb9f6['options']);return db[_0x13ad('0x2a')][_0x13ad('0x47')](_0x3ac72b)[_0x13ad('0x40')](handleEntityNotFound(_0x453fec,null))[_0x13ad('0x40')](respondWithResult(_0x453fec,null))[_0x13ad('0x44')](handleError(_0x453fec,null));};exports[_0x13ad('0x48')]=function(_0x941ba8,_0x2295e2){return db[_0x13ad('0x2a')][_0x13ad('0x48')](_0x941ba8[_0x13ad('0x49')],{})['then'](respondWithResult(_0x2295e2,0xc9))[_0x13ad('0x44')](handleError(_0x2295e2,null));};exports['update']=function(_0x223a5b,_0xc34273){if(_0x223a5b[_0x13ad('0x49')]['id']){delete _0x223a5b[_0x13ad('0x49')]['id'];}return db['FaxTransferReport'][_0x13ad('0x47')]({'where':{'id':_0x223a5b[_0x13ad('0x45')]['id']}})[_0x13ad('0x40')](handleEntityNotFound(_0xc34273,null))['then'](saveUpdates(_0x223a5b[_0x13ad('0x49')],null))[_0x13ad('0x40')](respondWithResult(_0xc34273,null))[_0x13ad('0x44')](handleError(_0xc34273,null));};exports[_0x13ad('0x24')]=function(_0x2e6abf,_0x546178){return db[_0x13ad('0x2a')][_0x13ad('0x47')]({'where':{'id':_0x2e6abf['params']['id']}})['then'](handleEntityNotFound(_0x546178,null))[_0x13ad('0x40')](removeEntity(_0x546178,null))[_0x13ad('0x44')](handleError(_0x546178,null));};exports[_0x13ad('0x4a')]=function(_0x32aa43,_0x1c7344){return db['FaxTransferReport'][_0x13ad('0x4a')]()[_0x13ad('0x40')](respondWithResult(_0x1c7344,null))[_0x13ad('0x44')](handleError(_0x1c7344,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4874bdb..b3a9a73 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 _0x47cb=['moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2e1738,_0x23644b){var _0xdd96f1=function(_0x5c9911){while(--_0x5c9911){_0x2e1738['push'](_0x2e1738['shift']());}};_0xdd96f1(++_0x23644b);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var logger=require(_0xb47c('0x2'))(_0xb47c('0x3'));var moment=require(_0xb47c('0x4'));var BPromise=require(_0xb47c('0x5'));var rp=require(_0xb47c('0x6'));var fs=require('fs');var path=require(_0xb47c('0x7'));var rimraf=require('rimraf');var config=require(_0xb47c('0x8'));var attributes=require(_0xb47c('0x9'));module[_0xb47c('0xa')]=function(_0x10891b,_0x325e36){return _0x10891b[_0xb47c('0xb')](_0xb47c('0xc'),attributes,{'tableName':_0xb47c('0xd'),'paranoid':![],'indexes':[{'name':_0xb47c('0xe'),'fields':[_0xb47c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4502=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid'];(function(_0x384aa8,_0x1dfcbe){var _0x29f844=function(_0x49beb8){while(--_0x49beb8){_0x384aa8['push'](_0x384aa8['shift']());}};_0x29f844(++_0x1dfcbe);}(_0x4502,0xa0));var _0x2450=function(_0x4365d0,_0x1eefb7){_0x4365d0=_0x4365d0-0x0;var _0x4c7e84=_0x4502[_0x4365d0];return _0x4c7e84;};'use strict';var _=require(_0x2450('0x0'));var util=require(_0x2450('0x1'));var logger=require(_0x2450('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2450('0x3'));var fs=require('fs');var path=require(_0x2450('0x4'));var rimraf=require('rimraf');var config=require(_0x2450('0x5'));var attributes=require(_0x2450('0x6'));module[_0x2450('0x7')]=function(_0x3b09b0,_0x15a8a9){return _0x3b09b0['define'](_0x2450('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x2450('0x9'),'fields':[_0x2450('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2eff624..e4197c6 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 _0x4bfb=['error','message','result','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x49d6af,_0x26658c){var _0x32d499=function(_0xe23071){while(--_0xe23071){_0x49d6af['push'](_0x49d6af['shift']());}};_0x32d499(++_0x26658c);}(_0x4bfb,0x147));var _0xb4bf=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x4bfb[_0x4e170e];return _0x338291;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4bf('0x0'));var BPromise=require('bluebird');var rs=require(_0xb4bf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4bf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4bf('0x3'))(_0xb4bf('0x4'));var config=require(_0xb4bf('0x5'));var jayson=require(_0xb4bf('0x6'));var client=jayson[_0xb4bf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3f31,_0x1b1423,_0x4d1037){return new BPromise(function(_0x10f84b,_0x326e85){return client[_0xb4bf('0x8')](_0x2f3f31,_0x4d1037)['then'](function(_0x1086f2){logger['info'](_0xb4bf('0x9'),_0x1b1423,_0xb4bf('0xa'));logger[_0xb4bf('0xb')](_0xb4bf('0xc'),_0x1b1423,_0xb4bf('0xa'),JSON['stringify'](_0x1086f2));if(_0x1086f2['error']){if(_0x1086f2[_0xb4bf('0xd')]['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1b1423,_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);return _0x326e85(_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);}logger['error'](_0xb4bf('0x9'),_0x1b1423,_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);return _0x10f84b(_0x1086f2[_0xb4bf('0xd')][_0xb4bf('0xe')]);}else{logger['info'](_0xb4bf('0x9'),_0x1b1423,_0xb4bf('0xa'));_0x10f84b(_0x1086f2[_0xb4bf('0xf')][_0xb4bf('0xe')]);}})[_0xb4bf('0x10')](function(_0x5784f){logger[_0xb4bf('0xd')](_0xb4bf('0x9'),_0x1b1423,_0x5784f);_0x326e85(_0x5784f);});});} \ No newline at end of file +var _0x8535=['util','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x16f36b,_0x1a3ce2){var _0x3b0a4d=function(_0x2c88fb){while(--_0x2c88fb){_0x16f36b['push'](_0x16f36b['shift']());}};_0x3b0a4d(++_0x1a3ce2);}(_0x8535,0x1da));var _0x5853=function(_0x41be50,_0xd7738){_0x41be50=_0x41be50-0x0;var _0x5889dd=_0x8535[_0x41be50];return _0x5889dd;};'use strict';var _=require(_0x5853('0x0'));var util=require(_0x5853('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5853('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5853('0x3'));var logger=require(_0x5853('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5853('0x5'));var client=jayson[_0x5853('0x6')][_0x5853('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b73b5,_0x3947c9,_0xca2126){return new BPromise(function(_0xce1641,_0x47eec8){return client[_0x5853('0x8')](_0x5b73b5,_0xca2126)[_0x5853('0x9')](function(_0x2e5f74){logger['info'](_0x5853('0xa'),_0x3947c9,_0x5853('0xb'));logger['debug'](_0x5853('0xc'),_0x3947c9,_0x5853('0xb'),JSON['stringify'](_0x2e5f74));if(_0x2e5f74[_0x5853('0xd')]){if(_0x2e5f74[_0x5853('0xd')][_0x5853('0xe')]===0x1f4){logger['error'](_0x5853('0xa'),_0x3947c9,_0x2e5f74[_0x5853('0xd')]['message']);return _0x47eec8(_0x2e5f74[_0x5853('0xd')][_0x5853('0xf')]);}logger[_0x5853('0xd')](_0x5853('0xa'),_0x3947c9,_0x2e5f74[_0x5853('0xd')][_0x5853('0xf')]);return _0xce1641(_0x2e5f74[_0x5853('0xd')]['message']);}else{logger[_0x5853('0x10')](_0x5853('0xa'),_0x3947c9,_0x5853('0xb'));_0xce1641(_0x2e5f74[_0x5853('0x11')]['message']);}})[_0x5853('0x12')](function(_0x5aaf55){logger['error'](_0x5853('0xa'),_0x3947c9,_0x5aaf55);_0x47eec8(_0x5aaf55);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 795337c..a32490f 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 _0x4821=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x7fbfcf,_0x4ad4c8){var _0x1f9f9c=function(_0x6fd1f){while(--_0x6fd1f){_0x7fbfcf['push'](_0x7fbfcf['shift']());}};_0x1f9f9c(++_0x4ad4c8);}(_0x4821,0x165));var _0x1482=function(_0x1567a2,_0x534a3f){_0x1567a2=_0x1567a2-0x0;var _0x5b2e4e=_0x4821[_0x1567a2];return _0x5b2e4e;};'use strict';var multer=require(_0x1482('0x0'));var util=require('util');var path=require(_0x1482('0x1'));var timeout=require(_0x1482('0x2'));var express=require('express');var router=express[_0x1482('0x3')]();var fs_extra=require(_0x1482('0x4'));var auth=require(_0x1482('0x5'));var interaction=require(_0x1482('0x6'));var config=require(_0x1482('0x7'));var controller=require('./faxTransferReport.controller');router[_0x1482('0x8')]('/',auth['isAuthenticated'](),controller[_0x1482('0x9')]);router[_0x1482('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1482('0xa')]);router['get'](_0x1482('0xb'),auth[_0x1482('0xc')](),controller[_0x1482('0xd')]);router[_0x1482('0xe')]('/',auth[_0x1482('0xc')](),controller['create']);router[_0x1482('0xf')](_0x1482('0xb'),auth[_0x1482('0xc')](),controller[_0x1482('0x10')]);router[_0x1482('0x11')](_0x1482('0xb'),auth[_0x1482('0xc')](),controller[_0x1482('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0278=['isAuthenticated','index','/describe','create','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x46db15,_0x172c92){var _0x4b42a7=function(_0x2866f5){while(--_0x2866f5){_0x46db15['push'](_0x46db15['shift']());}};_0x4b42a7(++_0x172c92);}(_0x0278,0x1d5));var _0x8027=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x0278[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require('multer');var util=require(_0x8027('0x0'));var path=require(_0x8027('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8027('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8027('0x3'));var config=require(_0x8027('0x4'));var controller=require(_0x8027('0x5'));router[_0x8027('0x6')]('/',auth[_0x8027('0x7')](),controller[_0x8027('0x8')]);router[_0x8027('0x6')](_0x8027('0x9'),auth[_0x8027('0x7')](),controller['describe']);router[_0x8027('0x6')]('/:id',auth[_0x8027('0x7')](),controller['show']);router['post']('/',auth[_0x8027('0x7')](),controller[_0x8027('0xa')]);router[_0x8027('0xb')](_0x8027('0xc'),auth[_0x8027('0x7')](),controller[_0x8027('0xd')]);router[_0x8027('0xe')]('/:id',auth[_0x8027('0x7')](),controller[_0x8027('0xf')]);module[_0x8027('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e5c7282..1dd894d 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 _0xc041=['isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id'];(function(_0x162b92,_0x579692){var _0x53bcc8=function(_0x45f90){while(--_0x45f90){_0x162b92['push'](_0x162b92['shift']());}};_0x53bcc8(++_0x579692);}(_0xc041,0xab));var _0x1c04=function(_0x1ea6eb,_0x33d3d4){_0x1ea6eb=_0x1ea6eb-0x0;var _0x127200=_0xc041[_0x1ea6eb];return _0x127200;};'use strict';var multer=require(_0x1c04('0x0'));var util=require('util');var path=require(_0x1c04('0x1'));var timeout=require(_0x1c04('0x2'));var express=require(_0x1c04('0x3'));var router=express[_0x1c04('0x4')]();var fs_extra=require(_0x1c04('0x5'));var auth=require(_0x1c04('0x6'));var interaction=require(_0x1c04('0x7'));var config=require(_0x1c04('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1c04('0x9')]);router['get'](_0x1c04('0xa'),auth[_0x1c04('0xb')](),controller[_0x1c04('0xc')]);router[_0x1c04('0xd')](_0x1c04('0xe'),auth[_0x1c04('0xb')](),controller[_0x1c04('0xf')]);router[_0x1c04('0xd')](_0x1c04('0x10'),auth[_0x1c04('0xb')](),controller[_0x1c04('0x11')]);router['post']('/',auth[_0x1c04('0xb')](),controller[_0x1c04('0x12')]);router[_0x1c04('0x13')]('/:id/configurations',auth[_0x1c04('0xb')](),controller[_0x1c04('0x14')]);router[_0x1c04('0x15')](_0x1c04('0xa'),auth[_0x1c04('0xb')](),controller[_0x1c04('0x16')]);router[_0x1c04('0x17')](_0x1c04('0xa'),auth[_0x1c04('0xb')](),controller[_0x1c04('0x18')]);module[_0x1c04('0x19')]=router; \ No newline at end of file +var _0x7d20=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','/:id','show','get','getFields','create','post','/:id/configurations','addConfiguration','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d20,0xa5));var _0x07d2=function(_0x48cde0,_0xf898){_0x48cde0=_0x48cde0-0x0;var _0x48dada=_0x7d20[_0x48cde0];return _0x48dada;};'use strict';var multer=require(_0x07d2('0x0'));var util=require(_0x07d2('0x1'));var path=require('path');var timeout=require(_0x07d2('0x2'));var express=require(_0x07d2('0x3'));var router=express[_0x07d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x07d2('0x5'));var interaction=require(_0x07d2('0x6'));var config=require(_0x07d2('0x7'));var controller=require(_0x07d2('0x8'));router['get']('/',auth[_0x07d2('0x9')](),controller['index']);router['get'](_0x07d2('0xa'),auth[_0x07d2('0x9')](),controller[_0x07d2('0xb')]);router[_0x07d2('0xc')]('/:id/configurations',auth[_0x07d2('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x07d2('0x9')](),controller[_0x07d2('0xd')]);router['post']('/',auth[_0x07d2('0x9')](),controller[_0x07d2('0xe')]);router[_0x07d2('0xf')](_0x07d2('0x10'),auth['isAuthenticated'](),controller[_0x07d2('0x11')]);router[_0x07d2('0x12')](_0x07d2('0xa'),auth['isAuthenticated'](),controller[_0x07d2('0x13')]);router[_0x07d2('0x14')]('/:id',auth[_0x07d2('0x9')](),controller[_0x07d2('0x15')]);module[_0x07d2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 364d74a..d6263b8 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 _0x87d8=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x87d8,0x9e));var _0x887d=function(_0xeead8a,_0x3d2400){_0xeead8a=_0xeead8a-0x0;var _0x24742c=_0x87d8[_0xeead8a];return _0x24742c;};'use strict';var Sequelize=require(_0x887d('0x0'));module[_0x887d('0x1')]={'name':{'type':Sequelize[_0x887d('0x2')]},'description':{'type':Sequelize[_0x887d('0x2')]},'username':{'type':Sequelize[_0x887d('0x2')]},'remoteUri':{'type':Sequelize[_0x887d('0x2')]},'authType':{'type':Sequelize[_0x887d('0x3')](_0x887d('0x4')),'defaultValue':_0x887d('0x4')},'password':{'type':Sequelize[_0x887d('0x2')]},'consumerKey':{'type':Sequelize[_0x887d('0x2')]},'consumerSecret':{'type':Sequelize[_0x887d('0x2')]},'token':{'type':Sequelize[_0x887d('0x2')]},'tokenSecret':{'type':Sequelize[_0x887d('0x2')]},'serverUrl':{'type':Sequelize[_0x887d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x887d('0x3')](_0x887d('0x5'),_0x887d('0x6')),'defaultValue':_0x887d('0x5')}}; \ No newline at end of file +var _0x5cbf=['integrationTab','exports','STRING','ENUM','basic'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x5cbf,0x17d));var _0xf5cb=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x5cbf[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require('sequelize');module[_0xf5cb('0x0')]={'name':{'type':Sequelize[_0xf5cb('0x1')]},'description':{'type':Sequelize[_0xf5cb('0x1')]},'username':{'type':Sequelize[_0xf5cb('0x1')]},'remoteUri':{'type':Sequelize[_0xf5cb('0x1')]},'authType':{'type':Sequelize[_0xf5cb('0x2')](_0xf5cb('0x3')),'defaultValue':_0xf5cb('0x3')},'password':{'type':Sequelize[_0xf5cb('0x1')]},'consumerKey':{'type':Sequelize[_0xf5cb('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf5cb('0x1')]},'tokenSecret':{'type':Sequelize[_0xf5cb('0x1')]},'serverUrl':{'type':Sequelize[_0xf5cb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf5cb('0x2')](_0xf5cb('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b39eef3..7213472 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 _0x8408=['create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','options','find'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x8408,0x9d));var _0x8840=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x8408[_0x4e90e3];return _0x295e5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8840('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8840('0x1'));var rp=require(_0x8840('0x2'));var moment=require('moment');var BPromise=require(_0x8840('0x3'));var Mustache=require(_0x8840('0x4'));var util=require('util');var path=require(_0x8840('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8840('0x6'));var fs=require('fs');var fs_extra=require(_0x8840('0x7'));var _=require(_0x8840('0x8'));var squel=require(_0x8840('0x9'));var crypto=require(_0x8840('0xa'));var jsforce=require(_0x8840('0xb'));var deskjs=require(_0x8840('0xc'));var toCsv=require(_0x8840('0xd'));var querystring=require(_0x8840('0xe'));var Papa=require('papaparse');var Redis=require(_0x8840('0xf'));var authService=require(_0x8840('0x10'));var qs=require(_0x8840('0x11'));var as=require(_0x8840('0x12'));var hardwareService=require(_0x8840('0x13'));var logger=require(_0x8840('0x14'))(_0x8840('0x15'));var utils=require(_0x8840('0x16'));var config=require(_0x8840('0x17'));var licenseUtil=require(_0x8840('0x18'));var db=require(_0x8840('0x19'))['db'];var integrations=require(_0x8840('0x1a'));function respondWithStatusCode(_0x5d48ae,_0x5122be){_0x5122be=_0x5122be||0xcc;return function(_0x2e8459){if(_0x2e8459){return _0x5d48ae[_0x8840('0x1b')](_0x5122be);}return _0x5d48ae[_0x8840('0x1c')](_0x5122be)['end']();};}function respondWithResult(_0x503381,_0x572e38){_0x572e38=_0x572e38||0xc8;return function(_0xe05ce1){if(_0xe05ce1){return _0x503381[_0x8840('0x1c')](_0x572e38)[_0x8840('0x1d')](_0xe05ce1);}};}function respondWithFilteredResult(_0x365619,_0x38e387){return function(_0x14b19c){if(_0x14b19c){var _0x3779a5=typeof _0x38e387[_0x8840('0x1e')]===_0x8840('0x1f')&&typeof _0x38e387['limit']===_0x8840('0x1f');var _0x4798ba=_0x14b19c[_0x8840('0x20')];var _0x2bef3e=_0x3779a5?0x0:_0x38e387[_0x8840('0x1e')];var _0x21cee4=_0x3779a5?_0x14b19c[_0x8840('0x20')]:_0x38e387['offset']+_0x38e387['limit'];var _0x463a92;if(_0x21cee4>=_0x4798ba){_0x21cee4=_0x4798ba;_0x463a92=0xc8;}else{_0x463a92=0xce;}_0x365619[_0x8840('0x1c')](_0x463a92);return _0x365619[_0x8840('0x21')](_0x8840('0x22'),_0x2bef3e+'-'+_0x21cee4+'/'+_0x4798ba)[_0x8840('0x1d')](_0x14b19c);}return null;};}function patchUpdates(_0x1c36f7){return function(_0x386fb8){try{jsonpatch[_0x8840('0x23')](_0x386fb8,_0x1c36f7,!![]);}catch(_0x58d138){return BPromise['reject'](_0x58d138);}return _0x386fb8[_0x8840('0x24')]();};}function saveUpdates(_0x2f1c90,_0x615b96){return function(_0x42d2c8){if(_0x42d2c8){return _0x42d2c8[_0x8840('0x25')](_0x2f1c90)[_0x8840('0x26')](function(_0x378747){return _0x378747;});}return null;};}function removeEntity(_0x75477b,_0x20c211){return function(_0x2e7fa1){if(_0x2e7fa1){return _0x2e7fa1[_0x8840('0x27')]()[_0x8840('0x26')](function(){_0x75477b['status'](0xcc)[_0x8840('0x28')]();});}};}function handleEntityNotFound(_0x29b407,_0x4d8693){return function(_0x3dba9a){if(!_0x3dba9a){_0x29b407[_0x8840('0x1b')](0x194);}return _0x3dba9a;};}function handleError(_0x87e4c4,_0x44ef22){_0x44ef22=_0x44ef22||0x1f4;return function(_0xcf432a){logger[_0x8840('0x29')](_0xcf432a['stack']);if(_0xcf432a[_0x8840('0x2a')]){delete _0xcf432a['name'];}_0x87e4c4[_0x8840('0x1c')](_0x44ef22)[_0x8840('0x2b')](_0xcf432a);};}exports['index']=function(_0x5295e7,_0x5b9838){var _0x2b43d7={},_0x7027f6={},_0x1028df={'count':0x0,'rows':[]};var _0x41db0b=_[_0x8840('0x2c')](db[_0x8840('0x2d')][_0x8840('0x2e')],function(_0xf103ee){return{'name':_0xf103ee[_0x8840('0x2f')],'type':_0xf103ee[_0x8840('0x30')][_0x8840('0x31')]};});_0x7027f6[_0x8840('0x32')]=_[_0x8840('0x2c')](_0x41db0b,'name');_0x7027f6[_0x8840('0x33')]=_[_0x8840('0x34')](_0x5295e7[_0x8840('0x33')]);_0x7027f6[_0x8840('0x35')]=_[_0x8840('0x36')](_0x7027f6['model'],_0x7027f6[_0x8840('0x33')]);_0x2b43d7[_0x8840('0x37')]=_[_0x8840('0x36')](_0x7027f6[_0x8840('0x32')],qs[_0x8840('0x38')](_0x5295e7[_0x8840('0x33')][_0x8840('0x38')]));_0x2b43d7[_0x8840('0x37')]=_0x2b43d7['attributes']['length']?_0x2b43d7['attributes']:_0x7027f6[_0x8840('0x32')];if(!_0x5295e7[_0x8840('0x33')]['hasOwnProperty'](_0x8840('0x39'))){_0x2b43d7[_0x8840('0x3a')]=qs['limit'](_0x5295e7[_0x8840('0x33')][_0x8840('0x3a')]);_0x2b43d7['offset']=qs['offset'](_0x5295e7[_0x8840('0x33')][_0x8840('0x1e')]);}_0x2b43d7[_0x8840('0x3b')]=qs[_0x8840('0x3c')](_0x5295e7['query']['sort']);_0x2b43d7[_0x8840('0x3d')]=qs['filters'](_[_0x8840('0x3e')](_0x5295e7[_0x8840('0x33')],_0x7027f6['filters']),_0x41db0b);if(_0x5295e7[_0x8840('0x33')][_0x8840('0x3f')]){_0x2b43d7[_0x8840('0x3d')]=_[_0x8840('0x40')](_0x2b43d7['where'],{'$or':_[_0x8840('0x2c')](_0x41db0b,function(_0x281951){if(_0x281951[_0x8840('0x30')]!==_0x8840('0x41')){var _0x49b061={};_0x49b061[_0x281951[_0x8840('0x2a')]]={'$like':'%'+_0x5295e7[_0x8840('0x33')][_0x8840('0x3f')]+'%'};return _0x49b061;}})});}_0x2b43d7=_[_0x8840('0x40')]({},_0x2b43d7,_0x5295e7['options']);var _0x11ebe9={'where':_0x2b43d7['where']};return db[_0x8840('0x2d')][_0x8840('0x20')](_0x11ebe9)[_0x8840('0x26')](function(_0x5b2aba){_0x1028df['count']=_0x5b2aba;if(_0x5295e7[_0x8840('0x33')]['includeAll']){_0x2b43d7[_0x8840('0x42')]=[{'all':!![]}];}return db[_0x8840('0x2d')][_0x8840('0x43')](_0x2b43d7);})[_0x8840('0x26')](function(_0x1d194d){_0x1028df[_0x8840('0x44')]=_0x1d194d;return _0x1028df;})[_0x8840('0x26')](respondWithFilteredResult(_0x5b9838,_0x2b43d7))[_0x8840('0x45')](handleError(_0x5b9838,null));};exports[_0x8840('0x46')]=function(_0x5d87c5,_0x4951b6){var _0x489903={'raw':![],'where':{'id':_0x5d87c5[_0x8840('0x47')]['id']}},_0x2ab187={};_0x2ab187[_0x8840('0x32')]=_[_0x8840('0x34')](db[_0x8840('0x2d')][_0x8840('0x2e')]);_0x2ab187[_0x8840('0x33')]=_[_0x8840('0x34')](_0x5d87c5[_0x8840('0x33')]);_0x2ab187[_0x8840('0x35')]=_[_0x8840('0x36')](_0x2ab187[_0x8840('0x32')],_0x2ab187['query']);_0x489903['attributes']=_['intersection'](_0x2ab187[_0x8840('0x32')],qs['fields'](_0x5d87c5[_0x8840('0x33')][_0x8840('0x38')]));_0x489903[_0x8840('0x37')]=_0x489903['attributes'][_0x8840('0x48')]?_0x489903[_0x8840('0x37')]:_0x2ab187[_0x8840('0x32')];if(_0x5d87c5[_0x8840('0x33')]['includeAll']){_0x489903[_0x8840('0x42')]=[{'all':!![]}];}_0x489903=_['merge']({},_0x489903,_0x5d87c5[_0x8840('0x49')]);return db[_0x8840('0x2d')][_0x8840('0x4a')](_0x489903)[_0x8840('0x26')](handleEntityNotFound(_0x4951b6,null))[_0x8840('0x26')](respondWithResult(_0x4951b6,null))['catch'](handleError(_0x4951b6,null));};exports[_0x8840('0x4b')]=function(_0x20a40d,_0x3a5acf){return db[_0x8840('0x2d')][_0x8840('0x4b')](_0x20a40d[_0x8840('0x4c')],{})['then'](respondWithResult(_0x3a5acf,0xc9))[_0x8840('0x45')](handleError(_0x3a5acf,null));};exports[_0x8840('0x25')]=function(_0x2fda33,_0x4e75d1){if(_0x2fda33['body']['id']){delete _0x2fda33['body']['id'];}return db['DeskAccount'][_0x8840('0x4a')]({'where':{'id':_0x2fda33['params']['id']}})[_0x8840('0x26')](handleEntityNotFound(_0x4e75d1,null))['then'](saveUpdates(_0x2fda33[_0x8840('0x4c')],null))[_0x8840('0x26')](respondWithResult(_0x4e75d1,null))[_0x8840('0x45')](handleError(_0x4e75d1,null));};exports['destroy']=function(_0x27669e,_0x4c44f0){return db[_0x8840('0x2d')][_0x8840('0x4a')]({'where':{'id':_0x27669e[_0x8840('0x47')]['id']}})[_0x8840('0x26')](handleEntityNotFound(_0x4c44f0,null))[_0x8840('0x26')](removeEntity(_0x4c44f0,null))[_0x8840('0x45')](handleError(_0x4c44f0,null));};exports[_0x8840('0x4d')]=function(_0x148f60,_0x380878,_0x10a9b5){var _0x1e6b96={};var _0x5e13a7={};var _0x2372b4;var _0x2f6ad9;return db[_0x8840('0x2d')][_0x8840('0x4e')]({'where':{'id':_0x148f60[_0x8840('0x47')]['id']}})[_0x8840('0x26')](handleEntityNotFound(_0x380878,null))['then'](function(_0x1ca3bd){if(_0x1ca3bd){_0x2372b4=_0x1ca3bd;_0x5e13a7[_0x8840('0x32')]=_[_0x8840('0x34')](db[_0x8840('0x4f')][_0x8840('0x2e')]);_0x5e13a7[_0x8840('0x33')]=_[_0x8840('0x34')](_0x148f60[_0x8840('0x33')]);_0x5e13a7[_0x8840('0x35')]=_[_0x8840('0x36')](_0x5e13a7[_0x8840('0x32')],_0x5e13a7[_0x8840('0x33')]);_0x1e6b96[_0x8840('0x37')]=_[_0x8840('0x36')](_0x5e13a7[_0x8840('0x32')],qs[_0x8840('0x38')](_0x148f60[_0x8840('0x33')][_0x8840('0x38')]));_0x1e6b96['attributes']=_0x1e6b96[_0x8840('0x37')][_0x8840('0x48')]?_0x1e6b96[_0x8840('0x37')]:_0x5e13a7[_0x8840('0x32')];_0x1e6b96[_0x8840('0x3b')]=qs[_0x8840('0x3c')](_0x148f60['query']['sort']);_0x1e6b96[_0x8840('0x3d')]=qs['filters'](_[_0x8840('0x3e')](_0x148f60[_0x8840('0x33')],_0x5e13a7[_0x8840('0x35')]));if(_0x148f60[_0x8840('0x33')][_0x8840('0x3f')]){_0x1e6b96[_0x8840('0x3d')]=_[_0x8840('0x40')](_0x1e6b96[_0x8840('0x3d')],{'$or':_['map'](_0x1e6b96[_0x8840('0x37')],function(_0x2b4a9a){var _0x42f640={};_0x42f640[_0x2b4a9a]={'$like':'%'+_0x148f60[_0x8840('0x33')][_0x8840('0x3f')]+'%'};return _0x42f640;})});}_0x1e6b96=_[_0x8840('0x40')]({},_0x1e6b96,_0x148f60[_0x8840('0x49')]);return _0x2372b4['getConfigurations'](_0x1e6b96);}})[_0x8840('0x26')](function(_0x190139){if(_0x190139){_0x2f6ad9=_0x190139[_0x8840('0x48')];if(!_0x148f60['query'][_0x8840('0x50')](_0x8840('0x39'))){_0x1e6b96[_0x8840('0x3a')]=qs['limit'](_0x148f60['query'][_0x8840('0x3a')]);_0x1e6b96[_0x8840('0x1e')]=qs['offset'](_0x148f60[_0x8840('0x33')]['offset']);}return _0x2372b4[_0x8840('0x4d')](_0x1e6b96);}})[_0x8840('0x26')](function(_0x1ed838){if(_0x1ed838){return _0x1ed838?{'count':_0x2f6ad9,'rows':_0x1ed838}:null;}})['then'](respondWithResult(_0x380878,null))['catch'](handleError(_0x380878,null));};exports['addConfiguration']=function(_0x6c5fe5,_0x25f866,_0x1df552){if(_0x6c5fe5[_0x8840('0x4c')]['id']){delete _0x6c5fe5[_0x8840('0x4c')]['id'];}return db[_0x8840('0x2d')][_0x8840('0x4e')]({'where':{'id':_0x6c5fe5['params']['id']}})['then'](handleEntityNotFound(_0x25f866,null))[_0x8840('0x26')](function(_0x673f90){if(_0x673f90){_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x51')]=_0x673f90['id'];_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x52')]=integrations[_0x8840('0x53')](_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x54')],_0x6c5fe5[_0x8840('0x4c')][_0x8840('0x30')]);_0x6c5fe5[_0x8840('0x4c')]['Descriptions']=integrations[_0x8840('0x55')](_0x6c5fe5[_0x8840('0x4c')]['channel'],_0x6c5fe5['body'][_0x8840('0x30')]);return db['DeskConfiguration'][_0x8840('0x4b')](_0x6c5fe5[_0x8840('0x4c')],{'include':[{'model':db[_0x8840('0x56')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x8840('0x57')}]});}return null;})[_0x8840('0x26')](respondWithResult(_0x25f866,null))[_0x8840('0x45')](handleError(_0x25f866,null));};exports[_0x8840('0x58')]=function(_0xeb7b7e,_0x793989,_0x564804){var _0x3188fb=[{'name':'priority','label':_0x8840('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2fef6e='';return db['DeskAccount'][_0x8840('0x4e')]({'where':{'id':_0xeb7b7e['params']['id']},'attributes':['id','remoteUri',_0x8840('0x5a'),_0x8840('0x5b'),_0x8840('0x5c'),'consumerKey',_0x8840('0x5d'),_0x8840('0x5e'),_0x8840('0x5f')]})['then'](handleEntityNotFound(_0x793989,null))[_0x8840('0x26')](function(_0x110e55){if(_0x110e55){_0x2fef6e=_0x110e55['remoteUri'];var _0x34108c=_0x2fef6e[_0x8840('0x60')](-0x1);if(_0x34108c==='/'){_0x2fef6e=_0x2fef6e[_0x8840('0x61')](0x0,_0x2fef6e[_0x8840('0x62')](_0x34108c));}var _0x411413={'method':_0x8840('0x63'),'uri':util[_0x8840('0x64')](_0x8840('0x65'),_0x2fef6e),'headers':{'Content-Type':_0x8840('0x66'),'Accept':'application/json'},'json':!![]};if(_0x110e55['authType']===_0x8840('0x67')){_0x411413['headers'][_0x8840('0x68')]=util['format'](_0x8840('0x69'),new Buffer(util['format'](_0x8840('0x6a'),_0x110e55[_0x8840('0x5b')],_0x110e55[_0x8840('0x5c')]))[_0x8840('0x6b')]('base64'));}return rp(_0x411413)[_0x8840('0x26')](function(_0x2a77f7){return _0x3188fb['concat'](_[_0x8840('0x2c')](_0x2a77f7[_0x8840('0x6c')][_0x8840('0x6d')],function(_0x354f0b){return{'id':_0x354f0b[_0x8840('0x2a')],'name':_0x354f0b[_0x8840('0x2a')],'type':_0x354f0b[_0x8840('0x30')],'active':_0x354f0b[_0x8840('0x6e')],'label':_0x354f0b[_0x8840('0x6f')],'custom':!![]};}));});}})['then'](function(_0x554e47){return{'count':_0x554e47[_0x8840('0x48')],'rows':_0x554e47};})[_0x8840('0x26')](respondWithResult(_0x793989,null))[_0x8840('0x45')](function(_0x5ae6bb){var _0x4bde03=_0xeb7b7e[_0x8840('0x33')][_0x8840('0x70')]?0x1f4:_0x5ae6bb[_0x8840('0x71')]||0x1f4;logger[_0x8840('0x29')](_0x8840('0x72'),'getFields',_0x4bde03,JSON[_0x8840('0x73')](_0x5ae6bb));delete _0x5ae6bb[_0x8840('0x2a')];if(_0x4bde03===0x191){_0x4bde03=0x190;}_0x793989[_0x8840('0x1c')](_0x4bde03)[_0x8840('0x2b')](_0xeb7b7e[_0x8840('0x33')][_0x8840('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x5ae6bb[_0x8840('0x71')]}:_0x5ae6bb);});}; \ No newline at end of file +var _0x6840=['destroy','getConfigurations','DeskConfiguration','rawAttributes','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','findOne','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','%s:%s','password','base64','concat','entries','active','label','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','end','stack','name','index','map','DeskAccount','fieldName','query','keys','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','merge','type','options','include','catch','params','includeAll','find','create','body'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6840,0x1da));var _0x0684=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6840[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x0684('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0684('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0684('0x2'));var moment=require(_0x0684('0x3'));var BPromise=require(_0x0684('0x4'));var Mustache=require(_0x0684('0x5'));var util=require(_0x0684('0x6'));var path=require(_0x0684('0x7'));var sox=require(_0x0684('0x8'));var csv=require(_0x0684('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0684('0xa'));var crypto=require(_0x0684('0xb'));var jsforce=require(_0x0684('0xc'));var deskjs=require(_0x0684('0xd'));var toCsv=require(_0x0684('0x9'));var querystring=require(_0x0684('0xe'));var Papa=require(_0x0684('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0684('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0684('0x11'));var logger=require(_0x0684('0x12'))(_0x0684('0x13'));var utils=require(_0x0684('0x14'));var config=require(_0x0684('0x15'));var licenseUtil=require(_0x0684('0x16'));var db=require(_0x0684('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x39ce4e,_0xd058ab){_0xd058ab=_0xd058ab||0xcc;return function(_0x53db46){if(_0x53db46){return _0x39ce4e['sendStatus'](_0xd058ab);}return _0x39ce4e['status'](_0xd058ab)['end']();};}function respondWithResult(_0x54c4a1,_0x5db282){_0x5db282=_0x5db282||0xc8;return function(_0x1b0ecb){if(_0x1b0ecb){return _0x54c4a1['status'](_0x5db282)[_0x0684('0x18')](_0x1b0ecb);}};}function respondWithFilteredResult(_0x578c71,_0x182021){return function(_0x374764){if(_0x374764){var _0x59e24f=typeof _0x182021[_0x0684('0x19')]===_0x0684('0x1a')&&typeof _0x182021[_0x0684('0x1b')]===_0x0684('0x1a');var _0x39d6e7=_0x374764['count'];var _0x3f163a=_0x59e24f?0x0:_0x182021[_0x0684('0x19')];var _0x211353=_0x59e24f?_0x374764[_0x0684('0x1c')]:_0x182021[_0x0684('0x19')]+_0x182021[_0x0684('0x1b')];var _0x155041;if(_0x211353>=_0x39d6e7){_0x211353=_0x39d6e7;_0x155041=0xc8;}else{_0x155041=0xce;}_0x578c71[_0x0684('0x1d')](_0x155041);return _0x578c71[_0x0684('0x1e')](_0x0684('0x1f'),_0x3f163a+'-'+_0x211353+'/'+_0x39d6e7)[_0x0684('0x18')](_0x374764);}return null;};}function patchUpdates(_0x274045){return function(_0x42c3eb){try{jsonpatch[_0x0684('0x20')](_0x42c3eb,_0x274045,!![]);}catch(_0xdeba01){return BPromise[_0x0684('0x21')](_0xdeba01);}return _0x42c3eb['save']();};}function saveUpdates(_0x458631,_0x16c0bf){return function(_0x32f668){if(_0x32f668){return _0x32f668[_0x0684('0x22')](_0x458631)[_0x0684('0x23')](function(_0x55832c){return _0x55832c;});}return null;};}function removeEntity(_0xfed363,_0x25cd43){return function(_0x555284){if(_0x555284){return _0x555284['destroy']()[_0x0684('0x23')](function(){_0xfed363[_0x0684('0x1d')](0xcc)[_0x0684('0x24')]();});}};}function handleEntityNotFound(_0x295a2a,_0x4f51c6){return function(_0x5ce966){if(!_0x5ce966){_0x295a2a['sendStatus'](0x194);}return _0x5ce966;};}function handleError(_0xa67c2d,_0x29b8b1){_0x29b8b1=_0x29b8b1||0x1f4;return function(_0x75d971){logger['error'](_0x75d971[_0x0684('0x25')]);if(_0x75d971[_0x0684('0x26')]){delete _0x75d971[_0x0684('0x26')];}_0xa67c2d[_0x0684('0x1d')](_0x29b8b1)['send'](_0x75d971);};}exports[_0x0684('0x27')]=function(_0x16efe9,_0x53c7e7){var _0x30dc47={},_0x524055={},_0x58b22e={'count':0x0,'rows':[]};var _0xa38555=_[_0x0684('0x28')](db[_0x0684('0x29')]['rawAttributes'],function(_0x8d5143){return{'name':_0x8d5143[_0x0684('0x2a')],'type':_0x8d5143['type']['key']};});_0x524055['model']=_[_0x0684('0x28')](_0xa38555,_0x0684('0x26'));_0x524055[_0x0684('0x2b')]=_[_0x0684('0x2c')](_0x16efe9['query']);_0x524055[_0x0684('0x2d')]=_[_0x0684('0x2e')](_0x524055[_0x0684('0x2f')],_0x524055[_0x0684('0x2b')]);_0x30dc47[_0x0684('0x30')]=_[_0x0684('0x2e')](_0x524055[_0x0684('0x2f')],qs[_0x0684('0x31')](_0x16efe9[_0x0684('0x2b')]['fields']));_0x30dc47[_0x0684('0x30')]=_0x30dc47['attributes'][_0x0684('0x32')]?_0x30dc47[_0x0684('0x30')]:_0x524055[_0x0684('0x2f')];if(!_0x16efe9['query']['hasOwnProperty']('nolimit')){_0x30dc47[_0x0684('0x1b')]=qs[_0x0684('0x1b')](_0x16efe9['query']['limit']);_0x30dc47[_0x0684('0x19')]=qs[_0x0684('0x19')](_0x16efe9[_0x0684('0x2b')][_0x0684('0x19')]);}_0x30dc47[_0x0684('0x33')]=qs[_0x0684('0x34')](_0x16efe9[_0x0684('0x2b')][_0x0684('0x34')]);_0x30dc47['where']=qs[_0x0684('0x2d')](_[_0x0684('0x35')](_0x16efe9[_0x0684('0x2b')],_0x524055[_0x0684('0x2d')]),_0xa38555);if(_0x16efe9[_0x0684('0x2b')][_0x0684('0x36')]){_0x30dc47[_0x0684('0x37')]=_[_0x0684('0x38')](_0x30dc47[_0x0684('0x37')],{'$or':_[_0x0684('0x28')](_0xa38555,function(_0x2bbc80){if(_0x2bbc80[_0x0684('0x39')]!=='VIRTUAL'){var _0x268d9d={};_0x268d9d[_0x2bbc80[_0x0684('0x26')]]={'$like':'%'+_0x16efe9[_0x0684('0x2b')][_0x0684('0x36')]+'%'};return _0x268d9d;}})});}_0x30dc47=_[_0x0684('0x38')]({},_0x30dc47,_0x16efe9[_0x0684('0x3a')]);var _0x47f187={'where':_0x30dc47['where']};return db[_0x0684('0x29')][_0x0684('0x1c')](_0x47f187)['then'](function(_0x3034dc){_0x58b22e['count']=_0x3034dc;if(_0x16efe9[_0x0684('0x2b')]['includeAll']){_0x30dc47[_0x0684('0x3b')]=[{'all':!![]}];}return db[_0x0684('0x29')]['findAll'](_0x30dc47);})[_0x0684('0x23')](function(_0x154131){_0x58b22e['rows']=_0x154131;return _0x58b22e;})[_0x0684('0x23')](respondWithFilteredResult(_0x53c7e7,_0x30dc47))[_0x0684('0x3c')](handleError(_0x53c7e7,null));};exports['show']=function(_0x104204,_0x30f6b0){var _0xd6496d={'raw':![],'where':{'id':_0x104204[_0x0684('0x3d')]['id']}},_0x3c30a4={};_0x3c30a4[_0x0684('0x2f')]=_[_0x0684('0x2c')](db['DeskAccount']['rawAttributes']);_0x3c30a4[_0x0684('0x2b')]=_['keys'](_0x104204[_0x0684('0x2b')]);_0x3c30a4[_0x0684('0x2d')]=_['intersection'](_0x3c30a4[_0x0684('0x2f')],_0x3c30a4[_0x0684('0x2b')]);_0xd6496d[_0x0684('0x30')]=_['intersection'](_0x3c30a4['model'],qs[_0x0684('0x31')](_0x104204['query'][_0x0684('0x31')]));_0xd6496d[_0x0684('0x30')]=_0xd6496d[_0x0684('0x30')][_0x0684('0x32')]?_0xd6496d['attributes']:_0x3c30a4[_0x0684('0x2f')];if(_0x104204[_0x0684('0x2b')][_0x0684('0x3e')]){_0xd6496d[_0x0684('0x3b')]=[{'all':!![]}];}_0xd6496d=_[_0x0684('0x38')]({},_0xd6496d,_0x104204[_0x0684('0x3a')]);return db[_0x0684('0x29')][_0x0684('0x3f')](_0xd6496d)[_0x0684('0x23')](handleEntityNotFound(_0x30f6b0,null))[_0x0684('0x23')](respondWithResult(_0x30f6b0,null))[_0x0684('0x3c')](handleError(_0x30f6b0,null));};exports[_0x0684('0x40')]=function(_0x735a1f,_0xfedb86){return db[_0x0684('0x29')][_0x0684('0x40')](_0x735a1f[_0x0684('0x41')],{})[_0x0684('0x23')](respondWithResult(_0xfedb86,0xc9))[_0x0684('0x3c')](handleError(_0xfedb86,null));};exports['update']=function(_0x319c04,_0x3e73a1){if(_0x319c04['body']['id']){delete _0x319c04[_0x0684('0x41')]['id'];}return db['DeskAccount'][_0x0684('0x3f')]({'where':{'id':_0x319c04[_0x0684('0x3d')]['id']}})[_0x0684('0x23')](handleEntityNotFound(_0x3e73a1,null))['then'](saveUpdates(_0x319c04['body'],null))[_0x0684('0x23')](respondWithResult(_0x3e73a1,null))[_0x0684('0x3c')](handleError(_0x3e73a1,null));};exports[_0x0684('0x42')]=function(_0x56877b,_0x130142){return db['DeskAccount'][_0x0684('0x3f')]({'where':{'id':_0x56877b[_0x0684('0x3d')]['id']}})[_0x0684('0x23')](handleEntityNotFound(_0x130142,null))['then'](removeEntity(_0x130142,null))['catch'](handleError(_0x130142,null));};exports[_0x0684('0x43')]=function(_0x1d711b,_0x4d4f6e,_0x958d9){var _0x13a8f1={};var _0x53f335={};var _0x440fef;var _0x57d58b;return db[_0x0684('0x29')]['findOne']({'where':{'id':_0x1d711b[_0x0684('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4d4f6e,null))[_0x0684('0x23')](function(_0x3a1335){if(_0x3a1335){_0x440fef=_0x3a1335;_0x53f335[_0x0684('0x2f')]=_[_0x0684('0x2c')](db[_0x0684('0x44')][_0x0684('0x45')]);_0x53f335[_0x0684('0x2b')]=_[_0x0684('0x2c')](_0x1d711b[_0x0684('0x2b')]);_0x53f335[_0x0684('0x2d')]=_[_0x0684('0x2e')](_0x53f335[_0x0684('0x2f')],_0x53f335['query']);_0x13a8f1[_0x0684('0x30')]=_[_0x0684('0x2e')](_0x53f335[_0x0684('0x2f')],qs[_0x0684('0x31')](_0x1d711b[_0x0684('0x2b')][_0x0684('0x31')]));_0x13a8f1[_0x0684('0x30')]=_0x13a8f1[_0x0684('0x30')]['length']?_0x13a8f1[_0x0684('0x30')]:_0x53f335[_0x0684('0x2f')];_0x13a8f1['order']=qs['sort'](_0x1d711b['query'][_0x0684('0x34')]);_0x13a8f1['where']=qs[_0x0684('0x2d')](_[_0x0684('0x35')](_0x1d711b[_0x0684('0x2b')],_0x53f335[_0x0684('0x2d')]));if(_0x1d711b[_0x0684('0x2b')][_0x0684('0x36')]){_0x13a8f1[_0x0684('0x37')]=_[_0x0684('0x38')](_0x13a8f1['where'],{'$or':_['map'](_0x13a8f1[_0x0684('0x30')],function(_0x139956){var _0x3d904c={};_0x3d904c[_0x139956]={'$like':'%'+_0x1d711b[_0x0684('0x2b')][_0x0684('0x36')]+'%'};return _0x3d904c;})});}_0x13a8f1=_[_0x0684('0x38')]({},_0x13a8f1,_0x1d711b[_0x0684('0x3a')]);return _0x440fef[_0x0684('0x43')](_0x13a8f1);}})[_0x0684('0x23')](function(_0x5c4efa){if(_0x5c4efa){_0x57d58b=_0x5c4efa[_0x0684('0x32')];if(!_0x1d711b[_0x0684('0x2b')]['hasOwnProperty'](_0x0684('0x46'))){_0x13a8f1['limit']=qs[_0x0684('0x1b')](_0x1d711b[_0x0684('0x2b')]['limit']);_0x13a8f1[_0x0684('0x19')]=qs[_0x0684('0x19')](_0x1d711b[_0x0684('0x2b')][_0x0684('0x19')]);}return _0x440fef[_0x0684('0x43')](_0x13a8f1);}})[_0x0684('0x23')](function(_0x1f099d){if(_0x1f099d){return _0x1f099d?{'count':_0x57d58b,'rows':_0x1f099d}:null;}})[_0x0684('0x23')](respondWithResult(_0x4d4f6e,null))[_0x0684('0x3c')](handleError(_0x4d4f6e,null));};exports['addConfiguration']=function(_0x312f38,_0x47c851,_0x4c8faf){if(_0x312f38[_0x0684('0x41')]['id']){delete _0x312f38[_0x0684('0x41')]['id'];}return db[_0x0684('0x29')]['findOne']({'where':{'id':_0x312f38[_0x0684('0x3d')]['id']}})[_0x0684('0x23')](handleEntityNotFound(_0x47c851,null))[_0x0684('0x23')](function(_0x3d784b){if(_0x3d784b){_0x312f38[_0x0684('0x41')][_0x0684('0x47')]=_0x3d784b['id'];_0x312f38[_0x0684('0x41')][_0x0684('0x48')]=integrations[_0x0684('0x49')](_0x312f38[_0x0684('0x41')][_0x0684('0x4a')],_0x312f38[_0x0684('0x41')][_0x0684('0x39')]);_0x312f38[_0x0684('0x41')][_0x0684('0x4b')]=integrations[_0x0684('0x4c')](_0x312f38['body'][_0x0684('0x4a')],_0x312f38[_0x0684('0x41')][_0x0684('0x39')]);return db[_0x0684('0x44')][_0x0684('0x40')](_0x312f38['body'],{'include':[{'model':db[_0x0684('0x4d')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x0684('0x4b')}]});}return null;})[_0x0684('0x23')](respondWithResult(_0x47c851,null))['catch'](handleError(_0x47c851,null));};exports[_0x0684('0x4e')]=function(_0x52e6fb,_0x4727a5,_0x1ad4f9){var _0x2193d3=[{'name':'priority','label':_0x0684('0x4f'),'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 _0x3da8e2='';return db['DeskAccount'][_0x0684('0x50')]({'where':{'id':_0x52e6fb[_0x0684('0x3d')]['id']},'attributes':['id',_0x0684('0x51'),_0x0684('0x52'),_0x0684('0x53'),'password',_0x0684('0x54'),_0x0684('0x55'),_0x0684('0x56'),_0x0684('0x57')]})[_0x0684('0x23')](handleEntityNotFound(_0x4727a5,null))[_0x0684('0x23')](function(_0x33b043){if(_0x33b043){_0x3da8e2=_0x33b043[_0x0684('0x51')];var _0x5a71e9=_0x3da8e2['slice'](-0x1);if(_0x5a71e9==='/'){_0x3da8e2=_0x3da8e2[_0x0684('0x58')](0x0,_0x3da8e2[_0x0684('0x59')](_0x5a71e9));}var _0x5d2899={'method':_0x0684('0x5a'),'uri':util[_0x0684('0x5b')]('%s/custom_fields',_0x3da8e2),'headers':{'Content-Type':_0x0684('0x5c'),'Accept':_0x0684('0x5c')},'json':!![]};if(_0x33b043['authType']===_0x0684('0x5d')){_0x5d2899[_0x0684('0x5e')][_0x0684('0x5f')]=util[_0x0684('0x5b')]('Basic\x20%s',new Buffer(util['format'](_0x0684('0x60'),_0x33b043[_0x0684('0x53')],_0x33b043[_0x0684('0x61')]))['toString'](_0x0684('0x62')));}return rp(_0x5d2899)['then'](function(_0x25f412){return _0x2193d3[_0x0684('0x63')](_[_0x0684('0x28')](_0x25f412['_embedded'][_0x0684('0x64')],function(_0x5aeddd){return{'id':_0x5aeddd[_0x0684('0x26')],'name':_0x5aeddd[_0x0684('0x26')],'type':_0x5aeddd[_0x0684('0x39')],'active':_0x5aeddd[_0x0684('0x65')],'label':_0x5aeddd[_0x0684('0x66')],'custom':!![]};}));});}})[_0x0684('0x23')](function(_0x28bdcc){return{'count':_0x28bdcc['length'],'rows':_0x28bdcc};})[_0x0684('0x23')](respondWithResult(_0x4727a5,null))[_0x0684('0x3c')](function(_0x2644fc){var _0x546444=_0x52e6fb[_0x0684('0x2b')]['test']?0x1f4:_0x2644fc['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0684('0x4e'),_0x546444,JSON[_0x0684('0x67')](_0x2644fc));delete _0x2644fc[_0x0684('0x26')];if(_0x546444===0x191){_0x546444=0x190;}_0x4727a5['status'](_0x546444)[_0x0684('0x68')](_0x52e6fb['query'][_0x0684('0x69')]?{'message':_0x0684('0x6a'),'statusCode':_0x2644fc[_0x0684('0x6b')]}:_0x2644fc);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4462154..0175345 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 _0xabbf=['../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','request-promise','rimraf','./intDeskAccount.attributes'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xabbf,0x1d0));var _0xfabb=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xabbf[_0x5951e8];return _0x20a1f5;};'use strict';var _=require(_0xfabb('0x0'));var util=require('util');var logger=require(_0xfabb('0x1'))('api');var moment=require(_0xfabb('0x2'));var BPromise=require('bluebird');var rp=require(_0xfabb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfabb('0x4'));var config=require('../../config/environment');var attributes=require(_0xfabb('0x5'));var integrations=require(_0xfabb('0x6'));module[_0xfabb('0x7')]=function(_0x94550c,_0xec10c3){return _0x94550c['define'](_0xfabb('0x8'),attributes,{'tableName':_0xfabb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a48=['exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a48,0x1d5));var _0x84a4=function(_0x5611f5,_0x174d69){_0x5611f5=_0x5611f5-0x0;var _0x48c8bb=_0x4a48[_0x5611f5];return _0x48c8bb;};'use strict';var _=require(_0x84a4('0x0'));var util=require(_0x84a4('0x1'));var logger=require(_0x84a4('0x2'))(_0x84a4('0x3'));var moment=require(_0x84a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x84a4('0x5'));var fs=require('fs');var path=require(_0x84a4('0x6'));var rimraf=require(_0x84a4('0x7'));var config=require(_0x84a4('0x8'));var attributes=require(_0x84a4('0x9'));var integrations=require(_0x84a4('0xa'));module[_0x84a4('0xb')]=function(_0x2737f9,_0x2d465b){return _0x2737f9[_0x84a4('0xc')](_0x84a4('0xd'),attributes,{'tableName':_0x84a4('0xe'),'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 f97b6e9..6f5681c 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 _0x8c42=['code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x161494,_0x425de9){var _0x9eb2fc=function(_0x1de847){while(--_0x1de847){_0x161494['push'](_0x161494['shift']());}};_0x9eb2fc(++_0x425de9);}(_0x8c42,0x93));var _0x28c4=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x8c42[_0x1034ca];return _0x1a023a;};'use strict';var _=require(_0x28c4('0x0'));var util=require(_0x28c4('0x1'));var moment=require(_0x28c4('0x2'));var BPromise=require(_0x28c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28c4('0x4'));var db=require(_0x28c4('0x5'))['db'];var utils=require(_0x28c4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x28c4('0x7'));var jayson=require(_0x28c4('0x8'));var client=jayson[_0x28c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357ea7,_0x27b8dc,_0x16472c){return new BPromise(function(_0x41667b,_0x31a99b){return client[_0x28c4('0xa')](_0x357ea7,_0x16472c)[_0x28c4('0xb')](function(_0x4c60c0){logger[_0x28c4('0xc')]('DeskAccount,\x20%s,\x20%s',_0x27b8dc,_0x28c4('0xd'));logger[_0x28c4('0xe')](_0x28c4('0xf'),_0x27b8dc,'request\x20sent',JSON[_0x28c4('0x10')](_0x4c60c0));if(_0x4c60c0['error']){if(_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x12')]===0x1f4){logger[_0x28c4('0x11')](_0x28c4('0x13'),_0x27b8dc,_0x4c60c0['error']['message']);return _0x31a99b(_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x14')]);}logger[_0x28c4('0x11')]('DeskAccount,\x20%s,\x20%s',_0x27b8dc,_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x14')]);return _0x41667b(_0x4c60c0[_0x28c4('0x11')][_0x28c4('0x14')]);}else{logger[_0x28c4('0xc')](_0x28c4('0x13'),_0x27b8dc,_0x28c4('0xd'));_0x41667b(_0x4c60c0['result'][_0x28c4('0x14')]);}})[_0x28c4('0x15')](function(_0x214e47){logger[_0x28c4('0x11')](_0x28c4('0x13'),_0x27b8dc,_0x214e47);_0x31a99b(_0x214e47);});});}exports[_0x28c4('0x16')]=function(_0x572988){var _0x3a6eba=this;return new Promise(function(_0x4aa3a3,_0xd3e2f){return db['DeskAccount']['findAll']({'raw':_0x572988[_0x28c4('0x17')]?_0x572988['options'][_0x28c4('0x18')]===undefined?!![]:![]:!![],'where':_0x572988[_0x28c4('0x17')]?_0x572988[_0x28c4('0x17')][_0x28c4('0x19')]||null:null,'attributes':_0x572988[_0x28c4('0x17')]?_0x572988[_0x28c4('0x17')][_0x28c4('0x1a')]||null:null,'limit':_0x572988[_0x28c4('0x17')]?_0x572988[_0x28c4('0x17')][_0x28c4('0x1b')]||null:null,'include':_0x572988['options']?_0x572988[_0x28c4('0x17')][_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x572988[_0x28c4('0x17')][_0x28c4('0x1c')],function(_0x499f3d){return{'model':db[_0x499f3d[_0x28c4('0x1e')]],'as':_0x499f3d['as'],'attributes':_0x499f3d['attributes'],'include':_0x499f3d[_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x499f3d[_0x28c4('0x1c')],function(_0x1b1d41){return{'model':db[_0x1b1d41[_0x28c4('0x1e')]],'as':_0x1b1d41['as'],'attributes':_0x1b1d41[_0x28c4('0x1a')],'include':_0x1b1d41[_0x28c4('0x1c')]?_['map'](_0x1b1d41['include'],function(_0x562ad5){return{'model':db[_0x562ad5[_0x28c4('0x1e')]],'as':_0x562ad5['as'],'attributes':_0x562ad5['attributes']};}):[]};}):[]};}):[]:[]})[_0x28c4('0xb')](function(_0x10d87b){logger[_0x28c4('0xc')](_0x28c4('0x16'),_0x572988);logger[_0x28c4('0xe')](_0x28c4('0x16'),_0x572988,JSON[_0x28c4('0x10')](_0x10d87b));_0x4aa3a3(_0x10d87b);})['catch'](function(_0x23fa77){logger[_0x28c4('0x11')](_0x28c4('0x16'),_0x23fa77['message'],_0x572988);_0xd3e2f(_0x3a6eba[_0x28c4('0x11')](0x1f4,_0x23fa77[_0x28c4('0x14')]));});});};exports[_0x28c4('0x1f')]=function(_0x240706){var _0x3bf9d3=this;return new Promise(function(_0x8c1a50,_0x3a538d){return db[_0x28c4('0x20')]['find']({'raw':_0x240706[_0x28c4('0x17')]?_0x240706[_0x28c4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x240706['options']?_0x240706[_0x28c4('0x17')][_0x28c4('0x19')]||null:null,'attributes':_0x240706[_0x28c4('0x17')]?_0x240706['options'][_0x28c4('0x1a')]||null:null,'include':_0x240706[_0x28c4('0x17')]?_0x240706[_0x28c4('0x17')][_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x240706['options'][_0x28c4('0x1c')],function(_0x590dd7){return{'model':db[_0x590dd7[_0x28c4('0x1e')]],'as':_0x590dd7['as'],'attributes':_0x590dd7[_0x28c4('0x1a')],'include':_0x590dd7[_0x28c4('0x1c')]?_[_0x28c4('0x1d')](_0x590dd7[_0x28c4('0x1c')],function(_0x20d43d){return{'model':db[_0x20d43d[_0x28c4('0x1e')]],'as':_0x20d43d['as'],'attributes':_0x20d43d[_0x28c4('0x1a')],'include':_0x20d43d['include']?_[_0x28c4('0x1d')](_0x20d43d[_0x28c4('0x1c')],function(_0x3f28ae){return{'model':db[_0x3f28ae[_0x28c4('0x1e')]],'as':_0x3f28ae['as'],'attributes':_0x3f28ae[_0x28c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a70d6){logger['info'](_0x28c4('0x1f'),_0x240706);logger[_0x28c4('0xe')](_0x28c4('0x1f'),_0x240706,JSON[_0x28c4('0x10')](_0x4a70d6));_0x8c1a50(_0x4a70d6);})[_0x28c4('0x15')](function(_0x2846b0){logger[_0x28c4('0x11')]('ShowDeskAccount',_0x2846b0['message'],_0x240706);_0x3a538d(_0x3bf9d3[_0x28c4('0x11')](0x1f4,_0x2846b0[_0x28c4('0x14')]));});});}; \ No newline at end of file +var _0x1586=['catch','GetDeskAccount','options','raw','where','attributes','include','map','model','then','DeskAccount','find','ShowDeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x27794b,_0x4d219b){var _0x3eb569=function(_0x27126d){while(--_0x27126d){_0x27794b['push'](_0x27794b['shift']());}};_0x3eb569(++_0x4d219b);}(_0x1586,0x1ed));var _0x6158=function(_0x552041,_0xc34ee7){_0x552041=_0x552041-0x0;var _0x198a1a=_0x1586[_0x552041];return _0x198a1a;};'use strict';var _=require(_0x6158('0x0'));var util=require(_0x6158('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6158('0x2'));var fs=require('fs');var Redis=require(_0x6158('0x3'));var db=require(_0x6158('0x4'))['db'];var utils=require(_0x6158('0x5'));var logger=require('../../config/logger')(_0x6158('0x6'));var config=require(_0x6158('0x7'));var jayson=require(_0x6158('0x8'));var client=jayson[_0x6158('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x208ed6,_0x2242c5,_0x272587){return new BPromise(function(_0x16aade,_0x2fddfe){return client['request'](_0x208ed6,_0x272587)['then'](function(_0x180f7d){logger['info'](_0x6158('0xa'),_0x2242c5,_0x6158('0xb'));logger[_0x6158('0xc')](_0x6158('0xd'),_0x2242c5,'request\x20sent',JSON[_0x6158('0xe')](_0x180f7d));if(_0x180f7d[_0x6158('0xf')]){if(_0x180f7d['error'][_0x6158('0x10')]===0x1f4){logger[_0x6158('0xf')](_0x6158('0xa'),_0x2242c5,_0x180f7d[_0x6158('0xf')]['message']);return _0x2fddfe(_0x180f7d[_0x6158('0xf')][_0x6158('0x11')]);}logger[_0x6158('0xf')](_0x6158('0xa'),_0x2242c5,_0x180f7d[_0x6158('0xf')][_0x6158('0x11')]);return _0x16aade(_0x180f7d[_0x6158('0xf')][_0x6158('0x11')]);}else{logger[_0x6158('0x12')](_0x6158('0xa'),_0x2242c5,_0x6158('0xb'));_0x16aade(_0x180f7d['result'][_0x6158('0x11')]);}})[_0x6158('0x13')](function(_0x2724d1){logger[_0x6158('0xf')]('DeskAccount,\x20%s,\x20%s',_0x2242c5,_0x2724d1);_0x2fddfe(_0x2724d1);});});}exports[_0x6158('0x14')]=function(_0x9f265c){var _0x3a5f9b=this;return new Promise(function(_0x24c462,_0x4d1ce8){return db['DeskAccount']['findAll']({'raw':_0x9f265c[_0x6158('0x15')]?_0x9f265c[_0x6158('0x15')][_0x6158('0x16')]===undefined?!![]:![]:!![],'where':_0x9f265c[_0x6158('0x15')]?_0x9f265c[_0x6158('0x15')][_0x6158('0x17')]||null:null,'attributes':_0x9f265c[_0x6158('0x15')]?_0x9f265c[_0x6158('0x15')][_0x6158('0x18')]||null:null,'limit':_0x9f265c['options']?_0x9f265c[_0x6158('0x15')]['limit']||null:null,'include':_0x9f265c[_0x6158('0x15')]?_0x9f265c[_0x6158('0x15')][_0x6158('0x19')]?_[_0x6158('0x1a')](_0x9f265c[_0x6158('0x15')][_0x6158('0x19')],function(_0x8fd4f3){return{'model':db[_0x8fd4f3[_0x6158('0x1b')]],'as':_0x8fd4f3['as'],'attributes':_0x8fd4f3['attributes'],'include':_0x8fd4f3[_0x6158('0x19')]?_[_0x6158('0x1a')](_0x8fd4f3['include'],function(_0x10d8c3){return{'model':db[_0x10d8c3['model']],'as':_0x10d8c3['as'],'attributes':_0x10d8c3[_0x6158('0x18')],'include':_0x10d8c3[_0x6158('0x19')]?_[_0x6158('0x1a')](_0x10d8c3['include'],function(_0x4d0fd4){return{'model':db[_0x4d0fd4[_0x6158('0x1b')]],'as':_0x4d0fd4['as'],'attributes':_0x4d0fd4[_0x6158('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6158('0x1c')](function(_0x3eeb99){logger[_0x6158('0x12')]('GetDeskAccount',_0x9f265c);logger[_0x6158('0xc')]('GetDeskAccount',_0x9f265c,JSON[_0x6158('0xe')](_0x3eeb99));_0x24c462(_0x3eeb99);})[_0x6158('0x13')](function(_0x1605de){logger['error'](_0x6158('0x14'),_0x1605de[_0x6158('0x11')],_0x9f265c);_0x4d1ce8(_0x3a5f9b[_0x6158('0xf')](0x1f4,_0x1605de['message']));});});};exports['ShowDeskAccount']=function(_0x31714b){var _0x34d6c3=this;return new Promise(function(_0x2ca552,_0x386bd8){return db[_0x6158('0x1d')][_0x6158('0x1e')]({'raw':_0x31714b[_0x6158('0x15')]?_0x31714b[_0x6158('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x31714b[_0x6158('0x15')]?_0x31714b[_0x6158('0x15')][_0x6158('0x17')]||null:null,'attributes':_0x31714b['options']?_0x31714b[_0x6158('0x15')][_0x6158('0x18')]||null:null,'include':_0x31714b['options']?_0x31714b[_0x6158('0x15')]['include']?_[_0x6158('0x1a')](_0x31714b[_0x6158('0x15')]['include'],function(_0x26ba63){return{'model':db[_0x26ba63['model']],'as':_0x26ba63['as'],'attributes':_0x26ba63[_0x6158('0x18')],'include':_0x26ba63['include']?_[_0x6158('0x1a')](_0x26ba63[_0x6158('0x19')],function(_0x2d3be5){return{'model':db[_0x2d3be5[_0x6158('0x1b')]],'as':_0x2d3be5['as'],'attributes':_0x2d3be5[_0x6158('0x18')],'include':_0x2d3be5[_0x6158('0x19')]?_[_0x6158('0x1a')](_0x2d3be5[_0x6158('0x19')],function(_0x155a0d){return{'model':db[_0x155a0d[_0x6158('0x1b')]],'as':_0x155a0d['as'],'attributes':_0x155a0d[_0x6158('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6158('0x1c')](function(_0x5a0dec){logger['info'](_0x6158('0x1f'),_0x31714b);logger[_0x6158('0xc')](_0x6158('0x1f'),_0x31714b,JSON['stringify'](_0x5a0dec));_0x2ca552(_0x5a0dec);})[_0x6158('0x13')](function(_0x312018){logger[_0x6158('0xf')](_0x6158('0x1f'),_0x312018[_0x6158('0x11')],_0x31714b);_0x386bd8(_0x34d6c3[_0x6158('0xf')](0x1f4,_0x312018[_0x6158('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 95e586e..e639588 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x543c2f,_0x1a6849){var _0xdecbfd=function(_0xceecef){while(--_0xceecef){_0x543c2f['push'](_0x543c2f['shift']());}};_0xdecbfd(++_0x1a6849);}(_0xedd9,0xfc));var _0x9edd=function(_0x12cdf9,_0x4a00cc){_0x12cdf9=_0x12cdf9-0x0;var _0x516146=_0xedd9[_0x12cdf9];return _0x516146;};'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['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x2535eb,_0x59ab9d){var _0x39aaa0=function(_0x481c02){while(--_0x481c02){_0x2535eb['push'](_0x2535eb['shift']());}};_0x39aaa0(++_0x59ab9d);}(_0xedd9,0xfc));var _0x9edd=function(_0x21bb2f,_0x4199b9){_0x21bb2f=_0x21bb2f-0x0;var _0x279b0e=_0xedd9[_0x21bb2f];return _0x279b0e;};'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['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 984de27..6f97a6b 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 _0x813b=['STRING','sequelize','exports'];(function(_0x176cbe,_0xfbbda6){var _0x1490cc=function(_0x12e158){while(--_0x12e158){_0x176cbe['push'](_0x176cbe['shift']());}};_0x1490cc(++_0xfbbda6);}(_0x813b,0x1f0));var _0xb813=function(_0x243d9f,_0x1a81ec){_0x243d9f=_0x243d9f-0x0;var _0x34a46c=_0x813b[_0x243d9f];return _0x34a46c;};'use strict';var Sequelize=require(_0xb813('0x0'));module[_0xb813('0x1')]={'name':{'type':Sequelize[_0xb813('0x2')]},'description':{'type':Sequelize[_0xb813('0x2')]}}; \ No newline at end of file +var _0xf92d=['exports','STRING'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xf92d,0xae));var _0xdf92=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xf92d[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require('sequelize');module[_0xdf92('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdf92('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 0e2c623..62f9a7a 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 _0x1c92=['setTags','ids','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','error','send','index','map','DeskConfiguration','fieldName','type','key','name','keys','query','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','fields','find','create','body','findOne','params','DeskField','pick','getFields','getSubjects','getDescriptions','getTags','Tag'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x1c92,0x104));var _0x21c9=function(_0x37ce45,_0xda6746){_0x37ce45=_0x37ce45-0x0;var _0x17d5f7=_0x1c92[_0x37ce45];return _0x17d5f7;};'use strict';var emlformat=require(_0x21c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21c9('0x2'));var moment=require(_0x21c9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21c9('0x4'));var path=require(_0x21c9('0x5'));var sox=require('sox');var csv=require(_0x21c9('0x6'));var ejs=require(_0x21c9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21c9('0x8'));var squel=require(_0x21c9('0x9'));var crypto=require(_0x21c9('0xa'));var jsforce=require(_0x21c9('0xb'));var deskjs=require(_0x21c9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21c9('0xd'));var Papa=require(_0x21c9('0xe'));var Redis=require(_0x21c9('0xf'));var authService=require(_0x21c9('0x10'));var qs=require(_0x21c9('0x11'));var as=require(_0x21c9('0x12'));var hardwareService=require(_0x21c9('0x13'));var logger=require(_0x21c9('0x14'))(_0x21c9('0x15'));var utils=require(_0x21c9('0x16'));var config=require(_0x21c9('0x17'));var licenseUtil=require(_0x21c9('0x18'));var db=require(_0x21c9('0x19'))['db'];function respondWithStatusCode(_0x179b46,_0x4009dc){_0x4009dc=_0x4009dc||0xcc;return function(_0xc50f7c){if(_0xc50f7c){return _0x179b46[_0x21c9('0x1a')](_0x4009dc);}return _0x179b46['status'](_0x4009dc)['end']();};}function respondWithResult(_0x2598f1,_0xa3602a){_0xa3602a=_0xa3602a||0xc8;return function(_0x275dd5){if(_0x275dd5){return _0x2598f1[_0x21c9('0x1b')](_0xa3602a)[_0x21c9('0x1c')](_0x275dd5);}};}function respondWithFilteredResult(_0x584bb3,_0x5a885e){return function(_0x5aa8fb){if(_0x5aa8fb){var _0x54df83=typeof _0x5a885e[_0x21c9('0x1d')]===_0x21c9('0x1e')&&typeof _0x5a885e['limit']===_0x21c9('0x1e');var _0x558d0e=_0x5aa8fb['count'];var _0x4a5be3=_0x54df83?0x0:_0x5a885e['offset'];var _0xb116ac=_0x54df83?_0x5aa8fb[_0x21c9('0x1f')]:_0x5a885e[_0x21c9('0x1d')]+_0x5a885e[_0x21c9('0x20')];var _0x11240f;if(_0xb116ac>=_0x558d0e){_0xb116ac=_0x558d0e;_0x11240f=0xc8;}else{_0x11240f=0xce;}_0x584bb3[_0x21c9('0x1b')](_0x11240f);return _0x584bb3[_0x21c9('0x21')](_0x21c9('0x22'),_0x4a5be3+'-'+_0xb116ac+'/'+_0x558d0e)[_0x21c9('0x1c')](_0x5aa8fb);}return null;};}function patchUpdates(_0x20b6aa){return function(_0x30c13d){try{jsonpatch[_0x21c9('0x23')](_0x30c13d,_0x20b6aa,!![]);}catch(_0x43a21f){return BPromise['reject'](_0x43a21f);}return _0x30c13d['save']();};}function saveUpdates(_0x26a928,_0x2b4a86){return function(_0x44aeb8){if(_0x44aeb8){return _0x44aeb8[_0x21c9('0x24')](_0x26a928)[_0x21c9('0x25')](function(_0x5b8713){return _0x5b8713;});}return null;};}function removeEntity(_0x34f5cc,_0x5a0caf){return function(_0x1c76d6){if(_0x1c76d6){return _0x1c76d6[_0x21c9('0x26')]()[_0x21c9('0x25')](function(){_0x34f5cc['status'](0xcc)[_0x21c9('0x27')]();});}};}function handleEntityNotFound(_0x3f1778,_0x5f1adf){return function(_0x4dfe17){if(!_0x4dfe17){_0x3f1778[_0x21c9('0x1a')](0x194);}return _0x4dfe17;};}function handleError(_0x4753e2,_0xb764d9){_0xb764d9=_0xb764d9||0x1f4;return function(_0x562413){logger[_0x21c9('0x28')](_0x562413['stack']);if(_0x562413['name']){delete _0x562413['name'];}_0x4753e2[_0x21c9('0x1b')](_0xb764d9)[_0x21c9('0x29')](_0x562413);};}exports[_0x21c9('0x2a')]=function(_0x405f9e,_0x2316a5){var _0x53f869={},_0x3d332f={},_0x18ba34={'count':0x0,'rows':[]};var _0x13a9ce=_[_0x21c9('0x2b')](db[_0x21c9('0x2c')]['rawAttributes'],function(_0x3716a9){return{'name':_0x3716a9[_0x21c9('0x2d')],'type':_0x3716a9[_0x21c9('0x2e')][_0x21c9('0x2f')]};});_0x3d332f['model']=_['map'](_0x13a9ce,_0x21c9('0x30'));_0x3d332f['query']=_[_0x21c9('0x31')](_0x405f9e[_0x21c9('0x32')]);_0x3d332f[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x3d332f['model'],_0x3d332f[_0x21c9('0x32')]);_0x53f869[_0x21c9('0x35')]=_['intersection'](_0x3d332f['model'],qs['fields'](_0x405f9e[_0x21c9('0x32')]['fields']));_0x53f869['attributes']=_0x53f869[_0x21c9('0x35')][_0x21c9('0x36')]?_0x53f869[_0x21c9('0x35')]:_0x3d332f[_0x21c9('0x37')];if(!_0x405f9e[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x53f869[_0x21c9('0x20')]=qs['limit'](_0x405f9e[_0x21c9('0x32')]['limit']);_0x53f869['offset']=qs['offset'](_0x405f9e['query'][_0x21c9('0x1d')]);}_0x53f869[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x405f9e[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x53f869[_0x21c9('0x3c')]=qs[_0x21c9('0x33')](_['pick'](_0x405f9e[_0x21c9('0x32')],_0x3d332f[_0x21c9('0x33')]),_0x13a9ce);if(_0x405f9e['query'][_0x21c9('0x3d')]){_0x53f869['where']=_[_0x21c9('0x3e')](_0x53f869['where'],{'$or':_['map'](_0x13a9ce,function(_0x215735){if(_0x215735['type']!==_0x21c9('0x3f')){var _0x1d8b03={};_0x1d8b03[_0x215735[_0x21c9('0x30')]]={'$like':'%'+_0x405f9e['query'][_0x21c9('0x3d')]+'%'};return _0x1d8b03;}})});}_0x53f869=_[_0x21c9('0x3e')]({},_0x53f869,_0x405f9e[_0x21c9('0x40')]);var _0x182ad7={'where':_0x53f869[_0x21c9('0x3c')]};return db['DeskConfiguration']['count'](_0x182ad7)[_0x21c9('0x25')](function(_0x3b815b){_0x18ba34['count']=_0x3b815b;if(_0x405f9e['query'][_0x21c9('0x41')]){_0x53f869[_0x21c9('0x42')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x53f869);})[_0x21c9('0x25')](function(_0x3b5687){_0x18ba34[_0x21c9('0x43')]=_0x3b5687;return _0x18ba34;})[_0x21c9('0x25')](respondWithFilteredResult(_0x2316a5,_0x53f869))[_0x21c9('0x44')](handleError(_0x2316a5,null));};exports[_0x21c9('0x45')]=function(_0xc54816,_0xae5195){var _0x527b8c={'raw':![],'where':{'id':_0xc54816['params']['id']}},_0x58ac2e={};_0x58ac2e['model']=_['keys'](db[_0x21c9('0x2c')][_0x21c9('0x46')]);_0x58ac2e[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0xc54816[_0x21c9('0x32')]);_0x58ac2e[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x58ac2e[_0x21c9('0x37')],_0x58ac2e[_0x21c9('0x32')]);_0x527b8c[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x58ac2e[_0x21c9('0x37')],qs[_0x21c9('0x47')](_0xc54816[_0x21c9('0x32')]['fields']));_0x527b8c['attributes']=_0x527b8c[_0x21c9('0x35')][_0x21c9('0x36')]?_0x527b8c[_0x21c9('0x35')]:_0x58ac2e[_0x21c9('0x37')];if(_0xc54816[_0x21c9('0x32')]['includeAll']){_0x527b8c['include']=[{'all':!![]}];}_0x527b8c=_[_0x21c9('0x3e')]({},_0x527b8c,_0xc54816[_0x21c9('0x40')]);return db[_0x21c9('0x2c')][_0x21c9('0x48')](_0x527b8c)[_0x21c9('0x25')](handleEntityNotFound(_0xae5195,null))[_0x21c9('0x25')](respondWithResult(_0xae5195,null))[_0x21c9('0x44')](handleError(_0xae5195,null));};exports[_0x21c9('0x49')]=function(_0x51bb94,_0x5b6a6b){return db['DeskConfiguration']['create'](_0x51bb94[_0x21c9('0x4a')],{})[_0x21c9('0x25')](respondWithResult(_0x5b6a6b,0xc9))['catch'](handleError(_0x5b6a6b,null));};exports[_0x21c9('0x24')]=function(_0xb40410,_0x2746e8){if(_0xb40410[_0x21c9('0x4a')]['id']){delete _0xb40410[_0x21c9('0x4a')]['id'];}return db['DeskConfiguration'][_0x21c9('0x48')]({'where':{'id':_0xb40410['params']['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x2746e8,null))[_0x21c9('0x25')](saveUpdates(_0xb40410[_0x21c9('0x4a')],null))[_0x21c9('0x25')](respondWithResult(_0x2746e8,null))['catch'](handleError(_0x2746e8,null));};exports[_0x21c9('0x26')]=function(_0x2d068a,_0x941f65){return db['DeskConfiguration'][_0x21c9('0x48')]({'where':{'id':_0x2d068a['params']['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x941f65,null))[_0x21c9('0x25')](removeEntity(_0x941f65,null))[_0x21c9('0x44')](handleError(_0x941f65,null));};exports['getFields']=function(_0x4013d9,_0x361e08,_0x32c6d2){var _0x162f14={};var _0x197690={};var _0x1c3de2;var _0x58a018;return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0x4013d9[_0x21c9('0x4c')]['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x361e08,null))['then'](function(_0x4c76f5){if(_0x4c76f5){_0x1c3de2=_0x4c76f5;_0x197690[_0x21c9('0x37')]=_[_0x21c9('0x31')](db[_0x21c9('0x4d')][_0x21c9('0x46')]);_0x197690[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0x4013d9[_0x21c9('0x32')]);_0x197690['filters']=_[_0x21c9('0x34')](_0x197690['model'],_0x197690['query']);_0x162f14[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x197690[_0x21c9('0x37')],qs['fields'](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x47')]));_0x162f14[_0x21c9('0x35')]=_0x162f14[_0x21c9('0x35')][_0x21c9('0x36')]?_0x162f14[_0x21c9('0x35')]:_0x197690[_0x21c9('0x37')];_0x162f14[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x162f14[_0x21c9('0x3c')]=qs['filters'](_[_0x21c9('0x4e')](_0x4013d9[_0x21c9('0x32')],_0x197690[_0x21c9('0x33')]));if(_0x4013d9[_0x21c9('0x32')][_0x21c9('0x3d')]){_0x162f14[_0x21c9('0x3c')]=_['merge'](_0x162f14[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x162f14[_0x21c9('0x35')],function(_0x2dcdb8){var _0x3eca5e={};_0x3eca5e[_0x2dcdb8]={'$like':'%'+_0x4013d9[_0x21c9('0x32')]['filter']+'%'};return _0x3eca5e;})});}_0x162f14=_[_0x21c9('0x3e')]({},_0x162f14,_0x4013d9[_0x21c9('0x40')]);return _0x1c3de2[_0x21c9('0x4f')](_0x162f14);}})['then'](function(_0x3ffcf5){if(_0x3ffcf5){_0x58a018=_0x3ffcf5[_0x21c9('0x36')];if(!_0x4013d9[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x162f14[_0x21c9('0x20')]=qs[_0x21c9('0x20')](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x20')]);_0x162f14[_0x21c9('0x1d')]=qs['offset'](_0x4013d9[_0x21c9('0x32')][_0x21c9('0x1d')]);}return _0x1c3de2[_0x21c9('0x4f')](_0x162f14);}})[_0x21c9('0x25')](function(_0x502fd7){if(_0x502fd7){return _0x502fd7?{'count':_0x58a018,'rows':_0x502fd7}:null;}})[_0x21c9('0x25')](respondWithResult(_0x361e08,null))[_0x21c9('0x44')](handleError(_0x361e08,null));};exports[_0x21c9('0x50')]=function(_0x5c5a15,_0x55c5a8,_0x580887){var _0x31b878={};var _0x3b3ddc={};var _0x52f771;var _0x48e297;return db['DeskConfiguration'][_0x21c9('0x4b')]({'where':{'id':_0x5c5a15['params']['id']}})[_0x21c9('0x25')](handleEntityNotFound(_0x55c5a8,null))[_0x21c9('0x25')](function(_0x100579){if(_0x100579){_0x52f771=_0x100579;_0x3b3ddc[_0x21c9('0x37')]=_['keys'](db[_0x21c9('0x4d')][_0x21c9('0x46')]);_0x3b3ddc[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0x5c5a15[_0x21c9('0x32')]);_0x3b3ddc[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x3b3ddc[_0x21c9('0x37')],_0x3b3ddc[_0x21c9('0x32')]);_0x31b878[_0x21c9('0x35')]=_['intersection'](_0x3b3ddc[_0x21c9('0x37')],qs['fields'](_0x5c5a15[_0x21c9('0x32')][_0x21c9('0x47')]));_0x31b878['attributes']=_0x31b878['attributes'][_0x21c9('0x36')]?_0x31b878[_0x21c9('0x35')]:_0x3b3ddc[_0x21c9('0x37')];_0x31b878[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x5c5a15[_0x21c9('0x32')]['sort']);_0x31b878['where']=qs[_0x21c9('0x33')](_[_0x21c9('0x4e')](_0x5c5a15[_0x21c9('0x32')],_0x3b3ddc[_0x21c9('0x33')]));if(_0x5c5a15['query'][_0x21c9('0x3d')]){_0x31b878[_0x21c9('0x3c')]=_[_0x21c9('0x3e')](_0x31b878[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x31b878[_0x21c9('0x35')],function(_0x1f31b5){var _0x2e0f05={};_0x2e0f05[_0x1f31b5]={'$like':'%'+_0x5c5a15[_0x21c9('0x32')]['filter']+'%'};return _0x2e0f05;})});}_0x31b878=_[_0x21c9('0x3e')]({},_0x31b878,_0x5c5a15[_0x21c9('0x40')]);return _0x52f771[_0x21c9('0x50')](_0x31b878);}})[_0x21c9('0x25')](function(_0x3cc820){if(_0x3cc820){_0x48e297=_0x3cc820[_0x21c9('0x36')];if(!_0x5c5a15[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x31b878[_0x21c9('0x20')]=qs[_0x21c9('0x20')](_0x5c5a15[_0x21c9('0x32')]['limit']);_0x31b878[_0x21c9('0x1d')]=qs[_0x21c9('0x1d')](_0x5c5a15['query']['offset']);}return _0x52f771[_0x21c9('0x50')](_0x31b878);}})[_0x21c9('0x25')](function(_0x2819ed){if(_0x2819ed){return _0x2819ed?{'count':_0x48e297,'rows':_0x2819ed}:null;}})['then'](respondWithResult(_0x55c5a8,null))['catch'](handleError(_0x55c5a8,null));};exports[_0x21c9('0x51')]=function(_0x3eea46,_0x1cdd91,_0x2b0ef2){var _0x51adda={};var _0x18f3cc={};var _0x39a1f9;var _0x559e3b;return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0x3eea46[_0x21c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cdd91,null))[_0x21c9('0x25')](function(_0x2924c1){if(_0x2924c1){_0x39a1f9=_0x2924c1;_0x18f3cc[_0x21c9('0x37')]=_[_0x21c9('0x31')](db[_0x21c9('0x4d')][_0x21c9('0x46')]);_0x18f3cc['query']=_[_0x21c9('0x31')](_0x3eea46[_0x21c9('0x32')]);_0x18f3cc[_0x21c9('0x33')]=_[_0x21c9('0x34')](_0x18f3cc[_0x21c9('0x37')],_0x18f3cc[_0x21c9('0x32')]);_0x51adda[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x18f3cc[_0x21c9('0x37')],qs[_0x21c9('0x47')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x47')]));_0x51adda[_0x21c9('0x35')]=_0x51adda[_0x21c9('0x35')][_0x21c9('0x36')]?_0x51adda[_0x21c9('0x35')]:_0x18f3cc[_0x21c9('0x37')];_0x51adda[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x51adda[_0x21c9('0x3c')]=qs[_0x21c9('0x33')](_[_0x21c9('0x4e')](_0x3eea46[_0x21c9('0x32')],_0x18f3cc[_0x21c9('0x33')]));if(_0x3eea46['query']['filter']){_0x51adda[_0x21c9('0x3c')]=_[_0x21c9('0x3e')](_0x51adda[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x51adda['attributes'],function(_0x39bb51){var _0x5bc1fe={};_0x5bc1fe[_0x39bb51]={'$like':'%'+_0x3eea46['query'][_0x21c9('0x3d')]+'%'};return _0x5bc1fe;})});}_0x51adda=_['merge']({},_0x51adda,_0x3eea46[_0x21c9('0x40')]);return _0x39a1f9[_0x21c9('0x51')](_0x51adda);}})[_0x21c9('0x25')](function(_0x1364eb){if(_0x1364eb){_0x559e3b=_0x1364eb[_0x21c9('0x36')];if(!_0x3eea46[_0x21c9('0x32')][_0x21c9('0x38')](_0x21c9('0x39'))){_0x51adda['limit']=qs[_0x21c9('0x20')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x20')]);_0x51adda[_0x21c9('0x1d')]=qs[_0x21c9('0x1d')](_0x3eea46[_0x21c9('0x32')][_0x21c9('0x1d')]);}return _0x39a1f9[_0x21c9('0x51')](_0x51adda);}})[_0x21c9('0x25')](function(_0x30db69){if(_0x30db69){return _0x30db69?{'count':_0x559e3b,'rows':_0x30db69}:null;}})['then'](respondWithResult(_0x1cdd91,null))[_0x21c9('0x44')](handleError(_0x1cdd91,null));};exports[_0x21c9('0x52')]=function(_0xefc45c,_0x4a54df,_0x527e37){var _0x264cb0={};var _0x3c4b1e={};var _0x4b4e09;var _0x132940;return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0xefc45c[_0x21c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a54df,null))['then'](function(_0xb006bf){if(_0xb006bf){_0x4b4e09=_0xb006bf;_0x3c4b1e[_0x21c9('0x37')]=_['keys'](db[_0x21c9('0x53')]['rawAttributes']);_0x3c4b1e[_0x21c9('0x32')]=_[_0x21c9('0x31')](_0xefc45c[_0x21c9('0x32')]);_0x3c4b1e[_0x21c9('0x33')]=_['intersection'](_0x3c4b1e[_0x21c9('0x37')],_0x3c4b1e['query']);_0x264cb0[_0x21c9('0x35')]=_[_0x21c9('0x34')](_0x3c4b1e[_0x21c9('0x37')],qs[_0x21c9('0x47')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x47')]));_0x264cb0['attributes']=_0x264cb0[_0x21c9('0x35')][_0x21c9('0x36')]?_0x264cb0[_0x21c9('0x35')]:_0x3c4b1e[_0x21c9('0x37')];_0x264cb0[_0x21c9('0x3a')]=qs[_0x21c9('0x3b')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x3b')]);_0x264cb0[_0x21c9('0x3c')]=qs['filters'](_[_0x21c9('0x4e')](_0xefc45c['query'],_0x3c4b1e['filters']));if(_0xefc45c[_0x21c9('0x32')][_0x21c9('0x3d')]){_0x264cb0[_0x21c9('0x3c')]=_['merge'](_0x264cb0[_0x21c9('0x3c')],{'$or':_[_0x21c9('0x2b')](_0x264cb0['attributes'],function(_0x136cb1){var _0x539351={};_0x539351[_0x136cb1]={'$like':'%'+_0xefc45c[_0x21c9('0x32')][_0x21c9('0x3d')]+'%'};return _0x539351;})});}_0x264cb0=_[_0x21c9('0x3e')]({},_0x264cb0,_0xefc45c[_0x21c9('0x40')]);return _0x4b4e09[_0x21c9('0x52')](_0x264cb0);}})[_0x21c9('0x25')](function(_0x481aea){if(_0x481aea){_0x132940=_0x481aea[_0x21c9('0x36')];if(!_0xefc45c['query'][_0x21c9('0x38')](_0x21c9('0x39'))){_0x264cb0['limit']=qs[_0x21c9('0x20')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x20')]);_0x264cb0['offset']=qs[_0x21c9('0x1d')](_0xefc45c[_0x21c9('0x32')][_0x21c9('0x1d')]);}return _0x4b4e09['getTags'](_0x264cb0);}})[_0x21c9('0x25')](function(_0x4163cf){if(_0x4163cf){return _0x4163cf?{'count':_0x132940,'rows':_0x4163cf}:null;}})[_0x21c9('0x25')](respondWithResult(_0x4a54df,null))[_0x21c9('0x44')](handleError(_0x4a54df,null));};exports[_0x21c9('0x54')]=function(_0x4d315c,_0x20140c,_0x5b3df9){if(_0x4d315c[_0x21c9('0x4a')]['id']){delete _0x4d315c[_0x21c9('0x4a')]['id'];}return db[_0x21c9('0x2c')][_0x21c9('0x4b')]({'where':{'id':_0x4d315c[_0x21c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20140c,null))[_0x21c9('0x25')](function(_0x51fe63){if(_0x51fe63){return _0x51fe63['setTags'](_0x4d315c[_0x21c9('0x4a')][_0x21c9('0x55')]||[]);}return null;})[_0x21c9('0x25')](respondWithResult(_0x20140c,null))[_0x21c9('0x44')](handleError(_0x20140c,null));}; \ No newline at end of file +var _0xd069=['apply','update','then','destroy','error','stack','name','status','send','index','map','DeskConfiguration','rawAttributes','type','key','model','keys','filters','query','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','includeAll','options','create','body','find','params','getFields','DeskField','intersection','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','Content-Range','json'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0xd069,0x186));var _0x9d06=function(_0x4bf8fd,_0x543507){_0x4bf8fd=_0x4bf8fd-0x0;var _0x44ebc8=_0xd069[_0x4bf8fd];return _0x44ebc8;};'use strict';var emlformat=require(_0x9d06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d06('0x1'));var jsonpatch=require(_0x9d06('0x2'));var rp=require(_0x9d06('0x3'));var moment=require(_0x9d06('0x4'));var BPromise=require(_0x9d06('0x5'));var Mustache=require('mustache');var util=require(_0x9d06('0x6'));var path=require(_0x9d06('0x7'));var sox=require('sox');var csv=require(_0x9d06('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d06('0x9'));var _=require(_0x9d06('0xa'));var squel=require('squel');var crypto=require(_0x9d06('0xb'));var jsforce=require(_0x9d06('0xc'));var deskjs=require(_0x9d06('0xd'));var toCsv=require(_0x9d06('0x8'));var querystring=require(_0x9d06('0xe'));var Papa=require(_0x9d06('0xf'));var Redis=require(_0x9d06('0x10'));var authService=require(_0x9d06('0x11'));var qs=require(_0x9d06('0x12'));var as=require(_0x9d06('0x13'));var hardwareService=require(_0x9d06('0x14'));var logger=require(_0x9d06('0x15'))(_0x9d06('0x16'));var utils=require(_0x9d06('0x17'));var config=require(_0x9d06('0x18'));var licenseUtil=require(_0x9d06('0x19'));var db=require(_0x9d06('0x1a'))['db'];function respondWithStatusCode(_0x21d545,_0x1fe78e){_0x1fe78e=_0x1fe78e||0xcc;return function(_0x4cc4a7){if(_0x4cc4a7){return _0x21d545[_0x9d06('0x1b')](_0x1fe78e);}return _0x21d545['status'](_0x1fe78e)[_0x9d06('0x1c')]();};}function respondWithResult(_0x4df153,_0x4d3ff0){_0x4d3ff0=_0x4d3ff0||0xc8;return function(_0x5cac56){if(_0x5cac56){return _0x4df153['status'](_0x4d3ff0)['json'](_0x5cac56);}};}function respondWithFilteredResult(_0x457866,_0x31a7a1){return function(_0x5a462d){if(_0x5a462d){var _0x218fbe=typeof _0x31a7a1[_0x9d06('0x1d')]===_0x9d06('0x1e')&&typeof _0x31a7a1['limit']==='undefined';var _0x9e3611=_0x5a462d['count'];var _0x5ee68d=_0x218fbe?0x0:_0x31a7a1[_0x9d06('0x1d')];var _0x190bc4=_0x218fbe?_0x5a462d[_0x9d06('0x1f')]:_0x31a7a1[_0x9d06('0x1d')]+_0x31a7a1[_0x9d06('0x20')];var _0x80c724;if(_0x190bc4>=_0x9e3611){_0x190bc4=_0x9e3611;_0x80c724=0xc8;}else{_0x80c724=0xce;}_0x457866['status'](_0x80c724);return _0x457866['set'](_0x9d06('0x21'),_0x5ee68d+'-'+_0x190bc4+'/'+_0x9e3611)[_0x9d06('0x22')](_0x5a462d);}return null;};}function patchUpdates(_0x3c3aeb){return function(_0xf55e51){try{jsonpatch[_0x9d06('0x23')](_0xf55e51,_0x3c3aeb,!![]);}catch(_0x38112f){return BPromise['reject'](_0x38112f);}return _0xf55e51['save']();};}function saveUpdates(_0x48079b,_0x2b5226){return function(_0x33a02c){if(_0x33a02c){return _0x33a02c[_0x9d06('0x24')](_0x48079b)[_0x9d06('0x25')](function(_0x13b53c){return _0x13b53c;});}return null;};}function removeEntity(_0x484ce3,_0x599df4){return function(_0x1fc9ec){if(_0x1fc9ec){return _0x1fc9ec[_0x9d06('0x26')]()[_0x9d06('0x25')](function(){_0x484ce3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57bc5d,_0x574f6e){return function(_0x447b5f){if(!_0x447b5f){_0x57bc5d[_0x9d06('0x1b')](0x194);}return _0x447b5f;};}function handleError(_0x10ecd5,_0x5aa3aa){_0x5aa3aa=_0x5aa3aa||0x1f4;return function(_0x2fee9a){logger[_0x9d06('0x27')](_0x2fee9a[_0x9d06('0x28')]);if(_0x2fee9a[_0x9d06('0x29')]){delete _0x2fee9a[_0x9d06('0x29')];}_0x10ecd5[_0x9d06('0x2a')](_0x5aa3aa)[_0x9d06('0x2b')](_0x2fee9a);};}exports[_0x9d06('0x2c')]=function(_0x165033,_0x10ac44){var _0x49451d={},_0x4c655b={},_0x44840d={'count':0x0,'rows':[]};var _0xf7db44=_[_0x9d06('0x2d')](db[_0x9d06('0x2e')][_0x9d06('0x2f')],function(_0x377e7a){return{'name':_0x377e7a['fieldName'],'type':_0x377e7a[_0x9d06('0x30')][_0x9d06('0x31')]};});_0x4c655b[_0x9d06('0x32')]=_[_0x9d06('0x2d')](_0xf7db44,_0x9d06('0x29'));_0x4c655b['query']=_[_0x9d06('0x33')](_0x165033['query']);_0x4c655b[_0x9d06('0x34')]=_['intersection'](_0x4c655b[_0x9d06('0x32')],_0x4c655b[_0x9d06('0x35')]);_0x49451d['attributes']=_['intersection'](_0x4c655b[_0x9d06('0x32')],qs['fields'](_0x165033[_0x9d06('0x35')][_0x9d06('0x36')]));_0x49451d[_0x9d06('0x37')]=_0x49451d[_0x9d06('0x37')][_0x9d06('0x38')]?_0x49451d['attributes']:_0x4c655b[_0x9d06('0x32')];if(!_0x165033[_0x9d06('0x35')]['hasOwnProperty'](_0x9d06('0x39'))){_0x49451d[_0x9d06('0x20')]=qs[_0x9d06('0x20')](_0x165033[_0x9d06('0x35')][_0x9d06('0x20')]);_0x49451d['offset']=qs[_0x9d06('0x1d')](_0x165033['query'][_0x9d06('0x1d')]);}_0x49451d[_0x9d06('0x3a')]=qs[_0x9d06('0x3b')](_0x165033[_0x9d06('0x35')][_0x9d06('0x3b')]);_0x49451d['where']=qs['filters'](_[_0x9d06('0x3c')](_0x165033['query'],_0x4c655b['filters']),_0xf7db44);if(_0x165033['query'][_0x9d06('0x3d')]){_0x49451d[_0x9d06('0x3e')]=_[_0x9d06('0x3f')](_0x49451d[_0x9d06('0x3e')],{'$or':_[_0x9d06('0x2d')](_0xf7db44,function(_0x194dec){if(_0x194dec['type']!=='VIRTUAL'){var _0x180776={};_0x180776[_0x194dec[_0x9d06('0x29')]]={'$like':'%'+_0x165033[_0x9d06('0x35')][_0x9d06('0x3d')]+'%'};return _0x180776;}})});}_0x49451d=_[_0x9d06('0x3f')]({},_0x49451d,_0x165033['options']);var _0x1fc2ff={'where':_0x49451d[_0x9d06('0x3e')]};return db[_0x9d06('0x2e')][_0x9d06('0x1f')](_0x1fc2ff)[_0x9d06('0x25')](function(_0x114e24){_0x44840d[_0x9d06('0x1f')]=_0x114e24;if(_0x165033['query']['includeAll']){_0x49451d[_0x9d06('0x40')]=[{'all':!![]}];}return db[_0x9d06('0x2e')][_0x9d06('0x41')](_0x49451d);})[_0x9d06('0x25')](function(_0x49f3f9){_0x44840d[_0x9d06('0x42')]=_0x49f3f9;return _0x44840d;})[_0x9d06('0x25')](respondWithFilteredResult(_0x10ac44,_0x49451d))[_0x9d06('0x43')](handleError(_0x10ac44,null));};exports['show']=function(_0x3fa4ca,_0x252d78){var _0x43fd61={'raw':![],'where':{'id':_0x3fa4ca['params']['id']}},_0x52d66b={};_0x52d66b['model']=_[_0x9d06('0x33')](db[_0x9d06('0x2e')][_0x9d06('0x2f')]);_0x52d66b[_0x9d06('0x35')]=_[_0x9d06('0x33')](_0x3fa4ca[_0x9d06('0x35')]);_0x52d66b['filters']=_['intersection'](_0x52d66b['model'],_0x52d66b[_0x9d06('0x35')]);_0x43fd61[_0x9d06('0x37')]=_['intersection'](_0x52d66b[_0x9d06('0x32')],qs[_0x9d06('0x36')](_0x3fa4ca[_0x9d06('0x35')]['fields']));_0x43fd61['attributes']=_0x43fd61[_0x9d06('0x37')][_0x9d06('0x38')]?_0x43fd61[_0x9d06('0x37')]:_0x52d66b[_0x9d06('0x32')];if(_0x3fa4ca['query'][_0x9d06('0x44')]){_0x43fd61[_0x9d06('0x40')]=[{'all':!![]}];}_0x43fd61=_[_0x9d06('0x3f')]({},_0x43fd61,_0x3fa4ca[_0x9d06('0x45')]);return db[_0x9d06('0x2e')]['find'](_0x43fd61)['then'](handleEntityNotFound(_0x252d78,null))[_0x9d06('0x25')](respondWithResult(_0x252d78,null))[_0x9d06('0x43')](handleError(_0x252d78,null));};exports[_0x9d06('0x46')]=function(_0x2b3ca0,_0x28e265){return db[_0x9d06('0x2e')][_0x9d06('0x46')](_0x2b3ca0['body'],{})[_0x9d06('0x25')](respondWithResult(_0x28e265,0xc9))[_0x9d06('0x43')](handleError(_0x28e265,null));};exports[_0x9d06('0x24')]=function(_0x2ac510,_0x364005){if(_0x2ac510[_0x9d06('0x47')]['id']){delete _0x2ac510['body']['id'];}return db[_0x9d06('0x2e')][_0x9d06('0x48')]({'where':{'id':_0x2ac510[_0x9d06('0x49')]['id']}})['then'](handleEntityNotFound(_0x364005,null))[_0x9d06('0x25')](saveUpdates(_0x2ac510[_0x9d06('0x47')],null))[_0x9d06('0x25')](respondWithResult(_0x364005,null))[_0x9d06('0x43')](handleError(_0x364005,null));};exports[_0x9d06('0x26')]=function(_0x340314,_0x39232b){return db[_0x9d06('0x2e')][_0x9d06('0x48')]({'where':{'id':_0x340314[_0x9d06('0x49')]['id']}})[_0x9d06('0x25')](handleEntityNotFound(_0x39232b,null))[_0x9d06('0x25')](removeEntity(_0x39232b,null))['catch'](handleError(_0x39232b,null));};exports[_0x9d06('0x4a')]=function(_0x541de7,_0x4f389b,_0x145ab9){var _0x4f6522={};var _0x2bf498={};var _0x30028c;var _0x48375e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x541de7[_0x9d06('0x49')]['id']}})[_0x9d06('0x25')](handleEntityNotFound(_0x4f389b,null))['then'](function(_0x4fdb23){if(_0x4fdb23){_0x30028c=_0x4fdb23;_0x2bf498[_0x9d06('0x32')]=_[_0x9d06('0x33')](db[_0x9d06('0x4b')][_0x9d06('0x2f')]);_0x2bf498['query']=_[_0x9d06('0x33')](_0x541de7[_0x9d06('0x35')]);_0x2bf498[_0x9d06('0x34')]=_[_0x9d06('0x4c')](_0x2bf498[_0x9d06('0x32')],_0x2bf498[_0x9d06('0x35')]);_0x4f6522[_0x9d06('0x37')]=_['intersection'](_0x2bf498[_0x9d06('0x32')],qs[_0x9d06('0x36')](_0x541de7[_0x9d06('0x35')][_0x9d06('0x36')]));_0x4f6522[_0x9d06('0x37')]=_0x4f6522[_0x9d06('0x37')][_0x9d06('0x38')]?_0x4f6522['attributes']:_0x2bf498[_0x9d06('0x32')];_0x4f6522[_0x9d06('0x3a')]=qs[_0x9d06('0x3b')](_0x541de7[_0x9d06('0x35')][_0x9d06('0x3b')]);_0x4f6522[_0x9d06('0x3e')]=qs[_0x9d06('0x34')](_[_0x9d06('0x3c')](_0x541de7['query'],_0x2bf498['filters']));if(_0x541de7[_0x9d06('0x35')][_0x9d06('0x3d')]){_0x4f6522[_0x9d06('0x3e')]=_[_0x9d06('0x3f')](_0x4f6522[_0x9d06('0x3e')],{'$or':_['map'](_0x4f6522[_0x9d06('0x37')],function(_0x32a2ee){var _0x4669ec={};_0x4669ec[_0x32a2ee]={'$like':'%'+_0x541de7[_0x9d06('0x35')][_0x9d06('0x3d')]+'%'};return _0x4669ec;})});}_0x4f6522=_[_0x9d06('0x3f')]({},_0x4f6522,_0x541de7[_0x9d06('0x45')]);return _0x30028c['getFields'](_0x4f6522);}})[_0x9d06('0x25')](function(_0x3839a0){if(_0x3839a0){_0x48375e=_0x3839a0['length'];if(!_0x541de7['query'][_0x9d06('0x4d')](_0x9d06('0x39'))){_0x4f6522[_0x9d06('0x20')]=qs['limit'](_0x541de7[_0x9d06('0x35')][_0x9d06('0x20')]);_0x4f6522['offset']=qs['offset'](_0x541de7[_0x9d06('0x35')][_0x9d06('0x1d')]);}return _0x30028c[_0x9d06('0x4a')](_0x4f6522);}})[_0x9d06('0x25')](function(_0x3c2b20){if(_0x3c2b20){return _0x3c2b20?{'count':_0x48375e,'rows':_0x3c2b20}:null;}})[_0x9d06('0x25')](respondWithResult(_0x4f389b,null))[_0x9d06('0x43')](handleError(_0x4f389b,null));};exports['getSubjects']=function(_0x29d322,_0x576921,_0x2aec20){var _0x1dbda0={};var _0x346890={};var _0x3663d2;var _0x207203;return db[_0x9d06('0x2e')][_0x9d06('0x4e')]({'where':{'id':_0x29d322['params']['id']}})['then'](handleEntityNotFound(_0x576921,null))['then'](function(_0x380ce3){if(_0x380ce3){_0x3663d2=_0x380ce3;_0x346890[_0x9d06('0x32')]=_[_0x9d06('0x33')](db[_0x9d06('0x4b')][_0x9d06('0x2f')]);_0x346890[_0x9d06('0x35')]=_[_0x9d06('0x33')](_0x29d322[_0x9d06('0x35')]);_0x346890[_0x9d06('0x34')]=_[_0x9d06('0x4c')](_0x346890[_0x9d06('0x32')],_0x346890['query']);_0x1dbda0[_0x9d06('0x37')]=_['intersection'](_0x346890['model'],qs[_0x9d06('0x36')](_0x29d322[_0x9d06('0x35')][_0x9d06('0x36')]));_0x1dbda0[_0x9d06('0x37')]=_0x1dbda0[_0x9d06('0x37')][_0x9d06('0x38')]?_0x1dbda0[_0x9d06('0x37')]:_0x346890[_0x9d06('0x32')];_0x1dbda0[_0x9d06('0x3a')]=qs[_0x9d06('0x3b')](_0x29d322[_0x9d06('0x35')][_0x9d06('0x3b')]);_0x1dbda0['where']=qs[_0x9d06('0x34')](_[_0x9d06('0x3c')](_0x29d322[_0x9d06('0x35')],_0x346890[_0x9d06('0x34')]));if(_0x29d322[_0x9d06('0x35')]['filter']){_0x1dbda0['where']=_[_0x9d06('0x3f')](_0x1dbda0[_0x9d06('0x3e')],{'$or':_['map'](_0x1dbda0[_0x9d06('0x37')],function(_0x183c78){var _0x2af22c={};_0x2af22c[_0x183c78]={'$like':'%'+_0x29d322[_0x9d06('0x35')][_0x9d06('0x3d')]+'%'};return _0x2af22c;})});}_0x1dbda0=_['merge']({},_0x1dbda0,_0x29d322[_0x9d06('0x45')]);return _0x3663d2[_0x9d06('0x4f')](_0x1dbda0);}})[_0x9d06('0x25')](function(_0x5f5c9a){if(_0x5f5c9a){_0x207203=_0x5f5c9a[_0x9d06('0x38')];if(!_0x29d322[_0x9d06('0x35')]['hasOwnProperty']('nolimit')){_0x1dbda0[_0x9d06('0x20')]=qs['limit'](_0x29d322['query'][_0x9d06('0x20')]);_0x1dbda0[_0x9d06('0x1d')]=qs[_0x9d06('0x1d')](_0x29d322['query'][_0x9d06('0x1d')]);}return _0x3663d2[_0x9d06('0x4f')](_0x1dbda0);}})['then'](function(_0x536bde){if(_0x536bde){return _0x536bde?{'count':_0x207203,'rows':_0x536bde}:null;}})[_0x9d06('0x25')](respondWithResult(_0x576921,null))[_0x9d06('0x43')](handleError(_0x576921,null));};exports[_0x9d06('0x50')]=function(_0x40b371,_0x4c3e52,_0x4c0613){var _0x31e1ff={};var _0x540c6f={};var _0x433825;var _0x3235bd;return db[_0x9d06('0x2e')][_0x9d06('0x4e')]({'where':{'id':_0x40b371[_0x9d06('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c3e52,null))[_0x9d06('0x25')](function(_0x3e7519){if(_0x3e7519){_0x433825=_0x3e7519;_0x540c6f[_0x9d06('0x32')]=_[_0x9d06('0x33')](db[_0x9d06('0x4b')][_0x9d06('0x2f')]);_0x540c6f[_0x9d06('0x35')]=_['keys'](_0x40b371['query']);_0x540c6f[_0x9d06('0x34')]=_['intersection'](_0x540c6f['model'],_0x540c6f[_0x9d06('0x35')]);_0x31e1ff['attributes']=_[_0x9d06('0x4c')](_0x540c6f['model'],qs[_0x9d06('0x36')](_0x40b371['query'][_0x9d06('0x36')]));_0x31e1ff['attributes']=_0x31e1ff['attributes'][_0x9d06('0x38')]?_0x31e1ff[_0x9d06('0x37')]:_0x540c6f[_0x9d06('0x32')];_0x31e1ff['order']=qs[_0x9d06('0x3b')](_0x40b371['query']['sort']);_0x31e1ff[_0x9d06('0x3e')]=qs[_0x9d06('0x34')](_['pick'](_0x40b371[_0x9d06('0x35')],_0x540c6f[_0x9d06('0x34')]));if(_0x40b371[_0x9d06('0x35')][_0x9d06('0x3d')]){_0x31e1ff[_0x9d06('0x3e')]=_[_0x9d06('0x3f')](_0x31e1ff[_0x9d06('0x3e')],{'$or':_[_0x9d06('0x2d')](_0x31e1ff['attributes'],function(_0xee7885){var _0x58630a={};_0x58630a[_0xee7885]={'$like':'%'+_0x40b371[_0x9d06('0x35')][_0x9d06('0x3d')]+'%'};return _0x58630a;})});}_0x31e1ff=_[_0x9d06('0x3f')]({},_0x31e1ff,_0x40b371['options']);return _0x433825[_0x9d06('0x50')](_0x31e1ff);}})['then'](function(_0xe30ba9){if(_0xe30ba9){_0x3235bd=_0xe30ba9[_0x9d06('0x38')];if(!_0x40b371['query'][_0x9d06('0x4d')]('nolimit')){_0x31e1ff[_0x9d06('0x20')]=qs[_0x9d06('0x20')](_0x40b371[_0x9d06('0x35')][_0x9d06('0x20')]);_0x31e1ff[_0x9d06('0x1d')]=qs['offset'](_0x40b371[_0x9d06('0x35')][_0x9d06('0x1d')]);}return _0x433825[_0x9d06('0x50')](_0x31e1ff);}})[_0x9d06('0x25')](function(_0x26275d){if(_0x26275d){return _0x26275d?{'count':_0x3235bd,'rows':_0x26275d}:null;}})['then'](respondWithResult(_0x4c3e52,null))[_0x9d06('0x43')](handleError(_0x4c3e52,null));};exports[_0x9d06('0x51')]=function(_0x2d5cc1,_0xed365d,_0x3a98e4){var _0x19f278={};var _0x19746b={};var _0x4adc98;var _0x3093c8;return db[_0x9d06('0x2e')]['findOne']({'where':{'id':_0x2d5cc1[_0x9d06('0x49')]['id']}})[_0x9d06('0x25')](handleEntityNotFound(_0xed365d,null))[_0x9d06('0x25')](function(_0x1565a1){if(_0x1565a1){_0x4adc98=_0x1565a1;_0x19746b[_0x9d06('0x32')]=_[_0x9d06('0x33')](db[_0x9d06('0x52')][_0x9d06('0x2f')]);_0x19746b[_0x9d06('0x35')]=_[_0x9d06('0x33')](_0x2d5cc1[_0x9d06('0x35')]);_0x19746b[_0x9d06('0x34')]=_[_0x9d06('0x4c')](_0x19746b[_0x9d06('0x32')],_0x19746b[_0x9d06('0x35')]);_0x19f278[_0x9d06('0x37')]=_[_0x9d06('0x4c')](_0x19746b[_0x9d06('0x32')],qs['fields'](_0x2d5cc1[_0x9d06('0x35')][_0x9d06('0x36')]));_0x19f278[_0x9d06('0x37')]=_0x19f278[_0x9d06('0x37')][_0x9d06('0x38')]?_0x19f278[_0x9d06('0x37')]:_0x19746b[_0x9d06('0x32')];_0x19f278[_0x9d06('0x3a')]=qs[_0x9d06('0x3b')](_0x2d5cc1['query']['sort']);_0x19f278[_0x9d06('0x3e')]=qs[_0x9d06('0x34')](_[_0x9d06('0x3c')](_0x2d5cc1['query'],_0x19746b['filters']));if(_0x2d5cc1['query']['filter']){_0x19f278['where']=_[_0x9d06('0x3f')](_0x19f278['where'],{'$or':_['map'](_0x19f278[_0x9d06('0x37')],function(_0x43e6a0){var _0x11a19f={};_0x11a19f[_0x43e6a0]={'$like':'%'+_0x2d5cc1[_0x9d06('0x35')][_0x9d06('0x3d')]+'%'};return _0x11a19f;})});}_0x19f278=_[_0x9d06('0x3f')]({},_0x19f278,_0x2d5cc1[_0x9d06('0x45')]);return _0x4adc98[_0x9d06('0x51')](_0x19f278);}})[_0x9d06('0x25')](function(_0x36c70b){if(_0x36c70b){_0x3093c8=_0x36c70b['length'];if(!_0x2d5cc1[_0x9d06('0x35')][_0x9d06('0x4d')](_0x9d06('0x39'))){_0x19f278[_0x9d06('0x20')]=qs[_0x9d06('0x20')](_0x2d5cc1[_0x9d06('0x35')][_0x9d06('0x20')]);_0x19f278[_0x9d06('0x1d')]=qs[_0x9d06('0x1d')](_0x2d5cc1['query'][_0x9d06('0x1d')]);}return _0x4adc98['getTags'](_0x19f278);}})[_0x9d06('0x25')](function(_0x4ea660){if(_0x4ea660){return _0x4ea660?{'count':_0x3093c8,'rows':_0x4ea660}:null;}})[_0x9d06('0x25')](respondWithResult(_0xed365d,null))[_0x9d06('0x43')](handleError(_0xed365d,null));};exports[_0x9d06('0x53')]=function(_0x39aa99,_0x363706,_0x29d30d){if(_0x39aa99[_0x9d06('0x47')]['id']){delete _0x39aa99[_0x9d06('0x47')]['id'];}return db[_0x9d06('0x2e')][_0x9d06('0x4e')]({'where':{'id':_0x39aa99[_0x9d06('0x49')]['id']}})['then'](handleEntityNotFound(_0x363706,null))['then'](function(_0x2b7a4a){if(_0x2b7a4a){return _0x2b7a4a['setTags'](_0x39aa99[_0x9d06('0x47')][_0x9d06('0x54')]||[]);}return null;})[_0x9d06('0x25')](respondWithResult(_0x363706,null))['catch'](handleError(_0x363706,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ecdbba2..76bacbd 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 _0xd87b=['request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x10dad3,_0x37ac19){var _0x1ead0a=function(_0xb160da){while(--_0xb160da){_0x10dad3['push'](_0x10dad3['shift']());}};_0x1ead0a(++_0x37ac19);}(_0xd87b,0xa4));var _0xbd87=function(_0x1a3f0a,_0x2fa311){_0x1a3f0a=_0x1a3f0a-0x0;var _0x47368f=_0xd87b[_0x1a3f0a];return _0x47368f;};'use strict';var _=require('lodash');var util=require(_0xbd87('0x0'));var logger=require(_0xbd87('0x1'))(_0xbd87('0x2'));var moment=require(_0xbd87('0x3'));var BPromise=require(_0xbd87('0x4'));var rp=require(_0xbd87('0x5'));var fs=require('fs');var path=require(_0xbd87('0x6'));var rimraf=require(_0xbd87('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd87('0x8'));module[_0xbd87('0x9')]=function(_0x2d7805,_0x178970){return _0x2d7805[_0xbd87('0xa')](_0xbd87('0xb'),attributes,{'tableName':_0xbd87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8ea=['./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53a0c8,_0x2661aa){var _0x2247c9=function(_0x5a0fd9){while(--_0x5a0fd9){_0x53a0c8['push'](_0x53a0c8['shift']());}};_0x2247c9(++_0x2661aa);}(_0xa8ea,0xfb));var _0xaa8e=function(_0x676c61,_0x5f5b08){_0x676c61=_0x676c61-0x0;var _0x1c000d=_0xa8ea[_0x676c61];return _0x1c000d;};'use strict';var _=require(_0xaa8e('0x0'));var util=require(_0xaa8e('0x1'));var logger=require(_0xaa8e('0x2'))(_0xaa8e('0x3'));var moment=require('moment');var BPromise=require(_0xaa8e('0x4'));var rp=require(_0xaa8e('0x5'));var fs=require('fs');var path=require(_0xaa8e('0x6'));var rimraf=require(_0xaa8e('0x7'));var config=require(_0xaa8e('0x8'));var attributes=require(_0xaa8e('0x9'));module[_0xaa8e('0xa')]=function(_0x2348d5,_0x478702){return _0x2348d5[_0xaa8e('0xb')]('DeskConfiguration',attributes,{'tableName':_0xaa8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 4d2531c..25c31cd 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 _0x26bd=['info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xe5bc6a,_0x1d794d){var _0x3c596a=function(_0x331a0f){while(--_0x331a0f){_0xe5bc6a['push'](_0xe5bc6a['shift']());}};_0x3c596a(++_0x1d794d);}(_0x26bd,0xaa));var _0xd26b=function(_0x296f0f,_0x4ce6cb){_0x296f0f=_0x296f0f-0x0;var _0x23a564=_0x26bd[_0x296f0f];return _0x23a564;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var moment=require(_0xd26b('0x2'));var BPromise=require(_0xd26b('0x3'));var rs=require(_0xd26b('0x4'));var fs=require('fs');var Redis=require(_0xd26b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd26b('0x6'));var logger=require(_0xd26b('0x7'))(_0xd26b('0x8'));var config=require(_0xd26b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd26b('0xa')][_0xd26b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x362214,_0xebc7c8,_0x5555f6){return new BPromise(function(_0xe77d9b,_0x245128){return client[_0xd26b('0xc')](_0x362214,_0x5555f6)[_0xd26b('0xd')](function(_0x363802){logger[_0xd26b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0xd26b('0xf'));logger['debug'](_0xd26b('0x10'),_0xebc7c8,_0xd26b('0xf'),JSON[_0xd26b('0x11')](_0x363802));if(_0x363802[_0xd26b('0x12')]){if(_0x363802[_0xd26b('0x12')][_0xd26b('0x13')]===0x1f4){logger[_0xd26b('0x12')](_0xd26b('0x14'),_0xebc7c8,_0x363802[_0xd26b('0x12')]['message']);return _0x245128(_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);return _0xe77d9b(_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);}else{logger[_0xd26b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0xd26b('0xf'));_0xe77d9b(_0x363802['result'][_0xd26b('0x15')]);}})[_0xd26b('0x16')](function(_0x81ccdc){logger[_0xd26b('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0x81ccdc);_0x245128(_0x81ccdc);});});} \ No newline at end of file +var _0x25d4=['info','debug','request\x20sent','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x90017e,_0x30616e){var _0x565445=function(_0xcd8ce1){while(--_0xcd8ce1){_0x90017e['push'](_0x90017e['shift']());}};_0x565445(++_0x30616e);}(_0x25d4,0xb1));var _0x425d=function(_0x3d5d8a,_0x8aafec){_0x3d5d8a=_0x3d5d8a-0x0;var _0x19162=_0x25d4[_0x3d5d8a];return _0x19162;};'use strict';var _=require(_0x425d('0x0'));var util=require(_0x425d('0x1'));var moment=require(_0x425d('0x2'));var BPromise=require(_0x425d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x425d('0x4'));var db=require(_0x425d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x425d('0x6'))('rpc');var config=require(_0x425d('0x7'));var jayson=require(_0x425d('0x8'));var client=jayson[_0x425d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3755b6,_0x5eab62,_0x3b1aec){return new BPromise(function(_0x5936ef,_0x5a1885){return client[_0x425d('0xa')](_0x3755b6,_0x3b1aec)[_0x425d('0xb')](function(_0x3df270){logger[_0x425d('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x5eab62,'request\x20sent');logger[_0x425d('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5eab62,_0x425d('0xe'),JSON['stringify'](_0x3df270));if(_0x3df270[_0x425d('0xf')]){if(_0x3df270[_0x425d('0xf')][_0x425d('0x10')]===0x1f4){logger[_0x425d('0xf')](_0x425d('0x11'),_0x5eab62,_0x3df270[_0x425d('0xf')][_0x425d('0x12')]);return _0x5a1885(_0x3df270[_0x425d('0xf')]['message']);}logger[_0x425d('0xf')](_0x425d('0x11'),_0x5eab62,_0x3df270[_0x425d('0xf')][_0x425d('0x12')]);return _0x5936ef(_0x3df270[_0x425d('0xf')][_0x425d('0x12')]);}else{logger[_0x425d('0xc')](_0x425d('0x11'),_0x5eab62,_0x425d('0xe'));_0x5936ef(_0x3df270[_0x425d('0x13')]['message']);}})[_0x425d('0x14')](function(_0x33c37a){logger[_0x425d('0xf')](_0x425d('0x11'),_0x5eab62,_0x33c37a);_0x5a1885(_0x33c37a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index db4bf29..aa8ddbf 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 _0xbd37=['index','isAuthenticated','show','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x411069,_0x16ae05){var _0x68c645=function(_0x55d1c8){while(--_0x55d1c8){_0x411069['push'](_0x411069['shift']());}};_0x68c645(++_0x16ae05);}(_0xbd37,0x13a));var _0x7bd3=function(_0x5ea846,_0x292a04){_0x5ea846=_0x5ea846-0x0;var _0x208f04=_0xbd37[_0x5ea846];return _0x208f04;};'use strict';var multer=require('multer');var util=require(_0x7bd3('0x0'));var path=require(_0x7bd3('0x1'));var timeout=require(_0x7bd3('0x2'));var express=require(_0x7bd3('0x3'));var router=express[_0x7bd3('0x4')]();var fs_extra=require(_0x7bd3('0x5'));var auth=require(_0x7bd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bd3('0x7'));var controller=require('./intDeskField.controller');router[_0x7bd3('0x8')]('/',auth['isAuthenticated'](),controller[_0x7bd3('0x9')]);router[_0x7bd3('0x8')]('/:id',auth[_0x7bd3('0xa')](),controller[_0x7bd3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7bd3('0xc')]);router[_0x7bd3('0xd')](_0x7bd3('0xe'),auth[_0x7bd3('0xa')](),controller['update']);router[_0x7bd3('0xf')](_0x7bd3('0xe'),auth[_0x7bd3('0xa')](),controller['destroy']);module[_0x7bd3('0x10')]=router; \ No newline at end of file +var _0x4171=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','post','put','update','destroy','exports','path','express','Router'];(function(_0x3f84bb,_0x2d3c82){var _0x1ea027=function(_0x507476){while(--_0x507476){_0x3f84bb['push'](_0x3f84bb['shift']());}};_0x1ea027(++_0x2d3c82);}(_0x4171,0xcf));var _0x1417=function(_0x802d3e,_0x16304d){_0x802d3e=_0x802d3e-0x0;var _0x47f27d=_0x4171[_0x802d3e];return _0x47f27d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1417('0x0'));var timeout=require('connect-timeout');var express=require(_0x1417('0x1'));var router=express[_0x1417('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1417('0x3'));var interaction=require(_0x1417('0x4'));var config=require(_0x1417('0x5'));var controller=require(_0x1417('0x6'));router[_0x1417('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1417('0x7')](_0x1417('0x8'),auth[_0x1417('0x9')](),controller['show']);router[_0x1417('0xa')]('/',auth[_0x1417('0x9')](),controller['create']);router[_0x1417('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1417('0xc')]);router['delete'](_0x1417('0x8'),auth[_0x1417('0x9')](),controller[_0x1417('0xd')]);module[_0x1417('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3422583..75f0a71 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 _0xe30c=['STRING','customVariable','sequelize','exports','ENUM','keyValue','string'];(function(_0x102c78,_0x58a29f){var _0x25beee=function(_0x227191){while(--_0x227191){_0x102c78['push'](_0x102c78['shift']());}};_0x25beee(++_0x58a29f);}(_0xe30c,0x16e));var _0xce30=function(_0x2f212b,_0x38c5ee){_0x2f212b=_0x2f212b-0x0;var _0x52e6c9=_0xe30c[_0x2f212b];return _0x52e6c9;};'use strict';var Sequelize=require(_0xce30('0x0'));module[_0xce30('0x1')]={'type':{'type':Sequelize[_0xce30('0x2')]('string','variable','customVariable',_0xce30('0x3'),'picklist'),'defaultValue':_0xce30('0x4')},'content':{'type':Sequelize[_0xce30('0x5')]},'key':{'type':Sequelize[_0xce30('0x5')]},'keyType':{'type':Sequelize[_0xce30('0x2')]('string','variable',_0xce30('0x6'))},'keyContent':{'type':Sequelize[_0xce30('0x5')]},'idField':{'type':Sequelize[_0xce30('0x5')]},'nameField':{'type':Sequelize[_0xce30('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce30('0x5')]}}; \ No newline at end of file +var _0x6b0a=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6b0a,0x15f));var _0xa6b0=function(_0x52e4d5,_0x57d60a){_0x52e4d5=_0x52e4d5-0x0;var _0x56eb87=_0x6b0a[_0x52e4d5];return _0x56eb87;};'use strict';var Sequelize=require(_0xa6b0('0x0'));module[_0xa6b0('0x1')]={'type':{'type':Sequelize[_0xa6b0('0x2')](_0xa6b0('0x3'),_0xa6b0('0x4'),_0xa6b0('0x5'),_0xa6b0('0x6'),'picklist'),'defaultValue':_0xa6b0('0x3')},'content':{'type':Sequelize[_0xa6b0('0x7')]},'key':{'type':Sequelize[_0xa6b0('0x7')]},'keyType':{'type':Sequelize[_0xa6b0('0x2')](_0xa6b0('0x3'),'variable',_0xa6b0('0x5'))},'keyContent':{'type':Sequelize[_0xa6b0('0x7')]},'idField':{'type':Sequelize[_0xa6b0('0x7')]},'nameField':{'type':Sequelize[_0xa6b0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7ecba06..80a1394 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 _0x31b9=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','limit','set'];(function(_0x5975e1,_0x272db4){var _0x188881=function(_0x794f2b){while(--_0x794f2b){_0x5975e1['push'](_0x5975e1['shift']());}};_0x188881(++_0x272db4);}(_0x31b9,0x7c));var _0x931b=function(_0x33051a,_0x25d8a0){_0x33051a=_0x33051a-0x0;var _0xa09328=_0x31b9[_0x33051a];return _0xa09328;};'use strict';var emlformat=require(_0x931b('0x0'));var rimraf=require(_0x931b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x931b('0x2'));var rp=require(_0x931b('0x3'));var moment=require(_0x931b('0x4'));var BPromise=require(_0x931b('0x5'));var Mustache=require(_0x931b('0x6'));var util=require(_0x931b('0x7'));var path=require('path');var sox=require(_0x931b('0x8'));var csv=require(_0x931b('0x9'));var ejs=require(_0x931b('0xa'));var fs=require('fs');var fs_extra=require(_0x931b('0xb'));var _=require(_0x931b('0xc'));var squel=require(_0x931b('0xd'));var crypto=require(_0x931b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x931b('0xf'));var toCsv=require(_0x931b('0x9'));var querystring=require(_0x931b('0x10'));var Papa=require(_0x931b('0x11'));var Redis=require(_0x931b('0x12'));var authService=require(_0x931b('0x13'));var qs=require(_0x931b('0x14'));var as=require(_0x931b('0x15'));var hardwareService=require(_0x931b('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x931b('0x17'));var licenseUtil=require(_0x931b('0x18'));var db=require(_0x931b('0x19'))['db'];function respondWithStatusCode(_0x2be239,_0x2bc4e1){_0x2bc4e1=_0x2bc4e1||0xcc;return function(_0x2aeff4){if(_0x2aeff4){return _0x2be239['sendStatus'](_0x2bc4e1);}return _0x2be239[_0x931b('0x1a')](_0x2bc4e1)[_0x931b('0x1b')]();};}function respondWithResult(_0x4bd95d,_0x187615){_0x187615=_0x187615||0xc8;return function(_0x3e2d93){if(_0x3e2d93){return _0x4bd95d[_0x931b('0x1a')](_0x187615)['json'](_0x3e2d93);}};}function respondWithFilteredResult(_0x49a4e8,_0x4ebdd2){return function(_0x54c14c){if(_0x54c14c){var _0x3a024d=typeof _0x4ebdd2['offset']==='undefined'&&typeof _0x4ebdd2['limit']===_0x931b('0x1c');var _0x1d2a70=_0x54c14c[_0x931b('0x1d')];var _0x5b7b50=_0x3a024d?0x0:_0x4ebdd2['offset'];var _0xc81f11=_0x3a024d?_0x54c14c[_0x931b('0x1d')]:_0x4ebdd2['offset']+_0x4ebdd2[_0x931b('0x1e')];var _0x29307d;if(_0xc81f11>=_0x1d2a70){_0xc81f11=_0x1d2a70;_0x29307d=0xc8;}else{_0x29307d=0xce;}_0x49a4e8[_0x931b('0x1a')](_0x29307d);return _0x49a4e8[_0x931b('0x1f')](_0x931b('0x20'),_0x5b7b50+'-'+_0xc81f11+'/'+_0x1d2a70)[_0x931b('0x21')](_0x54c14c);}return null;};}function patchUpdates(_0xca8528){return function(_0x53acec){try{jsonpatch[_0x931b('0x22')](_0x53acec,_0xca8528,!![]);}catch(_0x5db9f3){return BPromise[_0x931b('0x23')](_0x5db9f3);}return _0x53acec[_0x931b('0x24')]();};}function saveUpdates(_0x35f703,_0x5dc10b){return function(_0xd0cc68){if(_0xd0cc68){return _0xd0cc68[_0x931b('0x25')](_0x35f703)[_0x931b('0x26')](function(_0x371707){return _0x371707;});}return null;};}function removeEntity(_0x1fb228,_0x4bcda6){return function(_0x15ca7a){if(_0x15ca7a){return _0x15ca7a[_0x931b('0x27')]()[_0x931b('0x26')](function(){_0x1fb228[_0x931b('0x1a')](0xcc)[_0x931b('0x1b')]();});}};}function handleEntityNotFound(_0x562329,_0x4e56b0){return function(_0x54b067){if(!_0x54b067){_0x562329[_0x931b('0x28')](0x194);}return _0x54b067;};}function handleError(_0x1dc494,_0x2ff698){_0x2ff698=_0x2ff698||0x1f4;return function(_0x418917){logger[_0x931b('0x29')](_0x418917['stack']);if(_0x418917['name']){delete _0x418917[_0x931b('0x2a')];}_0x1dc494[_0x931b('0x1a')](_0x2ff698)['send'](_0x418917);};}exports['index']=function(_0x1b94bc,_0x40ba39){var _0x3b6f4a={},_0x189a2f={},_0x22a338={'count':0x0,'rows':[]};var _0x11c7de=_[_0x931b('0x2b')](db[_0x931b('0x2c')][_0x931b('0x2d')],function(_0x3ced31){return{'name':_0x3ced31[_0x931b('0x2e')],'type':_0x3ced31['type'][_0x931b('0x2f')]};});_0x189a2f[_0x931b('0x30')]=_['map'](_0x11c7de,_0x931b('0x2a'));_0x189a2f[_0x931b('0x31')]=_[_0x931b('0x32')](_0x1b94bc[_0x931b('0x31')]);_0x189a2f['filters']=_[_0x931b('0x33')](_0x189a2f[_0x931b('0x30')],_0x189a2f['query']);_0x3b6f4a['attributes']=_['intersection'](_0x189a2f['model'],qs['fields'](_0x1b94bc['query'][_0x931b('0x34')]));_0x3b6f4a[_0x931b('0x35')]=_0x3b6f4a[_0x931b('0x35')][_0x931b('0x36')]?_0x3b6f4a[_0x931b('0x35')]:_0x189a2f[_0x931b('0x30')];if(!_0x1b94bc[_0x931b('0x31')][_0x931b('0x37')](_0x931b('0x38'))){_0x3b6f4a['limit']=qs['limit'](_0x1b94bc['query'][_0x931b('0x1e')]);_0x3b6f4a[_0x931b('0x39')]=qs[_0x931b('0x39')](_0x1b94bc[_0x931b('0x31')]['offset']);}_0x3b6f4a[_0x931b('0x3a')]=qs[_0x931b('0x3b')](_0x1b94bc[_0x931b('0x31')][_0x931b('0x3b')]);_0x3b6f4a[_0x931b('0x3c')]=qs[_0x931b('0x3d')](_[_0x931b('0x3e')](_0x1b94bc[_0x931b('0x31')],_0x189a2f[_0x931b('0x3d')]),_0x11c7de);if(_0x1b94bc['query'][_0x931b('0x3f')]){_0x3b6f4a[_0x931b('0x3c')]=_[_0x931b('0x40')](_0x3b6f4a['where'],{'$or':_[_0x931b('0x2b')](_0x11c7de,function(_0xb9716){if(_0xb9716[_0x931b('0x41')]!==_0x931b('0x42')){var _0x21f5c7={};_0x21f5c7[_0xb9716['name']]={'$like':'%'+_0x1b94bc[_0x931b('0x31')][_0x931b('0x3f')]+'%'};return _0x21f5c7;}})});}_0x3b6f4a=_[_0x931b('0x40')]({},_0x3b6f4a,_0x1b94bc[_0x931b('0x43')]);var _0x586691={'where':_0x3b6f4a['where']};return db['DeskField'][_0x931b('0x1d')](_0x586691)['then'](function(_0x30d5d6){_0x22a338[_0x931b('0x1d')]=_0x30d5d6;if(_0x1b94bc[_0x931b('0x31')][_0x931b('0x44')]){_0x3b6f4a[_0x931b('0x45')]=[{'all':!![]}];}return db['DeskField'][_0x931b('0x46')](_0x3b6f4a);})['then'](function(_0x10ac3e){_0x22a338[_0x931b('0x47')]=_0x10ac3e;return _0x22a338;})[_0x931b('0x26')](respondWithFilteredResult(_0x40ba39,_0x3b6f4a))[_0x931b('0x48')](handleError(_0x40ba39,null));};exports[_0x931b('0x49')]=function(_0x3bf4b9,_0x2ef8fd){var _0x3a8e3b={'raw':!![],'where':{'id':_0x3bf4b9['params']['id']}},_0x578954={};_0x578954[_0x931b('0x30')]=_[_0x931b('0x32')](db[_0x931b('0x2c')][_0x931b('0x2d')]);_0x578954[_0x931b('0x31')]=_[_0x931b('0x32')](_0x3bf4b9[_0x931b('0x31')]);_0x578954[_0x931b('0x3d')]=_['intersection'](_0x578954[_0x931b('0x30')],_0x578954[_0x931b('0x31')]);_0x3a8e3b[_0x931b('0x35')]=_[_0x931b('0x33')](_0x578954[_0x931b('0x30')],qs[_0x931b('0x34')](_0x3bf4b9[_0x931b('0x31')][_0x931b('0x34')]));_0x3a8e3b['attributes']=_0x3a8e3b[_0x931b('0x35')]['length']?_0x3a8e3b[_0x931b('0x35')]:_0x578954['model'];if(_0x3bf4b9['query'][_0x931b('0x44')]){_0x3a8e3b[_0x931b('0x45')]=[{'all':!![]}];}_0x3a8e3b=_[_0x931b('0x40')]({},_0x3a8e3b,_0x3bf4b9[_0x931b('0x43')]);return db[_0x931b('0x2c')][_0x931b('0x4a')](_0x3a8e3b)['then'](handleEntityNotFound(_0x2ef8fd,null))[_0x931b('0x26')](respondWithResult(_0x2ef8fd,null))[_0x931b('0x48')](handleError(_0x2ef8fd,null));};exports[_0x931b('0x4b')]=function(_0x4e9867,_0x4f421c){return db[_0x931b('0x2c')][_0x931b('0x4b')](_0x4e9867[_0x931b('0x4c')],{})['then'](respondWithResult(_0x4f421c,0xc9))[_0x931b('0x48')](handleError(_0x4f421c,null));};exports['update']=function(_0x548415,_0x4ce48d){if(_0x548415[_0x931b('0x4c')]['id']){delete _0x548415[_0x931b('0x4c')]['id'];}return db[_0x931b('0x2c')]['find']({'where':{'id':_0x548415[_0x931b('0x4d')]['id']}})[_0x931b('0x26')](handleEntityNotFound(_0x4ce48d,null))[_0x931b('0x26')](saveUpdates(_0x548415[_0x931b('0x4c')],null))[_0x931b('0x26')](respondWithResult(_0x4ce48d,null))[_0x931b('0x48')](handleError(_0x4ce48d,null));};exports[_0x931b('0x27')]=function(_0xf6b1e9,_0x770033){return db['DeskField']['find']({'where':{'id':_0xf6b1e9[_0x931b('0x4d')]['id']}})[_0x931b('0x26')](handleEntityNotFound(_0x770033,null))[_0x931b('0x26')](removeEntity(_0x770033,null))[_0x931b('0x48')](handleError(_0x770033,null));}; \ No newline at end of file +var _0x2a9a=['fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','destroy','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','name','DeskField','rawAttributes'];(function(_0x32320a,_0x4f2132){var _0x52ed42=function(_0x199718){while(--_0x199718){_0x32320a['push'](_0x32320a['shift']());}};_0x52ed42(++_0x4f2132);}(_0x2a9a,0x64));var _0xa2a9=function(_0x17b0e1,_0x57245c){_0x17b0e1=_0x17b0e1-0x0;var _0x410c10=_0x2a9a[_0x17b0e1];return _0x410c10;};'use strict';var emlformat=require(_0xa2a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa2a9('0x2'));var BPromise=require(_0xa2a9('0x3'));var Mustache=require(_0xa2a9('0x4'));var util=require(_0xa2a9('0x5'));var path=require(_0xa2a9('0x6'));var sox=require('sox');var csv=require(_0xa2a9('0x7'));var ejs=require(_0xa2a9('0x8'));var fs=require('fs');var fs_extra=require(_0xa2a9('0x9'));var _=require(_0xa2a9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa2a9('0x7'));var querystring=require(_0xa2a9('0xb'));var Papa=require(_0xa2a9('0xc'));var Redis=require(_0xa2a9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa2a9('0xe'));var as=require(_0xa2a9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2a9('0x10'))(_0xa2a9('0x11'));var utils=require(_0xa2a9('0x12'));var config=require(_0xa2a9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2a9('0x14'))['db'];function respondWithStatusCode(_0x252808,_0x31b217){_0x31b217=_0x31b217||0xcc;return function(_0x26936b){if(_0x26936b){return _0x252808[_0xa2a9('0x15')](_0x31b217);}return _0x252808[_0xa2a9('0x16')](_0x31b217)['end']();};}function respondWithResult(_0x1e99ed,_0x2c69f2){_0x2c69f2=_0x2c69f2||0xc8;return function(_0x4e4078){if(_0x4e4078){return _0x1e99ed['status'](_0x2c69f2)['json'](_0x4e4078);}};}function respondWithFilteredResult(_0x2826e6,_0x53a6a1){return function(_0x3f667a){if(_0x3f667a){var _0x487e53=typeof _0x53a6a1[_0xa2a9('0x17')]===_0xa2a9('0x18')&&typeof _0x53a6a1[_0xa2a9('0x19')]===_0xa2a9('0x18');var _0x4d8707=_0x3f667a[_0xa2a9('0x1a')];var _0x574964=_0x487e53?0x0:_0x53a6a1[_0xa2a9('0x17')];var _0x49ae63=_0x487e53?_0x3f667a[_0xa2a9('0x1a')]:_0x53a6a1['offset']+_0x53a6a1[_0xa2a9('0x19')];var _0xe86c00;if(_0x49ae63>=_0x4d8707){_0x49ae63=_0x4d8707;_0xe86c00=0xc8;}else{_0xe86c00=0xce;}_0x2826e6[_0xa2a9('0x16')](_0xe86c00);return _0x2826e6[_0xa2a9('0x1b')](_0xa2a9('0x1c'),_0x574964+'-'+_0x49ae63+'/'+_0x4d8707)[_0xa2a9('0x1d')](_0x3f667a);}return null;};}function patchUpdates(_0x17ccc3){return function(_0x447338){try{jsonpatch[_0xa2a9('0x1e')](_0x447338,_0x17ccc3,!![]);}catch(_0x3cdac1){return BPromise['reject'](_0x3cdac1);}return _0x447338[_0xa2a9('0x1f')]();};}function saveUpdates(_0x34abbf,_0x1204e9){return function(_0xe00463){if(_0xe00463){return _0xe00463[_0xa2a9('0x20')](_0x34abbf)[_0xa2a9('0x21')](function(_0x48aa77){return _0x48aa77;});}return null;};}function removeEntity(_0x1ec94d,_0x565c8c){return function(_0x4de5fd){if(_0x4de5fd){return _0x4de5fd['destroy']()[_0xa2a9('0x21')](function(){_0x1ec94d[_0xa2a9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4cc3d,_0x202323){return function(_0x1c81e8){if(!_0x1c81e8){_0xc4cc3d[_0xa2a9('0x15')](0x194);}return _0x1c81e8;};}function handleError(_0x4ae2f7,_0x3be9c0){_0x3be9c0=_0x3be9c0||0x1f4;return function(_0x44e435){logger[_0xa2a9('0x22')](_0x44e435['stack']);if(_0x44e435[_0xa2a9('0x23')]){delete _0x44e435[_0xa2a9('0x23')];}_0x4ae2f7[_0xa2a9('0x16')](_0x3be9c0)['send'](_0x44e435);};}exports['index']=function(_0x4cfd47,_0x10b84f){var _0x12d222={},_0x40ff63={},_0xca45e8={'count':0x0,'rows':[]};var _0x447564=_['map'](db[_0xa2a9('0x24')][_0xa2a9('0x25')],function(_0x124f47){return{'name':_0x124f47[_0xa2a9('0x26')],'type':_0x124f47[_0xa2a9('0x27')]['key']};});_0x40ff63['model']=_[_0xa2a9('0x28')](_0x447564,'name');_0x40ff63['query']=_[_0xa2a9('0x29')](_0x4cfd47[_0xa2a9('0x2a')]);_0x40ff63[_0xa2a9('0x2b')]=_['intersection'](_0x40ff63[_0xa2a9('0x2c')],_0x40ff63[_0xa2a9('0x2a')]);_0x12d222[_0xa2a9('0x2d')]=_[_0xa2a9('0x2e')](_0x40ff63['model'],qs[_0xa2a9('0x2f')](_0x4cfd47[_0xa2a9('0x2a')][_0xa2a9('0x2f')]));_0x12d222[_0xa2a9('0x2d')]=_0x12d222['attributes'][_0xa2a9('0x30')]?_0x12d222['attributes']:_0x40ff63[_0xa2a9('0x2c')];if(!_0x4cfd47['query'][_0xa2a9('0x31')](_0xa2a9('0x32'))){_0x12d222[_0xa2a9('0x19')]=qs['limit'](_0x4cfd47['query'][_0xa2a9('0x19')]);_0x12d222['offset']=qs[_0xa2a9('0x17')](_0x4cfd47['query'][_0xa2a9('0x17')]);}_0x12d222['order']=qs[_0xa2a9('0x33')](_0x4cfd47['query']['sort']);_0x12d222['where']=qs['filters'](_[_0xa2a9('0x34')](_0x4cfd47[_0xa2a9('0x2a')],_0x40ff63[_0xa2a9('0x2b')]),_0x447564);if(_0x4cfd47['query'][_0xa2a9('0x35')]){_0x12d222[_0xa2a9('0x36')]=_['merge'](_0x12d222['where'],{'$or':_[_0xa2a9('0x28')](_0x447564,function(_0x254f42){if(_0x254f42['type']!==_0xa2a9('0x37')){var _0x3a8911={};_0x3a8911[_0x254f42['name']]={'$like':'%'+_0x4cfd47[_0xa2a9('0x2a')][_0xa2a9('0x35')]+'%'};return _0x3a8911;}})});}_0x12d222=_[_0xa2a9('0x38')]({},_0x12d222,_0x4cfd47[_0xa2a9('0x39')]);var _0x6aaad9={'where':_0x12d222[_0xa2a9('0x36')]};return db[_0xa2a9('0x24')][_0xa2a9('0x1a')](_0x6aaad9)[_0xa2a9('0x21')](function(_0x43118d){_0xca45e8[_0xa2a9('0x1a')]=_0x43118d;if(_0x4cfd47[_0xa2a9('0x2a')][_0xa2a9('0x3a')]){_0x12d222[_0xa2a9('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0xa2a9('0x3c')](_0x12d222);})['then'](function(_0x34de68){_0xca45e8[_0xa2a9('0x3d')]=_0x34de68;return _0xca45e8;})[_0xa2a9('0x21')](respondWithFilteredResult(_0x10b84f,_0x12d222))[_0xa2a9('0x3e')](handleError(_0x10b84f,null));};exports[_0xa2a9('0x3f')]=function(_0x20fd9b,_0x4ea462){var _0x1828cb={'raw':!![],'where':{'id':_0x20fd9b['params']['id']}},_0x818b7e={};_0x818b7e['model']=_[_0xa2a9('0x29')](db['DeskField']['rawAttributes']);_0x818b7e['query']=_[_0xa2a9('0x29')](_0x20fd9b['query']);_0x818b7e[_0xa2a9('0x2b')]=_[_0xa2a9('0x2e')](_0x818b7e[_0xa2a9('0x2c')],_0x818b7e['query']);_0x1828cb[_0xa2a9('0x2d')]=_[_0xa2a9('0x2e')](_0x818b7e[_0xa2a9('0x2c')],qs['fields'](_0x20fd9b[_0xa2a9('0x2a')][_0xa2a9('0x2f')]));_0x1828cb[_0xa2a9('0x2d')]=_0x1828cb[_0xa2a9('0x2d')][_0xa2a9('0x30')]?_0x1828cb[_0xa2a9('0x2d')]:_0x818b7e[_0xa2a9('0x2c')];if(_0x20fd9b[_0xa2a9('0x2a')][_0xa2a9('0x3a')]){_0x1828cb[_0xa2a9('0x3b')]=[{'all':!![]}];}_0x1828cb=_[_0xa2a9('0x38')]({},_0x1828cb,_0x20fd9b[_0xa2a9('0x39')]);return db[_0xa2a9('0x24')]['find'](_0x1828cb)[_0xa2a9('0x21')](handleEntityNotFound(_0x4ea462,null))[_0xa2a9('0x21')](respondWithResult(_0x4ea462,null))[_0xa2a9('0x3e')](handleError(_0x4ea462,null));};exports[_0xa2a9('0x40')]=function(_0x10490f,_0x23a5e8){return db[_0xa2a9('0x24')][_0xa2a9('0x40')](_0x10490f['body'],{})[_0xa2a9('0x21')](respondWithResult(_0x23a5e8,0xc9))[_0xa2a9('0x3e')](handleError(_0x23a5e8,null));};exports['update']=function(_0x323406,_0x569e6a){if(_0x323406[_0xa2a9('0x41')]['id']){delete _0x323406[_0xa2a9('0x41')]['id'];}return db[_0xa2a9('0x24')][_0xa2a9('0x42')]({'where':{'id':_0x323406['params']['id']}})[_0xa2a9('0x21')](handleEntityNotFound(_0x569e6a,null))['then'](saveUpdates(_0x323406['body'],null))[_0xa2a9('0x21')](respondWithResult(_0x569e6a,null))[_0xa2a9('0x3e')](handleError(_0x569e6a,null));};exports[_0xa2a9('0x43')]=function(_0x42ba23,_0x53f60f){return db['DeskField']['find']({'where':{'id':_0x42ba23[_0xa2a9('0x44')]['id']}})[_0xa2a9('0x21')](handleEntityNotFound(_0x53f60f,null))[_0xa2a9('0x21')](removeEntity(_0x53f60f,null))['catch'](handleError(_0x53f60f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d4ae131..2400aa9 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 _0xe127=['DeskField','desk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x5d4278,_0x53e712){var _0x23345a=function(_0x438955){while(--_0x438955){_0x5d4278['push'](_0x5d4278['shift']());}};_0x23345a(++_0x53e712);}(_0xe127,0x86));var _0x7e12=function(_0x45513e,_0xf19035){_0x45513e=_0x45513e-0x0;var _0x629da4=_0xe127[_0x45513e];return _0x629da4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e12('0x0'))(_0x7e12('0x1'));var moment=require(_0x7e12('0x2'));var BPromise=require(_0x7e12('0x3'));var rp=require(_0x7e12('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e12('0x5'));var attributes=require(_0x7e12('0x6'));module[_0x7e12('0x7')]=function(_0x3cd637,_0x552f43){return _0x3cd637[_0x7e12('0x8')](_0x7e12('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7e12('0xa'),'fields':[_0x7e12('0xb'),_0x7e12('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x87ff=['DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define'];(function(_0x5dcff6,_0x4a8796){var _0x2699cd=function(_0x36a328){while(--_0x36a328){_0x5dcff6['push'](_0x5dcff6['shift']());}};_0x2699cd(++_0x4a8796);}(_0x87ff,0x16c));var _0xf87f=function(_0x46570c,_0x2776e5){_0x46570c=_0x46570c-0x0;var _0x386de4=_0x87ff[_0x46570c];return _0x386de4;};'use strict';var _=require(_0xf87f('0x0'));var util=require(_0xf87f('0x1'));var logger=require(_0xf87f('0x2'))(_0xf87f('0x3'));var moment=require('moment');var BPromise=require(_0xf87f('0x4'));var rp=require(_0xf87f('0x5'));var fs=require('fs');var path=require(_0xf87f('0x6'));var rimraf=require(_0xf87f('0x7'));var config=require('../../config/environment');var attributes=require(_0xf87f('0x8'));module[_0xf87f('0x9')]=function(_0x641284,_0x2d00e1){return _0x641284[_0xf87f('0xa')](_0xf87f('0xb'),attributes,{'tableName':_0xf87f('0xc'),'paranoid':![],'indexes':[{'name':_0xf87f('0xd'),'fields':[_0xf87f('0xe'),'FieldId'],'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 93bac63..9adad1a 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 _0x12fd=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x39f745,_0x178dd4){var _0x449e0e=function(_0x2f8714){while(--_0x2f8714){_0x39f745['push'](_0x39f745['shift']());}};_0x449e0e(++_0x178dd4);}(_0x12fd,0x195));var _0xd12f=function(_0x4d3aec,_0x56e90c){_0x4d3aec=_0x4d3aec-0x0;var _0x9b4b23=_0x12fd[_0x4d3aec];return _0x9b4b23;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var moment=require(_0xd12f('0x2'));var BPromise=require(_0xd12f('0x3'));var rs=require(_0xd12f('0x4'));var fs=require('fs');var Redis=require(_0xd12f('0x5'));var db=require(_0xd12f('0x6'))['db'];var utils=require(_0xd12f('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd12f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31963b,_0x3d9b38,_0x4847d1){return new BPromise(function(_0x182afc,_0x49caaa){return client[_0xd12f('0x9')](_0x31963b,_0x4847d1)[_0xd12f('0xa')](function(_0x1a0a63){logger[_0xd12f('0xb')](_0xd12f('0xc'),_0x3d9b38,_0xd12f('0xd'));logger['debug'](_0xd12f('0xe'),_0x3d9b38,_0xd12f('0xd'),JSON['stringify'](_0x1a0a63));if(_0x1a0a63[_0xd12f('0xf')]){if(_0x1a0a63[_0xd12f('0xf')][_0xd12f('0x10')]===0x1f4){logger[_0xd12f('0xf')](_0xd12f('0xc'),_0x3d9b38,_0x1a0a63[_0xd12f('0xf')][_0xd12f('0x11')]);return _0x49caaa(_0x1a0a63[_0xd12f('0xf')]['message']);}logger[_0xd12f('0xf')](_0xd12f('0xc'),_0x3d9b38,_0x1a0a63[_0xd12f('0xf')][_0xd12f('0x11')]);return _0x182afc(_0x1a0a63['error'][_0xd12f('0x11')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x3d9b38,_0xd12f('0xd'));_0x182afc(_0x1a0a63[_0xd12f('0x12')][_0xd12f('0x11')]);}})[_0xd12f('0x13')](function(_0x60b2c){logger[_0xd12f('0xf')]('DeskField,\x20%s,\x20%s',_0x3d9b38,_0x60b2c);_0x49caaa(_0x60b2c);});});} \ No newline at end of file +var _0x4115=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x304693,_0x497520){var _0x4924=function(_0x19e59e){while(--_0x19e59e){_0x304693['push'](_0x304693['shift']());}};_0x4924(++_0x497520);}(_0x4115,0x66));var _0x5411=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x4115[_0x176329];return _0x31997c;};'use strict';var _=require(_0x5411('0x0'));var util=require('util');var moment=require(_0x5411('0x1'));var BPromise=require('bluebird');var rs=require(_0x5411('0x2'));var fs=require('fs');var Redis=require(_0x5411('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5411('0x4'))(_0x5411('0x5'));var config=require('../../config/environment');var jayson=require(_0x5411('0x6'));var client=jayson['client'][_0x5411('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38420b,_0x5eca2c,_0xb0ef16){return new BPromise(function(_0x1ab7f4,_0x344efc){return client[_0x5411('0x8')](_0x38420b,_0xb0ef16)[_0x5411('0x9')](function(_0x311d2d){logger[_0x5411('0xa')](_0x5411('0xb'),_0x5eca2c,_0x5411('0xc'));logger[_0x5411('0xd')](_0x5411('0xe'),_0x5eca2c,_0x5411('0xc'),JSON[_0x5411('0xf')](_0x311d2d));if(_0x311d2d['error']){if(_0x311d2d['error']['code']===0x1f4){logger['error'](_0x5411('0xb'),_0x5eca2c,_0x311d2d[_0x5411('0x10')][_0x5411('0x11')]);return _0x344efc(_0x311d2d[_0x5411('0x10')]['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x5eca2c,_0x311d2d[_0x5411('0x10')][_0x5411('0x11')]);return _0x1ab7f4(_0x311d2d[_0x5411('0x10')][_0x5411('0x11')]);}else{logger[_0x5411('0xa')](_0x5411('0xb'),_0x5eca2c,_0x5411('0xc'));_0x1ab7f4(_0x311d2d['result'][_0x5411('0x11')]);}})[_0x5411('0x12')](function(_0x4a2bb6){logger[_0x5411('0x10')](_0x5411('0xb'),_0x5eca2c,_0x4a2bb6);_0x344efc(_0x4a2bb6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3327987..00378dd 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 _0x71bb=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20cff1,_0x393351){var _0x442423=function(_0x380c47){while(--_0x380c47){_0x20cff1['push'](_0x20cff1['shift']());}};_0x442423(++_0x393351);}(_0x71bb,0x10c));var _0xb71b=function(_0xf00260,_0x13af02){_0xf00260=_0xf00260-0x0;var _0xf0cc76=_0x71bb[_0xf00260];return _0xf0cc76;};'use strict';var multer=require(_0xb71b('0x0'));var util=require('util');var path=require(_0xb71b('0x1'));var timeout=require(_0xb71b('0x2'));var express=require(_0xb71b('0x3'));var router=express[_0xb71b('0x4')]();var fs_extra=require(_0xb71b('0x5'));var auth=require(_0xb71b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb71b('0x7'));router[_0xb71b('0x8')]('/',auth[_0xb71b('0x9')](),controller[_0xb71b('0xa')]);router[_0xb71b('0x8')](_0xb71b('0xb'),auth[_0xb71b('0x9')](),controller[_0xb71b('0xc')]);router[_0xb71b('0x8')](_0xb71b('0xd'),auth[_0xb71b('0x9')](),controller[_0xb71b('0xe')]);router[_0xb71b('0x8')](_0xb71b('0xf'),auth[_0xb71b('0x9')](),controller[_0xb71b('0x10')]);router[_0xb71b('0x11')]('/',auth[_0xb71b('0x9')](),controller[_0xb71b('0x12')]);router[_0xb71b('0x11')]('/:id/configurations',auth[_0xb71b('0x9')](),controller[_0xb71b('0x13')]);router[_0xb71b('0x14')]('/:id',auth[_0xb71b('0x9')](),controller[_0xb71b('0x15')]);router[_0xb71b('0x16')](_0xb71b('0xb'),auth[_0xb71b('0x9')](),controller[_0xb71b('0x17')]);module[_0xb71b('0x18')]=router; \ No newline at end of file +var _0x0cd0=['/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3bbe4b,_0x35f067){var _0x402d37=function(_0x2f7f78){while(--_0x2f7f78){_0x3bbe4b['push'](_0x3bbe4b['shift']());}};_0x402d37(++_0x35f067);}(_0x0cd0,0xbe));var _0x00cd=function(_0x3c7598,_0x3437b4){_0x3c7598=_0x3c7598-0x0;var _0x5a3789=_0x0cd0[_0x3c7598];return _0x5a3789;};'use strict';var multer=require('multer');var util=require(_0x00cd('0x0'));var path=require(_0x00cd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x00cd('0x2'));var auth=require(_0x00cd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x00cd('0x4'));var controller=require('./intDynamics365Account.controller');router[_0x00cd('0x5')]('/',auth[_0x00cd('0x6')](),controller[_0x00cd('0x7')]);router[_0x00cd('0x5')](_0x00cd('0x8'),auth[_0x00cd('0x6')](),controller[_0x00cd('0x9')]);router['get'](_0x00cd('0xa'),auth[_0x00cd('0x6')](),controller[_0x00cd('0xb')]);router[_0x00cd('0x5')]('/:id/fields',auth[_0x00cd('0x6')](),controller[_0x00cd('0xc')]);router['post']('/',auth[_0x00cd('0x6')](),controller[_0x00cd('0xd')]);router[_0x00cd('0xe')](_0x00cd('0xa'),auth[_0x00cd('0x6')](),controller[_0x00cd('0xf')]);router[_0x00cd('0x10')](_0x00cd('0x8'),auth[_0x00cd('0x6')](),controller[_0x00cd('0x11')]);router[_0x00cd('0x12')](_0x00cd('0x8'),auth[_0x00cd('0x6')](),controller[_0x00cd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 0372f5d..250ddda 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 _0xc1fa=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1c5968,_0x68d40c){var _0x290441=function(_0x5e2f4b){while(--_0x5e2f4b){_0x1c5968['push'](_0x1c5968['shift']());}};_0x290441(++_0x68d40c);}(_0xc1fa,0x83));var _0xac1f=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xc1fa[_0x142020];return _0x40da8f;};'use strict';var Sequelize=require(_0xac1f('0x0'));module[_0xac1f('0x1')]={'name':{'type':Sequelize[_0xac1f('0x2')]},'username':{'type':Sequelize[_0xac1f('0x2')]},'password':{'type':Sequelize[_0xac1f('0x2')]},'remoteUri':{'type':Sequelize[_0xac1f('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xac1f('0x2')]},'clientSecret':{'type':Sequelize[_0xac1f('0x2')]},'serverUrl':{'type':Sequelize[_0xac1f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac1f('0x2')]},'modernAuthentication':{'type':Sequelize[_0xac1f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x522b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x522b,0x1c3));var _0xb522=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x522b[_0x2e7a43];return _0x52e9e1;};'use strict';var Sequelize=require(_0xb522('0x0'));module[_0xb522('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb522('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb522('0x2')]},'clientId':{'type':Sequelize[_0xb522('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb522('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb522('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb522('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 91fe0df..a2deb90 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 _0xb477=['filter','where','merge','options','Dynamics365Account','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','ticketType','incident','Incident','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','subjectidname','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','includes','forEach','@odata.type','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','LogicalName','DisplayName','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','update','then','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x592a1c,_0x4f773e){var _0x27a3bb=function(_0x6bcfff){while(--_0x6bcfff){_0x592a1c['push'](_0x592a1c['shift']());}};_0x27a3bb(++_0x4f773e);}(_0xb477,0x8f));var _0x7b47=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb477[_0xfae23b];return _0x200640;};'use strict';var rp=require('request-promise');var util=require(_0x7b47('0x0'));var _=require(_0x7b47('0x1'));var qs=require(_0x7b47('0x2'));var logger=require('../../config/logger')(_0x7b47('0x3'));var db=require(_0x7b47('0x4'))['db'];var integrations=require(_0x7b47('0x5'));function respondWithResult(_0x5ccfb5,_0x3fcae3){_0x3fcae3=_0x3fcae3||0xc8;return function(_0x1c3e88){if(_0x1c3e88){return _0x5ccfb5[_0x7b47('0x6')](_0x3fcae3)[_0x7b47('0x7')](_0x1c3e88);}};}function respondWithFilteredResult(_0x45fb67,_0x48e1fc){return function(_0x259a1e){if(_0x259a1e){var _0x439867=typeof _0x48e1fc['offset']===_0x7b47('0x8')&&typeof _0x48e1fc[_0x7b47('0x9')]===_0x7b47('0x8');var _0x306d6e=_0x259a1e[_0x7b47('0xa')];var _0x8121cc=_0x439867?0x0:_0x48e1fc[_0x7b47('0xb')];var _0x765ebb=_0x439867?_0x259a1e[_0x7b47('0xa')]:_0x48e1fc[_0x7b47('0xb')]+_0x48e1fc[_0x7b47('0x9')];var _0x1e4a8b;if(_0x765ebb>=_0x306d6e){_0x765ebb=_0x306d6e;_0x1e4a8b=0xc8;}else{_0x1e4a8b=0xce;}_0x45fb67['status'](_0x1e4a8b);return _0x45fb67[_0x7b47('0xc')]('Content-Range',_0x8121cc+'-'+_0x765ebb+'/'+_0x306d6e)['json'](_0x259a1e);}return null;};}function saveUpdates(_0x5ad505){return function(_0x1e4e3d){if(_0x1e4e3d){return _0x1e4e3d[_0x7b47('0xd')](_0x5ad505)[_0x7b47('0xe')](function(_0x36abe4){return _0x36abe4;});}return null;};}function removeEntity(_0x335416){return function(_0x128999){if(_0x128999){return _0x128999['destroy']()[_0x7b47('0xe')](function(){_0x335416[_0x7b47('0x6')](0xcc)[_0x7b47('0xf')]();});}};}function handleEntityNotFound(_0x56aaa8){return function(_0x11be4f){if(!_0x11be4f){_0x56aaa8[_0x7b47('0x10')](0x194);}return _0x11be4f;};}function handleError(_0x379182,_0x283cd2){_0x283cd2=_0x283cd2||0x1f4;return function(_0x5c72be){logger[_0x7b47('0x11')](_0x5c72be[_0x7b47('0x12')]);if(_0x5c72be[_0x7b47('0x13')]){delete _0x5c72be[_0x7b47('0x13')];}_0x379182['status'](_0x283cd2)[_0x7b47('0x14')](_0x5c72be);};}exports['index']=function(_0x13e959,_0x47a713){var _0x4dd8d5={},_0x57e939={},_0x13c673={'count':0x0,'rows':[]};var _0x5a293f=_[_0x7b47('0x15')](db['Dynamics365Account'][_0x7b47('0x16')],function(_0x443333){return{'name':_0x443333[_0x7b47('0x17')],'type':_0x443333[_0x7b47('0x18')][_0x7b47('0x19')]};});_0x57e939[_0x7b47('0x1a')]=_[_0x7b47('0x15')](_0x5a293f,_0x7b47('0x13'));_0x57e939[_0x7b47('0x1b')]=_[_0x7b47('0x1c')](_0x13e959[_0x7b47('0x1b')]);_0x57e939[_0x7b47('0x1d')]=_['intersection'](_0x57e939[_0x7b47('0x1a')],_0x57e939[_0x7b47('0x1b')]);_0x4dd8d5[_0x7b47('0x1e')]=_[_0x7b47('0x1f')](_0x57e939[_0x7b47('0x1a')],qs[_0x7b47('0x20')](_0x13e959[_0x7b47('0x1b')][_0x7b47('0x20')]));_0x4dd8d5[_0x7b47('0x1e')]=_0x4dd8d5['attributes']['length']?_0x4dd8d5['attributes']:_0x57e939['model'];if(!_0x13e959[_0x7b47('0x1b')][_0x7b47('0x21')](_0x7b47('0x22'))){_0x4dd8d5[_0x7b47('0x9')]=qs[_0x7b47('0x9')](_0x13e959[_0x7b47('0x1b')][_0x7b47('0x9')]);_0x4dd8d5[_0x7b47('0xb')]=qs[_0x7b47('0xb')](_0x13e959[_0x7b47('0x1b')][_0x7b47('0xb')]);}_0x4dd8d5[_0x7b47('0x23')]=qs[_0x7b47('0x24')](_0x13e959[_0x7b47('0x1b')]['sort']);_0x4dd8d5['where']=qs['filters'](_[_0x7b47('0x25')](_0x13e959[_0x7b47('0x1b')],_0x57e939[_0x7b47('0x1d')]),_0x5a293f);if(_0x13e959[_0x7b47('0x1b')][_0x7b47('0x26')]){_0x4dd8d5[_0x7b47('0x27')]=_['merge'](_0x4dd8d5[_0x7b47('0x27')],{'$or':_[_0x7b47('0x15')](_0x5a293f,function(_0x1cf30c){if(_0x1cf30c[_0x7b47('0x18')]!=='VIRTUAL'){var _0x37f56b={};_0x37f56b[_0x1cf30c[_0x7b47('0x13')]]={'$like':'%'+_0x13e959['query'][_0x7b47('0x26')]+'%'};return _0x37f56b;}})});}_0x4dd8d5=_[_0x7b47('0x28')]({},_0x4dd8d5,_0x13e959[_0x7b47('0x29')]);var _0x30e968={'where':_0x4dd8d5[_0x7b47('0x27')]};return db[_0x7b47('0x2a')][_0x7b47('0xa')](_0x30e968)['then'](function(_0x4ddc08){_0x13c673[_0x7b47('0xa')]=_0x4ddc08;if(_0x13e959['query'][_0x7b47('0x2b')]){_0x4dd8d5[_0x7b47('0x2c')]=[{'all':!![]}];}return db[_0x7b47('0x2a')][_0x7b47('0x2d')](_0x4dd8d5);})[_0x7b47('0xe')](function(_0xc57f42){_0x13c673[_0x7b47('0x2e')]=_0xc57f42;return _0x13c673;})['then'](respondWithFilteredResult(_0x47a713,_0x4dd8d5))[_0x7b47('0x2f')](handleError(_0x47a713,null));};exports['show']=function(_0x4d45ae,_0x12a63d){var _0x365303={'raw':![],'where':{'id':_0x4d45ae[_0x7b47('0x30')]['id']}},_0x538bce={};_0x538bce[_0x7b47('0x1a')]=_[_0x7b47('0x1c')](db[_0x7b47('0x2a')][_0x7b47('0x16')]);_0x538bce[_0x7b47('0x1b')]=_[_0x7b47('0x1c')](_0x4d45ae[_0x7b47('0x1b')]);_0x538bce['filters']=_[_0x7b47('0x1f')](_0x538bce['model'],_0x538bce[_0x7b47('0x1b')]);_0x365303[_0x7b47('0x1e')]=_[_0x7b47('0x1f')](_0x538bce[_0x7b47('0x1a')],qs['fields'](_0x4d45ae[_0x7b47('0x1b')][_0x7b47('0x20')]));_0x365303[_0x7b47('0x1e')]=_0x365303[_0x7b47('0x1e')][_0x7b47('0x31')]?_0x365303['attributes']:_0x538bce[_0x7b47('0x1a')];if(_0x4d45ae['query']['includeAll']){_0x365303[_0x7b47('0x2c')]=[{'all':!![]}];}_0x365303=_[_0x7b47('0x28')]({},_0x365303,_0x4d45ae['options']);return db[_0x7b47('0x2a')][_0x7b47('0x32')](_0x365303)[_0x7b47('0xe')](handleEntityNotFound(_0x12a63d,null))[_0x7b47('0xe')](respondWithResult(_0x12a63d,null))[_0x7b47('0x2f')](handleError(_0x12a63d,null));};exports['create']=function(_0x340886,_0x544597){return db[_0x7b47('0x2a')][_0x7b47('0x33')](_0x340886[_0x7b47('0x34')],{})[_0x7b47('0xe')](respondWithResult(_0x544597,0xc9))[_0x7b47('0x2f')](handleError(_0x544597,null));};exports[_0x7b47('0xd')]=function(_0x2de261,_0x23804e){if(_0x2de261['body']['id']){delete _0x2de261[_0x7b47('0x34')]['id'];}return db[_0x7b47('0x2a')][_0x7b47('0x32')]({'where':{'id':_0x2de261['params']['id']}})[_0x7b47('0xe')](handleEntityNotFound(_0x23804e,null))[_0x7b47('0xe')](saveUpdates(_0x2de261[_0x7b47('0x34')],null))[_0x7b47('0xe')](respondWithResult(_0x23804e,null))['catch'](handleError(_0x23804e,null));};exports[_0x7b47('0x35')]=function(_0x1a70d2,_0xd24c11){return db['Dynamics365Account'][_0x7b47('0x32')]({'where':{'id':_0x1a70d2[_0x7b47('0x30')]['id']}})[_0x7b47('0xe')](handleEntityNotFound(_0xd24c11,null))['then'](removeEntity(_0xd24c11,null))[_0x7b47('0x2f')](handleError(_0xd24c11,null));};exports[_0x7b47('0x36')]=function(_0x7bad5f,_0x1ee886){var _0x76a30a={};var _0x5416aa={};var _0x3cc89e;var _0x590754;return db[_0x7b47('0x2a')][_0x7b47('0x37')]({'where':{'id':_0x7bad5f['params']['id']}})[_0x7b47('0xe')](handleEntityNotFound(_0x1ee886,null))[_0x7b47('0xe')](function(_0x269aca){if(_0x269aca){_0x3cc89e=_0x269aca;_0x5416aa['model']=_[_0x7b47('0x1c')](db[_0x7b47('0x38')][_0x7b47('0x16')]);_0x5416aa['query']=_[_0x7b47('0x1c')](_0x7bad5f['query']);_0x5416aa[_0x7b47('0x1d')]=_[_0x7b47('0x1f')](_0x5416aa[_0x7b47('0x1a')],_0x5416aa[_0x7b47('0x1b')]);_0x76a30a['attributes']=_[_0x7b47('0x1f')](_0x5416aa['model'],qs[_0x7b47('0x20')](_0x7bad5f['query'][_0x7b47('0x20')]));_0x76a30a[_0x7b47('0x1e')]=_0x76a30a[_0x7b47('0x1e')]['length']?_0x76a30a[_0x7b47('0x1e')]:_0x5416aa[_0x7b47('0x1a')];_0x76a30a[_0x7b47('0x23')]=qs['sort'](_0x7bad5f['query']['sort']);_0x76a30a[_0x7b47('0x27')]=qs['filters'](_[_0x7b47('0x25')](_0x7bad5f[_0x7b47('0x1b')],_0x5416aa[_0x7b47('0x1d')]));if(_0x7bad5f[_0x7b47('0x1b')]['filter']){_0x76a30a['where']=_[_0x7b47('0x28')](_0x76a30a['where'],{'$or':_[_0x7b47('0x15')](_0x76a30a[_0x7b47('0x1e')],function(_0x202e64){var _0x3d3c57={};_0x3d3c57[_0x202e64]={'$like':'%'+_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0x26')]+'%'};return _0x3d3c57;})});}_0x76a30a=_[_0x7b47('0x28')]({},_0x76a30a,_0x7bad5f[_0x7b47('0x29')]);return _0x3cc89e[_0x7b47('0x36')](_0x76a30a);}})['then'](function(_0x377079){if(_0x377079){_0x590754=_0x377079[_0x7b47('0x31')];if(!_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0x21')](_0x7b47('0x22'))){_0x76a30a[_0x7b47('0x9')]=qs['limit'](_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0x9')]);_0x76a30a[_0x7b47('0xb')]=qs[_0x7b47('0xb')](_0x7bad5f[_0x7b47('0x1b')][_0x7b47('0xb')]);}return _0x3cc89e[_0x7b47('0x36')](_0x76a30a);}})[_0x7b47('0xe')](function(_0x5579c6){if(_0x5579c6){return _0x5579c6?{'count':_0x590754,'rows':_0x5579c6}:null;}})[_0x7b47('0xe')](respondWithResult(_0x1ee886,null))[_0x7b47('0x2f')](handleError(_0x1ee886,null));};exports['addConfiguration']=function(_0x483a13,_0x33449b){if(_0x483a13[_0x7b47('0x34')]['id']){delete _0x483a13[_0x7b47('0x34')]['id'];}return db[_0x7b47('0x2a')][_0x7b47('0x37')]({'where':{'id':_0x483a13[_0x7b47('0x30')]['id']}})['then'](handleEntityNotFound(_0x33449b,null))['then'](function(_0x16b701){if(_0x16b701){_0x483a13[_0x7b47('0x34')][_0x7b47('0x39')]=_0x16b701['id'];_0x483a13['body'][_0x7b47('0x3a')]=integrations['getSubjects'](_0x483a13['body'][_0x7b47('0x3b')],_0x483a13['body'][_0x7b47('0x18')]);_0x483a13[_0x7b47('0x34')][_0x7b47('0x3c')]=integrations[_0x7b47('0x3d')](_0x483a13[_0x7b47('0x34')][_0x7b47('0x3b')],_0x483a13[_0x7b47('0x34')]['type']);return db[_0x7b47('0x38')][_0x7b47('0x33')](_0x483a13['body'],{'include':[{'model':db[_0x7b47('0x3e')],'as':_0x7b47('0x3a')},{'model':db[_0x7b47('0x3e')],'as':'Descriptions'}]});}return null;})[_0x7b47('0xe')](respondWithResult(_0x33449b,null))[_0x7b47('0x2f')](handleError(_0x33449b,null));};function sanitizeRemoteUri(_0x120066){var _0x5d6458=_0x120066['slice'](-0x1);if(_0x5d6458==='/')return _0x120066[_0x7b47('0x3f')](0x0,_0x120066[_0x7b47('0x40')](_0x5d6458));return _0x120066;}function getWebApiUrl(_0x5ef85a){return util[_0x7b47('0x41')]('%s/api/data/v9.0/',_0x5ef85a);}exports['getFields']=function(_0x10a72a,_0x559527){var _0x14c023=_0x10a72a['query'][_0x7b47('0x42')];var _0x43ab36=_0x14c023===_0x7b47('0x43')?_0x7b47('0x44'):'PhoneCall';var _0x5b7537='';var _0x9b8b5e='';var _0x15c30a='';var _0x3b40bc='';var _0x54dfe5='';var _0x4bd0c7='';var _0x31f33d='';var _0x47013e='';var _0x38a32b=[_0x7b47('0x45'),_0x7b47('0x46'),'customerid',_0x7b47('0x47'),'caseorigincode',_0x7b47('0x48'),_0x7b47('0x49'),_0x7b47('0x4a'),_0x7b47('0x4b'),_0x7b47('0x4c')];var _0x1f2856=['accountidname',_0x7b47('0x4d'),_0x7b47('0x4e'),'billedserviceunits',_0x7b47('0x4f'),_0x7b47('0x50'),_0x7b47('0x51'),_0x7b47('0x52'),_0x7b47('0x53'),'createdbyexternalpartyyominame',_0x7b47('0x54'),_0x7b47('0x55'),'createdon','createdonbehalfbyname',_0x7b47('0x56'),_0x7b47('0x57'),_0x7b47('0x58'),_0x7b47('0x59'),_0x7b47('0x5a'),_0x7b47('0x5b'),_0x7b47('0x5c'),_0x7b47('0x5d'),'escalatedon',_0x7b47('0x5e'),_0x7b47('0x5f'),_0x7b47('0x60'),_0x7b47('0x61'),_0x7b47('0x62'),_0x7b47('0x63'),'lastonholdtime',_0x7b47('0x64'),_0x7b47('0x65'),_0x7b47('0x66'),'modifiedbyname','modifiedbyyominame',_0x7b47('0x67'),_0x7b47('0x68'),_0x7b47('0x69'),_0x7b47('0x6a'),_0x7b47('0x6b'),_0x7b47('0x6c'),_0x7b47('0x6d'),_0x7b47('0x6e'),_0x7b47('0x6f'),'owneridtype',_0x7b47('0x70'),_0x7b47('0x71'),_0x7b47('0x72'),'primarycontactidyominame',_0x7b47('0x73'),_0x7b47('0x74'),_0x7b47('0x75'),_0x7b47('0x76'),_0x7b47('0x77'),_0x7b47('0x78'),'responsiblecontactidname',_0x7b47('0x79'),_0x7b47('0x7a'),'slainvokedidname',_0x7b47('0x7b'),_0x7b47('0x7c'),'statecode','statuscode',_0x7b47('0x7d'),'ticketnumber','timezoneruleversionnumber',_0x7b47('0x7e'),'traversedpath',_0x7b47('0x7f'),_0x7b47('0x80')];var _0x234e17=_0x38a32b[_0x7b47('0x81')](_0x1f2856);return db[_0x7b47('0x2a')][_0x7b47('0x37')]({'where':{'id':_0x10a72a[_0x7b47('0x30')]['id']},'attributes':['id','username',_0x7b47('0x82'),_0x7b47('0x83'),_0x7b47('0x84'),_0x7b47('0x85'),_0x7b47('0x86'),_0x7b47('0x87')],'include':[{'model':db['CloudProvider'],'as':_0x7b47('0x88'),'attributes':['id',_0x7b47('0x89'),_0x7b47('0x8a')]}]})[_0x7b47('0xe')](handleEntityNotFound(_0x559527,null))[_0x7b47('0xe')](function(_0x2d8a08){if(_0x2d8a08){if(_0x2d8a08[_0x7b47('0x87')]){_0x2d8a08['access_token']=_0x2d8a08[_0x7b47('0x88')][_0x7b47('0x89')];_0x47013e=sanitizeRemoteUri(_0x2d8a08[_0x7b47('0x88')]['data7']);_0x31f33d=getWebApiUrl(_0x47013e);return _0x2d8a08;}_0x47013e=sanitizeRemoteUri(_0x2d8a08[_0x7b47('0x83')]);_0x31f33d=getWebApiUrl(_0x47013e);var _0x60ac23={'method':_0x7b47('0x8b'),'uri':_0x7b47('0x8c')+_0x2d8a08['tenantId']+_0x7b47('0x8d'),'form':{'client_id':_0x2d8a08['clientId'],'resource':_0x47013e,'username':_0x2d8a08['username'],'password':_0x2d8a08[_0x7b47('0x82')],'grant_type':_0x7b47('0x82'),'client_secret':_0x2d8a08[_0x7b47('0x86')]},'json':!![]};return rp(_0x60ac23);}})[_0x7b47('0xe')](function(_0x1054b8){_0x4bd0c7=_0x1054b8[_0x7b47('0x8e')];var _0x1fee6f={'method':_0x7b47('0x8f'),'uri':encodeURI(_0x31f33d+_0x7b47('0x90')+_0x43ab36+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4bd0c7,'If-None-Match':null,'OData-Version':_0x7b47('0x91')},'json':!![]};return rp(_0x1fee6f);})[_0x7b47('0xe')](function(_0x3b5809){var _0x5dca3a=_0x3b5809[_0x7b47('0x92')][0x0];var _0x19619d=_0x5dca3a[_0x7b47('0x93')];var _0x5a630f={'method':_0x7b47('0x8f'),'uri':_0x31f33d+_0x7b47('0x94')+_0x19619d+_0x7b47('0x95'),'headers':{'Authorization':_0x7b47('0x96')+_0x4bd0c7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5a630f);})['then'](function(_0x111f52){_0x5b7537=_0x111f52;_0x9b8b5e=_0x5b7537['Attributes'];_0x9b8b5e=_['remove'](_0x9b8b5e,function(_0x471196){return!_0x234e17[_0x7b47('0x97')](_0x471196['LogicalName']);});var _0x289bd7=[];var _0x44356a=[];_0x9b8b5e[_0x7b47('0x98')](function(_0x55810e){if(_0x55810e[_0x7b47('0x99')]){var _0x58e458=_0x55810e[_0x7b47('0x99')]['substring'](_0x55810e['@odata.type'][_0x7b47('0x40')]('.')+0x1);if(_0x58e458==='PicklistAttributeMetadata'){_0x289bd7[_0x7b47('0x9a')](getSelectList(_0x31f33d,_0x14c023,_0x44356a,_0x5b7537[_0x7b47('0x93')],_0x55810e[_0x7b47('0x93')],_0x4bd0c7));}}});return Promise[_0x7b47('0x9b')](_0x289bd7);})[_0x7b47('0xe')](function(_0x5bda28){_0x15c30a=_0x5bda28[0x0];var _0x33c457=[];var _0x32aff1=[];_0x9b8b5e[_0x7b47('0x98')](function(_0x5eab8d){if(!_[_0x7b47('0x9c')](_0x5eab8d[_0x7b47('0x99')])){var _0x3fd93a=_0x5eab8d[_0x7b47('0x99')][_0x7b47('0x3f')](_0x5eab8d[_0x7b47('0x99')][_0x7b47('0x40')]('.')+0x1);if(_0x3fd93a==='BooleanAttributeMetadata'){_0x33c457[_0x7b47('0x9a')](getBooleanList(_0x31f33d,_0x14c023,_0x32aff1,_0x5b7537[_0x7b47('0x93')],_0x5eab8d[_0x7b47('0x93')],_0x4bd0c7));}}});return Promise[_0x7b47('0x9b')](_0x33c457);})[_0x7b47('0xe')](function(_0x2a9f4c){_0x3b40bc=_0x2a9f4c[0x0];var _0x3d8650=[];var _0xc07226=[];_0x9b8b5e[_0x7b47('0x98')](function(_0x5e5b92){if(_0x5e5b92[_0x7b47('0x99')]){var _0x4e8bf5=_0x5e5b92['@odata.type'][_0x7b47('0x3f')](_0x5e5b92[_0x7b47('0x99')]['lastIndexOf']('.')+0x1);if(_0x4e8bf5===_0x7b47('0x9d')||_0x4e8bf5===_0x7b47('0x9e')||_0x4e8bf5===_0x7b47('0x9f')||_0x4e8bf5===_0x7b47('0xa0')||_0x4e8bf5===_0x7b47('0xa1')||_0x4e8bf5==='DateTimeAttributeMetadata'||_0x4e8bf5===_0x7b47('0xa2')||_0x4e8bf5==='EntityNameAttributeMetadata'||_0x4e8bf5==='StateAttributeMetadata'||_0x4e8bf5===_0x7b47('0xa3')){_0x3d8650['push'](getInputList(_0x31f33d,_0x14c023,_0x4e8bf5,_0xc07226,_0x5b7537[_0x7b47('0x93')],_0x5e5b92[_0x7b47('0x93')],_0x4bd0c7));}}});return Promise['all'](_0x3d8650);})[_0x7b47('0xe')](function(_0x537a95){_0x54dfe5=_0x537a95[0x0];var _0x1fdf30=_0x15c30a[_0x7b47('0x81')](_0x3b40bc)['concat'](_0x54dfe5);var _0x1fa9a9={'count':_0x1fdf30[_0x7b47('0x31')],'rows':_0x1fdf30};return _0x1fa9a9;})[_0x7b47('0xe')](respondWithResult(_0x559527,null))[_0x7b47('0x2f')](function(_0x5bac4b){var _0x105dca=_0x10a72a[_0x7b47('0x1b')][_0x7b47('0xa4')]?0x1f4:_0x5bac4b[_0x7b47('0xa5')]||0x1f4;logger['error'](_0x5bac4b[_0x7b47('0x12')]);delete _0x5bac4b[_0x7b47('0x13')];if(_0x105dca===0x191){_0x105dca=0x190;}_0x559527[_0x7b47('0x6')](_0x105dca)['send'](_0x10a72a[_0x7b47('0x1b')][_0x7b47('0xa4')]?{'message':_0x7b47('0xa6'),'statusCode':_0x5bac4b['statusCode']}:_0x5bac4b);});};function getSelectList(_0x4e0069,_0x353020,_0x31cc6e,_0x5a10bd,_0xf47561,_0x3e92c9){var _0x39fe85={'method':_0x7b47('0x8f'),'uri':_0x4e0069+_0x7b47('0x94')+_0x5a10bd+_0x7b47('0xa7')+_0xf47561+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x7b47('0x96')+_0x3e92c9,'If-None-Match':null,'OData-Version':_0x7b47('0x91')},'json':!![]};return rp(_0x39fe85)['then'](function(_0x4dcd07){var _0x35183f=[];var _0x1812e4=_0x4dcd07[_0x7b47('0xa8')][_0x7b47('0xa9')];_0x1812e4[_0x7b47('0x98')](function(_0x375f5f){_0x35183f['push']({'name':_0x375f5f[_0x7b47('0xaa')][_0x7b47('0xab')][_0x7b47('0xaa')],'value':String(_0x375f5f[_0x7b47('0xac')])});});var _0x10ed4d={'id':_0x353020+'_'+_0x4dcd07['LogicalName'],'name':_0x4dcd07['DisplayName'][_0x7b47('0xab')][_0x7b47('0xaa')],'custom':![],'options':_0x35183f};_0x31cc6e[_0x7b47('0x9a')](_0x10ed4d);return _0x31cc6e;});}function getBooleanList(_0x4ee544,_0x2fc366,_0x5e30bb,_0x3f2165,_0x5e16ec,_0x124f5a){var _0x353afa={'method':'GET','uri':_0x4ee544+_0x7b47('0x94')+_0x3f2165+_0x7b47('0xa7')+_0x5e16ec+_0x7b47('0xad'),'headers':{'Authorization':_0x7b47('0x96')+_0x124f5a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x353afa)[_0x7b47('0xe')](function(_0x75b7d7){var _0x2c941c=[];_0x2c941c[_0x7b47('0x9a')]({'name':_0x75b7d7[_0x7b47('0xa8')][_0x7b47('0xae')][_0x7b47('0xaa')][_0x7b47('0xab')][_0x7b47('0xaa')],'value':'true'},{'name':_0x75b7d7[_0x7b47('0xa8')][_0x7b47('0xaf')][_0x7b47('0xaa')]['UserLocalizedLabel'][_0x7b47('0xaa')],'value':_0x7b47('0xb0')});var _0x2f1e61={'id':_0x2fc366+'_'+_0x75b7d7['LogicalName'],'name':_0x75b7d7['DisplayName'][_0x7b47('0xab')][_0x7b47('0xaa')],'custom':![],'options':_0x2c941c};_0x5e30bb[_0x7b47('0x9a')](_0x2f1e61);return _0x5e30bb;});}function getInputList(_0x250a8a,_0x10e77a,_0x47a952,_0x3142ef,_0x506980,_0x55b7d6,_0x38f07a){var _0x26813e={'method':_0x7b47('0x8f'),'uri':_0x250a8a+'EntityDefinitions('+_0x506980+')/Attributes('+_0x55b7d6+_0x7b47('0xb1')+_0x47a952+_0x7b47('0xb2'),'headers':{'Authorization':_0x7b47('0x96')+_0x38f07a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26813e)[_0x7b47('0xe')](function(_0x3bf3a0){var _0x3c33ae={'id':_0x10e77a+'_'+_0x3bf3a0[_0x7b47('0xb3')],'name':_0x3bf3a0['DisplayName'][_0x7b47('0xab')]?_0x3bf3a0[_0x7b47('0xb4')][_0x7b47('0xab')][_0x7b47('0xaa')]:_0x3bf3a0[_0x7b47('0xb3')],'custom':![],'options':[]};_0x3142ef[_0x7b47('0x9a')](_0x3c33ae);return _0x3142ef;});} \ No newline at end of file +var _0x0a1a=['index','map','Dynamics365Account','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','substring','lastIndexOf','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','sendStatus','error','name','send'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x0a1a,0x161));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var rp=require(_0xa0a1('0x0'));var util=require(_0xa0a1('0x1'));var _=require(_0xa0a1('0x2'));var qs=require(_0xa0a1('0x3'));var logger=require(_0xa0a1('0x4'))(_0xa0a1('0x5'));var db=require(_0xa0a1('0x6'))['db'];var integrations=require(_0xa0a1('0x7'));function respondWithResult(_0x56fb50,_0x3450a6){_0x3450a6=_0x3450a6||0xc8;return function(_0x23f6c6){if(_0x23f6c6){return _0x56fb50[_0xa0a1('0x8')](_0x3450a6)[_0xa0a1('0x9')](_0x23f6c6);}};}function respondWithFilteredResult(_0xa5b83,_0x3e0353){return function(_0x482fd3){if(_0x482fd3){var _0x2989ff=typeof _0x3e0353[_0xa0a1('0xa')]===_0xa0a1('0xb')&&typeof _0x3e0353[_0xa0a1('0xc')]===_0xa0a1('0xb');var _0x303535=_0x482fd3[_0xa0a1('0xd')];var _0x21e1af=_0x2989ff?0x0:_0x3e0353[_0xa0a1('0xa')];var _0x42a779=_0x2989ff?_0x482fd3[_0xa0a1('0xd')]:_0x3e0353[_0xa0a1('0xa')]+_0x3e0353['limit'];var _0x1dce43;if(_0x42a779>=_0x303535){_0x42a779=_0x303535;_0x1dce43=0xc8;}else{_0x1dce43=0xce;}_0xa5b83[_0xa0a1('0x8')](_0x1dce43);return _0xa5b83['set'](_0xa0a1('0xe'),_0x21e1af+'-'+_0x42a779+'/'+_0x303535)[_0xa0a1('0x9')](_0x482fd3);}return null;};}function saveUpdates(_0x1796af){return function(_0x104599){if(_0x104599){return _0x104599[_0xa0a1('0xf')](_0x1796af)[_0xa0a1('0x10')](function(_0x17d639){return _0x17d639;});}return null;};}function removeEntity(_0x56c83d){return function(_0x3ec4ec){if(_0x3ec4ec){return _0x3ec4ec[_0xa0a1('0x11')]()[_0xa0a1('0x10')](function(){_0x56c83d[_0xa0a1('0x8')](0xcc)[_0xa0a1('0x12')]();});}};}function handleEntityNotFound(_0x367871){return function(_0x2aa317){if(!_0x2aa317){_0x367871[_0xa0a1('0x13')](0x194);}return _0x2aa317;};}function handleError(_0x26dd29,_0x5aca98){_0x5aca98=_0x5aca98||0x1f4;return function(_0x58074c){logger[_0xa0a1('0x14')](_0x58074c['stack']);if(_0x58074c[_0xa0a1('0x15')]){delete _0x58074c[_0xa0a1('0x15')];}_0x26dd29[_0xa0a1('0x8')](_0x5aca98)[_0xa0a1('0x16')](_0x58074c);};}exports[_0xa0a1('0x17')]=function(_0x413f01,_0x226d1b){var _0x1008cf={},_0x5b0e25={},_0x15b8af={'count':0x0,'rows':[]};var _0x228638=_[_0xa0a1('0x18')](db[_0xa0a1('0x19')]['rawAttributes'],function(_0x3c31dd){return{'name':_0x3c31dd[_0xa0a1('0x1a')],'type':_0x3c31dd[_0xa0a1('0x1b')]['key']};});_0x5b0e25['model']=_[_0xa0a1('0x18')](_0x228638,'name');_0x5b0e25[_0xa0a1('0x1c')]=_[_0xa0a1('0x1d')](_0x413f01[_0xa0a1('0x1c')]);_0x5b0e25['filters']=_[_0xa0a1('0x1e')](_0x5b0e25[_0xa0a1('0x1f')],_0x5b0e25[_0xa0a1('0x1c')]);_0x1008cf['attributes']=_['intersection'](_0x5b0e25['model'],qs[_0xa0a1('0x20')](_0x413f01[_0xa0a1('0x1c')][_0xa0a1('0x20')]));_0x1008cf[_0xa0a1('0x21')]=_0x1008cf[_0xa0a1('0x21')][_0xa0a1('0x22')]?_0x1008cf['attributes']:_0x5b0e25['model'];if(!_0x413f01[_0xa0a1('0x1c')][_0xa0a1('0x23')](_0xa0a1('0x24'))){_0x1008cf[_0xa0a1('0xc')]=qs[_0xa0a1('0xc')](_0x413f01[_0xa0a1('0x1c')][_0xa0a1('0xc')]);_0x1008cf[_0xa0a1('0xa')]=qs[_0xa0a1('0xa')](_0x413f01[_0xa0a1('0x1c')][_0xa0a1('0xa')]);}_0x1008cf[_0xa0a1('0x25')]=qs[_0xa0a1('0x26')](_0x413f01['query'][_0xa0a1('0x26')]);_0x1008cf[_0xa0a1('0x27')]=qs['filters'](_[_0xa0a1('0x28')](_0x413f01[_0xa0a1('0x1c')],_0x5b0e25[_0xa0a1('0x29')]),_0x228638);if(_0x413f01[_0xa0a1('0x1c')][_0xa0a1('0x2a')]){_0x1008cf[_0xa0a1('0x27')]=_[_0xa0a1('0x2b')](_0x1008cf[_0xa0a1('0x27')],{'$or':_['map'](_0x228638,function(_0x551af8){if(_0x551af8[_0xa0a1('0x1b')]!==_0xa0a1('0x2c')){var _0x586c90={};_0x586c90[_0x551af8[_0xa0a1('0x15')]]={'$like':'%'+_0x413f01[_0xa0a1('0x1c')]['filter']+'%'};return _0x586c90;}})});}_0x1008cf=_[_0xa0a1('0x2b')]({},_0x1008cf,_0x413f01[_0xa0a1('0x2d')]);var _0x1900e5={'where':_0x1008cf[_0xa0a1('0x27')]};return db[_0xa0a1('0x19')]['count'](_0x1900e5)[_0xa0a1('0x10')](function(_0x41a78e){_0x15b8af[_0xa0a1('0xd')]=_0x41a78e;if(_0x413f01[_0xa0a1('0x1c')][_0xa0a1('0x2e')]){_0x1008cf['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0xa0a1('0x2f')](_0x1008cf);})[_0xa0a1('0x10')](function(_0x1ac54d){_0x15b8af[_0xa0a1('0x30')]=_0x1ac54d;return _0x15b8af;})['then'](respondWithFilteredResult(_0x226d1b,_0x1008cf))[_0xa0a1('0x31')](handleError(_0x226d1b,null));};exports['show']=function(_0x5b1b1b,_0x781504){var _0x461f54={'raw':![],'where':{'id':_0x5b1b1b[_0xa0a1('0x32')]['id']}},_0x4ae288={};_0x4ae288[_0xa0a1('0x1f')]=_[_0xa0a1('0x1d')](db['Dynamics365Account'][_0xa0a1('0x33')]);_0x4ae288[_0xa0a1('0x1c')]=_[_0xa0a1('0x1d')](_0x5b1b1b[_0xa0a1('0x1c')]);_0x4ae288['filters']=_[_0xa0a1('0x1e')](_0x4ae288['model'],_0x4ae288['query']);_0x461f54[_0xa0a1('0x21')]=_[_0xa0a1('0x1e')](_0x4ae288['model'],qs[_0xa0a1('0x20')](_0x5b1b1b[_0xa0a1('0x1c')][_0xa0a1('0x20')]));_0x461f54[_0xa0a1('0x21')]=_0x461f54[_0xa0a1('0x21')][_0xa0a1('0x22')]?_0x461f54[_0xa0a1('0x21')]:_0x4ae288['model'];if(_0x5b1b1b[_0xa0a1('0x1c')]['includeAll']){_0x461f54[_0xa0a1('0x34')]=[{'all':!![]}];}_0x461f54=_['merge']({},_0x461f54,_0x5b1b1b[_0xa0a1('0x2d')]);return db[_0xa0a1('0x19')][_0xa0a1('0x35')](_0x461f54)[_0xa0a1('0x10')](handleEntityNotFound(_0x781504,null))['then'](respondWithResult(_0x781504,null))['catch'](handleError(_0x781504,null));};exports[_0xa0a1('0x36')]=function(_0x19817f,_0x21d1f5){return db['Dynamics365Account']['create'](_0x19817f[_0xa0a1('0x37')],{})[_0xa0a1('0x10')](respondWithResult(_0x21d1f5,0xc9))[_0xa0a1('0x31')](handleError(_0x21d1f5,null));};exports[_0xa0a1('0xf')]=function(_0x2cf6bd,_0x418dce){if(_0x2cf6bd[_0xa0a1('0x37')]['id']){delete _0x2cf6bd[_0xa0a1('0x37')]['id'];}return db['Dynamics365Account'][_0xa0a1('0x35')]({'where':{'id':_0x2cf6bd[_0xa0a1('0x32')]['id']}})[_0xa0a1('0x10')](handleEntityNotFound(_0x418dce,null))[_0xa0a1('0x10')](saveUpdates(_0x2cf6bd[_0xa0a1('0x37')],null))[_0xa0a1('0x10')](respondWithResult(_0x418dce,null))['catch'](handleError(_0x418dce,null));};exports[_0xa0a1('0x11')]=function(_0x37742e,_0x5b750c){return db[_0xa0a1('0x19')][_0xa0a1('0x35')]({'where':{'id':_0x37742e['params']['id']}})[_0xa0a1('0x10')](handleEntityNotFound(_0x5b750c,null))['then'](removeEntity(_0x5b750c,null))[_0xa0a1('0x31')](handleError(_0x5b750c,null));};exports[_0xa0a1('0x38')]=function(_0x1ba6eb,_0xdaa881){var _0x4b6ef2={};var _0x31ec00={};var _0x39fe2b;var _0x541c34;return db['Dynamics365Account'][_0xa0a1('0x39')]({'where':{'id':_0x1ba6eb['params']['id']}})[_0xa0a1('0x10')](handleEntityNotFound(_0xdaa881,null))['then'](function(_0x2f5702){if(_0x2f5702){_0x39fe2b=_0x2f5702;_0x31ec00[_0xa0a1('0x1f')]=_[_0xa0a1('0x1d')](db[_0xa0a1('0x3a')]['rawAttributes']);_0x31ec00['query']=_[_0xa0a1('0x1d')](_0x1ba6eb[_0xa0a1('0x1c')]);_0x31ec00[_0xa0a1('0x29')]=_[_0xa0a1('0x1e')](_0x31ec00[_0xa0a1('0x1f')],_0x31ec00[_0xa0a1('0x1c')]);_0x4b6ef2[_0xa0a1('0x21')]=_[_0xa0a1('0x1e')](_0x31ec00[_0xa0a1('0x1f')],qs[_0xa0a1('0x20')](_0x1ba6eb['query'][_0xa0a1('0x20')]));_0x4b6ef2['attributes']=_0x4b6ef2[_0xa0a1('0x21')]['length']?_0x4b6ef2[_0xa0a1('0x21')]:_0x31ec00[_0xa0a1('0x1f')];_0x4b6ef2[_0xa0a1('0x25')]=qs[_0xa0a1('0x26')](_0x1ba6eb[_0xa0a1('0x1c')][_0xa0a1('0x26')]);_0x4b6ef2[_0xa0a1('0x27')]=qs[_0xa0a1('0x29')](_[_0xa0a1('0x28')](_0x1ba6eb[_0xa0a1('0x1c')],_0x31ec00[_0xa0a1('0x29')]));if(_0x1ba6eb[_0xa0a1('0x1c')][_0xa0a1('0x2a')]){_0x4b6ef2[_0xa0a1('0x27')]=_[_0xa0a1('0x2b')](_0x4b6ef2[_0xa0a1('0x27')],{'$or':_[_0xa0a1('0x18')](_0x4b6ef2[_0xa0a1('0x21')],function(_0x112ce1){var _0x3a45e8={};_0x3a45e8[_0x112ce1]={'$like':'%'+_0x1ba6eb['query'][_0xa0a1('0x2a')]+'%'};return _0x3a45e8;})});}_0x4b6ef2=_[_0xa0a1('0x2b')]({},_0x4b6ef2,_0x1ba6eb[_0xa0a1('0x2d')]);return _0x39fe2b[_0xa0a1('0x38')](_0x4b6ef2);}})[_0xa0a1('0x10')](function(_0x39eb83){if(_0x39eb83){_0x541c34=_0x39eb83[_0xa0a1('0x22')];if(!_0x1ba6eb[_0xa0a1('0x1c')]['hasOwnProperty'](_0xa0a1('0x24'))){_0x4b6ef2['limit']=qs[_0xa0a1('0xc')](_0x1ba6eb['query'][_0xa0a1('0xc')]);_0x4b6ef2[_0xa0a1('0xa')]=qs['offset'](_0x1ba6eb['query'][_0xa0a1('0xa')]);}return _0x39fe2b[_0xa0a1('0x38')](_0x4b6ef2);}})[_0xa0a1('0x10')](function(_0xb44d4b){if(_0xb44d4b){return _0xb44d4b?{'count':_0x541c34,'rows':_0xb44d4b}:null;}})['then'](respondWithResult(_0xdaa881,null))[_0xa0a1('0x31')](handleError(_0xdaa881,null));};exports['addConfiguration']=function(_0x17dcee,_0xb0044a){if(_0x17dcee['body']['id']){delete _0x17dcee[_0xa0a1('0x37')]['id'];}return db[_0xa0a1('0x19')][_0xa0a1('0x39')]({'where':{'id':_0x17dcee[_0xa0a1('0x32')]['id']}})[_0xa0a1('0x10')](handleEntityNotFound(_0xb0044a,null))[_0xa0a1('0x10')](function(_0x24c4de){if(_0x24c4de){_0x17dcee[_0xa0a1('0x37')][_0xa0a1('0x3b')]=_0x24c4de['id'];_0x17dcee[_0xa0a1('0x37')][_0xa0a1('0x3c')]=integrations[_0xa0a1('0x3d')](_0x17dcee[_0xa0a1('0x37')][_0xa0a1('0x3e')],_0x17dcee[_0xa0a1('0x37')][_0xa0a1('0x1b')]);_0x17dcee[_0xa0a1('0x37')]['Descriptions']=integrations[_0xa0a1('0x3f')](_0x17dcee[_0xa0a1('0x37')][_0xa0a1('0x3e')],_0x17dcee[_0xa0a1('0x37')]['type']);return db[_0xa0a1('0x3a')][_0xa0a1('0x36')](_0x17dcee[_0xa0a1('0x37')],{'include':[{'model':db[_0xa0a1('0x40')],'as':'Subjects'},{'model':db[_0xa0a1('0x40')],'as':_0xa0a1('0x41')}]});}return null;})[_0xa0a1('0x10')](respondWithResult(_0xb0044a,null))[_0xa0a1('0x31')](handleError(_0xb0044a,null));};function sanitizeRemoteUri(_0x3942c8){var _0xec689e=_0x3942c8['slice'](-0x1);if(_0xec689e==='/')return _0x3942c8['substring'](0x0,_0x3942c8['lastIndexOf'](_0xec689e));return _0x3942c8;}function getWebApiUrl(_0x318762){return util[_0xa0a1('0x42')](_0xa0a1('0x43'),_0x318762);}exports[_0xa0a1('0x44')]=function(_0x1ff7f5,_0x429f4e){var _0x456b7f=_0x1ff7f5[_0xa0a1('0x1c')][_0xa0a1('0x45')];var _0x489e67=_0x456b7f===_0xa0a1('0x46')?_0xa0a1('0x47'):_0xa0a1('0x48');var _0x40e6d7='';var _0x24536a='';var _0x459ade='';var _0x511ad1='';var _0x3fb820='';var _0x4a0bde='';var _0x17a595='';var _0x157e6f='';var _0x306b70=[_0xa0a1('0x49'),'description',_0xa0a1('0x4a'),_0xa0a1('0x4b'),'caseorigincode',_0xa0a1('0x4c'),_0xa0a1('0x4d'),_0xa0a1('0x4e'),_0xa0a1('0x4f'),_0xa0a1('0x50')];var _0x13ab04=[_0xa0a1('0x51'),_0xa0a1('0x52'),_0xa0a1('0x53'),_0xa0a1('0x54'),'contactidname',_0xa0a1('0x55'),_0xa0a1('0x56'),_0xa0a1('0x57'),_0xa0a1('0x58'),'createdbyexternalpartyyominame',_0xa0a1('0x59'),_0xa0a1('0x5a'),'createdon',_0xa0a1('0x5b'),'createdonbehalfbyyominame',_0xa0a1('0x5c'),_0xa0a1('0x5d'),_0xa0a1('0x5e'),'emailaddress',_0xa0a1('0x5f'),_0xa0a1('0x60'),_0xa0a1('0x61'),_0xa0a1('0x62'),_0xa0a1('0x63'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore',_0xa0a1('0x64'),'lastonholdtime','masteridname',_0xa0a1('0x65'),_0xa0a1('0x66'),_0xa0a1('0x67'),_0xa0a1('0x68'),_0xa0a1('0x69'),_0xa0a1('0x6a'),_0xa0a1('0x6b'),'msdyn_incidenttypename',_0xa0a1('0x6c'),_0xa0a1('0x6d'),_0xa0a1('0x6e'),'overriddencreatedon',_0xa0a1('0x6f'),_0xa0a1('0x70'),_0xa0a1('0x71'),_0xa0a1('0x72'),_0xa0a1('0x73'),_0xa0a1('0x74'),_0xa0a1('0x75'),_0xa0a1('0x76'),_0xa0a1('0x77'),'resolveby',_0xa0a1('0x78'),_0xa0a1('0x79'),_0xa0a1('0x7a'),_0xa0a1('0x7b'),_0xa0a1('0x7c'),_0xa0a1('0x7d'),'slaname','socialprofileidname','statecode',_0xa0a1('0x7e'),_0xa0a1('0x7f'),_0xa0a1('0x80'),_0xa0a1('0x81'),_0xa0a1('0x82'),_0xa0a1('0x83'),_0xa0a1('0x84'),_0xa0a1('0x85')];var _0x23b3d8=_0x306b70[_0xa0a1('0x86')](_0x13ab04);return db['Dynamics365Account'][_0xa0a1('0x39')]({'where':{'id':_0x1ff7f5[_0xa0a1('0x32')]['id']},'attributes':['id',_0xa0a1('0x87'),_0xa0a1('0x88'),_0xa0a1('0x89'),'tenantId',_0xa0a1('0x8a'),_0xa0a1('0x8b'),_0xa0a1('0x8c')],'include':[{'model':db[_0xa0a1('0x8d')],'as':_0xa0a1('0x8d'),'attributes':['id','data5',_0xa0a1('0x8e')]}]})[_0xa0a1('0x10')](handleEntityNotFound(_0x429f4e,null))['then'](function(_0x157da4){if(_0x157da4){if(_0x157da4[_0xa0a1('0x8c')]){_0x157da4[_0xa0a1('0x8f')]=_0x157da4['CloudProvider'][_0xa0a1('0x90')];_0x157e6f=sanitizeRemoteUri(_0x157da4[_0xa0a1('0x8d')][_0xa0a1('0x8e')]);_0x17a595=getWebApiUrl(_0x157e6f);return _0x157da4;}_0x157e6f=sanitizeRemoteUri(_0x157da4['remoteUri']);_0x17a595=getWebApiUrl(_0x157e6f);var _0x29cc12={'method':_0xa0a1('0x91'),'uri':_0xa0a1('0x92')+_0x157da4['tenantId']+_0xa0a1('0x93'),'form':{'client_id':_0x157da4[_0xa0a1('0x8a')],'resource':_0x157e6f,'username':_0x157da4[_0xa0a1('0x87')],'password':_0x157da4[_0xa0a1('0x88')],'grant_type':_0xa0a1('0x88'),'client_secret':_0x157da4['clientSecret']},'json':!![]};return rp(_0x29cc12);}})[_0xa0a1('0x10')](function(_0x52dbae){_0x4a0bde=_0x52dbae[_0xa0a1('0x8f')];var _0x4f4624={'method':_0xa0a1('0x94'),'uri':encodeURI(_0x17a595+_0xa0a1('0x95')+_0x489e67+'\x27'),'headers':{'Authorization':_0xa0a1('0x96')+_0x4a0bde,'If-None-Match':null,'OData-Version':_0xa0a1('0x97')},'json':!![]};return rp(_0x4f4624);})['then'](function(_0x2b2ebb){var _0x58078d=_0x2b2ebb[_0xa0a1('0x98')][0x0];var _0x560bfd=_0x58078d[_0xa0a1('0x99')];var _0xf8ff83={'method':_0xa0a1('0x94'),'uri':_0x17a595+_0xa0a1('0x9a')+_0x560bfd+_0xa0a1('0x9b'),'headers':{'Authorization':_0xa0a1('0x96')+_0x4a0bde,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf8ff83);})[_0xa0a1('0x10')](function(_0x32040a){_0x40e6d7=_0x32040a;_0x24536a=_0x40e6d7[_0xa0a1('0x9c')];_0x24536a=_[_0xa0a1('0x9d')](_0x24536a,function(_0x1783b4){return!_0x23b3d8['includes'](_0x1783b4[_0xa0a1('0x9e')]);});var _0x5c1a45=[];var _0x4a88e0=[];_0x24536a[_0xa0a1('0x9f')](function(_0x1f8200){if(_0x1f8200['@odata.type']){var _0x98d97e=_0x1f8200[_0xa0a1('0xa0')][_0xa0a1('0xa1')](_0x1f8200[_0xa0a1('0xa0')][_0xa0a1('0xa2')]('.')+0x1);if(_0x98d97e==='PicklistAttributeMetadata'){_0x5c1a45[_0xa0a1('0xa3')](getSelectList(_0x17a595,_0x456b7f,_0x4a88e0,_0x40e6d7[_0xa0a1('0x99')],_0x1f8200[_0xa0a1('0x99')],_0x4a0bde));}}});return Promise['all'](_0x5c1a45);})['then'](function(_0x3e4d8e){_0x459ade=_0x3e4d8e[0x0];var _0x3cdb3a=[];var _0x59b76d=[];_0x24536a[_0xa0a1('0x9f')](function(_0x8ce1c){if(!_[_0xa0a1('0xa4')](_0x8ce1c[_0xa0a1('0xa0')])){var _0x8682be=_0x8ce1c[_0xa0a1('0xa0')][_0xa0a1('0xa1')](_0x8ce1c[_0xa0a1('0xa0')][_0xa0a1('0xa2')]('.')+0x1);if(_0x8682be==='BooleanAttributeMetadata'){_0x3cdb3a[_0xa0a1('0xa3')](getBooleanList(_0x17a595,_0x456b7f,_0x59b76d,_0x40e6d7['MetadataId'],_0x8ce1c[_0xa0a1('0x99')],_0x4a0bde));}}});return Promise[_0xa0a1('0xa5')](_0x3cdb3a);})[_0xa0a1('0x10')](function(_0x1beb49){_0x511ad1=_0x1beb49[0x0];var _0x11f31c=[];var _0x13a9dc=[];_0x24536a[_0xa0a1('0x9f')](function(_0x303e96){if(_0x303e96[_0xa0a1('0xa0')]){var _0x14579a=_0x303e96[_0xa0a1('0xa0')]['substring'](_0x303e96[_0xa0a1('0xa0')]['lastIndexOf']('.')+0x1);if(_0x14579a===_0xa0a1('0xa6')||_0x14579a===_0xa0a1('0xa7')||_0x14579a===_0xa0a1('0xa8')||_0x14579a==='IntegerAttributeMetadata'||_0x14579a===_0xa0a1('0xa9')||_0x14579a===_0xa0a1('0xaa')||_0x14579a===_0xa0a1('0xab')||_0x14579a==='EntityNameAttributeMetadata'||_0x14579a==='StateAttributeMetadata'||_0x14579a==='DecimalAttributeMetadata'){_0x11f31c[_0xa0a1('0xa3')](getInputList(_0x17a595,_0x456b7f,_0x14579a,_0x13a9dc,_0x40e6d7[_0xa0a1('0x99')],_0x303e96['MetadataId'],_0x4a0bde));}}});return Promise[_0xa0a1('0xa5')](_0x11f31c);})[_0xa0a1('0x10')](function(_0xe33559){_0x3fb820=_0xe33559[0x0];var _0x38319f=_0x459ade[_0xa0a1('0x86')](_0x511ad1)[_0xa0a1('0x86')](_0x3fb820);var _0x5e50b0={'count':_0x38319f['length'],'rows':_0x38319f};return _0x5e50b0;})[_0xa0a1('0x10')](respondWithResult(_0x429f4e,null))[_0xa0a1('0x31')](function(_0x5eac0f){var _0x214577=_0x1ff7f5[_0xa0a1('0x1c')][_0xa0a1('0xac')]?0x1f4:_0x5eac0f[_0xa0a1('0xad')]||0x1f4;logger[_0xa0a1('0x14')](_0x5eac0f['stack']);delete _0x5eac0f['name'];if(_0x214577===0x191){_0x214577=0x190;}_0x429f4e[_0xa0a1('0x8')](_0x214577)[_0xa0a1('0x16')](_0x1ff7f5[_0xa0a1('0x1c')][_0xa0a1('0xac')]?{'message':_0xa0a1('0xae'),'statusCode':_0x5eac0f['statusCode']}:_0x5eac0f);});};function getSelectList(_0xaa7ca,_0x51e855,_0xc47f55,_0x5c0c54,_0x435b76,_0x454d03){var _0x1109d7={'method':_0xa0a1('0x94'),'uri':_0xaa7ca+_0xa0a1('0x9a')+_0x5c0c54+')/Attributes('+_0x435b76+_0xa0a1('0xaf')+_0xa0a1('0xb0'),'headers':{'Authorization':_0xa0a1('0x96')+_0x454d03,'If-None-Match':null,'OData-Version':_0xa0a1('0x97')},'json':!![]};return rp(_0x1109d7)[_0xa0a1('0x10')](function(_0x58dfed){var _0x4bf09=[];var _0x225ac0=_0x58dfed[_0xa0a1('0xb1')][_0xa0a1('0xb2')];_0x225ac0[_0xa0a1('0x9f')](function(_0xc16153){_0x4bf09[_0xa0a1('0xa3')]({'name':_0xc16153[_0xa0a1('0xb3')][_0xa0a1('0xb4')][_0xa0a1('0xb3')],'value':String(_0xc16153['Value'])});});var _0x4274ef={'id':_0x51e855+'_'+_0x58dfed['LogicalName'],'name':_0x58dfed[_0xa0a1('0xb5')][_0xa0a1('0xb4')][_0xa0a1('0xb3')],'custom':![],'options':_0x4bf09};_0xc47f55[_0xa0a1('0xa3')](_0x4274ef);return _0xc47f55;});}function getBooleanList(_0x323833,_0x40a573,_0x37bb43,_0x3e0467,_0x13102d,_0x53c096){var _0x2e11e4={'method':_0xa0a1('0x94'),'uri':_0x323833+'EntityDefinitions('+_0x3e0467+_0xa0a1('0xb6')+_0x13102d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xa0a1('0x96')+_0x53c096,'If-None-Match':null,'OData-Version':_0xa0a1('0x97')},'json':!![]};return rp(_0x2e11e4)[_0xa0a1('0x10')](function(_0x3a8535){var _0x11594d=[];_0x11594d['push']({'name':_0x3a8535['OptionSet']['TrueOption'][_0xa0a1('0xb3')][_0xa0a1('0xb4')][_0xa0a1('0xb3')],'value':_0xa0a1('0xb7')},{'name':_0x3a8535[_0xa0a1('0xb1')][_0xa0a1('0xb8')][_0xa0a1('0xb3')][_0xa0a1('0xb4')][_0xa0a1('0xb3')],'value':_0xa0a1('0xb9')});var _0x41a633={'id':_0x40a573+'_'+_0x3a8535[_0xa0a1('0x9e')],'name':_0x3a8535['DisplayName'][_0xa0a1('0xb4')][_0xa0a1('0xb3')],'custom':![],'options':_0x11594d};_0x37bb43['push'](_0x41a633);return _0x37bb43;});}function getInputList(_0x2d2418,_0x468a83,_0x573257,_0x250968,_0x7bc9df,_0x5e1caa,_0x3fae36){var _0x1960ac={'method':_0xa0a1('0x94'),'uri':_0x2d2418+_0xa0a1('0x9a')+_0x7bc9df+_0xa0a1('0xb6')+_0x5e1caa+_0xa0a1('0xba')+_0x573257+_0xa0a1('0xbb'),'headers':{'Authorization':_0xa0a1('0x96')+_0x3fae36,'If-None-Match':null,'OData-Version':_0xa0a1('0x97')},'json':!![]};return rp(_0x1960ac)['then'](function(_0x2fcb5b){var _0x5b7706={'id':_0x468a83+'_'+_0x2fcb5b[_0xa0a1('0x9e')],'name':_0x2fcb5b[_0xa0a1('0xb5')][_0xa0a1('0xb4')]?_0x2fcb5b['DisplayName'][_0xa0a1('0xb4')]['Label']:_0x2fcb5b[_0xa0a1('0x9e')],'custom':![],'options':[]};_0x250968[_0xa0a1('0xa3')](_0x5b7706);return _0x250968;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 71a70a8..71e69fc 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(_0xf89afd,_0x5aa9db){var _0x3ffda6=function(_0x545b0d){while(--_0x545b0d){_0xf89afd['push'](_0xf89afd['shift']());}};_0x3ffda6(++_0x5aa9db);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xcb91[_0x5cb97e];return _0x1714b4;};'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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x1b3ada,_0x57e70e){var _0x419fa9=function(_0x12e938){while(--_0x12e938){_0x1b3ada['push'](_0x1b3ada['shift']());}};_0x419fa9(++_0x57e70e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb7e7[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 2798fdc..9387e3e 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 _0x0a66=['lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Dynamics365Account','options','where','attributes','limit','include','map','model','GetDynamics365Account','debug','ShowDynamics365Account','find'];(function(_0x58112f,_0x25fb5e){var _0xf53c38=function(_0x4cd3e0){while(--_0x4cd3e0){_0x58112f['push'](_0x58112f['shift']());}};_0xf53c38(++_0x25fb5e);}(_0x0a66,0x80));var _0x60a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0a66[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x60a6('0x0'));var util=require(_0x60a6('0x1'));var moment=require(_0x60a6('0x2'));var BPromise=require(_0x60a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60a6('0x5'));var config=require(_0x60a6('0x6'));var jayson=require(_0x60a6('0x7'));var client=jayson['client'][_0x60a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4caea6,_0x1d6ad2,_0x38d47f){return new BPromise(function(_0x1a030e,_0x2c4f1a){return client[_0x60a6('0x9')](_0x4caea6,_0x38d47f)[_0x60a6('0xa')](function(_0x517bf8){logger[_0x60a6('0xb')](_0x60a6('0xc'),_0x1d6ad2,_0x60a6('0xd'));logger['debug'](_0x60a6('0xe'),_0x1d6ad2,_0x60a6('0xd'),JSON['stringify'](_0x517bf8));if(_0x517bf8[_0x60a6('0xf')]){if(_0x517bf8['error'][_0x60a6('0x10')]===0x1f4){logger['error'](_0x60a6('0xc'),_0x1d6ad2,_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);return _0x2c4f1a(_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1d6ad2,_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);return _0x1a030e(_0x517bf8[_0x60a6('0xf')][_0x60a6('0x11')]);}else{logger[_0x60a6('0xb')](_0x60a6('0xc'),_0x1d6ad2,_0x60a6('0xd'));_0x1a030e(_0x517bf8[_0x60a6('0x12')][_0x60a6('0x11')]);}})[_0x60a6('0x13')](function(_0x343741){logger[_0x60a6('0xf')](_0x60a6('0xc'),_0x1d6ad2,_0x343741);_0x2c4f1a(_0x343741);});});}exports['GetDynamics365Account']=function(_0x329e68){var _0x4ef82a=this;return new Promise(function(_0x5cffa1,_0xabf102){return db[_0x60a6('0x14')]['findAll']({'raw':_0x329e68[_0x60a6('0x15')]?_0x329e68[_0x60a6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x329e68['options']?_0x329e68[_0x60a6('0x15')][_0x60a6('0x16')]||null:null,'attributes':_0x329e68[_0x60a6('0x15')]?_0x329e68[_0x60a6('0x15')][_0x60a6('0x17')]||null:null,'limit':_0x329e68[_0x60a6('0x15')]?_0x329e68['options'][_0x60a6('0x18')]||null:null,'include':_0x329e68[_0x60a6('0x15')]?_0x329e68['options'][_0x60a6('0x19')]?_[_0x60a6('0x1a')](_0x329e68[_0x60a6('0x15')][_0x60a6('0x19')],function(_0x34b049){return{'model':db[_0x34b049[_0x60a6('0x1b')]],'as':_0x34b049['as'],'attributes':_0x34b049['attributes'],'include':_0x34b049[_0x60a6('0x19')]?_[_0x60a6('0x1a')](_0x34b049[_0x60a6('0x19')],function(_0xb63008){return{'model':db[_0xb63008[_0x60a6('0x1b')]],'as':_0xb63008['as'],'attributes':_0xb63008['attributes'],'include':_0xb63008[_0x60a6('0x19')]?_[_0x60a6('0x1a')](_0xb63008[_0x60a6('0x19')],function(_0x811cb9){return{'model':db[_0x811cb9[_0x60a6('0x1b')]],'as':_0x811cb9['as'],'attributes':_0x811cb9[_0x60a6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x60a6('0xa')](function(_0x43edf9){logger['info'](_0x60a6('0x1c'),_0x329e68);logger[_0x60a6('0x1d')](_0x60a6('0x1c'),_0x329e68,JSON['stringify'](_0x43edf9));_0x5cffa1(_0x43edf9);})[_0x60a6('0x13')](function(_0x463bcf){logger[_0x60a6('0xf')]('GetDynamics365Account',_0x463bcf[_0x60a6('0x11')],_0x329e68);_0xabf102(_0x4ef82a[_0x60a6('0xf')](0x1f4,_0x463bcf[_0x60a6('0x11')]));});});};exports[_0x60a6('0x1e')]=function(_0x4cbe86){var _0xe0c755=this;return new Promise(function(_0x1043fc,_0x194b8a){return db['Dynamics365Account'][_0x60a6('0x1f')]({'raw':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')]['where']||null:null,'attributes':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')][_0x60a6('0x17')]||null:null,'include':_0x4cbe86[_0x60a6('0x15')]?_0x4cbe86[_0x60a6('0x15')][_0x60a6('0x19')]?_['map'](_0x4cbe86[_0x60a6('0x15')][_0x60a6('0x19')],function(_0x33b531){return{'model':db[_0x33b531[_0x60a6('0x1b')]],'as':_0x33b531['as'],'attributes':_0x33b531[_0x60a6('0x17')],'include':_0x33b531['include']?_[_0x60a6('0x1a')](_0x33b531[_0x60a6('0x19')],function(_0x2d1dfd){return{'model':db[_0x2d1dfd[_0x60a6('0x1b')]],'as':_0x2d1dfd['as'],'attributes':_0x2d1dfd['attributes'],'include':_0x2d1dfd['include']?_[_0x60a6('0x1a')](_0x2d1dfd[_0x60a6('0x19')],function(_0x5444ef){return{'model':db[_0x5444ef['model']],'as':_0x5444ef['as'],'attributes':_0x5444ef[_0x60a6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x60a6('0xa')](function(_0x49f861){logger[_0x60a6('0xb')](_0x60a6('0x1e'),_0x4cbe86);logger[_0x60a6('0x1d')](_0x60a6('0x1e'),_0x4cbe86,JSON['stringify'](_0x49f861));_0x1043fc(_0x49f861);})[_0x60a6('0x13')](function(_0xe43769){logger[_0x60a6('0xf')]('ShowDynamics365Account',_0xe43769[_0x60a6('0x11')],_0x4cbe86);_0x194b8a(_0xe0c755[_0x60a6('0xf')](0x1f4,_0xe43769[_0x60a6('0x11')]));});});}; \ No newline at end of file +var _0x3cfb=['attributes','include','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','options','raw','limit','map','model'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3cfb,0x88));var _0xb3cf=function(_0x375ed5,_0x49666c){_0x375ed5=_0x375ed5-0x0;var _0x4670e2=_0x3cfb[_0x375ed5];return _0x4670e2;};'use strict';var _=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3cf('0x3'));var fs=require('fs');var Redis=require(_0xb3cf('0x4'));var db=require(_0xb3cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3cf('0x6'))(_0xb3cf('0x7'));var config=require(_0xb3cf('0x8'));var jayson=require(_0xb3cf('0x9'));var client=jayson[_0xb3cf('0xa')][_0xb3cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11cb8,_0x198c79,_0x250571){return new BPromise(function(_0x5eb976,_0x2fb997){return client[_0xb3cf('0xc')](_0x11cb8,_0x250571)['then'](function(_0x2f3377){logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x198c79,_0xb3cf('0xf'));logger[_0xb3cf('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x198c79,_0xb3cf('0xf'),JSON[_0xb3cf('0x11')](_0x2f3377));if(_0x2f3377[_0xb3cf('0x12')]){if(_0x2f3377['error'][_0xb3cf('0x13')]===0x1f4){logger[_0xb3cf('0x12')](_0xb3cf('0xe'),_0x198c79,_0x2f3377[_0xb3cf('0x12')]['message']);return _0x2fb997(_0x2f3377[_0xb3cf('0x12')][_0xb3cf('0x14')]);}logger[_0xb3cf('0x12')](_0xb3cf('0xe'),_0x198c79,_0x2f3377[_0xb3cf('0x12')][_0xb3cf('0x14')]);return _0x5eb976(_0x2f3377[_0xb3cf('0x12')][_0xb3cf('0x14')]);}else{logger['info'](_0xb3cf('0xe'),_0x198c79,_0xb3cf('0xf'));_0x5eb976(_0x2f3377['result']['message']);}})[_0xb3cf('0x15')](function(_0x105257){logger[_0xb3cf('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x198c79,_0x105257);_0x2fb997(_0x105257);});});}exports[_0xb3cf('0x16')]=function(_0x5cad70){var _0x5902c4=this;return new Promise(function(_0x22d755,_0x48f0c5){return db[_0xb3cf('0x17')]['findAll']({'raw':_0x5cad70[_0xb3cf('0x18')]?_0x5cad70[_0xb3cf('0x18')][_0xb3cf('0x19')]===undefined?!![]:![]:!![],'where':_0x5cad70['options']?_0x5cad70[_0xb3cf('0x18')]['where']||null:null,'attributes':_0x5cad70[_0xb3cf('0x18')]?_0x5cad70[_0xb3cf('0x18')]['attributes']||null:null,'limit':_0x5cad70[_0xb3cf('0x18')]?_0x5cad70[_0xb3cf('0x18')][_0xb3cf('0x1a')]||null:null,'include':_0x5cad70[_0xb3cf('0x18')]?_0x5cad70[_0xb3cf('0x18')]['include']?_[_0xb3cf('0x1b')](_0x5cad70[_0xb3cf('0x18')]['include'],function(_0x4e486e){return{'model':db[_0x4e486e[_0xb3cf('0x1c')]],'as':_0x4e486e['as'],'attributes':_0x4e486e[_0xb3cf('0x1d')],'include':_0x4e486e[_0xb3cf('0x1e')]?_[_0xb3cf('0x1b')](_0x4e486e[_0xb3cf('0x1e')],function(_0x4de845){return{'model':db[_0x4de845[_0xb3cf('0x1c')]],'as':_0x4de845['as'],'attributes':_0x4de845[_0xb3cf('0x1d')],'include':_0x4de845[_0xb3cf('0x1e')]?_['map'](_0x4de845[_0xb3cf('0x1e')],function(_0x2bf0fa){return{'model':db[_0x2bf0fa[_0xb3cf('0x1c')]],'as':_0x2bf0fa['as'],'attributes':_0x2bf0fa[_0xb3cf('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9380){logger['info'](_0xb3cf('0x16'),_0x5cad70);logger[_0xb3cf('0x10')]('GetDynamics365Account',_0x5cad70,JSON[_0xb3cf('0x11')](_0x5e9380));_0x22d755(_0x5e9380);})[_0xb3cf('0x15')](function(_0x3e2f72){logger[_0xb3cf('0x12')]('GetDynamics365Account',_0x3e2f72[_0xb3cf('0x14')],_0x5cad70);_0x48f0c5(_0x5902c4[_0xb3cf('0x12')](0x1f4,_0x3e2f72['message']));});});};exports[_0xb3cf('0x1f')]=function(_0x27f9b2){var _0x1d0391=this;return new Promise(function(_0xa93548,_0xfda961){return db[_0xb3cf('0x17')][_0xb3cf('0x20')]({'raw':_0x27f9b2['options']?_0x27f9b2[_0xb3cf('0x18')][_0xb3cf('0x19')]===undefined?!![]:![]:!![],'where':_0x27f9b2[_0xb3cf('0x18')]?_0x27f9b2[_0xb3cf('0x18')]['where']||null:null,'attributes':_0x27f9b2[_0xb3cf('0x18')]?_0x27f9b2[_0xb3cf('0x18')]['attributes']||null:null,'include':_0x27f9b2[_0xb3cf('0x18')]?_0x27f9b2[_0xb3cf('0x18')][_0xb3cf('0x1e')]?_[_0xb3cf('0x1b')](_0x27f9b2['options'][_0xb3cf('0x1e')],function(_0x2c76cc){return{'model':db[_0x2c76cc['model']],'as':_0x2c76cc['as'],'attributes':_0x2c76cc['attributes'],'include':_0x2c76cc[_0xb3cf('0x1e')]?_[_0xb3cf('0x1b')](_0x2c76cc['include'],function(_0x552d4f){return{'model':db[_0x552d4f[_0xb3cf('0x1c')]],'as':_0x552d4f['as'],'attributes':_0x552d4f[_0xb3cf('0x1d')],'include':_0x552d4f[_0xb3cf('0x1e')]?_[_0xb3cf('0x1b')](_0x552d4f['include'],function(_0x46219d){return{'model':db[_0x46219d['model']],'as':_0x46219d['as'],'attributes':_0x46219d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d8b94){logger['info'](_0xb3cf('0x1f'),_0x27f9b2);logger[_0xb3cf('0x10')]('ShowDynamics365Account',_0x27f9b2,JSON['stringify'](_0x5d8b94));_0xa93548(_0x5d8b94);})[_0xb3cf('0x15')](function(_0x3e2693){logger['error'](_0xb3cf('0x1f'),_0x3e2693[_0xb3cf('0x14')],_0x27f9b2);_0xfda961(_0x1d0391[_0xb3cf('0x12')](0x1f4,_0x3e2693[_0xb3cf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0fd47e3..3a2ceec 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 _0x5eb8=['exports','path','connect-timeout','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','/:id/descriptions','getDescriptions','post','create','put','destroy'];(function(_0x5c9adf,_0x1ecf60){var _0x477fa8=function(_0xf4d13b){while(--_0xf4d13b){_0x5c9adf['push'](_0x5c9adf['shift']());}};_0x477fa8(++_0x1ecf60);}(_0x5eb8,0xb0));var _0x85eb=function(_0x237bf7,_0xb851fc){_0x237bf7=_0x237bf7-0x0;var _0x5928ba=_0x5eb8[_0x237bf7];return _0x5928ba;};'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('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x16')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['update']);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);module[_0x85eb('0x18')]=router; \ No newline at end of file +var _0x7bee=['/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2c7924,_0x147bbe){var _0x559c88=function(_0x121c4d){while(--_0x121c4d){_0x2c7924['push'](_0x2c7924['shift']());}};_0x559c88(++_0x147bbe);}(_0x7bee,0x168));var _0xe7be=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7bee[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xe7be('0x0'));var util=require(_0xe7be('0x1'));var path=require(_0xe7be('0x2'));var timeout=require(_0xe7be('0x3'));var express=require(_0xe7be('0x4'));var router=express[_0xe7be('0x5')]();var fs_extra=require(_0xe7be('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe7be('0x7'));var controller=require(_0xe7be('0x8'));router[_0xe7be('0x9')]('/',auth[_0xe7be('0xa')](),controller[_0xe7be('0xb')]);router[_0xe7be('0x9')](_0xe7be('0xc'),auth[_0xe7be('0xa')](),controller[_0xe7be('0xd')]);router[_0xe7be('0x9')](_0xe7be('0xe'),auth[_0xe7be('0xa')](),controller['getFields']);router[_0xe7be('0x9')](_0xe7be('0xf'),auth[_0xe7be('0xa')](),controller['getSubjects']);router[_0xe7be('0x9')](_0xe7be('0x10'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x11')]);router['post']('/',auth[_0xe7be('0xa')](),controller['create']);router[_0xe7be('0x12')](_0xe7be('0xc'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x13')]);router['delete'](_0xe7be('0xc'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x14')]);module[_0xe7be('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 33a745e..74f79d8 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 _0xf1ae=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x2d63ae,_0x2464bf){var _0xd22295=function(_0x46bf40){while(--_0x46bf40){_0x2d63ae['push'](_0x2d63ae['shift']());}};_0xd22295(++_0x2464bf);}(_0xf1ae,0xcd));var _0xef1a=function(_0x49f7f1,_0x168387){_0x49f7f1=_0x49f7f1-0x0;var _0x22ba5f=_0xf1ae[_0x49f7f1];return _0x22ba5f;};'use strict';var Sequelize=require(_0xef1a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef1a('0x1')]},'ticketType':{'type':Sequelize[_0xef1a('0x2')](_0xef1a('0x3'),_0xef1a('0x4')),'defaultValue':_0xef1a('0x3')},'moduleCreate':{'type':Sequelize[_0xef1a('0x2')](_0xef1a('0x5'),_0xef1a('0x6')),'defaultValue':_0xef1a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xef1a('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7eb7=['ENUM','incident','contact','nothing','BOOLEAN','STRING'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x7eb7,0xef));var _0x77eb=function(_0x37d960,_0x136c09){_0x37d960=_0x37d960-0x0;var _0x75c969=_0x7eb7[_0x37d960];return _0x75c969;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x77eb('0x0')]},'description':{'type':Sequelize[_0x77eb('0x0')]},'ticketType':{'type':Sequelize[_0x77eb('0x1')](_0x77eb('0x2'),'phonecall'),'defaultValue':_0x77eb('0x2')},'moduleCreate':{'type':Sequelize[_0x77eb('0x1')](_0x77eb('0x3'),_0x77eb('0x4')),'defaultValue':_0x77eb('0x3'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x77eb('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c90a356..e9ffae6 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 _0x4058=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','order','getFields','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x7d324f,_0x33cd55){var _0x4c54db=function(_0xf6a52c){while(--_0xf6a52c){_0x7d324f['push'](_0x7d324f['shift']());}};_0x4c54db(++_0x33cd55);}(_0x4058,0x9b));var _0x8405=function(_0x32aeac,_0x385aba){_0x32aeac=_0x32aeac-0x0;var _0x17b5a6=_0x4058[_0x32aeac];return _0x17b5a6;};'use strict';var emlformat=require(_0x8405('0x0'));var rimraf=require(_0x8405('0x1'));var zipdir=require(_0x8405('0x2'));var jsonpatch=require(_0x8405('0x3'));var rp=require('request-promise');var moment=require(_0x8405('0x4'));var BPromise=require(_0x8405('0x5'));var Mustache=require(_0x8405('0x6'));var util=require(_0x8405('0x7'));var path=require(_0x8405('0x8'));var sox=require(_0x8405('0x9'));var csv=require(_0x8405('0xa'));var ejs=require(_0x8405('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8405('0xc'));var squel=require(_0x8405('0xd'));var crypto=require('crypto');var jsforce=require(_0x8405('0xe'));var deskjs=require(_0x8405('0xf'));var toCsv=require(_0x8405('0xa'));var querystring=require(_0x8405('0x10'));var Papa=require(_0x8405('0x11'));var Redis=require(_0x8405('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x14'))('api');var utils=require(_0x8405('0x15'));var config=require(_0x8405('0x16'));var licenseUtil=require(_0x8405('0x17'));var db=require(_0x8405('0x18'))['db'];function respondWithStatusCode(_0x239ada,_0x2df92f){_0x2df92f=_0x2df92f||0xcc;return function(_0x45a658){if(_0x45a658){return _0x239ada[_0x8405('0x19')](_0x2df92f);}return _0x239ada[_0x8405('0x1a')](_0x2df92f)[_0x8405('0x1b')]();};}function respondWithResult(_0x453784,_0x2589ec){_0x2589ec=_0x2589ec||0xc8;return function(_0x36a760){if(_0x36a760){return _0x453784[_0x8405('0x1a')](_0x2589ec)['json'](_0x36a760);}};}function respondWithFilteredResult(_0x3a73d5,_0x176e98){return function(_0x17d8ab){if(_0x17d8ab){var _0x584599=typeof _0x176e98[_0x8405('0x1c')]===_0x8405('0x1d')&&typeof _0x176e98[_0x8405('0x1e')]===_0x8405('0x1d');var _0x4ef0df=_0x17d8ab[_0x8405('0x1f')];var _0x2d32d7=_0x584599?0x0:_0x176e98[_0x8405('0x1c')];var _0x385ccb=_0x584599?_0x17d8ab[_0x8405('0x1f')]:_0x176e98[_0x8405('0x1c')]+_0x176e98[_0x8405('0x1e')];var _0x132a8d;if(_0x385ccb>=_0x4ef0df){_0x385ccb=_0x4ef0df;_0x132a8d=0xc8;}else{_0x132a8d=0xce;}_0x3a73d5[_0x8405('0x1a')](_0x132a8d);return _0x3a73d5[_0x8405('0x20')](_0x8405('0x21'),_0x2d32d7+'-'+_0x385ccb+'/'+_0x4ef0df)['json'](_0x17d8ab);}return null;};}function patchUpdates(_0x1a03d1){return function(_0x2262d9){try{jsonpatch[_0x8405('0x22')](_0x2262d9,_0x1a03d1,!![]);}catch(_0x31f7cf){return BPromise[_0x8405('0x23')](_0x31f7cf);}return _0x2262d9[_0x8405('0x24')]();};}function saveUpdates(_0x476f76,_0x2cb5ec){return function(_0x492b06){if(_0x492b06){return _0x492b06[_0x8405('0x25')](_0x476f76)[_0x8405('0x26')](function(_0x4badb8){return _0x4badb8;});}return null;};}function removeEntity(_0x5ce42c,_0x4794fe){return function(_0x1d8216){if(_0x1d8216){return _0x1d8216[_0x8405('0x27')]()[_0x8405('0x26')](function(){_0x5ce42c[_0x8405('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2204f2,_0x1d512c){return function(_0x6b0fd5){if(!_0x6b0fd5){_0x2204f2[_0x8405('0x19')](0x194);}return _0x6b0fd5;};}function handleError(_0x23592f,_0x2cf279){_0x2cf279=_0x2cf279||0x1f4;return function(_0x4e6f5d){logger[_0x8405('0x28')](_0x4e6f5d['stack']);if(_0x4e6f5d[_0x8405('0x29')]){delete _0x4e6f5d[_0x8405('0x29')];}_0x23592f['status'](_0x2cf279)[_0x8405('0x2a')](_0x4e6f5d);};}exports[_0x8405('0x2b')]=function(_0x4f3c4d,_0x128d0c){var _0x360a6a={},_0x2e36a9={},_0x5f110e={'count':0x0,'rows':[]};var _0x16328c=_[_0x8405('0x2c')](db[_0x8405('0x2d')][_0x8405('0x2e')],function(_0x47979c){return{'name':_0x47979c[_0x8405('0x2f')],'type':_0x47979c[_0x8405('0x30')][_0x8405('0x31')]};});_0x2e36a9[_0x8405('0x32')]=_['map'](_0x16328c,'name');_0x2e36a9[_0x8405('0x33')]=_['keys'](_0x4f3c4d[_0x8405('0x33')]);_0x2e36a9[_0x8405('0x34')]=_[_0x8405('0x35')](_0x2e36a9[_0x8405('0x32')],_0x2e36a9[_0x8405('0x33')]);_0x360a6a[_0x8405('0x36')]=_[_0x8405('0x35')](_0x2e36a9[_0x8405('0x32')],qs[_0x8405('0x37')](_0x4f3c4d['query'][_0x8405('0x37')]));_0x360a6a[_0x8405('0x36')]=_0x360a6a[_0x8405('0x36')][_0x8405('0x38')]?_0x360a6a[_0x8405('0x36')]:_0x2e36a9[_0x8405('0x32')];if(!_0x4f3c4d[_0x8405('0x33')]['hasOwnProperty'](_0x8405('0x39'))){_0x360a6a[_0x8405('0x1e')]=qs[_0x8405('0x1e')](_0x4f3c4d[_0x8405('0x33')][_0x8405('0x1e')]);_0x360a6a[_0x8405('0x1c')]=qs[_0x8405('0x1c')](_0x4f3c4d['query'][_0x8405('0x1c')]);}_0x360a6a['order']=qs['sort'](_0x4f3c4d['query'][_0x8405('0x3a')]);_0x360a6a[_0x8405('0x3b')]=qs[_0x8405('0x34')](_[_0x8405('0x3c')](_0x4f3c4d['query'],_0x2e36a9[_0x8405('0x34')]),_0x16328c);if(_0x4f3c4d['query'][_0x8405('0x3d')]){_0x360a6a[_0x8405('0x3b')]=_['merge'](_0x360a6a['where'],{'$or':_[_0x8405('0x2c')](_0x16328c,function(_0xea7098){if(_0xea7098[_0x8405('0x30')]!==_0x8405('0x3e')){var _0x373c08={};_0x373c08[_0xea7098[_0x8405('0x29')]]={'$like':'%'+_0x4f3c4d[_0x8405('0x33')][_0x8405('0x3d')]+'%'};return _0x373c08;}})});}_0x360a6a=_[_0x8405('0x3f')]({},_0x360a6a,_0x4f3c4d[_0x8405('0x40')]);var _0x2ac302={'where':_0x360a6a[_0x8405('0x3b')]};return db[_0x8405('0x2d')][_0x8405('0x1f')](_0x2ac302)['then'](function(_0xe79b3b){_0x5f110e['count']=_0xe79b3b;if(_0x4f3c4d[_0x8405('0x33')][_0x8405('0x41')]){_0x360a6a[_0x8405('0x42')]=[{'all':!![]}];}return db[_0x8405('0x2d')]['findAll'](_0x360a6a);})[_0x8405('0x26')](function(_0x499eb5){_0x5f110e[_0x8405('0x43')]=_0x499eb5;return _0x5f110e;})[_0x8405('0x26')](respondWithFilteredResult(_0x128d0c,_0x360a6a))[_0x8405('0x44')](handleError(_0x128d0c,null));};exports[_0x8405('0x45')]=function(_0xabf5d3,_0x1de5e9){var _0x459fbf={'raw':![],'where':{'id':_0xabf5d3[_0x8405('0x46')]['id']}},_0x4433ce={};_0x4433ce['model']=_[_0x8405('0x47')](db['Dynamics365Configuration']['rawAttributes']);_0x4433ce[_0x8405('0x33')]=_['keys'](_0xabf5d3[_0x8405('0x33')]);_0x4433ce[_0x8405('0x34')]=_[_0x8405('0x35')](_0x4433ce['model'],_0x4433ce[_0x8405('0x33')]);_0x459fbf[_0x8405('0x36')]=_[_0x8405('0x35')](_0x4433ce[_0x8405('0x32')],qs[_0x8405('0x37')](_0xabf5d3[_0x8405('0x33')][_0x8405('0x37')]));_0x459fbf[_0x8405('0x36')]=_0x459fbf[_0x8405('0x36')][_0x8405('0x38')]?_0x459fbf['attributes']:_0x4433ce['model'];if(_0xabf5d3[_0x8405('0x33')]['includeAll']){_0x459fbf[_0x8405('0x42')]=[{'all':!![]}];}_0x459fbf=_['merge']({},_0x459fbf,_0xabf5d3[_0x8405('0x40')]);return db['Dynamics365Configuration'][_0x8405('0x48')](_0x459fbf)[_0x8405('0x26')](handleEntityNotFound(_0x1de5e9,null))['then'](respondWithResult(_0x1de5e9,null))['catch'](handleError(_0x1de5e9,null));};exports[_0x8405('0x49')]=function(_0x14383e,_0x3b4203){return db[_0x8405('0x2d')][_0x8405('0x49')](_0x14383e[_0x8405('0x4a')],{})['then'](respondWithResult(_0x3b4203,0xc9))[_0x8405('0x44')](handleError(_0x3b4203,null));};exports[_0x8405('0x25')]=function(_0x4fb0eb,_0x803de4){if(_0x4fb0eb[_0x8405('0x4a')]['id']){delete _0x4fb0eb[_0x8405('0x4a')]['id'];}return db[_0x8405('0x2d')][_0x8405('0x48')]({'where':{'id':_0x4fb0eb[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0x803de4,null))[_0x8405('0x26')](saveUpdates(_0x4fb0eb[_0x8405('0x4a')],null))[_0x8405('0x26')](respondWithResult(_0x803de4,null))[_0x8405('0x44')](handleError(_0x803de4,null));};exports[_0x8405('0x27')]=function(_0x5f5711,_0x315498){return db[_0x8405('0x2d')][_0x8405('0x48')]({'where':{'id':_0x5f5711[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0x315498,null))[_0x8405('0x26')](removeEntity(_0x315498,null))[_0x8405('0x44')](handleError(_0x315498,null));};exports['getFields']=function(_0x556afc,_0xa1a12f,_0x1c632b){var _0x3b145f={};var _0x4f2c42={};var _0xb0e87b;var _0x19cc96;return db[_0x8405('0x2d')][_0x8405('0x4b')]({'where':{'id':_0x556afc[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0xa1a12f,null))[_0x8405('0x26')](function(_0x36312a){if(_0x36312a){_0xb0e87b=_0x36312a;_0x4f2c42[_0x8405('0x32')]=_[_0x8405('0x47')](db['Dynamics365Field'][_0x8405('0x2e')]);_0x4f2c42['query']=_[_0x8405('0x47')](_0x556afc[_0x8405('0x33')]);_0x4f2c42['filters']=_['intersection'](_0x4f2c42[_0x8405('0x32')],_0x4f2c42[_0x8405('0x33')]);_0x3b145f[_0x8405('0x36')]=_[_0x8405('0x35')](_0x4f2c42[_0x8405('0x32')],qs[_0x8405('0x37')](_0x556afc['query'][_0x8405('0x37')]));_0x3b145f[_0x8405('0x36')]=_0x3b145f[_0x8405('0x36')][_0x8405('0x38')]?_0x3b145f['attributes']:_0x4f2c42[_0x8405('0x32')];_0x3b145f[_0x8405('0x4c')]=qs[_0x8405('0x3a')](_0x556afc[_0x8405('0x33')][_0x8405('0x3a')]);_0x3b145f['where']=qs[_0x8405('0x34')](_[_0x8405('0x3c')](_0x556afc[_0x8405('0x33')],_0x4f2c42[_0x8405('0x34')]));if(_0x556afc['query'][_0x8405('0x3d')]){_0x3b145f[_0x8405('0x3b')]=_[_0x8405('0x3f')](_0x3b145f[_0x8405('0x3b')],{'$or':_['map'](_0x3b145f[_0x8405('0x36')],function(_0x5c294d){var _0x3738a8={};_0x3738a8[_0x5c294d]={'$like':'%'+_0x556afc['query']['filter']+'%'};return _0x3738a8;})});}_0x3b145f=_[_0x8405('0x3f')]({},_0x3b145f,_0x556afc[_0x8405('0x40')]);return _0xb0e87b[_0x8405('0x4d')](_0x3b145f);}})[_0x8405('0x26')](function(_0x326be6){if(_0x326be6){_0x19cc96=_0x326be6[_0x8405('0x38')];if(!_0x556afc['query'][_0x8405('0x4e')](_0x8405('0x39'))){_0x3b145f[_0x8405('0x1e')]=qs[_0x8405('0x1e')](_0x556afc[_0x8405('0x33')][_0x8405('0x1e')]);_0x3b145f['offset']=qs[_0x8405('0x1c')](_0x556afc['query'][_0x8405('0x1c')]);}return _0xb0e87b[_0x8405('0x4d')](_0x3b145f);}})[_0x8405('0x26')](function(_0x1fe36f){if(_0x1fe36f){return _0x1fe36f?{'count':_0x19cc96,'rows':_0x1fe36f}:null;}})[_0x8405('0x26')](respondWithResult(_0xa1a12f,null))[_0x8405('0x44')](handleError(_0xa1a12f,null));};exports['getSubjects']=function(_0x15c9f4,_0x1487e7,_0x21a258){var _0x518c6e={};var _0x14d203={};var _0x3b9d47;var _0x2e464a;return db[_0x8405('0x2d')]['findOne']({'where':{'id':_0x15c9f4[_0x8405('0x46')]['id']}})['then'](handleEntityNotFound(_0x1487e7,null))[_0x8405('0x26')](function(_0x1fdbcb){if(_0x1fdbcb){_0x3b9d47=_0x1fdbcb;_0x14d203['model']=_[_0x8405('0x47')](db[_0x8405('0x4f')][_0x8405('0x2e')]);_0x14d203[_0x8405('0x33')]=_[_0x8405('0x47')](_0x15c9f4['query']);_0x14d203[_0x8405('0x34')]=_[_0x8405('0x35')](_0x14d203[_0x8405('0x32')],_0x14d203[_0x8405('0x33')]);_0x518c6e[_0x8405('0x36')]=_[_0x8405('0x35')](_0x14d203[_0x8405('0x32')],qs['fields'](_0x15c9f4['query'][_0x8405('0x37')]));_0x518c6e[_0x8405('0x36')]=_0x518c6e[_0x8405('0x36')][_0x8405('0x38')]?_0x518c6e[_0x8405('0x36')]:_0x14d203[_0x8405('0x32')];_0x518c6e[_0x8405('0x4c')]=qs[_0x8405('0x3a')](_0x15c9f4[_0x8405('0x33')][_0x8405('0x3a')]);_0x518c6e['where']=qs[_0x8405('0x34')](_[_0x8405('0x3c')](_0x15c9f4[_0x8405('0x33')],_0x14d203[_0x8405('0x34')]));if(_0x15c9f4[_0x8405('0x33')][_0x8405('0x3d')]){_0x518c6e['where']=_['merge'](_0x518c6e['where'],{'$or':_[_0x8405('0x2c')](_0x518c6e[_0x8405('0x36')],function(_0x37410b){var _0x38507d={};_0x38507d[_0x37410b]={'$like':'%'+_0x15c9f4['query'][_0x8405('0x3d')]+'%'};return _0x38507d;})});}_0x518c6e=_[_0x8405('0x3f')]({},_0x518c6e,_0x15c9f4[_0x8405('0x40')]);return _0x3b9d47['getSubjects'](_0x518c6e);}})[_0x8405('0x26')](function(_0x28349a){if(_0x28349a){_0x2e464a=_0x28349a[_0x8405('0x38')];if(!_0x15c9f4['query']['hasOwnProperty'](_0x8405('0x39'))){_0x518c6e[_0x8405('0x1e')]=qs['limit'](_0x15c9f4[_0x8405('0x33')][_0x8405('0x1e')]);_0x518c6e['offset']=qs[_0x8405('0x1c')](_0x15c9f4[_0x8405('0x33')]['offset']);}return _0x3b9d47[_0x8405('0x50')](_0x518c6e);}})[_0x8405('0x26')](function(_0x4e4cd7){if(_0x4e4cd7){return _0x4e4cd7?{'count':_0x2e464a,'rows':_0x4e4cd7}:null;}})[_0x8405('0x26')](respondWithResult(_0x1487e7,null))[_0x8405('0x44')](handleError(_0x1487e7,null));};exports[_0x8405('0x51')]=function(_0x351165,_0x31e4c0,_0x18bdd7){var _0x173821={};var _0x156634={};var _0xbd82d4;var _0x5d1920;return db[_0x8405('0x2d')][_0x8405('0x4b')]({'where':{'id':_0x351165[_0x8405('0x46')]['id']}})[_0x8405('0x26')](handleEntityNotFound(_0x31e4c0,null))['then'](function(_0x31c546){if(_0x31c546){_0xbd82d4=_0x31c546;_0x156634[_0x8405('0x32')]=_['keys'](db[_0x8405('0x4f')][_0x8405('0x2e')]);_0x156634[_0x8405('0x33')]=_[_0x8405('0x47')](_0x351165[_0x8405('0x33')]);_0x156634[_0x8405('0x34')]=_['intersection'](_0x156634[_0x8405('0x32')],_0x156634[_0x8405('0x33')]);_0x173821[_0x8405('0x36')]=_[_0x8405('0x35')](_0x156634[_0x8405('0x32')],qs[_0x8405('0x37')](_0x351165[_0x8405('0x33')]['fields']));_0x173821[_0x8405('0x36')]=_0x173821['attributes'][_0x8405('0x38')]?_0x173821[_0x8405('0x36')]:_0x156634[_0x8405('0x32')];_0x173821[_0x8405('0x4c')]=qs[_0x8405('0x3a')](_0x351165['query'][_0x8405('0x3a')]);_0x173821[_0x8405('0x3b')]=qs[_0x8405('0x34')](_['pick'](_0x351165['query'],_0x156634['filters']));if(_0x351165[_0x8405('0x33')]['filter']){_0x173821[_0x8405('0x3b')]=_['merge'](_0x173821[_0x8405('0x3b')],{'$or':_['map'](_0x173821['attributes'],function(_0x389d93){var _0x239fcf={};_0x239fcf[_0x389d93]={'$like':'%'+_0x351165[_0x8405('0x33')][_0x8405('0x3d')]+'%'};return _0x239fcf;})});}_0x173821=_[_0x8405('0x3f')]({},_0x173821,_0x351165[_0x8405('0x40')]);return _0xbd82d4[_0x8405('0x51')](_0x173821);}})[_0x8405('0x26')](function(_0x1551d2){if(_0x1551d2){_0x5d1920=_0x1551d2[_0x8405('0x38')];if(!_0x351165[_0x8405('0x33')][_0x8405('0x4e')](_0x8405('0x39'))){_0x173821[_0x8405('0x1e')]=qs[_0x8405('0x1e')](_0x351165['query'][_0x8405('0x1e')]);_0x173821[_0x8405('0x1c')]=qs['offset'](_0x351165[_0x8405('0x33')][_0x8405('0x1c')]);}return _0xbd82d4[_0x8405('0x51')](_0x173821);}})[_0x8405('0x26')](function(_0x4c9d2a){if(_0x4c9d2a){return _0x4c9d2a?{'count':_0x5d1920,'rows':_0x4c9d2a}:null;}})[_0x8405('0x26')](respondWithResult(_0x31e4c0,null))[_0x8405('0x44')](handleError(_0x31e4c0,null));}; \ No newline at end of file +var _0xe8ca=['ejs','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','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3cf270,_0x18d0c8){var _0x3bed97=function(_0x373002){while(--_0x373002){_0x3cf270['push'](_0x3cf270['shift']());}};_0x3bed97(++_0x18d0c8);}(_0xe8ca,0x150));var _0xae8c=function(_0xb04032,_0x5e0cad){_0xb04032=_0xb04032-0x0;var _0x2b0248=_0xe8ca[_0xb04032];return _0x2b0248;};'use strict';var emlformat=require(_0xae8c('0x0'));var rimraf=require(_0xae8c('0x1'));var zipdir=require(_0xae8c('0x2'));var jsonpatch=require(_0xae8c('0x3'));var rp=require(_0xae8c('0x4'));var moment=require(_0xae8c('0x5'));var BPromise=require(_0xae8c('0x6'));var Mustache=require(_0xae8c('0x7'));var util=require(_0xae8c('0x8'));var path=require(_0xae8c('0x9'));var sox=require(_0xae8c('0xa'));var csv=require(_0xae8c('0xb'));var ejs=require(_0xae8c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae8c('0xd'));var squel=require(_0xae8c('0xe'));var crypto=require(_0xae8c('0xf'));var jsforce=require(_0xae8c('0x10'));var deskjs=require(_0xae8c('0x11'));var toCsv=require('to-csv');var querystring=require(_0xae8c('0x12'));var Papa=require(_0xae8c('0x13'));var Redis=require(_0xae8c('0x14'));var authService=require(_0xae8c('0x15'));var qs=require(_0xae8c('0x16'));var as=require(_0xae8c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae8c('0x18'))(_0xae8c('0x19'));var utils=require(_0xae8c('0x1a'));var config=require(_0xae8c('0x1b'));var licenseUtil=require(_0xae8c('0x1c'));var db=require(_0xae8c('0x1d'))['db'];function respondWithStatusCode(_0x251dd9,_0x54027d){_0x54027d=_0x54027d||0xcc;return function(_0x420ab4){if(_0x420ab4){return _0x251dd9['sendStatus'](_0x54027d);}return _0x251dd9[_0xae8c('0x1e')](_0x54027d)[_0xae8c('0x1f')]();};}function respondWithResult(_0x1ecfa8,_0x13fce0){_0x13fce0=_0x13fce0||0xc8;return function(_0x3665e3){if(_0x3665e3){return _0x1ecfa8[_0xae8c('0x1e')](_0x13fce0)[_0xae8c('0x20')](_0x3665e3);}};}function respondWithFilteredResult(_0x507ac7,_0x338a45){return function(_0xcc7a4b){if(_0xcc7a4b){var _0x523ccd=typeof _0x338a45[_0xae8c('0x21')]===_0xae8c('0x22')&&typeof _0x338a45['limit']===_0xae8c('0x22');var _0x3e8e92=_0xcc7a4b['count'];var _0x1b1dca=_0x523ccd?0x0:_0x338a45[_0xae8c('0x21')];var _0x52e765=_0x523ccd?_0xcc7a4b[_0xae8c('0x23')]:_0x338a45[_0xae8c('0x21')]+_0x338a45[_0xae8c('0x24')];var _0x4f397c;if(_0x52e765>=_0x3e8e92){_0x52e765=_0x3e8e92;_0x4f397c=0xc8;}else{_0x4f397c=0xce;}_0x507ac7['status'](_0x4f397c);return _0x507ac7['set'](_0xae8c('0x25'),_0x1b1dca+'-'+_0x52e765+'/'+_0x3e8e92)[_0xae8c('0x20')](_0xcc7a4b);}return null;};}function patchUpdates(_0x2ac280){return function(_0x5b3e9a){try{jsonpatch[_0xae8c('0x26')](_0x5b3e9a,_0x2ac280,!![]);}catch(_0x3e8cfc){return BPromise['reject'](_0x3e8cfc);}return _0x5b3e9a[_0xae8c('0x27')]();};}function saveUpdates(_0x988481,_0x3e9fa6){return function(_0x5f12d9){if(_0x5f12d9){return _0x5f12d9['update'](_0x988481)[_0xae8c('0x28')](function(_0x4f240a){return _0x4f240a;});}return null;};}function removeEntity(_0x5c70e8,_0x4961d6){return function(_0x49eb8c){if(_0x49eb8c){return _0x49eb8c[_0xae8c('0x29')]()[_0xae8c('0x28')](function(){_0x5c70e8[_0xae8c('0x1e')](0xcc)[_0xae8c('0x1f')]();});}};}function handleEntityNotFound(_0x3a58b4,_0x425b05){return function(_0x1f0b59){if(!_0x1f0b59){_0x3a58b4[_0xae8c('0x2a')](0x194);}return _0x1f0b59;};}function handleError(_0x3b4c7a,_0x4ac598){_0x4ac598=_0x4ac598||0x1f4;return function(_0x10edb6){logger['error'](_0x10edb6[_0xae8c('0x2b')]);if(_0x10edb6[_0xae8c('0x2c')]){delete _0x10edb6['name'];}_0x3b4c7a[_0xae8c('0x1e')](_0x4ac598)[_0xae8c('0x2d')](_0x10edb6);};}exports[_0xae8c('0x2e')]=function(_0x14380c,_0x4e4dff){var _0x3f6c57={},_0x170db3={},_0x1d8830={'count':0x0,'rows':[]};var _0x51bb18=_[_0xae8c('0x2f')](db[_0xae8c('0x30')][_0xae8c('0x31')],function(_0x669715){return{'name':_0x669715[_0xae8c('0x32')],'type':_0x669715[_0xae8c('0x33')][_0xae8c('0x34')]};});_0x170db3[_0xae8c('0x35')]=_['map'](_0x51bb18,'name');_0x170db3['query']=_[_0xae8c('0x36')](_0x14380c[_0xae8c('0x37')]);_0x170db3['filters']=_[_0xae8c('0x38')](_0x170db3[_0xae8c('0x35')],_0x170db3['query']);_0x3f6c57['attributes']=_['intersection'](_0x170db3[_0xae8c('0x35')],qs[_0xae8c('0x39')](_0x14380c['query']['fields']));_0x3f6c57[_0xae8c('0x3a')]=_0x3f6c57[_0xae8c('0x3a')][_0xae8c('0x3b')]?_0x3f6c57['attributes']:_0x170db3[_0xae8c('0x35')];if(!_0x14380c[_0xae8c('0x37')][_0xae8c('0x3c')](_0xae8c('0x3d'))){_0x3f6c57[_0xae8c('0x24')]=qs[_0xae8c('0x24')](_0x14380c[_0xae8c('0x37')]['limit']);_0x3f6c57[_0xae8c('0x21')]=qs['offset'](_0x14380c[_0xae8c('0x37')][_0xae8c('0x21')]);}_0x3f6c57[_0xae8c('0x3e')]=qs[_0xae8c('0x3f')](_0x14380c[_0xae8c('0x37')][_0xae8c('0x3f')]);_0x3f6c57[_0xae8c('0x40')]=qs[_0xae8c('0x41')](_[_0xae8c('0x42')](_0x14380c[_0xae8c('0x37')],_0x170db3[_0xae8c('0x41')]),_0x51bb18);if(_0x14380c[_0xae8c('0x37')][_0xae8c('0x43')]){_0x3f6c57[_0xae8c('0x40')]=_[_0xae8c('0x44')](_0x3f6c57[_0xae8c('0x40')],{'$or':_[_0xae8c('0x2f')](_0x51bb18,function(_0xa8bd70){if(_0xa8bd70[_0xae8c('0x33')]!==_0xae8c('0x45')){var _0x472020={};_0x472020[_0xa8bd70['name']]={'$like':'%'+_0x14380c['query'][_0xae8c('0x43')]+'%'};return _0x472020;}})});}_0x3f6c57=_[_0xae8c('0x44')]({},_0x3f6c57,_0x14380c[_0xae8c('0x46')]);var _0x18fbde={'where':_0x3f6c57[_0xae8c('0x40')]};return db[_0xae8c('0x30')][_0xae8c('0x23')](_0x18fbde)[_0xae8c('0x28')](function(_0x456e77){_0x1d8830[_0xae8c('0x23')]=_0x456e77;if(_0x14380c[_0xae8c('0x37')][_0xae8c('0x47')]){_0x3f6c57[_0xae8c('0x48')]=[{'all':!![]}];}return db[_0xae8c('0x30')][_0xae8c('0x49')](_0x3f6c57);})[_0xae8c('0x28')](function(_0x4c5a94){_0x1d8830[_0xae8c('0x4a')]=_0x4c5a94;return _0x1d8830;})[_0xae8c('0x28')](respondWithFilteredResult(_0x4e4dff,_0x3f6c57))[_0xae8c('0x4b')](handleError(_0x4e4dff,null));};exports[_0xae8c('0x4c')]=function(_0x1b6637,_0x50eec6){var _0x5751c7={'raw':![],'where':{'id':_0x1b6637['params']['id']}},_0x31af12={};_0x31af12[_0xae8c('0x35')]=_[_0xae8c('0x36')](db[_0xae8c('0x30')][_0xae8c('0x31')]);_0x31af12[_0xae8c('0x37')]=_[_0xae8c('0x36')](_0x1b6637[_0xae8c('0x37')]);_0x31af12[_0xae8c('0x41')]=_[_0xae8c('0x38')](_0x31af12[_0xae8c('0x35')],_0x31af12[_0xae8c('0x37')]);_0x5751c7['attributes']=_[_0xae8c('0x38')](_0x31af12['model'],qs['fields'](_0x1b6637[_0xae8c('0x37')]['fields']));_0x5751c7[_0xae8c('0x3a')]=_0x5751c7['attributes'][_0xae8c('0x3b')]?_0x5751c7[_0xae8c('0x3a')]:_0x31af12[_0xae8c('0x35')];if(_0x1b6637[_0xae8c('0x37')][_0xae8c('0x47')]){_0x5751c7[_0xae8c('0x48')]=[{'all':!![]}];}_0x5751c7=_[_0xae8c('0x44')]({},_0x5751c7,_0x1b6637['options']);return db[_0xae8c('0x30')][_0xae8c('0x4d')](_0x5751c7)[_0xae8c('0x28')](handleEntityNotFound(_0x50eec6,null))[_0xae8c('0x28')](respondWithResult(_0x50eec6,null))[_0xae8c('0x4b')](handleError(_0x50eec6,null));};exports[_0xae8c('0x4e')]=function(_0xa787b9,_0x313096){return db[_0xae8c('0x30')][_0xae8c('0x4e')](_0xa787b9[_0xae8c('0x4f')],{})['then'](respondWithResult(_0x313096,0xc9))[_0xae8c('0x4b')](handleError(_0x313096,null));};exports[_0xae8c('0x50')]=function(_0x57a37e,_0xe2157e){if(_0x57a37e['body']['id']){delete _0x57a37e[_0xae8c('0x4f')]['id'];}return db[_0xae8c('0x30')][_0xae8c('0x4d')]({'where':{'id':_0x57a37e['params']['id']}})[_0xae8c('0x28')](handleEntityNotFound(_0xe2157e,null))[_0xae8c('0x28')](saveUpdates(_0x57a37e[_0xae8c('0x4f')],null))['then'](respondWithResult(_0xe2157e,null))['catch'](handleError(_0xe2157e,null));};exports[_0xae8c('0x29')]=function(_0x517772,_0x489166){return db['Dynamics365Configuration'][_0xae8c('0x4d')]({'where':{'id':_0x517772[_0xae8c('0x51')]['id']}})[_0xae8c('0x28')](handleEntityNotFound(_0x489166,null))[_0xae8c('0x28')](removeEntity(_0x489166,null))[_0xae8c('0x4b')](handleError(_0x489166,null));};exports[_0xae8c('0x52')]=function(_0x27cdc1,_0x10ae85,_0x26b1db){var _0x277497={};var _0x5d5e3a={};var _0x5ac86a;var _0x44fc91;return db[_0xae8c('0x30')]['findOne']({'where':{'id':_0x27cdc1[_0xae8c('0x51')]['id']}})[_0xae8c('0x28')](handleEntityNotFound(_0x10ae85,null))['then'](function(_0x5d66ca){if(_0x5d66ca){_0x5ac86a=_0x5d66ca;_0x5d5e3a[_0xae8c('0x35')]=_[_0xae8c('0x36')](db[_0xae8c('0x53')][_0xae8c('0x31')]);_0x5d5e3a['query']=_[_0xae8c('0x36')](_0x27cdc1['query']);_0x5d5e3a[_0xae8c('0x41')]=_[_0xae8c('0x38')](_0x5d5e3a[_0xae8c('0x35')],_0x5d5e3a[_0xae8c('0x37')]);_0x277497['attributes']=_[_0xae8c('0x38')](_0x5d5e3a[_0xae8c('0x35')],qs[_0xae8c('0x39')](_0x27cdc1['query'][_0xae8c('0x39')]));_0x277497[_0xae8c('0x3a')]=_0x277497[_0xae8c('0x3a')]['length']?_0x277497['attributes']:_0x5d5e3a[_0xae8c('0x35')];_0x277497[_0xae8c('0x3e')]=qs[_0xae8c('0x3f')](_0x27cdc1['query'][_0xae8c('0x3f')]);_0x277497[_0xae8c('0x40')]=qs[_0xae8c('0x41')](_[_0xae8c('0x42')](_0x27cdc1['query'],_0x5d5e3a[_0xae8c('0x41')]));if(_0x27cdc1[_0xae8c('0x37')][_0xae8c('0x43')]){_0x277497[_0xae8c('0x40')]=_[_0xae8c('0x44')](_0x277497[_0xae8c('0x40')],{'$or':_[_0xae8c('0x2f')](_0x277497[_0xae8c('0x3a')],function(_0x1bdb87){var _0x3a92d1={};_0x3a92d1[_0x1bdb87]={'$like':'%'+_0x27cdc1[_0xae8c('0x37')]['filter']+'%'};return _0x3a92d1;})});}_0x277497=_[_0xae8c('0x44')]({},_0x277497,_0x27cdc1[_0xae8c('0x46')]);return _0x5ac86a[_0xae8c('0x52')](_0x277497);}})[_0xae8c('0x28')](function(_0x4cbd2f){if(_0x4cbd2f){_0x44fc91=_0x4cbd2f[_0xae8c('0x3b')];if(!_0x27cdc1[_0xae8c('0x37')][_0xae8c('0x3c')]('nolimit')){_0x277497['limit']=qs[_0xae8c('0x24')](_0x27cdc1[_0xae8c('0x37')][_0xae8c('0x24')]);_0x277497[_0xae8c('0x21')]=qs[_0xae8c('0x21')](_0x27cdc1[_0xae8c('0x37')][_0xae8c('0x21')]);}return _0x5ac86a[_0xae8c('0x52')](_0x277497);}})[_0xae8c('0x28')](function(_0x2ba0dd){if(_0x2ba0dd){return _0x2ba0dd?{'count':_0x44fc91,'rows':_0x2ba0dd}:null;}})[_0xae8c('0x28')](respondWithResult(_0x10ae85,null))[_0xae8c('0x4b')](handleError(_0x10ae85,null));};exports[_0xae8c('0x54')]=function(_0xfd8374,_0x38b0bf,_0x98096d){var _0xf5e0a2={};var _0x24a78d={};var _0x1d4d88;var _0x18c09e;return db[_0xae8c('0x30')]['findOne']({'where':{'id':_0xfd8374[_0xae8c('0x51')]['id']}})[_0xae8c('0x28')](handleEntityNotFound(_0x38b0bf,null))[_0xae8c('0x28')](function(_0x36de2d){if(_0x36de2d){_0x1d4d88=_0x36de2d;_0x24a78d[_0xae8c('0x35')]=_['keys'](db['Dynamics365Field'][_0xae8c('0x31')]);_0x24a78d['query']=_[_0xae8c('0x36')](_0xfd8374[_0xae8c('0x37')]);_0x24a78d[_0xae8c('0x41')]=_['intersection'](_0x24a78d[_0xae8c('0x35')],_0x24a78d[_0xae8c('0x37')]);_0xf5e0a2[_0xae8c('0x3a')]=_[_0xae8c('0x38')](_0x24a78d[_0xae8c('0x35')],qs['fields'](_0xfd8374[_0xae8c('0x37')][_0xae8c('0x39')]));_0xf5e0a2[_0xae8c('0x3a')]=_0xf5e0a2[_0xae8c('0x3a')][_0xae8c('0x3b')]?_0xf5e0a2[_0xae8c('0x3a')]:_0x24a78d[_0xae8c('0x35')];_0xf5e0a2[_0xae8c('0x3e')]=qs['sort'](_0xfd8374[_0xae8c('0x37')][_0xae8c('0x3f')]);_0xf5e0a2[_0xae8c('0x40')]=qs['filters'](_[_0xae8c('0x42')](_0xfd8374['query'],_0x24a78d[_0xae8c('0x41')]));if(_0xfd8374[_0xae8c('0x37')][_0xae8c('0x43')]){_0xf5e0a2['where']=_[_0xae8c('0x44')](_0xf5e0a2['where'],{'$or':_[_0xae8c('0x2f')](_0xf5e0a2['attributes'],function(_0x58bd91){var _0x7468eb={};_0x7468eb[_0x58bd91]={'$like':'%'+_0xfd8374['query'][_0xae8c('0x43')]+'%'};return _0x7468eb;})});}_0xf5e0a2=_['merge']({},_0xf5e0a2,_0xfd8374[_0xae8c('0x46')]);return _0x1d4d88['getSubjects'](_0xf5e0a2);}})[_0xae8c('0x28')](function(_0x50553f){if(_0x50553f){_0x18c09e=_0x50553f['length'];if(!_0xfd8374[_0xae8c('0x37')][_0xae8c('0x3c')](_0xae8c('0x3d'))){_0xf5e0a2['limit']=qs[_0xae8c('0x24')](_0xfd8374[_0xae8c('0x37')][_0xae8c('0x24')]);_0xf5e0a2[_0xae8c('0x21')]=qs['offset'](_0xfd8374[_0xae8c('0x37')][_0xae8c('0x21')]);}return _0x1d4d88[_0xae8c('0x54')](_0xf5e0a2);}})['then'](function(_0x3be28c){if(_0x3be28c){return _0x3be28c?{'count':_0x18c09e,'rows':_0x3be28c}:null;}})[_0xae8c('0x28')](respondWithResult(_0x38b0bf,null))[_0xae8c('0x4b')](handleError(_0x38b0bf,null));};exports['getDescriptions']=function(_0xe0f4fb,_0x32b113,_0x5e0446){var _0x3f2f2a={};var _0x1e323d={};var _0x45ab59;var _0x19697a;return db[_0xae8c('0x30')][_0xae8c('0x55')]({'where':{'id':_0xe0f4fb['params']['id']}})[_0xae8c('0x28')](handleEntityNotFound(_0x32b113,null))[_0xae8c('0x28')](function(_0x1d3e3e){if(_0x1d3e3e){_0x45ab59=_0x1d3e3e;_0x1e323d[_0xae8c('0x35')]=_[_0xae8c('0x36')](db[_0xae8c('0x53')][_0xae8c('0x31')]);_0x1e323d[_0xae8c('0x37')]=_[_0xae8c('0x36')](_0xe0f4fb[_0xae8c('0x37')]);_0x1e323d[_0xae8c('0x41')]=_[_0xae8c('0x38')](_0x1e323d['model'],_0x1e323d[_0xae8c('0x37')]);_0x3f2f2a[_0xae8c('0x3a')]=_[_0xae8c('0x38')](_0x1e323d['model'],qs['fields'](_0xe0f4fb['query'][_0xae8c('0x39')]));_0x3f2f2a[_0xae8c('0x3a')]=_0x3f2f2a[_0xae8c('0x3a')][_0xae8c('0x3b')]?_0x3f2f2a['attributes']:_0x1e323d[_0xae8c('0x35')];_0x3f2f2a[_0xae8c('0x3e')]=qs['sort'](_0xe0f4fb[_0xae8c('0x37')]['sort']);_0x3f2f2a[_0xae8c('0x40')]=qs[_0xae8c('0x41')](_[_0xae8c('0x42')](_0xe0f4fb['query'],_0x1e323d[_0xae8c('0x41')]));if(_0xe0f4fb['query'][_0xae8c('0x43')]){_0x3f2f2a[_0xae8c('0x40')]=_[_0xae8c('0x44')](_0x3f2f2a[_0xae8c('0x40')],{'$or':_['map'](_0x3f2f2a[_0xae8c('0x3a')],function(_0x16c72c){var _0x1f8d46={};_0x1f8d46[_0x16c72c]={'$like':'%'+_0xe0f4fb[_0xae8c('0x37')][_0xae8c('0x43')]+'%'};return _0x1f8d46;})});}_0x3f2f2a=_['merge']({},_0x3f2f2a,_0xe0f4fb[_0xae8c('0x46')]);return _0x45ab59[_0xae8c('0x56')](_0x3f2f2a);}})[_0xae8c('0x28')](function(_0x1b1d29){if(_0x1b1d29){_0x19697a=_0x1b1d29[_0xae8c('0x3b')];if(!_0xe0f4fb[_0xae8c('0x37')][_0xae8c('0x3c')](_0xae8c('0x3d'))){_0x3f2f2a[_0xae8c('0x24')]=qs[_0xae8c('0x24')](_0xe0f4fb[_0xae8c('0x37')]['limit']);_0x3f2f2a[_0xae8c('0x21')]=qs[_0xae8c('0x21')](_0xe0f4fb[_0xae8c('0x37')]['offset']);}return _0x45ab59[_0xae8c('0x56')](_0x3f2f2a);}})[_0xae8c('0x28')](function(_0x100301){if(_0x100301){return _0x100301?{'count':_0x19697a,'rows':_0x100301}:null;}})[_0xae8c('0x28')](respondWithResult(_0x32b113,null))[_0xae8c('0x4b')](handleError(_0x32b113,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 011a3dd..430f133 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 _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x393c55,_0x43b06c){var _0x4085fc=function(_0x541e20){while(--_0x541e20){_0x393c55['push'](_0x393c55['shift']());}};_0x4085fc(++_0x43b06c);}(_0x70e0,0x17b));var _0x070e=function(_0x3e8255,_0x2c1651){_0x3e8255=_0x3e8255-0x0;var _0x3c2c68=_0x70e0[_0x3e8255];return _0x3c2c68;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x40e640,_0x3c50f0){_0x40e640=_0x40e640-0x0;var _0xacd87e=_0xe5b3[_0x40e640];return _0xacd87e;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index adde0c0..0c566c2 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 _0xdf84=['Dynamics365Configuration,\x20%s,\x20%s','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x36e4cd,_0x4fe25d){var _0x2a6b3a=function(_0x2c7d5a){while(--_0x2c7d5a){_0x36e4cd['push'](_0x36e4cd['shift']());}};_0x2a6b3a(++_0x4fe25d);}(_0xdf84,0xbf));var _0x4df8=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xdf84[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x4df8('0x0'));var moment=require(_0x4df8('0x1'));var BPromise=require(_0x4df8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4df8('0x3'));var db=require(_0x4df8('0x4'))['db'];var utils=require(_0x4df8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4df8('0x6'));var jayson=require(_0x4df8('0x7'));var client=jayson[_0x4df8('0x8')][_0x4df8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x73d269,_0x4011c5,_0x2fea8f){return new BPromise(function(_0x45031a,_0x36f850){return client[_0x4df8('0xa')](_0x73d269,_0x2fea8f)[_0x4df8('0xb')](function(_0x576cbf){logger[_0x4df8('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4011c5,_0x4df8('0xd'));logger[_0x4df8('0xe')](_0x4df8('0xf'),_0x4011c5,'request\x20sent',JSON[_0x4df8('0x10')](_0x576cbf));if(_0x576cbf[_0x4df8('0x11')]){if(_0x576cbf['error']['code']===0x1f4){logger[_0x4df8('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4011c5,_0x576cbf[_0x4df8('0x11')][_0x4df8('0x12')]);return _0x36f850(_0x576cbf['error']['message']);}logger['error'](_0x4df8('0x13'),_0x4011c5,_0x576cbf[_0x4df8('0x11')][_0x4df8('0x12')]);return _0x45031a(_0x576cbf['error']['message']);}else{logger[_0x4df8('0xc')](_0x4df8('0x13'),_0x4011c5,_0x4df8('0xd'));_0x45031a(_0x576cbf[_0x4df8('0x14')][_0x4df8('0x12')]);}})['catch'](function(_0x42fd7a){logger[_0x4df8('0x11')](_0x4df8('0x13'),_0x4011c5,_0x42fd7a);_0x36f850(_0x42fd7a);});});} \ No newline at end of file +var _0x3296=['request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3296,0x1d8));var _0x6329=function(_0x441a91,_0x1a55e3){_0x441a91=_0x441a91-0x0;var _0x1c3bff=_0x3296[_0x441a91];return _0x1c3bff;};'use strict';var _=require('lodash');var util=require(_0x6329('0x0'));var moment=require(_0x6329('0x1'));var BPromise=require('bluebird');var rs=require(_0x6329('0x2'));var fs=require('fs');var Redis=require(_0x6329('0x3'));var db=require(_0x6329('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6329('0x5'))(_0x6329('0x6'));var config=require(_0x6329('0x7'));var jayson=require(_0x6329('0x8'));var client=jayson[_0x6329('0x9')][_0x6329('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56e1d0,_0x4319f1,_0x43b7d6){return new BPromise(function(_0x452f9c,_0x4020c3){return client[_0x6329('0xb')](_0x56e1d0,_0x43b7d6)[_0x6329('0xc')](function(_0x22843e){logger[_0x6329('0xd')](_0x6329('0xe'),_0x4319f1,_0x6329('0xf'));logger[_0x6329('0x10')](_0x6329('0x11'),_0x4319f1,_0x6329('0xf'),JSON[_0x6329('0x12')](_0x22843e));if(_0x22843e[_0x6329('0x13')]){if(_0x22843e[_0x6329('0x13')]['code']===0x1f4){logger[_0x6329('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4319f1,_0x22843e[_0x6329('0x13')][_0x6329('0x14')]);return _0x4020c3(_0x22843e[_0x6329('0x13')][_0x6329('0x14')]);}logger[_0x6329('0x13')](_0x6329('0xe'),_0x4319f1,_0x22843e[_0x6329('0x13')][_0x6329('0x14')]);return _0x452f9c(_0x22843e['error'][_0x6329('0x14')]);}else{logger['info'](_0x6329('0xe'),_0x4319f1,_0x6329('0xf'));_0x452f9c(_0x22843e[_0x6329('0x15')][_0x6329('0x14')]);}})[_0x6329('0x16')](function(_0x421090){logger[_0x6329('0x13')](_0x6329('0xe'),_0x4319f1,_0x421090);_0x4020c3(_0x421090);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 05e5248..258ce51 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 _0x5b4f=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post'];(function(_0x1cbecb,_0x505e33){var _0x4112c4=function(_0x1d1d36){while(--_0x1d1d36){_0x1cbecb['push'](_0x1cbecb['shift']());}};_0x4112c4(++_0x505e33);}(_0x5b4f,0x1be));var _0xf5b4=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x5b4f[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xf5b4('0x0'));var util=require(_0xf5b4('0x1'));var path=require('path');var timeout=require(_0xf5b4('0x2'));var express=require(_0xf5b4('0x3'));var router=express[_0xf5b4('0x4')]();var fs_extra=require(_0xf5b4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5b4('0x6'));var config=require(_0xf5b4('0x7'));var controller=require(_0xf5b4('0x8'));router[_0xf5b4('0x9')]('/',auth[_0xf5b4('0xa')](),controller[_0xf5b4('0xb')]);router[_0xf5b4('0x9')]('/:id',auth[_0xf5b4('0xa')](),controller[_0xf5b4('0xc')]);router[_0xf5b4('0xd')]('/',auth[_0xf5b4('0xa')](),controller['create']);router[_0xf5b4('0xe')](_0xf5b4('0xf'),auth[_0xf5b4('0xa')](),controller[_0xf5b4('0x10')]);router[_0xf5b4('0x11')]('/:id',auth[_0xf5b4('0xa')](),controller[_0xf5b4('0x12')]);module[_0xf5b4('0x13')]=router; \ No newline at end of file +var _0x5b47=['index','/:id','post','create','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5b47,0x98));var _0x75b4=function(_0x1d4b88,_0x8a052f){_0x1d4b88=_0x1d4b88-0x0;var _0x36da06=_0x5b47[_0x1d4b88];return _0x36da06;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x75b4('0x0'));var timeout=require(_0x75b4('0x1'));var express=require('express');var router=express[_0x75b4('0x2')]();var fs_extra=require(_0x75b4('0x3'));var auth=require(_0x75b4('0x4'));var interaction=require(_0x75b4('0x5'));var config=require(_0x75b4('0x6'));var controller=require(_0x75b4('0x7'));router[_0x75b4('0x8')]('/',auth[_0x75b4('0x9')](),controller[_0x75b4('0xa')]);router[_0x75b4('0x8')](_0x75b4('0xb'),auth[_0x75b4('0x9')](),controller['show']);router[_0x75b4('0xc')]('/',auth[_0x75b4('0x9')](),controller[_0x75b4('0xd')]);router['put'](_0x75b4('0xb'),auth['isAuthenticated'](),controller[_0x75b4('0xe')]);router[_0x75b4('0xf')](_0x75b4('0xb'),auth[_0x75b4('0x9')](),controller[_0x75b4('0x10')]);module[_0x75b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 87d058f..50dc987 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 _0xaa21=['picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x3431d3,_0x12f839){var _0x64b334=function(_0x36ed77){while(--_0x36ed77){_0x3431d3['push'](_0x3431d3['shift']());}};_0x64b334(++_0x12f839);}(_0xaa21,0x144));var _0x1aa2=function(_0x305664,_0x1574f8){_0x305664=_0x305664-0x0;var _0x5cfec2=_0xaa21[_0x305664];return _0x5cfec2;};'use strict';var Sequelize=require('sequelize');module[_0x1aa2('0x0')]={'type':{'type':Sequelize[_0x1aa2('0x1')](_0x1aa2('0x2'),_0x1aa2('0x3'),_0x1aa2('0x4'),'keyValue',_0x1aa2('0x5')),'defaultValue':_0x1aa2('0x2')},'content':{'type':Sequelize[_0x1aa2('0x6')]},'key':{'type':Sequelize[_0x1aa2('0x6')]},'keyType':{'type':Sequelize[_0x1aa2('0x1')](_0x1aa2('0x2'),_0x1aa2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1aa2('0x6')]},'idField':{'type':Sequelize[_0x1aa2('0x6')]},'nameField':{'type':Sequelize[_0x1aa2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfea3=['string','customVariable','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x2397b7,_0x5f1976){var _0x5b5cf7=function(_0x357dca){while(--_0x357dca){_0x2397b7['push'](_0x2397b7['shift']());}};_0x5b5cf7(++_0x5f1976);}(_0xfea3,0x186));var _0x3fea=function(_0x34d408,_0x32ec83){_0x34d408=_0x34d408-0x0;var _0x20366c=_0xfea3[_0x34d408];return _0x20366c;};'use strict';var Sequelize=require('sequelize');module[_0x3fea('0x0')]={'type':{'type':Sequelize[_0x3fea('0x1')](_0x3fea('0x2'),'variable',_0x3fea('0x3'),'keyValue','picklist'),'defaultValue':_0x3fea('0x2')},'content':{'type':Sequelize[_0x3fea('0x4')]},'key':{'type':Sequelize[_0x3fea('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3fea('0x2'),_0x3fea('0x5'),_0x3fea('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3fea('0x4')]},'nameField':{'type':Sequelize[_0x3fea('0x4')]},'customField':{'type':Sequelize[_0x3fea('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 87a7d43..8d34b1b 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 _0x879a=['catch','show','params','includeAll','find','create','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','status','Content-Range','apply','reject','then','end','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','merge','options','Dynamics365Field','count','include','findAll'];(function(_0x2eb6e2,_0x972e4e){var _0xfcd369=function(_0x5ab95f){while(--_0x5ab95f){_0x2eb6e2['push'](_0x2eb6e2['shift']());}};_0xfcd369(++_0x972e4e);}(_0x879a,0x1dd));var _0xa879=function(_0x325bc4,_0x375b9a){_0x325bc4=_0x325bc4-0x0;var _0x4946ef=_0x879a[_0x325bc4];return _0x4946ef;};'use strict';var emlformat=require(_0xa879('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa879('0x1'));var jsonpatch=require(_0xa879('0x2'));var rp=require(_0xa879('0x3'));var moment=require(_0xa879('0x4'));var BPromise=require(_0xa879('0x5'));var Mustache=require(_0xa879('0x6'));var util=require(_0xa879('0x7'));var path=require(_0xa879('0x8'));var sox=require(_0xa879('0x9'));var csv=require(_0xa879('0xa'));var ejs=require(_0xa879('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa879('0xc'));var squel=require(_0xa879('0xd'));var crypto=require(_0xa879('0xe'));var jsforce=require(_0xa879('0xf'));var deskjs=require(_0xa879('0x10'));var toCsv=require(_0xa879('0xa'));var querystring=require(_0xa879('0x11'));var Papa=require(_0xa879('0x12'));var Redis=require(_0xa879('0x13'));var authService=require(_0xa879('0x14'));var qs=require(_0xa879('0x15'));var as=require(_0xa879('0x16'));var hardwareService=require(_0xa879('0x17'));var logger=require(_0xa879('0x18'))('api');var utils=require(_0xa879('0x19'));var config=require(_0xa879('0x1a'));var licenseUtil=require(_0xa879('0x1b'));var db=require(_0xa879('0x1c'))['db'];function respondWithStatusCode(_0x19703f,_0x2ce803){_0x2ce803=_0x2ce803||0xcc;return function(_0x315819){if(_0x315819){return _0x19703f[_0xa879('0x1d')](_0x2ce803);}return _0x19703f['status'](_0x2ce803)['end']();};}function respondWithResult(_0x2959d1,_0xeaa008){_0xeaa008=_0xeaa008||0xc8;return function(_0x9b76a0){if(_0x9b76a0){return _0x2959d1['status'](_0xeaa008)[_0xa879('0x1e')](_0x9b76a0);}};}function respondWithFilteredResult(_0x538bfb,_0x2f2437){return function(_0x4fe4c9){if(_0x4fe4c9){var _0x9cd45f=typeof _0x2f2437[_0xa879('0x1f')]==='undefined'&&typeof _0x2f2437[_0xa879('0x20')]===_0xa879('0x21');var _0x2f0bbc=_0x4fe4c9['count'];var _0x4b7e69=_0x9cd45f?0x0:_0x2f2437[_0xa879('0x1f')];var _0x5369db=_0x9cd45f?_0x4fe4c9['count']:_0x2f2437[_0xa879('0x1f')]+_0x2f2437[_0xa879('0x20')];var _0x511904;if(_0x5369db>=_0x2f0bbc){_0x5369db=_0x2f0bbc;_0x511904=0xc8;}else{_0x511904=0xce;}_0x538bfb[_0xa879('0x22')](_0x511904);return _0x538bfb['set'](_0xa879('0x23'),_0x4b7e69+'-'+_0x5369db+'/'+_0x2f0bbc)[_0xa879('0x1e')](_0x4fe4c9);}return null;};}function patchUpdates(_0x512e13){return function(_0x31e97a){try{jsonpatch[_0xa879('0x24')](_0x31e97a,_0x512e13,!![]);}catch(_0x36df39){return BPromise[_0xa879('0x25')](_0x36df39);}return _0x31e97a['save']();};}function saveUpdates(_0x48b176,_0x580592){return function(_0x3bbc1a){if(_0x3bbc1a){return _0x3bbc1a['update'](_0x48b176)[_0xa879('0x26')](function(_0x3f5976){return _0x3f5976;});}return null;};}function removeEntity(_0x1124c0,_0x39dd51){return function(_0x232aed){if(_0x232aed){return _0x232aed['destroy']()[_0xa879('0x26')](function(){_0x1124c0[_0xa879('0x22')](0xcc)[_0xa879('0x27')]();});}};}function handleEntityNotFound(_0x4900d2,_0x5d6521){return function(_0x13d96e){if(!_0x13d96e){_0x4900d2[_0xa879('0x1d')](0x194);}return _0x13d96e;};}function handleError(_0x34774d,_0x1da652){_0x1da652=_0x1da652||0x1f4;return function(_0x36107f){logger[_0xa879('0x28')](_0x36107f[_0xa879('0x29')]);if(_0x36107f[_0xa879('0x2a')]){delete _0x36107f['name'];}_0x34774d['status'](_0x1da652)[_0xa879('0x2b')](_0x36107f);};}exports[_0xa879('0x2c')]=function(_0x233e35,_0x41f7f6){var _0x198676={},_0x367571={},_0x30ea8d={'count':0x0,'rows':[]};var _0x5bf658=_['map'](db['Dynamics365Field'][_0xa879('0x2d')],function(_0x3dcfd7){return{'name':_0x3dcfd7[_0xa879('0x2e')],'type':_0x3dcfd7['type']['key']};});_0x367571[_0xa879('0x2f')]=_[_0xa879('0x30')](_0x5bf658,'name');_0x367571[_0xa879('0x31')]=_[_0xa879('0x32')](_0x233e35[_0xa879('0x31')]);_0x367571['filters']=_[_0xa879('0x33')](_0x367571[_0xa879('0x2f')],_0x367571['query']);_0x198676[_0xa879('0x34')]=_[_0xa879('0x33')](_0x367571[_0xa879('0x2f')],qs[_0xa879('0x35')](_0x233e35[_0xa879('0x31')][_0xa879('0x35')]));_0x198676[_0xa879('0x34')]=_0x198676[_0xa879('0x34')][_0xa879('0x36')]?_0x198676[_0xa879('0x34')]:_0x367571[_0xa879('0x2f')];if(!_0x233e35[_0xa879('0x31')][_0xa879('0x37')](_0xa879('0x38'))){_0x198676['limit']=qs[_0xa879('0x20')](_0x233e35[_0xa879('0x31')]['limit']);_0x198676[_0xa879('0x1f')]=qs[_0xa879('0x1f')](_0x233e35[_0xa879('0x31')][_0xa879('0x1f')]);}_0x198676[_0xa879('0x39')]=qs['sort'](_0x233e35[_0xa879('0x31')][_0xa879('0x3a')]);_0x198676['where']=qs[_0xa879('0x3b')](_['pick'](_0x233e35[_0xa879('0x31')],_0x367571['filters']),_0x5bf658);if(_0x233e35[_0xa879('0x31')][_0xa879('0x3c')]){_0x198676[_0xa879('0x3d')]=_['merge'](_0x198676['where'],{'$or':_[_0xa879('0x30')](_0x5bf658,function(_0x31704a){if(_0x31704a[_0xa879('0x3e')]!=='VIRTUAL'){var _0x472fe1={};_0x472fe1[_0x31704a[_0xa879('0x2a')]]={'$like':'%'+_0x233e35['query'][_0xa879('0x3c')]+'%'};return _0x472fe1;}})});}_0x198676=_[_0xa879('0x3f')]({},_0x198676,_0x233e35[_0xa879('0x40')]);var _0x5208bd={'where':_0x198676[_0xa879('0x3d')]};return db[_0xa879('0x41')]['count'](_0x5208bd)[_0xa879('0x26')](function(_0x1f97ff){_0x30ea8d[_0xa879('0x42')]=_0x1f97ff;if(_0x233e35[_0xa879('0x31')]['includeAll']){_0x198676[_0xa879('0x43')]=[{'all':!![]}];}return db[_0xa879('0x41')][_0xa879('0x44')](_0x198676);})[_0xa879('0x26')](function(_0x29900d){_0x30ea8d['rows']=_0x29900d;return _0x30ea8d;})['then'](respondWithFilteredResult(_0x41f7f6,_0x198676))[_0xa879('0x45')](handleError(_0x41f7f6,null));};exports[_0xa879('0x46')]=function(_0x37ee3e,_0x397e6d){var _0xaa45b7={'raw':!![],'where':{'id':_0x37ee3e[_0xa879('0x47')]['id']}},_0x3282b6={};_0x3282b6[_0xa879('0x2f')]=_[_0xa879('0x32')](db[_0xa879('0x41')][_0xa879('0x2d')]);_0x3282b6[_0xa879('0x31')]=_[_0xa879('0x32')](_0x37ee3e[_0xa879('0x31')]);_0x3282b6[_0xa879('0x3b')]=_[_0xa879('0x33')](_0x3282b6[_0xa879('0x2f')],_0x3282b6[_0xa879('0x31')]);_0xaa45b7['attributes']=_[_0xa879('0x33')](_0x3282b6[_0xa879('0x2f')],qs['fields'](_0x37ee3e[_0xa879('0x31')][_0xa879('0x35')]));_0xaa45b7[_0xa879('0x34')]=_0xaa45b7[_0xa879('0x34')][_0xa879('0x36')]?_0xaa45b7['attributes']:_0x3282b6[_0xa879('0x2f')];if(_0x37ee3e[_0xa879('0x31')][_0xa879('0x48')]){_0xaa45b7[_0xa879('0x43')]=[{'all':!![]}];}_0xaa45b7=_[_0xa879('0x3f')]({},_0xaa45b7,_0x37ee3e[_0xa879('0x40')]);return db['Dynamics365Field'][_0xa879('0x49')](_0xaa45b7)['then'](handleEntityNotFound(_0x397e6d,null))[_0xa879('0x26')](respondWithResult(_0x397e6d,null))[_0xa879('0x45')](handleError(_0x397e6d,null));};exports['create']=function(_0x1bb066,_0x40ac74){return db[_0xa879('0x41')][_0xa879('0x4a')](_0x1bb066['body'],{})[_0xa879('0x26')](respondWithResult(_0x40ac74,0xc9))[_0xa879('0x45')](handleError(_0x40ac74,null));};exports[_0xa879('0x4b')]=function(_0x2952ec,_0x168c5e){if(_0x2952ec['body']['id']){delete _0x2952ec['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x2952ec[_0xa879('0x47')]['id']}})[_0xa879('0x26')](handleEntityNotFound(_0x168c5e,null))[_0xa879('0x26')](saveUpdates(_0x2952ec[_0xa879('0x4c')],null))['then'](respondWithResult(_0x168c5e,null))[_0xa879('0x45')](handleError(_0x168c5e,null));};exports[_0xa879('0x4d')]=function(_0x4fcb54,_0x2842e6){return db[_0xa879('0x41')]['find']({'where':{'id':_0x4fcb54[_0xa879('0x47')]['id']}})[_0xa879('0x26')](handleEntityNotFound(_0x2842e6,null))[_0xa879('0x26')](removeEntity(_0x2842e6,null))[_0xa879('0x45')](handleError(_0x2842e6,null));}; \ No newline at end of file +var _0xae69=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','where','filter','merge','VIRTUAL','options','then','findAll','rows','catch','params','fields','includeAll','include','find','create','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xae69,0xc6));var _0x9ae6=function(_0x37a0c1,_0x46c8bd){_0x37a0c1=_0x37a0c1-0x0;var _0x4c4f33=_0xae69[_0x37a0c1];return _0x4c4f33;};'use strict';var emlformat=require(_0x9ae6('0x0'));var rimraf=require(_0x9ae6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ae6('0x2'));var rp=require('request-promise');var moment=require(_0x9ae6('0x3'));var BPromise=require(_0x9ae6('0x4'));var Mustache=require(_0x9ae6('0x5'));var util=require(_0x9ae6('0x6'));var path=require(_0x9ae6('0x7'));var sox=require(_0x9ae6('0x8'));var csv=require(_0x9ae6('0x9'));var ejs=require(_0x9ae6('0xa'));var fs=require('fs');var fs_extra=require(_0x9ae6('0xb'));var _=require('lodash');var squel=require(_0x9ae6('0xc'));var crypto=require(_0x9ae6('0xd'));var jsforce=require(_0x9ae6('0xe'));var deskjs=require(_0x9ae6('0xf'));var toCsv=require(_0x9ae6('0x9'));var querystring=require(_0x9ae6('0x10'));var Papa=require('papaparse');var Redis=require(_0x9ae6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ae6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9ae6('0x13'));var utils=require(_0x9ae6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ae6('0x15'))['db'];function respondWithStatusCode(_0x55f1d3,_0x2609f0){_0x2609f0=_0x2609f0||0xcc;return function(_0x197bc1){if(_0x197bc1){return _0x55f1d3[_0x9ae6('0x16')](_0x2609f0);}return _0x55f1d3[_0x9ae6('0x17')](_0x2609f0)['end']();};}function respondWithResult(_0x3a16d9,_0x2565ce){_0x2565ce=_0x2565ce||0xc8;return function(_0x50857e){if(_0x50857e){return _0x3a16d9[_0x9ae6('0x17')](_0x2565ce)[_0x9ae6('0x18')](_0x50857e);}};}function respondWithFilteredResult(_0x4ecb1b,_0x3073dd){return function(_0x144b9a){if(_0x144b9a){var _0x275458=typeof _0x3073dd[_0x9ae6('0x19')]===_0x9ae6('0x1a')&&typeof _0x3073dd[_0x9ae6('0x1b')]==='undefined';var _0x3f1840=_0x144b9a[_0x9ae6('0x1c')];var _0x5b489b=_0x275458?0x0:_0x3073dd[_0x9ae6('0x19')];var _0x2ed71e=_0x275458?_0x144b9a[_0x9ae6('0x1c')]:_0x3073dd[_0x9ae6('0x19')]+_0x3073dd['limit'];var _0x9cfa00;if(_0x2ed71e>=_0x3f1840){_0x2ed71e=_0x3f1840;_0x9cfa00=0xc8;}else{_0x9cfa00=0xce;}_0x4ecb1b[_0x9ae6('0x17')](_0x9cfa00);return _0x4ecb1b[_0x9ae6('0x1d')](_0x9ae6('0x1e'),_0x5b489b+'-'+_0x2ed71e+'/'+_0x3f1840)[_0x9ae6('0x18')](_0x144b9a);}return null;};}function patchUpdates(_0x4785bb){return function(_0x29a3c1){try{jsonpatch[_0x9ae6('0x1f')](_0x29a3c1,_0x4785bb,!![]);}catch(_0x360152){return BPromise[_0x9ae6('0x20')](_0x360152);}return _0x29a3c1[_0x9ae6('0x21')]();};}function saveUpdates(_0x3f9a1c,_0x7bd14e){return function(_0x286d26){if(_0x286d26){return _0x286d26['update'](_0x3f9a1c)['then'](function(_0x5c5404){return _0x5c5404;});}return null;};}function removeEntity(_0x4c90b5,_0x4e64ed){return function(_0x296454){if(_0x296454){return _0x296454[_0x9ae6('0x22')]()['then'](function(){_0x4c90b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf30004,_0x146dc3){return function(_0x417505){if(!_0x417505){_0xf30004[_0x9ae6('0x16')](0x194);}return _0x417505;};}function handleError(_0x115e94,_0x837074){_0x837074=_0x837074||0x1f4;return function(_0x463e6a){logger[_0x9ae6('0x23')](_0x463e6a[_0x9ae6('0x24')]);if(_0x463e6a[_0x9ae6('0x25')]){delete _0x463e6a[_0x9ae6('0x25')];}_0x115e94[_0x9ae6('0x17')](_0x837074)['send'](_0x463e6a);};}exports['index']=function(_0x63d0d5,_0x5f2e11){var _0x460c79={},_0x2f680e={},_0x1e3830={'count':0x0,'rows':[]};var _0x3beb58=_[_0x9ae6('0x26')](db[_0x9ae6('0x27')][_0x9ae6('0x28')],function(_0x2d91e7){return{'name':_0x2d91e7[_0x9ae6('0x29')],'type':_0x2d91e7[_0x9ae6('0x2a')]['key']};});_0x2f680e['model']=_['map'](_0x3beb58,'name');_0x2f680e[_0x9ae6('0x2b')]=_[_0x9ae6('0x2c')](_0x63d0d5[_0x9ae6('0x2b')]);_0x2f680e[_0x9ae6('0x2d')]=_[_0x9ae6('0x2e')](_0x2f680e['model'],_0x2f680e['query']);_0x460c79[_0x9ae6('0x2f')]=_[_0x9ae6('0x2e')](_0x2f680e['model'],qs['fields'](_0x63d0d5[_0x9ae6('0x2b')]['fields']));_0x460c79[_0x9ae6('0x2f')]=_0x460c79[_0x9ae6('0x2f')][_0x9ae6('0x30')]?_0x460c79['attributes']:_0x2f680e[_0x9ae6('0x31')];if(!_0x63d0d5['query'][_0x9ae6('0x32')]('nolimit')){_0x460c79[_0x9ae6('0x1b')]=qs[_0x9ae6('0x1b')](_0x63d0d5[_0x9ae6('0x2b')][_0x9ae6('0x1b')]);_0x460c79['offset']=qs[_0x9ae6('0x19')](_0x63d0d5['query']['offset']);}_0x460c79['order']=qs['sort'](_0x63d0d5['query']['sort']);_0x460c79[_0x9ae6('0x33')]=qs[_0x9ae6('0x2d')](_['pick'](_0x63d0d5['query'],_0x2f680e[_0x9ae6('0x2d')]),_0x3beb58);if(_0x63d0d5['query'][_0x9ae6('0x34')]){_0x460c79[_0x9ae6('0x33')]=_[_0x9ae6('0x35')](_0x460c79[_0x9ae6('0x33')],{'$or':_['map'](_0x3beb58,function(_0xf84a04){if(_0xf84a04[_0x9ae6('0x2a')]!==_0x9ae6('0x36')){var _0xa59603={};_0xa59603[_0xf84a04[_0x9ae6('0x25')]]={'$like':'%'+_0x63d0d5[_0x9ae6('0x2b')][_0x9ae6('0x34')]+'%'};return _0xa59603;}})});}_0x460c79=_[_0x9ae6('0x35')]({},_0x460c79,_0x63d0d5[_0x9ae6('0x37')]);var _0x56fb54={'where':_0x460c79['where']};return db[_0x9ae6('0x27')][_0x9ae6('0x1c')](_0x56fb54)[_0x9ae6('0x38')](function(_0x485e38){_0x1e3830[_0x9ae6('0x1c')]=_0x485e38;if(_0x63d0d5['query']['includeAll']){_0x460c79['include']=[{'all':!![]}];}return db[_0x9ae6('0x27')][_0x9ae6('0x39')](_0x460c79);})[_0x9ae6('0x38')](function(_0xa96763){_0x1e3830[_0x9ae6('0x3a')]=_0xa96763;return _0x1e3830;})['then'](respondWithFilteredResult(_0x5f2e11,_0x460c79))[_0x9ae6('0x3b')](handleError(_0x5f2e11,null));};exports['show']=function(_0xf8e572,_0x44dbd0){var _0x179b33={'raw':!![],'where':{'id':_0xf8e572[_0x9ae6('0x3c')]['id']}},_0x297713={};_0x297713['model']=_[_0x9ae6('0x2c')](db[_0x9ae6('0x27')]['rawAttributes']);_0x297713[_0x9ae6('0x2b')]=_[_0x9ae6('0x2c')](_0xf8e572[_0x9ae6('0x2b')]);_0x297713['filters']=_[_0x9ae6('0x2e')](_0x297713['model'],_0x297713['query']);_0x179b33[_0x9ae6('0x2f')]=_[_0x9ae6('0x2e')](_0x297713[_0x9ae6('0x31')],qs[_0x9ae6('0x3d')](_0xf8e572['query']['fields']));_0x179b33['attributes']=_0x179b33[_0x9ae6('0x2f')][_0x9ae6('0x30')]?_0x179b33[_0x9ae6('0x2f')]:_0x297713[_0x9ae6('0x31')];if(_0xf8e572['query'][_0x9ae6('0x3e')]){_0x179b33[_0x9ae6('0x3f')]=[{'all':!![]}];}_0x179b33=_[_0x9ae6('0x35')]({},_0x179b33,_0xf8e572[_0x9ae6('0x37')]);return db[_0x9ae6('0x27')][_0x9ae6('0x40')](_0x179b33)['then'](handleEntityNotFound(_0x44dbd0,null))[_0x9ae6('0x38')](respondWithResult(_0x44dbd0,null))[_0x9ae6('0x3b')](handleError(_0x44dbd0,null));};exports[_0x9ae6('0x41')]=function(_0x1e990f,_0x260a24){return db[_0x9ae6('0x27')][_0x9ae6('0x41')](_0x1e990f['body'],{})[_0x9ae6('0x38')](respondWithResult(_0x260a24,0xc9))[_0x9ae6('0x3b')](handleError(_0x260a24,null));};exports[_0x9ae6('0x42')]=function(_0x22a04d,_0x16ec64){if(_0x22a04d[_0x9ae6('0x43')]['id']){delete _0x22a04d['body']['id'];}return db[_0x9ae6('0x27')][_0x9ae6('0x40')]({'where':{'id':_0x22a04d['params']['id']}})[_0x9ae6('0x38')](handleEntityNotFound(_0x16ec64,null))[_0x9ae6('0x38')](saveUpdates(_0x22a04d[_0x9ae6('0x43')],null))['then'](respondWithResult(_0x16ec64,null))[_0x9ae6('0x3b')](handleError(_0x16ec64,null));};exports[_0x9ae6('0x22')]=function(_0x173fb3,_0x35558d){return db['Dynamics365Field'][_0x9ae6('0x40')]({'where':{'id':_0x173fb3['params']['id']}})[_0x9ae6('0x38')](handleEntityNotFound(_0x35558d,null))[_0x9ae6('0x38')](removeEntity(_0x35558d,null))[_0x9ae6('0x3b')](handleError(_0x35558d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ecf2480..9d71ca2 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 _0x8076=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util'];(function(_0x2646f6,_0x287adf){var _0x577237=function(_0x4d2d6f){while(--_0x4d2d6f){_0x2646f6['push'](_0x2646f6['shift']());}};_0x577237(++_0x287adf);}(_0x8076,0x14f));var _0x6807=function(_0x529208,_0x488ae5){_0x529208=_0x529208-0x0;var _0x3154f5=_0x8076[_0x529208];return _0x3154f5;};'use strict';var _=require('lodash');var util=require(_0x6807('0x0'));var logger=require('../../config/logger')(_0x6807('0x1'));var moment=require(_0x6807('0x2'));var BPromise=require(_0x6807('0x3'));var rp=require(_0x6807('0x4'));var fs=require('fs');var path=require(_0x6807('0x5'));var rimraf=require(_0x6807('0x6'));var config=require(_0x6807('0x7'));var attributes=require(_0x6807('0x8'));module[_0x6807('0x9')]=function(_0x235d91,_0x45e4d8){return _0x235d91[_0x6807('0xa')](_0x6807('0xb'),attributes,{'tableName':_0x6807('0xc'),'paranoid':![],'indexes':[{'name':_0x6807('0xd'),'fields':[_0x6807('0xe'),_0x6807('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1543=['idField','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1543,0x1a5));var _0x3154=function(_0x1564f0,_0x38869c){_0x1564f0=_0x1564f0-0x0;var _0x551cf1=_0x1543[_0x1564f0];return _0x551cf1;};'use strict';var _=require(_0x3154('0x0'));var util=require('util');var logger=require(_0x3154('0x1'))(_0x3154('0x2'));var moment=require(_0x3154('0x3'));var BPromise=require('bluebird');var rp=require(_0x3154('0x4'));var fs=require('fs');var path=require(_0x3154('0x5'));var rimraf=require(_0x3154('0x6'));var config=require('../../config/environment');var attributes=require(_0x3154('0x7'));module['exports']=function(_0x1bbf37,_0x5324b3){return _0x1bbf37['define'](_0x3154('0x8'),attributes,{'tableName':_0x3154('0x9'),'paranoid':![],'indexes':[{'name':_0x3154('0xa'),'fields':[_0x3154('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 59115eb..3db4e9d 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 _0x699b=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x11bd8c,_0x51e776){var _0x5e5ff0=function(_0x2ed276){while(--_0x2ed276){_0x11bd8c['push'](_0x11bd8c['shift']());}};_0x5e5ff0(++_0x51e776);}(_0x699b,0x81));var _0xb699=function(_0x4e5577,_0x5d3979){_0x4e5577=_0x4e5577-0x0;var _0x24fbf2=_0x699b[_0x4e5577];return _0x24fbf2;};'use strict';var _=require(_0xb699('0x0'));var util=require(_0xb699('0x1'));var moment=require(_0xb699('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb699('0x3'))['db'];var utils=require(_0xb699('0x4'));var logger=require(_0xb699('0x5'))(_0xb699('0x6'));var config=require(_0xb699('0x7'));var jayson=require(_0xb699('0x8'));var client=jayson['client'][_0xb699('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41370d,_0x3b5884,_0x1ebe0c){return new BPromise(function(_0x4334c3,_0x1fe6cc){return client[_0xb699('0xa')](_0x41370d,_0x1ebe0c)[_0xb699('0xb')](function(_0x4ba75f){logger[_0xb699('0xc')](_0xb699('0xd'),_0x3b5884,_0xb699('0xe'));logger['debug'](_0xb699('0xf'),_0x3b5884,'request\x20sent',JSON['stringify'](_0x4ba75f));if(_0x4ba75f[_0xb699('0x10')]){if(_0x4ba75f[_0xb699('0x10')][_0xb699('0x11')]===0x1f4){logger['error'](_0xb699('0xd'),_0x3b5884,_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);return _0x1fe6cc(_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);}logger[_0xb699('0x10')](_0xb699('0xd'),_0x3b5884,_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);return _0x4334c3(_0x4ba75f[_0xb699('0x10')][_0xb699('0x12')]);}else{logger[_0xb699('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x3b5884,'request\x20sent');_0x4334c3(_0x4ba75f[_0xb699('0x13')][_0xb699('0x12')]);}})[_0xb699('0x14')](function(_0x2be0a5){logger[_0xb699('0x10')](_0xb699('0xd'),_0x3b5884,_0x2be0a5);_0x1fe6cc(_0x2be0a5);});});} \ No newline at end of file +var _0xfd8b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird'];(function(_0x2f0bf0,_0x2f888e){var _0x502938=function(_0x387ea4){while(--_0x387ea4){_0x2f0bf0['push'](_0x2f0bf0['shift']());}};_0x502938(++_0x2f888e);}(_0xfd8b,0xc5));var _0xbfd8=function(_0x8a97a1,_0xaf1fdf){_0x8a97a1=_0x8a97a1-0x0;var _0x3daafa=_0xfd8b[_0x8a97a1];return _0x3daafa;};'use strict';var _=require(_0xbfd8('0x0'));var util=require(_0xbfd8('0x1'));var moment=require('moment');var BPromise=require(_0xbfd8('0x2'));var rs=require(_0xbfd8('0x3'));var fs=require('fs');var Redis=require(_0xbfd8('0x4'));var db=require(_0xbfd8('0x5'))['db'];var utils=require(_0xbfd8('0x6'));var logger=require(_0xbfd8('0x7'))(_0xbfd8('0x8'));var config=require(_0xbfd8('0x9'));var jayson=require(_0xbfd8('0xa'));var client=jayson[_0xbfd8('0xb')][_0xbfd8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c266b,_0x321324,_0x466b42){return new BPromise(function(_0x41b120,_0x531b90){return client[_0xbfd8('0xd')](_0x4c266b,_0x466b42)[_0xbfd8('0xe')](function(_0xef664b){logger['info'](_0xbfd8('0xf'),_0x321324,_0xbfd8('0x10'));logger[_0xbfd8('0x11')](_0xbfd8('0x12'),_0x321324,_0xbfd8('0x10'),JSON[_0xbfd8('0x13')](_0xef664b));if(_0xef664b[_0xbfd8('0x14')]){if(_0xef664b[_0xbfd8('0x14')][_0xbfd8('0x15')]===0x1f4){logger['error'](_0xbfd8('0xf'),_0x321324,_0xef664b[_0xbfd8('0x14')][_0xbfd8('0x16')]);return _0x531b90(_0xef664b[_0xbfd8('0x14')][_0xbfd8('0x16')]);}logger[_0xbfd8('0x14')](_0xbfd8('0xf'),_0x321324,_0xef664b[_0xbfd8('0x14')][_0xbfd8('0x16')]);return _0x41b120(_0xef664b['error'][_0xbfd8('0x16')]);}else{logger[_0xbfd8('0x17')](_0xbfd8('0xf'),_0x321324,'request\x20sent');_0x41b120(_0xef664b['result'][_0xbfd8('0x16')]);}})[_0xbfd8('0x18')](function(_0x19d494){logger[_0xbfd8('0x14')](_0xbfd8('0xf'),_0x321324,_0x19d494);_0x531b90(_0x19d494);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 110cf1c..88a8acd 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 _0x9088=['getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2225ca,_0x121e86){var _0x1577a7=function(_0x6a79c3){while(--_0x6a79c3){_0x2225ca['push'](_0x2225ca['shift']());}};_0x1577a7(++_0x121e86);}(_0x9088,0x140));var _0x8908=function(_0x461ea7,_0x1ec19b){_0x461ea7=_0x461ea7-0x0;var _0x56cf81=_0x9088[_0x461ea7];return _0x56cf81;};'use strict';var multer=require(_0x8908('0x0'));var util=require(_0x8908('0x1'));var path=require(_0x8908('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8908('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8908('0x4'));var interaction=require(_0x8908('0x5'));var config=require(_0x8908('0x6'));var controller=require(_0x8908('0x7'));router['get']('/',auth[_0x8908('0x8')](),controller[_0x8908('0x9')]);router[_0x8908('0xa')](_0x8908('0xb'),auth[_0x8908('0x8')](),controller[_0x8908('0xc')]);router[_0x8908('0xa')](_0x8908('0xd'),auth[_0x8908('0x8')](),controller[_0x8908('0xe')]);router[_0x8908('0xa')](_0x8908('0xf'),auth['isAuthenticated'](),controller[_0x8908('0x10')]);router[_0x8908('0x11')]('/',auth['isAuthenticated'](),controller[_0x8908('0x12')]);router[_0x8908('0x11')](_0x8908('0xd'),auth[_0x8908('0x8')](),controller[_0x8908('0x13')]);router[_0x8908('0x14')](_0x8908('0xb'),auth[_0x8908('0x8')](),controller[_0x8908('0x15')]);router['delete'](_0x8908('0xb'),auth[_0x8908('0x8')](),controller[_0x8908('0x16')]);module[_0x8908('0x17')]=router; \ No newline at end of file +var _0x6748=['getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0x6748,0x88));var _0x8674=function(_0x224e23,_0xae780e){_0x224e23=_0x224e23-0x0;var _0x1903a5=_0x6748[_0x224e23];return _0x1903a5;};'use strict';var multer=require('multer');var util=require(_0x8674('0x0'));var path=require(_0x8674('0x1'));var timeout=require(_0x8674('0x2'));var express=require(_0x8674('0x3'));var router=express[_0x8674('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8674('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8674('0x6'));var controller=require(_0x8674('0x7'));router[_0x8674('0x8')]('/',auth['isAuthenticated'](),controller[_0x8674('0x9')]);router['get'](_0x8674('0xa'),auth[_0x8674('0xb')](),controller[_0x8674('0xc')]);router['get'](_0x8674('0xd'),auth[_0x8674('0xb')](),controller[_0x8674('0xe')]);router['get'](_0x8674('0xf'),auth[_0x8674('0xb')](),controller[_0x8674('0x10')]);router['post']('/',auth[_0x8674('0xb')](),controller[_0x8674('0x11')]);router[_0x8674('0x12')](_0x8674('0xd'),auth[_0x8674('0xb')](),controller[_0x8674('0x13')]);router[_0x8674('0x14')](_0x8674('0xa'),auth['isAuthenticated'](),controller[_0x8674('0x15')]);router[_0x8674('0x16')](_0x8674('0xa'),auth[_0x8674('0xb')](),controller[_0x8674('0x17')]);module[_0x8674('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e8ff6cd..a950e6f 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 _0x7096=['exports','STRING','username','remoteUri'];(function(_0xf3b41,_0xa93b1f){var _0xbb9010=function(_0x5d3a48){while(--_0x5d3a48){_0xf3b41['push'](_0xf3b41['shift']());}};_0xbb9010(++_0xa93b1f);}(_0x7096,0x10c));var _0x6709=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7096[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xadb5,0xad));var _0x5adb=function(_0x3f1539,_0x11cd92){_0x3f1539=_0x3f1539-0x0;var _0x1390d5=_0xadb5[_0x3f1539];return _0x1390d5;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 98de8c8..a41bf08 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 _0xfc61=['default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','agent','description','priority','group','ticket_type','company','remove','custom_text','custom_dropdown'];(function(_0x2ec1c5,_0x120c94){var _0x4cd1de=function(_0x203af5){while(--_0x203af5){_0x2ec1c5['push'](_0x2ec1c5['shift']());}};_0x4cd1de(++_0x120c94);}(_0xfc61,0x78));var _0x1fc6=function(_0x49a15d,_0x48aedb){_0x49a15d=_0x49a15d-0x0;var _0x52f73e=_0xfc61[_0x49a15d];return _0x52f73e;};'use strict';var emlformat=require(_0x1fc6('0x0'));var rimraf=require(_0x1fc6('0x1'));var zipdir=require(_0x1fc6('0x2'));var jsonpatch=require(_0x1fc6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fc6('0x4'));var util=require(_0x1fc6('0x5'));var path=require(_0x1fc6('0x6'));var sox=require(_0x1fc6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fc6('0x8'));var _=require(_0x1fc6('0x9'));var squel=require(_0x1fc6('0xa'));var crypto=require(_0x1fc6('0xb'));var jsforce=require(_0x1fc6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0xd'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fc6('0x11'));var as=require(_0x1fc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fc6('0x13'))(_0x1fc6('0x14'));var utils=require(_0x1fc6('0x15'));var config=require(_0x1fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1fc6('0x17'));function respondWithStatusCode(_0x475b16,_0xa08740){_0xa08740=_0xa08740||0xcc;return function(_0x5e694d){if(_0x5e694d){return _0x475b16['sendStatus'](_0xa08740);}return _0x475b16[_0x1fc6('0x18')](_0xa08740)['end']();};}function respondWithResult(_0x2833ef,_0x35ecb5){_0x35ecb5=_0x35ecb5||0xc8;return function(_0x2e43f1){if(_0x2e43f1){return _0x2833ef[_0x1fc6('0x18')](_0x35ecb5)[_0x1fc6('0x19')](_0x2e43f1);}};}function respondWithFilteredResult(_0x624be2,_0x324fa7){return function(_0x141d3e){if(_0x141d3e){var _0x578045=typeof _0x324fa7[_0x1fc6('0x1a')]===_0x1fc6('0x1b')&&typeof _0x324fa7[_0x1fc6('0x1c')]===_0x1fc6('0x1b');var _0x3a144b=_0x141d3e[_0x1fc6('0x1d')];var _0x3e9406=_0x578045?0x0:_0x324fa7['offset'];var _0x3e2996=_0x578045?_0x141d3e[_0x1fc6('0x1d')]:_0x324fa7[_0x1fc6('0x1a')]+_0x324fa7[_0x1fc6('0x1c')];var _0xbd94b;if(_0x3e2996>=_0x3a144b){_0x3e2996=_0x3a144b;_0xbd94b=0xc8;}else{_0xbd94b=0xce;}_0x624be2[_0x1fc6('0x18')](_0xbd94b);return _0x624be2[_0x1fc6('0x1e')]('Content-Range',_0x3e9406+'-'+_0x3e2996+'/'+_0x3a144b)['json'](_0x141d3e);}return null;};}function patchUpdates(_0x53b17d){return function(_0x37742e){try{jsonpatch[_0x1fc6('0x1f')](_0x37742e,_0x53b17d,!![]);}catch(_0x514766){return BPromise[_0x1fc6('0x20')](_0x514766);}return _0x37742e[_0x1fc6('0x21')]();};}function saveUpdates(_0x2d0fe0,_0x38a792){return function(_0xbd5b8){if(_0xbd5b8){return _0xbd5b8[_0x1fc6('0x22')](_0x2d0fe0)[_0x1fc6('0x23')](function(_0x3fc788){return _0x3fc788;});}return null;};}function removeEntity(_0x891eba,_0xc6965f){return function(_0x2465a4){if(_0x2465a4){return _0x2465a4[_0x1fc6('0x24')]()[_0x1fc6('0x23')](function(){_0x891eba['status'](0xcc)[_0x1fc6('0x25')]();});}};}function handleEntityNotFound(_0x46d93a,_0x202506){return function(_0x2e326f){if(!_0x2e326f){_0x46d93a[_0x1fc6('0x26')](0x194);}return _0x2e326f;};}function handleError(_0xac242c,_0x42bd0d){_0x42bd0d=_0x42bd0d||0x1f4;return function(_0x3cb114){logger[_0x1fc6('0x27')](_0x3cb114[_0x1fc6('0x28')]);if(_0x3cb114[_0x1fc6('0x29')]){delete _0x3cb114[_0x1fc6('0x29')];}_0xac242c[_0x1fc6('0x18')](_0x42bd0d)[_0x1fc6('0x2a')](_0x3cb114);};}exports['index']=function(_0x287c3e,_0x2996db){var _0xbce313={},_0x4a48bc={},_0x2f75e2={'count':0x0,'rows':[]};var _0x402b01=_[_0x1fc6('0x2b')](db[_0x1fc6('0x2c')][_0x1fc6('0x2d')],function(_0x41886c){return{'name':_0x41886c[_0x1fc6('0x2e')],'type':_0x41886c[_0x1fc6('0x2f')]['key']};});_0x4a48bc[_0x1fc6('0x30')]=_[_0x1fc6('0x2b')](_0x402b01,_0x1fc6('0x29'));_0x4a48bc[_0x1fc6('0x31')]=_[_0x1fc6('0x32')](_0x287c3e[_0x1fc6('0x31')]);_0x4a48bc[_0x1fc6('0x33')]=_['intersection'](_0x4a48bc[_0x1fc6('0x30')],_0x4a48bc[_0x1fc6('0x31')]);_0xbce313[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x4a48bc[_0x1fc6('0x30')],qs['fields'](_0x287c3e['query'][_0x1fc6('0x36')]));_0xbce313[_0x1fc6('0x34')]=_0xbce313[_0x1fc6('0x34')][_0x1fc6('0x37')]?_0xbce313['attributes']:_0x4a48bc[_0x1fc6('0x30')];if(!_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x38')](_0x1fc6('0x39'))){_0xbce313[_0x1fc6('0x1c')]=qs['limit'](_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x1c')]);_0xbce313[_0x1fc6('0x1a')]=qs[_0x1fc6('0x1a')](_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x1a')]);}_0xbce313[_0x1fc6('0x3a')]=qs[_0x1fc6('0x3b')](_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x3b')]);_0xbce313[_0x1fc6('0x3c')]=qs[_0x1fc6('0x33')](_[_0x1fc6('0x3d')](_0x287c3e[_0x1fc6('0x31')],_0x4a48bc[_0x1fc6('0x33')]),_0x402b01);if(_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x3e')]){_0xbce313[_0x1fc6('0x3c')]=_[_0x1fc6('0x3f')](_0xbce313['where'],{'$or':_[_0x1fc6('0x2b')](_0x402b01,function(_0x388b15){if(_0x388b15[_0x1fc6('0x2f')]!==_0x1fc6('0x40')){var _0x54976c={};_0x54976c[_0x388b15[_0x1fc6('0x29')]]={'$like':'%'+_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x3e')]+'%'};return _0x54976c;}})});}_0xbce313=_[_0x1fc6('0x3f')]({},_0xbce313,_0x287c3e[_0x1fc6('0x41')]);var _0x1f6d6a={'where':_0xbce313['where']};return db[_0x1fc6('0x2c')]['count'](_0x1f6d6a)[_0x1fc6('0x23')](function(_0x1f495d){_0x2f75e2[_0x1fc6('0x1d')]=_0x1f495d;if(_0x287c3e[_0x1fc6('0x31')][_0x1fc6('0x42')]){_0xbce313['include']=[{'all':!![]}];}return db[_0x1fc6('0x2c')][_0x1fc6('0x43')](_0xbce313);})[_0x1fc6('0x23')](function(_0x3c20e1){_0x2f75e2[_0x1fc6('0x44')]=_0x3c20e1;return _0x2f75e2;})['then'](respondWithFilteredResult(_0x2996db,_0xbce313))[_0x1fc6('0x45')](handleError(_0x2996db,null));};exports[_0x1fc6('0x46')]=function(_0x1f9108,_0x2896e2){var _0x49f335={'raw':![],'where':{'id':_0x1f9108[_0x1fc6('0x47')]['id']}},_0x3e1dbc={};_0x3e1dbc[_0x1fc6('0x30')]=_[_0x1fc6('0x32')](db[_0x1fc6('0x2c')][_0x1fc6('0x2d')]);_0x3e1dbc[_0x1fc6('0x31')]=_[_0x1fc6('0x32')](_0x1f9108[_0x1fc6('0x31')]);_0x3e1dbc[_0x1fc6('0x33')]=_[_0x1fc6('0x35')](_0x3e1dbc['model'],_0x3e1dbc[_0x1fc6('0x31')]);_0x49f335[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x3e1dbc[_0x1fc6('0x30')],qs['fields'](_0x1f9108['query'][_0x1fc6('0x36')]));_0x49f335[_0x1fc6('0x34')]=_0x49f335[_0x1fc6('0x34')][_0x1fc6('0x37')]?_0x49f335['attributes']:_0x3e1dbc['model'];if(_0x1f9108[_0x1fc6('0x31')]['includeAll']){_0x49f335[_0x1fc6('0x48')]=[{'all':!![]}];}_0x49f335=_[_0x1fc6('0x3f')]({},_0x49f335,_0x1f9108['options']);return db[_0x1fc6('0x2c')][_0x1fc6('0x49')](_0x49f335)['then'](handleEntityNotFound(_0x2896e2,null))['then'](respondWithResult(_0x2896e2,null))[_0x1fc6('0x45')](handleError(_0x2896e2,null));};exports['create']=function(_0x5f2e3f,_0x36200e){return db[_0x1fc6('0x2c')][_0x1fc6('0x4a')](_0x5f2e3f[_0x1fc6('0x4b')],{})['then'](respondWithResult(_0x36200e,0xc9))[_0x1fc6('0x45')](handleError(_0x36200e,null));};exports[_0x1fc6('0x22')]=function(_0x48062c,_0x5b59ab){if(_0x48062c[_0x1fc6('0x4b')]['id']){delete _0x48062c['body']['id'];}return db[_0x1fc6('0x2c')][_0x1fc6('0x49')]({'where':{'id':_0x48062c['params']['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x5b59ab,null))[_0x1fc6('0x23')](saveUpdates(_0x48062c[_0x1fc6('0x4b')],null))[_0x1fc6('0x23')](respondWithResult(_0x5b59ab,null))['catch'](handleError(_0x5b59ab,null));};exports[_0x1fc6('0x24')]=function(_0x57d863,_0x7a66ba){return db['FreshdeskAccount'][_0x1fc6('0x49')]({'where':{'id':_0x57d863[_0x1fc6('0x47')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x7a66ba,null))['then'](removeEntity(_0x7a66ba,null))[_0x1fc6('0x45')](handleError(_0x7a66ba,null));};exports[_0x1fc6('0x4c')]=function(_0x28f94d,_0x592361,_0x136885){var _0x4a0876={};var _0xe1c5c6={};var _0x59d5e2;var _0x5790a9;return db[_0x1fc6('0x2c')][_0x1fc6('0x4d')]({'where':{'id':_0x28f94d['params']['id']}})['then'](handleEntityNotFound(_0x592361,null))['then'](function(_0x2f203c){if(_0x2f203c){_0x59d5e2=_0x2f203c;_0xe1c5c6[_0x1fc6('0x30')]=_[_0x1fc6('0x32')](db[_0x1fc6('0x4e')][_0x1fc6('0x2d')]);_0xe1c5c6[_0x1fc6('0x31')]=_[_0x1fc6('0x32')](_0x28f94d[_0x1fc6('0x31')]);_0xe1c5c6[_0x1fc6('0x33')]=_[_0x1fc6('0x35')](_0xe1c5c6[_0x1fc6('0x30')],_0xe1c5c6['query']);_0x4a0876[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0xe1c5c6[_0x1fc6('0x30')],qs[_0x1fc6('0x36')](_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x36')]));_0x4a0876[_0x1fc6('0x34')]=_0x4a0876[_0x1fc6('0x34')][_0x1fc6('0x37')]?_0x4a0876[_0x1fc6('0x34')]:_0xe1c5c6[_0x1fc6('0x30')];_0x4a0876[_0x1fc6('0x3a')]=qs['sort'](_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x3b')]);_0x4a0876[_0x1fc6('0x3c')]=qs[_0x1fc6('0x33')](_['pick'](_0x28f94d[_0x1fc6('0x31')],_0xe1c5c6[_0x1fc6('0x33')]));if(_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x3e')]){_0x4a0876[_0x1fc6('0x3c')]=_[_0x1fc6('0x3f')](_0x4a0876['where'],{'$or':_[_0x1fc6('0x2b')](_0x4a0876['attributes'],function(_0x21f125){var _0x1d00fc={};_0x1d00fc[_0x21f125]={'$like':'%'+_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x3e')]+'%'};return _0x1d00fc;})});}_0x4a0876=_[_0x1fc6('0x3f')]({},_0x4a0876,_0x28f94d[_0x1fc6('0x41')]);return _0x59d5e2['getConfigurations'](_0x4a0876);}})[_0x1fc6('0x23')](function(_0x706f1f){if(_0x706f1f){_0x5790a9=_0x706f1f[_0x1fc6('0x37')];if(!_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x38')](_0x1fc6('0x39'))){_0x4a0876[_0x1fc6('0x1c')]=qs[_0x1fc6('0x1c')](_0x28f94d[_0x1fc6('0x31')][_0x1fc6('0x1c')]);_0x4a0876[_0x1fc6('0x1a')]=qs[_0x1fc6('0x1a')](_0x28f94d['query'][_0x1fc6('0x1a')]);}return _0x59d5e2[_0x1fc6('0x4c')](_0x4a0876);}})[_0x1fc6('0x23')](function(_0x1c34ef){if(_0x1c34ef){return _0x1c34ef?{'count':_0x5790a9,'rows':_0x1c34ef}:null;}})['then'](respondWithResult(_0x592361,null))[_0x1fc6('0x45')](handleError(_0x592361,null));};exports[_0x1fc6('0x4f')]=function(_0x107708,_0x204b1c,_0xdf53f6){if(_0x107708[_0x1fc6('0x4b')]['id']){delete _0x107708[_0x1fc6('0x4b')]['id'];}return db[_0x1fc6('0x2c')][_0x1fc6('0x4d')]({'where':{'id':_0x107708[_0x1fc6('0x47')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x204b1c,null))[_0x1fc6('0x23')](function(_0x52d8b0){if(_0x52d8b0){_0x107708['body'][_0x1fc6('0x50')]=_0x52d8b0['id'];_0x107708[_0x1fc6('0x4b')]['Subjects']=integrations[_0x1fc6('0x51')](_0x107708['body'][_0x1fc6('0x52')],_0x107708[_0x1fc6('0x4b')]['type']);_0x107708[_0x1fc6('0x4b')][_0x1fc6('0x53')]=integrations[_0x1fc6('0x54')](_0x107708[_0x1fc6('0x4b')]['channel'],_0x107708[_0x1fc6('0x4b')]['type']);return db[_0x1fc6('0x4e')][_0x1fc6('0x4a')](_0x107708['body'],{'include':[{'model':db[_0x1fc6('0x55')],'as':'Subjects'},{'model':db[_0x1fc6('0x55')],'as':'Descriptions'}]});}return null;})[_0x1fc6('0x23')](respondWithResult(_0x204b1c,null))[_0x1fc6('0x45')](handleError(_0x204b1c,null));};exports[_0x1fc6('0x56')]=function(_0x1abb38,_0x1f3675,_0x1163c9){var _0x157810='';return db[_0x1fc6('0x2c')][_0x1fc6('0x4d')]({'where':{'id':_0x1abb38[_0x1fc6('0x47')]['id']},'attributes':['id','remoteUri',_0x1fc6('0x57')]})[_0x1fc6('0x23')](handleEntityNotFound(_0x1f3675,null))[_0x1fc6('0x23')](function(_0x136950){if(_0x136950){_0x157810=_0x136950['remoteUri'];var _0x4235ac=_0x157810[_0x1fc6('0x58')](-0x1);if(_0x4235ac==='/'){_0x157810=_0x157810[_0x1fc6('0x59')](0x0,_0x157810['lastIndexOf'](_0x4235ac));}return rp({'method':_0x1fc6('0x5a'),'uri':util[_0x1fc6('0x5b')](_0x1fc6('0x5c'),_0x157810,_0x1fc6('0x5d')),'headers':{'Authorization':util[_0x1fc6('0x5b')]('Basic\x20%s',new Buffer(util[_0x1fc6('0x5b')](_0x1fc6('0x5e'),_0x136950[_0x1fc6('0x57')]))[_0x1fc6('0x5f')](_0x1fc6('0x60')))},'json':!![]});}})[_0x1fc6('0x23')](function(_0x269e7d){if(_0x269e7d){var _0x44769d=['requester','subject',_0x1fc6('0x61'),_0x1fc6('0x62'),'status',_0x1fc6('0x63'),_0x1fc6('0x64'),'source',_0x1fc6('0x65'),_0x1fc6('0x64'),_0x1fc6('0x66')];_[_0x1fc6('0x67')](_0x269e7d,function(_0x224ba2){return _0x44769d['includes'](_0x224ba2[_0x1fc6('0x29')])||!_0x224ba2['default']&&_0x224ba2[_0x1fc6('0x2f')]!==_0x1fc6('0x68')&&_0x224ba2['type']!==_0x1fc6('0x69');});return{'count':_0x269e7d['length'],'rows':_[_0x1fc6('0x2b')](_0x269e7d,function(_0x260b75){return{'id':_0x260b75[_0x1fc6('0x29')],'name':_0x260b75['label'],'custom':!_0x260b75[_0x1fc6('0x6a')],'options':_0x260b75['choices']?_[_0x1fc6('0x2b')](_0x260b75[_0x1fc6('0x6b')],function(_0x582b16){return{'name':_[_0x1fc6('0x6c')](_0x582b16),'value':_0x582b16};}):[]};})};}})[_0x1fc6('0x23')](respondWithResult(_0x1f3675,null))[_0x1fc6('0x45')](function(_0x5044b4){var _0x5c44dd=_0x1abb38[_0x1fc6('0x31')][_0x1fc6('0x6d')]?0x1f4:_0x5044b4[_0x1fc6('0x6e')]||0x1f4;logger[_0x1fc6('0x27')](_0x1fc6('0x6f'),_0x1fc6('0x56'),_0x5c44dd,JSON[_0x1fc6('0x70')](_0x5044b4));delete _0x5044b4[_0x1fc6('0x29')];if(_0x5c44dd===0x191){_0x5c44dd=0x190;}_0x1f3675[_0x1fc6('0x18')](_0x5c44dd)['send'](_0x1abb38[_0x1fc6('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5044b4[_0x1fc6('0x6e')]}:_0x5044b4);});}; \ No newline at end of file +var _0x93ed=['requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','length','find','catch','create','body','getConfigurations','params','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x93ed,0xfe));var _0xd93e=function(_0x262ff6,_0x158799){_0x262ff6=_0x262ff6-0x0;var _0x4c9b82=_0x93ed[_0x262ff6];return _0x4c9b82;};'use strict';var emlformat=require(_0xd93e('0x0'));var rimraf=require(_0xd93e('0x1'));var zipdir=require(_0xd93e('0x2'));var jsonpatch=require(_0xd93e('0x3'));var rp=require(_0xd93e('0x4'));var moment=require('moment');var BPromise=require(_0xd93e('0x5'));var Mustache=require('mustache');var util=require(_0xd93e('0x6'));var path=require(_0xd93e('0x7'));var sox=require('sox');var csv=require(_0xd93e('0x8'));var ejs=require(_0xd93e('0x9'));var fs=require('fs');var fs_extra=require(_0xd93e('0xa'));var _=require(_0xd93e('0xb'));var squel=require(_0xd93e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd93e('0xd'));var toCsv=require(_0xd93e('0x8'));var querystring=require(_0xd93e('0xe'));var Papa=require(_0xd93e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd93e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd93e('0x11'));var logger=require(_0xd93e('0x12'))(_0xd93e('0x13'));var utils=require(_0xd93e('0x14'));var config=require(_0xd93e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd93e('0x16'))['db'];var integrations=require(_0xd93e('0x17'));function respondWithStatusCode(_0x444b08,_0x2e4284){_0x2e4284=_0x2e4284||0xcc;return function(_0x2032c7){if(_0x2032c7){return _0x444b08['sendStatus'](_0x2e4284);}return _0x444b08['status'](_0x2e4284)['end']();};}function respondWithResult(_0x567589,_0x1e1ef4){_0x1e1ef4=_0x1e1ef4||0xc8;return function(_0x42eea7){if(_0x42eea7){return _0x567589[_0xd93e('0x18')](_0x1e1ef4)['json'](_0x42eea7);}};}function respondWithFilteredResult(_0xc53b90,_0x490bc0){return function(_0x1826b8){if(_0x1826b8){var _0x164238=typeof _0x490bc0[_0xd93e('0x19')]===_0xd93e('0x1a')&&typeof _0x490bc0[_0xd93e('0x1b')]===_0xd93e('0x1a');var _0x433ced=_0x1826b8['count'];var _0x50c196=_0x164238?0x0:_0x490bc0['offset'];var _0x2e9fff=_0x164238?_0x1826b8[_0xd93e('0x1c')]:_0x490bc0[_0xd93e('0x19')]+_0x490bc0['limit'];var _0x4c1d3a;if(_0x2e9fff>=_0x433ced){_0x2e9fff=_0x433ced;_0x4c1d3a=0xc8;}else{_0x4c1d3a=0xce;}_0xc53b90[_0xd93e('0x18')](_0x4c1d3a);return _0xc53b90[_0xd93e('0x1d')](_0xd93e('0x1e'),_0x50c196+'-'+_0x2e9fff+'/'+_0x433ced)[_0xd93e('0x1f')](_0x1826b8);}return null;};}function patchUpdates(_0x5bc3f9){return function(_0x23b151){try{jsonpatch[_0xd93e('0x20')](_0x23b151,_0x5bc3f9,!![]);}catch(_0x336e14){return BPromise[_0xd93e('0x21')](_0x336e14);}return _0x23b151[_0xd93e('0x22')]();};}function saveUpdates(_0x4909c1,_0x52376d){return function(_0x287e01){if(_0x287e01){return _0x287e01[_0xd93e('0x23')](_0x4909c1)[_0xd93e('0x24')](function(_0xe5553f){return _0xe5553f;});}return null;};}function removeEntity(_0xd74297,_0x128e72){return function(_0xa0bcbe){if(_0xa0bcbe){return _0xa0bcbe[_0xd93e('0x25')]()[_0xd93e('0x24')](function(){_0xd74297[_0xd93e('0x18')](0xcc)[_0xd93e('0x26')]();});}};}function handleEntityNotFound(_0x538a3e,_0xf6c667){return function(_0x50eec4){if(!_0x50eec4){_0x538a3e['sendStatus'](0x194);}return _0x50eec4;};}function handleError(_0x1b2f60,_0x2175ad){_0x2175ad=_0x2175ad||0x1f4;return function(_0x5aaa9a){logger[_0xd93e('0x27')](_0x5aaa9a[_0xd93e('0x28')]);if(_0x5aaa9a[_0xd93e('0x29')]){delete _0x5aaa9a['name'];}_0x1b2f60[_0xd93e('0x18')](_0x2175ad)[_0xd93e('0x2a')](_0x5aaa9a);};}exports['index']=function(_0x2bff6e,_0x131a9c){var _0x49dae={},_0x41c479={},_0x4e4895={'count':0x0,'rows':[]};var _0x519ee8=_['map'](db[_0xd93e('0x2b')][_0xd93e('0x2c')],function(_0x23c1b4){return{'name':_0x23c1b4[_0xd93e('0x2d')],'type':_0x23c1b4[_0xd93e('0x2e')][_0xd93e('0x2f')]};});_0x41c479['model']=_[_0xd93e('0x30')](_0x519ee8,'name');_0x41c479[_0xd93e('0x31')]=_[_0xd93e('0x32')](_0x2bff6e[_0xd93e('0x31')]);_0x41c479[_0xd93e('0x33')]=_[_0xd93e('0x34')](_0x41c479['model'],_0x41c479['query']);_0x49dae['attributes']=_['intersection'](_0x41c479['model'],qs[_0xd93e('0x35')](_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x35')]));_0x49dae['attributes']=_0x49dae[_0xd93e('0x36')]['length']?_0x49dae['attributes']:_0x41c479[_0xd93e('0x37')];if(!_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x38')](_0xd93e('0x39'))){_0x49dae['limit']=qs['limit'](_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x1b')]);_0x49dae[_0xd93e('0x19')]=qs['offset'](_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x19')]);}_0x49dae['order']=qs['sort'](_0x2bff6e['query'][_0xd93e('0x3a')]);_0x49dae[_0xd93e('0x3b')]=qs[_0xd93e('0x33')](_[_0xd93e('0x3c')](_0x2bff6e[_0xd93e('0x31')],_0x41c479[_0xd93e('0x33')]),_0x519ee8);if(_0x2bff6e[_0xd93e('0x31')]['filter']){_0x49dae[_0xd93e('0x3b')]=_['merge'](_0x49dae[_0xd93e('0x3b')],{'$or':_['map'](_0x519ee8,function(_0x35423f){if(_0x35423f[_0xd93e('0x2e')]!=='VIRTUAL'){var _0x341010={};_0x341010[_0x35423f[_0xd93e('0x29')]]={'$like':'%'+_0x2bff6e['query'][_0xd93e('0x3d')]+'%'};return _0x341010;}})});}_0x49dae=_[_0xd93e('0x3e')]({},_0x49dae,_0x2bff6e[_0xd93e('0x3f')]);var _0x5090bb={'where':_0x49dae['where']};return db['FreshdeskAccount'][_0xd93e('0x1c')](_0x5090bb)[_0xd93e('0x24')](function(_0x17a368){_0x4e4895[_0xd93e('0x1c')]=_0x17a368;if(_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x40')]){_0x49dae[_0xd93e('0x41')]=[{'all':!![]}];}return db[_0xd93e('0x2b')]['findAll'](_0x49dae);})[_0xd93e('0x24')](function(_0x5eeee6){_0x4e4895[_0xd93e('0x42')]=_0x5eeee6;return _0x4e4895;})[_0xd93e('0x24')](respondWithFilteredResult(_0x131a9c,_0x49dae))['catch'](handleError(_0x131a9c,null));};exports[_0xd93e('0x43')]=function(_0x3d490d,_0x11d951){var _0x20c463={'raw':![],'where':{'id':_0x3d490d['params']['id']}},_0x2204c3={};_0x2204c3[_0xd93e('0x37')]=_[_0xd93e('0x32')](db[_0xd93e('0x2b')]['rawAttributes']);_0x2204c3[_0xd93e('0x31')]=_['keys'](_0x3d490d['query']);_0x2204c3[_0xd93e('0x33')]=_[_0xd93e('0x34')](_0x2204c3[_0xd93e('0x37')],_0x2204c3['query']);_0x20c463['attributes']=_[_0xd93e('0x34')](_0x2204c3[_0xd93e('0x37')],qs[_0xd93e('0x35')](_0x3d490d[_0xd93e('0x31')]['fields']));_0x20c463['attributes']=_0x20c463[_0xd93e('0x36')][_0xd93e('0x44')]?_0x20c463[_0xd93e('0x36')]:_0x2204c3[_0xd93e('0x37')];if(_0x3d490d[_0xd93e('0x31')][_0xd93e('0x40')]){_0x20c463[_0xd93e('0x41')]=[{'all':!![]}];}_0x20c463=_[_0xd93e('0x3e')]({},_0x20c463,_0x3d490d[_0xd93e('0x3f')]);return db[_0xd93e('0x2b')][_0xd93e('0x45')](_0x20c463)[_0xd93e('0x24')](handleEntityNotFound(_0x11d951,null))[_0xd93e('0x24')](respondWithResult(_0x11d951,null))[_0xd93e('0x46')](handleError(_0x11d951,null));};exports[_0xd93e('0x47')]=function(_0x1624da,_0x543de8){return db[_0xd93e('0x2b')][_0xd93e('0x47')](_0x1624da[_0xd93e('0x48')],{})[_0xd93e('0x24')](respondWithResult(_0x543de8,0xc9))['catch'](handleError(_0x543de8,null));};exports[_0xd93e('0x23')]=function(_0x57ba4f,_0x467b02){if(_0x57ba4f[_0xd93e('0x48')]['id']){delete _0x57ba4f[_0xd93e('0x48')]['id'];}return db[_0xd93e('0x2b')][_0xd93e('0x45')]({'where':{'id':_0x57ba4f['params']['id']}})[_0xd93e('0x24')](handleEntityNotFound(_0x467b02,null))[_0xd93e('0x24')](saveUpdates(_0x57ba4f[_0xd93e('0x48')],null))[_0xd93e('0x24')](respondWithResult(_0x467b02,null))[_0xd93e('0x46')](handleError(_0x467b02,null));};exports['destroy']=function(_0x1d552d,_0xef2705){return db[_0xd93e('0x2b')][_0xd93e('0x45')]({'where':{'id':_0x1d552d['params']['id']}})['then'](handleEntityNotFound(_0xef2705,null))[_0xd93e('0x24')](removeEntity(_0xef2705,null))[_0xd93e('0x46')](handleError(_0xef2705,null));};exports[_0xd93e('0x49')]=function(_0x2e2eed,_0x3d197d,_0x1cc130){var _0x1fa006={};var _0x15f2c1={};var _0x56be38;var _0x4c6eaa;return db[_0xd93e('0x2b')]['findOne']({'where':{'id':_0x2e2eed[_0xd93e('0x4a')]['id']}})[_0xd93e('0x24')](handleEntityNotFound(_0x3d197d,null))[_0xd93e('0x24')](function(_0x2025c9){if(_0x2025c9){_0x56be38=_0x2025c9;_0x15f2c1[_0xd93e('0x37')]=_['keys'](db[_0xd93e('0x4b')]['rawAttributes']);_0x15f2c1[_0xd93e('0x31')]=_[_0xd93e('0x32')](_0x2e2eed[_0xd93e('0x31')]);_0x15f2c1['filters']=_[_0xd93e('0x34')](_0x15f2c1['model'],_0x15f2c1['query']);_0x1fa006[_0xd93e('0x36')]=_[_0xd93e('0x34')](_0x15f2c1[_0xd93e('0x37')],qs[_0xd93e('0x35')](_0x2e2eed[_0xd93e('0x31')]['fields']));_0x1fa006['attributes']=_0x1fa006['attributes']['length']?_0x1fa006[_0xd93e('0x36')]:_0x15f2c1[_0xd93e('0x37')];_0x1fa006['order']=qs[_0xd93e('0x3a')](_0x2e2eed['query'][_0xd93e('0x3a')]);_0x1fa006[_0xd93e('0x3b')]=qs[_0xd93e('0x33')](_[_0xd93e('0x3c')](_0x2e2eed[_0xd93e('0x31')],_0x15f2c1[_0xd93e('0x33')]));if(_0x2e2eed[_0xd93e('0x31')][_0xd93e('0x3d')]){_0x1fa006['where']=_[_0xd93e('0x3e')](_0x1fa006[_0xd93e('0x3b')],{'$or':_[_0xd93e('0x30')](_0x1fa006[_0xd93e('0x36')],function(_0x3278c9){var _0x4b3c5c={};_0x4b3c5c[_0x3278c9]={'$like':'%'+_0x2e2eed[_0xd93e('0x31')][_0xd93e('0x3d')]+'%'};return _0x4b3c5c;})});}_0x1fa006=_[_0xd93e('0x3e')]({},_0x1fa006,_0x2e2eed[_0xd93e('0x3f')]);return _0x56be38['getConfigurations'](_0x1fa006);}})['then'](function(_0x1efb3f){if(_0x1efb3f){_0x4c6eaa=_0x1efb3f[_0xd93e('0x44')];if(!_0x2e2eed[_0xd93e('0x31')][_0xd93e('0x38')](_0xd93e('0x39'))){_0x1fa006[_0xd93e('0x1b')]=qs[_0xd93e('0x1b')](_0x2e2eed['query'][_0xd93e('0x1b')]);_0x1fa006[_0xd93e('0x19')]=qs['offset'](_0x2e2eed[_0xd93e('0x31')]['offset']);}return _0x56be38[_0xd93e('0x49')](_0x1fa006);}})[_0xd93e('0x24')](function(_0x336bc6){if(_0x336bc6){return _0x336bc6?{'count':_0x4c6eaa,'rows':_0x336bc6}:null;}})[_0xd93e('0x24')](respondWithResult(_0x3d197d,null))['catch'](handleError(_0x3d197d,null));};exports[_0xd93e('0x4c')]=function(_0x2e228a,_0x4d701d,_0xc5d319){if(_0x2e228a['body']['id']){delete _0x2e228a[_0xd93e('0x48')]['id'];}return db[_0xd93e('0x2b')][_0xd93e('0x4d')]({'where':{'id':_0x2e228a['params']['id']}})['then'](handleEntityNotFound(_0x4d701d,null))[_0xd93e('0x24')](function(_0x5214e8){if(_0x5214e8){_0x2e228a[_0xd93e('0x48')][_0xd93e('0x4e')]=_0x5214e8['id'];_0x2e228a['body'][_0xd93e('0x4f')]=integrations[_0xd93e('0x50')](_0x2e228a[_0xd93e('0x48')][_0xd93e('0x51')],_0x2e228a['body'][_0xd93e('0x2e')]);_0x2e228a[_0xd93e('0x48')][_0xd93e('0x52')]=integrations['getDescriptions'](_0x2e228a[_0xd93e('0x48')]['channel'],_0x2e228a[_0xd93e('0x48')][_0xd93e('0x2e')]);return db[_0xd93e('0x4b')]['create'](_0x2e228a[_0xd93e('0x48')],{'include':[{'model':db[_0xd93e('0x53')],'as':_0xd93e('0x4f')},{'model':db[_0xd93e('0x53')],'as':_0xd93e('0x52')}]});}return null;})[_0xd93e('0x24')](respondWithResult(_0x4d701d,null))[_0xd93e('0x46')](handleError(_0x4d701d,null));};exports[_0xd93e('0x54')]=function(_0x24de38,_0x12f2ad,_0x27e5c4){var _0x5ecaad='';return db[_0xd93e('0x2b')][_0xd93e('0x4d')]({'where':{'id':_0x24de38[_0xd93e('0x4a')]['id']},'attributes':['id',_0xd93e('0x55'),_0xd93e('0x56')]})['then'](handleEntityNotFound(_0x12f2ad,null))[_0xd93e('0x24')](function(_0xdc1751){if(_0xdc1751){_0x5ecaad=_0xdc1751[_0xd93e('0x55')];var _0x20d88b=_0x5ecaad['slice'](-0x1);if(_0x20d88b==='/'){_0x5ecaad=_0x5ecaad[_0xd93e('0x57')](0x0,_0x5ecaad[_0xd93e('0x58')](_0x20d88b));}return rp({'method':_0xd93e('0x59'),'uri':util['format'](_0xd93e('0x5a'),_0x5ecaad,_0xd93e('0x5b')),'headers':{'Authorization':util[_0xd93e('0x5c')](_0xd93e('0x5d'),new Buffer(util[_0xd93e('0x5c')](_0xd93e('0x5e'),_0xdc1751[_0xd93e('0x56')]))[_0xd93e('0x5f')](_0xd93e('0x60')))},'json':!![]});}})['then'](function(_0xda7ecc){if(_0xda7ecc){var _0x5a6eea=[_0xd93e('0x61'),_0xd93e('0x62'),_0xd93e('0x63'),_0xd93e('0x64'),_0xd93e('0x18'),_0xd93e('0x65'),_0xd93e('0x66'),_0xd93e('0x67'),_0xd93e('0x68'),_0xd93e('0x66'),'company'];_[_0xd93e('0x69')](_0xda7ecc,function(_0x3b6512){return _0x5a6eea[_0xd93e('0x6a')](_0x3b6512['name'])||!_0x3b6512[_0xd93e('0x6b')]&&_0x3b6512[_0xd93e('0x2e')]!==_0xd93e('0x6c')&&_0x3b6512[_0xd93e('0x2e')]!==_0xd93e('0x6d');});return{'count':_0xda7ecc[_0xd93e('0x44')],'rows':_[_0xd93e('0x30')](_0xda7ecc,function(_0x5c1581){return{'id':_0x5c1581[_0xd93e('0x29')],'name':_0x5c1581[_0xd93e('0x6e')],'custom':!_0x5c1581[_0xd93e('0x6b')],'options':_0x5c1581[_0xd93e('0x6f')]?_['map'](_0x5c1581['choices'],function(_0x18add0){return{'name':_[_0xd93e('0x70')](_0x18add0),'value':_0x18add0};}):[]};})};}})[_0xd93e('0x24')](respondWithResult(_0x12f2ad,null))[_0xd93e('0x46')](function(_0x54ce9a){var _0x45c0ac=_0x24de38['query'][_0xd93e('0x71')]?0x1f4:_0x54ce9a[_0xd93e('0x72')]||0x1f4;logger[_0xd93e('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xd93e('0x54'),_0x45c0ac,JSON[_0xd93e('0x73')](_0x54ce9a));delete _0x54ce9a['name'];if(_0x45c0ac===0x191){_0x45c0ac=0x190;}_0x12f2ad[_0xd93e('0x18')](_0x45c0ac)[_0xd93e('0x2a')](_0x24de38[_0xd93e('0x31')][_0xd93e('0x71')]?{'message':_0xd93e('0x74'),'statusCode':_0x54ce9a[_0xd93e('0x72')]}:_0x54ce9a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c943616..990b310 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 _0xad89=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xad89,0xbd));var _0x9ad8=function(_0x1406c8,_0x40a801){_0x1406c8=_0x1406c8-0x0;var _0x3ec6f8=_0xad89[_0x1406c8];return _0x3ec6f8;};'use strict';var _=require('lodash');var util=require(_0x9ad8('0x0'));var logger=require(_0x9ad8('0x1'))(_0x9ad8('0x2'));var moment=require(_0x9ad8('0x3'));var BPromise=require(_0x9ad8('0x4'));var rp=require(_0x9ad8('0x5'));var fs=require('fs');var path=require(_0x9ad8('0x6'));var rimraf=require(_0x9ad8('0x7'));var config=require(_0x9ad8('0x8'));var attributes=require(_0x9ad8('0x9'));var integrations=require(_0x9ad8('0xa'));module['exports']=function(_0x122e4a,_0x49def4){return _0x122e4a['define'](_0x9ad8('0xb'),attributes,{'tableName':_0x9ad8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eee=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x0eee,0xa7));var _0xe0ee=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x0eee[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xe0ee('0x0'));var util=require(_0xe0ee('0x1'));var logger=require(_0xe0ee('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe0ee('0x3'));var rp=require(_0xe0ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe0ee('0x5'));var attributes=require(_0xe0ee('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xe0ee('0x7')]=function(_0x4a0c91,_0x531e8b){return _0x4a0c91[_0xe0ee('0x8')](_0xe0ee('0x9'),attributes,{'tableName':_0xe0ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f8fae26..b268415 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 _0x4f80=['map','then','debug','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model'];(function(_0x45ab70,_0x46f754){var _0x4e93bb=function(_0x4e6a56){while(--_0x4e6a56){_0x45ab70['push'](_0x45ab70['shift']());}};_0x4e93bb(++_0x46f754);}(_0x4f80,0xcb));var _0x04f8=function(_0x168120,_0x4e19de){_0x168120=_0x168120-0x0;var _0x5c827e=_0x4f80[_0x168120];return _0x5c827e;};'use strict';var _=require(_0x04f8('0x0'));var util=require(_0x04f8('0x1'));var moment=require(_0x04f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x04f8('0x3'));var fs=require('fs');var Redis=require(_0x04f8('0x4'));var db=require(_0x04f8('0x5'))['db'];var utils=require(_0x04f8('0x6'));var logger=require(_0x04f8('0x7'))(_0x04f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x04f8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x255cd0,_0x5baa79,_0x201be1){return new BPromise(function(_0x3a77d6,_0x331679){return client['request'](_0x255cd0,_0x201be1)['then'](function(_0x3f7534){logger[_0x04f8('0xa')](_0x04f8('0xb'),_0x5baa79,_0x04f8('0xc'));logger['debug'](_0x04f8('0xd'),_0x5baa79,'request\x20sent',JSON['stringify'](_0x3f7534));if(_0x3f7534[_0x04f8('0xe')]){if(_0x3f7534[_0x04f8('0xe')][_0x04f8('0xf')]===0x1f4){logger['error'](_0x04f8('0xb'),_0x5baa79,_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);return _0x331679(_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);}logger['error'](_0x04f8('0xb'),_0x5baa79,_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);return _0x3a77d6(_0x3f7534[_0x04f8('0xe')][_0x04f8('0x10')]);}else{logger[_0x04f8('0xa')](_0x04f8('0xb'),_0x5baa79,_0x04f8('0xc'));_0x3a77d6(_0x3f7534[_0x04f8('0x11')][_0x04f8('0x10')]);}})[_0x04f8('0x12')](function(_0x3c73de){logger[_0x04f8('0xe')](_0x04f8('0xb'),_0x5baa79,_0x3c73de);_0x331679(_0x3c73de);});});}exports[_0x04f8('0x13')]=function(_0x1cd7c6){var _0x52c30d=this;return new Promise(function(_0x3a10d1,_0x400319){return db[_0x04f8('0x14')][_0x04f8('0x15')]({'raw':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6['options'][_0x04f8('0x17')]===undefined?!![]:![]:!![],'where':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6['options']['where']||null:null,'attributes':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x18')]||null:null,'limit':_0x1cd7c6['options']?_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x19')]||null:null,'include':_0x1cd7c6[_0x04f8('0x16')]?_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x1a')]?_['map'](_0x1cd7c6[_0x04f8('0x16')][_0x04f8('0x1a')],function(_0x59cbec){return{'model':db[_0x59cbec[_0x04f8('0x1b')]],'as':_0x59cbec['as'],'attributes':_0x59cbec[_0x04f8('0x18')],'include':_0x59cbec[_0x04f8('0x1a')]?_[_0x04f8('0x1c')](_0x59cbec[_0x04f8('0x1a')],function(_0x7d8616){return{'model':db[_0x7d8616[_0x04f8('0x1b')]],'as':_0x7d8616['as'],'attributes':_0x7d8616[_0x04f8('0x18')],'include':_0x7d8616['include']?_[_0x04f8('0x1c')](_0x7d8616[_0x04f8('0x1a')],function(_0x18c6cf){return{'model':db[_0x18c6cf[_0x04f8('0x1b')]],'as':_0x18c6cf['as'],'attributes':_0x18c6cf[_0x04f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x04f8('0x1d')](function(_0x53ebe2){logger['info']('GetFreshdeskAccount',_0x1cd7c6);logger[_0x04f8('0x1e')](_0x04f8('0x13'),_0x1cd7c6,JSON['stringify'](_0x53ebe2));_0x3a10d1(_0x53ebe2);})['catch'](function(_0x273707){logger[_0x04f8('0xe')](_0x04f8('0x13'),_0x273707[_0x04f8('0x10')],_0x1cd7c6);_0x400319(_0x52c30d[_0x04f8('0xe')](0x1f4,_0x273707[_0x04f8('0x10')]));});});};exports[_0x04f8('0x1f')]=function(_0x12f706){var _0x5cb637=this;return new Promise(function(_0x59e7d7,_0x2e507d){return db[_0x04f8('0x14')][_0x04f8('0x20')]({'raw':_0x12f706['options']?_0x12f706[_0x04f8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x12f706[_0x04f8('0x16')]?_0x12f706[_0x04f8('0x16')]['where']||null:null,'attributes':_0x12f706[_0x04f8('0x16')]?_0x12f706[_0x04f8('0x16')]['attributes']||null:null,'include':_0x12f706[_0x04f8('0x16')]?_0x12f706[_0x04f8('0x16')][_0x04f8('0x1a')]?_['map'](_0x12f706[_0x04f8('0x16')][_0x04f8('0x1a')],function(_0x293f63){return{'model':db[_0x293f63[_0x04f8('0x1b')]],'as':_0x293f63['as'],'attributes':_0x293f63[_0x04f8('0x18')],'include':_0x293f63[_0x04f8('0x1a')]?_[_0x04f8('0x1c')](_0x293f63[_0x04f8('0x1a')],function(_0x8922f0){return{'model':db[_0x8922f0[_0x04f8('0x1b')]],'as':_0x8922f0['as'],'attributes':_0x8922f0[_0x04f8('0x18')],'include':_0x8922f0[_0x04f8('0x1a')]?_['map'](_0x8922f0['include'],function(_0x40dd76){return{'model':db[_0x40dd76[_0x04f8('0x1b')]],'as':_0x40dd76['as'],'attributes':_0x40dd76[_0x04f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x04f8('0x1d')](function(_0x3a797c){logger[_0x04f8('0xa')]('ShowFreshdeskAccount',_0x12f706);logger['debug']('ShowFreshdeskAccount',_0x12f706,JSON['stringify'](_0x3a797c));_0x59e7d7(_0x3a797c);})[_0x04f8('0x12')](function(_0x2cf99a){logger[_0x04f8('0xe')](_0x04f8('0x1f'),_0x2cf99a[_0x04f8('0x10')],_0x12f706);_0x2e507d(_0x5cb637[_0x04f8('0xe')](0x1f4,_0x2cf99a[_0x04f8('0x10')]));});});}; \ No newline at end of file +var _0x5a05=['map','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount','findAll','options','raw','limit','include','model','attributes'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x5a05,0x93));var _0x55a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a05[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x55a0('0x0'));var util=require(_0x55a0('0x1'));var moment=require(_0x55a0('0x2'));var BPromise=require(_0x55a0('0x3'));var rs=require(_0x55a0('0x4'));var fs=require('fs');var Redis=require(_0x55a0('0x5'));var db=require(_0x55a0('0x6'))['db'];var utils=require(_0x55a0('0x7'));var logger=require(_0x55a0('0x8'))(_0x55a0('0x9'));var config=require(_0x55a0('0xa'));var jayson=require(_0x55a0('0xb'));var client=jayson[_0x55a0('0xc')][_0x55a0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x551c26,_0x51e054,_0x4ec00d){return new BPromise(function(_0x25e52f,_0x20d2c7){return client[_0x55a0('0xe')](_0x551c26,_0x4ec00d)[_0x55a0('0xf')](function(_0x4a9e95){logger[_0x55a0('0x10')](_0x55a0('0x11'),_0x51e054,_0x55a0('0x12'));logger[_0x55a0('0x13')](_0x55a0('0x14'),_0x51e054,_0x55a0('0x12'),JSON[_0x55a0('0x15')](_0x4a9e95));if(_0x4a9e95[_0x55a0('0x16')]){if(_0x4a9e95[_0x55a0('0x16')][_0x55a0('0x17')]===0x1f4){logger[_0x55a0('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0x51e054,_0x4a9e95[_0x55a0('0x16')][_0x55a0('0x18')]);return _0x20d2c7(_0x4a9e95['error']['message']);}logger[_0x55a0('0x16')](_0x55a0('0x11'),_0x51e054,_0x4a9e95[_0x55a0('0x16')]['message']);return _0x25e52f(_0x4a9e95['error'][_0x55a0('0x18')]);}else{logger['info'](_0x55a0('0x11'),_0x51e054,_0x55a0('0x12'));_0x25e52f(_0x4a9e95['result'][_0x55a0('0x18')]);}})['catch'](function(_0x5840af){logger[_0x55a0('0x16')](_0x55a0('0x11'),_0x51e054,_0x5840af);_0x20d2c7(_0x5840af);});});}exports['GetFreshdeskAccount']=function(_0x3f70a6){var _0x522386=this;return new Promise(function(_0x1c47d0,_0x199f80){return db[_0x55a0('0x19')][_0x55a0('0x1a')]({'raw':_0x3f70a6[_0x55a0('0x1b')]?_0x3f70a6[_0x55a0('0x1b')][_0x55a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f70a6[_0x55a0('0x1b')]?_0x3f70a6[_0x55a0('0x1b')]['where']||null:null,'attributes':_0x3f70a6[_0x55a0('0x1b')]?_0x3f70a6[_0x55a0('0x1b')]['attributes']||null:null,'limit':_0x3f70a6['options']?_0x3f70a6[_0x55a0('0x1b')][_0x55a0('0x1d')]||null:null,'include':_0x3f70a6['options']?_0x3f70a6[_0x55a0('0x1b')][_0x55a0('0x1e')]?_['map'](_0x3f70a6[_0x55a0('0x1b')][_0x55a0('0x1e')],function(_0x25c9a3){return{'model':db[_0x25c9a3[_0x55a0('0x1f')]],'as':_0x25c9a3['as'],'attributes':_0x25c9a3[_0x55a0('0x20')],'include':_0x25c9a3[_0x55a0('0x1e')]?_[_0x55a0('0x21')](_0x25c9a3['include'],function(_0x17442d){return{'model':db[_0x17442d['model']],'as':_0x17442d['as'],'attributes':_0x17442d[_0x55a0('0x20')],'include':_0x17442d[_0x55a0('0x1e')]?_[_0x55a0('0x21')](_0x17442d[_0x55a0('0x1e')],function(_0x281a0b){return{'model':db[_0x281a0b[_0x55a0('0x1f')]],'as':_0x281a0b['as'],'attributes':_0x281a0b['attributes']};}):[]};}):[]};}):[]:[]})[_0x55a0('0xf')](function(_0x529f88){logger['info']('GetFreshdeskAccount',_0x3f70a6);logger['debug'](_0x55a0('0x22'),_0x3f70a6,JSON[_0x55a0('0x15')](_0x529f88));_0x1c47d0(_0x529f88);})['catch'](function(_0x456cf9){logger['error']('GetFreshdeskAccount',_0x456cf9[_0x55a0('0x18')],_0x3f70a6);_0x199f80(_0x522386[_0x55a0('0x16')](0x1f4,_0x456cf9[_0x55a0('0x18')]));});});};exports[_0x55a0('0x23')]=function(_0x3397d7){var _0x2dc989=this;return new Promise(function(_0x51a34a,_0x24ee1b){return db[_0x55a0('0x19')]['find']({'raw':_0x3397d7[_0x55a0('0x1b')]?_0x3397d7[_0x55a0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3397d7[_0x55a0('0x1b')]?_0x3397d7['options']['where']||null:null,'attributes':_0x3397d7[_0x55a0('0x1b')]?_0x3397d7[_0x55a0('0x1b')][_0x55a0('0x20')]||null:null,'include':_0x3397d7['options']?_0x3397d7[_0x55a0('0x1b')][_0x55a0('0x1e')]?_['map'](_0x3397d7[_0x55a0('0x1b')][_0x55a0('0x1e')],function(_0x30a81d){return{'model':db[_0x30a81d[_0x55a0('0x1f')]],'as':_0x30a81d['as'],'attributes':_0x30a81d['attributes'],'include':_0x30a81d['include']?_[_0x55a0('0x21')](_0x30a81d[_0x55a0('0x1e')],function(_0x19bdba){return{'model':db[_0x19bdba[_0x55a0('0x1f')]],'as':_0x19bdba['as'],'attributes':_0x19bdba[_0x55a0('0x20')],'include':_0x19bdba['include']?_[_0x55a0('0x21')](_0x19bdba[_0x55a0('0x1e')],function(_0x3ab092){return{'model':db[_0x3ab092['model']],'as':_0x3ab092['as'],'attributes':_0x3ab092[_0x55a0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x55a0('0xf')](function(_0x49b9d9){logger[_0x55a0('0x10')](_0x55a0('0x23'),_0x3397d7);logger[_0x55a0('0x13')](_0x55a0('0x23'),_0x3397d7,JSON['stringify'](_0x49b9d9));_0x51a34a(_0x49b9d9);})['catch'](function(_0x5d89e9){logger[_0x55a0('0x16')](_0x55a0('0x23'),_0x5d89e9[_0x55a0('0x18')],_0x3397d7);_0x24ee1b(_0x2dc989[_0x55a0('0x16')](0x1f4,_0x5d89e9[_0x55a0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b89c878..878f389 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 _0x35b7=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','destroy','exports'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x35b7,0x17a));var _0x735b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x35b7[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0x735b('0x0'));var util=require(_0x735b('0x1'));var path=require('path');var timeout=require(_0x735b('0x2'));var express=require(_0x735b('0x3'));var router=express['Router']();var fs_extra=require(_0x735b('0x4'));var auth=require(_0x735b('0x5'));var interaction=require(_0x735b('0x6'));var config=require('../../config/environment');var controller=require(_0x735b('0x7'));router['get']('/',auth[_0x735b('0x8')](),controller[_0x735b('0x9')]);router[_0x735b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x735b('0xb')]);router[_0x735b('0xa')](_0x735b('0xc'),auth[_0x735b('0x8')](),controller[_0x735b('0xd')]);router[_0x735b('0xa')]('/:id/subjects',auth[_0x735b('0x8')](),controller[_0x735b('0xe')]);router[_0x735b('0xa')](_0x735b('0xf'),auth['isAuthenticated'](),controller[_0x735b('0x10')]);router[_0x735b('0xa')](_0x735b('0x11'),auth[_0x735b('0x8')](),controller[_0x735b('0x12')]);router[_0x735b('0x13')]('/',auth[_0x735b('0x8')](),controller[_0x735b('0x14')]);router['post'](_0x735b('0x11'),auth['isAuthenticated'](),controller[_0x735b('0x15')]);router[_0x735b('0x16')](_0x735b('0x17'),auth[_0x735b('0x8')](),controller[_0x735b('0x18')]);router['delete'](_0x735b('0x17'),auth[_0x735b('0x8')](),controller[_0x735b('0x19')]);module[_0x735b('0x1a')]=router; \ No newline at end of file +var _0xa913=['/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get'];(function(_0xc2dccb,_0x5957f2){var _0x3239b3=function(_0x58f337){while(--_0x58f337){_0xc2dccb['push'](_0xc2dccb['shift']());}};_0x3239b3(++_0x5957f2);}(_0xa913,0x84));var _0x3a91=function(_0x3875fc,_0x1dd545){_0x3875fc=_0x3875fc-0x0;var _0x55f8b2=_0xa913[_0x3875fc];return _0x55f8b2;};'use strict';var multer=require(_0x3a91('0x0'));var util=require('util');var path=require(_0x3a91('0x1'));var timeout=require(_0x3a91('0x2'));var express=require(_0x3a91('0x3'));var router=express[_0x3a91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3a91('0x5'));var interaction=require(_0x3a91('0x6'));var config=require(_0x3a91('0x7'));var controller=require(_0x3a91('0x8'));router['get']('/',auth[_0x3a91('0x9')](),controller[_0x3a91('0xa')]);router[_0x3a91('0xb')](_0x3a91('0xc'),auth[_0x3a91('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0x3a91('0x9')](),controller[_0x3a91('0xd')]);router[_0x3a91('0xb')]('/:id/subjects',auth[_0x3a91('0x9')](),controller[_0x3a91('0xe')]);router[_0x3a91('0xb')](_0x3a91('0xf'),auth['isAuthenticated'](),controller[_0x3a91('0x10')]);router['get'](_0x3a91('0x11'),auth[_0x3a91('0x9')](),controller[_0x3a91('0x12')]);router[_0x3a91('0x13')]('/',auth['isAuthenticated'](),controller[_0x3a91('0x14')]);router[_0x3a91('0x13')](_0x3a91('0x11'),auth[_0x3a91('0x9')](),controller['setTags']);router['put'](_0x3a91('0xc'),auth[_0x3a91('0x9')](),controller['update']);router[_0x3a91('0x15')](_0x3a91('0xc'),auth['isAuthenticated'](),controller[_0x3a91('0x16')]);module[_0x3a91('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9cabb24..97a8ecc 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 _0x6419=['STRING','exports'];(function(_0x1338d8,_0x2537d0){var _0xe67cd5=function(_0x144ecc){while(--_0x144ecc){_0x1338d8['push'](_0x1338d8['shift']());}};_0xe67cd5(++_0x2537d0);}(_0x6419,0x1e5));var _0x9641=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6419[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x9641('0x0')]={'name':{'type':Sequelize[_0x9641('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe04e=['STRING','sequelize','exports'];(function(_0x50b5de,_0x1234ff){var _0x1770ca=function(_0x9d8bad){while(--_0x9d8bad){_0x50b5de['push'](_0x50b5de['shift']());}};_0x1770ca(++_0x1234ff);}(_0xe04e,0x160));var _0xee04=function(_0x134693,_0x529985){_0x134693=_0x134693-0x0;var _0xc1665b=_0xe04e[_0x134693];return _0xc1665b;};'use strict';var Sequelize=require(_0xee04('0x0'));module[_0xee04('0x1')]={'name':{'type':Sequelize[_0xee04('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f641978..cad35ac 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 _0x8b93=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','getFields','findOne','FreshdeskField','merge','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8b93,0xc5));var _0x38b9=function(_0x5c897d,_0x2c7b3f){_0x5c897d=_0x5c897d-0x0;var _0x3ccf42=_0x8b93[_0x5c897d];return _0x3ccf42;};'use strict';var emlformat=require(_0x38b9('0x0'));var rimraf=require(_0x38b9('0x1'));var zipdir=require(_0x38b9('0x2'));var jsonpatch=require(_0x38b9('0x3'));var rp=require(_0x38b9('0x4'));var moment=require(_0x38b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x38b9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x38b9('0x7'));var csv=require(_0x38b9('0x8'));var ejs=require(_0x38b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38b9('0xa'));var squel=require(_0x38b9('0xb'));var crypto=require(_0x38b9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38b9('0x8'));var querystring=require('querystring');var Papa=require(_0x38b9('0xd'));var Redis=require('ioredis');var authService=require(_0x38b9('0xe'));var qs=require(_0x38b9('0xf'));var as=require(_0x38b9('0x10'));var hardwareService=require(_0x38b9('0x11'));var logger=require(_0x38b9('0x12'))('api');var utils=require(_0x38b9('0x13'));var config=require(_0x38b9('0x14'));var licenseUtil=require(_0x38b9('0x15'));var db=require(_0x38b9('0x16'))['db'];function respondWithStatusCode(_0x5a2b64,_0x1d09de){_0x1d09de=_0x1d09de||0xcc;return function(_0x2aca86){if(_0x2aca86){return _0x5a2b64[_0x38b9('0x17')](_0x1d09de);}return _0x5a2b64[_0x38b9('0x18')](_0x1d09de)[_0x38b9('0x19')]();};}function respondWithResult(_0x173865,_0x1d9188){_0x1d9188=_0x1d9188||0xc8;return function(_0x41852c){if(_0x41852c){return _0x173865[_0x38b9('0x18')](_0x1d9188)['json'](_0x41852c);}};}function respondWithFilteredResult(_0x4734ca,_0x4f829e){return function(_0x9abaea){if(_0x9abaea){var _0x3563ff=typeof _0x4f829e['offset']===_0x38b9('0x1a')&&typeof _0x4f829e[_0x38b9('0x1b')]===_0x38b9('0x1a');var _0x5a56d0=_0x9abaea[_0x38b9('0x1c')];var _0x171a36=_0x3563ff?0x0:_0x4f829e['offset'];var _0x371653=_0x3563ff?_0x9abaea[_0x38b9('0x1c')]:_0x4f829e[_0x38b9('0x1d')]+_0x4f829e[_0x38b9('0x1b')];var _0x2b9953;if(_0x371653>=_0x5a56d0){_0x371653=_0x5a56d0;_0x2b9953=0xc8;}else{_0x2b9953=0xce;}_0x4734ca['status'](_0x2b9953);return _0x4734ca[_0x38b9('0x1e')]('Content-Range',_0x171a36+'-'+_0x371653+'/'+_0x5a56d0)[_0x38b9('0x1f')](_0x9abaea);}return null;};}function patchUpdates(_0x40f1cb){return function(_0x3e5dd3){try{jsonpatch[_0x38b9('0x20')](_0x3e5dd3,_0x40f1cb,!![]);}catch(_0x24b572){return BPromise[_0x38b9('0x21')](_0x24b572);}return _0x3e5dd3[_0x38b9('0x22')]();};}function saveUpdates(_0x1d88c8,_0x42acd4){return function(_0xbef657){if(_0xbef657){return _0xbef657[_0x38b9('0x23')](_0x1d88c8)[_0x38b9('0x24')](function(_0x403a25){return _0x403a25;});}return null;};}function removeEntity(_0x3a98b0,_0xb2e17a){return function(_0x2b5f57){if(_0x2b5f57){return _0x2b5f57['destroy']()[_0x38b9('0x24')](function(){_0x3a98b0[_0x38b9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cf23,_0x361b85){return function(_0x198a3f){if(!_0x198a3f){_0x16cf23[_0x38b9('0x17')](0x194);}return _0x198a3f;};}function handleError(_0x1d3ad6,_0x4b5e2e){_0x4b5e2e=_0x4b5e2e||0x1f4;return function(_0x4e4bb8){logger[_0x38b9('0x25')](_0x4e4bb8[_0x38b9('0x26')]);if(_0x4e4bb8['name']){delete _0x4e4bb8[_0x38b9('0x27')];}_0x1d3ad6[_0x38b9('0x18')](_0x4b5e2e)[_0x38b9('0x28')](_0x4e4bb8);};}exports['index']=function(_0x19fabd,_0x1859ce){var _0xd4b33b={},_0x30e13b={},_0x16ef52={'count':0x0,'rows':[]};var _0x16e95c=_[_0x38b9('0x29')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x158adb){return{'name':_0x158adb[_0x38b9('0x2a')],'type':_0x158adb[_0x38b9('0x2b')][_0x38b9('0x2c')]};});_0x30e13b[_0x38b9('0x2d')]=_[_0x38b9('0x29')](_0x16e95c,_0x38b9('0x27'));_0x30e13b[_0x38b9('0x2e')]=_[_0x38b9('0x2f')](_0x19fabd['query']);_0x30e13b[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x30e13b[_0x38b9('0x2d')],_0x30e13b[_0x38b9('0x2e')]);_0xd4b33b[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x30e13b[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x33')]));_0xd4b33b['attributes']=_0xd4b33b[_0x38b9('0x32')][_0x38b9('0x34')]?_0xd4b33b['attributes']:_0x30e13b['model'];if(!_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x35')](_0x38b9('0x36'))){_0xd4b33b[_0x38b9('0x1b')]=qs['limit'](_0x19fabd['query'][_0x38b9('0x1b')]);_0xd4b33b[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x19fabd[_0x38b9('0x2e')]['offset']);}_0xd4b33b[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x19fabd[_0x38b9('0x2e')]['sort']);_0xd4b33b[_0x38b9('0x39')]=qs['filters'](_[_0x38b9('0x3a')](_0x19fabd['query'],_0x30e13b['filters']),_0x16e95c);if(_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0xd4b33b['where']=_['merge'](_0xd4b33b[_0x38b9('0x39')],{'$or':_['map'](_0x16e95c,function(_0x2a7ee9){if(_0x2a7ee9[_0x38b9('0x2b')]!==_0x38b9('0x3c')){var _0x388b88={};_0x388b88[_0x2a7ee9['name']]={'$like':'%'+_0x19fabd[_0x38b9('0x2e')]['filter']+'%'};return _0x388b88;}})});}_0xd4b33b=_['merge']({},_0xd4b33b,_0x19fabd[_0x38b9('0x3d')]);var _0x26dfe7={'where':_0xd4b33b[_0x38b9('0x39')]};return db[_0x38b9('0x3e')][_0x38b9('0x1c')](_0x26dfe7)[_0x38b9('0x24')](function(_0x2ff9d8){_0x16ef52[_0x38b9('0x1c')]=_0x2ff9d8;if(_0x19fabd[_0x38b9('0x2e')][_0x38b9('0x3f')]){_0xd4b33b[_0x38b9('0x40')]=[{'all':!![]}];}return db[_0x38b9('0x3e')][_0x38b9('0x41')](_0xd4b33b);})['then'](function(_0x383c8b){_0x16ef52[_0x38b9('0x42')]=_0x383c8b;return _0x16ef52;})[_0x38b9('0x24')](respondWithFilteredResult(_0x1859ce,_0xd4b33b))[_0x38b9('0x43')](handleError(_0x1859ce,null));};exports['show']=function(_0x3deda4,_0x213069){var _0x5b7f77={'raw':![],'where':{'id':_0x3deda4[_0x38b9('0x44')]['id']}},_0x15adf0={};_0x15adf0[_0x38b9('0x2d')]=_[_0x38b9('0x2f')](db[_0x38b9('0x3e')][_0x38b9('0x45')]);_0x15adf0['query']=_['keys'](_0x3deda4[_0x38b9('0x2e')]);_0x15adf0[_0x38b9('0x30')]=_['intersection'](_0x15adf0[_0x38b9('0x2d')],_0x15adf0[_0x38b9('0x2e')]);_0x5b7f77[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x15adf0[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x3deda4[_0x38b9('0x2e')][_0x38b9('0x33')]));_0x5b7f77[_0x38b9('0x32')]=_0x5b7f77['attributes'][_0x38b9('0x34')]?_0x5b7f77[_0x38b9('0x32')]:_0x15adf0[_0x38b9('0x2d')];if(_0x3deda4[_0x38b9('0x2e')][_0x38b9('0x3f')]){_0x5b7f77[_0x38b9('0x40')]=[{'all':!![]}];}_0x5b7f77=_['merge']({},_0x5b7f77,_0x3deda4[_0x38b9('0x3d')]);return db[_0x38b9('0x3e')][_0x38b9('0x46')](_0x5b7f77)[_0x38b9('0x24')](handleEntityNotFound(_0x213069,null))[_0x38b9('0x24')](respondWithResult(_0x213069,null))[_0x38b9('0x43')](handleError(_0x213069,null));};exports[_0x38b9('0x47')]=function(_0x2f5552,_0x2009a5){return db['FreshdeskConfiguration']['create'](_0x2f5552['body'],{})['then'](respondWithResult(_0x2009a5,0xc9))['catch'](handleError(_0x2009a5,null));};exports[_0x38b9('0x23')]=function(_0x3abf37,_0x4fb254){if(_0x3abf37['body']['id']){delete _0x3abf37[_0x38b9('0x48')]['id'];}return db[_0x38b9('0x3e')][_0x38b9('0x46')]({'where':{'id':_0x3abf37[_0x38b9('0x44')]['id']}})[_0x38b9('0x24')](handleEntityNotFound(_0x4fb254,null))[_0x38b9('0x24')](saveUpdates(_0x3abf37[_0x38b9('0x48')],null))[_0x38b9('0x24')](respondWithResult(_0x4fb254,null))[_0x38b9('0x43')](handleError(_0x4fb254,null));};exports[_0x38b9('0x49')]=function(_0x501d65,_0x35ff47){return db['FreshdeskConfiguration'][_0x38b9('0x46')]({'where':{'id':_0x501d65[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x35ff47,null))['then'](removeEntity(_0x35ff47,null))[_0x38b9('0x43')](handleError(_0x35ff47,null));};exports[_0x38b9('0x4a')]=function(_0x2e0b4e,_0x45bd70,_0x376643){var _0x589da5={};var _0x52510b={};var _0x36f5be;var _0x2d2e23;return db[_0x38b9('0x3e')][_0x38b9('0x4b')]({'where':{'id':_0x2e0b4e[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x45bd70,null))[_0x38b9('0x24')](function(_0x3ddcdb){if(_0x3ddcdb){_0x36f5be=_0x3ddcdb;_0x52510b['model']=_[_0x38b9('0x2f')](db[_0x38b9('0x4c')][_0x38b9('0x45')]);_0x52510b['query']=_[_0x38b9('0x2f')](_0x2e0b4e['query']);_0x52510b[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x52510b['model'],_0x52510b['query']);_0x589da5[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x52510b[_0x38b9('0x2d')],qs['fields'](_0x2e0b4e[_0x38b9('0x2e')]['fields']));_0x589da5['attributes']=_0x589da5[_0x38b9('0x32')][_0x38b9('0x34')]?_0x589da5[_0x38b9('0x32')]:_0x52510b[_0x38b9('0x2d')];_0x589da5[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x2e0b4e[_0x38b9('0x2e')][_0x38b9('0x38')]);_0x589da5[_0x38b9('0x39')]=qs[_0x38b9('0x30')](_[_0x38b9('0x3a')](_0x2e0b4e[_0x38b9('0x2e')],_0x52510b['filters']));if(_0x2e0b4e[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0x589da5[_0x38b9('0x39')]=_['merge'](_0x589da5['where'],{'$or':_[_0x38b9('0x29')](_0x589da5[_0x38b9('0x32')],function(_0x105a11){var _0x3874e5={};_0x3874e5[_0x105a11]={'$like':'%'+_0x2e0b4e[_0x38b9('0x2e')]['filter']+'%'};return _0x3874e5;})});}_0x589da5=_[_0x38b9('0x4d')]({},_0x589da5,_0x2e0b4e[_0x38b9('0x3d')]);return _0x36f5be[_0x38b9('0x4a')](_0x589da5);}})[_0x38b9('0x24')](function(_0x4d0f18){if(_0x4d0f18){_0x2d2e23=_0x4d0f18[_0x38b9('0x34')];if(!_0x2e0b4e[_0x38b9('0x2e')]['hasOwnProperty'](_0x38b9('0x36'))){_0x589da5[_0x38b9('0x1b')]=qs['limit'](_0x2e0b4e[_0x38b9('0x2e')][_0x38b9('0x1b')]);_0x589da5[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x2e0b4e[_0x38b9('0x2e')]['offset']);}return _0x36f5be[_0x38b9('0x4a')](_0x589da5);}})[_0x38b9('0x24')](function(_0x3d876d){if(_0x3d876d){return _0x3d876d?{'count':_0x2d2e23,'rows':_0x3d876d}:null;}})[_0x38b9('0x24')](respondWithResult(_0x45bd70,null))[_0x38b9('0x43')](handleError(_0x45bd70,null));};exports[_0x38b9('0x4e')]=function(_0x441e55,_0x114196,_0x487eec){var _0x5a3367={};var _0x1b6f7a={};var _0x542a6b;var _0x2256a6;return db[_0x38b9('0x3e')][_0x38b9('0x4b')]({'where':{'id':_0x441e55[_0x38b9('0x44')]['id']}})[_0x38b9('0x24')](handleEntityNotFound(_0x114196,null))[_0x38b9('0x24')](function(_0x1bd13a){if(_0x1bd13a){_0x542a6b=_0x1bd13a;_0x1b6f7a[_0x38b9('0x2d')]=_['keys'](db[_0x38b9('0x4c')][_0x38b9('0x45')]);_0x1b6f7a[_0x38b9('0x2e')]=_[_0x38b9('0x2f')](_0x441e55[_0x38b9('0x2e')]);_0x1b6f7a[_0x38b9('0x30')]=_['intersection'](_0x1b6f7a['model'],_0x1b6f7a['query']);_0x5a3367[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x1b6f7a[_0x38b9('0x2d')],qs['fields'](_0x441e55[_0x38b9('0x2e')][_0x38b9('0x33')]));_0x5a3367['attributes']=_0x5a3367[_0x38b9('0x32')][_0x38b9('0x34')]?_0x5a3367[_0x38b9('0x32')]:_0x1b6f7a['model'];_0x5a3367['order']=qs[_0x38b9('0x38')](_0x441e55[_0x38b9('0x2e')]['sort']);_0x5a3367[_0x38b9('0x39')]=qs[_0x38b9('0x30')](_[_0x38b9('0x3a')](_0x441e55[_0x38b9('0x2e')],_0x1b6f7a[_0x38b9('0x30')]));if(_0x441e55[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0x5a3367[_0x38b9('0x39')]=_[_0x38b9('0x4d')](_0x5a3367[_0x38b9('0x39')],{'$or':_[_0x38b9('0x29')](_0x5a3367[_0x38b9('0x32')],function(_0x5ae02f){var _0x35c5a9={};_0x35c5a9[_0x5ae02f]={'$like':'%'+_0x441e55['query']['filter']+'%'};return _0x35c5a9;})});}_0x5a3367=_[_0x38b9('0x4d')]({},_0x5a3367,_0x441e55[_0x38b9('0x3d')]);return _0x542a6b[_0x38b9('0x4e')](_0x5a3367);}})['then'](function(_0x54201e){if(_0x54201e){_0x2256a6=_0x54201e[_0x38b9('0x34')];if(!_0x441e55[_0x38b9('0x2e')][_0x38b9('0x35')]('nolimit')){_0x5a3367[_0x38b9('0x1b')]=qs[_0x38b9('0x1b')](_0x441e55[_0x38b9('0x2e')]['limit']);_0x5a3367[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x441e55['query']['offset']);}return _0x542a6b['getSubjects'](_0x5a3367);}})[_0x38b9('0x24')](function(_0x32781d){if(_0x32781d){return _0x32781d?{'count':_0x2256a6,'rows':_0x32781d}:null;}})[_0x38b9('0x24')](respondWithResult(_0x114196,null))[_0x38b9('0x43')](handleError(_0x114196,null));};exports[_0x38b9('0x4f')]=function(_0x32a83e,_0x5a0e8d,_0x2d4669){var _0x4b1417={};var _0x432dfd={};var _0x5ee5b0;var _0x322fa6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x32a83e[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a0e8d,null))['then'](function(_0x13963a){if(_0x13963a){_0x5ee5b0=_0x13963a;_0x432dfd['model']=_[_0x38b9('0x2f')](db[_0x38b9('0x4c')][_0x38b9('0x45')]);_0x432dfd[_0x38b9('0x2e')]=_[_0x38b9('0x2f')](_0x32a83e[_0x38b9('0x2e')]);_0x432dfd[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x432dfd[_0x38b9('0x2d')],_0x432dfd[_0x38b9('0x2e')]);_0x4b1417[_0x38b9('0x32')]=_[_0x38b9('0x31')](_0x432dfd[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x32a83e[_0x38b9('0x2e')]['fields']));_0x4b1417[_0x38b9('0x32')]=_0x4b1417['attributes'][_0x38b9('0x34')]?_0x4b1417[_0x38b9('0x32')]:_0x432dfd[_0x38b9('0x2d')];_0x4b1417[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x32a83e[_0x38b9('0x2e')]['sort']);_0x4b1417['where']=qs[_0x38b9('0x30')](_['pick'](_0x32a83e[_0x38b9('0x2e')],_0x432dfd[_0x38b9('0x30')]));if(_0x32a83e['query']['filter']){_0x4b1417['where']=_[_0x38b9('0x4d')](_0x4b1417['where'],{'$or':_[_0x38b9('0x29')](_0x4b1417[_0x38b9('0x32')],function(_0x1e8e0d){var _0x5dd767={};_0x5dd767[_0x1e8e0d]={'$like':'%'+_0x32a83e[_0x38b9('0x2e')]['filter']+'%'};return _0x5dd767;})});}_0x4b1417=_['merge']({},_0x4b1417,_0x32a83e[_0x38b9('0x3d')]);return _0x5ee5b0[_0x38b9('0x4f')](_0x4b1417);}})[_0x38b9('0x24')](function(_0x192a26){if(_0x192a26){_0x322fa6=_0x192a26[_0x38b9('0x34')];if(!_0x32a83e[_0x38b9('0x2e')][_0x38b9('0x35')](_0x38b9('0x36'))){_0x4b1417[_0x38b9('0x1b')]=qs['limit'](_0x32a83e['query'][_0x38b9('0x1b')]);_0x4b1417['offset']=qs[_0x38b9('0x1d')](_0x32a83e[_0x38b9('0x2e')]['offset']);}return _0x5ee5b0[_0x38b9('0x4f')](_0x4b1417);}})[_0x38b9('0x24')](function(_0x1bb098){if(_0x1bb098){return _0x1bb098?{'count':_0x322fa6,'rows':_0x1bb098}:null;}})[_0x38b9('0x24')](respondWithResult(_0x5a0e8d,null))[_0x38b9('0x43')](handleError(_0x5a0e8d,null));};exports[_0x38b9('0x50')]=function(_0x376c4f,_0x103056,_0x19abcd){var _0xdd050c={};var _0x1c7f14={};var _0x2ea2ec;var _0x265329;return db[_0x38b9('0x3e')][_0x38b9('0x4b')]({'where':{'id':_0x376c4f[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x103056,null))['then'](function(_0x4192a5){if(_0x4192a5){_0x2ea2ec=_0x4192a5;_0x1c7f14['model']=_[_0x38b9('0x2f')](db[_0x38b9('0x51')][_0x38b9('0x45')]);_0x1c7f14['query']=_[_0x38b9('0x2f')](_0x376c4f[_0x38b9('0x2e')]);_0x1c7f14[_0x38b9('0x30')]=_[_0x38b9('0x31')](_0x1c7f14[_0x38b9('0x2d')],_0x1c7f14[_0x38b9('0x2e')]);_0xdd050c['attributes']=_[_0x38b9('0x31')](_0x1c7f14[_0x38b9('0x2d')],qs[_0x38b9('0x33')](_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x33')]));_0xdd050c[_0x38b9('0x32')]=_0xdd050c[_0x38b9('0x32')][_0x38b9('0x34')]?_0xdd050c[_0x38b9('0x32')]:_0x1c7f14[_0x38b9('0x2d')];_0xdd050c[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_0x376c4f[_0x38b9('0x2e')]['sort']);_0xdd050c[_0x38b9('0x39')]=qs[_0x38b9('0x30')](_[_0x38b9('0x3a')](_0x376c4f[_0x38b9('0x2e')],_0x1c7f14['filters']));if(_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x3b')]){_0xdd050c[_0x38b9('0x39')]=_[_0x38b9('0x4d')](_0xdd050c['where'],{'$or':_[_0x38b9('0x29')](_0xdd050c['attributes'],function(_0x47bac9){var _0x268ac3={};_0x268ac3[_0x47bac9]={'$like':'%'+_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x3b')]+'%'};return _0x268ac3;})});}_0xdd050c=_['merge']({},_0xdd050c,_0x376c4f[_0x38b9('0x3d')]);return _0x2ea2ec[_0x38b9('0x50')](_0xdd050c);}})['then'](function(_0x5069ae){if(_0x5069ae){_0x265329=_0x5069ae['length'];if(!_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x35')](_0x38b9('0x36'))){_0xdd050c[_0x38b9('0x1b')]=qs[_0x38b9('0x1b')](_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x1b')]);_0xdd050c[_0x38b9('0x1d')]=qs[_0x38b9('0x1d')](_0x376c4f[_0x38b9('0x2e')][_0x38b9('0x1d')]);}return _0x2ea2ec[_0x38b9('0x50')](_0xdd050c);}})['then'](function(_0x360db3){if(_0x360db3){return _0x360db3?{'count':_0x265329,'rows':_0x360db3}:null;}})[_0x38b9('0x24')](respondWithResult(_0x103056,null))[_0x38b9('0x43')](handleError(_0x103056,null));};exports['setTags']=function(_0x311845,_0x18af7e,_0x44c0f3){if(_0x311845[_0x38b9('0x48')]['id']){delete _0x311845[_0x38b9('0x48')]['id'];}return db[_0x38b9('0x3e')]['findOne']({'where':{'id':_0x311845[_0x38b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x18af7e,null))[_0x38b9('0x24')](function(_0x1a06d6){if(_0x1a06d6){return _0x1a06d6['setTags'](_0x311845['body'][_0x38b9('0x52')]||[]);}return null;})[_0x38b9('0x24')](respondWithResult(_0x18af7e,null))[_0x38b9('0x43')](handleError(_0x18af7e,null));}; \ No newline at end of file +var _0xc6c3=['merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','create','body','findOne','FreshdeskField','pick','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x18ec05,_0x4cb61d){var _0x136bfb=function(_0x112ff5){while(--_0x112ff5){_0x18ec05['push'](_0x18ec05['shift']());}};_0x136bfb(++_0x4cb61d);}(_0xc6c3,0x65));var _0x3c6c=function(_0x17e05c,_0x2ae564){_0x17e05c=_0x17e05c-0x0;var _0x5ad01b=_0xc6c3[_0x17e05c];return _0x5ad01b;};'use strict';var emlformat=require(_0x3c6c('0x0'));var rimraf=require(_0x3c6c('0x1'));var zipdir=require(_0x3c6c('0x2'));var jsonpatch=require(_0x3c6c('0x3'));var rp=require('request-promise');var moment=require(_0x3c6c('0x4'));var BPromise=require(_0x3c6c('0x5'));var Mustache=require(_0x3c6c('0x6'));var util=require(_0x3c6c('0x7'));var path=require('path');var sox=require(_0x3c6c('0x8'));var csv=require(_0x3c6c('0x9'));var ejs=require(_0x3c6c('0xa'));var fs=require('fs');var fs_extra=require(_0x3c6c('0xb'));var _=require(_0x3c6c('0xc'));var squel=require('squel');var crypto=require(_0x3c6c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c6c('0xe'));var toCsv=require(_0x3c6c('0x9'));var querystring=require('querystring');var Papa=require(_0x3c6c('0xf'));var Redis=require(_0x3c6c('0x10'));var authService=require(_0x3c6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c6c('0x12'));var logger=require(_0x3c6c('0x13'))(_0x3c6c('0x14'));var utils=require(_0x3c6c('0x15'));var config=require(_0x3c6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe4699,_0x450779){_0x450779=_0x450779||0xcc;return function(_0x33af14){if(_0x33af14){return _0xe4699[_0x3c6c('0x17')](_0x450779);}return _0xe4699['status'](_0x450779)[_0x3c6c('0x18')]();};}function respondWithResult(_0x2108cc,_0x32136a){_0x32136a=_0x32136a||0xc8;return function(_0x595608){if(_0x595608){return _0x2108cc['status'](_0x32136a)[_0x3c6c('0x19')](_0x595608);}};}function respondWithFilteredResult(_0x545d2c,_0x955814){return function(_0x446c1a){if(_0x446c1a){var _0x33d318=typeof _0x955814[_0x3c6c('0x1a')]===_0x3c6c('0x1b')&&typeof _0x955814[_0x3c6c('0x1c')]==='undefined';var _0x10729b=_0x446c1a[_0x3c6c('0x1d')];var _0x4b6bab=_0x33d318?0x0:_0x955814[_0x3c6c('0x1a')];var _0x887129=_0x33d318?_0x446c1a['count']:_0x955814[_0x3c6c('0x1a')]+_0x955814[_0x3c6c('0x1c')];var _0x2eac8c;if(_0x887129>=_0x10729b){_0x887129=_0x10729b;_0x2eac8c=0xc8;}else{_0x2eac8c=0xce;}_0x545d2c[_0x3c6c('0x1e')](_0x2eac8c);return _0x545d2c['set'](_0x3c6c('0x1f'),_0x4b6bab+'-'+_0x887129+'/'+_0x10729b)['json'](_0x446c1a);}return null;};}function patchUpdates(_0x50f927){return function(_0x5ccc14){try{jsonpatch[_0x3c6c('0x20')](_0x5ccc14,_0x50f927,!![]);}catch(_0x3bc213){return BPromise[_0x3c6c('0x21')](_0x3bc213);}return _0x5ccc14[_0x3c6c('0x22')]();};}function saveUpdates(_0x54db07,_0x2a77cd){return function(_0x1d93ac){if(_0x1d93ac){return _0x1d93ac[_0x3c6c('0x23')](_0x54db07)[_0x3c6c('0x24')](function(_0xa4a377){return _0xa4a377;});}return null;};}function removeEntity(_0x5eda3c,_0x47bfe6){return function(_0x44724a){if(_0x44724a){return _0x44724a[_0x3c6c('0x25')]()['then'](function(){_0x5eda3c['status'](0xcc)[_0x3c6c('0x18')]();});}};}function handleEntityNotFound(_0x483ccc,_0x4d36c5){return function(_0x3fe2e5){if(!_0x3fe2e5){_0x483ccc[_0x3c6c('0x17')](0x194);}return _0x3fe2e5;};}function handleError(_0x1bf088,_0x5ed360){_0x5ed360=_0x5ed360||0x1f4;return function(_0x1e8196){logger['error'](_0x1e8196['stack']);if(_0x1e8196[_0x3c6c('0x26')]){delete _0x1e8196[_0x3c6c('0x26')];}_0x1bf088[_0x3c6c('0x1e')](_0x5ed360)[_0x3c6c('0x27')](_0x1e8196);};}exports[_0x3c6c('0x28')]=function(_0x1eea2a,_0x143809){var _0x3dea0f={},_0xd6e270={},_0x215370={'count':0x0,'rows':[]};var _0x144354=_[_0x3c6c('0x29')](db[_0x3c6c('0x2a')][_0x3c6c('0x2b')],function(_0x31dc44){return{'name':_0x31dc44[_0x3c6c('0x2c')],'type':_0x31dc44['type'][_0x3c6c('0x2d')]};});_0xd6e270[_0x3c6c('0x2e')]=_[_0x3c6c('0x29')](_0x144354,_0x3c6c('0x26'));_0xd6e270[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0x1eea2a[_0x3c6c('0x2f')]);_0xd6e270['filters']=_[_0x3c6c('0x31')](_0xd6e270[_0x3c6c('0x2e')],_0xd6e270[_0x3c6c('0x2f')]);_0x3dea0f['attributes']=_[_0x3c6c('0x31')](_0xd6e270[_0x3c6c('0x2e')],qs[_0x3c6c('0x32')](_0x1eea2a[_0x3c6c('0x2f')][_0x3c6c('0x32')]));_0x3dea0f[_0x3c6c('0x33')]=_0x3dea0f[_0x3c6c('0x33')][_0x3c6c('0x34')]?_0x3dea0f[_0x3c6c('0x33')]:_0xd6e270[_0x3c6c('0x2e')];if(!_0x1eea2a[_0x3c6c('0x2f')][_0x3c6c('0x35')](_0x3c6c('0x36'))){_0x3dea0f['limit']=qs[_0x3c6c('0x1c')](_0x1eea2a['query'][_0x3c6c('0x1c')]);_0x3dea0f[_0x3c6c('0x1a')]=qs['offset'](_0x1eea2a[_0x3c6c('0x2f')]['offset']);}_0x3dea0f[_0x3c6c('0x37')]=qs[_0x3c6c('0x38')](_0x1eea2a[_0x3c6c('0x2f')][_0x3c6c('0x38')]);_0x3dea0f[_0x3c6c('0x39')]=qs[_0x3c6c('0x3a')](_['pick'](_0x1eea2a[_0x3c6c('0x2f')],_0xd6e270[_0x3c6c('0x3a')]),_0x144354);if(_0x1eea2a[_0x3c6c('0x2f')]['filter']){_0x3dea0f['where']=_[_0x3c6c('0x3b')](_0x3dea0f['where'],{'$or':_[_0x3c6c('0x29')](_0x144354,function(_0x301d6d){if(_0x301d6d['type']!==_0x3c6c('0x3c')){var _0x3511be={};_0x3511be[_0x301d6d[_0x3c6c('0x26')]]={'$like':'%'+_0x1eea2a['query'][_0x3c6c('0x3d')]+'%'};return _0x3511be;}})});}_0x3dea0f=_[_0x3c6c('0x3b')]({},_0x3dea0f,_0x1eea2a[_0x3c6c('0x3e')]);var _0x234a5b={'where':_0x3dea0f[_0x3c6c('0x39')]};return db['FreshdeskConfiguration']['count'](_0x234a5b)[_0x3c6c('0x24')](function(_0x14c683){_0x215370['count']=_0x14c683;if(_0x1eea2a['query']['includeAll']){_0x3dea0f[_0x3c6c('0x3f')]=[{'all':!![]}];}return db[_0x3c6c('0x2a')]['findAll'](_0x3dea0f);})[_0x3c6c('0x24')](function(_0x5a77d6){_0x215370[_0x3c6c('0x40')]=_0x5a77d6;return _0x215370;})[_0x3c6c('0x24')](respondWithFilteredResult(_0x143809,_0x3dea0f))[_0x3c6c('0x41')](handleError(_0x143809,null));};exports['show']=function(_0x1c6969,_0x1f089d){var _0x489c0e={'raw':![],'where':{'id':_0x1c6969[_0x3c6c('0x42')]['id']}},_0xabb763={};_0xabb763[_0x3c6c('0x2e')]=_[_0x3c6c('0x30')](db[_0x3c6c('0x2a')][_0x3c6c('0x2b')]);_0xabb763['query']=_[_0x3c6c('0x30')](_0x1c6969[_0x3c6c('0x2f')]);_0xabb763[_0x3c6c('0x3a')]=_[_0x3c6c('0x31')](_0xabb763[_0x3c6c('0x2e')],_0xabb763[_0x3c6c('0x2f')]);_0x489c0e[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](_0xabb763['model'],qs[_0x3c6c('0x32')](_0x1c6969[_0x3c6c('0x2f')][_0x3c6c('0x32')]));_0x489c0e[_0x3c6c('0x33')]=_0x489c0e[_0x3c6c('0x33')]['length']?_0x489c0e[_0x3c6c('0x33')]:_0xabb763['model'];if(_0x1c6969[_0x3c6c('0x2f')][_0x3c6c('0x43')]){_0x489c0e[_0x3c6c('0x3f')]=[{'all':!![]}];}_0x489c0e=_[_0x3c6c('0x3b')]({},_0x489c0e,_0x1c6969['options']);return db[_0x3c6c('0x2a')][_0x3c6c('0x44')](_0x489c0e)[_0x3c6c('0x24')](handleEntityNotFound(_0x1f089d,null))['then'](respondWithResult(_0x1f089d,null))[_0x3c6c('0x41')](handleError(_0x1f089d,null));};exports[_0x3c6c('0x45')]=function(_0x4b68a8,_0x1fca4a){return db['FreshdeskConfiguration']['create'](_0x4b68a8['body'],{})[_0x3c6c('0x24')](respondWithResult(_0x1fca4a,0xc9))[_0x3c6c('0x41')](handleError(_0x1fca4a,null));};exports['update']=function(_0x1dc009,_0xef4d42){if(_0x1dc009['body']['id']){delete _0x1dc009[_0x3c6c('0x46')]['id'];}return db[_0x3c6c('0x2a')][_0x3c6c('0x44')]({'where':{'id':_0x1dc009['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0xef4d42,null))['then'](saveUpdates(_0x1dc009['body'],null))[_0x3c6c('0x24')](respondWithResult(_0xef4d42,null))[_0x3c6c('0x41')](handleError(_0xef4d42,null));};exports[_0x3c6c('0x25')]=function(_0x244d17,_0x159921){return db[_0x3c6c('0x2a')][_0x3c6c('0x44')]({'where':{'id':_0x244d17[_0x3c6c('0x42')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x159921,null))[_0x3c6c('0x24')](removeEntity(_0x159921,null))['catch'](handleError(_0x159921,null));};exports['getFields']=function(_0x2ce2f3,_0x3bb085,_0x4d3d69){var _0x3ba08d={};var _0x3cbc8c={};var _0x1f884f;var _0x435be4;return db[_0x3c6c('0x2a')][_0x3c6c('0x47')]({'where':{'id':_0x2ce2f3['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x3bb085,null))[_0x3c6c('0x24')](function(_0x495ba8){if(_0x495ba8){_0x1f884f=_0x495ba8;_0x3cbc8c[_0x3c6c('0x2e')]=_[_0x3c6c('0x30')](db[_0x3c6c('0x48')][_0x3c6c('0x2b')]);_0x3cbc8c[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0x2ce2f3['query']);_0x3cbc8c['filters']=_[_0x3c6c('0x31')](_0x3cbc8c[_0x3c6c('0x2e')],_0x3cbc8c[_0x3c6c('0x2f')]);_0x3ba08d[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](_0x3cbc8c[_0x3c6c('0x2e')],qs['fields'](_0x2ce2f3['query'][_0x3c6c('0x32')]));_0x3ba08d[_0x3c6c('0x33')]=_0x3ba08d['attributes']['length']?_0x3ba08d[_0x3c6c('0x33')]:_0x3cbc8c[_0x3c6c('0x2e')];_0x3ba08d[_0x3c6c('0x37')]=qs[_0x3c6c('0x38')](_0x2ce2f3['query'][_0x3c6c('0x38')]);_0x3ba08d['where']=qs[_0x3c6c('0x3a')](_[_0x3c6c('0x49')](_0x2ce2f3[_0x3c6c('0x2f')],_0x3cbc8c['filters']));if(_0x2ce2f3[_0x3c6c('0x2f')][_0x3c6c('0x3d')]){_0x3ba08d['where']=_[_0x3c6c('0x3b')](_0x3ba08d[_0x3c6c('0x39')],{'$or':_[_0x3c6c('0x29')](_0x3ba08d[_0x3c6c('0x33')],function(_0x469a92){var _0x500fe2={};_0x500fe2[_0x469a92]={'$like':'%'+_0x2ce2f3['query'][_0x3c6c('0x3d')]+'%'};return _0x500fe2;})});}_0x3ba08d=_[_0x3c6c('0x3b')]({},_0x3ba08d,_0x2ce2f3[_0x3c6c('0x3e')]);return _0x1f884f[_0x3c6c('0x4a')](_0x3ba08d);}})[_0x3c6c('0x24')](function(_0x3e999e){if(_0x3e999e){_0x435be4=_0x3e999e[_0x3c6c('0x34')];if(!_0x2ce2f3['query'][_0x3c6c('0x35')](_0x3c6c('0x36'))){_0x3ba08d['limit']=qs[_0x3c6c('0x1c')](_0x2ce2f3['query'][_0x3c6c('0x1c')]);_0x3ba08d['offset']=qs[_0x3c6c('0x1a')](_0x2ce2f3[_0x3c6c('0x2f')]['offset']);}return _0x1f884f[_0x3c6c('0x4a')](_0x3ba08d);}})[_0x3c6c('0x24')](function(_0x4e5c08){if(_0x4e5c08){return _0x4e5c08?{'count':_0x435be4,'rows':_0x4e5c08}:null;}})['then'](respondWithResult(_0x3bb085,null))[_0x3c6c('0x41')](handleError(_0x3bb085,null));};exports['getSubjects']=function(_0xb046cc,_0x3db1a3,_0x95a5c8){var _0x5f1c57={};var _0xe0ddf5={};var _0x2b6880;var _0x351cc2;return db[_0x3c6c('0x2a')][_0x3c6c('0x47')]({'where':{'id':_0xb046cc[_0x3c6c('0x42')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x3db1a3,null))[_0x3c6c('0x24')](function(_0x263291){if(_0x263291){_0x2b6880=_0x263291;_0xe0ddf5[_0x3c6c('0x2e')]=_[_0x3c6c('0x30')](db[_0x3c6c('0x48')]['rawAttributes']);_0xe0ddf5[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0xb046cc[_0x3c6c('0x2f')]);_0xe0ddf5[_0x3c6c('0x3a')]=_['intersection'](_0xe0ddf5[_0x3c6c('0x2e')],_0xe0ddf5[_0x3c6c('0x2f')]);_0x5f1c57['attributes']=_[_0x3c6c('0x31')](_0xe0ddf5[_0x3c6c('0x2e')],qs[_0x3c6c('0x32')](_0xb046cc[_0x3c6c('0x2f')]['fields']));_0x5f1c57['attributes']=_0x5f1c57['attributes'][_0x3c6c('0x34')]?_0x5f1c57['attributes']:_0xe0ddf5[_0x3c6c('0x2e')];_0x5f1c57[_0x3c6c('0x37')]=qs['sort'](_0xb046cc[_0x3c6c('0x2f')][_0x3c6c('0x38')]);_0x5f1c57['where']=qs[_0x3c6c('0x3a')](_[_0x3c6c('0x49')](_0xb046cc[_0x3c6c('0x2f')],_0xe0ddf5['filters']));if(_0xb046cc[_0x3c6c('0x2f')][_0x3c6c('0x3d')]){_0x5f1c57[_0x3c6c('0x39')]=_[_0x3c6c('0x3b')](_0x5f1c57[_0x3c6c('0x39')],{'$or':_[_0x3c6c('0x29')](_0x5f1c57[_0x3c6c('0x33')],function(_0x27c606){var _0x2f8dde={};_0x2f8dde[_0x27c606]={'$like':'%'+_0xb046cc[_0x3c6c('0x2f')][_0x3c6c('0x3d')]+'%'};return _0x2f8dde;})});}_0x5f1c57=_[_0x3c6c('0x3b')]({},_0x5f1c57,_0xb046cc[_0x3c6c('0x3e')]);return _0x2b6880[_0x3c6c('0x4b')](_0x5f1c57);}})[_0x3c6c('0x24')](function(_0x4c8168){if(_0x4c8168){_0x351cc2=_0x4c8168[_0x3c6c('0x34')];if(!_0xb046cc[_0x3c6c('0x2f')][_0x3c6c('0x35')]('nolimit')){_0x5f1c57[_0x3c6c('0x1c')]=qs[_0x3c6c('0x1c')](_0xb046cc['query'][_0x3c6c('0x1c')]);_0x5f1c57[_0x3c6c('0x1a')]=qs['offset'](_0xb046cc[_0x3c6c('0x2f')][_0x3c6c('0x1a')]);}return _0x2b6880['getSubjects'](_0x5f1c57);}})[_0x3c6c('0x24')](function(_0x52abec){if(_0x52abec){return _0x52abec?{'count':_0x351cc2,'rows':_0x52abec}:null;}})['then'](respondWithResult(_0x3db1a3,null))[_0x3c6c('0x41')](handleError(_0x3db1a3,null));};exports[_0x3c6c('0x4c')]=function(_0x3fe5bb,_0x595423,_0x3ad26f){var _0x3d4bcd={};var _0x554b07={};var _0xeacc55;var _0x5dfbcf;return db['FreshdeskConfiguration'][_0x3c6c('0x47')]({'where':{'id':_0x3fe5bb[_0x3c6c('0x42')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x595423,null))[_0x3c6c('0x24')](function(_0x495176){if(_0x495176){_0xeacc55=_0x495176;_0x554b07[_0x3c6c('0x2e')]=_[_0x3c6c('0x30')](db[_0x3c6c('0x48')][_0x3c6c('0x2b')]);_0x554b07[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0x3fe5bb[_0x3c6c('0x2f')]);_0x554b07['filters']=_['intersection'](_0x554b07[_0x3c6c('0x2e')],_0x554b07[_0x3c6c('0x2f')]);_0x3d4bcd[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](_0x554b07[_0x3c6c('0x2e')],qs[_0x3c6c('0x32')](_0x3fe5bb[_0x3c6c('0x2f')][_0x3c6c('0x32')]));_0x3d4bcd[_0x3c6c('0x33')]=_0x3d4bcd[_0x3c6c('0x33')]['length']?_0x3d4bcd['attributes']:_0x554b07[_0x3c6c('0x2e')];_0x3d4bcd[_0x3c6c('0x37')]=qs['sort'](_0x3fe5bb[_0x3c6c('0x2f')][_0x3c6c('0x38')]);_0x3d4bcd[_0x3c6c('0x39')]=qs['filters'](_['pick'](_0x3fe5bb[_0x3c6c('0x2f')],_0x554b07[_0x3c6c('0x3a')]));if(_0x3fe5bb[_0x3c6c('0x2f')][_0x3c6c('0x3d')]){_0x3d4bcd[_0x3c6c('0x39')]=_[_0x3c6c('0x3b')](_0x3d4bcd['where'],{'$or':_[_0x3c6c('0x29')](_0x3d4bcd[_0x3c6c('0x33')],function(_0x157bb1){var _0x1dc98d={};_0x1dc98d[_0x157bb1]={'$like':'%'+_0x3fe5bb[_0x3c6c('0x2f')][_0x3c6c('0x3d')]+'%'};return _0x1dc98d;})});}_0x3d4bcd=_[_0x3c6c('0x3b')]({},_0x3d4bcd,_0x3fe5bb['options']);return _0xeacc55[_0x3c6c('0x4c')](_0x3d4bcd);}})[_0x3c6c('0x24')](function(_0x10bced){if(_0x10bced){_0x5dfbcf=_0x10bced[_0x3c6c('0x34')];if(!_0x3fe5bb[_0x3c6c('0x2f')][_0x3c6c('0x35')](_0x3c6c('0x36'))){_0x3d4bcd[_0x3c6c('0x1c')]=qs[_0x3c6c('0x1c')](_0x3fe5bb[_0x3c6c('0x2f')]['limit']);_0x3d4bcd[_0x3c6c('0x1a')]=qs[_0x3c6c('0x1a')](_0x3fe5bb[_0x3c6c('0x2f')][_0x3c6c('0x1a')]);}return _0xeacc55[_0x3c6c('0x4c')](_0x3d4bcd);}})['then'](function(_0xff6d46){if(_0xff6d46){return _0xff6d46?{'count':_0x5dfbcf,'rows':_0xff6d46}:null;}})[_0x3c6c('0x24')](respondWithResult(_0x595423,null))[_0x3c6c('0x41')](handleError(_0x595423,null));};exports[_0x3c6c('0x4d')]=function(_0x3d4a39,_0x138686,_0x14d074){var _0xe7e9c={};var _0x20b464={};var _0x23f9ba;var _0x5204d3;return db['FreshdeskConfiguration'][_0x3c6c('0x47')]({'where':{'id':_0x3d4a39[_0x3c6c('0x42')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x138686,null))[_0x3c6c('0x24')](function(_0x17d33b){if(_0x17d33b){_0x23f9ba=_0x17d33b;_0x20b464[_0x3c6c('0x2e')]=_[_0x3c6c('0x30')](db[_0x3c6c('0x4e')][_0x3c6c('0x2b')]);_0x20b464[_0x3c6c('0x2f')]=_[_0x3c6c('0x30')](_0x3d4a39[_0x3c6c('0x2f')]);_0x20b464[_0x3c6c('0x3a')]=_[_0x3c6c('0x31')](_0x20b464[_0x3c6c('0x2e')],_0x20b464[_0x3c6c('0x2f')]);_0xe7e9c[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](_0x20b464[_0x3c6c('0x2e')],qs[_0x3c6c('0x32')](_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x32')]));_0xe7e9c[_0x3c6c('0x33')]=_0xe7e9c[_0x3c6c('0x33')][_0x3c6c('0x34')]?_0xe7e9c[_0x3c6c('0x33')]:_0x20b464[_0x3c6c('0x2e')];_0xe7e9c['order']=qs['sort'](_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x38')]);_0xe7e9c[_0x3c6c('0x39')]=qs[_0x3c6c('0x3a')](_['pick'](_0x3d4a39[_0x3c6c('0x2f')],_0x20b464[_0x3c6c('0x3a')]));if(_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x3d')]){_0xe7e9c[_0x3c6c('0x39')]=_[_0x3c6c('0x3b')](_0xe7e9c[_0x3c6c('0x39')],{'$or':_[_0x3c6c('0x29')](_0xe7e9c['attributes'],function(_0x20a339){var _0x16caa6={};_0x16caa6[_0x20a339]={'$like':'%'+_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x3d')]+'%'};return _0x16caa6;})});}_0xe7e9c=_[_0x3c6c('0x3b')]({},_0xe7e9c,_0x3d4a39[_0x3c6c('0x3e')]);return _0x23f9ba[_0x3c6c('0x4d')](_0xe7e9c);}})['then'](function(_0x489d78){if(_0x489d78){_0x5204d3=_0x489d78[_0x3c6c('0x34')];if(!_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x35')](_0x3c6c('0x36'))){_0xe7e9c[_0x3c6c('0x1c')]=qs[_0x3c6c('0x1c')](_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x1c')]);_0xe7e9c['offset']=qs[_0x3c6c('0x1a')](_0x3d4a39[_0x3c6c('0x2f')][_0x3c6c('0x1a')]);}return _0x23f9ba[_0x3c6c('0x4d')](_0xe7e9c);}})['then'](function(_0x49c030){if(_0x49c030){return _0x49c030?{'count':_0x5204d3,'rows':_0x49c030}:null;}})[_0x3c6c('0x24')](respondWithResult(_0x138686,null))[_0x3c6c('0x41')](handleError(_0x138686,null));};exports[_0x3c6c('0x4f')]=function(_0x46807b,_0x286c33,_0x413ff1){if(_0x46807b[_0x3c6c('0x46')]['id']){delete _0x46807b[_0x3c6c('0x46')]['id'];}return db[_0x3c6c('0x2a')][_0x3c6c('0x47')]({'where':{'id':_0x46807b['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x286c33,null))[_0x3c6c('0x24')](function(_0x366810){if(_0x366810){return _0x366810[_0x3c6c('0x4f')](_0x46807b[_0x3c6c('0x46')]['ids']||[]);}return null;})[_0x3c6c('0x24')](respondWithResult(_0x286c33,null))['catch'](handleError(_0x286c33,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 62039e9..cfc1360 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 _0x655e=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','util','api','moment','request-promise','path'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x655e,0x1be));var _0xe655=function(_0x21652b,_0x4f5bea){_0x21652b=_0x21652b-0x0;var _0x2852e1=_0x655e[_0x21652b];return _0x2852e1;};'use strict';var _=require('lodash');var util=require(_0xe655('0x0'));var logger=require('../../config/logger')(_0xe655('0x1'));var moment=require(_0xe655('0x2'));var BPromise=require('bluebird');var rp=require(_0xe655('0x3'));var fs=require('fs');var path=require(_0xe655('0x4'));var rimraf=require(_0xe655('0x5'));var config=require(_0xe655('0x6'));var attributes=require(_0xe655('0x7'));module[_0xe655('0x8')]=function(_0x2bc82b,_0x27a51f){return _0x2bc82b[_0xe655('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0xe655('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf77a=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2e55c9,_0x2c37f3){var _0x4f7361=function(_0x4c6251){while(--_0x4c6251){_0x2e55c9['push'](_0x2e55c9['shift']());}};_0x4f7361(++_0x2c37f3);}(_0xf77a,0xe1));var _0xaf77=function(_0x2a1a09,_0x37454e){_0x2a1a09=_0x2a1a09-0x0;var _0xacb6de=_0xf77a[_0x2a1a09];return _0xacb6de;};'use strict';var _=require('lodash');var util=require(_0xaf77('0x0'));var logger=require(_0xaf77('0x1'))(_0xaf77('0x2'));var moment=require(_0xaf77('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf77('0x4'));var fs=require('fs');var path=require(_0xaf77('0x5'));var rimraf=require('rimraf');var config=require(_0xaf77('0x6'));var attributes=require(_0xaf77('0x7'));module[_0xaf77('0x8')]=function(_0x5907f4,_0x5f1590){return _0x5907f4['define'](_0xaf77('0x9'),attributes,{'tableName':_0xaf77('0xa'),'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 982b15b..050ebf9 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 _0x2f4b=['../../config/environment','jayson/promise','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x39f7ce,_0x19d17c){var _0x487f8d=function(_0x5a37d1){while(--_0x5a37d1){_0x39f7ce['push'](_0x39f7ce['shift']());}};_0x487f8d(++_0x19d17c);}(_0x2f4b,0x77));var _0xb2f4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2f4b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xb2f4('0x0'));var util=require(_0xb2f4('0x1'));var moment=require(_0xb2f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb2f4('0x3'));var fs=require('fs');var Redis=require(_0xb2f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb2f4('0x5'))(_0xb2f4('0x6'));var config=require(_0xb2f4('0x7'));var jayson=require(_0xb2f4('0x8'));var client=jayson['client'][_0xb2f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dfae5,_0x4154b8,_0x3963ff){return new BPromise(function(_0x40509b,_0xd1803b){return client[_0xb2f4('0xa')](_0x4dfae5,_0x3963ff)['then'](function(_0x5b4a38){logger['info'](_0xb2f4('0xb'),_0x4154b8,_0xb2f4('0xc'));logger[_0xb2f4('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4154b8,_0xb2f4('0xc'),JSON[_0xb2f4('0xe')](_0x5b4a38));if(_0x5b4a38[_0xb2f4('0xf')]){if(_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x10')]===0x1f4){logger[_0xb2f4('0xf')](_0xb2f4('0xb'),_0x4154b8,_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);return _0xd1803b(_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);}logger[_0xb2f4('0xf')](_0xb2f4('0xb'),_0x4154b8,_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);return _0x40509b(_0x5b4a38[_0xb2f4('0xf')][_0xb2f4('0x11')]);}else{logger[_0xb2f4('0x12')](_0xb2f4('0xb'),_0x4154b8,_0xb2f4('0xc'));_0x40509b(_0x5b4a38[_0xb2f4('0x13')][_0xb2f4('0x11')]);}})[_0xb2f4('0x14')](function(_0x209d88){logger['error'](_0xb2f4('0xb'),_0x4154b8,_0x209d88);_0xd1803b(_0x209d88);});});} \ No newline at end of file +var _0xc7d7=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','bluebird'];(function(_0xd6d456,_0x37accf){var _0x5c3e7d=function(_0x262ac9){while(--_0x262ac9){_0xd6d456['push'](_0xd6d456['shift']());}};_0x5c3e7d(++_0x37accf);}(_0xc7d7,0x9d));var _0x7c7d=function(_0x3b6ad5,_0x1b0ddb){_0x3b6ad5=_0x3b6ad5-0x0;var _0x3a6e1f=_0xc7d7[_0x3b6ad5];return _0x3a6e1f;};'use strict';var _=require(_0x7c7d('0x0'));var util=require('util');var moment=require(_0x7c7d('0x1'));var BPromise=require(_0x7c7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c7d('0x3'));var db=require(_0x7c7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c7d('0x5'))(_0x7c7d('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c7d('0x7'));var client=jayson['client'][_0x7c7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ce2a2,_0x1c771e,_0x4bab57){return new BPromise(function(_0x41f89c,_0x50e9f5){return client[_0x7c7d('0x9')](_0x5ce2a2,_0x4bab57)[_0x7c7d('0xa')](function(_0x854c4a){logger['info'](_0x7c7d('0xb'),_0x1c771e,'request\x20sent');logger[_0x7c7d('0xc')](_0x7c7d('0xd'),_0x1c771e,_0x7c7d('0xe'),JSON['stringify'](_0x854c4a));if(_0x854c4a['error']){if(_0x854c4a[_0x7c7d('0xf')][_0x7c7d('0x10')]===0x1f4){logger[_0x7c7d('0xf')](_0x7c7d('0xb'),_0x1c771e,_0x854c4a[_0x7c7d('0xf')][_0x7c7d('0x11')]);return _0x50e9f5(_0x854c4a[_0x7c7d('0xf')]['message']);}logger[_0x7c7d('0xf')](_0x7c7d('0xb'),_0x1c771e,_0x854c4a[_0x7c7d('0xf')][_0x7c7d('0x11')]);return _0x41f89c(_0x854c4a[_0x7c7d('0xf')][_0x7c7d('0x11')]);}else{logger[_0x7c7d('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1c771e,_0x7c7d('0xe'));_0x41f89c(_0x854c4a[_0x7c7d('0x13')][_0x7c7d('0x11')]);}})['catch'](function(_0x54d5c5){logger[_0x7c7d('0xf')](_0x7c7d('0xb'),_0x1c771e,_0x54d5c5);_0x50e9f5(_0x54d5c5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3ca3d56..a1582c8 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 _0xdfe3=['connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x54ad19,_0x2f3fc1){var _0x1330db=function(_0x3cb412){while(--_0x3cb412){_0x54ad19['push'](_0x54ad19['shift']());}};_0x1330db(++_0x2f3fc1);}(_0xdfe3,0x13d));var _0x3dfe=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xdfe3[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0x3dfe('0x0'));var util=require(_0x3dfe('0x1'));var path=require(_0x3dfe('0x2'));var timeout=require(_0x3dfe('0x3'));var express=require(_0x3dfe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3dfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3dfe('0x6'));var controller=require(_0x3dfe('0x7'));router['get']('/',auth[_0x3dfe('0x8')](),controller[_0x3dfe('0x9')]);router[_0x3dfe('0xa')](_0x3dfe('0xb'),auth[_0x3dfe('0x8')](),controller[_0x3dfe('0xc')]);router[_0x3dfe('0xd')]('/',auth['isAuthenticated'](),controller[_0x3dfe('0xe')]);router[_0x3dfe('0xf')](_0x3dfe('0xb'),auth[_0x3dfe('0x8')](),controller[_0x3dfe('0x10')]);router[_0x3dfe('0x11')](_0x3dfe('0xb'),auth[_0x3dfe('0x8')](),controller[_0x3dfe('0x12')]);module[_0x3dfe('0x13')]=router; \ No newline at end of file +var _0x3598=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0xafdd64,_0x1c20b0){var _0x326499=function(_0x140fdb){while(--_0x140fdb){_0xafdd64['push'](_0xafdd64['shift']());}};_0x326499(++_0x1c20b0);}(_0x3598,0x1a3));var _0x8359=function(_0x15019e,_0x52c809){_0x15019e=_0x15019e-0x0;var _0x5ce225=_0x3598[_0x15019e];return _0x5ce225;};'use strict';var multer=require(_0x8359('0x0'));var util=require(_0x8359('0x1'));var path=require(_0x8359('0x2'));var timeout=require(_0x8359('0x3'));var express=require(_0x8359('0x4'));var router=express[_0x8359('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8359('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8359('0x7'));var controller=require(_0x8359('0x8'));router['get']('/',auth[_0x8359('0x9')](),controller[_0x8359('0xa')]);router['get'](_0x8359('0xb'),auth[_0x8359('0x9')](),controller[_0x8359('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8359('0xd')]);router[_0x8359('0xe')](_0x8359('0xb'),auth['isAuthenticated'](),controller[_0x8359('0xf')]);router[_0x8359('0x10')](_0x8359('0xb'),auth[_0x8359('0x9')](),controller[_0x8359('0x11')]);module[_0x8359('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4414b39..52be957 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 _0xad8b=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x4505ff,_0x279eac){var _0x589f3f=function(_0x4dc73f){while(--_0x4dc73f){_0x4505ff['push'](_0x4505ff['shift']());}};_0x589f3f(++_0x279eac);}(_0xad8b,0xb8));var _0xbad8=function(_0x4f5633,_0x3ba792){_0x4f5633=_0x4f5633-0x0;var _0x1139d3=_0xad8b[_0x4f5633];return _0x1139d3;};'use strict';var Sequelize=require(_0xbad8('0x0'));module['exports']={'type':{'type':Sequelize[_0xbad8('0x1')](_0xbad8('0x2'),_0xbad8('0x3'),_0xbad8('0x4'),_0xbad8('0x5'),_0xbad8('0x6')),'defaultValue':_0xbad8('0x2')},'content':{'type':Sequelize[_0xbad8('0x7')]},'key':{'type':Sequelize[_0xbad8('0x7')]},'keyType':{'type':Sequelize[_0xbad8('0x1')](_0xbad8('0x2'),_0xbad8('0x3'),_0xbad8('0x4'))},'keyContent':{'type':Sequelize[_0xbad8('0x7')]},'idField':{'type':Sequelize[_0xbad8('0x7')]},'nameField':{'type':Sequelize[_0xbad8('0x7')]},'customField':{'type':Sequelize[_0xbad8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4f1=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa4f1,0x1ae));var _0x1a4f=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa4f1[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require('sequelize');module[_0x1a4f('0x0')]={'type':{'type':Sequelize[_0x1a4f('0x1')](_0x1a4f('0x2'),'variable',_0x1a4f('0x3'),_0x1a4f('0x4'),_0x1a4f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1a4f('0x6')]},'key':{'type':Sequelize[_0x1a4f('0x6')]},'keyType':{'type':Sequelize[_0x1a4f('0x1')](_0x1a4f('0x2'),_0x1a4f('0x7'),_0x1a4f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1a4f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1a4f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a4f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 55e2212..76aeb25 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 _0xa25c=['map','FreshdeskField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index'];(function(_0x4f7c71,_0x32ce58){var _0xb7a7e8=function(_0x451ca3){while(--_0x451ca3){_0x4f7c71['push'](_0x4f7c71['shift']());}};_0xb7a7e8(++_0x32ce58);}(_0xa25c,0x13f));var _0xca25=function(_0x4c3ee2,_0x2221fa){_0x4c3ee2=_0x4c3ee2-0x0;var _0x5a5184=_0xa25c[_0x4c3ee2];return _0x5a5184;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)[_0xca25('0x17')]();});}};}function handleEntityNotFound(_0x20dc6d,_0x4dffad){return function(_0x1aa848){if(!_0x1aa848){_0x20dc6d[_0xca25('0x24')](0x194);}return _0x1aa848;};}function handleError(_0x7ceacb,_0x374cde){_0x374cde=_0x374cde||0x1f4;return function(_0x220546){logger['error'](_0x220546[_0xca25('0x25')]);if(_0x220546[_0xca25('0x26')]){delete _0x220546[_0xca25('0x26')];}_0x7ceacb[_0xca25('0x16')](_0x374cde)[_0xca25('0x27')](_0x220546);};}exports[_0xca25('0x28')]=function(_0xfd888c,_0x1660a5){var _0x3e72cb={},_0x7b67f4={},_0x190f27={'count':0x0,'rows':[]};var _0x315f76=_[_0xca25('0x29')](db[_0xca25('0x2a')][_0xca25('0x2b')],function(_0x2433bb){return{'name':_0x2433bb[_0xca25('0x2c')],'type':_0x2433bb[_0xca25('0x2d')]['key']};});_0x7b67f4[_0xca25('0x2e')]=_[_0xca25('0x29')](_0x315f76,_0xca25('0x26'));_0x7b67f4['query']=_[_0xca25('0x2f')](_0xfd888c[_0xca25('0x30')]);_0x7b67f4[_0xca25('0x31')]=_[_0xca25('0x32')](_0x7b67f4[_0xca25('0x2e')],_0x7b67f4[_0xca25('0x30')]);_0x3e72cb['attributes']=_[_0xca25('0x32')](_0x7b67f4['model'],qs[_0xca25('0x33')](_0xfd888c[_0xca25('0x30')][_0xca25('0x33')]));_0x3e72cb['attributes']=_0x3e72cb[_0xca25('0x34')][_0xca25('0x35')]?_0x3e72cb[_0xca25('0x34')]:_0x7b67f4[_0xca25('0x2e')];if(!_0xfd888c[_0xca25('0x30')]['hasOwnProperty'](_0xca25('0x36'))){_0x3e72cb[_0xca25('0x1a')]=qs[_0xca25('0x1a')](_0xfd888c[_0xca25('0x30')][_0xca25('0x1a')]);_0x3e72cb[_0xca25('0x1c')]=qs[_0xca25('0x1c')](_0xfd888c['query']['offset']);}_0x3e72cb[_0xca25('0x37')]=qs[_0xca25('0x38')](_0xfd888c['query']['sort']);_0x3e72cb[_0xca25('0x39')]=qs[_0xca25('0x31')](_[_0xca25('0x3a')](_0xfd888c['query'],_0x7b67f4[_0xca25('0x31')]),_0x315f76);if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]){_0x3e72cb[_0xca25('0x39')]=_[_0xca25('0x3c')](_0x3e72cb[_0xca25('0x39')],{'$or':_['map'](_0x315f76,function(_0x290537){if(_0x290537['type']!==_0xca25('0x3d')){var _0x25880f={};_0x25880f[_0x290537[_0xca25('0x26')]]={'$like':'%'+_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]+'%'};return _0x25880f;}})});}_0x3e72cb=_[_0xca25('0x3c')]({},_0x3e72cb,_0xfd888c[_0xca25('0x3e')]);var _0x19984f={'where':_0x3e72cb[_0xca25('0x39')]};return db['FreshdeskField'][_0xca25('0x1b')](_0x19984f)['then'](function(_0x2d6f27){_0x190f27['count']=_0x2d6f27;if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3f')]){_0x3e72cb[_0xca25('0x40')]=[{'all':!![]}];}return db[_0xca25('0x2a')]['findAll'](_0x3e72cb);})[_0xca25('0x22')](function(_0x5aafa5){_0x190f27[_0xca25('0x41')]=_0x5aafa5;return _0x190f27;})[_0xca25('0x22')](respondWithFilteredResult(_0x1660a5,_0x3e72cb))['catch'](handleError(_0x1660a5,null));};exports[_0xca25('0x42')]=function(_0x183135,_0x52799a){var _0x2ff9c2={'raw':!![],'where':{'id':_0x183135[_0xca25('0x43')]['id']}},_0x1068c9={};_0x1068c9[_0xca25('0x2e')]=_['keys'](db[_0xca25('0x2a')][_0xca25('0x2b')]);_0x1068c9['query']=_['keys'](_0x183135['query']);_0x1068c9['filters']=_[_0xca25('0x32')](_0x1068c9[_0xca25('0x2e')],_0x1068c9[_0xca25('0x30')]);_0x2ff9c2[_0xca25('0x34')]=_['intersection'](_0x1068c9[_0xca25('0x2e')],qs[_0xca25('0x33')](_0x183135[_0xca25('0x30')][_0xca25('0x33')]));_0x2ff9c2['attributes']=_0x2ff9c2[_0xca25('0x34')]['length']?_0x2ff9c2[_0xca25('0x34')]:_0x1068c9[_0xca25('0x2e')];if(_0x183135[_0xca25('0x30')][_0xca25('0x3f')]){_0x2ff9c2[_0xca25('0x40')]=[{'all':!![]}];}_0x2ff9c2=_[_0xca25('0x3c')]({},_0x2ff9c2,_0x183135['options']);return db[_0xca25('0x2a')][_0xca25('0x44')](_0x2ff9c2)[_0xca25('0x22')](handleEntityNotFound(_0x52799a,null))[_0xca25('0x22')](respondWithResult(_0x52799a,null))[_0xca25('0x45')](handleError(_0x52799a,null));};exports[_0xca25('0x46')]=function(_0x1ad2d0,_0x352a17){return db[_0xca25('0x2a')][_0xca25('0x46')](_0x1ad2d0[_0xca25('0x47')],{})[_0xca25('0x22')](respondWithResult(_0x352a17,0xc9))[_0xca25('0x45')](handleError(_0x352a17,null));};exports[_0xca25('0x21')]=function(_0x3279e0,_0x1fba32){if(_0x3279e0[_0xca25('0x47')]['id']){delete _0x3279e0[_0xca25('0x47')]['id'];}return db['FreshdeskField'][_0xca25('0x44')]({'where':{'id':_0x3279e0[_0xca25('0x43')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x1fba32,null))[_0xca25('0x22')](saveUpdates(_0x3279e0['body'],null))[_0xca25('0x22')](respondWithResult(_0x1fba32,null))[_0xca25('0x45')](handleError(_0x1fba32,null));};exports['destroy']=function(_0x2bc528,_0x10692f){return db[_0xca25('0x2a')][_0xca25('0x44')]({'where':{'id':_0x2bc528['params']['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x10692f,null))['then'](removeEntity(_0x10692f,null))[_0xca25('0x45')](handleError(_0x10692f,null));}; \ No newline at end of file +var _0xf403=['error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','params','intersection','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xf403,0x1d3));var _0x3f40=function(_0x3ab7c7,_0x58347a){_0x3ab7c7=_0x3ab7c7-0x0;var _0x149229=_0xf403[_0x3ab7c7];return _0x149229;};'use strict';var emlformat=require(_0x3f40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f40('0x1'));var jsonpatch=require(_0x3f40('0x2'));var rp=require(_0x3f40('0x3'));var moment=require(_0x3f40('0x4'));var BPromise=require(_0x3f40('0x5'));var Mustache=require(_0x3f40('0x6'));var util=require(_0x3f40('0x7'));var path=require(_0x3f40('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f40('0x9'));var fs=require('fs');var fs_extra=require(_0x3f40('0xa'));var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332635,_0x509c02){_0x509c02=_0x509c02||0xcc;return function(_0x116460){if(_0x116460){return _0x332635[_0x3f40('0x17')](_0x509c02);}return _0x332635[_0x3f40('0x18')](_0x509c02)[_0x3f40('0x19')]();};}function respondWithResult(_0x569c6e,_0x2b2bfe){_0x2b2bfe=_0x2b2bfe||0xc8;return function(_0x308e97){if(_0x308e97){return _0x569c6e[_0x3f40('0x18')](_0x2b2bfe)[_0x3f40('0x1a')](_0x308e97);}};}function respondWithFilteredResult(_0x232241,_0x4e28b9){return function(_0x2e51ed){if(_0x2e51ed){var _0x3d11c9=typeof _0x4e28b9['offset']==='undefined'&&typeof _0x4e28b9['limit']===_0x3f40('0x1b');var _0x13b950=_0x2e51ed[_0x3f40('0x1c')];var _0x131e55=_0x3d11c9?0x0:_0x4e28b9[_0x3f40('0x1d')];var _0x5b4ebc=_0x3d11c9?_0x2e51ed[_0x3f40('0x1c')]:_0x4e28b9[_0x3f40('0x1d')]+_0x4e28b9[_0x3f40('0x1e')];var _0x29405a;if(_0x5b4ebc>=_0x13b950){_0x5b4ebc=_0x13b950;_0x29405a=0xc8;}else{_0x29405a=0xce;}_0x232241[_0x3f40('0x18')](_0x29405a);return _0x232241['set'](_0x3f40('0x1f'),_0x131e55+'-'+_0x5b4ebc+'/'+_0x13b950)['json'](_0x2e51ed);}return null;};}function patchUpdates(_0x12aabf){return function(_0x32b945){try{jsonpatch[_0x3f40('0x20')](_0x32b945,_0x12aabf,!![]);}catch(_0x113293){return BPromise[_0x3f40('0x21')](_0x113293);}return _0x32b945['save']();};}function saveUpdates(_0x27f5a5,_0x379b4e){return function(_0x117823){if(_0x117823){return _0x117823[_0x3f40('0x22')](_0x27f5a5)[_0x3f40('0x23')](function(_0xa1f39d){return _0xa1f39d;});}return null;};}function removeEntity(_0x4e1f47,_0x31fc91){return function(_0x59eb32){if(_0x59eb32){return _0x59eb32[_0x3f40('0x24')]()['then'](function(){_0x4e1f47[_0x3f40('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b47e,_0x5ae235){return function(_0x4b206b){if(!_0x4b206b){_0x37b47e['sendStatus'](0x194);}return _0x4b206b;};}function handleError(_0x30a945,_0x26e46b){_0x26e46b=_0x26e46b||0x1f4;return function(_0x140044){logger[_0x3f40('0x25')](_0x140044['stack']);if(_0x140044[_0x3f40('0x26')]){delete _0x140044['name'];}_0x30a945[_0x3f40('0x18')](_0x26e46b)[_0x3f40('0x27')](_0x140044);};}exports[_0x3f40('0x28')]=function(_0x5e0f25,_0x287632){var _0x4b5ef7={},_0x1cab5c={},_0x5b9079={'count':0x0,'rows':[]};var _0x49057b=_[_0x3f40('0x29')](db[_0x3f40('0x2a')][_0x3f40('0x2b')],function(_0xb23186){return{'name':_0xb23186[_0x3f40('0x2c')],'type':_0xb23186[_0x3f40('0x2d')][_0x3f40('0x2e')]};});_0x1cab5c[_0x3f40('0x2f')]=_['map'](_0x49057b,_0x3f40('0x26'));_0x1cab5c[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x5e0f25[_0x3f40('0x30')]);_0x1cab5c[_0x3f40('0x32')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],_0x1cab5c[_0x3f40('0x30')]);_0x4b5ef7[_0x3f40('0x33')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],qs[_0x3f40('0x34')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x34')]));_0x4b5ef7[_0x3f40('0x33')]=_0x4b5ef7[_0x3f40('0x33')][_0x3f40('0x35')]?_0x4b5ef7[_0x3f40('0x33')]:_0x1cab5c[_0x3f40('0x2f')];if(!_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x36')](_0x3f40('0x37'))){_0x4b5ef7[_0x3f40('0x1e')]=qs[_0x3f40('0x1e')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1e')]);_0x4b5ef7[_0x3f40('0x1d')]=qs[_0x3f40('0x1d')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1d')]);}_0x4b5ef7[_0x3f40('0x38')]=qs[_0x3f40('0x39')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x39')]);_0x4b5ef7[_0x3f40('0x3a')]=qs[_0x3f40('0x32')](_[_0x3f40('0x3b')](_0x5e0f25[_0x3f40('0x30')],_0x1cab5c[_0x3f40('0x32')]),_0x49057b);if(_0x5e0f25[_0x3f40('0x30')]['filter']){_0x4b5ef7['where']=_[_0x3f40('0x3c')](_0x4b5ef7[_0x3f40('0x3a')],{'$or':_[_0x3f40('0x29')](_0x49057b,function(_0x4778ec){if(_0x4778ec[_0x3f40('0x2d')]!==_0x3f40('0x3d')){var _0x1ffa33={};_0x1ffa33[_0x4778ec['name']]={'$like':'%'+_0x5e0f25[_0x3f40('0x30')]['filter']+'%'};return _0x1ffa33;}})});}_0x4b5ef7=_[_0x3f40('0x3c')]({},_0x4b5ef7,_0x5e0f25[_0x3f40('0x3e')]);var _0xec24e4={'where':_0x4b5ef7['where']};return db[_0x3f40('0x2a')][_0x3f40('0x1c')](_0xec24e4)['then'](function(_0x1eb15c){_0x5b9079[_0x3f40('0x1c')]=_0x1eb15c;if(_0x5e0f25['query'][_0x3f40('0x3f')]){_0x4b5ef7['include']=[{'all':!![]}];}return db[_0x3f40('0x2a')]['findAll'](_0x4b5ef7);})['then'](function(_0x8e89a){_0x5b9079['rows']=_0x8e89a;return _0x5b9079;})[_0x3f40('0x23')](respondWithFilteredResult(_0x287632,_0x4b5ef7))[_0x3f40('0x40')](handleError(_0x287632,null));};exports[_0x3f40('0x41')]=function(_0x460237,_0x48b65e){var _0x237c91={'raw':!![],'where':{'id':_0x460237[_0x3f40('0x42')]['id']}},_0x5b0eaa={};_0x5b0eaa[_0x3f40('0x2f')]=_[_0x3f40('0x31')](db['FreshdeskField']['rawAttributes']);_0x5b0eaa[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x460237[_0x3f40('0x30')]);_0x5b0eaa[_0x3f40('0x32')]=_[_0x3f40('0x43')](_0x5b0eaa[_0x3f40('0x2f')],_0x5b0eaa[_0x3f40('0x30')]);_0x237c91[_0x3f40('0x33')]=_['intersection'](_0x5b0eaa[_0x3f40('0x2f')],qs['fields'](_0x460237['query'][_0x3f40('0x34')]));_0x237c91[_0x3f40('0x33')]=_0x237c91[_0x3f40('0x33')][_0x3f40('0x35')]?_0x237c91[_0x3f40('0x33')]:_0x5b0eaa[_0x3f40('0x2f')];if(_0x460237[_0x3f40('0x30')][_0x3f40('0x3f')]){_0x237c91[_0x3f40('0x44')]=[{'all':!![]}];}_0x237c91=_[_0x3f40('0x3c')]({},_0x237c91,_0x460237[_0x3f40('0x3e')]);return db[_0x3f40('0x2a')][_0x3f40('0x45')](_0x237c91)[_0x3f40('0x23')](handleEntityNotFound(_0x48b65e,null))['then'](respondWithResult(_0x48b65e,null))[_0x3f40('0x40')](handleError(_0x48b65e,null));};exports['create']=function(_0x2c1fa2,_0x2f16d6){return db['FreshdeskField'][_0x3f40('0x46')](_0x2c1fa2[_0x3f40('0x47')],{})[_0x3f40('0x23')](respondWithResult(_0x2f16d6,0xc9))[_0x3f40('0x40')](handleError(_0x2f16d6,null));};exports[_0x3f40('0x22')]=function(_0x268ae4,_0x851bfc){if(_0x268ae4[_0x3f40('0x47')]['id']){delete _0x268ae4[_0x3f40('0x47')]['id'];}return db[_0x3f40('0x2a')][_0x3f40('0x45')]({'where':{'id':_0x268ae4[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x851bfc,null))[_0x3f40('0x23')](saveUpdates(_0x268ae4[_0x3f40('0x47')],null))[_0x3f40('0x23')](respondWithResult(_0x851bfc,null))[_0x3f40('0x40')](handleError(_0x851bfc,null));};exports[_0x3f40('0x24')]=function(_0x32bd05,_0x2d7e66){return db[_0x3f40('0x2a')]['find']({'where':{'id':_0x32bd05[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x2d7e66,null))[_0x3f40('0x23')](removeEntity(_0x2d7e66,null))[_0x3f40('0x40')](handleError(_0x2d7e66,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d734d00..6701527 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 _0xed1c=['request-promise','path','exports','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xed1c,0x7f));var _0xced1=function(_0x162419,_0x53310c){_0x162419=_0x162419-0x0;var _0xc3c9b6=_0xed1c[_0x162419];return _0xc3c9b6;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')(_0xced1('0x2'));var moment=require(_0xced1('0x3'));var BPromise=require(_0xced1('0x4'));var rp=require(_0xced1('0x5'));var fs=require('fs');var path=require(_0xced1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xced1('0x7')]=function(_0x4846c3,_0x39baa1){return _0x4846c3['define'](_0xced1('0x8'),attributes,{'tableName':_0xced1('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xced1('0xa'),_0xced1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd240=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','util'];(function(_0x322177,_0x4a29c4){var _0x357c57=function(_0x5114c9){while(--_0x5114c9){_0x322177['push'](_0x322177['shift']());}};_0x357c57(++_0x4a29c4);}(_0xd240,0x1c7));var _0x0d24=function(_0x52f938,_0x1d2c50){_0x52f938=_0x52f938-0x0;var _0x1be631=_0xd240[_0x52f938];return _0x1be631;};'use strict';var _=require('lodash');var util=require(_0x0d24('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0d24('0x1'));var BPromise=require(_0x0d24('0x2'));var rp=require(_0x0d24('0x3'));var fs=require('fs');var path=require(_0x0d24('0x4'));var rimraf=require(_0x0d24('0x5'));var config=require(_0x0d24('0x6'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x30fbee,_0x2accfe){return _0x30fbee[_0x0d24('0x7')](_0x0d24('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x0d24('0x9'),'fields':[_0x0d24('0xa'),_0x0d24('0xb')],'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 4457922..d848689 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 _0x6f53=['rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x12ec39,_0x2cd90e){var _0x54c1ef=function(_0x2923b4){while(--_0x2923b4){_0x12ec39['push'](_0x12ec39['shift']());}};_0x54c1ef(++_0x2cd90e);}(_0x6f53,0x11c));var _0x36f5=function(_0x4199b4,_0x4c1a97){_0x4199b4=_0x4199b4-0x0;var _0x2f0342=_0x6f53[_0x4199b4];return _0x2f0342;};'use strict';var _=require('lodash');var util=require(_0x36f5('0x0'));var moment=require(_0x36f5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36f5('0x2'));var db=require(_0x36f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36f5('0x4'));var config=require(_0x36f5('0x5'));var jayson=require(_0x36f5('0x6'));var client=jayson[_0x36f5('0x7')][_0x36f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31e1a3,_0xe62b76,_0x1182bd){return new BPromise(function(_0x3a0949,_0x13b6f9){return client['request'](_0x31e1a3,_0x1182bd)[_0x36f5('0x9')](function(_0x55f723){logger[_0x36f5('0xa')](_0x36f5('0xb'),_0xe62b76,_0x36f5('0xc'));logger[_0x36f5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xe62b76,'request\x20sent',JSON['stringify'](_0x55f723));if(_0x55f723[_0x36f5('0xe')]){if(_0x55f723[_0x36f5('0xe')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0xe62b76,_0x55f723[_0x36f5('0xe')]['message']);return _0x13b6f9(_0x55f723[_0x36f5('0xe')]['message']);}logger[_0x36f5('0xe')](_0x36f5('0xb'),_0xe62b76,_0x55f723['error'][_0x36f5('0xf')]);return _0x3a0949(_0x55f723[_0x36f5('0xe')][_0x36f5('0xf')]);}else{logger[_0x36f5('0xa')]('FreshdeskField,\x20%s,\x20%s',_0xe62b76,_0x36f5('0xc'));_0x3a0949(_0x55f723[_0x36f5('0x10')][_0x36f5('0xf')]);}})[_0x36f5('0x11')](function(_0x34e25f){logger[_0x36f5('0xe')](_0x36f5('0xb'),_0xe62b76,_0x34e25f);_0x13b6f9(_0x34e25f);});});} \ No newline at end of file +var _0xe64c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment'];(function(_0x4635e5,_0x5590a9){var _0x5a187b=function(_0x4e4f0c){while(--_0x4e4f0c){_0x4635e5['push'](_0x4635e5['shift']());}};_0x5a187b(++_0x5590a9);}(_0xe64c,0x112));var _0xce64=function(_0x5b1a7c,_0x17dd34){_0x5b1a7c=_0x5b1a7c-0x0;var _0x17250e=_0xe64c[_0x5b1a7c];return _0x17250e;};'use strict';var _=require('lodash');var util=require(_0xce64('0x0'));var moment=require(_0xce64('0x1'));var BPromise=require(_0xce64('0x2'));var rs=require(_0xce64('0x3'));var fs=require('fs');var Redis=require(_0xce64('0x4'));var db=require(_0xce64('0x5'))['db'];var utils=require(_0xce64('0x6'));var logger=require(_0xce64('0x7'))(_0xce64('0x8'));var config=require(_0xce64('0x9'));var jayson=require(_0xce64('0xa'));var client=jayson[_0xce64('0xb')][_0xce64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a2118,_0x524561,_0x239c89){return new BPromise(function(_0x551b35,_0x563dc4){return client[_0xce64('0xd')](_0x5a2118,_0x239c89)[_0xce64('0xe')](function(_0x3ef71e){logger[_0xce64('0xf')](_0xce64('0x10'),_0x524561,'request\x20sent');logger['debug'](_0xce64('0x11'),_0x524561,_0xce64('0x12'),JSON['stringify'](_0x3ef71e));if(_0x3ef71e[_0xce64('0x13')]){if(_0x3ef71e['error'][_0xce64('0x14')]===0x1f4){logger[_0xce64('0x13')](_0xce64('0x10'),_0x524561,_0x3ef71e[_0xce64('0x13')][_0xce64('0x15')]);return _0x563dc4(_0x3ef71e['error'][_0xce64('0x15')]);}logger[_0xce64('0x13')](_0xce64('0x10'),_0x524561,_0x3ef71e[_0xce64('0x13')][_0xce64('0x15')]);return _0x551b35(_0x3ef71e[_0xce64('0x13')]['message']);}else{logger['info'](_0xce64('0x10'),_0x524561,'request\x20sent');_0x551b35(_0x3ef71e[_0xce64('0x16')]['message']);}})['catch'](function(_0x1158e3){logger[_0xce64('0x13')](_0xce64('0x10'),_0x524561,_0x1158e3);_0x563dc4(_0x1158e3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index bc31270..e510586 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 _0x351d=['index','/:id','/:id/configurations','getFields','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x351d,0x90));var _0xd351=function(_0x34aa42,_0x3d6a77){_0x34aa42=_0x34aa42-0x0;var _0x149418=_0x351d[_0x34aa42];return _0x149418;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var fs_extra=require(_0xd351('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xd351('0x7')]('/',auth[_0xd351('0x8')](),controller[_0xd351('0x9')]);router['get'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['show']);router[_0xd351('0x7')](_0xd351('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd351('0x7')]('/:id/fields',auth[_0xd351('0x8')](),controller[_0xd351('0xc')]);router['post']('/',auth[_0xd351('0x8')](),controller[_0xd351('0xd')]);router['post'](_0xd351('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd351('0xe')](_0xd351('0xa'),auth[_0xd351('0x8')](),controller[_0xd351('0xf')]);router['delete'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['destroy']);module[_0xd351('0x10')]=router; \ No newline at end of file +var _0x1339=['/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x57914d,_0x59213b){var _0x15989f=function(_0x482fbe){while(--_0x482fbe){_0x57914d['push'](_0x57914d['shift']());}};_0x15989f(++_0x59213b);}(_0x1339,0x1ed));var _0x9133=function(_0x1a655e,_0x4f2b76){_0x1a655e=_0x1a655e-0x0;var _0x124559=_0x1339[_0x1a655e];return _0x124559;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0x8')](_0x9133('0xf'),auth[_0x9133('0x9')](),controller['getFields']);router[_0x9133('0x10')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x10')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['addConfiguration']);router[_0x9133('0x12')](_0x9133('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9133('0x13')]('/:id',auth[_0x9133('0x9')](),controller[_0x9133('0x14')]);module[_0x9133('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 4c2330b..f5e056c 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 _0x5b12=['STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5b12,0xa3));var _0x25b1=function(_0x1a4c48,_0x2ec891){_0x1a4c48=_0x1a4c48-0x0;var _0x3a4aba=_0x5b12[_0x1a4c48];return _0x3a4aba;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x282186,_0x433534){var _0x445ef5=function(_0x410099){while(--_0x410099){_0x282186['push'](_0x282186['shift']());}};_0x445ef5(++_0x433534);}(_0x25e7,0x1d6));var _0x725e=function(_0x44ceee,_0x2a5e28){_0x44ceee=_0x44ceee-0x0;var _0x1a065c=_0x25e7[_0x44ceee];return _0x1a065c;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4f2c8ef..2f8d06b 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 _0xca8b=['limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','FreshsalesAccount','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../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','offset','undefined'];(function(_0x51f5a1,_0x5238d4){var _0x39215b=function(_0x43f9fa){while(--_0x43f9fa){_0x51f5a1['push'](_0x51f5a1['shift']());}};_0x39215b(++_0x5238d4);}(_0xca8b,0xb7));var _0xbca8=function(_0x3368e5,_0x473946){_0x3368e5=_0x3368e5-0x0;var _0x34f28c=_0xca8b[_0x3368e5];return _0x34f28c;};'use strict';var emlformat=require(_0xbca8('0x0'));var rimraf=require(_0xbca8('0x1'));var zipdir=require(_0xbca8('0x2'));var jsonpatch=require(_0xbca8('0x3'));var rp=require(_0xbca8('0x4'));var moment=require('moment');var BPromise=require(_0xbca8('0x5'));var Mustache=require(_0xbca8('0x6'));var util=require(_0xbca8('0x7'));var path=require(_0xbca8('0x8'));var sox=require(_0xbca8('0x9'));var csv=require('to-csv');var ejs=require(_0xbca8('0xa'));var fs=require('fs');var fs_extra=require(_0xbca8('0xb'));var _=require('lodash');var squel=require(_0xbca8('0xc'));var crypto=require(_0xbca8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbca8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbca8('0xf'));var Papa=require(_0xbca8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbca8('0x11'));var as=require(_0xbca8('0x12'));var hardwareService=require(_0xbca8('0x13'));var logger=require(_0xbca8('0x14'))(_0xbca8('0x15'));var utils=require(_0xbca8('0x16'));var config=require(_0xbca8('0x17'));var licenseUtil=require(_0xbca8('0x18'));var db=require(_0xbca8('0x19'))['db'];var integrations=require(_0xbca8('0x1a'));function respondWithStatusCode(_0x28c878,_0x2a152d){_0x2a152d=_0x2a152d||0xcc;return function(_0x2a815d){if(_0x2a815d){return _0x28c878[_0xbca8('0x1b')](_0x2a152d);}return _0x28c878[_0xbca8('0x1c')](_0x2a152d)[_0xbca8('0x1d')]();};}function respondWithResult(_0x557671,_0x2a6f36){_0x2a6f36=_0x2a6f36||0xc8;return function(_0x2f1321){if(_0x2f1321){return _0x557671[_0xbca8('0x1c')](_0x2a6f36)[_0xbca8('0x1e')](_0x2f1321);}};}function respondWithFilteredResult(_0x2285f5,_0x34b99e){return function(_0x4cb48c){if(_0x4cb48c){var _0x2ef1f8=typeof _0x34b99e[_0xbca8('0x1f')]===_0xbca8('0x20')&&typeof _0x34b99e[_0xbca8('0x21')]==='undefined';var _0x433cc7=_0x4cb48c[_0xbca8('0x22')];var _0xf873fb=_0x2ef1f8?0x0:_0x34b99e[_0xbca8('0x1f')];var _0x7f9053=_0x2ef1f8?_0x4cb48c['count']:_0x34b99e['offset']+_0x34b99e[_0xbca8('0x21')];var _0x428246;if(_0x7f9053>=_0x433cc7){_0x7f9053=_0x433cc7;_0x428246=0xc8;}else{_0x428246=0xce;}_0x2285f5[_0xbca8('0x1c')](_0x428246);return _0x2285f5[_0xbca8('0x23')](_0xbca8('0x24'),_0xf873fb+'-'+_0x7f9053+'/'+_0x433cc7)[_0xbca8('0x1e')](_0x4cb48c);}return null;};}function patchUpdates(_0xbbe06e){return function(_0x4f2f54){try{jsonpatch[_0xbca8('0x25')](_0x4f2f54,_0xbbe06e,!![]);}catch(_0xc672f4){return BPromise[_0xbca8('0x26')](_0xc672f4);}return _0x4f2f54['save']();};}function saveUpdates(_0x57b26a,_0x217f12){return function(_0x2e934d){if(_0x2e934d){return _0x2e934d['update'](_0x57b26a)[_0xbca8('0x27')](function(_0x14cf5b){return _0x14cf5b;});}return null;};}function removeEntity(_0x19bdb0,_0x3c2c22){return function(_0x1db152){if(_0x1db152){return _0x1db152[_0xbca8('0x28')]()['then'](function(){_0x19bdb0[_0xbca8('0x1c')](0xcc)[_0xbca8('0x1d')]();});}};}function handleEntityNotFound(_0xa082f4,_0x93eeab){return function(_0x146012){if(!_0x146012){_0xa082f4[_0xbca8('0x1b')](0x194);}return _0x146012;};}function handleError(_0x2ac8a8,_0xf693e5){_0xf693e5=_0xf693e5||0x1f4;return function(_0x625775){logger[_0xbca8('0x29')](_0x625775[_0xbca8('0x2a')]);if(_0x625775[_0xbca8('0x2b')]){delete _0x625775[_0xbca8('0x2b')];}_0x2ac8a8['status'](_0xf693e5)[_0xbca8('0x2c')](_0x625775);};}exports['index']=function(_0x1f16b6,_0x4241cc){var _0x5004f2={},_0x1161dd={},_0x1ae285={'count':0x0,'rows':[]};var _0x5e7841=_['map'](db['FreshsalesAccount'][_0xbca8('0x2d')],function(_0x33c0ba){return{'name':_0x33c0ba[_0xbca8('0x2e')],'type':_0x33c0ba['type'][_0xbca8('0x2f')]};});_0x1161dd[_0xbca8('0x30')]=_[_0xbca8('0x31')](_0x5e7841,_0xbca8('0x2b'));_0x1161dd['query']=_[_0xbca8('0x32')](_0x1f16b6[_0xbca8('0x33')]);_0x1161dd[_0xbca8('0x34')]=_[_0xbca8('0x35')](_0x1161dd['model'],_0x1161dd['query']);_0x5004f2[_0xbca8('0x36')]=_[_0xbca8('0x35')](_0x1161dd[_0xbca8('0x30')],qs[_0xbca8('0x37')](_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x37')]));_0x5004f2[_0xbca8('0x36')]=_0x5004f2[_0xbca8('0x36')]['length']?_0x5004f2[_0xbca8('0x36')]:_0x1161dd[_0xbca8('0x30')];if(!_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x38')](_0xbca8('0x39'))){_0x5004f2[_0xbca8('0x21')]=qs['limit'](_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x21')]);_0x5004f2[_0xbca8('0x1f')]=qs[_0xbca8('0x1f')](_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x1f')]);}_0x5004f2[_0xbca8('0x3a')]=qs[_0xbca8('0x3b')](_0x1f16b6['query']['sort']);_0x5004f2[_0xbca8('0x3c')]=qs[_0xbca8('0x34')](_[_0xbca8('0x3d')](_0x1f16b6[_0xbca8('0x33')],_0x1161dd[_0xbca8('0x34')]),_0x5e7841);if(_0x1f16b6['query'][_0xbca8('0x3e')]){_0x5004f2[_0xbca8('0x3c')]=_[_0xbca8('0x3f')](_0x5004f2[_0xbca8('0x3c')],{'$or':_['map'](_0x5e7841,function(_0x44b28d){if(_0x44b28d[_0xbca8('0x40')]!=='VIRTUAL'){var _0x403f44={};_0x403f44[_0x44b28d[_0xbca8('0x2b')]]={'$like':'%'+_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x3e')]+'%'};return _0x403f44;}})});}_0x5004f2=_['merge']({},_0x5004f2,_0x1f16b6[_0xbca8('0x41')]);var _0x519963={'where':_0x5004f2['where']};return db[_0xbca8('0x42')][_0xbca8('0x22')](_0x519963)['then'](function(_0x576033){_0x1ae285[_0xbca8('0x22')]=_0x576033;if(_0x1f16b6[_0xbca8('0x33')][_0xbca8('0x43')]){_0x5004f2['include']=[{'all':!![]}];}return db[_0xbca8('0x42')][_0xbca8('0x44')](_0x5004f2);})[_0xbca8('0x27')](function(_0x3e9836){_0x1ae285[_0xbca8('0x45')]=_0x3e9836;return _0x1ae285;})[_0xbca8('0x27')](respondWithFilteredResult(_0x4241cc,_0x5004f2))[_0xbca8('0x46')](handleError(_0x4241cc,null));};exports[_0xbca8('0x47')]=function(_0x5808,_0x2c96e0){var _0xe3e6ab={'raw':![],'where':{'id':_0x5808[_0xbca8('0x48')]['id']}},_0x20bcfa={};_0x20bcfa[_0xbca8('0x30')]=_[_0xbca8('0x32')](db[_0xbca8('0x42')][_0xbca8('0x2d')]);_0x20bcfa['query']=_['keys'](_0x5808[_0xbca8('0x33')]);_0x20bcfa['filters']=_[_0xbca8('0x35')](_0x20bcfa[_0xbca8('0x30')],_0x20bcfa[_0xbca8('0x33')]);_0xe3e6ab['attributes']=_[_0xbca8('0x35')](_0x20bcfa[_0xbca8('0x30')],qs['fields'](_0x5808[_0xbca8('0x33')][_0xbca8('0x37')]));_0xe3e6ab[_0xbca8('0x36')]=_0xe3e6ab[_0xbca8('0x36')][_0xbca8('0x49')]?_0xe3e6ab['attributes']:_0x20bcfa[_0xbca8('0x30')];if(_0x5808['query'][_0xbca8('0x43')]){_0xe3e6ab[_0xbca8('0x4a')]=[{'all':!![]}];}_0xe3e6ab=_[_0xbca8('0x3f')]({},_0xe3e6ab,_0x5808[_0xbca8('0x41')]);return db[_0xbca8('0x42')][_0xbca8('0x4b')](_0xe3e6ab)[_0xbca8('0x27')](handleEntityNotFound(_0x2c96e0,null))[_0xbca8('0x27')](respondWithResult(_0x2c96e0,null))[_0xbca8('0x46')](handleError(_0x2c96e0,null));};exports['create']=function(_0x33ef9b,_0x66f71d){return db['FreshsalesAccount'][_0xbca8('0x4c')](_0x33ef9b[_0xbca8('0x4d')],{})[_0xbca8('0x27')](respondWithResult(_0x66f71d,0xc9))[_0xbca8('0x46')](handleError(_0x66f71d,null));};exports[_0xbca8('0x4e')]=function(_0x5c62ed,_0x3beae6){if(_0x5c62ed[_0xbca8('0x4d')]['id']){delete _0x5c62ed[_0xbca8('0x4d')]['id'];}return db[_0xbca8('0x42')][_0xbca8('0x4b')]({'where':{'id':_0x5c62ed[_0xbca8('0x48')]['id']}})['then'](handleEntityNotFound(_0x3beae6,null))[_0xbca8('0x27')](saveUpdates(_0x5c62ed['body'],null))[_0xbca8('0x27')](respondWithResult(_0x3beae6,null))[_0xbca8('0x46')](handleError(_0x3beae6,null));};exports['destroy']=function(_0x56bcf9,_0x4a74cc){return db[_0xbca8('0x42')][_0xbca8('0x4b')]({'where':{'id':_0x56bcf9[_0xbca8('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a74cc,null))[_0xbca8('0x27')](removeEntity(_0x4a74cc,null))[_0xbca8('0x46')](handleError(_0x4a74cc,null));};exports[_0xbca8('0x4f')]=function(_0x266e7a,_0x33674f,_0x35e016){var _0x306565={};var _0x39f2ec={};var _0x499060;var _0x479d08;return db['FreshsalesAccount'][_0xbca8('0x50')]({'where':{'id':_0x266e7a[_0xbca8('0x48')]['id']}})['then'](handleEntityNotFound(_0x33674f,null))['then'](function(_0x3065b9){if(_0x3065b9){_0x499060=_0x3065b9;_0x39f2ec[_0xbca8('0x30')]=_[_0xbca8('0x32')](db[_0xbca8('0x51')][_0xbca8('0x2d')]);_0x39f2ec[_0xbca8('0x33')]=_[_0xbca8('0x32')](_0x266e7a[_0xbca8('0x33')]);_0x39f2ec[_0xbca8('0x34')]=_[_0xbca8('0x35')](_0x39f2ec[_0xbca8('0x30')],_0x39f2ec[_0xbca8('0x33')]);_0x306565[_0xbca8('0x36')]=_['intersection'](_0x39f2ec[_0xbca8('0x30')],qs[_0xbca8('0x37')](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x37')]));_0x306565['attributes']=_0x306565[_0xbca8('0x36')][_0xbca8('0x49')]?_0x306565['attributes']:_0x39f2ec['model'];_0x306565['order']=qs['sort'](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x3b')]);_0x306565[_0xbca8('0x3c')]=qs[_0xbca8('0x34')](_[_0xbca8('0x3d')](_0x266e7a[_0xbca8('0x33')],_0x39f2ec['filters']));if(_0x266e7a[_0xbca8('0x33')]['filter']){_0x306565[_0xbca8('0x3c')]=_[_0xbca8('0x3f')](_0x306565[_0xbca8('0x3c')],{'$or':_[_0xbca8('0x31')](_0x306565['attributes'],function(_0x3e0891){var _0x3e95b3={};_0x3e95b3[_0x3e0891]={'$like':'%'+_0x266e7a[_0xbca8('0x33')][_0xbca8('0x3e')]+'%'};return _0x3e95b3;})});}_0x306565=_[_0xbca8('0x3f')]({},_0x306565,_0x266e7a[_0xbca8('0x41')]);return _0x499060[_0xbca8('0x4f')](_0x306565);}})[_0xbca8('0x27')](function(_0x3811fb){if(_0x3811fb){_0x479d08=_0x3811fb['length'];if(!_0x266e7a[_0xbca8('0x33')][_0xbca8('0x38')]('nolimit')){_0x306565[_0xbca8('0x21')]=qs[_0xbca8('0x21')](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x21')]);_0x306565[_0xbca8('0x1f')]=qs[_0xbca8('0x1f')](_0x266e7a[_0xbca8('0x33')][_0xbca8('0x1f')]);}return _0x499060[_0xbca8('0x4f')](_0x306565);}})[_0xbca8('0x27')](function(_0x57c5d3){if(_0x57c5d3){return _0x57c5d3?{'count':_0x479d08,'rows':_0x57c5d3}:null;}})[_0xbca8('0x27')](respondWithResult(_0x33674f,null))[_0xbca8('0x46')](handleError(_0x33674f,null));};exports[_0xbca8('0x52')]=function(_0x4d5c63,_0x417f64,_0x4cdec2){if(_0x4d5c63[_0xbca8('0x4d')]['id']){delete _0x4d5c63[_0xbca8('0x4d')]['id'];}return db[_0xbca8('0x42')][_0xbca8('0x50')]({'where':{'id':_0x4d5c63['params']['id']}})[_0xbca8('0x27')](handleEntityNotFound(_0x417f64,null))[_0xbca8('0x27')](function(_0x113931){if(_0x113931){_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x53')]=_0x113931['id'];_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x54')]=integrations[_0xbca8('0x55')](_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x56')],_0x4d5c63[_0xbca8('0x4d')]['type']);_0x4d5c63[_0xbca8('0x4d')]['Descriptions']=integrations[_0xbca8('0x57')](_0x4d5c63[_0xbca8('0x4d')]['channel'],_0x4d5c63[_0xbca8('0x4d')][_0xbca8('0x40')]);return db['FreshsalesConfiguration'][_0xbca8('0x4c')](_0x4d5c63[_0xbca8('0x4d')],{'include':[{'model':db[_0xbca8('0x58')],'as':'Subjects'},{'model':db[_0xbca8('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x417f64,null))['catch'](handleError(_0x417f64,null));};exports[_0xbca8('0x59')]=function(_0x4664b3,_0x5a7158,_0x2fdbcf){var _0x1b044b='';var _0x4c7bed='';return db['FreshsalesAccount'][_0xbca8('0x50')]({'where':{'id':_0x4664b3[_0xbca8('0x48')]['id']},'attributes':['id','username',_0xbca8('0x5a'),_0xbca8('0x5b')]})[_0xbca8('0x27')](handleEntityNotFound(_0x5a7158,null))['then'](function(_0x13892e){if(_0x13892e){_0x4c7bed=_0x13892e[_0xbca8('0x5c')];_0x1b044b=_0x13892e[_0xbca8('0x5a')];var _0x40cef4=_0x13892e[_0xbca8('0x5a')][_0xbca8('0x5d')](-0x1);if(_0x40cef4==='/'){_0x1b044b=_0x1b044b[_0xbca8('0x5e')](0x0,_0x1b044b[_0xbca8('0x5f')](_0x40cef4));}return rp({'method':_0xbca8('0x60'),'uri':util[_0xbca8('0x61')](_0xbca8('0x62'),_0x1b044b,_0xbca8('0x63')),'headers':{'Authorization':_0xbca8('0x64')+_0x13892e[_0xbca8('0x5b')]},'json':!![]});}})['then'](function(_0x3fe2ff){if(_0x3fe2ff){var _0x5055e4=_0x3fe2ff['users'];var _0xb5506d=![];var _0x1cc025=null;for(_0x1cc025=0x0;_0x1cc025<_0x5055e4[_0xbca8('0x49')];_0x1cc025++){if(_0x5055e4[_0x1cc025][_0xbca8('0x65')]===_0x4c7bed){_0xb5506d=!![];}}if(_0xb5506d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbca8('0x66')});}}})[_0xbca8('0x27')](respondWithResult(_0x5a7158,null))['catch'](function(_0x58248a){var _0xbc7e5f=_0x4664b3['query'][_0xbca8('0x67')]?0x1f4:_0x58248a[_0xbca8('0x68')]||0x1f4;logger[_0xbca8('0x29')](_0xbca8('0x69'),'getFields',_0xbc7e5f,JSON[_0xbca8('0x6a')](_0x58248a));delete _0x58248a[_0xbca8('0x2b')];if(_0xbc7e5f===0x191){_0xbc7e5f=0x190;}_0x5a7158[_0xbca8('0x1c')](_0xbc7e5f)[_0xbca8('0x2c')](_0x4664b3[_0xbca8('0x33')][_0xbca8('0x67')]?{'message':_0xbca8('0x6b'),'statusCode':_0x58248a[_0xbca8('0x68')]}:_0x58248a);});}; \ No newline at end of file +var _0xa7c9=['AccountId','Subjects','channel','FreshsalesField','Descriptions','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','keys','options','find','catch','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','order','pick','addConfiguration'];(function(_0x42c48c,_0x1e5cc5){var _0x16860a=function(_0xd5d8e8){while(--_0xd5d8e8){_0x42c48c['push'](_0x42c48c['shift']());}};_0x16860a(++_0x1e5cc5);}(_0xa7c9,0x7e));var _0x9a7c=function(_0xb6fb4e,_0x53444b){_0xb6fb4e=_0xb6fb4e-0x0;var _0x1c8b0f=_0xa7c9[_0xb6fb4e];return _0x1c8b0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a7c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a7c('0x1'));var moment=require(_0x9a7c('0x2'));var BPromise=require(_0x9a7c('0x3'));var Mustache=require(_0x9a7c('0x4'));var util=require(_0x9a7c('0x5'));var path=require(_0x9a7c('0x6'));var sox=require(_0x9a7c('0x7'));var csv=require(_0x9a7c('0x8'));var ejs=require(_0x9a7c('0x9'));var fs=require('fs');var fs_extra=require(_0x9a7c('0xa'));var _=require(_0x9a7c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a7c('0xc'));var toCsv=require(_0x9a7c('0x8'));var querystring=require(_0x9a7c('0xd'));var Papa=require(_0x9a7c('0xe'));var Redis=require(_0x9a7c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a7c('0x10'));var as=require(_0x9a7c('0x11'));var hardwareService=require(_0x9a7c('0x12'));var logger=require('../../config/logger')(_0x9a7c('0x13'));var utils=require(_0x9a7c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a7c('0x15'));var db=require(_0x9a7c('0x16'))['db'];var integrations=require(_0x9a7c('0x17'));function respondWithStatusCode(_0x358297,_0x30ec30){_0x30ec30=_0x30ec30||0xcc;return function(_0x5fe91c){if(_0x5fe91c){return _0x358297[_0x9a7c('0x18')](_0x30ec30);}return _0x358297[_0x9a7c('0x19')](_0x30ec30)[_0x9a7c('0x1a')]();};}function respondWithResult(_0x4a8b92,_0x32f412){_0x32f412=_0x32f412||0xc8;return function(_0x477893){if(_0x477893){return _0x4a8b92['status'](_0x32f412)['json'](_0x477893);}};}function respondWithFilteredResult(_0x4a128b,_0x4090a2){return function(_0x481048){if(_0x481048){var _0x3c840f=typeof _0x4090a2[_0x9a7c('0x1b')]===_0x9a7c('0x1c')&&typeof _0x4090a2[_0x9a7c('0x1d')]===_0x9a7c('0x1c');var _0x3163ed=_0x481048[_0x9a7c('0x1e')];var _0x2315bc=_0x3c840f?0x0:_0x4090a2[_0x9a7c('0x1b')];var _0x16ecb3=_0x3c840f?_0x481048[_0x9a7c('0x1e')]:_0x4090a2[_0x9a7c('0x1b')]+_0x4090a2['limit'];var _0x24ee60;if(_0x16ecb3>=_0x3163ed){_0x16ecb3=_0x3163ed;_0x24ee60=0xc8;}else{_0x24ee60=0xce;}_0x4a128b[_0x9a7c('0x19')](_0x24ee60);return _0x4a128b[_0x9a7c('0x1f')](_0x9a7c('0x20'),_0x2315bc+'-'+_0x16ecb3+'/'+_0x3163ed)[_0x9a7c('0x21')](_0x481048);}return null;};}function patchUpdates(_0x3cd9e4){return function(_0x56e522){try{jsonpatch[_0x9a7c('0x22')](_0x56e522,_0x3cd9e4,!![]);}catch(_0x5dd3a9){return BPromise[_0x9a7c('0x23')](_0x5dd3a9);}return _0x56e522[_0x9a7c('0x24')]();};}function saveUpdates(_0x3872f2,_0x1190b1){return function(_0x2d343f){if(_0x2d343f){return _0x2d343f['update'](_0x3872f2)[_0x9a7c('0x25')](function(_0x46b55f){return _0x46b55f;});}return null;};}function removeEntity(_0x3132c0,_0x14b838){return function(_0x4c6ece){if(_0x4c6ece){return _0x4c6ece[_0x9a7c('0x26')]()[_0x9a7c('0x25')](function(){_0x3132c0[_0x9a7c('0x19')](0xcc)[_0x9a7c('0x1a')]();});}};}function handleEntityNotFound(_0x15ae91,_0x131b42){return function(_0x38a930){if(!_0x38a930){_0x15ae91[_0x9a7c('0x18')](0x194);}return _0x38a930;};}function handleError(_0x23d3c9,_0x3f31d0){_0x3f31d0=_0x3f31d0||0x1f4;return function(_0xd68559){logger['error'](_0xd68559['stack']);if(_0xd68559['name']){delete _0xd68559[_0x9a7c('0x27')];}_0x23d3c9['status'](_0x3f31d0)[_0x9a7c('0x28')](_0xd68559);};}exports['index']=function(_0x303096,_0x3f36a0){var _0x4b04a7={},_0xeeb377={},_0x35fe08={'count':0x0,'rows':[]};var _0x2ac842=_[_0x9a7c('0x29')](db[_0x9a7c('0x2a')][_0x9a7c('0x2b')],function(_0x2d5ff9){return{'name':_0x2d5ff9[_0x9a7c('0x2c')],'type':_0x2d5ff9[_0x9a7c('0x2d')][_0x9a7c('0x2e')]};});_0xeeb377[_0x9a7c('0x2f')]=_[_0x9a7c('0x29')](_0x2ac842,_0x9a7c('0x27'));_0xeeb377[_0x9a7c('0x30')]=_['keys'](_0x303096['query']);_0xeeb377[_0x9a7c('0x31')]=_[_0x9a7c('0x32')](_0xeeb377[_0x9a7c('0x2f')],_0xeeb377['query']);_0x4b04a7['attributes']=_['intersection'](_0xeeb377['model'],qs[_0x9a7c('0x33')](_0x303096['query'][_0x9a7c('0x33')]));_0x4b04a7[_0x9a7c('0x34')]=_0x4b04a7[_0x9a7c('0x34')][_0x9a7c('0x35')]?_0x4b04a7[_0x9a7c('0x34')]:_0xeeb377[_0x9a7c('0x2f')];if(!_0x303096[_0x9a7c('0x30')][_0x9a7c('0x36')](_0x9a7c('0x37'))){_0x4b04a7['limit']=qs[_0x9a7c('0x1d')](_0x303096[_0x9a7c('0x30')][_0x9a7c('0x1d')]);_0x4b04a7[_0x9a7c('0x1b')]=qs[_0x9a7c('0x1b')](_0x303096[_0x9a7c('0x30')]['offset']);}_0x4b04a7['order']=qs[_0x9a7c('0x38')](_0x303096['query'][_0x9a7c('0x38')]);_0x4b04a7[_0x9a7c('0x39')]=qs[_0x9a7c('0x31')](_['pick'](_0x303096[_0x9a7c('0x30')],_0xeeb377['filters']),_0x2ac842);if(_0x303096[_0x9a7c('0x30')][_0x9a7c('0x3a')]){_0x4b04a7[_0x9a7c('0x39')]=_['merge'](_0x4b04a7[_0x9a7c('0x39')],{'$or':_[_0x9a7c('0x29')](_0x2ac842,function(_0x3f9856){if(_0x3f9856['type']!==_0x9a7c('0x3b')){var _0x500e62={};_0x500e62[_0x3f9856[_0x9a7c('0x27')]]={'$like':'%'+_0x303096['query'][_0x9a7c('0x3a')]+'%'};return _0x500e62;}})});}_0x4b04a7=_[_0x9a7c('0x3c')]({},_0x4b04a7,_0x303096['options']);var _0x3f5029={'where':_0x4b04a7['where']};return db[_0x9a7c('0x2a')][_0x9a7c('0x1e')](_0x3f5029)[_0x9a7c('0x25')](function(_0xe0144c){_0x35fe08[_0x9a7c('0x1e')]=_0xe0144c;if(_0x303096['query'][_0x9a7c('0x3d')]){_0x4b04a7['include']=[{'all':!![]}];}return db[_0x9a7c('0x2a')][_0x9a7c('0x3e')](_0x4b04a7);})['then'](function(_0x1a4beb){_0x35fe08[_0x9a7c('0x3f')]=_0x1a4beb;return _0x35fe08;})[_0x9a7c('0x25')](respondWithFilteredResult(_0x3f36a0,_0x4b04a7))['catch'](handleError(_0x3f36a0,null));};exports['show']=function(_0x28a98f,_0x2b49b9){var _0x4a17ea={'raw':![],'where':{'id':_0x28a98f['params']['id']}},_0x1c6783={};_0x1c6783[_0x9a7c('0x2f')]=_[_0x9a7c('0x40')](db[_0x9a7c('0x2a')][_0x9a7c('0x2b')]);_0x1c6783[_0x9a7c('0x30')]=_[_0x9a7c('0x40')](_0x28a98f[_0x9a7c('0x30')]);_0x1c6783[_0x9a7c('0x31')]=_[_0x9a7c('0x32')](_0x1c6783[_0x9a7c('0x2f')],_0x1c6783[_0x9a7c('0x30')]);_0x4a17ea[_0x9a7c('0x34')]=_['intersection'](_0x1c6783[_0x9a7c('0x2f')],qs[_0x9a7c('0x33')](_0x28a98f[_0x9a7c('0x30')]['fields']));_0x4a17ea['attributes']=_0x4a17ea[_0x9a7c('0x34')][_0x9a7c('0x35')]?_0x4a17ea[_0x9a7c('0x34')]:_0x1c6783[_0x9a7c('0x2f')];if(_0x28a98f['query'][_0x9a7c('0x3d')]){_0x4a17ea['include']=[{'all':!![]}];}_0x4a17ea=_[_0x9a7c('0x3c')]({},_0x4a17ea,_0x28a98f[_0x9a7c('0x41')]);return db[_0x9a7c('0x2a')][_0x9a7c('0x42')](_0x4a17ea)[_0x9a7c('0x25')](handleEntityNotFound(_0x2b49b9,null))['then'](respondWithResult(_0x2b49b9,null))[_0x9a7c('0x43')](handleError(_0x2b49b9,null));};exports['create']=function(_0x32c159,_0x4cea3c){return db[_0x9a7c('0x2a')][_0x9a7c('0x44')](_0x32c159[_0x9a7c('0x45')],{})['then'](respondWithResult(_0x4cea3c,0xc9))[_0x9a7c('0x43')](handleError(_0x4cea3c,null));};exports[_0x9a7c('0x46')]=function(_0x4c095e,_0x926a70){if(_0x4c095e[_0x9a7c('0x45')]['id']){delete _0x4c095e[_0x9a7c('0x45')]['id'];}return db[_0x9a7c('0x2a')][_0x9a7c('0x42')]({'where':{'id':_0x4c095e[_0x9a7c('0x47')]['id']}})['then'](handleEntityNotFound(_0x926a70,null))[_0x9a7c('0x25')](saveUpdates(_0x4c095e[_0x9a7c('0x45')],null))[_0x9a7c('0x25')](respondWithResult(_0x926a70,null))['catch'](handleError(_0x926a70,null));};exports[_0x9a7c('0x26')]=function(_0xd947d2,_0x472315){return db[_0x9a7c('0x2a')][_0x9a7c('0x42')]({'where':{'id':_0xd947d2['params']['id']}})[_0x9a7c('0x25')](handleEntityNotFound(_0x472315,null))[_0x9a7c('0x25')](removeEntity(_0x472315,null))['catch'](handleError(_0x472315,null));};exports[_0x9a7c('0x48')]=function(_0x3ba5b1,_0x633948,_0x204328){var _0x532552={};var _0x5d1190={};var _0x5a84bf;var _0x29af61;return db[_0x9a7c('0x2a')][_0x9a7c('0x49')]({'where':{'id':_0x3ba5b1[_0x9a7c('0x47')]['id']}})['then'](handleEntityNotFound(_0x633948,null))[_0x9a7c('0x25')](function(_0x4af9eb){if(_0x4af9eb){_0x5a84bf=_0x4af9eb;_0x5d1190[_0x9a7c('0x2f')]=_[_0x9a7c('0x40')](db[_0x9a7c('0x4a')]['rawAttributes']);_0x5d1190[_0x9a7c('0x30')]=_[_0x9a7c('0x40')](_0x3ba5b1[_0x9a7c('0x30')]);_0x5d1190[_0x9a7c('0x31')]=_[_0x9a7c('0x32')](_0x5d1190[_0x9a7c('0x2f')],_0x5d1190[_0x9a7c('0x30')]);_0x532552[_0x9a7c('0x34')]=_[_0x9a7c('0x32')](_0x5d1190[_0x9a7c('0x2f')],qs[_0x9a7c('0x33')](_0x3ba5b1[_0x9a7c('0x30')][_0x9a7c('0x33')]));_0x532552[_0x9a7c('0x34')]=_0x532552[_0x9a7c('0x34')][_0x9a7c('0x35')]?_0x532552[_0x9a7c('0x34')]:_0x5d1190['model'];_0x532552[_0x9a7c('0x4b')]=qs['sort'](_0x3ba5b1[_0x9a7c('0x30')][_0x9a7c('0x38')]);_0x532552[_0x9a7c('0x39')]=qs[_0x9a7c('0x31')](_[_0x9a7c('0x4c')](_0x3ba5b1[_0x9a7c('0x30')],_0x5d1190['filters']));if(_0x3ba5b1[_0x9a7c('0x30')][_0x9a7c('0x3a')]){_0x532552[_0x9a7c('0x39')]=_[_0x9a7c('0x3c')](_0x532552[_0x9a7c('0x39')],{'$or':_[_0x9a7c('0x29')](_0x532552[_0x9a7c('0x34')],function(_0x2063f6){var _0x27b968={};_0x27b968[_0x2063f6]={'$like':'%'+_0x3ba5b1[_0x9a7c('0x30')][_0x9a7c('0x3a')]+'%'};return _0x27b968;})});}_0x532552=_[_0x9a7c('0x3c')]({},_0x532552,_0x3ba5b1['options']);return _0x5a84bf[_0x9a7c('0x48')](_0x532552);}})[_0x9a7c('0x25')](function(_0x484135){if(_0x484135){_0x29af61=_0x484135['length'];if(!_0x3ba5b1['query'][_0x9a7c('0x36')](_0x9a7c('0x37'))){_0x532552[_0x9a7c('0x1d')]=qs[_0x9a7c('0x1d')](_0x3ba5b1['query'][_0x9a7c('0x1d')]);_0x532552[_0x9a7c('0x1b')]=qs['offset'](_0x3ba5b1[_0x9a7c('0x30')]['offset']);}return _0x5a84bf['getConfigurations'](_0x532552);}})[_0x9a7c('0x25')](function(_0x26723f){if(_0x26723f){return _0x26723f?{'count':_0x29af61,'rows':_0x26723f}:null;}})[_0x9a7c('0x25')](respondWithResult(_0x633948,null))['catch'](handleError(_0x633948,null));};exports[_0x9a7c('0x4d')]=function(_0x4339cd,_0x1fb135,_0x245581){if(_0x4339cd[_0x9a7c('0x45')]['id']){delete _0x4339cd[_0x9a7c('0x45')]['id'];}return db[_0x9a7c('0x2a')]['findOne']({'where':{'id':_0x4339cd[_0x9a7c('0x47')]['id']}})[_0x9a7c('0x25')](handleEntityNotFound(_0x1fb135,null))[_0x9a7c('0x25')](function(_0x586f95){if(_0x586f95){_0x4339cd['body'][_0x9a7c('0x4e')]=_0x586f95['id'];_0x4339cd['body'][_0x9a7c('0x4f')]=integrations['getSubjects'](_0x4339cd[_0x9a7c('0x45')]['channel'],_0x4339cd[_0x9a7c('0x45')][_0x9a7c('0x2d')]);_0x4339cd[_0x9a7c('0x45')]['Descriptions']=integrations['getDescriptions'](_0x4339cd['body'][_0x9a7c('0x50')],_0x4339cd[_0x9a7c('0x45')][_0x9a7c('0x2d')]);return db[_0x9a7c('0x4a')][_0x9a7c('0x44')](_0x4339cd[_0x9a7c('0x45')],{'include':[{'model':db[_0x9a7c('0x51')],'as':_0x9a7c('0x4f')},{'model':db[_0x9a7c('0x51')],'as':_0x9a7c('0x52')}]});}return null;})[_0x9a7c('0x25')](respondWithResult(_0x1fb135,null))['catch'](handleError(_0x1fb135,null));};exports[_0x9a7c('0x53')]=function(_0xc5938a,_0x5d612b,_0x43ae22){var _0x10fceb='';var _0x220be2='';return db[_0x9a7c('0x2a')][_0x9a7c('0x49')]({'where':{'id':_0xc5938a[_0x9a7c('0x47')]['id']},'attributes':['id',_0x9a7c('0x54'),_0x9a7c('0x55'),'apiKey']})['then'](handleEntityNotFound(_0x5d612b,null))[_0x9a7c('0x25')](function(_0x18d177){if(_0x18d177){_0x220be2=_0x18d177[_0x9a7c('0x54')];_0x10fceb=_0x18d177[_0x9a7c('0x55')];var _0x5236dc=_0x18d177[_0x9a7c('0x55')][_0x9a7c('0x56')](-0x1);if(_0x5236dc==='/'){_0x10fceb=_0x10fceb[_0x9a7c('0x57')](0x0,_0x10fceb[_0x9a7c('0x58')](_0x5236dc));}return rp({'method':_0x9a7c('0x59'),'uri':util[_0x9a7c('0x5a')](_0x9a7c('0x5b'),_0x10fceb,_0x9a7c('0x5c')),'headers':{'Authorization':_0x9a7c('0x5d')+_0x18d177[_0x9a7c('0x5e')]},'json':!![]});}})['then'](function(_0x23eb08){if(_0x23eb08){var _0x5cf736=_0x23eb08['users'];var _0x2a2165=![];var _0x329660=null;for(_0x329660=0x0;_0x329660<_0x5cf736[_0x9a7c('0x35')];_0x329660++){if(_0x5cf736[_0x329660][_0x9a7c('0x5f')]===_0x220be2){_0x2a2165=!![];}}if(_0x2a2165){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9a7c('0x60')});}}})[_0x9a7c('0x25')](respondWithResult(_0x5d612b,null))[_0x9a7c('0x43')](function(_0xbf7e21){var _0x198fbf=_0xc5938a[_0x9a7c('0x30')][_0x9a7c('0x61')]?0x1f4:_0xbf7e21[_0x9a7c('0x62')]||0x1f4;logger[_0x9a7c('0x63')](_0x9a7c('0x64'),_0x9a7c('0x53'),_0x198fbf,JSON[_0x9a7c('0x65')](_0xbf7e21));delete _0xbf7e21[_0x9a7c('0x27')];if(_0x198fbf===0x191){_0x198fbf=0x190;}_0x5d612b[_0x9a7c('0x19')](_0x198fbf)[_0x9a7c('0x28')](_0xc5938a['query'][_0x9a7c('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0xbf7e21[_0x9a7c('0x62')]}:_0xbf7e21);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7e3ec36..cfc0e8b 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 _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x5430,0x10c));var _0x0543=function(_0x4e9713,_0x347c77){_0x4e9713=_0x4e9713-0x0;var _0x2aa7b6=_0x5430[_0x4e9713];return _0x2aa7b6;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d11=['../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','moment','request-promise','path','./intFreshsalesAccount.attributes'];(function(_0x4a3a12,_0x458ca9){var _0x18975b=function(_0x4a5c17){while(--_0x4a5c17){_0x4a3a12['push'](_0x4a3a12['shift']());}};_0x18975b(++_0x458ca9);}(_0x6d11,0xbf));var _0x16d1=function(_0x59ad75,_0x23d697){_0x59ad75=_0x59ad75-0x0;var _0x2c18ea=_0x6d11[_0x59ad75];return _0x2c18ea;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));var integrations=require(_0x16d1('0x7'));module[_0x16d1('0x8')]=function(_0x38626d,_0x1009dc){return _0x38626d[_0x16d1('0x9')](_0x16d1('0xa'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 9b3f48c..8a523a7 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 _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x53cad4,_0xcf5021){_0x53cad4=_0x53cad4-0x0;var _0x56dad6=_0x4975[_0x53cad4];return _0x56dad6;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file +var _0x2da6=['info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0xc43140,_0x46ce6f){var _0x2f6792=function(_0x269e8f){while(--_0x269e8f){_0xc43140['push'](_0xc43140['shift']());}};_0x2f6792(++_0x46ce6f);}(_0x2da6,0x1dd));var _0x62da=function(_0x35fafd,_0x1af7df){_0x35fafd=_0x35fafd-0x0;var _0xc10f32=_0x2da6[_0x35fafd];return _0xc10f32;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['GetFreshsalesAccount']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['findAll']({'raw':_0xa7050b[_0x62da('0x19')]?_0xa7050b['options'][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1b')]||null:null,'attributes':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1c')]||null:null,'limit':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')]['limit']||null:null,'include':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')]?_[_0x62da('0x1e')](_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')],function(_0x24298a){return{'model':db[_0x24298a['model']],'as':_0x24298a['as'],'attributes':_0x24298a['attributes'],'include':_0x24298a['include']?_[_0x62da('0x1e')](_0x24298a[_0x62da('0x1d')],function(_0x14897c){return{'model':db[_0x14897c[_0x62da('0x1f')]],'as':_0x14897c['as'],'attributes':_0x14897c['attributes'],'include':_0x14897c[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x14897c['include'],function(_0x3ccf96){return{'model':db[_0x3ccf96[_0x62da('0x1f')]],'as':_0x3ccf96['as'],'attributes':_0x3ccf96[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41de3a){logger[_0x62da('0xd')](_0x62da('0x20'),_0xa7050b);logger['debug']('GetFreshsalesAccount',_0xa7050b,JSON[_0x62da('0x12')](_0x41de3a));_0x4d6482(_0x41de3a);})[_0x62da('0x17')](function(_0x220ffc){logger['error'](_0x62da('0x20'),_0x220ffc[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x220ffc[_0x62da('0x15')]));});});};exports[_0x62da('0x21')]=function(_0x1cf765){var _0x592c6c=this;return new Promise(function(_0xbe398f,_0x4f71bc){return db[_0x62da('0x18')][_0x62da('0x22')]({'raw':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cf765[_0x62da('0x19')]?_0x1cf765['options'][_0x62da('0x1b')]||null:null,'attributes':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')]['attributes']||null:null,'include':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')]?_['map'](_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')],function(_0x55eda7){return{'model':db[_0x55eda7[_0x62da('0x1f')]],'as':_0x55eda7['as'],'attributes':_0x55eda7[_0x62da('0x1c')],'include':_0x55eda7['include']?_[_0x62da('0x1e')](_0x55eda7[_0x62da('0x1d')],function(_0x11bf73){return{'model':db[_0x11bf73[_0x62da('0x1f')]],'as':_0x11bf73['as'],'attributes':_0x11bf73[_0x62da('0x1c')],'include':_0x11bf73[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x11bf73[_0x62da('0x1d')],function(_0x2f1115){return{'model':db[_0x2f1115[_0x62da('0x1f')]],'as':_0x2f1115['as'],'attributes':_0x2f1115[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62da('0xc')](function(_0x3057f6){logger[_0x62da('0xd')](_0x62da('0x21'),_0x1cf765);logger[_0x62da('0xf')](_0x62da('0x21'),_0x1cf765,JSON['stringify'](_0x3057f6));_0xbe398f(_0x3057f6);})[_0x62da('0x17')](function(_0x5e9295){logger[_0x62da('0x13')](_0x62da('0x21'),_0x5e9295[_0x62da('0x15')],_0x1cf765);_0x4f71bc(_0x592c6c['error'](0x1f4,_0x5e9295[_0x62da('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 314056e..6a82b0f 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 _0x2007=['getDescriptions','getFields','create','put','/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2007,0x158));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7200('0x0'));var util=require(_0x7200('0x1'));var path=require(_0x7200('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7200('0x3')]();var fs_extra=require(_0x7200('0x4'));var auth=require(_0x7200('0x5'));var interaction=require(_0x7200('0x6'));var config=require(_0x7200('0x7'));var controller=require(_0x7200('0x8'));router[_0x7200('0x9')]('/',auth['isAuthenticated'](),controller[_0x7200('0xa')]);router[_0x7200('0x9')]('/:id',auth[_0x7200('0xb')](),controller[_0x7200('0xc')]);router[_0x7200('0x9')](_0x7200('0xd'),auth[_0x7200('0xb')](),controller[_0x7200('0xe')]);router[_0x7200('0x9')](_0x7200('0xf'),auth['isAuthenticated'](),controller[_0x7200('0x10')]);router[_0x7200('0x9')]('/:id/fields',auth[_0x7200('0xb')](),controller[_0x7200('0x11')]);router['post']('/',auth[_0x7200('0xb')](),controller[_0x7200('0x12')]);router[_0x7200('0x13')](_0x7200('0x14'),auth[_0x7200('0xb')](),controller[_0x7200('0x15')]);router[_0x7200('0x16')](_0x7200('0x14'),auth[_0x7200('0xb')](),controller[_0x7200('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1bb7=['/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bb7,0x1a7));var _0x71bb=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1bb7[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x71bb('0x0'));var util=require('util');var path=require(_0x71bb('0x1'));var timeout=require(_0x71bb('0x2'));var express=require(_0x71bb('0x3'));var router=express[_0x71bb('0x4')]();var fs_extra=require(_0x71bb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x71bb('0x6'));router[_0x71bb('0x7')]('/',auth[_0x71bb('0x8')](),controller[_0x71bb('0x9')]);router[_0x71bb('0x7')](_0x71bb('0xa'),auth['isAuthenticated'](),controller[_0x71bb('0xb')]);router[_0x71bb('0x7')](_0x71bb('0xc'),auth[_0x71bb('0x8')](),controller[_0x71bb('0xd')]);router[_0x71bb('0x7')](_0x71bb('0xe'),auth[_0x71bb('0x8')](),controller['getDescriptions']);router[_0x71bb('0x7')](_0x71bb('0xf'),auth[_0x71bb('0x8')](),controller[_0x71bb('0x10')]);router[_0x71bb('0x11')]('/',auth[_0x71bb('0x8')](),controller[_0x71bb('0x12')]);router[_0x71bb('0x13')]('/:id',auth[_0x71bb('0x8')](),controller[_0x71bb('0x14')]);router[_0x71bb('0x15')](_0x71bb('0xa'),auth[_0x71bb('0x8')](),controller['destroy']);module[_0x71bb('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index ff33f80..48a3ce4 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 _0x6005=['exports','STRING','sequelize'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x6005,0x65));var _0x5600=function(_0x4e0365,_0x9454c6){_0x4e0365=_0x4e0365-0x0;var _0x181b39=_0x6005[_0x4e0365];return _0x181b39;};'use strict';var Sequelize=require(_0x5600('0x0'));module[_0x5600('0x1')]={'name':{'type':Sequelize[_0x5600('0x2')]},'description':{'type':Sequelize[_0x5600('0x2')]}}; \ No newline at end of file +var _0xdf83=['STRING','sequelize'];(function(_0x39501e,_0x241f9a){var _0x4a2a66=function(_0x4fdfba){while(--_0x4fdfba){_0x39501e['push'](_0x39501e['shift']());}};_0x4a2a66(++_0x241f9a);}(_0xdf83,0x137));var _0x3df8=function(_0x3a2734,_0x4cf230){_0x3a2734=_0x3a2734-0x0;var _0x3c960e=_0xdf83[_0x3a2734];return _0x3c960e;};'use strict';var Sequelize=require(_0x3df8('0x0'));module['exports']={'name':{'type':Sequelize[_0x3df8('0x1')]},'description':{'type':Sequelize[_0x3df8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3d54957..4f71870 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 _0xb1fc=['stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error'];(function(_0x52325b,_0x32e7a7){var _0x5e1b4c=function(_0x3eca03){while(--_0x3eca03){_0x52325b['push'](_0x52325b['shift']());}};_0x5e1b4c(++_0x32e7a7);}(_0xb1fc,0x17b));var _0xcb1f=function(_0x367b5c,_0x5c6e12){_0x367b5c=_0x367b5c-0x0;var _0x16c76b=_0xb1fc[_0x367b5c];return _0x16c76b;};'use strict';var emlformat=require(_0xcb1f('0x0'));var rimraf=require(_0xcb1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb1f('0x2'));var rp=require(_0xcb1f('0x3'));var moment=require(_0xcb1f('0x4'));var BPromise=require(_0xcb1f('0x5'));var Mustache=require('mustache');var util=require(_0xcb1f('0x6'));var path=require('path');var sox=require(_0xcb1f('0x7'));var csv=require(_0xcb1f('0x8'));var ejs=require(_0xcb1f('0x9'));var fs=require('fs');var fs_extra=require(_0xcb1f('0xa'));var _=require('lodash');var squel=require(_0xcb1f('0xb'));var crypto=require(_0xcb1f('0xc'));var jsforce=require(_0xcb1f('0xd'));var deskjs=require(_0xcb1f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb1f('0xf'));var Papa=require('papaparse');var Redis=require(_0xcb1f('0x10'));var authService=require(_0xcb1f('0x11'));var qs=require(_0xcb1f('0x12'));var as=require(_0xcb1f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb1f('0x14'))(_0xcb1f('0x15'));var utils=require(_0xcb1f('0x16'));var config=require(_0xcb1f('0x17'));var licenseUtil=require(_0xcb1f('0x18'));var db=require(_0xcb1f('0x19'))['db'];function respondWithStatusCode(_0x211910,_0x19a7cf){_0x19a7cf=_0x19a7cf||0xcc;return function(_0x12dd5e){if(_0x12dd5e){return _0x211910[_0xcb1f('0x1a')](_0x19a7cf);}return _0x211910[_0xcb1f('0x1b')](_0x19a7cf)[_0xcb1f('0x1c')]();};}function respondWithResult(_0x51e587,_0x2b5846){_0x2b5846=_0x2b5846||0xc8;return function(_0x3a2805){if(_0x3a2805){return _0x51e587[_0xcb1f('0x1b')](_0x2b5846)[_0xcb1f('0x1d')](_0x3a2805);}};}function respondWithFilteredResult(_0x4cad7f,_0x3c07ad){return function(_0x5ba26d){if(_0x5ba26d){var _0x5dda4a=typeof _0x3c07ad[_0xcb1f('0x1e')]===_0xcb1f('0x1f')&&typeof _0x3c07ad[_0xcb1f('0x20')]===_0xcb1f('0x1f');var _0x2c242b=_0x5ba26d['count'];var _0x3be34f=_0x5dda4a?0x0:_0x3c07ad[_0xcb1f('0x1e')];var _0x55d3c2=_0x5dda4a?_0x5ba26d[_0xcb1f('0x21')]:_0x3c07ad['offset']+_0x3c07ad[_0xcb1f('0x20')];var _0x4933a4;if(_0x55d3c2>=_0x2c242b){_0x55d3c2=_0x2c242b;_0x4933a4=0xc8;}else{_0x4933a4=0xce;}_0x4cad7f[_0xcb1f('0x1b')](_0x4933a4);return _0x4cad7f[_0xcb1f('0x22')]('Content-Range',_0x3be34f+'-'+_0x55d3c2+'/'+_0x2c242b)[_0xcb1f('0x1d')](_0x5ba26d);}return null;};}function patchUpdates(_0x108d3c){return function(_0x5f415a){try{jsonpatch[_0xcb1f('0x23')](_0x5f415a,_0x108d3c,!![]);}catch(_0x122f39){return BPromise[_0xcb1f('0x24')](_0x122f39);}return _0x5f415a[_0xcb1f('0x25')]();};}function saveUpdates(_0x3011b3,_0x530994){return function(_0x58969b){if(_0x58969b){return _0x58969b[_0xcb1f('0x26')](_0x3011b3)[_0xcb1f('0x27')](function(_0x9bb860){return _0x9bb860;});}return null;};}function removeEntity(_0x481621,_0x3d4ea3){return function(_0xbbbcf5){if(_0xbbbcf5){return _0xbbbcf5['destroy']()['then'](function(){_0x481621['status'](0xcc)[_0xcb1f('0x1c')]();});}};}function handleEntityNotFound(_0x30c8f3,_0x6ae5f3){return function(_0x49fa85){if(!_0x49fa85){_0x30c8f3['sendStatus'](0x194);}return _0x49fa85;};}function handleError(_0x4c8edf,_0x572954){_0x572954=_0x572954||0x1f4;return function(_0x2d276e){logger[_0xcb1f('0x28')](_0x2d276e[_0xcb1f('0x29')]);if(_0x2d276e[_0xcb1f('0x2a')]){delete _0x2d276e[_0xcb1f('0x2a')];}_0x4c8edf[_0xcb1f('0x1b')](_0x572954)[_0xcb1f('0x2b')](_0x2d276e);};}exports[_0xcb1f('0x2c')]=function(_0x592a2f,_0x29021d){var _0x3843bb={},_0x20012a={},_0x2b8d5d={'count':0x0,'rows':[]};var _0x2a08a4=_[_0xcb1f('0x2d')](db[_0xcb1f('0x2e')][_0xcb1f('0x2f')],function(_0x17727c){return{'name':_0x17727c['fieldName'],'type':_0x17727c[_0xcb1f('0x30')][_0xcb1f('0x31')]};});_0x20012a[_0xcb1f('0x32')]=_[_0xcb1f('0x2d')](_0x2a08a4,_0xcb1f('0x2a'));_0x20012a[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x592a2f['query']);_0x20012a[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x20012a[_0xcb1f('0x32')],_0x20012a['query']);_0x3843bb['attributes']=_[_0xcb1f('0x36')](_0x20012a[_0xcb1f('0x32')],qs[_0xcb1f('0x37')](_0x592a2f['query']['fields']));_0x3843bb[_0xcb1f('0x38')]=_0x3843bb[_0xcb1f('0x38')]['length']?_0x3843bb[_0xcb1f('0x38')]:_0x20012a[_0xcb1f('0x32')];if(!_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x3843bb[_0xcb1f('0x20')]=qs[_0xcb1f('0x20')](_0x592a2f[_0xcb1f('0x33')]['limit']);_0x3843bb['offset']=qs[_0xcb1f('0x1e')](_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x1e')]);}_0x3843bb[_0xcb1f('0x3b')]=qs[_0xcb1f('0x3c')](_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x3c')]);_0x3843bb[_0xcb1f('0x3d')]=qs['filters'](_[_0xcb1f('0x3e')](_0x592a2f[_0xcb1f('0x33')],_0x20012a[_0xcb1f('0x35')]),_0x2a08a4);if(_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x3f')]){_0x3843bb['where']=_[_0xcb1f('0x40')](_0x3843bb[_0xcb1f('0x3d')],{'$or':_['map'](_0x2a08a4,function(_0x13f9d5){if(_0x13f9d5[_0xcb1f('0x30')]!==_0xcb1f('0x41')){var _0x522836={};_0x522836[_0x13f9d5[_0xcb1f('0x2a')]]={'$like':'%'+_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x3f')]+'%'};return _0x522836;}})});}_0x3843bb=_['merge']({},_0x3843bb,_0x592a2f[_0xcb1f('0x42')]);var _0x36951e={'where':_0x3843bb['where']};return db[_0xcb1f('0x2e')][_0xcb1f('0x21')](_0x36951e)[_0xcb1f('0x27')](function(_0xc5bb2d){_0x2b8d5d[_0xcb1f('0x21')]=_0xc5bb2d;if(_0x592a2f[_0xcb1f('0x33')][_0xcb1f('0x43')]){_0x3843bb[_0xcb1f('0x44')]=[{'all':!![]}];}return db[_0xcb1f('0x2e')][_0xcb1f('0x45')](_0x3843bb);})[_0xcb1f('0x27')](function(_0x3f352e){_0x2b8d5d[_0xcb1f('0x46')]=_0x3f352e;return _0x2b8d5d;})[_0xcb1f('0x27')](respondWithFilteredResult(_0x29021d,_0x3843bb))[_0xcb1f('0x47')](handleError(_0x29021d,null));};exports[_0xcb1f('0x48')]=function(_0x58b53f,_0x5ed15f){var _0x57b6ec={'raw':![],'where':{'id':_0x58b53f['params']['id']}},_0x16dbfb={};_0x16dbfb['model']=_['keys'](db[_0xcb1f('0x2e')]['rawAttributes']);_0x16dbfb[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x58b53f[_0xcb1f('0x33')]);_0x16dbfb[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x16dbfb['model'],_0x16dbfb['query']);_0x57b6ec[_0xcb1f('0x38')]=_['intersection'](_0x16dbfb['model'],qs[_0xcb1f('0x37')](_0x58b53f[_0xcb1f('0x33')]['fields']));_0x57b6ec['attributes']=_0x57b6ec[_0xcb1f('0x38')][_0xcb1f('0x49')]?_0x57b6ec[_0xcb1f('0x38')]:_0x16dbfb[_0xcb1f('0x32')];if(_0x58b53f[_0xcb1f('0x33')][_0xcb1f('0x43')]){_0x57b6ec['include']=[{'all':!![]}];}_0x57b6ec=_['merge']({},_0x57b6ec,_0x58b53f[_0xcb1f('0x42')]);return db[_0xcb1f('0x2e')][_0xcb1f('0x4a')](_0x57b6ec)[_0xcb1f('0x27')](handleEntityNotFound(_0x5ed15f,null))[_0xcb1f('0x27')](respondWithResult(_0x5ed15f,null))[_0xcb1f('0x47')](handleError(_0x5ed15f,null));};exports['create']=function(_0x141144,_0x2197a9){return db[_0xcb1f('0x2e')][_0xcb1f('0x4b')](_0x141144[_0xcb1f('0x4c')],{})[_0xcb1f('0x27')](respondWithResult(_0x2197a9,0xc9))[_0xcb1f('0x47')](handleError(_0x2197a9,null));};exports[_0xcb1f('0x26')]=function(_0x83cdae,_0x565988){if(_0x83cdae['body']['id']){delete _0x83cdae['body']['id'];}return db[_0xcb1f('0x2e')][_0xcb1f('0x4a')]({'where':{'id':_0x83cdae[_0xcb1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x565988,null))[_0xcb1f('0x27')](saveUpdates(_0x83cdae[_0xcb1f('0x4c')],null))['then'](respondWithResult(_0x565988,null))[_0xcb1f('0x47')](handleError(_0x565988,null));};exports[_0xcb1f('0x4e')]=function(_0x452f65,_0x19594c){return db[_0xcb1f('0x2e')][_0xcb1f('0x4a')]({'where':{'id':_0x452f65[_0xcb1f('0x4d')]['id']}})[_0xcb1f('0x27')](handleEntityNotFound(_0x19594c,null))[_0xcb1f('0x27')](removeEntity(_0x19594c,null))[_0xcb1f('0x47')](handleError(_0x19594c,null));};exports['getSubjects']=function(_0x45e69c,_0x4d3c87,_0x190383){var _0x2216ab={};var _0x10d712={};var _0xcbfbc8;var _0x3b4160;return db['FreshsalesConfiguration'][_0xcb1f('0x4f')]({'where':{'id':_0x45e69c[_0xcb1f('0x4d')]['id']}})[_0xcb1f('0x27')](handleEntityNotFound(_0x4d3c87,null))['then'](function(_0x3aeece){if(_0x3aeece){_0xcbfbc8=_0x3aeece;_0x10d712['model']=_[_0xcb1f('0x34')](db[_0xcb1f('0x50')][_0xcb1f('0x2f')]);_0x10d712[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x45e69c[_0xcb1f('0x33')]);_0x10d712[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x10d712[_0xcb1f('0x32')],_0x10d712['query']);_0x2216ab[_0xcb1f('0x38')]=_['intersection'](_0x10d712[_0xcb1f('0x32')],qs[_0xcb1f('0x37')](_0x45e69c[_0xcb1f('0x33')]['fields']));_0x2216ab[_0xcb1f('0x38')]=_0x2216ab[_0xcb1f('0x38')][_0xcb1f('0x49')]?_0x2216ab[_0xcb1f('0x38')]:_0x10d712[_0xcb1f('0x32')];_0x2216ab[_0xcb1f('0x3b')]=qs['sort'](_0x45e69c[_0xcb1f('0x33')]['sort']);_0x2216ab[_0xcb1f('0x3d')]=qs[_0xcb1f('0x35')](_['pick'](_0x45e69c[_0xcb1f('0x33')],_0x10d712[_0xcb1f('0x35')]));if(_0x45e69c[_0xcb1f('0x33')]['filter']){_0x2216ab[_0xcb1f('0x3d')]=_['merge'](_0x2216ab[_0xcb1f('0x3d')],{'$or':_['map'](_0x2216ab[_0xcb1f('0x38')],function(_0x41a741){var _0x5c9dc9={};_0x5c9dc9[_0x41a741]={'$like':'%'+_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x3f')]+'%'};return _0x5c9dc9;})});}_0x2216ab=_[_0xcb1f('0x40')]({},_0x2216ab,_0x45e69c['options']);return _0xcbfbc8['getSubjects'](_0x2216ab);}})[_0xcb1f('0x27')](function(_0x28c960){if(_0x28c960){_0x3b4160=_0x28c960[_0xcb1f('0x49')];if(!_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x2216ab[_0xcb1f('0x20')]=qs['limit'](_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x20')]);_0x2216ab['offset']=qs[_0xcb1f('0x1e')](_0x45e69c[_0xcb1f('0x33')][_0xcb1f('0x1e')]);}return _0xcbfbc8[_0xcb1f('0x51')](_0x2216ab);}})[_0xcb1f('0x27')](function(_0xa3ef90){if(_0xa3ef90){return _0xa3ef90?{'count':_0x3b4160,'rows':_0xa3ef90}:null;}})[_0xcb1f('0x27')](respondWithResult(_0x4d3c87,null))['catch'](handleError(_0x4d3c87,null));};exports[_0xcb1f('0x52')]=function(_0x5a21d1,_0x352612,_0x117b99){var _0x92316a={};var _0x4b6362={};var _0x54a6ee;var _0x4439cc;return db[_0xcb1f('0x2e')]['findOne']({'where':{'id':_0x5a21d1[_0xcb1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x352612,null))[_0xcb1f('0x27')](function(_0x1a26af){if(_0x1a26af){_0x54a6ee=_0x1a26af;_0x4b6362[_0xcb1f('0x32')]=_['keys'](db[_0xcb1f('0x50')]['rawAttributes']);_0x4b6362['query']=_[_0xcb1f('0x34')](_0x5a21d1[_0xcb1f('0x33')]);_0x4b6362['filters']=_['intersection'](_0x4b6362[_0xcb1f('0x32')],_0x4b6362[_0xcb1f('0x33')]);_0x92316a['attributes']=_[_0xcb1f('0x36')](_0x4b6362['model'],qs[_0xcb1f('0x37')](_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x37')]));_0x92316a['attributes']=_0x92316a[_0xcb1f('0x38')][_0xcb1f('0x49')]?_0x92316a[_0xcb1f('0x38')]:_0x4b6362[_0xcb1f('0x32')];_0x92316a[_0xcb1f('0x3b')]=qs[_0xcb1f('0x3c')](_0x5a21d1[_0xcb1f('0x33')]['sort']);_0x92316a[_0xcb1f('0x3d')]=qs[_0xcb1f('0x35')](_[_0xcb1f('0x3e')](_0x5a21d1[_0xcb1f('0x33')],_0x4b6362[_0xcb1f('0x35')]));if(_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x3f')]){_0x92316a['where']=_[_0xcb1f('0x40')](_0x92316a[_0xcb1f('0x3d')],{'$or':_[_0xcb1f('0x2d')](_0x92316a[_0xcb1f('0x38')],function(_0x5df024){var _0x2b9b3d={};_0x2b9b3d[_0x5df024]={'$like':'%'+_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x3f')]+'%'};return _0x2b9b3d;})});}_0x92316a=_[_0xcb1f('0x40')]({},_0x92316a,_0x5a21d1['options']);return _0x54a6ee['getDescriptions'](_0x92316a);}})['then'](function(_0x5197bd){if(_0x5197bd){_0x4439cc=_0x5197bd['length'];if(!_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x92316a['limit']=qs['limit'](_0x5a21d1[_0xcb1f('0x33')][_0xcb1f('0x20')]);_0x92316a[_0xcb1f('0x1e')]=qs[_0xcb1f('0x1e')](_0x5a21d1['query'][_0xcb1f('0x1e')]);}return _0x54a6ee[_0xcb1f('0x52')](_0x92316a);}})[_0xcb1f('0x27')](function(_0x36e546){if(_0x36e546){return _0x36e546?{'count':_0x4439cc,'rows':_0x36e546}:null;}})[_0xcb1f('0x27')](respondWithResult(_0x352612,null))['catch'](handleError(_0x352612,null));};exports[_0xcb1f('0x53')]=function(_0x2dcf9d,_0x239fc2,_0x24bb56){var _0x4ad130={};var _0x37627a={};var _0x16a843;var _0x4b510e;return db['FreshsalesConfiguration'][_0xcb1f('0x4f')]({'where':{'id':_0x2dcf9d[_0xcb1f('0x4d')]['id']}})[_0xcb1f('0x27')](handleEntityNotFound(_0x239fc2,null))[_0xcb1f('0x27')](function(_0x4acf0c){if(_0x4acf0c){_0x16a843=_0x4acf0c;_0x37627a[_0xcb1f('0x32')]=_[_0xcb1f('0x34')](db[_0xcb1f('0x50')][_0xcb1f('0x2f')]);_0x37627a[_0xcb1f('0x33')]=_[_0xcb1f('0x34')](_0x2dcf9d[_0xcb1f('0x33')]);_0x37627a[_0xcb1f('0x35')]=_[_0xcb1f('0x36')](_0x37627a[_0xcb1f('0x32')],_0x37627a[_0xcb1f('0x33')]);_0x4ad130['attributes']=_[_0xcb1f('0x36')](_0x37627a[_0xcb1f('0x32')],qs[_0xcb1f('0x37')](_0x2dcf9d[_0xcb1f('0x33')][_0xcb1f('0x37')]));_0x4ad130[_0xcb1f('0x38')]=_0x4ad130[_0xcb1f('0x38')]['length']?_0x4ad130[_0xcb1f('0x38')]:_0x37627a[_0xcb1f('0x32')];_0x4ad130[_0xcb1f('0x3b')]=qs[_0xcb1f('0x3c')](_0x2dcf9d[_0xcb1f('0x33')]['sort']);_0x4ad130[_0xcb1f('0x3d')]=qs[_0xcb1f('0x35')](_[_0xcb1f('0x3e')](_0x2dcf9d['query'],_0x37627a[_0xcb1f('0x35')]));if(_0x2dcf9d['query'][_0xcb1f('0x3f')]){_0x4ad130[_0xcb1f('0x3d')]=_[_0xcb1f('0x40')](_0x4ad130[_0xcb1f('0x3d')],{'$or':_[_0xcb1f('0x2d')](_0x4ad130[_0xcb1f('0x38')],function(_0x2f8d40){var _0xdd5295={};_0xdd5295[_0x2f8d40]={'$like':'%'+_0x2dcf9d[_0xcb1f('0x33')]['filter']+'%'};return _0xdd5295;})});}_0x4ad130=_['merge']({},_0x4ad130,_0x2dcf9d[_0xcb1f('0x42')]);return _0x16a843[_0xcb1f('0x53')](_0x4ad130);}})[_0xcb1f('0x27')](function(_0x13691e){if(_0x13691e){_0x4b510e=_0x13691e[_0xcb1f('0x49')];if(!_0x2dcf9d[_0xcb1f('0x33')][_0xcb1f('0x39')](_0xcb1f('0x3a'))){_0x4ad130['limit']=qs['limit'](_0x2dcf9d[_0xcb1f('0x33')]['limit']);_0x4ad130[_0xcb1f('0x1e')]=qs[_0xcb1f('0x1e')](_0x2dcf9d['query']['offset']);}return _0x16a843[_0xcb1f('0x53')](_0x4ad130);}})[_0xcb1f('0x27')](function(_0x28b811){if(_0x28b811){return _0x28b811?{'count':_0x4b510e,'rows':_0x28b811}:null;}})[_0xcb1f('0x27')](respondWithResult(_0x239fc2,null))[_0xcb1f('0x47')](handleError(_0x239fc2,null));}; \ No newline at end of file +var _0x1af3=['FreshsalesField','pick','hasOwnProperty','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','getSubjects','findOne'];(function(_0x1486d7,_0x64d129){var _0x437f3f=function(_0x5c3ac2){while(--_0x5c3ac2){_0x1486d7['push'](_0x1486d7['shift']());}};_0x437f3f(++_0x64d129);}(_0x1af3,0x14d));var _0x31af=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x1af3[_0x2a0183];return _0x158c3a;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31af('0x1'));var jsonpatch=require(_0x31af('0x2'));var rp=require(_0x31af('0x3'));var moment=require(_0x31af('0x4'));var BPromise=require(_0x31af('0x5'));var Mustache=require(_0x31af('0x6'));var util=require(_0x31af('0x7'));var path=require(_0x31af('0x8'));var sox=require(_0x31af('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31af('0xa'));var _=require(_0x31af('0xb'));var squel=require(_0x31af('0xc'));var crypto=require(_0x31af('0xd'));var jsforce=require(_0x31af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x31af('0xf'));var querystring=require(_0x31af('0x10'));var Papa=require(_0x31af('0x11'));var Redis=require('ioredis');var authService=require(_0x31af('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31af('0x13'));var logger=require(_0x31af('0x14'))(_0x31af('0x15'));var utils=require(_0x31af('0x16'));var config=require(_0x31af('0x17'));var licenseUtil=require(_0x31af('0x18'));var db=require(_0x31af('0x19'))['db'];function respondWithStatusCode(_0x22c6d2,_0x3ee4df){_0x3ee4df=_0x3ee4df||0xcc;return function(_0x4541e5){if(_0x4541e5){return _0x22c6d2[_0x31af('0x1a')](_0x3ee4df);}return _0x22c6d2['status'](_0x3ee4df)[_0x31af('0x1b')]();};}function respondWithResult(_0x1fbc81,_0x593ddd){_0x593ddd=_0x593ddd||0xc8;return function(_0x452815){if(_0x452815){return _0x1fbc81[_0x31af('0x1c')](_0x593ddd)[_0x31af('0x1d')](_0x452815);}};}function respondWithFilteredResult(_0x16c7fc,_0x41cdd4){return function(_0x3744fc){if(_0x3744fc){var _0x54b06f=typeof _0x41cdd4[_0x31af('0x1e')]===_0x31af('0x1f')&&typeof _0x41cdd4['limit']===_0x31af('0x1f');var _0x5a77af=_0x3744fc['count'];var _0x4a1c0f=_0x54b06f?0x0:_0x41cdd4[_0x31af('0x1e')];var _0x43510c=_0x54b06f?_0x3744fc[_0x31af('0x20')]:_0x41cdd4[_0x31af('0x1e')]+_0x41cdd4[_0x31af('0x21')];var _0x54a8a1;if(_0x43510c>=_0x5a77af){_0x43510c=_0x5a77af;_0x54a8a1=0xc8;}else{_0x54a8a1=0xce;}_0x16c7fc[_0x31af('0x1c')](_0x54a8a1);return _0x16c7fc[_0x31af('0x22')]('Content-Range',_0x4a1c0f+'-'+_0x43510c+'/'+_0x5a77af)[_0x31af('0x1d')](_0x3744fc);}return null;};}function patchUpdates(_0x4abc87){return function(_0x14ada4){try{jsonpatch[_0x31af('0x23')](_0x14ada4,_0x4abc87,!![]);}catch(_0x5c41a5){return BPromise[_0x31af('0x24')](_0x5c41a5);}return _0x14ada4['save']();};}function saveUpdates(_0x7d75dd,_0x4234b4){return function(_0x57527e){if(_0x57527e){return _0x57527e[_0x31af('0x25')](_0x7d75dd)[_0x31af('0x26')](function(_0x2a38a1){return _0x2a38a1;});}return null;};}function removeEntity(_0x13bb64,_0x221453){return function(_0x163385){if(_0x163385){return _0x163385[_0x31af('0x27')]()['then'](function(){_0x13bb64[_0x31af('0x1c')](0xcc)[_0x31af('0x1b')]();});}};}function handleEntityNotFound(_0x3c0fed,_0x10da34){return function(_0x5c94fd){if(!_0x5c94fd){_0x3c0fed['sendStatus'](0x194);}return _0x5c94fd;};}function handleError(_0x3c6d0e,_0x3b8055){_0x3b8055=_0x3b8055||0x1f4;return function(_0x462b4c){logger[_0x31af('0x28')](_0x462b4c['stack']);if(_0x462b4c[_0x31af('0x29')]){delete _0x462b4c['name'];}_0x3c6d0e['status'](_0x3b8055)[_0x31af('0x2a')](_0x462b4c);};}exports[_0x31af('0x2b')]=function(_0x4a24f8,_0x501439){var _0x3af453={},_0x1dc542={},_0x4de077={'count':0x0,'rows':[]};var _0x3021ba=_['map'](db[_0x31af('0x2c')][_0x31af('0x2d')],function(_0x2a7737){return{'name':_0x2a7737[_0x31af('0x2e')],'type':_0x2a7737[_0x31af('0x2f')][_0x31af('0x30')]};});_0x1dc542['model']=_[_0x31af('0x31')](_0x3021ba,_0x31af('0x29'));_0x1dc542[_0x31af('0x32')]=_[_0x31af('0x33')](_0x4a24f8['query']);_0x1dc542[_0x31af('0x34')]=_[_0x31af('0x35')](_0x1dc542[_0x31af('0x36')],_0x1dc542[_0x31af('0x32')]);_0x3af453['attributes']=_[_0x31af('0x35')](_0x1dc542['model'],qs[_0x31af('0x37')](_0x4a24f8['query'][_0x31af('0x37')]));_0x3af453[_0x31af('0x38')]=_0x3af453['attributes'][_0x31af('0x39')]?_0x3af453['attributes']:_0x1dc542[_0x31af('0x36')];if(!_0x4a24f8[_0x31af('0x32')]['hasOwnProperty'](_0x31af('0x3a'))){_0x3af453[_0x31af('0x21')]=qs[_0x31af('0x21')](_0x4a24f8[_0x31af('0x32')][_0x31af('0x21')]);_0x3af453[_0x31af('0x1e')]=qs['offset'](_0x4a24f8[_0x31af('0x32')]['offset']);}_0x3af453[_0x31af('0x3b')]=qs[_0x31af('0x3c')](_0x4a24f8['query'][_0x31af('0x3c')]);_0x3af453[_0x31af('0x3d')]=qs[_0x31af('0x34')](_['pick'](_0x4a24f8['query'],_0x1dc542[_0x31af('0x34')]),_0x3021ba);if(_0x4a24f8[_0x31af('0x32')][_0x31af('0x3e')]){_0x3af453[_0x31af('0x3d')]=_[_0x31af('0x3f')](_0x3af453[_0x31af('0x3d')],{'$or':_[_0x31af('0x31')](_0x3021ba,function(_0x121f4a){if(_0x121f4a[_0x31af('0x2f')]!==_0x31af('0x40')){var _0x1dec01={};_0x1dec01[_0x121f4a[_0x31af('0x29')]]={'$like':'%'+_0x4a24f8['query'][_0x31af('0x3e')]+'%'};return _0x1dec01;}})});}_0x3af453=_[_0x31af('0x3f')]({},_0x3af453,_0x4a24f8[_0x31af('0x41')]);var _0x59a06c={'where':_0x3af453['where']};return db[_0x31af('0x2c')]['count'](_0x59a06c)[_0x31af('0x26')](function(_0xa76a14){_0x4de077[_0x31af('0x20')]=_0xa76a14;if(_0x4a24f8[_0x31af('0x32')][_0x31af('0x42')]){_0x3af453['include']=[{'all':!![]}];}return db[_0x31af('0x2c')][_0x31af('0x43')](_0x3af453);})[_0x31af('0x26')](function(_0xbf43a3){_0x4de077[_0x31af('0x44')]=_0xbf43a3;return _0x4de077;})[_0x31af('0x26')](respondWithFilteredResult(_0x501439,_0x3af453))[_0x31af('0x45')](handleError(_0x501439,null));};exports[_0x31af('0x46')]=function(_0x320a49,_0x40a67b){var _0x42e008={'raw':![],'where':{'id':_0x320a49[_0x31af('0x47')]['id']}},_0x15c6ab={};_0x15c6ab[_0x31af('0x36')]=_[_0x31af('0x33')](db[_0x31af('0x2c')]['rawAttributes']);_0x15c6ab[_0x31af('0x32')]=_[_0x31af('0x33')](_0x320a49[_0x31af('0x32')]);_0x15c6ab[_0x31af('0x34')]=_[_0x31af('0x35')](_0x15c6ab['model'],_0x15c6ab[_0x31af('0x32')]);_0x42e008[_0x31af('0x38')]=_[_0x31af('0x35')](_0x15c6ab[_0x31af('0x36')],qs['fields'](_0x320a49[_0x31af('0x32')][_0x31af('0x37')]));_0x42e008[_0x31af('0x38')]=_0x42e008[_0x31af('0x38')][_0x31af('0x39')]?_0x42e008[_0x31af('0x38')]:_0x15c6ab['model'];if(_0x320a49['query']['includeAll']){_0x42e008[_0x31af('0x48')]=[{'all':!![]}];}_0x42e008=_[_0x31af('0x3f')]({},_0x42e008,_0x320a49[_0x31af('0x41')]);return db[_0x31af('0x2c')][_0x31af('0x49')](_0x42e008)[_0x31af('0x26')](handleEntityNotFound(_0x40a67b,null))[_0x31af('0x26')](respondWithResult(_0x40a67b,null))[_0x31af('0x45')](handleError(_0x40a67b,null));};exports['create']=function(_0x4241f0,_0x104e8e){return db[_0x31af('0x2c')]['create'](_0x4241f0[_0x31af('0x4a')],{})[_0x31af('0x26')](respondWithResult(_0x104e8e,0xc9))[_0x31af('0x45')](handleError(_0x104e8e,null));};exports[_0x31af('0x25')]=function(_0x2f1411,_0x260f69){if(_0x2f1411[_0x31af('0x4a')]['id']){delete _0x2f1411[_0x31af('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0x31af('0x49')]({'where':{'id':_0x2f1411[_0x31af('0x47')]['id']}})['then'](handleEntityNotFound(_0x260f69,null))[_0x31af('0x26')](saveUpdates(_0x2f1411[_0x31af('0x4a')],null))[_0x31af('0x26')](respondWithResult(_0x260f69,null))[_0x31af('0x45')](handleError(_0x260f69,null));};exports[_0x31af('0x27')]=function(_0x193526,_0x572183){return db[_0x31af('0x2c')][_0x31af('0x49')]({'where':{'id':_0x193526[_0x31af('0x47')]['id']}})[_0x31af('0x26')](handleEntityNotFound(_0x572183,null))[_0x31af('0x26')](removeEntity(_0x572183,null))['catch'](handleError(_0x572183,null));};exports[_0x31af('0x4b')]=function(_0x57fa0a,_0x494d26,_0x10cdc2){var _0x31b3d5={};var _0x5ab679={};var _0x411d1c;var _0x29ae59;return db[_0x31af('0x2c')][_0x31af('0x4c')]({'where':{'id':_0x57fa0a[_0x31af('0x47')]['id']}})[_0x31af('0x26')](handleEntityNotFound(_0x494d26,null))[_0x31af('0x26')](function(_0x52380a){if(_0x52380a){_0x411d1c=_0x52380a;_0x5ab679['model']=_['keys'](db[_0x31af('0x4d')][_0x31af('0x2d')]);_0x5ab679[_0x31af('0x32')]=_['keys'](_0x57fa0a[_0x31af('0x32')]);_0x5ab679['filters']=_[_0x31af('0x35')](_0x5ab679[_0x31af('0x36')],_0x5ab679[_0x31af('0x32')]);_0x31b3d5[_0x31af('0x38')]=_[_0x31af('0x35')](_0x5ab679[_0x31af('0x36')],qs[_0x31af('0x37')](_0x57fa0a[_0x31af('0x32')]['fields']));_0x31b3d5[_0x31af('0x38')]=_0x31b3d5['attributes'][_0x31af('0x39')]?_0x31b3d5[_0x31af('0x38')]:_0x5ab679[_0x31af('0x36')];_0x31b3d5[_0x31af('0x3b')]=qs[_0x31af('0x3c')](_0x57fa0a['query']['sort']);_0x31b3d5['where']=qs[_0x31af('0x34')](_[_0x31af('0x4e')](_0x57fa0a['query'],_0x5ab679['filters']));if(_0x57fa0a['query'][_0x31af('0x3e')]){_0x31b3d5[_0x31af('0x3d')]=_['merge'](_0x31b3d5[_0x31af('0x3d')],{'$or':_[_0x31af('0x31')](_0x31b3d5[_0x31af('0x38')],function(_0x52fea1){var _0x36cfb8={};_0x36cfb8[_0x52fea1]={'$like':'%'+_0x57fa0a[_0x31af('0x32')][_0x31af('0x3e')]+'%'};return _0x36cfb8;})});}_0x31b3d5=_[_0x31af('0x3f')]({},_0x31b3d5,_0x57fa0a[_0x31af('0x41')]);return _0x411d1c[_0x31af('0x4b')](_0x31b3d5);}})[_0x31af('0x26')](function(_0x2b1f85){if(_0x2b1f85){_0x29ae59=_0x2b1f85['length'];if(!_0x57fa0a[_0x31af('0x32')][_0x31af('0x4f')](_0x31af('0x3a'))){_0x31b3d5['limit']=qs[_0x31af('0x21')](_0x57fa0a[_0x31af('0x32')][_0x31af('0x21')]);_0x31b3d5['offset']=qs[_0x31af('0x1e')](_0x57fa0a[_0x31af('0x32')]['offset']);}return _0x411d1c[_0x31af('0x4b')](_0x31b3d5);}})[_0x31af('0x26')](function(_0x2b73ed){if(_0x2b73ed){return _0x2b73ed?{'count':_0x29ae59,'rows':_0x2b73ed}:null;}})[_0x31af('0x26')](respondWithResult(_0x494d26,null))[_0x31af('0x45')](handleError(_0x494d26,null));};exports[_0x31af('0x50')]=function(_0x422350,_0x3f9a53,_0x36a5ee){var _0x3e6fcf={};var _0x7ee2be={};var _0x2c8538;var _0x13e0d7;return db[_0x31af('0x2c')]['findOne']({'where':{'id':_0x422350['params']['id']}})[_0x31af('0x26')](handleEntityNotFound(_0x3f9a53,null))[_0x31af('0x26')](function(_0x4b266d){if(_0x4b266d){_0x2c8538=_0x4b266d;_0x7ee2be[_0x31af('0x36')]=_[_0x31af('0x33')](db['FreshsalesField']['rawAttributes']);_0x7ee2be[_0x31af('0x32')]=_[_0x31af('0x33')](_0x422350[_0x31af('0x32')]);_0x7ee2be[_0x31af('0x34')]=_['intersection'](_0x7ee2be['model'],_0x7ee2be[_0x31af('0x32')]);_0x3e6fcf[_0x31af('0x38')]=_[_0x31af('0x35')](_0x7ee2be[_0x31af('0x36')],qs[_0x31af('0x37')](_0x422350[_0x31af('0x32')][_0x31af('0x37')]));_0x3e6fcf[_0x31af('0x38')]=_0x3e6fcf[_0x31af('0x38')]['length']?_0x3e6fcf[_0x31af('0x38')]:_0x7ee2be[_0x31af('0x36')];_0x3e6fcf[_0x31af('0x3b')]=qs[_0x31af('0x3c')](_0x422350[_0x31af('0x32')][_0x31af('0x3c')]);_0x3e6fcf[_0x31af('0x3d')]=qs[_0x31af('0x34')](_[_0x31af('0x4e')](_0x422350['query'],_0x7ee2be[_0x31af('0x34')]));if(_0x422350['query'][_0x31af('0x3e')]){_0x3e6fcf[_0x31af('0x3d')]=_[_0x31af('0x3f')](_0x3e6fcf[_0x31af('0x3d')],{'$or':_[_0x31af('0x31')](_0x3e6fcf[_0x31af('0x38')],function(_0x254314){var _0x1814d0={};_0x1814d0[_0x254314]={'$like':'%'+_0x422350[_0x31af('0x32')][_0x31af('0x3e')]+'%'};return _0x1814d0;})});}_0x3e6fcf=_['merge']({},_0x3e6fcf,_0x422350[_0x31af('0x41')]);return _0x2c8538[_0x31af('0x50')](_0x3e6fcf);}})['then'](function(_0x59dbfe){if(_0x59dbfe){_0x13e0d7=_0x59dbfe[_0x31af('0x39')];if(!_0x422350[_0x31af('0x32')]['hasOwnProperty'](_0x31af('0x3a'))){_0x3e6fcf[_0x31af('0x21')]=qs[_0x31af('0x21')](_0x422350['query'][_0x31af('0x21')]);_0x3e6fcf[_0x31af('0x1e')]=qs[_0x31af('0x1e')](_0x422350[_0x31af('0x32')]['offset']);}return _0x2c8538[_0x31af('0x50')](_0x3e6fcf);}})['then'](function(_0x4ac50d){if(_0x4ac50d){return _0x4ac50d?{'count':_0x13e0d7,'rows':_0x4ac50d}:null;}})[_0x31af('0x26')](respondWithResult(_0x3f9a53,null))['catch'](handleError(_0x3f9a53,null));};exports[_0x31af('0x51')]=function(_0x3667ae,_0x5e90ce,_0x2fd45f){var _0x36220e={};var _0x50a6fa={};var _0x1b849b;var _0x54f550;return db[_0x31af('0x2c')][_0x31af('0x4c')]({'where':{'id':_0x3667ae[_0x31af('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e90ce,null))['then'](function(_0x304db0){if(_0x304db0){_0x1b849b=_0x304db0;_0x50a6fa[_0x31af('0x36')]=_['keys'](db[_0x31af('0x4d')][_0x31af('0x2d')]);_0x50a6fa[_0x31af('0x32')]=_['keys'](_0x3667ae[_0x31af('0x32')]);_0x50a6fa[_0x31af('0x34')]=_[_0x31af('0x35')](_0x50a6fa[_0x31af('0x36')],_0x50a6fa[_0x31af('0x32')]);_0x36220e[_0x31af('0x38')]=_[_0x31af('0x35')](_0x50a6fa[_0x31af('0x36')],qs[_0x31af('0x37')](_0x3667ae[_0x31af('0x32')][_0x31af('0x37')]));_0x36220e['attributes']=_0x36220e[_0x31af('0x38')][_0x31af('0x39')]?_0x36220e[_0x31af('0x38')]:_0x50a6fa[_0x31af('0x36')];_0x36220e[_0x31af('0x3b')]=qs[_0x31af('0x3c')](_0x3667ae[_0x31af('0x32')]['sort']);_0x36220e[_0x31af('0x3d')]=qs['filters'](_[_0x31af('0x4e')](_0x3667ae[_0x31af('0x32')],_0x50a6fa['filters']));if(_0x3667ae[_0x31af('0x32')][_0x31af('0x3e')]){_0x36220e[_0x31af('0x3d')]=_['merge'](_0x36220e[_0x31af('0x3d')],{'$or':_[_0x31af('0x31')](_0x36220e[_0x31af('0x38')],function(_0x3fc006){var _0x27be8f={};_0x27be8f[_0x3fc006]={'$like':'%'+_0x3667ae[_0x31af('0x32')][_0x31af('0x3e')]+'%'};return _0x27be8f;})});}_0x36220e=_[_0x31af('0x3f')]({},_0x36220e,_0x3667ae['options']);return _0x1b849b['getFields'](_0x36220e);}})['then'](function(_0x393f3c){if(_0x393f3c){_0x54f550=_0x393f3c[_0x31af('0x39')];if(!_0x3667ae['query'][_0x31af('0x4f')](_0x31af('0x3a'))){_0x36220e['limit']=qs[_0x31af('0x21')](_0x3667ae[_0x31af('0x32')][_0x31af('0x21')]);_0x36220e[_0x31af('0x1e')]=qs[_0x31af('0x1e')](_0x3667ae[_0x31af('0x32')][_0x31af('0x1e')]);}return _0x1b849b['getFields'](_0x36220e);}})[_0x31af('0x26')](function(_0x58e136){if(_0x58e136){return _0x58e136?{'count':_0x54f550,'rows':_0x58e136}:null;}})[_0x31af('0x26')](respondWithResult(_0x5e90ce,null))[_0x31af('0x45')](handleError(_0x5e90ce,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1739a4a..e0f7724 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 _0xd56b=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x2760f1,_0x431f6b){var _0x175c71=function(_0x41f695){while(--_0x41f695){_0x2760f1['push'](_0x2760f1['shift']());}};_0x175c71(++_0x431f6b);}(_0xd56b,0x16f));var _0xbd56=function(_0x22077b,_0x5d75f1){_0x22077b=_0x22077b-0x0;var _0x50c8f9=_0xd56b[_0x22077b];return _0x50c8f9;};'use strict';var _=require(_0xbd56('0x0'));var util=require(_0xbd56('0x1'));var logger=require(_0xbd56('0x2'))(_0xbd56('0x3'));var moment=require(_0xbd56('0x4'));var BPromise=require(_0xbd56('0x5'));var rp=require(_0xbd56('0x6'));var fs=require('fs');var path=require(_0xbd56('0x7'));var rimraf=require(_0xbd56('0x8'));var config=require(_0xbd56('0x9'));var attributes=require(_0xbd56('0xa'));module[_0xbd56('0xb')]=function(_0x326c90,_0x25fa17){return _0x326c90['define'](_0xbd56('0xc'),attributes,{'tableName':_0xbd56('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa274=['request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0xa274,0x11b));var _0x4a27=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0xa274[_0x186222];return _0x226a38;};'use strict';var _=require(_0x4a27('0x0'));var util=require('util');var logger=require(_0x4a27('0x1'))(_0x4a27('0x2'));var moment=require(_0x4a27('0x3'));var BPromise=require(_0x4a27('0x4'));var rp=require(_0x4a27('0x5'));var fs=require('fs');var path=require(_0x4a27('0x6'));var rimraf=require('rimraf');var config=require(_0x4a27('0x7'));var attributes=require(_0x4a27('0x8'));module['exports']=function(_0x60d5de,_0x553a94){return _0x60d5de[_0x4a27('0x9')](_0x4a27('0xa'),attributes,{'tableName':_0x4a27('0xb'),'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 156e249..0a5a142 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 _0x5483=['rpc','../../config/environment','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfba429,_0x17b844){var _0x36d40f=function(_0x141cc5){while(--_0x141cc5){_0xfba429['push'](_0xfba429['shift']());}};_0x36d40f(++_0x17b844);}(_0x5483,0x1a8));var _0x3548=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x5483[_0x32cf96];return _0x125cc1;};'use strict';var _=require(_0x3548('0x0'));var util=require(_0x3548('0x1'));var moment=require(_0x3548('0x2'));var BPromise=require(_0x3548('0x3'));var rs=require(_0x3548('0x4'));var fs=require('fs');var Redis=require(_0x3548('0x5'));var db=require(_0x3548('0x6'))['db'];var utils=require(_0x3548('0x7'));var logger=require('../../config/logger')(_0x3548('0x8'));var config=require(_0x3548('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3548('0xa')][_0x3548('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e1987,_0x11f6d3,_0x496f49){return new BPromise(function(_0x3ddb6d,_0x24c179){return client['request'](_0x4e1987,_0x496f49)[_0x3548('0xc')](function(_0x2eafbf){logger['info'](_0x3548('0xd'),_0x11f6d3,_0x3548('0xe'));logger[_0x3548('0xf')](_0x3548('0x10'),_0x11f6d3,_0x3548('0xe'),JSON[_0x3548('0x11')](_0x2eafbf));if(_0x2eafbf[_0x3548('0x12')]){if(_0x2eafbf[_0x3548('0x12')][_0x3548('0x13')]===0x1f4){logger['error'](_0x3548('0xd'),_0x11f6d3,_0x2eafbf['error']['message']);return _0x24c179(_0x2eafbf[_0x3548('0x12')][_0x3548('0x14')]);}logger[_0x3548('0x12')](_0x3548('0xd'),_0x11f6d3,_0x2eafbf[_0x3548('0x12')][_0x3548('0x14')]);return _0x3ddb6d(_0x2eafbf[_0x3548('0x12')][_0x3548('0x14')]);}else{logger[_0x3548('0x15')](_0x3548('0xd'),_0x11f6d3,_0x3548('0xe'));_0x3ddb6d(_0x2eafbf[_0x3548('0x16')][_0x3548('0x14')]);}})[_0x3548('0x17')](function(_0x1ad5b8){logger[_0x3548('0x12')](_0x3548('0xd'),_0x11f6d3,_0x1ad5b8);_0x24c179(_0x1ad5b8);});});} \ No newline at end of file +var _0xb6f1=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment'];(function(_0x386352,_0xfac264){var _0x5bcdc3=function(_0x173af4){while(--_0x173af4){_0x386352['push'](_0x386352['shift']());}};_0x5bcdc3(++_0xfac264);}(_0xb6f1,0x7c));var _0x1b6f=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xb6f1[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var moment=require(_0x1b6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6f('0x2'));var fs=require('fs');var Redis=require(_0x1b6f('0x3'));var db=require(_0x1b6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b6f('0x5'))(_0x1b6f('0x6'));var config=require(_0x1b6f('0x7'));var jayson=require(_0x1b6f('0x8'));var client=jayson[_0x1b6f('0x9')][_0x1b6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49fb42,_0x2cc396,_0x381702){return new BPromise(function(_0x49f049,_0x35229d){return client['request'](_0x49fb42,_0x381702)[_0x1b6f('0xb')](function(_0x24f10c){logger[_0x1b6f('0xc')](_0x1b6f('0xd'),_0x2cc396,_0x1b6f('0xe'));logger['debug'](_0x1b6f('0xf'),_0x2cc396,_0x1b6f('0xe'),JSON['stringify'](_0x24f10c));if(_0x24f10c['error']){if(_0x24f10c['error'][_0x1b6f('0x10')]===0x1f4){logger[_0x1b6f('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2cc396,_0x24f10c['error'][_0x1b6f('0x12')]);return _0x35229d(_0x24f10c[_0x1b6f('0x11')]['message']);}logger[_0x1b6f('0x11')](_0x1b6f('0xd'),_0x2cc396,_0x24f10c['error'][_0x1b6f('0x12')]);return _0x49f049(_0x24f10c['error']['message']);}else{logger[_0x1b6f('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2cc396,_0x1b6f('0xe'));_0x49f049(_0x24f10c[_0x1b6f('0x13')]['message']);}})[_0x1b6f('0x14')](function(_0x4b00cb){logger[_0x1b6f('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2cc396,_0x4b00cb);_0x35229d(_0x4b00cb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 164b6f4..de9bc7b 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 _0x3c6d=['./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3c6d,0x199));var _0xd3c6=function(_0x402114,_0x18b963){_0x402114=_0x402114-0x0;var _0x1813a6=_0x3c6d[_0x402114];return _0x1813a6;};'use strict';var multer=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var path=require(_0xd3c6('0x2'));var timeout=require(_0xd3c6('0x3'));var express=require('express');var router=express[_0xd3c6('0x4')]();var fs_extra=require(_0xd3c6('0x5'));var auth=require(_0xd3c6('0x6'));var interaction=require(_0xd3c6('0x7'));var config=require(_0xd3c6('0x8'));var controller=require(_0xd3c6('0x9'));router['get']('/',auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xb')]);router[_0xd3c6('0xc')](_0xd3c6('0xd'),auth[_0xd3c6('0xa')](),controller[_0xd3c6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd3c6('0xf')]);router[_0xd3c6('0x10')](_0xd3c6('0xd'),auth['isAuthenticated'](),controller[_0xd3c6('0x11')]);router['delete'](_0xd3c6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3c6('0x12')]=router; \ No newline at end of file +var _0xbec5=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0x314d82,_0x52f61c){var _0x2f01bc=function(_0x531836){while(--_0x531836){_0x314d82['push'](_0x314d82['shift']());}};_0x2f01bc(++_0x52f61c);}(_0xbec5,0xe5));var _0x5bec=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xbec5[_0x1ee0a1];return _0x1d2d5b;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);module[_0x5bec('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8d606ae..d17ee34 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 _0x4e36=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x17ca23,_0x11c7d3){var _0x385e5c=function(_0x1d1d87){while(--_0x1d1d87){_0x17ca23['push'](_0x17ca23['shift']());}};_0x385e5c(++_0x11c7d3);}(_0x4e36,0x1b5));var _0x64e3=function(_0x4cc304,_0x33786f){_0x4cc304=_0x4cc304-0x0;var _0x98c06d=_0x4e36[_0x4cc304];return _0x98c06d;};'use strict';var Sequelize=require(_0x64e3('0x0'));module['exports']={'type':{'type':Sequelize[_0x64e3('0x1')](_0x64e3('0x2'),_0x64e3('0x3'),_0x64e3('0x4'),_0x64e3('0x5'),_0x64e3('0x6')),'defaultValue':_0x64e3('0x2')},'content':{'type':Sequelize[_0x64e3('0x7')]},'key':{'type':Sequelize[_0x64e3('0x7')]},'keyType':{'type':Sequelize[_0x64e3('0x1')](_0x64e3('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x64e3('0x7')]},'idField':{'type':Sequelize[_0x64e3('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x64e3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x31ca=['ENUM','customVariable','keyValue','picklist','STRING','string','variable','BOOLEAN','exports'];(function(_0x4c1ad8,_0x55e28d){var _0x2c617b=function(_0x5f80df){while(--_0x5f80df){_0x4c1ad8['push'](_0x4c1ad8['shift']());}};_0x2c617b(++_0x55e28d);}(_0x31ca,0xb3));var _0xa31c=function(_0x99a506,_0x5b4f9c){_0x99a506=_0x99a506-0x0;var _0x646330=_0x31ca[_0x99a506];return _0x646330;};'use strict';var Sequelize=require('sequelize');module[_0xa31c('0x0')]={'type':{'type':Sequelize[_0xa31c('0x1')]('string','variable',_0xa31c('0x2'),_0xa31c('0x3'),_0xa31c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa31c('0x5')]},'key':{'type':Sequelize[_0xa31c('0x5')]},'keyType':{'type':Sequelize[_0xa31c('0x1')](_0xa31c('0x6'),_0xa31c('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xa31c('0x5')]},'idField':{'type':Sequelize[_0xa31c('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa31c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa31c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e58af44..24483ae 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 _0x082b=['reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','type','options','where','FreshsalesField','count','includeAll','include','rows','show','find','create','body','catch','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','apply'];(function(_0x3b3178,_0x249501){var _0x1d0ee6=function(_0x23150b){while(--_0x23150b){_0x3b3178['push'](_0x3b3178['shift']());}};_0x1d0ee6(++_0x249501);}(_0x082b,0x140));var _0xb082=function(_0x211118,_0x47e09e){_0x211118=_0x211118-0x0;var _0x463d8c=_0x082b[_0x211118];return _0x463d8c;};'use strict';var emlformat=require(_0xb082('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb082('0x1'));var rp=require(_0xb082('0x2'));var moment=require(_0xb082('0x3'));var BPromise=require(_0xb082('0x4'));var Mustache=require(_0xb082('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb082('0x6'));var csv=require(_0xb082('0x7'));var ejs=require(_0xb082('0x8'));var fs=require('fs');var fs_extra=require(_0xb082('0x9'));var _=require(_0xb082('0xa'));var squel=require(_0xb082('0xb'));var crypto=require(_0xb082('0xc'));var jsforce=require(_0xb082('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb082('0x7'));var querystring=require(_0xb082('0xe'));var Papa=require(_0xb082('0xf'));var Redis=require(_0xb082('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb082('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb082('0x12'));var logger=require('../../config/logger')(_0xb082('0x13'));var utils=require(_0xb082('0x14'));var config=require(_0xb082('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb082('0x16'))['db'];function respondWithStatusCode(_0x420308,_0x1e40ef){_0x1e40ef=_0x1e40ef||0xcc;return function(_0x541773){if(_0x541773){return _0x420308[_0xb082('0x17')](_0x1e40ef);}return _0x420308['status'](_0x1e40ef)['end']();};}function respondWithResult(_0x1d92f0,_0xffc692){_0xffc692=_0xffc692||0xc8;return function(_0x55088f){if(_0x55088f){return _0x1d92f0[_0xb082('0x18')](_0xffc692)[_0xb082('0x19')](_0x55088f);}};}function respondWithFilteredResult(_0x274e61,_0x175214){return function(_0x5ee137){if(_0x5ee137){var _0x9e6240=typeof _0x175214[_0xb082('0x1a')]==='undefined'&&typeof _0x175214[_0xb082('0x1b')]===_0xb082('0x1c');var _0x3242eb=_0x5ee137['count'];var _0x445049=_0x9e6240?0x0:_0x175214[_0xb082('0x1a')];var _0x485416=_0x9e6240?_0x5ee137['count']:_0x175214[_0xb082('0x1a')]+_0x175214[_0xb082('0x1b')];var _0x6cdcf5;if(_0x485416>=_0x3242eb){_0x485416=_0x3242eb;_0x6cdcf5=0xc8;}else{_0x6cdcf5=0xce;}_0x274e61[_0xb082('0x18')](_0x6cdcf5);return _0x274e61['set']('Content-Range',_0x445049+'-'+_0x485416+'/'+_0x3242eb)[_0xb082('0x19')](_0x5ee137);}return null;};}function patchUpdates(_0x26f644){return function(_0x4aaac0){try{jsonpatch[_0xb082('0x1d')](_0x4aaac0,_0x26f644,!![]);}catch(_0x5ecbfb){return BPromise[_0xb082('0x1e')](_0x5ecbfb);}return _0x4aaac0['save']();};}function saveUpdates(_0x4969af,_0x7dc4bc){return function(_0x7ffa66){if(_0x7ffa66){return _0x7ffa66[_0xb082('0x1f')](_0x4969af)[_0xb082('0x20')](function(_0x59826b){return _0x59826b;});}return null;};}function removeEntity(_0x48237f,_0x37d2a0){return function(_0x567240){if(_0x567240){return _0x567240[_0xb082('0x21')]()[_0xb082('0x20')](function(){_0x48237f[_0xb082('0x18')](0xcc)[_0xb082('0x22')]();});}};}function handleEntityNotFound(_0x373cfe,_0x599567){return function(_0x21b076){if(!_0x21b076){_0x373cfe[_0xb082('0x17')](0x194);}return _0x21b076;};}function handleError(_0x47a1c8,_0x2e646a){_0x2e646a=_0x2e646a||0x1f4;return function(_0x23e597){logger[_0xb082('0x23')](_0x23e597[_0xb082('0x24')]);if(_0x23e597['name']){delete _0x23e597[_0xb082('0x25')];}_0x47a1c8[_0xb082('0x18')](_0x2e646a)[_0xb082('0x26')](_0x23e597);};}exports[_0xb082('0x27')]=function(_0x53cccf,_0x36a19e){var _0x2fb55b={},_0x11a669={},_0x4c7e2c={'count':0x0,'rows':[]};var _0x123dd9=_[_0xb082('0x28')](db['FreshsalesField'][_0xb082('0x29')],function(_0x12516e){return{'name':_0x12516e['fieldName'],'type':_0x12516e['type']['key']};});_0x11a669[_0xb082('0x2a')]=_[_0xb082('0x28')](_0x123dd9,_0xb082('0x25'));_0x11a669[_0xb082('0x2b')]=_['keys'](_0x53cccf[_0xb082('0x2b')]);_0x11a669['filters']=_[_0xb082('0x2c')](_0x11a669['model'],_0x11a669['query']);_0x2fb55b[_0xb082('0x2d')]=_['intersection'](_0x11a669['model'],qs[_0xb082('0x2e')](_0x53cccf['query']['fields']));_0x2fb55b[_0xb082('0x2d')]=_0x2fb55b[_0xb082('0x2d')][_0xb082('0x2f')]?_0x2fb55b['attributes']:_0x11a669[_0xb082('0x2a')];if(!_0x53cccf[_0xb082('0x2b')][_0xb082('0x30')](_0xb082('0x31'))){_0x2fb55b[_0xb082('0x1b')]=qs[_0xb082('0x1b')](_0x53cccf[_0xb082('0x2b')]['limit']);_0x2fb55b[_0xb082('0x1a')]=qs['offset'](_0x53cccf[_0xb082('0x2b')]['offset']);}_0x2fb55b[_0xb082('0x32')]=qs[_0xb082('0x33')](_0x53cccf[_0xb082('0x2b')]['sort']);_0x2fb55b['where']=qs[_0xb082('0x34')](_[_0xb082('0x35')](_0x53cccf['query'],_0x11a669[_0xb082('0x34')]),_0x123dd9);if(_0x53cccf[_0xb082('0x2b')][_0xb082('0x36')]){_0x2fb55b['where']=_[_0xb082('0x37')](_0x2fb55b['where'],{'$or':_['map'](_0x123dd9,function(_0x513f8b){if(_0x513f8b[_0xb082('0x38')]!=='VIRTUAL'){var _0x3523c8={};_0x3523c8[_0x513f8b[_0xb082('0x25')]]={'$like':'%'+_0x53cccf['query'][_0xb082('0x36')]+'%'};return _0x3523c8;}})});}_0x2fb55b=_[_0xb082('0x37')]({},_0x2fb55b,_0x53cccf[_0xb082('0x39')]);var _0x46bc33={'where':_0x2fb55b[_0xb082('0x3a')]};return db[_0xb082('0x3b')][_0xb082('0x3c')](_0x46bc33)[_0xb082('0x20')](function(_0x16f45a){_0x4c7e2c[_0xb082('0x3c')]=_0x16f45a;if(_0x53cccf['query'][_0xb082('0x3d')]){_0x2fb55b[_0xb082('0x3e')]=[{'all':!![]}];}return db[_0xb082('0x3b')]['findAll'](_0x2fb55b);})['then'](function(_0x423c6d){_0x4c7e2c[_0xb082('0x3f')]=_0x423c6d;return _0x4c7e2c;})[_0xb082('0x20')](respondWithFilteredResult(_0x36a19e,_0x2fb55b))['catch'](handleError(_0x36a19e,null));};exports[_0xb082('0x40')]=function(_0x54b17b,_0x469582){var _0x4e71d2={'raw':!![],'where':{'id':_0x54b17b['params']['id']}},_0x2168d2={};_0x2168d2['model']=_['keys'](db[_0xb082('0x3b')][_0xb082('0x29')]);_0x2168d2[_0xb082('0x2b')]=_['keys'](_0x54b17b['query']);_0x2168d2['filters']=_['intersection'](_0x2168d2[_0xb082('0x2a')],_0x2168d2[_0xb082('0x2b')]);_0x4e71d2[_0xb082('0x2d')]=_[_0xb082('0x2c')](_0x2168d2[_0xb082('0x2a')],qs[_0xb082('0x2e')](_0x54b17b['query']['fields']));_0x4e71d2[_0xb082('0x2d')]=_0x4e71d2[_0xb082('0x2d')][_0xb082('0x2f')]?_0x4e71d2[_0xb082('0x2d')]:_0x2168d2['model'];if(_0x54b17b[_0xb082('0x2b')]['includeAll']){_0x4e71d2[_0xb082('0x3e')]=[{'all':!![]}];}_0x4e71d2=_['merge']({},_0x4e71d2,_0x54b17b[_0xb082('0x39')]);return db[_0xb082('0x3b')][_0xb082('0x41')](_0x4e71d2)[_0xb082('0x20')](handleEntityNotFound(_0x469582,null))['then'](respondWithResult(_0x469582,null))['catch'](handleError(_0x469582,null));};exports[_0xb082('0x42')]=function(_0xb3634f,_0x58535){return db[_0xb082('0x3b')][_0xb082('0x42')](_0xb3634f[_0xb082('0x43')],{})[_0xb082('0x20')](respondWithResult(_0x58535,0xc9))[_0xb082('0x44')](handleError(_0x58535,null));};exports['update']=function(_0x5edb37,_0x2b8d32){if(_0x5edb37[_0xb082('0x43')]['id']){delete _0x5edb37[_0xb082('0x43')]['id'];}return db[_0xb082('0x3b')][_0xb082('0x41')]({'where':{'id':_0x5edb37[_0xb082('0x45')]['id']}})[_0xb082('0x20')](handleEntityNotFound(_0x2b8d32,null))['then'](saveUpdates(_0x5edb37['body'],null))[_0xb082('0x20')](respondWithResult(_0x2b8d32,null))[_0xb082('0x44')](handleError(_0x2b8d32,null));};exports['destroy']=function(_0x5b568b,_0x10c31e){return db['FreshsalesField'][_0xb082('0x41')]({'where':{'id':_0x5b568b[_0xb082('0x45')]['id']}})[_0xb082('0x20')](handleEntityNotFound(_0x10c31e,null))[_0xb082('0x20')](removeEntity(_0x10c31e,null))['catch'](handleError(_0x10c31e,null));}; \ No newline at end of file +var _0x79c8=['save','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply'];(function(_0x2e761d,_0x123e87){var _0x3a316a=function(_0x1a56a4){while(--_0x1a56a4){_0x2e761d['push'](_0x2e761d['shift']());}};_0x3a316a(++_0x123e87);}(_0x79c8,0x10e));var _0x879c=function(_0x3c6bc1,_0x40b3c7){_0x3c6bc1=_0x3c6bc1-0x0;var _0x215adf=_0x79c8[_0x3c6bc1];return _0x215adf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x879c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x879c('0x1'));var rp=require(_0x879c('0x2'));var moment=require(_0x879c('0x3'));var BPromise=require(_0x879c('0x4'));var Mustache=require('mustache');var util=require(_0x879c('0x5'));var path=require(_0x879c('0x6'));var sox=require(_0x879c('0x7'));var csv=require('to-csv');var ejs=require(_0x879c('0x8'));var fs=require('fs');var fs_extra=require(_0x879c('0x9'));var _=require(_0x879c('0xa'));var squel=require(_0x879c('0xb'));var crypto=require(_0x879c('0xc'));var jsforce=require(_0x879c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x879c('0xe'));var querystring=require(_0x879c('0xf'));var Papa=require(_0x879c('0x10'));var Redis=require(_0x879c('0x11'));var authService=require(_0x879c('0x12'));var qs=require(_0x879c('0x13'));var as=require(_0x879c('0x14'));var hardwareService=require(_0x879c('0x15'));var logger=require(_0x879c('0x16'))(_0x879c('0x17'));var utils=require(_0x879c('0x18'));var config=require(_0x879c('0x19'));var licenseUtil=require(_0x879c('0x1a'));var db=require(_0x879c('0x1b'))['db'];function respondWithStatusCode(_0x57c8b1,_0x2ddd42){_0x2ddd42=_0x2ddd42||0xcc;return function(_0x4b55ec){if(_0x4b55ec){return _0x57c8b1[_0x879c('0x1c')](_0x2ddd42);}return _0x57c8b1[_0x879c('0x1d')](_0x2ddd42)[_0x879c('0x1e')]();};}function respondWithResult(_0x1ad175,_0xaf3389){_0xaf3389=_0xaf3389||0xc8;return function(_0x1a5549){if(_0x1a5549){return _0x1ad175[_0x879c('0x1d')](_0xaf3389)['json'](_0x1a5549);}};}function respondWithFilteredResult(_0x556b53,_0x12e00e){return function(_0xbe48ab){if(_0xbe48ab){var _0x56862f=typeof _0x12e00e[_0x879c('0x1f')]==='undefined'&&typeof _0x12e00e[_0x879c('0x20')]===_0x879c('0x21');var _0x54d674=_0xbe48ab['count'];var _0xa18e69=_0x56862f?0x0:_0x12e00e[_0x879c('0x1f')];var _0x3d6855=_0x56862f?_0xbe48ab[_0x879c('0x22')]:_0x12e00e['offset']+_0x12e00e[_0x879c('0x20')];var _0x4e1633;if(_0x3d6855>=_0x54d674){_0x3d6855=_0x54d674;_0x4e1633=0xc8;}else{_0x4e1633=0xce;}_0x556b53[_0x879c('0x1d')](_0x4e1633);return _0x556b53['set'](_0x879c('0x23'),_0xa18e69+'-'+_0x3d6855+'/'+_0x54d674)[_0x879c('0x24')](_0xbe48ab);}return null;};}function patchUpdates(_0x51704c){return function(_0x1cc57a){try{jsonpatch[_0x879c('0x25')](_0x1cc57a,_0x51704c,!![]);}catch(_0x54fb30){return BPromise['reject'](_0x54fb30);}return _0x1cc57a[_0x879c('0x26')]();};}function saveUpdates(_0x3bfc30,_0x34c285){return function(_0x52faac){if(_0x52faac){return _0x52faac[_0x879c('0x27')](_0x3bfc30)[_0x879c('0x28')](function(_0x4ec2db){return _0x4ec2db;});}return null;};}function removeEntity(_0x56243f,_0x16a61b){return function(_0x2ec5f2){if(_0x2ec5f2){return _0x2ec5f2[_0x879c('0x29')]()[_0x879c('0x28')](function(){_0x56243f[_0x879c('0x1d')](0xcc)[_0x879c('0x1e')]();});}};}function handleEntityNotFound(_0x230970,_0x54c6b4){return function(_0x482c4f){if(!_0x482c4f){_0x230970[_0x879c('0x1c')](0x194);}return _0x482c4f;};}function handleError(_0x2529ec,_0x2c47d8){_0x2c47d8=_0x2c47d8||0x1f4;return function(_0x4f0d25){logger[_0x879c('0x2a')](_0x4f0d25['stack']);if(_0x4f0d25[_0x879c('0x2b')]){delete _0x4f0d25['name'];}_0x2529ec[_0x879c('0x1d')](_0x2c47d8)[_0x879c('0x2c')](_0x4f0d25);};}exports[_0x879c('0x2d')]=function(_0xa47814,_0x117e14){var _0x282181={},_0x382070={},_0x10620c={'count':0x0,'rows':[]};var _0x47a189=_[_0x879c('0x2e')](db[_0x879c('0x2f')][_0x879c('0x30')],function(_0x3efa2b){return{'name':_0x3efa2b[_0x879c('0x31')],'type':_0x3efa2b['type'][_0x879c('0x32')]};});_0x382070['model']=_['map'](_0x47a189,'name');_0x382070['query']=_[_0x879c('0x33')](_0xa47814[_0x879c('0x34')]);_0x382070['filters']=_[_0x879c('0x35')](_0x382070[_0x879c('0x36')],_0x382070[_0x879c('0x34')]);_0x282181[_0x879c('0x37')]=_[_0x879c('0x35')](_0x382070['model'],qs[_0x879c('0x38')](_0xa47814[_0x879c('0x34')][_0x879c('0x38')]));_0x282181[_0x879c('0x37')]=_0x282181[_0x879c('0x37')][_0x879c('0x39')]?_0x282181[_0x879c('0x37')]:_0x382070['model'];if(!_0xa47814[_0x879c('0x34')]['hasOwnProperty'](_0x879c('0x3a'))){_0x282181[_0x879c('0x20')]=qs[_0x879c('0x20')](_0xa47814[_0x879c('0x34')]['limit']);_0x282181['offset']=qs[_0x879c('0x1f')](_0xa47814[_0x879c('0x34')][_0x879c('0x1f')]);}_0x282181[_0x879c('0x3b')]=qs[_0x879c('0x3c')](_0xa47814[_0x879c('0x34')][_0x879c('0x3c')]);_0x282181['where']=qs[_0x879c('0x3d')](_[_0x879c('0x3e')](_0xa47814[_0x879c('0x34')],_0x382070[_0x879c('0x3d')]),_0x47a189);if(_0xa47814[_0x879c('0x34')]['filter']){_0x282181[_0x879c('0x3f')]=_[_0x879c('0x40')](_0x282181[_0x879c('0x3f')],{'$or':_['map'](_0x47a189,function(_0x50fb10){if(_0x50fb10['type']!==_0x879c('0x41')){var _0xf35076={};_0xf35076[_0x50fb10[_0x879c('0x2b')]]={'$like':'%'+_0xa47814['query'][_0x879c('0x42')]+'%'};return _0xf35076;}})});}_0x282181=_[_0x879c('0x40')]({},_0x282181,_0xa47814[_0x879c('0x43')]);var _0x441a30={'where':_0x282181[_0x879c('0x3f')]};return db[_0x879c('0x2f')][_0x879c('0x22')](_0x441a30)[_0x879c('0x28')](function(_0x4861af){_0x10620c[_0x879c('0x22')]=_0x4861af;if(_0xa47814['query'][_0x879c('0x44')]){_0x282181[_0x879c('0x45')]=[{'all':!![]}];}return db[_0x879c('0x2f')][_0x879c('0x46')](_0x282181);})[_0x879c('0x28')](function(_0x3017bc){_0x10620c[_0x879c('0x47')]=_0x3017bc;return _0x10620c;})[_0x879c('0x28')](respondWithFilteredResult(_0x117e14,_0x282181))[_0x879c('0x48')](handleError(_0x117e14,null));};exports[_0x879c('0x49')]=function(_0x411fdb,_0x2643db){var _0x5aa06f={'raw':!![],'where':{'id':_0x411fdb[_0x879c('0x4a')]['id']}},_0x39ff5a={};_0x39ff5a[_0x879c('0x36')]=_[_0x879c('0x33')](db[_0x879c('0x2f')][_0x879c('0x30')]);_0x39ff5a[_0x879c('0x34')]=_[_0x879c('0x33')](_0x411fdb[_0x879c('0x34')]);_0x39ff5a[_0x879c('0x3d')]=_[_0x879c('0x35')](_0x39ff5a[_0x879c('0x36')],_0x39ff5a[_0x879c('0x34')]);_0x5aa06f[_0x879c('0x37')]=_[_0x879c('0x35')](_0x39ff5a[_0x879c('0x36')],qs[_0x879c('0x38')](_0x411fdb[_0x879c('0x34')][_0x879c('0x38')]));_0x5aa06f['attributes']=_0x5aa06f[_0x879c('0x37')][_0x879c('0x39')]?_0x5aa06f['attributes']:_0x39ff5a['model'];if(_0x411fdb['query'][_0x879c('0x44')]){_0x5aa06f[_0x879c('0x45')]=[{'all':!![]}];}_0x5aa06f=_['merge']({},_0x5aa06f,_0x411fdb[_0x879c('0x43')]);return db[_0x879c('0x2f')][_0x879c('0x4b')](_0x5aa06f)[_0x879c('0x28')](handleEntityNotFound(_0x2643db,null))[_0x879c('0x28')](respondWithResult(_0x2643db,null))[_0x879c('0x48')](handleError(_0x2643db,null));};exports['create']=function(_0x25258a,_0x369e92){return db['FreshsalesField']['create'](_0x25258a['body'],{})['then'](respondWithResult(_0x369e92,0xc9))['catch'](handleError(_0x369e92,null));};exports[_0x879c('0x27')]=function(_0x3e91d5,_0x5e2476){if(_0x3e91d5[_0x879c('0x4c')]['id']){delete _0x3e91d5[_0x879c('0x4c')]['id'];}return db['FreshsalesField'][_0x879c('0x4b')]({'where':{'id':_0x3e91d5['params']['id']}})[_0x879c('0x28')](handleEntityNotFound(_0x5e2476,null))['then'](saveUpdates(_0x3e91d5[_0x879c('0x4c')],null))[_0x879c('0x28')](respondWithResult(_0x5e2476,null))[_0x879c('0x48')](handleError(_0x5e2476,null));};exports[_0x879c('0x29')]=function(_0x2f605a,_0x4d33cb){return db[_0x879c('0x2f')][_0x879c('0x4b')]({'where':{'id':_0x2f605a['params']['id']}})[_0x879c('0x28')](handleEntityNotFound(_0x4d33cb,null))[_0x879c('0x28')](removeEntity(_0x4d33cb,null))['catch'](handleError(_0x4d33cb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 35b3a2c..f3cd1bd 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 _0xbb35=['idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index'];(function(_0x4cf2b6,_0x4d2485){var _0xd3c24f=function(_0x16ede5){while(--_0x16ede5){_0x4cf2b6['push'](_0x4cf2b6['shift']());}};_0xd3c24f(++_0x4d2485);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x305ba9,_0x42ce42){_0x305ba9=_0x305ba9-0x0;var _0x368966=_0xbb35[_0x305ba9];return _0x368966;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5bb3('0xc'),'fields':[_0x5bb3('0xd'),_0x5bb3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20d6=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x55c379,_0x1565e6){var _0x1164e7=function(_0x2c7baa){while(--_0x2c7baa){_0x55c379['push'](_0x55c379['shift']());}};_0x1164e7(++_0x1565e6);}(_0x20d6,0x1b8));var _0x620d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x20d6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var logger=require(_0x620d('0x2'))(_0x620d('0x3'));var moment=require('moment');var BPromise=require(_0x620d('0x4'));var rp=require(_0x620d('0x5'));var fs=require('fs');var path=require(_0x620d('0x6'));var rimraf=require(_0x620d('0x7'));var config=require(_0x620d('0x8'));var attributes=require(_0x620d('0x9'));module[_0x620d('0xa')]=function(_0x46fc14,_0x28e29a){return _0x46fc14[_0x620d('0xb')](_0x620d('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x620d('0xd'),'fields':['idField','FieldId'],'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 9229763..d8347ab 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2a173d,_0x27ca7a){var _0x37f81e=function(_0x1a4ab0){while(--_0x1a4ab0){_0x2a173d['push'](_0x2a173d['shift']());}};_0x37f81e(++_0x27ca7a);}(_0x33af,0xec));var _0xf33a=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0x33af[_0x2649e2];return _0x4797d4;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0xfcf0[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4e263c4..f8fc819 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(_0x1093de,_0x2a2e36){var _0x75d610=function(_0x412e4d){while(--_0x412e4d){_0x1093de['push'](_0x1093de['shift']());}};_0x75d610(++_0x2a2e36);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 _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(_0x5682d0,_0x45c554){var _0x5f5b14=function(_0x400a78){while(--_0x400a78){_0x5682d0['push'](_0x5682d0['shift']());}};_0x5f5b14(++_0x45c554);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7a9fbeb..8698b86 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 _0x6888=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x6888,0xd2));var _0x8688=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6888[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x8688('0x0'));module['exports']={'name':{'type':Sequelize[_0x8688('0x1')]},'description':{'type':Sequelize[_0x8688('0x1')]},'username':{'type':Sequelize[_0x8688('0x1')],'unique':_0x8688('0x2')},'remoteUri':{'type':Sequelize[_0x8688('0x1')]},'password':{'type':Sequelize[_0x8688('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x8688('0x1')]},'serverUrl':{'type':Sequelize[_0x8688('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8688('0x3')](_0x8688('0x4'),_0x8688('0x5')),'defaultValue':_0x8688('0x4')}}; \ No newline at end of file +var _0x2080=['STRING','username','ENUM','integrationTab','newTab'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x2080,0x19f));var _0x0208=function(_0x3dd3bc,_0x32950b){_0x3dd3bc=_0x3dd3bc-0x0;var _0x172373=_0x2080[_0x3dd3bc];return _0x172373;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0208('0x0')]},'description':{'type':Sequelize[_0x0208('0x0')]},'username':{'type':Sequelize[_0x0208('0x0')],'unique':_0x0208('0x1')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0208('0x0')]},'clientId':{'type':Sequelize[_0x0208('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x0208('0x0')]},'serverUrl':{'type':Sequelize[_0x0208('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x0208('0x2')](_0x0208('0x3'),_0x0208('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c40e186..3da554c 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 _0x6277=['False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','find','create','body','catch','getConfigurations','SalesforceConfiguration','length','findOne','Subjects','getSubjects','Descriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','string','int','picklist','boolean','textarea','includes','label'];(function(_0x44921b,_0x32a201){var _0x4907f5=function(_0x209840){while(--_0x209840){_0x44921b['push'](_0x44921b['shift']());}};_0x4907f5(++_0x32a201);}(_0x6277,0x7d));var _0x7627=function(_0x4b13f6,_0x53acfc){_0x4b13f6=_0x4b13f6-0x0;var _0x427747=_0x6277[_0x4b13f6];return _0x427747;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7627('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7627('0x1'));var rp=require(_0x7627('0x2'));var moment=require(_0x7627('0x3'));var BPromise=require(_0x7627('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7627('0x5'));var sox=require(_0x7627('0x6'));var csv=require(_0x7627('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7627('0x8'));var _=require(_0x7627('0x9'));var squel=require(_0x7627('0xa'));var crypto=require(_0x7627('0xb'));var jsforce=require(_0x7627('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7627('0xd'));var Papa=require(_0x7627('0xe'));var Redis=require(_0x7627('0xf'));var authService=require(_0x7627('0x10'));var qs=require(_0x7627('0x11'));var as=require(_0x7627('0x12'));var hardwareService=require(_0x7627('0x13'));var logger=require(_0x7627('0x14'))(_0x7627('0x15'));var utils=require('../../config/utils');var config=require(_0x7627('0x16'));var licenseUtil=require(_0x7627('0x17'));var db=require(_0x7627('0x18'))['db'];var integrations=require(_0x7627('0x19'));function respondWithStatusCode(_0x3ab290,_0x2701b2){_0x2701b2=_0x2701b2||0xcc;return function(_0x5a32a2){if(_0x5a32a2){return _0x3ab290['sendStatus'](_0x2701b2);}return _0x3ab290[_0x7627('0x1a')](_0x2701b2)[_0x7627('0x1b')]();};}function respondWithResult(_0x4dd6d1,_0x4d9735){_0x4d9735=_0x4d9735||0xc8;return function(_0x3315fd){if(_0x3315fd){return _0x4dd6d1[_0x7627('0x1a')](_0x4d9735)[_0x7627('0x1c')](_0x3315fd);}};}function respondWithFilteredResult(_0x1a5209,_0x111fd6){return function(_0xe4ae5b){if(_0xe4ae5b){var _0x47bac3=typeof _0x111fd6['offset']==='undefined'&&typeof _0x111fd6['limit']==='undefined';var _0x266af0=_0xe4ae5b['count'];var _0x2d68ed=_0x47bac3?0x0:_0x111fd6[_0x7627('0x1d')];var _0x504611=_0x47bac3?_0xe4ae5b[_0x7627('0x1e')]:_0x111fd6['offset']+_0x111fd6[_0x7627('0x1f')];var _0x3732b0;if(_0x504611>=_0x266af0){_0x504611=_0x266af0;_0x3732b0=0xc8;}else{_0x3732b0=0xce;}_0x1a5209['status'](_0x3732b0);return _0x1a5209[_0x7627('0x20')](_0x7627('0x21'),_0x2d68ed+'-'+_0x504611+'/'+_0x266af0)['json'](_0xe4ae5b);}return null;};}function patchUpdates(_0x260979){return function(_0x1d1714){try{jsonpatch[_0x7627('0x22')](_0x1d1714,_0x260979,!![]);}catch(_0x497017){return BPromise[_0x7627('0x23')](_0x497017);}return _0x1d1714[_0x7627('0x24')]();};}function saveUpdates(_0x3a9904,_0x5dd0b4){return function(_0x1359c1){if(_0x1359c1){return _0x1359c1[_0x7627('0x25')](_0x3a9904)[_0x7627('0x26')](function(_0x924c0){return _0x924c0;});}return null;};}function removeEntity(_0x34b9fa,_0x485181){return function(_0x25bfaa){if(_0x25bfaa){return _0x25bfaa[_0x7627('0x27')]()[_0x7627('0x26')](function(){_0x34b9fa[_0x7627('0x1a')](0xcc)[_0x7627('0x1b')]();});}};}function handleEntityNotFound(_0x59f123,_0x4dea9b){return function(_0x2b0ed2){if(!_0x2b0ed2){_0x59f123['sendStatus'](0x194);}return _0x2b0ed2;};}function handleError(_0x5f40a9,_0x4c09a5){_0x4c09a5=_0x4c09a5||0x1f4;return function(_0x537271){logger[_0x7627('0x28')](_0x537271[_0x7627('0x29')]);if(_0x537271[_0x7627('0x2a')]){delete _0x537271[_0x7627('0x2a')];}_0x5f40a9[_0x7627('0x1a')](_0x4c09a5)[_0x7627('0x2b')](_0x537271);};}exports[_0x7627('0x2c')]=function(_0x26c647,_0x253075){var _0x428127={},_0x10b927={},_0x35b1df={'count':0x0,'rows':[]};var _0x3af845=_['map'](db[_0x7627('0x2d')][_0x7627('0x2e')],function(_0x29891f){return{'name':_0x29891f[_0x7627('0x2f')],'type':_0x29891f[_0x7627('0x30')][_0x7627('0x31')]};});_0x10b927[_0x7627('0x32')]=_[_0x7627('0x33')](_0x3af845,'name');_0x10b927[_0x7627('0x34')]=_['keys'](_0x26c647['query']);_0x10b927[_0x7627('0x35')]=_[_0x7627('0x36')](_0x10b927[_0x7627('0x32')],_0x10b927['query']);_0x428127[_0x7627('0x37')]=_[_0x7627('0x36')](_0x10b927[_0x7627('0x32')],qs[_0x7627('0x38')](_0x26c647[_0x7627('0x34')][_0x7627('0x38')]));_0x428127[_0x7627('0x37')]=_0x428127[_0x7627('0x37')]['length']?_0x428127['attributes']:_0x10b927[_0x7627('0x32')];if(!_0x26c647[_0x7627('0x34')][_0x7627('0x39')](_0x7627('0x3a'))){_0x428127[_0x7627('0x1f')]=qs[_0x7627('0x1f')](_0x26c647['query'][_0x7627('0x1f')]);_0x428127['offset']=qs['offset'](_0x26c647['query'][_0x7627('0x1d')]);}_0x428127[_0x7627('0x3b')]=qs['sort'](_0x26c647[_0x7627('0x34')][_0x7627('0x3c')]);_0x428127[_0x7627('0x3d')]=qs[_0x7627('0x35')](_[_0x7627('0x3e')](_0x26c647[_0x7627('0x34')],_0x10b927[_0x7627('0x35')]),_0x3af845);if(_0x26c647[_0x7627('0x34')][_0x7627('0x3f')]){_0x428127[_0x7627('0x3d')]=_[_0x7627('0x40')](_0x428127['where'],{'$or':_['map'](_0x3af845,function(_0x548e90){if(_0x548e90['type']!=='VIRTUAL'){var _0x3780d6={};_0x3780d6[_0x548e90[_0x7627('0x2a')]]={'$like':'%'+_0x26c647['query'][_0x7627('0x3f')]+'%'};return _0x3780d6;}})});}_0x428127=_[_0x7627('0x40')]({},_0x428127,_0x26c647[_0x7627('0x41')]);var _0x3760b6={'where':_0x428127[_0x7627('0x3d')]};return db['SalesforceAccount'][_0x7627('0x1e')](_0x3760b6)[_0x7627('0x26')](function(_0x4ec73e){_0x35b1df[_0x7627('0x1e')]=_0x4ec73e;if(_0x26c647['query'][_0x7627('0x42')]){_0x428127[_0x7627('0x43')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x428127);})[_0x7627('0x26')](function(_0x272689){_0x35b1df[_0x7627('0x44')]=_0x272689;return _0x35b1df;})[_0x7627('0x26')](respondWithFilteredResult(_0x253075,_0x428127))['catch'](handleError(_0x253075,null));};exports[_0x7627('0x45')]=function(_0xd2084d,_0x29af93){var _0x71b958={'raw':![],'where':{'id':_0xd2084d[_0x7627('0x46')]['id']}},_0x501ef3={};_0x501ef3[_0x7627('0x32')]=_[_0x7627('0x47')](db[_0x7627('0x2d')]['rawAttributes']);_0x501ef3[_0x7627('0x34')]=_[_0x7627('0x47')](_0xd2084d[_0x7627('0x34')]);_0x501ef3[_0x7627('0x35')]=_[_0x7627('0x36')](_0x501ef3[_0x7627('0x32')],_0x501ef3[_0x7627('0x34')]);_0x71b958['attributes']=_[_0x7627('0x36')](_0x501ef3[_0x7627('0x32')],qs[_0x7627('0x38')](_0xd2084d[_0x7627('0x34')]['fields']));_0x71b958['attributes']=_0x71b958[_0x7627('0x37')]['length']?_0x71b958[_0x7627('0x37')]:_0x501ef3[_0x7627('0x32')];if(_0xd2084d[_0x7627('0x34')][_0x7627('0x42')]){_0x71b958[_0x7627('0x43')]=[{'all':!![]}];}_0x71b958=_[_0x7627('0x40')]({},_0x71b958,_0xd2084d[_0x7627('0x41')]);return db[_0x7627('0x2d')][_0x7627('0x48')](_0x71b958)[_0x7627('0x26')](handleEntityNotFound(_0x29af93,null))[_0x7627('0x26')](respondWithResult(_0x29af93,null))['catch'](handleError(_0x29af93,null));};exports['create']=function(_0x3f5d0e,_0x4b94f9){return db[_0x7627('0x2d')][_0x7627('0x49')](_0x3f5d0e[_0x7627('0x4a')],{})[_0x7627('0x26')](respondWithResult(_0x4b94f9,0xc9))[_0x7627('0x4b')](handleError(_0x4b94f9,null));};exports[_0x7627('0x25')]=function(_0x2d9fe0,_0x3abd14){if(_0x2d9fe0['body']['id']){delete _0x2d9fe0[_0x7627('0x4a')]['id'];}return db[_0x7627('0x2d')][_0x7627('0x48')]({'where':{'id':_0x2d9fe0['params']['id']}})[_0x7627('0x26')](handleEntityNotFound(_0x3abd14,null))['then'](saveUpdates(_0x2d9fe0[_0x7627('0x4a')],null))[_0x7627('0x26')](respondWithResult(_0x3abd14,null))[_0x7627('0x4b')](handleError(_0x3abd14,null));};exports[_0x7627('0x27')]=function(_0x51e8fa,_0x3a910b){return db[_0x7627('0x2d')][_0x7627('0x48')]({'where':{'id':_0x51e8fa[_0x7627('0x46')]['id']}})[_0x7627('0x26')](handleEntityNotFound(_0x3a910b,null))[_0x7627('0x26')](removeEntity(_0x3a910b,null))[_0x7627('0x4b')](handleError(_0x3a910b,null));};exports[_0x7627('0x4c')]=function(_0x1db91e,_0x5b884c,_0x59ddb6){var _0x1cba4b={};var _0x3a53a7={};var _0x4562b3;var _0x4bddc2;return db['SalesforceAccount']['findOne']({'where':{'id':_0x1db91e['params']['id']}})[_0x7627('0x26')](handleEntityNotFound(_0x5b884c,null))['then'](function(_0x37c19a){if(_0x37c19a){_0x4562b3=_0x37c19a;_0x3a53a7[_0x7627('0x32')]=_[_0x7627('0x47')](db[_0x7627('0x4d')]['rawAttributes']);_0x3a53a7[_0x7627('0x34')]=_[_0x7627('0x47')](_0x1db91e[_0x7627('0x34')]);_0x3a53a7[_0x7627('0x35')]=_['intersection'](_0x3a53a7[_0x7627('0x32')],_0x3a53a7[_0x7627('0x34')]);_0x1cba4b[_0x7627('0x37')]=_['intersection'](_0x3a53a7['model'],qs[_0x7627('0x38')](_0x1db91e[_0x7627('0x34')][_0x7627('0x38')]));_0x1cba4b[_0x7627('0x37')]=_0x1cba4b['attributes'][_0x7627('0x4e')]?_0x1cba4b[_0x7627('0x37')]:_0x3a53a7[_0x7627('0x32')];_0x1cba4b[_0x7627('0x3b')]=qs[_0x7627('0x3c')](_0x1db91e[_0x7627('0x34')][_0x7627('0x3c')]);_0x1cba4b[_0x7627('0x3d')]=qs[_0x7627('0x35')](_[_0x7627('0x3e')](_0x1db91e[_0x7627('0x34')],_0x3a53a7[_0x7627('0x35')]));if(_0x1db91e[_0x7627('0x34')][_0x7627('0x3f')]){_0x1cba4b[_0x7627('0x3d')]=_[_0x7627('0x40')](_0x1cba4b[_0x7627('0x3d')],{'$or':_[_0x7627('0x33')](_0x1cba4b[_0x7627('0x37')],function(_0x4c15f0){var _0x75c98c={};_0x75c98c[_0x4c15f0]={'$like':'%'+_0x1db91e[_0x7627('0x34')][_0x7627('0x3f')]+'%'};return _0x75c98c;})});}_0x1cba4b=_['merge']({},_0x1cba4b,_0x1db91e[_0x7627('0x41')]);return _0x4562b3[_0x7627('0x4c')](_0x1cba4b);}})[_0x7627('0x26')](function(_0x53cc9e){if(_0x53cc9e){_0x4bddc2=_0x53cc9e[_0x7627('0x4e')];if(!_0x1db91e['query'][_0x7627('0x39')](_0x7627('0x3a'))){_0x1cba4b[_0x7627('0x1f')]=qs[_0x7627('0x1f')](_0x1db91e[_0x7627('0x34')]['limit']);_0x1cba4b[_0x7627('0x1d')]=qs['offset'](_0x1db91e[_0x7627('0x34')][_0x7627('0x1d')]);}return _0x4562b3[_0x7627('0x4c')](_0x1cba4b);}})[_0x7627('0x26')](function(_0x4cc4f6){if(_0x4cc4f6){return _0x4cc4f6?{'count':_0x4bddc2,'rows':_0x4cc4f6}:null;}})[_0x7627('0x26')](respondWithResult(_0x5b884c,null))['catch'](handleError(_0x5b884c,null));};exports['addConfiguration']=function(_0x53b604,_0x276389,_0x35aa7b){if(_0x53b604[_0x7627('0x4a')]['id']){delete _0x53b604[_0x7627('0x4a')]['id'];}return db[_0x7627('0x2d')][_0x7627('0x4f')]({'where':{'id':_0x53b604[_0x7627('0x46')]['id']}})['then'](handleEntityNotFound(_0x276389,null))[_0x7627('0x26')](function(_0x540018){if(_0x540018){_0x53b604[_0x7627('0x4a')]['AccountId']=_0x540018['id'];_0x53b604[_0x7627('0x4a')][_0x7627('0x50')]=integrations[_0x7627('0x51')](_0x53b604[_0x7627('0x4a')]['channel'],_0x53b604['body']['type']);_0x53b604[_0x7627('0x4a')][_0x7627('0x52')]=integrations['getDescriptions'](_0x53b604[_0x7627('0x4a')][_0x7627('0x53')],_0x53b604[_0x7627('0x4a')]['type']);return db[_0x7627('0x4d')][_0x7627('0x49')](_0x53b604[_0x7627('0x4a')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7627('0x54')],'as':_0x7627('0x52')}]});}return null;})['then'](respondWithResult(_0x276389,null))['catch'](handleError(_0x276389,null));};exports[_0x7627('0x55')]=function(_0x554f91,_0x28ba29,_0x24ccff){var _0xedb7a0;var _0x2d4426='';var _0x1f6363=_0x7627('0x56');return db[_0x7627('0x2d')][_0x7627('0x4f')]({'where':{'id':_0x554f91[_0x7627('0x46')]['id']},'attributes':['id',_0x7627('0x57'),_0x7627('0x58'),_0x7627('0x59'),_0x7627('0x5a'),_0x7627('0x5b'),_0x7627('0x5c')]})[_0x7627('0x26')](handleEntityNotFound(_0x28ba29,null))[_0x7627('0x26')](function(_0x419852){if(_0x419852){_0x2d4426=_0x419852['remoteUri'];var _0xe31613=_0x2d4426[_0x7627('0x5d')](-0x1);if(_0xe31613==='/'){_0x2d4426=_0x2d4426[_0x7627('0x5e')](0x0,_0x2d4426[_0x7627('0x5f')](_0xe31613));}_0xedb7a0=new jsforce[(_0x7627('0x60'))]({'oauth2':{'loginUrl':_0x2d4426,'clientId':_0x419852[_0x7627('0x58')],'clientSecret':_0x419852['clientSecret']}});return _0xedb7a0[_0x7627('0x61')](_0x419852['username'],_0x419852['password'][_0x7627('0x62')](_0x419852[_0x7627('0x5c')]));}})[_0x7627('0x26')](function(_0x1a663c){if(_0x1a663c){if(!_[_0x7627('0x63')](_0x554f91[_0x7627('0x34')][_0x7627('0x64')])){_0x1f6363=_0x554f91[_0x7627('0x34')]['ticketType'];}return _0xedb7a0[_0x7627('0x65')](_0x1f6363)[_0x7627('0x66')]();}})[_0x7627('0x26')](function(_0x2bdff4){var _0x3ec6a9=[_0x7627('0x67'),'ActivityDate',_0x7627('0x68'),_0x7627('0x69'),'Subject','Description'];var _0x132c4b=[_0x7627('0x6a'),_0x7627('0x6b'),_0x7627('0x6c'),_0x7627('0x6d'),'email',_0x7627('0x6e'),'phone'];if(_0x2bdff4){_['remove'](_0x2bdff4[_0x7627('0x38')],function(_0x51345a){return _0x3ec6a9[_0x7627('0x6f')](_0x51345a[_0x7627('0x2a')])||!_0x132c4b[_0x7627('0x6f')](_0x51345a['type']);});return{'count':_0x2bdff4[_0x7627('0x38')]['length'],'rows':_[_0x7627('0x33')](_0x2bdff4[_0x7627('0x38')],function(_0x14b7dd){return{'id':_0x14b7dd[_0x7627('0x2a')],'name':_0x14b7dd[_0x7627('0x70')],'custom':_0x14b7dd['custom'],'options':_0x14b7dd['picklistValues']['length']>0x0?_['map'](_0x14b7dd['picklistValues'],function(_0x5b3c61){return{'name':_0x5b3c61['label'],'value':_0x5b3c61['value']};}):_0x14b7dd[_0x7627('0x30')]==_0x7627('0x6d')?[{'name':'True','value':'true'},{'name':_0x7627('0x71'),'value':_0x7627('0x72')}]:[]};})};}})['then'](respondWithResult(_0x28ba29,null))[_0x7627('0x4b')](function(_0x45b8d3){var _0x3fc2c7=_0x554f91['query'][_0x7627('0x73')]?0x1f4:_0x45b8d3[_0x7627('0x74')]||0x1f4;logger[_0x7627('0x28')](_0x7627('0x75'),'getFields',_0x3fc2c7,JSON[_0x7627('0x76')](_0x45b8d3));delete _0x45b8d3['name'];if(_0x3fc2c7===0x191){_0x3fc2c7=0x190;}_0x28ba29['status'](_0x3fc2c7)[_0x7627('0x2b')](_0x554f91[_0x7627('0x34')][_0x7627('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x45b8d3[_0x7627('0x74')]}:_0x45b8d3);});}; \ No newline at end of file +var _0xabb6=['SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','email','textarea','phone','remove','includes','custom','picklistValues','label','boolean','true','False','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','end','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','sort','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x16806a,_0x1f94e7){var _0x26c482=function(_0x2502f1){while(--_0x2502f1){_0x16806a['push'](_0x16806a['shift']());}};_0x26c482(++_0x1f94e7);}(_0xabb6,0x11f));var _0x6abb=function(_0x44dc5f,_0x4fe455){_0x44dc5f=_0x44dc5f-0x0;var _0x3eaf77=_0xabb6[_0x44dc5f];return _0x3eaf77;};'use strict';var emlformat=require(_0x6abb('0x0'));var rimraf=require(_0x6abb('0x1'));var zipdir=require(_0x6abb('0x2'));var jsonpatch=require(_0x6abb('0x3'));var rp=require(_0x6abb('0x4'));var moment=require(_0x6abb('0x5'));var BPromise=require(_0x6abb('0x6'));var Mustache=require(_0x6abb('0x7'));var util=require('util');var path=require(_0x6abb('0x8'));var sox=require('sox');var csv=require(_0x6abb('0x9'));var ejs=require(_0x6abb('0xa'));var fs=require('fs');var fs_extra=require(_0x6abb('0xb'));var _=require('lodash');var squel=require(_0x6abb('0xc'));var crypto=require('crypto');var jsforce=require(_0x6abb('0xd'));var deskjs=require(_0x6abb('0xe'));var toCsv=require(_0x6abb('0x9'));var querystring=require('querystring');var Papa=require(_0x6abb('0xf'));var Redis=require(_0x6abb('0x10'));var authService=require(_0x6abb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6abb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6abb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6abb('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6abb('0x15'));function respondWithStatusCode(_0x5a56f9,_0x1dfa05){_0x1dfa05=_0x1dfa05||0xcc;return function(_0x446079){if(_0x446079){return _0x5a56f9[_0x6abb('0x16')](_0x1dfa05);}return _0x5a56f9[_0x6abb('0x17')](_0x1dfa05)['end']();};}function respondWithResult(_0x441f68,_0x14b306){_0x14b306=_0x14b306||0xc8;return function(_0x36a0f3){if(_0x36a0f3){return _0x441f68[_0x6abb('0x17')](_0x14b306)[_0x6abb('0x18')](_0x36a0f3);}};}function respondWithFilteredResult(_0x261e69,_0x58a294){return function(_0x555b9e){if(_0x555b9e){var _0x522909=typeof _0x58a294['offset']===_0x6abb('0x19')&&typeof _0x58a294[_0x6abb('0x1a')]===_0x6abb('0x19');var _0x31152c=_0x555b9e[_0x6abb('0x1b')];var _0x1c2b25=_0x522909?0x0:_0x58a294['offset'];var _0x4030f4=_0x522909?_0x555b9e[_0x6abb('0x1b')]:_0x58a294[_0x6abb('0x1c')]+_0x58a294[_0x6abb('0x1a')];var _0x54bbd4;if(_0x4030f4>=_0x31152c){_0x4030f4=_0x31152c;_0x54bbd4=0xc8;}else{_0x54bbd4=0xce;}_0x261e69[_0x6abb('0x17')](_0x54bbd4);return _0x261e69[_0x6abb('0x1d')]('Content-Range',_0x1c2b25+'-'+_0x4030f4+'/'+_0x31152c)['json'](_0x555b9e);}return null;};}function patchUpdates(_0x54d327){return function(_0x1519ca){try{jsonpatch['apply'](_0x1519ca,_0x54d327,!![]);}catch(_0x57eec6){return BPromise[_0x6abb('0x1e')](_0x57eec6);}return _0x1519ca[_0x6abb('0x1f')]();};}function saveUpdates(_0x14b99c,_0x440c9d){return function(_0x396abf){if(_0x396abf){return _0x396abf[_0x6abb('0x20')](_0x14b99c)[_0x6abb('0x21')](function(_0x4ac7ac){return _0x4ac7ac;});}return null;};}function removeEntity(_0x33049c,_0x710b51){return function(_0x398038){if(_0x398038){return _0x398038[_0x6abb('0x22')]()[_0x6abb('0x21')](function(){_0x33049c[_0x6abb('0x17')](0xcc)[_0x6abb('0x23')]();});}};}function handleEntityNotFound(_0x16eafd,_0x259f8a){return function(_0x4bc4e7){if(!_0x4bc4e7){_0x16eafd['sendStatus'](0x194);}return _0x4bc4e7;};}function handleError(_0xc3e269,_0x2c30cd){_0x2c30cd=_0x2c30cd||0x1f4;return function(_0x3c6041){logger[_0x6abb('0x24')](_0x3c6041['stack']);if(_0x3c6041[_0x6abb('0x25')]){delete _0x3c6041[_0x6abb('0x25')];}_0xc3e269[_0x6abb('0x17')](_0x2c30cd)[_0x6abb('0x26')](_0x3c6041);};}exports[_0x6abb('0x27')]=function(_0x9e41d1,_0x1284c3){var _0x2bb295={},_0x4c8957={},_0x9883a6={'count':0x0,'rows':[]};var _0x169ece=_[_0x6abb('0x28')](db[_0x6abb('0x29')][_0x6abb('0x2a')],function(_0x4b0a31){return{'name':_0x4b0a31[_0x6abb('0x2b')],'type':_0x4b0a31[_0x6abb('0x2c')][_0x6abb('0x2d')]};});_0x4c8957[_0x6abb('0x2e')]=_[_0x6abb('0x28')](_0x169ece,_0x6abb('0x25'));_0x4c8957[_0x6abb('0x2f')]=_[_0x6abb('0x30')](_0x9e41d1['query']);_0x4c8957[_0x6abb('0x31')]=_[_0x6abb('0x32')](_0x4c8957[_0x6abb('0x2e')],_0x4c8957['query']);_0x2bb295['attributes']=_[_0x6abb('0x32')](_0x4c8957[_0x6abb('0x2e')],qs[_0x6abb('0x33')](_0x9e41d1['query'][_0x6abb('0x33')]));_0x2bb295[_0x6abb('0x34')]=_0x2bb295[_0x6abb('0x34')][_0x6abb('0x35')]?_0x2bb295[_0x6abb('0x34')]:_0x4c8957[_0x6abb('0x2e')];if(!_0x9e41d1[_0x6abb('0x2f')][_0x6abb('0x36')](_0x6abb('0x37'))){_0x2bb295[_0x6abb('0x1a')]=qs[_0x6abb('0x1a')](_0x9e41d1[_0x6abb('0x2f')][_0x6abb('0x1a')]);_0x2bb295[_0x6abb('0x1c')]=qs[_0x6abb('0x1c')](_0x9e41d1['query']['offset']);}_0x2bb295[_0x6abb('0x38')]=qs['sort'](_0x9e41d1['query']['sort']);_0x2bb295[_0x6abb('0x39')]=qs['filters'](_[_0x6abb('0x3a')](_0x9e41d1[_0x6abb('0x2f')],_0x4c8957[_0x6abb('0x31')]),_0x169ece);if(_0x9e41d1[_0x6abb('0x2f')][_0x6abb('0x3b')]){_0x2bb295[_0x6abb('0x39')]=_['merge'](_0x2bb295['where'],{'$or':_[_0x6abb('0x28')](_0x169ece,function(_0x4c9143){if(_0x4c9143[_0x6abb('0x2c')]!==_0x6abb('0x3c')){var _0x144d74={};_0x144d74[_0x4c9143['name']]={'$like':'%'+_0x9e41d1[_0x6abb('0x2f')][_0x6abb('0x3b')]+'%'};return _0x144d74;}})});}_0x2bb295=_[_0x6abb('0x3d')]({},_0x2bb295,_0x9e41d1[_0x6abb('0x3e')]);var _0x1e2907={'where':_0x2bb295[_0x6abb('0x39')]};return db[_0x6abb('0x29')][_0x6abb('0x1b')](_0x1e2907)[_0x6abb('0x21')](function(_0x304540){_0x9883a6['count']=_0x304540;if(_0x9e41d1[_0x6abb('0x2f')][_0x6abb('0x3f')]){_0x2bb295[_0x6abb('0x40')]=[{'all':!![]}];}return db[_0x6abb('0x29')]['findAll'](_0x2bb295);})[_0x6abb('0x21')](function(_0x21b8f2){_0x9883a6[_0x6abb('0x41')]=_0x21b8f2;return _0x9883a6;})[_0x6abb('0x21')](respondWithFilteredResult(_0x1284c3,_0x2bb295))[_0x6abb('0x42')](handleError(_0x1284c3,null));};exports[_0x6abb('0x43')]=function(_0x8ec27c,_0x25d273){var _0x296a15={'raw':![],'where':{'id':_0x8ec27c[_0x6abb('0x44')]['id']}},_0x23b415={};_0x23b415[_0x6abb('0x2e')]=_['keys'](db['SalesforceAccount'][_0x6abb('0x2a')]);_0x23b415['query']=_[_0x6abb('0x30')](_0x8ec27c[_0x6abb('0x2f')]);_0x23b415[_0x6abb('0x31')]=_['intersection'](_0x23b415[_0x6abb('0x2e')],_0x23b415[_0x6abb('0x2f')]);_0x296a15[_0x6abb('0x34')]=_[_0x6abb('0x32')](_0x23b415['model'],qs[_0x6abb('0x33')](_0x8ec27c[_0x6abb('0x2f')][_0x6abb('0x33')]));_0x296a15[_0x6abb('0x34')]=_0x296a15['attributes']['length']?_0x296a15[_0x6abb('0x34')]:_0x23b415[_0x6abb('0x2e')];if(_0x8ec27c[_0x6abb('0x2f')][_0x6abb('0x3f')]){_0x296a15['include']=[{'all':!![]}];}_0x296a15=_['merge']({},_0x296a15,_0x8ec27c[_0x6abb('0x3e')]);return db[_0x6abb('0x29')][_0x6abb('0x45')](_0x296a15)[_0x6abb('0x21')](handleEntityNotFound(_0x25d273,null))[_0x6abb('0x21')](respondWithResult(_0x25d273,null))[_0x6abb('0x42')](handleError(_0x25d273,null));};exports['create']=function(_0x20098a,_0x485d75){return db[_0x6abb('0x29')][_0x6abb('0x46')](_0x20098a[_0x6abb('0x47')],{})[_0x6abb('0x21')](respondWithResult(_0x485d75,0xc9))[_0x6abb('0x42')](handleError(_0x485d75,null));};exports[_0x6abb('0x20')]=function(_0x5d04c9,_0x16c3c9){if(_0x5d04c9[_0x6abb('0x47')]['id']){delete _0x5d04c9[_0x6abb('0x47')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x5d04c9[_0x6abb('0x44')]['id']}})['then'](handleEntityNotFound(_0x16c3c9,null))['then'](saveUpdates(_0x5d04c9[_0x6abb('0x47')],null))[_0x6abb('0x21')](respondWithResult(_0x16c3c9,null))['catch'](handleError(_0x16c3c9,null));};exports[_0x6abb('0x22')]=function(_0x3bfb94,_0x13b041){return db[_0x6abb('0x29')][_0x6abb('0x45')]({'where':{'id':_0x3bfb94[_0x6abb('0x44')]['id']}})[_0x6abb('0x21')](handleEntityNotFound(_0x13b041,null))[_0x6abb('0x21')](removeEntity(_0x13b041,null))['catch'](handleError(_0x13b041,null));};exports[_0x6abb('0x48')]=function(_0x7a8c55,_0x58f476,_0xcc38ae){var _0x5364ad={};var _0x59bb44={};var _0x4ff6c4;var _0x37591d;return db['SalesforceAccount'][_0x6abb('0x49')]({'where':{'id':_0x7a8c55[_0x6abb('0x44')]['id']}})[_0x6abb('0x21')](handleEntityNotFound(_0x58f476,null))['then'](function(_0x53c20c){if(_0x53c20c){_0x4ff6c4=_0x53c20c;_0x59bb44[_0x6abb('0x2e')]=_[_0x6abb('0x30')](db[_0x6abb('0x4a')][_0x6abb('0x2a')]);_0x59bb44[_0x6abb('0x2f')]=_[_0x6abb('0x30')](_0x7a8c55['query']);_0x59bb44[_0x6abb('0x31')]=_[_0x6abb('0x32')](_0x59bb44['model'],_0x59bb44['query']);_0x5364ad[_0x6abb('0x34')]=_['intersection'](_0x59bb44[_0x6abb('0x2e')],qs['fields'](_0x7a8c55[_0x6abb('0x2f')]['fields']));_0x5364ad[_0x6abb('0x34')]=_0x5364ad[_0x6abb('0x34')][_0x6abb('0x35')]?_0x5364ad[_0x6abb('0x34')]:_0x59bb44[_0x6abb('0x2e')];_0x5364ad[_0x6abb('0x38')]=qs[_0x6abb('0x4b')](_0x7a8c55[_0x6abb('0x2f')][_0x6abb('0x4b')]);_0x5364ad[_0x6abb('0x39')]=qs[_0x6abb('0x31')](_[_0x6abb('0x3a')](_0x7a8c55[_0x6abb('0x2f')],_0x59bb44[_0x6abb('0x31')]));if(_0x7a8c55[_0x6abb('0x2f')][_0x6abb('0x3b')]){_0x5364ad[_0x6abb('0x39')]=_[_0x6abb('0x3d')](_0x5364ad[_0x6abb('0x39')],{'$or':_['map'](_0x5364ad[_0x6abb('0x34')],function(_0x152bfd){var _0x1c1554={};_0x1c1554[_0x152bfd]={'$like':'%'+_0x7a8c55[_0x6abb('0x2f')][_0x6abb('0x3b')]+'%'};return _0x1c1554;})});}_0x5364ad=_[_0x6abb('0x3d')]({},_0x5364ad,_0x7a8c55[_0x6abb('0x3e')]);return _0x4ff6c4[_0x6abb('0x48')](_0x5364ad);}})[_0x6abb('0x21')](function(_0xbee6c4){if(_0xbee6c4){_0x37591d=_0xbee6c4[_0x6abb('0x35')];if(!_0x7a8c55['query'][_0x6abb('0x36')]('nolimit')){_0x5364ad[_0x6abb('0x1a')]=qs[_0x6abb('0x1a')](_0x7a8c55[_0x6abb('0x2f')]['limit']);_0x5364ad['offset']=qs[_0x6abb('0x1c')](_0x7a8c55[_0x6abb('0x2f')][_0x6abb('0x1c')]);}return _0x4ff6c4[_0x6abb('0x48')](_0x5364ad);}})['then'](function(_0x2df345){if(_0x2df345){return _0x2df345?{'count':_0x37591d,'rows':_0x2df345}:null;}})[_0x6abb('0x21')](respondWithResult(_0x58f476,null))['catch'](handleError(_0x58f476,null));};exports[_0x6abb('0x4c')]=function(_0x21c43c,_0x1a122d,_0x40a619){if(_0x21c43c[_0x6abb('0x47')]['id']){delete _0x21c43c[_0x6abb('0x47')]['id'];}return db[_0x6abb('0x29')][_0x6abb('0x49')]({'where':{'id':_0x21c43c['params']['id']}})[_0x6abb('0x21')](handleEntityNotFound(_0x1a122d,null))[_0x6abb('0x21')](function(_0x389071){if(_0x389071){_0x21c43c['body'][_0x6abb('0x4d')]=_0x389071['id'];_0x21c43c['body']['Subjects']=integrations[_0x6abb('0x4e')](_0x21c43c[_0x6abb('0x47')][_0x6abb('0x4f')],_0x21c43c['body'][_0x6abb('0x2c')]);_0x21c43c[_0x6abb('0x47')][_0x6abb('0x50')]=integrations[_0x6abb('0x51')](_0x21c43c[_0x6abb('0x47')][_0x6abb('0x4f')],_0x21c43c[_0x6abb('0x47')][_0x6abb('0x2c')]);return db['SalesforceConfiguration'][_0x6abb('0x46')](_0x21c43c[_0x6abb('0x47')],{'include':[{'model':db[_0x6abb('0x52')],'as':_0x6abb('0x53')},{'model':db[_0x6abb('0x52')],'as':_0x6abb('0x50')}]});}return null;})[_0x6abb('0x21')](respondWithResult(_0x1a122d,null))['catch'](handleError(_0x1a122d,null));};exports[_0x6abb('0x54')]=function(_0x12ded7,_0x4373d6,_0x53cef2){var _0x5ef695;var _0x10672e='';var _0x49985a=_0x6abb('0x55');return db[_0x6abb('0x29')][_0x6abb('0x49')]({'where':{'id':_0x12ded7['params']['id']},'attributes':['id',_0x6abb('0x56'),_0x6abb('0x57'),_0x6abb('0x58'),_0x6abb('0x59'),_0x6abb('0x5a'),'securityToken']})[_0x6abb('0x21')](handleEntityNotFound(_0x4373d6,null))[_0x6abb('0x21')](function(_0x57ba6f){if(_0x57ba6f){_0x10672e=_0x57ba6f[_0x6abb('0x56')];var _0x324748=_0x10672e[_0x6abb('0x5b')](-0x1);if(_0x324748==='/'){_0x10672e=_0x10672e[_0x6abb('0x5c')](0x0,_0x10672e[_0x6abb('0x5d')](_0x324748));}_0x5ef695=new jsforce[(_0x6abb('0x5e'))]({'oauth2':{'loginUrl':_0x10672e,'clientId':_0x57ba6f['clientId'],'clientSecret':_0x57ba6f['clientSecret']}});return _0x5ef695[_0x6abb('0x5f')](_0x57ba6f['username'],_0x57ba6f[_0x6abb('0x5a')][_0x6abb('0x60')](_0x57ba6f[_0x6abb('0x61')]));}})[_0x6abb('0x21')](function(_0x1bb022){if(_0x1bb022){if(!_[_0x6abb('0x62')](_0x12ded7['query'][_0x6abb('0x63')])){_0x49985a=_0x12ded7['query'][_0x6abb('0x63')];}return _0x5ef695['sobject'](_0x49985a)[_0x6abb('0x64')]();}})[_0x6abb('0x21')](function(_0x30ac8b){var _0x119f85=[_0x6abb('0x65'),_0x6abb('0x66'),_0x6abb('0x67'),_0x6abb('0x68'),'Subject',_0x6abb('0x69')];var _0x51b01b=[_0x6abb('0x6a'),_0x6abb('0x6b'),'picklist','boolean',_0x6abb('0x6c'),_0x6abb('0x6d'),_0x6abb('0x6e')];if(_0x30ac8b){_[_0x6abb('0x6f')](_0x30ac8b['fields'],function(_0xda747a){return _0x119f85[_0x6abb('0x70')](_0xda747a[_0x6abb('0x25')])||!_0x51b01b[_0x6abb('0x70')](_0xda747a['type']);});return{'count':_0x30ac8b[_0x6abb('0x33')]['length'],'rows':_[_0x6abb('0x28')](_0x30ac8b[_0x6abb('0x33')],function(_0x5c3962){return{'id':_0x5c3962['name'],'name':_0x5c3962['label'],'custom':_0x5c3962[_0x6abb('0x71')],'options':_0x5c3962[_0x6abb('0x72')][_0x6abb('0x35')]>0x0?_['map'](_0x5c3962[_0x6abb('0x72')],function(_0x2d2ba0){return{'name':_0x2d2ba0[_0x6abb('0x73')],'value':_0x2d2ba0['value']};}):_0x5c3962[_0x6abb('0x2c')]==_0x6abb('0x74')?[{'name':'True','value':_0x6abb('0x75')},{'name':_0x6abb('0x76'),'value':'false'}]:[]};})};}})[_0x6abb('0x21')](respondWithResult(_0x4373d6,null))[_0x6abb('0x42')](function(_0x39559e){var _0x1b1f86=_0x12ded7[_0x6abb('0x2f')][_0x6abb('0x77')]?0x1f4:_0x39559e['statusCode']||0x1f4;logger['error'](_0x6abb('0x78'),_0x6abb('0x54'),_0x1b1f86,JSON[_0x6abb('0x79')](_0x39559e));delete _0x39559e[_0x6abb('0x25')];if(_0x1b1f86===0x191){_0x1b1f86=0x190;}_0x4373d6[_0x6abb('0x17')](_0x1b1f86)[_0x6abb('0x26')](_0x12ded7['query'][_0x6abb('0x77')]?{'message':_0x6abb('0x7a'),'statusCode':_0x39559e['statusCode']}:_0x39559e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ebed16b..0bb87f7 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 _0x6055=['../../config/logger','api','moment','bluebird','path','rimraf','../../components/integrations/configuration','define','SalesforceAccount','lodash','util'];(function(_0x1837d9,_0x5e0ec8){var _0x3e9233=function(_0x4d0d3d){while(--_0x4d0d3d){_0x1837d9['push'](_0x1837d9['shift']());}};_0x3e9233(++_0x5e0ec8);}(_0x6055,0x15e));var _0x5605=function(_0x4824ed,_0x2e4a1b){_0x4824ed=_0x4824ed-0x0;var _0x5114fe=_0x6055[_0x4824ed];return _0x5114fe;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var logger=require(_0x5605('0x2'))(_0x5605('0x3'));var moment=require(_0x5605('0x4'));var BPromise=require(_0x5605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x6'));var rimraf=require(_0x5605('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5605('0x8'));module['exports']=function(_0x5c64fe,_0x40a85e){return _0x5c64fe[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x684d=['api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger'];(function(_0x4dd838,_0x2209b0){var _0x446118=function(_0xa847eb){while(--_0xa847eb){_0x4dd838['push'](_0x4dd838['shift']());}};_0x446118(++_0x2209b0);}(_0x684d,0x174));var _0xd684=function(_0x1441ba,_0xf0df81){_0x1441ba=_0x1441ba-0x0;var _0x397320=_0x684d[_0x1441ba];return _0x397320;};'use strict';var _=require('lodash');var util=require(_0xd684('0x0'));var logger=require(_0xd684('0x1'))(_0xd684('0x2'));var moment=require('moment');var BPromise=require(_0xd684('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd684('0x4'));var rimraf=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xd684('0x7'));module['exports']=function(_0x3bf907,_0x51350a){return _0x3bf907[_0xd684('0x8')](_0xd684('0x9'),attributes,{'tableName':_0xd684('0xa'),'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 5159861..32774a8 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 _0xdeac=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','where','ShowSalesforceAccount','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdeac,0xfa));var _0xcdea=function(_0x217b49,_0x32a478){_0x217b49=_0x217b49-0x0;var _0x10f295=_0xdeac[_0x217b49];return _0x10f295;};'use strict';var _=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var moment=require(_0xcdea('0x2'));var BPromise=require(_0xcdea('0x3'));var rs=require(_0xcdea('0x4'));var fs=require('fs');var Redis=require(_0xcdea('0x5'));var db=require(_0xcdea('0x6'))['db'];var utils=require(_0xcdea('0x7'));var logger=require(_0xcdea('0x8'))(_0xcdea('0x9'));var config=require('../../config/environment');var jayson=require(_0xcdea('0xa'));var client=jayson[_0xcdea('0xb')][_0xcdea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50868e,_0x349b44,_0x4ab63e){return new BPromise(function(_0x2784a7,_0xcf86b9){return client['request'](_0x50868e,_0x4ab63e)[_0xcdea('0xd')](function(_0x2cfee7){logger[_0xcdea('0xe')](_0xcdea('0xf'),_0x349b44,'request\x20sent');logger[_0xcdea('0x10')](_0xcdea('0x11'),_0x349b44,'request\x20sent',JSON[_0xcdea('0x12')](_0x2cfee7));if(_0x2cfee7[_0xcdea('0x13')]){if(_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x14')]===0x1f4){logger[_0xcdea('0x13')](_0xcdea('0xf'),_0x349b44,_0x2cfee7[_0xcdea('0x13')]['message']);return _0xcf86b9(_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x15')]);}logger[_0xcdea('0x13')](_0xcdea('0xf'),_0x349b44,_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x15')]);return _0x2784a7(_0x2cfee7[_0xcdea('0x13')][_0xcdea('0x15')]);}else{logger['info'](_0xcdea('0xf'),_0x349b44,_0xcdea('0x16'));_0x2784a7(_0x2cfee7['result']['message']);}})[_0xcdea('0x17')](function(_0x4f43fe){logger[_0xcdea('0x13')](_0xcdea('0xf'),_0x349b44,_0x4f43fe);_0xcf86b9(_0x4f43fe);});});}exports[_0xcdea('0x18')]=function(_0x4f13f1){var _0x10e244=this;return new Promise(function(_0x4918eb,_0x16aa91){return db[_0xcdea('0x19')][_0xcdea('0x1a')]({'raw':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1[_0xcdea('0x1b')][_0xcdea('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1[_0xcdea('0x1b')]['where']||null:null,'attributes':_0x4f13f1['options']?_0x4f13f1[_0xcdea('0x1b')][_0xcdea('0x1d')]||null:null,'limit':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1[_0xcdea('0x1b')][_0xcdea('0x1e')]||null:null,'include':_0x4f13f1[_0xcdea('0x1b')]?_0x4f13f1['options'][_0xcdea('0x1f')]?_['map'](_0x4f13f1['options'][_0xcdea('0x1f')],function(_0x1c372c){return{'model':db[_0x1c372c[_0xcdea('0x20')]],'as':_0x1c372c['as'],'attributes':_0x1c372c['attributes'],'include':_0x1c372c['include']?_['map'](_0x1c372c[_0xcdea('0x1f')],function(_0x39aa01){return{'model':db[_0x39aa01['model']],'as':_0x39aa01['as'],'attributes':_0x39aa01[_0xcdea('0x1d')],'include':_0x39aa01[_0xcdea('0x1f')]?_[_0xcdea('0x21')](_0x39aa01['include'],function(_0x15737b){return{'model':db[_0x15737b[_0xcdea('0x20')]],'as':_0x15737b['as'],'attributes':_0x15737b[_0xcdea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdea('0xd')](function(_0x44491c){logger[_0xcdea('0xe')](_0xcdea('0x18'),_0x4f13f1);logger[_0xcdea('0x10')](_0xcdea('0x18'),_0x4f13f1,JSON[_0xcdea('0x12')](_0x44491c));_0x4918eb(_0x44491c);})[_0xcdea('0x17')](function(_0x1535f7){logger[_0xcdea('0x13')](_0xcdea('0x18'),_0x1535f7['message'],_0x4f13f1);_0x16aa91(_0x10e244[_0xcdea('0x13')](0x1f4,_0x1535f7[_0xcdea('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x1b036d){var _0x19dd16=this;return new Promise(function(_0x113c7c,_0x4b2538){return db[_0xcdea('0x19')]['find']({'raw':_0x1b036d[_0xcdea('0x1b')]?_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b036d['options']?_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x22')]||null:null,'attributes':_0x1b036d[_0xcdea('0x1b')]?_0x1b036d[_0xcdea('0x1b')]['attributes']||null:null,'include':_0x1b036d[_0xcdea('0x1b')]?_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x1f')]?_[_0xcdea('0x21')](_0x1b036d[_0xcdea('0x1b')][_0xcdea('0x1f')],function(_0x5dbe76){return{'model':db[_0x5dbe76[_0xcdea('0x20')]],'as':_0x5dbe76['as'],'attributes':_0x5dbe76[_0xcdea('0x1d')],'include':_0x5dbe76[_0xcdea('0x1f')]?_[_0xcdea('0x21')](_0x5dbe76['include'],function(_0x1ec84b){return{'model':db[_0x1ec84b[_0xcdea('0x20')]],'as':_0x1ec84b['as'],'attributes':_0x1ec84b[_0xcdea('0x1d')],'include':_0x1ec84b['include']?_[_0xcdea('0x21')](_0x1ec84b[_0xcdea('0x1f')],function(_0x45186f){return{'model':db[_0x45186f[_0xcdea('0x20')]],'as':_0x45186f['as'],'attributes':_0x45186f[_0xcdea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdea('0xd')](function(_0x4c90c9){logger[_0xcdea('0xe')]('ShowSalesforceAccount',_0x1b036d);logger[_0xcdea('0x10')](_0xcdea('0x23'),_0x1b036d,JSON[_0xcdea('0x12')](_0x4c90c9));_0x113c7c(_0x4c90c9);})['catch'](function(_0x38facd){logger['error'](_0xcdea('0x23'),_0x38facd[_0xcdea('0x15')],_0x1b036d);_0x4b2538(_0x19dd16[_0xcdea('0x13')](0x1f4,_0x38facd['message']));});});}; \ No newline at end of file +var _0x1107=['include','model','map','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit'];(function(_0x4dcc68,_0x5bcf40){var _0x36cf3f=function(_0x3a5f54){while(--_0x3a5f54){_0x4dcc68['push'](_0x4dcc68['shift']());}};_0x36cf3f(++_0x5bcf40);}(_0x1107,0xd8));var _0x7110=function(_0x3da647,_0xa1a501){_0x3da647=_0x3da647-0x0;var _0x2e91a2=_0x1107[_0x3da647];return _0x2e91a2;};'use strict';var _=require(_0x7110('0x0'));var util=require(_0x7110('0x1'));var moment=require(_0x7110('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7110('0x3'));var db=require(_0x7110('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7110('0x5'))(_0x7110('0x6'));var config=require(_0x7110('0x7'));var jayson=require(_0x7110('0x8'));var client=jayson[_0x7110('0x9')][_0x7110('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38b340,_0xe978a,_0x10df10){return new BPromise(function(_0x3925e6,_0x129706){return client[_0x7110('0xb')](_0x38b340,_0x10df10)[_0x7110('0xc')](function(_0x4960b1){logger[_0x7110('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0xe978a,_0x7110('0xe'));logger[_0x7110('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xe978a,_0x7110('0xe'),JSON[_0x7110('0x10')](_0x4960b1));if(_0x4960b1[_0x7110('0x11')]){if(_0x4960b1[_0x7110('0x11')][_0x7110('0x12')]===0x1f4){logger[_0x7110('0x11')](_0x7110('0x13'),_0xe978a,_0x4960b1[_0x7110('0x11')][_0x7110('0x14')]);return _0x129706(_0x4960b1['error'][_0x7110('0x14')]);}logger['error'](_0x7110('0x13'),_0xe978a,_0x4960b1['error'][_0x7110('0x14')]);return _0x3925e6(_0x4960b1[_0x7110('0x11')][_0x7110('0x14')]);}else{logger[_0x7110('0xd')](_0x7110('0x13'),_0xe978a,_0x7110('0xe'));_0x3925e6(_0x4960b1[_0x7110('0x15')]['message']);}})[_0x7110('0x16')](function(_0x5cb6f4){logger[_0x7110('0x11')](_0x7110('0x13'),_0xe978a,_0x5cb6f4);_0x129706(_0x5cb6f4);});});}exports['GetSalesforceAccount']=function(_0x9df9ca){var _0xd46bd3=this;return new Promise(function(_0x3b590f,_0x49f7d3){return db['SalesforceAccount'][_0x7110('0x17')]({'raw':_0x9df9ca[_0x7110('0x18')]?_0x9df9ca[_0x7110('0x18')][_0x7110('0x19')]===undefined?!![]:![]:!![],'where':_0x9df9ca[_0x7110('0x18')]?_0x9df9ca['options'][_0x7110('0x1a')]||null:null,'attributes':_0x9df9ca[_0x7110('0x18')]?_0x9df9ca[_0x7110('0x18')][_0x7110('0x1b')]||null:null,'limit':_0x9df9ca[_0x7110('0x18')]?_0x9df9ca[_0x7110('0x18')][_0x7110('0x1c')]||null:null,'include':_0x9df9ca[_0x7110('0x18')]?_0x9df9ca['options'][_0x7110('0x1d')]?_['map'](_0x9df9ca[_0x7110('0x18')][_0x7110('0x1d')],function(_0x2373b4){return{'model':db[_0x2373b4[_0x7110('0x1e')]],'as':_0x2373b4['as'],'attributes':_0x2373b4['attributes'],'include':_0x2373b4[_0x7110('0x1d')]?_[_0x7110('0x1f')](_0x2373b4[_0x7110('0x1d')],function(_0x54fc43){return{'model':db[_0x54fc43[_0x7110('0x1e')]],'as':_0x54fc43['as'],'attributes':_0x54fc43['attributes'],'include':_0x54fc43['include']?_[_0x7110('0x1f')](_0x54fc43[_0x7110('0x1d')],function(_0x16b03d){return{'model':db[_0x16b03d[_0x7110('0x1e')]],'as':_0x16b03d['as'],'attributes':_0x16b03d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7110('0xc')](function(_0x2f91c0){logger[_0x7110('0xd')](_0x7110('0x20'),_0x9df9ca);logger[_0x7110('0xf')](_0x7110('0x20'),_0x9df9ca,JSON[_0x7110('0x10')](_0x2f91c0));_0x3b590f(_0x2f91c0);})[_0x7110('0x16')](function(_0x1b163a){logger[_0x7110('0x11')](_0x7110('0x20'),_0x1b163a[_0x7110('0x14')],_0x9df9ca);_0x49f7d3(_0xd46bd3['error'](0x1f4,_0x1b163a['message']));});});};exports[_0x7110('0x21')]=function(_0x5758f6){var _0x4fed9b=this;return new Promise(function(_0x3425fc,_0x138585){return db['SalesforceAccount'][_0x7110('0x22')]({'raw':_0x5758f6['options']?_0x5758f6[_0x7110('0x18')][_0x7110('0x19')]===undefined?!![]:![]:!![],'where':_0x5758f6['options']?_0x5758f6[_0x7110('0x18')][_0x7110('0x1a')]||null:null,'attributes':_0x5758f6[_0x7110('0x18')]?_0x5758f6['options'][_0x7110('0x1b')]||null:null,'include':_0x5758f6[_0x7110('0x18')]?_0x5758f6[_0x7110('0x18')][_0x7110('0x1d')]?_[_0x7110('0x1f')](_0x5758f6[_0x7110('0x18')][_0x7110('0x1d')],function(_0x1bd465){return{'model':db[_0x1bd465[_0x7110('0x1e')]],'as':_0x1bd465['as'],'attributes':_0x1bd465['attributes'],'include':_0x1bd465['include']?_[_0x7110('0x1f')](_0x1bd465['include'],function(_0x44ec87){return{'model':db[_0x44ec87[_0x7110('0x1e')]],'as':_0x44ec87['as'],'attributes':_0x44ec87[_0x7110('0x1b')],'include':_0x44ec87[_0x7110('0x1d')]?_['map'](_0x44ec87['include'],function(_0x300b26){return{'model':db[_0x300b26['model']],'as':_0x300b26['as'],'attributes':_0x300b26[_0x7110('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7110('0xc')](function(_0x4a05c8){logger[_0x7110('0xd')]('ShowSalesforceAccount',_0x5758f6);logger[_0x7110('0xf')](_0x7110('0x21'),_0x5758f6,JSON[_0x7110('0x10')](_0x4a05c8));_0x3425fc(_0x4a05c8);})[_0x7110('0x16')](function(_0x28b04e){logger['error'](_0x7110('0x21'),_0x28b04e[_0x7110('0x14')],_0x5758f6);_0x138585(_0x4fed9b[_0x7110('0x11')](0x1f4,_0x28b04e[_0x7110('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 59898bc..bc03340 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(_0x763f6b,_0xfc6fc3){var _0x4dc52d=function(_0x1f59f5){while(--_0x1f59f5){_0x763f6b['push'](_0x763f6b['shift']());}};_0x4dc52d(++_0xfc6fc3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x166e10,_0x524f09){var _0x309be6=function(_0x3460ee){while(--_0x3460ee){_0x166e10['push'](_0x166e10['shift']());}};_0x309be6(++_0x524f09);}(_0x7a54,0x106));var _0x47a5=function(_0x2cedfa,_0x284f06){_0x2cedfa=_0x2cedfa-0x0;var _0x530339=_0x7a54[_0x2cedfa];return _0x530339;};'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('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 58fd201..5dc398c 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 _0x3cae=['lead','account','contact_lead','sequelize','exports','STRING','ENUM','Task','Case','contact'];(function(_0x3c1163,_0x2adee7){var _0x257b42=function(_0x237088){while(--_0x237088){_0x3c1163['push'](_0x3c1163['shift']());}};_0x257b42(++_0x2adee7);}(_0x3cae,0x19d));var _0xe3ca=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x3cae[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0xe3ca('0x0'));module[_0xe3ca('0x1')]={'name':{'type':Sequelize[_0xe3ca('0x2')]},'description':{'type':Sequelize[_0xe3ca('0x2')]},'ticketType':{'type':Sequelize[_0xe3ca('0x3')](_0xe3ca('0x4'),_0xe3ca('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xe3ca('0x3')]('contact_lead',_0xe3ca('0x6'),_0xe3ca('0x7'),'account_contact_lead',_0xe3ca('0x8')),'defaultValue':_0xe3ca('0x9')},'moduleCreate':{'type':Sequelize[_0xe3ca('0x3')]('nothing','contact',_0xe3ca('0x7'),_0xe3ca('0x8')),'defaultValue':_0xe3ca('0x7')},'leadId':{'type':Sequelize[_0xe3ca('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe3ca('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xe3ca('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5df3=['lead','account_contact_lead','contact_lead','STRING','ENUM','Task','contact'];(function(_0x15fff5,_0x3317b8){var _0x1624b9=function(_0x14697f){while(--_0x14697f){_0x15fff5['push'](_0x15fff5['shift']());}};_0x1624b9(++_0x3317b8);}(_0x5df3,0xb2));var _0x35df=function(_0x25e812,_0x1342a2){_0x25e812=_0x25e812-0x0;var _0x727c56=_0x5df3[_0x25e812];return _0x727c56;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x35df('0x0')]},'description':{'type':Sequelize[_0x35df('0x0')]},'ticketType':{'type':Sequelize[_0x35df('0x1')](_0x35df('0x2'),'Case'),'defaultValue':_0x35df('0x2')},'moduleSearch':{'type':Sequelize[_0x35df('0x1')]('contact_lead',_0x35df('0x3'),_0x35df('0x4'),_0x35df('0x5'),'account'),'defaultValue':_0x35df('0x6')},'moduleCreate':{'type':Sequelize[_0x35df('0x1')]('nothing','contact',_0x35df('0x4'),'account'),'defaultValue':_0x35df('0x4')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x35df('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x35df('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x35df('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b2edfcf..ae22874 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 _0xbac5=['merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4ad205,_0x5b636d){var _0x4db6c3=function(_0x4421a6){while(--_0x4421a6){_0x4ad205['push'](_0x4ad205['shift']());}};_0x4db6c3(++_0x5b636d);}(_0xbac5,0xa9));var _0x5bac=function(_0xe69bf1,_0x487cbc){_0xe69bf1=_0xe69bf1-0x0;var _0x1259d1=_0xbac5[_0xe69bf1];return _0x1259d1;};'use strict';var emlformat=require(_0x5bac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bac('0x1'));var moment=require(_0x5bac('0x2'));var BPromise=require(_0x5bac('0x3'));var Mustache=require(_0x5bac('0x4'));var util=require('util');var path=require(_0x5bac('0x5'));var sox=require('sox');var csv=require(_0x5bac('0x6'));var ejs=require(_0x5bac('0x7'));var fs=require('fs');var fs_extra=require(_0x5bac('0x8'));var _=require(_0x5bac('0x9'));var squel=require(_0x5bac('0xa'));var crypto=require(_0x5bac('0xb'));var jsforce=require(_0x5bac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5bac('0x6'));var querystring=require(_0x5bac('0xd'));var Papa=require('papaparse');var Redis=require(_0x5bac('0xe'));var authService=require(_0x5bac('0xf'));var qs=require(_0x5bac('0x10'));var as=require(_0x5bac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5bac('0x12'));var utils=require('../../config/utils');var config=require(_0x5bac('0x13'));var licenseUtil=require(_0x5bac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a3250,_0x296417){_0x296417=_0x296417||0xcc;return function(_0x14d911){if(_0x14d911){return _0x5a3250['sendStatus'](_0x296417);}return _0x5a3250[_0x5bac('0x15')](_0x296417)[_0x5bac('0x16')]();};}function respondWithResult(_0x404bb4,_0x4df684){_0x4df684=_0x4df684||0xc8;return function(_0x368aa3){if(_0x368aa3){return _0x404bb4[_0x5bac('0x15')](_0x4df684)[_0x5bac('0x17')](_0x368aa3);}};}function respondWithFilteredResult(_0xc86f96,_0xee253e){return function(_0x2ec91f){if(_0x2ec91f){var _0x225c8b=typeof _0xee253e[_0x5bac('0x18')]===_0x5bac('0x19')&&typeof _0xee253e['limit']===_0x5bac('0x19');var _0x133098=_0x2ec91f[_0x5bac('0x1a')];var _0x1b45a9=_0x225c8b?0x0:_0xee253e[_0x5bac('0x18')];var _0x544b6f=_0x225c8b?_0x2ec91f['count']:_0xee253e[_0x5bac('0x18')]+_0xee253e[_0x5bac('0x1b')];var _0x3e5a94;if(_0x544b6f>=_0x133098){_0x544b6f=_0x133098;_0x3e5a94=0xc8;}else{_0x3e5a94=0xce;}_0xc86f96[_0x5bac('0x15')](_0x3e5a94);return _0xc86f96[_0x5bac('0x1c')]('Content-Range',_0x1b45a9+'-'+_0x544b6f+'/'+_0x133098)[_0x5bac('0x17')](_0x2ec91f);}return null;};}function patchUpdates(_0x319f55){return function(_0x444975){try{jsonpatch[_0x5bac('0x1d')](_0x444975,_0x319f55,!![]);}catch(_0x27bb08){return BPromise[_0x5bac('0x1e')](_0x27bb08);}return _0x444975[_0x5bac('0x1f')]();};}function saveUpdates(_0x26f31c,_0x3f3e8d){return function(_0x24def9){if(_0x24def9){return _0x24def9[_0x5bac('0x20')](_0x26f31c)[_0x5bac('0x21')](function(_0x5242ce){return _0x5242ce;});}return null;};}function removeEntity(_0x340f1f,_0xfd1746){return function(_0x151938){if(_0x151938){return _0x151938[_0x5bac('0x22')]()[_0x5bac('0x21')](function(){_0x340f1f[_0x5bac('0x15')](0xcc)[_0x5bac('0x16')]();});}};}function handleEntityNotFound(_0x27c405,_0x19e5b2){return function(_0x2b7c3e){if(!_0x2b7c3e){_0x27c405[_0x5bac('0x23')](0x194);}return _0x2b7c3e;};}function handleError(_0x3f924e,_0x88e51c){_0x88e51c=_0x88e51c||0x1f4;return function(_0x1aad3a){logger['error'](_0x1aad3a[_0x5bac('0x24')]);if(_0x1aad3a[_0x5bac('0x25')]){delete _0x1aad3a['name'];}_0x3f924e['status'](_0x88e51c)['send'](_0x1aad3a);};}exports[_0x5bac('0x26')]=function(_0x12d611,_0x39b9e3){var _0x33abfa={},_0x45c7d4={},_0x4cdec0={'count':0x0,'rows':[]};var _0x15042b=_[_0x5bac('0x27')](db[_0x5bac('0x28')][_0x5bac('0x29')],function(_0x1ab295){return{'name':_0x1ab295[_0x5bac('0x2a')],'type':_0x1ab295[_0x5bac('0x2b')][_0x5bac('0x2c')]};});_0x45c7d4['model']=_[_0x5bac('0x27')](_0x15042b,_0x5bac('0x25'));_0x45c7d4[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x12d611[_0x5bac('0x2d')]);_0x45c7d4[_0x5bac('0x2f')]=_[_0x5bac('0x30')](_0x45c7d4[_0x5bac('0x31')],_0x45c7d4['query']);_0x33abfa['attributes']=_[_0x5bac('0x30')](_0x45c7d4[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x12d611[_0x5bac('0x2d')]['fields']));_0x33abfa[_0x5bac('0x33')]=_0x33abfa['attributes'][_0x5bac('0x34')]?_0x33abfa[_0x5bac('0x33')]:_0x45c7d4['model'];if(!_0x12d611[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0x33abfa[_0x5bac('0x1b')]=qs[_0x5bac('0x1b')](_0x12d611[_0x5bac('0x2d')]['limit']);_0x33abfa[_0x5bac('0x18')]=qs[_0x5bac('0x18')](_0x12d611['query']['offset']);}_0x33abfa[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x12d611['query'][_0x5bac('0x38')]);_0x33abfa[_0x5bac('0x39')]=qs[_0x5bac('0x2f')](_[_0x5bac('0x3a')](_0x12d611[_0x5bac('0x2d')],_0x45c7d4[_0x5bac('0x2f')]),_0x15042b);if(_0x12d611[_0x5bac('0x2d')]['filter']){_0x33abfa[_0x5bac('0x39')]=_[_0x5bac('0x3b')](_0x33abfa[_0x5bac('0x39')],{'$or':_[_0x5bac('0x27')](_0x15042b,function(_0x258b7b){if(_0x258b7b[_0x5bac('0x2b')]!=='VIRTUAL'){var _0x4965c8={};_0x4965c8[_0x258b7b[_0x5bac('0x25')]]={'$like':'%'+_0x12d611['query'][_0x5bac('0x3c')]+'%'};return _0x4965c8;}})});}_0x33abfa=_[_0x5bac('0x3b')]({},_0x33abfa,_0x12d611[_0x5bac('0x3d')]);var _0x44ff00={'where':_0x33abfa[_0x5bac('0x39')]};return db[_0x5bac('0x28')]['count'](_0x44ff00)[_0x5bac('0x21')](function(_0xa21928){_0x4cdec0['count']=_0xa21928;if(_0x12d611['query'][_0x5bac('0x3e')]){_0x33abfa[_0x5bac('0x3f')]=[{'all':!![]}];}return db[_0x5bac('0x28')][_0x5bac('0x40')](_0x33abfa);})['then'](function(_0x462e47){_0x4cdec0['rows']=_0x462e47;return _0x4cdec0;})[_0x5bac('0x21')](respondWithFilteredResult(_0x39b9e3,_0x33abfa))[_0x5bac('0x41')](handleError(_0x39b9e3,null));};exports[_0x5bac('0x42')]=function(_0x203ea3,_0x7fce50){var _0x133ee1={'raw':![],'where':{'id':_0x203ea3[_0x5bac('0x43')]['id']}},_0x56467e={};_0x56467e['model']=_[_0x5bac('0x2e')](db[_0x5bac('0x28')]['rawAttributes']);_0x56467e[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x203ea3[_0x5bac('0x2d')]);_0x56467e['filters']=_['intersection'](_0x56467e['model'],_0x56467e[_0x5bac('0x2d')]);_0x133ee1[_0x5bac('0x33')]=_['intersection'](_0x56467e[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x203ea3[_0x5bac('0x2d')][_0x5bac('0x32')]));_0x133ee1[_0x5bac('0x33')]=_0x133ee1['attributes'][_0x5bac('0x34')]?_0x133ee1[_0x5bac('0x33')]:_0x56467e['model'];if(_0x203ea3[_0x5bac('0x2d')][_0x5bac('0x3e')]){_0x133ee1['include']=[{'all':!![]}];}_0x133ee1=_[_0x5bac('0x3b')]({},_0x133ee1,_0x203ea3[_0x5bac('0x3d')]);return db[_0x5bac('0x28')][_0x5bac('0x44')](_0x133ee1)['then'](handleEntityNotFound(_0x7fce50,null))[_0x5bac('0x21')](respondWithResult(_0x7fce50,null))[_0x5bac('0x41')](handleError(_0x7fce50,null));};exports[_0x5bac('0x45')]=function(_0x1f9405,_0x2fdb3a){return db[_0x5bac('0x28')]['create'](_0x1f9405[_0x5bac('0x46')],{})[_0x5bac('0x21')](respondWithResult(_0x2fdb3a,0xc9))['catch'](handleError(_0x2fdb3a,null));};exports[_0x5bac('0x20')]=function(_0x110078,_0x368259){if(_0x110078[_0x5bac('0x46')]['id']){delete _0x110078[_0x5bac('0x46')]['id'];}return db[_0x5bac('0x28')][_0x5bac('0x44')]({'where':{'id':_0x110078[_0x5bac('0x43')]['id']}})['then'](handleEntityNotFound(_0x368259,null))[_0x5bac('0x21')](saveUpdates(_0x110078['body'],null))[_0x5bac('0x21')](respondWithResult(_0x368259,null))[_0x5bac('0x41')](handleError(_0x368259,null));};exports[_0x5bac('0x22')]=function(_0x2939dc,_0x3819e1){return db[_0x5bac('0x28')][_0x5bac('0x44')]({'where':{'id':_0x2939dc[_0x5bac('0x43')]['id']}})[_0x5bac('0x21')](handleEntityNotFound(_0x3819e1,null))[_0x5bac('0x21')](removeEntity(_0x3819e1,null))[_0x5bac('0x41')](handleError(_0x3819e1,null));};exports[_0x5bac('0x47')]=function(_0x2ccc39,_0xb9e60b,_0x3aad3c){var _0xc42d9c={};var _0x32b895={};var _0x5fb95e;var _0x2f5f6a;return db[_0x5bac('0x28')][_0x5bac('0x48')]({'where':{'id':_0x2ccc39[_0x5bac('0x43')]['id']}})[_0x5bac('0x21')](handleEntityNotFound(_0xb9e60b,null))[_0x5bac('0x21')](function(_0x2533da){if(_0x2533da){_0x5fb95e=_0x2533da;_0x32b895[_0x5bac('0x31')]=_['keys'](db[_0x5bac('0x49')]['rawAttributes']);_0x32b895[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x2ccc39[_0x5bac('0x2d')]);_0x32b895[_0x5bac('0x2f')]=_[_0x5bac('0x30')](_0x32b895[_0x5bac('0x31')],_0x32b895[_0x5bac('0x2d')]);_0xc42d9c[_0x5bac('0x33')]=_['intersection'](_0x32b895[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x2ccc39['query'][_0x5bac('0x32')]));_0xc42d9c[_0x5bac('0x33')]=_0xc42d9c[_0x5bac('0x33')][_0x5bac('0x34')]?_0xc42d9c[_0x5bac('0x33')]:_0x32b895[_0x5bac('0x31')];_0xc42d9c[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x38')]);_0xc42d9c['where']=qs[_0x5bac('0x2f')](_['pick'](_0x2ccc39[_0x5bac('0x2d')],_0x32b895[_0x5bac('0x2f')]));if(_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x3c')]){_0xc42d9c['where']=_[_0x5bac('0x3b')](_0xc42d9c['where'],{'$or':_[_0x5bac('0x27')](_0xc42d9c[_0x5bac('0x33')],function(_0x9f2f52){var _0x5080ed={};_0x5080ed[_0x9f2f52]={'$like':'%'+_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x3c')]+'%'};return _0x5080ed;})});}_0xc42d9c=_[_0x5bac('0x3b')]({},_0xc42d9c,_0x2ccc39[_0x5bac('0x3d')]);return _0x5fb95e['getFields'](_0xc42d9c);}})[_0x5bac('0x21')](function(_0x194957){if(_0x194957){_0x2f5f6a=_0x194957[_0x5bac('0x34')];if(!_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0xc42d9c['limit']=qs[_0x5bac('0x1b')](_0x2ccc39[_0x5bac('0x2d')][_0x5bac('0x1b')]);_0xc42d9c[_0x5bac('0x18')]=qs[_0x5bac('0x18')](_0x2ccc39[_0x5bac('0x2d')]['offset']);}return _0x5fb95e[_0x5bac('0x47')](_0xc42d9c);}})[_0x5bac('0x21')](function(_0x4c1bd0){if(_0x4c1bd0){return _0x4c1bd0?{'count':_0x2f5f6a,'rows':_0x4c1bd0}:null;}})[_0x5bac('0x21')](respondWithResult(_0xb9e60b,null))[_0x5bac('0x41')](handleError(_0xb9e60b,null));};exports[_0x5bac('0x4a')]=function(_0x2489d0,_0x2306f2,_0x2a94e4){var _0x3f3769={};var _0x28599c={};var _0x1c0cac;var _0x97112e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2489d0[_0x5bac('0x43')]['id']}})['then'](handleEntityNotFound(_0x2306f2,null))[_0x5bac('0x21')](function(_0xf09a73){if(_0xf09a73){_0x1c0cac=_0xf09a73;_0x28599c[_0x5bac('0x31')]=_[_0x5bac('0x2e')](db[_0x5bac('0x49')][_0x5bac('0x29')]);_0x28599c[_0x5bac('0x2d')]=_['keys'](_0x2489d0[_0x5bac('0x2d')]);_0x28599c[_0x5bac('0x2f')]=_[_0x5bac('0x30')](_0x28599c[_0x5bac('0x31')],_0x28599c[_0x5bac('0x2d')]);_0x3f3769[_0x5bac('0x33')]=_[_0x5bac('0x30')](_0x28599c[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x32')]));_0x3f3769[_0x5bac('0x33')]=_0x3f3769[_0x5bac('0x33')][_0x5bac('0x34')]?_0x3f3769['attributes']:_0x28599c['model'];_0x3f3769[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x38')]);_0x3f3769[_0x5bac('0x39')]=qs[_0x5bac('0x2f')](_[_0x5bac('0x3a')](_0x2489d0[_0x5bac('0x2d')],_0x28599c[_0x5bac('0x2f')]));if(_0x2489d0['query']['filter']){_0x3f3769[_0x5bac('0x39')]=_[_0x5bac('0x3b')](_0x3f3769[_0x5bac('0x39')],{'$or':_[_0x5bac('0x27')](_0x3f3769[_0x5bac('0x33')],function(_0x7658c1){var _0x41d2fe={};_0x41d2fe[_0x7658c1]={'$like':'%'+_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x3c')]+'%'};return _0x41d2fe;})});}_0x3f3769=_['merge']({},_0x3f3769,_0x2489d0[_0x5bac('0x3d')]);return _0x1c0cac['getSubjects'](_0x3f3769);}})[_0x5bac('0x21')](function(_0x4dadb9){if(_0x4dadb9){_0x97112e=_0x4dadb9[_0x5bac('0x34')];if(!_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0x3f3769['limit']=qs[_0x5bac('0x1b')](_0x2489d0[_0x5bac('0x2d')][_0x5bac('0x1b')]);_0x3f3769[_0x5bac('0x18')]=qs[_0x5bac('0x18')](_0x2489d0[_0x5bac('0x2d')]['offset']);}return _0x1c0cac[_0x5bac('0x4a')](_0x3f3769);}})[_0x5bac('0x21')](function(_0x69e87f){if(_0x69e87f){return _0x69e87f?{'count':_0x97112e,'rows':_0x69e87f}:null;}})['then'](respondWithResult(_0x2306f2,null))['catch'](handleError(_0x2306f2,null));};exports[_0x5bac('0x4b')]=function(_0x28ab88,_0x50cdd5,_0x5945df){var _0x2e2f3e={};var _0x289d69={};var _0x3c0277;var _0x4cf686;return db[_0x5bac('0x28')][_0x5bac('0x48')]({'where':{'id':_0x28ab88[_0x5bac('0x43')]['id']}})[_0x5bac('0x21')](handleEntityNotFound(_0x50cdd5,null))[_0x5bac('0x21')](function(_0x2ade54){if(_0x2ade54){_0x3c0277=_0x2ade54;_0x289d69[_0x5bac('0x31')]=_[_0x5bac('0x2e')](db[_0x5bac('0x49')][_0x5bac('0x29')]);_0x289d69['query']=_[_0x5bac('0x2e')](_0x28ab88[_0x5bac('0x2d')]);_0x289d69[_0x5bac('0x2f')]=_['intersection'](_0x289d69[_0x5bac('0x31')],_0x289d69['query']);_0x2e2f3e[_0x5bac('0x33')]=_[_0x5bac('0x30')](_0x289d69[_0x5bac('0x31')],qs[_0x5bac('0x32')](_0x28ab88[_0x5bac('0x2d')]['fields']));_0x2e2f3e[_0x5bac('0x33')]=_0x2e2f3e['attributes']['length']?_0x2e2f3e['attributes']:_0x289d69[_0x5bac('0x31')];_0x2e2f3e[_0x5bac('0x37')]=qs[_0x5bac('0x38')](_0x28ab88[_0x5bac('0x2d')]['sort']);_0x2e2f3e[_0x5bac('0x39')]=qs[_0x5bac('0x2f')](_['pick'](_0x28ab88[_0x5bac('0x2d')],_0x289d69[_0x5bac('0x2f')]));if(_0x28ab88[_0x5bac('0x2d')][_0x5bac('0x3c')]){_0x2e2f3e[_0x5bac('0x39')]=_[_0x5bac('0x3b')](_0x2e2f3e[_0x5bac('0x39')],{'$or':_[_0x5bac('0x27')](_0x2e2f3e[_0x5bac('0x33')],function(_0x7ccee2){var _0x51be41={};_0x51be41[_0x7ccee2]={'$like':'%'+_0x28ab88[_0x5bac('0x2d')]['filter']+'%'};return _0x51be41;})});}_0x2e2f3e=_[_0x5bac('0x3b')]({},_0x2e2f3e,_0x28ab88[_0x5bac('0x3d')]);return _0x3c0277['getDescriptions'](_0x2e2f3e);}})[_0x5bac('0x21')](function(_0x15f72a){if(_0x15f72a){_0x4cf686=_0x15f72a['length'];if(!_0x28ab88[_0x5bac('0x2d')][_0x5bac('0x35')](_0x5bac('0x36'))){_0x2e2f3e[_0x5bac('0x1b')]=qs[_0x5bac('0x1b')](_0x28ab88['query'][_0x5bac('0x1b')]);_0x2e2f3e['offset']=qs[_0x5bac('0x18')](_0x28ab88['query'][_0x5bac('0x18')]);}return _0x3c0277[_0x5bac('0x4b')](_0x2e2f3e);}})[_0x5bac('0x21')](function(_0x13c7ee){if(_0x13c7ee){return _0x13c7ee?{'count':_0x4cf686,'rows':_0x13c7ee}:null;}})['then'](respondWithResult(_0x50cdd5,null))[_0x5bac('0x41')](handleError(_0x50cdd5,null));}; \ No newline at end of file +var _0x0c10=['SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','SalesforceConfiguration','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','body','update','findOne','pick','filter','getFields','getSubjects'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0c10,0x13a));var _0x00c1=function(_0x219c82,_0xe6f67f){_0x219c82=_0x219c82-0x0;var _0x2195c9=_0x0c10[_0x219c82];return _0x2195c9;};'use strict';var emlformat=require(_0x00c1('0x0'));var rimraf=require(_0x00c1('0x1'));var zipdir=require(_0x00c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00c1('0x3'));var moment=require(_0x00c1('0x4'));var BPromise=require(_0x00c1('0x5'));var Mustache=require(_0x00c1('0x6'));var util=require('util');var path=require(_0x00c1('0x7'));var sox=require(_0x00c1('0x8'));var csv=require(_0x00c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00c1('0xa'));var _=require(_0x00c1('0xb'));var squel=require('squel');var crypto=require(_0x00c1('0xc'));var jsforce=require(_0x00c1('0xd'));var deskjs=require(_0x00c1('0xe'));var toCsv=require(_0x00c1('0x9'));var querystring=require(_0x00c1('0xf'));var Papa=require(_0x00c1('0x10'));var Redis=require(_0x00c1('0x11'));var authService=require(_0x00c1('0x12'));var qs=require(_0x00c1('0x13'));var as=require(_0x00c1('0x14'));var hardwareService=require(_0x00c1('0x15'));var logger=require(_0x00c1('0x16'))('api');var utils=require(_0x00c1('0x17'));var config=require(_0x00c1('0x18'));var licenseUtil=require(_0x00c1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfd1564,_0x5c0d99){_0x5c0d99=_0x5c0d99||0xcc;return function(_0x2439aa){if(_0x2439aa){return _0xfd1564['sendStatus'](_0x5c0d99);}return _0xfd1564[_0x00c1('0x1a')](_0x5c0d99)[_0x00c1('0x1b')]();};}function respondWithResult(_0x5de26f,_0x1a1700){_0x1a1700=_0x1a1700||0xc8;return function(_0x2b4024){if(_0x2b4024){return _0x5de26f[_0x00c1('0x1a')](_0x1a1700)[_0x00c1('0x1c')](_0x2b4024);}};}function respondWithFilteredResult(_0x19a70a,_0x5eaf2c){return function(_0x17ca67){if(_0x17ca67){var _0x485110=typeof _0x5eaf2c['offset']==='undefined'&&typeof _0x5eaf2c[_0x00c1('0x1d')]===_0x00c1('0x1e');var _0x404436=_0x17ca67['count'];var _0x317c5a=_0x485110?0x0:_0x5eaf2c[_0x00c1('0x1f')];var _0x4f1951=_0x485110?_0x17ca67[_0x00c1('0x20')]:_0x5eaf2c['offset']+_0x5eaf2c[_0x00c1('0x1d')];var _0x53881c;if(_0x4f1951>=_0x404436){_0x4f1951=_0x404436;_0x53881c=0xc8;}else{_0x53881c=0xce;}_0x19a70a[_0x00c1('0x1a')](_0x53881c);return _0x19a70a[_0x00c1('0x21')](_0x00c1('0x22'),_0x317c5a+'-'+_0x4f1951+'/'+_0x404436)[_0x00c1('0x1c')](_0x17ca67);}return null;};}function patchUpdates(_0x191af3){return function(_0x43a37a){try{jsonpatch[_0x00c1('0x23')](_0x43a37a,_0x191af3,!![]);}catch(_0x37ce5c){return BPromise[_0x00c1('0x24')](_0x37ce5c);}return _0x43a37a[_0x00c1('0x25')]();};}function saveUpdates(_0x57b16a,_0x2bf64f){return function(_0x9d7cee){if(_0x9d7cee){return _0x9d7cee['update'](_0x57b16a)[_0x00c1('0x26')](function(_0x3e07cc){return _0x3e07cc;});}return null;};}function removeEntity(_0x2d18a7,_0x1e315f){return function(_0x1f95a8){if(_0x1f95a8){return _0x1f95a8[_0x00c1('0x27')]()[_0x00c1('0x26')](function(){_0x2d18a7[_0x00c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dabc4,_0x4c3bde){return function(_0x259a3e){if(!_0x259a3e){_0x5dabc4[_0x00c1('0x28')](0x194);}return _0x259a3e;};}function handleError(_0x1209dc,_0x5557a3){_0x5557a3=_0x5557a3||0x1f4;return function(_0x1bd99f){logger[_0x00c1('0x29')](_0x1bd99f['stack']);if(_0x1bd99f[_0x00c1('0x2a')]){delete _0x1bd99f[_0x00c1('0x2a')];}_0x1209dc['status'](_0x5557a3)['send'](_0x1bd99f);};}exports[_0x00c1('0x2b')]=function(_0x4e48d6,_0x3cb972){var _0x58ecdc={},_0x501680={},_0x21aba6={'count':0x0,'rows':[]};var _0xd03c0a=_[_0x00c1('0x2c')](db[_0x00c1('0x2d')]['rawAttributes'],function(_0x43783c){return{'name':_0x43783c['fieldName'],'type':_0x43783c[_0x00c1('0x2e')]['key']};});_0x501680['model']=_[_0x00c1('0x2c')](_0xd03c0a,'name');_0x501680['query']=_[_0x00c1('0x2f')](_0x4e48d6[_0x00c1('0x30')]);_0x501680[_0x00c1('0x31')]=_[_0x00c1('0x32')](_0x501680[_0x00c1('0x33')],_0x501680[_0x00c1('0x30')]);_0x58ecdc[_0x00c1('0x34')]=_[_0x00c1('0x32')](_0x501680['model'],qs[_0x00c1('0x35')](_0x4e48d6[_0x00c1('0x30')][_0x00c1('0x35')]));_0x58ecdc[_0x00c1('0x34')]=_0x58ecdc[_0x00c1('0x34')][_0x00c1('0x36')]?_0x58ecdc[_0x00c1('0x34')]:_0x501680['model'];if(!_0x4e48d6[_0x00c1('0x30')][_0x00c1('0x37')](_0x00c1('0x38'))){_0x58ecdc['limit']=qs['limit'](_0x4e48d6[_0x00c1('0x30')][_0x00c1('0x1d')]);_0x58ecdc[_0x00c1('0x1f')]=qs[_0x00c1('0x1f')](_0x4e48d6[_0x00c1('0x30')][_0x00c1('0x1f')]);}_0x58ecdc[_0x00c1('0x39')]=qs[_0x00c1('0x3a')](_0x4e48d6[_0x00c1('0x30')][_0x00c1('0x3a')]);_0x58ecdc[_0x00c1('0x3b')]=qs[_0x00c1('0x31')](_['pick'](_0x4e48d6[_0x00c1('0x30')],_0x501680[_0x00c1('0x31')]),_0xd03c0a);if(_0x4e48d6['query']['filter']){_0x58ecdc['where']=_[_0x00c1('0x3c')](_0x58ecdc[_0x00c1('0x3b')],{'$or':_['map'](_0xd03c0a,function(_0x1fc282){if(_0x1fc282[_0x00c1('0x2e')]!=='VIRTUAL'){var _0x1d3aae={};_0x1d3aae[_0x1fc282[_0x00c1('0x2a')]]={'$like':'%'+_0x4e48d6['query']['filter']+'%'};return _0x1d3aae;}})});}_0x58ecdc=_[_0x00c1('0x3c')]({},_0x58ecdc,_0x4e48d6[_0x00c1('0x3d')]);var _0x472742={'where':_0x58ecdc[_0x00c1('0x3b')]};return db[_0x00c1('0x2d')][_0x00c1('0x20')](_0x472742)[_0x00c1('0x26')](function(_0x11bee1){_0x21aba6[_0x00c1('0x20')]=_0x11bee1;if(_0x4e48d6[_0x00c1('0x30')][_0x00c1('0x3e')]){_0x58ecdc[_0x00c1('0x3f')]=[{'all':!![]}];}return db[_0x00c1('0x2d')]['findAll'](_0x58ecdc);})['then'](function(_0x3e719c){_0x21aba6[_0x00c1('0x40')]=_0x3e719c;return _0x21aba6;})[_0x00c1('0x26')](respondWithFilteredResult(_0x3cb972,_0x58ecdc))[_0x00c1('0x41')](handleError(_0x3cb972,null));};exports['show']=function(_0x2391e5,_0x3f3391){var _0x34f9ed={'raw':![],'where':{'id':_0x2391e5[_0x00c1('0x42')]['id']}},_0xad31f3={};_0xad31f3[_0x00c1('0x33')]=_[_0x00c1('0x2f')](db['SalesforceConfiguration'][_0x00c1('0x43')]);_0xad31f3[_0x00c1('0x30')]=_['keys'](_0x2391e5[_0x00c1('0x30')]);_0xad31f3[_0x00c1('0x31')]=_[_0x00c1('0x32')](_0xad31f3['model'],_0xad31f3[_0x00c1('0x30')]);_0x34f9ed[_0x00c1('0x34')]=_['intersection'](_0xad31f3[_0x00c1('0x33')],qs[_0x00c1('0x35')](_0x2391e5[_0x00c1('0x30')][_0x00c1('0x35')]));_0x34f9ed['attributes']=_0x34f9ed['attributes']['length']?_0x34f9ed[_0x00c1('0x34')]:_0xad31f3['model'];if(_0x2391e5[_0x00c1('0x30')]['includeAll']){_0x34f9ed['include']=[{'all':!![]}];}_0x34f9ed=_[_0x00c1('0x3c')]({},_0x34f9ed,_0x2391e5[_0x00c1('0x3d')]);return db[_0x00c1('0x2d')][_0x00c1('0x44')](_0x34f9ed)['then'](handleEntityNotFound(_0x3f3391,null))['then'](respondWithResult(_0x3f3391,null))[_0x00c1('0x41')](handleError(_0x3f3391,null));};exports['create']=function(_0x55a9cf,_0x8938c1){return db[_0x00c1('0x2d')]['create'](_0x55a9cf[_0x00c1('0x45')],{})[_0x00c1('0x26')](respondWithResult(_0x8938c1,0xc9))[_0x00c1('0x41')](handleError(_0x8938c1,null));};exports[_0x00c1('0x46')]=function(_0x422f6b,_0x1fcb30){if(_0x422f6b[_0x00c1('0x45')]['id']){delete _0x422f6b[_0x00c1('0x45')]['id'];}return db[_0x00c1('0x2d')]['find']({'where':{'id':_0x422f6b[_0x00c1('0x42')]['id']}})[_0x00c1('0x26')](handleEntityNotFound(_0x1fcb30,null))[_0x00c1('0x26')](saveUpdates(_0x422f6b['body'],null))[_0x00c1('0x26')](respondWithResult(_0x1fcb30,null))[_0x00c1('0x41')](handleError(_0x1fcb30,null));};exports[_0x00c1('0x27')]=function(_0x2d10f7,_0x280f55){return db[_0x00c1('0x2d')]['find']({'where':{'id':_0x2d10f7[_0x00c1('0x42')]['id']}})[_0x00c1('0x26')](handleEntityNotFound(_0x280f55,null))[_0x00c1('0x26')](removeEntity(_0x280f55,null))[_0x00c1('0x41')](handleError(_0x280f55,null));};exports['getFields']=function(_0x4a0bff,_0x32fbeb,_0x1bf624){var _0x339e2f={};var _0x325678={};var _0x335d6f;var _0x17edac;return db[_0x00c1('0x2d')][_0x00c1('0x47')]({'where':{'id':_0x4a0bff['params']['id']}})[_0x00c1('0x26')](handleEntityNotFound(_0x32fbeb,null))['then'](function(_0x1b7a23){if(_0x1b7a23){_0x335d6f=_0x1b7a23;_0x325678[_0x00c1('0x33')]=_[_0x00c1('0x2f')](db['SalesforceField'][_0x00c1('0x43')]);_0x325678[_0x00c1('0x30')]=_[_0x00c1('0x2f')](_0x4a0bff['query']);_0x325678['filters']=_[_0x00c1('0x32')](_0x325678['model'],_0x325678['query']);_0x339e2f[_0x00c1('0x34')]=_[_0x00c1('0x32')](_0x325678[_0x00c1('0x33')],qs['fields'](_0x4a0bff['query'][_0x00c1('0x35')]));_0x339e2f[_0x00c1('0x34')]=_0x339e2f[_0x00c1('0x34')]['length']?_0x339e2f['attributes']:_0x325678[_0x00c1('0x33')];_0x339e2f[_0x00c1('0x39')]=qs['sort'](_0x4a0bff['query'][_0x00c1('0x3a')]);_0x339e2f['where']=qs[_0x00c1('0x31')](_[_0x00c1('0x48')](_0x4a0bff[_0x00c1('0x30')],_0x325678['filters']));if(_0x4a0bff[_0x00c1('0x30')]['filter']){_0x339e2f[_0x00c1('0x3b')]=_[_0x00c1('0x3c')](_0x339e2f['where'],{'$or':_[_0x00c1('0x2c')](_0x339e2f[_0x00c1('0x34')],function(_0x37df44){var _0x19eccd={};_0x19eccd[_0x37df44]={'$like':'%'+_0x4a0bff['query'][_0x00c1('0x49')]+'%'};return _0x19eccd;})});}_0x339e2f=_[_0x00c1('0x3c')]({},_0x339e2f,_0x4a0bff[_0x00c1('0x3d')]);return _0x335d6f[_0x00c1('0x4a')](_0x339e2f);}})['then'](function(_0x6fb4a9){if(_0x6fb4a9){_0x17edac=_0x6fb4a9[_0x00c1('0x36')];if(!_0x4a0bff['query'][_0x00c1('0x37')](_0x00c1('0x38'))){_0x339e2f[_0x00c1('0x1d')]=qs[_0x00c1('0x1d')](_0x4a0bff['query'][_0x00c1('0x1d')]);_0x339e2f[_0x00c1('0x1f')]=qs[_0x00c1('0x1f')](_0x4a0bff['query'][_0x00c1('0x1f')]);}return _0x335d6f[_0x00c1('0x4a')](_0x339e2f);}})[_0x00c1('0x26')](function(_0x3b642f){if(_0x3b642f){return _0x3b642f?{'count':_0x17edac,'rows':_0x3b642f}:null;}})[_0x00c1('0x26')](respondWithResult(_0x32fbeb,null))['catch'](handleError(_0x32fbeb,null));};exports[_0x00c1('0x4b')]=function(_0x3c1b4a,_0x97eb43,_0x2ee1c5){var _0x51e41f={};var _0x31e2d4={};var _0x7f8413;var _0x5b1f1e;return db['SalesforceConfiguration'][_0x00c1('0x47')]({'where':{'id':_0x3c1b4a[_0x00c1('0x42')]['id']}})[_0x00c1('0x26')](handleEntityNotFound(_0x97eb43,null))[_0x00c1('0x26')](function(_0x3ec48e){if(_0x3ec48e){_0x7f8413=_0x3ec48e;_0x31e2d4[_0x00c1('0x33')]=_[_0x00c1('0x2f')](db[_0x00c1('0x4c')][_0x00c1('0x43')]);_0x31e2d4[_0x00c1('0x30')]=_['keys'](_0x3c1b4a[_0x00c1('0x30')]);_0x31e2d4[_0x00c1('0x31')]=_[_0x00c1('0x32')](_0x31e2d4[_0x00c1('0x33')],_0x31e2d4[_0x00c1('0x30')]);_0x51e41f[_0x00c1('0x34')]=_[_0x00c1('0x32')](_0x31e2d4[_0x00c1('0x33')],qs['fields'](_0x3c1b4a[_0x00c1('0x30')][_0x00c1('0x35')]));_0x51e41f[_0x00c1('0x34')]=_0x51e41f[_0x00c1('0x34')][_0x00c1('0x36')]?_0x51e41f[_0x00c1('0x34')]:_0x31e2d4[_0x00c1('0x33')];_0x51e41f[_0x00c1('0x39')]=qs[_0x00c1('0x3a')](_0x3c1b4a[_0x00c1('0x30')][_0x00c1('0x3a')]);_0x51e41f[_0x00c1('0x3b')]=qs[_0x00c1('0x31')](_[_0x00c1('0x48')](_0x3c1b4a[_0x00c1('0x30')],_0x31e2d4[_0x00c1('0x31')]));if(_0x3c1b4a['query'][_0x00c1('0x49')]){_0x51e41f[_0x00c1('0x3b')]=_[_0x00c1('0x3c')](_0x51e41f[_0x00c1('0x3b')],{'$or':_['map'](_0x51e41f[_0x00c1('0x34')],function(_0x140444){var _0x244d32={};_0x244d32[_0x140444]={'$like':'%'+_0x3c1b4a[_0x00c1('0x30')]['filter']+'%'};return _0x244d32;})});}_0x51e41f=_[_0x00c1('0x3c')]({},_0x51e41f,_0x3c1b4a[_0x00c1('0x3d')]);return _0x7f8413['getSubjects'](_0x51e41f);}})[_0x00c1('0x26')](function(_0x5638c2){if(_0x5638c2){_0x5b1f1e=_0x5638c2[_0x00c1('0x36')];if(!_0x3c1b4a['query']['hasOwnProperty']('nolimit')){_0x51e41f[_0x00c1('0x1d')]=qs[_0x00c1('0x1d')](_0x3c1b4a[_0x00c1('0x30')][_0x00c1('0x1d')]);_0x51e41f[_0x00c1('0x1f')]=qs['offset'](_0x3c1b4a[_0x00c1('0x30')][_0x00c1('0x1f')]);}return _0x7f8413[_0x00c1('0x4b')](_0x51e41f);}})[_0x00c1('0x26')](function(_0x1b0dbb){if(_0x1b0dbb){return _0x1b0dbb?{'count':_0x5b1f1e,'rows':_0x1b0dbb}:null;}})[_0x00c1('0x26')](respondWithResult(_0x97eb43,null))[_0x00c1('0x41')](handleError(_0x97eb43,null));};exports[_0x00c1('0x4d')]=function(_0x198b85,_0x42feda,_0x3c1243){var _0xcaf94a={};var _0x15932b={};var _0x47ad8c;var _0x18d1c5;return db[_0x00c1('0x2d')][_0x00c1('0x47')]({'where':{'id':_0x198b85[_0x00c1('0x42')]['id']}})['then'](handleEntityNotFound(_0x42feda,null))['then'](function(_0x444627){if(_0x444627){_0x47ad8c=_0x444627;_0x15932b[_0x00c1('0x33')]=_[_0x00c1('0x2f')](db['SalesforceField'][_0x00c1('0x43')]);_0x15932b[_0x00c1('0x30')]=_[_0x00c1('0x2f')](_0x198b85[_0x00c1('0x30')]);_0x15932b[_0x00c1('0x31')]=_[_0x00c1('0x32')](_0x15932b[_0x00c1('0x33')],_0x15932b['query']);_0xcaf94a[_0x00c1('0x34')]=_['intersection'](_0x15932b[_0x00c1('0x33')],qs['fields'](_0x198b85[_0x00c1('0x30')]['fields']));_0xcaf94a[_0x00c1('0x34')]=_0xcaf94a[_0x00c1('0x34')]['length']?_0xcaf94a[_0x00c1('0x34')]:_0x15932b[_0x00c1('0x33')];_0xcaf94a[_0x00c1('0x39')]=qs[_0x00c1('0x3a')](_0x198b85[_0x00c1('0x30')][_0x00c1('0x3a')]);_0xcaf94a[_0x00c1('0x3b')]=qs[_0x00c1('0x31')](_[_0x00c1('0x48')](_0x198b85[_0x00c1('0x30')],_0x15932b[_0x00c1('0x31')]));if(_0x198b85['query'][_0x00c1('0x49')]){_0xcaf94a[_0x00c1('0x3b')]=_[_0x00c1('0x3c')](_0xcaf94a[_0x00c1('0x3b')],{'$or':_[_0x00c1('0x2c')](_0xcaf94a['attributes'],function(_0x4d34ac){var _0x531b11={};_0x531b11[_0x4d34ac]={'$like':'%'+_0x198b85[_0x00c1('0x30')][_0x00c1('0x49')]+'%'};return _0x531b11;})});}_0xcaf94a=_[_0x00c1('0x3c')]({},_0xcaf94a,_0x198b85[_0x00c1('0x3d')]);return _0x47ad8c[_0x00c1('0x4d')](_0xcaf94a);}})[_0x00c1('0x26')](function(_0x5481d3){if(_0x5481d3){_0x18d1c5=_0x5481d3[_0x00c1('0x36')];if(!_0x198b85[_0x00c1('0x30')][_0x00c1('0x37')]('nolimit')){_0xcaf94a[_0x00c1('0x1d')]=qs[_0x00c1('0x1d')](_0x198b85[_0x00c1('0x30')]['limit']);_0xcaf94a[_0x00c1('0x1f')]=qs[_0x00c1('0x1f')](_0x198b85[_0x00c1('0x30')]['offset']);}return _0x47ad8c[_0x00c1('0x4d')](_0xcaf94a);}})['then'](function(_0x35226f){if(_0x35226f){return _0x35226f?{'count':_0x18d1c5,'rows':_0x35226f}:null;}})[_0x00c1('0x26')](respondWithResult(_0x42feda,null))[_0x00c1('0x41')](handleError(_0x42feda,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8c90be4..9025d6a 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 _0x3b64=['int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x5b4d2c,_0x5d1623){var _0x529eea=function(_0x1db7c8){while(--_0x1db7c8){_0x5b4d2c['push'](_0x5b4d2c['shift']());}};_0x529eea(++_0x5d1623);}(_0x3b64,0xc5));var _0x43b6=function(_0x5bc0e0,_0x507608){_0x5bc0e0=_0x5bc0e0-0x0;var _0x2a577b=_0x3b64[_0x5bc0e0];return _0x2a577b;};'use strict';var _=require(_0x43b6('0x0'));var util=require('util');var logger=require(_0x43b6('0x1'))(_0x43b6('0x2'));var moment=require(_0x43b6('0x3'));var BPromise=require(_0x43b6('0x4'));var rp=require(_0x43b6('0x5'));var fs=require('fs');var path=require(_0x43b6('0x6'));var rimraf=require(_0x43b6('0x7'));var config=require(_0x43b6('0x8'));var attributes=require(_0x43b6('0x9'));module[_0x43b6('0xa')]=function(_0x55c178,_0x3ffcae){return _0x55c178[_0x43b6('0xb')](_0x43b6('0xc'),attributes,{'tableName':_0x43b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fe=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x977ff7,_0x5a6f01){var _0x3885d3=function(_0x4df93e){while(--_0x4df93e){_0x977ff7['push'](_0x977ff7['shift']());}};_0x3885d3(++_0x5a6f01);}(_0xc4fe,0x139));var _0xec4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec4f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xec4f('0x1'));var BPromise=require(_0xec4f('0x2'));var rp=require(_0xec4f('0x3'));var fs=require('fs');var path=require(_0xec4f('0x4'));var rimraf=require(_0xec4f('0x5'));var config=require(_0xec4f('0x6'));var attributes=require(_0xec4f('0x7'));module[_0xec4f('0x8')]=function(_0x1e3e25,_0x62c281){return _0x1e3e25[_0xec4f('0x9')](_0xec4f('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index e071e75..8a8bda4 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 _0x969f=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5cd502,_0xd98fd2){var _0x43d8a5=function(_0x2acdd8){while(--_0x2acdd8){_0x5cd502['push'](_0x5cd502['shift']());}};_0x43d8a5(++_0xd98fd2);}(_0x969f,0x13c));var _0xf969=function(_0x3ed95e,_0x2d2d13){_0x3ed95e=_0x3ed95e-0x0;var _0x4ab531=_0x969f[_0x3ed95e];return _0x4ab531;};'use strict';var _=require(_0xf969('0x0'));var util=require(_0xf969('0x1'));var moment=require(_0xf969('0x2'));var BPromise=require(_0xf969('0x3'));var rs=require(_0xf969('0x4'));var fs=require('fs');var Redis=require(_0xf969('0x5'));var db=require(_0xf969('0x6'))['db'];var utils=require(_0xf969('0x7'));var logger=require(_0xf969('0x8'))(_0xf969('0x9'));var config=require(_0xf969('0xa'));var jayson=require(_0xf969('0xb'));var client=jayson[_0xf969('0xc')][_0xf969('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e17af,_0x1b7893,_0x2258a3){return new BPromise(function(_0x4c113c,_0x378cd7){return client[_0xf969('0xe')](_0x1e17af,_0x2258a3)[_0xf969('0xf')](function(_0x2351b3){logger[_0xf969('0x10')](_0xf969('0x11'),_0x1b7893,_0xf969('0x12'));logger[_0xf969('0x13')](_0xf969('0x14'),_0x1b7893,_0xf969('0x12'),JSON[_0xf969('0x15')](_0x2351b3));if(_0x2351b3[_0xf969('0x16')]){if(_0x2351b3[_0xf969('0x16')]['code']===0x1f4){logger[_0xf969('0x16')](_0xf969('0x11'),_0x1b7893,_0x2351b3[_0xf969('0x16')][_0xf969('0x17')]);return _0x378cd7(_0x2351b3[_0xf969('0x16')][_0xf969('0x17')]);}logger['error'](_0xf969('0x11'),_0x1b7893,_0x2351b3[_0xf969('0x16')][_0xf969('0x17')]);return _0x4c113c(_0x2351b3['error'][_0xf969('0x17')]);}else{logger[_0xf969('0x10')](_0xf969('0x11'),_0x1b7893,_0xf969('0x12'));_0x4c113c(_0x2351b3[_0xf969('0x18')][_0xf969('0x17')]);}})[_0xf969('0x19')](function(_0x334d39){logger[_0xf969('0x16')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b7893,_0x334d39);_0x378cd7(_0x334d39);});});} \ No newline at end of file +var _0xd592=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x57e7b1,_0x52469c){var _0x25a0aa=function(_0x19ab9a){while(--_0x19ab9a){_0x57e7b1['push'](_0x57e7b1['shift']());}};_0x25a0aa(++_0x52469c);}(_0xd592,0xec));var _0x2d59=function(_0x28a032,_0x5b8c26){_0x28a032=_0x28a032-0x0;var _0x3e456d=_0xd592[_0x28a032];return _0x3e456d;};'use strict';var _=require(_0x2d59('0x0'));var util=require(_0x2d59('0x1'));var moment=require(_0x2d59('0x2'));var BPromise=require(_0x2d59('0x3'));var rs=require(_0x2d59('0x4'));var fs=require('fs');var Redis=require(_0x2d59('0x5'));var db=require(_0x2d59('0x6'))['db'];var utils=require(_0x2d59('0x7'));var logger=require('../../config/logger')(_0x2d59('0x8'));var config=require(_0x2d59('0x9'));var jayson=require(_0x2d59('0xa'));var client=jayson[_0x2d59('0xb')][_0x2d59('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x459561,_0x29d610,_0x2136bd){return new BPromise(function(_0x2bc2a5,_0x3bfb5a){return client[_0x2d59('0xd')](_0x459561,_0x2136bd)['then'](function(_0x434684){logger[_0x2d59('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x29d610,_0x2d59('0xf'));logger[_0x2d59('0x10')](_0x2d59('0x11'),_0x29d610,_0x2d59('0xf'),JSON[_0x2d59('0x12')](_0x434684));if(_0x434684['error']){if(_0x434684[_0x2d59('0x13')]['code']===0x1f4){logger[_0x2d59('0x13')](_0x2d59('0x14'),_0x29d610,_0x434684['error']['message']);return _0x3bfb5a(_0x434684[_0x2d59('0x13')]['message']);}logger[_0x2d59('0x13')](_0x2d59('0x14'),_0x29d610,_0x434684[_0x2d59('0x13')][_0x2d59('0x15')]);return _0x2bc2a5(_0x434684[_0x2d59('0x13')][_0x2d59('0x15')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x29d610,'request\x20sent');_0x2bc2a5(_0x434684[_0x2d59('0x16')]['message']);}})[_0x2d59('0x17')](function(_0x208bcf){logger[_0x2d59('0x13')](_0x2d59('0x14'),_0x29d610,_0x208bcf);_0x3bfb5a(_0x208bcf);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7755b5e..d3f0838 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 _0x9c95=['./intSalesforceField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c95,0x1ce));var _0x59c9=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9c95[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x59c9('0x0'));var util=require(_0x59c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x59c9('0x2'));var router=express[_0x59c9('0x3')]();var fs_extra=require(_0x59c9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59c9('0x5'));var controller=require(_0x59c9('0x6'));router[_0x59c9('0x7')]('/',auth[_0x59c9('0x8')](),controller[_0x59c9('0x9')]);router[_0x59c9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x59c9('0xa')]);router[_0x59c9('0xb')]('/',auth[_0x59c9('0x8')](),controller[_0x59c9('0xc')]);router[_0x59c9('0xd')](_0x59c9('0xe'),auth[_0x59c9('0x8')](),controller['update']);router[_0x59c9('0xf')](_0x59c9('0xe'),auth[_0x59c9('0x8')](),controller[_0x59c9('0x10')]);module[_0x59c9('0x11')]=router; \ No newline at end of file +var _0x8612=['delete','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','post','create','update'];(function(_0x2de41e,_0x12a7dc){var _0x2e70d1=function(_0x3e77ba){while(--_0x3e77ba){_0x2de41e['push'](_0x2de41e['shift']());}};_0x2e70d1(++_0x12a7dc);}(_0x8612,0x162));var _0x2861=function(_0x46de5a,_0x1cf3e0){_0x46de5a=_0x46de5a-0x0;var _0x1ad8a7=_0x8612[_0x46de5a];return _0x1ad8a7;};'use strict';var multer=require(_0x2861('0x0'));var util=require('util');var path=require(_0x2861('0x1'));var timeout=require(_0x2861('0x2'));var express=require(_0x2861('0x3'));var router=express[_0x2861('0x4')]();var fs_extra=require(_0x2861('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2861('0x6'));var controller=require(_0x2861('0x7'));router[_0x2861('0x8')]('/',auth[_0x2861('0x9')](),controller[_0x2861('0xa')]);router[_0x2861('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2861('0xb')]('/',auth['isAuthenticated'](),controller[_0x2861('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2861('0xd')]);router[_0x2861('0xe')](_0x2861('0xf'),auth[_0x2861('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4edd95f..e5d269a 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 _0x6f6c=['sequelize','ENUM','string','variable','customVariable','STRING'];(function(_0x256684,_0xff356e){var _0xe7e17d=function(_0x1ff250){while(--_0x1ff250){_0x256684['push'](_0x256684['shift']());}};_0xe7e17d(++_0xff356e);}(_0x6f6c,0xae));var _0xc6f6=function(_0xb59c89,_0x143196){_0xb59c89=_0xb59c89-0x0;var _0x779378=_0x6f6c[_0xb59c89];return _0x779378;};'use strict';var Sequelize=require(_0xc6f6('0x0'));module['exports']={'type':{'type':Sequelize[_0xc6f6('0x1')](_0xc6f6('0x2'),_0xc6f6('0x3'),_0xc6f6('0x4'),'keyValue','picklist'),'defaultValue':_0xc6f6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xc6f6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6f6('0x5')]},'idField':{'type':Sequelize[_0xc6f6('0x5')]},'variableName':{'type':Sequelize[_0xc6f6('0x5')]}}; \ No newline at end of file +var _0x3b08=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize'];(function(_0xf45c9,_0x5b8ca1){var _0x25f1bd=function(_0x175b19){while(--_0x175b19){_0xf45c9['push'](_0xf45c9['shift']());}};_0x25f1bd(++_0x5b8ca1);}(_0x3b08,0xd7));var _0x83b0=function(_0x1913ad,_0x5ef05c){_0x1913ad=_0x1913ad-0x0;var _0x387509=_0x3b08[_0x1913ad];return _0x387509;};'use strict';var Sequelize=require(_0x83b0('0x0'));module[_0x83b0('0x1')]={'type':{'type':Sequelize[_0x83b0('0x2')](_0x83b0('0x3'),_0x83b0('0x4'),'customVariable',_0x83b0('0x5'),_0x83b0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x83b0('0x7')]},'key':{'type':Sequelize[_0x83b0('0x7')]},'keyType':{'type':Sequelize[_0x83b0('0x2')]('string',_0x83b0('0x4'),_0x83b0('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x83b0('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 64d0452..17ea0fa 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 _0x19d3=['nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','options','create','body','catch','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xddc052,_0x234244){var _0x4886bc=function(_0x1f66f5){while(--_0x1f66f5){_0xddc052['push'](_0xddc052['shift']());}};_0x4886bc(++_0x234244);}(_0x19d3,0x195));var _0x319d=function(_0x43b0cb,_0x485044){_0x43b0cb=_0x43b0cb-0x0;var _0x4c3a07=_0x19d3[_0x43b0cb];return _0x4c3a07;};'use strict';var emlformat=require(_0x319d('0x0'));var rimraf=require(_0x319d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x319d('0x2'));var moment=require(_0x319d('0x3'));var BPromise=require(_0x319d('0x4'));var Mustache=require(_0x319d('0x5'));var util=require(_0x319d('0x6'));var path=require(_0x319d('0x7'));var sox=require('sox');var csv=require(_0x319d('0x8'));var ejs=require(_0x319d('0x9'));var fs=require('fs');var fs_extra=require(_0x319d('0xa'));var _=require(_0x319d('0xb'));var squel=require(_0x319d('0xc'));var crypto=require(_0x319d('0xd'));var jsforce=require(_0x319d('0xe'));var deskjs=require(_0x319d('0xf'));var toCsv=require(_0x319d('0x8'));var querystring=require('querystring');var Papa=require(_0x319d('0x10'));var Redis=require(_0x319d('0x11'));var authService=require(_0x319d('0x12'));var qs=require(_0x319d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x319d('0x14'));var logger=require(_0x319d('0x15'))('api');var utils=require(_0x319d('0x16'));var config=require(_0x319d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x319d('0x18'))['db'];function respondWithStatusCode(_0x4e5981,_0x11685c){_0x11685c=_0x11685c||0xcc;return function(_0x5ea9c1){if(_0x5ea9c1){return _0x4e5981[_0x319d('0x19')](_0x11685c);}return _0x4e5981[_0x319d('0x1a')](_0x11685c)[_0x319d('0x1b')]();};}function respondWithResult(_0x38e5db,_0x59f85f){_0x59f85f=_0x59f85f||0xc8;return function(_0x3d8987){if(_0x3d8987){return _0x38e5db[_0x319d('0x1a')](_0x59f85f)[_0x319d('0x1c')](_0x3d8987);}};}function respondWithFilteredResult(_0xa22daa,_0x4a5cb1){return function(_0x28ac69){if(_0x28ac69){var _0x2b0831=typeof _0x4a5cb1[_0x319d('0x1d')]===_0x319d('0x1e')&&typeof _0x4a5cb1[_0x319d('0x1f')]===_0x319d('0x1e');var _0x335530=_0x28ac69[_0x319d('0x20')];var _0x125c32=_0x2b0831?0x0:_0x4a5cb1[_0x319d('0x1d')];var _0x4ad6b2=_0x2b0831?_0x28ac69[_0x319d('0x20')]:_0x4a5cb1['offset']+_0x4a5cb1[_0x319d('0x1f')];var _0x333266;if(_0x4ad6b2>=_0x335530){_0x4ad6b2=_0x335530;_0x333266=0xc8;}else{_0x333266=0xce;}_0xa22daa[_0x319d('0x1a')](_0x333266);return _0xa22daa[_0x319d('0x21')](_0x319d('0x22'),_0x125c32+'-'+_0x4ad6b2+'/'+_0x335530)[_0x319d('0x1c')](_0x28ac69);}return null;};}function patchUpdates(_0x307886){return function(_0x41a822){try{jsonpatch[_0x319d('0x23')](_0x41a822,_0x307886,!![]);}catch(_0x461233){return BPromise[_0x319d('0x24')](_0x461233);}return _0x41a822['save']();};}function saveUpdates(_0x150b55,_0xead2d2){return function(_0x20602e){if(_0x20602e){return _0x20602e[_0x319d('0x25')](_0x150b55)['then'](function(_0xf286e){return _0xf286e;});}return null;};}function removeEntity(_0x5b13fa,_0x34c300){return function(_0x1ae630){if(_0x1ae630){return _0x1ae630[_0x319d('0x26')]()[_0x319d('0x27')](function(){_0x5b13fa['status'](0xcc)[_0x319d('0x1b')]();});}};}function handleEntityNotFound(_0x5e1b3e,_0xa1c654){return function(_0x1e5fa6){if(!_0x1e5fa6){_0x5e1b3e['sendStatus'](0x194);}return _0x1e5fa6;};}function handleError(_0x5e432f,_0x162b7e){_0x162b7e=_0x162b7e||0x1f4;return function(_0xba1682){logger[_0x319d('0x28')](_0xba1682[_0x319d('0x29')]);if(_0xba1682[_0x319d('0x2a')]){delete _0xba1682['name'];}_0x5e432f[_0x319d('0x1a')](_0x162b7e)[_0x319d('0x2b')](_0xba1682);};}exports[_0x319d('0x2c')]=function(_0x58a63e,_0x51b180){var _0x379501={},_0x43a44a={},_0x41d284={'count':0x0,'rows':[]};var _0x1eb9ee=_[_0x319d('0x2d')](db[_0x319d('0x2e')][_0x319d('0x2f')],function(_0x361b1b){return{'name':_0x361b1b[_0x319d('0x30')],'type':_0x361b1b[_0x319d('0x31')]['key']};});_0x43a44a[_0x319d('0x32')]=_[_0x319d('0x2d')](_0x1eb9ee,_0x319d('0x2a'));_0x43a44a[_0x319d('0x33')]=_['keys'](_0x58a63e[_0x319d('0x33')]);_0x43a44a['filters']=_[_0x319d('0x34')](_0x43a44a[_0x319d('0x32')],_0x43a44a[_0x319d('0x33')]);_0x379501[_0x319d('0x35')]=_[_0x319d('0x34')](_0x43a44a['model'],qs[_0x319d('0x36')](_0x58a63e['query'][_0x319d('0x36')]));_0x379501[_0x319d('0x35')]=_0x379501[_0x319d('0x35')][_0x319d('0x37')]?_0x379501[_0x319d('0x35')]:_0x43a44a[_0x319d('0x32')];if(!_0x58a63e[_0x319d('0x33')][_0x319d('0x38')](_0x319d('0x39'))){_0x379501['limit']=qs[_0x319d('0x1f')](_0x58a63e[_0x319d('0x33')]['limit']);_0x379501['offset']=qs['offset'](_0x58a63e[_0x319d('0x33')][_0x319d('0x1d')]);}_0x379501[_0x319d('0x3a')]=qs[_0x319d('0x3b')](_0x58a63e[_0x319d('0x33')][_0x319d('0x3b')]);_0x379501['where']=qs[_0x319d('0x3c')](_[_0x319d('0x3d')](_0x58a63e['query'],_0x43a44a['filters']),_0x1eb9ee);if(_0x58a63e[_0x319d('0x33')][_0x319d('0x3e')]){_0x379501[_0x319d('0x3f')]=_['merge'](_0x379501[_0x319d('0x3f')],{'$or':_[_0x319d('0x2d')](_0x1eb9ee,function(_0x40fc48){if(_0x40fc48[_0x319d('0x31')]!==_0x319d('0x40')){var _0x13bcb2={};_0x13bcb2[_0x40fc48[_0x319d('0x2a')]]={'$like':'%'+_0x58a63e[_0x319d('0x33')][_0x319d('0x3e')]+'%'};return _0x13bcb2;}})});}_0x379501=_[_0x319d('0x41')]({},_0x379501,_0x58a63e['options']);var _0x55514b={'where':_0x379501[_0x319d('0x3f')]};return db[_0x319d('0x2e')][_0x319d('0x20')](_0x55514b)[_0x319d('0x27')](function(_0x1f97f3){_0x41d284[_0x319d('0x20')]=_0x1f97f3;if(_0x58a63e[_0x319d('0x33')][_0x319d('0x42')]){_0x379501[_0x319d('0x43')]=[{'all':!![]}];}return db[_0x319d('0x2e')]['findAll'](_0x379501);})[_0x319d('0x27')](function(_0xacd662){_0x41d284[_0x319d('0x44')]=_0xacd662;return _0x41d284;})[_0x319d('0x27')](respondWithFilteredResult(_0x51b180,_0x379501))['catch'](handleError(_0x51b180,null));};exports[_0x319d('0x45')]=function(_0x5838fa,_0x3f21c6){var _0x44c9da={'raw':!![],'where':{'id':_0x5838fa[_0x319d('0x46')]['id']}},_0x45dc7d={};_0x45dc7d[_0x319d('0x32')]=_[_0x319d('0x47')](db[_0x319d('0x2e')][_0x319d('0x2f')]);_0x45dc7d[_0x319d('0x33')]=_[_0x319d('0x47')](_0x5838fa['query']);_0x45dc7d[_0x319d('0x3c')]=_[_0x319d('0x34')](_0x45dc7d[_0x319d('0x32')],_0x45dc7d[_0x319d('0x33')]);_0x44c9da[_0x319d('0x35')]=_['intersection'](_0x45dc7d[_0x319d('0x32')],qs[_0x319d('0x36')](_0x5838fa[_0x319d('0x33')][_0x319d('0x36')]));_0x44c9da['attributes']=_0x44c9da[_0x319d('0x35')][_0x319d('0x37')]?_0x44c9da[_0x319d('0x35')]:_0x45dc7d[_0x319d('0x32')];if(_0x5838fa['query'][_0x319d('0x42')]){_0x44c9da['include']=[{'all':!![]}];}_0x44c9da=_[_0x319d('0x41')]({},_0x44c9da,_0x5838fa[_0x319d('0x48')]);return db[_0x319d('0x2e')]['find'](_0x44c9da)[_0x319d('0x27')](handleEntityNotFound(_0x3f21c6,null))['then'](respondWithResult(_0x3f21c6,null))['catch'](handleError(_0x3f21c6,null));};exports[_0x319d('0x49')]=function(_0x511e5c,_0x478ddf){return db['SalesforceField'][_0x319d('0x49')](_0x511e5c[_0x319d('0x4a')],{})[_0x319d('0x27')](respondWithResult(_0x478ddf,0xc9))[_0x319d('0x4b')](handleError(_0x478ddf,null));};exports[_0x319d('0x25')]=function(_0x2dcf3b,_0x39fbb7){if(_0x2dcf3b[_0x319d('0x4a')]['id']){delete _0x2dcf3b[_0x319d('0x4a')]['id'];}return db[_0x319d('0x2e')]['find']({'where':{'id':_0x2dcf3b[_0x319d('0x46')]['id']}})[_0x319d('0x27')](handleEntityNotFound(_0x39fbb7,null))['then'](saveUpdates(_0x2dcf3b[_0x319d('0x4a')],null))[_0x319d('0x27')](respondWithResult(_0x39fbb7,null))['catch'](handleError(_0x39fbb7,null));};exports[_0x319d('0x26')]=function(_0x1cdbdb,_0x34485d){return db[_0x319d('0x2e')][_0x319d('0x4c')]({'where':{'id':_0x1cdbdb['params']['id']}})['then'](handleEntityNotFound(_0x34485d,null))[_0x319d('0x27')](removeEntity(_0x34485d,null))[_0x319d('0x4b')](handleError(_0x34485d,null));}; \ No newline at end of file +var _0xc145=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','SalesforceField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x5f41c9,_0x160beb){var _0xdb7812=function(_0x4575d4){while(--_0x4575d4){_0x5f41c9['push'](_0x5f41c9['shift']());}};_0xdb7812(++_0x160beb);}(_0xc145,0x14e));var _0x5c14=function(_0x5db0d2,_0x3162d9){_0x5db0d2=_0x5db0d2-0x0;var _0x4ed455=_0xc145[_0x5db0d2];return _0x4ed455;};'use strict';var emlformat=require(_0x5c14('0x0'));var rimraf=require(_0x5c14('0x1'));var zipdir=require(_0x5c14('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c14('0x3'));var moment=require('moment');var BPromise=require(_0x5c14('0x4'));var Mustache=require(_0x5c14('0x5'));var util=require(_0x5c14('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5c14('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c14('0x8'));var jsforce=require(_0x5c14('0x9'));var deskjs=require(_0x5c14('0xa'));var toCsv=require(_0x5c14('0x7'));var querystring=require(_0x5c14('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c14('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c14('0xd'));var logger=require(_0x5c14('0xe'))(_0x5c14('0xf'));var utils=require(_0x5c14('0x10'));var config=require(_0x5c14('0x11'));var licenseUtil=require(_0x5c14('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f0ef,_0x3ba006){_0x3ba006=_0x3ba006||0xcc;return function(_0x30b9f1){if(_0x30b9f1){return _0x43f0ef[_0x5c14('0x13')](_0x3ba006);}return _0x43f0ef[_0x5c14('0x14')](_0x3ba006)['end']();};}function respondWithResult(_0x453253,_0x372ad9){_0x372ad9=_0x372ad9||0xc8;return function(_0x751220){if(_0x751220){return _0x453253['status'](_0x372ad9)[_0x5c14('0x15')](_0x751220);}};}function respondWithFilteredResult(_0x2e0169,_0x451580){return function(_0x4e88a4){if(_0x4e88a4){var _0x464b5c=typeof _0x451580[_0x5c14('0x16')]===_0x5c14('0x17')&&typeof _0x451580[_0x5c14('0x18')]===_0x5c14('0x17');var _0x4fe6c2=_0x4e88a4['count'];var _0x6fdb6d=_0x464b5c?0x0:_0x451580[_0x5c14('0x16')];var _0xd1fd58=_0x464b5c?_0x4e88a4[_0x5c14('0x19')]:_0x451580['offset']+_0x451580[_0x5c14('0x18')];var _0x4e6bca;if(_0xd1fd58>=_0x4fe6c2){_0xd1fd58=_0x4fe6c2;_0x4e6bca=0xc8;}else{_0x4e6bca=0xce;}_0x2e0169[_0x5c14('0x14')](_0x4e6bca);return _0x2e0169['set'](_0x5c14('0x1a'),_0x6fdb6d+'-'+_0xd1fd58+'/'+_0x4fe6c2)[_0x5c14('0x15')](_0x4e88a4);}return null;};}function patchUpdates(_0x4e1fa1){return function(_0x142d99){try{jsonpatch[_0x5c14('0x1b')](_0x142d99,_0x4e1fa1,!![]);}catch(_0xb064d9){return BPromise['reject'](_0xb064d9);}return _0x142d99[_0x5c14('0x1c')]();};}function saveUpdates(_0x2dff3f,_0x1d0615){return function(_0x4deffc){if(_0x4deffc){return _0x4deffc[_0x5c14('0x1d')](_0x2dff3f)[_0x5c14('0x1e')](function(_0x30bf71){return _0x30bf71;});}return null;};}function removeEntity(_0x383d70,_0x212982){return function(_0x137316){if(_0x137316){return _0x137316[_0x5c14('0x1f')]()[_0x5c14('0x1e')](function(){_0x383d70[_0x5c14('0x14')](0xcc)[_0x5c14('0x20')]();});}};}function handleEntityNotFound(_0x3611e7,_0x23a0ac){return function(_0x11d7cc){if(!_0x11d7cc){_0x3611e7[_0x5c14('0x13')](0x194);}return _0x11d7cc;};}function handleError(_0x3a38f3,_0x556f92){_0x556f92=_0x556f92||0x1f4;return function(_0x10f708){logger[_0x5c14('0x21')](_0x10f708[_0x5c14('0x22')]);if(_0x10f708[_0x5c14('0x23')]){delete _0x10f708[_0x5c14('0x23')];}_0x3a38f3['status'](_0x556f92)[_0x5c14('0x24')](_0x10f708);};}exports[_0x5c14('0x25')]=function(_0x57e9d5,_0xf15165){var _0x1ab191={},_0x4d061a={},_0x5bd15b={'count':0x0,'rows':[]};var _0x36507a=_['map'](db[_0x5c14('0x26')][_0x5c14('0x27')],function(_0x1fe94e){return{'name':_0x1fe94e['fieldName'],'type':_0x1fe94e[_0x5c14('0x28')]['key']};});_0x4d061a[_0x5c14('0x29')]=_['map'](_0x36507a,_0x5c14('0x23'));_0x4d061a[_0x5c14('0x2a')]=_[_0x5c14('0x2b')](_0x57e9d5[_0x5c14('0x2a')]);_0x4d061a[_0x5c14('0x2c')]=_[_0x5c14('0x2d')](_0x4d061a[_0x5c14('0x29')],_0x4d061a[_0x5c14('0x2a')]);_0x1ab191[_0x5c14('0x2e')]=_[_0x5c14('0x2d')](_0x4d061a['model'],qs['fields'](_0x57e9d5[_0x5c14('0x2a')][_0x5c14('0x2f')]));_0x1ab191['attributes']=_0x1ab191[_0x5c14('0x2e')][_0x5c14('0x30')]?_0x1ab191['attributes']:_0x4d061a[_0x5c14('0x29')];if(!_0x57e9d5[_0x5c14('0x2a')][_0x5c14('0x31')](_0x5c14('0x32'))){_0x1ab191[_0x5c14('0x18')]=qs['limit'](_0x57e9d5[_0x5c14('0x2a')][_0x5c14('0x18')]);_0x1ab191[_0x5c14('0x16')]=qs[_0x5c14('0x16')](_0x57e9d5['query']['offset']);}_0x1ab191[_0x5c14('0x33')]=qs[_0x5c14('0x34')](_0x57e9d5[_0x5c14('0x2a')]['sort']);_0x1ab191[_0x5c14('0x35')]=qs[_0x5c14('0x2c')](_[_0x5c14('0x36')](_0x57e9d5[_0x5c14('0x2a')],_0x4d061a[_0x5c14('0x2c')]),_0x36507a);if(_0x57e9d5[_0x5c14('0x2a')][_0x5c14('0x37')]){_0x1ab191[_0x5c14('0x35')]=_[_0x5c14('0x38')](_0x1ab191['where'],{'$or':_[_0x5c14('0x39')](_0x36507a,function(_0x1ec97d){if(_0x1ec97d[_0x5c14('0x28')]!==_0x5c14('0x3a')){var _0x29a56f={};_0x29a56f[_0x1ec97d[_0x5c14('0x23')]]={'$like':'%'+_0x57e9d5[_0x5c14('0x2a')]['filter']+'%'};return _0x29a56f;}})});}_0x1ab191=_[_0x5c14('0x38')]({},_0x1ab191,_0x57e9d5[_0x5c14('0x3b')]);var _0x4e2b13={'where':_0x1ab191[_0x5c14('0x35')]};return db[_0x5c14('0x26')]['count'](_0x4e2b13)[_0x5c14('0x1e')](function(_0x549de0){_0x5bd15b[_0x5c14('0x19')]=_0x549de0;if(_0x57e9d5[_0x5c14('0x2a')][_0x5c14('0x3c')]){_0x1ab191[_0x5c14('0x3d')]=[{'all':!![]}];}return db[_0x5c14('0x26')][_0x5c14('0x3e')](_0x1ab191);})[_0x5c14('0x1e')](function(_0x420b5f){_0x5bd15b[_0x5c14('0x3f')]=_0x420b5f;return _0x5bd15b;})['then'](respondWithFilteredResult(_0xf15165,_0x1ab191))['catch'](handleError(_0xf15165,null));};exports[_0x5c14('0x40')]=function(_0x1303c4,_0x388485){var _0x54147a={'raw':!![],'where':{'id':_0x1303c4[_0x5c14('0x41')]['id']}},_0x20070b={};_0x20070b[_0x5c14('0x29')]=_[_0x5c14('0x2b')](db[_0x5c14('0x26')][_0x5c14('0x27')]);_0x20070b[_0x5c14('0x2a')]=_[_0x5c14('0x2b')](_0x1303c4[_0x5c14('0x2a')]);_0x20070b[_0x5c14('0x2c')]=_[_0x5c14('0x2d')](_0x20070b[_0x5c14('0x29')],_0x20070b[_0x5c14('0x2a')]);_0x54147a[_0x5c14('0x2e')]=_[_0x5c14('0x2d')](_0x20070b[_0x5c14('0x29')],qs[_0x5c14('0x2f')](_0x1303c4['query'][_0x5c14('0x2f')]));_0x54147a['attributes']=_0x54147a['attributes'][_0x5c14('0x30')]?_0x54147a[_0x5c14('0x2e')]:_0x20070b[_0x5c14('0x29')];if(_0x1303c4[_0x5c14('0x2a')][_0x5c14('0x3c')]){_0x54147a[_0x5c14('0x3d')]=[{'all':!![]}];}_0x54147a=_[_0x5c14('0x38')]({},_0x54147a,_0x1303c4[_0x5c14('0x3b')]);return db[_0x5c14('0x26')]['find'](_0x54147a)[_0x5c14('0x1e')](handleEntityNotFound(_0x388485,null))['then'](respondWithResult(_0x388485,null))[_0x5c14('0x42')](handleError(_0x388485,null));};exports[_0x5c14('0x43')]=function(_0x2c315f,_0x1e5468){return db[_0x5c14('0x26')][_0x5c14('0x43')](_0x2c315f['body'],{})['then'](respondWithResult(_0x1e5468,0xc9))['catch'](handleError(_0x1e5468,null));};exports[_0x5c14('0x1d')]=function(_0x2eeffc,_0x5ce66b){if(_0x2eeffc[_0x5c14('0x44')]['id']){delete _0x2eeffc['body']['id'];}return db[_0x5c14('0x26')][_0x5c14('0x45')]({'where':{'id':_0x2eeffc[_0x5c14('0x41')]['id']}})[_0x5c14('0x1e')](handleEntityNotFound(_0x5ce66b,null))[_0x5c14('0x1e')](saveUpdates(_0x2eeffc[_0x5c14('0x44')],null))[_0x5c14('0x1e')](respondWithResult(_0x5ce66b,null))[_0x5c14('0x42')](handleError(_0x5ce66b,null));};exports['destroy']=function(_0x2c98da,_0x242ec8){return db['SalesforceField'][_0x5c14('0x45')]({'where':{'id':_0x2c98da[_0x5c14('0x41')]['id']}})['then'](handleEntityNotFound(_0x242ec8,null))[_0x5c14('0x1e')](removeEntity(_0x242ec8,null))[_0x5c14('0x42')](handleError(_0x242ec8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c7fd184..61dd828 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 _0x9777=['request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','api','bluebird'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x9777,0x8c));var _0x7977=function(_0x5de7fe,_0x147f0f){_0x5de7fe=_0x5de7fe-0x0;var _0x389a5b=_0x9777[_0x5de7fe];return _0x389a5b;};'use strict';var _=require('lodash');var util=require(_0x7977('0x0'));var logger=require('../../config/logger')(_0x7977('0x1'));var moment=require('moment');var BPromise=require(_0x7977('0x2'));var rp=require(_0x7977('0x3'));var fs=require('fs');var path=require(_0x7977('0x4'));var rimraf=require(_0x7977('0x5'));var config=require('../../config/environment');var attributes=require(_0x7977('0x6'));module[_0x7977('0x7')]=function(_0x41ae1a,_0x1d9aad){return _0x41ae1a[_0x7977('0x8')](_0x7977('0x9'),attributes,{'tableName':_0x7977('0xa'),'paranoid':![],'indexes':[{'name':_0x7977('0xb'),'fields':['idField',_0x7977('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x493a=['exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x549c51,_0x29e6fd){var _0x264861=function(_0x24e074){while(--_0x24e074){_0x549c51['push'](_0x549c51['shift']());}};_0x264861(++_0x29e6fd);}(_0x493a,0xa0));var _0xa493=function(_0x3d1ce2,_0x2a9d26){_0x3d1ce2=_0x3d1ce2-0x0;var _0x43c682=_0x493a[_0x3d1ce2];return _0x43c682;};'use strict';var _=require(_0xa493('0x0'));var util=require(_0xa493('0x1'));var logger=require(_0xa493('0x2'))(_0xa493('0x3'));var moment=require('moment');var BPromise=require(_0xa493('0x4'));var rp=require(_0xa493('0x5'));var fs=require('fs');var path=require(_0xa493('0x6'));var rimraf=require(_0xa493('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xa493('0x8')]=function(_0x39edcd,_0x3b289d){return _0x39edcd[_0xa493('0x9')]('SalesforceField',attributes,{'tableName':_0xa493('0xa'),'paranoid':![],'indexes':[{'name':_0xa493('0xb'),'fields':[_0xa493('0xc'),_0xa493('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index edd8dd7..26755d7 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 _0x9cc3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x13609c,_0x460110){var _0x1dff06=function(_0x1fb7a0){while(--_0x1fb7a0){_0x13609c['push'](_0x13609c['shift']());}};_0x1dff06(++_0x460110);}(_0x9cc3,0x135));var _0x39cc=function(_0xea1caa,_0x29cc77){_0xea1caa=_0xea1caa-0x0;var _0x384ec8=_0x9cc3[_0xea1caa];return _0x384ec8;};'use strict';var _=require(_0x39cc('0x0'));var util=require(_0x39cc('0x1'));var moment=require('moment');var BPromise=require(_0x39cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39cc('0x3'));var db=require(_0x39cc('0x4'))['db'];var utils=require(_0x39cc('0x5'));var logger=require(_0x39cc('0x6'))(_0x39cc('0x7'));var config=require(_0x39cc('0x8'));var jayson=require(_0x39cc('0x9'));var client=jayson[_0x39cc('0xa')][_0x39cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1717be,_0x22cf94,_0x10edba){return new BPromise(function(_0x43e926,_0x304498){return client[_0x39cc('0xc')](_0x1717be,_0x10edba)[_0x39cc('0xd')](function(_0x37a9f4){logger[_0x39cc('0xe')](_0x39cc('0xf'),_0x22cf94,_0x39cc('0x10'));logger[_0x39cc('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x22cf94,_0x39cc('0x10'),JSON[_0x39cc('0x12')](_0x37a9f4));if(_0x37a9f4[_0x39cc('0x13')]){if(_0x37a9f4[_0x39cc('0x13')][_0x39cc('0x14')]===0x1f4){logger[_0x39cc('0x13')](_0x39cc('0xf'),_0x22cf94,_0x37a9f4[_0x39cc('0x13')][_0x39cc('0x15')]);return _0x304498(_0x37a9f4[_0x39cc('0x13')]['message']);}logger[_0x39cc('0x13')]('SalesforceField,\x20%s,\x20%s',_0x22cf94,_0x37a9f4['error']['message']);return _0x43e926(_0x37a9f4[_0x39cc('0x13')][_0x39cc('0x15')]);}else{logger['info'](_0x39cc('0xf'),_0x22cf94,_0x39cc('0x10'));_0x43e926(_0x37a9f4[_0x39cc('0x16')]['message']);}})[_0x39cc('0x17')](function(_0x1bbe6e){logger[_0x39cc('0x13')](_0x39cc('0xf'),_0x22cf94,_0x1bbe6e);_0x304498(_0x1bbe6e);});});} \ No newline at end of file +var _0x99c9=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x54b637,_0x53af68){var _0x522f8f=function(_0x22c35f){while(--_0x22c35f){_0x54b637['push'](_0x54b637['shift']());}};_0x522f8f(++_0x53af68);}(_0x99c9,0x1e9));var _0x999c=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x99c9[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var moment=require(_0x999c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x999c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x999c('0x4'));var logger=require(_0x999c('0x5'))('rpc');var config=require(_0x999c('0x6'));var jayson=require(_0x999c('0x7'));var client=jayson[_0x999c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1deb1f,_0x30e423,_0x3adeea){return new BPromise(function(_0x684029,_0x26a0db){return client[_0x999c('0x9')](_0x1deb1f,_0x3adeea)['then'](function(_0x36934c){logger[_0x999c('0xa')](_0x999c('0xb'),_0x30e423,_0x999c('0xc'));logger[_0x999c('0xd')](_0x999c('0xe'),_0x30e423,_0x999c('0xc'),JSON['stringify'](_0x36934c));if(_0x36934c[_0x999c('0xf')]){if(_0x36934c[_0x999c('0xf')][_0x999c('0x10')]===0x1f4){logger[_0x999c('0xf')]('SalesforceField,\x20%s,\x20%s',_0x30e423,_0x36934c['error'][_0x999c('0x11')]);return _0x26a0db(_0x36934c[_0x999c('0xf')]['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x30e423,_0x36934c[_0x999c('0xf')][_0x999c('0x11')]);return _0x684029(_0x36934c[_0x999c('0xf')][_0x999c('0x11')]);}else{logger[_0x999c('0xa')]('SalesforceField,\x20%s,\x20%s',_0x30e423,'request\x20sent');_0x684029(_0x36934c[_0x999c('0x12')][_0x999c('0x11')]);}})[_0x999c('0x13')](function(_0x183f8d){logger[_0x999c('0xf')]('SalesforceField,\x20%s,\x20%s',_0x30e423,_0x183f8d);_0x26a0db(_0x183f8d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3e9c3a4..10c397b 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 _0xcd1a=['/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x2ac622,_0x5a31b9){var _0x500fce=function(_0x18b7ef){while(--_0x18b7ef){_0x2ac622['push'](_0x2ac622['shift']());}};_0x500fce(++_0x5a31b9);}(_0xcd1a,0x115));var _0xacd1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xcd1a[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var path=require(_0xacd1('0x2'));var timeout=require('connect-timeout');var express=require(_0xacd1('0x3'));var router=express[_0xacd1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xacd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xacd1('0x6'));var controller=require(_0xacd1('0x7'));router[_0xacd1('0x8')]('/',auth[_0xacd1('0x9')](),controller[_0xacd1('0xa')]);router['get'](_0xacd1('0xb'),auth[_0xacd1('0x9')](),controller[_0xacd1('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xacd1('0xd'),auth[_0xacd1('0x9')](),controller[_0xacd1('0xe')]);router['post']('/',auth[_0xacd1('0x9')](),controller[_0xacd1('0xf')]);router[_0xacd1('0x10')](_0xacd1('0x11'),auth[_0xacd1('0x9')](),controller[_0xacd1('0x12')]);router[_0xacd1('0x13')](_0xacd1('0xb'),auth[_0xacd1('0x9')](),controller[_0xacd1('0x14')]);router[_0xacd1('0x15')]('/:id',auth[_0xacd1('0x9')](),controller[_0xacd1('0x16')]);module[_0xacd1('0x17')]=router; \ No newline at end of file +var _0xdd32=['./intServicenowAccount.controller','get','index','isAuthenticated','show','getConfigurations','post','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15f114,_0x22935c){var _0x52df23=function(_0x2e1439){while(--_0x2e1439){_0x15f114['push'](_0x15f114['shift']());}};_0x52df23(++_0x22935c);}(_0xdd32,0x98));var _0x2dd3=function(_0x589870,_0x2595a1){_0x589870=_0x589870-0x0;var _0xf3ffc0=_0xdd32[_0x589870];return _0xf3ffc0;};'use strict';var multer=require(_0x2dd3('0x0'));var util=require(_0x2dd3('0x1'));var path=require(_0x2dd3('0x2'));var timeout=require(_0x2dd3('0x3'));var express=require(_0x2dd3('0x4'));var router=express[_0x2dd3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2dd3('0x6'));var interaction=require(_0x2dd3('0x7'));var config=require(_0x2dd3('0x8'));var controller=require(_0x2dd3('0x9'));router[_0x2dd3('0xa')]('/',auth['isAuthenticated'](),controller[_0x2dd3('0xb')]);router[_0x2dd3('0xa')]('/:id',auth[_0x2dd3('0xc')](),controller[_0x2dd3('0xd')]);router[_0x2dd3('0xa')]('/:id/configurations',auth[_0x2dd3('0xc')](),controller[_0x2dd3('0xe')]);router['get']('/:id/fields',auth[_0x2dd3('0xc')](),controller['getFields']);router[_0x2dd3('0xf')]('/',auth[_0x2dd3('0xc')](),controller['create']);router['post'](_0x2dd3('0x10'),auth['isAuthenticated'](),controller[_0x2dd3('0x11')]);router['put'](_0x2dd3('0x12'),auth[_0x2dd3('0xc')](),controller[_0x2dd3('0x13')]);router[_0x2dd3('0x14')](_0x2dd3('0x12'),auth[_0x2dd3('0xc')](),controller[_0x2dd3('0x15')]);module[_0x2dd3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 01ebf08..490affa 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 _0xa942=['sequelize','exports','STRING','remoteUri'];(function(_0x38192c,_0x231e41){var _0x31d64e=function(_0x579a6e){while(--_0x579a6e){_0x38192c['push'](_0x38192c['shift']());}};_0x31d64e(++_0x231e41);}(_0xa942,0x16c));var _0x2a94=function(_0x529fb3,_0x835195){_0x529fb3=_0x529fb3-0x0;var _0x311379=_0xa942[_0x529fb3];return _0x311379;};'use strict';var Sequelize=require(_0x2a94('0x0'));module[_0x2a94('0x1')]={'name':{'type':Sequelize[_0x2a94('0x2')]},'description':{'type':Sequelize[_0x2a94('0x2')]},'username':{'type':Sequelize[_0x2a94('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2a94('0x2')]},'email':{'type':Sequelize[_0x2a94('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2a94('0x3')},'serverUrl':{'type':Sequelize[_0x2a94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf7b6=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4248d4,_0x21de09){var _0x110855=function(_0x5bf3c4){while(--_0x5bf3c4){_0x4248d4['push'](_0x4248d4['shift']());}};_0x110855(++_0x21de09);}(_0xf7b6,0x1cb));var _0x6f7b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf7b6[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x6f7b('0x0'));module[_0x6f7b('0x1')]={'name':{'type':Sequelize[_0x6f7b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6f7b('0x3')},'password':{'type':Sequelize[_0x6f7b('0x2')]},'email':{'type':Sequelize[_0x6f7b('0x2')]},'remoteUri':{'type':Sequelize[_0x6f7b('0x2')],'unique':_0x6f7b('0x4')},'serverUrl':{'type':Sequelize[_0x6f7b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index f3b4d31..0d506c3 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 _0xfcbf=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','ServicenowAccount','includeAll','include','rows','catch','show','params','create','body','update','find','findOne','ServicenowConfiguration','map','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','opened_by','user_input','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','reopened_by','incident_state','urgency','problem_id','company','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','location','username','password','email','slice','substring','lastIndexOf','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','label','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','concat','ServiceNow\x20error:\x20','stack','test','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','name','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x177ac4,_0x62717){var _0x5c94af=function(_0x2bb2ab){while(--_0x2bb2ab){_0x177ac4['push'](_0x177ac4['shift']());}};_0x5c94af(++_0x62717);}(_0xfcbf,0x83));var _0xffcb=function(_0xe4aec9,_0x3000e9){_0xe4aec9=_0xe4aec9-0x0;var _0x5ba35f=_0xfcbf[_0xe4aec9];return _0x5ba35f;};'use strict';var emlformat=require(_0xffcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffcb('0x1'));var jsonpatch=require(_0xffcb('0x2'));var rp=require(_0xffcb('0x3'));var moment=require(_0xffcb('0x4'));var BPromise=require(_0xffcb('0x5'));var Mustache=require('mustache');var util=require(_0xffcb('0x6'));var path=require(_0xffcb('0x7'));var sox=require(_0xffcb('0x8'));var csv=require(_0xffcb('0x9'));var ejs=require(_0xffcb('0xa'));var fs=require('fs');var fs_extra=require(_0xffcb('0xb'));var _=require('lodash');var squel=require(_0xffcb('0xc'));var crypto=require(_0xffcb('0xd'));var jsforce=require(_0xffcb('0xe'));var deskjs=require(_0xffcb('0xf'));var toCsv=require(_0xffcb('0x9'));var querystring=require('querystring');var Papa=require(_0xffcb('0x10'));var Redis=require(_0xffcb('0x11'));var authService=require(_0xffcb('0x12'));var qs=require(_0xffcb('0x13'));var as=require(_0xffcb('0x14'));var hardwareService=require(_0xffcb('0x15'));var logger=require(_0xffcb('0x16'))(_0xffcb('0x17'));var utils=require(_0xffcb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xffcb('0x19'));var db=require(_0xffcb('0x1a'))['db'];var integrations=require(_0xffcb('0x1b'));function respondWithStatusCode(_0x280c2b,_0x143f3b){_0x143f3b=_0x143f3b||0xcc;return function(_0x22ef82){if(_0x22ef82){return _0x280c2b[_0xffcb('0x1c')](_0x143f3b);}return _0x280c2b[_0xffcb('0x1d')](_0x143f3b)[_0xffcb('0x1e')]();};}function respondWithResult(_0x244463,_0x1e757d){_0x1e757d=_0x1e757d||0xc8;return function(_0xb3e1e8){if(_0xb3e1e8){return _0x244463[_0xffcb('0x1d')](_0x1e757d)['json'](_0xb3e1e8);}};}function respondWithFilteredResult(_0x41f08c,_0x26c2a3){return function(_0x4bd55a){if(_0x4bd55a){var _0x37e755=typeof _0x26c2a3[_0xffcb('0x1f')]===_0xffcb('0x20')&&typeof _0x26c2a3[_0xffcb('0x21')]===_0xffcb('0x20');var _0x81cd8f=_0x4bd55a[_0xffcb('0x22')];var _0x4cab2a=_0x37e755?0x0:_0x26c2a3[_0xffcb('0x1f')];var _0x8186c3=_0x37e755?_0x4bd55a['count']:_0x26c2a3['offset']+_0x26c2a3[_0xffcb('0x21')];var _0xdf1e08;if(_0x8186c3>=_0x81cd8f){_0x8186c3=_0x81cd8f;_0xdf1e08=0xc8;}else{_0xdf1e08=0xce;}_0x41f08c['status'](_0xdf1e08);return _0x41f08c[_0xffcb('0x23')](_0xffcb('0x24'),_0x4cab2a+'-'+_0x8186c3+'/'+_0x81cd8f)[_0xffcb('0x25')](_0x4bd55a);}return null;};}function patchUpdates(_0x553a5c){return function(_0x21e990){try{jsonpatch['apply'](_0x21e990,_0x553a5c,!![]);}catch(_0x2f678c){return BPromise[_0xffcb('0x26')](_0x2f678c);}return _0x21e990[_0xffcb('0x27')]();};}function saveUpdates(_0x412e66,_0x10a74a){return function(_0x3c7822){if(_0x3c7822){return _0x3c7822['update'](_0x412e66)[_0xffcb('0x28')](function(_0x2810e7){return _0x2810e7;});}return null;};}function removeEntity(_0x3f2f7e,_0x24261c){return function(_0x7888d7){if(_0x7888d7){return _0x7888d7[_0xffcb('0x29')]()[_0xffcb('0x28')](function(){_0x3f2f7e[_0xffcb('0x1d')](0xcc)[_0xffcb('0x1e')]();});}};}function handleEntityNotFound(_0xeb7d39,_0x46cbc9){return function(_0x3bbc88){if(!_0x3bbc88){_0xeb7d39[_0xffcb('0x1c')](0x194);}return _0x3bbc88;};}function handleError(_0x43992b,_0x5d7641){_0x5d7641=_0x5d7641||0x1f4;return function(_0xad8607){logger[_0xffcb('0x2a')](_0xad8607['stack']);if(_0xad8607[_0xffcb('0x2b')]){delete _0xad8607[_0xffcb('0x2b')];}_0x43992b[_0xffcb('0x1d')](_0x5d7641)['send'](_0xad8607);};}exports[_0xffcb('0x2c')]=function(_0x232542,_0x4cb0e6){var _0x43fc83={},_0x508da3={},_0x2369bd={'count':0x0,'rows':[]};var _0x4af7f6=_['map'](db['ServicenowAccount'][_0xffcb('0x2d')],function(_0x44963b){return{'name':_0x44963b[_0xffcb('0x2e')],'type':_0x44963b[_0xffcb('0x2f')]['key']};});_0x508da3[_0xffcb('0x30')]=_['map'](_0x4af7f6,_0xffcb('0x2b'));_0x508da3[_0xffcb('0x31')]=_[_0xffcb('0x32')](_0x232542[_0xffcb('0x31')]);_0x508da3['filters']=_[_0xffcb('0x33')](_0x508da3[_0xffcb('0x30')],_0x508da3[_0xffcb('0x31')]);_0x43fc83[_0xffcb('0x34')]=_[_0xffcb('0x33')](_0x508da3[_0xffcb('0x30')],qs[_0xffcb('0x35')](_0x232542[_0xffcb('0x31')][_0xffcb('0x35')]));_0x43fc83[_0xffcb('0x34')]=_0x43fc83[_0xffcb('0x34')][_0xffcb('0x36')]?_0x43fc83[_0xffcb('0x34')]:_0x508da3[_0xffcb('0x30')];if(!_0x232542[_0xffcb('0x31')][_0xffcb('0x37')](_0xffcb('0x38'))){_0x43fc83['limit']=qs[_0xffcb('0x21')](_0x232542['query'][_0xffcb('0x21')]);_0x43fc83[_0xffcb('0x1f')]=qs[_0xffcb('0x1f')](_0x232542[_0xffcb('0x31')][_0xffcb('0x1f')]);}_0x43fc83[_0xffcb('0x39')]=qs[_0xffcb('0x3a')](_0x232542['query'][_0xffcb('0x3a')]);_0x43fc83['where']=qs[_0xffcb('0x3b')](_[_0xffcb('0x3c')](_0x232542[_0xffcb('0x31')],_0x508da3['filters']),_0x4af7f6);if(_0x232542['query'][_0xffcb('0x3d')]){_0x43fc83['where']=_[_0xffcb('0x3e')](_0x43fc83['where'],{'$or':_['map'](_0x4af7f6,function(_0x148014){if(_0x148014[_0xffcb('0x2f')]!==_0xffcb('0x3f')){var _0x19d836={};_0x19d836[_0x148014['name']]={'$like':'%'+_0x232542[_0xffcb('0x31')][_0xffcb('0x3d')]+'%'};return _0x19d836;}})});}_0x43fc83=_['merge']({},_0x43fc83,_0x232542[_0xffcb('0x40')]);var _0x2c24ad={'where':_0x43fc83[_0xffcb('0x41')]};return db[_0xffcb('0x42')][_0xffcb('0x22')](_0x2c24ad)['then'](function(_0x1ccf0c){_0x2369bd[_0xffcb('0x22')]=_0x1ccf0c;if(_0x232542[_0xffcb('0x31')][_0xffcb('0x43')]){_0x43fc83[_0xffcb('0x44')]=[{'all':!![]}];}return db[_0xffcb('0x42')]['findAll'](_0x43fc83);})[_0xffcb('0x28')](function(_0x15c82a){_0x2369bd[_0xffcb('0x45')]=_0x15c82a;return _0x2369bd;})['then'](respondWithFilteredResult(_0x4cb0e6,_0x43fc83))[_0xffcb('0x46')](handleError(_0x4cb0e6,null));};exports[_0xffcb('0x47')]=function(_0x4e2352,_0x49f4b3){var _0x19784f={'raw':![],'where':{'id':_0x4e2352[_0xffcb('0x48')]['id']}},_0x439a2f={};_0x439a2f[_0xffcb('0x30')]=_[_0xffcb('0x32')](db[_0xffcb('0x42')][_0xffcb('0x2d')]);_0x439a2f[_0xffcb('0x31')]=_['keys'](_0x4e2352[_0xffcb('0x31')]);_0x439a2f['filters']=_[_0xffcb('0x33')](_0x439a2f['model'],_0x439a2f[_0xffcb('0x31')]);_0x19784f['attributes']=_[_0xffcb('0x33')](_0x439a2f['model'],qs[_0xffcb('0x35')](_0x4e2352['query']['fields']));_0x19784f[_0xffcb('0x34')]=_0x19784f[_0xffcb('0x34')][_0xffcb('0x36')]?_0x19784f[_0xffcb('0x34')]:_0x439a2f[_0xffcb('0x30')];if(_0x4e2352[_0xffcb('0x31')]['includeAll']){_0x19784f[_0xffcb('0x44')]=[{'all':!![]}];}_0x19784f=_['merge']({},_0x19784f,_0x4e2352['options']);return db['ServicenowAccount']['find'](_0x19784f)[_0xffcb('0x28')](handleEntityNotFound(_0x49f4b3,null))[_0xffcb('0x28')](respondWithResult(_0x49f4b3,null))[_0xffcb('0x46')](handleError(_0x49f4b3,null));};exports[_0xffcb('0x49')]=function(_0xe8230d,_0x52859a){return db[_0xffcb('0x42')][_0xffcb('0x49')](_0xe8230d[_0xffcb('0x4a')],{})[_0xffcb('0x28')](respondWithResult(_0x52859a,0xc9))['catch'](handleError(_0x52859a,null));};exports[_0xffcb('0x4b')]=function(_0x292ce3,_0x5d6981){if(_0x292ce3[_0xffcb('0x4a')]['id']){delete _0x292ce3[_0xffcb('0x4a')]['id'];}return db['ServicenowAccount'][_0xffcb('0x4c')]({'where':{'id':_0x292ce3[_0xffcb('0x48')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x5d6981,null))['then'](saveUpdates(_0x292ce3[_0xffcb('0x4a')],null))['then'](respondWithResult(_0x5d6981,null))[_0xffcb('0x46')](handleError(_0x5d6981,null));};exports['destroy']=function(_0x327aa0,_0x42c65e){return db[_0xffcb('0x42')][_0xffcb('0x4c')]({'where':{'id':_0x327aa0[_0xffcb('0x48')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x42c65e,null))[_0xffcb('0x28')](removeEntity(_0x42c65e,null))[_0xffcb('0x46')](handleError(_0x42c65e,null));};exports['getConfigurations']=function(_0x4c6bb4,_0x49634a,_0x25ef51){var _0x52fee7={};var _0x205ec7={};var _0x49f1e4;var _0x2658bb;return db['ServicenowAccount'][_0xffcb('0x4d')]({'where':{'id':_0x4c6bb4[_0xffcb('0x48')]['id']}})['then'](handleEntityNotFound(_0x49634a,null))[_0xffcb('0x28')](function(_0x218418){if(_0x218418){_0x49f1e4=_0x218418;_0x205ec7[_0xffcb('0x30')]=_[_0xffcb('0x32')](db[_0xffcb('0x4e')]['rawAttributes']);_0x205ec7[_0xffcb('0x31')]=_[_0xffcb('0x32')](_0x4c6bb4[_0xffcb('0x31')]);_0x205ec7['filters']=_['intersection'](_0x205ec7[_0xffcb('0x30')],_0x205ec7[_0xffcb('0x31')]);_0x52fee7[_0xffcb('0x34')]=_['intersection'](_0x205ec7['model'],qs[_0xffcb('0x35')](_0x4c6bb4[_0xffcb('0x31')]['fields']));_0x52fee7[_0xffcb('0x34')]=_0x52fee7[_0xffcb('0x34')]['length']?_0x52fee7[_0xffcb('0x34')]:_0x205ec7[_0xffcb('0x30')];_0x52fee7[_0xffcb('0x39')]=qs[_0xffcb('0x3a')](_0x4c6bb4[_0xffcb('0x31')][_0xffcb('0x3a')]);_0x52fee7[_0xffcb('0x41')]=qs[_0xffcb('0x3b')](_[_0xffcb('0x3c')](_0x4c6bb4[_0xffcb('0x31')],_0x205ec7[_0xffcb('0x3b')]));if(_0x4c6bb4['query'][_0xffcb('0x3d')]){_0x52fee7['where']=_['merge'](_0x52fee7[_0xffcb('0x41')],{'$or':_[_0xffcb('0x4f')](_0x52fee7[_0xffcb('0x34')],function(_0xc6e3dd){var _0x14128f={};_0x14128f[_0xc6e3dd]={'$like':'%'+_0x4c6bb4[_0xffcb('0x31')]['filter']+'%'};return _0x14128f;})});}_0x52fee7=_['merge']({},_0x52fee7,_0x4c6bb4[_0xffcb('0x40')]);return _0x49f1e4[_0xffcb('0x50')](_0x52fee7);}})[_0xffcb('0x28')](function(_0x432088){if(_0x432088){_0x2658bb=_0x432088[_0xffcb('0x36')];if(!_0x4c6bb4['query'][_0xffcb('0x37')](_0xffcb('0x38'))){_0x52fee7[_0xffcb('0x21')]=qs['limit'](_0x4c6bb4[_0xffcb('0x31')][_0xffcb('0x21')]);_0x52fee7[_0xffcb('0x1f')]=qs[_0xffcb('0x1f')](_0x4c6bb4[_0xffcb('0x31')]['offset']);}return _0x49f1e4[_0xffcb('0x50')](_0x52fee7);}})['then'](function(_0x298c80){if(_0x298c80){return _0x298c80?{'count':_0x2658bb,'rows':_0x298c80}:null;}})[_0xffcb('0x28')](respondWithResult(_0x49634a,null))[_0xffcb('0x46')](handleError(_0x49634a,null));};exports[_0xffcb('0x51')]=function(_0xd9c379,_0x2f3277,_0x4a70aa){if(_0xd9c379['body']['id']){delete _0xd9c379['body']['id'];}return db[_0xffcb('0x42')][_0xffcb('0x4d')]({'where':{'id':_0xd9c379[_0xffcb('0x48')]['id']}})[_0xffcb('0x28')](handleEntityNotFound(_0x2f3277,null))[_0xffcb('0x28')](function(_0x8d9860){if(_0x8d9860){_0xd9c379[_0xffcb('0x4a')]['AccountId']=_0x8d9860['id'];_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x52')]=integrations[_0xffcb('0x53')](_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x54')],_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x2f')]);_0xd9c379[_0xffcb('0x4a')]['Descriptions']=integrations[_0xffcb('0x55')](_0xd9c379[_0xffcb('0x4a')][_0xffcb('0x54')],_0xd9c379[_0xffcb('0x4a')]['type']);return db['ServicenowConfiguration']['create'](_0xd9c379['body'],{'include':[{'model':db['ServicenowField'],'as':_0xffcb('0x52')},{'model':db[_0xffcb('0x56')],'as':_0xffcb('0x57')}]});}return null;})[_0xffcb('0x28')](respondWithResult(_0x2f3277,null))[_0xffcb('0x46')](handleError(_0x2f3277,null));};exports[_0xffcb('0x58')]=function(_0xee26ac,_0x5ceaf8,_0x19ecf8){var _0x46526b=['made_sla',_0xffcb('0x59'),_0xffcb('0x5a'),_0xffcb('0x5b'),_0xffcb('0x5c'),_0xffcb('0x5d'),'incident_state','severity',_0xffcb('0x5e')];var _0x30388d=[_0xffcb('0x5f'),_0xffcb('0x60'),_0xffcb('0x61'),_0xffcb('0x62'),_0xffcb('0x63'),_0xffcb('0x64'),_0xffcb('0x65'),_0xffcb('0x59'),_0xffcb('0x66'),_0xffcb('0x67'),'resolved_by','sys_updated_by',_0xffcb('0x68'),_0xffcb('0x69'),'sys_created_on','sys_domain',_0xffcb('0x6a'),_0xffcb('0x6b'),_0xffcb('0x5a'),_0xffcb('0x39'),_0xffcb('0x6c'),_0xffcb('0x6d'),_0xffcb('0x6e'),_0xffcb('0x6f'),_0xffcb('0x70'),_0xffcb('0x71'),_0xffcb('0x72'),_0xffcb('0x73'),_0xffcb('0x74'),'sys_domain_path',_0xffcb('0x75'),_0xffcb('0x76'),_0xffcb('0x77'),'opened_at',_0xffcb('0x78'),_0xffcb('0x79'),_0xffcb('0x7a'),'reopened_time',_0xffcb('0x7b'),_0xffcb('0x7c'),_0xffcb('0x7d'),'subcategory',_0xffcb('0x7e'),'short_description',_0xffcb('0x5c'),'correlation_display',_0xffcb('0x7f'),_0xffcb('0x80'),_0xffcb('0x81'),_0xffcb('0x82'),'additional_assignee_list',_0xffcb('0x83'),_0xffcb('0x84'),'notify',_0xffcb('0x85'),_0xffcb('0x86'),_0xffcb('0x87'),_0xffcb('0x88'),'parent_incident','sys_id','contact_type',_0xffcb('0x89'),_0xffcb('0x8a'),_0xffcb('0x8b'),_0xffcb('0x8c'),_0xffcb('0x8d'),'reassignment_count',_0xffcb('0x8e'),_0xffcb('0x8f'),_0xffcb('0x90'),_0xffcb('0x91'),'sla_due',_0xffcb('0x92'),_0xffcb('0x93'),_0xffcb('0x94'),'sys_mod_count','reopen_count',_0xffcb('0x95'),_0xffcb('0x96'),_0xffcb('0x97'),'correlation_id',_0xffcb('0x98'),_0xffcb('0x5e')];var _0x4ad487='';var _0x22d082='';var _0x259a77=[];var _0x3f179b='';var _0x330aa9='';var _0x2fde45=[];var _0x337a2c='';var _0x44a8d6='';var _0x5a387b={};var _0x1d952b='';return db[_0xffcb('0x42')][_0xffcb('0x4d')]({'where':{'id':_0xee26ac[_0xffcb('0x48')]['id']},'attributes':['id',_0xffcb('0x99'),_0xffcb('0x9a'),_0xffcb('0x9b'),'remoteUri','serverUrl']})[_0xffcb('0x28')](handleEntityNotFound(_0x5ceaf8,null))[_0xffcb('0x28')](function(_0x575757){if(_0x575757){_0x1d952b=_0x575757['remoteUri'];var _0x4a003e=_0x1d952b[_0xffcb('0x9c')](-0x1);if(_0x4a003e==='/'){_0x1d952b=_0x1d952b[_0xffcb('0x9d')](0x0,_0x1d952b[_0xffcb('0x9e')](_0x4a003e));}_0x44a8d6=util['format']('%s/api/now/doc/table/schema/',_0x1d952b);_0x337a2c=util['format'](_0xffcb('0x9f'),_0x1d952b);_0x5a387b={'user':_0x575757[_0xffcb('0x99')],'pass':_0x575757[_0xffcb('0x9a')]};var _0x5f5718={'method':_0xffcb('0xa0'),'uri':_0x44a8d6+_0xffcb('0xa1'),'auth':_0x5a387b,'json':!![]};return rp(_0x5f5718);}})['then'](function(_0x2656c0){if(_0x2656c0['result'][_0xffcb('0x36')]>0x0){_0x4ad487=_0x2656c0[_0xffcb('0xa2')];}console['log'](_0xffcb('0xa3'),_0x4ad487);_0x2fde45=[];_0x22d082=Object[_0xffcb('0xa4')]([],_0x4ad487);_['remove'](_0x22d082,function(_0x45d717){return!_0x46526b[_0xffcb('0xa5')](_0x45d717[_0xffcb('0x2b')]);});_0x22d082[_0xffcb('0xa6')](function(_0x250416){var _0xfa9d2e=createFieldObject(_0x337a2c,_0x5a387b,_0x250416['internalType'],_0x250416[_0xffcb('0x2b')],_0x250416[_0xffcb('0xa7')],![]);_0x2fde45['push'](_0xfa9d2e);});return Promise[_0xffcb('0xa8')](_0x2fde45);})[_0xffcb('0x28')](function(_0x18b37f){_0x259a77=_0x18b37f;_0x3f179b=Object[_0xffcb('0xa4')]([],_0x4ad487);console[_0xffcb('0xa9')](_0xffcb('0xaa'),_0x4ad487);_[_0xffcb('0xab')](_0x3f179b,function(_0x4959b6){return _0x30388d[_0xffcb('0xa5')](_0x4959b6[_0xffcb('0x2b')]);});console[_0xffcb('0xa9')](_0xffcb('0xac'),_0x3f179b);_0x2fde45=[];_0x3f179b['forEach'](function(_0x5c7ac2){var _0x367bca=createFieldObject(_0x337a2c,_0x5a387b,_0x5c7ac2[_0xffcb('0xad')],_0x5c7ac2[_0xffcb('0x2b')],_0x5c7ac2[_0xffcb('0xa7')],!![]);_0x2fde45[_0xffcb('0xae')](_0x367bca);});return Promise['all'](_0x2fde45);})[_0xffcb('0x28')](function(_0x4f2711){_0x330aa9=_0x4f2711;var _0x5ed5df=_0x259a77[_0xffcb('0xaf')](_0x330aa9);return{'count':_0x5ed5df[_0xffcb('0x36')],'rows':_0x5ed5df};})['then'](respondWithResult(_0x5ceaf8,null))[_0xffcb('0x46')](function(_0x3b7a6d){console[_0xffcb('0xa9')](_0xffcb('0xb0')+_0x3b7a6d);var _0x1fda9e=_0xee26ac[_0xffcb('0x31')]['test']?0x1f4:_0x3b7a6d['statusCode']||0x1f4;logger['error'](_0x3b7a6d[_0xffcb('0xb1')]);delete _0x3b7a6d[_0xffcb('0x2b')];if(_0x1fda9e===0x191){_0x1fda9e=0x190;}_0x5ceaf8[_0xffcb('0x1d')](_0x1fda9e)['send'](_0xee26ac[_0xffcb('0x31')][_0xffcb('0xb2')]?{'message':_0xffcb('0xb3'),'statusCode':_0x3b7a6d['statusCode']}:_0x3b7a6d);});};function createFieldObject(_0x46976f,_0x1cfee6,_0x47c0e7,_0x1404a6,_0x5730a3,_0x124385){return new Promise(function(_0x2b38df,_0x5937bc){var _0x4383aa={'id':_0x1404a6,'name':_0x5730a3,'custom':_0x124385};if(_0x47c0e7===_0xffcb('0xb4')){_0x4383aa[_0xffcb('0x40')]=[{'name':_0xffcb('0xb5'),'value':_0xffcb('0xb6')},{'name':'False','value':_0xffcb('0xb7')}];_0x2b38df(_0x4383aa);}else{var _0x4d3da5={'method':_0xffcb('0xa0'),'uri':_0x46976f+_0xffcb('0xb8')+_0x1404a6,'auth':_0x1cfee6,'json':!![]};return rp(_0x4d3da5)['then'](function(_0x11ce4e){var _0xd50ee8=[];if(_0x11ce4e[_0xffcb('0xa2')]['length']>0x0){_0x11ce4e[_0xffcb('0xa2')][_0xffcb('0xa6')](function(_0x40dbda){if(_0x40dbda[_0xffcb('0xb9')]===_0xffcb('0xb7')){var _0x38359a={'name':_0x40dbda[_0xffcb('0xa7')],'value':_0x40dbda['value']};_0xd50ee8[_0xffcb('0xae')](_0x38359a);}});}_0x4383aa[_0xffcb('0x40')]=_0xd50ee8;if(_0x4383aa[_0xffcb('0x40')][_0xffcb('0x36')]>0x0){_0x2b38df(_0x4383aa);}else{if(_0x124385==![]){_0x2b38df();}else{_0x2b38df(_0x4383aa);}}});}});} \ No newline at end of file +var _0x485f=['moment','mustache','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/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','save','update','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','ServicenowAccount','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','ServicenowConfiguration','options','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','hold_reason','knowledge','subcategory','close_code','notify','severity','category','made_sla','caused_by','watch_list','upon_reject','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x485f,0x177));var _0xf485=function(_0x289e48,_0x2fe387){_0x289e48=_0x289e48-0x0;var _0x56d497=_0x485f[_0x289e48];return _0x56d497;};'use strict';var emlformat=require(_0xf485('0x0'));var rimraf=require(_0xf485('0x1'));var zipdir=require(_0xf485('0x2'));var jsonpatch=require(_0xf485('0x3'));var rp=require(_0xf485('0x4'));var moment=require(_0xf485('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf485('0x6'));var util=require('util');var path=require(_0xf485('0x7'));var sox=require(_0xf485('0x8'));var csv=require(_0xf485('0x9'));var ejs=require(_0xf485('0xa'));var fs=require('fs');var fs_extra=require(_0xf485('0xb'));var _=require(_0xf485('0xc'));var squel=require(_0xf485('0xd'));var crypto=require(_0xf485('0xe'));var jsforce=require(_0xf485('0xf'));var deskjs=require(_0xf485('0x10'));var toCsv=require(_0xf485('0x9'));var querystring=require('querystring');var Papa=require(_0xf485('0x11'));var Redis=require(_0xf485('0x12'));var authService=require(_0xf485('0x13'));var qs=require(_0xf485('0x14'));var as=require(_0xf485('0x15'));var hardwareService=require(_0xf485('0x16'));var logger=require(_0xf485('0x17'))(_0xf485('0x18'));var utils=require('../../config/utils');var config=require(_0xf485('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf485('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c4825,_0x3957d7){_0x3957d7=_0x3957d7||0xcc;return function(_0x82d4d){if(_0x82d4d){return _0x3c4825[_0xf485('0x1b')](_0x3957d7);}return _0x3c4825[_0xf485('0x1c')](_0x3957d7)['end']();};}function respondWithResult(_0xeb56db,_0x39e631){_0x39e631=_0x39e631||0xc8;return function(_0x15a403){if(_0x15a403){return _0xeb56db[_0xf485('0x1c')](_0x39e631)['json'](_0x15a403);}};}function respondWithFilteredResult(_0xfb797f,_0x18fbe1){return function(_0x14b26a){if(_0x14b26a){var _0x4f6d91=typeof _0x18fbe1[_0xf485('0x1d')]===_0xf485('0x1e')&&typeof _0x18fbe1[_0xf485('0x1f')]===_0xf485('0x1e');var _0x1606ca=_0x14b26a[_0xf485('0x20')];var _0x1cdedc=_0x4f6d91?0x0:_0x18fbe1[_0xf485('0x1d')];var _0x59f179=_0x4f6d91?_0x14b26a[_0xf485('0x20')]:_0x18fbe1[_0xf485('0x1d')]+_0x18fbe1['limit'];var _0x39586b;if(_0x59f179>=_0x1606ca){_0x59f179=_0x1606ca;_0x39586b=0xc8;}else{_0x39586b=0xce;}_0xfb797f[_0xf485('0x1c')](_0x39586b);return _0xfb797f[_0xf485('0x21')]('Content-Range',_0x1cdedc+'-'+_0x59f179+'/'+_0x1606ca)[_0xf485('0x22')](_0x14b26a);}return null;};}function patchUpdates(_0x114694){return function(_0x59ddae){try{jsonpatch['apply'](_0x59ddae,_0x114694,!![]);}catch(_0x29980a){return BPromise['reject'](_0x29980a);}return _0x59ddae[_0xf485('0x23')]();};}function saveUpdates(_0x1f688e,_0x3e5b1d){return function(_0x4afa62){if(_0x4afa62){return _0x4afa62[_0xf485('0x24')](_0x1f688e)['then'](function(_0x460c43){return _0x460c43;});}return null;};}function removeEntity(_0x2cedf9,_0x55a002){return function(_0x4b6c03){if(_0x4b6c03){return _0x4b6c03[_0xf485('0x25')]()['then'](function(){_0x2cedf9[_0xf485('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b7ee,_0x270b3f){return function(_0x1796eb){if(!_0x1796eb){_0x49b7ee['sendStatus'](0x194);}return _0x1796eb;};}function handleError(_0x59e391,_0x1bcf12){_0x1bcf12=_0x1bcf12||0x1f4;return function(_0x569ea4){logger[_0xf485('0x26')](_0x569ea4[_0xf485('0x27')]);if(_0x569ea4[_0xf485('0x28')]){delete _0x569ea4[_0xf485('0x28')];}_0x59e391[_0xf485('0x1c')](_0x1bcf12)[_0xf485('0x29')](_0x569ea4);};}exports[_0xf485('0x2a')]=function(_0x10acdd,_0x359155){var _0x31baa3={},_0x40685c={},_0x545517={'count':0x0,'rows':[]};var _0x1a051c=_[_0xf485('0x2b')](db['ServicenowAccount']['rawAttributes'],function(_0x6225b2){return{'name':_0x6225b2[_0xf485('0x2c')],'type':_0x6225b2[_0xf485('0x2d')][_0xf485('0x2e')]};});_0x40685c[_0xf485('0x2f')]=_['map'](_0x1a051c,_0xf485('0x28'));_0x40685c[_0xf485('0x30')]=_[_0xf485('0x31')](_0x10acdd[_0xf485('0x30')]);_0x40685c[_0xf485('0x32')]=_[_0xf485('0x33')](_0x40685c[_0xf485('0x2f')],_0x40685c['query']);_0x31baa3[_0xf485('0x34')]=_['intersection'](_0x40685c[_0xf485('0x2f')],qs[_0xf485('0x35')](_0x10acdd[_0xf485('0x30')][_0xf485('0x35')]));_0x31baa3[_0xf485('0x34')]=_0x31baa3[_0xf485('0x34')][_0xf485('0x36')]?_0x31baa3[_0xf485('0x34')]:_0x40685c['model'];if(!_0x10acdd[_0xf485('0x30')][_0xf485('0x37')]('nolimit')){_0x31baa3['limit']=qs[_0xf485('0x1f')](_0x10acdd[_0xf485('0x30')][_0xf485('0x1f')]);_0x31baa3[_0xf485('0x1d')]=qs['offset'](_0x10acdd['query']['offset']);}_0x31baa3[_0xf485('0x38')]=qs[_0xf485('0x39')](_0x10acdd[_0xf485('0x30')][_0xf485('0x39')]);_0x31baa3['where']=qs[_0xf485('0x32')](_[_0xf485('0x3a')](_0x10acdd[_0xf485('0x30')],_0x40685c[_0xf485('0x32')]),_0x1a051c);if(_0x10acdd['query']['filter']){_0x31baa3[_0xf485('0x3b')]=_[_0xf485('0x3c')](_0x31baa3[_0xf485('0x3b')],{'$or':_[_0xf485('0x2b')](_0x1a051c,function(_0x585d3c){if(_0x585d3c[_0xf485('0x2d')]!==_0xf485('0x3d')){var _0x4c3359={};_0x4c3359[_0x585d3c[_0xf485('0x28')]]={'$like':'%'+_0x10acdd[_0xf485('0x30')]['filter']+'%'};return _0x4c3359;}})});}_0x31baa3=_[_0xf485('0x3c')]({},_0x31baa3,_0x10acdd['options']);var _0x5a7c33={'where':_0x31baa3[_0xf485('0x3b')]};return db[_0xf485('0x3e')][_0xf485('0x20')](_0x5a7c33)[_0xf485('0x3f')](function(_0x453418){_0x545517[_0xf485('0x20')]=_0x453418;if(_0x10acdd[_0xf485('0x30')]['includeAll']){_0x31baa3[_0xf485('0x40')]=[{'all':!![]}];}return db[_0xf485('0x3e')][_0xf485('0x41')](_0x31baa3);})[_0xf485('0x3f')](function(_0x1a89d1){_0x545517[_0xf485('0x42')]=_0x1a89d1;return _0x545517;})[_0xf485('0x3f')](respondWithFilteredResult(_0x359155,_0x31baa3))[_0xf485('0x43')](handleError(_0x359155,null));};exports[_0xf485('0x44')]=function(_0x5e04d7,_0x43cb60){var _0x5a10df={'raw':![],'where':{'id':_0x5e04d7[_0xf485('0x45')]['id']}},_0xc4204e={};_0xc4204e['model']=_[_0xf485('0x31')](db[_0xf485('0x3e')][_0xf485('0x46')]);_0xc4204e[_0xf485('0x30')]=_['keys'](_0x5e04d7[_0xf485('0x30')]);_0xc4204e['filters']=_['intersection'](_0xc4204e[_0xf485('0x2f')],_0xc4204e[_0xf485('0x30')]);_0x5a10df[_0xf485('0x34')]=_[_0xf485('0x33')](_0xc4204e[_0xf485('0x2f')],qs[_0xf485('0x35')](_0x5e04d7[_0xf485('0x30')]['fields']));_0x5a10df[_0xf485('0x34')]=_0x5a10df['attributes'][_0xf485('0x36')]?_0x5a10df[_0xf485('0x34')]:_0xc4204e[_0xf485('0x2f')];if(_0x5e04d7[_0xf485('0x30')][_0xf485('0x47')]){_0x5a10df['include']=[{'all':!![]}];}_0x5a10df=_[_0xf485('0x3c')]({},_0x5a10df,_0x5e04d7['options']);return db[_0xf485('0x3e')][_0xf485('0x48')](_0x5a10df)[_0xf485('0x3f')](handleEntityNotFound(_0x43cb60,null))[_0xf485('0x3f')](respondWithResult(_0x43cb60,null))[_0xf485('0x43')](handleError(_0x43cb60,null));};exports[_0xf485('0x49')]=function(_0x572837,_0xc59acd){return db['ServicenowAccount']['create'](_0x572837[_0xf485('0x4a')],{})[_0xf485('0x3f')](respondWithResult(_0xc59acd,0xc9))['catch'](handleError(_0xc59acd,null));};exports[_0xf485('0x24')]=function(_0x583857,_0x23e173){if(_0x583857['body']['id']){delete _0x583857[_0xf485('0x4a')]['id'];}return db['ServicenowAccount'][_0xf485('0x48')]({'where':{'id':_0x583857[_0xf485('0x45')]['id']}})[_0xf485('0x3f')](handleEntityNotFound(_0x23e173,null))[_0xf485('0x3f')](saveUpdates(_0x583857[_0xf485('0x4a')],null))[_0xf485('0x3f')](respondWithResult(_0x23e173,null))[_0xf485('0x43')](handleError(_0x23e173,null));};exports[_0xf485('0x25')]=function(_0x3956cc,_0x134c74){return db['ServicenowAccount'][_0xf485('0x48')]({'where':{'id':_0x3956cc['params']['id']}})['then'](handleEntityNotFound(_0x134c74,null))[_0xf485('0x3f')](removeEntity(_0x134c74,null))[_0xf485('0x43')](handleError(_0x134c74,null));};exports[_0xf485('0x4b')]=function(_0x176d00,_0x52ca8f,_0x23eed4){var _0x22c9d0={};var _0x2e15ad={};var _0x3aecb1;var _0x358f25;return db['ServicenowAccount']['findOne']({'where':{'id':_0x176d00[_0xf485('0x45')]['id']}})['then'](handleEntityNotFound(_0x52ca8f,null))[_0xf485('0x3f')](function(_0x23e0bf){if(_0x23e0bf){_0x3aecb1=_0x23e0bf;_0x2e15ad[_0xf485('0x2f')]=_[_0xf485('0x31')](db[_0xf485('0x4c')]['rawAttributes']);_0x2e15ad['query']=_[_0xf485('0x31')](_0x176d00[_0xf485('0x30')]);_0x2e15ad['filters']=_[_0xf485('0x33')](_0x2e15ad[_0xf485('0x2f')],_0x2e15ad[_0xf485('0x30')]);_0x22c9d0[_0xf485('0x34')]=_[_0xf485('0x33')](_0x2e15ad[_0xf485('0x2f')],qs[_0xf485('0x35')](_0x176d00['query'][_0xf485('0x35')]));_0x22c9d0['attributes']=_0x22c9d0['attributes'][_0xf485('0x36')]?_0x22c9d0[_0xf485('0x34')]:_0x2e15ad['model'];_0x22c9d0['order']=qs[_0xf485('0x39')](_0x176d00[_0xf485('0x30')]['sort']);_0x22c9d0[_0xf485('0x3b')]=qs[_0xf485('0x32')](_[_0xf485('0x3a')](_0x176d00[_0xf485('0x30')],_0x2e15ad[_0xf485('0x32')]));if(_0x176d00[_0xf485('0x30')]['filter']){_0x22c9d0['where']=_[_0xf485('0x3c')](_0x22c9d0[_0xf485('0x3b')],{'$or':_[_0xf485('0x2b')](_0x22c9d0[_0xf485('0x34')],function(_0x4c1cf4){var _0x3381f3={};_0x3381f3[_0x4c1cf4]={'$like':'%'+_0x176d00[_0xf485('0x30')]['filter']+'%'};return _0x3381f3;})});}_0x22c9d0=_[_0xf485('0x3c')]({},_0x22c9d0,_0x176d00[_0xf485('0x4d')]);return _0x3aecb1[_0xf485('0x4b')](_0x22c9d0);}})[_0xf485('0x3f')](function(_0x32d567){if(_0x32d567){_0x358f25=_0x32d567['length'];if(!_0x176d00[_0xf485('0x30')][_0xf485('0x37')](_0xf485('0x4e'))){_0x22c9d0[_0xf485('0x1f')]=qs[_0xf485('0x1f')](_0x176d00[_0xf485('0x30')][_0xf485('0x1f')]);_0x22c9d0[_0xf485('0x1d')]=qs[_0xf485('0x1d')](_0x176d00[_0xf485('0x30')][_0xf485('0x1d')]);}return _0x3aecb1[_0xf485('0x4b')](_0x22c9d0);}})['then'](function(_0x135c28){if(_0x135c28){return _0x135c28?{'count':_0x358f25,'rows':_0x135c28}:null;}})[_0xf485('0x3f')](respondWithResult(_0x52ca8f,null))[_0xf485('0x43')](handleError(_0x52ca8f,null));};exports[_0xf485('0x4f')]=function(_0x9c97ab,_0x48ab08,_0x33fe65){if(_0x9c97ab[_0xf485('0x4a')]['id']){delete _0x9c97ab[_0xf485('0x4a')]['id'];}return db[_0xf485('0x3e')][_0xf485('0x50')]({'where':{'id':_0x9c97ab[_0xf485('0x45')]['id']}})['then'](handleEntityNotFound(_0x48ab08,null))[_0xf485('0x3f')](function(_0x781776){if(_0x781776){_0x9c97ab[_0xf485('0x4a')][_0xf485('0x51')]=_0x781776['id'];_0x9c97ab['body'][_0xf485('0x52')]=integrations[_0xf485('0x53')](_0x9c97ab[_0xf485('0x4a')][_0xf485('0x54')],_0x9c97ab['body']['type']);_0x9c97ab[_0xf485('0x4a')][_0xf485('0x55')]=integrations[_0xf485('0x56')](_0x9c97ab[_0xf485('0x4a')][_0xf485('0x54')],_0x9c97ab[_0xf485('0x4a')][_0xf485('0x2d')]);return db[_0xf485('0x4c')]['create'](_0x9c97ab['body'],{'include':[{'model':db[_0xf485('0x57')],'as':_0xf485('0x52')},{'model':db['ServicenowField'],'as':_0xf485('0x55')}]});}return null;})['then'](respondWithResult(_0x48ab08,null))[_0xf485('0x43')](handleError(_0x48ab08,null));};exports['getFields']=function(_0x44f502,_0x5f3201,_0x4e49ca){var _0x3dc120=['made_sla',_0xf485('0x58'),_0xf485('0x59'),_0xf485('0x5a'),_0xf485('0x5b'),_0xf485('0x5c'),'incident_state',_0xf485('0x5d'),_0xf485('0x5e')];var _0x266e0b=['parent',_0xf485('0x5f'),_0xf485('0x60'),_0xf485('0x61'),_0xf485('0x62'),'sys_updated_on','child_incidents','hold_reason','approval_history',_0xf485('0x63'),_0xf485('0x64'),_0xf485('0x65'),_0xf485('0x66'),_0xf485('0x67'),_0xf485('0x68'),_0xf485('0x69'),_0xf485('0x6a'),_0xf485('0x6b'),'knowledge','order','calendar_stc',_0xf485('0x6c'),_0xf485('0x6d'),'delivery_plan','impact',_0xf485('0x6e'),'work_notes_list',_0xf485('0x6f'),_0xf485('0x70'),_0xf485('0x71'),_0xf485('0x72'),_0xf485('0x73'),_0xf485('0x74'),_0xf485('0x75'),_0xf485('0x76'),_0xf485('0x77'),_0xf485('0x78'),_0xf485('0x79'),_0xf485('0x7a'),_0xf485('0x7b'),'approval_set',_0xf485('0x5a'),'work_notes','short_description','close_code',_0xf485('0x7c'),_0xf485('0x7d'),_0xf485('0x7e'),_0xf485('0x7f'),_0xf485('0x80'),_0xf485('0x81'),_0xf485('0x82'),_0xf485('0x83'),_0xf485('0x5c'),_0xf485('0x84'),_0xf485('0x85'),_0xf485('0x86'),_0xf485('0x87'),_0xf485('0x88'),_0xf485('0x89'),_0xf485('0x8a'),_0xf485('0x8b'),'incident_state',_0xf485('0x8c'),_0xf485('0x8d'),_0xf485('0x8e'),_0xf485('0x8f'),_0xf485('0x90'),_0xf485('0x91'),_0xf485('0x5d'),_0xf485('0x92'),_0xf485('0x93'),_0xf485('0x94'),_0xf485('0x95'),_0xf485('0x96'),_0xf485('0x97'),_0xf485('0x98'),_0xf485('0x99'),_0xf485('0x9a'),_0xf485('0x9b'),_0xf485('0x9c'),_0xf485('0x9d'),_0xf485('0x5e')];var _0x4b12fa='';var _0x46bf7e='';var _0x1c53d9=[];var _0x34c35d='';var _0x522d42='';var _0x22d10b=[];var _0x1c8b01='';var _0x1b3c0a='';var _0x345594={};var _0x433a7f='';return db['ServicenowAccount'][_0xf485('0x50')]({'where':{'id':_0x44f502['params']['id']},'attributes':['id',_0xf485('0x9e'),'password',_0xf485('0x9f'),_0xf485('0xa0'),_0xf485('0xa1')]})[_0xf485('0x3f')](handleEntityNotFound(_0x5f3201,null))[_0xf485('0x3f')](function(_0x1ca526){if(_0x1ca526){_0x433a7f=_0x1ca526[_0xf485('0xa0')];var _0x53bfef=_0x433a7f[_0xf485('0xa2')](-0x1);if(_0x53bfef==='/'){_0x433a7f=_0x433a7f['substring'](0x0,_0x433a7f[_0xf485('0xa3')](_0x53bfef));}_0x1b3c0a=util[_0xf485('0xa4')](_0xf485('0xa5'),_0x433a7f);_0x1c8b01=util[_0xf485('0xa4')](_0xf485('0xa6'),_0x433a7f);_0x345594={'user':_0x1ca526[_0xf485('0x9e')],'pass':_0x1ca526[_0xf485('0xa7')]};var _0x58f2e5={'method':'GET','uri':_0x1b3c0a+_0xf485('0xa8'),'auth':_0x345594,'json':!![]};return rp(_0x58f2e5);}})['then'](function(_0x581c77){if(_0x581c77[_0xf485('0xa9')][_0xf485('0x36')]>0x0){_0x4b12fa=_0x581c77[_0xf485('0xa9')];}console[_0xf485('0xaa')](_0xf485('0xab'),_0x4b12fa);_0x22d10b=[];_0x46bf7e=Object[_0xf485('0xac')]([],_0x4b12fa);_[_0xf485('0xad')](_0x46bf7e,function(_0x4db3a3){return!_0x3dc120[_0xf485('0xae')](_0x4db3a3['name']);});_0x46bf7e['forEach'](function(_0x3eb161){var _0x2545f4=createFieldObject(_0x1c8b01,_0x345594,_0x3eb161[_0xf485('0xaf')],_0x3eb161[_0xf485('0x28')],_0x3eb161['label'],![]);_0x22d10b[_0xf485('0xb0')](_0x2545f4);});return Promise[_0xf485('0xb1')](_0x22d10b);})[_0xf485('0x3f')](function(_0x55b271){_0x1c53d9=_0x55b271;_0x34c35d=Object['assign']([],_0x4b12fa);console[_0xf485('0xaa')](_0xf485('0xb2'),_0x4b12fa);_[_0xf485('0xad')](_0x34c35d,function(_0x169d16){return _0x266e0b[_0xf485('0xae')](_0x169d16[_0xf485('0x28')]);});console[_0xf485('0xaa')](_0xf485('0xb3'),_0x34c35d);_0x22d10b=[];_0x34c35d[_0xf485('0xb4')](function(_0x3de50e){var _0x381fbb=createFieldObject(_0x1c8b01,_0x345594,_0x3de50e[_0xf485('0xaf')],_0x3de50e[_0xf485('0x28')],_0x3de50e['label'],!![]);_0x22d10b['push'](_0x381fbb);});return Promise['all'](_0x22d10b);})['then'](function(_0x47d085){_0x522d42=_0x47d085;var _0x226d69=_0x1c53d9[_0xf485('0xb5')](_0x522d42);return{'count':_0x226d69[_0xf485('0x36')],'rows':_0x226d69};})['then'](respondWithResult(_0x5f3201,null))['catch'](function(_0x233108){console[_0xf485('0xaa')](_0xf485('0xb6')+_0x233108);var _0x14b313=_0x44f502[_0xf485('0x30')][_0xf485('0xb7')]?0x1f4:_0x233108[_0xf485('0xb8')]||0x1f4;logger[_0xf485('0x26')](_0x233108[_0xf485('0x27')]);delete _0x233108[_0xf485('0x28')];if(_0x14b313===0x191){_0x14b313=0x190;}_0x5f3201[_0xf485('0x1c')](_0x14b313)[_0xf485('0x29')](_0x44f502[_0xf485('0x30')][_0xf485('0xb7')]?{'message':'Wrong\x20credentials','statusCode':_0x233108[_0xf485('0xb8')]}:_0x233108);});};function createFieldObject(_0x49afe4,_0x48f2ec,_0x315749,_0x5f1ba8,_0x4ebbbf,_0x38b253){return new Promise(function(_0x184755,_0xa13d1e){var _0x5c8c88={'id':_0x5f1ba8,'name':_0x4ebbbf,'custom':_0x38b253};if(_0x315749===_0xf485('0xb9')){_0x5c8c88['options']=[{'name':_0xf485('0xba'),'value':'true'},{'name':'False','value':_0xf485('0xbb')}];_0x184755(_0x5c8c88);}else{var _0x5517fd={'method':'GET','uri':_0x49afe4+'sys_choice?sysparm_query=name=incident^element='+_0x5f1ba8,'auth':_0x48f2ec,'json':!![]};return rp(_0x5517fd)[_0xf485('0x3f')](function(_0x4d215c){var _0x1046a1=[];if(_0x4d215c['result'][_0xf485('0x36')]>0x0){_0x4d215c[_0xf485('0xa9')][_0xf485('0xb4')](function(_0x5da5a0){if(_0x5da5a0[_0xf485('0xbc')]===_0xf485('0xbb')){var _0xd1ccf5={'name':_0x5da5a0['label'],'value':_0x5da5a0[_0xf485('0xbd')]};_0x1046a1[_0xf485('0xb0')](_0xd1ccf5);}});}_0x5c8c88['options']=_0x1046a1;if(_0x5c8c88[_0xf485('0x4d')][_0xf485('0x36')]>0x0){_0x184755(_0x5c8c88);}else{if(_0x38b253==![]){_0x184755();}else{_0x184755(_0x5c8c88);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ecae5f7..7eb18e8 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 _0xc1c6=['rimraf','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x450d2d,_0x197f8b){var _0x36fdb4=function(_0x192953){while(--_0x192953){_0x450d2d['push'](_0x450d2d['shift']());}};_0x36fdb4(++_0x197f8b);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x6a2898,_0x35e341){_0x6a2898=_0x6a2898-0x0;var _0x3a9612=_0xc1c6[_0x6a2898];return _0x3a9612;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf494,0x1c6));var _0x4f49=function(_0x5b55c7,_0x15d300){_0x5b55c7=_0x5b55c7-0x0;var _0x4a0dc4=_0xf494[_0x5b55c7];return _0x4a0dc4;};'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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7156888..8649e82 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 _0xa464=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowServicenowAccount','lodash','moment','bluebird','randomstring'];(function(_0x1335c9,_0xfa13d6){var _0x527653=function(_0x4c61ef){while(--_0x4c61ef){_0x1335c9['push'](_0x1335c9['shift']());}};_0x527653(++_0xfa13d6);}(_0xa464,0xab));var _0x4a46=function(_0x4db561,_0x521d0d){_0x4db561=_0x4db561-0x0;var _0x299980=_0xa464[_0x4db561];return _0x299980;};'use strict';var _=require(_0x4a46('0x0'));var util=require('util');var moment=require(_0x4a46('0x1'));var BPromise=require(_0x4a46('0x2'));var rs=require(_0x4a46('0x3'));var fs=require('fs');var Redis=require(_0x4a46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a46('0x5'));var logger=require(_0x4a46('0x6'))(_0x4a46('0x7'));var config=require(_0x4a46('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4a46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54b32b,_0x104a29,_0xb3d72e){return new BPromise(function(_0x598714,_0x50ab15){return client[_0x4a46('0xa')](_0x54b32b,_0xb3d72e)[_0x4a46('0xb')](function(_0x304de4){logger[_0x4a46('0xc')](_0x4a46('0xd'),_0x104a29,_0x4a46('0xe'));logger[_0x4a46('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x104a29,_0x4a46('0xe'),JSON[_0x4a46('0x10')](_0x304de4));if(_0x304de4[_0x4a46('0x11')]){if(_0x304de4[_0x4a46('0x11')][_0x4a46('0x12')]===0x1f4){logger[_0x4a46('0x11')](_0x4a46('0xd'),_0x104a29,_0x304de4[_0x4a46('0x11')][_0x4a46('0x13')]);return _0x50ab15(_0x304de4[_0x4a46('0x11')][_0x4a46('0x13')]);}logger[_0x4a46('0x11')](_0x4a46('0xd'),_0x104a29,_0x304de4[_0x4a46('0x11')][_0x4a46('0x13')]);return _0x598714(_0x304de4['error'][_0x4a46('0x13')]);}else{logger[_0x4a46('0xc')](_0x4a46('0xd'),_0x104a29,_0x4a46('0xe'));_0x598714(_0x304de4[_0x4a46('0x14')]['message']);}})['catch'](function(_0x41608b){logger[_0x4a46('0x11')](_0x4a46('0xd'),_0x104a29,_0x41608b);_0x50ab15(_0x41608b);});});}exports[_0x4a46('0x15')]=function(_0x485350){var _0x3a1f37=this;return new Promise(function(_0x2e4e60,_0x3fc1ea){return db[_0x4a46('0x16')][_0x4a46('0x17')]({'raw':_0x485350[_0x4a46('0x18')]?_0x485350['options'][_0x4a46('0x19')]===undefined?!![]:![]:!![],'where':_0x485350[_0x4a46('0x18')]?_0x485350[_0x4a46('0x18')]['where']||null:null,'attributes':_0x485350[_0x4a46('0x18')]?_0x485350['options'][_0x4a46('0x1a')]||null:null,'limit':_0x485350[_0x4a46('0x18')]?_0x485350[_0x4a46('0x18')][_0x4a46('0x1b')]||null:null,'include':_0x485350[_0x4a46('0x18')]?_0x485350[_0x4a46('0x18')][_0x4a46('0x1c')]?_[_0x4a46('0x1d')](_0x485350[_0x4a46('0x18')][_0x4a46('0x1c')],function(_0x27ee1b){return{'model':db[_0x27ee1b['model']],'as':_0x27ee1b['as'],'attributes':_0x27ee1b[_0x4a46('0x1a')],'include':_0x27ee1b['include']?_[_0x4a46('0x1d')](_0x27ee1b[_0x4a46('0x1c')],function(_0x3c0548){return{'model':db[_0x3c0548['model']],'as':_0x3c0548['as'],'attributes':_0x3c0548[_0x4a46('0x1a')],'include':_0x3c0548[_0x4a46('0x1c')]?_['map'](_0x3c0548[_0x4a46('0x1c')],function(_0x5a1a97){return{'model':db[_0x5a1a97[_0x4a46('0x1e')]],'as':_0x5a1a97['as'],'attributes':_0x5a1a97[_0x4a46('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4a46('0xb')](function(_0x2e38cb){logger['info'](_0x4a46('0x15'),_0x485350);logger[_0x4a46('0xf')](_0x4a46('0x15'),_0x485350,JSON['stringify'](_0x2e38cb));_0x2e4e60(_0x2e38cb);})[_0x4a46('0x1f')](function(_0x555d7e){logger[_0x4a46('0x11')](_0x4a46('0x15'),_0x555d7e['message'],_0x485350);_0x3fc1ea(_0x3a1f37[_0x4a46('0x11')](0x1f4,_0x555d7e[_0x4a46('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x588f47){var _0x5a9dde=this;return new Promise(function(_0x4d32ae,_0x92e03e){return db[_0x4a46('0x16')][_0x4a46('0x20')]({'raw':_0x588f47[_0x4a46('0x18')]?_0x588f47[_0x4a46('0x18')][_0x4a46('0x19')]===undefined?!![]:![]:!![],'where':_0x588f47['options']?_0x588f47[_0x4a46('0x18')][_0x4a46('0x21')]||null:null,'attributes':_0x588f47[_0x4a46('0x18')]?_0x588f47[_0x4a46('0x18')]['attributes']||null:null,'include':_0x588f47[_0x4a46('0x18')]?_0x588f47[_0x4a46('0x18')]['include']?_[_0x4a46('0x1d')](_0x588f47['options'][_0x4a46('0x1c')],function(_0x12995d){return{'model':db[_0x12995d[_0x4a46('0x1e')]],'as':_0x12995d['as'],'attributes':_0x12995d[_0x4a46('0x1a')],'include':_0x12995d[_0x4a46('0x1c')]?_['map'](_0x12995d[_0x4a46('0x1c')],function(_0x61d743){return{'model':db[_0x61d743[_0x4a46('0x1e')]],'as':_0x61d743['as'],'attributes':_0x61d743[_0x4a46('0x1a')],'include':_0x61d743[_0x4a46('0x1c')]?_[_0x4a46('0x1d')](_0x61d743[_0x4a46('0x1c')],function(_0x55e9f2){return{'model':db[_0x55e9f2[_0x4a46('0x1e')]],'as':_0x55e9f2['as'],'attributes':_0x55e9f2[_0x4a46('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4414bc){logger[_0x4a46('0xc')](_0x4a46('0x22'),_0x588f47);logger[_0x4a46('0xf')]('ShowServicenowAccount',_0x588f47,JSON[_0x4a46('0x10')](_0x4414bc));_0x4d32ae(_0x4414bc);})[_0x4a46('0x1f')](function(_0x351c23){logger[_0x4a46('0x11')](_0x4a46('0x22'),_0x351c23[_0x4a46('0x13')],_0x588f47);_0x92e03e(_0x5a9dde[_0x4a46('0x11')](0x1f4,_0x351c23[_0x4a46('0x13')]));});});}; \ No newline at end of file +var _0xba87=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','ServicenowAccount','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xba87,0xb8));var _0x7ba8=function(_0x11ee99,_0xa743ed){_0x11ee99=_0x11ee99-0x0;var _0x469072=_0xba87[_0x11ee99];return _0x469072;};'use strict';var _=require(_0x7ba8('0x0'));var util=require(_0x7ba8('0x1'));var moment=require(_0x7ba8('0x2'));var BPromise=require(_0x7ba8('0x3'));var rs=require(_0x7ba8('0x4'));var fs=require('fs');var Redis=require(_0x7ba8('0x5'));var db=require(_0x7ba8('0x6'))['db'];var utils=require(_0x7ba8('0x7'));var logger=require(_0x7ba8('0x8'))(_0x7ba8('0x9'));var config=require(_0x7ba8('0xa'));var jayson=require(_0x7ba8('0xb'));var client=jayson[_0x7ba8('0xc')][_0x7ba8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x593213,_0x2cf99d,_0x45daf9){return new BPromise(function(_0x5b244c,_0x234c44){return client['request'](_0x593213,_0x45daf9)[_0x7ba8('0xe')](function(_0x1eb9ee){logger[_0x7ba8('0xf')](_0x7ba8('0x10'),_0x2cf99d,_0x7ba8('0x11'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2cf99d,_0x7ba8('0x11'),JSON[_0x7ba8('0x12')](_0x1eb9ee));if(_0x1eb9ee['error']){if(_0x1eb9ee[_0x7ba8('0x13')][_0x7ba8('0x14')]===0x1f4){logger['error'](_0x7ba8('0x10'),_0x2cf99d,_0x1eb9ee[_0x7ba8('0x13')][_0x7ba8('0x15')]);return _0x234c44(_0x1eb9ee[_0x7ba8('0x13')][_0x7ba8('0x15')]);}logger[_0x7ba8('0x13')](_0x7ba8('0x10'),_0x2cf99d,_0x1eb9ee[_0x7ba8('0x13')][_0x7ba8('0x15')]);return _0x5b244c(_0x1eb9ee['error'][_0x7ba8('0x15')]);}else{logger[_0x7ba8('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x2cf99d,_0x7ba8('0x11'));_0x5b244c(_0x1eb9ee[_0x7ba8('0x16')][_0x7ba8('0x15')]);}})[_0x7ba8('0x17')](function(_0x401b05){logger[_0x7ba8('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x2cf99d,_0x401b05);_0x234c44(_0x401b05);});});}exports[_0x7ba8('0x18')]=function(_0x6058c5){var _0x1f9ac2=this;return new Promise(function(_0x50b56f,_0x43a87b){return db['ServicenowAccount'][_0x7ba8('0x19')]({'raw':_0x6058c5['options']?_0x6058c5[_0x7ba8('0x1a')][_0x7ba8('0x1b')]===undefined?!![]:![]:!![],'where':_0x6058c5['options']?_0x6058c5[_0x7ba8('0x1a')][_0x7ba8('0x1c')]||null:null,'attributes':_0x6058c5[_0x7ba8('0x1a')]?_0x6058c5[_0x7ba8('0x1a')][_0x7ba8('0x1d')]||null:null,'limit':_0x6058c5[_0x7ba8('0x1a')]?_0x6058c5['options'][_0x7ba8('0x1e')]||null:null,'include':_0x6058c5[_0x7ba8('0x1a')]?_0x6058c5[_0x7ba8('0x1a')][_0x7ba8('0x1f')]?_['map'](_0x6058c5[_0x7ba8('0x1a')][_0x7ba8('0x1f')],function(_0x934826){return{'model':db[_0x934826[_0x7ba8('0x20')]],'as':_0x934826['as'],'attributes':_0x934826['attributes'],'include':_0x934826['include']?_['map'](_0x934826['include'],function(_0x326ede){return{'model':db[_0x326ede[_0x7ba8('0x20')]],'as':_0x326ede['as'],'attributes':_0x326ede['attributes'],'include':_0x326ede[_0x7ba8('0x1f')]?_[_0x7ba8('0x21')](_0x326ede[_0x7ba8('0x1f')],function(_0x466202){return{'model':db[_0x466202[_0x7ba8('0x20')]],'as':_0x466202['as'],'attributes':_0x466202[_0x7ba8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7ba8('0xe')](function(_0x1cce96){logger['info'](_0x7ba8('0x18'),_0x6058c5);logger[_0x7ba8('0x22')](_0x7ba8('0x18'),_0x6058c5,JSON[_0x7ba8('0x12')](_0x1cce96));_0x50b56f(_0x1cce96);})[_0x7ba8('0x17')](function(_0x28e283){logger[_0x7ba8('0x13')]('GetServicenowAccount',_0x28e283[_0x7ba8('0x15')],_0x6058c5);_0x43a87b(_0x1f9ac2[_0x7ba8('0x13')](0x1f4,_0x28e283[_0x7ba8('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x273aa5){var _0x194960=this;return new Promise(function(_0x1d8dcf,_0x222bd8){return db[_0x7ba8('0x23')][_0x7ba8('0x24')]({'raw':_0x273aa5[_0x7ba8('0x1a')]?_0x273aa5[_0x7ba8('0x1a')][_0x7ba8('0x1b')]===undefined?!![]:![]:!![],'where':_0x273aa5[_0x7ba8('0x1a')]?_0x273aa5[_0x7ba8('0x1a')][_0x7ba8('0x1c')]||null:null,'attributes':_0x273aa5[_0x7ba8('0x1a')]?_0x273aa5['options'][_0x7ba8('0x1d')]||null:null,'include':_0x273aa5[_0x7ba8('0x1a')]?_0x273aa5['options'][_0x7ba8('0x1f')]?_[_0x7ba8('0x21')](_0x273aa5[_0x7ba8('0x1a')][_0x7ba8('0x1f')],function(_0x5e12b1){return{'model':db[_0x5e12b1[_0x7ba8('0x20')]],'as':_0x5e12b1['as'],'attributes':_0x5e12b1[_0x7ba8('0x1d')],'include':_0x5e12b1[_0x7ba8('0x1f')]?_[_0x7ba8('0x21')](_0x5e12b1['include'],function(_0x4beccd){return{'model':db[_0x4beccd[_0x7ba8('0x20')]],'as':_0x4beccd['as'],'attributes':_0x4beccd[_0x7ba8('0x1d')],'include':_0x4beccd[_0x7ba8('0x1f')]?_[_0x7ba8('0x21')](_0x4beccd['include'],function(_0xe0fc0e){return{'model':db[_0xe0fc0e[_0x7ba8('0x20')]],'as':_0xe0fc0e['as'],'attributes':_0xe0fc0e[_0x7ba8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7ba8('0xe')](function(_0x4a4071){logger[_0x7ba8('0xf')](_0x7ba8('0x25'),_0x273aa5);logger[_0x7ba8('0x22')](_0x7ba8('0x25'),_0x273aa5,JSON[_0x7ba8('0x12')](_0x4a4071));_0x1d8dcf(_0x4a4071);})['catch'](function(_0x109290){logger[_0x7ba8('0x13')](_0x7ba8('0x25'),_0x109290['message'],_0x273aa5);_0x222bd8(_0x194960[_0x7ba8('0x13')](0x1f4,_0x109290[_0x7ba8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 266bf16..136a01f 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 _0x2851=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x7d1ccb,_0x2af43b){var _0x5a78af=function(_0x19daa4){while(--_0x19daa4){_0x7d1ccb['push'](_0x7d1ccb['shift']());}};_0x5a78af(++_0x2af43b);}(_0x2851,0x10a));var _0x1285=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2851[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x1285('0x0'));var util=require(_0x1285('0x1'));var path=require(_0x1285('0x2'));var timeout=require(_0x1285('0x3'));var express=require(_0x1285('0x4'));var router=express['Router']();var fs_extra=require(_0x1285('0x5'));var auth=require(_0x1285('0x6'));var interaction=require(_0x1285('0x7'));var config=require(_0x1285('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0x1285('0x9')]('/',auth[_0x1285('0xa')](),controller[_0x1285('0xb')]);router['get'](_0x1285('0xc'),auth[_0x1285('0xa')](),controller['show']);router['get'](_0x1285('0xd'),auth[_0x1285('0xa')](),controller[_0x1285('0xe')]);router[_0x1285('0x9')]('/:id/subjects',auth[_0x1285('0xa')](),controller[_0x1285('0xf')]);router[_0x1285('0x9')](_0x1285('0x10'),auth[_0x1285('0xa')](),controller[_0x1285('0x11')]);router[_0x1285('0x12')]('/',auth[_0x1285('0xa')](),controller[_0x1285('0x13')]);router[_0x1285('0x14')]('/:id',auth[_0x1285('0xa')](),controller[_0x1285('0x15')]);router[_0x1285('0x16')]('/:id',auth[_0x1285('0xa')](),controller[_0x1285('0x17')]);module['exports']=router; \ No newline at end of file +var _0x221c=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x2913e3,_0x131dd3){var _0x17b57a=function(_0x4af8e2){while(--_0x4af8e2){_0x2913e3['push'](_0x2913e3['shift']());}};_0x17b57a(++_0x131dd3);}(_0x221c,0x1cc));var _0xc221=function(_0x3a2e5a,_0x56e6e8){_0x3a2e5a=_0x3a2e5a-0x0;var _0x16153e=_0x221c[_0x3a2e5a];return _0x16153e;};'use strict';var multer=require(_0xc221('0x0'));var util=require('util');var path=require(_0xc221('0x1'));var timeout=require(_0xc221('0x2'));var express=require('express');var router=express[_0xc221('0x3')]();var fs_extra=require(_0xc221('0x4'));var auth=require(_0xc221('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc221('0x6'));var controller=require(_0xc221('0x7'));router[_0xc221('0x8')]('/',auth['isAuthenticated'](),controller[_0xc221('0x9')]);router[_0xc221('0x8')](_0xc221('0xa'),auth[_0xc221('0xb')](),controller[_0xc221('0xc')]);router[_0xc221('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc221('0xd')]);router[_0xc221('0x8')](_0xc221('0xe'),auth[_0xc221('0xb')](),controller[_0xc221('0xf')]);router[_0xc221('0x8')](_0xc221('0x10'),auth['isAuthenticated'](),controller[_0xc221('0x11')]);router[_0xc221('0x12')]('/',auth[_0xc221('0xb')](),controller[_0xc221('0x13')]);router['put'](_0xc221('0xa'),auth[_0xc221('0xb')](),controller[_0xc221('0x14')]);router[_0xc221('0x15')](_0xc221('0xa'),auth[_0xc221('0xb')](),controller[_0xc221('0x16')]);module[_0xc221('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5d0619f..741290f 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 _0xa290=['exports','STRING'];(function(_0x1d3fa3,_0x491bac){var _0x222cda=function(_0x4389ae){while(--_0x4389ae){_0x1d3fa3['push'](_0x1d3fa3['shift']());}};_0x222cda(++_0x491bac);}(_0xa290,0xb0));var _0x0a29=function(_0x526440,_0x2d22c3){_0x526440=_0x526440-0x0;var _0x383f8c=_0xa290[_0x526440];return _0x383f8c;};'use strict';var Sequelize=require('sequelize');module[_0x0a29('0x0')]={'name':{'type':Sequelize[_0x0a29('0x1')]},'description':{'type':Sequelize[_0x0a29('0x1')]}}; \ No newline at end of file +var _0x857a=['sequelize','exports','STRING'];(function(_0x587f89,_0x15821d){var _0x5fb74e=function(_0x24abbe){while(--_0x24abbe){_0x587f89['push'](_0x587f89['shift']());}};_0x5fb74e(++_0x15821d);}(_0x857a,0x93));var _0xa857=function(_0x3c48b0,_0x327bfe){_0x3c48b0=_0x3c48b0-0x0;var _0x28a6e4=_0x857a[_0x3c48b0];return _0x28a6e4;};'use strict';var Sequelize=require(_0xa857('0x0'));module[_0xa857('0x1')]={'name':{'type':Sequelize[_0xa857('0x2')]},'description':{'type':Sequelize[_0xa857('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index fb5d067..8393c67 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 _0xce4e=['ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration','includeAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne'];(function(_0x2630e6,_0x1bccdc){var _0x236599=function(_0x26a6e4){while(--_0x26a6e4){_0x2630e6['push'](_0x2630e6['shift']());}};_0x236599(++_0x1bccdc);}(_0xce4e,0x1e9));var _0xece4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xce4e[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xece4('0x0'));var rimraf=require(_0xece4('0x1'));var zipdir=require(_0xece4('0x2'));var jsonpatch=require(_0xece4('0x3'));var rp=require(_0xece4('0x4'));var moment=require(_0xece4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xece4('0x6'));var util=require(_0xece4('0x7'));var path=require(_0xece4('0x8'));var sox=require(_0xece4('0x9'));var csv=require(_0xece4('0xa'));var ejs=require(_0xece4('0xb'));var fs=require('fs');var fs_extra=require(_0xece4('0xc'));var _=require(_0xece4('0xd'));var squel=require(_0xece4('0xe'));var crypto=require(_0xece4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xece4('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xece4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xece4('0x12'));var as=require(_0xece4('0x13'));var hardwareService=require(_0xece4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xece4('0x15'));var config=require(_0xece4('0x16'));var licenseUtil=require(_0xece4('0x17'));var db=require(_0xece4('0x18'))['db'];function respondWithStatusCode(_0x52cac2,_0x579f82){_0x579f82=_0x579f82||0xcc;return function(_0x42bb83){if(_0x42bb83){return _0x52cac2[_0xece4('0x19')](_0x579f82);}return _0x52cac2[_0xece4('0x1a')](_0x579f82)[_0xece4('0x1b')]();};}function respondWithResult(_0x2eaf2b,_0x591f25){_0x591f25=_0x591f25||0xc8;return function(_0xdcc37a){if(_0xdcc37a){return _0x2eaf2b['status'](_0x591f25)[_0xece4('0x1c')](_0xdcc37a);}};}function respondWithFilteredResult(_0x55cfe7,_0x2bb3e7){return function(_0x293755){if(_0x293755){var _0x215fc1=typeof _0x2bb3e7[_0xece4('0x1d')]===_0xece4('0x1e')&&typeof _0x2bb3e7[_0xece4('0x1f')]===_0xece4('0x1e');var _0x434fdc=_0x293755[_0xece4('0x20')];var _0x53cc8e=_0x215fc1?0x0:_0x2bb3e7[_0xece4('0x1d')];var _0x4fcc2f=_0x215fc1?_0x293755[_0xece4('0x20')]:_0x2bb3e7[_0xece4('0x1d')]+_0x2bb3e7['limit'];var _0x14ab69;if(_0x4fcc2f>=_0x434fdc){_0x4fcc2f=_0x434fdc;_0x14ab69=0xc8;}else{_0x14ab69=0xce;}_0x55cfe7[_0xece4('0x1a')](_0x14ab69);return _0x55cfe7[_0xece4('0x21')](_0xece4('0x22'),_0x53cc8e+'-'+_0x4fcc2f+'/'+_0x434fdc)[_0xece4('0x1c')](_0x293755);}return null;};}function patchUpdates(_0x935b90){return function(_0x235e9e){try{jsonpatch['apply'](_0x235e9e,_0x935b90,!![]);}catch(_0x40a7c9){return BPromise[_0xece4('0x23')](_0x40a7c9);}return _0x235e9e[_0xece4('0x24')]();};}function saveUpdates(_0x50e2ac,_0x331573){return function(_0x3deade){if(_0x3deade){return _0x3deade[_0xece4('0x25')](_0x50e2ac)[_0xece4('0x26')](function(_0x5bda02){return _0x5bda02;});}return null;};}function removeEntity(_0x591fff,_0x825bd7){return function(_0x4fdea2){if(_0x4fdea2){return _0x4fdea2[_0xece4('0x27')]()[_0xece4('0x26')](function(){_0x591fff['status'](0xcc)[_0xece4('0x1b')]();});}};}function handleEntityNotFound(_0x593b43,_0x5974ad){return function(_0x23997d){if(!_0x23997d){_0x593b43['sendStatus'](0x194);}return _0x23997d;};}function handleError(_0x2dc8f2,_0x3c4e61){_0x3c4e61=_0x3c4e61||0x1f4;return function(_0x5e6318){logger['error'](_0x5e6318[_0xece4('0x28')]);if(_0x5e6318[_0xece4('0x29')]){delete _0x5e6318['name'];}_0x2dc8f2[_0xece4('0x1a')](_0x3c4e61)[_0xece4('0x2a')](_0x5e6318);};}exports[_0xece4('0x2b')]=function(_0x414c27,_0x4d07de){var _0x11f896={},_0x216065={},_0x45f91f={'count':0x0,'rows':[]};var _0x5ae5f7=_[_0xece4('0x2c')](db['ServicenowConfiguration'][_0xece4('0x2d')],function(_0x521bc8){return{'name':_0x521bc8[_0xece4('0x2e')],'type':_0x521bc8['type'][_0xece4('0x2f')]};});_0x216065[_0xece4('0x30')]=_['map'](_0x5ae5f7,_0xece4('0x29'));_0x216065[_0xece4('0x31')]=_[_0xece4('0x32')](_0x414c27[_0xece4('0x31')]);_0x216065[_0xece4('0x33')]=_[_0xece4('0x34')](_0x216065[_0xece4('0x30')],_0x216065[_0xece4('0x31')]);_0x11f896['attributes']=_[_0xece4('0x34')](_0x216065[_0xece4('0x30')],qs[_0xece4('0x35')](_0x414c27[_0xece4('0x31')]['fields']));_0x11f896['attributes']=_0x11f896[_0xece4('0x36')]['length']?_0x11f896['attributes']:_0x216065[_0xece4('0x30')];if(!_0x414c27[_0xece4('0x31')][_0xece4('0x37')](_0xece4('0x38'))){_0x11f896[_0xece4('0x1f')]=qs[_0xece4('0x1f')](_0x414c27[_0xece4('0x31')]['limit']);_0x11f896[_0xece4('0x1d')]=qs['offset'](_0x414c27[_0xece4('0x31')][_0xece4('0x1d')]);}_0x11f896[_0xece4('0x39')]=qs[_0xece4('0x3a')](_0x414c27['query']['sort']);_0x11f896[_0xece4('0x3b')]=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x414c27[_0xece4('0x31')],_0x216065[_0xece4('0x33')]),_0x5ae5f7);if(_0x414c27[_0xece4('0x31')][_0xece4('0x3d')]){_0x11f896['where']=_['merge'](_0x11f896['where'],{'$or':_[_0xece4('0x2c')](_0x5ae5f7,function(_0x122f9b){if(_0x122f9b['type']!==_0xece4('0x3e')){var _0x2bb932={};_0x2bb932[_0x122f9b[_0xece4('0x29')]]={'$like':'%'+_0x414c27[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x2bb932;}})});}_0x11f896=_[_0xece4('0x3f')]({},_0x11f896,_0x414c27[_0xece4('0x40')]);var _0x625cb9={'where':_0x11f896[_0xece4('0x3b')]};return db[_0xece4('0x41')][_0xece4('0x20')](_0x625cb9)[_0xece4('0x26')](function(_0x437a08){_0x45f91f[_0xece4('0x20')]=_0x437a08;if(_0x414c27[_0xece4('0x31')][_0xece4('0x42')]){_0x11f896['include']=[{'all':!![]}];}return db[_0xece4('0x41')]['findAll'](_0x11f896);})[_0xece4('0x26')](function(_0x241edf){_0x45f91f[_0xece4('0x43')]=_0x241edf;return _0x45f91f;})[_0xece4('0x26')](respondWithFilteredResult(_0x4d07de,_0x11f896))[_0xece4('0x44')](handleError(_0x4d07de,null));};exports[_0xece4('0x45')]=function(_0xf43147,_0x5dcf08){var _0x1c61c5={'raw':![],'where':{'id':_0xf43147[_0xece4('0x46')]['id']}},_0x273326={};_0x273326[_0xece4('0x30')]=_[_0xece4('0x32')](db[_0xece4('0x41')][_0xece4('0x2d')]);_0x273326[_0xece4('0x31')]=_[_0xece4('0x32')](_0xf43147[_0xece4('0x31')]);_0x273326[_0xece4('0x33')]=_[_0xece4('0x34')](_0x273326[_0xece4('0x30')],_0x273326[_0xece4('0x31')]);_0x1c61c5[_0xece4('0x36')]=_['intersection'](_0x273326[_0xece4('0x30')],qs[_0xece4('0x35')](_0xf43147[_0xece4('0x31')][_0xece4('0x35')]));_0x1c61c5[_0xece4('0x36')]=_0x1c61c5[_0xece4('0x36')][_0xece4('0x47')]?_0x1c61c5[_0xece4('0x36')]:_0x273326[_0xece4('0x30')];if(_0xf43147[_0xece4('0x31')]['includeAll']){_0x1c61c5[_0xece4('0x48')]=[{'all':!![]}];}_0x1c61c5=_['merge']({},_0x1c61c5,_0xf43147[_0xece4('0x40')]);return db['ServicenowConfiguration'][_0xece4('0x49')](_0x1c61c5)[_0xece4('0x26')](handleEntityNotFound(_0x5dcf08,null))[_0xece4('0x26')](respondWithResult(_0x5dcf08,null))[_0xece4('0x44')](handleError(_0x5dcf08,null));};exports[_0xece4('0x4a')]=function(_0x1431dd,_0x4135e3){return db[_0xece4('0x41')][_0xece4('0x4a')](_0x1431dd[_0xece4('0x4b')],{})[_0xece4('0x26')](respondWithResult(_0x4135e3,0xc9))[_0xece4('0x44')](handleError(_0x4135e3,null));};exports[_0xece4('0x25')]=function(_0x3fe5ea,_0x39b44b){if(_0x3fe5ea[_0xece4('0x4b')]['id']){delete _0x3fe5ea[_0xece4('0x4b')]['id'];}return db[_0xece4('0x41')][_0xece4('0x49')]({'where':{'id':_0x3fe5ea[_0xece4('0x46')]['id']}})['then'](handleEntityNotFound(_0x39b44b,null))[_0xece4('0x26')](saveUpdates(_0x3fe5ea['body'],null))['then'](respondWithResult(_0x39b44b,null))[_0xece4('0x44')](handleError(_0x39b44b,null));};exports[_0xece4('0x27')]=function(_0x4bdb64,_0x35f2b6){return db[_0xece4('0x41')][_0xece4('0x49')]({'where':{'id':_0x4bdb64[_0xece4('0x46')]['id']}})[_0xece4('0x26')](handleEntityNotFound(_0x35f2b6,null))['then'](removeEntity(_0x35f2b6,null))['catch'](handleError(_0x35f2b6,null));};exports[_0xece4('0x4c')]=function(_0x30183d,_0x3c3baf,_0x2d6aff){var _0x208728={};var _0x121850={};var _0x38d360;var _0x451b25;return db[_0xece4('0x41')][_0xece4('0x4d')]({'where':{'id':_0x30183d['params']['id']}})[_0xece4('0x26')](handleEntityNotFound(_0x3c3baf,null))[_0xece4('0x26')](function(_0x5a4842){if(_0x5a4842){_0x38d360=_0x5a4842;_0x121850[_0xece4('0x30')]=_['keys'](db[_0xece4('0x4e')][_0xece4('0x2d')]);_0x121850[_0xece4('0x31')]=_[_0xece4('0x32')](_0x30183d[_0xece4('0x31')]);_0x121850[_0xece4('0x33')]=_[_0xece4('0x34')](_0x121850['model'],_0x121850[_0xece4('0x31')]);_0x208728['attributes']=_[_0xece4('0x34')](_0x121850[_0xece4('0x30')],qs[_0xece4('0x35')](_0x30183d[_0xece4('0x31')][_0xece4('0x35')]));_0x208728[_0xece4('0x36')]=_0x208728[_0xece4('0x36')][_0xece4('0x47')]?_0x208728[_0xece4('0x36')]:_0x121850[_0xece4('0x30')];_0x208728['order']=qs[_0xece4('0x3a')](_0x30183d[_0xece4('0x31')][_0xece4('0x3a')]);_0x208728[_0xece4('0x3b')]=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x30183d['query'],_0x121850[_0xece4('0x33')]));if(_0x30183d[_0xece4('0x31')][_0xece4('0x3d')]){_0x208728[_0xece4('0x3b')]=_['merge'](_0x208728[_0xece4('0x3b')],{'$or':_[_0xece4('0x2c')](_0x208728[_0xece4('0x36')],function(_0x2d6b09){var _0x41d04e={};_0x41d04e[_0x2d6b09]={'$like':'%'+_0x30183d[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x41d04e;})});}_0x208728=_[_0xece4('0x3f')]({},_0x208728,_0x30183d['options']);return _0x38d360[_0xece4('0x4c')](_0x208728);}})[_0xece4('0x26')](function(_0x2b6b37){if(_0x2b6b37){_0x451b25=_0x2b6b37[_0xece4('0x47')];if(!_0x30183d[_0xece4('0x31')]['hasOwnProperty'](_0xece4('0x38'))){_0x208728['limit']=qs['limit'](_0x30183d['query']['limit']);_0x208728[_0xece4('0x1d')]=qs[_0xece4('0x1d')](_0x30183d[_0xece4('0x31')][_0xece4('0x1d')]);}return _0x38d360[_0xece4('0x4c')](_0x208728);}})['then'](function(_0x33e4cc){if(_0x33e4cc){return _0x33e4cc?{'count':_0x451b25,'rows':_0x33e4cc}:null;}})[_0xece4('0x26')](respondWithResult(_0x3c3baf,null))[_0xece4('0x44')](handleError(_0x3c3baf,null));};exports[_0xece4('0x4f')]=function(_0x19caa9,_0x49a383,_0x591030){var _0xe36cff={};var _0x1a85a3={};var _0x2f55b8;var _0x4c121d;return db[_0xece4('0x41')][_0xece4('0x4d')]({'where':{'id':_0x19caa9[_0xece4('0x46')]['id']}})[_0xece4('0x26')](handleEntityNotFound(_0x49a383,null))[_0xece4('0x26')](function(_0x33e2bb){if(_0x33e2bb){_0x2f55b8=_0x33e2bb;_0x1a85a3['model']=_[_0xece4('0x32')](db[_0xece4('0x4e')][_0xece4('0x2d')]);_0x1a85a3['query']=_['keys'](_0x19caa9[_0xece4('0x31')]);_0x1a85a3['filters']=_[_0xece4('0x34')](_0x1a85a3[_0xece4('0x30')],_0x1a85a3[_0xece4('0x31')]);_0xe36cff[_0xece4('0x36')]=_[_0xece4('0x34')](_0x1a85a3['model'],qs[_0xece4('0x35')](_0x19caa9['query'][_0xece4('0x35')]));_0xe36cff[_0xece4('0x36')]=_0xe36cff['attributes'][_0xece4('0x47')]?_0xe36cff[_0xece4('0x36')]:_0x1a85a3[_0xece4('0x30')];_0xe36cff['order']=qs['sort'](_0x19caa9[_0xece4('0x31')][_0xece4('0x3a')]);_0xe36cff['where']=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x19caa9['query'],_0x1a85a3[_0xece4('0x33')]));if(_0x19caa9[_0xece4('0x31')][_0xece4('0x3d')]){_0xe36cff[_0xece4('0x3b')]=_[_0xece4('0x3f')](_0xe36cff[_0xece4('0x3b')],{'$or':_[_0xece4('0x2c')](_0xe36cff[_0xece4('0x36')],function(_0x3db7ce){var _0x1503a9={};_0x1503a9[_0x3db7ce]={'$like':'%'+_0x19caa9[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x1503a9;})});}_0xe36cff=_[_0xece4('0x3f')]({},_0xe36cff,_0x19caa9[_0xece4('0x40')]);return _0x2f55b8[_0xece4('0x4f')](_0xe36cff);}})[_0xece4('0x26')](function(_0x4feb07){if(_0x4feb07){_0x4c121d=_0x4feb07[_0xece4('0x47')];if(!_0x19caa9['query'][_0xece4('0x37')](_0xece4('0x38'))){_0xe36cff[_0xece4('0x1f')]=qs[_0xece4('0x1f')](_0x19caa9[_0xece4('0x31')][_0xece4('0x1f')]);_0xe36cff['offset']=qs['offset'](_0x19caa9[_0xece4('0x31')]['offset']);}return _0x2f55b8['getSubjects'](_0xe36cff);}})[_0xece4('0x26')](function(_0x4437c4){if(_0x4437c4){return _0x4437c4?{'count':_0x4c121d,'rows':_0x4437c4}:null;}})[_0xece4('0x26')](respondWithResult(_0x49a383,null))['catch'](handleError(_0x49a383,null));};exports[_0xece4('0x50')]=function(_0x2ac1c8,_0xa38df8,_0x51409e){var _0x2cc58e={};var _0x5ca364={};var _0x1d7c0a;var _0x327ddb;return db[_0xece4('0x41')]['findOne']({'where':{'id':_0x2ac1c8['params']['id']}})[_0xece4('0x26')](handleEntityNotFound(_0xa38df8,null))[_0xece4('0x26')](function(_0xf9d93a){if(_0xf9d93a){_0x1d7c0a=_0xf9d93a;_0x5ca364[_0xece4('0x30')]=_['keys'](db[_0xece4('0x4e')][_0xece4('0x2d')]);_0x5ca364[_0xece4('0x31')]=_[_0xece4('0x32')](_0x2ac1c8[_0xece4('0x31')]);_0x5ca364[_0xece4('0x33')]=_[_0xece4('0x34')](_0x5ca364[_0xece4('0x30')],_0x5ca364[_0xece4('0x31')]);_0x2cc58e['attributes']=_[_0xece4('0x34')](_0x5ca364['model'],qs['fields'](_0x2ac1c8[_0xece4('0x31')]['fields']));_0x2cc58e['attributes']=_0x2cc58e[_0xece4('0x36')][_0xece4('0x47')]?_0x2cc58e[_0xece4('0x36')]:_0x5ca364['model'];_0x2cc58e['order']=qs['sort'](_0x2ac1c8[_0xece4('0x31')][_0xece4('0x3a')]);_0x2cc58e['where']=qs[_0xece4('0x33')](_[_0xece4('0x3c')](_0x2ac1c8['query'],_0x5ca364['filters']));if(_0x2ac1c8[_0xece4('0x31')][_0xece4('0x3d')]){_0x2cc58e[_0xece4('0x3b')]=_['merge'](_0x2cc58e[_0xece4('0x3b')],{'$or':_[_0xece4('0x2c')](_0x2cc58e[_0xece4('0x36')],function(_0x5abb04){var _0x4e2b5d={};_0x4e2b5d[_0x5abb04]={'$like':'%'+_0x2ac1c8[_0xece4('0x31')][_0xece4('0x3d')]+'%'};return _0x4e2b5d;})});}_0x2cc58e=_[_0xece4('0x3f')]({},_0x2cc58e,_0x2ac1c8[_0xece4('0x40')]);return _0x1d7c0a['getDescriptions'](_0x2cc58e);}})[_0xece4('0x26')](function(_0x10c657){if(_0x10c657){_0x327ddb=_0x10c657[_0xece4('0x47')];if(!_0x2ac1c8[_0xece4('0x31')][_0xece4('0x37')](_0xece4('0x38'))){_0x2cc58e['limit']=qs[_0xece4('0x1f')](_0x2ac1c8[_0xece4('0x31')]['limit']);_0x2cc58e[_0xece4('0x1d')]=qs[_0xece4('0x1d')](_0x2ac1c8[_0xece4('0x31')][_0xece4('0x1d')]);}return _0x1d7c0a[_0xece4('0x50')](_0x2cc58e);}})['then'](function(_0x3e30c6){if(_0x3e30c6){return _0x3e30c6?{'count':_0x327ddb,'rows':_0x3e30c6}:null;}})['then'](respondWithResult(_0xa38df8,null))[_0xece4('0x44')](handleError(_0xa38df8,null));}; \ No newline at end of file +var _0x3e42=['body','findOne','getFields','getSubjects','ServicenowField','getDescriptions','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','ServicenowConfiguration','findAll','rows','catch','show','params','includeAll','include','find'];(function(_0x5e5cbf,_0x1311b0){var _0x419f9e=function(_0x15d0e0){while(--_0x15d0e0){_0x5e5cbf['push'](_0x5e5cbf['shift']());}};_0x419f9e(++_0x1311b0);}(_0x3e42,0x147));var _0x23e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e42[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23e4('0x0'));var zipdir=require(_0x23e4('0x1'));var jsonpatch=require(_0x23e4('0x2'));var rp=require(_0x23e4('0x3'));var moment=require(_0x23e4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x23e4('0x5'));var path=require(_0x23e4('0x6'));var sox=require(_0x23e4('0x7'));var csv=require(_0x23e4('0x8'));var ejs=require(_0x23e4('0x9'));var fs=require('fs');var fs_extra=require(_0x23e4('0xa'));var _=require(_0x23e4('0xb'));var squel=require(_0x23e4('0xc'));var crypto=require(_0x23e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x23e4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x23e4('0xf'));var Papa=require(_0x23e4('0x10'));var Redis=require('ioredis');var authService=require(_0x23e4('0x11'));var qs=require(_0x23e4('0x12'));var as=require(_0x23e4('0x13'));var hardwareService=require(_0x23e4('0x14'));var logger=require(_0x23e4('0x15'))('api');var utils=require(_0x23e4('0x16'));var config=require(_0x23e4('0x17'));var licenseUtil=require(_0x23e4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b961,_0xe077b4){_0xe077b4=_0xe077b4||0xcc;return function(_0x389581){if(_0x389581){return _0x33b961[_0x23e4('0x19')](_0xe077b4);}return _0x33b961['status'](_0xe077b4)[_0x23e4('0x1a')]();};}function respondWithResult(_0x33cdb4,_0x5844f9){_0x5844f9=_0x5844f9||0xc8;return function(_0x518334){if(_0x518334){return _0x33cdb4[_0x23e4('0x1b')](_0x5844f9)[_0x23e4('0x1c')](_0x518334);}};}function respondWithFilteredResult(_0x34fdce,_0x368652){return function(_0x23e034){if(_0x23e034){var _0x31219d=typeof _0x368652[_0x23e4('0x1d')]===_0x23e4('0x1e')&&typeof _0x368652['limit']===_0x23e4('0x1e');var _0x3a498d=_0x23e034[_0x23e4('0x1f')];var _0x320337=_0x31219d?0x0:_0x368652[_0x23e4('0x1d')];var _0x45e112=_0x31219d?_0x23e034[_0x23e4('0x1f')]:_0x368652[_0x23e4('0x1d')]+_0x368652['limit'];var _0x227b70;if(_0x45e112>=_0x3a498d){_0x45e112=_0x3a498d;_0x227b70=0xc8;}else{_0x227b70=0xce;}_0x34fdce['status'](_0x227b70);return _0x34fdce['set'](_0x23e4('0x20'),_0x320337+'-'+_0x45e112+'/'+_0x3a498d)['json'](_0x23e034);}return null;};}function patchUpdates(_0x1e0c67){return function(_0x30a107){try{jsonpatch[_0x23e4('0x21')](_0x30a107,_0x1e0c67,!![]);}catch(_0x1dd9ea){return BPromise[_0x23e4('0x22')](_0x1dd9ea);}return _0x30a107['save']();};}function saveUpdates(_0x530de0,_0x52eaab){return function(_0x28265e){if(_0x28265e){return _0x28265e[_0x23e4('0x23')](_0x530de0)[_0x23e4('0x24')](function(_0x3ffd48){return _0x3ffd48;});}return null;};}function removeEntity(_0x3bbe4d,_0x37f894){return function(_0x597cc1){if(_0x597cc1){return _0x597cc1[_0x23e4('0x25')]()[_0x23e4('0x24')](function(){_0x3bbe4d[_0x23e4('0x1b')](0xcc)[_0x23e4('0x1a')]();});}};}function handleEntityNotFound(_0x2bab63,_0x3e03f2){return function(_0x3fa78c){if(!_0x3fa78c){_0x2bab63[_0x23e4('0x19')](0x194);}return _0x3fa78c;};}function handleError(_0x374e9d,_0x3016d0){_0x3016d0=_0x3016d0||0x1f4;return function(_0x3ee310){logger[_0x23e4('0x26')](_0x3ee310['stack']);if(_0x3ee310[_0x23e4('0x27')]){delete _0x3ee310[_0x23e4('0x27')];}_0x374e9d[_0x23e4('0x1b')](_0x3016d0)[_0x23e4('0x28')](_0x3ee310);};}exports[_0x23e4('0x29')]=function(_0x13b311,_0x8149db){var _0x403685={},_0x48388e={},_0x1731a7={'count':0x0,'rows':[]};var _0x1cf0f7=_[_0x23e4('0x2a')](db['ServicenowConfiguration'][_0x23e4('0x2b')],function(_0xb708b2){return{'name':_0xb708b2[_0x23e4('0x2c')],'type':_0xb708b2[_0x23e4('0x2d')]['key']};});_0x48388e[_0x23e4('0x2e')]=_[_0x23e4('0x2a')](_0x1cf0f7,_0x23e4('0x27'));_0x48388e[_0x23e4('0x2f')]=_[_0x23e4('0x30')](_0x13b311[_0x23e4('0x2f')]);_0x48388e[_0x23e4('0x31')]=_[_0x23e4('0x32')](_0x48388e['model'],_0x48388e[_0x23e4('0x2f')]);_0x403685[_0x23e4('0x33')]=_[_0x23e4('0x32')](_0x48388e['model'],qs['fields'](_0x13b311[_0x23e4('0x2f')][_0x23e4('0x34')]));_0x403685[_0x23e4('0x33')]=_0x403685[_0x23e4('0x33')][_0x23e4('0x35')]?_0x403685[_0x23e4('0x33')]:_0x48388e[_0x23e4('0x2e')];if(!_0x13b311['query'][_0x23e4('0x36')](_0x23e4('0x37'))){_0x403685[_0x23e4('0x38')]=qs['limit'](_0x13b311[_0x23e4('0x2f')][_0x23e4('0x38')]);_0x403685['offset']=qs[_0x23e4('0x1d')](_0x13b311[_0x23e4('0x2f')][_0x23e4('0x1d')]);}_0x403685[_0x23e4('0x39')]=qs[_0x23e4('0x3a')](_0x13b311[_0x23e4('0x2f')][_0x23e4('0x3a')]);_0x403685[_0x23e4('0x3b')]=qs[_0x23e4('0x31')](_['pick'](_0x13b311['query'],_0x48388e[_0x23e4('0x31')]),_0x1cf0f7);if(_0x13b311[_0x23e4('0x2f')][_0x23e4('0x3c')]){_0x403685['where']=_[_0x23e4('0x3d')](_0x403685[_0x23e4('0x3b')],{'$or':_[_0x23e4('0x2a')](_0x1cf0f7,function(_0x185246){if(_0x185246[_0x23e4('0x2d')]!==_0x23e4('0x3e')){var _0x1464b7={};_0x1464b7[_0x185246[_0x23e4('0x27')]]={'$like':'%'+_0x13b311[_0x23e4('0x2f')][_0x23e4('0x3c')]+'%'};return _0x1464b7;}})});}_0x403685=_[_0x23e4('0x3d')]({},_0x403685,_0x13b311[_0x23e4('0x3f')]);var _0x23bc95={'where':_0x403685['where']};return db['ServicenowConfiguration'][_0x23e4('0x1f')](_0x23bc95)[_0x23e4('0x24')](function(_0x56796a){_0x1731a7['count']=_0x56796a;if(_0x13b311[_0x23e4('0x2f')]['includeAll']){_0x403685['include']=[{'all':!![]}];}return db[_0x23e4('0x40')][_0x23e4('0x41')](_0x403685);})[_0x23e4('0x24')](function(_0x13eea7){_0x1731a7[_0x23e4('0x42')]=_0x13eea7;return _0x1731a7;})[_0x23e4('0x24')](respondWithFilteredResult(_0x8149db,_0x403685))[_0x23e4('0x43')](handleError(_0x8149db,null));};exports[_0x23e4('0x44')]=function(_0x1204f0,_0x6c5825){var _0x1c15b6={'raw':![],'where':{'id':_0x1204f0[_0x23e4('0x45')]['id']}},_0x402b46={};_0x402b46['model']=_['keys'](db[_0x23e4('0x40')][_0x23e4('0x2b')]);_0x402b46[_0x23e4('0x2f')]=_[_0x23e4('0x30')](_0x1204f0[_0x23e4('0x2f')]);_0x402b46['filters']=_['intersection'](_0x402b46['model'],_0x402b46[_0x23e4('0x2f')]);_0x1c15b6['attributes']=_[_0x23e4('0x32')](_0x402b46[_0x23e4('0x2e')],qs[_0x23e4('0x34')](_0x1204f0[_0x23e4('0x2f')][_0x23e4('0x34')]));_0x1c15b6[_0x23e4('0x33')]=_0x1c15b6[_0x23e4('0x33')][_0x23e4('0x35')]?_0x1c15b6[_0x23e4('0x33')]:_0x402b46['model'];if(_0x1204f0['query'][_0x23e4('0x46')]){_0x1c15b6[_0x23e4('0x47')]=[{'all':!![]}];}_0x1c15b6=_[_0x23e4('0x3d')]({},_0x1c15b6,_0x1204f0['options']);return db[_0x23e4('0x40')][_0x23e4('0x48')](_0x1c15b6)['then'](handleEntityNotFound(_0x6c5825,null))['then'](respondWithResult(_0x6c5825,null))[_0x23e4('0x43')](handleError(_0x6c5825,null));};exports['create']=function(_0x28a4ef,_0x47d484){return db[_0x23e4('0x40')]['create'](_0x28a4ef[_0x23e4('0x49')],{})[_0x23e4('0x24')](respondWithResult(_0x47d484,0xc9))[_0x23e4('0x43')](handleError(_0x47d484,null));};exports[_0x23e4('0x23')]=function(_0x6add63,_0x4b29b2){if(_0x6add63[_0x23e4('0x49')]['id']){delete _0x6add63[_0x23e4('0x49')]['id'];}return db[_0x23e4('0x40')][_0x23e4('0x48')]({'where':{'id':_0x6add63[_0x23e4('0x45')]['id']}})[_0x23e4('0x24')](handleEntityNotFound(_0x4b29b2,null))['then'](saveUpdates(_0x6add63['body'],null))['then'](respondWithResult(_0x4b29b2,null))[_0x23e4('0x43')](handleError(_0x4b29b2,null));};exports[_0x23e4('0x25')]=function(_0x9f266a,_0x32c407){return db[_0x23e4('0x40')][_0x23e4('0x48')]({'where':{'id':_0x9f266a[_0x23e4('0x45')]['id']}})[_0x23e4('0x24')](handleEntityNotFound(_0x32c407,null))['then'](removeEntity(_0x32c407,null))[_0x23e4('0x43')](handleError(_0x32c407,null));};exports['getFields']=function(_0x49d31e,_0x2bbca9,_0x4aef0b){var _0x487601={};var _0x4b0fd2={};var _0x297b13;var _0xf6d88;return db[_0x23e4('0x40')][_0x23e4('0x4a')]({'where':{'id':_0x49d31e[_0x23e4('0x45')]['id']}})[_0x23e4('0x24')](handleEntityNotFound(_0x2bbca9,null))[_0x23e4('0x24')](function(_0x5e1bea){if(_0x5e1bea){_0x297b13=_0x5e1bea;_0x4b0fd2[_0x23e4('0x2e')]=_[_0x23e4('0x30')](db['ServicenowField'][_0x23e4('0x2b')]);_0x4b0fd2[_0x23e4('0x2f')]=_[_0x23e4('0x30')](_0x49d31e[_0x23e4('0x2f')]);_0x4b0fd2[_0x23e4('0x31')]=_[_0x23e4('0x32')](_0x4b0fd2['model'],_0x4b0fd2[_0x23e4('0x2f')]);_0x487601[_0x23e4('0x33')]=_[_0x23e4('0x32')](_0x4b0fd2[_0x23e4('0x2e')],qs[_0x23e4('0x34')](_0x49d31e[_0x23e4('0x2f')]['fields']));_0x487601[_0x23e4('0x33')]=_0x487601['attributes']['length']?_0x487601[_0x23e4('0x33')]:_0x4b0fd2['model'];_0x487601['order']=qs[_0x23e4('0x3a')](_0x49d31e[_0x23e4('0x2f')][_0x23e4('0x3a')]);_0x487601[_0x23e4('0x3b')]=qs[_0x23e4('0x31')](_['pick'](_0x49d31e['query'],_0x4b0fd2[_0x23e4('0x31')]));if(_0x49d31e['query']['filter']){_0x487601[_0x23e4('0x3b')]=_[_0x23e4('0x3d')](_0x487601[_0x23e4('0x3b')],{'$or':_[_0x23e4('0x2a')](_0x487601[_0x23e4('0x33')],function(_0x3c468c){var _0x3b4d76={};_0x3b4d76[_0x3c468c]={'$like':'%'+_0x49d31e['query'][_0x23e4('0x3c')]+'%'};return _0x3b4d76;})});}_0x487601=_[_0x23e4('0x3d')]({},_0x487601,_0x49d31e['options']);return _0x297b13[_0x23e4('0x4b')](_0x487601);}})[_0x23e4('0x24')](function(_0x50bc43){if(_0x50bc43){_0xf6d88=_0x50bc43['length'];if(!_0x49d31e[_0x23e4('0x2f')][_0x23e4('0x36')]('nolimit')){_0x487601[_0x23e4('0x38')]=qs[_0x23e4('0x38')](_0x49d31e[_0x23e4('0x2f')][_0x23e4('0x38')]);_0x487601[_0x23e4('0x1d')]=qs[_0x23e4('0x1d')](_0x49d31e[_0x23e4('0x2f')][_0x23e4('0x1d')]);}return _0x297b13[_0x23e4('0x4b')](_0x487601);}})[_0x23e4('0x24')](function(_0x5503fb){if(_0x5503fb){return _0x5503fb?{'count':_0xf6d88,'rows':_0x5503fb}:null;}})[_0x23e4('0x24')](respondWithResult(_0x2bbca9,null))[_0x23e4('0x43')](handleError(_0x2bbca9,null));};exports[_0x23e4('0x4c')]=function(_0x43eb36,_0x25ff3a,_0x25c556){var _0xb0009d={};var _0x255165={};var _0x41d5fb;var _0x57bf89;return db[_0x23e4('0x40')][_0x23e4('0x4a')]({'where':{'id':_0x43eb36[_0x23e4('0x45')]['id']}})[_0x23e4('0x24')](handleEntityNotFound(_0x25ff3a,null))[_0x23e4('0x24')](function(_0x4a9434){if(_0x4a9434){_0x41d5fb=_0x4a9434;_0x255165[_0x23e4('0x2e')]=_[_0x23e4('0x30')](db[_0x23e4('0x4d')][_0x23e4('0x2b')]);_0x255165[_0x23e4('0x2f')]=_[_0x23e4('0x30')](_0x43eb36['query']);_0x255165[_0x23e4('0x31')]=_['intersection'](_0x255165[_0x23e4('0x2e')],_0x255165[_0x23e4('0x2f')]);_0xb0009d[_0x23e4('0x33')]=_[_0x23e4('0x32')](_0x255165[_0x23e4('0x2e')],qs[_0x23e4('0x34')](_0x43eb36[_0x23e4('0x2f')][_0x23e4('0x34')]));_0xb0009d[_0x23e4('0x33')]=_0xb0009d[_0x23e4('0x33')][_0x23e4('0x35')]?_0xb0009d['attributes']:_0x255165[_0x23e4('0x2e')];_0xb0009d['order']=qs['sort'](_0x43eb36['query'][_0x23e4('0x3a')]);_0xb0009d[_0x23e4('0x3b')]=qs[_0x23e4('0x31')](_['pick'](_0x43eb36[_0x23e4('0x2f')],_0x255165[_0x23e4('0x31')]));if(_0x43eb36['query'][_0x23e4('0x3c')]){_0xb0009d['where']=_[_0x23e4('0x3d')](_0xb0009d[_0x23e4('0x3b')],{'$or':_['map'](_0xb0009d['attributes'],function(_0x182244){var _0x2b7f59={};_0x2b7f59[_0x182244]={'$like':'%'+_0x43eb36[_0x23e4('0x2f')]['filter']+'%'};return _0x2b7f59;})});}_0xb0009d=_[_0x23e4('0x3d')]({},_0xb0009d,_0x43eb36[_0x23e4('0x3f')]);return _0x41d5fb['getSubjects'](_0xb0009d);}})[_0x23e4('0x24')](function(_0x2c6b01){if(_0x2c6b01){_0x57bf89=_0x2c6b01['length'];if(!_0x43eb36[_0x23e4('0x2f')]['hasOwnProperty']('nolimit')){_0xb0009d[_0x23e4('0x38')]=qs[_0x23e4('0x38')](_0x43eb36['query'][_0x23e4('0x38')]);_0xb0009d[_0x23e4('0x1d')]=qs[_0x23e4('0x1d')](_0x43eb36[_0x23e4('0x2f')][_0x23e4('0x1d')]);}return _0x41d5fb[_0x23e4('0x4c')](_0xb0009d);}})[_0x23e4('0x24')](function(_0x405daf){if(_0x405daf){return _0x405daf?{'count':_0x57bf89,'rows':_0x405daf}:null;}})[_0x23e4('0x24')](respondWithResult(_0x25ff3a,null))[_0x23e4('0x43')](handleError(_0x25ff3a,null));};exports[_0x23e4('0x4e')]=function(_0x201a9b,_0x1b57f6,_0x4885f5){var _0x104450={};var _0x4362d7={};var _0x2c76d6;var _0x5529d7;return db['ServicenowConfiguration'][_0x23e4('0x4a')]({'where':{'id':_0x201a9b[_0x23e4('0x45')]['id']}})[_0x23e4('0x24')](handleEntityNotFound(_0x1b57f6,null))[_0x23e4('0x24')](function(_0x24051b){if(_0x24051b){_0x2c76d6=_0x24051b;_0x4362d7[_0x23e4('0x2e')]=_[_0x23e4('0x30')](db[_0x23e4('0x4d')][_0x23e4('0x2b')]);_0x4362d7['query']=_[_0x23e4('0x30')](_0x201a9b[_0x23e4('0x2f')]);_0x4362d7[_0x23e4('0x31')]=_['intersection'](_0x4362d7[_0x23e4('0x2e')],_0x4362d7[_0x23e4('0x2f')]);_0x104450[_0x23e4('0x33')]=_[_0x23e4('0x32')](_0x4362d7[_0x23e4('0x2e')],qs[_0x23e4('0x34')](_0x201a9b[_0x23e4('0x2f')][_0x23e4('0x34')]));_0x104450[_0x23e4('0x33')]=_0x104450[_0x23e4('0x33')][_0x23e4('0x35')]?_0x104450[_0x23e4('0x33')]:_0x4362d7[_0x23e4('0x2e')];_0x104450[_0x23e4('0x39')]=qs[_0x23e4('0x3a')](_0x201a9b[_0x23e4('0x2f')][_0x23e4('0x3a')]);_0x104450[_0x23e4('0x3b')]=qs[_0x23e4('0x31')](_[_0x23e4('0x4f')](_0x201a9b['query'],_0x4362d7['filters']));if(_0x201a9b['query'][_0x23e4('0x3c')]){_0x104450[_0x23e4('0x3b')]=_[_0x23e4('0x3d')](_0x104450[_0x23e4('0x3b')],{'$or':_[_0x23e4('0x2a')](_0x104450[_0x23e4('0x33')],function(_0x2cb607){var _0xd482e9={};_0xd482e9[_0x2cb607]={'$like':'%'+_0x201a9b['query'][_0x23e4('0x3c')]+'%'};return _0xd482e9;})});}_0x104450=_[_0x23e4('0x3d')]({},_0x104450,_0x201a9b[_0x23e4('0x3f')]);return _0x2c76d6[_0x23e4('0x4e')](_0x104450);}})[_0x23e4('0x24')](function(_0x5bb177){if(_0x5bb177){_0x5529d7=_0x5bb177[_0x23e4('0x35')];if(!_0x201a9b[_0x23e4('0x2f')][_0x23e4('0x36')](_0x23e4('0x37'))){_0x104450[_0x23e4('0x38')]=qs[_0x23e4('0x38')](_0x201a9b[_0x23e4('0x2f')][_0x23e4('0x38')]);_0x104450[_0x23e4('0x1d')]=qs[_0x23e4('0x1d')](_0x201a9b[_0x23e4('0x2f')][_0x23e4('0x1d')]);}return _0x2c76d6[_0x23e4('0x4e')](_0x104450);}})[_0x23e4('0x24')](function(_0xfc6a21){if(_0xfc6a21){return _0xfc6a21?{'count':_0x5529d7,'rows':_0xfc6a21}:null;}})[_0x23e4('0x24')](respondWithResult(_0x1b57f6,null))[_0x23e4('0x43')](handleError(_0x1b57f6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b2e58bd..3fdaadc 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 _0x6257=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','../../config/logger'];(function(_0x5f3958,_0x5b1953){var _0x512fa1=function(_0x4a6034){while(--_0x4a6034){_0x5f3958['push'](_0x5f3958['shift']());}};_0x512fa1(++_0x5b1953);}(_0x6257,0x1d4));var _0x7625=function(_0x47a8ff,_0x1e65d1){_0x47a8ff=_0x47a8ff-0x0;var _0x10ba69=_0x6257[_0x47a8ff];return _0x10ba69;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var logger=require(_0x7625('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7625('0x2'));var rp=require(_0x7625('0x3'));var fs=require('fs');var path=require(_0x7625('0x4'));var rimraf=require(_0x7625('0x5'));var config=require(_0x7625('0x6'));var attributes=require(_0x7625('0x7'));module[_0x7625('0x8')]=function(_0x2ee215,_0x2340ab){return _0x2ee215[_0x7625('0x9')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b7=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','path'];(function(_0x422baa,_0x98d34a){var _0x31c810=function(_0xa554fe){while(--_0xa554fe){_0x422baa['push'](_0x422baa['shift']());}};_0x31c810(++_0x98d34a);}(_0x98b7,0xc1));var _0x798b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x98b7[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var logger=require(_0x798b('0x2'))(_0x798b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x798b('0x4'));var rimraf=require(_0x798b('0x5'));var config=require(_0x798b('0x6'));var attributes=require(_0x798b('0x7'));module[_0x798b('0x8')]=function(_0x4c197e,_0x2bab89){return _0x4c197e['define'](_0x798b('0x9'),attributes,{'tableName':_0x798b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 3789e90..b21ef50 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 _0x5353=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x38665e,_0x111a0a){var _0x66dd90=function(_0x423513){while(--_0x423513){_0x38665e['push'](_0x38665e['shift']());}};_0x66dd90(++_0x111a0a);}(_0x5353,0x12f));var _0x3535=function(_0x3848e7,_0x20147a){_0x3848e7=_0x3848e7-0x0;var _0x2d21be=_0x5353[_0x3848e7];return _0x2d21be;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var moment=require(_0x3535('0x1'));var BPromise=require(_0x3535('0x2'));var rs=require(_0x3535('0x3'));var fs=require('fs');var Redis=require(_0x3535('0x4'));var db=require(_0x3535('0x5'))['db'];var utils=require(_0x3535('0x6'));var logger=require(_0x3535('0x7'))(_0x3535('0x8'));var config=require(_0x3535('0x9'));var jayson=require(_0x3535('0xa'));var client=jayson['client'][_0x3535('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498868,_0x1c92fd,_0x268873){return new BPromise(function(_0x3e3500,_0x5437a2){return client[_0x3535('0xc')](_0x498868,_0x268873)[_0x3535('0xd')](function(_0x2da555){logger[_0x3535('0xe')](_0x3535('0xf'),_0x1c92fd,_0x3535('0x10'));logger['debug'](_0x3535('0x11'),_0x1c92fd,_0x3535('0x10'),JSON['stringify'](_0x2da555));if(_0x2da555[_0x3535('0x12')]){if(_0x2da555['error']['code']===0x1f4){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);return _0x5437a2(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}logger[_0x3535('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c92fd,_0x2da555[_0x3535('0x12')]['message']);return _0x3e3500(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}else{logger[_0x3535('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c92fd,_0x3535('0x10'));_0x3e3500(_0x2da555['result'][_0x3535('0x13')]);}})['catch'](function(_0x519c33){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x519c33);_0x5437a2(_0x519c33);});});} \ No newline at end of file +var _0x5c10=['request','request\x20sent','debug','error','message','info','result','catch','ServicenowConfiguration,\x20%s,\x20%s','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x244f28,_0x444117){var _0x5533e2=function(_0x3e9405){while(--_0x3e9405){_0x244f28['push'](_0x244f28['shift']());}};_0x5533e2(++_0x444117);}(_0x5c10,0x183));var _0x05c1=function(_0x4da2d4,_0x152cd3){_0x4da2d4=_0x4da2d4-0x0;var _0x265151=_0x5c10[_0x4da2d4];return _0x265151;};'use strict';var _=require(_0x05c1('0x0'));var util=require('util');var moment=require(_0x05c1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05c1('0x2'));var db=require(_0x05c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x05c1('0x4'))(_0x05c1('0x5'));var config=require('../../config/environment');var jayson=require(_0x05c1('0x6'));var client=jayson[_0x05c1('0x7')][_0x05c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x399a18,_0x51d30e,_0x12047d){return new BPromise(function(_0x5e46e3,_0x41a93f){return client[_0x05c1('0x9')](_0x399a18,_0x12047d)['then'](function(_0xf471c1){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x51d30e,_0x05c1('0xa'));logger[_0x05c1('0xb')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x51d30e,'request\x20sent',JSON['stringify'](_0xf471c1));if(_0xf471c1[_0x05c1('0xc')]){if(_0xf471c1[_0x05c1('0xc')]['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x51d30e,_0xf471c1['error'][_0x05c1('0xd')]);return _0x41a93f(_0xf471c1['error']['message']);}logger[_0x05c1('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x51d30e,_0xf471c1[_0x05c1('0xc')]['message']);return _0x5e46e3(_0xf471c1[_0x05c1('0xc')]['message']);}else{logger[_0x05c1('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x51d30e,_0x05c1('0xa'));_0x5e46e3(_0xf471c1[_0x05c1('0xf')][_0x05c1('0xd')]);}})[_0x05c1('0x10')](function(_0x405c3d){logger[_0x05c1('0xc')](_0x05c1('0x11'),_0x51d30e,_0x405c3d);_0x41a93f(_0x405c3d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index db12c86..9ac8142 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 _0x81af=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x81af,0xfa));var _0xf81a=function(_0x4a3df5,_0x2df3fb){_0x4a3df5=_0x4a3df5-0x0;var _0x54201d=_0x81af[_0x4a3df5];return _0x54201d;};'use strict';var multer=require('multer');var util=require(_0xf81a('0x0'));var path=require(_0xf81a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf81a('0x2')]();var fs_extra=require(_0xf81a('0x3'));var auth=require(_0xf81a('0x4'));var interaction=require(_0xf81a('0x5'));var config=require('../../config/environment');var controller=require(_0xf81a('0x6'));router[_0xf81a('0x7')]('/',auth[_0xf81a('0x8')](),controller[_0xf81a('0x9')]);router[_0xf81a('0x7')](_0xf81a('0xa'),auth[_0xf81a('0x8')](),controller['show']);router[_0xf81a('0xb')]('/',auth[_0xf81a('0x8')](),controller[_0xf81a('0xc')]);router['put'](_0xf81a('0xa'),auth[_0xf81a('0x8')](),controller[_0xf81a('0xd')]);router[_0xf81a('0xe')](_0xf81a('0xa'),auth[_0xf81a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc39e=['./intServicenowField.controller','get','isAuthenticated','index','/:id','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41bec0,_0x5f4b7f){var _0x25638c=function(_0x42b319){while(--_0x42b319){_0x41bec0['push'](_0x41bec0['shift']());}};_0x25638c(++_0x5f4b7f);}(_0xc39e,0x74));var _0xec39=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xc39e[_0x576266];return _0x18234f;};'use strict';var multer=require(_0xec39('0x0'));var util=require(_0xec39('0x1'));var path=require(_0xec39('0x2'));var timeout=require(_0xec39('0x3'));var express=require(_0xec39('0x4'));var router=express[_0xec39('0x5')]();var fs_extra=require(_0xec39('0x6'));var auth=require(_0xec39('0x7'));var interaction=require(_0xec39('0x8'));var config=require(_0xec39('0x9'));var controller=require(_0xec39('0xa'));router[_0xec39('0xb')]('/',auth[_0xec39('0xc')](),controller[_0xec39('0xd')]);router['get'](_0xec39('0xe'),auth[_0xec39('0xc')](),controller['show']);router[_0xec39('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xec39('0x10')](_0xec39('0xe'),auth[_0xec39('0xc')](),controller['update']);router[_0xec39('0x11')](_0xec39('0xe'),auth[_0xec39('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3326cc9..5c21212 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 _0x2924=['picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x4b64f2,_0x1302a8){var _0x3fde4a=function(_0x507720){while(--_0x507720){_0x4b64f2['push'](_0x4b64f2['shift']());}};_0x3fde4a(++_0x1302a8);}(_0x2924,0xcd));var _0x4292=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0x2924[_0xcd26a9];return _0x3afcbc;};'use strict';var Sequelize=require(_0x4292('0x0'));module[_0x4292('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x4292('0x2'),_0x4292('0x3'),_0x4292('0x4'),_0x4292('0x5')),'defaultValue':_0x4292('0x6')},'content':{'type':Sequelize[_0x4292('0x7')]},'key':{'type':Sequelize[_0x4292('0x7')]},'keyType':{'type':Sequelize[_0x4292('0x8')](_0x4292('0x6'),_0x4292('0x2'),_0x4292('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4292('0x7')]},'nameField':{'type':Sequelize[_0x4292('0x7')]},'customField':{'type':Sequelize[_0x4292('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4292('0x7')]}}; \ No newline at end of file +var _0x9a2c=['variable','keyValue','picklist','string','STRING','customVariable','sequelize','ENUM'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x9a2c,0xfe));var _0xc9a2=function(_0x318fb3,_0xb3c2ec){_0x318fb3=_0x318fb3-0x0;var _0x298c25=_0x9a2c[_0x318fb3];return _0x298c25;};'use strict';var Sequelize=require(_0xc9a2('0x0'));module['exports']={'type':{'type':Sequelize[_0xc9a2('0x1')]('string',_0xc9a2('0x2'),'customVariable',_0xc9a2('0x3'),_0xc9a2('0x4')),'defaultValue':_0xc9a2('0x5')},'content':{'type':Sequelize[_0xc9a2('0x6')]},'key':{'type':Sequelize[_0xc9a2('0x6')]},'keyType':{'type':Sequelize[_0xc9a2('0x1')](_0xc9a2('0x5'),_0xc9a2('0x2'),_0xc9a2('0x7'))},'keyContent':{'type':Sequelize[_0xc9a2('0x6')]},'idField':{'type':Sequelize[_0xc9a2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc9a2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b7961ba..13c4c66 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 _0x7178=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','ServicenowField','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x367995,_0x129ae2){var _0x22daa8=function(_0x4a2ceb){while(--_0x4a2ceb){_0x367995['push'](_0x367995['shift']());}};_0x22daa8(++_0x129ae2);}(_0x7178,0xe0));var _0x8717=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7178[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x8717('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8717('0x1'));var jsonpatch=require(_0x8717('0x2'));var rp=require(_0x8717('0x3'));var moment=require(_0x8717('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8717('0x5'));var util=require(_0x8717('0x6'));var path=require(_0x8717('0x7'));var sox=require(_0x8717('0x8'));var csv=require(_0x8717('0x9'));var ejs=require(_0x8717('0xa'));var fs=require('fs');var fs_extra=require(_0x8717('0xb'));var _=require(_0x8717('0xc'));var squel=require(_0x8717('0xd'));var crypto=require(_0x8717('0xe'));var jsforce=require(_0x8717('0xf'));var deskjs=require(_0x8717('0x10'));var toCsv=require(_0x8717('0x9'));var querystring=require('querystring');var Papa=require(_0x8717('0x11'));var Redis=require(_0x8717('0x12'));var authService=require(_0x8717('0x13'));var qs=require(_0x8717('0x14'));var as=require(_0x8717('0x15'));var hardwareService=require(_0x8717('0x16'));var logger=require(_0x8717('0x17'))(_0x8717('0x18'));var utils=require('../../config/utils');var config=require(_0x8717('0x19'));var licenseUtil=require(_0x8717('0x1a'));var db=require(_0x8717('0x1b'))['db'];function respondWithStatusCode(_0x17dbc6,_0x40fc7d){_0x40fc7d=_0x40fc7d||0xcc;return function(_0x243e8f){if(_0x243e8f){return _0x17dbc6[_0x8717('0x1c')](_0x40fc7d);}return _0x17dbc6[_0x8717('0x1d')](_0x40fc7d)[_0x8717('0x1e')]();};}function respondWithResult(_0x3cfee8,_0x143bd3){_0x143bd3=_0x143bd3||0xc8;return function(_0x123b37){if(_0x123b37){return _0x3cfee8['status'](_0x143bd3)[_0x8717('0x1f')](_0x123b37);}};}function respondWithFilteredResult(_0x3e1af8,_0x36240d){return function(_0xaf0b1c){if(_0xaf0b1c){var _0x462648=typeof _0x36240d[_0x8717('0x20')]===_0x8717('0x21')&&typeof _0x36240d['limit']==='undefined';var _0x3fe443=_0xaf0b1c[_0x8717('0x22')];var _0x539de4=_0x462648?0x0:_0x36240d['offset'];var _0x349c79=_0x462648?_0xaf0b1c[_0x8717('0x22')]:_0x36240d['offset']+_0x36240d[_0x8717('0x23')];var _0x168298;if(_0x349c79>=_0x3fe443){_0x349c79=_0x3fe443;_0x168298=0xc8;}else{_0x168298=0xce;}_0x3e1af8[_0x8717('0x1d')](_0x168298);return _0x3e1af8[_0x8717('0x24')](_0x8717('0x25'),_0x539de4+'-'+_0x349c79+'/'+_0x3fe443)[_0x8717('0x1f')](_0xaf0b1c);}return null;};}function patchUpdates(_0x36b7b6){return function(_0x31d2b1){try{jsonpatch[_0x8717('0x26')](_0x31d2b1,_0x36b7b6,!![]);}catch(_0x27b842){return BPromise[_0x8717('0x27')](_0x27b842);}return _0x31d2b1[_0x8717('0x28')]();};}function saveUpdates(_0x800a59,_0x33c812){return function(_0x50516){if(_0x50516){return _0x50516[_0x8717('0x29')](_0x800a59)[_0x8717('0x2a')](function(_0x39be4d){return _0x39be4d;});}return null;};}function removeEntity(_0x4fa949,_0x2083bc){return function(_0x7436c){if(_0x7436c){return _0x7436c[_0x8717('0x2b')]()['then'](function(){_0x4fa949[_0x8717('0x1d')](0xcc)[_0x8717('0x1e')]();});}};}function handleEntityNotFound(_0x552250,_0x577250){return function(_0x524b8b){if(!_0x524b8b){_0x552250[_0x8717('0x1c')](0x194);}return _0x524b8b;};}function handleError(_0x2535bf,_0x151091){_0x151091=_0x151091||0x1f4;return function(_0x298881){logger[_0x8717('0x2c')](_0x298881[_0x8717('0x2d')]);if(_0x298881[_0x8717('0x2e')]){delete _0x298881['name'];}_0x2535bf['status'](_0x151091)['send'](_0x298881);};}exports['index']=function(_0x4e9eeb,_0xaa1633){var _0x5a5cc6={},_0x36d01a={},_0x4ae469={'count':0x0,'rows':[]};var _0xbbfc9=_[_0x8717('0x2f')](db['ServicenowField']['rawAttributes'],function(_0x4821d4){return{'name':_0x4821d4[_0x8717('0x30')],'type':_0x4821d4[_0x8717('0x31')][_0x8717('0x32')]};});_0x36d01a[_0x8717('0x33')]=_[_0x8717('0x2f')](_0xbbfc9,_0x8717('0x2e'));_0x36d01a[_0x8717('0x34')]=_[_0x8717('0x35')](_0x4e9eeb[_0x8717('0x34')]);_0x36d01a['filters']=_[_0x8717('0x36')](_0x36d01a[_0x8717('0x33')],_0x36d01a[_0x8717('0x34')]);_0x5a5cc6[_0x8717('0x37')]=_[_0x8717('0x36')](_0x36d01a[_0x8717('0x33')],qs[_0x8717('0x38')](_0x4e9eeb[_0x8717('0x34')]['fields']));_0x5a5cc6[_0x8717('0x37')]=_0x5a5cc6[_0x8717('0x37')][_0x8717('0x39')]?_0x5a5cc6[_0x8717('0x37')]:_0x36d01a['model'];if(!_0x4e9eeb['query'][_0x8717('0x3a')](_0x8717('0x3b'))){_0x5a5cc6['limit']=qs['limit'](_0x4e9eeb[_0x8717('0x34')][_0x8717('0x23')]);_0x5a5cc6[_0x8717('0x20')]=qs[_0x8717('0x20')](_0x4e9eeb[_0x8717('0x34')][_0x8717('0x20')]);}_0x5a5cc6[_0x8717('0x3c')]=qs[_0x8717('0x3d')](_0x4e9eeb[_0x8717('0x34')]['sort']);_0x5a5cc6[_0x8717('0x3e')]=qs[_0x8717('0x3f')](_[_0x8717('0x40')](_0x4e9eeb[_0x8717('0x34')],_0x36d01a[_0x8717('0x3f')]),_0xbbfc9);if(_0x4e9eeb['query'][_0x8717('0x41')]){_0x5a5cc6['where']=_['merge'](_0x5a5cc6[_0x8717('0x3e')],{'$or':_[_0x8717('0x2f')](_0xbbfc9,function(_0x38a2cf){if(_0x38a2cf[_0x8717('0x31')]!==_0x8717('0x42')){var _0x515dc7={};_0x515dc7[_0x38a2cf['name']]={'$like':'%'+_0x4e9eeb[_0x8717('0x34')]['filter']+'%'};return _0x515dc7;}})});}_0x5a5cc6=_[_0x8717('0x43')]({},_0x5a5cc6,_0x4e9eeb['options']);var _0x42e372={'where':_0x5a5cc6[_0x8717('0x3e')]};return db[_0x8717('0x44')]['count'](_0x42e372)[_0x8717('0x2a')](function(_0x38198c){_0x4ae469[_0x8717('0x22')]=_0x38198c;if(_0x4e9eeb[_0x8717('0x34')][_0x8717('0x45')]){_0x5a5cc6[_0x8717('0x46')]=[{'all':!![]}];}return db[_0x8717('0x44')]['findAll'](_0x5a5cc6);})[_0x8717('0x2a')](function(_0x56bb8d){_0x4ae469[_0x8717('0x47')]=_0x56bb8d;return _0x4ae469;})['then'](respondWithFilteredResult(_0xaa1633,_0x5a5cc6))[_0x8717('0x48')](handleError(_0xaa1633,null));};exports[_0x8717('0x49')]=function(_0x137da5,_0x2bc20c){var _0xeb9aaa={'raw':!![],'where':{'id':_0x137da5[_0x8717('0x4a')]['id']}},_0x4fc856={};_0x4fc856[_0x8717('0x33')]=_[_0x8717('0x35')](db[_0x8717('0x44')]['rawAttributes']);_0x4fc856[_0x8717('0x34')]=_['keys'](_0x137da5[_0x8717('0x34')]);_0x4fc856[_0x8717('0x3f')]=_['intersection'](_0x4fc856[_0x8717('0x33')],_0x4fc856[_0x8717('0x34')]);_0xeb9aaa[_0x8717('0x37')]=_['intersection'](_0x4fc856['model'],qs[_0x8717('0x38')](_0x137da5[_0x8717('0x34')]['fields']));_0xeb9aaa['attributes']=_0xeb9aaa[_0x8717('0x37')]['length']?_0xeb9aaa[_0x8717('0x37')]:_0x4fc856['model'];if(_0x137da5[_0x8717('0x34')][_0x8717('0x45')]){_0xeb9aaa[_0x8717('0x46')]=[{'all':!![]}];}_0xeb9aaa=_[_0x8717('0x43')]({},_0xeb9aaa,_0x137da5[_0x8717('0x4b')]);return db[_0x8717('0x44')][_0x8717('0x4c')](_0xeb9aaa)[_0x8717('0x2a')](handleEntityNotFound(_0x2bc20c,null))['then'](respondWithResult(_0x2bc20c,null))[_0x8717('0x48')](handleError(_0x2bc20c,null));};exports[_0x8717('0x4d')]=function(_0x173d69,_0x5bca95){return db[_0x8717('0x44')][_0x8717('0x4d')](_0x173d69[_0x8717('0x4e')],{})[_0x8717('0x2a')](respondWithResult(_0x5bca95,0xc9))[_0x8717('0x48')](handleError(_0x5bca95,null));};exports[_0x8717('0x29')]=function(_0x3809a4,_0x191243){if(_0x3809a4[_0x8717('0x4e')]['id']){delete _0x3809a4['body']['id'];}return db[_0x8717('0x44')][_0x8717('0x4c')]({'where':{'id':_0x3809a4[_0x8717('0x4a')]['id']}})[_0x8717('0x2a')](handleEntityNotFound(_0x191243,null))[_0x8717('0x2a')](saveUpdates(_0x3809a4[_0x8717('0x4e')],null))[_0x8717('0x2a')](respondWithResult(_0x191243,null))[_0x8717('0x48')](handleError(_0x191243,null));};exports[_0x8717('0x2b')]=function(_0x524de8,_0x4c8e77){return db[_0x8717('0x44')][_0x8717('0x4c')]({'where':{'id':_0x524de8[_0x8717('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c8e77,null))[_0x8717('0x2a')](removeEntity(_0x4c8e77,null))[_0x8717('0x48')](handleError(_0x4c8e77,null));}; \ No newline at end of file +var _0x3dff=['includeAll','include','ServicenowField','findAll','rows','show','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x3dff,0x13b));var _0xf3df=function(_0x168bb8,_0x2f16f9){_0x168bb8=_0x168bb8-0x0;var _0x48a84d=_0x3dff[_0x168bb8];return _0x48a84d;};'use strict';var emlformat=require(_0xf3df('0x0'));var rimraf=require(_0xf3df('0x1'));var zipdir=require(_0xf3df('0x2'));var jsonpatch=require(_0xf3df('0x3'));var rp=require(_0xf3df('0x4'));var moment=require(_0xf3df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf3df('0x6'));var util=require(_0xf3df('0x7'));var path=require(_0xf3df('0x8'));var sox=require(_0xf3df('0x9'));var csv=require(_0xf3df('0xa'));var ejs=require(_0xf3df('0xb'));var fs=require('fs');var fs_extra=require(_0xf3df('0xc'));var _=require(_0xf3df('0xd'));var squel=require(_0xf3df('0xe'));var crypto=require(_0xf3df('0xf'));var jsforce=require(_0xf3df('0x10'));var deskjs=require(_0xf3df('0x11'));var toCsv=require(_0xf3df('0xa'));var querystring=require('querystring');var Papa=require(_0xf3df('0x12'));var Redis=require(_0xf3df('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf3df('0x14'));var as=require(_0xf3df('0x15'));var hardwareService=require(_0xf3df('0x16'));var logger=require(_0xf3df('0x17'))(_0xf3df('0x18'));var utils=require('../../config/utils');var config=require(_0xf3df('0x19'));var licenseUtil=require(_0xf3df('0x1a'));var db=require(_0xf3df('0x1b'))['db'];function respondWithStatusCode(_0x20c411,_0x282461){_0x282461=_0x282461||0xcc;return function(_0x52987f){if(_0x52987f){return _0x20c411['sendStatus'](_0x282461);}return _0x20c411[_0xf3df('0x1c')](_0x282461)[_0xf3df('0x1d')]();};}function respondWithResult(_0x44de4a,_0x56ba17){_0x56ba17=_0x56ba17||0xc8;return function(_0x57ac2b){if(_0x57ac2b){return _0x44de4a[_0xf3df('0x1c')](_0x56ba17)[_0xf3df('0x1e')](_0x57ac2b);}};}function respondWithFilteredResult(_0x404c64,_0x5f522b){return function(_0x353295){if(_0x353295){var _0x55da0a=typeof _0x5f522b[_0xf3df('0x1f')]==='undefined'&&typeof _0x5f522b[_0xf3df('0x20')]==='undefined';var _0x5077b1=_0x353295['count'];var _0x2a0d12=_0x55da0a?0x0:_0x5f522b['offset'];var _0x33e7e8=_0x55da0a?_0x353295[_0xf3df('0x21')]:_0x5f522b[_0xf3df('0x1f')]+_0x5f522b[_0xf3df('0x20')];var _0x57e962;if(_0x33e7e8>=_0x5077b1){_0x33e7e8=_0x5077b1;_0x57e962=0xc8;}else{_0x57e962=0xce;}_0x404c64[_0xf3df('0x1c')](_0x57e962);return _0x404c64[_0xf3df('0x22')](_0xf3df('0x23'),_0x2a0d12+'-'+_0x33e7e8+'/'+_0x5077b1)[_0xf3df('0x1e')](_0x353295);}return null;};}function patchUpdates(_0x532292){return function(_0x942a7e){try{jsonpatch[_0xf3df('0x24')](_0x942a7e,_0x532292,!![]);}catch(_0x2a6a22){return BPromise['reject'](_0x2a6a22);}return _0x942a7e['save']();};}function saveUpdates(_0xede337,_0x182846){return function(_0x45f218){if(_0x45f218){return _0x45f218[_0xf3df('0x25')](_0xede337)[_0xf3df('0x26')](function(_0x503ad4){return _0x503ad4;});}return null;};}function removeEntity(_0x102a1e,_0xbe2a9f){return function(_0x3bb6bd){if(_0x3bb6bd){return _0x3bb6bd[_0xf3df('0x27')]()[_0xf3df('0x26')](function(){_0x102a1e[_0xf3df('0x1c')](0xcc)[_0xf3df('0x1d')]();});}};}function handleEntityNotFound(_0x38ebc7,_0x131660){return function(_0x467654){if(!_0x467654){_0x38ebc7[_0xf3df('0x28')](0x194);}return _0x467654;};}function handleError(_0x272bef,_0x25f17a){_0x25f17a=_0x25f17a||0x1f4;return function(_0x1c2fd3){logger[_0xf3df('0x29')](_0x1c2fd3['stack']);if(_0x1c2fd3[_0xf3df('0x2a')]){delete _0x1c2fd3['name'];}_0x272bef['status'](_0x25f17a)['send'](_0x1c2fd3);};}exports[_0xf3df('0x2b')]=function(_0x5c94e3,_0x2296fb){var _0x417b59={},_0x1055b3={},_0x3f36ce={'count':0x0,'rows':[]};var _0x2e8b03=_['map'](db['ServicenowField'][_0xf3df('0x2c')],function(_0x287939){return{'name':_0x287939[_0xf3df('0x2d')],'type':_0x287939[_0xf3df('0x2e')][_0xf3df('0x2f')]};});_0x1055b3[_0xf3df('0x30')]=_[_0xf3df('0x31')](_0x2e8b03,_0xf3df('0x2a'));_0x1055b3[_0xf3df('0x32')]=_[_0xf3df('0x33')](_0x5c94e3[_0xf3df('0x32')]);_0x1055b3[_0xf3df('0x34')]=_[_0xf3df('0x35')](_0x1055b3[_0xf3df('0x30')],_0x1055b3[_0xf3df('0x32')]);_0x417b59['attributes']=_[_0xf3df('0x35')](_0x1055b3[_0xf3df('0x30')],qs['fields'](_0x5c94e3[_0xf3df('0x32')][_0xf3df('0x36')]));_0x417b59[_0xf3df('0x37')]=_0x417b59[_0xf3df('0x37')][_0xf3df('0x38')]?_0x417b59['attributes']:_0x1055b3['model'];if(!_0x5c94e3[_0xf3df('0x32')][_0xf3df('0x39')]('nolimit')){_0x417b59[_0xf3df('0x20')]=qs['limit'](_0x5c94e3[_0xf3df('0x32')]['limit']);_0x417b59['offset']=qs[_0xf3df('0x1f')](_0x5c94e3['query'][_0xf3df('0x1f')]);}_0x417b59[_0xf3df('0x3a')]=qs[_0xf3df('0x3b')](_0x5c94e3['query'][_0xf3df('0x3b')]);_0x417b59[_0xf3df('0x3c')]=qs['filters'](_['pick'](_0x5c94e3[_0xf3df('0x32')],_0x1055b3[_0xf3df('0x34')]),_0x2e8b03);if(_0x5c94e3['query'][_0xf3df('0x3d')]){_0x417b59[_0xf3df('0x3c')]=_[_0xf3df('0x3e')](_0x417b59['where'],{'$or':_['map'](_0x2e8b03,function(_0x4ebe69){if(_0x4ebe69[_0xf3df('0x2e')]!==_0xf3df('0x3f')){var _0x4aba67={};_0x4aba67[_0x4ebe69[_0xf3df('0x2a')]]={'$like':'%'+_0x5c94e3[_0xf3df('0x32')][_0xf3df('0x3d')]+'%'};return _0x4aba67;}})});}_0x417b59=_[_0xf3df('0x3e')]({},_0x417b59,_0x5c94e3[_0xf3df('0x40')]);var _0x31b2c1={'where':_0x417b59[_0xf3df('0x3c')]};return db['ServicenowField'][_0xf3df('0x21')](_0x31b2c1)['then'](function(_0x1091fe){_0x3f36ce[_0xf3df('0x21')]=_0x1091fe;if(_0x5c94e3['query'][_0xf3df('0x41')]){_0x417b59[_0xf3df('0x42')]=[{'all':!![]}];}return db[_0xf3df('0x43')][_0xf3df('0x44')](_0x417b59);})[_0xf3df('0x26')](function(_0x28fc7b){_0x3f36ce[_0xf3df('0x45')]=_0x28fc7b;return _0x3f36ce;})[_0xf3df('0x26')](respondWithFilteredResult(_0x2296fb,_0x417b59))['catch'](handleError(_0x2296fb,null));};exports[_0xf3df('0x46')]=function(_0x14cd14,_0x48c0f1){var _0x5f1171={'raw':!![],'where':{'id':_0x14cd14['params']['id']}},_0x3eff1a={};_0x3eff1a['model']=_[_0xf3df('0x33')](db[_0xf3df('0x43')][_0xf3df('0x2c')]);_0x3eff1a['query']=_[_0xf3df('0x33')](_0x14cd14[_0xf3df('0x32')]);_0x3eff1a[_0xf3df('0x34')]=_['intersection'](_0x3eff1a[_0xf3df('0x30')],_0x3eff1a[_0xf3df('0x32')]);_0x5f1171[_0xf3df('0x37')]=_[_0xf3df('0x35')](_0x3eff1a['model'],qs[_0xf3df('0x36')](_0x14cd14[_0xf3df('0x32')][_0xf3df('0x36')]));_0x5f1171[_0xf3df('0x37')]=_0x5f1171[_0xf3df('0x37')]['length']?_0x5f1171['attributes']:_0x3eff1a[_0xf3df('0x30')];if(_0x14cd14[_0xf3df('0x32')]['includeAll']){_0x5f1171[_0xf3df('0x42')]=[{'all':!![]}];}_0x5f1171=_[_0xf3df('0x3e')]({},_0x5f1171,_0x14cd14[_0xf3df('0x40')]);return db[_0xf3df('0x43')][_0xf3df('0x47')](_0x5f1171)[_0xf3df('0x26')](handleEntityNotFound(_0x48c0f1,null))['then'](respondWithResult(_0x48c0f1,null))['catch'](handleError(_0x48c0f1,null));};exports[_0xf3df('0x48')]=function(_0x363858,_0x57137b){return db['ServicenowField'][_0xf3df('0x48')](_0x363858[_0xf3df('0x49')],{})[_0xf3df('0x26')](respondWithResult(_0x57137b,0xc9))[_0xf3df('0x4a')](handleError(_0x57137b,null));};exports[_0xf3df('0x25')]=function(_0x4f3448,_0x214d5a){if(_0x4f3448[_0xf3df('0x49')]['id']){delete _0x4f3448[_0xf3df('0x49')]['id'];}return db[_0xf3df('0x43')][_0xf3df('0x47')]({'where':{'id':_0x4f3448[_0xf3df('0x4b')]['id']}})[_0xf3df('0x26')](handleEntityNotFound(_0x214d5a,null))[_0xf3df('0x26')](saveUpdates(_0x4f3448[_0xf3df('0x49')],null))[_0xf3df('0x26')](respondWithResult(_0x214d5a,null))[_0xf3df('0x4a')](handleError(_0x214d5a,null));};exports[_0xf3df('0x27')]=function(_0x2aee57,_0xf2b0ea){return db[_0xf3df('0x43')]['find']({'where':{'id':_0x2aee57[_0xf3df('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf2b0ea,null))[_0xf3df('0x26')](removeEntity(_0xf2b0ea,null))[_0xf3df('0x4a')](handleError(_0xf2b0ea,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5ffecc0..2c9f76b 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 _0x7870=['int_servicenow_fields','servicenow_unique_index','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','define','ServicenowField'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0x7870,0xf9));var _0x0787=function(_0x327537,_0x588cb0){_0x327537=_0x327537-0x0;var _0x390167=_0x7870[_0x327537];return _0x390167;};'use strict';var _=require(_0x0787('0x0'));var util=require(_0x0787('0x1'));var logger=require('../../config/logger')(_0x0787('0x2'));var moment=require(_0x0787('0x3'));var BPromise=require(_0x0787('0x4'));var rp=require(_0x0787('0x5'));var fs=require('fs');var path=require(_0x0787('0x6'));var rimraf=require('rimraf');var config=require(_0x0787('0x7'));var attributes=require(_0x0787('0x8'));module['exports']=function(_0x420292,_0x3e3c2b){return _0x420292[_0x0787('0x9')](_0x0787('0xa'),attributes,{'tableName':_0x0787('0xb'),'paranoid':![],'indexes':[{'name':_0x0787('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x904c=['./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x904c,0xd9));var _0xc904=function(_0x2398b4,_0x117cbd){_0x2398b4=_0x2398b4-0x0;var _0x3457fd=_0x904c[_0x2398b4];return _0x3457fd;};'use strict';var _=require(_0xc904('0x0'));var util=require(_0xc904('0x1'));var logger=require(_0xc904('0x2'))(_0xc904('0x3'));var moment=require(_0xc904('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc904('0x5'));var rimraf=require(_0xc904('0x6'));var config=require(_0xc904('0x7'));var attributes=require(_0xc904('0x8'));module[_0xc904('0x9')]=function(_0x579ceb,_0x31c0a9){return _0x579ceb[_0xc904('0xa')](_0xc904('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc904('0xc'),'fields':[_0xc904('0xd'),_0xc904('0xe')],'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 840ee94..319c34c 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0xe955d,_0x21334b){var _0x504b38=function(_0x1bdb02){while(--_0x1bdb02){_0xe955d['push'](_0xe955d['shift']());}};_0x504b38(++_0x21334b);}(_0xe706,0xa3));var _0x6e70=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xe706[_0x456bd2];return _0x2218c1;};'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']('ServicenowField,\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']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x2478ad,_0x1cc494){var _0xfcbc6f=function(_0x40f0a1){while(--_0x40f0a1){_0x2478ad['push'](_0x2478ad['shift']());}};_0xfcbc6f(++_0x1cc494);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index d84ac92..1bc7d20 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5004ab,_0x2dbfaa){var _0x34ec4b=function(_0x4e38e8){while(--_0x4e38e8){_0x5004ab['push'](_0x5004ab['shift']());}};_0x34ec4b(++_0x2dbfaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x189de8,_0x4c8c4a){var _0x3cafdb=function(_0x1d1fbf){while(--_0x1d1fbf){_0x189de8['push'](_0x189de8['shift']());}};_0x3cafdb(++_0x4c8c4a);}(_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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 483a062..eee9b28 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(_0x4e7def,_0x3a507e){var _0x41ab8d=function(_0x5abbe6){while(--_0x5abbe6){_0x4e7def['push'](_0x4e7def['shift']());}};_0x41ab8d(++_0x3a507e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x35b0ae,_0x18a193){var _0x10e39b=function(_0xca256e){while(--_0xca256e){_0x35b0ae['push'](_0x35b0ae['shift']());}};_0x10e39b(++_0x18a193);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 a5af6e2..9676f8e 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 _0x8886=['catch','show','params','fields','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','stringify','Calls','values','module_fields','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x430d57,_0x403601){var _0x2d4d55=function(_0x44d365){while(--_0x44d365){_0x430d57['push'](_0x430d57['shift']());}};_0x2d4d55(++_0x403601);}(_0x8886,0xa9));var _0x6888=function(_0x546de0,_0xa8df16){_0x546de0=_0x546de0-0x0;var _0x2c1990=_0x8886[_0x546de0];return _0x2c1990;};'use strict';var emlformat=require(_0x6888('0x0'));var rimraf=require(_0x6888('0x1'));var zipdir=require(_0x6888('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6888('0x3'));var BPromise=require(_0x6888('0x4'));var Mustache=require(_0x6888('0x5'));var util=require(_0x6888('0x6'));var path=require('path');var sox=require(_0x6888('0x7'));var csv=require(_0x6888('0x8'));var ejs=require(_0x6888('0x9'));var fs=require('fs');var fs_extra=require(_0x6888('0xa'));var _=require(_0x6888('0xb'));var squel=require('squel');var crypto=require(_0x6888('0xc'));var jsforce=require(_0x6888('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6888('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6888('0xe'));var qs=require(_0x6888('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6888('0x10'));var logger=require(_0x6888('0x11'))(_0x6888('0x12'));var utils=require(_0x6888('0x13'));var config=require(_0x6888('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6888('0x15'))['db'];var integrations=require(_0x6888('0x16'));function respondWithStatusCode(_0xc3e113,_0x4b446d){_0x4b446d=_0x4b446d||0xcc;return function(_0xdbad5e){if(_0xdbad5e){return _0xc3e113[_0x6888('0x17')](_0x4b446d);}return _0xc3e113[_0x6888('0x18')](_0x4b446d)[_0x6888('0x19')]();};}function respondWithResult(_0x31679c,_0x1f78ef){_0x1f78ef=_0x1f78ef||0xc8;return function(_0x144ee1){if(_0x144ee1){return _0x31679c[_0x6888('0x18')](_0x1f78ef)['json'](_0x144ee1);}};}function respondWithFilteredResult(_0x1384f8,_0x3bfd2b){return function(_0x475c97){if(_0x475c97){var _0x5d65f6=typeof _0x3bfd2b[_0x6888('0x1a')]===_0x6888('0x1b')&&typeof _0x3bfd2b[_0x6888('0x1c')]==='undefined';var _0x559e4e=_0x475c97['count'];var _0x264725=_0x5d65f6?0x0:_0x3bfd2b['offset'];var _0x5f2a79=_0x5d65f6?_0x475c97[_0x6888('0x1d')]:_0x3bfd2b[_0x6888('0x1a')]+_0x3bfd2b[_0x6888('0x1c')];var _0x51d8fa;if(_0x5f2a79>=_0x559e4e){_0x5f2a79=_0x559e4e;_0x51d8fa=0xc8;}else{_0x51d8fa=0xce;}_0x1384f8[_0x6888('0x18')](_0x51d8fa);return _0x1384f8[_0x6888('0x1e')](_0x6888('0x1f'),_0x264725+'-'+_0x5f2a79+'/'+_0x559e4e)['json'](_0x475c97);}return null;};}function patchUpdates(_0x4017cd){return function(_0x4f1bf1){try{jsonpatch['apply'](_0x4f1bf1,_0x4017cd,!![]);}catch(_0x3f78f4){return BPromise[_0x6888('0x20')](_0x3f78f4);}return _0x4f1bf1[_0x6888('0x21')]();};}function saveUpdates(_0x1a5ae8,_0x3de320){return function(_0x2c8527){if(_0x2c8527){return _0x2c8527[_0x6888('0x22')](_0x1a5ae8)[_0x6888('0x23')](function(_0x2b4ddd){return _0x2b4ddd;});}return null;};}function removeEntity(_0x56bbdf,_0xbb4876){return function(_0x42fd4c){if(_0x42fd4c){return _0x42fd4c[_0x6888('0x24')]()['then'](function(){_0x56bbdf[_0x6888('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585275,_0x348409){return function(_0x339323){if(!_0x339323){_0x585275[_0x6888('0x17')](0x194);}return _0x339323;};}function handleError(_0xb107ae,_0x5db6c2){_0x5db6c2=_0x5db6c2||0x1f4;return function(_0x391937){logger[_0x6888('0x25')](_0x391937[_0x6888('0x26')]);if(_0x391937['name']){delete _0x391937[_0x6888('0x27')];}_0xb107ae[_0x6888('0x18')](_0x5db6c2)[_0x6888('0x28')](_0x391937);};}exports['index']=function(_0x42ddda,_0x2ed404){var _0x5e7a72={},_0x50ff5a={},_0x12c4b7={'count':0x0,'rows':[]};var _0x11d9a3=_[_0x6888('0x29')](db[_0x6888('0x2a')][_0x6888('0x2b')],function(_0x38a630){return{'name':_0x38a630[_0x6888('0x2c')],'type':_0x38a630[_0x6888('0x2d')][_0x6888('0x2e')]};});_0x50ff5a[_0x6888('0x2f')]=_['map'](_0x11d9a3,_0x6888('0x27'));_0x50ff5a['query']=_[_0x6888('0x30')](_0x42ddda['query']);_0x50ff5a['filters']=_[_0x6888('0x31')](_0x50ff5a[_0x6888('0x2f')],_0x50ff5a[_0x6888('0x32')]);_0x5e7a72['attributes']=_['intersection'](_0x50ff5a[_0x6888('0x2f')],qs['fields'](_0x42ddda[_0x6888('0x32')]['fields']));_0x5e7a72[_0x6888('0x33')]=_0x5e7a72[_0x6888('0x33')][_0x6888('0x34')]?_0x5e7a72[_0x6888('0x33')]:_0x50ff5a[_0x6888('0x2f')];if(!_0x42ddda['query']['hasOwnProperty'](_0x6888('0x35'))){_0x5e7a72[_0x6888('0x1c')]=qs[_0x6888('0x1c')](_0x42ddda[_0x6888('0x32')][_0x6888('0x1c')]);_0x5e7a72[_0x6888('0x1a')]=qs[_0x6888('0x1a')](_0x42ddda[_0x6888('0x32')]['offset']);}_0x5e7a72[_0x6888('0x36')]=qs[_0x6888('0x37')](_0x42ddda[_0x6888('0x32')][_0x6888('0x37')]);_0x5e7a72[_0x6888('0x38')]=qs[_0x6888('0x39')](_[_0x6888('0x3a')](_0x42ddda[_0x6888('0x32')],_0x50ff5a[_0x6888('0x39')]),_0x11d9a3);if(_0x42ddda[_0x6888('0x32')][_0x6888('0x3b')]){_0x5e7a72[_0x6888('0x38')]=_[_0x6888('0x3c')](_0x5e7a72[_0x6888('0x38')],{'$or':_[_0x6888('0x29')](_0x11d9a3,function(_0x2e8b29){if(_0x2e8b29[_0x6888('0x2d')]!==_0x6888('0x3d')){var _0x247b51={};_0x247b51[_0x2e8b29['name']]={'$like':'%'+_0x42ddda['query'][_0x6888('0x3b')]+'%'};return _0x247b51;}})});}_0x5e7a72=_[_0x6888('0x3c')]({},_0x5e7a72,_0x42ddda[_0x6888('0x3e')]);var _0x36a02d={'where':_0x5e7a72[_0x6888('0x38')]};return db[_0x6888('0x2a')][_0x6888('0x1d')](_0x36a02d)['then'](function(_0x4be169){_0x12c4b7[_0x6888('0x1d')]=_0x4be169;if(_0x42ddda['query'][_0x6888('0x3f')]){_0x5e7a72[_0x6888('0x40')]=[{'all':!![]}];}return db[_0x6888('0x2a')][_0x6888('0x41')](_0x5e7a72);})['then'](function(_0x3a8b5c){_0x12c4b7[_0x6888('0x42')]=_0x3a8b5c;return _0x12c4b7;})[_0x6888('0x23')](respondWithFilteredResult(_0x2ed404,_0x5e7a72))[_0x6888('0x43')](handleError(_0x2ed404,null));};exports[_0x6888('0x44')]=function(_0x1efebf,_0x329881){var _0x59fa05={'raw':![],'where':{'id':_0x1efebf[_0x6888('0x45')]['id']}},_0x42d7f0={};_0x42d7f0[_0x6888('0x2f')]=_[_0x6888('0x30')](db[_0x6888('0x2a')][_0x6888('0x2b')]);_0x42d7f0[_0x6888('0x32')]=_[_0x6888('0x30')](_0x1efebf['query']);_0x42d7f0[_0x6888('0x39')]=_['intersection'](_0x42d7f0['model'],_0x42d7f0['query']);_0x59fa05[_0x6888('0x33')]=_['intersection'](_0x42d7f0[_0x6888('0x2f')],qs[_0x6888('0x46')](_0x1efebf[_0x6888('0x32')][_0x6888('0x46')]));_0x59fa05[_0x6888('0x33')]=_0x59fa05['attributes'][_0x6888('0x34')]?_0x59fa05[_0x6888('0x33')]:_0x42d7f0['model'];if(_0x1efebf['query'][_0x6888('0x3f')]){_0x59fa05['include']=[{'all':!![]}];}_0x59fa05=_[_0x6888('0x3c')]({},_0x59fa05,_0x1efebf[_0x6888('0x3e')]);return db[_0x6888('0x2a')]['find'](_0x59fa05)[_0x6888('0x23')](handleEntityNotFound(_0x329881,null))[_0x6888('0x23')](respondWithResult(_0x329881,null))[_0x6888('0x43')](handleError(_0x329881,null));};exports[_0x6888('0x47')]=function(_0x3cde89,_0x4216d7){return db['SugarcrmAccount'][_0x6888('0x47')](_0x3cde89['body'],{})[_0x6888('0x23')](respondWithResult(_0x4216d7,0xc9))[_0x6888('0x43')](handleError(_0x4216d7,null));};exports['update']=function(_0xfa654b,_0x3ccf5f){if(_0xfa654b[_0x6888('0x48')]['id']){delete _0xfa654b[_0x6888('0x48')]['id'];}return db[_0x6888('0x2a')][_0x6888('0x49')]({'where':{'id':_0xfa654b[_0x6888('0x45')]['id']}})[_0x6888('0x23')](handleEntityNotFound(_0x3ccf5f,null))[_0x6888('0x23')](saveUpdates(_0xfa654b['body'],null))['then'](respondWithResult(_0x3ccf5f,null))[_0x6888('0x43')](handleError(_0x3ccf5f,null));};exports[_0x6888('0x24')]=function(_0x261d7f,_0xdf48ed){return db[_0x6888('0x2a')][_0x6888('0x49')]({'where':{'id':_0x261d7f[_0x6888('0x45')]['id']}})['then'](handleEntityNotFound(_0xdf48ed,null))[_0x6888('0x23')](removeEntity(_0xdf48ed,null))[_0x6888('0x43')](handleError(_0xdf48ed,null));};exports[_0x6888('0x4a')]=function(_0x236cda,_0x5350fe,_0x46a555){var _0xc71172={};var _0x24b78b={};var _0x30939d;var _0x2dc8f2;return db['SugarcrmAccount'][_0x6888('0x4b')]({'where':{'id':_0x236cda[_0x6888('0x45')]['id']}})['then'](handleEntityNotFound(_0x5350fe,null))[_0x6888('0x23')](function(_0x189885){if(_0x189885){_0x30939d=_0x189885;_0x24b78b['model']=_[_0x6888('0x30')](db[_0x6888('0x4c')][_0x6888('0x2b')]);_0x24b78b[_0x6888('0x32')]=_[_0x6888('0x30')](_0x236cda['query']);_0x24b78b[_0x6888('0x39')]=_[_0x6888('0x31')](_0x24b78b['model'],_0x24b78b[_0x6888('0x32')]);_0xc71172[_0x6888('0x33')]=_['intersection'](_0x24b78b[_0x6888('0x2f')],qs['fields'](_0x236cda[_0x6888('0x32')][_0x6888('0x46')]));_0xc71172['attributes']=_0xc71172[_0x6888('0x33')][_0x6888('0x34')]?_0xc71172[_0x6888('0x33')]:_0x24b78b[_0x6888('0x2f')];_0xc71172['order']=qs['sort'](_0x236cda['query']['sort']);_0xc71172['where']=qs[_0x6888('0x39')](_[_0x6888('0x3a')](_0x236cda[_0x6888('0x32')],_0x24b78b[_0x6888('0x39')]));if(_0x236cda['query']['filter']){_0xc71172[_0x6888('0x38')]=_[_0x6888('0x3c')](_0xc71172[_0x6888('0x38')],{'$or':_[_0x6888('0x29')](_0xc71172[_0x6888('0x33')],function(_0x272106){var _0x3fc67b={};_0x3fc67b[_0x272106]={'$like':'%'+_0x236cda[_0x6888('0x32')][_0x6888('0x3b')]+'%'};return _0x3fc67b;})});}_0xc71172=_['merge']({},_0xc71172,_0x236cda['options']);return _0x30939d[_0x6888('0x4a')](_0xc71172);}})[_0x6888('0x23')](function(_0x391af1){if(_0x391af1){_0x2dc8f2=_0x391af1['length'];if(!_0x236cda['query']['hasOwnProperty'](_0x6888('0x35'))){_0xc71172[_0x6888('0x1c')]=qs[_0x6888('0x1c')](_0x236cda[_0x6888('0x32')][_0x6888('0x1c')]);_0xc71172[_0x6888('0x1a')]=qs[_0x6888('0x1a')](_0x236cda[_0x6888('0x32')][_0x6888('0x1a')]);}return _0x30939d[_0x6888('0x4a')](_0xc71172);}})['then'](function(_0x33383a){if(_0x33383a){return _0x33383a?{'count':_0x2dc8f2,'rows':_0x33383a}:null;}})[_0x6888('0x23')](respondWithResult(_0x5350fe,null))['catch'](handleError(_0x5350fe,null));};exports['addConfiguration']=function(_0x21b385,_0x41e6d4,_0xc8d8a){if(_0x21b385['body']['id']){delete _0x21b385[_0x6888('0x48')]['id'];}return db['SugarcrmAccount'][_0x6888('0x4b')]({'where':{'id':_0x21b385['params']['id']}})[_0x6888('0x23')](handleEntityNotFound(_0x41e6d4,null))[_0x6888('0x23')](function(_0x57e840){if(_0x57e840){_0x21b385[_0x6888('0x48')][_0x6888('0x4d')]=_0x57e840['id'];_0x21b385[_0x6888('0x48')][_0x6888('0x4e')]=integrations['getSubjects'](_0x21b385[_0x6888('0x48')][_0x6888('0x4f')],_0x21b385[_0x6888('0x48')][_0x6888('0x2d')]);_0x21b385[_0x6888('0x48')]['Descriptions']=integrations[_0x6888('0x50')](_0x21b385[_0x6888('0x48')][_0x6888('0x4f')],_0x21b385[_0x6888('0x48')]['type']);return db[_0x6888('0x4c')]['create'](_0x21b385[_0x6888('0x48')],{'include':[{'model':db[_0x6888('0x51')],'as':_0x6888('0x4e')},{'model':db['SugarcrmField'],'as':_0x6888('0x52')}]});}return null;})['then'](respondWithResult(_0x41e6d4,null))[_0x6888('0x43')](handleError(_0x41e6d4,null));};exports[_0x6888('0x53')]=function(_0x5539d2,_0x26b789,_0x564452){var _0x335742='';var _0x15216d=['id','name',_0x6888('0x54'),'created_by',_0x6888('0x55'),_0x6888('0x56'),_0x6888('0x57'),_0x6888('0x58'),_0x6888('0x59'),'parent_type',_0x6888('0x5a'),_0x6888('0x5b')];return db['SugarcrmAccount'][_0x6888('0x4b')]({'where':{'id':_0x5539d2[_0x6888('0x45')]['id']},'attributes':['id',_0x6888('0x5c'),_0x6888('0x5d'),_0x6888('0x5e')]})[_0x6888('0x23')](handleEntityNotFound(_0x26b789,null))['then'](function(_0x191837){if(_0x191837){_0x335742=_0x191837[_0x6888('0x5e')];var _0x41cfe4=_0x335742['slice'](-0x1);if(_0x41cfe4==='/'){_0x335742=_0x335742[_0x6888('0x5f')](0x0,_0x335742[_0x6888('0x60')](_0x41cfe4));}return rp({'method':_0x6888('0x61'),'uri':util[_0x6888('0x62')](_0x6888('0x63'),_0x335742,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6888('0x64'),'input_type':_0x6888('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x191837[_0x6888('0x5c')],'password':_0x191837['password'],'encryption':_0x6888('0x66')},'application':_0x6888('0x67')})}});}})['then'](function(_0x40c574){if(_0x40c574&&_0x40c574['name']!==_0x6888('0x68')&&_0x40c574[_0x6888('0x27')]!==_0x6888('0x69')){return rp({'method':_0x6888('0x61'),'uri':util['format'](_0x6888('0x63'),_0x335742,_0x6888('0x6a')),'json':!![],'form':{'method':_0x6888('0x6b'),'input_type':'JSON','response_type':_0x6888('0x65'),'rest_data':JSON[_0x6888('0x6c')]({'session':_0x40c574['id'],'module_name':_0x6888('0x6d')})}})[_0x6888('0x23')](function(_0x50b232){if(_0x50b232){var _0x56ed33=_[_0x6888('0x6e')](_0x50b232[_0x6888('0x6f')]);_['remove'](_0x56ed33,function(_0x43ba4e){return _0x15216d['includes'](_0x43ba4e[_0x6888('0x27')]);});return{'count':_0x56ed33[_0x6888('0x34')],'rows':_[_0x6888('0x29')](_0x56ed33,function(_0x2bd848){return{'id':_0x2bd848[_0x6888('0x27')],'name':_0x2bd848[_0x6888('0x70')],'custom':_['endsWith'](_0x2bd848[_0x6888('0x27')],'_c')?!![]:![],'options':_0x2bd848['options']?_[_0x6888('0x29')](_[_0x6888('0x6e')](_0x2bd848[_0x6888('0x3e')]),function(_0x47fe64){return{'name':_0x47fe64[_0x6888('0x71')],'value':_0x47fe64[_0x6888('0x27')]};}):[]};})};}})[_0x6888('0x23')](respondWithResult(_0x26b789,null))['catch'](function(_0x2ccace){var _0x35f031=_0x5539d2['query']['test']?0x1f4:_0x2ccace[_0x6888('0x72')]||0x1f4;logger['error'](_0x6888('0x73'),_0x6888('0x53'),_0x35f031,JSON[_0x6888('0x6c')](_0x2ccace));delete _0x2ccace['name'];if(_0x35f031===0x191){_0x35f031=0x190;}_0x26b789[_0x6888('0x18')](_0x35f031)[_0x6888('0x28')](_0x5539d2[_0x6888('0x32')][_0x6888('0x74')]?{'message':_0x6888('0x75'),'statusCode':_0x2ccace[_0x6888('0x72')]}:_0x2ccace);});}else{var _0x20585e=0x1f4;_0x26b789[_0x6888('0x18')](_0x20585e)[_0x6888('0x28')]({'message':_0x6888('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x643d=['error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','length','create','body','find','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','format','%s%s','/service/v4_1/rest.php','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x643d,0xc8));var _0xd643=function(_0x1aea09,_0x4f5b1b){_0x1aea09=_0x1aea09-0x0;var _0x456b43=_0x643d[_0x1aea09];return _0x456b43;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd643('0x0'));var jsonpatch=require(_0xd643('0x1'));var rp=require(_0xd643('0x2'));var moment=require(_0xd643('0x3'));var BPromise=require(_0xd643('0x4'));var Mustache=require(_0xd643('0x5'));var util=require(_0xd643('0x6'));var path=require(_0xd643('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd643('0x8'));var fs=require('fs');var fs_extra=require(_0xd643('0x9'));var _=require('lodash');var squel=require(_0xd643('0xa'));var crypto=require('crypto');var jsforce=require(_0xd643('0xb'));var deskjs=require(_0xd643('0xc'));var toCsv=require(_0xd643('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd643('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd643('0xf'));var as=require(_0xd643('0x10'));var hardwareService=require(_0xd643('0x11'));var logger=require(_0xd643('0x12'))(_0xd643('0x13'));var utils=require('../../config/utils');var config=require(_0xd643('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd643('0x15'));function respondWithStatusCode(_0x1d2c82,_0x176002){_0x176002=_0x176002||0xcc;return function(_0x3fe65e){if(_0x3fe65e){return _0x1d2c82[_0xd643('0x16')](_0x176002);}return _0x1d2c82[_0xd643('0x17')](_0x176002)['end']();};}function respondWithResult(_0x204bdd,_0x3955c1){_0x3955c1=_0x3955c1||0xc8;return function(_0x2cdb7f){if(_0x2cdb7f){return _0x204bdd['status'](_0x3955c1)[_0xd643('0x18')](_0x2cdb7f);}};}function respondWithFilteredResult(_0x575234,_0x12e433){return function(_0x2746d2){if(_0x2746d2){var _0x14cccb=typeof _0x12e433[_0xd643('0x19')]===_0xd643('0x1a')&&typeof _0x12e433[_0xd643('0x1b')]===_0xd643('0x1a');var _0x4ca91b=_0x2746d2[_0xd643('0x1c')];var _0x380aad=_0x14cccb?0x0:_0x12e433[_0xd643('0x19')];var _0x2456c0=_0x14cccb?_0x2746d2[_0xd643('0x1c')]:_0x12e433[_0xd643('0x19')]+_0x12e433['limit'];var _0xf6421;if(_0x2456c0>=_0x4ca91b){_0x2456c0=_0x4ca91b;_0xf6421=0xc8;}else{_0xf6421=0xce;}_0x575234[_0xd643('0x17')](_0xf6421);return _0x575234[_0xd643('0x1d')](_0xd643('0x1e'),_0x380aad+'-'+_0x2456c0+'/'+_0x4ca91b)[_0xd643('0x18')](_0x2746d2);}return null;};}function patchUpdates(_0x92eb37){return function(_0x5d674b){try{jsonpatch[_0xd643('0x1f')](_0x5d674b,_0x92eb37,!![]);}catch(_0x25b8c4){return BPromise[_0xd643('0x20')](_0x25b8c4);}return _0x5d674b[_0xd643('0x21')]();};}function saveUpdates(_0x561b2a,_0x283072){return function(_0x5d0dac){if(_0x5d0dac){return _0x5d0dac[_0xd643('0x22')](_0x561b2a)[_0xd643('0x23')](function(_0x238ca6){return _0x238ca6;});}return null;};}function removeEntity(_0x1921fa,_0x2e8351){return function(_0xfd0a36){if(_0xfd0a36){return _0xfd0a36[_0xd643('0x24')]()[_0xd643('0x23')](function(){_0x1921fa['status'](0xcc)[_0xd643('0x25')]();});}};}function handleEntityNotFound(_0x16320b,_0x46b265){return function(_0x3472cd){if(!_0x3472cd){_0x16320b[_0xd643('0x16')](0x194);}return _0x3472cd;};}function handleError(_0x516ae8,_0x44a285){_0x44a285=_0x44a285||0x1f4;return function(_0x3dcee9){logger[_0xd643('0x26')](_0x3dcee9['stack']);if(_0x3dcee9[_0xd643('0x27')]){delete _0x3dcee9[_0xd643('0x27')];}_0x516ae8[_0xd643('0x17')](_0x44a285)[_0xd643('0x28')](_0x3dcee9);};}exports[_0xd643('0x29')]=function(_0x4288a6,_0x3351c6){var _0x5ca4bb={},_0x3a211c={},_0x1d7e64={'count':0x0,'rows':[]};var _0x38f175=_[_0xd643('0x2a')](db[_0xd643('0x2b')][_0xd643('0x2c')],function(_0x4034ad){return{'name':_0x4034ad[_0xd643('0x2d')],'type':_0x4034ad[_0xd643('0x2e')][_0xd643('0x2f')]};});_0x3a211c[_0xd643('0x30')]=_[_0xd643('0x2a')](_0x38f175,_0xd643('0x27'));_0x3a211c[_0xd643('0x31')]=_[_0xd643('0x32')](_0x4288a6[_0xd643('0x31')]);_0x3a211c['filters']=_[_0xd643('0x33')](_0x3a211c[_0xd643('0x30')],_0x3a211c['query']);_0x5ca4bb[_0xd643('0x34')]=_[_0xd643('0x33')](_0x3a211c[_0xd643('0x30')],qs['fields'](_0x4288a6['query'][_0xd643('0x35')]));_0x5ca4bb[_0xd643('0x34')]=_0x5ca4bb[_0xd643('0x34')]['length']?_0x5ca4bb[_0xd643('0x34')]:_0x3a211c[_0xd643('0x30')];if(!_0x4288a6[_0xd643('0x31')]['hasOwnProperty'](_0xd643('0x36'))){_0x5ca4bb[_0xd643('0x1b')]=qs['limit'](_0x4288a6[_0xd643('0x31')][_0xd643('0x1b')]);_0x5ca4bb[_0xd643('0x19')]=qs[_0xd643('0x19')](_0x4288a6['query'][_0xd643('0x19')]);}_0x5ca4bb[_0xd643('0x37')]=qs[_0xd643('0x38')](_0x4288a6[_0xd643('0x31')][_0xd643('0x38')]);_0x5ca4bb[_0xd643('0x39')]=qs[_0xd643('0x3a')](_[_0xd643('0x3b')](_0x4288a6['query'],_0x3a211c[_0xd643('0x3a')]),_0x38f175);if(_0x4288a6[_0xd643('0x31')][_0xd643('0x3c')]){_0x5ca4bb['where']=_[_0xd643('0x3d')](_0x5ca4bb[_0xd643('0x39')],{'$or':_['map'](_0x38f175,function(_0x2515e9){if(_0x2515e9[_0xd643('0x2e')]!==_0xd643('0x3e')){var _0x45a542={};_0x45a542[_0x2515e9[_0xd643('0x27')]]={'$like':'%'+_0x4288a6[_0xd643('0x31')][_0xd643('0x3c')]+'%'};return _0x45a542;}})});}_0x5ca4bb=_[_0xd643('0x3d')]({},_0x5ca4bb,_0x4288a6[_0xd643('0x3f')]);var _0x2b4634={'where':_0x5ca4bb[_0xd643('0x39')]};return db[_0xd643('0x2b')][_0xd643('0x1c')](_0x2b4634)[_0xd643('0x23')](function(_0x20c934){_0x1d7e64[_0xd643('0x1c')]=_0x20c934;if(_0x4288a6[_0xd643('0x31')][_0xd643('0x40')]){_0x5ca4bb['include']=[{'all':!![]}];}return db[_0xd643('0x2b')][_0xd643('0x41')](_0x5ca4bb);})[_0xd643('0x23')](function(_0x5ca038){_0x1d7e64['rows']=_0x5ca038;return _0x1d7e64;})[_0xd643('0x23')](respondWithFilteredResult(_0x3351c6,_0x5ca4bb))[_0xd643('0x42')](handleError(_0x3351c6,null));};exports['show']=function(_0x247aba,_0x1c6c42){var _0x5690b2={'raw':![],'where':{'id':_0x247aba[_0xd643('0x43')]['id']}},_0x38baec={};_0x38baec[_0xd643('0x30')]=_[_0xd643('0x32')](db['SugarcrmAccount'][_0xd643('0x2c')]);_0x38baec[_0xd643('0x31')]=_[_0xd643('0x32')](_0x247aba[_0xd643('0x31')]);_0x38baec[_0xd643('0x3a')]=_[_0xd643('0x33')](_0x38baec[_0xd643('0x30')],_0x38baec[_0xd643('0x31')]);_0x5690b2[_0xd643('0x34')]=_['intersection'](_0x38baec[_0xd643('0x30')],qs[_0xd643('0x35')](_0x247aba[_0xd643('0x31')][_0xd643('0x35')]));_0x5690b2[_0xd643('0x34')]=_0x5690b2[_0xd643('0x34')][_0xd643('0x44')]?_0x5690b2['attributes']:_0x38baec[_0xd643('0x30')];if(_0x247aba[_0xd643('0x31')][_0xd643('0x40')]){_0x5690b2['include']=[{'all':!![]}];}_0x5690b2=_[_0xd643('0x3d')]({},_0x5690b2,_0x247aba[_0xd643('0x3f')]);return db[_0xd643('0x2b')]['find'](_0x5690b2)[_0xd643('0x23')](handleEntityNotFound(_0x1c6c42,null))['then'](respondWithResult(_0x1c6c42,null))[_0xd643('0x42')](handleError(_0x1c6c42,null));};exports[_0xd643('0x45')]=function(_0x2f1b97,_0x87b6a2){return db[_0xd643('0x2b')][_0xd643('0x45')](_0x2f1b97[_0xd643('0x46')],{})[_0xd643('0x23')](respondWithResult(_0x87b6a2,0xc9))[_0xd643('0x42')](handleError(_0x87b6a2,null));};exports[_0xd643('0x22')]=function(_0x3befa7,_0x3c54bf){if(_0x3befa7['body']['id']){delete _0x3befa7[_0xd643('0x46')]['id'];}return db[_0xd643('0x2b')]['find']({'where':{'id':_0x3befa7[_0xd643('0x43')]['id']}})[_0xd643('0x23')](handleEntityNotFound(_0x3c54bf,null))[_0xd643('0x23')](saveUpdates(_0x3befa7['body'],null))['then'](respondWithResult(_0x3c54bf,null))[_0xd643('0x42')](handleError(_0x3c54bf,null));};exports[_0xd643('0x24')]=function(_0x39c87c,_0x4c2a85){return db[_0xd643('0x2b')][_0xd643('0x47')]({'where':{'id':_0x39c87c[_0xd643('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c2a85,null))['then'](removeEntity(_0x4c2a85,null))[_0xd643('0x42')](handleError(_0x4c2a85,null));};exports[_0xd643('0x48')]=function(_0x57b247,_0x1fe029,_0x4a65e4){var _0x2353e3={};var _0x1c9c37={};var _0x52b758;var _0xb64312;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x57b247['params']['id']}})[_0xd643('0x23')](handleEntityNotFound(_0x1fe029,null))['then'](function(_0x5e185a){if(_0x5e185a){_0x52b758=_0x5e185a;_0x1c9c37[_0xd643('0x30')]=_[_0xd643('0x32')](db['SugarcrmConfiguration'][_0xd643('0x2c')]);_0x1c9c37[_0xd643('0x31')]=_['keys'](_0x57b247[_0xd643('0x31')]);_0x1c9c37[_0xd643('0x3a')]=_['intersection'](_0x1c9c37[_0xd643('0x30')],_0x1c9c37[_0xd643('0x31')]);_0x2353e3[_0xd643('0x34')]=_[_0xd643('0x33')](_0x1c9c37[_0xd643('0x30')],qs[_0xd643('0x35')](_0x57b247[_0xd643('0x31')]['fields']));_0x2353e3[_0xd643('0x34')]=_0x2353e3[_0xd643('0x34')]['length']?_0x2353e3['attributes']:_0x1c9c37['model'];_0x2353e3[_0xd643('0x37')]=qs['sort'](_0x57b247[_0xd643('0x31')][_0xd643('0x38')]);_0x2353e3[_0xd643('0x39')]=qs['filters'](_[_0xd643('0x3b')](_0x57b247[_0xd643('0x31')],_0x1c9c37[_0xd643('0x3a')]));if(_0x57b247[_0xd643('0x31')][_0xd643('0x3c')]){_0x2353e3[_0xd643('0x39')]=_[_0xd643('0x3d')](_0x2353e3['where'],{'$or':_['map'](_0x2353e3['attributes'],function(_0x14ebf2){var _0xca614a={};_0xca614a[_0x14ebf2]={'$like':'%'+_0x57b247[_0xd643('0x31')][_0xd643('0x3c')]+'%'};return _0xca614a;})});}_0x2353e3=_[_0xd643('0x3d')]({},_0x2353e3,_0x57b247[_0xd643('0x3f')]);return _0x52b758[_0xd643('0x48')](_0x2353e3);}})['then'](function(_0x250cef){if(_0x250cef){_0xb64312=_0x250cef['length'];if(!_0x57b247['query'][_0xd643('0x49')](_0xd643('0x36'))){_0x2353e3[_0xd643('0x1b')]=qs[_0xd643('0x1b')](_0x57b247[_0xd643('0x31')]['limit']);_0x2353e3['offset']=qs[_0xd643('0x19')](_0x57b247['query'][_0xd643('0x19')]);}return _0x52b758[_0xd643('0x48')](_0x2353e3);}})[_0xd643('0x23')](function(_0xcaee08){if(_0xcaee08){return _0xcaee08?{'count':_0xb64312,'rows':_0xcaee08}:null;}})[_0xd643('0x23')](respondWithResult(_0x1fe029,null))[_0xd643('0x42')](handleError(_0x1fe029,null));};exports[_0xd643('0x4a')]=function(_0x44c39e,_0xe721d0,_0x55d131){if(_0x44c39e[_0xd643('0x46')]['id']){delete _0x44c39e['body']['id'];}return db[_0xd643('0x2b')]['findOne']({'where':{'id':_0x44c39e[_0xd643('0x43')]['id']}})[_0xd643('0x23')](handleEntityNotFound(_0xe721d0,null))[_0xd643('0x23')](function(_0x257cfb){if(_0x257cfb){_0x44c39e[_0xd643('0x46')][_0xd643('0x4b')]=_0x257cfb['id'];_0x44c39e[_0xd643('0x46')][_0xd643('0x4c')]=integrations[_0xd643('0x4d')](_0x44c39e[_0xd643('0x46')][_0xd643('0x4e')],_0x44c39e[_0xd643('0x46')][_0xd643('0x2e')]);_0x44c39e['body'][_0xd643('0x4f')]=integrations[_0xd643('0x50')](_0x44c39e[_0xd643('0x46')][_0xd643('0x4e')],_0x44c39e[_0xd643('0x46')]['type']);return db[_0xd643('0x51')][_0xd643('0x45')](_0x44c39e[_0xd643('0x46')],{'include':[{'model':db[_0xd643('0x52')],'as':_0xd643('0x4c')},{'model':db[_0xd643('0x52')],'as':'Descriptions'}]});}return null;})[_0xd643('0x23')](respondWithResult(_0xe721d0,null))[_0xd643('0x42')](handleError(_0xe721d0,null));};exports[_0xd643('0x53')]=function(_0x499f88,_0x2b3a7f,_0x390ca6){var _0x1db8be='';var _0x3163eb=['id',_0xd643('0x27'),'assigned_user_id',_0xd643('0x54'),'description',_0xd643('0x55'),_0xd643('0x56'),_0xd643('0x57'),_0xd643('0x58'),_0xd643('0x59'),_0xd643('0x5a'),_0xd643('0x5b')];return db[_0xd643('0x2b')]['findOne']({'where':{'id':_0x499f88[_0xd643('0x43')]['id']},'attributes':['id',_0xd643('0x5c'),'password',_0xd643('0x5d')]})[_0xd643('0x23')](handleEntityNotFound(_0x2b3a7f,null))['then'](function(_0x32851c){if(_0x32851c){_0x1db8be=_0x32851c[_0xd643('0x5d')];var _0x42bc20=_0x1db8be[_0xd643('0x5e')](-0x1);if(_0x42bc20==='/'){_0x1db8be=_0x1db8be[_0xd643('0x5f')](0x0,_0x1db8be['lastIndexOf'](_0x42bc20));}return rp({'method':'POST','uri':util[_0xd643('0x60')](_0xd643('0x61'),_0x1db8be,_0xd643('0x62')),'json':!![],'form':{'method':'login','input_type':_0xd643('0x63'),'response_type':_0xd643('0x63'),'rest_data':JSON[_0xd643('0x64')]({'user_auth':{'user_name':_0x32851c[_0xd643('0x5c')],'password':_0x32851c[_0xd643('0x65')],'encryption':_0xd643('0x66')},'application':_0xd643('0x67')})}});}})[_0xd643('0x23')](function(_0x5ecc37){if(_0x5ecc37&&_0x5ecc37[_0xd643('0x27')]!==_0xd643('0x68')&&_0x5ecc37['name']!==_0xd643('0x69')){return rp({'method':_0xd643('0x6a'),'uri':util[_0xd643('0x60')](_0xd643('0x61'),_0x1db8be,_0xd643('0x62')),'json':!![],'form':{'method':_0xd643('0x6b'),'input_type':_0xd643('0x63'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5ecc37['id'],'module_name':_0xd643('0x6c')})}})[_0xd643('0x23')](function(_0x7abe73){if(_0x7abe73){var _0xe8a772=_[_0xd643('0x6d')](_0x7abe73[_0xd643('0x6e')]);_[_0xd643('0x6f')](_0xe8a772,function(_0x1d9cde){return _0x3163eb[_0xd643('0x70')](_0x1d9cde[_0xd643('0x27')]);});return{'count':_0xe8a772[_0xd643('0x44')],'rows':_['map'](_0xe8a772,function(_0x8865dd){return{'id':_0x8865dd['name'],'name':_0x8865dd['label'],'custom':_[_0xd643('0x71')](_0x8865dd['name'],'_c')?!![]:![],'options':_0x8865dd[_0xd643('0x3f')]?_['map'](_[_0xd643('0x6d')](_0x8865dd['options']),function(_0x1ad210){return{'name':_0x1ad210[_0xd643('0x72')],'value':_0x1ad210[_0xd643('0x27')]};}):[]};})};}})['then'](respondWithResult(_0x2b3a7f,null))[_0xd643('0x42')](function(_0x5c16c7){var _0x2ddf81=_0x499f88['query'][_0xd643('0x73')]?0x1f4:_0x5c16c7['statusCode']||0x1f4;logger['error'](_0xd643('0x74'),_0xd643('0x53'),_0x2ddf81,JSON['stringify'](_0x5c16c7));delete _0x5c16c7[_0xd643('0x27')];if(_0x2ddf81===0x191){_0x2ddf81=0x190;}_0x2b3a7f[_0xd643('0x17')](_0x2ddf81)['send'](_0x499f88['query'][_0xd643('0x73')]?{'message':_0xd643('0x75'),'statusCode':_0x5c16c7[_0xd643('0x76')]}:_0x5c16c7);});}else{var _0x13ded2=0x1f4;_0x2b3a7f[_0xd643('0x17')](_0x13ded2)[_0xd643('0x28')]({'message':_0xd643('0x75'),'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 16be83b..e9b20d9 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 _0xaf60=['../../config/logger','bluebird','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xaf60,0x82));var _0x0af6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xaf60[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var attributes=require(_0x0af6('0x6'));var integrations=require(_0x0af6('0x7'));module[_0x0af6('0x8')]=function(_0x333ce1,_0x2eb218){return _0x333ce1['define'](_0x0af6('0x9'),attributes,{'tableName':_0x0af6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69d4=['util','api','moment','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','lodash'];(function(_0x2b0d44,_0x3b6cba){var _0x3d0cf7=function(_0x4344cd){while(--_0x4344cd){_0x2b0d44['push'](_0x2b0d44['shift']());}};_0x3d0cf7(++_0x3b6cba);}(_0x69d4,0x83));var _0x469d=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x69d4[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var logger=require('../../config/logger')(_0x469d('0x2'));var moment=require(_0x469d('0x3'));var BPromise=require(_0x469d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x469d('0x5'));var rimraf=require('rimraf');var config=require(_0x469d('0x6'));var attributes=require(_0x469d('0x7'));var integrations=require(_0x469d('0x8'));module[_0x469d('0x9')]=function(_0x3d0ec8,_0xb15ca9){return _0x3d0ec8['define'](_0x469d('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','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 46ce62e..960a290 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 _0x8f2c=['debug','stringify','error','message','result','catch','GetSugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3c11d6,_0xa9f933){var _0x6296fe=function(_0x3aeff2){while(--_0x3aeff2){_0x3c11d6['push'](_0x3c11d6['shift']());}};_0x6296fe(++_0xa9f933);}(_0x8f2c,0xbc));var _0xc8f2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8f2c[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xc8f2('0x0'));var util=require(_0xc8f2('0x1'));var moment=require(_0xc8f2('0x2'));var BPromise=require('bluebird');var rs=require(_0xc8f2('0x3'));var fs=require('fs');var Redis=require(_0xc8f2('0x4'));var db=require(_0xc8f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f2('0x6'))(_0xc8f2('0x7'));var config=require(_0xc8f2('0x8'));var jayson=require(_0xc8f2('0x9'));var client=jayson[_0xc8f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f24da,_0x6506da,_0x43f70b){return new BPromise(function(_0x3f0bf7,_0x3eed1c){return client[_0xc8f2('0xb')](_0x5f24da,_0x43f70b)[_0xc8f2('0xc')](function(_0x18063d){logger[_0xc8f2('0xd')](_0xc8f2('0xe'),_0x6506da,_0xc8f2('0xf'));logger[_0xc8f2('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x6506da,_0xc8f2('0xf'),JSON[_0xc8f2('0x11')](_0x18063d));if(_0x18063d[_0xc8f2('0x12')]){if(_0x18063d[_0xc8f2('0x12')]['code']===0x1f4){logger[_0xc8f2('0x12')](_0xc8f2('0xe'),_0x6506da,_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);return _0x3eed1c(_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);}logger['error'](_0xc8f2('0xe'),_0x6506da,_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);return _0x3f0bf7(_0x18063d[_0xc8f2('0x12')][_0xc8f2('0x13')]);}else{logger[_0xc8f2('0xd')](_0xc8f2('0xe'),_0x6506da,'request\x20sent');_0x3f0bf7(_0x18063d[_0xc8f2('0x14')][_0xc8f2('0x13')]);}})[_0xc8f2('0x15')](function(_0x1211ae){logger[_0xc8f2('0x12')](_0xc8f2('0xe'),_0x6506da,_0x1211ae);_0x3eed1c(_0x1211ae);});});}exports[_0xc8f2('0x16')]=function(_0x59ddd2){var _0x5801f3=this;return new Promise(function(_0x51cd4a,_0x524d18){return db['SugarcrmAccount'][_0xc8f2('0x17')]({'raw':_0x59ddd2['options']?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x19')]===undefined?!![]:![]:!![],'where':_0x59ddd2['options']?_0x59ddd2[_0xc8f2('0x18')]['where']||null:null,'attributes':_0x59ddd2[_0xc8f2('0x18')]?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1a')]||null:null,'limit':_0x59ddd2[_0xc8f2('0x18')]?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1b')]||null:null,'include':_0x59ddd2['options']?_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1c')]?_[_0xc8f2('0x1d')](_0x59ddd2[_0xc8f2('0x18')][_0xc8f2('0x1c')],function(_0x55cf1b){return{'model':db[_0x55cf1b[_0xc8f2('0x1e')]],'as':_0x55cf1b['as'],'attributes':_0x55cf1b[_0xc8f2('0x1a')],'include':_0x55cf1b[_0xc8f2('0x1c')]?_['map'](_0x55cf1b[_0xc8f2('0x1c')],function(_0x1c05e2){return{'model':db[_0x1c05e2['model']],'as':_0x1c05e2['as'],'attributes':_0x1c05e2[_0xc8f2('0x1a')],'include':_0x1c05e2['include']?_['map'](_0x1c05e2[_0xc8f2('0x1c')],function(_0x5b5092){return{'model':db[_0x5b5092[_0xc8f2('0x1e')]],'as':_0x5b5092['as'],'attributes':_0x5b5092[_0xc8f2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550938){logger[_0xc8f2('0xd')]('GetSugarcrmAccount',_0x59ddd2);logger['debug'](_0xc8f2('0x16'),_0x59ddd2,JSON['stringify'](_0x550938));_0x51cd4a(_0x550938);})['catch'](function(_0x434a4a){logger[_0xc8f2('0x12')](_0xc8f2('0x16'),_0x434a4a[_0xc8f2('0x13')],_0x59ddd2);_0x524d18(_0x5801f3[_0xc8f2('0x12')](0x1f4,_0x434a4a[_0xc8f2('0x13')]));});});};exports[_0xc8f2('0x1f')]=function(_0x45a877){var _0x49ac32=this;return new Promise(function(_0x4eb2c8,_0x18698c){return db[_0xc8f2('0x20')][_0xc8f2('0x21')]({'raw':_0x45a877['options']?_0x45a877['options'][_0xc8f2('0x19')]===undefined?!![]:![]:!![],'where':_0x45a877[_0xc8f2('0x18')]?_0x45a877['options']['where']||null:null,'attributes':_0x45a877[_0xc8f2('0x18')]?_0x45a877['options'][_0xc8f2('0x1a')]||null:null,'include':_0x45a877['options']?_0x45a877[_0xc8f2('0x18')][_0xc8f2('0x1c')]?_[_0xc8f2('0x1d')](_0x45a877['options']['include'],function(_0x5af665){return{'model':db[_0x5af665[_0xc8f2('0x1e')]],'as':_0x5af665['as'],'attributes':_0x5af665['attributes'],'include':_0x5af665['include']?_[_0xc8f2('0x1d')](_0x5af665[_0xc8f2('0x1c')],function(_0x41465b){return{'model':db[_0x41465b['model']],'as':_0x41465b['as'],'attributes':_0x41465b['attributes'],'include':_0x41465b[_0xc8f2('0x1c')]?_[_0xc8f2('0x1d')](_0x41465b[_0xc8f2('0x1c')],function(_0x29b8cb){return{'model':db[_0x29b8cb['model']],'as':_0x29b8cb['as'],'attributes':_0x29b8cb[_0xc8f2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x183482){logger[_0xc8f2('0xd')](_0xc8f2('0x1f'),_0x45a877);logger[_0xc8f2('0x10')](_0xc8f2('0x1f'),_0x45a877,JSON[_0xc8f2('0x11')](_0x183482));_0x4eb2c8(_0x183482);})['catch'](function(_0x448b8d){logger[_0xc8f2('0x12')](_0xc8f2('0x1f'),_0x448b8d['message'],_0x45a877);_0x18698c(_0x49ac32[_0xc8f2('0x12')](0x1f4,_0x448b8d[_0xc8f2('0x13')]));});});}; \ No newline at end of file +var _0xd860=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowSugarcrmAccount','find','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd860,0x14f));var _0x0d86=function(_0x3958df,_0x58d13f){_0x3958df=_0x3958df-0x0;var _0x5c9313=_0xd860[_0x3958df];return _0x5c9313;};'use strict';var _=require('lodash');var util=require(_0x0d86('0x0'));var moment=require(_0x0d86('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d86('0x2'));var db=require(_0x0d86('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d86('0x4'))(_0x0d86('0x5'));var config=require(_0x0d86('0x6'));var jayson=require(_0x0d86('0x7'));var client=jayson[_0x0d86('0x8')][_0x0d86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a37,_0x2639ab,_0x129b14){return new BPromise(function(_0x3ad5f,_0x10e9dc){return client[_0x0d86('0xa')](_0x4a6a37,_0x129b14)[_0x0d86('0xb')](function(_0x162211){logger[_0x0d86('0xc')](_0x0d86('0xd'),_0x2639ab,_0x0d86('0xe'));logger[_0x0d86('0xf')](_0x0d86('0x10'),_0x2639ab,_0x0d86('0xe'),JSON['stringify'](_0x162211));if(_0x162211[_0x0d86('0x11')]){if(_0x162211[_0x0d86('0x11')][_0x0d86('0x12')]===0x1f4){logger[_0x0d86('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x2639ab,_0x162211['error']['message']);return _0x10e9dc(_0x162211[_0x0d86('0x11')]['message']);}logger[_0x0d86('0x11')](_0x0d86('0xd'),_0x2639ab,_0x162211[_0x0d86('0x11')][_0x0d86('0x13')]);return _0x3ad5f(_0x162211[_0x0d86('0x11')][_0x0d86('0x13')]);}else{logger[_0x0d86('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x2639ab,_0x0d86('0xe'));_0x3ad5f(_0x162211[_0x0d86('0x14')][_0x0d86('0x13')]);}})[_0x0d86('0x15')](function(_0x4c11fc){logger[_0x0d86('0x11')](_0x0d86('0xd'),_0x2639ab,_0x4c11fc);_0x10e9dc(_0x4c11fc);});});}exports[_0x0d86('0x16')]=function(_0x4e8a13){var _0x34bce4=this;return new Promise(function(_0x30e392,_0x4c377e){return db[_0x0d86('0x17')][_0x0d86('0x18')]({'raw':_0x4e8a13[_0x0d86('0x19')]?_0x4e8a13['options'][_0x0d86('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e8a13[_0x0d86('0x19')]?_0x4e8a13[_0x0d86('0x19')]['where']||null:null,'attributes':_0x4e8a13[_0x0d86('0x19')]?_0x4e8a13[_0x0d86('0x19')][_0x0d86('0x1b')]||null:null,'limit':_0x4e8a13['options']?_0x4e8a13[_0x0d86('0x19')][_0x0d86('0x1c')]||null:null,'include':_0x4e8a13[_0x0d86('0x19')]?_0x4e8a13[_0x0d86('0x19')]['include']?_[_0x0d86('0x1d')](_0x4e8a13[_0x0d86('0x19')][_0x0d86('0x1e')],function(_0x4063ea){return{'model':db[_0x4063ea[_0x0d86('0x1f')]],'as':_0x4063ea['as'],'attributes':_0x4063ea[_0x0d86('0x1b')],'include':_0x4063ea['include']?_['map'](_0x4063ea[_0x0d86('0x1e')],function(_0x3b7eb3){return{'model':db[_0x3b7eb3[_0x0d86('0x1f')]],'as':_0x3b7eb3['as'],'attributes':_0x3b7eb3[_0x0d86('0x1b')],'include':_0x3b7eb3['include']?_[_0x0d86('0x1d')](_0x3b7eb3['include'],function(_0x21678b){return{'model':db[_0x21678b[_0x0d86('0x1f')]],'as':_0x21678b['as'],'attributes':_0x21678b[_0x0d86('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d86('0xb')](function(_0x3aeb6d){logger['info'](_0x0d86('0x16'),_0x4e8a13);logger[_0x0d86('0xf')]('GetSugarcrmAccount',_0x4e8a13,JSON[_0x0d86('0x20')](_0x3aeb6d));_0x30e392(_0x3aeb6d);})['catch'](function(_0x45585e){logger['error'](_0x0d86('0x16'),_0x45585e[_0x0d86('0x13')],_0x4e8a13);_0x4c377e(_0x34bce4['error'](0x1f4,_0x45585e[_0x0d86('0x13')]));});});};exports[_0x0d86('0x21')]=function(_0x51d9b2){var _0x2a1e06=this;return new Promise(function(_0x3ef864,_0x3534fb){return db[_0x0d86('0x17')][_0x0d86('0x22')]({'raw':_0x51d9b2[_0x0d86('0x19')]?_0x51d9b2[_0x0d86('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51d9b2[_0x0d86('0x19')]?_0x51d9b2[_0x0d86('0x19')]['where']||null:null,'attributes':_0x51d9b2[_0x0d86('0x19')]?_0x51d9b2[_0x0d86('0x19')][_0x0d86('0x1b')]||null:null,'include':_0x51d9b2[_0x0d86('0x19')]?_0x51d9b2['options']['include']?_[_0x0d86('0x1d')](_0x51d9b2[_0x0d86('0x19')][_0x0d86('0x1e')],function(_0x5c87b1){return{'model':db[_0x5c87b1['model']],'as':_0x5c87b1['as'],'attributes':_0x5c87b1[_0x0d86('0x1b')],'include':_0x5c87b1['include']?_[_0x0d86('0x1d')](_0x5c87b1[_0x0d86('0x1e')],function(_0x5ca57b){return{'model':db[_0x5ca57b[_0x0d86('0x1f')]],'as':_0x5ca57b['as'],'attributes':_0x5ca57b['attributes'],'include':_0x5ca57b['include']?_[_0x0d86('0x1d')](_0x5ca57b['include'],function(_0x4e90e0){return{'model':db[_0x4e90e0[_0x0d86('0x1f')]],'as':_0x4e90e0['as'],'attributes':_0x4e90e0[_0x0d86('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d86('0xb')](function(_0x574046){logger[_0x0d86('0xc')](_0x0d86('0x21'),_0x51d9b2);logger['debug'](_0x0d86('0x21'),_0x51d9b2,JSON[_0x0d86('0x20')](_0x574046));_0x3ef864(_0x574046);})['catch'](function(_0x35cc7e){logger['error']('ShowSugarcrmAccount',_0x35cc7e[_0x0d86('0x13')],_0x51d9b2);_0x3534fb(_0x2a1e06[_0x0d86('0x11')](0x1f4,_0x35cc7e[_0x0d86('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 24a95b7..a269c37 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 _0x3854=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x3854,0xca));var _0x4385=function(_0x476d64,_0x490172){_0x476d64=_0x476d64-0x0;var _0x5703f8=_0x3854[_0x476d64];return _0x5703f8;};'use strict';var multer=require(_0x4385('0x0'));var util=require('util');var path=require(_0x4385('0x1'));var timeout=require('connect-timeout');var express=require(_0x4385('0x2'));var router=express[_0x4385('0x3')]();var fs_extra=require(_0x4385('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4385('0x5'));var config=require(_0x4385('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x4385('0x7')]('/',auth[_0x4385('0x8')](),controller[_0x4385('0x9')]);router[_0x4385('0x7')](_0x4385('0xa'),auth['isAuthenticated'](),controller[_0x4385('0xb')]);router[_0x4385('0x7')]('/:id/fields',auth[_0x4385('0x8')](),controller[_0x4385('0xc')]);router['get'](_0x4385('0xd'),auth[_0x4385('0x8')](),controller[_0x4385('0xe')]);router[_0x4385('0x7')](_0x4385('0xf'),auth[_0x4385('0x8')](),controller['getDescriptions']);router[_0x4385('0x10')]('/',auth['isAuthenticated'](),controller[_0x4385('0x11')]);router[_0x4385('0x12')](_0x4385('0xa'),auth[_0x4385('0x8')](),controller[_0x4385('0x13')]);router['delete']('/:id',auth[_0x4385('0x8')](),controller[_0x4385('0x14')]);module[_0x4385('0x15')]=router; \ No newline at end of file +var _0x0979=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x4dfad5,_0x62f93c){var _0xc5c336=function(_0x4ad0ed){while(--_0x4ad0ed){_0x4dfad5['push'](_0x4dfad5['shift']());}};_0xc5c336(++_0x62f93c);}(_0x0979,0x7b));var _0x9097=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0x0979[_0x98db33];return _0x5ae63a;};'use strict';var multer=require(_0x9097('0x0'));var util=require(_0x9097('0x1'));var path=require(_0x9097('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9097('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9097('0x4'));var interaction=require(_0x9097('0x5'));var config=require(_0x9097('0x6'));var controller=require(_0x9097('0x7'));router[_0x9097('0x8')]('/',auth[_0x9097('0x9')](),controller['index']);router[_0x9097('0x8')](_0x9097('0xa'),auth[_0x9097('0x9')](),controller[_0x9097('0xb')]);router['get'](_0x9097('0xc'),auth[_0x9097('0x9')](),controller[_0x9097('0xd')]);router[_0x9097('0x8')](_0x9097('0xe'),auth[_0x9097('0x9')](),controller[_0x9097('0xf')]);router[_0x9097('0x8')](_0x9097('0x10'),auth[_0x9097('0x9')](),controller[_0x9097('0x11')]);router['post']('/',auth[_0x9097('0x9')](),controller[_0x9097('0x12')]);router['put'](_0x9097('0xa'),auth[_0x9097('0x9')](),controller[_0x9097('0x13')]);router[_0x9097('0x14')](_0x9097('0xa'),auth[_0x9097('0x9')](),controller['destroy']);module[_0x9097('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e3e54fb..9f4a42b 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 _0x230e=['exports','STRING','sequelize'];(function(_0xeec51d,_0x262da8){var _0x422afd=function(_0x3d1e7e){while(--_0x3d1e7e){_0xeec51d['push'](_0xeec51d['shift']());}};_0x422afd(++_0x262da8);}(_0x230e,0xfe));var _0xe230=function(_0x4de875,_0xa9cae0){_0x4de875=_0x4de875-0x0;var _0x16f50a=_0x230e[_0x4de875];return _0x16f50a;};'use strict';var Sequelize=require(_0xe230('0x0'));module[_0xe230('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe230('0x2')]}}; \ No newline at end of file +var _0x8a3b=['STRING'];(function(_0x357c40,_0x1c24fa){var _0x1e4ee2=function(_0x3af66c){while(--_0x3af66c){_0x357c40['push'](_0x357c40['shift']());}};_0x1e4ee2(++_0x1c24fa);}(_0x8a3b,0xc4));var _0xb8a3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x8a3b[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb8a3('0x0')]},'description':{'type':Sequelize[_0xb8a3('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 63fdb08..25656f1 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 _0x5c9e=['update','then','error','stack','name','send','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getFields','findOne','SugarcrmField','order','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x5c9e,0x11e));var _0xe5c9=function(_0x3204b6,_0x449180){_0x3204b6=_0x3204b6-0x0;var _0x162aa6=_0x5c9e[_0x3204b6];return _0x162aa6;};'use strict';var emlformat=require(_0xe5c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5c9('0x1'));var jsonpatch=require(_0xe5c9('0x2'));var rp=require(_0xe5c9('0x3'));var moment=require('moment');var BPromise=require(_0xe5c9('0x4'));var Mustache=require('mustache');var util=require(_0xe5c9('0x5'));var path=require(_0xe5c9('0x6'));var sox=require('sox');var csv=require(_0xe5c9('0x7'));var ejs=require(_0xe5c9('0x8'));var fs=require('fs');var fs_extra=require(_0xe5c9('0x9'));var _=require('lodash');var squel=require(_0xe5c9('0xa'));var crypto=require(_0xe5c9('0xb'));var jsforce=require(_0xe5c9('0xc'));var deskjs=require(_0xe5c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe5c9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5c9('0xf'));var qs=require(_0xe5c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe5c9('0x11'));var utils=require(_0xe5c9('0x12'));var config=require(_0xe5c9('0x13'));var licenseUtil=require(_0xe5c9('0x14'));var db=require(_0xe5c9('0x15'))['db'];function respondWithStatusCode(_0x420d99,_0x51b074){_0x51b074=_0x51b074||0xcc;return function(_0x4bfd26){if(_0x4bfd26){return _0x420d99[_0xe5c9('0x16')](_0x51b074);}return _0x420d99[_0xe5c9('0x17')](_0x51b074)[_0xe5c9('0x18')]();};}function respondWithResult(_0xac953a,_0x31859d){_0x31859d=_0x31859d||0xc8;return function(_0x1d744c){if(_0x1d744c){return _0xac953a[_0xe5c9('0x17')](_0x31859d)['json'](_0x1d744c);}};}function respondWithFilteredResult(_0x35c2f6,_0x52ef26){return function(_0x2e4517){if(_0x2e4517){var _0x5c21ac=typeof _0x52ef26['offset']===_0xe5c9('0x19')&&typeof _0x52ef26[_0xe5c9('0x1a')]===_0xe5c9('0x19');var _0x5efe07=_0x2e4517[_0xe5c9('0x1b')];var _0x3d4db6=_0x5c21ac?0x0:_0x52ef26[_0xe5c9('0x1c')];var _0x4d6ed6=_0x5c21ac?_0x2e4517[_0xe5c9('0x1b')]:_0x52ef26[_0xe5c9('0x1c')]+_0x52ef26[_0xe5c9('0x1a')];var _0x128337;if(_0x4d6ed6>=_0x5efe07){_0x4d6ed6=_0x5efe07;_0x128337=0xc8;}else{_0x128337=0xce;}_0x35c2f6[_0xe5c9('0x17')](_0x128337);return _0x35c2f6[_0xe5c9('0x1d')](_0xe5c9('0x1e'),_0x3d4db6+'-'+_0x4d6ed6+'/'+_0x5efe07)[_0xe5c9('0x1f')](_0x2e4517);}return null;};}function patchUpdates(_0x51886d){return function(_0x812df9){try{jsonpatch[_0xe5c9('0x20')](_0x812df9,_0x51886d,!![]);}catch(_0x20e98b){return BPromise[_0xe5c9('0x21')](_0x20e98b);}return _0x812df9['save']();};}function saveUpdates(_0x577e2a,_0x4dbafb){return function(_0x4cc975){if(_0x4cc975){return _0x4cc975[_0xe5c9('0x22')](_0x577e2a)[_0xe5c9('0x23')](function(_0x1b1bfc){return _0x1b1bfc;});}return null;};}function removeEntity(_0x3c3b4f,_0x38f0ba){return function(_0x179839){if(_0x179839){return _0x179839['destroy']()[_0xe5c9('0x23')](function(){_0x3c3b4f['status'](0xcc)[_0xe5c9('0x18')]();});}};}function handleEntityNotFound(_0x17cf72,_0x40888e){return function(_0x48da23){if(!_0x48da23){_0x17cf72[_0xe5c9('0x16')](0x194);}return _0x48da23;};}function handleError(_0x44af56,_0x488ac0){_0x488ac0=_0x488ac0||0x1f4;return function(_0x41bb2e){logger[_0xe5c9('0x24')](_0x41bb2e[_0xe5c9('0x25')]);if(_0x41bb2e['name']){delete _0x41bb2e[_0xe5c9('0x26')];}_0x44af56[_0xe5c9('0x17')](_0x488ac0)[_0xe5c9('0x27')](_0x41bb2e);};}exports['index']=function(_0x52b0e2,_0x270f3d){var _0x41949c={},_0x469353={},_0x187016={'count':0x0,'rows':[]};var _0x7735a8=_[_0xe5c9('0x28')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x5c5143){return{'name':_0x5c5143[_0xe5c9('0x29')],'type':_0x5c5143[_0xe5c9('0x2a')][_0xe5c9('0x2b')]};});_0x469353['model']=_[_0xe5c9('0x28')](_0x7735a8,_0xe5c9('0x26'));_0x469353[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x52b0e2['query']);_0x469353['filters']=_[_0xe5c9('0x2e')](_0x469353[_0xe5c9('0x2f')],_0x469353[_0xe5c9('0x2c')]);_0x41949c[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x469353[_0xe5c9('0x2f')],qs[_0xe5c9('0x31')](_0x52b0e2[_0xe5c9('0x2c')]['fields']));_0x41949c[_0xe5c9('0x30')]=_0x41949c[_0xe5c9('0x30')][_0xe5c9('0x32')]?_0x41949c[_0xe5c9('0x30')]:_0x469353[_0xe5c9('0x2f')];if(!_0x52b0e2[_0xe5c9('0x2c')][_0xe5c9('0x33')]('nolimit')){_0x41949c[_0xe5c9('0x1a')]=qs[_0xe5c9('0x1a')](_0x52b0e2['query'][_0xe5c9('0x1a')]);_0x41949c[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x52b0e2['query'][_0xe5c9('0x1c')]);}_0x41949c['order']=qs[_0xe5c9('0x34')](_0x52b0e2[_0xe5c9('0x2c')][_0xe5c9('0x34')]);_0x41949c[_0xe5c9('0x35')]=qs['filters'](_[_0xe5c9('0x36')](_0x52b0e2['query'],_0x469353[_0xe5c9('0x37')]),_0x7735a8);if(_0x52b0e2['query'][_0xe5c9('0x38')]){_0x41949c['where']=_['merge'](_0x41949c['where'],{'$or':_[_0xe5c9('0x28')](_0x7735a8,function(_0x16351c){if(_0x16351c[_0xe5c9('0x2a')]!==_0xe5c9('0x39')){var _0x29785e={};_0x29785e[_0x16351c[_0xe5c9('0x26')]]={'$like':'%'+_0x52b0e2['query'][_0xe5c9('0x38')]+'%'};return _0x29785e;}})});}_0x41949c=_[_0xe5c9('0x3a')]({},_0x41949c,_0x52b0e2[_0xe5c9('0x3b')]);var _0x4c9ee7={'where':_0x41949c[_0xe5c9('0x35')]};return db[_0xe5c9('0x3c')][_0xe5c9('0x1b')](_0x4c9ee7)[_0xe5c9('0x23')](function(_0x1d01ba){_0x187016[_0xe5c9('0x1b')]=_0x1d01ba;if(_0x52b0e2['query'][_0xe5c9('0x3d')]){_0x41949c[_0xe5c9('0x3e')]=[{'all':!![]}];}return db[_0xe5c9('0x3c')][_0xe5c9('0x3f')](_0x41949c);})[_0xe5c9('0x23')](function(_0x33845f){_0x187016[_0xe5c9('0x40')]=_0x33845f;return _0x187016;})[_0xe5c9('0x23')](respondWithFilteredResult(_0x270f3d,_0x41949c))[_0xe5c9('0x41')](handleError(_0x270f3d,null));};exports[_0xe5c9('0x42')]=function(_0x2b2b2a,_0x2e79ea){var _0x319473={'raw':![],'where':{'id':_0x2b2b2a[_0xe5c9('0x43')]['id']}},_0x4fd9aa={};_0x4fd9aa[_0xe5c9('0x2f')]=_['keys'](db[_0xe5c9('0x3c')][_0xe5c9('0x44')]);_0x4fd9aa[_0xe5c9('0x2c')]=_['keys'](_0x2b2b2a[_0xe5c9('0x2c')]);_0x4fd9aa[_0xe5c9('0x37')]=_[_0xe5c9('0x2e')](_0x4fd9aa[_0xe5c9('0x2f')],_0x4fd9aa['query']);_0x319473[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x4fd9aa[_0xe5c9('0x2f')],qs[_0xe5c9('0x31')](_0x2b2b2a['query']['fields']));_0x319473[_0xe5c9('0x30')]=_0x319473[_0xe5c9('0x30')][_0xe5c9('0x32')]?_0x319473[_0xe5c9('0x30')]:_0x4fd9aa[_0xe5c9('0x2f')];if(_0x2b2b2a[_0xe5c9('0x2c')][_0xe5c9('0x3d')]){_0x319473[_0xe5c9('0x3e')]=[{'all':!![]}];}_0x319473=_[_0xe5c9('0x3a')]({},_0x319473,_0x2b2b2a[_0xe5c9('0x3b')]);return db[_0xe5c9('0x3c')][_0xe5c9('0x45')](_0x319473)['then'](handleEntityNotFound(_0x2e79ea,null))[_0xe5c9('0x23')](respondWithResult(_0x2e79ea,null))[_0xe5c9('0x41')](handleError(_0x2e79ea,null));};exports[_0xe5c9('0x46')]=function(_0x51bd9a,_0x2d77fd){return db[_0xe5c9('0x3c')][_0xe5c9('0x46')](_0x51bd9a[_0xe5c9('0x47')],{})[_0xe5c9('0x23')](respondWithResult(_0x2d77fd,0xc9))['catch'](handleError(_0x2d77fd,null));};exports[_0xe5c9('0x22')]=function(_0x3ae393,_0x5cc370){if(_0x3ae393[_0xe5c9('0x47')]['id']){delete _0x3ae393[_0xe5c9('0x47')]['id'];}return db[_0xe5c9('0x3c')]['find']({'where':{'id':_0x3ae393[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x5cc370,null))[_0xe5c9('0x23')](saveUpdates(_0x3ae393[_0xe5c9('0x47')],null))['then'](respondWithResult(_0x5cc370,null))[_0xe5c9('0x41')](handleError(_0x5cc370,null));};exports[_0xe5c9('0x48')]=function(_0xdce651,_0x24b455){return db[_0xe5c9('0x3c')][_0xe5c9('0x45')]({'where':{'id':_0xdce651[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x24b455,null))[_0xe5c9('0x23')](removeEntity(_0x24b455,null))['catch'](handleError(_0x24b455,null));};exports[_0xe5c9('0x49')]=function(_0x5d7c1d,_0x46122e,_0x493c17){var _0xefe8a3={};var _0x441044={};var _0x31553b;var _0x5e884b;return db[_0xe5c9('0x3c')][_0xe5c9('0x4a')]({'where':{'id':_0x5d7c1d[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x46122e,null))[_0xe5c9('0x23')](function(_0x341219){if(_0x341219){_0x31553b=_0x341219;_0x441044[_0xe5c9('0x2f')]=_['keys'](db[_0xe5c9('0x4b')][_0xe5c9('0x44')]);_0x441044[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x5d7c1d['query']);_0x441044[_0xe5c9('0x37')]=_['intersection'](_0x441044[_0xe5c9('0x2f')],_0x441044[_0xe5c9('0x2c')]);_0xefe8a3[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x441044['model'],qs[_0xe5c9('0x31')](_0x5d7c1d[_0xe5c9('0x2c')][_0xe5c9('0x31')]));_0xefe8a3[_0xe5c9('0x30')]=_0xefe8a3['attributes'][_0xe5c9('0x32')]?_0xefe8a3[_0xe5c9('0x30')]:_0x441044['model'];_0xefe8a3['order']=qs['sort'](_0x5d7c1d[_0xe5c9('0x2c')]['sort']);_0xefe8a3[_0xe5c9('0x35')]=qs[_0xe5c9('0x37')](_[_0xe5c9('0x36')](_0x5d7c1d['query'],_0x441044[_0xe5c9('0x37')]));if(_0x5d7c1d[_0xe5c9('0x2c')][_0xe5c9('0x38')]){_0xefe8a3['where']=_[_0xe5c9('0x3a')](_0xefe8a3[_0xe5c9('0x35')],{'$or':_[_0xe5c9('0x28')](_0xefe8a3['attributes'],function(_0x4dafa2){var _0x4a1bb6={};_0x4a1bb6[_0x4dafa2]={'$like':'%'+_0x5d7c1d[_0xe5c9('0x2c')]['filter']+'%'};return _0x4a1bb6;})});}_0xefe8a3=_[_0xe5c9('0x3a')]({},_0xefe8a3,_0x5d7c1d[_0xe5c9('0x3b')]);return _0x31553b['getFields'](_0xefe8a3);}})[_0xe5c9('0x23')](function(_0x33f025){if(_0x33f025){_0x5e884b=_0x33f025[_0xe5c9('0x32')];if(!_0x5d7c1d['query'][_0xe5c9('0x33')]('nolimit')){_0xefe8a3[_0xe5c9('0x1a')]=qs['limit'](_0x5d7c1d[_0xe5c9('0x2c')]['limit']);_0xefe8a3[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x5d7c1d[_0xe5c9('0x2c')][_0xe5c9('0x1c')]);}return _0x31553b[_0xe5c9('0x49')](_0xefe8a3);}})['then'](function(_0x38d06e){if(_0x38d06e){return _0x38d06e?{'count':_0x5e884b,'rows':_0x38d06e}:null;}})[_0xe5c9('0x23')](respondWithResult(_0x46122e,null))[_0xe5c9('0x41')](handleError(_0x46122e,null));};exports['getSubjects']=function(_0x223730,_0x511ef5,_0x203172){var _0x4e803b={};var _0x1adb84={};var _0xf0e15a;var _0x35cd15;return db['SugarcrmConfiguration'][_0xe5c9('0x4a')]({'where':{'id':_0x223730[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x511ef5,null))[_0xe5c9('0x23')](function(_0x3c6f28){if(_0x3c6f28){_0xf0e15a=_0x3c6f28;_0x1adb84[_0xe5c9('0x2f')]=_[_0xe5c9('0x2d')](db[_0xe5c9('0x4b')]['rawAttributes']);_0x1adb84[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x223730[_0xe5c9('0x2c')]);_0x1adb84['filters']=_['intersection'](_0x1adb84[_0xe5c9('0x2f')],_0x1adb84['query']);_0x4e803b[_0xe5c9('0x30')]=_[_0xe5c9('0x2e')](_0x1adb84['model'],qs[_0xe5c9('0x31')](_0x223730['query'][_0xe5c9('0x31')]));_0x4e803b[_0xe5c9('0x30')]=_0x4e803b[_0xe5c9('0x30')][_0xe5c9('0x32')]?_0x4e803b[_0xe5c9('0x30')]:_0x1adb84['model'];_0x4e803b[_0xe5c9('0x4c')]=qs['sort'](_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x34')]);_0x4e803b[_0xe5c9('0x35')]=qs[_0xe5c9('0x37')](_[_0xe5c9('0x36')](_0x223730['query'],_0x1adb84[_0xe5c9('0x37')]));if(_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x38')]){_0x4e803b[_0xe5c9('0x35')]=_['merge'](_0x4e803b[_0xe5c9('0x35')],{'$or':_[_0xe5c9('0x28')](_0x4e803b[_0xe5c9('0x30')],function(_0x531b36){var _0x528af0={};_0x528af0[_0x531b36]={'$like':'%'+_0x223730['query'][_0xe5c9('0x38')]+'%'};return _0x528af0;})});}_0x4e803b=_[_0xe5c9('0x3a')]({},_0x4e803b,_0x223730['options']);return _0xf0e15a[_0xe5c9('0x4d')](_0x4e803b);}})[_0xe5c9('0x23')](function(_0x2dccba){if(_0x2dccba){_0x35cd15=_0x2dccba['length'];if(!_0x223730['query'][_0xe5c9('0x33')](_0xe5c9('0x4e'))){_0x4e803b[_0xe5c9('0x1a')]=qs['limit'](_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x1a')]);_0x4e803b[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x223730[_0xe5c9('0x2c')][_0xe5c9('0x1c')]);}return _0xf0e15a['getSubjects'](_0x4e803b);}})[_0xe5c9('0x23')](function(_0x375a4c){if(_0x375a4c){return _0x375a4c?{'count':_0x35cd15,'rows':_0x375a4c}:null;}})[_0xe5c9('0x23')](respondWithResult(_0x511ef5,null))[_0xe5c9('0x41')](handleError(_0x511ef5,null));};exports[_0xe5c9('0x4f')]=function(_0x514dbe,_0x427600,_0x2dca77){var _0x3994f5={};var _0x5b3845={};var _0x4cf402;var _0x4a69ae;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x514dbe[_0xe5c9('0x43')]['id']}})[_0xe5c9('0x23')](handleEntityNotFound(_0x427600,null))[_0xe5c9('0x23')](function(_0x166c23){if(_0x166c23){_0x4cf402=_0x166c23;_0x5b3845[_0xe5c9('0x2f')]=_[_0xe5c9('0x2d')](db[_0xe5c9('0x4b')]['rawAttributes']);_0x5b3845[_0xe5c9('0x2c')]=_[_0xe5c9('0x2d')](_0x514dbe[_0xe5c9('0x2c')]);_0x5b3845[_0xe5c9('0x37')]=_[_0xe5c9('0x2e')](_0x5b3845[_0xe5c9('0x2f')],_0x5b3845['query']);_0x3994f5['attributes']=_['intersection'](_0x5b3845[_0xe5c9('0x2f')],qs[_0xe5c9('0x31')](_0x514dbe[_0xe5c9('0x2c')]['fields']));_0x3994f5['attributes']=_0x3994f5[_0xe5c9('0x30')]['length']?_0x3994f5[_0xe5c9('0x30')]:_0x5b3845[_0xe5c9('0x2f')];_0x3994f5[_0xe5c9('0x4c')]=qs[_0xe5c9('0x34')](_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x34')]);_0x3994f5[_0xe5c9('0x35')]=qs['filters'](_['pick'](_0x514dbe[_0xe5c9('0x2c')],_0x5b3845[_0xe5c9('0x37')]));if(_0x514dbe[_0xe5c9('0x2c')]['filter']){_0x3994f5[_0xe5c9('0x35')]=_['merge'](_0x3994f5[_0xe5c9('0x35')],{'$or':_[_0xe5c9('0x28')](_0x3994f5['attributes'],function(_0x395057){var _0x2253d3={};_0x2253d3[_0x395057]={'$like':'%'+_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x38')]+'%'};return _0x2253d3;})});}_0x3994f5=_[_0xe5c9('0x3a')]({},_0x3994f5,_0x514dbe['options']);return _0x4cf402[_0xe5c9('0x4f')](_0x3994f5);}})[_0xe5c9('0x23')](function(_0x1f69fe){if(_0x1f69fe){_0x4a69ae=_0x1f69fe[_0xe5c9('0x32')];if(!_0x514dbe[_0xe5c9('0x2c')]['hasOwnProperty']('nolimit')){_0x3994f5[_0xe5c9('0x1a')]=qs[_0xe5c9('0x1a')](_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x1a')]);_0x3994f5[_0xe5c9('0x1c')]=qs[_0xe5c9('0x1c')](_0x514dbe[_0xe5c9('0x2c')][_0xe5c9('0x1c')]);}return _0x4cf402[_0xe5c9('0x4f')](_0x3994f5);}})[_0xe5c9('0x23')](function(_0x12d019){if(_0x12d019){return _0x12d019?{'count':_0x4a69ae,'rows':_0x12d019}:null;}})[_0xe5c9('0x23')](respondWithResult(_0x427600,null))[_0xe5c9('0x41')](handleError(_0x427600,null));}; \ No newline at end of file +var _0xc326=['send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','getFields','pick','hasOwnProperty','nolimit','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc326,0x7b));var _0x6c32=function(_0xe5bcfd,_0x17a060){_0xe5bcfd=_0xe5bcfd-0x0;var _0x1d5424=_0xc326[_0xe5bcfd];return _0x1d5424;};'use strict';var emlformat=require(_0x6c32('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c32('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c32('0x2'));var Mustache=require(_0x6c32('0x3'));var util=require(_0x6c32('0x4'));var path=require(_0x6c32('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c32('0x6'));var fs=require('fs');var fs_extra=require(_0x6c32('0x7'));var _=require(_0x6c32('0x8'));var squel=require(_0x6c32('0x9'));var crypto=require(_0x6c32('0xa'));var jsforce=require(_0x6c32('0xb'));var deskjs=require(_0x6c32('0xc'));var toCsv=require(_0x6c32('0xd'));var querystring=require(_0x6c32('0xe'));var Papa=require(_0x6c32('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c32('0x10'));var as=require(_0x6c32('0x11'));var hardwareService=require(_0x6c32('0x12'));var logger=require(_0x6c32('0x13'))('api');var utils=require(_0x6c32('0x14'));var config=require(_0x6c32('0x15'));var licenseUtil=require(_0x6c32('0x16'));var db=require(_0x6c32('0x17'))['db'];function respondWithStatusCode(_0x23c9a7,_0x3eff31){_0x3eff31=_0x3eff31||0xcc;return function(_0x5384ac){if(_0x5384ac){return _0x23c9a7[_0x6c32('0x18')](_0x3eff31);}return _0x23c9a7[_0x6c32('0x19')](_0x3eff31)[_0x6c32('0x1a')]();};}function respondWithResult(_0x1cecd2,_0x546064){_0x546064=_0x546064||0xc8;return function(_0xbd9fa2){if(_0xbd9fa2){return _0x1cecd2[_0x6c32('0x19')](_0x546064)[_0x6c32('0x1b')](_0xbd9fa2);}};}function respondWithFilteredResult(_0x502481,_0x269d1f){return function(_0x25d75a){if(_0x25d75a){var _0x1c1feb=typeof _0x269d1f[_0x6c32('0x1c')]==='undefined'&&typeof _0x269d1f[_0x6c32('0x1d')]==='undefined';var _0x4793f9=_0x25d75a[_0x6c32('0x1e')];var _0x207c46=_0x1c1feb?0x0:_0x269d1f[_0x6c32('0x1c')];var _0x566055=_0x1c1feb?_0x25d75a[_0x6c32('0x1e')]:_0x269d1f[_0x6c32('0x1c')]+_0x269d1f['limit'];var _0x35d42f;if(_0x566055>=_0x4793f9){_0x566055=_0x4793f9;_0x35d42f=0xc8;}else{_0x35d42f=0xce;}_0x502481[_0x6c32('0x19')](_0x35d42f);return _0x502481[_0x6c32('0x1f')](_0x6c32('0x20'),_0x207c46+'-'+_0x566055+'/'+_0x4793f9)[_0x6c32('0x1b')](_0x25d75a);}return null;};}function patchUpdates(_0xe2d6d0){return function(_0x58dd9f){try{jsonpatch[_0x6c32('0x21')](_0x58dd9f,_0xe2d6d0,!![]);}catch(_0x1abb2b){return BPromise[_0x6c32('0x22')](_0x1abb2b);}return _0x58dd9f[_0x6c32('0x23')]();};}function saveUpdates(_0x1541b3,_0x1506cb){return function(_0x357366){if(_0x357366){return _0x357366[_0x6c32('0x24')](_0x1541b3)[_0x6c32('0x25')](function(_0x258d79){return _0x258d79;});}return null;};}function removeEntity(_0x503110,_0x37c8a2){return function(_0x437411){if(_0x437411){return _0x437411['destroy']()['then'](function(){_0x503110['status'](0xcc)[_0x6c32('0x1a')]();});}};}function handleEntityNotFound(_0x484651,_0x4e08d4){return function(_0x25ed81){if(!_0x25ed81){_0x484651[_0x6c32('0x18')](0x194);}return _0x25ed81;};}function handleError(_0x4312f9,_0x269606){_0x269606=_0x269606||0x1f4;return function(_0x48ee74){logger[_0x6c32('0x26')](_0x48ee74[_0x6c32('0x27')]);if(_0x48ee74[_0x6c32('0x28')]){delete _0x48ee74['name'];}_0x4312f9[_0x6c32('0x19')](_0x269606)[_0x6c32('0x29')](_0x48ee74);};}exports[_0x6c32('0x2a')]=function(_0x19ce0d,_0xbf4ff){var _0x326026={},_0x39aa29={},_0x45e153={'count':0x0,'rows':[]};var _0x5c45fd=_[_0x6c32('0x2b')](db[_0x6c32('0x2c')][_0x6c32('0x2d')],function(_0x510ab0){return{'name':_0x510ab0[_0x6c32('0x2e')],'type':_0x510ab0[_0x6c32('0x2f')][_0x6c32('0x30')]};});_0x39aa29[_0x6c32('0x31')]=_['map'](_0x5c45fd,_0x6c32('0x28'));_0x39aa29[_0x6c32('0x32')]=_['keys'](_0x19ce0d[_0x6c32('0x32')]);_0x39aa29[_0x6c32('0x33')]=_['intersection'](_0x39aa29[_0x6c32('0x31')],_0x39aa29[_0x6c32('0x32')]);_0x326026[_0x6c32('0x34')]=_[_0x6c32('0x35')](_0x39aa29[_0x6c32('0x31')],qs[_0x6c32('0x36')](_0x19ce0d['query'][_0x6c32('0x36')]));_0x326026['attributes']=_0x326026[_0x6c32('0x34')][_0x6c32('0x37')]?_0x326026[_0x6c32('0x34')]:_0x39aa29[_0x6c32('0x31')];if(!_0x19ce0d[_0x6c32('0x32')]['hasOwnProperty']('nolimit')){_0x326026['limit']=qs[_0x6c32('0x1d')](_0x19ce0d[_0x6c32('0x32')][_0x6c32('0x1d')]);_0x326026[_0x6c32('0x1c')]=qs['offset'](_0x19ce0d['query'][_0x6c32('0x1c')]);}_0x326026[_0x6c32('0x38')]=qs['sort'](_0x19ce0d[_0x6c32('0x32')][_0x6c32('0x39')]);_0x326026[_0x6c32('0x3a')]=qs[_0x6c32('0x33')](_['pick'](_0x19ce0d['query'],_0x39aa29['filters']),_0x5c45fd);if(_0x19ce0d['query'][_0x6c32('0x3b')]){_0x326026[_0x6c32('0x3a')]=_[_0x6c32('0x3c')](_0x326026['where'],{'$or':_[_0x6c32('0x2b')](_0x5c45fd,function(_0x489834){if(_0x489834['type']!==_0x6c32('0x3d')){var _0x4c189a={};_0x4c189a[_0x489834['name']]={'$like':'%'+_0x19ce0d['query'][_0x6c32('0x3b')]+'%'};return _0x4c189a;}})});}_0x326026=_[_0x6c32('0x3c')]({},_0x326026,_0x19ce0d[_0x6c32('0x3e')]);var _0xa41436={'where':_0x326026[_0x6c32('0x3a')]};return db[_0x6c32('0x2c')]['count'](_0xa41436)[_0x6c32('0x25')](function(_0x3b414e){_0x45e153['count']=_0x3b414e;if(_0x19ce0d[_0x6c32('0x32')]['includeAll']){_0x326026[_0x6c32('0x3f')]=[{'all':!![]}];}return db[_0x6c32('0x2c')][_0x6c32('0x40')](_0x326026);})[_0x6c32('0x25')](function(_0x2c8fb0){_0x45e153[_0x6c32('0x41')]=_0x2c8fb0;return _0x45e153;})[_0x6c32('0x25')](respondWithFilteredResult(_0xbf4ff,_0x326026))[_0x6c32('0x42')](handleError(_0xbf4ff,null));};exports[_0x6c32('0x43')]=function(_0x1af5d3,_0x22c561){var _0x31d637={'raw':![],'where':{'id':_0x1af5d3[_0x6c32('0x44')]['id']}},_0x5be082={};_0x5be082[_0x6c32('0x31')]=_[_0x6c32('0x45')](db[_0x6c32('0x2c')]['rawAttributes']);_0x5be082[_0x6c32('0x32')]=_[_0x6c32('0x45')](_0x1af5d3[_0x6c32('0x32')]);_0x5be082[_0x6c32('0x33')]=_[_0x6c32('0x35')](_0x5be082[_0x6c32('0x31')],_0x5be082[_0x6c32('0x32')]);_0x31d637[_0x6c32('0x34')]=_['intersection'](_0x5be082[_0x6c32('0x31')],qs[_0x6c32('0x36')](_0x1af5d3[_0x6c32('0x32')]['fields']));_0x31d637[_0x6c32('0x34')]=_0x31d637[_0x6c32('0x34')][_0x6c32('0x37')]?_0x31d637[_0x6c32('0x34')]:_0x5be082['model'];if(_0x1af5d3[_0x6c32('0x32')]['includeAll']){_0x31d637[_0x6c32('0x3f')]=[{'all':!![]}];}_0x31d637=_[_0x6c32('0x3c')]({},_0x31d637,_0x1af5d3['options']);return db[_0x6c32('0x2c')]['find'](_0x31d637)[_0x6c32('0x25')](handleEntityNotFound(_0x22c561,null))[_0x6c32('0x25')](respondWithResult(_0x22c561,null))['catch'](handleError(_0x22c561,null));};exports[_0x6c32('0x46')]=function(_0x4b5680,_0x43c688){return db['SugarcrmConfiguration']['create'](_0x4b5680[_0x6c32('0x47')],{})[_0x6c32('0x25')](respondWithResult(_0x43c688,0xc9))[_0x6c32('0x42')](handleError(_0x43c688,null));};exports[_0x6c32('0x24')]=function(_0x49944f,_0x3b174d){if(_0x49944f[_0x6c32('0x47')]['id']){delete _0x49944f['body']['id'];}return db['SugarcrmConfiguration'][_0x6c32('0x48')]({'where':{'id':_0x49944f[_0x6c32('0x44')]['id']}})[_0x6c32('0x25')](handleEntityNotFound(_0x3b174d,null))[_0x6c32('0x25')](saveUpdates(_0x49944f[_0x6c32('0x47')],null))[_0x6c32('0x25')](respondWithResult(_0x3b174d,null))[_0x6c32('0x42')](handleError(_0x3b174d,null));};exports[_0x6c32('0x49')]=function(_0x135df1,_0x4cc339){return db['SugarcrmConfiguration'][_0x6c32('0x48')]({'where':{'id':_0x135df1[_0x6c32('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cc339,null))[_0x6c32('0x25')](removeEntity(_0x4cc339,null))[_0x6c32('0x42')](handleError(_0x4cc339,null));};exports[_0x6c32('0x4a')]=function(_0x4e7f80,_0x1d760c,_0x5c6406){var _0x53275a={};var _0x32545e={};var _0x31c75a;var _0x146a7f;return db[_0x6c32('0x2c')]['findOne']({'where':{'id':_0x4e7f80[_0x6c32('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d760c,null))['then'](function(_0xcaf588){if(_0xcaf588){_0x31c75a=_0xcaf588;_0x32545e[_0x6c32('0x31')]=_[_0x6c32('0x45')](db['SugarcrmField'][_0x6c32('0x2d')]);_0x32545e[_0x6c32('0x32')]=_[_0x6c32('0x45')](_0x4e7f80['query']);_0x32545e[_0x6c32('0x33')]=_['intersection'](_0x32545e[_0x6c32('0x31')],_0x32545e[_0x6c32('0x32')]);_0x53275a[_0x6c32('0x34')]=_['intersection'](_0x32545e[_0x6c32('0x31')],qs[_0x6c32('0x36')](_0x4e7f80[_0x6c32('0x32')][_0x6c32('0x36')]));_0x53275a[_0x6c32('0x34')]=_0x53275a[_0x6c32('0x34')]['length']?_0x53275a[_0x6c32('0x34')]:_0x32545e[_0x6c32('0x31')];_0x53275a[_0x6c32('0x38')]=qs[_0x6c32('0x39')](_0x4e7f80[_0x6c32('0x32')]['sort']);_0x53275a[_0x6c32('0x3a')]=qs['filters'](_[_0x6c32('0x4b')](_0x4e7f80[_0x6c32('0x32')],_0x32545e[_0x6c32('0x33')]));if(_0x4e7f80['query'][_0x6c32('0x3b')]){_0x53275a[_0x6c32('0x3a')]=_[_0x6c32('0x3c')](_0x53275a[_0x6c32('0x3a')],{'$or':_[_0x6c32('0x2b')](_0x53275a[_0x6c32('0x34')],function(_0x26c012){var _0x615836={};_0x615836[_0x26c012]={'$like':'%'+_0x4e7f80[_0x6c32('0x32')][_0x6c32('0x3b')]+'%'};return _0x615836;})});}_0x53275a=_['merge']({},_0x53275a,_0x4e7f80[_0x6c32('0x3e')]);return _0x31c75a[_0x6c32('0x4a')](_0x53275a);}})[_0x6c32('0x25')](function(_0x38dadb){if(_0x38dadb){_0x146a7f=_0x38dadb[_0x6c32('0x37')];if(!_0x4e7f80['query'][_0x6c32('0x4c')](_0x6c32('0x4d'))){_0x53275a[_0x6c32('0x1d')]=qs[_0x6c32('0x1d')](_0x4e7f80['query'][_0x6c32('0x1d')]);_0x53275a[_0x6c32('0x1c')]=qs[_0x6c32('0x1c')](_0x4e7f80[_0x6c32('0x32')][_0x6c32('0x1c')]);}return _0x31c75a[_0x6c32('0x4a')](_0x53275a);}})['then'](function(_0x3df984){if(_0x3df984){return _0x3df984?{'count':_0x146a7f,'rows':_0x3df984}:null;}})[_0x6c32('0x25')](respondWithResult(_0x1d760c,null))[_0x6c32('0x42')](handleError(_0x1d760c,null));};exports[_0x6c32('0x4e')]=function(_0x24a8d6,_0x14d861,_0x4d5193){var _0x44189a={};var _0x59c8e1={};var _0x565c3b;var _0x3b62e4;return db[_0x6c32('0x2c')][_0x6c32('0x4f')]({'where':{'id':_0x24a8d6['params']['id']}})[_0x6c32('0x25')](handleEntityNotFound(_0x14d861,null))[_0x6c32('0x25')](function(_0x1d455c){if(_0x1d455c){_0x565c3b=_0x1d455c;_0x59c8e1[_0x6c32('0x31')]=_[_0x6c32('0x45')](db[_0x6c32('0x50')][_0x6c32('0x2d')]);_0x59c8e1[_0x6c32('0x32')]=_[_0x6c32('0x45')](_0x24a8d6[_0x6c32('0x32')]);_0x59c8e1[_0x6c32('0x33')]=_['intersection'](_0x59c8e1[_0x6c32('0x31')],_0x59c8e1[_0x6c32('0x32')]);_0x44189a[_0x6c32('0x34')]=_[_0x6c32('0x35')](_0x59c8e1[_0x6c32('0x31')],qs[_0x6c32('0x36')](_0x24a8d6['query'][_0x6c32('0x36')]));_0x44189a[_0x6c32('0x34')]=_0x44189a['attributes'][_0x6c32('0x37')]?_0x44189a[_0x6c32('0x34')]:_0x59c8e1['model'];_0x44189a[_0x6c32('0x38')]=qs['sort'](_0x24a8d6['query'][_0x6c32('0x39')]);_0x44189a[_0x6c32('0x3a')]=qs[_0x6c32('0x33')](_[_0x6c32('0x4b')](_0x24a8d6[_0x6c32('0x32')],_0x59c8e1[_0x6c32('0x33')]));if(_0x24a8d6['query'][_0x6c32('0x3b')]){_0x44189a['where']=_[_0x6c32('0x3c')](_0x44189a[_0x6c32('0x3a')],{'$or':_[_0x6c32('0x2b')](_0x44189a[_0x6c32('0x34')],function(_0x1fe090){var _0x2615c2={};_0x2615c2[_0x1fe090]={'$like':'%'+_0x24a8d6[_0x6c32('0x32')][_0x6c32('0x3b')]+'%'};return _0x2615c2;})});}_0x44189a=_[_0x6c32('0x3c')]({},_0x44189a,_0x24a8d6[_0x6c32('0x3e')]);return _0x565c3b[_0x6c32('0x4e')](_0x44189a);}})['then'](function(_0x1ea196){if(_0x1ea196){_0x3b62e4=_0x1ea196[_0x6c32('0x37')];if(!_0x24a8d6[_0x6c32('0x32')]['hasOwnProperty']('nolimit')){_0x44189a['limit']=qs[_0x6c32('0x1d')](_0x24a8d6[_0x6c32('0x32')][_0x6c32('0x1d')]);_0x44189a['offset']=qs['offset'](_0x24a8d6['query']['offset']);}return _0x565c3b[_0x6c32('0x4e')](_0x44189a);}})['then'](function(_0xa00c8e){if(_0xa00c8e){return _0xa00c8e?{'count':_0x3b62e4,'rows':_0xa00c8e}:null;}})[_0x6c32('0x25')](respondWithResult(_0x14d861,null))[_0x6c32('0x42')](handleError(_0x14d861,null));};exports[_0x6c32('0x51')]=function(_0x1b9ee2,_0x573c63,_0x20b5d7){var _0x14f077={};var _0x11c86f={};var _0x4c811f;var _0x28cae3;return db['SugarcrmConfiguration'][_0x6c32('0x4f')]({'where':{'id':_0x1b9ee2[_0x6c32('0x44')]['id']}})[_0x6c32('0x25')](handleEntityNotFound(_0x573c63,null))[_0x6c32('0x25')](function(_0x59c0df){if(_0x59c0df){_0x4c811f=_0x59c0df;_0x11c86f[_0x6c32('0x31')]=_[_0x6c32('0x45')](db['SugarcrmField']['rawAttributes']);_0x11c86f[_0x6c32('0x32')]=_[_0x6c32('0x45')](_0x1b9ee2[_0x6c32('0x32')]);_0x11c86f[_0x6c32('0x33')]=_[_0x6c32('0x35')](_0x11c86f['model'],_0x11c86f[_0x6c32('0x32')]);_0x14f077['attributes']=_['intersection'](_0x11c86f[_0x6c32('0x31')],qs[_0x6c32('0x36')](_0x1b9ee2[_0x6c32('0x32')][_0x6c32('0x36')]));_0x14f077[_0x6c32('0x34')]=_0x14f077[_0x6c32('0x34')][_0x6c32('0x37')]?_0x14f077[_0x6c32('0x34')]:_0x11c86f['model'];_0x14f077[_0x6c32('0x38')]=qs[_0x6c32('0x39')](_0x1b9ee2[_0x6c32('0x32')][_0x6c32('0x39')]);_0x14f077[_0x6c32('0x3a')]=qs[_0x6c32('0x33')](_[_0x6c32('0x4b')](_0x1b9ee2[_0x6c32('0x32')],_0x11c86f[_0x6c32('0x33')]));if(_0x1b9ee2['query'][_0x6c32('0x3b')]){_0x14f077[_0x6c32('0x3a')]=_[_0x6c32('0x3c')](_0x14f077[_0x6c32('0x3a')],{'$or':_[_0x6c32('0x2b')](_0x14f077[_0x6c32('0x34')],function(_0x302bd5){var _0x3a52a6={};_0x3a52a6[_0x302bd5]={'$like':'%'+_0x1b9ee2[_0x6c32('0x32')][_0x6c32('0x3b')]+'%'};return _0x3a52a6;})});}_0x14f077=_[_0x6c32('0x3c')]({},_0x14f077,_0x1b9ee2[_0x6c32('0x3e')]);return _0x4c811f[_0x6c32('0x51')](_0x14f077);}})['then'](function(_0x3a6090){if(_0x3a6090){_0x28cae3=_0x3a6090[_0x6c32('0x37')];if(!_0x1b9ee2[_0x6c32('0x32')][_0x6c32('0x4c')]('nolimit')){_0x14f077[_0x6c32('0x1d')]=qs[_0x6c32('0x1d')](_0x1b9ee2[_0x6c32('0x32')][_0x6c32('0x1d')]);_0x14f077[_0x6c32('0x1c')]=qs[_0x6c32('0x1c')](_0x1b9ee2['query'][_0x6c32('0x1c')]);}return _0x4c811f['getDescriptions'](_0x14f077);}})[_0x6c32('0x25')](function(_0x4d82b0){if(_0x4d82b0){return _0x4d82b0?{'count':_0x28cae3,'rows':_0x4d82b0}:null;}})[_0x6c32('0x25')](respondWithResult(_0x573c63,null))[_0x6c32('0x42')](handleError(_0x573c63,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2dd3ac6..c703b15 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 _0x19d0=['moment','bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0xe08925,_0x46ee17){var _0x17b36e=function(_0x36b162){while(--_0x36b162){_0xe08925['push'](_0xe08925['shift']());}};_0x17b36e(++_0x46ee17);}(_0x19d0,0xc2));var _0x019d=function(_0x29431d,_0x23d339){_0x29431d=_0x29431d-0x0;var _0x49f8ac=_0x19d0[_0x29431d];return _0x49f8ac;};'use strict';var _=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var logger=require(_0x019d('0x2'))(_0x019d('0x3'));var moment=require(_0x019d('0x4'));var BPromise=require(_0x019d('0x5'));var rp=require(_0x019d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x019d('0x7'));var config=require('../../config/environment');var attributes=require(_0x019d('0x8'));module['exports']=function(_0x382e18,_0x3a18eb){return _0x382e18['define'](_0x019d('0x9'),attributes,{'tableName':_0x019d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0f0=['bluebird','request-promise','../../config/environment','exports','int_sugarcrm_configurations','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0f0,0x8c));var _0x0f0f=function(_0x3ce87a,_0xe59e94){_0x3ce87a=_0x3ce87a-0x0;var _0x5dfcea=_0xf0f0[_0x3ce87a];return _0x5dfcea;};'use strict';var _=require(_0x0f0f('0x0'));var util=require('util');var logger=require(_0x0f0f('0x1'))(_0x0f0f('0x2'));var moment=require(_0x0f0f('0x3'));var BPromise=require(_0x0f0f('0x4'));var rp=require(_0x0f0f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0f0f('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x0f0f('0x7')]=function(_0x4d2733,_0xd378a5){return _0x4d2733['define']('SugarcrmConfiguration',attributes,{'tableName':_0x0f0f('0x8'),'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 9355442..48fa069 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 _0x2641=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x2641,0x133));var _0x1264=function(_0x4bd700,_0x3e2348){_0x4bd700=_0x4bd700-0x0;var _0x12b765=_0x2641[_0x4bd700];return _0x12b765;};'use strict';var _=require(_0x1264('0x0'));var util=require(_0x1264('0x1'));var moment=require('moment');var BPromise=require(_0x1264('0x2'));var rs=require(_0x1264('0x3'));var fs=require('fs');var Redis=require(_0x1264('0x4'));var db=require(_0x1264('0x5'))['db'];var utils=require(_0x1264('0x6'));var logger=require(_0x1264('0x7'))('rpc');var config=require(_0x1264('0x8'));var jayson=require(_0x1264('0x9'));var client=jayson[_0x1264('0xa')][_0x1264('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb9e2,_0x47f23b,_0x52a232){return new BPromise(function(_0x234e09,_0x5c610f){return client['request'](_0x3eb9e2,_0x52a232)[_0x1264('0xc')](function(_0xb7c6ad){logger[_0x1264('0xd')](_0x1264('0xe'),_0x47f23b,'request\x20sent');logger[_0x1264('0xf')](_0x1264('0x10'),_0x47f23b,_0x1264('0x11'),JSON[_0x1264('0x12')](_0xb7c6ad));if(_0xb7c6ad[_0x1264('0x13')]){if(_0xb7c6ad[_0x1264('0x13')][_0x1264('0x14')]===0x1f4){logger[_0x1264('0x13')](_0x1264('0xe'),_0x47f23b,_0xb7c6ad[_0x1264('0x13')]['message']);return _0x5c610f(_0xb7c6ad[_0x1264('0x13')][_0x1264('0x15')]);}logger[_0x1264('0x13')](_0x1264('0xe'),_0x47f23b,_0xb7c6ad['error'][_0x1264('0x15')]);return _0x234e09(_0xb7c6ad[_0x1264('0x13')]['message']);}else{logger[_0x1264('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x47f23b,_0x1264('0x11'));_0x234e09(_0xb7c6ad[_0x1264('0x16')][_0x1264('0x15')]);}})[_0x1264('0x17')](function(_0x30dfe3){logger[_0x1264('0x13')](_0x1264('0xe'),_0x47f23b,_0x30dfe3);_0x5c610f(_0x30dfe3);});});} \ No newline at end of file +var _0x8bdc=['SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code'];(function(_0x4f3f31,_0x12f348){var _0x87dbd0=function(_0x4be664){while(--_0x4be664){_0x4f3f31['push'](_0x4f3f31['shift']());}};_0x87dbd0(++_0x12f348);}(_0x8bdc,0x13c));var _0xc8bd=function(_0x2738f5,_0x57cbea){_0x2738f5=_0x2738f5-0x0;var _0x24f291=_0x8bdc[_0x2738f5];return _0x24f291;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8bd('0x0'));var BPromise=require(_0xc8bd('0x1'));var rs=require(_0xc8bd('0x2'));var fs=require('fs');var Redis=require(_0xc8bd('0x3'));var db=require(_0xc8bd('0x4'))['db'];var utils=require(_0xc8bd('0x5'));var logger=require(_0xc8bd('0x6'))(_0xc8bd('0x7'));var config=require(_0xc8bd('0x8'));var jayson=require(_0xc8bd('0x9'));var client=jayson[_0xc8bd('0xa')][_0xc8bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf1e60f,_0x43604e,_0x347982){return new BPromise(function(_0x392a31,_0x94352){return client[_0xc8bd('0xc')](_0xf1e60f,_0x347982)[_0xc8bd('0xd')](function(_0x171345){logger[_0xc8bd('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x43604e,'request\x20sent');logger[_0xc8bd('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x43604e,_0xc8bd('0x10'),JSON[_0xc8bd('0x11')](_0x171345));if(_0x171345[_0xc8bd('0x12')]){if(_0x171345[_0xc8bd('0x12')][_0xc8bd('0x13')]===0x1f4){logger[_0xc8bd('0x12')](_0xc8bd('0x14'),_0x43604e,_0x171345[_0xc8bd('0x12')]['message']);return _0x94352(_0x171345[_0xc8bd('0x12')][_0xc8bd('0x15')]);}logger[_0xc8bd('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x43604e,_0x171345['error'][_0xc8bd('0x15')]);return _0x392a31(_0x171345[_0xc8bd('0x12')][_0xc8bd('0x15')]);}else{logger[_0xc8bd('0xe')](_0xc8bd('0x14'),_0x43604e,'request\x20sent');_0x392a31(_0x171345[_0xc8bd('0x16')]['message']);}})[_0xc8bd('0x17')](function(_0x5949be){logger[_0xc8bd('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x43604e,_0x5949be);_0x94352(_0x5949be);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4060788..7d7c5a6 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 _0xb679=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x22499b,_0x3d5a5c){var _0x35cabe=function(_0x883037){while(--_0x883037){_0x22499b['push'](_0x22499b['shift']());}};_0x35cabe(++_0x3d5a5c);}(_0xb679,0xe5));var _0x9b67=function(_0xed0f75,_0x279c68){_0xed0f75=_0xed0f75-0x0;var _0x3abd22=_0xb679[_0xed0f75];return _0x3abd22;};'use strict';var multer=require(_0x9b67('0x0'));var util=require('util');var path=require(_0x9b67('0x1'));var timeout=require(_0x9b67('0x2'));var express=require(_0x9b67('0x3'));var router=express[_0x9b67('0x4')]();var fs_extra=require(_0x9b67('0x5'));var auth=require(_0x9b67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b67('0x7'));var controller=require(_0x9b67('0x8'));router[_0x9b67('0x9')]('/',auth[_0x9b67('0xa')](),controller[_0x9b67('0xb')]);router[_0x9b67('0x9')]('/:id',auth[_0x9b67('0xa')](),controller[_0x9b67('0xc')]);router[_0x9b67('0xd')]('/',auth[_0x9b67('0xa')](),controller[_0x9b67('0xe')]);router[_0x9b67('0xf')](_0x9b67('0x10'),auth['isAuthenticated'](),controller[_0x9b67('0x11')]);router[_0x9b67('0x12')](_0x9b67('0x10'),auth['isAuthenticated'](),controller[_0x9b67('0x13')]);module[_0x9b67('0x14')]=router; \ No newline at end of file +var _0xff55=['connect-timeout','express','Router','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xff55,0x9f));var _0x5ff5=function(_0x49b716,_0x3ff724){_0x49b716=_0x49b716-0x0;var _0x19ee5c=_0xff55[_0x49b716];return _0x19ee5c;};'use strict';var multer=require(_0x5ff5('0x0'));var util=require(_0x5ff5('0x1'));var path=require(_0x5ff5('0x2'));var timeout=require(_0x5ff5('0x3'));var express=require(_0x5ff5('0x4'));var router=express[_0x5ff5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ff5('0x6'));var controller=require(_0x5ff5('0x7'));router['get']('/',auth[_0x5ff5('0x8')](),controller['index']);router[_0x5ff5('0x9')](_0x5ff5('0xa'),auth[_0x5ff5('0x8')](),controller[_0x5ff5('0xb')]);router['post']('/',auth[_0x5ff5('0x8')](),controller[_0x5ff5('0xc')]);router[_0x5ff5('0xd')](_0x5ff5('0xa'),auth[_0x5ff5('0x8')](),controller[_0x5ff5('0xe')]);router[_0x5ff5('0xf')](_0x5ff5('0xa'),auth[_0x5ff5('0x8')](),controller[_0x5ff5('0x10')]);module[_0x5ff5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9a289ef..23156b5 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 _0xceda=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x131cc,_0x157ea9){var _0x36e23b=function(_0x364bbf){while(--_0x364bbf){_0x131cc['push'](_0x131cc['shift']());}};_0x36e23b(++_0x157ea9);}(_0xceda,0x1ad));var _0xaced=function(_0x15ee54,_0x3908f1){_0x15ee54=_0x15ee54-0x0;var _0x59cc40=_0xceda[_0x15ee54];return _0x59cc40;};'use strict';var Sequelize=require(_0xaced('0x0'));module[_0xaced('0x1')]={'type':{'type':Sequelize[_0xaced('0x2')]('string','variable',_0xaced('0x3'),_0xaced('0x4'),_0xaced('0x5')),'defaultValue':_0xaced('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaced('0x7')]},'keyType':{'type':Sequelize[_0xaced('0x2')](_0xaced('0x6'),'variable',_0xaced('0x3'))},'keyContent':{'type':Sequelize[_0xaced('0x7')]},'idField':{'type':Sequelize[_0xaced('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaced('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaced('0x7')]}}; \ No newline at end of file +var _0x9dc0=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x336c57,_0x382cbf){var _0x26d9cf=function(_0x1a0f25){while(--_0x1a0f25){_0x336c57['push'](_0x336c57['shift']());}};_0x26d9cf(++_0x382cbf);}(_0x9dc0,0x17a));var _0x09dc=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x9dc0[_0x5dbb84];return _0x1d6eae;};'use strict';var Sequelize=require(_0x09dc('0x0'));module['exports']={'type':{'type':Sequelize[_0x09dc('0x1')](_0x09dc('0x2'),_0x09dc('0x3'),_0x09dc('0x4'),'keyValue',_0x09dc('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x09dc('0x6')]},'key':{'type':Sequelize[_0x09dc('0x6')]},'keyType':{'type':Sequelize[_0x09dc('0x1')](_0x09dc('0x2'),_0x09dc('0x3'),_0x09dc('0x4'))},'keyContent':{'type':Sequelize[_0x09dc('0x6')]},'idField':{'type':Sequelize[_0x09dc('0x6')]},'nameField':{'type':Sequelize[_0x09dc('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 6f32508..9ef6d46 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 _0xcbaa=['lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra'];(function(_0x10949d,_0x36325a){var _0x28f4e6=function(_0x105808){while(--_0x105808){_0x10949d['push'](_0x10949d['shift']());}};_0x28f4e6(++_0x36325a);}(_0xcbaa,0x196));var _0xacba=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xcbaa[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xacba('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacba('0x1'));var rp=require('request-promise');var moment=require(_0xacba('0x2'));var BPromise=require(_0xacba('0x3'));var Mustache=require(_0xacba('0x4'));var util=require('util');var path=require(_0xacba('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacba('0x6'));var fs=require('fs');var fs_extra=require(_0xacba('0x7'));var _=require(_0xacba('0x8'));var squel=require(_0xacba('0x9'));var crypto=require(_0xacba('0xa'));var jsforce=require(_0xacba('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xacba('0xc'));var querystring=require(_0xacba('0xd'));var Papa=require(_0xacba('0xe'));var Redis=require('ioredis');var authService=require(_0xacba('0xf'));var qs=require(_0xacba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xacba('0x11'))('api');var utils=require(_0xacba('0x12'));var config=require(_0xacba('0x13'));var licenseUtil=require(_0xacba('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d2aa,_0x2f6db8){_0x2f6db8=_0x2f6db8||0xcc;return function(_0x47b659){if(_0x47b659){return _0x42d2aa[_0xacba('0x15')](_0x2f6db8);}return _0x42d2aa[_0xacba('0x16')](_0x2f6db8)[_0xacba('0x17')]();};}function respondWithResult(_0x42e013,_0x1d6415){_0x1d6415=_0x1d6415||0xc8;return function(_0x28a2c6){if(_0x28a2c6){return _0x42e013[_0xacba('0x16')](_0x1d6415)[_0xacba('0x18')](_0x28a2c6);}};}function respondWithFilteredResult(_0x582687,_0x57e82b){return function(_0x318efb){if(_0x318efb){var _0x2f4a36=typeof _0x57e82b['offset']===_0xacba('0x19')&&typeof _0x57e82b[_0xacba('0x1a')]==='undefined';var _0x47528d=_0x318efb[_0xacba('0x1b')];var _0x5a7cd0=_0x2f4a36?0x0:_0x57e82b['offset'];var _0x3975a3=_0x2f4a36?_0x318efb['count']:_0x57e82b[_0xacba('0x1c')]+_0x57e82b['limit'];var _0x50620c;if(_0x3975a3>=_0x47528d){_0x3975a3=_0x47528d;_0x50620c=0xc8;}else{_0x50620c=0xce;}_0x582687[_0xacba('0x16')](_0x50620c);return _0x582687[_0xacba('0x1d')]('Content-Range',_0x5a7cd0+'-'+_0x3975a3+'/'+_0x47528d)['json'](_0x318efb);}return null;};}function patchUpdates(_0x368e05){return function(_0x49b3eb){try{jsonpatch[_0xacba('0x1e')](_0x49b3eb,_0x368e05,!![]);}catch(_0xb799f2){return BPromise[_0xacba('0x1f')](_0xb799f2);}return _0x49b3eb[_0xacba('0x20')]();};}function saveUpdates(_0x50a61b,_0x4cca61){return function(_0x1b87e3){if(_0x1b87e3){return _0x1b87e3[_0xacba('0x21')](_0x50a61b)[_0xacba('0x22')](function(_0x2039e4){return _0x2039e4;});}return null;};}function removeEntity(_0x135c75,_0x2f89a5){return function(_0x2d3662){if(_0x2d3662){return _0x2d3662[_0xacba('0x23')]()[_0xacba('0x22')](function(){_0x135c75['status'](0xcc)[_0xacba('0x17')]();});}};}function handleEntityNotFound(_0x494949,_0x5d434f){return function(_0x13fa12){if(!_0x13fa12){_0x494949[_0xacba('0x15')](0x194);}return _0x13fa12;};}function handleError(_0x19fa4c,_0xae6559){_0xae6559=_0xae6559||0x1f4;return function(_0x3c6253){logger[_0xacba('0x24')](_0x3c6253[_0xacba('0x25')]);if(_0x3c6253[_0xacba('0x26')]){delete _0x3c6253[_0xacba('0x26')];}_0x19fa4c[_0xacba('0x16')](_0xae6559)[_0xacba('0x27')](_0x3c6253);};}exports['index']=function(_0x3c7b2b,_0x3bea23){var _0x15a619={},_0x5e7ab4={},_0x42b0e2={'count':0x0,'rows':[]};var _0x3ac68b=_[_0xacba('0x28')](db[_0xacba('0x29')][_0xacba('0x2a')],function(_0x1f7d84){return{'name':_0x1f7d84['fieldName'],'type':_0x1f7d84[_0xacba('0x2b')]['key']};});_0x5e7ab4[_0xacba('0x2c')]=_[_0xacba('0x28')](_0x3ac68b,'name');_0x5e7ab4[_0xacba('0x2d')]=_['keys'](_0x3c7b2b[_0xacba('0x2d')]);_0x5e7ab4[_0xacba('0x2e')]=_['intersection'](_0x5e7ab4[_0xacba('0x2c')],_0x5e7ab4[_0xacba('0x2d')]);_0x15a619[_0xacba('0x2f')]=_[_0xacba('0x30')](_0x5e7ab4[_0xacba('0x2c')],qs[_0xacba('0x31')](_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x31')]));_0x15a619[_0xacba('0x2f')]=_0x15a619[_0xacba('0x2f')][_0xacba('0x32')]?_0x15a619[_0xacba('0x2f')]:_0x5e7ab4[_0xacba('0x2c')];if(!_0x3c7b2b[_0xacba('0x2d')]['hasOwnProperty'](_0xacba('0x33'))){_0x15a619[_0xacba('0x1a')]=qs[_0xacba('0x1a')](_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x1a')]);_0x15a619[_0xacba('0x1c')]=qs[_0xacba('0x1c')](_0x3c7b2b['query'][_0xacba('0x1c')]);}_0x15a619[_0xacba('0x34')]=qs[_0xacba('0x35')](_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x35')]);_0x15a619[_0xacba('0x36')]=qs[_0xacba('0x2e')](_['pick'](_0x3c7b2b['query'],_0x5e7ab4[_0xacba('0x2e')]),_0x3ac68b);if(_0x3c7b2b[_0xacba('0x2d')][_0xacba('0x37')]){_0x15a619['where']=_[_0xacba('0x38')](_0x15a619[_0xacba('0x36')],{'$or':_[_0xacba('0x28')](_0x3ac68b,function(_0x574a7a){if(_0x574a7a[_0xacba('0x2b')]!==_0xacba('0x39')){var _0x15b2f8={};_0x15b2f8[_0x574a7a[_0xacba('0x26')]]={'$like':'%'+_0x3c7b2b['query'][_0xacba('0x37')]+'%'};return _0x15b2f8;}})});}_0x15a619=_['merge']({},_0x15a619,_0x3c7b2b[_0xacba('0x3a')]);var _0x56dbf0={'where':_0x15a619[_0xacba('0x36')]};return db[_0xacba('0x29')][_0xacba('0x1b')](_0x56dbf0)['then'](function(_0x405fcc){_0x42b0e2[_0xacba('0x1b')]=_0x405fcc;if(_0x3c7b2b['query'][_0xacba('0x3b')]){_0x15a619[_0xacba('0x3c')]=[{'all':!![]}];}return db['SugarcrmField'][_0xacba('0x3d')](_0x15a619);})[_0xacba('0x22')](function(_0x6d37c4){_0x42b0e2[_0xacba('0x3e')]=_0x6d37c4;return _0x42b0e2;})['then'](respondWithFilteredResult(_0x3bea23,_0x15a619))[_0xacba('0x3f')](handleError(_0x3bea23,null));};exports[_0xacba('0x40')]=function(_0x1d23a4,_0x19e288){var _0x4c16af={'raw':!![],'where':{'id':_0x1d23a4['params']['id']}},_0x5385d1={};_0x5385d1['model']=_['keys'](db[_0xacba('0x29')]['rawAttributes']);_0x5385d1[_0xacba('0x2d')]=_[_0xacba('0x41')](_0x1d23a4[_0xacba('0x2d')]);_0x5385d1['filters']=_['intersection'](_0x5385d1[_0xacba('0x2c')],_0x5385d1['query']);_0x4c16af['attributes']=_['intersection'](_0x5385d1['model'],qs[_0xacba('0x31')](_0x1d23a4[_0xacba('0x2d')]['fields']));_0x4c16af[_0xacba('0x2f')]=_0x4c16af[_0xacba('0x2f')][_0xacba('0x32')]?_0x4c16af[_0xacba('0x2f')]:_0x5385d1[_0xacba('0x2c')];if(_0x1d23a4[_0xacba('0x2d')]['includeAll']){_0x4c16af[_0xacba('0x3c')]=[{'all':!![]}];}_0x4c16af=_[_0xacba('0x38')]({},_0x4c16af,_0x1d23a4['options']);return db[_0xacba('0x29')][_0xacba('0x42')](_0x4c16af)[_0xacba('0x22')](handleEntityNotFound(_0x19e288,null))[_0xacba('0x22')](respondWithResult(_0x19e288,null))[_0xacba('0x3f')](handleError(_0x19e288,null));};exports[_0xacba('0x43')]=function(_0xe3a005,_0x40b6b1){return db['SugarcrmField'][_0xacba('0x43')](_0xe3a005['body'],{})['then'](respondWithResult(_0x40b6b1,0xc9))[_0xacba('0x3f')](handleError(_0x40b6b1,null));};exports[_0xacba('0x21')]=function(_0xb9d99,_0x3d6f9d){if(_0xb9d99[_0xacba('0x44')]['id']){delete _0xb9d99[_0xacba('0x44')]['id'];}return db[_0xacba('0x29')][_0xacba('0x42')]({'where':{'id':_0xb9d99['params']['id']}})[_0xacba('0x22')](handleEntityNotFound(_0x3d6f9d,null))[_0xacba('0x22')](saveUpdates(_0xb9d99[_0xacba('0x44')],null))[_0xacba('0x22')](respondWithResult(_0x3d6f9d,null))[_0xacba('0x3f')](handleError(_0x3d6f9d,null));};exports[_0xacba('0x23')]=function(_0x32af85,_0x56aba0){return db[_0xacba('0x29')][_0xacba('0x42')]({'where':{'id':_0x32af85['params']['id']}})['then'](handleEntityNotFound(_0x56aba0,null))['then'](removeEntity(_0x56aba0,null))[_0xacba('0x3f')](handleError(_0x56aba0,null));}; \ No newline at end of file +var _0xb1fb=['save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','SugarcrmField','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x5b1acd,_0x4f7f2f){var _0x1ed300=function(_0x1ee3ef){while(--_0x1ee3ef){_0x5b1acd['push'](_0x5b1acd['shift']());}};_0x1ed300(++_0x4f7f2f);}(_0xb1fb,0x1c8));var _0xbb1f=function(_0x4834f3,_0x3fbff9){_0x4834f3=_0x4834f3-0x0;var _0x36988e=_0xb1fb[_0x4834f3];return _0x36988e;};'use strict';var emlformat=require(_0xbb1f('0x0'));var rimraf=require(_0xbb1f('0x1'));var zipdir=require(_0xbb1f('0x2'));var jsonpatch=require(_0xbb1f('0x3'));var rp=require(_0xbb1f('0x4'));var moment=require(_0xbb1f('0x5'));var BPromise=require(_0xbb1f('0x6'));var Mustache=require(_0xbb1f('0x7'));var util=require(_0xbb1f('0x8'));var path=require(_0xbb1f('0x9'));var sox=require(_0xbb1f('0xa'));var csv=require(_0xbb1f('0xb'));var ejs=require(_0xbb1f('0xc'));var fs=require('fs');var fs_extra=require(_0xbb1f('0xd'));var _=require(_0xbb1f('0xe'));var squel=require(_0xbb1f('0xf'));var crypto=require(_0xbb1f('0x10'));var jsforce=require(_0xbb1f('0x11'));var deskjs=require(_0xbb1f('0x12'));var toCsv=require('to-csv');var querystring=require(_0xbb1f('0x13'));var Papa=require(_0xbb1f('0x14'));var Redis=require(_0xbb1f('0x15'));var authService=require(_0xbb1f('0x16'));var qs=require(_0xbb1f('0x17'));var as=require(_0xbb1f('0x18'));var hardwareService=require(_0xbb1f('0x19'));var logger=require(_0xbb1f('0x1a'))(_0xbb1f('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbb1f('0x1c'));var db=require(_0xbb1f('0x1d'))['db'];function respondWithStatusCode(_0x441a2f,_0x331e79){_0x331e79=_0x331e79||0xcc;return function(_0x53b67e){if(_0x53b67e){return _0x441a2f[_0xbb1f('0x1e')](_0x331e79);}return _0x441a2f[_0xbb1f('0x1f')](_0x331e79)[_0xbb1f('0x20')]();};}function respondWithResult(_0x53557e,_0x2d34d8){_0x2d34d8=_0x2d34d8||0xc8;return function(_0x5762db){if(_0x5762db){return _0x53557e['status'](_0x2d34d8)[_0xbb1f('0x21')](_0x5762db);}};}function respondWithFilteredResult(_0x287e27,_0x537669){return function(_0x109484){if(_0x109484){var _0x4ad44f=typeof _0x537669[_0xbb1f('0x22')]==='undefined'&&typeof _0x537669['limit']===_0xbb1f('0x23');var _0x4760d0=_0x109484[_0xbb1f('0x24')];var _0xe25b1d=_0x4ad44f?0x0:_0x537669[_0xbb1f('0x22')];var _0x11c80e=_0x4ad44f?_0x109484[_0xbb1f('0x24')]:_0x537669[_0xbb1f('0x22')]+_0x537669[_0xbb1f('0x25')];var _0x4866bd;if(_0x11c80e>=_0x4760d0){_0x11c80e=_0x4760d0;_0x4866bd=0xc8;}else{_0x4866bd=0xce;}_0x287e27[_0xbb1f('0x1f')](_0x4866bd);return _0x287e27[_0xbb1f('0x26')](_0xbb1f('0x27'),_0xe25b1d+'-'+_0x11c80e+'/'+_0x4760d0)[_0xbb1f('0x21')](_0x109484);}return null;};}function patchUpdates(_0x2d2911){return function(_0x5a97a3){try{jsonpatch[_0xbb1f('0x28')](_0x5a97a3,_0x2d2911,!![]);}catch(_0x5c09b4){return BPromise[_0xbb1f('0x29')](_0x5c09b4);}return _0x5a97a3[_0xbb1f('0x2a')]();};}function saveUpdates(_0x306a59,_0x4ad30a){return function(_0x32ea01){if(_0x32ea01){return _0x32ea01[_0xbb1f('0x2b')](_0x306a59)[_0xbb1f('0x2c')](function(_0x5a5f7f){return _0x5a5f7f;});}return null;};}function removeEntity(_0xe324c6,_0x3c6f77){return function(_0x4853d6){if(_0x4853d6){return _0x4853d6[_0xbb1f('0x2d')]()[_0xbb1f('0x2c')](function(){_0xe324c6[_0xbb1f('0x1f')](0xcc)[_0xbb1f('0x20')]();});}};}function handleEntityNotFound(_0x117452,_0x5ccf47){return function(_0x560632){if(!_0x560632){_0x117452[_0xbb1f('0x1e')](0x194);}return _0x560632;};}function handleError(_0x44a7fd,_0x5b94fb){_0x5b94fb=_0x5b94fb||0x1f4;return function(_0x5b3b01){logger[_0xbb1f('0x2e')](_0x5b3b01[_0xbb1f('0x2f')]);if(_0x5b3b01[_0xbb1f('0x30')]){delete _0x5b3b01[_0xbb1f('0x30')];}_0x44a7fd[_0xbb1f('0x1f')](_0x5b94fb)[_0xbb1f('0x31')](_0x5b3b01);};}exports[_0xbb1f('0x32')]=function(_0x1048fc,_0x31431a){var _0x2f4a5d={},_0x3de04c={},_0xf929bb={'count':0x0,'rows':[]};var _0x5cd474=_[_0xbb1f('0x33')](db['SugarcrmField']['rawAttributes'],function(_0x585000){return{'name':_0x585000[_0xbb1f('0x34')],'type':_0x585000[_0xbb1f('0x35')][_0xbb1f('0x36')]};});_0x3de04c[_0xbb1f('0x37')]=_['map'](_0x5cd474,_0xbb1f('0x30'));_0x3de04c[_0xbb1f('0x38')]=_[_0xbb1f('0x39')](_0x1048fc[_0xbb1f('0x38')]);_0x3de04c['filters']=_['intersection'](_0x3de04c[_0xbb1f('0x37')],_0x3de04c['query']);_0x2f4a5d[_0xbb1f('0x3a')]=_[_0xbb1f('0x3b')](_0x3de04c['model'],qs['fields'](_0x1048fc[_0xbb1f('0x38')][_0xbb1f('0x3c')]));_0x2f4a5d[_0xbb1f('0x3a')]=_0x2f4a5d['attributes'][_0xbb1f('0x3d')]?_0x2f4a5d[_0xbb1f('0x3a')]:_0x3de04c[_0xbb1f('0x37')];if(!_0x1048fc[_0xbb1f('0x38')]['hasOwnProperty'](_0xbb1f('0x3e'))){_0x2f4a5d[_0xbb1f('0x25')]=qs[_0xbb1f('0x25')](_0x1048fc[_0xbb1f('0x38')][_0xbb1f('0x25')]);_0x2f4a5d[_0xbb1f('0x22')]=qs[_0xbb1f('0x22')](_0x1048fc['query']['offset']);}_0x2f4a5d['order']=qs[_0xbb1f('0x3f')](_0x1048fc[_0xbb1f('0x38')][_0xbb1f('0x3f')]);_0x2f4a5d[_0xbb1f('0x40')]=qs[_0xbb1f('0x41')](_[_0xbb1f('0x42')](_0x1048fc[_0xbb1f('0x38')],_0x3de04c['filters']),_0x5cd474);if(_0x1048fc['query'][_0xbb1f('0x43')]){_0x2f4a5d[_0xbb1f('0x40')]=_['merge'](_0x2f4a5d[_0xbb1f('0x40')],{'$or':_['map'](_0x5cd474,function(_0x59bd8e){if(_0x59bd8e[_0xbb1f('0x35')]!==_0xbb1f('0x44')){var _0x34bd46={};_0x34bd46[_0x59bd8e[_0xbb1f('0x30')]]={'$like':'%'+_0x1048fc[_0xbb1f('0x38')][_0xbb1f('0x43')]+'%'};return _0x34bd46;}})});}_0x2f4a5d=_['merge']({},_0x2f4a5d,_0x1048fc[_0xbb1f('0x45')]);var _0x4a185f={'where':_0x2f4a5d[_0xbb1f('0x40')]};return db[_0xbb1f('0x46')][_0xbb1f('0x24')](_0x4a185f)[_0xbb1f('0x2c')](function(_0x1222d4){_0xf929bb[_0xbb1f('0x24')]=_0x1222d4;if(_0x1048fc[_0xbb1f('0x38')][_0xbb1f('0x47')]){_0x2f4a5d['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xbb1f('0x48')](_0x2f4a5d);})[_0xbb1f('0x2c')](function(_0x1a8a5c){_0xf929bb[_0xbb1f('0x49')]=_0x1a8a5c;return _0xf929bb;})[_0xbb1f('0x2c')](respondWithFilteredResult(_0x31431a,_0x2f4a5d))[_0xbb1f('0x4a')](handleError(_0x31431a,null));};exports[_0xbb1f('0x4b')]=function(_0x315a52,_0x280f7c){var _0x4e9bfe={'raw':!![],'where':{'id':_0x315a52[_0xbb1f('0x4c')]['id']}},_0x4a50b1={};_0x4a50b1[_0xbb1f('0x37')]=_['keys'](db[_0xbb1f('0x46')][_0xbb1f('0x4d')]);_0x4a50b1[_0xbb1f('0x38')]=_[_0xbb1f('0x39')](_0x315a52[_0xbb1f('0x38')]);_0x4a50b1['filters']=_[_0xbb1f('0x3b')](_0x4a50b1[_0xbb1f('0x37')],_0x4a50b1['query']);_0x4e9bfe['attributes']=_[_0xbb1f('0x3b')](_0x4a50b1['model'],qs[_0xbb1f('0x3c')](_0x315a52[_0xbb1f('0x38')][_0xbb1f('0x3c')]));_0x4e9bfe[_0xbb1f('0x3a')]=_0x4e9bfe[_0xbb1f('0x3a')][_0xbb1f('0x3d')]?_0x4e9bfe['attributes']:_0x4a50b1['model'];if(_0x315a52[_0xbb1f('0x38')][_0xbb1f('0x47')]){_0x4e9bfe[_0xbb1f('0x4e')]=[{'all':!![]}];}_0x4e9bfe=_[_0xbb1f('0x4f')]({},_0x4e9bfe,_0x315a52[_0xbb1f('0x45')]);return db[_0xbb1f('0x46')][_0xbb1f('0x50')](_0x4e9bfe)[_0xbb1f('0x2c')](handleEntityNotFound(_0x280f7c,null))[_0xbb1f('0x2c')](respondWithResult(_0x280f7c,null))['catch'](handleError(_0x280f7c,null));};exports[_0xbb1f('0x51')]=function(_0x5aa218,_0xfaf644){return db[_0xbb1f('0x46')]['create'](_0x5aa218[_0xbb1f('0x52')],{})[_0xbb1f('0x2c')](respondWithResult(_0xfaf644,0xc9))[_0xbb1f('0x4a')](handleError(_0xfaf644,null));};exports[_0xbb1f('0x2b')]=function(_0x2c594e,_0x1cc24b){if(_0x2c594e[_0xbb1f('0x52')]['id']){delete _0x2c594e[_0xbb1f('0x52')]['id'];}return db[_0xbb1f('0x46')][_0xbb1f('0x50')]({'where':{'id':_0x2c594e[_0xbb1f('0x4c')]['id']}})[_0xbb1f('0x2c')](handleEntityNotFound(_0x1cc24b,null))[_0xbb1f('0x2c')](saveUpdates(_0x2c594e[_0xbb1f('0x52')],null))[_0xbb1f('0x2c')](respondWithResult(_0x1cc24b,null))[_0xbb1f('0x4a')](handleError(_0x1cc24b,null));};exports['destroy']=function(_0x19c2f5,_0x5db583){return db[_0xbb1f('0x46')][_0xbb1f('0x50')]({'where':{'id':_0x19c2f5['params']['id']}})['then'](handleEntityNotFound(_0x5db583,null))['then'](removeEntity(_0x5db583,null))[_0xbb1f('0x4a')](handleError(_0x5db583,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 977a094..8920569 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 _0x8dd0=['exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x451e09,_0x17ae70){var _0x3c1be8=function(_0x76336a){while(--_0x76336a){_0x451e09['push'](_0x451e09['shift']());}};_0x3c1be8(++_0x17ae70);}(_0x8dd0,0x147));var _0x08dd=function(_0x8f4e81,_0x397d44){_0x8f4e81=_0x8f4e81-0x0;var _0x1cd790=_0x8dd0[_0x8f4e81];return _0x1cd790;};'use strict';var _=require(_0x08dd('0x0'));var util=require(_0x08dd('0x1'));var logger=require(_0x08dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x08dd('0x3'));var rp=require(_0x08dd('0x4'));var fs=require('fs');var path=require(_0x08dd('0x5'));var rimraf=require(_0x08dd('0x6'));var config=require(_0x08dd('0x7'));var attributes=require(_0x08dd('0x8'));module[_0x08dd('0x9')]=function(_0x5dcbca,_0x1a4b36){return _0x5dcbca['define'](_0x08dd('0xa'),attributes,{'tableName':_0x08dd('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x08dd('0xc'),_0x08dd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29a0=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3165eb,_0x2b7a35){var _0x429978=function(_0x45878e){while(--_0x45878e){_0x3165eb['push'](_0x3165eb['shift']());}};_0x429978(++_0x2b7a35);}(_0x29a0,0x1c8));var _0x029a=function(_0xf5307f,_0x9eb22d){_0xf5307f=_0xf5307f-0x0;var _0x5a1db9=_0x29a0[_0xf5307f];return _0x5a1db9;};'use strict';var _=require(_0x029a('0x0'));var util=require(_0x029a('0x1'));var logger=require(_0x029a('0x2'))(_0x029a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x029a('0x4'));var fs=require('fs');var path=require(_0x029a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x029a('0x6'));module[_0x029a('0x7')]=function(_0xe0b001,_0x5e56c4){return _0xe0b001[_0x029a('0x8')](_0x029a('0x9'),attributes,{'tableName':_0x029a('0xa'),'paranoid':![],'indexes':[{'name':_0x029a('0xb'),'fields':[_0x029a('0xc'),_0x029a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 10921c9..b8d37dd 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 _0xf0c8=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment'];(function(_0x458c4c,_0xb3540){var _0x4fa73d=function(_0x34551d){while(--_0x34551d){_0x458c4c['push'](_0x458c4c['shift']());}};_0x4fa73d(++_0xb3540);}(_0xf0c8,0x111));var _0x8f0c=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0xf0c8[_0x459335];return _0x50f00b;};'use strict';var _=require(_0x8f0c('0x0'));var util=require(_0x8f0c('0x1'));var moment=require(_0x8f0c('0x2'));var BPromise=require(_0x8f0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f0c('0x4'));var db=require(_0x8f0c('0x5'))['db'];var utils=require(_0x8f0c('0x6'));var logger=require(_0x8f0c('0x7'))(_0x8f0c('0x8'));var config=require(_0x8f0c('0x9'));var jayson=require(_0x8f0c('0xa'));var client=jayson[_0x8f0c('0xb')][_0x8f0c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23eba5,_0x372a6a,_0x311a16){return new BPromise(function(_0xae0206,_0x3f4d21){return client['request'](_0x23eba5,_0x311a16)[_0x8f0c('0xd')](function(_0x45b2e7){logger['info'](_0x8f0c('0xe'),_0x372a6a,_0x8f0c('0xf'));logger[_0x8f0c('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x372a6a,'request\x20sent',JSON[_0x8f0c('0x11')](_0x45b2e7));if(_0x45b2e7[_0x8f0c('0x12')]){if(_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x13')]===0x1f4){logger[_0x8f0c('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x372a6a,_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x14')]);return _0x3f4d21(_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x14')]);}logger[_0x8f0c('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x372a6a,_0x45b2e7[_0x8f0c('0x12')][_0x8f0c('0x14')]);return _0xae0206(_0x45b2e7['error'][_0x8f0c('0x14')]);}else{logger[_0x8f0c('0x15')](_0x8f0c('0xe'),_0x372a6a,_0x8f0c('0xf'));_0xae0206(_0x45b2e7[_0x8f0c('0x16')]['message']);}})['catch'](function(_0x35404f){logger[_0x8f0c('0x12')](_0x8f0c('0xe'),_0x372a6a,_0x35404f);_0x3f4d21(_0x35404f);});});} \ No newline at end of file +var _0x1efe=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x1efe,0x12c));var _0xe1ef=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x1efe[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xe1ef('0x0'));var util=require(_0xe1ef('0x1'));var moment=require(_0xe1ef('0x2'));var BPromise=require(_0xe1ef('0x3'));var rs=require(_0xe1ef('0x4'));var fs=require('fs');var Redis=require(_0xe1ef('0x5'));var db=require(_0xe1ef('0x6'))['db'];var utils=require(_0xe1ef('0x7'));var logger=require(_0xe1ef('0x8'))(_0xe1ef('0x9'));var config=require(_0xe1ef('0xa'));var jayson=require(_0xe1ef('0xb'));var client=jayson[_0xe1ef('0xc')][_0xe1ef('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x12bbcd,_0x2c0c19,_0x210462){return new BPromise(function(_0x5ca406,_0x560b0f){return client[_0xe1ef('0xe')](_0x12bbcd,_0x210462)[_0xe1ef('0xf')](function(_0x489378){logger[_0xe1ef('0x10')](_0xe1ef('0x11'),_0x2c0c19,_0xe1ef('0x12'));logger[_0xe1ef('0x13')](_0xe1ef('0x14'),_0x2c0c19,_0xe1ef('0x12'),JSON[_0xe1ef('0x15')](_0x489378));if(_0x489378[_0xe1ef('0x16')]){if(_0x489378[_0xe1ef('0x16')][_0xe1ef('0x17')]===0x1f4){logger[_0xe1ef('0x16')](_0xe1ef('0x11'),_0x2c0c19,_0x489378['error'][_0xe1ef('0x18')]);return _0x560b0f(_0x489378[_0xe1ef('0x16')][_0xe1ef('0x18')]);}logger[_0xe1ef('0x16')](_0xe1ef('0x11'),_0x2c0c19,_0x489378[_0xe1ef('0x16')][_0xe1ef('0x18')]);return _0x5ca406(_0x489378[_0xe1ef('0x16')]['message']);}else{logger[_0xe1ef('0x10')](_0xe1ef('0x11'),_0x2c0c19,_0xe1ef('0x12'));_0x5ca406(_0x489378[_0xe1ef('0x19')]['message']);}})[_0xe1ef('0x1a')](function(_0x190e79){logger[_0xe1ef('0x16')]('SugarcrmField,\x20%s,\x20%s',_0x2c0c19,_0x190e79);_0x560b0f(_0x190e79);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2e39e0c..6637574 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 _0x481a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0x481a,0xbb));var _0xa481=function(_0xe0342,_0x7114a9){_0xe0342=_0xe0342-0x0;var _0xed9810=_0x481a[_0xe0342];return _0xed9810;};'use strict';var multer=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var path=require(_0xa481('0x2'));var timeout=require(_0xa481('0x3'));var express=require(_0xa481('0x4'));var router=express['Router']();var fs_extra=require(_0xa481('0x5'));var auth=require(_0xa481('0x6'));var interaction=require(_0xa481('0x7'));var config=require(_0xa481('0x8'));var controller=require(_0xa481('0x9'));router[_0xa481('0xa')]('/',auth['isAuthenticated'](),controller[_0xa481('0xb')]);router[_0xa481('0xa')](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0xe')]);router[_0xa481('0xa')](_0xa481('0xf'),auth[_0xa481('0xd')](),controller['getConfigurations']);router[_0xa481('0xa')](_0xa481('0x10'),auth[_0xa481('0xd')](),controller['getFields']);router[_0xa481('0x11')]('/',auth[_0xa481('0xd')](),controller[_0xa481('0x12')]);router[_0xa481('0x11')](_0xa481('0xf'),auth[_0xa481('0xd')](),controller[_0xa481('0x13')]);router[_0xa481('0x14')](_0xa481('0xc'),auth['isAuthenticated'](),controller[_0xa481('0x15')]);router['delete'](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0x16')]);module[_0xa481('0x17')]=router; \ No newline at end of file +var _0x98e1=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x277607,_0x345a06){var _0x15fe23=function(_0x336de7){while(--_0x336de7){_0x277607['push'](_0x277607['shift']());}};_0x15fe23(++_0x345a06);}(_0x98e1,0x160));var _0x198e=function(_0x3ab8df,_0xe88b7f){_0x3ab8df=_0x3ab8df-0x0;var _0x135f26=_0x98e1[_0x3ab8df];return _0x135f26;};'use strict';var multer=require('multer');var util=require(_0x198e('0x0'));var path=require(_0x198e('0x1'));var timeout=require(_0x198e('0x2'));var express=require(_0x198e('0x3'));var router=express['Router']();var fs_extra=require(_0x198e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x198e('0x5'));var controller=require(_0x198e('0x6'));router[_0x198e('0x7')]('/',auth[_0x198e('0x8')](),controller['index']);router['get'](_0x198e('0x9'),auth['isAuthenticated'](),controller[_0x198e('0xa')]);router['get'](_0x198e('0xb'),auth[_0x198e('0x8')](),controller[_0x198e('0xc')]);router[_0x198e('0x7')](_0x198e('0xd'),auth[_0x198e('0x8')](),controller[_0x198e('0xe')]);router[_0x198e('0xf')]('/',auth[_0x198e('0x8')](),controller['create']);router[_0x198e('0xf')](_0x198e('0xb'),auth['isAuthenticated'](),controller[_0x198e('0x10')]);router['put'](_0x198e('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x198e('0x8')](),controller[_0x198e('0x11')]);module[_0x198e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c87ab99..f8edca1 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 _0x77a1=['HelpDesk','exports','STRING'];(function(_0x5060e4,_0x3c3efa){var _0x2bab36=function(_0x48c823){while(--_0x48c823){_0x5060e4['push'](_0x5060e4['shift']());}};_0x2bab36(++_0x3c3efa);}(_0x77a1,0x15d));var _0x177a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x77a1[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x177a('0x0')]={'name':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x177a('0x1')],'allowNull':![],'defaultValue':_0x177a('0x2')},'remoteUri':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x177a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x38b9=['sequelize','exports','STRING','HelpDesk'];(function(_0x4d3973,_0x21daf3){var _0x534dd2=function(_0x470b40){while(--_0x470b40){_0x4d3973['push'](_0x4d3973['shift']());}};_0x534dd2(++_0x21daf3);}(_0x38b9,0x1f0));var _0x938b=function(_0x2b594d,_0x56dac0){_0x2b594d=_0x2b594d-0x0;var _0x4dfc68=_0x38b9[_0x2b594d];return _0x4dfc68;};'use strict';var Sequelize=require(_0x938b('0x0'));module[_0x938b('0x1')]={'name':{'type':Sequelize[_0x938b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x938b('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x938b('0x2')],'allowNull':![],'defaultValue':_0x938b('0x3')},'remoteUri':{'type':Sequelize[_0x938b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x938b('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index d2aa0d0..8a8645e 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 _0x202b=['username','description','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','VtigerConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields'];(function(_0x340b70,_0xdcf02){var _0x17879b=function(_0x2049aa){while(--_0x2049aa){_0x340b70['push'](_0x340b70['shift']());}};_0x17879b(++_0xdcf02);}(_0x202b,0x118));var _0xb202=function(_0x3f4ba8,_0x5ab00c){_0x3f4ba8=_0x3f4ba8-0x0;var _0x1243de=_0x202b[_0x3f4ba8];return _0x1243de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb202('0x0'));var zipdir=require(_0xb202('0x1'));var jsonpatch=require(_0xb202('0x2'));var rp=require('request-promise');var moment=require(_0xb202('0x3'));var BPromise=require(_0xb202('0x4'));var Mustache=require(_0xb202('0x5'));var util=require(_0xb202('0x6'));var path=require('path');var sox=require(_0xb202('0x7'));var csv=require('to-csv');var ejs=require(_0xb202('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb202('0x9'));var squel=require(_0xb202('0xa'));var crypto=require(_0xb202('0xb'));var jsforce=require(_0xb202('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb202('0xd'));var Papa=require(_0xb202('0xe'));var Redis=require(_0xb202('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb202('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb202('0x11'))(_0xb202('0x12'));var utils=require(_0xb202('0x13'));var config=require(_0xb202('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb202('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ec8e4,_0x31df76){_0x31df76=_0x31df76||0xcc;return function(_0x57af11){if(_0x57af11){return _0x2ec8e4[_0xb202('0x16')](_0x31df76);}return _0x2ec8e4[_0xb202('0x17')](_0x31df76)[_0xb202('0x18')]();};}function respondWithResult(_0x46dbbb,_0xabd2c1){_0xabd2c1=_0xabd2c1||0xc8;return function(_0x3e42d2){if(_0x3e42d2){return _0x46dbbb['status'](_0xabd2c1)[_0xb202('0x19')](_0x3e42d2);}};}function respondWithFilteredResult(_0x5d3c8d,_0x2cf50c){return function(_0x1515b7){if(_0x1515b7){var _0x500b6c=typeof _0x2cf50c[_0xb202('0x1a')]===_0xb202('0x1b')&&typeof _0x2cf50c['limit']===_0xb202('0x1b');var _0x5e3490=_0x1515b7[_0xb202('0x1c')];var _0x1d2af=_0x500b6c?0x0:_0x2cf50c['offset'];var _0x2a70f7=_0x500b6c?_0x1515b7[_0xb202('0x1c')]:_0x2cf50c[_0xb202('0x1a')]+_0x2cf50c['limit'];var _0x3d9fcd;if(_0x2a70f7>=_0x5e3490){_0x2a70f7=_0x5e3490;_0x3d9fcd=0xc8;}else{_0x3d9fcd=0xce;}_0x5d3c8d[_0xb202('0x17')](_0x3d9fcd);return _0x5d3c8d[_0xb202('0x1d')](_0xb202('0x1e'),_0x1d2af+'-'+_0x2a70f7+'/'+_0x5e3490)[_0xb202('0x19')](_0x1515b7);}return null;};}function patchUpdates(_0x28d527){return function(_0x15486e){try{jsonpatch[_0xb202('0x1f')](_0x15486e,_0x28d527,!![]);}catch(_0x3ee9e9){return BPromise[_0xb202('0x20')](_0x3ee9e9);}return _0x15486e[_0xb202('0x21')]();};}function saveUpdates(_0x12a6d5,_0x24eebd){return function(_0x463935){if(_0x463935){return _0x463935[_0xb202('0x22')](_0x12a6d5)[_0xb202('0x23')](function(_0x340296){return _0x340296;});}return null;};}function removeEntity(_0x564fcd,_0x3851b6){return function(_0x3e9234){if(_0x3e9234){return _0x3e9234[_0xb202('0x24')]()[_0xb202('0x23')](function(){_0x564fcd[_0xb202('0x17')](0xcc)[_0xb202('0x18')]();});}};}function handleEntityNotFound(_0x969703,_0x4415ed){return function(_0x4607b5){if(!_0x4607b5){_0x969703[_0xb202('0x16')](0x194);}return _0x4607b5;};}function handleError(_0xbf3b3e,_0x11660e){_0x11660e=_0x11660e||0x1f4;return function(_0x2e04ce){logger[_0xb202('0x25')](_0x2e04ce[_0xb202('0x26')]);if(_0x2e04ce['name']){delete _0x2e04ce['name'];}_0xbf3b3e[_0xb202('0x17')](_0x11660e)[_0xb202('0x27')](_0x2e04ce);};}exports[_0xb202('0x28')]=function(_0x657ce1,_0xbab2e2){var _0x32f671={},_0x343fa2={},_0x2f3610={'count':0x0,'rows':[]};var _0x2d216d=_[_0xb202('0x29')](db[_0xb202('0x2a')][_0xb202('0x2b')],function(_0x1beb67){return{'name':_0x1beb67[_0xb202('0x2c')],'type':_0x1beb67[_0xb202('0x2d')][_0xb202('0x2e')]};});_0x343fa2[_0xb202('0x2f')]=_[_0xb202('0x29')](_0x2d216d,_0xb202('0x30'));_0x343fa2[_0xb202('0x31')]=_[_0xb202('0x32')](_0x657ce1['query']);_0x343fa2[_0xb202('0x33')]=_['intersection'](_0x343fa2[_0xb202('0x2f')],_0x343fa2[_0xb202('0x31')]);_0x32f671[_0xb202('0x34')]=_[_0xb202('0x35')](_0x343fa2['model'],qs[_0xb202('0x36')](_0x657ce1['query'][_0xb202('0x36')]));_0x32f671[_0xb202('0x34')]=_0x32f671[_0xb202('0x34')][_0xb202('0x37')]?_0x32f671['attributes']:_0x343fa2['model'];if(!_0x657ce1['query']['hasOwnProperty'](_0xb202('0x38'))){_0x32f671[_0xb202('0x39')]=qs['limit'](_0x657ce1['query']['limit']);_0x32f671[_0xb202('0x1a')]=qs[_0xb202('0x1a')](_0x657ce1[_0xb202('0x31')][_0xb202('0x1a')]);}_0x32f671['order']=qs[_0xb202('0x3a')](_0x657ce1[_0xb202('0x31')][_0xb202('0x3a')]);_0x32f671[_0xb202('0x3b')]=qs[_0xb202('0x33')](_[_0xb202('0x3c')](_0x657ce1[_0xb202('0x31')],_0x343fa2[_0xb202('0x33')]),_0x2d216d);if(_0x657ce1['query'][_0xb202('0x3d')]){_0x32f671[_0xb202('0x3b')]=_[_0xb202('0x3e')](_0x32f671[_0xb202('0x3b')],{'$or':_[_0xb202('0x29')](_0x2d216d,function(_0x4b48cd){if(_0x4b48cd[_0xb202('0x2d')]!=='VIRTUAL'){var _0x5cb676={};_0x5cb676[_0x4b48cd[_0xb202('0x30')]]={'$like':'%'+_0x657ce1[_0xb202('0x31')][_0xb202('0x3d')]+'%'};return _0x5cb676;}})});}_0x32f671=_[_0xb202('0x3e')]({},_0x32f671,_0x657ce1[_0xb202('0x3f')]);var _0x5f16e5={'where':_0x32f671[_0xb202('0x3b')]};return db[_0xb202('0x2a')][_0xb202('0x1c')](_0x5f16e5)['then'](function(_0x3d29f6){_0x2f3610['count']=_0x3d29f6;if(_0x657ce1['query'][_0xb202('0x40')]){_0x32f671['include']=[{'all':!![]}];}return db[_0xb202('0x2a')][_0xb202('0x41')](_0x32f671);})[_0xb202('0x23')](function(_0x198fb9){_0x2f3610[_0xb202('0x42')]=_0x198fb9;return _0x2f3610;})[_0xb202('0x23')](respondWithFilteredResult(_0xbab2e2,_0x32f671))['catch'](handleError(_0xbab2e2,null));};exports['show']=function(_0x120934,_0x4eb469){var _0x459c02={'raw':![],'where':{'id':_0x120934[_0xb202('0x43')]['id']}},_0x3e3601={};_0x3e3601['model']=_[_0xb202('0x32')](db['VtigerAccount'][_0xb202('0x2b')]);_0x3e3601[_0xb202('0x31')]=_['keys'](_0x120934[_0xb202('0x31')]);_0x3e3601[_0xb202('0x33')]=_['intersection'](_0x3e3601[_0xb202('0x2f')],_0x3e3601[_0xb202('0x31')]);_0x459c02['attributes']=_[_0xb202('0x35')](_0x3e3601[_0xb202('0x2f')],qs[_0xb202('0x36')](_0x120934[_0xb202('0x31')][_0xb202('0x36')]));_0x459c02[_0xb202('0x34')]=_0x459c02[_0xb202('0x34')][_0xb202('0x37')]?_0x459c02[_0xb202('0x34')]:_0x3e3601[_0xb202('0x2f')];if(_0x120934['query'][_0xb202('0x40')]){_0x459c02[_0xb202('0x44')]=[{'all':!![]}];}_0x459c02=_[_0xb202('0x3e')]({},_0x459c02,_0x120934[_0xb202('0x3f')]);return db[_0xb202('0x2a')][_0xb202('0x45')](_0x459c02)[_0xb202('0x23')](handleEntityNotFound(_0x4eb469,null))[_0xb202('0x23')](respondWithResult(_0x4eb469,null))[_0xb202('0x46')](handleError(_0x4eb469,null));};exports[_0xb202('0x47')]=function(_0x449f6b,_0x5d4269){return db[_0xb202('0x2a')][_0xb202('0x47')](_0x449f6b[_0xb202('0x48')],{})[_0xb202('0x23')](respondWithResult(_0x5d4269,0xc9))[_0xb202('0x46')](handleError(_0x5d4269,null));};exports[_0xb202('0x22')]=function(_0x55a8a6,_0x1ed002){if(_0x55a8a6[_0xb202('0x48')]['id']){delete _0x55a8a6[_0xb202('0x48')]['id'];}return db['VtigerAccount'][_0xb202('0x45')]({'where':{'id':_0x55a8a6[_0xb202('0x43')]['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x1ed002,null))[_0xb202('0x23')](saveUpdates(_0x55a8a6['body'],null))['then'](respondWithResult(_0x1ed002,null))['catch'](handleError(_0x1ed002,null));};exports[_0xb202('0x24')]=function(_0x24245c,_0x45477c){return db[_0xb202('0x2a')][_0xb202('0x45')]({'where':{'id':_0x24245c[_0xb202('0x43')]['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x45477c,null))[_0xb202('0x23')](removeEntity(_0x45477c,null))[_0xb202('0x46')](handleError(_0x45477c,null));};exports['getConfigurations']=function(_0x46fc3d,_0x4e999a,_0x5d947e){var _0x3b5242={};var _0x4934ea={};var _0x1ea5ea;var _0x4df5da;return db[_0xb202('0x2a')]['findOne']({'where':{'id':_0x46fc3d[_0xb202('0x43')]['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x4e999a,null))[_0xb202('0x23')](function(_0x5edf8){if(_0x5edf8){_0x1ea5ea=_0x5edf8;_0x4934ea[_0xb202('0x2f')]=_[_0xb202('0x32')](db[_0xb202('0x49')]['rawAttributes']);_0x4934ea[_0xb202('0x31')]=_[_0xb202('0x32')](_0x46fc3d[_0xb202('0x31')]);_0x4934ea[_0xb202('0x33')]=_[_0xb202('0x35')](_0x4934ea[_0xb202('0x2f')],_0x4934ea['query']);_0x3b5242['attributes']=_[_0xb202('0x35')](_0x4934ea[_0xb202('0x2f')],qs['fields'](_0x46fc3d[_0xb202('0x31')]['fields']));_0x3b5242['attributes']=_0x3b5242[_0xb202('0x34')][_0xb202('0x37')]?_0x3b5242[_0xb202('0x34')]:_0x4934ea[_0xb202('0x2f')];_0x3b5242[_0xb202('0x4a')]=qs[_0xb202('0x3a')](_0x46fc3d[_0xb202('0x31')]['sort']);_0x3b5242['where']=qs[_0xb202('0x33')](_['pick'](_0x46fc3d[_0xb202('0x31')],_0x4934ea[_0xb202('0x33')]));if(_0x46fc3d[_0xb202('0x31')]['filter']){_0x3b5242[_0xb202('0x3b')]=_['merge'](_0x3b5242['where'],{'$or':_[_0xb202('0x29')](_0x3b5242[_0xb202('0x34')],function(_0x5b2492){var _0xab9150={};_0xab9150[_0x5b2492]={'$like':'%'+_0x46fc3d[_0xb202('0x31')][_0xb202('0x3d')]+'%'};return _0xab9150;})});}_0x3b5242=_['merge']({},_0x3b5242,_0x46fc3d[_0xb202('0x3f')]);return _0x1ea5ea[_0xb202('0x4b')](_0x3b5242);}})['then'](function(_0x1899e2){if(_0x1899e2){_0x4df5da=_0x1899e2[_0xb202('0x37')];if(!_0x46fc3d[_0xb202('0x31')]['hasOwnProperty']('nolimit')){_0x3b5242[_0xb202('0x39')]=qs['limit'](_0x46fc3d[_0xb202('0x31')][_0xb202('0x39')]);_0x3b5242[_0xb202('0x1a')]=qs['offset'](_0x46fc3d[_0xb202('0x31')][_0xb202('0x1a')]);}return _0x1ea5ea['getConfigurations'](_0x3b5242);}})[_0xb202('0x23')](function(_0x371736){if(_0x371736){return _0x371736?{'count':_0x4df5da,'rows':_0x371736}:null;}})[_0xb202('0x23')](respondWithResult(_0x4e999a,null))[_0xb202('0x46')](handleError(_0x4e999a,null));};exports[_0xb202('0x4c')]=function(_0x40580b,_0x9ec5a,_0x3477ca){if(_0x40580b['body']['id']){delete _0x40580b[_0xb202('0x48')]['id'];}return db[_0xb202('0x2a')][_0xb202('0x4d')]({'where':{'id':_0x40580b['params']['id']}})[_0xb202('0x23')](handleEntityNotFound(_0x9ec5a,null))[_0xb202('0x23')](function(_0x30fe52){if(_0x30fe52){_0x40580b['body'][_0xb202('0x4e')]=_0x30fe52['id'];_0x40580b[_0xb202('0x48')][_0xb202('0x4f')]=integrations[_0xb202('0x50')](_0x40580b[_0xb202('0x48')][_0xb202('0x51')],_0x40580b[_0xb202('0x48')][_0xb202('0x2d')]);_0x40580b['body'][_0xb202('0x52')]=integrations[_0xb202('0x53')](_0x40580b[_0xb202('0x48')][_0xb202('0x51')],_0x40580b[_0xb202('0x48')][_0xb202('0x2d')]);return db[_0xb202('0x49')][_0xb202('0x47')](_0x40580b[_0xb202('0x48')],{'include':[{'model':db[_0xb202('0x54')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0xb202('0x52')}]});}return null;})[_0xb202('0x23')](respondWithResult(_0x9ec5a,null))['catch'](handleError(_0x9ec5a,null));};var md5=require('md5');exports[_0xb202('0x55')]=function(_0x5cd9f4,_0xbb44c7,_0x789568){var _0x637e00=null;var _0x3ca6b6=null;var _0xbd94b7=null;var _0x561a1f=null;var _0x331b3f='';return db[_0xb202('0x2a')]['findOne']({'where':{'id':_0x5cd9f4[_0xb202('0x43')]['id']},'attributes':['id',_0xb202('0x30'),_0xb202('0x56'),_0xb202('0x57'),'moduleName','remoteUri',_0xb202('0x58'),_0xb202('0x59')]})[_0xb202('0x23')](handleEntityNotFound(_0xbb44c7,null))[_0xb202('0x23')](function(_0xf8cdb6){if(_0xf8cdb6){_0x637e00=_0xf8cdb6[_0xb202('0x56')];_0x3ca6b6=_0xf8cdb6[_0xb202('0x59')];_0xbd94b7=_0xf8cdb6['moduleName'];_0x331b3f=_0xf8cdb6['remoteUri'];var _0x366ddb=_0x331b3f[_0xb202('0x5a')](-0x1);if(_0x366ddb==='/'){_0x331b3f=_0x331b3f[_0xb202('0x5b')](0x0,_0x331b3f[_0xb202('0x5c')](_0x366ddb));}_0x561a1f=util[_0xb202('0x5d')](_0xb202('0x5e'),_0x331b3f);var _0xa563ed={'method':_0xb202('0x5f'),'uri':_0x561a1f,'qs':{'operation':_0xb202('0x60'),'username':_0xf8cdb6[_0xb202('0x56')]},'json':!![]};return rp(_0xa563ed);}})[_0xb202('0x23')](function(_0x2ba045){if(_0x2ba045[_0xb202('0x61')]){var _0x5822d6={'method':_0xb202('0x62'),'uri':_0x561a1f,'form':{'operation':_0xb202('0x63'),'username':_0x637e00,'accessKey':md5(_0x2ba045[_0xb202('0x64')][_0xb202('0x65')]+_0x3ca6b6)},'json':!![]};return rp(_0x5822d6);}})[_0xb202('0x23')](function(_0x5c1ffa){if(_0x5c1ffa[_0xb202('0x61')]){var _0x2bfd36={'method':_0xb202('0x5f'),'uri':_0x561a1f,'qs':{'operation':_0xb202('0x66'),'username':_0x637e00,'sessionName':_0x5c1ffa[_0xb202('0x64')][_0xb202('0x67')],'elementType':_0xbd94b7},'json':!![]};return rp(_0x2bfd36);}})[_0xb202('0x23')](function(_0x3738ac){if(_0x3738ac[_0xb202('0x61')]){var _0x245296=[_0xb202('0x68'),_0xb202('0x69'),'owner'];_[_0xb202('0x6a')](_0x3738ac[_0xb202('0x64')][_0xb202('0x36')],function(_0x4b7eae){return _0x245296[_0xb202('0x6b')](_0x4b7eae['type'][_0xb202('0x30')]);});_[_0xb202('0x6a')](_0x3738ac[_0xb202('0x64')]['fields'],function(_0xb5cfd4){return _0xb5cfd4[_0xb202('0x6c')]===_0xb202('0x6d');});return{'count':_0x3738ac[_0xb202('0x64')][_0xb202('0x36')][_0xb202('0x37')],'rows':_[_0xb202('0x29')](_0x3738ac[_0xb202('0x64')][_0xb202('0x36')],function(_0x3117d4){return{'id':_0x3117d4[_0xb202('0x30')],'name':_0x3117d4[_0xb202('0x6e')],'custom':_[_0xb202('0x6f')](_0x3117d4[_0xb202('0x30')],_0xb202('0x70'))?!![]:![],'options':_0x3117d4[_0xb202('0x2d')][_0xb202('0x30')]===_0xb202('0x71')&&_0x3117d4[_0xb202('0x2d')][_0xb202('0x72')][_0xb202('0x37')]>0x0?_[_0xb202('0x29')](_0x3117d4[_0xb202('0x2d')][_0xb202('0x72')],function(_0xb95cd2){return{'name':_0xb95cd2[_0xb202('0x6e')],'value':_0xb95cd2['value']};}):[]};})};}})[_0xb202('0x23')](respondWithResult(_0xbb44c7,null))[_0xb202('0x46')](function(_0x180613){console[_0xb202('0x73')](_0xb202('0x74')+_0x180613);var _0xc25968=_0x5cd9f4[_0xb202('0x31')][_0xb202('0x75')]?0x1f4:_0x180613['statusCode']||0x1f4;logger['error'](_0xb202('0x76'),_0xb202('0x55'),_0xc25968,JSON[_0xb202('0x77')](_0x180613));delete _0x180613[_0xb202('0x30')];if(_0xc25968===0x191){_0xc25968=0x190;}_0xbb44c7[_0xb202('0x17')](_0xc25968)['send'](_0x5cd9f4[_0xb202('0x31')][_0xb202('0x75')]?{'message':_0xb202('0x78'),'statusCode':_0x180613[_0xb202('0x79')]}:_0x180613);});}; \ No newline at end of file +var _0x1e16=['statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../components/integrations/configuration','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','filters','intersection','query','fields','attributes','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','include','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','md5','getFields','username','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','success','GET','autogenerated','owner','remove','includes','editable','false','label','cf_','picklistValues','log','vTiger\x20error:\x20','test'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x1e16,0x15c));var _0x61e1=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1e16[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x61e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x61e1('0x1'));var jsonpatch=require(_0x61e1('0x2'));var rp=require(_0x61e1('0x3'));var moment=require(_0x61e1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x61e1('0x5'));var util=require(_0x61e1('0x6'));var path=require(_0x61e1('0x7'));var sox=require('sox');var csv=require(_0x61e1('0x8'));var ejs=require(_0x61e1('0x9'));var fs=require('fs');var fs_extra=require(_0x61e1('0xa'));var _=require('lodash');var squel=require(_0x61e1('0xb'));var crypto=require(_0x61e1('0xc'));var jsforce=require(_0x61e1('0xd'));var deskjs=require(_0x61e1('0xe'));var toCsv=require(_0x61e1('0x8'));var querystring=require('querystring');var Papa=require(_0x61e1('0xf'));var Redis=require(_0x61e1('0x10'));var authService=require(_0x61e1('0x11'));var qs=require(_0x61e1('0x12'));var as=require(_0x61e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x61e1('0x14'));var utils=require(_0x61e1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x61e1('0x16'));function respondWithStatusCode(_0x303f44,_0x45e65c){_0x45e65c=_0x45e65c||0xcc;return function(_0x520c1f){if(_0x520c1f){return _0x303f44['sendStatus'](_0x45e65c);}return _0x303f44[_0x61e1('0x17')](_0x45e65c)[_0x61e1('0x18')]();};}function respondWithResult(_0x2ba1f0,_0x49cf5e){_0x49cf5e=_0x49cf5e||0xc8;return function(_0x4a85fe){if(_0x4a85fe){return _0x2ba1f0[_0x61e1('0x17')](_0x49cf5e)['json'](_0x4a85fe);}};}function respondWithFilteredResult(_0x31fd78,_0x12dea1){return function(_0xe05d2a){if(_0xe05d2a){var _0x2fc9d4=typeof _0x12dea1[_0x61e1('0x19')]===_0x61e1('0x1a')&&typeof _0x12dea1['limit']===_0x61e1('0x1a');var _0x496839=_0xe05d2a['count'];var _0x160e6a=_0x2fc9d4?0x0:_0x12dea1[_0x61e1('0x19')];var _0x394362=_0x2fc9d4?_0xe05d2a[_0x61e1('0x1b')]:_0x12dea1['offset']+_0x12dea1[_0x61e1('0x1c')];var _0xc85120;if(_0x394362>=_0x496839){_0x394362=_0x496839;_0xc85120=0xc8;}else{_0xc85120=0xce;}_0x31fd78[_0x61e1('0x17')](_0xc85120);return _0x31fd78[_0x61e1('0x1d')](_0x61e1('0x1e'),_0x160e6a+'-'+_0x394362+'/'+_0x496839)['json'](_0xe05d2a);}return null;};}function patchUpdates(_0x5afa9e){return function(_0x54f43d){try{jsonpatch['apply'](_0x54f43d,_0x5afa9e,!![]);}catch(_0x5edc2e){return BPromise[_0x61e1('0x1f')](_0x5edc2e);}return _0x54f43d['save']();};}function saveUpdates(_0x1b04b4,_0x19f545){return function(_0x3d66c){if(_0x3d66c){return _0x3d66c[_0x61e1('0x20')](_0x1b04b4)[_0x61e1('0x21')](function(_0x1c7338){return _0x1c7338;});}return null;};}function removeEntity(_0x40074f,_0x415682){return function(_0xcf1c25){if(_0xcf1c25){return _0xcf1c25[_0x61e1('0x22')]()[_0x61e1('0x21')](function(){_0x40074f[_0x61e1('0x17')](0xcc)[_0x61e1('0x18')]();});}};}function handleEntityNotFound(_0x1e2a45,_0x1498a8){return function(_0x3aea6e){if(!_0x3aea6e){_0x1e2a45['sendStatus'](0x194);}return _0x3aea6e;};}function handleError(_0x570ebb,_0x5ae7df){_0x5ae7df=_0x5ae7df||0x1f4;return function(_0x33ecac){logger[_0x61e1('0x23')](_0x33ecac[_0x61e1('0x24')]);if(_0x33ecac['name']){delete _0x33ecac[_0x61e1('0x25')];}_0x570ebb[_0x61e1('0x17')](_0x5ae7df)[_0x61e1('0x26')](_0x33ecac);};}exports[_0x61e1('0x27')]=function(_0x37f974,_0x107236){var _0x2b693a={},_0x4d9d9a={},_0xe5bfd={'count':0x0,'rows':[]};var _0x26a4c3=_[_0x61e1('0x28')](db[_0x61e1('0x29')][_0x61e1('0x2a')],function(_0x46c6e5){return{'name':_0x46c6e5[_0x61e1('0x2b')],'type':_0x46c6e5[_0x61e1('0x2c')]['key']};});_0x4d9d9a['model']=_[_0x61e1('0x28')](_0x26a4c3,_0x61e1('0x25'));_0x4d9d9a['query']=_['keys'](_0x37f974['query']);_0x4d9d9a[_0x61e1('0x2d')]=_[_0x61e1('0x2e')](_0x4d9d9a['model'],_0x4d9d9a[_0x61e1('0x2f')]);_0x2b693a['attributes']=_[_0x61e1('0x2e')](_0x4d9d9a['model'],qs[_0x61e1('0x30')](_0x37f974[_0x61e1('0x2f')][_0x61e1('0x30')]));_0x2b693a[_0x61e1('0x31')]=_0x2b693a[_0x61e1('0x31')]['length']?_0x2b693a[_0x61e1('0x31')]:_0x4d9d9a[_0x61e1('0x32')];if(!_0x37f974['query'][_0x61e1('0x33')](_0x61e1('0x34'))){_0x2b693a['limit']=qs[_0x61e1('0x1c')](_0x37f974['query'][_0x61e1('0x1c')]);_0x2b693a[_0x61e1('0x19')]=qs['offset'](_0x37f974[_0x61e1('0x2f')][_0x61e1('0x19')]);}_0x2b693a['order']=qs[_0x61e1('0x35')](_0x37f974['query'][_0x61e1('0x35')]);_0x2b693a[_0x61e1('0x36')]=qs[_0x61e1('0x2d')](_[_0x61e1('0x37')](_0x37f974['query'],_0x4d9d9a[_0x61e1('0x2d')]),_0x26a4c3);if(_0x37f974['query'][_0x61e1('0x38')]){_0x2b693a[_0x61e1('0x36')]=_[_0x61e1('0x39')](_0x2b693a[_0x61e1('0x36')],{'$or':_[_0x61e1('0x28')](_0x26a4c3,function(_0x53a976){if(_0x53a976[_0x61e1('0x2c')]!==_0x61e1('0x3a')){var _0xec42a5={};_0xec42a5[_0x53a976[_0x61e1('0x25')]]={'$like':'%'+_0x37f974['query']['filter']+'%'};return _0xec42a5;}})});}_0x2b693a=_['merge']({},_0x2b693a,_0x37f974[_0x61e1('0x3b')]);var _0xf50d5d={'where':_0x2b693a[_0x61e1('0x36')]};return db[_0x61e1('0x29')][_0x61e1('0x1b')](_0xf50d5d)[_0x61e1('0x21')](function(_0x3e2614){_0xe5bfd['count']=_0x3e2614;if(_0x37f974[_0x61e1('0x2f')][_0x61e1('0x3c')]){_0x2b693a['include']=[{'all':!![]}];}return db[_0x61e1('0x29')][_0x61e1('0x3d')](_0x2b693a);})[_0x61e1('0x21')](function(_0x52715c){_0xe5bfd['rows']=_0x52715c;return _0xe5bfd;})[_0x61e1('0x21')](respondWithFilteredResult(_0x107236,_0x2b693a))[_0x61e1('0x3e')](handleError(_0x107236,null));};exports[_0x61e1('0x3f')]=function(_0x5bb88e,_0x10ccdf){var _0x29fc9b={'raw':![],'where':{'id':_0x5bb88e['params']['id']}},_0x3bafe2={};_0x3bafe2['model']=_[_0x61e1('0x40')](db[_0x61e1('0x29')]['rawAttributes']);_0x3bafe2['query']=_[_0x61e1('0x40')](_0x5bb88e[_0x61e1('0x2f')]);_0x3bafe2[_0x61e1('0x2d')]=_[_0x61e1('0x2e')](_0x3bafe2[_0x61e1('0x32')],_0x3bafe2[_0x61e1('0x2f')]);_0x29fc9b[_0x61e1('0x31')]=_[_0x61e1('0x2e')](_0x3bafe2[_0x61e1('0x32')],qs[_0x61e1('0x30')](_0x5bb88e[_0x61e1('0x2f')][_0x61e1('0x30')]));_0x29fc9b[_0x61e1('0x31')]=_0x29fc9b[_0x61e1('0x31')]['length']?_0x29fc9b[_0x61e1('0x31')]:_0x3bafe2['model'];if(_0x5bb88e[_0x61e1('0x2f')]['includeAll']){_0x29fc9b[_0x61e1('0x41')]=[{'all':!![]}];}_0x29fc9b=_[_0x61e1('0x39')]({},_0x29fc9b,_0x5bb88e['options']);return db[_0x61e1('0x29')]['find'](_0x29fc9b)[_0x61e1('0x21')](handleEntityNotFound(_0x10ccdf,null))['then'](respondWithResult(_0x10ccdf,null))[_0x61e1('0x3e')](handleError(_0x10ccdf,null));};exports[_0x61e1('0x42')]=function(_0x4c9b38,_0x1ce6cd){return db[_0x61e1('0x29')][_0x61e1('0x42')](_0x4c9b38[_0x61e1('0x43')],{})[_0x61e1('0x21')](respondWithResult(_0x1ce6cd,0xc9))[_0x61e1('0x3e')](handleError(_0x1ce6cd,null));};exports[_0x61e1('0x20')]=function(_0x20e059,_0x55dcee){if(_0x20e059[_0x61e1('0x43')]['id']){delete _0x20e059['body']['id'];}return db['VtigerAccount'][_0x61e1('0x44')]({'where':{'id':_0x20e059['params']['id']}})['then'](handleEntityNotFound(_0x55dcee,null))[_0x61e1('0x21')](saveUpdates(_0x20e059['body'],null))[_0x61e1('0x21')](respondWithResult(_0x55dcee,null))[_0x61e1('0x3e')](handleError(_0x55dcee,null));};exports[_0x61e1('0x22')]=function(_0x2a730f,_0x4a60da){return db[_0x61e1('0x29')][_0x61e1('0x44')]({'where':{'id':_0x2a730f[_0x61e1('0x45')]['id']}})[_0x61e1('0x21')](handleEntityNotFound(_0x4a60da,null))[_0x61e1('0x21')](removeEntity(_0x4a60da,null))[_0x61e1('0x3e')](handleError(_0x4a60da,null));};exports[_0x61e1('0x46')]=function(_0x1bc839,_0x3bc943,_0x575b4c){var _0x4ba66c={};var _0xd14b0d={};var _0x358536;var _0x9a3df9;return db[_0x61e1('0x29')][_0x61e1('0x47')]({'where':{'id':_0x1bc839[_0x61e1('0x45')]['id']}})[_0x61e1('0x21')](handleEntityNotFound(_0x3bc943,null))[_0x61e1('0x21')](function(_0x29f303){if(_0x29f303){_0x358536=_0x29f303;_0xd14b0d[_0x61e1('0x32')]=_[_0x61e1('0x40')](db[_0x61e1('0x48')][_0x61e1('0x2a')]);_0xd14b0d[_0x61e1('0x2f')]=_['keys'](_0x1bc839['query']);_0xd14b0d[_0x61e1('0x2d')]=_['intersection'](_0xd14b0d[_0x61e1('0x32')],_0xd14b0d['query']);_0x4ba66c[_0x61e1('0x31')]=_['intersection'](_0xd14b0d[_0x61e1('0x32')],qs[_0x61e1('0x30')](_0x1bc839[_0x61e1('0x2f')][_0x61e1('0x30')]));_0x4ba66c[_0x61e1('0x31')]=_0x4ba66c[_0x61e1('0x31')]['length']?_0x4ba66c[_0x61e1('0x31')]:_0xd14b0d[_0x61e1('0x32')];_0x4ba66c['order']=qs[_0x61e1('0x35')](_0x1bc839[_0x61e1('0x2f')][_0x61e1('0x35')]);_0x4ba66c[_0x61e1('0x36')]=qs[_0x61e1('0x2d')](_[_0x61e1('0x37')](_0x1bc839[_0x61e1('0x2f')],_0xd14b0d[_0x61e1('0x2d')]));if(_0x1bc839[_0x61e1('0x2f')][_0x61e1('0x38')]){_0x4ba66c[_0x61e1('0x36')]=_[_0x61e1('0x39')](_0x4ba66c['where'],{'$or':_[_0x61e1('0x28')](_0x4ba66c[_0x61e1('0x31')],function(_0x41d308){var _0x16da88={};_0x16da88[_0x41d308]={'$like':'%'+_0x1bc839[_0x61e1('0x2f')][_0x61e1('0x38')]+'%'};return _0x16da88;})});}_0x4ba66c=_[_0x61e1('0x39')]({},_0x4ba66c,_0x1bc839[_0x61e1('0x3b')]);return _0x358536[_0x61e1('0x46')](_0x4ba66c);}})[_0x61e1('0x21')](function(_0x25acfb){if(_0x25acfb){_0x9a3df9=_0x25acfb[_0x61e1('0x49')];if(!_0x1bc839[_0x61e1('0x2f')]['hasOwnProperty'](_0x61e1('0x34'))){_0x4ba66c[_0x61e1('0x1c')]=qs[_0x61e1('0x1c')](_0x1bc839['query']['limit']);_0x4ba66c['offset']=qs[_0x61e1('0x19')](_0x1bc839[_0x61e1('0x2f')][_0x61e1('0x19')]);}return _0x358536[_0x61e1('0x46')](_0x4ba66c);}})[_0x61e1('0x21')](function(_0x257af6){if(_0x257af6){return _0x257af6?{'count':_0x9a3df9,'rows':_0x257af6}:null;}})[_0x61e1('0x21')](respondWithResult(_0x3bc943,null))[_0x61e1('0x3e')](handleError(_0x3bc943,null));};exports[_0x61e1('0x4a')]=function(_0x4c1a32,_0x6f1f3,_0x332efc){if(_0x4c1a32[_0x61e1('0x43')]['id']){delete _0x4c1a32['body']['id'];}return db['VtigerAccount'][_0x61e1('0x47')]({'where':{'id':_0x4c1a32[_0x61e1('0x45')]['id']}})[_0x61e1('0x21')](handleEntityNotFound(_0x6f1f3,null))[_0x61e1('0x21')](function(_0x1f4c28){if(_0x1f4c28){_0x4c1a32[_0x61e1('0x43')][_0x61e1('0x4b')]=_0x1f4c28['id'];_0x4c1a32[_0x61e1('0x43')][_0x61e1('0x4c')]=integrations[_0x61e1('0x4d')](_0x4c1a32[_0x61e1('0x43')]['channel'],_0x4c1a32[_0x61e1('0x43')][_0x61e1('0x2c')]);_0x4c1a32[_0x61e1('0x43')]['Descriptions']=integrations[_0x61e1('0x4e')](_0x4c1a32[_0x61e1('0x43')][_0x61e1('0x4f')],_0x4c1a32[_0x61e1('0x43')][_0x61e1('0x2c')]);return db[_0x61e1('0x48')][_0x61e1('0x42')](_0x4c1a32[_0x61e1('0x43')],{'include':[{'model':db[_0x61e1('0x50')],'as':_0x61e1('0x4c')},{'model':db['VtigerField'],'as':_0x61e1('0x51')}]});}return null;})['then'](respondWithResult(_0x6f1f3,null))['catch'](handleError(_0x6f1f3,null));};var md5=require(_0x61e1('0x52'));exports[_0x61e1('0x53')]=function(_0x41b3cf,_0xee3527,_0x45732d){var _0x21868e=null;var _0x229bd5=null;var _0x37493b=null;var _0x47d08e=null;var _0x357552='';return db['VtigerAccount'][_0x61e1('0x47')]({'where':{'id':_0x41b3cf[_0x61e1('0x45')]['id']},'attributes':['id',_0x61e1('0x25'),_0x61e1('0x54'),'description','moduleName',_0x61e1('0x55'),_0x61e1('0x56'),_0x61e1('0x57')]})[_0x61e1('0x21')](handleEntityNotFound(_0xee3527,null))[_0x61e1('0x21')](function(_0x5bf8f4){if(_0x5bf8f4){_0x21868e=_0x5bf8f4['username'];_0x229bd5=_0x5bf8f4['accessKey'];_0x37493b=_0x5bf8f4['moduleName'];_0x357552=_0x5bf8f4['remoteUri'];var _0x5ee5e6=_0x357552[_0x61e1('0x58')](-0x1);if(_0x5ee5e6==='/'){_0x357552=_0x357552[_0x61e1('0x59')](0x0,_0x357552[_0x61e1('0x5a')](_0x5ee5e6));}_0x47d08e=util[_0x61e1('0x5b')](_0x61e1('0x5c'),_0x357552);var _0x48b1f5={'method':'GET','uri':_0x47d08e,'qs':{'operation':_0x61e1('0x5d'),'username':_0x5bf8f4[_0x61e1('0x54')]},'json':!![]};return rp(_0x48b1f5);}})[_0x61e1('0x21')](function(_0x546370){if(_0x546370['success']){var _0x2e5005={'method':_0x61e1('0x5e'),'uri':_0x47d08e,'form':{'operation':_0x61e1('0x5f'),'username':_0x21868e,'accessKey':md5(_0x546370[_0x61e1('0x60')][_0x61e1('0x61')]+_0x229bd5)},'json':!![]};return rp(_0x2e5005);}})[_0x61e1('0x21')](function(_0x3a554a){if(_0x3a554a[_0x61e1('0x62')]){var _0x4ab789={'method':_0x61e1('0x63'),'uri':_0x47d08e,'qs':{'operation':'describe','username':_0x21868e,'sessionName':_0x3a554a[_0x61e1('0x60')]['sessionName'],'elementType':_0x37493b},'json':!![]};return rp(_0x4ab789);}})[_0x61e1('0x21')](function(_0x2efb46){if(_0x2efb46[_0x61e1('0x62')]){var _0x59ab72=[_0x61e1('0x64'),'reference',_0x61e1('0x65')];_[_0x61e1('0x66')](_0x2efb46[_0x61e1('0x60')]['fields'],function(_0x42e661){return _0x59ab72[_0x61e1('0x67')](_0x42e661[_0x61e1('0x2c')][_0x61e1('0x25')]);});_[_0x61e1('0x66')](_0x2efb46[_0x61e1('0x60')][_0x61e1('0x30')],function(_0x9cc8fb){return _0x9cc8fb[_0x61e1('0x68')]===_0x61e1('0x69');});return{'count':_0x2efb46[_0x61e1('0x60')][_0x61e1('0x30')][_0x61e1('0x49')],'rows':_[_0x61e1('0x28')](_0x2efb46[_0x61e1('0x60')][_0x61e1('0x30')],function(_0x33f37e){return{'id':_0x33f37e[_0x61e1('0x25')],'name':_0x33f37e[_0x61e1('0x6a')],'custom':_['startsWith'](_0x33f37e[_0x61e1('0x25')],_0x61e1('0x6b'))?!![]:![],'options':_0x33f37e[_0x61e1('0x2c')][_0x61e1('0x25')]==='picklist'&&_0x33f37e[_0x61e1('0x2c')][_0x61e1('0x6c')]['length']>0x0?_['map'](_0x33f37e[_0x61e1('0x2c')][_0x61e1('0x6c')],function(_0x3ce100){return{'name':_0x3ce100[_0x61e1('0x6a')],'value':_0x3ce100['value']};}):[]};})};}})[_0x61e1('0x21')](respondWithResult(_0xee3527,null))[_0x61e1('0x3e')](function(_0x5bf5a5){console[_0x61e1('0x6d')](_0x61e1('0x6e')+_0x5bf5a5);var _0x182b57=_0x41b3cf[_0x61e1('0x2f')][_0x61e1('0x6f')]?0x1f4:_0x5bf5a5[_0x61e1('0x70')]||0x1f4;logger[_0x61e1('0x23')](_0x61e1('0x71'),_0x61e1('0x53'),_0x182b57,JSON['stringify'](_0x5bf5a5));delete _0x5bf5a5['name'];if(_0x182b57===0x191){_0x182b57=0x190;}_0xee3527[_0x61e1('0x17')](_0x182b57)[_0x61e1('0x26')](_0x41b3cf[_0x61e1('0x2f')][_0x61e1('0x6f')]?{'message':_0x61e1('0x72'),'statusCode':_0x5bf5a5['statusCode']}:_0x5bf5a5);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 385c2c5..b338079 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 _0x3c23=['../../config/logger','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x31c04d,_0x59a5d5){var _0x3fd81b=function(_0x4c05dc){while(--_0x4c05dc){_0x31c04d['push'](_0x31c04d['shift']());}};_0x3fd81b(++_0x59a5d5);}(_0x3c23,0x13e));var _0x33c2=function(_0x22f98b,_0x57edc7){_0x22f98b=_0x22f98b-0x0;var _0x4e0b5a=_0x3c23[_0x22f98b];return _0x4e0b5a;};'use strict';var _=require(_0x33c2('0x0'));var util=require('util');var logger=require(_0x33c2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x33c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33c2('0x3'));var rimraf=require(_0x33c2('0x4'));var config=require(_0x33c2('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x33c2('0x6'));module[_0x33c2('0x7')]=function(_0x3d5ffb,_0xfd2f6c){return _0x3d5ffb[_0x33c2('0x8')](_0x33c2('0x9'),attributes,{'tableName':_0x33c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x917f=['path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger','api','moment','request-promise'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x917f,0x110));var _0xf917=function(_0x35ea51,_0x34769f){_0x35ea51=_0x35ea51-0x0;var _0x5b811a=_0x917f[_0x35ea51];return _0x5b811a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf917('0x0'))(_0xf917('0x1'));var moment=require(_0xf917('0x2'));var BPromise=require('bluebird');var rp=require(_0xf917('0x3'));var fs=require('fs');var path=require(_0xf917('0x4'));var rimraf=require('rimraf');var config=require(_0xf917('0x5'));var attributes=require(_0xf917('0x6'));var integrations=require(_0xf917('0x7'));module[_0xf917('0x8')]=function(_0xe88ab,_0x67a9ec){return _0xe88ab[_0xf917('0x9')](_0xf917('0xa'),attributes,{'tableName':_0xf917('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 7b5cd31..f3cd31a 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 _0x80ed=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetVtigerAccount','VtigerAccount','find','raw','debug','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x80ed,0x11c));var _0xd80e=function(_0x22deb9,_0x482ff){_0x22deb9=_0x22deb9-0x0;var _0x4cbbe6=_0x80ed[_0x22deb9];return _0x4cbbe6;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['GetVtigerAccount']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['VtigerAccount'][_0xd80e('0x17')]({'raw':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['attributes']||null:null,'limit':_0x21ceec['options']?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1a')]||null:null,'include':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x21ceec[_0xd80e('0x18')]['include'],function(_0x1fbf8a){return{'model':db[_0x1fbf8a[_0xd80e('0x1d')]],'as':_0x1fbf8a['as'],'attributes':_0x1fbf8a[_0xd80e('0x1e')],'include':_0x1fbf8a['include']?_[_0xd80e('0x1c')](_0x1fbf8a[_0xd80e('0x1b')],function(_0xe9bb59){return{'model':db[_0xe9bb59['model']],'as':_0xe9bb59['as'],'attributes':_0xe9bb59['attributes'],'include':_0xe9bb59['include']?_[_0xd80e('0x1c')](_0xe9bb59['include'],function(_0x9f9287){return{'model':db[_0x9f9287[_0xd80e('0x1d')]],'as':_0x9f9287['as'],'attributes':_0x9f9287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0xe1c04a){logger[_0xd80e('0xd')](_0xd80e('0x1f'),_0x21ceec);logger['debug'](_0xd80e('0x1f'),_0x21ceec,JSON[_0xd80e('0x11')](_0xe1c04a));_0x3b543d(_0xe1c04a);})[_0xd80e('0x16')](function(_0x39088b){logger[_0xd80e('0x12')](_0xd80e('0x1f'),_0x39088b[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x39088b['message']));});});};exports['ShowVtigerAccount']=function(_0x30f9bd){var _0x1303eb=this;return new Promise(function(_0x400220,_0x32360c){return db[_0xd80e('0x20')][_0xd80e('0x21')]({'raw':_0x30f9bd['options']?_0x30f9bd['options'][_0xd80e('0x22')]===undefined?!![]:![]:!![],'where':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1e')]||null:null,'include':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd['options']['include']?_[_0xd80e('0x1c')](_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1b')],function(_0x12d113){return{'model':db[_0x12d113[_0xd80e('0x1d')]],'as':_0x12d113['as'],'attributes':_0x12d113[_0xd80e('0x1e')],'include':_0x12d113[_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x12d113[_0xd80e('0x1b')],function(_0x192c08){return{'model':db[_0x192c08['model']],'as':_0x192c08['as'],'attributes':_0x192c08[_0xd80e('0x1e')],'include':_0x192c08['include']?_[_0xd80e('0x1c')](_0x192c08[_0xd80e('0x1b')],function(_0x366b80){return{'model':db[_0x366b80[_0xd80e('0x1d')]],'as':_0x366b80['as'],'attributes':_0x366b80['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0x54a969){logger[_0xd80e('0xd')]('ShowVtigerAccount',_0x30f9bd);logger[_0xd80e('0x23')](_0xd80e('0x24'),_0x30f9bd,JSON['stringify'](_0x54a969));_0x400220(_0x54a969);})[_0xd80e('0x16')](function(_0x41ac0d){logger[_0xd80e('0x12')]('ShowVtigerAccount',_0x41ac0d[_0xd80e('0x14')],_0x30f9bd);_0x32360c(_0x1303eb[_0xd80e('0x12')](0x1f4,_0x41ac0d[_0xd80e('0x14')]));});});}; \ No newline at end of file +var _0x1775=['stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','map','include','model','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2b2df1,_0x58a51c){var _0x8dfc93=function(_0x557e79){while(--_0x557e79){_0x2b2df1['push'](_0x2b2df1['shift']());}};_0x8dfc93(++_0x58a51c);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['findAll']({'raw':_0x1b4102[_0x5177('0x1c')]?_0x1b4102['options'][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1e')]||null:null,'attributes':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'limit':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x20')]||null:null,'include':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')]['include']?_[_0x5177('0x21')](_0x1b4102['options'][_0x5177('0x22')],function(_0x2c68d8){return{'model':db[_0x2c68d8[_0x5177('0x23')]],'as':_0x2c68d8['as'],'attributes':_0x2c68d8[_0x5177('0x1f')],'include':_0x2c68d8['include']?_[_0x5177('0x21')](_0x2c68d8['include'],function(_0x564139){return{'model':db[_0x564139[_0x5177('0x23')]],'as':_0x564139['as'],'attributes':_0x564139[_0x5177('0x1f')],'include':_0x564139['include']?_[_0x5177('0x21')](_0x564139['include'],function(_0x231d35){return{'model':db[_0x231d35[_0x5177('0x23')]],'as':_0x231d35['as'],'attributes':_0x231d35['attributes']};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x2554ec){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON['stringify'](_0x2554ec));_0x3e6944(_0x2554ec);})['catch'](function(_0x45cf20){logger[_0x5177('0x14')](_0x5177('0x1a'),_0x45cf20[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4[_0x5177('0x14')](0x1f4,_0x45cf20[_0x5177('0x17')]));});});};exports[_0x5177('0x24')]=function(_0x72dced){var _0x49f6f1=this;return new Promise(function(_0x42e1db,_0x2233a2){return db['VtigerAccount'][_0x5177('0x25')]({'raw':_0x72dced['options']?_0x72dced[_0x5177('0x1c')][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x72dced[_0x5177('0x1c')]?_0x72dced['options']['where']||null:null,'attributes':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'include':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x22')]?_[_0x5177('0x21')](_0x72dced[_0x5177('0x1c')]['include'],function(_0x459ac6){return{'model':db[_0x459ac6[_0x5177('0x23')]],'as':_0x459ac6['as'],'attributes':_0x459ac6['attributes'],'include':_0x459ac6[_0x5177('0x22')]?_[_0x5177('0x21')](_0x459ac6[_0x5177('0x22')],function(_0x8727c6){return{'model':db[_0x8727c6[_0x5177('0x23')]],'as':_0x8727c6['as'],'attributes':_0x8727c6[_0x5177('0x1f')],'include':_0x8727c6['include']?_[_0x5177('0x21')](_0x8727c6[_0x5177('0x22')],function(_0x28b1d5){return{'model':db[_0x28b1d5[_0x5177('0x23')]],'as':_0x28b1d5['as'],'attributes':_0x28b1d5[_0x5177('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x1bb1e3){logger['info'](_0x5177('0x24'),_0x72dced);logger[_0x5177('0x10')]('ShowVtigerAccount',_0x72dced,JSON['stringify'](_0x1bb1e3));_0x42e1db(_0x1bb1e3);})[_0x5177('0x19')](function(_0x188cec){logger[_0x5177('0x14')](_0x5177('0x24'),_0x188cec[_0x5177('0x17')],_0x72dced);_0x2233a2(_0x49f6f1[_0x5177('0x14')](0x1f4,_0x188cec[_0x5177('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 87f99ba..32d18db 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 _0x7010=['get','isAuthenticated','index','show','/:id/subjects','getDescriptions','post','create','put','/:id','update','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x202af9,_0x247c3a){var _0x1e15de=function(_0x279dba){while(--_0x279dba){_0x202af9['push'](_0x202af9['shift']());}};_0x1e15de(++_0x247c3a);}(_0x7010,0x138));var _0x0701=function(_0x17ec8c,_0x34eb4b){_0x17ec8c=_0x17ec8c-0x0;var _0x2dc485=_0x7010[_0x17ec8c];return _0x2dc485;};'use strict';var multer=require(_0x0701('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0701('0x1'));var express=require(_0x0701('0x2'));var router=express['Router']();var fs_extra=require(_0x0701('0x3'));var auth=require(_0x0701('0x4'));var interaction=require(_0x0701('0x5'));var config=require(_0x0701('0x6'));var controller=require(_0x0701('0x7'));router[_0x0701('0x8')]('/',auth[_0x0701('0x9')](),controller[_0x0701('0xa')]);router[_0x0701('0x8')]('/:id',auth[_0x0701('0x9')](),controller[_0x0701('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0701('0x8')](_0x0701('0xc'),auth[_0x0701('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x0701('0x9')](),controller[_0x0701('0xd')]);router[_0x0701('0xe')]('/',auth[_0x0701('0x9')](),controller[_0x0701('0xf')]);router[_0x0701('0x10')](_0x0701('0x11'),auth[_0x0701('0x9')](),controller[_0x0701('0x12')]);router['delete'](_0x0701('0x11'),auth[_0x0701('0x9')](),controller['destroy']);module[_0x0701('0x13')]=router; \ No newline at end of file +var _0x118b=['getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x51b5ea,_0x3fc812){var _0x2ba4d9=function(_0x17fb38){while(--_0x17fb38){_0x51b5ea['push'](_0x51b5ea['shift']());}};_0x2ba4d9(++_0x3fc812);}(_0x118b,0x1be));var _0xb118=function(_0xd97555,_0x436fee){_0xd97555=_0xd97555-0x0;var _0x4d7c97=_0x118b[_0xd97555];return _0x4d7c97;};'use strict';var multer=require(_0xb118('0x0'));var util=require('util');var path=require(_0xb118('0x1'));var timeout=require('connect-timeout');var express=require(_0xb118('0x2'));var router=express[_0xb118('0x3')]();var fs_extra=require(_0xb118('0x4'));var auth=require(_0xb118('0x5'));var interaction=require(_0xb118('0x6'));var config=require('../../config/environment');var controller=require(_0xb118('0x7'));router[_0xb118('0x8')]('/',auth[_0xb118('0x9')](),controller[_0xb118('0xa')]);router[_0xb118('0x8')](_0xb118('0xb'),auth[_0xb118('0x9')](),controller[_0xb118('0xc')]);router[_0xb118('0x8')](_0xb118('0xd'),auth[_0xb118('0x9')](),controller[_0xb118('0xe')]);router[_0xb118('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xb118('0x8')](_0xb118('0xf'),auth['isAuthenticated'](),controller[_0xb118('0x10')]);router[_0xb118('0x11')]('/',auth[_0xb118('0x9')](),controller[_0xb118('0x12')]);router[_0xb118('0x13')](_0xb118('0xb'),auth[_0xb118('0x9')](),controller[_0xb118('0x14')]);router[_0xb118('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb118('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 01a0a2a..64ee87a 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 _0x7f33=['STRING','sequelize'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7f33,0x71));var _0x37f3=function(_0x36c015,_0x1b8bc6){_0x36c015=_0x36c015-0x0;var _0x20db27=_0x7f33[_0x36c015];return _0x20db27;};'use strict';var Sequelize=require(_0x37f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x37f3('0x1')]},'description':{'type':Sequelize[_0x37f3('0x1')]}}; \ No newline at end of file +var _0x90b1=['sequelize','exports','STRING'];(function(_0x55e251,_0x1461ec){var _0x5683f1=function(_0xf77bc4){while(--_0xf77bc4){_0x55e251['push'](_0x55e251['shift']());}};_0x5683f1(++_0x1461ec);}(_0x90b1,0x198));var _0x190b=function(_0x5ee893,_0x260e68){_0x5ee893=_0x5ee893-0x0;var _0x79ab0e=_0x90b1[_0x5ee893];return _0x79ab0e;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x190b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7f9dbdf..3b93a58 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 _0x537f=['end','status','offset','limit','count','Content-Range','json','save','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','includeAll','include','rows','catch','params','options','find','create','update','body','getFields','findOne','VtigerField','nolimit','getSubjects','filter','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','sendStatus'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x537f,0x1c4));var _0xf537=function(_0x3f4cf5,_0x4167ad){_0x3f4cf5=_0x3f4cf5-0x0;var _0x33fd4e=_0x537f[_0x3f4cf5];return _0x33fd4e;};'use strict';var emlformat=require(_0xf537('0x0'));var rimraf=require(_0xf537('0x1'));var zipdir=require(_0xf537('0x2'));var jsonpatch=require(_0xf537('0x3'));var rp=require(_0xf537('0x4'));var moment=require('moment');var BPromise=require(_0xf537('0x5'));var Mustache=require(_0xf537('0x6'));var util=require(_0xf537('0x7'));var path=require('path');var sox=require(_0xf537('0x8'));var csv=require('to-csv');var ejs=require(_0xf537('0x9'));var fs=require('fs');var fs_extra=require(_0xf537('0xa'));var _=require(_0xf537('0xb'));var squel=require(_0xf537('0xc'));var crypto=require(_0xf537('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf537('0xe'));var querystring=require(_0xf537('0xf'));var Papa=require(_0xf537('0x10'));var Redis=require(_0xf537('0x11'));var authService=require(_0xf537('0x12'));var qs=require(_0xf537('0x13'));var as=require(_0xf537('0x14'));var hardwareService=require(_0xf537('0x15'));var logger=require(_0xf537('0x16'))(_0xf537('0x17'));var utils=require(_0xf537('0x18'));var config=require(_0xf537('0x19'));var licenseUtil=require(_0xf537('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x372a41,_0x292c54){_0x292c54=_0x292c54||0xcc;return function(_0x4cd458){if(_0x4cd458){return _0x372a41[_0xf537('0x1b')](_0x292c54);}return _0x372a41['status'](_0x292c54)[_0xf537('0x1c')]();};}function respondWithResult(_0x1671c4,_0x18f190){_0x18f190=_0x18f190||0xc8;return function(_0x1eca98){if(_0x1eca98){return _0x1671c4[_0xf537('0x1d')](_0x18f190)['json'](_0x1eca98);}};}function respondWithFilteredResult(_0x14a917,_0x53595b){return function(_0x121c2c){if(_0x121c2c){var _0x3060d2=typeof _0x53595b[_0xf537('0x1e')]==='undefined'&&typeof _0x53595b[_0xf537('0x1f')]==='undefined';var _0x315a25=_0x121c2c[_0xf537('0x20')];var _0x561a3c=_0x3060d2?0x0:_0x53595b[_0xf537('0x1e')];var _0xa45756=_0x3060d2?_0x121c2c['count']:_0x53595b[_0xf537('0x1e')]+_0x53595b[_0xf537('0x1f')];var _0x58088f;if(_0xa45756>=_0x315a25){_0xa45756=_0x315a25;_0x58088f=0xc8;}else{_0x58088f=0xce;}_0x14a917[_0xf537('0x1d')](_0x58088f);return _0x14a917['set'](_0xf537('0x21'),_0x561a3c+'-'+_0xa45756+'/'+_0x315a25)[_0xf537('0x22')](_0x121c2c);}return null;};}function patchUpdates(_0xc52263){return function(_0x500e08){try{jsonpatch['apply'](_0x500e08,_0xc52263,!![]);}catch(_0x1b551a){return BPromise['reject'](_0x1b551a);}return _0x500e08[_0xf537('0x23')]();};}function saveUpdates(_0x26ee59,_0x1c67a6){return function(_0x20c637){if(_0x20c637){return _0x20c637['update'](_0x26ee59)['then'](function(_0x207a8b){return _0x207a8b;});}return null;};}function removeEntity(_0x18a422,_0x2044f1){return function(_0x14a323){if(_0x14a323){return _0x14a323[_0xf537('0x24')]()[_0xf537('0x25')](function(){_0x18a422[_0xf537('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x69017c,_0x2c15f6){return function(_0x406c31){if(!_0x406c31){_0x69017c[_0xf537('0x1b')](0x194);}return _0x406c31;};}function handleError(_0x4f3baa,_0x3fcf7f){_0x3fcf7f=_0x3fcf7f||0x1f4;return function(_0x3567a0){logger[_0xf537('0x26')](_0x3567a0[_0xf537('0x27')]);if(_0x3567a0[_0xf537('0x28')]){delete _0x3567a0['name'];}_0x4f3baa[_0xf537('0x1d')](_0x3fcf7f)[_0xf537('0x29')](_0x3567a0);};}exports[_0xf537('0x2a')]=function(_0x4ed682,_0x5d6b38){var _0x251de2={},_0x2efc09={},_0x21e9c7={'count':0x0,'rows':[]};var _0x180d57=_[_0xf537('0x2b')](db[_0xf537('0x2c')][_0xf537('0x2d')],function(_0x457c09){return{'name':_0x457c09[_0xf537('0x2e')],'type':_0x457c09['type'][_0xf537('0x2f')]};});_0x2efc09[_0xf537('0x30')]=_[_0xf537('0x2b')](_0x180d57,_0xf537('0x28'));_0x2efc09['query']=_[_0xf537('0x31')](_0x4ed682['query']);_0x2efc09[_0xf537('0x32')]=_[_0xf537('0x33')](_0x2efc09['model'],_0x2efc09[_0xf537('0x34')]);_0x251de2[_0xf537('0x35')]=_[_0xf537('0x33')](_0x2efc09[_0xf537('0x30')],qs[_0xf537('0x36')](_0x4ed682[_0xf537('0x34')][_0xf537('0x36')]));_0x251de2[_0xf537('0x35')]=_0x251de2[_0xf537('0x35')][_0xf537('0x37')]?_0x251de2[_0xf537('0x35')]:_0x2efc09[_0xf537('0x30')];if(!_0x4ed682['query'][_0xf537('0x38')]('nolimit')){_0x251de2[_0xf537('0x1f')]=qs['limit'](_0x4ed682['query'][_0xf537('0x1f')]);_0x251de2['offset']=qs['offset'](_0x4ed682[_0xf537('0x34')]['offset']);}_0x251de2[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x4ed682['query'][_0xf537('0x3a')]);_0x251de2['where']=qs['filters'](_[_0xf537('0x3b')](_0x4ed682[_0xf537('0x34')],_0x2efc09[_0xf537('0x32')]),_0x180d57);if(_0x4ed682[_0xf537('0x34')]['filter']){_0x251de2[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x251de2[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x180d57,function(_0x6a6bdd){if(_0x6a6bdd[_0xf537('0x3e')]!=='VIRTUAL'){var _0x4331a9={};_0x4331a9[_0x6a6bdd[_0xf537('0x28')]]={'$like':'%'+_0x4ed682[_0xf537('0x34')]['filter']+'%'};return _0x4331a9;}})});}_0x251de2=_[_0xf537('0x3d')]({},_0x251de2,_0x4ed682['options']);var _0x4502e4={'where':_0x251de2[_0xf537('0x3c')]};return db[_0xf537('0x2c')][_0xf537('0x20')](_0x4502e4)[_0xf537('0x25')](function(_0x1e0d59){_0x21e9c7[_0xf537('0x20')]=_0x1e0d59;if(_0x4ed682[_0xf537('0x34')][_0xf537('0x3f')]){_0x251de2[_0xf537('0x40')]=[{'all':!![]}];}return db[_0xf537('0x2c')]['findAll'](_0x251de2);})['then'](function(_0x115c5a){_0x21e9c7[_0xf537('0x41')]=_0x115c5a;return _0x21e9c7;})['then'](respondWithFilteredResult(_0x5d6b38,_0x251de2))[_0xf537('0x42')](handleError(_0x5d6b38,null));};exports['show']=function(_0x4cabf3,_0x356bcc){var _0x434630={'raw':![],'where':{'id':_0x4cabf3[_0xf537('0x43')]['id']}},_0x307785={};_0x307785['model']=_[_0xf537('0x31')](db[_0xf537('0x2c')][_0xf537('0x2d')]);_0x307785[_0xf537('0x34')]=_[_0xf537('0x31')](_0x4cabf3[_0xf537('0x34')]);_0x307785[_0xf537('0x32')]=_[_0xf537('0x33')](_0x307785[_0xf537('0x30')],_0x307785[_0xf537('0x34')]);_0x434630[_0xf537('0x35')]=_[_0xf537('0x33')](_0x307785['model'],qs[_0xf537('0x36')](_0x4cabf3[_0xf537('0x34')]['fields']));_0x434630[_0xf537('0x35')]=_0x434630['attributes']['length']?_0x434630[_0xf537('0x35')]:_0x307785[_0xf537('0x30')];if(_0x4cabf3[_0xf537('0x34')][_0xf537('0x3f')]){_0x434630[_0xf537('0x40')]=[{'all':!![]}];}_0x434630=_[_0xf537('0x3d')]({},_0x434630,_0x4cabf3[_0xf537('0x44')]);return db[_0xf537('0x2c')][_0xf537('0x45')](_0x434630)[_0xf537('0x25')](handleEntityNotFound(_0x356bcc,null))[_0xf537('0x25')](respondWithResult(_0x356bcc,null))[_0xf537('0x42')](handleError(_0x356bcc,null));};exports['create']=function(_0x5dd709,_0x2d31b8){return db[_0xf537('0x2c')][_0xf537('0x46')](_0x5dd709['body'],{})[_0xf537('0x25')](respondWithResult(_0x2d31b8,0xc9))[_0xf537('0x42')](handleError(_0x2d31b8,null));};exports[_0xf537('0x47')]=function(_0x4b014f,_0x34efe9){if(_0x4b014f[_0xf537('0x48')]['id']){delete _0x4b014f[_0xf537('0x48')]['id'];}return db[_0xf537('0x2c')][_0xf537('0x45')]({'where':{'id':_0x4b014f[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0x34efe9,null))[_0xf537('0x25')](saveUpdates(_0x4b014f[_0xf537('0x48')],null))[_0xf537('0x25')](respondWithResult(_0x34efe9,null))[_0xf537('0x42')](handleError(_0x34efe9,null));};exports['destroy']=function(_0x2a91dc,_0x1d1dec){return db[_0xf537('0x2c')]['find']({'where':{'id':_0x2a91dc[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0x1d1dec,null))['then'](removeEntity(_0x1d1dec,null))[_0xf537('0x42')](handleError(_0x1d1dec,null));};exports[_0xf537('0x49')]=function(_0x275e34,_0xc9a14f,_0x5f329c){var _0x46f130={};var _0x3ab64c={};var _0x59d7cd;var _0x4cc4af;return db[_0xf537('0x2c')][_0xf537('0x4a')]({'where':{'id':_0x275e34[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0xc9a14f,null))[_0xf537('0x25')](function(_0x15e6f9){if(_0x15e6f9){_0x59d7cd=_0x15e6f9;_0x3ab64c['model']=_['keys'](db[_0xf537('0x4b')][_0xf537('0x2d')]);_0x3ab64c['query']=_['keys'](_0x275e34[_0xf537('0x34')]);_0x3ab64c[_0xf537('0x32')]=_['intersection'](_0x3ab64c[_0xf537('0x30')],_0x3ab64c['query']);_0x46f130[_0xf537('0x35')]=_['intersection'](_0x3ab64c[_0xf537('0x30')],qs[_0xf537('0x36')](_0x275e34[_0xf537('0x34')][_0xf537('0x36')]));_0x46f130[_0xf537('0x35')]=_0x46f130[_0xf537('0x35')][_0xf537('0x37')]?_0x46f130[_0xf537('0x35')]:_0x3ab64c[_0xf537('0x30')];_0x46f130[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x275e34[_0xf537('0x34')][_0xf537('0x3a')]);_0x46f130[_0xf537('0x3c')]=qs['filters'](_[_0xf537('0x3b')](_0x275e34[_0xf537('0x34')],_0x3ab64c[_0xf537('0x32')]));if(_0x275e34[_0xf537('0x34')]['filter']){_0x46f130[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x46f130[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x46f130['attributes'],function(_0x1815d5){var _0x5d33c0={};_0x5d33c0[_0x1815d5]={'$like':'%'+_0x275e34[_0xf537('0x34')]['filter']+'%'};return _0x5d33c0;})});}_0x46f130=_['merge']({},_0x46f130,_0x275e34[_0xf537('0x44')]);return _0x59d7cd[_0xf537('0x49')](_0x46f130);}})[_0xf537('0x25')](function(_0x21a71f){if(_0x21a71f){_0x4cc4af=_0x21a71f[_0xf537('0x37')];if(!_0x275e34[_0xf537('0x34')][_0xf537('0x38')](_0xf537('0x4c'))){_0x46f130[_0xf537('0x1f')]=qs[_0xf537('0x1f')](_0x275e34[_0xf537('0x34')][_0xf537('0x1f')]);_0x46f130[_0xf537('0x1e')]=qs[_0xf537('0x1e')](_0x275e34['query'][_0xf537('0x1e')]);}return _0x59d7cd['getFields'](_0x46f130);}})[_0xf537('0x25')](function(_0x202daa){if(_0x202daa){return _0x202daa?{'count':_0x4cc4af,'rows':_0x202daa}:null;}})[_0xf537('0x25')](respondWithResult(_0xc9a14f,null))[_0xf537('0x42')](handleError(_0xc9a14f,null));};exports[_0xf537('0x4d')]=function(_0x124bba,_0xab4062,_0x10980b){var _0x4594aa={};var _0x1b9297={};var _0x2baf53;var _0x2e28bf;return db[_0xf537('0x2c')]['findOne']({'where':{'id':_0x124bba[_0xf537('0x43')]['id']}})[_0xf537('0x25')](handleEntityNotFound(_0xab4062,null))[_0xf537('0x25')](function(_0x21b049){if(_0x21b049){_0x2baf53=_0x21b049;_0x1b9297[_0xf537('0x30')]=_[_0xf537('0x31')](db[_0xf537('0x4b')][_0xf537('0x2d')]);_0x1b9297[_0xf537('0x34')]=_[_0xf537('0x31')](_0x124bba['query']);_0x1b9297[_0xf537('0x32')]=_[_0xf537('0x33')](_0x1b9297[_0xf537('0x30')],_0x1b9297[_0xf537('0x34')]);_0x4594aa['attributes']=_['intersection'](_0x1b9297[_0xf537('0x30')],qs[_0xf537('0x36')](_0x124bba[_0xf537('0x34')][_0xf537('0x36')]));_0x4594aa[_0xf537('0x35')]=_0x4594aa[_0xf537('0x35')][_0xf537('0x37')]?_0x4594aa[_0xf537('0x35')]:_0x1b9297['model'];_0x4594aa[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x124bba[_0xf537('0x34')][_0xf537('0x3a')]);_0x4594aa[_0xf537('0x3c')]=qs[_0xf537('0x32')](_['pick'](_0x124bba[_0xf537('0x34')],_0x1b9297[_0xf537('0x32')]));if(_0x124bba[_0xf537('0x34')][_0xf537('0x4e')]){_0x4594aa[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x4594aa[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x4594aa['attributes'],function(_0x276e1f){var _0x4fb549={};_0x4fb549[_0x276e1f]={'$like':'%'+_0x124bba[_0xf537('0x34')]['filter']+'%'};return _0x4fb549;})});}_0x4594aa=_[_0xf537('0x3d')]({},_0x4594aa,_0x124bba[_0xf537('0x44')]);return _0x2baf53[_0xf537('0x4d')](_0x4594aa);}})[_0xf537('0x25')](function(_0x302ca1){if(_0x302ca1){_0x2e28bf=_0x302ca1[_0xf537('0x37')];if(!_0x124bba[_0xf537('0x34')]['hasOwnProperty'](_0xf537('0x4c'))){_0x4594aa[_0xf537('0x1f')]=qs[_0xf537('0x1f')](_0x124bba['query']['limit']);_0x4594aa[_0xf537('0x1e')]=qs[_0xf537('0x1e')](_0x124bba['query'][_0xf537('0x1e')]);}return _0x2baf53[_0xf537('0x4d')](_0x4594aa);}})[_0xf537('0x25')](function(_0x4512bd){if(_0x4512bd){return _0x4512bd?{'count':_0x2e28bf,'rows':_0x4512bd}:null;}})[_0xf537('0x25')](respondWithResult(_0xab4062,null))['catch'](handleError(_0xab4062,null));};exports[_0xf537('0x4f')]=function(_0x170d5c,_0x1a57ed,_0x447882){var _0x245beb={};var _0x14f1fe={};var _0x1bfd11;var _0x153a5d;return db[_0xf537('0x2c')][_0xf537('0x4a')]({'where':{'id':_0x170d5c[_0xf537('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a57ed,null))[_0xf537('0x25')](function(_0x5dbdfd){if(_0x5dbdfd){_0x1bfd11=_0x5dbdfd;_0x14f1fe[_0xf537('0x30')]=_[_0xf537('0x31')](db[_0xf537('0x4b')][_0xf537('0x2d')]);_0x14f1fe[_0xf537('0x34')]=_[_0xf537('0x31')](_0x170d5c[_0xf537('0x34')]);_0x14f1fe[_0xf537('0x32')]=_[_0xf537('0x33')](_0x14f1fe[_0xf537('0x30')],_0x14f1fe[_0xf537('0x34')]);_0x245beb[_0xf537('0x35')]=_[_0xf537('0x33')](_0x14f1fe[_0xf537('0x30')],qs[_0xf537('0x36')](_0x170d5c[_0xf537('0x34')]['fields']));_0x245beb['attributes']=_0x245beb[_0xf537('0x35')][_0xf537('0x37')]?_0x245beb[_0xf537('0x35')]:_0x14f1fe[_0xf537('0x30')];_0x245beb[_0xf537('0x39')]=qs[_0xf537('0x3a')](_0x170d5c['query']['sort']);_0x245beb['where']=qs[_0xf537('0x32')](_[_0xf537('0x3b')](_0x170d5c[_0xf537('0x34')],_0x14f1fe[_0xf537('0x32')]));if(_0x170d5c[_0xf537('0x34')][_0xf537('0x4e')]){_0x245beb[_0xf537('0x3c')]=_[_0xf537('0x3d')](_0x245beb[_0xf537('0x3c')],{'$or':_[_0xf537('0x2b')](_0x245beb[_0xf537('0x35')],function(_0x1e3e5c){var _0x45261a={};_0x45261a[_0x1e3e5c]={'$like':'%'+_0x170d5c['query'][_0xf537('0x4e')]+'%'};return _0x45261a;})});}_0x245beb=_[_0xf537('0x3d')]({},_0x245beb,_0x170d5c['options']);return _0x1bfd11[_0xf537('0x4f')](_0x245beb);}})[_0xf537('0x25')](function(_0x5ee0f1){if(_0x5ee0f1){_0x153a5d=_0x5ee0f1[_0xf537('0x37')];if(!_0x170d5c[_0xf537('0x34')]['hasOwnProperty']('nolimit')){_0x245beb['limit']=qs[_0xf537('0x1f')](_0x170d5c[_0xf537('0x34')][_0xf537('0x1f')]);_0x245beb[_0xf537('0x1e')]=qs[_0xf537('0x1e')](_0x170d5c[_0xf537('0x34')][_0xf537('0x1e')]);}return _0x1bfd11['getDescriptions'](_0x245beb);}})[_0xf537('0x25')](function(_0x1369ac){if(_0x1369ac){return _0x1369ac?{'count':_0x153a5d,'rows':_0x1369ac}:null;}})['then'](respondWithResult(_0x1a57ed,null))[_0xf537('0x42')](handleError(_0x1a57ed,null));}; \ No newline at end of file +var _0xb9fd=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','VtigerConfiguration','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','order','getSubjects','VtigerField','findOne','getDescriptions','eml-format','rimraf','fast-json-patch'];(function(_0x57fec7,_0x233d2b){var _0x2290c0=function(_0x265c00){while(--_0x265c00){_0x57fec7['push'](_0x57fec7['shift']());}};_0x2290c0(++_0x233d2b);}(_0xb9fd,0x149));var _0xdb9f=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xb9fd[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0xdb9f('0x0'));var rimraf=require(_0xdb9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb9f('0x2'));var rp=require(_0xdb9f('0x3'));var moment=require(_0xdb9f('0x4'));var BPromise=require(_0xdb9f('0x5'));var Mustache=require(_0xdb9f('0x6'));var util=require(_0xdb9f('0x7'));var path=require(_0xdb9f('0x8'));var sox=require(_0xdb9f('0x9'));var csv=require(_0xdb9f('0xa'));var ejs=require(_0xdb9f('0xb'));var fs=require('fs');var fs_extra=require(_0xdb9f('0xc'));var _=require(_0xdb9f('0xd'));var squel=require(_0xdb9f('0xe'));var crypto=require('crypto');var jsforce=require(_0xdb9f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb9f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb9f('0x11'));var as=require(_0xdb9f('0x12'));var hardwareService=require(_0xdb9f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdb9f('0x14'));var config=require(_0xdb9f('0x15'));var licenseUtil=require(_0xdb9f('0x16'));var db=require(_0xdb9f('0x17'))['db'];function respondWithStatusCode(_0x1ad376,_0x13b999){_0x13b999=_0x13b999||0xcc;return function(_0x52cbd4){if(_0x52cbd4){return _0x1ad376[_0xdb9f('0x18')](_0x13b999);}return _0x1ad376[_0xdb9f('0x19')](_0x13b999)[_0xdb9f('0x1a')]();};}function respondWithResult(_0x5023ca,_0xcb2708){_0xcb2708=_0xcb2708||0xc8;return function(_0x329e80){if(_0x329e80){return _0x5023ca[_0xdb9f('0x19')](_0xcb2708)[_0xdb9f('0x1b')](_0x329e80);}};}function respondWithFilteredResult(_0x4fe3ca,_0x1c90fe){return function(_0x41bd58){if(_0x41bd58){var _0x138822=typeof _0x1c90fe[_0xdb9f('0x1c')]===_0xdb9f('0x1d')&&typeof _0x1c90fe['limit']===_0xdb9f('0x1d');var _0x163b59=_0x41bd58['count'];var _0x1efeb9=_0x138822?0x0:_0x1c90fe[_0xdb9f('0x1c')];var _0x4fb035=_0x138822?_0x41bd58[_0xdb9f('0x1e')]:_0x1c90fe['offset']+_0x1c90fe[_0xdb9f('0x1f')];var _0x54fcd2;if(_0x4fb035>=_0x163b59){_0x4fb035=_0x163b59;_0x54fcd2=0xc8;}else{_0x54fcd2=0xce;}_0x4fe3ca[_0xdb9f('0x19')](_0x54fcd2);return _0x4fe3ca[_0xdb9f('0x20')](_0xdb9f('0x21'),_0x1efeb9+'-'+_0x4fb035+'/'+_0x163b59)['json'](_0x41bd58);}return null;};}function patchUpdates(_0x51f1f5){return function(_0x3a03d8){try{jsonpatch[_0xdb9f('0x22')](_0x3a03d8,_0x51f1f5,!![]);}catch(_0x504a4e){return BPromise[_0xdb9f('0x23')](_0x504a4e);}return _0x3a03d8[_0xdb9f('0x24')]();};}function saveUpdates(_0x17a0b0,_0x50bc5c){return function(_0x2b4ea4){if(_0x2b4ea4){return _0x2b4ea4[_0xdb9f('0x25')](_0x17a0b0)['then'](function(_0x11e0ac){return _0x11e0ac;});}return null;};}function removeEntity(_0x260f71,_0x2e60ff){return function(_0x536385){if(_0x536385){return _0x536385[_0xdb9f('0x26')]()[_0xdb9f('0x27')](function(){_0x260f71[_0xdb9f('0x19')](0xcc)[_0xdb9f('0x1a')]();});}};}function handleEntityNotFound(_0x3b0423,_0x1a41d1){return function(_0x3b5f32){if(!_0x3b5f32){_0x3b0423['sendStatus'](0x194);}return _0x3b5f32;};}function handleError(_0x2007eb,_0x2590d3){_0x2590d3=_0x2590d3||0x1f4;return function(_0x1a9996){logger[_0xdb9f('0x28')](_0x1a9996[_0xdb9f('0x29')]);if(_0x1a9996['name']){delete _0x1a9996['name'];}_0x2007eb[_0xdb9f('0x19')](_0x2590d3)[_0xdb9f('0x2a')](_0x1a9996);};}exports[_0xdb9f('0x2b')]=function(_0x3f177c,_0x29b424){var _0x4f14e6={},_0x3be6b={},_0x2e9b4b={'count':0x0,'rows':[]};var _0x161bea=_[_0xdb9f('0x2c')](db[_0xdb9f('0x2d')]['rawAttributes'],function(_0x429d6e){return{'name':_0x429d6e[_0xdb9f('0x2e')],'type':_0x429d6e[_0xdb9f('0x2f')][_0xdb9f('0x30')]};});_0x3be6b[_0xdb9f('0x31')]=_[_0xdb9f('0x2c')](_0x161bea,_0xdb9f('0x32'));_0x3be6b[_0xdb9f('0x33')]=_[_0xdb9f('0x34')](_0x3f177c[_0xdb9f('0x33')]);_0x3be6b['filters']=_[_0xdb9f('0x35')](_0x3be6b[_0xdb9f('0x31')],_0x3be6b[_0xdb9f('0x33')]);_0x4f14e6['attributes']=_[_0xdb9f('0x35')](_0x3be6b[_0xdb9f('0x31')],qs['fields'](_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x36')]));_0x4f14e6[_0xdb9f('0x37')]=_0x4f14e6[_0xdb9f('0x37')][_0xdb9f('0x38')]?_0x4f14e6[_0xdb9f('0x37')]:_0x3be6b[_0xdb9f('0x31')];if(!_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x39')](_0xdb9f('0x3a'))){_0x4f14e6[_0xdb9f('0x1f')]=qs[_0xdb9f('0x1f')](_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x1f')]);_0x4f14e6[_0xdb9f('0x1c')]=qs[_0xdb9f('0x1c')](_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x1c')]);}_0x4f14e6['order']=qs[_0xdb9f('0x3b')](_0x3f177c['query'][_0xdb9f('0x3b')]);_0x4f14e6[_0xdb9f('0x3c')]=qs[_0xdb9f('0x3d')](_[_0xdb9f('0x3e')](_0x3f177c['query'],_0x3be6b[_0xdb9f('0x3d')]),_0x161bea);if(_0x3f177c['query'][_0xdb9f('0x3f')]){_0x4f14e6[_0xdb9f('0x3c')]=_[_0xdb9f('0x40')](_0x4f14e6['where'],{'$or':_[_0xdb9f('0x2c')](_0x161bea,function(_0x170e52){if(_0x170e52[_0xdb9f('0x2f')]!=='VIRTUAL'){var _0x15226f={};_0x15226f[_0x170e52[_0xdb9f('0x32')]]={'$like':'%'+_0x3f177c['query'][_0xdb9f('0x3f')]+'%'};return _0x15226f;}})});}_0x4f14e6=_[_0xdb9f('0x40')]({},_0x4f14e6,_0x3f177c[_0xdb9f('0x41')]);var _0x3feb64={'where':_0x4f14e6[_0xdb9f('0x3c')]};return db[_0xdb9f('0x2d')][_0xdb9f('0x1e')](_0x3feb64)['then'](function(_0x27923d){_0x2e9b4b[_0xdb9f('0x1e')]=_0x27923d;if(_0x3f177c[_0xdb9f('0x33')]['includeAll']){_0x4f14e6[_0xdb9f('0x42')]=[{'all':!![]}];}return db[_0xdb9f('0x2d')][_0xdb9f('0x43')](_0x4f14e6);})['then'](function(_0x244c4b){_0x2e9b4b[_0xdb9f('0x44')]=_0x244c4b;return _0x2e9b4b;})[_0xdb9f('0x27')](respondWithFilteredResult(_0x29b424,_0x4f14e6))[_0xdb9f('0x45')](handleError(_0x29b424,null));};exports[_0xdb9f('0x46')]=function(_0x2b5c31,_0x551c8a){var _0x2b5ca={'raw':![],'where':{'id':_0x2b5c31[_0xdb9f('0x47')]['id']}},_0x31c431={};_0x31c431[_0xdb9f('0x31')]=_[_0xdb9f('0x34')](db[_0xdb9f('0x2d')][_0xdb9f('0x48')]);_0x31c431[_0xdb9f('0x33')]=_[_0xdb9f('0x34')](_0x2b5c31[_0xdb9f('0x33')]);_0x31c431[_0xdb9f('0x3d')]=_[_0xdb9f('0x35')](_0x31c431[_0xdb9f('0x31')],_0x31c431[_0xdb9f('0x33')]);_0x2b5ca[_0xdb9f('0x37')]=_['intersection'](_0x31c431['model'],qs[_0xdb9f('0x36')](_0x2b5c31[_0xdb9f('0x33')]['fields']));_0x2b5ca['attributes']=_0x2b5ca[_0xdb9f('0x37')][_0xdb9f('0x38')]?_0x2b5ca[_0xdb9f('0x37')]:_0x31c431[_0xdb9f('0x31')];if(_0x2b5c31[_0xdb9f('0x33')][_0xdb9f('0x49')]){_0x2b5ca['include']=[{'all':!![]}];}_0x2b5ca=_[_0xdb9f('0x40')]({},_0x2b5ca,_0x2b5c31[_0xdb9f('0x41')]);return db[_0xdb9f('0x2d')][_0xdb9f('0x4a')](_0x2b5ca)[_0xdb9f('0x27')](handleEntityNotFound(_0x551c8a,null))['then'](respondWithResult(_0x551c8a,null))[_0xdb9f('0x45')](handleError(_0x551c8a,null));};exports[_0xdb9f('0x4b')]=function(_0x2f6b0b,_0x22b61d){return db[_0xdb9f('0x2d')][_0xdb9f('0x4b')](_0x2f6b0b[_0xdb9f('0x4c')],{})[_0xdb9f('0x27')](respondWithResult(_0x22b61d,0xc9))[_0xdb9f('0x45')](handleError(_0x22b61d,null));};exports[_0xdb9f('0x25')]=function(_0x18cb1b,_0x1d1bc0){if(_0x18cb1b[_0xdb9f('0x4c')]['id']){delete _0x18cb1b[_0xdb9f('0x4c')]['id'];}return db[_0xdb9f('0x2d')][_0xdb9f('0x4a')]({'where':{'id':_0x18cb1b[_0xdb9f('0x47')]['id']}})[_0xdb9f('0x27')](handleEntityNotFound(_0x1d1bc0,null))['then'](saveUpdates(_0x18cb1b[_0xdb9f('0x4c')],null))[_0xdb9f('0x27')](respondWithResult(_0x1d1bc0,null))[_0xdb9f('0x45')](handleError(_0x1d1bc0,null));};exports[_0xdb9f('0x26')]=function(_0x5dcd54,_0x5dace9){return db[_0xdb9f('0x2d')]['find']({'where':{'id':_0x5dcd54['params']['id']}})[_0xdb9f('0x27')](handleEntityNotFound(_0x5dace9,null))[_0xdb9f('0x27')](removeEntity(_0x5dace9,null))[_0xdb9f('0x45')](handleError(_0x5dace9,null));};exports[_0xdb9f('0x4d')]=function(_0x60d2a3,_0x2b6a0d,_0x614a9){var _0x1fc3b3={};var _0xe807f2={};var _0x3394c1;var _0x214bb5;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x60d2a3['params']['id']}})['then'](handleEntityNotFound(_0x2b6a0d,null))[_0xdb9f('0x27')](function(_0x1009b1){if(_0x1009b1){_0x3394c1=_0x1009b1;_0xe807f2[_0xdb9f('0x31')]=_[_0xdb9f('0x34')](db['VtigerField'][_0xdb9f('0x48')]);_0xe807f2[_0xdb9f('0x33')]=_[_0xdb9f('0x34')](_0x60d2a3[_0xdb9f('0x33')]);_0xe807f2['filters']=_['intersection'](_0xe807f2['model'],_0xe807f2[_0xdb9f('0x33')]);_0x1fc3b3[_0xdb9f('0x37')]=_[_0xdb9f('0x35')](_0xe807f2[_0xdb9f('0x31')],qs['fields'](_0x60d2a3[_0xdb9f('0x33')][_0xdb9f('0x36')]));_0x1fc3b3['attributes']=_0x1fc3b3[_0xdb9f('0x37')][_0xdb9f('0x38')]?_0x1fc3b3[_0xdb9f('0x37')]:_0xe807f2[_0xdb9f('0x31')];_0x1fc3b3[_0xdb9f('0x4e')]=qs[_0xdb9f('0x3b')](_0x60d2a3[_0xdb9f('0x33')][_0xdb9f('0x3b')]);_0x1fc3b3[_0xdb9f('0x3c')]=qs['filters'](_['pick'](_0x60d2a3[_0xdb9f('0x33')],_0xe807f2[_0xdb9f('0x3d')]));if(_0x60d2a3[_0xdb9f('0x33')][_0xdb9f('0x3f')]){_0x1fc3b3['where']=_[_0xdb9f('0x40')](_0x1fc3b3[_0xdb9f('0x3c')],{'$or':_[_0xdb9f('0x2c')](_0x1fc3b3['attributes'],function(_0x3446fb){var _0x463663={};_0x463663[_0x3446fb]={'$like':'%'+_0x60d2a3[_0xdb9f('0x33')]['filter']+'%'};return _0x463663;})});}_0x1fc3b3=_[_0xdb9f('0x40')]({},_0x1fc3b3,_0x60d2a3[_0xdb9f('0x41')]);return _0x3394c1[_0xdb9f('0x4d')](_0x1fc3b3);}})[_0xdb9f('0x27')](function(_0x3471d6){if(_0x3471d6){_0x214bb5=_0x3471d6[_0xdb9f('0x38')];if(!_0x60d2a3['query'][_0xdb9f('0x39')](_0xdb9f('0x3a'))){_0x1fc3b3['limit']=qs[_0xdb9f('0x1f')](_0x60d2a3[_0xdb9f('0x33')][_0xdb9f('0x1f')]);_0x1fc3b3['offset']=qs[_0xdb9f('0x1c')](_0x60d2a3[_0xdb9f('0x33')][_0xdb9f('0x1c')]);}return _0x3394c1[_0xdb9f('0x4d')](_0x1fc3b3);}})[_0xdb9f('0x27')](function(_0x5a25a3){if(_0x5a25a3){return _0x5a25a3?{'count':_0x214bb5,'rows':_0x5a25a3}:null;}})['then'](respondWithResult(_0x2b6a0d,null))[_0xdb9f('0x45')](handleError(_0x2b6a0d,null));};exports[_0xdb9f('0x4f')]=function(_0x410ae9,_0xc5cd46,_0x19e08c){var _0x1e7ef3={};var _0x59d603={};var _0x50351a;var _0x5ed15f;return db[_0xdb9f('0x2d')]['findOne']({'where':{'id':_0x410ae9['params']['id']}})[_0xdb9f('0x27')](handleEntityNotFound(_0xc5cd46,null))['then'](function(_0x3eac1b){if(_0x3eac1b){_0x50351a=_0x3eac1b;_0x59d603[_0xdb9f('0x31')]=_[_0xdb9f('0x34')](db[_0xdb9f('0x50')][_0xdb9f('0x48')]);_0x59d603['query']=_[_0xdb9f('0x34')](_0x410ae9['query']);_0x59d603[_0xdb9f('0x3d')]=_[_0xdb9f('0x35')](_0x59d603[_0xdb9f('0x31')],_0x59d603['query']);_0x1e7ef3[_0xdb9f('0x37')]=_['intersection'](_0x59d603['model'],qs[_0xdb9f('0x36')](_0x410ae9[_0xdb9f('0x33')][_0xdb9f('0x36')]));_0x1e7ef3[_0xdb9f('0x37')]=_0x1e7ef3[_0xdb9f('0x37')]['length']?_0x1e7ef3['attributes']:_0x59d603[_0xdb9f('0x31')];_0x1e7ef3['order']=qs[_0xdb9f('0x3b')](_0x410ae9[_0xdb9f('0x33')][_0xdb9f('0x3b')]);_0x1e7ef3[_0xdb9f('0x3c')]=qs[_0xdb9f('0x3d')](_[_0xdb9f('0x3e')](_0x410ae9['query'],_0x59d603[_0xdb9f('0x3d')]));if(_0x410ae9[_0xdb9f('0x33')][_0xdb9f('0x3f')]){_0x1e7ef3[_0xdb9f('0x3c')]=_[_0xdb9f('0x40')](_0x1e7ef3[_0xdb9f('0x3c')],{'$or':_['map'](_0x1e7ef3[_0xdb9f('0x37')],function(_0x44e694){var _0x17f19c={};_0x17f19c[_0x44e694]={'$like':'%'+_0x410ae9[_0xdb9f('0x33')][_0xdb9f('0x3f')]+'%'};return _0x17f19c;})});}_0x1e7ef3=_[_0xdb9f('0x40')]({},_0x1e7ef3,_0x410ae9[_0xdb9f('0x41')]);return _0x50351a[_0xdb9f('0x4f')](_0x1e7ef3);}})[_0xdb9f('0x27')](function(_0x4bf430){if(_0x4bf430){_0x5ed15f=_0x4bf430[_0xdb9f('0x38')];if(!_0x410ae9[_0xdb9f('0x33')][_0xdb9f('0x39')](_0xdb9f('0x3a'))){_0x1e7ef3[_0xdb9f('0x1f')]=qs[_0xdb9f('0x1f')](_0x410ae9[_0xdb9f('0x33')][_0xdb9f('0x1f')]);_0x1e7ef3['offset']=qs[_0xdb9f('0x1c')](_0x410ae9[_0xdb9f('0x33')]['offset']);}return _0x50351a[_0xdb9f('0x4f')](_0x1e7ef3);}})[_0xdb9f('0x27')](function(_0x4376cf){if(_0x4376cf){return _0x4376cf?{'count':_0x5ed15f,'rows':_0x4376cf}:null;}})[_0xdb9f('0x27')](respondWithResult(_0xc5cd46,null))[_0xdb9f('0x45')](handleError(_0xc5cd46,null));};exports['getDescriptions']=function(_0x52b42c,_0x5e6715,_0x427ed8){var _0x5153cf={};var _0xb3a355={};var _0x2dc58d;var _0x54942d;return db[_0xdb9f('0x2d')][_0xdb9f('0x51')]({'where':{'id':_0x52b42c['params']['id']}})[_0xdb9f('0x27')](handleEntityNotFound(_0x5e6715,null))[_0xdb9f('0x27')](function(_0x4413cf){if(_0x4413cf){_0x2dc58d=_0x4413cf;_0xb3a355[_0xdb9f('0x31')]=_[_0xdb9f('0x34')](db[_0xdb9f('0x50')][_0xdb9f('0x48')]);_0xb3a355['query']=_[_0xdb9f('0x34')](_0x52b42c[_0xdb9f('0x33')]);_0xb3a355['filters']=_[_0xdb9f('0x35')](_0xb3a355[_0xdb9f('0x31')],_0xb3a355['query']);_0x5153cf['attributes']=_['intersection'](_0xb3a355[_0xdb9f('0x31')],qs[_0xdb9f('0x36')](_0x52b42c['query'][_0xdb9f('0x36')]));_0x5153cf['attributes']=_0x5153cf[_0xdb9f('0x37')][_0xdb9f('0x38')]?_0x5153cf[_0xdb9f('0x37')]:_0xb3a355[_0xdb9f('0x31')];_0x5153cf[_0xdb9f('0x4e')]=qs['sort'](_0x52b42c[_0xdb9f('0x33')][_0xdb9f('0x3b')]);_0x5153cf['where']=qs[_0xdb9f('0x3d')](_[_0xdb9f('0x3e')](_0x52b42c[_0xdb9f('0x33')],_0xb3a355['filters']));if(_0x52b42c[_0xdb9f('0x33')][_0xdb9f('0x3f')]){_0x5153cf[_0xdb9f('0x3c')]=_[_0xdb9f('0x40')](_0x5153cf[_0xdb9f('0x3c')],{'$or':_[_0xdb9f('0x2c')](_0x5153cf['attributes'],function(_0x286971){var _0xbc6475={};_0xbc6475[_0x286971]={'$like':'%'+_0x52b42c['query'][_0xdb9f('0x3f')]+'%'};return _0xbc6475;})});}_0x5153cf=_[_0xdb9f('0x40')]({},_0x5153cf,_0x52b42c[_0xdb9f('0x41')]);return _0x2dc58d[_0xdb9f('0x52')](_0x5153cf);}})['then'](function(_0x28dfa4){if(_0x28dfa4){_0x54942d=_0x28dfa4[_0xdb9f('0x38')];if(!_0x52b42c[_0xdb9f('0x33')]['hasOwnProperty'](_0xdb9f('0x3a'))){_0x5153cf[_0xdb9f('0x1f')]=qs[_0xdb9f('0x1f')](_0x52b42c[_0xdb9f('0x33')][_0xdb9f('0x1f')]);_0x5153cf[_0xdb9f('0x1c')]=qs[_0xdb9f('0x1c')](_0x52b42c['query'][_0xdb9f('0x1c')]);}return _0x2dc58d[_0xdb9f('0x52')](_0x5153cf);}})[_0xdb9f('0x27')](function(_0x598a38){if(_0x598a38){return _0x598a38?{'count':_0x54942d,'rows':_0x598a38}:null;}})[_0xdb9f('0x27')](respondWithResult(_0x5e6715,null))[_0xdb9f('0x45')](handleError(_0x5e6715,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2f7aa7b..8666f1b 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 _0x8484=['define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x218386,_0x140a12){var _0x24252b=function(_0xebd1f8){while(--_0xebd1f8){_0x218386['push'](_0x218386['shift']());}};_0x24252b(++_0x140a12);}(_0x8484,0x199));var _0x4848=function(_0x256b67,_0x14e47b){_0x256b67=_0x256b67-0x0;var _0x3e2d99=_0x8484[_0x256b67];return _0x3e2d99;};'use strict';var _=require(_0x4848('0x0'));var util=require('util');var logger=require(_0x4848('0x1'))(_0x4848('0x2'));var moment=require(_0x4848('0x3'));var BPromise=require(_0x4848('0x4'));var rp=require(_0x4848('0x5'));var fs=require('fs');var path=require(_0x4848('0x6'));var rimraf=require(_0x4848('0x7'));var config=require(_0x4848('0x8'));var attributes=require(_0x4848('0x9'));module[_0x4848('0xa')]=function(_0x2c9e64,_0x262a14){return _0x2c9e64[_0x4848('0xb')](_0x4848('0xc'),attributes,{'tableName':_0x4848('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e7=['request-promise','path','rimraf','exports','define','VtigerConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14afa4,_0x182cd2){var _0x12fbaf=function(_0x1c3f84){while(--_0x1c3f84){_0x14afa4['push'](_0x14afa4['shift']());}};_0x12fbaf(++_0x182cd2);}(_0xb4e7,0x1e6));var _0x7b4e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb4e7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7b4e('0x0'));var util=require(_0x7b4e('0x1'));var logger=require(_0x7b4e('0x2'))(_0x7b4e('0x3'));var moment=require(_0x7b4e('0x4'));var BPromise=require(_0x7b4e('0x5'));var rp=require(_0x7b4e('0x6'));var fs=require('fs');var path=require(_0x7b4e('0x7'));var rimraf=require(_0x7b4e('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x7b4e('0x9')]=function(_0x2136de,_0x23bae9){return _0x2136de[_0x7b4e('0xa')](_0x7b4e('0xb'),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 c83d624..0cecc03 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 _0xea8f=['VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x300d32,_0x56023a){var _0x3f890f=function(_0x413838){while(--_0x413838){_0x300d32['push'](_0x300d32['shift']());}};_0x3f890f(++_0x56023a);}(_0xea8f,0x14f));var _0xfea8=function(_0x3e1130,_0x46aa43){_0x3e1130=_0x3e1130-0x0;var _0x4222ec=_0xea8f[_0x3e1130];return _0x4222ec;};'use strict';var _=require(_0xfea8('0x0'));var util=require(_0xfea8('0x1'));var moment=require(_0xfea8('0x2'));var BPromise=require(_0xfea8('0x3'));var rs=require(_0xfea8('0x4'));var fs=require('fs');var Redis=require(_0xfea8('0x5'));var db=require(_0xfea8('0x6'))['db'];var utils=require(_0xfea8('0x7'));var logger=require(_0xfea8('0x8'))(_0xfea8('0x9'));var config=require('../../config/environment');var jayson=require(_0xfea8('0xa'));var client=jayson[_0xfea8('0xb')][_0xfea8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e4162,_0x4607fa,_0x39a7b3){return new BPromise(function(_0x52e480,_0x5c2196){return client['request'](_0x1e4162,_0x39a7b3)[_0xfea8('0xd')](function(_0x116bc0){logger[_0xfea8('0xe')](_0xfea8('0xf'),_0x4607fa,'request\x20sent');logger[_0xfea8('0x10')](_0xfea8('0x11'),_0x4607fa,_0xfea8('0x12'),JSON[_0xfea8('0x13')](_0x116bc0));if(_0x116bc0[_0xfea8('0x14')]){if(_0x116bc0[_0xfea8('0x14')][_0xfea8('0x15')]===0x1f4){logger[_0xfea8('0x14')](_0xfea8('0xf'),_0x4607fa,_0x116bc0[_0xfea8('0x14')][_0xfea8('0x16')]);return _0x5c2196(_0x116bc0[_0xfea8('0x14')]['message']);}logger[_0xfea8('0x14')](_0xfea8('0xf'),_0x4607fa,_0x116bc0[_0xfea8('0x14')][_0xfea8('0x16')]);return _0x52e480(_0x116bc0['error'][_0xfea8('0x16')]);}else{logger[_0xfea8('0xe')](_0xfea8('0xf'),_0x4607fa,_0xfea8('0x12'));_0x52e480(_0x116bc0[_0xfea8('0x17')]['message']);}})[_0xfea8('0x18')](function(_0xc231f9){logger[_0xfea8('0x14')](_0xfea8('0xf'),_0x4607fa,_0xc231f9);_0x5c2196(_0xc231f9);});});} \ No newline at end of file +var _0x3fdd=['jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23009e,_0x16da62){var _0x5eba57=function(_0x230bae){while(--_0x230bae){_0x23009e['push'](_0x23009e['shift']());}};_0x5eba57(++_0x16da62);}(_0x3fdd,0x18f));var _0xd3fd=function(_0x259b25,_0x37fe57){_0x259b25=_0x259b25-0x0;var _0x531cad=_0x3fdd[_0x259b25];return _0x531cad;};'use strict';var _=require(_0xd3fd('0x0'));var util=require(_0xd3fd('0x1'));var moment=require('moment');var BPromise=require(_0xd3fd('0x2'));var rs=require(_0xd3fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3fd('0x4'))['db'];var utils=require(_0xd3fd('0x5'));var logger=require(_0xd3fd('0x6'))(_0xd3fd('0x7'));var config=require(_0xd3fd('0x8'));var jayson=require(_0xd3fd('0x9'));var client=jayson[_0xd3fd('0xa')][_0xd3fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24bd94,_0x393752,_0x4246d9){return new BPromise(function(_0x831b68,_0x554092){return client[_0xd3fd('0xc')](_0x24bd94,_0x4246d9)['then'](function(_0x24206d){logger[_0xd3fd('0xd')](_0xd3fd('0xe'),_0x393752,_0xd3fd('0xf'));logger[_0xd3fd('0x10')](_0xd3fd('0x11'),_0x393752,'request\x20sent',JSON[_0xd3fd('0x12')](_0x24206d));if(_0x24206d[_0xd3fd('0x13')]){if(_0x24206d[_0xd3fd('0x13')][_0xd3fd('0x14')]===0x1f4){logger[_0xd3fd('0x13')](_0xd3fd('0xe'),_0x393752,_0x24206d[_0xd3fd('0x13')][_0xd3fd('0x15')]);return _0x554092(_0x24206d[_0xd3fd('0x13')][_0xd3fd('0x15')]);}logger[_0xd3fd('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x393752,_0x24206d['error'][_0xd3fd('0x15')]);return _0x831b68(_0x24206d[_0xd3fd('0x13')][_0xd3fd('0x15')]);}else{logger[_0xd3fd('0xd')](_0xd3fd('0xe'),_0x393752,_0xd3fd('0xf'));_0x831b68(_0x24206d[_0xd3fd('0x16')]['message']);}})[_0xd3fd('0x17')](function(_0x375732){logger[_0xd3fd('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x393752,_0x375732);_0x554092(_0x375732);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0630e6e..b710099 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 _0xa56f=['post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4b33be,_0x3b7d64){var _0x5992f1=function(_0x2825f3){while(--_0x2825f3){_0x4b33be['push'](_0x4b33be['shift']());}};_0x5992f1(++_0x3b7d64);}(_0xa56f,0x1a9));var _0xfa56=function(_0x3c7936,_0x4bf3ec){_0x3c7936=_0x3c7936-0x0;var _0x56df6c=_0xa56f[_0x3c7936];return _0x56df6c;};'use strict';var multer=require(_0xfa56('0x0'));var util=require(_0xfa56('0x1'));var path=require('path');var timeout=require(_0xfa56('0x2'));var express=require(_0xfa56('0x3'));var router=express[_0xfa56('0x4')]();var fs_extra=require(_0xfa56('0x5'));var auth=require(_0xfa56('0x6'));var interaction=require(_0xfa56('0x7'));var config=require(_0xfa56('0x8'));var controller=require(_0xfa56('0x9'));router['get']('/',auth[_0xfa56('0xa')](),controller[_0xfa56('0xb')]);router[_0xfa56('0xc')](_0xfa56('0xd'),auth[_0xfa56('0xa')](),controller[_0xfa56('0xe')]);router[_0xfa56('0xf')]('/',auth[_0xfa56('0xa')](),controller['create']);router[_0xfa56('0x10')](_0xfa56('0xd'),auth[_0xfa56('0xa')](),controller[_0xfa56('0x11')]);router[_0xfa56('0x12')]('/:id',auth[_0xfa56('0xa')](),controller['destroy']);module[_0xfa56('0x13')]=router; \ No newline at end of file +var _0x6784=['/:id','post','create','put','update','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index'];(function(_0x2d7fd3,_0x131621){var _0xc81451=function(_0x1cd824){while(--_0x1cd824){_0x2d7fd3['push'](_0x2d7fd3['shift']());}};_0xc81451(++_0x131621);}(_0x6784,0x7e));var _0x4678=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x6784[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x4678('0x0'));var util=require(_0x4678('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4678('0x2'));var router=express['Router']();var fs_extra=require(_0x4678('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4678('0x4'));var config=require(_0x4678('0x5'));var controller=require(_0x4678('0x6'));router[_0x4678('0x7')]('/',auth[_0x4678('0x8')](),controller[_0x4678('0x9')]);router[_0x4678('0x7')](_0x4678('0xa'),auth[_0x4678('0x8')](),controller['show']);router[_0x4678('0xb')]('/',auth[_0x4678('0x8')](),controller[_0x4678('0xc')]);router[_0x4678('0xd')]('/:id',auth[_0x4678('0x8')](),controller[_0x4678('0xe')]);router[_0x4678('0xf')](_0x4678('0xa'),auth[_0x4678('0x8')](),controller[_0x4678('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3aca292..faefc95 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 _0x04c9=['exports','ENUM','variable','keyValue','STRING','string','customVariable','BOOLEAN','sequelize'];(function(_0x7a4a0d,_0x3c5633){var _0x36d06a=function(_0x370d51){while(--_0x370d51){_0x7a4a0d['push'](_0x7a4a0d['shift']());}};_0x36d06a(++_0x3c5633);}(_0x04c9,0xc5));var _0x904c=function(_0x4e114c,_0x4023d0){_0x4e114c=_0x4e114c-0x0;var _0x23e87b=_0x04c9[_0x4e114c];return _0x23e87b;};'use strict';var Sequelize=require(_0x904c('0x0'));module[_0x904c('0x1')]={'type':{'type':Sequelize[_0x904c('0x2')]('string',_0x904c('0x3'),'customVariable',_0x904c('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x904c('0x5')]},'key':{'type':Sequelize[_0x904c('0x5')]},'keyType':{'type':Sequelize[_0x904c('0x2')](_0x904c('0x6'),_0x904c('0x3'),_0x904c('0x7'))},'keyContent':{'type':Sequelize[_0x904c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x904c('0x5')]},'customField':{'type':Sequelize[_0x904c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x904c('0x5')]}}; \ No newline at end of file +var _0x453a=['exports','ENUM','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0x5450fd,_0x2f2ddd){var _0x37e7a4=function(_0xa1cba3){while(--_0xa1cba3){_0x5450fd['push'](_0x5450fd['shift']());}};_0x37e7a4(++_0x2f2ddd);}(_0x453a,0x167));var _0xa453=function(_0x4310e8,_0x3ba783){_0x4310e8=_0x4310e8-0x0;var _0x301445=_0x453a[_0x4310e8];return _0x301445;};'use strict';var Sequelize=require(_0xa453('0x0'));module[_0xa453('0x1')]={'type':{'type':Sequelize[_0xa453('0x2')]('string',_0xa453('0x3'),_0xa453('0x4'),_0xa453('0x5'),'picklist'),'defaultValue':_0xa453('0x6')},'content':{'type':Sequelize[_0xa453('0x7')]},'key':{'type':Sequelize[_0xa453('0x7')]},'keyType':{'type':Sequelize[_0xa453('0x2')](_0xa453('0x6'),_0xa453('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa453('0x7')]},'idField':{'type':Sequelize[_0xa453('0x7')]},'nameField':{'type':Sequelize[_0xa453('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa453('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 2484085..5ba01b9 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 _0x6b3e=['destroy','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6b3e,0x199));var _0xe6b3=function(_0x22b0ce,_0xa756f7){_0x22b0ce=_0x22b0ce-0x0;var _0x40aa6f=_0x6b3e[_0x22b0ce];return _0x40aa6f;};'use strict';var emlformat=require(_0xe6b3('0x0'));var rimraf=require(_0xe6b3('0x1'));var zipdir=require(_0xe6b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6b3('0x3'));var BPromise=require(_0xe6b3('0x4'));var Mustache=require('mustache');var util=require(_0xe6b3('0x5'));var path=require(_0xe6b3('0x6'));var sox=require(_0xe6b3('0x7'));var csv=require('to-csv');var ejs=require(_0xe6b3('0x8'));var fs=require('fs');var fs_extra=require(_0xe6b3('0x9'));var _=require('lodash');var squel=require(_0xe6b3('0xa'));var crypto=require(_0xe6b3('0xb'));var jsforce=require(_0xe6b3('0xc'));var deskjs=require(_0xe6b3('0xd'));var toCsv=require(_0xe6b3('0xe'));var querystring=require(_0xe6b3('0xf'));var Papa=require(_0xe6b3('0x10'));var Redis=require('ioredis');var authService=require(_0xe6b3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe6b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe6b3('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9950,_0x44d2cd){_0x44d2cd=_0x44d2cd||0xcc;return function(_0x3970b0){if(_0x3970b0){return _0x3d9950[_0xe6b3('0x14')](_0x44d2cd);}return _0x3d9950[_0xe6b3('0x15')](_0x44d2cd)[_0xe6b3('0x16')]();};}function respondWithResult(_0xdeca9b,_0x4c13a0){_0x4c13a0=_0x4c13a0||0xc8;return function(_0xe6a34e){if(_0xe6a34e){return _0xdeca9b[_0xe6b3('0x15')](_0x4c13a0)[_0xe6b3('0x17')](_0xe6a34e);}};}function respondWithFilteredResult(_0x27560c,_0x546227){return function(_0x3dd960){if(_0x3dd960){var _0x46952c=typeof _0x546227[_0xe6b3('0x18')]==='undefined'&&typeof _0x546227['limit']===_0xe6b3('0x19');var _0x33d0bd=_0x3dd960[_0xe6b3('0x1a')];var _0x4cc5a6=_0x46952c?0x0:_0x546227['offset'];var _0x26e944=_0x46952c?_0x3dd960[_0xe6b3('0x1a')]:_0x546227[_0xe6b3('0x18')]+_0x546227[_0xe6b3('0x1b')];var _0x18becb;if(_0x26e944>=_0x33d0bd){_0x26e944=_0x33d0bd;_0x18becb=0xc8;}else{_0x18becb=0xce;}_0x27560c[_0xe6b3('0x15')](_0x18becb);return _0x27560c[_0xe6b3('0x1c')]('Content-Range',_0x4cc5a6+'-'+_0x26e944+'/'+_0x33d0bd)[_0xe6b3('0x17')](_0x3dd960);}return null;};}function patchUpdates(_0xe1cc3a){return function(_0xd63729){try{jsonpatch[_0xe6b3('0x1d')](_0xd63729,_0xe1cc3a,!![]);}catch(_0xc9cb5c){return BPromise['reject'](_0xc9cb5c);}return _0xd63729[_0xe6b3('0x1e')]();};}function saveUpdates(_0x326c00,_0x2e637c){return function(_0x5d4c12){if(_0x5d4c12){return _0x5d4c12[_0xe6b3('0x1f')](_0x326c00)[_0xe6b3('0x20')](function(_0x4c7b35){return _0x4c7b35;});}return null;};}function removeEntity(_0x8132b0,_0x4bb8c2){return function(_0x1fecf0){if(_0x1fecf0){return _0x1fecf0['destroy']()['then'](function(){_0x8132b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x261573,_0xb44607){return function(_0x598c9c){if(!_0x598c9c){_0x261573[_0xe6b3('0x14')](0x194);}return _0x598c9c;};}function handleError(_0x37c925,_0x3b4359){_0x3b4359=_0x3b4359||0x1f4;return function(_0x42f410){logger['error'](_0x42f410['stack']);if(_0x42f410[_0xe6b3('0x21')]){delete _0x42f410[_0xe6b3('0x21')];}_0x37c925[_0xe6b3('0x15')](_0x3b4359)[_0xe6b3('0x22')](_0x42f410);};}exports[_0xe6b3('0x23')]=function(_0x5209ab,_0x5cfc28){var _0xbeef7c={},_0xa8a699={},_0x21575d={'count':0x0,'rows':[]};var _0x568886=_[_0xe6b3('0x24')](db[_0xe6b3('0x25')]['rawAttributes'],function(_0x4aa3be){return{'name':_0x4aa3be[_0xe6b3('0x26')],'type':_0x4aa3be[_0xe6b3('0x27')][_0xe6b3('0x28')]};});_0xa8a699[_0xe6b3('0x29')]=_[_0xe6b3('0x24')](_0x568886,'name');_0xa8a699[_0xe6b3('0x2a')]=_[_0xe6b3('0x2b')](_0x5209ab[_0xe6b3('0x2a')]);_0xa8a699['filters']=_[_0xe6b3('0x2c')](_0xa8a699[_0xe6b3('0x29')],_0xa8a699[_0xe6b3('0x2a')]);_0xbeef7c[_0xe6b3('0x2d')]=_['intersection'](_0xa8a699[_0xe6b3('0x29')],qs['fields'](_0x5209ab['query'][_0xe6b3('0x2e')]));_0xbeef7c[_0xe6b3('0x2d')]=_0xbeef7c[_0xe6b3('0x2d')]['length']?_0xbeef7c[_0xe6b3('0x2d')]:_0xa8a699[_0xe6b3('0x29')];if(!_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x2f')]('nolimit')){_0xbeef7c['limit']=qs[_0xe6b3('0x1b')](_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x1b')]);_0xbeef7c[_0xe6b3('0x18')]=qs[_0xe6b3('0x18')](_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x18')]);}_0xbeef7c['order']=qs['sort'](_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x30')]);_0xbeef7c['where']=qs['filters'](_['pick'](_0x5209ab[_0xe6b3('0x2a')],_0xa8a699[_0xe6b3('0x31')]),_0x568886);if(_0x5209ab['query'][_0xe6b3('0x32')]){_0xbeef7c[_0xe6b3('0x33')]=_[_0xe6b3('0x34')](_0xbeef7c[_0xe6b3('0x33')],{'$or':_[_0xe6b3('0x24')](_0x568886,function(_0x360053){if(_0x360053['type']!==_0xe6b3('0x35')){var _0x2033d4={};_0x2033d4[_0x360053[_0xe6b3('0x21')]]={'$like':'%'+_0x5209ab[_0xe6b3('0x2a')][_0xe6b3('0x32')]+'%'};return _0x2033d4;}})});}_0xbeef7c=_[_0xe6b3('0x34')]({},_0xbeef7c,_0x5209ab[_0xe6b3('0x36')]);var _0x438eae={'where':_0xbeef7c[_0xe6b3('0x33')]};return db[_0xe6b3('0x25')][_0xe6b3('0x1a')](_0x438eae)[_0xe6b3('0x20')](function(_0x445769){_0x21575d[_0xe6b3('0x1a')]=_0x445769;if(_0x5209ab['query'][_0xe6b3('0x37')]){_0xbeef7c[_0xe6b3('0x38')]=[{'all':!![]}];}return db[_0xe6b3('0x25')][_0xe6b3('0x39')](_0xbeef7c);})[_0xe6b3('0x20')](function(_0xbbc0a0){_0x21575d[_0xe6b3('0x3a')]=_0xbbc0a0;return _0x21575d;})[_0xe6b3('0x20')](respondWithFilteredResult(_0x5cfc28,_0xbeef7c))[_0xe6b3('0x3b')](handleError(_0x5cfc28,null));};exports[_0xe6b3('0x3c')]=function(_0x51887c,_0x468acf){var _0x37839b={'raw':!![],'where':{'id':_0x51887c[_0xe6b3('0x3d')]['id']}},_0x558acc={};_0x558acc[_0xe6b3('0x29')]=_[_0xe6b3('0x2b')](db[_0xe6b3('0x25')][_0xe6b3('0x3e')]);_0x558acc[_0xe6b3('0x2a')]=_[_0xe6b3('0x2b')](_0x51887c[_0xe6b3('0x2a')]);_0x558acc['filters']=_[_0xe6b3('0x2c')](_0x558acc['model'],_0x558acc[_0xe6b3('0x2a')]);_0x37839b[_0xe6b3('0x2d')]=_[_0xe6b3('0x2c')](_0x558acc[_0xe6b3('0x29')],qs[_0xe6b3('0x2e')](_0x51887c[_0xe6b3('0x2a')][_0xe6b3('0x2e')]));_0x37839b[_0xe6b3('0x2d')]=_0x37839b[_0xe6b3('0x2d')][_0xe6b3('0x3f')]?_0x37839b[_0xe6b3('0x2d')]:_0x558acc[_0xe6b3('0x29')];if(_0x51887c[_0xe6b3('0x2a')][_0xe6b3('0x37')]){_0x37839b['include']=[{'all':!![]}];}_0x37839b=_['merge']({},_0x37839b,_0x51887c[_0xe6b3('0x36')]);return db[_0xe6b3('0x25')][_0xe6b3('0x40')](_0x37839b)[_0xe6b3('0x20')](handleEntityNotFound(_0x468acf,null))[_0xe6b3('0x20')](respondWithResult(_0x468acf,null))[_0xe6b3('0x3b')](handleError(_0x468acf,null));};exports[_0xe6b3('0x41')]=function(_0x34b691,_0x509cd1){return db[_0xe6b3('0x25')]['create'](_0x34b691[_0xe6b3('0x42')],{})[_0xe6b3('0x20')](respondWithResult(_0x509cd1,0xc9))[_0xe6b3('0x3b')](handleError(_0x509cd1,null));};exports['update']=function(_0x265691,_0x152fae){if(_0x265691[_0xe6b3('0x42')]['id']){delete _0x265691['body']['id'];}return db[_0xe6b3('0x25')][_0xe6b3('0x40')]({'where':{'id':_0x265691['params']['id']}})[_0xe6b3('0x20')](handleEntityNotFound(_0x152fae,null))[_0xe6b3('0x20')](saveUpdates(_0x265691[_0xe6b3('0x42')],null))[_0xe6b3('0x20')](respondWithResult(_0x152fae,null))[_0xe6b3('0x3b')](handleError(_0x152fae,null));};exports[_0xe6b3('0x43')]=function(_0x4d17aa,_0x48c120){return db['VtigerField'][_0xe6b3('0x40')]({'where':{'id':_0x4d17aa[_0xe6b3('0x3d')]['id']}})[_0xe6b3('0x20')](handleEntityNotFound(_0x48c120,null))['then'](removeEntity(_0x48c120,null))[_0xe6b3('0x3b')](handleError(_0x48c120,null));}; \ No newline at end of file +var _0x2ab0=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','map','VtigerField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x2ab0,0x138));var _0x02ab=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x2ab0[_0x4bb66f];return _0xf2772f;};'use strict';var emlformat=require(_0x02ab('0x0'));var rimraf=require(_0x02ab('0x1'));var zipdir=require(_0x02ab('0x2'));var jsonpatch=require(_0x02ab('0x3'));var rp=require('request-promise');var moment=require(_0x02ab('0x4'));var BPromise=require(_0x02ab('0x5'));var Mustache=require(_0x02ab('0x6'));var util=require(_0x02ab('0x7'));var path=require(_0x02ab('0x8'));var sox=require(_0x02ab('0x9'));var csv=require(_0x02ab('0xa'));var ejs=require(_0x02ab('0xb'));var fs=require('fs');var fs_extra=require(_0x02ab('0xc'));var _=require(_0x02ab('0xd'));var squel=require(_0x02ab('0xe'));var crypto=require(_0x02ab('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x02ab('0x10'));var toCsv=require(_0x02ab('0xa'));var querystring=require(_0x02ab('0x11'));var Papa=require(_0x02ab('0x12'));var Redis=require('ioredis');var authService=require(_0x02ab('0x13'));var qs=require(_0x02ab('0x14'));var as=require(_0x02ab('0x15'));var hardwareService=require(_0x02ab('0x16'));var logger=require(_0x02ab('0x17'))(_0x02ab('0x18'));var utils=require(_0x02ab('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x02ab('0x1a'))['db'];function respondWithStatusCode(_0x4106b4,_0x5b14fe){_0x5b14fe=_0x5b14fe||0xcc;return function(_0x5660bb){if(_0x5660bb){return _0x4106b4['sendStatus'](_0x5b14fe);}return _0x4106b4[_0x02ab('0x1b')](_0x5b14fe)[_0x02ab('0x1c')]();};}function respondWithResult(_0x7b1960,_0x1b82fd){_0x1b82fd=_0x1b82fd||0xc8;return function(_0x48f8a7){if(_0x48f8a7){return _0x7b1960[_0x02ab('0x1b')](_0x1b82fd)[_0x02ab('0x1d')](_0x48f8a7);}};}function respondWithFilteredResult(_0x393078,_0x146f07){return function(_0x46408c){if(_0x46408c){var _0x53813e=typeof _0x146f07[_0x02ab('0x1e')]===_0x02ab('0x1f')&&typeof _0x146f07[_0x02ab('0x20')]===_0x02ab('0x1f');var _0x58a035=_0x46408c[_0x02ab('0x21')];var _0x4ef6c9=_0x53813e?0x0:_0x146f07[_0x02ab('0x1e')];var _0xcd2a86=_0x53813e?_0x46408c[_0x02ab('0x21')]:_0x146f07[_0x02ab('0x1e')]+_0x146f07[_0x02ab('0x20')];var _0x5159a2;if(_0xcd2a86>=_0x58a035){_0xcd2a86=_0x58a035;_0x5159a2=0xc8;}else{_0x5159a2=0xce;}_0x393078[_0x02ab('0x1b')](_0x5159a2);return _0x393078[_0x02ab('0x22')](_0x02ab('0x23'),_0x4ef6c9+'-'+_0xcd2a86+'/'+_0x58a035)[_0x02ab('0x1d')](_0x46408c);}return null;};}function patchUpdates(_0x2f3d07){return function(_0x4fdfb4){try{jsonpatch[_0x02ab('0x24')](_0x4fdfb4,_0x2f3d07,!![]);}catch(_0xa1b74f){return BPromise[_0x02ab('0x25')](_0xa1b74f);}return _0x4fdfb4[_0x02ab('0x26')]();};}function saveUpdates(_0x4fc520,_0x449e25){return function(_0x1693d8){if(_0x1693d8){return _0x1693d8[_0x02ab('0x27')](_0x4fc520)[_0x02ab('0x28')](function(_0x477a57){return _0x477a57;});}return null;};}function removeEntity(_0x3463f5,_0x458430){return function(_0x1ed9d3){if(_0x1ed9d3){return _0x1ed9d3['destroy']()[_0x02ab('0x28')](function(){_0x3463f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f471c,_0x26405a){return function(_0x1f9fcd){if(!_0x1f9fcd){_0x2f471c['sendStatus'](0x194);}return _0x1f9fcd;};}function handleError(_0x2b1c5d,_0x4fd9f2){_0x4fd9f2=_0x4fd9f2||0x1f4;return function(_0xc55ff){logger[_0x02ab('0x29')](_0xc55ff[_0x02ab('0x2a')]);if(_0xc55ff['name']){delete _0xc55ff['name'];}_0x2b1c5d[_0x02ab('0x1b')](_0x4fd9f2)[_0x02ab('0x2b')](_0xc55ff);};}exports['index']=function(_0xb806fe,_0xc2ebe){var _0x9e2eff={},_0x4daf52={},_0x51816c={'count':0x0,'rows':[]};var _0x21c029=_[_0x02ab('0x2c')](db[_0x02ab('0x2d')][_0x02ab('0x2e')],function(_0x5d0d7d){return{'name':_0x5d0d7d[_0x02ab('0x2f')],'type':_0x5d0d7d[_0x02ab('0x30')][_0x02ab('0x31')]};});_0x4daf52[_0x02ab('0x32')]=_[_0x02ab('0x2c')](_0x21c029,_0x02ab('0x33'));_0x4daf52[_0x02ab('0x34')]=_[_0x02ab('0x35')](_0xb806fe[_0x02ab('0x34')]);_0x4daf52[_0x02ab('0x36')]=_[_0x02ab('0x37')](_0x4daf52['model'],_0x4daf52[_0x02ab('0x34')]);_0x9e2eff[_0x02ab('0x38')]=_[_0x02ab('0x37')](_0x4daf52[_0x02ab('0x32')],qs[_0x02ab('0x39')](_0xb806fe[_0x02ab('0x34')][_0x02ab('0x39')]));_0x9e2eff[_0x02ab('0x38')]=_0x9e2eff[_0x02ab('0x38')][_0x02ab('0x3a')]?_0x9e2eff['attributes']:_0x4daf52[_0x02ab('0x32')];if(!_0xb806fe[_0x02ab('0x34')]['hasOwnProperty'](_0x02ab('0x3b'))){_0x9e2eff[_0x02ab('0x20')]=qs['limit'](_0xb806fe[_0x02ab('0x34')][_0x02ab('0x20')]);_0x9e2eff[_0x02ab('0x1e')]=qs['offset'](_0xb806fe[_0x02ab('0x34')]['offset']);}_0x9e2eff['order']=qs[_0x02ab('0x3c')](_0xb806fe[_0x02ab('0x34')][_0x02ab('0x3c')]);_0x9e2eff[_0x02ab('0x3d')]=qs[_0x02ab('0x36')](_[_0x02ab('0x3e')](_0xb806fe['query'],_0x4daf52['filters']),_0x21c029);if(_0xb806fe[_0x02ab('0x34')][_0x02ab('0x3f')]){_0x9e2eff[_0x02ab('0x3d')]=_['merge'](_0x9e2eff[_0x02ab('0x3d')],{'$or':_['map'](_0x21c029,function(_0x4764b2){if(_0x4764b2['type']!==_0x02ab('0x40')){var _0x295ac2={};_0x295ac2[_0x4764b2[_0x02ab('0x33')]]={'$like':'%'+_0xb806fe[_0x02ab('0x34')][_0x02ab('0x3f')]+'%'};return _0x295ac2;}})});}_0x9e2eff=_[_0x02ab('0x41')]({},_0x9e2eff,_0xb806fe[_0x02ab('0x42')]);var _0x58c345={'where':_0x9e2eff[_0x02ab('0x3d')]};return db[_0x02ab('0x2d')][_0x02ab('0x21')](_0x58c345)[_0x02ab('0x28')](function(_0x217d26){_0x51816c['count']=_0x217d26;if(_0xb806fe[_0x02ab('0x34')]['includeAll']){_0x9e2eff[_0x02ab('0x43')]=[{'all':!![]}];}return db[_0x02ab('0x2d')][_0x02ab('0x44')](_0x9e2eff);})[_0x02ab('0x28')](function(_0x34fd3a){_0x51816c[_0x02ab('0x45')]=_0x34fd3a;return _0x51816c;})[_0x02ab('0x28')](respondWithFilteredResult(_0xc2ebe,_0x9e2eff))[_0x02ab('0x46')](handleError(_0xc2ebe,null));};exports[_0x02ab('0x47')]=function(_0x430c6b,_0xe37aaa){var _0x14dcd6={'raw':!![],'where':{'id':_0x430c6b['params']['id']}},_0x3cb61f={};_0x3cb61f[_0x02ab('0x32')]=_[_0x02ab('0x35')](db[_0x02ab('0x2d')][_0x02ab('0x2e')]);_0x3cb61f[_0x02ab('0x34')]=_[_0x02ab('0x35')](_0x430c6b[_0x02ab('0x34')]);_0x3cb61f['filters']=_[_0x02ab('0x37')](_0x3cb61f['model'],_0x3cb61f[_0x02ab('0x34')]);_0x14dcd6['attributes']=_[_0x02ab('0x37')](_0x3cb61f[_0x02ab('0x32')],qs[_0x02ab('0x39')](_0x430c6b['query'][_0x02ab('0x39')]));_0x14dcd6[_0x02ab('0x38')]=_0x14dcd6[_0x02ab('0x38')][_0x02ab('0x3a')]?_0x14dcd6[_0x02ab('0x38')]:_0x3cb61f[_0x02ab('0x32')];if(_0x430c6b[_0x02ab('0x34')][_0x02ab('0x48')]){_0x14dcd6[_0x02ab('0x43')]=[{'all':!![]}];}_0x14dcd6=_[_0x02ab('0x41')]({},_0x14dcd6,_0x430c6b[_0x02ab('0x42')]);return db['VtigerField'][_0x02ab('0x49')](_0x14dcd6)['then'](handleEntityNotFound(_0xe37aaa,null))['then'](respondWithResult(_0xe37aaa,null))['catch'](handleError(_0xe37aaa,null));};exports[_0x02ab('0x4a')]=function(_0x3f200b,_0x4b82b4){return db[_0x02ab('0x2d')]['create'](_0x3f200b[_0x02ab('0x4b')],{})[_0x02ab('0x28')](respondWithResult(_0x4b82b4,0xc9))[_0x02ab('0x46')](handleError(_0x4b82b4,null));};exports[_0x02ab('0x27')]=function(_0x50e443,_0x445cbc){if(_0x50e443[_0x02ab('0x4b')]['id']){delete _0x50e443['body']['id'];}return db[_0x02ab('0x2d')][_0x02ab('0x49')]({'where':{'id':_0x50e443[_0x02ab('0x4c')]['id']}})[_0x02ab('0x28')](handleEntityNotFound(_0x445cbc,null))[_0x02ab('0x28')](saveUpdates(_0x50e443['body'],null))[_0x02ab('0x28')](respondWithResult(_0x445cbc,null))[_0x02ab('0x46')](handleError(_0x445cbc,null));};exports[_0x02ab('0x4d')]=function(_0x4b1d77,_0x442996){return db[_0x02ab('0x2d')][_0x02ab('0x49')]({'where':{'id':_0x4b1d77[_0x02ab('0x4c')]['id']}})[_0x02ab('0x28')](handleEntityNotFound(_0x442996,null))['then'](removeEntity(_0x442996,null))[_0x02ab('0x46')](handleError(_0x442996,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 55bb5ff..4d1dfc2 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 _0xd4f1=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x8d9fd,_0x205365){var _0x29bb46=function(_0x46c4b2){while(--_0x46c4b2){_0x8d9fd['push'](_0x8d9fd['shift']());}};_0x29bb46(++_0x205365);}(_0xd4f1,0xf0));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d4f('0x0'));var util=require(_0x1d4f('0x1'));var logger=require(_0x1d4f('0x2'))(_0x1d4f('0x3'));var moment=require(_0x1d4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4f('0x5'));var fs=require('fs');var path=require(_0x1d4f('0x6'));var rimraf=require(_0x1d4f('0x7'));var config=require('../../config/environment');var attributes=require(_0x1d4f('0x8'));module[_0x1d4f('0x9')]=function(_0x1a2986,_0x41b925){return _0x1a2986[_0x1d4f('0xa')](_0x1d4f('0xb'),attributes,{'tableName':_0x1d4f('0xc'),'paranoid':![],'indexes':[{'name':_0x1d4f('0xd'),'fields':[_0x1d4f('0xe'),_0x1d4f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc520=['moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','api'];(function(_0x23b36e,_0x5899e6){var _0xe8c2c5=function(_0x31260d){while(--_0x31260d){_0x23b36e['push'](_0x23b36e['shift']());}};_0xe8c2c5(++_0x5899e6);}(_0xc520,0xa2));var _0x0c52=function(_0x1577db,_0x3ba4c7){_0x1577db=_0x1577db-0x0;var _0x117aac=_0xc520[_0x1577db];return _0x117aac;};'use strict';var _=require(_0x0c52('0x0'));var util=require(_0x0c52('0x1'));var logger=require('../../config/logger')(_0x0c52('0x2'));var moment=require(_0x0c52('0x3'));var BPromise=require(_0x0c52('0x4'));var rp=require(_0x0c52('0x5'));var fs=require('fs');var path=require(_0x0c52('0x6'));var rimraf=require('rimraf');var config=require(_0x0c52('0x7'));var attributes=require(_0x0c52('0x8'));module['exports']=function(_0x1fa09a,_0x27d993){return _0x1fa09a[_0x0c52('0x9')](_0x0c52('0xa'),attributes,{'tableName':_0x0c52('0xb'),'paranoid':![],'indexes':[{'name':_0x0c52('0xc'),'fields':[_0x0c52('0xd'),_0x0c52('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 beefd44..d42797d 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 _0x23d7=['rpc','../../config/environment','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x23d7,0x1dc));var _0x723d=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x23d7[_0x57408b];return _0x31a897;};'use strict';var _=require(_0x723d('0x0'));var util=require(_0x723d('0x1'));var moment=require(_0x723d('0x2'));var BPromise=require('bluebird');var rs=require(_0x723d('0x3'));var fs=require('fs');var Redis=require(_0x723d('0x4'));var db=require(_0x723d('0x5'))['db'];var utils=require(_0x723d('0x6'));var logger=require(_0x723d('0x7'))(_0x723d('0x8'));var config=require(_0x723d('0x9'));var jayson=require(_0x723d('0xa'));var client=jayson[_0x723d('0xb')][_0x723d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15b654,_0x4f7416,_0x3dd0b1){return new BPromise(function(_0x83b603,_0x44f6f2){return client['request'](_0x15b654,_0x3dd0b1)['then'](function(_0x1e5052){logger[_0x723d('0xd')](_0x723d('0xe'),_0x4f7416,_0x723d('0xf'));logger[_0x723d('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4f7416,_0x723d('0xf'),JSON[_0x723d('0x11')](_0x1e5052));if(_0x1e5052[_0x723d('0x12')]){if(_0x1e5052[_0x723d('0x12')]['code']===0x1f4){logger[_0x723d('0x12')]('VtigerField,\x20%s,\x20%s',_0x4f7416,_0x1e5052[_0x723d('0x12')]['message']);return _0x44f6f2(_0x1e5052['error'][_0x723d('0x13')]);}logger[_0x723d('0x12')]('VtigerField,\x20%s,\x20%s',_0x4f7416,_0x1e5052[_0x723d('0x12')][_0x723d('0x13')]);return _0x83b603(_0x1e5052[_0x723d('0x12')][_0x723d('0x13')]);}else{logger[_0x723d('0xd')](_0x723d('0xe'),_0x4f7416,_0x723d('0xf'));_0x83b603(_0x1e5052[_0x723d('0x14')][_0x723d('0x13')]);}})[_0x723d('0x15')](function(_0x2b9b54){logger['error'](_0x723d('0xe'),_0x4f7416,_0x2b9b54);_0x44f6f2(_0x2b9b54);});});} \ No newline at end of file +var _0xfa25=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45c035,_0x2333f1){var _0x14e3af=function(_0x3ba2b4){while(--_0x3ba2b4){_0x45c035['push'](_0x45c035['shift']());}};_0x14e3af(++_0x2333f1);}(_0xfa25,0xb9));var _0x5fa2=function(_0x4c9e55,_0x4d31f1){_0x4c9e55=_0x4c9e55-0x0;var _0x435f65=_0xfa25[_0x4c9e55];return _0x435f65;};'use strict';var _=require(_0x5fa2('0x0'));var util=require(_0x5fa2('0x1'));var moment=require(_0x5fa2('0x2'));var BPromise=require(_0x5fa2('0x3'));var rs=require(_0x5fa2('0x4'));var fs=require('fs');var Redis=require(_0x5fa2('0x5'));var db=require(_0x5fa2('0x6'))['db'];var utils=require(_0x5fa2('0x7'));var logger=require(_0x5fa2('0x8'))(_0x5fa2('0x9'));var config=require('../../config/environment');var jayson=require(_0x5fa2('0xa'));var client=jayson['client'][_0x5fa2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x327bf7,_0x48ace8,_0x3ea713){return new BPromise(function(_0x48acad,_0x3512ba){return client[_0x5fa2('0xc')](_0x327bf7,_0x3ea713)[_0x5fa2('0xd')](function(_0x202eed){logger['info'](_0x5fa2('0xe'),_0x48ace8,'request\x20sent');logger[_0x5fa2('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x48ace8,_0x5fa2('0x10'),JSON[_0x5fa2('0x11')](_0x202eed));if(_0x202eed[_0x5fa2('0x12')]){if(_0x202eed[_0x5fa2('0x12')][_0x5fa2('0x13')]===0x1f4){logger[_0x5fa2('0x12')](_0x5fa2('0xe'),_0x48ace8,_0x202eed[_0x5fa2('0x12')]['message']);return _0x3512ba(_0x202eed[_0x5fa2('0x12')][_0x5fa2('0x14')]);}logger[_0x5fa2('0x12')](_0x5fa2('0xe'),_0x48ace8,_0x202eed['error'][_0x5fa2('0x14')]);return _0x48acad(_0x202eed['error'][_0x5fa2('0x14')]);}else{logger[_0x5fa2('0x15')]('VtigerField,\x20%s,\x20%s',_0x48ace8,_0x5fa2('0x10'));_0x48acad(_0x202eed[_0x5fa2('0x16')]['message']);}})[_0x5fa2('0x17')](function(_0x173179){logger[_0x5fa2('0x12')](_0x5fa2('0xe'),_0x48ace8,_0x173179);_0x3512ba(_0x173179);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5e2d155..4c5d04a 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 _0xc96a=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','getConfigurations','getFields','create','post','put','/:id','update','destroy','exports'];(function(_0x5676dd,_0x57febd){var _0x4c711b=function(_0x577161){while(--_0x577161){_0x5676dd['push'](_0x5676dd['shift']());}};_0x4c711b(++_0x57febd);}(_0xc96a,0x14a));var _0xac96=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xc96a[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xac96('0x0'));var util=require(_0xac96('0x1'));var path=require(_0xac96('0x2'));var timeout=require(_0xac96('0x3'));var express=require(_0xac96('0x4'));var router=express['Router']();var fs_extra=require(_0xac96('0x5'));var auth=require(_0xac96('0x6'));var interaction=require(_0xac96('0x7'));var config=require(_0xac96('0x8'));var controller=require('./intZendeskAccount.controller');router[_0xac96('0x9')]('/',auth['isAuthenticated'](),controller[_0xac96('0xa')]);router[_0xac96('0x9')]('/:id',auth[_0xac96('0xb')](),controller[_0xac96('0xc')]);router[_0xac96('0x9')]('/:id/configurations',auth[_0xac96('0xb')](),controller[_0xac96('0xd')]);router['get']('/:id/fields',auth[_0xac96('0xb')](),controller[_0xac96('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac96('0xf')]);router[_0xac96('0x10')]('/:id/configurations',auth[_0xac96('0xb')](),controller['addConfiguration']);router[_0xac96('0x11')](_0xac96('0x12'),auth[_0xac96('0xb')](),controller[_0xac96('0x13')]);router['delete']('/:id',auth[_0xac96('0xb')](),controller[_0xac96('0x14')]);module[_0xac96('0x15')]=router; \ No newline at end of file +var _0x4753=['Router','../../components/auth/service','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x15106b,_0x4d96f6){var _0x521203=function(_0x4dbe23){while(--_0x4dbe23){_0x15106b['push'](_0x15106b['shift']());}};_0x521203(++_0x4d96f6);}(_0x4753,0x1f4));var _0x3475=function(_0xcea93f,_0x2df052){_0xcea93f=_0xcea93f-0x0;var _0xc7795c=_0x4753[_0xcea93f];return _0xc7795c;};'use strict';var multer=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var path=require(_0x3475('0x2'));var timeout=require('connect-timeout');var express=require(_0x3475('0x3'));var router=express[_0x3475('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3475('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x3475('0x6')](),controller[_0x3475('0x7')]);router['get'](_0x3475('0x8'),auth[_0x3475('0x6')](),controller[_0x3475('0x9')]);router[_0x3475('0xa')](_0x3475('0xb'),auth[_0x3475('0x6')](),controller[_0x3475('0xc')]);router[_0x3475('0xa')](_0x3475('0xd'),auth[_0x3475('0x6')](),controller['getFields']);router[_0x3475('0xe')]('/',auth[_0x3475('0x6')](),controller[_0x3475('0xf')]);router['post'](_0x3475('0xb'),auth[_0x3475('0x6')](),controller['addConfiguration']);router[_0x3475('0x10')]('/:id',auth[_0x3475('0x6')](),controller[_0x3475('0x11')]);router[_0x3475('0x12')]('/:id',auth[_0x3475('0x6')](),controller[_0x3475('0x13')]);module[_0x3475('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 7f29b07..f06e618 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 _0x524e=['STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x412f5b,_0x259457){var _0x46ca14=function(_0x4cd676){while(--_0x4cd676){_0x412f5b['push'](_0x412f5b['shift']());}};_0x46ca14(++_0x259457);}(_0x524e,0x15e));var _0xe524=function(_0x18a792,_0xfb7505){_0x18a792=_0x18a792-0x0;var _0x26f877=_0x524e[_0x18a792];return _0x26f877;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'password':{'type':Sequelize[_0xe524('0x0')]},'token':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'authType':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4'),'token'),'defaultValue':_0xe524('0x4')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x3')]('integrationTab',_0xe524('0x5')),'defaultValue':_0xe524('0x6')}}; \ No newline at end of file +var _0xee2c=['STRING','username','remoteUri','password','token','ENUM','integrationTab','sequelize'];(function(_0x4c62ce,_0x18e255){var _0x388297=function(_0x4aadfc){while(--_0x4aadfc){_0x4c62ce['push'](_0x4c62ce['shift']());}};_0x388297(++_0x18e255);}(_0xee2c,0x1c7));var _0xcee2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xee2c[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xcee2('0x0'));module['exports']={'name':{'type':Sequelize[_0xcee2('0x1')]},'description':{'type':Sequelize[_0xcee2('0x1')]},'username':{'type':Sequelize[_0xcee2('0x1')],'unique':_0xcee2('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcee2('0x1')],'unique':_0xcee2('0x3')},'authType':{'type':Sequelize['ENUM'](_0xcee2('0x4'),_0xcee2('0x5')),'defaultValue':_0xcee2('0x4')},'serverUrl':{'type':Sequelize[_0xcee2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcee2('0x6')]('integrationTab','newTab'),'defaultValue':_0xcee2('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8bcb6ad..7c98288 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 _0x3de3=['token','%s/token:%s','base64','ValidationError','subject','description','assignee','includes','position','title','system_field_options','statusCode','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','status','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','body','find','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Descriptions','channel','ZendeskField','Subjects','getFields','findOne','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','headers','%s:%s','toString'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0x3de3,0x1ce));var _0x33de=function(_0x26479e,_0xfdd13f){_0x26479e=_0x26479e-0x0;var _0x26fa40=_0x3de3[_0x26479e];return _0x26fa40;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];var integrations=require(_0x33de('0x19'));function respondWithStatusCode(_0x5170ad,_0x6b1a4c){_0x6b1a4c=_0x6b1a4c||0xcc;return function(_0x25d069){if(_0x25d069){return _0x5170ad['sendStatus'](_0x6b1a4c);}return _0x5170ad['status'](_0x6b1a4c)[_0x33de('0x1a')]();};}function respondWithResult(_0x22bda8,_0x2b3748){_0x2b3748=_0x2b3748||0xc8;return function(_0x57a2a1){if(_0x57a2a1){return _0x22bda8['status'](_0x2b3748)[_0x33de('0x1b')](_0x57a2a1);}};}function respondWithFilteredResult(_0x1b1166,_0x522ba0){return function(_0x4ff69f){if(_0x4ff69f){var _0x185849=typeof _0x522ba0[_0x33de('0x1c')]===_0x33de('0x1d')&&typeof _0x522ba0['limit']===_0x33de('0x1d');var _0x1203cf=_0x4ff69f['count'];var _0x2815a7=_0x185849?0x0:_0x522ba0[_0x33de('0x1c')];var _0x482667=_0x185849?_0x4ff69f['count']:_0x522ba0[_0x33de('0x1c')]+_0x522ba0['limit'];var _0x16255f;if(_0x482667>=_0x1203cf){_0x482667=_0x1203cf;_0x16255f=0xc8;}else{_0x16255f=0xce;}_0x1b1166[_0x33de('0x1e')](_0x16255f);return _0x1b1166[_0x33de('0x1f')](_0x33de('0x20'),_0x2815a7+'-'+_0x482667+'/'+_0x1203cf)[_0x33de('0x1b')](_0x4ff69f);}return null;};}function patchUpdates(_0x40a8e6){return function(_0x6cdc4f){try{jsonpatch['apply'](_0x6cdc4f,_0x40a8e6,!![]);}catch(_0x571086){return BPromise[_0x33de('0x21')](_0x571086);}return _0x6cdc4f['save']();};}function saveUpdates(_0x8acd8d,_0x4cd8db){return function(_0x28ed17){if(_0x28ed17){return _0x28ed17[_0x33de('0x22')](_0x8acd8d)['then'](function(_0x2dbcf2){return _0x2dbcf2;});}return null;};}function removeEntity(_0x5cd77e,_0x67d040){return function(_0x5c602d){if(_0x5c602d){return _0x5c602d[_0x33de('0x23')]()[_0x33de('0x24')](function(){_0x5cd77e[_0x33de('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdba4,_0x2d206b){return function(_0x140979){if(!_0x140979){_0x3bdba4['sendStatus'](0x194);}return _0x140979;};}function handleError(_0x34fba3,_0x5585a2){_0x5585a2=_0x5585a2||0x1f4;return function(_0x566373){logger[_0x33de('0x25')](_0x566373[_0x33de('0x26')]);if(_0x566373[_0x33de('0x27')]){delete _0x566373[_0x33de('0x27')];}_0x34fba3[_0x33de('0x1e')](_0x5585a2)[_0x33de('0x28')](_0x566373);};}exports[_0x33de('0x29')]=function(_0x1b4703,_0x59bc3b){var _0x5ae0e8={},_0x2755e6={},_0x1420d2={'count':0x0,'rows':[]};var _0xaeaec5=_[_0x33de('0x2a')](db[_0x33de('0x2b')][_0x33de('0x2c')],function(_0x427e82){return{'name':_0x427e82['fieldName'],'type':_0x427e82[_0x33de('0x2d')][_0x33de('0x2e')]};});_0x2755e6[_0x33de('0x2f')]=_[_0x33de('0x2a')](_0xaeaec5,'name');_0x2755e6[_0x33de('0x30')]=_[_0x33de('0x31')](_0x1b4703['query']);_0x2755e6['filters']=_['intersection'](_0x2755e6[_0x33de('0x2f')],_0x2755e6[_0x33de('0x30')]);_0x5ae0e8['attributes']=_[_0x33de('0x32')](_0x2755e6['model'],qs['fields'](_0x1b4703[_0x33de('0x30')][_0x33de('0x33')]));_0x5ae0e8[_0x33de('0x34')]=_0x5ae0e8[_0x33de('0x34')][_0x33de('0x35')]?_0x5ae0e8[_0x33de('0x34')]:_0x2755e6[_0x33de('0x2f')];if(!_0x1b4703[_0x33de('0x30')]['hasOwnProperty'](_0x33de('0x36'))){_0x5ae0e8['limit']=qs[_0x33de('0x37')](_0x1b4703['query']['limit']);_0x5ae0e8[_0x33de('0x1c')]=qs[_0x33de('0x1c')](_0x1b4703[_0x33de('0x30')][_0x33de('0x1c')]);}_0x5ae0e8[_0x33de('0x38')]=qs[_0x33de('0x39')](_0x1b4703['query'][_0x33de('0x39')]);_0x5ae0e8[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_[_0x33de('0x3c')](_0x1b4703[_0x33de('0x30')],_0x2755e6[_0x33de('0x3b')]),_0xaeaec5);if(_0x1b4703[_0x33de('0x30')]['filter']){_0x5ae0e8[_0x33de('0x3a')]=_[_0x33de('0x3d')](_0x5ae0e8[_0x33de('0x3a')],{'$or':_[_0x33de('0x2a')](_0xaeaec5,function(_0x46ddfe){if(_0x46ddfe[_0x33de('0x2d')]!==_0x33de('0x3e')){var _0x511691={};_0x511691[_0x46ddfe[_0x33de('0x27')]]={'$like':'%'+_0x1b4703[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x511691;}})});}_0x5ae0e8=_[_0x33de('0x3d')]({},_0x5ae0e8,_0x1b4703[_0x33de('0x40')]);var _0x640136={'where':_0x5ae0e8['where']};return db[_0x33de('0x2b')]['count'](_0x640136)[_0x33de('0x24')](function(_0x66897c){_0x1420d2['count']=_0x66897c;if(_0x1b4703[_0x33de('0x30')][_0x33de('0x41')]){_0x5ae0e8[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2b')][_0x33de('0x43')](_0x5ae0e8);})[_0x33de('0x24')](function(_0x22518d){_0x1420d2[_0x33de('0x44')]=_0x22518d;return _0x1420d2;})[_0x33de('0x24')](respondWithFilteredResult(_0x59bc3b,_0x5ae0e8))['catch'](handleError(_0x59bc3b,null));};exports['show']=function(_0x417d9b,_0x1f75f7){var _0x20d04f={'raw':![],'where':{'id':_0x417d9b['params']['id']}},_0x376c55={};_0x376c55[_0x33de('0x2f')]=_['keys'](db['ZendeskAccount'][_0x33de('0x2c')]);_0x376c55[_0x33de('0x30')]=_[_0x33de('0x31')](_0x417d9b[_0x33de('0x30')]);_0x376c55[_0x33de('0x3b')]=_[_0x33de('0x32')](_0x376c55[_0x33de('0x2f')],_0x376c55['query']);_0x20d04f[_0x33de('0x34')]=_['intersection'](_0x376c55[_0x33de('0x2f')],qs['fields'](_0x417d9b[_0x33de('0x30')][_0x33de('0x33')]));_0x20d04f['attributes']=_0x20d04f[_0x33de('0x34')][_0x33de('0x35')]?_0x20d04f[_0x33de('0x34')]:_0x376c55['model'];if(_0x417d9b['query'][_0x33de('0x41')]){_0x20d04f[_0x33de('0x42')]=[{'all':!![]}];}_0x20d04f=_['merge']({},_0x20d04f,_0x417d9b['options']);return db[_0x33de('0x2b')]['find'](_0x20d04f)['then'](handleEntityNotFound(_0x1f75f7,null))['then'](respondWithResult(_0x1f75f7,null))[_0x33de('0x45')](handleError(_0x1f75f7,null));};exports[_0x33de('0x46')]=function(_0x9a816c,_0xce6079){return db['ZendeskAccount']['create'](_0x9a816c[_0x33de('0x47')],{})[_0x33de('0x24')](respondWithResult(_0xce6079,0xc9))['catch'](handleError(_0xce6079,null));};exports[_0x33de('0x22')]=function(_0xc23633,_0x23a5e7){if(_0xc23633[_0x33de('0x47')]['id']){delete _0xc23633[_0x33de('0x47')]['id'];}return db['ZendeskAccount'][_0x33de('0x48')]({'where':{'id':_0xc23633[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x23a5e7,null))[_0x33de('0x24')](saveUpdates(_0xc23633[_0x33de('0x47')],null))[_0x33de('0x24')](respondWithResult(_0x23a5e7,null))[_0x33de('0x45')](handleError(_0x23a5e7,null));};exports[_0x33de('0x23')]=function(_0x40f1b7,_0x3d6424){return db[_0x33de('0x2b')][_0x33de('0x48')]({'where':{'id':_0x40f1b7[_0x33de('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d6424,null))[_0x33de('0x24')](removeEntity(_0x3d6424,null))[_0x33de('0x45')](handleError(_0x3d6424,null));};exports[_0x33de('0x4a')]=function(_0x464502,_0xe6d59,_0x3fe65d){var _0x5c91e7={};var _0x49e1d9={};var _0x109ec5;var _0x32042e;return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x464502[_0x33de('0x49')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xe6d59,null))[_0x33de('0x24')](function(_0x303f72){if(_0x303f72){_0x109ec5=_0x303f72;_0x49e1d9['model']=_['keys'](db[_0x33de('0x4b')][_0x33de('0x2c')]);_0x49e1d9[_0x33de('0x30')]=_[_0x33de('0x31')](_0x464502[_0x33de('0x30')]);_0x49e1d9['filters']=_['intersection'](_0x49e1d9[_0x33de('0x2f')],_0x49e1d9[_0x33de('0x30')]);_0x5c91e7[_0x33de('0x34')]=_[_0x33de('0x32')](_0x49e1d9[_0x33de('0x2f')],qs[_0x33de('0x33')](_0x464502[_0x33de('0x30')][_0x33de('0x33')]));_0x5c91e7[_0x33de('0x34')]=_0x5c91e7['attributes'][_0x33de('0x35')]?_0x5c91e7[_0x33de('0x34')]:_0x49e1d9[_0x33de('0x2f')];_0x5c91e7['order']=qs[_0x33de('0x39')](_0x464502['query']['sort']);_0x5c91e7['where']=qs['filters'](_[_0x33de('0x3c')](_0x464502[_0x33de('0x30')],_0x49e1d9['filters']));if(_0x464502[_0x33de('0x30')][_0x33de('0x3f')]){_0x5c91e7['where']=_[_0x33de('0x3d')](_0x5c91e7[_0x33de('0x3a')],{'$or':_['map'](_0x5c91e7[_0x33de('0x34')],function(_0x2bd687){var _0x277bb7={};_0x277bb7[_0x2bd687]={'$like':'%'+_0x464502[_0x33de('0x30')][_0x33de('0x3f')]+'%'};return _0x277bb7;})});}_0x5c91e7=_[_0x33de('0x3d')]({},_0x5c91e7,_0x464502[_0x33de('0x40')]);return _0x109ec5['getConfigurations'](_0x5c91e7);}})['then'](function(_0x409e2e){if(_0x409e2e){_0x32042e=_0x409e2e['length'];if(!_0x464502[_0x33de('0x30')][_0x33de('0x4c')]('nolimit')){_0x5c91e7[_0x33de('0x37')]=qs['limit'](_0x464502[_0x33de('0x30')][_0x33de('0x37')]);_0x5c91e7['offset']=qs['offset'](_0x464502[_0x33de('0x30')][_0x33de('0x1c')]);}return _0x109ec5[_0x33de('0x4a')](_0x5c91e7);}})[_0x33de('0x24')](function(_0x24d936){if(_0x24d936){return _0x24d936?{'count':_0x32042e,'rows':_0x24d936}:null;}})['then'](respondWithResult(_0xe6d59,null))[_0x33de('0x45')](handleError(_0xe6d59,null));};exports[_0x33de('0x4d')]=function(_0x5d4ffd,_0xa10291,_0x375bda){if(_0x5d4ffd['body']['id']){delete _0x5d4ffd[_0x33de('0x47')]['id'];}return db[_0x33de('0x2b')]['findOne']({'where':{'id':_0x5d4ffd['params']['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xa10291,null))['then'](function(_0x31a511){if(_0x31a511){_0x5d4ffd['body'][_0x33de('0x4e')]=_0x31a511['id'];_0x5d4ffd['body']['Subjects']=integrations['getSubjects'](_0x5d4ffd['body']['channel'],_0x5d4ffd['body'][_0x33de('0x2d')]);_0x5d4ffd['body'][_0x33de('0x4f')]=integrations['getDescriptions'](_0x5d4ffd['body'][_0x33de('0x50')],_0x5d4ffd[_0x33de('0x47')][_0x33de('0x2d')]);return db[_0x33de('0x4b')][_0x33de('0x46')](_0x5d4ffd[_0x33de('0x47')],{'include':[{'model':db[_0x33de('0x51')],'as':_0x33de('0x52')},{'model':db['ZendeskField'],'as':_0x33de('0x4f')}]});}return null;})['then'](respondWithResult(_0xa10291,null))[_0x33de('0x45')](handleError(_0xa10291,null));};exports[_0x33de('0x53')]=function(_0x2cbf20,_0x3a8d6b,_0x8a9729){var _0x3f5d52='';return db[_0x33de('0x2b')][_0x33de('0x54')]({'where':{'id':_0x2cbf20[_0x33de('0x49')]['id']},'attributes':['id',_0x33de('0x55'),_0x33de('0x56'),'token','authType',_0x33de('0x57')]})[_0x33de('0x24')](handleEntityNotFound(_0x3a8d6b,null))[_0x33de('0x24')](function(_0xbf482f){if(_0xbf482f){_0x3f5d52=_0xbf482f[_0x33de('0x57')];var _0x21a3ec=_0x3f5d52[_0x33de('0x58')](-0x1);if(_0x21a3ec==='/'){_0x3f5d52=_0x3f5d52[_0x33de('0x59')](0x0,_0x3f5d52[_0x33de('0x5a')](_0x21a3ec));}var _0x39e8c9={'method':'GET','uri':util[_0x33de('0x5b')](_0x33de('0x5c'),_0x3f5d52,_0x33de('0x5d')),'json':!![]};switch(_0xbf482f[_0x33de('0x5e')]){case _0x33de('0x56'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x60'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x56')]))[_0x33de('0x61')]('base64'))};break;case _0x33de('0x62'):_0x39e8c9[_0x33de('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x33de('0x63'),_0xbf482f[_0x33de('0x55')],_0xbf482f[_0x33de('0x62')]))[_0x33de('0x61')](_0x33de('0x64')))};break;default:throw new db['Sequelize'][(_0x33de('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x39e8c9);}})[_0x33de('0x24')](function(_0x20e8ce){if(_0x20e8ce){var _0x50587b=[_0x33de('0x66'),_0x33de('0x67'),'group',_0x33de('0x68')];_['remove'](_0x20e8ce['ticket_fields'],function(_0x2b6729){return _0x50587b[_0x33de('0x69')](_0x2b6729[_0x33de('0x2d')]);});return{'count':_0x20e8ce[_0x33de('0x5d')][_0x33de('0x35')],'rows':_['map'](_0x20e8ce[_0x33de('0x5d')],function(_0x3bda5e){return{'id':_0x3bda5e['id'],'name':_0x3bda5e[_0x33de('0x6a')]>0x7?_0x3bda5e[_0x33de('0x6b')]:_0x3bda5e['type'],'custom':_0x3bda5e[_0x33de('0x6a')]>0x7?!![]:![],'options':_0x3bda5e[_0x33de('0x6c')]?_0x3bda5e[_0x33de('0x6c')]:_0x3bda5e['custom_field_options']?_0x3bda5e['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3a8d6b,null))['catch'](function(_0x5769f7){var _0x1f0e87=_0x2cbf20[_0x33de('0x30')]['test']?0x1f4:_0x5769f7[_0x33de('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x33de('0x53'),_0x1f0e87,JSON[_0x33de('0x6e')](_0x5769f7));delete _0x5769f7['name'];if(_0x1f0e87===0x191){_0x1f0e87=0x190;}_0x3a8d6b[_0x33de('0x1e')](_0x1f0e87)[_0x33de('0x28')](_0x2cbf20['query'][_0x33de('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x5769f7[_0x33de('0x6d')]}:_0x5769f7);});}; \ No newline at end of file +var _0x0713=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','catch','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','toString','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ZendeskAccount'];(function(_0x3b7bcf,_0x6d8a7d){var _0x2feb9b=function(_0x2970f9){while(--_0x2970f9){_0x3b7bcf['push'](_0x3b7bcf['shift']());}};_0x2feb9b(++_0x6d8a7d);}(_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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5330a8,_0x1826ca){_0x1826ca=_0x1826ca||0xcc;return function(_0x5dc13b){if(_0x5dc13b){return _0x5330a8[_0x3071('0x1b')](_0x1826ca);}return _0x5330a8[_0x3071('0x1c')](_0x1826ca)['end']();};}function respondWithResult(_0x104e73,_0x4e1219){_0x4e1219=_0x4e1219||0xc8;return function(_0x2fc15d){if(_0x2fc15d){return _0x104e73[_0x3071('0x1c')](_0x4e1219)[_0x3071('0x1d')](_0x2fc15d);}};}function respondWithFilteredResult(_0x1f14e1,_0x1caa5d){return function(_0x2a6a4b){if(_0x2a6a4b){var _0x157a47=typeof _0x1caa5d[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1caa5d[_0x3071('0x20')]==='undefined';var _0x224996=_0x2a6a4b[_0x3071('0x21')];var _0x1068d9=_0x157a47?0x0:_0x1caa5d[_0x3071('0x1e')];var _0x3acf0e=_0x157a47?_0x2a6a4b[_0x3071('0x21')]:_0x1caa5d[_0x3071('0x1e')]+_0x1caa5d[_0x3071('0x20')];var _0x502a16;if(_0x3acf0e>=_0x224996){_0x3acf0e=_0x224996;_0x502a16=0xc8;}else{_0x502a16=0xce;}_0x1f14e1[_0x3071('0x1c')](_0x502a16);return _0x1f14e1[_0x3071('0x22')](_0x3071('0x23'),_0x1068d9+'-'+_0x3acf0e+'/'+_0x224996)['json'](_0x2a6a4b);}return null;};}function patchUpdates(_0xb8f4e3){return function(_0x5cd80d){try{jsonpatch[_0x3071('0x24')](_0x5cd80d,_0xb8f4e3,!![]);}catch(_0x43128c){return BPromise[_0x3071('0x25')](_0x43128c);}return _0x5cd80d[_0x3071('0x26')]();};}function saveUpdates(_0x33090c,_0x34c50e){return function(_0x3c5cef){if(_0x3c5cef){return _0x3c5cef[_0x3071('0x27')](_0x33090c)['then'](function(_0x481a51){return _0x481a51;});}return null;};}function removeEntity(_0x2ce48a,_0xb05b1d){return function(_0x412652){if(_0x412652){return _0x412652[_0x3071('0x28')]()[_0x3071('0x29')](function(){_0x2ce48a[_0x3071('0x1c')](0xcc)[_0x3071('0x2a')]();});}};}function handleEntityNotFound(_0x1fe727,_0x1de5fb){return function(_0x4c7130){if(!_0x4c7130){_0x1fe727[_0x3071('0x1b')](0x194);}return _0x4c7130;};}function handleError(_0x3f1e6e,_0x177138){_0x177138=_0x177138||0x1f4;return function(_0x4d5c4b){logger[_0x3071('0x2b')](_0x4d5c4b[_0x3071('0x2c')]);if(_0x4d5c4b[_0x3071('0x2d')]){delete _0x4d5c4b[_0x3071('0x2d')];}_0x3f1e6e[_0x3071('0x1c')](_0x177138)[_0x3071('0x2e')](_0x4d5c4b);};}exports[_0x3071('0x2f')]=function(_0x3921a1,_0x32f1b4){var _0x292205={},_0x254fc8={},_0x5aba96={'count':0x0,'rows':[]};var _0x4f1484=_[_0x3071('0x30')](db[_0x3071('0x31')][_0x3071('0x32')],function(_0x40be95){return{'name':_0x40be95[_0x3071('0x33')],'type':_0x40be95[_0x3071('0x34')][_0x3071('0x35')]};});_0x254fc8[_0x3071('0x36')]=_['map'](_0x4f1484,'name');_0x254fc8['query']=_[_0x3071('0x37')](_0x3921a1[_0x3071('0x38')]);_0x254fc8['filters']=_[_0x3071('0x39')](_0x254fc8[_0x3071('0x36')],_0x254fc8[_0x3071('0x38')]);_0x292205[_0x3071('0x3a')]=_['intersection'](_0x254fc8[_0x3071('0x36')],qs[_0x3071('0x3b')](_0x3921a1[_0x3071('0x38')][_0x3071('0x3b')]));_0x292205[_0x3071('0x3a')]=_0x292205[_0x3071('0x3a')][_0x3071('0x3c')]?_0x292205[_0x3071('0x3a')]:_0x254fc8['model'];if(!_0x3921a1[_0x3071('0x38')]['hasOwnProperty']('nolimit')){_0x292205[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x3921a1['query'][_0x3071('0x20')]);_0x292205[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x3921a1[_0x3071('0x38')][_0x3071('0x1e')]);}_0x292205[_0x3071('0x3d')]=qs['sort'](_0x3921a1[_0x3071('0x38')][_0x3071('0x3e')]);_0x292205['where']=qs[_0x3071('0x3f')](_['pick'](_0x3921a1[_0x3071('0x38')],_0x254fc8[_0x3071('0x3f')]),_0x4f1484);if(_0x3921a1['query']['filter']){_0x292205[_0x3071('0x40')]=_[_0x3071('0x41')](_0x292205[_0x3071('0x40')],{'$or':_['map'](_0x4f1484,function(_0x4dea69){if(_0x4dea69['type']!==_0x3071('0x42')){var _0x4b7928={};_0x4b7928[_0x4dea69[_0x3071('0x2d')]]={'$like':'%'+_0x3921a1[_0x3071('0x38')][_0x3071('0x43')]+'%'};return _0x4b7928;}})});}_0x292205=_[_0x3071('0x41')]({},_0x292205,_0x3921a1[_0x3071('0x44')]);var _0x593c9c={'where':_0x292205['where']};return db[_0x3071('0x31')][_0x3071('0x21')](_0x593c9c)[_0x3071('0x29')](function(_0x1f69a6){_0x5aba96['count']=_0x1f69a6;if(_0x3921a1[_0x3071('0x38')][_0x3071('0x45')]){_0x292205[_0x3071('0x46')]=[{'all':!![]}];}return db[_0x3071('0x31')][_0x3071('0x47')](_0x292205);})[_0x3071('0x29')](function(_0x56a9d8){_0x5aba96[_0x3071('0x48')]=_0x56a9d8;return _0x5aba96;})['then'](respondWithFilteredResult(_0x32f1b4,_0x292205))['catch'](handleError(_0x32f1b4,null));};exports['show']=function(_0x47ceaf,_0x2992e6){var _0x1be8b6={'raw':![],'where':{'id':_0x47ceaf[_0x3071('0x49')]['id']}},_0x67b2fb={};_0x67b2fb[_0x3071('0x36')]=_[_0x3071('0x37')](db[_0x3071('0x31')][_0x3071('0x32')]);_0x67b2fb['query']=_[_0x3071('0x37')](_0x47ceaf[_0x3071('0x38')]);_0x67b2fb[_0x3071('0x3f')]=_[_0x3071('0x39')](_0x67b2fb[_0x3071('0x36')],_0x67b2fb['query']);_0x1be8b6['attributes']=_[_0x3071('0x39')](_0x67b2fb[_0x3071('0x36')],qs[_0x3071('0x3b')](_0x47ceaf[_0x3071('0x38')][_0x3071('0x3b')]));_0x1be8b6['attributes']=_0x1be8b6[_0x3071('0x3a')]['length']?_0x1be8b6[_0x3071('0x3a')]:_0x67b2fb['model'];if(_0x47ceaf['query'][_0x3071('0x45')]){_0x1be8b6['include']=[{'all':!![]}];}_0x1be8b6=_[_0x3071('0x41')]({},_0x1be8b6,_0x47ceaf['options']);return db[_0x3071('0x31')][_0x3071('0x4a')](_0x1be8b6)[_0x3071('0x29')](handleEntityNotFound(_0x2992e6,null))[_0x3071('0x29')](respondWithResult(_0x2992e6,null))['catch'](handleError(_0x2992e6,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){return db['ZendeskAccount'][_0x3071('0x4b')](_0x575c12[_0x3071('0x4c')],{})['then'](respondWithResult(_0xd273ec,0xc9))[_0x3071('0x4d')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x224a70,_0x38bcc2){if(_0x224a70[_0x3071('0x4c')]['id']){delete _0x224a70[_0x3071('0x4c')]['id'];}return db[_0x3071('0x31')]['find']({'where':{'id':_0x224a70[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x38bcc2,null))[_0x3071('0x29')](saveUpdates(_0x224a70[_0x3071('0x4c')],null))['then'](respondWithResult(_0x38bcc2,null))[_0x3071('0x4d')](handleError(_0x38bcc2,null));};exports[_0x3071('0x28')]=function(_0x1b832e,_0x2307dd){return db[_0x3071('0x31')][_0x3071('0x4a')]({'where':{'id':_0x1b832e[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x2307dd,null))[_0x3071('0x29')](removeEntity(_0x2307dd,null))[_0x3071('0x4d')](handleError(_0x2307dd,null));};exports[_0x3071('0x4e')]=function(_0x111115,_0x24977b,_0x114f1f){var _0x1656de={};var _0x12be97={};var _0x596cdd;var _0x47a438;return db[_0x3071('0x31')]['findOne']({'where':{'id':_0x111115[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x24977b,null))[_0x3071('0x29')](function(_0x514821){if(_0x514821){_0x596cdd=_0x514821;_0x12be97[_0x3071('0x36')]=_[_0x3071('0x37')](db['ZendeskConfiguration']['rawAttributes']);_0x12be97[_0x3071('0x38')]=_[_0x3071('0x37')](_0x111115[_0x3071('0x38')]);_0x12be97[_0x3071('0x3f')]=_['intersection'](_0x12be97[_0x3071('0x36')],_0x12be97[_0x3071('0x38')]);_0x1656de[_0x3071('0x3a')]=_[_0x3071('0x39')](_0x12be97[_0x3071('0x36')],qs['fields'](_0x111115[_0x3071('0x38')][_0x3071('0x3b')]));_0x1656de[_0x3071('0x3a')]=_0x1656de[_0x3071('0x3a')][_0x3071('0x3c')]?_0x1656de[_0x3071('0x3a')]:_0x12be97[_0x3071('0x36')];_0x1656de['order']=qs['sort'](_0x111115[_0x3071('0x38')]['sort']);_0x1656de[_0x3071('0x40')]=qs[_0x3071('0x3f')](_['pick'](_0x111115[_0x3071('0x38')],_0x12be97[_0x3071('0x3f')]));if(_0x111115['query'][_0x3071('0x43')]){_0x1656de[_0x3071('0x40')]=_[_0x3071('0x41')](_0x1656de[_0x3071('0x40')],{'$or':_[_0x3071('0x30')](_0x1656de['attributes'],function(_0x327ef0){var _0x313a54={};_0x313a54[_0x327ef0]={'$like':'%'+_0x111115[_0x3071('0x38')]['filter']+'%'};return _0x313a54;})});}_0x1656de=_[_0x3071('0x41')]({},_0x1656de,_0x111115[_0x3071('0x44')]);return _0x596cdd[_0x3071('0x4e')](_0x1656de);}})[_0x3071('0x29')](function(_0x379723){if(_0x379723){_0x47a438=_0x379723[_0x3071('0x3c')];if(!_0x111115[_0x3071('0x38')][_0x3071('0x4f')](_0x3071('0x50'))){_0x1656de['limit']=qs[_0x3071('0x20')](_0x111115[_0x3071('0x38')][_0x3071('0x20')]);_0x1656de[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x111115[_0x3071('0x38')][_0x3071('0x1e')]);}return _0x596cdd[_0x3071('0x4e')](_0x1656de);}})[_0x3071('0x29')](function(_0x302680){if(_0x302680){return _0x302680?{'count':_0x47a438,'rows':_0x302680}:null;}})[_0x3071('0x29')](respondWithResult(_0x24977b,null))['catch'](handleError(_0x24977b,null));};exports[_0x3071('0x51')]=function(_0x315044,_0x279594,_0x3ed86c){if(_0x315044[_0x3071('0x4c')]['id']){delete _0x315044[_0x3071('0x4c')]['id'];}return db[_0x3071('0x31')][_0x3071('0x52')]({'where':{'id':_0x315044['params']['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x279594,null))[_0x3071('0x29')](function(_0x59ba87){if(_0x59ba87){_0x315044['body'][_0x3071('0x53')]=_0x59ba87['id'];_0x315044[_0x3071('0x4c')][_0x3071('0x54')]=integrations[_0x3071('0x55')](_0x315044['body']['channel'],_0x315044[_0x3071('0x4c')]['type']);_0x315044['body']['Descriptions']=integrations['getDescriptions'](_0x315044[_0x3071('0x4c')][_0x3071('0x56')],_0x315044[_0x3071('0x4c')]['type']);return db[_0x3071('0x57')][_0x3071('0x4b')](_0x315044[_0x3071('0x4c')],{'include':[{'model':db[_0x3071('0x58')],'as':'Subjects'},{'model':db[_0x3071('0x58')],'as':_0x3071('0x59')}]});}return null;})['then'](respondWithResult(_0x279594,null))[_0x3071('0x4d')](handleError(_0x279594,null));};exports[_0x3071('0x5a')]=function(_0x388cd1,_0x40c258,_0x4edd23){var _0x11ffdd='';return db[_0x3071('0x31')]['findOne']({'where':{'id':_0x388cd1['params']['id']},'attributes':['id',_0x3071('0x5b'),_0x3071('0x5c'),_0x3071('0x5d'),'authType','remoteUri']})[_0x3071('0x29')](handleEntityNotFound(_0x40c258,null))[_0x3071('0x29')](function(_0x3bad84){if(_0x3bad84){_0x11ffdd=_0x3bad84[_0x3071('0x5e')];var _0x2f1935=_0x11ffdd[_0x3071('0x5f')](-0x1);if(_0x2f1935==='/'){_0x11ffdd=_0x11ffdd[_0x3071('0x60')](0x0,_0x11ffdd[_0x3071('0x61')](_0x2f1935));}var _0x5eed64={'method':_0x3071('0x62'),'uri':util['format'](_0x3071('0x63'),_0x11ffdd,_0x3071('0x64')),'json':!![]};switch(_0x3bad84[_0x3071('0x65')]){case _0x3071('0x5c'):_0x5eed64[_0x3071('0x66')]={'Authorization':util[_0x3071('0x67')](_0x3071('0x68'),new Buffer(util[_0x3071('0x67')]('%s:%s',_0x3bad84[_0x3071('0x5b')],_0x3bad84[_0x3071('0x5c')]))[_0x3071('0x69')]('base64'))};break;case _0x3071('0x5d'):_0x5eed64[_0x3071('0x66')]={'Authorization':util[_0x3071('0x67')]('Basic\x20%s',new Buffer(util['format'](_0x3071('0x6a'),_0x3bad84['username'],_0x3bad84[_0x3071('0x5d')]))[_0x3071('0x69')](_0x3071('0x6b')))};break;default:throw new db[(_0x3071('0x6c'))][(_0x3071('0x6d'))](_0x3071('0x6e'));}return rp(_0x5eed64);}})[_0x3071('0x29')](function(_0x4c67ec){if(_0x4c67ec){var _0x1f2be3=[_0x3071('0x6f'),_0x3071('0x70'),_0x3071('0x71'),_0x3071('0x72')];_[_0x3071('0x73')](_0x4c67ec[_0x3071('0x64')],function(_0x277377){return _0x1f2be3['includes'](_0x277377[_0x3071('0x34')]);});return{'count':_0x4c67ec['ticket_fields'][_0x3071('0x3c')],'rows':_[_0x3071('0x30')](_0x4c67ec[_0x3071('0x64')],function(_0x45879b){return{'id':_0x45879b['id'],'name':_0x45879b[_0x3071('0x74')]>0x7?_0x45879b[_0x3071('0x75')]:_0x45879b[_0x3071('0x34')],'custom':_0x45879b[_0x3071('0x74')]>0x7?!![]:![],'options':_0x45879b[_0x3071('0x76')]?_0x45879b[_0x3071('0x76')]:_0x45879b['custom_field_options']?_0x45879b[_0x3071('0x77')]:[]};})};}})[_0x3071('0x29')](respondWithResult(_0x40c258,null))['catch'](function(_0x156826){var _0x3b7c95=_0x388cd1[_0x3071('0x38')][_0x3071('0x78')]?0x1f4:_0x156826[_0x3071('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3071('0x5a'),_0x3b7c95,JSON['stringify'](_0x156826));delete _0x156826[_0x3071('0x2d')];if(_0x3b7c95===0x191){_0x3b7c95=0x190;}_0x40c258[_0x3071('0x1c')](_0x3b7c95)[_0x3071('0x2e')](_0x388cd1[_0x3071('0x38')][_0x3071('0x78')]?{'message':_0x3071('0x7a'),'statusCode':_0x156826['statusCode']}:_0x156826);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 92ad07d..2ffc122 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 _0x6d20=['request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','util','api','moment','bluebird'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6d20,0x80));var _0x06d2=function(_0x32fb8d,_0x567a64){_0x32fb8d=_0x32fb8d-0x0;var _0x37cf13=_0x6d20[_0x32fb8d];return _0x37cf13;};'use strict';var _=require('lodash');var util=require(_0x06d2('0x0'));var logger=require('../../config/logger')(_0x06d2('0x1'));var moment=require(_0x06d2('0x2'));var BPromise=require(_0x06d2('0x3'));var rp=require(_0x06d2('0x4'));var fs=require('fs');var path=require(_0x06d2('0x5'));var rimraf=require(_0x06d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x06d2('0x7'));var integrations=require(_0x06d2('0x8'));module[_0x06d2('0x9')]=function(_0x153995,_0x589513){return _0x153995['define'](_0x06d2('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26f6=['util','../../config/logger','bluebird','rimraf','../../config/environment','define','lodash'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0x26f6,0x125));var _0x626f=function(_0x3969aa,_0x368c1c){_0x3969aa=_0x3969aa-0x0;var _0x125067=_0x26f6[_0x3969aa];return _0x125067;};'use strict';var _=require(_0x626f('0x0'));var util=require(_0x626f('0x1'));var logger=require(_0x626f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x626f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x626f('0x4'));var config=require(_0x626f('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x58845e,_0x1a726f){return _0x58845e[_0x626f('0x6')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','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 4849b41..b1c6921 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 _0x7613=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','ZendeskAccount','options','raw','limit','include','attributes','map','model','GetZendeskAccount','ShowZendeskAccount','find','where','lodash','moment','randomstring'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0x7613,0x190));var _0x3761=function(_0x390ef6,_0x1d401c){_0x390ef6=_0x390ef6-0x0;var _0x2fdaac=_0x7613[_0x390ef6];return _0x2fdaac;};'use strict';var _=require(_0x3761('0x0'));var util=require('util');var moment=require(_0x3761('0x1'));var BPromise=require('bluebird');var rs=require(_0x3761('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3761('0x3'))['db'];var utils=require(_0x3761('0x4'));var logger=require('../../config/logger')(_0x3761('0x5'));var config=require('../../config/environment');var jayson=require(_0x3761('0x6'));var client=jayson[_0x3761('0x7')][_0x3761('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x262c56,_0x482464,_0x17eabd){return new BPromise(function(_0x160f2f,_0x152652){return client[_0x3761('0x9')](_0x262c56,_0x17eabd)[_0x3761('0xa')](function(_0x1e530b){logger[_0x3761('0xb')](_0x3761('0xc'),_0x482464,_0x3761('0xd'));logger[_0x3761('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x482464,'request\x20sent',JSON['stringify'](_0x1e530b));if(_0x1e530b[_0x3761('0xf')]){if(_0x1e530b['error']['code']===0x1f4){logger[_0x3761('0xf')](_0x3761('0xc'),_0x482464,_0x1e530b['error'][_0x3761('0x10')]);return _0x152652(_0x1e530b[_0x3761('0xf')][_0x3761('0x10')]);}logger[_0x3761('0xf')](_0x3761('0xc'),_0x482464,_0x1e530b[_0x3761('0xf')][_0x3761('0x10')]);return _0x160f2f(_0x1e530b[_0x3761('0xf')][_0x3761('0x10')]);}else{logger[_0x3761('0xb')](_0x3761('0xc'),_0x482464,'request\x20sent');_0x160f2f(_0x1e530b[_0x3761('0x11')]['message']);}})[_0x3761('0x12')](function(_0x45b6be){logger[_0x3761('0xf')](_0x3761('0xc'),_0x482464,_0x45b6be);_0x152652(_0x45b6be);});});}exports['GetZendeskAccount']=function(_0x47b5c7){var _0x3c397e=this;return new Promise(function(_0x3d9a86,_0x2913e9){return db[_0x3761('0x13')]['findAll']({'raw':_0x47b5c7['options']?_0x47b5c7[_0x3761('0x14')][_0x3761('0x15')]===undefined?!![]:![]:!![],'where':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7[_0x3761('0x14')]['where']||null:null,'attributes':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7[_0x3761('0x14')]['attributes']||null:null,'limit':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7['options'][_0x3761('0x16')]||null:null,'include':_0x47b5c7[_0x3761('0x14')]?_0x47b5c7[_0x3761('0x14')][_0x3761('0x17')]?_['map'](_0x47b5c7[_0x3761('0x14')][_0x3761('0x17')],function(_0xb955d0){return{'model':db[_0xb955d0['model']],'as':_0xb955d0['as'],'attributes':_0xb955d0[_0x3761('0x18')],'include':_0xb955d0[_0x3761('0x17')]?_[_0x3761('0x19')](_0xb955d0[_0x3761('0x17')],function(_0x2f308a){return{'model':db[_0x2f308a[_0x3761('0x1a')]],'as':_0x2f308a['as'],'attributes':_0x2f308a[_0x3761('0x18')],'include':_0x2f308a[_0x3761('0x17')]?_[_0x3761('0x19')](_0x2f308a[_0x3761('0x17')],function(_0x1dca25){return{'model':db[_0x1dca25[_0x3761('0x1a')]],'as':_0x1dca25['as'],'attributes':_0x1dca25[_0x3761('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487abb){logger[_0x3761('0xb')](_0x3761('0x1b'),_0x47b5c7);logger[_0x3761('0xe')](_0x3761('0x1b'),_0x47b5c7,JSON['stringify'](_0x487abb));_0x3d9a86(_0x487abb);})[_0x3761('0x12')](function(_0x31f70e){logger['error'](_0x3761('0x1b'),_0x31f70e[_0x3761('0x10')],_0x47b5c7);_0x2913e9(_0x3c397e[_0x3761('0xf')](0x1f4,_0x31f70e['message']));});});};exports[_0x3761('0x1c')]=function(_0x104900){var _0x36261a=this;return new Promise(function(_0xaac26f,_0x228f07){return db[_0x3761('0x13')][_0x3761('0x1d')]({'raw':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x15')]===undefined?!![]:![]:!![],'where':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x1e')]||null:null,'attributes':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x18')]||null:null,'include':_0x104900[_0x3761('0x14')]?_0x104900[_0x3761('0x14')][_0x3761('0x17')]?_[_0x3761('0x19')](_0x104900['options'][_0x3761('0x17')],function(_0x329bd7){return{'model':db[_0x329bd7[_0x3761('0x1a')]],'as':_0x329bd7['as'],'attributes':_0x329bd7[_0x3761('0x18')],'include':_0x329bd7[_0x3761('0x17')]?_[_0x3761('0x19')](_0x329bd7[_0x3761('0x17')],function(_0x338923){return{'model':db[_0x338923['model']],'as':_0x338923['as'],'attributes':_0x338923['attributes'],'include':_0x338923[_0x3761('0x17')]?_[_0x3761('0x19')](_0x338923[_0x3761('0x17')],function(_0x39bd90){return{'model':db[_0x39bd90[_0x3761('0x1a')]],'as':_0x39bd90['as'],'attributes':_0x39bd90[_0x3761('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3761('0xa')](function(_0x2af75a){logger['info']('ShowZendeskAccount',_0x104900);logger[_0x3761('0xe')](_0x3761('0x1c'),_0x104900,JSON['stringify'](_0x2af75a));_0xaac26f(_0x2af75a);})[_0x3761('0x12')](function(_0x56100a){logger[_0x3761('0xf')]('ShowZendeskAccount',_0x56100a[_0x3761('0x10')],_0x104900);_0x228f07(_0x36261a['error'](0x1f4,_0x56100a[_0x3761('0x10')]));});});}; \ No newline at end of file +var _0xc17f=['ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','error','message','ZendeskAccount,\x20%s,\x20%s','info','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetZendeskAccount','debug','stringify','find'];(function(_0x1223bd,_0xcecb3a){var _0x8c7308=function(_0x296ece){while(--_0x296ece){_0x1223bd['push'](_0x1223bd['shift']());}};_0x8c7308(++_0xcecb3a);}(_0xc17f,0x155));var _0xfc17=function(_0x15f956,_0x4facae){_0x15f956=_0x15f956-0x0;var _0x52c33c=_0xc17f[_0x15f956];return _0x52c33c;};'use strict';var _=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var moment=require(_0xfc17('0x2'));var BPromise=require(_0xfc17('0x3'));var rs=require(_0xfc17('0x4'));var fs=require('fs');var Redis=require(_0xfc17('0x5'));var db=require(_0xfc17('0x6'))['db'];var utils=require(_0xfc17('0x7'));var logger=require(_0xfc17('0x8'))(_0xfc17('0x9'));var config=require(_0xfc17('0xa'));var jayson=require(_0xfc17('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec2ca,_0x1aa0ab,_0x58377b){return new BPromise(function(_0x1c6fb4,_0x2ac442){return client['request'](_0x4ec2ca,_0x58377b)[_0xfc17('0xc')](function(_0x1c60b8){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x1aa0ab,_0xfc17('0xd'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1aa0ab,_0xfc17('0xd'),JSON['stringify'](_0x1c60b8));if(_0x1c60b8[_0xfc17('0xe')]){if(_0x1c60b8[_0xfc17('0xe')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1aa0ab,_0x1c60b8['error'][_0xfc17('0xf')]);return _0x2ac442(_0x1c60b8['error'][_0xfc17('0xf')]);}logger[_0xfc17('0xe')](_0xfc17('0x10'),_0x1aa0ab,_0x1c60b8[_0xfc17('0xe')][_0xfc17('0xf')]);return _0x1c6fb4(_0x1c60b8[_0xfc17('0xe')][_0xfc17('0xf')]);}else{logger[_0xfc17('0x11')](_0xfc17('0x10'),_0x1aa0ab,_0xfc17('0xd'));_0x1c6fb4(_0x1c60b8[_0xfc17('0x12')][_0xfc17('0xf')]);}})[_0xfc17('0x13')](function(_0x22cc29){logger[_0xfc17('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x1aa0ab,_0x22cc29);_0x2ac442(_0x22cc29);});});}exports['GetZendeskAccount']=function(_0x43ef71){var _0xa8d78f=this;return new Promise(function(_0x26d258,_0x4ffac9){return db['ZendeskAccount'][_0xfc17('0x14')]({'raw':_0x43ef71[_0xfc17('0x15')]?_0x43ef71['options'][_0xfc17('0x16')]===undefined?!![]:![]:!![],'where':_0x43ef71[_0xfc17('0x15')]?_0x43ef71[_0xfc17('0x15')][_0xfc17('0x17')]||null:null,'attributes':_0x43ef71['options']?_0x43ef71[_0xfc17('0x15')]['attributes']||null:null,'limit':_0x43ef71[_0xfc17('0x15')]?_0x43ef71[_0xfc17('0x15')][_0xfc17('0x18')]||null:null,'include':_0x43ef71[_0xfc17('0x15')]?_0x43ef71['options'][_0xfc17('0x19')]?_[_0xfc17('0x1a')](_0x43ef71[_0xfc17('0x15')][_0xfc17('0x19')],function(_0x54459d){return{'model':db[_0x54459d[_0xfc17('0x1b')]],'as':_0x54459d['as'],'attributes':_0x54459d[_0xfc17('0x1c')],'include':_0x54459d[_0xfc17('0x19')]?_[_0xfc17('0x1a')](_0x54459d[_0xfc17('0x19')],function(_0x152d45){return{'model':db[_0x152d45[_0xfc17('0x1b')]],'as':_0x152d45['as'],'attributes':_0x152d45[_0xfc17('0x1c')],'include':_0x152d45['include']?_['map'](_0x152d45[_0xfc17('0x19')],function(_0x166556){return{'model':db[_0x166556[_0xfc17('0x1b')]],'as':_0x166556['as'],'attributes':_0x166556[_0xfc17('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4825c5){logger['info'](_0xfc17('0x1d'),_0x43ef71);logger[_0xfc17('0x1e')]('GetZendeskAccount',_0x43ef71,JSON[_0xfc17('0x1f')](_0x4825c5));_0x26d258(_0x4825c5);})['catch'](function(_0x16a220){logger[_0xfc17('0xe')](_0xfc17('0x1d'),_0x16a220['message'],_0x43ef71);_0x4ffac9(_0xa8d78f[_0xfc17('0xe')](0x1f4,_0x16a220['message']));});});};exports['ShowZendeskAccount']=function(_0x596fe2){var _0x172d2e=this;return new Promise(function(_0xcb130c,_0x18a2dc){return db['ZendeskAccount'][_0xfc17('0x20')]({'raw':_0x596fe2['options']?_0x596fe2['options'][_0xfc17('0x16')]===undefined?!![]:![]:!![],'where':_0x596fe2[_0xfc17('0x15')]?_0x596fe2[_0xfc17('0x15')][_0xfc17('0x17')]||null:null,'attributes':_0x596fe2[_0xfc17('0x15')]?_0x596fe2[_0xfc17('0x15')][_0xfc17('0x1c')]||null:null,'include':_0x596fe2['options']?_0x596fe2[_0xfc17('0x15')][_0xfc17('0x19')]?_['map'](_0x596fe2[_0xfc17('0x15')][_0xfc17('0x19')],function(_0x498cac){return{'model':db[_0x498cac[_0xfc17('0x1b')]],'as':_0x498cac['as'],'attributes':_0x498cac[_0xfc17('0x1c')],'include':_0x498cac[_0xfc17('0x19')]?_[_0xfc17('0x1a')](_0x498cac[_0xfc17('0x19')],function(_0x2a37a9){return{'model':db[_0x2a37a9[_0xfc17('0x1b')]],'as':_0x2a37a9['as'],'attributes':_0x2a37a9[_0xfc17('0x1c')],'include':_0x2a37a9[_0xfc17('0x19')]?_[_0xfc17('0x1a')](_0x2a37a9[_0xfc17('0x19')],function(_0x5929af){return{'model':db[_0x5929af['model']],'as':_0x5929af['as'],'attributes':_0x5929af[_0xfc17('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2403c0){logger[_0xfc17('0x11')](_0xfc17('0x21'),_0x596fe2);logger['debug'](_0xfc17('0x21'),_0x596fe2,JSON[_0xfc17('0x1f')](_0x2403c0));_0xcb130c(_0x2403c0);})[_0xfc17('0x13')](function(_0x52ae4c){logger[_0xfc17('0xe')]('ShowZendeskAccount',_0x52ae4c[_0xfc17('0xf')],_0x596fe2);_0x18a2dc(_0x172d2e[_0xfc17('0xe')](0x1f4,_0x52ae4c[_0xfc17('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 68e8025..a1cdd87 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x4217ee,_0x17b42b){var _0x4b6183=function(_0x223296){while(--_0x223296){_0x4217ee['push'](_0x4217ee['shift']());}};_0x4b6183(++_0x17b42b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x296a68,_0x21254f){var _0x138035=function(_0x696d87){while(--_0x696d87){_0x296a68['push'](_0x296a68['shift']());}};_0x138035(++_0x21254f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3ad3723..c50cc7e 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 _0x7777=['STRING'];(function(_0x3d328a,_0xf4dba5){var _0x50ba88=function(_0x233fdb){while(--_0x233fdb){_0x3d328a['push'](_0x3d328a['shift']());}};_0x50ba88(++_0xf4dba5);}(_0x7777,0x1ce));var _0x7777=function(_0x1eecf2,_0x5eddc2){_0x1eecf2=_0x1eecf2-0x0;var _0x3e3d86=_0x7777[_0x1eecf2];return _0x3e3d86;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7777('0x0')]}}; \ No newline at end of file +var _0x9162=['sequelize','exports','STRING'];(function(_0x5b11e0,_0x48afdf){var _0x40256b=function(_0x565609){while(--_0x565609){_0x5b11e0['push'](_0x5b11e0['shift']());}};_0x40256b(++_0x48afdf);}(_0x9162,0xf0));var _0x2916=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x9162[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x2916('0x0'));module[_0x2916('0x1')]={'name':{'type':Sequelize[_0x2916('0x2')]},'description':{'type':Sequelize[_0x2916('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a2066a3..2e702ea 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 _0x4539=['save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','ZendeskConfiguration','findAll','rows','show','catch','create','body','find','params','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0xf40d11,_0xb4dd63){var _0x2c21c8=function(_0x14a2cc){while(--_0x14a2cc){_0xf40d11['push'](_0xf40d11['shift']());}};_0x2c21c8(++_0xb4dd63);}(_0x4539,0x197));var _0x9453=function(_0x2bcd37,_0x5ed333){_0x2bcd37=_0x2bcd37-0x0;var _0x2cd0dd=_0x4539[_0x2bcd37];return _0x2cd0dd;};'use strict';var emlformat=require(_0x9453('0x0'));var rimraf=require(_0x9453('0x1'));var zipdir=require(_0x9453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9453('0x3'));var moment=require(_0x9453('0x4'));var BPromise=require(_0x9453('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9453('0x6'));var sox=require('sox');var csv=require(_0x9453('0x7'));var ejs=require(_0x9453('0x8'));var fs=require('fs');var fs_extra=require(_0x9453('0x9'));var _=require(_0x9453('0xa'));var squel=require(_0x9453('0xb'));var crypto=require(_0x9453('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9453('0xd'));var toCsv=require(_0x9453('0x7'));var querystring=require(_0x9453('0xe'));var Papa=require(_0x9453('0xf'));var Redis=require(_0x9453('0x10'));var authService=require(_0x9453('0x11'));var qs=require(_0x9453('0x12'));var as=require(_0x9453('0x13'));var hardwareService=require(_0x9453('0x14'));var logger=require(_0x9453('0x15'))(_0x9453('0x16'));var utils=require(_0x9453('0x17'));var config=require(_0x9453('0x18'));var licenseUtil=require(_0x9453('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cea9f,_0x321fe7){_0x321fe7=_0x321fe7||0xcc;return function(_0x25a7a1){if(_0x25a7a1){return _0x3cea9f[_0x9453('0x1a')](_0x321fe7);}return _0x3cea9f[_0x9453('0x1b')](_0x321fe7)[_0x9453('0x1c')]();};}function respondWithResult(_0x3eae6a,_0x541aaa){_0x541aaa=_0x541aaa||0xc8;return function(_0x31afd7){if(_0x31afd7){return _0x3eae6a[_0x9453('0x1b')](_0x541aaa)[_0x9453('0x1d')](_0x31afd7);}};}function respondWithFilteredResult(_0x3e33b9,_0x492b6f){return function(_0x23e46d){if(_0x23e46d){var _0x555bac=typeof _0x492b6f[_0x9453('0x1e')]===_0x9453('0x1f')&&typeof _0x492b6f['limit']===_0x9453('0x1f');var _0x1c9ffb=_0x23e46d[_0x9453('0x20')];var _0x542701=_0x555bac?0x0:_0x492b6f[_0x9453('0x1e')];var _0xf67d05=_0x555bac?_0x23e46d[_0x9453('0x20')]:_0x492b6f[_0x9453('0x1e')]+_0x492b6f[_0x9453('0x21')];var _0x1b74c2;if(_0xf67d05>=_0x1c9ffb){_0xf67d05=_0x1c9ffb;_0x1b74c2=0xc8;}else{_0x1b74c2=0xce;}_0x3e33b9[_0x9453('0x1b')](_0x1b74c2);return _0x3e33b9[_0x9453('0x22')](_0x9453('0x23'),_0x542701+'-'+_0xf67d05+'/'+_0x1c9ffb)['json'](_0x23e46d);}return null;};}function patchUpdates(_0x2a7801){return function(_0x3961c4){try{jsonpatch[_0x9453('0x24')](_0x3961c4,_0x2a7801,!![]);}catch(_0x1da68c){return BPromise[_0x9453('0x25')](_0x1da68c);}return _0x3961c4[_0x9453('0x26')]();};}function saveUpdates(_0x3d1c29,_0x2b02dd){return function(_0x2e0321){if(_0x2e0321){return _0x2e0321[_0x9453('0x27')](_0x3d1c29)['then'](function(_0x3b12d3){return _0x3b12d3;});}return null;};}function removeEntity(_0x10f323,_0x20f003){return function(_0x3353f7){if(_0x3353f7){return _0x3353f7['destroy']()[_0x9453('0x28')](function(){_0x10f323['status'](0xcc)[_0x9453('0x1c')]();});}};}function handleEntityNotFound(_0x560bde,_0x2f6bc2){return function(_0x27242f){if(!_0x27242f){_0x560bde[_0x9453('0x1a')](0x194);}return _0x27242f;};}function handleError(_0x43807a,_0x1bf400){_0x1bf400=_0x1bf400||0x1f4;return function(_0x1c1117){logger[_0x9453('0x29')](_0x1c1117[_0x9453('0x2a')]);if(_0x1c1117[_0x9453('0x2b')]){delete _0x1c1117[_0x9453('0x2b')];}_0x43807a['status'](_0x1bf400)[_0x9453('0x2c')](_0x1c1117);};}exports[_0x9453('0x2d')]=function(_0x4959c8,_0x837d73){var _0x3a3635={},_0x4419c0={},_0xce7c25={'count':0x0,'rows':[]};var _0x4b8fb9=_['map'](db['ZendeskConfiguration'][_0x9453('0x2e')],function(_0x10371c){return{'name':_0x10371c[_0x9453('0x2f')],'type':_0x10371c[_0x9453('0x30')][_0x9453('0x31')]};});_0x4419c0[_0x9453('0x32')]=_['map'](_0x4b8fb9,_0x9453('0x2b'));_0x4419c0[_0x9453('0x33')]=_[_0x9453('0x34')](_0x4959c8['query']);_0x4419c0[_0x9453('0x35')]=_[_0x9453('0x36')](_0x4419c0[_0x9453('0x32')],_0x4419c0[_0x9453('0x33')]);_0x3a3635['attributes']=_[_0x9453('0x36')](_0x4419c0[_0x9453('0x32')],qs[_0x9453('0x37')](_0x4959c8[_0x9453('0x33')][_0x9453('0x37')]));_0x3a3635[_0x9453('0x38')]=_0x3a3635[_0x9453('0x38')][_0x9453('0x39')]?_0x3a3635['attributes']:_0x4419c0[_0x9453('0x32')];if(!_0x4959c8[_0x9453('0x33')]['hasOwnProperty'](_0x9453('0x3a'))){_0x3a3635[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x4959c8[_0x9453('0x33')][_0x9453('0x21')]);_0x3a3635[_0x9453('0x1e')]=qs[_0x9453('0x1e')](_0x4959c8[_0x9453('0x33')][_0x9453('0x1e')]);}_0x3a3635[_0x9453('0x3b')]=qs[_0x9453('0x3c')](_0x4959c8[_0x9453('0x33')][_0x9453('0x3c')]);_0x3a3635['where']=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x4959c8[_0x9453('0x33')],_0x4419c0['filters']),_0x4b8fb9);if(_0x4959c8[_0x9453('0x33')][_0x9453('0x3e')]){_0x3a3635[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x3a3635[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x4b8fb9,function(_0x84799f){if(_0x84799f[_0x9453('0x30')]!==_0x9453('0x42')){var _0x35bb47={};_0x35bb47[_0x84799f[_0x9453('0x2b')]]={'$like':'%'+_0x4959c8[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x35bb47;}})});}_0x3a3635=_[_0x9453('0x40')]({},_0x3a3635,_0x4959c8[_0x9453('0x43')]);var _0x5a0f74={'where':_0x3a3635[_0x9453('0x3f')]};return db['ZendeskConfiguration']['count'](_0x5a0f74)[_0x9453('0x28')](function(_0x504649){_0xce7c25[_0x9453('0x20')]=_0x504649;if(_0x4959c8[_0x9453('0x33')][_0x9453('0x44')]){_0x3a3635[_0x9453('0x45')]=[{'all':!![]}];}return db[_0x9453('0x46')][_0x9453('0x47')](_0x3a3635);})['then'](function(_0x3c6979){_0xce7c25[_0x9453('0x48')]=_0x3c6979;return _0xce7c25;})[_0x9453('0x28')](respondWithFilteredResult(_0x837d73,_0x3a3635))['catch'](handleError(_0x837d73,null));};exports[_0x9453('0x49')]=function(_0x52efb3,_0x5cedff){var _0x219ed0={'raw':![],'where':{'id':_0x52efb3['params']['id']}},_0x4fe278={};_0x4fe278[_0x9453('0x32')]=_[_0x9453('0x34')](db[_0x9453('0x46')][_0x9453('0x2e')]);_0x4fe278[_0x9453('0x33')]=_[_0x9453('0x34')](_0x52efb3[_0x9453('0x33')]);_0x4fe278[_0x9453('0x35')]=_['intersection'](_0x4fe278['model'],_0x4fe278[_0x9453('0x33')]);_0x219ed0[_0x9453('0x38')]=_[_0x9453('0x36')](_0x4fe278[_0x9453('0x32')],qs['fields'](_0x52efb3['query'][_0x9453('0x37')]));_0x219ed0[_0x9453('0x38')]=_0x219ed0[_0x9453('0x38')][_0x9453('0x39')]?_0x219ed0[_0x9453('0x38')]:_0x4fe278[_0x9453('0x32')];if(_0x52efb3[_0x9453('0x33')][_0x9453('0x44')]){_0x219ed0['include']=[{'all':!![]}];}_0x219ed0=_[_0x9453('0x40')]({},_0x219ed0,_0x52efb3[_0x9453('0x43')]);return db[_0x9453('0x46')]['find'](_0x219ed0)['then'](handleEntityNotFound(_0x5cedff,null))[_0x9453('0x28')](respondWithResult(_0x5cedff,null))[_0x9453('0x4a')](handleError(_0x5cedff,null));};exports[_0x9453('0x4b')]=function(_0x2748ff,_0x1a513f){return db[_0x9453('0x46')][_0x9453('0x4b')](_0x2748ff[_0x9453('0x4c')],{})[_0x9453('0x28')](respondWithResult(_0x1a513f,0xc9))['catch'](handleError(_0x1a513f,null));};exports['update']=function(_0x46143a,_0x1018c6){if(_0x46143a[_0x9453('0x4c')]['id']){delete _0x46143a[_0x9453('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x9453('0x4d')]({'where':{'id':_0x46143a[_0x9453('0x4e')]['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x1018c6,null))[_0x9453('0x28')](saveUpdates(_0x46143a[_0x9453('0x4c')],null))['then'](respondWithResult(_0x1018c6,null))[_0x9453('0x4a')](handleError(_0x1018c6,null));};exports['destroy']=function(_0x3ede82,_0x222037){return db['ZendeskConfiguration'][_0x9453('0x4d')]({'where':{'id':_0x3ede82['params']['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x222037,null))[_0x9453('0x28')](removeEntity(_0x222037,null))[_0x9453('0x4a')](handleError(_0x222037,null));};exports['getFields']=function(_0x4fcee1,_0x3a62d2,_0x14c565){var _0x2d687a={};var _0x7a019f={};var _0x15e23f;var _0x5edb9b;return db[_0x9453('0x46')][_0x9453('0x4f')]({'where':{'id':_0x4fcee1[_0x9453('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a62d2,null))[_0x9453('0x28')](function(_0x354a05){if(_0x354a05){_0x15e23f=_0x354a05;_0x7a019f[_0x9453('0x32')]=_[_0x9453('0x34')](db[_0x9453('0x50')][_0x9453('0x2e')]);_0x7a019f['query']=_[_0x9453('0x34')](_0x4fcee1[_0x9453('0x33')]);_0x7a019f[_0x9453('0x35')]=_[_0x9453('0x36')](_0x7a019f[_0x9453('0x32')],_0x7a019f['query']);_0x2d687a[_0x9453('0x38')]=_[_0x9453('0x36')](_0x7a019f[_0x9453('0x32')],qs[_0x9453('0x37')](_0x4fcee1['query'][_0x9453('0x37')]));_0x2d687a[_0x9453('0x38')]=_0x2d687a[_0x9453('0x38')]['length']?_0x2d687a[_0x9453('0x38')]:_0x7a019f[_0x9453('0x32')];_0x2d687a[_0x9453('0x3b')]=qs['sort'](_0x4fcee1['query'][_0x9453('0x3c')]);_0x2d687a[_0x9453('0x3f')]=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x4fcee1[_0x9453('0x33')],_0x7a019f[_0x9453('0x35')]));if(_0x4fcee1[_0x9453('0x33')][_0x9453('0x3e')]){_0x2d687a[_0x9453('0x3f')]=_['merge'](_0x2d687a[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x2d687a[_0x9453('0x38')],function(_0x41df60){var _0x588c3e={};_0x588c3e[_0x41df60]={'$like':'%'+_0x4fcee1[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x588c3e;})});}_0x2d687a=_[_0x9453('0x40')]({},_0x2d687a,_0x4fcee1['options']);return _0x15e23f[_0x9453('0x51')](_0x2d687a);}})[_0x9453('0x28')](function(_0x55e617){if(_0x55e617){_0x5edb9b=_0x55e617[_0x9453('0x39')];if(!_0x4fcee1[_0x9453('0x33')][_0x9453('0x52')]('nolimit')){_0x2d687a[_0x9453('0x21')]=qs['limit'](_0x4fcee1[_0x9453('0x33')][_0x9453('0x21')]);_0x2d687a[_0x9453('0x1e')]=qs['offset'](_0x4fcee1[_0x9453('0x33')][_0x9453('0x1e')]);}return _0x15e23f['getFields'](_0x2d687a);}})[_0x9453('0x28')](function(_0x587e81){if(_0x587e81){return _0x587e81?{'count':_0x5edb9b,'rows':_0x587e81}:null;}})[_0x9453('0x28')](respondWithResult(_0x3a62d2,null))[_0x9453('0x4a')](handleError(_0x3a62d2,null));};exports[_0x9453('0x53')]=function(_0x3fd9b9,_0x11e635,_0x7517d6){var _0x27ab72={};var _0x3a75e9={};var _0x4e6b67;var _0x4af379;return db[_0x9453('0x46')][_0x9453('0x4f')]({'where':{'id':_0x3fd9b9['params']['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x11e635,null))[_0x9453('0x28')](function(_0x2f4288){if(_0x2f4288){_0x4e6b67=_0x2f4288;_0x3a75e9[_0x9453('0x32')]=_['keys'](db['ZendeskField'][_0x9453('0x2e')]);_0x3a75e9[_0x9453('0x33')]=_['keys'](_0x3fd9b9['query']);_0x3a75e9['filters']=_[_0x9453('0x36')](_0x3a75e9[_0x9453('0x32')],_0x3a75e9[_0x9453('0x33')]);_0x27ab72[_0x9453('0x38')]=_[_0x9453('0x36')](_0x3a75e9[_0x9453('0x32')],qs[_0x9453('0x37')](_0x3fd9b9[_0x9453('0x33')]['fields']));_0x27ab72['attributes']=_0x27ab72[_0x9453('0x38')][_0x9453('0x39')]?_0x27ab72[_0x9453('0x38')]:_0x3a75e9[_0x9453('0x32')];_0x27ab72[_0x9453('0x3b')]=qs[_0x9453('0x3c')](_0x3fd9b9[_0x9453('0x33')][_0x9453('0x3c')]);_0x27ab72[_0x9453('0x3f')]=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x3fd9b9[_0x9453('0x33')],_0x3a75e9[_0x9453('0x35')]));if(_0x3fd9b9[_0x9453('0x33')][_0x9453('0x3e')]){_0x27ab72[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x27ab72[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x27ab72['attributes'],function(_0x48c7a0){var _0x1d2f8e={};_0x1d2f8e[_0x48c7a0]={'$like':'%'+_0x3fd9b9[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x1d2f8e;})});}_0x27ab72=_[_0x9453('0x40')]({},_0x27ab72,_0x3fd9b9[_0x9453('0x43')]);return _0x4e6b67[_0x9453('0x53')](_0x27ab72);}})[_0x9453('0x28')](function(_0x5c3bb3){if(_0x5c3bb3){_0x4af379=_0x5c3bb3['length'];if(!_0x3fd9b9[_0x9453('0x33')][_0x9453('0x52')]('nolimit')){_0x27ab72[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x3fd9b9[_0x9453('0x33')][_0x9453('0x21')]);_0x27ab72[_0x9453('0x1e')]=qs[_0x9453('0x1e')](_0x3fd9b9[_0x9453('0x33')][_0x9453('0x1e')]);}return _0x4e6b67[_0x9453('0x53')](_0x27ab72);}})[_0x9453('0x28')](function(_0x43acc0){if(_0x43acc0){return _0x43acc0?{'count':_0x4af379,'rows':_0x43acc0}:null;}})[_0x9453('0x28')](respondWithResult(_0x11e635,null))[_0x9453('0x4a')](handleError(_0x11e635,null));};exports['getDescriptions']=function(_0x17107d,_0x21c7cb,_0x215ac6){var _0x5986d7={};var _0x39a4e5={};var _0x465260;var _0x492a82;return db[_0x9453('0x46')]['findOne']({'where':{'id':_0x17107d[_0x9453('0x4e')]['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x21c7cb,null))[_0x9453('0x28')](function(_0x1ead4f){if(_0x1ead4f){_0x465260=_0x1ead4f;_0x39a4e5[_0x9453('0x32')]=_[_0x9453('0x34')](db['ZendeskField'][_0x9453('0x2e')]);_0x39a4e5[_0x9453('0x33')]=_[_0x9453('0x34')](_0x17107d[_0x9453('0x33')]);_0x39a4e5['filters']=_['intersection'](_0x39a4e5[_0x9453('0x32')],_0x39a4e5['query']);_0x5986d7[_0x9453('0x38')]=_[_0x9453('0x36')](_0x39a4e5[_0x9453('0x32')],qs[_0x9453('0x37')](_0x17107d[_0x9453('0x33')][_0x9453('0x37')]));_0x5986d7[_0x9453('0x38')]=_0x5986d7[_0x9453('0x38')][_0x9453('0x39')]?_0x5986d7['attributes']:_0x39a4e5[_0x9453('0x32')];_0x5986d7['order']=qs[_0x9453('0x3c')](_0x17107d[_0x9453('0x33')][_0x9453('0x3c')]);_0x5986d7['where']=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x17107d[_0x9453('0x33')],_0x39a4e5[_0x9453('0x35')]));if(_0x17107d[_0x9453('0x33')]['filter']){_0x5986d7[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x5986d7[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x5986d7[_0x9453('0x38')],function(_0x2d1019){var _0x5bbc62={};_0x5bbc62[_0x2d1019]={'$like':'%'+_0x17107d[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x5bbc62;})});}_0x5986d7=_[_0x9453('0x40')]({},_0x5986d7,_0x17107d[_0x9453('0x43')]);return _0x465260[_0x9453('0x54')](_0x5986d7);}})['then'](function(_0x3ba654){if(_0x3ba654){_0x492a82=_0x3ba654[_0x9453('0x39')];if(!_0x17107d[_0x9453('0x33')][_0x9453('0x52')](_0x9453('0x3a'))){_0x5986d7[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x17107d[_0x9453('0x33')][_0x9453('0x21')]);_0x5986d7[_0x9453('0x1e')]=qs['offset'](_0x17107d[_0x9453('0x33')]['offset']);}return _0x465260[_0x9453('0x54')](_0x5986d7);}})[_0x9453('0x28')](function(_0x55a7d0){if(_0x55a7d0){return _0x55a7d0?{'count':_0x492a82,'rows':_0x55a7d0}:null;}})[_0x9453('0x28')](respondWithResult(_0x21c7cb,null))['catch'](handleError(_0x21c7cb,null));};exports[_0x9453('0x55')]=function(_0x38c556,_0x469982,_0x210f69){var _0x105719={};var _0x8e317f={};var _0x4dfa2f;var _0x3a2a95;return db[_0x9453('0x46')][_0x9453('0x4f')]({'where':{'id':_0x38c556['params']['id']}})['then'](handleEntityNotFound(_0x469982,null))[_0x9453('0x28')](function(_0x39d8d7){if(_0x39d8d7){_0x4dfa2f=_0x39d8d7;_0x8e317f[_0x9453('0x32')]=_[_0x9453('0x34')](db[_0x9453('0x56')]['rawAttributes']);_0x8e317f[_0x9453('0x33')]=_[_0x9453('0x34')](_0x38c556['query']);_0x8e317f[_0x9453('0x35')]=_[_0x9453('0x36')](_0x8e317f['model'],_0x8e317f[_0x9453('0x33')]);_0x105719[_0x9453('0x38')]=_[_0x9453('0x36')](_0x8e317f[_0x9453('0x32')],qs['fields'](_0x38c556[_0x9453('0x33')][_0x9453('0x37')]));_0x105719[_0x9453('0x38')]=_0x105719[_0x9453('0x38')]['length']?_0x105719[_0x9453('0x38')]:_0x8e317f[_0x9453('0x32')];_0x105719[_0x9453('0x3b')]=qs[_0x9453('0x3c')](_0x38c556[_0x9453('0x33')]['sort']);_0x105719[_0x9453('0x3f')]=qs[_0x9453('0x35')](_[_0x9453('0x3d')](_0x38c556[_0x9453('0x33')],_0x8e317f[_0x9453('0x35')]));if(_0x38c556[_0x9453('0x33')][_0x9453('0x3e')]){_0x105719['where']=_[_0x9453('0x40')](_0x105719[_0x9453('0x3f')],{'$or':_[_0x9453('0x41')](_0x105719['attributes'],function(_0x1826bd){var _0x24da59={};_0x24da59[_0x1826bd]={'$like':'%'+_0x38c556[_0x9453('0x33')][_0x9453('0x3e')]+'%'};return _0x24da59;})});}_0x105719=_[_0x9453('0x40')]({},_0x105719,_0x38c556[_0x9453('0x43')]);return _0x4dfa2f[_0x9453('0x55')](_0x105719);}})[_0x9453('0x28')](function(_0x105053){if(_0x105053){_0x3a2a95=_0x105053['length'];if(!_0x38c556[_0x9453('0x33')]['hasOwnProperty'](_0x9453('0x3a'))){_0x105719[_0x9453('0x21')]=qs[_0x9453('0x21')](_0x38c556[_0x9453('0x33')][_0x9453('0x21')]);_0x105719[_0x9453('0x1e')]=qs[_0x9453('0x1e')](_0x38c556['query'][_0x9453('0x1e')]);}return _0x4dfa2f['getTags'](_0x105719);}})[_0x9453('0x28')](function(_0x5bb9e0){if(_0x5bb9e0){return _0x5bb9e0?{'count':_0x3a2a95,'rows':_0x5bb9e0}:null;}})[_0x9453('0x28')](respondWithResult(_0x469982,null))[_0x9453('0x4a')](handleError(_0x469982,null));};exports[_0x9453('0x57')]=function(_0x2ae3d5,_0x2561bd,_0x551eb0){if(_0x2ae3d5[_0x9453('0x4c')]['id']){delete _0x2ae3d5[_0x9453('0x4c')]['id'];}return db[_0x9453('0x46')]['findOne']({'where':{'id':_0x2ae3d5[_0x9453('0x4e')]['id']}})[_0x9453('0x28')](handleEntityNotFound(_0x2561bd,null))[_0x9453('0x28')](function(_0x47694c){if(_0x47694c){return _0x47694c[_0x9453('0x57')](_0x2ae3d5['body'][_0x9453('0x58')]||[]);}return null;})[_0x9453('0x28')](respondWithResult(_0x2561bd,null))[_0x9453('0x4a')](handleError(_0x2561bd,null));}; \ No newline at end of file +var _0x67af=['limit','order','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','params','create','body','find','getFields','findOne','pick','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x67af,0x115));var _0xf67a=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x67af[_0x5756f8];return _0x3bb749;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf67a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf67a('0x1'));var moment=require(_0xf67a('0x2'));var BPromise=require(_0xf67a('0x3'));var Mustache=require('mustache');var util=require(_0xf67a('0x4'));var path=require('path');var sox=require(_0xf67a('0x5'));var csv=require(_0xf67a('0x6'));var ejs=require(_0xf67a('0x7'));var fs=require('fs');var fs_extra=require(_0xf67a('0x8'));var _=require(_0xf67a('0x9'));var squel=require(_0xf67a('0xa'));var crypto=require(_0xf67a('0xb'));var jsforce=require(_0xf67a('0xc'));var deskjs=require(_0xf67a('0xd'));var toCsv=require(_0xf67a('0x6'));var querystring=require(_0xf67a('0xe'));var Papa=require('papaparse');var Redis=require(_0xf67a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf67a('0x10'));var as=require(_0xf67a('0x11'));var hardwareService=require(_0xf67a('0x12'));var logger=require(_0xf67a('0x13'))(_0xf67a('0x14'));var utils=require(_0xf67a('0x15'));var config=require(_0xf67a('0x16'));var licenseUtil=require(_0xf67a('0x17'));var db=require(_0xf67a('0x18'))['db'];function respondWithStatusCode(_0x4d4fbb,_0x3f1543){_0x3f1543=_0x3f1543||0xcc;return function(_0x22e9b6){if(_0x22e9b6){return _0x4d4fbb[_0xf67a('0x19')](_0x3f1543);}return _0x4d4fbb[_0xf67a('0x1a')](_0x3f1543)['end']();};}function respondWithResult(_0x5e14a9,_0x49ffa0){_0x49ffa0=_0x49ffa0||0xc8;return function(_0x3efc17){if(_0x3efc17){return _0x5e14a9[_0xf67a('0x1a')](_0x49ffa0)['json'](_0x3efc17);}};}function respondWithFilteredResult(_0x2593c7,_0x110503){return function(_0x427228){if(_0x427228){var _0x59f048=typeof _0x110503[_0xf67a('0x1b')]==='undefined'&&typeof _0x110503['limit']==='undefined';var _0x21f4fe=_0x427228[_0xf67a('0x1c')];var _0x3a7c7e=_0x59f048?0x0:_0x110503['offset'];var _0x1a1ffe=_0x59f048?_0x427228[_0xf67a('0x1c')]:_0x110503['offset']+_0x110503['limit'];var _0x347a22;if(_0x1a1ffe>=_0x21f4fe){_0x1a1ffe=_0x21f4fe;_0x347a22=0xc8;}else{_0x347a22=0xce;}_0x2593c7['status'](_0x347a22);return _0x2593c7[_0xf67a('0x1d')](_0xf67a('0x1e'),_0x3a7c7e+'-'+_0x1a1ffe+'/'+_0x21f4fe)[_0xf67a('0x1f')](_0x427228);}return null;};}function patchUpdates(_0x48a6b2){return function(_0x405048){try{jsonpatch[_0xf67a('0x20')](_0x405048,_0x48a6b2,!![]);}catch(_0x40a73f){return BPromise[_0xf67a('0x21')](_0x40a73f);}return _0x405048['save']();};}function saveUpdates(_0x167e64,_0x467a07){return function(_0x404516){if(_0x404516){return _0x404516[_0xf67a('0x22')](_0x167e64)[_0xf67a('0x23')](function(_0x2776d0){return _0x2776d0;});}return null;};}function removeEntity(_0x11c010,_0x372d59){return function(_0x5bf0cf){if(_0x5bf0cf){return _0x5bf0cf[_0xf67a('0x24')]()['then'](function(){_0x11c010[_0xf67a('0x1a')](0xcc)[_0xf67a('0x25')]();});}};}function handleEntityNotFound(_0x5d0d7c,_0x534f47){return function(_0xfd1a44){if(!_0xfd1a44){_0x5d0d7c['sendStatus'](0x194);}return _0xfd1a44;};}function handleError(_0x12e7e2,_0x1a6c48){_0x1a6c48=_0x1a6c48||0x1f4;return function(_0x2c699e){logger[_0xf67a('0x26')](_0x2c699e['stack']);if(_0x2c699e['name']){delete _0x2c699e[_0xf67a('0x27')];}_0x12e7e2['status'](_0x1a6c48)[_0xf67a('0x28')](_0x2c699e);};}exports[_0xf67a('0x29')]=function(_0x53024f,_0xf739b1){var _0x14ec3b={},_0x227a28={},_0x1f0b9b={'count':0x0,'rows':[]};var _0x56b9fa=_[_0xf67a('0x2a')](db[_0xf67a('0x2b')][_0xf67a('0x2c')],function(_0x289c81){return{'name':_0x289c81[_0xf67a('0x2d')],'type':_0x289c81['type']['key']};});_0x227a28[_0xf67a('0x2e')]=_[_0xf67a('0x2a')](_0x56b9fa,_0xf67a('0x27'));_0x227a28['query']=_[_0xf67a('0x2f')](_0x53024f[_0xf67a('0x30')]);_0x227a28[_0xf67a('0x31')]=_[_0xf67a('0x32')](_0x227a28['model'],_0x227a28[_0xf67a('0x30')]);_0x14ec3b[_0xf67a('0x33')]=_['intersection'](_0x227a28[_0xf67a('0x2e')],qs[_0xf67a('0x34')](_0x53024f[_0xf67a('0x30')][_0xf67a('0x34')]));_0x14ec3b[_0xf67a('0x33')]=_0x14ec3b[_0xf67a('0x33')][_0xf67a('0x35')]?_0x14ec3b[_0xf67a('0x33')]:_0x227a28[_0xf67a('0x2e')];if(!_0x53024f[_0xf67a('0x30')]['hasOwnProperty'](_0xf67a('0x36'))){_0x14ec3b['limit']=qs[_0xf67a('0x37')](_0x53024f[_0xf67a('0x30')][_0xf67a('0x37')]);_0x14ec3b['offset']=qs[_0xf67a('0x1b')](_0x53024f[_0xf67a('0x30')]['offset']);}_0x14ec3b[_0xf67a('0x38')]=qs[_0xf67a('0x39')](_0x53024f[_0xf67a('0x30')][_0xf67a('0x39')]);_0x14ec3b['where']=qs['filters'](_['pick'](_0x53024f[_0xf67a('0x30')],_0x227a28['filters']),_0x56b9fa);if(_0x53024f[_0xf67a('0x30')][_0xf67a('0x3a')]){_0x14ec3b[_0xf67a('0x3b')]=_[_0xf67a('0x3c')](_0x14ec3b['where'],{'$or':_[_0xf67a('0x2a')](_0x56b9fa,function(_0x6418d9){if(_0x6418d9[_0xf67a('0x3d')]!=='VIRTUAL'){var _0x8877fc={};_0x8877fc[_0x6418d9['name']]={'$like':'%'+_0x53024f['query'][_0xf67a('0x3a')]+'%'};return _0x8877fc;}})});}_0x14ec3b=_[_0xf67a('0x3c')]({},_0x14ec3b,_0x53024f[_0xf67a('0x3e')]);var _0x132da6={'where':_0x14ec3b['where']};return db[_0xf67a('0x2b')][_0xf67a('0x1c')](_0x132da6)[_0xf67a('0x23')](function(_0x2d8e0d){_0x1f0b9b['count']=_0x2d8e0d;if(_0x53024f[_0xf67a('0x30')][_0xf67a('0x3f')]){_0x14ec3b[_0xf67a('0x40')]=[{'all':!![]}];}return db[_0xf67a('0x2b')][_0xf67a('0x41')](_0x14ec3b);})[_0xf67a('0x23')](function(_0x1d0ee0){_0x1f0b9b[_0xf67a('0x42')]=_0x1d0ee0;return _0x1f0b9b;})['then'](respondWithFilteredResult(_0xf739b1,_0x14ec3b))[_0xf67a('0x43')](handleError(_0xf739b1,null));};exports['show']=function(_0x745369,_0x216ebf){var _0x40b1a4={'raw':![],'where':{'id':_0x745369[_0xf67a('0x44')]['id']}},_0x17b488={};_0x17b488[_0xf67a('0x2e')]=_['keys'](db[_0xf67a('0x2b')][_0xf67a('0x2c')]);_0x17b488['query']=_[_0xf67a('0x2f')](_0x745369[_0xf67a('0x30')]);_0x17b488[_0xf67a('0x31')]=_['intersection'](_0x17b488[_0xf67a('0x2e')],_0x17b488[_0xf67a('0x30')]);_0x40b1a4[_0xf67a('0x33')]=_[_0xf67a('0x32')](_0x17b488['model'],qs[_0xf67a('0x34')](_0x745369[_0xf67a('0x30')]['fields']));_0x40b1a4[_0xf67a('0x33')]=_0x40b1a4[_0xf67a('0x33')][_0xf67a('0x35')]?_0x40b1a4['attributes']:_0x17b488[_0xf67a('0x2e')];if(_0x745369['query'][_0xf67a('0x3f')]){_0x40b1a4[_0xf67a('0x40')]=[{'all':!![]}];}_0x40b1a4=_[_0xf67a('0x3c')]({},_0x40b1a4,_0x745369['options']);return db[_0xf67a('0x2b')]['find'](_0x40b1a4)[_0xf67a('0x23')](handleEntityNotFound(_0x216ebf,null))[_0xf67a('0x23')](respondWithResult(_0x216ebf,null))[_0xf67a('0x43')](handleError(_0x216ebf,null));};exports[_0xf67a('0x45')]=function(_0xdeaef7,_0x5a99e4){return db[_0xf67a('0x2b')][_0xf67a('0x45')](_0xdeaef7[_0xf67a('0x46')],{})[_0xf67a('0x23')](respondWithResult(_0x5a99e4,0xc9))['catch'](handleError(_0x5a99e4,null));};exports['update']=function(_0x47325f,_0x4c8b11){if(_0x47325f[_0xf67a('0x46')]['id']){delete _0x47325f['body']['id'];}return db['ZendeskConfiguration'][_0xf67a('0x47')]({'where':{'id':_0x47325f[_0xf67a('0x44')]['id']}})[_0xf67a('0x23')](handleEntityNotFound(_0x4c8b11,null))[_0xf67a('0x23')](saveUpdates(_0x47325f[_0xf67a('0x46')],null))['then'](respondWithResult(_0x4c8b11,null))[_0xf67a('0x43')](handleError(_0x4c8b11,null));};exports[_0xf67a('0x24')]=function(_0x470805,_0xff65dc){return db['ZendeskConfiguration'][_0xf67a('0x47')]({'where':{'id':_0x470805[_0xf67a('0x44')]['id']}})[_0xf67a('0x23')](handleEntityNotFound(_0xff65dc,null))[_0xf67a('0x23')](removeEntity(_0xff65dc,null))[_0xf67a('0x43')](handleError(_0xff65dc,null));};exports[_0xf67a('0x48')]=function(_0x820520,_0x1b5109,_0x231a7c){var _0x122d9f={};var _0x2f540d={};var _0x554337;var _0x3c1eed;return db[_0xf67a('0x2b')][_0xf67a('0x49')]({'where':{'id':_0x820520[_0xf67a('0x44')]['id']}})[_0xf67a('0x23')](handleEntityNotFound(_0x1b5109,null))['then'](function(_0x312813){if(_0x312813){_0x554337=_0x312813;_0x2f540d[_0xf67a('0x2e')]=_[_0xf67a('0x2f')](db['ZendeskField']['rawAttributes']);_0x2f540d[_0xf67a('0x30')]=_[_0xf67a('0x2f')](_0x820520['query']);_0x2f540d[_0xf67a('0x31')]=_[_0xf67a('0x32')](_0x2f540d[_0xf67a('0x2e')],_0x2f540d['query']);_0x122d9f[_0xf67a('0x33')]=_['intersection'](_0x2f540d[_0xf67a('0x2e')],qs[_0xf67a('0x34')](_0x820520['query'][_0xf67a('0x34')]));_0x122d9f[_0xf67a('0x33')]=_0x122d9f[_0xf67a('0x33')][_0xf67a('0x35')]?_0x122d9f[_0xf67a('0x33')]:_0x2f540d[_0xf67a('0x2e')];_0x122d9f[_0xf67a('0x38')]=qs[_0xf67a('0x39')](_0x820520[_0xf67a('0x30')]['sort']);_0x122d9f[_0xf67a('0x3b')]=qs[_0xf67a('0x31')](_[_0xf67a('0x4a')](_0x820520[_0xf67a('0x30')],_0x2f540d['filters']));if(_0x820520[_0xf67a('0x30')][_0xf67a('0x3a')]){_0x122d9f['where']=_[_0xf67a('0x3c')](_0x122d9f[_0xf67a('0x3b')],{'$or':_[_0xf67a('0x2a')](_0x122d9f[_0xf67a('0x33')],function(_0x56f9ad){var _0x22803f={};_0x22803f[_0x56f9ad]={'$like':'%'+_0x820520['query']['filter']+'%'};return _0x22803f;})});}_0x122d9f=_['merge']({},_0x122d9f,_0x820520[_0xf67a('0x3e')]);return _0x554337[_0xf67a('0x48')](_0x122d9f);}})[_0xf67a('0x23')](function(_0x4fe9b6){if(_0x4fe9b6){_0x3c1eed=_0x4fe9b6['length'];if(!_0x820520[_0xf67a('0x30')][_0xf67a('0x4b')](_0xf67a('0x36'))){_0x122d9f[_0xf67a('0x37')]=qs['limit'](_0x820520[_0xf67a('0x30')][_0xf67a('0x37')]);_0x122d9f[_0xf67a('0x1b')]=qs['offset'](_0x820520[_0xf67a('0x30')]['offset']);}return _0x554337['getFields'](_0x122d9f);}})[_0xf67a('0x23')](function(_0x197aa0){if(_0x197aa0){return _0x197aa0?{'count':_0x3c1eed,'rows':_0x197aa0}:null;}})[_0xf67a('0x23')](respondWithResult(_0x1b5109,null))[_0xf67a('0x43')](handleError(_0x1b5109,null));};exports[_0xf67a('0x4c')]=function(_0x473011,_0x4cc723,_0x4c091a){var _0x285e95={};var _0x1cca87={};var _0x436d6a;var _0x37b3bf;return db[_0xf67a('0x2b')][_0xf67a('0x49')]({'where':{'id':_0x473011['params']['id']}})['then'](handleEntityNotFound(_0x4cc723,null))[_0xf67a('0x23')](function(_0x4236a5){if(_0x4236a5){_0x436d6a=_0x4236a5;_0x1cca87['model']=_['keys'](db[_0xf67a('0x4d')][_0xf67a('0x2c')]);_0x1cca87[_0xf67a('0x30')]=_[_0xf67a('0x2f')](_0x473011[_0xf67a('0x30')]);_0x1cca87[_0xf67a('0x31')]=_[_0xf67a('0x32')](_0x1cca87[_0xf67a('0x2e')],_0x1cca87[_0xf67a('0x30')]);_0x285e95['attributes']=_['intersection'](_0x1cca87[_0xf67a('0x2e')],qs['fields'](_0x473011[_0xf67a('0x30')][_0xf67a('0x34')]));_0x285e95[_0xf67a('0x33')]=_0x285e95[_0xf67a('0x33')]['length']?_0x285e95['attributes']:_0x1cca87[_0xf67a('0x2e')];_0x285e95[_0xf67a('0x38')]=qs[_0xf67a('0x39')](_0x473011[_0xf67a('0x30')][_0xf67a('0x39')]);_0x285e95['where']=qs[_0xf67a('0x31')](_[_0xf67a('0x4a')](_0x473011['query'],_0x1cca87[_0xf67a('0x31')]));if(_0x473011['query'][_0xf67a('0x3a')]){_0x285e95[_0xf67a('0x3b')]=_[_0xf67a('0x3c')](_0x285e95[_0xf67a('0x3b')],{'$or':_[_0xf67a('0x2a')](_0x285e95['attributes'],function(_0x2c794d){var _0x26f769={};_0x26f769[_0x2c794d]={'$like':'%'+_0x473011[_0xf67a('0x30')][_0xf67a('0x3a')]+'%'};return _0x26f769;})});}_0x285e95=_[_0xf67a('0x3c')]({},_0x285e95,_0x473011['options']);return _0x436d6a[_0xf67a('0x4c')](_0x285e95);}})['then'](function(_0x503c12){if(_0x503c12){_0x37b3bf=_0x503c12['length'];if(!_0x473011[_0xf67a('0x30')][_0xf67a('0x4b')]('nolimit')){_0x285e95[_0xf67a('0x37')]=qs['limit'](_0x473011[_0xf67a('0x30')]['limit']);_0x285e95[_0xf67a('0x1b')]=qs['offset'](_0x473011['query'][_0xf67a('0x1b')]);}return _0x436d6a[_0xf67a('0x4c')](_0x285e95);}})[_0xf67a('0x23')](function(_0xc064ef){if(_0xc064ef){return _0xc064ef?{'count':_0x37b3bf,'rows':_0xc064ef}:null;}})[_0xf67a('0x23')](respondWithResult(_0x4cc723,null))[_0xf67a('0x43')](handleError(_0x4cc723,null));};exports[_0xf67a('0x4e')]=function(_0x742a77,_0x1b1ac0,_0x366ec){var _0xa15b7d={};var _0x29633a={};var _0x5bedde;var _0x54ebb3;return db[_0xf67a('0x2b')][_0xf67a('0x49')]({'where':{'id':_0x742a77[_0xf67a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b1ac0,null))[_0xf67a('0x23')](function(_0x4b3a7d){if(_0x4b3a7d){_0x5bedde=_0x4b3a7d;_0x29633a[_0xf67a('0x2e')]=_[_0xf67a('0x2f')](db[_0xf67a('0x4d')][_0xf67a('0x2c')]);_0x29633a[_0xf67a('0x30')]=_[_0xf67a('0x2f')](_0x742a77[_0xf67a('0x30')]);_0x29633a[_0xf67a('0x31')]=_[_0xf67a('0x32')](_0x29633a[_0xf67a('0x2e')],_0x29633a['query']);_0xa15b7d[_0xf67a('0x33')]=_[_0xf67a('0x32')](_0x29633a[_0xf67a('0x2e')],qs[_0xf67a('0x34')](_0x742a77['query'][_0xf67a('0x34')]));_0xa15b7d[_0xf67a('0x33')]=_0xa15b7d[_0xf67a('0x33')][_0xf67a('0x35')]?_0xa15b7d[_0xf67a('0x33')]:_0x29633a['model'];_0xa15b7d[_0xf67a('0x38')]=qs[_0xf67a('0x39')](_0x742a77['query'][_0xf67a('0x39')]);_0xa15b7d['where']=qs[_0xf67a('0x31')](_[_0xf67a('0x4a')](_0x742a77['query'],_0x29633a['filters']));if(_0x742a77[_0xf67a('0x30')][_0xf67a('0x3a')]){_0xa15b7d['where']=_[_0xf67a('0x3c')](_0xa15b7d[_0xf67a('0x3b')],{'$or':_[_0xf67a('0x2a')](_0xa15b7d[_0xf67a('0x33')],function(_0x49b0c6){var _0x3ad78a={};_0x3ad78a[_0x49b0c6]={'$like':'%'+_0x742a77[_0xf67a('0x30')]['filter']+'%'};return _0x3ad78a;})});}_0xa15b7d=_[_0xf67a('0x3c')]({},_0xa15b7d,_0x742a77[_0xf67a('0x3e')]);return _0x5bedde[_0xf67a('0x4e')](_0xa15b7d);}})['then'](function(_0x5e589e){if(_0x5e589e){_0x54ebb3=_0x5e589e[_0xf67a('0x35')];if(!_0x742a77['query'][_0xf67a('0x4b')](_0xf67a('0x36'))){_0xa15b7d[_0xf67a('0x37')]=qs[_0xf67a('0x37')](_0x742a77[_0xf67a('0x30')][_0xf67a('0x37')]);_0xa15b7d[_0xf67a('0x1b')]=qs[_0xf67a('0x1b')](_0x742a77[_0xf67a('0x30')][_0xf67a('0x1b')]);}return _0x5bedde[_0xf67a('0x4e')](_0xa15b7d);}})[_0xf67a('0x23')](function(_0x1cf438){if(_0x1cf438){return _0x1cf438?{'count':_0x54ebb3,'rows':_0x1cf438}:null;}})[_0xf67a('0x23')](respondWithResult(_0x1b1ac0,null))[_0xf67a('0x43')](handleError(_0x1b1ac0,null));};exports[_0xf67a('0x4f')]=function(_0x4bcc34,_0x389b24,_0x11a1f6){var _0x1d8fc8={};var _0x185efa={};var _0x1e098d;var _0x503755;return db['ZendeskConfiguration'][_0xf67a('0x49')]({'where':{'id':_0x4bcc34[_0xf67a('0x44')]['id']}})[_0xf67a('0x23')](handleEntityNotFound(_0x389b24,null))[_0xf67a('0x23')](function(_0x447c29){if(_0x447c29){_0x1e098d=_0x447c29;_0x185efa[_0xf67a('0x2e')]=_[_0xf67a('0x2f')](db[_0xf67a('0x50')][_0xf67a('0x2c')]);_0x185efa['query']=_[_0xf67a('0x2f')](_0x4bcc34[_0xf67a('0x30')]);_0x185efa['filters']=_['intersection'](_0x185efa[_0xf67a('0x2e')],_0x185efa['query']);_0x1d8fc8[_0xf67a('0x33')]=_[_0xf67a('0x32')](_0x185efa[_0xf67a('0x2e')],qs[_0xf67a('0x34')](_0x4bcc34['query'][_0xf67a('0x34')]));_0x1d8fc8[_0xf67a('0x33')]=_0x1d8fc8[_0xf67a('0x33')]['length']?_0x1d8fc8[_0xf67a('0x33')]:_0x185efa['model'];_0x1d8fc8[_0xf67a('0x38')]=qs[_0xf67a('0x39')](_0x4bcc34[_0xf67a('0x30')]['sort']);_0x1d8fc8[_0xf67a('0x3b')]=qs['filters'](_[_0xf67a('0x4a')](_0x4bcc34[_0xf67a('0x30')],_0x185efa[_0xf67a('0x31')]));if(_0x4bcc34[_0xf67a('0x30')][_0xf67a('0x3a')]){_0x1d8fc8[_0xf67a('0x3b')]=_[_0xf67a('0x3c')](_0x1d8fc8[_0xf67a('0x3b')],{'$or':_[_0xf67a('0x2a')](_0x1d8fc8[_0xf67a('0x33')],function(_0x4135e4){var _0x58f2d3={};_0x58f2d3[_0x4135e4]={'$like':'%'+_0x4bcc34[_0xf67a('0x30')][_0xf67a('0x3a')]+'%'};return _0x58f2d3;})});}_0x1d8fc8=_[_0xf67a('0x3c')]({},_0x1d8fc8,_0x4bcc34[_0xf67a('0x3e')]);return _0x1e098d[_0xf67a('0x4f')](_0x1d8fc8);}})['then'](function(_0x1c0c35){if(_0x1c0c35){_0x503755=_0x1c0c35['length'];if(!_0x4bcc34[_0xf67a('0x30')]['hasOwnProperty']('nolimit')){_0x1d8fc8[_0xf67a('0x37')]=qs[_0xf67a('0x37')](_0x4bcc34[_0xf67a('0x30')]['limit']);_0x1d8fc8[_0xf67a('0x1b')]=qs[_0xf67a('0x1b')](_0x4bcc34[_0xf67a('0x30')]['offset']);}return _0x1e098d[_0xf67a('0x4f')](_0x1d8fc8);}})[_0xf67a('0x23')](function(_0x3029b7){if(_0x3029b7){return _0x3029b7?{'count':_0x503755,'rows':_0x3029b7}:null;}})['then'](respondWithResult(_0x389b24,null))['catch'](handleError(_0x389b24,null));};exports[_0xf67a('0x51')]=function(_0x3a7f0e,_0x33d765,_0x488f75){if(_0x3a7f0e[_0xf67a('0x46')]['id']){delete _0x3a7f0e[_0xf67a('0x46')]['id'];}return db['ZendeskConfiguration'][_0xf67a('0x49')]({'where':{'id':_0x3a7f0e[_0xf67a('0x44')]['id']}})[_0xf67a('0x23')](handleEntityNotFound(_0x33d765,null))[_0xf67a('0x23')](function(_0x377486){if(_0x377486){return _0x377486['setTags'](_0x3a7f0e[_0xf67a('0x46')][_0xf67a('0x52')]||[]);}return null;})[_0xf67a('0x23')](respondWithResult(_0x33d765,null))['catch'](handleError(_0x33d765,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b14bcce..516f5d5 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 _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x21deb4,_0xf0afcc){var _0x2b3858=function(_0x2224a7){while(--_0x2224a7){_0x21deb4['push'](_0x21deb4['shift']());}};_0x2b3858(++_0xf0afcc);}(_0xefda,0x96));var _0xaefd=function(_0xddf898,_0x505284){_0xddf898=_0xddf898-0x0;var _0x1017c3=_0xefda[_0xddf898];return _0x1017c3;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x160f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','int_zendesk_configurations'];(function(_0x51879d,_0x48a0b1){var _0x347ec5=function(_0x1934af){while(--_0x1934af){_0x51879d['push'](_0x51879d['shift']());}};_0x347ec5(++_0x48a0b1);}(_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 logger=require(_0xf160('0x2'))(_0xf160('0x3'));var moment=require('moment');var BPromise=require(_0xf160('0x4'));var rp=require(_0xf160('0x5'));var fs=require('fs');var path=require(_0xf160('0x6'));var rimraf=require(_0xf160('0x7'));var config=require(_0xf160('0x8'));var attributes=require(_0xf160('0x9'));module['exports']=function(_0x311d63,_0x11902f){return _0x311d63['define']('ZendeskConfiguration',attributes,{'tableName':_0xf160('0xa'),'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 881bdf9..af0d733 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 _0xf921=['request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32ee89,_0x2ba492){var _0x10e742=function(_0x192335){while(--_0x192335){_0x32ee89['push'](_0x32ee89['shift']());}};_0x10e742(++_0x2ba492);}(_0xf921,0xfd));var _0x1f92=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xf921[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0x1f92('0x0'));var util=require(_0x1f92('0x1'));var moment=require(_0x1f92('0x2'));var BPromise=require(_0x1f92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f92('0x4'));var db=require(_0x1f92('0x5'))['db'];var utils=require(_0x1f92('0x6'));var logger=require(_0x1f92('0x7'))(_0x1f92('0x8'));var config=require(_0x1f92('0x9'));var jayson=require(_0x1f92('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x241bbe,_0x36904b,_0xd77eb4){return new BPromise(function(_0x221004,_0x494461){return client[_0x1f92('0xb')](_0x241bbe,_0xd77eb4)['then'](function(_0x565be9){logger[_0x1f92('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36904b,'request\x20sent');logger[_0x1f92('0xd')](_0x1f92('0xe'),_0x36904b,_0x1f92('0xf'),JSON[_0x1f92('0x10')](_0x565be9));if(_0x565be9[_0x1f92('0x11')]){if(_0x565be9[_0x1f92('0x11')][_0x1f92('0x12')]===0x1f4){logger['error'](_0x1f92('0x13'),_0x36904b,_0x565be9['error'][_0x1f92('0x14')]);return _0x494461(_0x565be9[_0x1f92('0x11')]['message']);}logger['error'](_0x1f92('0x13'),_0x36904b,_0x565be9[_0x1f92('0x11')][_0x1f92('0x14')]);return _0x221004(_0x565be9[_0x1f92('0x11')][_0x1f92('0x14')]);}else{logger[_0x1f92('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36904b,_0x1f92('0xf'));_0x221004(_0x565be9['result']['message']);}})[_0x1f92('0x15')](function(_0x44fc58){logger[_0x1f92('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36904b,_0x44fc58);_0x494461(_0x44fc58);});});} \ No newline at end of file +var _0x8ac6=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x232bd7,_0x247b6b){var _0x58310c=function(_0x562c13){while(--_0x562c13){_0x232bd7['push'](_0x232bd7['shift']());}};_0x58310c(++_0x247b6b);}(_0x8ac6,0x92));var _0x68ac=function(_0x219dbf,_0xd31643){_0x219dbf=_0x219dbf-0x0;var _0x584202=_0x8ac6[_0x219dbf];return _0x584202;};'use strict';var _=require(_0x68ac('0x0'));var util=require(_0x68ac('0x1'));var moment=require(_0x68ac('0x2'));var BPromise=require(_0x68ac('0x3'));var rs=require(_0x68ac('0x4'));var fs=require('fs');var Redis=require(_0x68ac('0x5'));var db=require(_0x68ac('0x6'))['db'];var utils=require(_0x68ac('0x7'));var logger=require('../../config/logger')(_0x68ac('0x8'));var config=require(_0x68ac('0x9'));var jayson=require(_0x68ac('0xa'));var client=jayson[_0x68ac('0xb')][_0x68ac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb78fc7,_0xba3a40,_0x5514cf){return new BPromise(function(_0x203f46,_0x6fba7f){return client[_0x68ac('0xd')](_0xb78fc7,_0x5514cf)[_0x68ac('0xe')](function(_0x4c3aba){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0xba3a40,_0x68ac('0xf'));logger['debug'](_0x68ac('0x10'),_0xba3a40,_0x68ac('0xf'),JSON[_0x68ac('0x11')](_0x4c3aba));if(_0x4c3aba[_0x68ac('0x12')]){if(_0x4c3aba[_0x68ac('0x12')][_0x68ac('0x13')]===0x1f4){logger[_0x68ac('0x12')](_0x68ac('0x14'),_0xba3a40,_0x4c3aba[_0x68ac('0x12')][_0x68ac('0x15')]);return _0x6fba7f(_0x4c3aba[_0x68ac('0x12')][_0x68ac('0x15')]);}logger[_0x68ac('0x12')](_0x68ac('0x14'),_0xba3a40,_0x4c3aba[_0x68ac('0x12')]['message']);return _0x203f46(_0x4c3aba['error'][_0x68ac('0x15')]);}else{logger[_0x68ac('0x16')](_0x68ac('0x14'),_0xba3a40,_0x68ac('0xf'));_0x203f46(_0x4c3aba[_0x68ac('0x17')][_0x68ac('0x15')]);}})[_0x68ac('0x18')](function(_0xee3f6f){logger[_0x68ac('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0xba3a40,_0xee3f6f);_0x6fba7f(_0xee3f6f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index eab2688..7f1843e 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 _0x2a30=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x5ad512,_0x16aec4){var _0x34180a=function(_0x1c1ab6){while(--_0x1c1ab6){_0x5ad512['push'](_0x5ad512['shift']());}};_0x34180a(++_0x16aec4);}(_0x2a30,0x1dd));var _0x02a3=function(_0x52852c,_0x27f53a){_0x52852c=_0x52852c-0x0;var _0x245a12=_0x2a30[_0x52852c];return _0x245a12;};'use strict';var multer=require(_0x02a3('0x0'));var util=require(_0x02a3('0x1'));var path=require(_0x02a3('0x2'));var timeout=require(_0x02a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x02a3('0x4'));var interaction=require(_0x02a3('0x5'));var config=require(_0x02a3('0x6'));var controller=require('./intZendeskField.controller');router[_0x02a3('0x7')]('/',auth[_0x02a3('0x8')](),controller[_0x02a3('0x9')]);router[_0x02a3('0x7')](_0x02a3('0xa'),auth[_0x02a3('0x8')](),controller['show']);router['post']('/',auth[_0x02a3('0x8')](),controller[_0x02a3('0xb')]);router[_0x02a3('0xc')](_0x02a3('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x02a3('0xd')](_0x02a3('0xa'),auth[_0x02a3('0x8')](),controller[_0x02a3('0xe')]);module[_0x02a3('0xf')]=router; \ No newline at end of file +var _0x2ffa=['/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskField.controller','isAuthenticated'];(function(_0x2b8b91,_0x3cab36){var _0xc6e4ce=function(_0x20b7ce){while(--_0x20b7ce){_0x2b8b91['push'](_0x2b8b91['shift']());}};_0xc6e4ce(++_0x3cab36);}(_0x2ffa,0x189));var _0xa2ff=function(_0x2ea9d4,_0x492718){_0x2ea9d4=_0x2ea9d4-0x0;var _0x469ac4=_0x2ffa[_0x2ea9d4];return _0x469ac4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa2ff('0x0'));var express=require(_0xa2ff('0x1'));var router=express[_0xa2ff('0x2')]();var fs_extra=require(_0xa2ff('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa2ff('0x4'));var controller=require(_0xa2ff('0x5'));router['get']('/',auth[_0xa2ff('0x6')](),controller['index']);router['get'](_0xa2ff('0x7'),auth[_0xa2ff('0x6')](),controller[_0xa2ff('0x8')]);router[_0xa2ff('0x9')]('/',auth['isAuthenticated'](),controller[_0xa2ff('0xa')]);router[_0xa2ff('0xb')](_0xa2ff('0x7'),auth[_0xa2ff('0x6')](),controller[_0xa2ff('0xc')]);router[_0xa2ff('0xd')]('/:id',auth[_0xa2ff('0x6')](),controller[_0xa2ff('0xe')]);module[_0xa2ff('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index efea63f..7aeca8d 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 _0xed61=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed61,0x162));var _0x1ed6=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0xed61[_0xeaba4b];return _0x32f4fd;};'use strict';var Sequelize=require(_0x1ed6('0x0'));module['exports']={'type':{'type':Sequelize[_0x1ed6('0x1')](_0x1ed6('0x2'),_0x1ed6('0x3'),_0x1ed6('0x4'),'keyValue','picklist'),'defaultValue':_0x1ed6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1ed6('0x5')]},'keyType':{'type':Sequelize[_0x1ed6('0x1')]('string',_0x1ed6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1ed6('0x5')]},'idField':{'type':Sequelize[_0x1ed6('0x5')]},'nameField':{'type':Sequelize[_0x1ed6('0x5')]},'customField':{'type':Sequelize[_0x1ed6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ed6('0x5')]}}; \ No newline at end of file +var _0xaa15=['variable','customVariable','keyValue','STRING','BOOLEAN','ENUM','string'];(function(_0x4ec550,_0xee9cf){var _0x1f24e3=function(_0x59d212){while(--_0x59d212){_0x4ec550['push'](_0x4ec550['shift']());}};_0x1f24e3(++_0xee9cf);}(_0xaa15,0x1d3));var _0x5aa1=function(_0x125250,_0x23ba4d){_0x125250=_0x125250-0x0;var _0x926c4c=_0xaa15[_0x125250];return _0x926c4c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5aa1('0x0')](_0x5aa1('0x1'),_0x5aa1('0x2'),_0x5aa1('0x3'),_0x5aa1('0x4'),'picklist'),'defaultValue':_0x5aa1('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5aa1('0x5')]},'keyType':{'type':Sequelize[_0x5aa1('0x0')](_0x5aa1('0x1'),_0x5aa1('0x2'),_0x5aa1('0x3'))},'keyContent':{'type':Sequelize[_0x5aa1('0x5')]},'idField':{'type':Sequelize[_0x5aa1('0x5')]},'nameField':{'type':Sequelize[_0x5aa1('0x5')]},'customField':{'type':Sequelize[_0x5aa1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5aa1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 3ace852..cf7ac23 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 _0xf0da=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','create','body'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0xf0da,0xe4));var _0xaf0d=function(_0x25cdfc,_0x4531c8){_0x25cdfc=_0x25cdfc-0x0;var _0x10e740=_0xf0da[_0x25cdfc];return _0x10e740;};'use strict';var emlformat=require(_0xaf0d('0x0'));var rimraf=require(_0xaf0d('0x1'));var zipdir=require(_0xaf0d('0x2'));var jsonpatch=require(_0xaf0d('0x3'));var rp=require(_0xaf0d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf0d('0x5'));var util=require(_0xaf0d('0x6'));var path=require(_0xaf0d('0x7'));var sox=require(_0xaf0d('0x8'));var csv=require('to-csv');var ejs=require(_0xaf0d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf0d('0xa'));var squel=require(_0xaf0d('0xb'));var crypto=require(_0xaf0d('0xc'));var jsforce=require(_0xaf0d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaf0d('0xe'));var querystring=require('querystring');var Papa=require(_0xaf0d('0xf'));var Redis=require(_0xaf0d('0x10'));var authService=require(_0xaf0d('0x11'));var qs=require(_0xaf0d('0x12'));var as=require(_0xaf0d('0x13'));var hardwareService=require(_0xaf0d('0x14'));var logger=require('../../config/logger')(_0xaf0d('0x15'));var utils=require(_0xaf0d('0x16'));var config=require(_0xaf0d('0x17'));var licenseUtil=require(_0xaf0d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3819b3,_0x4e0456){_0x4e0456=_0x4e0456||0xcc;return function(_0x362aaf){if(_0x362aaf){return _0x3819b3['sendStatus'](_0x4e0456);}return _0x3819b3[_0xaf0d('0x19')](_0x4e0456)[_0xaf0d('0x1a')]();};}function respondWithResult(_0x2fd3dd,_0x19e09a){_0x19e09a=_0x19e09a||0xc8;return function(_0x13d696){if(_0x13d696){return _0x2fd3dd[_0xaf0d('0x19')](_0x19e09a)[_0xaf0d('0x1b')](_0x13d696);}};}function respondWithFilteredResult(_0x35fba6,_0x30de1d){return function(_0x384193){if(_0x384193){var _0x3309f8=typeof _0x30de1d[_0xaf0d('0x1c')]===_0xaf0d('0x1d')&&typeof _0x30de1d[_0xaf0d('0x1e')]==='undefined';var _0x48fd51=_0x384193[_0xaf0d('0x1f')];var _0x3d17d0=_0x3309f8?0x0:_0x30de1d[_0xaf0d('0x1c')];var _0x11405c=_0x3309f8?_0x384193[_0xaf0d('0x1f')]:_0x30de1d[_0xaf0d('0x1c')]+_0x30de1d['limit'];var _0x2ef1c7;if(_0x11405c>=_0x48fd51){_0x11405c=_0x48fd51;_0x2ef1c7=0xc8;}else{_0x2ef1c7=0xce;}_0x35fba6[_0xaf0d('0x19')](_0x2ef1c7);return _0x35fba6[_0xaf0d('0x20')]('Content-Range',_0x3d17d0+'-'+_0x11405c+'/'+_0x48fd51)['json'](_0x384193);}return null;};}function patchUpdates(_0x1afe72){return function(_0x56754a){try{jsonpatch[_0xaf0d('0x21')](_0x56754a,_0x1afe72,!![]);}catch(_0x19163b){return BPromise[_0xaf0d('0x22')](_0x19163b);}return _0x56754a[_0xaf0d('0x23')]();};}function saveUpdates(_0x1d8504,_0x55675d){return function(_0x4a9454){if(_0x4a9454){return _0x4a9454[_0xaf0d('0x24')](_0x1d8504)['then'](function(_0x2a3954){return _0x2a3954;});}return null;};}function removeEntity(_0x393424,_0xb3498){return function(_0x27fac2){if(_0x27fac2){return _0x27fac2[_0xaf0d('0x25')]()[_0xaf0d('0x26')](function(){_0x393424[_0xaf0d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c463d,_0x41fa6b){return function(_0x416638){if(!_0x416638){_0x2c463d[_0xaf0d('0x27')](0x194);}return _0x416638;};}function handleError(_0x635105,_0x4f3aa5){_0x4f3aa5=_0x4f3aa5||0x1f4;return function(_0x208637){logger[_0xaf0d('0x28')](_0x208637['stack']);if(_0x208637[_0xaf0d('0x29')]){delete _0x208637['name'];}_0x635105[_0xaf0d('0x19')](_0x4f3aa5)[_0xaf0d('0x2a')](_0x208637);};}exports['index']=function(_0x1c036e,_0x2ba067){var _0xeb2690={},_0x3f7e7c={},_0x30498e={'count':0x0,'rows':[]};var _0x514bd2=_[_0xaf0d('0x2b')](db[_0xaf0d('0x2c')][_0xaf0d('0x2d')],function(_0x156d49){return{'name':_0x156d49[_0xaf0d('0x2e')],'type':_0x156d49[_0xaf0d('0x2f')][_0xaf0d('0x30')]};});_0x3f7e7c[_0xaf0d('0x31')]=_[_0xaf0d('0x2b')](_0x514bd2,_0xaf0d('0x29'));_0x3f7e7c[_0xaf0d('0x32')]=_['keys'](_0x1c036e[_0xaf0d('0x32')]);_0x3f7e7c['filters']=_[_0xaf0d('0x33')](_0x3f7e7c[_0xaf0d('0x31')],_0x3f7e7c[_0xaf0d('0x32')]);_0xeb2690[_0xaf0d('0x34')]=_[_0xaf0d('0x33')](_0x3f7e7c[_0xaf0d('0x31')],qs[_0xaf0d('0x35')](_0x1c036e['query']['fields']));_0xeb2690['attributes']=_0xeb2690[_0xaf0d('0x34')][_0xaf0d('0x36')]?_0xeb2690['attributes']:_0x3f7e7c[_0xaf0d('0x31')];if(!_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x37')](_0xaf0d('0x38'))){_0xeb2690[_0xaf0d('0x1e')]=qs[_0xaf0d('0x1e')](_0x1c036e['query'][_0xaf0d('0x1e')]);_0xeb2690[_0xaf0d('0x1c')]=qs[_0xaf0d('0x1c')](_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x1c')]);}_0xeb2690[_0xaf0d('0x39')]=qs['sort'](_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x3a')]);_0xeb2690[_0xaf0d('0x3b')]=qs['filters'](_[_0xaf0d('0x3c')](_0x1c036e['query'],_0x3f7e7c[_0xaf0d('0x3d')]),_0x514bd2);if(_0x1c036e[_0xaf0d('0x32')][_0xaf0d('0x3e')]){_0xeb2690[_0xaf0d('0x3b')]=_[_0xaf0d('0x3f')](_0xeb2690['where'],{'$or':_['map'](_0x514bd2,function(_0x219c25){if(_0x219c25[_0xaf0d('0x2f')]!==_0xaf0d('0x40')){var _0x34135a={};_0x34135a[_0x219c25[_0xaf0d('0x29')]]={'$like':'%'+_0x1c036e['query'][_0xaf0d('0x3e')]+'%'};return _0x34135a;}})});}_0xeb2690=_['merge']({},_0xeb2690,_0x1c036e[_0xaf0d('0x41')]);var _0x309a14={'where':_0xeb2690[_0xaf0d('0x3b')]};return db[_0xaf0d('0x2c')][_0xaf0d('0x1f')](_0x309a14)[_0xaf0d('0x26')](function(_0x570900){_0x30498e[_0xaf0d('0x1f')]=_0x570900;if(_0x1c036e[_0xaf0d('0x32')]['includeAll']){_0xeb2690['include']=[{'all':!![]}];}return db[_0xaf0d('0x2c')][_0xaf0d('0x42')](_0xeb2690);})[_0xaf0d('0x26')](function(_0x22e9fd){_0x30498e[_0xaf0d('0x43')]=_0x22e9fd;return _0x30498e;})['then'](respondWithFilteredResult(_0x2ba067,_0xeb2690))[_0xaf0d('0x44')](handleError(_0x2ba067,null));};exports[_0xaf0d('0x45')]=function(_0x1667c6,_0x5bb6e4){var _0x3d8e54={'raw':!![],'where':{'id':_0x1667c6[_0xaf0d('0x46')]['id']}},_0x2e705e={};_0x2e705e[_0xaf0d('0x31')]=_['keys'](db['ZendeskField'][_0xaf0d('0x2d')]);_0x2e705e[_0xaf0d('0x32')]=_[_0xaf0d('0x47')](_0x1667c6[_0xaf0d('0x32')]);_0x2e705e[_0xaf0d('0x3d')]=_[_0xaf0d('0x33')](_0x2e705e[_0xaf0d('0x31')],_0x2e705e[_0xaf0d('0x32')]);_0x3d8e54['attributes']=_[_0xaf0d('0x33')](_0x2e705e[_0xaf0d('0x31')],qs[_0xaf0d('0x35')](_0x1667c6['query'][_0xaf0d('0x35')]));_0x3d8e54[_0xaf0d('0x34')]=_0x3d8e54[_0xaf0d('0x34')][_0xaf0d('0x36')]?_0x3d8e54[_0xaf0d('0x34')]:_0x2e705e[_0xaf0d('0x31')];if(_0x1667c6[_0xaf0d('0x32')][_0xaf0d('0x48')]){_0x3d8e54[_0xaf0d('0x49')]=[{'all':!![]}];}_0x3d8e54=_[_0xaf0d('0x3f')]({},_0x3d8e54,_0x1667c6[_0xaf0d('0x41')]);return db[_0xaf0d('0x2c')]['find'](_0x3d8e54)[_0xaf0d('0x26')](handleEntityNotFound(_0x5bb6e4,null))[_0xaf0d('0x26')](respondWithResult(_0x5bb6e4,null))[_0xaf0d('0x44')](handleError(_0x5bb6e4,null));};exports[_0xaf0d('0x4a')]=function(_0x5328a2,_0x1e5352){return db[_0xaf0d('0x2c')][_0xaf0d('0x4a')](_0x5328a2[_0xaf0d('0x4b')],{})[_0xaf0d('0x26')](respondWithResult(_0x1e5352,0xc9))[_0xaf0d('0x44')](handleError(_0x1e5352,null));};exports[_0xaf0d('0x24')]=function(_0x376460,_0x3bad38){if(_0x376460[_0xaf0d('0x4b')]['id']){delete _0x376460['body']['id'];}return db[_0xaf0d('0x2c')]['find']({'where':{'id':_0x376460['params']['id']}})[_0xaf0d('0x26')](handleEntityNotFound(_0x3bad38,null))[_0xaf0d('0x26')](saveUpdates(_0x376460[_0xaf0d('0x4b')],null))[_0xaf0d('0x26')](respondWithResult(_0x3bad38,null))[_0xaf0d('0x44')](handleError(_0x3bad38,null));};exports[_0xaf0d('0x25')]=function(_0x101e4a,_0x36b394){return db[_0xaf0d('0x2c')]['find']({'where':{'id':_0x101e4a[_0xaf0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x36b394,null))['then'](removeEntity(_0x36b394,null))[_0xaf0d('0x44')](handleError(_0x36b394,null));}; \ No newline at end of file +var _0x7220=['set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','ZendeskField','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x46f690,_0x571be0){var _0x52319d=function(_0x21648d){while(--_0x21648d){_0x46f690['push'](_0x46f690['shift']());}};_0x52319d(++_0x571be0);}(_0x7220,0x14d));var _0x0722=function(_0x405372,_0x2276ed){_0x405372=_0x405372-0x0;var _0x3a5a9b=_0x7220[_0x405372];return _0x3a5a9b;};'use strict';var emlformat=require(_0x0722('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0722('0x1'));var jsonpatch=require(_0x0722('0x2'));var rp=require(_0x0722('0x3'));var moment=require(_0x0722('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0722('0x5'));var util=require('util');var path=require(_0x0722('0x6'));var sox=require(_0x0722('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0722('0x8'));var _=require(_0x0722('0x9'));var squel=require(_0x0722('0xa'));var crypto=require(_0x0722('0xb'));var jsforce=require(_0x0722('0xc'));var deskjs=require(_0x0722('0xd'));var toCsv=require(_0x0722('0xe'));var querystring=require(_0x0722('0xf'));var Papa=require(_0x0722('0x10'));var Redis=require(_0x0722('0x11'));var authService=require(_0x0722('0x12'));var qs=require(_0x0722('0x13'));var as=require(_0x0722('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0722('0x15'));var utils=require(_0x0722('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0722('0x17'));var db=require(_0x0722('0x18'))['db'];function respondWithStatusCode(_0x3ee2ee,_0x228fe0){_0x228fe0=_0x228fe0||0xcc;return function(_0x119003){if(_0x119003){return _0x3ee2ee['sendStatus'](_0x228fe0);}return _0x3ee2ee[_0x0722('0x19')](_0x228fe0)[_0x0722('0x1a')]();};}function respondWithResult(_0x2cca09,_0x1e750f){_0x1e750f=_0x1e750f||0xc8;return function(_0x1d59d4){if(_0x1d59d4){return _0x2cca09[_0x0722('0x19')](_0x1e750f)[_0x0722('0x1b')](_0x1d59d4);}};}function respondWithFilteredResult(_0xf4b291,_0x41b239){return function(_0x3f27d4){if(_0x3f27d4){var _0x2d993f=typeof _0x41b239[_0x0722('0x1c')]===_0x0722('0x1d')&&typeof _0x41b239[_0x0722('0x1e')]===_0x0722('0x1d');var _0x346f15=_0x3f27d4[_0x0722('0x1f')];var _0x3fee44=_0x2d993f?0x0:_0x41b239[_0x0722('0x1c')];var _0x3cdaa3=_0x2d993f?_0x3f27d4[_0x0722('0x1f')]:_0x41b239[_0x0722('0x1c')]+_0x41b239['limit'];var _0x17c71a;if(_0x3cdaa3>=_0x346f15){_0x3cdaa3=_0x346f15;_0x17c71a=0xc8;}else{_0x17c71a=0xce;}_0xf4b291[_0x0722('0x19')](_0x17c71a);return _0xf4b291[_0x0722('0x20')](_0x0722('0x21'),_0x3fee44+'-'+_0x3cdaa3+'/'+_0x346f15)[_0x0722('0x1b')](_0x3f27d4);}return null;};}function patchUpdates(_0x23bb85){return function(_0x5e9ad5){try{jsonpatch[_0x0722('0x22')](_0x5e9ad5,_0x23bb85,!![]);}catch(_0x276b2b){return BPromise['reject'](_0x276b2b);}return _0x5e9ad5[_0x0722('0x23')]();};}function saveUpdates(_0x4fc58a,_0x56f7f6){return function(_0x49314d){if(_0x49314d){return _0x49314d[_0x0722('0x24')](_0x4fc58a)['then'](function(_0xcf0b0d){return _0xcf0b0d;});}return null;};}function removeEntity(_0x2f8289,_0x3ada37){return function(_0x54c111){if(_0x54c111){return _0x54c111[_0x0722('0x25')]()[_0x0722('0x26')](function(){_0x2f8289[_0x0722('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443c99,_0x48d7d9){return function(_0x22cd3f){if(!_0x22cd3f){_0x443c99[_0x0722('0x27')](0x194);}return _0x22cd3f;};}function handleError(_0x578956,_0x2d6d80){_0x2d6d80=_0x2d6d80||0x1f4;return function(_0x7118e6){logger[_0x0722('0x28')](_0x7118e6[_0x0722('0x29')]);if(_0x7118e6['name']){delete _0x7118e6[_0x0722('0x2a')];}_0x578956[_0x0722('0x19')](_0x2d6d80)[_0x0722('0x2b')](_0x7118e6);};}exports['index']=function(_0x465bd8,_0x32da11){var _0x44bb4b={},_0x55210b={},_0x3a84f1={'count':0x0,'rows':[]};var _0x13095c=_['map'](db[_0x0722('0x2c')]['rawAttributes'],function(_0x42b02d){return{'name':_0x42b02d['fieldName'],'type':_0x42b02d['type'][_0x0722('0x2d')]};});_0x55210b[_0x0722('0x2e')]=_[_0x0722('0x2f')](_0x13095c,_0x0722('0x2a'));_0x55210b[_0x0722('0x30')]=_[_0x0722('0x31')](_0x465bd8[_0x0722('0x30')]);_0x55210b[_0x0722('0x32')]=_[_0x0722('0x33')](_0x55210b[_0x0722('0x2e')],_0x55210b['query']);_0x44bb4b['attributes']=_[_0x0722('0x33')](_0x55210b[_0x0722('0x2e')],qs[_0x0722('0x34')](_0x465bd8[_0x0722('0x30')][_0x0722('0x34')]));_0x44bb4b['attributes']=_0x44bb4b[_0x0722('0x35')][_0x0722('0x36')]?_0x44bb4b['attributes']:_0x55210b[_0x0722('0x2e')];if(!_0x465bd8[_0x0722('0x30')]['hasOwnProperty'](_0x0722('0x37'))){_0x44bb4b['limit']=qs[_0x0722('0x1e')](_0x465bd8[_0x0722('0x30')][_0x0722('0x1e')]);_0x44bb4b['offset']=qs['offset'](_0x465bd8[_0x0722('0x30')][_0x0722('0x1c')]);}_0x44bb4b[_0x0722('0x38')]=qs[_0x0722('0x39')](_0x465bd8[_0x0722('0x30')][_0x0722('0x39')]);_0x44bb4b['where']=qs[_0x0722('0x32')](_[_0x0722('0x3a')](_0x465bd8[_0x0722('0x30')],_0x55210b[_0x0722('0x32')]),_0x13095c);if(_0x465bd8[_0x0722('0x30')][_0x0722('0x3b')]){_0x44bb4b[_0x0722('0x3c')]=_[_0x0722('0x3d')](_0x44bb4b[_0x0722('0x3c')],{'$or':_[_0x0722('0x2f')](_0x13095c,function(_0x512cf0){if(_0x512cf0[_0x0722('0x3e')]!==_0x0722('0x3f')){var _0x3f1d39={};_0x3f1d39[_0x512cf0[_0x0722('0x2a')]]={'$like':'%'+_0x465bd8[_0x0722('0x30')]['filter']+'%'};return _0x3f1d39;}})});}_0x44bb4b=_[_0x0722('0x3d')]({},_0x44bb4b,_0x465bd8['options']);var _0x2b3ebd={'where':_0x44bb4b[_0x0722('0x3c')]};return db[_0x0722('0x2c')]['count'](_0x2b3ebd)['then'](function(_0x6f7fbc){_0x3a84f1[_0x0722('0x1f')]=_0x6f7fbc;if(_0x465bd8['query'][_0x0722('0x40')]){_0x44bb4b[_0x0722('0x41')]=[{'all':!![]}];}return db[_0x0722('0x2c')]['findAll'](_0x44bb4b);})['then'](function(_0x295777){_0x3a84f1[_0x0722('0x42')]=_0x295777;return _0x3a84f1;})['then'](respondWithFilteredResult(_0x32da11,_0x44bb4b))[_0x0722('0x43')](handleError(_0x32da11,null));};exports[_0x0722('0x44')]=function(_0x2e6ed7,_0x5d3a12){var _0x50d7f9={'raw':!![],'where':{'id':_0x2e6ed7[_0x0722('0x45')]['id']}},_0x44a72d={};_0x44a72d[_0x0722('0x2e')]=_[_0x0722('0x31')](db[_0x0722('0x2c')][_0x0722('0x46')]);_0x44a72d['query']=_[_0x0722('0x31')](_0x2e6ed7[_0x0722('0x30')]);_0x44a72d[_0x0722('0x32')]=_[_0x0722('0x33')](_0x44a72d[_0x0722('0x2e')],_0x44a72d[_0x0722('0x30')]);_0x50d7f9[_0x0722('0x35')]=_[_0x0722('0x33')](_0x44a72d[_0x0722('0x2e')],qs[_0x0722('0x34')](_0x2e6ed7['query'][_0x0722('0x34')]));_0x50d7f9['attributes']=_0x50d7f9['attributes'][_0x0722('0x36')]?_0x50d7f9[_0x0722('0x35')]:_0x44a72d[_0x0722('0x2e')];if(_0x2e6ed7[_0x0722('0x30')][_0x0722('0x40')]){_0x50d7f9[_0x0722('0x41')]=[{'all':!![]}];}_0x50d7f9=_[_0x0722('0x3d')]({},_0x50d7f9,_0x2e6ed7['options']);return db[_0x0722('0x2c')][_0x0722('0x47')](_0x50d7f9)[_0x0722('0x26')](handleEntityNotFound(_0x5d3a12,null))['then'](respondWithResult(_0x5d3a12,null))['catch'](handleError(_0x5d3a12,null));};exports['create']=function(_0x33afc8,_0x3ed868){return db[_0x0722('0x2c')]['create'](_0x33afc8['body'],{})[_0x0722('0x26')](respondWithResult(_0x3ed868,0xc9))[_0x0722('0x43')](handleError(_0x3ed868,null));};exports['update']=function(_0x873e8b,_0xe0b89e){if(_0x873e8b['body']['id']){delete _0x873e8b[_0x0722('0x48')]['id'];}return db['ZendeskField'][_0x0722('0x47')]({'where':{'id':_0x873e8b['params']['id']}})['then'](handleEntityNotFound(_0xe0b89e,null))[_0x0722('0x26')](saveUpdates(_0x873e8b['body'],null))[_0x0722('0x26')](respondWithResult(_0xe0b89e,null))[_0x0722('0x43')](handleError(_0xe0b89e,null));};exports[_0x0722('0x25')]=function(_0x5a8907,_0x4057b2){return db[_0x0722('0x2c')][_0x0722('0x47')]({'where':{'id':_0x5a8907['params']['id']}})[_0x0722('0x26')](handleEntityNotFound(_0x4057b2,null))['then'](removeEntity(_0x4057b2,null))[_0x0722('0x43')](handleError(_0x4057b2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 38d8c8a..0c00961 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 _0xaa19=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaa19,0x14e));var _0x9aa1=function(_0x1ce8f7,_0x43ed1d){_0x1ce8f7=_0x1ce8f7-0x0;var _0x5cc47c=_0xaa19[_0x1ce8f7];return _0x5cc47c;};'use strict';var _=require(_0x9aa1('0x0'));var util=require('util');var logger=require(_0x9aa1('0x1'))('api');var moment=require(_0x9aa1('0x2'));var BPromise=require(_0x9aa1('0x3'));var rp=require(_0x9aa1('0x4'));var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require(_0x9aa1('0x6'));var config=require('../../config/environment');var attributes=require(_0x9aa1('0x7'));module[_0x9aa1('0x8')]=function(_0x5e1733,_0x53ada5){return _0x5e1733[_0x9aa1('0x9')](_0x9aa1('0xa'),attributes,{'tableName':_0x9aa1('0xb'),'paranoid':![],'indexes':[{'name':_0x9aa1('0xc'),'fields':[_0x9aa1('0xd'),_0x9aa1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21ad=['FieldId','lodash','moment','request-promise','path','rimraf','../../config/environment','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0xf0c56a,_0x5a0beb){var _0x23b4ac=function(_0x27a33f){while(--_0x27a33f){_0xf0c56a['push'](_0xf0c56a['shift']());}};_0x23b4ac(++_0x5a0beb);}(_0x21ad,0x9b));var _0xd21a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x21ad[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xd21a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd21a('0x1'));var BPromise=require('bluebird');var rp=require(_0xd21a('0x2'));var fs=require('fs');var path=require(_0xd21a('0x3'));var rimraf=require(_0xd21a('0x4'));var config=require(_0xd21a('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0xe72a6d,_0x12a910){return _0xe72a6d['define'](_0xd21a('0x6'),attributes,{'tableName':_0xd21a('0x7'),'paranoid':![],'indexes':[{'name':_0xd21a('0x8'),'fields':[_0xd21a('0x9'),_0xd21a('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index d2b2184..6206319 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 _0x09ce=['client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3126c9,_0x14fd9d){var _0x2fd6d5=function(_0x49c145){while(--_0x49c145){_0x3126c9['push'](_0x3126c9['shift']());}};_0x2fd6d5(++_0x14fd9d);}(_0x09ce,0x1ad));var _0xe09c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x09ce[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe09c('0x0'));var util=require(_0xe09c('0x1'));var moment=require(_0xe09c('0x2'));var BPromise=require(_0xe09c('0x3'));var rs=require(_0xe09c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe09c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe09c('0x6'));var jayson=require(_0xe09c('0x7'));var client=jayson[_0xe09c('0x8')][_0xe09c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xab7e6e,_0x5f5a85,_0x48fd9d){return new BPromise(function(_0x3eb97f,_0x2f8344){return client[_0xe09c('0xa')](_0xab7e6e,_0x48fd9d)[_0xe09c('0xb')](function(_0x13ba4d){logger['info'](_0xe09c('0xc'),_0x5f5a85,_0xe09c('0xd'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5f5a85,_0xe09c('0xd'),JSON['stringify'](_0x13ba4d));if(_0x13ba4d[_0xe09c('0xe')]){if(_0x13ba4d[_0xe09c('0xe')][_0xe09c('0xf')]===0x1f4){logger[_0xe09c('0xe')]('ZendeskField,\x20%s,\x20%s',_0x5f5a85,_0x13ba4d[_0xe09c('0xe')][_0xe09c('0x10')]);return _0x2f8344(_0x13ba4d[_0xe09c('0xe')][_0xe09c('0x10')]);}logger[_0xe09c('0xe')](_0xe09c('0xc'),_0x5f5a85,_0x13ba4d['error'][_0xe09c('0x10')]);return _0x3eb97f(_0x13ba4d['error'][_0xe09c('0x10')]);}else{logger[_0xe09c('0x11')](_0xe09c('0xc'),_0x5f5a85,_0xe09c('0xd'));_0x3eb97f(_0x13ba4d['result'][_0xe09c('0x10')]);}})[_0xe09c('0x12')](function(_0x7fc36a){logger[_0xe09c('0xe')]('ZendeskField,\x20%s,\x20%s',_0x5f5a85,_0x7fc36a);_0x2f8344(_0x7fc36a);});});} \ No newline at end of file +var _0x1f91=['ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x2798a3,_0x141295){var _0x13a1e7=function(_0x57d290){while(--_0x57d290){_0x2798a3['push'](_0x2798a3['shift']());}};_0x13a1e7(++_0x141295);}(_0x1f91,0xe4));var _0x11f9=function(_0x4d8f8d,_0x1384c1){_0x4d8f8d=_0x4d8f8d-0x0;var _0x7eb23f=_0x1f91[_0x4d8f8d];return _0x7eb23f;};'use strict';var _=require(_0x11f9('0x0'));var util=require('util');var moment=require(_0x11f9('0x1'));var BPromise=require(_0x11f9('0x2'));var rs=require(_0x11f9('0x3'));var fs=require('fs');var Redis=require(_0x11f9('0x4'));var db=require(_0x11f9('0x5'))['db'];var utils=require(_0x11f9('0x6'));var logger=require(_0x11f9('0x7'))(_0x11f9('0x8'));var config=require(_0x11f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x11f9('0xa')][_0x11f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12fe39,_0x1b9afd,_0x5003a7){return new BPromise(function(_0x397eff,_0x43fe69){return client['request'](_0x12fe39,_0x5003a7)[_0x11f9('0xc')](function(_0x4bba9d){logger[_0x11f9('0xd')](_0x11f9('0xe'),_0x1b9afd,_0x11f9('0xf'));logger['debug'](_0x11f9('0x10'),_0x1b9afd,_0x11f9('0xf'),JSON[_0x11f9('0x11')](_0x4bba9d));if(_0x4bba9d[_0x11f9('0x12')]){if(_0x4bba9d['error']['code']===0x1f4){logger[_0x11f9('0x12')]('ZendeskField,\x20%s,\x20%s',_0x1b9afd,_0x4bba9d[_0x11f9('0x12')][_0x11f9('0x13')]);return _0x43fe69(_0x4bba9d[_0x11f9('0x12')]['message']);}logger['error'](_0x11f9('0xe'),_0x1b9afd,_0x4bba9d[_0x11f9('0x12')][_0x11f9('0x13')]);return _0x397eff(_0x4bba9d[_0x11f9('0x12')][_0x11f9('0x13')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x1b9afd,_0x11f9('0xf'));_0x397eff(_0x4bba9d[_0x11f9('0x14')][_0x11f9('0x13')]);}})[_0x11f9('0x15')](function(_0x4b043d){logger[_0x11f9('0x12')](_0x11f9('0xe'),_0x1b9afd,_0x4b043d);_0x43fe69(_0x4b043d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index efa27aa..1c8be72 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 _0x1a3d=['Router','fs-extra','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer','util','connect-timeout','express'];(function(_0x56bad1,_0x2af2e6){var _0x53bab9=function(_0x4fff6e){while(--_0x4fff6e){_0x56bad1['push'](_0x56bad1['shift']());}};_0x53bab9(++_0x2af2e6);}(_0x1a3d,0xce));var _0xd1a3=function(_0x2f808d,_0x55fa16){_0x2f808d=_0x2f808d-0x0;var _0x447df1=_0x1a3d[_0x2f808d];return _0x447df1;};'use strict';var multer=require(_0xd1a3('0x0'));var util=require(_0xd1a3('0x1'));var path=require('path');var timeout=require(_0xd1a3('0x2'));var express=require(_0xd1a3('0x3'));var router=express[_0xd1a3('0x4')]();var fs_extra=require(_0xd1a3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1a3('0x6'));router[_0xd1a3('0x7')]('/',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x9')]);router['get']('/:id',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0xa')]);router[_0xd1a3('0x7')](_0xd1a3('0xb'),auth['isAuthenticated'](),controller[_0xd1a3('0xc')]);router['get'](_0xd1a3('0xd'),auth[_0xd1a3('0x8')](),controller[_0xd1a3('0xe')]);router[_0xd1a3('0xf')]('/',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x10')]);router[_0xd1a3('0xf')](_0xd1a3('0xb'),auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x11')]);router[_0xd1a3('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd1a3('0x8')](),controller[_0xd1a3('0x13')]);module[_0xd1a3('0x14')]=router; \ No newline at end of file +var _0xea2f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xea2f,0x14d));var _0xfea2=function(_0xd076cf,_0xf8bc5b){_0xd076cf=_0xd076cf-0x0;var _0x43b7fb=_0xea2f[_0xd076cf];return _0x43b7fb;};'use strict';var multer=require(_0xfea2('0x0'));var util=require(_0xfea2('0x1'));var path=require(_0xfea2('0x2'));var timeout=require(_0xfea2('0x3'));var express=require(_0xfea2('0x4'));var router=express[_0xfea2('0x5')]();var fs_extra=require(_0xfea2('0x6'));var auth=require(_0xfea2('0x7'));var interaction=require(_0xfea2('0x8'));var config=require('../../config/environment');var controller=require(_0xfea2('0x9'));router[_0xfea2('0xa')]('/',auth[_0xfea2('0xb')](),controller['index']);router[_0xfea2('0xa')](_0xfea2('0xc'),auth[_0xfea2('0xb')](),controller[_0xfea2('0xd')]);router['get'](_0xfea2('0xe'),auth[_0xfea2('0xb')](),controller['getConfigurations']);router[_0xfea2('0xa')](_0xfea2('0xf'),auth['isAuthenticated'](),controller[_0xfea2('0x10')]);router[_0xfea2('0x11')]('/',auth[_0xfea2('0xb')](),controller[_0xfea2('0x12')]);router['post']('/:id/configurations',auth[_0xfea2('0xb')](),controller[_0xfea2('0x13')]);router[_0xfea2('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfea2('0x15')](_0xfea2('0xc'),auth[_0xfea2('0xb')](),controller[_0xfea2('0x16')]);module[_0xfea2('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 fb753c9..19d569f 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 _0x5636=['sequelize','exports','STRING'];(function(_0x4a7966,_0x452594){var _0x4c61ed=function(_0x3a89db){while(--_0x3a89db){_0x4a7966['push'](_0x4a7966['shift']());}};_0x4c61ed(++_0x452594);}(_0x5636,0x102));var _0x6563=function(_0x50f1c1,_0x15eb5e){_0x50f1c1=_0x50f1c1-0x0;var _0x7614f5=_0x5636[_0x50f1c1];return _0x7614f5;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','STRING'];(function(_0x2d7e09,_0x16be83){var _0x1ba707=function(_0x4d3063){while(--_0x4d3063){_0x2d7e09['push'](_0x2d7e09['shift']());}};_0x1ba707(++_0x16be83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9bd4997..26361d7 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 _0x93b0=['clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','WhoId','Call_Result','includes','api_name','system_mandatory','push','custom_field','picklist','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','count','offset','set','Content-Range','json','reject','save','then','end','sendStatus','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken'];(function(_0x2c2a50,_0x86b25b){var _0x3f88f0=function(_0x347dd1){while(--_0x347dd1){_0x2c2a50['push'](_0x2c2a50['shift']());}};_0x3f88f0(++_0x86b25b);}(_0x93b0,0x196));var _0x093b=function(_0x28c342,_0x9ab475){_0x28c342=_0x28c342-0x0;var _0x1b0ae0=_0x93b0[_0x28c342];return _0x1b0ae0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x093b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x093b('0x1'));var rp=require('request-promise');var moment=require(_0x093b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x093b('0x3'));var path=require(_0x093b('0x4'));var sox=require(_0x093b('0x5'));var csv=require('to-csv');var ejs=require(_0x093b('0x6'));var fs=require('fs');var fs_extra=require(_0x093b('0x7'));var _=require(_0x093b('0x8'));var squel=require(_0x093b('0x9'));var crypto=require(_0x093b('0xa'));var jsforce=require(_0x093b('0xb'));var deskjs=require(_0x093b('0xc'));var toCsv=require(_0x093b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x093b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x093b('0xf'));var as=require(_0x093b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x093b('0x11'));var utils=require(_0x093b('0x12'));var config=require(_0x093b('0x13'));var licenseUtil=require(_0x093b('0x14'));var db=require(_0x093b('0x15'))['db'];var integrations=require(_0x093b('0x16'));function respondWithStatusCode(_0x2885b4,_0x18d17e){_0x18d17e=_0x18d17e||0xcc;return function(_0x39a696){if(_0x39a696){return _0x2885b4['sendStatus'](_0x18d17e);}return _0x2885b4[_0x093b('0x17')](_0x18d17e)['end']();};}function respondWithResult(_0x384127,_0x5aefe7){_0x5aefe7=_0x5aefe7||0xc8;return function(_0x5d7bab){if(_0x5d7bab){return _0x384127[_0x093b('0x17')](_0x5aefe7)['json'](_0x5d7bab);}};}function respondWithFilteredResult(_0x527966,_0xef7c8d){return function(_0x4e920b){if(_0x4e920b){var _0x578e6b=typeof _0xef7c8d['offset']===_0x093b('0x18')&&typeof _0xef7c8d['limit']==='undefined';var _0x4f454d=_0x4e920b[_0x093b('0x19')];var _0x506d50=_0x578e6b?0x0:_0xef7c8d['offset'];var _0x2725fa=_0x578e6b?_0x4e920b[_0x093b('0x19')]:_0xef7c8d[_0x093b('0x1a')]+_0xef7c8d['limit'];var _0x2e0f81;if(_0x2725fa>=_0x4f454d){_0x2725fa=_0x4f454d;_0x2e0f81=0xc8;}else{_0x2e0f81=0xce;}_0x527966[_0x093b('0x17')](_0x2e0f81);return _0x527966[_0x093b('0x1b')](_0x093b('0x1c'),_0x506d50+'-'+_0x2725fa+'/'+_0x4f454d)[_0x093b('0x1d')](_0x4e920b);}return null;};}function patchUpdates(_0x580873){return function(_0x519dae){try{jsonpatch['apply'](_0x519dae,_0x580873,!![]);}catch(_0x55bb7d){return BPromise[_0x093b('0x1e')](_0x55bb7d);}return _0x519dae[_0x093b('0x1f')]();};}function saveUpdates(_0x207e78,_0x11052b){return function(_0x11cc7d){if(_0x11cc7d){return _0x11cc7d['update'](_0x207e78)[_0x093b('0x20')](function(_0x3d9b34){return _0x3d9b34;});}return null;};}function removeEntity(_0x53bf29,_0x4ae7af){return function(_0x458dfb){if(_0x458dfb){return _0x458dfb['destroy']()['then'](function(){_0x53bf29['status'](0xcc)[_0x093b('0x21')]();});}};}function handleEntityNotFound(_0x2f737c,_0x2b81a3){return function(_0x319eef){if(!_0x319eef){_0x2f737c[_0x093b('0x22')](0x194);}return _0x319eef;};}function handleError(_0x3d9403,_0xfed10){_0xfed10=_0xfed10||0x1f4;return function(_0x36728d){logger['error'](_0x36728d['stack']);if(_0x36728d[_0x093b('0x23')]){delete _0x36728d[_0x093b('0x23')];}_0x3d9403[_0x093b('0x17')](_0xfed10)[_0x093b('0x24')](_0x36728d);};}exports[_0x093b('0x25')]=function(_0x1f3d2e,_0x490ebb){var _0x7d4f73={},_0x670d1c={},_0xb30645={'count':0x0,'rows':[]};var _0x49ffb7=_[_0x093b('0x26')](db[_0x093b('0x27')][_0x093b('0x28')],function(_0x134351){return{'name':_0x134351[_0x093b('0x29')],'type':_0x134351[_0x093b('0x2a')][_0x093b('0x2b')]};});_0x670d1c[_0x093b('0x2c')]=_[_0x093b('0x26')](_0x49ffb7,_0x093b('0x23'));_0x670d1c['query']=_[_0x093b('0x2d')](_0x1f3d2e['query']);_0x670d1c[_0x093b('0x2e')]=_[_0x093b('0x2f')](_0x670d1c[_0x093b('0x2c')],_0x670d1c[_0x093b('0x30')]);_0x7d4f73[_0x093b('0x31')]=_[_0x093b('0x2f')](_0x670d1c[_0x093b('0x2c')],qs[_0x093b('0x32')](_0x1f3d2e['query'][_0x093b('0x32')]));_0x7d4f73[_0x093b('0x31')]=_0x7d4f73[_0x093b('0x31')][_0x093b('0x33')]?_0x7d4f73[_0x093b('0x31')]:_0x670d1c[_0x093b('0x2c')];if(!_0x1f3d2e['query'][_0x093b('0x34')]('nolimit')){_0x7d4f73['limit']=qs[_0x093b('0x35')](_0x1f3d2e['query'][_0x093b('0x35')]);_0x7d4f73[_0x093b('0x1a')]=qs[_0x093b('0x1a')](_0x1f3d2e[_0x093b('0x30')]['offset']);}_0x7d4f73[_0x093b('0x36')]=qs[_0x093b('0x37')](_0x1f3d2e[_0x093b('0x30')][_0x093b('0x37')]);_0x7d4f73[_0x093b('0x38')]=qs[_0x093b('0x2e')](_[_0x093b('0x39')](_0x1f3d2e[_0x093b('0x30')],_0x670d1c[_0x093b('0x2e')]),_0x49ffb7);if(_0x1f3d2e[_0x093b('0x30')][_0x093b('0x3a')]){_0x7d4f73['where']=_[_0x093b('0x3b')](_0x7d4f73[_0x093b('0x38')],{'$or':_[_0x093b('0x26')](_0x49ffb7,function(_0xb8a874){if(_0xb8a874[_0x093b('0x2a')]!==_0x093b('0x3c')){var _0x22c757={};_0x22c757[_0xb8a874['name']]={'$like':'%'+_0x1f3d2e[_0x093b('0x30')]['filter']+'%'};return _0x22c757;}})});}_0x7d4f73=_[_0x093b('0x3b')]({},_0x7d4f73,_0x1f3d2e[_0x093b('0x3d')]);var _0x3fce26={'where':_0x7d4f73[_0x093b('0x38')]};return db[_0x093b('0x27')]['count'](_0x3fce26)[_0x093b('0x20')](function(_0x1bd7f8){_0xb30645['count']=_0x1bd7f8;if(_0x1f3d2e[_0x093b('0x30')][_0x093b('0x3e')]){_0x7d4f73[_0x093b('0x3f')]=[{'all':!![]}];}return db[_0x093b('0x27')][_0x093b('0x40')](_0x7d4f73);})['then'](function(_0x163936){_0xb30645[_0x093b('0x41')]=_0x163936;return _0xb30645;})['then'](respondWithFilteredResult(_0x490ebb,_0x7d4f73))[_0x093b('0x42')](handleError(_0x490ebb,null));};exports['show']=function(_0x261cc6,_0x576ba7){var _0x228e86={'raw':![],'where':{'id':_0x261cc6[_0x093b('0x43')]['id']}},_0x46ea87={};_0x46ea87[_0x093b('0x2c')]=_[_0x093b('0x2d')](db[_0x093b('0x27')][_0x093b('0x28')]);_0x46ea87[_0x093b('0x30')]=_['keys'](_0x261cc6['query']);_0x46ea87[_0x093b('0x2e')]=_['intersection'](_0x46ea87[_0x093b('0x2c')],_0x46ea87[_0x093b('0x30')]);_0x228e86[_0x093b('0x31')]=_[_0x093b('0x2f')](_0x46ea87['model'],qs['fields'](_0x261cc6[_0x093b('0x30')][_0x093b('0x32')]));_0x228e86[_0x093b('0x31')]=_0x228e86[_0x093b('0x31')][_0x093b('0x33')]?_0x228e86[_0x093b('0x31')]:_0x46ea87[_0x093b('0x2c')];if(_0x261cc6[_0x093b('0x30')][_0x093b('0x3e')]){_0x228e86['include']=[{'all':!![]}];}_0x228e86=_[_0x093b('0x3b')]({},_0x228e86,_0x261cc6[_0x093b('0x3d')]);return db[_0x093b('0x27')][_0x093b('0x44')](_0x228e86)[_0x093b('0x20')](handleEntityNotFound(_0x576ba7,null))[_0x093b('0x20')](respondWithResult(_0x576ba7,null))[_0x093b('0x42')](handleError(_0x576ba7,null));};exports[_0x093b('0x45')]=function(_0x1b53dd,_0x4056f5){return db['ZohoAccount']['create'](_0x1b53dd[_0x093b('0x46')],{})['then'](respondWithResult(_0x4056f5,0xc9))['catch'](handleError(_0x4056f5,null));};exports[_0x093b('0x47')]=function(_0x2a09db,_0x3e89c9){if(_0x2a09db[_0x093b('0x46')]['id']){delete _0x2a09db[_0x093b('0x46')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x2a09db[_0x093b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e89c9,null))[_0x093b('0x20')](saveUpdates(_0x2a09db[_0x093b('0x46')],null))['then'](respondWithResult(_0x3e89c9,null))['catch'](handleError(_0x3e89c9,null));};exports['destroy']=function(_0x4bef40,_0x35dd7a){return db[_0x093b('0x27')][_0x093b('0x44')]({'where':{'id':_0x4bef40[_0x093b('0x43')]['id']}})[_0x093b('0x20')](handleEntityNotFound(_0x35dd7a,null))[_0x093b('0x20')](removeEntity(_0x35dd7a,null))[_0x093b('0x42')](handleError(_0x35dd7a,null));};exports[_0x093b('0x48')]=function(_0x4f2515,_0x37f0d1,_0x16fb6c){var _0x19671f={};var _0x561392={};var _0x41c3f3;var _0x3689fe;return db['ZohoAccount'][_0x093b('0x49')]({'where':{'id':_0x4f2515[_0x093b('0x43')]['id']}})[_0x093b('0x20')](handleEntityNotFound(_0x37f0d1,null))[_0x093b('0x20')](function(_0xcf4728){if(_0xcf4728){_0x41c3f3=_0xcf4728;_0x561392['model']=_[_0x093b('0x2d')](db['ZohoConfiguration']['rawAttributes']);_0x561392[_0x093b('0x30')]=_['keys'](_0x4f2515['query']);_0x561392[_0x093b('0x2e')]=_['intersection'](_0x561392[_0x093b('0x2c')],_0x561392['query']);_0x19671f['attributes']=_[_0x093b('0x2f')](_0x561392[_0x093b('0x2c')],qs['fields'](_0x4f2515[_0x093b('0x30')][_0x093b('0x32')]));_0x19671f[_0x093b('0x31')]=_0x19671f[_0x093b('0x31')][_0x093b('0x33')]?_0x19671f[_0x093b('0x31')]:_0x561392[_0x093b('0x2c')];_0x19671f[_0x093b('0x36')]=qs['sort'](_0x4f2515['query']['sort']);_0x19671f['where']=qs[_0x093b('0x2e')](_[_0x093b('0x39')](_0x4f2515[_0x093b('0x30')],_0x561392['filters']));if(_0x4f2515['query'][_0x093b('0x3a')]){_0x19671f[_0x093b('0x38')]=_[_0x093b('0x3b')](_0x19671f[_0x093b('0x38')],{'$or':_[_0x093b('0x26')](_0x19671f['attributes'],function(_0x4eb431){var _0x1f81a4={};_0x1f81a4[_0x4eb431]={'$like':'%'+_0x4f2515[_0x093b('0x30')][_0x093b('0x3a')]+'%'};return _0x1f81a4;})});}_0x19671f=_[_0x093b('0x3b')]({},_0x19671f,_0x4f2515[_0x093b('0x3d')]);return _0x41c3f3[_0x093b('0x48')](_0x19671f);}})[_0x093b('0x20')](function(_0x194c38){if(_0x194c38){_0x3689fe=_0x194c38[_0x093b('0x33')];if(!_0x4f2515[_0x093b('0x30')][_0x093b('0x34')](_0x093b('0x4a'))){_0x19671f[_0x093b('0x35')]=qs[_0x093b('0x35')](_0x4f2515[_0x093b('0x30')]['limit']);_0x19671f[_0x093b('0x1a')]=qs[_0x093b('0x1a')](_0x4f2515[_0x093b('0x30')][_0x093b('0x1a')]);}return _0x41c3f3[_0x093b('0x48')](_0x19671f);}})['then'](function(_0xa8d60b){if(_0xa8d60b){return _0xa8d60b?{'count':_0x3689fe,'rows':_0xa8d60b}:null;}})[_0x093b('0x20')](respondWithResult(_0x37f0d1,null))[_0x093b('0x42')](handleError(_0x37f0d1,null));};exports[_0x093b('0x4b')]=function(_0x2b88ee,_0x5df29b,_0x681050){if(_0x2b88ee[_0x093b('0x46')]['id']){delete _0x2b88ee[_0x093b('0x46')]['id'];}return db[_0x093b('0x27')][_0x093b('0x49')]({'where':{'id':_0x2b88ee[_0x093b('0x43')]['id']}})[_0x093b('0x20')](handleEntityNotFound(_0x5df29b,null))[_0x093b('0x20')](function(_0xd29f93){if(_0xd29f93){_0x2b88ee[_0x093b('0x46')][_0x093b('0x4c')]=_0xd29f93['id'];_0x2b88ee[_0x093b('0x46')][_0x093b('0x4d')]=integrations['getSubjects'](_0x2b88ee[_0x093b('0x46')][_0x093b('0x4e')],_0x2b88ee[_0x093b('0x46')][_0x093b('0x2a')]);_0x2b88ee[_0x093b('0x46')][_0x093b('0x4f')]=integrations[_0x093b('0x50')](_0x2b88ee['body'][_0x093b('0x4e')],_0x2b88ee[_0x093b('0x46')][_0x093b('0x2a')]);return db['ZohoConfiguration'][_0x093b('0x45')](_0x2b88ee['body'],{'include':[{'model':db[_0x093b('0x51')],'as':_0x093b('0x4d')},{'model':db[_0x093b('0x51')],'as':_0x093b('0x4f')}]});}return null;})['then'](respondWithResult(_0x5df29b,null))[_0x093b('0x42')](handleError(_0x5df29b,null));};function getAccessToken(_0x4713e5){return new Promise(function(_0x277350,_0x3ec786){var _0x7a45bb;switch(_0x4713e5[_0x093b('0x52')]){case'US':_0x7a45bb=_0x093b('0x53');break;case'AU':_0x7a45bb=_0x093b('0x54');break;case'EU':_0x7a45bb='https://accounts.zoho.eu';break;case'IN':_0x7a45bb=_0x093b('0x55');break;case'CN':_0x7a45bb=_0x093b('0x56');break;default:_0x7a45bb='https://accounts.zoho.eu';break;}var _0x3a626d={'method':_0x093b('0x57'),'uri':_0x7a45bb+_0x093b('0x58'),'qs':{'refresh_token':_0x4713e5[_0x093b('0x59')],'client_id':_0x4713e5[_0x093b('0x5a')],'client_secret':_0x4713e5[_0x093b('0x5b')],'grant_type':_0x093b('0x5c')},'json':!![]};return rp(_0x3a626d)[_0x093b('0x20')](function(_0x499cb6){if(_0x499cb6[_0x093b('0x5d')]){_0x277350(_0x499cb6[_0x093b('0x5d')]);}else{_0x3ec786(_0x093b('0x5e'));}})[_0x093b('0x42')](function(_0x235abc){_0x3ec786(_0x235abc);});});}exports[_0x093b('0x5f')]=function(_0x3855cb,_0x2a83a9,_0x4a3408){var _0x3b1105,_0x4e3f49,_0x10d55a,_0x4b08a7,_0x31e25c;return db[_0x093b('0x27')][_0x093b('0x49')]({'where':{'id':_0x3855cb['params']['id']},'attributes':['id',_0x093b('0x60'),'zone',_0x093b('0x5a'),_0x093b('0x5b'),_0x093b('0x61'),_0x093b('0x62'),'refreshToken']})[_0x093b('0x20')](handleEntityNotFound(_0x2a83a9,null))['then'](function(_0x344f0b){_0x31e25c=_0x344f0b;_0x3b1105=_0x31e25c['host'];_0x4e3f49=_0x3b1105===_0x093b('0x63')?'eu':'com';_0x10d55a=_0x31e25c[_0x093b('0x61')];var _0x3d8fdf=_0x10d55a[_0x093b('0x64')](-0x1);if(_0x3d8fdf==='/'||_0x3d8fdf==='\x5c'||_0x3d8fdf===':'){_0x10d55a=_0x10d55a[_0x093b('0x65')](0x0,_0x10d55a[_0x093b('0x66')](_0x3d8fdf));}if(!_0x31e25c[_0x093b('0x59')]){throw new Error(_0x093b('0x67'));}return getAccessToken(_0x31e25c);})['then'](function(_0x561977){if(_0x561977){return rp({'method':_0x093b('0x68'),'uri':util[_0x093b('0x69')](_0x093b('0x6a'),_0x4e3f49),'qs':{'module':_0x093b('0x6b')},'headers':{'Authorization':_0x093b('0x6c')+_0x561977},'json':!![]});}})['then'](function(_0x5da777){if(_0x5da777){if(_0x5da777[_0x093b('0x6d')]&&_0x5da777[_0x093b('0x6d')][_0x093b('0x6e')]){throw new Error(_0x5da777[_0x093b('0x6d')][_0x093b('0x6e')][_0x093b('0x6f')]);}var _0x44a5b7=[];var _0x57a146=[];var _0x2c231b=['Owner',_0x093b('0x70'),'Description',_0x093b('0x71'),'Call_Duration',_0x093b('0x72'),'Call_Start_Time','Call_Type'];_0x57a146=_['remove'](_0x5da777[_0x093b('0x32')],function(_0x4f0c36){return _0x2c231b[_0x093b('0x73')](_0x4f0c36[_0x093b('0x74')]);});for(var _0x33fab=0x0;_0x33fab<_0x57a146['length'];_0x33fab++){if(_0x57a146[_0x33fab][_0x093b('0x75')]===![]){_0x44a5b7[_0x093b('0x76')]({'id':_0x57a146[_0x33fab]['id'],'name':_0x57a146[_0x33fab]['display_label'],'custom':_0x57a146[_0x33fab][_0x093b('0x77')],'options':_0x57a146[_0x33fab]['data_type']===_0x093b('0x78')&&_0x57a146[_0x33fab]['pick_list_values'][_0x093b('0x33')]>-0x1?_['map'](_0x57a146[_0x33fab]['pick_list_values'],function(_0x153a8d){return{'name':_0x153a8d,'value':_0x153a8d};}):[]});}}return{'count':_0x44a5b7[_0x093b('0x33')],'rows':_0x44a5b7};}else{return{'count':0x0,'rows':[]};}})[_0x093b('0x20')](respondWithResult(_0x2a83a9,null))[_0x093b('0x42')](function(_0x206956){var _0x44752b=_0x3855cb[_0x093b('0x30')][_0x093b('0x79')]?0x1f4:_0x206956[_0x093b('0x7a')]||0x1f4;logger[_0x093b('0x6e')]('getFields,\x20%s,\x20%s,\x20%s',_0x093b('0x5f'),_0x44752b,JSON['stringify'](_0x206956));delete _0x206956['name'];if(_0x44752b===0x191){_0x44752b=0x190;}_0x2a83a9[_0x093b('0x17')](_0x44752b)[_0x093b('0x24')](_0x3855cb['query'][_0x093b('0x79')]?{'message':_0x093b('0x7b'),'statusCode':_0x206956['statusCode']}:_0x206956);});}; \ No newline at end of file +var _0xcf44=['find','create','body','params','findOne','order','getConfigurations','addConfiguration','Subjects','getSubjects','getDescriptions','channel','ZohoConfiguration','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','push','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xcf44,0x133));var _0x4cf4=function(_0x4ed3f7,_0x2b2627){_0x4ed3f7=_0x4ed3f7-0x0;var _0xdfe8ee=_0xcf44[_0x4ed3f7];return _0xdfe8ee;};'use strict';var emlformat=require(_0x4cf4('0x0'));var rimraf=require(_0x4cf4('0x1'));var zipdir=require(_0x4cf4('0x2'));var jsonpatch=require(_0x4cf4('0x3'));var rp=require(_0x4cf4('0x4'));var moment=require(_0x4cf4('0x5'));var BPromise=require(_0x4cf4('0x6'));var Mustache=require(_0x4cf4('0x7'));var util=require(_0x4cf4('0x8'));var path=require(_0x4cf4('0x9'));var sox=require(_0x4cf4('0xa'));var csv=require(_0x4cf4('0xb'));var ejs=require(_0x4cf4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cf4('0xd'));var crypto=require(_0x4cf4('0xe'));var jsforce=require(_0x4cf4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4cf4('0xb'));var querystring=require(_0x4cf4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4cf4('0x11'));var qs=require(_0x4cf4('0x12'));var as=require(_0x4cf4('0x13'));var hardwareService=require(_0x4cf4('0x14'));var logger=require(_0x4cf4('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4cf4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4cf4('0x17'))['db'];var integrations=require(_0x4cf4('0x18'));function respondWithStatusCode(_0x4cf420,_0x23e01b){_0x23e01b=_0x23e01b||0xcc;return function(_0x3c67c8){if(_0x3c67c8){return _0x4cf420[_0x4cf4('0x19')](_0x23e01b);}return _0x4cf420[_0x4cf4('0x1a')](_0x23e01b)[_0x4cf4('0x1b')]();};}function respondWithResult(_0x30364b,_0x52f044){_0x52f044=_0x52f044||0xc8;return function(_0x1acc64){if(_0x1acc64){return _0x30364b['status'](_0x52f044)[_0x4cf4('0x1c')](_0x1acc64);}};}function respondWithFilteredResult(_0x22f562,_0x5d97d1){return function(_0x36a14e){if(_0x36a14e){var _0x15e191=typeof _0x5d97d1[_0x4cf4('0x1d')]==='undefined'&&typeof _0x5d97d1[_0x4cf4('0x1e')]==='undefined';var _0xe46d60=_0x36a14e[_0x4cf4('0x1f')];var _0x1eabdf=_0x15e191?0x0:_0x5d97d1[_0x4cf4('0x1d')];var _0xdf1bb4=_0x15e191?_0x36a14e['count']:_0x5d97d1[_0x4cf4('0x1d')]+_0x5d97d1[_0x4cf4('0x1e')];var _0x20aca8;if(_0xdf1bb4>=_0xe46d60){_0xdf1bb4=_0xe46d60;_0x20aca8=0xc8;}else{_0x20aca8=0xce;}_0x22f562[_0x4cf4('0x1a')](_0x20aca8);return _0x22f562[_0x4cf4('0x20')](_0x4cf4('0x21'),_0x1eabdf+'-'+_0xdf1bb4+'/'+_0xe46d60)[_0x4cf4('0x1c')](_0x36a14e);}return null;};}function patchUpdates(_0x40329c){return function(_0x264841){try{jsonpatch[_0x4cf4('0x22')](_0x264841,_0x40329c,!![]);}catch(_0x4953a2){return BPromise['reject'](_0x4953a2);}return _0x264841[_0x4cf4('0x23')]();};}function saveUpdates(_0x2ee6a0,_0x4adefc){return function(_0x57e0ee){if(_0x57e0ee){return _0x57e0ee[_0x4cf4('0x24')](_0x2ee6a0)[_0x4cf4('0x25')](function(_0xc16fa9){return _0xc16fa9;});}return null;};}function removeEntity(_0x39a147,_0x5eda2e){return function(_0xc211a6){if(_0xc211a6){return _0xc211a6[_0x4cf4('0x26')]()[_0x4cf4('0x25')](function(){_0x39a147[_0x4cf4('0x1a')](0xcc)[_0x4cf4('0x1b')]();});}};}function handleEntityNotFound(_0x2cd9ce,_0xfc3aba){return function(_0x539444){if(!_0x539444){_0x2cd9ce[_0x4cf4('0x19')](0x194);}return _0x539444;};}function handleError(_0x2f9c61,_0x223095){_0x223095=_0x223095||0x1f4;return function(_0x3bbea7){logger['error'](_0x3bbea7[_0x4cf4('0x27')]);if(_0x3bbea7[_0x4cf4('0x28')]){delete _0x3bbea7[_0x4cf4('0x28')];}_0x2f9c61['status'](_0x223095)[_0x4cf4('0x29')](_0x3bbea7);};}exports['index']=function(_0xbbe01f,_0x47e8d4){var _0x209687={},_0x58a256={},_0x428a34={'count':0x0,'rows':[]};var _0x4d9b8e=_['map'](db[_0x4cf4('0x2a')][_0x4cf4('0x2b')],function(_0x428341){return{'name':_0x428341[_0x4cf4('0x2c')],'type':_0x428341[_0x4cf4('0x2d')][_0x4cf4('0x2e')]};});_0x58a256[_0x4cf4('0x2f')]=_[_0x4cf4('0x30')](_0x4d9b8e,_0x4cf4('0x28'));_0x58a256[_0x4cf4('0x31')]=_[_0x4cf4('0x32')](_0xbbe01f[_0x4cf4('0x31')]);_0x58a256[_0x4cf4('0x33')]=_['intersection'](_0x58a256[_0x4cf4('0x2f')],_0x58a256[_0x4cf4('0x31')]);_0x209687[_0x4cf4('0x34')]=_[_0x4cf4('0x35')](_0x58a256[_0x4cf4('0x2f')],qs[_0x4cf4('0x36')](_0xbbe01f[_0x4cf4('0x31')][_0x4cf4('0x36')]));_0x209687['attributes']=_0x209687[_0x4cf4('0x34')][_0x4cf4('0x37')]?_0x209687[_0x4cf4('0x34')]:_0x58a256[_0x4cf4('0x2f')];if(!_0xbbe01f['query'][_0x4cf4('0x38')](_0x4cf4('0x39'))){_0x209687[_0x4cf4('0x1e')]=qs['limit'](_0xbbe01f[_0x4cf4('0x31')][_0x4cf4('0x1e')]);_0x209687[_0x4cf4('0x1d')]=qs[_0x4cf4('0x1d')](_0xbbe01f[_0x4cf4('0x31')][_0x4cf4('0x1d')]);}_0x209687['order']=qs[_0x4cf4('0x3a')](_0xbbe01f[_0x4cf4('0x31')][_0x4cf4('0x3a')]);_0x209687[_0x4cf4('0x3b')]=qs[_0x4cf4('0x33')](_[_0x4cf4('0x3c')](_0xbbe01f[_0x4cf4('0x31')],_0x58a256[_0x4cf4('0x33')]),_0x4d9b8e);if(_0xbbe01f[_0x4cf4('0x31')][_0x4cf4('0x3d')]){_0x209687[_0x4cf4('0x3b')]=_[_0x4cf4('0x3e')](_0x209687[_0x4cf4('0x3b')],{'$or':_[_0x4cf4('0x30')](_0x4d9b8e,function(_0x4d13a6){if(_0x4d13a6['type']!==_0x4cf4('0x3f')){var _0x429fe9={};_0x429fe9[_0x4d13a6[_0x4cf4('0x28')]]={'$like':'%'+_0xbbe01f[_0x4cf4('0x31')][_0x4cf4('0x3d')]+'%'};return _0x429fe9;}})});}_0x209687=_[_0x4cf4('0x3e')]({},_0x209687,_0xbbe01f[_0x4cf4('0x40')]);var _0x33fe5b={'where':_0x209687[_0x4cf4('0x3b')]};return db[_0x4cf4('0x2a')][_0x4cf4('0x1f')](_0x33fe5b)['then'](function(_0x261206){_0x428a34[_0x4cf4('0x1f')]=_0x261206;if(_0xbbe01f[_0x4cf4('0x31')]['includeAll']){_0x209687[_0x4cf4('0x41')]=[{'all':!![]}];}return db[_0x4cf4('0x2a')][_0x4cf4('0x42')](_0x209687);})[_0x4cf4('0x25')](function(_0x123ead){_0x428a34[_0x4cf4('0x43')]=_0x123ead;return _0x428a34;})[_0x4cf4('0x25')](respondWithFilteredResult(_0x47e8d4,_0x209687))[_0x4cf4('0x44')](handleError(_0x47e8d4,null));};exports[_0x4cf4('0x45')]=function(_0x5c3cfa,_0x1a087a){var _0x43abb7={'raw':![],'where':{'id':_0x5c3cfa['params']['id']}},_0x20f6dd={};_0x20f6dd[_0x4cf4('0x2f')]=_[_0x4cf4('0x32')](db[_0x4cf4('0x2a')][_0x4cf4('0x2b')]);_0x20f6dd['query']=_[_0x4cf4('0x32')](_0x5c3cfa[_0x4cf4('0x31')]);_0x20f6dd[_0x4cf4('0x33')]=_[_0x4cf4('0x35')](_0x20f6dd[_0x4cf4('0x2f')],_0x20f6dd[_0x4cf4('0x31')]);_0x43abb7[_0x4cf4('0x34')]=_[_0x4cf4('0x35')](_0x20f6dd['model'],qs[_0x4cf4('0x36')](_0x5c3cfa['query']['fields']));_0x43abb7[_0x4cf4('0x34')]=_0x43abb7[_0x4cf4('0x34')][_0x4cf4('0x37')]?_0x43abb7[_0x4cf4('0x34')]:_0x20f6dd['model'];if(_0x5c3cfa[_0x4cf4('0x31')][_0x4cf4('0x46')]){_0x43abb7[_0x4cf4('0x41')]=[{'all':!![]}];}_0x43abb7=_[_0x4cf4('0x3e')]({},_0x43abb7,_0x5c3cfa[_0x4cf4('0x40')]);return db[_0x4cf4('0x2a')][_0x4cf4('0x47')](_0x43abb7)[_0x4cf4('0x25')](handleEntityNotFound(_0x1a087a,null))[_0x4cf4('0x25')](respondWithResult(_0x1a087a,null))['catch'](handleError(_0x1a087a,null));};exports['create']=function(_0x5cb3da,_0x2fd533){return db[_0x4cf4('0x2a')][_0x4cf4('0x48')](_0x5cb3da[_0x4cf4('0x49')],{})[_0x4cf4('0x25')](respondWithResult(_0x2fd533,0xc9))[_0x4cf4('0x44')](handleError(_0x2fd533,null));};exports['update']=function(_0x1cf0d7,_0x35c323){if(_0x1cf0d7['body']['id']){delete _0x1cf0d7['body']['id'];}return db[_0x4cf4('0x2a')][_0x4cf4('0x47')]({'where':{'id':_0x1cf0d7[_0x4cf4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35c323,null))[_0x4cf4('0x25')](saveUpdates(_0x1cf0d7['body'],null))[_0x4cf4('0x25')](respondWithResult(_0x35c323,null))[_0x4cf4('0x44')](handleError(_0x35c323,null));};exports[_0x4cf4('0x26')]=function(_0x506e8f,_0x5b30e9){return db[_0x4cf4('0x2a')][_0x4cf4('0x47')]({'where':{'id':_0x506e8f['params']['id']}})[_0x4cf4('0x25')](handleEntityNotFound(_0x5b30e9,null))[_0x4cf4('0x25')](removeEntity(_0x5b30e9,null))[_0x4cf4('0x44')](handleError(_0x5b30e9,null));};exports['getConfigurations']=function(_0x38e593,_0x52a79e,_0x6d75fa){var _0x18d54a={};var _0x4475c4={};var _0x4d307b;var _0x4908c8;return db[_0x4cf4('0x2a')][_0x4cf4('0x4b')]({'where':{'id':_0x38e593[_0x4cf4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52a79e,null))[_0x4cf4('0x25')](function(_0x31e12b){if(_0x31e12b){_0x4d307b=_0x31e12b;_0x4475c4[_0x4cf4('0x2f')]=_[_0x4cf4('0x32')](db['ZohoConfiguration']['rawAttributes']);_0x4475c4[_0x4cf4('0x31')]=_[_0x4cf4('0x32')](_0x38e593['query']);_0x4475c4[_0x4cf4('0x33')]=_[_0x4cf4('0x35')](_0x4475c4[_0x4cf4('0x2f')],_0x4475c4[_0x4cf4('0x31')]);_0x18d54a[_0x4cf4('0x34')]=_[_0x4cf4('0x35')](_0x4475c4[_0x4cf4('0x2f')],qs[_0x4cf4('0x36')](_0x38e593['query'][_0x4cf4('0x36')]));_0x18d54a['attributes']=_0x18d54a['attributes'][_0x4cf4('0x37')]?_0x18d54a['attributes']:_0x4475c4[_0x4cf4('0x2f')];_0x18d54a[_0x4cf4('0x4c')]=qs[_0x4cf4('0x3a')](_0x38e593[_0x4cf4('0x31')]['sort']);_0x18d54a[_0x4cf4('0x3b')]=qs['filters'](_[_0x4cf4('0x3c')](_0x38e593[_0x4cf4('0x31')],_0x4475c4['filters']));if(_0x38e593[_0x4cf4('0x31')][_0x4cf4('0x3d')]){_0x18d54a[_0x4cf4('0x3b')]=_[_0x4cf4('0x3e')](_0x18d54a[_0x4cf4('0x3b')],{'$or':_[_0x4cf4('0x30')](_0x18d54a['attributes'],function(_0x58c0dc){var _0x2d677d={};_0x2d677d[_0x58c0dc]={'$like':'%'+_0x38e593[_0x4cf4('0x31')][_0x4cf4('0x3d')]+'%'};return _0x2d677d;})});}_0x18d54a=_[_0x4cf4('0x3e')]({},_0x18d54a,_0x38e593['options']);return _0x4d307b[_0x4cf4('0x4d')](_0x18d54a);}})[_0x4cf4('0x25')](function(_0x408ea2){if(_0x408ea2){_0x4908c8=_0x408ea2[_0x4cf4('0x37')];if(!_0x38e593[_0x4cf4('0x31')][_0x4cf4('0x38')](_0x4cf4('0x39'))){_0x18d54a['limit']=qs['limit'](_0x38e593[_0x4cf4('0x31')][_0x4cf4('0x1e')]);_0x18d54a[_0x4cf4('0x1d')]=qs[_0x4cf4('0x1d')](_0x38e593[_0x4cf4('0x31')]['offset']);}return _0x4d307b[_0x4cf4('0x4d')](_0x18d54a);}})[_0x4cf4('0x25')](function(_0x478721){if(_0x478721){return _0x478721?{'count':_0x4908c8,'rows':_0x478721}:null;}})[_0x4cf4('0x25')](respondWithResult(_0x52a79e,null))[_0x4cf4('0x44')](handleError(_0x52a79e,null));};exports[_0x4cf4('0x4e')]=function(_0xb97a9a,_0x488b3d,_0x19b419){if(_0xb97a9a[_0x4cf4('0x49')]['id']){delete _0xb97a9a[_0x4cf4('0x49')]['id'];}return db[_0x4cf4('0x2a')][_0x4cf4('0x4b')]({'where':{'id':_0xb97a9a[_0x4cf4('0x4a')]['id']}})[_0x4cf4('0x25')](handleEntityNotFound(_0x488b3d,null))[_0x4cf4('0x25')](function(_0x3593df){if(_0x3593df){_0xb97a9a['body']['AccountId']=_0x3593df['id'];_0xb97a9a['body'][_0x4cf4('0x4f')]=integrations[_0x4cf4('0x50')](_0xb97a9a[_0x4cf4('0x49')]['channel'],_0xb97a9a[_0x4cf4('0x49')][_0x4cf4('0x2d')]);_0xb97a9a[_0x4cf4('0x49')]['Descriptions']=integrations[_0x4cf4('0x51')](_0xb97a9a[_0x4cf4('0x49')][_0x4cf4('0x52')],_0xb97a9a[_0x4cf4('0x49')]['type']);return db[_0x4cf4('0x53')][_0x4cf4('0x48')](_0xb97a9a[_0x4cf4('0x49')],{'include':[{'model':db['ZohoField'],'as':_0x4cf4('0x4f')},{'model':db[_0x4cf4('0x54')],'as':_0x4cf4('0x55')}]});}return null;})['then'](respondWithResult(_0x488b3d,null))[_0x4cf4('0x44')](handleError(_0x488b3d,null));};function getAccessToken(_0x303ecb){return new Promise(function(_0xf20a17,_0x228f0e){var _0x594ad1;switch(_0x303ecb[_0x4cf4('0x56')]){case'US':_0x594ad1='https://accounts.zoho.com';break;case'AU':_0x594ad1=_0x4cf4('0x57');break;case'EU':_0x594ad1='https://accounts.zoho.eu';break;case'IN':_0x594ad1='https://accounts.zoho.in';break;case'CN':_0x594ad1=_0x4cf4('0x58');break;default:_0x594ad1=_0x4cf4('0x59');break;}var _0x4bb4af={'method':'POST','uri':_0x594ad1+_0x4cf4('0x5a'),'qs':{'refresh_token':_0x303ecb[_0x4cf4('0x5b')],'client_id':_0x303ecb[_0x4cf4('0x5c')],'client_secret':_0x303ecb[_0x4cf4('0x5d')],'grant_type':_0x4cf4('0x5e')},'json':!![]};return rp(_0x4bb4af)[_0x4cf4('0x25')](function(_0x146ae2){if(_0x146ae2[_0x4cf4('0x5f')]){_0xf20a17(_0x146ae2[_0x4cf4('0x5f')]);}else{_0x228f0e(_0x4cf4('0x60'));}})[_0x4cf4('0x44')](function(_0x57e20d){_0x228f0e(_0x57e20d);});});}exports[_0x4cf4('0x61')]=function(_0xc4339f,_0x498993,_0xcc0ae){var _0x5e7146,_0x1584b2,_0x42819d,_0x115f92,_0x1d9c44;return db[_0x4cf4('0x2a')][_0x4cf4('0x4b')]({'where':{'id':_0xc4339f[_0x4cf4('0x4a')]['id']},'attributes':['id','host',_0x4cf4('0x56'),_0x4cf4('0x5c'),_0x4cf4('0x5d'),_0x4cf4('0x62'),_0x4cf4('0x63'),_0x4cf4('0x5b')]})[_0x4cf4('0x25')](handleEntityNotFound(_0x498993,null))[_0x4cf4('0x25')](function(_0x2b2371){_0x1d9c44=_0x2b2371;_0x5e7146=_0x1d9c44['host'];_0x1584b2=_0x5e7146===_0x4cf4('0x64')?'eu':_0x4cf4('0x65');_0x42819d=_0x1d9c44[_0x4cf4('0x62')];var _0x3a32a8=_0x42819d[_0x4cf4('0x66')](-0x1);if(_0x3a32a8==='/'||_0x3a32a8==='\x5c'||_0x3a32a8===':'){_0x42819d=_0x42819d[_0x4cf4('0x67')](0x0,_0x42819d[_0x4cf4('0x68')](_0x3a32a8));}if(!_0x1d9c44[_0x4cf4('0x5b')]){throw new Error(_0x4cf4('0x69'));}return getAccessToken(_0x1d9c44);})[_0x4cf4('0x25')](function(_0x4e2b1e){if(_0x4e2b1e){return rp({'method':'GET','uri':util[_0x4cf4('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1584b2),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4e2b1e},'json':!![]});}})[_0x4cf4('0x25')](function(_0x509583){if(_0x509583){if(_0x509583[_0x4cf4('0x6b')]&&_0x509583[_0x4cf4('0x6b')][_0x4cf4('0x6c')]){throw new Error(_0x509583[_0x4cf4('0x6b')][_0x4cf4('0x6c')][_0x4cf4('0x6d')]);}var _0x4237c0=[];var _0x28d637=[];var _0xfab75c=[_0x4cf4('0x6e'),'Subject',_0x4cf4('0x6f'),_0x4cf4('0x70'),_0x4cf4('0x71'),_0x4cf4('0x72'),_0x4cf4('0x73'),'Call_Type'];_0x28d637=_['remove'](_0x509583['fields'],function(_0x2d7c3e){return _0xfab75c[_0x4cf4('0x74')](_0x2d7c3e[_0x4cf4('0x75')]);});for(var _0x483a34=0x0;_0x483a34<_0x28d637['length'];_0x483a34++){if(_0x28d637[_0x483a34]['system_mandatory']===![]){_0x4237c0[_0x4cf4('0x76')]({'id':_0x28d637[_0x483a34]['id'],'name':_0x28d637[_0x483a34]['display_label'],'custom':_0x28d637[_0x483a34]['custom_field'],'options':_0x28d637[_0x483a34][_0x4cf4('0x77')]===_0x4cf4('0x78')&&_0x28d637[_0x483a34][_0x4cf4('0x79')][_0x4cf4('0x37')]>-0x1?_[_0x4cf4('0x30')](_0x28d637[_0x483a34]['pick_list_values'],function(_0x2531ef){return{'name':_0x2531ef,'value':_0x2531ef};}):[]});}}return{'count':_0x4237c0[_0x4cf4('0x37')],'rows':_0x4237c0};}else{return{'count':0x0,'rows':[]};}})[_0x4cf4('0x25')](respondWithResult(_0x498993,null))['catch'](function(_0x17f6d3){var _0x24d8f0=_0xc4339f[_0x4cf4('0x31')][_0x4cf4('0x7a')]?0x1f4:_0x17f6d3[_0x4cf4('0x7b')]||0x1f4;logger['error'](_0x4cf4('0x7c'),'getFields',_0x24d8f0,JSON[_0x4cf4('0x7d')](_0x17f6d3));delete _0x17f6d3[_0x4cf4('0x28')];if(_0x24d8f0===0x191){_0x24d8f0=0x190;}_0x498993[_0x4cf4('0x1a')](_0x24d8f0)[_0x4cf4('0x29')](_0xc4339f[_0x4cf4('0x31')][_0x4cf4('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x17f6d3[_0x4cf4('0x7b')]}:_0x17f6d3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 98519bf..0040f3e 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 _0x5bee=['refresh_token','refreshToken','info','format','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','https://accounts.zoho.in','https://accounts.zoho.eu','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','int_zoho_accounts','changed','clientId','code','serverUrl','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then'];(function(_0x305e55,_0x2b0d8a){var _0x364570=function(_0x299d66){while(--_0x299d66){_0x305e55['push'](_0x305e55['shift']());}};_0x364570(++_0x2b0d8a);}(_0x5bee,0xe0));var _0xe5be=function(_0x115f40,_0x10c346){_0x115f40=_0x115f40-0x0;var _0x22c0ed=_0x5bee[_0x115f40];return _0x22c0ed;};'use strict';var _=require(_0xe5be('0x0'));var util=require(_0xe5be('0x1'));var logger=require(_0xe5be('0x2'))(_0xe5be('0x3'));var moment=require(_0xe5be('0x4'));var BPromise=require('bluebird');var rp=require(_0xe5be('0x5'));var fs=require('fs');var path=require(_0xe5be('0x6'));var rimraf=require(_0xe5be('0x7'));var config=require(_0xe5be('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe5be('0x9')]=function(_0x27efb6,_0x3f70de){return _0x27efb6['define']('ZohoAccount',attributes,{'tableName':_0xe5be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe0d94f,_0x1ac203,_0x51c6cc){if(_0xe0d94f[_0xe5be('0xb')]('zone')||_0xe0d94f['changed']('serverUrl')||_0xe0d94f[_0xe5be('0xb')](_0xe5be('0xc'))||_0xe0d94f[_0xe5be('0xb')]('clientSecret')||_0xe0d94f[_0xe5be('0xb')](_0xe5be('0xd'))||_0xe0d94f[_0xe5be('0xb')]('host')){var _0x49f5fe,_0x3971f8;_0x49f5fe=_0xe0d94f[_0xe5be('0xe')];var _0x18f93e=_0x49f5fe[_0xe5be('0xf')](-0x1);if(_0x18f93e==='/'||_0x18f93e==='\x5c'||_0x18f93e===':'){_0x49f5fe=_0x49f5fe[_0xe5be('0x10')](0x0,_0x49f5fe[_0xe5be('0x11')](_0x18f93e));}switch(_0xe0d94f[_0xe5be('0x12')]){case'US':_0x3971f8=_0xe5be('0x13');break;case'AU':_0x3971f8=_0xe5be('0x14');break;case'IN':_0x3971f8='https://accounts.zoho.in';break;case'CN':_0x3971f8=_0xe5be('0x15');break;default:_0x3971f8='https://accounts.zoho.eu';break;}var _0x45b34c={'method':_0xe5be('0x16'),'uri':_0x3971f8+_0xe5be('0x17'),'form':{'grant_type':_0xe5be('0x18'),'client_id':_0xe0d94f[_0xe5be('0xc')],'client_secret':_0xe0d94f[_0xe5be('0x19')],'redirect_uri':_0xe0d94f[_0xe5be('0xe')],'code':_0xe0d94f[_0xe5be('0xd')]},'headers':{'Content-Type':_0xe5be('0x1a')}};return rp(_0x45b34c)[_0xe5be('0x1b')](function(_0x5a41b6){var _0x481d4e=JSON['parse'](_0x5a41b6);if(_0x481d4e[_0xe5be('0x1c')]){_0xe0d94f[_0xe5be('0x1d')]=_0x481d4e['refresh_token'];logger[_0xe5be('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe0d94f['name'],_0xe0d94f['id']));}else{logger['error'](util[_0xe5be('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe0d94f[_0xe5be('0x20')],_0xe0d94f['id']),util[_0xe5be('0x21')](_0x481d4e,{'showHidden':![],'depth':null}));}return _0x51c6cc(null,_0x1ac203);})[_0xe5be('0x22')](function(_0x43ad98){logger[_0xe5be('0x23')](util[_0xe5be('0x1f')](_0xe5be('0x24'),_0xe0d94f[_0xe5be('0x20')],_0xe0d94f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x51c6cc(_0x43ad98);});}else{return _0x51c6cc(null,_0x1ac203);}},'beforeUpdate':function(_0x374161,_0x418806,_0x273b6f){if(_0x374161['changed'](_0xe5be('0x12'))||_0x374161[_0xe5be('0xb')](_0xe5be('0xe'))||_0x374161[_0xe5be('0xb')]('clientId')||_0x374161[_0xe5be('0xb')](_0xe5be('0x19'))||_0x374161['changed'](_0xe5be('0xd'))||_0x374161[_0xe5be('0xb')](_0xe5be('0x25'))){var _0x441abe,_0x55440c;_0x441abe=_0x374161[_0xe5be('0xe')];var _0x1bf94a=_0x441abe[_0xe5be('0xf')](-0x1);if(_0x1bf94a==='/'||_0x1bf94a==='\x5c'||_0x1bf94a===':'){_0x441abe=_0x441abe[_0xe5be('0x10')](0x0,_0x441abe[_0xe5be('0x11')](_0x1bf94a));}switch(_0x374161['zone']){case'US':_0x55440c='https://accounts.zoho.com';break;case'AU':_0x55440c=_0xe5be('0x14');break;case'IN':_0x55440c=_0xe5be('0x26');break;case'CN':_0x55440c='https://accounts.zoho.com.cn';break;default:_0x55440c=_0xe5be('0x27');break;}var _0x2838b2={'method':'POST','uri':_0x55440c+_0xe5be('0x17'),'form':{'grant_type':_0xe5be('0x18'),'client_id':_0x374161[_0xe5be('0xc')],'client_secret':_0x374161[_0xe5be('0x19')],'redirect_uri':_0x374161['serverUrl'],'code':_0x374161[_0xe5be('0xd')]},'headers':{'Content-Type':_0xe5be('0x1a')}};return rp(_0x2838b2)[_0xe5be('0x1b')](function(_0x3803a4){var _0x4db09f=JSON[_0xe5be('0x28')](_0x3803a4);if(_0x4db09f['refresh_token']){_0x374161[_0xe5be('0x1d')]=_0x4db09f[_0xe5be('0x1c')];logger[_0xe5be('0x1e')](util[_0xe5be('0x1f')](_0xe5be('0x29'),_0x374161[_0xe5be('0x20')],_0x374161['id']));}else{logger[_0xe5be('0x23')](util[_0xe5be('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x374161['name'],_0x374161['id']),util['inspect'](_0x4db09f,{'showHidden':![],'depth':null}));}return _0x273b6f(null,_0x418806);})[_0xe5be('0x22')](function(_0x4f802b){logger[_0xe5be('0x23')](util[_0xe5be('0x1f')](_0xe5be('0x24'),_0x374161[_0xe5be('0x20')],_0x374161['id']),util[_0xe5be('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x273b6f(_0x4f802b);});}else{return _0x273b6f(null,_0x418806);}}}});}; \ No newline at end of file +var _0x2b49=['clientId','clientSecret','code','host','substring','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','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','https://accounts.zoho.com.cn','refreshToken','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_zoho_accounts','changed','serverUrl'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0x2b49,0x95));var _0x92b4=function(_0x1e821b,_0x10bf0f){_0x1e821b=_0x1e821b-0x0;var _0xc80b42=_0x2b49[_0x1e821b];return _0xc80b42;};'use strict';var _=require(_0x92b4('0x0'));var util=require(_0x92b4('0x1'));var logger=require(_0x92b4('0x2'))(_0x92b4('0x3'));var moment=require(_0x92b4('0x4'));var BPromise=require(_0x92b4('0x5'));var rp=require(_0x92b4('0x6'));var fs=require('fs');var path=require(_0x92b4('0x7'));var rimraf=require(_0x92b4('0x8'));var config=require(_0x92b4('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x92b4('0xa'));module[_0x92b4('0xb')]=function(_0x243d8f,_0x2e853f){return _0x243d8f['define']('ZohoAccount',attributes,{'tableName':_0x92b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x17ae8e,_0x4369dd,_0x67aec9){if(_0x17ae8e[_0x92b4('0xd')]('zone')||_0x17ae8e[_0x92b4('0xd')](_0x92b4('0xe'))||_0x17ae8e[_0x92b4('0xd')](_0x92b4('0xf'))||_0x17ae8e[_0x92b4('0xd')](_0x92b4('0x10'))||_0x17ae8e[_0x92b4('0xd')](_0x92b4('0x11'))||_0x17ae8e[_0x92b4('0xd')](_0x92b4('0x12'))){var _0x5d9c5f,_0x68eae;_0x5d9c5f=_0x17ae8e[_0x92b4('0xe')];var _0x7c5244=_0x5d9c5f['slice'](-0x1);if(_0x7c5244==='/'||_0x7c5244==='\x5c'||_0x7c5244===':'){_0x5d9c5f=_0x5d9c5f[_0x92b4('0x13')](0x0,_0x5d9c5f['lastIndexOf'](_0x7c5244));}switch(_0x17ae8e[_0x92b4('0x14')]){case'US':_0x68eae='https://accounts.zoho.com';break;case'AU':_0x68eae=_0x92b4('0x15');break;case'IN':_0x68eae=_0x92b4('0x16');break;case'CN':_0x68eae='https://accounts.zoho.com.cn';break;default:_0x68eae=_0x92b4('0x17');break;}var _0x46f5cd={'method':_0x92b4('0x18'),'uri':_0x68eae+_0x92b4('0x19'),'form':{'grant_type':_0x92b4('0x1a'),'client_id':_0x17ae8e[_0x92b4('0xf')],'client_secret':_0x17ae8e['clientSecret'],'redirect_uri':_0x17ae8e['serverUrl'],'code':_0x17ae8e[_0x92b4('0x11')]},'headers':{'Content-Type':_0x92b4('0x1b')}};return rp(_0x46f5cd)[_0x92b4('0x1c')](function(_0x268285){var _0x286683=JSON[_0x92b4('0x1d')](_0x268285);if(_0x286683[_0x92b4('0x1e')]){_0x17ae8e['refreshToken']=_0x286683[_0x92b4('0x1e')];logger[_0x92b4('0x1f')](util[_0x92b4('0x20')](_0x92b4('0x21'),_0x17ae8e[_0x92b4('0x22')],_0x17ae8e['id']));}else{logger[_0x92b4('0x23')](util['format'](_0x92b4('0x24'),_0x17ae8e[_0x92b4('0x22')],_0x17ae8e['id']),util[_0x92b4('0x25')](_0x286683,{'showHidden':![],'depth':null}));}return _0x67aec9(null,_0x4369dd);})['catch'](function(_0x36d053){logger[_0x92b4('0x23')](util[_0x92b4('0x20')](_0x92b4('0x24'),_0x17ae8e['name'],_0x17ae8e['id']),util[_0x92b4('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x67aec9(_0x36d053);});}else{return _0x67aec9(null,_0x4369dd);}},'beforeUpdate':function(_0x245e06,_0x4b9ebc,_0x536a03){if(_0x245e06[_0x92b4('0xd')](_0x92b4('0x14'))||_0x245e06[_0x92b4('0xd')](_0x92b4('0xe'))||_0x245e06['changed'](_0x92b4('0xf'))||_0x245e06['changed'](_0x92b4('0x10'))||_0x245e06[_0x92b4('0xd')]('code')||_0x245e06[_0x92b4('0xd')](_0x92b4('0x12'))){var _0x1698c4,_0x18365c;_0x1698c4=_0x245e06[_0x92b4('0xe')];var _0x328002=_0x1698c4['slice'](-0x1);if(_0x328002==='/'||_0x328002==='\x5c'||_0x328002===':'){_0x1698c4=_0x1698c4['substring'](0x0,_0x1698c4['lastIndexOf'](_0x328002));}switch(_0x245e06[_0x92b4('0x14')]){case'US':_0x18365c='https://accounts.zoho.com';break;case'AU':_0x18365c='https://accounts.zoho.com.au';break;case'IN':_0x18365c=_0x92b4('0x16');break;case'CN':_0x18365c=_0x92b4('0x26');break;default:_0x18365c=_0x92b4('0x17');break;}var _0x48d4e4={'method':_0x92b4('0x18'),'uri':_0x18365c+_0x92b4('0x19'),'form':{'grant_type':_0x92b4('0x1a'),'client_id':_0x245e06[_0x92b4('0xf')],'client_secret':_0x245e06['clientSecret'],'redirect_uri':_0x245e06[_0x92b4('0xe')],'code':_0x245e06[_0x92b4('0x11')]},'headers':{'Content-Type':_0x92b4('0x1b')}};return rp(_0x48d4e4)[_0x92b4('0x1c')](function(_0xab516c){var _0x72ffe5=JSON['parse'](_0xab516c);if(_0x72ffe5[_0x92b4('0x1e')]){_0x245e06[_0x92b4('0x27')]=_0x72ffe5[_0x92b4('0x1e')];logger[_0x92b4('0x1f')](util['format'](_0x92b4('0x21'),_0x245e06[_0x92b4('0x22')],_0x245e06['id']));}else{logger[_0x92b4('0x23')](util[_0x92b4('0x20')](_0x92b4('0x24'),_0x245e06['name'],_0x245e06['id']),util['inspect'](_0x72ffe5,{'showHidden':![],'depth':null}));}return _0x536a03(null,_0x4b9ebc);})[_0x92b4('0x28')](function(_0x5e7289){logger[_0x92b4('0x23')](util[_0x92b4('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x245e06['name'],_0x245e06['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x536a03(_0x5e7289);});}else{return _0x536a03(null,_0x4b9ebc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 7d61282..80a1469 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 _0x762e=['raw','then','stringify','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','options','where','attributes','limit','include','model','map','ShowZohoAccount','ZohoAccount','find'];(function(_0x37bcb7,_0x4cc150){var _0x40d7ef=function(_0x4a5e97){while(--_0x4a5e97){_0x37bcb7['push'](_0x37bcb7['shift']());}};_0x40d7ef(++_0x4cc150);}(_0x762e,0xea));var _0xe762=function(_0x5c4d9b,_0x18d583){_0x5c4d9b=_0x5c4d9b-0x0;var _0x371c1b=_0x762e[_0x5c4d9b];return _0x371c1b;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe762('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe762('0x2'))['db'];var utils=require(_0xe762('0x3'));var logger=require(_0xe762('0x4'))('rpc');var config=require(_0xe762('0x5'));var jayson=require(_0xe762('0x6'));var client=jayson[_0xe762('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4726,_0x7a1740,_0x2511ad){return new BPromise(function(_0xf20548,_0x26a4fc){return client[_0xe762('0x8')](_0x1f4726,_0x2511ad)['then'](function(_0x50dd96){logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));logger[_0xe762('0xc')](_0xe762('0xd'),_0x7a1740,_0xe762('0xb'),JSON['stringify'](_0x50dd96));if(_0x50dd96[_0xe762('0xe')]){if(_0x50dd96[_0xe762('0xe')][_0xe762('0xf')]===0x1f4){logger['error'](_0xe762('0xa'),_0x7a1740,_0x50dd96['error'][_0xe762('0x10')]);return _0x26a4fc(_0x50dd96['error'][_0xe762('0x10')]);}logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x50dd96['error']['message']);return _0xf20548(_0x50dd96[_0xe762('0xe')][_0xe762('0x10')]);}else{logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));_0xf20548(_0x50dd96[_0xe762('0x11')][_0xe762('0x10')]);}})[_0xe762('0x12')](function(_0x531587){logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x531587);_0x26a4fc(_0x531587);});});}exports[_0xe762('0x13')]=function(_0x27c2cf){var _0x57850f=this;return new Promise(function(_0xd2cb26,_0x157de2){return db['ZohoAccount']['findAll']({'raw':_0x27c2cf['options']?_0x27c2cf[_0xe762('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x27c2cf[_0xe762('0x14')]?_0x27c2cf['options'][_0xe762('0x15')]||null:null,'attributes':_0x27c2cf['options']?_0x27c2cf[_0xe762('0x14')][_0xe762('0x16')]||null:null,'limit':_0x27c2cf[_0xe762('0x14')]?_0x27c2cf[_0xe762('0x14')][_0xe762('0x17')]||null:null,'include':_0x27c2cf['options']?_0x27c2cf['options']['include']?_['map'](_0x27c2cf[_0xe762('0x14')][_0xe762('0x18')],function(_0x31ac1a){return{'model':db[_0x31ac1a[_0xe762('0x19')]],'as':_0x31ac1a['as'],'attributes':_0x31ac1a[_0xe762('0x16')],'include':_0x31ac1a['include']?_[_0xe762('0x1a')](_0x31ac1a[_0xe762('0x18')],function(_0x407d1e){return{'model':db[_0x407d1e[_0xe762('0x19')]],'as':_0x407d1e['as'],'attributes':_0x407d1e[_0xe762('0x16')],'include':_0x407d1e[_0xe762('0x18')]?_[_0xe762('0x1a')](_0x407d1e[_0xe762('0x18')],function(_0xc05eb8){return{'model':db[_0xc05eb8[_0xe762('0x19')]],'as':_0xc05eb8['as'],'attributes':_0xc05eb8[_0xe762('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bfe46){logger[_0xe762('0x9')]('GetZohoAccount',_0x27c2cf);logger[_0xe762('0xc')](_0xe762('0x13'),_0x27c2cf,JSON['stringify'](_0x5bfe46));_0xd2cb26(_0x5bfe46);})[_0xe762('0x12')](function(_0xa39b64){logger[_0xe762('0xe')](_0xe762('0x13'),_0xa39b64[_0xe762('0x10')],_0x27c2cf);_0x157de2(_0x57850f[_0xe762('0xe')](0x1f4,_0xa39b64[_0xe762('0x10')]));});});};exports[_0xe762('0x1b')]=function(_0x26dbd3){var _0x79604b=this;return new Promise(function(_0x5f135b,_0x3bf093){return db[_0xe762('0x1c')][_0xe762('0x1d')]({'raw':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')][_0xe762('0x1e')]===undefined?!![]:![]:!![],'where':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')]['where']||null:null,'attributes':_0x26dbd3['options']?_0x26dbd3[_0xe762('0x14')][_0xe762('0x16')]||null:null,'include':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')][_0xe762('0x18')]?_[_0xe762('0x1a')](_0x26dbd3[_0xe762('0x14')]['include'],function(_0x40eedf){return{'model':db[_0x40eedf[_0xe762('0x19')]],'as':_0x40eedf['as'],'attributes':_0x40eedf[_0xe762('0x16')],'include':_0x40eedf['include']?_[_0xe762('0x1a')](_0x40eedf[_0xe762('0x18')],function(_0x249d01){return{'model':db[_0x249d01[_0xe762('0x19')]],'as':_0x249d01['as'],'attributes':_0x249d01[_0xe762('0x16')],'include':_0x249d01[_0xe762('0x18')]?_[_0xe762('0x1a')](_0x249d01[_0xe762('0x18')],function(_0x37cc8b){return{'model':db[_0x37cc8b[_0xe762('0x19')]],'as':_0x37cc8b['as'],'attributes':_0x37cc8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xe762('0x1f')](function(_0x25ec08){logger[_0xe762('0x9')](_0xe762('0x1b'),_0x26dbd3);logger[_0xe762('0xc')](_0xe762('0x1b'),_0x26dbd3,JSON[_0xe762('0x20')](_0x25ec08));_0x5f135b(_0x25ec08);})[_0xe762('0x12')](function(_0x3e17d9){logger[_0xe762('0xe')](_0xe762('0x1b'),_0x3e17d9[_0xe762('0x10')],_0x26dbd3);_0x3bf093(_0x79604b[_0xe762('0xe')](0x1f4,_0x3e17d9[_0xe762('0x10')]));});});}; \ No newline at end of file +var _0x2c91=['find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','debug','stringify','ShowZohoAccount'];(function(_0x28b6a8,_0xfe5c71){var _0x2dd1c4=function(_0x2b6c21){while(--_0x2b6c21){_0x28b6a8['push'](_0x28b6a8['shift']());}};_0x2dd1c4(++_0xfe5c71);}(_0x2c91,0x158));var _0x12c9=function(_0x3ac599,_0x40c0ab){_0x3ac599=_0x3ac599-0x0;var _0x2b1b07=_0x2c91[_0x3ac599];return _0x2b1b07;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var moment=require(_0x12c9('0x2'));var BPromise=require(_0x12c9('0x3'));var rs=require(_0x12c9('0x4'));var fs=require('fs');var Redis=require(_0x12c9('0x5'));var db=require(_0x12c9('0x6'))['db'];var utils=require(_0x12c9('0x7'));var logger=require('../../config/logger')(_0x12c9('0x8'));var config=require(_0x12c9('0x9'));var jayson=require(_0x12c9('0xa'));var client=jayson[_0x12c9('0xb')][_0x12c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x170c17,_0x3e30ed,_0x55c40a){return new BPromise(function(_0x283633,_0x2cbffe){return client['request'](_0x170c17,_0x55c40a)[_0x12c9('0xd')](function(_0x397004){logger['info'](_0x12c9('0xe'),_0x3e30ed,_0x12c9('0xf'));logger['debug'](_0x12c9('0x10'),_0x3e30ed,_0x12c9('0xf'),JSON['stringify'](_0x397004));if(_0x397004[_0x12c9('0x11')]){if(_0x397004[_0x12c9('0x11')][_0x12c9('0x12')]===0x1f4){logger[_0x12c9('0x11')](_0x12c9('0xe'),_0x3e30ed,_0x397004[_0x12c9('0x11')]['message']);return _0x2cbffe(_0x397004[_0x12c9('0x11')][_0x12c9('0x13')]);}logger[_0x12c9('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x3e30ed,_0x397004['error']['message']);return _0x283633(_0x397004['error']['message']);}else{logger[_0x12c9('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3e30ed,_0x12c9('0xf'));_0x283633(_0x397004[_0x12c9('0x15')][_0x12c9('0x13')]);}})[_0x12c9('0x16')](function(_0x8caeda){logger['error'](_0x12c9('0xe'),_0x3e30ed,_0x8caeda);_0x2cbffe(_0x8caeda);});});}exports[_0x12c9('0x17')]=function(_0x1890d4){var _0x38c12e=this;return new Promise(function(_0x44e9af,_0x1def14){return db[_0x12c9('0x18')][_0x12c9('0x19')]({'raw':_0x1890d4['options']?_0x1890d4[_0x12c9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1b')]||null:null,'attributes':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')]['attributes']||null:null,'limit':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1c')]||null:null,'include':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1d')],function(_0x2eecec){return{'model':db[_0x2eecec[_0x12c9('0x1f')]],'as':_0x2eecec['as'],'attributes':_0x2eecec['attributes'],'include':_0x2eecec[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x2eecec[_0x12c9('0x1d')],function(_0x1aa6a8){return{'model':db[_0x1aa6a8[_0x12c9('0x1f')]],'as':_0x1aa6a8['as'],'attributes':_0x1aa6a8[_0x12c9('0x20')],'include':_0x1aa6a8[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x1aa6a8[_0x12c9('0x1d')],function(_0x3ed911){return{'model':db[_0x3ed911[_0x12c9('0x1f')]],'as':_0x3ed911['as'],'attributes':_0x3ed911[_0x12c9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x12c9('0xd')](function(_0x2224ce){logger[_0x12c9('0x14')](_0x12c9('0x17'),_0x1890d4);logger[_0x12c9('0x21')](_0x12c9('0x17'),_0x1890d4,JSON[_0x12c9('0x22')](_0x2224ce));_0x44e9af(_0x2224ce);})[_0x12c9('0x16')](function(_0x5c02fb){logger[_0x12c9('0x11')](_0x12c9('0x17'),_0x5c02fb[_0x12c9('0x13')],_0x1890d4);_0x1def14(_0x38c12e[_0x12c9('0x11')](0x1f4,_0x5c02fb[_0x12c9('0x13')]));});});};exports[_0x12c9('0x23')]=function(_0x98660f){var _0x59ba1a=this;return new Promise(function(_0x179def,_0x35a37d){return db[_0x12c9('0x18')][_0x12c9('0x24')]({'raw':_0x98660f[_0x12c9('0x1a')]?_0x98660f['options'][_0x12c9('0x25')]===undefined?!![]:![]:!![],'where':_0x98660f['options']?_0x98660f[_0x12c9('0x1a')][_0x12c9('0x1b')]||null:null,'attributes':_0x98660f[_0x12c9('0x1a')]?_0x98660f[_0x12c9('0x1a')][_0x12c9('0x20')]||null:null,'include':_0x98660f[_0x12c9('0x1a')]?_0x98660f[_0x12c9('0x1a')][_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x98660f['options']['include'],function(_0x46bfc0){return{'model':db[_0x46bfc0[_0x12c9('0x1f')]],'as':_0x46bfc0['as'],'attributes':_0x46bfc0[_0x12c9('0x20')],'include':_0x46bfc0[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x46bfc0[_0x12c9('0x1d')],function(_0x410841){return{'model':db[_0x410841['model']],'as':_0x410841['as'],'attributes':_0x410841[_0x12c9('0x20')],'include':_0x410841[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x410841['include'],function(_0x30221c){return{'model':db[_0x30221c[_0x12c9('0x1f')]],'as':_0x30221c['as'],'attributes':_0x30221c['attributes']};}):[]};}):[]};}):[]:[]})[_0x12c9('0xd')](function(_0x34dacd){logger[_0x12c9('0x14')]('ShowZohoAccount',_0x98660f);logger[_0x12c9('0x21')](_0x12c9('0x23'),_0x98660f,JSON[_0x12c9('0x22')](_0x34dacd));_0x179def(_0x34dacd);})[_0x12c9('0x16')](function(_0x2f4cf7){logger[_0x12c9('0x11')](_0x12c9('0x23'),_0x2f4cf7[_0x12c9('0x13')],_0x98660f);_0x35a37d(_0x59ba1a[_0x12c9('0x11')](0x1f4,_0x2f4cf7[_0x12c9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 6617c07..59b6a4b 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 _0xa926=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','util'];(function(_0x42676a,_0xc50993){var _0x545a4e=function(_0x208903){while(--_0x208903){_0x42676a['push'](_0x42676a['shift']());}};_0x545a4e(++_0xc50993);}(_0xa926,0x166));var _0x6a92=function(_0x4ba043,_0x9cd2de){_0x4ba043=_0x4ba043-0x0;var _0x1d6188=_0xa926[_0x4ba043];return _0x1d6188;};'use strict';var multer=require(_0x6a92('0x0'));var util=require(_0x6a92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a92('0x2'));var router=express[_0x6a92('0x3')]();var fs_extra=require(_0x6a92('0x4'));var auth=require(_0x6a92('0x5'));var interaction=require(_0x6a92('0x6'));var config=require('../../config/environment');var controller=require(_0x6a92('0x7'));router[_0x6a92('0x8')]('/',auth[_0x6a92('0x9')](),controller[_0x6a92('0xa')]);router[_0x6a92('0x8')](_0x6a92('0xb'),auth['isAuthenticated'](),controller[_0x6a92('0xc')]);router[_0x6a92('0x8')](_0x6a92('0xd'),auth['isAuthenticated'](),controller[_0x6a92('0xe')]);router[_0x6a92('0x8')](_0x6a92('0xf'),auth[_0x6a92('0x9')](),controller[_0x6a92('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6a92('0x11')]);router[_0x6a92('0x12')]('/',auth[_0x6a92('0x9')](),controller[_0x6a92('0x13')]);router[_0x6a92('0x14')](_0x6a92('0xb'),auth[_0x6a92('0x9')](),controller[_0x6a92('0x15')]);router[_0x6a92('0x16')]('/:id',auth[_0x6a92('0x9')](),controller[_0x6a92('0x17')]);module['exports']=router; \ No newline at end of file +var _0x60f0=['getDescriptions','post','create','put','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x26569d,_0x55d60a){var _0x4c7297=function(_0x32f1ff){while(--_0x32f1ff){_0x26569d['push'](_0x26569d['shift']());}};_0x4c7297(++_0x55d60a);}(_0x60f0,0x98));var _0x060f=function(_0x1e671f,_0x1c8a22){_0x1e671f=_0x1e671f-0x0;var _0x1e6ffb=_0x60f0[_0x1e671f];return _0x1e6ffb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x060f('0x0'));var timeout=require(_0x060f('0x1'));var express=require(_0x060f('0x2'));var router=express['Router']();var fs_extra=require(_0x060f('0x3'));var auth=require(_0x060f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x060f('0x5'));var controller=require(_0x060f('0x6'));router[_0x060f('0x7')]('/',auth[_0x060f('0x8')](),controller[_0x060f('0x9')]);router['get'](_0x060f('0xa'),auth['isAuthenticated'](),controller[_0x060f('0xb')]);router[_0x060f('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x060f('0xc')]);router[_0x060f('0x7')](_0x060f('0xd'),auth['isAuthenticated'](),controller[_0x060f('0xe')]);router['get'](_0x060f('0xf'),auth[_0x060f('0x8')](),controller[_0x060f('0x10')]);router[_0x060f('0x11')]('/',auth[_0x060f('0x8')](),controller[_0x060f('0x12')]);router[_0x060f('0x13')]('/:id',auth[_0x060f('0x8')](),controller['update']);router['delete'](_0x060f('0xa'),auth[_0x060f('0x8')](),controller[_0x060f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2eddfd1..9c982ba 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 _0x9622=['contact_lead','sequelize','exports','STRING','lead','contact','nothing'];(function(_0x1cd4d5,_0x40bd09){var _0x348028=function(_0x10ffb3){while(--_0x10ffb3){_0x1cd4d5['push'](_0x1cd4d5['shift']());}};_0x348028(++_0x40bd09);}(_0x9622,0x8d));var _0x2962=function(_0x380a3f,_0x2807c7){_0x380a3f=_0x380a3f-0x0;var _0x1f4b10=_0x9622[_0x380a3f];return _0x1f4b10;};'use strict';var Sequelize=require(_0x2962('0x0'));module[_0x2962('0x1')]={'name':{'type':Sequelize[_0x2962('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x2962('0x3'),_0x2962('0x4'),_0x2962('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0x2962('0x3')),'defaultValue':_0x2962('0x6')},'description':{'type':Sequelize[_0x2962('0x2')]}}; \ No newline at end of file +var _0x91f6=['nothing','ENUM','contact_lead','contact','STRING','lead'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x91f6,0x7c));var _0x691f=function(_0x2ae77b,_0x368e2c){_0x2ae77b=_0x2ae77b-0x0;var _0x25a4e1=_0x91f6[_0x2ae77b];return _0x25a4e1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x691f('0x0')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x691f('0x1'),'contact',_0x691f('0x2')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x691f('0x3')](_0x691f('0x4'),_0x691f('0x5'),_0x691f('0x1')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x691f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 100eb56..6930073 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 _0xffa3=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','ZohoConfiguration','includeAll','findAll','rows','show','params','include','create','body','catch','find','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4c8282,_0x26279b){var _0x2bbf2f=function(_0x467dbd){while(--_0x467dbd){_0x4c8282['push'](_0x4c8282['shift']());}};_0x2bbf2f(++_0x26279b);}(_0xffa3,0x88));var _0x3ffa=function(_0x2e34f8,_0x53a191){_0x2e34f8=_0x2e34f8-0x0;var _0x2b147a=_0xffa3[_0x2e34f8];return _0x2b147a;};'use strict';var emlformat=require(_0x3ffa('0x0'));var rimraf=require(_0x3ffa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ffa('0x2'));var rp=require(_0x3ffa('0x3'));var moment=require(_0x3ffa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ffa('0x5'));var util=require(_0x3ffa('0x6'));var path=require(_0x3ffa('0x7'));var sox=require('sox');var csv=require(_0x3ffa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ffa('0x9'));var squel=require(_0x3ffa('0xa'));var crypto=require(_0x3ffa('0xb'));var jsforce=require(_0x3ffa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ffa('0x8'));var querystring=require(_0x3ffa('0xd'));var Papa=require('papaparse');var Redis=require(_0x3ffa('0xe'));var authService=require(_0x3ffa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3ffa('0x10'));var hardwareService=require(_0x3ffa('0x11'));var logger=require(_0x3ffa('0x12'))('api');var utils=require(_0x3ffa('0x13'));var config=require(_0x3ffa('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ffa('0x15'))['db'];function respondWithStatusCode(_0x51e142,_0x43731f){_0x43731f=_0x43731f||0xcc;return function(_0x557d26){if(_0x557d26){return _0x51e142[_0x3ffa('0x16')](_0x43731f);}return _0x51e142[_0x3ffa('0x17')](_0x43731f)[_0x3ffa('0x18')]();};}function respondWithResult(_0x4e822c,_0x310a57){_0x310a57=_0x310a57||0xc8;return function(_0x524695){if(_0x524695){return _0x4e822c[_0x3ffa('0x17')](_0x310a57)[_0x3ffa('0x19')](_0x524695);}};}function respondWithFilteredResult(_0x1e9bf2,_0x4fbf42){return function(_0xb77f5b){if(_0xb77f5b){var _0x51876d=typeof _0x4fbf42[_0x3ffa('0x1a')]==='undefined'&&typeof _0x4fbf42['limit']==='undefined';var _0x4679f5=_0xb77f5b[_0x3ffa('0x1b')];var _0x571177=_0x51876d?0x0:_0x4fbf42[_0x3ffa('0x1a')];var _0x34198a=_0x51876d?_0xb77f5b['count']:_0x4fbf42[_0x3ffa('0x1a')]+_0x4fbf42[_0x3ffa('0x1c')];var _0x5c0593;if(_0x34198a>=_0x4679f5){_0x34198a=_0x4679f5;_0x5c0593=0xc8;}else{_0x5c0593=0xce;}_0x1e9bf2['status'](_0x5c0593);return _0x1e9bf2[_0x3ffa('0x1d')]('Content-Range',_0x571177+'-'+_0x34198a+'/'+_0x4679f5)[_0x3ffa('0x19')](_0xb77f5b);}return null;};}function patchUpdates(_0x6fa1c9){return function(_0x30dc58){try{jsonpatch[_0x3ffa('0x1e')](_0x30dc58,_0x6fa1c9,!![]);}catch(_0x5deaee){return BPromise[_0x3ffa('0x1f')](_0x5deaee);}return _0x30dc58[_0x3ffa('0x20')]();};}function saveUpdates(_0x2ecf18,_0x20b8bb){return function(_0x5a8adb){if(_0x5a8adb){return _0x5a8adb[_0x3ffa('0x21')](_0x2ecf18)[_0x3ffa('0x22')](function(_0x14f410){return _0x14f410;});}return null;};}function removeEntity(_0x21095a,_0x138705){return function(_0x412f5d){if(_0x412f5d){return _0x412f5d[_0x3ffa('0x23')]()['then'](function(){_0x21095a[_0x3ffa('0x17')](0xcc)[_0x3ffa('0x18')]();});}};}function handleEntityNotFound(_0x4a81f2,_0x210d1e){return function(_0x2a0181){if(!_0x2a0181){_0x4a81f2[_0x3ffa('0x16')](0x194);}return _0x2a0181;};}function handleError(_0x19180b,_0x45adb5){_0x45adb5=_0x45adb5||0x1f4;return function(_0x4e2f4c){logger[_0x3ffa('0x24')](_0x4e2f4c['stack']);if(_0x4e2f4c[_0x3ffa('0x25')]){delete _0x4e2f4c['name'];}_0x19180b[_0x3ffa('0x17')](_0x45adb5)['send'](_0x4e2f4c);};}exports[_0x3ffa('0x26')]=function(_0x4c514f,_0x24a2bd){var _0x1f08c4={},_0x4f3fbf={},_0x47a1df={'count':0x0,'rows':[]};var _0x1a22c4=_[_0x3ffa('0x27')](db['ZohoConfiguration'][_0x3ffa('0x28')],function(_0x50ff08){return{'name':_0x50ff08[_0x3ffa('0x29')],'type':_0x50ff08[_0x3ffa('0x2a')]['key']};});_0x4f3fbf[_0x3ffa('0x2b')]=_['map'](_0x1a22c4,_0x3ffa('0x25'));_0x4f3fbf[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x4c514f['query']);_0x4f3fbf[_0x3ffa('0x2e')]=_[_0x3ffa('0x2f')](_0x4f3fbf['model'],_0x4f3fbf[_0x3ffa('0x2c')]);_0x1f08c4[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x4f3fbf['model'],qs[_0x3ffa('0x31')](_0x4c514f['query']['fields']));_0x1f08c4[_0x3ffa('0x30')]=_0x1f08c4[_0x3ffa('0x30')][_0x3ffa('0x32')]?_0x1f08c4[_0x3ffa('0x30')]:_0x4f3fbf[_0x3ffa('0x2b')];if(!_0x4c514f[_0x3ffa('0x2c')]['hasOwnProperty'](_0x3ffa('0x33'))){_0x1f08c4[_0x3ffa('0x1c')]=qs[_0x3ffa('0x1c')](_0x4c514f[_0x3ffa('0x2c')][_0x3ffa('0x1c')]);_0x1f08c4[_0x3ffa('0x1a')]=qs['offset'](_0x4c514f[_0x3ffa('0x2c')][_0x3ffa('0x1a')]);}_0x1f08c4[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x4c514f[_0x3ffa('0x2c')][_0x3ffa('0x35')]);_0x1f08c4['where']=qs[_0x3ffa('0x2e')](_['pick'](_0x4c514f['query'],_0x4f3fbf[_0x3ffa('0x2e')]),_0x1a22c4);if(_0x4c514f['query'][_0x3ffa('0x36')]){_0x1f08c4[_0x3ffa('0x37')]=_['merge'](_0x1f08c4[_0x3ffa('0x37')],{'$or':_[_0x3ffa('0x27')](_0x1a22c4,function(_0x19ef57){if(_0x19ef57[_0x3ffa('0x2a')]!==_0x3ffa('0x38')){var _0x32e339={};_0x32e339[_0x19ef57[_0x3ffa('0x25')]]={'$like':'%'+_0x4c514f[_0x3ffa('0x2c')]['filter']+'%'};return _0x32e339;}})});}_0x1f08c4=_[_0x3ffa('0x39')]({},_0x1f08c4,_0x4c514f[_0x3ffa('0x3a')]);var _0x58fbb0={'where':_0x1f08c4[_0x3ffa('0x37')]};return db[_0x3ffa('0x3b')][_0x3ffa('0x1b')](_0x58fbb0)[_0x3ffa('0x22')](function(_0x1dd42c){_0x47a1df[_0x3ffa('0x1b')]=_0x1dd42c;if(_0x4c514f['query'][_0x3ffa('0x3c')]){_0x1f08c4['include']=[{'all':!![]}];}return db[_0x3ffa('0x3b')][_0x3ffa('0x3d')](_0x1f08c4);})['then'](function(_0x4a0420){_0x47a1df[_0x3ffa('0x3e')]=_0x4a0420;return _0x47a1df;})['then'](respondWithFilteredResult(_0x24a2bd,_0x1f08c4))['catch'](handleError(_0x24a2bd,null));};exports[_0x3ffa('0x3f')]=function(_0x58e8ce,_0x2a056a){var _0x59891a={'raw':![],'where':{'id':_0x58e8ce[_0x3ffa('0x40')]['id']}},_0x40d4a6={};_0x40d4a6['model']=_['keys'](db[_0x3ffa('0x3b')][_0x3ffa('0x28')]);_0x40d4a6[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x58e8ce[_0x3ffa('0x2c')]);_0x40d4a6[_0x3ffa('0x2e')]=_[_0x3ffa('0x2f')](_0x40d4a6[_0x3ffa('0x2b')],_0x40d4a6[_0x3ffa('0x2c')]);_0x59891a[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x40d4a6['model'],qs[_0x3ffa('0x31')](_0x58e8ce[_0x3ffa('0x2c')]['fields']));_0x59891a[_0x3ffa('0x30')]=_0x59891a[_0x3ffa('0x30')][_0x3ffa('0x32')]?_0x59891a[_0x3ffa('0x30')]:_0x40d4a6[_0x3ffa('0x2b')];if(_0x58e8ce['query'][_0x3ffa('0x3c')]){_0x59891a[_0x3ffa('0x41')]=[{'all':!![]}];}_0x59891a=_[_0x3ffa('0x39')]({},_0x59891a,_0x58e8ce[_0x3ffa('0x3a')]);return db[_0x3ffa('0x3b')]['find'](_0x59891a)[_0x3ffa('0x22')](handleEntityNotFound(_0x2a056a,null))[_0x3ffa('0x22')](respondWithResult(_0x2a056a,null))['catch'](handleError(_0x2a056a,null));};exports[_0x3ffa('0x42')]=function(_0x3524d9,_0x3ecd20){return db[_0x3ffa('0x3b')][_0x3ffa('0x42')](_0x3524d9[_0x3ffa('0x43')],{})['then'](respondWithResult(_0x3ecd20,0xc9))[_0x3ffa('0x44')](handleError(_0x3ecd20,null));};exports[_0x3ffa('0x21')]=function(_0x2ee581,_0x2d46be){if(_0x2ee581[_0x3ffa('0x43')]['id']){delete _0x2ee581[_0x3ffa('0x43')]['id'];}return db['ZohoConfiguration'][_0x3ffa('0x45')]({'where':{'id':_0x2ee581[_0x3ffa('0x40')]['id']}})['then'](handleEntityNotFound(_0x2d46be,null))[_0x3ffa('0x22')](saveUpdates(_0x2ee581[_0x3ffa('0x43')],null))[_0x3ffa('0x22')](respondWithResult(_0x2d46be,null))[_0x3ffa('0x44')](handleError(_0x2d46be,null));};exports[_0x3ffa('0x23')]=function(_0x5d7229,_0x42c5c7){return db[_0x3ffa('0x3b')][_0x3ffa('0x45')]({'where':{'id':_0x5d7229['params']['id']}})['then'](handleEntityNotFound(_0x42c5c7,null))['then'](removeEntity(_0x42c5c7,null))[_0x3ffa('0x44')](handleError(_0x42c5c7,null));};exports[_0x3ffa('0x46')]=function(_0x5d2330,_0x5f6111,_0x4009c3){var _0x371772={};var _0xb2d767={};var _0x4bfb2e;var _0x5df2f7;return db['ZohoConfiguration'][_0x3ffa('0x47')]({'where':{'id':_0x5d2330['params']['id']}})[_0x3ffa('0x22')](handleEntityNotFound(_0x5f6111,null))[_0x3ffa('0x22')](function(_0xefd7fb){if(_0xefd7fb){_0x4bfb2e=_0xefd7fb;_0xb2d767[_0x3ffa('0x2b')]=_['keys'](db[_0x3ffa('0x48')]['rawAttributes']);_0xb2d767['query']=_[_0x3ffa('0x2d')](_0x5d2330['query']);_0xb2d767[_0x3ffa('0x2e')]=_[_0x3ffa('0x2f')](_0xb2d767[_0x3ffa('0x2b')],_0xb2d767['query']);_0x371772[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0xb2d767[_0x3ffa('0x2b')],qs[_0x3ffa('0x31')](_0x5d2330['query'][_0x3ffa('0x31')]));_0x371772['attributes']=_0x371772['attributes'][_0x3ffa('0x32')]?_0x371772['attributes']:_0xb2d767[_0x3ffa('0x2b')];_0x371772[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x5d2330['query']['sort']);_0x371772[_0x3ffa('0x37')]=qs[_0x3ffa('0x2e')](_['pick'](_0x5d2330[_0x3ffa('0x2c')],_0xb2d767['filters']));if(_0x5d2330[_0x3ffa('0x2c')][_0x3ffa('0x36')]){_0x371772['where']=_['merge'](_0x371772[_0x3ffa('0x37')],{'$or':_[_0x3ffa('0x27')](_0x371772[_0x3ffa('0x30')],function(_0x240106){var _0x2a305b={};_0x2a305b[_0x240106]={'$like':'%'+_0x5d2330[_0x3ffa('0x2c')]['filter']+'%'};return _0x2a305b;})});}_0x371772=_['merge']({},_0x371772,_0x5d2330[_0x3ffa('0x3a')]);return _0x4bfb2e['getFields'](_0x371772);}})[_0x3ffa('0x22')](function(_0x17d891){if(_0x17d891){_0x5df2f7=_0x17d891[_0x3ffa('0x32')];if(!_0x5d2330[_0x3ffa('0x2c')][_0x3ffa('0x49')]('nolimit')){_0x371772[_0x3ffa('0x1c')]=qs[_0x3ffa('0x1c')](_0x5d2330['query'][_0x3ffa('0x1c')]);_0x371772[_0x3ffa('0x1a')]=qs[_0x3ffa('0x1a')](_0x5d2330['query'][_0x3ffa('0x1a')]);}return _0x4bfb2e[_0x3ffa('0x46')](_0x371772);}})[_0x3ffa('0x22')](function(_0x34ca8a){if(_0x34ca8a){return _0x34ca8a?{'count':_0x5df2f7,'rows':_0x34ca8a}:null;}})['then'](respondWithResult(_0x5f6111,null))[_0x3ffa('0x44')](handleError(_0x5f6111,null));};exports[_0x3ffa('0x4a')]=function(_0x33bc01,_0x1c259a,_0x45a5c5){var _0xf66c47={};var _0x502aff={};var _0x39d044;var _0x1ddd8f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x33bc01[_0x3ffa('0x40')]['id']}})[_0x3ffa('0x22')](handleEntityNotFound(_0x1c259a,null))[_0x3ffa('0x22')](function(_0x4f6260){if(_0x4f6260){_0x39d044=_0x4f6260;_0x502aff['model']=_[_0x3ffa('0x2d')](db[_0x3ffa('0x48')]['rawAttributes']);_0x502aff[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x33bc01[_0x3ffa('0x2c')]);_0x502aff[_0x3ffa('0x2e')]=_['intersection'](_0x502aff[_0x3ffa('0x2b')],_0x502aff[_0x3ffa('0x2c')]);_0xf66c47[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x502aff[_0x3ffa('0x2b')],qs[_0x3ffa('0x31')](_0x33bc01[_0x3ffa('0x2c')]['fields']));_0xf66c47[_0x3ffa('0x30')]=_0xf66c47[_0x3ffa('0x30')][_0x3ffa('0x32')]?_0xf66c47[_0x3ffa('0x30')]:_0x502aff[_0x3ffa('0x2b')];_0xf66c47[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x33bc01[_0x3ffa('0x2c')][_0x3ffa('0x35')]);_0xf66c47[_0x3ffa('0x37')]=qs['filters'](_[_0x3ffa('0x4b')](_0x33bc01[_0x3ffa('0x2c')],_0x502aff[_0x3ffa('0x2e')]));if(_0x33bc01[_0x3ffa('0x2c')][_0x3ffa('0x36')]){_0xf66c47[_0x3ffa('0x37')]=_[_0x3ffa('0x39')](_0xf66c47[_0x3ffa('0x37')],{'$or':_['map'](_0xf66c47[_0x3ffa('0x30')],function(_0x4c7e1b){var _0x3dac45={};_0x3dac45[_0x4c7e1b]={'$like':'%'+_0x33bc01[_0x3ffa('0x2c')]['filter']+'%'};return _0x3dac45;})});}_0xf66c47=_[_0x3ffa('0x39')]({},_0xf66c47,_0x33bc01[_0x3ffa('0x3a')]);return _0x39d044['getSubjects'](_0xf66c47);}})['then'](function(_0x1a2a27){if(_0x1a2a27){_0x1ddd8f=_0x1a2a27[_0x3ffa('0x32')];if(!_0x33bc01[_0x3ffa('0x2c')]['hasOwnProperty'](_0x3ffa('0x33'))){_0xf66c47[_0x3ffa('0x1c')]=qs['limit'](_0x33bc01[_0x3ffa('0x2c')][_0x3ffa('0x1c')]);_0xf66c47['offset']=qs[_0x3ffa('0x1a')](_0x33bc01['query'][_0x3ffa('0x1a')]);}return _0x39d044['getSubjects'](_0xf66c47);}})[_0x3ffa('0x22')](function(_0x453e87){if(_0x453e87){return _0x453e87?{'count':_0x1ddd8f,'rows':_0x453e87}:null;}})[_0x3ffa('0x22')](respondWithResult(_0x1c259a,null))['catch'](handleError(_0x1c259a,null));};exports[_0x3ffa('0x4c')]=function(_0x44b1a6,_0x435a0c,_0x27bfd2){var _0x3fa4fb={};var _0x57e751={};var _0x1e04bb;var _0x399134;return db['ZohoConfiguration'][_0x3ffa('0x47')]({'where':{'id':_0x44b1a6['params']['id']}})[_0x3ffa('0x22')](handleEntityNotFound(_0x435a0c,null))[_0x3ffa('0x22')](function(_0x4134c2){if(_0x4134c2){_0x1e04bb=_0x4134c2;_0x57e751[_0x3ffa('0x2b')]=_['keys'](db[_0x3ffa('0x48')][_0x3ffa('0x28')]);_0x57e751[_0x3ffa('0x2c')]=_[_0x3ffa('0x2d')](_0x44b1a6[_0x3ffa('0x2c')]);_0x57e751['filters']=_[_0x3ffa('0x2f')](_0x57e751[_0x3ffa('0x2b')],_0x57e751[_0x3ffa('0x2c')]);_0x3fa4fb[_0x3ffa('0x30')]=_[_0x3ffa('0x2f')](_0x57e751[_0x3ffa('0x2b')],qs[_0x3ffa('0x31')](_0x44b1a6[_0x3ffa('0x2c')][_0x3ffa('0x31')]));_0x3fa4fb[_0x3ffa('0x30')]=_0x3fa4fb[_0x3ffa('0x30')]['length']?_0x3fa4fb[_0x3ffa('0x30')]:_0x57e751[_0x3ffa('0x2b')];_0x3fa4fb[_0x3ffa('0x34')]=qs[_0x3ffa('0x35')](_0x44b1a6['query'][_0x3ffa('0x35')]);_0x3fa4fb[_0x3ffa('0x37')]=qs['filters'](_['pick'](_0x44b1a6['query'],_0x57e751['filters']));if(_0x44b1a6[_0x3ffa('0x2c')]['filter']){_0x3fa4fb[_0x3ffa('0x37')]=_[_0x3ffa('0x39')](_0x3fa4fb[_0x3ffa('0x37')],{'$or':_[_0x3ffa('0x27')](_0x3fa4fb[_0x3ffa('0x30')],function(_0x3c2967){var _0x106cf9={};_0x106cf9[_0x3c2967]={'$like':'%'+_0x44b1a6['query']['filter']+'%'};return _0x106cf9;})});}_0x3fa4fb=_[_0x3ffa('0x39')]({},_0x3fa4fb,_0x44b1a6[_0x3ffa('0x3a')]);return _0x1e04bb[_0x3ffa('0x4c')](_0x3fa4fb);}})[_0x3ffa('0x22')](function(_0x1f787f){if(_0x1f787f){_0x399134=_0x1f787f['length'];if(!_0x44b1a6[_0x3ffa('0x2c')][_0x3ffa('0x49')](_0x3ffa('0x33'))){_0x3fa4fb[_0x3ffa('0x1c')]=qs['limit'](_0x44b1a6[_0x3ffa('0x2c')][_0x3ffa('0x1c')]);_0x3fa4fb[_0x3ffa('0x1a')]=qs[_0x3ffa('0x1a')](_0x44b1a6['query'][_0x3ffa('0x1a')]);}return _0x1e04bb[_0x3ffa('0x4c')](_0x3fa4fb);}})['then'](function(_0xbbd29e){if(_0xbbd29e){return _0xbbd29e?{'count':_0x399134,'rows':_0xbbd29e}:null;}})[_0x3ffa('0x22')](respondWithResult(_0x435a0c,null))[_0x3ffa('0x44')](handleError(_0x435a0c,null));}; \ No newline at end of file +var _0x8f32=['params','fields','include','find','create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','map','ZohoConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','catch','show'];(function(_0x11277f,_0x37bb02){var _0x196686=function(_0x349021){while(--_0x349021){_0x11277f['push'](_0x11277f['shift']());}};_0x196686(++_0x37bb02);}(_0x8f32,0x14c));var _0x28f3=function(_0x2dddf9,_0x38f1fc){_0x2dddf9=_0x2dddf9-0x0;var _0x1312ea=_0x8f32[_0x2dddf9];return _0x1312ea;};'use strict';var emlformat=require(_0x28f3('0x0'));var rimraf=require(_0x28f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28f3('0x2'));var rp=require(_0x28f3('0x3'));var moment=require(_0x28f3('0x4'));var BPromise=require(_0x28f3('0x5'));var Mustache=require('mustache');var util=require(_0x28f3('0x6'));var path=require(_0x28f3('0x7'));var sox=require(_0x28f3('0x8'));var csv=require(_0x28f3('0x9'));var ejs=require(_0x28f3('0xa'));var fs=require('fs');var fs_extra=require(_0x28f3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x28f3('0xc'));var jsforce=require(_0x28f3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x28f3('0x9'));var querystring=require(_0x28f3('0xe'));var Papa=require(_0x28f3('0xf'));var Redis=require(_0x28f3('0x10'));var authService=require(_0x28f3('0x11'));var qs=require(_0x28f3('0x12'));var as=require(_0x28f3('0x13'));var hardwareService=require(_0x28f3('0x14'));var logger=require(_0x28f3('0x15'))(_0x28f3('0x16'));var utils=require(_0x28f3('0x17'));var config=require(_0x28f3('0x18'));var licenseUtil=require(_0x28f3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aecf7,_0x1474a8){_0x1474a8=_0x1474a8||0xcc;return function(_0x1b9d21){if(_0x1b9d21){return _0x1aecf7[_0x28f3('0x1a')](_0x1474a8);}return _0x1aecf7[_0x28f3('0x1b')](_0x1474a8)[_0x28f3('0x1c')]();};}function respondWithResult(_0x3116d3,_0x319628){_0x319628=_0x319628||0xc8;return function(_0x4be9c1){if(_0x4be9c1){return _0x3116d3['status'](_0x319628)[_0x28f3('0x1d')](_0x4be9c1);}};}function respondWithFilteredResult(_0x39cc6b,_0x11c74f){return function(_0x55ce40){if(_0x55ce40){var _0x25c2bd=typeof _0x11c74f[_0x28f3('0x1e')]===_0x28f3('0x1f')&&typeof _0x11c74f[_0x28f3('0x20')]===_0x28f3('0x1f');var _0x20e847=_0x55ce40['count'];var _0x3ff843=_0x25c2bd?0x0:_0x11c74f[_0x28f3('0x1e')];var _0x1e0032=_0x25c2bd?_0x55ce40['count']:_0x11c74f[_0x28f3('0x1e')]+_0x11c74f[_0x28f3('0x20')];var _0x33e546;if(_0x1e0032>=_0x20e847){_0x1e0032=_0x20e847;_0x33e546=0xc8;}else{_0x33e546=0xce;}_0x39cc6b[_0x28f3('0x1b')](_0x33e546);return _0x39cc6b[_0x28f3('0x21')](_0x28f3('0x22'),_0x3ff843+'-'+_0x1e0032+'/'+_0x20e847)['json'](_0x55ce40);}return null;};}function patchUpdates(_0x4139a2){return function(_0x3e7bc0){try{jsonpatch['apply'](_0x3e7bc0,_0x4139a2,!![]);}catch(_0x2b74cc){return BPromise[_0x28f3('0x23')](_0x2b74cc);}return _0x3e7bc0[_0x28f3('0x24')]();};}function saveUpdates(_0x387414,_0x52bc0b){return function(_0x1d85f7){if(_0x1d85f7){return _0x1d85f7[_0x28f3('0x25')](_0x387414)['then'](function(_0x3aa2e4){return _0x3aa2e4;});}return null;};}function removeEntity(_0x3f0763,_0x451170){return function(_0xb65a6b){if(_0xb65a6b){return _0xb65a6b[_0x28f3('0x26')]()['then'](function(){_0x3f0763[_0x28f3('0x1b')](0xcc)[_0x28f3('0x1c')]();});}};}function handleEntityNotFound(_0x289466,_0x4acbd6){return function(_0x460b5e){if(!_0x460b5e){_0x289466['sendStatus'](0x194);}return _0x460b5e;};}function handleError(_0x4681d9,_0x996e35){_0x996e35=_0x996e35||0x1f4;return function(_0x4f3124){logger[_0x28f3('0x27')](_0x4f3124[_0x28f3('0x28')]);if(_0x4f3124[_0x28f3('0x29')]){delete _0x4f3124[_0x28f3('0x29')];}_0x4681d9['status'](_0x996e35)[_0x28f3('0x2a')](_0x4f3124);};}exports['index']=function(_0x4d074c,_0x3e147c){var _0xbe4dee={},_0x497771={},_0x22b3f6={'count':0x0,'rows':[]};var _0x3d68b2=_[_0x28f3('0x2b')](db[_0x28f3('0x2c')][_0x28f3('0x2d')],function(_0x7902c6){return{'name':_0x7902c6['fieldName'],'type':_0x7902c6[_0x28f3('0x2e')]['key']};});_0x497771[_0x28f3('0x2f')]=_['map'](_0x3d68b2,_0x28f3('0x29'));_0x497771[_0x28f3('0x30')]=_[_0x28f3('0x31')](_0x4d074c[_0x28f3('0x30')]);_0x497771[_0x28f3('0x32')]=_['intersection'](_0x497771[_0x28f3('0x2f')],_0x497771[_0x28f3('0x30')]);_0xbe4dee['attributes']=_[_0x28f3('0x33')](_0x497771[_0x28f3('0x2f')],qs['fields'](_0x4d074c[_0x28f3('0x30')]['fields']));_0xbe4dee[_0x28f3('0x34')]=_0xbe4dee[_0x28f3('0x34')][_0x28f3('0x35')]?_0xbe4dee[_0x28f3('0x34')]:_0x497771[_0x28f3('0x2f')];if(!_0x4d074c[_0x28f3('0x30')]['hasOwnProperty'](_0x28f3('0x36'))){_0xbe4dee[_0x28f3('0x20')]=qs[_0x28f3('0x20')](_0x4d074c[_0x28f3('0x30')][_0x28f3('0x20')]);_0xbe4dee['offset']=qs[_0x28f3('0x1e')](_0x4d074c[_0x28f3('0x30')]['offset']);}_0xbe4dee[_0x28f3('0x37')]=qs[_0x28f3('0x38')](_0x4d074c[_0x28f3('0x30')][_0x28f3('0x38')]);_0xbe4dee[_0x28f3('0x39')]=qs['filters'](_[_0x28f3('0x3a')](_0x4d074c[_0x28f3('0x30')],_0x497771[_0x28f3('0x32')]),_0x3d68b2);if(_0x4d074c[_0x28f3('0x30')][_0x28f3('0x3b')]){_0xbe4dee[_0x28f3('0x39')]=_[_0x28f3('0x3c')](_0xbe4dee['where'],{'$or':_[_0x28f3('0x2b')](_0x3d68b2,function(_0x9f4c3c){if(_0x9f4c3c[_0x28f3('0x2e')]!=='VIRTUAL'){var _0x4fbfb6={};_0x4fbfb6[_0x9f4c3c[_0x28f3('0x29')]]={'$like':'%'+_0x4d074c[_0x28f3('0x30')][_0x28f3('0x3b')]+'%'};return _0x4fbfb6;}})});}_0xbe4dee=_[_0x28f3('0x3c')]({},_0xbe4dee,_0x4d074c[_0x28f3('0x3d')]);var _0x104dce={'where':_0xbe4dee[_0x28f3('0x39')]};return db['ZohoConfiguration']['count'](_0x104dce)[_0x28f3('0x3e')](function(_0x50b4da){_0x22b3f6['count']=_0x50b4da;if(_0x4d074c[_0x28f3('0x30')][_0x28f3('0x3f')]){_0xbe4dee['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x28f3('0x40')](_0xbe4dee);})[_0x28f3('0x3e')](function(_0x490457){_0x22b3f6[_0x28f3('0x41')]=_0x490457;return _0x22b3f6;})[_0x28f3('0x3e')](respondWithFilteredResult(_0x3e147c,_0xbe4dee))[_0x28f3('0x42')](handleError(_0x3e147c,null));};exports[_0x28f3('0x43')]=function(_0x2024ae,_0x3ec5ac){var _0x1f4199={'raw':![],'where':{'id':_0x2024ae[_0x28f3('0x44')]['id']}},_0x146ace={};_0x146ace['model']=_[_0x28f3('0x31')](db[_0x28f3('0x2c')][_0x28f3('0x2d')]);_0x146ace[_0x28f3('0x30')]=_['keys'](_0x2024ae[_0x28f3('0x30')]);_0x146ace[_0x28f3('0x32')]=_[_0x28f3('0x33')](_0x146ace[_0x28f3('0x2f')],_0x146ace[_0x28f3('0x30')]);_0x1f4199[_0x28f3('0x34')]=_['intersection'](_0x146ace['model'],qs['fields'](_0x2024ae['query'][_0x28f3('0x45')]));_0x1f4199[_0x28f3('0x34')]=_0x1f4199[_0x28f3('0x34')][_0x28f3('0x35')]?_0x1f4199[_0x28f3('0x34')]:_0x146ace[_0x28f3('0x2f')];if(_0x2024ae[_0x28f3('0x30')]['includeAll']){_0x1f4199[_0x28f3('0x46')]=[{'all':!![]}];}_0x1f4199=_['merge']({},_0x1f4199,_0x2024ae['options']);return db[_0x28f3('0x2c')][_0x28f3('0x47')](_0x1f4199)[_0x28f3('0x3e')](handleEntityNotFound(_0x3ec5ac,null))[_0x28f3('0x3e')](respondWithResult(_0x3ec5ac,null))[_0x28f3('0x42')](handleError(_0x3ec5ac,null));};exports[_0x28f3('0x48')]=function(_0x5c7eea,_0x5355e1){return db[_0x28f3('0x2c')][_0x28f3('0x48')](_0x5c7eea[_0x28f3('0x49')],{})[_0x28f3('0x3e')](respondWithResult(_0x5355e1,0xc9))[_0x28f3('0x42')](handleError(_0x5355e1,null));};exports[_0x28f3('0x25')]=function(_0x2963de,_0x1b3c2c){if(_0x2963de[_0x28f3('0x49')]['id']){delete _0x2963de[_0x28f3('0x49')]['id'];}return db[_0x28f3('0x2c')][_0x28f3('0x47')]({'where':{'id':_0x2963de[_0x28f3('0x44')]['id']}})[_0x28f3('0x3e')](handleEntityNotFound(_0x1b3c2c,null))[_0x28f3('0x3e')](saveUpdates(_0x2963de[_0x28f3('0x49')],null))[_0x28f3('0x3e')](respondWithResult(_0x1b3c2c,null))[_0x28f3('0x42')](handleError(_0x1b3c2c,null));};exports[_0x28f3('0x26')]=function(_0xf5f296,_0x158854){return db[_0x28f3('0x2c')][_0x28f3('0x47')]({'where':{'id':_0xf5f296[_0x28f3('0x44')]['id']}})['then'](handleEntityNotFound(_0x158854,null))[_0x28f3('0x3e')](removeEntity(_0x158854,null))[_0x28f3('0x42')](handleError(_0x158854,null));};exports[_0x28f3('0x4a')]=function(_0x3996c3,_0xaca5cc,_0x3f8c55){var _0x592aab={};var _0x197703={};var _0x3825e2;var _0x3066a5;return db[_0x28f3('0x2c')][_0x28f3('0x4b')]({'where':{'id':_0x3996c3['params']['id']}})[_0x28f3('0x3e')](handleEntityNotFound(_0xaca5cc,null))[_0x28f3('0x3e')](function(_0x4ab98f){if(_0x4ab98f){_0x3825e2=_0x4ab98f;_0x197703[_0x28f3('0x2f')]=_[_0x28f3('0x31')](db[_0x28f3('0x4c')][_0x28f3('0x2d')]);_0x197703['query']=_[_0x28f3('0x31')](_0x3996c3['query']);_0x197703[_0x28f3('0x32')]=_[_0x28f3('0x33')](_0x197703[_0x28f3('0x2f')],_0x197703[_0x28f3('0x30')]);_0x592aab[_0x28f3('0x34')]=_[_0x28f3('0x33')](_0x197703[_0x28f3('0x2f')],qs['fields'](_0x3996c3['query']['fields']));_0x592aab[_0x28f3('0x34')]=_0x592aab[_0x28f3('0x34')][_0x28f3('0x35')]?_0x592aab[_0x28f3('0x34')]:_0x197703[_0x28f3('0x2f')];_0x592aab[_0x28f3('0x37')]=qs[_0x28f3('0x38')](_0x3996c3[_0x28f3('0x30')][_0x28f3('0x38')]);_0x592aab[_0x28f3('0x39')]=qs[_0x28f3('0x32')](_['pick'](_0x3996c3[_0x28f3('0x30')],_0x197703[_0x28f3('0x32')]));if(_0x3996c3[_0x28f3('0x30')][_0x28f3('0x3b')]){_0x592aab[_0x28f3('0x39')]=_[_0x28f3('0x3c')](_0x592aab[_0x28f3('0x39')],{'$or':_[_0x28f3('0x2b')](_0x592aab[_0x28f3('0x34')],function(_0x56f1f2){var _0x4a1f68={};_0x4a1f68[_0x56f1f2]={'$like':'%'+_0x3996c3[_0x28f3('0x30')][_0x28f3('0x3b')]+'%'};return _0x4a1f68;})});}_0x592aab=_[_0x28f3('0x3c')]({},_0x592aab,_0x3996c3[_0x28f3('0x3d')]);return _0x3825e2['getFields'](_0x592aab);}})[_0x28f3('0x3e')](function(_0x42d89b){if(_0x42d89b){_0x3066a5=_0x42d89b[_0x28f3('0x35')];if(!_0x3996c3[_0x28f3('0x30')][_0x28f3('0x4d')](_0x28f3('0x36'))){_0x592aab[_0x28f3('0x20')]=qs[_0x28f3('0x20')](_0x3996c3[_0x28f3('0x30')][_0x28f3('0x20')]);_0x592aab[_0x28f3('0x1e')]=qs[_0x28f3('0x1e')](_0x3996c3[_0x28f3('0x30')][_0x28f3('0x1e')]);}return _0x3825e2[_0x28f3('0x4a')](_0x592aab);}})['then'](function(_0x2634b1){if(_0x2634b1){return _0x2634b1?{'count':_0x3066a5,'rows':_0x2634b1}:null;}})[_0x28f3('0x3e')](respondWithResult(_0xaca5cc,null))[_0x28f3('0x42')](handleError(_0xaca5cc,null));};exports[_0x28f3('0x4e')]=function(_0x22c0fe,_0x3f1ad4,_0x5702b0){var _0x3c9e38={};var _0x564109={};var _0x1c2b44;var _0x192d06;return db[_0x28f3('0x2c')][_0x28f3('0x4b')]({'where':{'id':_0x22c0fe[_0x28f3('0x44')]['id']}})[_0x28f3('0x3e')](handleEntityNotFound(_0x3f1ad4,null))[_0x28f3('0x3e')](function(_0x366484){if(_0x366484){_0x1c2b44=_0x366484;_0x564109[_0x28f3('0x2f')]=_[_0x28f3('0x31')](db[_0x28f3('0x4c')][_0x28f3('0x2d')]);_0x564109['query']=_[_0x28f3('0x31')](_0x22c0fe[_0x28f3('0x30')]);_0x564109[_0x28f3('0x32')]=_[_0x28f3('0x33')](_0x564109['model'],_0x564109[_0x28f3('0x30')]);_0x3c9e38[_0x28f3('0x34')]=_['intersection'](_0x564109[_0x28f3('0x2f')],qs[_0x28f3('0x45')](_0x22c0fe['query'][_0x28f3('0x45')]));_0x3c9e38['attributes']=_0x3c9e38[_0x28f3('0x34')][_0x28f3('0x35')]?_0x3c9e38['attributes']:_0x564109[_0x28f3('0x2f')];_0x3c9e38['order']=qs[_0x28f3('0x38')](_0x22c0fe['query']['sort']);_0x3c9e38[_0x28f3('0x39')]=qs['filters'](_[_0x28f3('0x3a')](_0x22c0fe['query'],_0x564109['filters']));if(_0x22c0fe['query'][_0x28f3('0x3b')]){_0x3c9e38[_0x28f3('0x39')]=_['merge'](_0x3c9e38[_0x28f3('0x39')],{'$or':_[_0x28f3('0x2b')](_0x3c9e38[_0x28f3('0x34')],function(_0x44bb00){var _0x3a8e2e={};_0x3a8e2e[_0x44bb00]={'$like':'%'+_0x22c0fe[_0x28f3('0x30')][_0x28f3('0x3b')]+'%'};return _0x3a8e2e;})});}_0x3c9e38=_[_0x28f3('0x3c')]({},_0x3c9e38,_0x22c0fe[_0x28f3('0x3d')]);return _0x1c2b44['getSubjects'](_0x3c9e38);}})[_0x28f3('0x3e')](function(_0x26dfca){if(_0x26dfca){_0x192d06=_0x26dfca['length'];if(!_0x22c0fe[_0x28f3('0x30')]['hasOwnProperty']('nolimit')){_0x3c9e38[_0x28f3('0x20')]=qs[_0x28f3('0x20')](_0x22c0fe['query'][_0x28f3('0x20')]);_0x3c9e38[_0x28f3('0x1e')]=qs['offset'](_0x22c0fe['query'][_0x28f3('0x1e')]);}return _0x1c2b44['getSubjects'](_0x3c9e38);}})[_0x28f3('0x3e')](function(_0x25a84c){if(_0x25a84c){return _0x25a84c?{'count':_0x192d06,'rows':_0x25a84c}:null;}})[_0x28f3('0x3e')](respondWithResult(_0x3f1ad4,null))[_0x28f3('0x42')](handleError(_0x3f1ad4,null));};exports[_0x28f3('0x4f')]=function(_0x21af77,_0x2a5a75,_0x3412c9){var _0x4c34fe={};var _0x216da5={};var _0x1ec558;var _0x464004;return db[_0x28f3('0x2c')][_0x28f3('0x4b')]({'where':{'id':_0x21af77[_0x28f3('0x44')]['id']}})[_0x28f3('0x3e')](handleEntityNotFound(_0x2a5a75,null))[_0x28f3('0x3e')](function(_0x4c6e13){if(_0x4c6e13){_0x1ec558=_0x4c6e13;_0x216da5[_0x28f3('0x2f')]=_['keys'](db['ZohoField'][_0x28f3('0x2d')]);_0x216da5['query']=_[_0x28f3('0x31')](_0x21af77[_0x28f3('0x30')]);_0x216da5[_0x28f3('0x32')]=_[_0x28f3('0x33')](_0x216da5[_0x28f3('0x2f')],_0x216da5['query']);_0x4c34fe['attributes']=_[_0x28f3('0x33')](_0x216da5[_0x28f3('0x2f')],qs[_0x28f3('0x45')](_0x21af77['query']['fields']));_0x4c34fe[_0x28f3('0x34')]=_0x4c34fe[_0x28f3('0x34')][_0x28f3('0x35')]?_0x4c34fe['attributes']:_0x216da5[_0x28f3('0x2f')];_0x4c34fe[_0x28f3('0x37')]=qs['sort'](_0x21af77[_0x28f3('0x30')]['sort']);_0x4c34fe[_0x28f3('0x39')]=qs[_0x28f3('0x32')](_[_0x28f3('0x3a')](_0x21af77[_0x28f3('0x30')],_0x216da5[_0x28f3('0x32')]));if(_0x21af77[_0x28f3('0x30')]['filter']){_0x4c34fe[_0x28f3('0x39')]=_[_0x28f3('0x3c')](_0x4c34fe['where'],{'$or':_[_0x28f3('0x2b')](_0x4c34fe[_0x28f3('0x34')],function(_0x1a4469){var _0x50c664={};_0x50c664[_0x1a4469]={'$like':'%'+_0x21af77['query'][_0x28f3('0x3b')]+'%'};return _0x50c664;})});}_0x4c34fe=_['merge']({},_0x4c34fe,_0x21af77[_0x28f3('0x3d')]);return _0x1ec558[_0x28f3('0x4f')](_0x4c34fe);}})[_0x28f3('0x3e')](function(_0x23677f){if(_0x23677f){_0x464004=_0x23677f[_0x28f3('0x35')];if(!_0x21af77[_0x28f3('0x30')][_0x28f3('0x4d')]('nolimit')){_0x4c34fe[_0x28f3('0x20')]=qs[_0x28f3('0x20')](_0x21af77['query']['limit']);_0x4c34fe[_0x28f3('0x1e')]=qs[_0x28f3('0x1e')](_0x21af77[_0x28f3('0x30')][_0x28f3('0x1e')]);}return _0x1ec558[_0x28f3('0x4f')](_0x4c34fe);}})[_0x28f3('0x3e')](function(_0x3209e0){if(_0x3209e0){return _0x3209e0?{'count':_0x464004,'rows':_0x3209e0}:null;}})[_0x28f3('0x3e')](respondWithResult(_0x2a5a75,null))[_0x28f3('0x42')](handleError(_0x2a5a75,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 357018a..998ebf8 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 _0x05cb=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','lodash'];(function(_0x1c9721,_0x3f83a4){var _0x5b1a4c=function(_0x44f048){while(--_0x44f048){_0x1c9721['push'](_0x1c9721['shift']());}};_0x5b1a4c(++_0x3f83a4);}(_0x05cb,0x95));var _0xb05c=function(_0x14de5f,_0x4714b0){_0x14de5f=_0x14de5f-0x0;var _0x36c96d=_0x05cb[_0x14de5f];return _0x36c96d;};'use strict';var _=require(_0xb05c('0x0'));var util=require('util');var logger=require(_0xb05c('0x1'))(_0xb05c('0x2'));var moment=require(_0xb05c('0x3'));var BPromise=require(_0xb05c('0x4'));var rp=require(_0xb05c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb05c('0x6'));var config=require(_0xb05c('0x7'));var attributes=require(_0xb05c('0x8'));module[_0xb05c('0x9')]=function(_0x17773f,_0x397f41){return _0x17773f['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2b7=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x229f5e,_0x433f0f){var _0x2d62ff=function(_0xe4d381){while(--_0xe4d381){_0x229f5e['push'](_0x229f5e['shift']());}};_0x2d62ff(++_0x433f0f);}(_0xf2b7,0x150));var _0x7f2b=function(_0x168928,_0x49e53d){_0x168928=_0x168928-0x0;var _0x33d81c=_0xf2b7[_0x168928];return _0x33d81c;};'use strict';var _=require(_0x7f2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7f2b('0x1'));var moment=require('moment');var BPromise=require(_0x7f2b('0x2'));var rp=require(_0x7f2b('0x3'));var fs=require('fs');var path=require(_0x7f2b('0x4'));var rimraf=require(_0x7f2b('0x5'));var config=require(_0x7f2b('0x6'));var attributes=require(_0x7f2b('0x7'));module[_0x7f2b('0x8')]=function(_0x1b3310,_0x3cbca5){return _0x1b3310[_0x7f2b('0x9')](_0x7f2b('0xa'),attributes,{'tableName':_0x7f2b('0xb'),'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 193e80c..6fa7537 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 _0x8b06=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x533edf,_0x408bef){var _0x504d54=function(_0x5f4b81){while(--_0x5f4b81){_0x533edf['push'](_0x533edf['shift']());}};_0x504d54(++_0x408bef);}(_0x8b06,0x1ee));var _0x68b0=function(_0xb1aadf,_0xba8308){_0xb1aadf=_0xb1aadf-0x0;var _0x5b7be6=_0x8b06[_0xb1aadf];return _0x5b7be6;};'use strict';var _=require('lodash');var util=require(_0x68b0('0x0'));var moment=require(_0x68b0('0x1'));var BPromise=require(_0x68b0('0x2'));var rs=require(_0x68b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68b0('0x4'))['db'];var utils=require(_0x68b0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x68b0('0x6'));var jayson=require(_0x68b0('0x7'));var client=jayson[_0x68b0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1170,_0x17b826,_0x216522){return new BPromise(function(_0x4934bb,_0x1c2abd){return client[_0x68b0('0x9')](_0x3e1170,_0x216522)[_0x68b0('0xa')](function(_0x144fa8){logger[_0x68b0('0xb')](_0x68b0('0xc'),_0x17b826,_0x68b0('0xd'));logger[_0x68b0('0xe')](_0x68b0('0xf'),_0x17b826,'request\x20sent',JSON[_0x68b0('0x10')](_0x144fa8));if(_0x144fa8['error']){if(_0x144fa8['error'][_0x68b0('0x11')]===0x1f4){logger[_0x68b0('0x12')](_0x68b0('0xc'),_0x17b826,_0x144fa8['error'][_0x68b0('0x13')]);return _0x1c2abd(_0x144fa8[_0x68b0('0x12')][_0x68b0('0x13')]);}logger[_0x68b0('0x12')](_0x68b0('0xc'),_0x17b826,_0x144fa8[_0x68b0('0x12')][_0x68b0('0x13')]);return _0x4934bb(_0x144fa8[_0x68b0('0x12')][_0x68b0('0x13')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x17b826,'request\x20sent');_0x4934bb(_0x144fa8[_0x68b0('0x14')]['message']);}})[_0x68b0('0x15')](function(_0x58d450){logger[_0x68b0('0x12')](_0x68b0('0xc'),_0x17b826,_0x58d450);_0x1c2abd(_0x58d450);});});} \ No newline at end of file +var _0x73a7=['request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x73a7,0x148));var _0x773a=function(_0x15ae2d,_0xe14444){_0x15ae2d=_0x15ae2d-0x0;var _0x14926c=_0x73a7[_0x15ae2d];return _0x14926c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x773a('0x0'));var BPromise=require('bluebird');var rs=require(_0x773a('0x1'));var fs=require('fs');var Redis=require(_0x773a('0x2'));var db=require(_0x773a('0x3'))['db'];var utils=require(_0x773a('0x4'));var logger=require(_0x773a('0x5'))(_0x773a('0x6'));var config=require(_0x773a('0x7'));var jayson=require(_0x773a('0x8'));var client=jayson['client'][_0x773a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d498,_0x55cdb4,_0x388537){return new BPromise(function(_0xc4dffd,_0x1434f5){return client['request'](_0x52d498,_0x388537)[_0x773a('0xa')](function(_0x32e12b){logger[_0x773a('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x55cdb4,_0x773a('0xc'));logger['debug'](_0x773a('0xd'),_0x55cdb4,_0x773a('0xc'),JSON[_0x773a('0xe')](_0x32e12b));if(_0x32e12b[_0x773a('0xf')]){if(_0x32e12b['error'][_0x773a('0x10')]===0x1f4){logger[_0x773a('0xf')](_0x773a('0x11'),_0x55cdb4,_0x32e12b[_0x773a('0xf')][_0x773a('0x12')]);return _0x1434f5(_0x32e12b[_0x773a('0xf')][_0x773a('0x12')]);}logger[_0x773a('0xf')](_0x773a('0x11'),_0x55cdb4,_0x32e12b['error'][_0x773a('0x12')]);return _0xc4dffd(_0x32e12b[_0x773a('0xf')][_0x773a('0x12')]);}else{logger[_0x773a('0xb')](_0x773a('0x11'),_0x55cdb4,_0x773a('0xc'));_0xc4dffd(_0x32e12b[_0x773a('0x13')]['message']);}})['catch'](function(_0x25648d){logger['error'](_0x773a('0x11'),_0x55cdb4,_0x25648d);_0x1434f5(_0x25648d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index eeeb6de..7640eed 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 _0x263e=['create','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4a4369,_0xeda22b){var _0x2f66fe=function(_0x4dfe21){while(--_0x4dfe21){_0x4a4369['push'](_0x4a4369['shift']());}};_0x2f66fe(++_0xeda22b);}(_0x263e,0x110));var _0xe263=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x263e[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0xe263('0x0'));var util=require(_0xe263('0x1'));var path=require(_0xe263('0x2'));var timeout=require(_0xe263('0x3'));var express=require(_0xe263('0x4'));var router=express[_0xe263('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe263('0x6'));var config=require('../../config/environment');var controller=require(_0xe263('0x7'));router['get']('/',auth[_0xe263('0x8')](),controller[_0xe263('0x9')]);router[_0xe263('0xa')](_0xe263('0xb'),auth[_0xe263('0x8')](),controller[_0xe263('0xc')]);router['post']('/',auth[_0xe263('0x8')](),controller[_0xe263('0xd')]);router['put'](_0xe263('0xb'),auth[_0xe263('0x8')](),controller['update']);router['delete'](_0xe263('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe263('0xe')]=router; \ No newline at end of file +var _0xf41d=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4b0589,_0xed7f9a){var _0x45ce5f=function(_0x2b9ba2){while(--_0x2b9ba2){_0x4b0589['push'](_0x4b0589['shift']());}};_0x45ce5f(++_0xed7f9a);}(_0xf41d,0xa0));var _0xdf41=function(_0x1bcf55,_0x3eefa4){_0x1bcf55=_0x1bcf55-0x0;var _0x30bf4c=_0xf41d[_0x1bcf55];return _0x30bf4c;};'use strict';var multer=require(_0xdf41('0x0'));var util=require(_0xdf41('0x1'));var path=require('path');var timeout=require(_0xdf41('0x2'));var express=require(_0xdf41('0x3'));var router=express['Router']();var fs_extra=require(_0xdf41('0x4'));var auth=require(_0xdf41('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdf41('0x6'));var controller=require(_0xdf41('0x7'));router[_0xdf41('0x8')]('/',auth[_0xdf41('0x9')](),controller['index']);router['get'](_0xdf41('0xa'),auth[_0xdf41('0x9')](),controller[_0xdf41('0xb')]);router[_0xdf41('0xc')]('/',auth[_0xdf41('0x9')](),controller[_0xdf41('0xd')]);router[_0xdf41('0xe')]('/:id',auth[_0xdf41('0x9')](),controller['update']);router[_0xdf41('0xf')](_0xdf41('0xa'),auth[_0xdf41('0x9')](),controller[_0xdf41('0x10')]);module[_0xdf41('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6972321..1ed0f0c 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 _0x664a=['variable','customVariable','keyValue','picklist','STRING','string','exports','ENUM'];(function(_0x2f3782,_0x150f14){var _0x40a8c4=function(_0x1cdc87){while(--_0x1cdc87){_0x2f3782['push'](_0x2f3782['shift']());}};_0x40a8c4(++_0x150f14);}(_0x664a,0x9e));var _0xa664=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x664a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0xa664('0x0')]={'type':{'type':Sequelize[_0xa664('0x1')]('string',_0xa664('0x2'),_0xa664('0x3'),_0xa664('0x4'),_0xa664('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa664('0x6')]},'keyType':{'type':Sequelize[_0xa664('0x1')](_0xa664('0x7'),_0xa664('0x2'),_0xa664('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa664('0x6')]},'nameField':{'type':Sequelize[_0xa664('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa664('0x6')]}}; \ No newline at end of file +var _0x1844=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2eb42d,_0x330213){var _0x3ceff=function(_0x24b8d2){while(--_0x24b8d2){_0x2eb42d['push'](_0x2eb42d['shift']());}};_0x3ceff(++_0x330213);}(_0x1844,0x1c2));var _0x4184=function(_0x32f376,_0x2c8523){_0x32f376=_0x32f376-0x0;var _0x55ba12=_0x1844[_0x32f376];return _0x55ba12;};'use strict';var Sequelize=require(_0x4184('0x0'));module[_0x4184('0x1')]={'type':{'type':Sequelize[_0x4184('0x2')](_0x4184('0x3'),_0x4184('0x4'),_0x4184('0x5'),_0x4184('0x6'),_0x4184('0x7')),'defaultValue':_0x4184('0x3')},'content':{'type':Sequelize[_0x4184('0x8')]},'key':{'type':Sequelize[_0x4184('0x8')]},'keyType':{'type':Sequelize[_0x4184('0x2')](_0x4184('0x3'),_0x4184('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4184('0x8')]},'idField':{'type':Sequelize[_0x4184('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4184('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2678dfb..7822493 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 _0x3fc4=['index','map','ZohoField','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x19bc11,_0x59c8e6){var _0x579c65=function(_0x237370){while(--_0x237370){_0x19bc11['push'](_0x19bc11['shift']());}};_0x579c65(++_0x59c8e6);}(_0x3fc4,0x6a));var _0x43fc=function(_0x220bd5,_0x318f24){_0x220bd5=_0x220bd5-0x0;var _0x3f9dc7=_0x3fc4[_0x220bd5];return _0x3f9dc7;};'use strict';var emlformat=require(_0x43fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43fc('0x2'));var moment=require(_0x43fc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43fc('0x4'));var util=require('util');var path=require(_0x43fc('0x5'));var sox=require(_0x43fc('0x6'));var csv=require(_0x43fc('0x7'));var ejs=require(_0x43fc('0x8'));var fs=require('fs');var fs_extra=require(_0x43fc('0x9'));var _=require(_0x43fc('0xa'));var squel=require(_0x43fc('0xb'));var crypto=require(_0x43fc('0xc'));var jsforce=require(_0x43fc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x43fc('0x7'));var querystring=require('querystring');var Papa=require(_0x43fc('0xe'));var Redis=require(_0x43fc('0xf'));var authService=require(_0x43fc('0x10'));var qs=require(_0x43fc('0x11'));var as=require(_0x43fc('0x12'));var hardwareService=require(_0x43fc('0x13'));var logger=require(_0x43fc('0x14'))(_0x43fc('0x15'));var utils=require(_0x43fc('0x16'));var config=require(_0x43fc('0x17'));var licenseUtil=require(_0x43fc('0x18'));var db=require(_0x43fc('0x19'))['db'];function respondWithStatusCode(_0x49e99e,_0x31fad6){_0x31fad6=_0x31fad6||0xcc;return function(_0x521199){if(_0x521199){return _0x49e99e[_0x43fc('0x1a')](_0x31fad6);}return _0x49e99e[_0x43fc('0x1b')](_0x31fad6)['end']();};}function respondWithResult(_0x3b2ef9,_0x4b3ccd){_0x4b3ccd=_0x4b3ccd||0xc8;return function(_0x30b087){if(_0x30b087){return _0x3b2ef9[_0x43fc('0x1b')](_0x4b3ccd)[_0x43fc('0x1c')](_0x30b087);}};}function respondWithFilteredResult(_0x53701e,_0x5e2c71){return function(_0x9a8b9d){if(_0x9a8b9d){var _0x43d7aa=typeof _0x5e2c71[_0x43fc('0x1d')]==='undefined'&&typeof _0x5e2c71['limit']==='undefined';var _0x43b860=_0x9a8b9d[_0x43fc('0x1e')];var _0xc8744e=_0x43d7aa?0x0:_0x5e2c71[_0x43fc('0x1d')];var _0x37f256=_0x43d7aa?_0x9a8b9d['count']:_0x5e2c71[_0x43fc('0x1d')]+_0x5e2c71[_0x43fc('0x1f')];var _0x582db0;if(_0x37f256>=_0x43b860){_0x37f256=_0x43b860;_0x582db0=0xc8;}else{_0x582db0=0xce;}_0x53701e[_0x43fc('0x1b')](_0x582db0);return _0x53701e[_0x43fc('0x20')](_0x43fc('0x21'),_0xc8744e+'-'+_0x37f256+'/'+_0x43b860)['json'](_0x9a8b9d);}return null;};}function patchUpdates(_0x57421b){return function(_0x2746d2){try{jsonpatch['apply'](_0x2746d2,_0x57421b,!![]);}catch(_0xd4fa71){return BPromise[_0x43fc('0x22')](_0xd4fa71);}return _0x2746d2[_0x43fc('0x23')]();};}function saveUpdates(_0x368cf0,_0x52be47){return function(_0xcdefbb){if(_0xcdefbb){return _0xcdefbb[_0x43fc('0x24')](_0x368cf0)[_0x43fc('0x25')](function(_0x253321){return _0x253321;});}return null;};}function removeEntity(_0x541820,_0x598258){return function(_0x49f3e8){if(_0x49f3e8){return _0x49f3e8[_0x43fc('0x26')]()['then'](function(){_0x541820[_0x43fc('0x1b')](0xcc)[_0x43fc('0x27')]();});}};}function handleEntityNotFound(_0x513805,_0x4e638a){return function(_0x55aaec){if(!_0x55aaec){_0x513805[_0x43fc('0x1a')](0x194);}return _0x55aaec;};}function handleError(_0x365644,_0x55f3f1){_0x55f3f1=_0x55f3f1||0x1f4;return function(_0x34d776){logger[_0x43fc('0x28')](_0x34d776[_0x43fc('0x29')]);if(_0x34d776['name']){delete _0x34d776[_0x43fc('0x2a')];}_0x365644['status'](_0x55f3f1)[_0x43fc('0x2b')](_0x34d776);};}exports[_0x43fc('0x2c')]=function(_0x13b11a,_0x544ef1){var _0x2d21c7={},_0x30b832={},_0x24c375={'count':0x0,'rows':[]};var _0x56c34f=_[_0x43fc('0x2d')](db[_0x43fc('0x2e')][_0x43fc('0x2f')],function(_0x231d8c){return{'name':_0x231d8c[_0x43fc('0x30')],'type':_0x231d8c[_0x43fc('0x31')]['key']};});_0x30b832[_0x43fc('0x32')]=_[_0x43fc('0x2d')](_0x56c34f,_0x43fc('0x2a'));_0x30b832['query']=_['keys'](_0x13b11a[_0x43fc('0x33')]);_0x30b832['filters']=_['intersection'](_0x30b832['model'],_0x30b832[_0x43fc('0x33')]);_0x2d21c7[_0x43fc('0x34')]=_[_0x43fc('0x35')](_0x30b832[_0x43fc('0x32')],qs[_0x43fc('0x36')](_0x13b11a[_0x43fc('0x33')]['fields']));_0x2d21c7[_0x43fc('0x34')]=_0x2d21c7[_0x43fc('0x34')]['length']?_0x2d21c7[_0x43fc('0x34')]:_0x30b832[_0x43fc('0x32')];if(!_0x13b11a[_0x43fc('0x33')]['hasOwnProperty'](_0x43fc('0x37'))){_0x2d21c7['limit']=qs[_0x43fc('0x1f')](_0x13b11a[_0x43fc('0x33')][_0x43fc('0x1f')]);_0x2d21c7['offset']=qs[_0x43fc('0x1d')](_0x13b11a[_0x43fc('0x33')][_0x43fc('0x1d')]);}_0x2d21c7['order']=qs[_0x43fc('0x38')](_0x13b11a[_0x43fc('0x33')][_0x43fc('0x38')]);_0x2d21c7[_0x43fc('0x39')]=qs[_0x43fc('0x3a')](_[_0x43fc('0x3b')](_0x13b11a[_0x43fc('0x33')],_0x30b832[_0x43fc('0x3a')]),_0x56c34f);if(_0x13b11a[_0x43fc('0x33')][_0x43fc('0x3c')]){_0x2d21c7[_0x43fc('0x39')]=_[_0x43fc('0x3d')](_0x2d21c7[_0x43fc('0x39')],{'$or':_[_0x43fc('0x2d')](_0x56c34f,function(_0x2e61b9){if(_0x2e61b9['type']!==_0x43fc('0x3e')){var _0x5ba140={};_0x5ba140[_0x2e61b9[_0x43fc('0x2a')]]={'$like':'%'+_0x13b11a[_0x43fc('0x33')][_0x43fc('0x3c')]+'%'};return _0x5ba140;}})});}_0x2d21c7=_[_0x43fc('0x3d')]({},_0x2d21c7,_0x13b11a[_0x43fc('0x3f')]);var _0x1a61a5={'where':_0x2d21c7[_0x43fc('0x39')]};return db['ZohoField'][_0x43fc('0x1e')](_0x1a61a5)['then'](function(_0x4c04a0){_0x24c375[_0x43fc('0x1e')]=_0x4c04a0;if(_0x13b11a[_0x43fc('0x33')][_0x43fc('0x40')]){_0x2d21c7[_0x43fc('0x41')]=[{'all':!![]}];}return db[_0x43fc('0x2e')][_0x43fc('0x42')](_0x2d21c7);})[_0x43fc('0x25')](function(_0x5f593c){_0x24c375[_0x43fc('0x43')]=_0x5f593c;return _0x24c375;})[_0x43fc('0x25')](respondWithFilteredResult(_0x544ef1,_0x2d21c7))[_0x43fc('0x44')](handleError(_0x544ef1,null));};exports[_0x43fc('0x45')]=function(_0x1ddc40,_0x538be2){var _0x227253={'raw':!![],'where':{'id':_0x1ddc40['params']['id']}},_0x3d626f={};_0x3d626f[_0x43fc('0x32')]=_[_0x43fc('0x46')](db[_0x43fc('0x2e')]['rawAttributes']);_0x3d626f[_0x43fc('0x33')]=_['keys'](_0x1ddc40['query']);_0x3d626f[_0x43fc('0x3a')]=_[_0x43fc('0x35')](_0x3d626f[_0x43fc('0x32')],_0x3d626f[_0x43fc('0x33')]);_0x227253[_0x43fc('0x34')]=_[_0x43fc('0x35')](_0x3d626f['model'],qs[_0x43fc('0x36')](_0x1ddc40[_0x43fc('0x33')][_0x43fc('0x36')]));_0x227253['attributes']=_0x227253['attributes'][_0x43fc('0x47')]?_0x227253['attributes']:_0x3d626f[_0x43fc('0x32')];if(_0x1ddc40[_0x43fc('0x33')]['includeAll']){_0x227253[_0x43fc('0x41')]=[{'all':!![]}];}_0x227253=_[_0x43fc('0x3d')]({},_0x227253,_0x1ddc40[_0x43fc('0x3f')]);return db[_0x43fc('0x2e')][_0x43fc('0x48')](_0x227253)[_0x43fc('0x25')](handleEntityNotFound(_0x538be2,null))[_0x43fc('0x25')](respondWithResult(_0x538be2,null))[_0x43fc('0x44')](handleError(_0x538be2,null));};exports[_0x43fc('0x49')]=function(_0x48a1c0,_0x495fb7){return db[_0x43fc('0x2e')][_0x43fc('0x49')](_0x48a1c0[_0x43fc('0x4a')],{})[_0x43fc('0x25')](respondWithResult(_0x495fb7,0xc9))[_0x43fc('0x44')](handleError(_0x495fb7,null));};exports['update']=function(_0x178a69,_0x319e5e){if(_0x178a69[_0x43fc('0x4a')]['id']){delete _0x178a69[_0x43fc('0x4a')]['id'];}return db[_0x43fc('0x2e')]['find']({'where':{'id':_0x178a69['params']['id']}})[_0x43fc('0x25')](handleEntityNotFound(_0x319e5e,null))[_0x43fc('0x25')](saveUpdates(_0x178a69[_0x43fc('0x4a')],null))[_0x43fc('0x25')](respondWithResult(_0x319e5e,null))['catch'](handleError(_0x319e5e,null));};exports[_0x43fc('0x26')]=function(_0x204787,_0x31dfca){return db[_0x43fc('0x2e')][_0x43fc('0x48')]({'where':{'id':_0x204787['params']['id']}})[_0x43fc('0x25')](handleEntityNotFound(_0x31dfca,null))[_0x43fc('0x25')](removeEntity(_0x31dfca,null))[_0x43fc('0x44')](handleError(_0x31dfca,null));}; \ No newline at end of file +var _0xf064=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x26f959,_0x1cf0c9){var _0x1191b9=function(_0x54cc62){while(--_0x54cc62){_0x26f959['push'](_0x26f959['shift']());}};_0x1191b9(++_0x1cf0c9);}(_0xf064,0xcc));var _0x4f06=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0xf064[_0x4bfade];return _0x272465;};'use strict';var emlformat=require(_0x4f06('0x0'));var rimraf=require(_0x4f06('0x1'));var zipdir=require(_0x4f06('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f06('0x3'));var moment=require(_0x4f06('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f06('0x5'));var path=require(_0x4f06('0x6'));var sox=require('sox');var csv=require(_0x4f06('0x7'));var ejs=require(_0x4f06('0x8'));var fs=require('fs');var fs_extra=require(_0x4f06('0x9'));var _=require(_0x4f06('0xa'));var squel=require(_0x4f06('0xb'));var crypto=require('crypto');var jsforce=require(_0x4f06('0xc'));var deskjs=require(_0x4f06('0xd'));var toCsv=require(_0x4f06('0x7'));var querystring=require(_0x4f06('0xe'));var Papa=require(_0x4f06('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f06('0x10'));var hardwareService=require(_0x4f06('0x11'));var logger=require(_0x4f06('0x12'))(_0x4f06('0x13'));var utils=require(_0x4f06('0x14'));var config=require(_0x4f06('0x15'));var licenseUtil=require(_0x4f06('0x16'));var db=require(_0x4f06('0x17'))['db'];function respondWithStatusCode(_0x57fb8a,_0x1d7397){_0x1d7397=_0x1d7397||0xcc;return function(_0x4ed652){if(_0x4ed652){return _0x57fb8a['sendStatus'](_0x1d7397);}return _0x57fb8a[_0x4f06('0x18')](_0x1d7397)[_0x4f06('0x19')]();};}function respondWithResult(_0xb94fe6,_0x22cccc){_0x22cccc=_0x22cccc||0xc8;return function(_0x429b20){if(_0x429b20){return _0xb94fe6['status'](_0x22cccc)[_0x4f06('0x1a')](_0x429b20);}};}function respondWithFilteredResult(_0x2e5d12,_0x47fad3){return function(_0x32a2c3){if(_0x32a2c3){var _0x307935=typeof _0x47fad3[_0x4f06('0x1b')]===_0x4f06('0x1c')&&typeof _0x47fad3[_0x4f06('0x1d')]===_0x4f06('0x1c');var _0x32d281=_0x32a2c3[_0x4f06('0x1e')];var _0x35fc51=_0x307935?0x0:_0x47fad3['offset'];var _0x2a166f=_0x307935?_0x32a2c3['count']:_0x47fad3[_0x4f06('0x1b')]+_0x47fad3[_0x4f06('0x1d')];var _0x36d53;if(_0x2a166f>=_0x32d281){_0x2a166f=_0x32d281;_0x36d53=0xc8;}else{_0x36d53=0xce;}_0x2e5d12['status'](_0x36d53);return _0x2e5d12[_0x4f06('0x1f')]('Content-Range',_0x35fc51+'-'+_0x2a166f+'/'+_0x32d281)[_0x4f06('0x1a')](_0x32a2c3);}return null;};}function patchUpdates(_0x406581){return function(_0x9bf336){try{jsonpatch[_0x4f06('0x20')](_0x9bf336,_0x406581,!![]);}catch(_0x256ed2){return BPromise[_0x4f06('0x21')](_0x256ed2);}return _0x9bf336[_0x4f06('0x22')]();};}function saveUpdates(_0x427299,_0x510085){return function(_0x323d5a){if(_0x323d5a){return _0x323d5a['update'](_0x427299)[_0x4f06('0x23')](function(_0x505bc5){return _0x505bc5;});}return null;};}function removeEntity(_0x48623e,_0x49747d){return function(_0x4c565c){if(_0x4c565c){return _0x4c565c['destroy']()[_0x4f06('0x23')](function(){_0x48623e[_0x4f06('0x18')](0xcc)[_0x4f06('0x19')]();});}};}function handleEntityNotFound(_0x8b9f14,_0x2e20fb){return function(_0x10571e){if(!_0x10571e){_0x8b9f14[_0x4f06('0x24')](0x194);}return _0x10571e;};}function handleError(_0x36aa48,_0x6e97f){_0x6e97f=_0x6e97f||0x1f4;return function(_0xbdac16){logger[_0x4f06('0x25')](_0xbdac16[_0x4f06('0x26')]);if(_0xbdac16[_0x4f06('0x27')]){delete _0xbdac16[_0x4f06('0x27')];}_0x36aa48['status'](_0x6e97f)['send'](_0xbdac16);};}exports[_0x4f06('0x28')]=function(_0x1554b1,_0x21a661){var _0x26515e={},_0x2f56d0={},_0x49b6f6={'count':0x0,'rows':[]};var _0x1f8fa2=_[_0x4f06('0x29')](db[_0x4f06('0x2a')][_0x4f06('0x2b')],function(_0x46b76d){return{'name':_0x46b76d[_0x4f06('0x2c')],'type':_0x46b76d[_0x4f06('0x2d')][_0x4f06('0x2e')]};});_0x2f56d0[_0x4f06('0x2f')]=_['map'](_0x1f8fa2,_0x4f06('0x27'));_0x2f56d0[_0x4f06('0x30')]=_[_0x4f06('0x31')](_0x1554b1['query']);_0x2f56d0[_0x4f06('0x32')]=_[_0x4f06('0x33')](_0x2f56d0[_0x4f06('0x2f')],_0x2f56d0[_0x4f06('0x30')]);_0x26515e['attributes']=_[_0x4f06('0x33')](_0x2f56d0[_0x4f06('0x2f')],qs[_0x4f06('0x34')](_0x1554b1['query'][_0x4f06('0x34')]));_0x26515e[_0x4f06('0x35')]=_0x26515e[_0x4f06('0x35')]['length']?_0x26515e['attributes']:_0x2f56d0[_0x4f06('0x2f')];if(!_0x1554b1['query']['hasOwnProperty']('nolimit')){_0x26515e[_0x4f06('0x1d')]=qs[_0x4f06('0x1d')](_0x1554b1[_0x4f06('0x30')][_0x4f06('0x1d')]);_0x26515e['offset']=qs['offset'](_0x1554b1['query']['offset']);}_0x26515e[_0x4f06('0x36')]=qs[_0x4f06('0x37')](_0x1554b1['query'][_0x4f06('0x37')]);_0x26515e[_0x4f06('0x38')]=qs['filters'](_[_0x4f06('0x39')](_0x1554b1[_0x4f06('0x30')],_0x2f56d0['filters']),_0x1f8fa2);if(_0x1554b1[_0x4f06('0x30')][_0x4f06('0x3a')]){_0x26515e[_0x4f06('0x38')]=_[_0x4f06('0x3b')](_0x26515e[_0x4f06('0x38')],{'$or':_[_0x4f06('0x29')](_0x1f8fa2,function(_0x39d2fa){if(_0x39d2fa[_0x4f06('0x2d')]!=='VIRTUAL'){var _0x14c7ca={};_0x14c7ca[_0x39d2fa[_0x4f06('0x27')]]={'$like':'%'+_0x1554b1[_0x4f06('0x30')]['filter']+'%'};return _0x14c7ca;}})});}_0x26515e=_[_0x4f06('0x3b')]({},_0x26515e,_0x1554b1['options']);var _0x438aa8={'where':_0x26515e[_0x4f06('0x38')]};return db['ZohoField'][_0x4f06('0x1e')](_0x438aa8)[_0x4f06('0x23')](function(_0x2d75be){_0x49b6f6['count']=_0x2d75be;if(_0x1554b1[_0x4f06('0x30')][_0x4f06('0x3c')]){_0x26515e['include']=[{'all':!![]}];}return db['ZohoField'][_0x4f06('0x3d')](_0x26515e);})['then'](function(_0x270f64){_0x49b6f6[_0x4f06('0x3e')]=_0x270f64;return _0x49b6f6;})[_0x4f06('0x23')](respondWithFilteredResult(_0x21a661,_0x26515e))[_0x4f06('0x3f')](handleError(_0x21a661,null));};exports[_0x4f06('0x40')]=function(_0x131fec,_0x30b41c){var _0x2209b4={'raw':!![],'where':{'id':_0x131fec[_0x4f06('0x41')]['id']}},_0x461c02={};_0x461c02[_0x4f06('0x2f')]=_[_0x4f06('0x31')](db['ZohoField']['rawAttributes']);_0x461c02[_0x4f06('0x30')]=_['keys'](_0x131fec[_0x4f06('0x30')]);_0x461c02[_0x4f06('0x32')]=_[_0x4f06('0x33')](_0x461c02[_0x4f06('0x2f')],_0x461c02[_0x4f06('0x30')]);_0x2209b4[_0x4f06('0x35')]=_[_0x4f06('0x33')](_0x461c02[_0x4f06('0x2f')],qs[_0x4f06('0x34')](_0x131fec['query'][_0x4f06('0x34')]));_0x2209b4[_0x4f06('0x35')]=_0x2209b4[_0x4f06('0x35')][_0x4f06('0x42')]?_0x2209b4['attributes']:_0x461c02['model'];if(_0x131fec[_0x4f06('0x30')][_0x4f06('0x3c')]){_0x2209b4[_0x4f06('0x43')]=[{'all':!![]}];}_0x2209b4=_[_0x4f06('0x3b')]({},_0x2209b4,_0x131fec[_0x4f06('0x44')]);return db[_0x4f06('0x2a')][_0x4f06('0x45')](_0x2209b4)[_0x4f06('0x23')](handleEntityNotFound(_0x30b41c,null))['then'](respondWithResult(_0x30b41c,null))[_0x4f06('0x3f')](handleError(_0x30b41c,null));};exports['create']=function(_0x4442d9,_0x4c67ef){return db[_0x4f06('0x2a')][_0x4f06('0x46')](_0x4442d9[_0x4f06('0x47')],{})['then'](respondWithResult(_0x4c67ef,0xc9))[_0x4f06('0x3f')](handleError(_0x4c67ef,null));};exports[_0x4f06('0x48')]=function(_0x1e0bc5,_0x41c245){if(_0x1e0bc5[_0x4f06('0x47')]['id']){delete _0x1e0bc5['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x1e0bc5['params']['id']}})[_0x4f06('0x23')](handleEntityNotFound(_0x41c245,null))[_0x4f06('0x23')](saveUpdates(_0x1e0bc5['body'],null))[_0x4f06('0x23')](respondWithResult(_0x41c245,null))[_0x4f06('0x3f')](handleError(_0x41c245,null));};exports[_0x4f06('0x49')]=function(_0x1eee5b,_0xff725a){return db['ZohoField']['find']({'where':{'id':_0x1eee5b['params']['id']}})[_0x4f06('0x23')](handleEntityNotFound(_0xff725a,null))[_0x4f06('0x23')](removeEntity(_0xff725a,null))[_0x4f06('0x3f')](handleError(_0xff725a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index acc3abf..fb026a2 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 _0x6455=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','../../config/logger','api'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x6455,0x97));var _0x5645=function(_0x34ef4a,_0x9689be){_0x34ef4a=_0x34ef4a-0x0;var _0xc9c562=_0x6455[_0x34ef4a];return _0xc9c562;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5645('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['moment','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash'];(function(_0x78eb03,_0x5cd104){var _0xc146c3=function(_0x47fc1d){while(--_0x47fc1d){_0x78eb03['push'](_0x78eb03['shift']());}};_0xc146c3(++_0x5cd104);}(_0x6a55,0xdb));var _0x56a5=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0x6a55[_0x2abd13];return _0x5ad645;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intZohoField.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'paranoid':![],'indexes':[{'name':_0x56a5('0x8'),'fields':[_0x56a5('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 231d593..3faf1e3 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 _0x7177=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash'];(function(_0x5a0683,_0x49fba2){var _0x1ac947=function(_0x111af7){while(--_0x111af7){_0x5a0683['push'](_0x5a0683['shift']());}};_0x1ac947(++_0x49fba2);}(_0x7177,0x11d));var _0x7717=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x7177[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x7717('0x0'));var util=require(_0x7717('0x1'));var moment=require(_0x7717('0x2'));var BPromise=require(_0x7717('0x3'));var rs=require(_0x7717('0x4'));var fs=require('fs');var Redis=require(_0x7717('0x5'));var db=require(_0x7717('0x6'))['db'];var utils=require(_0x7717('0x7'));var logger=require(_0x7717('0x8'))(_0x7717('0x9'));var config=require(_0x7717('0xa'));var jayson=require(_0x7717('0xb'));var client=jayson[_0x7717('0xc')][_0x7717('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b0952,_0x5a88e2,_0xeca92){return new BPromise(function(_0x2a6278,_0x227261){return client[_0x7717('0xe')](_0x2b0952,_0xeca92)[_0x7717('0xf')](function(_0x316826){logger[_0x7717('0x10')](_0x7717('0x11'),_0x5a88e2,'request\x20sent');logger[_0x7717('0x12')](_0x7717('0x13'),_0x5a88e2,'request\x20sent',JSON[_0x7717('0x14')](_0x316826));if(_0x316826[_0x7717('0x15')]){if(_0x316826[_0x7717('0x15')][_0x7717('0x16')]===0x1f4){logger[_0x7717('0x15')]('ZohoField,\x20%s,\x20%s',_0x5a88e2,_0x316826[_0x7717('0x15')][_0x7717('0x17')]);return _0x227261(_0x316826['error']['message']);}logger[_0x7717('0x15')](_0x7717('0x11'),_0x5a88e2,_0x316826[_0x7717('0x15')][_0x7717('0x17')]);return _0x2a6278(_0x316826[_0x7717('0x15')][_0x7717('0x17')]);}else{logger['info'](_0x7717('0x11'),_0x5a88e2,_0x7717('0x18'));_0x2a6278(_0x316826[_0x7717('0x19')][_0x7717('0x17')]);}})['catch'](function(_0x2ebf9e){logger[_0x7717('0x15')](_0x7717('0x11'),_0x5a88e2,_0x2ebf9e);_0x227261(_0x2ebf9e);});});} \ No newline at end of file +var _0x776c=['../../mysqldb','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x776c,0x182));var _0xc776=function(_0x1e2854,_0x1f5474){_0x1e2854=_0x1e2854-0x0;var _0x44a7b1=_0x776c[_0x1e2854];return _0x44a7b1;};'use strict';var _=require(_0xc776('0x0'));var util=require('util');var moment=require(_0xc776('0x1'));var BPromise=require(_0xc776('0x2'));var rs=require(_0xc776('0x3'));var fs=require('fs');var Redis=require(_0xc776('0x4'));var db=require(_0xc776('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc776('0x6'));var config=require('../../config/environment');var jayson=require(_0xc776('0x7'));var client=jayson[_0xc776('0x8')][_0xc776('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa9c618,_0x2091bc,_0x2255a){return new BPromise(function(_0x412af9,_0x33eaf4){return client[_0xc776('0xa')](_0xa9c618,_0x2255a)[_0xc776('0xb')](function(_0x426c06){logger[_0xc776('0xc')](_0xc776('0xd'),_0x2091bc,_0xc776('0xe'));logger[_0xc776('0xf')](_0xc776('0x10'),_0x2091bc,_0xc776('0xe'),JSON[_0xc776('0x11')](_0x426c06));if(_0x426c06['error']){if(_0x426c06[_0xc776('0x12')][_0xc776('0x13')]===0x1f4){logger[_0xc776('0x12')]('ZohoField,\x20%s,\x20%s',_0x2091bc,_0x426c06[_0xc776('0x12')][_0xc776('0x14')]);return _0x33eaf4(_0x426c06[_0xc776('0x12')][_0xc776('0x14')]);}logger['error'](_0xc776('0xd'),_0x2091bc,_0x426c06[_0xc776('0x12')]['message']);return _0x412af9(_0x426c06[_0xc776('0x12')][_0xc776('0x14')]);}else{logger[_0xc776('0xc')]('ZohoField,\x20%s,\x20%s',_0x2091bc,_0xc776('0xe'));_0x412af9(_0x426c06[_0xc776('0x15')][_0xc776('0x14')]);}})[_0xc776('0x16')](function(_0x500cb7){logger['error']('ZohoField,\x20%s,\x20%s',_0x2091bc,_0x500cb7);_0x33eaf4(_0x500cb7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1ec242d..5a3df7d 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x533a7c,_0x2b39ed){var _0x3b6cbf=function(_0x45fe6a){while(--_0x45fe6a){_0x533a7c['push'](_0x533a7c['shift']());}};_0x3b6cbf(++_0x2b39ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x30fc68,_0x76a7b6){_0x30fc68=_0x30fc68-0x0;var _0x31be0d=_0xedd9[_0x30fc68];return _0x31be0d;};'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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1edc1d,_0x12dd5c){var _0x760cc0=function(_0x2ac31b){while(--_0x2ac31b){_0x1edc1d['push'](_0x1edc1d['shift']());}};_0x760cc0(++_0x12dd5c);}(_0x70e0,0x17b));var _0x070e=function(_0x42cdf7,_0x397328){_0x42cdf7=_0x42cdf7-0x0;var _0x25419d=_0x70e0[_0x42cdf7];return _0x25419d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index bd2ce59..8e1290b 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 _0x9366=['app.js','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x358d7a,_0x1fa749){var _0x4df57=function(_0x371e2f){while(--_0x371e2f){_0x358d7a['push'](_0x358d7a['shift']());}};_0x4df57(++_0x1fa749);}(_0x9366,0x7a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6936('0x0'));module[_0x6936('0x1')]={'name':{'type':Sequelize[_0x6936('0x2')],'allowNull':![],'unique':_0x6936('0x3')},'version':{'type':Sequelize[_0x6936('0x2')],'allowNull':![],'unique':_0x6936('0x3')},'main':{'type':Sequelize[_0x6936('0x2')],'defaultValue':_0x6936('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x6936('0x2')]},'type':{'type':Sequelize[_0x6936('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x6936('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x6936('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x6936('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6936('0x2')]},'link':{'type':Sequelize[_0x6936('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9c00=['app.js','INTEGER','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x33ff2b,_0xcfeca6){var _0x1adb18=function(_0x4f4678){while(--_0x4f4678){_0x33ff2b['push'](_0x33ff2b['shift']());}};_0x1adb18(++_0xcfeca6);}(_0x9c00,0x1a0));var _0x09c0=function(_0xa6e83b,_0x266b29){_0xa6e83b=_0xa6e83b-0x0;var _0x21d379=_0x9c00[_0xa6e83b];return _0x21d379;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x09c0('0x2')],'allowNull':![],'unique':_0x09c0('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x09c0('0x4')},'filename':{'type':Sequelize[_0x09c0('0x2')]},'path':{'type':Sequelize[_0x09c0('0x2')]},'type':{'type':Sequelize[_0x09c0('0x2')]},'size':{'type':Sequelize[_0x09c0('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x09c0('0x2')]},'state':{'type':Sequelize[_0x09c0('0x2')],'unique':_0x09c0('0x6')},'description':{'type':Sequelize[_0x09c0('0x2')]},'title':{'type':Sequelize[_0x09c0('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x09c0('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0176208..0cbb431 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Integration','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1f9f73,_0x36c448){var _0x5cecbc=function(_0x3af6a7){while(--_0x3af6a7){_0x1f9f73['push'](_0x1f9f73['shift']());}};_0x5cecbc(++_0x36c448);}(_0x7a54,0x106));var _0x47a5=function(_0x2d14cd,_0x1ce389){_0x2d14cd=_0x2d14cd-0x0;var _0x1cfcd9=_0x7a54[_0x2d14cd];return _0x1cfcd9;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['Integration'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['Integration']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['Integration']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d20ba,_0x92b596){_0x4d20ba=_0x4d20ba-0x0;var _0x4824d8=_0x5f2f[_0x4d20ba];return _0x4824d8;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1c1debc..075c514 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 _0x1324=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./integration.attributes','Integration','integrations'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x1324,0x11e));var _0x4132=function(_0x2c45d9,_0x1f0758){_0x2c45d9=_0x2c45d9-0x0;var _0x25043c=_0x1324[_0x2c45d9];return _0x25043c;};'use strict';var _=require(_0x4132('0x0'));var util=require(_0x4132('0x1'));var logger=require(_0x4132('0x2'))(_0x4132('0x3'));var moment=require('moment');var BPromise=require(_0x4132('0x4'));var rp=require(_0x4132('0x5'));var fs=require('fs');var path=require(_0x4132('0x6'));var rimraf=require(_0x4132('0x7'));var config=require('../../config/environment');var attributes=require(_0x4132('0x8'));module['exports']=function(_0xe13b2b,_0x1f87bd){return _0xe13b2b['define'](_0x4132('0x9'),attributes,{'tableName':_0x4132('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x954d=['../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','api','request-promise','path'];(function(_0x5c9f8f,_0x33a1f6){var _0x5bb83f=function(_0x882e0){while(--_0x882e0){_0x5c9f8f['push'](_0x5c9f8f['shift']());}};_0x5bb83f(++_0x33a1f6);}(_0x954d,0x1c9));var _0xd954=function(_0x4c7a4d,_0xf6fda9){_0x4c7a4d=_0x4c7a4d-0x0;var _0x16a471=_0x954d[_0x4c7a4d];return _0x16a471;};'use strict';var _=require('lodash');var util=require(_0xd954('0x0'));var logger=require(_0xd954('0x1'))(_0xd954('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd954('0x3'));var fs=require('fs');var path=require(_0xd954('0x4'));var rimraf=require('rimraf');var config=require(_0xd954('0x5'));var attributes=require(_0xd954('0x6'));module[_0xd954('0x7')]=function(_0x15262a,_0x13cce3){return _0x15262a[_0xd954('0x8')](_0xd954('0x9'),attributes,{'tableName':_0xd954('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 53acacf..2dc7307 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3d600b,_0x59c036){var _0x3c0e86=function(_0x1685d9){while(--_0x1685d9){_0x3d600b['push'](_0x3d600b['shift']());}};_0x3c0e86(++_0x59c036);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x44231b,_0x4b278f){var _0x3cb95d=function(_0x354b32){while(--_0x354b32){_0x44231b['push'](_0x44231b['shift']());}};_0x3cb95d(++_0x4b278f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4a1c42,_0x5f598f){_0x4a1c42=_0x4a1c42-0x0;var _0x30b506=_0xdd4f[_0x4a1c42];return _0x30b506;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3f313c8..ea5a58e 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 _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x53088e,_0x4e8f93){var _0x4827fe=function(_0x283fe9){while(--_0x283fe9){_0x53088e['push'](_0x53088e['shift']());}};_0x4827fe(++_0x4e8f93);}(_0x1261,0x144));var _0x1126=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x1261[_0x2bd1ec];return _0x2f7577;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 65b6707..e135545 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 _0xa783=['TEXT','ENUM','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x34e97a,_0x2279fa){var _0x5602b9=function(_0x3e7f8e){while(--_0x3e7f8e){_0x34e97a['push'](_0x34e97a['shift']());}};_0x5602b9(++_0x2279fa);}(_0xa783,0x18a));var _0x3a78=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa783[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x3a78('0x0'));module[_0x3a78('0x1')]={'integration':{'type':Sequelize[_0x3a78('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3a78('0x2')]},'integrationId':{'type':Sequelize[_0x3a78('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a78('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3a78('0x2')]},'membername':{'type':Sequelize[_0x3a78('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3a78('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3a78('0x4')]},'talktime':{'type':Sequelize[_0x3a78('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3a78('0x3')]},'reason':{'type':Sequelize[_0x3a78('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3a78('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3a78('0x4')]},'agentdump':{'type':Sequelize[_0x3a78('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3a78('0x4')]},'lastevent':{'type':Sequelize[_0x3a78('0x2')]},'channel':{'type':Sequelize[_0x3a78('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3a78('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a78('0x2')]},'connectedlinename':{'type':Sequelize[_0x3a78('0x2')]},'language':{'type':Sequelize[_0x3a78('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3a78('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3a78('0x2')]},'destchannelstate':{'type':Sequelize[_0x3a78('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x3a78('0x2')]},'destcalleridname':{'type':Sequelize[_0x3a78('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x3a78('0x2')]},'destlanguage':{'type':Sequelize[_0x3a78('0x2')]},'destaccountcode':{'type':Sequelize[_0x3a78('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3a78('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3a78('0x2')]},'messageId':{'type':Sequelize[_0x3a78('0x2')]},'inReplyTo':{'type':Sequelize[_0x3a78('0x2')]},'subject':{'type':Sequelize[_0x3a78('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3a78('0x2')]},'cc':{'type':Sequelize[_0x3a78('0x2')]},'attachment':{'type':Sequelize[_0x3a78('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x3a78('0x6')]},'status':{'type':Sequelize[_0x3a78('0x7')]('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0x3a78('0x2')]},'app':{'type':Sequelize[_0x3a78('0x2')]},'appdata':{'type':Sequelize[_0x3a78('0x2')]},'projectId':{'type':Sequelize[_0x3a78('0x3')]}}; \ No newline at end of file +var _0x5a93=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5a93,0x149));var _0x35a9=function(_0x34238b,_0x424a09){_0x34238b=_0x34238b-0x0;var _0x38e94f=_0x5a93[_0x34238b];return _0x38e94f;};'use strict';var Sequelize=require(_0x35a9('0x0'));module[_0x35a9('0x1')]={'integration':{'type':Sequelize[_0x35a9('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x35a9('0x2')]},'ticketId':{'type':Sequelize[_0x35a9('0x2')]},'integrationId':{'type':Sequelize[_0x35a9('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x35a9('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x35a9('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x35a9('0x2')]},'membername':{'type':Sequelize[_0x35a9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x35a9('0x4')]},'agentconnectAt':{'type':Sequelize[_0x35a9('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x35a9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x35a9('0x4')]},'talktime':{'type':Sequelize[_0x35a9('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x35a9('0x3')]},'reason':{'type':Sequelize[_0x35a9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x35a9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x35a9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x35a9('0x4')]},'lastevent':{'type':Sequelize[_0x35a9('0x2')]},'channel':{'type':Sequelize[_0x35a9('0x2')]},'channelstate':{'type':Sequelize[_0x35a9('0x3')]},'channelstatedesc':{'type':Sequelize[_0x35a9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x35a9('0x2')]},'connectedlinename':{'type':Sequelize[_0x35a9('0x2')]},'language':{'type':Sequelize[_0x35a9('0x2')]},'accountcode':{'type':Sequelize[_0x35a9('0x2')]},'context':{'type':Sequelize[_0x35a9('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x35a9('0x2')]},'destchannel':{'type':Sequelize[_0x35a9('0x2')]},'destchannelstate':{'type':Sequelize[_0x35a9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x35a9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x35a9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x35a9('0x2')]},'destlanguage':{'type':Sequelize[_0x35a9('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x35a9('0x2')]},'destexten':{'type':Sequelize[_0x35a9('0x2')]},'destpriority':{'type':Sequelize[_0x35a9('0x2')]},'destuniqueid':{'type':Sequelize[_0x35a9('0x2')]},'messageId':{'type':Sequelize[_0x35a9('0x2')]},'inReplyTo':{'type':Sequelize[_0x35a9('0x2')]},'subject':{'type':Sequelize[_0x35a9('0x2')]},'from':{'type':Sequelize[_0x35a9('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x35a9('0x6')]},'html':{'type':Sequelize[_0x35a9('0x6')]},'text':{'type':Sequelize[_0x35a9('0x6')]},'status':{'type':Sequelize[_0x35a9('0x7')](_0x35a9('0x8'),_0x35a9('0x9'),_0x35a9('0xa'),_0x35a9('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x35a9('0x2')]},'appdata':{'type':Sequelize[_0x35a9('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 a45071e..b1049e9 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 _0x97f4=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','send'];(function(_0x22c907,_0x499099){var _0x20ebd0=function(_0x4ec82d){while(--_0x4ec82d){_0x22c907['push'](_0x22c907['shift']());}};_0x20ebd0(++_0x499099);}(_0x97f4,0x1e8));var _0x497f=function(_0x1c1f21,_0x3dc7de){_0x1c1f21=_0x1c1f21-0x0;var _0x131282=_0x97f4[_0x1c1f21];return _0x131282;};'use strict';var emlformat=require(_0x497f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x497f('0x1'));var jsonpatch=require(_0x497f('0x2'));var rp=require(_0x497f('0x3'));var moment=require(_0x497f('0x4'));var BPromise=require(_0x497f('0x5'));var Mustache=require('mustache');var util=require(_0x497f('0x6'));var path=require(_0x497f('0x7'));var sox=require('sox');var csv=require(_0x497f('0x8'));var ejs=require(_0x497f('0x9'));var fs=require('fs');var fs_extra=require(_0x497f('0xa'));var _=require(_0x497f('0xb'));var squel=require('squel');var crypto=require(_0x497f('0xc'));var jsforce=require(_0x497f('0xd'));var deskjs=require(_0x497f('0xe'));var toCsv=require(_0x497f('0x8'));var querystring=require(_0x497f('0xf'));var Papa=require(_0x497f('0x10'));var Redis=require(_0x497f('0x11'));var authService=require(_0x497f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x497f('0x13'));var logger=require(_0x497f('0x14'))(_0x497f('0x15'));var utils=require(_0x497f('0x16'));var config=require(_0x497f('0x17'));var licenseUtil=require(_0x497f('0x18'));var db=require(_0x497f('0x19'))['db'];function respondWithStatusCode(_0x266d67,_0x4707ec){_0x4707ec=_0x4707ec||0xcc;return function(_0x3e6992){if(_0x3e6992){return _0x266d67[_0x497f('0x1a')](_0x4707ec);}return _0x266d67['status'](_0x4707ec)['end']();};}function respondWithResult(_0x2b71bf,_0x5410ec){_0x5410ec=_0x5410ec||0xc8;return function(_0x3eed35){if(_0x3eed35){return _0x2b71bf[_0x497f('0x1b')](_0x5410ec)['json'](_0x3eed35);}};}function respondWithFilteredResult(_0xa548b,_0x40301a){return function(_0x4c7ce3){if(_0x4c7ce3){var _0x59f642=typeof _0x40301a['offset']==='undefined'&&typeof _0x40301a[_0x497f('0x1c')]===_0x497f('0x1d');var _0x4362bd=_0x4c7ce3['count'];var _0x24f7d0=_0x59f642?0x0:_0x40301a[_0x497f('0x1e')];var _0x4803ae=_0x59f642?_0x4c7ce3[_0x497f('0x1f')]:_0x40301a[_0x497f('0x1e')]+_0x40301a[_0x497f('0x1c')];var _0xd1ed0e;if(_0x4803ae>=_0x4362bd){_0x4803ae=_0x4362bd;_0xd1ed0e=0xc8;}else{_0xd1ed0e=0xce;}_0xa548b['status'](_0xd1ed0e);return _0xa548b['set'](_0x497f('0x20'),_0x24f7d0+'-'+_0x4803ae+'/'+_0x4362bd)[_0x497f('0x21')](_0x4c7ce3);}return null;};}function patchUpdates(_0x47af21){return function(_0xd3abf1){try{jsonpatch[_0x497f('0x22')](_0xd3abf1,_0x47af21,!![]);}catch(_0x3dbcf7){return BPromise[_0x497f('0x23')](_0x3dbcf7);}return _0xd3abf1['save']();};}function saveUpdates(_0x5f1b3b,_0x3d89cb){return function(_0x7f7cae){if(_0x7f7cae){return _0x7f7cae[_0x497f('0x24')](_0x5f1b3b)['then'](function(_0x30c330){return _0x30c330;});}return null;};}function removeEntity(_0x3d81ae,_0x3a51c4){return function(_0x52e219){if(_0x52e219){return _0x52e219[_0x497f('0x25')]()[_0x497f('0x26')](function(){_0x3d81ae[_0x497f('0x1b')](0xcc)[_0x497f('0x27')]();});}};}function handleEntityNotFound(_0x2b02dd,_0x146309){return function(_0x44746b){if(!_0x44746b){_0x2b02dd[_0x497f('0x1a')](0x194);}return _0x44746b;};}function handleError(_0x5bd35a,_0x56e8a7){_0x56e8a7=_0x56e8a7||0x1f4;return function(_0x37b8d9){logger[_0x497f('0x28')](_0x37b8d9[_0x497f('0x29')]);if(_0x37b8d9[_0x497f('0x2a')]){delete _0x37b8d9['name'];}_0x5bd35a[_0x497f('0x1b')](_0x56e8a7)[_0x497f('0x2b')](_0x37b8d9);};}exports[_0x497f('0x2c')]=function(_0x5a957b,_0x4538b9){var _0xa54c9f={},_0x66e2fc={},_0x4ff8ae={'count':0x0,'rows':[]};var _0x4a43d7=_[_0x497f('0x2d')](db[_0x497f('0x2e')][_0x497f('0x2f')],function(_0x463e14){return{'name':_0x463e14[_0x497f('0x30')],'type':_0x463e14[_0x497f('0x31')][_0x497f('0x32')]};});_0x66e2fc[_0x497f('0x33')]=_[_0x497f('0x2d')](_0x4a43d7,'name');_0x66e2fc[_0x497f('0x34')]=_[_0x497f('0x35')](_0x5a957b[_0x497f('0x34')]);_0x66e2fc[_0x497f('0x36')]=_['intersection'](_0x66e2fc[_0x497f('0x33')],_0x66e2fc[_0x497f('0x34')]);_0xa54c9f['attributes']=_[_0x497f('0x37')](_0x66e2fc[_0x497f('0x33')],qs[_0x497f('0x38')](_0x5a957b[_0x497f('0x34')]['fields']));_0xa54c9f[_0x497f('0x39')]=_0xa54c9f['attributes'][_0x497f('0x3a')]?_0xa54c9f[_0x497f('0x39')]:_0x66e2fc['model'];if(!_0x5a957b[_0x497f('0x34')]['hasOwnProperty'](_0x497f('0x3b'))){_0xa54c9f[_0x497f('0x1c')]=qs[_0x497f('0x1c')](_0x5a957b['query'][_0x497f('0x1c')]);_0xa54c9f[_0x497f('0x1e')]=qs[_0x497f('0x1e')](_0x5a957b[_0x497f('0x34')]['offset']);}_0xa54c9f['order']=qs[_0x497f('0x3c')](_0x5a957b['query'][_0x497f('0x3c')]);_0xa54c9f[_0x497f('0x3d')]=qs[_0x497f('0x36')](_['pick'](_0x5a957b['query'],_0x66e2fc[_0x497f('0x36')]),_0x4a43d7);if(_0x5a957b[_0x497f('0x34')][_0x497f('0x3e')]){_0xa54c9f[_0x497f('0x3d')]=_[_0x497f('0x3f')](_0xa54c9f['where'],{'$or':_[_0x497f('0x2d')](_0x4a43d7,function(_0x4faae8){if(_0x4faae8['type']!==_0x497f('0x40')){var _0x1b3615={};_0x1b3615[_0x4faae8[_0x497f('0x2a')]]={'$like':'%'+_0x5a957b[_0x497f('0x34')][_0x497f('0x3e')]+'%'};return _0x1b3615;}})});}_0xa54c9f=_[_0x497f('0x3f')]({},_0xa54c9f,_0x5a957b[_0x497f('0x41')]);var _0x5713da={'where':_0xa54c9f['where']};return db['IntegrationReport']['count'](_0x5713da)[_0x497f('0x26')](function(_0x2d1322){_0x4ff8ae[_0x497f('0x1f')]=_0x2d1322;if(_0x5a957b[_0x497f('0x34')][_0x497f('0x42')]){_0xa54c9f['include']=[{'all':!![]}];}return db[_0x497f('0x2e')][_0x497f('0x43')](_0xa54c9f);})[_0x497f('0x26')](function(_0x5bddcf){_0x4ff8ae[_0x497f('0x44')]=_0x5bddcf;return _0x4ff8ae;})[_0x497f('0x26')](respondWithFilteredResult(_0x4538b9,_0xa54c9f))[_0x497f('0x45')](handleError(_0x4538b9,null));};exports[_0x497f('0x46')]=function(_0x351227,_0x37084a){var _0x20f2b9={'raw':![],'where':{'id':_0x351227[_0x497f('0x47')]['id']}},_0x1f3ffd={};_0x1f3ffd[_0x497f('0x33')]=_['keys'](db[_0x497f('0x2e')][_0x497f('0x2f')]);_0x1f3ffd['query']=_[_0x497f('0x35')](_0x351227[_0x497f('0x34')]);_0x1f3ffd[_0x497f('0x36')]=_[_0x497f('0x37')](_0x1f3ffd[_0x497f('0x33')],_0x1f3ffd[_0x497f('0x34')]);_0x20f2b9[_0x497f('0x39')]=_['intersection'](_0x1f3ffd[_0x497f('0x33')],qs['fields'](_0x351227[_0x497f('0x34')]['fields']));_0x20f2b9[_0x497f('0x39')]=_0x20f2b9[_0x497f('0x39')][_0x497f('0x3a')]?_0x20f2b9[_0x497f('0x39')]:_0x1f3ffd['model'];if(_0x351227[_0x497f('0x34')][_0x497f('0x42')]){_0x20f2b9[_0x497f('0x48')]=[{'all':!![]}];}_0x20f2b9=_['merge']({},_0x20f2b9,_0x351227[_0x497f('0x41')]);return db[_0x497f('0x2e')][_0x497f('0x49')](_0x20f2b9)['then'](handleEntityNotFound(_0x37084a,null))[_0x497f('0x26')](respondWithResult(_0x37084a,null))[_0x497f('0x45')](handleError(_0x37084a,null));};exports['create']=function(_0x3e0f45,_0x5f48f2){return db[_0x497f('0x2e')]['create'](_0x3e0f45['body'],{})['then'](respondWithResult(_0x5f48f2,0xc9))[_0x497f('0x45')](handleError(_0x5f48f2,null));};exports[_0x497f('0x24')]=function(_0x21f74e,_0x5ed8f3){if(_0x21f74e[_0x497f('0x4a')]['id']){delete _0x21f74e['body']['id'];}return db[_0x497f('0x2e')][_0x497f('0x49')]({'where':{'id':_0x21f74e[_0x497f('0x47')]['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x5ed8f3,null))[_0x497f('0x26')](saveUpdates(_0x21f74e[_0x497f('0x4a')],null))[_0x497f('0x26')](respondWithResult(_0x5ed8f3,null))[_0x497f('0x45')](handleError(_0x5ed8f3,null));};exports[_0x497f('0x25')]=function(_0x34a7d6,_0x47c4fa){return db[_0x497f('0x2e')][_0x497f('0x49')]({'where':{'id':_0x34a7d6['params']['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x47c4fa,null))[_0x497f('0x26')](removeEntity(_0x47c4fa,null))[_0x497f('0x45')](handleError(_0x47c4fa,null));};exports[_0x497f('0x4b')]=function(_0x4dd047,_0x4634dc){return db[_0x497f('0x2e')]['describe']()[_0x497f('0x26')](respondWithResult(_0x4634dc,null))[_0x497f('0x45')](handleError(_0x4634dc,null));}; \ No newline at end of file +var _0x5faf=['count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','IntegrationReport','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','mustache','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2c3fe3,_0x24a181){var _0x1b89a6=function(_0x260628){while(--_0x260628){_0x2c3fe3['push'](_0x2c3fe3['shift']());}};_0x1b89a6(++_0x24a181);}(_0x5faf,0x146));var _0xf5fa=function(_0x5f46e3,_0x2bad46){_0x5f46e3=_0x5f46e3-0x0;var _0x3f0785=_0x5faf[_0x5f46e3];return _0x3f0785;};'use strict';var emlformat=require(_0xf5fa('0x0'));var rimraf=require(_0xf5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf5fa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf5fa('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf5fa('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf5fa('0x5'));var crypto=require(_0xf5fa('0x6'));var jsforce=require(_0xf5fa('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xf5fa('0x4'));var querystring=require('querystring');var Papa=require(_0xf5fa('0x8'));var Redis=require(_0xf5fa('0x9'));var authService=require(_0xf5fa('0xa'));var qs=require(_0xf5fa('0xb'));var as=require(_0xf5fa('0xc'));var hardwareService=require(_0xf5fa('0xd'));var logger=require('../../config/logger')(_0xf5fa('0xe'));var utils=require(_0xf5fa('0xf'));var config=require(_0xf5fa('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe4465a,_0xd85a6d){_0xd85a6d=_0xd85a6d||0xcc;return function(_0x198c9e){if(_0x198c9e){return _0xe4465a[_0xf5fa('0x11')](_0xd85a6d);}return _0xe4465a[_0xf5fa('0x12')](_0xd85a6d)[_0xf5fa('0x13')]();};}function respondWithResult(_0x3c890e,_0x2db69f){_0x2db69f=_0x2db69f||0xc8;return function(_0x48adad){if(_0x48adad){return _0x3c890e[_0xf5fa('0x12')](_0x2db69f)[_0xf5fa('0x14')](_0x48adad);}};}function respondWithFilteredResult(_0x18ae34,_0x41be6f){return function(_0x4c3032){if(_0x4c3032){var _0x468753=typeof _0x41be6f[_0xf5fa('0x15')]===_0xf5fa('0x16')&&typeof _0x41be6f[_0xf5fa('0x17')]===_0xf5fa('0x16');var _0x4b3f01=_0x4c3032['count'];var _0x53ed36=_0x468753?0x0:_0x41be6f[_0xf5fa('0x15')];var _0x43ed6c=_0x468753?_0x4c3032[_0xf5fa('0x18')]:_0x41be6f[_0xf5fa('0x15')]+_0x41be6f[_0xf5fa('0x17')];var _0x3a8cad;if(_0x43ed6c>=_0x4b3f01){_0x43ed6c=_0x4b3f01;_0x3a8cad=0xc8;}else{_0x3a8cad=0xce;}_0x18ae34[_0xf5fa('0x12')](_0x3a8cad);return _0x18ae34[_0xf5fa('0x19')](_0xf5fa('0x1a'),_0x53ed36+'-'+_0x43ed6c+'/'+_0x4b3f01)[_0xf5fa('0x14')](_0x4c3032);}return null;};}function patchUpdates(_0x3e588a){return function(_0x2a1c36){try{jsonpatch[_0xf5fa('0x1b')](_0x2a1c36,_0x3e588a,!![]);}catch(_0x224138){return BPromise[_0xf5fa('0x1c')](_0x224138);}return _0x2a1c36[_0xf5fa('0x1d')]();};}function saveUpdates(_0x460229,_0xa2ef5c){return function(_0x2a1a7a){if(_0x2a1a7a){return _0x2a1a7a[_0xf5fa('0x1e')](_0x460229)[_0xf5fa('0x1f')](function(_0x132510){return _0x132510;});}return null;};}function removeEntity(_0xf558e9,_0x26d7e2){return function(_0x1ce91f){if(_0x1ce91f){return _0x1ce91f[_0xf5fa('0x20')]()['then'](function(){_0xf558e9['status'](0xcc)[_0xf5fa('0x13')]();});}};}function handleEntityNotFound(_0x408240,_0x3e79a4){return function(_0x215805){if(!_0x215805){_0x408240['sendStatus'](0x194);}return _0x215805;};}function handleError(_0x411f8f,_0x297e9f){_0x297e9f=_0x297e9f||0x1f4;return function(_0x33dcd3){logger['error'](_0x33dcd3[_0xf5fa('0x21')]);if(_0x33dcd3[_0xf5fa('0x22')]){delete _0x33dcd3[_0xf5fa('0x22')];}_0x411f8f[_0xf5fa('0x12')](_0x297e9f)[_0xf5fa('0x23')](_0x33dcd3);};}exports['index']=function(_0x59381a,_0x192ac5){var _0x8cb227={},_0x1eddad={},_0x28d894={'count':0x0,'rows':[]};var _0x2365f3=_[_0xf5fa('0x24')](db['IntegrationReport']['rawAttributes'],function(_0x510d35){return{'name':_0x510d35[_0xf5fa('0x25')],'type':_0x510d35['type'][_0xf5fa('0x26')]};});_0x1eddad[_0xf5fa('0x27')]=_[_0xf5fa('0x24')](_0x2365f3,_0xf5fa('0x22'));_0x1eddad[_0xf5fa('0x28')]=_[_0xf5fa('0x29')](_0x59381a[_0xf5fa('0x28')]);_0x1eddad[_0xf5fa('0x2a')]=_[_0xf5fa('0x2b')](_0x1eddad[_0xf5fa('0x27')],_0x1eddad[_0xf5fa('0x28')]);_0x8cb227['attributes']=_[_0xf5fa('0x2b')](_0x1eddad[_0xf5fa('0x27')],qs[_0xf5fa('0x2c')](_0x59381a[_0xf5fa('0x28')][_0xf5fa('0x2c')]));_0x8cb227['attributes']=_0x8cb227[_0xf5fa('0x2d')]['length']?_0x8cb227[_0xf5fa('0x2d')]:_0x1eddad[_0xf5fa('0x27')];if(!_0x59381a['query']['hasOwnProperty'](_0xf5fa('0x2e'))){_0x8cb227['limit']=qs[_0xf5fa('0x17')](_0x59381a[_0xf5fa('0x28')][_0xf5fa('0x17')]);_0x8cb227[_0xf5fa('0x15')]=qs[_0xf5fa('0x15')](_0x59381a[_0xf5fa('0x28')][_0xf5fa('0x15')]);}_0x8cb227[_0xf5fa('0x2f')]=qs[_0xf5fa('0x30')](_0x59381a['query'][_0xf5fa('0x30')]);_0x8cb227[_0xf5fa('0x31')]=qs[_0xf5fa('0x2a')](_[_0xf5fa('0x32')](_0x59381a[_0xf5fa('0x28')],_0x1eddad['filters']),_0x2365f3);if(_0x59381a[_0xf5fa('0x28')][_0xf5fa('0x33')]){_0x8cb227[_0xf5fa('0x31')]=_[_0xf5fa('0x34')](_0x8cb227[_0xf5fa('0x31')],{'$or':_[_0xf5fa('0x24')](_0x2365f3,function(_0x434e03){if(_0x434e03[_0xf5fa('0x35')]!==_0xf5fa('0x36')){var _0x35f2f4={};_0x35f2f4[_0x434e03[_0xf5fa('0x22')]]={'$like':'%'+_0x59381a['query'][_0xf5fa('0x33')]+'%'};return _0x35f2f4;}})});}_0x8cb227=_[_0xf5fa('0x34')]({},_0x8cb227,_0x59381a[_0xf5fa('0x37')]);var _0x32bc22={'where':_0x8cb227[_0xf5fa('0x31')]};return db[_0xf5fa('0x38')][_0xf5fa('0x18')](_0x32bc22)[_0xf5fa('0x1f')](function(_0x12ea9a){_0x28d894[_0xf5fa('0x18')]=_0x12ea9a;if(_0x59381a[_0xf5fa('0x28')]['includeAll']){_0x8cb227[_0xf5fa('0x39')]=[{'all':!![]}];}return db[_0xf5fa('0x38')][_0xf5fa('0x3a')](_0x8cb227);})[_0xf5fa('0x1f')](function(_0x461a2d){_0x28d894[_0xf5fa('0x3b')]=_0x461a2d;return _0x28d894;})['then'](respondWithFilteredResult(_0x192ac5,_0x8cb227))[_0xf5fa('0x3c')](handleError(_0x192ac5,null));};exports[_0xf5fa('0x3d')]=function(_0x1e90f4,_0x4dbb9b){var _0x573b0a={'raw':![],'where':{'id':_0x1e90f4[_0xf5fa('0x3e')]['id']}},_0x426951={};_0x426951['model']=_[_0xf5fa('0x29')](db[_0xf5fa('0x38')][_0xf5fa('0x3f')]);_0x426951[_0xf5fa('0x28')]=_[_0xf5fa('0x29')](_0x1e90f4['query']);_0x426951['filters']=_['intersection'](_0x426951[_0xf5fa('0x27')],_0x426951[_0xf5fa('0x28')]);_0x573b0a[_0xf5fa('0x2d')]=_[_0xf5fa('0x2b')](_0x426951[_0xf5fa('0x27')],qs[_0xf5fa('0x2c')](_0x1e90f4[_0xf5fa('0x28')][_0xf5fa('0x2c')]));_0x573b0a[_0xf5fa('0x2d')]=_0x573b0a[_0xf5fa('0x2d')][_0xf5fa('0x40')]?_0x573b0a[_0xf5fa('0x2d')]:_0x426951[_0xf5fa('0x27')];if(_0x1e90f4[_0xf5fa('0x28')][_0xf5fa('0x41')]){_0x573b0a[_0xf5fa('0x39')]=[{'all':!![]}];}_0x573b0a=_[_0xf5fa('0x34')]({},_0x573b0a,_0x1e90f4[_0xf5fa('0x37')]);return db[_0xf5fa('0x38')][_0xf5fa('0x42')](_0x573b0a)[_0xf5fa('0x1f')](handleEntityNotFound(_0x4dbb9b,null))['then'](respondWithResult(_0x4dbb9b,null))[_0xf5fa('0x3c')](handleError(_0x4dbb9b,null));};exports[_0xf5fa('0x43')]=function(_0x284d31,_0xe28dee){return db[_0xf5fa('0x38')][_0xf5fa('0x43')](_0x284d31[_0xf5fa('0x44')],{})[_0xf5fa('0x1f')](respondWithResult(_0xe28dee,0xc9))[_0xf5fa('0x3c')](handleError(_0xe28dee,null));};exports[_0xf5fa('0x1e')]=function(_0x2d4ca9,_0x634e03){if(_0x2d4ca9['body']['id']){delete _0x2d4ca9[_0xf5fa('0x44')]['id'];}return db[_0xf5fa('0x38')][_0xf5fa('0x42')]({'where':{'id':_0x2d4ca9['params']['id']}})['then'](handleEntityNotFound(_0x634e03,null))[_0xf5fa('0x1f')](saveUpdates(_0x2d4ca9['body'],null))[_0xf5fa('0x1f')](respondWithResult(_0x634e03,null))[_0xf5fa('0x3c')](handleError(_0x634e03,null));};exports[_0xf5fa('0x20')]=function(_0x115e42,_0x260224){return db[_0xf5fa('0x38')][_0xf5fa('0x42')]({'where':{'id':_0x115e42['params']['id']}})['then'](handleEntityNotFound(_0x260224,null))[_0xf5fa('0x1f')](removeEntity(_0x260224,null))[_0xf5fa('0x3c')](handleError(_0x260224,null));};exports[_0xf5fa('0x45')]=function(_0x2e2245,_0x369c7a){return db[_0xf5fa('0x38')][_0xf5fa('0x45')]()[_0xf5fa('0x1f')](respondWithResult(_0x369c7a,null))['catch'](handleError(_0x369c7a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9359ec9..2161bea 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 _0xdcc0=['api','moment','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','../../config/logger'];(function(_0x41bd12,_0xb8a5e0){var _0x5a614f=function(_0x3f5898){while(--_0x3f5898){_0x41bd12['push'](_0x41bd12['shift']());}};_0x5a614f(++_0xb8a5e0);}(_0xdcc0,0x94));var _0x0dcc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcc0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0dcc('0x0'));var util=require('util');var logger=require(_0x0dcc('0x1'))(_0x0dcc('0x2'));var moment=require(_0x0dcc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0dcc('0x4'));var config=require(_0x0dcc('0x5'));var attributes=require(_0x0dcc('0x6'));module[_0x0dcc('0x7')]=function(_0x2a64ee,_0x3cdd42){return _0x2a64ee[_0x0dcc('0x8')](_0x0dcc('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb591=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','bluebird'];(function(_0x22fc85,_0x2d521a){var _0x424cb0=function(_0x28e6fd){while(--_0x28e6fd){_0x22fc85['push'](_0x22fc85['shift']());}};_0x424cb0(++_0x2d521a);}(_0xb591,0x92));var _0x1b59=function(_0x3351b6,_0x37d07b){_0x3351b6=_0x3351b6-0x0;var _0x1fe058=_0xb591[_0x3351b6];return _0x1fe058;};'use strict';var _=require('lodash');var util=require(_0x1b59('0x0'));var logger=require(_0x1b59('0x1'))(_0x1b59('0x2'));var moment=require('moment');var BPromise=require(_0x1b59('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b59('0x4'));var attributes=require(_0x1b59('0x5'));module[_0x1b59('0x6')]=function(_0x4c2e50,_0x6b7fad){return _0x4c2e50[_0x1b59('0x7')](_0x1b59('0x8'),attributes,{'tableName':_0x1b59('0x9'),'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 5b64822..ac7c76c 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x4975,0x86));var _0x5497=function(_0x5f3cbd,_0x26a517){_0x5f3cbd=_0x5f3cbd-0x0;var _0x14eb16=_0x4975[_0x5f3cbd];return _0x14eb16;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x18fabc,_0x73e8aa){var _0x20fa08=function(_0x335bd6){while(--_0x335bd6){_0x18fabc['push'](_0x18fabc['shift']());}};_0x20fa08(++_0x73e8aa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index efce59a..5432fe6 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 _0x7ed1=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals'];(function(_0x380fac,_0x133494){var _0xdddfe4=function(_0x1dbb98){while(--_0x1dbb98){_0x380fac['push'](_0x380fac['shift']());}};_0xdddfe4(++_0x133494);}(_0x7ed1,0xca));var _0x17ed=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x7ed1[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x17ed('0x0'));var util=require('util');var path=require(_0x17ed('0x1'));var timeout=require(_0x17ed('0x2'));var express=require(_0x17ed('0x3'));var router=express[_0x17ed('0x4')]();var fs_extra=require(_0x17ed('0x5'));var auth=require(_0x17ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x17ed('0x7'));var controller=require(_0x17ed('0x8'));router[_0x17ed('0x9')]('/',auth[_0x17ed('0xa')](),controller['index']);router['get'](_0x17ed('0xb'),auth[_0x17ed('0xa')](),controller[_0x17ed('0xc')]);router[_0x17ed('0x9')]('/:id/sub_intervals',auth[_0x17ed('0xa')](),controller[_0x17ed('0xd')]);router[_0x17ed('0xe')]('/',auth[_0x17ed('0xa')](),controller[_0x17ed('0xf')]);router[_0x17ed('0xe')]('/:id/sub_intervals',auth[_0x17ed('0xa')](),controller['addInterval']);router['post'](_0x17ed('0x10'),auth[_0x17ed('0xa')](),controller[_0x17ed('0x11')]);router[_0x17ed('0x12')](_0x17ed('0xb'),auth['isAuthenticated'](),controller[_0x17ed('0x13')]);router[_0x17ed('0x14')](_0x17ed('0xb'),auth['isAuthenticated'](),controller[_0x17ed('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa0a1=['isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addIntervals','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./interval.controller','get','index','/:id'];(function(_0x278583,_0x15dbca){var _0x462e6f=function(_0x41814e){while(--_0x41814e){_0x278583['push'](_0x278583['shift']());}};_0x462e6f(++_0x15dbca);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x4fe0c,_0x1f9112){_0x4fe0c=_0x4fe0c-0x0;var _0x4dd2cc=_0xa0a1[_0x4fe0c];return _0x4dd2cc;};'use strict';var multer=require(_0x1a0a('0x0'));var util=require('util');var path=require(_0x1a0a('0x1'));var timeout=require(_0x1a0a('0x2'));var express=require(_0x1a0a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a0a('0x4'));var interaction=require(_0x1a0a('0x5'));var config=require('../../config/environment');var controller=require(_0x1a0a('0x6'));router[_0x1a0a('0x7')]('/',auth['isAuthenticated'](),controller[_0x1a0a('0x8')]);router[_0x1a0a('0x7')](_0x1a0a('0x9'),auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xb')]);router['get'](_0x1a0a('0xc'),auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1a0a('0xe')](_0x1a0a('0xc'),auth[_0x1a0a('0xa')](),controller['addInterval']);router[_0x1a0a('0xe')]('/:id/sub_intervals/create_many',auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xf')]);router[_0x1a0a('0x10')](_0x1a0a('0x9'),auth[_0x1a0a('0xa')](),controller[_0x1a0a('0x11')]);router[_0x1a0a('0x12')]('/:id',auth[_0x1a0a('0xa')](),controller[_0x1a0a('0x13')]);module[_0x1a0a('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e2f42bf..3121c80 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 _0xe94d=['sequelize','exports','STRING'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xe94d,0x144));var _0xde94=function(_0x2c6189,_0x41ce2a){_0x2c6189=_0x2c6189-0x0;var _0x46b94a=_0xe94d[_0x2c6189];return _0x46b94a;};'use strict';var Sequelize=require(_0xde94('0x0'));module[_0xde94('0x1')]={'name':{'type':Sequelize[_0xde94('0x2')]},'description':{'type':Sequelize[_0xde94('0x2')]},'interval':{'type':Sequelize[_0xde94('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8be9=['exports','STRING','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8be9,0x1b5));var _0x98be=function(_0x543d50,_0x1f3906){_0x543d50=_0x543d50-0x0;var _0x45ea40=_0x8be9[_0x543d50];return _0x45ea40;};'use strict';var Sequelize=require(_0x98be('0x0'));module[_0x98be('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98be('0x2')]},'interval':{'type':Sequelize[_0x98be('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 5b8e434..8ac9c11 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 _0x9139=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','Intervals','UserProfileResource','then','error','name','send','index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','findOne','pick','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x9139,0xa3));var _0x9913=function(_0x3a480f,_0x315fa7){_0x3a480f=_0x3a480f-0x0;var _0x427864=_0x9139[_0x3a480f];return _0x427864;};'use strict';var emlformat=require(_0x9913('0x0'));var rimraf=require(_0x9913('0x1'));var zipdir=require(_0x9913('0x2'));var jsonpatch=require(_0x9913('0x3'));var rp=require(_0x9913('0x4'));var moment=require('moment');var BPromise=require(_0x9913('0x5'));var Mustache=require(_0x9913('0x6'));var util=require(_0x9913('0x7'));var path=require('path');var sox=require(_0x9913('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9913('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9913('0xa'));var jsforce=require(_0x9913('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9913('0xc'));var Papa=require(_0x9913('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9913('0xe'));var as=require(_0x9913('0xf'));var hardwareService=require(_0x9913('0x10'));var logger=require(_0x9913('0x11'))(_0x9913('0x12'));var utils=require(_0x9913('0x13'));var config=require(_0x9913('0x14'));var licenseUtil=require(_0x9913('0x15'));var db=require(_0x9913('0x16'))['db'];var extensions=require(_0x9913('0x17'));function respondWithStatusCode(_0x196a42,_0x2c4a63){_0x2c4a63=_0x2c4a63||0xcc;return function(_0x226c8c){if(_0x226c8c){return _0x196a42[_0x9913('0x18')](_0x2c4a63);}return _0x196a42[_0x9913('0x19')](_0x2c4a63)[_0x9913('0x1a')]();};}function respondWithResult(_0x3fdc55,_0x576f94){_0x576f94=_0x576f94||0xc8;return function(_0x1289e6){if(_0x1289e6){return _0x3fdc55[_0x9913('0x19')](_0x576f94)[_0x9913('0x1b')](_0x1289e6);}};}function respondWithFilteredResult(_0x54d49c,_0x3a3b33){return function(_0x336de8){if(_0x336de8){var _0xa3c710=typeof _0x3a3b33['offset']===_0x9913('0x1c')&&typeof _0x3a3b33[_0x9913('0x1d')]===_0x9913('0x1c');var _0x476b8d=_0x336de8[_0x9913('0x1e')];var _0x41cbb6=_0xa3c710?0x0:_0x3a3b33['offset'];var _0x4daa21=_0xa3c710?_0x336de8[_0x9913('0x1e')]:_0x3a3b33[_0x9913('0x1f')]+_0x3a3b33[_0x9913('0x1d')];var _0x2260b6;if(_0x4daa21>=_0x476b8d){_0x4daa21=_0x476b8d;_0x2260b6=0xc8;}else{_0x2260b6=0xce;}_0x54d49c[_0x9913('0x19')](_0x2260b6);return _0x54d49c['set'](_0x9913('0x20'),_0x41cbb6+'-'+_0x4daa21+'/'+_0x476b8d)[_0x9913('0x1b')](_0x336de8);}return null;};}function patchUpdates(_0x5cb360){return function(_0x14bcea){try{jsonpatch[_0x9913('0x21')](_0x14bcea,_0x5cb360,!![]);}catch(_0x51f6ed){return BPromise[_0x9913('0x22')](_0x51f6ed);}return _0x14bcea[_0x9913('0x23')]();};}function saveUpdates(_0x254462,_0x2482f1){return function(_0x3bd020){if(_0x3bd020){return _0x3bd020[_0x9913('0x24')](_0x254462)['then'](function(_0x5a5082){return _0x5a5082;});}return null;};}function removeEntity(_0x1cea8c,_0x48c28d){return function(_0x45dadd){if(_0x45dadd){return _0x45dadd[_0x9913('0x25')]()['then'](function(){var _0x4c0c73=_0x45dadd['get']({'plain':!![]});var _0x2567b2=_0x9913('0x26');return db[_0x9913('0x27')]['destroy']({'where':{'type':_0x2567b2,'resourceId':_0x4c0c73['id']}})[_0x9913('0x28')](function(){return _0x45dadd;});})['then'](function(){_0x1cea8c[_0x9913('0x19')](0xcc)[_0x9913('0x1a')]();});}};}function handleEntityNotFound(_0x4c6e9a,_0xb38978){return function(_0x3553f3){if(!_0x3553f3){_0x4c6e9a[_0x9913('0x18')](0x194);}return _0x3553f3;};}function handleError(_0x4364d5,_0x176441){_0x176441=_0x176441||0x1f4;return function(_0x3b1799){logger[_0x9913('0x29')](_0x3b1799['stack']);if(_0x3b1799['name']){delete _0x3b1799[_0x9913('0x2a')];}_0x4364d5[_0x9913('0x19')](_0x176441)[_0x9913('0x2b')](_0x3b1799);};}exports[_0x9913('0x2c')]=function(_0x1d96c5,_0x187a1a){var _0x3f25dc={},_0x1d71e1={},_0x5d3369={'count':0x0,'rows':[]};var _0x3d5fb6=_[_0x9913('0x2d')](db[_0x9913('0x2e')][_0x9913('0x2f')],function(_0x422749){return{'name':_0x422749['fieldName'],'type':_0x422749[_0x9913('0x30')]['key']};});_0x1d71e1[_0x9913('0x31')]=_[_0x9913('0x2d')](_0x3d5fb6,_0x9913('0x2a'));_0x1d71e1[_0x9913('0x32')]=_[_0x9913('0x33')](_0x1d96c5[_0x9913('0x32')]);_0x1d71e1[_0x9913('0x34')]=_[_0x9913('0x35')](_0x1d71e1[_0x9913('0x31')],_0x1d71e1[_0x9913('0x32')]);_0x3f25dc[_0x9913('0x36')]=_[_0x9913('0x35')](_0x1d71e1[_0x9913('0x31')],qs['fields'](_0x1d96c5[_0x9913('0x32')][_0x9913('0x37')]));_0x3f25dc['attributes']=_0x3f25dc[_0x9913('0x36')][_0x9913('0x38')]?_0x3f25dc[_0x9913('0x36')]:_0x1d71e1[_0x9913('0x31')];if(!_0x1d96c5[_0x9913('0x32')][_0x9913('0x39')](_0x9913('0x3a'))){_0x3f25dc[_0x9913('0x1d')]=qs[_0x9913('0x1d')](_0x1d96c5[_0x9913('0x32')][_0x9913('0x1d')]);_0x3f25dc['offset']=qs[_0x9913('0x1f')](_0x1d96c5[_0x9913('0x32')][_0x9913('0x1f')]);}_0x3f25dc['order']=qs[_0x9913('0x3b')](_0x1d96c5[_0x9913('0x32')][_0x9913('0x3b')]);_0x3f25dc[_0x9913('0x3c')]=qs[_0x9913('0x34')](_['pick'](_0x1d96c5[_0x9913('0x32')],_0x1d71e1[_0x9913('0x34')]),_0x3d5fb6);if(_0x1d96c5[_0x9913('0x32')][_0x9913('0x3d')]){_0x3f25dc['where']=_['merge'](_0x3f25dc[_0x9913('0x3c')],{'$or':_[_0x9913('0x2d')](_0x3d5fb6,function(_0x2485c8){if(_0x2485c8[_0x9913('0x30')]!=='VIRTUAL'){var _0x4b612a={};_0x4b612a[_0x2485c8[_0x9913('0x2a')]]={'$like':'%'+_0x1d96c5[_0x9913('0x32')][_0x9913('0x3d')]+'%'};return _0x4b612a;}})});}_0x3f25dc=_[_0x9913('0x3e')]({},_0x3f25dc,_0x1d96c5[_0x9913('0x3f')]);var _0x3f4b8c={'where':_0x3f25dc[_0x9913('0x3c')]};return db[_0x9913('0x2e')]['count'](_0x3f4b8c)[_0x9913('0x28')](function(_0x356636){_0x5d3369[_0x9913('0x1e')]=_0x356636;if(_0x1d96c5[_0x9913('0x32')][_0x9913('0x40')]){_0x3f25dc[_0x9913('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9913('0x42')](_0x3f25dc);})[_0x9913('0x28')](function(_0x48c5e4){_0x5d3369[_0x9913('0x43')]=_0x48c5e4;return _0x5d3369;})['then'](respondWithFilteredResult(_0x187a1a,_0x3f25dc))[_0x9913('0x44')](handleError(_0x187a1a,null));};exports[_0x9913('0x45')]=function(_0x2c4ae0,_0x2f805e){var _0x43578b={'raw':!![],'where':{'id':_0x2c4ae0[_0x9913('0x46')]['id']}},_0x31fb0b={};_0x31fb0b[_0x9913('0x31')]=_['keys'](db[_0x9913('0x2e')]['rawAttributes']);_0x31fb0b[_0x9913('0x32')]=_[_0x9913('0x33')](_0x2c4ae0[_0x9913('0x32')]);_0x31fb0b[_0x9913('0x34')]=_['intersection'](_0x31fb0b[_0x9913('0x31')],_0x31fb0b[_0x9913('0x32')]);_0x43578b[_0x9913('0x36')]=_['intersection'](_0x31fb0b[_0x9913('0x31')],qs[_0x9913('0x37')](_0x2c4ae0[_0x9913('0x32')][_0x9913('0x37')]));_0x43578b[_0x9913('0x36')]=_0x43578b[_0x9913('0x36')]['length']?_0x43578b[_0x9913('0x36')]:_0x31fb0b[_0x9913('0x31')];if(_0x2c4ae0['query'][_0x9913('0x40')]){_0x43578b['include']=[{'all':!![]}];}_0x43578b=_['merge']({},_0x43578b,_0x2c4ae0[_0x9913('0x3f')]);return db[_0x9913('0x2e')]['find'](_0x43578b)['then'](handleEntityNotFound(_0x2f805e,null))[_0x9913('0x28')](respondWithResult(_0x2f805e,null))[_0x9913('0x44')](handleError(_0x2f805e,null));};exports['create']=function(_0x957604,_0x65f87c){return db[_0x9913('0x2e')][_0x9913('0x47')](_0x957604[_0x9913('0x48')],{})[_0x9913('0x28')](function(_0x183ed1){var _0x5bef6a=_0x957604[_0x9913('0x49')][_0x9913('0x4a')]({'plain':!![]});if(!_0x5bef6a)throw new Error(_0x9913('0x4b'));if(_0x5bef6a[_0x9913('0x4c')]===_0x9913('0x49')){var _0x52f179=_0x183ed1['get']({'plain':!![]});var _0x355a8f=_0x9913('0x26');return db[_0x9913('0x4d')]['find']({'where':{'name':_0x355a8f,'userProfileId':_0x5bef6a[_0x9913('0x4e')]},'raw':!![]})[_0x9913('0x28')](function(_0x566d70){if(_0x566d70&&_0x566d70['autoAssociation']===0x0){return db[_0x9913('0x27')][_0x9913('0x47')]({'name':_0x52f179[_0x9913('0x2a')],'resourceId':_0x52f179['id'],'type':_0x566d70[_0x9913('0x2a')],'sectionId':_0x566d70['id']},{})[_0x9913('0x28')](function(){return _0x183ed1;});}else{return _0x183ed1;}})['catch'](function(_0x4e9fcb){logger[_0x9913('0x29')](_0x9913('0x4f'),_0x4e9fcb);throw _0x4e9fcb;});}return _0x183ed1;})[_0x9913('0x28')](respondWithResult(_0x65f87c,0xc9))[_0x9913('0x44')](handleError(_0x65f87c,null));};exports[_0x9913('0x24')]=function(_0x285b44,_0x35abeb){if(_0x285b44[_0x9913('0x48')]['id']){delete _0x285b44[_0x9913('0x48')]['id'];}return db[_0x9913('0x2e')][_0x9913('0x50')]({'where':{'id':_0x285b44['params']['id']}})['then'](handleEntityNotFound(_0x35abeb,null))[_0x9913('0x28')](saveUpdates(_0x285b44[_0x9913('0x48')],null))[_0x9913('0x28')](respondWithResult(_0x35abeb,null))['catch'](handleError(_0x35abeb,null));};exports[_0x9913('0x25')]=function(_0x1b9e24,_0x476c55){return db[_0x9913('0x2e')][_0x9913('0x50')]({'where':{'id':_0x1b9e24[_0x9913('0x46')]['id']}})[_0x9913('0x28')](handleEntityNotFound(_0x476c55,null))[_0x9913('0x28')](removeEntity(_0x476c55,null))[_0x9913('0x44')](handleError(_0x476c55,null));};exports[_0x9913('0x51')]=function(_0x44f1a0,_0x1fe977,_0x543c92){if(_0x44f1a0[_0x9913('0x48')]['id']){delete _0x44f1a0['body']['id'];}return db[_0x9913('0x2e')][_0x9913('0x50')]({'where':{'id':_0x44f1a0[_0x9913('0x46')]['id']}})[_0x9913('0x28')](handleEntityNotFound(_0x1fe977,null))['then'](function(_0x26fde3){if(_0x26fde3){_0x44f1a0[_0x9913('0x48')][_0x9913('0x52')]=_0x26fde3['id'];return db[_0x9913('0x2e')][_0x9913('0x47')](_0x44f1a0[_0x9913('0x48')]);}})[_0x9913('0x28')](respondWithResult(_0x1fe977,null))[_0x9913('0x44')](handleError(_0x1fe977,null));};exports['getIntervals']=function(_0x2b8150,_0x10dcab,_0x3e8612){var _0x3cc1e2={};var _0xe4e42c={};var _0x69293c;var _0x40718a;return db[_0x9913('0x2e')][_0x9913('0x53')]({'where':{'id':_0x2b8150[_0x9913('0x46')]['id']}})['then'](handleEntityNotFound(_0x10dcab,null))[_0x9913('0x28')](function(_0x14e6f6){if(_0x14e6f6){_0x69293c=_0x14e6f6;_0xe4e42c['model']=_[_0x9913('0x33')](db[_0x9913('0x2e')][_0x9913('0x2f')]);_0xe4e42c[_0x9913('0x32')]=_[_0x9913('0x33')](_0x2b8150[_0x9913('0x32')]);_0xe4e42c[_0x9913('0x34')]=_[_0x9913('0x35')](_0xe4e42c[_0x9913('0x31')],_0xe4e42c[_0x9913('0x32')]);_0x3cc1e2[_0x9913('0x36')]=_[_0x9913('0x35')](_0xe4e42c[_0x9913('0x31')],qs[_0x9913('0x37')](_0x2b8150[_0x9913('0x32')][_0x9913('0x37')]));_0x3cc1e2['attributes']=_0x3cc1e2[_0x9913('0x36')][_0x9913('0x38')]?_0x3cc1e2['attributes']:_0xe4e42c[_0x9913('0x31')];_0x3cc1e2['order']=qs['sort'](_0x2b8150[_0x9913('0x32')][_0x9913('0x3b')]);_0x3cc1e2['where']=qs[_0x9913('0x34')](_[_0x9913('0x54')](_0x2b8150[_0x9913('0x32')],_0xe4e42c[_0x9913('0x34')]));if(_0x2b8150['query'][_0x9913('0x3d')]){_0x3cc1e2[_0x9913('0x3c')]=_[_0x9913('0x3e')](_0x3cc1e2['where'],{'$or':_[_0x9913('0x2d')](_0x3cc1e2[_0x9913('0x36')],function(_0x49a6d4){var _0x403699={};_0x403699[_0x49a6d4]={'$like':'%'+_0x2b8150[_0x9913('0x32')][_0x9913('0x3d')]+'%'};return _0x403699;})});}_0x3cc1e2=_[_0x9913('0x3e')]({},_0x3cc1e2,_0x2b8150[_0x9913('0x3f')]);return _0x69293c[_0x9913('0x55')](_0x3cc1e2);}})[_0x9913('0x28')](function(_0xe9d158){if(_0xe9d158){_0x40718a=_0xe9d158[_0x9913('0x38')];if(!_0x2b8150[_0x9913('0x32')]['hasOwnProperty']('nolimit')){_0x3cc1e2[_0x9913('0x1d')]=qs[_0x9913('0x1d')](_0x2b8150[_0x9913('0x32')][_0x9913('0x1d')]);_0x3cc1e2[_0x9913('0x1f')]=qs[_0x9913('0x1f')](_0x2b8150[_0x9913('0x32')][_0x9913('0x1f')]);}return _0x69293c[_0x9913('0x55')](_0x3cc1e2);}})[_0x9913('0x28')](function(_0x5ec8bb){if(_0x5ec8bb){return _0x5ec8bb?{'count':_0x40718a,'rows':_0x5ec8bb}:null;}})[_0x9913('0x28')](respondWithResult(_0x10dcab,null))['catch'](handleError(_0x10dcab,null));};exports[_0x9913('0x56')]=function(_0x1eda12,_0x2092b6,_0x5cc507){return db[_0x9913('0x2e')]['findOne']({'where':{'id':_0x1eda12[_0x9913('0x46')]['id']}})[_0x9913('0x28')](handleEntityNotFound(_0x2092b6,null))[_0x9913('0x28')](function(_0x858e){if(_0x858e){return db[_0x9913('0x57')][_0x9913('0x58')](function(_0x202d5a){return db[_0x9913('0x2e')][_0x9913('0x25')]({'where':{'IntervalId':_0x1eda12['params']['id']},'transaction':_0x202d5a})['then'](function(_0x374033){var _0x4d96a5=_[_0x9913('0x2d')](_0x1eda12[_0x9913('0x48')],function(_0x17c943){delete _0x17c943['id'];_0x17c943[_0x9913('0x52')]=_0x1eda12[_0x9913('0x46')]['id'];return _0x17c943;});return db[_0x9913('0x2e')][_0x9913('0x59')](_0x4d96a5,{'transaction':_0x202d5a});});})[_0x9913('0x28')](function(){return db[_0x9913('0x2e')][_0x9913('0x42')]({'where':{'IntervalId':_0x1eda12['params']['id']}});});}})[_0x9913('0x28')](respondWithResult(_0x2092b6,null))['catch'](handleError(_0x2092b6,null));}; \ No newline at end of file +var _0x80b2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','filter','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','Interval','rawAttributes','fieldName','type','key','map','keys','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create'];(function(_0x583998,_0x49c395){var _0x39780b=function(_0x260d57){while(--_0x260d57){_0x583998['push'](_0x583998['shift']());}};_0x39780b(++_0x49c395);}(_0x80b2,0x64));var _0x280b=function(_0x102d06,_0x40aefa){_0x102d06=_0x102d06-0x0;var _0x40b185=_0x80b2[_0x102d06];return _0x40b185;};'use strict';var emlformat=require(_0x280b('0x0'));var rimraf=require(_0x280b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x280b('0x2'));var rp=require(_0x280b('0x3'));var moment=require(_0x280b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x280b('0x5'));var util=require(_0x280b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x280b('0x7'));var ejs=require(_0x280b('0x8'));var fs=require('fs');var fs_extra=require(_0x280b('0x9'));var _=require(_0x280b('0xa'));var squel=require(_0x280b('0xb'));var crypto=require('crypto');var jsforce=require(_0x280b('0xc'));var deskjs=require(_0x280b('0xd'));var toCsv=require(_0x280b('0x7'));var querystring=require(_0x280b('0xe'));var Papa=require('papaparse');var Redis=require(_0x280b('0xf'));var authService=require(_0x280b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x280b('0x11'))('api');var utils=require(_0x280b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x280b('0x13'));var db=require('../../mysqldb')['db'];var extensions=require(_0x280b('0x14'));function respondWithStatusCode(_0x3a2a8b,_0x103e8f){_0x103e8f=_0x103e8f||0xcc;return function(_0x1750e9){if(_0x1750e9){return _0x3a2a8b[_0x280b('0x15')](_0x103e8f);}return _0x3a2a8b[_0x280b('0x16')](_0x103e8f)[_0x280b('0x17')]();};}function respondWithResult(_0x5cee65,_0x5e1bdb){_0x5e1bdb=_0x5e1bdb||0xc8;return function(_0x3b8adb){if(_0x3b8adb){return _0x5cee65[_0x280b('0x16')](_0x5e1bdb)[_0x280b('0x18')](_0x3b8adb);}};}function respondWithFilteredResult(_0x23fb71,_0x3c9258){return function(_0x3274a4){if(_0x3274a4){var _0x465eae=typeof _0x3c9258[_0x280b('0x19')]===_0x280b('0x1a')&&typeof _0x3c9258[_0x280b('0x1b')]==='undefined';var _0x5c81c7=_0x3274a4['count'];var _0x58112a=_0x465eae?0x0:_0x3c9258[_0x280b('0x19')];var _0x1ae37b=_0x465eae?_0x3274a4[_0x280b('0x1c')]:_0x3c9258[_0x280b('0x19')]+_0x3c9258[_0x280b('0x1b')];var _0x169133;if(_0x1ae37b>=_0x5c81c7){_0x1ae37b=_0x5c81c7;_0x169133=0xc8;}else{_0x169133=0xce;}_0x23fb71[_0x280b('0x16')](_0x169133);return _0x23fb71[_0x280b('0x1d')](_0x280b('0x1e'),_0x58112a+'-'+_0x1ae37b+'/'+_0x5c81c7)[_0x280b('0x18')](_0x3274a4);}return null;};}function patchUpdates(_0x4acecd){return function(_0x5ac683){try{jsonpatch[_0x280b('0x1f')](_0x5ac683,_0x4acecd,!![]);}catch(_0x343a32){return BPromise['reject'](_0x343a32);}return _0x5ac683[_0x280b('0x20')]();};}function saveUpdates(_0x1ed500,_0x4f2407){return function(_0x3b33ba){if(_0x3b33ba){return _0x3b33ba['update'](_0x1ed500)[_0x280b('0x21')](function(_0x35cd58){return _0x35cd58;});}return null;};}function removeEntity(_0x2cdfcf,_0x4913c9){return function(_0x5deeac){if(_0x5deeac){return _0x5deeac[_0x280b('0x22')]()[_0x280b('0x21')](function(){var _0x2a1013=_0x5deeac[_0x280b('0x23')]({'plain':!![]});var _0x7f3895=_0x280b('0x24');return db[_0x280b('0x25')][_0x280b('0x22')]({'where':{'type':_0x7f3895,'resourceId':_0x2a1013['id']}})['then'](function(){return _0x5deeac;});})['then'](function(){_0x2cdfcf['status'](0xcc)[_0x280b('0x17')]();});}};}function handleEntityNotFound(_0x3d6fe2,_0x5af4c7){return function(_0x50cbce){if(!_0x50cbce){_0x3d6fe2[_0x280b('0x15')](0x194);}return _0x50cbce;};}function handleError(_0x2ce0df,_0x262b27){_0x262b27=_0x262b27||0x1f4;return function(_0x4233f1){logger[_0x280b('0x26')](_0x4233f1[_0x280b('0x27')]);if(_0x4233f1[_0x280b('0x28')]){delete _0x4233f1[_0x280b('0x28')];}_0x2ce0df[_0x280b('0x16')](_0x262b27)[_0x280b('0x29')](_0x4233f1);};}exports['index']=function(_0x31f050,_0x3e5c04){var _0x1fa5e6={},_0x13687a={},_0x36f752={'count':0x0,'rows':[]};var _0x7844d6=_['map'](db[_0x280b('0x2a')][_0x280b('0x2b')],function(_0x5be246){return{'name':_0x5be246[_0x280b('0x2c')],'type':_0x5be246[_0x280b('0x2d')][_0x280b('0x2e')]};});_0x13687a['model']=_[_0x280b('0x2f')](_0x7844d6,_0x280b('0x28'));_0x13687a['query']=_[_0x280b('0x30')](_0x31f050[_0x280b('0x31')]);_0x13687a['filters']=_['intersection'](_0x13687a[_0x280b('0x32')],_0x13687a[_0x280b('0x31')]);_0x1fa5e6[_0x280b('0x33')]=_['intersection'](_0x13687a[_0x280b('0x32')],qs[_0x280b('0x34')](_0x31f050[_0x280b('0x31')]['fields']));_0x1fa5e6['attributes']=_0x1fa5e6['attributes']['length']?_0x1fa5e6[_0x280b('0x33')]:_0x13687a[_0x280b('0x32')];if(!_0x31f050['query'][_0x280b('0x35')](_0x280b('0x36'))){_0x1fa5e6[_0x280b('0x1b')]=qs['limit'](_0x31f050[_0x280b('0x31')]['limit']);_0x1fa5e6['offset']=qs[_0x280b('0x19')](_0x31f050[_0x280b('0x31')][_0x280b('0x19')]);}_0x1fa5e6[_0x280b('0x37')]=qs['sort'](_0x31f050[_0x280b('0x31')][_0x280b('0x38')]);_0x1fa5e6[_0x280b('0x39')]=qs[_0x280b('0x3a')](_[_0x280b('0x3b')](_0x31f050[_0x280b('0x31')],_0x13687a[_0x280b('0x3a')]),_0x7844d6);if(_0x31f050['query']['filter']){_0x1fa5e6[_0x280b('0x39')]=_[_0x280b('0x3c')](_0x1fa5e6[_0x280b('0x39')],{'$or':_[_0x280b('0x2f')](_0x7844d6,function(_0x54b863){if(_0x54b863[_0x280b('0x2d')]!=='VIRTUAL'){var _0x424433={};_0x424433[_0x54b863['name']]={'$like':'%'+_0x31f050['query']['filter']+'%'};return _0x424433;}})});}_0x1fa5e6=_[_0x280b('0x3c')]({},_0x1fa5e6,_0x31f050[_0x280b('0x3d')]);var _0x3f49a5={'where':_0x1fa5e6['where']};return db[_0x280b('0x2a')]['count'](_0x3f49a5)['then'](function(_0x2bd431){_0x36f752[_0x280b('0x1c')]=_0x2bd431;if(_0x31f050[_0x280b('0x31')]['includeAll']){_0x1fa5e6[_0x280b('0x3e')]=[{'all':!![]}];}return db[_0x280b('0x2a')][_0x280b('0x3f')](_0x1fa5e6);})[_0x280b('0x21')](function(_0x1efe7d){_0x36f752[_0x280b('0x40')]=_0x1efe7d;return _0x36f752;})[_0x280b('0x21')](respondWithFilteredResult(_0x3e5c04,_0x1fa5e6))[_0x280b('0x41')](handleError(_0x3e5c04,null));};exports[_0x280b('0x42')]=function(_0x1142ef,_0x2d39ec){var _0xede863={'raw':!![],'where':{'id':_0x1142ef[_0x280b('0x43')]['id']}},_0x2e7c74={};_0x2e7c74['model']=_[_0x280b('0x30')](db[_0x280b('0x2a')]['rawAttributes']);_0x2e7c74[_0x280b('0x31')]=_[_0x280b('0x30')](_0x1142ef[_0x280b('0x31')]);_0x2e7c74[_0x280b('0x3a')]=_[_0x280b('0x44')](_0x2e7c74['model'],_0x2e7c74['query']);_0xede863[_0x280b('0x33')]=_['intersection'](_0x2e7c74[_0x280b('0x32')],qs[_0x280b('0x34')](_0x1142ef[_0x280b('0x31')]['fields']));_0xede863[_0x280b('0x33')]=_0xede863[_0x280b('0x33')][_0x280b('0x45')]?_0xede863['attributes']:_0x2e7c74['model'];if(_0x1142ef[_0x280b('0x31')][_0x280b('0x46')]){_0xede863[_0x280b('0x3e')]=[{'all':!![]}];}_0xede863=_['merge']({},_0xede863,_0x1142ef['options']);return db[_0x280b('0x2a')]['find'](_0xede863)[_0x280b('0x21')](handleEntityNotFound(_0x2d39ec,null))[_0x280b('0x21')](respondWithResult(_0x2d39ec,null))[_0x280b('0x41')](handleError(_0x2d39ec,null));};exports['create']=function(_0x3d2115,_0xeeb5f6){return db[_0x280b('0x2a')]['create'](_0x3d2115[_0x280b('0x47')],{})[_0x280b('0x21')](function(_0x498490){var _0x2b4f28=_0x3d2115[_0x280b('0x48')][_0x280b('0x23')]({'plain':!![]});if(!_0x2b4f28)throw new Error(_0x280b('0x49'));if(_0x2b4f28[_0x280b('0x4a')]===_0x280b('0x48')){var _0x46d30d=_0x498490['get']({'plain':!![]});var _0x444beb='Intervals';return db[_0x280b('0x4b')][_0x280b('0x4c')]({'where':{'name':_0x444beb,'userProfileId':_0x2b4f28[_0x280b('0x4d')]},'raw':!![]})[_0x280b('0x21')](function(_0x23c49e){if(_0x23c49e&&_0x23c49e[_0x280b('0x4e')]===0x0){return db[_0x280b('0x25')][_0x280b('0x4f')]({'name':_0x46d30d[_0x280b('0x28')],'resourceId':_0x46d30d['id'],'type':_0x23c49e[_0x280b('0x28')],'sectionId':_0x23c49e['id']},{})[_0x280b('0x21')](function(){return _0x498490;});}else{return _0x498490;}})['catch'](function(_0x9021f8){logger[_0x280b('0x26')](_0x280b('0x50'),_0x9021f8);throw _0x9021f8;});}return _0x498490;})[_0x280b('0x21')](respondWithResult(_0xeeb5f6,0xc9))[_0x280b('0x41')](handleError(_0xeeb5f6,null));};exports[_0x280b('0x51')]=function(_0xa92f75,_0x318fbe){if(_0xa92f75[_0x280b('0x47')]['id']){delete _0xa92f75[_0x280b('0x47')]['id'];}return db['Interval'][_0x280b('0x4c')]({'where':{'id':_0xa92f75['params']['id']}})[_0x280b('0x21')](handleEntityNotFound(_0x318fbe,null))[_0x280b('0x21')](saveUpdates(_0xa92f75['body'],null))[_0x280b('0x21')](respondWithResult(_0x318fbe,null))[_0x280b('0x41')](handleError(_0x318fbe,null));};exports[_0x280b('0x22')]=function(_0x38f75d,_0x39d160){return db['Interval']['find']({'where':{'id':_0x38f75d['params']['id']}})[_0x280b('0x21')](handleEntityNotFound(_0x39d160,null))[_0x280b('0x21')](removeEntity(_0x39d160,null))[_0x280b('0x41')](handleError(_0x39d160,null));};exports[_0x280b('0x52')]=function(_0x26aa10,_0x39cbc5,_0x107c91){if(_0x26aa10[_0x280b('0x47')]['id']){delete _0x26aa10[_0x280b('0x47')]['id'];}return db[_0x280b('0x2a')]['find']({'where':{'id':_0x26aa10['params']['id']}})[_0x280b('0x21')](handleEntityNotFound(_0x39cbc5,null))['then'](function(_0x56e144){if(_0x56e144){_0x26aa10[_0x280b('0x47')][_0x280b('0x53')]=_0x56e144['id'];return db[_0x280b('0x2a')][_0x280b('0x4f')](_0x26aa10['body']);}})[_0x280b('0x21')](respondWithResult(_0x39cbc5,null))[_0x280b('0x41')](handleError(_0x39cbc5,null));};exports[_0x280b('0x54')]=function(_0x2d577b,_0x43025e,_0xbd1fd4){var _0x55a23c={};var _0x7cae9d={};var _0x39c5d3;var _0x89df25;return db[_0x280b('0x2a')][_0x280b('0x55')]({'where':{'id':_0x2d577b[_0x280b('0x43')]['id']}})['then'](handleEntityNotFound(_0x43025e,null))[_0x280b('0x21')](function(_0x168786){if(_0x168786){_0x39c5d3=_0x168786;_0x7cae9d['model']=_[_0x280b('0x30')](db[_0x280b('0x2a')]['rawAttributes']);_0x7cae9d[_0x280b('0x31')]=_[_0x280b('0x30')](_0x2d577b[_0x280b('0x31')]);_0x7cae9d[_0x280b('0x3a')]=_['intersection'](_0x7cae9d[_0x280b('0x32')],_0x7cae9d[_0x280b('0x31')]);_0x55a23c['attributes']=_[_0x280b('0x44')](_0x7cae9d[_0x280b('0x32')],qs['fields'](_0x2d577b[_0x280b('0x31')][_0x280b('0x34')]));_0x55a23c['attributes']=_0x55a23c[_0x280b('0x33')][_0x280b('0x45')]?_0x55a23c[_0x280b('0x33')]:_0x7cae9d[_0x280b('0x32')];_0x55a23c['order']=qs['sort'](_0x2d577b[_0x280b('0x31')][_0x280b('0x38')]);_0x55a23c['where']=qs[_0x280b('0x3a')](_[_0x280b('0x3b')](_0x2d577b[_0x280b('0x31')],_0x7cae9d[_0x280b('0x3a')]));if(_0x2d577b['query'][_0x280b('0x56')]){_0x55a23c['where']=_[_0x280b('0x3c')](_0x55a23c['where'],{'$or':_[_0x280b('0x2f')](_0x55a23c[_0x280b('0x33')],function(_0x412835){var _0x552c9a={};_0x552c9a[_0x412835]={'$like':'%'+_0x2d577b['query'][_0x280b('0x56')]+'%'};return _0x552c9a;})});}_0x55a23c=_[_0x280b('0x3c')]({},_0x55a23c,_0x2d577b['options']);return _0x39c5d3[_0x280b('0x54')](_0x55a23c);}})[_0x280b('0x21')](function(_0x424d3a){if(_0x424d3a){_0x89df25=_0x424d3a[_0x280b('0x45')];if(!_0x2d577b[_0x280b('0x31')][_0x280b('0x35')](_0x280b('0x36'))){_0x55a23c[_0x280b('0x1b')]=qs[_0x280b('0x1b')](_0x2d577b['query'][_0x280b('0x1b')]);_0x55a23c[_0x280b('0x19')]=qs['offset'](_0x2d577b[_0x280b('0x31')][_0x280b('0x19')]);}return _0x39c5d3['getIntervals'](_0x55a23c);}})[_0x280b('0x21')](function(_0x41e4ee){if(_0x41e4ee){return _0x41e4ee?{'count':_0x89df25,'rows':_0x41e4ee}:null;}})['then'](respondWithResult(_0x43025e,null))[_0x280b('0x41')](handleError(_0x43025e,null));};exports['addIntervals']=function(_0x2ef3f4,_0x2e6166,_0x57998b){return db['Interval']['findOne']({'where':{'id':_0x2ef3f4[_0x280b('0x43')]['id']}})[_0x280b('0x21')](handleEntityNotFound(_0x2e6166,null))[_0x280b('0x21')](function(_0x129f97){if(_0x129f97){return db[_0x280b('0x57')][_0x280b('0x58')](function(_0x4a592f){return db[_0x280b('0x2a')][_0x280b('0x22')]({'where':{'IntervalId':_0x2ef3f4[_0x280b('0x43')]['id']},'transaction':_0x4a592f})[_0x280b('0x21')](function(_0x856e28){var _0x98874f=_[_0x280b('0x2f')](_0x2ef3f4['body'],function(_0x42c130){delete _0x42c130['id'];_0x42c130[_0x280b('0x53')]=_0x2ef3f4[_0x280b('0x43')]['id'];return _0x42c130;});return db['Interval'][_0x280b('0x59')](_0x98874f,{'transaction':_0x4a592f});});})['then'](function(){return db[_0x280b('0x2a')]['findAll']({'where':{'IntervalId':_0x2ef3f4['params']['id']}});});}})['then'](respondWithResult(_0x2e6166,null))[_0x280b('0x41')](handleError(_0x2e6166,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 19545b0..6e98ccb 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 _0x655e=['Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../components/extensions/rewrite','exports','define'];(function(_0x21d1eb,_0x56f664){var _0x4cb8cd=function(_0x450a48){while(--_0x450a48){_0x21d1eb['push'](_0x21d1eb['shift']());}};_0x4cb8cd(++_0x56f664);}(_0x655e,0x199));var _0xe655=function(_0x5e8a89,_0x52dc7c){_0x5e8a89=_0x5e8a89-0x0;var _0x345562=_0x655e[_0x5e8a89];return _0x345562;};'use strict';var _=require(_0xe655('0x0'));var util=require(_0xe655('0x1'));var logger=require(_0xe655('0x2'))('api');var moment=require(_0xe655('0x3'));var BPromise=require(_0xe655('0x4'));var rp=require(_0xe655('0x5'));var fs=require('fs');var path=require(_0xe655('0x6'));var rimraf=require(_0xe655('0x7'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0xe655('0x8'));module[_0xe655('0x9')]=function(_0x18b4c3,_0x305a4b){return _0x18b4c3[_0xe655('0xa')](_0xe655('0xb'),attributes,{'tableName':_0xe655('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28c96f,_0x4c706){extensions['rewrite'](_0x18b4c3,_0x28c96f);},'afterBulkCreate':function(_0x29e25d,_0x33dbb5,_0x50ea8a){_0x50ea8a();extensions[_0xe655('0xd')](_0x18b4c3,_0x29e25d[0x0]);},'afterUpdate':function(_0x41ecba,_0x49a4f4){extensions['rewrite'](_0x18b4c3,_0x41ecba);},'afterDestroy':function(_0x373ac0,_0x5537a9){extensions['rewrite'](_0x18b4c3,_0x373ac0);}}});}; \ No newline at end of file +var _0x8e61=['request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','bluebird'];(function(_0x5581e9,_0x28d871){var _0x2d923c=function(_0x5b7d58){while(--_0x5b7d58){_0x5581e9['push'](_0x5581e9['shift']());}};_0x2d923c(++_0x28d871);}(_0x8e61,0x6c));var _0x18e6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8e61[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x18e6('0x0'));var util=require('util');var logger=require(_0x18e6('0x1'))(_0x18e6('0x2'));var moment=require('moment');var BPromise=require(_0x18e6('0x3'));var rp=require(_0x18e6('0x4'));var fs=require('fs');var path=require(_0x18e6('0x5'));var rimraf=require('rimraf');var config=require(_0x18e6('0x6'));var attributes=require(_0x18e6('0x7'));var extensions=require(_0x18e6('0x8'));module[_0x18e6('0x9')]=function(_0x39b639,_0x3ea837){return _0x39b639[_0x18e6('0xa')](_0x18e6('0xb'),attributes,{'tableName':_0x18e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26ea89,_0x228ae9){extensions[_0x18e6('0xd')](_0x39b639,_0x26ea89);},'afterBulkCreate':function(_0x438f6d,_0x2bef00,_0x5efefb){_0x5efefb();extensions['rewrite'](_0x39b639,_0x438f6d[0x0]);},'afterUpdate':function(_0x8b56f5,_0x12e1c8){extensions['rewrite'](_0x39b639,_0x8b56f5);},'afterDestroy':function(_0x29ab20,_0x4688a5){extensions[_0x18e6('0xd')](_0x39b639,_0x29ab20);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b718c96..5573fea 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index f1e047a..4b0f6f1 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb10b,0x12a));var _0xbb10=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0xb10b[_0xd1f854];return _0x548294;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x283708,_0x57a9e7){var _0xd6bd85=function(_0xa21419){while(--_0xa21419){_0x283708['push'](_0x283708['shift']());}};_0xd6bd85(++_0x57a9e7);}(_0x2ef3,0xba));var _0x32ef=function(_0x20cd04,_0x2b67dd){_0x20cd04=_0x20cd04-0x0;var _0x16085e=_0x2ef3[_0x20cd04];return _0x16085e;};'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 4f78fd8..4b7a00a 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 _0x2515=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','fields','customfield_11501','newToken','customfield_11504','reason'];(function(_0x239ec2,_0xb83dea){var _0x4984f1=function(_0x386df6){while(--_0x386df6){_0x239ec2['push'](_0x239ec2['shift']());}};_0x4984f1(++_0xb83dea);}(_0x2515,0x116));var _0x5251=function(_0x467e61,_0x387c3d){_0x467e61=_0x467e61-0x0;var _0x2eab8f=_0x2515[_0x467e61];return _0x2eab8f;};'use strict';var BPromise=require(_0x5251('0x0'));var https=require(_0x5251('0x1'));var logger=require(_0x5251('0x2'))(_0x5251('0x3'));var USERNAME=_0x5251('0x4');var PASSWORD=_0x5251('0x5');function openIssue(_0x593ec6,_0x547b0b){var _0x1cdf10={'fields':{'project':{'key':_0x593ec6[_0x5251('0x6')]||_0x5251('0x7')},'summary':(_0x593ec6['summary']||'Report')+_0x5251('0x8')+_0x593ec6['ip'],'description':_0x593ec6[_0x5251('0x9')]||JSON[_0x5251('0xa')](_0x593ec6),'issuetype':{'name':_0x593ec6['issuetype']||'Bug'}}};_0x1cdf10[_0x5251('0xb')]['customfield_11500']=_0x593ec6['email'];_0x1cdf10[_0x5251('0xb')][_0x5251('0xc')]=_0x593ec6['oldToken'];_0x1cdf10[_0x5251('0xb')]['customfield_11502']=_0x593ec6[_0x5251('0xd')];_0x1cdf10[_0x5251('0xb')]['customfield_11503']=_0x593ec6['name'];_0x1cdf10[_0x5251('0xb')][_0x5251('0xe')]=_0x593ec6[_0x5251('0xf')];_0x1cdf10[_0x5251('0xb')][_0x5251('0x10')]=_0x593ec6['ip'];var _0x1903e5={'host':_0x5251('0x11'),'port':0x1bb,'path':_0x5251('0x12'),'method':_0x5251('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x5251('0x14'),'Authorization':_0x5251('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x2980b5=JSON['stringify'](_0x1cdf10);var _0xfd6722=https[_0x5251('0x16')](_0x1903e5,function(_0x5045c5){_0x5045c5[_0x5251('0x17')](_0x5251('0x18'));var _0x374921='';_0x5045c5['on'](_0x5251('0x19'),function(_0x3b215c){_0x374921+=_0x3b215c;});_0x5045c5['on'](_0x5251('0x1a'),function(){if(_0x547b0b){return _0x547b0b[_0x5251('0x1b')](_0x5045c5[_0x5251('0x1c')])[_0x5251('0x1d')](JSON[_0x5251('0x1e')](_0x374921));}});});_0xfd6722['on'](_0x5251('0x1f'),function(_0x4c64b0){if(_0x547b0b){return _0x547b0b[_0x5251('0x1b')](0x1f4)[_0x5251('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x5251('0x20')}]});}});_0xfd6722[_0x5251('0x21')](_0x2980b5);_0xfd6722[_0x5251('0x1a')]();}exports[_0x5251('0x22')]=openIssue;exports[_0x5251('0x23')]=function(_0x385d3d,_0x2dbdd6){_0x385d3d[_0x5251('0x24')]['ip']=_0x385d3d[_0x5251('0x25')][_0x5251('0x26')]||_0x385d3d['connection'][_0x5251('0x27')]||_0x385d3d['socket'][_0x5251('0x27')]||_0x385d3d[_0x5251('0x28')][_0x5251('0x29')][_0x5251('0x27')];return openIssue(_0x385d3d[_0x5251('0x24')],_0x2dbdd6);}; \ No newline at end of file +var _0xe3f7=['end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','api','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data'];(function(_0x19d7af,_0x54fbdb){var _0x17a39e=function(_0xef411d){while(--_0xef411d){_0x19d7af['push'](_0x19d7af['shift']());}};_0x17a39e(++_0x54fbdb);}(_0xe3f7,0x13d));var _0x7e3f=function(_0x1e00e3,_0x2bf288){_0x1e00e3=_0x1e00e3-0x0;var _0x50b6ca=_0xe3f7[_0x1e00e3];return _0x50b6ca;};'use strict';var BPromise=require(_0x7e3f('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x7e3f('0x1'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0xd2610b,_0x506775){var _0x495edd={'fields':{'project':{'key':_0xd2610b[_0x7e3f('0x2')]||_0x7e3f('0x3')},'summary':(_0xd2610b[_0x7e3f('0x4')]||_0x7e3f('0x5'))+_0x7e3f('0x6')+_0xd2610b['ip'],'description':_0xd2610b[_0x7e3f('0x7')]||JSON[_0x7e3f('0x8')](_0xd2610b),'issuetype':{'name':_0xd2610b['issuetype']||_0x7e3f('0x9')}}};_0x495edd[_0x7e3f('0xa')][_0x7e3f('0xb')]=_0xd2610b['email'];_0x495edd[_0x7e3f('0xa')]['customfield_11501']=_0xd2610b['oldToken'];_0x495edd[_0x7e3f('0xa')]['customfield_11502']=_0xd2610b[_0x7e3f('0xc')];_0x495edd[_0x7e3f('0xa')][_0x7e3f('0xd')]=_0xd2610b[_0x7e3f('0xe')];_0x495edd['fields'][_0x7e3f('0xf')]=_0xd2610b[_0x7e3f('0x10')];_0x495edd[_0x7e3f('0xa')]['customfield_10102']=_0xd2610b['ip'];var _0xc45418={'host':_0x7e3f('0x11'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7e3f('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x7e3f('0x13'),'Authorization':_0x7e3f('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x7e3f('0x15')](_0x7e3f('0x16'))}};var _0x2a61c9=JSON[_0x7e3f('0x8')](_0x495edd);var _0x23af62=https[_0x7e3f('0x17')](_0xc45418,function(_0x1d0368){_0x1d0368[_0x7e3f('0x18')](_0x7e3f('0x19'));var _0x42809a='';_0x1d0368['on'](_0x7e3f('0x1a'),function(_0x54fda5){_0x42809a+=_0x54fda5;});_0x1d0368['on'](_0x7e3f('0x1b'),function(){if(_0x506775){return _0x506775['status'](_0x1d0368[_0x7e3f('0x1c')])[_0x7e3f('0x1d')](JSON[_0x7e3f('0x1e')](_0x42809a));}});});_0x23af62['on'](_0x7e3f('0x1f'),function(_0x550660){if(_0x506775){return _0x506775[_0x7e3f('0x20')](0x1f4)['json']({'errors':[{'message':_0x7e3f('0x21'),'type':_0x7e3f('0x22')}]});}});_0x23af62[_0x7e3f('0x23')](_0x2a61c9);_0x23af62['end']();}exports[_0x7e3f('0x24')]=openIssue;exports['send']=function(_0x417548,_0x2a06d9){_0x417548['body']['ip']=_0x417548[_0x7e3f('0x25')][_0x7e3f('0x26')]||_0x417548[_0x7e3f('0x27')][_0x7e3f('0x28')]||_0x417548['socket'][_0x7e3f('0x28')]||_0x417548[_0x7e3f('0x27')][_0x7e3f('0x29')]['remoteAddress'];return openIssue(_0x417548[_0x7e3f('0x2a')],_0x2a06d9);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ef49d67..6538aff 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x21e895,_0x4fef7f){var _0x43c312=function(_0x53e092){while(--_0x53e092){_0x21e895['push'](_0x21e895['shift']());}};_0x43c312(++_0x4fef7f);}(_0xa75b,0x170));var _0xba75=function(_0x57afbb,_0x52f55f){_0x57afbb=_0x57afbb-0x0;var _0x38d4e2=_0xa75b[_0x57afbb];return _0x38d4e2;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x89a5f2,_0x1c0cfb){var _0x526482=function(_0x607e9d){while(--_0x607e9d){_0x89a5f2['push'](_0x89a5f2['shift']());}};_0x526482(++_0x1c0cfb);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4bf485,_0x284dcc){_0x4bf485=_0x4bf485-0x0;var _0x58824b=_0xee5b[_0x4bf485];return _0x58824b;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 461c561..dbde7ca 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x2d4699,_0x37177d){_0x2d4699=_0x2d4699-0x0;var _0x5a8b26=_0x7a54[_0x2d4699];return _0x5a8b26;};'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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x31bb80,_0x5a0b50){_0x31bb80=_0x31bb80-0x0;var _0x45e1a7=_0x7a54[_0x31bb80];return _0x45e1a7;};'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 a0d8bf2..b040ca8 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 _0x0734=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','set'];(function(_0x205c8a,_0x2c685b){var _0x336fd6=function(_0x17672a){while(--_0x17672a){_0x205c8a['push'](_0x205c8a['shift']());}};_0x336fd6(++_0x2c685b);}(_0x0734,0xba));var _0x4073=function(_0x37ef1a,_0x4f9479){_0x37ef1a=_0x37ef1a-0x0;var _0x180380=_0x0734[_0x37ef1a];return _0x180380;};'use strict';var emlformat=require(_0x4073('0x0'));var rimraf=require(_0x4073('0x1'));var zipdir=require(_0x4073('0x2'));var jsonpatch=require(_0x4073('0x3'));var rp=require(_0x4073('0x4'));var moment=require('moment');var BPromise=require(_0x4073('0x5'));var Mustache=require(_0x4073('0x6'));var util=require(_0x4073('0x7'));var path=require(_0x4073('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4073('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4073('0xa'));var squel=require(_0x4073('0xb'));var crypto=require(_0x4073('0xc'));var jsforce=require(_0x4073('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4073('0xe'));var querystring=require('querystring');var Papa=require(_0x4073('0xf'));var Redis=require(_0x4073('0x10'));var authService=require(_0x4073('0x11'));var qs=require(_0x4073('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4073('0x13'))(_0x4073('0x14'));var utils=require('../../config/utils');var config=require(_0x4073('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4073('0x16'))['db'];function respondWithStatusCode(_0x4c496c,_0x1778d8){_0x1778d8=_0x1778d8||0xcc;return function(_0x48e6eb){if(_0x48e6eb){return _0x4c496c['sendStatus'](_0x1778d8);}return _0x4c496c[_0x4073('0x17')](_0x1778d8)[_0x4073('0x18')]();};}function respondWithResult(_0x565576,_0x416322){_0x416322=_0x416322||0xc8;return function(_0x1355f5){if(_0x1355f5){return _0x565576[_0x4073('0x17')](_0x416322)[_0x4073('0x19')](_0x1355f5);}};}function respondWithFilteredResult(_0x3e29e9,_0x45238f){return function(_0x592c8c){if(_0x592c8c){var _0x2bc7c5=typeof _0x45238f['offset']===_0x4073('0x1a')&&typeof _0x45238f[_0x4073('0x1b')]==='undefined';var _0x1339b2=_0x592c8c[_0x4073('0x1c')];var _0x7a6e37=_0x2bc7c5?0x0:_0x45238f['offset'];var _0x35e397=_0x2bc7c5?_0x592c8c[_0x4073('0x1c')]:_0x45238f['offset']+_0x45238f['limit'];var _0x44aa71;if(_0x35e397>=_0x1339b2){_0x35e397=_0x1339b2;_0x44aa71=0xc8;}else{_0x44aa71=0xce;}_0x3e29e9['status'](_0x44aa71);return _0x3e29e9[_0x4073('0x1d')](_0x4073('0x1e'),_0x7a6e37+'-'+_0x35e397+'/'+_0x1339b2)[_0x4073('0x19')](_0x592c8c);}return null;};}function patchUpdates(_0x56d196){return function(_0xa87289){try{jsonpatch[_0x4073('0x1f')](_0xa87289,_0x56d196,!![]);}catch(_0x37b4f3){return BPromise[_0x4073('0x20')](_0x37b4f3);}return _0xa87289[_0x4073('0x21')]();};}function saveUpdates(_0x523c11,_0x1b36b7){return function(_0x5b5977){if(_0x5b5977){return _0x5b5977['update'](_0x523c11)[_0x4073('0x22')](function(_0x3dfed2){return _0x3dfed2;});}return null;};}function removeEntity(_0x37fd2d,_0x531bf4){return function(_0x48c8eb){if(_0x48c8eb){return _0x48c8eb[_0x4073('0x23')]()[_0x4073('0x22')](function(){_0x37fd2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x765754,_0x477cf6){return function(_0x259234){if(!_0x259234){_0x765754[_0x4073('0x24')](0x194);}return _0x259234;};}function handleError(_0x19a118,_0x20d4a8){_0x20d4a8=_0x20d4a8||0x1f4;return function(_0xf3faf4){logger[_0x4073('0x25')](_0xf3faf4['stack']);if(_0xf3faf4[_0x4073('0x26')]){delete _0xf3faf4[_0x4073('0x26')];}_0x19a118[_0x4073('0x17')](_0x20d4a8)['send'](_0xf3faf4);};}exports[_0x4073('0x27')]=function(_0x35b8d5,_0x512f69){var _0x57fcfd={},_0x465c67={},_0x429f8d={'count':0x0,'rows':[]};var _0x5e958d=_[_0x4073('0x28')](db[_0x4073('0x29')][_0x4073('0x2a')],function(_0x45a36e){return{'name':_0x45a36e['fieldName'],'type':_0x45a36e[_0x4073('0x2b')][_0x4073('0x2c')]};});_0x465c67[_0x4073('0x2d')]=_['map'](_0x5e958d,_0x4073('0x26'));_0x465c67[_0x4073('0x2e')]=_[_0x4073('0x2f')](_0x35b8d5[_0x4073('0x2e')]);_0x465c67[_0x4073('0x30')]=_['intersection'](_0x465c67[_0x4073('0x2d')],_0x465c67[_0x4073('0x2e')]);_0x57fcfd[_0x4073('0x31')]=_[_0x4073('0x32')](_0x465c67[_0x4073('0x2d')],qs['fields'](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x33')]));_0x57fcfd[_0x4073('0x31')]=_0x57fcfd[_0x4073('0x31')][_0x4073('0x34')]?_0x57fcfd[_0x4073('0x31')]:_0x465c67[_0x4073('0x2d')];if(!_0x35b8d5['query'][_0x4073('0x35')](_0x4073('0x36'))){_0x57fcfd[_0x4073('0x1b')]=qs[_0x4073('0x1b')](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x1b')]);_0x57fcfd['offset']=qs['offset'](_0x35b8d5[_0x4073('0x2e')][_0x4073('0x37')]);}_0x57fcfd['order']=qs['sort'](_0x35b8d5['query'][_0x4073('0x38')]);_0x57fcfd[_0x4073('0x39')]=qs['filters'](_[_0x4073('0x3a')](_0x35b8d5[_0x4073('0x2e')],_0x465c67[_0x4073('0x30')]),_0x5e958d);if(_0x35b8d5[_0x4073('0x2e')][_0x4073('0x3b')]){_0x57fcfd[_0x4073('0x39')]=_[_0x4073('0x3c')](_0x57fcfd[_0x4073('0x39')],{'$or':_[_0x4073('0x28')](_0x5e958d,function(_0x4e93a6){if(_0x4e93a6[_0x4073('0x2b')]!==_0x4073('0x3d')){var _0xce192c={};_0xce192c[_0x4e93a6['name']]={'$like':'%'+_0x35b8d5['query'][_0x4073('0x3b')]+'%'};return _0xce192c;}})});}_0x57fcfd=_[_0x4073('0x3c')]({},_0x57fcfd,_0x35b8d5['options']);var _0x5eb108={'where':_0x57fcfd[_0x4073('0x39')]};return db['JscriptyAnswerReport'][_0x4073('0x1c')](_0x5eb108)[_0x4073('0x22')](function(_0x4499ad){_0x429f8d[_0x4073('0x1c')]=_0x4499ad;if(_0x35b8d5[_0x4073('0x2e')][_0x4073('0x3e')]){_0x57fcfd[_0x4073('0x3f')]=[{'all':!![]}];}return db[_0x4073('0x29')][_0x4073('0x40')](_0x57fcfd);})[_0x4073('0x22')](function(_0x214635){_0x429f8d['rows']=_0x214635;return _0x429f8d;})[_0x4073('0x22')](respondWithFilteredResult(_0x512f69,_0x57fcfd))[_0x4073('0x41')](handleError(_0x512f69,null));};exports[_0x4073('0x42')]=function(_0x288055,_0x4d026c){var _0x4d4baf={'raw':!![],'where':{'id':_0x288055[_0x4073('0x43')]['id']}},_0x2d577e={};_0x2d577e[_0x4073('0x2d')]=_[_0x4073('0x2f')](db['JscriptyAnswerReport']['rawAttributes']);_0x2d577e[_0x4073('0x2e')]=_[_0x4073('0x2f')](_0x288055[_0x4073('0x2e')]);_0x2d577e[_0x4073('0x30')]=_[_0x4073('0x32')](_0x2d577e[_0x4073('0x2d')],_0x2d577e[_0x4073('0x2e')]);_0x4d4baf[_0x4073('0x31')]=_[_0x4073('0x32')](_0x2d577e[_0x4073('0x2d')],qs['fields'](_0x288055[_0x4073('0x2e')][_0x4073('0x33')]));_0x4d4baf[_0x4073('0x31')]=_0x4d4baf[_0x4073('0x31')][_0x4073('0x34')]?_0x4d4baf['attributes']:_0x2d577e[_0x4073('0x2d')];if(_0x288055[_0x4073('0x2e')][_0x4073('0x3e')]){_0x4d4baf[_0x4073('0x3f')]=[{'all':!![]}];}_0x4d4baf=_[_0x4073('0x3c')]({},_0x4d4baf,_0x288055['options']);return db[_0x4073('0x29')]['find'](_0x4d4baf)[_0x4073('0x22')](handleEntityNotFound(_0x4d026c,null))[_0x4073('0x22')](respondWithResult(_0x4d026c,null))[_0x4073('0x41')](handleError(_0x4d026c,null));};exports[_0x4073('0x44')]=function(_0x51093e,_0x5a0143){return db['JscriptyAnswerReport'][_0x4073('0x44')](_0x51093e[_0x4073('0x45')],{})[_0x4073('0x22')](respondWithResult(_0x5a0143,0xc9))[_0x4073('0x41')](handleError(_0x5a0143,null));};exports['update']=function(_0x4deee7,_0x49b366){if(_0x4deee7[_0x4073('0x45')]['id']){delete _0x4deee7[_0x4073('0x45')]['id'];}return db[_0x4073('0x29')]['find']({'where':{'id':_0x4deee7[_0x4073('0x43')]['id']}})[_0x4073('0x22')](handleEntityNotFound(_0x49b366,null))[_0x4073('0x22')](saveUpdates(_0x4deee7[_0x4073('0x45')],null))[_0x4073('0x22')](respondWithResult(_0x49b366,null))['catch'](handleError(_0x49b366,null));};exports['destroy']=function(_0x45fd98,_0x104983){return db[_0x4073('0x29')][_0x4073('0x46')]({'where':{'id':_0x45fd98['params']['id']}})[_0x4073('0x22')](handleEntityNotFound(_0x104983,null))[_0x4073('0x22')](removeEntity(_0x104983,null))[_0x4073('0x41')](handleError(_0x104983,null));};exports[_0x4073('0x47')]=function(_0x4ad4ee,_0x58588c){return db['JscriptyAnswerReport'][_0x4073('0x47')]()[_0x4073('0x22')](respondWithResult(_0x58588c,null))[_0x4073('0x41')](handleError(_0x58588c,null));}; \ No newline at end of file +var _0x23f4=['index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','update','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','send'];(function(_0x59f64e,_0x3f87d5){var _0x618691=function(_0x30e22c){while(--_0x30e22c){_0x59f64e['push'](_0x59f64e['shift']());}};_0x618691(++_0x3f87d5);}(_0x23f4,0x1ee));var _0x423f=function(_0x491a62,_0x415eac){_0x491a62=_0x491a62-0x0;var _0x170227=_0x23f4[_0x491a62];return _0x170227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x423f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x423f('0x1'));var moment=require(_0x423f('0x2'));var BPromise=require(_0x423f('0x3'));var Mustache=require(_0x423f('0x4'));var util=require(_0x423f('0x5'));var path=require(_0x423f('0x6'));var sox=require(_0x423f('0x7'));var csv=require(_0x423f('0x8'));var ejs=require(_0x423f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x423f('0xa'));var squel=require(_0x423f('0xb'));var crypto=require('crypto');var jsforce=require(_0x423f('0xc'));var deskjs=require(_0x423f('0xd'));var toCsv=require(_0x423f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x423f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x423f('0xf'));var hardwareService=require(_0x423f('0x10'));var logger=require(_0x423f('0x11'))(_0x423f('0x12'));var utils=require('../../config/utils');var config=require(_0x423f('0x13'));var licenseUtil=require(_0x423f('0x14'));var db=require(_0x423f('0x15'))['db'];function respondWithStatusCode(_0x3d4027,_0x216360){_0x216360=_0x216360||0xcc;return function(_0x5275b0){if(_0x5275b0){return _0x3d4027[_0x423f('0x16')](_0x216360);}return _0x3d4027[_0x423f('0x17')](_0x216360)[_0x423f('0x18')]();};}function respondWithResult(_0x1c894f,_0x44e1d5){_0x44e1d5=_0x44e1d5||0xc8;return function(_0x3b531d){if(_0x3b531d){return _0x1c894f[_0x423f('0x17')](_0x44e1d5)[_0x423f('0x19')](_0x3b531d);}};}function respondWithFilteredResult(_0x252e6c,_0x235c86){return function(_0x3940ea){if(_0x3940ea){var _0x276be1=typeof _0x235c86[_0x423f('0x1a')]===_0x423f('0x1b')&&typeof _0x235c86[_0x423f('0x1c')]===_0x423f('0x1b');var _0x3fd56d=_0x3940ea[_0x423f('0x1d')];var _0x26b6d1=_0x276be1?0x0:_0x235c86['offset'];var _0x99435f=_0x276be1?_0x3940ea['count']:_0x235c86['offset']+_0x235c86[_0x423f('0x1c')];var _0x4956e0;if(_0x99435f>=_0x3fd56d){_0x99435f=_0x3fd56d;_0x4956e0=0xc8;}else{_0x4956e0=0xce;}_0x252e6c[_0x423f('0x17')](_0x4956e0);return _0x252e6c[_0x423f('0x1e')]('Content-Range',_0x26b6d1+'-'+_0x99435f+'/'+_0x3fd56d)[_0x423f('0x19')](_0x3940ea);}return null;};}function patchUpdates(_0x1fc317){return function(_0x56c21e){try{jsonpatch[_0x423f('0x1f')](_0x56c21e,_0x1fc317,!![]);}catch(_0x2ebe74){return BPromise['reject'](_0x2ebe74);}return _0x56c21e[_0x423f('0x20')]();};}function saveUpdates(_0x1b4ecc,_0x568dcd){return function(_0x54f47){if(_0x54f47){return _0x54f47['update'](_0x1b4ecc)[_0x423f('0x21')](function(_0x3c942e){return _0x3c942e;});}return null;};}function removeEntity(_0x4502ab,_0x3955a0){return function(_0xb82e8d){if(_0xb82e8d){return _0xb82e8d[_0x423f('0x22')]()[_0x423f('0x21')](function(){_0x4502ab[_0x423f('0x17')](0xcc)[_0x423f('0x18')]();});}};}function handleEntityNotFound(_0x36f57f,_0x45889f){return function(_0x199196){if(!_0x199196){_0x36f57f[_0x423f('0x16')](0x194);}return _0x199196;};}function handleError(_0x1f1747,_0x4a98f2){_0x4a98f2=_0x4a98f2||0x1f4;return function(_0x3308dd){logger[_0x423f('0x23')](_0x3308dd[_0x423f('0x24')]);if(_0x3308dd['name']){delete _0x3308dd['name'];}_0x1f1747[_0x423f('0x17')](_0x4a98f2)[_0x423f('0x25')](_0x3308dd);};}exports[_0x423f('0x26')]=function(_0x4c2f21,_0x5882ed){var _0x3ca28d={},_0xbb4bce={},_0x5a838e={'count':0x0,'rows':[]};var _0x3cf4aa=_[_0x423f('0x27')](db[_0x423f('0x28')][_0x423f('0x29')],function(_0x518c1e){return{'name':_0x518c1e[_0x423f('0x2a')],'type':_0x518c1e[_0x423f('0x2b')][_0x423f('0x2c')]};});_0xbb4bce[_0x423f('0x2d')]=_['map'](_0x3cf4aa,_0x423f('0x2e'));_0xbb4bce[_0x423f('0x2f')]=_[_0x423f('0x30')](_0x4c2f21[_0x423f('0x2f')]);_0xbb4bce[_0x423f('0x31')]=_[_0x423f('0x32')](_0xbb4bce[_0x423f('0x2d')],_0xbb4bce[_0x423f('0x2f')]);_0x3ca28d[_0x423f('0x33')]=_[_0x423f('0x32')](_0xbb4bce['model'],qs[_0x423f('0x34')](_0x4c2f21[_0x423f('0x2f')][_0x423f('0x34')]));_0x3ca28d['attributes']=_0x3ca28d[_0x423f('0x33')]['length']?_0x3ca28d[_0x423f('0x33')]:_0xbb4bce[_0x423f('0x2d')];if(!_0x4c2f21[_0x423f('0x2f')][_0x423f('0x35')](_0x423f('0x36'))){_0x3ca28d['limit']=qs['limit'](_0x4c2f21[_0x423f('0x2f')][_0x423f('0x1c')]);_0x3ca28d[_0x423f('0x1a')]=qs[_0x423f('0x1a')](_0x4c2f21[_0x423f('0x2f')][_0x423f('0x1a')]);}_0x3ca28d[_0x423f('0x37')]=qs[_0x423f('0x38')](_0x4c2f21[_0x423f('0x2f')][_0x423f('0x38')]);_0x3ca28d[_0x423f('0x39')]=qs[_0x423f('0x31')](_[_0x423f('0x3a')](_0x4c2f21['query'],_0xbb4bce['filters']),_0x3cf4aa);if(_0x4c2f21[_0x423f('0x2f')][_0x423f('0x3b')]){_0x3ca28d[_0x423f('0x39')]=_[_0x423f('0x3c')](_0x3ca28d[_0x423f('0x39')],{'$or':_['map'](_0x3cf4aa,function(_0x38dcce){if(_0x38dcce[_0x423f('0x2b')]!==_0x423f('0x3d')){var _0x1d47d8={};_0x1d47d8[_0x38dcce[_0x423f('0x2e')]]={'$like':'%'+_0x4c2f21[_0x423f('0x2f')][_0x423f('0x3b')]+'%'};return _0x1d47d8;}})});}_0x3ca28d=_[_0x423f('0x3c')]({},_0x3ca28d,_0x4c2f21[_0x423f('0x3e')]);var _0x40571a={'where':_0x3ca28d['where']};return db['JscriptyAnswerReport'][_0x423f('0x1d')](_0x40571a)[_0x423f('0x21')](function(_0x81bd62){_0x5a838e[_0x423f('0x1d')]=_0x81bd62;if(_0x4c2f21[_0x423f('0x2f')][_0x423f('0x3f')]){_0x3ca28d['include']=[{'all':!![]}];}return db[_0x423f('0x28')][_0x423f('0x40')](_0x3ca28d);})[_0x423f('0x21')](function(_0x393618){_0x5a838e[_0x423f('0x41')]=_0x393618;return _0x5a838e;})[_0x423f('0x21')](respondWithFilteredResult(_0x5882ed,_0x3ca28d))[_0x423f('0x42')](handleError(_0x5882ed,null));};exports[_0x423f('0x43')]=function(_0x518443,_0x4165e0){var _0x3bc113={'raw':!![],'where':{'id':_0x518443[_0x423f('0x44')]['id']}},_0x192ae5={};_0x192ae5[_0x423f('0x2d')]=_[_0x423f('0x30')](db[_0x423f('0x28')][_0x423f('0x29')]);_0x192ae5[_0x423f('0x2f')]=_['keys'](_0x518443[_0x423f('0x2f')]);_0x192ae5['filters']=_[_0x423f('0x32')](_0x192ae5[_0x423f('0x2d')],_0x192ae5[_0x423f('0x2f')]);_0x3bc113[_0x423f('0x33')]=_[_0x423f('0x32')](_0x192ae5[_0x423f('0x2d')],qs[_0x423f('0x34')](_0x518443[_0x423f('0x2f')][_0x423f('0x34')]));_0x3bc113[_0x423f('0x33')]=_0x3bc113[_0x423f('0x33')][_0x423f('0x45')]?_0x3bc113[_0x423f('0x33')]:_0x192ae5[_0x423f('0x2d')];if(_0x518443[_0x423f('0x2f')][_0x423f('0x3f')]){_0x3bc113[_0x423f('0x46')]=[{'all':!![]}];}_0x3bc113=_[_0x423f('0x3c')]({},_0x3bc113,_0x518443[_0x423f('0x3e')]);return db[_0x423f('0x28')]['find'](_0x3bc113)[_0x423f('0x21')](handleEntityNotFound(_0x4165e0,null))['then'](respondWithResult(_0x4165e0,null))[_0x423f('0x42')](handleError(_0x4165e0,null));};exports[_0x423f('0x47')]=function(_0x1cf881,_0x37035a){return db[_0x423f('0x28')][_0x423f('0x47')](_0x1cf881[_0x423f('0x48')],{})[_0x423f('0x21')](respondWithResult(_0x37035a,0xc9))[_0x423f('0x42')](handleError(_0x37035a,null));};exports[_0x423f('0x49')]=function(_0x31b88e,_0x2dcbec){if(_0x31b88e['body']['id']){delete _0x31b88e[_0x423f('0x48')]['id'];}return db[_0x423f('0x28')]['find']({'where':{'id':_0x31b88e[_0x423f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2dcbec,null))[_0x423f('0x21')](saveUpdates(_0x31b88e['body'],null))['then'](respondWithResult(_0x2dcbec,null))[_0x423f('0x42')](handleError(_0x2dcbec,null));};exports[_0x423f('0x22')]=function(_0x1668d4,_0x4114e1){return db['JscriptyAnswerReport'][_0x423f('0x4a')]({'where':{'id':_0x1668d4['params']['id']}})[_0x423f('0x21')](handleEntityNotFound(_0x4114e1,null))[_0x423f('0x21')](removeEntity(_0x4114e1,null))[_0x423f('0x42')](handleError(_0x4114e1,null));};exports[_0x423f('0x4b')]=function(_0x17c2b6,_0x961f0d){return db[_0x423f('0x28')][_0x423f('0x4b')]()[_0x423f('0x21')](respondWithResult(_0x961f0d,null))['catch'](handleError(_0x961f0d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 66881b9..90c2e44 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 _0x94d6=['lodash','util','api','moment','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x35e42e,_0x338536){var _0x46be96=function(_0x318ff2){while(--_0x318ff2){_0x35e42e['push'](_0x35e42e['shift']());}};_0x46be96(++_0x338536);}(_0x94d6,0x1a2));var _0x694d=function(_0xa5120a,_0x19467f){_0xa5120a=_0xa5120a-0x0;var _0x381c19=_0x94d6[_0xa5120a];return _0x381c19;};'use strict';var _=require(_0x694d('0x0'));var util=require(_0x694d('0x1'));var logger=require('../../config/logger')(_0x694d('0x2'));var moment=require(_0x694d('0x3'));var BPromise=require('bluebird');var rp=require(_0x694d('0x4'));var fs=require('fs');var path=require(_0x694d('0x5'));var rimraf=require(_0x694d('0x6'));var config=require('../../config/environment');var attributes=require(_0x694d('0x7'));module[_0x694d('0x8')]=function(_0x295a66,_0x2cabc3){return _0x295a66['define'](_0x694d('0x9'),attributes,{'tableName':_0x694d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bc7=['report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x0bc7,0xfe));var _0x70bc=function(_0x2d02a1,_0x400768){_0x2d02a1=_0x2d02a1-0x0;var _0x2e44e8=_0x0bc7[_0x2d02a1];return _0x2e44e8;};'use strict';var _=require(_0x70bc('0x0'));var util=require(_0x70bc('0x1'));var logger=require(_0x70bc('0x2'))('api');var moment=require(_0x70bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x70bc('0x4'));var fs=require('fs');var path=require(_0x70bc('0x5'));var rimraf=require(_0x70bc('0x6'));var config=require(_0x70bc('0x7'));var attributes=require(_0x70bc('0x8'));module['exports']=function(_0x4e4d4e,_0x560944){return _0x4e4d4e[_0x70bc('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x70bc('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 0d91633..eda988c 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 _0xcd3d=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ae949,_0x2715ba){var _0x333dc0=function(_0x325412){while(--_0x325412){_0x3ae949['push'](_0x3ae949['shift']());}};_0x333dc0(++_0x2715ba);}(_0xcd3d,0x1c4));var _0xdcd3=function(_0x4cc447,_0x2265f9){_0x4cc447=_0x4cc447-0x0;var _0x45d8ea=_0xcd3d[_0x4cc447];return _0x45d8ea;};'use strict';var _=require('lodash');var util=require(_0xdcd3('0x0'));var moment=require(_0xdcd3('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcd3('0x2'));var fs=require('fs');var Redis=require(_0xdcd3('0x3'));var db=require(_0xdcd3('0x4'))['db'];var utils=require(_0xdcd3('0x5'));var logger=require(_0xdcd3('0x6'))(_0xdcd3('0x7'));var config=require(_0xdcd3('0x8'));var jayson=require(_0xdcd3('0x9'));var client=jayson['client'][_0xdcd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5adf06,_0x42224e,_0xde1b98){return new BPromise(function(_0x5dc18e,_0x33dfee){return client[_0xdcd3('0xb')](_0x5adf06,_0xde1b98)[_0xdcd3('0xc')](function(_0x2725c2){logger[_0xdcd3('0xd')](_0xdcd3('0xe'),_0x42224e,_0xdcd3('0xf'));logger['debug'](_0xdcd3('0x10'),_0x42224e,_0xdcd3('0xf'),JSON[_0xdcd3('0x11')](_0x2725c2));if(_0x2725c2[_0xdcd3('0x12')]){if(_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x13')]===0x1f4){logger[_0xdcd3('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42224e,_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x14')]);return _0x33dfee(_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x14')]);}logger[_0xdcd3('0x12')](_0xdcd3('0xe'),_0x42224e,_0x2725c2['error'][_0xdcd3('0x14')]);return _0x5dc18e(_0x2725c2[_0xdcd3('0x12')][_0xdcd3('0x14')]);}else{logger[_0xdcd3('0xd')](_0xdcd3('0xe'),_0x42224e,_0xdcd3('0xf'));_0x5dc18e(_0x2725c2[_0xdcd3('0x15')]['message']);}})['catch'](function(_0x4438d0){logger[_0xdcd3('0x12')](_0xdcd3('0xe'),_0x42224e,_0x4438d0);_0x33dfee(_0x4438d0);});});} \ No newline at end of file +var _0xc504=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5f26f4,_0x4f9bcf){var _0x385e31=function(_0x20d9d7){while(--_0x20d9d7){_0x5f26f4['push'](_0x5f26f4['shift']());}};_0x385e31(++_0x4f9bcf);}(_0xc504,0x1c6));var _0x4c50=function(_0x502196,_0x19affd){_0x502196=_0x502196-0x0;var _0x1ace96=_0xc504[_0x502196];return _0x1ace96;};'use strict';var _=require(_0x4c50('0x0'));var util=require(_0x4c50('0x1'));var moment=require(_0x4c50('0x2'));var BPromise=require(_0x4c50('0x3'));var rs=require(_0x4c50('0x4'));var fs=require('fs');var Redis=require(_0x4c50('0x5'));var db=require(_0x4c50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c50('0x7'))(_0x4c50('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c50('0x9'));var client=jayson[_0x4c50('0xa')][_0x4c50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c86f2,_0x15f26e,_0x36b02d){return new BPromise(function(_0x1d1fc1,_0x40bb56){return client[_0x4c50('0xc')](_0x4c86f2,_0x36b02d)['then'](function(_0x152f1f){logger[_0x4c50('0xd')](_0x4c50('0xe'),_0x15f26e,_0x4c50('0xf'));logger['debug'](_0x4c50('0x10'),_0x15f26e,_0x4c50('0xf'),JSON[_0x4c50('0x11')](_0x152f1f));if(_0x152f1f[_0x4c50('0x12')]){if(_0x152f1f['error'][_0x4c50('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x15f26e,_0x152f1f[_0x4c50('0x12')][_0x4c50('0x14')]);return _0x40bb56(_0x152f1f[_0x4c50('0x12')]['message']);}logger['error'](_0x4c50('0xe'),_0x15f26e,_0x152f1f[_0x4c50('0x12')][_0x4c50('0x14')]);return _0x1d1fc1(_0x152f1f['error'][_0x4c50('0x14')]);}else{logger['info'](_0x4c50('0xe'),_0x15f26e,_0x4c50('0xf'));_0x1d1fc1(_0x152f1f[_0x4c50('0x15')][_0x4c50('0x14')]);}})[_0x4c50('0x16')](function(_0x26714b){logger[_0x4c50('0x12')](_0x4c50('0xe'),_0x15f26e,_0x26714b);_0x40bb56(_0x26714b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f071ff2..28e3ccd 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 _0x8fee=['destroy','util','path','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','index','get','show','/:id/sessions','getSessions','/:id/summary','getSummary','post','isAuthenticated','create','/:id/clone','put','/:id','delete'];(function(_0x630e58,_0x2cd7a5){var _0x2dca0a=function(_0x36cf76){while(--_0x36cf76){_0x630e58['push'](_0x630e58['shift']());}};_0x2dca0a(++_0x2cd7a5);}(_0x8fee,0x13c));var _0xe8fe=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x8fee[_0x420d8d];return _0x4865d7;};'use strict';var multer=require('multer');var util=require(_0xe8fe('0x0'));var path=require(_0xe8fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8fe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8fe('0x3'));var interaction=require(_0xe8fe('0x4'));var config=require('../../config/environment');var controller=require(_0xe8fe('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8fe('0x6')]);router[_0xe8fe('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe8fe('0x8')]);router[_0xe8fe('0x7')](_0xe8fe('0x9'),auth['isAuthenticated'](),controller[_0xe8fe('0xa')]);router[_0xe8fe('0x7')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xe8fe('0xb'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe8fe('0xc')]);router[_0xe8fe('0xd')]('/',auth[_0xe8fe('0xe')](),controller[_0xe8fe('0xf')]);router[_0xe8fe('0xd')](_0xe8fe('0x10'),auth[_0xe8fe('0xe')](),controller['clone']);router[_0xe8fe('0x11')](_0xe8fe('0x12'),auth[_0xe8fe('0xe')](),controller['update']);router[_0xe8fe('0x13')](_0xe8fe('0x12'),auth[_0xe8fe('0xe')](),controller[_0xe8fe('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc635=['getSummary','post','create','/:id/clone','clone','put','/:id','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','getSessions','getAnswers','/:id/summary','30s'];(function(_0x2888ba,_0x5b0146){var _0x3e22b3=function(_0x53ea43){while(--_0x53ea43){_0x2888ba['push'](_0x2888ba['shift']());}};_0x3e22b3(++_0x5b0146);}(_0xc635,0x199));var _0x5c63=function(_0x209c34,_0x2a110c){_0x209c34=_0x209c34-0x0;var _0x45289d=_0xc635[_0x209c34];return _0x45289d;};'use strict';var multer=require(_0x5c63('0x0'));var util=require(_0x5c63('0x1'));var path=require(_0x5c63('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c63('0x3')]();var fs_extra=require(_0x5c63('0x4'));var auth=require(_0x5c63('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5c63('0x6'));var controller=require(_0x5c63('0x7'));router[_0x5c63('0x8')]('/',auth[_0x5c63('0x9')](),controller[_0x5c63('0xa')]);router['get']('/:id',auth[_0x5c63('0x9')](),controller[_0x5c63('0xb')]);router['get']('/:id/sessions',auth['isAuthenticated'](),controller[_0x5c63('0xc')]);router[_0x5c63('0x8')]('/:id/answers',auth['isAuthenticated'](),controller[_0x5c63('0xd')]);router[_0x5c63('0x8')](_0x5c63('0xe'),auth[_0x5c63('0x9')](),timeout(_0x5c63('0xf')),controller[_0x5c63('0x10')]);router[_0x5c63('0x11')]('/',auth[_0x5c63('0x9')](),controller[_0x5c63('0x12')]);router[_0x5c63('0x11')](_0x5c63('0x13'),auth[_0x5c63('0x9')](),controller[_0x5c63('0x14')]);router[_0x5c63('0x15')](_0x5c63('0x16'),auth[_0x5c63('0x9')](),controller['update']);router[_0x5c63('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5c63('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 84d8d6d..cfbab66 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 _0x0713=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format'];(function(_0xaee9b2,_0x4f74cf){var _0x8c26c1=function(_0x252b5a){while(--_0x252b5a){_0xaee9b2['push'](_0xaee9b2['shift']());}};_0x8c26c1(++_0x4f74cf);}(_0x0713,0x83));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3071('0x0'));var _=require(_0x3071('0x1'));var util=require(_0x3071('0x2'));module['exports']={'name':{'type':Sequelize[_0x3071('0x3')],'unique':_0x3071('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3071('0x5')](_0x3071('0x6')),'set':function(_0x468150){if(_[_0x3071('0x7')](_0x468150)){this[_0x3071('0x8')]('formData',JSON[_0x3071('0x9')](_0x468150));}else if(_[_0x3071('0xa')](_0x468150)){this[_0x3071('0x8')](_0x3071('0xb'),_0x468150);}else{this[_0x3071('0x8')](_0x3071('0xb'),util[_0x3071('0xc')](_0x3071('0xd'),this['getDataValue'](_0x3071('0x4'))||'',this[_0x3071('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3071('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3071('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xc506=['exports','STRING','name','TEXT','long','setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x48759e,_0x3edb3a){var _0x13da56=function(_0x569a18){while(--_0x569a18){_0x48759e['push'](_0x48759e['shift']());}};_0x13da56(++_0x3edb3a);}(_0xc506,0x147));var _0x6c50=function(_0x124da8,_0x2f4adf){_0x124da8=_0x124da8-0x0;var _0x470b89=_0xc506[_0x124da8];return _0x470b89;};'use strict';var Sequelize=require(_0x6c50('0x0'));var _=require(_0x6c50('0x1'));var util=require(_0x6c50('0x2'));module[_0x6c50('0x3')]={'name':{'type':Sequelize[_0x6c50('0x4')],'unique':_0x6c50('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6c50('0x6')](_0x6c50('0x7')),'set':function(_0x5dda81){if(_['isObjectLike'](_0x5dda81)){this[_0x6c50('0x8')](_0x6c50('0x9'),JSON['stringify'](_0x5dda81));}else if(_[_0x6c50('0xa')](_0x5dda81)){this['setDataValue']('formData',_0x5dda81);}else{this[_0x6c50('0x8')](_0x6c50('0x9'),util[_0x6c50('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6c50('0xc')](_0x6c50('0x5'))||'',this[_0x6c50('0xc')](_0x6c50('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6c50('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b2ab29e..27ef4f7 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 _0x1cf6=['order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','length','find','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','nolimit','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','get','Projects','UserProfileResource','sendStatus','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit'];(function(_0x375010,_0x34c626){var _0x2690a8=function(_0x330022){while(--_0x330022){_0x375010['push'](_0x375010['shift']());}};_0x2690a8(++_0x34c626);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x4b5bf7,_0xae9467){_0x4b5bf7=_0x4b5bf7-0x0;var _0x52a09b=_0x1cf6[_0x4b5bf7];return _0x52a09b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61cf('0x0'));var zipdir=require(_0x61cf('0x1'));var jsonpatch=require(_0x61cf('0x2'));var rp=require(_0x61cf('0x3'));var moment=require(_0x61cf('0x4'));var BPromise=require(_0x61cf('0x5'));var Mustache=require('mustache');var util=require(_0x61cf('0x6'));var path=require(_0x61cf('0x7'));var sox=require(_0x61cf('0x8'));var csv=require(_0x61cf('0x9'));var ejs=require(_0x61cf('0xa'));var fs=require('fs');var fs_extra=require(_0x61cf('0xb'));var _=require(_0x61cf('0xc'));var squel=require(_0x61cf('0xd'));var crypto=require(_0x61cf('0xe'));var jsforce=require(_0x61cf('0xf'));var deskjs=require(_0x61cf('0x10'));var toCsv=require(_0x61cf('0x9'));var querystring=require(_0x61cf('0x11'));var Papa=require(_0x61cf('0x12'));var Redis=require(_0x61cf('0x13'));var authService=require(_0x61cf('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x61cf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61cf('0x16'))(_0x61cf('0x17'));var utils=require('../../config/utils');var config=require(_0x61cf('0x18'));var licenseUtil=require(_0x61cf('0x19'));var db=require(_0x61cf('0x1a'))['db'];function respondWithStatusCode(_0x18b674,_0x24a4e8){_0x24a4e8=_0x24a4e8||0xcc;return function(_0x54e56f){if(_0x54e56f){return _0x18b674['sendStatus'](_0x24a4e8);}return _0x18b674[_0x61cf('0x1b')](_0x24a4e8)[_0x61cf('0x1c')]();};}function respondWithResult(_0x290dd5,_0x10cbc3){_0x10cbc3=_0x10cbc3||0xc8;return function(_0x2426e5){if(_0x2426e5){return _0x290dd5[_0x61cf('0x1b')](_0x10cbc3)[_0x61cf('0x1d')](_0x2426e5);}};}function respondWithFilteredResult(_0x4cc012,_0x3c3083){return function(_0xd01df5){if(_0xd01df5){var _0x41ad26=typeof _0x3c3083[_0x61cf('0x1e')]===_0x61cf('0x1f')&&typeof _0x3c3083['limit']===_0x61cf('0x1f');var _0x22dc46=_0xd01df5[_0x61cf('0x20')];var _0x36f2d6=_0x41ad26?0x0:_0x3c3083[_0x61cf('0x1e')];var _0x239b91=_0x41ad26?_0xd01df5[_0x61cf('0x20')]:_0x3c3083['offset']+_0x3c3083['limit'];var _0x2908b0;if(_0x239b91>=_0x22dc46){_0x239b91=_0x22dc46;_0x2908b0=0xc8;}else{_0x2908b0=0xce;}_0x4cc012[_0x61cf('0x1b')](_0x2908b0);return _0x4cc012['set'](_0x61cf('0x21'),_0x36f2d6+'-'+_0x239b91+'/'+_0x22dc46)['json'](_0xd01df5);}return null;};}function patchUpdates(_0x508617){return function(_0x2f4314){try{jsonpatch[_0x61cf('0x22')](_0x2f4314,_0x508617,!![]);}catch(_0x59f0f9){return BPromise['reject'](_0x59f0f9);}return _0x2f4314[_0x61cf('0x23')]();};}function saveUpdates(_0x59b50f,_0x320042){return function(_0x58b6f5){if(_0x58b6f5){return _0x58b6f5['update'](_0x59b50f)[_0x61cf('0x24')](function(_0xf1fa7d){return _0xf1fa7d;});}return null;};}function removeEntity(_0x44eb29,_0x2f9d2b){return function(_0x469a90){if(_0x469a90){return _0x469a90[_0x61cf('0x25')]()['then'](function(){var _0x540c70=_0x469a90[_0x61cf('0x26')]({'plain':!![]});var _0x3916e6=_0x61cf('0x27');return db[_0x61cf('0x28')]['destroy']({'where':{'type':_0x3916e6,'resourceId':_0x540c70['id']}})[_0x61cf('0x24')](function(){return _0x469a90;});})[_0x61cf('0x24')](function(){_0x44eb29[_0x61cf('0x1b')](0xcc)[_0x61cf('0x1c')]();});}};}function handleEntityNotFound(_0x533aa1,_0x5603ad){return function(_0x2e2df3){if(!_0x2e2df3){_0x533aa1[_0x61cf('0x29')](0x194);}return _0x2e2df3;};}function handleError(_0x27a132,_0x16c3d1){_0x16c3d1=_0x16c3d1||0x1f4;return function(_0x5368ba){logger['error'](_0x5368ba['stack']);if(_0x5368ba['name']){delete _0x5368ba[_0x61cf('0x2a')];}_0x27a132[_0x61cf('0x1b')](_0x16c3d1)[_0x61cf('0x2b')](_0x5368ba);};}exports[_0x61cf('0x2c')]=function(_0x51343c,_0x23d0ee){var _0x3188d3={},_0x133e9f={},_0x533fe6={'count':0x0,'rows':[]};var _0x21edb3=_[_0x61cf('0x2d')](db[_0x61cf('0x2e')][_0x61cf('0x2f')],function(_0x5efb8a){return{'name':_0x5efb8a[_0x61cf('0x30')],'type':_0x5efb8a[_0x61cf('0x31')][_0x61cf('0x32')]};});_0x133e9f[_0x61cf('0x33')]=_[_0x61cf('0x2d')](_0x21edb3,_0x61cf('0x2a'));_0x133e9f[_0x61cf('0x34')]=_[_0x61cf('0x35')](_0x51343c['query']);_0x133e9f[_0x61cf('0x36')]=_[_0x61cf('0x37')](_0x133e9f[_0x61cf('0x33')],_0x133e9f[_0x61cf('0x34')]);_0x3188d3[_0x61cf('0x38')]=_[_0x61cf('0x37')](_0x133e9f['model'],qs[_0x61cf('0x39')](_0x51343c[_0x61cf('0x34')]['fields']));_0x3188d3[_0x61cf('0x38')]=_0x3188d3['attributes']['length']?_0x3188d3['attributes']:_0x133e9f[_0x61cf('0x33')];if(!_0x51343c[_0x61cf('0x34')][_0x61cf('0x3a')]('nolimit')){_0x3188d3[_0x61cf('0x3b')]=qs[_0x61cf('0x3b')](_0x51343c['query'][_0x61cf('0x3b')]);_0x3188d3[_0x61cf('0x1e')]=qs[_0x61cf('0x1e')](_0x51343c[_0x61cf('0x34')][_0x61cf('0x1e')]);}_0x3188d3[_0x61cf('0x3c')]=qs[_0x61cf('0x3d')](_0x51343c[_0x61cf('0x34')]['sort']);_0x3188d3['where']=qs['filters'](_['pick'](_0x51343c[_0x61cf('0x34')],_0x133e9f[_0x61cf('0x36')]),_0x21edb3);if(_0x51343c['query'][_0x61cf('0x3e')]){_0x3188d3[_0x61cf('0x3f')]=_[_0x61cf('0x40')](_0x3188d3[_0x61cf('0x3f')],{'$or':_[_0x61cf('0x2d')](_0x21edb3,function(_0xd99df8){if(_0xd99df8[_0x61cf('0x31')]!==_0x61cf('0x41')){var _0x364899={};_0x364899[_0xd99df8[_0x61cf('0x2a')]]={'$like':'%'+_0x51343c[_0x61cf('0x34')][_0x61cf('0x3e')]+'%'};return _0x364899;}})});}_0x3188d3=_[_0x61cf('0x40')]({},_0x3188d3,_0x51343c[_0x61cf('0x42')]);var _0x31922a={'where':_0x3188d3[_0x61cf('0x3f')]};return db[_0x61cf('0x2e')][_0x61cf('0x20')](_0x31922a)[_0x61cf('0x24')](function(_0x2e6002){_0x533fe6['count']=_0x2e6002;if(_0x51343c[_0x61cf('0x34')][_0x61cf('0x43')]){_0x3188d3[_0x61cf('0x44')]=[{'all':!![]}];}return db[_0x61cf('0x2e')][_0x61cf('0x45')](_0x3188d3);})[_0x61cf('0x24')](function(_0x1be7a2){_0x533fe6[_0x61cf('0x46')]=_0x1be7a2;return _0x533fe6;})[_0x61cf('0x24')](respondWithFilteredResult(_0x23d0ee,_0x3188d3))[_0x61cf('0x47')](handleError(_0x23d0ee,null));};exports[_0x61cf('0x48')]=function(_0x100442,_0x489766){var _0x2c2d00={'raw':![],'where':{'id':_0x100442['params']['id']}},_0x49497e={};_0x49497e['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x49497e[_0x61cf('0x34')]=_['keys'](_0x100442['query']);_0x49497e['filters']=_[_0x61cf('0x37')](_0x49497e[_0x61cf('0x33')],_0x49497e[_0x61cf('0x34')]);_0x2c2d00[_0x61cf('0x38')]=_['intersection'](_0x49497e['model'],qs[_0x61cf('0x39')](_0x100442[_0x61cf('0x34')]['fields']));_0x2c2d00['attributes']=_0x2c2d00[_0x61cf('0x38')]['length']?_0x2c2d00[_0x61cf('0x38')]:_0x49497e[_0x61cf('0x33')];if(_0x100442['query']['includeAll']){_0x2c2d00['include']=[{'all':!![]}];}_0x2c2d00=_[_0x61cf('0x40')]({},_0x2c2d00,_0x100442[_0x61cf('0x42')]);return db[_0x61cf('0x2e')]['find'](_0x2c2d00)['then'](handleEntityNotFound(_0x489766,null))['then'](respondWithResult(_0x489766,null))['catch'](handleError(_0x489766,null));};exports['create']=function(_0x228c53,_0x53421b){return db[_0x61cf('0x2e')][_0x61cf('0x49')](_0x228c53[_0x61cf('0x4a')],{})[_0x61cf('0x24')](function(_0x22610f){var _0x5523fa=_0x228c53[_0x61cf('0x4b')][_0x61cf('0x26')]({'plain':!![]});if(!_0x5523fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5523fa[_0x61cf('0x4c')]===_0x61cf('0x4b')){var _0xb0ef60=_0x22610f[_0x61cf('0x26')]({'plain':!![]});var _0x2e741f=_0x61cf('0x27');return db[_0x61cf('0x4d')]['find']({'where':{'name':_0x2e741f,'userProfileId':_0x5523fa[_0x61cf('0x4e')]},'raw':!![]})[_0x61cf('0x24')](function(_0x4707d8){if(_0x4707d8&&_0x4707d8[_0x61cf('0x4f')]===0x0){return db[_0x61cf('0x28')][_0x61cf('0x49')]({'name':_0xb0ef60[_0x61cf('0x2a')],'resourceId':_0xb0ef60['id'],'type':_0x4707d8['name'],'sectionId':_0x4707d8['id']},{})[_0x61cf('0x24')](function(){return _0x22610f;});}else{return _0x22610f;}})['catch'](function(_0x20a960){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20a960);throw _0x20a960;});}return _0x22610f;})[_0x61cf('0x24')](respondWithResult(_0x53421b,0xc9))[_0x61cf('0x47')](handleError(_0x53421b,null));};exports[_0x61cf('0x50')]=function(_0x1ecf2e,_0x59dc29){var _0x3b39f2={'where':{'id':_0x1ecf2e[_0x61cf('0x51')]['id']}},_0x3d3942={};_0x3d3942[_0x61cf('0x33')]=_[_0x61cf('0x35')](db[_0x61cf('0x2e')][_0x61cf('0x2f')]);_0x3b39f2['attributes']=_[_0x61cf('0x37')](_0x3d3942[_0x61cf('0x33')],qs[_0x61cf('0x39')](_0x1ecf2e[_0x61cf('0x34')]['fields']));_0x3b39f2[_0x61cf('0x38')]=_0x3b39f2[_0x61cf('0x38')][_0x61cf('0x52')]?_0x3b39f2[_0x61cf('0x38')]:_0x3d3942[_0x61cf('0x33')];if(_0x1ecf2e['query']['includeAll']){_0x3b39f2[_0x61cf('0x44')]=[{'all':!![]}];}_0x3b39f2=_[_0x61cf('0x40')]({},_0x3b39f2,_0x1ecf2e[_0x61cf('0x42')]);return db[_0x61cf('0x2e')][_0x61cf('0x53')](_0x3b39f2)[_0x61cf('0x24')](handleEntityNotFound(_0x59dc29,null))[_0x61cf('0x24')](function(_0x5a6a45){if(_0x5a6a45){var _0x4cdcbe=_0x5a6a45[_0x61cf('0x26')]({'plain':!![]});_0x4cdcbe=qs[_0x61cf('0x54')](_0x4cdcbe,['id',_0x61cf('0x55'),_0x61cf('0x56')]);_0x1ecf2e['body']=_[_0x61cf('0x54')](_0x1ecf2e['body'],['id','createdAt','updatedAt']);return db[_0x61cf('0x2e')][_0x61cf('0x49')](_[_0x61cf('0x40')](_0x4cdcbe,_0x1ecf2e[_0x61cf('0x4a')]),{'include':_0x1ecf2e[_0x61cf('0x34')][_0x61cf('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x368171){var _0x21ee4b=_0x1ecf2e[_0x61cf('0x4b')][_0x61cf('0x26')]({'plain':!![]});if(!_0x21ee4b)throw new Error(_0x61cf('0x57'));if(_0x21ee4b[_0x61cf('0x4c')]===_0x61cf('0x4b')){var _0xd63b69=_0x368171[_0x61cf('0x26')]({'plain':!![]});var _0x107bd8='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x107bd8,'userProfileId':_0x21ee4b[_0x61cf('0x4e')]},'raw':!![]})['then'](function(_0x56c006){if(_0x56c006&&_0x56c006[_0x61cf('0x4f')]===0x0){return db[_0x61cf('0x28')]['create']({'name':_0xd63b69[_0x61cf('0x2a')],'resourceId':_0xd63b69['id'],'type':_0x56c006[_0x61cf('0x2a')],'sectionId':_0x56c006['id']},{})['then'](function(){return _0x368171;});}else{return _0x368171;}})[_0x61cf('0x47')](function(_0x2cd425){logger[_0x61cf('0x58')](_0x61cf('0x59'),_0x2cd425);throw _0x2cd425;});}return _0x368171;});}})['then'](respondWithResult(_0x59dc29,0xc9))[_0x61cf('0x47')](handleError(_0x59dc29,null));};exports[_0x61cf('0x5a')]=function(_0x429609,_0x2afeee){if(_0x429609[_0x61cf('0x4a')]['id']){delete _0x429609[_0x61cf('0x4a')]['id'];}return db[_0x61cf('0x2e')][_0x61cf('0x53')]({'where':{'id':_0x429609['params']['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x2afeee,null))['then'](saveUpdates(_0x429609[_0x61cf('0x4a')],null))[_0x61cf('0x24')](respondWithResult(_0x2afeee,null))[_0x61cf('0x47')](handleError(_0x2afeee,null));};exports['destroy']=function(_0x1d6740,_0x5ce912){return db['JscriptyProject'][_0x61cf('0x53')]({'where':{'id':_0x1d6740[_0x61cf('0x51')]['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x5ce912,null))['then'](removeEntity(_0x5ce912,null))['catch'](handleError(_0x5ce912,null));};exports[_0x61cf('0x5b')]=function(_0x537390,_0x6a66c2,_0x21bbbf){var _0x16d00e={'raw':!![],'where':{}};var _0x21fb59={};var _0x4b01c0={'count':0x0,'rows':[]};return db[_0x61cf('0x2e')][_0x61cf('0x5c')]({'where':{'id':_0x537390[_0x61cf('0x51')]['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x6a66c2,null))[_0x61cf('0x24')](function(_0x293d5d){if(_0x293d5d){_0x21fb59[_0x61cf('0x33')]=_['keys'](db[_0x61cf('0x5d')][_0x61cf('0x2f')]);_0x21fb59[_0x61cf('0x34')]=_[_0x61cf('0x35')](_0x537390[_0x61cf('0x34')]);_0x21fb59[_0x61cf('0x36')]=_['intersection'](_0x21fb59[_0x61cf('0x33')],_0x21fb59[_0x61cf('0x34')]);_0x16d00e['attributes']=_[_0x61cf('0x37')](_0x21fb59[_0x61cf('0x33')],qs[_0x61cf('0x39')](_0x537390[_0x61cf('0x34')][_0x61cf('0x39')]));_0x16d00e['attributes']=_0x16d00e['attributes'][_0x61cf('0x52')]?_0x16d00e[_0x61cf('0x38')]:_0x21fb59[_0x61cf('0x33')];if(!_0x537390[_0x61cf('0x34')][_0x61cf('0x3a')](_0x61cf('0x5e'))){_0x16d00e[_0x61cf('0x3b')]=qs['limit'](_0x537390[_0x61cf('0x34')][_0x61cf('0x3b')]);_0x16d00e[_0x61cf('0x1e')]=qs[_0x61cf('0x1e')](_0x537390[_0x61cf('0x34')][_0x61cf('0x1e')]);}_0x16d00e[_0x61cf('0x3c')]=qs[_0x61cf('0x3d')](_0x537390[_0x61cf('0x34')]['sort']);_0x16d00e['where']=qs[_0x61cf('0x36')](_[_0x61cf('0x5f')](_0x537390[_0x61cf('0x34')],_0x21fb59[_0x61cf('0x36')]));_0x16d00e[_0x61cf('0x3f')][_0x61cf('0x60')]=_0x293d5d['id'];if(_0x537390[_0x61cf('0x34')][_0x61cf('0x3e')]){_0x16d00e[_0x61cf('0x3f')]=_[_0x61cf('0x40')](_0x16d00e[_0x61cf('0x3f')],{'$or':_[_0x61cf('0x2d')](_0x16d00e[_0x61cf('0x38')],function(_0x466860){var _0x5490c4={};_0x5490c4[_0x466860]={'$like':'%'+_0x537390[_0x61cf('0x34')][_0x61cf('0x3e')]+'%'};return _0x5490c4;})});}_0x16d00e=_[_0x61cf('0x40')]({},_0x16d00e,_0x537390[_0x61cf('0x42')]);return db[_0x61cf('0x5d')][_0x61cf('0x20')]({'where':_0x16d00e[_0x61cf('0x3f')]})['then'](function(_0x53db34){_0x4b01c0[_0x61cf('0x20')]=_0x53db34;if(_0x537390[_0x61cf('0x34')]['includeAll']){_0x16d00e['include']=[{'all':!![]}];}return db[_0x61cf('0x5d')]['findAll'](_0x16d00e);})[_0x61cf('0x24')](function(_0x23a9fe){_0x4b01c0[_0x61cf('0x46')]=_0x23a9fe;return _0x4b01c0;});}})['then'](respondWithFilteredResult(_0x6a66c2,_0x16d00e))['catch'](handleError(_0x6a66c2,null));};exports[_0x61cf('0x61')]=function(_0x5af841,_0x4e71cf,_0x5b85da){var _0x21dfa2={'raw':!![],'where':{}};var _0x45cfb9={};var _0x11b112={'count':0x0,'rows':[]};return db[_0x61cf('0x2e')][_0x61cf('0x5c')]({'where':{'id':_0x5af841[_0x61cf('0x51')]['id']}})[_0x61cf('0x24')](handleEntityNotFound(_0x4e71cf,null))[_0x61cf('0x24')](function(_0x19574a){if(_0x19574a){_0x45cfb9[_0x61cf('0x33')]=_[_0x61cf('0x35')](db[_0x61cf('0x62')][_0x61cf('0x2f')]);_0x45cfb9[_0x61cf('0x34')]=_[_0x61cf('0x35')](_0x5af841[_0x61cf('0x34')]);_0x45cfb9[_0x61cf('0x36')]=_[_0x61cf('0x37')](_0x45cfb9[_0x61cf('0x33')],_0x45cfb9[_0x61cf('0x34')]);_0x21dfa2[_0x61cf('0x38')]=_[_0x61cf('0x37')](_0x45cfb9[_0x61cf('0x33')],qs[_0x61cf('0x39')](_0x5af841[_0x61cf('0x34')]['fields']));_0x21dfa2[_0x61cf('0x38')]=_0x21dfa2[_0x61cf('0x38')][_0x61cf('0x52')]?_0x21dfa2[_0x61cf('0x38')]:_0x45cfb9[_0x61cf('0x33')];if(!_0x5af841[_0x61cf('0x34')][_0x61cf('0x3a')](_0x61cf('0x5e'))){_0x21dfa2[_0x61cf('0x3b')]=qs[_0x61cf('0x3b')](_0x5af841[_0x61cf('0x34')]['limit']);_0x21dfa2[_0x61cf('0x1e')]=qs[_0x61cf('0x1e')](_0x5af841[_0x61cf('0x34')][_0x61cf('0x1e')]);}_0x21dfa2[_0x61cf('0x3c')]=qs[_0x61cf('0x3d')](_0x5af841[_0x61cf('0x34')]['sort']);_0x21dfa2[_0x61cf('0x3f')]=qs[_0x61cf('0x36')](_[_0x61cf('0x5f')](_0x5af841[_0x61cf('0x34')],_0x45cfb9[_0x61cf('0x36')]));_0x21dfa2[_0x61cf('0x3f')][_0x61cf('0x60')]=_0x19574a['id'];if(_0x5af841[_0x61cf('0x34')][_0x61cf('0x3e')]){_0x21dfa2[_0x61cf('0x3f')]=_[_0x61cf('0x40')](_0x21dfa2['where'],{'$or':_[_0x61cf('0x2d')](_0x21dfa2[_0x61cf('0x38')],function(_0x364cc3){var _0x22e414={};_0x22e414[_0x364cc3]={'$like':'%'+_0x5af841[_0x61cf('0x34')][_0x61cf('0x3e')]+'%'};return _0x22e414;})});}_0x21dfa2=_[_0x61cf('0x40')]({},_0x21dfa2,_0x5af841[_0x61cf('0x42')]);return db['JscriptyAnswerReport'][_0x61cf('0x20')]({'where':_0x21dfa2['where']})[_0x61cf('0x24')](function(_0x102c9d){_0x11b112[_0x61cf('0x20')]=_0x102c9d;if(_0x5af841[_0x61cf('0x34')]['includeAll']){_0x21dfa2[_0x61cf('0x44')]=[{'all':!![]}];}return db[_0x61cf('0x62')][_0x61cf('0x45')](_0x21dfa2);})[_0x61cf('0x24')](function(_0x3769c4){_0x11b112[_0x61cf('0x46')]=_0x3769c4;return _0x11b112;});}})['then'](respondWithFilteredResult(_0x4e71cf,_0x21dfa2))['catch'](handleError(_0x4e71cf,null));};function char(_0x1b3700){return _0x61cf('0x63')===typeof _0x1b3700?String[_0x61cf('0x64')]['apply'](null,arguments):_0x1b3700;}function needsEncapsulation(_0x1012dd){return!!_0x1012dd&&(_0x1012dd[_0x61cf('0x65')]()[_0x61cf('0x66')](char(0xd))>=0x0||_0x1012dd[_0x61cf('0x65')]()['indexOf'](char(0xa))>=0x0||_0x1012dd['toString']()[_0x61cf('0x66')](char(0x2c))>=0x0||_0x1012dd[_0x61cf('0x65')]()[_0x61cf('0x66')](char(0x22))>=0x0);}function encapsulate(_0x5cf19e){var _0x538c23=char(0x22),_0x42ef1e='\x5c'+char(0x22),_0x33d6f6=_0x5cf19e[_0x61cf('0x65')]()[_0x61cf('0x67')](new RegExp(_0x538c23,'g'),_0x42ef1e);return _0x538c23+_0x33d6f6+_0x538c23;}exports[_0x61cf('0x68')]=function(_0xcdd286,_0x3726f6,_0x5cf579){var _0x4e7958,_0x2a363d;var _0x17cd6d={'where':{'ProjectId':_0xcdd286[_0x61cf('0x51')]['id']}};if(_0xcdd286[_0x61cf('0x34')][_0x61cf('0x69')]){_0x17cd6d['where'][_0x61cf('0x6a')]=JSON['parse'](_0xcdd286[_0x61cf('0x34')]['startTime']);}return db['JscriptySessionReport'][_0x61cf('0x45')](_0x17cd6d)[_0x61cf('0x24')](handleEntityNotFound(_0x3726f6,null))[_0x61cf('0x24')](function(_0x5cdb66){if(_0x5cdb66){_0x4e7958=_0x5cdb66;return db[_0x61cf('0x6b')][_0x61cf('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x4e7958,'id')},'ProjectId':_0xcdd286[_0x61cf('0x51')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x3726f6,null))[_0x61cf('0x24')](function(_0x45a5b7){if(_0x45a5b7){_0x2a363d=_0x45a5b7;var _0x111fef={};for(var _0xfe212e=0x0,_0x477932=_0x2a363d['length'];_0xfe212e<_0x477932;_0xfe212e++){if(!_0x111fef[_0x61cf('0x3a')](_0x2a363d[_0xfe212e][_0x61cf('0x6c')])){_0x111fef[_0x2a363d[_0xfe212e][_0x61cf('0x6c')]]=needsEncapsulation(_0x2a363d[_0xfe212e]['question'])?encapsulate(_0x2a363d[_0xfe212e]['question']):_0x2a363d[_0xfe212e]['question'];}}var _0x3b63a0=[],_0x53b9a0={};for(var _0x5e1fea=0x0,_0x5383ad=_0x4e7958[_0x61cf('0x52')];_0x5e1fea<_0x5383ad;_0x5e1fea++){_0x53b9a0={'ProjectId':_0xcdd286[_0x61cf('0x51')]['id'],'SessionId':_0x4e7958[_0x5e1fea]['id'],'StartTime':moment(_0x4e7958[_0x5e1fea][_0x61cf('0x6a')])[_0x61cf('0x6d')](_0x61cf('0x6e'))};for(var _0x404baa=0x0,_0x5ce7b4=_0x2a363d[_0x61cf('0x52')];_0x404baa<_0x5ce7b4;_0x404baa++){if(_0x2a363d[_0x404baa]['SessionId']==_0x4e7958[_0x5e1fea]['id']&&_0x111fef[_0x61cf('0x3a')](_0x2a363d[_0x404baa][_0x61cf('0x6c')])){_0x53b9a0[_0x111fef[_0x2a363d[_0x404baa][_0x61cf('0x6c')]]]=_0x2a363d[_0x404baa]['answer'];}}for(var _0x3027d2 in _0x111fef){if(!_0x53b9a0[_0x61cf('0x3a')](_0x111fef[_0x3027d2])){_0x53b9a0[_0x111fef[_0x3027d2]]=null;}}_0x3b63a0[_0x61cf('0x6f')](_0x53b9a0);}return _0x3b63a0;}})[_0x61cf('0x24')](function(_0x4e6802){if(!_[_0x61cf('0x70')](_0x4e6802)){var _0x8184ef=toCsv(_0x4e6802);var _0x2c1466=Date[_0x61cf('0x71')]();fs[_0x61cf('0x72')](util['format'](_0x61cf('0x73'),_0xcdd286[_0x61cf('0x51')]['id'],_0x2c1466),_0x8184ef);_0x3726f6['setHeader'](_0x61cf('0x74'),'attachment;\x20filename='+util[_0x61cf('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0xcdd286[_0x61cf('0x51')]['id'],_0x2c1466));_0x3726f6[_0x61cf('0x75')]('Content-type',_0x61cf('0x76'));return _0x3726f6[_0x61cf('0x77')](util[_0x61cf('0x6d')](_0x61cf('0x73'),_0xcdd286['params']['id'],_0x2c1466));}else{return _0x3726f6[_0x61cf('0x29')](0xcc);}})[_0x61cf('0x47')](handleError(_0x3726f6,null));}; \ No newline at end of file +var _0x143a=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','UserProfileSection','getSessions','JscriptySessionReport','order','pick','ProjectId','count','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x54cef4,_0x3f01b9){var _0x50bc2b=function(_0x180df3){while(--_0x180df3){_0x54cef4['push'](_0x54cef4['shift']());}};_0x50bc2b(++_0x3f01b9);}(_0x143a,0x1b9));var _0xa143=function(_0xcff696,_0x212d6d){_0xcff696=_0xcff696-0x0;var _0xf720b9=_0x143a[_0xcff696];return _0xf720b9;};'use strict';var emlformat=require(_0xa143('0x0'));var rimraf=require(_0xa143('0x1'));var zipdir=require(_0xa143('0x2'));var jsonpatch=require(_0xa143('0x3'));var rp=require(_0xa143('0x4'));var moment=require('moment');var BPromise=require(_0xa143('0x5'));var Mustache=require('mustache');var util=require(_0xa143('0x6'));var path=require('path');var sox=require(_0xa143('0x7'));var csv=require(_0xa143('0x8'));var ejs=require(_0xa143('0x9'));var fs=require('fs');var fs_extra=require(_0xa143('0xa'));var _=require(_0xa143('0xb'));var squel=require(_0xa143('0xc'));var crypto=require(_0xa143('0xd'));var jsforce=require(_0xa143('0xe'));var deskjs=require(_0xa143('0xf'));var toCsv=require(_0xa143('0x8'));var querystring=require(_0xa143('0x10'));var Papa=require(_0xa143('0x11'));var Redis=require('ioredis');var authService=require(_0xa143('0x12'));var qs=require(_0xa143('0x13'));var as=require(_0xa143('0x14'));var hardwareService=require(_0xa143('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa143('0x16'));var config=require(_0xa143('0x17'));var licenseUtil=require(_0xa143('0x18'));var db=require(_0xa143('0x19'))['db'];function respondWithStatusCode(_0xc3cc21,_0x3a5c00){_0x3a5c00=_0x3a5c00||0xcc;return function(_0x226303){if(_0x226303){return _0xc3cc21[_0xa143('0x1a')](_0x3a5c00);}return _0xc3cc21[_0xa143('0x1b')](_0x3a5c00)[_0xa143('0x1c')]();};}function respondWithResult(_0x49807f,_0x1988fe){_0x1988fe=_0x1988fe||0xc8;return function(_0x29146e){if(_0x29146e){return _0x49807f[_0xa143('0x1b')](_0x1988fe)[_0xa143('0x1d')](_0x29146e);}};}function respondWithFilteredResult(_0x4318c1,_0x47d554){return function(_0x72f2c7){if(_0x72f2c7){var _0x3f2771=typeof _0x47d554[_0xa143('0x1e')]==='undefined'&&typeof _0x47d554['limit']===_0xa143('0x1f');var _0x3d7197=_0x72f2c7['count'];var _0x7b534e=_0x3f2771?0x0:_0x47d554[_0xa143('0x1e')];var _0x58343c=_0x3f2771?_0x72f2c7['count']:_0x47d554[_0xa143('0x1e')]+_0x47d554[_0xa143('0x20')];var _0xae3471;if(_0x58343c>=_0x3d7197){_0x58343c=_0x3d7197;_0xae3471=0xc8;}else{_0xae3471=0xce;}_0x4318c1['status'](_0xae3471);return _0x4318c1[_0xa143('0x21')]('Content-Range',_0x7b534e+'-'+_0x58343c+'/'+_0x3d7197)[_0xa143('0x1d')](_0x72f2c7);}return null;};}function patchUpdates(_0x25254a){return function(_0x27d8a8){try{jsonpatch[_0xa143('0x22')](_0x27d8a8,_0x25254a,!![]);}catch(_0x477e4d){return BPromise['reject'](_0x477e4d);}return _0x27d8a8[_0xa143('0x23')]();};}function saveUpdates(_0x3a1998,_0x51eb32){return function(_0x419024){if(_0x419024){return _0x419024[_0xa143('0x24')](_0x3a1998)['then'](function(_0xb90b5c){return _0xb90b5c;});}return null;};}function removeEntity(_0xbf7ac,_0x320f20){return function(_0x317b5f){if(_0x317b5f){return _0x317b5f[_0xa143('0x25')]()[_0xa143('0x26')](function(){var _0x26b7f1=_0x317b5f[_0xa143('0x27')]({'plain':!![]});var _0x2467ac=_0xa143('0x28');return db[_0xa143('0x29')]['destroy']({'where':{'type':_0x2467ac,'resourceId':_0x26b7f1['id']}})[_0xa143('0x26')](function(){return _0x317b5f;});})['then'](function(){_0xbf7ac[_0xa143('0x1b')](0xcc)[_0xa143('0x1c')]();});}};}function handleEntityNotFound(_0x422e04,_0x4fc21e){return function(_0x5b68e0){if(!_0x5b68e0){_0x422e04['sendStatus'](0x194);}return _0x5b68e0;};}function handleError(_0x533e13,_0x1fc193){_0x1fc193=_0x1fc193||0x1f4;return function(_0x571877){logger[_0xa143('0x2a')](_0x571877[_0xa143('0x2b')]);if(_0x571877[_0xa143('0x2c')]){delete _0x571877[_0xa143('0x2c')];}_0x533e13[_0xa143('0x1b')](_0x1fc193)['send'](_0x571877);};}exports[_0xa143('0x2d')]=function(_0x105396,_0x4b1505){var _0x4f1000={},_0x4c8da8={},_0x4363b6={'count':0x0,'rows':[]};var _0xd2b938=_[_0xa143('0x2e')](db[_0xa143('0x2f')][_0xa143('0x30')],function(_0x492677){return{'name':_0x492677[_0xa143('0x31')],'type':_0x492677[_0xa143('0x32')][_0xa143('0x33')]};});_0x4c8da8[_0xa143('0x34')]=_[_0xa143('0x2e')](_0xd2b938,'name');_0x4c8da8['query']=_[_0xa143('0x35')](_0x105396[_0xa143('0x36')]);_0x4c8da8[_0xa143('0x37')]=_[_0xa143('0x38')](_0x4c8da8['model'],_0x4c8da8[_0xa143('0x36')]);_0x4f1000['attributes']=_[_0xa143('0x38')](_0x4c8da8[_0xa143('0x34')],qs[_0xa143('0x39')](_0x105396[_0xa143('0x36')][_0xa143('0x39')]));_0x4f1000[_0xa143('0x3a')]=_0x4f1000['attributes']['length']?_0x4f1000['attributes']:_0x4c8da8['model'];if(!_0x105396[_0xa143('0x36')][_0xa143('0x3b')](_0xa143('0x3c'))){_0x4f1000[_0xa143('0x20')]=qs[_0xa143('0x20')](_0x105396[_0xa143('0x36')][_0xa143('0x20')]);_0x4f1000[_0xa143('0x1e')]=qs[_0xa143('0x1e')](_0x105396['query'][_0xa143('0x1e')]);}_0x4f1000['order']=qs[_0xa143('0x3d')](_0x105396[_0xa143('0x36')][_0xa143('0x3d')]);_0x4f1000[_0xa143('0x3e')]=qs[_0xa143('0x37')](_['pick'](_0x105396[_0xa143('0x36')],_0x4c8da8[_0xa143('0x37')]),_0xd2b938);if(_0x105396[_0xa143('0x36')][_0xa143('0x3f')]){_0x4f1000[_0xa143('0x3e')]=_[_0xa143('0x40')](_0x4f1000['where'],{'$or':_[_0xa143('0x2e')](_0xd2b938,function(_0x4a6057){if(_0x4a6057[_0xa143('0x32')]!==_0xa143('0x41')){var _0x30c4a2={};_0x30c4a2[_0x4a6057[_0xa143('0x2c')]]={'$like':'%'+_0x105396['query'][_0xa143('0x3f')]+'%'};return _0x30c4a2;}})});}_0x4f1000=_['merge']({},_0x4f1000,_0x105396[_0xa143('0x42')]);var _0x37178b={'where':_0x4f1000[_0xa143('0x3e')]};return db[_0xa143('0x2f')]['count'](_0x37178b)[_0xa143('0x26')](function(_0x5e2f11){_0x4363b6['count']=_0x5e2f11;if(_0x105396[_0xa143('0x36')][_0xa143('0x43')]){_0x4f1000[_0xa143('0x44')]=[{'all':!![]}];}return db[_0xa143('0x2f')][_0xa143('0x45')](_0x4f1000);})['then'](function(_0x9f650f){_0x4363b6[_0xa143('0x46')]=_0x9f650f;return _0x4363b6;})[_0xa143('0x26')](respondWithFilteredResult(_0x4b1505,_0x4f1000))['catch'](handleError(_0x4b1505,null));};exports[_0xa143('0x47')]=function(_0x4e5901,_0x1f0bd9){var _0x23e732={'raw':![],'where':{'id':_0x4e5901[_0xa143('0x48')]['id']}},_0x2a8828={};_0x2a8828[_0xa143('0x34')]=_[_0xa143('0x35')](db['JscriptyProject'][_0xa143('0x30')]);_0x2a8828[_0xa143('0x36')]=_[_0xa143('0x35')](_0x4e5901['query']);_0x2a8828[_0xa143('0x37')]=_['intersection'](_0x2a8828[_0xa143('0x34')],_0x2a8828[_0xa143('0x36')]);_0x23e732[_0xa143('0x3a')]=_[_0xa143('0x38')](_0x2a8828[_0xa143('0x34')],qs['fields'](_0x4e5901[_0xa143('0x36')]['fields']));_0x23e732[_0xa143('0x3a')]=_0x23e732['attributes'][_0xa143('0x49')]?_0x23e732[_0xa143('0x3a')]:_0x2a8828[_0xa143('0x34')];if(_0x4e5901[_0xa143('0x36')][_0xa143('0x43')]){_0x23e732['include']=[{'all':!![]}];}_0x23e732=_[_0xa143('0x40')]({},_0x23e732,_0x4e5901[_0xa143('0x42')]);return db[_0xa143('0x2f')][_0xa143('0x4a')](_0x23e732)[_0xa143('0x26')](handleEntityNotFound(_0x1f0bd9,null))[_0xa143('0x26')](respondWithResult(_0x1f0bd9,null))['catch'](handleError(_0x1f0bd9,null));};exports[_0xa143('0x4b')]=function(_0x5f5b1b,_0x340392){return db[_0xa143('0x2f')][_0xa143('0x4b')](_0x5f5b1b[_0xa143('0x4c')],{})['then'](function(_0x18a4cf){var _0x27369f=_0x5f5b1b[_0xa143('0x4d')][_0xa143('0x27')]({'plain':!![]});if(!_0x27369f)throw new Error(_0xa143('0x4e'));if(_0x27369f['role']==='user'){var _0xc7db60=_0x18a4cf['get']({'plain':!![]});var _0x1bc17f=_0xa143('0x28');return db['UserProfileSection'][_0xa143('0x4a')]({'where':{'name':_0x1bc17f,'userProfileId':_0x27369f['userProfileId']},'raw':!![]})[_0xa143('0x26')](function(_0x65b782){if(_0x65b782&&_0x65b782[_0xa143('0x4f')]===0x0){return db[_0xa143('0x29')][_0xa143('0x4b')]({'name':_0xc7db60[_0xa143('0x2c')],'resourceId':_0xc7db60['id'],'type':_0x65b782['name'],'sectionId':_0x65b782['id']},{})[_0xa143('0x26')](function(){return _0x18a4cf;});}else{return _0x18a4cf;}})[_0xa143('0x50')](function(_0x48b43b){logger[_0xa143('0x2a')](_0xa143('0x51'),_0x48b43b);throw _0x48b43b;});}return _0x18a4cf;})[_0xa143('0x26')](respondWithResult(_0x340392,0xc9))[_0xa143('0x50')](handleError(_0x340392,null));};exports[_0xa143('0x52')]=function(_0x110e2a,_0x1d71c0){var _0x2728cf={'where':{'id':_0x110e2a[_0xa143('0x48')]['id']}},_0x5ae19e={};_0x5ae19e[_0xa143('0x34')]=_[_0xa143('0x35')](db[_0xa143('0x2f')]['rawAttributes']);_0x2728cf[_0xa143('0x3a')]=_[_0xa143('0x38')](_0x5ae19e[_0xa143('0x34')],qs[_0xa143('0x39')](_0x110e2a[_0xa143('0x36')][_0xa143('0x39')]));_0x2728cf['attributes']=_0x2728cf[_0xa143('0x3a')]['length']?_0x2728cf[_0xa143('0x3a')]:_0x5ae19e[_0xa143('0x34')];if(_0x110e2a[_0xa143('0x36')][_0xa143('0x43')]){_0x2728cf[_0xa143('0x44')]=[{'all':!![]}];}_0x2728cf=_[_0xa143('0x40')]({},_0x2728cf,_0x110e2a[_0xa143('0x42')]);return db[_0xa143('0x2f')][_0xa143('0x4a')](_0x2728cf)['then'](handleEntityNotFound(_0x1d71c0,null))[_0xa143('0x26')](function(_0xa2610d){if(_0xa2610d){var _0x566871=_0xa2610d[_0xa143('0x27')]({'plain':!![]});_0x566871=qs[_0xa143('0x53')](_0x566871,['id',_0xa143('0x54'),_0xa143('0x55')]);_0x110e2a[_0xa143('0x4c')]=_[_0xa143('0x53')](_0x110e2a[_0xa143('0x4c')],['id',_0xa143('0x54'),_0xa143('0x55')]);return db['JscriptyProject'][_0xa143('0x4b')](_[_0xa143('0x40')](_0x566871,_0x110e2a[_0xa143('0x4c')]),{'include':_0x110e2a[_0xa143('0x36')][_0xa143('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x2eb472){var _0x1ccb8c=_0x110e2a[_0xa143('0x4d')][_0xa143('0x27')]({'plain':!![]});if(!_0x1ccb8c)throw new Error(_0xa143('0x4e'));if(_0x1ccb8c[_0xa143('0x56')]===_0xa143('0x4d')){var _0x4229f6=_0x2eb472[_0xa143('0x27')]({'plain':!![]});var _0x11b315='Projects';return db[_0xa143('0x57')][_0xa143('0x4a')]({'where':{'name':_0x11b315,'userProfileId':_0x1ccb8c['userProfileId']},'raw':!![]})[_0xa143('0x26')](function(_0xcf1c08){if(_0xcf1c08&&_0xcf1c08[_0xa143('0x4f')]===0x0){return db[_0xa143('0x29')][_0xa143('0x4b')]({'name':_0x4229f6['name'],'resourceId':_0x4229f6['id'],'type':_0xcf1c08[_0xa143('0x2c')],'sectionId':_0xcf1c08['id']},{})[_0xa143('0x26')](function(){return _0x2eb472;});}else{return _0x2eb472;}})['catch'](function(_0x431b90){logger[_0xa143('0x2a')](_0xa143('0x51'),_0x431b90);throw _0x431b90;});}return _0x2eb472;});}})['then'](respondWithResult(_0x1d71c0,0xc9))[_0xa143('0x50')](handleError(_0x1d71c0,null));};exports['update']=function(_0x1f6e78,_0x12dd6c){if(_0x1f6e78[_0xa143('0x4c')]['id']){delete _0x1f6e78[_0xa143('0x4c')]['id'];}return db[_0xa143('0x2f')][_0xa143('0x4a')]({'where':{'id':_0x1f6e78['params']['id']}})[_0xa143('0x26')](handleEntityNotFound(_0x12dd6c,null))[_0xa143('0x26')](saveUpdates(_0x1f6e78['body'],null))[_0xa143('0x26')](respondWithResult(_0x12dd6c,null))[_0xa143('0x50')](handleError(_0x12dd6c,null));};exports[_0xa143('0x25')]=function(_0x117028,_0x1af5c0){return db[_0xa143('0x2f')]['find']({'where':{'id':_0x117028[_0xa143('0x48')]['id']}})[_0xa143('0x26')](handleEntityNotFound(_0x1af5c0,null))[_0xa143('0x26')](removeEntity(_0x1af5c0,null))[_0xa143('0x50')](handleError(_0x1af5c0,null));};exports[_0xa143('0x58')]=function(_0x37ca1f,_0x51add7,_0xaed815){var _0x415f8f={'raw':!![],'where':{}};var _0x5cda88={};var _0xbdc66b={'count':0x0,'rows':[]};return db[_0xa143('0x2f')]['findOne']({'where':{'id':_0x37ca1f[_0xa143('0x48')]['id']}})[_0xa143('0x26')](handleEntityNotFound(_0x51add7,null))[_0xa143('0x26')](function(_0x1076b2){if(_0x1076b2){_0x5cda88[_0xa143('0x34')]=_[_0xa143('0x35')](db[_0xa143('0x59')][_0xa143('0x30')]);_0x5cda88[_0xa143('0x36')]=_[_0xa143('0x35')](_0x37ca1f[_0xa143('0x36')]);_0x5cda88['filters']=_['intersection'](_0x5cda88[_0xa143('0x34')],_0x5cda88[_0xa143('0x36')]);_0x415f8f[_0xa143('0x3a')]=_[_0xa143('0x38')](_0x5cda88[_0xa143('0x34')],qs[_0xa143('0x39')](_0x37ca1f[_0xa143('0x36')][_0xa143('0x39')]));_0x415f8f[_0xa143('0x3a')]=_0x415f8f['attributes']['length']?_0x415f8f['attributes']:_0x5cda88[_0xa143('0x34')];if(!_0x37ca1f[_0xa143('0x36')][_0xa143('0x3b')](_0xa143('0x3c'))){_0x415f8f[_0xa143('0x20')]=qs[_0xa143('0x20')](_0x37ca1f[_0xa143('0x36')][_0xa143('0x20')]);_0x415f8f['offset']=qs['offset'](_0x37ca1f[_0xa143('0x36')][_0xa143('0x1e')]);}_0x415f8f[_0xa143('0x5a')]=qs[_0xa143('0x3d')](_0x37ca1f[_0xa143('0x36')][_0xa143('0x3d')]);_0x415f8f[_0xa143('0x3e')]=qs['filters'](_[_0xa143('0x5b')](_0x37ca1f['query'],_0x5cda88[_0xa143('0x37')]));_0x415f8f['where'][_0xa143('0x5c')]=_0x1076b2['id'];if(_0x37ca1f['query'][_0xa143('0x3f')]){_0x415f8f[_0xa143('0x3e')]=_[_0xa143('0x40')](_0x415f8f[_0xa143('0x3e')],{'$or':_[_0xa143('0x2e')](_0x415f8f[_0xa143('0x3a')],function(_0x6443dd){var _0x406f9a={};_0x406f9a[_0x6443dd]={'$like':'%'+_0x37ca1f[_0xa143('0x36')]['filter']+'%'};return _0x406f9a;})});}_0x415f8f=_['merge']({},_0x415f8f,_0x37ca1f[_0xa143('0x42')]);return db[_0xa143('0x59')]['count']({'where':_0x415f8f[_0xa143('0x3e')]})[_0xa143('0x26')](function(_0x1c94b9){_0xbdc66b[_0xa143('0x5d')]=_0x1c94b9;if(_0x37ca1f[_0xa143('0x36')][_0xa143('0x43')]){_0x415f8f['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xa143('0x45')](_0x415f8f);})[_0xa143('0x26')](function(_0x46a627){_0xbdc66b[_0xa143('0x46')]=_0x46a627;return _0xbdc66b;});}})['then'](respondWithFilteredResult(_0x51add7,_0x415f8f))[_0xa143('0x50')](handleError(_0x51add7,null));};exports[_0xa143('0x5e')]=function(_0x536261,_0xe2dbc1,_0x5f15c3){var _0x2fed93={'raw':!![],'where':{}};var _0x4c9a69={};var _0x36f159={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xa143('0x5f')]({'where':{'id':_0x536261[_0xa143('0x48')]['id']}})[_0xa143('0x26')](handleEntityNotFound(_0xe2dbc1,null))[_0xa143('0x26')](function(_0xf80dbd){if(_0xf80dbd){_0x4c9a69[_0xa143('0x34')]=_['keys'](db[_0xa143('0x60')]['rawAttributes']);_0x4c9a69[_0xa143('0x36')]=_[_0xa143('0x35')](_0x536261[_0xa143('0x36')]);_0x4c9a69[_0xa143('0x37')]=_[_0xa143('0x38')](_0x4c9a69[_0xa143('0x34')],_0x4c9a69[_0xa143('0x36')]);_0x2fed93[_0xa143('0x3a')]=_[_0xa143('0x38')](_0x4c9a69['model'],qs['fields'](_0x536261[_0xa143('0x36')]['fields']));_0x2fed93[_0xa143('0x3a')]=_0x2fed93[_0xa143('0x3a')][_0xa143('0x49')]?_0x2fed93[_0xa143('0x3a')]:_0x4c9a69[_0xa143('0x34')];if(!_0x536261[_0xa143('0x36')][_0xa143('0x3b')](_0xa143('0x3c'))){_0x2fed93[_0xa143('0x20')]=qs[_0xa143('0x20')](_0x536261[_0xa143('0x36')][_0xa143('0x20')]);_0x2fed93[_0xa143('0x1e')]=qs['offset'](_0x536261[_0xa143('0x36')][_0xa143('0x1e')]);}_0x2fed93[_0xa143('0x5a')]=qs[_0xa143('0x3d')](_0x536261[_0xa143('0x36')]['sort']);_0x2fed93[_0xa143('0x3e')]=qs[_0xa143('0x37')](_[_0xa143('0x5b')](_0x536261[_0xa143('0x36')],_0x4c9a69['filters']));_0x2fed93[_0xa143('0x3e')][_0xa143('0x5c')]=_0xf80dbd['id'];if(_0x536261[_0xa143('0x36')][_0xa143('0x3f')]){_0x2fed93[_0xa143('0x3e')]=_[_0xa143('0x40')](_0x2fed93[_0xa143('0x3e')],{'$or':_[_0xa143('0x2e')](_0x2fed93[_0xa143('0x3a')],function(_0x3c0a1e){var _0x4a99d6={};_0x4a99d6[_0x3c0a1e]={'$like':'%'+_0x536261['query']['filter']+'%'};return _0x4a99d6;})});}_0x2fed93=_['merge']({},_0x2fed93,_0x536261[_0xa143('0x42')]);return db[_0xa143('0x60')]['count']({'where':_0x2fed93[_0xa143('0x3e')]})[_0xa143('0x26')](function(_0xd672fe){_0x36f159[_0xa143('0x5d')]=_0xd672fe;if(_0x536261['query']['includeAll']){_0x2fed93['include']=[{'all':!![]}];}return db[_0xa143('0x60')][_0xa143('0x45')](_0x2fed93);})['then'](function(_0x3b8900){_0x36f159[_0xa143('0x46')]=_0x3b8900;return _0x36f159;});}})[_0xa143('0x26')](respondWithFilteredResult(_0xe2dbc1,_0x2fed93))[_0xa143('0x50')](handleError(_0xe2dbc1,null));};function char(_0x2d6916){return _0xa143('0x61')===typeof _0x2d6916?String[_0xa143('0x62')][_0xa143('0x22')](null,arguments):_0x2d6916;}function needsEncapsulation(_0x3f4ad2){return!!_0x3f4ad2&&(_0x3f4ad2[_0xa143('0x63')]()[_0xa143('0x64')](char(0xd))>=0x0||_0x3f4ad2[_0xa143('0x63')]()['indexOf'](char(0xa))>=0x0||_0x3f4ad2['toString']()[_0xa143('0x64')](char(0x2c))>=0x0||_0x3f4ad2[_0xa143('0x63')]()[_0xa143('0x64')](char(0x22))>=0x0);}function encapsulate(_0x5555ac){var _0x2a3d88=char(0x22),_0x189cc7='\x5c'+char(0x22),_0x4c1c04=_0x5555ac[_0xa143('0x63')]()[_0xa143('0x65')](new RegExp(_0x2a3d88,'g'),_0x189cc7);return _0x2a3d88+_0x4c1c04+_0x2a3d88;}exports[_0xa143('0x66')]=function(_0x4b49c5,_0x2c35ab,_0x8b535){var _0x2f56b2,_0x251887;var _0x333447={'where':{'ProjectId':_0x4b49c5[_0xa143('0x48')]['id']}};if(_0x4b49c5[_0xa143('0x36')]['startTime']){_0x333447[_0xa143('0x3e')][_0xa143('0x67')]=JSON[_0xa143('0x68')](_0x4b49c5[_0xa143('0x36')][_0xa143('0x69')]);}return db[_0xa143('0x59')][_0xa143('0x45')](_0x333447)[_0xa143('0x26')](handleEntityNotFound(_0x2c35ab,null))['then'](function(_0x602403){if(_0x602403){_0x2f56b2=_0x602403;return db[_0xa143('0x6a')][_0xa143('0x45')]({'where':{'SessionId':{'$in':_[_0xa143('0x2e')](_0x2f56b2,'id')},'ProjectId':_0x4b49c5['params']['id']},'order':_0xa143('0x6b')});}})[_0xa143('0x26')](handleEntityNotFound(_0x2c35ab,null))[_0xa143('0x26')](function(_0x3c01ed){if(_0x3c01ed){_0x251887=_0x3c01ed;var _0x235f9b={};for(var _0x483e80=0x0,_0x6e9fd1=_0x251887[_0xa143('0x49')];_0x483e80<_0x6e9fd1;_0x483e80++){if(!_0x235f9b[_0xa143('0x3b')](_0x251887[_0x483e80][_0xa143('0x6c')])){_0x235f9b[_0x251887[_0x483e80][_0xa143('0x6c')]]=needsEncapsulation(_0x251887[_0x483e80][_0xa143('0x6d')])?encapsulate(_0x251887[_0x483e80][_0xa143('0x6d')]):_0x251887[_0x483e80][_0xa143('0x6d')];}}var _0x3a38ef=[],_0x1b0798={};for(var _0xfdd855=0x0,_0x15ea8c=_0x2f56b2[_0xa143('0x49')];_0xfdd855<_0x15ea8c;_0xfdd855++){_0x1b0798={'ProjectId':_0x4b49c5['params']['id'],'SessionId':_0x2f56b2[_0xfdd855]['id'],'StartTime':moment(_0x2f56b2[_0xfdd855][_0xa143('0x67')])[_0xa143('0x6e')](_0xa143('0x6f'))};for(var _0x2825ba=0x0,_0x398b76=_0x251887[_0xa143('0x49')];_0x2825ba<_0x398b76;_0x2825ba++){if(_0x251887[_0x2825ba][_0xa143('0x70')]==_0x2f56b2[_0xfdd855]['id']&&_0x235f9b[_0xa143('0x3b')](_0x251887[_0x2825ba][_0xa143('0x6c')])){_0x1b0798[_0x235f9b[_0x251887[_0x2825ba][_0xa143('0x6c')]]]=_0x251887[_0x2825ba][_0xa143('0x71')];}}for(var _0x4a0d09 in _0x235f9b){if(!_0x1b0798[_0xa143('0x3b')](_0x235f9b[_0x4a0d09])){_0x1b0798[_0x235f9b[_0x4a0d09]]=null;}}_0x3a38ef['push'](_0x1b0798);}return _0x3a38ef;}})[_0xa143('0x26')](function(_0x25b2fe){if(!_[_0xa143('0x72')](_0x25b2fe)){var _0x104678=toCsv(_0x25b2fe);var _0x282114=Date[_0xa143('0x73')]();fs[_0xa143('0x74')](util['format'](_0xa143('0x75'),_0x4b49c5['params']['id'],_0x282114),_0x104678);_0x2c35ab[_0xa143('0x76')](_0xa143('0x77'),'attachment;\x20filename='+util[_0xa143('0x6e')](_0xa143('0x78'),_0x4b49c5[_0xa143('0x48')]['id'],_0x282114));_0x2c35ab[_0xa143('0x76')](_0xa143('0x79'),_0xa143('0x7a'));return _0x2c35ab[_0xa143('0x7b')](util[_0xa143('0x6e')](_0xa143('0x75'),_0x4b49c5[_0xa143('0x48')]['id'],_0x282114));}else{return _0x2c35ab[_0xa143('0x1a')](0xcc);}})[_0xa143('0x50')](handleError(_0x2c35ab,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index cc195a1..60e259c 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 _0x2208=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x2740ae,_0x40ddda){var _0x3a640c=function(_0x2a29e6){while(--_0x2a29e6){_0x2740ae['push'](_0x2740ae['shift']());}};_0x3a640c(++_0x40ddda);}(_0x2208,0x11e));var _0x8220=function(_0x182256,_0x181956){_0x182256=_0x182256-0x0;var _0x1b9cfd=_0x2208[_0x182256];return _0x1b9cfd;};'use strict';var _=require('lodash');var util=require(_0x8220('0x0'));var logger=require('../../config/logger')(_0x8220('0x1'));var moment=require('moment');var BPromise=require(_0x8220('0x2'));var rp=require(_0x8220('0x3'));var fs=require('fs');var path=require(_0x8220('0x4'));var rimraf=require(_0x8220('0x5'));var config=require(_0x8220('0x6'));var attributes=require(_0x8220('0x7'));module['exports']=function(_0x31a112,_0x4dd1a0){return _0x31a112[_0x8220('0x8')](_0x8220('0x9'),attributes,{'tableName':_0x8220('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0f=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyProject.attributes'];(function(_0x217523,_0x5d793a){var _0x43e3e1=function(_0x477f77){while(--_0x477f77){_0x217523['push'](_0x217523['shift']());}};_0x43e3e1(++_0x5d793a);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x41b109,_0x3f1365){_0x41b109=_0x41b109-0x0;var _0x440653=_0x8e0f[_0x41b109];return _0x440653;};'use strict';var _=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var logger=require(_0xf8e0('0x2'))(_0xf8e0('0x3'));var moment=require(_0xf8e0('0x4'));var BPromise=require(_0xf8e0('0x5'));var rp=require(_0xf8e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e0('0x7'));var config=require('../../config/environment');var attributes=require(_0xf8e0('0x8'));module[_0xf8e0('0x9')]=function(_0x4f3b30,_0x2921b3){return _0x4f3b30[_0xf8e0('0xa')](_0xf8e0('0xb'),attributes,{'tableName':_0xf8e0('0xc'),'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 99efa58..fd39e09 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xda3f,0xec));var _0xfda3=function(_0x267858,_0x1268dc){_0x267858=_0x267858-0x0;var _0x580259=_0xda3f[_0x267858];return _0x580259;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x27a8af,_0x4f7e9e){var _0x25050f=function(_0x9d4451){while(--_0x9d4451){_0x27a8af['push'](_0x27a8af['shift']());}};_0x25050f(++_0x4f7e9e);}(_0x70e0,0x17b));var _0x070e=function(_0xc4141a,_0x2ca194){_0xc4141a=_0xc4141a-0x0;var _0x656668=_0x70e0[_0xc4141a];return _0x656668;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 28b64c0..9c6dce0 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 _0x0a00=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','isAuthenticated','/:id','show','post','create','update','destroy'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x0a00,0x105));var _0x00a0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x0a00[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x00a0('0x0'));var util=require(_0x00a0('0x1'));var path=require(_0x00a0('0x2'));var timeout=require(_0x00a0('0x3'));var express=require(_0x00a0('0x4'));var router=express[_0x00a0('0x5')]();var fs_extra=require(_0x00a0('0x6'));var auth=require(_0x00a0('0x7'));var interaction=require(_0x00a0('0x8'));var config=require('../../config/environment');var controller=require(_0x00a0('0x9'));router[_0x00a0('0xa')]('/',auth['isAuthenticated'](),controller[_0x00a0('0xb')]);router[_0x00a0('0xa')]('/describe',auth[_0x00a0('0xc')](),controller['describe']);router[_0x00a0('0xa')](_0x00a0('0xd'),auth[_0x00a0('0xc')](),controller[_0x00a0('0xe')]);router[_0x00a0('0xf')]('/',auth[_0x00a0('0xc')](),controller[_0x00a0('0x10')]);router['put'](_0x00a0('0xd'),auth[_0x00a0('0xc')](),controller[_0x00a0('0x11')]);router['delete'](_0x00a0('0xd'),auth[_0x00a0('0xc')](),controller[_0x00a0('0x12')]);module[_0x00a0('0x13')]=router; \ No newline at end of file +var _0x507d=['get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x1b8e24,_0x1dbcd0){var _0x44b6b3=function(_0x32199e){while(--_0x32199e){_0x1b8e24['push'](_0x1b8e24['shift']());}};_0x44b6b3(++_0x1dbcd0);}(_0x507d,0xde));var _0xd507=function(_0x4a7736,_0x5bc5fa){_0x4a7736=_0x4a7736-0x0;var _0x48f09a=_0x507d[_0x4a7736];return _0x48f09a;};'use strict';var multer=require(_0xd507('0x0'));var util=require(_0xd507('0x1'));var path=require(_0xd507('0x2'));var timeout=require(_0xd507('0x3'));var express=require('express');var router=express[_0xd507('0x4')]();var fs_extra=require(_0xd507('0x5'));var auth=require(_0xd507('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd507('0x7'));var controller=require(_0xd507('0x8'));router[_0xd507('0x9')]('/',auth[_0xd507('0xa')](),controller[_0xd507('0xb')]);router[_0xd507('0x9')](_0xd507('0xc'),auth[_0xd507('0xa')](),controller['describe']);router[_0xd507('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd507('0xd')]);router[_0xd507('0xe')]('/',auth['isAuthenticated'](),controller[_0xd507('0xf')]);router[_0xd507('0x10')](_0xd507('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xd507('0x12')](_0xd507('0x11'),auth[_0xd507('0xa')](),controller[_0xd507('0x13')]);module[_0xd507('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index fb73c57..ac15d41 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0xc82342,_0x5837bd){_0xc82342=_0xc82342-0x0;var _0x2f73e4=_0x7a54[_0xc82342];return _0x2f73e4;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x4ef4e5,_0x248fe7){_0x4ef4e5=_0x4ef4e5-0x0;var _0x192cfa=_0x7a54[_0x4ef4e5];return _0x192cfa;};'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 5c3f440..2dae7e0 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 _0x4328=['offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5c61cd,_0x3604d1){var _0x5bcae2=function(_0x3cc095){while(--_0x3cc095){_0x5c61cd['push'](_0x5c61cd['shift']());}};_0x5bcae2(++_0x3604d1);}(_0x4328,0xc0));var _0x8432=function(_0x15b44a,_0x243f93){_0x15b44a=_0x15b44a-0x0;var _0x2ea275=_0x4328[_0x15b44a];return _0x2ea275;};'use strict';var emlformat=require(_0x8432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8432('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8432('0x2'));var moment=require(_0x8432('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8432('0x4'));var util=require('util');var path=require(_0x8432('0x5'));var sox=require(_0x8432('0x6'));var csv=require('to-csv');var ejs=require(_0x8432('0x7'));var fs=require('fs');var fs_extra=require(_0x8432('0x8'));var _=require(_0x8432('0x9'));var squel=require(_0x8432('0xa'));var crypto=require(_0x8432('0xb'));var jsforce=require(_0x8432('0xc'));var deskjs=require(_0x8432('0xd'));var toCsv=require(_0x8432('0xe'));var querystring=require(_0x8432('0xf'));var Papa=require(_0x8432('0x10'));var Redis=require(_0x8432('0x11'));var authService=require(_0x8432('0x12'));var qs=require(_0x8432('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8432('0x14'));var utils=require('../../config/utils');var config=require(_0x8432('0x15'));var licenseUtil=require(_0x8432('0x16'));var db=require(_0x8432('0x17'))['db'];function respondWithStatusCode(_0x1ce033,_0x21120f){_0x21120f=_0x21120f||0xcc;return function(_0x48e73d){if(_0x48e73d){return _0x1ce033[_0x8432('0x18')](_0x21120f);}return _0x1ce033[_0x8432('0x19')](_0x21120f)['end']();};}function respondWithResult(_0x1b4d5f,_0x4ee9e4){_0x4ee9e4=_0x4ee9e4||0xc8;return function(_0x4fc64b){if(_0x4fc64b){return _0x1b4d5f[_0x8432('0x19')](_0x4ee9e4)[_0x8432('0x1a')](_0x4fc64b);}};}function respondWithFilteredResult(_0x256655,_0x5e6a37){return function(_0x409330){if(_0x409330){var _0x110eb4=typeof _0x5e6a37[_0x8432('0x1b')]===_0x8432('0x1c')&&typeof _0x5e6a37[_0x8432('0x1d')]===_0x8432('0x1c');var _0x1d95b7=_0x409330[_0x8432('0x1e')];var _0x594731=_0x110eb4?0x0:_0x5e6a37[_0x8432('0x1b')];var _0x5737b7=_0x110eb4?_0x409330[_0x8432('0x1e')]:_0x5e6a37[_0x8432('0x1b')]+_0x5e6a37[_0x8432('0x1d')];var _0x46fc0d;if(_0x5737b7>=_0x1d95b7){_0x5737b7=_0x1d95b7;_0x46fc0d=0xc8;}else{_0x46fc0d=0xce;}_0x256655[_0x8432('0x19')](_0x46fc0d);return _0x256655[_0x8432('0x1f')](_0x8432('0x20'),_0x594731+'-'+_0x5737b7+'/'+_0x1d95b7)[_0x8432('0x1a')](_0x409330);}return null;};}function patchUpdates(_0x62a05c){return function(_0x1ec30a){try{jsonpatch[_0x8432('0x21')](_0x1ec30a,_0x62a05c,!![]);}catch(_0x457bde){return BPromise['reject'](_0x457bde);}return _0x1ec30a[_0x8432('0x22')]();};}function saveUpdates(_0x40d08d,_0x2800f0){return function(_0x56c029){if(_0x56c029){return _0x56c029[_0x8432('0x23')](_0x40d08d)['then'](function(_0x49b026){return _0x49b026;});}return null;};}function removeEntity(_0x2286ad,_0x5f179f){return function(_0x3f7f46){if(_0x3f7f46){return _0x3f7f46[_0x8432('0x24')]()[_0x8432('0x25')](function(){_0x2286ad[_0x8432('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3858c7,_0x1c931c){return function(_0x411008){if(!_0x411008){_0x3858c7[_0x8432('0x18')](0x194);}return _0x411008;};}function handleError(_0x5a968e,_0x4a9590){_0x4a9590=_0x4a9590||0x1f4;return function(_0x4fe69a){logger[_0x8432('0x26')](_0x4fe69a['stack']);if(_0x4fe69a[_0x8432('0x27')]){delete _0x4fe69a[_0x8432('0x27')];}_0x5a968e[_0x8432('0x19')](_0x4a9590)['send'](_0x4fe69a);};}exports[_0x8432('0x28')]=function(_0x9990e3,_0x119079){var _0x393212={},_0x5bc2a0={},_0x2e4ef3={'count':0x0,'rows':[]};var _0x372bae=_[_0x8432('0x29')](db[_0x8432('0x2a')][_0x8432('0x2b')],function(_0x4ff4aa){return{'name':_0x4ff4aa[_0x8432('0x2c')],'type':_0x4ff4aa[_0x8432('0x2d')][_0x8432('0x2e')]};});_0x5bc2a0[_0x8432('0x2f')]=_[_0x8432('0x29')](_0x372bae,_0x8432('0x27'));_0x5bc2a0[_0x8432('0x30')]=_[_0x8432('0x31')](_0x9990e3[_0x8432('0x30')]);_0x5bc2a0[_0x8432('0x32')]=_[_0x8432('0x33')](_0x5bc2a0[_0x8432('0x2f')],_0x5bc2a0['query']);_0x393212[_0x8432('0x34')]=_['intersection'](_0x5bc2a0[_0x8432('0x2f')],qs[_0x8432('0x35')](_0x9990e3[_0x8432('0x30')]['fields']));_0x393212[_0x8432('0x34')]=_0x393212[_0x8432('0x34')]['length']?_0x393212['attributes']:_0x5bc2a0[_0x8432('0x2f')];if(!_0x9990e3[_0x8432('0x30')][_0x8432('0x36')](_0x8432('0x37'))){_0x393212[_0x8432('0x1d')]=qs[_0x8432('0x1d')](_0x9990e3[_0x8432('0x30')][_0x8432('0x1d')]);_0x393212[_0x8432('0x1b')]=qs[_0x8432('0x1b')](_0x9990e3[_0x8432('0x30')][_0x8432('0x1b')]);}_0x393212[_0x8432('0x38')]=qs[_0x8432('0x39')](_0x9990e3[_0x8432('0x30')]['sort']);_0x393212[_0x8432('0x3a')]=qs[_0x8432('0x32')](_[_0x8432('0x3b')](_0x9990e3['query'],_0x5bc2a0[_0x8432('0x32')]),_0x372bae);if(_0x9990e3[_0x8432('0x30')][_0x8432('0x3c')]){_0x393212[_0x8432('0x3a')]=_[_0x8432('0x3d')](_0x393212[_0x8432('0x3a')],{'$or':_[_0x8432('0x29')](_0x372bae,function(_0x3713f7){if(_0x3713f7[_0x8432('0x2d')]!=='VIRTUAL'){var _0x4e531b={};_0x4e531b[_0x3713f7['name']]={'$like':'%'+_0x9990e3['query']['filter']+'%'};return _0x4e531b;}})});}_0x393212=_['merge']({},_0x393212,_0x9990e3['options']);var _0x499a84={'where':_0x393212[_0x8432('0x3a')]};return db['JscriptyQuestionReport'][_0x8432('0x1e')](_0x499a84)['then'](function(_0x527304){_0x2e4ef3[_0x8432('0x1e')]=_0x527304;if(_0x9990e3['query'][_0x8432('0x3e')]){_0x393212[_0x8432('0x3f')]=[{'all':!![]}];}return db[_0x8432('0x2a')][_0x8432('0x40')](_0x393212);})[_0x8432('0x25')](function(_0x2d5715){_0x2e4ef3[_0x8432('0x41')]=_0x2d5715;return _0x2e4ef3;})[_0x8432('0x25')](respondWithFilteredResult(_0x119079,_0x393212))[_0x8432('0x42')](handleError(_0x119079,null));};exports['show']=function(_0x239067,_0x1c2f68){var _0x27950f={'raw':!![],'where':{'id':_0x239067[_0x8432('0x43')]['id']}},_0x46392c={};_0x46392c[_0x8432('0x2f')]=_[_0x8432('0x31')](db[_0x8432('0x2a')][_0x8432('0x2b')]);_0x46392c[_0x8432('0x30')]=_[_0x8432('0x31')](_0x239067['query']);_0x46392c[_0x8432('0x32')]=_['intersection'](_0x46392c[_0x8432('0x2f')],_0x46392c['query']);_0x27950f['attributes']=_[_0x8432('0x33')](_0x46392c[_0x8432('0x2f')],qs[_0x8432('0x35')](_0x239067[_0x8432('0x30')][_0x8432('0x35')]));_0x27950f[_0x8432('0x34')]=_0x27950f['attributes'][_0x8432('0x44')]?_0x27950f[_0x8432('0x34')]:_0x46392c[_0x8432('0x2f')];if(_0x239067[_0x8432('0x30')][_0x8432('0x3e')]){_0x27950f['include']=[{'all':!![]}];}_0x27950f=_[_0x8432('0x3d')]({},_0x27950f,_0x239067['options']);return db[_0x8432('0x2a')][_0x8432('0x45')](_0x27950f)['then'](handleEntityNotFound(_0x1c2f68,null))[_0x8432('0x25')](respondWithResult(_0x1c2f68,null))[_0x8432('0x42')](handleError(_0x1c2f68,null));};exports[_0x8432('0x46')]=function(_0x2f2d55,_0x5dc2bc){return db[_0x8432('0x2a')][_0x8432('0x46')](_0x2f2d55[_0x8432('0x47')],{})[_0x8432('0x25')](respondWithResult(_0x5dc2bc,0xc9))[_0x8432('0x42')](handleError(_0x5dc2bc,null));};exports[_0x8432('0x23')]=function(_0x3a5343,_0x261fb2){if(_0x3a5343[_0x8432('0x47')]['id']){delete _0x3a5343[_0x8432('0x47')]['id'];}return db[_0x8432('0x2a')][_0x8432('0x45')]({'where':{'id':_0x3a5343[_0x8432('0x43')]['id']}})[_0x8432('0x25')](handleEntityNotFound(_0x261fb2,null))['then'](saveUpdates(_0x3a5343[_0x8432('0x47')],null))[_0x8432('0x25')](respondWithResult(_0x261fb2,null))['catch'](handleError(_0x261fb2,null));};exports['destroy']=function(_0x1956b6,_0x5b6a45){return db['JscriptyQuestionReport'][_0x8432('0x45')]({'where':{'id':_0x1956b6['params']['id']}})[_0x8432('0x25')](handleEntityNotFound(_0x5b6a45,null))['then'](removeEntity(_0x5b6a45,null))[_0x8432('0x42')](handleError(_0x5b6a45,null));};exports[_0x8432('0x48')]=function(_0x1a77c8,_0x5ef01b){return db[_0x8432('0x2a')]['describe']()[_0x8432('0x25')](respondWithResult(_0x5ef01b,null))['catch'](handleError(_0x5ef01b,null));}; \ No newline at end of file +var _0xdf93=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x376679,_0x5ce09e){var _0xae73e9=function(_0x4bba87){while(--_0x4bba87){_0x376679['push'](_0x376679['shift']());}};_0xae73e9(++_0x5ce09e);}(_0xdf93,0x80));var _0x3df9=function(_0x594f9a,_0x479270){_0x594f9a=_0x594f9a-0x0;var _0x35bf46=_0xdf93[_0x594f9a];return _0x35bf46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3df9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3df9('0x1'));var rp=require(_0x3df9('0x2'));var moment=require(_0x3df9('0x3'));var BPromise=require(_0x3df9('0x4'));var Mustache=require(_0x3df9('0x5'));var util=require(_0x3df9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3df9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3df9('0x8'));var _=require(_0x3df9('0x9'));var squel=require('squel');var crypto=require(_0x3df9('0xa'));var jsforce=require(_0x3df9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3df9('0x7'));var querystring=require('querystring');var Papa=require(_0x3df9('0xc'));var Redis=require(_0x3df9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3df9('0xe'));var as=require(_0x3df9('0xf'));var hardwareService=require(_0x3df9('0x10'));var logger=require(_0x3df9('0x11'))(_0x3df9('0x12'));var utils=require(_0x3df9('0x13'));var config=require(_0x3df9('0x14'));var licenseUtil=require(_0x3df9('0x15'));var db=require(_0x3df9('0x16'))['db'];function respondWithStatusCode(_0x5bc07d,_0x10e1f0){_0x10e1f0=_0x10e1f0||0xcc;return function(_0x5a570c){if(_0x5a570c){return _0x5bc07d[_0x3df9('0x17')](_0x10e1f0);}return _0x5bc07d[_0x3df9('0x18')](_0x10e1f0)['end']();};}function respondWithResult(_0x133950,_0x347092){_0x347092=_0x347092||0xc8;return function(_0x1f2a51){if(_0x1f2a51){return _0x133950['status'](_0x347092)[_0x3df9('0x19')](_0x1f2a51);}};}function respondWithFilteredResult(_0x3b4a97,_0x1110b0){return function(_0x4ff44d){if(_0x4ff44d){var _0x36cca3=typeof _0x1110b0[_0x3df9('0x1a')]===_0x3df9('0x1b')&&typeof _0x1110b0[_0x3df9('0x1c')]===_0x3df9('0x1b');var _0x1f7d46=_0x4ff44d[_0x3df9('0x1d')];var _0x59a734=_0x36cca3?0x0:_0x1110b0[_0x3df9('0x1a')];var _0x2fb5c6=_0x36cca3?_0x4ff44d[_0x3df9('0x1d')]:_0x1110b0[_0x3df9('0x1a')]+_0x1110b0[_0x3df9('0x1c')];var _0x5ae632;if(_0x2fb5c6>=_0x1f7d46){_0x2fb5c6=_0x1f7d46;_0x5ae632=0xc8;}else{_0x5ae632=0xce;}_0x3b4a97[_0x3df9('0x18')](_0x5ae632);return _0x3b4a97[_0x3df9('0x1e')](_0x3df9('0x1f'),_0x59a734+'-'+_0x2fb5c6+'/'+_0x1f7d46)[_0x3df9('0x19')](_0x4ff44d);}return null;};}function patchUpdates(_0x49cff6){return function(_0x52e1aa){try{jsonpatch[_0x3df9('0x20')](_0x52e1aa,_0x49cff6,!![]);}catch(_0x294a5b){return BPromise[_0x3df9('0x21')](_0x294a5b);}return _0x52e1aa[_0x3df9('0x22')]();};}function saveUpdates(_0x55bfd9,_0x195c94){return function(_0x313179){if(_0x313179){return _0x313179[_0x3df9('0x23')](_0x55bfd9)[_0x3df9('0x24')](function(_0x5eb6b3){return _0x5eb6b3;});}return null;};}function removeEntity(_0x174a98,_0x14b378){return function(_0x329c4d){if(_0x329c4d){return _0x329c4d[_0x3df9('0x25')]()[_0x3df9('0x24')](function(){_0x174a98['status'](0xcc)[_0x3df9('0x26')]();});}};}function handleEntityNotFound(_0x4aab42,_0x1585ac){return function(_0x16021a){if(!_0x16021a){_0x4aab42['sendStatus'](0x194);}return _0x16021a;};}function handleError(_0x37cd27,_0x5797a1){_0x5797a1=_0x5797a1||0x1f4;return function(_0x2413cf){logger[_0x3df9('0x27')](_0x2413cf[_0x3df9('0x28')]);if(_0x2413cf['name']){delete _0x2413cf[_0x3df9('0x29')];}_0x37cd27['status'](_0x5797a1)[_0x3df9('0x2a')](_0x2413cf);};}exports[_0x3df9('0x2b')]=function(_0x1d18bf,_0x1d8409){var _0x45183c={},_0x51df45={},_0xcba5d9={'count':0x0,'rows':[]};var _0x360f8a=_[_0x3df9('0x2c')](db[_0x3df9('0x2d')][_0x3df9('0x2e')],function(_0x4739de){return{'name':_0x4739de['fieldName'],'type':_0x4739de[_0x3df9('0x2f')][_0x3df9('0x30')]};});_0x51df45[_0x3df9('0x31')]=_[_0x3df9('0x2c')](_0x360f8a,_0x3df9('0x29'));_0x51df45[_0x3df9('0x32')]=_['keys'](_0x1d18bf['query']);_0x51df45[_0x3df9('0x33')]=_[_0x3df9('0x34')](_0x51df45[_0x3df9('0x31')],_0x51df45[_0x3df9('0x32')]);_0x45183c[_0x3df9('0x35')]=_[_0x3df9('0x34')](_0x51df45[_0x3df9('0x31')],qs[_0x3df9('0x36')](_0x1d18bf[_0x3df9('0x32')][_0x3df9('0x36')]));_0x45183c['attributes']=_0x45183c[_0x3df9('0x35')][_0x3df9('0x37')]?_0x45183c[_0x3df9('0x35')]:_0x51df45['model'];if(!_0x1d18bf[_0x3df9('0x32')]['hasOwnProperty'](_0x3df9('0x38'))){_0x45183c[_0x3df9('0x1c')]=qs[_0x3df9('0x1c')](_0x1d18bf[_0x3df9('0x32')][_0x3df9('0x1c')]);_0x45183c[_0x3df9('0x1a')]=qs[_0x3df9('0x1a')](_0x1d18bf['query']['offset']);}_0x45183c[_0x3df9('0x39')]=qs[_0x3df9('0x3a')](_0x1d18bf[_0x3df9('0x32')][_0x3df9('0x3a')]);_0x45183c[_0x3df9('0x3b')]=qs[_0x3df9('0x33')](_[_0x3df9('0x3c')](_0x1d18bf['query'],_0x51df45['filters']),_0x360f8a);if(_0x1d18bf[_0x3df9('0x32')][_0x3df9('0x3d')]){_0x45183c[_0x3df9('0x3b')]=_[_0x3df9('0x3e')](_0x45183c[_0x3df9('0x3b')],{'$or':_[_0x3df9('0x2c')](_0x360f8a,function(_0x4c5d1f){if(_0x4c5d1f[_0x3df9('0x2f')]!==_0x3df9('0x3f')){var _0x1b134d={};_0x1b134d[_0x4c5d1f['name']]={'$like':'%'+_0x1d18bf['query'][_0x3df9('0x3d')]+'%'};return _0x1b134d;}})});}_0x45183c=_[_0x3df9('0x3e')]({},_0x45183c,_0x1d18bf[_0x3df9('0x40')]);var _0x47dc69={'where':_0x45183c['where']};return db[_0x3df9('0x2d')][_0x3df9('0x1d')](_0x47dc69)[_0x3df9('0x24')](function(_0x3d367b){_0xcba5d9[_0x3df9('0x1d')]=_0x3d367b;if(_0x1d18bf[_0x3df9('0x32')][_0x3df9('0x41')]){_0x45183c[_0x3df9('0x42')]=[{'all':!![]}];}return db[_0x3df9('0x2d')][_0x3df9('0x43')](_0x45183c);})['then'](function(_0x15c67a){_0xcba5d9[_0x3df9('0x44')]=_0x15c67a;return _0xcba5d9;})[_0x3df9('0x24')](respondWithFilteredResult(_0x1d8409,_0x45183c))[_0x3df9('0x45')](handleError(_0x1d8409,null));};exports[_0x3df9('0x46')]=function(_0x22e61c,_0x10647a){var _0x17e34e={'raw':!![],'where':{'id':_0x22e61c[_0x3df9('0x47')]['id']}},_0x1c1ed7={};_0x1c1ed7[_0x3df9('0x31')]=_['keys'](db[_0x3df9('0x2d')][_0x3df9('0x2e')]);_0x1c1ed7[_0x3df9('0x32')]=_[_0x3df9('0x48')](_0x22e61c[_0x3df9('0x32')]);_0x1c1ed7[_0x3df9('0x33')]=_['intersection'](_0x1c1ed7[_0x3df9('0x31')],_0x1c1ed7[_0x3df9('0x32')]);_0x17e34e[_0x3df9('0x35')]=_[_0x3df9('0x34')](_0x1c1ed7[_0x3df9('0x31')],qs['fields'](_0x22e61c['query'][_0x3df9('0x36')]));_0x17e34e[_0x3df9('0x35')]=_0x17e34e[_0x3df9('0x35')][_0x3df9('0x37')]?_0x17e34e[_0x3df9('0x35')]:_0x1c1ed7['model'];if(_0x22e61c[_0x3df9('0x32')]['includeAll']){_0x17e34e[_0x3df9('0x42')]=[{'all':!![]}];}_0x17e34e=_[_0x3df9('0x3e')]({},_0x17e34e,_0x22e61c[_0x3df9('0x40')]);return db[_0x3df9('0x2d')][_0x3df9('0x49')](_0x17e34e)[_0x3df9('0x24')](handleEntityNotFound(_0x10647a,null))[_0x3df9('0x24')](respondWithResult(_0x10647a,null))[_0x3df9('0x45')](handleError(_0x10647a,null));};exports['create']=function(_0x306d3d,_0x515054){return db[_0x3df9('0x2d')][_0x3df9('0x4a')](_0x306d3d['body'],{})[_0x3df9('0x24')](respondWithResult(_0x515054,0xc9))['catch'](handleError(_0x515054,null));};exports[_0x3df9('0x23')]=function(_0x2f5ed5,_0x1e767d){if(_0x2f5ed5[_0x3df9('0x4b')]['id']){delete _0x2f5ed5[_0x3df9('0x4b')]['id'];}return db[_0x3df9('0x2d')]['find']({'where':{'id':_0x2f5ed5[_0x3df9('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e767d,null))['then'](saveUpdates(_0x2f5ed5[_0x3df9('0x4b')],null))['then'](respondWithResult(_0x1e767d,null))['catch'](handleError(_0x1e767d,null));};exports['destroy']=function(_0x573228,_0x1ba346){return db[_0x3df9('0x2d')][_0x3df9('0x49')]({'where':{'id':_0x573228[_0x3df9('0x47')]['id']}})[_0x3df9('0x24')](handleEntityNotFound(_0x1ba346,null))[_0x3df9('0x24')](removeEntity(_0x1ba346,null))['catch'](handleError(_0x1ba346,null));};exports['describe']=function(_0x17b122,_0x2fb4d2){return db[_0x3df9('0x2d')][_0x3df9('0x4c')]()['then'](respondWithResult(_0x2fb4d2,null))[_0x3df9('0x45')](handleError(_0x2fb4d2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7e77a1c..cb4d6d0 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 _0x60d7=['JscriptyQuestionReport','lodash','../../config/logger','api','bluebird','path','rimraf','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x195570,_0x241fcc){var _0x252084=function(_0x3498a2){while(--_0x3498a2){_0x195570['push'](_0x195570['shift']());}};_0x252084(++_0x241fcc);}(_0x60d7,0x19b));var _0x760d=function(_0x573c86,_0x4c4337){_0x573c86=_0x573c86-0x0;var _0x2d1478=_0x60d7[_0x573c86];return _0x2d1478;};'use strict';var _=require(_0x760d('0x0'));var util=require('util');var logger=require(_0x760d('0x1'))(_0x760d('0x2'));var moment=require('moment');var BPromise=require(_0x760d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x760d('0x4'));var rimraf=require(_0x760d('0x5'));var config=require('../../config/environment');var attributes=require(_0x760d('0x6'));module[_0x760d('0x7')]=function(_0x3b8497,_0x29961f){return _0x3b8497[_0x760d('0x8')](_0x760d('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d5=['request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment'];(function(_0x4394bf,_0x352e04){var _0x442fea=function(_0x58a44e){while(--_0x58a44e){_0x4394bf['push'](_0x4394bf['shift']());}};_0x442fea(++_0x352e04);}(_0x98d5,0x1f1));var _0x598d=function(_0x423d6f,_0x21fc69){_0x423d6f=_0x423d6f-0x0;var _0x2c1b9b=_0x98d5[_0x423d6f];return _0x2c1b9b;};'use strict';var _=require(_0x598d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x598d('0x1'));var moment=require(_0x598d('0x2'));var BPromise=require('bluebird');var rp=require(_0x598d('0x3'));var fs=require('fs');var path=require(_0x598d('0x4'));var rimraf=require('rimraf');var config=require(_0x598d('0x5'));var attributes=require(_0x598d('0x6'));module['exports']=function(_0x114fde,_0xdfade9){return _0x114fde[_0x598d('0x7')](_0x598d('0x8'),attributes,{'tableName':_0x598d('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 48b0b77..4590317 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 _0xb7a8=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xb7a8,0x95));var _0x8b7a=function(_0x3438f7,_0x58b2fd){_0x3438f7=_0x3438f7-0x0;var _0x1fb83e=_0xb7a8[_0x3438f7];return _0x1fb83e;};'use strict';var _=require(_0x8b7a('0x0'));var util=require(_0x8b7a('0x1'));var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rs=require(_0x8b7a('0x4'));var fs=require('fs');var Redis=require(_0x8b7a('0x5'));var db=require(_0x8b7a('0x6'))['db'];var utils=require(_0x8b7a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b7a('0x8'));var jayson=require(_0x8b7a('0x9'));var client=jayson[_0x8b7a('0xa')][_0x8b7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x449a7e,_0x6fdc0b,_0x1ed692){return new BPromise(function(_0x5d509f,_0x5168d2){return client[_0x8b7a('0xc')](_0x449a7e,_0x1ed692)[_0x8b7a('0xd')](function(_0x9fb1ce){logger[_0x8b7a('0xe')](_0x8b7a('0xf'),_0x6fdc0b,_0x8b7a('0x10'));logger[_0x8b7a('0x11')](_0x8b7a('0x12'),_0x6fdc0b,_0x8b7a('0x10'),JSON[_0x8b7a('0x13')](_0x9fb1ce));if(_0x9fb1ce[_0x8b7a('0x14')]){if(_0x9fb1ce[_0x8b7a('0x14')]['code']===0x1f4){logger[_0x8b7a('0x14')](_0x8b7a('0xf'),_0x6fdc0b,_0x9fb1ce[_0x8b7a('0x14')][_0x8b7a('0x15')]);return _0x5168d2(_0x9fb1ce['error']['message']);}logger[_0x8b7a('0x14')](_0x8b7a('0xf'),_0x6fdc0b,_0x9fb1ce['error'][_0x8b7a('0x15')]);return _0x5d509f(_0x9fb1ce['error'][_0x8b7a('0x15')]);}else{logger['info'](_0x8b7a('0xf'),_0x6fdc0b,_0x8b7a('0x10'));_0x5d509f(_0x9fb1ce[_0x8b7a('0x16')][_0x8b7a('0x15')]);}})['catch'](function(_0xff2e59){logger['error'](_0x8b7a('0xf'),_0x6fdc0b,_0xff2e59);_0x5168d2(_0xff2e59);});});} \ No newline at end of file +var _0x1ffc=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x6de857,_0x5c7b04){var _0x5cf9e2=function(_0x511c80){while(--_0x511c80){_0x6de857['push'](_0x6de857['shift']());}};_0x5cf9e2(++_0x5c7b04);}(_0x1ffc,0x89));var _0xc1ff=function(_0x68776b,_0x58c25c){_0x68776b=_0x68776b-0x0;var _0xec1af3=_0x1ffc[_0x68776b];return _0xec1af3;};'use strict';var _=require(_0xc1ff('0x0'));var util=require(_0xc1ff('0x1'));var moment=require('moment');var BPromise=require(_0xc1ff('0x2'));var rs=require(_0xc1ff('0x3'));var fs=require('fs');var Redis=require(_0xc1ff('0x4'));var db=require(_0xc1ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1ff('0x6'))(_0xc1ff('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc1ff('0x8')][_0xc1ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4da30c,_0x47699b,_0x1ebd13){return new BPromise(function(_0x3be1d8,_0x4cad5f){return client[_0xc1ff('0xa')](_0x4da30c,_0x1ebd13)[_0xc1ff('0xb')](function(_0x3e4e24){logger[_0xc1ff('0xc')](_0xc1ff('0xd'),_0x47699b,_0xc1ff('0xe'));logger[_0xc1ff('0xf')](_0xc1ff('0x10'),_0x47699b,_0xc1ff('0xe'),JSON[_0xc1ff('0x11')](_0x3e4e24));if(_0x3e4e24[_0xc1ff('0x12')]){if(_0x3e4e24[_0xc1ff('0x12')][_0xc1ff('0x13')]===0x1f4){logger[_0xc1ff('0x12')](_0xc1ff('0xd'),_0x47699b,_0x3e4e24[_0xc1ff('0x12')][_0xc1ff('0x14')]);return _0x4cad5f(_0x3e4e24[_0xc1ff('0x12')][_0xc1ff('0x14')]);}logger[_0xc1ff('0x12')](_0xc1ff('0xd'),_0x47699b,_0x3e4e24['error']['message']);return _0x3be1d8(_0x3e4e24[_0xc1ff('0x12')][_0xc1ff('0x14')]);}else{logger[_0xc1ff('0xc')](_0xc1ff('0xd'),_0x47699b,_0xc1ff('0xe'));_0x3be1d8(_0x3e4e24['result'][_0xc1ff('0x14')]);}})[_0xc1ff('0x15')](function(_0x6d18e8){logger[_0xc1ff('0x12')](_0xc1ff('0xd'),_0x47699b,_0x6d18e8);_0x4cad5f(_0x6d18e8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 98dded3..2117c24 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 _0x736e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x736e,0x14d));var _0xe736=function(_0x104628,_0x1a007e){_0x104628=_0x104628-0x0;var _0x56550b=_0x736e[_0x104628];return _0x56550b;};'use strict';var multer=require(_0xe736('0x0'));var util=require(_0xe736('0x1'));var path=require(_0xe736('0x2'));var timeout=require(_0xe736('0x3'));var express=require('express');var router=express[_0xe736('0x4')]();var fs_extra=require(_0xe736('0x5'));var auth=require(_0xe736('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe736('0x7'));var controller=require(_0xe736('0x8'));router[_0xe736('0x9')]('/',auth[_0xe736('0xa')](),controller['index']);router['get'](_0xe736('0xb'),auth[_0xe736('0xa')](),controller[_0xe736('0xc')]);router['get'](_0xe736('0xd'),auth[_0xe736('0xa')](),controller[_0xe736('0xe')]);router[_0xe736('0x9')](_0xe736('0xf'),auth[_0xe736('0xa')](),controller[_0xe736('0x10')]);router[_0xe736('0x11')]('/',auth[_0xe736('0xa')](),controller[_0xe736('0x12')]);router[_0xe736('0x13')](_0xe736('0xd'),auth['isAuthenticated'](),controller[_0xe736('0x14')]);router[_0xe736('0x15')](_0xe736('0xd'),auth[_0xe736('0xa')](),controller[_0xe736('0x16')]);module[_0xe736('0x17')]=router; \ No newline at end of file +var _0xa245=['describe','/:id','show','/:id/questions','post','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x43213b,_0x3e739c){var _0x501bea=function(_0xb76a36){while(--_0xb76a36){_0x43213b['push'](_0x43213b['shift']());}};_0x501bea(++_0x3e739c);}(_0xa245,0x67));var _0x5a24=function(_0x376a4d,_0x26ca79){_0x376a4d=_0x376a4d-0x0;var _0x31b8fd=_0xa245[_0x376a4d];return _0x31b8fd;};'use strict';var multer=require('multer');var util=require(_0x5a24('0x0'));var path=require('path');var timeout=require(_0x5a24('0x1'));var express=require('express');var router=express[_0x5a24('0x2')]();var fs_extra=require(_0x5a24('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5a24('0x4'));var config=require(_0x5a24('0x5'));var controller=require(_0x5a24('0x6'));router[_0x5a24('0x7')]('/',auth[_0x5a24('0x8')](),controller[_0x5a24('0x9')]);router[_0x5a24('0x7')](_0x5a24('0xa'),auth[_0x5a24('0x8')](),controller[_0x5a24('0xb')]);router[_0x5a24('0x7')](_0x5a24('0xc'),auth[_0x5a24('0x8')](),controller[_0x5a24('0xd')]);router[_0x5a24('0x7')](_0x5a24('0xe'),auth[_0x5a24('0x8')](),controller['getQuestions']);router[_0x5a24('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x5a24('0x8')](),controller[_0x5a24('0x10')]);router[_0x5a24('0x11')](_0x5a24('0xc'),auth['isAuthenticated'](),controller[_0x5a24('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 565c1ff..2b5bc01 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 _0xb8cd=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime','setDataValue','format'];(function(_0x2ed0a4,_0xb9c275){var _0x1cfd37=function(_0x3ecc20){while(--_0x3ecc20){_0x2ed0a4['push'](_0x2ed0a4['shift']());}};_0x1cfd37(++_0xb9c275);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x335844,_0x3470e0){_0x335844=_0x335844-0x0;var _0x227991=_0xb8cd[_0x335844];return _0x227991;};'use strict';var moment=require(_0xdb8c('0x0'));var Sequelize=require(_0xdb8c('0x1'));module[_0xdb8c('0x2')]={'starttime':{'type':Sequelize[_0xdb8c('0x3')],'set':function(_0x10354b){this['setDataValue'](_0xdb8c('0x4'),_0x10354b);this[_0xdb8c('0x5')]('endtime',moment()[_0xdb8c('0x6')](_0xdb8c('0x7')));}},'endtime':{'type':Sequelize[_0xdb8c('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdb8c('0x8')]},'queue':{'type':Sequelize[_0xdb8c('0x8')]},'uniqueid':{'type':Sequelize[_0xdb8c('0x8')]},'calleridname':{'type':Sequelize[_0xdb8c('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xdb8c('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xe451=['format','STRING','moment','sequelize','exports','DATE','endtime'];(function(_0x45883b,_0x1ff0c1){var _0x5713f8=function(_0x1a4a27){while(--_0x1a4a27){_0x45883b['push'](_0x45883b['shift']());}};_0x5713f8(++_0x1ff0c1);}(_0xe451,0x1e5));var _0x1e45=function(_0x4cff77,_0x4a6a2c){_0x4cff77=_0x4cff77-0x0;var _0x5be9c2=_0xe451[_0x4cff77];return _0x5be9c2;};'use strict';var moment=require(_0x1e45('0x0'));var Sequelize=require(_0x1e45('0x1'));module[_0x1e45('0x2')]={'starttime':{'type':Sequelize[_0x1e45('0x3')],'set':function(_0x5b807f){this['setDataValue']('starttime',_0x5b807f);this['setDataValue'](_0x1e45('0x4'),moment()[_0x1e45('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x1e45('0x6')]},'projectname':{'type':Sequelize[_0x1e45('0x6')]},'queue':{'type':Sequelize[_0x1e45('0x6')]},'uniqueid':{'type':Sequelize[_0x1e45('0x6')]},'calleridname':{'type':Sequelize[_0x1e45('0x6')]},'calleridnum':{'type':Sequelize[_0x1e45('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ac9dca1..e60fddf 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 _0xffe9=['sort','where','pick','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','find','create','body','params','describe','findOne','JscriptyQuestionReport','order','SessionId','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xffe9,0x197));var _0x9ffe=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xffe9[_0x49d280];return _0x25274a;};'use strict';var emlformat=require(_0x9ffe('0x0'));var rimraf=require(_0x9ffe('0x1'));var zipdir=require(_0x9ffe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ffe('0x3'));var moment=require(_0x9ffe('0x4'));var BPromise=require(_0x9ffe('0x5'));var Mustache=require('mustache');var util=require(_0x9ffe('0x6'));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(_0x9ffe('0x7'));var _=require(_0x9ffe('0x8'));var squel=require(_0x9ffe('0x9'));var crypto=require(_0x9ffe('0xa'));var jsforce=require(_0x9ffe('0xb'));var deskjs=require(_0x9ffe('0xc'));var toCsv=require(_0x9ffe('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9ffe('0xe'));var authService=require(_0x9ffe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9ffe('0x10'));var hardwareService=require(_0x9ffe('0x11'));var logger=require(_0x9ffe('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9ffe('0x13'));var licenseUtil=require(_0x9ffe('0x14'));var db=require(_0x9ffe('0x15'))['db'];function respondWithStatusCode(_0x7992f9,_0x5c72dd){_0x5c72dd=_0x5c72dd||0xcc;return function(_0xc01ce4){if(_0xc01ce4){return _0x7992f9[_0x9ffe('0x16')](_0x5c72dd);}return _0x7992f9[_0x9ffe('0x17')](_0x5c72dd)['end']();};}function respondWithResult(_0x1841c5,_0x5bb543){_0x5bb543=_0x5bb543||0xc8;return function(_0x5645a7){if(_0x5645a7){return _0x1841c5['status'](_0x5bb543)[_0x9ffe('0x18')](_0x5645a7);}};}function respondWithFilteredResult(_0x8f2505,_0x3c5d4b){return function(_0x2c02e7){if(_0x2c02e7){var _0x1cfa2c=typeof _0x3c5d4b[_0x9ffe('0x19')]==='undefined'&&typeof _0x3c5d4b['limit']===_0x9ffe('0x1a');var _0x3f3c42=_0x2c02e7[_0x9ffe('0x1b')];var _0x338936=_0x1cfa2c?0x0:_0x3c5d4b[_0x9ffe('0x19')];var _0x4cc151=_0x1cfa2c?_0x2c02e7['count']:_0x3c5d4b['offset']+_0x3c5d4b[_0x9ffe('0x1c')];var _0x230299;if(_0x4cc151>=_0x3f3c42){_0x4cc151=_0x3f3c42;_0x230299=0xc8;}else{_0x230299=0xce;}_0x8f2505[_0x9ffe('0x17')](_0x230299);return _0x8f2505[_0x9ffe('0x1d')]('Content-Range',_0x338936+'-'+_0x4cc151+'/'+_0x3f3c42)[_0x9ffe('0x18')](_0x2c02e7);}return null;};}function patchUpdates(_0x4abbf1){return function(_0x14b3e3){try{jsonpatch[_0x9ffe('0x1e')](_0x14b3e3,_0x4abbf1,!![]);}catch(_0x4e2de3){return BPromise[_0x9ffe('0x1f')](_0x4e2de3);}return _0x14b3e3['save']();};}function saveUpdates(_0x18592b,_0x558781){return function(_0x2bc20b){if(_0x2bc20b){return _0x2bc20b[_0x9ffe('0x20')](_0x18592b)[_0x9ffe('0x21')](function(_0x5bfe08){return _0x5bfe08;});}return null;};}function removeEntity(_0x1d7c88,_0x2d4361){return function(_0x3e8793){if(_0x3e8793){return _0x3e8793[_0x9ffe('0x22')]()['then'](function(){_0x1d7c88['status'](0xcc)[_0x9ffe('0x23')]();});}};}function handleEntityNotFound(_0x53fd00,_0x4e8524){return function(_0x1ad4b3){if(!_0x1ad4b3){_0x53fd00[_0x9ffe('0x16')](0x194);}return _0x1ad4b3;};}function handleError(_0x31342d,_0x388d65){_0x388d65=_0x388d65||0x1f4;return function(_0x54fd47){logger[_0x9ffe('0x24')](_0x54fd47['stack']);if(_0x54fd47[_0x9ffe('0x25')]){delete _0x54fd47[_0x9ffe('0x25')];}_0x31342d['status'](_0x388d65)[_0x9ffe('0x26')](_0x54fd47);};}exports[_0x9ffe('0x27')]=function(_0x5aa12e,_0x1fb15b){var _0x1e7fcc={},_0x2bfb90={},_0x90b229={'count':0x0,'rows':[]};var _0x289eb2=_[_0x9ffe('0x28')](db['JscriptySessionReport'][_0x9ffe('0x29')],function(_0x149426){return{'name':_0x149426[_0x9ffe('0x2a')],'type':_0x149426[_0x9ffe('0x2b')][_0x9ffe('0x2c')]};});_0x2bfb90['model']=_[_0x9ffe('0x28')](_0x289eb2,_0x9ffe('0x25'));_0x2bfb90[_0x9ffe('0x2d')]=_[_0x9ffe('0x2e')](_0x5aa12e[_0x9ffe('0x2d')]);_0x2bfb90[_0x9ffe('0x2f')]=_[_0x9ffe('0x30')](_0x2bfb90[_0x9ffe('0x31')],_0x2bfb90['query']);_0x1e7fcc[_0x9ffe('0x32')]=_[_0x9ffe('0x30')](_0x2bfb90['model'],qs['fields'](_0x5aa12e['query'][_0x9ffe('0x33')]));_0x1e7fcc[_0x9ffe('0x32')]=_0x1e7fcc[_0x9ffe('0x32')][_0x9ffe('0x34')]?_0x1e7fcc[_0x9ffe('0x32')]:_0x2bfb90[_0x9ffe('0x31')];if(!_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x35')](_0x9ffe('0x36'))){_0x1e7fcc['limit']=qs['limit'](_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x1c')]);_0x1e7fcc[_0x9ffe('0x19')]=qs['offset'](_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x19')]);}_0x1e7fcc['order']=qs[_0x9ffe('0x37')](_0x5aa12e['query']['sort']);_0x1e7fcc[_0x9ffe('0x38')]=qs[_0x9ffe('0x2f')](_[_0x9ffe('0x39')](_0x5aa12e['query'],_0x2bfb90['filters']),_0x289eb2);if(_0x5aa12e[_0x9ffe('0x2d')]['filter']){_0x1e7fcc[_0x9ffe('0x38')]=_[_0x9ffe('0x3a')](_0x1e7fcc[_0x9ffe('0x38')],{'$or':_[_0x9ffe('0x28')](_0x289eb2,function(_0x252aa0){if(_0x252aa0[_0x9ffe('0x2b')]!==_0x9ffe('0x3b')){var _0x27ab4b={};_0x27ab4b[_0x252aa0['name']]={'$like':'%'+_0x5aa12e[_0x9ffe('0x2d')]['filter']+'%'};return _0x27ab4b;}})});}_0x1e7fcc=_[_0x9ffe('0x3a')]({},_0x1e7fcc,_0x5aa12e[_0x9ffe('0x3c')]);var _0x285b35={'where':_0x1e7fcc['where']};return db[_0x9ffe('0x3d')][_0x9ffe('0x1b')](_0x285b35)[_0x9ffe('0x21')](function(_0x2f35ae){_0x90b229[_0x9ffe('0x1b')]=_0x2f35ae;if(_0x5aa12e[_0x9ffe('0x2d')][_0x9ffe('0x3e')]){_0x1e7fcc[_0x9ffe('0x3f')]=[{'all':!![]}];}return db[_0x9ffe('0x3d')][_0x9ffe('0x40')](_0x1e7fcc);})[_0x9ffe('0x21')](function(_0x298149){_0x90b229[_0x9ffe('0x41')]=_0x298149;return _0x90b229;})[_0x9ffe('0x21')](respondWithFilteredResult(_0x1fb15b,_0x1e7fcc))[_0x9ffe('0x42')](handleError(_0x1fb15b,null));};exports['show']=function(_0x578cfd,_0x5c8137){var _0x3f1c2a={'raw':!![],'where':{'id':_0x578cfd['params']['id']}},_0x120b8e={};_0x120b8e[_0x9ffe('0x31')]=_['keys'](db[_0x9ffe('0x3d')][_0x9ffe('0x29')]);_0x120b8e['query']=_[_0x9ffe('0x2e')](_0x578cfd[_0x9ffe('0x2d')]);_0x120b8e[_0x9ffe('0x2f')]=_[_0x9ffe('0x30')](_0x120b8e['model'],_0x120b8e[_0x9ffe('0x2d')]);_0x3f1c2a[_0x9ffe('0x32')]=_[_0x9ffe('0x30')](_0x120b8e[_0x9ffe('0x31')],qs[_0x9ffe('0x33')](_0x578cfd[_0x9ffe('0x2d')]['fields']));_0x3f1c2a[_0x9ffe('0x32')]=_0x3f1c2a[_0x9ffe('0x32')]['length']?_0x3f1c2a[_0x9ffe('0x32')]:_0x120b8e[_0x9ffe('0x31')];if(_0x578cfd[_0x9ffe('0x2d')][_0x9ffe('0x3e')]){_0x3f1c2a[_0x9ffe('0x3f')]=[{'all':!![]}];}_0x3f1c2a=_[_0x9ffe('0x3a')]({},_0x3f1c2a,_0x578cfd['options']);return db['JscriptySessionReport'][_0x9ffe('0x43')](_0x3f1c2a)['then'](handleEntityNotFound(_0x5c8137,null))['then'](respondWithResult(_0x5c8137,null))['catch'](handleError(_0x5c8137,null));};exports[_0x9ffe('0x44')]=function(_0x30a87c,_0x104ab7){return db[_0x9ffe('0x3d')][_0x9ffe('0x44')](_0x30a87c[_0x9ffe('0x45')],{})[_0x9ffe('0x21')](respondWithResult(_0x104ab7,0xc9))[_0x9ffe('0x42')](handleError(_0x104ab7,null));};exports[_0x9ffe('0x20')]=function(_0x24f40,_0x7cf503){if(_0x24f40[_0x9ffe('0x45')]['id']){delete _0x24f40['body']['id'];}return db[_0x9ffe('0x3d')][_0x9ffe('0x43')]({'where':{'id':_0x24f40['params']['id']}})[_0x9ffe('0x21')](handleEntityNotFound(_0x7cf503,null))['then'](saveUpdates(_0x24f40[_0x9ffe('0x45')],null))[_0x9ffe('0x21')](respondWithResult(_0x7cf503,null))[_0x9ffe('0x42')](handleError(_0x7cf503,null));};exports[_0x9ffe('0x22')]=function(_0x513d2f,_0x4d9090){return db[_0x9ffe('0x3d')][_0x9ffe('0x43')]({'where':{'id':_0x513d2f[_0x9ffe('0x46')]['id']}})[_0x9ffe('0x21')](handleEntityNotFound(_0x4d9090,null))[_0x9ffe('0x21')](removeEntity(_0x4d9090,null))[_0x9ffe('0x42')](handleError(_0x4d9090,null));};exports['describe']=function(_0x4ae061,_0x152b7a){return db['JscriptySessionReport'][_0x9ffe('0x47')]()[_0x9ffe('0x21')](respondWithResult(_0x152b7a,null))[_0x9ffe('0x42')](handleError(_0x152b7a,null));};exports['getQuestions']=function(_0x1af817,_0x272b2e,_0x46a1ca){var _0x1a27f8={'raw':!![],'where':{}};var _0x167889={};var _0x587fd6={'count':0x0,'rows':[]};return db[_0x9ffe('0x3d')][_0x9ffe('0x48')]({'where':{'id':_0x1af817[_0x9ffe('0x46')]['id']}})[_0x9ffe('0x21')](handleEntityNotFound(_0x272b2e,null))['then'](function(_0x5c85c1){if(_0x5c85c1){_0x167889['model']=_[_0x9ffe('0x2e')](db[_0x9ffe('0x49')][_0x9ffe('0x29')]);_0x167889[_0x9ffe('0x2d')]=_[_0x9ffe('0x2e')](_0x1af817['query']);_0x167889[_0x9ffe('0x2f')]=_[_0x9ffe('0x30')](_0x167889[_0x9ffe('0x31')],_0x167889['query']);_0x1a27f8[_0x9ffe('0x32')]=_['intersection'](_0x167889[_0x9ffe('0x31')],qs[_0x9ffe('0x33')](_0x1af817['query'][_0x9ffe('0x33')]));_0x1a27f8[_0x9ffe('0x32')]=_0x1a27f8[_0x9ffe('0x32')][_0x9ffe('0x34')]?_0x1a27f8[_0x9ffe('0x32')]:_0x167889[_0x9ffe('0x31')];if(!_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x35')](_0x9ffe('0x36'))){_0x1a27f8[_0x9ffe('0x1c')]=qs[_0x9ffe('0x1c')](_0x1af817['query'][_0x9ffe('0x1c')]);_0x1a27f8[_0x9ffe('0x19')]=qs['offset'](_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x19')]);}_0x1a27f8[_0x9ffe('0x4a')]=qs['sort'](_0x1af817[_0x9ffe('0x2d')]['sort']);_0x1a27f8[_0x9ffe('0x38')]=qs[_0x9ffe('0x2f')](_['pick'](_0x1af817['query'],_0x167889['filters']));_0x1a27f8['where'][_0x9ffe('0x4b')]=_0x5c85c1['id'];if(_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x4c')]){_0x1a27f8[_0x9ffe('0x38')]=_['merge'](_0x1a27f8[_0x9ffe('0x38')],{'$or':_[_0x9ffe('0x28')](_0x1a27f8[_0x9ffe('0x32')],function(_0x45eb22){var _0x1a48f4={};_0x1a48f4[_0x45eb22]={'$like':'%'+_0x1af817[_0x9ffe('0x2d')][_0x9ffe('0x4c')]+'%'};return _0x1a48f4;})});}_0x1a27f8=_[_0x9ffe('0x3a')]({},_0x1a27f8,_0x1af817[_0x9ffe('0x3c')]);return db[_0x9ffe('0x49')][_0x9ffe('0x1b')]({'where':_0x1a27f8[_0x9ffe('0x38')]})[_0x9ffe('0x21')](function(_0x599224){_0x587fd6[_0x9ffe('0x1b')]=_0x599224;if(_0x1af817['query'][_0x9ffe('0x3e')]){_0x1a27f8[_0x9ffe('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9ffe('0x40')](_0x1a27f8);})[_0x9ffe('0x21')](function(_0x2e7243){_0x587fd6[_0x9ffe('0x41')]=_0x2e7243;return _0x587fd6;});}})['then'](respondWithFilteredResult(_0x272b2e,_0x1a27f8))['catch'](handleError(_0x272b2e,null));}; \ No newline at end of file +var _0x9a69=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','filters','includeAll','find','create','body','params','describe','findOne','pick','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x9a69,0x1c1));var _0x99a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9a69[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x99a6('0x0'));var rimraf=require(_0x99a6('0x1'));var zipdir=require(_0x99a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a6('0x3'));var moment=require(_0x99a6('0x4'));var BPromise=require(_0x99a6('0x5'));var Mustache=require(_0x99a6('0x6'));var util=require('util');var path=require(_0x99a6('0x7'));var sox=require('sox');var csv=require(_0x99a6('0x8'));var ejs=require(_0x99a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x99a6('0xa'));var crypto=require('crypto');var jsforce=require(_0x99a6('0xb'));var deskjs=require(_0x99a6('0xc'));var toCsv=require(_0x99a6('0x8'));var querystring=require(_0x99a6('0xd'));var Papa=require('papaparse');var Redis=require(_0x99a6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x99a6('0xf'));var as=require(_0x99a6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99a6('0x11'))(_0x99a6('0x12'));var utils=require('../../config/utils');var config=require(_0x99a6('0x13'));var licenseUtil=require(_0x99a6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd4f0,_0x120abf){_0x120abf=_0x120abf||0xcc;return function(_0x160caf){if(_0x160caf){return _0x5dd4f0[_0x99a6('0x15')](_0x120abf);}return _0x5dd4f0[_0x99a6('0x16')](_0x120abf)[_0x99a6('0x17')]();};}function respondWithResult(_0x34c451,_0x3e3339){_0x3e3339=_0x3e3339||0xc8;return function(_0x3c38d4){if(_0x3c38d4){return _0x34c451[_0x99a6('0x16')](_0x3e3339)[_0x99a6('0x18')](_0x3c38d4);}};}function respondWithFilteredResult(_0x3a0531,_0x5e0f2f){return function(_0x179a05){if(_0x179a05){var _0x249042=typeof _0x5e0f2f[_0x99a6('0x19')]===_0x99a6('0x1a')&&typeof _0x5e0f2f[_0x99a6('0x1b')]===_0x99a6('0x1a');var _0x452b45=_0x179a05['count'];var _0x70b164=_0x249042?0x0:_0x5e0f2f['offset'];var _0x261032=_0x249042?_0x179a05[_0x99a6('0x1c')]:_0x5e0f2f['offset']+_0x5e0f2f[_0x99a6('0x1b')];var _0x3f49c7;if(_0x261032>=_0x452b45){_0x261032=_0x452b45;_0x3f49c7=0xc8;}else{_0x3f49c7=0xce;}_0x3a0531[_0x99a6('0x16')](_0x3f49c7);return _0x3a0531[_0x99a6('0x1d')](_0x99a6('0x1e'),_0x70b164+'-'+_0x261032+'/'+_0x452b45)['json'](_0x179a05);}return null;};}function patchUpdates(_0x49cbe5){return function(_0x235c31){try{jsonpatch[_0x99a6('0x1f')](_0x235c31,_0x49cbe5,!![]);}catch(_0x2f4518){return BPromise[_0x99a6('0x20')](_0x2f4518);}return _0x235c31[_0x99a6('0x21')]();};}function saveUpdates(_0x379a8a,_0x496627){return function(_0x5e0ff1){if(_0x5e0ff1){return _0x5e0ff1[_0x99a6('0x22')](_0x379a8a)[_0x99a6('0x23')](function(_0x7da655){return _0x7da655;});}return null;};}function removeEntity(_0x3f39f5,_0x8c2c8a){return function(_0x15b826){if(_0x15b826){return _0x15b826[_0x99a6('0x24')]()[_0x99a6('0x23')](function(){_0x3f39f5[_0x99a6('0x16')](0xcc)[_0x99a6('0x17')]();});}};}function handleEntityNotFound(_0x303106,_0x2c098c){return function(_0x2fb620){if(!_0x2fb620){_0x303106[_0x99a6('0x15')](0x194);}return _0x2fb620;};}function handleError(_0x2e7eed,_0x243ce8){_0x243ce8=_0x243ce8||0x1f4;return function(_0x281a9e){logger['error'](_0x281a9e['stack']);if(_0x281a9e[_0x99a6('0x25')]){delete _0x281a9e['name'];}_0x2e7eed[_0x99a6('0x16')](_0x243ce8)[_0x99a6('0x26')](_0x281a9e);};}exports[_0x99a6('0x27')]=function(_0x136f67,_0x13d11f){var _0x5b3ea4={},_0xf38d7={},_0xa32ad9={'count':0x0,'rows':[]};var _0x4326cc=_[_0x99a6('0x28')](db[_0x99a6('0x29')][_0x99a6('0x2a')],function(_0x1db631){return{'name':_0x1db631[_0x99a6('0x2b')],'type':_0x1db631[_0x99a6('0x2c')]['key']};});_0xf38d7[_0x99a6('0x2d')]=_[_0x99a6('0x28')](_0x4326cc,_0x99a6('0x25'));_0xf38d7[_0x99a6('0x2e')]=_['keys'](_0x136f67[_0x99a6('0x2e')]);_0xf38d7['filters']=_[_0x99a6('0x2f')](_0xf38d7[_0x99a6('0x2d')],_0xf38d7[_0x99a6('0x2e')]);_0x5b3ea4['attributes']=_[_0x99a6('0x2f')](_0xf38d7[_0x99a6('0x2d')],qs[_0x99a6('0x30')](_0x136f67[_0x99a6('0x2e')]['fields']));_0x5b3ea4['attributes']=_0x5b3ea4[_0x99a6('0x31')][_0x99a6('0x32')]?_0x5b3ea4[_0x99a6('0x31')]:_0xf38d7[_0x99a6('0x2d')];if(!_0x136f67[_0x99a6('0x2e')][_0x99a6('0x33')](_0x99a6('0x34'))){_0x5b3ea4[_0x99a6('0x1b')]=qs[_0x99a6('0x1b')](_0x136f67[_0x99a6('0x2e')]['limit']);_0x5b3ea4['offset']=qs['offset'](_0x136f67['query'][_0x99a6('0x19')]);}_0x5b3ea4[_0x99a6('0x35')]=qs[_0x99a6('0x36')](_0x136f67['query'][_0x99a6('0x36')]);_0x5b3ea4[_0x99a6('0x37')]=qs['filters'](_['pick'](_0x136f67['query'],_0xf38d7['filters']),_0x4326cc);if(_0x136f67['query']['filter']){_0x5b3ea4[_0x99a6('0x37')]=_[_0x99a6('0x38')](_0x5b3ea4[_0x99a6('0x37')],{'$or':_['map'](_0x4326cc,function(_0x2ac676){if(_0x2ac676['type']!==_0x99a6('0x39')){var _0x3f774a={};_0x3f774a[_0x2ac676[_0x99a6('0x25')]]={'$like':'%'+_0x136f67[_0x99a6('0x2e')][_0x99a6('0x3a')]+'%'};return _0x3f774a;}})});}_0x5b3ea4=_[_0x99a6('0x38')]({},_0x5b3ea4,_0x136f67[_0x99a6('0x3b')]);var _0x139c4a={'where':_0x5b3ea4[_0x99a6('0x37')]};return db[_0x99a6('0x29')]['count'](_0x139c4a)[_0x99a6('0x23')](function(_0x4058df){_0xa32ad9[_0x99a6('0x1c')]=_0x4058df;if(_0x136f67[_0x99a6('0x2e')]['includeAll']){_0x5b3ea4[_0x99a6('0x3c')]=[{'all':!![]}];}return db[_0x99a6('0x29')][_0x99a6('0x3d')](_0x5b3ea4);})['then'](function(_0x3b9b98){_0xa32ad9[_0x99a6('0x3e')]=_0x3b9b98;return _0xa32ad9;})[_0x99a6('0x23')](respondWithFilteredResult(_0x13d11f,_0x5b3ea4))[_0x99a6('0x3f')](handleError(_0x13d11f,null));};exports[_0x99a6('0x40')]=function(_0x24c868,_0x50c874){var _0x410187={'raw':!![],'where':{'id':_0x24c868['params']['id']}},_0x1f31a5={};_0x1f31a5[_0x99a6('0x2d')]=_['keys'](db['JscriptySessionReport'][_0x99a6('0x2a')]);_0x1f31a5[_0x99a6('0x2e')]=_[_0x99a6('0x41')](_0x24c868[_0x99a6('0x2e')]);_0x1f31a5[_0x99a6('0x42')]=_[_0x99a6('0x2f')](_0x1f31a5[_0x99a6('0x2d')],_0x1f31a5[_0x99a6('0x2e')]);_0x410187[_0x99a6('0x31')]=_['intersection'](_0x1f31a5[_0x99a6('0x2d')],qs[_0x99a6('0x30')](_0x24c868[_0x99a6('0x2e')][_0x99a6('0x30')]));_0x410187[_0x99a6('0x31')]=_0x410187[_0x99a6('0x31')][_0x99a6('0x32')]?_0x410187[_0x99a6('0x31')]:_0x1f31a5[_0x99a6('0x2d')];if(_0x24c868['query'][_0x99a6('0x43')]){_0x410187[_0x99a6('0x3c')]=[{'all':!![]}];}_0x410187=_[_0x99a6('0x38')]({},_0x410187,_0x24c868[_0x99a6('0x3b')]);return db[_0x99a6('0x29')][_0x99a6('0x44')](_0x410187)[_0x99a6('0x23')](handleEntityNotFound(_0x50c874,null))[_0x99a6('0x23')](respondWithResult(_0x50c874,null))[_0x99a6('0x3f')](handleError(_0x50c874,null));};exports[_0x99a6('0x45')]=function(_0xff0eb5,_0x18a925){return db[_0x99a6('0x29')]['create'](_0xff0eb5[_0x99a6('0x46')],{})[_0x99a6('0x23')](respondWithResult(_0x18a925,0xc9))[_0x99a6('0x3f')](handleError(_0x18a925,null));};exports[_0x99a6('0x22')]=function(_0x5bea7e,_0x52bced){if(_0x5bea7e[_0x99a6('0x46')]['id']){delete _0x5bea7e[_0x99a6('0x46')]['id'];}return db[_0x99a6('0x29')][_0x99a6('0x44')]({'where':{'id':_0x5bea7e[_0x99a6('0x47')]['id']}})[_0x99a6('0x23')](handleEntityNotFound(_0x52bced,null))[_0x99a6('0x23')](saveUpdates(_0x5bea7e[_0x99a6('0x46')],null))[_0x99a6('0x23')](respondWithResult(_0x52bced,null))[_0x99a6('0x3f')](handleError(_0x52bced,null));};exports[_0x99a6('0x24')]=function(_0x5e9106,_0x19464f){return db['JscriptySessionReport'][_0x99a6('0x44')]({'where':{'id':_0x5e9106['params']['id']}})[_0x99a6('0x23')](handleEntityNotFound(_0x19464f,null))[_0x99a6('0x23')](removeEntity(_0x19464f,null))[_0x99a6('0x3f')](handleError(_0x19464f,null));};exports[_0x99a6('0x48')]=function(_0xceb739,_0x55ddbf){return db['JscriptySessionReport'][_0x99a6('0x48')]()['then'](respondWithResult(_0x55ddbf,null))[_0x99a6('0x3f')](handleError(_0x55ddbf,null));};exports['getQuestions']=function(_0x42ae31,_0x352499,_0x2353f7){var _0x263f76={'raw':!![],'where':{}};var _0x3af10a={};var _0x12cb7a={'count':0x0,'rows':[]};return db[_0x99a6('0x29')][_0x99a6('0x49')]({'where':{'id':_0x42ae31[_0x99a6('0x47')]['id']}})[_0x99a6('0x23')](handleEntityNotFound(_0x352499,null))[_0x99a6('0x23')](function(_0x453c78){if(_0x453c78){_0x3af10a['model']=_[_0x99a6('0x41')](db['JscriptyQuestionReport'][_0x99a6('0x2a')]);_0x3af10a[_0x99a6('0x2e')]=_[_0x99a6('0x41')](_0x42ae31[_0x99a6('0x2e')]);_0x3af10a['filters']=_[_0x99a6('0x2f')](_0x3af10a[_0x99a6('0x2d')],_0x3af10a[_0x99a6('0x2e')]);_0x263f76[_0x99a6('0x31')]=_['intersection'](_0x3af10a[_0x99a6('0x2d')],qs[_0x99a6('0x30')](_0x42ae31[_0x99a6('0x2e')][_0x99a6('0x30')]));_0x263f76[_0x99a6('0x31')]=_0x263f76[_0x99a6('0x31')]['length']?_0x263f76[_0x99a6('0x31')]:_0x3af10a[_0x99a6('0x2d')];if(!_0x42ae31[_0x99a6('0x2e')][_0x99a6('0x33')]('nolimit')){_0x263f76['limit']=qs['limit'](_0x42ae31[_0x99a6('0x2e')][_0x99a6('0x1b')]);_0x263f76[_0x99a6('0x19')]=qs['offset'](_0x42ae31['query']['offset']);}_0x263f76[_0x99a6('0x35')]=qs[_0x99a6('0x36')](_0x42ae31[_0x99a6('0x2e')][_0x99a6('0x36')]);_0x263f76['where']=qs[_0x99a6('0x42')](_[_0x99a6('0x4a')](_0x42ae31['query'],_0x3af10a['filters']));_0x263f76[_0x99a6('0x37')][_0x99a6('0x4b')]=_0x453c78['id'];if(_0x42ae31['query']['filter']){_0x263f76[_0x99a6('0x37')]=_[_0x99a6('0x38')](_0x263f76[_0x99a6('0x37')],{'$or':_['map'](_0x263f76[_0x99a6('0x31')],function(_0x4fae34){var _0x5477f3={};_0x5477f3[_0x4fae34]={'$like':'%'+_0x42ae31[_0x99a6('0x2e')][_0x99a6('0x3a')]+'%'};return _0x5477f3;})});}_0x263f76=_['merge']({},_0x263f76,_0x42ae31['options']);return db[_0x99a6('0x4c')][_0x99a6('0x1c')]({'where':_0x263f76[_0x99a6('0x37')]})[_0x99a6('0x23')](function(_0x1b7b48){_0x12cb7a[_0x99a6('0x1c')]=_0x1b7b48;if(_0x42ae31[_0x99a6('0x2e')][_0x99a6('0x43')]){_0x263f76[_0x99a6('0x3c')]=[{'all':!![]}];}return db[_0x99a6('0x4c')][_0x99a6('0x3d')](_0x263f76);})[_0x99a6('0x23')](function(_0x15e65f){_0x12cb7a[_0x99a6('0x3e')]=_0x15e65f;return _0x12cb7a;});}})[_0x99a6('0x23')](respondWithFilteredResult(_0x352499,_0x263f76))['catch'](handleError(_0x352499,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5c1b573..5643c92 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 _0xb091=['moment','request-promise','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x2b250c,_0x3d223b){var _0x43c013=function(_0x473da9){while(--_0x473da9){_0x2b250c['push'](_0x2b250c['shift']());}};_0x43c013(++_0x3d223b);}(_0xb091,0x16e));var _0x1b09=function(_0x5af324,_0x276ac8){_0x5af324=_0x5af324-0x0;var _0x152629=_0xb091[_0x5af324];return _0x152629;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x56029c,_0xaa925f){var _0xbae6d0=function(_0x16f5c7){while(--_0x16f5c7){_0x56029c['push'](_0x56029c['shift']());}};_0xbae6d0(++_0xaa925f);}(_0x5fab,0x177));var _0xb5fa=function(_0x52c1f6,_0x4eda0b){_0x52c1f6=_0x52c1f6-0x0;var _0x4df981=_0x5fab[_0x52c1f6];return _0x4df981;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'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 0dc7b6b..b579d5c 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 _0x9536=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x3feb0c,_0x5c57b7){var _0x46c8f1=function(_0x49b1f1){while(--_0x49b1f1){_0x3feb0c['push'](_0x3feb0c['shift']());}};_0x46c8f1(++_0x5c57b7);}(_0x9536,0x179));var _0x6953=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x9536[_0xcda377];return _0x1c024f;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x5fdc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring'];(function(_0x208616,_0x39fd62){var _0x1acc88=function(_0x1f3918){while(--_0x1f3918){_0x208616['push'](_0x208616['shift']());}};_0x1acc88(++_0x39fd62);}(_0x5fdc,0x127));var _0xc5fd=function(_0x136df0,_0x735f27){_0x136df0=_0x136df0-0x0;var _0x43e342=_0x5fdc[_0x136df0];return _0x43e342;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15ffe7,_0x5a2eb4,_0x5d86e5){return new BPromise(function(_0x493389,_0x224801){return client[_0xc5fd('0xe')](_0x15ffe7,_0x5d86e5)[_0xc5fd('0xf')](function(_0x45c91f){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5a2eb4,_0xc5fd('0x10'));logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x5a2eb4,_0xc5fd('0x10'),JSON[_0xc5fd('0x13')](_0x45c91f));if(_0x45c91f[_0xc5fd('0x14')]){if(_0x45c91f['error'][_0xc5fd('0x15')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x224801(_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);}logger[_0xc5fd('0x14')](_0xc5fd('0x17'),_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x493389(_0x45c91f['error'][_0xc5fd('0x16')]);}else{logger[_0xc5fd('0x18')](_0xc5fd('0x17'),_0x5a2eb4,_0xc5fd('0x10'));_0x493389(_0x45c91f['result']['message']);}})['catch'](function(_0x5529b3){logger['error'](_0xc5fd('0x17'),_0x5a2eb4,_0x5529b3);_0x224801(_0x5529b3);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1bef2a5..f52ad12 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 _0xb048=['isAuthenticated','update','/download_log_file','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x421526,_0x1d5f80){var _0x56148e=function(_0x379904){while(--_0x379904){_0x421526['push'](_0x421526['shift']());}};_0x56148e(++_0x1d5f80);}(_0xb048,0xa4));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8b04('0x0'));var util=require('util');var path=require(_0x8b04('0x1'));var timeout=require(_0x8b04('0x2'));var express=require(_0x8b04('0x3'));var router=express[_0x8b04('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b04('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b04('0x6'));var controller=require(_0x8b04('0x7'));router[_0x8b04('0x8')]('/',controller[_0x8b04('0x9')]);router[_0x8b04('0xa')](_0x8b04('0xb'),auth[_0x8b04('0xc')](),controller[_0x8b04('0xd')]);router['get'](_0x8b04('0xe'),auth[_0x8b04('0xc')](),controller['downloadLogFile']);module[_0x8b04('0xf')]=router; \ No newline at end of file +var _0x8149=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','index','isAuthenticated','update','get','/download_log_file','exports','multer'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x8149,0x1a3));var _0x9814=function(_0x31ff9c,_0x1c913a){_0x31ff9c=_0x31ff9c-0x0;var _0x34639d=_0x8149[_0x31ff9c];return _0x34639d;};'use strict';var multer=require(_0x9814('0x0'));var util=require(_0x9814('0x1'));var path=require('path');var timeout=require(_0x9814('0x2'));var express=require(_0x9814('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9814('0x4'));var config=require(_0x9814('0x5'));var controller=require('./license.controller');router['get']('/',controller[_0x9814('0x6')]);router['put']('/:id',auth[_0x9814('0x7')](),controller[_0x9814('0x8')]);router[_0x9814('0x9')](_0x9814('0xa'),auth[_0x9814('0x7')](),controller['downloadLogFile']);module[_0x9814('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0fb29d6..76a8926 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 _0xc1e4=['STRING','INTEGER','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc1e4,0x1ce));var _0x4c1e=function(_0x65693e,_0x49a9f1){_0x65693e=_0x65693e-0x0;var _0xd0460a=_0xc1e4[_0x65693e];return _0xd0460a;};'use strict';var Sequelize=require(_0x4c1e('0x0'));module[_0x4c1e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x4c1e('0x2')]},'data2':{'type':Sequelize[_0x4c1e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x4c1e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3f3=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x29fc00,_0x58869c){var _0x5c1f7a=function(_0x386087){while(--_0x386087){_0x29fc00['push'](_0x29fc00['shift']());}};_0x5c1f7a(++_0x58869c);}(_0xe3f3,0x14f));var _0x3e3f=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xe3f3[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0x3e3f('0x0'));module[_0x3e3f('0x1')]={'license':{'type':Sequelize[_0x3e3f('0x2')]},'data1':{'type':Sequelize[_0x3e3f('0x3')]},'data2':{'type':Sequelize[_0x3e3f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3e3f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ec2f1ba..f549a6d 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 _0x1fd8=['Content-Type','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','sendStatus','error','stack','name','send','../../config/license/util','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','options','getLicense','catch','find','params','then','get','checkLicense','body','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition'];(function(_0x58197a,_0x289ca2){var _0x21e74e=function(_0x3bb8a6){while(--_0x3bb8a6){_0x58197a['push'](_0x58197a['shift']());}};_0x21e74e(++_0x289ca2);}(_0x1fd8,0x14c));var _0x81fd=function(_0x60d3b8,_0x2ed654){_0x60d3b8=_0x60d3b8-0x0;var _0x210f34=_0x1fd8[_0x60d3b8];return _0x210f34;};'use strict';var emlformat=require(_0x81fd('0x0'));var rimraf=require(_0x81fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81fd('0x2'));var rp=require(_0x81fd('0x3'));var moment=require('moment');var BPromise=require(_0x81fd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x81fd('0x5'));var sox=require(_0x81fd('0x6'));var csv=require('to-csv');var ejs=require(_0x81fd('0x7'));var fs=require('fs');var fs_extra=require(_0x81fd('0x8'));var _=require(_0x81fd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81fd('0xa'));var toCsv=require(_0x81fd('0xb'));var querystring=require('querystring');var Papa=require(_0x81fd('0xc'));var Redis=require('ioredis');var authService=require(_0x81fd('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x81fd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81fd('0xf'))('api');var utils=require(_0x81fd('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81fd('0x11'))['db'];function respondWithStatusCode(_0x340478,_0x4e6971){_0x4e6971=_0x4e6971||0xcc;return function(_0x2342fd){if(_0x2342fd){return _0x340478['sendStatus'](_0x4e6971);}return _0x340478[_0x81fd('0x12')](_0x4e6971)[_0x81fd('0x13')]();};}function respondWithResult(_0x2039ed,_0x1c722a){_0x1c722a=_0x1c722a||0xc8;return function(_0x2b5834){if(_0x2b5834){return _0x2039ed[_0x81fd('0x12')](_0x1c722a)[_0x81fd('0x14')](_0x2b5834);}};}function respondWithFilteredResult(_0x1dde78,_0x489078){return function(_0x30a326){if(_0x30a326){var _0x175231=typeof _0x489078[_0x81fd('0x15')]===_0x81fd('0x16')&&typeof _0x489078[_0x81fd('0x17')]===_0x81fd('0x16');var _0xe1a93e=_0x30a326['count'];var _0x4cc46b=_0x175231?0x0:_0x489078['offset'];var _0x4e294a=_0x175231?_0x30a326[_0x81fd('0x18')]:_0x489078[_0x81fd('0x15')]+_0x489078['limit'];var _0x4f7610;if(_0x4e294a>=_0xe1a93e){_0x4e294a=_0xe1a93e;_0x4f7610=0xc8;}else{_0x4f7610=0xce;}_0x1dde78['status'](_0x4f7610);return _0x1dde78[_0x81fd('0x19')](_0x81fd('0x1a'),_0x4cc46b+'-'+_0x4e294a+'/'+_0xe1a93e)[_0x81fd('0x14')](_0x30a326);}return null;};}function patchUpdates(_0x3602e7){return function(_0x2d082d){try{jsonpatch['apply'](_0x2d082d,_0x3602e7,!![]);}catch(_0x2fa6ba){return BPromise[_0x81fd('0x1b')](_0x2fa6ba);}return _0x2d082d['save']();};}function saveUpdates(_0x4734fb,_0x58c3b5){return function(_0x7481a6){if(_0x7481a6){return _0x7481a6[_0x81fd('0x1c')](_0x4734fb)['then'](function(_0xe55fe5){return _0xe55fe5;});}return null;};}function removeEntity(_0x133ab5,_0x5e060d){return function(_0x35c4c1){if(_0x35c4c1){return _0x35c4c1[_0x81fd('0x1d')]()['then'](function(){_0x133ab5[_0x81fd('0x12')](0xcc)[_0x81fd('0x13')]();});}};}function handleEntityNotFound(_0x312629,_0x548438){return function(_0x4d02c2){if(!_0x4d02c2){_0x312629[_0x81fd('0x1e')](0x194);}return _0x4d02c2;};}function handleError(_0x4c7d74,_0xe5034){_0xe5034=_0xe5034||0x1f4;return function(_0x2f3d79){logger[_0x81fd('0x1f')](_0x2f3d79[_0x81fd('0x20')]);if(_0x2f3d79[_0x81fd('0x21')]){delete _0x2f3d79[_0x81fd('0x21')];}_0x4c7d74[_0x81fd('0x12')](_0xe5034)[_0x81fd('0x22')](_0x2f3d79);};}var utilLicense=require(_0x81fd('0x23'));exports['index']=function(_0x28b802,_0xf75b1b){var _0x26194b={'raw':!![],'where':{'id':0x1}},_0x307734={};_0x307734['model']=_[_0x81fd('0x24')](db['License'][_0x81fd('0x25')]);_0x307734[_0x81fd('0x26')]=_[_0x81fd('0x24')](_0x28b802[_0x81fd('0x26')]);_0x307734[_0x81fd('0x27')]=_[_0x81fd('0x28')](_0x307734[_0x81fd('0x29')],_0x307734[_0x81fd('0x26')]);_0x26194b[_0x81fd('0x2a')]=_[_0x81fd('0x28')](_0x307734['model'],qs['fields'](_0x28b802[_0x81fd('0x26')][_0x81fd('0x2b')]));_0x26194b[_0x81fd('0x2a')]=_0x26194b[_0x81fd('0x2a')][_0x81fd('0x2c')]?_0x26194b[_0x81fd('0x2a')]:_0x307734[_0x81fd('0x29')];_0x26194b=_['merge']({},_0x26194b,_0x28b802[_0x81fd('0x2d')]);return utilLicense[_0x81fd('0x2e')](_0x26194b)['then'](respondWithResult(_0xf75b1b,null))[_0x81fd('0x2f')](handleError(_0xf75b1b,null));};exports[_0x81fd('0x1c')]=function(_0x3789a8,_0x50a5f6){if(_0x3789a8['body']['id']){delete _0x3789a8['body']['id'];}return db['License'][_0x81fd('0x30')]({'where':{'id':_0x3789a8[_0x81fd('0x31')]['id']}})[_0x81fd('0x32')](handleEntityNotFound(_0x50a5f6,null))[_0x81fd('0x32')](function(_0x39a994){var _0x2c2549=_0x39a994[_0x81fd('0x33')]({'plain':!![]});return utilLicense[_0x81fd('0x34')](_0x2c2549,_0x3789a8[_0x81fd('0x35')][_0x81fd('0x36')]);})[_0x81fd('0x32')](function(_0x19be0a){if(!_0x19be0a[_0x81fd('0x37')]){return saveUpdates(_0x3789a8[_0x81fd('0x35')],null);}return _0x19be0a;})[_0x81fd('0x32')](respondWithResult(_0x50a5f6,null))['catch'](handleError(_0x50a5f6,null));};exports[_0x81fd('0x38')]=function(_0x57a93d,_0x26f0da){var _0x3ca1ad=_0x81fd('0x39');var _0x58ebe6=path[_0x81fd('0x3a')](_0x81fd('0x3b'),_0x81fd('0x3c'),_0x81fd('0x3d'),_0x3ca1ad);_0x26f0da[_0x81fd('0x3e')](_0x81fd('0x3f'),'attachment;\x20filename='+_0x3ca1ad);_0x26f0da[_0x81fd('0x19')](_0x81fd('0x40'),'text/plain');_0x26f0da[_0x81fd('0x41')](_0x58ebe6);}; \ No newline at end of file +var _0x3230=['moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','name','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','catch','body','find','params','get','demo','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','text/plain','download','fast-json-patch','request-promise'];(function(_0x5d0186,_0x2a6e57){var _0x25706c=function(_0x4f960d){while(--_0x4f960d){_0x5d0186['push'](_0x5d0186['shift']());}};_0x25706c(++_0x2a6e57);}(_0x3230,0x106));var _0x0323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3230[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0323('0x0'));var rp=require(_0x0323('0x1'));var moment=require(_0x0323('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0323('0x3'));var util=require(_0x0323('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0323('0x5'));var fs=require('fs');var fs_extra=require(_0x0323('0x6'));var _=require(_0x0323('0x7'));var squel=require(_0x0323('0x8'));var crypto=require(_0x0323('0x9'));var jsforce=require(_0x0323('0xa'));var deskjs=require(_0x0323('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0323('0xc'));var Papa=require('papaparse');var Redis=require(_0x0323('0xd'));var authService=require(_0x0323('0xe'));var qs=require(_0x0323('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0323('0x10'));var logger=require(_0x0323('0x11'))(_0x0323('0x12'));var utils=require(_0x0323('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0323('0x14'));var db=require(_0x0323('0x15'))['db'];function respondWithStatusCode(_0x46dbd3,_0x3d7fe5){_0x3d7fe5=_0x3d7fe5||0xcc;return function(_0x604f33){if(_0x604f33){return _0x46dbd3['sendStatus'](_0x3d7fe5);}return _0x46dbd3[_0x0323('0x16')](_0x3d7fe5)[_0x0323('0x17')]();};}function respondWithResult(_0x4bee1c,_0x3640d3){_0x3640d3=_0x3640d3||0xc8;return function(_0x49a013){if(_0x49a013){return _0x4bee1c['status'](_0x3640d3)[_0x0323('0x18')](_0x49a013);}};}function respondWithFilteredResult(_0x4f329a,_0x40c59d){return function(_0x3e9f04){if(_0x3e9f04){var _0x115c90=typeof _0x40c59d[_0x0323('0x19')]===_0x0323('0x1a')&&typeof _0x40c59d[_0x0323('0x1b')]===_0x0323('0x1a');var _0xd8272c=_0x3e9f04[_0x0323('0x1c')];var _0x3b0d66=_0x115c90?0x0:_0x40c59d[_0x0323('0x19')];var _0x68dfb1=_0x115c90?_0x3e9f04[_0x0323('0x1c')]:_0x40c59d[_0x0323('0x19')]+_0x40c59d[_0x0323('0x1b')];var _0x5380de;if(_0x68dfb1>=_0xd8272c){_0x68dfb1=_0xd8272c;_0x5380de=0xc8;}else{_0x5380de=0xce;}_0x4f329a[_0x0323('0x16')](_0x5380de);return _0x4f329a['set']('Content-Range',_0x3b0d66+'-'+_0x68dfb1+'/'+_0xd8272c)[_0x0323('0x18')](_0x3e9f04);}return null;};}function patchUpdates(_0x11f3f8){return function(_0x45953a){try{jsonpatch[_0x0323('0x1d')](_0x45953a,_0x11f3f8,!![]);}catch(_0x171227){return BPromise[_0x0323('0x1e')](_0x171227);}return _0x45953a[_0x0323('0x1f')]();};}function saveUpdates(_0x5dd3b0,_0x323ad8){return function(_0xfff6e9){if(_0xfff6e9){return _0xfff6e9[_0x0323('0x20')](_0x5dd3b0)[_0x0323('0x21')](function(_0x37f1dd){return _0x37f1dd;});}return null;};}function removeEntity(_0x24f1ae,_0x5e3190){return function(_0x1bc93b){if(_0x1bc93b){return _0x1bc93b[_0x0323('0x22')]()[_0x0323('0x21')](function(){_0x24f1ae[_0x0323('0x16')](0xcc)[_0x0323('0x17')]();});}};}function handleEntityNotFound(_0x1334f0,_0x1db8a5){return function(_0x5cf0ad){if(!_0x5cf0ad){_0x1334f0[_0x0323('0x23')](0x194);}return _0x5cf0ad;};}function handleError(_0x32cc7c,_0x4941de){_0x4941de=_0x4941de||0x1f4;return function(_0x1e7df2){logger[_0x0323('0x24')](_0x1e7df2['stack']);if(_0x1e7df2['name']){delete _0x1e7df2[_0x0323('0x25')];}_0x32cc7c['status'](_0x4941de)['send'](_0x1e7df2);};}var utilLicense=require(_0x0323('0x14'));exports[_0x0323('0x26')]=function(_0x5eb25d,_0x4784da){var _0x5e488b={'raw':!![],'where':{'id':0x1}},_0xbe3bca={};_0xbe3bca[_0x0323('0x27')]=_[_0x0323('0x28')](db['License'][_0x0323('0x29')]);_0xbe3bca[_0x0323('0x2a')]=_['keys'](_0x5eb25d[_0x0323('0x2a')]);_0xbe3bca[_0x0323('0x2b')]=_[_0x0323('0x2c')](_0xbe3bca['model'],_0xbe3bca[_0x0323('0x2a')]);_0x5e488b['attributes']=_[_0x0323('0x2c')](_0xbe3bca[_0x0323('0x27')],qs['fields'](_0x5eb25d[_0x0323('0x2a')][_0x0323('0x2d')]));_0x5e488b[_0x0323('0x2e')]=_0x5e488b['attributes'][_0x0323('0x2f')]?_0x5e488b['attributes']:_0xbe3bca[_0x0323('0x27')];_0x5e488b=_['merge']({},_0x5e488b,_0x5eb25d[_0x0323('0x30')]);return utilLicense[_0x0323('0x31')](_0x5e488b)[_0x0323('0x21')](respondWithResult(_0x4784da,null))[_0x0323('0x32')](handleError(_0x4784da,null));};exports[_0x0323('0x20')]=function(_0x5728b8,_0x2fbe3d){if(_0x5728b8[_0x0323('0x33')]['id']){delete _0x5728b8[_0x0323('0x33')]['id'];}return db['License'][_0x0323('0x34')]({'where':{'id':_0x5728b8[_0x0323('0x35')]['id']}})[_0x0323('0x21')](handleEntityNotFound(_0x2fbe3d,null))[_0x0323('0x21')](function(_0x4c4db6){var _0x11978d=_0x4c4db6[_0x0323('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x11978d,_0x5728b8['body']['key']);})[_0x0323('0x21')](function(_0x2845e6){if(!_0x2845e6[_0x0323('0x37')]){return saveUpdates(_0x5728b8[_0x0323('0x33')],null);}return _0x2845e6;})[_0x0323('0x21')](respondWithResult(_0x2fbe3d,null))[_0x0323('0x32')](handleError(_0x2fbe3d,null));};exports['downloadLogFile']=function(_0x39800e,_0x58ee77){var _0x455064=_0x0323('0x38');var _0x8748e2=path[_0x0323('0x39')]('/var',_0x0323('0x3a'),_0x0323('0x3b'),_0x455064);_0x58ee77[_0x0323('0x3c')](_0x0323('0x3d'),_0x0323('0x3e')+_0x455064);_0x58ee77[_0x0323('0x3f')]('Content-Type',_0x0323('0x40'));_0x58ee77[_0x0323('0x41')](_0x8748e2);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f9d709e..fbd9db0 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 _0x5eca=['./license.attributes','exports','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x5eca,0x138));var _0xa5ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5eca[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa5ec('0x0'));var util=require(_0xa5ec('0x1'));var logger=require(_0xa5ec('0x2'))(_0xa5ec('0x3'));var moment=require('moment');var BPromise=require(_0xa5ec('0x4'));var rp=require(_0xa5ec('0x5'));var fs=require('fs');var path=require(_0xa5ec('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5ec('0x7'));module[_0xa5ec('0x8')]=function(_0x120bac,_0x2f3887){return _0x120bac['define'](_0xa5ec('0x9'),attributes,{'tableName':_0xa5ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x680c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','License','license','util'];(function(_0x1678d0,_0x8a799c){var _0x1ff3c1=function(_0x53e4e2){while(--_0x53e4e2){_0x1678d0['push'](_0x1678d0['shift']());}};_0x1ff3c1(++_0x8a799c);}(_0x680c,0xc2));var _0xc680=function(_0x45ff95,_0x4c138e){_0x45ff95=_0x45ff95-0x0;var _0x3ff0a7=_0x680c[_0x45ff95];return _0x3ff0a7;};'use strict';var _=require('lodash');var util=require(_0xc680('0x0'));var logger=require(_0xc680('0x1'))(_0xc680('0x2'));var moment=require(_0xc680('0x3'));var BPromise=require(_0xc680('0x4'));var rp=require(_0xc680('0x5'));var fs=require('fs');var path=require(_0xc680('0x6'));var rimraf=require(_0xc680('0x7'));var config=require(_0xc680('0x8'));var attributes=require(_0xc680('0x9'));module[_0xc680('0xa')]=function(_0x34c5ae,_0x2d4ef0){return _0x34c5ae['define'](_0xc680('0xb'),attributes,{'tableName':_0xc680('0xc'),'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 a849be9..1b94d90 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 _0xc572=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','request\x20sent'];(function(_0x333195,_0x366608){var _0x2e44de=function(_0x5c1dd7){while(--_0x5c1dd7){_0x333195['push'](_0x333195['shift']());}};_0x2e44de(++_0x366608);}(_0xc572,0xe5));var _0x2c57=function(_0x937506,_0x32072c){_0x937506=_0x937506-0x0;var _0x5d6d09=_0xc572[_0x937506];return _0x5d6d09;};'use strict';var _=require(_0x2c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c57('0x1'));var fs=require('fs');var Redis=require(_0x2c57('0x2'));var db=require(_0x2c57('0x3'))['db'];var utils=require(_0x2c57('0x4'));var logger=require(_0x2c57('0x5'))(_0x2c57('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c57('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a322d,_0x142d12,_0xfcc5da){return new BPromise(function(_0xcec0f3,_0x5b1322){return client['request'](_0x3a322d,_0xfcc5da)[_0x2c57('0x8')](function(_0x4f0dff){logger[_0x2c57('0x9')]('License,\x20%s,\x20%s',_0x142d12,_0x2c57('0xa'));logger[_0x2c57('0xb')](_0x2c57('0xc'),_0x142d12,_0x2c57('0xa'),JSON[_0x2c57('0xd')](_0x4f0dff));if(_0x4f0dff[_0x2c57('0xe')]){if(_0x4f0dff[_0x2c57('0xe')][_0x2c57('0xf')]===0x1f4){logger['error'](_0x2c57('0x10'),_0x142d12,_0x4f0dff[_0x2c57('0xe')]['message']);return _0x5b1322(_0x4f0dff['error'][_0x2c57('0x11')]);}logger[_0x2c57('0xe')](_0x2c57('0x10'),_0x142d12,_0x4f0dff[_0x2c57('0xe')]['message']);return _0xcec0f3(_0x4f0dff['error']['message']);}else{logger[_0x2c57('0x9')](_0x2c57('0x10'),_0x142d12,_0x2c57('0xa'));_0xcec0f3(_0x4f0dff[_0x2c57('0x12')]['message']);}})[_0x2c57('0x13')](function(_0x5484f7){logger[_0x2c57('0xe')]('License,\x20%s,\x20%s',_0x142d12,_0x5484f7);_0x5b1322(_0x5484f7);});});} \ No newline at end of file +var _0x35a2=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1040c8,_0x1baa50){var _0x5d0df0=function(_0x182b7f){while(--_0x182b7f){_0x1040c8['push'](_0x1040c8['shift']());}};_0x5d0df0(++_0x1baa50);}(_0x35a2,0x1e2));var _0x235a=function(_0x542312,_0x54895d){_0x542312=_0x542312-0x0;var _0x4d73a0=_0x35a2[_0x542312];return _0x4d73a0;};'use strict';var _=require(_0x235a('0x0'));var util=require(_0x235a('0x1'));var moment=require(_0x235a('0x2'));var BPromise=require(_0x235a('0x3'));var rs=require(_0x235a('0x4'));var fs=require('fs');var Redis=require(_0x235a('0x5'));var db=require(_0x235a('0x6'))['db'];var utils=require(_0x235a('0x7'));var logger=require(_0x235a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x235a('0x9'));var client=jayson[_0x235a('0xa')][_0x235a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21041c,_0x268a3c,_0x4f140c){return new BPromise(function(_0x374208,_0x102002){return client['request'](_0x21041c,_0x4f140c)[_0x235a('0xc')](function(_0xbcc7f2){logger[_0x235a('0xd')](_0x235a('0xe'),_0x268a3c,_0x235a('0xf'));logger['debug'](_0x235a('0x10'),_0x268a3c,_0x235a('0xf'),JSON[_0x235a('0x11')](_0xbcc7f2));if(_0xbcc7f2['error']){if(_0xbcc7f2[_0x235a('0x12')][_0x235a('0x13')]===0x1f4){logger[_0x235a('0x12')](_0x235a('0xe'),_0x268a3c,_0xbcc7f2[_0x235a('0x12')][_0x235a('0x14')]);return _0x102002(_0xbcc7f2[_0x235a('0x12')][_0x235a('0x14')]);}logger['error'](_0x235a('0xe'),_0x268a3c,_0xbcc7f2['error'][_0x235a('0x14')]);return _0x374208(_0xbcc7f2[_0x235a('0x12')][_0x235a('0x14')]);}else{logger[_0x235a('0xd')](_0x235a('0xe'),_0x268a3c,_0x235a('0xf'));_0x374208(_0xbcc7f2[_0x235a('0x15')][_0x235a('0x14')]);}})[_0x235a('0x16')](function(_0x3fb562){logger[_0x235a('0x12')]('License,\x20%s,\x20%s',_0x268a3c,_0x3fb562);_0x102002(_0x3fb562);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 887d9d4..655be52 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 _0x083b=['/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','destroy','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers'];(function(_0xd79240,_0x5c9f09){var _0x4645dc=function(_0x41cfbc){while(--_0x41cfbc){_0xd79240['push'](_0xd79240['shift']());}};_0x4645dc(++_0x5c9f09);}(_0x083b,0x194));var _0xb083=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x083b[_0x57486e];return _0x5f110b;};'use strict';var multer=require(_0xb083('0x0'));var util=require(_0xb083('0x1'));var path=require(_0xb083('0x2'));var timeout=require('connect-timeout');var express=require(_0xb083('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb083('0x4'));var interaction=require(_0xb083('0x5'));var config=require(_0xb083('0x6'));var controller=require(_0xb083('0x7'));router[_0xb083('0x8')]('/',auth['isAuthenticated'](),controller[_0xb083('0x9')]);router[_0xb083('0x8')](_0xb083('0xa'),auth[_0xb083('0xb')](),controller[_0xb083('0xc')]);router[_0xb083('0x8')](_0xb083('0xd'),auth[_0xb083('0xb')](),controller['show']);router[_0xb083('0x8')](_0xb083('0xe'),auth[_0xb083('0xb')](),controller[_0xb083('0xf')]);router[_0xb083('0x8')](_0xb083('0x10'),auth['isAuthenticated'](),controller[_0xb083('0x11')]);router['get'](_0xb083('0x12'),auth[_0xb083('0xb')](),controller['getImap']);router[_0xb083('0x8')](_0xb083('0x13'),auth[_0xb083('0xb')](),controller[_0xb083('0x14')]);router[_0xb083('0x8')](_0xb083('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb083('0x8')](_0xb083('0x16'),auth['isAuthenticated'](),controller[_0xb083('0x17')]);router['get'](_0xb083('0x18'),auth[_0xb083('0xb')](),controller[_0xb083('0x19')]);router[_0xb083('0x8')](_0xb083('0x1a'),auth[_0xb083('0xb')](),controller[_0xb083('0x1b')]);router[_0xb083('0x8')](_0xb083('0x1c'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb083('0x1d')](_0xb083('0xe'),auth['isAuthenticated'](),controller[_0xb083('0x1e')]);router[_0xb083('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xb083('0x1d')]('/',auth[_0xb083('0xb')](),controller[_0xb083('0x1f')]);router[_0xb083('0x1d')](_0xb083('0x12'),auth['isAuthenticated'](),controller[_0xb083('0x20')]);router[_0xb083('0x1d')](_0xb083('0x13'),auth[_0xb083('0xb')](),controller[_0xb083('0x21')]);router[_0xb083('0x1d')]('/:id/interactions',auth[_0xb083('0xb')](),controller[_0xb083('0x22')]);router[_0xb083('0x1d')](_0xb083('0x16'),auth[_0xb083('0xb')](),controller[_0xb083('0x23')]);router[_0xb083('0x1d')](_0xb083('0x24'),auth[_0xb083('0xb')](),controller[_0xb083('0x25')]);router['post'](_0xb083('0x1c'),auth[_0xb083('0xb')](),controller[_0xb083('0x26')]);router[_0xb083('0x27')](_0xb083('0xd'),auth[_0xb083('0xb')](),controller[_0xb083('0x28')]);router['delete']('/:id/dispositions',auth[_0xb083('0xb')](),controller[_0xb083('0x29')]);router[_0xb083('0x2a')]('/:id/canned_answers',auth[_0xb083('0xb')](),controller[_0xb083('0x2b')]);router[_0xb083('0x2a')](_0xb083('0x12'),auth[_0xb083('0xb')](),controller[_0xb083('0x2c')]);router['delete'](_0xb083('0x13'),auth[_0xb083('0xb')](),controller['removeSmtp']);router[_0xb083('0x2a')](_0xb083('0xd'),auth[_0xb083('0xb')](),controller[_0xb083('0x2d')]);router[_0xb083('0x2a')](_0xb083('0x1c'),auth[_0xb083('0xb')](),controller[_0xb083('0x2e')]);module['exports']=router; \ No newline at end of file +var _0xaefa=['getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','/:id/send','/:id/users','addAgents','/:id','update','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x2977fc,_0x2a78df){var _0x1ac573=function(_0x3982a6){while(--_0x3982a6){_0x2977fc['push'](_0x2977fc['shift']());}};_0x1ac573(++_0x2a78df);}(_0xaefa,0x1df));var _0xaaef=function(_0x5a3277,_0x477100){_0x5a3277=_0x5a3277-0x0;var _0x3da47b=_0xaefa[_0x5a3277];return _0x3da47b;};'use strict';var multer=require(_0xaaef('0x0'));var util=require('util');var path=require(_0xaaef('0x1'));var timeout=require(_0xaaef('0x2'));var express=require(_0xaaef('0x3'));var router=express['Router']();var fs_extra=require(_0xaaef('0x4'));var auth=require(_0xaaef('0x5'));var interaction=require(_0xaaef('0x6'));var config=require(_0xaaef('0x7'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xaaef('0x8')]);router[_0xaaef('0x9')]('/describe',auth[_0xaaef('0xa')](),controller[_0xaaef('0xb')]);router[_0xaaef('0x9')]('/:id',auth[_0xaaef('0xa')](),controller['show']);router['get'](_0xaaef('0xc'),auth[_0xaaef('0xa')](),controller[_0xaaef('0xd')]);router[_0xaaef('0x9')](_0xaaef('0xe'),auth[_0xaaef('0xa')](),controller[_0xaaef('0xf')]);router[_0xaaef('0x9')]('/:id/in_servers',auth[_0xaaef('0xa')](),controller[_0xaaef('0x10')]);router[_0xaaef('0x9')](_0xaaef('0x11'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x12')]);router[_0xaaef('0x9')](_0xaaef('0x13'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x14')]);router['get'](_0xaaef('0x15'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x16')]);router[_0xaaef('0x9')]('/:id/messages',auth[_0xaaef('0xa')](),controller['getMessages']);router[_0xaaef('0x9')]('/:id/verify',auth[_0xaaef('0xa')](),controller[_0xaaef('0x17')]);router[_0xaaef('0x9')]('/:id/users',auth[_0xaaef('0xa')](),controller[_0xaaef('0x18')]);router[_0xaaef('0x19')](_0xaaef('0xc'),auth['isAuthenticated'](),controller[_0xaaef('0x1a')]);router['post'](_0xaaef('0xe'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x1b')]);router['post']('/',auth[_0xaaef('0xa')](),controller[_0xaaef('0x1c')]);router[_0xaaef('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0xaaef('0x19')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xaaef('0x1d')]);router[_0xaaef('0x19')](_0xaaef('0x13'),auth['isAuthenticated'](),controller[_0xaaef('0x1e')]);router['post'](_0xaaef('0x15'),auth[_0xaaef('0xa')](),controller['addApplications']);router['post'](_0xaaef('0x1f'),auth[_0xaaef('0xa')](),controller['send']);router['post'](_0xaaef('0x20'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x21')]);router['put'](_0xaaef('0x22'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x23')]);router[_0xaaef('0x24')]('/:id/dispositions',auth[_0xaaef('0xa')](),controller[_0xaaef('0x25')]);router[_0xaaef('0x24')](_0xaaef('0xe'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x26')]);router['delete'](_0xaaef('0x27'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x28')]);router[_0xaaef('0x24')](_0xaaef('0x11'),auth[_0xaaef('0xa')](),controller[_0xaaef('0x29')]);router[_0xaaef('0x24')](_0xaaef('0x22'),auth['isAuthenticated'](),controller[_0xaaef('0x2a')]);router[_0xaaef('0x24')]('/:id/users',auth[_0xaaef('0xa')](),controller[_0xaaef('0x2b')]);module[_0xaaef('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 90412ac..e52425c 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 _0x7ac2=['STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x1d4588,_0x62252a){var _0x196081=function(_0x2d3c6b){while(--_0x2d3c6b){_0x1d4588['push'](_0x1d4588['shift']());}};_0x196081(++_0x62252a);}(_0x7ac2,0x142));var _0x27ac=function(_0x2dd9b3,_0x1a705a){_0x2dd9b3=_0x2dd9b3-0x0;var _0x16db12=_0x7ac2[_0x2dd9b3];return _0x16db12;};'use strict';var Sequelize=require(_0x27ac('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x27ac('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x27ac('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x27ac('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x27ac('0x3')],'defaultValue':function(){return _0x27ac('0x4');}},'notificationSound':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x27ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x27ac('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x27ac('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x27ac('0x2')],'defaultValue':![],'comment':_0x27ac('0x7'),'set':function(_0x4425d8){if(!_0x4425d8)this['setDataValue'](_0x27ac('0x8'),null);this[_0x27ac('0x9')]('mandatoryDisposition',_0x4425d8);}},'provider':{'type':Sequelize[_0x27ac('0xa')](_0x27ac('0xb'),'hotmail',_0x27ac('0xc'),_0x27ac('0xd')),'defaultValue':null,'get':function(){if(!this[_0x27ac('0xe')](_0x27ac('0xf')))return _0x27ac('0x10');return this[_0x27ac('0xe')](_0x27ac('0xf'));},'set':function(_0x5dddac){if(_0x5dddac==='custom')_0x5dddac=null;return this['setDataValue']('provider',_0x5dddac);}}}; \ No newline at end of file +var _0x9393=['mandatoryDisposition','ENUM','gmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x9393,0x147));var _0x3939=function(_0x4f16e9,_0x44ea59){_0x4f16e9=_0x4f16e9-0x0;var _0x36dd05=_0x9393[_0x4f16e9];return _0x36dd05;};'use strict';var Sequelize=require(_0x3939('0x0'));module[_0x3939('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3939('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x3939('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3939('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3939('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x3939('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x3939('0x4')]},'markAsUnread':{'type':Sequelize[_0x3939('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x3939('0x2')],'allowNull':![],'defaultValue':_0x3939('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x3939('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3939('0x4')],'defaultValue':function(){return _0x3939('0x7');}},'notificationSound':{'type':Sequelize[_0x3939('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3939('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3939('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3939('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3939('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3939('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3939('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x3939('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x3939('0x3')],'defaultValue':![],'comment':_0x3939('0xa'),'set':function(_0x2349fe){if(!_0x2349fe)this[_0x3939('0xb')](_0x3939('0xc'),null);this[_0x3939('0xb')](_0x3939('0xd'),_0x2349fe);}},'provider':{'type':Sequelize[_0x3939('0xe')](_0x3939('0xf'),'hotmail',_0x3939('0x10'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x3939('0x11')](_0x3939('0x12')))return _0x3939('0x13');return this[_0x3939('0x11')]('provider');},'set':function(_0x53418f){if(_0x53418f==='custom')_0x53418f=null;return this['setDataValue'](_0x3939('0x12'),_0x53418f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5ae5566..fa6742c 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 _0x8a8b=['then','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','filter','type','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','Pause','fields','merge','update','body','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','custom','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','finally','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List','List\x20not\x20found','Contacts','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','json','destroy','MailAccounts','UserProfileResource'];(function(_0x27f493,_0x173006){var _0x777a3b=function(_0x1bd40e){while(--_0x1bd40e){_0x27f493['push'](_0x27f493['shift']());}};_0x777a3b(++_0x173006);}(_0x8a8b,0xa3));var _0xb8a8=function(_0xa8229b,_0x37fdae){_0xa8229b=_0xa8229b-0x0;var _0x37880f=_0x8a8b[_0xa8229b];return _0x37880f;};'use strict';var moment=require(_0xb8a8('0x0'));var BPromise=require(_0xb8a8('0x1'));var util=require(_0xb8a8('0x2'));var path=require(_0xb8a8('0x3'));var _=require('lodash');var juice=require(_0xb8a8('0x4'));var Redis=require(_0xb8a8('0x5'));var qs=require(_0xb8a8('0x6'));var logger=require(_0xb8a8('0x7'))(_0xb8a8('0x8'));var config=require(_0xb8a8('0x9'));var db=require('../../mysqldb')['db'];config[_0xb8a8('0xa')]=_[_0xb8a8('0xb')](config[_0xb8a8('0xa')],{'host':_0xb8a8('0xc'),'port':0x18eb});var socket=require(_0xb8a8('0xd'))(new Redis(config['redis']));require(_0xb8a8('0xe'))[_0xb8a8('0xf')](socket);var jayson=require(_0xb8a8('0x10'));var client=jayson[_0xb8a8('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x456ea2,_0x4cb5f5,_0x59b2c7,_0x10beb3){return new BPromise(function(_0x50a923,_0xbdbc7d){var _0x6e4956=_0x10beb3||client;return _0x6e4956[_0xb8a8('0x12')](_0x456ea2,_0x59b2c7)['then'](function(_0x5af3eb){logger[_0xb8a8('0x13')](_0xb8a8('0x14'),_0x4cb5f5,_0xb8a8('0x15'));logger[_0xb8a8('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4cb5f5,_0xb8a8('0x15'),JSON[_0xb8a8('0x17')](_0x5af3eb));if(_0x5af3eb[_0xb8a8('0x18')]){if(_0x5af3eb[_0xb8a8('0x18')][_0xb8a8('0x19')]===0x1f4){logger[_0xb8a8('0x18')](_0xb8a8('0x14'),_0x4cb5f5,_0x5af3eb['error'][_0xb8a8('0x1a')]);return _0xbdbc7d(_0x5af3eb[_0xb8a8('0x18')][_0xb8a8('0x1a')]);}logger['error'](_0xb8a8('0x14'),_0x4cb5f5,_0x5af3eb[_0xb8a8('0x18')]['message']);return _0x50a923(_0x5af3eb['error'][_0xb8a8('0x1a')]);}else{logger[_0xb8a8('0x13')](_0xb8a8('0x14'),_0x4cb5f5,_0xb8a8('0x15'));_0x50a923(_0x5af3eb[_0xb8a8('0x1b')][_0xb8a8('0x1a')]);}})[_0xb8a8('0x1c')](function(_0x279b3c){logger[_0xb8a8('0x18')](_0xb8a8('0x14'),_0x4cb5f5,_0x279b3c);_0xbdbc7d(_0x279b3c);});});}function respondWithStatusCode(_0x383353,_0xc6f258){_0xc6f258=_0xc6f258||0xcc;return function(_0x1e3a91){if(_0x1e3a91){return _0x383353[_0xb8a8('0x1d')](_0xc6f258);}return _0x383353[_0xb8a8('0x1e')](_0xc6f258)[_0xb8a8('0x1f')]();};}function respondWithResult(_0x59d18d,_0x29af13){_0x29af13=_0x29af13||0xc8;return function(_0x5e3f07){if(_0x5e3f07){return _0x59d18d[_0xb8a8('0x1e')](_0x29af13)['json'](_0x5e3f07);}};}function respondWithFilteredResult(_0x97b721,_0x3b156b){return function(_0x5db9fa){if(_0x5db9fa){var _0x179fef=typeof _0x3b156b[_0xb8a8('0x20')]==='undefined'&&typeof _0x3b156b[_0xb8a8('0x21')]===_0xb8a8('0x22');var _0x928a92=_0x5db9fa[_0xb8a8('0x23')];var _0x4e19ac=_0x179fef?0x0:_0x3b156b['offset'];var _0x20d05b=_0x179fef?_0x5db9fa[_0xb8a8('0x23')]:_0x3b156b['offset']+_0x3b156b[_0xb8a8('0x21')];var _0x2ee24f;if(_0x20d05b>=_0x928a92){_0x20d05b=_0x928a92;_0x2ee24f=0xc8;}else{_0x2ee24f=0xce;}_0x97b721[_0xb8a8('0x1e')](_0x2ee24f);return _0x97b721['set']('Content-Range',_0x4e19ac+'-'+_0x20d05b+'/'+_0x928a92)[_0xb8a8('0x24')](_0x5db9fa);}return null;};}function saveUpdates(_0x17b3c4){return function(_0x52f52d){if(_0x52f52d){return _0x52f52d['update'](_0x17b3c4)['then'](function(_0x3d8813){return _0x3d8813;});}return null;};}function removeEntity(_0x451f5e){return function(_0x4adfa9){if(_0x4adfa9){return _0x4adfa9[_0xb8a8('0x25')]()['then'](function(){var _0x5fa761=_0x4adfa9['get']({'plain':!![]});var _0x35553d=_0xb8a8('0x26');return db[_0xb8a8('0x27')]['destroy']({'where':{'type':_0x35553d,'resourceId':_0x5fa761['id']}})[_0xb8a8('0x28')](function(){return _0x4adfa9;});})[_0xb8a8('0x28')](function(){_0x451f5e[_0xb8a8('0x1e')](0xcc)[_0xb8a8('0x1f')]();});}};}function handleEntityNotFound(_0x199f33){return function(_0x422a6a){if(!_0x422a6a){_0x199f33[_0xb8a8('0x1d')](0x194);}return _0x422a6a;};}function handleError(_0x237b74,_0x11eebb){_0x11eebb=_0x11eebb||0x1f4;return function(_0x52374a){logger[_0xb8a8('0x18')](_0x52374a[_0xb8a8('0x29')]);if(_0x52374a[_0xb8a8('0x2a')]){delete _0x52374a[_0xb8a8('0x2a')];}_0x237b74[_0xb8a8('0x1e')](_0x11eebb)[_0xb8a8('0x2b')](_0x52374a);};}function getImapHost(_0x26b596){switch(_0x26b596){case _0xb8a8('0x2c'):return _0xb8a8('0x2d');case _0xb8a8('0x2e'):return _0xb8a8('0x2f');case _0xb8a8('0x30'):return _0xb8a8('0x31');case _0xb8a8('0x32'):return _0xb8a8('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x26b596);}function getSmtpHost(_0x3d746d){switch(_0x3d746d){case _0xb8a8('0x2c'):return'smtp.gmail.com';case _0xb8a8('0x2e'):return _0xb8a8('0x34');case _0xb8a8('0x30'):return _0xb8a8('0x35');case _0xb8a8('0x32'):return _0xb8a8('0x36');}throw new Error(_0xb8a8('0x37'),_0x3d746d);}function getAuthenticationOptions(_0x173706,_0x4caca5){var _0x52bca6={};var _0x5496cb={};if(_0x173706){_0x52bca6[_0xb8a8('0x38')]=_0x5496cb[_0xb8a8('0x38')]=_0x4caca5['username'];_0x52bca6['password']=_0x5496cb[_0xb8a8('0x39')]=_0x4caca5['password'];if(_0x4caca5['modernAuthentication']){_0x52bca6[_0xb8a8('0x3a')]=_0x5496cb['modernAuthentication']=!![];_0x52bca6[_0xb8a8('0x3b')]=_0x5496cb[_0xb8a8('0x3b')]=_0x4caca5[_0xb8a8('0x3b')];_0x52bca6[_0xb8a8('0x3c')]=_0x5496cb['pass']=null;}else{_0x52bca6['CloudProviderId']=_0x5496cb[_0xb8a8('0x3b')]=null;}_0x52bca6[_0xb8a8('0x3d')]=getImapHost(_0x173706);_0x52bca6[_0xb8a8('0x3e')]=0x3e1;_0x5496cb['host']=getSmtpHost(_0x173706);_0x5496cb[_0xb8a8('0x3e')]=0x24b;_0x5496cb[_0xb8a8('0x3f')]=![];_0x52bca6['service']=_0x5496cb[_0xb8a8('0x40')]=null;}else{if(_0x4caca5[_0xb8a8('0x41')]){_0x52bca6[_0xb8a8('0x38')]=_0x5496cb[_0xb8a8('0x38')]=_0x4caca5[_0xb8a8('0x42')];_0x52bca6[_0xb8a8('0x3c')]=_0x5496cb['pass']=_0x4caca5['password'];}else{_0x52bca6['authentication']=_0x5496cb[_0xb8a8('0x41')]=![];_0x52bca6[_0xb8a8('0x38')]=_0x5496cb['user']=null;_0x52bca6[_0xb8a8('0x3c')]=_0x5496cb['pass']=null;}_0x52bca6['host']=_0x4caca5[_0xb8a8('0x43')][_0xb8a8('0x3d')];_0x52bca6[_0xb8a8('0x3e')]=_0x4caca5[_0xb8a8('0x43')][_0xb8a8('0x3e')];_0x5496cb[_0xb8a8('0x3d')]=_0x4caca5[_0xb8a8('0x44')][_0xb8a8('0x3d')];_0x5496cb['port']=_0x4caca5[_0xb8a8('0x44')][_0xb8a8('0x3e')];}return{'Imap':_0x52bca6,'Smtp':_0x5496cb};}exports[_0xb8a8('0x45')]=function(_0x23400e,_0x5c2755){var _0x378ecd={'include':[{'model':db[_0xb8a8('0x46')],'as':_0xb8a8('0x43')},{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44')},{'model':db['Pause'],'as':_0xb8a8('0x48')}]},_0x3b0aec={},_0x4a17a8={'count':0x0,'rows':[]};var _0xf65d8=_[_0xb8a8('0x49')](db[_0xb8a8('0x4a')][_0xb8a8('0x4b')],function(_0x51e0fa){return{'name':_0x51e0fa[_0xb8a8('0x4c')],'type':_0x51e0fa['type'][_0xb8a8('0x4d')]};});_0x3b0aec[_0xb8a8('0x4e')]=_[_0xb8a8('0x49')](_0xf65d8,_0xb8a8('0x2a'));_0x3b0aec[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x23400e[_0xb8a8('0x4f')]);_0x3b0aec[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x3b0aec[_0xb8a8('0x4e')],_0x3b0aec['query']);_0x378ecd['attributes']=_[_0xb8a8('0x52')](_0x3b0aec[_0xb8a8('0x4e')],qs['fields'](_0x23400e['query']['fields']));_0x378ecd['attributes']=_0x378ecd['attributes'][_0xb8a8('0x53')]?_0x378ecd[_0xb8a8('0x54')]:_0x3b0aec[_0xb8a8('0x4e')];if(!_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x55')](_0xb8a8('0x56'))){_0x378ecd[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x21')]);_0x378ecd['offset']=qs['offset'](_0x23400e[_0xb8a8('0x4f')]['offset']);}_0x378ecd[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x58')]);_0x378ecd['where']=qs[_0xb8a8('0x51')](_['pick'](_0x23400e[_0xb8a8('0x4f')],_0x3b0aec[_0xb8a8('0x51')]),_0xf65d8);if(_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x59')]){_0x378ecd['where']=_['merge'](_0x378ecd['where'],{'$or':_['map'](_0xf65d8,function(_0x1db32d){if(_0x1db32d[_0xb8a8('0x5a')]!==_0xb8a8('0x5b')){var _0x51c4fe={};_0x51c4fe[_0x1db32d[_0xb8a8('0x2a')]]={'$like':'%'+_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x59')]+'%'};return _0x51c4fe;}})});}_0x378ecd=_['merge']({},_0x378ecd,_0x23400e[_0xb8a8('0x5c')]);var _0x2bd559={'where':_0x378ecd[_0xb8a8('0x5d')]};return db[_0xb8a8('0x4a')][_0xb8a8('0x23')](_0x2bd559)[_0xb8a8('0x28')](function(_0x85d7ce){_0x4a17a8[_0xb8a8('0x23')]=_0x85d7ce;if(_0x23400e[_0xb8a8('0x4f')][_0xb8a8('0x5e')]){_0x378ecd[_0xb8a8('0x5f')]=[{'all':!![]}];}return db[_0xb8a8('0x4a')][_0xb8a8('0x60')](_0x378ecd);})[_0xb8a8('0x28')](function(_0x5b256d){_0x4a17a8[_0xb8a8('0x61')]=_0x5b256d;return _0x4a17a8;})[_0xb8a8('0x28')](respondWithFilteredResult(_0x5c2755,_0x378ecd))['catch'](handleError(_0x5c2755,null));};exports[_0xb8a8('0x62')]=function(_0x9c2531,_0x19858c){var _0x346e0e={'raw':![],'where':{'id':_0x9c2531[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0x46')],'as':_0xb8a8('0x43')},{'model':db['MailServerOut'],'as':_0xb8a8('0x44')},{'model':db[_0xb8a8('0x64')],'as':_0xb8a8('0x48')}]},_0x1e7e9c={};_0x1e7e9c[_0xb8a8('0x4e')]=_['keys'](db[_0xb8a8('0x4a')]['rawAttributes']);_0x1e7e9c['query']=_[_0xb8a8('0x50')](_0x9c2531[_0xb8a8('0x4f')]);_0x1e7e9c['filters']=_[_0xb8a8('0x52')](_0x1e7e9c[_0xb8a8('0x4e')],_0x1e7e9c[_0xb8a8('0x4f')]);_0x346e0e[_0xb8a8('0x54')]=_[_0xb8a8('0x52')](_0x1e7e9c[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x9c2531[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0x346e0e['attributes']=_0x346e0e[_0xb8a8('0x54')]['length']?_0x346e0e['attributes']:_0x1e7e9c[_0xb8a8('0x4e')];if(_0x9c2531[_0xb8a8('0x4f')][_0xb8a8('0x5e')]){_0x346e0e[_0xb8a8('0x5f')]=[{'all':!![]}];}_0x346e0e=_[_0xb8a8('0x66')]({},_0x346e0e,_0x9c2531['options']);return db[_0xb8a8('0x4a')]['find'](_0x346e0e)[_0xb8a8('0x28')](handleEntityNotFound(_0x19858c,null))[_0xb8a8('0x28')](respondWithResult(_0x19858c,null))[_0xb8a8('0x1c')](handleError(_0x19858c,null));};exports[_0xb8a8('0x67')]=function(_0x55a338,_0x17bf5e){if(_0x55a338[_0xb8a8('0x68')]['id']){delete _0x55a338[_0xb8a8('0x68')]['id'];}var _0x521724=_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x69')]==='custom'?null:_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x69')];var _0x3a49e4=_0x55a338[_0xb8a8('0x68')]['Imap']||{};var _0x1cd562=_0x55a338[_0xb8a8('0x68')]['Smtp']||{};if(_0x521724){_0x3a49e4[_0xb8a8('0x3d')]=getImapHost(_0x521724);_0x3a49e4[_0xb8a8('0x3e')]=0x3e1;_0x1cd562[_0xb8a8('0x3d')]=getSmtpHost(_0x521724);_0x1cd562[_0xb8a8('0x3e')]=0x24b;_0x1cd562['secure']=![];}if(_0x1cd562[_0xb8a8('0x3a')]){_0x1cd562[_0xb8a8('0x3f')]=![];}else{_0x1cd562[_0xb8a8('0x3b')]=null;}if(!_0x3a49e4[_0xb8a8('0x3a')])_0x3a49e4[_0xb8a8('0x3b')]=null;_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x43')]=_0x3a49e4;_0x55a338[_0xb8a8('0x68')]['Smtp']=_0x1cd562;return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x55a338[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0x46')],'as':_0xb8a8('0x43')},{'model':db[_0xb8a8('0x47')],'as':'Smtp'},{'model':db[_0xb8a8('0x64')],'as':_0xb8a8('0x48')}]})[_0xb8a8('0x28')](handleEntityNotFound(_0x17bf5e,null))[_0xb8a8('0x28')](function(_0x1b50c5){if(!_0x1b50c5)throw new Error(_0xb8a8('0x6b'));if(_0x1b50c5[_0xb8a8('0x40')])delete _0x55a338['body'][_0xb8a8('0x43')];return _0x1b50c5;})[_0xb8a8('0x28')](saveUpdates(_0x55a338[_0xb8a8('0x68')],null))[_0xb8a8('0x28')](function(_0xfd0116){if(!_0x55a338[_0xb8a8('0x68')]['Imap'])return _0xfd0116;return db[_0xb8a8('0x46')][_0xb8a8('0x67')](_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x43')],{'where':{'MailAccountId':_0xfd0116['id']}})[_0xb8a8('0x28')](function(){return _0xfd0116;});})['then'](function(_0x2d4f7a){if(!_0x55a338[_0xb8a8('0x68')][_0xb8a8('0x44')])return _0x2d4f7a;return db['MailServerOut'][_0xb8a8('0x67')](_0x55a338['body'][_0xb8a8('0x44')],{'where':{'MailAccountId':_0x2d4f7a['id']}})[_0xb8a8('0x28')](function(){return _0x2d4f7a;});})['then'](respondWithResult(_0x17bf5e,null))[_0xb8a8('0x1c')](handleError(_0x17bf5e,null));};exports[_0xb8a8('0x6c')]=function(_0x40bf19,_0x412e82){return db[_0xb8a8('0x4a')][_0xb8a8('0x6c')]()[_0xb8a8('0x28')](respondWithResult(_0x412e82,null))['catch'](handleError(_0x412e82,null));};exports[_0xb8a8('0x6d')]=function(_0x23865a,_0x453ad9){if(_0x23865a[_0xb8a8('0x68')]['id']){delete _0x23865a['body']['id'];}return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x23865a[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x453ad9,null))[_0xb8a8('0x28')](function(_0x25966b){if(_0x25966b){_0x23865a['body']['MailAccountId']=_0x25966b['id'];return db[_0xb8a8('0x6e')][_0xb8a8('0x6f')](_0x23865a[_0xb8a8('0x68')]);}})[_0xb8a8('0x28')](respondWithResult(_0x453ad9,null))[_0xb8a8('0x1c')](handleError(_0x453ad9,null));};exports[_0xb8a8('0x70')]=function(_0x37e579,_0x11f737){var _0x49fefa={'raw':![],'where':{}};var _0x26daf6={};var _0x4a5b8f={'count':0x0,'rows':[]};return db['MailAccount'][_0xb8a8('0x71')]({'where':{'id':_0x37e579['params']['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x11f737,null))[_0xb8a8('0x28')](function(_0x2d08b0){if(_0x2d08b0){_0x26daf6[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db[_0xb8a8('0x6e')]['rawAttributes']);_0x26daf6[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x37e579[_0xb8a8('0x4f')]);_0x26daf6['filters']=_[_0xb8a8('0x52')](_0x26daf6[_0xb8a8('0x4e')],_0x26daf6[_0xb8a8('0x4f')]);_0x49fefa['attributes']=_[_0xb8a8('0x52')](_0x26daf6[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0x49fefa[_0xb8a8('0x54')]=_0x49fefa['attributes'][_0xb8a8('0x53')]?_0x49fefa['attributes']:_0x26daf6[_0xb8a8('0x4e')];if(!_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x55')]('nolimit')){_0x49fefa[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x21')]);_0x49fefa['offset']=qs['offset'](_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}_0x49fefa[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x37e579['query'][_0xb8a8('0x58')]);_0x49fefa[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x37e579[_0xb8a8('0x4f')],_0x26daf6['filters']));_0x49fefa[_0xb8a8('0x5d')]['MailAccountId']=_0x2d08b0['id'];if(_0x37e579[_0xb8a8('0x4f')]['filter']){_0x49fefa[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x49fefa[_0xb8a8('0x5d')],{'$or':_[_0xb8a8('0x49')](_0x49fefa[_0xb8a8('0x54')],function(_0x48a1a4){var _0x23733c={};_0x23733c[_0x48a1a4]={'$like':'%'+_0x37e579[_0xb8a8('0x4f')][_0xb8a8('0x59')]+'%'};return _0x23733c;})});}_0x49fefa=_[_0xb8a8('0x66')]({},_0x49fefa,_0x37e579[_0xb8a8('0x5c')]);return db[_0xb8a8('0x6e')][_0xb8a8('0x23')]({'where':_0x49fefa[_0xb8a8('0x5d')]})['then'](function(_0x55b919){_0x4a5b8f[_0xb8a8('0x23')]=_0x55b919;if(_0x37e579['query'][_0xb8a8('0x5e')]){_0x49fefa[_0xb8a8('0x5f')]=[{'all':!![]}];}return db[_0xb8a8('0x6e')][_0xb8a8('0x60')](_0x49fefa);})[_0xb8a8('0x28')](function(_0x23e703){_0x4a5b8f[_0xb8a8('0x61')]=_0x23e703;return _0x4a5b8f;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x11f737,_0x49fefa))[_0xb8a8('0x1c')](handleError(_0x11f737,null));};exports[_0xb8a8('0x73')]=function(_0x38f25d,_0x93272){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x38f25d[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x93272,null))[_0xb8a8('0x28')](function(_0x341cbe){if(_0x341cbe){return _0x341cbe[_0xb8a8('0x73')](_0x38f25d[_0xb8a8('0x4f')][_0xb8a8('0x74')]);}})[_0xb8a8('0x28')](respondWithStatusCode(_0x93272,null))[_0xb8a8('0x1c')](handleError(_0x93272,null));};exports[_0xb8a8('0x75')]=function(_0x343727,_0x83bf99){if(_0x343727[_0xb8a8('0x68')]['id']){delete _0x343727[_0xb8a8('0x68')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x343727[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x83bf99,null))[_0xb8a8('0x28')](function(_0x297d43){if(_0x297d43){_0x343727[_0xb8a8('0x68')][_0xb8a8('0x76')]=_0x297d43['id'];return db[_0xb8a8('0x77')][_0xb8a8('0x6f')](_0x343727[_0xb8a8('0x68')]);}})[_0xb8a8('0x28')](respondWithResult(_0x83bf99,null))[_0xb8a8('0x1c')](handleError(_0x83bf99,null));};exports[_0xb8a8('0x78')]=function(_0x4ee4c3,_0x1fda9a){var _0x300b81={'raw':![],'where':{}};var _0x1c582c={};var _0x38e375={'count':0x0,'rows':[]};return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x4ee4c3[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x1fda9a,null))[_0xb8a8('0x28')](function(_0x306b35){if(_0x306b35){_0x1c582c[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db['CannedAnswer'][_0xb8a8('0x4b')]);_0x1c582c['query']=_['keys'](_0x4ee4c3['query']);_0x1c582c[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x1c582c[_0xb8a8('0x4e')],_0x1c582c['query']);_0x300b81['attributes']=_['intersection'](_0x1c582c['model'],qs[_0xb8a8('0x65')](_0x4ee4c3[_0xb8a8('0x4f')]['fields']));_0x300b81[_0xb8a8('0x54')]=_0x300b81[_0xb8a8('0x54')][_0xb8a8('0x53')]?_0x300b81['attributes']:_0x1c582c[_0xb8a8('0x4e')];if(!_0x4ee4c3[_0xb8a8('0x4f')]['hasOwnProperty'](_0xb8a8('0x56'))){_0x300b81[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x4ee4c3['query'][_0xb8a8('0x21')]);_0x300b81[_0xb8a8('0x20')]=qs[_0xb8a8('0x20')](_0x4ee4c3[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}_0x300b81[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x4ee4c3['query']['sort']);_0x300b81['where']=qs[_0xb8a8('0x51')](_['pick'](_0x4ee4c3[_0xb8a8('0x4f')],_0x1c582c['filters']));_0x300b81[_0xb8a8('0x5d')][_0xb8a8('0x76')]=_0x306b35['id'];if(_0x4ee4c3[_0xb8a8('0x4f')][_0xb8a8('0x59')]){_0x300b81[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x300b81[_0xb8a8('0x5d')],{'$or':_['map'](_0x300b81['attributes'],function(_0x58fe35){var _0x3a8c9f={};_0x3a8c9f[_0x58fe35]={'$like':'%'+_0x4ee4c3[_0xb8a8('0x4f')]['filter']+'%'};return _0x3a8c9f;})});}_0x300b81=_['merge']({},_0x300b81,_0x4ee4c3['options']);return db[_0xb8a8('0x77')][_0xb8a8('0x23')]({'where':_0x300b81[_0xb8a8('0x5d')]})[_0xb8a8('0x28')](function(_0x8d49a5){_0x38e375[_0xb8a8('0x23')]=_0x8d49a5;if(_0x4ee4c3[_0xb8a8('0x4f')][_0xb8a8('0x5e')]){_0x300b81[_0xb8a8('0x5f')]=[{'all':!![]}];}return db[_0xb8a8('0x77')][_0xb8a8('0x60')](_0x300b81);})[_0xb8a8('0x28')](function(_0x44a66f){_0x38e375['rows']=_0x44a66f;return _0x38e375;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x1fda9a,_0x300b81))['catch'](handleError(_0x1fda9a,null));};exports[_0xb8a8('0x79')]=function(_0x5f2d1e,_0x3bb237){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x5f2d1e[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x3bb237,null))[_0xb8a8('0x28')](function(_0x2218d3){if(_0x2218d3){return _0x2218d3['removeAnswers'](_0x5f2d1e[_0xb8a8('0x4f')][_0xb8a8('0x74')]);}})[_0xb8a8('0x28')](respondWithStatusCode(_0x3bb237,null))[_0xb8a8('0x1c')](handleError(_0x3bb237,null));};exports[_0xb8a8('0x6f')]=function(_0x2220aa,_0x5d225a){var _0x168dc8={'name':_0x2220aa['body'][_0xb8a8('0x2a')],'key':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x4d')],'provider':_0x2220aa[_0xb8a8('0x68')]['provider']===_0xb8a8('0x7a')?null:_0x2220aa['body'][_0xb8a8('0x69')],'email':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7b')],'ListId':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7c')],'active':!_[_0xb8a8('0x7d')](_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7e')])?_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7e')]:!![],'description':_0x2220aa[_0xb8a8('0x68')][_0xb8a8('0x7f')]||null};var _0x3ae807=getAuthenticationOptions(_0x168dc8[_0xb8a8('0x69')],_0x2220aa['body']);_0x168dc8[_0xb8a8('0x43')]=_0x3ae807[_0xb8a8('0x43')];_0x168dc8[_0xb8a8('0x44')]=_0x3ae807[_0xb8a8('0x44')];return db['MailAccount']['create'](_0x168dc8,{'include':[{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44')},{'model':db['MailServerIn'],'as':_0xb8a8('0x43')}]})[_0xb8a8('0x28')](function(_0x25bb03){var _0x275f19=_0x2220aa[_0xb8a8('0x38')][_0xb8a8('0x80')]({'plain':!![]});if(!_0x275f19)throw new Error(_0xb8a8('0x81'));if(_0x275f19[_0xb8a8('0x82')]==='user'){var _0x553c8c=_0x25bb03[_0xb8a8('0x80')]({'plain':!![]});return db[_0xb8a8('0x83')][_0xb8a8('0x6a')]({'where':{'name':_0xb8a8('0x26'),'userProfileId':_0x275f19['userProfileId']},'raw':!![]})[_0xb8a8('0x28')](function(_0xc124b3){if(_0xc124b3&&_0xc124b3['autoAssociation']===0x0){return db[_0xb8a8('0x27')][_0xb8a8('0x6f')]({'name':_0x553c8c[_0xb8a8('0x2a')],'resourceId':_0x553c8c['id'],'type':_0xc124b3[_0xb8a8('0x2a')],'sectionId':_0xc124b3['id']},{})[_0xb8a8('0x28')](function(){return _0x25bb03;});}else{return _0x25bb03;}})[_0xb8a8('0x1c')](function(_0xdc357c){logger[_0xb8a8('0x18')](_0xb8a8('0x84'),_0xdc357c);throw _0xdc357c;});}return _0x25bb03;})['then'](respondWithResult(_0x5d225a,0xc9))[_0xb8a8('0x1c')](handleError(_0x5d225a,null));};exports[_0xb8a8('0x85')]=function(_0x55b2ea,_0x42b923){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x55b2ea[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x42b923,null))[_0xb8a8('0x28')](function(_0x303357){if(_0x303357){return _0x303357[_0xb8a8('0x85')]();}return null;})[_0xb8a8('0x28')](respondWithResult(_0x42b923,null))['catch'](handleError(_0x42b923,null));};exports[_0xb8a8('0x86')]=function(_0x38abf8,_0x4eb97c){if(_0x38abf8[_0xb8a8('0x68')]['id']){delete _0x38abf8['body']['id'];}return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x38abf8[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x4eb97c,null))[_0xb8a8('0x28')](function(_0x2a7466){if(_0x2a7466){_0x38abf8[_0xb8a8('0x68')][_0xb8a8('0x76')]=_0x2a7466['id'];return db['MailServerIn'][_0xb8a8('0x6f')](_0x38abf8['body']);}})['then'](respondWithResult(_0x4eb97c,null))['catch'](handleError(_0x4eb97c,null));};exports[_0xb8a8('0x87')]=function(_0x36f8e0,_0x27b018){return db['MailAccount'][_0xb8a8('0x71')]({'where':{'id':_0x36f8e0[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x27b018,null))[_0xb8a8('0x28')](function(_0x5e79f9){if(_0x5e79f9){return _0x5e79f9['setImap'](null);}return null;})[_0xb8a8('0x28')](respondWithStatusCode(_0x27b018,null))['catch'](handleError(_0x27b018,null));};exports[_0xb8a8('0x88')]=function(_0x2f7ae0,_0xcf53d2){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x2f7ae0[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0xcf53d2,null))['then'](function(_0x2a67e8){if(_0x2a67e8){return _0x2a67e8['getSmtp']();}return null;})['then'](respondWithResult(_0xcf53d2,null))['catch'](handleError(_0xcf53d2,null));};exports[_0xb8a8('0x89')]=function(_0x243736,_0x2a3790){if(_0x243736[_0xb8a8('0x68')]['id']){delete _0x243736[_0xb8a8('0x68')]['id'];}return db[_0xb8a8('0x4a')]['find']({'where':{'id':_0x243736[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x2a3790,null))[_0xb8a8('0x28')](function(_0x282a3f){if(_0x282a3f){_0x243736['body'][_0xb8a8('0x76')]=_0x282a3f['id'];return db[_0xb8a8('0x47')][_0xb8a8('0x6f')](_0x243736[_0xb8a8('0x68')]);}})[_0xb8a8('0x28')](respondWithResult(_0x2a3790,null))[_0xb8a8('0x1c')](handleError(_0x2a3790,null));};exports[_0xb8a8('0x8a')]=function(_0x4442b0,_0x43d4c1){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x4442b0[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x43d4c1,null))[_0xb8a8('0x28')](function(_0x1c6371){if(_0x1c6371){return _0x1c6371[_0xb8a8('0x8b')](null);}return null;})['then'](respondWithStatusCode(_0x43d4c1,null))[_0xb8a8('0x1c')](handleError(_0x43d4c1,null));};exports[_0xb8a8('0x8c')]=function(_0x2acc65,_0x266002){return db['MailInteraction'][_0xb8a8('0x6a')]({'where':{'id':_0x2acc65['params']['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x266002,null))[_0xb8a8('0x28')](function(_0x49ca00){if(_0x49ca00){return _0x49ca00[_0xb8a8('0x8c')](_0x2acc65[_0xb8a8('0x68')]['ids'],_[_0xb8a8('0x8d')](_0x2acc65[_0xb8a8('0x68')],[_0xb8a8('0x74'),'id'])||{});}})[_0xb8a8('0x28')](respondWithResult(_0x266002,null))[_0xb8a8('0x1c')](handleError(_0x266002,null));};exports[_0xb8a8('0x8e')]=function(_0x46018a,_0x2a14ab){var _0x493135={'raw':![],'where':{}};var _0x264fe7={};var _0x46cf8d={'count':0x0,'rows':[]};return db['MailAccount'][_0xb8a8('0x71')]({'where':{'id':_0x46018a[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x2a14ab,null))['then'](function(_0x278a22){if(_0x278a22){_0x264fe7[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db[_0xb8a8('0x8f')][_0xb8a8('0x4b')]);_0x264fe7[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x46018a[_0xb8a8('0x4f')]);_0x264fe7[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x264fe7[_0xb8a8('0x4e')],_0x264fe7[_0xb8a8('0x4f')]);_0x493135['attributes']=_[_0xb8a8('0x52')](_0x264fe7['model'],qs[_0xb8a8('0x65')](_0x46018a['query'][_0xb8a8('0x65')]));_0x493135[_0xb8a8('0x54')]=_0x493135[_0xb8a8('0x54')]['length']?_0x493135[_0xb8a8('0x54')]:_0x264fe7['model'];if(!_0x46018a['query'][_0xb8a8('0x55')](_0xb8a8('0x56'))){_0x493135['limit']=qs[_0xb8a8('0x21')](_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x21')]);_0x493135['offset']=qs[_0xb8a8('0x20')](_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}_0x493135['order']=qs['sort'](_0x46018a[_0xb8a8('0x4f')]['sort']);_0x493135[_0xb8a8('0x5d')]=qs['filters'](_[_0xb8a8('0x72')](_0x46018a['query'],_0x264fe7[_0xb8a8('0x51')]));_0x493135['where'][_0xb8a8('0x76')]=_0x278a22['id'];if(_0x46018a[_0xb8a8('0x4f')]['filter']){_0x493135['where']=_['merge'](_0x493135['where'],{'$or':_[_0xb8a8('0x49')](_0x493135[_0xb8a8('0x54')],function(_0x11715d){var _0x11fd3c={};_0x11fd3c[_0x11715d]={'$like':'%'+_0x46018a[_0xb8a8('0x4f')]['filter']+'%'};return _0x11fd3c;})});}_0x493135=_[_0xb8a8('0x66')]({},_0x493135,_0x46018a[_0xb8a8('0x5c')]);return db[_0xb8a8('0x8f')]['count']({'where':_0x493135[_0xb8a8('0x5d')]})[_0xb8a8('0x28')](function(_0x545924){_0x46cf8d[_0xb8a8('0x23')]=_0x545924;if(_0x46018a[_0xb8a8('0x4f')]['includeAll']){_0x493135[_0xb8a8('0x5f')]=[{'model':db[_0xb8a8('0x90')],'as':_0xb8a8('0x91'),'required':![]},{'model':db['User'],'as':_0xb8a8('0x92'),'attributes':[_0xb8a8('0x2a'),_0xb8a8('0x93'),'internal'],'required':![]},{'model':db[_0xb8a8('0x94')],'as':_0xb8a8('0x95'),'attributes':['id','name','color'],'where':_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x96')]?{'id':_0x46018a[_0xb8a8('0x4f')][_0xb8a8('0x96')]}:undefined,'required':_0x46018a[_0xb8a8('0x4f')]['tag']?!![]:![]}];}return db[_0xb8a8('0x8f')][_0xb8a8('0x60')](_0x493135);})[_0xb8a8('0x28')](function(_0x19f697){_0x46cf8d['rows']=_0x19f697;return _0x46cf8d;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x2a14ab,_0x493135))['catch'](handleError(_0x2a14ab,null));};exports['addApplications']=function addApplications(_0x3b38c4,_0xb71317){var _0x40bf28=_0x3b38c4[_0xb8a8('0x63')]['id'];var _0x321086=_0x3b38c4[_0xb8a8('0x68')];var _0x472ed2=0xc8;var _0x1f0220=null;return db[_0xb8a8('0x97')][_0xb8a8('0x98')]({'isolationLevel':db[_0xb8a8('0x97')][_0xb8a8('0x99')][_0xb8a8('0x9a')]['READ_COMMITTED']},function(_0x3815fd){return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x40bf28},'transaction':_0x3815fd})[_0xb8a8('0x28')](function(_0x5f39c0){if(_0x5f39c0){return db[_0xb8a8('0x9b')][_0xb8a8('0x25')]({'where':{'MailAccountId':_0x40bf28},'transaction':_0x3815fd})[_0xb8a8('0x28')](function(){var _0x107c60=_[_0xb8a8('0x49')](_0x321086,function(_0x507946){_0x507946[_0xb8a8('0x76')]=_0x40bf28;return _0x507946;});return db['MailApplication'][_0xb8a8('0x9c')](_0x107c60,{'transaction':_0x3815fd});});}else{_0x472ed2=0x194;_0x1f0220=[];}});})[_0xb8a8('0x28')](function(){if(_0x472ed2!==0x194){return db[_0xb8a8('0x9b')]['findAndCountAll']({'where':{'MailAccountId':_0x40bf28},'order':'priority'})[_0xb8a8('0x28')](function(_0xf761c9){_0x1f0220=_0xf761c9;});}})['catch'](function(_0x12eb91){_0x472ed2=0x1f4;logger['error'](_0x12eb91['stack']);if(_0x12eb91[_0xb8a8('0x2a')]){delete _0x12eb91[_0xb8a8('0x2a')];}_0x1f0220=_0x12eb91;})[_0xb8a8('0x9d')](function(){if(_0x1f0220===null){_0xb71317['sendStatus'](_0x472ed2);}else{if(_0x472ed2===0x1f4){_0xb71317['status'](_0x472ed2)[_0xb8a8('0x2b')](_0x1f0220);}else{_0xb71317[_0xb8a8('0x1e')](_0x472ed2)['json'](_0x1f0220);}}});};exports[_0xb8a8('0x9e')]=function(_0x1a42c4,_0xfadeae){var _0xd512a9={};var _0x9220b4={};var _0x5202f3;var _0x1a1bf7;return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x1a42c4[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0xfadeae,null))[_0xb8a8('0x28')](function(_0x10f740){if(_0x10f740){_0x5202f3=_0x10f740;_0x9220b4[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db['MailApplication'][_0xb8a8('0x4b')]);_0x9220b4[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x1a42c4[_0xb8a8('0x4f')]);_0x9220b4[_0xb8a8('0x51')]=_['intersection'](_0x9220b4[_0xb8a8('0x4e')],_0x9220b4['query']);_0xd512a9[_0xb8a8('0x54')]=_[_0xb8a8('0x52')](_0x9220b4['model'],qs[_0xb8a8('0x65')](_0x1a42c4[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0xd512a9[_0xb8a8('0x54')]=_0xd512a9[_0xb8a8('0x54')]['length']?_0xd512a9[_0xb8a8('0x54')]:_0x9220b4[_0xb8a8('0x4e')];_0xd512a9[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x1a42c4[_0xb8a8('0x4f')][_0xb8a8('0x58')]);_0xd512a9[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x1a42c4[_0xb8a8('0x4f')],_0x9220b4[_0xb8a8('0x51')]));if(_0x1a42c4[_0xb8a8('0x4f')]['filter']){_0xd512a9['where']=_[_0xb8a8('0x66')](_0xd512a9[_0xb8a8('0x5d')],{'$or':_['map'](_0xd512a9[_0xb8a8('0x54')],function(_0x490b9e){var _0x224b85={};_0x224b85[_0x490b9e]={'$like':'%'+_0x1a42c4['query'][_0xb8a8('0x59')]+'%'};return _0x224b85;})});}_0xd512a9=_['merge']({},_0xd512a9,_0x1a42c4[_0xb8a8('0x5c')]);return _0x5202f3[_0xb8a8('0x9e')](_0xd512a9);}})[_0xb8a8('0x28')](function(_0x4ce25a){if(_0x4ce25a){_0x1a1bf7=_0x4ce25a['length'];if(!_0x1a42c4[_0xb8a8('0x4f')]['hasOwnProperty'](_0xb8a8('0x56'))){_0xd512a9[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x1a42c4['query'][_0xb8a8('0x21')]);_0xd512a9[_0xb8a8('0x20')]=qs[_0xb8a8('0x20')](_0x1a42c4[_0xb8a8('0x4f')][_0xb8a8('0x20')]);}return _0x5202f3[_0xb8a8('0x9e')](_0xd512a9);}})[_0xb8a8('0x28')](function(_0x570520){if(_0x570520){return _0x570520?{'count':_0x1a1bf7,'rows':_0x570520}:null;}})['then'](respondWithResult(_0xfadeae,null))[_0xb8a8('0x1c')](handleError(_0xfadeae,null));};exports[_0xb8a8('0x9f')]=function(_0x225e9d,_0x33dc44){var _0x1353db={'raw':!![],'where':{}};var _0x541653={};var _0x134734={'count':0x0,'rows':[]};return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x225e9d[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x33dc44,null))[_0xb8a8('0x28')](function(_0x1d82e2){if(_0x1d82e2){_0x541653[_0xb8a8('0x4e')]=_['keys'](db['MailMessage'][_0xb8a8('0x4b')]);_0x541653[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x225e9d[_0xb8a8('0x4f')]);_0x541653[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0x541653[_0xb8a8('0x4e')],_0x541653[_0xb8a8('0x4f')]);_0x1353db[_0xb8a8('0x54')]=_[_0xb8a8('0x52')](_0x541653[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x225e9d[_0xb8a8('0x4f')][_0xb8a8('0x65')]));_0x1353db['attributes']=_0x1353db['attributes'][_0xb8a8('0x53')]?_0x1353db[_0xb8a8('0x54')]:_0x541653['model'];if(!_0x225e9d[_0xb8a8('0x4f')][_0xb8a8('0x55')](_0xb8a8('0x56'))){_0x1353db[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x225e9d[_0xb8a8('0x4f')]['limit']);_0x1353db[_0xb8a8('0x20')]=qs[_0xb8a8('0x20')](_0x225e9d['query']['offset']);}_0x1353db[_0xb8a8('0x57')]=qs[_0xb8a8('0x58')](_0x225e9d[_0xb8a8('0x4f')]['sort']);_0x1353db[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x225e9d[_0xb8a8('0x4f')],_0x541653[_0xb8a8('0x51')]));_0x1353db[_0xb8a8('0x5d')][_0xb8a8('0x76')]=_0x1d82e2['id'];if(_0x225e9d['query'][_0xb8a8('0x59')]){_0x1353db[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x1353db[_0xb8a8('0x5d')],{'$or':_[_0xb8a8('0x49')](_0x1353db['attributes'],function(_0x5bcfe2){var _0x1659d3={};_0x1659d3[_0x5bcfe2]={'$like':'%'+_0x225e9d[_0xb8a8('0x4f')]['filter']+'%'};return _0x1659d3;})});}if(_0x225e9d[_0xb8a8('0x4f')][_0xb8a8('0xa0')]){var _0x4752ac=_0x225e9d['query'][_0xb8a8('0xa0')][_0xb8a8('0xa1')](',');var _0x47b517={};_0x47b517[_0x4752ac[0x0]]={'$gte':moment(_0x4752ac[0x1])['format'](_0xb8a8('0xa2'))};_0x1353db[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x1353db[_0xb8a8('0x5d')],_0x47b517);}_0x1353db=_[_0xb8a8('0x66')]({},_0x1353db,_0x225e9d[_0xb8a8('0x5c')]);return db[_0xb8a8('0xa3')]['count']({'where':_0x1353db[_0xb8a8('0x5d')]})[_0xb8a8('0x28')](function(_0x5f10a8){_0x134734[_0xb8a8('0x23')]=_0x5f10a8;if(_0x225e9d['query'][_0xb8a8('0x5e')]){_0x1353db['include']=[{'all':!![]}];}return db[_0xb8a8('0xa3')][_0xb8a8('0x60')](_0x1353db);})['then'](function(_0x306aa6){if(_0x225e9d['query'][_0xb8a8('0xa4')]===_0xb8a8('0xa5')){for(var _0x22b003=0x0;_0x22b003<_0x306aa6[_0xb8a8('0x53')];_0x22b003++){_0x306aa6[_0x22b003][_0xb8a8('0x68')]=juice(_0x306aa6[_0x22b003]['body']);}}_0x134734[_0xb8a8('0x61')]=_0x306aa6;return _0x134734;});}})[_0xb8a8('0x28')](respondWithFilteredResult(_0x33dc44,_0x1353db))[_0xb8a8('0x1c')](handleError(_0x33dc44,null));};exports[_0xb8a8('0x2b')]=function(_0x1b63e5,_0x4da97d){var _0x465e12,_0x531a77={},_0x48acb8;if(_0x1b63e5['body']['to']){_0x48acb8=_0x1b63e5[_0xb8a8('0x68')]['to']['split'](',')[0x0];}return db[_0xb8a8('0x4a')]['find']({'where':{'id':_0x1b63e5[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0xa6')],'as':'List','include':[{'model':db[_0xb8a8('0x90')],'as':'Contacts','where':{'email':_0x48acb8},'limit':0x1,'order':[[_0xb8a8('0xa7'),_0xb8a8('0xa8')]]}]},{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44'),'raw':!![],'include':[{'model':db[_0xb8a8('0xa9')],'as':_0xb8a8('0xa9'),'raw':!![]}]}]})[_0xb8a8('0x28')](handleEntityNotFound(_0x4da97d,null))[_0xb8a8('0x28')](function(_0x4ab2e5){if(!_0x4ab2e5)return;_0x465e12=_0x4ab2e5;if(!_0x4ab2e5[_0xb8a8('0x44')])throw new Error(_0xb8a8('0xaa'));if(_[_0xb8a8('0x7d')](_0x1b63e5[_0xb8a8('0x68')]['from'])){_0x1b63e5['body'][_0xb8a8('0xab')]=util[_0xb8a8('0xac')](_0xb8a8('0xad'),_0x4ab2e5[_0xb8a8('0x2a')],_0x4ab2e5[_0xb8a8('0x7b')]||_0x4ab2e5[_0xb8a8('0x44')][_0xb8a8('0x38')]);}if(_0x1b63e5['body'][_0xb8a8('0xae')]&&_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xae')]['length']){for(var _0x86c563=0x0;_0x86c563<_0x1b63e5[_0xb8a8('0x68')]['attachments'][_0xb8a8('0x53')];_0x86c563+=0x1){_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xae')][_0x86c563]={'filename':_0x1b63e5[_0xb8a8('0x68')]['attachments'][_0x86c563][_0xb8a8('0x2a')],'path':path[_0xb8a8('0xaf')](config[_0xb8a8('0xb0')],_0xb8a8('0xb1'),_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xae')][_0x86c563][_0xb8a8('0xb2')])};}}var _0x560eb1=_0x4ab2e5[_0xb8a8('0xb3')]();return respondWithRpcPromise(_0xb8a8('0xb4'),'sendMail',{'account':_0x560eb1,'message':_0x1b63e5[_0xb8a8('0x68')]});})[_0xb8a8('0x28')](function(_0x4233d0){if(!_0x4233d0)return;_0x531a77=_0x4233d0;if(!_0x465e12[_0xb8a8('0xb5')])throw new Error(_0xb8a8('0xb6'));if(_0x465e12['List'][_0xb8a8('0xb7')]['length'])return _0x465e12[_0xb8a8('0xb5')][_0xb8a8('0xb7')][0x0];return db[_0xb8a8('0x90')][_0xb8a8('0x6f')](_['defaults'](_0x1b63e5[_0xb8a8('0x68')],{'firstName':_0x1b63e5['body']['to'],'email':_0x1b63e5['body']['to'],'phone':_0x1b63e5['body']['to'],'ListId':_0x465e12[_0xb8a8('0x7c')]}));})[_0xb8a8('0x28')](function(_0x99fea5){if(!_0x99fea5)return;var _0x342e99={'UserId':_0x1b63e5[_0xb8a8('0x38')]['id'],'ContactId':_0x99fea5['id'],'MailAccountId':_0x465e12['id'],'inReplyTo':_0x531a77['messageId'],'to':_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xab')],'cc':_0x1b63e5['body']['cc'],'subject':_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xb8')],'attach':_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xb9')],'firstMsgDirection':_0xb8a8('0xba'),'lastMsgAt':moment()[_0xb8a8('0xac')](_0xb8a8('0xa2')),'lastMsgDirection':'out','Messages':[_[_0xb8a8('0x66')](_0x1b63e5[_0xb8a8('0x68')],{'messageId':_0x531a77['messageId'],'sentAt':moment()[_0xb8a8('0xac')](_0xb8a8('0xa2')),'read':!![],'MailAccountId':_0x465e12['id'],'UserId':_0x1b63e5[_0xb8a8('0x38')]['id'],'ContactId':_0x99fea5['id']})]};if(_0x1b63e5[_0xb8a8('0x68')][_0xb8a8('0xbb')]){_0x342e99=_[_0xb8a8('0x66')](_0x342e99,_0x1b63e5['body'][_0xb8a8('0xbb')]);}return db[_0xb8a8('0x8f')][_0xb8a8('0x6f')](_0x342e99,{'include':[{'model':db[_0xb8a8('0xa3')],'as':_0xb8a8('0xbc')}]});})['then'](respondWithResult(_0x4da97d,null))['catch'](handleError(_0x4da97d,null));};exports[_0xb8a8('0xbd')]=function(_0x3ac7a8,_0x575a0d){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x3ac7a8[_0xb8a8('0x63')]['id']},'include':[{'model':db[_0xb8a8('0x47')],'as':_0xb8a8('0x44'),'raw':!![],'include':[{'model':db[_0xb8a8('0xa9')],'as':_0xb8a8('0xa9'),'raw':!![]}]}]})[_0xb8a8('0x28')](handleEntityNotFound(_0x575a0d,null))[_0xb8a8('0x28')](function(_0xad5112){if(!_0xad5112[_0xb8a8('0x44')])return;var _0x3dd1df=_0xad5112[_0xb8a8('0xb3')]();return respondWithRpcPromise(_0xb8a8('0xbe'),_0xb8a8('0xbd'),{'account':_0x3dd1df});})[_0xb8a8('0x28')](respondWithResult(_0x575a0d,null))[_0xb8a8('0x1c')](handleError(_0x575a0d,null));};exports[_0xb8a8('0x25')]=function(_0x331fea,_0x58fdea){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x331fea[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x58fdea,null))[_0xb8a8('0x28')](function(_0x404839){if(_0x404839&&_0x404839['service']){throw new db[(_0xb8a8('0xbf'))][(_0xb8a8('0xc0'))](_0xb8a8('0xc1'));}return _0x404839;})[_0xb8a8('0x28')](removeEntity(_0x58fdea,null))[_0xb8a8('0x1c')](handleError(_0x58fdea,null));};exports[_0xb8a8('0xc2')]=function(_0x29a374,_0x203dcf){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x29a374[_0xb8a8('0x63')]['id']}})['then'](handleEntityNotFound(_0x203dcf,null))[_0xb8a8('0x28')](function(_0xa49bc7){if(_0xa49bc7){return _0xa49bc7[_0xb8a8('0xc2')](_0x29a374['body'][_0xb8a8('0x74')],_['omit'](_0x29a374[_0xb8a8('0x68')],[_0xb8a8('0x74'),'id'])||{})[_0xb8a8('0xc3')](function(_0x33f119){for(var _0x13a47d=0x0;_0x13a47d<_0x29a374[_0xb8a8('0x68')][_0xb8a8('0x74')][_0xb8a8('0x53')];_0x13a47d+=0x1){socket[_0xb8a8('0xc4')](_0xb8a8('0xc5'),{'UserId':Number(_0x29a374['body'][_0xb8a8('0x74')][_0x13a47d]),'MailAccountId':Number(_0x29a374['params']['id'])});}return _0x33f119;});}})[_0xb8a8('0x28')](respondWithResult(_0x203dcf,null))[_0xb8a8('0x1c')](handleError(_0x203dcf,null));};exports['removeAgents']=function(_0x2ae458,_0xf86e63){return db[_0xb8a8('0x4a')][_0xb8a8('0x6a')]({'where':{'id':_0x2ae458[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0xf86e63,null))[_0xb8a8('0x28')](function(_0x9f8979){if(_0x9f8979){return _0x9f8979[_0xb8a8('0xc6')](_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')])['then'](function(){if(_[_0xb8a8('0xc7')](_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')])){for(var _0x57ecb9=0x0;_0x57ecb9<_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')][_0xb8a8('0x53')];_0x57ecb9+=0x1){socket[_0xb8a8('0xc4')](_0xb8a8('0xc8'),{'UserId':Number(_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')][_0x57ecb9]),'MailAccountId':Number(_0x2ae458[_0xb8a8('0x63')]['id'])});}}else{socket['emit'](_0xb8a8('0xc8'),{'UserId':Number(_0x2ae458[_0xb8a8('0x4f')][_0xb8a8('0x74')]),'MailAccountId':Number(_0x2ae458[_0xb8a8('0x63')]['id'])});}});}})[_0xb8a8('0x28')](respondWithStatusCode(_0xf86e63,null))['catch'](handleError(_0xf86e63,null));};exports[_0xb8a8('0xc9')]=function(_0x444f5f,_0x19372b){var _0x3dcf9d={};var _0xa2344d={};var _0x385919;var _0x4ffd21;return db[_0xb8a8('0x4a')][_0xb8a8('0x71')]({'where':{'id':_0x444f5f[_0xb8a8('0x63')]['id']}})[_0xb8a8('0x28')](handleEntityNotFound(_0x19372b,null))[_0xb8a8('0x28')](function(_0x158147){if(_0x158147){_0x385919=_0x158147;_0xa2344d[_0xb8a8('0x4e')]=_[_0xb8a8('0x50')](db[_0xb8a8('0xca')][_0xb8a8('0x4b')]);_0xa2344d[_0xb8a8('0x4f')]=_[_0xb8a8('0x50')](_0x444f5f[_0xb8a8('0x4f')]);_0xa2344d[_0xb8a8('0x51')]=_[_0xb8a8('0x52')](_0xa2344d[_0xb8a8('0x4e')],_0xa2344d[_0xb8a8('0x4f')]);_0x3dcf9d[_0xb8a8('0x54')]=_['intersection'](_0xa2344d[_0xb8a8('0x4e')],qs[_0xb8a8('0x65')](_0x444f5f['query'][_0xb8a8('0x65')]));_0x3dcf9d[_0xb8a8('0x54')]=_0x3dcf9d[_0xb8a8('0x54')][_0xb8a8('0x53')]?_0x3dcf9d[_0xb8a8('0x54')]:_0xa2344d[_0xb8a8('0x4e')];_0x3dcf9d['order']=qs[_0xb8a8('0x58')](_0x444f5f[_0xb8a8('0x4f')][_0xb8a8('0x58')]);_0x3dcf9d[_0xb8a8('0x5d')]=qs[_0xb8a8('0x51')](_[_0xb8a8('0x72')](_0x444f5f[_0xb8a8('0x4f')],_0xa2344d[_0xb8a8('0x51')]));if(_0x444f5f[_0xb8a8('0x4f')][_0xb8a8('0x59')]){_0x3dcf9d[_0xb8a8('0x5d')]=_[_0xb8a8('0x66')](_0x3dcf9d[_0xb8a8('0x5d')],{'$or':_['map'](_0x3dcf9d[_0xb8a8('0x54')],function(_0x4ac84a){var _0x4e249a={};_0x4e249a[_0x4ac84a]={'$like':'%'+_0x444f5f['query']['filter']+'%'};return _0x4e249a;})});}_0x3dcf9d=_[_0xb8a8('0x66')]({},_0x3dcf9d,_0x444f5f[_0xb8a8('0x5c')]);return _0x385919[_0xb8a8('0xc9')](_0x3dcf9d);}})[_0xb8a8('0x28')](function(_0x1e8691){if(_0x1e8691){_0x4ffd21=_0x1e8691[_0xb8a8('0x53')];if(!_0x444f5f['query'][_0xb8a8('0x55')]('nolimit')){_0x3dcf9d[_0xb8a8('0x21')]=qs[_0xb8a8('0x21')](_0x444f5f['query']['limit']);_0x3dcf9d['offset']=qs[_0xb8a8('0x20')](_0x444f5f[_0xb8a8('0x4f')]['offset']);}return _0x385919[_0xb8a8('0xc9')](_0x3dcf9d);}})[_0xb8a8('0x28')](function(_0x522325){if(_0x522325){return _0x522325?{'count':_0x4ffd21,'rows':_0x522325}:null;}})[_0xb8a8('0x28')](respondWithResult(_0x19372b,null))[_0xb8a8('0x1c')](handleError(_0x19372b,null));}; \ No newline at end of file +var _0x80dd=['UserProfileResource','end','stack','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','service','username','authentication','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','params','MailServerOut','keys','includeAll','include','find','update','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','findOne','rows','removeDispositions','CannedAnswer','create','getAnswers','removeAnswers','ids','email','ListId','active','description','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','attachments','root','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','Contacts','defaults','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','redis','register','jayson/promise','client','request','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','then','destroy','get','MailAccounts'];(function(_0x197879,_0x2f574a){var _0x5af2b9=function(_0x44fda1){while(--_0x44fda1){_0x197879['push'](_0x197879['shift']());}};_0x5af2b9(++_0x2f574a);}(_0x80dd,0x158));var _0xd80d=function(_0x110dc8,_0x2b1f1f){_0x110dc8=_0x110dc8-0x0;var _0x4b001d=_0x80dd[_0x110dc8];return _0x4b001d;};'use strict';var moment=require(_0xd80d('0x0'));var BPromise=require(_0xd80d('0x1'));var util=require('util');var path=require(_0xd80d('0x2'));var _=require(_0xd80d('0x3'));var juice=require(_0xd80d('0x4'));var Redis=require(_0xd80d('0x5'));var qs=require(_0xd80d('0x6'));var logger=require(_0xd80d('0x7'))(_0xd80d('0x8'));var config=require(_0xd80d('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd80d('0xa'),'port':0x18eb});var socket=require(_0xd80d('0xb'))(new Redis(config[_0xd80d('0xc')]));require('./mailAccount.socket')[_0xd80d('0xd')](socket);var jayson=require(_0xd80d('0xe'));var client=jayson[_0xd80d('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x43b1b7,_0x5df572,_0x4a5975,_0x1c59d5){return new BPromise(function(_0x4407c7,_0x4e5639){var _0x3157f3=_0x1c59d5||client;return _0x3157f3[_0xd80d('0x10')](_0x43b1b7,_0x4a5975)['then'](function(_0x547e0c){logger['info'](_0xd80d('0x11'),_0x5df572,_0xd80d('0x12'));logger['debug'](_0xd80d('0x13'),_0x5df572,_0xd80d('0x12'),JSON[_0xd80d('0x14')](_0x547e0c));if(_0x547e0c[_0xd80d('0x15')]){if(_0x547e0c['error']['code']===0x1f4){logger[_0xd80d('0x15')]('MailAccount,\x20%s,\x20%s',_0x5df572,_0x547e0c['error']['message']);return _0x4e5639(_0x547e0c['error'][_0xd80d('0x16')]);}logger[_0xd80d('0x15')]('MailAccount,\x20%s,\x20%s',_0x5df572,_0x547e0c['error'][_0xd80d('0x16')]);return _0x4407c7(_0x547e0c[_0xd80d('0x15')][_0xd80d('0x16')]);}else{logger[_0xd80d('0x17')]('MailAccount,\x20%s,\x20%s',_0x5df572,_0xd80d('0x12'));_0x4407c7(_0x547e0c[_0xd80d('0x18')][_0xd80d('0x16')]);}})[_0xd80d('0x19')](function(_0x304172){logger[_0xd80d('0x15')]('MailAccount,\x20%s,\x20%s',_0x5df572,_0x304172);_0x4e5639(_0x304172);});});}function respondWithStatusCode(_0x2aa597,_0x307a46){_0x307a46=_0x307a46||0xcc;return function(_0xf33bb2){if(_0xf33bb2){return _0x2aa597[_0xd80d('0x1a')](_0x307a46);}return _0x2aa597[_0xd80d('0x1b')](_0x307a46)['end']();};}function respondWithResult(_0x40910e,_0x45c10f){_0x45c10f=_0x45c10f||0xc8;return function(_0x453726){if(_0x453726){return _0x40910e['status'](_0x45c10f)[_0xd80d('0x1c')](_0x453726);}};}function respondWithFilteredResult(_0x28657b,_0x49d03b){return function(_0x3fe55b){if(_0x3fe55b){var _0x31ff6c=typeof _0x49d03b[_0xd80d('0x1d')]==='undefined'&&typeof _0x49d03b[_0xd80d('0x1e')]===_0xd80d('0x1f');var _0x1f110b=_0x3fe55b['count'];var _0x30862c=_0x31ff6c?0x0:_0x49d03b[_0xd80d('0x1d')];var _0x2fe525=_0x31ff6c?_0x3fe55b[_0xd80d('0x20')]:_0x49d03b[_0xd80d('0x1d')]+_0x49d03b[_0xd80d('0x1e')];var _0x3d6e41;if(_0x2fe525>=_0x1f110b){_0x2fe525=_0x1f110b;_0x3d6e41=0xc8;}else{_0x3d6e41=0xce;}_0x28657b[_0xd80d('0x1b')](_0x3d6e41);return _0x28657b['set'](_0xd80d('0x21'),_0x30862c+'-'+_0x2fe525+'/'+_0x1f110b)[_0xd80d('0x1c')](_0x3fe55b);}return null;};}function saveUpdates(_0x32b4e2){return function(_0x4aab7c){if(_0x4aab7c){return _0x4aab7c['update'](_0x32b4e2)[_0xd80d('0x22')](function(_0x43e47f){return _0x43e47f;});}return null;};}function removeEntity(_0x26b9e6){return function(_0x23a181){if(_0x23a181){return _0x23a181[_0xd80d('0x23')]()['then'](function(){var _0x116dc8=_0x23a181[_0xd80d('0x24')]({'plain':!![]});var _0x251044=_0xd80d('0x25');return db[_0xd80d('0x26')][_0xd80d('0x23')]({'where':{'type':_0x251044,'resourceId':_0x116dc8['id']}})[_0xd80d('0x22')](function(){return _0x23a181;});})[_0xd80d('0x22')](function(){_0x26b9e6['status'](0xcc)[_0xd80d('0x27')]();});}};}function handleEntityNotFound(_0x3ef9b1){return function(_0x201010){if(!_0x201010){_0x3ef9b1[_0xd80d('0x1a')](0x194);}return _0x201010;};}function handleError(_0x50ab2a,_0x4718d3){_0x4718d3=_0x4718d3||0x1f4;return function(_0x1a1992){logger['error'](_0x1a1992[_0xd80d('0x28')]);if(_0x1a1992['name']){delete _0x1a1992['name'];}_0x50ab2a[_0xd80d('0x1b')](_0x4718d3)[_0xd80d('0x29')](_0x1a1992);};}function getImapHost(_0x42ad1e){switch(_0x42ad1e){case _0xd80d('0x2a'):return _0xd80d('0x2b');case _0xd80d('0x2c'):return _0xd80d('0x2d');case _0xd80d('0x2e'):return'imap-mail.outlook.com';case _0xd80d('0x2f'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x42ad1e);}function getSmtpHost(_0x5cabab){switch(_0x5cabab){case _0xd80d('0x2a'):return _0xd80d('0x30');case _0xd80d('0x2c'):return _0xd80d('0x31');case'hotmail':return _0xd80d('0x32');case'outlook365':return _0xd80d('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5cabab);}function getAuthenticationOptions(_0x3badc4,_0x2ab01c){var _0x2e9583={};var _0x5f1b42={};if(_0x3badc4){_0x2e9583['user']=_0x5f1b42[_0xd80d('0x34')]=_0x2ab01c['username'];_0x2e9583[_0xd80d('0x35')]=_0x5f1b42[_0xd80d('0x36')]=_0x2ab01c['password'];if(_0x2ab01c[_0xd80d('0x37')]){_0x2e9583[_0xd80d('0x37')]=_0x5f1b42[_0xd80d('0x37')]=!![];_0x2e9583[_0xd80d('0x38')]=_0x5f1b42[_0xd80d('0x38')]=_0x2ab01c[_0xd80d('0x38')];_0x2e9583['password']=_0x5f1b42[_0xd80d('0x36')]=null;}else{_0x2e9583[_0xd80d('0x38')]=_0x5f1b42[_0xd80d('0x38')]=null;}_0x2e9583[_0xd80d('0x39')]=getImapHost(_0x3badc4);_0x2e9583[_0xd80d('0x3a')]=0x3e1;_0x5f1b42[_0xd80d('0x39')]=getSmtpHost(_0x3badc4);_0x5f1b42[_0xd80d('0x3a')]=0x24b;_0x5f1b42['secure']=![];_0x2e9583[_0xd80d('0x3b')]=_0x5f1b42[_0xd80d('0x3b')]=null;}else{if(_0x2ab01c['authentication']){_0x2e9583['user']=_0x5f1b42[_0xd80d('0x34')]=_0x2ab01c[_0xd80d('0x3c')];_0x2e9583[_0xd80d('0x35')]=_0x5f1b42[_0xd80d('0x36')]=_0x2ab01c[_0xd80d('0x35')];}else{_0x2e9583[_0xd80d('0x3d')]=_0x5f1b42[_0xd80d('0x3d')]=![];_0x2e9583[_0xd80d('0x34')]=_0x5f1b42['user']=null;_0x2e9583[_0xd80d('0x35')]=_0x5f1b42[_0xd80d('0x36')]=null;}_0x2e9583[_0xd80d('0x39')]=_0x2ab01c['Imap'][_0xd80d('0x39')];_0x2e9583[_0xd80d('0x3a')]=_0x2ab01c[_0xd80d('0x3e')]['port'];_0x5f1b42[_0xd80d('0x39')]=_0x2ab01c[_0xd80d('0x3f')][_0xd80d('0x39')];_0x5f1b42[_0xd80d('0x3a')]=_0x2ab01c[_0xd80d('0x3f')]['port'];}return{'Imap':_0x2e9583,'Smtp':_0x5f1b42};}exports['index']=function(_0xf27195,_0x4f1b53){var _0x22eeab={'include':[{'model':db[_0xd80d('0x40')],'as':_0xd80d('0x3e')},{'model':db['MailServerOut'],'as':_0xd80d('0x3f')},{'model':db[_0xd80d('0x41')],'as':_0xd80d('0x42')}]},_0x354926={},_0x1bbdf9={'count':0x0,'rows':[]};var _0x5ae5da=_[_0xd80d('0x43')](db[_0xd80d('0x44')][_0xd80d('0x45')],function(_0x1a53fd){return{'name':_0x1a53fd[_0xd80d('0x46')],'type':_0x1a53fd[_0xd80d('0x47')][_0xd80d('0x48')]};});_0x354926[_0xd80d('0x49')]=_[_0xd80d('0x43')](_0x5ae5da,_0xd80d('0x4a'));_0x354926['query']=_['keys'](_0xf27195[_0xd80d('0x4b')]);_0x354926[_0xd80d('0x4c')]=_[_0xd80d('0x4d')](_0x354926[_0xd80d('0x49')],_0x354926[_0xd80d('0x4b')]);_0x22eeab[_0xd80d('0x4e')]=_[_0xd80d('0x4d')](_0x354926['model'],qs[_0xd80d('0x4f')](_0xf27195[_0xd80d('0x4b')][_0xd80d('0x4f')]));_0x22eeab['attributes']=_0x22eeab[_0xd80d('0x4e')][_0xd80d('0x50')]?_0x22eeab[_0xd80d('0x4e')]:_0x354926[_0xd80d('0x49')];if(!_0xf27195[_0xd80d('0x4b')][_0xd80d('0x51')](_0xd80d('0x52'))){_0x22eeab[_0xd80d('0x1e')]=qs['limit'](_0xf27195[_0xd80d('0x4b')]['limit']);_0x22eeab[_0xd80d('0x1d')]=qs['offset'](_0xf27195[_0xd80d('0x4b')][_0xd80d('0x1d')]);}_0x22eeab[_0xd80d('0x53')]=qs['sort'](_0xf27195[_0xd80d('0x4b')][_0xd80d('0x54')]);_0x22eeab[_0xd80d('0x55')]=qs[_0xd80d('0x4c')](_[_0xd80d('0x56')](_0xf27195[_0xd80d('0x4b')],_0x354926['filters']),_0x5ae5da);if(_0xf27195[_0xd80d('0x4b')][_0xd80d('0x57')]){_0x22eeab[_0xd80d('0x55')]=_[_0xd80d('0x58')](_0x22eeab[_0xd80d('0x55')],{'$or':_['map'](_0x5ae5da,function(_0x254f2b){if(_0x254f2b[_0xd80d('0x47')]!=='VIRTUAL'){var _0x29f9a5={};_0x29f9a5[_0x254f2b['name']]={'$like':'%'+_0xf27195[_0xd80d('0x4b')]['filter']+'%'};return _0x29f9a5;}})});}_0x22eeab=_[_0xd80d('0x58')]({},_0x22eeab,_0xf27195[_0xd80d('0x59')]);var _0x21a77b={'where':_0x22eeab[_0xd80d('0x55')]};return db['MailAccount']['count'](_0x21a77b)[_0xd80d('0x22')](function(_0x2f7928){_0x1bbdf9['count']=_0x2f7928;if(_0xf27195['query']['includeAll']){_0x22eeab['include']=[{'all':!![]}];}return db['MailAccount'][_0xd80d('0x5a')](_0x22eeab);})['then'](function(_0x175dcb){_0x1bbdf9['rows']=_0x175dcb;return _0x1bbdf9;})[_0xd80d('0x22')](respondWithFilteredResult(_0x4f1b53,_0x22eeab))[_0xd80d('0x19')](handleError(_0x4f1b53,null));};exports['show']=function(_0x4aaace,_0x17ee5d){var _0x606cf6={'raw':![],'where':{'id':_0x4aaace[_0xd80d('0x5b')]['id']},'include':[{'model':db[_0xd80d('0x40')],'as':_0xd80d('0x3e')},{'model':db[_0xd80d('0x5c')],'as':_0xd80d('0x3f')},{'model':db[_0xd80d('0x41')],'as':'mandatoryDispositionPause'}]},_0x371093={};_0x371093[_0xd80d('0x49')]=_[_0xd80d('0x5d')](db[_0xd80d('0x44')][_0xd80d('0x45')]);_0x371093['query']=_[_0xd80d('0x5d')](_0x4aaace['query']);_0x371093['filters']=_[_0xd80d('0x4d')](_0x371093[_0xd80d('0x49')],_0x371093['query']);_0x606cf6['attributes']=_[_0xd80d('0x4d')](_0x371093[_0xd80d('0x49')],qs[_0xd80d('0x4f')](_0x4aaace[_0xd80d('0x4b')][_0xd80d('0x4f')]));_0x606cf6[_0xd80d('0x4e')]=_0x606cf6['attributes'][_0xd80d('0x50')]?_0x606cf6[_0xd80d('0x4e')]:_0x371093['model'];if(_0x4aaace['query'][_0xd80d('0x5e')]){_0x606cf6[_0xd80d('0x5f')]=[{'all':!![]}];}_0x606cf6=_[_0xd80d('0x58')]({},_0x606cf6,_0x4aaace['options']);return db['MailAccount'][_0xd80d('0x60')](_0x606cf6)[_0xd80d('0x22')](handleEntityNotFound(_0x17ee5d,null))[_0xd80d('0x22')](respondWithResult(_0x17ee5d,null))['catch'](handleError(_0x17ee5d,null));};exports[_0xd80d('0x61')]=function(_0x48da96,_0x1f5c03){if(_0x48da96['body']['id']){delete _0x48da96[_0xd80d('0x62')]['id'];}var _0x145989=_0x48da96['body'][_0xd80d('0x63')]===_0xd80d('0x64')?null:_0x48da96['body']['provider'];var _0x380349=_0x48da96[_0xd80d('0x62')]['Imap']||{};var _0x1ab89c=_0x48da96[_0xd80d('0x62')]['Smtp']||{};if(_0x145989){_0x380349[_0xd80d('0x39')]=getImapHost(_0x145989);_0x380349[_0xd80d('0x3a')]=0x3e1;_0x1ab89c[_0xd80d('0x39')]=getSmtpHost(_0x145989);_0x1ab89c['port']=0x24b;_0x1ab89c['secure']=![];}if(_0x1ab89c[_0xd80d('0x37')]){_0x1ab89c[_0xd80d('0x65')]=![];}else{_0x1ab89c['CloudProviderId']=null;}if(!_0x380349[_0xd80d('0x37')])_0x380349[_0xd80d('0x38')]=null;_0x48da96[_0xd80d('0x62')][_0xd80d('0x3e')]=_0x380349;_0x48da96[_0xd80d('0x62')][_0xd80d('0x3f')]=_0x1ab89c;return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x48da96[_0xd80d('0x5b')]['id']},'include':[{'model':db[_0xd80d('0x40')],'as':_0xd80d('0x3e')},{'model':db[_0xd80d('0x5c')],'as':_0xd80d('0x3f')},{'model':db[_0xd80d('0x41')],'as':_0xd80d('0x42')}]})[_0xd80d('0x22')](handleEntityNotFound(_0x1f5c03,null))[_0xd80d('0x22')](function(_0x20c8e6){if(!_0x20c8e6)throw new Error(_0xd80d('0x66'));if(_0x20c8e6[_0xd80d('0x3b')])delete _0x48da96['body']['Imap'];return _0x20c8e6;})['then'](saveUpdates(_0x48da96[_0xd80d('0x62')],null))[_0xd80d('0x22')](function(_0x3bf580){if(!_0x48da96[_0xd80d('0x62')][_0xd80d('0x3e')])return _0x3bf580;return db[_0xd80d('0x40')][_0xd80d('0x61')](_0x48da96[_0xd80d('0x62')][_0xd80d('0x3e')],{'where':{'MailAccountId':_0x3bf580['id']}})[_0xd80d('0x22')](function(){return _0x3bf580;});})['then'](function(_0x3e6c95){if(!_0x48da96[_0xd80d('0x62')][_0xd80d('0x3f')])return _0x3e6c95;return db[_0xd80d('0x5c')][_0xd80d('0x61')](_0x48da96[_0xd80d('0x62')]['Smtp'],{'where':{'MailAccountId':_0x3e6c95['id']}})[_0xd80d('0x22')](function(){return _0x3e6c95;});})[_0xd80d('0x22')](respondWithResult(_0x1f5c03,null))[_0xd80d('0x19')](handleError(_0x1f5c03,null));};exports[_0xd80d('0x67')]=function(_0x37cef6,_0x471603){return db[_0xd80d('0x44')][_0xd80d('0x67')]()[_0xd80d('0x22')](respondWithResult(_0x471603,null))[_0xd80d('0x19')](handleError(_0x471603,null));};exports['addDisposition']=function(_0x4aefbb,_0x19c086){if(_0x4aefbb[_0xd80d('0x62')]['id']){delete _0x4aefbb[_0xd80d('0x62')]['id'];}return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x4aefbb[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x19c086,null))['then'](function(_0xd27dbb){if(_0xd27dbb){_0x4aefbb['body'][_0xd80d('0x68')]=_0xd27dbb['id'];return db[_0xd80d('0x69')]['create'](_0x4aefbb[_0xd80d('0x62')]);}})[_0xd80d('0x22')](respondWithResult(_0x19c086,null))['catch'](handleError(_0x19c086,null));};exports['getDispositions']=function(_0x3376e5,_0x448fdb){var _0x24e726={'raw':![],'where':{}};var _0x53b0ae={};var _0x2e5d8b={'count':0x0,'rows':[]};return db[_0xd80d('0x44')][_0xd80d('0x6a')]({'where':{'id':_0x3376e5['params']['id']}})['then'](handleEntityNotFound(_0x448fdb,null))[_0xd80d('0x22')](function(_0x37bee2){if(_0x37bee2){_0x53b0ae[_0xd80d('0x49')]=_[_0xd80d('0x5d')](db[_0xd80d('0x69')][_0xd80d('0x45')]);_0x53b0ae['query']=_[_0xd80d('0x5d')](_0x3376e5['query']);_0x53b0ae[_0xd80d('0x4c')]=_[_0xd80d('0x4d')](_0x53b0ae[_0xd80d('0x49')],_0x53b0ae[_0xd80d('0x4b')]);_0x24e726[_0xd80d('0x4e')]=_[_0xd80d('0x4d')](_0x53b0ae[_0xd80d('0x49')],qs[_0xd80d('0x4f')](_0x3376e5[_0xd80d('0x4b')][_0xd80d('0x4f')]));_0x24e726['attributes']=_0x24e726[_0xd80d('0x4e')][_0xd80d('0x50')]?_0x24e726[_0xd80d('0x4e')]:_0x53b0ae[_0xd80d('0x49')];if(!_0x3376e5['query'][_0xd80d('0x51')](_0xd80d('0x52'))){_0x24e726[_0xd80d('0x1e')]=qs['limit'](_0x3376e5[_0xd80d('0x4b')][_0xd80d('0x1e')]);_0x24e726['offset']=qs[_0xd80d('0x1d')](_0x3376e5['query'][_0xd80d('0x1d')]);}_0x24e726[_0xd80d('0x53')]=qs[_0xd80d('0x54')](_0x3376e5['query'][_0xd80d('0x54')]);_0x24e726['where']=qs[_0xd80d('0x4c')](_[_0xd80d('0x56')](_0x3376e5['query'],_0x53b0ae[_0xd80d('0x4c')]));_0x24e726[_0xd80d('0x55')][_0xd80d('0x68')]=_0x37bee2['id'];if(_0x3376e5[_0xd80d('0x4b')][_0xd80d('0x57')]){_0x24e726['where']=_[_0xd80d('0x58')](_0x24e726[_0xd80d('0x55')],{'$or':_['map'](_0x24e726[_0xd80d('0x4e')],function(_0x287359){var _0x17b724={};_0x17b724[_0x287359]={'$like':'%'+_0x3376e5[_0xd80d('0x4b')]['filter']+'%'};return _0x17b724;})});}_0x24e726=_['merge']({},_0x24e726,_0x3376e5['options']);return db[_0xd80d('0x69')][_0xd80d('0x20')]({'where':_0x24e726[_0xd80d('0x55')]})[_0xd80d('0x22')](function(_0x4b49ee){_0x2e5d8b['count']=_0x4b49ee;if(_0x3376e5[_0xd80d('0x4b')]['includeAll']){_0x24e726[_0xd80d('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0xd80d('0x5a')](_0x24e726);})[_0xd80d('0x22')](function(_0x19fc09){_0x2e5d8b[_0xd80d('0x6b')]=_0x19fc09;return _0x2e5d8b;});}})[_0xd80d('0x22')](respondWithFilteredResult(_0x448fdb,_0x24e726))['catch'](handleError(_0x448fdb,null));};exports[_0xd80d('0x6c')]=function(_0x90ab11,_0x1fc5b4){return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x90ab11[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x1fc5b4,null))['then'](function(_0xea3a2c){if(_0xea3a2c){return _0xea3a2c['removeDispositions'](_0x90ab11[_0xd80d('0x4b')]['ids']);}})[_0xd80d('0x22')](respondWithStatusCode(_0x1fc5b4,null))[_0xd80d('0x19')](handleError(_0x1fc5b4,null));};exports['addAnswer']=function(_0x534c15,_0x524770){if(_0x534c15[_0xd80d('0x62')]['id']){delete _0x534c15[_0xd80d('0x62')]['id'];}return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x534c15[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x524770,null))['then'](function(_0x1de908){if(_0x1de908){_0x534c15[_0xd80d('0x62')][_0xd80d('0x68')]=_0x1de908['id'];return db[_0xd80d('0x6d')][_0xd80d('0x6e')](_0x534c15[_0xd80d('0x62')]);}})[_0xd80d('0x22')](respondWithResult(_0x524770,null))[_0xd80d('0x19')](handleError(_0x524770,null));};exports[_0xd80d('0x6f')]=function(_0x3cf24b,_0x279a72){var _0x4ea7df={'raw':![],'where':{}};var _0x4d69e3={};var _0x1310a1={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3cf24b[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x279a72,null))['then'](function(_0xdd003b){if(_0xdd003b){_0x4d69e3['model']=_['keys'](db['CannedAnswer'][_0xd80d('0x45')]);_0x4d69e3['query']=_[_0xd80d('0x5d')](_0x3cf24b[_0xd80d('0x4b')]);_0x4d69e3[_0xd80d('0x4c')]=_[_0xd80d('0x4d')](_0x4d69e3[_0xd80d('0x49')],_0x4d69e3[_0xd80d('0x4b')]);_0x4ea7df[_0xd80d('0x4e')]=_[_0xd80d('0x4d')](_0x4d69e3[_0xd80d('0x49')],qs[_0xd80d('0x4f')](_0x3cf24b[_0xd80d('0x4b')]['fields']));_0x4ea7df[_0xd80d('0x4e')]=_0x4ea7df[_0xd80d('0x4e')]['length']?_0x4ea7df[_0xd80d('0x4e')]:_0x4d69e3[_0xd80d('0x49')];if(!_0x3cf24b[_0xd80d('0x4b')][_0xd80d('0x51')](_0xd80d('0x52'))){_0x4ea7df['limit']=qs['limit'](_0x3cf24b['query'][_0xd80d('0x1e')]);_0x4ea7df[_0xd80d('0x1d')]=qs['offset'](_0x3cf24b[_0xd80d('0x4b')][_0xd80d('0x1d')]);}_0x4ea7df['order']=qs['sort'](_0x3cf24b[_0xd80d('0x4b')][_0xd80d('0x54')]);_0x4ea7df[_0xd80d('0x55')]=qs[_0xd80d('0x4c')](_['pick'](_0x3cf24b[_0xd80d('0x4b')],_0x4d69e3[_0xd80d('0x4c')]));_0x4ea7df[_0xd80d('0x55')]['MailAccountId']=_0xdd003b['id'];if(_0x3cf24b[_0xd80d('0x4b')]['filter']){_0x4ea7df[_0xd80d('0x55')]=_[_0xd80d('0x58')](_0x4ea7df[_0xd80d('0x55')],{'$or':_[_0xd80d('0x43')](_0x4ea7df[_0xd80d('0x4e')],function(_0x2166b2){var _0x197244={};_0x197244[_0x2166b2]={'$like':'%'+_0x3cf24b[_0xd80d('0x4b')][_0xd80d('0x57')]+'%'};return _0x197244;})});}_0x4ea7df=_[_0xd80d('0x58')]({},_0x4ea7df,_0x3cf24b[_0xd80d('0x59')]);return db[_0xd80d('0x6d')]['count']({'where':_0x4ea7df[_0xd80d('0x55')]})['then'](function(_0x4b63da){_0x1310a1[_0xd80d('0x20')]=_0x4b63da;if(_0x3cf24b['query'][_0xd80d('0x5e')]){_0x4ea7df[_0xd80d('0x5f')]=[{'all':!![]}];}return db[_0xd80d('0x6d')][_0xd80d('0x5a')](_0x4ea7df);})[_0xd80d('0x22')](function(_0x1c9fb3){_0x1310a1['rows']=_0x1c9fb3;return _0x1310a1;});}})['then'](respondWithFilteredResult(_0x279a72,_0x4ea7df))[_0xd80d('0x19')](handleError(_0x279a72,null));};exports['removeAnswers']=function(_0x2ff480,_0xf000bb){return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x2ff480[_0xd80d('0x5b')]['id']}})['then'](handleEntityNotFound(_0xf000bb,null))[_0xd80d('0x22')](function(_0x37fdda){if(_0x37fdda){return _0x37fdda[_0xd80d('0x70')](_0x2ff480['query'][_0xd80d('0x71')]);}})['then'](respondWithStatusCode(_0xf000bb,null))[_0xd80d('0x19')](handleError(_0xf000bb,null));};exports[_0xd80d('0x6e')]=function(_0x34cc35,_0x1ff634){var _0x570bbe={'name':_0x34cc35[_0xd80d('0x62')][_0xd80d('0x4a')],'key':_0x34cc35[_0xd80d('0x62')][_0xd80d('0x48')],'provider':_0x34cc35[_0xd80d('0x62')][_0xd80d('0x63')]==='custom'?null:_0x34cc35[_0xd80d('0x62')][_0xd80d('0x63')],'email':_0x34cc35[_0xd80d('0x62')][_0xd80d('0x72')],'ListId':_0x34cc35['body'][_0xd80d('0x73')],'active':!_['isNil'](_0x34cc35[_0xd80d('0x62')]['active'])?_0x34cc35[_0xd80d('0x62')][_0xd80d('0x74')]:!![],'description':_0x34cc35[_0xd80d('0x62')][_0xd80d('0x75')]||null};var _0x5e7c9b=getAuthenticationOptions(_0x570bbe[_0xd80d('0x63')],_0x34cc35['body']);_0x570bbe[_0xd80d('0x3e')]=_0x5e7c9b[_0xd80d('0x3e')];_0x570bbe[_0xd80d('0x3f')]=_0x5e7c9b[_0xd80d('0x3f')];return db[_0xd80d('0x44')][_0xd80d('0x6e')](_0x570bbe,{'include':[{'model':db[_0xd80d('0x5c')],'as':_0xd80d('0x3f')},{'model':db[_0xd80d('0x40')],'as':_0xd80d('0x3e')}]})['then'](function(_0x4855fa){var _0x1e7ee0=_0x34cc35[_0xd80d('0x34')][_0xd80d('0x24')]({'plain':!![]});if(!_0x1e7ee0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e7ee0[_0xd80d('0x76')]===_0xd80d('0x34')){var _0x62711c=_0x4855fa[_0xd80d('0x24')]({'plain':!![]});return db[_0xd80d('0x77')][_0xd80d('0x60')]({'where':{'name':'MailAccounts','userProfileId':_0x1e7ee0[_0xd80d('0x78')]},'raw':!![]})[_0xd80d('0x22')](function(_0x3c4d05){if(_0x3c4d05&&_0x3c4d05['autoAssociation']===0x0){return db[_0xd80d('0x26')][_0xd80d('0x6e')]({'name':_0x62711c[_0xd80d('0x4a')],'resourceId':_0x62711c['id'],'type':_0x3c4d05['name'],'sectionId':_0x3c4d05['id']},{})[_0xd80d('0x22')](function(){return _0x4855fa;});}else{return _0x4855fa;}})[_0xd80d('0x19')](function(_0x18a3de){logger[_0xd80d('0x15')](_0xd80d('0x79'),_0x18a3de);throw _0x18a3de;});}return _0x4855fa;})[_0xd80d('0x22')](respondWithResult(_0x1ff634,0xc9))[_0xd80d('0x19')](handleError(_0x1ff634,null));};exports[_0xd80d('0x7a')]=function(_0x533126,_0x55f5c3){return db[_0xd80d('0x44')][_0xd80d('0x6a')]({'where':{'id':_0x533126['params']['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x55f5c3,null))[_0xd80d('0x22')](function(_0x168a03){if(_0x168a03){return _0x168a03[_0xd80d('0x7a')]();}return null;})[_0xd80d('0x22')](respondWithResult(_0x55f5c3,null))[_0xd80d('0x19')](handleError(_0x55f5c3,null));};exports['addImap']=function(_0x498b49,_0x7d44f6){if(_0x498b49[_0xd80d('0x62')]['id']){delete _0x498b49[_0xd80d('0x62')]['id'];}return db['MailAccount'][_0xd80d('0x60')]({'where':{'id':_0x498b49[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x7d44f6,null))[_0xd80d('0x22')](function(_0xb26859){if(_0xb26859){_0x498b49[_0xd80d('0x62')]['MailAccountId']=_0xb26859['id'];return db[_0xd80d('0x40')]['create'](_0x498b49[_0xd80d('0x62')]);}})['then'](respondWithResult(_0x7d44f6,null))[_0xd80d('0x19')](handleError(_0x7d44f6,null));};exports[_0xd80d('0x7b')]=function(_0x23d2f8,_0x518cb8){return db['MailAccount'][_0xd80d('0x6a')]({'where':{'id':_0x23d2f8[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x518cb8,null))[_0xd80d('0x22')](function(_0x5b2bd4){if(_0x5b2bd4){return _0x5b2bd4['setImap'](null);}return null;})[_0xd80d('0x22')](respondWithStatusCode(_0x518cb8,null))[_0xd80d('0x19')](handleError(_0x518cb8,null));};exports[_0xd80d('0x7c')]=function(_0xba2041,_0xe7aa3f){return db[_0xd80d('0x44')]['findOne']({'where':{'id':_0xba2041[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0xe7aa3f,null))[_0xd80d('0x22')](function(_0xca19ae){if(_0xca19ae){return _0xca19ae[_0xd80d('0x7c')]();}return null;})[_0xd80d('0x22')](respondWithResult(_0xe7aa3f,null))[_0xd80d('0x19')](handleError(_0xe7aa3f,null));};exports['addSmtp']=function(_0x1d4a1d,_0x4e0a89){if(_0x1d4a1d[_0xd80d('0x62')]['id']){delete _0x1d4a1d['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x1d4a1d[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x4e0a89,null))[_0xd80d('0x22')](function(_0x2c9707){if(_0x2c9707){_0x1d4a1d[_0xd80d('0x62')][_0xd80d('0x68')]=_0x2c9707['id'];return db['MailServerOut'][_0xd80d('0x6e')](_0x1d4a1d['body']);}})[_0xd80d('0x22')](respondWithResult(_0x4e0a89,null))[_0xd80d('0x19')](handleError(_0x4e0a89,null));};exports[_0xd80d('0x7d')]=function(_0x297f9b,_0x31fa4a){return db[_0xd80d('0x44')][_0xd80d('0x6a')]({'where':{'id':_0x297f9b[_0xd80d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x31fa4a,null))[_0xd80d('0x22')](function(_0x425293){if(_0x425293){return _0x425293[_0xd80d('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0x31fa4a,null))[_0xd80d('0x19')](handleError(_0x31fa4a,null));};exports[_0xd80d('0x7f')]=function(_0x183118,_0xc3d1af){return db['MailInteraction'][_0xd80d('0x60')]({'where':{'id':_0x183118['params']['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0xc3d1af,null))[_0xd80d('0x22')](function(_0x378a71){if(_0x378a71){return _0x378a71[_0xd80d('0x7f')](_0x183118['body'][_0xd80d('0x71')],_[_0xd80d('0x80')](_0x183118['body'],[_0xd80d('0x71'),'id'])||{});}})[_0xd80d('0x22')](respondWithResult(_0xc3d1af,null))[_0xd80d('0x19')](handleError(_0xc3d1af,null));};exports['getInteractions']=function(_0xa8d5e1,_0x2d5a17){var _0x3bfb5d={'raw':![],'where':{}};var _0x153716={};var _0x573930={'count':0x0,'rows':[]};return db['MailAccount'][_0xd80d('0x6a')]({'where':{'id':_0xa8d5e1['params']['id']}})['then'](handleEntityNotFound(_0x2d5a17,null))['then'](function(_0x2a527c){if(_0x2a527c){_0x153716[_0xd80d('0x49')]=_['keys'](db[_0xd80d('0x81')][_0xd80d('0x45')]);_0x153716['query']=_['keys'](_0xa8d5e1[_0xd80d('0x4b')]);_0x153716['filters']=_[_0xd80d('0x4d')](_0x153716[_0xd80d('0x49')],_0x153716['query']);_0x3bfb5d[_0xd80d('0x4e')]=_[_0xd80d('0x4d')](_0x153716[_0xd80d('0x49')],qs[_0xd80d('0x4f')](_0xa8d5e1[_0xd80d('0x4b')][_0xd80d('0x4f')]));_0x3bfb5d[_0xd80d('0x4e')]=_0x3bfb5d['attributes'][_0xd80d('0x50')]?_0x3bfb5d['attributes']:_0x153716[_0xd80d('0x49')];if(!_0xa8d5e1[_0xd80d('0x4b')][_0xd80d('0x51')]('nolimit')){_0x3bfb5d[_0xd80d('0x1e')]=qs['limit'](_0xa8d5e1[_0xd80d('0x4b')][_0xd80d('0x1e')]);_0x3bfb5d[_0xd80d('0x1d')]=qs[_0xd80d('0x1d')](_0xa8d5e1[_0xd80d('0x4b')][_0xd80d('0x1d')]);}_0x3bfb5d['order']=qs['sort'](_0xa8d5e1['query'][_0xd80d('0x54')]);_0x3bfb5d[_0xd80d('0x55')]=qs[_0xd80d('0x4c')](_['pick'](_0xa8d5e1['query'],_0x153716[_0xd80d('0x4c')]));_0x3bfb5d['where']['MailAccountId']=_0x2a527c['id'];if(_0xa8d5e1[_0xd80d('0x4b')]['filter']){_0x3bfb5d[_0xd80d('0x55')]=_[_0xd80d('0x58')](_0x3bfb5d['where'],{'$or':_[_0xd80d('0x43')](_0x3bfb5d[_0xd80d('0x4e')],function(_0x4d0edb){var _0x3beea9={};_0x3beea9[_0x4d0edb]={'$like':'%'+_0xa8d5e1[_0xd80d('0x4b')][_0xd80d('0x57')]+'%'};return _0x3beea9;})});}_0x3bfb5d=_[_0xd80d('0x58')]({},_0x3bfb5d,_0xa8d5e1[_0xd80d('0x59')]);return db[_0xd80d('0x81')][_0xd80d('0x20')]({'where':_0x3bfb5d[_0xd80d('0x55')]})[_0xd80d('0x22')](function(_0x46045b){_0x573930[_0xd80d('0x20')]=_0x46045b;if(_0xa8d5e1[_0xd80d('0x4b')][_0xd80d('0x5e')]){_0x3bfb5d['include']=[{'model':db[_0xd80d('0x82')],'as':_0xd80d('0x83'),'required':![]},{'model':db[_0xd80d('0x84')],'as':_0xd80d('0x85'),'attributes':['name',_0xd80d('0x86'),'internal'],'required':![]},{'model':db[_0xd80d('0x87')],'as':_0xd80d('0x88'),'attributes':['id',_0xd80d('0x4a'),_0xd80d('0x89')],'where':_0xa8d5e1['query'][_0xd80d('0x8a')]?{'id':_0xa8d5e1[_0xd80d('0x4b')]['tag']}:undefined,'required':_0xa8d5e1['query']['tag']?!![]:![]}];}return db[_0xd80d('0x81')][_0xd80d('0x5a')](_0x3bfb5d);})[_0xd80d('0x22')](function(_0x5ab6d8){_0x573930[_0xd80d('0x6b')]=_0x5ab6d8;return _0x573930;});}})[_0xd80d('0x22')](respondWithFilteredResult(_0x2d5a17,_0x3bfb5d))['catch'](handleError(_0x2d5a17,null));};exports[_0xd80d('0x8b')]=function addApplications(_0x454ca7,_0x439b9b){var _0x422154=_0x454ca7[_0xd80d('0x5b')]['id'];var _0x27da4c=_0x454ca7[_0xd80d('0x62')];var _0x11b5db=0xc8;var _0x5dcae1=null;return db[_0xd80d('0x8c')]['transaction']({'isolationLevel':db['sequelize'][_0xd80d('0x8d')][_0xd80d('0x8e')][_0xd80d('0x8f')]},function(_0x3c01d5){return db[_0xd80d('0x44')][_0xd80d('0x6a')]({'where':{'id':_0x422154},'transaction':_0x3c01d5})[_0xd80d('0x22')](function(_0xd5cbdd){if(_0xd5cbdd){return db['MailApplication'][_0xd80d('0x23')]({'where':{'MailAccountId':_0x422154},'transaction':_0x3c01d5})[_0xd80d('0x22')](function(){var _0x99b055=_[_0xd80d('0x43')](_0x27da4c,function(_0x419425){_0x419425['MailAccountId']=_0x422154;return _0x419425;});return db[_0xd80d('0x90')][_0xd80d('0x91')](_0x99b055,{'transaction':_0x3c01d5});});}else{_0x11b5db=0x194;_0x5dcae1=[];}});})[_0xd80d('0x22')](function(){if(_0x11b5db!==0x194){return db[_0xd80d('0x90')][_0xd80d('0x92')]({'where':{'MailAccountId':_0x422154},'order':_0xd80d('0x93')})[_0xd80d('0x22')](function(_0x458d7e){_0x5dcae1=_0x458d7e;});}})[_0xd80d('0x19')](function(_0x3e5b8a){_0x11b5db=0x1f4;logger['error'](_0x3e5b8a[_0xd80d('0x28')]);if(_0x3e5b8a[_0xd80d('0x4a')]){delete _0x3e5b8a[_0xd80d('0x4a')];}_0x5dcae1=_0x3e5b8a;})[_0xd80d('0x94')](function(){if(_0x5dcae1===null){_0x439b9b['sendStatus'](_0x11b5db);}else{if(_0x11b5db===0x1f4){_0x439b9b[_0xd80d('0x1b')](_0x11b5db)['send'](_0x5dcae1);}else{_0x439b9b['status'](_0x11b5db)[_0xd80d('0x1c')](_0x5dcae1);}}});};exports[_0xd80d('0x95')]=function(_0x5a404a,_0x19315a){var _0x1fc927={};var _0x4c299f={};var _0x4dd892;var _0xc00ddc;return db[_0xd80d('0x44')][_0xd80d('0x6a')]({'where':{'id':_0x5a404a[_0xd80d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x19315a,null))[_0xd80d('0x22')](function(_0x374fa7){if(_0x374fa7){_0x4dd892=_0x374fa7;_0x4c299f[_0xd80d('0x49')]=_['keys'](db['MailApplication'][_0xd80d('0x45')]);_0x4c299f[_0xd80d('0x4b')]=_[_0xd80d('0x5d')](_0x5a404a['query']);_0x4c299f[_0xd80d('0x4c')]=_['intersection'](_0x4c299f[_0xd80d('0x49')],_0x4c299f['query']);_0x1fc927[_0xd80d('0x4e')]=_[_0xd80d('0x4d')](_0x4c299f[_0xd80d('0x49')],qs[_0xd80d('0x4f')](_0x5a404a['query']['fields']));_0x1fc927['attributes']=_0x1fc927['attributes'][_0xd80d('0x50')]?_0x1fc927[_0xd80d('0x4e')]:_0x4c299f[_0xd80d('0x49')];_0x1fc927[_0xd80d('0x53')]=qs[_0xd80d('0x54')](_0x5a404a[_0xd80d('0x4b')][_0xd80d('0x54')]);_0x1fc927[_0xd80d('0x55')]=qs['filters'](_[_0xd80d('0x56')](_0x5a404a['query'],_0x4c299f['filters']));if(_0x5a404a[_0xd80d('0x4b')][_0xd80d('0x57')]){_0x1fc927[_0xd80d('0x55')]=_[_0xd80d('0x58')](_0x1fc927[_0xd80d('0x55')],{'$or':_[_0xd80d('0x43')](_0x1fc927[_0xd80d('0x4e')],function(_0x979ba9){var _0x33769f={};_0x33769f[_0x979ba9]={'$like':'%'+_0x5a404a[_0xd80d('0x4b')]['filter']+'%'};return _0x33769f;})});}_0x1fc927=_['merge']({},_0x1fc927,_0x5a404a[_0xd80d('0x59')]);return _0x4dd892['getApplications'](_0x1fc927);}})[_0xd80d('0x22')](function(_0x31535f){if(_0x31535f){_0xc00ddc=_0x31535f[_0xd80d('0x50')];if(!_0x5a404a[_0xd80d('0x4b')]['hasOwnProperty'](_0xd80d('0x52'))){_0x1fc927[_0xd80d('0x1e')]=qs['limit'](_0x5a404a[_0xd80d('0x4b')][_0xd80d('0x1e')]);_0x1fc927[_0xd80d('0x1d')]=qs[_0xd80d('0x1d')](_0x5a404a[_0xd80d('0x4b')][_0xd80d('0x1d')]);}return _0x4dd892[_0xd80d('0x95')](_0x1fc927);}})[_0xd80d('0x22')](function(_0x47b865){if(_0x47b865){return _0x47b865?{'count':_0xc00ddc,'rows':_0x47b865}:null;}})[_0xd80d('0x22')](respondWithResult(_0x19315a,null))[_0xd80d('0x19')](handleError(_0x19315a,null));};exports[_0xd80d('0x96')]=function(_0x33d61b,_0x23cdef){var _0x30693d={'raw':!![],'where':{}};var _0x3c36a6={};var _0x598ee0={'count':0x0,'rows':[]};return db['MailAccount'][_0xd80d('0x6a')]({'where':{'id':_0x33d61b['params']['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x23cdef,null))['then'](function(_0x2fd553){if(_0x2fd553){_0x3c36a6['model']=_[_0xd80d('0x5d')](db[_0xd80d('0x97')][_0xd80d('0x45')]);_0x3c36a6[_0xd80d('0x4b')]=_[_0xd80d('0x5d')](_0x33d61b[_0xd80d('0x4b')]);_0x3c36a6['filters']=_[_0xd80d('0x4d')](_0x3c36a6[_0xd80d('0x49')],_0x3c36a6['query']);_0x30693d[_0xd80d('0x4e')]=_[_0xd80d('0x4d')](_0x3c36a6[_0xd80d('0x49')],qs[_0xd80d('0x4f')](_0x33d61b['query']['fields']));_0x30693d[_0xd80d('0x4e')]=_0x30693d[_0xd80d('0x4e')][_0xd80d('0x50')]?_0x30693d[_0xd80d('0x4e')]:_0x3c36a6[_0xd80d('0x49')];if(!_0x33d61b['query']['hasOwnProperty']('nolimit')){_0x30693d[_0xd80d('0x1e')]=qs['limit'](_0x33d61b['query'][_0xd80d('0x1e')]);_0x30693d[_0xd80d('0x1d')]=qs[_0xd80d('0x1d')](_0x33d61b[_0xd80d('0x4b')]['offset']);}_0x30693d[_0xd80d('0x53')]=qs[_0xd80d('0x54')](_0x33d61b['query'][_0xd80d('0x54')]);_0x30693d['where']=qs[_0xd80d('0x4c')](_['pick'](_0x33d61b[_0xd80d('0x4b')],_0x3c36a6[_0xd80d('0x4c')]));_0x30693d[_0xd80d('0x55')][_0xd80d('0x68')]=_0x2fd553['id'];if(_0x33d61b[_0xd80d('0x4b')][_0xd80d('0x57')]){_0x30693d[_0xd80d('0x55')]=_[_0xd80d('0x58')](_0x30693d[_0xd80d('0x55')],{'$or':_[_0xd80d('0x43')](_0x30693d['attributes'],function(_0x1be147){var _0x30486f={};_0x30486f[_0x1be147]={'$like':'%'+_0x33d61b[_0xd80d('0x4b')]['filter']+'%'};return _0x30486f;})});}if(_0x33d61b[_0xd80d('0x4b')][_0xd80d('0x98')]){var _0x7f0651=_0x33d61b[_0xd80d('0x4b')][_0xd80d('0x98')][_0xd80d('0x99')](',');var _0x48698b={};_0x48698b[_0x7f0651[0x0]]={'$gte':moment(_0x7f0651[0x1])[_0xd80d('0x9a')](_0xd80d('0x9b'))};_0x30693d[_0xd80d('0x55')]=_[_0xd80d('0x58')](_0x30693d[_0xd80d('0x55')],_0x48698b);}_0x30693d=_[_0xd80d('0x58')]({},_0x30693d,_0x33d61b[_0xd80d('0x59')]);return db['MailMessage'][_0xd80d('0x20')]({'where':_0x30693d[_0xd80d('0x55')]})[_0xd80d('0x22')](function(_0x5367c5){_0x598ee0[_0xd80d('0x20')]=_0x5367c5;if(_0x33d61b['query'][_0xd80d('0x5e')]){_0x30693d[_0xd80d('0x5f')]=[{'all':!![]}];}return db[_0xd80d('0x97')][_0xd80d('0x5a')](_0x30693d);})[_0xd80d('0x22')](function(_0x1a1ef9){if(_0x33d61b[_0xd80d('0x4b')][_0xd80d('0x9c')]===_0xd80d('0x9d')){for(var _0x1ff2fa=0x0;_0x1ff2fa<_0x1a1ef9[_0xd80d('0x50')];_0x1ff2fa++){_0x1a1ef9[_0x1ff2fa][_0xd80d('0x62')]=juice(_0x1a1ef9[_0x1ff2fa][_0xd80d('0x62')]);}}_0x598ee0[_0xd80d('0x6b')]=_0x1a1ef9;return _0x598ee0;});}})[_0xd80d('0x22')](respondWithFilteredResult(_0x23cdef,_0x30693d))[_0xd80d('0x19')](handleError(_0x23cdef,null));};exports['send']=function(_0x5ecbbc,_0x478bf7){var _0x32ca35,_0x522005={},_0x18d881;if(_0x5ecbbc['body']['to']){_0x18d881=_0x5ecbbc[_0xd80d('0x62')]['to'][_0xd80d('0x99')](',')[0x0];}return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x5ecbbc['params']['id']},'include':[{'model':db[_0xd80d('0x9e')],'as':_0xd80d('0x9f'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x18d881},'limit':0x1,'order':[[_0xd80d('0xa0'),'DESC']]}]},{'model':db[_0xd80d('0x5c')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd80d('0xa1')],'as':_0xd80d('0xa1'),'raw':!![]}]}]})[_0xd80d('0x22')](handleEntityNotFound(_0x478bf7,null))[_0xd80d('0x22')](function(_0x5cb253){if(!_0x5cb253)return;_0x32ca35=_0x5cb253;if(!_0x5cb253['Smtp'])throw new Error(_0xd80d('0xa2'));if(_[_0xd80d('0xa3')](_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xa4')])){_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xa4')]=util[_0xd80d('0x9a')]('%s\x20<%s>',_0x5cb253['name'],_0x5cb253['email']||_0x5cb253[_0xd80d('0x3f')][_0xd80d('0x34')]);}if(_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xa5')]&&_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xa5')][_0xd80d('0x50')]){for(var _0x29e2b9=0x0;_0x29e2b9<_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xa5')][_0xd80d('0x50')];_0x29e2b9+=0x1){_0x5ecbbc['body'][_0xd80d('0xa5')][_0x29e2b9]={'filename':_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xa5')][_0x29e2b9]['name'],'path':path['join'](config[_0xd80d('0xa6')],_0xd80d('0xa7'),_0x5ecbbc[_0xd80d('0x62')]['attachments'][_0x29e2b9]['basename'])};}}var _0x352b06=_0x5cb253[_0xd80d('0xa8')]();return respondWithRpcPromise(_0xd80d('0xa9'),'sendMail',{'account':_0x352b06,'message':_0x5ecbbc[_0xd80d('0x62')]});})[_0xd80d('0x22')](function(_0x175095){if(!_0x175095)return;_0x522005=_0x175095;if(!_0x32ca35['List'])throw new Error(_0xd80d('0xaa'));if(_0x32ca35[_0xd80d('0x9f')][_0xd80d('0xab')][_0xd80d('0x50')])return _0x32ca35[_0xd80d('0x9f')][_0xd80d('0xab')][0x0];return db[_0xd80d('0x82')][_0xd80d('0x6e')](_[_0xd80d('0xac')](_0x5ecbbc[_0xd80d('0x62')],{'firstName':_0x5ecbbc['body']['to'],'email':_0x5ecbbc[_0xd80d('0x62')]['to'],'phone':_0x5ecbbc['body']['to'],'ListId':_0x32ca35[_0xd80d('0x73')]}));})[_0xd80d('0x22')](function(_0xd7eae1){if(!_0xd7eae1)return;var _0x1dbbbf={'UserId':_0x5ecbbc['user']['id'],'ContactId':_0xd7eae1['id'],'MailAccountId':_0x32ca35['id'],'inReplyTo':_0x522005[_0xd80d('0xad')],'to':_0x5ecbbc[_0xd80d('0x62')]['from'],'cc':_0x5ecbbc[_0xd80d('0x62')]['cc'],'subject':_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xae')],'attach':_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xd80d('0x9a')](_0xd80d('0x9b')),'lastMsgDirection':_0xd80d('0xb0'),'Messages':[_[_0xd80d('0x58')](_0x5ecbbc[_0xd80d('0x62')],{'messageId':_0x522005[_0xd80d('0xad')],'sentAt':moment()['format'](_0xd80d('0x9b')),'read':!![],'MailAccountId':_0x32ca35['id'],'UserId':_0x5ecbbc[_0xd80d('0x34')]['id'],'ContactId':_0xd7eae1['id']})]};if(_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xb1')]){_0x1dbbbf=_[_0xd80d('0x58')](_0x1dbbbf,_0x5ecbbc[_0xd80d('0x62')][_0xd80d('0xb1')]);}return db[_0xd80d('0x81')][_0xd80d('0x6e')](_0x1dbbbf,{'include':[{'model':db['MailMessage'],'as':_0xd80d('0xb2')}]});})['then'](respondWithResult(_0x478bf7,null))[_0xd80d('0x19')](handleError(_0x478bf7,null));};exports['verifySmtp']=function(_0x3661c8,_0x90f1b5){return db['MailAccount'][_0xd80d('0x60')]({'where':{'id':_0x3661c8['params']['id']},'include':[{'model':db[_0xd80d('0x5c')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd80d('0xa1')],'as':'CloudProvider','raw':!![]}]}]})[_0xd80d('0x22')](handleEntityNotFound(_0x90f1b5,null))[_0xd80d('0x22')](function(_0x4409bc){if(!_0x4409bc['Smtp'])return;var _0x41201e=_0x4409bc[_0xd80d('0xa8')]();return respondWithRpcPromise(_0xd80d('0xb3'),_0xd80d('0xb4'),{'account':_0x41201e});})[_0xd80d('0x22')](respondWithResult(_0x90f1b5,null))[_0xd80d('0x19')](handleError(_0x90f1b5,null));};exports[_0xd80d('0x23')]=function(_0x5be0f9,_0x1764c1){return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x5be0f9[_0xd80d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1764c1,null))[_0xd80d('0x22')](function(_0x294b6e){if(_0x294b6e&&_0x294b6e[_0xd80d('0x3b')]){throw new db[(_0xd80d('0xb5'))][(_0xd80d('0xb6'))](_0xd80d('0xb7'));}return _0x294b6e;})['then'](removeEntity(_0x1764c1,null))['catch'](handleError(_0x1764c1,null));};exports['addAgents']=function(_0x4ecbb6,_0x4346d7){return db[_0xd80d('0x44')]['find']({'where':{'id':_0x4ecbb6['params']['id']}})['then'](handleEntityNotFound(_0x4346d7,null))[_0xd80d('0x22')](function(_0x442a0b){if(_0x442a0b){return _0x442a0b[_0xd80d('0xb8')](_0x4ecbb6[_0xd80d('0x62')][_0xd80d('0x71')],_[_0xd80d('0x80')](_0x4ecbb6[_0xd80d('0x62')],[_0xd80d('0x71'),'id'])||{})['spread'](function(_0x308af7){for(var _0x51dfac=0x0;_0x51dfac<_0x4ecbb6['body'][_0xd80d('0x71')][_0xd80d('0x50')];_0x51dfac+=0x1){socket[_0xd80d('0xb9')](_0xd80d('0xba'),{'UserId':Number(_0x4ecbb6[_0xd80d('0x62')][_0xd80d('0x71')][_0x51dfac]),'MailAccountId':Number(_0x4ecbb6[_0xd80d('0x5b')]['id'])});}return _0x308af7;});}})[_0xd80d('0x22')](respondWithResult(_0x4346d7,null))[_0xd80d('0x19')](handleError(_0x4346d7,null));};exports[_0xd80d('0xbb')]=function(_0x6af938,_0x1b5919){return db[_0xd80d('0x44')][_0xd80d('0x60')]({'where':{'id':_0x6af938[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x1b5919,null))[_0xd80d('0x22')](function(_0x3c0481){if(_0x3c0481){return _0x3c0481[_0xd80d('0xbb')](_0x6af938['query']['ids'])[_0xd80d('0x22')](function(){if(_[_0xd80d('0xbc')](_0x6af938[_0xd80d('0x4b')][_0xd80d('0x71')])){for(var _0x1508c2=0x0;_0x1508c2<_0x6af938[_0xd80d('0x4b')][_0xd80d('0x71')][_0xd80d('0x50')];_0x1508c2+=0x1){socket['emit'](_0xd80d('0xbd'),{'UserId':Number(_0x6af938[_0xd80d('0x4b')][_0xd80d('0x71')][_0x1508c2]),'MailAccountId':Number(_0x6af938[_0xd80d('0x5b')]['id'])});}}else{socket[_0xd80d('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x6af938[_0xd80d('0x4b')]['ids']),'MailAccountId':Number(_0x6af938[_0xd80d('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b5919,null))[_0xd80d('0x19')](handleError(_0x1b5919,null));};exports[_0xd80d('0xbe')]=function(_0x564088,_0x5ae10b){var _0x321575={};var _0x3c2d0c={};var _0xc7a6ef;var _0x4ae964;return db[_0xd80d('0x44')]['findOne']({'where':{'id':_0x564088[_0xd80d('0x5b')]['id']}})[_0xd80d('0x22')](handleEntityNotFound(_0x5ae10b,null))['then'](function(_0xf239a0){if(_0xf239a0){_0xc7a6ef=_0xf239a0;_0x3c2d0c[_0xd80d('0x49')]=_[_0xd80d('0x5d')](db[_0xd80d('0x84')][_0xd80d('0x45')]);_0x3c2d0c[_0xd80d('0x4b')]=_['keys'](_0x564088[_0xd80d('0x4b')]);_0x3c2d0c['filters']=_[_0xd80d('0x4d')](_0x3c2d0c[_0xd80d('0x49')],_0x3c2d0c[_0xd80d('0x4b')]);_0x321575[_0xd80d('0x4e')]=_['intersection'](_0x3c2d0c[_0xd80d('0x49')],qs['fields'](_0x564088[_0xd80d('0x4b')][_0xd80d('0x4f')]));_0x321575['attributes']=_0x321575[_0xd80d('0x4e')][_0xd80d('0x50')]?_0x321575[_0xd80d('0x4e')]:_0x3c2d0c['model'];_0x321575[_0xd80d('0x53')]=qs['sort'](_0x564088[_0xd80d('0x4b')][_0xd80d('0x54')]);_0x321575[_0xd80d('0x55')]=qs[_0xd80d('0x4c')](_['pick'](_0x564088['query'],_0x3c2d0c[_0xd80d('0x4c')]));if(_0x564088['query'][_0xd80d('0x57')]){_0x321575['where']=_[_0xd80d('0x58')](_0x321575[_0xd80d('0x55')],{'$or':_[_0xd80d('0x43')](_0x321575[_0xd80d('0x4e')],function(_0x1cc604){var _0x326a08={};_0x326a08[_0x1cc604]={'$like':'%'+_0x564088[_0xd80d('0x4b')][_0xd80d('0x57')]+'%'};return _0x326a08;})});}_0x321575=_[_0xd80d('0x58')]({},_0x321575,_0x564088[_0xd80d('0x59')]);return _0xc7a6ef[_0xd80d('0xbe')](_0x321575);}})['then'](function(_0xd0c526){if(_0xd0c526){_0x4ae964=_0xd0c526['length'];if(!_0x564088[_0xd80d('0x4b')][_0xd80d('0x51')](_0xd80d('0x52'))){_0x321575['limit']=qs['limit'](_0x564088['query'][_0xd80d('0x1e')]);_0x321575['offset']=qs['offset'](_0x564088[_0xd80d('0x4b')][_0xd80d('0x1d')]);}return _0xc7a6ef[_0xd80d('0xbe')](_0x321575);}})['then'](function(_0x3e1f78){if(_0x3e1f78){return _0x3e1f78?{'count':_0x4ae964,'rows':_0x3e1f78}:null;}})[_0xd80d('0x22')](respondWithResult(_0x5ae10b,null))[_0xd80d('0x19')](handleError(_0x5ae10b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 295aed3..bcbd17a 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 _0xb1f7=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x2f76b7,_0x27ed34){var _0x23c611=function(_0x40ebbf){while(--_0x40ebbf){_0x2f76b7['push'](_0x2f76b7['shift']());}};_0x23c611(++_0x27ed34);}(_0xb1f7,0x19d));var _0x7b1f=function(_0x3b72a8,_0x228ed6){_0x3b72a8=_0x3b72a8-0x0;var _0x5c4edd=_0xb1f7[_0x3b72a8];return _0x5c4edd;};'use strict';var EventEmitter=require(_0x7b1f('0x0'));var MailAccount=require(_0x7b1f('0x1'))['db'][_0x7b1f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7b1f('0x3')](0x0);var events={'afterCreate':_0x7b1f('0x4'),'afterUpdate':_0x7b1f('0x5'),'afterDestroy':_0x7b1f('0x6')};function emitEvent(_0x86aff){return function(_0x2d1f14,_0x2941cc,_0x23838f){MailAccountEvents[_0x7b1f('0x7')](_0x86aff+':'+_0x2d1f14['id'],_0x2d1f14);MailAccountEvents[_0x7b1f('0x7')](_0x86aff,_0x2d1f14);_0x23838f(null);};}for(var e in events){if(events[_0x7b1f('0x8')](e)){var event=events[e];MailAccount[_0x7b1f('0x9')](e,emitEvent(event));}}module[_0x7b1f('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x414f=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x452f62,_0x2b9811){var _0xc72188=function(_0x32efaa){while(--_0x32efaa){_0x452f62['push'](_0x452f62['shift']());}};_0xc72188(++_0x2b9811);}(_0x414f,0x13f));var _0xf414=function(_0x3ee99e,_0x4affec){_0x3ee99e=_0x3ee99e-0x0;var _0x1b56e1=_0x414f[_0x3ee99e];return _0x1b56e1;};'use strict';var EventEmitter=require(_0xf414('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xf414('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf414('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf414('0x3'),'afterDestroy':_0xf414('0x4')};function emitEvent(_0x26a3b2){return function(_0x335d3e,_0x29b998,_0x22e5aa){MailAccountEvents[_0xf414('0x5')](_0x26a3b2+':'+_0x335d3e['id'],_0x335d3e);MailAccountEvents['emit'](_0x26a3b2,_0x335d3e);_0x22e5aa(null);};}for(var e in events){if(events[_0xf414('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xf414('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index eafc2d1..fe629c2 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 _0x0057=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','CloudProvider'];(function(_0x26c7c9,_0x7b7d35){var _0x4fd423=function(_0x116abf){while(--_0x116abf){_0x26c7c9['push'](_0x26c7c9['shift']());}};_0x4fd423(++_0x7b7d35);}(_0x0057,0x145));var _0x7005=function(_0x509c4d,_0x50717e){_0x509c4d=_0x509c4d-0x0;var _0x29b6c6=_0x0057[_0x509c4d];return _0x29b6c6;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x46f931){return _0x46f931[_0x7005('0x0')]('MailAccount',attributes,{'tableName':_0x7005('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x261e82=this;var _0x1093f1={'id':_0x261e82['id'],'tls':{'rejectUnauthorized':![]}};if(_0x261e82[_0x7005('0x2')]!==_0x7005('0x3')){_0x1093f1[_0x7005('0x4')]=_0x261e82[_0x7005('0x2')];}else{_0x1093f1[_0x7005('0x5')]=_0x261e82[_0x7005('0x6')][_0x7005('0x5')];_0x1093f1['port']=_0x261e82[_0x7005('0x6')][_0x7005('0x7')];_0x1093f1['secure']=_0x261e82[_0x7005('0x6')][_0x7005('0x8')];}if(_0x261e82[_0x7005('0x6')][_0x7005('0x9')]){if(_0x261e82[_0x7005('0x6')]['modernAuthentication']){if(!_0x261e82[_0x7005('0x6')][_0x7005('0xa')])throw new Error(_0x7005('0xb'));_0x1093f1[_0x7005('0xc')]={'type':'OAuth2','user':_0x261e82[_0x7005('0x6')][_0x7005('0xd')],'accessToken':_0x261e82[_0x7005('0x6')][_0x7005('0xa')][_0x7005('0xe')]};}else{_0x1093f1[_0x7005('0xc')]={'user':_0x261e82[_0x7005('0x6')]['user'],'pass':_0x261e82[_0x7005('0x6')][_0x7005('0xf')]};}}return _0x1093f1;}}});}; \ No newline at end of file +var _0x931a=['host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service'];(function(_0x31341b,_0x533e30){var _0xfc7b19=function(_0x51a1d4){while(--_0x51a1d4){_0x31341b['push'](_0x31341b['shift']());}};_0xfc7b19(++_0x533e30);}(_0x931a,0x1a9));var _0xa931=function(_0x54d13a,_0xe2af58){_0x54d13a=_0x54d13a-0x0;var _0x26dc79=_0x931a[_0x54d13a];return _0x26dc79;};'use strict';var attributes=require(_0xa931('0x0'));module[_0xa931('0x1')]=function(_0x1a14a1){return _0x1a14a1[_0xa931('0x2')](_0xa931('0x3'),attributes,{'tableName':_0xa931('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2ea596=this;var _0x7365a0={'id':_0x2ea596['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2ea596[_0xa931('0x5')]!=='custom'){_0x7365a0[_0xa931('0x6')]=_0x2ea596[_0xa931('0x5')];}else{_0x7365a0[_0xa931('0x7')]=_0x2ea596['Smtp']['host'];_0x7365a0['port']=_0x2ea596[_0xa931('0x8')][_0xa931('0x9')];_0x7365a0[_0xa931('0xa')]=_0x2ea596[_0xa931('0x8')][_0xa931('0xa')];}if(_0x2ea596['Smtp']['authentication']){if(_0x2ea596[_0xa931('0x8')][_0xa931('0xb')]){if(!_0x2ea596[_0xa931('0x8')][_0xa931('0xc')])throw new Error(_0xa931('0xd'));_0x7365a0[_0xa931('0xe')]={'type':'OAuth2','user':_0x2ea596[_0xa931('0x8')][_0xa931('0xf')],'accessToken':_0x2ea596[_0xa931('0x8')][_0xa931('0xc')][_0xa931('0x10')]};}else{_0x7365a0[_0xa931('0xe')]={'user':_0x2ea596[_0xa931('0x8')][_0xa931('0xf')],'pass':_0x2ea596[_0xa931('0x8')][_0xa931('0x11')]};}}return _0x7365a0;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e2cb3d8..28e4654 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 _0x687b=['originTo','originCc','ChatWebsiteId','originChannel','Attachment','Attachments','UserId','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','body','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','CloudProvider','List','omit','applications','list','orderBy','asc','length','close','autoclose','*,*,*,*','ListId','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','spread','update','interaction','get','created','contact'];(function(_0x5a7f23,_0x47b655){var _0x3cc78d=function(_0x25ee96){while(--_0x25ee96){_0x5a7f23['push'](_0x5a7f23['shift']());}};_0x3cc78d(++_0x47b655);}(_0x687b,0x14a));var _0xb687=function(_0x47ee00,_0x256539){_0x47ee00=_0x47ee00-0x0;var _0x3d35f9=_0x687b[_0x47ee00];return _0x3d35f9;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var BPromise=require(_0xb687('0x2'));var rs=require(_0xb687('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xb687('0x4'))(_0xb687('0x5'));var config=require(_0xb687('0x6'));var jayson=require(_0xb687('0x7'));var client=jayson[_0xb687('0x8')][_0xb687('0x9')]({'port':0x232c});config[_0xb687('0xa')]=_[_0xb687('0xb')](config[_0xb687('0xa')],{'host':_0xb687('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb687('0xa')]));require(_0xb687('0xd'))['register'](socket);function respondWithRpcPromise(_0x1a99c5,_0x21e3ab,_0x825ad){return new BPromise(function(_0x15dc9a,_0x404fdb){return client[_0xb687('0xe')](_0x1a99c5,_0x825ad)[_0xb687('0xf')](function(_0xaf4727){logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));logger[_0xb687('0x12')](_0xb687('0x13'),_0x21e3ab,_0xb687('0x11'),JSON['stringify'](_0xaf4727));if(_0xaf4727['error']){if(_0xaf4727[_0xb687('0x14')][_0xb687('0x15')]===0x1f4){logger['error'](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x404fdb(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x15dc9a(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}else{logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));_0x15dc9a(_0xaf4727[_0xb687('0x18')][_0xb687('0x17')]);}})['catch'](function(_0x48958d){logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0x48958d);_0x404fdb(_0x48958d);});});}exports[_0xb687('0x19')]=function(_0x4b593b){var _0x42cdd2=this;return new Promise(function(_0x481f1d,_0x1bd2bf){return db[_0xb687('0x1a')][_0xb687('0x1b')]({'raw':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b593b['options']?_0x4b593b[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1f')]||null:null,'limit':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x20')]||null:null,'include':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x21')]?_[_0xb687('0x22')](_0x4b593b['options'][_0xb687('0x21')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x23')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1f')],'include':_0x129347[_0xb687('0x21')]?_[_0xb687('0x22')](_0x129347[_0xb687('0x21')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x23')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1f')],'include':_0x3cb2f2['include']?_[_0xb687('0x22')](_0x3cb2f2[_0xb687('0x21')],function(_0x392721){return{'model':db[_0x392721[_0xb687('0x23')]],'as':_0x392721['as'],'attributes':_0x392721[_0xb687('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x4e9a06){logger[_0xb687('0x10')]('GetMailAccount',_0x4b593b);logger[_0xb687('0x12')](_0xb687('0x19'),_0x4b593b,JSON[_0xb687('0x24')](_0x4e9a06));_0x481f1d(_0x4e9a06);})[_0xb687('0x25')](function(_0x1ad3ef){logger[_0xb687('0x14')](_0xb687('0x19'),_0x1ad3ef['message'],_0x4b593b);_0x1bd2bf(_0x42cdd2[_0xb687('0x14')](0x1f4,_0x1ad3ef[_0xb687('0x17')]));});});};exports[_0xb687('0x26')]=function(_0x22cd1d){var _0xa18fec=this;return new Promise(function(_0x263834,_0x44be88){return db[_0xb687('0x1a')][_0xb687('0x27')]({'raw':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['attributes']||null:null,'include':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')]?_['map'](_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')],function(_0x548b83){return{'model':db[_0x548b83[_0xb687('0x23')]],'as':_0x548b83['as'],'attributes':_0x548b83['attributes'],'include':_0x548b83[_0xb687('0x21')]?_[_0xb687('0x22')](_0x548b83[_0xb687('0x21')],function(_0x3e146a){return{'model':db[_0x3e146a[_0xb687('0x23')]],'as':_0x3e146a['as'],'attributes':_0x3e146a[_0xb687('0x1f')],'include':_0x3e146a['include']?_[_0xb687('0x22')](_0x3e146a[_0xb687('0x21')],function(_0x2a73df){return{'model':db[_0x2a73df[_0xb687('0x23')]],'as':_0x2a73df['as'],'attributes':_0x2a73df['attributes']};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x100f4a){if(_0x22cd1d[_0xb687('0x1c')][_0xb687('0x28')]===!![])_0x100f4a[_0xb687('0x29')]('smtpOptions',_0x100f4a[_0xb687('0x2a')]());logger[_0xb687('0x10')](_0xb687('0x26'),_0x22cd1d);logger[_0xb687('0x12')](_0xb687('0x26'),_0x22cd1d,JSON[_0xb687('0x24')](_0x100f4a));_0x263834(_0x100f4a);})['catch'](function(_0x5ad577){logger[_0xb687('0x14')]('ShowMailAccount',_0x5ad577[_0xb687('0x17')],_0x22cd1d);_0x44be88(_0xa18fec[_0xb687('0x14')](0x1f4,_0x5ad577['message']));});});};exports[_0xb687('0x2b')]=function(_0x2ce07a){var _0x57776b=this;return new Promise(function(_0x394b56,_0x28031e){var _0x127b25={'body':_0x2ce07a['body'],'channel':_0xb687('0x2c')};var _0x9cffb2=_[_0xb687('0x2d')](_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')]),[_0xb687('0x31'),'updatedAt',_0xb687('0x32'),'ListId']);var _0x50fdb7=![];if(_0x2ce07a[_0xb687('0x33')]['id']){delete _0x2ce07a[_0xb687('0x33')]['id'];}if(_['isNil'](_0x2ce07a[_0xb687('0x33')]['from'])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x34')));}if(_['isNil'](_0x2ce07a[_0xb687('0x33')][_0xb687('0x33')])||_0x2ce07a['body'][_0xb687('0x33')]===''){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x35')));}if(_[_0xb687('0x36')](_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x38')+_0x9cffb2));}if(!_[_0xb687('0x39')](_0x9cffb2,_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9cffb2));}var _0x1ac373={};_0x1ac373[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')];return db[_0xb687('0x1a')][_0xb687('0x27')]({'where':{'id':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb687('0x2f')],'as':_0xb687('0x3c'),'where':_0x1ac373,'limit':0x1,'order':[[_0xb687('0x3d'),_0xb687('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xb687('0x3f')},{'model':db[_0xb687('0x40')],'as':_0xb687('0x41'),'include':[{'model':db[_0xb687('0x42')],'as':'CloudProvider'}]}]})[_0xb687('0xf')](function(_0xfc4c5f){if(_0xfc4c5f&&_0xfc4c5f[_0xb687('0x43')]){var _0x401b99=_0xfc4c5f['get']({'plain':!![]});_0x127b25['account']=_[_0xb687('0x44')](_0x401b99,[_0xb687('0x3f'),_0xb687('0x43')]);_0x127b25['account']['smtpOptions']=_0xfc4c5f[_0xb687('0x2a')]();_0x127b25[_0xb687('0x45')]=_0x401b99[_0xb687('0x3f')];_0x127b25[_0xb687('0x46')]=_0x401b99[_0xb687('0x43')];_0x127b25[_0xb687('0x45')]=_[_0xb687('0x47')](_0x127b25[_0xb687('0x45')],['priority'],[_0xb687('0x48')]);if(_0x127b25[_0xb687('0x3b')]&&_0x127b25[_0xb687('0x3b')]['autoclose']){_0x127b25['applications']['push']({'id':0x0,'priority':_0x127b25['applications'][_0xb687('0x49')]+0x1,'app':_0xb687('0x4a'),'appdata':_0xb687('0x4b'),'interval':_0xb687('0x4c')});}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x3f')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x3f')];}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x43')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x43')];}if(_0x401b99[_0xb687('0x43')][_0xb687('0x3c')][_0xb687('0x49')]){return _0x401b99[_0xb687('0x43')][_0xb687('0x3c')][0x0];}var _0x4dca01=_['defaults'](_0x2ce07a[_0xb687('0x33')],{'firstName':_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')],'ListId':_0x401b99[_0xb687('0x4d')]});_0x4dca01[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')]['from'];return db[_0xb687('0x2f')]['create'](_0x4dca01);}else{throw new Error(_0xb687('0x4e'));}})[_0xb687('0xf')](function(_0x50fb31){_0x127b25['contact']=_0x50fb31;if(_0x50fb31){if(!_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId']){_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')]=rs['generate']()+'\x20'+_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')];}var _0x1a31f6={'ContactId':_0x50fb31['id'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId'],'to':_0x2ce07a['body'][_0xb687('0x17')]['from'],'cc':_0x2ce07a['body']['message']['cc'],'subject':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x50')],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'};return db[_0xb687('0x54')][_0xb687('0x27')]({'where':{'closed':![],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db[_0xb687('0x55')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x56')]}}]})[_0xb687('0xf')](function(_0x1c031f){if(_0x1c031f){return[_0x1c031f,![]];}return db[_0xb687('0x54')][_0xb687('0x57')](_0x1a31f6)['then'](function(_0x22da49){return[_0x22da49,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb687('0x58')](function(_0x293281,_0x18993a){if(_0x293281){_0x50fdb7=_0x18993a;if(!_0x18993a){return _0x293281[_0xb687('0x59')]({'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')],'to':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x3a')],'cc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['cc'],'subject':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x50')],'attach':_0x293281[_0xb687('0x51')]?_0x293281[_0xb687('0x51')]:_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'substatus':null,'substatusAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'});}else{return _0x293281;}}})[_0xb687('0xf')](function(_0x48838a){_0x127b25[_0xb687('0x5a')]=_0x48838a[_0xb687('0x5b')]({'plain':!![]});_0x127b25[_0xb687('0x5a')][_0xb687('0x5c')]=_0x50fdb7;return db['MailMessage'][_0xb687('0x57')]({'body':_0x2ce07a[_0xb687('0x33')]['body'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'MailInteractionId':_0x48838a['id'],'direction':'in','ContactId':_0x127b25[_0xb687('0x5d')]['id'],'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x4f')],'from':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')],'to':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['to'],'cc':_0x2ce07a[_0xb687('0x33')]['message']['cc'],'subject':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['subject'],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['attach'],'Attachments':_0x2ce07a['body'][_0xb687('0x17')]['attachments'],'originTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5e')],'originCc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5f')],'bcc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['bcc'],'ChatWebsiteId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x60')]||null,'originChannel':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x61')]||'Email','ChatOfflineMessageId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb687('0x62')],'as':_0xb687('0x63')}]});})[_0xb687('0xf')](function(_0x1227fe){_0x127b25['message']=_0x1227fe;if(_0x127b25[_0xb687('0x5a')]['UserId']){return db['User'][_0xb687('0x27')]({'attributes':['id','name'],'where':{'id':_0x127b25['interaction'][_0xb687('0x64')]}})['then'](function(_0x137631){if(_0x137631){_0x127b25[_0xb687('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb687('0x65'),'appdata':_0x137631[_0xb687('0x66')]+','+(_0x127b25['account'][_0xb687('0x67')]||0xa),'interval':_0xb687('0x4c')});}return respondWithRpcPromise(_0xb687('0x68'),_0xb687('0x69'),_0x127b25);});}return respondWithRpcPromise(_0xb687('0x68'),_0xb687('0x69'),_0x127b25);})[_0xb687('0xf')](function(_0x2ce516){_0x394b56(_0x2ce516);})[_0xb687('0x25')](function(_0x4092a0){_0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0x4092a0['message']));});});}; \ No newline at end of file +var _0x5fab=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','getSmtpOptions','applications','orderBy','priority','push','length','close','autoclose','*,*,*,*','defaults','ListId','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','interaction','get','created','create','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','attributes','limit','include','model','map','ShowMailAccount','find','where','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','updatedAt'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x5fab,0x177));var _0xb5fa=function(_0x12c34e,_0x39287a){_0x12c34e=_0x12c34e-0x0;var _0x244e88=_0x5fab[_0x12c34e];return _0x244e88;};'use strict';var _=require(_0xb5fa('0x0'));var moment=require(_0xb5fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5fa('0x2'));var Redis=require(_0xb5fa('0x3'));var db=require(_0xb5fa('0x4'))['db'];var logger=require(_0xb5fa('0x5'))(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var jayson=require(_0xb5fa('0x8'));var client=jayson[_0xb5fa('0x9')][_0xb5fa('0xa')]({'port':0x232c});config[_0xb5fa('0xb')]=_['defaults'](config['redis'],{'host':_0xb5fa('0xc'),'port':0x18eb});var socket=require(_0xb5fa('0xd'))(new Redis(config[_0xb5fa('0xb')]));require('./mailAccount.socket')[_0xb5fa('0xe')](socket);function respondWithRpcPromise(_0x38d9a3,_0x2cf4a5,_0x54c7eb){return new BPromise(function(_0x5b5ea8,_0x3a8e1b){return client[_0xb5fa('0xf')](_0x38d9a3,_0x54c7eb)[_0xb5fa('0x10')](function(_0x44e6c8){logger[_0xb5fa('0x11')](_0xb5fa('0x12'),_0x2cf4a5,_0xb5fa('0x13'));logger[_0xb5fa('0x14')](_0xb5fa('0x15'),_0x2cf4a5,'request\x20sent',JSON[_0xb5fa('0x16')](_0x44e6c8));if(_0x44e6c8[_0xb5fa('0x17')]){if(_0x44e6c8['error'][_0xb5fa('0x18')]===0x1f4){logger['error'](_0xb5fa('0x12'),_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x3a8e1b(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x5b5ea8(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0xb5fa('0x13'));_0x5b5ea8(_0x44e6c8[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x324ba5){logger[_0xb5fa('0x17')](_0xb5fa('0x12'),_0x2cf4a5,_0x324ba5);_0x3a8e1b(_0x324ba5);});});}exports[_0xb5fa('0x1c')]=function(_0xc14dc4){var _0x368cb1=this;return new Promise(function(_0x3c8d53,_0x1f5064){return db['MailAccount'][_0xb5fa('0x1d')]({'raw':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')]['where']||null:null,'attributes':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x1f')]||null:null,'limit':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x20')]||null:null,'include':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4['options'][_0xb5fa('0x21')]?_['map'](_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x22')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x11053a[_0xb5fa('0x21')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes'],'include':_0x568870['include']?_[_0xb5fa('0x23')](_0x568870[_0xb5fa('0x21')],function(_0x12c0d4){return{'model':db[_0x12c0d4[_0xb5fa('0x22')]],'as':_0x12c0d4['as'],'attributes':_0x12c0d4[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x358549){logger[_0xb5fa('0x11')](_0xb5fa('0x1c'),_0xc14dc4);logger[_0xb5fa('0x14')](_0xb5fa('0x1c'),_0xc14dc4,JSON[_0xb5fa('0x16')](_0x358549));_0x3c8d53(_0x358549);})[_0xb5fa('0x1b')](function(_0x1f4380){logger[_0xb5fa('0x17')](_0xb5fa('0x1c'),_0x1f4380[_0xb5fa('0x19')],_0xc14dc4);_0x1f5064(_0x368cb1[_0xb5fa('0x17')](0x1f4,_0x1f4380[_0xb5fa('0x19')]));});});};exports[_0xb5fa('0x24')]=function(_0x291938){var _0x370d95=this;return new Promise(function(_0x10fb43,_0x25fc7c){return db['MailAccount'][_0xb5fa('0x25')]({'raw':_0x291938['options']?_0x291938['options']['raw']===undefined?!![]:![]:!![],'where':_0x291938[_0xb5fa('0x1e')]?_0x291938['options'][_0xb5fa('0x26')]||null:null,'attributes':_0x291938['options']?_0x291938['options'][_0xb5fa('0x1f')]||null:null,'include':_0x291938[_0xb5fa('0x1e')]?_0x291938['options']['include']?_[_0xb5fa('0x23')](_0x291938[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x22')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x23')](_0x560b53[_0xb5fa('0x21')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')],'include':_0x204d6b[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x204d6b['include'],function(_0x117694){return{'model':db[_0x117694[_0xb5fa('0x22')]],'as':_0x117694['as'],'attributes':_0x117694[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x5e7770){if(_0x291938['options']['smtp']===!![])_0x5e7770['setDataValue']('smtpOptions',_0x5e7770['getSmtpOptions']());logger[_0xb5fa('0x11')]('ShowMailAccount',_0x291938);logger[_0xb5fa('0x14')](_0xb5fa('0x24'),_0x291938,JSON[_0xb5fa('0x16')](_0x5e7770));_0x10fb43(_0x5e7770);})[_0xb5fa('0x1b')](function(_0x40c1c0){logger[_0xb5fa('0x17')]('ShowMailAccount',_0x40c1c0['message'],_0x291938);_0x25fc7c(_0x370d95['error'](0x1f4,_0x40c1c0[_0xb5fa('0x19')]));});});};exports['NotifyMailAccount']=function(_0x73d425){var _0x5addd5=this;return new Promise(function(_0x58aa97,_0x3cdf63){var _0x42d331={'body':_0x73d425[_0xb5fa('0x27')],'channel':_0xb5fa('0x28')};var _0x5bc93f=_[_0xb5fa('0x29')](_[_0xb5fa('0x2a')](db[_0xb5fa('0x2b')][_0xb5fa('0x2c')]),[_0xb5fa('0x2d'),'updatedAt',_0xb5fa('0x2e'),'ListId']);var _0x233f90=![];if(_0x73d425[_0xb5fa('0x27')]['id']){delete _0x73d425[_0xb5fa('0x27')]['id'];}if(_[_0xb5fa('0x2f')](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x31')));}if(_['isNil'](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')])||_0x73d425['body'][_0xb5fa('0x27')]===''){return _0x3cdf63(_0x5addd5['error'](0x1f4,_0xb5fa('0x32')));}if(_[_0xb5fa('0x2f')](_0x73d425['body']['mapKey'])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x33')+_0x5bc93f));}if(!_[_0xb5fa('0x34')](_0x5bc93f,_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x36')+_0x5bc93f));}var _0x125a5c={};_0x125a5c[_0x73d425['body'][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')]['from'];return db[_0xb5fa('0x37')][_0xb5fa('0x25')]({'where':{'id':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x39')],'as':_0xb5fa('0x3a'),'include':[{'model':db[_0xb5fa('0x2b')],'as':_0xb5fa('0x3b'),'where':_0x125a5c,'limit':0x1,'order':[[_0xb5fa('0x3c'),_0xb5fa('0x3d')]]}]},{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')},{'model':db[_0xb5fa('0x40')],'as':_0xb5fa('0x41'),'include':[{'model':db[_0xb5fa('0x42')],'as':_0xb5fa('0x42')}]}]})[_0xb5fa('0x10')](function(_0x52f5d8){if(_0x52f5d8&&_0x52f5d8['List']){var _0x46194d=_0x52f5d8['get']({'plain':!![]});_0x42d331[_0xb5fa('0x38')]=_[_0xb5fa('0x43')](_0x46194d,['Applications',_0xb5fa('0x3a')]);_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x44')]=_0x52f5d8[_0xb5fa('0x45')]();_0x42d331[_0xb5fa('0x46')]=_0x46194d[_0xb5fa('0x3f')];_0x42d331['list']=_0x46194d[_0xb5fa('0x3a')];_0x42d331['applications']=_[_0xb5fa('0x47')](_0x42d331[_0xb5fa('0x46')],[_0xb5fa('0x48')],['asc']);if(_0x42d331[_0xb5fa('0x38')]&&_0x42d331[_0xb5fa('0x38')]['autoclose']){_0x42d331['applications'][_0xb5fa('0x49')]({'id':0x0,'priority':_0x42d331[_0xb5fa('0x46')][_0xb5fa('0x4a')]+0x1,'app':_0xb5fa('0x4b'),'appdata':_0xb5fa('0x4c'),'interval':_0xb5fa('0x4d')});}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')];}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')];}if(_0x46194d[_0xb5fa('0x3a')][_0xb5fa('0x3b')][_0xb5fa('0x4a')]){return _0x46194d[_0xb5fa('0x3a')]['Contacts'][0x0];}var _0x1900a5=_[_0xb5fa('0x4e')](_0x73d425[_0xb5fa('0x27')],{'firstName':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')],'ListId':_0x46194d[_0xb5fa('0x4f')]});_0x1900a5[_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')];return db['CmContact']['create'](_0x1900a5);}else{throw new Error(_0xb5fa('0x50'));}})[_0xb5fa('0x10')](function(_0x1e78cb){_0x42d331['contact']=_0x1e78cb;if(_0x1e78cb){if(!_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]){_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]=rs[_0xb5fa('0x52')]()+'\x20'+_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x30')];}var _0x4afc02={'ContactId':_0x1e78cb['id'],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'inReplyTo':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x54')],'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'};return db[_0xb5fa('0x57')][_0xb5fa('0x25')]({'where':{'closed':![],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x58')],'as':_0xb5fa('0x59'),'attributes':[_0xb5fa('0x51')],'where':{'messageId':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['inReplyTo']}}]})[_0xb5fa('0x10')](function(_0x34ebd0){if(_0x34ebd0){return[_0x34ebd0,![]];}return db[_0xb5fa('0x57')]['create'](_0x4afc02)[_0xb5fa('0x10')](function(_0x2d786e){return[_0x2d786e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb5fa('0x5a')](function(_0xb535c3,_0x5c25f6){if(_0xb535c3){_0x233f90=_0x5c25f6;if(!_0x5c25f6){return _0xb535c3['update']({'inReplyTo':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')]['message']['subject'],'attach':_0xb535c3['attach']?_0xb535c3[_0xb5fa('0x54')]:_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'});}else{return _0xb535c3;}}})[_0xb5fa('0x10')](function(_0x36b709){_0x42d331[_0xb5fa('0x5b')]=_0x36b709[_0xb5fa('0x5c')]({'plain':!![]});_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x5d')]=_0x233f90;return db[_0xb5fa('0x58')][_0xb5fa('0x5e')]({'body':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'MailInteractionId':_0x36b709['id'],'direction':'in','ContactId':_0x42d331['contact']['id'],'messageId':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'from':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'to':_0x73d425[_0xb5fa('0x27')]['message']['to'],'cc':_0x73d425[_0xb5fa('0x27')]['message']['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')]['message']['attach'],'Attachments':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x5f')],'originTo':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x60')],'originCc':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x61')],'bcc':_0x73d425['body']['message'][_0xb5fa('0x62')],'ChatWebsiteId':_0x73d425['body']['message']['ChatWebsiteId']||null,'originChannel':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x63')]||_0xb5fa('0x64'),'ChatOfflineMessageId':_0x73d425[_0xb5fa('0x27')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb5fa('0x65')],'as':_0xb5fa('0x66')}]});})['then'](function(_0x2d0c95){_0x42d331[_0xb5fa('0x19')]=_0x2d0c95;if(_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]){return db['User'][_0xb5fa('0x25')]({'attributes':['id',_0xb5fa('0x68')],'where':{'id':_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]}})[_0xb5fa('0x10')](function(_0x3348f7){if(_0x3348f7){_0x42d331[_0xb5fa('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb5fa('0x69'),'appdata':_0x3348f7['name']+','+(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x6a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);})[_0xb5fa('0x10')](function(_0x8ce5b8){_0x58aa97(_0x8ce5b8);})[_0xb5fa('0x1b')](function(_0x1bac54){_0x3cdf63(_0x5addd5['error'](0x1f4,_0x1bac54[_0xb5fa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index aaf9d5b..314b685 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 _0xa057=['emit','removeListener','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x39e23a,_0x17845e){var _0x40eda6=function(_0x5edec6){while(--_0x5edec6){_0x39e23a['push'](_0x39e23a['shift']());}};_0x40eda6(++_0x17845e);}(_0xa057,0x123));var _0x7a05=function(_0x901120,_0x2218ba){_0x901120=_0x901120-0x0;var _0x57bb0d=_0xa057[_0x901120];return _0x57bb0d;};'use strict';var MailAccountEvents=require(_0x7a05('0x0'));var events=[_0x7a05('0x1'),'remove',_0x7a05('0x2')];function createListener(_0x28ebf8,_0x195e2c){return function(_0x5a394a){_0x195e2c[_0x7a05('0x3')](_0x28ebf8,_0x5a394a);};}function removeListener(_0x3d346d,_0x5404f2){return function(){MailAccountEvents[_0x7a05('0x4')](_0x3d346d,_0x5404f2);};}exports['register']=function(_0x599a35){for(var _0x1f3b61=0x0,_0x19e056=events[_0x7a05('0x5')];_0x1f3b61<_0x19e056;_0x1f3b61++){var _0x560067=events[_0x1f3b61];var _0x32d32f=createListener(_0x7a05('0x6')+_0x560067,_0x599a35);MailAccountEvents['on'](_0x560067,_0x32d32f);}}; \ No newline at end of file +var _0xf5ac=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xf5ac,0x1a9));var _0xcf5a=function(_0x49c52e,_0x2fd41d){_0x49c52e=_0x49c52e-0x0;var _0x931127=_0xf5ac[_0x49c52e];return _0x931127;};'use strict';var MailAccountEvents=require(_0xcf5a('0x0'));var events=['save',_0xcf5a('0x1'),'update'];function createListener(_0x2a1190,_0x261e09){return function(_0x5ea981){_0x261e09[_0xcf5a('0x2')](_0x2a1190,_0x5ea981);};}function removeListener(_0x7f374c,_0x4e399e){return function(){MailAccountEvents[_0xcf5a('0x3')](_0x7f374c,_0x4e399e);};}exports[_0xcf5a('0x4')]=function(_0x2bfa6f){for(var _0x529b50=0x0,_0x358d1f=events[_0xcf5a('0x5')];_0x529b50<_0x358d1f;_0x529b50++){var _0xa47697=events[_0x529b50];var _0x66dde=createListener(_0xcf5a('0x6')+_0xa47697,_0x2bfa6f);MailAccountEvents['on'](_0xa47697,_0x66dde);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c45367d..c1f5770 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 _0x1517=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','delete','destroy','multer','path','Router','../../components/auth/service'];(function(_0x480435,_0x2ddfdd){var _0x5056b3=function(_0x42126d){while(--_0x42126d){_0x480435['push'](_0x480435['shift']());}};_0x5056b3(++_0x2ddfdd);}(_0x1517,0x71));var _0x7151=function(_0xace5bb,_0x4322f6){_0xace5bb=_0xace5bb-0x0;var _0x37bd48=_0x1517[_0xace5bb];return _0x37bd48;};'use strict';var multer=require(_0x7151('0x0'));var util=require('util');var path=require(_0x7151('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7151('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7151('0x3'));var interaction=require(_0x7151('0x4'));var config=require(_0x7151('0x5'));var controller=require('./mailApplication.controller');router[_0x7151('0x6')]('/:id',auth[_0x7151('0x7')](),controller[_0x7151('0x8')]);router[_0x7151('0x9')](_0x7151('0xa'),auth[_0x7151('0x7')](),controller['update']);router[_0x7151('0xb')](_0x7151('0xa'),auth['isAuthenticated'](),controller[_0x7151('0xc')]);module['exports']=router; \ No newline at end of file +var _0x90cb=['put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show'];(function(_0x3962ae,_0x58a714){var _0x4d2346=function(_0x2b9e8e){while(--_0x2b9e8e){_0x3962ae['push'](_0x3962ae['shift']());}};_0x4d2346(++_0x58a714);}(_0x90cb,0x17a));var _0xb90c=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0x90cb[_0x3a1972];return _0xc7e0b5;};'use strict';var multer=require(_0xb90c('0x0'));var util=require(_0xb90c('0x1'));var path=require(_0xb90c('0x2'));var timeout=require(_0xb90c('0x3'));var express=require(_0xb90c('0x4'));var router=express[_0xb90c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb90c('0x6'));var interaction=require(_0xb90c('0x7'));var config=require(_0xb90c('0x8'));var controller=require(_0xb90c('0x9'));router[_0xb90c('0xa')](_0xb90c('0xb'),auth['isAuthenticated'](),controller[_0xb90c('0xc')]);router[_0xb90c('0xd')](_0xb90c('0xb'),auth[_0xb90c('0xe')](),controller['update']);router[_0xb90c('0xf')](_0xb90c('0xb'),auth['isAuthenticated'](),controller[_0xb90c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2245ead..d146a46 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 _0xc60a=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1f4361,_0x520dce){var _0x5cfd53=function(_0xd72018){while(--_0xd72018){_0x1f4361['push'](_0x1f4361['shift']());}};_0x5cfd53(++_0x520dce);}(_0xc60a,0x1b3));var _0xac60=function(_0x462b48,_0x5379bf){_0x462b48=_0x462b48-0x0;var _0x2a4e55=_0xc60a[_0x462b48];return _0x2a4e55;};'use strict';var Sequelize=require(_0xac60('0x0'));module[_0xac60('0x1')]={'priority':{'type':Sequelize[_0xac60('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xac60('0x3')],'allowNull':![],'defaultValue':_0xac60('0x4')},'appdata':{'type':Sequelize[_0xac60('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xac60('0x3')],'defaultValue':_0xac60('0x6')}}; \ No newline at end of file +var _0x988c=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x988c,0xfb));var _0xc988=function(_0x21f260,_0x4770d2){_0x21f260=_0x21f260-0x0;var _0x2484d2=_0x988c[_0x21f260];return _0x2484d2;};'use strict';var Sequelize=require(_0xc988('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc988('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc988('0x2')],'allowNull':![],'defaultValue':_0xc988('0x3')},'appdata':{'type':Sequelize[_0xc988('0x4')]()},'description':{'type':Sequelize[_0xc988('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc988('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b6fec8c..73776cb 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(_0x5954dd,_0x23eedc){var _0x32fbab=function(_0x1f5781){while(--_0x1f5781){_0x5954dd['push'](_0x5954dd['shift']());}};_0x32fbab(++_0x23eedc);}(_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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x36ad73,_0x593eb9){var _0x59b7c8=function(_0x1b1e7d){while(--_0x1b1e7d){_0x36ad73['push'](_0x36ad73['shift']());}};_0x59b7c8(++_0x593eb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9c9cad3..3a8a6dc 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 _0x73b2=['path','rimraf','exports','define','mail_applications','lodash','util','bluebird','request-promise'];(function(_0x1c3a14,_0x100f3f){var _0x33ea86=function(_0x4fc20a){while(--_0x4fc20a){_0x1c3a14['push'](_0x1c3a14['shift']());}};_0x33ea86(++_0x100f3f);}(_0x73b2,0x1c7));var _0x273b=function(_0x473a91,_0x1db371){_0x473a91=_0x473a91-0x0;var _0x775747=_0x73b2[_0x473a91];return _0x775747;};'use strict';var _=require(_0x273b('0x0'));var util=require(_0x273b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x273b('0x2'));var rp=require(_0x273b('0x3'));var fs=require('fs');var path=require(_0x273b('0x4'));var rimraf=require(_0x273b('0x5'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x273b('0x6')]=function(_0x2e75e8,_0x1a5d1a){return _0x2e75e8[_0x273b('0x7')]('MailApplication',attributes,{'tableName':_0x273b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3bee=['exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x3bee,0x155));var _0xe3be=function(_0x55a53e,_0x563b3f){_0x55a53e=_0x55a53e-0x0;var _0x58335c=_0x3bee[_0x55a53e];return _0x58335c;};'use strict';var _=require(_0xe3be('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe3be('0x1'));var moment=require(_0xe3be('0x2'));var BPromise=require(_0xe3be('0x3'));var rp=require(_0xe3be('0x4'));var fs=require('fs');var path=require(_0xe3be('0x5'));var rimraf=require(_0xe3be('0x6'));var config=require(_0xe3be('0x7'));var attributes=require(_0xe3be('0x8'));module[_0xe3be('0x9')]=function(_0x472eab,_0x31fdb1){return _0x472eab['define'](_0xe3be('0xa'),attributes,{'tableName':_0xe3be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe3be('0xc'),'collate':_0xe3be('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 0f275a7..7d0149f 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 _0xc060=['info','MailApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailApplication','update','body','options','where','attributes','UpdateMailApplication','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xc060,0x165));var _0x0c06=function(_0x24ab7b,_0x2c9f19){_0x24ab7b=_0x24ab7b-0x0;var _0x5e3e25=_0xc060[_0x24ab7b];return _0x5e3e25;};'use strict';var _=require(_0x0c06('0x0'));var util=require(_0x0c06('0x1'));var moment=require(_0x0c06('0x2'));var BPromise=require(_0x0c06('0x3'));var rs=require(_0x0c06('0x4'));var fs=require('fs');var Redis=require(_0x0c06('0x5'));var db=require(_0x0c06('0x6'))['db'];var utils=require(_0x0c06('0x7'));var logger=require('../../config/logger')(_0x0c06('0x8'));var config=require(_0x0c06('0x9'));var jayson=require(_0x0c06('0xa'));var client=jayson[_0x0c06('0xb')][_0x0c06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x209f21,_0xd8275d,_0x48ca39){return new BPromise(function(_0x468a93,_0x5bb6c1){return client[_0x0c06('0xd')](_0x209f21,_0x48ca39)[_0x0c06('0xe')](function(_0xf27fd9){logger[_0x0c06('0xf')](_0x0c06('0x10'),_0xd8275d,_0x0c06('0x11'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0xd8275d,_0x0c06('0x11'),JSON['stringify'](_0xf27fd9));if(_0xf27fd9[_0x0c06('0x12')]){if(_0xf27fd9['error'][_0x0c06('0x13')]===0x1f4){logger[_0x0c06('0x12')]('MailApplication,\x20%s,\x20%s',_0xd8275d,_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);return _0x5bb6c1(_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);}logger['error'](_0x0c06('0x10'),_0xd8275d,_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);return _0x468a93(_0xf27fd9[_0x0c06('0x12')][_0x0c06('0x14')]);}else{logger['info'](_0x0c06('0x10'),_0xd8275d,_0x0c06('0x11'));_0x468a93(_0xf27fd9[_0x0c06('0x15')][_0x0c06('0x14')]);}})[_0x0c06('0x16')](function(_0x5a529d){logger[_0x0c06('0x12')](_0x0c06('0x10'),_0xd8275d,_0x5a529d);_0x5bb6c1(_0x5a529d);});});}exports['UpdateMailApplication']=function(_0xc6f041){var _0x2a1bdb=this;return new Promise(function(_0x14ce84,_0x28c5bc){return db[_0x0c06('0x17')][_0x0c06('0x18')](_0xc6f041[_0x0c06('0x19')],{'raw':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041[_0x0c06('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041['options'][_0x0c06('0x1b')]||null:null,'attributes':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041[_0x0c06('0x1a')][_0x0c06('0x1c')]||null:null,'limit':_0xc6f041[_0x0c06('0x1a')]?_0xc6f041[_0x0c06('0x1a')]['limit']||null:null})['then'](function(_0x1f81db){logger[_0x0c06('0xf')](_0x0c06('0x1d'),_0xc6f041);logger['debug'](_0x0c06('0x1d'),_0xc6f041,JSON[_0x0c06('0x1e')](_0x1f81db));_0x14ce84(_0x1f81db);})[_0x0c06('0x16')](function(_0x3a31f4){logger['error'](_0x0c06('0x1d'),_0x3a31f4[_0x0c06('0x14')],_0xc6f041);_0x28c5bc(_0x2a1bdb[_0x0c06('0x12')](0x1f4,_0x3a31f4[_0x0c06('0x14')]));});});}; \ No newline at end of file +var _0xccd4=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','update','options','raw','where','limit','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2471ae,_0x196073){var _0x316ef2=function(_0x481ec7){while(--_0x481ec7){_0x2471ae['push'](_0x2471ae['shift']());}};_0x316ef2(++_0x196073);}(_0xccd4,0x112));var _0x4ccd=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xccd4[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x4ccd('0x0'));var util=require('util');var moment=require(_0x4ccd('0x1'));var BPromise=require(_0x4ccd('0x2'));var rs=require(_0x4ccd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4ccd('0x4'));var logger=require('../../config/logger')(_0x4ccd('0x5'));var config=require(_0x4ccd('0x6'));var jayson=require(_0x4ccd('0x7'));var client=jayson[_0x4ccd('0x8')][_0x4ccd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8c4c,_0x5d373e,_0x5989e1){return new BPromise(function(_0x2216fe,_0x343da4){return client[_0x4ccd('0xa')](_0x2c8c4c,_0x5989e1)[_0x4ccd('0xb')](function(_0x462820){logger[_0x4ccd('0xc')](_0x4ccd('0xd'),_0x5d373e,_0x4ccd('0xe'));logger[_0x4ccd('0xf')](_0x4ccd('0x10'),_0x5d373e,'request\x20sent',JSON[_0x4ccd('0x11')](_0x462820));if(_0x462820[_0x4ccd('0x12')]){if(_0x462820['error'][_0x4ccd('0x13')]===0x1f4){logger[_0x4ccd('0x12')](_0x4ccd('0xd'),_0x5d373e,_0x462820['error'][_0x4ccd('0x14')]);return _0x343da4(_0x462820[_0x4ccd('0x12')][_0x4ccd('0x14')]);}logger[_0x4ccd('0x12')]('MailApplication,\x20%s,\x20%s',_0x5d373e,_0x462820[_0x4ccd('0x12')][_0x4ccd('0x14')]);return _0x2216fe(_0x462820[_0x4ccd('0x12')][_0x4ccd('0x14')]);}else{logger[_0x4ccd('0xc')](_0x4ccd('0xd'),_0x5d373e,_0x4ccd('0xe'));_0x2216fe(_0x462820[_0x4ccd('0x15')][_0x4ccd('0x14')]);}})['catch'](function(_0x5c5c4d){logger['error'](_0x4ccd('0xd'),_0x5d373e,_0x5c5c4d);_0x343da4(_0x5c5c4d);});});}exports[_0x4ccd('0x16')]=function(_0x5a8f80){var _0x3990db=this;return new Promise(function(_0x1175c5,_0x13523d){return db[_0x4ccd('0x17')][_0x4ccd('0x18')](_0x5a8f80['body'],{'raw':_0x5a8f80[_0x4ccd('0x19')]?_0x5a8f80['options'][_0x4ccd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a8f80['options']?_0x5a8f80[_0x4ccd('0x19')][_0x4ccd('0x1b')]||null:null,'attributes':_0x5a8f80[_0x4ccd('0x19')]?_0x5a8f80[_0x4ccd('0x19')]['attributes']||null:null,'limit':_0x5a8f80[_0x4ccd('0x19')]?_0x5a8f80[_0x4ccd('0x19')][_0x4ccd('0x1c')]||null:null})[_0x4ccd('0xb')](function(_0x15dc5f){logger[_0x4ccd('0xc')](_0x4ccd('0x16'),_0x5a8f80);logger[_0x4ccd('0xf')](_0x4ccd('0x16'),_0x5a8f80,JSON[_0x4ccd('0x11')](_0x15dc5f));_0x1175c5(_0x15dc5f);})['catch'](function(_0x3a5ca3){logger['error']('UpdateMailApplication',_0x3a5ca3[_0x4ccd('0x14')],_0x5a8f80);_0x13523d(_0x3990db['error'](0x1f4,_0x3a5ca3[_0x4ccd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ef5b034..9f6a26b 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 _0xdcfc=['./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2410db,_0x272e40){var _0xbc0013=function(_0x90e766){while(--_0x90e766){_0x2410db['push'](_0x2410db['shift']());}};_0xbc0013(++_0x272e40);}(_0xdcfc,0x74));var _0xcdcf=function(_0x2960f4,_0x421609){_0x2960f4=_0x2960f4-0x0;var _0x497125=_0xdcfc[_0x2960f4];return _0x497125;};'use strict';var express=require(_0xcdcf('0x0'));var router=express[_0xcdcf('0x1')]();var auth=require(_0xcdcf('0x2'));var interaction=require(_0xcdcf('0x3'));var controller=require(_0xcdcf('0x4'));router[_0xcdcf('0x5')]('/',auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x7')]);router['get'](_0xcdcf('0x8'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x9')]);router[_0xcdcf('0x5')](_0xcdcf('0xa'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0xb')]);router[_0xcdcf('0x5')](_0xcdcf('0xc'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0xd')]);router[_0xcdcf('0x5')](_0xcdcf('0xe'),auth['isAuthenticated'](),controller[_0xcdcf('0xf')]);router[_0xcdcf('0x10')]('/',auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x11')]);router[_0xcdcf('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xcdcf('0x12')]);router['post']('/:id/tags',auth[_0xcdcf('0x6')](),interaction[_0xcdcf('0x13')](_0xcdcf('0x14'),_0xcdcf('0x15')),controller['addTags']);router[_0xcdcf('0x16')](_0xcdcf('0xa'),auth['isAuthenticated'](),interaction[_0xcdcf('0x13')](_0xcdcf('0x14'),_0xcdcf('0x17')),controller[_0xcdcf('0x18')]);router[_0xcdcf('0x19')]('/:id',auth[_0xcdcf('0x6')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0xcdcf('0x1a')]);router[_0xcdcf('0x19')](_0xcdcf('0x1b'),auth[_0xcdcf('0x6')](),controller[_0xcdcf('0x1c')]);module[_0xcdcf('0x1d')]=router; \ No newline at end of file +var _0xd3f4=['mail','update','delete','mailinteraction:destroy','destroy','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','mailinteraction:addtags','addTags','put'];(function(_0xff8d4b,_0x1e6e8c){var _0x1126e6=function(_0x41cb4e){while(--_0x41cb4e){_0xff8d4b['push'](_0xff8d4b['shift']());}};_0x1126e6(++_0x1e6e8c);}(_0xd3f4,0xae));var _0x4d3f=function(_0xb18abc,_0x4f465b){_0xb18abc=_0xb18abc-0x0;var _0x5cdbb2=_0xd3f4[_0xb18abc];return _0x5cdbb2;};'use strict';var express=require(_0x4d3f('0x0'));var router=express['Router']();var auth=require(_0x4d3f('0x1'));var interaction=require(_0x4d3f('0x2'));var controller=require(_0x4d3f('0x3'));router[_0x4d3f('0x4')]('/',auth[_0x4d3f('0x5')](),controller[_0x4d3f('0x6')]);router[_0x4d3f('0x4')](_0x4d3f('0x7'),auth[_0x4d3f('0x5')](),controller[_0x4d3f('0x8')]);router[_0x4d3f('0x4')](_0x4d3f('0x9'),auth[_0x4d3f('0x5')](),controller[_0x4d3f('0xa')]);router['get'](_0x4d3f('0xb'),auth[_0x4d3f('0x5')](),controller[_0x4d3f('0xc')]);router[_0x4d3f('0x4')](_0x4d3f('0xd'),auth['isAuthenticated'](),controller[_0x4d3f('0xe')]);router['post']('/',auth[_0x4d3f('0x5')](),controller[_0x4d3f('0xf')]);router[_0x4d3f('0x10')](_0x4d3f('0xb'),auth[_0x4d3f('0x5')](),controller['addMessage']);router[_0x4d3f('0x10')](_0x4d3f('0x11'),auth[_0x4d3f('0x5')](),interaction[_0x4d3f('0x12')]('mail',_0x4d3f('0x13')),controller[_0x4d3f('0x14')]);router[_0x4d3f('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x4d3f('0x12')](_0x4d3f('0x16'),'mailinteraction:update'),controller[_0x4d3f('0x17')]);router[_0x4d3f('0x18')](_0x4d3f('0x9'),auth['isAuthenticated'](),interaction[_0x4d3f('0x12')](_0x4d3f('0x16'),_0x4d3f('0x19')),controller[_0x4d3f('0x1a')]);router[_0x4d3f('0x18')](_0x4d3f('0x11'),auth[_0x4d3f('0x5')](),controller['removeTags']);module[_0x4d3f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index aaca6f7..1096202 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 _0x8864=['TEXT','DATE','out','ENUM','BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8864,0x145));var _0x4886=function(_0xf7c93e,_0x586f4b){_0xf7c93e=_0xf7c93e-0x0;var _0x2e3b2a=_0x8864[_0xf7c93e];return _0x2e3b2a;};'use strict';var Sequelize=require(_0x4886('0x0'));var iconv=require('iconv');module[_0x4886('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4886('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4886('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4886('0x2')](0x1fe)},'to':{'type':Sequelize[_0x4886('0x2')]},'cc':{'type':Sequelize[_0x4886('0x3')]('long')},'subject':{'type':Sequelize[_0x4886('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4886('0x4')]},'substatus':{'type':Sequelize[_0x4886('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x4886('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4886('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4886('0x6')]('in',_0x4886('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4886('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x05da=['exports','DATE','STRING','TEXT','long','ENUM','out','BOOLEAN','iconv'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x05da,0x7d));var _0xa05d=function(_0x2d43f3,_0x4941bc){_0x2d43f3=_0x2d43f3-0x0;var _0x22cb6e=_0x05da[_0x2d43f3];return _0x22cb6e;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xa05d('0x0'));module[_0xa05d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa05d('0x2')]},'disposition':{'type':Sequelize[_0xa05d('0x3')]},'secondDisposition':{'type':Sequelize[_0xa05d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa05d('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xa05d('0x3')](0x1fe)},'to':{'type':Sequelize[_0xa05d('0x3')]},'cc':{'type':Sequelize[_0xa05d('0x4')](_0xa05d('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa05d('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xa05d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa05d('0x6')]('in',_0xa05d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa05d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa05d('0x6')]('in',_0xa05d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa05d('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 104254d..f1b45e0 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 _0xc284=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','message%d.eml','unlinkSync','sendStatus','zip-dir','moment','bluebird','util','path','squel','juice','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','findOne','out','-id','lastMsgText','catch','waiting','talking','total','closed','UserId','unmanaged','index','MailInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','ui.MailInteractionId','user_has_mail_interactions','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','length','unreadMessages','value','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','plainBody','buildExpression','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','isEmpty','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','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','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','includeAll','include','create','body','params','describe','addMessage','ids','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','true','addTags','setTags','omit','emit','mailInteractionTags:save','removeTags','download','unix','join','server','root','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','each','decode'];(function(_0x2ba7b,_0x5c47e9){var _0x1f3036=function(_0x1847a9){while(--_0x1847a9){_0x2ba7b['push'](_0x2ba7b['shift']());}};_0x1f3036(++_0x5c47e9);}(_0xc284,0xf8));var _0x4c28=function(_0x289a76,_0xd5b36b){_0x289a76=_0x289a76-0x0;var _0x57dc3f=_0xc284[_0x289a76];return _0x57dc3f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c28('0x0'));var moment=require(_0x4c28('0x1'));var BPromise=require(_0x4c28('0x2'));var util=require(_0x4c28('0x3'));var path=require(_0x4c28('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4c28('0x5'));var juice=require(_0x4c28('0x6'));var Redis=require(_0x4c28('0x7'));var qs=require('../../components/parsers/qs');var as=require(_0x4c28('0x8'));var logger=require('../../config/logger')(_0x4c28('0x9'));var config=require(_0x4c28('0xa'));var db=require(_0x4c28('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x4c28('0xc')]=_[_0x4c28('0xd')](config[_0x4c28('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c28('0xe'))(new Redis(config[_0x4c28('0xc')]));require(_0x4c28('0xf'))[_0x4c28('0x10')](socket);function respondWithStatusCode(_0x541339,_0x558300){_0x558300=_0x558300||0xcc;return function(_0x22bbce){if(_0x22bbce){return _0x541339['sendStatus'](_0x558300);}return _0x541339[_0x4c28('0x11')](_0x558300)[_0x4c28('0x12')]();};}function respondWithResult(_0x2a49db,_0x56e19a){_0x56e19a=_0x56e19a||0xc8;return function(_0x3ef086){if(_0x3ef086){return _0x2a49db[_0x4c28('0x11')](_0x56e19a)[_0x4c28('0x13')](_0x3ef086);}};}function respondWithFilteredResult(_0x5ef129,_0x2a43d2){return function(_0x4ba929){if(_0x4ba929){var _0x27201a=typeof _0x2a43d2[_0x4c28('0x14')]===_0x4c28('0x15')&&typeof _0x2a43d2[_0x4c28('0x16')]===_0x4c28('0x15');var _0x557c9c=_0x4ba929['count'];var _0x4a701f=_0x27201a?0x0:_0x2a43d2['offset'];var _0x221741=_0x27201a?_0x4ba929['count']:_0x2a43d2[_0x4c28('0x14')]+_0x2a43d2[_0x4c28('0x16')];var _0x100625;if(_0x221741>=_0x557c9c){_0x221741=_0x557c9c;_0x100625=0xc8;}else{_0x100625=0xce;}_0x5ef129[_0x4c28('0x11')](_0x100625);return _0x5ef129[_0x4c28('0x17')](_0x4c28('0x18'),_0x4a701f+'-'+_0x221741+'/'+_0x557c9c)['json'](_0x4ba929);}return null;};}function saveUpdates(_0x1f93b9){return function(_0x2572bf){if(_0x2572bf){return _0x2572bf[_0x4c28('0x19')](_0x1f93b9)[_0x4c28('0x1a')](function(_0x50b71b){return _0x50b71b;});}return null;};}function removeEntity(_0x5ed4b4){return function(_0x2acbb8){if(_0x2acbb8){return _0x2acbb8[_0x4c28('0x1b')]()[_0x4c28('0x1a')](function(){_0x5ed4b4[_0x4c28('0x11')](0xcc)[_0x4c28('0x12')]();});}};}function handleEntityNotFound(_0x5d8b30){return function(_0x3e92f3){if(!_0x3e92f3){_0x5d8b30['sendStatus'](0x194);}return _0x3e92f3;};}function handleError(_0x1c369f,_0x41475d){_0x41475d=_0x41475d||0x1f4;return function(_0xe9bd13){logger['error'](_0xe9bd13[_0x4c28('0x1c')]);if(_0xe9bd13[_0x4c28('0x1d')]){delete _0xe9bd13[_0x4c28('0x1d')];}_0x1c369f[_0x4c28('0x11')](_0x41475d)[_0x4c28('0x1e')](_0xe9bd13);};}function getInteractionUsers(_0x11ea81,_0x207b7b){return new BPromise(function(_0x4f9570,_0xe05345){try{if(_0x207b7b[_0x11ea81['id']]){_0x11ea81[_0x4c28('0x1f')]=_[_0x4c28('0x20')](_0x207b7b[_0x11ea81['id']],function(_0x20d031){return{'id':_0x20d031['id'],'fullname':_0x20d031['fullname']};});}}catch(_0x2e09b4){_0xe05345(_0x2e09b4);}_0x4f9570(_0x11ea81);});}function getInteractionTags(_0x13ea7c,_0xcfd21){return new BPromise(function(_0x1c0bbb,_0x2b8792){try{if(_0x13ea7c[_0x4c28('0x21')]){_0x13ea7c['Tags']=[];_0x13ea7c[_0x4c28('0x21')][_0x4c28('0x22')](',')[_0x4c28('0x23')](function(_0x89b02f){_0x13ea7c[_0x4c28('0x24')][_0x4c28('0x25')](_0xcfd21[_0x89b02f]);});}delete _0x13ea7c['TagIds'];}catch(_0x408fec){_0x2b8792(_0x408fec);}_0x1c0bbb(_0x13ea7c);});}function getLastMessageText(_0x5a6c4f){return new BPromise(function(_0x17b40a,_0x55a765){return db['MailMessage'][_0x4c28('0x26')]({'where':{'$and':[{'MailInteractionId':_0x5a6c4f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4c28('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x4c28('0x28'),'raw':!![]})[_0x4c28('0x1a')](function(_0x4c2235){if(_0x4c2235&&_0x4c2235['plainBody']){_0x5a6c4f[_0x4c28('0x29')]=_['trimStart'](_0x4c2235['plainBody']);}_0x17b40a(_0x5a6c4f);})[_0x4c28('0x2a')](function(_0x1a5163){_0x55a765(_0x1a5163);});});}function updateMailInteraction(_0x10584c,_0x141b0b,_0x4539bd,_0x47fb65){return new BPromise(function(_0xd53fd2,_0x3ad4b6){return getInteractionUsers(_0x10584c,_0x4539bd)[_0x4c28('0x1a')](function(_0x2d4e0d){return getInteractionTags(_0x2d4e0d,_0x141b0b);})[_0x4c28('0x1a')](function(_0x18873e){return getStateInteraction(_0x18873e);})[_0x4c28('0x1a')](function(_0x98350d){if(_0x47fb65){_0xd53fd2(getLastMessageText(_0x98350d));}else{_0xd53fd2(_0x98350d);}})['catch'](function(_0x15fde8){_0x3ad4b6(_0x15fde8);});});}function getStateInteraction(_0x5cad38){return new BPromise(function(_0x5e4548){_0x5cad38[_0x4c28('0x2b')]=0x0;_0x5cad38[_0x4c28('0x2c')]=0x0;_0x5cad38['answered']=0x0;_0x5cad38['unmanaged']=0x0;_0x5cad38[_0x4c28('0x2d')]=0x0;if(!_0x5cad38[_0x4c28('0x2e')]&&!_0x5cad38[_0x4c28('0x2f')]){_0x5cad38[_0x4c28('0x2b')]+=0x1;}if(!_0x5cad38[_0x4c28('0x2e')]&&_0x5cad38['UserId']){_0x5cad38[_0x4c28('0x2c')]+=0x1;if(_0x5cad38[_0x4c28('0x2b')]){_0x5cad38['waiting']-=0x1;}}if(_0x5cad38[_0x4c28('0x2e')]&&_0x5cad38[_0x4c28('0x2f')]){_0x5cad38['answered']+=0x1;if(_0x5cad38[_0x4c28('0x2c')]){_0x5cad38['talking']-=0x1;}}if(_0x5cad38['closed']&&!_0x5cad38['UserId']){_0x5cad38[_0x4c28('0x30')]+=0x1;if(_0x5cad38['waiting']){_0x5cad38['waiting']-=0x1;}}_0x5cad38['total']+=0x1;_0x5e4548(_0x5cad38);});}exports[_0x4c28('0x31')]=function(_0x28de50,_0x510bc1){var _0x307ac0={},_0x275c60={},_0x13c4aa={'count':0x0,'rows':[]};var _0x50d7ce=_[_0x4c28('0x20')](db[_0x4c28('0x32')][_0x4c28('0x33')],function(_0x2dd5f5){return{'name':_0x2dd5f5['fieldName'],'type':_0x2dd5f5[_0x4c28('0x34')][_0x4c28('0x35')]};});_0x275c60[_0x4c28('0x36')]=_[_0x4c28('0x20')](_0x50d7ce,_0x4c28('0x1d'));_0x275c60[_0x4c28('0x37')]=_[_0x4c28('0x38')](_0x28de50[_0x4c28('0x37')]);_0x275c60[_0x4c28('0x39')]=_[_0x4c28('0x3a')](_0x275c60[_0x4c28('0x36')],_0x275c60[_0x4c28('0x37')]);_0x307ac0[_0x4c28('0x3b')]=_[_0x4c28('0x3a')](_0x275c60[_0x4c28('0x36')],qs[_0x4c28('0x3c')](_0x28de50[_0x4c28('0x37')]['fields']));_0x307ac0[_0x4c28('0x3b')]=_0x307ac0[_0x4c28('0x3b')]['length']?_0x307ac0[_0x4c28('0x3b')]:_0x275c60[_0x4c28('0x36')];if(!_0x28de50[_0x4c28('0x37')][_0x4c28('0x3d')](_0x4c28('0x3e'))){_0x307ac0[_0x4c28('0x16')]=qs[_0x4c28('0x16')](_0x28de50['query']['limit']);_0x307ac0[_0x4c28('0x14')]=qs[_0x4c28('0x14')](_0x28de50['query'][_0x4c28('0x14')]);}_0x307ac0[_0x4c28('0x3f')]=qs[_0x4c28('0x40')](_0x28de50[_0x4c28('0x37')][_0x4c28('0x40')]);_0x307ac0[_0x4c28('0x41')]=qs[_0x4c28('0x39')](_[_0x4c28('0x42')](_0x28de50[_0x4c28('0x37')],_0x275c60[_0x4c28('0x39')]),_0x50d7ce);var _0x2e02bf=[];var _0xe31f55=squel[_0x4c28('0x43')]()[_0x4c28('0x44')]('id')[_0x4c28('0x44')]('name')['field'](_0x4c28('0x45'))[_0x4c28('0x46')]('tools_tags');var _0x4a9485=squel['select']()[_0x4c28('0x44')](_0x4c28('0x47'))[_0x4c28('0x44')]('u.fullname')[_0x4c28('0x44')](_0x4c28('0x48'))[_0x4c28('0x46')](_0x4c28('0x49'),'ui')['left_join']('users','u',_0x4c28('0x4a'));var _0xe23eb0=squel['select']()[_0x4c28('0x46')](_0x4c28('0x4b'),'i')['left_join'](_0x4c28('0x4c'),'c',_0x4c28('0x4d'))[_0x4c28('0x4e')](_0x4c28('0x4f'),'o',_0x4c28('0x50'))[_0x4c28('0x4e')](_0x4c28('0x51'),'a','a.id\x20=\x20i.MailAccountId')[_0x4c28('0x4e')]('mail_messages','me',_0x4c28('0x52'))[_0x4c28('0x4e')](_0x4c28('0x53'),'it',_0x4c28('0x54'))['left_join'](_0x4c28('0x55'),'t',_0x4c28('0x56'));var _0x47f807=squel[_0x4c28('0x57')]();var _0x381d3b=[];var _0x5d7297=squel['expr']();var _0x1ce347;if(_0x28de50[_0x4c28('0x37')]['search']){_0x1ce347=as[_0x4c28('0x58')](_0x28de50[_0x4c28('0x37')][_0x4c28('0x59')]);var _0x1e4949=_0x1ce347[_0x4c28('0x5a')];for(var _0x28b555=0x0;_0x28b555<_0x1ce347['conditions'][_0x4c28('0x5b')];_0x28b555++){var _0x139da5=_0x1ce347['conditions'][_0x28b555];var _0x3fb1bb='i';var _0x1f5775=_['find'](_0x50d7ce,[_0x4c28('0x1d'),_0x139da5[_0x4c28('0x44')]]);if(!_0x1f5775){switch(_0x139da5[_0x4c28('0x44')]){case _0x4c28('0x5c'):if(_0x139da5[_0x4c28('0x5d')]==0x1){_0xe23eb0['having']('`'+_0x139da5[_0x4c28('0x44')]+'`\x20=\x200');}else{_0xe23eb0[_0x4c28('0x5e')]('`'+_0x139da5[_0x4c28('0x44')]+_0x4c28('0x5f'));}break;case'Contact':if(_0x139da5['operator']===_0x4c28('0x60')){if(_0x139da5[_0x4c28('0x5d')][_0x4c28('0x22')]('\x20')['length']>0x1){_0x47f807[_0x1e4949](_0x4c28('0x61'),qs['getFullTextValue'](_0x139da5[_0x4c28('0x5d')]),null);}else{var _0x4afa25='%'+_0x139da5['value']+'%';_0x47f807[_0x1e4949](_0x4c28('0x62'),_0x4afa25,_0x4afa25,_0x4afa25);}}else{_0x1f5775=_['find'](_0x50d7ce,[_0x4c28('0x1d'),_0x4c28('0x63')]);_0x139da5[_0x4c28('0x44')]=_0x4c28('0x63');_0x541a4f=as['buildExpression'](_0x3fb1bb,_0x1f5775['type'],_0x139da5);_0x47f807[_0x1e4949](_0x541a4f[_0x4c28('0x64')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x65')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x12')]);}break;case _0x4c28('0x66'):var _0x57e20f=_0x139da5[_0x4c28('0x5d')][_0x4c28('0x22')](',')['map'](function(_0x2df9cf){return Number(_0x2df9cf);});_0x57e20f[_0x4c28('0x23')](function(_0x2c049b){_0x5d7297['or'](_0x4c28('0x67'),'%,'+_0x2c049b+',%');});_0x381d3b=_['union'](_0x381d3b,_0x57e20f);break;case'User':if(_0x139da5[_0x4c28('0x68')]===_0x4c28('0x60')){_0x47f807[_0x1e4949](_0x4c28('0x69'),'%'+_0x139da5[_0x4c28('0x5d')]+'%',null);}else{_0x1f5775=_[_0x4c28('0x6a')](_0x50d7ce,[_0x4c28('0x1d'),'UserId']);_0x139da5[_0x4c28('0x44')]=_0x4c28('0x2f');_0x541a4f=as['buildExpression'](_0x3fb1bb,_0x1f5775[_0x4c28('0x34')],_0x139da5);_0x47f807[_0x1e4949](_0x541a4f['text'],_0x541a4f[_0x4c28('0x5d')]['start'],_0x541a4f['value'][_0x4c28('0x12')]);}break;case _0x4c28('0x6b'):_0x541a4f=as[_0x4c28('0x6c')]('me',null,_0x139da5);_0x47f807[_0x1e4949](_0x541a4f[_0x4c28('0x64')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x65')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x12')]);break;}}else{var _0x541a4f=as['buildExpression'](_0x3fb1bb,_0x1f5775[_0x4c28('0x34')],_0x139da5);_0x47f807[_0x1e4949](_0x541a4f[_0x4c28('0x64')],_0x541a4f[_0x4c28('0x5d')][_0x4c28('0x65')],_0x541a4f[_0x4c28('0x5d')]['end']);}}}else{var _0x2e093e=_(_0x28de50[_0x4c28('0x37')])[_0x4c28('0x38')]()[_0x4c28('0x20')](function(_0x50e01b){return _[_0x4c28('0x6d')](_0x50d7ce,[_0x4c28('0x1d'),_0x50e01b])?_0x50e01b:undefined;})[_0x4c28('0x6e')]()['value']();if(!_['isEmpty'](_0x2e093e)){_0x2e093e['forEach'](function(_0x38ce45){if(_0x38ce45===_0x4c28('0x6f')){_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x70'),[][_0x4c28('0x71')](_0x28de50[_0x4c28('0x37')][_0x38ce45]));}else if(_0x38ce45===_0x4c28('0x72')){var _0x4b1b8d=JSON[_0x4c28('0x73')](_0x28de50[_0x4c28('0x37')][_0x38ce45])['$gte'];var _0x4fcf35=JSON[_0x4c28('0x73')](_0x28de50['query'][_0x38ce45])[_0x4c28('0x74')];_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x75'),_0x4b1b8d,_0x4fcf35);}else{if(_0x28de50['query'][_0x38ce45]===_0x4c28('0x76')){_0xe23eb0[_0x4c28('0x41')]('i.'+_0x38ce45+_0x4c28('0x77'));}else{_0xe23eb0[_0x4c28('0x41')]('i.'+_0x38ce45+'\x20=\x20?',_0x28de50['query'][_0x38ce45]);}}});}if(_0x28de50[_0x4c28('0x37')][_0x4c28('0x78')]){if(_0x28de50[_0x4c28('0x37')][_0x4c28('0x78')]==0x1){_0xe23eb0[_0x4c28('0x5e')](_0x4c28('0x79'));}else{_0xe23eb0['having'](_0x4c28('0x7a'));}}if(_0x28de50['query'][_0x4c28('0x7b')]){_0x381d3b=_[_0x4c28('0x7c')](_0x28de50[_0x4c28('0x37')]['tag'])?_0x28de50[_0x4c28('0x37')][_0x4c28('0x7b')]:new Array(_0x28de50[_0x4c28('0x37')]['tag']);_0x381d3b[_0x4c28('0x23')](function(_0x5ee464){_0x5d7297['or'](_0x4c28('0x67'),'%,'+_0x5ee464+',%');});}if(_0x28de50[_0x4c28('0x37')][_0x4c28('0x7d')]){var _0x4d76e9=_0x28de50[_0x4c28('0x37')][_0x4c28('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x4c28('0x7e')](/'/g,'\x27\x27');if(qs[_0x4c28('0x7f')](_0x4d76e9)){_0x47f807['or'](_0x4c28('0x80'),_0x4d76e9+'%');}else if(qs[_0x4c28('0x81')](_0x4d76e9)){_0x47f807['or']('c.email\x20LIKE\x20?',_0x4d76e9+'%');}else{_0x47f807['or'](_0x4c28('0x82'),qs[_0x4c28('0x83')](_0x4d76e9))['or'](_0x4c28('0x84'),qs['getFullTextValue'](_0x4d76e9));}}}_0xe23eb0[_0x4c28('0x41')](_0x47f807);_0xe23eb0[_0x4c28('0x85')](_0x4c28('0x86'));var _0x310297={'type':db[_0x4c28('0x87')][_0x4c28('0x88')][_0x4c28('0x89')],'raw':!![]};var _0x253c1b=_0xe23eb0[_0x4c28('0x8a')]();_0x253c1b['field'](_0x4c28('0x86'));_0x253c1b[_0x4c28('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x307ac0[_0x4c28('0x3f')]){_0x307ac0['order'][_0x4c28('0x23')](function(_0x529c3f){var _0x862b1c=_0x529c3f[0x0]===_0x4c28('0x8b')?_0x529c3f[0x0]:'i.'+_0x529c3f[0x0];_0xe23eb0[_0x4c28('0x3f')](_0x862b1c,_0x529c3f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4c28('0x8c')](_0x381d3b)){_0xe23eb0[_0x4c28('0x5e')](_0x5d7297);_0x253c1b[_0x4c28('0x41')]('t.id\x20IN\x20?',_0x381d3b);}BPromise[_0x4c28('0x8d')]()[_0x4c28('0x1a')](function(){if(!_0x1ce347){if(_0x28de50[_0x4c28('0x37')]['MailAccountId'])return;_0x253c1b[_0x4c28('0x41')](_0x4c28('0x8e'));_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x8e'));return;}if(_0x28de50[_0x4c28('0x8f')][_0x4c28('0x90')]!==_0x4c28('0x91'))return;return _0x28de50['user'][_0x4c28('0x92')]({'attributes':['id'],'raw':!![]})[_0x4c28('0x1a')](function(_0x4d245b){if(_[_0x4c28('0x8c')](_0x4d245b)){_0x253c1b[_0x4c28('0x41')]('i.MailAccountId\x20IS\x20NULL');_0xe23eb0[_0x4c28('0x41')](_0x4c28('0x93'));}else{_0x253c1b['where'](_0x4c28('0x70'),_[_0x4c28('0x20')](_0x4d245b,'id'));_0xe23eb0['where'](_0x4c28('0x70'),_[_0x4c28('0x20')](_0x4d245b,'id'));}});})['then'](function(){if(_0x28de50[_0x4c28('0x8f')][_0x4c28('0x90')]==='agent'&&!_0x1ce347&&!_0x28de50['query'][_0x4c28('0x6f')])return[];return db[_0x4c28('0x94')][_0x4c28('0x37')](_0x253c1b[_0x4c28('0x95')](),_0x310297);})['then'](function(_0xd7ae8a){_0x13c4aa['count']=_0xd7ae8a[_0x4c28('0x5b')];if(_0x13c4aa[_0x4c28('0x96')]===0x0)return[];return db['sequelize'][_0x4c28('0x37')](_0xe31f55['toString'](),_0x310297)[_0x4c28('0x1a')](function(_0x5a5438){_0x2e02bf=_[_0x4c28('0x97')](_0x5a5438,'id');_0x310297=_[_0x4c28('0x98')](_0x310297,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28de50['query']['fields']){_0x307ac0[_0x4c28('0x3b')][_0x4c28('0x23')](function(_0x970a47){_0xe23eb0[_0x4c28('0x44')]('i.'+_0x970a47);});}else{_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x99'),_0x4c28('0x5c'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x9a'),_0x4c28('0x9b'));_0xe23eb0['field'](_0x4c28('0x9c'),_0x4c28('0x9d'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x9e'),_0x4c28('0x9f'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa0'),_0x4c28('0x8b'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0x86'));_0xe23eb0[_0x4c28('0x44')]('i.createdAt');_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa1'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa2'));_0xe23eb0['field'](_0x4c28('0xa3'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa4'));_0xe23eb0[_0x4c28('0x44')]('i.lastMsgAt');_0xe23eb0[_0x4c28('0x44')]('i.lastMsgDirection');_0xe23eb0['field'](_0x4c28('0xa5'));_0xe23eb0['field'](_0x4c28('0xa6'));_0xe23eb0['field'](_0x4c28('0xa7'));_0xe23eb0['field'](_0x4c28('0xa8'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xa9'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xaa'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xab'));_0xe23eb0['field'](_0x4c28('0xac'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xad'));_0xe23eb0[_0x4c28('0x44')]('c.firstName',_0x4c28('0xae'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xaf'),_0x4c28('0xb0'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb1'),_0x4c28('0xb2'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb3'),_0x4c28('0xb4'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb5'),_0x4c28('0xb6'));_0xe23eb0['field']('c.fax','Contact.fax');_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb7'),_0x4c28('0xb8'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xb9'),_0x4c28('0xba'));_0xe23eb0[_0x4c28('0x44')](_0x4c28('0xbb'),_0x4c28('0x21'));}if(_0x307ac0['limit'])_0xe23eb0[_0x4c28('0x16')](_0x307ac0[_0x4c28('0x16')]);if(_0x307ac0['offset'])_0xe23eb0['offset'](_0x307ac0['offset']);return db[_0x4c28('0x94')][_0x4c28('0x37')](_0xe23eb0[_0x4c28('0x95')](),_0x310297);})[_0x4c28('0x1a')](function(_0x54b6e0){if(_0x54b6e0['length']>0x0)_0x4a9485[_0x4c28('0x41')](_0x4c28('0xbc'),_[_0x4c28('0x20')](_0x54b6e0,'id'));return db[_0x4c28('0x94')][_0x4c28('0x37')](_0x4a9485[_0x4c28('0x95')](),_0x310297)['then'](function(_0x4163d1){var _0x3de3a7=_[_0x4c28('0xbd')](_0x4163d1,_0x4c28('0xbe'));var _0x3bf062=[];return db[_0x4c28('0xbf')][_0x4c28('0x26')]({'attributes':[_0x4c28('0xc0')],'raw':!![]})[_0x4c28('0x1a')](function(_0x162110){var _0x479566=_0x162110[_0x4c28('0xc0')];_0x54b6e0[_0x4c28('0x23')](function(_0xad23dc){_0x3bf062[_0x4c28('0x25')](updateMailInteraction(_0xad23dc,_0x2e02bf,_0x3de3a7,_0x479566));});return BPromise[_0x4c28('0xc1')](_0x3bf062);});});});})['then'](function(_0x1487e8){_0x13c4aa[_0x4c28('0xc2')]=_0x1487e8;return _0x13c4aa;})[_0x4c28('0x1a')](respondWithFilteredResult(_0x510bc1,_0x307ac0))[_0x4c28('0x2a')](handleError(_0x510bc1,null));};exports['show']=function(_0x3ced67,_0x550b83){var _0x1f78ce={'raw':![],'where':{'id':_0x3ced67['params']['id']}},_0x20895d={};_0x20895d['model']=_[_0x4c28('0x38')](db[_0x4c28('0x32')][_0x4c28('0x33')]);_0x20895d[_0x4c28('0x37')]=_['keys'](_0x3ced67[_0x4c28('0x37')]);_0x20895d[_0x4c28('0x39')]=_[_0x4c28('0x3a')](_0x20895d[_0x4c28('0x36')],_0x20895d['query']);_0x1f78ce[_0x4c28('0x3b')]=_[_0x4c28('0x3a')](_0x20895d[_0x4c28('0x36')],qs[_0x4c28('0x3c')](_0x3ced67[_0x4c28('0x37')][_0x4c28('0x3c')]));_0x1f78ce[_0x4c28('0x3b')]=_0x1f78ce[_0x4c28('0x3b')][_0x4c28('0x5b')]?_0x1f78ce[_0x4c28('0x3b')]:_0x20895d[_0x4c28('0x36')];if(_0x3ced67[_0x4c28('0x37')][_0x4c28('0xc3')]){_0x1f78ce[_0x4c28('0xc4')]=[{'all':!![]}];}_0x1f78ce=_[_0x4c28('0x98')]({},_0x1f78ce,_0x3ced67['options']);return db[_0x4c28('0x32')][_0x4c28('0x6a')](_0x1f78ce)['then'](handleEntityNotFound(_0x550b83,null))[_0x4c28('0x1a')](respondWithResult(_0x550b83,null))[_0x4c28('0x2a')](handleError(_0x550b83,null));};exports[_0x4c28('0xc5')]=function(_0xfc3131,_0x5e2c43){return db[_0x4c28('0x32')][_0x4c28('0xc5')](_0xfc3131[_0x4c28('0xc6')],{})[_0x4c28('0x1a')](respondWithResult(_0x5e2c43,0xc9))[_0x4c28('0x2a')](handleError(_0x5e2c43,null));};exports['update']=function(_0x33f79e,_0x30b1dd){if(_0x33f79e['body']['id']){delete _0x33f79e[_0x4c28('0xc6')]['id'];}return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x33f79e[_0x4c28('0xc7')]['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x30b1dd,null))[_0x4c28('0x1a')](saveUpdates(_0x33f79e['body'],null))[_0x4c28('0x1a')](respondWithResult(_0x30b1dd,null))[_0x4c28('0x2a')](handleError(_0x30b1dd,null));};exports[_0x4c28('0x1b')]=function(_0x363241,_0x333e94){return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x363241['params']['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x333e94,null))[_0x4c28('0x1a')](removeEntity(_0x333e94,null))['catch'](handleError(_0x333e94,null));};exports['describe']=function(_0xb32609,_0x347ec8){return db[_0x4c28('0x32')][_0x4c28('0xc8')]()[_0x4c28('0x1a')](respondWithResult(_0x347ec8,null))[_0x4c28('0x2a')](handleError(_0x347ec8,null));};exports['addMessage']=function(_0x1f74df,_0x50c427){return db['MailMessage'][_0x4c28('0x6a')]({'where':{'id':_0x1f74df[_0x4c28('0xc7')]['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x50c427,null))[_0x4c28('0x1a')](function(_0x36daaa){if(_0x36daaa){return _0x36daaa[_0x4c28('0xc9')](_0x1f74df[_0x4c28('0xc6')][_0x4c28('0xca')],_['omit'](_0x1f74df['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x50c427,null))['catch'](handleError(_0x50c427,null));};exports[_0x4c28('0xcb')]=function(_0x5e19e1,_0x4e18a8){var _0x1d75f3={'raw':![],'where':{}};var _0x4ba926={};var _0x4ad4df={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4c28('0x26')]({'where':{'id':_0x5e19e1['params']['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x4e18a8,null))['then'](function(_0x3afc73){if(_0x3afc73){_0x4ba926[_0x4c28('0x36')]=_[_0x4c28('0x38')](db[_0x4c28('0xcc')]['rawAttributes']);_0x4ba926[_0x4c28('0x37')]=_[_0x4c28('0x38')](_0x5e19e1['query']);_0x4ba926['filters']=_['intersection'](_0x4ba926[_0x4c28('0x36')],_0x4ba926[_0x4c28('0x37')]);_0x1d75f3['attributes']=_[_0x4c28('0x3a')](_0x4ba926['model'],qs[_0x4c28('0x3c')](_0x5e19e1[_0x4c28('0x37')]['fields']));_0x1d75f3[_0x4c28('0x3b')]=_0x1d75f3[_0x4c28('0x3b')][_0x4c28('0x5b')]?_0x1d75f3[_0x4c28('0x3b')]:_0x4ba926[_0x4c28('0x36')];if(!_0x5e19e1[_0x4c28('0x37')]['hasOwnProperty'](_0x4c28('0x3e'))){_0x1d75f3[_0x4c28('0x16')]=qs[_0x4c28('0x16')](_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x16')]);_0x1d75f3[_0x4c28('0x14')]=qs[_0x4c28('0x14')](_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x14')]);}_0x1d75f3['order']=qs[_0x4c28('0x40')](_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x40')]);_0x1d75f3[_0x4c28('0x41')]=qs['filters'](_[_0x4c28('0x42')](_0x5e19e1['query'],_0x4ba926[_0x4c28('0x39')]));_0x1d75f3[_0x4c28('0x41')][_0x4c28('0xbe')]=_0x3afc73['id'];if(_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x7d')]){_0x1d75f3['where']=_['merge'](_0x1d75f3[_0x4c28('0x41')],{'$or':_['map'](_0x1d75f3[_0x4c28('0x3b')],function(_0x3dd3b3){var _0x29435f={};_0x29435f[_0x3dd3b3]={'$like':'%'+_0x5e19e1[_0x4c28('0x37')][_0x4c28('0x7d')]+'%'};return _0x29435f;})});}if(_0x5e19e1[_0x4c28('0x37')][_0x4c28('0xcd')]){var _0x42eea7=_0x5e19e1[_0x4c28('0x37')][_0x4c28('0xcd')]['split'](',');var _0x58a2de={};_0x58a2de[_0x42eea7[0x0]]={'$gte':moment(_0x42eea7[0x1])[_0x4c28('0xce')](_0x4c28('0xcf'))};_0x1d75f3['where']=_[_0x4c28('0x98')](_0x1d75f3[_0x4c28('0x41')],_0x58a2de);}_0x1d75f3=_[_0x4c28('0x98')]({},_0x1d75f3,_0x5e19e1[_0x4c28('0xd0')]);return db[_0x4c28('0xcc')]['count']({'where':_0x1d75f3[_0x4c28('0x41')]})[_0x4c28('0x1a')](function(_0x250534){_0x4ad4df[_0x4c28('0x96')]=_0x250534;if(_0x5e19e1['query'][_0x4c28('0xc3')]){_0x1d75f3[_0x4c28('0xc4')]=[{'all':!![]}];}return db[_0x4c28('0xcc')][_0x4c28('0xd1')](_0x1d75f3);})[_0x4c28('0x1a')](function(_0x20376f){if(_0x5e19e1[_0x4c28('0x37')]['inlineCss']===_0x4c28('0xd2')){for(var _0x183d22=0x0;_0x183d22<_0x20376f[_0x4c28('0x5b')];_0x183d22++){_0x20376f[_0x183d22][_0x4c28('0xc6')]=juice(_0x20376f[_0x183d22][_0x4c28('0xc6')]);}}_0x4ad4df[_0x4c28('0xc2')]=_0x20376f;return _0x4ad4df;});}})[_0x4c28('0x1a')](respondWithFilteredResult(_0x4e18a8,_0x1d75f3))[_0x4c28('0x2a')](handleError(_0x4e18a8,null));};exports[_0x4c28('0xd3')]=function(_0x217d02,_0x486bd5){return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x217d02[_0x4c28('0xc7')]['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x486bd5,null))[_0x4c28('0x1a')](function(_0x1be43c){if(_0x1be43c){return _0x1be43c[_0x4c28('0xd4')](_0x217d02[_0x4c28('0xc6')][_0x4c28('0xca')],_[_0x4c28('0xd5')](_0x217d02[_0x4c28('0xc6')],[_0x4c28('0xca'),'id'])||{})['spread'](function(){return db['Tag'][_0x4c28('0xd1')]({'attributes':['id','name',_0x4c28('0x45')],'where':{'id':_0x217d02[_0x4c28('0xc6')]['ids']}});})[_0x4c28('0x1a')](function(_0x261451){socket[_0x4c28('0xd6')](_0x4c28('0xd7'),{'id':Number(_0x217d02['params']['id']),'tags':_0x261451||[]});return{'id':Number(_0x217d02[_0x4c28('0xc7')]['id']),'tags':_0x261451||[]};});}})['then'](respondWithResult(_0x486bd5,null))['catch'](handleError(_0x486bd5,null));};exports[_0x4c28('0xd8')]=function(_0x4beb0e,_0x36f2e0){return db['MailInteraction']['find']({'where':{'id':_0x4beb0e['params']['id']}})[_0x4c28('0x1a')](handleEntityNotFound(_0x36f2e0,null))[_0x4c28('0x1a')](function(_0x28ec21){if(_0x28ec21){return _0x28ec21[_0x4c28('0xd8')](_0x4beb0e[_0x4c28('0x37')][_0x4c28('0xca')]);}})['then'](respondWithStatusCode(_0x36f2e0,null))[_0x4c28('0x2a')](handleError(_0x36f2e0,null));};exports[_0x4c28('0xd9')]=function(_0x4373d8,_0x46543c){var _0x5bb014=moment()[_0x4c28('0xda')]()['toString']();var _0x385d23=path[_0x4c28('0xdb')](config['root'],_0x4c28('0xdc'),'files','tmp');var _0x144d90=path[_0x4c28('0xdb')](config[_0x4c28('0xdd')],_0x4c28('0xdc'),'files','attachments');var _0x57c125=path['join'](_0x385d23,_0x5bb014);var _0x1dbe52=util[_0x4c28('0xce')](_0x4c28('0xde'),_0x4373d8['params']['id'],_0x5bb014);var _0x1e2b1e=path['join'](_0x385d23,_0x1dbe52);var _0x280b97=[];if(_0x4373d8[_0x4c28('0x37')][_0x4c28('0xdf')]){_0x280b97[_0x4c28('0x25')]({'model':db[_0x4c28('0xe0')],'as':_0x4c28('0xe1'),'raw':!![]});}var _0x2d4436=[{'model':db[_0x4c28('0xcc')],'as':_0x4c28('0xe2'),'attributes':['id',_0x4c28('0xc6'),_0x4c28('0x46'),'to','cc',_0x4c28('0xe3'),_0x4c28('0xe4'),'createdAt'],'where':{'secret':![]},'order':qs[_0x4c28('0x40')]('id'),'include':_0x280b97}];return db[_0x4c28('0x32')][_0x4c28('0x6a')]({'where':{'id':_0x4373d8[_0x4c28('0xc7')]['id']},'include':_0x2d4436})[_0x4c28('0x1a')](handleEntityNotFound(_0x46543c,null))[_0x4c28('0x1a')](function(_0x4c048f){if(_0x4c048f&&_0x4c048f['Messages']){var _0x4d5592=_0x4c048f[_0x4c28('0xe5')]({'plain':!![]});fs['mkdirSync'](_0x57c125);return BPromise[_0x4c28('0xe6')](_0x4d5592[_0x4c28('0xe2')],function(_0x4cf392,_0x2a3bfc){var _0x4105a7={'from':_0x4cf392['from'],'to':_0x4cf392['to'],'subject':_0x4cf392[_0x4c28('0xe4')],'html':htmlEntities[_0x4c28('0xe7')](_0x4cf392[_0x4c28('0xc6')]),'headers':{'Date':moment(_0x4cf392['createdAt'])['format'](_0x4c28('0xe8'))},'attachments':[]};if(_0x4cf392['cc']){_0x4105a7[_0x4c28('0xe9')]['Cc']=_0x4cf392['cc'];}if(_0x4cf392[_0x4c28('0xe3')]){_0x4105a7[_0x4c28('0xe9')][_0x4c28('0xea')]=_0x4cf392[_0x4c28('0xe3')];}return new BPromise(function(_0x119068,_0xfca151){if(_0x4cf392[_0x4c28('0xe1')]){for(var _0x3afee7=0x0;_0x3afee7<_0x4cf392['Attachments'][_0x4c28('0x5b')];_0x3afee7++){var _0x3f9571=_0x4cf392[_0x4c28('0xe1')][_0x3afee7];var _0x388693=path[_0x4c28('0xdb')](_0x144d90,_0x3f9571['basename']);if(fs[_0x4c28('0xeb')](_0x388693)){_0x4105a7[_0x4c28('0xdf')][_0x4c28('0x25')]({'name':_0x3f9571[_0x4c28('0x1d')],'contentType':_0x3f9571[_0x4c28('0x34')],'data':fs[_0x4c28('0xec')](_0x388693)});}}}emlformat['build'](_0x4105a7,function(_0x46def7,_0x57c36b){if(_0x46def7)return _0xfca151(_0x46def7);fs['writeFileSync'](path[_0x4c28('0xdb')](_0x57c125,util[_0x4c28('0xce')](_0x4c28('0xed'),_0x2a3bfc)),_0x57c36b);return _0x119068(_0x57c36b);});});})['then'](function(){return new BPromise(function(_0x4f8519,_0x520026){zipdir(_0x57c125,{'saveTo':_0x1e2b1e},function(_0x4de081,_0xd44aea){if(_0x4de081)return _0x520026(_0x4de081);return _0x4f8519(_0xd44aea);});})[_0x4c28('0x1a')](function(){return new BPromise(function(_0x3c3b81,_0x264e39){rimraf(_0x57c125,function(_0x54639e){if(_0x54639e)_0x264e39(_0x54639e);return _0x3c3b81();});});})['then'](function(){return _0x46543c['download'](_0x1e2b1e,_0x1dbe52,function(_0x371eda){if(!_0x371eda)fs[_0x4c28('0xee')](_0x1e2b1e);});});});}else{return _0x46543c[_0x4c28('0xef')](0xc8);}})['catch'](handleError(_0x46543c,null));}; \ No newline at end of file +var _0xd6c2=['getFullTextValue','group','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','MailAccountId','sequelize','toString','keyBy','a.key','Account.mandatoryDisposition','a.email','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','params','intersection','includeAll','include','merge','options','create','update','body','describe','addMessage','ids','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','subject','Messages','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','MailMessage','plainBody','-id','then','lastMsgText','trimStart','catch','answered','waiting','talking','closed','UserId','index','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.fullname','left_join','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','tools_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','i.MailAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x10286d,_0x595de8){var _0x25f02b=function(_0xfa6dd){while(--_0xfa6dd){_0x10286d['push'](_0x10286d['shift']());}};_0x25f02b(++_0x595de8);}(_0xd6c2,0x14a));var _0x2d6c=function(_0x2fae01,_0x372fb4){_0x2fae01=_0x2fae01-0x0;var _0x2a154b=_0xd6c2[_0x2fae01];return _0x2a154b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d6c('0x0'));var zipdir=require(_0x2d6c('0x1'));var moment=require(_0x2d6c('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x2d6c('0x3'));var fs=require('fs');var _=require(_0x2d6c('0x4'));var squel=require(_0x2d6c('0x5'));var juice=require(_0x2d6c('0x6'));var Redis=require(_0x2d6c('0x7'));var qs=require(_0x2d6c('0x8'));var as=require(_0x2d6c('0x9'));var logger=require('../../config/logger')(_0x2d6c('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x2d6c('0xb'));config[_0x2d6c('0xc')]=_[_0x2d6c('0xd')](config[_0x2d6c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d6c('0xc')]));require(_0x2d6c('0xe'))[_0x2d6c('0xf')](socket);function respondWithStatusCode(_0x2face3,_0x67651f){_0x67651f=_0x67651f||0xcc;return function(_0x121cf1){if(_0x121cf1){return _0x2face3[_0x2d6c('0x10')](_0x67651f);}return _0x2face3[_0x2d6c('0x11')](_0x67651f)[_0x2d6c('0x12')]();};}function respondWithResult(_0x229ada,_0x1a87c3){_0x1a87c3=_0x1a87c3||0xc8;return function(_0x4ecb6d){if(_0x4ecb6d){return _0x229ada[_0x2d6c('0x11')](_0x1a87c3)['json'](_0x4ecb6d);}};}function respondWithFilteredResult(_0xf35b75,_0x44a301){return function(_0x54fb3b){if(_0x54fb3b){var _0x2888be=typeof _0x44a301[_0x2d6c('0x13')]===_0x2d6c('0x14')&&typeof _0x44a301[_0x2d6c('0x15')]===_0x2d6c('0x14');var _0x22aa2e=_0x54fb3b[_0x2d6c('0x16')];var _0x579164=_0x2888be?0x0:_0x44a301[_0x2d6c('0x13')];var _0xf284a7=_0x2888be?_0x54fb3b[_0x2d6c('0x16')]:_0x44a301[_0x2d6c('0x13')]+_0x44a301['limit'];var _0x4aec18;if(_0xf284a7>=_0x22aa2e){_0xf284a7=_0x22aa2e;_0x4aec18=0xc8;}else{_0x4aec18=0xce;}_0xf35b75[_0x2d6c('0x11')](_0x4aec18);return _0xf35b75[_0x2d6c('0x17')](_0x2d6c('0x18'),_0x579164+'-'+_0xf284a7+'/'+_0x22aa2e)[_0x2d6c('0x19')](_0x54fb3b);}return null;};}function saveUpdates(_0xc5567){return function(_0x3e4c4b){if(_0x3e4c4b){return _0x3e4c4b['update'](_0xc5567)['then'](function(_0xd6b8b4){return _0xd6b8b4;});}return null;};}function removeEntity(_0x4e55e4){return function(_0x103ed4){if(_0x103ed4){return _0x103ed4[_0x2d6c('0x1a')]()['then'](function(){_0x4e55e4['status'](0xcc)[_0x2d6c('0x12')]();});}};}function handleEntityNotFound(_0x4b709){return function(_0x33bbd1){if(!_0x33bbd1){_0x4b709[_0x2d6c('0x10')](0x194);}return _0x33bbd1;};}function handleError(_0x3a1ee5,_0x1f18e3){_0x1f18e3=_0x1f18e3||0x1f4;return function(_0x397e6a){logger[_0x2d6c('0x1b')](_0x397e6a[_0x2d6c('0x1c')]);if(_0x397e6a['name']){delete _0x397e6a[_0x2d6c('0x1d')];}_0x3a1ee5[_0x2d6c('0x11')](_0x1f18e3)[_0x2d6c('0x1e')](_0x397e6a);};}function getInteractionUsers(_0x49e810,_0x5073ab){return new BPromise(function(_0xb57937,_0x38e575){try{if(_0x5073ab[_0x49e810['id']]){_0x49e810[_0x2d6c('0x1f')]=_[_0x2d6c('0x20')](_0x5073ab[_0x49e810['id']],function(_0x3db8c3){return{'id':_0x3db8c3['id'],'fullname':_0x3db8c3[_0x2d6c('0x21')]};});}}catch(_0x54750f){_0x38e575(_0x54750f);}_0xb57937(_0x49e810);});}function getInteractionTags(_0x50aa37,_0x522593){return new BPromise(function(_0x4ca442,_0x32b1f1){try{if(_0x50aa37['TagIds']){_0x50aa37[_0x2d6c('0x22')]=[];_0x50aa37['TagIds'][_0x2d6c('0x23')](',')[_0x2d6c('0x24')](function(_0x329c2f){_0x50aa37['Tags'][_0x2d6c('0x25')](_0x522593[_0x329c2f]);});}delete _0x50aa37[_0x2d6c('0x26')];}catch(_0x3e3934){_0x32b1f1(_0x3e3934);}_0x4ca442(_0x50aa37);});}function getLastMessageText(_0x21b1fe){return new BPromise(function(_0x278712,_0x2fccad){return db[_0x2d6c('0x27')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x21b1fe['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2d6c('0x28')],'order':_0x2d6c('0x29'),'raw':!![]})[_0x2d6c('0x2a')](function(_0x1f4259){if(_0x1f4259&&_0x1f4259[_0x2d6c('0x28')]){_0x21b1fe[_0x2d6c('0x2b')]=_[_0x2d6c('0x2c')](_0x1f4259['plainBody']);}_0x278712(_0x21b1fe);})[_0x2d6c('0x2d')](function(_0x3f82ef){_0x2fccad(_0x3f82ef);});});}function updateMailInteraction(_0x50c196,_0x46f09d,_0x3df901,_0xa49d58){return new BPromise(function(_0xdf77d0,_0x485c83){return getInteractionUsers(_0x50c196,_0x3df901)[_0x2d6c('0x2a')](function(_0x3414c3){return getInteractionTags(_0x3414c3,_0x46f09d);})[_0x2d6c('0x2a')](function(_0x3415e9){return getStateInteraction(_0x3415e9);})[_0x2d6c('0x2a')](function(_0x296707){if(_0xa49d58){_0xdf77d0(getLastMessageText(_0x296707));}else{_0xdf77d0(_0x296707);}})[_0x2d6c('0x2d')](function(_0x3a8d36){_0x485c83(_0x3a8d36);});});}function getStateInteraction(_0x2e68b7){return new BPromise(function(_0x250528){_0x2e68b7['waiting']=0x0;_0x2e68b7['talking']=0x0;_0x2e68b7[_0x2d6c('0x2e')]=0x0;_0x2e68b7['unmanaged']=0x0;_0x2e68b7['total']=0x0;if(!_0x2e68b7['closed']&&!_0x2e68b7['UserId']){_0x2e68b7[_0x2d6c('0x2f')]+=0x1;}if(!_0x2e68b7['closed']&&_0x2e68b7['UserId']){_0x2e68b7[_0x2d6c('0x30')]+=0x1;if(_0x2e68b7[_0x2d6c('0x2f')]){_0x2e68b7['waiting']-=0x1;}}if(_0x2e68b7[_0x2d6c('0x31')]&&_0x2e68b7[_0x2d6c('0x32')]){_0x2e68b7[_0x2d6c('0x2e')]+=0x1;if(_0x2e68b7[_0x2d6c('0x30')]){_0x2e68b7['talking']-=0x1;}}if(_0x2e68b7[_0x2d6c('0x31')]&&!_0x2e68b7[_0x2d6c('0x32')]){_0x2e68b7['unmanaged']+=0x1;if(_0x2e68b7['waiting']){_0x2e68b7['waiting']-=0x1;}}_0x2e68b7['total']+=0x1;_0x250528(_0x2e68b7);});}exports[_0x2d6c('0x33')]=function(_0x2be8a2,_0x375557){var _0x5a0771={},_0x22e12a={},_0x4ab3e0={'count':0x0,'rows':[]};var _0x527cf7=_[_0x2d6c('0x20')](db[_0x2d6c('0x34')][_0x2d6c('0x35')],function(_0x214441){return{'name':_0x214441[_0x2d6c('0x36')],'type':_0x214441[_0x2d6c('0x37')][_0x2d6c('0x38')]};});_0x22e12a[_0x2d6c('0x39')]=_[_0x2d6c('0x20')](_0x527cf7,_0x2d6c('0x1d'));_0x22e12a[_0x2d6c('0x3a')]=_[_0x2d6c('0x3b')](_0x2be8a2[_0x2d6c('0x3a')]);_0x22e12a[_0x2d6c('0x3c')]=_['intersection'](_0x22e12a[_0x2d6c('0x39')],_0x22e12a['query']);_0x5a0771[_0x2d6c('0x3d')]=_['intersection'](_0x22e12a[_0x2d6c('0x39')],qs['fields'](_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x3e')]));_0x5a0771[_0x2d6c('0x3d')]=_0x5a0771['attributes'][_0x2d6c('0x3f')]?_0x5a0771[_0x2d6c('0x3d')]:_0x22e12a['model'];if(!_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x40')](_0x2d6c('0x41'))){_0x5a0771[_0x2d6c('0x15')]=qs[_0x2d6c('0x15')](_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x15')]);_0x5a0771[_0x2d6c('0x13')]=qs['offset'](_0x2be8a2[_0x2d6c('0x3a')]['offset']);}_0x5a0771[_0x2d6c('0x42')]=qs[_0x2d6c('0x43')](_0x2be8a2['query'][_0x2d6c('0x43')]);_0x5a0771[_0x2d6c('0x44')]=qs[_0x2d6c('0x3c')](_[_0x2d6c('0x45')](_0x2be8a2[_0x2d6c('0x3a')],_0x22e12a[_0x2d6c('0x3c')]),_0x527cf7);var _0x3d2759=[];var _0x4b930f=squel['select']()[_0x2d6c('0x46')]('id')[_0x2d6c('0x46')]('name')['field'](_0x2d6c('0x47'))[_0x2d6c('0x48')]('tools_tags');var _0x2b6a0b=squel[_0x2d6c('0x49')]()[_0x2d6c('0x46')](_0x2d6c('0x4a'))['field'](_0x2d6c('0x4b'))[_0x2d6c('0x46')]('ui.MailInteractionId')[_0x2d6c('0x48')]('user_has_mail_interactions','ui')[_0x2d6c('0x4c')]('users','u','u.id\x20=\x20ui.UserId');var _0x1e2eda=squel['select']()[_0x2d6c('0x48')](_0x2d6c('0x4d'),'i')[_0x2d6c('0x4c')](_0x2d6c('0x4e'),'c',_0x2d6c('0x4f'))[_0x2d6c('0x4c')](_0x2d6c('0x50'),'o',_0x2d6c('0x51'))[_0x2d6c('0x4c')](_0x2d6c('0x52'),'a',_0x2d6c('0x53'))[_0x2d6c('0x4c')](_0x2d6c('0x54'),'me','me.MailInteractionId\x20=\x20i.id')[_0x2d6c('0x4c')](_0x2d6c('0x55'),'it','it.MailInteractionId\x20=\x20i.id')[_0x2d6c('0x4c')](_0x2d6c('0x56'),'t','t.id\x20=\x20it.TagId');var _0x1dbd19=squel[_0x2d6c('0x57')]();var _0x3a1f91=[];var _0x187f7d=squel['expr']();var _0x3d4a93;if(_0x2be8a2[_0x2d6c('0x3a')]['search']){_0x3d4a93=as[_0x2d6c('0x58')](_0x2be8a2['query'][_0x2d6c('0x59')]);var _0x5f4034=_0x3d4a93[_0x2d6c('0x5a')];for(var _0xe267b0=0x0;_0xe267b0<_0x3d4a93[_0x2d6c('0x5b')][_0x2d6c('0x3f')];_0xe267b0++){var _0x210ac6=_0x3d4a93[_0x2d6c('0x5b')][_0xe267b0];var _0x51abbe='i';var _0x443336=_[_0x2d6c('0x5c')](_0x527cf7,[_0x2d6c('0x1d'),_0x210ac6['field']]);if(!_0x443336){switch(_0x210ac6[_0x2d6c('0x46')]){case _0x2d6c('0x5d'):if(_0x210ac6[_0x2d6c('0x5e')]==0x1){_0x1e2eda[_0x2d6c('0x5f')]('`'+_0x210ac6['field']+_0x2d6c('0x60'));}else{_0x1e2eda[_0x2d6c('0x5f')]('`'+_0x210ac6[_0x2d6c('0x46')]+_0x2d6c('0x61'));}break;case _0x2d6c('0x62'):if(_0x210ac6[_0x2d6c('0x63')]==='$substring'){if(_0x210ac6[_0x2d6c('0x5e')][_0x2d6c('0x23')]('\x20')[_0x2d6c('0x3f')]>0x1){_0x1dbd19[_0x5f4034](_0x2d6c('0x64'),qs['getFullTextValue'](_0x210ac6[_0x2d6c('0x5e')]),null);}else{var _0x3d0b62='%'+_0x210ac6[_0x2d6c('0x5e')]+'%';_0x1dbd19[_0x5f4034]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3d0b62,_0x3d0b62,_0x3d0b62);}}else{_0x443336=_[_0x2d6c('0x5c')](_0x527cf7,[_0x2d6c('0x1d'),_0x2d6c('0x65')]);_0x210ac6['field']=_0x2d6c('0x65');_0x232f7c=as[_0x2d6c('0x66')](_0x51abbe,_0x443336[_0x2d6c('0x37')],_0x210ac6);_0x1dbd19[_0x5f4034](_0x232f7c[_0x2d6c('0x67')],_0x232f7c['value'][_0x2d6c('0x68')],_0x232f7c[_0x2d6c('0x5e')][_0x2d6c('0x12')]);}break;case _0x2d6c('0x69'):var _0x55a44d=_0x210ac6['value']['split'](',')[_0x2d6c('0x20')](function(_0x99433f){return Number(_0x99433f);});_0x55a44d[_0x2d6c('0x24')](function(_0x55f394){_0x187f7d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x55f394+',%');});_0x3a1f91=_[_0x2d6c('0x6a')](_0x3a1f91,_0x55a44d);break;case'User':if(_0x210ac6[_0x2d6c('0x63')]===_0x2d6c('0x6b')){_0x1dbd19[_0x5f4034](_0x2d6c('0x6c'),'%'+_0x210ac6[_0x2d6c('0x5e')]+'%',null);}else{_0x443336=_[_0x2d6c('0x5c')](_0x527cf7,['name',_0x2d6c('0x32')]);_0x210ac6[_0x2d6c('0x46')]=_0x2d6c('0x32');_0x232f7c=as[_0x2d6c('0x66')](_0x51abbe,_0x443336['type'],_0x210ac6);_0x1dbd19[_0x5f4034](_0x232f7c[_0x2d6c('0x67')],_0x232f7c[_0x2d6c('0x5e')][_0x2d6c('0x68')],_0x232f7c['value']['end']);}break;case _0x2d6c('0x28'):_0x232f7c=as[_0x2d6c('0x66')]('me',null,_0x210ac6);_0x1dbd19[_0x5f4034](_0x232f7c[_0x2d6c('0x67')],_0x232f7c[_0x2d6c('0x5e')][_0x2d6c('0x68')],_0x232f7c[_0x2d6c('0x5e')][_0x2d6c('0x12')]);break;}}else{var _0x232f7c=as['buildExpression'](_0x51abbe,_0x443336['type'],_0x210ac6);_0x1dbd19[_0x5f4034](_0x232f7c[_0x2d6c('0x67')],_0x232f7c[_0x2d6c('0x5e')][_0x2d6c('0x68')],_0x232f7c['value'][_0x2d6c('0x12')]);}}}else{var _0xab004e=_(_0x2be8a2['query'])[_0x2d6c('0x3b')]()[_0x2d6c('0x20')](function(_0x11d350){return _[_0x2d6c('0x6d')](_0x527cf7,['name',_0x11d350])?_0x11d350:undefined;})[_0x2d6c('0x6e')]()[_0x2d6c('0x5e')]();if(!_['isEmpty'](_0xab004e)){_0xab004e[_0x2d6c('0x24')](function(_0x23bfa4){if(_0x23bfa4==='MailAccountId'){_0x1e2eda['where'](_0x2d6c('0x6f'),[][_0x2d6c('0x70')](_0x2be8a2[_0x2d6c('0x3a')][_0x23bfa4]));}else if(_0x23bfa4===_0x2d6c('0x71')){var _0x3557d8=JSON['parse'](_0x2be8a2[_0x2d6c('0x3a')][_0x23bfa4])['$gte'];var _0x5e5caa=JSON['parse'](_0x2be8a2[_0x2d6c('0x3a')][_0x23bfa4])[_0x2d6c('0x72')];_0x1e2eda[_0x2d6c('0x44')](_0x2d6c('0x73'),_0x3557d8,_0x5e5caa);}else{if(_0x2be8a2['query'][_0x23bfa4]===_0x2d6c('0x74')){_0x1e2eda[_0x2d6c('0x44')]('i.'+_0x23bfa4+_0x2d6c('0x75'));}else{_0x1e2eda[_0x2d6c('0x44')]('i.'+_0x23bfa4+'\x20=\x20?',_0x2be8a2['query'][_0x23bfa4]);}}});}if(_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x76')]){if(_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x76')]==0x1){_0x1e2eda['having'](_0x2d6c('0x77'));}else{_0x1e2eda[_0x2d6c('0x5f')](_0x2d6c('0x78'));}}if(_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x79')]){_0x3a1f91=_[_0x2d6c('0x7a')](_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x79')])?_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x79')]:new Array(_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x79')]);_0x3a1f91['forEach'](function(_0x510d0d){_0x187f7d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x510d0d+',%');});}if(_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x7b')]){var _0x3504f6=_0x2be8a2[_0x2d6c('0x3a')]['filter'][_0x2d6c('0x7c')]('\x5c','\x5c\x5c')[_0x2d6c('0x7c')](/'/g,'\x27\x27');if(qs[_0x2d6c('0x7d')](_0x3504f6)){_0x1dbd19['or'](_0x2d6c('0x7e'),_0x3504f6+'%');}else if(qs['isEmail'](_0x3504f6)){_0x1dbd19['or'](_0x2d6c('0x7f'),_0x3504f6+'%');}else{_0x1dbd19['or'](_0x2d6c('0x80'),qs['getFullTextValue'](_0x3504f6))['or'](_0x2d6c('0x81'),qs[_0x2d6c('0x82')](_0x3504f6));}}}_0x1e2eda[_0x2d6c('0x44')](_0x1dbd19);_0x1e2eda[_0x2d6c('0x83')](_0x2d6c('0x84'));var _0xfb7cb2={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0xca8394=_0x1e2eda[_0x2d6c('0x85')]();_0xca8394[_0x2d6c('0x46')](_0x2d6c('0x84'));_0xca8394['field'](_0x2d6c('0x86'),_0x2d6c('0x5d'));if(_0x5a0771[_0x2d6c('0x42')]){_0x5a0771[_0x2d6c('0x42')]['forEach'](function(_0x575ea5){var _0x2b637e=_0x575ea5[0x0]==='contactName'?_0x575ea5[0x0]:'i.'+_0x575ea5[0x0];_0x1e2eda[_0x2d6c('0x42')](_0x2b637e,_0x575ea5[0x1]===_0x2d6c('0x87')?![]:!![]);});}if(!_[_0x2d6c('0x88')](_0x3a1f91)){_0x1e2eda[_0x2d6c('0x5f')](_0x187f7d);_0xca8394[_0x2d6c('0x44')](_0x2d6c('0x89'),_0x3a1f91);}BPromise[_0x2d6c('0x8a')]()[_0x2d6c('0x2a')](function(){if(!_0x3d4a93){if(_0x2be8a2[_0x2d6c('0x3a')]['MailAccountId'])return;_0xca8394[_0x2d6c('0x44')](_0x2d6c('0x8b'));_0x1e2eda[_0x2d6c('0x44')](_0x2d6c('0x8b'));return;}if(_0x2be8a2[_0x2d6c('0x8c')][_0x2d6c('0x8d')]!=='agent')return;return _0x2be8a2[_0x2d6c('0x8c')][_0x2d6c('0x8e')]({'attributes':['id'],'raw':!![]})[_0x2d6c('0x2a')](function(_0x1281ea){if(_[_0x2d6c('0x88')](_0x1281ea)){_0xca8394[_0x2d6c('0x44')]('i.MailAccountId\x20IS\x20NULL');_0x1e2eda['where'](_0x2d6c('0x8f'));}else{_0xca8394[_0x2d6c('0x44')]('i.MailAccountId\x20IN\x20?',_['map'](_0x1281ea,'id'));_0x1e2eda[_0x2d6c('0x44')](_0x2d6c('0x6f'),_[_0x2d6c('0x20')](_0x1281ea,'id'));}});})[_0x2d6c('0x2a')](function(){if(_0x2be8a2[_0x2d6c('0x8c')][_0x2d6c('0x8d')]===_0x2d6c('0x90')&&!_0x3d4a93&&!_0x2be8a2['query'][_0x2d6c('0x91')])return[];return db[_0x2d6c('0x92')][_0x2d6c('0x3a')](_0xca8394[_0x2d6c('0x93')](),_0xfb7cb2);})[_0x2d6c('0x2a')](function(_0x580f81){_0x4ab3e0[_0x2d6c('0x16')]=_0x580f81['length'];if(_0x4ab3e0[_0x2d6c('0x16')]===0x0)return[];return db[_0x2d6c('0x92')][_0x2d6c('0x3a')](_0x4b930f['toString'](),_0xfb7cb2)['then'](function(_0x122464){_0x3d2759=_[_0x2d6c('0x94')](_0x122464,'id');_0xfb7cb2=_['merge'](_0xfb7cb2,{'model':db[_0x2d6c('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2be8a2[_0x2d6c('0x3a')][_0x2d6c('0x3e')]){_0x5a0771[_0x2d6c('0x3d')]['forEach'](function(_0x3a12be){_0x1e2eda[_0x2d6c('0x46')]('i.'+_0x3a12be);});}else{_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x86'),_0x2d6c('0x5d'));_0x1e2eda['field'](_0x2d6c('0x95'),'Account.key');_0x1e2eda[_0x2d6c('0x46')]('a.mandatoryDisposition',_0x2d6c('0x96'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x97'),'Account.email');_0x1e2eda['field']('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',_0x2d6c('0x98'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x84'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x99'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x9a'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x9b'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x9c'));_0x1e2eda['field'](_0x2d6c('0x9d'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x9e'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0x9f'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xa0'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xa1'));_0x1e2eda[_0x2d6c('0x46')]('i.secondDisposition');_0x1e2eda['field']('i.thirdDisposition');_0x1e2eda['field']('i.substatus');_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xa2'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xa3'));_0x1e2eda['field'](_0x2d6c('0xa4'));_0x1e2eda['field'](_0x2d6c('0xa5'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xa6'),_0x2d6c('0xa7'));_0x1e2eda['field']('c.lastName',_0x2d6c('0xa8'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xa9'),_0x2d6c('0xaa'));_0x1e2eda['field'](_0x2d6c('0xab'),'Contact.phone');_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xac'),'Contact.mobile');_0x1e2eda[_0x2d6c('0x46')]('c.fax',_0x2d6c('0xad'));_0x1e2eda[_0x2d6c('0x46')](_0x2d6c('0xae'),_0x2d6c('0xaf'));_0x1e2eda[_0x2d6c('0x46')]('o.internal',_0x2d6c('0xb0'));_0x1e2eda['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2d6c('0x26'));}if(_0x5a0771[_0x2d6c('0x15')])_0x1e2eda['limit'](_0x5a0771['limit']);if(_0x5a0771[_0x2d6c('0x13')])_0x1e2eda[_0x2d6c('0x13')](_0x5a0771[_0x2d6c('0x13')]);return db[_0x2d6c('0x92')][_0x2d6c('0x3a')](_0x1e2eda['toString'](),_0xfb7cb2);})['then'](function(_0x435116){if(_0x435116[_0x2d6c('0x3f')]>0x0)_0x2b6a0b[_0x2d6c('0x44')](_0x2d6c('0xb1'),_['map'](_0x435116,'id'));return db[_0x2d6c('0x92')][_0x2d6c('0x3a')](_0x2b6a0b[_0x2d6c('0x93')](),_0xfb7cb2)[_0x2d6c('0x2a')](function(_0x10be59){var _0x3e34b1=_['groupBy'](_0x10be59,_0x2d6c('0xb2'));var _0x1b8d8e=[];return db[_0x2d6c('0xb3')][_0x2d6c('0xb4')]({'attributes':[_0x2d6c('0xb5')],'raw':!![]})['then'](function(_0x55c20e){var _0x298dd7=_0x55c20e[_0x2d6c('0xb5')];_0x435116[_0x2d6c('0x24')](function(_0x3526fc){_0x1b8d8e[_0x2d6c('0x25')](updateMailInteraction(_0x3526fc,_0x3d2759,_0x3e34b1,_0x298dd7));});return BPromise[_0x2d6c('0xb6')](_0x1b8d8e);});});});})[_0x2d6c('0x2a')](function(_0x44e369){_0x4ab3e0[_0x2d6c('0xb7')]=_0x44e369;return _0x4ab3e0;})[_0x2d6c('0x2a')](respondWithFilteredResult(_0x375557,_0x5a0771))['catch'](handleError(_0x375557,null));};exports[_0x2d6c('0xb8')]=function(_0xe7a314,_0x343313){var _0xb48645={'raw':![],'where':{'id':_0xe7a314[_0x2d6c('0xb9')]['id']}},_0x3169fa={};_0x3169fa[_0x2d6c('0x39')]=_[_0x2d6c('0x3b')](db[_0x2d6c('0x34')][_0x2d6c('0x35')]);_0x3169fa[_0x2d6c('0x3a')]=_['keys'](_0xe7a314[_0x2d6c('0x3a')]);_0x3169fa['filters']=_['intersection'](_0x3169fa[_0x2d6c('0x39')],_0x3169fa[_0x2d6c('0x3a')]);_0xb48645[_0x2d6c('0x3d')]=_[_0x2d6c('0xba')](_0x3169fa[_0x2d6c('0x39')],qs[_0x2d6c('0x3e')](_0xe7a314[_0x2d6c('0x3a')][_0x2d6c('0x3e')]));_0xb48645['attributes']=_0xb48645['attributes']['length']?_0xb48645[_0x2d6c('0x3d')]:_0x3169fa['model'];if(_0xe7a314[_0x2d6c('0x3a')][_0x2d6c('0xbb')]){_0xb48645[_0x2d6c('0xbc')]=[{'all':!![]}];}_0xb48645=_[_0x2d6c('0xbd')]({},_0xb48645,_0xe7a314[_0x2d6c('0xbe')]);return db['MailInteraction'][_0x2d6c('0x5c')](_0xb48645)['then'](handleEntityNotFound(_0x343313,null))[_0x2d6c('0x2a')](respondWithResult(_0x343313,null))[_0x2d6c('0x2d')](handleError(_0x343313,null));};exports[_0x2d6c('0xbf')]=function(_0x3f01d1,_0x494d97){return db['MailInteraction']['create'](_0x3f01d1['body'],{})[_0x2d6c('0x2a')](respondWithResult(_0x494d97,0xc9))[_0x2d6c('0x2d')](handleError(_0x494d97,null));};exports[_0x2d6c('0xc0')]=function(_0x32619b,_0x34c4f5){if(_0x32619b[_0x2d6c('0xc1')]['id']){delete _0x32619b[_0x2d6c('0xc1')]['id'];}return db[_0x2d6c('0x34')][_0x2d6c('0x5c')]({'where':{'id':_0x32619b['params']['id']}})['then'](handleEntityNotFound(_0x34c4f5,null))[_0x2d6c('0x2a')](saveUpdates(_0x32619b[_0x2d6c('0xc1')],null))[_0x2d6c('0x2a')](respondWithResult(_0x34c4f5,null))[_0x2d6c('0x2d')](handleError(_0x34c4f5,null));};exports[_0x2d6c('0x1a')]=function(_0x5a2f0c,_0x4848ca){return db[_0x2d6c('0x34')][_0x2d6c('0x5c')]({'where':{'id':_0x5a2f0c[_0x2d6c('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4848ca,null))[_0x2d6c('0x2a')](removeEntity(_0x4848ca,null))['catch'](handleError(_0x4848ca,null));};exports[_0x2d6c('0xc2')]=function(_0x4c20db,_0x283df0){return db[_0x2d6c('0x34')][_0x2d6c('0xc2')]()['then'](respondWithResult(_0x283df0,null))[_0x2d6c('0x2d')](handleError(_0x283df0,null));};exports[_0x2d6c('0xc3')]=function(_0x4b70a1,_0x40a62b){return db[_0x2d6c('0x27')][_0x2d6c('0x5c')]({'where':{'id':_0x4b70a1['params']['id']}})[_0x2d6c('0x2a')](handleEntityNotFound(_0x40a62b,null))[_0x2d6c('0x2a')](function(_0x47ccff){if(_0x47ccff){return _0x47ccff[_0x2d6c('0xc3')](_0x4b70a1[_0x2d6c('0xc1')][_0x2d6c('0xc4')],_['omit'](_0x4b70a1[_0x2d6c('0xc1')],[_0x2d6c('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x40a62b,null))['catch'](handleError(_0x40a62b,null));};exports['getMessages']=function(_0x1a0a25,_0x5ebc2e){var _0x12c9e5={'raw':![],'where':{}};var _0x40eed5={};var _0x150340={'count':0x0,'rows':[]};return db[_0x2d6c('0x34')]['findOne']({'where':{'id':_0x1a0a25['params']['id']}})['then'](handleEntityNotFound(_0x5ebc2e,null))[_0x2d6c('0x2a')](function(_0x5db0c8){if(_0x5db0c8){_0x40eed5[_0x2d6c('0x39')]=_['keys'](db[_0x2d6c('0x27')][_0x2d6c('0x35')]);_0x40eed5[_0x2d6c('0x3a')]=_[_0x2d6c('0x3b')](_0x1a0a25[_0x2d6c('0x3a')]);_0x40eed5[_0x2d6c('0x3c')]=_['intersection'](_0x40eed5[_0x2d6c('0x39')],_0x40eed5['query']);_0x12c9e5[_0x2d6c('0x3d')]=_[_0x2d6c('0xba')](_0x40eed5[_0x2d6c('0x39')],qs[_0x2d6c('0x3e')](_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0x3e')]));_0x12c9e5[_0x2d6c('0x3d')]=_0x12c9e5[_0x2d6c('0x3d')][_0x2d6c('0x3f')]?_0x12c9e5[_0x2d6c('0x3d')]:_0x40eed5[_0x2d6c('0x39')];if(!_0x1a0a25['query'][_0x2d6c('0x40')](_0x2d6c('0x41'))){_0x12c9e5[_0x2d6c('0x15')]=qs['limit'](_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0x15')]);_0x12c9e5[_0x2d6c('0x13')]=qs[_0x2d6c('0x13')](_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0x13')]);}_0x12c9e5[_0x2d6c('0x42')]=qs[_0x2d6c('0x43')](_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0x43')]);_0x12c9e5[_0x2d6c('0x44')]=qs[_0x2d6c('0x3c')](_['pick'](_0x1a0a25[_0x2d6c('0x3a')],_0x40eed5[_0x2d6c('0x3c')]));_0x12c9e5['where'][_0x2d6c('0xb2')]=_0x5db0c8['id'];if(_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0x7b')]){_0x12c9e5[_0x2d6c('0x44')]=_['merge'](_0x12c9e5[_0x2d6c('0x44')],{'$or':_[_0x2d6c('0x20')](_0x12c9e5[_0x2d6c('0x3d')],function(_0x5ae511){var _0x403aba={};_0x403aba[_0x5ae511]={'$like':'%'+_0x1a0a25['query']['filter']+'%'};return _0x403aba;})});}if(_0x1a0a25[_0x2d6c('0x3a')]['$gte']){var _0x41deac=_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0xc5')][_0x2d6c('0x23')](',');var _0x394943={};_0x394943[_0x41deac[0x0]]={'$gte':moment(_0x41deac[0x1])[_0x2d6c('0xc6')](_0x2d6c('0xc7'))};_0x12c9e5[_0x2d6c('0x44')]=_[_0x2d6c('0xbd')](_0x12c9e5[_0x2d6c('0x44')],_0x394943);}_0x12c9e5=_[_0x2d6c('0xbd')]({},_0x12c9e5,_0x1a0a25['options']);return db['MailMessage'][_0x2d6c('0x16')]({'where':_0x12c9e5[_0x2d6c('0x44')]})['then'](function(_0x435916){_0x150340[_0x2d6c('0x16')]=_0x435916;if(_0x1a0a25[_0x2d6c('0x3a')][_0x2d6c('0xbb')]){_0x12c9e5['include']=[{'all':!![]}];}return db[_0x2d6c('0x27')][_0x2d6c('0xc8')](_0x12c9e5);})[_0x2d6c('0x2a')](function(_0xab300e){if(_0x1a0a25[_0x2d6c('0x3a')]['inlineCss']==='true'){for(var _0x1f3bc0=0x0;_0x1f3bc0<_0xab300e['length'];_0x1f3bc0++){_0xab300e[_0x1f3bc0][_0x2d6c('0xc1')]=juice(_0xab300e[_0x1f3bc0][_0x2d6c('0xc1')]);}}_0x150340[_0x2d6c('0xb7')]=_0xab300e;return _0x150340;});}})[_0x2d6c('0x2a')](respondWithFilteredResult(_0x5ebc2e,_0x12c9e5))[_0x2d6c('0x2d')](handleError(_0x5ebc2e,null));};exports[_0x2d6c('0xc9')]=function(_0x4b2639,_0x362fbd){return db[_0x2d6c('0x34')][_0x2d6c('0x5c')]({'where':{'id':_0x4b2639[_0x2d6c('0xb9')]['id']}})[_0x2d6c('0x2a')](handleEntityNotFound(_0x362fbd,null))[_0x2d6c('0x2a')](function(_0x43a402){if(_0x43a402){return _0x43a402[_0x2d6c('0xca')](_0x4b2639[_0x2d6c('0xc1')][_0x2d6c('0xc4')],_[_0x2d6c('0xcb')](_0x4b2639[_0x2d6c('0xc1')],[_0x2d6c('0xc4'),'id'])||{})['spread'](function(){return db[_0x2d6c('0x69')][_0x2d6c('0xc8')]({'attributes':['id',_0x2d6c('0x1d'),'color'],'where':{'id':_0x4b2639[_0x2d6c('0xc1')][_0x2d6c('0xc4')]}});})[_0x2d6c('0x2a')](function(_0x57c02d){socket['emit'](_0x2d6c('0xcc'),{'id':Number(_0x4b2639[_0x2d6c('0xb9')]['id']),'tags':_0x57c02d||[]});return{'id':Number(_0x4b2639[_0x2d6c('0xb9')]['id']),'tags':_0x57c02d||[]};});}})[_0x2d6c('0x2a')](respondWithResult(_0x362fbd,null))[_0x2d6c('0x2d')](handleError(_0x362fbd,null));};exports[_0x2d6c('0xcd')]=function(_0x12cd68,_0x590c18){return db[_0x2d6c('0x34')][_0x2d6c('0x5c')]({'where':{'id':_0x12cd68[_0x2d6c('0xb9')]['id']}})[_0x2d6c('0x2a')](handleEntityNotFound(_0x590c18,null))[_0x2d6c('0x2a')](function(_0x4c6678){if(_0x4c6678){return _0x4c6678[_0x2d6c('0xcd')](_0x12cd68[_0x2d6c('0x3a')][_0x2d6c('0xc4')]);}})['then'](respondWithStatusCode(_0x590c18,null))[_0x2d6c('0x2d')](handleError(_0x590c18,null));};exports[_0x2d6c('0xce')]=function(_0x446ef8,_0xa0eb3d){var _0x206a18=moment()[_0x2d6c('0xcf')]()[_0x2d6c('0x93')]();var _0x58286d=path[_0x2d6c('0xd0')](config[_0x2d6c('0xd1')],_0x2d6c('0xd2'),'files',_0x2d6c('0xd3'));var _0x3fdead=path[_0x2d6c('0xd0')](config['root'],_0x2d6c('0xd2'),_0x2d6c('0xd4'),_0x2d6c('0xd5'));var _0x2c656d=path[_0x2d6c('0xd0')](_0x58286d,_0x206a18);var _0xdb730d=util[_0x2d6c('0xc6')](_0x2d6c('0xd6'),_0x446ef8[_0x2d6c('0xb9')]['id'],_0x206a18);var _0x59496e=path[_0x2d6c('0xd0')](_0x58286d,_0xdb730d);var _0x3ceb29=[];if(_0x446ef8['query']['attachments']){_0x3ceb29['push']({'model':db[_0x2d6c('0xd7')],'as':_0x2d6c('0xd8'),'raw':!![]});}var _0x566b4b=[{'model':db[_0x2d6c('0x27')],'as':'Messages','attributes':['id',_0x2d6c('0xc1'),_0x2d6c('0x48'),'to','cc','bcc',_0x2d6c('0xd9'),_0x2d6c('0x71')],'where':{'secret':![]},'order':qs[_0x2d6c('0x43')]('id'),'include':_0x3ceb29}];return db[_0x2d6c('0x34')][_0x2d6c('0x5c')]({'where':{'id':_0x446ef8[_0x2d6c('0xb9')]['id']},'include':_0x566b4b})[_0x2d6c('0x2a')](handleEntityNotFound(_0xa0eb3d,null))[_0x2d6c('0x2a')](function(_0x2cfe75){if(_0x2cfe75&&_0x2cfe75[_0x2d6c('0xda')]){var _0x4caa8f=_0x2cfe75['get']({'plain':!![]});fs['mkdirSync'](_0x2c656d);return BPromise[_0x2d6c('0xdb')](_0x4caa8f[_0x2d6c('0xda')],function(_0x2b1c08,_0x235813){var _0x58453e={'from':_0x2b1c08[_0x2d6c('0x48')],'to':_0x2b1c08['to'],'subject':_0x2b1c08['subject'],'html':htmlEntities[_0x2d6c('0xdc')](_0x2b1c08[_0x2d6c('0xc1')]),'headers':{'Date':moment(_0x2b1c08['createdAt'])[_0x2d6c('0xc6')](_0x2d6c('0xdd'))},'attachments':[]};if(_0x2b1c08['cc']){_0x58453e[_0x2d6c('0xde')]['Cc']=_0x2b1c08['cc'];}if(_0x2b1c08[_0x2d6c('0xdf')]){_0x58453e[_0x2d6c('0xde')][_0x2d6c('0xe0')]=_0x2b1c08[_0x2d6c('0xdf')];}return new BPromise(function(_0x41a1cd,_0x6fdbbe){if(_0x2b1c08['Attachments']){for(var _0x5e502a=0x0;_0x5e502a<_0x2b1c08[_0x2d6c('0xd8')][_0x2d6c('0x3f')];_0x5e502a++){var _0x169942=_0x2b1c08[_0x2d6c('0xd8')][_0x5e502a];var _0x491e0b=path[_0x2d6c('0xd0')](_0x3fdead,_0x169942[_0x2d6c('0xe1')]);if(fs['existsSync'](_0x491e0b)){_0x58453e['attachments'][_0x2d6c('0x25')]({'name':_0x169942[_0x2d6c('0x1d')],'contentType':_0x169942[_0x2d6c('0x37')],'data':fs['readFileSync'](_0x491e0b)});}}}emlformat[_0x2d6c('0xe2')](_0x58453e,function(_0x28f97f,_0x2a3c6d){if(_0x28f97f)return _0x6fdbbe(_0x28f97f);fs[_0x2d6c('0xe3')](path[_0x2d6c('0xd0')](_0x2c656d,util['format'](_0x2d6c('0xe4'),_0x235813)),_0x2a3c6d);return _0x41a1cd(_0x2a3c6d);});});})[_0x2d6c('0x2a')](function(){return new BPromise(function(_0x1d4423,_0x3c25b6){zipdir(_0x2c656d,{'saveTo':_0x59496e},function(_0x5caa6d,_0xd7519f){if(_0x5caa6d)return _0x3c25b6(_0x5caa6d);return _0x1d4423(_0xd7519f);});})[_0x2d6c('0x2a')](function(){return new BPromise(function(_0x14681d,_0x4281a7){rimraf(_0x2c656d,function(_0x4678a5){if(_0x4678a5)_0x4281a7(_0x4678a5);return _0x14681d();});});})[_0x2d6c('0x2a')](function(){return _0xa0eb3d['download'](_0x59496e,_0xdb730d,function(_0x26feb6){if(!_0x26feb6)fs[_0x2d6c('0xe5')](_0x59496e);});});});}else{return _0xa0eb3d[_0x2d6c('0x10')](0xc8);}})[_0x2d6c('0x2d')](handleError(_0xa0eb3d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 62fa120..21f1dfe 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 _0xfd41=['remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xfd41,0xb6));var _0x1fd4=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0xfd41[_0x38e177];return _0x1faf15;};'use strict';var EventEmitter=require(_0x1fd4('0x0'));var MailInteraction=require(_0x1fd4('0x1'))['db'][_0x1fd4('0x2')];var MailMessage=require(_0x1fd4('0x1'))['db'][_0x1fd4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1fd4('0x4'),'afterUpdate':'update','afterDestroy':_0x1fd4('0x5')};function emitEvent(_0x419c9f){return function(_0x51b225,_0x128b64,_0x2dda6b){_0x51b225[_0x1fd4('0x6')]({'attributes':['id'],'raw':!![]})[_0x1fd4('0x7')](function(_0xe7f15e){_0x51b225[_0x1fd4('0x8')](_0x1fd4('0x9'),_0xe7f15e[_0x1fd4('0xa')](function(_0x1f3acd){return{'id':_0x1f3acd['id']};}));return MailMessage[_0x1fd4('0xb')]({'where':{'MailInteractionId':_0x51b225['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fd4('0x7')](function(_0x1cf4bc){_0x51b225[_0x1fd4('0x8')]('unreadMessages',_0x1cf4bc[_0x1fd4('0xc')]);MailInteractionEvents[_0x1fd4('0xd')](_0x419c9f+':'+_0x51b225['id'],_0x51b225);MailInteractionEvents[_0x1fd4('0xd')](_0x419c9f,_0x51b225);_0x2dda6b(null);})['catch'](_0x2dda6b(null));};}for(var e in events){if(events[_0x1fd4('0xe')](e)){var event=events[e];MailInteraction[_0x1fd4('0xf')](e,emitEvent(event));}}module[_0x1fd4('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x6624=['catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x5c555e,_0x7e20c2){var _0x56375f=function(_0x570ed8){while(--_0x570ed8){_0x5c555e['push'](_0x5c555e['shift']());}};_0x56375f(++_0x7e20c2);}(_0x6624,0x1c2));var _0x4662=function(_0x1ccd84,_0x1eab50){_0x1ccd84=_0x1ccd84-0x0;var _0xf47a97=_0x6624[_0x1ccd84];return _0xf47a97;};'use strict';var EventEmitter=require(_0x4662('0x0'));var MailInteraction=require(_0x4662('0x1'))['db'][_0x4662('0x2')];var MailMessage=require(_0x4662('0x1'))['db'][_0x4662('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4662('0x4')](0x0);var events={'afterCreate':_0x4662('0x5'),'afterUpdate':_0x4662('0x6'),'afterDestroy':'remove'};function emitEvent(_0x405e7a){return function(_0x5552a8,_0x20c259,_0x23a80c){_0x5552a8[_0x4662('0x7')]({'attributes':['id'],'raw':!![]})[_0x4662('0x8')](function(_0x10eaf8){_0x5552a8[_0x4662('0x9')](_0x4662('0xa'),_0x10eaf8[_0x4662('0xb')](function(_0x3ea01e){return{'id':_0x3ea01e['id']};}));return MailMessage[_0x4662('0xc')]({'where':{'MailInteractionId':_0x5552a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4662('0x8')](function(_0x1707dd){_0x5552a8[_0x4662('0x9')](_0x4662('0xd'),_0x1707dd['length']);MailInteractionEvents['emit'](_0x405e7a+':'+_0x5552a8['id'],_0x5552a8);MailInteractionEvents['emit'](_0x405e7a,_0x5552a8);_0x23a80c(null);})[_0x4662('0xe')](_0x23a80c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x4662('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index bb9146e..99ede3c 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 _0x339d=['path','rimraf','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','changed','substatus','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0xbd069d,_0x1a46e9){var _0x3107aa=function(_0x23a81d){while(--_0x23a81d){_0xbd069d['push'](_0xbd069d['shift']());}};_0x3107aa(++_0x1a46e9);}(_0x339d,0x91));var _0xd339=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x339d[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xd339('0x0'));var util=require(_0xd339('0x1'));var logger=require(_0xd339('0x2'))('api');var moment=require(_0xd339('0x3'));var BPromise=require(_0xd339('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd339('0x5'));var rimraf=require(_0xd339('0x6'));var config=require('../../config/environment');var attributes=require(_0xd339('0x7'));module[_0xd339('0x8')]=function(_0x3c32b7,_0x2a9c69){return _0x3c32b7['define']('MailInteraction',attributes,{'tableName':_0xd339('0x9'),'paranoid':![],'indexes':[{'name':_0xd339('0xa'),'fields':[_0xd339('0xb'),'to'],'type':_0xd339('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f6257,_0x12574d,_0x350050){if(_0x4f6257['substatus']){_0x4f6257[_0xd339('0xd')]=moment()[_0xd339('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f6257[_0xd339('0xf')]){_0x4f6257[_0xd339('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x350050(null,_0x12574d);},'beforeUpdate':function(_0x1627d1,_0xf3f457,_0x54563a){if(_0x1627d1[_0xd339('0x11')]('substatus')){_0x1627d1['substatusAt']=_0x1627d1[_0xd339('0x12')]?moment()[_0xd339('0xe')](_0xd339('0x13')):null;}if(_0x1627d1['changed']('closed')){_0x1627d1['closedAt']=moment()[_0xd339('0xe')](_0xd339('0x13'));_0x1627d1[_0xd339('0x12')]=null;_0x1627d1[_0xd339('0xd')]=null;}_0x54563a(null,_0x1627d1);},'afterUpdate':function(_0x5c16e0,_0x241b96,_0x111ca7){var _0x525ece=_0x3c32b7[_0xd339('0x14')];var _0x309c1c=_0x5c16e0[_0xd339('0x15')]({'plain':!![]});if(_0x309c1c[_0xd339('0xf')]){return _0x525ece[_0xd339('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x309c1c['id']}})[_0xd339('0x17')](function(){_0x111ca7();})['catch'](function(_0x470f46){_0x111ca7(_0x470f46);});}else{_0x111ca7();}}},'charset':'utf8mb4','collate':_0xd339('0x18')});}; \ No newline at end of file +var _0xd425=['models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd425,0x1ab));var _0x5d42=function(_0x498381,_0x122bfc){_0x498381=_0x498381-0x0;var _0x7e0ae8=_0xd425[_0x498381];return _0x7e0ae8;};'use strict';var _=require(_0x5d42('0x0'));var util=require(_0x5d42('0x1'));var logger=require(_0x5d42('0x2'))(_0x5d42('0x3'));var moment=require(_0x5d42('0x4'));var BPromise=require(_0x5d42('0x5'));var rp=require(_0x5d42('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5d42('0x7'));var attributes=require(_0x5d42('0x8'));module[_0x5d42('0x9')]=function(_0x491afa,_0x3ea33b){return _0x491afa[_0x5d42('0xa')](_0x5d42('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x5d42('0xc'),'fields':['subject','to'],'type':_0x5d42('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x368cfe,_0x1de639,_0x5c62f8){if(_0x368cfe[_0x5d42('0xe')]){_0x368cfe[_0x5d42('0xf')]=moment()[_0x5d42('0x10')](_0x5d42('0x11'));}if(_0x368cfe['closed']){_0x368cfe[_0x5d42('0x12')]=moment()[_0x5d42('0x10')](_0x5d42('0x11'));}_0x5c62f8(null,_0x1de639);},'beforeUpdate':function(_0x3adc2c,_0x1e293e,_0x521915){if(_0x3adc2c[_0x5d42('0x13')](_0x5d42('0xe'))){_0x3adc2c['substatusAt']=_0x3adc2c['substatus']?moment()[_0x5d42('0x10')](_0x5d42('0x11')):null;}if(_0x3adc2c[_0x5d42('0x13')](_0x5d42('0x14'))){_0x3adc2c[_0x5d42('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3adc2c[_0x5d42('0xe')]=null;_0x3adc2c[_0x5d42('0xf')]=null;}_0x521915(null,_0x3adc2c);},'afterUpdate':function(_0x52e338,_0x4c4e13,_0x38c718){var _0x5ed5de=_0x491afa[_0x5d42('0x15')];var _0x5c3e04=_0x52e338[_0x5d42('0x16')]({'plain':!![]});if(_0x5c3e04['closed']){return _0x5ed5de[_0x5d42('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x5c3e04['id']}})[_0x5d42('0x18')](function(){_0x38c718();})[_0x5d42('0x19')](function(_0x108bbc){_0x38c718(_0x108bbc);});}else{_0x38c718();}}},'charset':_0x5d42('0x1a'),'collate':_0x5d42('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 51360d6..dfaa29a 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 _0x99e8=['options','attributes','limit','AddTagsToMailInteraction','find','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','raw'];(function(_0x5eded0,_0x369a44){var _0xb62cc3=function(_0x4fff35){while(--_0x4fff35){_0x5eded0['push'](_0x5eded0['shift']());}};_0xb62cc3(++_0x369a44);}(_0x99e8,0x148));var _0x899e=function(_0x76b420,_0x349df4){_0x76b420=_0x76b420-0x0;var _0x202cf1=_0x99e8[_0x76b420];return _0x202cf1;};'use strict';var _=require('lodash');var util=require(_0x899e('0x0'));var moment=require('moment');var BPromise=require(_0x899e('0x1'));var rs=require(_0x899e('0x2'));var fs=require('fs');var Redis=require(_0x899e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x899e('0x4'));var logger=require(_0x899e('0x5'))(_0x899e('0x6'));var config=require(_0x899e('0x7'));var jayson=require(_0x899e('0x8'));var client=jayson[_0x899e('0x9')][_0x899e('0xa')]({'port':0x232a});config[_0x899e('0xb')]=_[_0x899e('0xc')](config[_0x899e('0xb')],{'host':_0x899e('0xd'),'port':0x18eb});var socket=require(_0x899e('0xe'))(new Redis(config[_0x899e('0xb')]));require(_0x899e('0xf'))['register'](socket);function respondWithRpcPromise(_0x50b17c,_0x3d9c8a,_0x799552){return new BPromise(function(_0xc62d2e,_0x14c0c0){return client[_0x899e('0x10')](_0x50b17c,_0x799552)[_0x899e('0x11')](function(_0x206476){logger[_0x899e('0x12')](_0x899e('0x13'),_0x3d9c8a,_0x899e('0x14'));logger[_0x899e('0x15')](_0x899e('0x16'),_0x3d9c8a,_0x899e('0x14'),JSON[_0x899e('0x17')](_0x206476));if(_0x206476[_0x899e('0x18')]){if(_0x206476[_0x899e('0x18')]['code']===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3d9c8a,_0x206476[_0x899e('0x18')][_0x899e('0x19')]);return _0x14c0c0(_0x206476[_0x899e('0x18')][_0x899e('0x19')]);}logger[_0x899e('0x18')](_0x899e('0x13'),_0x3d9c8a,_0x206476[_0x899e('0x18')][_0x899e('0x19')]);return _0xc62d2e(_0x206476[_0x899e('0x18')][_0x899e('0x19')]);}else{logger['info'](_0x899e('0x13'),_0x3d9c8a,'request\x20sent');_0xc62d2e(_0x206476['result'][_0x899e('0x19')]);}})[_0x899e('0x1a')](function(_0x3c0cb1){logger['error'](_0x899e('0x13'),_0x3d9c8a,_0x3c0cb1);_0x14c0c0(_0x3c0cb1);});});}exports[_0x899e('0x1b')]=function(_0x459755){var _0x31fc23=this;return new Promise(function(_0x1416df,_0x287ac7){return db[_0x899e('0x1c')][_0x899e('0x1d')](_0x459755[_0x899e('0x1e')],{'raw':_0x459755['options']?_0x459755['options'][_0x899e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459755[_0x899e('0x20')]?_0x459755[_0x899e('0x20')]['where']||null:null,'attributes':_0x459755[_0x899e('0x20')]?_0x459755[_0x899e('0x20')][_0x899e('0x21')]||null:null,'limit':_0x459755[_0x899e('0x20')]?_0x459755['options'][_0x899e('0x22')]||null:null})['then'](function(_0xc55e36){logger[_0x899e('0x12')]('UpdateMailInteraction',_0x459755);logger[_0x899e('0x15')](_0x899e('0x1b'),_0x459755,JSON['stringify'](_0xc55e36));_0x1416df(_0xc55e36);})[_0x899e('0x1a')](function(_0x446909){logger[_0x899e('0x18')]('UpdateMailInteraction',_0x446909[_0x899e('0x19')],_0x459755);_0x287ac7(_0x31fc23['error'](0x1f4,_0x446909[_0x899e('0x19')]));});});};exports[_0x899e('0x23')]=function(_0x39ddae){return new Promise(function(_0x305e72,_0x47100e){return db[_0x899e('0x1c')][_0x899e('0x24')]({'where':_0x39ddae[_0x899e('0x20')]?_0x39ddae[_0x899e('0x20')]['where']||null:null})[_0x899e('0x11')](function(_0x2c4170){if(_0x2c4170){return _0x2c4170['addTags'](_0x39ddae[_0x899e('0x1e')][_0x899e('0x25')],_['omit'](_0x39ddae[_0x899e('0x1e')],['ids','id'])||{});}})[_0x899e('0x26')](function(_0x117c07){logger['info'](_0x899e('0x27'),_0x39ddae);logger['debug'](_0x899e('0x27'),_0x39ddae,JSON[_0x899e('0x17')](_0x117c07));_0x305e72(_0x117c07);})['catch'](function(_0xa6d773){logger[_0x899e('0x18')](_0x899e('0x27'),_0xa6d773['message'],_0x39ddae);_0x47100e(_this['error'](0x1f4,_0xa6d773[_0x899e('0x19')]));});});}; \ No newline at end of file +var _0xb344=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./mailInteraction.socket','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','options','raw','where','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','then','addTags','body','ids','omit'];(function(_0x58884e,_0x4a8fb6){var _0x4a5c87=function(_0x22d594){while(--_0x22d594){_0x58884e['push'](_0x58884e['shift']());}};_0x4a5c87(++_0x4a8fb6);}(_0xb344,0x152));var _0x4b34=function(_0x6b085f,_0x26959c){_0x6b085f=_0x6b085f-0x0;var _0x40a408=_0xb344[_0x6b085f];return _0x40a408;};'use strict';var _=require(_0x4b34('0x0'));var util=require(_0x4b34('0x1'));var moment=require(_0x4b34('0x2'));var BPromise=require(_0x4b34('0x3'));var rs=require(_0x4b34('0x4'));var fs=require('fs');var Redis=require(_0x4b34('0x5'));var db=require(_0x4b34('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b34('0x7'))(_0x4b34('0x8'));var config=require(_0x4b34('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4b34('0xa')][_0x4b34('0xb')]({'port':0x232a});config['redis']=_[_0x4b34('0xc')](config['redis'],{'host':_0x4b34('0xd'),'port':0x18eb});var socket=require(_0x4b34('0xe'))(new Redis(config['redis']));require(_0x4b34('0xf'))['register'](socket);function respondWithRpcPromise(_0x481123,_0x57e24d,_0x55e478){return new BPromise(function(_0x334df8,_0x4b2b1d){return client['request'](_0x481123,_0x55e478)['then'](function(_0x29dfa8){logger[_0x4b34('0x10')](_0x4b34('0x11'),_0x57e24d,_0x4b34('0x12'));logger[_0x4b34('0x13')](_0x4b34('0x14'),_0x57e24d,_0x4b34('0x12'),JSON[_0x4b34('0x15')](_0x29dfa8));if(_0x29dfa8[_0x4b34('0x16')]){if(_0x29dfa8[_0x4b34('0x16')][_0x4b34('0x17')]===0x1f4){logger['error'](_0x4b34('0x11'),_0x57e24d,_0x29dfa8[_0x4b34('0x16')]['message']);return _0x4b2b1d(_0x29dfa8[_0x4b34('0x16')][_0x4b34('0x18')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x57e24d,_0x29dfa8[_0x4b34('0x16')][_0x4b34('0x18')]);return _0x334df8(_0x29dfa8[_0x4b34('0x16')][_0x4b34('0x18')]);}else{logger[_0x4b34('0x10')]('MailInteraction,\x20%s,\x20%s',_0x57e24d,'request\x20sent');_0x334df8(_0x29dfa8['result'][_0x4b34('0x18')]);}})[_0x4b34('0x19')](function(_0x5b2592){logger[_0x4b34('0x16')](_0x4b34('0x11'),_0x57e24d,_0x5b2592);_0x4b2b1d(_0x5b2592);});});}exports[_0x4b34('0x1a')]=function(_0x3ed29a){var _0x5fdbfc=this;return new Promise(function(_0x724b7b,_0x8701a7){return db['MailInteraction']['update'](_0x3ed29a['body'],{'raw':_0x3ed29a[_0x4b34('0x1b')]?_0x3ed29a['options'][_0x4b34('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed29a[_0x4b34('0x1b')]?_0x3ed29a['options'][_0x4b34('0x1d')]||null:null,'attributes':_0x3ed29a[_0x4b34('0x1b')]?_0x3ed29a[_0x4b34('0x1b')][_0x4b34('0x1e')]||null:null,'limit':_0x3ed29a[_0x4b34('0x1b')]?_0x3ed29a[_0x4b34('0x1b')][_0x4b34('0x1f')]||null:null})['then'](function(_0x1fb7fb){logger[_0x4b34('0x10')](_0x4b34('0x1a'),_0x3ed29a);logger[_0x4b34('0x13')](_0x4b34('0x1a'),_0x3ed29a,JSON['stringify'](_0x1fb7fb));_0x724b7b(_0x1fb7fb);})[_0x4b34('0x19')](function(_0x27d85b){logger[_0x4b34('0x16')](_0x4b34('0x1a'),_0x27d85b[_0x4b34('0x18')],_0x3ed29a);_0x8701a7(_0x5fdbfc[_0x4b34('0x16')](0x1f4,_0x27d85b[_0x4b34('0x18')]));});});};exports[_0x4b34('0x20')]=function(_0xe491a5){return new Promise(function(_0x3f3da0,_0x1a02aa){return db[_0x4b34('0x21')][_0x4b34('0x22')]({'where':_0xe491a5[_0x4b34('0x1b')]?_0xe491a5['options'][_0x4b34('0x1d')]||null:null})[_0x4b34('0x23')](function(_0x2a9734){if(_0x2a9734){return _0x2a9734[_0x4b34('0x24')](_0xe491a5[_0x4b34('0x25')][_0x4b34('0x26')],_[_0x4b34('0x27')](_0xe491a5[_0x4b34('0x25')],[_0x4b34('0x26'),'id'])||{});}})[_0x4b34('0x28')](function(_0x558ec8){logger[_0x4b34('0x10')](_0x4b34('0x29'),_0xe491a5);logger['debug'](_0x4b34('0x29'),_0xe491a5,JSON[_0x4b34('0x15')](_0x558ec8));_0x3f3da0(_0x558ec8);})[_0x4b34('0x19')](function(_0x54b562){logger['error'](_0x4b34('0x29'),_0x54b562[_0x4b34('0x18')],_0xe491a5);_0x1a02aa(_this[_0x4b34('0x16')](0x1f4,_0x54b562[_0x4b34('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 427be28..a7b7f20 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 _0xbe2b=['./mailInteraction.events','save','update','removeListener','register'];(function(_0x39e5a8,_0x367273){var _0x5c9feb=function(_0x5a372e){while(--_0x5a372e){_0x39e5a8['push'](_0x39e5a8['shift']());}};_0x5c9feb(++_0x367273);}(_0xbe2b,0xe1));var _0xbbe2=function(_0x940dd1,_0x121111){_0x940dd1=_0x940dd1-0x0;var _0x57e7ce=_0xbe2b[_0x940dd1];return _0x57e7ce;};'use strict';var MailInteractionEvents=require(_0xbbe2('0x0'));var events=[_0xbbe2('0x1'),'remove',_0xbbe2('0x2')];function createListener(_0x1c76ec,_0x49d8f2){return function(_0x2ba5aa){_0x49d8f2['emit'](_0x1c76ec,_0x2ba5aa);};}function removeListener(_0x1be9e4,_0x49385a){return function(){MailInteractionEvents[_0xbbe2('0x3')](_0x1be9e4,_0x49385a);};}exports[_0xbbe2('0x4')]=function(_0x4376d3){for(var _0x2aebb8=0x0,_0x40b7f0=events['length'];_0x2aebb8<_0x40b7f0;_0x2aebb8++){var _0x53c768=events[_0x2aebb8];var _0x347313=createListener('mailInteraction:'+_0x53c768,_0x4376d3);MailInteractionEvents['on'](_0x53c768,_0x347313);}}; \ No newline at end of file +var _0x9dd4=['update','emit','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x5a0bab,_0x168def){var _0x32b15a=function(_0x52f391){while(--_0x52f391){_0x5a0bab['push'](_0x5a0bab['shift']());}};_0x32b15a(++_0x168def);}(_0x9dd4,0x138));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0x49dd('0x0'));var events=[_0x49dd('0x1'),_0x49dd('0x2'),_0x49dd('0x3')];function createListener(_0x54d822,_0x5e4e35){return function(_0x32efcd){_0x5e4e35[_0x49dd('0x4')](_0x54d822,_0x32efcd);};}function removeListener(_0x59d48a,_0x4c6422){return function(){MailInteractionEvents['removeListener'](_0x59d48a,_0x4c6422);};}exports['register']=function(_0x551d61){for(var _0x3233f0=0x0,_0x4e8e4b=events[_0x49dd('0x5')];_0x3233f0<_0x4e8e4b;_0x3233f0++){var _0x21fe5f=events[_0x3233f0];var _0x2c10d3=createListener(_0x49dd('0x6')+_0x21fe5f,_0x551d61);MailInteractionEvents['on'](_0x21fe5f,_0x2c10d3);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cc0494f..55b487a 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 _0xc882=['show','download','post','tracked','mail','create','put','update','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xc882,0xff));var _0x2c88=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc882[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var path=require(_0x2c88('0x2'));var timeout=require(_0x2c88('0x3'));var express=require(_0x2c88('0x4'));var router=express[_0x2c88('0x5')]();var fs_extra=require(_0x2c88('0x6'));var auth=require(_0x2c88('0x7'));var interaction=require(_0x2c88('0x8'));var config=require(_0x2c88('0x9'));var controller=require(_0x2c88('0xa'));router[_0x2c88('0xb')]('/',auth[_0x2c88('0xc')](),controller[_0x2c88('0xd')]);router[_0x2c88('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2c88('0xb')](_0x2c88('0xe'),auth['isAuthenticated'](),controller[_0x2c88('0xf')]);router[_0x2c88('0xb')]('/:id/download',auth[_0x2c88('0xc')](),controller[_0x2c88('0x10')]);router[_0x2c88('0x11')]('/',auth['isAuthenticated'](),interaction[_0x2c88('0x12')](_0x2c88('0x13'),'mailmessage:create'),controller[_0x2c88('0x14')]);router[_0x2c88('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2c88('0x16')]);router[_0x2c88('0x15')](_0x2c88('0x17'),auth['isAuthenticated'](),controller['accept']);router[_0x2c88('0x15')]('/:id/reject',auth[_0x2c88('0xc')](),controller[_0x2c88('0x18')]);router[_0x2c88('0x19')](_0x2c88('0xe'),auth[_0x2c88('0xc')](),controller[_0x2c88('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x23f2=['download','post','tracked','mail','mailmessage:create','put','update','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x23f2,0x1a2));var _0x223f=function(_0x56ab8f,_0x19b8d0){_0x56ab8f=_0x56ab8f-0x0;var _0x56d987=_0x23f2[_0x56ab8f];return _0x56d987;};'use strict';var multer=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var path=require(_0x223f('0x2'));var timeout=require('connect-timeout');var express=require(_0x223f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x223f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x223f('0x5'));var controller=require(_0x223f('0x6'));router['get']('/',auth[_0x223f('0x7')](),controller[_0x223f('0x8')]);router[_0x223f('0x9')](_0x223f('0xa'),auth[_0x223f('0x7')](),controller[_0x223f('0xb')]);router[_0x223f('0x9')]('/:id',auth[_0x223f('0x7')](),controller[_0x223f('0xc')]);router['get'](_0x223f('0xd'),auth[_0x223f('0x7')](),controller[_0x223f('0xe')]);router[_0x223f('0xf')]('/',auth[_0x223f('0x7')](),interaction[_0x223f('0x10')](_0x223f('0x11'),_0x223f('0x12')),controller['create']);router[_0x223f('0x13')]('/:id',auth[_0x223f('0x7')](),controller[_0x223f('0x14')]);router[_0x223f('0x13')]('/:id/accept',auth[_0x223f('0x7')](),controller['accept']);router[_0x223f('0x13')](_0x223f('0x15'),auth[_0x223f('0x7')](),controller[_0x223f('0x16')]);router[_0x223f('0x17')](_0x223f('0x18'),auth[_0x223f('0x7')](),controller[_0x223f('0x19')]);module[_0x223f('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 9c99cff..3a19ed1 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 _0xf0b0=['ENUM','Email','Chat','lodash','exports','TEXT','BOOLEAN','out','STRING','long'];(function(_0x58701f,_0x16037c){var _0x11ec45=function(_0x5143a5){while(--_0x5143a5){_0x58701f['push'](_0x58701f['shift']());}};_0x11ec45(++_0x16037c);}(_0xf0b0,0x143));var _0x0f0b=function(_0x26121b,_0x1247ca){_0x26121b=_0x26121b-0x0;var _0x3407d3=_0xf0b0[_0x26121b];return _0x3407d3;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0f0b('0x0'));module[_0x0f0b('0x1')]={'body':{'type':Sequelize[_0x0f0b('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0f0b('0x2')]('medium')},'read':{'type':Sequelize[_0x0f0b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0f0b('0x4')),'defaultValue':_0x0f0b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0f0b('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x0f0b('0x2')](_0x0f0b('0x6'))},'cc':{'type':Sequelize['TEXT'](_0x0f0b('0x6'))},'bcc':{'type':Sequelize[_0x0f0b('0x2')](_0x0f0b('0x6'))},'subject':{'type':Sequelize[_0x0f0b('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x0f0b('0x2')](_0x0f0b('0x6'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x0f0b('0x7')](_0x0f0b('0x8'),_0x0f0b('0x9')),'defaultValue':_0x0f0b('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x4329=['ENUM','out','STRING','DATE','INTEGER','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN'];(function(_0x4c5e14,_0xeee557){var _0xd244bc=function(_0x5e556b){while(--_0x5e556b){_0x4c5e14['push'](_0x4c5e14['shift']());}};_0xd244bc(++_0xeee557);}(_0x4329,0x13b));var _0x9432=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4329[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x9432('0x0'));var _=require(_0x9432('0x1'));module[_0x9432('0x2')]={'body':{'type':Sequelize[_0x9432('0x3')](_0x9432('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9432('0x3')](_0x9432('0x5'))},'read':{'type':Sequelize[_0x9432('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9432('0x7')]('in',_0x9432('0x8')),'defaultValue':_0x9432('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9432('0x9')](0x1fe)},'from':{'type':Sequelize[_0x9432('0x9')]},'to':{'type':Sequelize[_0x9432('0x3')]('long')},'cc':{'type':Sequelize[_0x9432('0x3')]('long')},'bcc':{'type':Sequelize[_0x9432('0x3')](_0x9432('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x9432('0xa')]},'attach':{'type':Sequelize[_0x9432('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9432('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9432('0xa')]},'originTo':{'type':Sequelize[_0x9432('0x3')]('long')},'originCc':{'type':Sequelize[_0x9432('0x3')](_0x9432('0x4'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x9432('0xc')),'defaultValue':_0x9432('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4ee54ff..9912fc0 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 _0x1369=['api','../../config/logger','mail-interactions','redis','socket.io-emitter','html-entities','./mailMessage.socket','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','limit','undefined','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','MailMessage','includeAll','findAll','rows','show','params','keys','include','find','body','describe','create','direction','secret','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','fromString','download','unix','root','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs'];(function(_0x4d0375,_0x1178f1){var _0x14b1fa=function(_0x4fc937){while(--_0x4fc937){_0x4d0375['push'](_0x4d0375['shift']());}};_0x14b1fa(++_0x1178f1);}(_0x1369,0x99));var _0x9136=function(_0x1e8520,_0x5daed2){_0x1e8520=_0x1e8520-0x0;var _0x4ac3d1=_0x1369[_0x1e8520];return _0x4ac3d1;};'use strict';var emlformat=require(_0x9136('0x0'));var moment=require(_0x9136('0x1'));var BPromise=require(_0x9136('0x2'));var util=require(_0x9136('0x3'));var path=require(_0x9136('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x9136('0x5'));var htmlToText=require(_0x9136('0x6'));var qs=require(_0x9136('0x7'));var logger=require('../../config/logger')(_0x9136('0x8'));var interaction_log=require(_0x9136('0x9'))(_0x9136('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x9136('0xb')]=_['defaults'](config[_0x9136('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9136('0xc'))(new Redis(config[_0x9136('0xb')]));var htmlEntities=require(_0x9136('0xd'));require(_0x9136('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9136('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x9136('0xf')]({'port':0x232b});var client9002=jayson[_0x9136('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2705b2,_0x59fed9,_0x35babf,_0x11e862){return new BPromise(function(_0x4f4e41,_0xff08ab){var _0x1d9cb1=_0x11e862||client;return _0x1d9cb1[_0x9136('0x11')](_0x2705b2,_0x35babf)[_0x9136('0x12')](function(_0x588a69){logger[_0x9136('0x13')](_0x9136('0x14'),_0x59fed9,_0x9136('0x15'));logger[_0x9136('0x16')](_0x9136('0x17'),_0x59fed9,_0x9136('0x15'),JSON['stringify'](_0x588a69));if(_0x588a69[_0x9136('0x18')]){if(_0x588a69[_0x9136('0x18')][_0x9136('0x19')]===0x1f4){logger[_0x9136('0x18')](_0x9136('0x14'),_0x59fed9,_0x588a69['error'][_0x9136('0x1a')]);return _0xff08ab(_0x588a69[_0x9136('0x18')][_0x9136('0x1a')]);}logger[_0x9136('0x18')](_0x9136('0x14'),_0x59fed9,_0x588a69['error'][_0x9136('0x1a')]);return _0x4f4e41(_0x588a69[_0x9136('0x18')][_0x9136('0x1a')]);}else{logger[_0x9136('0x13')]('MailMessage,\x20%s,\x20%s',_0x59fed9,_0x9136('0x15'));_0x4f4e41(_0x588a69[_0x9136('0x1b')][_0x9136('0x1a')]);}})[_0x9136('0x1c')](function(_0x5d1a82){logger[_0x9136('0x18')](_0x9136('0x14'),_0x59fed9,_0x5d1a82);_0xff08ab(_0x5d1a82);});});}function respondWithResult(_0x177322,_0x5089f1){_0x5089f1=_0x5089f1||0xc8;return function(_0x294989){if(_0x294989){return _0x177322[_0x9136('0x1d')](_0x5089f1)[_0x9136('0x1e')](_0x294989);}};}function respondWithFilteredResult(_0x2db507,_0x315d05){return function(_0x5b5d5b){if(_0x5b5d5b){var _0x40ef91=typeof _0x315d05[_0x9136('0x1f')]==='undefined'&&typeof _0x315d05[_0x9136('0x20')]===_0x9136('0x21');var _0x5ad3f6=_0x5b5d5b['count'];var _0x2954f3=_0x40ef91?0x0:_0x315d05[_0x9136('0x1f')];var _0x413c13=_0x40ef91?_0x5b5d5b['count']:_0x315d05[_0x9136('0x1f')]+_0x315d05[_0x9136('0x20')];var _0x20d2a9;if(_0x413c13>=_0x5ad3f6){_0x413c13=_0x5ad3f6;_0x20d2a9=0xc8;}else{_0x20d2a9=0xce;}_0x2db507['status'](_0x20d2a9);return _0x2db507['set']('Content-Range',_0x2954f3+'-'+_0x413c13+'/'+_0x5ad3f6)[_0x9136('0x1e')](_0x5b5d5b);}return null;};}function saveUpdates(_0x5ec091){return function(_0x333eba){if(_0x333eba){return _0x333eba['update'](_0x5ec091)[_0x9136('0x12')](function(_0x2e4840){return _0x2e4840;});}return null;};}function removeEntity(_0xd301f5){return function(_0x244b98){if(_0x244b98){return _0x244b98[_0x9136('0x22')]()[_0x9136('0x12')](function(){_0xd301f5[_0x9136('0x1d')](0xcc)[_0x9136('0x23')]();});}};}function handleEntityNotFound(_0x51589a){return function(_0x54603a){if(!_0x54603a){_0x51589a[_0x9136('0x24')](0x194);}return _0x54603a;};}function handleError(_0x35be70,_0x553e46){_0x553e46=_0x553e46||0x1f4;return function(_0x383e29){logger[_0x9136('0x18')](_0x383e29[_0x9136('0x25')]);if(_0x383e29[_0x9136('0x26')]){delete _0x383e29[_0x9136('0x26')];}_0x35be70[_0x9136('0x1d')](_0x553e46)[_0x9136('0x27')](_0x383e29);};}exports[_0x9136('0x28')]=function(_0x2266cf,_0x1c9059){var _0x2bd978={},_0x1f7db0={},_0x29fa81={'count':0x0,'rows':[]};var _0x53abc6=_['map'](db['MailMessage'][_0x9136('0x29')],function(_0x6a23e2){return{'name':_0x6a23e2[_0x9136('0x2a')],'type':_0x6a23e2[_0x9136('0x2b')]['key']};});_0x1f7db0[_0x9136('0x2c')]=_[_0x9136('0x2d')](_0x53abc6,'name');_0x1f7db0['query']=_['keys'](_0x2266cf['query']);_0x1f7db0[_0x9136('0x2e')]=_[_0x9136('0x2f')](_0x1f7db0['model'],_0x1f7db0[_0x9136('0x30')]);_0x2bd978[_0x9136('0x31')]=_[_0x9136('0x2f')](_0x1f7db0[_0x9136('0x2c')],qs[_0x9136('0x32')](_0x2266cf[_0x9136('0x30')]['fields']));_0x2bd978['attributes']=_0x2bd978[_0x9136('0x31')][_0x9136('0x33')]?_0x2bd978['attributes']:_0x1f7db0[_0x9136('0x2c')];if(!_0x2266cf[_0x9136('0x30')][_0x9136('0x34')](_0x9136('0x35'))){_0x2bd978['limit']=qs[_0x9136('0x20')](_0x2266cf[_0x9136('0x30')][_0x9136('0x20')]);_0x2bd978[_0x9136('0x1f')]=qs['offset'](_0x2266cf['query']['offset']);}_0x2bd978[_0x9136('0x36')]=qs['sort'](_0x2266cf[_0x9136('0x30')][_0x9136('0x37')]);_0x2bd978[_0x9136('0x38')]=qs[_0x9136('0x2e')](_['pick'](_0x2266cf[_0x9136('0x30')],_0x1f7db0[_0x9136('0x2e')]),_0x53abc6);if(_0x2266cf['query']['filter']){_0x2bd978[_0x9136('0x38')]=_[_0x9136('0x39')](_0x2bd978[_0x9136('0x38')],{'$or':_[_0x9136('0x2d')](_0x53abc6,function(_0x17c715){if(_0x17c715[_0x9136('0x2b')]!==_0x9136('0x3a')){var _0x5c48be={};_0x5c48be[_0x17c715['name']]={'$like':'%'+_0x2266cf[_0x9136('0x30')][_0x9136('0x3b')]+'%'};return _0x5c48be;}})});}_0x2bd978=_['merge']({},_0x2bd978,_0x2266cf[_0x9136('0x3c')]);var _0x591e9f={'where':_0x2bd978['where']};return db[_0x9136('0x3d')]['count'](_0x591e9f)[_0x9136('0x12')](function(_0x2b9068){_0x29fa81['count']=_0x2b9068;if(_0x2266cf[_0x9136('0x30')][_0x9136('0x3e')]){_0x2bd978['include']=[{'all':!![]}];}return db[_0x9136('0x3d')][_0x9136('0x3f')](_0x2bd978);})[_0x9136('0x12')](function(_0x443076){_0x29fa81[_0x9136('0x40')]=_0x443076;return _0x29fa81;})['then'](respondWithFilteredResult(_0x1c9059,_0x2bd978))[_0x9136('0x1c')](handleError(_0x1c9059,null));};exports[_0x9136('0x41')]=function(_0xd8edf0,_0x5005ea){var _0x51c32d={'raw':!![],'where':{'id':_0xd8edf0[_0x9136('0x42')]['id']}},_0x1c2920={};_0x1c2920['model']=_['keys'](db['MailMessage'][_0x9136('0x29')]);_0x1c2920[_0x9136('0x30')]=_[_0x9136('0x43')](_0xd8edf0[_0x9136('0x30')]);_0x1c2920['filters']=_[_0x9136('0x2f')](_0x1c2920[_0x9136('0x2c')],_0x1c2920['query']);_0x51c32d[_0x9136('0x31')]=_['intersection'](_0x1c2920[_0x9136('0x2c')],qs[_0x9136('0x32')](_0xd8edf0[_0x9136('0x30')]['fields']));_0x51c32d[_0x9136('0x31')]=_0x51c32d[_0x9136('0x31')][_0x9136('0x33')]?_0x51c32d['attributes']:_0x1c2920[_0x9136('0x2c')];if(_0xd8edf0[_0x9136('0x30')]['includeAll']){_0x51c32d[_0x9136('0x44')]=[{'all':!![]}];}_0x51c32d=_[_0x9136('0x39')]({},_0x51c32d,_0xd8edf0[_0x9136('0x3c')]);return db[_0x9136('0x3d')][_0x9136('0x45')](_0x51c32d)[_0x9136('0x12')](handleEntityNotFound(_0x5005ea,null))['then'](respondWithResult(_0x5005ea,null))[_0x9136('0x1c')](handleError(_0x5005ea,null));};exports['update']=function(_0x38a8e4,_0x48d670){if(_0x38a8e4['body']['id']){delete _0x38a8e4[_0x9136('0x46')]['id'];}return db[_0x9136('0x3d')][_0x9136('0x45')]({'where':{'id':_0x38a8e4[_0x9136('0x42')]['id']}})[_0x9136('0x12')](handleEntityNotFound(_0x48d670,null))[_0x9136('0x12')](saveUpdates(_0x38a8e4[_0x9136('0x46')],null))[_0x9136('0x12')](respondWithResult(_0x48d670,null))['catch'](handleError(_0x48d670,null));};exports[_0x9136('0x22')]=function(_0x1254bd,_0xd5fd8a){return db[_0x9136('0x3d')][_0x9136('0x45')]({'where':{'id':_0x1254bd[_0x9136('0x42')]['id']}})[_0x9136('0x12')](handleEntityNotFound(_0xd5fd8a,null))[_0x9136('0x12')](removeEntity(_0xd5fd8a,null))[_0x9136('0x1c')](handleError(_0xd5fd8a,null));};exports['describe']=function(_0x2cea71,_0x5afb13){return db[_0x9136('0x3d')][_0x9136('0x47')]()[_0x9136('0x12')](respondWithResult(_0x5afb13,null))[_0x9136('0x1c')](handleError(_0x5afb13,null));};exports[_0x9136('0x48')]=function(_0x391d38,_0x17a128){return db[_0x9136('0x3d')][_0x9136('0x48')](_0x391d38['body'])[_0x9136('0x12')](function(_0x3fc13a){if(_0x3fc13a){if(_0x3fc13a[_0x9136('0x49')]==='out'&&!_0x3fc13a[_0x9136('0x4a')]){var _0x53166e,_0x3a7c36,_0xc4a50f;if(_0x391d38['body']['to']){_0x3a7c36=_0x391d38[_0x9136('0x46')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x3fc13a[_0x9136('0x4b')]},'include':[{'model':db[_0x9136('0x4c')],'as':_0x9136('0x4d'),'include':[{'model':db[_0x9136('0x4e')],'as':_0x9136('0x4f'),'where':{'email':_0x3a7c36},'limit':0x1,'order':[[_0x9136('0x50'),_0x9136('0x51')]]}]},{'model':db[_0x9136('0x52')],'as':_0x9136('0x53'),'raw':!![],'include':[{'model':db[_0x9136('0x54')],'as':_0x9136('0x54'),'raw':!![]}]}]})[_0x9136('0x12')](function(_0x3b818f){_0x53166e=_0x3b818f;if(!_0x53166e||!_0x53166e[_0x9136('0x53')])return;var _0x1bc704=_0x53166e[_0x9136('0x55')]();if(_0x391d38['body'][_0x9136('0x56')]&&_0x391d38[_0x9136('0x46')][_0x9136('0x56')][_0x9136('0x33')]){for(var _0x354f20=0x0;_0x354f20<_0x391d38[_0x9136('0x46')][_0x9136('0x56')]['length'];_0x354f20+=0x1){_0x391d38[_0x9136('0x46')]['attachments'][_0x354f20]={'filename':_0x391d38['body'][_0x9136('0x56')][_0x354f20][_0x9136('0x26')],'path':path[_0x9136('0x57')](config['root'],_0x9136('0x58'),_0x391d38[_0x9136('0x46')][_0x9136('0x56')][_0x354f20][_0x9136('0x59')])};}}_0xc4a50f={'account':_0x1bc704,'message':_0x391d38[_0x9136('0x46')]};return;})[_0x9136('0x12')](function(){if(_0x53166e[_0x9136('0x4d')]){if(_0x53166e[_0x9136('0x4d')]['Contacts']['length']){return _0x53166e[_0x9136('0x4d')]['Contacts'][0x0];}else{return db[_0x9136('0x4e')][_0x9136('0x48')](_[_0x9136('0x5a')](_0x391d38[_0x9136('0x46')],{'firstName':_0x391d38[_0x9136('0x46')]['to'],'email':_0x391d38['body']['to'],'phone':_0x391d38[_0x9136('0x46')]['to'],'ListId':_0x53166e[_0x9136('0x5b')]}));}}else{throw new Error(_0x9136('0x5c'));}})[_0x9136('0x12')](function(){if(_0xc4a50f){return respondWithRpcPromise(_0x9136('0x5d'),_0x9136('0x5e'),_0xc4a50f,client9003)[_0x9136('0x12')](function(_0x55603a){return _0x3fc13a[_0x9136('0x5f')]({'read':!![],'messageId':_0x55603a[_0x9136('0x60')],'sentAt':moment()[_0x9136('0x61')](_0x9136('0x62'))});})['catch'](function(_0x2a0b65){logger[_0x9136('0x18')]('%s',JSON['stringify'](_0x2a0b65));return _0x3fc13a;});}return _0x3fc13a;});}return _0x3fc13a;}})['then'](respondWithResult(_0x17a128,0xc9))[_0x9136('0x1c')](handleError(_0x17a128,null));};exports['accept']=function(_0x40c69b,_0x1247fb){var _0x4a85e3={'agent':{},'channel':_0x9136('0x63')};if(_0x40c69b[_0x9136('0x46')]['id']){delete _0x40c69b[_0x9136('0x46')]['id'];}_0x40c69b[_0x9136('0x46')][_0x9136('0x64')]=!![];_0x40c69b[_0x9136('0x46')][_0x9136('0x65')]=moment()[_0x9136('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x40c69b[_0x9136('0x46')]['UserId']=_0x40c69b[_0x9136('0x46')][_0x9136('0x66')]||_0x40c69b['user']['id'];_0x4a85e3[_0x9136('0x67')]['id']=_0x40c69b[_0x9136('0x46')][_0x9136('0x66')];return db[_0x9136('0x3d')][_0x9136('0x45')]({'where':{'id':_0x40c69b[_0x9136('0x42')]['id'],'UserId':null}})[_0x9136('0x12')](handleEntityNotFound(_0x1247fb,null))[_0x9136('0x12')](saveUpdates(_0x40c69b[_0x9136('0x46')],null))[_0x9136('0x12')](function(_0x4fb6e1){if(_0x4fb6e1){_0x4a85e3['message']=_0x4fb6e1[_0x9136('0x68')]({'plain':!![]});return db[_0x9136('0x69')][_0x9136('0x45')]({'where':{'id':_0x4fb6e1[_0x9136('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x1247fb,null))[_0x9136('0x12')](function(_0x5e7648){if(_0x5e7648){return _0x5e7648[_0x9136('0x5f')]({'UserId':_0x40c69b['body'][_0x9136('0x66')],'read1stAt':_[_0x9136('0x6b')](_0x5e7648['read1stAt'])?moment()[_0x9136('0x61')](_0x9136('0x62')):undefined});}return null;})['then'](function(_0x51f0e7){if(_0x51f0e7){_0x4a85e3['interaction']=_0x51f0e7[_0x9136('0x68')]({'plain':!![]});interaction_log[_0x9136('0x13')](_0x9136('0x6c'),_0x40c69b[_0x9136('0x6d')]['id'],_0x40c69b[_0x9136('0x6d')][_0x9136('0x26')],_0x40c69b[_0x9136('0x6d')][_0x9136('0x6e')],_0x4a85e3[_0x9136('0x6f')]['id'],_0x40c69b[_0x9136('0x46')]?JSON[_0x9136('0x70')](_0x40c69b[_0x9136('0x46')]):_0x9136('0x71'));return respondWithRpcPromise('AcceptMessage',_0x9136('0x72'),_0x4a85e3);}return null;})[_0x9136('0x12')](function(_0x7feaf5){var _0x2115df=_0x9136('0x73')+_0x7feaf5[_0x9136('0x1a')][_0x9136('0x74')];return db[_0x9136('0x75')][_0x9136('0x30')](_0x2115df,{'type':db[_0x9136('0x76')][_0x9136('0x77')][_0x9136('0x78')],'raw':!![]})['then'](function(_0x208b61){return _0x208b61;});})[_0x9136('0x12')](function(_0x2a84d1){if(_0x2a84d1){_0x4a85e3[_0x9136('0x1a')][_0x9136('0x79')]=_0x2a84d1[0x0];if(!_0x40c69b['body'][_0x9136('0x66')])return;return db[_0x9136('0x7a')]['find']({'where':{'id':_0x40c69b['body'][_0x9136('0x66')],'role':'agent'},'attributes':['id','name',_0x9136('0x7b'),_0x9136('0x7c'),_0x9136('0x7d')],'raw':!![]});}return null;})['then'](function(_0x322823){if(!_0x322823)return null;_0x4a85e3[_0x9136('0x1a')][_0x9136('0x67')]=_0x322823;return _0x4a85e3;})[_0x9136('0x12')](function(_0x220041){if(_0x220041){if(_0x40c69b[_0x9136('0x46')][_0x9136('0x7e')]){_0x4a85e3[_0x9136('0x1a')][_0x9136('0x7f')]=util['format'](_0x9136('0x80'),_0x40c69b[_0x9136('0x6d')][_0x9136('0x26')]);_0x4a85e3[_0x9136('0x1a')][_0x9136('0x81')]=_0x4a85e3['channel'];_0x4a85e3[_0x9136('0x1a')]['motionChannel']=_0x4a85e3['channel'];_0x4a85e3[_0x9136('0x1a')][_0x9136('0x82')]=_0x9136('0x83');_0x4a85e3[_0x9136('0x1a')]['body']=htmlToText['fromString'](_0x4a85e3[_0x9136('0x1a')][_0x9136('0x46')]);return respondWithRpcPromise(_0x9136('0x84'),'EventManager',{'event':_0x9136('0x85'),'message':_0x4a85e3[_0x9136('0x1a')]},client9002)[_0x9136('0x12')](function(){return _0x4a85e3;});}return _0x4a85e3;}return null;})[_0x9136('0x12')](respondWithResult(_0x1247fb,null))[_0x9136('0x1c')](handleError(_0x1247fb,null));};exports[_0x9136('0x86')]=function(_0x2b7e3e,_0x107e15){var _0x1b5d61={'agent':{},'channel':_0x9136('0x63')};if(_0x2b7e3e['body']['id']){delete _0x2b7e3e[_0x9136('0x46')]['id'];}_0x2b7e3e[_0x9136('0x46')][_0x9136('0x66')]=_0x2b7e3e[_0x9136('0x46')][_0x9136('0x66')]||_0x2b7e3e[_0x9136('0x6d')]['id'];_0x1b5d61[_0x9136('0x67')]['id']=_0x2b7e3e[_0x9136('0x46')]['UserId'];return db[_0x9136('0x3d')]['find']({'where':{'id':_0x2b7e3e[_0x9136('0x42')]['id'],'UserId':null}})[_0x9136('0x12')](handleEntityNotFound(_0x107e15,null))[_0x9136('0x12')](function(_0x35311d){if(_0x35311d){_0x1b5d61[_0x9136('0x1a')]=_0x35311d[_0x9136('0x68')]({'plain':!![]});return db[_0x9136('0x69')]['find']({'where':{'id':_0x35311d[_0x9136('0x6a')]}});}return null;})[_0x9136('0x12')](handleEntityNotFound(_0x107e15,null))[_0x9136('0x12')](function(_0x4add1d){if(_0x4add1d){_0x1b5d61[_0x9136('0x6f')]=_0x4add1d[_0x9136('0x68')]({'plain':!![]});interaction_log[_0x9136('0x13')](_0x9136('0x87'),_0x2b7e3e[_0x9136('0x6d')]['id'],_0x2b7e3e[_0x9136('0x6d')][_0x9136('0x26')],_0x2b7e3e[_0x9136('0x6d')][_0x9136('0x6e')],_0x1b5d61[_0x9136('0x6f')]['id'],_0x2b7e3e['body']?JSON[_0x9136('0x70')](_0x2b7e3e[_0x9136('0x46')]):_0x9136('0x71'));return respondWithRpcPromise(_0x9136('0x88'),_0x9136('0x89'),_0x1b5d61);}return null;})[_0x9136('0x12')](function(_0x1ab5de){var _0x4e97d7=_0x9136('0x73')+_0x1ab5de['message'][_0x9136('0x74')];return db[_0x9136('0x75')]['query'](_0x4e97d7,{'type':db[_0x9136('0x76')]['QueryTypes'][_0x9136('0x78')],'raw':!![]})['then'](function(_0x474e17){return _0x474e17;});})['then'](function(_0x1c6a23){if(_0x1c6a23){_0x1b5d61[_0x9136('0x1a')][_0x9136('0x79')]=_0x1c6a23[0x0];if(!_0x2b7e3e['body'][_0x9136('0x66')])return;return db[_0x9136('0x7a')][_0x9136('0x45')]({'where':{'id':_0x2b7e3e['body'][_0x9136('0x66')],'role':_0x9136('0x67')},'attributes':['id','name',_0x9136('0x7b'),'email',_0x9136('0x7d')],'raw':!![]});}return null;})['then'](function(_0x452efc){if(!_0x452efc)return null;_0x1b5d61[_0x9136('0x1a')][_0x9136('0x67')]=_0x452efc;return _0x1b5d61;})[_0x9136('0x12')](function(_0x1f9674){if(_0x1f9674){_0x1f9674[_0x9136('0x1a')][_0x9136('0x7f')]=util[_0x9136('0x61')]('SIP/%s',_0x2b7e3e[_0x9136('0x6d')][_0x9136('0x26')]);_0x1f9674[_0x9136('0x1a')][_0x9136('0x81')]=_0x1b5d61[_0x9136('0x81')];_0x1f9674[_0x9136('0x1a')][_0x9136('0x8a')]=_0x1b5d61['channel'];_0x1f9674[_0x9136('0x1a')][_0x9136('0x82')]=_0x9136('0x86');_0x1f9674[_0x9136('0x1a')][_0x9136('0x46')]=htmlToText[_0x9136('0x8b')](_0x1b5d61[_0x9136('0x1a')][_0x9136('0x46')]);respondWithRpcPromise(_0x9136('0x84'),_0x9136('0x84'),{'event':'rejectmessage','message':_0x1f9674['message']},client9002);return _0x1b5d61;}return null;})['then'](respondWithResult(_0x107e15,null))['catch'](handleError(_0x107e15,null));};exports[_0x9136('0x8c')]=function(_0x50cf66,_0x2c5e51){var _0x2dc90b=moment()[_0x9136('0x8d')]()['toString']();var _0x22b460=path[_0x9136('0x57')](config[_0x9136('0x8e')],_0x9136('0x8f'),_0x9136('0x90'),_0x9136('0x91'));var _0x452112=path['join'](config['root'],_0x9136('0x8f'),_0x9136('0x90'),'attachments');var _0x44c3b2=util['format'](_0x9136('0x92'),_0x2dc90b);return db['MailMessage'][_0x9136('0x45')]({'where':{'id':_0x50cf66[_0x9136('0x42')]['id']},'attributes':['id',_0x9136('0x46'),_0x9136('0x93'),'to','cc',_0x9136('0x94'),'subject',_0x9136('0x95')],'include':_0x50cf66[_0x9136('0x30')][_0x9136('0x56')]?[{'model':db[_0x9136('0x96')],'as':_0x9136('0x97')}]:undefined})[_0x9136('0x12')](handleEntityNotFound(_0x2c5e51,null))[_0x9136('0x12')](function(_0x540eb8){if(_0x540eb8){var _0x37b085=_0x540eb8;var _0x336ad7={'from':_0x37b085[_0x9136('0x93')],'to':_0x37b085['to'],'subject':_0x37b085[_0x9136('0x98')],'html':htmlEntities[_0x9136('0x99')](_0x37b085[_0x9136('0x46')]),'headers':{'Date':moment(_0x37b085[_0x9136('0x95')])[_0x9136('0x61')](_0x9136('0x9a'))},'attachments':[]};if(_0x540eb8['cc']){_0x336ad7[_0x9136('0x9b')]['Cc']=_0x540eb8['cc'];}if(_0x540eb8[_0x9136('0x94')]){_0x336ad7[_0x9136('0x9b')][_0x9136('0x9c')]=_0x540eb8[_0x9136('0x94')];}return new BPromise(function(_0x1c1a7e,_0x23fdb0){if(_0x540eb8[_0x9136('0x97')]){for(var _0x25e8dd=0x0;_0x25e8dd<_0x540eb8[_0x9136('0x97')][_0x9136('0x33')];_0x25e8dd++){var _0x476a44=_0x540eb8[_0x9136('0x97')][_0x25e8dd];var _0x19b64e=path[_0x9136('0x57')](_0x452112,_0x476a44['basename']);if(fs[_0x9136('0x9d')](_0x19b64e)){_0x336ad7[_0x9136('0x56')][_0x9136('0x9e')]({'name':_0x476a44[_0x9136('0x26')],'contentType':_0x476a44[_0x9136('0x2b')],'data':fs['readFileSync'](_0x19b64e)});}}}emlformat[_0x9136('0x9f')](_0x336ad7,function(_0x49190a,_0x4a644d){if(_0x49190a)return _0x23fdb0(_0x49190a);fs[_0x9136('0xa0')](path[_0x9136('0x57')](_0x22b460,_0x44c3b2),_0x4a644d);return _0x1c1a7e(_0x4a644d);});});}})[_0x9136('0x12')](function(_0x128da6){if(_0x128da6){return _0x2c5e51['download'](path[_0x9136('0x57')](_0x22b460,_0x44c3b2),_0x44c3b2,function(_0x51af7f){if(!_0x51af7f)fs['unlinkSync'](path['join'](_0x22b460,_0x44c3b2));});}})[_0x9136('0x1c')](handleError(_0x2c5e51,null));}; \ No newline at end of file +var _0xebfd=['writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','http','client','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','body','describe','create','direction','out','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','CloudProvider','Smtp','getSmtpOptions','attachments','root','server/files/attachments','Contacts','ListId','sendMail','mail','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','internal','SIP/%s','download','toString','join','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','headers','Bcc','basename','existsSync','push','readFileSync'];(function(_0x443b20,_0x1f7118){var _0x49a084=function(_0x595322){while(--_0x595322){_0x443b20['push'](_0x443b20['shift']());}};_0x49a084(++_0x1f7118);}(_0xebfd,0x1e2));var _0xdebf=function(_0x1b5d5f,_0x5ed766){_0x1b5d5f=_0x1b5d5f-0x0;var _0x3c9347=_0xebfd[_0x1b5d5f];return _0x3c9347;};'use strict';var emlformat=require(_0xdebf('0x0'));var moment=require(_0xdebf('0x1'));var BPromise=require(_0xdebf('0x2'));var util=require(_0xdebf('0x3'));var path=require(_0xdebf('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xdebf('0x5'));var htmlToText=require(_0xdebf('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xdebf('0x7'))(_0xdebf('0x8'));var interaction_log=require('../../config/logger')(_0xdebf('0x9'));var config=require(_0xdebf('0xa'));var db=require(_0xdebf('0xb'))['db'];config[_0xdebf('0xc')]=_[_0xdebf('0xd')](config[_0xdebf('0xc')],{'host':_0xdebf('0xe'),'port':0x18eb});var socket=require(_0xdebf('0xf'))(new Redis(config[_0xdebf('0xc')]));var htmlEntities=require(_0xdebf('0x10'));require(_0xdebf('0x11'))['register'](socket);var jayson=require(_0xdebf('0x12'));var client=jayson['client'][_0xdebf('0x13')]({'port':0x232c});var client9003=jayson[_0xdebf('0x14')][_0xdebf('0x13')]({'port':0x232b});var client9002=jayson[_0xdebf('0x14')][_0xdebf('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x447cb4,_0x145ef1,_0x1a5640,_0xbfbd22){return new BPromise(function(_0x4d679a,_0xa61d42){var _0x4d24fd=_0xbfbd22||client;return _0x4d24fd[_0xdebf('0x15')](_0x447cb4,_0x1a5640)[_0xdebf('0x16')](function(_0x4d4bd1){logger['info'](_0xdebf('0x17'),_0x145ef1,_0xdebf('0x18'));logger[_0xdebf('0x19')](_0xdebf('0x1a'),_0x145ef1,_0xdebf('0x18'),JSON[_0xdebf('0x1b')](_0x4d4bd1));if(_0x4d4bd1['error']){if(_0x4d4bd1[_0xdebf('0x1c')][_0xdebf('0x1d')]===0x1f4){logger[_0xdebf('0x1c')](_0xdebf('0x17'),_0x145ef1,_0x4d4bd1[_0xdebf('0x1c')][_0xdebf('0x1e')]);return _0xa61d42(_0x4d4bd1[_0xdebf('0x1c')][_0xdebf('0x1e')]);}logger[_0xdebf('0x1c')]('MailMessage,\x20%s,\x20%s',_0x145ef1,_0x4d4bd1[_0xdebf('0x1c')]['message']);return _0x4d679a(_0x4d4bd1[_0xdebf('0x1c')][_0xdebf('0x1e')]);}else{logger[_0xdebf('0x1f')](_0xdebf('0x17'),_0x145ef1,_0xdebf('0x18'));_0x4d679a(_0x4d4bd1[_0xdebf('0x20')][_0xdebf('0x1e')]);}})[_0xdebf('0x21')](function(_0x56e51f){logger['error'](_0xdebf('0x17'),_0x145ef1,_0x56e51f);_0xa61d42(_0x56e51f);});});}function respondWithResult(_0x314980,_0x1715d4){_0x1715d4=_0x1715d4||0xc8;return function(_0x167339){if(_0x167339){return _0x314980[_0xdebf('0x22')](_0x1715d4)[_0xdebf('0x23')](_0x167339);}};}function respondWithFilteredResult(_0x28590c,_0x52596b){return function(_0x2c0a18){if(_0x2c0a18){var _0x30f828=typeof _0x52596b[_0xdebf('0x24')]===_0xdebf('0x25')&&typeof _0x52596b[_0xdebf('0x26')]===_0xdebf('0x25');var _0x1cfdd0=_0x2c0a18[_0xdebf('0x27')];var _0x102754=_0x30f828?0x0:_0x52596b['offset'];var _0x5e9dfe=_0x30f828?_0x2c0a18[_0xdebf('0x27')]:_0x52596b['offset']+_0x52596b['limit'];var _0x30c862;if(_0x5e9dfe>=_0x1cfdd0){_0x5e9dfe=_0x1cfdd0;_0x30c862=0xc8;}else{_0x30c862=0xce;}_0x28590c[_0xdebf('0x22')](_0x30c862);return _0x28590c[_0xdebf('0x28')]('Content-Range',_0x102754+'-'+_0x5e9dfe+'/'+_0x1cfdd0)[_0xdebf('0x23')](_0x2c0a18);}return null;};}function saveUpdates(_0x359de0){return function(_0x1693ca){if(_0x1693ca){return _0x1693ca[_0xdebf('0x29')](_0x359de0)[_0xdebf('0x16')](function(_0x3e6ffa){return _0x3e6ffa;});}return null;};}function removeEntity(_0x42dee7){return function(_0x224435){if(_0x224435){return _0x224435[_0xdebf('0x2a')]()[_0xdebf('0x16')](function(){_0x42dee7['status'](0xcc)[_0xdebf('0x2b')]();});}};}function handleEntityNotFound(_0x6d63f0){return function(_0x2a8bd6){if(!_0x2a8bd6){_0x6d63f0[_0xdebf('0x2c')](0x194);}return _0x2a8bd6;};}function handleError(_0x2d74ec,_0x296333){_0x296333=_0x296333||0x1f4;return function(_0x160805){logger[_0xdebf('0x1c')](_0x160805['stack']);if(_0x160805[_0xdebf('0x2d')]){delete _0x160805[_0xdebf('0x2d')];}_0x2d74ec[_0xdebf('0x22')](_0x296333)[_0xdebf('0x2e')](_0x160805);};}exports[_0xdebf('0x2f')]=function(_0x912b2f,_0x4a7419){var _0x44b223={},_0x5b57a9={},_0x4417bb={'count':0x0,'rows':[]};var _0xeb07ad=_[_0xdebf('0x30')](db[_0xdebf('0x31')][_0xdebf('0x32')],function(_0x1026cf){return{'name':_0x1026cf[_0xdebf('0x33')],'type':_0x1026cf[_0xdebf('0x34')][_0xdebf('0x35')]};});_0x5b57a9[_0xdebf('0x36')]=_[_0xdebf('0x30')](_0xeb07ad,_0xdebf('0x2d'));_0x5b57a9[_0xdebf('0x37')]=_[_0xdebf('0x38')](_0x912b2f[_0xdebf('0x37')]);_0x5b57a9[_0xdebf('0x39')]=_['intersection'](_0x5b57a9[_0xdebf('0x36')],_0x5b57a9[_0xdebf('0x37')]);_0x44b223[_0xdebf('0x3a')]=_[_0xdebf('0x3b')](_0x5b57a9[_0xdebf('0x36')],qs[_0xdebf('0x3c')](_0x912b2f['query'][_0xdebf('0x3c')]));_0x44b223[_0xdebf('0x3a')]=_0x44b223[_0xdebf('0x3a')]['length']?_0x44b223[_0xdebf('0x3a')]:_0x5b57a9[_0xdebf('0x36')];if(!_0x912b2f[_0xdebf('0x37')][_0xdebf('0x3d')](_0xdebf('0x3e'))){_0x44b223[_0xdebf('0x26')]=qs[_0xdebf('0x26')](_0x912b2f[_0xdebf('0x37')][_0xdebf('0x26')]);_0x44b223[_0xdebf('0x24')]=qs['offset'](_0x912b2f['query'][_0xdebf('0x24')]);}_0x44b223[_0xdebf('0x3f')]=qs[_0xdebf('0x40')](_0x912b2f['query']['sort']);_0x44b223[_0xdebf('0x41')]=qs[_0xdebf('0x39')](_['pick'](_0x912b2f['query'],_0x5b57a9[_0xdebf('0x39')]),_0xeb07ad);if(_0x912b2f['query'][_0xdebf('0x42')]){_0x44b223['where']=_['merge'](_0x44b223[_0xdebf('0x41')],{'$or':_[_0xdebf('0x30')](_0xeb07ad,function(_0x1b4fff){if(_0x1b4fff[_0xdebf('0x34')]!==_0xdebf('0x43')){var _0x5d7bbf={};_0x5d7bbf[_0x1b4fff[_0xdebf('0x2d')]]={'$like':'%'+_0x912b2f[_0xdebf('0x37')]['filter']+'%'};return _0x5d7bbf;}})});}_0x44b223=_[_0xdebf('0x44')]({},_0x44b223,_0x912b2f[_0xdebf('0x45')]);var _0x7db214={'where':_0x44b223[_0xdebf('0x41')]};return db[_0xdebf('0x31')][_0xdebf('0x27')](_0x7db214)[_0xdebf('0x16')](function(_0x2896b2){_0x4417bb[_0xdebf('0x27')]=_0x2896b2;if(_0x912b2f[_0xdebf('0x37')][_0xdebf('0x46')]){_0x44b223[_0xdebf('0x47')]=[{'all':!![]}];}return db[_0xdebf('0x31')]['findAll'](_0x44b223);})[_0xdebf('0x16')](function(_0x4679cc){_0x4417bb[_0xdebf('0x48')]=_0x4679cc;return _0x4417bb;})[_0xdebf('0x16')](respondWithFilteredResult(_0x4a7419,_0x44b223))[_0xdebf('0x21')](handleError(_0x4a7419,null));};exports[_0xdebf('0x49')]=function(_0x134038,_0xa44135){var _0x266c38={'raw':!![],'where':{'id':_0x134038[_0xdebf('0x4a')]['id']}},_0x3f50e4={};_0x3f50e4[_0xdebf('0x36')]=_[_0xdebf('0x38')](db['MailMessage'][_0xdebf('0x32')]);_0x3f50e4[_0xdebf('0x37')]=_[_0xdebf('0x38')](_0x134038[_0xdebf('0x37')]);_0x3f50e4[_0xdebf('0x39')]=_[_0xdebf('0x3b')](_0x3f50e4[_0xdebf('0x36')],_0x3f50e4[_0xdebf('0x37')]);_0x266c38[_0xdebf('0x3a')]=_[_0xdebf('0x3b')](_0x3f50e4['model'],qs[_0xdebf('0x3c')](_0x134038['query'][_0xdebf('0x3c')]));_0x266c38[_0xdebf('0x3a')]=_0x266c38[_0xdebf('0x3a')][_0xdebf('0x4b')]?_0x266c38[_0xdebf('0x3a')]:_0x3f50e4[_0xdebf('0x36')];if(_0x134038[_0xdebf('0x37')][_0xdebf('0x46')]){_0x266c38[_0xdebf('0x47')]=[{'all':!![]}];}_0x266c38=_[_0xdebf('0x44')]({},_0x266c38,_0x134038[_0xdebf('0x45')]);return db[_0xdebf('0x31')][_0xdebf('0x4c')](_0x266c38)[_0xdebf('0x16')](handleEntityNotFound(_0xa44135,null))[_0xdebf('0x16')](respondWithResult(_0xa44135,null))[_0xdebf('0x21')](handleError(_0xa44135,null));};exports['update']=function(_0x33ed86,_0x24ede3){if(_0x33ed86[_0xdebf('0x4d')]['id']){delete _0x33ed86[_0xdebf('0x4d')]['id'];}return db[_0xdebf('0x31')][_0xdebf('0x4c')]({'where':{'id':_0x33ed86[_0xdebf('0x4a')]['id']}})[_0xdebf('0x16')](handleEntityNotFound(_0x24ede3,null))[_0xdebf('0x16')](saveUpdates(_0x33ed86[_0xdebf('0x4d')],null))[_0xdebf('0x16')](respondWithResult(_0x24ede3,null))[_0xdebf('0x21')](handleError(_0x24ede3,null));};exports[_0xdebf('0x2a')]=function(_0x28dffe,_0x2ebae7){return db['MailMessage'][_0xdebf('0x4c')]({'where':{'id':_0x28dffe['params']['id']}})[_0xdebf('0x16')](handleEntityNotFound(_0x2ebae7,null))[_0xdebf('0x16')](removeEntity(_0x2ebae7,null))['catch'](handleError(_0x2ebae7,null));};exports[_0xdebf('0x4e')]=function(_0x1607c5,_0xfef3c3){return db['MailMessage'][_0xdebf('0x4e')]()[_0xdebf('0x16')](respondWithResult(_0xfef3c3,null))[_0xdebf('0x21')](handleError(_0xfef3c3,null));};exports['create']=function(_0x256c57,_0x5b11f2){return db['MailMessage'][_0xdebf('0x4f')](_0x256c57['body'])['then'](function(_0xc32ce){if(_0xc32ce){if(_0xc32ce[_0xdebf('0x50')]===_0xdebf('0x51')&&!_0xc32ce['secret']){var _0x5f568c,_0x300c1a,_0x572510;if(_0x256c57[_0xdebf('0x4d')]['to']){_0x300c1a=_0x256c57['body']['to'][_0xdebf('0x52')](',')[0x0];}return db[_0xdebf('0x53')]['findOne']({'where':{'id':_0xc32ce[_0xdebf('0x54')]},'include':[{'model':db[_0xdebf('0x55')],'as':_0xdebf('0x56'),'include':[{'model':db[_0xdebf('0x57')],'as':'Contacts','where':{'email':_0x300c1a},'limit':0x1,'order':[[_0xdebf('0x58'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xdebf('0x59')],'as':_0xdebf('0x59'),'raw':!![]}]}]})[_0xdebf('0x16')](function(_0x3ba75d){_0x5f568c=_0x3ba75d;if(!_0x5f568c||!_0x5f568c[_0xdebf('0x5a')])return;var _0x42fc0f=_0x5f568c[_0xdebf('0x5b')]();if(_0x256c57[_0xdebf('0x4d')]['attachments']&&_0x256c57['body'][_0xdebf('0x5c')]['length']){for(var _0x2fa563=0x0;_0x2fa563<_0x256c57[_0xdebf('0x4d')][_0xdebf('0x5c')][_0xdebf('0x4b')];_0x2fa563+=0x1){_0x256c57[_0xdebf('0x4d')][_0xdebf('0x5c')][_0x2fa563]={'filename':_0x256c57['body'][_0xdebf('0x5c')][_0x2fa563][_0xdebf('0x2d')],'path':path['join'](config[_0xdebf('0x5d')],_0xdebf('0x5e'),_0x256c57['body'][_0xdebf('0x5c')][_0x2fa563]['basename'])};}}_0x572510={'account':_0x42fc0f,'message':_0x256c57[_0xdebf('0x4d')]};return;})['then'](function(){if(_0x5f568c[_0xdebf('0x56')]){if(_0x5f568c['List'][_0xdebf('0x5f')][_0xdebf('0x4b')]){return _0x5f568c['List'][_0xdebf('0x5f')][0x0];}else{return db[_0xdebf('0x57')][_0xdebf('0x4f')](_[_0xdebf('0xd')](_0x256c57[_0xdebf('0x4d')],{'firstName':_0x256c57[_0xdebf('0x4d')]['to'],'email':_0x256c57[_0xdebf('0x4d')]['to'],'phone':_0x256c57[_0xdebf('0x4d')]['to'],'ListId':_0x5f568c[_0xdebf('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xdebf('0x16')](function(){if(_0x572510){return respondWithRpcPromise('SendMail',_0xdebf('0x61'),_0x572510,client9003)['then'](function(_0x41fb3e){return _0xc32ce['update']({'read':!![],'messageId':_0x41fb3e['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdebf('0x21')](function(_0x2bb029){logger[_0xdebf('0x1c')]('%s',JSON[_0xdebf('0x1b')](_0x2bb029));return _0xc32ce;});}return _0xc32ce;});}return _0xc32ce;}})['then'](respondWithResult(_0x5b11f2,0xc9))[_0xdebf('0x21')](handleError(_0x5b11f2,null));};exports['accept']=function(_0x2a8876,_0x31174c){var _0x4cad38={'agent':{},'channel':_0xdebf('0x62')};if(_0x2a8876['body']['id']){delete _0x2a8876[_0xdebf('0x4d')]['id'];}_0x2a8876['body'][_0xdebf('0x63')]=!![];_0x2a8876[_0xdebf('0x4d')][_0xdebf('0x64')]=moment()[_0xdebf('0x65')](_0xdebf('0x66'));_0x2a8876[_0xdebf('0x4d')]['UserId']=_0x2a8876['body'][_0xdebf('0x67')]||_0x2a8876[_0xdebf('0x68')]['id'];_0x4cad38[_0xdebf('0x69')]['id']=_0x2a8876[_0xdebf('0x4d')][_0xdebf('0x67')];return db['MailMessage'][_0xdebf('0x4c')]({'where':{'id':_0x2a8876[_0xdebf('0x4a')]['id'],'UserId':null}})[_0xdebf('0x16')](handleEntityNotFound(_0x31174c,null))[_0xdebf('0x16')](saveUpdates(_0x2a8876[_0xdebf('0x4d')],null))[_0xdebf('0x16')](function(_0x36f7fe){if(_0x36f7fe){_0x4cad38[_0xdebf('0x1e')]=_0x36f7fe[_0xdebf('0x6a')]({'plain':!![]});return db[_0xdebf('0x6b')][_0xdebf('0x4c')]({'where':{'id':_0x36f7fe[_0xdebf('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x31174c,null))[_0xdebf('0x16')](function(_0x2ddb30){if(_0x2ddb30){return _0x2ddb30[_0xdebf('0x29')]({'UserId':_0x2a8876[_0xdebf('0x4d')][_0xdebf('0x67')],'read1stAt':_['isNil'](_0x2ddb30[_0xdebf('0x6d')])?moment()['format'](_0xdebf('0x66')):undefined});}return null;})['then'](function(_0x4a3b86){if(_0x4a3b86){_0x4cad38['interaction']=_0x4a3b86['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a8876[_0xdebf('0x68')]['id'],_0x2a8876['user']['name'],_0x2a8876[_0xdebf('0x68')][_0xdebf('0x6e')],_0x4cad38[_0xdebf('0x6f')]['id'],_0x2a8876['body']?JSON[_0xdebf('0x1b')](_0x2a8876['body']):'null');return respondWithRpcPromise(_0xdebf('0x70'),_0xdebf('0x71'),_0x4cad38);}return null;})[_0xdebf('0x16')](function(_0x1bb8a7){var _0x2a2425=_0xdebf('0x72')+_0x1bb8a7[_0xdebf('0x1e')][_0xdebf('0x73')];return db[_0xdebf('0x74')][_0xdebf('0x37')](_0x2a2425,{'type':db[_0xdebf('0x75')][_0xdebf('0x76')][_0xdebf('0x77')],'raw':!![]})[_0xdebf('0x16')](function(_0x37ada0){return _0x37ada0;});})[_0xdebf('0x16')](function(_0x15448b){if(_0x15448b){_0x4cad38['message'][_0xdebf('0x78')]=_0x15448b[0x0];if(!_0x2a8876['body'][_0xdebf('0x67')])return;return db[_0xdebf('0x79')][_0xdebf('0x4c')]({'where':{'id':_0x2a8876[_0xdebf('0x4d')]['UserId'],'role':'agent'},'attributes':['id',_0xdebf('0x2d'),_0xdebf('0x7a'),_0xdebf('0x7b'),'internal'],'raw':!![]});}return null;})[_0xdebf('0x16')](function(_0x500984){if(!_0x500984)return null;_0x4cad38[_0xdebf('0x1e')][_0xdebf('0x69')]=_0x500984;return _0x4cad38;})[_0xdebf('0x16')](function(_0x2805f9){if(_0x2805f9){if(_0x2a8876[_0xdebf('0x4d')]['manual']){_0x4cad38['message'][_0xdebf('0x7c')]=util[_0xdebf('0x65')]('SIP/%s',_0x2a8876[_0xdebf('0x68')][_0xdebf('0x2d')]);_0x4cad38[_0xdebf('0x1e')][_0xdebf('0x7d')]=_0x4cad38['channel'];_0x4cad38[_0xdebf('0x1e')][_0xdebf('0x7e')]=_0x4cad38[_0xdebf('0x7d')];_0x4cad38['message'][_0xdebf('0x7f')]=_0xdebf('0x80');_0x4cad38[_0xdebf('0x1e')][_0xdebf('0x4d')]=htmlToText[_0xdebf('0x81')](_0x4cad38[_0xdebf('0x1e')]['body']);return respondWithRpcPromise('EventManager',_0xdebf('0x82'),{'event':_0xdebf('0x83'),'message':_0x4cad38['message']},client9002)[_0xdebf('0x16')](function(){return _0x4cad38;});}return _0x4cad38;}return null;})[_0xdebf('0x16')](respondWithResult(_0x31174c,null))['catch'](handleError(_0x31174c,null));};exports[_0xdebf('0x84')]=function(_0x4bd960,_0x2c2974){var _0xbcd0ad={'agent':{},'channel':_0xdebf('0x62')};if(_0x4bd960[_0xdebf('0x4d')]['id']){delete _0x4bd960['body']['id'];}_0x4bd960[_0xdebf('0x4d')][_0xdebf('0x67')]=_0x4bd960[_0xdebf('0x4d')][_0xdebf('0x67')]||_0x4bd960[_0xdebf('0x68')]['id'];_0xbcd0ad[_0xdebf('0x69')]['id']=_0x4bd960[_0xdebf('0x4d')][_0xdebf('0x67')];return db[_0xdebf('0x31')][_0xdebf('0x4c')]({'where':{'id':_0x4bd960[_0xdebf('0x4a')]['id'],'UserId':null}})[_0xdebf('0x16')](handleEntityNotFound(_0x2c2974,null))['then'](function(_0x294abd){if(_0x294abd){_0xbcd0ad['message']=_0x294abd[_0xdebf('0x6a')]({'plain':!![]});return db['MailInteraction'][_0xdebf('0x4c')]({'where':{'id':_0x294abd['MailInteractionId']}});}return null;})[_0xdebf('0x16')](handleEntityNotFound(_0x2c2974,null))['then'](function(_0x187c8e){if(_0x187c8e){_0xbcd0ad[_0xdebf('0x6f')]=_0x187c8e['get']({'plain':!![]});interaction_log[_0xdebf('0x1f')](_0xdebf('0x85'),_0x4bd960[_0xdebf('0x68')]['id'],_0x4bd960['user'][_0xdebf('0x2d')],_0x4bd960['user'][_0xdebf('0x6e')],_0xbcd0ad[_0xdebf('0x6f')]['id'],_0x4bd960['body']?JSON[_0xdebf('0x1b')](_0x4bd960[_0xdebf('0x4d')]):_0xdebf('0x86'));return respondWithRpcPromise('RejectMessage',_0xdebf('0x87'),_0xbcd0ad);}return null;})[_0xdebf('0x16')](function(_0x238809){var _0xea0ac=_0xdebf('0x72')+_0x238809[_0xdebf('0x1e')]['ContactId'];return db['sequelize'][_0xdebf('0x37')](_0xea0ac,{'type':db[_0xdebf('0x75')]['QueryTypes'][_0xdebf('0x77')],'raw':!![]})[_0xdebf('0x16')](function(_0xa0b21b){return _0xa0b21b;});})[_0xdebf('0x16')](function(_0x1f1861){if(_0x1f1861){_0xbcd0ad['message'][_0xdebf('0x78')]=_0x1f1861[0x0];if(!_0x4bd960['body'][_0xdebf('0x67')])return;return db[_0xdebf('0x79')][_0xdebf('0x4c')]({'where':{'id':_0x4bd960['body'][_0xdebf('0x67')],'role':_0xdebf('0x69')},'attributes':['id',_0xdebf('0x2d'),_0xdebf('0x7a'),_0xdebf('0x7b'),_0xdebf('0x88')],'raw':!![]});}return null;})[_0xdebf('0x16')](function(_0x3598de){if(!_0x3598de)return null;_0xbcd0ad['message']['agent']=_0x3598de;return _0xbcd0ad;})[_0xdebf('0x16')](function(_0x37c860){if(_0x37c860){_0x37c860['message'][_0xdebf('0x7c')]=util['format'](_0xdebf('0x89'),_0x4bd960['user']['name']);_0x37c860[_0xdebf('0x1e')][_0xdebf('0x7d')]=_0xbcd0ad[_0xdebf('0x7d')];_0x37c860[_0xdebf('0x1e')][_0xdebf('0x7e')]=_0xbcd0ad[_0xdebf('0x7d')];_0x37c860['message'][_0xdebf('0x7f')]='reject';_0x37c860[_0xdebf('0x1e')][_0xdebf('0x4d')]=htmlToText[_0xdebf('0x81')](_0xbcd0ad[_0xdebf('0x1e')][_0xdebf('0x4d')]);respondWithRpcPromise('EventManager',_0xdebf('0x82'),{'event':'rejectmessage','message':_0x37c860[_0xdebf('0x1e')]},client9002);return _0xbcd0ad;}return null;})['then'](respondWithResult(_0x2c2974,null))[_0xdebf('0x21')](handleError(_0x2c2974,null));};exports[_0xdebf('0x8a')]=function(_0x1c66e6,_0x565b10){var _0x55d60e=moment()['unix']()[_0xdebf('0x8b')]();var _0x643e6c=path[_0xdebf('0x8c')](config[_0xdebf('0x5d')],_0xdebf('0x8d'),_0xdebf('0x8e'),_0xdebf('0x8f'));var _0x5c1cb2=path['join'](config['root'],_0xdebf('0x8d'),_0xdebf('0x8e'),_0xdebf('0x5c'));var _0x3ac0ec=util[_0xdebf('0x65')](_0xdebf('0x90'),_0x55d60e);return db[_0xdebf('0x31')]['find']({'where':{'id':_0x1c66e6[_0xdebf('0x4a')]['id']},'attributes':['id',_0xdebf('0x4d'),_0xdebf('0x91'),'to','cc',_0xdebf('0x92'),'subject',_0xdebf('0x93')],'include':_0x1c66e6[_0xdebf('0x37')][_0xdebf('0x5c')]?[{'model':db[_0xdebf('0x94')],'as':_0xdebf('0x95')}]:undefined})['then'](handleEntityNotFound(_0x565b10,null))[_0xdebf('0x16')](function(_0x35ca50){if(_0x35ca50){var _0xeb25ca=_0x35ca50;var _0x1924bc={'from':_0xeb25ca[_0xdebf('0x91')],'to':_0xeb25ca['to'],'subject':_0xeb25ca[_0xdebf('0x96')],'html':htmlEntities[_0xdebf('0x97')](_0xeb25ca[_0xdebf('0x4d')]),'headers':{'Date':moment(_0xeb25ca[_0xdebf('0x93')])[_0xdebf('0x65')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x35ca50['cc']){_0x1924bc['headers']['Cc']=_0x35ca50['cc'];}if(_0x35ca50[_0xdebf('0x92')]){_0x1924bc[_0xdebf('0x98')][_0xdebf('0x99')]=_0x35ca50[_0xdebf('0x92')];}return new BPromise(function(_0x1b0a9f,_0x507c2a){if(_0x35ca50['Attachments']){for(var _0x3782df=0x0;_0x3782df<_0x35ca50['Attachments'][_0xdebf('0x4b')];_0x3782df++){var _0x4921e5=_0x35ca50['Attachments'][_0x3782df];var _0x35d3e9=path[_0xdebf('0x8c')](_0x5c1cb2,_0x4921e5[_0xdebf('0x9a')]);if(fs[_0xdebf('0x9b')](_0x35d3e9)){_0x1924bc[_0xdebf('0x5c')][_0xdebf('0x9c')]({'name':_0x4921e5[_0xdebf('0x2d')],'contentType':_0x4921e5['type'],'data':fs[_0xdebf('0x9d')](_0x35d3e9)});}}}emlformat['build'](_0x1924bc,function(_0x26f184,_0x2af05d){if(_0x26f184)return _0x507c2a(_0x26f184);fs[_0xdebf('0x9e')](path['join'](_0x643e6c,_0x3ac0ec),_0x2af05d);return _0x1b0a9f(_0x2af05d);});});}})[_0xdebf('0x16')](function(_0x481ccf){if(_0x481ccf){return _0x565b10[_0xdebf('0x8a')](path[_0xdebf('0x8c')](_0x643e6c,_0x3ac0ec),_0x3ac0ec,function(_0x426bbe){if(!_0x426bbe)fs[_0xdebf('0x9f')](path[_0xdebf('0x8c')](_0x643e6c,_0x3ac0ec));});}})[_0xdebf('0x21')](handleError(_0x565b10,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 561d2a4..862612d 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 _0xf091=['remove','emit','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3d8778,_0x1fa476){var _0x2cdc24=function(_0x4d2c2b){while(--_0x4d2c2b){_0x3d8778['push'](_0x3d8778['shift']());}};_0x2cdc24(++_0x1fa476);}(_0xf091,0x1b3));var _0x1f09=function(_0x1815e5,_0x58fc74){_0x1815e5=_0x1815e5-0x0;var _0x2d212b=_0xf091[_0x1815e5];return _0x2d212b;};'use strict';var EventEmitter=require(_0x1f09('0x0'));var MailMessage=require(_0x1f09('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1f09('0x2')](0x0);var events={'afterCreate':_0x1f09('0x3'),'afterUpdate':_0x1f09('0x4'),'afterDestroy':_0x1f09('0x5')};function emitEvent(_0x704889){return function(_0x47d934,_0x49b889,_0x34746d){MailMessageEvents['emit'](_0x704889+':'+_0x47d934['id'],_0x47d934);MailMessageEvents[_0x1f09('0x6')](_0x704889,_0x47d934);_0x34746d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1f09('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x5020=['hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5020,0xaa));var _0x0502=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5020[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0x0502('0x0'));var MailMessage=require(_0x0502('0x1'))['db'][_0x0502('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0502('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0502('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4dca81){return function(_0x52b006,_0x5f232e,_0x5cdb17){MailMessageEvents[_0x0502('0x5')](_0x4dca81+':'+_0x52b006['id'],_0x52b006);MailMessageEvents[_0x0502('0x5')](_0x4dca81,_0x52b006);_0x5cdb17(null);};}for(var e in events){if(events[_0x0502('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x0502('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9021c05..971841d 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 _0x1836=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','toLowerCase','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','direction','catch','error','utf8mb4'];(function(_0x4b7bad,_0x135acf){var _0x4da111=function(_0x28650c){while(--_0x28650c){_0x4b7bad['push'](_0x4b7bad['shift']());}};_0x4da111(++_0x135acf);}(_0x1836,0x1ae));var _0x6183=function(_0x26573c,_0x75f467){_0x26573c=_0x26573c-0x0;var _0x175f6e=_0x1836[_0x26573c];return _0x175f6e;};'use strict';var _=require(_0x6183('0x0'));var util=require(_0x6183('0x1'));var logger=require(_0x6183('0x2'))('api');var moment=require(_0x6183('0x3'));var BPromise=require(_0x6183('0x4'));var rp=require(_0x6183('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x6183('0x6'));var rimraf=require('rimraf');var config=require(_0x6183('0x7'));var attributes=require(_0x6183('0x8'));module[_0x6183('0x9')]=function(_0x3703e8,_0x2bed83){return _0x3703e8[_0x6183('0xa')](_0x6183('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6183('0xc'),'fields':[_0x6183('0xc')]},{'name':_0x6183('0xd'),'fields':[_0x6183('0xe'),_0x6183('0xf')],'type':_0x6183('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x228c22,_0x29f806,_0x5506f8){if(_0x228c22[_0x6183('0x11')]){_0x228c22[_0x6183('0xe')]=htmlToText[_0x6183('0x12')](_0x228c22[_0x6183('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5506f8(null,_0x29f806);},'afterCreate':function(_0x12488b,_0x9bc124,_0x593471){var _0x194631=_0x3703e8['models'];var _0x35fe49=_0x12488b['get']({'plain':!![]});if(_0x35fe49['direction'][_0x6183('0x13')]()==='in'||_0x35fe49['direction'][_0x6183('0x13')]()==='out'&&!_0x35fe49[_0x6183('0x14')]&&!_[_0x6183('0x15')](_0x35fe49[_0x6183('0x16')])){_0x194631[_0x6183('0x17')]['findOne']({'where':{'id':_0x35fe49[_0x6183('0x18')]}})[_0x6183('0x19')](function(_0xa411a5){if(_0xa411a5){_0xa411a5[_0x6183('0x1a')]({'lastMsgAt':_0x35fe49[_0x6183('0x1b')],'lastMsgDirection':_0x35fe49[_0x6183('0x1c')][_0x6183('0x13')]()});}})[_0x6183('0x1d')](function(_0x21fa1f){console[_0x6183('0x1e')](_0x21fa1f);});}_0x593471();}},'charset':_0x6183('0x1f'),'collate':_0x6183('0x20')});}; \ No newline at end of file +var _0xa61e=['catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt'];(function(_0x464efa,_0x130e41){var _0x54c772=function(_0x643bfd){while(--_0x643bfd){_0x464efa['push'](_0x464efa['shift']());}};_0x54c772(++_0x130e41);}(_0xa61e,0x19b));var _0xea61=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa61e[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xea61('0x0'));var util=require(_0xea61('0x1'));var logger=require(_0xea61('0x2'))(_0xea61('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea61('0x4'));var htmlToText=require(_0xea61('0x5'));var fs=require('fs');var path=require(_0xea61('0x6'));var rimraf=require(_0xea61('0x7'));var config=require('../../config/environment');var attributes=require(_0xea61('0x8'));module[_0xea61('0x9')]=function(_0x23b077,_0x5779d7){return _0x23b077[_0xea61('0xa')](_0xea61('0xb'),attributes,{'tableName':_0xea61('0xc'),'paranoid':![],'indexes':[{'name':_0xea61('0xd'),'fields':[_0xea61('0xd')]},{'name':_0xea61('0xe'),'fields':[_0xea61('0xf'),'subject'],'type':_0xea61('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5c7571,_0x2ad807,_0x10e2a2){if(_0x5c7571[_0xea61('0x11')]){_0x5c7571[_0xea61('0xf')]=htmlToText['fromString'](_0x5c7571[_0xea61('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x10e2a2(null,_0x2ad807);},'afterCreate':function(_0x4e7dc0,_0x514dfe,_0x2e6100){var _0x1a5e0b=_0x23b077[_0xea61('0x12')];var _0x400ea7=_0x4e7dc0[_0xea61('0x13')]({'plain':!![]});if(_0x400ea7['direction'][_0xea61('0x14')]()==='in'||_0x400ea7[_0xea61('0x15')]['toLowerCase']()===_0xea61('0x16')&&!_0x400ea7[_0xea61('0x17')]&&!_[_0xea61('0x18')](_0x400ea7[_0xea61('0x19')])){_0x1a5e0b[_0xea61('0x1a')]['findOne']({'where':{'id':_0x400ea7[_0xea61('0x1b')]}})[_0xea61('0x1c')](function(_0x2a3f0f){if(_0x2a3f0f){_0x2a3f0f[_0xea61('0x1d')]({'lastMsgAt':_0x400ea7[_0xea61('0x1e')],'lastMsgDirection':_0x400ea7[_0xea61('0x15')][_0xea61('0x14')]()});}})[_0xea61('0x1f')](function(_0x6e37ee){console[_0xea61('0x20')](_0x6e37ee);});}_0x2e6100();}},'charset':'utf8mb4','collate':_0xea61('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 0982b24..0122819 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 _0x6a95=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailMessage,\x20%s,\x20%s','debug'];(function(_0x3a802d,_0x119cfc){var _0x2fd218=function(_0x46bb78){while(--_0x46bb78){_0x3a802d['push'](_0x3a802d['shift']());}};_0x2fd218(++_0x119cfc);}(_0x6a95,0x1db));var _0x56a9=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x6a95[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./mailMessage.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['MailMessage'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x56a9('0x11')](function(_0x3355c4){logger[_0x56a9('0x20')](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x3355c4));_0x62f79f(_0x3355c4);})[_0x56a9('0x1b')](function(_0xd029f7){logger[_0x56a9('0x17')]('CreateMailMessage',_0xd029f7[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0xd029f7[_0x56a9('0x19')]));});});}; \ No newline at end of file +var _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify'];(function(_0x485342,_0xe19f6f){var _0x54e30c=function(_0x5048a7){while(--_0x5048a7){_0x485342['push'](_0x485342['shift']());}};_0x54e30c(++_0xe19f6f);}(_0x66fa,0x117));var _0xa66f=function(_0x90c7cc,_0x3a99f4){_0x90c7cc=_0x90c7cc-0x0;var _0x272017=_0x66fa[_0x90c7cc];return _0x272017;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateMailMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateMailMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 6259871..cef2359 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 _0x2608=['length','./mailMessage.events','remove','update','register'];(function(_0x4679b6,_0x4d50b8){var _0x647869=function(_0x468717){while(--_0x468717){_0x4679b6['push'](_0x4679b6['shift']());}};_0x647869(++_0x4d50b8);}(_0x2608,0x1c8));var _0x8260=function(_0x174635,_0x2ea064){_0x174635=_0x174635-0x0;var _0x3fb4ab=_0x2608[_0x174635];return _0x3fb4ab;};'use strict';var MailMessageEvents=require(_0x8260('0x0'));var events=['save',_0x8260('0x1'),_0x8260('0x2')];function createListener(_0x649ff7,_0x4d1712){return function(_0x43294a){_0x4d1712['emit'](_0x649ff7,_0x43294a);};}function removeListener(_0x147695,_0x265ab4){return function(){MailMessageEvents['removeListener'](_0x147695,_0x265ab4);};}exports[_0x8260('0x3')]=function(_0x215b03){for(var _0x1cfd83=0x0,_0x2541e7=events[_0x8260('0x4')];_0x1cfd83<_0x2541e7;_0x1cfd83++){var _0x45954d=events[_0x1cfd83];var _0x491e4b=createListener('mailMessage:'+_0x45954d,_0x215b03);MailMessageEvents['on'](_0x45954d,_0x491e4b);}}; \ No newline at end of file +var _0xa181=['./mailMessage.events','save','remove','emit','register','length','mailMessage:'];(function(_0x28c752,_0x238454){var _0x30cd6c=function(_0x4c71be){while(--_0x4c71be){_0x28c752['push'](_0x28c752['shift']());}};_0x30cd6c(++_0x238454);}(_0xa181,0x10a));var _0x1a18=function(_0x52bb46,_0x1e8f5b){_0x52bb46=_0x52bb46-0x0;var _0x2303f6=_0xa181[_0x52bb46];return _0x2303f6;};'use strict';var MailMessageEvents=require(_0x1a18('0x0'));var events=[_0x1a18('0x1'),_0x1a18('0x2'),'update'];function createListener(_0x1bba3e,_0x373cdc){return function(_0x1053df){_0x373cdc[_0x1a18('0x3')](_0x1bba3e,_0x1053df);};}function removeListener(_0x3dd01c,_0x43c009){return function(){MailMessageEvents['removeListener'](_0x3dd01c,_0x43c009);};}exports[_0x1a18('0x4')]=function(_0x501ea2){for(var _0x246a4e=0x0,_0x33ac27=events[_0x1a18('0x5')];_0x246a4e<_0x33ac27;_0x246a4e++){var _0x436a14=events[_0x246a4e];var _0x49e0ab=createListener(_0x1a18('0x6')+_0x436a14,_0x501ea2);MailMessageEvents['on'](_0x436a14,_0x49e0ab);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 1e7ecfa..40f8a10 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 _0x07d0=['../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x07d0,0xd2));var _0x007d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x07d0[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x007d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x007d('0x1'));var express=require(_0x007d('0x2'));var router=express[_0x007d('0x3')]();var fs_extra=require(_0x007d('0x4'));var auth=require(_0x007d('0x5'));var interaction=require(_0x007d('0x6'));var config=require(_0x007d('0x7'));var controller=require(_0x007d('0x8'));router[_0x007d('0x9')]('/',auth['isAuthenticated'](),controller[_0x007d('0xa')]);router[_0x007d('0x9')](_0x007d('0xb'),auth[_0x007d('0xc')](),controller[_0x007d('0xd')]);router[_0x007d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x007d('0xe')]);router[_0x007d('0x9')](_0x007d('0xf'),auth[_0x007d('0xc')](),controller[_0x007d('0x10')]);router[_0x007d('0x9')](_0x007d('0x11'),auth['isAuthenticated'](),controller[_0x007d('0x12')]);router['get'](_0x007d('0x13'),auth[_0x007d('0xc')](),controller[_0x007d('0x14')]);router[_0x007d('0x15')]('/',auth[_0x007d('0xc')](),controller['create']);router[_0x007d('0x15')](_0x007d('0x11'),auth['isAuthenticated'](),controller[_0x007d('0x16')]);router[_0x007d('0x15')](_0x007d('0x13'),auth[_0x007d('0xc')](),controller[_0x007d('0x17')]);router[_0x007d('0x18')](_0x007d('0x19'),auth[_0x007d('0xc')](),controller[_0x007d('0x1a')]);router[_0x007d('0x1b')](_0x007d('0x19'),auth[_0x007d('0xc')](),controller[_0x007d('0x1c')]);router[_0x007d('0x1b')](_0x007d('0x11'),auth[_0x007d('0xc')](),controller[_0x007d('0x1d')]);router['delete'](_0x007d('0x13'),auth[_0x007d('0xc')](),controller['removeAgents']);module[_0x007d('0x1e')]=router; \ No newline at end of file +var _0x97b3=['/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','removeTeams','removeAgents','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get'];(function(_0x46b273,_0x3b016f){var _0x12445e=function(_0x220773){while(--_0x220773){_0x46b273['push'](_0x46b273['shift']());}};_0x12445e(++_0x3b016f);}(_0x97b3,0x79));var _0x397b=function(_0x38495b,_0x11e1e2){_0x38495b=_0x38495b-0x0;var _0x529cd6=_0x97b3[_0x38495b];return _0x529cd6;};'use strict';var multer=require(_0x397b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x397b('0x1'));var router=express['Router']();var fs_extra=require(_0x397b('0x2'));var auth=require(_0x397b('0x3'));var interaction=require(_0x397b('0x4'));var config=require('../../config/environment');var controller=require(_0x397b('0x5'));router['get']('/',auth[_0x397b('0x6')](),controller[_0x397b('0x7')]);router[_0x397b('0x8')](_0x397b('0x9'),auth[_0x397b('0x6')](),controller[_0x397b('0xa')]);router[_0x397b('0x8')]('/:id',auth[_0x397b('0x6')](),controller[_0x397b('0xb')]);router['get'](_0x397b('0xc'),auth['isAuthenticated'](),controller[_0x397b('0xd')]);router[_0x397b('0x8')](_0x397b('0xe'),auth[_0x397b('0x6')](),controller['getTeams']);router[_0x397b('0x8')](_0x397b('0xf'),auth[_0x397b('0x6')](),controller[_0x397b('0x10')]);router[_0x397b('0x11')]('/',auth[_0x397b('0x6')](),controller['create']);router['post']('/:id/teams',auth[_0x397b('0x6')](),controller[_0x397b('0x12')]);router[_0x397b('0x11')](_0x397b('0xf'),auth[_0x397b('0x6')](),controller[_0x397b('0x13')]);router[_0x397b('0x14')](_0x397b('0x15'),auth[_0x397b('0x6')](),controller['update']);router[_0x397b('0x16')](_0x397b('0x15'),auth[_0x397b('0x6')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x397b('0x17')]);router[_0x397b('0x16')](_0x397b('0xf'),auth[_0x397b('0x6')](),controller[_0x397b('0x18')]);module[_0x397b('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index cceb9cf..4c72b48 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 _0x7841=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x39c895,_0x560502){var _0x440998=function(_0xd1198c){while(--_0xd1198c){_0x39c895['push'](_0x39c895['shift']());}};_0x440998(++_0x560502);}(_0x7841,0x13b));var _0x1784=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0x7841[_0x295583];return _0x4c2ae6;};'use strict';var Sequelize=require(_0x1784('0x0'));module[_0x1784('0x1')]={'name':{'type':Sequelize[_0x1784('0x2')],'unique':_0x1784('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1784('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1784('0x5'),'beepall',_0x1784('0x6'))}}; \ No newline at end of file +var _0x9937=['INTEGER','rrmemory','roundrobin','exports','STRING','name'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x9937,0x135));var _0x7993=function(_0x287f06,_0x151336){_0x287f06=_0x287f06-0x0;var _0x2f94a8=_0x9937[_0x287f06];return _0x2f94a8;};'use strict';var Sequelize=require('sequelize');module[_0x7993('0x0')]={'name':{'type':Sequelize[_0x7993('0x1')],'unique':_0x7993('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7993('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7993('0x4'),'beepall',_0x7993('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7be947e..04621da 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 _0xfb00=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','sort','UserId','mailPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','key','query','filters'];(function(_0x5f442c,_0x1b1f0c){var _0x4efe84=function(_0x3df02f){while(--_0x3df02f){_0x5f442c['push'](_0x5f442c['shift']());}};_0x4efe84(++_0x1b1f0c);}(_0xfb00,0x167));var _0x0fb0=function(_0x214e65,_0xf94da6){_0x214e65=_0x214e65-0x0;var _0x4dd397=_0xfb00[_0x214e65];return _0x4dd397;};'use strict';var emlformat=require(_0x0fb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fb0('0x1'));var jsonpatch=require(_0x0fb0('0x2'));var rp=require(_0x0fb0('0x3'));var moment=require(_0x0fb0('0x4'));var BPromise=require(_0x0fb0('0x5'));var Mustache=require(_0x0fb0('0x6'));var util=require('util');var path=require(_0x0fb0('0x7'));var sox=require(_0x0fb0('0x8'));var csv=require('to-csv');var ejs=require(_0x0fb0('0x9'));var fs=require('fs');var fs_extra=require(_0x0fb0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fb0('0xb'));var toCsv=require(_0x0fb0('0xc'));var querystring=require('querystring');var Papa=require(_0x0fb0('0xd'));var Redis=require(_0x0fb0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0fb0('0xf'));var hardwareService=require(_0x0fb0('0x10'));var logger=require(_0x0fb0('0x11'))(_0x0fb0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fb0('0x13'))['db'];config[_0x0fb0('0x14')]=_[_0x0fb0('0x15')](config[_0x0fb0('0x14')],{'host':_0x0fb0('0x16'),'port':0x18eb});var socket=require(_0x0fb0('0x17'))(new Redis(config['redis']));require(_0x0fb0('0x18'))[_0x0fb0('0x19')](socket);function respondWithStatusCode(_0x152bd8,_0x210a73){_0x210a73=_0x210a73||0xcc;return function(_0x156ba2){if(_0x156ba2){return _0x152bd8[_0x0fb0('0x1a')](_0x210a73);}return _0x152bd8[_0x0fb0('0x1b')](_0x210a73)[_0x0fb0('0x1c')]();};}function respondWithResult(_0x3a0248,_0x4747e9){_0x4747e9=_0x4747e9||0xc8;return function(_0x2febef){if(_0x2febef){return _0x3a0248['status'](_0x4747e9)[_0x0fb0('0x1d')](_0x2febef);}};}function respondWithFilteredResult(_0x158397,_0x11c529){return function(_0x2d911a){if(_0x2d911a){var _0x266334=typeof _0x11c529[_0x0fb0('0x1e')]===_0x0fb0('0x1f')&&typeof _0x11c529['limit']===_0x0fb0('0x1f');var _0x55512e=_0x2d911a[_0x0fb0('0x20')];var _0x352587=_0x266334?0x0:_0x11c529[_0x0fb0('0x1e')];var _0x48a360=_0x266334?_0x2d911a['count']:_0x11c529[_0x0fb0('0x1e')]+_0x11c529[_0x0fb0('0x21')];var _0x50f93d;if(_0x48a360>=_0x55512e){_0x48a360=_0x55512e;_0x50f93d=0xc8;}else{_0x50f93d=0xce;}_0x158397[_0x0fb0('0x1b')](_0x50f93d);return _0x158397[_0x0fb0('0x22')](_0x0fb0('0x23'),_0x352587+'-'+_0x48a360+'/'+_0x55512e)[_0x0fb0('0x1d')](_0x2d911a);}return null;};}function patchUpdates(_0x1ac214){return function(_0x8980c){try{jsonpatch[_0x0fb0('0x24')](_0x8980c,_0x1ac214,!![]);}catch(_0x8358ef){return BPromise[_0x0fb0('0x25')](_0x8358ef);}return _0x8980c[_0x0fb0('0x26')]();};}function saveUpdates(_0x47994a,_0x3b2e0a){return function(_0x222081){if(_0x222081){return _0x222081[_0x0fb0('0x27')](_0x47994a)[_0x0fb0('0x28')](function(_0x25f4cd){return _0x25f4cd;});}return null;};}function removeEntity(_0x2ec1f7,_0xed5a56){return function(_0x29e849){if(_0x29e849){return _0x29e849[_0x0fb0('0x29')]()['then'](function(){var _0x21cb89=_0x29e849['get']({'plain':!![]});var _0xa2619a=_0x0fb0('0x2a');return db[_0x0fb0('0x2b')][_0x0fb0('0x29')]({'where':{'type':_0xa2619a,'resourceId':_0x21cb89['id']}})[_0x0fb0('0x28')](function(){return _0x29e849;});})[_0x0fb0('0x28')](function(){_0x2ec1f7['status'](0xcc)[_0x0fb0('0x1c')]();});}};}function handleEntityNotFound(_0x2a5873,_0xd3caf1){return function(_0x21a76d){if(!_0x21a76d){_0x2a5873[_0x0fb0('0x1a')](0x194);}return _0x21a76d;};}function handleError(_0x49b493,_0x496982){_0x496982=_0x496982||0x1f4;return function(_0x5f0b44){logger[_0x0fb0('0x2c')](_0x5f0b44[_0x0fb0('0x2d')]);if(_0x5f0b44[_0x0fb0('0x2e')]){delete _0x5f0b44[_0x0fb0('0x2e')];}_0x49b493['status'](_0x496982)['send'](_0x5f0b44);};}exports[_0x0fb0('0x2f')]=function(_0xa2714c,_0x3e8fd5){var _0x5dc42b={},_0xff2b9a={},_0x1ed651={'count':0x0,'rows':[]};var _0xca48f8=_['map'](db[_0x0fb0('0x30')][_0x0fb0('0x31')],function(_0x43d61d){return{'name':_0x43d61d[_0x0fb0('0x32')],'type':_0x43d61d[_0x0fb0('0x33')][_0x0fb0('0x34')]};});_0xff2b9a['model']=_['map'](_0xca48f8,'name');_0xff2b9a[_0x0fb0('0x35')]=_['keys'](_0xa2714c['query']);_0xff2b9a[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0xff2b9a[_0x0fb0('0x38')],_0xff2b9a['query']);_0x5dc42b[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0xff2b9a[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5dc42b['attributes']=_0x5dc42b[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x5dc42b[_0x0fb0('0x39')]:_0xff2b9a[_0x0fb0('0x38')];if(!_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x3c')](_0x0fb0('0x3d'))){_0x5dc42b[_0x0fb0('0x21')]=qs['limit'](_0xa2714c['query'][_0x0fb0('0x21')]);_0x5dc42b[_0x0fb0('0x1e')]=qs[_0x0fb0('0x1e')](_0xa2714c['query'][_0x0fb0('0x1e')]);}_0x5dc42b[_0x0fb0('0x3e')]=qs['sort'](_0xa2714c[_0x0fb0('0x35')]['sort']);_0x5dc42b[_0x0fb0('0x3f')]=qs[_0x0fb0('0x36')](_[_0x0fb0('0x40')](_0xa2714c[_0x0fb0('0x35')],_0xff2b9a[_0x0fb0('0x36')]),_0xca48f8);if(_0xa2714c['query'][_0x0fb0('0x41')]){_0x5dc42b['where']=_[_0x0fb0('0x42')](_0x5dc42b[_0x0fb0('0x3f')],{'$or':_[_0x0fb0('0x43')](_0xca48f8,function(_0x57461c){if(_0x57461c[_0x0fb0('0x33')]!==_0x0fb0('0x44')){var _0x3e102f={};_0x3e102f[_0x57461c[_0x0fb0('0x2e')]]={'$like':'%'+_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x41')]+'%'};return _0x3e102f;}})});}_0x5dc42b=_[_0x0fb0('0x42')]({},_0x5dc42b,_0xa2714c[_0x0fb0('0x45')]);var _0x4bf6df={'where':_0x5dc42b['where']};return db[_0x0fb0('0x30')][_0x0fb0('0x20')](_0x4bf6df)['then'](function(_0x430e53){_0x1ed651['count']=_0x430e53;if(_0xa2714c[_0x0fb0('0x35')]['includeAll']){_0x5dc42b[_0x0fb0('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x0fb0('0x47')](_0x5dc42b);})[_0x0fb0('0x28')](function(_0x10680a){_0x1ed651['rows']=_0x10680a;return _0x1ed651;})[_0x0fb0('0x28')](respondWithFilteredResult(_0x3e8fd5,_0x5dc42b))[_0x0fb0('0x48')](handleError(_0x3e8fd5,null));};exports[_0x0fb0('0x49')]=function(_0x757b7d,_0x26ea0c){var _0x5553d2={'raw':!![],'where':{'id':_0x757b7d[_0x0fb0('0x4a')]['id']}},_0x1ae094={};_0x1ae094[_0x0fb0('0x38')]=_[_0x0fb0('0x4b')](db[_0x0fb0('0x30')][_0x0fb0('0x31')]);_0x1ae094[_0x0fb0('0x35')]=_['keys'](_0x757b7d[_0x0fb0('0x35')]);_0x1ae094['filters']=_[_0x0fb0('0x37')](_0x1ae094[_0x0fb0('0x38')],_0x1ae094[_0x0fb0('0x35')]);_0x5553d2[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0x1ae094[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0x757b7d[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5553d2[_0x0fb0('0x39')]=_0x5553d2['attributes'][_0x0fb0('0x3b')]?_0x5553d2['attributes']:_0x1ae094[_0x0fb0('0x38')];if(_0x757b7d[_0x0fb0('0x35')]['includeAll']){_0x5553d2[_0x0fb0('0x46')]=[{'all':!![]}];}_0x5553d2=_['merge']({},_0x5553d2,_0x757b7d[_0x0fb0('0x45')]);return db['MailQueue'][_0x0fb0('0x4c')](_0x5553d2)[_0x0fb0('0x28')](handleEntityNotFound(_0x26ea0c,null))[_0x0fb0('0x28')](respondWithResult(_0x26ea0c,null))[_0x0fb0('0x48')](handleError(_0x26ea0c,null));};exports[_0x0fb0('0x4d')]=function(_0x37b8cf,_0x5ad8e5){return db['MailQueue']['create'](_0x37b8cf['body'],{})[_0x0fb0('0x28')](function(_0x5b2671){var _0x58afd0=_0x37b8cf[_0x0fb0('0x4e')][_0x0fb0('0x4f')]({'plain':!![]});if(!_0x58afd0)throw new Error(_0x0fb0('0x50'));if(_0x58afd0[_0x0fb0('0x51')]===_0x0fb0('0x4e')){var _0x5bbf56=_0x5b2671[_0x0fb0('0x4f')]({'plain':!![]});var _0x172e62=_0x0fb0('0x2a');return db['UserProfileSection'][_0x0fb0('0x4c')]({'where':{'name':_0x172e62,'userProfileId':_0x58afd0['userProfileId']},'raw':!![]})[_0x0fb0('0x28')](function(_0x23e16c){if(_0x23e16c&&_0x23e16c['autoAssociation']===0x0){return db[_0x0fb0('0x2b')]['create']({'name':_0x5bbf56[_0x0fb0('0x2e')],'resourceId':_0x5bbf56['id'],'type':_0x23e16c[_0x0fb0('0x2e')],'sectionId':_0x23e16c['id']},{})[_0x0fb0('0x28')](function(){return _0x5b2671;});}else{return _0x5b2671;}})[_0x0fb0('0x48')](function(_0x53fd34){logger[_0x0fb0('0x2c')](_0x0fb0('0x52'),_0x53fd34);throw _0x53fd34;});}return _0x5b2671;})[_0x0fb0('0x28')](respondWithResult(_0x5ad8e5,0xc9))[_0x0fb0('0x48')](handleError(_0x5ad8e5,null));};exports[_0x0fb0('0x27')]=function(_0x305d6b,_0x33e878){if(_0x305d6b[_0x0fb0('0x53')]['id']){delete _0x305d6b[_0x0fb0('0x53')]['id'];}return db['MailQueue'][_0x0fb0('0x4c')]({'where':{'id':_0x305d6b[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x33e878,null))['then'](saveUpdates(_0x305d6b[_0x0fb0('0x53')],null))['then'](respondWithResult(_0x33e878,null))['catch'](handleError(_0x33e878,null));};exports['destroy']=function(_0x136cd5,_0x3e0f61){return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x136cd5[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x3e0f61,null))[_0x0fb0('0x28')](removeEntity(_0x3e0f61,null))[_0x0fb0('0x48')](handleError(_0x3e0f61,null));};exports['describe']=function(_0x577727,_0x33802f){return db[_0x0fb0('0x30')][_0x0fb0('0x54')]()[_0x0fb0('0x28')](respondWithResult(_0x33802f,null))[_0x0fb0('0x48')](handleError(_0x33802f,null));};exports[_0x0fb0('0x55')]=function(_0x3fa17c,_0x59b32a,_0x1f53f4){var _0x5b967d={'raw':!![],'where':{}},_0x90d475={},_0x2ab6d6;return db[_0x0fb0('0x30')][_0x0fb0('0x56')]({'where':{'id':_0x3fa17c['params']['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x59b32a,null))[_0x0fb0('0x28')](function(_0x2b0b38){if(_0x2b0b38){_0x2ab6d6=_0x2b0b38[_0x0fb0('0x4f')]({'plain':!![]});_0x90d475[_0x0fb0('0x38')]=_[_0x0fb0('0x4b')](db[_0x0fb0('0x57')][_0x0fb0('0x31')]);_0x90d475['query']=_[_0x0fb0('0x4b')](_0x3fa17c['query']);_0x90d475[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0x90d475[_0x0fb0('0x38')],_0x90d475[_0x0fb0('0x35')]);_0x5b967d['attributes']=_[_0x0fb0('0x37')](_0x90d475['model'],qs[_0x0fb0('0x3a')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5b967d['attributes']=_0x5b967d[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x5b967d[_0x0fb0('0x39')]:_0x90d475[_0x0fb0('0x38')];if(!_0x3fa17c[_0x0fb0('0x35')]['hasOwnProperty'](_0x0fb0('0x3d'))){_0x5b967d[_0x0fb0('0x21')]=qs[_0x0fb0('0x21')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x21')]);_0x5b967d['offset']=qs[_0x0fb0('0x1e')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x1e')]);}_0x5b967d[_0x0fb0('0x3e')]=qs[_0x0fb0('0x58')](_0x3fa17c[_0x0fb0('0x35')]['sort']);_0x5b967d[_0x0fb0('0x3f')]=qs['filters'](_[_0x0fb0('0x40')](_0x3fa17c[_0x0fb0('0x35')],_0x90d475[_0x0fb0('0x36')]));_0x5b967d[_0x0fb0('0x3f')]['MailQueueId']=_0x2b0b38['id'];if(_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x41')]){_0x5b967d[_0x0fb0('0x3f')]=_['merge'](_0x5b967d[_0x0fb0('0x3f')],{'$or':_['map'](_0x5b967d[_0x0fb0('0x39')],function(_0x797700){var _0x3ebec8={};_0x3ebec8[_0x797700]={'$like':'%'+_0x3fa17c['query'][_0x0fb0('0x41')]+'%'};return _0x3ebec8;})});}_0x5b967d=_[_0x0fb0('0x42')]({},_0x5b967d,_0x3fa17c['options']);return db[_0x0fb0('0x57')][_0x0fb0('0x47')](_0x5b967d);}})[_0x0fb0('0x28')](function(_0x3e9c9e){if(_0x3e9c9e){return db['User']['findAndCountAll']({'where':{'id':_[_0x0fb0('0x43')](_0x3e9c9e,_0x0fb0('0x59')),'role':'agent'},'attributes':['id','name',_0x0fb0('0x5a'),_0x0fb0('0x5b'),'createdAt']});}})['then'](function(_0x190c82){if(_0x190c82){return{'count':_0x190c82[_0x0fb0('0x20')],'rows':_[_0x0fb0('0x43')](_0x190c82[_0x0fb0('0x5c')],function(_0x132ffb){return{'membername':_0x132ffb[_0x0fb0('0x2e')],'UserId':_0x132ffb['id'],'queue_name':_0x2ab6d6[_0x0fb0('0x2e')],'MailQueueId':_0x2ab6d6['id'],'interface':util[_0x0fb0('0x5d')](_0x0fb0('0x5e'),_0x0fb0('0x5f'),_0x132ffb['name']),'penalty':0x0,'paused':_0x132ffb[_0x0fb0('0x5a')],'createdAt':_0x132ffb[_0x0fb0('0x60')],'updatedAt':_0x132ffb[_0x0fb0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0fb0('0x28')](respondWithFilteredResult(_0x59b32a,_0x5b967d))[_0x0fb0('0x48')](handleError(_0x59b32a,null));};exports[_0x0fb0('0x61')]=function(_0x46612c,_0x3a6238,_0x1a65c1){var _0x213aa2={};var _0x2c1d93={};var _0x1e6ac0;var _0x12301a;return db['MailQueue'][_0x0fb0('0x56')]({'where':{'id':_0x46612c[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a6238,null))[_0x0fb0('0x28')](function(_0x27ce75){if(_0x27ce75){_0x1e6ac0=_0x27ce75;_0x2c1d93['model']=_[_0x0fb0('0x4b')](db[_0x0fb0('0x62')]['rawAttributes']);_0x2c1d93['query']=_[_0x0fb0('0x4b')](_0x46612c['query']);_0x2c1d93[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0x2c1d93[_0x0fb0('0x38')],_0x2c1d93['query']);_0x213aa2[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0x2c1d93[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x213aa2[_0x0fb0('0x39')]=_0x213aa2[_0x0fb0('0x39')]['length']?_0x213aa2[_0x0fb0('0x39')]:_0x2c1d93[_0x0fb0('0x38')];_0x213aa2[_0x0fb0('0x3e')]=qs[_0x0fb0('0x58')](_0x46612c['query'][_0x0fb0('0x58')]);_0x213aa2['where']=qs[_0x0fb0('0x36')](_[_0x0fb0('0x40')](_0x46612c['query'],_0x2c1d93['filters']));if(_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x41')]){_0x213aa2[_0x0fb0('0x3f')]=_['merge'](_0x213aa2['where'],{'$or':_[_0x0fb0('0x43')](_0x213aa2[_0x0fb0('0x39')],function(_0x264146){var _0xe5dff5={};_0xe5dff5[_0x264146]={'$like':'%'+_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x41')]+'%'};return _0xe5dff5;})});}_0x213aa2=_['merge']({},_0x213aa2,_0x46612c[_0x0fb0('0x45')]);return _0x1e6ac0['getTeams'](_0x213aa2);}})[_0x0fb0('0x28')](function(_0x5a5bad){if(_0x5a5bad){_0x12301a=_0x5a5bad[_0x0fb0('0x3b')];if(!_0x46612c['query']['hasOwnProperty']('nolimit')){_0x213aa2['limit']=qs[_0x0fb0('0x21')](_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x21')]);_0x213aa2[_0x0fb0('0x1e')]=qs[_0x0fb0('0x1e')](_0x46612c['query'][_0x0fb0('0x1e')]);}return _0x1e6ac0['getTeams'](_0x213aa2);}})['then'](function(_0x4f4e67){if(_0x4f4e67){return _0x4f4e67?{'count':_0x12301a,'rows':_0x4f4e67}:null;}})[_0x0fb0('0x28')](respondWithResult(_0x3a6238,null))[_0x0fb0('0x48')](handleError(_0x3a6238,null));};exports[_0x0fb0('0x63')]=function(_0x494ac8,_0x587e1e,_0x5e9643){var _0x2783b7=_0x494ac8['body'][_0x0fb0('0x64')];return db[_0x0fb0('0x62')][_0x0fb0('0x47')]({'where':{'id':_0x2783b7},'attributes':['id'],'include':[{'model':db[_0x0fb0('0x65')],'as':_0x0fb0('0x66'),'attributes':['id',_0x0fb0('0x2e'),_0x0fb0('0x67'),_0x0fb0('0x68'),'interface'],'raw':!![]}]})[_0x0fb0('0x28')](function(_0x110fb0){if(_0x110fb0){var _0x3a87ca=_[_0x0fb0('0x69')](_0x110fb0,function(_0x6aa9f4){var _0x3ba0d6=_0x6aa9f4['get']({'plain':!![]});return _0x3ba0d6[_0x0fb0('0x66')];});return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x494ac8[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](function(_0x4d3bb0){return db[_0x0fb0('0x6a')][_0x0fb0('0x6b')](function(_0x4f25ee){return _0x4d3bb0[_0x0fb0('0x63')](_0x2783b7,{'transaction':_0x4f25ee})[_0x0fb0('0x28')](function(){return BPromise[_0x0fb0('0x6c')](_0x3a87ca,function(_0x19160a){return db[_0x0fb0('0x57')][_0x0fb0('0x6d')]({'where':{'UserId':_0x19160a['id'],'MailQueueId':_0x494ac8[_0x0fb0('0x4a')]['id']},'transaction':_0x4f25ee});});})['then'](function(){_0x3a87ca['forEach'](function(_0x5b8d6a){socket[_0x0fb0('0x6e')](_0x0fb0('0x6f'),{'UserId':_0x5b8d6a['id'],'MailQueueId':_0x4d3bb0['id']});});});});});}})[_0x0fb0('0x28')](respondWithStatusCode(_0x587e1e,null))[_0x0fb0('0x48')](handleError(_0x587e1e,null));};exports[_0x0fb0('0x70')]=function(_0x23836a,_0x59fb58,_0x24b6df){return db[_0x0fb0('0x62')][_0x0fb0('0x47')]({'where':{'id':_0x23836a[_0x0fb0('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0fb0('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fb0('0x28')](handleEntityNotFound(_0x59fb58,null))['then'](function(_0x2c037d){var _0x3b5317=_[_0x0fb0('0x43')](_0x2c037d,'id');var _0x3c49e2=[];var _0x10f750=[];var _0x2c0803=squel[_0x0fb0('0x71')]();_0x2c0803[_0x0fb0('0x72')](_0x0fb0('0x73'))[_0x0fb0('0x74')]('team_has_mail_queues','tq')[_0x0fb0('0x75')]('user_has_teams','ut',_0x0fb0('0x76'))[_0x0fb0('0x3f')]('MailQueueId\x20=\x20?',_0x23836a[_0x0fb0('0x4a')]['id']);for(var _0xbf6ad=0x0;_0xbf6ad<_0x2c037d[_0x0fb0('0x3b')];_0xbf6ad+=0x1){let _0x1683b1=_0x2c037d[_0xbf6ad];for(var _0x2247ea=0x0;_0x2247ea<_0x1683b1[_0x0fb0('0x66')]['length'];_0x2247ea+=0x1){let _0x38c28e=_0x1683b1[_0x0fb0('0x66')][_0x2247ea];var _0x75c2ca=_0x2c0803[_0x0fb0('0x77')]();_0x75c2ca[_0x0fb0('0x3f')](_0x0fb0('0x78'),_0x38c28e['id']);_0x10f750[_0x0fb0('0x79')](db[_0x0fb0('0x6a')][_0x0fb0('0x35')](_0x75c2ca[_0x0fb0('0x7a')](),{'type':db[_0x0fb0('0x6a')][_0x0fb0('0x7b')][_0x0fb0('0x7c')]})['then'](function(_0x15ad7c){if(_0x15ad7c[_0x0fb0('0x3b')]===0x1){return _0x38c28e['id'];}else{var _0x2da8b3=_[_0x0fb0('0x7d')](_[_0x0fb0('0x43')](_0x15ad7c,'TeamId'),function(_0x46ae85){return _[_0x0fb0('0x7e')](_0x3b5317,_0x46ae85);});if(_0x2da8b3){return _0x38c28e['id'];}}}));}}return BPromise['all'](_0x10f750)[_0x0fb0('0x28')](function(_0x405563){_0x3c49e2=_(_0x3c49e2)[_0x0fb0('0x7f')](_0x405563)[_0x0fb0('0x80')]()['value']();return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x23836a[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](function(_0xb809ec){return db['sequelize']['transaction'](function(_0xf3c23e){return _0xb809ec[_0x0fb0('0x70')](_0x23836a[_0x0fb0('0x35')][_0x0fb0('0x64')],{'transaction':_0xf3c23e})[_0x0fb0('0x28')](function(){if(!_[_0x0fb0('0x81')](_0x3c49e2)){return _0xb809ec['removeAgents'](_0x3c49e2,{'transaction':_0xf3c23e});}})['then'](function(){_0x3c49e2[_0x0fb0('0x82')](function(_0x2b1c05){socket[_0x0fb0('0x6e')]('userMailQueue:remove',{'UserId':_0x2b1c05,'MailQueueId':_0xb809ec['id']});});});});});});})[_0x0fb0('0x28')](respondWithStatusCode(_0x59fb58,null))['catch'](handleError(_0x59fb58,null));};exports[_0x0fb0('0x83')]=function(_0x3da85d,_0x2166ef,_0x2fd147){return db['MailQueue'][_0x0fb0('0x4c')]({'where':{'id':_0x3da85d[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2166ef,null))[_0x0fb0('0x28')](function(_0x51a595){if(_0x51a595){return _0x51a595[_0x0fb0('0x83')](_0x3da85d[_0x0fb0('0x53')][_0x0fb0('0x64')],_[_0x0fb0('0x84')](_0x3da85d[_0x0fb0('0x53')],[_0x0fb0('0x64'),'id'])||{})[_0x0fb0('0x85')](function(_0x3fa8dd){for(var _0x4710d2=0x0;_0x4710d2<_0x3da85d[_0x0fb0('0x53')][_0x0fb0('0x64')][_0x0fb0('0x3b')];_0x4710d2+=0x1){socket[_0x0fb0('0x6e')](_0x0fb0('0x6f'),{'UserId':Number(_0x3da85d[_0x0fb0('0x53')]['ids'][_0x4710d2]),'MailQueueId':Number(_0x3da85d[_0x0fb0('0x4a')]['id'])});}return _0x3fa8dd;});}})['then'](respondWithResult(_0x2166ef,null))[_0x0fb0('0x48')](handleError(_0x2166ef,null));};exports[_0x0fb0('0x86')]=function(_0x5f2d08,_0x50c810,_0x3ab885){return db[_0x0fb0('0x30')]['find']({'where':{'id':_0x5f2d08[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x50c810,null))['then'](function(_0x20fc41){if(_0x20fc41){return _0x20fc41[_0x0fb0('0x86')](_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')])[_0x0fb0('0x28')](function(){if(_[_0x0fb0('0x87')](_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')])){for(var _0x1841c0=0x0;_0x1841c0<_0x5f2d08['query'][_0x0fb0('0x64')][_0x0fb0('0x3b')];_0x1841c0+=0x1){socket[_0x0fb0('0x6e')](_0x0fb0('0x88'),{'UserId':Number(_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')][_0x1841c0]),'MailQueueId':Number(_0x5f2d08[_0x0fb0('0x4a')]['id'])});}}else{socket[_0x0fb0('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')]),'MailQueueId':Number(_0x5f2d08[_0x0fb0('0x4a')]['id'])});}});}})[_0x0fb0('0x28')](respondWithStatusCode(_0x50c810,null))[_0x0fb0('0x48')](handleError(_0x50c810,null));};exports[_0x0fb0('0x89')]=function(_0x3c6597,_0x5ce294,_0x893d70){var _0x9832f9={};var _0x194068={};var _0x16b1b6;var _0x252026;return db[_0x0fb0('0x30')][_0x0fb0('0x56')]({'where':{'id':_0x3c6597[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ce294,null))[_0x0fb0('0x28')](function(_0x34c5eb){if(_0x34c5eb){_0x16b1b6=_0x34c5eb;_0x194068['model']=_['keys'](db[_0x0fb0('0x65')][_0x0fb0('0x31')]);_0x194068[_0x0fb0('0x35')]=_[_0x0fb0('0x4b')](_0x3c6597[_0x0fb0('0x35')]);_0x194068['filters']=_[_0x0fb0('0x37')](_0x194068[_0x0fb0('0x38')],_0x194068[_0x0fb0('0x35')]);_0x9832f9[_0x0fb0('0x39')]=_['intersection'](_0x194068['model'],qs[_0x0fb0('0x3a')](_0x3c6597[_0x0fb0('0x35')]['fields']));_0x9832f9[_0x0fb0('0x39')]=_0x9832f9[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x9832f9[_0x0fb0('0x39')]:_0x194068[_0x0fb0('0x38')];_0x9832f9['order']=qs[_0x0fb0('0x58')](_0x3c6597[_0x0fb0('0x35')][_0x0fb0('0x58')]);_0x9832f9[_0x0fb0('0x3f')]=qs[_0x0fb0('0x36')](_['pick'](_0x3c6597[_0x0fb0('0x35')],_0x194068[_0x0fb0('0x36')]));if(_0x3c6597[_0x0fb0('0x35')]['filter']){_0x9832f9['where']=_[_0x0fb0('0x42')](_0x9832f9[_0x0fb0('0x3f')],{'$or':_[_0x0fb0('0x43')](_0x9832f9['attributes'],function(_0x6e0d02){var _0x43752c={};_0x43752c[_0x6e0d02]={'$like':'%'+_0x3c6597[_0x0fb0('0x35')]['filter']+'%'};return _0x43752c;})});}_0x9832f9=_['merge']({},_0x9832f9,_0x3c6597[_0x0fb0('0x45')]);return _0x16b1b6['getAgents'](_0x9832f9);}})[_0x0fb0('0x28')](function(_0x255322){if(_0x255322){_0x252026=_0x255322[_0x0fb0('0x3b')];if(!_0x3c6597[_0x0fb0('0x35')]['hasOwnProperty'](_0x0fb0('0x3d'))){_0x9832f9['limit']=qs['limit'](_0x3c6597['query']['limit']);_0x9832f9['offset']=qs[_0x0fb0('0x1e')](_0x3c6597[_0x0fb0('0x35')][_0x0fb0('0x1e')]);}return _0x16b1b6[_0x0fb0('0x89')](_0x9832f9);}})[_0x0fb0('0x28')](function(_0x310c97){if(_0x310c97){return _0x310c97?{'count':_0x252026,'rows':_0x310c97}:null;}})[_0x0fb0('0x28')](respondWithResult(_0x5ce294,null))['catch'](handleError(_0x5ce294,null));}; \ No newline at end of file +var _0x3149=['value','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','map','MailQueue','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact'];(function(_0x2cfd66,_0x182b28){var _0xddc62e=function(_0x3425b4){while(--_0x3425b4){_0x2cfd66['push'](_0x2cfd66['shift']());}};_0xddc62e(++_0x182b28);}(_0x3149,0x1b7));var _0x9314=function(_0xb6b7fc,_0x331a9b){_0xb6b7fc=_0xb6b7fc-0x0;var _0x1b530e=_0x3149[_0xb6b7fc];return _0x1b530e;};'use strict';var emlformat=require(_0x9314('0x0'));var rimraf=require(_0x9314('0x1'));var zipdir=require(_0x9314('0x2'));var jsonpatch=require(_0x9314('0x3'));var rp=require(_0x9314('0x4'));var moment=require(_0x9314('0x5'));var BPromise=require(_0x9314('0x6'));var Mustache=require('mustache');var util=require(_0x9314('0x7'));var path=require(_0x9314('0x8'));var sox=require(_0x9314('0x9'));var csv=require(_0x9314('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9314('0xb'));var _=require(_0x9314('0xc'));var squel=require('squel');var crypto=require(_0x9314('0xd'));var jsforce=require(_0x9314('0xe'));var deskjs=require(_0x9314('0xf'));var toCsv=require(_0x9314('0xa'));var querystring=require(_0x9314('0x10'));var Papa=require(_0x9314('0x11'));var Redis=require(_0x9314('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9314('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9314('0x14'));var logger=require('../../config/logger')(_0x9314('0x15'));var utils=require(_0x9314('0x16'));var config=require(_0x9314('0x17'));var licenseUtil=require(_0x9314('0x18'));var db=require(_0x9314('0x19'))['db'];config['redis']=_[_0x9314('0x1a')](config['redis'],{'host':_0x9314('0x1b'),'port':0x18eb});var socket=require(_0x9314('0x1c'))(new Redis(config[_0x9314('0x1d')]));require(_0x9314('0x1e'))[_0x9314('0x1f')](socket);function respondWithStatusCode(_0x198e57,_0x1eca03){_0x1eca03=_0x1eca03||0xcc;return function(_0x14473f){if(_0x14473f){return _0x198e57[_0x9314('0x20')](_0x1eca03);}return _0x198e57[_0x9314('0x21')](_0x1eca03)[_0x9314('0x22')]();};}function respondWithResult(_0x2c534c,_0x3b3cd6){_0x3b3cd6=_0x3b3cd6||0xc8;return function(_0x57648e){if(_0x57648e){return _0x2c534c['status'](_0x3b3cd6)[_0x9314('0x23')](_0x57648e);}};}function respondWithFilteredResult(_0x59edf9,_0x3efa46){return function(_0x1a3bd4){if(_0x1a3bd4){var _0x3244e8=typeof _0x3efa46[_0x9314('0x24')]===_0x9314('0x25')&&typeof _0x3efa46['limit']===_0x9314('0x25');var _0x2f7ea4=_0x1a3bd4[_0x9314('0x26')];var _0x4e6f1f=_0x3244e8?0x0:_0x3efa46[_0x9314('0x24')];var _0x10172=_0x3244e8?_0x1a3bd4[_0x9314('0x26')]:_0x3efa46['offset']+_0x3efa46[_0x9314('0x27')];var _0x33292c;if(_0x10172>=_0x2f7ea4){_0x10172=_0x2f7ea4;_0x33292c=0xc8;}else{_0x33292c=0xce;}_0x59edf9[_0x9314('0x21')](_0x33292c);return _0x59edf9[_0x9314('0x28')](_0x9314('0x29'),_0x4e6f1f+'-'+_0x10172+'/'+_0x2f7ea4)[_0x9314('0x23')](_0x1a3bd4);}return null;};}function patchUpdates(_0x273570){return function(_0x2eda37){try{jsonpatch[_0x9314('0x2a')](_0x2eda37,_0x273570,!![]);}catch(_0x3ce713){return BPromise[_0x9314('0x2b')](_0x3ce713);}return _0x2eda37[_0x9314('0x2c')]();};}function saveUpdates(_0x44ddb6,_0x462f30){return function(_0x556048){if(_0x556048){return _0x556048['update'](_0x44ddb6)[_0x9314('0x2d')](function(_0x4d8f57){return _0x4d8f57;});}return null;};}function removeEntity(_0x1142d0,_0x12d5ee){return function(_0x15d541){if(_0x15d541){return _0x15d541[_0x9314('0x2e')]()['then'](function(){var _0x52f54d=_0x15d541[_0x9314('0x2f')]({'plain':!![]});var _0x29d01a=_0x9314('0x30');return db[_0x9314('0x31')]['destroy']({'where':{'type':_0x29d01a,'resourceId':_0x52f54d['id']}})[_0x9314('0x2d')](function(){return _0x15d541;});})[_0x9314('0x2d')](function(){_0x1142d0[_0x9314('0x21')](0xcc)[_0x9314('0x22')]();});}};}function handleEntityNotFound(_0x260481,_0xd3d2e2){return function(_0x5e8735){if(!_0x5e8735){_0x260481[_0x9314('0x20')](0x194);}return _0x5e8735;};}function handleError(_0x443a7d,_0x63258a){_0x63258a=_0x63258a||0x1f4;return function(_0x56ef54){logger['error'](_0x56ef54[_0x9314('0x32')]);if(_0x56ef54['name']){delete _0x56ef54[_0x9314('0x33')];}_0x443a7d[_0x9314('0x21')](_0x63258a)[_0x9314('0x34')](_0x56ef54);};}exports['index']=function(_0x250e04,_0x11f93e){var _0x52ff11={},_0x11f696={},_0x5c4be0={'count':0x0,'rows':[]};var _0x204558=_[_0x9314('0x35')](db[_0x9314('0x36')][_0x9314('0x37')],function(_0xc301b5){return{'name':_0xc301b5['fieldName'],'type':_0xc301b5[_0x9314('0x38')][_0x9314('0x39')]};});_0x11f696['model']=_[_0x9314('0x35')](_0x204558,_0x9314('0x33'));_0x11f696[_0x9314('0x3a')]=_[_0x9314('0x3b')](_0x250e04[_0x9314('0x3a')]);_0x11f696[_0x9314('0x3c')]=_[_0x9314('0x3d')](_0x11f696[_0x9314('0x3e')],_0x11f696[_0x9314('0x3a')]);_0x52ff11[_0x9314('0x3f')]=_[_0x9314('0x3d')](_0x11f696[_0x9314('0x3e')],qs[_0x9314('0x40')](_0x250e04[_0x9314('0x3a')][_0x9314('0x40')]));_0x52ff11[_0x9314('0x3f')]=_0x52ff11[_0x9314('0x3f')][_0x9314('0x41')]?_0x52ff11['attributes']:_0x11f696[_0x9314('0x3e')];if(!_0x250e04[_0x9314('0x3a')][_0x9314('0x42')](_0x9314('0x43'))){_0x52ff11['limit']=qs[_0x9314('0x27')](_0x250e04[_0x9314('0x3a')][_0x9314('0x27')]);_0x52ff11[_0x9314('0x24')]=qs[_0x9314('0x24')](_0x250e04[_0x9314('0x3a')][_0x9314('0x24')]);}_0x52ff11[_0x9314('0x44')]=qs[_0x9314('0x45')](_0x250e04[_0x9314('0x3a')][_0x9314('0x45')]);_0x52ff11['where']=qs[_0x9314('0x3c')](_[_0x9314('0x46')](_0x250e04[_0x9314('0x3a')],_0x11f696[_0x9314('0x3c')]),_0x204558);if(_0x250e04[_0x9314('0x3a')]['filter']){_0x52ff11[_0x9314('0x47')]=_[_0x9314('0x48')](_0x52ff11[_0x9314('0x47')],{'$or':_[_0x9314('0x35')](_0x204558,function(_0x421b93){if(_0x421b93[_0x9314('0x38')]!==_0x9314('0x49')){var _0x5965aa={};_0x5965aa[_0x421b93[_0x9314('0x33')]]={'$like':'%'+_0x250e04['query'][_0x9314('0x4a')]+'%'};return _0x5965aa;}})});}_0x52ff11=_[_0x9314('0x48')]({},_0x52ff11,_0x250e04[_0x9314('0x4b')]);var _0x34fb17={'where':_0x52ff11['where']};return db[_0x9314('0x36')][_0x9314('0x26')](_0x34fb17)['then'](function(_0x45da44){_0x5c4be0[_0x9314('0x26')]=_0x45da44;if(_0x250e04[_0x9314('0x3a')][_0x9314('0x4c')]){_0x52ff11['include']=[{'all':!![]}];}return db[_0x9314('0x36')][_0x9314('0x4d')](_0x52ff11);})[_0x9314('0x2d')](function(_0x581ee8){_0x5c4be0[_0x9314('0x4e')]=_0x581ee8;return _0x5c4be0;})['then'](respondWithFilteredResult(_0x11f93e,_0x52ff11))[_0x9314('0x4f')](handleError(_0x11f93e,null));};exports['show']=function(_0x3cdf75,_0x53278b){var _0x371ef3={'raw':!![],'where':{'id':_0x3cdf75[_0x9314('0x50')]['id']}},_0x3aedb9={};_0x3aedb9[_0x9314('0x3e')]=_['keys'](db[_0x9314('0x36')][_0x9314('0x37')]);_0x3aedb9['query']=_[_0x9314('0x3b')](_0x3cdf75['query']);_0x3aedb9[_0x9314('0x3c')]=_['intersection'](_0x3aedb9['model'],_0x3aedb9['query']);_0x371ef3[_0x9314('0x3f')]=_[_0x9314('0x3d')](_0x3aedb9[_0x9314('0x3e')],qs[_0x9314('0x40')](_0x3cdf75[_0x9314('0x3a')][_0x9314('0x40')]));_0x371ef3[_0x9314('0x3f')]=_0x371ef3[_0x9314('0x3f')][_0x9314('0x41')]?_0x371ef3[_0x9314('0x3f')]:_0x3aedb9[_0x9314('0x3e')];if(_0x3cdf75[_0x9314('0x3a')][_0x9314('0x4c')]){_0x371ef3['include']=[{'all':!![]}];}_0x371ef3=_[_0x9314('0x48')]({},_0x371ef3,_0x3cdf75['options']);return db['MailQueue'][_0x9314('0x51')](_0x371ef3)['then'](handleEntityNotFound(_0x53278b,null))['then'](respondWithResult(_0x53278b,null))[_0x9314('0x4f')](handleError(_0x53278b,null));};exports['create']=function(_0x2dda14,_0x509bf6){return db['MailQueue']['create'](_0x2dda14[_0x9314('0x52')],{})[_0x9314('0x2d')](function(_0x1431ef){var _0x31c53d=_0x2dda14['user'][_0x9314('0x2f')]({'plain':!![]});if(!_0x31c53d)throw new Error(_0x9314('0x53'));if(_0x31c53d[_0x9314('0x54')]===_0x9314('0x55')){var _0x22b5fa=_0x1431ef['get']({'plain':!![]});var _0x5272c2='MailQueues';return db[_0x9314('0x56')]['find']({'where':{'name':_0x5272c2,'userProfileId':_0x31c53d[_0x9314('0x57')]},'raw':!![]})[_0x9314('0x2d')](function(_0x1640a4){if(_0x1640a4&&_0x1640a4['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x22b5fa[_0x9314('0x33')],'resourceId':_0x22b5fa['id'],'type':_0x1640a4[_0x9314('0x33')],'sectionId':_0x1640a4['id']},{})['then'](function(){return _0x1431ef;});}else{return _0x1431ef;}})[_0x9314('0x4f')](function(_0x18af79){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18af79);throw _0x18af79;});}return _0x1431ef;})[_0x9314('0x2d')](respondWithResult(_0x509bf6,0xc9))[_0x9314('0x4f')](handleError(_0x509bf6,null));};exports[_0x9314('0x58')]=function(_0x26c4b3,_0x2322d7){if(_0x26c4b3[_0x9314('0x52')]['id']){delete _0x26c4b3[_0x9314('0x52')]['id'];}return db[_0x9314('0x36')][_0x9314('0x51')]({'where':{'id':_0x26c4b3[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0x2322d7,null))['then'](saveUpdates(_0x26c4b3[_0x9314('0x52')],null))[_0x9314('0x2d')](respondWithResult(_0x2322d7,null))[_0x9314('0x4f')](handleError(_0x2322d7,null));};exports[_0x9314('0x2e')]=function(_0x2b0a84,_0x462b15){return db[_0x9314('0x36')][_0x9314('0x51')]({'where':{'id':_0x2b0a84[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0x462b15,null))[_0x9314('0x2d')](removeEntity(_0x462b15,null))[_0x9314('0x4f')](handleError(_0x462b15,null));};exports[_0x9314('0x59')]=function(_0x101d71,_0x3f68ff){return db[_0x9314('0x36')][_0x9314('0x59')]()[_0x9314('0x2d')](respondWithResult(_0x3f68ff,null))[_0x9314('0x4f')](handleError(_0x3f68ff,null));};exports['getMembers']=function(_0xd23a24,_0x54eedc,_0x29fd71){var _0x1d5dd9={'raw':!![],'where':{}},_0x588ecb={},_0x5082b4;return db[_0x9314('0x36')][_0x9314('0x5a')]({'where':{'id':_0xd23a24[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0x54eedc,null))['then'](function(_0x4a34c3){if(_0x4a34c3){_0x5082b4=_0x4a34c3[_0x9314('0x2f')]({'plain':!![]});_0x588ecb[_0x9314('0x3e')]=_[_0x9314('0x3b')](db[_0x9314('0x5b')]['rawAttributes']);_0x588ecb['query']=_[_0x9314('0x3b')](_0xd23a24[_0x9314('0x3a')]);_0x588ecb[_0x9314('0x3c')]=_[_0x9314('0x3d')](_0x588ecb[_0x9314('0x3e')],_0x588ecb[_0x9314('0x3a')]);_0x1d5dd9[_0x9314('0x3f')]=_[_0x9314('0x3d')](_0x588ecb[_0x9314('0x3e')],qs[_0x9314('0x40')](_0xd23a24[_0x9314('0x3a')][_0x9314('0x40')]));_0x1d5dd9['attributes']=_0x1d5dd9['attributes'][_0x9314('0x41')]?_0x1d5dd9[_0x9314('0x3f')]:_0x588ecb[_0x9314('0x3e')];if(!_0xd23a24[_0x9314('0x3a')][_0x9314('0x42')](_0x9314('0x43'))){_0x1d5dd9[_0x9314('0x27')]=qs[_0x9314('0x27')](_0xd23a24[_0x9314('0x3a')][_0x9314('0x27')]);_0x1d5dd9[_0x9314('0x24')]=qs[_0x9314('0x24')](_0xd23a24[_0x9314('0x3a')][_0x9314('0x24')]);}_0x1d5dd9[_0x9314('0x44')]=qs[_0x9314('0x45')](_0xd23a24['query'][_0x9314('0x45')]);_0x1d5dd9[_0x9314('0x47')]=qs[_0x9314('0x3c')](_[_0x9314('0x46')](_0xd23a24[_0x9314('0x3a')],_0x588ecb[_0x9314('0x3c')]));_0x1d5dd9[_0x9314('0x47')][_0x9314('0x5c')]=_0x4a34c3['id'];if(_0xd23a24['query'][_0x9314('0x4a')]){_0x1d5dd9['where']=_[_0x9314('0x48')](_0x1d5dd9['where'],{'$or':_[_0x9314('0x35')](_0x1d5dd9['attributes'],function(_0x3eaaed){var _0x3a4d67={};_0x3a4d67[_0x3eaaed]={'$like':'%'+_0xd23a24['query'][_0x9314('0x4a')]+'%'};return _0x3a4d67;})});}_0x1d5dd9=_[_0x9314('0x48')]({},_0x1d5dd9,_0xd23a24[_0x9314('0x4b')]);return db[_0x9314('0x5b')]['findAll'](_0x1d5dd9);}})[_0x9314('0x2d')](function(_0x3b79a7){if(_0x3b79a7){return db[_0x9314('0x5d')][_0x9314('0x5e')]({'where':{'id':_[_0x9314('0x35')](_0x3b79a7,_0x9314('0x5f')),'role':_0x9314('0x60')},'attributes':['id','name',_0x9314('0x61'),_0x9314('0x62'),'createdAt']});}})[_0x9314('0x2d')](function(_0x58d657){if(_0x58d657){return{'count':_0x58d657['count'],'rows':_[_0x9314('0x35')](_0x58d657[_0x9314('0x4e')],function(_0x19c158){return{'membername':_0x19c158['name'],'UserId':_0x19c158['id'],'queue_name':_0x5082b4[_0x9314('0x33')],'MailQueueId':_0x5082b4['id'],'interface':util['format'](_0x9314('0x63'),_0x9314('0x64'),_0x19c158[_0x9314('0x33')]),'penalty':0x0,'paused':_0x19c158[_0x9314('0x61')],'createdAt':_0x19c158[_0x9314('0x65')],'updatedAt':_0x19c158['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9314('0x2d')](respondWithFilteredResult(_0x54eedc,_0x1d5dd9))[_0x9314('0x4f')](handleError(_0x54eedc,null));};exports[_0x9314('0x66')]=function(_0x2a01e9,_0xa5c527,_0x6799fb){var _0x2f8f59={};var _0x2b44f8={};var _0x53aaed;var _0x2bb15a;return db['MailQueue']['findOne']({'where':{'id':_0x2a01e9[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0xa5c527,null))[_0x9314('0x2d')](function(_0xeddd83){if(_0xeddd83){_0x53aaed=_0xeddd83;_0x2b44f8['model']=_[_0x9314('0x3b')](db[_0x9314('0x67')][_0x9314('0x37')]);_0x2b44f8[_0x9314('0x3a')]=_[_0x9314('0x3b')](_0x2a01e9[_0x9314('0x3a')]);_0x2b44f8[_0x9314('0x3c')]=_[_0x9314('0x3d')](_0x2b44f8[_0x9314('0x3e')],_0x2b44f8[_0x9314('0x3a')]);_0x2f8f59['attributes']=_[_0x9314('0x3d')](_0x2b44f8[_0x9314('0x3e')],qs[_0x9314('0x40')](_0x2a01e9[_0x9314('0x3a')][_0x9314('0x40')]));_0x2f8f59[_0x9314('0x3f')]=_0x2f8f59[_0x9314('0x3f')][_0x9314('0x41')]?_0x2f8f59[_0x9314('0x3f')]:_0x2b44f8[_0x9314('0x3e')];_0x2f8f59[_0x9314('0x44')]=qs['sort'](_0x2a01e9['query']['sort']);_0x2f8f59[_0x9314('0x47')]=qs['filters'](_[_0x9314('0x46')](_0x2a01e9[_0x9314('0x3a')],_0x2b44f8[_0x9314('0x3c')]));if(_0x2a01e9[_0x9314('0x3a')][_0x9314('0x4a')]){_0x2f8f59[_0x9314('0x47')]=_[_0x9314('0x48')](_0x2f8f59['where'],{'$or':_[_0x9314('0x35')](_0x2f8f59[_0x9314('0x3f')],function(_0x3a569f){var _0x5ce634={};_0x5ce634[_0x3a569f]={'$like':'%'+_0x2a01e9[_0x9314('0x3a')][_0x9314('0x4a')]+'%'};return _0x5ce634;})});}_0x2f8f59=_[_0x9314('0x48')]({},_0x2f8f59,_0x2a01e9[_0x9314('0x4b')]);return _0x53aaed[_0x9314('0x66')](_0x2f8f59);}})[_0x9314('0x2d')](function(_0xbdb367){if(_0xbdb367){_0x2bb15a=_0xbdb367[_0x9314('0x41')];if(!_0x2a01e9[_0x9314('0x3a')][_0x9314('0x42')]('nolimit')){_0x2f8f59['limit']=qs[_0x9314('0x27')](_0x2a01e9['query'][_0x9314('0x27')]);_0x2f8f59[_0x9314('0x24')]=qs[_0x9314('0x24')](_0x2a01e9['query'][_0x9314('0x24')]);}return _0x53aaed[_0x9314('0x66')](_0x2f8f59);}})[_0x9314('0x2d')](function(_0x1e85f9){if(_0x1e85f9){return _0x1e85f9?{'count':_0x2bb15a,'rows':_0x1e85f9}:null;}})['then'](respondWithResult(_0xa5c527,null))[_0x9314('0x4f')](handleError(_0xa5c527,null));};exports['addTeams']=function(_0x59fd42,_0x4737a4,_0x1cfdfd){var _0x505293=_0x59fd42[_0x9314('0x52')][_0x9314('0x68')];return db[_0x9314('0x67')][_0x9314('0x4d')]({'where':{'id':_0x505293},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9314('0x69'),'attributes':['id',_0x9314('0x33'),'online',_0x9314('0x6a'),_0x9314('0x6b')],'raw':!![]}]})[_0x9314('0x2d')](function(_0xa7245c){if(_0xa7245c){var _0x58ae65=_[_0x9314('0x6c')](_0xa7245c,function(_0x120a0a){var _0x346b78=_0x120a0a['get']({'plain':!![]});return _0x346b78[_0x9314('0x69')];});return db['MailQueue']['find']({'where':{'id':_0x59fd42[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](function(_0x98d9a5){return db[_0x9314('0x6d')][_0x9314('0x6e')](function(_0x34cfe7){return _0x98d9a5[_0x9314('0x6f')](_0x505293,{'transaction':_0x34cfe7})[_0x9314('0x2d')](function(){return BPromise[_0x9314('0x70')](_0x58ae65,function(_0x516402){return db[_0x9314('0x5b')][_0x9314('0x71')]({'where':{'UserId':_0x516402['id'],'MailQueueId':_0x59fd42['params']['id']},'transaction':_0x34cfe7});});})[_0x9314('0x2d')](function(){_0x58ae65[_0x9314('0x72')](function(_0x4e7faf){socket[_0x9314('0x73')](_0x9314('0x74'),{'UserId':_0x4e7faf['id'],'MailQueueId':_0x98d9a5['id']});});});});});}})[_0x9314('0x2d')](respondWithStatusCode(_0x4737a4,null))[_0x9314('0x4f')](handleError(_0x4737a4,null));};exports[_0x9314('0x75')]=function(_0x3fff67,_0x4de8e8,_0x95ce90){return db[_0x9314('0x67')][_0x9314('0x4d')]({'where':{'id':_0x3fff67[_0x9314('0x3a')][_0x9314('0x68')]},'attributes':['id'],'include':[{'model':db[_0x9314('0x5d')],'as':_0x9314('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4de8e8,null))[_0x9314('0x2d')](function(_0x4c7ab3){var _0x24c37d=_[_0x9314('0x35')](_0x4c7ab3,'id');var _0x365b1a=[];var _0x14760c=[];var _0x5b02c9=squel[_0x9314('0x76')]();_0x5b02c9[_0x9314('0x77')](_0x9314('0x78'))[_0x9314('0x79')](_0x9314('0x7a'),'tq')[_0x9314('0x7b')](_0x9314('0x7c'),'ut',_0x9314('0x7d'))[_0x9314('0x47')](_0x9314('0x7e'),_0x3fff67['params']['id']);for(var _0x5e3716=0x0;_0x5e3716<_0x4c7ab3[_0x9314('0x41')];_0x5e3716+=0x1){let _0x1c5444=_0x4c7ab3[_0x5e3716];for(var _0x302daf=0x0;_0x302daf<_0x1c5444[_0x9314('0x69')][_0x9314('0x41')];_0x302daf+=0x1){let _0x40c65d=_0x1c5444[_0x9314('0x69')][_0x302daf];var _0x3fff05=_0x5b02c9['clone']();_0x3fff05['where'](_0x9314('0x7f'),_0x40c65d['id']);_0x14760c[_0x9314('0x80')](db[_0x9314('0x6d')][_0x9314('0x3a')](_0x3fff05[_0x9314('0x81')](),{'type':db[_0x9314('0x6d')][_0x9314('0x82')][_0x9314('0x83')]})[_0x9314('0x2d')](function(_0x560288){if(_0x560288[_0x9314('0x41')]===0x1){return _0x40c65d['id'];}else{var _0x512fc2=_[_0x9314('0x84')](_['map'](_0x560288,_0x9314('0x85')),function(_0x1a279b){return _[_0x9314('0x86')](_0x24c37d,_0x1a279b);});if(_0x512fc2){return _0x40c65d['id'];}}}));}}return BPromise[_0x9314('0x87')](_0x14760c)[_0x9314('0x2d')](function(_0x534609){_0x365b1a=_(_0x365b1a)['union'](_0x534609)[_0x9314('0x88')]()[_0x9314('0x89')]();return db[_0x9314('0x36')][_0x9314('0x51')]({'where':{'id':_0x3fff67[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](function(_0x473518){return db[_0x9314('0x6d')][_0x9314('0x6e')](function(_0x6ee48e){return _0x473518['removeTeams'](_0x3fff67['query'][_0x9314('0x68')],{'transaction':_0x6ee48e})[_0x9314('0x2d')](function(){if(!_[_0x9314('0x8a')](_0x365b1a)){return _0x473518[_0x9314('0x8b')](_0x365b1a,{'transaction':_0x6ee48e});}})[_0x9314('0x2d')](function(){_0x365b1a[_0x9314('0x72')](function(_0x52b6a3){socket[_0x9314('0x73')](_0x9314('0x8c'),{'UserId':_0x52b6a3,'MailQueueId':_0x473518['id']});});});});});});})[_0x9314('0x2d')](respondWithStatusCode(_0x4de8e8,null))[_0x9314('0x4f')](handleError(_0x4de8e8,null));};exports[_0x9314('0x8d')]=function(_0x1102b,_0x45fc90,_0x70671a){return db[_0x9314('0x36')][_0x9314('0x51')]({'where':{'id':_0x1102b[_0x9314('0x50')]['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0x45fc90,null))[_0x9314('0x2d')](function(_0x3030be){if(_0x3030be){return _0x3030be['addAgents'](_0x1102b['body'][_0x9314('0x68')],_['omit'](_0x1102b['body'],[_0x9314('0x68'),'id'])||{})['spread'](function(_0x3ba773){for(var _0x3c5acd=0x0;_0x3c5acd<_0x1102b[_0x9314('0x52')][_0x9314('0x68')]['length'];_0x3c5acd+=0x1){socket[_0x9314('0x73')](_0x9314('0x74'),{'UserId':Number(_0x1102b[_0x9314('0x52')][_0x9314('0x68')][_0x3c5acd]),'MailQueueId':Number(_0x1102b[_0x9314('0x50')]['id'])});}return _0x3ba773;});}})[_0x9314('0x2d')](respondWithResult(_0x45fc90,null))['catch'](handleError(_0x45fc90,null));};exports['removeAgents']=function(_0x4609a0,_0x19503b,_0x3c19cb){return db['MailQueue'][_0x9314('0x51')]({'where':{'id':_0x4609a0['params']['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0x19503b,null))[_0x9314('0x2d')](function(_0x247f41){if(_0x247f41){return _0x247f41[_0x9314('0x8b')](_0x4609a0[_0x9314('0x3a')][_0x9314('0x68')])[_0x9314('0x2d')](function(){if(_[_0x9314('0x8e')](_0x4609a0[_0x9314('0x3a')]['ids'])){for(var _0x12fed4=0x0;_0x12fed4<_0x4609a0[_0x9314('0x3a')][_0x9314('0x68')][_0x9314('0x41')];_0x12fed4+=0x1){socket['emit'](_0x9314('0x8c'),{'UserId':Number(_0x4609a0[_0x9314('0x3a')]['ids'][_0x12fed4]),'MailQueueId':Number(_0x4609a0[_0x9314('0x50')]['id'])});}}else{socket[_0x9314('0x73')](_0x9314('0x8c'),{'UserId':Number(_0x4609a0[_0x9314('0x3a')]['ids']),'MailQueueId':Number(_0x4609a0[_0x9314('0x50')]['id'])});}});}})[_0x9314('0x2d')](respondWithStatusCode(_0x19503b,null))[_0x9314('0x4f')](handleError(_0x19503b,null));};exports['getAgents']=function(_0x4dadbf,_0x78d221,_0x33c2f7){var _0x5c7491={};var _0x3f3bf4={};var _0x1361cf;var _0x5b26d2;return db[_0x9314('0x36')][_0x9314('0x5a')]({'where':{'id':_0x4dadbf['params']['id']}})[_0x9314('0x2d')](handleEntityNotFound(_0x78d221,null))[_0x9314('0x2d')](function(_0x16c9d4){if(_0x16c9d4){_0x1361cf=_0x16c9d4;_0x3f3bf4[_0x9314('0x3e')]=_[_0x9314('0x3b')](db[_0x9314('0x5d')][_0x9314('0x37')]);_0x3f3bf4[_0x9314('0x3a')]=_['keys'](_0x4dadbf[_0x9314('0x3a')]);_0x3f3bf4[_0x9314('0x3c')]=_[_0x9314('0x3d')](_0x3f3bf4[_0x9314('0x3e')],_0x3f3bf4[_0x9314('0x3a')]);_0x5c7491[_0x9314('0x3f')]=_[_0x9314('0x3d')](_0x3f3bf4[_0x9314('0x3e')],qs['fields'](_0x4dadbf['query'][_0x9314('0x40')]));_0x5c7491[_0x9314('0x3f')]=_0x5c7491[_0x9314('0x3f')][_0x9314('0x41')]?_0x5c7491[_0x9314('0x3f')]:_0x3f3bf4[_0x9314('0x3e')];_0x5c7491[_0x9314('0x44')]=qs[_0x9314('0x45')](_0x4dadbf[_0x9314('0x3a')]['sort']);_0x5c7491[_0x9314('0x47')]=qs[_0x9314('0x3c')](_[_0x9314('0x46')](_0x4dadbf[_0x9314('0x3a')],_0x3f3bf4[_0x9314('0x3c')]));if(_0x4dadbf[_0x9314('0x3a')][_0x9314('0x4a')]){_0x5c7491[_0x9314('0x47')]=_[_0x9314('0x48')](_0x5c7491['where'],{'$or':_[_0x9314('0x35')](_0x5c7491['attributes'],function(_0x56b957){var _0x11ab08={};_0x11ab08[_0x56b957]={'$like':'%'+_0x4dadbf[_0x9314('0x3a')][_0x9314('0x4a')]+'%'};return _0x11ab08;})});}_0x5c7491=_[_0x9314('0x48')]({},_0x5c7491,_0x4dadbf[_0x9314('0x4b')]);return _0x1361cf[_0x9314('0x8f')](_0x5c7491);}})[_0x9314('0x2d')](function(_0xc32630){if(_0xc32630){_0x5b26d2=_0xc32630[_0x9314('0x41')];if(!_0x4dadbf['query'][_0x9314('0x42')](_0x9314('0x43'))){_0x5c7491['limit']=qs[_0x9314('0x27')](_0x4dadbf[_0x9314('0x3a')][_0x9314('0x27')]);_0x5c7491[_0x9314('0x24')]=qs[_0x9314('0x24')](_0x4dadbf[_0x9314('0x3a')][_0x9314('0x24')]);}return _0x1361cf[_0x9314('0x8f')](_0x5c7491);}})['then'](function(_0x5c4fcf){if(_0x5c4fcf){return _0x5c4fcf?{'count':_0x5b26d2,'rows':_0x5c4fcf}:null;}})[_0x9314('0x2d')](respondWithResult(_0x78d221,null))[_0x9314('0x4f')](handleError(_0x78d221,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 19a451d..39a4210 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 _0x293d=['hook','exports','events','MailQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x4e0897,_0x130f05){var _0x26e327=function(_0xfe536e){while(--_0xfe536e){_0x4e0897['push'](_0x4e0897['shift']());}};_0x26e327(++_0x130f05);}(_0x293d,0x119));var _0xd293=function(_0x59f99f,_0x1d6ed3){_0x59f99f=_0x59f99f-0x0;var _0x1e6165=_0x293d[_0x59f99f];return _0x1e6165;};'use strict';var EventEmitter=require(_0xd293('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xd293('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd293('0x2'),'afterUpdate':_0xd293('0x3'),'afterDestroy':_0xd293('0x4')};function emitEvent(_0x1238f5){return function(_0x58ed5f,_0x51f416,_0x2981ae){MailQueueEvents[_0xd293('0x5')](_0x1238f5+':'+_0x58ed5f['id'],_0x58ed5f);MailQueueEvents['emit'](_0x1238f5,_0x58ed5f);_0x2981ae(null);};}for(var e in events){if(events[_0xd293('0x6')](e)){var event=events[e];MailQueue[_0xd293('0x7')](e,emitEvent(event));}}module[_0xd293('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x4bd9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x4bd9,0x19f));var _0x94bd=function(_0x5b19da,_0x5d5d66){_0x5b19da=_0x5b19da-0x0;var _0x2608ed=_0x4bd9[_0x5b19da];return _0x2608ed;};'use strict';var EventEmitter=require(_0x94bd('0x0'));var MailQueue=require(_0x94bd('0x1'))['db'][_0x94bd('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x94bd('0x3')](0x0);var events={'afterCreate':_0x94bd('0x4'),'afterUpdate':_0x94bd('0x5'),'afterDestroy':_0x94bd('0x6')};function emitEvent(_0x1cf5d0){return function(_0x1d2400,_0x211196,_0x59e754){MailQueueEvents[_0x94bd('0x7')](_0x1cf5d0+':'+_0x1d2400['id'],_0x1d2400);MailQueueEvents[_0x94bd('0x7')](_0x1cf5d0,_0x1d2400);_0x59e754(null);};}for(var e in events){if(events[_0x94bd('0x8')](e)){var event=events[e];MailQueue[_0x94bd('0x9')](e,emitEvent(event));}}module[_0x94bd('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6711fda..09fa4aa 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 _0x9d9c=['MailQueue','mail_queues','api','moment','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x2aeffc,_0x4ec534){var _0x2a0d1f=function(_0x4fd7bb){while(--_0x4fd7bb){_0x2aeffc['push'](_0x2aeffc['shift']());}};_0x2a0d1f(++_0x4ec534);}(_0x9d9c,0x7a));var _0xc9d9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9d9c[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc9d9('0x0'));var moment=require(_0xc9d9('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9d9('0x2'));var rimraf=require(_0xc9d9('0x3'));var config=require(_0xc9d9('0x4'));var attributes=require(_0xc9d9('0x5'));module[_0xc9d9('0x6')]=function(_0x331e91,_0x1ae5bf){return _0x331e91[_0xc9d9('0x7')](_0xc9d9('0x8'),attributes,{'tableName':_0xc9d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3cb=['define','mail_queues','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3cb,0x18e));var _0xbd3c=function(_0x49ee6b,_0x322613){_0x49ee6b=_0x49ee6b-0x0;var _0x5bc3ba=_0xd3cb[_0x49ee6b];return _0x5bc3ba;};'use strict';var _=require(_0xbd3c('0x0'));var util=require(_0xbd3c('0x1'));var logger=require(_0xbd3c('0x2'))(_0xbd3c('0x3'));var moment=require('moment');var BPromise=require(_0xbd3c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd3c('0x5'));var rimraf=require('rimraf');var config=require(_0xbd3c('0x6'));var attributes=require(_0xbd3c('0x7'));module[_0xbd3c('0x8')]=function(_0x1efc09,_0x454e0f){return _0x1efc09[_0xbd3c('0x9')]('MailQueue',attributes,{'tableName':_0xbd3c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index ea31a12..83a78cb 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 _0x6ed3=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailQueue','findAll','options','raw','where','include','map','model','attributes','GetMailQueue','catch','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','register','request','then','info'];(function(_0x246a9c,_0x4df087){var _0x4bd0b3=function(_0x4558c6){while(--_0x4558c6){_0x246a9c['push'](_0x246a9c['shift']());}};_0x4bd0b3(++_0x4df087);}(_0x6ed3,0x1d9));var _0x36ed=function(_0x5d937c,_0x52963a){_0x5d937c=_0x5d937c-0x0;var _0x680f0a=_0x6ed3[_0x5d937c];return _0x680f0a;};'use strict';var _=require(_0x36ed('0x0'));var util=require('util');var moment=require(_0x36ed('0x1'));var BPromise=require(_0x36ed('0x2'));var rs=require(_0x36ed('0x3'));var fs=require('fs');var Redis=require(_0x36ed('0x4'));var db=require(_0x36ed('0x5'))['db'];var utils=require(_0x36ed('0x6'));var logger=require(_0x36ed('0x7'))(_0x36ed('0x8'));var config=require(_0x36ed('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x36ed('0xa')]['http']({'port':0x232a});config[_0x36ed('0xb')]=_[_0x36ed('0xc')](config[_0x36ed('0xb')],{'host':_0x36ed('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36ed('0xb')]));require(_0x36ed('0xe'))[_0x36ed('0xf')](socket);function respondWithRpcPromise(_0x2583b8,_0x5cdbb8,_0x5520d9){return new BPromise(function(_0x242745,_0x20d250){return client[_0x36ed('0x10')](_0x2583b8,_0x5520d9)[_0x36ed('0x11')](function(_0x4187fe){logger[_0x36ed('0x12')](_0x36ed('0x13'),_0x5cdbb8,_0x36ed('0x14'));logger[_0x36ed('0x15')](_0x36ed('0x16'),_0x5cdbb8,_0x36ed('0x14'),JSON[_0x36ed('0x17')](_0x4187fe));if(_0x4187fe[_0x36ed('0x18')]){if(_0x4187fe[_0x36ed('0x18')][_0x36ed('0x19')]===0x1f4){logger[_0x36ed('0x18')](_0x36ed('0x13'),_0x5cdbb8,_0x4187fe['error'][_0x36ed('0x1a')]);return _0x20d250(_0x4187fe[_0x36ed('0x18')]['message']);}logger[_0x36ed('0x18')](_0x36ed('0x13'),_0x5cdbb8,_0x4187fe[_0x36ed('0x18')][_0x36ed('0x1a')]);return _0x242745(_0x4187fe['error']['message']);}else{logger[_0x36ed('0x12')](_0x36ed('0x13'),_0x5cdbb8,_0x36ed('0x14'));_0x242745(_0x4187fe[_0x36ed('0x1b')]['message']);}})['catch'](function(_0x3abf89){logger[_0x36ed('0x18')](_0x36ed('0x13'),_0x5cdbb8,_0x3abf89);_0x20d250(_0x3abf89);});});}exports['GetMailQueue']=function(_0x2d33cb){var _0x1d0647=this;return new Promise(function(_0x288c8f,_0x420db2){return db[_0x36ed('0x1c')][_0x36ed('0x1d')]({'raw':_0x2d33cb['options']?_0x2d33cb[_0x36ed('0x1e')][_0x36ed('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb['options'][_0x36ed('0x20')]||null:null,'attributes':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb['options']['attributes']||null:null,'limit':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb['options']['limit']||null:null,'include':_0x2d33cb[_0x36ed('0x1e')]?_0x2d33cb[_0x36ed('0x1e')][_0x36ed('0x21')]?_[_0x36ed('0x22')](_0x2d33cb[_0x36ed('0x1e')][_0x36ed('0x21')],function(_0x36b4ca){return{'model':db[_0x36b4ca[_0x36ed('0x23')]],'as':_0x36b4ca['as'],'attributes':_0x36b4ca[_0x36ed('0x24')],'include':_0x36b4ca['include']?_[_0x36ed('0x22')](_0x36b4ca['include'],function(_0x2e76d8){return{'model':db[_0x2e76d8[_0x36ed('0x23')]],'as':_0x2e76d8['as'],'attributes':_0x2e76d8['attributes'],'include':_0x2e76d8[_0x36ed('0x21')]?_[_0x36ed('0x22')](_0x2e76d8[_0x36ed('0x21')],function(_0x211069){return{'model':db[_0x211069['model']],'as':_0x211069['as'],'attributes':_0x211069[_0x36ed('0x24')]};}):[]};}):[]};}):[]:[]})[_0x36ed('0x11')](function(_0xd8dfe4){logger[_0x36ed('0x12')]('GetMailQueue',_0x2d33cb);logger[_0x36ed('0x15')](_0x36ed('0x25'),_0x2d33cb,JSON[_0x36ed('0x17')](_0xd8dfe4));_0x288c8f(_0xd8dfe4);})[_0x36ed('0x26')](function(_0x57f8bd){logger[_0x36ed('0x18')](_0x36ed('0x25'),_0x57f8bd[_0x36ed('0x1a')],_0x2d33cb);_0x420db2(_0x1d0647['error'](0x1f4,_0x57f8bd[_0x36ed('0x1a')]));});});};exports[_0x36ed('0x27')]=function(_0x3674b0){var _0x5df32b=this;return new Promise(function(_0x3fb728,_0x560ddf){return db['MailQueue'][_0x36ed('0x28')]({'raw':_0x3674b0[_0x36ed('0x1e')]?_0x3674b0[_0x36ed('0x1e')][_0x36ed('0x1f')]===undefined?!![]:![]:!![],'where':_0x3674b0['options']?_0x3674b0['options'][_0x36ed('0x20')]||null:null,'attributes':_0x3674b0['options']?_0x3674b0['options'][_0x36ed('0x24')]||null:null,'include':_0x3674b0[_0x36ed('0x1e')]?_0x3674b0[_0x36ed('0x1e')][_0x36ed('0x21')]?_[_0x36ed('0x22')](_0x3674b0[_0x36ed('0x1e')][_0x36ed('0x21')],function(_0x17e827){return{'model':db[_0x17e827['model']],'as':_0x17e827['as'],'attributes':_0x17e827[_0x36ed('0x24')],'include':_0x17e827['include']?_[_0x36ed('0x22')](_0x17e827[_0x36ed('0x21')],function(_0x31cb40){return{'model':db[_0x31cb40[_0x36ed('0x23')]],'as':_0x31cb40['as'],'attributes':_0x31cb40[_0x36ed('0x24')],'include':_0x31cb40[_0x36ed('0x21')]?_['map'](_0x31cb40[_0x36ed('0x21')],function(_0xcb13a2){return{'model':db[_0xcb13a2[_0x36ed('0x23')]],'as':_0xcb13a2['as'],'attributes':_0xcb13a2[_0x36ed('0x24')]};}):[]};}):[]};}):[]:[]})[_0x36ed('0x11')](function(_0x399de6){logger[_0x36ed('0x12')](_0x36ed('0x27'),_0x3674b0);logger[_0x36ed('0x15')](_0x36ed('0x27'),_0x3674b0,JSON[_0x36ed('0x17')](_0x399de6));_0x3fb728(_0x399de6);})[_0x36ed('0x26')](function(_0x596961){logger['error'](_0x36ed('0x27'),_0x596961['message'],_0x3674b0);_0x560ddf(_0x5df32b[_0x36ed('0x18')](0x1f4,_0x596961[_0x36ed('0x1a')]));});});}; \ No newline at end of file +var _0x3934=['map','debug','where','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','model'];(function(_0x17f7ed,_0x57cb76){var _0x8dbee6=function(_0x4c518e){while(--_0x4c518e){_0x17f7ed['push'](_0x17f7ed['shift']());}};_0x8dbee6(++_0x57cb76);}(_0x3934,0x10e));var _0x4393=function(_0x12bf44,_0x326a55){_0x12bf44=_0x12bf44-0x0;var _0x5d94b1=_0x3934[_0x12bf44];return _0x5d94b1;};'use strict';var _=require(_0x4393('0x0'));var util=require(_0x4393('0x1'));var moment=require(_0x4393('0x2'));var BPromise=require(_0x4393('0x3'));var rs=require(_0x4393('0x4'));var fs=require('fs');var Redis=require(_0x4393('0x5'));var db=require(_0x4393('0x6'))['db'];var utils=require(_0x4393('0x7'));var logger=require(_0x4393('0x8'))(_0x4393('0x9'));var config=require('../../config/environment');var jayson=require(_0x4393('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x4393('0xb')]=_[_0x4393('0xc')](config[_0x4393('0xb')],{'host':_0x4393('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4393('0xb')]));require('./mailQueue.socket')[_0x4393('0xe')](socket);function respondWithRpcPromise(_0x5687f8,_0x807b86,_0x51c68c){return new BPromise(function(_0x5099e9,_0x5e6b73){return client[_0x4393('0xf')](_0x5687f8,_0x51c68c)[_0x4393('0x10')](function(_0x4cd00c){logger['info'](_0x4393('0x11'),_0x807b86,_0x4393('0x12'));logger['debug'](_0x4393('0x13'),_0x807b86,_0x4393('0x12'),JSON[_0x4393('0x14')](_0x4cd00c));if(_0x4cd00c[_0x4393('0x15')]){if(_0x4cd00c[_0x4393('0x15')]['code']===0x1f4){logger[_0x4393('0x15')](_0x4393('0x11'),_0x807b86,_0x4cd00c[_0x4393('0x15')]['message']);return _0x5e6b73(_0x4cd00c['error'][_0x4393('0x16')]);}logger[_0x4393('0x15')]('MailQueue,\x20%s,\x20%s',_0x807b86,_0x4cd00c[_0x4393('0x15')][_0x4393('0x16')]);return _0x5099e9(_0x4cd00c[_0x4393('0x15')][_0x4393('0x16')]);}else{logger[_0x4393('0x17')](_0x4393('0x11'),_0x807b86,_0x4393('0x12'));_0x5099e9(_0x4cd00c[_0x4393('0x18')][_0x4393('0x16')]);}})[_0x4393('0x19')](function(_0x45fb24){logger['error']('MailQueue,\x20%s,\x20%s',_0x807b86,_0x45fb24);_0x5e6b73(_0x45fb24);});});}exports[_0x4393('0x1a')]=function(_0xade61c){var _0x5b5d46=this;return new Promise(function(_0x4a27a4,_0x29e935){return db[_0x4393('0x1b')][_0x4393('0x1c')]({'raw':_0xade61c[_0x4393('0x1d')]?_0xade61c[_0x4393('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xade61c[_0x4393('0x1d')]?_0xade61c['options']['where']||null:null,'attributes':_0xade61c[_0x4393('0x1d')]?_0xade61c[_0x4393('0x1d')][_0x4393('0x1e')]||null:null,'limit':_0xade61c[_0x4393('0x1d')]?_0xade61c[_0x4393('0x1d')][_0x4393('0x1f')]||null:null,'include':_0xade61c[_0x4393('0x1d')]?_0xade61c[_0x4393('0x1d')]['include']?_['map'](_0xade61c[_0x4393('0x1d')][_0x4393('0x20')],function(_0xc195b9){return{'model':db[_0xc195b9[_0x4393('0x21')]],'as':_0xc195b9['as'],'attributes':_0xc195b9[_0x4393('0x1e')],'include':_0xc195b9['include']?_[_0x4393('0x22')](_0xc195b9[_0x4393('0x20')],function(_0x4b56f0){return{'model':db[_0x4b56f0[_0x4393('0x21')]],'as':_0x4b56f0['as'],'attributes':_0x4b56f0[_0x4393('0x1e')],'include':_0x4b56f0['include']?_[_0x4393('0x22')](_0x4b56f0[_0x4393('0x20')],function(_0x11cf86){return{'model':db[_0x11cf86[_0x4393('0x21')]],'as':_0x11cf86['as'],'attributes':_0x11cf86['attributes']};}):[]};}):[]};}):[]:[]})[_0x4393('0x10')](function(_0x2ff251){logger[_0x4393('0x17')](_0x4393('0x1a'),_0xade61c);logger[_0x4393('0x23')]('GetMailQueue',_0xade61c,JSON[_0x4393('0x14')](_0x2ff251));_0x4a27a4(_0x2ff251);})[_0x4393('0x19')](function(_0x396b68){logger[_0x4393('0x15')](_0x4393('0x1a'),_0x396b68[_0x4393('0x16')],_0xade61c);_0x29e935(_0x5b5d46[_0x4393('0x15')](0x1f4,_0x396b68[_0x4393('0x16')]));});});};exports['ShowMailQueue']=function(_0x3988cb){var _0x40b297=this;return new Promise(function(_0x6c6373,_0xb0f04f){return db[_0x4393('0x1b')]['find']({'raw':_0x3988cb['options']?_0x3988cb[_0x4393('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3988cb[_0x4393('0x1d')]?_0x3988cb[_0x4393('0x1d')][_0x4393('0x24')]||null:null,'attributes':_0x3988cb[_0x4393('0x1d')]?_0x3988cb[_0x4393('0x1d')][_0x4393('0x1e')]||null:null,'include':_0x3988cb[_0x4393('0x1d')]?_0x3988cb['options'][_0x4393('0x20')]?_[_0x4393('0x22')](_0x3988cb[_0x4393('0x1d')][_0x4393('0x20')],function(_0x308044){return{'model':db[_0x308044[_0x4393('0x21')]],'as':_0x308044['as'],'attributes':_0x308044[_0x4393('0x1e')],'include':_0x308044['include']?_['map'](_0x308044[_0x4393('0x20')],function(_0xd27081){return{'model':db[_0xd27081[_0x4393('0x21')]],'as':_0xd27081['as'],'attributes':_0xd27081[_0x4393('0x1e')],'include':_0xd27081[_0x4393('0x20')]?_[_0x4393('0x22')](_0xd27081[_0x4393('0x20')],function(_0x5d9954){return{'model':db[_0x5d9954[_0x4393('0x21')]],'as':_0x5d9954['as'],'attributes':_0x5d9954[_0x4393('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x236796){logger[_0x4393('0x17')](_0x4393('0x25'),_0x3988cb);logger[_0x4393('0x23')](_0x4393('0x25'),_0x3988cb,JSON[_0x4393('0x14')](_0x236796));_0x6c6373(_0x236796);})[_0x4393('0x19')](function(_0x4fa0c5){logger[_0x4393('0x15')](_0x4393('0x25'),_0x4fa0c5['message'],_0x3988cb);_0xb0f04f(_0x40b297[_0x4393('0x15')](0x1f4,_0x4fa0c5[_0x4393('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b19a716..cbe4d13 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 _0xa8d7=['./mailQueue.events','save','remove','emit','mailQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8d7,0x1b8));var _0x7a8d=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xa8d7[_0x15cdcb];return _0x37b069;};'use strict';var MailQueueEvents=require(_0x7a8d('0x0'));var events=[_0x7a8d('0x1'),_0x7a8d('0x2'),'update'];function createListener(_0x46011e,_0x2119f5){return function(_0x14b272){_0x2119f5[_0x7a8d('0x3')](_0x46011e,_0x14b272);};}function removeListener(_0x31333e,_0x1b5efa){return function(){MailQueueEvents['removeListener'](_0x31333e,_0x1b5efa);};}exports['register']=function(_0x105da1){for(var _0x59b715=0x0,_0x464b56=events['length'];_0x59b715<_0x464b56;_0x59b715++){var _0x55a22e=events[_0x59b715];var _0x369d57=createListener(_0x7a8d('0x4')+_0x55a22e,_0x105da1);MailQueueEvents['on'](_0x55a22e,_0x369d57);}}; \ No newline at end of file +var _0x57e6=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0xa1afcb,_0x1d4d02){var _0x25555e=function(_0x2b8b16){while(--_0x2b8b16){_0xa1afcb['push'](_0xa1afcb['shift']());}};_0x25555e(++_0x1d4d02);}(_0x57e6,0x177));var _0x657e=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x57e6[_0x2e249d];return _0x1faa37;};'use strict';var MailQueueEvents=require(_0x657e('0x0'));var events=[_0x657e('0x1'),_0x657e('0x2'),_0x657e('0x3')];function createListener(_0x520ec0,_0x7980e0){return function(_0x48a582){_0x7980e0[_0x657e('0x4')](_0x520ec0,_0x48a582);};}function removeListener(_0x773dd8,_0x3324d3){return function(){MailQueueEvents[_0x657e('0x5')](_0x773dd8,_0x3324d3);};}exports[_0x657e('0x6')]=function(_0x24708a){for(var _0x3521b1=0x0,_0x4358f1=events[_0x657e('0x7')];_0x3521b1<_0x4358f1;_0x3521b1++){var _0x440667=events[_0x3521b1];var _0x12807d=createListener(_0x657e('0x8')+_0x440667,_0x24708a);MailQueueEvents['on'](_0x440667,_0x12807d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 58594a3..8ce2166 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 _0xaea8=['update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put'];(function(_0x5e4e4a,_0xf6ef74){var _0x4bec11=function(_0x54dd7c){while(--_0x54dd7c){_0x5e4e4a['push'](_0x5e4e4a['shift']());}};_0x4bec11(++_0xf6ef74);}(_0xaea8,0xdf));var _0x8aea=function(_0x2d4490,_0xa2e671){_0x2d4490=_0x2d4490-0x0;var _0x3f98df=_0xaea8[_0x2d4490];return _0x3f98df;};'use strict';var multer=require(_0x8aea('0x0'));var util=require(_0x8aea('0x1'));var path=require('path');var timeout=require(_0x8aea('0x2'));var express=require(_0x8aea('0x3'));var router=express['Router']();var fs_extra=require(_0x8aea('0x4'));var auth=require(_0x8aea('0x5'));var interaction=require(_0x8aea('0x6'));var config=require(_0x8aea('0x7'));var controller=require(_0x8aea('0x8'));router[_0x8aea('0x9')]('/',auth[_0x8aea('0xa')](),controller[_0x8aea('0xb')]);router[_0x8aea('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8aea('0xc')]);router['get'](_0x8aea('0xd'),auth[_0x8aea('0xa')](),controller[_0x8aea('0xe')]);router['post']('/',auth[_0x8aea('0xa')](),controller[_0x8aea('0xf')]);router[_0x8aea('0x10')](_0x8aea('0xd'),auth[_0x8aea('0xa')](),controller[_0x8aea('0x11')]);router[_0x8aea('0x12')](_0x8aea('0xd'),auth[_0x8aea('0xa')](),controller[_0x8aea('0x13')]);module['exports']=router; \ No newline at end of file +var _0xae42=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','update','destroy'];(function(_0x1230b8,_0x1c6702){var _0x2e0bc7=function(_0x1c7df4){while(--_0x1c7df4){_0x1230b8['push'](_0x1230b8['shift']());}};_0x2e0bc7(++_0x1c6702);}(_0xae42,0xa1));var _0x2ae4=function(_0x49d9b8,_0x567967){_0x49d9b8=_0x49d9b8-0x0;var _0x381325=_0xae42[_0x49d9b8];return _0x381325;};'use strict';var multer=require(_0x2ae4('0x0'));var util=require(_0x2ae4('0x1'));var path=require('path');var timeout=require(_0x2ae4('0x2'));var express=require('express');var router=express[_0x2ae4('0x3')]();var fs_extra=require(_0x2ae4('0x4'));var auth=require(_0x2ae4('0x5'));var interaction=require(_0x2ae4('0x6'));var config=require(_0x2ae4('0x7'));var controller=require(_0x2ae4('0x8'));router['get']('/',auth[_0x2ae4('0x9')](),controller[_0x2ae4('0xa')]);router[_0x2ae4('0xb')]('/describe',auth[_0x2ae4('0x9')](),controller[_0x2ae4('0xc')]);router['get'](_0x2ae4('0xd'),auth[_0x2ae4('0x9')](),controller[_0x2ae4('0xe')]);router[_0x2ae4('0xf')]('/',auth[_0x2ae4('0x9')](),controller[_0x2ae4('0x10')]);router['put'](_0x2ae4('0xd'),auth[_0x2ae4('0x9')](),controller[_0x2ae4('0x11')]);router['delete'](_0x2ae4('0xd'),auth['isAuthenticated'](),controller[_0x2ae4('0x12')]);module[_0x2ae4('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d9284b1..605c681 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 _0xc3a1=['STRING','DATE','moment','exports'];(function(_0x240dce,_0x2b293c){var _0x371546=function(_0x2d32e5){while(--_0x2d32e5){_0x240dce['push'](_0x240dce['shift']());}};_0x371546(++_0x2b293c);}(_0xc3a1,0x102));var _0x1c3a=function(_0x4d16d2,_0x322c9a){_0x4d16d2=_0x4d16d2-0x0;var _0x277186=_0xc3a1[_0x4d16d2];return _0x277186;};'use strict';var moment=require(_0x1c3a('0x0'));var Sequelize=require('sequelize');module[_0x1c3a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1c3a('0x2')]},'joinAt':{'type':Sequelize[_0x1c3a('0x3')]},'leaveAt':{'type':Sequelize[_0x1c3a('0x3')]},'acceptAt':{'type':Sequelize[_0x1c3a('0x3')]},'exitAt':{'type':Sequelize[_0x1c3a('0x3')]},'reason':{'type':Sequelize[_0x1c3a('0x2')]}}; \ No newline at end of file +var _0x4f80=['exports','STRING','DATE','moment','sequelize'];(function(_0x43192f,_0x45e191){var _0x227deb=function(_0x58a9c4){while(--_0x58a9c4){_0x43192f['push'](_0x43192f['shift']());}};_0x227deb(++_0x45e191);}(_0x4f80,0xcb));var _0x04f8=function(_0x57cc16,_0x444378){_0x57cc16=_0x57cc16-0x0;var _0x5421e5=_0x4f80[_0x57cc16];return _0x5421e5;};'use strict';var moment=require(_0x04f8('0x0'));var Sequelize=require(_0x04f8('0x1'));module[_0x04f8('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x04f8('0x3')]},'joinAt':{'type':Sequelize[_0x04f8('0x4')]},'leaveAt':{'type':Sequelize[_0x04f8('0x4')]},'acceptAt':{'type':Sequelize[_0x04f8('0x4')]},'exitAt':{'type':Sequelize[_0x04f8('0x4')]},'reason':{'type':Sequelize[_0x04f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index efd54cf..2b2370d 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 _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','MailQueueReport','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x896e,0x1e9));var _0xe896=function(_0x17a531,_0x5d2dd7){_0x17a531=_0x17a531-0x0;var _0xc8c23=_0x896e[_0x17a531];return _0xc8c23;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['MailQueueReport'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':!![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['MailQueueReport'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file +var _0x3a6d=['keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','type','options','includeAll','rows','catch','params','rawAttributes','merge','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','MailQueueReport','fieldName','key','query'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3a6d,0x143));var _0xd3a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3a6d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0467,_0x1c6ad7){_0x1c6ad7=_0x1c6ad7||0xcc;return function(_0x671004){if(_0x671004){return _0x4b0467[_0xd3a6('0x1a')](_0x1c6ad7);}return _0x4b0467[_0xd3a6('0x1b')](_0x1c6ad7)[_0xd3a6('0x1c')]();};}function respondWithResult(_0x2911a0,_0xa56452){_0xa56452=_0xa56452||0xc8;return function(_0x4e67fb){if(_0x4e67fb){return _0x2911a0[_0xd3a6('0x1b')](_0xa56452)[_0xd3a6('0x1d')](_0x4e67fb);}};}function respondWithFilteredResult(_0x171a8f,_0x500a37){return function(_0x3c2399){if(_0x3c2399){var _0x305b61=typeof _0x500a37[_0xd3a6('0x1e')]==='undefined'&&typeof _0x500a37[_0xd3a6('0x1f')]==='undefined';var _0x518b6d=_0x3c2399[_0xd3a6('0x20')];var _0x8d1286=_0x305b61?0x0:_0x500a37[_0xd3a6('0x1e')];var _0xbe58b4=_0x305b61?_0x3c2399[_0xd3a6('0x20')]:_0x500a37[_0xd3a6('0x1e')]+_0x500a37[_0xd3a6('0x1f')];var _0x4ec27c;if(_0xbe58b4>=_0x518b6d){_0xbe58b4=_0x518b6d;_0x4ec27c=0xc8;}else{_0x4ec27c=0xce;}_0x171a8f[_0xd3a6('0x1b')](_0x4ec27c);return _0x171a8f['set'](_0xd3a6('0x21'),_0x8d1286+'-'+_0xbe58b4+'/'+_0x518b6d)[_0xd3a6('0x1d')](_0x3c2399);}return null;};}function patchUpdates(_0x12f2c1){return function(_0x20a34e){try{jsonpatch[_0xd3a6('0x22')](_0x20a34e,_0x12f2c1,!![]);}catch(_0x6ecd88){return BPromise['reject'](_0x6ecd88);}return _0x20a34e[_0xd3a6('0x23')]();};}function saveUpdates(_0x422f5c,_0x57cf15){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a['update'](_0x422f5c)['then'](function(_0x5c9075){return _0x5c9075;});}return null;};}function removeEntity(_0x98a12a,_0x400982){return function(_0x3d0b28){if(_0x3d0b28){return _0x3d0b28['destroy']()[_0xd3a6('0x24')](function(){_0x98a12a['status'](0xcc)[_0xd3a6('0x1c')]();});}};}function handleEntityNotFound(_0x16afc8,_0x429079){return function(_0x4f6130){if(!_0x4f6130){_0x16afc8[_0xd3a6('0x1a')](0x194);}return _0x4f6130;};}function handleError(_0x3bc8d1,_0x1b09ac){_0x1b09ac=_0x1b09ac||0x1f4;return function(_0x219e32){logger[_0xd3a6('0x25')](_0x219e32[_0xd3a6('0x26')]);if(_0x219e32['name']){delete _0x219e32[_0xd3a6('0x27')];}_0x3bc8d1[_0xd3a6('0x1b')](_0x1b09ac)[_0xd3a6('0x28')](_0x219e32);};}exports[_0xd3a6('0x29')]=function(_0x30abc2,_0x45c628){var _0x5c2186={},_0x535bd4={},_0x1f4859={'count':0x0,'rows':[]};var _0x210aa1=_[_0xd3a6('0x2a')](db[_0xd3a6('0x2b')]['rawAttributes'],function(_0x3de3bb){return{'name':_0x3de3bb[_0xd3a6('0x2c')],'type':_0x3de3bb['type'][_0xd3a6('0x2d')]};});_0x535bd4['model']=_[_0xd3a6('0x2a')](_0x210aa1,_0xd3a6('0x27'));_0x535bd4[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x30abc2[_0xd3a6('0x2e')]);_0x535bd4[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x535bd4['model'],_0x535bd4['query']);_0x5c2186[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x535bd4[_0xd3a6('0x33')],qs['fields'](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x5c2186[_0xd3a6('0x32')]=_0x5c2186[_0xd3a6('0x32')][_0xd3a6('0x35')]?_0x5c2186[_0xd3a6('0x32')]:_0x535bd4[_0xd3a6('0x33')];if(!_0x30abc2[_0xd3a6('0x2e')]['hasOwnProperty'](_0xd3a6('0x36'))){_0x5c2186[_0xd3a6('0x1f')]=qs[_0xd3a6('0x1f')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x1f')]);_0x5c2186[_0xd3a6('0x1e')]=qs['offset'](_0x30abc2[_0xd3a6('0x2e')]['offset']);}_0x5c2186[_0xd3a6('0x37')]=qs[_0xd3a6('0x38')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x38')]);_0x5c2186['where']=qs['filters'](_[_0xd3a6('0x39')](_0x30abc2[_0xd3a6('0x2e')],_0x535bd4[_0xd3a6('0x30')]),_0x210aa1);if(_0x30abc2['query'][_0xd3a6('0x3a')]){_0x5c2186[_0xd3a6('0x3b')]=_['merge'](_0x5c2186[_0xd3a6('0x3b')],{'$or':_['map'](_0x210aa1,function(_0x1e695a){if(_0x1e695a[_0xd3a6('0x3c')]!=='VIRTUAL'){var _0x219ba5={};_0x219ba5[_0x1e695a['name']]={'$like':'%'+_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3a')]+'%'};return _0x219ba5;}})});}_0x5c2186=_['merge']({},_0x5c2186,_0x30abc2[_0xd3a6('0x3d')]);var _0xfcef03={'where':_0x5c2186[_0xd3a6('0x3b')]};return db[_0xd3a6('0x2b')]['count'](_0xfcef03)[_0xd3a6('0x24')](function(_0x324dbd){_0x1f4859[_0xd3a6('0x20')]=_0x324dbd;if(_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x5c2186['include']=[{'all':!![]}];}return db[_0xd3a6('0x2b')]['findAll'](_0x5c2186);})[_0xd3a6('0x24')](function(_0x1bc18a){_0x1f4859[_0xd3a6('0x3f')]=_0x1bc18a;return _0x1f4859;})['then'](respondWithFilteredResult(_0x45c628,_0x5c2186))[_0xd3a6('0x40')](handleError(_0x45c628,null));};exports['show']=function(_0x23aa99,_0x4cbf76){var _0x448213={'raw':!![],'where':{'id':_0x23aa99[_0xd3a6('0x41')]['id']}},_0x629153={};_0x629153[_0xd3a6('0x33')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x2b')][_0xd3a6('0x42')]);_0x629153['query']=_[_0xd3a6('0x2f')](_0x23aa99[_0xd3a6('0x2e')]);_0x629153[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x629153['model'],_0x629153[_0xd3a6('0x2e')]);_0x448213[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x629153[_0xd3a6('0x33')],qs[_0xd3a6('0x34')](_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x448213[_0xd3a6('0x32')]=_0x448213['attributes'][_0xd3a6('0x35')]?_0x448213[_0xd3a6('0x32')]:_0x629153[_0xd3a6('0x33')];if(_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x448213['include']=[{'all':!![]}];}_0x448213=_[_0xd3a6('0x43')]({},_0x448213,_0x23aa99[_0xd3a6('0x3d')]);return db[_0xd3a6('0x2b')][_0xd3a6('0x44')](_0x448213)[_0xd3a6('0x24')](handleEntityNotFound(_0x4cbf76,null))[_0xd3a6('0x24')](respondWithResult(_0x4cbf76,null))[_0xd3a6('0x40')](handleError(_0x4cbf76,null));};exports[_0xd3a6('0x45')]=function(_0x4ac576,_0x7828c2){return db['MailQueueReport'][_0xd3a6('0x45')](_0x4ac576[_0xd3a6('0x46')],{})['then'](respondWithResult(_0x7828c2,0xc9))[_0xd3a6('0x40')](handleError(_0x7828c2,null));};exports[_0xd3a6('0x47')]=function(_0x3cf99a,_0x375067){if(_0x3cf99a[_0xd3a6('0x46')]['id']){delete _0x3cf99a[_0xd3a6('0x46')]['id'];}return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x3cf99a[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x375067,null))['then'](saveUpdates(_0x3cf99a[_0xd3a6('0x46')],null))[_0xd3a6('0x24')](respondWithResult(_0x375067,null))[_0xd3a6('0x40')](handleError(_0x375067,null));};exports[_0xd3a6('0x48')]=function(_0x26bd65,_0x225393){return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x26bd65[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x225393,null))['then'](removeEntity(_0x225393,null))[_0xd3a6('0x40')](handleError(_0x225393,null));};exports[_0xd3a6('0x49')]=function(_0x618b72,_0x4995b7){return db[_0xd3a6('0x2b')]['describe']()['then'](respondWithResult(_0x4995b7,null))['catch'](handleError(_0x4995b7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2159e14..0158bb0 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 _0xf7f7=['rimraf','../../config/environment','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf7f7,0x192));var _0x7f7f=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xf7f7[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var logger=require(_0x7f7f('0x2'))(_0x7f7f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7f7f('0x4'));var fs=require('fs');var path=require(_0x7f7f('0x5'));var rimraf=require(_0x7f7f('0x6'));var config=require(_0x7f7f('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x7f7f('0x8')]=function(_0x899994,_0x1d0310){return _0x899994[_0x7f7f('0x9')]('MailQueueReport',attributes,{'tableName':_0x7f7f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f7f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b4=['exports','define','MailQueueReport','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x382987,_0x58058b){var _0x29eb57=function(_0x646f43){while(--_0x646f43){_0x382987['push'](_0x382987['shift']());}};_0x29eb57(++_0x58058b);}(_0xa7b4,0x70));var _0x4a7b=function(_0xd2d5f7,_0xf4e61d){_0xd2d5f7=_0xd2d5f7-0x0;var _0x78116e=_0xa7b4[_0xd2d5f7];return _0x78116e;};'use strict';var _=require(_0x4a7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4a7b('0x1'));var moment=require(_0x4a7b('0x2'));var BPromise=require(_0x4a7b('0x3'));var rp=require(_0x4a7b('0x4'));var fs=require('fs');var path=require(_0x4a7b('0x5'));var rimraf=require(_0x4a7b('0x6'));var config=require(_0x4a7b('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x4a7b('0x8')]=function(_0xd54173,_0x1fcdde){return _0xd54173[_0x4a7b('0x9')](_0x4a7b('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4a7b('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6403800..109f26c 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0xee8d9e,_0x87d380){var _0x558642=function(_0x591a92){while(--_0x591a92){_0xee8d9e['push'](_0xee8d9e['shift']());}};_0x558642(++_0x87d380);}(_0x7a54,0x106));var _0x47a5=function(_0x43701d,_0x3a0880){_0x43701d=_0x43701d-0x0;var _0x59e5b8=_0x7a54[_0x43701d];return _0x59e5b8;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x2646a5,_0x4c7180){var _0x2c8339=function(_0x8873ed){while(--_0x8873ed){_0x2646a5['push'](_0x2646a5['shift']());}};_0x2c8339(++_0x4c7180);}(_0xdb28,0x106));var _0x8db2=function(_0x18548e,_0x4de2f9){_0x18548e=_0x18548e-0x0;var _0x41349f=_0xdb28[_0x18548e];return _0x41349f;};'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')]('MailQueueReport,\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);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c601beb..34f503d 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1bbe0f,_0x511de8){var _0x3ce083=function(_0xf4f7ab){while(--_0xf4f7ab){_0x1bbe0f['push'](_0x1bbe0f['shift']());}};_0x3ce083(++_0x511de8);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ee336,_0x21bfbe){_0x5ee336=_0x5ee336-0x0;var _0x4ff51d=_0xedd9[_0x5ee336];return _0x4ff51d;};'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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30a8c3,_0x4b572f){var _0x52aad4=function(_0xbcb86b){while(--_0xbcb86b){_0x30a8c3['push'](_0x30a8c3['shift']());}};_0x52aad4(++_0x4b572f);}(_0xe706,0xa3));var _0x6e70=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0xe706[_0x31cb77];return _0x710374;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 0298a7c..b9497aa 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 _0x708a=['exports','BOOLEAN','INTEGER','STRING','INBOX','sequelize'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0x708a,0xa1));var _0xa708=function(_0x182e45,_0x3bdd0d){_0x182e45=_0x182e45-0x0;var _0x5ddda2=_0x708a[_0x182e45];return _0x5ddda2;};'use strict';var Sequelize=require(_0xa708('0x0'));module[_0xa708('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa708('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa708('0x3')]},'tls':{'type':Sequelize[_0xa708('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa708('0x4')],'defaultValue':_0xa708('0x5')},'connTimeout':{'type':Sequelize[_0xa708('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa708('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa708('0x4')]},'modernAuthentication':{'type':Sequelize[_0xa708('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x88a3=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0x88a3,0x190));var _0x388a=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x88a3[_0x277af0];return _0x43bd7c;};'use strict';var Sequelize=require(_0x388a('0x0'));module[_0x388a('0x1')]={'description':{'type':Sequelize[_0x388a('0x2')]},'host':{'type':Sequelize[_0x388a('0x2')]},'authentication':{'type':Sequelize[_0x388a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x388a('0x2')]},'password':{'type':Sequelize[_0x388a('0x2')]},'port':{'type':Sequelize[_0x388a('0x4')]},'tls':{'type':Sequelize[_0x388a('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x388a('0x2')],'defaultValue':_0x388a('0x5')},'connTimeout':{'type':Sequelize[_0x388a('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5b423c6..e055c9e 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 _0xb079=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0xb079,0x180));var _0x9b07=function(_0xae53d0,_0x4df51f){_0xae53d0=_0xae53d0-0x0;var _0x3c2f15=_0xb079[_0xae53d0];return _0x3c2f15;};'use strict';var _=require(_0x9b07('0x0'));var util=require(_0x9b07('0x1'));var logger=require(_0x9b07('0x2'))(_0x9b07('0x3'));var moment=require(_0x9b07('0x4'));var BPromise=require(_0x9b07('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9b07('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x9b07('0x7')]=function(_0x572ce8,_0x27fb81){return _0x572ce8[_0x9b07('0x8')](_0x9b07('0x9'),attributes,{'tableName':_0x9b07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x123f=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x4b06c1,_0x3faaf1){var _0x30cfa7=function(_0x5b625a){while(--_0x5b625a){_0x4b06c1['push'](_0x4b06c1['shift']());}};_0x30cfa7(++_0x3faaf1);}(_0x123f,0xc6));var _0xf123=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x123f[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0xf123('0x0'));var util=require(_0xf123('0x1'));var logger=require(_0xf123('0x2'))('api');var moment=require(_0xf123('0x3'));var BPromise=require('bluebird');var rp=require(_0xf123('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf123('0x5'));var config=require(_0xf123('0x6'));var attributes=require(_0xf123('0x7'));module[_0xf123('0x8')]=function(_0x41594b,_0x6f346f){return _0x41594b[_0xf123('0x9')](_0xf123('0xa'),attributes,{'tableName':_0xf123('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index feddf27..2988d1a 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 _0xf31a=['info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','debug','util','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','then'];(function(_0x408ca8,_0x1be575){var _0x2ebcf6=function(_0x541318){while(--_0x541318){_0x408ca8['push'](_0x408ca8['shift']());}};_0x2ebcf6(++_0x1be575);}(_0xf31a,0xaa));var _0xaf31=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf31a[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xaf31('0x0'));var moment=require(_0xaf31('0x1'));var BPromise=require(_0xaf31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf31('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf31('0x4'))(_0xaf31('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf31('0x6')][_0xaf31('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f2da3,_0x1ce3bf,_0xc89c79){return new BPromise(function(_0x501641,_0x1efd02){return client[_0xaf31('0x8')](_0x3f2da3,_0xc89c79)[_0xaf31('0x9')](function(_0x1949f7){logger[_0xaf31('0xa')](_0xaf31('0xb'),_0x1ce3bf,_0xaf31('0xc'));logger['debug'](_0xaf31('0xd'),_0x1ce3bf,_0xaf31('0xc'),JSON[_0xaf31('0xe')](_0x1949f7));if(_0x1949f7[_0xaf31('0xf')]){if(_0x1949f7['error'][_0xaf31('0x10')]===0x1f4){logger[_0xaf31('0xf')]('MailServerIn,\x20%s,\x20%s',_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x1efd02(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}logger[_0xaf31('0xf')](_0xaf31('0xb'),_0x1ce3bf,_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);return _0x501641(_0x1949f7[_0xaf31('0xf')][_0xaf31('0x11')]);}else{logger[_0xaf31('0xa')]('MailServerIn,\x20%s,\x20%s',_0x1ce3bf,_0xaf31('0xc'));_0x501641(_0x1949f7[_0xaf31('0x12')][_0xaf31('0x11')]);}})[_0xaf31('0x13')](function(_0x2b3e42){logger['error'](_0xaf31('0xb'),_0x1ce3bf,_0x2b3e42);_0x1efd02(_0x2b3e42);});});}exports[_0xaf31('0x14')]=function(_0x1c55e8){var _0x49da39=this;return new Promise(function(_0x362995,_0x2a3e3b){return db[_0xaf31('0x15')][_0xaf31('0x16')]({'raw':_0x1c55e8['options']?_0x1c55e8[_0xaf31('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c55e8['options']?_0x1c55e8[_0xaf31('0x17')]['where']||null:null,'attributes':_0x1c55e8[_0xaf31('0x17')]?_0x1c55e8['options'][_0xaf31('0x18')]||null:null,'limit':_0x1c55e8[_0xaf31('0x17')]?_0x1c55e8[_0xaf31('0x17')][_0xaf31('0x19')]||null:null,'include':_0x1c55e8[_0xaf31('0x17')]?_0x1c55e8[_0xaf31('0x17')][_0xaf31('0x1a')]?_[_0xaf31('0x1b')](_0x1c55e8[_0xaf31('0x17')]['include'],function(_0x2e54e7){return{'model':db[_0x2e54e7[_0xaf31('0x1c')]],'as':_0x2e54e7['as'],'attributes':_0x2e54e7['attributes'],'include':_0x2e54e7[_0xaf31('0x1a')]?_['map'](_0x2e54e7[_0xaf31('0x1a')],function(_0x4e3802){return{'model':db[_0x4e3802[_0xaf31('0x1c')]],'as':_0x4e3802['as'],'attributes':_0x4e3802['attributes'],'include':_0x4e3802['include']?_[_0xaf31('0x1b')](_0x4e3802[_0xaf31('0x1a')],function(_0x4e1a30){return{'model':db[_0x4e1a30[_0xaf31('0x1c')]],'as':_0x4e1a30['as'],'attributes':_0x4e1a30[_0xaf31('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf31('0x9')](function(_0xa63481){logger['info'](_0xaf31('0x14'),_0x1c55e8);logger[_0xaf31('0x1d')](_0xaf31('0x14'),_0x1c55e8,JSON['stringify'](_0xa63481));_0x362995(_0xa63481);})[_0xaf31('0x13')](function(_0x34ea25){logger[_0xaf31('0xf')](_0xaf31('0x14'),_0x34ea25[_0xaf31('0x11')],_0x1c55e8);_0x2a3e3b(_0x49da39[_0xaf31('0xf')](0x1f4,_0x34ea25[_0xaf31('0x11')]));});});}; \ No newline at end of file +var _0x613f=['message','result','catch','GetMailServerIn','MailServerIn','findAll','options','limit','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error'];(function(_0x24bfc4,_0x2e7491){var _0x212767=function(_0x5d756b){while(--_0x5d756b){_0x24bfc4['push'](_0x24bfc4['shift']());}};_0x212767(++_0x2e7491);}(_0x613f,0x6d));var _0xf613=function(_0x196eca,_0x80dd36){_0x196eca=_0x196eca-0x0;var _0x1a1e3a=_0x613f[_0x196eca];return _0x1a1e3a;};'use strict';var _=require(_0xf613('0x0'));var util=require(_0xf613('0x1'));var moment=require(_0xf613('0x2'));var BPromise=require(_0xf613('0x3'));var rs=require(_0xf613('0x4'));var fs=require('fs');var Redis=require(_0xf613('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf613('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf613('0x7'));var jayson=require(_0xf613('0x8'));var client=jayson[_0xf613('0x9')][_0xf613('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb2c12d,_0x4c25df,_0x446cb1){return new BPromise(function(_0x53ade4,_0x38d54a){return client['request'](_0xb2c12d,_0x446cb1)[_0xf613('0xb')](function(_0x49658d){logger[_0xf613('0xc')](_0xf613('0xd'),_0x4c25df,'request\x20sent');logger[_0xf613('0xe')](_0xf613('0xf'),_0x4c25df,_0xf613('0x10'),JSON['stringify'](_0x49658d));if(_0x49658d['error']){if(_0x49658d['error'][_0xf613('0x11')]===0x1f4){logger[_0xf613('0x12')](_0xf613('0xd'),_0x4c25df,_0x49658d[_0xf613('0x12')][_0xf613('0x13')]);return _0x38d54a(_0x49658d['error'][_0xf613('0x13')]);}logger[_0xf613('0x12')](_0xf613('0xd'),_0x4c25df,_0x49658d[_0xf613('0x12')]['message']);return _0x53ade4(_0x49658d[_0xf613('0x12')][_0xf613('0x13')]);}else{logger['info'](_0xf613('0xd'),_0x4c25df,_0xf613('0x10'));_0x53ade4(_0x49658d[_0xf613('0x14')][_0xf613('0x13')]);}})[_0xf613('0x15')](function(_0x2a0e13){logger[_0xf613('0x12')](_0xf613('0xd'),_0x4c25df,_0x2a0e13);_0x38d54a(_0x2a0e13);});});}exports[_0xf613('0x16')]=function(_0x1018b3){var _0x4c01c2=this;return new Promise(function(_0x27ce70,_0x3b8591){return db[_0xf613('0x17')][_0xf613('0x18')]({'raw':_0x1018b3[_0xf613('0x19')]?_0x1018b3[_0xf613('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1018b3['options']?_0x1018b3[_0xf613('0x19')]['where']||null:null,'attributes':_0x1018b3[_0xf613('0x19')]?_0x1018b3['options']['attributes']||null:null,'limit':_0x1018b3['options']?_0x1018b3[_0xf613('0x19')][_0xf613('0x1a')]||null:null,'include':_0x1018b3['options']?_0x1018b3[_0xf613('0x19')][_0xf613('0x1b')]?_[_0xf613('0x1c')](_0x1018b3[_0xf613('0x19')][_0xf613('0x1b')],function(_0x14322d){return{'model':db[_0x14322d[_0xf613('0x1d')]],'as':_0x14322d['as'],'attributes':_0x14322d[_0xf613('0x1e')],'include':_0x14322d[_0xf613('0x1b')]?_[_0xf613('0x1c')](_0x14322d[_0xf613('0x1b')],function(_0xea3914){return{'model':db[_0xea3914[_0xf613('0x1d')]],'as':_0xea3914['as'],'attributes':_0xea3914[_0xf613('0x1e')],'include':_0xea3914['include']?_['map'](_0xea3914['include'],function(_0x1d4af5){return{'model':db[_0x1d4af5[_0xf613('0x1d')]],'as':_0x1d4af5['as'],'attributes':_0x1d4af5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf613('0xb')](function(_0xd72d78){logger['info']('GetMailServerIn',_0x1018b3);logger[_0xf613('0xe')](_0xf613('0x16'),_0x1018b3,JSON[_0xf613('0x1f')](_0xd72d78));_0x27ce70(_0xd72d78);})[_0xf613('0x15')](function(_0x16f977){logger['error'](_0xf613('0x16'),_0x16f977[_0xf613('0x13')],_0x1018b3);_0x3b8591(_0x4c01c2[_0xf613('0x12')](0x1f4,_0x16f977[_0xf613('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3cee179..4812a9a 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x5bbed4,_0x26b4d0){_0x5bbed4=_0x5bbed4-0x0;var _0x58d7e3=_0x7a54[_0x5bbed4];return _0x58d7e3;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 18a3ba3..dd4aa0b 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 _0x63a5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x18de19,_0x55bd8b){var _0xb7186=function(_0x2462de){while(--_0x2462de){_0x18de19['push'](_0x18de19['shift']());}};_0xb7186(++_0x55bd8b);}(_0x63a5,0x18e));var _0x563a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x63a5[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'description':{'type':Sequelize[_0x563a('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x563a('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x563a('0x3')]},'secure':{'type':Sequelize[_0x563a('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x563a('0x2')]},'authentication':{'type':Sequelize[_0x563a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x878f=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x103e4d,_0x4ba142){var _0x244a31=function(_0x4c1a61){while(--_0x4c1a61){_0x103e4d['push'](_0x103e4d['shift']());}};_0x244a31(++_0x4ba142);}(_0x878f,0x173));var _0xf878=function(_0xf9f437,_0xf1470f){_0xf9f437=_0xf9f437-0x0;var _0x4cd51e=_0x878f[_0xf9f437];return _0x4cd51e;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'description':{'type':Sequelize[_0xf878('0x1')]},'host':{'type':Sequelize[_0xf878('0x1')]},'user':{'type':Sequelize[_0xf878('0x1')]},'pass':{'type':Sequelize[_0xf878('0x1')]},'port':{'type':Sequelize[_0xf878('0x2')]},'secure':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf878('0x1')]},'authentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index c454422..b143004 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 _0x2fb4=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','catch','show','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/logger','../../config/utils'];(function(_0x5d0e5c,_0x1eb95f){var _0x2c4bd4=function(_0x5528dd){while(--_0x5528dd){_0x5d0e5c['push'](_0x5d0e5c['shift']());}};_0x2c4bd4(++_0x1eb95f);}(_0x2fb4,0x17f));var _0x42fb=function(_0x56b0a4,_0x371593){_0x56b0a4=_0x56b0a4-0x0;var _0xf4a34a=_0x2fb4[_0x56b0a4];return _0xf4a34a;};'use strict';var emlformat=require(_0x42fb('0x0'));var rimraf=require(_0x42fb('0x1'));var zipdir=require(_0x42fb('0x2'));var jsonpatch=require(_0x42fb('0x3'));var rp=require(_0x42fb('0x4'));var moment=require(_0x42fb('0x5'));var BPromise=require(_0x42fb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x42fb('0x7'));var sox=require('sox');var csv=require(_0x42fb('0x8'));var ejs=require(_0x42fb('0x9'));var fs=require('fs');var fs_extra=require(_0x42fb('0xa'));var _=require(_0x42fb('0xb'));var squel=require(_0x42fb('0xc'));var crypto=require(_0x42fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x42fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x42fb('0xf'));var Papa=require(_0x42fb('0x10'));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('../../config/license/hardware');var logger=require(_0x42fb('0x11'))('api');var utils=require(_0x42fb('0x12'));var config=require(_0x42fb('0x13'));var licenseUtil=require(_0x42fb('0x14'));var db=require(_0x42fb('0x15'))['db'];function respondWithStatusCode(_0x16c2d2,_0x1c90d4){_0x1c90d4=_0x1c90d4||0xcc;return function(_0x157446){if(_0x157446){return _0x16c2d2[_0x42fb('0x16')](_0x1c90d4);}return _0x16c2d2[_0x42fb('0x17')](_0x1c90d4)[_0x42fb('0x18')]();};}function respondWithResult(_0x665a39,_0x1e4039){_0x1e4039=_0x1e4039||0xc8;return function(_0x26715e){if(_0x26715e){return _0x665a39['status'](_0x1e4039)[_0x42fb('0x19')](_0x26715e);}};}function respondWithFilteredResult(_0x5cba71,_0xb07f89){return function(_0x190f81){if(_0x190f81){var _0xadc59b=typeof _0xb07f89[_0x42fb('0x1a')]===_0x42fb('0x1b')&&typeof _0xb07f89[_0x42fb('0x1c')]===_0x42fb('0x1b');var _0x4d88b5=_0x190f81[_0x42fb('0x1d')];var _0x38b7f1=_0xadc59b?0x0:_0xb07f89[_0x42fb('0x1a')];var _0x302b3a=_0xadc59b?_0x190f81['count']:_0xb07f89[_0x42fb('0x1a')]+_0xb07f89[_0x42fb('0x1c')];var _0x3ed0ba;if(_0x302b3a>=_0x4d88b5){_0x302b3a=_0x4d88b5;_0x3ed0ba=0xc8;}else{_0x3ed0ba=0xce;}_0x5cba71[_0x42fb('0x17')](_0x3ed0ba);return _0x5cba71['set'](_0x42fb('0x1e'),_0x38b7f1+'-'+_0x302b3a+'/'+_0x4d88b5)[_0x42fb('0x19')](_0x190f81);}return null;};}function patchUpdates(_0x5f03f3){return function(_0x647325){try{jsonpatch['apply'](_0x647325,_0x5f03f3,!![]);}catch(_0x5a7009){return BPromise['reject'](_0x5a7009);}return _0x647325['save']();};}function saveUpdates(_0x133371,_0x5df443){return function(_0x1fcb46){if(_0x1fcb46){return _0x1fcb46[_0x42fb('0x1f')](_0x133371)[_0x42fb('0x20')](function(_0xd303e3){return _0xd303e3;});}return null;};}function removeEntity(_0x5221e3,_0x67d903){return function(_0x20d5c1){if(_0x20d5c1){return _0x20d5c1['destroy']()['then'](function(){_0x5221e3[_0x42fb('0x17')](0xcc)[_0x42fb('0x18')]();});}};}function handleEntityNotFound(_0x365f22,_0x3a363e){return function(_0x42a42e){if(!_0x42a42e){_0x365f22[_0x42fb('0x16')](0x194);}return _0x42a42e;};}function handleError(_0x56dc63,_0x3f43a8){_0x3f43a8=_0x3f43a8||0x1f4;return function(_0x2c1cf3){logger['error'](_0x2c1cf3[_0x42fb('0x21')]);if(_0x2c1cf3[_0x42fb('0x22')]){delete _0x2c1cf3[_0x42fb('0x22')];}_0x56dc63['status'](_0x3f43a8)['send'](_0x2c1cf3);};}exports['index']=function(_0x4864b3,_0x13f091){var _0x50b454={},_0x3ae0c9={},_0x11d63d={'count':0x0,'rows':[]};var _0x238f14=_[_0x42fb('0x23')](db['MailServerOut'][_0x42fb('0x24')],function(_0x329a89){return{'name':_0x329a89['fieldName'],'type':_0x329a89[_0x42fb('0x25')][_0x42fb('0x26')]};});_0x3ae0c9['model']=_[_0x42fb('0x23')](_0x238f14,'name');_0x3ae0c9[_0x42fb('0x27')]=_[_0x42fb('0x28')](_0x4864b3[_0x42fb('0x27')]);_0x3ae0c9['filters']=_[_0x42fb('0x29')](_0x3ae0c9[_0x42fb('0x2a')],_0x3ae0c9[_0x42fb('0x27')]);_0x50b454[_0x42fb('0x2b')]=_[_0x42fb('0x29')](_0x3ae0c9[_0x42fb('0x2a')],qs[_0x42fb('0x2c')](_0x4864b3[_0x42fb('0x27')][_0x42fb('0x2c')]));_0x50b454['attributes']=_0x50b454[_0x42fb('0x2b')]['length']?_0x50b454['attributes']:_0x3ae0c9[_0x42fb('0x2a')];if(!_0x4864b3[_0x42fb('0x27')][_0x42fb('0x2d')](_0x42fb('0x2e'))){_0x50b454[_0x42fb('0x1c')]=qs['limit'](_0x4864b3[_0x42fb('0x27')][_0x42fb('0x1c')]);_0x50b454['offset']=qs[_0x42fb('0x1a')](_0x4864b3['query']['offset']);}_0x50b454['order']=qs[_0x42fb('0x2f')](_0x4864b3[_0x42fb('0x27')][_0x42fb('0x2f')]);_0x50b454[_0x42fb('0x30')]=qs['filters'](_[_0x42fb('0x31')](_0x4864b3[_0x42fb('0x27')],_0x3ae0c9[_0x42fb('0x32')]),_0x238f14);if(_0x4864b3[_0x42fb('0x27')]['filter']){_0x50b454['where']=_[_0x42fb('0x33')](_0x50b454['where'],{'$or':_['map'](_0x238f14,function(_0x5dfc6d){if(_0x5dfc6d['type']!==_0x42fb('0x34')){var _0x5e5001={};_0x5e5001[_0x5dfc6d[_0x42fb('0x22')]]={'$like':'%'+_0x4864b3[_0x42fb('0x27')][_0x42fb('0x35')]+'%'};return _0x5e5001;}})});}_0x50b454=_[_0x42fb('0x33')]({},_0x50b454,_0x4864b3[_0x42fb('0x36')]);var _0x540a08={'where':_0x50b454[_0x42fb('0x30')]};return db[_0x42fb('0x37')]['count'](_0x540a08)[_0x42fb('0x20')](function(_0x3533b2){_0x11d63d[_0x42fb('0x1d')]=_0x3533b2;if(_0x4864b3[_0x42fb('0x27')][_0x42fb('0x38')]){_0x50b454[_0x42fb('0x39')]=[{'all':!![]}];}return db['MailServerOut'][_0x42fb('0x3a')](_0x50b454);})[_0x42fb('0x20')](function(_0xfccea4){_0x11d63d['rows']=_0xfccea4;return _0x11d63d;})[_0x42fb('0x20')](respondWithFilteredResult(_0x13f091,_0x50b454))[_0x42fb('0x3b')](handleError(_0x13f091,null));};exports[_0x42fb('0x3c')]=function(_0x4ec613,_0x2f930c){var _0x277f92={'raw':!![],'where':{'id':_0x4ec613['params']['id']}},_0xc944ad={};_0xc944ad[_0x42fb('0x2a')]=_[_0x42fb('0x28')](db[_0x42fb('0x37')]['rawAttributes']);_0xc944ad[_0x42fb('0x27')]=_[_0x42fb('0x28')](_0x4ec613[_0x42fb('0x27')]);_0xc944ad[_0x42fb('0x32')]=_[_0x42fb('0x29')](_0xc944ad[_0x42fb('0x2a')],_0xc944ad['query']);_0x277f92['attributes']=_[_0x42fb('0x29')](_0xc944ad[_0x42fb('0x2a')],qs['fields'](_0x4ec613[_0x42fb('0x27')]['fields']));_0x277f92[_0x42fb('0x2b')]=_0x277f92[_0x42fb('0x2b')][_0x42fb('0x3d')]?_0x277f92[_0x42fb('0x2b')]:_0xc944ad[_0x42fb('0x2a')];if(_0x4ec613[_0x42fb('0x27')]['includeAll']){_0x277f92[_0x42fb('0x39')]=[{'all':!![]}];}_0x277f92=_[_0x42fb('0x33')]({},_0x277f92,_0x4ec613[_0x42fb('0x36')]);return db['MailServerOut'][_0x42fb('0x3e')](_0x277f92)[_0x42fb('0x20')](handleEntityNotFound(_0x2f930c,null))[_0x42fb('0x20')](respondWithResult(_0x2f930c,null))['catch'](handleError(_0x2f930c,null));};exports[_0x42fb('0x3f')]=function(_0x5c3f39,_0x52edad){return db[_0x42fb('0x37')]['create'](_0x5c3f39['body'],{})[_0x42fb('0x20')](respondWithResult(_0x52edad,0xc9))[_0x42fb('0x3b')](handleError(_0x52edad,null));};exports[_0x42fb('0x1f')]=function(_0x5cd999,_0x2c6bf0){if(_0x5cd999['body']['id']){delete _0x5cd999[_0x42fb('0x40')]['id'];}return db[_0x42fb('0x37')][_0x42fb('0x3e')]({'where':{'id':_0x5cd999[_0x42fb('0x41')]['id']}})[_0x42fb('0x20')](handleEntityNotFound(_0x2c6bf0,null))[_0x42fb('0x20')](saveUpdates(_0x5cd999[_0x42fb('0x40')],null))[_0x42fb('0x20')](respondWithResult(_0x2c6bf0,null))['catch'](handleError(_0x2c6bf0,null));};exports[_0x42fb('0x42')]=function(_0x59bb93,_0x67806e){return db[_0x42fb('0x37')][_0x42fb('0x3e')]({'where':{'id':_0x59bb93['params']['id']}})[_0x42fb('0x20')](handleEntityNotFound(_0x67806e,null))[_0x42fb('0x20')](removeEntity(_0x67806e,null))[_0x42fb('0x3b')](handleError(_0x67806e,null));}; \ No newline at end of file +var _0x59d8=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','params','merge','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3fcdf5,_0x503ca0){var _0x2d0786=function(_0x1ee5e2){while(--_0x1ee5e2){_0x3fcdf5['push'](_0x3fcdf5['shift']());}};_0x2d0786(++_0x503ca0);}(_0x59d8,0x11d));var _0x859d=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x59d8[_0x3b594b];return _0x1ea5f8;};'use strict';var emlformat=require(_0x859d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x859d('0x1'));var jsonpatch=require(_0x859d('0x2'));var rp=require(_0x859d('0x3'));var moment=require(_0x859d('0x4'));var BPromise=require(_0x859d('0x5'));var Mustache=require(_0x859d('0x6'));var util=require(_0x859d('0x7'));var path=require(_0x859d('0x8'));var sox=require(_0x859d('0x9'));var csv=require('to-csv');var ejs=require(_0x859d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x859d('0xb'));var squel=require('squel');var crypto=require(_0x859d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x859d('0xd'));var toCsv=require(_0x859d('0xe'));var querystring=require(_0x859d('0xf'));var Papa=require(_0x859d('0x10'));var Redis=require(_0x859d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x859d('0x12'));var as=require(_0x859d('0x13'));var hardwareService=require(_0x859d('0x14'));var logger=require('../../config/logger')(_0x859d('0x15'));var utils=require(_0x859d('0x16'));var config=require(_0x859d('0x17'));var licenseUtil=require(_0x859d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c769f,_0x53c7c3){_0x53c7c3=_0x53c7c3||0xcc;return function(_0x26f242){if(_0x26f242){return _0x3c769f[_0x859d('0x19')](_0x53c7c3);}return _0x3c769f[_0x859d('0x1a')](_0x53c7c3)[_0x859d('0x1b')]();};}function respondWithResult(_0x5802cf,_0x318b9f){_0x318b9f=_0x318b9f||0xc8;return function(_0x3dd987){if(_0x3dd987){return _0x5802cf['status'](_0x318b9f)[_0x859d('0x1c')](_0x3dd987);}};}function respondWithFilteredResult(_0x45ac4c,_0x1aae19){return function(_0x36ccf5){if(_0x36ccf5){var _0xb3789d=typeof _0x1aae19[_0x859d('0x1d')]==='undefined'&&typeof _0x1aae19['limit']===_0x859d('0x1e');var _0x553556=_0x36ccf5[_0x859d('0x1f')];var _0x48754f=_0xb3789d?0x0:_0x1aae19[_0x859d('0x1d')];var _0xeac4b8=_0xb3789d?_0x36ccf5[_0x859d('0x1f')]:_0x1aae19['offset']+_0x1aae19[_0x859d('0x20')];var _0x405000;if(_0xeac4b8>=_0x553556){_0xeac4b8=_0x553556;_0x405000=0xc8;}else{_0x405000=0xce;}_0x45ac4c['status'](_0x405000);return _0x45ac4c[_0x859d('0x21')](_0x859d('0x22'),_0x48754f+'-'+_0xeac4b8+'/'+_0x553556)[_0x859d('0x1c')](_0x36ccf5);}return null;};}function patchUpdates(_0x1d26bd){return function(_0x453257){try{jsonpatch[_0x859d('0x23')](_0x453257,_0x1d26bd,!![]);}catch(_0x568710){return BPromise[_0x859d('0x24')](_0x568710);}return _0x453257[_0x859d('0x25')]();};}function saveUpdates(_0x49a269,_0x1d9c81){return function(_0x1776c2){if(_0x1776c2){return _0x1776c2[_0x859d('0x26')](_0x49a269)[_0x859d('0x27')](function(_0x4e552d){return _0x4e552d;});}return null;};}function removeEntity(_0x1dd280,_0x4a3bd7){return function(_0xbf5cf2){if(_0xbf5cf2){return _0xbf5cf2['destroy']()[_0x859d('0x27')](function(){_0x1dd280[_0x859d('0x1a')](0xcc)[_0x859d('0x1b')]();});}};}function handleEntityNotFound(_0x3831be,_0x2be4b3){return function(_0x906ed4){if(!_0x906ed4){_0x3831be['sendStatus'](0x194);}return _0x906ed4;};}function handleError(_0x4461d0,_0x5c9c8f){_0x5c9c8f=_0x5c9c8f||0x1f4;return function(_0x2b9ff7){logger[_0x859d('0x28')](_0x2b9ff7[_0x859d('0x29')]);if(_0x2b9ff7[_0x859d('0x2a')]){delete _0x2b9ff7[_0x859d('0x2a')];}_0x4461d0[_0x859d('0x1a')](_0x5c9c8f)[_0x859d('0x2b')](_0x2b9ff7);};}exports[_0x859d('0x2c')]=function(_0x4c69d9,_0x21289c){var _0x3238c4={},_0x505c09={},_0x1cf317={'count':0x0,'rows':[]};var _0x3c07e7=_[_0x859d('0x2d')](db[_0x859d('0x2e')]['rawAttributes'],function(_0x2a2cc4){return{'name':_0x2a2cc4[_0x859d('0x2f')],'type':_0x2a2cc4['type'][_0x859d('0x30')]};});_0x505c09[_0x859d('0x31')]=_['map'](_0x3c07e7,_0x859d('0x2a'));_0x505c09['query']=_[_0x859d('0x32')](_0x4c69d9[_0x859d('0x33')]);_0x505c09[_0x859d('0x34')]=_[_0x859d('0x35')](_0x505c09[_0x859d('0x31')],_0x505c09[_0x859d('0x33')]);_0x3238c4['attributes']=_['intersection'](_0x505c09['model'],qs['fields'](_0x4c69d9[_0x859d('0x33')][_0x859d('0x36')]));_0x3238c4['attributes']=_0x3238c4[_0x859d('0x37')][_0x859d('0x38')]?_0x3238c4[_0x859d('0x37')]:_0x505c09[_0x859d('0x31')];if(!_0x4c69d9[_0x859d('0x33')][_0x859d('0x39')](_0x859d('0x3a'))){_0x3238c4[_0x859d('0x20')]=qs['limit'](_0x4c69d9[_0x859d('0x33')][_0x859d('0x20')]);_0x3238c4[_0x859d('0x1d')]=qs['offset'](_0x4c69d9[_0x859d('0x33')][_0x859d('0x1d')]);}_0x3238c4[_0x859d('0x3b')]=qs[_0x859d('0x3c')](_0x4c69d9[_0x859d('0x33')][_0x859d('0x3c')]);_0x3238c4[_0x859d('0x3d')]=qs[_0x859d('0x34')](_[_0x859d('0x3e')](_0x4c69d9['query'],_0x505c09[_0x859d('0x34')]),_0x3c07e7);if(_0x4c69d9['query'][_0x859d('0x3f')]){_0x3238c4['where']=_['merge'](_0x3238c4['where'],{'$or':_[_0x859d('0x2d')](_0x3c07e7,function(_0x5b2aa9){if(_0x5b2aa9['type']!=='VIRTUAL'){var _0x59e9f9={};_0x59e9f9[_0x5b2aa9[_0x859d('0x2a')]]={'$like':'%'+_0x4c69d9[_0x859d('0x33')][_0x859d('0x3f')]+'%'};return _0x59e9f9;}})});}_0x3238c4=_['merge']({},_0x3238c4,_0x4c69d9[_0x859d('0x40')]);var _0x2e1988={'where':_0x3238c4[_0x859d('0x3d')]};return db[_0x859d('0x2e')][_0x859d('0x1f')](_0x2e1988)[_0x859d('0x27')](function(_0x5ec124){_0x1cf317[_0x859d('0x1f')]=_0x5ec124;if(_0x4c69d9[_0x859d('0x33')][_0x859d('0x41')]){_0x3238c4[_0x859d('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x859d('0x43')](_0x3238c4);})[_0x859d('0x27')](function(_0x18958d){_0x1cf317[_0x859d('0x44')]=_0x18958d;return _0x1cf317;})[_0x859d('0x27')](respondWithFilteredResult(_0x21289c,_0x3238c4))['catch'](handleError(_0x21289c,null));};exports['show']=function(_0x282fad,_0x53049c){var _0x40c0a3={'raw':!![],'where':{'id':_0x282fad[_0x859d('0x45')]['id']}},_0x41f246={};_0x41f246[_0x859d('0x31')]=_[_0x859d('0x32')](db[_0x859d('0x2e')]['rawAttributes']);_0x41f246['query']=_[_0x859d('0x32')](_0x282fad[_0x859d('0x33')]);_0x41f246[_0x859d('0x34')]=_[_0x859d('0x35')](_0x41f246[_0x859d('0x31')],_0x41f246['query']);_0x40c0a3['attributes']=_[_0x859d('0x35')](_0x41f246['model'],qs[_0x859d('0x36')](_0x282fad[_0x859d('0x33')]['fields']));_0x40c0a3[_0x859d('0x37')]=_0x40c0a3['attributes'][_0x859d('0x38')]?_0x40c0a3['attributes']:_0x41f246[_0x859d('0x31')];if(_0x282fad[_0x859d('0x33')][_0x859d('0x41')]){_0x40c0a3['include']=[{'all':!![]}];}_0x40c0a3=_[_0x859d('0x46')]({},_0x40c0a3,_0x282fad[_0x859d('0x40')]);return db['MailServerOut'][_0x859d('0x47')](_0x40c0a3)[_0x859d('0x27')](handleEntityNotFound(_0x53049c,null))['then'](respondWithResult(_0x53049c,null))[_0x859d('0x48')](handleError(_0x53049c,null));};exports['create']=function(_0x195596,_0x547715){return db[_0x859d('0x2e')][_0x859d('0x49')](_0x195596[_0x859d('0x4a')],{})['then'](respondWithResult(_0x547715,0xc9))['catch'](handleError(_0x547715,null));};exports['update']=function(_0x4f1b46,_0x1cc3e5){if(_0x4f1b46[_0x859d('0x4a')]['id']){delete _0x4f1b46['body']['id'];}return db[_0x859d('0x2e')]['find']({'where':{'id':_0x4f1b46['params']['id']}})[_0x859d('0x27')](handleEntityNotFound(_0x1cc3e5,null))[_0x859d('0x27')](saveUpdates(_0x4f1b46[_0x859d('0x4a')],null))['then'](respondWithResult(_0x1cc3e5,null))['catch'](handleError(_0x1cc3e5,null));};exports[_0x859d('0x4b')]=function(_0x28dd95,_0xba745c){return db['MailServerOut'][_0x859d('0x47')]({'where':{'id':_0x28dd95[_0x859d('0x45')]['id']}})[_0x859d('0x27')](handleEntityNotFound(_0xba745c,null))[_0x859d('0x27')](removeEntity(_0xba745c,null))[_0x859d('0x48')](handleError(_0xba745c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 956dd09..31dabb7 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 _0x48da=['api','rimraf','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x46c073,_0x4ca7fc){var _0x4e377f=function(_0x1d7c36){while(--_0x1d7c36){_0x46c073['push'](_0x46c073['shift']());}};_0x4e377f(++_0x4ca7fc);}(_0x48da,0xad));var _0xa48d=function(_0x559523,_0x52d6d1){_0x559523=_0x559523-0x0;var _0xeb4688=_0x48da[_0x559523];return _0xeb4688;};'use strict';var _=require(_0xa48d('0x0'));var util=require(_0xa48d('0x1'));var logger=require(_0xa48d('0x2'))(_0xa48d('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(_0xa48d('0x4'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x4cf475,_0x439a01){return _0x4cf475[_0xa48d('0x5')](_0xa48d('0x6'),attributes,{'tableName':_0xa48d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c1d=['define','MailServerOut','lodash','util','../../config/logger','moment','bluebird','rimraf','exports'];(function(_0x4bcbc2,_0x46cbff){var _0xe5b888=function(_0xd3a99d){while(--_0xd3a99d){_0x4bcbc2['push'](_0x4bcbc2['shift']());}};_0xe5b888(++_0x46cbff);}(_0x9c1d,0x13d));var _0xd9c1=function(_0x2be403,_0x53977d){_0x2be403=_0x2be403-0x0;var _0x189eaa=_0x9c1d[_0x2be403];return _0x189eaa;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))('api');var moment=require(_0xd9c1('0x3'));var BPromise=require(_0xd9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd9c1('0x5'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xd9c1('0x6')]=function(_0x27fe57,_0x3e7a9c){return _0x27fe57[_0xd9c1('0x7')](_0xd9c1('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 76bd414..757ec98 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 _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(_0x54a2be,_0x448e7){var _0x48d32a=function(_0x18bbff){while(--_0x18bbff){_0x54a2be['push'](_0x54a2be['shift']());}};_0x48d32a(++_0x448e7);}(_0xdb28,0x106));var _0x8db2=function(_0x453904,_0x5522c9){_0x453904=_0x453904-0x0;var _0x796840=_0xdb28[_0x453904];return _0x796840;};'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 +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(_0x2d97a6,_0x3933a5){var _0xcfa4a7=function(_0x274662){while(--_0x274662){_0x2d97a6['push'](_0x2d97a6['shift']());}};_0xcfa4a7(++_0x3933a5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4cadc4,_0x1257ab){_0x4cadc4=_0x4cadc4-0x0;var _0x590d3c=_0x5f2f[_0x4cadc4];return _0x590d3c;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 060b28b..5b83d10 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 _0x8204=['get','index','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x2ad076,_0x57abf1){var _0x43ea81=function(_0x3e8d75){while(--_0x3e8d75){_0x2ad076['push'](_0x2ad076['shift']());}};_0x43ea81(++_0x57abf1);}(_0x8204,0x1d7));var _0x4820=function(_0x48e67e,_0x3c9d04){_0x48e67e=_0x48e67e-0x0;var _0x1a404c=_0x8204[_0x48e67e];return _0x1a404c;};'use strict';var multer=require(_0x4820('0x0'));var util=require(_0x4820('0x1'));var path=require(_0x4820('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4820('0x3')]();var fs_extra=require(_0x4820('0x4'));var auth=require(_0x4820('0x5'));var interaction=require(_0x4820('0x6'));var config=require(_0x4820('0x7'));var controller=require(_0x4820('0x8'));router[_0x4820('0x9')]('/',auth['isAuthenticated'](),controller[_0x4820('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4820('0x9')]('/:id',auth[_0x4820('0xb')](),controller[_0x4820('0xc')]);router[_0x4820('0xd')]('/',auth[_0x4820('0xb')](),controller[_0x4820('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4820('0xf')]);router[_0x4820('0x10')](_0x4820('0x11'),auth[_0x4820('0xb')](),controller[_0x4820('0x12')]);module[_0x4820('0x13')]=router; \ No newline at end of file +var _0x78eb=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','delete','exports','multer','util'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x78eb,0x7c));var _0xb78e=function(_0x522be5,_0x364142){_0x522be5=_0x522be5-0x0;var _0x36793e=_0x78eb[_0x522be5];return _0x36793e;};'use strict';var multer=require(_0xb78e('0x0'));var util=require(_0xb78e('0x1'));var path=require('path');var timeout=require(_0xb78e('0x2'));var express=require(_0xb78e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb78e('0x4'));var interaction=require(_0xb78e('0x5'));var config=require(_0xb78e('0x6'));var controller=require(_0xb78e('0x7'));router['get']('/',auth[_0xb78e('0x8')](),controller['index']);router[_0xb78e('0x9')](_0xb78e('0xa'),auth[_0xb78e('0x8')](),controller['describe']);router[_0xb78e('0x9')](_0xb78e('0xb'),auth[_0xb78e('0x8')](),controller[_0xb78e('0xc')]);router[_0xb78e('0xd')]('/',auth['isAuthenticated'](),controller[_0xb78e('0xe')]);router[_0xb78e('0xf')]('/:id',auth[_0xb78e('0x8')](),controller['update']);router[_0xb78e('0x10')](_0xb78e('0xb'),auth[_0xb78e('0x8')](),controller['destroy']);module[_0xb78e('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index ca81bd4..dc33f4b 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 _0x446c=['STRING','name','sequelize','exports'];(function(_0x16ae36,_0x4f2e57){var _0x3473be=function(_0x426274){while(--_0x426274){_0x16ae36['push'](_0x16ae36['shift']());}};_0x3473be(++_0x4f2e57);}(_0x446c,0x156));var _0xc446=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x446c[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'unique':_0xc446('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcca7=['STRING','name','sequelize','exports'];(function(_0x35a779,_0x27f8fb){var _0xca723b=function(_0x298df7){while(--_0x298df7){_0x35a779['push'](_0x35a779['shift']());}};_0xca723b(++_0x27f8fb);}(_0xcca7,0x1aa));var _0x7cca=function(_0x314656,_0x556548){_0x314656=_0x314656-0x0;var _0x51d05e=_0xcca7[_0x314656];return _0x51d05e;};'use strict';var Sequelize=require(_0x7cca('0x0'));module[_0x7cca('0x1')]={'name':{'type':Sequelize[_0x7cca('0x2')],'unique':_0x7cca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 92d2489..fa971d7 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 _0xc714=['merge','VIRTUAL','options','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','error','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x570db0,_0x5c0a32){var _0x340990=function(_0x52d1ea){while(--_0x52d1ea){_0x570db0['push'](_0x570db0['shift']());}};_0x340990(++_0x5c0a32);}(_0xc714,0x13a));var _0x4c71=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc714[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4c71('0x0'));var rimraf=require(_0x4c71('0x1'));var zipdir=require(_0x4c71('0x2'));var jsonpatch=require(_0x4c71('0x3'));var rp=require(_0x4c71('0x4'));var moment=require(_0x4c71('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4c71('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4c71('0x7'));var csv=require(_0x4c71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c71('0x9'));var _=require(_0x4c71('0xa'));var squel=require('squel');var crypto=require(_0x4c71('0xb'));var jsforce=require(_0x4c71('0xc'));var deskjs=require(_0x4c71('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4c71('0xe'));var Papa=require(_0x4c71('0xf'));var Redis=require('ioredis');var authService=require(_0x4c71('0x10'));var qs=require(_0x4c71('0x11'));var as=require(_0x4c71('0x12'));var hardwareService=require(_0x4c71('0x13'));var logger=require(_0x4c71('0x14'))(_0x4c71('0x15'));var utils=require(_0x4c71('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4c71('0x17'));var db=require(_0x4c71('0x18'))['db'];function respondWithStatusCode(_0x4e589b,_0x2743b2){_0x2743b2=_0x2743b2||0xcc;return function(_0x43adb){if(_0x43adb){return _0x4e589b[_0x4c71('0x19')](_0x2743b2);}return _0x4e589b[_0x4c71('0x1a')](_0x2743b2)[_0x4c71('0x1b')]();};}function respondWithResult(_0x2b7755,_0x20e1e5){_0x20e1e5=_0x20e1e5||0xc8;return function(_0x14c396){if(_0x14c396){return _0x2b7755[_0x4c71('0x1a')](_0x20e1e5)[_0x4c71('0x1c')](_0x14c396);}};}function respondWithFilteredResult(_0x57ce27,_0x1fa573){return function(_0x2c7081){if(_0x2c7081){var _0x130095=typeof _0x1fa573[_0x4c71('0x1d')]===_0x4c71('0x1e')&&typeof _0x1fa573['limit']===_0x4c71('0x1e');var _0x443e94=_0x2c7081[_0x4c71('0x1f')];var _0x26c4a5=_0x130095?0x0:_0x1fa573[_0x4c71('0x1d')];var _0x24b7af=_0x130095?_0x2c7081[_0x4c71('0x1f')]:_0x1fa573[_0x4c71('0x1d')]+_0x1fa573[_0x4c71('0x20')];var _0x20e255;if(_0x24b7af>=_0x443e94){_0x24b7af=_0x443e94;_0x20e255=0xc8;}else{_0x20e255=0xce;}_0x57ce27['status'](_0x20e255);return _0x57ce27[_0x4c71('0x21')]('Content-Range',_0x26c4a5+'-'+_0x24b7af+'/'+_0x443e94)[_0x4c71('0x1c')](_0x2c7081);}return null;};}function patchUpdates(_0x5155d6){return function(_0x3baf76){try{jsonpatch['apply'](_0x3baf76,_0x5155d6,!![]);}catch(_0x5c5ed9){return BPromise[_0x4c71('0x22')](_0x5c5ed9);}return _0x3baf76[_0x4c71('0x23')]();};}function saveUpdates(_0x93fdb1,_0x34e3c3){return function(_0x18a6dc){if(_0x18a6dc){return _0x18a6dc[_0x4c71('0x24')](_0x93fdb1)[_0x4c71('0x25')](function(_0x340fa0){return _0x340fa0;});}return null;};}function removeEntity(_0x368b50,_0x489d9b){return function(_0x4085d0){if(_0x4085d0){return _0x4085d0['destroy']()['then'](function(){_0x368b50[_0x4c71('0x1a')](0xcc)[_0x4c71('0x1b')]();});}};}function handleEntityNotFound(_0x52b0e5,_0x41dc38){return function(_0x1d9259){if(!_0x1d9259){_0x52b0e5[_0x4c71('0x19')](0x194);}return _0x1d9259;};}function handleError(_0x5b9ff6,_0x2187d5){_0x2187d5=_0x2187d5||0x1f4;return function(_0x513f6b){logger[_0x4c71('0x26')](_0x513f6b[_0x4c71('0x27')]);if(_0x513f6b[_0x4c71('0x28')]){delete _0x513f6b[_0x4c71('0x28')];}_0x5b9ff6[_0x4c71('0x1a')](_0x2187d5)['send'](_0x513f6b);};}exports[_0x4c71('0x29')]=function(_0x864646,_0x5a66b5){var _0x1eac09={},_0x4516c2={},_0x1a341d={'count':0x0,'rows':[]};var _0x1b5647=_[_0x4c71('0x2a')](db[_0x4c71('0x2b')]['rawAttributes'],function(_0x304a00){return{'name':_0x304a00[_0x4c71('0x2c')],'type':_0x304a00[_0x4c71('0x2d')][_0x4c71('0x2e')]};});_0x4516c2[_0x4c71('0x2f')]=_['map'](_0x1b5647,'name');_0x4516c2[_0x4c71('0x30')]=_[_0x4c71('0x31')](_0x864646[_0x4c71('0x30')]);_0x4516c2[_0x4c71('0x32')]=_[_0x4c71('0x33')](_0x4516c2[_0x4c71('0x2f')],_0x4516c2[_0x4c71('0x30')]);_0x1eac09[_0x4c71('0x34')]=_[_0x4c71('0x33')](_0x4516c2[_0x4c71('0x2f')],qs[_0x4c71('0x35')](_0x864646[_0x4c71('0x30')][_0x4c71('0x35')]));_0x1eac09['attributes']=_0x1eac09['attributes'][_0x4c71('0x36')]?_0x1eac09['attributes']:_0x4516c2[_0x4c71('0x2f')];if(!_0x864646['query'][_0x4c71('0x37')](_0x4c71('0x38'))){_0x1eac09[_0x4c71('0x20')]=qs[_0x4c71('0x20')](_0x864646[_0x4c71('0x30')][_0x4c71('0x20')]);_0x1eac09['offset']=qs[_0x4c71('0x1d')](_0x864646[_0x4c71('0x30')][_0x4c71('0x1d')]);}_0x1eac09[_0x4c71('0x39')]=qs[_0x4c71('0x3a')](_0x864646[_0x4c71('0x30')][_0x4c71('0x3a')]);_0x1eac09[_0x4c71('0x3b')]=qs[_0x4c71('0x32')](_[_0x4c71('0x3c')](_0x864646[_0x4c71('0x30')],_0x4516c2['filters']),_0x1b5647);if(_0x864646[_0x4c71('0x30')]['filter']){_0x1eac09[_0x4c71('0x3b')]=_[_0x4c71('0x3d')](_0x1eac09[_0x4c71('0x3b')],{'$or':_[_0x4c71('0x2a')](_0x1b5647,function(_0x564144){if(_0x564144[_0x4c71('0x2d')]!==_0x4c71('0x3e')){var _0x5533ae={};_0x5533ae[_0x564144[_0x4c71('0x28')]]={'$like':'%'+_0x864646[_0x4c71('0x30')]['filter']+'%'};return _0x5533ae;}})});}_0x1eac09=_[_0x4c71('0x3d')]({},_0x1eac09,_0x864646[_0x4c71('0x3f')]);var _0x1ecbde={'where':_0x1eac09[_0x4c71('0x3b')]};return db[_0x4c71('0x2b')][_0x4c71('0x1f')](_0x1ecbde)['then'](function(_0x1551c9){_0x1a341d['count']=_0x1551c9;if(_0x864646['query']['includeAll']){_0x1eac09[_0x4c71('0x40')]=[{'all':!![]}];}return db['MailSubstatus'][_0x4c71('0x41')](_0x1eac09);})[_0x4c71('0x25')](function(_0x528770){_0x1a341d[_0x4c71('0x42')]=_0x528770;return _0x1a341d;})[_0x4c71('0x25')](respondWithFilteredResult(_0x5a66b5,_0x1eac09))['catch'](handleError(_0x5a66b5,null));};exports[_0x4c71('0x43')]=function(_0x2244c6,_0x5b4702){var _0x299e7d={'raw':!![],'where':{'id':_0x2244c6['params']['id']}},_0x5a9542={};_0x5a9542['model']=_['keys'](db[_0x4c71('0x2b')]['rawAttributes']);_0x5a9542['query']=_[_0x4c71('0x31')](_0x2244c6[_0x4c71('0x30')]);_0x5a9542[_0x4c71('0x32')]=_[_0x4c71('0x33')](_0x5a9542[_0x4c71('0x2f')],_0x5a9542['query']);_0x299e7d[_0x4c71('0x34')]=_[_0x4c71('0x33')](_0x5a9542[_0x4c71('0x2f')],qs[_0x4c71('0x35')](_0x2244c6['query']['fields']));_0x299e7d[_0x4c71('0x34')]=_0x299e7d[_0x4c71('0x34')]['length']?_0x299e7d['attributes']:_0x5a9542[_0x4c71('0x2f')];if(_0x2244c6[_0x4c71('0x30')]['includeAll']){_0x299e7d[_0x4c71('0x40')]=[{'all':!![]}];}_0x299e7d=_[_0x4c71('0x3d')]({},_0x299e7d,_0x2244c6[_0x4c71('0x3f')]);return db[_0x4c71('0x2b')][_0x4c71('0x44')](_0x299e7d)[_0x4c71('0x25')](handleEntityNotFound(_0x5b4702,null))[_0x4c71('0x25')](respondWithResult(_0x5b4702,null))[_0x4c71('0x45')](handleError(_0x5b4702,null));};exports['create']=function(_0x1d9b65,_0x2d54ba){return db[_0x4c71('0x2b')][_0x4c71('0x46')](_0x1d9b65[_0x4c71('0x47')],{})[_0x4c71('0x25')](respondWithResult(_0x2d54ba,0xc9))[_0x4c71('0x45')](handleError(_0x2d54ba,null));};exports[_0x4c71('0x24')]=function(_0x49aa15,_0x4e7bd5){if(_0x49aa15[_0x4c71('0x47')]['id']){delete _0x49aa15['body']['id'];}return db[_0x4c71('0x2b')][_0x4c71('0x44')]({'where':{'id':_0x49aa15[_0x4c71('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e7bd5,null))['then'](saveUpdates(_0x49aa15[_0x4c71('0x47')],null))[_0x4c71('0x25')](respondWithResult(_0x4e7bd5,null))[_0x4c71('0x45')](handleError(_0x4e7bd5,null));};exports[_0x4c71('0x49')]=function(_0x1fee3c,_0x5a64b4){return db[_0x4c71('0x2b')]['find']({'where':{'id':_0x1fee3c[_0x4c71('0x48')]['id']}})[_0x4c71('0x25')](handleEntityNotFound(_0x5a64b4,null))[_0x4c71('0x25')](removeEntity(_0x5a64b4,null))[_0x4c71('0x45')](handleError(_0x5a64b4,null));};exports[_0x4c71('0x4a')]=function(_0x19c2a3,_0x2cd2e7){return db[_0x4c71('0x2b')][_0x4c71('0x4a')]()[_0x4c71('0x25')](respondWithResult(_0x2cd2e7,null))[_0x4c71('0x45')](handleError(_0x2cd2e7,null));}; \ No newline at end of file +var _0x035e=['api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','stack','name','send','map','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','options','MailSubstatus','includeAll','include','findAll','catch','show','params','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x243f65,_0x25d5b6){var _0x2d919f=function(_0x537f85){while(--_0x537f85){_0x243f65['push'](_0x243f65['shift']());}};_0x2d919f(++_0x25d5b6);}(_0x035e,0x113));var _0xe035=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x035e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe035('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe035('0x1'));var jsonpatch=require(_0xe035('0x2'));var rp=require('request-promise');var moment=require(_0xe035('0x3'));var BPromise=require(_0xe035('0x4'));var Mustache=require(_0xe035('0x5'));var util=require(_0xe035('0x6'));var path=require(_0xe035('0x7'));var sox=require(_0xe035('0x8'));var csv=require(_0xe035('0x9'));var ejs=require(_0xe035('0xa'));var fs=require('fs');var fs_extra=require(_0xe035('0xb'));var _=require('lodash');var squel=require(_0xe035('0xc'));var crypto=require(_0xe035('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe035('0x9'));var querystring=require(_0xe035('0xe'));var Papa=require(_0xe035('0xf'));var Redis=require(_0xe035('0x10'));var authService=require(_0xe035('0x11'));var qs=require(_0xe035('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe035('0x13'));var logger=require(_0xe035('0x14'))(_0xe035('0x15'));var utils=require(_0xe035('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe035('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22aa18,_0x2d8449){_0x2d8449=_0x2d8449||0xcc;return function(_0x408cf1){if(_0x408cf1){return _0x22aa18[_0xe035('0x18')](_0x2d8449);}return _0x22aa18[_0xe035('0x19')](_0x2d8449)[_0xe035('0x1a')]();};}function respondWithResult(_0xad6070,_0x2c71f0){_0x2c71f0=_0x2c71f0||0xc8;return function(_0x282e22){if(_0x282e22){return _0xad6070[_0xe035('0x19')](_0x2c71f0)[_0xe035('0x1b')](_0x282e22);}};}function respondWithFilteredResult(_0x157d38,_0x3964c6){return function(_0x35d353){if(_0x35d353){var _0xd37541=typeof _0x3964c6[_0xe035('0x1c')]===_0xe035('0x1d')&&typeof _0x3964c6['limit']===_0xe035('0x1d');var _0x481f66=_0x35d353[_0xe035('0x1e')];var _0x4bf696=_0xd37541?0x0:_0x3964c6[_0xe035('0x1c')];var _0x798bf8=_0xd37541?_0x35d353[_0xe035('0x1e')]:_0x3964c6[_0xe035('0x1c')]+_0x3964c6[_0xe035('0x1f')];var _0x526161;if(_0x798bf8>=_0x481f66){_0x798bf8=_0x481f66;_0x526161=0xc8;}else{_0x526161=0xce;}_0x157d38['status'](_0x526161);return _0x157d38[_0xe035('0x20')](_0xe035('0x21'),_0x4bf696+'-'+_0x798bf8+'/'+_0x481f66)[_0xe035('0x1b')](_0x35d353);}return null;};}function patchUpdates(_0x54cbd7){return function(_0x3a980f){try{jsonpatch[_0xe035('0x22')](_0x3a980f,_0x54cbd7,!![]);}catch(_0x131318){return BPromise[_0xe035('0x23')](_0x131318);}return _0x3a980f[_0xe035('0x24')]();};}function saveUpdates(_0x4092ef,_0x41431a){return function(_0x239db2){if(_0x239db2){return _0x239db2['update'](_0x4092ef)[_0xe035('0x25')](function(_0x5be658){return _0x5be658;});}return null;};}function removeEntity(_0x37255d,_0x1099ba){return function(_0x189ed8){if(_0x189ed8){return _0x189ed8['destroy']()[_0xe035('0x25')](function(){_0x37255d[_0xe035('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29ae0b,_0x12dd81){return function(_0x555c54){if(!_0x555c54){_0x29ae0b[_0xe035('0x18')](0x194);}return _0x555c54;};}function handleError(_0x4449d5,_0x45b1fa){_0x45b1fa=_0x45b1fa||0x1f4;return function(_0x7f06c8){logger['error'](_0x7f06c8[_0xe035('0x26')]);if(_0x7f06c8['name']){delete _0x7f06c8[_0xe035('0x27')];}_0x4449d5['status'](_0x45b1fa)[_0xe035('0x28')](_0x7f06c8);};}exports['index']=function(_0x3e9d71,_0x2fdcb1){var _0x2e1aaa={},_0x5d267b={},_0x6d1667={'count':0x0,'rows':[]};var _0x5e1ec6=_[_0xe035('0x29')](db['MailSubstatus'][_0xe035('0x2a')],function(_0x2e16af){return{'name':_0x2e16af['fieldName'],'type':_0x2e16af['type'][_0xe035('0x2b')]};});_0x5d267b['model']=_[_0xe035('0x29')](_0x5e1ec6,_0xe035('0x27'));_0x5d267b['query']=_[_0xe035('0x2c')](_0x3e9d71[_0xe035('0x2d')]);_0x5d267b[_0xe035('0x2e')]=_['intersection'](_0x5d267b[_0xe035('0x2f')],_0x5d267b[_0xe035('0x2d')]);_0x2e1aaa[_0xe035('0x30')]=_[_0xe035('0x31')](_0x5d267b[_0xe035('0x2f')],qs[_0xe035('0x32')](_0x3e9d71[_0xe035('0x2d')][_0xe035('0x32')]));_0x2e1aaa[_0xe035('0x30')]=_0x2e1aaa[_0xe035('0x30')][_0xe035('0x33')]?_0x2e1aaa[_0xe035('0x30')]:_0x5d267b[_0xe035('0x2f')];if(!_0x3e9d71[_0xe035('0x2d')][_0xe035('0x34')](_0xe035('0x35'))){_0x2e1aaa[_0xe035('0x1f')]=qs['limit'](_0x3e9d71[_0xe035('0x2d')][_0xe035('0x1f')]);_0x2e1aaa[_0xe035('0x1c')]=qs[_0xe035('0x1c')](_0x3e9d71[_0xe035('0x2d')][_0xe035('0x1c')]);}_0x2e1aaa[_0xe035('0x36')]=qs[_0xe035('0x37')](_0x3e9d71['query'][_0xe035('0x37')]);_0x2e1aaa[_0xe035('0x38')]=qs[_0xe035('0x2e')](_['pick'](_0x3e9d71[_0xe035('0x2d')],_0x5d267b[_0xe035('0x2e')]),_0x5e1ec6);if(_0x3e9d71[_0xe035('0x2d')]['filter']){_0x2e1aaa[_0xe035('0x38')]=_['merge'](_0x2e1aaa[_0xe035('0x38')],{'$or':_[_0xe035('0x29')](_0x5e1ec6,function(_0x42b7fc){if(_0x42b7fc[_0xe035('0x39')]!==_0xe035('0x3a')){var _0xac3959={};_0xac3959[_0x42b7fc[_0xe035('0x27')]]={'$like':'%'+_0x3e9d71[_0xe035('0x2d')][_0xe035('0x3b')]+'%'};return _0xac3959;}})});}_0x2e1aaa=_['merge']({},_0x2e1aaa,_0x3e9d71[_0xe035('0x3c')]);var _0xd266a8={'where':_0x2e1aaa['where']};return db[_0xe035('0x3d')][_0xe035('0x1e')](_0xd266a8)[_0xe035('0x25')](function(_0x3a2d68){_0x6d1667[_0xe035('0x1e')]=_0x3a2d68;if(_0x3e9d71[_0xe035('0x2d')][_0xe035('0x3e')]){_0x2e1aaa[_0xe035('0x3f')]=[{'all':!![]}];}return db[_0xe035('0x3d')][_0xe035('0x40')](_0x2e1aaa);})[_0xe035('0x25')](function(_0x14b315){_0x6d1667['rows']=_0x14b315;return _0x6d1667;})[_0xe035('0x25')](respondWithFilteredResult(_0x2fdcb1,_0x2e1aaa))[_0xe035('0x41')](handleError(_0x2fdcb1,null));};exports[_0xe035('0x42')]=function(_0xf05066,_0x1f2e6f){var _0x409260={'raw':!![],'where':{'id':_0xf05066[_0xe035('0x43')]['id']}},_0x11dac3={};_0x11dac3[_0xe035('0x2f')]=_[_0xe035('0x2c')](db[_0xe035('0x3d')][_0xe035('0x2a')]);_0x11dac3[_0xe035('0x2d')]=_[_0xe035('0x2c')](_0xf05066[_0xe035('0x2d')]);_0x11dac3[_0xe035('0x2e')]=_[_0xe035('0x31')](_0x11dac3['model'],_0x11dac3[_0xe035('0x2d')]);_0x409260[_0xe035('0x30')]=_[_0xe035('0x31')](_0x11dac3[_0xe035('0x2f')],qs[_0xe035('0x32')](_0xf05066[_0xe035('0x2d')][_0xe035('0x32')]));_0x409260[_0xe035('0x30')]=_0x409260[_0xe035('0x30')][_0xe035('0x33')]?_0x409260[_0xe035('0x30')]:_0x11dac3['model'];if(_0xf05066['query'][_0xe035('0x3e')]){_0x409260[_0xe035('0x3f')]=[{'all':!![]}];}_0x409260=_['merge']({},_0x409260,_0xf05066['options']);return db[_0xe035('0x3d')][_0xe035('0x44')](_0x409260)[_0xe035('0x25')](handleEntityNotFound(_0x1f2e6f,null))[_0xe035('0x25')](respondWithResult(_0x1f2e6f,null))[_0xe035('0x41')](handleError(_0x1f2e6f,null));};exports[_0xe035('0x45')]=function(_0x317f1e,_0x50ba35){return db[_0xe035('0x3d')][_0xe035('0x45')](_0x317f1e[_0xe035('0x46')],{})[_0xe035('0x25')](respondWithResult(_0x50ba35,0xc9))[_0xe035('0x41')](handleError(_0x50ba35,null));};exports[_0xe035('0x47')]=function(_0x58e475,_0x29ed13){if(_0x58e475[_0xe035('0x46')]['id']){delete _0x58e475['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x58e475[_0xe035('0x43')]['id']}})[_0xe035('0x25')](handleEntityNotFound(_0x29ed13,null))[_0xe035('0x25')](saveUpdates(_0x58e475[_0xe035('0x46')],null))[_0xe035('0x25')](respondWithResult(_0x29ed13,null))[_0xe035('0x41')](handleError(_0x29ed13,null));};exports[_0xe035('0x48')]=function(_0x3ab25c,_0x463cf7){return db[_0xe035('0x3d')][_0xe035('0x44')]({'where':{'id':_0x3ab25c[_0xe035('0x43')]['id']}})[_0xe035('0x25')](handleEntityNotFound(_0x463cf7,null))[_0xe035('0x25')](removeEntity(_0x463cf7,null))[_0xe035('0x41')](handleError(_0x463cf7,null));};exports[_0xe035('0x49')]=function(_0x278333,_0x2dddfd){return db[_0xe035('0x3d')]['describe']()['then'](respondWithResult(_0x2dddfd,null))[_0xe035('0x41')](handleError(_0x2dddfd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 4ef9bcf..0086691 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 _0xb812=['hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x46dcf9,_0x31fac7){var _0x11e6f1=function(_0x358b5f){while(--_0x358b5f){_0x46dcf9['push'](_0x46dcf9['shift']());}};_0x11e6f1(++_0x31fac7);}(_0xb812,0x1ea));var _0x2b81=function(_0x3b36c9,_0x46c4e4){_0x3b36c9=_0x3b36c9-0x0;var _0x343d81=_0xb812[_0x3b36c9];return _0x343d81;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x2b81('0x0'))['db'][_0x2b81('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2b81('0x2')](0x0);var events={'afterUpdate':_0x2b81('0x3')};function emitEvent(_0x292eeb){return function(_0x5a1029,_0x4a34cb,_0x45c36c){MailSubstatusEvents[_0x2b81('0x4')](_0x292eeb+':'+_0x5a1029['id'],_0x5a1029);MailSubstatusEvents[_0x2b81('0x4')](_0x292eeb,_0x5a1029);_0x45c36c(null);};}for(var e in events){if(events[_0x2b81('0x5')](e)){var event=events[e];MailSubstatus[_0x2b81('0x6')](e,emitEvent(event));}}module[_0x2b81('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xebe3=['MailSubstatus','setMaxListeners','update','emit','hook','events','../../mysqldb'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xebe3,0x1b7));var _0x3ebe=function(_0x38c9a6,_0x42830b){_0x38c9a6=_0x38c9a6-0x0;var _0x26857e=_0xebe3[_0x38c9a6];return _0x26857e;};'use strict';var EventEmitter=require(_0x3ebe('0x0'));var MailSubstatus=require(_0x3ebe('0x1'))['db'][_0x3ebe('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3ebe('0x3')](0x0);var events={'afterUpdate':_0x3ebe('0x4')};function emitEvent(_0x11a10c){return function(_0x42fe08,_0x3f0ca1,_0x2f024a){MailSubstatusEvents[_0x3ebe('0x5')](_0x11a10c+':'+_0x42fe08['id'],_0x42fe08);MailSubstatusEvents[_0x3ebe('0x5')](_0x11a10c,_0x42fe08);_0x2f024a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x3ebe('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 76c33c3..8d5e68a 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 _0xc7c7=['mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','name'];(function(_0x14f8c4,_0x3c1bfc){var _0x39b8b8=function(_0x25ce4a){while(--_0x25ce4a){_0x14f8c4['push'](_0x14f8c4['shift']());}};_0x39b8b8(++_0x3c1bfc);}(_0xc7c7,0x71));var _0x7c7c=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xc7c7[_0x4fde08];return _0x12e725;};'use strict';var attributes=require(_0x7c7c('0x0'));module[_0x7c7c('0x1')]=function(_0x35e567){var _0x23c2e3=_0x35e567[_0x7c7c('0x2')];return _0x35e567[_0x7c7c('0x3')](_0x7c7c('0x4'),attributes,{'tableName':_0x7c7c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3ef5a3,_0x349cd7,_0x586c43){return _0x23c2e3[_0x7c7c('0x6')]['update']({'value':_0x3ef5a3[_0x7c7c('0x7')]},{'where':{'field':_0x7c7c('0x8'),'value':_0x3ef5a3[_0x7c7c('0x9')][_0x7c7c('0x7')]}})[_0x7c7c('0xa')](function(){_0x586c43();})['catch'](function(_0x53b467){_0x586c43(_0x53b467);});}}});}; \ No newline at end of file +var _0x0ac1=['mail_substatuses','Condition','update','name','then','./mailSubstatus.attributes','exports','models','MailSubstatus'];(function(_0x344179,_0xb1c8a7){var _0x38fb32=function(_0x601710){while(--_0x601710){_0x344179['push'](_0x344179['shift']());}};_0x38fb32(++_0xb1c8a7);}(_0x0ac1,0x1b5));var _0x10ac=function(_0x1e000c,_0x924525){_0x1e000c=_0x1e000c-0x0;var _0x3264e7=_0x0ac1[_0x1e000c];return _0x3264e7;};'use strict';var attributes=require(_0x10ac('0x0'));module[_0x10ac('0x1')]=function(_0xf55157){var _0x4af7c7=_0xf55157[_0x10ac('0x2')];return _0xf55157['define'](_0x10ac('0x3'),attributes,{'tableName':_0x10ac('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4462a1,_0x8ccd50,_0x32333f){return _0x4af7c7[_0x10ac('0x5')][_0x10ac('0x6')]({'value':_0x4462a1['name']},{'where':{'field':'mailSubstatus','value':_0x4462a1['_previousDataValues'][_0x10ac('0x7')]}})[_0x10ac('0x8')](function(){_0x32333f();})['catch'](function(_0xf58fff){_0x32333f(_0xf58fff);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4325a04..c07a15e 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 _0x0a16=['message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x10202e,_0x5ec307){var _0x48832c=function(_0x51a983){while(--_0x51a983){_0x10202e['push'](_0x10202e['shift']());}};_0x48832c(++_0x5ec307);}(_0x0a16,0x17e));var _0x60a1=function(_0x27370e,_0x52563e){_0x27370e=_0x27370e-0x0;var _0x128247=_0x0a16[_0x27370e];return _0x128247;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60a1('0x0'));var BPromise=require(_0x60a1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60a1('0x2'));var db=require(_0x60a1('0x3'))['db'];var utils=require(_0x60a1('0x4'));var logger=require(_0x60a1('0x5'))('rpc');var config=require(_0x60a1('0x6'));var jayson=require(_0x60a1('0x7'));var client=jayson['client'][_0x60a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3811a5,_0x1e27ad,_0x30d020){return new BPromise(function(_0xfa944b,_0x48e188){return client[_0x60a1('0x9')](_0x3811a5,_0x30d020)['then'](function(_0x438b65){logger[_0x60a1('0xa')](_0x60a1('0xb'),_0x1e27ad,_0x60a1('0xc'));logger[_0x60a1('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1e27ad,_0x60a1('0xc'),JSON[_0x60a1('0xe')](_0x438b65));if(_0x438b65[_0x60a1('0xf')]){if(_0x438b65[_0x60a1('0xf')][_0x60a1('0x10')]===0x1f4){logger[_0x60a1('0xf')](_0x60a1('0xb'),_0x1e27ad,_0x438b65['error'][_0x60a1('0x11')]);return _0x48e188(_0x438b65[_0x60a1('0xf')][_0x60a1('0x11')]);}logger['error'](_0x60a1('0xb'),_0x1e27ad,_0x438b65['error'][_0x60a1('0x11')]);return _0xfa944b(_0x438b65['error']['message']);}else{logger[_0x60a1('0xa')](_0x60a1('0xb'),_0x1e27ad,'request\x20sent');_0xfa944b(_0x438b65[_0x60a1('0x12')][_0x60a1('0x11')]);}})['catch'](function(_0x4ea193){logger[_0x60a1('0xf')](_0x60a1('0xb'),_0x1e27ad,_0x4ea193);_0x48e188(_0x4ea193);});});} \ No newline at end of file +var _0x792d=['rpc','../../config/environment','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1ddb15,_0x3f9ad4){var _0x5bd2e1=function(_0x575cb3){while(--_0x575cb3){_0x1ddb15['push'](_0x1ddb15['shift']());}};_0x5bd2e1(++_0x3f9ad4);}(_0x792d,0x1cf));var _0xd792=function(_0xad38ea,_0xc872b2){_0xad38ea=_0xad38ea-0x0;var _0x3cd4b7=_0x792d[_0xad38ea];return _0x3cd4b7;};'use strict';var _=require(_0xd792('0x0'));var util=require('util');var moment=require(_0xd792('0x1'));var BPromise=require(_0xd792('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd792('0x3'))['db'];var utils=require(_0xd792('0x4'));var logger=require('../../config/logger')(_0xd792('0x5'));var config=require(_0xd792('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd792('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdea090,_0x316c17,_0xe92fac){return new BPromise(function(_0x1d1d5a,_0x4db81b){return client[_0xd792('0x8')](_0xdea090,_0xe92fac)[_0xd792('0x9')](function(_0x498e2b){logger[_0xd792('0xa')](_0xd792('0xb'),_0x316c17,_0xd792('0xc'));logger['debug'](_0xd792('0xd'),_0x316c17,_0xd792('0xc'),JSON['stringify'](_0x498e2b));if(_0x498e2b[_0xd792('0xe')]){if(_0x498e2b[_0xd792('0xe')][_0xd792('0xf')]===0x1f4){logger[_0xd792('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x316c17,_0x498e2b[_0xd792('0xe')][_0xd792('0x10')]);return _0x4db81b(_0x498e2b[_0xd792('0xe')][_0xd792('0x10')]);}logger[_0xd792('0xe')](_0xd792('0xb'),_0x316c17,_0x498e2b[_0xd792('0xe')]['message']);return _0x1d1d5a(_0x498e2b[_0xd792('0xe')][_0xd792('0x10')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x316c17,_0xd792('0xc'));_0x1d1d5a(_0x498e2b[_0xd792('0x11')][_0xd792('0x10')]);}})['catch'](function(_0x265ee9){logger['error'](_0xd792('0xb'),_0x316c17,_0x265ee9);_0x4db81b(_0x265ee9);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f12d6fe..b0b6d92 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 _0x4cb7=['/:id','show','post','put','update','exports','path','connect-timeout','Router','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x3e2ea1,_0x473055){var _0x4f830d=function(_0x22949d){while(--_0x22949d){_0x3e2ea1['push'](_0x3e2ea1['shift']());}};_0x4f830d(++_0x473055);}(_0x4cb7,0x86));var _0x74cb=function(_0x63de01,_0x140a1b){_0x63de01=_0x63de01-0x0;var _0x17d66f=_0x4cb7[_0x63de01];return _0x17d66f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x74cb('0x0'));var timeout=require(_0x74cb('0x1'));var express=require('express');var router=express[_0x74cb('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74cb('0x3'));var config=require('../../config/environment');var controller=require(_0x74cb('0x4'));router[_0x74cb('0x5')]('/',auth['isAuthenticated'](),controller[_0x74cb('0x6')]);router[_0x74cb('0x5')](_0x74cb('0x7'),auth[_0x74cb('0x8')](),controller[_0x74cb('0x9')]);router[_0x74cb('0x5')](_0x74cb('0xa'),auth[_0x74cb('0x8')](),controller[_0x74cb('0xb')]);router[_0x74cb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74cb('0xd')]('/:id',auth[_0x74cb('0x8')](),controller[_0x74cb('0xe')]);router['delete'](_0x74cb('0xa'),auth[_0x74cb('0x8')](),controller['destroy']);module[_0x74cb('0xf')]=router; \ No newline at end of file +var _0xe8ed=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x39c4c7,_0x2ddfa9){var _0x32f7b3=function(_0x22880f){while(--_0x22880f){_0x39c4c7['push'](_0x39c4c7['shift']());}};_0x32f7b3(++_0x2ddfa9);}(_0xe8ed,0xb6));var _0xde8e=function(_0x1eacaa,_0x3da655){_0x1eacaa=_0x1eacaa-0x0;var _0x411223=_0xe8ed[_0x1eacaa];return _0x411223;};'use strict';var multer=require(_0xde8e('0x0'));var util=require(_0xde8e('0x1'));var path=require('path');var timeout=require(_0xde8e('0x2'));var express=require(_0xde8e('0x3'));var router=express[_0xde8e('0x4')]();var fs_extra=require(_0xde8e('0x5'));var auth=require(_0xde8e('0x6'));var interaction=require(_0xde8e('0x7'));var config=require(_0xde8e('0x8'));var controller=require(_0xde8e('0x9'));router[_0xde8e('0xa')]('/',auth[_0xde8e('0xb')](),controller[_0xde8e('0xc')]);router[_0xde8e('0xa')](_0xde8e('0xd'),auth[_0xde8e('0xb')](),controller[_0xde8e('0xe')]);router[_0xde8e('0xa')](_0xde8e('0xf'),auth[_0xde8e('0xb')](),controller['show']);router[_0xde8e('0x10')]('/',auth[_0xde8e('0xb')](),controller[_0xde8e('0x11')]);router[_0xde8e('0x12')](_0xde8e('0xf'),auth[_0xde8e('0xb')](),controller[_0xde8e('0x13')]);router[_0xde8e('0x14')](_0xde8e('0xf'),auth[_0xde8e('0xb')](),controller[_0xde8e('0x15')]);module[_0xde8e('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 493cd65..363f075 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x9bde,0xe1));var _0xe9bd=function(_0x51bce2,_0x4e7124){_0x51bce2=_0x51bce2-0x0;var _0x5b955e=_0x9bde[_0x51bce2];return _0x5b955e;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1120c7,_0x18f931){var _0x436f8a=function(_0x19f1dd){while(--_0x19f1dd){_0x1120c7['push'](_0x1120c7['shift']());}};_0x436f8a(++_0x18f931);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index afeea64..6f6d42d 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 _0xd7ca=['include','findAll','rows','show','params','rawAttributes','intersection','length','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ca,0xe8));var _0xad7c=function(_0x2841f9,_0x50fdcd){_0x2841f9=_0x2841f9-0x0;var _0x25fc99=_0xd7ca[_0x2841f9];return _0x25fc99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad7c('0x0'));var zipdir=require(_0xad7c('0x1'));var jsonpatch=require(_0xad7c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad7c('0x3'));var Mustache=require(_0xad7c('0x4'));var util=require(_0xad7c('0x5'));var path=require('path');var sox=require(_0xad7c('0x6'));var csv=require(_0xad7c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad7c('0x8'));var _=require(_0xad7c('0x9'));var squel=require(_0xad7c('0xa'));var crypto=require('crypto');var jsforce=require(_0xad7c('0xb'));var deskjs=require(_0xad7c('0xc'));var toCsv=require(_0xad7c('0x7'));var querystring=require(_0xad7c('0xd'));var Papa=require('papaparse');var Redis=require(_0xad7c('0xe'));var authService=require(_0xad7c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xad7c('0x10'));var hardwareService=require(_0xad7c('0x11'));var logger=require(_0xad7c('0x12'))(_0xad7c('0x13'));var utils=require(_0xad7c('0x14'));var config=require(_0xad7c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad7c('0x16'))['db'];function respondWithStatusCode(_0x23f805,_0x241e45){_0x241e45=_0x241e45||0xcc;return function(_0x4bc343){if(_0x4bc343){return _0x23f805[_0xad7c('0x17')](_0x241e45);}return _0x23f805['status'](_0x241e45)[_0xad7c('0x18')]();};}function respondWithResult(_0x2f5a47,_0xbc6e63){_0xbc6e63=_0xbc6e63||0xc8;return function(_0x21cacc){if(_0x21cacc){return _0x2f5a47['status'](_0xbc6e63)[_0xad7c('0x19')](_0x21cacc);}};}function respondWithFilteredResult(_0x49afd7,_0x95f069){return function(_0x5261c6){if(_0x5261c6){var _0x10e1c2=typeof _0x95f069[_0xad7c('0x1a')]===_0xad7c('0x1b')&&typeof _0x95f069[_0xad7c('0x1c')]===_0xad7c('0x1b');var _0x5cc157=_0x5261c6['count'];var _0x554e90=_0x10e1c2?0x0:_0x95f069[_0xad7c('0x1a')];var _0x491312=_0x10e1c2?_0x5261c6[_0xad7c('0x1d')]:_0x95f069[_0xad7c('0x1a')]+_0x95f069['limit'];var _0x2e61c1;if(_0x491312>=_0x5cc157){_0x491312=_0x5cc157;_0x2e61c1=0xc8;}else{_0x2e61c1=0xce;}_0x49afd7[_0xad7c('0x1e')](_0x2e61c1);return _0x49afd7[_0xad7c('0x1f')](_0xad7c('0x20'),_0x554e90+'-'+_0x491312+'/'+_0x5cc157)[_0xad7c('0x19')](_0x5261c6);}return null;};}function patchUpdates(_0x41ff89){return function(_0x3e32cb){try{jsonpatch['apply'](_0x3e32cb,_0x41ff89,!![]);}catch(_0x547596){return BPromise[_0xad7c('0x21')](_0x547596);}return _0x3e32cb['save']();};}function saveUpdates(_0x22740c,_0x2f96c0){return function(_0x3c8f77){if(_0x3c8f77){return _0x3c8f77[_0xad7c('0x22')](_0x22740c)[_0xad7c('0x23')](function(_0x47e9ec){return _0x47e9ec;});}return null;};}function removeEntity(_0xe35156,_0x37efbf){return function(_0x38a500){if(_0x38a500){return _0x38a500[_0xad7c('0x24')]()['then'](function(){_0xe35156['status'](0xcc)[_0xad7c('0x18')]();});}};}function handleEntityNotFound(_0x44a485,_0x488e36){return function(_0x26f214){if(!_0x26f214){_0x44a485[_0xad7c('0x17')](0x194);}return _0x26f214;};}function handleError(_0x53fc18,_0x37df0a){_0x37df0a=_0x37df0a||0x1f4;return function(_0x43aee6){logger[_0xad7c('0x25')](_0x43aee6[_0xad7c('0x26')]);if(_0x43aee6[_0xad7c('0x27')]){delete _0x43aee6['name'];}_0x53fc18[_0xad7c('0x1e')](_0x37df0a)[_0xad7c('0x28')](_0x43aee6);};}exports['index']=function(_0x2d0c0e,_0x382b6d){var _0xe1f53d={},_0x2ee1e0={},_0x4d28f6={'count':0x0,'rows':[]};var _0x4d03d8=_[_0xad7c('0x29')](db[_0xad7c('0x2a')]['rawAttributes'],function(_0x12e109){return{'name':_0x12e109[_0xad7c('0x2b')],'type':_0x12e109[_0xad7c('0x2c')][_0xad7c('0x2d')]};});_0x2ee1e0[_0xad7c('0x2e')]=_['map'](_0x4d03d8,'name');_0x2ee1e0[_0xad7c('0x2f')]=_[_0xad7c('0x30')](_0x2d0c0e[_0xad7c('0x2f')]);_0x2ee1e0[_0xad7c('0x31')]=_['intersection'](_0x2ee1e0[_0xad7c('0x2e')],_0x2ee1e0[_0xad7c('0x2f')]);_0xe1f53d[_0xad7c('0x32')]=_['intersection'](_0x2ee1e0[_0xad7c('0x2e')],qs[_0xad7c('0x33')](_0x2d0c0e['query'][_0xad7c('0x33')]));_0xe1f53d[_0xad7c('0x32')]=_0xe1f53d[_0xad7c('0x32')]['length']?_0xe1f53d[_0xad7c('0x32')]:_0x2ee1e0[_0xad7c('0x2e')];if(!_0x2d0c0e[_0xad7c('0x2f')]['hasOwnProperty'](_0xad7c('0x34'))){_0xe1f53d[_0xad7c('0x1c')]=qs[_0xad7c('0x1c')](_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x1c')]);_0xe1f53d[_0xad7c('0x1a')]=qs[_0xad7c('0x1a')](_0x2d0c0e['query'][_0xad7c('0x1a')]);}_0xe1f53d['order']=qs['sort'](_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x35')]);_0xe1f53d[_0xad7c('0x36')]=qs[_0xad7c('0x31')](_[_0xad7c('0x37')](_0x2d0c0e[_0xad7c('0x2f')],_0x2ee1e0[_0xad7c('0x31')]),_0x4d03d8);if(_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x38')]){_0xe1f53d[_0xad7c('0x36')]=_[_0xad7c('0x39')](_0xe1f53d[_0xad7c('0x36')],{'$or':_['map'](_0x4d03d8,function(_0x2aa800){if(_0x2aa800['type']!==_0xad7c('0x3a')){var _0x1a6d46={};_0x1a6d46[_0x2aa800[_0xad7c('0x27')]]={'$like':'%'+_0x2d0c0e[_0xad7c('0x2f')]['filter']+'%'};return _0x1a6d46;}})});}_0xe1f53d=_[_0xad7c('0x39')]({},_0xe1f53d,_0x2d0c0e['options']);var _0x563348={'where':_0xe1f53d[_0xad7c('0x36')]};return db[_0xad7c('0x2a')]['count'](_0x563348)[_0xad7c('0x23')](function(_0x1ac035){_0x4d28f6[_0xad7c('0x1d')]=_0x1ac035;if(_0x2d0c0e[_0xad7c('0x2f')][_0xad7c('0x3b')]){_0xe1f53d[_0xad7c('0x3c')]=[{'all':!![]}];}return db[_0xad7c('0x2a')][_0xad7c('0x3d')](_0xe1f53d);})['then'](function(_0x34c3bd){_0x4d28f6[_0xad7c('0x3e')]=_0x34c3bd;return _0x4d28f6;})[_0xad7c('0x23')](respondWithFilteredResult(_0x382b6d,_0xe1f53d))['catch'](handleError(_0x382b6d,null));};exports[_0xad7c('0x3f')]=function(_0xb3243b,_0x155d36){var _0x321dcc={'raw':!![],'where':{'id':_0xb3243b[_0xad7c('0x40')]['id']}},_0xdef7ac={};_0xdef7ac[_0xad7c('0x2e')]=_[_0xad7c('0x30')](db[_0xad7c('0x2a')][_0xad7c('0x41')]);_0xdef7ac['query']=_[_0xad7c('0x30')](_0xb3243b['query']);_0xdef7ac[_0xad7c('0x31')]=_[_0xad7c('0x42')](_0xdef7ac[_0xad7c('0x2e')],_0xdef7ac['query']);_0x321dcc[_0xad7c('0x32')]=_[_0xad7c('0x42')](_0xdef7ac[_0xad7c('0x2e')],qs[_0xad7c('0x33')](_0xb3243b['query'][_0xad7c('0x33')]));_0x321dcc[_0xad7c('0x32')]=_0x321dcc[_0xad7c('0x32')][_0xad7c('0x43')]?_0x321dcc[_0xad7c('0x32')]:_0xdef7ac[_0xad7c('0x2e')];if(_0xb3243b[_0xad7c('0x2f')][_0xad7c('0x3b')]){_0x321dcc['include']=[{'all':!![]}];}_0x321dcc=_['merge']({},_0x321dcc,_0xb3243b['options']);return db['MailTransferReport'][_0xad7c('0x44')](_0x321dcc)[_0xad7c('0x23')](handleEntityNotFound(_0x155d36,null))[_0xad7c('0x23')](respondWithResult(_0x155d36,null))[_0xad7c('0x45')](handleError(_0x155d36,null));};exports[_0xad7c('0x46')]=function(_0x18a46b,_0x17b300){return db['MailTransferReport'][_0xad7c('0x46')](_0x18a46b['body'],{})[_0xad7c('0x23')](respondWithResult(_0x17b300,0xc9))['catch'](handleError(_0x17b300,null));};exports['update']=function(_0x1497ac,_0x21c443){if(_0x1497ac[_0xad7c('0x47')]['id']){delete _0x1497ac['body']['id'];}return db[_0xad7c('0x2a')][_0xad7c('0x44')]({'where':{'id':_0x1497ac[_0xad7c('0x40')]['id']}})[_0xad7c('0x23')](handleEntityNotFound(_0x21c443,null))['then'](saveUpdates(_0x1497ac[_0xad7c('0x47')],null))['then'](respondWithResult(_0x21c443,null))[_0xad7c('0x45')](handleError(_0x21c443,null));};exports['destroy']=function(_0x189a0d,_0x4cd909){return db[_0xad7c('0x2a')][_0xad7c('0x44')]({'where':{'id':_0x189a0d[_0xad7c('0x40')]['id']}})[_0xad7c('0x23')](handleEntityNotFound(_0x4cd909,null))[_0xad7c('0x23')](removeEntity(_0x4cd909,null))[_0xad7c('0x45')](handleError(_0x4cd909,null));};exports[_0xad7c('0x48')]=function(_0x30fd69,_0x52b3f2){return db['MailTransferReport'][_0xad7c('0x48')]()[_0xad7c('0x23')](respondWithResult(_0x52b3f2,null))[_0xad7c('0x45')](handleError(_0x52b3f2,null));}; \ No newline at end of file +var _0xffb0=['error','name','send','index','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','params','describe','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','save','update','then','destroy'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xffb0,0x154));var _0x0ffb=function(_0x1068a2,_0x3134d7){_0x1068a2=_0x1068a2-0x0;var _0x1c1b9f=_0xffb0[_0x1068a2];return _0x1c1b9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ffb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ffb('0x1'));var moment=require(_0x0ffb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0ffb('0x3'));var util=require(_0x0ffb('0x4'));var path=require(_0x0ffb('0x5'));var sox=require(_0x0ffb('0x6'));var csv=require(_0x0ffb('0x7'));var ejs=require(_0x0ffb('0x8'));var fs=require('fs');var fs_extra=require(_0x0ffb('0x9'));var _=require(_0x0ffb('0xa'));var squel=require(_0x0ffb('0xb'));var crypto=require(_0x0ffb('0xc'));var jsforce=require(_0x0ffb('0xd'));var deskjs=require(_0x0ffb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ffb('0xf'));var Papa=require(_0x0ffb('0x10'));var Redis=require(_0x0ffb('0x11'));var authService=require(_0x0ffb('0x12'));var qs=require(_0x0ffb('0x13'));var as=require(_0x0ffb('0x14'));var hardwareService=require(_0x0ffb('0x15'));var logger=require(_0x0ffb('0x16'))(_0x0ffb('0x17'));var utils=require(_0x0ffb('0x18'));var config=require(_0x0ffb('0x19'));var licenseUtil=require(_0x0ffb('0x1a'));var db=require(_0x0ffb('0x1b'))['db'];function respondWithStatusCode(_0x142130,_0x151873){_0x151873=_0x151873||0xcc;return function(_0x5d840d){if(_0x5d840d){return _0x142130[_0x0ffb('0x1c')](_0x151873);}return _0x142130[_0x0ffb('0x1d')](_0x151873)[_0x0ffb('0x1e')]();};}function respondWithResult(_0x3f6ebd,_0x452e5e){_0x452e5e=_0x452e5e||0xc8;return function(_0x62eb91){if(_0x62eb91){return _0x3f6ebd[_0x0ffb('0x1d')](_0x452e5e)['json'](_0x62eb91);}};}function respondWithFilteredResult(_0x18f71f,_0x2bac76){return function(_0x39780b){if(_0x39780b){var _0x2372fd=typeof _0x2bac76[_0x0ffb('0x1f')]===_0x0ffb('0x20')&&typeof _0x2bac76[_0x0ffb('0x21')]===_0x0ffb('0x20');var _0x5bbb30=_0x39780b['count'];var _0x4bba26=_0x2372fd?0x0:_0x2bac76[_0x0ffb('0x1f')];var _0x218826=_0x2372fd?_0x39780b['count']:_0x2bac76[_0x0ffb('0x1f')]+_0x2bac76[_0x0ffb('0x21')];var _0x4a23d6;if(_0x218826>=_0x5bbb30){_0x218826=_0x5bbb30;_0x4a23d6=0xc8;}else{_0x4a23d6=0xce;}_0x18f71f[_0x0ffb('0x1d')](_0x4a23d6);return _0x18f71f[_0x0ffb('0x22')]('Content-Range',_0x4bba26+'-'+_0x218826+'/'+_0x5bbb30)['json'](_0x39780b);}return null;};}function patchUpdates(_0x5ea6bf){return function(_0xee0036){try{jsonpatch[_0x0ffb('0x23')](_0xee0036,_0x5ea6bf,!![]);}catch(_0x2c9e64){return BPromise['reject'](_0x2c9e64);}return _0xee0036[_0x0ffb('0x24')]();};}function saveUpdates(_0x1681f4,_0x23eff8){return function(_0x520d85){if(_0x520d85){return _0x520d85[_0x0ffb('0x25')](_0x1681f4)[_0x0ffb('0x26')](function(_0x417085){return _0x417085;});}return null;};}function removeEntity(_0xf0c39b,_0x303ee0){return function(_0xa2281c){if(_0xa2281c){return _0xa2281c[_0x0ffb('0x27')]()[_0x0ffb('0x26')](function(){_0xf0c39b[_0x0ffb('0x1d')](0xcc)[_0x0ffb('0x1e')]();});}};}function handleEntityNotFound(_0x1bc533,_0x28d7f7){return function(_0x5b744e){if(!_0x5b744e){_0x1bc533[_0x0ffb('0x1c')](0x194);}return _0x5b744e;};}function handleError(_0x5c5d49,_0x577296){_0x577296=_0x577296||0x1f4;return function(_0x2919d4){logger[_0x0ffb('0x28')](_0x2919d4['stack']);if(_0x2919d4[_0x0ffb('0x29')]){delete _0x2919d4[_0x0ffb('0x29')];}_0x5c5d49[_0x0ffb('0x1d')](_0x577296)[_0x0ffb('0x2a')](_0x2919d4);};}exports[_0x0ffb('0x2b')]=function(_0x419d67,_0x2b933f){var _0x351d12={},_0x546ea4={},_0x1315df={'count':0x0,'rows':[]};var _0x353901=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x19d3fe){return{'name':_0x19d3fe[_0x0ffb('0x2c')],'type':_0x19d3fe[_0x0ffb('0x2d')]['key']};});_0x546ea4[_0x0ffb('0x2e')]=_[_0x0ffb('0x2f')](_0x353901,_0x0ffb('0x29'));_0x546ea4[_0x0ffb('0x30')]=_[_0x0ffb('0x31')](_0x419d67[_0x0ffb('0x30')]);_0x546ea4[_0x0ffb('0x32')]=_['intersection'](_0x546ea4['model'],_0x546ea4[_0x0ffb('0x30')]);_0x351d12[_0x0ffb('0x33')]=_['intersection'](_0x546ea4[_0x0ffb('0x2e')],qs[_0x0ffb('0x34')](_0x419d67[_0x0ffb('0x30')][_0x0ffb('0x34')]));_0x351d12[_0x0ffb('0x33')]=_0x351d12[_0x0ffb('0x33')][_0x0ffb('0x35')]?_0x351d12[_0x0ffb('0x33')]:_0x546ea4[_0x0ffb('0x2e')];if(!_0x419d67[_0x0ffb('0x30')][_0x0ffb('0x36')](_0x0ffb('0x37'))){_0x351d12[_0x0ffb('0x21')]=qs[_0x0ffb('0x21')](_0x419d67['query']['limit']);_0x351d12[_0x0ffb('0x1f')]=qs[_0x0ffb('0x1f')](_0x419d67['query']['offset']);}_0x351d12[_0x0ffb('0x38')]=qs[_0x0ffb('0x39')](_0x419d67[_0x0ffb('0x30')]['sort']);_0x351d12[_0x0ffb('0x3a')]=qs[_0x0ffb('0x32')](_['pick'](_0x419d67['query'],_0x546ea4[_0x0ffb('0x32')]),_0x353901);if(_0x419d67[_0x0ffb('0x30')]['filter']){_0x351d12[_0x0ffb('0x3a')]=_[_0x0ffb('0x3b')](_0x351d12['where'],{'$or':_[_0x0ffb('0x2f')](_0x353901,function(_0x2f518e){if(_0x2f518e['type']!==_0x0ffb('0x3c')){var _0x1e127f={};_0x1e127f[_0x2f518e[_0x0ffb('0x29')]]={'$like':'%'+_0x419d67[_0x0ffb('0x30')]['filter']+'%'};return _0x1e127f;}})});}_0x351d12=_['merge']({},_0x351d12,_0x419d67[_0x0ffb('0x3d')]);var _0x8d1862={'where':_0x351d12[_0x0ffb('0x3a')]};return db[_0x0ffb('0x3e')][_0x0ffb('0x3f')](_0x8d1862)['then'](function(_0x22910b){_0x1315df[_0x0ffb('0x3f')]=_0x22910b;if(_0x419d67[_0x0ffb('0x30')][_0x0ffb('0x40')]){_0x351d12[_0x0ffb('0x41')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x351d12);})['then'](function(_0x406075){_0x1315df[_0x0ffb('0x42')]=_0x406075;return _0x1315df;})[_0x0ffb('0x26')](respondWithFilteredResult(_0x2b933f,_0x351d12))[_0x0ffb('0x43')](handleError(_0x2b933f,null));};exports[_0x0ffb('0x44')]=function(_0x8dfe0,_0xe1bdb0){var _0x37c715={'raw':!![],'where':{'id':_0x8dfe0['params']['id']}},_0x565d37={};_0x565d37[_0x0ffb('0x2e')]=_[_0x0ffb('0x31')](db['MailTransferReport'][_0x0ffb('0x45')]);_0x565d37[_0x0ffb('0x30')]=_[_0x0ffb('0x31')](_0x8dfe0['query']);_0x565d37[_0x0ffb('0x32')]=_[_0x0ffb('0x46')](_0x565d37[_0x0ffb('0x2e')],_0x565d37[_0x0ffb('0x30')]);_0x37c715[_0x0ffb('0x33')]=_[_0x0ffb('0x46')](_0x565d37[_0x0ffb('0x2e')],qs[_0x0ffb('0x34')](_0x8dfe0[_0x0ffb('0x30')][_0x0ffb('0x34')]));_0x37c715[_0x0ffb('0x33')]=_0x37c715['attributes'][_0x0ffb('0x35')]?_0x37c715[_0x0ffb('0x33')]:_0x565d37['model'];if(_0x8dfe0[_0x0ffb('0x30')][_0x0ffb('0x40')]){_0x37c715[_0x0ffb('0x41')]=[{'all':!![]}];}_0x37c715=_[_0x0ffb('0x3b')]({},_0x37c715,_0x8dfe0[_0x0ffb('0x3d')]);return db[_0x0ffb('0x3e')][_0x0ffb('0x47')](_0x37c715)['then'](handleEntityNotFound(_0xe1bdb0,null))[_0x0ffb('0x26')](respondWithResult(_0xe1bdb0,null))[_0x0ffb('0x43')](handleError(_0xe1bdb0,null));};exports[_0x0ffb('0x48')]=function(_0x5cf0f3,_0xe2c6b){return db[_0x0ffb('0x3e')][_0x0ffb('0x48')](_0x5cf0f3[_0x0ffb('0x49')],{})[_0x0ffb('0x26')](respondWithResult(_0xe2c6b,0xc9))[_0x0ffb('0x43')](handleError(_0xe2c6b,null));};exports[_0x0ffb('0x25')]=function(_0x22ee7b,_0x5e1f2f){if(_0x22ee7b[_0x0ffb('0x49')]['id']){delete _0x22ee7b['body']['id'];}return db[_0x0ffb('0x3e')]['find']({'where':{'id':_0x22ee7b[_0x0ffb('0x4a')]['id']}})[_0x0ffb('0x26')](handleEntityNotFound(_0x5e1f2f,null))['then'](saveUpdates(_0x22ee7b[_0x0ffb('0x49')],null))[_0x0ffb('0x26')](respondWithResult(_0x5e1f2f,null))[_0x0ffb('0x43')](handleError(_0x5e1f2f,null));};exports[_0x0ffb('0x27')]=function(_0xdbaf8c,_0x1fbb24){return db['MailTransferReport'][_0x0ffb('0x47')]({'where':{'id':_0xdbaf8c[_0x0ffb('0x4a')]['id']}})[_0x0ffb('0x26')](handleEntityNotFound(_0x1fbb24,null))[_0x0ffb('0x26')](removeEntity(_0x1fbb24,null))[_0x0ffb('0x43')](handleError(_0x1fbb24,null));};exports[_0x0ffb('0x4b')]=function(_0x1a44b2,_0x44024a){return db[_0x0ffb('0x3e')][_0x0ffb('0x4b')]()['then'](respondWithResult(_0x44024a,null))[_0x0ffb('0x43')](handleError(_0x44024a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a3f2a81..ce884a0 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 _0x3ffb=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xfa775,_0xac95e0){var _0x515801=function(_0xf9c694){while(--_0xf9c694){_0xfa775['push'](_0xfa775['shift']());}};_0x515801(++_0xac95e0);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x225d9c,_0x15ae60){_0x225d9c=_0x225d9c-0x0;var _0x5af39d=_0x3ffb[_0x225d9c];return _0x5af39d;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var logger=require(_0xb3ff('0x2'))(_0xb3ff('0x3'));var moment=require(_0xb3ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3ff('0x5'));var fs=require('fs');var path=require(_0xb3ff('0x6'));var rimraf=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var attributes=require(_0xb3ff('0x9'));module[_0xb3ff('0xa')]=function(_0x45d514,_0x59bcb3){return _0x45d514[_0xb3ff('0xb')](_0xb3ff('0xc'),attributes,{'tableName':_0xb3ff('0xd'),'paranoid':![],'indexes':[{'name':_0xb3ff('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1738=['lodash','util','moment','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x1738,0x1bc));var _0x8173=function(_0x34c819,_0x2d4fd5){_0x34c819=_0x34c819-0x0;var _0x51912e=_0x1738[_0x34c819];return _0x51912e;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8173('0x2'));var BPromise=require(_0x8173('0x3'));var rp=require(_0x8173('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8173('0x5'));var attributes=require(_0x8173('0x6'));module[_0x8173('0x7')]=function(_0x3cf9ac,_0x2220fd){return _0x3cf9ac[_0x8173('0x8')](_0x8173('0x9'),attributes,{'tableName':_0x8173('0xa'),'paranoid':![],'indexes':[{'name':_0x8173('0xb'),'fields':[_0x8173('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 35071ff..8d7569a 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 _0xf557=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x1ad04e,_0xf269b6){var _0xc1a78a=function(_0x410c64){while(--_0x410c64){_0x1ad04e['push'](_0x1ad04e['shift']());}};_0xc1a78a(++_0xf269b6);}(_0xf557,0x18f));var _0x7f55=function(_0x14af7c,_0x5d3c02){_0x14af7c=_0x14af7c-0x0;var _0x540da0=_0xf557[_0x14af7c];return _0x540da0;};'use strict';var _=require(_0x7f55('0x0'));var util=require(_0x7f55('0x1'));var moment=require(_0x7f55('0x2'));var BPromise=require(_0x7f55('0x3'));var rs=require(_0x7f55('0x4'));var fs=require('fs');var Redis=require(_0x7f55('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f55('0x6'));var logger=require(_0x7f55('0x7'))(_0x7f55('0x8'));var config=require('../../config/environment');var jayson=require(_0x7f55('0x9'));var client=jayson[_0x7f55('0xa')][_0x7f55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11faab,_0x54a3f5,_0x1ed7d9){return new BPromise(function(_0x522d75,_0x246eae){return client[_0x7f55('0xc')](_0x11faab,_0x1ed7d9)['then'](function(_0x22aa95){logger[_0x7f55('0xd')](_0x7f55('0xe'),_0x54a3f5,_0x7f55('0xf'));logger[_0x7f55('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x54a3f5,_0x7f55('0xf'),JSON[_0x7f55('0x11')](_0x22aa95));if(_0x22aa95[_0x7f55('0x12')]){if(_0x22aa95['error'][_0x7f55('0x13')]===0x1f4){logger[_0x7f55('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x54a3f5,_0x22aa95[_0x7f55('0x12')]['message']);return _0x246eae(_0x22aa95[_0x7f55('0x12')][_0x7f55('0x14')]);}logger[_0x7f55('0x12')](_0x7f55('0xe'),_0x54a3f5,_0x22aa95[_0x7f55('0x12')][_0x7f55('0x14')]);return _0x522d75(_0x22aa95['error'][_0x7f55('0x14')]);}else{logger['info'](_0x7f55('0xe'),_0x54a3f5,_0x7f55('0xf'));_0x522d75(_0x22aa95[_0x7f55('0x15')][_0x7f55('0x14')]);}})[_0x7f55('0x16')](function(_0x461403){logger['error'](_0x7f55('0xe'),_0x54a3f5,_0x461403);_0x246eae(_0x461403);});});} \ No newline at end of file +var _0xa235=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xa235,0xdc));var _0x5a23=function(_0x5edcd7,_0x4c5e59){_0x5edcd7=_0x5edcd7-0x0;var _0x2f5b45=_0xa235[_0x5edcd7];return _0x2f5b45;};'use strict';var _=require(_0x5a23('0x0'));var util=require(_0x5a23('0x1'));var moment=require(_0x5a23('0x2'));var BPromise=require(_0x5a23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a23('0x4'));var db=require(_0x5a23('0x5'))['db'];var utils=require(_0x5a23('0x6'));var logger=require('../../config/logger')(_0x5a23('0x7'));var config=require(_0x5a23('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5a23('0x9')][_0x5a23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37f40f,_0x230d66,_0x1736bf){return new BPromise(function(_0x3a3156,_0x1ba833){return client[_0x5a23('0xb')](_0x37f40f,_0x1736bf)[_0x5a23('0xc')](function(_0x134b00){logger['info'](_0x5a23('0xd'),_0x230d66,_0x5a23('0xe'));logger['debug'](_0x5a23('0xf'),_0x230d66,_0x5a23('0xe'),JSON[_0x5a23('0x10')](_0x134b00));if(_0x134b00[_0x5a23('0x11')]){if(_0x134b00[_0x5a23('0x11')]['code']===0x1f4){logger[_0x5a23('0x11')](_0x5a23('0xd'),_0x230d66,_0x134b00[_0x5a23('0x11')][_0x5a23('0x12')]);return _0x1ba833(_0x134b00[_0x5a23('0x11')][_0x5a23('0x12')]);}logger[_0x5a23('0x11')](_0x5a23('0xd'),_0x230d66,_0x134b00['error']['message']);return _0x3a3156(_0x134b00[_0x5a23('0x11')][_0x5a23('0x12')]);}else{logger[_0x5a23('0x13')](_0x5a23('0xd'),_0x230d66,_0x5a23('0xe'));_0x3a3156(_0x134b00[_0x5a23('0x14')][_0x5a23('0x12')]);}})[_0x5a23('0x15')](function(_0x3a597d){logger['error'](_0x5a23('0xd'),_0x230d66,_0x3a597d);_0x1ba833(_0x3a597d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index eb4312c..3f85962 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 _0xa8da=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8da,0x16c));var _0xaa8d=function(_0x5210f8,_0x3f5fad){_0x5210f8=_0x5210f8-0x0;var _0x29dc51=_0xa8da[_0x5210f8];return _0x29dc51;};'use strict';var multer=require(_0xaa8d('0x0'));var util=require(_0xaa8d('0x1'));var path=require(_0xaa8d('0x2'));var timeout=require(_0xaa8d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa8d('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xaa8d('0x5')]('/',auth['isAuthenticated'](),controller[_0xaa8d('0x6')]);router[_0xaa8d('0x5')](_0xaa8d('0x7'),auth[_0xaa8d('0x8')](),controller[_0xaa8d('0x9')]);router[_0xaa8d('0x5')](_0xaa8d('0xa'),auth['isAuthenticated'](),controller[_0xaa8d('0xb')]);router[_0xaa8d('0xc')]('/',auth[_0xaa8d('0x8')](),controller[_0xaa8d('0xd')]);router[_0xaa8d('0xe')]('/:id',auth[_0xaa8d('0x8')](),controller[_0xaa8d('0xf')]);router[_0xaa8d('0x10')](_0xaa8d('0xa'),auth[_0xaa8d('0x8')](),controller[_0xaa8d('0x11')]);module[_0xaa8d('0x12')]=router; \ No newline at end of file +var _0x9851=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','util','path'];(function(_0x37dbe8,_0x10e968){var _0x2416b6=function(_0xd39957){while(--_0xd39957){_0x37dbe8['push'](_0x37dbe8['shift']());}};_0x2416b6(++_0x10e968);}(_0x9851,0x178));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x1985('0x0'));var path=require(_0x1985('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1985('0x2'));var auth=require(_0x1985('0x3'));var interaction=require(_0x1985('0x4'));var config=require(_0x1985('0x5'));var controller=require(_0x1985('0x6'));router[_0x1985('0x7')]('/',auth[_0x1985('0x8')](),controller[_0x1985('0x9')]);router[_0x1985('0x7')](_0x1985('0xa'),auth['isAuthenticated'](),controller[_0x1985('0xb')]);router['get'](_0x1985('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1985('0xd')]);router[_0x1985('0xe')]('/:id',auth[_0x1985('0x8')](),controller[_0x1985('0xf')]);router[_0x1985('0x10')](_0x1985('0xc'),auth[_0x1985('0x8')](),controller[_0x1985('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9c48617..a865cdc 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 _0x323f=['talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x323f,0x191));var _0xf323=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x323f[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf323('0x0'));module[_0xf323('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf323('0x2')]},'interface':{'type':Sequelize[_0xf323('0x2')]},'type':{'type':Sequelize[_0xf323('0x2')],'defaultValue':_0xf323('0x3'),'comment':_0xf323('0x4')},'duration':{'type':Sequelize[_0xf323('0x5')]},'enterAt':{'type':Sequelize[_0xf323('0x6')]},'exitAt':{'type':Sequelize[_0xf323('0x6')],'set':function(_0x5c0958){var _0x3a27cd=moment(_0x5c0958);var _0x4c8dce=moment(this[_0xf323('0x7')](_0xf323('0x8')));var _0x31c168=_0x3a27cd[_0xf323('0x9')](_0x4c8dce,_0xf323('0xa'));this[_0xf323('0xb')](_0xf323('0xc'),_0x5c0958);this['setDataValue'](_0xf323('0xd'),_0x31c168>=0x0?_0x31c168:null);}},'data1':{'type':Sequelize[_0xf323('0x2')],'comment':_0xf323('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xf323('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xf323('0x10')},'data4':{'type':Sequelize[_0xf323('0x2')],'comment':_0xf323('0x11')},'data5':{'type':Sequelize['STRING'],'comment':_0xf323('0x12')},'role':{'type':Sequelize[_0xf323('0x2')]},'internal':{'type':Sequelize[_0xf323('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1ac=['talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x267745,_0x5630f5){var _0x172518=function(_0x140bea){while(--_0x140bea){_0x267745['push'](_0x267745['shift']());}};_0x172518(++_0x5630f5);}(_0xc1ac,0xcd));var _0xcc1a=function(_0xe81a0c,_0x34ff25){_0xe81a0c=_0xe81a0c-0x0;var _0x1843e9=_0xc1ac[_0xe81a0c];return _0x1843e9;};'use strict';var Sequelize=require(_0xcc1a('0x0'));var moment=require(_0xcc1a('0x1'));module[_0xcc1a('0x2')]={'channel':{'type':Sequelize[_0xcc1a('0x3')]},'membername':{'type':Sequelize[_0xcc1a('0x3')]},'interface':{'type':Sequelize[_0xcc1a('0x3')]},'type':{'type':Sequelize[_0xcc1a('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xcc1a('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xcc1a('0x5')]},'exitAt':{'type':Sequelize[_0xcc1a('0x5')],'set':function(_0x32d1e6){var _0x32eb95=moment(_0x32d1e6);var _0x4e5840=moment(this[_0xcc1a('0x6')](_0xcc1a('0x7')));var _0x491ca2=_0x32eb95[_0xcc1a('0x8')](_0x4e5840,_0xcc1a('0x9'));this['setDataValue'](_0xcc1a('0xa'),_0x32d1e6);this[_0xcc1a('0xb')](_0xcc1a('0xc'),_0x491ca2>=0x0?_0x491ca2:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xcc1a('0xd')},'data2':{'type':Sequelize[_0xcc1a('0x3')],'comment':_0xcc1a('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xcc1a('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0xcc1a('0x10')},'data5':{'type':Sequelize[_0xcc1a('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xcc1a('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xcc1a('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8102f9a..d4e02c1 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x2a1dd1,_0x3794df){_0x2a1dd1=_0x2a1dd1-0x0;var _0x132c45=_0x55ca[_0x2a1dd1];return _0x132c45;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x55ca,0x126));var _0xa55c=function(_0x311c35,_0x54a2b0){_0x311c35=_0x311c35-0x0;var _0x31ff65=_0x55ca[_0x311c35];return _0x31ff65;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c230d8a..9dae9a3 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 _0x9c4b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member'];(function(_0x2eea34,_0x34f8ef){var _0x461c8f=function(_0x10f642){while(--_0x10f642){_0x2eea34['push'](_0x2eea34['shift']());}};_0x461c8f(++_0x34f8ef);}(_0x9c4b,0x14a));var _0xb9c4=function(_0x243e95,_0x1321ec){_0x243e95=_0x243e95-0x0;var _0x25ae15=_0x9c4b[_0x243e95];return _0x25ae15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb9c4('0x0'))(_0xb9c4('0x1'));var moment=require(_0xb9c4('0x2'));var BPromise=require(_0xb9c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c4('0x4'));var rimraf=require(_0xb9c4('0x5'));var config=require(_0xb9c4('0x6'));var attributes=require(_0xb9c4('0x7'));module[_0xb9c4('0x8')]=function(_0x2433e6,_0x4b96f8){return _0x2433e6['define'](_0xb9c4('0x9'),attributes,{'tableName':_0xb9c4('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xffae=['report_member','membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport'];(function(_0x4b214a,_0xa7d2fe){var _0x2726db=function(_0x588ca4){while(--_0x588ca4){_0x4b214a['push'](_0x4b214a['shift']());}};_0x2726db(++_0xa7d2fe);}(_0xffae,0x73));var _0xeffa=function(_0x4c714b,_0x4967b7){_0x4c714b=_0x4c714b-0x0;var _0x94dc32=_0xffae[_0x4c714b];return _0x94dc32;};'use strict';var _=require(_0xeffa('0x0'));var util=require(_0xeffa('0x1'));var logger=require(_0xeffa('0x2'))(_0xeffa('0x3'));var moment=require(_0xeffa('0x4'));var BPromise=require(_0xeffa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeffa('0x6'));var rimraf=require(_0xeffa('0x7'));var config=require(_0xeffa('0x8'));var attributes=require(_0xeffa('0x9'));module[_0xeffa('0xa')]=function(_0x4a050a,_0x3fd013){return _0x4a050a[_0xeffa('0xb')](_0xeffa('0xc'),attributes,{'tableName':_0xeffa('0xd'),'paranoid':![],'indexes':[{'name':_0xeffa('0xe'),'fields':[_0xeffa('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 98a74a7..cda966d 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 _0xd101=['request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','raw','options','attributes','include','map','model','CreateMemberReport','create','body','stringify','UpdateMemberReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd101,0xc1));var _0x1d10=function(_0x425dfe,_0x58ac74){_0x425dfe=_0x425dfe-0x0;var _0x46b8cf=_0xd101[_0x425dfe];return _0x46b8cf;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var rs=require(_0x1d10('0x3'));var fs=require('fs');var Redis=require(_0x1d10('0x4'));var db=require(_0x1d10('0x5'))['db'];var utils=require(_0x1d10('0x6'));var logger=require(_0x1d10('0x7'))(_0x1d10('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d10('0x9'));var client=jayson[_0x1d10('0xa')][_0x1d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d569,_0xb9e08,_0x36335e){return new BPromise(function(_0x6d6def,_0x43df2c){return client[_0x1d10('0xc')](_0x27d569,_0x36335e)[_0x1d10('0xd')](function(_0xf7926b){logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,_0x1d10('0x10'));logger[_0x1d10('0x11')](_0x1d10('0x12'),_0xb9e08,_0x1d10('0x10'),JSON['stringify'](_0xf7926b));if(_0xf7926b[_0x1d10('0x13')]){if(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x14')]===0x1f4){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b['error'][_0x1d10('0x15')]);return _0x43df2c(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b[_0x1d10('0x13')]['message']);return _0x6d6def(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}else{logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,'request\x20sent');_0x6d6def(_0xf7926b[_0x1d10('0x16')][_0x1d10('0x15')]);}})[_0x1d10('0x17')](function(_0x3f2f2b){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0x3f2f2b);_0x43df2c(_0x3f2f2b);});});}exports[_0x1d10('0x18')]=function(_0x4f3e2a){var _0x23d604=this;return new Promise(function(_0x1163dd,_0x4ca1e8){return db[_0x1d10('0x19')][_0x1d10('0x1a')]({'raw':_0x4f3e2a['options']?_0x4f3e2a['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f3e2a['options']?_0x4f3e2a['options']['where']||null:null,'attributes':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1d')]||null:null,'limit':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options']['limit']||null:null,'include':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options'][_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1e')],function(_0x127b37){return{'model':db[_0x127b37[_0x1d10('0x20')]],'as':_0x127b37['as'],'attributes':_0x127b37[_0x1d10('0x1d')],'include':_0x127b37[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x127b37[_0x1d10('0x1e')],function(_0xf1e4c8){return{'model':db[_0xf1e4c8['model']],'as':_0xf1e4c8['as'],'attributes':_0xf1e4c8[_0x1d10('0x1d')],'include':_0xf1e4c8[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0xf1e4c8[_0x1d10('0x1e')],function(_0x18e7d9){return{'model':db[_0x18e7d9[_0x1d10('0x20')]],'as':_0x18e7d9['as'],'attributes':_0x18e7d9[_0x1d10('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d10('0xd')](function(_0x4f7837){logger[_0x1d10('0xe')](_0x1d10('0x18'),_0x4f3e2a);logger['debug'](_0x1d10('0x18'),_0x4f3e2a,JSON['stringify'](_0x4f7837));_0x1163dd(_0x4f7837);})['catch'](function(_0x41b5b8){logger['error'](_0x1d10('0x18'),_0x41b5b8[_0x1d10('0x15')],_0x4f3e2a);_0x4ca1e8(_0x23d604[_0x1d10('0x13')](0x1f4,_0x41b5b8[_0x1d10('0x15')]));});});};exports[_0x1d10('0x21')]=function(_0x9c6cb9){var _0x4b5400=this;return new Promise(function(_0x4e30b2,_0x1ada44){return db[_0x1d10('0x19')][_0x1d10('0x22')](_0x9c6cb9[_0x1d10('0x23')],{'raw':_0x9c6cb9[_0x1d10('0x1c')]?_0x9c6cb9[_0x1d10('0x1c')][_0x1d10('0x1b')]===undefined?!![]:![]:!![]})[_0x1d10('0xd')](function(_0x8f4818){logger[_0x1d10('0xe')]('CreateMemberReport',_0x9c6cb9);logger[_0x1d10('0x11')]('CreateMemberReport',_0x9c6cb9,JSON[_0x1d10('0x24')](_0x8f4818));_0x4e30b2(_0x8f4818);})[_0x1d10('0x17')](function(_0x5d446b){logger[_0x1d10('0x13')]('CreateMemberReport',_0x5d446b[_0x1d10('0x15')],_0x9c6cb9);_0x1ada44(_0x4b5400[_0x1d10('0x13')](0x1f4,_0x5d446b[_0x1d10('0x15')]));});});};exports[_0x1d10('0x25')]=function(_0xd50250){var _0x5eb413=this;return new Promise(function(_0x4c3ef6,_0x35025e){return db[_0x1d10('0x19')][_0x1d10('0x26')](_0xd50250['body'],{'raw':_0xd50250['options']?_0xd50250['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x27')]||null:null,'attributes':_0xd50250[_0x1d10('0x1c')]?_0xd50250[_0x1d10('0x1c')]['attributes']||null:null,'limit':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x28')]||null:null})[_0x1d10('0xd')](function(_0x230c19){logger['info'](_0x1d10('0x25'),_0xd50250);logger['debug'](_0x1d10('0x25'),_0xd50250,JSON[_0x1d10('0x24')](_0x230c19));_0x4c3ef6(_0x230c19);})[_0x1d10('0x17')](function(_0x8d8405){logger[_0x1d10('0x13')](_0x1d10('0x25'),_0x8d8405[_0x1d10('0x15')],_0xd50250);_0x35025e(_0x5eb413[_0x1d10('0x13')](0x1f4,_0x8d8405[_0x1d10('0x15')]));});});}; \ No newline at end of file +var _0xdb70=['rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMemberReport','MemberReport','findAll','options','raw','where','include','map','model','attributes','debug','catch','CreateMemberReport','create','body','UpdateMemberReport','update','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26f77d,_0x35de2c){var _0x208fa9=function(_0x18eb90){while(--_0x18eb90){_0x26f77d['push'](_0x26f77d['shift']());}};_0x208fa9(++_0x35de2c);}(_0xdb70,0xa0));var _0x0db7=function(_0x8245ea,_0x51eeea){_0x8245ea=_0x8245ea-0x0;var _0x4de9a1=_0xdb70[_0x8245ea];return _0x4de9a1;};'use strict';var _=require(_0x0db7('0x0'));var util=require(_0x0db7('0x1'));var moment=require(_0x0db7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0db7('0x3'));var fs=require('fs');var Redis=require(_0x0db7('0x4'));var db=require(_0x0db7('0x5'))['db'];var utils=require(_0x0db7('0x6'));var logger=require(_0x0db7('0x7'))(_0x0db7('0x8'));var config=require(_0x0db7('0x9'));var jayson=require(_0x0db7('0xa'));var client=jayson[_0x0db7('0xb')][_0x0db7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x191a8e,_0x4c404e,_0x399095){return new BPromise(function(_0x1db9fe,_0x196b91){return client[_0x0db7('0xd')](_0x191a8e,_0x399095)[_0x0db7('0xe')](function(_0x3d43d6){logger['info'](_0x0db7('0xf'),_0x4c404e,_0x0db7('0x10'));logger['debug'](_0x0db7('0x11'),_0x4c404e,_0x0db7('0x10'),JSON[_0x0db7('0x12')](_0x3d43d6));if(_0x3d43d6[_0x0db7('0x13')]){if(_0x3d43d6['error'][_0x0db7('0x14')]===0x1f4){logger['error'](_0x0db7('0xf'),_0x4c404e,_0x3d43d6[_0x0db7('0x13')][_0x0db7('0x15')]);return _0x196b91(_0x3d43d6[_0x0db7('0x13')][_0x0db7('0x15')]);}logger['error'](_0x0db7('0xf'),_0x4c404e,_0x3d43d6[_0x0db7('0x13')][_0x0db7('0x15')]);return _0x1db9fe(_0x3d43d6[_0x0db7('0x13')][_0x0db7('0x15')]);}else{logger[_0x0db7('0x16')](_0x0db7('0xf'),_0x4c404e,_0x0db7('0x10'));_0x1db9fe(_0x3d43d6[_0x0db7('0x17')][_0x0db7('0x15')]);}})['catch'](function(_0x21cd17){logger[_0x0db7('0x13')](_0x0db7('0xf'),_0x4c404e,_0x21cd17);_0x196b91(_0x21cd17);});});}exports[_0x0db7('0x18')]=function(_0x31082b){var _0x359b37=this;return new Promise(function(_0x52e95e,_0x51fc0f){return db[_0x0db7('0x19')][_0x0db7('0x1a')]({'raw':_0x31082b[_0x0db7('0x1b')]?_0x31082b['options'][_0x0db7('0x1c')]===undefined?!![]:![]:!![],'where':_0x31082b[_0x0db7('0x1b')]?_0x31082b[_0x0db7('0x1b')][_0x0db7('0x1d')]||null:null,'attributes':_0x31082b['options']?_0x31082b[_0x0db7('0x1b')]['attributes']||null:null,'limit':_0x31082b[_0x0db7('0x1b')]?_0x31082b['options']['limit']||null:null,'include':_0x31082b[_0x0db7('0x1b')]?_0x31082b[_0x0db7('0x1b')][_0x0db7('0x1e')]?_[_0x0db7('0x1f')](_0x31082b[_0x0db7('0x1b')][_0x0db7('0x1e')],function(_0xc05009){return{'model':db[_0xc05009[_0x0db7('0x20')]],'as':_0xc05009['as'],'attributes':_0xc05009[_0x0db7('0x21')],'include':_0xc05009[_0x0db7('0x1e')]?_[_0x0db7('0x1f')](_0xc05009[_0x0db7('0x1e')],function(_0x299c22){return{'model':db[_0x299c22[_0x0db7('0x20')]],'as':_0x299c22['as'],'attributes':_0x299c22['attributes'],'include':_0x299c22['include']?_['map'](_0x299c22['include'],function(_0x5d2e46){return{'model':db[_0x5d2e46[_0x0db7('0x20')]],'as':_0x5d2e46['as'],'attributes':_0x5d2e46[_0x0db7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0db7('0xe')](function(_0x55637e){logger['info'](_0x0db7('0x18'),_0x31082b);logger[_0x0db7('0x22')](_0x0db7('0x18'),_0x31082b,JSON[_0x0db7('0x12')](_0x55637e));_0x52e95e(_0x55637e);})[_0x0db7('0x23')](function(_0xfc7311){logger['error'](_0x0db7('0x18'),_0xfc7311['message'],_0x31082b);_0x51fc0f(_0x359b37[_0x0db7('0x13')](0x1f4,_0xfc7311[_0x0db7('0x15')]));});});};exports[_0x0db7('0x24')]=function(_0x1b5b1d){var _0x530c3e=this;return new Promise(function(_0x5e0ded,_0x5625ce){return db[_0x0db7('0x19')][_0x0db7('0x25')](_0x1b5b1d[_0x0db7('0x26')],{'raw':_0x1b5b1d['options']?_0x1b5b1d[_0x0db7('0x1b')][_0x0db7('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4db0a0){logger[_0x0db7('0x16')](_0x0db7('0x24'),_0x1b5b1d);logger[_0x0db7('0x22')]('CreateMemberReport',_0x1b5b1d,JSON['stringify'](_0x4db0a0));_0x5e0ded(_0x4db0a0);})[_0x0db7('0x23')](function(_0x127cfc){logger[_0x0db7('0x13')]('CreateMemberReport',_0x127cfc[_0x0db7('0x15')],_0x1b5b1d);_0x5625ce(_0x530c3e[_0x0db7('0x13')](0x1f4,_0x127cfc[_0x0db7('0x15')]));});});};exports[_0x0db7('0x27')]=function(_0x5a21d2){var _0x20a5ff=this;return new Promise(function(_0x50a405,_0x225bd4){return db['MemberReport'][_0x0db7('0x28')](_0x5a21d2[_0x0db7('0x26')],{'raw':_0x5a21d2[_0x0db7('0x1b')]?_0x5a21d2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a21d2[_0x0db7('0x1b')]?_0x5a21d2[_0x0db7('0x1b')][_0x0db7('0x1d')]||null:null,'attributes':_0x5a21d2[_0x0db7('0x1b')]?_0x5a21d2[_0x0db7('0x1b')][_0x0db7('0x21')]||null:null,'limit':_0x5a21d2['options']?_0x5a21d2[_0x0db7('0x1b')][_0x0db7('0x29')]||null:null})['then'](function(_0x1169e2){logger['info'](_0x0db7('0x27'),_0x5a21d2);logger['debug'](_0x0db7('0x27'),_0x5a21d2,JSON[_0x0db7('0x12')](_0x1169e2));_0x50a405(_0x1169e2);})['catch'](function(_0x43c721){logger[_0x0db7('0x13')]('UpdateMemberReport',_0x43c721[_0x0db7('0x15')],_0x5a21d2);_0x225bd4(_0x20a5ff['error'](0x1f4,_0x43c721[_0x0db7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 66ff496..decad96 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 _0xf130=['../../components/auth/service','../../config/environment','./migration.controller','get','index','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3571da,_0x1c4562){var _0x4b1988=function(_0x5a2ec3){while(--_0x5a2ec3){_0x3571da['push'](_0x3571da['shift']());}};_0x4b1988(++_0x1c4562);}(_0xf130,0x149));var _0x0f13=function(_0x3127fb,_0x1d4232){_0x3127fb=_0x3127fb-0x0;var _0x40a2df=_0xf130[_0x3127fb];return _0x40a2df;};'use strict';var multer=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var path=require(_0x0f13('0x2'));var timeout=require(_0x0f13('0x3'));var express=require(_0x0f13('0x4'));var router=express[_0x0f13('0x5')]();var fs_extra=require(_0x0f13('0x6'));var auth=require(_0x0f13('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0f13('0x8'));var controller=require(_0x0f13('0x9'));router[_0x0f13('0xa')]('/',controller[_0x0f13('0xb')]);module['exports']=router; \ No newline at end of file +var _0xd2e3=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer'];(function(_0x3f5672,_0xacd24f){var _0x5c4b36=function(_0x120d7e){while(--_0x120d7e){_0x3f5672['push'](_0x3f5672['shift']());}};_0x5c4b36(++_0xacd24f);}(_0xd2e3,0x1e3));var _0x3d2e=function(_0x4e1a34,_0x40d7d3){_0x4e1a34=_0x4e1a34-0x0;var _0x1345a7=_0xd2e3[_0x4e1a34];return _0x1345a7;};'use strict';var multer=require(_0x3d2e('0x0'));var util=require('util');var path=require(_0x3d2e('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d2e('0x2'));var router=express[_0x3d2e('0x3')]();var fs_extra=require(_0x3d2e('0x4'));var auth=require(_0x3d2e('0x5'));var interaction=require(_0x3d2e('0x6'));var config=require(_0x3d2e('0x7'));var controller=require(_0x3d2e('0x8'));router[_0x3d2e('0x9')]('/',controller[_0x3d2e('0xa')]);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 05d59ed..902b93f 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 _0xa12d=['sequelize','STRING','version'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xa12d,0x19e));var _0xda12=function(_0x3fc61f,_0xe629eb){_0x3fc61f=_0x3fc61f-0x0;var _0x449df9=_0xa12d[_0x3fc61f];return _0x449df9;};'use strict';var Sequelize=require(_0xda12('0x0'));module['exports']={'version':{'type':Sequelize[_0xda12('0x1')],'unique':_0xda12('0x2')}}; \ No newline at end of file +var _0xbbbb=['STRING','sequelize','exports'];(function(_0x33408c,_0x4fe051){var _0x73c3=function(_0x2f3dd0){while(--_0x2f3dd0){_0x33408c['push'](_0x33408c['shift']());}};_0x73c3(++_0x4fe051);}(_0xbbbb,0x145));var _0xbbbb=function(_0x2ce529,_0x416354){_0x2ce529=_0x2ce529-0x0;var _0x2c92b7=_0xbbbb[_0x2ce529];return _0x2c92b7;};'use strict';var Sequelize=require(_0xbbbb('0x0'));module[_0xbbbb('0x1')]={'version':{'type':Sequelize[_0xbbbb('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 790c7c5..7febbf6 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 _0xb892=['include','findAll','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb892,0x189));var _0x2b89=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xb892[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x2b89('0x0'));var rimraf=require(_0x2b89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b89('0x2'));var rp=require('request-promise');var moment=require(_0x2b89('0x3'));var BPromise=require(_0x2b89('0x4'));var Mustache=require('mustache');var util=require(_0x2b89('0x5'));var path=require(_0x2b89('0x6'));var sox=require(_0x2b89('0x7'));var csv=require(_0x2b89('0x8'));var ejs=require(_0x2b89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b89('0xa'));var squel=require(_0x2b89('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2b89('0x8'));var querystring=require(_0x2b89('0xc'));var Papa=require(_0x2b89('0xd'));var Redis=require(_0x2b89('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2b89('0xf'));var as=require(_0x2b89('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b89('0x11'))(_0x2b89('0x12'));var utils=require(_0x2b89('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b89('0x14'))['db'];function respondWithStatusCode(_0x5256d5,_0x3103c7){_0x3103c7=_0x3103c7||0xcc;return function(_0x3f1ce){if(_0x3f1ce){return _0x5256d5[_0x2b89('0x15')](_0x3103c7);}return _0x5256d5[_0x2b89('0x16')](_0x3103c7)[_0x2b89('0x17')]();};}function respondWithResult(_0x32f472,_0x251f6f){_0x251f6f=_0x251f6f||0xc8;return function(_0x5c63da){if(_0x5c63da){return _0x32f472[_0x2b89('0x16')](_0x251f6f)[_0x2b89('0x18')](_0x5c63da);}};}function respondWithFilteredResult(_0xa2880,_0x54dd7c){return function(_0x2b7da0){if(_0x2b7da0){var _0x406efa=typeof _0x54dd7c[_0x2b89('0x19')]===_0x2b89('0x1a')&&typeof _0x54dd7c[_0x2b89('0x1b')]===_0x2b89('0x1a');var _0x1e3834=_0x2b7da0[_0x2b89('0x1c')];var _0x12f99b=_0x406efa?0x0:_0x54dd7c[_0x2b89('0x19')];var _0x5eac65=_0x406efa?_0x2b7da0[_0x2b89('0x1c')]:_0x54dd7c[_0x2b89('0x19')]+_0x54dd7c[_0x2b89('0x1b')];var _0x40182d;if(_0x5eac65>=_0x1e3834){_0x5eac65=_0x1e3834;_0x40182d=0xc8;}else{_0x40182d=0xce;}_0xa2880[_0x2b89('0x16')](_0x40182d);return _0xa2880[_0x2b89('0x1d')](_0x2b89('0x1e'),_0x12f99b+'-'+_0x5eac65+'/'+_0x1e3834)[_0x2b89('0x18')](_0x2b7da0);}return null;};}function patchUpdates(_0x2a3295){return function(_0x1f8374){try{jsonpatch['apply'](_0x1f8374,_0x2a3295,!![]);}catch(_0x2fd2ae){return BPromise['reject'](_0x2fd2ae);}return _0x1f8374['save']();};}function saveUpdates(_0x1e773d,_0x565f6a){return function(_0x40fdfb){if(_0x40fdfb){return _0x40fdfb['update'](_0x1e773d)[_0x2b89('0x1f')](function(_0x50fc65){return _0x50fc65;});}return null;};}function removeEntity(_0x54d907,_0x57aeac){return function(_0xf840ba){if(_0xf840ba){return _0xf840ba[_0x2b89('0x20')]()['then'](function(){_0x54d907[_0x2b89('0x16')](0xcc)[_0x2b89('0x17')]();});}};}function handleEntityNotFound(_0x2f40dc,_0x59d649){return function(_0x2aa2fd){if(!_0x2aa2fd){_0x2f40dc[_0x2b89('0x15')](0x194);}return _0x2aa2fd;};}function handleError(_0x4f256b,_0x1a0aa4){_0x1a0aa4=_0x1a0aa4||0x1f4;return function(_0x757e76){logger[_0x2b89('0x21')](_0x757e76[_0x2b89('0x22')]);if(_0x757e76['name']){delete _0x757e76[_0x2b89('0x23')];}_0x4f256b[_0x2b89('0x16')](_0x1a0aa4)[_0x2b89('0x24')](_0x757e76);};}exports[_0x2b89('0x25')]=function(_0x1aae8b,_0xd51855){var _0x379a3d={},_0x532b26={},_0x4f28b1={'count':0x0,'rows':[]};var _0x452954=_[_0x2b89('0x26')](db[_0x2b89('0x27')][_0x2b89('0x28')],function(_0x2efad8){return{'name':_0x2efad8[_0x2b89('0x29')],'type':_0x2efad8[_0x2b89('0x2a')][_0x2b89('0x2b')]};});_0x532b26[_0x2b89('0x2c')]=_['map'](_0x452954,_0x2b89('0x23'));_0x532b26[_0x2b89('0x2d')]=_[_0x2b89('0x2e')](_0x1aae8b[_0x2b89('0x2d')]);_0x532b26[_0x2b89('0x2f')]=_[_0x2b89('0x30')](_0x532b26[_0x2b89('0x2c')],_0x532b26[_0x2b89('0x2d')]);_0x379a3d[_0x2b89('0x31')]=_[_0x2b89('0x30')](_0x532b26[_0x2b89('0x2c')],qs['fields'](_0x1aae8b['query'][_0x2b89('0x32')]));_0x379a3d[_0x2b89('0x31')]=_0x379a3d[_0x2b89('0x31')][_0x2b89('0x33')]?_0x379a3d['attributes']:_0x532b26['model'];if(!_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x34')](_0x2b89('0x35'))){_0x379a3d[_0x2b89('0x1b')]=qs[_0x2b89('0x1b')](_0x1aae8b['query'][_0x2b89('0x1b')]);_0x379a3d[_0x2b89('0x19')]=qs['offset'](_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x19')]);}_0x379a3d[_0x2b89('0x36')]=qs[_0x2b89('0x37')](_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x37')]);_0x379a3d[_0x2b89('0x38')]=qs[_0x2b89('0x2f')](_[_0x2b89('0x39')](_0x1aae8b[_0x2b89('0x2d')],_0x532b26[_0x2b89('0x2f')]),_0x452954);if(_0x1aae8b['query']['filter']){_0x379a3d['where']=_[_0x2b89('0x3a')](_0x379a3d[_0x2b89('0x38')],{'$or':_[_0x2b89('0x26')](_0x452954,function(_0x132b6b){if(_0x132b6b[_0x2b89('0x2a')]!=='VIRTUAL'){var _0x5299d0={};_0x5299d0[_0x132b6b[_0x2b89('0x23')]]={'$like':'%'+_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x3b')]+'%'};return _0x5299d0;}})});}_0x379a3d=_[_0x2b89('0x3a')]({},_0x379a3d,_0x1aae8b[_0x2b89('0x3c')]);var _0xb5713b={'where':_0x379a3d['where']};return db[_0x2b89('0x27')]['count'](_0xb5713b)[_0x2b89('0x1f')](function(_0x47ce52){_0x4f28b1[_0x2b89('0x1c')]=_0x47ce52;if(_0x1aae8b[_0x2b89('0x2d')][_0x2b89('0x3d')]){_0x379a3d[_0x2b89('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x2b89('0x3f')](_0x379a3d);})[_0x2b89('0x1f')](function(_0x3757fb){_0x4f28b1[_0x2b89('0x40')]=_0x3757fb;return _0x4f28b1;})[_0x2b89('0x1f')](respondWithFilteredResult(_0xd51855,_0x379a3d))['catch'](handleError(_0xd51855,null));}; \ No newline at end of file +var _0x6e71=['update','then','end','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x6e7446,_0x120a01){var _0x167b36=function(_0x909f1a){while(--_0x909f1a){_0x6e7446['push'](_0x6e7446['shift']());}};_0x167b36(++_0x120a01);}(_0x6e71,0x1ac));var _0x16e7=function(_0x3a524e,_0x4bf183){_0x3a524e=_0x3a524e-0x0;var _0x44b8c0=_0x6e71[_0x3a524e];return _0x44b8c0;};'use strict';var emlformat=require(_0x16e7('0x0'));var rimraf=require(_0x16e7('0x1'));var zipdir=require(_0x16e7('0x2'));var jsonpatch=require(_0x16e7('0x3'));var rp=require(_0x16e7('0x4'));var moment=require(_0x16e7('0x5'));var BPromise=require(_0x16e7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x16e7('0x7'));var sox=require(_0x16e7('0x8'));var csv=require(_0x16e7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16e7('0xa'));var _=require('lodash');var squel=require(_0x16e7('0xb'));var crypto=require(_0x16e7('0xc'));var jsforce=require(_0x16e7('0xd'));var deskjs=require(_0x16e7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x16e7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x16e7('0x10'));var as=require(_0x16e7('0x11'));var hardwareService=require(_0x16e7('0x12'));var logger=require('../../config/logger')(_0x16e7('0x13'));var utils=require(_0x16e7('0x14'));var config=require(_0x16e7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x16e7('0x16'))['db'];function respondWithStatusCode(_0x25cb95,_0x184c53){_0x184c53=_0x184c53||0xcc;return function(_0xad3752){if(_0xad3752){return _0x25cb95[_0x16e7('0x17')](_0x184c53);}return _0x25cb95[_0x16e7('0x18')](_0x184c53)['end']();};}function respondWithResult(_0x4fe6b0,_0x5082f0){_0x5082f0=_0x5082f0||0xc8;return function(_0x4ed951){if(_0x4ed951){return _0x4fe6b0[_0x16e7('0x18')](_0x5082f0)[_0x16e7('0x19')](_0x4ed951);}};}function respondWithFilteredResult(_0x1fb421,_0x2874cd){return function(_0x1bbfd2){if(_0x1bbfd2){var _0x469255=typeof _0x2874cd[_0x16e7('0x1a')]===_0x16e7('0x1b')&&typeof _0x2874cd[_0x16e7('0x1c')]==='undefined';var _0x13efd0=_0x1bbfd2[_0x16e7('0x1d')];var _0x6ee666=_0x469255?0x0:_0x2874cd[_0x16e7('0x1a')];var _0x4aacd0=_0x469255?_0x1bbfd2['count']:_0x2874cd[_0x16e7('0x1a')]+_0x2874cd[_0x16e7('0x1c')];var _0x178116;if(_0x4aacd0>=_0x13efd0){_0x4aacd0=_0x13efd0;_0x178116=0xc8;}else{_0x178116=0xce;}_0x1fb421[_0x16e7('0x18')](_0x178116);return _0x1fb421['set'](_0x16e7('0x1e'),_0x6ee666+'-'+_0x4aacd0+'/'+_0x13efd0)[_0x16e7('0x19')](_0x1bbfd2);}return null;};}function patchUpdates(_0x4a149c){return function(_0x246429){try{jsonpatch[_0x16e7('0x1f')](_0x246429,_0x4a149c,!![]);}catch(_0x57de01){return BPromise[_0x16e7('0x20')](_0x57de01);}return _0x246429[_0x16e7('0x21')]();};}function saveUpdates(_0x24cefd,_0x4704f6){return function(_0x3690f7){if(_0x3690f7){return _0x3690f7[_0x16e7('0x22')](_0x24cefd)['then'](function(_0x27abc9){return _0x27abc9;});}return null;};}function removeEntity(_0x471cfa,_0x28b9ff){return function(_0x4839b1){if(_0x4839b1){return _0x4839b1['destroy']()[_0x16e7('0x23')](function(){_0x471cfa[_0x16e7('0x18')](0xcc)[_0x16e7('0x24')]();});}};}function handleEntityNotFound(_0x18e480,_0x2117b1){return function(_0x2136b7){if(!_0x2136b7){_0x18e480['sendStatus'](0x194);}return _0x2136b7;};}function handleError(_0x595461,_0x57a96a){_0x57a96a=_0x57a96a||0x1f4;return function(_0xf005f0){logger['error'](_0xf005f0[_0x16e7('0x25')]);if(_0xf005f0[_0x16e7('0x26')]){delete _0xf005f0[_0x16e7('0x26')];}_0x595461[_0x16e7('0x18')](_0x57a96a)['send'](_0xf005f0);};}exports[_0x16e7('0x27')]=function(_0x10ef4a,_0x40a6c2){var _0x4eb7d8={},_0x165502={},_0x57da39={'count':0x0,'rows':[]};var _0x2705fc=_[_0x16e7('0x28')](db[_0x16e7('0x29')][_0x16e7('0x2a')],function(_0x59e0d3){return{'name':_0x59e0d3[_0x16e7('0x2b')],'type':_0x59e0d3[_0x16e7('0x2c')][_0x16e7('0x2d')]};});_0x165502[_0x16e7('0x2e')]=_[_0x16e7('0x28')](_0x2705fc,_0x16e7('0x26'));_0x165502[_0x16e7('0x2f')]=_[_0x16e7('0x30')](_0x10ef4a['query']);_0x165502['filters']=_[_0x16e7('0x31')](_0x165502['model'],_0x165502[_0x16e7('0x2f')]);_0x4eb7d8[_0x16e7('0x32')]=_[_0x16e7('0x31')](_0x165502['model'],qs[_0x16e7('0x33')](_0x10ef4a[_0x16e7('0x2f')][_0x16e7('0x33')]));_0x4eb7d8[_0x16e7('0x32')]=_0x4eb7d8['attributes'][_0x16e7('0x34')]?_0x4eb7d8[_0x16e7('0x32')]:_0x165502[_0x16e7('0x2e')];if(!_0x10ef4a[_0x16e7('0x2f')]['hasOwnProperty']('nolimit')){_0x4eb7d8['limit']=qs['limit'](_0x10ef4a[_0x16e7('0x2f')]['limit']);_0x4eb7d8[_0x16e7('0x1a')]=qs[_0x16e7('0x1a')](_0x10ef4a[_0x16e7('0x2f')][_0x16e7('0x1a')]);}_0x4eb7d8['order']=qs[_0x16e7('0x35')](_0x10ef4a[_0x16e7('0x2f')][_0x16e7('0x35')]);_0x4eb7d8['where']=qs[_0x16e7('0x36')](_[_0x16e7('0x37')](_0x10ef4a[_0x16e7('0x2f')],_0x165502['filters']),_0x2705fc);if(_0x10ef4a[_0x16e7('0x2f')][_0x16e7('0x38')]){_0x4eb7d8[_0x16e7('0x39')]=_[_0x16e7('0x3a')](_0x4eb7d8[_0x16e7('0x39')],{'$or':_[_0x16e7('0x28')](_0x2705fc,function(_0x2e21a2){if(_0x2e21a2[_0x16e7('0x2c')]!==_0x16e7('0x3b')){var _0x3e6db2={};_0x3e6db2[_0x2e21a2['name']]={'$like':'%'+_0x10ef4a[_0x16e7('0x2f')]['filter']+'%'};return _0x3e6db2;}})});}_0x4eb7d8=_[_0x16e7('0x3a')]({},_0x4eb7d8,_0x10ef4a[_0x16e7('0x3c')]);var _0x446d2c={'where':_0x4eb7d8[_0x16e7('0x39')]};return db[_0x16e7('0x29')][_0x16e7('0x1d')](_0x446d2c)[_0x16e7('0x23')](function(_0x1c2158){_0x57da39[_0x16e7('0x1d')]=_0x1c2158;if(_0x10ef4a[_0x16e7('0x2f')][_0x16e7('0x3d')]){_0x4eb7d8[_0x16e7('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x16e7('0x3f')](_0x4eb7d8);})[_0x16e7('0x23')](function(_0x5c88ef){_0x57da39[_0x16e7('0x40')]=_0x5c88ef;return _0x57da39;})['then'](respondWithFilteredResult(_0x40a6c2,_0x4eb7d8))[_0x16e7('0x41')](handleError(_0x40a6c2,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0566cfa..610513d 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 _0x681d=['migrations','util','../../config/logger','api','moment','rimraf','exports','define','Migration'];(function(_0x237bfe,_0x842795){var _0x3a6167=function(_0x360e15){while(--_0x360e15){_0x237bfe['push'](_0x237bfe['shift']());}};_0x3a6167(++_0x842795);}(_0x681d,0xeb));var _0xd681=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x681d[_0x311909];return _0x8d3163;};'use strict';var _=require('lodash');var util=require(_0xd681('0x0'));var logger=require(_0xd681('0x1'))(_0xd681('0x2'));var moment=require(_0xd681('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd681('0x4'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xd681('0x5')]=function(_0x4c96b4,_0x55d00f){return _0x4c96b4[_0xd681('0x6')](_0xd681('0x7'),attributes,{'tableName':_0xd681('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddc4=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment'];(function(_0x4e0ca5,_0x208bb8){var _0x4e9d4d=function(_0x284461){while(--_0x284461){_0x4e0ca5['push'](_0x4e0ca5['shift']());}};_0x4e9d4d(++_0x208bb8);}(_0xddc4,0xdc));var _0x4ddc=function(_0x1bc470,_0x576a04){_0x1bc470=_0x1bc470-0x0;var _0x18730b=_0xddc4[_0x1bc470];return _0x18730b;};'use strict';var _=require('lodash');var util=require(_0x4ddc('0x0'));var logger=require(_0x4ddc('0x1'))(_0x4ddc('0x2'));var moment=require(_0x4ddc('0x3'));var BPromise=require(_0x4ddc('0x4'));var rp=require(_0x4ddc('0x5'));var fs=require('fs');var path=require(_0x4ddc('0x6'));var rimraf=require(_0x4ddc('0x7'));var config=require(_0x4ddc('0x8'));var attributes=require(_0x4ddc('0x9'));module[_0x4ddc('0xa')]=function(_0xb16a9b,_0xbcb93e){return _0xb16a9b[_0x4ddc('0xb')](_0x4ddc('0xc'),attributes,{'tableName':_0x4ddc('0xd'),'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 acd4344..8870ed7 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 _0x3a79=['rpc','../../config/environment','client','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd13a49,_0x42ae60){var _0x11b592=function(_0x4e712e){while(--_0x4e712e){_0xd13a49['push'](_0xd13a49['shift']());}};_0x11b592(++_0x42ae60);}(_0x3a79,0xca));var _0x93a7=function(_0x1d8e0a,_0x1bbfcf){_0x1d8e0a=_0x1d8e0a-0x0;var _0x4d2545=_0x3a79[_0x1d8e0a];return _0x4d2545;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var moment=require(_0x93a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93a7('0x2'));var fs=require('fs');var Redis=require(_0x93a7('0x3'));var db=require(_0x93a7('0x4'))['db'];var utils=require(_0x93a7('0x5'));var logger=require(_0x93a7('0x6'))(_0x93a7('0x7'));var config=require(_0x93a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2579e5,_0x4690bb,_0x1b59d1){return new BPromise(function(_0x2417da,_0x3a512b){return client[_0x93a7('0xa')](_0x2579e5,_0x1b59d1)['then'](function(_0x2996db){logger['info']('Migration,\x20%s,\x20%s',_0x4690bb,_0x93a7('0xb'));logger[_0x93a7('0xc')](_0x93a7('0xd'),_0x4690bb,'request\x20sent',JSON['stringify'](_0x2996db));if(_0x2996db[_0x93a7('0xe')]){if(_0x2996db[_0x93a7('0xe')][_0x93a7('0xf')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4690bb,_0x2996db[_0x93a7('0xe')]['message']);return _0x3a512b(_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);}logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);return _0x2417da(_0x2996db[_0x93a7('0xe')]['message']);}else{logger[_0x93a7('0x12')](_0x93a7('0x11'),_0x4690bb,'request\x20sent');_0x2417da(_0x2996db['result'][_0x93a7('0x10')]);}})['catch'](function(_0xfac49d){logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0xfac49d);_0x3a512b(_0xfac49d);});});} \ No newline at end of file +var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Migration,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x6fbccf,_0x13be0e){var _0x4d7cd1=function(_0x57a66c){while(--_0x57a66c){_0x6fbccf['push'](_0x6fbccf['shift']());}};_0x4d7cd1(++_0x13be0e);}(_0xb469,0x13b));var _0x9b46=function(_0x179913,_0x590ea2){_0x179913=_0x179913-0x0;var _0x263647=_0xb469[_0x179913];return _0x263647;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7609399..53151c6 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 _0xf319=['../../config/environment','./network.controller','isAuthenticated','get','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x594565,_0xeda9a1){var _0x5f24de=function(_0x2d82b7){while(--_0x2d82b7){_0x594565['push'](_0x594565['shift']());}};_0x5f24de(++_0xeda9a1);}(_0xf319,0xe8));var _0x9f31=function(_0x800545,_0x33573a){_0x800545=_0x800545-0x0;var _0x1afb06=_0xf319[_0x800545];return _0x1afb06;};'use strict';var multer=require(_0x9f31('0x0'));var util=require(_0x9f31('0x1'));var path=require(_0x9f31('0x2'));var timeout=require(_0x9f31('0x3'));var express=require(_0x9f31('0x4'));var router=express[_0x9f31('0x5')]();var fs_extra=require(_0x9f31('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9f31('0x7'));var config=require(_0x9f31('0x8'));var controller=require(_0x9f31('0x9'));router['get']('/',auth[_0x9f31('0xa')](),controller['index']);router[_0x9f31('0xb')]('/:id',auth[_0x9f31('0xa')](),controller[_0x9f31('0xc')]);router[_0x9f31('0xd')]('/',auth[_0x9f31('0xa')](),controller[_0x9f31('0xe')]);router['put'](_0x9f31('0xf'),auth[_0x9f31('0xa')](),controller[_0x9f31('0x10')]);router[_0x9f31('0x11')](_0x9f31('0xf'),auth[_0x9f31('0xa')](),controller[_0x9f31('0x12')]);module[_0x9f31('0x13')]=router; \ No newline at end of file +var _0x9a5e=['./network.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x9a5e,0xee));var _0xe9a5=function(_0x58fcad,_0x27b788){_0x58fcad=_0x58fcad-0x0;var _0x34d36d=_0x9a5e[_0x58fcad];return _0x34d36d;};'use strict';var multer=require(_0xe9a5('0x0'));var util=require(_0xe9a5('0x1'));var path=require(_0xe9a5('0x2'));var timeout=require(_0xe9a5('0x3'));var express=require(_0xe9a5('0x4'));var router=express[_0xe9a5('0x5')]();var fs_extra=require(_0xe9a5('0x6'));var auth=require(_0xe9a5('0x7'));var interaction=require(_0xe9a5('0x8'));var config=require('../../config/environment');var controller=require(_0xe9a5('0x9'));router[_0xe9a5('0xa')]('/',auth[_0xe9a5('0xb')](),controller['index']);router['get'](_0xe9a5('0xc'),auth['isAuthenticated'](),controller[_0xe9a5('0xd')]);router['post']('/',auth[_0xe9a5('0xb')](),controller[_0xe9a5('0xe')]);router[_0xe9a5('0xf')](_0xe9a5('0xc'),auth['isAuthenticated'](),controller[_0xe9a5('0x10')]);router[_0xe9a5('0x11')](_0xe9a5('0xc'),auth['isAuthenticated'](),controller[_0xe9a5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a6c3b2c..e65e3ad 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 _0xd7c4=['STRING','sequelize','ENUM','localnet','externip','turn'];(function(_0x33a495,_0x2e32a2){var _0x4c2b29=function(_0x5e81d3){while(--_0x5e81d3){_0x33a495['push'](_0x33a495['shift']());}};_0x4c2b29(++_0x2e32a2);}(_0xd7c4,0xeb));var _0x4d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4d7c('0x0'));module['exports']={'type':{'type':Sequelize[_0x4d7c('0x1')](_0x4d7c('0x2'),_0x4d7c('0x3'),'stun',_0x4d7c('0x4'))},'value':{'type':Sequelize[_0x4d7c('0x5')]},'username':{'type':Sequelize[_0x4d7c('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf2a2=['stun','turn','STRING','sequelize','ENUM','localnet','externip'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0xf2a2,0x15a));var _0x2f2a=function(_0x2bfe36,_0x5773b3){_0x2bfe36=_0x2bfe36-0x0;var _0x17dd89=_0xf2a2[_0x2bfe36];return _0x17dd89;};'use strict';var Sequelize=require(_0x2f2a('0x0'));module['exports']={'type':{'type':Sequelize[_0x2f2a('0x1')](_0x2f2a('0x2'),_0x2f2a('0x3'),_0x2f2a('0x4'),_0x2f2a('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2f2a('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fa1a4a0..8e2a534 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 _0x5c0d=['join','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','STUN','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','undefined','count','limit','status','set','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','findAll','params','include','options','create','body','toUpperCase','readFileSync','root','render','/etc/asterisk/stun_xcally.conf','Reload','TURN'];(function(_0x4527df,_0x15d888){var _0x24bc42=function(_0x2554bb){while(--_0x2554bb){_0x4527df['push'](_0x4527df['shift']());}};_0x24bc42(++_0x15d888);}(_0x5c0d,0x168));var _0xd5c0=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x5c0d[_0x26d6d9];return _0x1b4875;};'use strict';var util=require(_0xd5c0('0x0'));var path=require(_0xd5c0('0x1'));var ejs=require(_0xd5c0('0x2'));var fs=require('fs');var _=require(_0xd5c0('0x3'));var qs=require(_0xd5c0('0x4'));var logger=require(_0xd5c0('0x5'))(_0xd5c0('0x6'));var config=require('../../config/environment');var db=require(_0xd5c0('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd5c0('0x8')][_0xd5c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x265cb5,_0x1b920f,_0x1ffc65,_0x3de547){return new Promise(function(_0xb3f0cf,_0x4f5574){var _0x59a711=_0x3de547||client;return _0x59a711[_0xd5c0('0xa')](_0x265cb5,_0x1ffc65)[_0xd5c0('0xb')](function(_0x40a2cb){logger['info'](_0xd5c0('0xc'),_0x1b920f,_0xd5c0('0xd'));logger[_0xd5c0('0xe')](_0xd5c0('0xf'),_0x1b920f,_0xd5c0('0xd'),JSON[_0xd5c0('0x10')](_0x40a2cb));if(_0x40a2cb[_0xd5c0('0x11')]){if(_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x12')]===0x1f4){logger[_0xd5c0('0x11')](_0xd5c0('0xc'),_0x1b920f,_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);return _0x4f5574(_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);}logger[_0xd5c0('0x11')](_0xd5c0('0xc'),_0x1b920f,_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);return _0xb3f0cf(_0x40a2cb[_0xd5c0('0x11')][_0xd5c0('0x13')]);}else{logger[_0xd5c0('0x14')]('Network,\x20%s,\x20%s',_0x1b920f,_0xd5c0('0xd'));_0xb3f0cf(_0x40a2cb[_0xd5c0('0x15')][_0xd5c0('0x13')]);}})[_0xd5c0('0x16')](function(_0x567986){logger[_0xd5c0('0x11')](_0xd5c0('0xc'),_0x1b920f,_0x567986);_0x4f5574(_0x567986);});});}function respondWithResult(_0x2a5e89,_0x1fd759){_0x1fd759=_0x1fd759||0xc8;return function(_0xb2d97c){if(_0xb2d97c){return _0x2a5e89['status'](_0x1fd759)[_0xd5c0('0x17')](_0xb2d97c);}};}function respondWithFilteredResult(_0x33fddc,_0x5a11d6){return function(_0x146906){if(_0x146906){var _0x149e19=typeof _0x5a11d6[_0xd5c0('0x18')]==='undefined'&&typeof _0x5a11d6['limit']===_0xd5c0('0x19');var _0x35819d=_0x146906[_0xd5c0('0x1a')];var _0x4ee996=_0x149e19?0x0:_0x5a11d6[_0xd5c0('0x18')];var _0x19ff43=_0x149e19?_0x146906[_0xd5c0('0x1a')]:_0x5a11d6[_0xd5c0('0x18')]+_0x5a11d6[_0xd5c0('0x1b')];var _0x2f3a91;if(_0x19ff43>=_0x35819d){_0x19ff43=_0x35819d;_0x2f3a91=0xc8;}else{_0x2f3a91=0xce;}_0x33fddc[_0xd5c0('0x1c')](_0x2f3a91);return _0x33fddc[_0xd5c0('0x1d')]('Content-Range',_0x4ee996+'-'+_0x19ff43+'/'+_0x35819d)[_0xd5c0('0x17')](_0x146906);}return null;};}function saveUpdates(_0x1b9080){return function(_0x3351a6){if(_0x3351a6){return _0x3351a6['update'](_0x1b9080)[_0xd5c0('0xb')](function(_0x424254){return _0x424254;});}return null;};}function removeEntity(_0x38d5b6){return function(_0x2a90e7){if(_0x2a90e7){return _0x2a90e7['destroy']()[_0xd5c0('0xb')](function(){_0x38d5b6[_0xd5c0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bc25){return function(_0x1cf37c){if(!_0x1cf37c){_0x23bc25[_0xd5c0('0x1e')](0x194);}return _0x1cf37c;};}function handleError(_0x84ee35,_0x190724){_0x190724=_0x190724||0x1f4;return function(_0x37a103){logger['error'](_0x37a103[_0xd5c0('0x1f')]);if(_0x37a103[_0xd5c0('0x20')]){delete _0x37a103[_0xd5c0('0x20')];}_0x84ee35[_0xd5c0('0x1c')](_0x190724)['send'](_0x37a103);};}exports[_0xd5c0('0x21')]=function(_0xc95187,_0x6db7d9){var _0x4e9a2c={},_0x1e8253={},_0x4e14fe={'count':0x0,'rows':[]};var _0x523e28=_[_0xd5c0('0x22')](db[_0xd5c0('0x23')][_0xd5c0('0x24')],function(_0x75f3f7){return{'name':_0x75f3f7[_0xd5c0('0x25')],'type':_0x75f3f7['type'][_0xd5c0('0x26')]};});_0x1e8253[_0xd5c0('0x27')]=_[_0xd5c0('0x22')](_0x523e28,_0xd5c0('0x20'));_0x1e8253[_0xd5c0('0x28')]=_[_0xd5c0('0x29')](_0xc95187[_0xd5c0('0x28')]);_0x1e8253[_0xd5c0('0x2a')]=_[_0xd5c0('0x2b')](_0x1e8253[_0xd5c0('0x27')],_0x1e8253[_0xd5c0('0x28')]);_0x4e9a2c[_0xd5c0('0x2c')]=_['intersection'](_0x1e8253['model'],qs['fields'](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x2d')]));_0x4e9a2c[_0xd5c0('0x2c')]=_0x4e9a2c[_0xd5c0('0x2c')][_0xd5c0('0x2e')]?_0x4e9a2c[_0xd5c0('0x2c')]:_0x1e8253[_0xd5c0('0x27')];if(!_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x2f')](_0xd5c0('0x30'))){_0x4e9a2c[_0xd5c0('0x1b')]=qs[_0xd5c0('0x1b')](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x1b')]);_0x4e9a2c['offset']=qs[_0xd5c0('0x18')](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x18')]);}_0x4e9a2c[_0xd5c0('0x31')]=qs[_0xd5c0('0x32')](_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x32')]);_0x4e9a2c['where']=qs['filters'](_['pick'](_0xc95187[_0xd5c0('0x28')],_0x1e8253[_0xd5c0('0x2a')]),_0x523e28);if(_0xc95187['query'][_0xd5c0('0x33')]){_0x4e9a2c[_0xd5c0('0x34')]=_['merge'](_0x4e9a2c['where'],{'$or':_[_0xd5c0('0x22')](_0x523e28,function(_0x122a8f){if(_0x122a8f[_0xd5c0('0x35')]!==_0xd5c0('0x36')){var _0x59eb43={};_0x59eb43[_0x122a8f[_0xd5c0('0x20')]]={'$like':'%'+_0xc95187[_0xd5c0('0x28')]['filter']+'%'};return _0x59eb43;}})});}_0x4e9a2c=_[_0xd5c0('0x37')]({},_0x4e9a2c,_0xc95187['options']);var _0x1a4837={'where':_0x4e9a2c[_0xd5c0('0x34')]};return db['Network']['count'](_0x1a4837)[_0xd5c0('0xb')](function(_0x157273){_0x4e14fe[_0xd5c0('0x1a')]=_0x157273;if(_0xc95187[_0xd5c0('0x28')][_0xd5c0('0x38')]){_0x4e9a2c['include']=[{'all':!![]}];}return db['Network'][_0xd5c0('0x39')](_0x4e9a2c);})['then'](function(_0x571aca){_0x4e14fe['rows']=_0x571aca;return _0x4e14fe;})['then'](respondWithFilteredResult(_0x6db7d9,_0x4e9a2c))['catch'](handleError(_0x6db7d9,null));};exports['show']=function(_0x5d1edf,_0x2e36e3){var _0x546311={'raw':!![],'where':{'id':_0x5d1edf[_0xd5c0('0x3a')]['id']}},_0x5afa3b={};_0x5afa3b['model']=_[_0xd5c0('0x29')](db[_0xd5c0('0x23')][_0xd5c0('0x24')]);_0x5afa3b['query']=_[_0xd5c0('0x29')](_0x5d1edf[_0xd5c0('0x28')]);_0x5afa3b[_0xd5c0('0x2a')]=_[_0xd5c0('0x2b')](_0x5afa3b[_0xd5c0('0x27')],_0x5afa3b['query']);_0x546311[_0xd5c0('0x2c')]=_[_0xd5c0('0x2b')](_0x5afa3b['model'],qs['fields'](_0x5d1edf[_0xd5c0('0x28')][_0xd5c0('0x2d')]));_0x546311['attributes']=_0x546311[_0xd5c0('0x2c')][_0xd5c0('0x2e')]?_0x546311[_0xd5c0('0x2c')]:_0x5afa3b[_0xd5c0('0x27')];if(_0x5d1edf[_0xd5c0('0x28')]['includeAll']){_0x546311[_0xd5c0('0x3b')]=[{'all':!![]}];}_0x546311=_[_0xd5c0('0x37')]({},_0x546311,_0x5d1edf[_0xd5c0('0x3c')]);return db[_0xd5c0('0x23')]['find'](_0x546311)[_0xd5c0('0xb')](handleEntityNotFound(_0x2e36e3,null))[_0xd5c0('0xb')](respondWithResult(_0x2e36e3,null))[_0xd5c0('0x16')](handleError(_0x2e36e3,null));};exports[_0xd5c0('0x3d')]=function(_0x3d6c18,_0x5d6a96){var _0x451896;return db[_0xd5c0('0x23')][_0xd5c0('0x3d')](_0x3d6c18[_0xd5c0('0x3e')],{'raw':!![]})[_0xd5c0('0xb')](function(_0x5b980c){_0x451896=_0x5b980c;return db[_0xd5c0('0x23')][_0xd5c0('0x39')]({'where':{'type':_0x3d6c18['body'][_0xd5c0('0x35')]},'raw':!![]});})['then'](function(_0xae15ab){if(_0x451896[_0xd5c0('0x35')][_0xd5c0('0x3f')]()=='STUN'){var _0x37b597=fs[_0xd5c0('0x40')](path['join'](config[_0xd5c0('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x29dbb0=ejs[_0xd5c0('0x42')](_0x37b597,{'networks':_0xae15ab||[]});fs['writeFileSync'](_0xd5c0('0x43'),_0x29dbb0);return respondWithRpcPromise(_0xd5c0('0x44'),'create',{'module':'res_stun_monitor.so'});}else if(_0x451896[_0xd5c0('0x35')][_0xd5c0('0x3f')]()==_0xd5c0('0x45')){var _0x310bdb=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],'server/files/templates/turn_multiple.ejs'),_0xd5c0('0x47'));var _0xa28aaf=ejs[_0xd5c0('0x42')](_0x310bdb,{'networks':_0xae15ab||[]});fs[_0xd5c0('0x48')](_0xd5c0('0x49'),_0xa28aaf);return respondWithRpcPromise(_0xd5c0('0x44'),'create',{'module':'res_stun_monitor.so'});}else{var _0x1d7635=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],'server/files/templates/network.ejs'),'utf8');var _0x449edf=ejs[_0xd5c0('0x42')](_0x1d7635,{'networks':_0xae15ab||[]});fs[_0xd5c0('0x48')](util[_0xd5c0('0x4a')](_0xd5c0('0x4b'),_0x3d6c18[_0xd5c0('0x3e')][_0xd5c0('0x35')][_0xd5c0('0x4c')]()),_0x449edf);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x3d'),{'module':_0xd5c0('0x4d')});}})['then'](function(){return _0x451896;})[_0xd5c0('0xb')](respondWithResult(_0x5d6a96,0xc9))[_0xd5c0('0x16')](handleError(_0x5d6a96,null));};exports[_0xd5c0('0x4e')]=function(_0x300a3c,_0x501c58){var _0x33afa3;return db['Network'][_0xd5c0('0x4f')]({'where':{'id':_0x300a3c['params']['id']}})[_0xd5c0('0xb')](handleEntityNotFound(_0x501c58,null))[_0xd5c0('0xb')](saveUpdates(_0x300a3c['body'],null))[_0xd5c0('0xb')](function(_0x91185a){if(_0x91185a){_0x33afa3=_0x91185a;return db[_0xd5c0('0x23')][_0xd5c0('0x39')]({'where':{'type':_0x33afa3['type']},'raw':!![]});}return null;})[_0xd5c0('0xb')](function(_0x42292d){if(_0x33afa3[_0xd5c0('0x35')]['toUpperCase']()==_0xd5c0('0x50')){var _0x1570aa=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x51')),_0xd5c0('0x47'));var _0x7501cb=ejs['render'](_0x1570aa,{'networks':_0x42292d||[]});fs[_0xd5c0('0x48')]('/etc/asterisk/stun_xcally.conf',_0x7501cb);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x4e'),{'module':_0xd5c0('0x52')});}else if(_0x33afa3[_0xd5c0('0x35')][_0xd5c0('0x3f')]()==_0xd5c0('0x45')){var _0x33429e=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x53')),_0xd5c0('0x47'));var _0xd1da4e=ejs[_0xd5c0('0x42')](_0x33429e,{'networks':_0x42292d||[]});fs['writeFileSync'](_0xd5c0('0x49'),_0xd1da4e);return respondWithRpcPromise('Reload',_0xd5c0('0x4e'),{'module':_0xd5c0('0x52')});}else{var _0x669837=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x54')),_0xd5c0('0x47'));var _0x296620=ejs[_0xd5c0('0x42')](_0x669837,{'networks':_0x42292d||[]});fs[_0xd5c0('0x48')](util[_0xd5c0('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x300a3c[_0xd5c0('0x3e')][_0xd5c0('0x35')][_0xd5c0('0x4c')]()),_0x296620);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x4e'),{'module':_0xd5c0('0x4d')});}})['then'](function(_0x3c0f09){if(_0x3c0f09){return _0x33afa3;}return null;})['then'](respondWithResult(_0x501c58,null))[_0xd5c0('0x16')](handleError(_0x501c58,null));};exports['destroy']=function(_0x14a11e,_0x3db17e){var _0x4f3f5a;return db[_0xd5c0('0x23')][_0xd5c0('0x4f')]({'where':{'id':_0x14a11e[_0xd5c0('0x3a')]['id']}})[_0xd5c0('0xb')](function(_0x3265ba){_0x4f3f5a=_0x3265ba;return _0x3265ba;})[_0xd5c0('0xb')](handleEntityNotFound(_0x3db17e,null))[_0xd5c0('0xb')](removeEntity(_0x3db17e,null))[_0xd5c0('0xb')](function(){if(_0x4f3f5a){return db[_0xd5c0('0x23')][_0xd5c0('0x39')]({'where':{'type':_0x4f3f5a[_0xd5c0('0x35')]},'raw':!![]});}})[_0xd5c0('0xb')](function(_0xf1b44e){if(_0x4f3f5a[_0xd5c0('0x35')]['toUpperCase']()==_0xd5c0('0x50')){var _0x412082=fs[_0xd5c0('0x40')](path['join'](config[_0xd5c0('0x41')],_0xd5c0('0x51')),_0xd5c0('0x47'));var _0xd6af27=ejs[_0xd5c0('0x42')](_0x412082,{'networks':_0xf1b44e||[]});fs[_0xd5c0('0x48')](_0xd5c0('0x43'),_0xd6af27);return respondWithRpcPromise('Reload',_0xd5c0('0x55'),{'module':_0xd5c0('0x52')});}else if(_0x4f3f5a['type']['toUpperCase']()==_0xd5c0('0x45')){var _0x2aec1f=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config['root'],_0xd5c0('0x53')),_0xd5c0('0x47'));var _0x3a2106=ejs[_0xd5c0('0x42')](_0x2aec1f,{'networks':_0xf1b44e||[]});fs[_0xd5c0('0x48')](_0xd5c0('0x49'),_0x3a2106);return respondWithRpcPromise(_0xd5c0('0x44'),_0xd5c0('0x55'),{'module':_0xd5c0('0x52')});}else{var _0x1d69cf=fs[_0xd5c0('0x40')](path[_0xd5c0('0x46')](config[_0xd5c0('0x41')],_0xd5c0('0x54')),_0xd5c0('0x47'));var _0xfb7cdb=ejs['render'](_0x1d69cf,{'networks':_0xf1b44e||[]});fs[_0xd5c0('0x48')](util[_0xd5c0('0x4a')](_0xd5c0('0x4b'),_0x4f3f5a[_0xd5c0('0x35')]['toLowerCase']()),_0xfb7cdb);return respondWithRpcPromise(_0xd5c0('0x44'),'destroy',{'module':_0xd5c0('0x4d')});}})[_0xd5c0('0x16')](handleError(_0x3db17e,null));}; \ No newline at end of file +var _0x66c7=['Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','show','params','find','create','body','findAll','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toUpperCase','TURN','toLowerCase','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x66c7,0x13e));var _0x766c=function(_0x3fc81e,_0x24de72){_0x3fc81e=_0x3fc81e-0x0;var _0x4d0d12=_0x66c7[_0x3fc81e];return _0x4d0d12;};'use strict';var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x766c('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x766c('0x1'));var client=jayson[_0x766c('0x2')][_0x766c('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x5b644d,_0x4b2e72,_0x387edb,_0x50b09e){return new Promise(function(_0x216be7,_0x1b4fb5){var _0x249352=_0x50b09e||client;return _0x249352[_0x766c('0x4')](_0x5b644d,_0x387edb)['then'](function(_0x38c567){logger[_0x766c('0x5')](_0x766c('0x6'),_0x4b2e72,_0x766c('0x7'));logger[_0x766c('0x8')]('Network,\x20%s,\x20%s,\x20%s',_0x4b2e72,_0x766c('0x7'),JSON[_0x766c('0x9')](_0x38c567));if(_0x38c567[_0x766c('0xa')]){if(_0x38c567[_0x766c('0xa')][_0x766c('0xb')]===0x1f4){logger[_0x766c('0xa')]('Network,\x20%s,\x20%s',_0x4b2e72,_0x38c567[_0x766c('0xa')][_0x766c('0xc')]);return _0x1b4fb5(_0x38c567['error'][_0x766c('0xc')]);}logger[_0x766c('0xa')](_0x766c('0x6'),_0x4b2e72,_0x38c567[_0x766c('0xa')][_0x766c('0xc')]);return _0x216be7(_0x38c567[_0x766c('0xa')]['message']);}else{logger[_0x766c('0x5')](_0x766c('0x6'),_0x4b2e72,_0x766c('0x7'));_0x216be7(_0x38c567[_0x766c('0xd')][_0x766c('0xc')]);}})[_0x766c('0xe')](function(_0x32976b){logger[_0x766c('0xa')](_0x766c('0x6'),_0x4b2e72,_0x32976b);_0x1b4fb5(_0x32976b);});});}function respondWithResult(_0x2dc1d4,_0x139ae6){_0x139ae6=_0x139ae6||0xc8;return function(_0xa45fe5){if(_0xa45fe5){return _0x2dc1d4[_0x766c('0xf')](_0x139ae6)[_0x766c('0x10')](_0xa45fe5);}};}function respondWithFilteredResult(_0x419596,_0x188015){return function(_0x11b43d){if(_0x11b43d){var _0x1e31a7=typeof _0x188015[_0x766c('0x11')]===_0x766c('0x12')&&typeof _0x188015[_0x766c('0x13')]===_0x766c('0x12');var _0x18a1e4=_0x11b43d[_0x766c('0x14')];var _0x179b40=_0x1e31a7?0x0:_0x188015[_0x766c('0x11')];var _0x2739d=_0x1e31a7?_0x11b43d[_0x766c('0x14')]:_0x188015[_0x766c('0x11')]+_0x188015[_0x766c('0x13')];var _0x1a55da;if(_0x2739d>=_0x18a1e4){_0x2739d=_0x18a1e4;_0x1a55da=0xc8;}else{_0x1a55da=0xce;}_0x419596['status'](_0x1a55da);return _0x419596[_0x766c('0x15')](_0x766c('0x16'),_0x179b40+'-'+_0x2739d+'/'+_0x18a1e4)[_0x766c('0x10')](_0x11b43d);}return null;};}function saveUpdates(_0x2f6d91){return function(_0x102fb7){if(_0x102fb7){return _0x102fb7[_0x766c('0x17')](_0x2f6d91)[_0x766c('0x18')](function(_0x56b316){return _0x56b316;});}return null;};}function removeEntity(_0x16de71){return function(_0x4d305f){if(_0x4d305f){return _0x4d305f[_0x766c('0x19')]()[_0x766c('0x18')](function(){_0x16de71[_0x766c('0xf')](0xcc)[_0x766c('0x1a')]();});}};}function handleEntityNotFound(_0x559809){return function(_0x2063bb){if(!_0x2063bb){_0x559809[_0x766c('0x1b')](0x194);}return _0x2063bb;};}function handleError(_0x23c213,_0x4fdb95){_0x4fdb95=_0x4fdb95||0x1f4;return function(_0x1d1eee){logger[_0x766c('0xa')](_0x1d1eee[_0x766c('0x1c')]);if(_0x1d1eee[_0x766c('0x1d')]){delete _0x1d1eee[_0x766c('0x1d')];}_0x23c213[_0x766c('0xf')](_0x4fdb95)[_0x766c('0x1e')](_0x1d1eee);};}exports[_0x766c('0x1f')]=function(_0x4c9819,_0x155fe3){var _0x2435e3={},_0x4e1e98={},_0x123686={'count':0x0,'rows':[]};var _0xfdaccf=_[_0x766c('0x20')](db[_0x766c('0x21')][_0x766c('0x22')],function(_0x4feb18){return{'name':_0x4feb18[_0x766c('0x23')],'type':_0x4feb18[_0x766c('0x24')][_0x766c('0x25')]};});_0x4e1e98[_0x766c('0x26')]=_[_0x766c('0x20')](_0xfdaccf,_0x766c('0x1d'));_0x4e1e98['query']=_[_0x766c('0x27')](_0x4c9819[_0x766c('0x28')]);_0x4e1e98[_0x766c('0x29')]=_[_0x766c('0x2a')](_0x4e1e98['model'],_0x4e1e98[_0x766c('0x28')]);_0x2435e3[_0x766c('0x2b')]=_['intersection'](_0x4e1e98[_0x766c('0x26')],qs['fields'](_0x4c9819['query'][_0x766c('0x2c')]));_0x2435e3[_0x766c('0x2b')]=_0x2435e3[_0x766c('0x2b')][_0x766c('0x2d')]?_0x2435e3[_0x766c('0x2b')]:_0x4e1e98['model'];if(!_0x4c9819[_0x766c('0x28')][_0x766c('0x2e')]('nolimit')){_0x2435e3[_0x766c('0x13')]=qs[_0x766c('0x13')](_0x4c9819['query'][_0x766c('0x13')]);_0x2435e3[_0x766c('0x11')]=qs[_0x766c('0x11')](_0x4c9819['query']['offset']);}_0x2435e3[_0x766c('0x2f')]=qs[_0x766c('0x30')](_0x4c9819[_0x766c('0x28')][_0x766c('0x30')]);_0x2435e3[_0x766c('0x31')]=qs['filters'](_[_0x766c('0x32')](_0x4c9819[_0x766c('0x28')],_0x4e1e98[_0x766c('0x29')]),_0xfdaccf);if(_0x4c9819[_0x766c('0x28')]['filter']){_0x2435e3[_0x766c('0x31')]=_[_0x766c('0x33')](_0x2435e3['where'],{'$or':_[_0x766c('0x20')](_0xfdaccf,function(_0x4396f0){if(_0x4396f0[_0x766c('0x24')]!==_0x766c('0x34')){var _0x1af245={};_0x1af245[_0x4396f0['name']]={'$like':'%'+_0x4c9819[_0x766c('0x28')]['filter']+'%'};return _0x1af245;}})});}_0x2435e3=_[_0x766c('0x33')]({},_0x2435e3,_0x4c9819['options']);var _0x2c8c3c={'where':_0x2435e3[_0x766c('0x31')]};return db[_0x766c('0x21')]['count'](_0x2c8c3c)['then'](function(_0x3933c1){_0x123686[_0x766c('0x14')]=_0x3933c1;if(_0x4c9819[_0x766c('0x28')][_0x766c('0x35')]){_0x2435e3[_0x766c('0x36')]=[{'all':!![]}];}return db['Network']['findAll'](_0x2435e3);})[_0x766c('0x18')](function(_0x4f65ea){_0x123686[_0x766c('0x37')]=_0x4f65ea;return _0x123686;})[_0x766c('0x18')](respondWithFilteredResult(_0x155fe3,_0x2435e3))[_0x766c('0xe')](handleError(_0x155fe3,null));};exports[_0x766c('0x38')]=function(_0x4a28ef,_0x2ee515){var _0x1dc757={'raw':!![],'where':{'id':_0x4a28ef[_0x766c('0x39')]['id']}},_0x57f17d={};_0x57f17d[_0x766c('0x26')]=_[_0x766c('0x27')](db[_0x766c('0x21')][_0x766c('0x22')]);_0x57f17d[_0x766c('0x28')]=_[_0x766c('0x27')](_0x4a28ef['query']);_0x57f17d[_0x766c('0x29')]=_['intersection'](_0x57f17d[_0x766c('0x26')],_0x57f17d[_0x766c('0x28')]);_0x1dc757[_0x766c('0x2b')]=_['intersection'](_0x57f17d[_0x766c('0x26')],qs[_0x766c('0x2c')](_0x4a28ef['query'][_0x766c('0x2c')]));_0x1dc757['attributes']=_0x1dc757[_0x766c('0x2b')]['length']?_0x1dc757[_0x766c('0x2b')]:_0x57f17d[_0x766c('0x26')];if(_0x4a28ef[_0x766c('0x28')]['includeAll']){_0x1dc757[_0x766c('0x36')]=[{'all':!![]}];}_0x1dc757=_[_0x766c('0x33')]({},_0x1dc757,_0x4a28ef['options']);return db[_0x766c('0x21')][_0x766c('0x3a')](_0x1dc757)['then'](handleEntityNotFound(_0x2ee515,null))[_0x766c('0x18')](respondWithResult(_0x2ee515,null))[_0x766c('0xe')](handleError(_0x2ee515,null));};exports[_0x766c('0x3b')]=function(_0x4b71cd,_0x20a3f0){var _0x55ae7c;return db[_0x766c('0x21')][_0x766c('0x3b')](_0x4b71cd[_0x766c('0x3c')],{'raw':!![]})[_0x766c('0x18')](function(_0x2a51d2){_0x55ae7c=_0x2a51d2;return db[_0x766c('0x21')][_0x766c('0x3d')]({'where':{'type':_0x4b71cd[_0x766c('0x3c')]['type']},'raw':!![]});})[_0x766c('0x18')](function(_0x4f0f3e){if(_0x55ae7c['type']['toUpperCase']()==_0x766c('0x3e')){var _0xc9794b=fs[_0x766c('0x3f')](path['join'](config[_0x766c('0x40')],_0x766c('0x41')),_0x766c('0x42'));var _0x920780=ejs[_0x766c('0x43')](_0xc9794b,{'networks':_0x4f0f3e||[]});fs[_0x766c('0x44')]('/etc/asterisk/stun_xcally.conf',_0x920780);return respondWithRpcPromise(_0x766c('0x45'),_0x766c('0x3b'),{'module':_0x766c('0x46')});}else if(_0x55ae7c['type']['toUpperCase']()=='TURN'){var _0x4418fe=fs[_0x766c('0x3f')](path[_0x766c('0x47')](config[_0x766c('0x40')],_0x766c('0x48')),_0x766c('0x42'));var _0x51880b=ejs[_0x766c('0x43')](_0x4418fe,{'networks':_0x4f0f3e||[]});fs['writeFileSync'](_0x766c('0x49'),_0x51880b);return respondWithRpcPromise(_0x766c('0x45'),_0x766c('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x4e3adc=fs['readFileSync'](path[_0x766c('0x47')](config[_0x766c('0x40')],_0x766c('0x4a')),_0x766c('0x42'));var _0x3621ad=ejs[_0x766c('0x43')](_0x4e3adc,{'networks':_0x4f0f3e||[]});fs[_0x766c('0x44')](util[_0x766c('0x4b')](_0x766c('0x4c'),_0x4b71cd['body']['type']['toLowerCase']()),_0x3621ad);return respondWithRpcPromise('Reload',_0x766c('0x3b'),{'module':_0x766c('0x4d')});}})['then'](function(){return _0x55ae7c;})[_0x766c('0x18')](respondWithResult(_0x20a3f0,0xc9))['catch'](handleError(_0x20a3f0,null));};exports[_0x766c('0x17')]=function(_0x2e3f17,_0x59fa82){var _0x54ac56;return db['Network'][_0x766c('0x3a')]({'where':{'id':_0x2e3f17[_0x766c('0x39')]['id']}})[_0x766c('0x18')](handleEntityNotFound(_0x59fa82,null))[_0x766c('0x18')](saveUpdates(_0x2e3f17[_0x766c('0x3c')],null))['then'](function(_0x28363c){if(_0x28363c){_0x54ac56=_0x28363c;return db[_0x766c('0x21')][_0x766c('0x3d')]({'where':{'type':_0x54ac56[_0x766c('0x24')]},'raw':!![]});}return null;})[_0x766c('0x18')](function(_0x39db4c){if(_0x54ac56[_0x766c('0x24')]['toUpperCase']()==_0x766c('0x3e')){var _0x1bb74c=fs['readFileSync'](path[_0x766c('0x47')](config[_0x766c('0x40')],_0x766c('0x41')),_0x766c('0x42'));var _0x4fe22c=ejs[_0x766c('0x43')](_0x1bb74c,{'networks':_0x39db4c||[]});fs[_0x766c('0x44')]('/etc/asterisk/stun_xcally.conf',_0x4fe22c);return respondWithRpcPromise(_0x766c('0x45'),'update',{'module':_0x766c('0x46')});}else if(_0x54ac56[_0x766c('0x24')][_0x766c('0x4e')]()==_0x766c('0x4f')){var _0x52f70b=fs[_0x766c('0x3f')](path['join'](config[_0x766c('0x40')],_0x766c('0x48')),_0x766c('0x42'));var _0x245344=ejs['render'](_0x52f70b,{'networks':_0x39db4c||[]});fs[_0x766c('0x44')]('/etc/asterisk/turn_xcally.conf',_0x245344);return respondWithRpcPromise(_0x766c('0x45'),_0x766c('0x17'),{'module':'res_stun_monitor.so'});}else{var _0x288aac=fs['readFileSync'](path['join'](config[_0x766c('0x40')],'server/files/templates/network.ejs'),_0x766c('0x42'));var _0x51e01b=ejs[_0x766c('0x43')](_0x288aac,{'networks':_0x39db4c||[]});fs[_0x766c('0x44')](util[_0x766c('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x2e3f17['body']['type'][_0x766c('0x50')]()),_0x51e01b);return respondWithRpcPromise(_0x766c('0x45'),'update',{'module':_0x766c('0x4d')});}})[_0x766c('0x18')](function(_0x4db3f8){if(_0x4db3f8){return _0x54ac56;}return null;})[_0x766c('0x18')](respondWithResult(_0x59fa82,null))[_0x766c('0xe')](handleError(_0x59fa82,null));};exports[_0x766c('0x19')]=function(_0x24eb23,_0x3003f9){var _0x1c7052;return db[_0x766c('0x21')][_0x766c('0x3a')]({'where':{'id':_0x24eb23[_0x766c('0x39')]['id']}})[_0x766c('0x18')](function(_0x4e90f5){_0x1c7052=_0x4e90f5;return _0x4e90f5;})[_0x766c('0x18')](handleEntityNotFound(_0x3003f9,null))['then'](removeEntity(_0x3003f9,null))[_0x766c('0x18')](function(){if(_0x1c7052){return db[_0x766c('0x21')]['findAll']({'where':{'type':_0x1c7052['type']},'raw':!![]});}})[_0x766c('0x18')](function(_0x356385){if(_0x1c7052[_0x766c('0x24')][_0x766c('0x4e')]()==_0x766c('0x3e')){var _0x1d6988=fs[_0x766c('0x3f')](path['join'](config[_0x766c('0x40')],_0x766c('0x41')),'utf8');var _0x2e34f6=ejs['render'](_0x1d6988,{'networks':_0x356385||[]});fs[_0x766c('0x44')]('/etc/asterisk/stun_xcally.conf',_0x2e34f6);return respondWithRpcPromise(_0x766c('0x45'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x1c7052[_0x766c('0x24')]['toUpperCase']()=='TURN'){var _0x3052eb=fs[_0x766c('0x3f')](path['join'](config['root'],_0x766c('0x48')),_0x766c('0x42'));var _0x533bc8=ejs[_0x766c('0x43')](_0x3052eb,{'networks':_0x356385||[]});fs[_0x766c('0x44')]('/etc/asterisk/turn_xcally.conf',_0x533bc8);return respondWithRpcPromise(_0x766c('0x45'),_0x766c('0x19'),{'module':_0x766c('0x46')});}else{var _0x4dc2f9=fs[_0x766c('0x3f')](path[_0x766c('0x47')](config[_0x766c('0x40')],_0x766c('0x4a')),'utf8');var _0x2ff296=ejs[_0x766c('0x43')](_0x4dc2f9,{'networks':_0x356385||[]});fs[_0x766c('0x44')](util['format'](_0x766c('0x4c'),_0x1c7052[_0x766c('0x24')][_0x766c('0x50')]()),_0x2ff296);return respondWithRpcPromise(_0x766c('0x45'),_0x766c('0x19'),{'module':_0x766c('0x4d')});}})[_0x766c('0xe')](handleError(_0x3003f9,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bf7f371..7368194 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 _0xcb91=['rimraf','./network.attributes','exports','define','network','../../config/logger','api','moment','bluebird','path'];(function(_0x315f4d,_0xfb6f14){var _0x11e364=function(_0x61812a){while(--_0x61812a){_0x315f4d['push'](_0x315f4d['shift']());}};_0x11e364(++_0xfb6f14);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xcb91[_0x623e7];return _0x121131;};'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'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('Network',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['network','../../config/logger','bluebird','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x473b12,_0x36c2a8){var _0x9bb646=function(_0x515947){while(--_0x515947){_0x473b12['push'](_0x473b12['shift']());}};_0x9bb646(++_0x36c2a8);}(_0xa74f,0x9a));var _0xfa74=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0xa74f[_0x404957];return _0x4e0365;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'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 8648955..3613d98 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x17829d,_0x2b6871){var _0x209074=function(_0x3d74ea){while(--_0x3d74ea){_0x17829d['push'](_0x17829d['shift']());}};_0x209074(++_0x2b6871);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5d1683,_0x5c2e3d){var _0x22a928=function(_0x3dc27b){while(--_0x3dc27b){_0x5d1683['push'](_0x5d1683['shift']());}};_0x22a928(++_0x5c2e3d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 62845c8..1d453a0 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 _0x60e5=['removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers'];(function(_0x956be9,_0x19d2be){var _0x3e39e0=function(_0x24be58){while(--_0x24be58){_0x956be9['push'](_0x956be9['shift']());}};_0x3e39e0(++_0x19d2be);}(_0x60e5,0x1af));var _0x560e=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x60e5[_0x57fa7e];return _0x320671;};'use strict';var multer=require('multer');var util=require(_0x560e('0x0'));var path=require(_0x560e('0x1'));var timeout=require(_0x560e('0x2'));var express=require(_0x560e('0x3'));var router=express[_0x560e('0x4')]();var fs_extra=require(_0x560e('0x5'));var auth=require(_0x560e('0x6'));var interaction=require(_0x560e('0x7'));var config=require(_0x560e('0x8'));var controller=require(_0x560e('0x9'));router[_0x560e('0xa')]('/',auth['isAuthenticated'](),controller[_0x560e('0xb')]);router[_0x560e('0xa')](_0x560e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x560e('0xa')](_0x560e('0xd'),auth[_0x560e('0xe')](),controller['show']);router['get'](_0x560e('0xf'),auth['isAuthenticated'](),controller[_0x560e('0x10')]);router['get'](_0x560e('0x11'),auth[_0x560e('0xe')](),controller[_0x560e('0x12')]);router['get'](_0x560e('0x13'),auth[_0x560e('0xe')](),controller['getApplications']);router['get'](_0x560e('0x14'),auth[_0x560e('0xe')](),controller[_0x560e('0x15')]);router[_0x560e('0xa')](_0x560e('0x16'),auth[_0x560e('0xe')](),controller[_0x560e('0x17')]);router[_0x560e('0x18')]('/',auth[_0x560e('0xe')](),controller[_0x560e('0x19')]);router[_0x560e('0x18')](_0x560e('0xf'),auth['isAuthenticated'](),controller[_0x560e('0x1a')]);router[_0x560e('0x18')]('/:id/canned_answers',auth[_0x560e('0xe')](),controller[_0x560e('0x1b')]);router['post'](_0x560e('0x1c'),controller[_0x560e('0x1d')]);router[_0x560e('0x18')]('/:id/applications',auth[_0x560e('0xe')](),controller[_0x560e('0x1e')]);router['post']('/:id/users',auth[_0x560e('0xe')](),controller['addAgents']);router[_0x560e('0x18')](_0x560e('0x1f'),auth[_0x560e('0xe')](),controller[_0x560e('0x20')]);router[_0x560e('0x21')](_0x560e('0xd'),auth[_0x560e('0xe')](),controller['update']);router[_0x560e('0x22')](_0x560e('0xd'),auth[_0x560e('0xe')](),controller['destroy']);router[_0x560e('0x22')]('/:id/dispositions',auth[_0x560e('0xe')](),controller[_0x560e('0x23')]);router[_0x560e('0x22')](_0x560e('0x11'),auth[_0x560e('0xe')](),controller[_0x560e('0x24')]);router[_0x560e('0x22')](_0x560e('0x16'),auth[_0x560e('0xe')](),controller[_0x560e('0x25')]);module[_0x560e('0x26')]=router; \ No newline at end of file +var _0x347a=['getInteractions','post','addDisposition','addAnswer','/:id/notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','destroy','delete','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x37644a,_0x1a223a){var _0x48c516=function(_0x1fa32c){while(--_0x1fa32c){_0x37644a['push'](_0x37644a['shift']());}};_0x48c516(++_0x1a223a);}(_0x347a,0x1b5));var _0xa347=function(_0x3fd531,_0x538738){_0x3fd531=_0x3fd531-0x0;var _0x5bd9db=_0x347a[_0x3fd531];return _0x5bd9db;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa347('0x0'));var express=require(_0xa347('0x1'));var router=express[_0xa347('0x2')]();var fs_extra=require(_0xa347('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa347('0x4'));var config=require(_0xa347('0x5'));var controller=require(_0xa347('0x6'));router[_0xa347('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa347('0x7')](_0xa347('0x8'),auth[_0xa347('0x9')](),controller[_0xa347('0xa')]);router[_0xa347('0x7')]('/:id',auth[_0xa347('0x9')](),controller[_0xa347('0xb')]);router[_0xa347('0x7')](_0xa347('0xc'),auth[_0xa347('0x9')](),controller[_0xa347('0xd')]);router[_0xa347('0x7')](_0xa347('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xa347('0xf'),auth[_0xa347('0x9')](),controller[_0xa347('0x10')]);router[_0xa347('0x7')](_0xa347('0x11'),auth[_0xa347('0x9')](),controller[_0xa347('0x12')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xa347('0x13')]('/',auth[_0xa347('0x9')](),controller['create']);router['post'](_0xa347('0xc'),auth['isAuthenticated'](),controller[_0xa347('0x14')]);router['post'](_0xa347('0xe'),auth['isAuthenticated'](),controller[_0xa347('0x15')]);router[_0xa347('0x13')](_0xa347('0x16'),controller['notify']);router[_0xa347('0x13')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa347('0x17')]);router[_0xa347('0x13')](_0xa347('0x18'),auth[_0xa347('0x9')](),controller[_0xa347('0x19')]);router[_0xa347('0x13')](_0xa347('0x1a'),auth[_0xa347('0x9')](),controller[_0xa347('0x1b')]);router[_0xa347('0x1c')](_0xa347('0x1d'),auth[_0xa347('0x9')](),controller[_0xa347('0x1e')]);router['delete']('/:id',auth[_0xa347('0x9')](),controller[_0xa347('0x1f')]);router[_0xa347('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xa347('0xe'),auth[_0xa347('0x9')](),controller['removeAnswers']);router[_0xa347('0x20')](_0xa347('0x18'),auth[_0xa347('0x9')](),controller[_0xa347('0x21')]);module[_0xa347('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 76629d6..1bdd4bb 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 _0xd4bf=['randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xd4bf,0x8c));var _0xfd4b=function(_0x4d56c7,_0x24f382){_0x4d56c7=_0x4d56c7-0x0;var _0x39cee4=_0xd4bf[_0x4d56c7];return _0x39cee4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfd4b('0x0'));module[_0xfd4b('0x1')]={'name':{'type':Sequelize[_0xfd4b('0x2')],'unique':_0xfd4b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfd4b('0x2')],'defaultValue':function(){return rs[_0xfd4b('0x4')]();}},'replyUri':{'type':Sequelize[_0xfd4b('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xfd4b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfd4b('0x5')],'defaultValue':function(){return _0xfd4b('0x6');}},'notificationSound':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfd4b('0x2')]},'queueTransfer':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfd4b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfd4b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xfd4b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfd4b('0xa'),'set':function(_0x41315e){if(!_0x41315e)this[_0xfd4b('0xb')](_0xfd4b('0xc'),null);this['setDataValue'](_0xfd4b('0xd'),_0x41315e);}}}; \ No newline at end of file +var _0xa9c2=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xc26950,_0x2d7860){var _0x1f2293=function(_0x5948e0){while(--_0x5948e0){_0xc26950['push'](_0xc26950['shift']());}};_0x1f2293(++_0x2d7860);}(_0xa9c2,0x1c1));var _0x2a9c=function(_0x28a9c5,_0x131baa){_0x28a9c5=_0x28a9c5-0x0;var _0x35910a=_0xa9c2[_0x28a9c5];return _0x35910a;};'use strict';var Sequelize=require(_0x2a9c('0x0'));var rs=require('randomstring');module[_0x2a9c('0x1')]={'name':{'type':Sequelize[_0x2a9c('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2a9c('0x2')]},'token':{'type':Sequelize[_0x2a9c('0x2')],'defaultValue':function(){return rs[_0x2a9c('0x3')]();}},'replyUri':{'type':Sequelize[_0x2a9c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2a9c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2a9c('0x4')],'defaultValue':function(){return _0x2a9c('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2a9c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2a9c('0x2')]},'queueTransfer':{'type':Sequelize[_0x2a9c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2a9c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2a9c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2a9c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2a9c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2a9c('0x6')],'defaultValue':![],'comment':_0x2a9c('0x9'),'set':function(_0x156e18){if(!_0x156e18)this[_0x2a9c('0xa')](_0x2a9c('0xb'),null);this[_0x2a9c('0xa')](_0x2a9c('0xc'),_0x156e18);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 2034453..7afce65 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 _0x1da6=['name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','CmContact','DESC','OpenchannelApplication','Applications','list','orderBy','applications','priority','account','Contacts','from','mapKey','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','push','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Tag','Tags','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','OpenchannelAccounts','UserProfileResource','stack'];(function(_0x4f3dee,_0x46bb90){var _0x291aad=function(_0x3ca8f5){while(--_0x3ca8f5){_0x4f3dee['push'](_0x4f3dee['shift']());}};_0x291aad(++_0x46bb90);}(_0x1da6,0x7c));var _0x61da=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x1da6[_0x574ce3];return _0x3447a0;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require(_0x61da('0x5'));var BPromise=require(_0x61da('0x6'));var Mustache=require(_0x61da('0x7'));var util=require(_0x61da('0x8'));var path=require(_0x61da('0x9'));var sox=require(_0x61da('0xa'));var csv=require(_0x61da('0xb'));var ejs=require(_0x61da('0xc'));var fs=require('fs');var fs_extra=require(_0x61da('0xd'));var _=require(_0x61da('0xe'));var squel=require(_0x61da('0xf'));var crypto=require(_0x61da('0x10'));var jsforce=require(_0x61da('0x11'));var deskjs=require(_0x61da('0x12'));var toCsv=require(_0x61da('0xb'));var querystring=require('querystring');var Papa=require(_0x61da('0x13'));var Redis=require(_0x61da('0x14'));var authService=require(_0x61da('0x15'));var qs=require(_0x61da('0x16'));var as=require(_0x61da('0x17'));var hardwareService=require(_0x61da('0x18'));var logger=require(_0x61da('0x19'))(_0x61da('0x1a'));var utils=require(_0x61da('0x1b'));var config=require(_0x61da('0x1c'));var licenseUtil=require(_0x61da('0x1d'));var db=require(_0x61da('0x1e'))['db'];config[_0x61da('0x1f')]=_[_0x61da('0x20')](config[_0x61da('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x61da('0x21'))(new Redis(config[_0x61da('0x1f')]));require(_0x61da('0x22'))[_0x61da('0x23')](socket);var jayson=require('jayson/promise');var client=jayson[_0x61da('0x24')]['http']({'port':0x232c});var client9002=jayson[_0x61da('0x24')][_0x61da('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x4a0aea,_0x53f3a4,_0x1305fe,_0x314f41){return new BPromise(function(_0x46d2c4,_0x16ab1e){var _0x2ac3aa=_0x314f41||client;return _0x2ac3aa[_0x61da('0x26')](_0x4a0aea,_0x1305fe)['then'](function(_0x14f049){logger[_0x61da('0x27')](_0x61da('0x28'),_0x53f3a4,_0x61da('0x29'));logger['debug'](_0x61da('0x2a'),_0x53f3a4,_0x61da('0x29'),JSON[_0x61da('0x2b')](_0x14f049));if(_0x14f049[_0x61da('0x2c')]){if(_0x14f049['error'][_0x61da('0x2d')]===0x1f4){logger['error'](_0x61da('0x28'),_0x53f3a4,_0x14f049[_0x61da('0x2c')][_0x61da('0x2e')]);return _0x16ab1e(_0x14f049[_0x61da('0x2c')][_0x61da('0x2e')]);}logger[_0x61da('0x2c')](_0x61da('0x28'),_0x53f3a4,_0x14f049[_0x61da('0x2c')][_0x61da('0x2e')]);return _0x46d2c4(_0x14f049[_0x61da('0x2c')]['message']);}else{logger[_0x61da('0x27')](_0x61da('0x28'),_0x53f3a4,_0x61da('0x29'));_0x46d2c4(_0x14f049[_0x61da('0x2f')][_0x61da('0x2e')]);}})[_0x61da('0x30')](function(_0x4860d4){logger[_0x61da('0x2c')](_0x61da('0x28'),_0x53f3a4,_0x4860d4);_0x16ab1e(_0x4860d4);});});}function respondWithStatusCode(_0x229326,_0x100ba1){_0x100ba1=_0x100ba1||0xcc;return function(_0x351241){if(_0x351241){return _0x229326[_0x61da('0x31')](_0x100ba1);}return _0x229326[_0x61da('0x32')](_0x100ba1)[_0x61da('0x33')]();};}function respondWithResult(_0x4c1bf4,_0x2746a6){_0x2746a6=_0x2746a6||0xc8;return function(_0x403244){if(_0x403244){return _0x4c1bf4[_0x61da('0x32')](_0x2746a6)[_0x61da('0x34')](_0x403244);}};}function respondWithFilteredResult(_0x52f486,_0x275aa6){return function(_0x591efe){if(_0x591efe){var _0x2c9a1d=typeof _0x275aa6[_0x61da('0x35')]===_0x61da('0x36')&&typeof _0x275aa6[_0x61da('0x37')]===_0x61da('0x36');var _0x3166be=_0x591efe[_0x61da('0x38')];var _0x52d93d=_0x2c9a1d?0x0:_0x275aa6[_0x61da('0x35')];var _0x511ec7=_0x2c9a1d?_0x591efe['count']:_0x275aa6[_0x61da('0x35')]+_0x275aa6[_0x61da('0x37')];var _0xfb69f1;if(_0x511ec7>=_0x3166be){_0x511ec7=_0x3166be;_0xfb69f1=0xc8;}else{_0xfb69f1=0xce;}_0x52f486[_0x61da('0x32')](_0xfb69f1);return _0x52f486[_0x61da('0x39')]('Content-Range',_0x52d93d+'-'+_0x511ec7+'/'+_0x3166be)[_0x61da('0x34')](_0x591efe);}return null;};}function patchUpdates(_0x1c0ab4){return function(_0x2963a5){try{jsonpatch[_0x61da('0x3a')](_0x2963a5,_0x1c0ab4,!![]);}catch(_0x5cb24d){return BPromise[_0x61da('0x3b')](_0x5cb24d);}return _0x2963a5[_0x61da('0x3c')]();};}function saveUpdates(_0x4a3267,_0x23c225){return function(_0x5b4df3){if(_0x5b4df3){return _0x5b4df3['update'](_0x4a3267)['then'](function(_0x5d5203){return _0x5d5203;});}return null;};}function removeEntity(_0x4a74c0,_0x456f83){return function(_0x423c85){if(_0x423c85){return _0x423c85[_0x61da('0x3d')]()[_0x61da('0x3e')](function(){var _0x771641=_0x423c85['get']({'plain':!![]});var _0x256fd0=_0x61da('0x3f');return db[_0x61da('0x40')]['destroy']({'where':{'type':_0x256fd0,'resourceId':_0x771641['id']}})[_0x61da('0x3e')](function(){return _0x423c85;});})[_0x61da('0x3e')](function(){_0x4a74c0[_0x61da('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fe54,_0x3e381b){return function(_0x168f4b){if(!_0x168f4b){_0x36fe54[_0x61da('0x31')](0x194);}return _0x168f4b;};}function handleError(_0x2d6918,_0x4b49e7){_0x4b49e7=_0x4b49e7||0x1f4;return function(_0x71c945){logger[_0x61da('0x2c')](_0x71c945[_0x61da('0x41')]);if(_0x71c945[_0x61da('0x42')]){delete _0x71c945[_0x61da('0x42')];}_0x2d6918['status'](_0x4b49e7)['send'](_0x71c945);};}exports['index']=function(_0x2deb98,_0x278732){var _0x22f01e={'include':[{'model':db[_0x61da('0x43')],'as':_0x61da('0x44')}]},_0x2e57df={},_0xb0edad={'count':0x0,'rows':[]};var _0x522aeb=_[_0x61da('0x45')](db[_0x61da('0x46')]['rawAttributes'],function(_0xf24ef6){return{'name':_0xf24ef6[_0x61da('0x47')],'type':_0xf24ef6[_0x61da('0x48')]['key']};});_0x2e57df[_0x61da('0x49')]=_['map'](_0x522aeb,_0x61da('0x42'));_0x2e57df[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0x2deb98[_0x61da('0x4a')]);_0x2e57df['filters']=_[_0x61da('0x4c')](_0x2e57df[_0x61da('0x49')],_0x2e57df[_0x61da('0x4a')]);_0x22f01e[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x2e57df[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x2deb98[_0x61da('0x4a')][_0x61da('0x4e')]));_0x22f01e[_0x61da('0x4d')]=_0x22f01e['attributes'][_0x61da('0x4f')]?_0x22f01e[_0x61da('0x4d')]:_0x2e57df[_0x61da('0x49')];if(!_0x2deb98[_0x61da('0x4a')][_0x61da('0x50')](_0x61da('0x51'))){_0x22f01e[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x2deb98['query']['limit']);_0x22f01e[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x2deb98[_0x61da('0x4a')][_0x61da('0x35')]);}_0x22f01e[_0x61da('0x52')]=qs['sort'](_0x2deb98[_0x61da('0x4a')][_0x61da('0x53')]);_0x22f01e[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0x2deb98[_0x61da('0x4a')],_0x2e57df[_0x61da('0x55')]),_0x522aeb);if(_0x2deb98[_0x61da('0x4a')][_0x61da('0x57')]){_0x22f01e['where']=_[_0x61da('0x58')](_0x22f01e[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x522aeb,function(_0x14f21c){if(_0x14f21c['type']!==_0x61da('0x59')){var _0x1dbd9e={};_0x1dbd9e[_0x14f21c[_0x61da('0x42')]]={'$like':'%'+_0x2deb98[_0x61da('0x4a')][_0x61da('0x57')]+'%'};return _0x1dbd9e;}})});}_0x22f01e=_['merge']({},_0x22f01e,_0x2deb98[_0x61da('0x5a')]);var _0x5b3dee={'where':_0x22f01e[_0x61da('0x54')]};return db[_0x61da('0x46')][_0x61da('0x38')](_0x5b3dee)['then'](function(_0x1a7f4f){_0xb0edad[_0x61da('0x38')]=_0x1a7f4f;if(_0x2deb98[_0x61da('0x4a')]['includeAll']){_0x22f01e[_0x61da('0x5b')]=[{'all':!![]}];}return db[_0x61da('0x46')][_0x61da('0x5c')](_0x22f01e);})[_0x61da('0x3e')](function(_0x4dd6fb){_0xb0edad[_0x61da('0x5d')]=_0x4dd6fb;return _0xb0edad;})['then'](respondWithFilteredResult(_0x278732,_0x22f01e))[_0x61da('0x30')](handleError(_0x278732,null));};exports['show']=function(_0x45f710,_0x45e1fc){var _0x388aa7={'raw':![],'where':{'id':_0x45f710['params']['id']},'include':[{'model':db[_0x61da('0x43')],'as':_0x61da('0x44')}]},_0x14313e={};_0x14313e[_0x61da('0x49')]=_[_0x61da('0x4b')](db[_0x61da('0x46')][_0x61da('0x5e')]);_0x14313e[_0x61da('0x4a')]=_['keys'](_0x45f710['query']);_0x14313e['filters']=_[_0x61da('0x4c')](_0x14313e[_0x61da('0x49')],_0x14313e[_0x61da('0x4a')]);_0x388aa7['attributes']=_[_0x61da('0x4c')](_0x14313e[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x45f710[_0x61da('0x4a')][_0x61da('0x4e')]));_0x388aa7[_0x61da('0x4d')]=_0x388aa7[_0x61da('0x4d')]['length']?_0x388aa7['attributes']:_0x14313e[_0x61da('0x49')];if(_0x45f710[_0x61da('0x4a')][_0x61da('0x5f')]){_0x388aa7[_0x61da('0x5b')]=[{'all':!![]}];}_0x388aa7=_[_0x61da('0x58')]({},_0x388aa7,_0x45f710[_0x61da('0x5a')]);return db[_0x61da('0x46')][_0x61da('0x60')](_0x388aa7)[_0x61da('0x3e')](handleEntityNotFound(_0x45e1fc,null))[_0x61da('0x3e')](respondWithResult(_0x45e1fc,null))[_0x61da('0x30')](handleError(_0x45e1fc,null));};exports['create']=function(_0x1848f2,_0x276167){return db['OpenchannelAccount'][_0x61da('0x61')](_0x1848f2[_0x61da('0x62')],{})[_0x61da('0x3e')](function(_0x4f5f9d){var _0x24c8cd=_0x1848f2[_0x61da('0x63')]['get']({'plain':!![]});if(!_0x24c8cd)throw new Error(_0x61da('0x64'));if(_0x24c8cd[_0x61da('0x65')]===_0x61da('0x63')){var _0x3611cc=_0x4f5f9d[_0x61da('0x66')]({'plain':!![]});var _0x10a013=_0x61da('0x3f');return db[_0x61da('0x67')][_0x61da('0x60')]({'where':{'name':_0x10a013,'userProfileId':_0x24c8cd['userProfileId']},'raw':!![]})['then'](function(_0x2810b2){if(_0x2810b2&&_0x2810b2['autoAssociation']===0x0){return db[_0x61da('0x40')][_0x61da('0x61')]({'name':_0x3611cc[_0x61da('0x42')],'resourceId':_0x3611cc['id'],'type':_0x2810b2['name'],'sectionId':_0x2810b2['id']},{})['then'](function(){return _0x4f5f9d;});}else{return _0x4f5f9d;}})[_0x61da('0x30')](function(_0xed1c26){logger['error'](_0x61da('0x68'),_0xed1c26);throw _0xed1c26;});}return _0x4f5f9d;})[_0x61da('0x3e')](respondWithResult(_0x276167,0xc9))[_0x61da('0x30')](handleError(_0x276167,null));};exports[_0x61da('0x69')]=function(_0x15a783,_0x2bfbb8){if(_0x15a783[_0x61da('0x62')]['id']){delete _0x15a783[_0x61da('0x62')]['id'];}return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x15a783[_0x61da('0x6a')]['id']},'include':[{'model':db['Pause'],'as':_0x61da('0x44')}]})['then'](handleEntityNotFound(_0x2bfbb8,null))[_0x61da('0x3e')](saveUpdates(_0x15a783[_0x61da('0x62')],null))[_0x61da('0x3e')](respondWithResult(_0x2bfbb8,null))[_0x61da('0x30')](handleError(_0x2bfbb8,null));};exports[_0x61da('0x3d')]=function(_0x33db23,_0x15b8eb){return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x33db23[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x15b8eb,null))[_0x61da('0x3e')](removeEntity(_0x15b8eb,null))[_0x61da('0x30')](handleError(_0x15b8eb,null));};exports['describe']=function(_0x4defc7,_0x39f994){return db[_0x61da('0x46')][_0x61da('0x6b')]()[_0x61da('0x3e')](respondWithResult(_0x39f994,null))[_0x61da('0x30')](handleError(_0x39f994,null));};exports[_0x61da('0x6c')]=function(_0x5a4c25,_0x5d48e4,_0x1da2c7){if(_0x5a4c25[_0x61da('0x62')]['id']){delete _0x5a4c25[_0x61da('0x62')]['id'];}return db[_0x61da('0x46')]['find']({'where':{'id':_0x5a4c25[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5d48e4,null))[_0x61da('0x3e')](function(_0x5517d4){if(_0x5517d4){_0x5a4c25['body'][_0x61da('0x6d')]=_0x5517d4['id'];return db['Disposition'][_0x61da('0x61')](_0x5a4c25['body']);}})[_0x61da('0x3e')](respondWithResult(_0x5d48e4,null))['catch'](handleError(_0x5d48e4,null));};exports['getDispositions']=function(_0x5ec656,_0x46433,_0x2a6640){var _0x53d832={'raw':![],'where':{}};var _0x1b9b76={};var _0x33db8d={'count':0x0,'rows':[]};return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x5ec656['params']['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x46433,null))[_0x61da('0x3e')](function(_0x1255b2){if(_0x1255b2){_0x1b9b76['model']=_[_0x61da('0x4b')](db[_0x61da('0x6f')]['rawAttributes']);_0x1b9b76[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0x5ec656['query']);_0x1b9b76[_0x61da('0x55')]=_[_0x61da('0x4c')](_0x1b9b76['model'],_0x1b9b76[_0x61da('0x4a')]);_0x53d832[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x1b9b76[_0x61da('0x49')],qs['fields'](_0x5ec656[_0x61da('0x4a')][_0x61da('0x4e')]));_0x53d832['attributes']=_0x53d832[_0x61da('0x4d')][_0x61da('0x4f')]?_0x53d832[_0x61da('0x4d')]:_0x1b9b76['model'];if(!_0x5ec656[_0x61da('0x4a')]['hasOwnProperty'](_0x61da('0x51'))){_0x53d832[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x5ec656['query'][_0x61da('0x37')]);_0x53d832[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x5ec656[_0x61da('0x4a')][_0x61da('0x35')]);}_0x53d832['order']=qs[_0x61da('0x53')](_0x5ec656['query']['sort']);_0x53d832[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0x5ec656['query'],_0x1b9b76['filters']));_0x53d832[_0x61da('0x54')][_0x61da('0x6d')]=_0x1255b2['id'];if(_0x5ec656[_0x61da('0x4a')]['filter']){_0x53d832[_0x61da('0x54')]=_[_0x61da('0x58')](_0x53d832[_0x61da('0x54')],{'$or':_['map'](_0x53d832[_0x61da('0x4d')],function(_0x348299){var _0x38dfe3={};_0x38dfe3[_0x348299]={'$like':'%'+_0x5ec656[_0x61da('0x4a')][_0x61da('0x57')]+'%'};return _0x38dfe3;})});}_0x53d832=_['merge']({},_0x53d832,_0x5ec656['options']);return db[_0x61da('0x6f')][_0x61da('0x38')]({'where':_0x53d832[_0x61da('0x54')]})[_0x61da('0x3e')](function(_0xef593b){_0x33db8d[_0x61da('0x38')]=_0xef593b;if(_0x5ec656[_0x61da('0x4a')][_0x61da('0x5f')]){_0x53d832[_0x61da('0x5b')]=[{'all':!![]}];}return db[_0x61da('0x6f')][_0x61da('0x5c')](_0x53d832);})[_0x61da('0x3e')](function(_0x1c8d5f){_0x33db8d[_0x61da('0x5d')]=_0x1c8d5f;return _0x33db8d;});}})[_0x61da('0x3e')](respondWithFilteredResult(_0x46433,_0x53d832))[_0x61da('0x30')](handleError(_0x46433,null));};exports[_0x61da('0x70')]=function(_0x3adbb4,_0xc85dea,_0x5875d6){return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x3adbb4['params']['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0xc85dea,null))[_0x61da('0x3e')](function(_0x47a517){if(_0x47a517){return _0x47a517[_0x61da('0x70')](_0x3adbb4[_0x61da('0x4a')][_0x61da('0x71')]);}})[_0x61da('0x3e')](respondWithStatusCode(_0xc85dea,null))[_0x61da('0x30')](handleError(_0xc85dea,null));};exports['addAnswer']=function(_0x56710f,_0x5582fb,_0x25c284){if(_0x56710f[_0x61da('0x62')]['id']){delete _0x56710f['body']['id'];}return db[_0x61da('0x46')]['find']({'where':{'id':_0x56710f[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5582fb,null))[_0x61da('0x3e')](function(_0x4e9e19){if(_0x4e9e19){_0x56710f[_0x61da('0x62')][_0x61da('0x6d')]=_0x4e9e19['id'];return db[_0x61da('0x72')]['create'](_0x56710f[_0x61da('0x62')]);}})[_0x61da('0x3e')](respondWithResult(_0x5582fb,null))[_0x61da('0x30')](handleError(_0x5582fb,null));};exports[_0x61da('0x73')]=function(_0x57ca1a,_0x2f5f65,_0x112823){var _0x15213c={'raw':![],'where':{}};var _0xbec4ba={};var _0x36d20e={'count':0x0,'rows':[]};return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x57ca1a[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x2f5f65,null))[_0x61da('0x3e')](function(_0x1a1fac){if(_0x1a1fac){_0xbec4ba['model']=_[_0x61da('0x4b')](db[_0x61da('0x72')][_0x61da('0x5e')]);_0xbec4ba[_0x61da('0x4a')]=_['keys'](_0x57ca1a[_0x61da('0x4a')]);_0xbec4ba[_0x61da('0x55')]=_[_0x61da('0x4c')](_0xbec4ba[_0x61da('0x49')],_0xbec4ba[_0x61da('0x4a')]);_0x15213c['attributes']=_[_0x61da('0x4c')](_0xbec4ba[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x57ca1a[_0x61da('0x4a')][_0x61da('0x4e')]));_0x15213c[_0x61da('0x4d')]=_0x15213c[_0x61da('0x4d')][_0x61da('0x4f')]?_0x15213c[_0x61da('0x4d')]:_0xbec4ba['model'];if(!_0x57ca1a[_0x61da('0x4a')][_0x61da('0x50')]('nolimit')){_0x15213c[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x57ca1a['query']['limit']);_0x15213c[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x57ca1a['query'][_0x61da('0x35')]);}_0x15213c[_0x61da('0x52')]=qs['sort'](_0x57ca1a[_0x61da('0x4a')]['sort']);_0x15213c[_0x61da('0x54')]=qs[_0x61da('0x55')](_['pick'](_0x57ca1a[_0x61da('0x4a')],_0xbec4ba[_0x61da('0x55')]));_0x15213c[_0x61da('0x54')][_0x61da('0x6d')]=_0x1a1fac['id'];if(_0x57ca1a[_0x61da('0x4a')]['filter']){_0x15213c[_0x61da('0x54')]=_[_0x61da('0x58')](_0x15213c[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x15213c[_0x61da('0x4d')],function(_0x47cfa4){var _0x5245d6={};_0x5245d6[_0x47cfa4]={'$like':'%'+_0x57ca1a[_0x61da('0x4a')]['filter']+'%'};return _0x5245d6;})});}_0x15213c=_[_0x61da('0x58')]({},_0x15213c,_0x57ca1a[_0x61da('0x5a')]);return db[_0x61da('0x72')][_0x61da('0x38')]({'where':_0x15213c[_0x61da('0x54')]})[_0x61da('0x3e')](function(_0x19752e){_0x36d20e[_0x61da('0x38')]=_0x19752e;if(_0x57ca1a[_0x61da('0x4a')][_0x61da('0x5f')]){_0x15213c[_0x61da('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x61da('0x5c')](_0x15213c);})[_0x61da('0x3e')](function(_0x2b3ca8){_0x36d20e[_0x61da('0x5d')]=_0x2b3ca8;return _0x36d20e;});}})[_0x61da('0x3e')](respondWithFilteredResult(_0x2f5f65,_0x15213c))[_0x61da('0x30')](handleError(_0x2f5f65,null));};exports[_0x61da('0x74')]=function(_0x3b8bb7,_0x4f9606,_0x1b3c06){return db['OpenchannelAccount'][_0x61da('0x60')]({'where':{'id':_0x3b8bb7[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x4f9606,null))[_0x61da('0x3e')](function(_0x4be6db){if(_0x4be6db){return _0x4be6db['removeAnswers'](_0x3b8bb7[_0x61da('0x4a')][_0x61da('0x71')]);}})['then'](respondWithStatusCode(_0x4f9606,null))[_0x61da('0x30')](handleError(_0x4f9606,null));};exports[_0x61da('0x75')]=function(_0x229e78,_0x5a97b0,_0x43b64d){var _0x4d929c={'body':_0x229e78[_0x61da('0x62')],'channel':_0x61da('0x76')};var _0x43767c=[];var _0x4e2f9b=[];var _0x41531a={};var _0x4820b5=![];return db['CmContact'][_0x61da('0x6b')]()[_0x61da('0x3e')](function(_0x328748){if(!_0x328748){throw new db['Sequelize'][(_0x61da('0x77'))](_0x61da('0x78'));}_0x43767c=_[_0x61da('0x79')](_[_0x61da('0x4b')](_0x328748),['createdAt',_0x61da('0x7a')]);_0x4e2f9b=_[_0x61da('0x79')](_[_0x61da('0x4b')](_0x328748),['createdAt','updatedAt',_0x61da('0x7b'),_0x61da('0x7c')]);if(_0x229e78[_0x61da('0x62')]['id']){delete _0x229e78[_0x61da('0x62')]['id'];}if(_[_0x61da('0x7d')](_0x229e78[_0x61da('0x62')]['from'])){throw new db[(_0x61da('0x7e'))]['ValidationError'](_0x61da('0x7f'));}if(_[_0x61da('0x7d')](_0x229e78[_0x61da('0x62')][_0x61da('0x62')])||_0x229e78[_0x61da('0x62')][_0x61da('0x62')]===''){throw new db[(_0x61da('0x7e'))][(_0x61da('0x77'))](_0x61da('0x80'));}if(_[_0x61da('0x7d')](_0x229e78[_0x61da('0x62')]['mapKey'])){throw new db[(_0x61da('0x7e'))][(_0x61da('0x77'))](_0x61da('0x81')+_0x4e2f9b);}if(!_[_0x61da('0x82')](_0x4e2f9b,_0x229e78[_0x61da('0x62')]['mapKey'])){throw new db[(_0x61da('0x7e'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e2f9b);}_0x41531a[_0x229e78['body']['mapKey']]=_0x229e78['body']['from'];})[_0x61da('0x3e')](function(){return db[_0x61da('0x46')][_0x61da('0x60')]({'where':{'id':_0x229e78['params']['id']},'include':[{'model':db['CmList'],'as':_0x61da('0x83'),'include':[{'model':db[_0x61da('0x84')],'as':'Contacts','where':_0x41531a,'limit':0x1,'order':[[_0x61da('0x7a'),_0x61da('0x85')]]}]},{'model':db[_0x61da('0x86')],'as':_0x61da('0x87')}]});})[_0x61da('0x3e')](handleEntityNotFound(_0x5a97b0,null))[_0x61da('0x3e')](function(_0x3f6dd8){if(_0x3f6dd8&&_0x3f6dd8[_0x61da('0x83')]){_0x4d929c['account']=_0x3f6dd8;_0x4d929c['applications']=_0x3f6dd8[_0x61da('0x87')];_0x4d929c[_0x61da('0x88')]=_0x3f6dd8[_0x61da('0x83')];_0x4d929c['applications']=_[_0x61da('0x89')](_0x4d929c[_0x61da('0x8a')],[_0x61da('0x8b')],['asc']);if(_0x4d929c[_0x61da('0x8c')][_0x61da('0x87')]){delete _0x4d929c[_0x61da('0x8c')][_0x61da('0x87')];}if(_0x4d929c['account'][_0x61da('0x83')]&&_0x4d929c[_0x61da('0x8c')][_0x61da('0x83')][_0x61da('0x8d')][_0x61da('0x4f')]){return _0x4d929c['account'][_0x61da('0x83')][_0x61da('0x8d')][0x0];}var _0x33ca12=_['defaults'](_0x229e78[_0x61da('0x62')],{'firstName':_0x229e78['body'][_0x61da('0x8e')],'ListId':_0x3f6dd8[_0x61da('0x7c')]});_0x33ca12[_0x229e78['body'][_0x61da('0x8f')]]=_0x229e78[_0x61da('0x62')]['from'];return db[_0x61da('0x84')][_0x61da('0x61')](_0x33ca12,{'fields':_0x43767c,'raw':!![]});}})['then'](handleEntityNotFound(_0x5a97b0,null))['then'](function(_0x4beba3){_0x4d929c[_0x61da('0x90')]=_0x4beba3;if(_0x4beba3){var _0x52f54f={'ContactId':_0x4beba3['id'],'OpenchannelAccountId':_0x229e78[_0x61da('0x6a')]['id'],'from':(_0x4beba3[_0x61da('0x91')]||'')+'\x20'+(_0x4beba3['lastName']||'')};var _0x183e52={'OpenchannelAccountId':_0x229e78[_0x61da('0x6a')]['id'],'closed':![]};if(_0x229e78[_0x61da('0x62')]['threadId']){_0x183e52['threadId']=_0x229e78[_0x61da('0x62')][_0x61da('0x92')];return db[_0x61da('0x93')][_0x61da('0x60')]({'where':_0x183e52})[_0x61da('0x3e')](function(_0x4ec65f){if(_0x4ec65f){return[_0x4ec65f,![]];}_0x52f54f[_0x61da('0x92')]=_0x229e78['body'][_0x61da('0x92')];_0x52f54f[_0x61da('0x94')]=_0x229e78['body']['externalUrl'];return db[_0x61da('0x93')][_0x61da('0x61')](_0x52f54f)[_0x61da('0x3e')](function(_0x55d738){return[_0x55d738,!![]];});});}else{_0x183e52[_0x61da('0x92')]=null;}_0x183e52['ContactId']=_0x4beba3['id'];return db[_0x61da('0x93')]['find']({'where':_0x183e52})['then'](function(_0x8933ef){if(_0x8933ef){return[_0x8933ef,![]];}return db[_0x61da('0x93')][_0x61da('0x61')](_0x52f54f)['then'](function(_0x2fa413){return[_0x2fa413,!![]];});});}})['spread'](function(_0x557459,_0x253a0f){if(_0x557459){_0x4820b5=_0x253a0f;if(!_0x253a0f){var _0xe03c7f={'from':(_0x4d929c['contact'][_0x61da('0x91')]||'')+'\x20'+(_0x4d929c[_0x61da('0x90')][_0x61da('0x95')]||'')};if(_0x229e78[_0x61da('0x62')][_0x61da('0x92')]&&_0x229e78[_0x61da('0x62')][_0x61da('0x96')]&&_0x229e78[_0x61da('0x62')][_0x61da('0x92')]!=_0x229e78[_0x61da('0x62')][_0x61da('0x96')]){_0xe03c7f['threadId']=_0x229e78[_0x61da('0x62')]['messageId'];}return _0x557459['update'](_0xe03c7f);}else{return _0x557459;}}})[_0x61da('0x3e')](function(_0x55ca3d){_0x4d929c['interaction']=_0x55ca3d[_0x61da('0x66')]({'plain':!![]});_0x4d929c['interaction']['created']=_0x4820b5;if(_0x4d929c[_0x61da('0x97')][_0x61da('0x98')]){if(_0x4d929c[_0x61da('0x8c')][_0x61da('0x99')]){_0x4d929c[_0x61da('0x8a')][_0x61da('0x9a')]({'id':0x0,'priority':_0x4d929c['applications'][_0x61da('0x4f')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x229e78[_0x61da('0x62')]['body'],'OpenchannelAccountId':_0x229e78[_0x61da('0x6a')]['id'],'OpenchannelInteractionId':_0x55ca3d['id'],'direction':'in','ContactId':_0x4d929c['contact']['id'],'AttachmentId':_0x229e78[_0x61da('0x62')][_0x61da('0x9b')]});})[_0x61da('0x3e')](function(_0x5ad1e3){_0x4d929c['message']=_0x5ad1e3;if(_0x4d929c[_0x61da('0x97')]['UserId']){return db[_0x61da('0x9c')][_0x61da('0x60')]({'attributes':['id','name'],'where':{'id':_0x4d929c[_0x61da('0x97')][_0x61da('0x9d')]}})[_0x61da('0x3e')](function(_0x16e2b9){if(_0x16e2b9){_0x4d929c[_0x61da('0x8a')][_0x61da('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x16e2b9[_0x61da('0x42')]+','+(_0x4d929c['account'][_0x61da('0x9f')]||0xa),'interval':_0x61da('0xa0')});_0x4d929c['forcedOwnership']=![];}return respondWithRpcPromise(_0x61da('0xa1'),_0x61da('0xa2'),_0x4d929c);});}return respondWithRpcPromise('Start',_0x61da('0xa2'),_0x4d929c);})['then'](function(_0x1f3321){respondWithRpcPromise('EventManager',_0x61da('0xa3'),{'event':_0x61da('0x75'),'message':_0x1f3321},client9002);return _0x1f3321;})[_0x61da('0x3e')](respondWithResult(_0x5a97b0,null))[_0x61da('0x30')](handleError(_0x5a97b0,null));};exports[_0x61da('0xa4')]=function(_0x43dfec,_0x1fdb21){var _0x3d6f81=_0x43dfec['params']['id'];var _0x532038=_0x43dfec[_0x61da('0x62')];var _0x45ed96=0xc8;var _0xd1fb7f=null;return db[_0x61da('0xa5')][_0x61da('0xa6')]({'isolationLevel':db[_0x61da('0xa5')][_0x61da('0xa7')][_0x61da('0xa8')][_0x61da('0xa9')]},function(_0x4668c3){return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x3d6f81},'transaction':_0x4668c3})[_0x61da('0x3e')](function(_0x57938d){if(_0x57938d){return db[_0x61da('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0x3d6f81},'transaction':_0x4668c3})['then'](function(){var _0x1fe80f=_['map'](_0x532038,function(_0x255730){_0x255730[_0x61da('0x6d')]=_0x3d6f81;return _0x255730;});return db['OpenchannelApplication'][_0x61da('0xaa')](_0x1fe80f,{'transaction':_0x4668c3});});}else{_0x45ed96=0x194;_0xd1fb7f=[];}});})['then'](function(){if(_0x45ed96!==0x194){return db['OpenchannelApplication'][_0x61da('0xab')]({'where':{'OpenchannelAccountId':_0x3d6f81},'order':'priority'})['then'](function(_0x34bf61){_0xd1fb7f=_0x34bf61;});}})[_0x61da('0x30')](function(_0x5abbe6){_0x45ed96=0x1f4;logger['error'](_0x5abbe6[_0x61da('0x41')]);if(_0x5abbe6['name']){delete _0x5abbe6[_0x61da('0x42')];}_0xd1fb7f=_0x5abbe6;})[_0x61da('0xac')](function(){if(_0xd1fb7f===null){_0x1fdb21[_0x61da('0x31')](_0x45ed96);}else{if(_0x45ed96===0x1f4){_0x1fdb21[_0x61da('0x32')](_0x45ed96)[_0x61da('0xad')](_0xd1fb7f);}else{_0x1fdb21[_0x61da('0x32')](_0x45ed96)[_0x61da('0x34')](_0xd1fb7f);}}});};exports[_0x61da('0xae')]=function(_0xf21843,_0x241d9a,_0x1239c8){var _0x484313={};var _0x460bc7={};var _0x3825a3;var _0x1b5303;return db['OpenchannelAccount'][_0x61da('0x6e')]({'where':{'id':_0xf21843[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x241d9a,null))[_0x61da('0x3e')](function(_0x12097b){if(_0x12097b){_0x3825a3=_0x12097b;_0x460bc7[_0x61da('0x49')]=_[_0x61da('0x4b')](db[_0x61da('0x86')][_0x61da('0x5e')]);_0x460bc7[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0xf21843['query']);_0x460bc7[_0x61da('0x55')]=_[_0x61da('0x4c')](_0x460bc7[_0x61da('0x49')],_0x460bc7['query']);_0x484313[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x460bc7[_0x61da('0x49')],qs[_0x61da('0x4e')](_0xf21843['query']['fields']));_0x484313['attributes']=_0x484313[_0x61da('0x4d')][_0x61da('0x4f')]?_0x484313[_0x61da('0x4d')]:_0x460bc7[_0x61da('0x49')];_0x484313[_0x61da('0x52')]=qs[_0x61da('0x53')](_0xf21843[_0x61da('0x4a')][_0x61da('0x53')]);_0x484313[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0xf21843[_0x61da('0x4a')],_0x460bc7[_0x61da('0x55')]));if(_0xf21843[_0x61da('0x4a')]['filter']){_0x484313[_0x61da('0x54')]=_['merge'](_0x484313[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x484313[_0x61da('0x4d')],function(_0x375a72){var _0x142bd8={};_0x142bd8[_0x375a72]={'$like':'%'+_0xf21843['query']['filter']+'%'};return _0x142bd8;})});}_0x484313=_['merge']({},_0x484313,_0xf21843['options']);return _0x3825a3[_0x61da('0xae')](_0x484313);}})['then'](function(_0x408757){if(_0x408757){_0x1b5303=_0x408757[_0x61da('0x4f')];if(!_0xf21843[_0x61da('0x4a')]['hasOwnProperty'](_0x61da('0x51'))){_0x484313['limit']=qs['limit'](_0xf21843[_0x61da('0x4a')]['limit']);_0x484313[_0x61da('0x35')]=qs[_0x61da('0x35')](_0xf21843[_0x61da('0x4a')]['offset']);}return _0x3825a3[_0x61da('0xae')](_0x484313);}})[_0x61da('0x3e')](function(_0x28030f){if(_0x28030f){return _0x28030f?{'count':_0x1b5303,'rows':_0x28030f}:null;}})[_0x61da('0x3e')](respondWithResult(_0x241d9a,null))[_0x61da('0x30')](handleError(_0x241d9a,null));};exports[_0x61da('0xaf')]=function(_0x3eb2df,_0x78cf6,_0x5cc28d){var _0x3da12d={'raw':![],'where':{}};var _0x2f09d5={};var _0x37d3f3={'count':0x0,'rows':[]};return db[_0x61da('0x46')]['findOne']({'where':{'id':_0x3eb2df[_0x61da('0x6a')]['id']}})['then'](handleEntityNotFound(_0x78cf6,null))['then'](function(_0x3fc7b1){if(_0x3fc7b1){_0x2f09d5['model']=_[_0x61da('0x4b')](db[_0x61da('0x93')][_0x61da('0x5e')]);_0x2f09d5[_0x61da('0x4a')]=_[_0x61da('0x4b')](_0x3eb2df[_0x61da('0x4a')]);_0x2f09d5['filters']=_[_0x61da('0x4c')](_0x2f09d5[_0x61da('0x49')],_0x2f09d5['query']);_0x3da12d[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x2f09d5['model'],qs[_0x61da('0x4e')](_0x3eb2df[_0x61da('0x4a')][_0x61da('0x4e')]));_0x3da12d['attributes']=_0x3da12d[_0x61da('0x4d')][_0x61da('0x4f')]?_0x3da12d[_0x61da('0x4d')]:_0x2f09d5[_0x61da('0x49')];if(!_0x3eb2df[_0x61da('0x4a')]['hasOwnProperty'](_0x61da('0x51'))){_0x3da12d[_0x61da('0x37')]=qs[_0x61da('0x37')](_0x3eb2df[_0x61da('0x4a')][_0x61da('0x37')]);_0x3da12d[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x3eb2df[_0x61da('0x4a')]['offset']);}_0x3da12d[_0x61da('0x52')]=qs[_0x61da('0x53')](_0x3eb2df['query'][_0x61da('0x53')]);_0x3da12d[_0x61da('0x54')]=qs[_0x61da('0x55')](_[_0x61da('0x56')](_0x3eb2df[_0x61da('0x4a')],_0x2f09d5[_0x61da('0x55')]));_0x3da12d[_0x61da('0x54')][_0x61da('0x6d')]=_0x3fc7b1['id'];if(_0x3eb2df[_0x61da('0x4a')][_0x61da('0x57')]){_0x3da12d[_0x61da('0x54')]=_[_0x61da('0x58')](_0x3da12d[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x3da12d[_0x61da('0x4d')],function(_0x526091){var _0xbe9422={};_0xbe9422[_0x526091]={'$like':'%'+_0x3eb2df['query'][_0x61da('0x57')]+'%'};return _0xbe9422;})});}_0x3da12d=_['merge']({},_0x3da12d,_0x3eb2df['options']);return db[_0x61da('0x93')][_0x61da('0x38')]({'where':_0x3da12d[_0x61da('0x54')]})[_0x61da('0x3e')](function(_0x59f683){_0x37d3f3['count']=_0x59f683;if(_0x3eb2df['query'][_0x61da('0x5f')]){_0x3da12d[_0x61da('0x5b')]=[{'model':db[_0x61da('0x84')],'as':'Contact','required':![]},{'model':db[_0x61da('0x9c')],'as':'Owner','attributes':[_0x61da('0x42'),'fullname','internal'],'required':![]},{'model':db[_0x61da('0xb0')],'as':_0x61da('0xb1'),'attributes':['id',_0x61da('0x42'),'color'],'where':_0x3eb2df[_0x61da('0x4a')][_0x61da('0xb2')]?{'id':_0x3eb2df[_0x61da('0x4a')]['tag']}:undefined,'required':_0x3eb2df['query'][_0x61da('0xb2')]?!![]:![]}];}return db[_0x61da('0x93')]['findAll'](_0x3da12d);})[_0x61da('0x3e')](function(_0x5138f5){_0x37d3f3[_0x61da('0x5d')]=_0x5138f5;return _0x37d3f3;});}})[_0x61da('0x3e')](respondWithFilteredResult(_0x78cf6,_0x3da12d))[_0x61da('0x30')](handleError(_0x78cf6,null));};exports[_0x61da('0xb3')]=function(_0x5a865a,_0x21b4e1,_0x58ca09){return db['OpenchannelAccount'][_0x61da('0x60')]({'where':{'id':_0x5a865a[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x21b4e1,null))[_0x61da('0x3e')](function(_0xd19c25){if(_0xd19c25){return _0xd19c25[_0x61da('0xb3')](_0x5a865a['body']['ids'],_[_0x61da('0xb4')](_0x5a865a[_0x61da('0x62')],['ids','id'])||{})['spread'](function(_0x11414b){for(var _0x2bbaa5=0x0;_0x2bbaa5<_0x5a865a[_0x61da('0x62')][_0x61da('0x71')][_0x61da('0x4f')];_0x2bbaa5+=0x1){socket[_0x61da('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x5a865a[_0x61da('0x62')][_0x61da('0x71')][_0x2bbaa5]),'OpenchannelAccountId':Number(_0x5a865a[_0x61da('0x6a')]['id'])});}return _0x11414b;});}})['then'](respondWithResult(_0x21b4e1,null))[_0x61da('0x30')](handleError(_0x21b4e1,null));};exports[_0x61da('0xb6')]=function(_0x495286,_0x2d7247,_0x3320c6){return db[_0x61da('0x46')]['find']({'where':{'id':_0x495286['params']['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x2d7247,null))[_0x61da('0x3e')](function(_0x8a904c){if(_0x8a904c){return _0x8a904c[_0x61da('0xb6')](_0x495286[_0x61da('0x4a')][_0x61da('0x71')])[_0x61da('0x3e')](function(){if(_['isArray'](_0x495286[_0x61da('0x4a')][_0x61da('0x71')])){for(var _0x4ec5a4=0x0;_0x4ec5a4<_0x495286['query'][_0x61da('0x71')][_0x61da('0x4f')];_0x4ec5a4+=0x1){socket[_0x61da('0xb5')](_0x61da('0xb7'),{'UserId':Number(_0x495286['query'][_0x61da('0x71')][_0x4ec5a4]),'OpenchannelAccountId':Number(_0x495286[_0x61da('0x6a')]['id'])});}}else{socket[_0x61da('0xb5')](_0x61da('0xb7'),{'UserId':Number(_0x495286[_0x61da('0x4a')][_0x61da('0x71')]),'OpenchannelAccountId':Number(_0x495286[_0x61da('0x6a')]['id'])});}});}})[_0x61da('0x3e')](respondWithStatusCode(_0x2d7247,null))[_0x61da('0x30')](handleError(_0x2d7247,null));};exports[_0x61da('0xb8')]=function(_0x7a7940,_0x4f5638,_0x56856d){var _0x4f50b0={};var _0x230f03={};var _0x14c7bd;var _0x2c77ab;return db[_0x61da('0x46')][_0x61da('0x6e')]({'where':{'id':_0x7a7940[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x4f5638,null))['then'](function(_0x16a8bc){if(_0x16a8bc){_0x14c7bd=_0x16a8bc;_0x230f03[_0x61da('0x49')]=_[_0x61da('0x4b')](db['User'][_0x61da('0x5e')]);_0x230f03[_0x61da('0x4a')]=_['keys'](_0x7a7940[_0x61da('0x4a')]);_0x230f03[_0x61da('0x55')]=_[_0x61da('0x4c')](_0x230f03[_0x61da('0x49')],_0x230f03['query']);_0x4f50b0[_0x61da('0x4d')]=_[_0x61da('0x4c')](_0x230f03[_0x61da('0x49')],qs[_0x61da('0x4e')](_0x7a7940[_0x61da('0x4a')][_0x61da('0x4e')]));_0x4f50b0[_0x61da('0x4d')]=_0x4f50b0[_0x61da('0x4d')][_0x61da('0x4f')]?_0x4f50b0['attributes']:_0x230f03[_0x61da('0x49')];_0x4f50b0[_0x61da('0x52')]=qs[_0x61da('0x53')](_0x7a7940['query'][_0x61da('0x53')]);_0x4f50b0['where']=qs['filters'](_[_0x61da('0x56')](_0x7a7940[_0x61da('0x4a')],_0x230f03['filters']));if(_0x7a7940[_0x61da('0x4a')][_0x61da('0x57')]){_0x4f50b0[_0x61da('0x54')]=_['merge'](_0x4f50b0[_0x61da('0x54')],{'$or':_[_0x61da('0x45')](_0x4f50b0[_0x61da('0x4d')],function(_0x360525){var _0x293e2e={};_0x293e2e[_0x360525]={'$like':'%'+_0x7a7940[_0x61da('0x4a')][_0x61da('0x57')]+'%'};return _0x293e2e;})});}_0x4f50b0=_[_0x61da('0x58')]({},_0x4f50b0,_0x7a7940[_0x61da('0x5a')]);return _0x14c7bd[_0x61da('0xb8')](_0x4f50b0);}})['then'](function(_0x4108b9){if(_0x4108b9){_0x2c77ab=_0x4108b9['length'];if(!_0x7a7940[_0x61da('0x4a')][_0x61da('0x50')](_0x61da('0x51'))){_0x4f50b0['limit']=qs['limit'](_0x7a7940[_0x61da('0x4a')][_0x61da('0x37')]);_0x4f50b0[_0x61da('0x35')]=qs[_0x61da('0x35')](_0x7a7940[_0x61da('0x4a')][_0x61da('0x35')]);}return _0x14c7bd[_0x61da('0xb8')](_0x4f50b0);}})['then'](function(_0x221945){if(_0x221945){return _0x221945?{'count':_0x2c77ab,'rows':_0x221945}:null;}})['then'](respondWithResult(_0x4f5638,null))[_0x61da('0x30')](handleError(_0x4f5638,null));};exports[_0x61da('0xad')]=function(_0x35c056,_0x3fb1dc,_0x4b5782){var _0x2b0a97,_0x5effa3,_0x4e8018;if(_[_0x61da('0x7d')](_0x35c056['body'][_0x61da('0x62')])||_0x35c056[_0x61da('0x62')][_0x61da('0x62')]===''){throw new db[(_0x61da('0x7e'))][(_0x61da('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x61da('0x7d')](_0x35c056[_0x61da('0x62')]['to'])){}_0x2b0a97=_0x35c056[_0x61da('0x62')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x35c056[_0x61da('0x6a')]['id']}})[_0x61da('0x3e')](handleEntityNotFound(_0x3fb1dc,null))[_0x61da('0x3e')](function(_0x29c008){if(_0x29c008){return db['OpenchannelAccount'][_0x61da('0x60')]({'where':{'id':_0x29c008['id']},'include':[{'model':db[_0x61da('0xb9')],'as':'List','include':[{'model':db[_0x61da('0x84')],'as':'Contacts','where':{[_0x29c008[_0x61da('0x8f')]]:_0x2b0a97},'limit':0x1,'order':[['updatedAt',_0x61da('0x85')]]}]}]})[_0x61da('0x3e')](handleEntityNotFound(_0x3fb1dc,null))['then'](function(_0x50ab4a){if(_0x50ab4a&&_0x50ab4a['List']){_0x5effa3=_0x50ab4a[_0x61da('0x66')]({'plain':!![]});if(_0x5effa3[_0x61da('0x83')]&&_0x5effa3[_0x61da('0x83')][_0x61da('0x8d')][_0x61da('0x4f')]){return _0x5effa3[_0x61da('0x83')][_0x61da('0x8d')][0x0];}return db[_0x61da('0x84')][_0x61da('0x61')](_[_0x61da('0x20')](_0x35c056[_0x61da('0x62')],{'firstName':_0x2b0a97,[_0x50ab4a[_0x61da('0x8f')]]:_0x2b0a97,'phone':_0x2b0a97,'ListId':_0x5effa3[_0x61da('0x7c')]}));}})[_0x61da('0x3e')](handleEntityNotFound(_0x3fb1dc,null))[_0x61da('0x3e')](function(_0x2ebf79){if(_0x2ebf79){_0x4e8018=_0x2ebf79;return db[_0x61da('0x93')][_0x61da('0x60')]({'where':{'ContactId':_0x4e8018['id'],'closed':![],'OpenchannelAccountId':_0x5effa3['id']}})[_0x61da('0x3e')](function(_0x44acec){if(_0x44acec){return[_0x44acec,![]];}return db[_0x61da('0x93')][_0x61da('0x61')]({'UserId':_0x35c056[_0x61da('0x63')]['id'],'ContactId':_0x4e8018['id'],'OpenchannelAccountId':_0x5effa3['id'],'lastMsgDirection':_0x61da('0xba'),'firstMsgDirection':'out','Messages':[_[_0x61da('0x58')](_0x35c056['body'],{'read':![],'body':_0x35c056[_0x61da('0x62')][_0x61da('0x62')],'OpenchannelAccountId':_0x5effa3['id'],'UserId':_0x35c056[_0x61da('0x63')]['id'],'ContactId':_0x4e8018['id']})]},{'include':[{'model':db[_0x61da('0xbb')],'as':_0x61da('0xbc')}]})[_0x61da('0x3e')](function(_0x5138af){return[_0x5138af,!![]];});});}})['spread'](function(_0x5001ce,_0x10ddc4){if(_0x10ddc4){return _0x5001ce;}return db[_0x61da('0xbb')][_0x61da('0x61')](_[_0x61da('0x58')](_0x35c056[_0x61da('0x62')],{'read':![],'body':_0x35c056['body'][_0x61da('0x62')],'OpenchannelAccountId':_0x5effa3['id'],'OpenchannelInteractionId':_0x5001ce['id'],'UserId':_0x35c056[_0x61da('0x63')]['id'],'ContactId':_0x4e8018['id']}))['then'](function(_0x505347){_0x5001ce[_0x61da('0xbd')][_0x61da('0xbc')]=[];_0x5001ce[_0x61da('0xbd')][_0x61da('0xbc')][_0x61da('0x9a')](_0x505347[_0x61da('0xbd')]);return _0x5001ce;});});}})[_0x61da('0x3e')](respondWithResult(_0x3fb1dc,null))[_0x61da('0x30')](handleError(_0x3fb1dc,null));}; \ No newline at end of file +var _0x4abf=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','rows','show','fields','find','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','length','removeDispositions','addAnswer','CannedAnswer','nolimit','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','OpenchannelApplication','account','applications','list','List','orderBy','priority','asc','Applications','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x4abf,0xac));var _0xf4ab=function(_0x238e7c,_0x46ee86){_0x238e7c=_0x238e7c-0x0;var _0x128a39=_0x4abf[_0x238e7c];return _0x128a39;};'use strict';var emlformat=require(_0xf4ab('0x0'));var rimraf=require(_0xf4ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf4ab('0x3'));var util=require(_0xf4ab('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf4ab('0x5'));var ejs=require(_0xf4ab('0x6'));var fs=require('fs');var fs_extra=require(_0xf4ab('0x7'));var _=require(_0xf4ab('0x8'));var squel=require('squel');var crypto=require(_0xf4ab('0x9'));var jsforce=require(_0xf4ab('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ab('0x5'));var querystring=require('querystring');var Papa=require(_0xf4ab('0xb'));var Redis=require(_0xf4ab('0xc'));var authService=require(_0xf4ab('0xd'));var qs=require(_0xf4ab('0xe'));var as=require(_0xf4ab('0xf'));var hardwareService=require(_0xf4ab('0x10'));var logger=require(_0xf4ab('0x11'))(_0xf4ab('0x12'));var utils=require(_0xf4ab('0x13'));var config=require(_0xf4ab('0x14'));var licenseUtil=require(_0xf4ab('0x15'));var db=require(_0xf4ab('0x16'))['db'];config[_0xf4ab('0x17')]=_['defaults'](config['redis'],{'host':_0xf4ab('0x18'),'port':0x18eb});var socket=require(_0xf4ab('0x19'))(new Redis(config[_0xf4ab('0x17')]));require(_0xf4ab('0x1a'))[_0xf4ab('0x1b')](socket);var jayson=require(_0xf4ab('0x1c'));var client=jayson[_0xf4ab('0x1d')][_0xf4ab('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xf4ab('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1c5202,_0xc26111,_0x5d50cb,_0x1e1a02){return new BPromise(function(_0x21bdc0,_0x4b17e4){var _0x196ea7=_0x1e1a02||client;return _0x196ea7[_0xf4ab('0x1f')](_0x1c5202,_0x5d50cb)[_0xf4ab('0x20')](function(_0x2b8ac8){logger[_0xf4ab('0x21')](_0xf4ab('0x22'),_0xc26111,_0xf4ab('0x23'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xc26111,_0xf4ab('0x23'),JSON['stringify'](_0x2b8ac8));if(_0x2b8ac8[_0xf4ab('0x24')]){if(_0x2b8ac8[_0xf4ab('0x24')][_0xf4ab('0x25')]===0x1f4){logger['error'](_0xf4ab('0x22'),_0xc26111,_0x2b8ac8[_0xf4ab('0x24')][_0xf4ab('0x26')]);return _0x4b17e4(_0x2b8ac8[_0xf4ab('0x24')][_0xf4ab('0x26')]);}logger['error'](_0xf4ab('0x22'),_0xc26111,_0x2b8ac8[_0xf4ab('0x24')][_0xf4ab('0x26')]);return _0x21bdc0(_0x2b8ac8[_0xf4ab('0x24')][_0xf4ab('0x26')]);}else{logger[_0xf4ab('0x21')](_0xf4ab('0x22'),_0xc26111,'request\x20sent');_0x21bdc0(_0x2b8ac8[_0xf4ab('0x27')]['message']);}})[_0xf4ab('0x28')](function(_0x550e29){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xc26111,_0x550e29);_0x4b17e4(_0x550e29);});});}function respondWithStatusCode(_0x58015c,_0x5781da){_0x5781da=_0x5781da||0xcc;return function(_0x5641b8){if(_0x5641b8){return _0x58015c['sendStatus'](_0x5781da);}return _0x58015c[_0xf4ab('0x29')](_0x5781da)[_0xf4ab('0x2a')]();};}function respondWithResult(_0x1abd31,_0x425e4e){_0x425e4e=_0x425e4e||0xc8;return function(_0x1efb48){if(_0x1efb48){return _0x1abd31['status'](_0x425e4e)['json'](_0x1efb48);}};}function respondWithFilteredResult(_0x325b38,_0x3cf5b1){return function(_0x52f419){if(_0x52f419){var _0x46877c=typeof _0x3cf5b1['offset']===_0xf4ab('0x2b')&&typeof _0x3cf5b1[_0xf4ab('0x2c')]===_0xf4ab('0x2b');var _0x3d195b=_0x52f419[_0xf4ab('0x2d')];var _0x3dcc37=_0x46877c?0x0:_0x3cf5b1[_0xf4ab('0x2e')];var _0x25d68f=_0x46877c?_0x52f419[_0xf4ab('0x2d')]:_0x3cf5b1[_0xf4ab('0x2e')]+_0x3cf5b1[_0xf4ab('0x2c')];var _0x495612;if(_0x25d68f>=_0x3d195b){_0x25d68f=_0x3d195b;_0x495612=0xc8;}else{_0x495612=0xce;}_0x325b38[_0xf4ab('0x29')](_0x495612);return _0x325b38['set'](_0xf4ab('0x2f'),_0x3dcc37+'-'+_0x25d68f+'/'+_0x3d195b)[_0xf4ab('0x30')](_0x52f419);}return null;};}function patchUpdates(_0x4cad6b){return function(_0x526710){try{jsonpatch[_0xf4ab('0x31')](_0x526710,_0x4cad6b,!![]);}catch(_0x3e1bb5){return BPromise[_0xf4ab('0x32')](_0x3e1bb5);}return _0x526710[_0xf4ab('0x33')]();};}function saveUpdates(_0x26a58b,_0x5eb7e1){return function(_0x59663d){if(_0x59663d){return _0x59663d[_0xf4ab('0x34')](_0x26a58b)[_0xf4ab('0x20')](function(_0x29bd4c){return _0x29bd4c;});}return null;};}function removeEntity(_0x526c68,_0x1411ab){return function(_0x18cf46){if(_0x18cf46){return _0x18cf46[_0xf4ab('0x35')]()[_0xf4ab('0x20')](function(){var _0x37c30b=_0x18cf46[_0xf4ab('0x36')]({'plain':!![]});var _0x146df9=_0xf4ab('0x37');return db[_0xf4ab('0x38')][_0xf4ab('0x35')]({'where':{'type':_0x146df9,'resourceId':_0x37c30b['id']}})[_0xf4ab('0x20')](function(){return _0x18cf46;});})[_0xf4ab('0x20')](function(){_0x526c68['status'](0xcc)[_0xf4ab('0x2a')]();});}};}function handleEntityNotFound(_0x1c6afb,_0x7bf0fd){return function(_0x460637){if(!_0x460637){_0x1c6afb[_0xf4ab('0x39')](0x194);}return _0x460637;};}function handleError(_0x2ead81,_0x2dfd08){_0x2dfd08=_0x2dfd08||0x1f4;return function(_0x1b15aa){logger[_0xf4ab('0x24')](_0x1b15aa[_0xf4ab('0x3a')]);if(_0x1b15aa[_0xf4ab('0x3b')]){delete _0x1b15aa[_0xf4ab('0x3b')];}_0x2ead81[_0xf4ab('0x29')](_0x2dfd08)[_0xf4ab('0x3c')](_0x1b15aa);};}exports['index']=function(_0x354ca8,_0x32eb5e){var _0x866dcc={'include':[{'model':db[_0xf4ab('0x3d')],'as':_0xf4ab('0x3e')}]},_0x1410db={},_0x52f90a={'count':0x0,'rows':[]};var _0x220281=_[_0xf4ab('0x3f')](db['OpenchannelAccount'][_0xf4ab('0x40')],function(_0x1fe448){return{'name':_0x1fe448[_0xf4ab('0x41')],'type':_0x1fe448['type'][_0xf4ab('0x42')]};});_0x1410db[_0xf4ab('0x43')]=_[_0xf4ab('0x3f')](_0x220281,_0xf4ab('0x3b'));_0x1410db[_0xf4ab('0x44')]=_[_0xf4ab('0x45')](_0x354ca8[_0xf4ab('0x44')]);_0x1410db['filters']=_[_0xf4ab('0x46')](_0x1410db[_0xf4ab('0x43')],_0x1410db['query']);_0x866dcc[_0xf4ab('0x47')]=_[_0xf4ab('0x46')](_0x1410db[_0xf4ab('0x43')],qs['fields'](_0x354ca8[_0xf4ab('0x44')]['fields']));_0x866dcc[_0xf4ab('0x47')]=_0x866dcc[_0xf4ab('0x47')]['length']?_0x866dcc[_0xf4ab('0x47')]:_0x1410db[_0xf4ab('0x43')];if(!_0x354ca8[_0xf4ab('0x44')][_0xf4ab('0x48')]('nolimit')){_0x866dcc['limit']=qs[_0xf4ab('0x2c')](_0x354ca8['query']['limit']);_0x866dcc[_0xf4ab('0x2e')]=qs[_0xf4ab('0x2e')](_0x354ca8[_0xf4ab('0x44')][_0xf4ab('0x2e')]);}_0x866dcc[_0xf4ab('0x49')]=qs[_0xf4ab('0x4a')](_0x354ca8[_0xf4ab('0x44')][_0xf4ab('0x4a')]);_0x866dcc[_0xf4ab('0x4b')]=qs[_0xf4ab('0x4c')](_[_0xf4ab('0x4d')](_0x354ca8[_0xf4ab('0x44')],_0x1410db[_0xf4ab('0x4c')]),_0x220281);if(_0x354ca8['query'][_0xf4ab('0x4e')]){_0x866dcc[_0xf4ab('0x4b')]=_[_0xf4ab('0x4f')](_0x866dcc[_0xf4ab('0x4b')],{'$or':_[_0xf4ab('0x3f')](_0x220281,function(_0x15395e){if(_0x15395e['type']!==_0xf4ab('0x50')){var _0x479c5c={};_0x479c5c[_0x15395e[_0xf4ab('0x3b')]]={'$like':'%'+_0x354ca8[_0xf4ab('0x44')][_0xf4ab('0x4e')]+'%'};return _0x479c5c;}})});}_0x866dcc=_[_0xf4ab('0x4f')]({},_0x866dcc,_0x354ca8[_0xf4ab('0x51')]);var _0x448646={'where':_0x866dcc[_0xf4ab('0x4b')]};return db['OpenchannelAccount'][_0xf4ab('0x2d')](_0x448646)[_0xf4ab('0x20')](function(_0x3d8bd6){_0x52f90a[_0xf4ab('0x2d')]=_0x3d8bd6;if(_0x354ca8[_0xf4ab('0x44')][_0xf4ab('0x52')]){_0x866dcc[_0xf4ab('0x53')]=[{'all':!![]}];}return db[_0xf4ab('0x54')][_0xf4ab('0x55')](_0x866dcc);})[_0xf4ab('0x20')](function(_0x55cf7a){_0x52f90a[_0xf4ab('0x56')]=_0x55cf7a;return _0x52f90a;})[_0xf4ab('0x20')](respondWithFilteredResult(_0x32eb5e,_0x866dcc))[_0xf4ab('0x28')](handleError(_0x32eb5e,null));};exports[_0xf4ab('0x57')]=function(_0x469e2f,_0x2537cd){var _0x3d333e={'raw':![],'where':{'id':_0x469e2f['params']['id']},'include':[{'model':db[_0xf4ab('0x3d')],'as':_0xf4ab('0x3e')}]},_0x3447c1={};_0x3447c1[_0xf4ab('0x43')]=_[_0xf4ab('0x45')](db[_0xf4ab('0x54')][_0xf4ab('0x40')]);_0x3447c1[_0xf4ab('0x44')]=_['keys'](_0x469e2f[_0xf4ab('0x44')]);_0x3447c1[_0xf4ab('0x4c')]=_['intersection'](_0x3447c1[_0xf4ab('0x43')],_0x3447c1[_0xf4ab('0x44')]);_0x3d333e[_0xf4ab('0x47')]=_[_0xf4ab('0x46')](_0x3447c1[_0xf4ab('0x43')],qs['fields'](_0x469e2f['query'][_0xf4ab('0x58')]));_0x3d333e[_0xf4ab('0x47')]=_0x3d333e[_0xf4ab('0x47')]['length']?_0x3d333e[_0xf4ab('0x47')]:_0x3447c1[_0xf4ab('0x43')];if(_0x469e2f[_0xf4ab('0x44')][_0xf4ab('0x52')]){_0x3d333e[_0xf4ab('0x53')]=[{'all':!![]}];}_0x3d333e=_[_0xf4ab('0x4f')]({},_0x3d333e,_0x469e2f['options']);return db[_0xf4ab('0x54')][_0xf4ab('0x59')](_0x3d333e)[_0xf4ab('0x20')](handleEntityNotFound(_0x2537cd,null))[_0xf4ab('0x20')](respondWithResult(_0x2537cd,null))['catch'](handleError(_0x2537cd,null));};exports['create']=function(_0x87f24b,_0x126ee0){return db[_0xf4ab('0x54')]['create'](_0x87f24b['body'],{})[_0xf4ab('0x20')](function(_0xbe0d69){var _0x5f1006=_0x87f24b[_0xf4ab('0x5a')][_0xf4ab('0x36')]({'plain':!![]});if(!_0x5f1006)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f1006[_0xf4ab('0x5b')]===_0xf4ab('0x5a')){var _0x43c7c3=_0xbe0d69['get']({'plain':!![]});var _0x76fb29=_0xf4ab('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x76fb29,'userProfileId':_0x5f1006[_0xf4ab('0x5c')]},'raw':!![]})[_0xf4ab('0x20')](function(_0x4ce06e){if(_0x4ce06e&&_0x4ce06e[_0xf4ab('0x5d')]===0x0){return db[_0xf4ab('0x38')][_0xf4ab('0x5e')]({'name':_0x43c7c3[_0xf4ab('0x3b')],'resourceId':_0x43c7c3['id'],'type':_0x4ce06e['name'],'sectionId':_0x4ce06e['id']},{})[_0xf4ab('0x20')](function(){return _0xbe0d69;});}else{return _0xbe0d69;}})[_0xf4ab('0x28')](function(_0xab966a){logger[_0xf4ab('0x24')](_0xf4ab('0x5f'),_0xab966a);throw _0xab966a;});}return _0xbe0d69;})[_0xf4ab('0x20')](respondWithResult(_0x126ee0,0xc9))['catch'](handleError(_0x126ee0,null));};exports[_0xf4ab('0x34')]=function(_0x5a2b38,_0x5b1884){if(_0x5a2b38[_0xf4ab('0x60')]['id']){delete _0x5a2b38[_0xf4ab('0x60')]['id'];}return db[_0xf4ab('0x54')]['find']({'where':{'id':_0x5a2b38[_0xf4ab('0x61')]['id']},'include':[{'model':db[_0xf4ab('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xf4ab('0x20')](handleEntityNotFound(_0x5b1884,null))[_0xf4ab('0x20')](saveUpdates(_0x5a2b38[_0xf4ab('0x60')],null))[_0xf4ab('0x20')](respondWithResult(_0x5b1884,null))[_0xf4ab('0x28')](handleError(_0x5b1884,null));};exports[_0xf4ab('0x35')]=function(_0x3d30c2,_0x261047){return db['OpenchannelAccount'][_0xf4ab('0x59')]({'where':{'id':_0x3d30c2[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x261047,null))[_0xf4ab('0x20')](removeEntity(_0x261047,null))['catch'](handleError(_0x261047,null));};exports[_0xf4ab('0x62')]=function(_0x29c698,_0x2c01ba){return db['OpenchannelAccount'][_0xf4ab('0x62')]()['then'](respondWithResult(_0x2c01ba,null))[_0xf4ab('0x28')](handleError(_0x2c01ba,null));};exports[_0xf4ab('0x63')]=function(_0x1596c2,_0x354256,_0x3961ea){if(_0x1596c2[_0xf4ab('0x60')]['id']){delete _0x1596c2['body']['id'];}return db[_0xf4ab('0x54')][_0xf4ab('0x59')]({'where':{'id':_0x1596c2[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x354256,null))[_0xf4ab('0x20')](function(_0x36d990){if(_0x36d990){_0x1596c2[_0xf4ab('0x60')][_0xf4ab('0x64')]=_0x36d990['id'];return db['Disposition'][_0xf4ab('0x5e')](_0x1596c2['body']);}})[_0xf4ab('0x20')](respondWithResult(_0x354256,null))[_0xf4ab('0x28')](handleError(_0x354256,null));};exports['getDispositions']=function(_0x2a8c44,_0xce3eb6,_0x2eac87){var _0x2f8287={'raw':![],'where':{}};var _0x13a439={};var _0x43ce40={'count':0x0,'rows':[]};return db[_0xf4ab('0x54')][_0xf4ab('0x65')]({'where':{'id':_0x2a8c44[_0xf4ab('0x61')]['id']}})['then'](handleEntityNotFound(_0xce3eb6,null))['then'](function(_0x29c733){if(_0x29c733){_0x13a439[_0xf4ab('0x43')]=_[_0xf4ab('0x45')](db[_0xf4ab('0x66')]['rawAttributes']);_0x13a439['query']=_['keys'](_0x2a8c44[_0xf4ab('0x44')]);_0x13a439['filters']=_[_0xf4ab('0x46')](_0x13a439[_0xf4ab('0x43')],_0x13a439[_0xf4ab('0x44')]);_0x2f8287['attributes']=_[_0xf4ab('0x46')](_0x13a439[_0xf4ab('0x43')],qs[_0xf4ab('0x58')](_0x2a8c44['query'][_0xf4ab('0x58')]));_0x2f8287[_0xf4ab('0x47')]=_0x2f8287['attributes'][_0xf4ab('0x67')]?_0x2f8287[_0xf4ab('0x47')]:_0x13a439[_0xf4ab('0x43')];if(!_0x2a8c44['query'][_0xf4ab('0x48')]('nolimit')){_0x2f8287[_0xf4ab('0x2c')]=qs[_0xf4ab('0x2c')](_0x2a8c44[_0xf4ab('0x44')][_0xf4ab('0x2c')]);_0x2f8287['offset']=qs[_0xf4ab('0x2e')](_0x2a8c44[_0xf4ab('0x44')]['offset']);}_0x2f8287[_0xf4ab('0x49')]=qs[_0xf4ab('0x4a')](_0x2a8c44[_0xf4ab('0x44')][_0xf4ab('0x4a')]);_0x2f8287['where']=qs['filters'](_[_0xf4ab('0x4d')](_0x2a8c44[_0xf4ab('0x44')],_0x13a439[_0xf4ab('0x4c')]));_0x2f8287['where'][_0xf4ab('0x64')]=_0x29c733['id'];if(_0x2a8c44[_0xf4ab('0x44')]['filter']){_0x2f8287[_0xf4ab('0x4b')]=_['merge'](_0x2f8287['where'],{'$or':_[_0xf4ab('0x3f')](_0x2f8287[_0xf4ab('0x47')],function(_0x1abe91){var _0x4ec63a={};_0x4ec63a[_0x1abe91]={'$like':'%'+_0x2a8c44[_0xf4ab('0x44')][_0xf4ab('0x4e')]+'%'};return _0x4ec63a;})});}_0x2f8287=_[_0xf4ab('0x4f')]({},_0x2f8287,_0x2a8c44[_0xf4ab('0x51')]);return db[_0xf4ab('0x66')][_0xf4ab('0x2d')]({'where':_0x2f8287[_0xf4ab('0x4b')]})[_0xf4ab('0x20')](function(_0x26798e){_0x43ce40[_0xf4ab('0x2d')]=_0x26798e;if(_0x2a8c44['query'][_0xf4ab('0x52')]){_0x2f8287['include']=[{'all':!![]}];}return db['Disposition'][_0xf4ab('0x55')](_0x2f8287);})[_0xf4ab('0x20')](function(_0x423e85){_0x43ce40['rows']=_0x423e85;return _0x43ce40;});}})['then'](respondWithFilteredResult(_0xce3eb6,_0x2f8287))[_0xf4ab('0x28')](handleError(_0xce3eb6,null));};exports[_0xf4ab('0x68')]=function(_0x33b32f,_0x294843,_0x1df8cc){return db[_0xf4ab('0x54')][_0xf4ab('0x59')]({'where':{'id':_0x33b32f['params']['id']}})['then'](handleEntityNotFound(_0x294843,null))['then'](function(_0xe3d470){if(_0xe3d470){return _0xe3d470[_0xf4ab('0x68')](_0x33b32f[_0xf4ab('0x44')]['ids']);}})[_0xf4ab('0x20')](respondWithStatusCode(_0x294843,null))[_0xf4ab('0x28')](handleError(_0x294843,null));};exports[_0xf4ab('0x69')]=function(_0x262f9a,_0x19912a,_0x416954){if(_0x262f9a[_0xf4ab('0x60')]['id']){delete _0x262f9a[_0xf4ab('0x60')]['id'];}return db[_0xf4ab('0x54')]['find']({'where':{'id':_0x262f9a['params']['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x19912a,null))[_0xf4ab('0x20')](function(_0x28634d){if(_0x28634d){_0x262f9a[_0xf4ab('0x60')][_0xf4ab('0x64')]=_0x28634d['id'];return db[_0xf4ab('0x6a')][_0xf4ab('0x5e')](_0x262f9a['body']);}})[_0xf4ab('0x20')](respondWithResult(_0x19912a,null))[_0xf4ab('0x28')](handleError(_0x19912a,null));};exports['getAnswers']=function(_0xd94850,_0xec0be3,_0x521949){var _0x374324={'raw':![],'where':{}};var _0x26ee96={};var _0x37d591={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf4ab('0x65')]({'where':{'id':_0xd94850[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0xec0be3,null))[_0xf4ab('0x20')](function(_0x5117ac){if(_0x5117ac){_0x26ee96['model']=_[_0xf4ab('0x45')](db[_0xf4ab('0x6a')]['rawAttributes']);_0x26ee96['query']=_[_0xf4ab('0x45')](_0xd94850[_0xf4ab('0x44')]);_0x26ee96[_0xf4ab('0x4c')]=_[_0xf4ab('0x46')](_0x26ee96[_0xf4ab('0x43')],_0x26ee96[_0xf4ab('0x44')]);_0x374324['attributes']=_['intersection'](_0x26ee96['model'],qs[_0xf4ab('0x58')](_0xd94850['query']['fields']));_0x374324[_0xf4ab('0x47')]=_0x374324[_0xf4ab('0x47')][_0xf4ab('0x67')]?_0x374324[_0xf4ab('0x47')]:_0x26ee96[_0xf4ab('0x43')];if(!_0xd94850[_0xf4ab('0x44')][_0xf4ab('0x48')](_0xf4ab('0x6b'))){_0x374324['limit']=qs[_0xf4ab('0x2c')](_0xd94850['query'][_0xf4ab('0x2c')]);_0x374324[_0xf4ab('0x2e')]=qs[_0xf4ab('0x2e')](_0xd94850[_0xf4ab('0x44')][_0xf4ab('0x2e')]);}_0x374324[_0xf4ab('0x49')]=qs['sort'](_0xd94850['query']['sort']);_0x374324[_0xf4ab('0x4b')]=qs[_0xf4ab('0x4c')](_[_0xf4ab('0x4d')](_0xd94850[_0xf4ab('0x44')],_0x26ee96[_0xf4ab('0x4c')]));_0x374324[_0xf4ab('0x4b')][_0xf4ab('0x64')]=_0x5117ac['id'];if(_0xd94850[_0xf4ab('0x44')][_0xf4ab('0x4e')]){_0x374324[_0xf4ab('0x4b')]=_[_0xf4ab('0x4f')](_0x374324[_0xf4ab('0x4b')],{'$or':_[_0xf4ab('0x3f')](_0x374324[_0xf4ab('0x47')],function(_0xec53c){var _0x15ae89={};_0x15ae89[_0xec53c]={'$like':'%'+_0xd94850['query'][_0xf4ab('0x4e')]+'%'};return _0x15ae89;})});}_0x374324=_['merge']({},_0x374324,_0xd94850[_0xf4ab('0x51')]);return db[_0xf4ab('0x6a')][_0xf4ab('0x2d')]({'where':_0x374324[_0xf4ab('0x4b')]})['then'](function(_0x3a752f){_0x37d591['count']=_0x3a752f;if(_0xd94850[_0xf4ab('0x44')][_0xf4ab('0x52')]){_0x374324[_0xf4ab('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf4ab('0x55')](_0x374324);})[_0xf4ab('0x20')](function(_0x3c3364){_0x37d591[_0xf4ab('0x56')]=_0x3c3364;return _0x37d591;});}})['then'](respondWithFilteredResult(_0xec0be3,_0x374324))[_0xf4ab('0x28')](handleError(_0xec0be3,null));};exports[_0xf4ab('0x6c')]=function(_0x1c5d2e,_0x37c55f,_0xa1e116){return db[_0xf4ab('0x54')][_0xf4ab('0x59')]({'where':{'id':_0x1c5d2e[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x37c55f,null))[_0xf4ab('0x20')](function(_0x48f931){if(_0x48f931){return _0x48f931['removeAnswers'](_0x1c5d2e[_0xf4ab('0x44')][_0xf4ab('0x6d')]);}})[_0xf4ab('0x20')](respondWithStatusCode(_0x37c55f,null))[_0xf4ab('0x28')](handleError(_0x37c55f,null));};exports[_0xf4ab('0x6e')]=function(_0x168a5c,_0x1e6159,_0x5b264e){var _0x1aa3a4={'body':_0x168a5c[_0xf4ab('0x60')],'channel':_0xf4ab('0x6f')};var _0x82f48c=[];var _0x1e3571=[];var _0x53c5f1={};var _0x59cd8c=![];return db[_0xf4ab('0x70')][_0xf4ab('0x62')]()[_0xf4ab('0x20')](function(_0x408d09){if(!_0x408d09){throw new db[(_0xf4ab('0x71'))][(_0xf4ab('0x72'))](_0xf4ab('0x73'));}_0x82f48c=_[_0xf4ab('0x74')](_['keys'](_0x408d09),[_0xf4ab('0x75'),_0xf4ab('0x76')]);_0x1e3571=_['difference'](_['keys'](_0x408d09),[_0xf4ab('0x75'),'updatedAt','CompanyId',_0xf4ab('0x77')]);if(_0x168a5c['body']['id']){delete _0x168a5c[_0xf4ab('0x60')]['id'];}if(_[_0xf4ab('0x78')](_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x79')])){throw new db[(_0xf4ab('0x71'))][(_0xf4ab('0x72'))](_0xf4ab('0x7a'));}if(_['isNil'](_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x60')])||_0x168a5c[_0xf4ab('0x60')]['body']===''){throw new db[(_0xf4ab('0x71'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf4ab('0x78')](_0x168a5c['body'][_0xf4ab('0x7b')])){throw new db[(_0xf4ab('0x71'))][(_0xf4ab('0x72'))](_0xf4ab('0x7c')+_0x1e3571);}if(!_[_0xf4ab('0x7d')](_0x1e3571,_0x168a5c[_0xf4ab('0x60')]['mapKey'])){throw new db[(_0xf4ab('0x71'))][(_0xf4ab('0x72'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e3571);}_0x53c5f1[_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x7b')]]=_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x79')];})[_0xf4ab('0x20')](function(){return db['OpenchannelAccount'][_0xf4ab('0x59')]({'where':{'id':_0x168a5c[_0xf4ab('0x61')]['id']},'include':[{'model':db[_0xf4ab('0x7e')],'as':'List','include':[{'model':db[_0xf4ab('0x70')],'as':_0xf4ab('0x7f'),'where':_0x53c5f1,'limit':0x1,'order':[[_0xf4ab('0x76'),_0xf4ab('0x80')]]}]},{'model':db[_0xf4ab('0x81')],'as':'Applications'}]});})[_0xf4ab('0x20')](handleEntityNotFound(_0x1e6159,null))[_0xf4ab('0x20')](function(_0x2b1229){if(_0x2b1229&&_0x2b1229['List']){_0x1aa3a4[_0xf4ab('0x82')]=_0x2b1229;_0x1aa3a4[_0xf4ab('0x83')]=_0x2b1229['Applications'];_0x1aa3a4[_0xf4ab('0x84')]=_0x2b1229[_0xf4ab('0x85')];_0x1aa3a4[_0xf4ab('0x83')]=_[_0xf4ab('0x86')](_0x1aa3a4['applications'],[_0xf4ab('0x87')],[_0xf4ab('0x88')]);if(_0x1aa3a4[_0xf4ab('0x82')][_0xf4ab('0x89')]){delete _0x1aa3a4[_0xf4ab('0x82')]['Applications'];}if(_0x1aa3a4['account'][_0xf4ab('0x85')]&&_0x1aa3a4['account'][_0xf4ab('0x85')]['Contacts'][_0xf4ab('0x67')]){return _0x1aa3a4[_0xf4ab('0x82')][_0xf4ab('0x85')][_0xf4ab('0x7f')][0x0];}var _0x506dd2=_['defaults'](_0x168a5c['body'],{'firstName':_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x79')],'ListId':_0x2b1229[_0xf4ab('0x77')]});_0x506dd2[_0x168a5c['body'][_0xf4ab('0x7b')]]=_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x79')];return db[_0xf4ab('0x70')][_0xf4ab('0x5e')](_0x506dd2,{'fields':_0x82f48c,'raw':!![]});}})['then'](handleEntityNotFound(_0x1e6159,null))[_0xf4ab('0x20')](function(_0x52d76a){_0x1aa3a4[_0xf4ab('0x8a')]=_0x52d76a;if(_0x52d76a){var _0x2e4eb3={'ContactId':_0x52d76a['id'],'OpenchannelAccountId':_0x168a5c[_0xf4ab('0x61')]['id'],'from':(_0x52d76a[_0xf4ab('0x8b')]||'')+'\x20'+(_0x52d76a[_0xf4ab('0x8c')]||'')};var _0x1846d5={'OpenchannelAccountId':_0x168a5c['params']['id'],'closed':![]};if(_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x8d')]){_0x1846d5[_0xf4ab('0x8d')]=_0x168a5c[_0xf4ab('0x60')]['threadId'];return db[_0xf4ab('0x8e')][_0xf4ab('0x59')]({'where':_0x1846d5})['then'](function(_0x2d9532){if(_0x2d9532){return[_0x2d9532,![]];}_0x2e4eb3[_0xf4ab('0x8d')]=_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x8d')];_0x2e4eb3[_0xf4ab('0x8f')]=_0x168a5c['body'][_0xf4ab('0x8f')];return db['OpenchannelInteraction'][_0xf4ab('0x5e')](_0x2e4eb3)[_0xf4ab('0x20')](function(_0x9d7db0){return[_0x9d7db0,!![]];});});}else{_0x1846d5[_0xf4ab('0x8d')]=null;}_0x1846d5[_0xf4ab('0x90')]=_0x52d76a['id'];return db['OpenchannelInteraction'][_0xf4ab('0x59')]({'where':_0x1846d5})[_0xf4ab('0x20')](function(_0x10a8f5){if(_0x10a8f5){return[_0x10a8f5,![]];}return db['OpenchannelInteraction'][_0xf4ab('0x5e')](_0x2e4eb3)[_0xf4ab('0x20')](function(_0x352e92){return[_0x352e92,!![]];});});}})[_0xf4ab('0x91')](function(_0x27aa84,_0x3292c1){if(_0x27aa84){_0x59cd8c=_0x3292c1;if(!_0x3292c1){var _0x7d9bcd={'from':(_0x1aa3a4[_0xf4ab('0x8a')]['firstName']||'')+'\x20'+(_0x1aa3a4[_0xf4ab('0x8a')][_0xf4ab('0x8c')]||'')};if(_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x8d')]&&_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x92')]&&_0x168a5c['body'][_0xf4ab('0x8d')]!=_0x168a5c['body'][_0xf4ab('0x92')]){_0x7d9bcd[_0xf4ab('0x8d')]=_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x92')];}return _0x27aa84[_0xf4ab('0x34')](_0x7d9bcd);}else{return _0x27aa84;}}})[_0xf4ab('0x20')](function(_0x5c1d51){_0x1aa3a4['interaction']=_0x5c1d51[_0xf4ab('0x36')]({'plain':!![]});_0x1aa3a4[_0xf4ab('0x93')][_0xf4ab('0x94')]=_0x59cd8c;if(_0x1aa3a4[_0xf4ab('0x93')]['created']){if(_0x1aa3a4[_0xf4ab('0x82')][_0xf4ab('0x95')]){_0x1aa3a4[_0xf4ab('0x83')][_0xf4ab('0x96')]({'id':0x0,'priority':_0x1aa3a4[_0xf4ab('0x83')][_0xf4ab('0x67')]+0x1,'app':_0xf4ab('0x97'),'appdata':_0xf4ab('0x98'),'interval':_0xf4ab('0x99')});}}return db['OpenchannelMessage'][_0xf4ab('0x5e')]({'body':_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x60')],'OpenchannelAccountId':_0x168a5c[_0xf4ab('0x61')]['id'],'OpenchannelInteractionId':_0x5c1d51['id'],'direction':'in','ContactId':_0x1aa3a4['contact']['id'],'AttachmentId':_0x168a5c[_0xf4ab('0x60')][_0xf4ab('0x9a')]});})[_0xf4ab('0x20')](function(_0x44dbb7){_0x1aa3a4[_0xf4ab('0x26')]=_0x44dbb7;if(_0x1aa3a4[_0xf4ab('0x93')]['UserId']){return db[_0xf4ab('0x9b')][_0xf4ab('0x59')]({'attributes':['id','name'],'where':{'id':_0x1aa3a4[_0xf4ab('0x93')][_0xf4ab('0x9c')]}})['then'](function(_0x1854d0){if(_0x1854d0){_0x1aa3a4[_0xf4ab('0x83')][_0xf4ab('0x9d')]({'id':0x0,'priority':0x0,'app':_0xf4ab('0x9e'),'appdata':_0x1854d0[_0xf4ab('0x3b')]+','+(_0x1aa3a4[_0xf4ab('0x82')][_0xf4ab('0x9f')]||0xa),'interval':_0xf4ab('0x99')});_0x1aa3a4['forcedOwnership']=![];}return respondWithRpcPromise('Start','startRouting',_0x1aa3a4);});}return respondWithRpcPromise(_0xf4ab('0xa0'),_0xf4ab('0xa1'),_0x1aa3a4);})[_0xf4ab('0x20')](function(_0x244f28){respondWithRpcPromise(_0xf4ab('0xa2'),_0xf4ab('0xa2'),{'event':_0xf4ab('0x6e'),'message':_0x244f28},client9002);return _0x244f28;})['then'](respondWithResult(_0x1e6159,null))[_0xf4ab('0x28')](handleError(_0x1e6159,null));};exports[_0xf4ab('0xa3')]=function(_0x56bed9,_0xe83268){var _0x3022d2=_0x56bed9['params']['id'];var _0x5dbaba=_0x56bed9['body'];var _0x1f63f0=0xc8;var _0x2a17bb=null;return db[_0xf4ab('0xa4')][_0xf4ab('0xa5')]({'isolationLevel':db['sequelize'][_0xf4ab('0xa6')][_0xf4ab('0xa7')][_0xf4ab('0xa8')]},function(_0x27094e){return db[_0xf4ab('0x54')][_0xf4ab('0x65')]({'where':{'id':_0x3022d2},'transaction':_0x27094e})[_0xf4ab('0x20')](function(_0x1b40d5){if(_0x1b40d5){return db[_0xf4ab('0x81')][_0xf4ab('0x35')]({'where':{'OpenchannelAccountId':_0x3022d2},'transaction':_0x27094e})['then'](function(){var _0x2c7158=_[_0xf4ab('0x3f')](_0x5dbaba,function(_0x27f48a){_0x27f48a[_0xf4ab('0x64')]=_0x3022d2;return _0x27f48a;});return db[_0xf4ab('0x81')][_0xf4ab('0xa9')](_0x2c7158,{'transaction':_0x27094e});});}else{_0x1f63f0=0x194;_0x2a17bb=[];}});})[_0xf4ab('0x20')](function(){if(_0x1f63f0!==0x194){return db[_0xf4ab('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3022d2},'order':_0xf4ab('0x87')})[_0xf4ab('0x20')](function(_0xb8eedf){_0x2a17bb=_0xb8eedf;});}})[_0xf4ab('0x28')](function(_0x4d0f7e){_0x1f63f0=0x1f4;logger['error'](_0x4d0f7e[_0xf4ab('0x3a')]);if(_0x4d0f7e[_0xf4ab('0x3b')]){delete _0x4d0f7e[_0xf4ab('0x3b')];}_0x2a17bb=_0x4d0f7e;})[_0xf4ab('0xaa')](function(){if(_0x2a17bb===null){_0xe83268[_0xf4ab('0x39')](_0x1f63f0);}else{if(_0x1f63f0===0x1f4){_0xe83268['status'](_0x1f63f0)['send'](_0x2a17bb);}else{_0xe83268[_0xf4ab('0x29')](_0x1f63f0)[_0xf4ab('0x30')](_0x2a17bb);}}});};exports[_0xf4ab('0xab')]=function(_0x18b085,_0x7822b2,_0x48f192){var _0x522104={};var _0x895d57={};var _0x3ff979;var _0x5049ed;return db[_0xf4ab('0x54')]['findOne']({'where':{'id':_0x18b085[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x7822b2,null))['then'](function(_0x4d679b){if(_0x4d679b){_0x3ff979=_0x4d679b;_0x895d57['model']=_['keys'](db[_0xf4ab('0x81')][_0xf4ab('0x40')]);_0x895d57[_0xf4ab('0x44')]=_[_0xf4ab('0x45')](_0x18b085['query']);_0x895d57['filters']=_[_0xf4ab('0x46')](_0x895d57[_0xf4ab('0x43')],_0x895d57[_0xf4ab('0x44')]);_0x522104[_0xf4ab('0x47')]=_['intersection'](_0x895d57['model'],qs[_0xf4ab('0x58')](_0x18b085[_0xf4ab('0x44')]['fields']));_0x522104[_0xf4ab('0x47')]=_0x522104[_0xf4ab('0x47')][_0xf4ab('0x67')]?_0x522104[_0xf4ab('0x47')]:_0x895d57['model'];_0x522104[_0xf4ab('0x49')]=qs[_0xf4ab('0x4a')](_0x18b085[_0xf4ab('0x44')][_0xf4ab('0x4a')]);_0x522104['where']=qs[_0xf4ab('0x4c')](_[_0xf4ab('0x4d')](_0x18b085[_0xf4ab('0x44')],_0x895d57[_0xf4ab('0x4c')]));if(_0x18b085[_0xf4ab('0x44')][_0xf4ab('0x4e')]){_0x522104['where']=_['merge'](_0x522104['where'],{'$or':_['map'](_0x522104[_0xf4ab('0x47')],function(_0x234c20){var _0x2290b6={};_0x2290b6[_0x234c20]={'$like':'%'+_0x18b085['query'][_0xf4ab('0x4e')]+'%'};return _0x2290b6;})});}_0x522104=_[_0xf4ab('0x4f')]({},_0x522104,_0x18b085[_0xf4ab('0x51')]);return _0x3ff979[_0xf4ab('0xab')](_0x522104);}})[_0xf4ab('0x20')](function(_0x4cbb8b){if(_0x4cbb8b){_0x5049ed=_0x4cbb8b[_0xf4ab('0x67')];if(!_0x18b085[_0xf4ab('0x44')][_0xf4ab('0x48')](_0xf4ab('0x6b'))){_0x522104[_0xf4ab('0x2c')]=qs[_0xf4ab('0x2c')](_0x18b085['query'][_0xf4ab('0x2c')]);_0x522104['offset']=qs[_0xf4ab('0x2e')](_0x18b085[_0xf4ab('0x44')][_0xf4ab('0x2e')]);}return _0x3ff979['getApplications'](_0x522104);}})['then'](function(_0x5950c5){if(_0x5950c5){return _0x5950c5?{'count':_0x5049ed,'rows':_0x5950c5}:null;}})[_0xf4ab('0x20')](respondWithResult(_0x7822b2,null))[_0xf4ab('0x28')](handleError(_0x7822b2,null));};exports[_0xf4ab('0xac')]=function(_0x3d01d3,_0x1bb631,_0x41e017){var _0x28e3ed={'raw':![],'where':{}};var _0x49a4db={};var _0x2b4703={'count':0x0,'rows':[]};return db[_0xf4ab('0x54')][_0xf4ab('0x65')]({'where':{'id':_0x3d01d3[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x1bb631,null))[_0xf4ab('0x20')](function(_0x56932f){if(_0x56932f){_0x49a4db[_0xf4ab('0x43')]=_[_0xf4ab('0x45')](db[_0xf4ab('0x8e')][_0xf4ab('0x40')]);_0x49a4db[_0xf4ab('0x44')]=_[_0xf4ab('0x45')](_0x3d01d3[_0xf4ab('0x44')]);_0x49a4db[_0xf4ab('0x4c')]=_[_0xf4ab('0x46')](_0x49a4db[_0xf4ab('0x43')],_0x49a4db[_0xf4ab('0x44')]);_0x28e3ed[_0xf4ab('0x47')]=_[_0xf4ab('0x46')](_0x49a4db[_0xf4ab('0x43')],qs[_0xf4ab('0x58')](_0x3d01d3['query'][_0xf4ab('0x58')]));_0x28e3ed[_0xf4ab('0x47')]=_0x28e3ed[_0xf4ab('0x47')][_0xf4ab('0x67')]?_0x28e3ed[_0xf4ab('0x47')]:_0x49a4db['model'];if(!_0x3d01d3['query'][_0xf4ab('0x48')](_0xf4ab('0x6b'))){_0x28e3ed[_0xf4ab('0x2c')]=qs[_0xf4ab('0x2c')](_0x3d01d3['query'][_0xf4ab('0x2c')]);_0x28e3ed[_0xf4ab('0x2e')]=qs['offset'](_0x3d01d3[_0xf4ab('0x44')][_0xf4ab('0x2e')]);}_0x28e3ed[_0xf4ab('0x49')]=qs[_0xf4ab('0x4a')](_0x3d01d3[_0xf4ab('0x44')][_0xf4ab('0x4a')]);_0x28e3ed[_0xf4ab('0x4b')]=qs[_0xf4ab('0x4c')](_[_0xf4ab('0x4d')](_0x3d01d3[_0xf4ab('0x44')],_0x49a4db[_0xf4ab('0x4c')]));_0x28e3ed[_0xf4ab('0x4b')][_0xf4ab('0x64')]=_0x56932f['id'];if(_0x3d01d3[_0xf4ab('0x44')]['filter']){_0x28e3ed[_0xf4ab('0x4b')]=_[_0xf4ab('0x4f')](_0x28e3ed[_0xf4ab('0x4b')],{'$or':_[_0xf4ab('0x3f')](_0x28e3ed['attributes'],function(_0x4909cc){var _0x3373d8={};_0x3373d8[_0x4909cc]={'$like':'%'+_0x3d01d3[_0xf4ab('0x44')]['filter']+'%'};return _0x3373d8;})});}_0x28e3ed=_[_0xf4ab('0x4f')]({},_0x28e3ed,_0x3d01d3[_0xf4ab('0x51')]);return db['OpenchannelInteraction'][_0xf4ab('0x2d')]({'where':_0x28e3ed[_0xf4ab('0x4b')]})['then'](function(_0x4c2b94){_0x2b4703[_0xf4ab('0x2d')]=_0x4c2b94;if(_0x3d01d3['query'][_0xf4ab('0x52')]){_0x28e3ed[_0xf4ab('0x53')]=[{'model':db[_0xf4ab('0x70')],'as':_0xf4ab('0xad'),'required':![]},{'model':db[_0xf4ab('0x9b')],'as':'Owner','attributes':[_0xf4ab('0x3b'),'fullname',_0xf4ab('0xae')],'required':![]},{'model':db[_0xf4ab('0xaf')],'as':_0xf4ab('0xb0'),'attributes':['id',_0xf4ab('0x3b'),'color'],'where':_0x3d01d3[_0xf4ab('0x44')][_0xf4ab('0xb1')]?{'id':_0x3d01d3[_0xf4ab('0x44')][_0xf4ab('0xb1')]}:undefined,'required':_0x3d01d3[_0xf4ab('0x44')][_0xf4ab('0xb1')]?!![]:![]}];}return db[_0xf4ab('0x8e')][_0xf4ab('0x55')](_0x28e3ed);})[_0xf4ab('0x20')](function(_0x26c663){_0x2b4703[_0xf4ab('0x56')]=_0x26c663;return _0x2b4703;});}})[_0xf4ab('0x20')](respondWithFilteredResult(_0x1bb631,_0x28e3ed))[_0xf4ab('0x28')](handleError(_0x1bb631,null));};exports[_0xf4ab('0xb2')]=function(_0x3cb962,_0x4d8056,_0x41a6f5){return db[_0xf4ab('0x54')][_0xf4ab('0x59')]({'where':{'id':_0x3cb962[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x4d8056,null))[_0xf4ab('0x20')](function(_0x21af1f){if(_0x21af1f){return _0x21af1f['addAgents'](_0x3cb962['body'][_0xf4ab('0x6d')],_[_0xf4ab('0xb3')](_0x3cb962[_0xf4ab('0x60')],[_0xf4ab('0x6d'),'id'])||{})[_0xf4ab('0x91')](function(_0x112c14){for(var _0xf8e77c=0x0;_0xf8e77c<_0x3cb962[_0xf4ab('0x60')][_0xf4ab('0x6d')][_0xf4ab('0x67')];_0xf8e77c+=0x1){socket[_0xf4ab('0xb4')](_0xf4ab('0xb5'),{'UserId':Number(_0x3cb962[_0xf4ab('0x60')][_0xf4ab('0x6d')][_0xf8e77c]),'OpenchannelAccountId':Number(_0x3cb962[_0xf4ab('0x61')]['id'])});}return _0x112c14;});}})[_0xf4ab('0x20')](respondWithResult(_0x4d8056,null))[_0xf4ab('0x28')](handleError(_0x4d8056,null));};exports[_0xf4ab('0xb6')]=function(_0x261f67,_0x495561,_0x69e5e5){return db['OpenchannelAccount'][_0xf4ab('0x59')]({'where':{'id':_0x261f67['params']['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x495561,null))['then'](function(_0x4afc8e){if(_0x4afc8e){return _0x4afc8e[_0xf4ab('0xb6')](_0x261f67[_0xf4ab('0x44')][_0xf4ab('0x6d')])[_0xf4ab('0x20')](function(){if(_[_0xf4ab('0xb7')](_0x261f67[_0xf4ab('0x44')]['ids'])){for(var _0x48b384=0x0;_0x48b384<_0x261f67[_0xf4ab('0x44')][_0xf4ab('0x6d')][_0xf4ab('0x67')];_0x48b384+=0x1){socket[_0xf4ab('0xb4')](_0xf4ab('0xb8'),{'UserId':Number(_0x261f67[_0xf4ab('0x44')][_0xf4ab('0x6d')][_0x48b384]),'OpenchannelAccountId':Number(_0x261f67[_0xf4ab('0x61')]['id'])});}}else{socket['emit'](_0xf4ab('0xb8'),{'UserId':Number(_0x261f67[_0xf4ab('0x44')][_0xf4ab('0x6d')]),'OpenchannelAccountId':Number(_0x261f67[_0xf4ab('0x61')]['id'])});}});}})[_0xf4ab('0x20')](respondWithStatusCode(_0x495561,null))[_0xf4ab('0x28')](handleError(_0x495561,null));};exports['getAgents']=function(_0x3fdb11,_0x55e412,_0x4912e5){var _0xa92ab2={};var _0xdfd465={};var _0x396859;var _0x3fd18e;return db[_0xf4ab('0x54')][_0xf4ab('0x65')]({'where':{'id':_0x3fdb11[_0xf4ab('0x61')]['id']}})[_0xf4ab('0x20')](handleEntityNotFound(_0x55e412,null))[_0xf4ab('0x20')](function(_0x5db978){if(_0x5db978){_0x396859=_0x5db978;_0xdfd465[_0xf4ab('0x43')]=_[_0xf4ab('0x45')](db[_0xf4ab('0x9b')][_0xf4ab('0x40')]);_0xdfd465[_0xf4ab('0x44')]=_[_0xf4ab('0x45')](_0x3fdb11[_0xf4ab('0x44')]);_0xdfd465[_0xf4ab('0x4c')]=_[_0xf4ab('0x46')](_0xdfd465[_0xf4ab('0x43')],_0xdfd465[_0xf4ab('0x44')]);_0xa92ab2[_0xf4ab('0x47')]=_[_0xf4ab('0x46')](_0xdfd465['model'],qs[_0xf4ab('0x58')](_0x3fdb11[_0xf4ab('0x44')][_0xf4ab('0x58')]));_0xa92ab2[_0xf4ab('0x47')]=_0xa92ab2[_0xf4ab('0x47')]['length']?_0xa92ab2[_0xf4ab('0x47')]:_0xdfd465['model'];_0xa92ab2['order']=qs[_0xf4ab('0x4a')](_0x3fdb11[_0xf4ab('0x44')]['sort']);_0xa92ab2[_0xf4ab('0x4b')]=qs[_0xf4ab('0x4c')](_[_0xf4ab('0x4d')](_0x3fdb11[_0xf4ab('0x44')],_0xdfd465[_0xf4ab('0x4c')]));if(_0x3fdb11[_0xf4ab('0x44')][_0xf4ab('0x4e')]){_0xa92ab2[_0xf4ab('0x4b')]=_['merge'](_0xa92ab2['where'],{'$or':_[_0xf4ab('0x3f')](_0xa92ab2[_0xf4ab('0x47')],function(_0x206553){var _0x277254={};_0x277254[_0x206553]={'$like':'%'+_0x3fdb11['query']['filter']+'%'};return _0x277254;})});}_0xa92ab2=_['merge']({},_0xa92ab2,_0x3fdb11['options']);return _0x396859[_0xf4ab('0xb9')](_0xa92ab2);}})[_0xf4ab('0x20')](function(_0x5b3cfa){if(_0x5b3cfa){_0x3fd18e=_0x5b3cfa[_0xf4ab('0x67')];if(!_0x3fdb11[_0xf4ab('0x44')][_0xf4ab('0x48')](_0xf4ab('0x6b'))){_0xa92ab2[_0xf4ab('0x2c')]=qs['limit'](_0x3fdb11['query'][_0xf4ab('0x2c')]);_0xa92ab2[_0xf4ab('0x2e')]=qs[_0xf4ab('0x2e')](_0x3fdb11[_0xf4ab('0x44')][_0xf4ab('0x2e')]);}return _0x396859[_0xf4ab('0xb9')](_0xa92ab2);}})[_0xf4ab('0x20')](function(_0x2cf994){if(_0x2cf994){return _0x2cf994?{'count':_0x3fd18e,'rows':_0x2cf994}:null;}})[_0xf4ab('0x20')](respondWithResult(_0x55e412,null))[_0xf4ab('0x28')](handleError(_0x55e412,null));};exports[_0xf4ab('0x3c')]=function(_0x293c2d,_0x5c1909,_0x75527b){var _0x4c2a98,_0x49a59a,_0x46f9f3;if(_[_0xf4ab('0x78')](_0x293c2d[_0xf4ab('0x60')][_0xf4ab('0x60')])||_0x293c2d[_0xf4ab('0x60')][_0xf4ab('0x60')]===''){throw new db[(_0xf4ab('0x71'))][(_0xf4ab('0x72'))](_0xf4ab('0xba'));}if(_[_0xf4ab('0x78')](_0x293c2d['body']['to'])){}_0x4c2a98=_0x293c2d['body']['to'];return db[_0xf4ab('0x54')][_0xf4ab('0x65')]({'where':{'id':_0x293c2d['params']['id']}})['then'](handleEntityNotFound(_0x5c1909,null))[_0xf4ab('0x20')](function(_0x28ce0f){if(_0x28ce0f){return db[_0xf4ab('0x54')]['find']({'where':{'id':_0x28ce0f['id']},'include':[{'model':db[_0xf4ab('0x7e')],'as':_0xf4ab('0x85'),'include':[{'model':db['CmContact'],'as':_0xf4ab('0x7f'),'where':{[_0x28ce0f['mapKey']]:_0x4c2a98},'limit':0x1,'order':[[_0xf4ab('0x76'),_0xf4ab('0x80')]]}]}]})[_0xf4ab('0x20')](handleEntityNotFound(_0x5c1909,null))['then'](function(_0x351beb){if(_0x351beb&&_0x351beb['List']){_0x49a59a=_0x351beb[_0xf4ab('0x36')]({'plain':!![]});if(_0x49a59a['List']&&_0x49a59a['List'][_0xf4ab('0x7f')]['length']){return _0x49a59a[_0xf4ab('0x85')]['Contacts'][0x0];}return db['CmContact']['create'](_['defaults'](_0x293c2d['body'],{'firstName':_0x4c2a98,[_0x351beb[_0xf4ab('0x7b')]]:_0x4c2a98,'phone':_0x4c2a98,'ListId':_0x49a59a[_0xf4ab('0x77')]}));}})[_0xf4ab('0x20')](handleEntityNotFound(_0x5c1909,null))['then'](function(_0x244556){if(_0x244556){_0x46f9f3=_0x244556;return db[_0xf4ab('0x8e')]['find']({'where':{'ContactId':_0x46f9f3['id'],'closed':![],'OpenchannelAccountId':_0x49a59a['id']}})[_0xf4ab('0x20')](function(_0x2a82ed){if(_0x2a82ed){return[_0x2a82ed,![]];}return db[_0xf4ab('0x8e')][_0xf4ab('0x5e')]({'UserId':_0x293c2d[_0xf4ab('0x5a')]['id'],'ContactId':_0x46f9f3['id'],'OpenchannelAccountId':_0x49a59a['id'],'lastMsgDirection':_0xf4ab('0xbb'),'firstMsgDirection':'out','Messages':[_['merge'](_0x293c2d[_0xf4ab('0x60')],{'read':![],'body':_0x293c2d[_0xf4ab('0x60')][_0xf4ab('0x60')],'OpenchannelAccountId':_0x49a59a['id'],'UserId':_0x293c2d[_0xf4ab('0x5a')]['id'],'ContactId':_0x46f9f3['id']})]},{'include':[{'model':db[_0xf4ab('0xbc')],'as':_0xf4ab('0xbd')}]})[_0xf4ab('0x20')](function(_0x5afc22){return[_0x5afc22,!![]];});});}})[_0xf4ab('0x91')](function(_0x147435,_0x3f0e1e){if(_0x3f0e1e){return _0x147435;}return db[_0xf4ab('0xbc')][_0xf4ab('0x5e')](_[_0xf4ab('0x4f')](_0x293c2d['body'],{'read':![],'body':_0x293c2d[_0xf4ab('0x60')]['body'],'OpenchannelAccountId':_0x49a59a['id'],'OpenchannelInteractionId':_0x147435['id'],'UserId':_0x293c2d[_0xf4ab('0x5a')]['id'],'ContactId':_0x46f9f3['id']}))[_0xf4ab('0x20')](function(_0x36e4d4){_0x147435[_0xf4ab('0xbe')][_0xf4ab('0xbd')]=[];_0x147435[_0xf4ab('0xbe')][_0xf4ab('0xbd')][_0xf4ab('0x96')](_0x36e4d4[_0xf4ab('0xbe')]);return _0x147435;});});}})[_0xf4ab('0x20')](respondWithResult(_0x5c1909,null))[_0xf4ab('0x28')](handleError(_0x5c1909,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b2bc34c..7e4a43c 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 _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x748003,_0x564d6a){var _0xb64054=function(_0x540957){while(--_0x540957){_0x748003['push'](_0x748003['shift']());}};_0xb64054(++_0x564d6a);}(_0x9348,0x10d));var _0x8934=function(_0x3f9eae,_0x42496b){_0x3f9eae=_0x3f9eae-0x0;var _0x26a492=_0x9348[_0x3f9eae];return _0x26a492;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xa74f=['remove','hasOwnProperty','hook','exports','OpenchannelAccount','update'];(function(_0x4eb3c5,_0x448889){var _0x756ae2=function(_0x48c799){while(--_0x48c799){_0x4eb3c5['push'](_0x4eb3c5['shift']());}};_0x756ae2(++_0x448889);}(_0xa74f,0x9a));var _0xfa74=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xa74f[_0x243217];return _0x478029;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xfa74('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa74('0x1'),'afterDestroy':_0xfa74('0x2')};function emitEvent(_0x394a1e){return function(_0x25a9b7,_0x5b367b,_0x141625){OpenchannelAccountEvents['emit'](_0x394a1e+':'+_0x25a9b7['id'],_0x25a9b7);OpenchannelAccountEvents['emit'](_0x394a1e,_0x25a9b7);_0x141625(null);};}for(var e in events){if(events[_0xfa74('0x3')](e)){var event=events[e];OpenchannelAccount[_0xfa74('0x4')](e,emitEvent(event));}}module[_0xfa74('0x5')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index ca17fcf..29e3b19 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(_0xf84edc,_0x49f101){var _0x12c592=function(_0x4ee470){while(--_0x4ee470){_0xf84edc['push'](_0xf84edc['shift']());}};_0x12c592(++_0x49f101);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x28d6e6,_0x3814ba){var _0x242fe8=function(_0x1f451e){while(--_0x1f451e){_0x28d6e6['push'](_0x28d6e6['shift']());}};_0x242fe8(++_0x3814ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 c0d13a9..52239fb 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 _0xeb74=['request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register'];(function(_0xe38937,_0x54458d){var _0x3c912e=function(_0x3ef720){while(--_0x3ef720){_0xe38937['push'](_0xe38937['shift']());}};_0x3c912e(++_0x54458d);}(_0xeb74,0xe3));var _0x4eb7=function(_0x4d690b,_0x4aa5f8){_0x4d690b=_0x4d690b-0x0;var _0x3552aa=_0xeb74[_0x4d690b];return _0x3552aa;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});config[_0x4eb7('0xc')]=_['defaults'](config[_0x4eb7('0xc')],{'host':_0x4eb7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4eb7('0xe'))[_0x4eb7('0xf')](socket);function respondWithRpcPromise(_0x4b3add,_0xa72e98,_0x4ff98e){return new BPromise(function(_0x3326cd,_0x462392){return client[_0x4eb7('0x10')](_0x4b3add,_0x4ff98e)['then'](function(_0x2b32be){logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));logger[_0x4eb7('0x14')](_0x4eb7('0x15'),_0xa72e98,_0x4eb7('0x13'),JSON['stringify'](_0x2b32be));if(_0x2b32be['error']){if(_0x2b32be['error'][_0x4eb7('0x16')]===0x1f4){logger['error'](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x462392(_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);}logger[_0x4eb7('0x17')](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x3326cd(_0x2b32be[_0x4eb7('0x17')]['message']);}else{logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));_0x3326cd(_0x2b32be[_0x4eb7('0x19')][_0x4eb7('0x18')]);}})[_0x4eb7('0x1a')](function(_0x2d0ea7){logger[_0x4eb7('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0xa72e98,_0x2d0ea7);_0x462392(_0x2d0ea7);});});} \ No newline at end of file +var _0x1ba2=['http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var moment=require(_0x21ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x21ba('0x2'));var fs=require('fs');var Redis=require(_0x21ba('0x3'));var db=require(_0x21ba('0x4'))['db'];var utils=require(_0x21ba('0x5'));var logger=require(_0x21ba('0x6'))('rpc');var config=require(_0x21ba('0x7'));var jayson=require(_0x21ba('0x8'));var client=jayson['client'][_0x21ba('0x9')]({'port':0x232a});config['redis']=_[_0x21ba('0xa')](config[_0x21ba('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x21ba('0xc'))(new Redis(config['redis']));require(_0x21ba('0xd'))[_0x21ba('0xe')](socket);function respondWithRpcPromise(_0x48ddf3,_0x3063e9,_0x32393d){return new BPromise(function(_0x3926b5,_0x3512a2){return client[_0x21ba('0xf')](_0x48ddf3,_0x32393d)[_0x21ba('0x10')](function(_0x2953d2){logger[_0x21ba('0x11')](_0x21ba('0x12'),_0x3063e9,_0x21ba('0x13'));logger[_0x21ba('0x14')](_0x21ba('0x15'),_0x3063e9,'request\x20sent',JSON['stringify'](_0x2953d2));if(_0x2953d2[_0x21ba('0x16')]){if(_0x2953d2[_0x21ba('0x16')][_0x21ba('0x17')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3063e9,_0x2953d2[_0x21ba('0x16')]['message']);return _0x3512a2(_0x2953d2[_0x21ba('0x16')]['message']);}logger[_0x21ba('0x16')](_0x21ba('0x12'),_0x3063e9,_0x2953d2[_0x21ba('0x16')][_0x21ba('0x18')]);return _0x3926b5(_0x2953d2[_0x21ba('0x16')]['message']);}else{logger[_0x21ba('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x3063e9,_0x21ba('0x13'));_0x3926b5(_0x2953d2[_0x21ba('0x19')][_0x21ba('0x18')]);}})[_0x21ba('0x1a')](function(_0x305c05){logger[_0x21ba('0x16')](_0x21ba('0x12'),_0x3063e9,_0x305c05);_0x3512a2(_0x305c05);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fc3f096..72fc31b 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 _0x98e1=['update','removeListener','register','length','save','remove'];(function(_0x383658,_0x1cea99){var _0x26bfc7=function(_0x21b697){while(--_0x21b697){_0x383658['push'](_0x383658['shift']());}};_0x26bfc7(++_0x1cea99);}(_0x98e1,0x160));var _0x198e=function(_0x271e08,_0x52189a){_0x271e08=_0x271e08-0x0;var _0x4d4eca=_0x98e1[_0x271e08];return _0x4d4eca;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x198e('0x0'),_0x198e('0x1'),_0x198e('0x2')];function createListener(_0x1d1f36,_0x53fd68){return function(_0x300c4b){_0x53fd68['emit'](_0x1d1f36,_0x300c4b);};}function removeListener(_0x4a102f,_0x3bd989){return function(){OpenchannelAccountEvents[_0x198e('0x3')](_0x4a102f,_0x3bd989);};}exports[_0x198e('0x4')]=function(_0x317209){for(var _0x551d31=0x0,_0x545114=events[_0x198e('0x5')];_0x551d31<_0x545114;_0x551d31++){var _0x4d45d6=events[_0x551d31];var _0x3322c5=createListener('openchannelAccount:'+_0x4d45d6,_0x317209);OpenchannelAccountEvents['on'](_0x4d45d6,_0x3322c5);}}; \ No newline at end of file +var _0x3ae9=['register','length','openchannelAccount:','remove','update','emit'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x3ae9,0xdb));var _0x93ae=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x3ae9[_0x487b0c];return _0x1adbdc;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x93ae('0x0'),_0x93ae('0x1')];function createListener(_0x189f64,_0x4a724f){return function(_0x946abf){_0x4a724f[_0x93ae('0x2')](_0x189f64,_0x946abf);};}function removeListener(_0x2dc540,_0x2af5aa){return function(){OpenchannelAccountEvents['removeListener'](_0x2dc540,_0x2af5aa);};}exports[_0x93ae('0x3')]=function(_0x51e450){for(var _0x3a9a9c=0x0,_0x32564c=events[_0x93ae('0x4')];_0x3a9a9c<_0x32564c;_0x3a9a9c++){var _0x36e141=events[_0x3a9a9c];var _0x22761c=createListener(_0x93ae('0x5')+_0x36e141,_0x51e450);OpenchannelAccountEvents['on'](_0x36e141,_0x22761c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 665fe1c..09f7720 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 _0x637d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create','put','update','/:id','exports','util','path','connect-timeout','express','Router'];(function(_0x462853,_0x4b7272){var _0x27ca60=function(_0xaef816){while(--_0xaef816){_0x462853['push'](_0x462853['shift']());}};_0x27ca60(++_0x4b7272);}(_0x637d,0x181));var _0xd637=function(_0x371f3b,_0x4329cc){_0x371f3b=_0x371f3b-0x0;var _0x31287c=_0x637d[_0x371f3b];return _0x31287c;};'use strict';var multer=require('multer');var util=require(_0xd637('0x0'));var path=require(_0xd637('0x1'));var timeout=require(_0xd637('0x2'));var express=require(_0xd637('0x3'));var router=express[_0xd637('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd637('0x5'));var interaction=require(_0xd637('0x6'));var config=require(_0xd637('0x7'));var controller=require('./openchannelApplication.controller');router[_0xd637('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd637('0x8')]('/:id',auth[_0xd637('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd637('0xa')]);router[_0xd637('0xb')]('/:id',auth[_0xd637('0x9')](),controller[_0xd637('0xc')]);router['delete'](_0xd637('0xd'),auth[_0xd637('0x9')](),controller['destroy']);module[_0xd637('0xe')]=router; \ No newline at end of file +var _0x90dd=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x4df9bf,_0x31b340){var _0x285791=function(_0x4b49ef){while(--_0x4b49ef){_0x4df9bf['push'](_0x4df9bf['shift']());}};_0x285791(++_0x31b340);}(_0x90dd,0x80));var _0xd90d=function(_0x362795,_0x2c7301){_0x362795=_0x362795-0x0;var _0x591278=_0x90dd[_0x362795];return _0x591278;};'use strict';var multer=require(_0xd90d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd90d('0x1'));var express=require(_0xd90d('0x2'));var router=express[_0xd90d('0x3')]();var fs_extra=require(_0xd90d('0x4'));var auth=require(_0xd90d('0x5'));var interaction=require(_0xd90d('0x6'));var config=require(_0xd90d('0x7'));var controller=require(_0xd90d('0x8'));router[_0xd90d('0x9')]('/',auth['isAuthenticated'](),controller[_0xd90d('0xa')]);router['get'](_0xd90d('0xb'),auth[_0xd90d('0xc')](),controller[_0xd90d('0xd')]);router[_0xd90d('0xe')]('/',auth[_0xd90d('0xc')](),controller['create']);router[_0xd90d('0xf')](_0xd90d('0xb'),auth[_0xd90d('0xc')](),controller['update']);router['delete'](_0xd90d('0xb'),auth[_0xd90d('0xc')](),controller[_0xd90d('0x10')]);module[_0xd90d('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 fc98e5d..2b44fbc 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 _0xabde=['*,*,*,*','exports','INTEGER','noop','STRING'];(function(_0x58e39a,_0x474e33){var _0x5233f4=function(_0x3fa875){while(--_0x3fa875){_0x58e39a['push'](_0x58e39a['shift']());}};_0x5233f4(++_0x474e33);}(_0xabde,0x1c3));var _0xeabd=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xabde[_0x350aeb];return _0x3c5273;};'use strict';var Sequelize=require('sequelize');module[_0xeabd('0x0')]={'priority':{'type':Sequelize[_0xeabd('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xeabd('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeabd('0x4')}}; \ No newline at end of file +var _0xa3c5=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x454a5b,_0x42184b){var _0x2b7ad6=function(_0xa15ee1){while(--_0xa15ee1){_0x454a5b['push'](_0x454a5b['shift']());}};_0x2b7ad6(++_0x42184b);}(_0xa3c5,0x136));var _0x5a3c=function(_0x55e25c,_0x5de6a6){_0x55e25c=_0x55e25c-0x0;var _0xb42603=_0xa3c5[_0x55e25c];return _0xb42603;};'use strict';var Sequelize=require('sequelize');module[_0x5a3c('0x0')]={'priority':{'type':Sequelize[_0x5a3c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5a3c('0x2')],'allowNull':![],'defaultValue':_0x5a3c('0x3')},'appdata':{'type':Sequelize[_0x5a3c('0x4')]()},'description':{'type':Sequelize[_0x5a3c('0x2')]},'interval':{'type':Sequelize[_0x5a3c('0x2')],'defaultValue':_0x5a3c('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 95b848d..9e3d31f 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 _0xb00f=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4967d5,_0x1f9943){var _0x2d7559=function(_0x447936){while(--_0x447936){_0x4967d5['push'](_0x4967d5['shift']());}};_0x2d7559(++_0x1f9943);}(_0xb00f,0x111));var _0xfb00=function(_0x28cc72,_0x2c0643){_0x28cc72=_0x28cc72-0x0;var _0xed74ab=_0xb00f[_0x28cc72];return _0xed74ab;};'use strict';var emlformat=require(_0xfb00('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb00('0x1'));var rp=require(_0xfb00('0x2'));var moment=require(_0xfb00('0x3'));var BPromise=require(_0xfb00('0x4'));var Mustache=require('mustache');var util=require(_0xfb00('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfb00('0x6'));var ejs=require(_0xfb00('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb00('0x8'));var squel=require(_0xfb00('0x9'));var crypto=require(_0xfb00('0xa'));var jsforce=require(_0xfb00('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfb00('0x6'));var querystring=require(_0xfb00('0xc'));var Papa=require(_0xfb00('0xd'));var Redis=require(_0xfb00('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfb00('0xf'));var as=require(_0xfb00('0x10'));var hardwareService=require(_0xfb00('0x11'));var logger=require(_0xfb00('0x12'))(_0xfb00('0x13'));var utils=require(_0xfb00('0x14'));var config=require(_0xfb00('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb00('0x16'))['db'];function respondWithStatusCode(_0x171304,_0x2eaf5d){_0x2eaf5d=_0x2eaf5d||0xcc;return function(_0x429909){if(_0x429909){return _0x171304[_0xfb00('0x17')](_0x2eaf5d);}return _0x171304[_0xfb00('0x18')](_0x2eaf5d)[_0xfb00('0x19')]();};}function respondWithResult(_0x1540a8,_0x1d1f59){_0x1d1f59=_0x1d1f59||0xc8;return function(_0x268cb4){if(_0x268cb4){return _0x1540a8[_0xfb00('0x18')](_0x1d1f59)['json'](_0x268cb4);}};}function respondWithFilteredResult(_0x2f077f,_0x175d50){return function(_0x509ecf){if(_0x509ecf){var _0xbf1096=typeof _0x175d50[_0xfb00('0x1a')]==='undefined'&&typeof _0x175d50['limit']===_0xfb00('0x1b');var _0x2549ed=_0x509ecf['count'];var _0x3f1d2c=_0xbf1096?0x0:_0x175d50['offset'];var _0x41b134=_0xbf1096?_0x509ecf['count']:_0x175d50[_0xfb00('0x1a')]+_0x175d50['limit'];var _0x10817b;if(_0x41b134>=_0x2549ed){_0x41b134=_0x2549ed;_0x10817b=0xc8;}else{_0x10817b=0xce;}_0x2f077f[_0xfb00('0x18')](_0x10817b);return _0x2f077f[_0xfb00('0x1c')]('Content-Range',_0x3f1d2c+'-'+_0x41b134+'/'+_0x2549ed)[_0xfb00('0x1d')](_0x509ecf);}return null;};}function patchUpdates(_0x3f2246){return function(_0x4fee6b){try{jsonpatch[_0xfb00('0x1e')](_0x4fee6b,_0x3f2246,!![]);}catch(_0x1ff052){return BPromise[_0xfb00('0x1f')](_0x1ff052);}return _0x4fee6b[_0xfb00('0x20')]();};}function saveUpdates(_0x523878,_0x37e682){return function(_0x1ec38a){if(_0x1ec38a){return _0x1ec38a[_0xfb00('0x21')](_0x523878)[_0xfb00('0x22')](function(_0xdc201){return _0xdc201;});}return null;};}function removeEntity(_0x4b86a1,_0x31003f){return function(_0xb9ebfb){if(_0xb9ebfb){return _0xb9ebfb[_0xfb00('0x23')]()['then'](function(){_0x4b86a1[_0xfb00('0x18')](0xcc)[_0xfb00('0x19')]();});}};}function handleEntityNotFound(_0x53c5cf,_0x2e6bc5){return function(_0x14d1fb){if(!_0x14d1fb){_0x53c5cf['sendStatus'](0x194);}return _0x14d1fb;};}function handleError(_0x485b55,_0x42cfb0){_0x42cfb0=_0x42cfb0||0x1f4;return function(_0x310cad){logger['error'](_0x310cad[_0xfb00('0x24')]);if(_0x310cad[_0xfb00('0x25')]){delete _0x310cad[_0xfb00('0x25')];}_0x485b55[_0xfb00('0x18')](_0x42cfb0)[_0xfb00('0x26')](_0x310cad);};}exports[_0xfb00('0x27')]=function(_0x2493b0,_0x228979){var _0x169bf2={},_0x2bd169={},_0x273e6f={'count':0x0,'rows':[]};var _0x10ec56=_[_0xfb00('0x28')](db[_0xfb00('0x29')]['rawAttributes'],function(_0x26adcb){return{'name':_0x26adcb[_0xfb00('0x2a')],'type':_0x26adcb[_0xfb00('0x2b')][_0xfb00('0x2c')]};});_0x2bd169[_0xfb00('0x2d')]=_[_0xfb00('0x28')](_0x10ec56,'name');_0x2bd169[_0xfb00('0x2e')]=_[_0xfb00('0x2f')](_0x2493b0[_0xfb00('0x2e')]);_0x2bd169[_0xfb00('0x30')]=_[_0xfb00('0x31')](_0x2bd169[_0xfb00('0x2d')],_0x2bd169[_0xfb00('0x2e')]);_0x169bf2[_0xfb00('0x32')]=_[_0xfb00('0x31')](_0x2bd169[_0xfb00('0x2d')],qs[_0xfb00('0x33')](_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x33')]));_0x169bf2[_0xfb00('0x32')]=_0x169bf2['attributes'][_0xfb00('0x34')]?_0x169bf2['attributes']:_0x2bd169['model'];if(!_0x2493b0['query']['hasOwnProperty']('nolimit')){_0x169bf2[_0xfb00('0x35')]=qs[_0xfb00('0x35')](_0x2493b0[_0xfb00('0x2e')]['limit']);_0x169bf2[_0xfb00('0x1a')]=qs[_0xfb00('0x1a')](_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x1a')]);}_0x169bf2[_0xfb00('0x36')]=qs[_0xfb00('0x37')](_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x37')]);_0x169bf2[_0xfb00('0x38')]=qs[_0xfb00('0x30')](_[_0xfb00('0x39')](_0x2493b0[_0xfb00('0x2e')],_0x2bd169[_0xfb00('0x30')]),_0x10ec56);if(_0x2493b0[_0xfb00('0x2e')]['filter']){_0x169bf2[_0xfb00('0x38')]=_[_0xfb00('0x3a')](_0x169bf2[_0xfb00('0x38')],{'$or':_[_0xfb00('0x28')](_0x10ec56,function(_0x28a73c){if(_0x28a73c[_0xfb00('0x2b')]!=='VIRTUAL'){var _0x3da173={};_0x3da173[_0x28a73c[_0xfb00('0x25')]]={'$like':'%'+_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x3b')]+'%'};return _0x3da173;}})});}_0x169bf2=_[_0xfb00('0x3a')]({},_0x169bf2,_0x2493b0[_0xfb00('0x3c')]);var _0x445572={'where':_0x169bf2[_0xfb00('0x38')]};return db[_0xfb00('0x29')][_0xfb00('0x3d')](_0x445572)[_0xfb00('0x22')](function(_0x5e44d0){_0x273e6f[_0xfb00('0x3d')]=_0x5e44d0;if(_0x2493b0[_0xfb00('0x2e')][_0xfb00('0x3e')]){_0x169bf2[_0xfb00('0x3f')]=[{'all':!![]}];}return db[_0xfb00('0x29')][_0xfb00('0x40')](_0x169bf2);})[_0xfb00('0x22')](function(_0x438f9e){_0x273e6f[_0xfb00('0x41')]=_0x438f9e;return _0x273e6f;})[_0xfb00('0x22')](respondWithFilteredResult(_0x228979,_0x169bf2))['catch'](handleError(_0x228979,null));};exports[_0xfb00('0x42')]=function(_0x3cdd84,_0x62570d){var _0x246786={'raw':!![],'where':{'id':_0x3cdd84[_0xfb00('0x43')]['id']}},_0x38e9ea={};_0x38e9ea[_0xfb00('0x2d')]=_[_0xfb00('0x2f')](db[_0xfb00('0x29')][_0xfb00('0x44')]);_0x38e9ea[_0xfb00('0x2e')]=_[_0xfb00('0x2f')](_0x3cdd84[_0xfb00('0x2e')]);_0x38e9ea[_0xfb00('0x30')]=_[_0xfb00('0x31')](_0x38e9ea['model'],_0x38e9ea[_0xfb00('0x2e')]);_0x246786[_0xfb00('0x32')]=_['intersection'](_0x38e9ea['model'],qs[_0xfb00('0x33')](_0x3cdd84[_0xfb00('0x2e')][_0xfb00('0x33')]));_0x246786['attributes']=_0x246786[_0xfb00('0x32')]['length']?_0x246786['attributes']:_0x38e9ea['model'];if(_0x3cdd84[_0xfb00('0x2e')][_0xfb00('0x3e')]){_0x246786[_0xfb00('0x3f')]=[{'all':!![]}];}_0x246786=_['merge']({},_0x246786,_0x3cdd84[_0xfb00('0x3c')]);return db[_0xfb00('0x29')][_0xfb00('0x45')](_0x246786)[_0xfb00('0x22')](handleEntityNotFound(_0x62570d,null))[_0xfb00('0x22')](respondWithResult(_0x62570d,null))['catch'](handleError(_0x62570d,null));};exports[_0xfb00('0x46')]=function(_0x267b52,_0x34f8a0){return db[_0xfb00('0x29')]['create'](_0x267b52[_0xfb00('0x47')],{})[_0xfb00('0x22')](respondWithResult(_0x34f8a0,0xc9))[_0xfb00('0x48')](handleError(_0x34f8a0,null));};exports[_0xfb00('0x21')]=function(_0x40d3fe,_0x4ee8d6){if(_0x40d3fe[_0xfb00('0x47')]['id']){delete _0x40d3fe[_0xfb00('0x47')]['id'];}return db['OpenchannelApplication'][_0xfb00('0x45')]({'where':{'id':_0x40d3fe[_0xfb00('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ee8d6,null))['then'](saveUpdates(_0x40d3fe[_0xfb00('0x47')],null))['then'](respondWithResult(_0x4ee8d6,null))[_0xfb00('0x48')](handleError(_0x4ee8d6,null));};exports[_0xfb00('0x23')]=function(_0x174887,_0x584425){return db['OpenchannelApplication'][_0xfb00('0x45')]({'where':{'id':_0x174887['params']['id']}})['then'](handleEntityNotFound(_0x584425,null))[_0xfb00('0x22')](removeEntity(_0x584425,null))['catch'](handleError(_0x584425,null));}; \ No newline at end of file +var _0x537a=['count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','OpenchannelApplication','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','limit','undefined'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x537a,0x1a3));var _0xa537=function(_0x4a6491,_0x4fc1de){_0x4a6491=_0x4a6491-0x0;var _0x1edf88=_0x537a[_0x4a6491];return _0x1edf88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa537('0x0'));var zipdir=require(_0xa537('0x1'));var jsonpatch=require(_0xa537('0x2'));var rp=require(_0xa537('0x3'));var moment=require(_0xa537('0x4'));var BPromise=require(_0xa537('0x5'));var Mustache=require('mustache');var util=require(_0xa537('0x6'));var path=require(_0xa537('0x7'));var sox=require(_0xa537('0x8'));var csv=require(_0xa537('0x9'));var ejs=require(_0xa537('0xa'));var fs=require('fs');var fs_extra=require(_0xa537('0xb'));var _=require(_0xa537('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa537('0xd'));var deskjs=require(_0xa537('0xe'));var toCsv=require(_0xa537('0x9'));var querystring=require(_0xa537('0xf'));var Papa=require(_0xa537('0x10'));var Redis=require(_0xa537('0x11'));var authService=require(_0xa537('0x12'));var qs=require(_0xa537('0x13'));var as=require(_0xa537('0x14'));var hardwareService=require(_0xa537('0x15'));var logger=require(_0xa537('0x16'))(_0xa537('0x17'));var utils=require(_0xa537('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa537('0x19'));var db=require(_0xa537('0x1a'))['db'];function respondWithStatusCode(_0x12b59f,_0x31dd68){_0x31dd68=_0x31dd68||0xcc;return function(_0x2b06b1){if(_0x2b06b1){return _0x12b59f[_0xa537('0x1b')](_0x31dd68);}return _0x12b59f['status'](_0x31dd68)['end']();};}function respondWithResult(_0x541587,_0x1d10c2){_0x1d10c2=_0x1d10c2||0xc8;return function(_0x474596){if(_0x474596){return _0x541587['status'](_0x1d10c2)[_0xa537('0x1c')](_0x474596);}};}function respondWithFilteredResult(_0x440090,_0x11e7c5){return function(_0x3db95d){if(_0x3db95d){var _0x395054=typeof _0x11e7c5['offset']==='undefined'&&typeof _0x11e7c5[_0xa537('0x1d')]===_0xa537('0x1e');var _0x5959d2=_0x3db95d[_0xa537('0x1f')];var _0x196e7a=_0x395054?0x0:_0x11e7c5['offset'];var _0x4c955b=_0x395054?_0x3db95d[_0xa537('0x1f')]:_0x11e7c5[_0xa537('0x20')]+_0x11e7c5[_0xa537('0x1d')];var _0x455655;if(_0x4c955b>=_0x5959d2){_0x4c955b=_0x5959d2;_0x455655=0xc8;}else{_0x455655=0xce;}_0x440090[_0xa537('0x21')](_0x455655);return _0x440090[_0xa537('0x22')](_0xa537('0x23'),_0x196e7a+'-'+_0x4c955b+'/'+_0x5959d2)['json'](_0x3db95d);}return null;};}function patchUpdates(_0x53a6d2){return function(_0x3fcc68){try{jsonpatch[_0xa537('0x24')](_0x3fcc68,_0x53a6d2,!![]);}catch(_0x9b8861){return BPromise[_0xa537('0x25')](_0x9b8861);}return _0x3fcc68[_0xa537('0x26')]();};}function saveUpdates(_0x1389a6,_0x99b988){return function(_0x2a8f31){if(_0x2a8f31){return _0x2a8f31[_0xa537('0x27')](_0x1389a6)[_0xa537('0x28')](function(_0x194935){return _0x194935;});}return null;};}function removeEntity(_0x350be6,_0x11c081){return function(_0x40de7c){if(_0x40de7c){return _0x40de7c[_0xa537('0x29')]()[_0xa537('0x28')](function(){_0x350be6['status'](0xcc)[_0xa537('0x2a')]();});}};}function handleEntityNotFound(_0x3c7cc4,_0x3b1698){return function(_0x1f8031){if(!_0x1f8031){_0x3c7cc4[_0xa537('0x1b')](0x194);}return _0x1f8031;};}function handleError(_0x43104b,_0x5acbc4){_0x5acbc4=_0x5acbc4||0x1f4;return function(_0x1dd63a){logger['error'](_0x1dd63a['stack']);if(_0x1dd63a[_0xa537('0x2b')]){delete _0x1dd63a[_0xa537('0x2b')];}_0x43104b['status'](_0x5acbc4)[_0xa537('0x2c')](_0x1dd63a);};}exports[_0xa537('0x2d')]=function(_0x14cdc0,_0x34d5ec){var _0x253500={},_0x14a816={},_0x2032e3={'count':0x0,'rows':[]};var _0x5afbd8=_[_0xa537('0x2e')](db['OpenchannelApplication'][_0xa537('0x2f')],function(_0x476330){return{'name':_0x476330['fieldName'],'type':_0x476330['type']['key']};});_0x14a816[_0xa537('0x30')]=_['map'](_0x5afbd8,_0xa537('0x2b'));_0x14a816[_0xa537('0x31')]=_[_0xa537('0x32')](_0x14cdc0[_0xa537('0x31')]);_0x14a816[_0xa537('0x33')]=_[_0xa537('0x34')](_0x14a816[_0xa537('0x30')],_0x14a816[_0xa537('0x31')]);_0x253500[_0xa537('0x35')]=_['intersection'](_0x14a816['model'],qs[_0xa537('0x36')](_0x14cdc0['query'][_0xa537('0x36')]));_0x253500[_0xa537('0x35')]=_0x253500[_0xa537('0x35')][_0xa537('0x37')]?_0x253500['attributes']:_0x14a816['model'];if(!_0x14cdc0[_0xa537('0x31')][_0xa537('0x38')]('nolimit')){_0x253500[_0xa537('0x1d')]=qs[_0xa537('0x1d')](_0x14cdc0[_0xa537('0x31')][_0xa537('0x1d')]);_0x253500['offset']=qs[_0xa537('0x20')](_0x14cdc0['query']['offset']);}_0x253500['order']=qs['sort'](_0x14cdc0[_0xa537('0x31')][_0xa537('0x39')]);_0x253500[_0xa537('0x3a')]=qs[_0xa537('0x33')](_['pick'](_0x14cdc0[_0xa537('0x31')],_0x14a816[_0xa537('0x33')]),_0x5afbd8);if(_0x14cdc0[_0xa537('0x31')][_0xa537('0x3b')]){_0x253500[_0xa537('0x3a')]=_['merge'](_0x253500['where'],{'$or':_[_0xa537('0x2e')](_0x5afbd8,function(_0x3fcfce){if(_0x3fcfce[_0xa537('0x3c')]!==_0xa537('0x3d')){var _0x43fb67={};_0x43fb67[_0x3fcfce[_0xa537('0x2b')]]={'$like':'%'+_0x14cdc0[_0xa537('0x31')][_0xa537('0x3b')]+'%'};return _0x43fb67;}})});}_0x253500=_[_0xa537('0x3e')]({},_0x253500,_0x14cdc0[_0xa537('0x3f')]);var _0x116184={'where':_0x253500[_0xa537('0x3a')]};return db[_0xa537('0x40')]['count'](_0x116184)[_0xa537('0x28')](function(_0x27fdbc){_0x2032e3[_0xa537('0x1f')]=_0x27fdbc;if(_0x14cdc0[_0xa537('0x31')][_0xa537('0x41')]){_0x253500['include']=[{'all':!![]}];}return db[_0xa537('0x40')][_0xa537('0x42')](_0x253500);})['then'](function(_0x30cf39){_0x2032e3[_0xa537('0x43')]=_0x30cf39;return _0x2032e3;})[_0xa537('0x28')](respondWithFilteredResult(_0x34d5ec,_0x253500))[_0xa537('0x44')](handleError(_0x34d5ec,null));};exports[_0xa537('0x45')]=function(_0x56069e,_0x3bbcb0){var _0xa4763e={'raw':!![],'where':{'id':_0x56069e[_0xa537('0x46')]['id']}},_0x24fbdc={};_0x24fbdc[_0xa537('0x30')]=_[_0xa537('0x32')](db[_0xa537('0x40')][_0xa537('0x2f')]);_0x24fbdc[_0xa537('0x31')]=_['keys'](_0x56069e['query']);_0x24fbdc[_0xa537('0x33')]=_[_0xa537('0x34')](_0x24fbdc[_0xa537('0x30')],_0x24fbdc[_0xa537('0x31')]);_0xa4763e[_0xa537('0x35')]=_[_0xa537('0x34')](_0x24fbdc[_0xa537('0x30')],qs[_0xa537('0x36')](_0x56069e['query']['fields']));_0xa4763e[_0xa537('0x35')]=_0xa4763e[_0xa537('0x35')]['length']?_0xa4763e[_0xa537('0x35')]:_0x24fbdc['model'];if(_0x56069e[_0xa537('0x31')][_0xa537('0x41')]){_0xa4763e[_0xa537('0x47')]=[{'all':!![]}];}_0xa4763e=_[_0xa537('0x3e')]({},_0xa4763e,_0x56069e[_0xa537('0x3f')]);return db[_0xa537('0x40')][_0xa537('0x48')](_0xa4763e)['then'](handleEntityNotFound(_0x3bbcb0,null))[_0xa537('0x28')](respondWithResult(_0x3bbcb0,null))[_0xa537('0x44')](handleError(_0x3bbcb0,null));};exports[_0xa537('0x49')]=function(_0x6b5354,_0x106c99){return db[_0xa537('0x40')][_0xa537('0x49')](_0x6b5354[_0xa537('0x4a')],{})[_0xa537('0x28')](respondWithResult(_0x106c99,0xc9))['catch'](handleError(_0x106c99,null));};exports['update']=function(_0x3d541e,_0x4ef067){if(_0x3d541e[_0xa537('0x4a')]['id']){delete _0x3d541e[_0xa537('0x4a')]['id'];}return db[_0xa537('0x40')]['find']({'where':{'id':_0x3d541e[_0xa537('0x46')]['id']}})[_0xa537('0x28')](handleEntityNotFound(_0x4ef067,null))[_0xa537('0x28')](saveUpdates(_0x3d541e[_0xa537('0x4a')],null))['then'](respondWithResult(_0x4ef067,null))[_0xa537('0x44')](handleError(_0x4ef067,null));};exports[_0xa537('0x29')]=function(_0x1b70b6,_0x1ad9ea){return db[_0xa537('0x40')][_0xa537('0x48')]({'where':{'id':_0x1b70b6[_0xa537('0x46')]['id']}})[_0xa537('0x28')](handleEntityNotFound(_0x1ad9ea,null))[_0xa537('0x28')](removeEntity(_0x1ad9ea,null))[_0xa537('0x44')](handleError(_0x1ad9ea,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 60532f0..c294d0f 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 _0x2eee=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x54a816,_0x24f7b6){var _0x35b0d9=function(_0x24a431){while(--_0x24a431){_0x54a816['push'](_0x54a816['shift']());}};_0x35b0d9(++_0x24f7b6);}(_0x2eee,0x1bb));var _0xe2ee=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x2eee[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0xe2ee('0x0'));var util=require('util');var logger=require(_0xe2ee('0x1'))(_0xe2ee('0x2'));var moment=require(_0xe2ee('0x3'));var BPromise=require(_0xe2ee('0x4'));var rp=require(_0xe2ee('0x5'));var fs=require('fs');var path=require(_0xe2ee('0x6'));var rimraf=require(_0xe2ee('0x7'));var config=require(_0xe2ee('0x8'));var attributes=require(_0xe2ee('0x9'));module[_0xe2ee('0xa')]=function(_0x3bedfe,_0x1f2959){return _0x3bedfe['define']('OpenchannelApplication',attributes,{'tableName':_0xe2ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2ee('0xc'),'collate':_0xe2ee('0xd')});}; \ No newline at end of file +var _0xdda2=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x2b9c8e,_0x481857){var _0x3e6953=function(_0x3a3dda){while(--_0x3a3dda){_0x2b9c8e['push'](_0x2b9c8e['shift']());}};_0x3e6953(++_0x481857);}(_0xdda2,0x106));var _0x2dda=function(_0x295b80,_0x3bf87d){_0x295b80=_0x295b80-0x0;var _0xfc29b6=_0xdda2[_0x295b80];return _0xfc29b6;};'use strict';var _=require('lodash');var util=require(_0x2dda('0x0'));var logger=require(_0x2dda('0x1'))(_0x2dda('0x2'));var moment=require(_0x2dda('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2dda('0x4'));var rimraf=require(_0x2dda('0x5'));var config=require(_0x2dda('0x6'));var attributes=require(_0x2dda('0x7'));module[_0x2dda('0x8')]=function(_0x477894,_0x5eeb16){return _0x477894[_0x2dda('0x9')](_0x2dda('0xa'),attributes,{'tableName':_0x2dda('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dda('0xc'),'collate':_0x2dda('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index c91da39..00aff28 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 _0xb286=['code','message','result','catch','OpenchannelApplication','update','body','options','raw','limit','debug','UpdateOpenchannelApplication','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x586bd5,_0x329cd1){var _0x395059=function(_0x18c82f){while(--_0x18c82f){_0x586bd5['push'](_0x586bd5['shift']());}};_0x395059(++_0x329cd1);}(_0xb286,0xff));var _0x6b28=function(_0x2cc6dc,_0x2a8398){_0x2cc6dc=_0x2cc6dc-0x0;var _0xa740e2=_0xb286[_0x2cc6dc];return _0xa740e2;};'use strict';var _=require(_0x6b28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b28('0x1'));var fs=require('fs');var Redis=require(_0x6b28('0x2'));var db=require(_0x6b28('0x3'))['db'];var utils=require(_0x6b28('0x4'));var logger=require(_0x6b28('0x5'))(_0x6b28('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6b28('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a107d,_0x3675ed,_0xabe953){return new BPromise(function(_0x5ba72d,_0x527446){return client['request'](_0x5a107d,_0xabe953)[_0x6b28('0x8')](function(_0x523352){logger[_0x6b28('0x9')](_0x6b28('0xa'),_0x3675ed,_0x6b28('0xb'));logger['debug'](_0x6b28('0xc'),_0x3675ed,_0x6b28('0xb'),JSON[_0x6b28('0xd')](_0x523352));if(_0x523352[_0x6b28('0xe')]){if(_0x523352[_0x6b28('0xe')][_0x6b28('0xf')]===0x1f4){logger['error'](_0x6b28('0xa'),_0x3675ed,_0x523352['error']['message']);return _0x527446(_0x523352[_0x6b28('0xe')][_0x6b28('0x10')]);}logger[_0x6b28('0xe')](_0x6b28('0xa'),_0x3675ed,_0x523352[_0x6b28('0xe')][_0x6b28('0x10')]);return _0x5ba72d(_0x523352['error'][_0x6b28('0x10')]);}else{logger['info'](_0x6b28('0xa'),_0x3675ed,'request\x20sent');_0x5ba72d(_0x523352[_0x6b28('0x11')][_0x6b28('0x10')]);}})[_0x6b28('0x12')](function(_0x1d46dc){logger[_0x6b28('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x3675ed,_0x1d46dc);_0x527446(_0x1d46dc);});});}exports['UpdateOpenchannelApplication']=function(_0x563222){var _0x1a9677=this;return new Promise(function(_0x5327c9,_0x452d48){return db[_0x6b28('0x13')][_0x6b28('0x14')](_0x563222[_0x6b28('0x15')],{'raw':_0x563222['options']?_0x563222[_0x6b28('0x16')][_0x6b28('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563222['options']?_0x563222[_0x6b28('0x16')]['where']||null:null,'attributes':_0x563222[_0x6b28('0x16')]?_0x563222[_0x6b28('0x16')]['attributes']||null:null,'limit':_0x563222[_0x6b28('0x16')]?_0x563222[_0x6b28('0x16')][_0x6b28('0x18')]||null:null})[_0x6b28('0x8')](function(_0x3d5be8){logger[_0x6b28('0x9')]('UpdateOpenchannelApplication',_0x563222);logger[_0x6b28('0x19')](_0x6b28('0x1a'),_0x563222,JSON[_0x6b28('0xd')](_0x3d5be8));_0x5327c9(_0x3d5be8);})[_0x6b28('0x12')](function(_0x19aef3){logger[_0x6b28('0xe')](_0x6b28('0x1a'),_0x19aef3[_0x6b28('0x10')],_0x563222);_0x452d48(_0x1a9677['error'](0x1f4,_0x19aef3[_0x6b28('0x10')]));});});}; \ No newline at end of file +var _0x195f=['raw','where','limit','UpdateOpenchannelApplication','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','OpenchannelApplication','body','options'];(function(_0x64b974,_0x3de08c){var _0x65eb42=function(_0x5200b2){while(--_0x5200b2){_0x64b974['push'](_0x64b974['shift']());}};_0x65eb42(++_0x3de08c);}(_0x195f,0x113));var _0xf195=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x195f[_0x576d8a];return _0x3dc3ef;};'use strict';var _=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var moment=require('moment');var BPromise=require(_0xf195('0x2'));var rs=require(_0xf195('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf195('0x5'))(_0xf195('0x6'));var config=require(_0xf195('0x7'));var jayson=require(_0xf195('0x8'));var client=jayson[_0xf195('0x9')][_0xf195('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2770db,_0x59d783,_0x5eac33){return new BPromise(function(_0x327cc3,_0x15d465){return client[_0xf195('0xb')](_0x2770db,_0x5eac33)[_0xf195('0xc')](function(_0x7b3e6f){logger[_0xf195('0xd')](_0xf195('0xe'),_0x59d783,'request\x20sent');logger[_0xf195('0xf')](_0xf195('0x10'),_0x59d783,_0xf195('0x11'),JSON['stringify'](_0x7b3e6f));if(_0x7b3e6f[_0xf195('0x12')]){if(_0x7b3e6f[_0xf195('0x12')][_0xf195('0x13')]===0x1f4){logger[_0xf195('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x59d783,_0x7b3e6f[_0xf195('0x12')][_0xf195('0x14')]);return _0x15d465(_0x7b3e6f['error'][_0xf195('0x14')]);}logger['error'](_0xf195('0xe'),_0x59d783,_0x7b3e6f[_0xf195('0x12')][_0xf195('0x14')]);return _0x327cc3(_0x7b3e6f[_0xf195('0x12')][_0xf195('0x14')]);}else{logger[_0xf195('0xd')](_0xf195('0xe'),_0x59d783,_0xf195('0x11'));_0x327cc3(_0x7b3e6f['result']['message']);}})[_0xf195('0x15')](function(_0x3ad05f){logger[_0xf195('0x12')](_0xf195('0xe'),_0x59d783,_0x3ad05f);_0x15d465(_0x3ad05f);});});}exports['UpdateOpenchannelApplication']=function(_0x374fc6){var _0x1ae33e=this;return new Promise(function(_0x5cf7dc,_0x452931){return db[_0xf195('0x16')]['update'](_0x374fc6[_0xf195('0x17')],{'raw':_0x374fc6[_0xf195('0x18')]?_0x374fc6['options'][_0xf195('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374fc6[_0xf195('0x18')]?_0x374fc6[_0xf195('0x18')][_0xf195('0x1a')]||null:null,'attributes':_0x374fc6['options']?_0x374fc6['options']['attributes']||null:null,'limit':_0x374fc6[_0xf195('0x18')]?_0x374fc6[_0xf195('0x18')][_0xf195('0x1b')]||null:null})[_0xf195('0xc')](function(_0x1c72f5){logger[_0xf195('0xd')](_0xf195('0x1c'),_0x374fc6);logger[_0xf195('0xf')](_0xf195('0x1c'),_0x374fc6,JSON[_0xf195('0x1d')](_0x1c72f5));_0x5cf7dc(_0x1c72f5);})[_0xf195('0x15')](function(_0x1481ae){logger['error'](_0xf195('0x1c'),_0x1481ae[_0xf195('0x14')],_0x374fc6);_0x452931(_0x1ae33e[_0xf195('0x12')](0x1f4,_0x1481ae[_0xf195('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 700d6ae..e758e58 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 _0x1f05=['describe','show','getMessages','/:id/download','download','post','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','/:id','tracked','openchannelinteraction:update','update','destroy','delete','/:id/tags','removeTags','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe'];(function(_0x3df204,_0x43e85b){var _0x1436bd=function(_0x4c8822){while(--_0x4c8822){_0x3df204['push'](_0x3df204['shift']());}};_0x1436bd(++_0x43e85b);}(_0x1f05,0x12b));var _0x51f0=function(_0x5be7df,_0x7633eb){_0x5be7df=_0x5be7df-0x0;var _0x2379c7=_0x1f05[_0x5be7df];return _0x2379c7;};'use strict';var multer=require('multer');var util=require(_0x51f0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51f0('0x1'));var router=express[_0x51f0('0x2')]();var fs_extra=require(_0x51f0('0x3'));var auth=require(_0x51f0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x51f0('0x5'));var controller=require(_0x51f0('0x6'));router['get']('/',auth[_0x51f0('0x7')](),controller[_0x51f0('0x8')]);router[_0x51f0('0x9')](_0x51f0('0xa'),auth[_0x51f0('0x7')](),controller[_0x51f0('0xb')]);router[_0x51f0('0x9')]('/:id',auth[_0x51f0('0x7')](),controller[_0x51f0('0xc')]);router[_0x51f0('0x9')]('/:id/messages',auth[_0x51f0('0x7')](),controller[_0x51f0('0xd')]);router[_0x51f0('0x9')](_0x51f0('0xe'),auth[_0x51f0('0x7')](),controller[_0x51f0('0xf')]);router['post']('/',auth[_0x51f0('0x7')](),controller['create']);router[_0x51f0('0x10')]('/:id/messages',auth[_0x51f0('0x7')](),controller[_0x51f0('0x11')]);router['post']('/:id/tags',auth[_0x51f0('0x7')](),interaction['tracked'](_0x51f0('0x12'),_0x51f0('0x13')),controller[_0x51f0('0x14')]);router[_0x51f0('0x15')](_0x51f0('0x16'),auth[_0x51f0('0x7')](),interaction[_0x51f0('0x17')](_0x51f0('0x12'),_0x51f0('0x18')),controller[_0x51f0('0x19')]);router['delete']('/:id',auth[_0x51f0('0x7')](),interaction[_0x51f0('0x17')](_0x51f0('0x12'),'openchannelinteraction:destroy'),controller[_0x51f0('0x1a')]);router[_0x51f0('0x1b')](_0x51f0('0x1c'),auth[_0x51f0('0x7')](),controller[_0x51f0('0x1d')]);module[_0x51f0('0x1e')]=router; \ No newline at end of file +var _0x8fe6=['../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','addTags','put','/:id','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x5f1351,_0x27cf33){var _0x322b44=function(_0x404599){while(--_0x404599){_0x5f1351['push'](_0x5f1351['shift']());}};_0x322b44(++_0x27cf33);}(_0x8fe6,0x14f));var _0x68fe=function(_0x4f3cd1,_0x4b666e){_0x4f3cd1=_0x4f3cd1-0x0;var _0x4f304d=_0x8fe6[_0x4f3cd1];return _0x4f304d;};'use strict';var multer=require(_0x68fe('0x0'));var util=require(_0x68fe('0x1'));var path=require(_0x68fe('0x2'));var timeout=require(_0x68fe('0x3'));var express=require(_0x68fe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x68fe('0x5'));var config=require(_0x68fe('0x6'));var controller=require(_0x68fe('0x7'));router[_0x68fe('0x8')]('/',auth[_0x68fe('0x9')](),controller[_0x68fe('0xa')]);router[_0x68fe('0x8')](_0x68fe('0xb'),auth[_0x68fe('0x9')](),controller[_0x68fe('0xc')]);router[_0x68fe('0x8')]('/:id',auth[_0x68fe('0x9')](),controller[_0x68fe('0xd')]);router[_0x68fe('0x8')](_0x68fe('0xe'),auth[_0x68fe('0x9')](),controller[_0x68fe('0xf')]);router['get'](_0x68fe('0x10'),auth[_0x68fe('0x9')](),controller[_0x68fe('0x11')]);router[_0x68fe('0x12')]('/',auth[_0x68fe('0x9')](),controller['create']);router[_0x68fe('0x12')](_0x68fe('0xe'),auth[_0x68fe('0x9')](),controller[_0x68fe('0x13')]);router[_0x68fe('0x12')](_0x68fe('0x14'),auth[_0x68fe('0x9')](),interaction[_0x68fe('0x15')](_0x68fe('0x16'),'openchannelinteraction:addtags'),controller[_0x68fe('0x17')]);router[_0x68fe('0x18')](_0x68fe('0x19'),auth[_0x68fe('0x9')](),interaction[_0x68fe('0x15')]('openchannel','openchannelinteraction:update'),controller[_0x68fe('0x1a')]);router[_0x68fe('0x1b')]('/:id',auth[_0x68fe('0x9')](),interaction[_0x68fe('0x15')](_0x68fe('0x16'),_0x68fe('0x1c')),controller[_0x68fe('0x1d')]);router[_0x68fe('0x1b')](_0x68fe('0x14'),auth[_0x68fe('0x9')](),controller[_0x68fe('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index b0e211a..020b388 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 _0x383a=['DATE','ENUM','out','exports','BOOLEAN','STRING'];(function(_0x26637e,_0x376e3b){var _0x17583d=function(_0x263f6b){while(--_0x263f6b){_0x26637e['push'](_0x26637e['shift']());}};_0x17583d(++_0x376e3b);}(_0x383a,0x1ad));var _0xa383=function(_0x2b70bd,_0x2e39d2){_0x2b70bd=_0x2b70bd-0x0;var _0x4cd986=_0x383a[_0x2b70bd];return _0x4cd986;};'use strict';var Sequelize=require('sequelize');module[_0xa383('0x0')]={'closed':{'type':Sequelize[_0xa383('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa383('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa383('0x2')]},'read1stAt':{'type':Sequelize[_0xa383('0x3')]},'threadId':{'type':Sequelize[_0xa383('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa383('0x4')]('in',_0xa383('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa383('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xca66=['BOOLEAN','sequelize','DATE','STRING','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca66,0x8b));var _0x6ca6=function(_0x17dd6e,_0x343e73){_0x17dd6e=_0x17dd6e-0x0;var _0x37693a=_0xca66[_0x17dd6e];return _0x37693a;};'use strict';var Sequelize=require(_0x6ca6('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6ca6('0x1')]},'disposition':{'type':Sequelize[_0x6ca6('0x2')]},'secondDisposition':{'type':Sequelize[_0x6ca6('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6ca6('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6ca6('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x6ca6('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x6ca6('0x3')]('in',_0x6ca6('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6ca6('0x3')]('in',_0x6ca6('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6ca6('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x6ca6('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 38ee468..46bd408 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 _0xfd1c=['Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','Users','map','TagIds','Tags','split','catch','answered','unmanaged','total','closed','UserId','talking','waiting','index','OpenchannelInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','text','body','buildExpression','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','params','includeAll','include','create','update','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','findAll','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Owner','mkdirSync','Openchannel','closedAt','disposition','threadId'];(function(_0x3d3cfe,_0x2afef7){var _0x33d6b5=function(_0x3cb86e){while(--_0x3cb86e){_0x3d3cfe['push'](_0x3d3cfe['shift']());}};_0x33d6b5(++_0x2afef7);}(_0xfd1c,0x107));var _0xcfd1=function(_0x3778d8,_0x5ce417){_0x3778d8=_0x3778d8-0x0;var _0x45a1b3=_0xfd1c[_0x3778d8];return _0x45a1b3;};'use strict';var emlformat=require(_0xcfd1('0x0'));var rimraf=require(_0xcfd1('0x1'));var zipdir=require(_0xcfd1('0x2'));var jsonpatch=require(_0xcfd1('0x3'));var rp=require(_0xcfd1('0x4'));var moment=require(_0xcfd1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfd1('0x6'));var path=require('path');var sox=require(_0xcfd1('0x7'));var csv=require(_0xcfd1('0x8'));var ejs=require(_0xcfd1('0x9'));var fs=require('fs');var fs_extra=require(_0xcfd1('0xa'));var _=require(_0xcfd1('0xb'));var squel=require(_0xcfd1('0xc'));var crypto=require('crypto');var jsforce=require(_0xcfd1('0xd'));var deskjs=require(_0xcfd1('0xe'));var toCsv=require(_0xcfd1('0x8'));var querystring=require(_0xcfd1('0xf'));var Papa=require(_0xcfd1('0x10'));var Redis=require(_0xcfd1('0x11'));var authService=require(_0xcfd1('0x12'));var qs=require(_0xcfd1('0x13'));var as=require(_0xcfd1('0x14'));var pdf=require(_0xcfd1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfd1('0x16'))(_0xcfd1('0x17'));var utils=require(_0xcfd1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcfd1('0x19'));var db=require(_0xcfd1('0x1a'))['db'];config[_0xcfd1('0x1b')]=_[_0xcfd1('0x1c')](config['redis'],{'host':_0xcfd1('0x1d'),'port':0x18eb});var socket=require(_0xcfd1('0x1e'))(new Redis(config['redis']));require(_0xcfd1('0x1f'))['register'](socket);function respondWithStatusCode(_0x33166f,_0x2b6312){_0x2b6312=_0x2b6312||0xcc;return function(_0x3a45e7){if(_0x3a45e7){return _0x33166f[_0xcfd1('0x20')](_0x2b6312);}return _0x33166f[_0xcfd1('0x21')](_0x2b6312)[_0xcfd1('0x22')]();};}function respondWithResult(_0x3acd27,_0x5837da){_0x5837da=_0x5837da||0xc8;return function(_0x36e0fb){if(_0x36e0fb){return _0x3acd27[_0xcfd1('0x21')](_0x5837da)['json'](_0x36e0fb);}};}function respondWithFilteredResult(_0x2ab046,_0x4cc976){return function(_0x3a30f8){if(_0x3a30f8){var _0x23782c=typeof _0x4cc976[_0xcfd1('0x23')]==='undefined'&&typeof _0x4cc976['limit']===_0xcfd1('0x24');var _0x8b8c1e=_0x3a30f8[_0xcfd1('0x25')];var _0x18c5bb=_0x23782c?0x0:_0x4cc976[_0xcfd1('0x23')];var _0x12cdc4=_0x23782c?_0x3a30f8['count']:_0x4cc976[_0xcfd1('0x23')]+_0x4cc976[_0xcfd1('0x26')];var _0x4cde94;if(_0x12cdc4>=_0x8b8c1e){_0x12cdc4=_0x8b8c1e;_0x4cde94=0xc8;}else{_0x4cde94=0xce;}_0x2ab046[_0xcfd1('0x21')](_0x4cde94);return _0x2ab046[_0xcfd1('0x27')](_0xcfd1('0x28'),_0x18c5bb+'-'+_0x12cdc4+'/'+_0x8b8c1e)['json'](_0x3a30f8);}return null;};}function patchUpdates(_0x14783a){return function(_0x12cf03){try{jsonpatch[_0xcfd1('0x29')](_0x12cf03,_0x14783a,!![]);}catch(_0x4f4fa2){return BPromise[_0xcfd1('0x2a')](_0x4f4fa2);}return _0x12cf03['save']();};}function saveUpdates(_0x52c5c3,_0x3797d5){return function(_0x575316){if(_0x575316){return _0x575316['update'](_0x52c5c3)['then'](function(_0x45222a){return _0x45222a;});}return null;};}function removeEntity(_0x25a41e,_0x2c67e6){return function(_0x3587e7){if(_0x3587e7){return _0x3587e7[_0xcfd1('0x2b')]()[_0xcfd1('0x2c')](function(){_0x25a41e[_0xcfd1('0x21')](0xcc)[_0xcfd1('0x22')]();});}};}function handleEntityNotFound(_0x2bc34c,_0x5be914){return function(_0x5f5549){if(!_0x5f5549){_0x2bc34c[_0xcfd1('0x20')](0x194);}return _0x5f5549;};}function handleError(_0x287b4a,_0x13e08f){_0x13e08f=_0x13e08f||0x1f4;return function(_0x4fb1d6){logger[_0xcfd1('0x2d')](_0x4fb1d6[_0xcfd1('0x2e')]);if(_0x4fb1d6[_0xcfd1('0x2f')]){delete _0x4fb1d6[_0xcfd1('0x2f')];}_0x287b4a[_0xcfd1('0x21')](_0x13e08f)[_0xcfd1('0x30')](_0x4fb1d6);};}function getInteractionUsers(_0x3966d5,_0x582b7b){return new BPromise(function(_0x3b64dc,_0x2ad673){try{if(_0x582b7b[_0x3966d5['id']]){_0x3966d5[_0xcfd1('0x31')]=_[_0xcfd1('0x32')](_0x582b7b[_0x3966d5['id']],function(_0x3bc18f){return{'id':_0x3bc18f['id'],'fullname':_0x3bc18f['fullname']};});}}catch(_0x324562){_0x2ad673(_0x324562);}_0x3b64dc(_0x3966d5);});}function getInteractionTags(_0x27ca47,_0x15d909){return new BPromise(function(_0x29e0ba,_0x35baac){try{if(_0x27ca47[_0xcfd1('0x33')]){_0x27ca47[_0xcfd1('0x34')]=[];_0x27ca47[_0xcfd1('0x33')][_0xcfd1('0x35')](',')['forEach'](function(_0x6cf3a8){_0x27ca47['Tags']['push'](_0x15d909[_0x6cf3a8]);});}delete _0x27ca47['TagIds'];}catch(_0x371e0a){_0x35baac(_0x371e0a);}_0x29e0ba(_0x27ca47);});}function updateOpenchannelInteraction(_0x5d1cca,_0xe4665d,_0x4f62f7){return new BPromise(function(_0x8410cd,_0x348474){return getInteractionUsers(_0x5d1cca,_0x4f62f7)[_0xcfd1('0x2c')](function(_0x287398){return getInteractionTags(_0x287398,_0xe4665d);})['then'](function(_0x12c8c8){return getStateInteraction(_0x12c8c8);})[_0xcfd1('0x2c')](function(_0x232b76){_0x8410cd(_0x232b76);})[_0xcfd1('0x36')](function(_0x1c418c){_0x348474(_0x1c418c);});});}function getStateInteraction(_0x4c03b4){return new BPromise(function(_0x2c5f89){_0x4c03b4['waiting']=0x0;_0x4c03b4['talking']=0x0;_0x4c03b4[_0xcfd1('0x37')]=0x0;_0x4c03b4[_0xcfd1('0x38')]=0x0;_0x4c03b4[_0xcfd1('0x39')]=0x0;if(!_0x4c03b4[_0xcfd1('0x3a')]&&!_0x4c03b4['UserId']){_0x4c03b4['waiting']+=0x1;}if(!_0x4c03b4['closed']&&_0x4c03b4[_0xcfd1('0x3b')]){_0x4c03b4[_0xcfd1('0x3c')]+=0x1;if(_0x4c03b4[_0xcfd1('0x3d')]){_0x4c03b4[_0xcfd1('0x3d')]-=0x1;}}if(_0x4c03b4[_0xcfd1('0x3a')]&&_0x4c03b4[_0xcfd1('0x3b')]){_0x4c03b4[_0xcfd1('0x37')]+=0x1;if(_0x4c03b4[_0xcfd1('0x3c')]){_0x4c03b4[_0xcfd1('0x3c')]-=0x1;}}if(_0x4c03b4[_0xcfd1('0x3a')]&&!_0x4c03b4[_0xcfd1('0x3b')]){_0x4c03b4[_0xcfd1('0x38')]+=0x1;if(_0x4c03b4[_0xcfd1('0x3d')]){_0x4c03b4[_0xcfd1('0x3d')]-=0x1;}}_0x4c03b4[_0xcfd1('0x39')]+=0x1;_0x2c5f89(_0x4c03b4);});}exports[_0xcfd1('0x3e')]=function(_0x5c242c,_0x2b0f66){var _0x45e607={},_0xe6ade2={},_0x48e80d={'count':0x0,'rows':[]};var _0x3794b5=_[_0xcfd1('0x32')](db[_0xcfd1('0x3f')][_0xcfd1('0x40')],function(_0x3e821e){return{'name':_0x3e821e[_0xcfd1('0x41')],'type':_0x3e821e['type']['key']};});_0xe6ade2[_0xcfd1('0x42')]=_['map'](_0x3794b5,_0xcfd1('0x2f'));_0xe6ade2[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x5c242c[_0xcfd1('0x43')]);_0xe6ade2[_0xcfd1('0x45')]=_[_0xcfd1('0x46')](_0xe6ade2[_0xcfd1('0x42')],_0xe6ade2[_0xcfd1('0x43')]);_0x45e607[_0xcfd1('0x47')]=_['intersection'](_0xe6ade2[_0xcfd1('0x42')],qs[_0xcfd1('0x48')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x48')]));_0x45e607[_0xcfd1('0x47')]=_0x45e607[_0xcfd1('0x47')][_0xcfd1('0x49')]?_0x45e607[_0xcfd1('0x47')]:_0xe6ade2[_0xcfd1('0x42')];if(!_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x4a')]('nolimit')){_0x45e607[_0xcfd1('0x26')]=qs[_0xcfd1('0x26')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x26')]);_0x45e607[_0xcfd1('0x23')]=qs[_0xcfd1('0x23')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x23')]);}_0x45e607[_0xcfd1('0x4b')]=qs[_0xcfd1('0x4c')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x4c')]);_0x45e607[_0xcfd1('0x4d')]=qs[_0xcfd1('0x45')](_['pick'](_0x5c242c[_0xcfd1('0x43')],_0xe6ade2[_0xcfd1('0x45')]),_0x3794b5);var _0x73f6dc=[];var _0xd83b12=squel[_0xcfd1('0x4e')]()[_0xcfd1('0x4f')]('id')[_0xcfd1('0x4f')](_0xcfd1('0x2f'))['field'](_0xcfd1('0x50'))['from'](_0xcfd1('0x51'));var _0xcde407=squel[_0xcfd1('0x4e')]()[_0xcfd1('0x4f')]('u.id')['field'](_0xcfd1('0x52'))[_0xcfd1('0x4f')](_0xcfd1('0x53'))[_0xcfd1('0x54')](_0xcfd1('0x55'),'ui')[_0xcfd1('0x56')](_0xcfd1('0x57'),'u',_0xcfd1('0x58'));var _0x343301=squel[_0xcfd1('0x4e')]()[_0xcfd1('0x54')](_0xcfd1('0x59'),'i')[_0xcfd1('0x56')](_0xcfd1('0x5a'),'c',_0xcfd1('0x5b'))[_0xcfd1('0x56')]('users','o',_0xcfd1('0x5c'))[_0xcfd1('0x56')](_0xcfd1('0x5d'),'a',_0xcfd1('0x5e'))[_0xcfd1('0x56')]('openchannel_messages','me',_0xcfd1('0x5f'))['left_join']('openchannel_interaction_has_tags','it',_0xcfd1('0x60'))[_0xcfd1('0x56')](_0xcfd1('0x51'),'t','t.id\x20=\x20it.TagId');var _0x7b8987=squel[_0xcfd1('0x61')]();var _0x38e77c=[];var _0x28f123=squel[_0xcfd1('0x61')]();var _0x460aed;if(_0x5c242c['query'][_0xcfd1('0x62')]){_0x460aed=as[_0xcfd1('0x63')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x62')]);var _0xe6a494=_0x460aed[_0xcfd1('0x64')];for(var _0x320672=0x0;_0x320672<_0x460aed[_0xcfd1('0x65')][_0xcfd1('0x49')];_0x320672++){var _0x5cdd33=_0x460aed[_0xcfd1('0x65')][_0x320672];var _0x2930a7='i';var _0x178f7b=_['find'](_0x3794b5,['name',_0x5cdd33[_0xcfd1('0x4f')]]);if(!_0x178f7b){switch(_0x5cdd33[_0xcfd1('0x4f')]){case _0xcfd1('0x66'):if(_0x5cdd33[_0xcfd1('0x67')]==0x1){_0x343301[_0xcfd1('0x68')]('`'+_0x5cdd33['field']+_0xcfd1('0x69'));}else{_0x343301[_0xcfd1('0x68')]('`'+_0x5cdd33[_0xcfd1('0x4f')]+_0xcfd1('0x6a'));}break;case _0xcfd1('0x6b'):if(_0x5cdd33[_0xcfd1('0x6c')]===_0xcfd1('0x6d')){if(_0x5cdd33[_0xcfd1('0x67')][_0xcfd1('0x35')]('\x20')[_0xcfd1('0x49')]>0x1){_0x7b8987[_0xe6a494]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcfd1('0x6e')](_0x5cdd33['value']),null);}else{var _0x477884='%'+_0x5cdd33['value']+'%';_0x7b8987[_0xe6a494](_0xcfd1('0x6f'),_0x477884,_0x477884,_0x477884);}}else{_0x178f7b=_[_0xcfd1('0x70')](_0x3794b5,[_0xcfd1('0x2f'),_0xcfd1('0x71')]);_0x5cdd33[_0xcfd1('0x4f')]=_0xcfd1('0x71');_0x354762=as['buildExpression'](_0x2930a7,_0x178f7b['type'],_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762['text'],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x72')],_0x354762[_0xcfd1('0x67')]['end']);}break;case _0xcfd1('0x73'):var _0x37f8d8=_0x5cdd33['value'][_0xcfd1('0x35')](',')[_0xcfd1('0x32')](function(_0x478f20){return Number(_0x478f20);});_0x37f8d8[_0xcfd1('0x74')](function(_0x25c140){_0x28f123['or'](_0xcfd1('0x75'),'%,'+_0x25c140+',%');});_0x38e77c=_[_0xcfd1('0x76')](_0x38e77c,_0x37f8d8);break;case _0xcfd1('0x77'):if(_0x5cdd33[_0xcfd1('0x6c')]===_0xcfd1('0x6d')){_0x7b8987[_0xe6a494](_0xcfd1('0x78'),'%'+_0x5cdd33[_0xcfd1('0x67')]+'%',null);}else{_0x178f7b=_[_0xcfd1('0x70')](_0x3794b5,[_0xcfd1('0x2f'),_0xcfd1('0x3b')]);_0x5cdd33['field']=_0xcfd1('0x3b');_0x354762=as['buildExpression'](_0x2930a7,_0x178f7b[_0xcfd1('0x79')],_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762[_0xcfd1('0x7a')],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x72')],_0x354762['value'][_0xcfd1('0x22')]);}break;case _0xcfd1('0x7b'):_0x354762=as[_0xcfd1('0x7c')]('me',null,_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762['text'],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x72')],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x22')]);break;}}else{var _0x354762=as['buildExpression'](_0x2930a7,_0x178f7b[_0xcfd1('0x79')],_0x5cdd33);_0x7b8987[_0xe6a494](_0x354762[_0xcfd1('0x7a')],_0x354762['value'][_0xcfd1('0x72')],_0x354762[_0xcfd1('0x67')][_0xcfd1('0x22')]);}}}else{var _0x1a01cf=_(_0x5c242c[_0xcfd1('0x43')])[_0xcfd1('0x44')]()[_0xcfd1('0x32')](function(_0x1129dd){return _[_0xcfd1('0x7d')](_0x3794b5,[_0xcfd1('0x2f'),_0x1129dd])?_0x1129dd:undefined;})[_0xcfd1('0x7e')]()['value']();if(!_[_0xcfd1('0x7f')](_0x1a01cf)){_0x1a01cf[_0xcfd1('0x74')](function(_0x2db28a){if(_0x2db28a==='OpenchannelAccountId'){_0x343301[_0xcfd1('0x4d')](_0xcfd1('0x80'),[][_0xcfd1('0x81')](_0x5c242c[_0xcfd1('0x43')][_0x2db28a]));}else if(_0x2db28a===_0xcfd1('0x82')){var _0x691c06=JSON[_0xcfd1('0x83')](_0x5c242c['query'][_0x2db28a])[_0xcfd1('0x84')];var _0x45693f=JSON['parse'](_0x5c242c[_0xcfd1('0x43')][_0x2db28a])['$lte'];_0x343301[_0xcfd1('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x691c06,_0x45693f);}else{if(_0x5c242c[_0xcfd1('0x43')][_0x2db28a]===_0xcfd1('0x85')){_0x343301['where']('i.'+_0x2db28a+_0xcfd1('0x86'));}else{_0x343301['where']('i.'+_0x2db28a+'\x20=\x20?',_0x5c242c[_0xcfd1('0x43')][_0x2db28a]);}}});}if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x87')]){if(_0x5c242c['query'][_0xcfd1('0x87')]==0x1){_0x343301['having']('`unreadMessages`\x20=\x200');}else{_0x343301[_0xcfd1('0x68')](_0xcfd1('0x88'));}}if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x89')]){_0x38e77c=_[_0xcfd1('0x8a')](_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x89')])?_0x5c242c['query']['tag']:new Array(_0x5c242c['query'][_0xcfd1('0x89')]);_0x38e77c[_0xcfd1('0x74')](function(_0x5a23a8){_0x28f123['or'](_0xcfd1('0x75'),'%,'+_0x5a23a8+',%');});}if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x8b')]){var _0x168335=_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x8b')]['replace']('\x5c','\x5c\x5c')[_0xcfd1('0x8c')](/'/g,'\x27\x27');if(qs[_0xcfd1('0x8d')](_0x168335)){_0x7b8987['or']('i.id\x20LIKE\x20?',_0x168335+'%');}else{_0x7b8987['or'](_0xcfd1('0x8e'),qs[_0xcfd1('0x6e')](_0x168335))['or'](_0xcfd1('0x8f'),_0x168335+'%')['or'](_0xcfd1('0x90'),_0x168335+'%');}}}_0x343301[_0xcfd1('0x4d')](_0x7b8987);_0x343301[_0xcfd1('0x91')](_0xcfd1('0x92'));var _0x1dc896={'type':db[_0xcfd1('0x93')][_0xcfd1('0x94')][_0xcfd1('0x95')],'raw':!![]};var _0x5acaaa=_0x343301['clone']();_0x5acaaa[_0xcfd1('0x4f')]('i.id');_0x5acaaa[_0xcfd1('0x4f')](_0xcfd1('0x96'),_0xcfd1('0x66'));if(_0x45e607[_0xcfd1('0x4b')]){_0x45e607[_0xcfd1('0x4b')][_0xcfd1('0x74')](function(_0x23c6c2){var _0xd36d68=_0x23c6c2[0x0]===_0xcfd1('0x97')?_0x23c6c2[0x0]:'i.'+_0x23c6c2[0x0];_0x343301[_0xcfd1('0x4b')](_0xd36d68,_0x23c6c2[0x1]===_0xcfd1('0x98')?![]:!![]);});}if(!_[_0xcfd1('0x7f')](_0x38e77c)){_0x343301[_0xcfd1('0x68')](_0x28f123);_0x5acaaa[_0xcfd1('0x4d')](_0xcfd1('0x99'),_0x38e77c);}BPromise[_0xcfd1('0x9a')]()[_0xcfd1('0x2c')](function(){if(!_0x460aed){if(_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x9b')])return;_0x5acaaa['where'](_0xcfd1('0x9c'));_0x343301[_0xcfd1('0x4d')](_0xcfd1('0x9c'));return;}if(_0x5c242c[_0xcfd1('0x9d')][_0xcfd1('0x9e')]!==_0xcfd1('0x9f'))return;return _0x5c242c[_0xcfd1('0x9d')][_0xcfd1('0xa0')]({'attributes':['id'],'raw':!![]})[_0xcfd1('0x2c')](function(_0x29be27){if(_[_0xcfd1('0x7f')](_0x29be27)){_0x5acaaa['where'](_0xcfd1('0xa1'));_0x343301['where'](_0xcfd1('0xa1'));}else{_0x5acaaa['where'](_0xcfd1('0x80'),_[_0xcfd1('0x32')](_0x29be27,'id'));_0x343301[_0xcfd1('0x4d')](_0xcfd1('0x80'),_['map'](_0x29be27,'id'));}});})[_0xcfd1('0x2c')](function(){if(_0x5c242c[_0xcfd1('0x9d')][_0xcfd1('0x9e')]===_0xcfd1('0x9f')&&!_0x460aed&&!_0x5c242c[_0xcfd1('0x43')][_0xcfd1('0x9b')])return[];return db['sequelize'][_0xcfd1('0x43')](_0x5acaaa[_0xcfd1('0xa2')](),_0x1dc896);})[_0xcfd1('0x2c')](function(_0x55c6ff){_0x48e80d['count']=_0x55c6ff[_0xcfd1('0x49')];if(_0x48e80d[_0xcfd1('0x25')]===0x0)return[];return db[_0xcfd1('0xa3')][_0xcfd1('0x43')](_0xd83b12[_0xcfd1('0xa2')](),_0x1dc896)[_0xcfd1('0x2c')](function(_0x4466dc){_0x73f6dc=_[_0xcfd1('0xa4')](_0x4466dc,'id');_0x1dc896=_[_0xcfd1('0xa5')](_0x1dc896,{'model':db[_0xcfd1('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c242c[_0xcfd1('0x43')]['fields']){_0x45e607[_0xcfd1('0x47')][_0xcfd1('0x74')](function(_0x295b1d){_0x343301[_0xcfd1('0x4f')]('i.'+_0x295b1d);});}else{_0x343301['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcfd1('0x66'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xa6'),_0xcfd1('0xa7'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xa8'),'Account.mandatoryDisposition');_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xa9'),_0xcfd1('0x97'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xaa'));_0x343301[_0xcfd1('0x4f')]('c.firstName','Contact.firstName');_0x343301['field'](_0xcfd1('0xab'),'Contact.lastName');_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xac'),_0xcfd1('0xad'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xae'),_0xcfd1('0xaf'));_0x343301['field'](_0xcfd1('0xb0'),_0xcfd1('0xb1'));_0x343301['field'](_0xcfd1('0xb2'),_0xcfd1('0xb3'));_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xb4'),_0xcfd1('0xb5'));_0x343301[_0xcfd1('0x4f')]('o.internal','Owner.internal');_0x343301[_0xcfd1('0x4f')](_0xcfd1('0xb6'),'TagIds');}if(_0x45e607['limit'])_0x343301[_0xcfd1('0x26')](_0x45e607['limit']);if(_0x45e607[_0xcfd1('0x23')])_0x343301[_0xcfd1('0x23')](_0x45e607[_0xcfd1('0x23')]);return db[_0xcfd1('0xa3')]['query'](_0x343301[_0xcfd1('0xa2')](),_0x1dc896);})['then'](function(_0x2e251f){if(_0x2e251f[_0xcfd1('0x49')]>0x0)_0xcde407[_0xcfd1('0x4d')](_0xcfd1('0xb7'),_['map'](_0x2e251f,'id'));return db[_0xcfd1('0xa3')][_0xcfd1('0x43')](_0xcde407[_0xcfd1('0xa2')](),_0x1dc896)[_0xcfd1('0x2c')](function(_0x4360ab){var _0x2a9e82=_[_0xcfd1('0xb8')](_0x4360ab,_0xcfd1('0xb9'));var _0x4c735f=[];_0x2e251f[_0xcfd1('0x74')](function(_0x55b747){_0x4c735f[_0xcfd1('0xba')](updateOpenchannelInteraction(_0x55b747,_0x73f6dc,_0x2a9e82));});return BPromise['all'](_0x4c735f);});});})[_0xcfd1('0x2c')](function(_0x19b761){_0x48e80d['rows']=_0x19b761;return _0x48e80d;})[_0xcfd1('0x2c')](respondWithFilteredResult(_0x2b0f66,_0x45e607))[_0xcfd1('0x36')](handleError(_0x2b0f66,null));};exports['show']=function(_0x183320,_0x4ac5c7){var _0x29df3e={};if(_0x183320['query'][_0xcfd1('0x79')]&&_0x183320[_0xcfd1('0x43')][_0xcfd1('0x79')]===_0xcfd1('0x54')){_0x29df3e['from']=_0x183320[_0xcfd1('0xbb')]['id'];}else{_0x29df3e['id']=_0x183320['params']['id'];}var _0x409e3d={'raw':![],'where':_0x29df3e},_0x5a5760={};_0x5a5760['model']=_[_0xcfd1('0x44')](db[_0xcfd1('0x3f')][_0xcfd1('0x40')]);_0x5a5760[_0xcfd1('0x43')]=_[_0xcfd1('0x44')](_0x183320[_0xcfd1('0x43')]);_0x5a5760[_0xcfd1('0x45')]=_[_0xcfd1('0x46')](_0x5a5760[_0xcfd1('0x42')],_0x5a5760[_0xcfd1('0x43')]);_0x409e3d[_0xcfd1('0x47')]=_[_0xcfd1('0x46')](_0x5a5760[_0xcfd1('0x42')],qs[_0xcfd1('0x48')](_0x183320['query'][_0xcfd1('0x48')]));_0x409e3d[_0xcfd1('0x47')]=_0x409e3d[_0xcfd1('0x47')]['length']?_0x409e3d['attributes']:_0x5a5760[_0xcfd1('0x42')];if(_0x183320[_0xcfd1('0x43')][_0xcfd1('0xbc')]){_0x409e3d[_0xcfd1('0xbd')]=[{'all':!![]}];}_0x409e3d=_[_0xcfd1('0xa5')]({},_0x409e3d,_0x183320['options']);return db[_0xcfd1('0x3f')][_0xcfd1('0x70')](_0x409e3d)['then'](handleEntityNotFound(_0x4ac5c7,null))[_0xcfd1('0x2c')](respondWithResult(_0x4ac5c7,null))['catch'](handleError(_0x4ac5c7,null));};exports[_0xcfd1('0xbe')]=function(_0x2f5a3b,_0x5f417c){return db[_0xcfd1('0x3f')]['create'](_0x2f5a3b[_0xcfd1('0x7b')],{})[_0xcfd1('0x2c')](respondWithResult(_0x5f417c,0xc9))[_0xcfd1('0x36')](handleError(_0x5f417c,null));};exports[_0xcfd1('0xbf')]=function(_0x2f6501,_0x47a11b){if(_0x2f6501['body']['id']){delete _0x2f6501[_0xcfd1('0x7b')]['id'];}return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x2f6501['params']['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x47a11b,null))[_0xcfd1('0x2c')](saveUpdates(_0x2f6501[_0xcfd1('0x7b')],null))[_0xcfd1('0x2c')](respondWithResult(_0x47a11b,null))['catch'](handleError(_0x47a11b,null));};exports[_0xcfd1('0x2b')]=function(_0x2aac8a,_0x3f087f){return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x2aac8a[_0xcfd1('0xbb')]['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x3f087f,null))[_0xcfd1('0x2c')](removeEntity(_0x3f087f,null))[_0xcfd1('0x36')](handleError(_0x3f087f,null));};exports['describe']=function(_0x2847e4,_0x428c1b){return db['OpenchannelInteraction'][_0xcfd1('0xc0')]()[_0xcfd1('0x2c')](respondWithResult(_0x428c1b,null))['catch'](handleError(_0x428c1b,null));};exports[_0xcfd1('0xc1')]=function(_0x2c0817,_0x43e910,_0xa3d075){return db[_0xcfd1('0xc2')][_0xcfd1('0x70')]({'where':{'id':_0x2c0817[_0xcfd1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x43e910,null))[_0xcfd1('0x2c')](function(_0x4bbae6){if(_0x4bbae6){return _0x4bbae6[_0xcfd1('0xc1')](_0x2c0817[_0xcfd1('0x7b')][_0xcfd1('0xc3')],_['omit'](_0x2c0817[_0xcfd1('0x7b')],['ids','id'])||{});}})[_0xcfd1('0x2c')](respondWithResult(_0x43e910,null))[_0xcfd1('0x36')](handleError(_0x43e910,null));};exports[_0xcfd1('0xc4')]=function(_0x135903,_0x6e2a82,_0x2783f5){var _0x488a33={'raw':![],'where':{}};var _0x3bb69f={};var _0x3497c5={'count':0x0,'rows':[]};return db[_0xcfd1('0x3f')][_0xcfd1('0xc5')]({'where':{'id':_0x135903[_0xcfd1('0xbb')]['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x6e2a82,null))[_0xcfd1('0x2c')](function(_0x551492){if(_0x551492){_0x3bb69f[_0xcfd1('0x42')]=_[_0xcfd1('0x44')](db[_0xcfd1('0xc2')][_0xcfd1('0x40')]);_0x3bb69f['query']=_[_0xcfd1('0x44')](_0x135903['query']);_0x3bb69f[_0xcfd1('0x45')]=_['intersection'](_0x3bb69f[_0xcfd1('0x42')],_0x3bb69f[_0xcfd1('0x43')]);_0x488a33[_0xcfd1('0x47')]=_[_0xcfd1('0x46')](_0x3bb69f[_0xcfd1('0x42')],qs['fields'](_0x135903[_0xcfd1('0x43')]['fields']));_0x488a33['attributes']=_0x488a33[_0xcfd1('0x47')][_0xcfd1('0x49')]?_0x488a33[_0xcfd1('0x47')]:_0x3bb69f[_0xcfd1('0x42')];if(!_0x135903[_0xcfd1('0x43')][_0xcfd1('0x4a')](_0xcfd1('0xc6'))){_0x488a33[_0xcfd1('0x26')]=qs[_0xcfd1('0x26')](_0x135903[_0xcfd1('0x43')][_0xcfd1('0x26')]);_0x488a33['offset']=qs[_0xcfd1('0x23')](_0x135903[_0xcfd1('0x43')][_0xcfd1('0x23')]);}_0x488a33['order']=qs[_0xcfd1('0x4c')](_0x135903[_0xcfd1('0x43')][_0xcfd1('0x4c')]);_0x488a33[_0xcfd1('0x4d')]=qs[_0xcfd1('0x45')](_[_0xcfd1('0xc7')](_0x135903['query'],_0x3bb69f[_0xcfd1('0x45')]));_0x488a33['where'][_0xcfd1('0xb9')]=_0x551492['id'];if(_0x135903['query'][_0xcfd1('0x8b')]){_0x488a33['where']=_[_0xcfd1('0xa5')](_0x488a33[_0xcfd1('0x4d')],{'$or':_['map'](_0x488a33[_0xcfd1('0x47')],function(_0x4ffbd8){var _0x3c5808={};_0x3c5808[_0x4ffbd8]={'$like':'%'+_0x135903[_0xcfd1('0x43')][_0xcfd1('0x8b')]+'%'};return _0x3c5808;})});}if(_0x135903[_0xcfd1('0x43')][_0xcfd1('0x84')]){var _0x2dc26d=_0x135903[_0xcfd1('0x43')][_0xcfd1('0x84')][_0xcfd1('0x35')](',');var _0x1b5557={};_0x1b5557[_0x2dc26d[0x0]]={'$gte':moment(_0x2dc26d[0x1])[_0xcfd1('0xc8')](_0xcfd1('0xc9'))};_0x488a33[_0xcfd1('0x4d')]=_[_0xcfd1('0xa5')](_0x488a33['where'],_0x1b5557);}_0x488a33=_[_0xcfd1('0xa5')]({},_0x488a33,_0x135903[_0xcfd1('0xca')]);return db['OpenchannelMessage']['count']({'where':_0x488a33[_0xcfd1('0x4d')]})[_0xcfd1('0x2c')](function(_0x4c3481){_0x3497c5[_0xcfd1('0x25')]=_0x4c3481;if(_0x135903[_0xcfd1('0x43')][_0xcfd1('0xbc')]){_0x488a33[_0xcfd1('0xbd')]=[{'all':!![]}];}return db[_0xcfd1('0xc2')]['findAll'](_0x488a33);})[_0xcfd1('0x2c')](function(_0x289b7c){_0x3497c5[_0xcfd1('0xcb')]=_0x289b7c;return _0x3497c5;});}})[_0xcfd1('0x2c')](respondWithFilteredResult(_0x6e2a82,_0x488a33))['catch'](handleError(_0x6e2a82,null));};exports[_0xcfd1('0xcc')]=function(_0x183afd,_0x14b32a,_0x38f3a8){return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x183afd[_0xcfd1('0xbb')]['id']}})[_0xcfd1('0x2c')](handleEntityNotFound(_0x14b32a,null))[_0xcfd1('0x2c')](function(_0x2511db){if(_0x2511db){return _0x2511db[_0xcfd1('0xcd')](_0x183afd[_0xcfd1('0x7b')][_0xcfd1('0xc3')],_['omit'](_0x183afd[_0xcfd1('0x7b')],[_0xcfd1('0xc3'),'id'])||{})[_0xcfd1('0xce')](function(){return db[_0xcfd1('0x73')][_0xcfd1('0xcf')]({'attributes':['id',_0xcfd1('0x2f'),_0xcfd1('0x50')],'where':{'id':_0x183afd[_0xcfd1('0x7b')][_0xcfd1('0xc3')]}});})[_0xcfd1('0x2c')](function(_0x519596){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x183afd[_0xcfd1('0xbb')]['id']),'tags':_0x519596||[]});return{'id':Number(_0x183afd[_0xcfd1('0xbb')]['id']),'tags':_0x519596||[]};});}})['then'](respondWithResult(_0x14b32a,null))[_0xcfd1('0x36')](handleError(_0x14b32a,null));};exports[_0xcfd1('0xd0')]=function(_0x52beb3,_0x254328,_0x3f57ad){return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x52beb3[_0xcfd1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x254328,null))[_0xcfd1('0x2c')](function(_0x1efa53){if(_0x1efa53){return _0x1efa53[_0xcfd1('0xd0')](_0x52beb3[_0xcfd1('0x43')][_0xcfd1('0xc3')]);}})[_0xcfd1('0x2c')](respondWithStatusCode(_0x254328,null))['catch'](handleError(_0x254328,null));};exports[_0xcfd1('0xd1')]=function(_0x58663f,_0x2d5f70){var _0x28ff46=moment()['unix']()[_0xcfd1('0xa2')]();var _0x4fabce=path[_0xcfd1('0xd2')](config[_0xcfd1('0xd3')],_0xcfd1('0xd4'),_0xcfd1('0xd5'),_0xcfd1('0xd6'));var _0x58a1d0=path[_0xcfd1('0xd2')](config[_0xcfd1('0xd3')],_0xcfd1('0xd4'),_0xcfd1('0xd5'),_0xcfd1('0xd7'));var _0x155ff2=path[_0xcfd1('0xd2')](_0x4fabce,_0x28ff46);var _0x154587=util['format'](_0xcfd1('0xd8'),_0x58663f[_0xcfd1('0xbb')]['id'],_0x28ff46);var _0x3eab77=path[_0xcfd1('0xd2')](_0x4fabce,_0x154587);var _0x164dd2=[];_0x164dd2[_0xcfd1('0xba')]({'model':db[_0xcfd1('0x77')],'as':_0xcfd1('0x77'),'attributes':['id',_0xcfd1('0xd9')],'raw':!![]});_0x164dd2[_0xcfd1('0xba')]({'model':db[_0xcfd1('0xda')],'as':_0xcfd1('0x6b'),'attributes':['id',_0xcfd1('0xdb'),_0xcfd1('0xdc')],'raw':!![]});if(_0x58663f[_0xcfd1('0x43')][_0xcfd1('0xd7')]){_0x164dd2[_0xcfd1('0xba')]({'model':db[_0xcfd1('0xdd')],'as':_0xcfd1('0xdd'),'raw':!![]});}var _0x55c946=[{'model':db['OpenchannelMessage'],'as':_0xcfd1('0xde'),'attributes':['id',_0xcfd1('0x7b'),_0xcfd1('0x82'),_0xcfd1('0xdf'),_0xcfd1('0xe0'),_0xcfd1('0x87')],'include':_0x164dd2}];_0x55c946[_0xcfd1('0xba')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x55c946['push']({'model':db[_0xcfd1('0x77')],'as':_0xcfd1('0xe1'),'attributes':['id',_0xcfd1('0xd9')]});return db[_0xcfd1('0x3f')][_0xcfd1('0x70')]({'where':{'id':_0x58663f[_0xcfd1('0xbb')]['id']},'include':_0x55c946})[_0xcfd1('0x2c')](handleEntityNotFound(_0x2d5f70,null))[_0xcfd1('0x2c')](function(_0x3b24e2){if(_0x3b24e2){var _0x5c6e4d=_0x3b24e2['get']({'plain':!![]});fs[_0xcfd1('0xe2')](_0x155ff2);var _0x567160={'channel':_0xcfd1('0xe3'),'account':_0x5c6e4d['Account'][_0xcfd1('0x2f')],'agent':_0x5c6e4d[_0xcfd1('0xe1')]?_0x5c6e4d['Owner']['fullname']:'N.A.','createdAt':moment(_0x5c6e4d[_0xcfd1('0x82')])[_0xcfd1('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5c6e4d[_0xcfd1('0x3a')]?moment(_0x5c6e4d[_0xcfd1('0xe4')])[_0xcfd1('0xc8')](_0xcfd1('0xc9'))[_0xcfd1('0xa2')]():'','disposition':_0x5c6e4d[_0xcfd1('0xe5')],'visibility':_0x5c6e4d[_0xcfd1('0xe6')]?_0xcfd1('0xe7'):_0xcfd1('0xe8'),'messages':_(_0x5c6e4d['Messages'])[_0xcfd1('0x8b')]({'secret':![]})[_0xcfd1('0x32')](function(_0x59b793){if(_0x59b793[_0xcfd1('0xdd')]){var _0x4a2128=path[_0xcfd1('0xd2')](_0x58a1d0,_0x59b793[_0xcfd1('0xdd')][_0xcfd1('0xe9')]);if(fs[_0xcfd1('0xea')](_0x4a2128)){fs[_0xcfd1('0xeb')](_0x4a2128)[_0xcfd1('0xec')](fs[_0xcfd1('0xed')](path[_0xcfd1('0xd2')](_0x155ff2,_0x59b793[_0xcfd1('0xdd')][_0xcfd1('0xe9')])));}}return{'date':moment(_0x59b793[_0xcfd1('0x82')])[_0xcfd1('0xc8')](_0xcfd1('0xc9'))[_0xcfd1('0xa2')](),'sender':_0x59b793['direction']===_0xcfd1('0xee')?_0x59b793['User']?_0x59b793[_0xcfd1('0x77')][_0xcfd1('0xd9')]:_0xcfd1('0xef'):_0x59b793['Contact']['firstName']+(_0x59b793[_0xcfd1('0x6b')]['lastName']?'\x20'+_0x59b793['Contact'][_0xcfd1('0xdc')]:''),'body':_0x59b793[_0xcfd1('0xdd')]?_0x59b793[_0xcfd1('0xdd')][_0xcfd1('0xe9')]:_0x59b793[_0xcfd1('0x7b')],'direction':_0x59b793['direction']===_0xcfd1('0xee')?'A':'C','secret':_0x59b793[_0xcfd1('0xe0')],'read':_0x59b793[_0xcfd1('0x87')],'attachment':_0x59b793['Attachment']};})[_0xcfd1('0x67')]()};return ejs[_0xcfd1('0xf0')](path[_0xcfd1('0xd2')](config['root'],_0xcfd1('0xd4'),'views',_0xcfd1('0xf1')),{'interaction':_0x567160})[_0xcfd1('0x2c')](function(_0x52d15e){var _0x5af624=path[_0xcfd1('0xd2')](_0x155ff2,_0xcfd1('0xf2')+_0x5c6e4d['id']+'-'+_0x28ff46+_0xcfd1('0xf3'));var _0x139377={'path':_0x5af624,'channel':_0xcfd1('0xe3'),'interactionId':_0x5c6e4d['id']};return pdf[_0xcfd1('0xf4')](_0x52d15e,_0x139377);})[_0xcfd1('0x2c')](function(){return new BPromise(function(_0x30c84b,_0x4733df){zipdir(_0x155ff2,{'saveTo':_0x3eab77},function(_0x5163d8,_0x2d3a12){if(_0x5163d8)return _0x4733df(_0x5163d8);return _0x30c84b(_0x2d3a12);});})['then'](function(){return new BPromise(function(_0x26e60c,_0x4dabe2){rimraf(_0x155ff2,function(_0x414d75){if(_0x414d75)_0x4dabe2(_0x414d75);return _0x26e60c();});});})['then'](function(){return _0x2d5f70['download'](_0x3eab77,_0x154587,function(_0x1312e7){if(_0x1312e7){console[_0xcfd1('0xf5')]('err',_0x1312e7);}else{fs[_0xcfd1('0xf6')](_0x3eab77);}});});});}else{return _0x2d5f70[_0xcfd1('0x20')](0xc8);}})[_0xcfd1('0x36')](handleError(_0x2d5f70,null));}; \ No newline at end of file +var _0x2550=['Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','rows','show','params','OpenchannelInteraction','merge','options','catch','create','describe','OpenchannelMessage','addMessage','omit','ids','getMessages','findOne','nolimit','OpenchannelInteractionId','filter','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','format','transcript-%d-%s.zip','fullname','CmContact','attachments','Attachment','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','Messages','existsSync','createReadStream','createWriteStream','basename','out','System','Contact','firstName','lastName','direction','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','end','name','send','Users','TagIds','Tags','split','push','waiting','answered','unmanaged','closed','UserId','talking','total','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','length','hasOwnProperty','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','conditions','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','keys','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','fields','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email'];(function(_0x3192c1,_0x3cdf2c){var _0x22e4ce=function(_0x57495f){while(--_0x57495f){_0x3192c1['push'](_0x3192c1['shift']());}};_0x22e4ce(++_0x3cdf2c);}(_0x2550,0x144));var _0x0255=function(_0x9a71bf,_0xb173d){_0x9a71bf=_0x9a71bf-0x0;var _0x5f2da3=_0x2550[_0x9a71bf];return _0x5f2da3;};'use strict';var emlformat=require(_0x0255('0x0'));var rimraf=require(_0x0255('0x1'));var zipdir=require(_0x0255('0x2'));var jsonpatch=require(_0x0255('0x3'));var rp=require(_0x0255('0x4'));var moment=require(_0x0255('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0255('0x6'));var path=require(_0x0255('0x7'));var sox=require(_0x0255('0x8'));var csv=require(_0x0255('0x9'));var ejs=require(_0x0255('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0255('0xb'));var crypto=require('crypto');var jsforce=require(_0x0255('0xc'));var deskjs=require(_0x0255('0xd'));var toCsv=require(_0x0255('0x9'));var querystring=require(_0x0255('0xe'));var Papa=require(_0x0255('0xf'));var Redis=require(_0x0255('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0255('0x11'));var pdf=require(_0x0255('0x12'));var hardwareService=require(_0x0255('0x13'));var logger=require(_0x0255('0x14'))('api');var utils=require(_0x0255('0x15'));var config=require(_0x0255('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0255('0x17'))['db'];config['redis']=_[_0x0255('0x18')](config['redis'],{'host':_0x0255('0x19'),'port':0x18eb});var socket=require(_0x0255('0x1a'))(new Redis(config[_0x0255('0x1b')]));require(_0x0255('0x1c'))[_0x0255('0x1d')](socket);function respondWithStatusCode(_0x2df8af,_0x845b9b){_0x845b9b=_0x845b9b||0xcc;return function(_0x1ebb7f){if(_0x1ebb7f){return _0x2df8af[_0x0255('0x1e')](_0x845b9b);}return _0x2df8af[_0x0255('0x1f')](_0x845b9b)['end']();};}function respondWithResult(_0x43a984,_0x4bae1b){_0x4bae1b=_0x4bae1b||0xc8;return function(_0x5d9bf8){if(_0x5d9bf8){return _0x43a984[_0x0255('0x1f')](_0x4bae1b)[_0x0255('0x20')](_0x5d9bf8);}};}function respondWithFilteredResult(_0x49c21b,_0x16baad){return function(_0x82f0d1){if(_0x82f0d1){var _0x323727=typeof _0x16baad[_0x0255('0x21')]==='undefined'&&typeof _0x16baad[_0x0255('0x22')]===_0x0255('0x23');var _0x594ea5=_0x82f0d1['count'];var _0x14bc7b=_0x323727?0x0:_0x16baad[_0x0255('0x21')];var _0x598021=_0x323727?_0x82f0d1['count']:_0x16baad[_0x0255('0x21')]+_0x16baad[_0x0255('0x22')];var _0x2ae769;if(_0x598021>=_0x594ea5){_0x598021=_0x594ea5;_0x2ae769=0xc8;}else{_0x2ae769=0xce;}_0x49c21b[_0x0255('0x1f')](_0x2ae769);return _0x49c21b[_0x0255('0x24')](_0x0255('0x25'),_0x14bc7b+'-'+_0x598021+'/'+_0x594ea5)[_0x0255('0x20')](_0x82f0d1);}return null;};}function patchUpdates(_0x469c64){return function(_0x5539b3){try{jsonpatch[_0x0255('0x26')](_0x5539b3,_0x469c64,!![]);}catch(_0x30fadb){return BPromise[_0x0255('0x27')](_0x30fadb);}return _0x5539b3[_0x0255('0x28')]();};}function saveUpdates(_0x427cd8,_0x58de7f){return function(_0x41f3a6){if(_0x41f3a6){return _0x41f3a6[_0x0255('0x29')](_0x427cd8)[_0x0255('0x2a')](function(_0xd0806a){return _0xd0806a;});}return null;};}function removeEntity(_0x25216d,_0x4dd065){return function(_0x431296){if(_0x431296){return _0x431296['destroy']()['then'](function(){_0x25216d[_0x0255('0x1f')](0xcc)[_0x0255('0x2b')]();});}};}function handleEntityNotFound(_0x4cfcf7,_0x3ca799){return function(_0x23cf31){if(!_0x23cf31){_0x4cfcf7[_0x0255('0x1e')](0x194);}return _0x23cf31;};}function handleError(_0x3cb603,_0x1b135b){_0x1b135b=_0x1b135b||0x1f4;return function(_0xe2dd0b){logger['error'](_0xe2dd0b['stack']);if(_0xe2dd0b['name']){delete _0xe2dd0b[_0x0255('0x2c')];}_0x3cb603['status'](_0x1b135b)[_0x0255('0x2d')](_0xe2dd0b);};}function getInteractionUsers(_0x41aa86,_0xff2f91){return new BPromise(function(_0x24f2ac,_0x34000c){try{if(_0xff2f91[_0x41aa86['id']]){_0x41aa86[_0x0255('0x2e')]=_['map'](_0xff2f91[_0x41aa86['id']],function(_0x5e6d9a){return{'id':_0x5e6d9a['id'],'fullname':_0x5e6d9a['fullname']};});}}catch(_0x18ae39){_0x34000c(_0x18ae39);}_0x24f2ac(_0x41aa86);});}function getInteractionTags(_0x1bc31e,_0x369d24){return new BPromise(function(_0x316955,_0x1de6f3){try{if(_0x1bc31e[_0x0255('0x2f')]){_0x1bc31e[_0x0255('0x30')]=[];_0x1bc31e['TagIds'][_0x0255('0x31')](',')['forEach'](function(_0x4b04fd){_0x1bc31e[_0x0255('0x30')][_0x0255('0x32')](_0x369d24[_0x4b04fd]);});}delete _0x1bc31e[_0x0255('0x2f')];}catch(_0x476507){_0x1de6f3(_0x476507);}_0x316955(_0x1bc31e);});}function updateOpenchannelInteraction(_0x354940,_0x527d4e,_0x1cfd66){return new BPromise(function(_0x1b891d,_0xd08cb1){return getInteractionUsers(_0x354940,_0x1cfd66)['then'](function(_0x4bbd7e){return getInteractionTags(_0x4bbd7e,_0x527d4e);})[_0x0255('0x2a')](function(_0x373df4){return getStateInteraction(_0x373df4);})[_0x0255('0x2a')](function(_0x3c6623){_0x1b891d(_0x3c6623);})['catch'](function(_0x2915c3){_0xd08cb1(_0x2915c3);});});}function getStateInteraction(_0x2c31c4){return new BPromise(function(_0x499359){_0x2c31c4[_0x0255('0x33')]=0x0;_0x2c31c4['talking']=0x0;_0x2c31c4[_0x0255('0x34')]=0x0;_0x2c31c4[_0x0255('0x35')]=0x0;_0x2c31c4['total']=0x0;if(!_0x2c31c4[_0x0255('0x36')]&&!_0x2c31c4['UserId']){_0x2c31c4[_0x0255('0x33')]+=0x1;}if(!_0x2c31c4[_0x0255('0x36')]&&_0x2c31c4['UserId']){_0x2c31c4['talking']+=0x1;if(_0x2c31c4['waiting']){_0x2c31c4['waiting']-=0x1;}}if(_0x2c31c4[_0x0255('0x36')]&&_0x2c31c4[_0x0255('0x37')]){_0x2c31c4[_0x0255('0x34')]+=0x1;if(_0x2c31c4['talking']){_0x2c31c4[_0x0255('0x38')]-=0x1;}}if(_0x2c31c4[_0x0255('0x36')]&&!_0x2c31c4[_0x0255('0x37')]){_0x2c31c4[_0x0255('0x35')]+=0x1;if(_0x2c31c4[_0x0255('0x33')]){_0x2c31c4[_0x0255('0x33')]-=0x1;}}_0x2c31c4[_0x0255('0x39')]+=0x1;_0x499359(_0x2c31c4);});}exports[_0x0255('0x3a')]=function(_0x48e462,_0x208f28){var _0x8a4ee9={},_0x5d9032={},_0x33e959={'count':0x0,'rows':[]};var _0x21884b=_[_0x0255('0x3b')](db['OpenchannelInteraction'][_0x0255('0x3c')],function(_0x32e430){return{'name':_0x32e430[_0x0255('0x3d')],'type':_0x32e430[_0x0255('0x3e')][_0x0255('0x3f')]};});_0x5d9032[_0x0255('0x40')]=_['map'](_0x21884b,'name');_0x5d9032[_0x0255('0x41')]=_['keys'](_0x48e462[_0x0255('0x41')]);_0x5d9032['filters']=_['intersection'](_0x5d9032['model'],_0x5d9032[_0x0255('0x41')]);_0x8a4ee9[_0x0255('0x42')]=_[_0x0255('0x43')](_0x5d9032[_0x0255('0x40')],qs['fields'](_0x48e462[_0x0255('0x41')]['fields']));_0x8a4ee9[_0x0255('0x42')]=_0x8a4ee9['attributes'][_0x0255('0x44')]?_0x8a4ee9[_0x0255('0x42')]:_0x5d9032[_0x0255('0x40')];if(!_0x48e462[_0x0255('0x41')][_0x0255('0x45')]('nolimit')){_0x8a4ee9[_0x0255('0x22')]=qs['limit'](_0x48e462[_0x0255('0x41')][_0x0255('0x22')]);_0x8a4ee9['offset']=qs[_0x0255('0x21')](_0x48e462[_0x0255('0x41')][_0x0255('0x21')]);}_0x8a4ee9['order']=qs[_0x0255('0x46')](_0x48e462[_0x0255('0x41')][_0x0255('0x46')]);_0x8a4ee9[_0x0255('0x47')]=qs[_0x0255('0x48')](_[_0x0255('0x49')](_0x48e462[_0x0255('0x41')],_0x5d9032[_0x0255('0x48')]),_0x21884b);var _0xe382fe=[];var _0x4d975e=squel[_0x0255('0x4a')]()[_0x0255('0x4b')]('id')[_0x0255('0x4b')](_0x0255('0x2c'))['field'](_0x0255('0x4c'))[_0x0255('0x4d')](_0x0255('0x4e'));var _0xc35601=squel[_0x0255('0x4a')]()['field'](_0x0255('0x4f'))['field'](_0x0255('0x50'))[_0x0255('0x4b')]('ui.OpenchannelInteractionId')['from'](_0x0255('0x51'),'ui')[_0x0255('0x52')](_0x0255('0x53'),'u',_0x0255('0x54'));var _0x854a2=squel[_0x0255('0x4a')]()[_0x0255('0x4d')](_0x0255('0x55'),'i')[_0x0255('0x52')](_0x0255('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0255('0x52')]('users','o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x0255('0x57'))[_0x0255('0x52')](_0x0255('0x58'),'me',_0x0255('0x59'))['left_join'](_0x0255('0x5a'),'it',_0x0255('0x5b'))[_0x0255('0x52')](_0x0255('0x4e'),'t',_0x0255('0x5c'));var _0xf6d87a=squel['expr']();var _0x226941=[];var _0x4b694d=squel['expr']();var _0x4d8272;if(_0x48e462[_0x0255('0x41')][_0x0255('0x5d')]){_0x4d8272=as[_0x0255('0x5e')](_0x48e462[_0x0255('0x41')]['search']);var _0x37cb50=_0x4d8272['sqlOperator'];for(var _0xce316a=0x0;_0xce316a<_0x4d8272[_0x0255('0x5f')][_0x0255('0x44')];_0xce316a++){var _0x156ad0=_0x4d8272[_0x0255('0x5f')][_0xce316a];var _0x823b19='i';var _0x3f5617=_['find'](_0x21884b,[_0x0255('0x2c'),_0x156ad0[_0x0255('0x4b')]]);if(!_0x3f5617){switch(_0x156ad0[_0x0255('0x4b')]){case'unreadMessages':if(_0x156ad0[_0x0255('0x60')]==0x1){_0x854a2[_0x0255('0x61')]('`'+_0x156ad0[_0x0255('0x4b')]+_0x0255('0x62'));}else{_0x854a2[_0x0255('0x61')]('`'+_0x156ad0[_0x0255('0x4b')]+_0x0255('0x63'));}break;case'Contact':if(_0x156ad0[_0x0255('0x64')]===_0x0255('0x65')){if(_0x156ad0[_0x0255('0x60')][_0x0255('0x31')]('\x20')['length']>0x1){_0xf6d87a[_0x37cb50](_0x0255('0x66'),qs[_0x0255('0x67')](_0x156ad0[_0x0255('0x60')]),null);}else{var _0x2f6d75='%'+_0x156ad0[_0x0255('0x60')]+'%';_0xf6d87a[_0x37cb50]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2f6d75,_0x2f6d75,_0x2f6d75);}}else{_0x3f5617=_[_0x0255('0x68')](_0x21884b,[_0x0255('0x2c'),_0x0255('0x69')]);_0x156ad0[_0x0255('0x4b')]=_0x0255('0x69');_0x49150f=as[_0x0255('0x6a')](_0x823b19,_0x3f5617[_0x0255('0x3e')],_0x156ad0);_0xf6d87a[_0x37cb50](_0x49150f[_0x0255('0x6b')],_0x49150f['value']['start'],_0x49150f[_0x0255('0x60')][_0x0255('0x2b')]);}break;case _0x0255('0x6c'):var _0x59252c=_0x156ad0[_0x0255('0x60')][_0x0255('0x31')](',')[_0x0255('0x3b')](function(_0x370812){return Number(_0x370812);});_0x59252c[_0x0255('0x6d')](function(_0x3e6130){_0x4b694d['or'](_0x0255('0x6e'),'%,'+_0x3e6130+',%');});_0x226941=_['union'](_0x226941,_0x59252c);break;case _0x0255('0x6f'):if(_0x156ad0[_0x0255('0x64')]===_0x0255('0x65')){_0xf6d87a[_0x37cb50](_0x0255('0x70'),'%'+_0x156ad0[_0x0255('0x60')]+'%',null);}else{_0x3f5617=_[_0x0255('0x68')](_0x21884b,[_0x0255('0x2c'),_0x0255('0x37')]);_0x156ad0[_0x0255('0x4b')]='UserId';_0x49150f=as['buildExpression'](_0x823b19,_0x3f5617[_0x0255('0x3e')],_0x156ad0);_0xf6d87a[_0x37cb50](_0x49150f[_0x0255('0x6b')],_0x49150f[_0x0255('0x60')]['start'],_0x49150f[_0x0255('0x60')][_0x0255('0x2b')]);}break;case _0x0255('0x71'):_0x49150f=as['buildExpression']('me',null,_0x156ad0);_0xf6d87a[_0x37cb50](_0x49150f[_0x0255('0x6b')],_0x49150f[_0x0255('0x60')][_0x0255('0x72')],_0x49150f['value'][_0x0255('0x2b')]);break;}}else{var _0x49150f=as[_0x0255('0x6a')](_0x823b19,_0x3f5617[_0x0255('0x3e')],_0x156ad0);_0xf6d87a[_0x37cb50](_0x49150f[_0x0255('0x6b')],_0x49150f[_0x0255('0x60')]['start'],_0x49150f[_0x0255('0x60')][_0x0255('0x2b')]);}}}else{var _0xd3ff7c=_(_0x48e462['query'])[_0x0255('0x73')]()[_0x0255('0x3b')](function(_0x5bfd24){return _[_0x0255('0x74')](_0x21884b,[_0x0255('0x2c'),_0x5bfd24])?_0x5bfd24:undefined;})[_0x0255('0x75')]()[_0x0255('0x60')]();if(!_['isEmpty'](_0xd3ff7c)){_0xd3ff7c[_0x0255('0x6d')](function(_0x556ed1){if(_0x556ed1===_0x0255('0x76')){_0x854a2[_0x0255('0x47')](_0x0255('0x77'),[][_0x0255('0x78')](_0x48e462['query'][_0x556ed1]));}else if(_0x556ed1===_0x0255('0x79')){var _0x1ce582=JSON[_0x0255('0x7a')](_0x48e462[_0x0255('0x41')][_0x556ed1])[_0x0255('0x7b')];var _0x4a2ce4=JSON['parse'](_0x48e462[_0x0255('0x41')][_0x556ed1])[_0x0255('0x7c')];_0x854a2[_0x0255('0x47')](_0x0255('0x7d'),_0x1ce582,_0x4a2ce4);}else{if(_0x48e462[_0x0255('0x41')][_0x556ed1]===_0x0255('0x7e')){_0x854a2['where']('i.'+_0x556ed1+'\x20IS\x20NULL');}else{_0x854a2[_0x0255('0x47')]('i.'+_0x556ed1+_0x0255('0x7f'),_0x48e462[_0x0255('0x41')][_0x556ed1]);}}});}if(_0x48e462[_0x0255('0x41')][_0x0255('0x80')]){if(_0x48e462['query'][_0x0255('0x80')]==0x1){_0x854a2[_0x0255('0x61')](_0x0255('0x81'));}else{_0x854a2['having']('`unreadMessages`\x20>\x200');}}if(_0x48e462['query']['tag']){_0x226941=_['isArray'](_0x48e462['query'][_0x0255('0x82')])?_0x48e462[_0x0255('0x41')][_0x0255('0x82')]:new Array(_0x48e462[_0x0255('0x41')][_0x0255('0x82')]);_0x226941[_0x0255('0x6d')](function(_0x27cf52){_0x4b694d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x27cf52+',%');});}if(_0x48e462[_0x0255('0x41')]['filter']){var _0xd980b8=_0x48e462[_0x0255('0x41')]['filter'][_0x0255('0x83')]('\x5c','\x5c\x5c')[_0x0255('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xd980b8)){_0xf6d87a['or'](_0x0255('0x84'),_0xd980b8+'%');}else{_0xf6d87a['or'](_0x0255('0x85'),qs['getFullTextValue'](_0xd980b8))['or']('i.from\x20LIKE\x20?',_0xd980b8+'%')['or'](_0x0255('0x86'),_0xd980b8+'%');}}}_0x854a2['where'](_0xf6d87a);_0x854a2['group']('i.id');var _0x179e49={'type':db['Sequelize'][_0x0255('0x87')]['SELECT'],'raw':!![]};var _0x317e3f=_0x854a2['clone']();_0x317e3f[_0x0255('0x4b')]('i.id');_0x317e3f[_0x0255('0x4b')](_0x0255('0x88'),_0x0255('0x89'));if(_0x8a4ee9[_0x0255('0x8a')]){_0x8a4ee9['order'][_0x0255('0x6d')](function(_0x330950){var _0x5327e3=_0x330950[0x0]==='contactName'?_0x330950[0x0]:'i.'+_0x330950[0x0];_0x854a2[_0x0255('0x8a')](_0x5327e3,_0x330950[0x1]===_0x0255('0x8b')?![]:!![]);});}if(!_[_0x0255('0x8c')](_0x226941)){_0x854a2[_0x0255('0x61')](_0x4b694d);_0x317e3f[_0x0255('0x47')](_0x0255('0x8d'),_0x226941);}BPromise[_0x0255('0x8e')]()['then'](function(){if(!_0x4d8272){if(_0x48e462[_0x0255('0x41')][_0x0255('0x76')])return;_0x317e3f[_0x0255('0x47')](_0x0255('0x8f'));_0x854a2[_0x0255('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x48e462[_0x0255('0x90')]['role']!==_0x0255('0x91'))return;return _0x48e462[_0x0255('0x90')][_0x0255('0x92')]({'attributes':['id'],'raw':!![]})[_0x0255('0x2a')](function(_0x5bc2ec){if(_['isEmpty'](_0x5bc2ec)){_0x317e3f['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x854a2['where'](_0x0255('0x93'));}else{_0x317e3f[_0x0255('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x0255('0x3b')](_0x5bc2ec,'id'));_0x854a2[_0x0255('0x47')](_0x0255('0x77'),_[_0x0255('0x3b')](_0x5bc2ec,'id'));}});})[_0x0255('0x2a')](function(){if(_0x48e462[_0x0255('0x90')][_0x0255('0x94')]==='agent'&&!_0x4d8272&&!_0x48e462[_0x0255('0x41')][_0x0255('0x76')])return[];return db[_0x0255('0x95')]['query'](_0x317e3f[_0x0255('0x96')](),_0x179e49);})['then'](function(_0x51fb17){_0x33e959['count']=_0x51fb17[_0x0255('0x44')];if(_0x33e959[_0x0255('0x97')]===0x0)return[];return db[_0x0255('0x95')]['query'](_0x4d975e[_0x0255('0x96')](),_0x179e49)[_0x0255('0x2a')](function(_0x3568ba){_0xe382fe=_[_0x0255('0x98')](_0x3568ba,'id');_0x179e49=_['merge'](_0x179e49,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48e462[_0x0255('0x41')][_0x0255('0x99')]){_0x8a4ee9[_0x0255('0x42')][_0x0255('0x6d')](function(_0x170f75){_0x854a2[_0x0255('0x4b')]('i.'+_0x170f75);});}else{_0x854a2[_0x0255('0x4b')](_0x0255('0x88'),_0x0255('0x89'));_0x854a2[_0x0255('0x4b')](_0x0255('0x9a'),_0x0255('0x9b'));_0x854a2[_0x0255('0x4b')]('a.mandatoryDisposition',_0x0255('0x9c'));_0x854a2[_0x0255('0x4b')](_0x0255('0x9d'),'contactName');_0x854a2[_0x0255('0x4b')](_0x0255('0x9e'));_0x854a2[_0x0255('0x4b')](_0x0255('0x9f'),_0x0255('0xa0'));_0x854a2[_0x0255('0x4b')](_0x0255('0xa1'),_0x0255('0xa2'));_0x854a2[_0x0255('0x4b')](_0x0255('0xa3'),_0x0255('0xa4'));_0x854a2[_0x0255('0x4b')](_0x0255('0xa5'),'Contact.phone');_0x854a2[_0x0255('0x4b')](_0x0255('0xa6'),_0x0255('0xa7'));_0x854a2['field'](_0x0255('0xa8'),_0x0255('0xa9'));_0x854a2[_0x0255('0x4b')]('o.fullname','Owner.fullname');_0x854a2[_0x0255('0x4b')]('o.internal',_0x0255('0xaa'));_0x854a2['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0255('0x2f'));}if(_0x8a4ee9[_0x0255('0x22')])_0x854a2[_0x0255('0x22')](_0x8a4ee9['limit']);if(_0x8a4ee9[_0x0255('0x21')])_0x854a2['offset'](_0x8a4ee9[_0x0255('0x21')]);return db[_0x0255('0x95')][_0x0255('0x41')](_0x854a2['toString'](),_0x179e49);})['then'](function(_0x2f9dd7){if(_0x2f9dd7['length']>0x0)_0xc35601[_0x0255('0x47')](_0x0255('0xab'),_[_0x0255('0x3b')](_0x2f9dd7,'id'));return db[_0x0255('0x95')]['query'](_0xc35601[_0x0255('0x96')](),_0x179e49)[_0x0255('0x2a')](function(_0x862160){var _0x2ae840=_[_0x0255('0xac')](_0x862160,'OpenchannelInteractionId');var _0x3a316d=[];_0x2f9dd7['forEach'](function(_0xccb60f){_0x3a316d[_0x0255('0x32')](updateOpenchannelInteraction(_0xccb60f,_0xe382fe,_0x2ae840));});return BPromise['all'](_0x3a316d);});});})['then'](function(_0x5a0b60){_0x33e959[_0x0255('0xad')]=_0x5a0b60;return _0x33e959;})[_0x0255('0x2a')](respondWithFilteredResult(_0x208f28,_0x8a4ee9))['catch'](handleError(_0x208f28,null));};exports[_0x0255('0xae')]=function(_0x4653bb,_0x4cb4e7){var _0x2e0b7d={};if(_0x4653bb[_0x0255('0x41')][_0x0255('0x3e')]&&_0x4653bb[_0x0255('0x41')][_0x0255('0x3e')]==='from'){_0x2e0b7d['from']=_0x4653bb[_0x0255('0xaf')]['id'];}else{_0x2e0b7d['id']=_0x4653bb['params']['id'];}var _0x5c5bf4={'raw':![],'where':_0x2e0b7d},_0x32451e={};_0x32451e[_0x0255('0x40')]=_['keys'](db[_0x0255('0xb0')][_0x0255('0x3c')]);_0x32451e['query']=_[_0x0255('0x73')](_0x4653bb['query']);_0x32451e[_0x0255('0x48')]=_[_0x0255('0x43')](_0x32451e['model'],_0x32451e['query']);_0x5c5bf4[_0x0255('0x42')]=_[_0x0255('0x43')](_0x32451e[_0x0255('0x40')],qs[_0x0255('0x99')](_0x4653bb['query'][_0x0255('0x99')]));_0x5c5bf4[_0x0255('0x42')]=_0x5c5bf4[_0x0255('0x42')][_0x0255('0x44')]?_0x5c5bf4[_0x0255('0x42')]:_0x32451e[_0x0255('0x40')];if(_0x4653bb[_0x0255('0x41')]['includeAll']){_0x5c5bf4['include']=[{'all':!![]}];}_0x5c5bf4=_[_0x0255('0xb1')]({},_0x5c5bf4,_0x4653bb[_0x0255('0xb2')]);return db[_0x0255('0xb0')]['find'](_0x5c5bf4)[_0x0255('0x2a')](handleEntityNotFound(_0x4cb4e7,null))[_0x0255('0x2a')](respondWithResult(_0x4cb4e7,null))[_0x0255('0xb3')](handleError(_0x4cb4e7,null));};exports[_0x0255('0xb4')]=function(_0x33e257,_0x44aabc){return db[_0x0255('0xb0')]['create'](_0x33e257[_0x0255('0x71')],{})[_0x0255('0x2a')](respondWithResult(_0x44aabc,0xc9))[_0x0255('0xb3')](handleError(_0x44aabc,null));};exports[_0x0255('0x29')]=function(_0x17a839,_0x1c925a){if(_0x17a839[_0x0255('0x71')]['id']){delete _0x17a839[_0x0255('0x71')]['id'];}return db[_0x0255('0xb0')][_0x0255('0x68')]({'where':{'id':_0x17a839[_0x0255('0xaf')]['id']}})['then'](handleEntityNotFound(_0x1c925a,null))[_0x0255('0x2a')](saveUpdates(_0x17a839[_0x0255('0x71')],null))[_0x0255('0x2a')](respondWithResult(_0x1c925a,null))[_0x0255('0xb3')](handleError(_0x1c925a,null));};exports['destroy']=function(_0x2a6f32,_0x32ec06){return db[_0x0255('0xb0')][_0x0255('0x68')]({'where':{'id':_0x2a6f32[_0x0255('0xaf')]['id']}})['then'](handleEntityNotFound(_0x32ec06,null))[_0x0255('0x2a')](removeEntity(_0x32ec06,null))['catch'](handleError(_0x32ec06,null));};exports[_0x0255('0xb5')]=function(_0x3b646b,_0x5a507c){return db[_0x0255('0xb0')][_0x0255('0xb5')]()[_0x0255('0x2a')](respondWithResult(_0x5a507c,null))[_0x0255('0xb3')](handleError(_0x5a507c,null));};exports['addMessage']=function(_0x4b46b8,_0x2bdb3c,_0x27dbee){return db[_0x0255('0xb6')][_0x0255('0x68')]({'where':{'id':_0x4b46b8[_0x0255('0xaf')]['id']}})[_0x0255('0x2a')](handleEntityNotFound(_0x2bdb3c,null))[_0x0255('0x2a')](function(_0x3de1d3){if(_0x3de1d3){return _0x3de1d3[_0x0255('0xb7')](_0x4b46b8[_0x0255('0x71')]['ids'],_[_0x0255('0xb8')](_0x4b46b8[_0x0255('0x71')],[_0x0255('0xb9'),'id'])||{});}})[_0x0255('0x2a')](respondWithResult(_0x2bdb3c,null))[_0x0255('0xb3')](handleError(_0x2bdb3c,null));};exports[_0x0255('0xba')]=function(_0x1013c5,_0x4e97f1,_0x4dca5e){var _0x3d0988={'raw':![],'where':{}};var _0x38e53b={};var _0x326bf3={'count':0x0,'rows':[]};return db[_0x0255('0xb0')][_0x0255('0xbb')]({'where':{'id':_0x1013c5[_0x0255('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4e97f1,null))[_0x0255('0x2a')](function(_0x4972c8){if(_0x4972c8){_0x38e53b[_0x0255('0x40')]=_['keys'](db[_0x0255('0xb6')][_0x0255('0x3c')]);_0x38e53b[_0x0255('0x41')]=_[_0x0255('0x73')](_0x1013c5[_0x0255('0x41')]);_0x38e53b[_0x0255('0x48')]=_[_0x0255('0x43')](_0x38e53b['model'],_0x38e53b[_0x0255('0x41')]);_0x3d0988[_0x0255('0x42')]=_[_0x0255('0x43')](_0x38e53b[_0x0255('0x40')],qs[_0x0255('0x99')](_0x1013c5[_0x0255('0x41')][_0x0255('0x99')]));_0x3d0988[_0x0255('0x42')]=_0x3d0988[_0x0255('0x42')][_0x0255('0x44')]?_0x3d0988[_0x0255('0x42')]:_0x38e53b[_0x0255('0x40')];if(!_0x1013c5[_0x0255('0x41')][_0x0255('0x45')](_0x0255('0xbc'))){_0x3d0988['limit']=qs[_0x0255('0x22')](_0x1013c5[_0x0255('0x41')][_0x0255('0x22')]);_0x3d0988[_0x0255('0x21')]=qs['offset'](_0x1013c5[_0x0255('0x41')][_0x0255('0x21')]);}_0x3d0988['order']=qs['sort'](_0x1013c5[_0x0255('0x41')][_0x0255('0x46')]);_0x3d0988[_0x0255('0x47')]=qs[_0x0255('0x48')](_[_0x0255('0x49')](_0x1013c5['query'],_0x38e53b[_0x0255('0x48')]));_0x3d0988[_0x0255('0x47')][_0x0255('0xbd')]=_0x4972c8['id'];if(_0x1013c5[_0x0255('0x41')][_0x0255('0xbe')]){_0x3d0988['where']=_[_0x0255('0xb1')](_0x3d0988[_0x0255('0x47')],{'$or':_[_0x0255('0x3b')](_0x3d0988['attributes'],function(_0x1c455d){var _0xf241dd={};_0xf241dd[_0x1c455d]={'$like':'%'+_0x1013c5[_0x0255('0x41')]['filter']+'%'};return _0xf241dd;})});}if(_0x1013c5[_0x0255('0x41')][_0x0255('0x7b')]){var _0x252201=_0x1013c5['query'][_0x0255('0x7b')]['split'](',');var _0x58d30a={};_0x58d30a[_0x252201[0x0]]={'$gte':moment(_0x252201[0x1])['format'](_0x0255('0xbf'))};_0x3d0988[_0x0255('0x47')]=_[_0x0255('0xb1')](_0x3d0988['where'],_0x58d30a);}_0x3d0988=_['merge']({},_0x3d0988,_0x1013c5['options']);return db[_0x0255('0xb6')][_0x0255('0x97')]({'where':_0x3d0988[_0x0255('0x47')]})['then'](function(_0x481422){_0x326bf3[_0x0255('0x97')]=_0x481422;if(_0x1013c5[_0x0255('0x41')][_0x0255('0xc0')]){_0x3d0988[_0x0255('0xc1')]=[{'all':!![]}];}return db[_0x0255('0xb6')][_0x0255('0xc2')](_0x3d0988);})[_0x0255('0x2a')](function(_0x2e81ef){_0x326bf3[_0x0255('0xad')]=_0x2e81ef;return _0x326bf3;});}})[_0x0255('0x2a')](respondWithFilteredResult(_0x4e97f1,_0x3d0988))['catch'](handleError(_0x4e97f1,null));};exports[_0x0255('0xc3')]=function(_0x320b8d,_0x4a53e2,_0x53490c){return db[_0x0255('0xb0')][_0x0255('0x68')]({'where':{'id':_0x320b8d[_0x0255('0xaf')]['id']}})[_0x0255('0x2a')](handleEntityNotFound(_0x4a53e2,null))['then'](function(_0x2f5d3a){if(_0x2f5d3a){return _0x2f5d3a[_0x0255('0xc4')](_0x320b8d[_0x0255('0x71')][_0x0255('0xb9')],_[_0x0255('0xb8')](_0x320b8d[_0x0255('0x71')],[_0x0255('0xb9'),'id'])||{})[_0x0255('0xc5')](function(){return db['Tag'][_0x0255('0xc2')]({'attributes':['id',_0x0255('0x2c'),_0x0255('0x4c')],'where':{'id':_0x320b8d[_0x0255('0x71')][_0x0255('0xb9')]}});})[_0x0255('0x2a')](function(_0x227dd4){socket[_0x0255('0xc6')]('openchannelInteractionTags:save',{'id':Number(_0x320b8d[_0x0255('0xaf')]['id']),'tags':_0x227dd4||[]});return{'id':Number(_0x320b8d['params']['id']),'tags':_0x227dd4||[]};});}})['then'](respondWithResult(_0x4a53e2,null))[_0x0255('0xb3')](handleError(_0x4a53e2,null));};exports['removeTags']=function(_0x2e8a73,_0x3fb159,_0x480774){return db[_0x0255('0xb0')][_0x0255('0x68')]({'where':{'id':_0x2e8a73[_0x0255('0xaf')]['id']}})[_0x0255('0x2a')](handleEntityNotFound(_0x3fb159,null))[_0x0255('0x2a')](function(_0x26d7c2){if(_0x26d7c2){return _0x26d7c2[_0x0255('0xc7')](_0x2e8a73[_0x0255('0x41')][_0x0255('0xb9')]);}})[_0x0255('0x2a')](respondWithStatusCode(_0x3fb159,null))[_0x0255('0xb3')](handleError(_0x3fb159,null));};exports[_0x0255('0xc8')]=function(_0x41a709,_0x4e19d3){var _0x5be738=moment()[_0x0255('0xc9')]()[_0x0255('0x96')]();var _0xadc3c9=path[_0x0255('0xca')](config[_0x0255('0xcb')],'server','files','tmp');var _0x183a2a=path[_0x0255('0xca')](config[_0x0255('0xcb')],_0x0255('0xcc'),_0x0255('0xcd'),'attachments');var _0x333e18=path['join'](_0xadc3c9,_0x5be738);var _0x599fe5=util[_0x0255('0xce')](_0x0255('0xcf'),_0x41a709[_0x0255('0xaf')]['id'],_0x5be738);var _0x571e82=path[_0x0255('0xca')](_0xadc3c9,_0x599fe5);var _0x235298=[];_0x235298[_0x0255('0x32')]({'model':db['User'],'as':_0x0255('0x6f'),'attributes':['id',_0x0255('0xd0')],'raw':!![]});_0x235298['push']({'model':db[_0x0255('0xd1')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x41a709[_0x0255('0x41')][_0x0255('0xd2')]){_0x235298[_0x0255('0x32')]({'model':db[_0x0255('0xd3')],'as':_0x0255('0xd3'),'raw':!![]});}var _0x50bedd=[{'model':db[_0x0255('0xb6')],'as':'Messages','attributes':['id',_0x0255('0x71'),_0x0255('0x79'),'direction',_0x0255('0xd4'),_0x0255('0x80')],'include':_0x235298}];_0x50bedd[_0x0255('0x32')]({'model':db[_0x0255('0xd5')],'as':_0x0255('0xd6'),'attributes':['id',_0x0255('0x2c')]});_0x50bedd['push']({'model':db[_0x0255('0x6f')],'as':_0x0255('0xd7'),'attributes':['id',_0x0255('0xd0')]});return db[_0x0255('0xb0')][_0x0255('0x68')]({'where':{'id':_0x41a709[_0x0255('0xaf')]['id']},'include':_0x50bedd})[_0x0255('0x2a')](handleEntityNotFound(_0x4e19d3,null))[_0x0255('0x2a')](function(_0x3a5bb0){if(_0x3a5bb0){var _0x83eff1=_0x3a5bb0[_0x0255('0xd8')]({'plain':!![]});fs[_0x0255('0xd9')](_0x333e18);var _0x16798a={'channel':_0x0255('0xda'),'account':_0x83eff1[_0x0255('0xd6')][_0x0255('0x2c')],'agent':_0x83eff1['Owner']?_0x83eff1['Owner']['fullname']:_0x0255('0xdb'),'createdAt':moment(_0x83eff1[_0x0255('0x79')])[_0x0255('0xce')](_0x0255('0xbf'))[_0x0255('0x96')](),'closedAt':_0x83eff1[_0x0255('0x36')]?moment(_0x83eff1[_0x0255('0xdc')])[_0x0255('0xce')](_0x0255('0xbf'))['toString']():'','disposition':_0x83eff1[_0x0255('0xdd')],'visibility':_0x83eff1[_0x0255('0xde')]?_0x0255('0xdf'):_0x0255('0xe0'),'messages':_(_0x83eff1[_0x0255('0xe1')])[_0x0255('0xbe')]({'secret':![]})[_0x0255('0x3b')](function(_0x19dde3){if(_0x19dde3[_0x0255('0xd3')]){var _0x803edb=path['join'](_0x183a2a,_0x19dde3[_0x0255('0xd3')]['basename']);if(fs[_0x0255('0xe2')](_0x803edb)){fs[_0x0255('0xe3')](_0x803edb)['pipe'](fs[_0x0255('0xe4')](path[_0x0255('0xca')](_0x333e18,_0x19dde3[_0x0255('0xd3')][_0x0255('0xe5')])));}}return{'date':moment(_0x19dde3[_0x0255('0x79')])[_0x0255('0xce')](_0x0255('0xbf'))[_0x0255('0x96')](),'sender':_0x19dde3['direction']===_0x0255('0xe6')?_0x19dde3['User']?_0x19dde3['User'][_0x0255('0xd0')]:_0x0255('0xe7'):_0x19dde3[_0x0255('0xe8')][_0x0255('0xe9')]+(_0x19dde3[_0x0255('0xe8')][_0x0255('0xea')]?'\x20'+_0x19dde3['Contact'][_0x0255('0xea')]:''),'body':_0x19dde3[_0x0255('0xd3')]?_0x19dde3[_0x0255('0xd3')][_0x0255('0xe5')]:_0x19dde3[_0x0255('0x71')],'direction':_0x19dde3[_0x0255('0xeb')]===_0x0255('0xe6')?'A':'C','secret':_0x19dde3[_0x0255('0xd4')],'read':_0x19dde3[_0x0255('0x80')],'attachment':_0x19dde3['Attachment']};})[_0x0255('0x60')]()};return ejs['renderFile'](path[_0x0255('0xca')](config[_0x0255('0xcb')],_0x0255('0xcc'),_0x0255('0xec'),_0x0255('0xed')),{'interaction':_0x16798a})[_0x0255('0x2a')](function(_0x46a06e){var _0x44a198=path[_0x0255('0xca')](_0x333e18,_0x0255('0xee')+_0x83eff1['id']+'-'+_0x5be738+_0x0255('0xef'));var _0x3aa602={'path':_0x44a198,'channel':_0x0255('0xda'),'interactionId':_0x83eff1['id']};return pdf[_0x0255('0xf0')](_0x46a06e,_0x3aa602);})[_0x0255('0x2a')](function(){return new BPromise(function(_0xfba29b,_0x5db4fd){zipdir(_0x333e18,{'saveTo':_0x571e82},function(_0x488671,_0x5a8138){if(_0x488671)return _0x5db4fd(_0x488671);return _0xfba29b(_0x5a8138);});})[_0x0255('0x2a')](function(){return new BPromise(function(_0x2ca8dc,_0x2d4df1){rimraf(_0x333e18,function(_0x8e5cb3){if(_0x8e5cb3)_0x2d4df1(_0x8e5cb3);return _0x2ca8dc();});});})[_0x0255('0x2a')](function(){return _0x4e19d3[_0x0255('0xc8')](_0x571e82,_0x599fe5,function(_0x29027b){if(_0x29027b){console[_0x0255('0xf1')](_0x0255('0xf2'),_0x29027b);}else{fs[_0x0255('0xf3')](_0x571e82);}});});});}else{return _0x4e19d3[_0x0255('0x1e')](0xc8);}})[_0x0255('0xb3')](handleError(_0x4e19d3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 12dbdce..3509766 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 _0x3c7d=['remove','getUsers','then','setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3c7d,0x127));var _0xd3c7=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x3c7d[_0x455c6c];return _0x488242;};'use strict';var EventEmitter=require(_0xd3c7('0x0'));var OpenchannelInteraction=require(_0xd3c7('0x1'))['db'][_0xd3c7('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd3c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd3c7('0x4'),'afterDestroy':_0xd3c7('0x5')};function emitEvent(_0xd196af){return function(_0x52bc5b,_0x25212c,_0x153c39){_0x52bc5b[_0xd3c7('0x6')]({'attributes':['id'],'raw':!![]})[_0xd3c7('0x7')](function(_0x348fb7){_0x52bc5b[_0xd3c7('0x8')]('Users',_0x348fb7[_0xd3c7('0x9')](function(_0x340c14){return{'id':_0x340c14['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x52bc5b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3c7('0x7')](function(_0x5ebd8c){_0x52bc5b[_0xd3c7('0x8')](_0xd3c7('0xa'),_0x5ebd8c['length']);OpenchannelInteractionEvents[_0xd3c7('0xb')](_0xd196af+':'+_0x52bc5b['id'],_0x52bc5b);OpenchannelInteractionEvents[_0xd3c7('0xb')](_0xd196af,_0x52bc5b);_0x153c39(null);})[_0xd3c7('0xc')](_0x153c39(null));};}for(var e in events){if(events[_0xd3c7('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xd3c7('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x46ec=['findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x46ec,0x1a7));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xc46e('0x0'))['db'][_0xc46e('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc46e('0x2')](0x0);var events={'afterCreate':_0xc46e('0x3'),'afterUpdate':_0xc46e('0x4'),'afterDestroy':_0xc46e('0x5')};function emitEvent(_0x190fe3){return function(_0x4a85e5,_0x158afc,_0x1ce4a0){_0x4a85e5[_0xc46e('0x6')]({'attributes':['id'],'raw':!![]})[_0xc46e('0x7')](function(_0x179af9){_0x4a85e5[_0xc46e('0x8')]('Users',_0x179af9['map'](function(_0x2469c3){return{'id':_0x2469c3['id']};}));return OpenchannelMessage[_0xc46e('0x9')]({'where':{'OpenchannelInteractionId':_0x4a85e5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc46e('0x7')](function(_0x17dc62){_0x4a85e5['setDataValue'](_0xc46e('0xa'),_0x17dc62[_0xc46e('0xb')]);OpenchannelInteractionEvents['emit'](_0x190fe3+':'+_0x4a85e5['id'],_0x4a85e5);OpenchannelInteractionEvents['emit'](_0x190fe3,_0x4a85e5);_0x1ce4a0(null);})[_0xc46e('0xc')](_0x1ce4a0(null));};}for(var e in events){if(events[_0xc46e('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xc46e('0xe')](e,emitEvent(event));}}module[_0xc46e('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0d648e7..3efbc46 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 _0x54c6=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x54c6,0x195));var _0x654c=function(_0x20a270,_0x8b8437){_0x20a270=_0x20a270-0x0;var _0x49429a=_0x54c6[_0x20a270];return _0x49429a;};'use strict';var _=require(_0x654c('0x0'));var util=require(_0x654c('0x1'));var logger=require(_0x654c('0x2'))('api');var moment=require(_0x654c('0x3'));var BPromise=require(_0x654c('0x4'));var rp=require(_0x654c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x654c('0x6'));var config=require(_0x654c('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x654c('0x8')]=function(_0x2c1f72,_0x17d45b){return _0x2c1f72[_0x654c('0x9')](_0x654c('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x654c('0xb'),'hooks':{'beforeUpdate':function(_0x30f618,_0x29830a,_0x26f4c3){if(_0x30f618[_0x654c('0xc')](_0x654c('0xd'))){_0x30f618[_0x654c('0xe')]=moment()[_0x654c('0xf')](_0x654c('0x10'));}_0x26f4c3(null,_0x30f618);}}});}; \ No newline at end of file +var _0xd089=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x2ac691,_0x4ada84){var _0x29eb24=function(_0x5aa289){while(--_0x5aa289){_0x2ac691['push'](_0x2ac691['shift']());}};_0x29eb24(++_0x4ada84);}(_0xd089,0x167));var _0x9d08=function(_0x1d257c,_0x97df2b){_0x1d257c=_0x1d257c-0x0;var _0x595d51=_0xd089[_0x1d257c];return _0x595d51;};'use strict';var _=require('lodash');var util=require(_0x9d08('0x0'));var logger=require(_0x9d08('0x1'))(_0x9d08('0x2'));var moment=require(_0x9d08('0x3'));var BPromise=require(_0x9d08('0x4'));var rp=require(_0x9d08('0x5'));var fs=require('fs');var path=require(_0x9d08('0x6'));var rimraf=require(_0x9d08('0x7'));var config=require(_0x9d08('0x8'));var attributes=require(_0x9d08('0x9'));module['exports']=function(_0xcce2ce,_0x57c5e5){return _0xcce2ce['define'](_0x9d08('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d08('0xb'),'collate':_0x9d08('0xc'),'hooks':{'beforeUpdate':function(_0x3f4afd,_0xacbc61,_0x107528){if(_0x3f4afd[_0x9d08('0xd')](_0x9d08('0xe'))){_0x3f4afd[_0x9d08('0xf')]=moment()[_0x9d08('0x10')](_0x9d08('0x11'));}_0x107528(null,_0x3f4afd);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ab37814..d739c33 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 _0x8169=['update','raw','options','where','attributes','debug','stringify','catch','find','addTags','body','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction'];(function(_0x4fb58c,_0x3a737c){var _0x1d8e77=function(_0x5f1387){while(--_0x5f1387){_0x4fb58c['push'](_0x4fb58c['shift']());}};_0x1d8e77(++_0x3a737c);}(_0x8169,0xfe));var _0x9816=function(_0x4c3d4a,_0x3d5888){_0x4c3d4a=_0x4c3d4a-0x0;var _0x189ad6=_0x8169[_0x4c3d4a];return _0x189ad6;};'use strict';var _=require('lodash');var util=require(_0x9816('0x0'));var moment=require(_0x9816('0x1'));var BPromise=require(_0x9816('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9816('0x3'));var db=require(_0x9816('0x4'))['db'];var utils=require(_0x9816('0x5'));var logger=require(_0x9816('0x6'))(_0x9816('0x7'));var config=require(_0x9816('0x8'));var jayson=require(_0x9816('0x9'));var client=jayson[_0x9816('0xa')]['http']({'port':0x232a});config[_0x9816('0xb')]=_[_0x9816('0xc')](config[_0x9816('0xb')],{'host':_0x9816('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x137041,_0x5984b3,_0x2dba4a){return new BPromise(function(_0x20018d,_0x370770){return client[_0x9816('0xe')](_0x137041,_0x2dba4a)[_0x9816('0xf')](function(_0x37728c){logger['info'](_0x9816('0x10'),_0x5984b3,_0x9816('0x11'));logger['debug'](_0x9816('0x12'),_0x5984b3,'request\x20sent',JSON['stringify'](_0x37728c));if(_0x37728c[_0x9816('0x13')]){if(_0x37728c[_0x9816('0x13')][_0x9816('0x14')]===0x1f4){logger[_0x9816('0x13')](_0x9816('0x10'),_0x5984b3,_0x37728c[_0x9816('0x13')][_0x9816('0x15')]);return _0x370770(_0x37728c[_0x9816('0x13')][_0x9816('0x15')]);}logger[_0x9816('0x13')](_0x9816('0x10'),_0x5984b3,_0x37728c[_0x9816('0x13')]['message']);return _0x20018d(_0x37728c[_0x9816('0x13')][_0x9816('0x15')]);}else{logger[_0x9816('0x16')](_0x9816('0x10'),_0x5984b3,_0x9816('0x11'));_0x20018d(_0x37728c[_0x9816('0x17')][_0x9816('0x15')]);}})['catch'](function(_0x58a85c){logger[_0x9816('0x13')](_0x9816('0x10'),_0x5984b3,_0x58a85c);_0x370770(_0x58a85c);});});}exports[_0x9816('0x18')]=function(_0x3242ad){var _0x4dc628=this;return new Promise(function(_0x5cd277,_0x4cd2a0){return db[_0x9816('0x19')][_0x9816('0x1a')](_0x3242ad['body'],{'raw':_0x3242ad['options']?_0x3242ad['options'][_0x9816('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3242ad[_0x9816('0x1c')]?_0x3242ad[_0x9816('0x1c')][_0x9816('0x1d')]||null:null,'attributes':_0x3242ad[_0x9816('0x1c')]?_0x3242ad[_0x9816('0x1c')][_0x9816('0x1e')]||null:null,'limit':_0x3242ad[_0x9816('0x1c')]?_0x3242ad['options']['limit']||null:null})['then'](function(_0x136ce4){logger[_0x9816('0x16')](_0x9816('0x18'),_0x3242ad);logger[_0x9816('0x1f')](_0x9816('0x18'),_0x3242ad,JSON[_0x9816('0x20')](_0x136ce4));_0x5cd277(_0x136ce4);})[_0x9816('0x21')](function(_0x44f662){logger[_0x9816('0x13')]('UpdateOpenchannelInteraction',_0x44f662[_0x9816('0x15')],_0x3242ad);_0x4cd2a0(_0x4dc628[_0x9816('0x13')](0x1f4,_0x44f662[_0x9816('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4102a2){return new Promise(function(_0x55dd9e,_0x267728){return db[_0x9816('0x19')][_0x9816('0x22')]({'where':_0x4102a2['options']?_0x4102a2[_0x9816('0x1c')][_0x9816('0x1d')]||null:null})[_0x9816('0xf')](function(_0x13742b){if(_0x13742b){return _0x13742b[_0x9816('0x23')](_0x4102a2[_0x9816('0x24')][_0x9816('0x25')],_['omit'](_0x4102a2['body'],[_0x9816('0x25'),'id'])||{});}})[_0x9816('0x26')](function(_0x2a4780){logger['info'](_0x9816('0x27'),_0x4102a2);logger['debug'](_0x9816('0x27'),_0x4102a2,JSON[_0x9816('0x20')](_0x2a4780));_0x55dd9e(_0x2a4780);})[_0x9816('0x21')](function(_0x54cb2d){logger['error'](_0x9816('0x27'),_0x54cb2d['message'],_0x4102a2);_0x267728(_this[_0x9816('0x13')](0x1f4,_0x54cb2d[_0x9816('0x15')]));});});}; \ No newline at end of file +var _0x0e20=['then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0e20,0x1a9));var _0x00e2=function(_0x231ee4,_0x207068){_0x231ee4=_0x231ee4-0x0;var _0x360a0e=_0x0e20[_0x231ee4];return _0x360a0e;};'use strict';var _=require('lodash');var util=require(_0x00e2('0x0'));var moment=require(_0x00e2('0x1'));var BPromise=require(_0x00e2('0x2'));var rs=require(_0x00e2('0x3'));var fs=require('fs');var Redis=require(_0x00e2('0x4'));var db=require(_0x00e2('0x5'))['db'];var utils=require(_0x00e2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x00e2('0x7'));var jayson=require(_0x00e2('0x8'));var client=jayson[_0x00e2('0x9')][_0x00e2('0xa')]({'port':0x232a});config[_0x00e2('0xb')]=_['defaults'](config[_0x00e2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x00e2('0xc'))(new Redis(config[_0x00e2('0xb')]));require('./openchannelInteraction.socket')[_0x00e2('0xd')](socket);function respondWithRpcPromise(_0x506896,_0x245d61,_0xa199bd){return new BPromise(function(_0xd9e447,_0x3c12f9){return client[_0x00e2('0xe')](_0x506896,_0xa199bd)[_0x00e2('0xf')](function(_0x3093a2){logger[_0x00e2('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x245d61,'request\x20sent');logger[_0x00e2('0x11')](_0x00e2('0x12'),_0x245d61,_0x00e2('0x13'),JSON[_0x00e2('0x14')](_0x3093a2));if(_0x3093a2[_0x00e2('0x15')]){if(_0x3093a2[_0x00e2('0x15')][_0x00e2('0x16')]===0x1f4){logger[_0x00e2('0x15')](_0x00e2('0x17'),_0x245d61,_0x3093a2['error'][_0x00e2('0x18')]);return _0x3c12f9(_0x3093a2[_0x00e2('0x15')][_0x00e2('0x18')]);}logger[_0x00e2('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x245d61,_0x3093a2[_0x00e2('0x15')][_0x00e2('0x18')]);return _0xd9e447(_0x3093a2[_0x00e2('0x15')]['message']);}else{logger[_0x00e2('0x10')](_0x00e2('0x17'),_0x245d61,_0x00e2('0x13'));_0xd9e447(_0x3093a2[_0x00e2('0x19')][_0x00e2('0x18')]);}})[_0x00e2('0x1a')](function(_0x49c6bb){logger[_0x00e2('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x245d61,_0x49c6bb);_0x3c12f9(_0x49c6bb);});});}exports[_0x00e2('0x1b')]=function(_0x4dce83){var _0x4e9417=this;return new Promise(function(_0x4c7823,_0xb42237){return db['OpenchannelInteraction'][_0x00e2('0x1c')](_0x4dce83[_0x00e2('0x1d')],{'raw':_0x4dce83['options']?_0x4dce83[_0x00e2('0x1e')][_0x00e2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dce83[_0x00e2('0x1e')]?_0x4dce83[_0x00e2('0x1e')][_0x00e2('0x20')]||null:null,'attributes':_0x4dce83[_0x00e2('0x1e')]?_0x4dce83[_0x00e2('0x1e')][_0x00e2('0x21')]||null:null,'limit':_0x4dce83[_0x00e2('0x1e')]?_0x4dce83[_0x00e2('0x1e')][_0x00e2('0x22')]||null:null})['then'](function(_0x5799ee){logger[_0x00e2('0x10')]('UpdateOpenchannelInteraction',_0x4dce83);logger[_0x00e2('0x11')](_0x00e2('0x1b'),_0x4dce83,JSON[_0x00e2('0x14')](_0x5799ee));_0x4c7823(_0x5799ee);})[_0x00e2('0x1a')](function(_0x3040de){logger[_0x00e2('0x15')](_0x00e2('0x1b'),_0x3040de[_0x00e2('0x18')],_0x4dce83);_0xb42237(_0x4e9417[_0x00e2('0x15')](0x1f4,_0x3040de[_0x00e2('0x18')]));});});};exports[_0x00e2('0x23')]=function(_0x51c8e8){return new Promise(function(_0x860f24,_0x4a33d8){return db['OpenchannelInteraction'][_0x00e2('0x24')]({'where':_0x51c8e8[_0x00e2('0x1e')]?_0x51c8e8[_0x00e2('0x1e')][_0x00e2('0x20')]||null:null})[_0x00e2('0xf')](function(_0x6c05a0){if(_0x6c05a0){return _0x6c05a0[_0x00e2('0x25')](_0x51c8e8[_0x00e2('0x1d')]['ids'],_['omit'](_0x51c8e8[_0x00e2('0x1d')],['ids','id'])||{});}})[_0x00e2('0x26')](function(_0x7417bb){logger[_0x00e2('0x10')]('AddTags',_0x51c8e8);logger['debug'](_0x00e2('0x27'),_0x51c8e8,JSON[_0x00e2('0x14')](_0x7417bb));_0x860f24(_0x7417bb);})['catch'](function(_0x7831af){logger[_0x00e2('0x15')](_0x00e2('0x27'),_0x7831af['message'],_0x51c8e8);_0x4a33d8(_this[_0x00e2('0x15')](0x1f4,_0x7831af[_0x00e2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a3af1b4..ce72d4f 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 _0x3b51=['./openchannelInteraction.events','remove','update','emit','register','openchannelInteraction:'];(function(_0x2c34c1,_0x3f9aa7){var _0x587ccc=function(_0x24bb12){while(--_0x24bb12){_0x2c34c1['push'](_0x2c34c1['shift']());}};_0x587ccc(++_0x3f9aa7);}(_0x3b51,0x186));var _0x13b5=function(_0x481f99,_0x458b72){_0x481f99=_0x481f99-0x0;var _0x721d60=_0x3b51[_0x481f99];return _0x721d60;};'use strict';var OpenchannelInteractionEvents=require(_0x13b5('0x0'));var events=['save',_0x13b5('0x1'),_0x13b5('0x2')];function createListener(_0x4b2651,_0x462217){return function(_0x18a414){_0x462217[_0x13b5('0x3')](_0x4b2651,_0x18a414);};}function removeListener(_0x1e5865,_0x50e2c3){return function(){OpenchannelInteractionEvents['removeListener'](_0x1e5865,_0x50e2c3);};}exports[_0x13b5('0x4')]=function(_0x33733c){for(var _0x53fa2c=0x0,_0x927b84=events['length'];_0x53fa2c<_0x927b84;_0x53fa2c++){var _0x557300=events[_0x53fa2c];var _0x1241bd=createListener(_0x13b5('0x5')+_0x557300,_0x33733c);OpenchannelInteractionEvents['on'](_0x557300,_0x1241bd);}}; \ No newline at end of file +var _0x80f7=['update','emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x80f7,0x6d));var _0x780f=function(_0x58df3b,_0x182132){_0x58df3b=_0x58df3b-0x0;var _0x1c82d6=_0x80f7[_0x58df3b];return _0x1c82d6;};'use strict';var OpenchannelInteractionEvents=require(_0x780f('0x0'));var events=[_0x780f('0x1'),_0x780f('0x2'),_0x780f('0x3')];function createListener(_0xed92c1,_0x11476d){return function(_0xadad43){_0x11476d[_0x780f('0x4')](_0xed92c1,_0xadad43);};}function removeListener(_0x3a727f,_0x142af5){return function(){OpenchannelInteractionEvents[_0x780f('0x5')](_0x3a727f,_0x142af5);};}exports[_0x780f('0x6')]=function(_0x3599c2){for(var _0x1abe85=0x0,_0x19ad78=events['length'];_0x1abe85<_0x19ad78;_0x1abe85++){var _0x1063d0=events[_0x1abe85];var _0x36ebf9=createListener(_0x780f('0x7')+_0x1063d0,_0x3599c2);OpenchannelInteractionEvents['on'](_0x1063d0,_0x36ebf9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 770cf43..599a264 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x8359b,_0x42cbf9){var _0x1d3c4b=function(_0x14f548){while(--_0x14f548){_0x8359b['push'](_0x8359b['shift']());}};_0x1d3c4b(++_0x42cbf9);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x1c6ebe,_0x16b450){_0x1c6ebe=_0x1c6ebe-0x0;var _0x1d38c8=_0x70e0[_0x1c6ebe];return _0x1d38c8;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4715d5f..ceedbd1 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 _0x3c66=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x28e2fc,_0x11b9e9){var _0x37bb27=function(_0x4eac22){while(--_0x4eac22){_0x28e2fc['push'](_0x28e2fc['shift']());}};_0x37bb27(++_0x11b9e9);}(_0x3c66,0x8b));var _0x63c6=function(_0x3a3348,_0x3363db){_0x3a3348=_0x3a3348-0x0;var _0x3917c8=_0x3c66[_0x3a3348];return _0x3917c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x63c6('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63c6('0x2')]('in',_0x63c6('0x3')),'defaultValue':_0x63c6('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x63c6('0x4')]},'providerName':{'type':Sequelize[_0x63c6('0x5')]},'providerResponse':{'type':Sequelize[_0x63c6('0x6')]}}; \ No newline at end of file +var _0xeef7=['exports','medium','BOOLEAN','out','DATE','STRING','sequelize'];(function(_0x35994e,_0x3968be){var _0x1dc2e=function(_0x5443ed){while(--_0x5443ed){_0x35994e['push'](_0x35994e['shift']());}};_0x1dc2e(++_0x3968be);}(_0xeef7,0x7d));var _0x7eef=function(_0x5799ea,_0x3e2e46){_0x5799ea=_0x5799ea-0x0;var _0x3f89be=_0xeef7[_0x5799ea];return _0x3f89be;};'use strict';var Sequelize=require(_0x7eef('0x0'));module[_0x7eef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x7eef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7eef('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7eef('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7eef('0x5')]},'providerName':{'type':Sequelize[_0x7eef('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f5c22b3..c85fa8d 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 _0xc82d=['mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','name','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','destroy','describe','../../config/logger','openchannel-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','fullname','internal','manual','interface','format','channel','motionChannel','EventManager','acceptmessage','openchannel','RejectMessage','ContactId','QueryTypes','contact','User','SIP/%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x1594fa,_0x51967f){var _0x5778f4=function(_0x3d3f1d){while(--_0x3d3f1d){_0x1594fa['push'](_0x1594fa['shift']());}};_0x5778f4(++_0x51967f);}(_0xc82d,0x7a));var _0xdc82=function(_0x216494,_0x21a0b4){_0x216494=_0x216494-0x0;var _0x3fce22=_0xc82d[_0x216494];return _0x3fce22;};'use strict';var emlformat=require(_0xdc82('0x0'));var rimraf=require(_0xdc82('0x1'));var zipdir=require(_0xdc82('0x2'));var jsonpatch=require(_0xdc82('0x3'));var rp=require('request-promise');var moment=require(_0xdc82('0x4'));var BPromise=require(_0xdc82('0x5'));var Mustache=require(_0xdc82('0x6'));var util=require(_0xdc82('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdc82('0x8'));var ejs=require(_0xdc82('0x9'));var fs=require('fs');var fs_extra=require(_0xdc82('0xa'));var _=require('lodash');var squel=require(_0xdc82('0xb'));var crypto=require(_0xdc82('0xc'));var jsforce=require(_0xdc82('0xd'));var deskjs=require(_0xdc82('0xe'));var toCsv=require(_0xdc82('0x8'));var querystring=require('querystring');var Papa=require(_0xdc82('0xf'));var Redis=require('ioredis');var authService=require(_0xdc82('0x10'));var qs=require(_0xdc82('0x11'));var as=require(_0xdc82('0x12'));var hardwareService=require(_0xdc82('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdc82('0x14'));var config=require(_0xdc82('0x15'));var licenseUtil=require(_0xdc82('0x16'));var db=require(_0xdc82('0x17'))['db'];config[_0xdc82('0x18')]=_[_0xdc82('0x19')](config[_0xdc82('0x18')],{'host':_0xdc82('0x1a'),'port':0x18eb});var socket=require(_0xdc82('0x1b'))(new Redis(config[_0xdc82('0x18')]));require(_0xdc82('0x1c'))[_0xdc82('0x1d')](socket);var jayson=require(_0xdc82('0x1e'));var client=jayson['client'][_0xdc82('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xdc82('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5417c1,_0x58a0f4,_0x158f0f,_0x3ce90f){return new BPromise(function(_0x89d431,_0x240080){var _0x2c5ff5=_0x3ce90f||client;return _0x2c5ff5['request'](_0x5417c1,_0x158f0f)[_0xdc82('0x20')](function(_0x489873){logger['info'](_0xdc82('0x21'),_0x58a0f4,_0xdc82('0x22'));logger['debug'](_0xdc82('0x23'),_0x58a0f4,'request\x20sent',JSON[_0xdc82('0x24')](_0x489873));if(_0x489873[_0xdc82('0x25')]){if(_0x489873[_0xdc82('0x25')][_0xdc82('0x26')]===0x1f4){logger[_0xdc82('0x25')](_0xdc82('0x21'),_0x58a0f4,_0x489873[_0xdc82('0x25')][_0xdc82('0x27')]);return _0x240080(_0x489873['error'][_0xdc82('0x27')]);}logger[_0xdc82('0x25')](_0xdc82('0x21'),_0x58a0f4,_0x489873[_0xdc82('0x25')][_0xdc82('0x27')]);return _0x89d431(_0x489873[_0xdc82('0x25')][_0xdc82('0x27')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x58a0f4,_0xdc82('0x22'));_0x89d431(_0x489873['result'][_0xdc82('0x27')]);}})['catch'](function(_0x42256c){logger[_0xdc82('0x25')](_0xdc82('0x21'),_0x58a0f4,_0x42256c);_0x240080(_0x42256c);});});}function respondWithStatusCode(_0x3c6b7e,_0x436242){_0x436242=_0x436242||0xcc;return function(_0x9a1929){if(_0x9a1929){return _0x3c6b7e[_0xdc82('0x28')](_0x436242);}return _0x3c6b7e[_0xdc82('0x29')](_0x436242)[_0xdc82('0x2a')]();};}function respondWithResult(_0x3193aa,_0x44ec92){_0x44ec92=_0x44ec92||0xc8;return function(_0x32e7bb){if(_0x32e7bb){return _0x3193aa[_0xdc82('0x29')](_0x44ec92)[_0xdc82('0x2b')](_0x32e7bb);}};}function respondWithFilteredResult(_0x20b4cd,_0x589ff7){return function(_0x510758){if(_0x510758){var _0x5ca485=typeof _0x589ff7[_0xdc82('0x2c')]===_0xdc82('0x2d')&&typeof _0x589ff7[_0xdc82('0x2e')]===_0xdc82('0x2d');var _0x26e775=_0x510758[_0xdc82('0x2f')];var _0x48e292=_0x5ca485?0x0:_0x589ff7['offset'];var _0x11591b=_0x5ca485?_0x510758[_0xdc82('0x2f')]:_0x589ff7[_0xdc82('0x2c')]+_0x589ff7[_0xdc82('0x2e')];var _0x1ab085;if(_0x11591b>=_0x26e775){_0x11591b=_0x26e775;_0x1ab085=0xc8;}else{_0x1ab085=0xce;}_0x20b4cd[_0xdc82('0x29')](_0x1ab085);return _0x20b4cd['set'](_0xdc82('0x30'),_0x48e292+'-'+_0x11591b+'/'+_0x26e775)[_0xdc82('0x2b')](_0x510758);}return null;};}function patchUpdates(_0x22f1a3){return function(_0x32dca6){try{jsonpatch[_0xdc82('0x31')](_0x32dca6,_0x22f1a3,!![]);}catch(_0x49b9ac){return BPromise[_0xdc82('0x32')](_0x49b9ac);}return _0x32dca6[_0xdc82('0x33')]();};}function saveUpdates(_0x11f038,_0x2221cd){return function(_0x5b86ed){if(_0x5b86ed){return _0x5b86ed[_0xdc82('0x34')](_0x11f038)[_0xdc82('0x20')](function(_0x3c0df9){return _0x3c0df9;});}return null;};}function removeEntity(_0x2ce370,_0x4d480e){return function(_0x4206cb){if(_0x4206cb){return _0x4206cb['destroy']()[_0xdc82('0x20')](function(){_0x2ce370[_0xdc82('0x29')](0xcc)[_0xdc82('0x2a')]();});}};}function handleEntityNotFound(_0x24d520,_0x1006d8){return function(_0x68641c){if(!_0x68641c){_0x24d520[_0xdc82('0x28')](0x194);}return _0x68641c;};}function handleError(_0x2cac61,_0x28542f){_0x28542f=_0x28542f||0x1f4;return function(_0x594a8b){logger[_0xdc82('0x25')](_0x594a8b['stack']);if(_0x594a8b['name']){delete _0x594a8b[_0xdc82('0x35')];}_0x2cac61[_0xdc82('0x29')](_0x28542f)['send'](_0x594a8b);};}exports[_0xdc82('0x36')]=function(_0xd14e33,_0x37d40b){var _0x3e2e8b={},_0x361d40={},_0x429c16={'count':0x0,'rows':[]};var _0x209e14=_[_0xdc82('0x37')](db[_0xdc82('0x38')][_0xdc82('0x39')],function(_0x5bfb36){return{'name':_0x5bfb36['fieldName'],'type':_0x5bfb36[_0xdc82('0x3a')][_0xdc82('0x3b')]};});_0x361d40[_0xdc82('0x3c')]=_[_0xdc82('0x37')](_0x209e14,'name');_0x361d40[_0xdc82('0x3d')]=_[_0xdc82('0x3e')](_0xd14e33[_0xdc82('0x3d')]);_0x361d40[_0xdc82('0x3f')]=_['intersection'](_0x361d40[_0xdc82('0x3c')],_0x361d40['query']);_0x3e2e8b[_0xdc82('0x40')]=_['intersection'](_0x361d40[_0xdc82('0x3c')],qs[_0xdc82('0x41')](_0xd14e33[_0xdc82('0x3d')]['fields']));_0x3e2e8b[_0xdc82('0x40')]=_0x3e2e8b[_0xdc82('0x40')][_0xdc82('0x42')]?_0x3e2e8b[_0xdc82('0x40')]:_0x361d40[_0xdc82('0x3c')];if(!_0xd14e33['query'][_0xdc82('0x43')](_0xdc82('0x44'))){_0x3e2e8b[_0xdc82('0x2e')]=qs[_0xdc82('0x2e')](_0xd14e33[_0xdc82('0x3d')][_0xdc82('0x2e')]);_0x3e2e8b[_0xdc82('0x2c')]=qs[_0xdc82('0x2c')](_0xd14e33['query']['offset']);}_0x3e2e8b[_0xdc82('0x45')]=qs[_0xdc82('0x46')](_0xd14e33[_0xdc82('0x3d')]['sort']);_0x3e2e8b[_0xdc82('0x47')]=qs['filters'](_[_0xdc82('0x48')](_0xd14e33[_0xdc82('0x3d')],_0x361d40[_0xdc82('0x3f')]),_0x209e14);if(_0xd14e33[_0xdc82('0x3d')][_0xdc82('0x49')]){_0x3e2e8b['where']=_[_0xdc82('0x4a')](_0x3e2e8b['where'],{'$or':_[_0xdc82('0x37')](_0x209e14,function(_0x54711a){if(_0x54711a[_0xdc82('0x3a')]!==_0xdc82('0x4b')){var _0x2b2b2f={};_0x2b2b2f[_0x54711a['name']]={'$like':'%'+_0xd14e33[_0xdc82('0x3d')]['filter']+'%'};return _0x2b2b2f;}})});}_0x3e2e8b=_[_0xdc82('0x4a')]({},_0x3e2e8b,_0xd14e33['options']);var _0x431d3d={'where':_0x3e2e8b[_0xdc82('0x47')]};return db[_0xdc82('0x38')][_0xdc82('0x2f')](_0x431d3d)[_0xdc82('0x20')](function(_0x2dc130){_0x429c16[_0xdc82('0x2f')]=_0x2dc130;if(_0xd14e33[_0xdc82('0x3d')][_0xdc82('0x4c')]){_0x3e2e8b[_0xdc82('0x4d')]=[{'all':!![]}];}return db[_0xdc82('0x38')][_0xdc82('0x4e')](_0x3e2e8b);})[_0xdc82('0x20')](function(_0x432fd2){_0x429c16[_0xdc82('0x4f')]=_0x432fd2;return _0x429c16;})[_0xdc82('0x20')](respondWithFilteredResult(_0x37d40b,_0x3e2e8b))[_0xdc82('0x50')](handleError(_0x37d40b,null));};exports[_0xdc82('0x51')]=function(_0x553e7e,_0x287989){var _0x2d40e1={'raw':!![],'where':{'id':_0x553e7e[_0xdc82('0x52')]['id']}},_0x12dc61={};_0x12dc61[_0xdc82('0x3c')]=_[_0xdc82('0x3e')](db['OpenchannelMessage']['rawAttributes']);_0x12dc61['query']=_['keys'](_0x553e7e['query']);_0x12dc61[_0xdc82('0x3f')]=_[_0xdc82('0x53')](_0x12dc61[_0xdc82('0x3c')],_0x12dc61['query']);_0x2d40e1[_0xdc82('0x40')]=_[_0xdc82('0x53')](_0x12dc61[_0xdc82('0x3c')],qs[_0xdc82('0x41')](_0x553e7e[_0xdc82('0x3d')][_0xdc82('0x41')]));_0x2d40e1[_0xdc82('0x40')]=_0x2d40e1[_0xdc82('0x40')][_0xdc82('0x42')]?_0x2d40e1[_0xdc82('0x40')]:_0x12dc61[_0xdc82('0x3c')];if(_0x553e7e[_0xdc82('0x3d')]['includeAll']){_0x2d40e1[_0xdc82('0x4d')]=[{'all':!![]}];}_0x2d40e1=_[_0xdc82('0x4a')]({},_0x2d40e1,_0x553e7e[_0xdc82('0x54')]);return db[_0xdc82('0x38')][_0xdc82('0x55')](_0x2d40e1)[_0xdc82('0x20')](handleEntityNotFound(_0x287989,null))[_0xdc82('0x20')](respondWithResult(_0x287989,null))[_0xdc82('0x50')](handleError(_0x287989,null));};exports[_0xdc82('0x56')]=function(_0x140b96,_0x4d1ae9){return db[_0xdc82('0x38')][_0xdc82('0x56')](_0x140b96[_0xdc82('0x57')],{})[_0xdc82('0x20')](respondWithResult(_0x4d1ae9,0xc9))[_0xdc82('0x50')](handleError(_0x4d1ae9,null));};exports[_0xdc82('0x34')]=function(_0x157316,_0x580f81){if(_0x157316[_0xdc82('0x57')]['id']){delete _0x157316[_0xdc82('0x57')]['id'];}return db['OpenchannelMessage'][_0xdc82('0x55')]({'where':{'id':_0x157316[_0xdc82('0x52')]['id']}})['then'](handleEntityNotFound(_0x580f81,null))[_0xdc82('0x20')](saveUpdates(_0x157316[_0xdc82('0x57')],null))[_0xdc82('0x20')](respondWithResult(_0x580f81,null))[_0xdc82('0x50')](handleError(_0x580f81,null));};exports[_0xdc82('0x58')]=function(_0x158120,_0x5d575a){return db[_0xdc82('0x38')]['find']({'where':{'id':_0x158120[_0xdc82('0x52')]['id']}})[_0xdc82('0x20')](handleEntityNotFound(_0x5d575a,null))[_0xdc82('0x20')](removeEntity(_0x5d575a,null))[_0xdc82('0x50')](handleError(_0x5d575a,null));};exports[_0xdc82('0x59')]=function(_0x26e29e,_0xd8278f){return db[_0xdc82('0x38')][_0xdc82('0x59')]()['then'](respondWithResult(_0xd8278f,null))[_0xdc82('0x50')](handleError(_0xd8278f,null));};var interaction_log=require(_0xdc82('0x5a'))(_0xdc82('0x5b'));exports[_0xdc82('0x5c')]=function(_0x3bbbe6,_0x5314ae,_0x4aae0f){var _0x1905f5={'agent':{},'channel':'openchannel'};if(_0x3bbbe6[_0xdc82('0x57')]['id']){delete _0x3bbbe6['body']['id'];}_0x3bbbe6[_0xdc82('0x57')]['read']=!![];_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5d')]=moment()['format'](_0xdc82('0x5e'));_0x3bbbe6['body']['UserId']=_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5f')]||_0x3bbbe6[_0xdc82('0x60')]['id'];_0x1905f5[_0xdc82('0x61')]['id']=_0x3bbbe6[_0xdc82('0x57')]['UserId'];return db[_0xdc82('0x38')][_0xdc82('0x55')]({'where':{'id':_0x3bbbe6[_0xdc82('0x52')]['id'],'UserId':null}})[_0xdc82('0x20')](handleEntityNotFound(_0x5314ae,null))[_0xdc82('0x20')](saveUpdates(_0x3bbbe6[_0xdc82('0x57')],null))[_0xdc82('0x20')](function(_0x5cd474){if(_0x5cd474){_0x1905f5[_0xdc82('0x27')]=_0x5cd474[_0xdc82('0x62')]({'plain':!![]});return db[_0xdc82('0x63')][_0xdc82('0x55')]({'where':{'id':_0x5cd474[_0xdc82('0x64')]}});}return null;})[_0xdc82('0x20')](handleEntityNotFound(_0x5314ae,null))[_0xdc82('0x20')](function(_0x3e6f66){if(_0x3e6f66){return _0x3e6f66[_0xdc82('0x34')]({'UserId':_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5f')],'read1stAt':_[_0xdc82('0x65')](_0x3e6f66[_0xdc82('0x66')])?moment()['format'](_0xdc82('0x5e')):undefined});}return null;})[_0xdc82('0x20')](function(_0x39b6d7){if(_0x39b6d7){_0x1905f5['interaction']=_0x39b6d7[_0xdc82('0x62')]({'plain':!![]});interaction_log[_0xdc82('0x67')](_0xdc82('0x68'),_0x3bbbe6[_0xdc82('0x60')]['id'],_0x3bbbe6[_0xdc82('0x60')]['name'],_0x3bbbe6[_0xdc82('0x60')][_0xdc82('0x69')],_0x1905f5[_0xdc82('0x6a')]['id'],_0x3bbbe6[_0xdc82('0x57')]?JSON['stringify'](_0x3bbbe6['body']):'null');return respondWithRpcPromise(_0xdc82('0x6b'),_0xdc82('0x6c'),_0x1905f5);}return null;})['then'](function(_0x5e8a63){var _0x5befb2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e8a63[_0xdc82('0x27')]['ContactId'];return db[_0xdc82('0x6d')][_0xdc82('0x3d')](_0x5befb2,{'type':db[_0xdc82('0x6e')]['QueryTypes'][_0xdc82('0x6f')],'raw':!![]})['then'](function(_0x4bb994){return _0x4bb994;});})[_0xdc82('0x20')](function(_0x31a1bc){if(_0x31a1bc){_0x1905f5['message']['contact']=_0x31a1bc[0x0];if(!_0x3bbbe6[_0xdc82('0x57')][_0xdc82('0x5f')])return;return db['User'][_0xdc82('0x55')]({'where':{'id':_0x3bbbe6[_0xdc82('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0xdc82('0x35'),_0xdc82('0x70'),'email',_0xdc82('0x71')],'raw':!![]});}return null;})[_0xdc82('0x20')](function(_0x487fde){if(!_0x487fde)return null;_0x1905f5[_0xdc82('0x27')]['agent']=_0x487fde;return _0x1905f5;})['then'](function(_0x41655b){if(_0x41655b){if(_0x3bbbe6['body'][_0xdc82('0x72')]){_0x1905f5[_0xdc82('0x27')][_0xdc82('0x73')]=util[_0xdc82('0x74')]('SIP/%s',_0x3bbbe6['user'][_0xdc82('0x35')]);_0x1905f5[_0xdc82('0x27')][_0xdc82('0x75')]=_0x1905f5[_0xdc82('0x75')];_0x1905f5[_0xdc82('0x27')][_0xdc82('0x76')]=_0x1905f5['channel'];_0x1905f5[_0xdc82('0x27')]['event']=_0xdc82('0x5c');return respondWithRpcPromise(_0xdc82('0x77'),_0xdc82('0x77'),{'event':_0xdc82('0x78'),'message':_0x1905f5[_0xdc82('0x27')]},client9002)['then'](function(){return _0x1905f5;});}return _0x1905f5;}return null;})['then'](respondWithResult(_0x5314ae,null))[_0xdc82('0x50')](handleError(_0x5314ae,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x1500ba,_0x278f29,_0x554f15){var _0x14c6fc={'agent':{},'channel':_0xdc82('0x79')};if(_0x1500ba[_0xdc82('0x57')]['id']){delete _0x1500ba['body']['id'];}_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')]=_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')]||_0x1500ba[_0xdc82('0x60')]['id'];_0x14c6fc['agent']['id']=_0x1500ba[_0xdc82('0x57')]['UserId'];return db[_0xdc82('0x38')][_0xdc82('0x55')]({'where':{'id':_0x1500ba['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x278f29,null))['then'](function(_0x27e709){if(_0x27e709){_0x14c6fc[_0xdc82('0x27')]=_0x27e709[_0xdc82('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x27e709[_0xdc82('0x64')]}});}return null;})[_0xdc82('0x20')](handleEntityNotFound(_0x278f29,null))[_0xdc82('0x20')](function(_0x45f8c7){if(_0x45f8c7){_0x14c6fc[_0xdc82('0x6a')]=_0x45f8c7[_0xdc82('0x62')]({'plain':!![]});interaction_log[_0xdc82('0x67')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1500ba[_0xdc82('0x60')]['id'],_0x1500ba[_0xdc82('0x60')]['name'],_0x1500ba[_0xdc82('0x60')][_0xdc82('0x69')],_0x14c6fc[_0xdc82('0x6a')]['id'],_0x1500ba[_0xdc82('0x57')]?JSON[_0xdc82('0x24')](_0x1500ba[_0xdc82('0x57')]):'null');return respondWithRpcPromise(_0xdc82('0x7a'),'rejectMessage',_0x14c6fc);}return null;})['then'](function(_0x2f34f1){var _0x41590e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f34f1['message'][_0xdc82('0x7b')];return db['sequelize'][_0xdc82('0x3d')](_0x41590e,{'type':db[_0xdc82('0x6e')][_0xdc82('0x7c')][_0xdc82('0x6f')],'raw':!![]})[_0xdc82('0x20')](function(_0x1dd043){return _0x1dd043;});})[_0xdc82('0x20')](function(_0x6dbee2){if(_0x6dbee2){_0x14c6fc[_0xdc82('0x27')][_0xdc82('0x7d')]=_0x6dbee2[0x0];if(!_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')])return;return db[_0xdc82('0x7e')][_0xdc82('0x55')]({'where':{'id':_0x1500ba[_0xdc82('0x57')][_0xdc82('0x5f')],'role':'agent'},'attributes':['id',_0xdc82('0x35'),_0xdc82('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xdc82('0x20')](function(_0x291bc4){if(!_0x291bc4)return null;_0x14c6fc[_0xdc82('0x27')][_0xdc82('0x61')]=_0x291bc4;return _0x14c6fc;})['then'](function(_0x174822){if(_0x174822){_0x174822[_0xdc82('0x27')]['interface']=util[_0xdc82('0x74')](_0xdc82('0x7f'),_0x1500ba[_0xdc82('0x60')][_0xdc82('0x35')]);_0x174822[_0xdc82('0x27')][_0xdc82('0x75')]=_0x14c6fc[_0xdc82('0x75')];_0x174822[_0xdc82('0x27')][_0xdc82('0x76')]=_0x14c6fc[_0xdc82('0x75')];_0x174822[_0xdc82('0x27')]['event']=_0xdc82('0x32');respondWithRpcPromise(_0xdc82('0x77'),'EventManager',{'event':'rejectmessage','message':_0x174822[_0xdc82('0x27')]},client9002);return _0x14c6fc;}return null;})['then'](respondWithResult(_0x278f29,null))[_0xdc82('0x50')](handleError(_0x278f29,null));}; \ No newline at end of file +var _0xc60b=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','create','body','catch','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit'];(function(_0x548cef,_0x956093){var _0x24a867=function(_0x2cb5b8){while(--_0x2cb5b8){_0x548cef['push'](_0x548cef['shift']());}};_0x24a867(++_0x956093);}(_0xc60b,0x150));var _0xbc60=function(_0x486303,_0x3a55a0){_0x486303=_0x486303-0x0;var _0x123b9b=_0xc60b[_0x486303];return _0x123b9b;};'use strict';var emlformat=require(_0xbc60('0x0'));var rimraf=require(_0xbc60('0x1'));var zipdir=require(_0xbc60('0x2'));var jsonpatch=require(_0xbc60('0x3'));var rp=require(_0xbc60('0x4'));var moment=require(_0xbc60('0x5'));var BPromise=require(_0xbc60('0x6'));var Mustache=require(_0xbc60('0x7'));var util=require('util');var path=require(_0xbc60('0x8'));var sox=require(_0xbc60('0x9'));var csv=require(_0xbc60('0xa'));var ejs=require(_0xbc60('0xb'));var fs=require('fs');var fs_extra=require(_0xbc60('0xc'));var _=require(_0xbc60('0xd'));var squel=require('squel');var crypto=require(_0xbc60('0xe'));var jsforce=require(_0xbc60('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc60('0x10'));var Papa=require(_0xbc60('0x11'));var Redis=require(_0xbc60('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbc60('0x13'));var hardwareService=require(_0xbc60('0x14'));var logger=require(_0xbc60('0x15'))(_0xbc60('0x16'));var utils=require(_0xbc60('0x17'));var config=require(_0xbc60('0x18'));var licenseUtil=require(_0xbc60('0x19'));var db=require(_0xbc60('0x1a'))['db'];config[_0xbc60('0x1b')]=_[_0xbc60('0x1c')](config[_0xbc60('0x1b')],{'host':_0xbc60('0x1d'),'port':0x18eb});var socket=require(_0xbc60('0x1e'))(new Redis(config[_0xbc60('0x1b')]));require(_0xbc60('0x1f'))[_0xbc60('0x20')](socket);var jayson=require(_0xbc60('0x21'));var client=jayson['client'][_0xbc60('0x22')]({'port':0x232c});var client9002=jayson[_0xbc60('0x23')][_0xbc60('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4e5874,_0x4e9cb4,_0x213377,_0x2e941e){return new BPromise(function(_0xb73e60,_0x1ad6e6){var _0x5919cd=_0x2e941e||client;return _0x5919cd[_0xbc60('0x24')](_0x4e5874,_0x213377)[_0xbc60('0x25')](function(_0x49a686){logger[_0xbc60('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e9cb4,_0xbc60('0x27'));logger[_0xbc60('0x28')](_0xbc60('0x29'),_0x4e9cb4,_0xbc60('0x27'),JSON['stringify'](_0x49a686));if(_0x49a686['error']){if(_0x49a686[_0xbc60('0x2a')][_0xbc60('0x2b')]===0x1f4){logger[_0xbc60('0x2a')](_0xbc60('0x2c'),_0x4e9cb4,_0x49a686[_0xbc60('0x2a')][_0xbc60('0x2d')]);return _0x1ad6e6(_0x49a686[_0xbc60('0x2a')][_0xbc60('0x2d')]);}logger[_0xbc60('0x2a')](_0xbc60('0x2c'),_0x4e9cb4,_0x49a686[_0xbc60('0x2a')]['message']);return _0xb73e60(_0x49a686[_0xbc60('0x2a')][_0xbc60('0x2d')]);}else{logger[_0xbc60('0x26')](_0xbc60('0x2c'),_0x4e9cb4,_0xbc60('0x27'));_0xb73e60(_0x49a686[_0xbc60('0x2e')][_0xbc60('0x2d')]);}})['catch'](function(_0x2f3a64){logger[_0xbc60('0x2a')](_0xbc60('0x2c'),_0x4e9cb4,_0x2f3a64);_0x1ad6e6(_0x2f3a64);});});}function respondWithStatusCode(_0x53b321,_0x54b925){_0x54b925=_0x54b925||0xcc;return function(_0x46e876){if(_0x46e876){return _0x53b321[_0xbc60('0x2f')](_0x54b925);}return _0x53b321[_0xbc60('0x30')](_0x54b925)[_0xbc60('0x31')]();};}function respondWithResult(_0x45f624,_0x53c7c1){_0x53c7c1=_0x53c7c1||0xc8;return function(_0x56827c){if(_0x56827c){return _0x45f624[_0xbc60('0x30')](_0x53c7c1)['json'](_0x56827c);}};}function respondWithFilteredResult(_0x36ac52,_0x5a8f9b){return function(_0x26c019){if(_0x26c019){var _0x1b088a=typeof _0x5a8f9b[_0xbc60('0x32')]===_0xbc60('0x33')&&typeof _0x5a8f9b['limit']===_0xbc60('0x33');var _0x1c984f=_0x26c019['count'];var _0x40a100=_0x1b088a?0x0:_0x5a8f9b[_0xbc60('0x32')];var _0x446582=_0x1b088a?_0x26c019[_0xbc60('0x34')]:_0x5a8f9b[_0xbc60('0x32')]+_0x5a8f9b[_0xbc60('0x35')];var _0x26755e;if(_0x446582>=_0x1c984f){_0x446582=_0x1c984f;_0x26755e=0xc8;}else{_0x26755e=0xce;}_0x36ac52[_0xbc60('0x30')](_0x26755e);return _0x36ac52[_0xbc60('0x36')]('Content-Range',_0x40a100+'-'+_0x446582+'/'+_0x1c984f)[_0xbc60('0x37')](_0x26c019);}return null;};}function patchUpdates(_0x29dec6){return function(_0x49fcfc){try{jsonpatch[_0xbc60('0x38')](_0x49fcfc,_0x29dec6,!![]);}catch(_0x47349f){return BPromise[_0xbc60('0x39')](_0x47349f);}return _0x49fcfc[_0xbc60('0x3a')]();};}function saveUpdates(_0x31fc27,_0x2d57d3){return function(_0x4d41b9){if(_0x4d41b9){return _0x4d41b9[_0xbc60('0x3b')](_0x31fc27)[_0xbc60('0x25')](function(_0x4d586b){return _0x4d586b;});}return null;};}function removeEntity(_0x252291,_0x136a48){return function(_0x134e70){if(_0x134e70){return _0x134e70[_0xbc60('0x3c')]()[_0xbc60('0x25')](function(){_0x252291[_0xbc60('0x30')](0xcc)[_0xbc60('0x31')]();});}};}function handleEntityNotFound(_0x15773b,_0x574d73){return function(_0x3d82e4){if(!_0x3d82e4){_0x15773b['sendStatus'](0x194);}return _0x3d82e4;};}function handleError(_0x16ee7c,_0xf60ad9){_0xf60ad9=_0xf60ad9||0x1f4;return function(_0x424766){logger[_0xbc60('0x2a')](_0x424766[_0xbc60('0x3d')]);if(_0x424766[_0xbc60('0x3e')]){delete _0x424766[_0xbc60('0x3e')];}_0x16ee7c[_0xbc60('0x30')](_0xf60ad9)[_0xbc60('0x3f')](_0x424766);};}exports[_0xbc60('0x40')]=function(_0x45f96b,_0x85e73e){var _0x54ad0c={},_0x3cce76={},_0x442d04={'count':0x0,'rows':[]};var _0x5e7458=_[_0xbc60('0x41')](db[_0xbc60('0x42')]['rawAttributes'],function(_0x2505f3){return{'name':_0x2505f3[_0xbc60('0x43')],'type':_0x2505f3[_0xbc60('0x44')][_0xbc60('0x45')]};});_0x3cce76['model']=_[_0xbc60('0x41')](_0x5e7458,_0xbc60('0x3e'));_0x3cce76[_0xbc60('0x46')]=_[_0xbc60('0x47')](_0x45f96b[_0xbc60('0x46')]);_0x3cce76['filters']=_[_0xbc60('0x48')](_0x3cce76[_0xbc60('0x49')],_0x3cce76['query']);_0x54ad0c['attributes']=_[_0xbc60('0x48')](_0x3cce76[_0xbc60('0x49')],qs['fields'](_0x45f96b[_0xbc60('0x46')][_0xbc60('0x4a')]));_0x54ad0c[_0xbc60('0x4b')]=_0x54ad0c['attributes'][_0xbc60('0x4c')]?_0x54ad0c[_0xbc60('0x4b')]:_0x3cce76[_0xbc60('0x49')];if(!_0x45f96b[_0xbc60('0x46')]['hasOwnProperty'](_0xbc60('0x4d'))){_0x54ad0c[_0xbc60('0x35')]=qs[_0xbc60('0x35')](_0x45f96b[_0xbc60('0x46')]['limit']);_0x54ad0c[_0xbc60('0x32')]=qs[_0xbc60('0x32')](_0x45f96b[_0xbc60('0x46')][_0xbc60('0x32')]);}_0x54ad0c[_0xbc60('0x4e')]=qs[_0xbc60('0x4f')](_0x45f96b['query'][_0xbc60('0x4f')]);_0x54ad0c[_0xbc60('0x50')]=qs[_0xbc60('0x51')](_[_0xbc60('0x52')](_0x45f96b['query'],_0x3cce76[_0xbc60('0x51')]),_0x5e7458);if(_0x45f96b['query'][_0xbc60('0x53')]){_0x54ad0c[_0xbc60('0x50')]=_[_0xbc60('0x54')](_0x54ad0c['where'],{'$or':_[_0xbc60('0x41')](_0x5e7458,function(_0x340e52){if(_0x340e52[_0xbc60('0x44')]!==_0xbc60('0x55')){var _0x2cae39={};_0x2cae39[_0x340e52[_0xbc60('0x3e')]]={'$like':'%'+_0x45f96b[_0xbc60('0x46')][_0xbc60('0x53')]+'%'};return _0x2cae39;}})});}_0x54ad0c=_[_0xbc60('0x54')]({},_0x54ad0c,_0x45f96b[_0xbc60('0x56')]);var _0x4eb1da={'where':_0x54ad0c['where']};return db[_0xbc60('0x42')][_0xbc60('0x34')](_0x4eb1da)[_0xbc60('0x25')](function(_0x16afb2){_0x442d04[_0xbc60('0x34')]=_0x16afb2;if(_0x45f96b[_0xbc60('0x46')][_0xbc60('0x57')]){_0x54ad0c[_0xbc60('0x58')]=[{'all':!![]}];}return db[_0xbc60('0x42')][_0xbc60('0x59')](_0x54ad0c);})[_0xbc60('0x25')](function(_0x2d969f){_0x442d04['rows']=_0x2d969f;return _0x442d04;})[_0xbc60('0x25')](respondWithFilteredResult(_0x85e73e,_0x54ad0c))['catch'](handleError(_0x85e73e,null));};exports['show']=function(_0x239951,_0x2e710e){var _0x52a3e7={'raw':!![],'where':{'id':_0x239951[_0xbc60('0x5a')]['id']}},_0x499caa={};_0x499caa[_0xbc60('0x49')]=_[_0xbc60('0x47')](db[_0xbc60('0x42')][_0xbc60('0x5b')]);_0x499caa[_0xbc60('0x46')]=_[_0xbc60('0x47')](_0x239951[_0xbc60('0x46')]);_0x499caa[_0xbc60('0x51')]=_[_0xbc60('0x48')](_0x499caa[_0xbc60('0x49')],_0x499caa[_0xbc60('0x46')]);_0x52a3e7['attributes']=_[_0xbc60('0x48')](_0x499caa['model'],qs[_0xbc60('0x4a')](_0x239951[_0xbc60('0x46')][_0xbc60('0x4a')]));_0x52a3e7['attributes']=_0x52a3e7[_0xbc60('0x4b')]['length']?_0x52a3e7[_0xbc60('0x4b')]:_0x499caa[_0xbc60('0x49')];if(_0x239951[_0xbc60('0x46')][_0xbc60('0x57')]){_0x52a3e7[_0xbc60('0x58')]=[{'all':!![]}];}_0x52a3e7=_[_0xbc60('0x54')]({},_0x52a3e7,_0x239951[_0xbc60('0x56')]);return db[_0xbc60('0x42')][_0xbc60('0x5c')](_0x52a3e7)[_0xbc60('0x25')](handleEntityNotFound(_0x2e710e,null))[_0xbc60('0x25')](respondWithResult(_0x2e710e,null))['catch'](handleError(_0x2e710e,null));};exports['create']=function(_0x233dca,_0x7e7943){return db['OpenchannelMessage'][_0xbc60('0x5d')](_0x233dca[_0xbc60('0x5e')],{})[_0xbc60('0x25')](respondWithResult(_0x7e7943,0xc9))[_0xbc60('0x5f')](handleError(_0x7e7943,null));};exports['update']=function(_0x4c0b94,_0x43f463){if(_0x4c0b94['body']['id']){delete _0x4c0b94[_0xbc60('0x5e')]['id'];}return db['OpenchannelMessage'][_0xbc60('0x5c')]({'where':{'id':_0x4c0b94[_0xbc60('0x5a')]['id']}})[_0xbc60('0x25')](handleEntityNotFound(_0x43f463,null))[_0xbc60('0x25')](saveUpdates(_0x4c0b94[_0xbc60('0x5e')],null))['then'](respondWithResult(_0x43f463,null))[_0xbc60('0x5f')](handleError(_0x43f463,null));};exports['destroy']=function(_0xda6e7a,_0x2cd2d6){return db[_0xbc60('0x42')][_0xbc60('0x5c')]({'where':{'id':_0xda6e7a['params']['id']}})[_0xbc60('0x25')](handleEntityNotFound(_0x2cd2d6,null))[_0xbc60('0x25')](removeEntity(_0x2cd2d6,null))[_0xbc60('0x5f')](handleError(_0x2cd2d6,null));};exports['describe']=function(_0x4f9659,_0x173022){return db[_0xbc60('0x42')]['describe']()[_0xbc60('0x25')](respondWithResult(_0x173022,null))['catch'](handleError(_0x173022,null));};var interaction_log=require(_0xbc60('0x15'))(_0xbc60('0x60'));exports[_0xbc60('0x61')]=function(_0x5d701a,_0x1a2351,_0x2a1043){var _0x1227d1={'agent':{},'channel':_0xbc60('0x62')};if(_0x5d701a[_0xbc60('0x5e')]['id']){delete _0x5d701a[_0xbc60('0x5e')]['id'];}_0x5d701a[_0xbc60('0x5e')]['read']=!![];_0x5d701a[_0xbc60('0x5e')][_0xbc60('0x63')]=moment()[_0xbc60('0x64')](_0xbc60('0x65'));_0x5d701a[_0xbc60('0x5e')][_0xbc60('0x66')]=_0x5d701a[_0xbc60('0x5e')][_0xbc60('0x66')]||_0x5d701a['user']['id'];_0x1227d1[_0xbc60('0x67')]['id']=_0x5d701a['body']['UserId'];return db[_0xbc60('0x42')][_0xbc60('0x5c')]({'where':{'id':_0x5d701a[_0xbc60('0x5a')]['id'],'UserId':null}})[_0xbc60('0x25')](handleEntityNotFound(_0x1a2351,null))[_0xbc60('0x25')](saveUpdates(_0x5d701a['body'],null))[_0xbc60('0x25')](function(_0x2e8621){if(_0x2e8621){_0x1227d1[_0xbc60('0x2d')]=_0x2e8621[_0xbc60('0x68')]({'plain':!![]});return db[_0xbc60('0x69')]['find']({'where':{'id':_0x2e8621[_0xbc60('0x6a')]}});}return null;})[_0xbc60('0x25')](handleEntityNotFound(_0x1a2351,null))['then'](function(_0x362d08){if(_0x362d08){return _0x362d08[_0xbc60('0x3b')]({'UserId':_0x5d701a[_0xbc60('0x5e')][_0xbc60('0x66')],'read1stAt':_[_0xbc60('0x6b')](_0x362d08[_0xbc60('0x6c')])?moment()['format'](_0xbc60('0x65')):undefined});}return null;})[_0xbc60('0x25')](function(_0x473a29){if(_0x473a29){_0x1227d1[_0xbc60('0x6d')]=_0x473a29[_0xbc60('0x68')]({'plain':!![]});interaction_log[_0xbc60('0x26')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d701a[_0xbc60('0x6e')]['id'],_0x5d701a[_0xbc60('0x6e')][_0xbc60('0x3e')],_0x5d701a[_0xbc60('0x6e')][_0xbc60('0x6f')],_0x1227d1[_0xbc60('0x6d')]['id'],_0x5d701a[_0xbc60('0x5e')]?JSON[_0xbc60('0x70')](_0x5d701a[_0xbc60('0x5e')]):_0xbc60('0x71'));return respondWithRpcPromise(_0xbc60('0x72'),_0xbc60('0x73'),_0x1227d1);}return null;})[_0xbc60('0x25')](function(_0x5a5c42){var _0x440844=_0xbc60('0x74')+_0x5a5c42[_0xbc60('0x2d')][_0xbc60('0x75')];return db[_0xbc60('0x76')]['query'](_0x440844,{'type':db[_0xbc60('0x77')][_0xbc60('0x78')]['SELECT'],'raw':!![]})['then'](function(_0x27b56e){return _0x27b56e;});})[_0xbc60('0x25')](function(_0x4514e4){if(_0x4514e4){_0x1227d1[_0xbc60('0x2d')][_0xbc60('0x79')]=_0x4514e4[0x0];if(!_0x5d701a[_0xbc60('0x5e')][_0xbc60('0x66')])return;return db[_0xbc60('0x7a')][_0xbc60('0x5c')]({'where':{'id':_0x5d701a[_0xbc60('0x5e')]['UserId'],'role':_0xbc60('0x67')},'attributes':['id','name',_0xbc60('0x7b'),_0xbc60('0x7c'),_0xbc60('0x7d')],'raw':!![]});}return null;})[_0xbc60('0x25')](function(_0x33e6e2){if(!_0x33e6e2)return null;_0x1227d1[_0xbc60('0x2d')]['agent']=_0x33e6e2;return _0x1227d1;})[_0xbc60('0x25')](function(_0x91c4d1){if(_0x91c4d1){if(_0x5d701a[_0xbc60('0x5e')][_0xbc60('0x7e')]){_0x1227d1['message'][_0xbc60('0x7f')]=util[_0xbc60('0x64')](_0xbc60('0x80'),_0x5d701a[_0xbc60('0x6e')][_0xbc60('0x3e')]);_0x1227d1['message'][_0xbc60('0x81')]=_0x1227d1['channel'];_0x1227d1[_0xbc60('0x2d')][_0xbc60('0x82')]=_0x1227d1[_0xbc60('0x81')];_0x1227d1['message'][_0xbc60('0x83')]=_0xbc60('0x61');return respondWithRpcPromise(_0xbc60('0x84'),_0xbc60('0x84'),{'event':_0xbc60('0x85'),'message':_0x1227d1[_0xbc60('0x2d')]},client9002)['then'](function(){return _0x1227d1;});}return _0x1227d1;}return null;})[_0xbc60('0x25')](respondWithResult(_0x1a2351,null))['catch'](handleError(_0x1a2351,null));};var interaction_log=require('../../config/logger')(_0xbc60('0x60'));exports['reject']=function(_0x4c9af5,_0x331ebe,_0x20b308){var _0x9a8599={'agent':{},'channel':_0xbc60('0x62')};if(_0x4c9af5['body']['id']){delete _0x4c9af5[_0xbc60('0x5e')]['id'];}_0x4c9af5[_0xbc60('0x5e')][_0xbc60('0x66')]=_0x4c9af5[_0xbc60('0x5e')][_0xbc60('0x66')]||_0x4c9af5['user']['id'];_0x9a8599[_0xbc60('0x67')]['id']=_0x4c9af5[_0xbc60('0x5e')][_0xbc60('0x66')];return db[_0xbc60('0x42')][_0xbc60('0x5c')]({'where':{'id':_0x4c9af5[_0xbc60('0x5a')]['id'],'UserId':null}})[_0xbc60('0x25')](handleEntityNotFound(_0x331ebe,null))[_0xbc60('0x25')](function(_0x6c846b){if(_0x6c846b){_0x9a8599[_0xbc60('0x2d')]=_0x6c846b[_0xbc60('0x68')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x6c846b['OpenchannelInteractionId']}});}return null;})[_0xbc60('0x25')](handleEntityNotFound(_0x331ebe,null))[_0xbc60('0x25')](function(_0xea0a86){if(_0xea0a86){_0x9a8599[_0xbc60('0x6d')]=_0xea0a86[_0xbc60('0x68')]({'plain':!![]});interaction_log[_0xbc60('0x26')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c9af5[_0xbc60('0x6e')]['id'],_0x4c9af5[_0xbc60('0x6e')][_0xbc60('0x3e')],_0x4c9af5[_0xbc60('0x6e')][_0xbc60('0x6f')],_0x9a8599[_0xbc60('0x6d')]['id'],_0x4c9af5[_0xbc60('0x5e')]?JSON['stringify'](_0x4c9af5[_0xbc60('0x5e')]):_0xbc60('0x71'));return respondWithRpcPromise(_0xbc60('0x86'),_0xbc60('0x87'),_0x9a8599);}return null;})[_0xbc60('0x25')](function(_0x37d9c6){var _0x4647d7=_0xbc60('0x74')+_0x37d9c6['message'][_0xbc60('0x75')];return db[_0xbc60('0x76')][_0xbc60('0x46')](_0x4647d7,{'type':db[_0xbc60('0x77')][_0xbc60('0x78')][_0xbc60('0x88')],'raw':!![]})[_0xbc60('0x25')](function(_0x5d8312){return _0x5d8312;});})[_0xbc60('0x25')](function(_0x3c6747){if(_0x3c6747){_0x9a8599[_0xbc60('0x2d')][_0xbc60('0x79')]=_0x3c6747[0x0];if(!_0x4c9af5[_0xbc60('0x5e')][_0xbc60('0x66')])return;return db['User']['find']({'where':{'id':_0x4c9af5[_0xbc60('0x5e')][_0xbc60('0x66')],'role':_0xbc60('0x67')},'attributes':['id',_0xbc60('0x3e'),_0xbc60('0x7b'),'email',_0xbc60('0x7d')],'raw':!![]});}return null;})[_0xbc60('0x25')](function(_0x5cf2d2){if(!_0x5cf2d2)return null;_0x9a8599[_0xbc60('0x2d')][_0xbc60('0x67')]=_0x5cf2d2;return _0x9a8599;})[_0xbc60('0x25')](function(_0x1e468e){if(_0x1e468e){_0x1e468e[_0xbc60('0x2d')][_0xbc60('0x7f')]=util[_0xbc60('0x64')](_0xbc60('0x80'),_0x4c9af5[_0xbc60('0x6e')][_0xbc60('0x3e')]);_0x1e468e['message']['channel']=_0x9a8599['channel'];_0x1e468e['message'][_0xbc60('0x82')]=_0x9a8599[_0xbc60('0x81')];_0x1e468e[_0xbc60('0x2d')]['event']=_0xbc60('0x39');respondWithRpcPromise(_0xbc60('0x84'),_0xbc60('0x84'),{'event':_0xbc60('0x89'),'message':_0x1e468e[_0xbc60('0x2d')]},client9002);return _0x9a8599;}return null;})['then'](respondWithResult(_0x331ebe,null))['catch'](handleError(_0x331ebe,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6aa2308..3b14a9b 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 _0x1575=['save','remove','emit','hook','events','../../mysqldb'];(function(_0x56139e,_0x714ec2){var _0x113526=function(_0x529c28){while(--_0x529c28){_0x56139e['push'](_0x56139e['shift']());}};_0x113526(++_0x714ec2);}(_0x1575,0x88));var _0x5157=function(_0x3a7650,_0x458946){_0x3a7650=_0x3a7650-0x0;var _0x136de7=_0x1575[_0x3a7650];return _0x136de7;};'use strict';var EventEmitter=require(_0x5157('0x0'));var OpenchannelMessage=require(_0x5157('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5157('0x2'),'afterUpdate':'update','afterDestroy':_0x5157('0x3')};function emitEvent(_0x505f43){return function(_0x1e97da,_0x119c78,_0x18fb17){OpenchannelMessageEvents[_0x5157('0x4')](_0x505f43+':'+_0x1e97da['id'],_0x1e97da);OpenchannelMessageEvents[_0x5157('0x4')](_0x505f43,_0x1e97da);_0x18fb17(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x5157('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x0c63=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x3ede43,_0x2c1338){var _0x5ed193=function(_0x542ca8){while(--_0x542ca8){_0x3ede43['push'](_0x3ede43['shift']());}};_0x5ed193(++_0x2c1338);}(_0x0c63,0x1ed));var _0x30c6=function(_0x5655ea,_0x394586){_0x5655ea=_0x5655ea-0x0;var _0xc711ac=_0x0c63[_0x5655ea];return _0xc711ac;};'use strict';var EventEmitter=require(_0x30c6('0x0'));var OpenchannelMessage=require(_0x30c6('0x1'))['db'][_0x30c6('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x30c6('0x3')](0x0);var events={'afterCreate':_0x30c6('0x4'),'afterUpdate':_0x30c6('0x5'),'afterDestroy':_0x30c6('0x6')};function emitEvent(_0x1d6fd4){return function(_0x5a6183,_0x4fd5ba,_0x3e7777){OpenchannelMessageEvents[_0x30c6('0x7')](_0x1d6fd4+':'+_0x5a6183['id'],_0x5a6183);OpenchannelMessageEvents[_0x30c6('0x7')](_0x1d6fd4,_0x5a6183);_0x3e7777(null);};}for(var e in events){if(events[_0x30c6('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x30c6('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8bc285e..6b08df4 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 _0x70b4=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','then','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','OpenchannelMessage,\x20%s,\x20%s','threadId'];(function(_0x509b99,_0x3ff1f0){var _0x383d46=function(_0x5cfcab){while(--_0x5cfcab){_0x509b99['push'](_0x509b99['shift']());}};_0x383d46(++_0x3ff1f0);}(_0x70b4,0x130));var _0x470b=function(_0x4941bc,_0x199598){_0x4941bc=_0x4941bc-0x0;var _0xf3862d=_0x70b4[_0x4941bc];return _0xf3862d;};'use strict';var _=require(_0x470b('0x0'));var util=require('util');var logger=require(_0x470b('0x1'))(_0x470b('0x2'));var moment=require(_0x470b('0x3'));var BPromise=require(_0x470b('0x4'));var rp=require(_0x470b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x470b('0x6'));var config=require(_0x470b('0x7'));var attributes=require(_0x470b('0x8'));module['exports']=function(_0x256e8d,_0x1e9725){return _0x256e8d[_0x470b('0x9')](_0x470b('0xa'),attributes,{'tableName':_0x470b('0xb'),'paranoid':![],'indexes':[{'name':_0x470b('0xc'),'fields':[_0x470b('0xd')],'type':_0x470b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fe321,_0x245a4b,_0x4670c7){var _0x3d64f9=_0x256e8d[_0x470b('0xf')];var _0x3b2bb8=_0x2fe321[_0x470b('0x10')]({'plain':!![]});if(_0x3b2bb8['direction'][_0x470b('0x11')]()==='in'||_0x3b2bb8[_0x470b('0x12')][_0x470b('0x11')]()===_0x470b('0x13')&&!_0x3b2bb8['secret']&&!_['isNil'](_0x3b2bb8['UserId'])){_0x3d64f9[_0x470b('0x14')][_0x470b('0x15')]({'where':{'id':_0x3b2bb8[_0x470b('0x16')]}})['then'](function(_0x288966){if(_0x288966){_0x288966[_0x470b('0x17')]({'lastMsgAt':_0x3b2bb8[_0x470b('0x18')],'lastMsgDirection':_0x3b2bb8[_0x470b('0x12')][_0x470b('0x11')]()});}})['catch'](function(_0x325ba5){console[_0x470b('0x19')](_0x325ba5);});}if(_0x3b2bb8['direction']==='out'&&!_0x3b2bb8[_0x470b('0x1a')]){var _0x109c6a;_0x3d64f9[_0x470b('0x1b')][_0x470b('0x1c')]()['then'](function(_0x49d4e4){return _0x3d64f9[_0x470b('0x1d')][_0x470b('0x1e')]({'where':{'id':_0x3b2bb8[_0x470b('0x1f')]},'include':[{'model':_0x3d64f9['OpenchannelInteraction'],'as':_0x470b('0x20'),'where':{'id':_0x3b2bb8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3d64f9[_0x470b('0x1b')],'as':_0x470b('0x21'),'attributes':_[_0x470b('0x22')](_0x49d4e4)}]}]});})[_0x470b('0x23')](function(_0x5c437b){_0x109c6a=_0x5c437b[_0x470b('0x10')]({'plain':!![]});if(_0x109c6a&&_0x109c6a[_0x470b('0x24')]){logger[_0x470b('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x470b('0x26'),util[_0x470b('0x27')](_0x470b('0x28'),_0x3b2bb8['id'],_0x109c6a[_0x470b('0x24')]));if(_0x109c6a[_0x470b('0x20')]&&_0x109c6a['Interactions']['length']){_0x3b2bb8[_0x470b('0x29')]=_[_0x470b('0x2a')](_0x109c6a['Interactions'][0x0],_0x470b('0x21'));_0x3b2bb8['Contact']=_0x109c6a['Interactions'][0x0][_0x470b('0x21')];}var _0x245a4b={'method':_0x470b('0x2b'),'uri':encodeURI(_0x109c6a[_0x470b('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x245a4b['method']){case'GET':_0x245a4b['qs']=_0x3b2bb8;break;case _0x470b('0x2b'):_0x245a4b['body']=_0x3b2bb8;break;}return rp(_0x245a4b)[_0x470b('0x23')](function(_0x1d934f){logger[_0x470b('0x25')](_0x470b('0x2c'),_0x470b('0x26'),util[_0x470b('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3b2bb8['id'],_0x109c6a[_0x470b('0x24')]));if(_0x1d934f[_0x470b('0xd')][_0x470b('0x2d')]&&_0x1d934f[_0x470b('0xd')][_0x470b('0x2d')]!=_0x3b2bb8[_0x470b('0x29')][_0x470b('0x2d')]){return _0x3d64f9[_0x470b('0x14')][_0x470b('0x17')]({'threadId':_0x1d934f['body']['threadId']},{'where':{'id':_0x3b2bb8[_0x470b('0x29')]['id']}});}else{return;}})[_0x470b('0x23')](function(){return _0x2fe321[_0x470b('0x17')]({'read':!![]});})['catch'](function(_0x3ff27a){logger[_0x470b('0x19')](_0x470b('0x2c'),_0x470b('0x26'),util[_0x470b('0x2e')](_0x3ff27a,{'showHidden':![],'depth':null}));_0x4670c7();});}else{_0x4670c7();}})[_0x470b('0x2f')](function(){_0x4670c7();});}else{_0x4670c7();}}},'charset':_0x470b('0x30'),'collate':_0x470b('0x31')});}; \ No newline at end of file +var _0x0062=['method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','lodash','../../config/logger','api','bluebird','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST'];(function(_0x21679c,_0x5064c8){var _0x3cbd03=function(_0x268a25){while(--_0x268a25){_0x21679c['push'](_0x21679c['shift']());}};_0x3cbd03(++_0x5064c8);}(_0x0062,0x66));var _0x2006=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x0062[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x2006('0x0'));var util=require('util');var logger=require(_0x2006('0x1'))(_0x2006('0x2'));var moment=require('moment');var BPromise=require(_0x2006('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2006('0x4'));var config=require('../../config/environment');var attributes=require(_0x2006('0x5'));module[_0x2006('0x6')]=function(_0x41fe34,_0x576614){return _0x41fe34[_0x2006('0x7')](_0x2006('0x8'),attributes,{'tableName':_0x2006('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x2006('0xa')],'type':_0x2006('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f25a8,_0x52521e,_0x5e4eeb){var _0x197c02=_0x41fe34[_0x2006('0xc')];var _0x185bee=_0x3f25a8['get']({'plain':!![]});if(_0x185bee[_0x2006('0xd')][_0x2006('0xe')]()==='in'||_0x185bee['direction'][_0x2006('0xe')]()===_0x2006('0xf')&&!_0x185bee[_0x2006('0x10')]&&!_[_0x2006('0x11')](_0x185bee['UserId'])){_0x197c02[_0x2006('0x12')]['findOne']({'where':{'id':_0x185bee[_0x2006('0x13')]}})[_0x2006('0x14')](function(_0x3396cb){if(_0x3396cb){_0x3396cb['update']({'lastMsgAt':_0x185bee[_0x2006('0x15')],'lastMsgDirection':_0x185bee[_0x2006('0xd')][_0x2006('0xe')]()});}})[_0x2006('0x16')](function(_0x416a55){console[_0x2006('0x17')](_0x416a55);});}if(_0x185bee['direction']===_0x2006('0xf')&&!_0x185bee['secret']){var _0x4a0d41;_0x197c02[_0x2006('0x18')][_0x2006('0x19')]()[_0x2006('0x14')](function(_0x5417fb){return _0x197c02[_0x2006('0x1a')]['find']({'where':{'id':_0x185bee['OpenchannelAccountId']},'include':[{'model':_0x197c02[_0x2006('0x12')],'as':_0x2006('0x1b'),'where':{'id':_0x185bee[_0x2006('0x13')]},'limit':0x1,'include':[{'model':_0x197c02['CmContact'],'as':_0x2006('0x1c'),'attributes':_[_0x2006('0x1d')](_0x5417fb)}]}]});})['then'](function(_0x4d200c){_0x4a0d41=_0x4d200c['get']({'plain':!![]});if(_0x4a0d41&&_0x4a0d41[_0x2006('0x1e')]){logger[_0x2006('0x1f')](_0x2006('0x20'),_0x2006('0x21'),util[_0x2006('0x22')](_0x2006('0x23'),_0x185bee['id'],_0x4a0d41[_0x2006('0x1e')]));if(_0x4a0d41[_0x2006('0x1b')]&&_0x4a0d41[_0x2006('0x1b')]['length']){_0x185bee[_0x2006('0x24')]=_[_0x2006('0x25')](_0x4a0d41[_0x2006('0x1b')][0x0],'Contact');_0x185bee[_0x2006('0x1c')]=_0x4a0d41[_0x2006('0x1b')][0x0]['Contact'];}var _0x52521e={'method':_0x2006('0x26'),'uri':encodeURI(_0x4a0d41[_0x2006('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x52521e[_0x2006('0x27')]){case _0x2006('0x28'):_0x52521e['qs']=_0x185bee;break;case _0x2006('0x26'):_0x52521e['body']=_0x185bee;break;}return rp(_0x52521e)[_0x2006('0x14')](function(_0x3a83b1){logger[_0x2006('0x1f')](_0x2006('0x20'),'afterCreate',util[_0x2006('0x22')](_0x2006('0x29'),_0x185bee['id'],_0x4a0d41[_0x2006('0x1e')]));if(_0x3a83b1['body']['threadId']&&_0x3a83b1[_0x2006('0xa')][_0x2006('0x2a')]!=_0x185bee[_0x2006('0x24')][_0x2006('0x2a')]){return _0x197c02[_0x2006('0x12')]['update']({'threadId':_0x3a83b1[_0x2006('0xa')][_0x2006('0x2a')]},{'where':{'id':_0x185bee[_0x2006('0x24')]['id']}});}else{return;}})[_0x2006('0x14')](function(){return _0x3f25a8[_0x2006('0x2b')]({'read':!![]});})[_0x2006('0x16')](function(_0x399d8c){logger['error'](_0x2006('0x20'),_0x2006('0x21'),util[_0x2006('0x2c')](_0x399d8c,{'showHidden':![],'depth':null}));_0x5e4eeb();});}else{_0x5e4eeb();}})[_0x2006('0x2d')](function(){_0x5e4eeb();});}else{_0x5e4eeb();}}},'charset':_0x2006('0x2e'),'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 ebe37c1..03dc125 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x4cacfc,_0x56dfe0){var _0xffb88c=function(_0x3023b7){while(--_0x3023b7){_0x4cacfc['push'](_0x4cacfc['shift']());}};_0xffb88c(++_0x56dfe0);}(_0xdb28,0x106));var _0x8db2=function(_0x2e0c50,_0x47cf9c){_0x2e0c50=_0x2e0c50-0x0;var _0x1a5ddd=_0xdb28[_0x2e0c50];return _0x1a5ddd;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42f92a,_0x2bdd20){var _0x24a7d1=function(_0x537a3a){while(--_0x537a3a){_0x42f92a['push'](_0x42f92a['shift']());}};_0x24a7d1(++_0x2bdd20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1aa0fc,_0x441679){_0x1aa0fc=_0x1aa0fc-0x0;var _0x2c3977=_0x5f2f[_0x1aa0fc];return _0x2c3977;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6bcb986..dfcb008 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 _0x96b7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0x96b7,0x149));var _0x796b=function(_0x38e8b0,_0x5b8cb5){_0x38e8b0=_0x38e8b0-0x0;var _0x139697=_0x96b7[_0x38e8b0];return _0x139697;};'use strict';var OpenchannelMessageEvents=require(_0x796b('0x0'));var events=[_0x796b('0x1'),_0x796b('0x2'),_0x796b('0x3')];function createListener(_0x5210d4,_0x39b4f7){return function(_0x571082){_0x39b4f7[_0x796b('0x4')](_0x5210d4,_0x571082);};}function removeListener(_0x2268ff,_0x5866b8){return function(){OpenchannelMessageEvents[_0x796b('0x5')](_0x2268ff,_0x5866b8);};}exports['register']=function(_0x553615){for(var _0x4cece8=0x0,_0x30dbb9=events[_0x796b('0x6')];_0x4cece8<_0x30dbb9;_0x4cece8++){var _0x243531=events[_0x4cece8];var _0x4b7951=createListener(_0x796b('0x7')+_0x243531,_0x553615);OpenchannelMessageEvents['on'](_0x243531,_0x4b7951);}}; \ No newline at end of file +var _0x9485=['removeListener','register','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0x9485,0x8b));var _0x5948=function(_0x25b7f9,_0x2f9aee){_0x25b7f9=_0x25b7f9-0x0;var _0x1d1598=_0x9485[_0x25b7f9];return _0x1d1598;};'use strict';var OpenchannelMessageEvents=require(_0x5948('0x0'));var events=[_0x5948('0x1'),_0x5948('0x2'),_0x5948('0x3')];function createListener(_0x5ca17a,_0x42393d){return function(_0xc057c8){_0x42393d[_0x5948('0x4')](_0x5ca17a,_0xc057c8);};}function removeListener(_0x47b3f3,_0xcfd4b6){return function(){OpenchannelMessageEvents[_0x5948('0x5')](_0x47b3f3,_0xcfd4b6);};}exports[_0x5948('0x6')]=function(_0x4312a8){for(var _0x19ccdd=0x0,_0x283a13=events['length'];_0x19ccdd<_0x283a13;_0x19ccdd++){var _0x2cf314=events[_0x19ccdd];var _0x4e7f15=createListener(_0x5948('0x7')+_0x2cf314,_0x4312a8);OpenchannelMessageEvents['on'](_0x2cf314,_0x4e7f15);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index cef7f8c..5b0b193 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 _0xce3a=['getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','removeTeams','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce3a,0x13f));var _0xace3=function(_0x218f38,_0x4f8ad6){_0x218f38=_0x218f38-0x0;var _0x4b1b83=_0xce3a[_0x218f38];return _0x4b1b83;};'use strict';var multer=require('multer');var util=require(_0xace3('0x0'));var path=require('path');var timeout=require(_0xace3('0x1'));var express=require(_0xace3('0x2'));var router=express[_0xace3('0x3')]();var fs_extra=require(_0xace3('0x4'));var auth=require(_0xace3('0x5'));var interaction=require(_0xace3('0x6'));var config=require(_0xace3('0x7'));var controller=require(_0xace3('0x8'));router[_0xace3('0x9')]('/',auth[_0xace3('0xa')](),controller['index']);router[_0xace3('0x9')]('/describe',auth[_0xace3('0xa')](),controller[_0xace3('0xb')]);router[_0xace3('0x9')](_0xace3('0xc'),auth[_0xace3('0xa')](),controller[_0xace3('0xd')]);router[_0xace3('0x9')](_0xace3('0xe'),auth[_0xace3('0xa')](),controller[_0xace3('0xf')]);router['get'](_0xace3('0x10'),auth[_0xace3('0xa')](),controller[_0xace3('0x11')]);router[_0xace3('0x9')](_0xace3('0x12'),auth[_0xace3('0xa')](),controller[_0xace3('0x13')]);router['post']('/',auth[_0xace3('0xa')](),controller[_0xace3('0x14')]);router[_0xace3('0x15')](_0xace3('0x10'),auth[_0xace3('0xa')](),controller[_0xace3('0x16')]);router[_0xace3('0x15')](_0xace3('0x12'),auth[_0xace3('0xa')](),controller[_0xace3('0x17')]);router[_0xace3('0x18')](_0xace3('0xc'),auth[_0xace3('0xa')](),controller['update']);router['delete'](_0xace3('0xc'),auth[_0xace3('0xa')](),controller['destroy']);router[_0xace3('0x19')](_0xace3('0x10'),auth['isAuthenticated'](),controller[_0xace3('0x1a')]);router['delete'](_0xace3('0x12'),auth[_0xace3('0xa')](),controller[_0xace3('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x47f9=['removeAgents','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','/:id/users'];(function(_0x1293bd,_0x479537){var _0x435472=function(_0x19edc6){while(--_0x19edc6){_0x1293bd['push'](_0x1293bd['shift']());}};_0x435472(++_0x479537);}(_0x47f9,0x151));var _0x947f=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x47f9[_0x2a558d];return _0xa7bc9c;};'use strict';var multer=require(_0x947f('0x0'));var util=require(_0x947f('0x1'));var path=require(_0x947f('0x2'));var timeout=require(_0x947f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x947f('0x4'));var auth=require(_0x947f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x947f('0x6'));var controller=require(_0x947f('0x7'));router[_0x947f('0x8')]('/',auth[_0x947f('0x9')](),controller['index']);router[_0x947f('0x8')]('/describe',auth[_0x947f('0x9')](),controller['describe']);router['get'](_0x947f('0xa'),auth[_0x947f('0x9')](),controller[_0x947f('0xb')]);router[_0x947f('0x8')](_0x947f('0xc'),auth[_0x947f('0x9')](),controller[_0x947f('0xd')]);router[_0x947f('0x8')]('/:id/teams',auth[_0x947f('0x9')](),controller[_0x947f('0xe')]);router[_0x947f('0x8')]('/:id/users',auth[_0x947f('0x9')](),controller[_0x947f('0xf')]);router[_0x947f('0x10')]('/',auth['isAuthenticated'](),controller[_0x947f('0x11')]);router[_0x947f('0x10')](_0x947f('0x12'),auth[_0x947f('0x9')](),controller[_0x947f('0x13')]);router[_0x947f('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x947f('0x14')]);router[_0x947f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x947f('0x16')]);router[_0x947f('0x17')](_0x947f('0xa'),auth[_0x947f('0x9')](),controller[_0x947f('0x18')]);router[_0x947f('0x17')]('/:id/teams',auth[_0x947f('0x9')](),controller[_0x947f('0x19')]);router[_0x947f('0x17')](_0x947f('0x1a'),auth[_0x947f('0x9')](),controller[_0x947f('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6ea285a..57f4c6a 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 _0x040f=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x109c0f,_0x3be9f4){var _0x4ed42b=function(_0x361d32){while(--_0x361d32){_0x109c0f['push'](_0x109c0f['shift']());}};_0x4ed42b(++_0x3be9f4);}(_0x040f,0x1e0));var _0xf040=function(_0x266df3,_0x310f44){_0x266df3=_0x266df3-0x0;var _0x36684b=_0x040f[_0x266df3];return _0x36684b;};'use strict';var Sequelize=require(_0xf040('0x0'));module[_0xf040('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf040('0x2')]},'timeout':{'type':Sequelize[_0xf040('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf040('0x4')](_0xf040('0x5'),_0xf040('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xb3b1=['ENUM','rrmemory','beepall','sequelize','exports','name','INTEGER'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xb3b1,0x11b));var _0x1b3b=function(_0x3e4061,_0x502d0b){_0x3e4061=_0x3e4061-0x0;var _0xfac9e9=_0xb3b1[_0x3e4061];return _0xfac9e9;};'use strict';var Sequelize=require(_0x1b3b('0x0'));module[_0x1b3b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b3b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1b3b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b3b('0x4')](_0x1b3b('0x5'),_0x1b3b('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9bafbd0..a91284e 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 _0xd680=['%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','SELECT','every','TeamId','includes','all','compact','value','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','then','get','OpenchannelQueues','destroy','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','pick','filter','merge','where','options','findAll','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','order','sort','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format'];(function(_0x43acda,_0x19a3dc){var _0x156ea4=function(_0x1a438d){while(--_0x1a438d){_0x43acda['push'](_0x43acda['shift']());}};_0x156ea4(++_0x19a3dc);}(_0xd680,0xb3));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d68('0x0'));var zipdir=require(_0x0d68('0x1'));var jsonpatch=require(_0x0d68('0x2'));var rp=require(_0x0d68('0x3'));var moment=require(_0x0d68('0x4'));var BPromise=require(_0x0d68('0x5'));var Mustache=require(_0x0d68('0x6'));var util=require(_0x0d68('0x7'));var path=require('path');var sox=require(_0x0d68('0x8'));var csv=require(_0x0d68('0x9'));var ejs=require(_0x0d68('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d68('0xb'));var squel=require('squel');var crypto=require(_0x0d68('0xc'));var jsforce=require(_0x0d68('0xd'));var deskjs=require(_0x0d68('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0d68('0xf'));var Papa=require(_0x0d68('0x10'));var Redis=require(_0x0d68('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d68('0x12'));var as=require(_0x0d68('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d68('0x14'))(_0x0d68('0x15'));var utils=require('../../config/utils');var config=require(_0x0d68('0x16'));var licenseUtil=require(_0x0d68('0x17'));var db=require(_0x0d68('0x18'))['db'];config[_0x0d68('0x19')]=_[_0x0d68('0x1a')](config['redis'],{'host':_0x0d68('0x1b'),'port':0x18eb});var socket=require(_0x0d68('0x1c'))(new Redis(config[_0x0d68('0x19')]));require('./openchannelQueue.socket')[_0x0d68('0x1d')](socket);function respondWithStatusCode(_0x4012d7,_0x5d246c){_0x5d246c=_0x5d246c||0xcc;return function(_0x2f18ad){if(_0x2f18ad){return _0x4012d7[_0x0d68('0x1e')](_0x5d246c);}return _0x4012d7[_0x0d68('0x1f')](_0x5d246c)[_0x0d68('0x20')]();};}function respondWithResult(_0x2774e7,_0x23dbef){_0x23dbef=_0x23dbef||0xc8;return function(_0x20e79e){if(_0x20e79e){return _0x2774e7[_0x0d68('0x1f')](_0x23dbef)['json'](_0x20e79e);}};}function respondWithFilteredResult(_0x5a2d3c,_0x475e2c){return function(_0x2f6ee1){if(_0x2f6ee1){var _0x4c8536=typeof _0x475e2c[_0x0d68('0x21')]===_0x0d68('0x22')&&typeof _0x475e2c['limit']===_0x0d68('0x22');var _0x43d137=_0x2f6ee1['count'];var _0xe513e7=_0x4c8536?0x0:_0x475e2c[_0x0d68('0x21')];var _0x2afd11=_0x4c8536?_0x2f6ee1[_0x0d68('0x23')]:_0x475e2c[_0x0d68('0x21')]+_0x475e2c['limit'];var _0x2bc9f7;if(_0x2afd11>=_0x43d137){_0x2afd11=_0x43d137;_0x2bc9f7=0xc8;}else{_0x2bc9f7=0xce;}_0x5a2d3c[_0x0d68('0x1f')](_0x2bc9f7);return _0x5a2d3c[_0x0d68('0x24')](_0x0d68('0x25'),_0xe513e7+'-'+_0x2afd11+'/'+_0x43d137)[_0x0d68('0x26')](_0x2f6ee1);}return null;};}function patchUpdates(_0x3d1e5c){return function(_0x589b6b){try{jsonpatch[_0x0d68('0x27')](_0x589b6b,_0x3d1e5c,!![]);}catch(_0x508a8c){return BPromise['reject'](_0x508a8c);}return _0x589b6b[_0x0d68('0x28')]();};}function saveUpdates(_0x44dd10,_0x398db2){return function(_0x59d5fc){if(_0x59d5fc){return _0x59d5fc['update'](_0x44dd10)[_0x0d68('0x29')](function(_0x4c1d82){return _0x4c1d82;});}return null;};}function removeEntity(_0x5295e3,_0x5609a0){return function(_0x33deb1){if(_0x33deb1){return _0x33deb1['destroy']()[_0x0d68('0x29')](function(){var _0x20edc3=_0x33deb1[_0x0d68('0x2a')]({'plain':!![]});var _0x2a4b1c=_0x0d68('0x2b');return db['UserProfileResource'][_0x0d68('0x2c')]({'where':{'type':_0x2a4b1c,'resourceId':_0x20edc3['id']}})[_0x0d68('0x29')](function(){return _0x33deb1;});})[_0x0d68('0x29')](function(){_0x5295e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3155,_0x2af6fd){return function(_0x1e75c8){if(!_0x1e75c8){_0x1d3155[_0x0d68('0x1e')](0x194);}return _0x1e75c8;};}function handleError(_0x15baf3,_0x14d678){_0x14d678=_0x14d678||0x1f4;return function(_0x19f3ad){logger[_0x0d68('0x2d')](_0x19f3ad[_0x0d68('0x2e')]);if(_0x19f3ad[_0x0d68('0x2f')]){delete _0x19f3ad['name'];}_0x15baf3['status'](_0x14d678)['send'](_0x19f3ad);};}exports[_0x0d68('0x30')]=function(_0x255818,_0x5b53ac){var _0x273f59={},_0xa977b6={},_0x116e3e={'count':0x0,'rows':[]};var _0x110072=_[_0x0d68('0x31')](db[_0x0d68('0x32')][_0x0d68('0x33')],function(_0x5a4a87){return{'name':_0x5a4a87[_0x0d68('0x34')],'type':_0x5a4a87[_0x0d68('0x35')][_0x0d68('0x36')]};});_0xa977b6['model']=_[_0x0d68('0x31')](_0x110072,_0x0d68('0x2f'));_0xa977b6[_0x0d68('0x37')]=_[_0x0d68('0x38')](_0x255818[_0x0d68('0x37')]);_0xa977b6[_0x0d68('0x39')]=_[_0x0d68('0x3a')](_0xa977b6['model'],_0xa977b6['query']);_0x273f59[_0x0d68('0x3b')]=_[_0x0d68('0x3a')](_0xa977b6[_0x0d68('0x3c')],qs['fields'](_0x255818[_0x0d68('0x37')][_0x0d68('0x3d')]));_0x273f59[_0x0d68('0x3b')]=_0x273f59[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x273f59[_0x0d68('0x3b')]:_0xa977b6[_0x0d68('0x3c')];if(!_0x255818[_0x0d68('0x37')][_0x0d68('0x3f')](_0x0d68('0x40'))){_0x273f59[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x255818[_0x0d68('0x37')][_0x0d68('0x41')]);_0x273f59[_0x0d68('0x21')]=qs[_0x0d68('0x21')](_0x255818[_0x0d68('0x37')][_0x0d68('0x21')]);}_0x273f59['order']=qs['sort'](_0x255818[_0x0d68('0x37')]['sort']);_0x273f59['where']=qs['filters'](_[_0x0d68('0x42')](_0x255818[_0x0d68('0x37')],_0xa977b6[_0x0d68('0x39')]),_0x110072);if(_0x255818[_0x0d68('0x37')][_0x0d68('0x43')]){_0x273f59['where']=_[_0x0d68('0x44')](_0x273f59[_0x0d68('0x45')],{'$or':_['map'](_0x110072,function(_0x1ba5fe){if(_0x1ba5fe['type']!=='VIRTUAL'){var _0x52e0c9={};_0x52e0c9[_0x1ba5fe[_0x0d68('0x2f')]]={'$like':'%'+_0x255818['query']['filter']+'%'};return _0x52e0c9;}})});}_0x273f59=_[_0x0d68('0x44')]({},_0x273f59,_0x255818[_0x0d68('0x46')]);var _0x1e6db2={'where':_0x273f59[_0x0d68('0x45')]};return db['OpenchannelQueue'][_0x0d68('0x23')](_0x1e6db2)[_0x0d68('0x29')](function(_0x5462aa){_0x116e3e[_0x0d68('0x23')]=_0x5462aa;if(_0x255818['query']['includeAll']){_0x273f59['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0d68('0x47')](_0x273f59);})['then'](function(_0x488eb7){_0x116e3e['rows']=_0x488eb7;return _0x116e3e;})[_0x0d68('0x29')](respondWithFilteredResult(_0x5b53ac,_0x273f59))[_0x0d68('0x48')](handleError(_0x5b53ac,null));};exports[_0x0d68('0x49')]=function(_0x52beb7,_0x4682e7){var _0x5b2c6f={'raw':!![],'where':{'id':_0x52beb7[_0x0d68('0x4a')]['id']}},_0x375a1d={};_0x375a1d['model']=_[_0x0d68('0x38')](db[_0x0d68('0x32')]['rawAttributes']);_0x375a1d[_0x0d68('0x37')]=_['keys'](_0x52beb7[_0x0d68('0x37')]);_0x375a1d[_0x0d68('0x39')]=_['intersection'](_0x375a1d[_0x0d68('0x3c')],_0x375a1d[_0x0d68('0x37')]);_0x5b2c6f[_0x0d68('0x3b')]=_[_0x0d68('0x3a')](_0x375a1d[_0x0d68('0x3c')],qs[_0x0d68('0x3d')](_0x52beb7['query'][_0x0d68('0x3d')]));_0x5b2c6f[_0x0d68('0x3b')]=_0x5b2c6f[_0x0d68('0x3b')]['length']?_0x5b2c6f[_0x0d68('0x3b')]:_0x375a1d[_0x0d68('0x3c')];if(_0x52beb7[_0x0d68('0x37')][_0x0d68('0x4b')]){_0x5b2c6f[_0x0d68('0x4c')]=[{'all':!![]}];}_0x5b2c6f=_[_0x0d68('0x44')]({},_0x5b2c6f,_0x52beb7['options']);return db[_0x0d68('0x32')][_0x0d68('0x4d')](_0x5b2c6f)[_0x0d68('0x29')](handleEntityNotFound(_0x4682e7,null))[_0x0d68('0x29')](respondWithResult(_0x4682e7,null))['catch'](handleError(_0x4682e7,null));};exports[_0x0d68('0x4e')]=function(_0x5775bf,_0x5aa9f5){return db['OpenchannelQueue'][_0x0d68('0x4e')](_0x5775bf[_0x0d68('0x4f')],{})[_0x0d68('0x29')](function(_0x548e34){var _0x4bda79=_0x5775bf['user'][_0x0d68('0x2a')]({'plain':!![]});if(!_0x4bda79)throw new Error(_0x0d68('0x50'));if(_0x4bda79['role']===_0x0d68('0x51')){var _0x3523bb=_0x548e34[_0x0d68('0x2a')]({'plain':!![]});var _0x3f030a=_0x0d68('0x2b');return db['UserProfileSection'][_0x0d68('0x4d')]({'where':{'name':_0x3f030a,'userProfileId':_0x4bda79[_0x0d68('0x52')]},'raw':!![]})[_0x0d68('0x29')](function(_0x4c703a){if(_0x4c703a&&_0x4c703a[_0x0d68('0x53')]===0x0){return db[_0x0d68('0x54')]['create']({'name':_0x3523bb[_0x0d68('0x2f')],'resourceId':_0x3523bb['id'],'type':_0x4c703a['name'],'sectionId':_0x4c703a['id']},{})[_0x0d68('0x29')](function(){return _0x548e34;});}else{return _0x548e34;}})[_0x0d68('0x48')](function(_0x5a1e8a){logger[_0x0d68('0x2d')](_0x0d68('0x55'),_0x5a1e8a);throw _0x5a1e8a;});}return _0x548e34;})[_0x0d68('0x29')](respondWithResult(_0x5aa9f5,0xc9))[_0x0d68('0x48')](handleError(_0x5aa9f5,null));};exports[_0x0d68('0x56')]=function(_0x1e32c3,_0x4383a9){if(_0x1e32c3[_0x0d68('0x4f')]['id']){delete _0x1e32c3[_0x0d68('0x4f')]['id'];}return db[_0x0d68('0x32')]['find']({'where':{'id':_0x1e32c3[_0x0d68('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4383a9,null))[_0x0d68('0x29')](saveUpdates(_0x1e32c3[_0x0d68('0x4f')],null))['then'](respondWithResult(_0x4383a9,null))[_0x0d68('0x48')](handleError(_0x4383a9,null));};exports[_0x0d68('0x2c')]=function(_0x1d825d,_0x4032e4){return db['OpenchannelQueue'][_0x0d68('0x4d')]({'where':{'id':_0x1d825d[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x4032e4,null))['then'](removeEntity(_0x4032e4,null))[_0x0d68('0x48')](handleError(_0x4032e4,null));};exports['describe']=function(_0x2c1541,_0x523dda){return db[_0x0d68('0x32')][_0x0d68('0x57')]()[_0x0d68('0x29')](respondWithResult(_0x523dda,null))[_0x0d68('0x48')](handleError(_0x523dda,null));};exports[_0x0d68('0x58')]=function(_0x1e230b,_0x207035,_0x1a8763){var _0x557858={'raw':!![],'where':{}},_0x1ffeb3={},_0x30ab71;return db[_0x0d68('0x32')][_0x0d68('0x59')]({'where':{'id':_0x1e230b['params']['id']}})['then'](handleEntityNotFound(_0x207035,null))[_0x0d68('0x29')](function(_0x185f9a){if(_0x185f9a){_0x30ab71=_0x185f9a[_0x0d68('0x2a')]({'plain':!![]});_0x1ffeb3[_0x0d68('0x3c')]=_['keys'](db[_0x0d68('0x5a')][_0x0d68('0x33')]);_0x1ffeb3[_0x0d68('0x37')]=_[_0x0d68('0x38')](_0x1e230b['query']);_0x1ffeb3['filters']=_['intersection'](_0x1ffeb3[_0x0d68('0x3c')],_0x1ffeb3[_0x0d68('0x37')]);_0x557858[_0x0d68('0x3b')]=_['intersection'](_0x1ffeb3[_0x0d68('0x3c')],qs['fields'](_0x1e230b[_0x0d68('0x37')][_0x0d68('0x3d')]));_0x557858[_0x0d68('0x3b')]=_0x557858[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x557858['attributes']:_0x1ffeb3[_0x0d68('0x3c')];if(!_0x1e230b[_0x0d68('0x37')][_0x0d68('0x3f')](_0x0d68('0x40'))){_0x557858[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x1e230b[_0x0d68('0x37')][_0x0d68('0x41')]);_0x557858[_0x0d68('0x21')]=qs[_0x0d68('0x21')](_0x1e230b['query'][_0x0d68('0x21')]);}_0x557858[_0x0d68('0x5b')]=qs[_0x0d68('0x5c')](_0x1e230b[_0x0d68('0x37')]['sort']);_0x557858[_0x0d68('0x45')]=qs[_0x0d68('0x39')](_[_0x0d68('0x42')](_0x1e230b[_0x0d68('0x37')],_0x1ffeb3[_0x0d68('0x39')]));_0x557858['where'][_0x0d68('0x5d')]=_0x185f9a['id'];if(_0x1e230b[_0x0d68('0x37')][_0x0d68('0x43')]){_0x557858['where']=_[_0x0d68('0x44')](_0x557858['where'],{'$or':_[_0x0d68('0x31')](_0x557858[_0x0d68('0x3b')],function(_0x3fe01d){var _0x360a1e={};_0x360a1e[_0x3fe01d]={'$like':'%'+_0x1e230b[_0x0d68('0x37')][_0x0d68('0x43')]+'%'};return _0x360a1e;})});}_0x557858=_[_0x0d68('0x44')]({},_0x557858,_0x1e230b[_0x0d68('0x46')]);return db['UserOpenchannelQueue'][_0x0d68('0x47')](_0x557858);}})['then'](function(_0x576841){if(_0x576841){return db['User'][_0x0d68('0x5e')]({'where':{'id':_[_0x0d68('0x31')](_0x576841,_0x0d68('0x5f')),'role':_0x0d68('0x60')},'attributes':['id','name',_0x0d68('0x61'),_0x0d68('0x62'),_0x0d68('0x63')]});}})[_0x0d68('0x29')](function(_0x469591){if(_0x469591){return{'count':_0x469591[_0x0d68('0x23')],'rows':_[_0x0d68('0x31')](_0x469591['rows'],function(_0x17debc){return{'membername':_0x17debc[_0x0d68('0x2f')],'UserId':_0x17debc['id'],'queue_name':_0x30ab71['name'],'OpenchannelQueueId':_0x30ab71['id'],'interface':util[_0x0d68('0x64')](_0x0d68('0x65'),_0x0d68('0x66'),_0x17debc[_0x0d68('0x2f')]),'penalty':0x0,'paused':_0x17debc[_0x0d68('0x61')],'createdAt':_0x17debc[_0x0d68('0x63')],'updatedAt':_0x17debc[_0x0d68('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d68('0x29')](respondWithFilteredResult(_0x207035,_0x557858))[_0x0d68('0x48')](handleError(_0x207035,null));};exports[_0x0d68('0x67')]=function(_0x37079f,_0x308c72,_0x927257){var _0x3058ac={};var _0x468cca={};var _0x3e4b12;var _0x105127;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x37079f[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x308c72,null))[_0x0d68('0x29')](function(_0x3a5367){if(_0x3a5367){_0x3e4b12=_0x3a5367;_0x468cca[_0x0d68('0x3c')]=_['keys'](db['Team'][_0x0d68('0x33')]);_0x468cca[_0x0d68('0x37')]=_['keys'](_0x37079f[_0x0d68('0x37')]);_0x468cca[_0x0d68('0x39')]=_[_0x0d68('0x3a')](_0x468cca[_0x0d68('0x3c')],_0x468cca['query']);_0x3058ac[_0x0d68('0x3b')]=_['intersection'](_0x468cca[_0x0d68('0x3c')],qs['fields'](_0x37079f[_0x0d68('0x37')][_0x0d68('0x3d')]));_0x3058ac['attributes']=_0x3058ac[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x3058ac[_0x0d68('0x3b')]:_0x468cca[_0x0d68('0x3c')];_0x3058ac['order']=qs[_0x0d68('0x5c')](_0x37079f['query'][_0x0d68('0x5c')]);_0x3058ac[_0x0d68('0x45')]=qs[_0x0d68('0x39')](_['pick'](_0x37079f[_0x0d68('0x37')],_0x468cca[_0x0d68('0x39')]));if(_0x37079f[_0x0d68('0x37')][_0x0d68('0x43')]){_0x3058ac['where']=_[_0x0d68('0x44')](_0x3058ac[_0x0d68('0x45')],{'$or':_[_0x0d68('0x31')](_0x3058ac[_0x0d68('0x3b')],function(_0x25c19d){var _0x4585de={};_0x4585de[_0x25c19d]={'$like':'%'+_0x37079f[_0x0d68('0x37')][_0x0d68('0x43')]+'%'};return _0x4585de;})});}_0x3058ac=_['merge']({},_0x3058ac,_0x37079f[_0x0d68('0x46')]);return _0x3e4b12[_0x0d68('0x67')](_0x3058ac);}})['then'](function(_0x5bc923){if(_0x5bc923){_0x105127=_0x5bc923['length'];if(!_0x37079f[_0x0d68('0x37')][_0x0d68('0x3f')](_0x0d68('0x40'))){_0x3058ac[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x37079f[_0x0d68('0x37')]['limit']);_0x3058ac['offset']=qs[_0x0d68('0x21')](_0x37079f[_0x0d68('0x37')][_0x0d68('0x21')]);}return _0x3e4b12[_0x0d68('0x67')](_0x3058ac);}})[_0x0d68('0x29')](function(_0x2f9cea){if(_0x2f9cea){return _0x2f9cea?{'count':_0x105127,'rows':_0x2f9cea}:null;}})['then'](respondWithResult(_0x308c72,null))[_0x0d68('0x48')](handleError(_0x308c72,null));};exports[_0x0d68('0x68')]=function(_0x26e0e3,_0x5bfb1e,_0x5ad85a){var _0x36905a=_0x26e0e3['body'][_0x0d68('0x69')];return db[_0x0d68('0x6a')][_0x0d68('0x47')]({'where':{'id':_0x36905a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0d68('0x6b'),'attributes':['id','name',_0x0d68('0x6c'),_0x0d68('0x6d'),_0x0d68('0x6e')],'raw':!![]}]})[_0x0d68('0x29')](function(_0x313a28){if(_0x313a28){var _0x2dfbed=_[_0x0d68('0x6f')](_0x313a28,function(_0x10f1f7){var _0x48f5b5=_0x10f1f7['get']({'plain':!![]});return _0x48f5b5[_0x0d68('0x6b')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x26e0e3[_0x0d68('0x4a')]['id']}})['then'](function(_0xa172ad){return db['sequelize'][_0x0d68('0x70')](function(_0x2e00b1){return _0xa172ad[_0x0d68('0x68')](_0x36905a,{'transaction':_0x2e00b1})[_0x0d68('0x29')](function(){return BPromise['each'](_0x2dfbed,function(_0x1d60a3){return db['UserOpenchannelQueue'][_0x0d68('0x71')]({'where':{'UserId':_0x1d60a3['id'],'OpenchannelQueueId':_0x26e0e3[_0x0d68('0x4a')]['id']},'transaction':_0x2e00b1});});})['then'](function(){_0x2dfbed[_0x0d68('0x72')](function(_0x4d61da){socket[_0x0d68('0x73')](_0x0d68('0x74'),{'UserId':_0x4d61da['id'],'OpenchannelQueueId':_0xa172ad['id']});});});});});}})[_0x0d68('0x29')](respondWithStatusCode(_0x5bfb1e,null))[_0x0d68('0x48')](handleError(_0x5bfb1e,null));};exports[_0x0d68('0x75')]=function(_0x396525,_0x1f8fbf,_0x43185d){return db['Team'][_0x0d68('0x47')]({'where':{'id':_0x396525[_0x0d68('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d68('0x76')],'as':_0x0d68('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x0d68('0x29')](handleEntityNotFound(_0x1f8fbf,null))[_0x0d68('0x29')](function(_0x145244){var _0x3def45=_[_0x0d68('0x31')](_0x145244,'id');var _0x262370=[];var _0x562768=[];var _0x2c7939=squel['select']();_0x2c7939[_0x0d68('0x77')]('tq.TeamId')[_0x0d68('0x78')]('team_has_openchannel_queues','tq')[_0x0d68('0x79')](_0x0d68('0x7a'),'ut',_0x0d68('0x7b'))[_0x0d68('0x45')](_0x0d68('0x7c'),_0x396525[_0x0d68('0x4a')]['id']);for(var _0x34a8e0=0x0;_0x34a8e0<_0x145244['length'];_0x34a8e0+=0x1){let _0x338d04=_0x145244[_0x34a8e0];for(var _0x544be5=0x0;_0x544be5<_0x338d04[_0x0d68('0x6b')][_0x0d68('0x3e')];_0x544be5+=0x1){let _0x5929a3=_0x338d04['Agents'][_0x544be5];var _0x33e813=_0x2c7939[_0x0d68('0x7d')]();_0x33e813[_0x0d68('0x45')]('ut.UserId\x20=\x20?',_0x5929a3['id']);_0x562768[_0x0d68('0x7e')](db[_0x0d68('0x7f')]['query'](_0x33e813['toString'](),{'type':db[_0x0d68('0x7f')]['QueryTypes'][_0x0d68('0x80')]})[_0x0d68('0x29')](function(_0x33858e){if(_0x33858e['length']===0x1){return _0x5929a3['id'];}else{var _0x45d695=_[_0x0d68('0x81')](_[_0x0d68('0x31')](_0x33858e,_0x0d68('0x82')),function(_0x47d090){return _[_0x0d68('0x83')](_0x3def45,_0x47d090);});if(_0x45d695){return _0x5929a3['id'];}}}));}}return BPromise[_0x0d68('0x84')](_0x562768)[_0x0d68('0x29')](function(_0x16e805){_0x262370=_(_0x262370)['union'](_0x16e805)[_0x0d68('0x85')]()[_0x0d68('0x86')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x396525[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](function(_0x3b1c6b){return db['sequelize']['transaction'](function(_0x419d91){return _0x3b1c6b[_0x0d68('0x75')](_0x396525[_0x0d68('0x37')][_0x0d68('0x69')],{'transaction':_0x419d91})[_0x0d68('0x29')](function(){if(!_['isEmpty'](_0x262370)){return _0x3b1c6b['removeAgents'](_0x262370,{'transaction':_0x419d91});}})[_0x0d68('0x29')](function(){_0x262370[_0x0d68('0x72')](function(_0x61d483){socket[_0x0d68('0x73')](_0x0d68('0x87'),{'UserId':_0x61d483,'OpenchannelQueueId':_0x3b1c6b['id']});});});});});});})['then'](respondWithStatusCode(_0x1f8fbf,null))['catch'](handleError(_0x1f8fbf,null));};exports[_0x0d68('0x88')]=function(_0x301f73,_0x50912d,_0x1d6683){return db[_0x0d68('0x32')]['find']({'where':{'id':_0x301f73[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x50912d,null))[_0x0d68('0x29')](function(_0x4db272){if(_0x4db272){return _0x4db272[_0x0d68('0x88')](_0x301f73[_0x0d68('0x4f')][_0x0d68('0x69')],_['omit'](_0x301f73[_0x0d68('0x4f')],['ids','id'])||{})[_0x0d68('0x89')](function(_0x305f16){for(var _0x1e672e=0x0;_0x1e672e<_0x301f73['body'][_0x0d68('0x69')][_0x0d68('0x3e')];_0x1e672e+=0x1){socket[_0x0d68('0x73')](_0x0d68('0x74'),{'UserId':Number(_0x301f73[_0x0d68('0x4f')][_0x0d68('0x69')][_0x1e672e]),'OpenchannelQueueId':Number(_0x301f73[_0x0d68('0x4a')]['id'])});}return _0x305f16;});}})['then'](respondWithResult(_0x50912d,null))[_0x0d68('0x48')](handleError(_0x50912d,null));};exports['removeAgents']=function(_0x14cfe9,_0x4dd326,_0x2fa2d4){return db[_0x0d68('0x32')]['find']({'where':{'id':_0x14cfe9[_0x0d68('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4dd326,null))[_0x0d68('0x29')](function(_0x525d95){if(_0x525d95){return _0x525d95['removeAgents'](_0x14cfe9[_0x0d68('0x37')]['ids'])[_0x0d68('0x29')](function(){if(_[_0x0d68('0x8a')](_0x14cfe9[_0x0d68('0x37')][_0x0d68('0x69')])){for(var _0x416c10=0x0;_0x416c10<_0x14cfe9[_0x0d68('0x37')]['ids'][_0x0d68('0x3e')];_0x416c10+=0x1){socket[_0x0d68('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0x14cfe9[_0x0d68('0x37')][_0x0d68('0x69')][_0x416c10]),'OpenchannelQueueId':Number(_0x14cfe9[_0x0d68('0x4a')]['id'])});}}else{socket[_0x0d68('0x73')](_0x0d68('0x87'),{'UserId':Number(_0x14cfe9[_0x0d68('0x37')][_0x0d68('0x69')]),'OpenchannelQueueId':Number(_0x14cfe9[_0x0d68('0x4a')]['id'])});}});}})[_0x0d68('0x29')](respondWithStatusCode(_0x4dd326,null))[_0x0d68('0x48')](handleError(_0x4dd326,null));};exports[_0x0d68('0x8b')]=function(_0x5809a0,_0x4c59e9,_0x54bca9){var _0x91144c={};var _0x42fec0={};var _0x4130fa;var _0x45e149;return db['OpenchannelQueue'][_0x0d68('0x59')]({'where':{'id':_0x5809a0[_0x0d68('0x4a')]['id']}})[_0x0d68('0x29')](handleEntityNotFound(_0x4c59e9,null))[_0x0d68('0x29')](function(_0x224590){if(_0x224590){_0x4130fa=_0x224590;_0x42fec0[_0x0d68('0x3c')]=_['keys'](db['User'][_0x0d68('0x33')]);_0x42fec0[_0x0d68('0x37')]=_[_0x0d68('0x38')](_0x5809a0[_0x0d68('0x37')]);_0x42fec0[_0x0d68('0x39')]=_[_0x0d68('0x3a')](_0x42fec0[_0x0d68('0x3c')],_0x42fec0[_0x0d68('0x37')]);_0x91144c[_0x0d68('0x3b')]=_['intersection'](_0x42fec0['model'],qs['fields'](_0x5809a0[_0x0d68('0x37')]['fields']));_0x91144c[_0x0d68('0x3b')]=_0x91144c[_0x0d68('0x3b')][_0x0d68('0x3e')]?_0x91144c['attributes']:_0x42fec0[_0x0d68('0x3c')];_0x91144c[_0x0d68('0x5b')]=qs[_0x0d68('0x5c')](_0x5809a0[_0x0d68('0x37')][_0x0d68('0x5c')]);_0x91144c[_0x0d68('0x45')]=qs['filters'](_[_0x0d68('0x42')](_0x5809a0['query'],_0x42fec0[_0x0d68('0x39')]));if(_0x5809a0['query'][_0x0d68('0x43')]){_0x91144c[_0x0d68('0x45')]=_[_0x0d68('0x44')](_0x91144c['where'],{'$or':_[_0x0d68('0x31')](_0x91144c['attributes'],function(_0x354048){var _0x2eede8={};_0x2eede8[_0x354048]={'$like':'%'+_0x5809a0[_0x0d68('0x37')][_0x0d68('0x43')]+'%'};return _0x2eede8;})});}_0x91144c=_[_0x0d68('0x44')]({},_0x91144c,_0x5809a0[_0x0d68('0x46')]);return _0x4130fa['getAgents'](_0x91144c);}})[_0x0d68('0x29')](function(_0x1aa3f7){if(_0x1aa3f7){_0x45e149=_0x1aa3f7[_0x0d68('0x3e')];if(!_0x5809a0[_0x0d68('0x37')]['hasOwnProperty'](_0x0d68('0x40'))){_0x91144c[_0x0d68('0x41')]=qs[_0x0d68('0x41')](_0x5809a0['query'][_0x0d68('0x41')]);_0x91144c['offset']=qs['offset'](_0x5809a0[_0x0d68('0x37')][_0x0d68('0x21')]);}return _0x4130fa['getAgents'](_0x91144c);}})[_0x0d68('0x29')](function(_0x5abb84){if(_0x5abb84){return _0x5abb84?{'count':_0x45e149,'rows':_0x5abb84}:null;}})['then'](respondWithResult(_0x4c59e9,null))[_0x0d68('0x48')](handleError(_0x4c59e9,null));}; \ No newline at end of file +var _0x98f4=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','stack','name','send','index','map','OpenchannelQueue','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','rows','catch','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','findOne','params','UserOpenchannelQueue','sort','pick','User','UserId','agent','openchannelPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','rawAttributes','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','value','removeAgents','userOpenchannelQueue:remove','addAgents','ids','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x154a86,_0x4f08d3){var _0x4cb64e=function(_0x1032c2){while(--_0x1032c2){_0x154a86['push'](_0x154a86['shift']());}};_0x4cb64e(++_0x4f08d3);}(_0x98f4,0xf9));var _0x498f=function(_0x317d4e,_0x3de942){_0x317d4e=_0x317d4e-0x0;var _0x56ce3d=_0x98f4[_0x317d4e];return _0x56ce3d;};'use strict';var emlformat=require(_0x498f('0x0'));var rimraf=require(_0x498f('0x1'));var zipdir=require(_0x498f('0x2'));var jsonpatch=require(_0x498f('0x3'));var rp=require(_0x498f('0x4'));var moment=require(_0x498f('0x5'));var BPromise=require(_0x498f('0x6'));var Mustache=require(_0x498f('0x7'));var util=require(_0x498f('0x8'));var path=require(_0x498f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x498f('0xa'));var _=require(_0x498f('0xb'));var squel=require(_0x498f('0xc'));var crypto=require(_0x498f('0xd'));var jsforce=require(_0x498f('0xe'));var deskjs=require(_0x498f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x498f('0x10'));var Redis=require(_0x498f('0x11'));var authService=require(_0x498f('0x12'));var qs=require(_0x498f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x498f('0x14'));var logger=require('../../config/logger')(_0x498f('0x15'));var utils=require(_0x498f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x498f('0x17'));var db=require(_0x498f('0x18'))['db'];config[_0x498f('0x19')]=_[_0x498f('0x1a')](config[_0x498f('0x19')],{'host':_0x498f('0x1b'),'port':0x18eb});var socket=require(_0x498f('0x1c'))(new Redis(config[_0x498f('0x19')]));require(_0x498f('0x1d'))[_0x498f('0x1e')](socket);function respondWithStatusCode(_0x1eac11,_0x14914c){_0x14914c=_0x14914c||0xcc;return function(_0x5331bc){if(_0x5331bc){return _0x1eac11['sendStatus'](_0x14914c);}return _0x1eac11[_0x498f('0x1f')](_0x14914c)[_0x498f('0x20')]();};}function respondWithResult(_0x132bae,_0x52319d){_0x52319d=_0x52319d||0xc8;return function(_0x316ce2){if(_0x316ce2){return _0x132bae[_0x498f('0x1f')](_0x52319d)['json'](_0x316ce2);}};}function respondWithFilteredResult(_0x29ac61,_0x4cc065){return function(_0x5b448f){if(_0x5b448f){var _0x5b751b=typeof _0x4cc065[_0x498f('0x21')]===_0x498f('0x22')&&typeof _0x4cc065[_0x498f('0x23')]===_0x498f('0x22');var _0x441af7=_0x5b448f[_0x498f('0x24')];var _0x1f7b77=_0x5b751b?0x0:_0x4cc065[_0x498f('0x21')];var _0x5b506c=_0x5b751b?_0x5b448f[_0x498f('0x24')]:_0x4cc065[_0x498f('0x21')]+_0x4cc065[_0x498f('0x23')];var _0x16acaa;if(_0x5b506c>=_0x441af7){_0x5b506c=_0x441af7;_0x16acaa=0xc8;}else{_0x16acaa=0xce;}_0x29ac61['status'](_0x16acaa);return _0x29ac61[_0x498f('0x25')](_0x498f('0x26'),_0x1f7b77+'-'+_0x5b506c+'/'+_0x441af7)['json'](_0x5b448f);}return null;};}function patchUpdates(_0x205389){return function(_0x50563f){try{jsonpatch[_0x498f('0x27')](_0x50563f,_0x205389,!![]);}catch(_0x11ef39){return BPromise['reject'](_0x11ef39);}return _0x50563f['save']();};}function saveUpdates(_0x5d2aa0,_0x14dcdc){return function(_0x9a968f){if(_0x9a968f){return _0x9a968f['update'](_0x5d2aa0)[_0x498f('0x28')](function(_0x47ec7c){return _0x47ec7c;});}return null;};}function removeEntity(_0x11053c,_0x133bd7){return function(_0x4b25b5){if(_0x4b25b5){return _0x4b25b5[_0x498f('0x29')]()['then'](function(){var _0x48da87=_0x4b25b5[_0x498f('0x2a')]({'plain':!![]});var _0x22efa5='OpenchannelQueues';return db['UserProfileResource'][_0x498f('0x29')]({'where':{'type':_0x22efa5,'resourceId':_0x48da87['id']}})['then'](function(){return _0x4b25b5;});})[_0x498f('0x28')](function(){_0x11053c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x114637,_0x561b28){return function(_0x950dd5){if(!_0x950dd5){_0x114637['sendStatus'](0x194);}return _0x950dd5;};}function handleError(_0x21f789,_0xfc1931){_0xfc1931=_0xfc1931||0x1f4;return function(_0x2caaee){logger['error'](_0x2caaee[_0x498f('0x2b')]);if(_0x2caaee[_0x498f('0x2c')]){delete _0x2caaee[_0x498f('0x2c')];}_0x21f789[_0x498f('0x1f')](_0xfc1931)[_0x498f('0x2d')](_0x2caaee);};}exports[_0x498f('0x2e')]=function(_0x10b2d0,_0x4f5326){var _0xf44af3={},_0x27f950={},_0x4ce18f={'count':0x0,'rows':[]};var _0x28d2ed=_[_0x498f('0x2f')](db[_0x498f('0x30')]['rawAttributes'],function(_0x347e92){return{'name':_0x347e92[_0x498f('0x31')],'type':_0x347e92[_0x498f('0x32')]['key']};});_0x27f950[_0x498f('0x33')]=_[_0x498f('0x2f')](_0x28d2ed,_0x498f('0x2c'));_0x27f950[_0x498f('0x34')]=_[_0x498f('0x35')](_0x10b2d0[_0x498f('0x34')]);_0x27f950[_0x498f('0x36')]=_['intersection'](_0x27f950['model'],_0x27f950['query']);_0xf44af3[_0x498f('0x37')]=_[_0x498f('0x38')](_0x27f950[_0x498f('0x33')],qs[_0x498f('0x39')](_0x10b2d0[_0x498f('0x34')][_0x498f('0x39')]));_0xf44af3[_0x498f('0x37')]=_0xf44af3['attributes'][_0x498f('0x3a')]?_0xf44af3[_0x498f('0x37')]:_0x27f950[_0x498f('0x33')];if(!_0x10b2d0[_0x498f('0x34')][_0x498f('0x3b')](_0x498f('0x3c'))){_0xf44af3[_0x498f('0x23')]=qs[_0x498f('0x23')](_0x10b2d0[_0x498f('0x34')]['limit']);_0xf44af3[_0x498f('0x21')]=qs[_0x498f('0x21')](_0x10b2d0[_0x498f('0x34')]['offset']);}_0xf44af3[_0x498f('0x3d')]=qs['sort'](_0x10b2d0[_0x498f('0x34')]['sort']);_0xf44af3[_0x498f('0x3e')]=qs['filters'](_['pick'](_0x10b2d0[_0x498f('0x34')],_0x27f950[_0x498f('0x36')]),_0x28d2ed);if(_0x10b2d0[_0x498f('0x34')]['filter']){_0xf44af3[_0x498f('0x3e')]=_['merge'](_0xf44af3['where'],{'$or':_[_0x498f('0x2f')](_0x28d2ed,function(_0x4dee4a){if(_0x4dee4a['type']!=='VIRTUAL'){var _0x409dc5={};_0x409dc5[_0x4dee4a[_0x498f('0x2c')]]={'$like':'%'+_0x10b2d0[_0x498f('0x34')][_0x498f('0x3f')]+'%'};return _0x409dc5;}})});}_0xf44af3=_[_0x498f('0x40')]({},_0xf44af3,_0x10b2d0['options']);var _0x43f1fa={'where':_0xf44af3[_0x498f('0x3e')]};return db['OpenchannelQueue']['count'](_0x43f1fa)[_0x498f('0x28')](function(_0x4b396b){_0x4ce18f[_0x498f('0x24')]=_0x4b396b;if(_0x10b2d0['query'][_0x498f('0x41')]){_0xf44af3['include']=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0xf44af3);})[_0x498f('0x28')](function(_0xde07){_0x4ce18f[_0x498f('0x42')]=_0xde07;return _0x4ce18f;})[_0x498f('0x28')](respondWithFilteredResult(_0x4f5326,_0xf44af3))[_0x498f('0x43')](handleError(_0x4f5326,null));};exports['show']=function(_0x41c92e,_0x40166d){var _0x9b32f6={'raw':!![],'where':{'id':_0x41c92e['params']['id']}},_0xa5bc8b={};_0xa5bc8b[_0x498f('0x33')]=_[_0x498f('0x35')](db['OpenchannelQueue']['rawAttributes']);_0xa5bc8b[_0x498f('0x34')]=_[_0x498f('0x35')](_0x41c92e[_0x498f('0x34')]);_0xa5bc8b['filters']=_[_0x498f('0x38')](_0xa5bc8b[_0x498f('0x33')],_0xa5bc8b['query']);_0x9b32f6[_0x498f('0x37')]=_['intersection'](_0xa5bc8b[_0x498f('0x33')],qs[_0x498f('0x39')](_0x41c92e['query'][_0x498f('0x39')]));_0x9b32f6[_0x498f('0x37')]=_0x9b32f6[_0x498f('0x37')]['length']?_0x9b32f6[_0x498f('0x37')]:_0xa5bc8b[_0x498f('0x33')];if(_0x41c92e[_0x498f('0x34')][_0x498f('0x41')]){_0x9b32f6[_0x498f('0x44')]=[{'all':!![]}];}_0x9b32f6=_[_0x498f('0x40')]({},_0x9b32f6,_0x41c92e[_0x498f('0x45')]);return db[_0x498f('0x30')]['find'](_0x9b32f6)['then'](handleEntityNotFound(_0x40166d,null))[_0x498f('0x28')](respondWithResult(_0x40166d,null))[_0x498f('0x43')](handleError(_0x40166d,null));};exports['create']=function(_0x5a7848,_0x24691b){return db[_0x498f('0x30')][_0x498f('0x46')](_0x5a7848[_0x498f('0x47')],{})[_0x498f('0x28')](function(_0x543043){var _0x4e99a5=_0x5a7848[_0x498f('0x48')][_0x498f('0x2a')]({'plain':!![]});if(!_0x4e99a5)throw new Error(_0x498f('0x49'));if(_0x4e99a5[_0x498f('0x4a')]===_0x498f('0x48')){var _0x1d940a=_0x543043[_0x498f('0x2a')]({'plain':!![]});var _0x261632=_0x498f('0x4b');return db[_0x498f('0x4c')][_0x498f('0x4d')]({'where':{'name':_0x261632,'userProfileId':_0x4e99a5[_0x498f('0x4e')]},'raw':!![]})[_0x498f('0x28')](function(_0x3d859d){if(_0x3d859d&&_0x3d859d['autoAssociation']===0x0){return db['UserProfileResource'][_0x498f('0x46')]({'name':_0x1d940a['name'],'resourceId':_0x1d940a['id'],'type':_0x3d859d[_0x498f('0x2c')],'sectionId':_0x3d859d['id']},{})[_0x498f('0x28')](function(){return _0x543043;});}else{return _0x543043;}})[_0x498f('0x43')](function(_0x39ac86){logger[_0x498f('0x4f')](_0x498f('0x50'),_0x39ac86);throw _0x39ac86;});}return _0x543043;})[_0x498f('0x28')](respondWithResult(_0x24691b,0xc9))[_0x498f('0x43')](handleError(_0x24691b,null));};exports[_0x498f('0x51')]=function(_0xea8d8c,_0x1934db){if(_0xea8d8c['body']['id']){delete _0xea8d8c[_0x498f('0x47')]['id'];}return db[_0x498f('0x30')][_0x498f('0x4d')]({'where':{'id':_0xea8d8c['params']['id']}})[_0x498f('0x28')](handleEntityNotFound(_0x1934db,null))['then'](saveUpdates(_0xea8d8c['body'],null))[_0x498f('0x28')](respondWithResult(_0x1934db,null))[_0x498f('0x43')](handleError(_0x1934db,null));};exports['destroy']=function(_0x1fae7e,_0x3a23af){return db[_0x498f('0x30')][_0x498f('0x4d')]({'where':{'id':_0x1fae7e['params']['id']}})[_0x498f('0x28')](handleEntityNotFound(_0x3a23af,null))['then'](removeEntity(_0x3a23af,null))[_0x498f('0x43')](handleError(_0x3a23af,null));};exports['describe']=function(_0x196b8c,_0x1b228e){return db['OpenchannelQueue']['describe']()[_0x498f('0x28')](respondWithResult(_0x1b228e,null))[_0x498f('0x43')](handleError(_0x1b228e,null));};exports[_0x498f('0x52')]=function(_0x6e92a4,_0xbe35ed,_0x3b6360){var _0x2edb42={'raw':!![],'where':{}},_0xa6e368={},_0x5ee6b2;return db[_0x498f('0x30')][_0x498f('0x53')]({'where':{'id':_0x6e92a4[_0x498f('0x54')]['id']}})['then'](handleEntityNotFound(_0xbe35ed,null))['then'](function(_0x5cd90f){if(_0x5cd90f){_0x5ee6b2=_0x5cd90f[_0x498f('0x2a')]({'plain':!![]});_0xa6e368[_0x498f('0x33')]=_[_0x498f('0x35')](db[_0x498f('0x55')]['rawAttributes']);_0xa6e368[_0x498f('0x34')]=_['keys'](_0x6e92a4[_0x498f('0x34')]);_0xa6e368[_0x498f('0x36')]=_[_0x498f('0x38')](_0xa6e368[_0x498f('0x33')],_0xa6e368[_0x498f('0x34')]);_0x2edb42[_0x498f('0x37')]=_[_0x498f('0x38')](_0xa6e368[_0x498f('0x33')],qs[_0x498f('0x39')](_0x6e92a4[_0x498f('0x34')]['fields']));_0x2edb42[_0x498f('0x37')]=_0x2edb42[_0x498f('0x37')][_0x498f('0x3a')]?_0x2edb42[_0x498f('0x37')]:_0xa6e368['model'];if(!_0x6e92a4[_0x498f('0x34')]['hasOwnProperty'](_0x498f('0x3c'))){_0x2edb42[_0x498f('0x23')]=qs['limit'](_0x6e92a4['query']['limit']);_0x2edb42[_0x498f('0x21')]=qs[_0x498f('0x21')](_0x6e92a4[_0x498f('0x34')][_0x498f('0x21')]);}_0x2edb42['order']=qs[_0x498f('0x56')](_0x6e92a4[_0x498f('0x34')]['sort']);_0x2edb42['where']=qs[_0x498f('0x36')](_[_0x498f('0x57')](_0x6e92a4[_0x498f('0x34')],_0xa6e368['filters']));_0x2edb42[_0x498f('0x3e')]['OpenchannelQueueId']=_0x5cd90f['id'];if(_0x6e92a4[_0x498f('0x34')]['filter']){_0x2edb42['where']=_['merge'](_0x2edb42[_0x498f('0x3e')],{'$or':_[_0x498f('0x2f')](_0x2edb42[_0x498f('0x37')],function(_0x3c3c29){var _0x55bb3d={};_0x55bb3d[_0x3c3c29]={'$like':'%'+_0x6e92a4[_0x498f('0x34')]['filter']+'%'};return _0x55bb3d;})});}_0x2edb42=_[_0x498f('0x40')]({},_0x2edb42,_0x6e92a4[_0x498f('0x45')]);return db['UserOpenchannelQueue']['findAll'](_0x2edb42);}})[_0x498f('0x28')](function(_0x26ca59){if(_0x26ca59){return db[_0x498f('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x26ca59,_0x498f('0x59')),'role':_0x498f('0x5a')},'attributes':['id','name',_0x498f('0x5b'),_0x498f('0x5c'),'createdAt']});}})[_0x498f('0x28')](function(_0xa12107){if(_0xa12107){return{'count':_0xa12107[_0x498f('0x24')],'rows':_[_0x498f('0x2f')](_0xa12107[_0x498f('0x42')],function(_0x53a7ee){return{'membername':_0x53a7ee[_0x498f('0x2c')],'UserId':_0x53a7ee['id'],'queue_name':_0x5ee6b2[_0x498f('0x2c')],'OpenchannelQueueId':_0x5ee6b2['id'],'interface':util['format'](_0x498f('0x5d'),_0x498f('0x5e'),_0x53a7ee['name']),'penalty':0x0,'paused':_0x53a7ee[_0x498f('0x5b')],'createdAt':_0x53a7ee[_0x498f('0x5f')],'updatedAt':_0x53a7ee['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x498f('0x28')](respondWithFilteredResult(_0xbe35ed,_0x2edb42))['catch'](handleError(_0xbe35ed,null));};exports[_0x498f('0x60')]=function(_0x4064a7,_0x45dc88,_0x3d8405){var _0x1582ee={};var _0x4a0c9c={};var _0x5f0a18;var _0x188519;return db[_0x498f('0x30')][_0x498f('0x53')]({'where':{'id':_0x4064a7['params']['id']}})[_0x498f('0x28')](handleEntityNotFound(_0x45dc88,null))[_0x498f('0x28')](function(_0x1e640a){if(_0x1e640a){_0x5f0a18=_0x1e640a;_0x4a0c9c[_0x498f('0x33')]=_[_0x498f('0x35')](db[_0x498f('0x61')][_0x498f('0x62')]);_0x4a0c9c['query']=_[_0x498f('0x35')](_0x4064a7[_0x498f('0x34')]);_0x4a0c9c[_0x498f('0x36')]=_[_0x498f('0x38')](_0x4a0c9c[_0x498f('0x33')],_0x4a0c9c[_0x498f('0x34')]);_0x1582ee[_0x498f('0x37')]=_[_0x498f('0x38')](_0x4a0c9c[_0x498f('0x33')],qs[_0x498f('0x39')](_0x4064a7[_0x498f('0x34')][_0x498f('0x39')]));_0x1582ee[_0x498f('0x37')]=_0x1582ee['attributes']['length']?_0x1582ee[_0x498f('0x37')]:_0x4a0c9c[_0x498f('0x33')];_0x1582ee[_0x498f('0x3d')]=qs[_0x498f('0x56')](_0x4064a7[_0x498f('0x34')]['sort']);_0x1582ee['where']=qs[_0x498f('0x36')](_[_0x498f('0x57')](_0x4064a7[_0x498f('0x34')],_0x4a0c9c[_0x498f('0x36')]));if(_0x4064a7['query'][_0x498f('0x3f')]){_0x1582ee[_0x498f('0x3e')]=_[_0x498f('0x40')](_0x1582ee[_0x498f('0x3e')],{'$or':_['map'](_0x1582ee[_0x498f('0x37')],function(_0x214f86){var _0xd26a76={};_0xd26a76[_0x214f86]={'$like':'%'+_0x4064a7[_0x498f('0x34')][_0x498f('0x3f')]+'%'};return _0xd26a76;})});}_0x1582ee=_[_0x498f('0x40')]({},_0x1582ee,_0x4064a7[_0x498f('0x45')]);return _0x5f0a18['getTeams'](_0x1582ee);}})['then'](function(_0x4fd8ae){if(_0x4fd8ae){_0x188519=_0x4fd8ae[_0x498f('0x3a')];if(!_0x4064a7[_0x498f('0x34')][_0x498f('0x3b')]('nolimit')){_0x1582ee[_0x498f('0x23')]=qs[_0x498f('0x23')](_0x4064a7[_0x498f('0x34')]['limit']);_0x1582ee[_0x498f('0x21')]=qs[_0x498f('0x21')](_0x4064a7[_0x498f('0x34')]['offset']);}return _0x5f0a18[_0x498f('0x60')](_0x1582ee);}})[_0x498f('0x28')](function(_0x4ca6d2){if(_0x4ca6d2){return _0x4ca6d2?{'count':_0x188519,'rows':_0x4ca6d2}:null;}})[_0x498f('0x28')](respondWithResult(_0x45dc88,null))['catch'](handleError(_0x45dc88,null));};exports[_0x498f('0x63')]=function(_0x1c78d5,_0x348adf,_0x57e4ae){var _0x421aee=_0x1c78d5[_0x498f('0x47')]['ids'];return db['Team']['findAll']({'where':{'id':_0x421aee},'attributes':['id'],'include':[{'model':db[_0x498f('0x58')],'as':_0x498f('0x64'),'attributes':['id',_0x498f('0x2c'),_0x498f('0x65'),_0x498f('0x66'),_0x498f('0x67')],'raw':!![]}]})[_0x498f('0x28')](function(_0x24098d){if(_0x24098d){var _0x3bab7b=_['flatMap'](_0x24098d,function(_0x5cdbaf){var _0xcf0f14=_0x5cdbaf[_0x498f('0x2a')]({'plain':!![]});return _0xcf0f14[_0x498f('0x64')];});return db['OpenchannelQueue'][_0x498f('0x4d')]({'where':{'id':_0x1c78d5['params']['id']}})[_0x498f('0x28')](function(_0x4a0b63){return db[_0x498f('0x68')]['transaction'](function(_0x446001){return _0x4a0b63[_0x498f('0x63')](_0x421aee,{'transaction':_0x446001})[_0x498f('0x28')](function(){return BPromise[_0x498f('0x69')](_0x3bab7b,function(_0x44f464){return db[_0x498f('0x55')][_0x498f('0x6a')]({'where':{'UserId':_0x44f464['id'],'OpenchannelQueueId':_0x1c78d5[_0x498f('0x54')]['id']},'transaction':_0x446001});});})[_0x498f('0x28')](function(){_0x3bab7b[_0x498f('0x6b')](function(_0x3fcd58){socket[_0x498f('0x6c')](_0x498f('0x6d'),{'UserId':_0x3fcd58['id'],'OpenchannelQueueId':_0x4a0b63['id']});});});});});}})['then'](respondWithStatusCode(_0x348adf,null))[_0x498f('0x43')](handleError(_0x348adf,null));};exports[_0x498f('0x6e')]=function(_0x508a9c,_0x55909d,_0x3090ac){return db['Team'][_0x498f('0x6f')]({'where':{'id':_0x508a9c[_0x498f('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x498f('0x58')],'as':_0x498f('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x55909d,null))[_0x498f('0x28')](function(_0x5bf338){var _0x229e5e=_[_0x498f('0x2f')](_0x5bf338,'id');var _0xc16891=[];var _0x1750a0=[];var _0x593ab6=squel[_0x498f('0x70')]();_0x593ab6[_0x498f('0x71')](_0x498f('0x72'))[_0x498f('0x73')](_0x498f('0x74'),'tq')[_0x498f('0x75')](_0x498f('0x76'),'ut',_0x498f('0x77'))[_0x498f('0x3e')](_0x498f('0x78'),_0x508a9c[_0x498f('0x54')]['id']);for(var _0x293a7a=0x0;_0x293a7a<_0x5bf338['length'];_0x293a7a+=0x1){let _0x343e50=_0x5bf338[_0x293a7a];for(var _0x3b9e94=0x0;_0x3b9e94<_0x343e50['Agents']['length'];_0x3b9e94+=0x1){let _0xdc5a29=_0x343e50['Agents'][_0x3b9e94];var _0x410b14=_0x593ab6[_0x498f('0x79')]();_0x410b14[_0x498f('0x3e')](_0x498f('0x7a'),_0xdc5a29['id']);_0x1750a0['push'](db[_0x498f('0x68')]['query'](_0x410b14[_0x498f('0x7b')](),{'type':db[_0x498f('0x68')]['QueryTypes'][_0x498f('0x7c')]})[_0x498f('0x28')](function(_0x3bd9c4){if(_0x3bd9c4['length']===0x1){return _0xdc5a29['id'];}else{var _0x4a29da=_['every'](_[_0x498f('0x2f')](_0x3bd9c4,_0x498f('0x7d')),function(_0x41c9b6){return _[_0x498f('0x7e')](_0x229e5e,_0x41c9b6);});if(_0x4a29da){return _0xdc5a29['id'];}}}));}}return BPromise[_0x498f('0x7f')](_0x1750a0)['then'](function(_0x48c219){_0xc16891=_(_0xc16891)['union'](_0x48c219)['compact']()[_0x498f('0x80')]();return db['OpenchannelQueue'][_0x498f('0x4d')]({'where':{'id':_0x508a9c['params']['id']}})['then'](function(_0x5c75f){return db[_0x498f('0x68')]['transaction'](function(_0x106925){return _0x5c75f['removeTeams'](_0x508a9c[_0x498f('0x34')]['ids'],{'transaction':_0x106925})[_0x498f('0x28')](function(){if(!_['isEmpty'](_0xc16891)){return _0x5c75f[_0x498f('0x81')](_0xc16891,{'transaction':_0x106925});}})[_0x498f('0x28')](function(){_0xc16891[_0x498f('0x6b')](function(_0x27fdd2){socket['emit'](_0x498f('0x82'),{'UserId':_0x27fdd2,'OpenchannelQueueId':_0x5c75f['id']});});});});});});})['then'](respondWithStatusCode(_0x55909d,null))['catch'](handleError(_0x55909d,null));};exports[_0x498f('0x83')]=function(_0x55c45e,_0x5db2bc,_0x526d14){return db[_0x498f('0x30')][_0x498f('0x4d')]({'where':{'id':_0x55c45e[_0x498f('0x54')]['id']}})['then'](handleEntityNotFound(_0x5db2bc,null))[_0x498f('0x28')](function(_0x1c5f15){if(_0x1c5f15){return _0x1c5f15['addAgents'](_0x55c45e[_0x498f('0x47')][_0x498f('0x84')],_[_0x498f('0x85')](_0x55c45e[_0x498f('0x47')],[_0x498f('0x84'),'id'])||{})['spread'](function(_0x59bc12){for(var _0x41ca1f=0x0;_0x41ca1f<_0x55c45e[_0x498f('0x47')]['ids']['length'];_0x41ca1f+=0x1){socket[_0x498f('0x6c')](_0x498f('0x6d'),{'UserId':Number(_0x55c45e[_0x498f('0x47')][_0x498f('0x84')][_0x41ca1f]),'OpenchannelQueueId':Number(_0x55c45e[_0x498f('0x54')]['id'])});}return _0x59bc12;});}})['then'](respondWithResult(_0x5db2bc,null))[_0x498f('0x43')](handleError(_0x5db2bc,null));};exports['removeAgents']=function(_0x5bedfc,_0x5b3373,_0x54266c){return db[_0x498f('0x30')][_0x498f('0x4d')]({'where':{'id':_0x5bedfc[_0x498f('0x54')]['id']}})['then'](handleEntityNotFound(_0x5b3373,null))[_0x498f('0x28')](function(_0x2f6be1){if(_0x2f6be1){return _0x2f6be1[_0x498f('0x81')](_0x5bedfc['query'][_0x498f('0x84')])[_0x498f('0x28')](function(){if(_[_0x498f('0x86')](_0x5bedfc['query'][_0x498f('0x84')])){for(var _0x15d4fe=0x0;_0x15d4fe<_0x5bedfc[_0x498f('0x34')][_0x498f('0x84')][_0x498f('0x3a')];_0x15d4fe+=0x1){socket[_0x498f('0x6c')](_0x498f('0x82'),{'UserId':Number(_0x5bedfc['query'][_0x498f('0x84')][_0x15d4fe]),'OpenchannelQueueId':Number(_0x5bedfc['params']['id'])});}}else{socket[_0x498f('0x6c')](_0x498f('0x82'),{'UserId':Number(_0x5bedfc[_0x498f('0x34')][_0x498f('0x84')]),'OpenchannelQueueId':Number(_0x5bedfc[_0x498f('0x54')]['id'])});}});}})[_0x498f('0x28')](respondWithStatusCode(_0x5b3373,null))[_0x498f('0x43')](handleError(_0x5b3373,null));};exports[_0x498f('0x87')]=function(_0x28581d,_0x178da7,_0x5dbca4){var _0x2888f5={};var _0x2a8b5c={};var _0x420fa3;var _0x25e0f0;return db[_0x498f('0x30')][_0x498f('0x53')]({'where':{'id':_0x28581d[_0x498f('0x54')]['id']}})[_0x498f('0x28')](handleEntityNotFound(_0x178da7,null))[_0x498f('0x28')](function(_0x18db14){if(_0x18db14){_0x420fa3=_0x18db14;_0x2a8b5c[_0x498f('0x33')]=_[_0x498f('0x35')](db['User'][_0x498f('0x62')]);_0x2a8b5c[_0x498f('0x34')]=_[_0x498f('0x35')](_0x28581d[_0x498f('0x34')]);_0x2a8b5c[_0x498f('0x36')]=_[_0x498f('0x38')](_0x2a8b5c[_0x498f('0x33')],_0x2a8b5c['query']);_0x2888f5[_0x498f('0x37')]=_[_0x498f('0x38')](_0x2a8b5c[_0x498f('0x33')],qs[_0x498f('0x39')](_0x28581d[_0x498f('0x34')][_0x498f('0x39')]));_0x2888f5[_0x498f('0x37')]=_0x2888f5['attributes'][_0x498f('0x3a')]?_0x2888f5[_0x498f('0x37')]:_0x2a8b5c['model'];_0x2888f5[_0x498f('0x3d')]=qs['sort'](_0x28581d['query']['sort']);_0x2888f5[_0x498f('0x3e')]=qs[_0x498f('0x36')](_['pick'](_0x28581d[_0x498f('0x34')],_0x2a8b5c[_0x498f('0x36')]));if(_0x28581d['query'][_0x498f('0x3f')]){_0x2888f5['where']=_[_0x498f('0x40')](_0x2888f5[_0x498f('0x3e')],{'$or':_[_0x498f('0x2f')](_0x2888f5[_0x498f('0x37')],function(_0x539fae){var _0x42fa9d={};_0x42fa9d[_0x539fae]={'$like':'%'+_0x28581d['query'][_0x498f('0x3f')]+'%'};return _0x42fa9d;})});}_0x2888f5=_[_0x498f('0x40')]({},_0x2888f5,_0x28581d['options']);return _0x420fa3['getAgents'](_0x2888f5);}})[_0x498f('0x28')](function(_0x18c1d2){if(_0x18c1d2){_0x25e0f0=_0x18c1d2[_0x498f('0x3a')];if(!_0x28581d[_0x498f('0x34')][_0x498f('0x3b')](_0x498f('0x3c'))){_0x2888f5[_0x498f('0x23')]=qs[_0x498f('0x23')](_0x28581d[_0x498f('0x34')][_0x498f('0x23')]);_0x2888f5[_0x498f('0x21')]=qs['offset'](_0x28581d[_0x498f('0x34')][_0x498f('0x21')]);}return _0x420fa3['getAgents'](_0x2888f5);}})[_0x498f('0x28')](function(_0x45b427){if(_0x45b427){return _0x45b427?{'count':_0x25e0f0,'rows':_0x45b427}:null;}})['then'](respondWithResult(_0x178da7,null))[_0x498f('0x43')](handleError(_0x178da7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2c7f8d5..2812b3e 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 _0xb145=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb145,0x1bb));var _0x5b14=function(_0x46d359,_0x4084aa){_0x46d359=_0x46d359-0x0;var _0x1ebaae=_0xb145[_0x46d359];return _0x1ebaae;};'use strict';var EventEmitter=require(_0x5b14('0x0'));var OpenchannelQueue=require(_0x5b14('0x1'))['db'][_0x5b14('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5b14('0x3')](0x0);var events={'afterCreate':_0x5b14('0x4'),'afterUpdate':_0x5b14('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50cfa5){return function(_0x194225,_0x4847ed,_0x34a289){OpenchannelQueueEvents[_0x5b14('0x6')](_0x50cfa5+':'+_0x194225['id'],_0x194225);OpenchannelQueueEvents['emit'](_0x50cfa5,_0x194225);_0x34a289(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5b14('0x8')](e,emitEvent(event));}}module[_0x5b14('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x06e1=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x30d7b5,_0x55ad20){var _0x45356d=function(_0x2252e0){while(--_0x2252e0){_0x30d7b5['push'](_0x30d7b5['shift']());}};_0x45356d(++_0x55ad20);}(_0x06e1,0xc2));var _0x106e=function(_0x2a16c4,_0x47dd61){_0x2a16c4=_0x2a16c4-0x0;var _0x2ce251=_0x06e1[_0x2a16c4];return _0x2ce251;};'use strict';var EventEmitter=require(_0x106e('0x0'));var OpenchannelQueue=require(_0x106e('0x1'))['db'][_0x106e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x106e('0x3')](0x0);var events={'afterCreate':_0x106e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x135b47){return function(_0x45cc23,_0x1d0c2e,_0x3e5df7){OpenchannelQueueEvents['emit'](_0x135b47+':'+_0x45cc23['id'],_0x45cc23);OpenchannelQueueEvents[_0x106e('0x5')](_0x135b47,_0x45cc23);_0x3e5df7(null);};}for(var e in events){if(events[_0x106e('0x6')](e)){var event=events[e];OpenchannelQueue[_0x106e('0x7')](e,emitEvent(event));}}module[_0x106e('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ba49c74..0440ca2 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 _0xb500=['moment','bluebird','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util'];(function(_0x486caf,_0x1084d8){var _0x22ab74=function(_0x2e137e){while(--_0x2e137e){_0x486caf['push'](_0x486caf['shift']());}};_0x22ab74(++_0x1084d8);}(_0xb500,0xb3));var _0x0b50=function(_0x96f878,_0x5685fa){_0x96f878=_0x96f878-0x0;var _0x4ea01b=_0xb500[_0x96f878];return _0x4ea01b;};'use strict';var _=require('lodash');var util=require(_0x0b50('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0b50('0x1'));var BPromise=require(_0x0b50('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b50('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b50('0x4'));module[_0x0b50('0x5')]=function(_0x447f56,_0x4c2d1b){return _0x447f56[_0x0b50('0x6')](_0x0b50('0x7'),attributes,{'tableName':_0x0b50('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ac7=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','openchannel_queues'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6ac7,0xe4));var _0x76ac=function(_0x279daa,_0x21eab9){_0x279daa=_0x279daa-0x0;var _0x52882b=_0x6ac7[_0x279daa];return _0x52882b;};'use strict';var _=require(_0x76ac('0x0'));var util=require(_0x76ac('0x1'));var logger=require('../../config/logger')(_0x76ac('0x2'));var moment=require(_0x76ac('0x3'));var BPromise=require(_0x76ac('0x4'));var rp=require(_0x76ac('0x5'));var fs=require('fs');var path=require(_0x76ac('0x6'));var rimraf=require(_0x76ac('0x7'));var config=require('../../config/environment');var attributes=require(_0x76ac('0x8'));module[_0x76ac('0x9')]=function(_0x692e45,_0x5e2faa){return _0x692e45[_0x76ac('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x76ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ec6aa9c..a816a1f 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 _0xe605=['findAll','options','raw','where','attributes','map','include','model','then','find','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x2e1ef2,_0xcc4033){var _0x1aa955=function(_0x1d74b6){while(--_0x1d74b6){_0x2e1ef2['push'](_0x2e1ef2['shift']());}};_0x1aa955(++_0xcc4033);}(_0xe605,0x163));var _0x5e60=function(_0x349918,_0x4314f6){_0x349918=_0x349918-0x0;var _0x41fa33=_0xe605[_0x349918];return _0x41fa33;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5e60('0xa')][_0x5e60('0xb')]({'port':0x232a});config[_0x5e60('0xc')]=_[_0x5e60('0xd')](config[_0x5e60('0xc')],{'host':_0x5e60('0xe'),'port':0x18eb});var socket=require(_0x5e60('0xf'))(new Redis(config[_0x5e60('0xc')]));require(_0x5e60('0x10'))[_0x5e60('0x11')](socket);function respondWithRpcPromise(_0x42f78a,_0x18a16c,_0x207d99){return new BPromise(function(_0x1f03f2,_0x4bafa9){return client[_0x5e60('0x12')](_0x42f78a,_0x207d99)['then'](function(_0x33f9ba){logger[_0x5e60('0x13')](_0x5e60('0x14'),_0x18a16c,_0x5e60('0x15'));logger[_0x5e60('0x16')](_0x5e60('0x17'),_0x18a16c,_0x5e60('0x15'),JSON[_0x5e60('0x18')](_0x33f9ba));if(_0x33f9ba[_0x5e60('0x19')]){if(_0x33f9ba['error'][_0x5e60('0x1a')]===0x1f4){logger[_0x5e60('0x19')](_0x5e60('0x14'),_0x18a16c,_0x33f9ba[_0x5e60('0x19')][_0x5e60('0x1b')]);return _0x4bafa9(_0x33f9ba[_0x5e60('0x19')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x18a16c,_0x33f9ba[_0x5e60('0x19')][_0x5e60('0x1b')]);return _0x1f03f2(_0x33f9ba['error'][_0x5e60('0x1b')]);}else{logger[_0x5e60('0x13')](_0x5e60('0x14'),_0x18a16c,_0x5e60('0x15'));_0x1f03f2(_0x33f9ba[_0x5e60('0x1c')][_0x5e60('0x1b')]);}})[_0x5e60('0x1d')](function(_0x9de9b2){logger[_0x5e60('0x19')](_0x5e60('0x14'),_0x18a16c,_0x9de9b2);_0x4bafa9(_0x9de9b2);});});}exports[_0x5e60('0x1e')]=function(_0x87246f){var _0x54bc17=this;return new Promise(function(_0x1331fe,_0x491ce3){return db[_0x5e60('0x1f')][_0x5e60('0x20')]({'raw':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')][_0x5e60('0x22')]===undefined?!![]:![]:!![],'where':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')][_0x5e60('0x23')]||null:null,'attributes':_0x87246f[_0x5e60('0x21')]?_0x87246f['options'][_0x5e60('0x24')]||null:null,'limit':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')]['limit']||null:null,'include':_0x87246f[_0x5e60('0x21')]?_0x87246f[_0x5e60('0x21')]['include']?_[_0x5e60('0x25')](_0x87246f[_0x5e60('0x21')][_0x5e60('0x26')],function(_0x603f89){return{'model':db[_0x603f89[_0x5e60('0x27')]],'as':_0x603f89['as'],'attributes':_0x603f89[_0x5e60('0x24')],'include':_0x603f89[_0x5e60('0x26')]?_[_0x5e60('0x25')](_0x603f89[_0x5e60('0x26')],function(_0x4575ce){return{'model':db[_0x4575ce['model']],'as':_0x4575ce['as'],'attributes':_0x4575ce[_0x5e60('0x24')],'include':_0x4575ce[_0x5e60('0x26')]?_['map'](_0x4575ce[_0x5e60('0x26')],function(_0x54ef05){return{'model':db[_0x54ef05[_0x5e60('0x27')]],'as':_0x54ef05['as'],'attributes':_0x54ef05[_0x5e60('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0x28')](function(_0x315650){logger['info'](_0x5e60('0x1e'),_0x87246f);logger[_0x5e60('0x16')]('GetOpenchannelQueue',_0x87246f,JSON[_0x5e60('0x18')](_0x315650));_0x1331fe(_0x315650);})[_0x5e60('0x1d')](function(_0x1c4553){logger[_0x5e60('0x19')](_0x5e60('0x1e'),_0x1c4553[_0x5e60('0x1b')],_0x87246f);_0x491ce3(_0x54bc17[_0x5e60('0x19')](0x1f4,_0x1c4553['message']));});});};exports['ShowOpenchannelQueue']=function(_0xc5554c){var _0x2243f6=this;return new Promise(function(_0x2b5852,_0x581d42){return db[_0x5e60('0x1f')][_0x5e60('0x29')]({'raw':_0xc5554c[_0x5e60('0x21')]?_0xc5554c['options'][_0x5e60('0x22')]===undefined?!![]:![]:!![],'where':_0xc5554c[_0x5e60('0x21')]?_0xc5554c['options'][_0x5e60('0x23')]||null:null,'attributes':_0xc5554c['options']?_0xc5554c[_0x5e60('0x21')]['attributes']||null:null,'include':_0xc5554c[_0x5e60('0x21')]?_0xc5554c[_0x5e60('0x21')]['include']?_[_0x5e60('0x25')](_0xc5554c[_0x5e60('0x21')][_0x5e60('0x26')],function(_0x5ab0ce){return{'model':db[_0x5ab0ce[_0x5e60('0x27')]],'as':_0x5ab0ce['as'],'attributes':_0x5ab0ce[_0x5e60('0x24')],'include':_0x5ab0ce['include']?_[_0x5e60('0x25')](_0x5ab0ce[_0x5e60('0x26')],function(_0x2e6a7c){return{'model':db[_0x2e6a7c[_0x5e60('0x27')]],'as':_0x2e6a7c['as'],'attributes':_0x2e6a7c[_0x5e60('0x24')],'include':_0x2e6a7c[_0x5e60('0x26')]?_[_0x5e60('0x25')](_0x2e6a7c['include'],function(_0x44be5e){return{'model':db[_0x44be5e[_0x5e60('0x27')]],'as':_0x44be5e['as'],'attributes':_0x44be5e[_0x5e60('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0x28')](function(_0x15fc38){logger[_0x5e60('0x13')](_0x5e60('0x2a'),_0xc5554c);logger[_0x5e60('0x16')](_0x5e60('0x2a'),_0xc5554c,JSON[_0x5e60('0x18')](_0x15fc38));_0x2b5852(_0x15fc38);})[_0x5e60('0x1d')](function(_0x38d80e){logger[_0x5e60('0x19')](_0x5e60('0x2a'),_0x38d80e[_0x5e60('0x1b')],_0xc5554c);_0x581d42(_0x2243f6[_0x5e60('0x19')](0x1f4,_0x38d80e[_0x5e60('0x1b')]));});});}; \ No newline at end of file +var _0xcdfe=['defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','OpenchannelQueue','find','ShowOpenchannelQueue','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x14cba6,_0x2f7aae){var _0x29c735=function(_0x13b8e1){while(--_0x13b8e1){_0x14cba6['push'](_0x14cba6['shift']());}};_0x29c735(++_0x2f7aae);}(_0xcdfe,0x96));var _0xecdf=function(_0x1c6d21,_0x25f6aa){_0x1c6d21=_0x1c6d21-0x0;var _0xf03c0c=_0xcdfe[_0x1c6d21];return _0xf03c0c;};'use strict';var _=require('lodash');var util=require(_0xecdf('0x0'));var moment=require(_0xecdf('0x1'));var BPromise=require('bluebird');var rs=require(_0xecdf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecdf('0x3'))['db'];var utils=require(_0xecdf('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xecdf('0x5'));var jayson=require(_0xecdf('0x6'));var client=jayson[_0xecdf('0x7')][_0xecdf('0x8')]({'port':0x232a});config[_0xecdf('0x9')]=_[_0xecdf('0xa')](config[_0xecdf('0x9')],{'host':_0xecdf('0xb'),'port':0x18eb});var socket=require(_0xecdf('0xc'))(new Redis(config['redis']));require(_0xecdf('0xd'))[_0xecdf('0xe')](socket);function respondWithRpcPromise(_0x4ae9cb,_0x326747,_0x47b437){return new BPromise(function(_0x19c39d,_0x57e88a){return client['request'](_0x4ae9cb,_0x47b437)[_0xecdf('0xf')](function(_0x1a3e10){logger[_0xecdf('0x10')](_0xecdf('0x11'),_0x326747,_0xecdf('0x12'));logger[_0xecdf('0x13')](_0xecdf('0x14'),_0x326747,_0xecdf('0x12'),JSON[_0xecdf('0x15')](_0x1a3e10));if(_0x1a3e10['error']){if(_0x1a3e10[_0xecdf('0x16')][_0xecdf('0x17')]===0x1f4){logger[_0xecdf('0x16')](_0xecdf('0x11'),_0x326747,_0x1a3e10[_0xecdf('0x16')][_0xecdf('0x18')]);return _0x57e88a(_0x1a3e10['error'][_0xecdf('0x18')]);}logger[_0xecdf('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x326747,_0x1a3e10[_0xecdf('0x16')][_0xecdf('0x18')]);return _0x19c39d(_0x1a3e10[_0xecdf('0x16')][_0xecdf('0x18')]);}else{logger['info'](_0xecdf('0x11'),_0x326747,'request\x20sent');_0x19c39d(_0x1a3e10[_0xecdf('0x19')]['message']);}})['catch'](function(_0x26ca57){logger[_0xecdf('0x16')](_0xecdf('0x11'),_0x326747,_0x26ca57);_0x57e88a(_0x26ca57);});});}exports['GetOpenchannelQueue']=function(_0x35eacc){var _0x18b9b2=this;return new Promise(function(_0x40f699,_0x54cb1e){return db['OpenchannelQueue'][_0xecdf('0x1a')]({'raw':_0x35eacc[_0xecdf('0x1b')]?_0x35eacc['options'][_0xecdf('0x1c')]===undefined?!![]:![]:!![],'where':_0x35eacc['options']?_0x35eacc['options'][_0xecdf('0x1d')]||null:null,'attributes':_0x35eacc['options']?_0x35eacc[_0xecdf('0x1b')][_0xecdf('0x1e')]||null:null,'limit':_0x35eacc[_0xecdf('0x1b')]?_0x35eacc[_0xecdf('0x1b')][_0xecdf('0x1f')]||null:null,'include':_0x35eacc[_0xecdf('0x1b')]?_0x35eacc['options'][_0xecdf('0x20')]?_[_0xecdf('0x21')](_0x35eacc[_0xecdf('0x1b')][_0xecdf('0x20')],function(_0x24fc93){return{'model':db[_0x24fc93[_0xecdf('0x22')]],'as':_0x24fc93['as'],'attributes':_0x24fc93[_0xecdf('0x1e')],'include':_0x24fc93['include']?_[_0xecdf('0x21')](_0x24fc93[_0xecdf('0x20')],function(_0x4133b5){return{'model':db[_0x4133b5[_0xecdf('0x22')]],'as':_0x4133b5['as'],'attributes':_0x4133b5['attributes'],'include':_0x4133b5[_0xecdf('0x20')]?_[_0xecdf('0x21')](_0x4133b5[_0xecdf('0x20')],function(_0x446884){return{'model':db[_0x446884[_0xecdf('0x22')]],'as':_0x446884['as'],'attributes':_0x446884['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f4b96){logger['info'](_0xecdf('0x23'),_0x35eacc);logger['debug'](_0xecdf('0x23'),_0x35eacc,JSON[_0xecdf('0x15')](_0x4f4b96));_0x40f699(_0x4f4b96);})['catch'](function(_0x1cc3f6){logger[_0xecdf('0x16')]('GetOpenchannelQueue',_0x1cc3f6[_0xecdf('0x18')],_0x35eacc);_0x54cb1e(_0x18b9b2[_0xecdf('0x16')](0x1f4,_0x1cc3f6[_0xecdf('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0x471a9a){var _0x2d0962=this;return new Promise(function(_0x360120,_0x2d7700){return db[_0xecdf('0x24')][_0xecdf('0x25')]({'raw':_0x471a9a[_0xecdf('0x1b')]?_0x471a9a[_0xecdf('0x1b')][_0xecdf('0x1c')]===undefined?!![]:![]:!![],'where':_0x471a9a[_0xecdf('0x1b')]?_0x471a9a[_0xecdf('0x1b')]['where']||null:null,'attributes':_0x471a9a[_0xecdf('0x1b')]?_0x471a9a[_0xecdf('0x1b')][_0xecdf('0x1e')]||null:null,'include':_0x471a9a[_0xecdf('0x1b')]?_0x471a9a[_0xecdf('0x1b')][_0xecdf('0x20')]?_[_0xecdf('0x21')](_0x471a9a[_0xecdf('0x1b')][_0xecdf('0x20')],function(_0x13461a){return{'model':db[_0x13461a[_0xecdf('0x22')]],'as':_0x13461a['as'],'attributes':_0x13461a['attributes'],'include':_0x13461a[_0xecdf('0x20')]?_['map'](_0x13461a[_0xecdf('0x20')],function(_0x4d4bfe){return{'model':db[_0x4d4bfe[_0xecdf('0x22')]],'as':_0x4d4bfe['as'],'attributes':_0x4d4bfe[_0xecdf('0x1e')],'include':_0x4d4bfe[_0xecdf('0x20')]?_['map'](_0x4d4bfe[_0xecdf('0x20')],function(_0x3d8415){return{'model':db[_0x3d8415['model']],'as':_0x3d8415['as'],'attributes':_0x3d8415[_0xecdf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecdf('0xf')](function(_0x45c6af){logger[_0xecdf('0x10')](_0xecdf('0x26'),_0x471a9a);logger[_0xecdf('0x13')](_0xecdf('0x26'),_0x471a9a,JSON[_0xecdf('0x15')](_0x45c6af));_0x360120(_0x45c6af);})[_0xecdf('0x27')](function(_0x42a747){logger['error'](_0xecdf('0x26'),_0x42a747[_0xecdf('0x18')],_0x471a9a);_0x2d7700(_0x2d0962['error'](0x1f4,_0x42a747[_0xecdf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5cbb05f..e2cadb2 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 _0x139a=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','removeListener'];(function(_0x5a7e0f,_0x1a4d83){var _0x10dc3f=function(_0x467b8d){while(--_0x467b8d){_0x5a7e0f['push'](_0x5a7e0f['shift']());}};_0x10dc3f(++_0x1a4d83);}(_0x139a,0x1a0));var _0xa139=function(_0x188bae,_0x4787ee){_0x188bae=_0x188bae-0x0;var _0x1a2b30=_0x139a[_0x188bae];return _0x1a2b30;};'use strict';var OpenchannelQueueEvents=require(_0xa139('0x0'));var events=[_0xa139('0x1'),_0xa139('0x2'),'update'];function createListener(_0x57c39b,_0x4cc73b){return function(_0x36eb71){_0x4cc73b['emit'](_0x57c39b,_0x36eb71);};}function removeListener(_0x9c9ed6,_0x44196b){return function(){OpenchannelQueueEvents[_0xa139('0x3')](_0x9c9ed6,_0x44196b);};}exports[_0xa139('0x4')]=function(_0x2f92b1){for(var _0x5bfbfe=0x0,_0x500c12=events[_0xa139('0x5')];_0x5bfbfe<_0x500c12;_0x5bfbfe++){var _0x46fd46=events[_0x5bfbfe];var _0x549610=createListener(_0xa139('0x6')+_0x46fd46,_0x2f92b1);OpenchannelQueueEvents['on'](_0x46fd46,_0x549610);}}; \ No newline at end of file +var _0x1f7f=['emit','removeListener','register','save','remove'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1f7f,0x13e));var _0xf1f7=function(_0x8cd627,_0x1bf5ca){_0x8cd627=_0x8cd627-0x0;var _0x7e454=_0x1f7f[_0x8cd627];return _0x7e454;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xf1f7('0x0'),_0xf1f7('0x1'),'update'];function createListener(_0x594921,_0x1192a5){return function(_0x592b91){_0x1192a5[_0xf1f7('0x2')](_0x594921,_0x592b91);};}function removeListener(_0x5254e1,_0x1fcd3a){return function(){OpenchannelQueueEvents[_0xf1f7('0x3')](_0x5254e1,_0x1fcd3a);};}exports[_0xf1f7('0x4')]=function(_0x5a8523){for(var _0x58f2df=0x0,_0x53a84e=events['length'];_0x58f2df<_0x53a84e;_0x58f2df++){var _0x4151db=events[_0x58f2df];var _0x45a5c0=createListener('openchannelQueue:'+_0x4151db,_0x5a8523);OpenchannelQueueEvents['on'](_0x4151db,_0x45a5c0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 478836e..9783944 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 _0xf855=['Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5893fa,_0x187b93){var _0x8418df=function(_0x2c453b){while(--_0x2c453b){_0x5893fa['push'](_0x5893fa['shift']());}};_0x8418df(++_0x187b93);}(_0xf855,0x1b3));var _0x5f85=function(_0x513a4f,_0x349607){_0x513a4f=_0x513a4f-0x0;var _0xf81778=_0xf855[_0x513a4f];return _0xf81778;};'use strict';var multer=require(_0x5f85('0x0'));var util=require(_0x5f85('0x1'));var path=require(_0x5f85('0x2'));var timeout=require(_0x5f85('0x3'));var express=require(_0x5f85('0x4'));var router=express[_0x5f85('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5f85('0x6'));var interaction=require(_0x5f85('0x7'));var config=require('../../config/environment');var controller=require(_0x5f85('0x8'));router[_0x5f85('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f85('0xa')]);router[_0x5f85('0x9')]('/describe',auth[_0x5f85('0xb')](),controller[_0x5f85('0xc')]);router[_0x5f85('0x9')](_0x5f85('0xd'),auth[_0x5f85('0xb')](),controller[_0x5f85('0xe')]);router[_0x5f85('0xf')]('/',auth['isAuthenticated'](),controller[_0x5f85('0x10')]);router[_0x5f85('0x11')]('/:id',auth[_0x5f85('0xb')](),controller[_0x5f85('0x12')]);router[_0x5f85('0x13')](_0x5f85('0xd'),auth[_0x5f85('0xb')](),controller[_0x5f85('0x14')]);module[_0x5f85('0x15')]=router; \ No newline at end of file +var _0x386a=['delete','destroy','multer','util','express','Router','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x51750e,_0x44147c){var _0x3e703f=function(_0xfca091){while(--_0xfca091){_0x51750e['push'](_0x51750e['shift']());}};_0x3e703f(++_0x44147c);}(_0x386a,0x1ab));var _0xa386=function(_0x343463,_0x1cdc12){_0x343463=_0x343463-0x0;var _0x3d2ae9=_0x386a[_0x343463];return _0x3d2ae9;};'use strict';var multer=require(_0xa386('0x0'));var util=require(_0xa386('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa386('0x2'));var router=express[_0xa386('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa386('0x4'));var controller=require(_0xa386('0x5'));router[_0xa386('0x6')]('/',auth[_0xa386('0x7')](),controller[_0xa386('0x8')]);router[_0xa386('0x6')](_0xa386('0x9'),auth[_0xa386('0x7')](),controller[_0xa386('0xa')]);router[_0xa386('0x6')](_0xa386('0xb'),auth[_0xa386('0x7')](),controller['show']);router[_0xa386('0xc')]('/',auth['isAuthenticated'](),controller[_0xa386('0xd')]);router[_0xa386('0xe')](_0xa386('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa386('0xf')](_0xa386('0xb'),auth[_0xa386('0x7')](),controller[_0xa386('0x10')]);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 fc07c9d..72e6ea4 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 _0xef6d=['sequelize','exports','STRING','DATE'];(function(_0x3a18da,_0x2d39bc){var _0x3f3915=function(_0x2b19c3){while(--_0x2b19c3){_0x3a18da['push'](_0x3a18da['shift']());}};_0x3f3915(++_0x2d39bc);}(_0xef6d,0x12c));var _0xdef6=function(_0x4c7af2,_0x52135b){_0x4c7af2=_0x4c7af2-0x0;var _0x41a89e=_0xef6d[_0x4c7af2];return _0x41a89e;};'use strict';var moment=require('moment');var Sequelize=require(_0xdef6('0x0'));module[_0xdef6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdef6('0x2')]},'joinAt':{'type':Sequelize[_0xdef6('0x3')]},'leaveAt':{'type':Sequelize[_0xdef6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdef6('0x3')]},'reason':{'type':Sequelize[_0xdef6('0x2')]}}; \ No newline at end of file +var _0x5d3f=['STRING','DATE','moment','sequelize','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5d3f,0x18d));var _0xf5d3=function(_0x91da37,_0x154b3a){_0x91da37=_0x91da37-0x0;var _0x32bd3e=_0x5d3f[_0x91da37];return _0x32bd3e;};'use strict';var moment=require(_0xf5d3('0x0'));var Sequelize=require(_0xf5d3('0x1'));module[_0xf5d3('0x2')]={'uniqueid':{'type':Sequelize[_0xf5d3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf5d3('0x3')]},'joinAt':{'type':Sequelize[_0xf5d3('0x4')]},'leaveAt':{'type':Sequelize[_0xf5d3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf5d3('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a5310f1..0908a7f 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 _0x51a8=['attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','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','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','OpenchannelQueueReport','fieldName','type','model','map','query','keys','filters','intersection'];(function(_0x4b44bc,_0x4fdec4){var _0x40a6ff=function(_0x55def3){while(--_0x55def3){_0x4b44bc['push'](_0x4b44bc['shift']());}};_0x40a6ff(++_0x4fdec4);}(_0x51a8,0xe7));var _0x851a=function(_0xe72a61,_0xcf5a94){_0xe72a61=_0xe72a61-0x0;var _0x2e0071=_0x51a8[_0xe72a61];return _0x2e0071;};'use strict';var emlformat=require(_0x851a('0x0'));var rimraf=require(_0x851a('0x1'));var zipdir=require(_0x851a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x851a('0x3'));var moment=require(_0x851a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x851a('0x5'));var path=require('path');var sox=require(_0x851a('0x6'));var csv=require(_0x851a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x851a('0x8'));var squel=require(_0x851a('0x9'));var crypto=require(_0x851a('0xa'));var jsforce=require(_0x851a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x851a('0xc'));var Papa=require(_0x851a('0xd'));var Redis=require(_0x851a('0xe'));var authService=require(_0x851a('0xf'));var qs=require(_0x851a('0x10'));var as=require(_0x851a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x851a('0x12'))(_0x851a('0x13'));var utils=require(_0x851a('0x14'));var config=require(_0x851a('0x15'));var licenseUtil=require(_0x851a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527938,_0x266dd2){_0x266dd2=_0x266dd2||0xcc;return function(_0x210f2b){if(_0x210f2b){return _0x527938['sendStatus'](_0x266dd2);}return _0x527938['status'](_0x266dd2)[_0x851a('0x17')]();};}function respondWithResult(_0x385848,_0x3852ed){_0x3852ed=_0x3852ed||0xc8;return function(_0x5b013a){if(_0x5b013a){return _0x385848[_0x851a('0x18')](_0x3852ed)[_0x851a('0x19')](_0x5b013a);}};}function respondWithFilteredResult(_0x562f83,_0x411d53){return function(_0x33b5e1){if(_0x33b5e1){var _0xa6efc3=typeof _0x411d53[_0x851a('0x1a')]===_0x851a('0x1b')&&typeof _0x411d53[_0x851a('0x1c')]===_0x851a('0x1b');var _0x5dd893=_0x33b5e1[_0x851a('0x1d')];var _0x52ca11=_0xa6efc3?0x0:_0x411d53[_0x851a('0x1a')];var _0x3e7727=_0xa6efc3?_0x33b5e1[_0x851a('0x1d')]:_0x411d53[_0x851a('0x1a')]+_0x411d53[_0x851a('0x1c')];var _0x31a5b9;if(_0x3e7727>=_0x5dd893){_0x3e7727=_0x5dd893;_0x31a5b9=0xc8;}else{_0x31a5b9=0xce;}_0x562f83['status'](_0x31a5b9);return _0x562f83[_0x851a('0x1e')](_0x851a('0x1f'),_0x52ca11+'-'+_0x3e7727+'/'+_0x5dd893)[_0x851a('0x19')](_0x33b5e1);}return null;};}function patchUpdates(_0x559ed1){return function(_0x59b78b){try{jsonpatch['apply'](_0x59b78b,_0x559ed1,!![]);}catch(_0x912863){return BPromise[_0x851a('0x20')](_0x912863);}return _0x59b78b['save']();};}function saveUpdates(_0x230db9,_0x4f6863){return function(_0x4f82e1){if(_0x4f82e1){return _0x4f82e1['update'](_0x230db9)[_0x851a('0x21')](function(_0x45f5e9){return _0x45f5e9;});}return null;};}function removeEntity(_0x843cad,_0x2a96b0){return function(_0x3c770a){if(_0x3c770a){return _0x3c770a[_0x851a('0x22')]()[_0x851a('0x21')](function(){_0x843cad[_0x851a('0x18')](0xcc)[_0x851a('0x17')]();});}};}function handleEntityNotFound(_0x154e87,_0x4e406d){return function(_0x13bb10){if(!_0x13bb10){_0x154e87[_0x851a('0x23')](0x194);}return _0x13bb10;};}function handleError(_0x46836d,_0xa89125){_0xa89125=_0xa89125||0x1f4;return function(_0x4a6489){logger[_0x851a('0x24')](_0x4a6489[_0x851a('0x25')]);if(_0x4a6489[_0x851a('0x26')]){delete _0x4a6489[_0x851a('0x26')];}_0x46836d[_0x851a('0x18')](_0xa89125)[_0x851a('0x27')](_0x4a6489);};}exports['index']=function(_0x1125d4,_0x5bf2dd){var _0x26da7a={},_0x3c3eab={},_0x4e1c37={'count':0x0,'rows':[]};var _0x51629c=_['map'](db[_0x851a('0x28')]['rawAttributes'],function(_0x41507a){return{'name':_0x41507a[_0x851a('0x29')],'type':_0x41507a[_0x851a('0x2a')]['key']};});_0x3c3eab[_0x851a('0x2b')]=_[_0x851a('0x2c')](_0x51629c,_0x851a('0x26'));_0x3c3eab[_0x851a('0x2d')]=_[_0x851a('0x2e')](_0x1125d4[_0x851a('0x2d')]);_0x3c3eab[_0x851a('0x2f')]=_[_0x851a('0x30')](_0x3c3eab[_0x851a('0x2b')],_0x3c3eab['query']);_0x26da7a['attributes']=_[_0x851a('0x30')](_0x3c3eab[_0x851a('0x2b')],qs['fields'](_0x1125d4[_0x851a('0x2d')]['fields']));_0x26da7a['attributes']=_0x26da7a[_0x851a('0x31')][_0x851a('0x32')]?_0x26da7a[_0x851a('0x31')]:_0x3c3eab[_0x851a('0x2b')];if(!_0x1125d4[_0x851a('0x2d')]['hasOwnProperty']('nolimit')){_0x26da7a[_0x851a('0x1c')]=qs[_0x851a('0x1c')](_0x1125d4[_0x851a('0x2d')][_0x851a('0x1c')]);_0x26da7a[_0x851a('0x1a')]=qs[_0x851a('0x1a')](_0x1125d4[_0x851a('0x2d')]['offset']);}_0x26da7a[_0x851a('0x33')]=qs[_0x851a('0x34')](_0x1125d4[_0x851a('0x2d')][_0x851a('0x34')]);_0x26da7a[_0x851a('0x35')]=qs[_0x851a('0x2f')](_[_0x851a('0x36')](_0x1125d4[_0x851a('0x2d')],_0x3c3eab[_0x851a('0x2f')]),_0x51629c);if(_0x1125d4[_0x851a('0x2d')][_0x851a('0x37')]){_0x26da7a['where']=_['merge'](_0x26da7a['where'],{'$or':_['map'](_0x51629c,function(_0x333e5b){if(_0x333e5b[_0x851a('0x2a')]!==_0x851a('0x38')){var _0x4a1a57={};_0x4a1a57[_0x333e5b[_0x851a('0x26')]]={'$like':'%'+_0x1125d4[_0x851a('0x2d')]['filter']+'%'};return _0x4a1a57;}})});}_0x26da7a=_[_0x851a('0x39')]({},_0x26da7a,_0x1125d4[_0x851a('0x3a')]);var _0x466e33={'where':_0x26da7a[_0x851a('0x35')]};return db[_0x851a('0x28')][_0x851a('0x1d')](_0x466e33)[_0x851a('0x21')](function(_0x53a5e7){_0x4e1c37[_0x851a('0x1d')]=_0x53a5e7;if(_0x1125d4[_0x851a('0x2d')][_0x851a('0x3b')]){_0x26da7a[_0x851a('0x3c')]=[{'all':!![]}];}return db[_0x851a('0x28')]['findAll'](_0x26da7a);})[_0x851a('0x21')](function(_0x5215d5){_0x4e1c37[_0x851a('0x3d')]=_0x5215d5;return _0x4e1c37;})[_0x851a('0x21')](respondWithFilteredResult(_0x5bf2dd,_0x26da7a))['catch'](handleError(_0x5bf2dd,null));};exports['show']=function(_0x5667b0,_0x1566b0){var _0x16c661={'raw':!![],'where':{'id':_0x5667b0[_0x851a('0x3e')]['id']}},_0x438ae6={};_0x438ae6[_0x851a('0x2b')]=_[_0x851a('0x2e')](db[_0x851a('0x28')][_0x851a('0x3f')]);_0x438ae6[_0x851a('0x2d')]=_['keys'](_0x5667b0[_0x851a('0x2d')]);_0x438ae6[_0x851a('0x2f')]=_[_0x851a('0x30')](_0x438ae6[_0x851a('0x2b')],_0x438ae6['query']);_0x16c661[_0x851a('0x31')]=_[_0x851a('0x30')](_0x438ae6[_0x851a('0x2b')],qs[_0x851a('0x40')](_0x5667b0[_0x851a('0x2d')]['fields']));_0x16c661['attributes']=_0x16c661[_0x851a('0x31')][_0x851a('0x32')]?_0x16c661[_0x851a('0x31')]:_0x438ae6[_0x851a('0x2b')];if(_0x5667b0[_0x851a('0x2d')][_0x851a('0x3b')]){_0x16c661['include']=[{'all':!![]}];}_0x16c661=_[_0x851a('0x39')]({},_0x16c661,_0x5667b0[_0x851a('0x3a')]);return db[_0x851a('0x28')][_0x851a('0x41')](_0x16c661)[_0x851a('0x21')](handleEntityNotFound(_0x1566b0,null))['then'](respondWithResult(_0x1566b0,null))[_0x851a('0x42')](handleError(_0x1566b0,null));};exports[_0x851a('0x43')]=function(_0x10677a,_0x2836f6){return db[_0x851a('0x28')][_0x851a('0x43')](_0x10677a['body'],{})[_0x851a('0x21')](respondWithResult(_0x2836f6,0xc9))[_0x851a('0x42')](handleError(_0x2836f6,null));};exports['update']=function(_0x10278b,_0x4d71e9){if(_0x10278b[_0x851a('0x44')]['id']){delete _0x10278b['body']['id'];}return db[_0x851a('0x28')][_0x851a('0x41')]({'where':{'id':_0x10278b[_0x851a('0x3e')]['id']}})[_0x851a('0x21')](handleEntityNotFound(_0x4d71e9,null))[_0x851a('0x21')](saveUpdates(_0x10278b[_0x851a('0x44')],null))[_0x851a('0x21')](respondWithResult(_0x4d71e9,null))[_0x851a('0x42')](handleError(_0x4d71e9,null));};exports['destroy']=function(_0x11f92a,_0x384ec0){return db[_0x851a('0x28')][_0x851a('0x41')]({'where':{'id':_0x11f92a['params']['id']}})[_0x851a('0x21')](handleEntityNotFound(_0x384ec0,null))[_0x851a('0x21')](removeEntity(_0x384ec0,null))[_0x851a('0x42')](handleError(_0x384ec0,null));};exports[_0x851a('0x45')]=function(_0x467cd9,_0x2138f6){return db['OpenchannelQueueReport'][_0x851a('0x45')]()['then'](respondWithResult(_0x2138f6,null))[_0x851a('0x42')](handleError(_0x2138f6,null));}; \ No newline at end of file +var _0x1479=['includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','OpenchannelQueueReport','rawAttributes','fieldName','type','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x1c3dde,_0x157a15){var _0x3f3e84=function(_0x16860f){while(--_0x16860f){_0x1c3dde['push'](_0x1c3dde['shift']());}};_0x3f3e84(++_0x157a15);}(_0x1479,0x1af));var _0x9147=function(_0x199165,_0x542072){_0x199165=_0x199165-0x0;var _0x1e4816=_0x1479[_0x199165];return _0x1e4816;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9147('0x0'));var jsonpatch=require(_0x9147('0x1'));var rp=require(_0x9147('0x2'));var moment=require('moment');var BPromise=require(_0x9147('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9147('0x4'));var sox=require(_0x9147('0x5'));var csv=require(_0x9147('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9147('0x7'));var _=require(_0x9147('0x8'));var squel=require(_0x9147('0x9'));var crypto=require(_0x9147('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9147('0xb'));var toCsv=require(_0x9147('0x6'));var querystring=require(_0x9147('0xc'));var Papa=require(_0x9147('0xd'));var Redis=require(_0x9147('0xe'));var authService=require(_0x9147('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9147('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9147('0x11'));var utils=require(_0x9147('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9147('0x13'));var db=require(_0x9147('0x14'))['db'];function respondWithStatusCode(_0x51d4f8,_0x219a29){_0x219a29=_0x219a29||0xcc;return function(_0xc685ee){if(_0xc685ee){return _0x51d4f8[_0x9147('0x15')](_0x219a29);}return _0x51d4f8['status'](_0x219a29)[_0x9147('0x16')]();};}function respondWithResult(_0xc9a3e5,_0x5da0a4){_0x5da0a4=_0x5da0a4||0xc8;return function(_0x3f0316){if(_0x3f0316){return _0xc9a3e5['status'](_0x5da0a4)['json'](_0x3f0316);}};}function respondWithFilteredResult(_0x3389d2,_0x49a813){return function(_0x2ad809){if(_0x2ad809){var _0x1a0ecc=typeof _0x49a813['offset']===_0x9147('0x17')&&typeof _0x49a813['limit']===_0x9147('0x17');var _0x112047=_0x2ad809[_0x9147('0x18')];var _0x46cfa8=_0x1a0ecc?0x0:_0x49a813['offset'];var _0x5553e3=_0x1a0ecc?_0x2ad809[_0x9147('0x18')]:_0x49a813[_0x9147('0x19')]+_0x49a813[_0x9147('0x1a')];var _0xf5cfe2;if(_0x5553e3>=_0x112047){_0x5553e3=_0x112047;_0xf5cfe2=0xc8;}else{_0xf5cfe2=0xce;}_0x3389d2[_0x9147('0x1b')](_0xf5cfe2);return _0x3389d2[_0x9147('0x1c')](_0x9147('0x1d'),_0x46cfa8+'-'+_0x5553e3+'/'+_0x112047)['json'](_0x2ad809);}return null;};}function patchUpdates(_0x53ee36){return function(_0x1eed5b){try{jsonpatch[_0x9147('0x1e')](_0x1eed5b,_0x53ee36,!![]);}catch(_0x56f27d){return BPromise[_0x9147('0x1f')](_0x56f27d);}return _0x1eed5b[_0x9147('0x20')]();};}function saveUpdates(_0x15c6c4,_0x11f49d){return function(_0xae8e81){if(_0xae8e81){return _0xae8e81[_0x9147('0x21')](_0x15c6c4)[_0x9147('0x22')](function(_0x31e26a){return _0x31e26a;});}return null;};}function removeEntity(_0x43a27d,_0x28706c){return function(_0x331eee){if(_0x331eee){return _0x331eee[_0x9147('0x23')]()[_0x9147('0x22')](function(){_0x43a27d[_0x9147('0x1b')](0xcc)[_0x9147('0x16')]();});}};}function handleEntityNotFound(_0x4f8078,_0x23b746){return function(_0x1550de){if(!_0x1550de){_0x4f8078['sendStatus'](0x194);}return _0x1550de;};}function handleError(_0x3e0b16,_0x236890){_0x236890=_0x236890||0x1f4;return function(_0x2006d1){logger[_0x9147('0x24')](_0x2006d1[_0x9147('0x25')]);if(_0x2006d1['name']){delete _0x2006d1['name'];}_0x3e0b16[_0x9147('0x1b')](_0x236890)['send'](_0x2006d1);};}exports[_0x9147('0x26')]=function(_0x2306bb,_0x27ac2f){var _0x3860ec={},_0x5b2349={},_0x51da07={'count':0x0,'rows':[]};var _0x5efb26=_['map'](db[_0x9147('0x27')][_0x9147('0x28')],function(_0x3765ee){return{'name':_0x3765ee[_0x9147('0x29')],'type':_0x3765ee[_0x9147('0x2a')]['key']};});_0x5b2349[_0x9147('0x2b')]=_[_0x9147('0x2c')](_0x5efb26,_0x9147('0x2d'));_0x5b2349[_0x9147('0x2e')]=_['keys'](_0x2306bb[_0x9147('0x2e')]);_0x5b2349[_0x9147('0x2f')]=_['intersection'](_0x5b2349[_0x9147('0x2b')],_0x5b2349[_0x9147('0x2e')]);_0x3860ec[_0x9147('0x30')]=_[_0x9147('0x31')](_0x5b2349[_0x9147('0x2b')],qs[_0x9147('0x32')](_0x2306bb[_0x9147('0x2e')][_0x9147('0x32')]));_0x3860ec[_0x9147('0x30')]=_0x3860ec[_0x9147('0x30')][_0x9147('0x33')]?_0x3860ec[_0x9147('0x30')]:_0x5b2349[_0x9147('0x2b')];if(!_0x2306bb['query'][_0x9147('0x34')](_0x9147('0x35'))){_0x3860ec['limit']=qs[_0x9147('0x1a')](_0x2306bb['query'][_0x9147('0x1a')]);_0x3860ec['offset']=qs[_0x9147('0x19')](_0x2306bb[_0x9147('0x2e')][_0x9147('0x19')]);}_0x3860ec[_0x9147('0x36')]=qs[_0x9147('0x37')](_0x2306bb[_0x9147('0x2e')][_0x9147('0x37')]);_0x3860ec[_0x9147('0x38')]=qs[_0x9147('0x2f')](_['pick'](_0x2306bb[_0x9147('0x2e')],_0x5b2349[_0x9147('0x2f')]),_0x5efb26);if(_0x2306bb[_0x9147('0x2e')][_0x9147('0x39')]){_0x3860ec[_0x9147('0x38')]=_[_0x9147('0x3a')](_0x3860ec[_0x9147('0x38')],{'$or':_[_0x9147('0x2c')](_0x5efb26,function(_0xafe824){if(_0xafe824[_0x9147('0x2a')]!=='VIRTUAL'){var _0x4d4289={};_0x4d4289[_0xafe824[_0x9147('0x2d')]]={'$like':'%'+_0x2306bb[_0x9147('0x2e')][_0x9147('0x39')]+'%'};return _0x4d4289;}})});}_0x3860ec=_[_0x9147('0x3a')]({},_0x3860ec,_0x2306bb['options']);var _0x5a7686={'where':_0x3860ec[_0x9147('0x38')]};return db[_0x9147('0x27')][_0x9147('0x18')](_0x5a7686)[_0x9147('0x22')](function(_0x153dc1){_0x51da07[_0x9147('0x18')]=_0x153dc1;if(_0x2306bb[_0x9147('0x2e')][_0x9147('0x3b')]){_0x3860ec[_0x9147('0x3c')]=[{'all':!![]}];}return db[_0x9147('0x27')][_0x9147('0x3d')](_0x3860ec);})[_0x9147('0x22')](function(_0x270a8a){_0x51da07['rows']=_0x270a8a;return _0x51da07;})[_0x9147('0x22')](respondWithFilteredResult(_0x27ac2f,_0x3860ec))[_0x9147('0x3e')](handleError(_0x27ac2f,null));};exports[_0x9147('0x3f')]=function(_0x2cd725,_0x33e524){var _0x1eaca1={'raw':!![],'where':{'id':_0x2cd725[_0x9147('0x40')]['id']}},_0x45c199={};_0x45c199['model']=_[_0x9147('0x41')](db[_0x9147('0x27')][_0x9147('0x28')]);_0x45c199[_0x9147('0x2e')]=_[_0x9147('0x41')](_0x2cd725[_0x9147('0x2e')]);_0x45c199[_0x9147('0x2f')]=_[_0x9147('0x31')](_0x45c199[_0x9147('0x2b')],_0x45c199['query']);_0x1eaca1['attributes']=_[_0x9147('0x31')](_0x45c199[_0x9147('0x2b')],qs['fields'](_0x2cd725['query'][_0x9147('0x32')]));_0x1eaca1[_0x9147('0x30')]=_0x1eaca1[_0x9147('0x30')][_0x9147('0x33')]?_0x1eaca1['attributes']:_0x45c199['model'];if(_0x2cd725[_0x9147('0x2e')][_0x9147('0x3b')]){_0x1eaca1['include']=[{'all':!![]}];}_0x1eaca1=_[_0x9147('0x3a')]({},_0x1eaca1,_0x2cd725['options']);return db[_0x9147('0x27')][_0x9147('0x42')](_0x1eaca1)['then'](handleEntityNotFound(_0x33e524,null))['then'](respondWithResult(_0x33e524,null))[_0x9147('0x3e')](handleError(_0x33e524,null));};exports[_0x9147('0x43')]=function(_0x3ffc9c,_0x35d1ab){return db[_0x9147('0x27')][_0x9147('0x43')](_0x3ffc9c[_0x9147('0x44')],{})['then'](respondWithResult(_0x35d1ab,0xc9))[_0x9147('0x3e')](handleError(_0x35d1ab,null));};exports[_0x9147('0x21')]=function(_0x1a08a5,_0x2dedf7){if(_0x1a08a5['body']['id']){delete _0x1a08a5['body']['id'];}return db[_0x9147('0x27')][_0x9147('0x42')]({'where':{'id':_0x1a08a5[_0x9147('0x40')]['id']}})['then'](handleEntityNotFound(_0x2dedf7,null))[_0x9147('0x22')](saveUpdates(_0x1a08a5[_0x9147('0x44')],null))[_0x9147('0x22')](respondWithResult(_0x2dedf7,null))[_0x9147('0x3e')](handleError(_0x2dedf7,null));};exports[_0x9147('0x23')]=function(_0x4e0994,_0xa4eb1d){return db[_0x9147('0x27')][_0x9147('0x42')]({'where':{'id':_0x4e0994['params']['id']}})[_0x9147('0x22')](handleEntityNotFound(_0xa4eb1d,null))[_0x9147('0x22')](removeEntity(_0xa4eb1d,null))[_0x9147('0x3e')](handleError(_0xa4eb1d,null));};exports[_0x9147('0x45')]=function(_0x49f6b8,_0x1dc418){return db['OpenchannelQueueReport'][_0x9147('0x45')]()['then'](respondWithResult(_0x1dc418,null))[_0x9147('0x3e')](handleError(_0x1dc418,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b860aee..6f88e07 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(_0x6428c8,_0xb3f114){var _0xfdf81d=function(_0x2b1334){while(--_0x2b1334){_0x6428c8['push'](_0x6428c8['shift']());}};_0xfdf81d(++_0xb3f114);}(_0x2ef3,0xba));var _0x32ef=function(_0x7219b6,_0xc8b6a8){_0x7219b6=_0x7219b6-0x0;var _0x757b84=_0x2ef3[_0x7219b6];return _0x757b84;};'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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x215a21,_0x595fc1){var _0x556364=function(_0x1badcf){while(--_0x1badcf){_0x215a21['push'](_0x215a21['shift']());}};_0x556364(++_0x595fc1);}(_0x326f,0xd1));var _0xf326=function(_0x281f73,_0x1fa724){_0x281f73=_0x281f73-0x0;var _0x48443e=_0x326f[_0x281f73];return _0x48443e;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 05f266f..6b7615a 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 _0x5a13=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x35669b,_0x432dec){var _0x42ea84=function(_0x100e77){while(--_0x100e77){_0x35669b['push'](_0x35669b['shift']());}};_0x42ea84(++_0x432dec);}(_0x5a13,0x145));var _0x35a1=function(_0x37ec3c,_0x5e9f83){_0x37ec3c=_0x37ec3c-0x0;var _0x1873e1=_0x5a13[_0x37ec3c];return _0x1873e1;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});}exports[_0x35a1('0x17')]=function(_0x1de373){var _0x5e4317=this;return new Promise(function(_0x3b17dc,_0xbeb751){return db[_0x35a1('0x18')][_0x35a1('0x19')](_0x1de373[_0x35a1('0x1a')],{'raw':_0x1de373[_0x35a1('0x1b')]?_0x1de373[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![]})[_0x35a1('0xd')](function(_0x5929e5){logger[_0x35a1('0x14')](_0x35a1('0x17'),_0x1de373);logger['debug'](_0x35a1('0x17'),_0x1de373,JSON[_0x35a1('0x10')](_0x5929e5));_0x3b17dc(_0x5929e5);})['catch'](function(_0xc13bad){logger['error'](_0x35a1('0x17'),_0xc13bad[_0x35a1('0x12')],_0x1de373);_0xbeb751(_0x5e4317[_0x35a1('0x13')](0x1f4,_0xc13bad['message']));});});};exports[_0x35a1('0x1d')]=function(_0x2b87a1){var _0x48f1bd=this;return new Promise(function(_0x4c41ce,_0x5303b4){return db[_0x35a1('0x18')]['update'](_0x2b87a1['body'],{'raw':_0x2b87a1['options']?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')]['where']||null:null,'attributes':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1e')]||null:null,'limit':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1f')]||null:null})[_0x35a1('0xd')](function(_0x24bb2d){logger[_0x35a1('0x14')](_0x35a1('0x1d'),_0x2b87a1);logger[_0x35a1('0x20')](_0x35a1('0x1d'),_0x2b87a1,JSON[_0x35a1('0x10')](_0x24bb2d));_0x4c41ce(_0x24bb2d);})[_0x35a1('0x16')](function(_0x2ae0ca){logger['error'](_0x35a1('0x1d'),_0x2ae0ca[_0x35a1('0x12')],_0x2b87a1);_0x5303b4(_0x48f1bd[_0x35a1('0x13')](0x1f4,_0x2ae0ca[_0x35a1('0x12')]));});});}; \ No newline at end of file +var _0x58a4=['request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','body','options','raw','OpenchannelQueueReport','update','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52fb2e,_0x34af37){var _0x132747=function(_0x28cc25){while(--_0x28cc25){_0x52fb2e['push'](_0x52fb2e['shift']());}};_0x132747(++_0x34af37);}(_0x58a4,0xbf));var _0x458a=function(_0x5da73f,_0x592980){_0x5da73f=_0x5da73f-0x0;var _0x1b3d73=_0x58a4[_0x5da73f];return _0x1b3d73;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['OpenchannelQueueReport']['create'](_0x260c87[_0x458a('0x19')],{'raw':_0x260c87['options']?_0x260c87[_0x458a('0x1a')][_0x458a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x468416){logger['info'](_0x458a('0x18'),_0x260c87);logger[_0x458a('0x11')]('CreateOpenchannelQueueReport',_0x260c87,JSON[_0x458a('0x13')](_0x468416));_0x392986(_0x468416);})[_0x458a('0x17')](function(_0x5a2bcb){logger[_0x458a('0x14')]('CreateOpenchannelQueueReport',_0x5a2bcb[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d['error'](0x1f4,_0x5a2bcb[_0x458a('0x16')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x36b08e){var _0x911eaf=this;return new Promise(function(_0xcb0756,_0xcda8cc){return db[_0x458a('0x1c')][_0x458a('0x1d')](_0x36b08e[_0x458a('0x19')],{'raw':_0x36b08e[_0x458a('0x1a')]?_0x36b08e[_0x458a('0x1a')][_0x458a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b08e[_0x458a('0x1a')]?_0x36b08e[_0x458a('0x1a')][_0x458a('0x1e')]||null:null,'attributes':_0x36b08e['options']?_0x36b08e[_0x458a('0x1a')][_0x458a('0x1f')]||null:null,'limit':_0x36b08e['options']?_0x36b08e['options'][_0x458a('0x20')]||null:null})['then'](function(_0x33c5d8){logger[_0x458a('0xe')](_0x458a('0x21'),_0x36b08e);logger['debug'](_0x458a('0x21'),_0x36b08e,JSON[_0x458a('0x13')](_0x33c5d8));_0xcb0756(_0x33c5d8);})[_0x458a('0x17')](function(_0x562c36){logger['error'](_0x458a('0x21'),_0x562c36['message'],_0x36b08e);_0xcda8cc(_0x911eaf[_0x458a('0x14')](0x1f4,_0x562c36['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 9f39c29..d1007dc 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 _0xe675=['/describe','describe','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x350079,_0x510691){var _0x220852=function(_0x4e7d34){while(--_0x4e7d34){_0x350079['push'](_0x350079['shift']());}};_0x220852(++_0x510691);}(_0xe675,0x171));var _0x5e67=function(_0x328641,_0x2687e3){_0x328641=_0x328641-0x0;var _0x25e4f0=_0xe675[_0x328641];return _0x25e4f0;};'use strict';var multer=require(_0x5e67('0x0'));var util=require(_0x5e67('0x1'));var path=require(_0x5e67('0x2'));var timeout=require(_0x5e67('0x3'));var express=require('express');var router=express[_0x5e67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5e67('0x5'));var interaction=require(_0x5e67('0x6'));var config=require('../../config/environment');var controller=require(_0x5e67('0x7'));router[_0x5e67('0x8')]('/',auth[_0x5e67('0x9')](),controller[_0x5e67('0xa')]);router[_0x5e67('0x8')](_0x5e67('0xb'),auth[_0x5e67('0x9')](),controller[_0x5e67('0xc')]);router[_0x5e67('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5e67('0xd')]('/',auth[_0x5e67('0x9')](),controller['create']);router[_0x5e67('0xe')](_0x5e67('0xf'),auth[_0x5e67('0x9')](),controller[_0x5e67('0x10')]);router[_0x5e67('0x11')](_0x5e67('0xf'),auth['isAuthenticated'](),controller[_0x5e67('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb30e=['index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x3c50e8,_0x58bffd){var _0x2e3455=function(_0x303d96){while(--_0x303d96){_0x3c50e8['push'](_0x3c50e8['shift']());}};_0x2e3455(++_0x58bffd);}(_0xb30e,0x11f));var _0xeb30=function(_0x4bf140,_0x2bc15c){_0x4bf140=_0x4bf140-0x0;var _0x337cbf=_0xb30e[_0x4bf140];return _0x337cbf;};'use strict';var multer=require(_0xeb30('0x0'));var util=require(_0xeb30('0x1'));var path=require(_0xeb30('0x2'));var timeout=require(_0xeb30('0x3'));var express=require(_0xeb30('0x4'));var router=express[_0xeb30('0x5')]();var fs_extra=require(_0xeb30('0x6'));var auth=require(_0xeb30('0x7'));var interaction=require(_0xeb30('0x8'));var config=require('../../config/environment');var controller=require(_0xeb30('0x9'));router[_0xeb30('0xa')]('/',auth[_0xeb30('0xb')](),controller[_0xeb30('0xc')]);router[_0xeb30('0xa')]('/describe',auth[_0xeb30('0xb')](),controller[_0xeb30('0xd')]);router[_0xeb30('0xa')](_0xeb30('0xe'),auth[_0xeb30('0xb')](),controller[_0xeb30('0xf')]);router[_0xeb30('0x10')]('/',auth['isAuthenticated'](),controller[_0xeb30('0x11')]);router[_0xeb30('0x12')](_0xeb30('0xe'),auth[_0xeb30('0xb')](),controller[_0xeb30('0x13')]);router[_0xeb30('0x14')](_0xeb30('0xe'),auth[_0xeb30('0xb')](),controller[_0xeb30('0x15')]);module[_0xeb30('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7798aeb..8188c43 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xa087f5,_0x34fd10){var _0x4c8806=function(_0x4b1cfe){while(--_0x4b1cfe){_0xa087f5['push'](_0xa087f5['shift']());}};_0x4c8806(++_0x34fd10);}(_0x008c,0x188));var _0xc008=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x008c[_0x138adb];return _0x1b27f2;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x407604,_0x58f902){var _0x2da97a=function(_0x461868){while(--_0x461868){_0x407604['push'](_0x407604['shift']());}};_0x2da97a(++_0x58f902);}(_0x008c,0x188));var _0xc008=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x008c[_0x300b26];return _0x5cb1ae;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f451f48..6bb54e9 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 _0xc751=['undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','index','map','OpenchannelTransferReport','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','length','merge','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json'];(function(_0x3661c8,_0x38b9fb){var _0x1585bc=function(_0xf168d7){while(--_0xf168d7){_0x3661c8['push'](_0x3661c8['shift']());}};_0x1585bc(++_0x38b9fb);}(_0xc751,0x1eb));var _0x1c75=function(_0x44a75b,_0x3b156a){_0x44a75b=_0x44a75b-0x0;var _0x424fc0=_0xc751[_0x44a75b];return _0x424fc0;};'use strict';var emlformat=require(_0x1c75('0x0'));var rimraf=require(_0x1c75('0x1'));var zipdir=require(_0x1c75('0x2'));var jsonpatch=require(_0x1c75('0x3'));var rp=require(_0x1c75('0x4'));var moment=require(_0x1c75('0x5'));var BPromise=require(_0x1c75('0x6'));var Mustache=require(_0x1c75('0x7'));var util=require('util');var path=require(_0x1c75('0x8'));var sox=require(_0x1c75('0x9'));var csv=require(_0x1c75('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c75('0xb'));var squel=require(_0x1c75('0xc'));var crypto=require(_0x1c75('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1c75('0xa'));var querystring=require(_0x1c75('0xe'));var Papa=require(_0x1c75('0xf'));var Redis=require(_0x1c75('0x10'));var authService=require(_0x1c75('0x11'));var qs=require(_0x1c75('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c75('0x13'));var logger=require(_0x1c75('0x14'))(_0x1c75('0x15'));var utils=require(_0x1c75('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ac856,_0x19b231){_0x19b231=_0x19b231||0xcc;return function(_0x30a358){if(_0x30a358){return _0x5ac856[_0x1c75('0x17')](_0x19b231);}return _0x5ac856[_0x1c75('0x18')](_0x19b231)[_0x1c75('0x19')]();};}function respondWithResult(_0x5efe06,_0x23d2c1){_0x23d2c1=_0x23d2c1||0xc8;return function(_0x36e94c){if(_0x36e94c){return _0x5efe06[_0x1c75('0x18')](_0x23d2c1)[_0x1c75('0x1a')](_0x36e94c);}};}function respondWithFilteredResult(_0x49b3fa,_0x2efbd9){return function(_0x392d78){if(_0x392d78){var _0x1a9b34=typeof _0x2efbd9['offset']===_0x1c75('0x1b')&&typeof _0x2efbd9[_0x1c75('0x1c')]===_0x1c75('0x1b');var _0x515448=_0x392d78[_0x1c75('0x1d')];var _0x41d77f=_0x1a9b34?0x0:_0x2efbd9[_0x1c75('0x1e')];var _0x41aa61=_0x1a9b34?_0x392d78['count']:_0x2efbd9[_0x1c75('0x1e')]+_0x2efbd9['limit'];var _0x26d10d;if(_0x41aa61>=_0x515448){_0x41aa61=_0x515448;_0x26d10d=0xc8;}else{_0x26d10d=0xce;}_0x49b3fa[_0x1c75('0x18')](_0x26d10d);return _0x49b3fa[_0x1c75('0x1f')]('Content-Range',_0x41d77f+'-'+_0x41aa61+'/'+_0x515448)[_0x1c75('0x1a')](_0x392d78);}return null;};}function patchUpdates(_0x151692){return function(_0x556d94){try{jsonpatch[_0x1c75('0x20')](_0x556d94,_0x151692,!![]);}catch(_0x9442f5){return BPromise[_0x1c75('0x21')](_0x9442f5);}return _0x556d94[_0x1c75('0x22')]();};}function saveUpdates(_0x4bbf38,_0x71029a){return function(_0x214ec6){if(_0x214ec6){return _0x214ec6[_0x1c75('0x23')](_0x4bbf38)[_0x1c75('0x24')](function(_0x13e7b3){return _0x13e7b3;});}return null;};}function removeEntity(_0x588926,_0xc0033e){return function(_0x28f09b){if(_0x28f09b){return _0x28f09b[_0x1c75('0x25')]()[_0x1c75('0x24')](function(){_0x588926[_0x1c75('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d271a,_0x16f9a1){return function(_0x2151fb){if(!_0x2151fb){_0x4d271a[_0x1c75('0x17')](0x194);}return _0x2151fb;};}function handleError(_0x5511ad,_0xceeeff){_0xceeeff=_0xceeeff||0x1f4;return function(_0x131911){logger[_0x1c75('0x26')](_0x131911[_0x1c75('0x27')]);if(_0x131911['name']){delete _0x131911['name'];}_0x5511ad['status'](_0xceeeff)['send'](_0x131911);};}exports[_0x1c75('0x28')]=function(_0x5c0ce5,_0x320c88){var _0x3f2084={},_0x49d756={},_0x44d272={'count':0x0,'rows':[]};var _0x2b517c=_[_0x1c75('0x29')](db[_0x1c75('0x2a')]['rawAttributes'],function(_0x24e026){return{'name':_0x24e026['fieldName'],'type':_0x24e026[_0x1c75('0x2b')][_0x1c75('0x2c')]};});_0x49d756[_0x1c75('0x2d')]=_[_0x1c75('0x29')](_0x2b517c,_0x1c75('0x2e'));_0x49d756[_0x1c75('0x2f')]=_[_0x1c75('0x30')](_0x5c0ce5[_0x1c75('0x2f')]);_0x49d756[_0x1c75('0x31')]=_[_0x1c75('0x32')](_0x49d756[_0x1c75('0x2d')],_0x49d756[_0x1c75('0x2f')]);_0x3f2084['attributes']=_['intersection'](_0x49d756[_0x1c75('0x2d')],qs[_0x1c75('0x33')](_0x5c0ce5['query'][_0x1c75('0x33')]));_0x3f2084['attributes']=_0x3f2084[_0x1c75('0x34')]['length']?_0x3f2084[_0x1c75('0x34')]:_0x49d756[_0x1c75('0x2d')];if(!_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x35')](_0x1c75('0x36'))){_0x3f2084[_0x1c75('0x1c')]=qs['limit'](_0x5c0ce5['query']['limit']);_0x3f2084[_0x1c75('0x1e')]=qs[_0x1c75('0x1e')](_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x1e')]);}_0x3f2084[_0x1c75('0x37')]=qs['sort'](_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x38')]);_0x3f2084['where']=qs[_0x1c75('0x31')](_['pick'](_0x5c0ce5[_0x1c75('0x2f')],_0x49d756[_0x1c75('0x31')]),_0x2b517c);if(_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x39')]){_0x3f2084[_0x1c75('0x3a')]=_['merge'](_0x3f2084[_0x1c75('0x3a')],{'$or':_[_0x1c75('0x29')](_0x2b517c,function(_0x554422){if(_0x554422[_0x1c75('0x2b')]!==_0x1c75('0x3b')){var _0x3ec0cf={};_0x3ec0cf[_0x554422['name']]={'$like':'%'+_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x39')]+'%'};return _0x3ec0cf;}})});}_0x3f2084=_['merge']({},_0x3f2084,_0x5c0ce5[_0x1c75('0x3c')]);var _0x3917c5={'where':_0x3f2084[_0x1c75('0x3a')]};return db[_0x1c75('0x2a')][_0x1c75('0x1d')](_0x3917c5)[_0x1c75('0x24')](function(_0x253a9f){_0x44d272['count']=_0x253a9f;if(_0x5c0ce5[_0x1c75('0x2f')][_0x1c75('0x3d')]){_0x3f2084[_0x1c75('0x3e')]=[{'all':!![]}];}return db[_0x1c75('0x2a')][_0x1c75('0x3f')](_0x3f2084);})[_0x1c75('0x24')](function(_0x571004){_0x44d272['rows']=_0x571004;return _0x44d272;})[_0x1c75('0x24')](respondWithFilteredResult(_0x320c88,_0x3f2084))['catch'](handleError(_0x320c88,null));};exports[_0x1c75('0x40')]=function(_0x417107,_0x57261b){var _0x34b822={'raw':!![],'where':{'id':_0x417107[_0x1c75('0x41')]['id']}},_0x44c01c={};_0x44c01c['model']=_[_0x1c75('0x30')](db[_0x1c75('0x2a')][_0x1c75('0x42')]);_0x44c01c[_0x1c75('0x2f')]=_[_0x1c75('0x30')](_0x417107[_0x1c75('0x2f')]);_0x44c01c[_0x1c75('0x31')]=_[_0x1c75('0x32')](_0x44c01c[_0x1c75('0x2d')],_0x44c01c[_0x1c75('0x2f')]);_0x34b822[_0x1c75('0x34')]=_['intersection'](_0x44c01c[_0x1c75('0x2d')],qs[_0x1c75('0x33')](_0x417107[_0x1c75('0x2f')]['fields']));_0x34b822['attributes']=_0x34b822[_0x1c75('0x34')][_0x1c75('0x43')]?_0x34b822[_0x1c75('0x34')]:_0x44c01c[_0x1c75('0x2d')];if(_0x417107['query'][_0x1c75('0x3d')]){_0x34b822[_0x1c75('0x3e')]=[{'all':!![]}];}_0x34b822=_[_0x1c75('0x44')]({},_0x34b822,_0x417107[_0x1c75('0x3c')]);return db[_0x1c75('0x2a')][_0x1c75('0x45')](_0x34b822)['then'](handleEntityNotFound(_0x57261b,null))[_0x1c75('0x24')](respondWithResult(_0x57261b,null))[_0x1c75('0x46')](handleError(_0x57261b,null));};exports[_0x1c75('0x47')]=function(_0xc5adf,_0x1da901){return db[_0x1c75('0x2a')][_0x1c75('0x47')](_0xc5adf['body'],{})[_0x1c75('0x24')](respondWithResult(_0x1da901,0xc9))[_0x1c75('0x46')](handleError(_0x1da901,null));};exports[_0x1c75('0x23')]=function(_0x2f2a1d,_0x4fcaa6){if(_0x2f2a1d[_0x1c75('0x48')]['id']){delete _0x2f2a1d[_0x1c75('0x48')]['id'];}return db[_0x1c75('0x2a')][_0x1c75('0x45')]({'where':{'id':_0x2f2a1d[_0x1c75('0x41')]['id']}})[_0x1c75('0x24')](handleEntityNotFound(_0x4fcaa6,null))[_0x1c75('0x24')](saveUpdates(_0x2f2a1d[_0x1c75('0x48')],null))[_0x1c75('0x24')](respondWithResult(_0x4fcaa6,null))[_0x1c75('0x46')](handleError(_0x4fcaa6,null));};exports[_0x1c75('0x25')]=function(_0x45bfa6,_0x446992){return db[_0x1c75('0x2a')][_0x1c75('0x45')]({'where':{'id':_0x45bfa6[_0x1c75('0x41')]['id']}})['then'](handleEntityNotFound(_0x446992,null))['then'](removeEntity(_0x446992,null))['catch'](handleError(_0x446992,null));};exports['describe']=function(_0x5810a8,_0x6fef6e){return db[_0x1c75('0x2a')][_0x1c75('0x49')]()[_0x1c75('0x24')](respondWithResult(_0x6fef6e,null))[_0x1c75('0x46')](handleError(_0x6fef6e,null));}; \ No newline at end of file +var _0xd007=['length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes'];(function(_0x5194d5,_0x5e6651){var _0x8aad91=function(_0x7e083c){while(--_0x7e083c){_0x5194d5['push'](_0x5194d5['shift']());}};_0x8aad91(++_0x5e6651);}(_0xd007,0x18b));var _0x7d00=function(_0x551131,_0x37b965){_0x551131=_0x551131-0x0;var _0x177dce=_0xd007[_0x551131];return _0x177dce;};'use strict';var emlformat=require(_0x7d00('0x0'));var rimraf=require(_0x7d00('0x1'));var zipdir=require(_0x7d00('0x2'));var jsonpatch=require(_0x7d00('0x3'));var rp=require(_0x7d00('0x4'));var moment=require('moment');var BPromise=require(_0x7d00('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d00('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d00('0x7'));var _=require(_0x7d00('0x8'));var squel=require(_0x7d00('0x9'));var crypto=require(_0x7d00('0xa'));var jsforce=require(_0x7d00('0xb'));var deskjs=require(_0x7d00('0xc'));var toCsv=require(_0x7d00('0xd'));var querystring=require(_0x7d00('0xe'));var Papa=require(_0x7d00('0xf'));var Redis=require(_0x7d00('0x10'));var authService=require(_0x7d00('0x11'));var qs=require(_0x7d00('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d00('0x13'));var logger=require(_0x7d00('0x14'))('api');var utils=require(_0x7d00('0x15'));var config=require(_0x7d00('0x16'));var licenseUtil=require(_0x7d00('0x17'));var db=require(_0x7d00('0x18'))['db'];function respondWithStatusCode(_0x4f3659,_0x100bab){_0x100bab=_0x100bab||0xcc;return function(_0xa9ef5){if(_0xa9ef5){return _0x4f3659['sendStatus'](_0x100bab);}return _0x4f3659[_0x7d00('0x19')](_0x100bab)[_0x7d00('0x1a')]();};}function respondWithResult(_0x29d3f3,_0x8ea94b){_0x8ea94b=_0x8ea94b||0xc8;return function(_0x45d9b1){if(_0x45d9b1){return _0x29d3f3[_0x7d00('0x19')](_0x8ea94b)[_0x7d00('0x1b')](_0x45d9b1);}};}function respondWithFilteredResult(_0x2ec8ba,_0x73ceb){return function(_0x20ab4d){if(_0x20ab4d){var _0xcc254e=typeof _0x73ceb[_0x7d00('0x1c')]===_0x7d00('0x1d')&&typeof _0x73ceb['limit']===_0x7d00('0x1d');var _0x88460a=_0x20ab4d[_0x7d00('0x1e')];var _0x40b980=_0xcc254e?0x0:_0x73ceb[_0x7d00('0x1c')];var _0x4594a0=_0xcc254e?_0x20ab4d['count']:_0x73ceb['offset']+_0x73ceb['limit'];var _0x33b105;if(_0x4594a0>=_0x88460a){_0x4594a0=_0x88460a;_0x33b105=0xc8;}else{_0x33b105=0xce;}_0x2ec8ba[_0x7d00('0x19')](_0x33b105);return _0x2ec8ba['set'](_0x7d00('0x1f'),_0x40b980+'-'+_0x4594a0+'/'+_0x88460a)[_0x7d00('0x1b')](_0x20ab4d);}return null;};}function patchUpdates(_0xee5be){return function(_0x4b0713){try{jsonpatch[_0x7d00('0x20')](_0x4b0713,_0xee5be,!![]);}catch(_0x4c62c8){return BPromise[_0x7d00('0x21')](_0x4c62c8);}return _0x4b0713[_0x7d00('0x22')]();};}function saveUpdates(_0x483d7f,_0x37fb9e){return function(_0x5d3bfa){if(_0x5d3bfa){return _0x5d3bfa[_0x7d00('0x23')](_0x483d7f)[_0x7d00('0x24')](function(_0x41d859){return _0x41d859;});}return null;};}function removeEntity(_0x4d48a3,_0x3de720){return function(_0x1b89eb){if(_0x1b89eb){return _0x1b89eb[_0x7d00('0x25')]()[_0x7d00('0x24')](function(){_0x4d48a3[_0x7d00('0x19')](0xcc)[_0x7d00('0x1a')]();});}};}function handleEntityNotFound(_0x5ec76d,_0x508335){return function(_0x2f5bda){if(!_0x2f5bda){_0x5ec76d[_0x7d00('0x26')](0x194);}return _0x2f5bda;};}function handleError(_0x221b81,_0x45a157){_0x45a157=_0x45a157||0x1f4;return function(_0x332e21){logger[_0x7d00('0x27')](_0x332e21[_0x7d00('0x28')]);if(_0x332e21[_0x7d00('0x29')]){delete _0x332e21[_0x7d00('0x29')];}_0x221b81[_0x7d00('0x19')](_0x45a157)[_0x7d00('0x2a')](_0x332e21);};}exports['index']=function(_0x59c124,_0x153127){var _0x1c70bf={},_0x471700={},_0x4ad4ff={'count':0x0,'rows':[]};var _0x407bc3=_[_0x7d00('0x2b')](db[_0x7d00('0x2c')][_0x7d00('0x2d')],function(_0x26e2f0){return{'name':_0x26e2f0[_0x7d00('0x2e')],'type':_0x26e2f0['type'][_0x7d00('0x2f')]};});_0x471700['model']=_[_0x7d00('0x2b')](_0x407bc3,_0x7d00('0x29'));_0x471700[_0x7d00('0x30')]=_[_0x7d00('0x31')](_0x59c124['query']);_0x471700[_0x7d00('0x32')]=_['intersection'](_0x471700[_0x7d00('0x33')],_0x471700[_0x7d00('0x30')]);_0x1c70bf['attributes']=_[_0x7d00('0x34')](_0x471700['model'],qs[_0x7d00('0x35')](_0x59c124[_0x7d00('0x30')][_0x7d00('0x35')]));_0x1c70bf['attributes']=_0x1c70bf[_0x7d00('0x36')][_0x7d00('0x37')]?_0x1c70bf[_0x7d00('0x36')]:_0x471700[_0x7d00('0x33')];if(!_0x59c124['query'][_0x7d00('0x38')](_0x7d00('0x39'))){_0x1c70bf['limit']=qs[_0x7d00('0x3a')](_0x59c124[_0x7d00('0x30')]['limit']);_0x1c70bf[_0x7d00('0x1c')]=qs[_0x7d00('0x1c')](_0x59c124[_0x7d00('0x30')][_0x7d00('0x1c')]);}_0x1c70bf[_0x7d00('0x3b')]=qs['sort'](_0x59c124[_0x7d00('0x30')][_0x7d00('0x3c')]);_0x1c70bf['where']=qs[_0x7d00('0x32')](_[_0x7d00('0x3d')](_0x59c124[_0x7d00('0x30')],_0x471700[_0x7d00('0x32')]),_0x407bc3);if(_0x59c124[_0x7d00('0x30')][_0x7d00('0x3e')]){_0x1c70bf[_0x7d00('0x3f')]=_[_0x7d00('0x40')](_0x1c70bf[_0x7d00('0x3f')],{'$or':_[_0x7d00('0x2b')](_0x407bc3,function(_0x118ed4){if(_0x118ed4['type']!=='VIRTUAL'){var _0x4fa17b={};_0x4fa17b[_0x118ed4[_0x7d00('0x29')]]={'$like':'%'+_0x59c124[_0x7d00('0x30')][_0x7d00('0x3e')]+'%'};return _0x4fa17b;}})});}_0x1c70bf=_[_0x7d00('0x40')]({},_0x1c70bf,_0x59c124[_0x7d00('0x41')]);var _0x10f72d={'where':_0x1c70bf[_0x7d00('0x3f')]};return db[_0x7d00('0x2c')][_0x7d00('0x1e')](_0x10f72d)[_0x7d00('0x24')](function(_0x7a7ddf){_0x4ad4ff[_0x7d00('0x1e')]=_0x7a7ddf;if(_0x59c124['query'][_0x7d00('0x42')]){_0x1c70bf[_0x7d00('0x43')]=[{'all':!![]}];}return db[_0x7d00('0x2c')][_0x7d00('0x44')](_0x1c70bf);})[_0x7d00('0x24')](function(_0x5df36a){_0x4ad4ff[_0x7d00('0x45')]=_0x5df36a;return _0x4ad4ff;})[_0x7d00('0x24')](respondWithFilteredResult(_0x153127,_0x1c70bf))['catch'](handleError(_0x153127,null));};exports['show']=function(_0x10cbe3,_0x4c2c14){var _0x2e982b={'raw':!![],'where':{'id':_0x10cbe3[_0x7d00('0x46')]['id']}},_0x47bf6b={};_0x47bf6b[_0x7d00('0x33')]=_[_0x7d00('0x31')](db[_0x7d00('0x2c')][_0x7d00('0x2d')]);_0x47bf6b[_0x7d00('0x30')]=_[_0x7d00('0x31')](_0x10cbe3[_0x7d00('0x30')]);_0x47bf6b['filters']=_[_0x7d00('0x34')](_0x47bf6b['model'],_0x47bf6b[_0x7d00('0x30')]);_0x2e982b[_0x7d00('0x36')]=_[_0x7d00('0x34')](_0x47bf6b['model'],qs[_0x7d00('0x35')](_0x10cbe3[_0x7d00('0x30')][_0x7d00('0x35')]));_0x2e982b[_0x7d00('0x36')]=_0x2e982b[_0x7d00('0x36')][_0x7d00('0x37')]?_0x2e982b[_0x7d00('0x36')]:_0x47bf6b['model'];if(_0x10cbe3[_0x7d00('0x30')][_0x7d00('0x42')]){_0x2e982b['include']=[{'all':!![]}];}_0x2e982b=_[_0x7d00('0x40')]({},_0x2e982b,_0x10cbe3[_0x7d00('0x41')]);return db[_0x7d00('0x2c')][_0x7d00('0x47')](_0x2e982b)[_0x7d00('0x24')](handleEntityNotFound(_0x4c2c14,null))[_0x7d00('0x24')](respondWithResult(_0x4c2c14,null))[_0x7d00('0x48')](handleError(_0x4c2c14,null));};exports[_0x7d00('0x49')]=function(_0x3663ff,_0x355db4){return db['OpenchannelTransferReport'][_0x7d00('0x49')](_0x3663ff['body'],{})[_0x7d00('0x24')](respondWithResult(_0x355db4,0xc9))[_0x7d00('0x48')](handleError(_0x355db4,null));};exports['update']=function(_0x23c6ed,_0x271d0b){if(_0x23c6ed[_0x7d00('0x4a')]['id']){delete _0x23c6ed[_0x7d00('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0x7d00('0x47')]({'where':{'id':_0x23c6ed[_0x7d00('0x46')]['id']}})[_0x7d00('0x24')](handleEntityNotFound(_0x271d0b,null))[_0x7d00('0x24')](saveUpdates(_0x23c6ed['body'],null))[_0x7d00('0x24')](respondWithResult(_0x271d0b,null))[_0x7d00('0x48')](handleError(_0x271d0b,null));};exports['destroy']=function(_0x54b658,_0x53d635){return db['OpenchannelTransferReport'][_0x7d00('0x47')]({'where':{'id':_0x54b658[_0x7d00('0x46')]['id']}})[_0x7d00('0x24')](handleEntityNotFound(_0x53d635,null))[_0x7d00('0x24')](removeEntity(_0x53d635,null))['catch'](handleError(_0x53d635,null));};exports['describe']=function(_0x1539fd,_0x4d0e13){return db[_0x7d00('0x2c')]['describe']()[_0x7d00('0x24')](respondWithResult(_0x4d0e13,null))[_0x7d00('0x48')](handleError(_0x4d0e13,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a453b6d..efdf47f 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 _0x929b=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x1b675d,_0x330201){var _0x4d706e=function(_0x49ad87){while(--_0x49ad87){_0x1b675d['push'](_0x1b675d['shift']());}};_0x4d706e(++_0x330201);}(_0x929b,0x6d));var _0xb929=function(_0x31ade7,_0x4a2dab){_0x31ade7=_0x31ade7-0x0;var _0x1b20ad=_0x929b[_0x31ade7];return _0x1b20ad;};'use strict';var _=require(_0xb929('0x0'));var util=require(_0xb929('0x1'));var logger=require('../../config/logger')(_0xb929('0x2'));var moment=require(_0xb929('0x3'));var BPromise=require(_0xb929('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb929('0x5'));var rimraf=require(_0xb929('0x6'));var config=require(_0xb929('0x7'));var attributes=require(_0xb929('0x8'));module[_0xb929('0x9')]=function(_0x35f297,_0x3c0e0f){return _0x35f297[_0xb929('0xa')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb929('0xb'),'fields':[_0xb929('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x127d=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport'];(function(_0x218899,_0x4ccc76){var _0x199aa1=function(_0x37fad6){while(--_0x37fad6){_0x218899['push'](_0x218899['shift']());}};_0x199aa1(++_0x4ccc76);}(_0x127d,0x9e));var _0xd127=function(_0x32eabf,_0x1a6dfe){_0x32eabf=_0x32eabf-0x0;var _0xeebf76=_0x127d[_0x32eabf];return _0xeebf76;};'use strict';var _=require(_0xd127('0x0'));var util=require(_0xd127('0x1'));var logger=require(_0xd127('0x2'))(_0xd127('0x3'));var moment=require('moment');var BPromise=require(_0xd127('0x4'));var rp=require(_0xd127('0x5'));var fs=require('fs');var path=require(_0xd127('0x6'));var rimraf=require('rimraf');var config=require(_0xd127('0x7'));var attributes=require(_0xd127('0x8'));module['exports']=function(_0x1e6d46,_0x194400){return _0x1e6d46[_0xd127('0x9')](_0xd127('0xa'),attributes,{'tableName':_0xd127('0xb'),'paranoid':![],'indexes':[{'name':_0xd127('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index ada3b3f..1249833 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 _0x5183=['../../config/utils','../../config/logger','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x5183,0x13e));var _0x3518=function(_0x58f30a,_0x2885ee){_0x58f30a=_0x58f30a-0x0;var _0x46225d=_0x5183[_0x58f30a];return _0x46225d;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var moment=require(_0x3518('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3518('0x3'));var db=require(_0x3518('0x4'))['db'];var utils=require(_0x3518('0x5'));var logger=require(_0x3518('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3518('0x7'));var client=jayson[_0x3518('0x8')][_0x3518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482b2d,_0x5cd139,_0x488c52){return new BPromise(function(_0x147b59,_0x33e66c){return client[_0x3518('0xa')](_0x482b2d,_0x488c52)['then'](function(_0x12530b){logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));logger[_0x3518('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5cd139,_0x3518('0xc'),JSON[_0x3518('0xe')](_0x12530b));if(_0x12530b['error']){if(_0x12530b[_0x3518('0xf')][_0x3518('0x10')]===0x1f4){logger[_0x3518('0xf')](_0x3518('0xb'),_0x5cd139,_0x12530b['error']['message']);return _0x33e66c(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}logger[_0x3518('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5cd139,_0x12530b['error'][_0x3518('0x11')]);return _0x147b59(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}else{logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));_0x147b59(_0x12530b[_0x3518('0x12')][_0x3518('0x11')]);}})['catch'](function(_0xc7f658){logger['error'](_0x3518('0xb'),_0x5cd139,_0xc7f658);_0x33e66c(_0xc7f658);});});} \ No newline at end of file +var _0xac95=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x307e7e,_0x5b7197){var _0x1941b6=function(_0x1c5bf4){while(--_0x1c5bf4){_0x307e7e['push'](_0x307e7e['shift']());}};_0x1941b6(++_0x5b7197);}(_0xac95,0xa8));var _0x5ac9=function(_0x43da1a,_0x1c2c08){_0x43da1a=_0x43da1a-0x0;var _0x1c515b=_0xac95[_0x43da1a];return _0x1c515b;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));var BPromise=require(_0x5ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac9('0x4'))['db'];var utils=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x8')][_0x5ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8675ec,_0x4bddcf,_0x4dffb8){return new BPromise(function(_0x32afbc,_0x2ab11c){return client[_0x5ac9('0xa')](_0x8675ec,_0x4dffb8)[_0x5ac9('0xb')](function(_0x397bb8){logger[_0x5ac9('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'));logger[_0x5ac9('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'),JSON['stringify'](_0x397bb8));if(_0x397bb8[_0x5ac9('0xf')]){if(_0x397bb8['error'][_0x5ac9('0x10')]===0x1f4){logger[_0x5ac9('0xf')](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x2ab11c(_0x397bb8['error'][_0x5ac9('0x12')]);}logger['error'](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x32afbc(_0x397bb8[_0x5ac9('0xf')][_0x5ac9('0x12')]);}else{logger[_0x5ac9('0xc')](_0x5ac9('0x11'),_0x4bddcf,_0x5ac9('0xd'));_0x32afbc(_0x397bb8[_0x5ac9('0x13')][_0x5ac9('0x12')]);}})[_0x5ac9('0x14')](function(_0x460fd7){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bddcf,_0x460fd7);_0x2ab11c(_0x460fd7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 635086e..0ffb5b2 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 _0x76cc=['put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','show','post','create'];(function(_0x21b283,_0x46d64a){var _0x14631a=function(_0x4d2432){while(--_0x4d2432){_0x21b283['push'](_0x21b283['shift']());}};_0x14631a(++_0x46d64a);}(_0x76cc,0x117));var _0xc76c=function(_0x50dac3,_0x1cc598){_0x50dac3=_0x50dac3-0x0;var _0x404596=_0x76cc[_0x50dac3];return _0x404596;};'use strict';var multer=require(_0xc76c('0x0'));var util=require(_0xc76c('0x1'));var path=require('path');var timeout=require(_0xc76c('0x2'));var express=require(_0xc76c('0x3'));var router=express[_0xc76c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc76c('0x5'));var interaction=require(_0xc76c('0x6'));var config=require(_0xc76c('0x7'));var controller=require(_0xc76c('0x8'));router['get']('/',auth[_0xc76c('0x9')](),controller[_0xc76c('0xa')]);router[_0xc76c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc76c('0xc')]);router[_0xc76c('0xd')]('/',auth[_0xc76c('0x9')](),controller[_0xc76c('0xe')]);router[_0xc76c('0xf')]('/:id',auth[_0xc76c('0x9')](),controller[_0xc76c('0x10')]);router[_0xc76c('0x11')](_0xc76c('0x12'),auth[_0xc76c('0x9')](),controller[_0xc76c('0x13')]);module[_0xc76c('0x14')]=router; \ No newline at end of file +var _0xf34c=['express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1c461e,_0x1b98ff){var _0x1dce4f=function(_0x5cbdf0){while(--_0x5cbdf0){_0x1c461e['push'](_0x1c461e['shift']());}};_0x1dce4f(++_0x1b98ff);}(_0xf34c,0x10d));var _0xcf34=function(_0x2a07b0,_0x3151e2){_0x2a07b0=_0x2a07b0-0x0;var _0x55a518=_0xf34c[_0x2a07b0];return _0x55a518;};'use strict';var multer=require(_0xcf34('0x0'));var util=require(_0xcf34('0x1'));var path=require(_0xcf34('0x2'));var timeout=require(_0xcf34('0x3'));var express=require(_0xcf34('0x4'));var router=express[_0xcf34('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcf34('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf34('0x7'));var controller=require(_0xcf34('0x8'));router[_0xcf34('0x9')]('/',auth['isAuthenticated'](),controller[_0xcf34('0xa')]);router['get'](_0xcf34('0xb'),auth[_0xcf34('0xc')](),controller[_0xcf34('0xd')]);router[_0xcf34('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf34('0xf')]);router[_0xcf34('0x10')](_0xcf34('0xb'),auth[_0xcf34('0xc')](),controller[_0xcf34('0x11')]);router[_0xcf34('0x12')]('/:id',auth[_0xcf34('0xc')](),controller[_0xcf34('0x13')]);module[_0xcf34('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 09be750..5027bf4 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 _0xd2b3=['name','sequelize','exports'];(function(_0x4019ba,_0x8ae1c1){var _0x1ac2d2=function(_0x5b8f11){while(--_0x5b8f11){_0x4019ba['push'](_0x4019ba['shift']());}};_0x1ac2d2(++_0x8ae1c1);}(_0xd2b3,0x85));var _0x3d2b=function(_0x10cbe6,_0x4ff42e){_0x10cbe6=_0x10cbe6-0x0;var _0x597166=_0xd2b3[_0x10cbe6];return _0x597166;};'use strict';var Sequelize=require(_0x3d2b('0x0'));module[_0x3d2b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3d2b('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x80d9=['STRING','name','sequelize','exports'];(function(_0xea897b,_0x269096){var _0x8a736e=function(_0x2b13b6){while(--_0x2b13b6){_0xea897b['push'](_0xea897b['shift']());}};_0x8a736e(++_0x269096);}(_0x80d9,0xca));var _0x980d=function(_0x2c46ba,_0x2b6948){_0x2c46ba=_0x2c46ba-0x0;var _0x7dc2e9=_0x80d9[_0x2c46ba];return _0x7dc2e9;};'use strict';var Sequelize=require(_0x980d('0x0'));module[_0x980d('0x1')]={'name':{'type':Sequelize[_0x980d('0x2')],'unique':_0x980d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x980d('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ce99117..edd73f5 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 _0xbdfb=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Pauses','UserProfileResource','destroy','then','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format'];(function(_0x4fc2b6,_0x2698bc){var _0xb20b54=function(_0x288194){while(--_0x288194){_0x4fc2b6['push'](_0x4fc2b6['shift']());}};_0xb20b54(++_0x2698bc);}(_0xbdfb,0x185));var _0xbbdf=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xbdfb[_0x2e76a7];return _0x454cde;};'use strict';var emlformat=require(_0xbbdf('0x0'));var rimraf=require(_0xbbdf('0x1'));var zipdir=require(_0xbbdf('0x2'));var jsonpatch=require(_0xbbdf('0x3'));var rp=require('request-promise');var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbbdf('0x6'));var sox=require('sox');var csv=require(_0xbbdf('0x7'));var ejs=require(_0xbbdf('0x8'));var fs=require('fs');var fs_extra=require(_0xbbdf('0x9'));var _=require('lodash');var squel=require(_0xbbdf('0xa'));var crypto=require('crypto');var jsforce=require(_0xbbdf('0xb'));var deskjs=require(_0xbbdf('0xc'));var toCsv=require(_0xbbdf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbbdf('0xd'));var authService=require(_0xbbdf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbbdf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbbdf('0x10'));var config=require(_0xbbdf('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbdf('0x12'))['db'];function respondWithStatusCode(_0x1a8626,_0x530f11){_0x530f11=_0x530f11||0xcc;return function(_0x31c461){if(_0x31c461){return _0x1a8626[_0xbbdf('0x13')](_0x530f11);}return _0x1a8626[_0xbbdf('0x14')](_0x530f11)[_0xbbdf('0x15')]();};}function respondWithResult(_0x38e37e,_0x16a760){_0x16a760=_0x16a760||0xc8;return function(_0x88bde5){if(_0x88bde5){return _0x38e37e['status'](_0x16a760)[_0xbbdf('0x16')](_0x88bde5);}};}function respondWithFilteredResult(_0x426d1e,_0x78687b){return function(_0x5b2ac7){if(_0x5b2ac7){var _0x46eff5=typeof _0x78687b[_0xbbdf('0x17')]==='undefined'&&typeof _0x78687b[_0xbbdf('0x18')]===_0xbbdf('0x19');var _0x4bb868=_0x5b2ac7[_0xbbdf('0x1a')];var _0x1324c8=_0x46eff5?0x0:_0x78687b[_0xbbdf('0x17')];var _0x516e44=_0x46eff5?_0x5b2ac7[_0xbbdf('0x1a')]:_0x78687b[_0xbbdf('0x17')]+_0x78687b[_0xbbdf('0x18')];var _0x328e0b;if(_0x516e44>=_0x4bb868){_0x516e44=_0x4bb868;_0x328e0b=0xc8;}else{_0x328e0b=0xce;}_0x426d1e[_0xbbdf('0x14')](_0x328e0b);return _0x426d1e[_0xbbdf('0x1b')](_0xbbdf('0x1c'),_0x1324c8+'-'+_0x516e44+'/'+_0x4bb868)['json'](_0x5b2ac7);}return null;};}function patchUpdates(_0x55813b){return function(_0x2c31d7){try{jsonpatch['apply'](_0x2c31d7,_0x55813b,!![]);}catch(_0x565968){return BPromise[_0xbbdf('0x1d')](_0x565968);}return _0x2c31d7[_0xbbdf('0x1e')]();};}function saveUpdates(_0x285378,_0x48c18c){return function(_0x3eaddc){if(_0x3eaddc){return _0x3eaddc['update'](_0x285378)['then'](function(_0x289477){return _0x289477;});}return null;};}function removeEntity(_0x39af84,_0x541402){return function(_0x8fbbd0){if(_0x8fbbd0){return _0x8fbbd0['destroy']()['then'](function(){var _0x3a0293=_0x8fbbd0[_0xbbdf('0x1f')]({'plain':!![]});var _0x3d7b04=_0xbbdf('0x20');return db[_0xbbdf('0x21')][_0xbbdf('0x22')]({'where':{'type':_0x3d7b04,'resourceId':_0x3a0293['id']}})[_0xbbdf('0x23')](function(){return _0x8fbbd0;});})[_0xbbdf('0x23')](function(){_0x39af84[_0xbbdf('0x14')](0xcc)[_0xbbdf('0x15')]();});}};}function handleEntityNotFound(_0x199905,_0x225921){return function(_0xa8e6e){if(!_0xa8e6e){_0x199905[_0xbbdf('0x13')](0x194);}return _0xa8e6e;};}function handleError(_0x4abf36,_0x148cab){_0x148cab=_0x148cab||0x1f4;return function(_0x5b49f5){logger[_0xbbdf('0x24')](_0x5b49f5[_0xbbdf('0x25')]);if(_0x5b49f5[_0xbbdf('0x26')]){delete _0x5b49f5[_0xbbdf('0x26')];}_0x4abf36[_0xbbdf('0x14')](_0x148cab)[_0xbbdf('0x27')](_0x5b49f5);};}exports[_0xbbdf('0x28')]=function(_0x2ed408,_0x1c726e){var _0x53ac64={},_0x360a10={},_0x230d06={'count':0x0,'rows':[]};var _0x3e1127=_['map'](db[_0xbbdf('0x29')][_0xbbdf('0x2a')],function(_0x2960f3){return{'name':_0x2960f3[_0xbbdf('0x2b')],'type':_0x2960f3[_0xbbdf('0x2c')][_0xbbdf('0x2d')]};});_0x360a10['model']=_[_0xbbdf('0x2e')](_0x3e1127,'name');_0x360a10[_0xbbdf('0x2f')]=_[_0xbbdf('0x30')](_0x2ed408['query']);_0x360a10[_0xbbdf('0x31')]=_[_0xbbdf('0x32')](_0x360a10['model'],_0x360a10[_0xbbdf('0x2f')]);_0x53ac64[_0xbbdf('0x33')]=_[_0xbbdf('0x32')](_0x360a10[_0xbbdf('0x34')],qs[_0xbbdf('0x35')](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x35')]));_0x53ac64[_0xbbdf('0x33')]=_0x53ac64['attributes'][_0xbbdf('0x36')]?_0x53ac64['attributes']:_0x360a10[_0xbbdf('0x34')];if(!_0x2ed408[_0xbbdf('0x2f')]['hasOwnProperty'](_0xbbdf('0x37'))){_0x53ac64[_0xbbdf('0x18')]=qs['limit'](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x18')]);_0x53ac64[_0xbbdf('0x17')]=qs[_0xbbdf('0x17')](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x17')]);}_0x53ac64['order']=qs[_0xbbdf('0x38')](_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x38')]);_0x53ac64[_0xbbdf('0x39')]=qs[_0xbbdf('0x31')](_[_0xbbdf('0x3a')](_0x2ed408[_0xbbdf('0x2f')],_0x360a10[_0xbbdf('0x31')]),_0x3e1127);if(_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x3b')]){_0x53ac64[_0xbbdf('0x39')]=_[_0xbbdf('0x3c')](_0x53ac64[_0xbbdf('0x39')],{'$or':_[_0xbbdf('0x2e')](_0x3e1127,function(_0x3632d7){if(_0x3632d7[_0xbbdf('0x2c')]!==_0xbbdf('0x3d')){var _0x9c6b52={};_0x9c6b52[_0x3632d7[_0xbbdf('0x26')]]={'$like':'%'+_0x2ed408[_0xbbdf('0x2f')][_0xbbdf('0x3b')]+'%'};return _0x9c6b52;}})});}_0x53ac64=_[_0xbbdf('0x3c')]({},_0x53ac64,_0x2ed408[_0xbbdf('0x3e')]);var _0x26c260={'where':_0x53ac64[_0xbbdf('0x39')]};return db[_0xbbdf('0x29')]['count'](_0x26c260)[_0xbbdf('0x23')](function(_0x4bf8e9){_0x230d06['count']=_0x4bf8e9;if(_0x2ed408['query'][_0xbbdf('0x3f')]){_0x53ac64[_0xbbdf('0x40')]=[{'all':!![]}];}return db[_0xbbdf('0x29')][_0xbbdf('0x41')](_0x53ac64);})['then'](function(_0x141ef3){_0x230d06['rows']=_0x141ef3;return _0x230d06;})[_0xbbdf('0x23')](respondWithFilteredResult(_0x1c726e,_0x53ac64))[_0xbbdf('0x42')](handleError(_0x1c726e,null));};exports[_0xbbdf('0x43')]=function(_0x520d2e,_0x48b52d){var _0x194a2a={'raw':!![],'where':{'id':_0x520d2e[_0xbbdf('0x44')]['id']}},_0xb73349={};_0xb73349['model']=_[_0xbbdf('0x30')](db[_0xbbdf('0x29')]['rawAttributes']);_0xb73349[_0xbbdf('0x2f')]=_[_0xbbdf('0x30')](_0x520d2e[_0xbbdf('0x2f')]);_0xb73349[_0xbbdf('0x31')]=_[_0xbbdf('0x32')](_0xb73349[_0xbbdf('0x34')],_0xb73349['query']);_0x194a2a[_0xbbdf('0x33')]=_[_0xbbdf('0x32')](_0xb73349['model'],qs[_0xbbdf('0x35')](_0x520d2e[_0xbbdf('0x2f')][_0xbbdf('0x35')]));_0x194a2a['attributes']=_0x194a2a[_0xbbdf('0x33')]['length']?_0x194a2a[_0xbbdf('0x33')]:_0xb73349['model'];if(_0x520d2e[_0xbbdf('0x2f')]['includeAll']){_0x194a2a[_0xbbdf('0x40')]=[{'all':!![]}];}_0x194a2a=_['merge']({},_0x194a2a,_0x520d2e[_0xbbdf('0x3e')]);return db[_0xbbdf('0x29')][_0xbbdf('0x45')](_0x194a2a)['then'](handleEntityNotFound(_0x48b52d,null))[_0xbbdf('0x23')](respondWithResult(_0x48b52d,null))[_0xbbdf('0x42')](handleError(_0x48b52d,null));};exports[_0xbbdf('0x46')]=function(_0x463d30,_0x38e6ce){return db[_0xbbdf('0x29')][_0xbbdf('0x46')](_0x463d30[_0xbbdf('0x47')],{})[_0xbbdf('0x23')](function(_0x584576){var _0x52354e=_0x463d30['user'][_0xbbdf('0x1f')]({'plain':!![]});if(!_0x52354e)throw new Error(_0xbbdf('0x48'));if(_0x52354e[_0xbbdf('0x49')]===_0xbbdf('0x4a')){var _0x31a180=_0x584576[_0xbbdf('0x1f')]({'plain':!![]});var _0x3818ff=_0xbbdf('0x20');return db['UserProfileSection'][_0xbbdf('0x45')]({'where':{'name':_0x3818ff,'userProfileId':_0x52354e[_0xbbdf('0x4b')]},'raw':!![]})['then'](function(_0x3c4129){if(_0x3c4129&&_0x3c4129['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x31a180[_0xbbdf('0x26')],'resourceId':_0x31a180['id'],'type':_0x3c4129[_0xbbdf('0x26')],'sectionId':_0x3c4129['id']},{})[_0xbbdf('0x23')](function(){return _0x584576;});}else{return _0x584576;}})[_0xbbdf('0x42')](function(_0xdda3ac){logger[_0xbbdf('0x24')](_0xbbdf('0x4c'),_0xdda3ac);throw _0xdda3ac;});}return _0x584576;})[_0xbbdf('0x23')](respondWithResult(_0x38e6ce,0xc9))['catch'](handleError(_0x38e6ce,null));};exports[_0xbbdf('0x4d')]=function(_0x4a2660,_0x5f4270){if(_0x4a2660[_0xbbdf('0x47')]['id']){delete _0x4a2660['body']['id'];}return db[_0xbbdf('0x29')][_0xbbdf('0x45')]({'where':{'id':_0x4a2660[_0xbbdf('0x44')]['id']}})[_0xbbdf('0x23')](handleEntityNotFound(_0x5f4270,null))[_0xbbdf('0x23')](saveUpdates(_0x4a2660[_0xbbdf('0x47')],null))['then'](respondWithResult(_0x5f4270,null))[_0xbbdf('0x42')](handleError(_0x5f4270,null));};exports[_0xbbdf('0x22')]=function(_0x4fee5b,_0x465501){return db[_0xbbdf('0x29')][_0xbbdf('0x45')]({'where':{'id':_0x4fee5b[_0xbbdf('0x44')]['id']}})[_0xbbdf('0x23')](handleEntityNotFound(_0x465501,null))[_0xbbdf('0x23')](removeEntity(_0x465501,null))['catch'](handleError(_0x465501,null));}; \ No newline at end of file +var _0x3e23=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','Pauses','UserProfileResource','end','name','index','map','Pause','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x196e1f,_0x18a7e1){var _0x2b5e77=function(_0x32ff81){while(--_0x32ff81){_0x196e1f['push'](_0x196e1f['shift']());}};_0x2b5e77(++_0x18a7e1);}(_0x3e23,0x88));var _0x33e2=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0x3e23[_0x548200];return _0x1a6d74;};'use strict';var emlformat=require(_0x33e2('0x0'));var rimraf=require(_0x33e2('0x1'));var zipdir=require(_0x33e2('0x2'));var jsonpatch=require(_0x33e2('0x3'));var rp=require(_0x33e2('0x4'));var moment=require(_0x33e2('0x5'));var BPromise=require(_0x33e2('0x6'));var Mustache=require(_0x33e2('0x7'));var util=require(_0x33e2('0x8'));var path=require(_0x33e2('0x9'));var sox=require('sox');var csv=require(_0x33e2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33e2('0xb'));var squel=require('squel');var crypto=require(_0x33e2('0xc'));var jsforce=require(_0x33e2('0xd'));var deskjs=require(_0x33e2('0xe'));var toCsv=require(_0x33e2('0xa'));var querystring=require(_0x33e2('0xf'));var Papa=require(_0x33e2('0x10'));var Redis=require(_0x33e2('0x11'));var authService=require(_0x33e2('0x12'));var qs=require(_0x33e2('0x13'));var as=require(_0x33e2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x33e2('0x15'));var config=require(_0x33e2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x33e2('0x17'))['db'];function respondWithStatusCode(_0x48ff08,_0x45a9ac){_0x45a9ac=_0x45a9ac||0xcc;return function(_0x275633){if(_0x275633){return _0x48ff08[_0x33e2('0x18')](_0x45a9ac);}return _0x48ff08[_0x33e2('0x19')](_0x45a9ac)['end']();};}function respondWithResult(_0x136762,_0x1fd661){_0x1fd661=_0x1fd661||0xc8;return function(_0x3d493e){if(_0x3d493e){return _0x136762[_0x33e2('0x19')](_0x1fd661)[_0x33e2('0x1a')](_0x3d493e);}};}function respondWithFilteredResult(_0x49fd00,_0x509c4b){return function(_0x5a1e2b){if(_0x5a1e2b){var _0x5f57cf=typeof _0x509c4b[_0x33e2('0x1b')]===_0x33e2('0x1c')&&typeof _0x509c4b[_0x33e2('0x1d')]==='undefined';var _0x4f1909=_0x5a1e2b[_0x33e2('0x1e')];var _0x13c170=_0x5f57cf?0x0:_0x509c4b[_0x33e2('0x1b')];var _0x2bda9a=_0x5f57cf?_0x5a1e2b[_0x33e2('0x1e')]:_0x509c4b[_0x33e2('0x1b')]+_0x509c4b[_0x33e2('0x1d')];var _0x3c7089;if(_0x2bda9a>=_0x4f1909){_0x2bda9a=_0x4f1909;_0x3c7089=0xc8;}else{_0x3c7089=0xce;}_0x49fd00[_0x33e2('0x19')](_0x3c7089);return _0x49fd00[_0x33e2('0x1f')](_0x33e2('0x20'),_0x13c170+'-'+_0x2bda9a+'/'+_0x4f1909)[_0x33e2('0x1a')](_0x5a1e2b);}return null;};}function patchUpdates(_0x141ad3){return function(_0x524b5f){try{jsonpatch[_0x33e2('0x21')](_0x524b5f,_0x141ad3,!![]);}catch(_0x4f183c){return BPromise[_0x33e2('0x22')](_0x4f183c);}return _0x524b5f['save']();};}function saveUpdates(_0x50a103,_0x5ed7a9){return function(_0x2f0528){if(_0x2f0528){return _0x2f0528['update'](_0x50a103)[_0x33e2('0x23')](function(_0xde0a03){return _0xde0a03;});}return null;};}function removeEntity(_0x286f16,_0x5f1ee2){return function(_0x223bcf){if(_0x223bcf){return _0x223bcf['destroy']()[_0x33e2('0x23')](function(){var _0x2991f1=_0x223bcf[_0x33e2('0x24')]({'plain':!![]});var _0x29df61=_0x33e2('0x25');return db[_0x33e2('0x26')]['destroy']({'where':{'type':_0x29df61,'resourceId':_0x2991f1['id']}})['then'](function(){return _0x223bcf;});})[_0x33e2('0x23')](function(){_0x286f16[_0x33e2('0x19')](0xcc)[_0x33e2('0x27')]();});}};}function handleEntityNotFound(_0x418d38,_0x3ef757){return function(_0x559e77){if(!_0x559e77){_0x418d38[_0x33e2('0x18')](0x194);}return _0x559e77;};}function handleError(_0x419139,_0x214a9b){_0x214a9b=_0x214a9b||0x1f4;return function(_0x1dd863){logger['error'](_0x1dd863['stack']);if(_0x1dd863['name']){delete _0x1dd863[_0x33e2('0x28')];}_0x419139['status'](_0x214a9b)['send'](_0x1dd863);};}exports[_0x33e2('0x29')]=function(_0x457c7d,_0x17a3f0){var _0x216f53={},_0x324b68={},_0x20a1d1={'count':0x0,'rows':[]};var _0x2f347d=_[_0x33e2('0x2a')](db[_0x33e2('0x2b')]['rawAttributes'],function(_0x17d94d){return{'name':_0x17d94d[_0x33e2('0x2c')],'type':_0x17d94d['type'][_0x33e2('0x2d')]};});_0x324b68[_0x33e2('0x2e')]=_['map'](_0x2f347d,'name');_0x324b68[_0x33e2('0x2f')]=_[_0x33e2('0x30')](_0x457c7d[_0x33e2('0x2f')]);_0x324b68[_0x33e2('0x31')]=_['intersection'](_0x324b68[_0x33e2('0x2e')],_0x324b68[_0x33e2('0x2f')]);_0x216f53[_0x33e2('0x32')]=_[_0x33e2('0x33')](_0x324b68[_0x33e2('0x2e')],qs[_0x33e2('0x34')](_0x457c7d[_0x33e2('0x2f')][_0x33e2('0x34')]));_0x216f53[_0x33e2('0x32')]=_0x216f53[_0x33e2('0x32')]['length']?_0x216f53[_0x33e2('0x32')]:_0x324b68[_0x33e2('0x2e')];if(!_0x457c7d[_0x33e2('0x2f')][_0x33e2('0x35')]('nolimit')){_0x216f53['limit']=qs[_0x33e2('0x1d')](_0x457c7d[_0x33e2('0x2f')][_0x33e2('0x1d')]);_0x216f53[_0x33e2('0x1b')]=qs[_0x33e2('0x1b')](_0x457c7d[_0x33e2('0x2f')][_0x33e2('0x1b')]);}_0x216f53[_0x33e2('0x36')]=qs[_0x33e2('0x37')](_0x457c7d[_0x33e2('0x2f')][_0x33e2('0x37')]);_0x216f53[_0x33e2('0x38')]=qs[_0x33e2('0x31')](_[_0x33e2('0x39')](_0x457c7d[_0x33e2('0x2f')],_0x324b68[_0x33e2('0x31')]),_0x2f347d);if(_0x457c7d['query'][_0x33e2('0x3a')]){_0x216f53['where']=_[_0x33e2('0x3b')](_0x216f53[_0x33e2('0x38')],{'$or':_[_0x33e2('0x2a')](_0x2f347d,function(_0x4791e2){if(_0x4791e2['type']!==_0x33e2('0x3c')){var _0x100911={};_0x100911[_0x4791e2[_0x33e2('0x28')]]={'$like':'%'+_0x457c7d[_0x33e2('0x2f')][_0x33e2('0x3a')]+'%'};return _0x100911;}})});}_0x216f53=_[_0x33e2('0x3b')]({},_0x216f53,_0x457c7d[_0x33e2('0x3d')]);var _0x49bb8f={'where':_0x216f53[_0x33e2('0x38')]};return db[_0x33e2('0x2b')][_0x33e2('0x1e')](_0x49bb8f)['then'](function(_0x33b879){_0x20a1d1['count']=_0x33b879;if(_0x457c7d['query'][_0x33e2('0x3e')]){_0x216f53[_0x33e2('0x3f')]=[{'all':!![]}];}return db[_0x33e2('0x2b')][_0x33e2('0x40')](_0x216f53);})[_0x33e2('0x23')](function(_0xb64efb){_0x20a1d1['rows']=_0xb64efb;return _0x20a1d1;})['then'](respondWithFilteredResult(_0x17a3f0,_0x216f53))[_0x33e2('0x41')](handleError(_0x17a3f0,null));};exports[_0x33e2('0x42')]=function(_0x11b313,_0xa988d4){var _0xe69bf6={'raw':!![],'where':{'id':_0x11b313[_0x33e2('0x43')]['id']}},_0x15fc6a={};_0x15fc6a['model']=_['keys'](db[_0x33e2('0x2b')]['rawAttributes']);_0x15fc6a[_0x33e2('0x2f')]=_[_0x33e2('0x30')](_0x11b313[_0x33e2('0x2f')]);_0x15fc6a[_0x33e2('0x31')]=_[_0x33e2('0x33')](_0x15fc6a[_0x33e2('0x2e')],_0x15fc6a[_0x33e2('0x2f')]);_0xe69bf6[_0x33e2('0x32')]=_[_0x33e2('0x33')](_0x15fc6a[_0x33e2('0x2e')],qs['fields'](_0x11b313[_0x33e2('0x2f')][_0x33e2('0x34')]));_0xe69bf6[_0x33e2('0x32')]=_0xe69bf6['attributes'][_0x33e2('0x44')]?_0xe69bf6[_0x33e2('0x32')]:_0x15fc6a[_0x33e2('0x2e')];if(_0x11b313[_0x33e2('0x2f')][_0x33e2('0x3e')]){_0xe69bf6[_0x33e2('0x3f')]=[{'all':!![]}];}_0xe69bf6=_['merge']({},_0xe69bf6,_0x11b313[_0x33e2('0x3d')]);return db[_0x33e2('0x2b')]['find'](_0xe69bf6)[_0x33e2('0x23')](handleEntityNotFound(_0xa988d4,null))[_0x33e2('0x23')](respondWithResult(_0xa988d4,null))[_0x33e2('0x41')](handleError(_0xa988d4,null));};exports[_0x33e2('0x45')]=function(_0x1abeaf,_0xd04afe){return db[_0x33e2('0x2b')][_0x33e2('0x45')](_0x1abeaf[_0x33e2('0x46')],{})[_0x33e2('0x23')](function(_0x158cdc){var _0x512abd=_0x1abeaf[_0x33e2('0x47')][_0x33e2('0x24')]({'plain':!![]});if(!_0x512abd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x512abd[_0x33e2('0x48')]===_0x33e2('0x47')){var _0x398b38=_0x158cdc['get']({'plain':!![]});var _0x231533=_0x33e2('0x25');return db[_0x33e2('0x49')][_0x33e2('0x4a')]({'where':{'name':_0x231533,'userProfileId':_0x512abd[_0x33e2('0x4b')]},'raw':!![]})[_0x33e2('0x23')](function(_0x1956e8){if(_0x1956e8&&_0x1956e8['autoAssociation']===0x0){return db[_0x33e2('0x26')][_0x33e2('0x45')]({'name':_0x398b38['name'],'resourceId':_0x398b38['id'],'type':_0x1956e8['name'],'sectionId':_0x1956e8['id']},{})[_0x33e2('0x23')](function(){return _0x158cdc;});}else{return _0x158cdc;}})[_0x33e2('0x41')](function(_0x1f62ce){logger[_0x33e2('0x4c')](_0x33e2('0x4d'),_0x1f62ce);throw _0x1f62ce;});}return _0x158cdc;})['then'](respondWithResult(_0xd04afe,0xc9))[_0x33e2('0x41')](handleError(_0xd04afe,null));};exports[_0x33e2('0x4e')]=function(_0x7a0333,_0x6d1b4a){if(_0x7a0333[_0x33e2('0x46')]['id']){delete _0x7a0333[_0x33e2('0x46')]['id'];}return db[_0x33e2('0x2b')][_0x33e2('0x4a')]({'where':{'id':_0x7a0333[_0x33e2('0x43')]['id']}})[_0x33e2('0x23')](handleEntityNotFound(_0x6d1b4a,null))[_0x33e2('0x23')](saveUpdates(_0x7a0333[_0x33e2('0x46')],null))[_0x33e2('0x23')](respondWithResult(_0x6d1b4a,null))[_0x33e2('0x41')](handleError(_0x6d1b4a,null));};exports[_0x33e2('0x4f')]=function(_0x3da4d3,_0x900a9f){return db['Pause'][_0x33e2('0x4a')]({'where':{'id':_0x3da4d3['params']['id']}})['then'](handleEntityNotFound(_0x900a9f,null))['then'](removeEntity(_0x900a9f,null))[_0x33e2('0x41')](handleError(_0x900a9f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dfdab41..ac51a3b 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x42934b,_0x483ed6){var _0x31c5e4=function(_0x2a51ba){while(--_0x2a51ba){_0x42934b['push'](_0x42934b['shift']());}};_0x31c5e4(++_0x483ed6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x202790,_0x1cd69f){_0x202790=_0x202790-0x0;var _0x188e92=_0x8ef6[_0x202790];return _0x188e92;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x2acbcb,_0x4d11ba){var _0x102fc6=function(_0x547c9c){while(--_0x547c9c){_0x2acbcb['push'](_0x2acbcb['shift']());}};_0x102fc6(++_0x4d11ba);}(_0xf494,0x1c6));var _0x4f49=function(_0x10ef79,_0x52233b){_0x10ef79=_0x10ef79-0x0;var _0x3cc423=_0xf494[_0x10ef79];return _0x3cc423;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5ac1e33..b6984ca 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(_0x470d4f,_0x372bae){var _0x244e15=function(_0x18ebf8){while(--_0x18ebf8){_0x470d4f['push'](_0x470d4f['shift']());}};_0x244e15(++_0x372bae);}(_0x7a54,0x106));var _0x47a5=function(_0x3dcfc1,_0x1ef348){_0x3dcfc1=_0x3dcfc1-0x0;var _0x22d649=_0x7a54[_0x3dcfc1];return _0x22d649;};'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(_0x4a525e,_0x615150){var _0x149a94=function(_0xa51727){while(--_0xa51727){_0x4a525e['push'](_0x4a525e['shift']());}};_0x149a94(++_0x615150);}(_0x7a54,0x106));var _0x47a5=function(_0x6f41c8,_0x2bf83a){_0x6f41c8=_0x6f41c8-0x0;var _0x45e478=_0x7a54[_0x6f41c8];return _0x45e478;};'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 609d9c1..7c009de 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 _0x8ce3=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','/webhook','webhookGet','get','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','post','single','upload','put','/:id'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0x8ce3[_0x3d7de8];return _0x5e9a0c;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var fs_extra=require(_0x38ce('0x5'));var auth=require(_0x38ce('0x6'));var interaction=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var controller=require(_0x38ce('0x9'));router['get']('/',auth[_0x38ce('0xa')](),controller[_0x38ce('0xb')]);router['get'](_0x38ce('0xc'),controller[_0x38ce('0xd')]);router[_0x38ce('0xe')]('/:id',auth[_0x38ce('0xa')](),controller['show']);router[_0x38ce('0xe')]('/:id/download',auth[_0x38ce('0xa')](),controller[_0x38ce('0xf')]);var upload=multer({'storage':multer[_0x38ce('0x10')]({'destination':function(_0x2c0cab,_0x564332,_0x3603fa){_0x3603fa(null,path[_0x38ce('0x11')](config[_0x38ce('0x12')],_0x38ce('0x13')));},'filename':function(_0xe33aec,_0x42e234,_0x3ef662){_0x42e234[_0x38ce('0x14')]=_0x42e234[_0x38ce('0x14')][_0x38ce('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ef662(null,util[_0x38ce('0x16')]('%s-%s%s',path['basename'](_0x42e234[_0x38ce('0x14')],path[_0x38ce('0x17')](_0x42e234[_0x38ce('0x14')])),Date['now'](),path[_0x38ce('0x17')](_0x42e234['originalname'])));}})});router[_0x38ce('0x18')]('/',upload[_0x38ce('0x19')]('file'),controller[_0x38ce('0x1a')]);router[_0x38ce('0x18')](_0x38ce('0xc'),controller['webhookPost']);router[_0x38ce('0x1b')](_0x38ce('0x1c'),auth[_0x38ce('0xa')](),controller[_0x38ce('0x1d')]);router[_0x38ce('0x1e')](_0x38ce('0x1c'),auth[_0x38ce('0xa')](),controller['delete']);module[_0x38ce('0x1f')]=router; \ No newline at end of file +var _0x2dae=['put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload'];(function(_0x5dafeb,_0x12878c){var _0x5424c6=function(_0x30fb2c){while(--_0x30fb2c){_0x5dafeb['push'](_0x5dafeb['shift']());}};_0x5424c6(++_0x12878c);}(_0x2dae,0xc3));var _0xe2da=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x2dae[_0xf2662b];return _0x257dc7;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),controller[_0xe2da('0xc')]);router[_0xe2da('0x9')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x9')]('/:id/download',auth[_0xe2da('0xe')](),controller[_0xe2da('0x10')]);var upload=multer({'storage':multer[_0xe2da('0x11')]({'destination':function(_0x17086c,_0x3c1309,_0x44ec3e){_0x44ec3e(null,path[_0xe2da('0x12')](config[_0xe2da('0x13')],'server/files/plugins'));},'filename':function(_0xb98909,_0x5200b1,_0x4377c6){_0x5200b1[_0xe2da('0x14')]=_0x5200b1[_0xe2da('0x14')][_0xe2da('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4377c6(null,util[_0xe2da('0x16')](_0xe2da('0x17'),path[_0xe2da('0x18')](_0x5200b1['originalname'],path[_0xe2da('0x19')](_0x5200b1['originalname'])),Date['now'](),path[_0xe2da('0x19')](_0x5200b1[_0xe2da('0x14')])));}})});router[_0xe2da('0x1a')]('/',upload['single'](_0xe2da('0x1b')),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1a')](_0xe2da('0xb'),controller['webhookPost']);router[_0xe2da('0x1d')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1f')]('/:id',auth[_0xe2da('0xe')](),controller[_0xe2da('0x1f')]);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 bc441d3..a13493a 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 _0xfd9c=['adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM'];(function(_0x31cd5f,_0x2436ab){var _0x58efba=function(_0x5f2e60){while(--_0x5f2e60){_0x31cd5f['push'](_0x31cd5f['shift']());}};_0x58efba(++_0x2436ab);}(_0xfd9c,0xc8));var _0xcfd9=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xfd9c[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0xcfd9('0x0'));module[_0xcfd9('0x1')]={'name':{'type':Sequelize[_0xcfd9('0x2')]},'type':{'type':Sequelize['ENUM'](_0xcfd9('0x3'),_0xcfd9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcfd9('0x5')]},'path':{'type':Sequelize[_0xcfd9('0x2')],'comment':_0xcfd9('0x6')},'active':{'type':Sequelize[_0xcfd9('0x7')],'defaultValue':0x0,'comment':_0xcfd9('0x8')},'sidebar':{'type':Sequelize[_0xcfd9('0x9')](_0xcfd9('0xa'),_0xcfd9('0xb'),'always',_0xcfd9('0xc')),'defaultValue':'always','comment':_0xcfd9('0xd')},'icon':{'type':Sequelize[_0xcfd9('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xcfd9('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xcfd9('0x2')]}}; \ No newline at end of file +var _0x0633=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','script'];(function(_0x24a79e,_0x6d3f4f){var _0x42034d=function(_0x5ef6ee){while(--_0x5ef6ee){_0x24a79e['push'](_0x24a79e['shift']());}};_0x42034d(++_0x6d3f4f);}(_0x0633,0x188));var _0x3063=function(_0x1d3990,_0x39869a){_0x1d3990=_0x1d3990-0x0;var _0x46b55d=_0x0633[_0x1d3990];return _0x46b55d;};'use strict';var Sequelize=require(_0x3063('0x0'));module[_0x3063('0x1')]={'name':{'type':Sequelize[_0x3063('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x3063('0x3'))},'description':{'type':Sequelize[_0x3063('0x4')]},'version':{'type':Sequelize[_0x3063('0x4')]},'path':{'type':Sequelize[_0x3063('0x2')],'comment':_0x3063('0x5')},'active':{'type':Sequelize[_0x3063('0x6')],'defaultValue':0x0,'comment':_0x3063('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x3063('0x8'),'agentOnly',_0x3063('0x9'),'never'),'defaultValue':_0x3063('0x9'),'comment':_0x3063('0xa')},'icon':{'type':Sequelize[_0x3063('0x2')]},'adminUrl':{'type':Sequelize[_0x3063('0x2')]},'agentUrl':{'type':Sequelize[_0x3063('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x3063('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index fe036e7..c098236 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 _0x7309=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','status','end','json','offset','undefined','limit','count','set','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','join','root','server/files/plugins','format','basename','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','send','hostname'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x7309,0xae));var _0x9730=function(_0x504994,_0x25a31a){_0x504994=_0x504994-0x0;var _0x4f60bd=_0x7309[_0x504994];return _0x4f60bd;};'use strict';var emlformat=require(_0x9730('0x0'));var rimraf=require(_0x9730('0x1'));var zipdir=require(_0x9730('0x2'));var jsonpatch=require(_0x9730('0x3'));var rp=require(_0x9730('0x4'));var moment=require(_0x9730('0x5'));var BPromise=require(_0x9730('0x6'));var Mustache=require(_0x9730('0x7'));var util=require(_0x9730('0x8'));var path=require(_0x9730('0x9'));var sox=require(_0x9730('0xa'));var csv=require('to-csv');var ejs=require(_0x9730('0xb'));var fs=require('fs');var fs_extra=require(_0x9730('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9730('0xd'));var jsforce=require(_0x9730('0xe'));var deskjs=require(_0x9730('0xf'));var toCsv=require(_0x9730('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x9730('0x11'));var rimraf=require(_0x9730('0x1'));var archiver=require(_0x9730('0x12'));var Redis=require(_0x9730('0x13'));var authService=require(_0x9730('0x14'));var qs=require(_0x9730('0x15'));var as=require(_0x9730('0x16'));var hardwareService=require(_0x9730('0x17'));var logger=require(_0x9730('0x18'))(_0x9730('0x19'));var utils=require('../../config/utils');var config=require(_0x9730('0x1a'));var licenseUtil=require(_0x9730('0x1b'));var db=require(_0x9730('0x1c'))['db'];config[_0x9730('0x1d')]=_[_0x9730('0x1e')](config[_0x9730('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x9730('0x1f'))(new Redis(config[_0x9730('0x1d')]));require(_0x9730('0x20'))['register'](socket);function respondWithStatusCode(_0x369fe5,_0x52ed9d){_0x52ed9d=_0x52ed9d||0xcc;return function(_0x4db056){if(_0x4db056){return _0x369fe5['sendStatus'](_0x52ed9d);}return _0x369fe5[_0x9730('0x21')](_0x52ed9d)[_0x9730('0x22')]();};}function respondWithResult(_0x2caf9d,_0x2ac6bb){_0x2ac6bb=_0x2ac6bb||0xc8;return function(_0x2e1688){if(_0x2e1688){return _0x2caf9d['status'](_0x2ac6bb)[_0x9730('0x23')](_0x2e1688);}};}function respondWithFilteredResult(_0x5eb56e,_0x583d52){return function(_0x2521a3){if(_0x2521a3){var _0x24b1f0=typeof _0x583d52[_0x9730('0x24')]===_0x9730('0x25')&&typeof _0x583d52[_0x9730('0x26')]===_0x9730('0x25');var _0x548a6e=_0x2521a3[_0x9730('0x27')];var _0x3f7719=_0x24b1f0?0x0:_0x583d52[_0x9730('0x24')];var _0x2b9f22=_0x24b1f0?_0x2521a3[_0x9730('0x27')]:_0x583d52[_0x9730('0x24')]+_0x583d52[_0x9730('0x26')];var _0x245c6b;if(_0x2b9f22>=_0x548a6e){_0x2b9f22=_0x548a6e;_0x245c6b=0xc8;}else{_0x245c6b=0xce;}_0x5eb56e[_0x9730('0x21')](_0x245c6b);return _0x5eb56e[_0x9730('0x28')]('Content-Range',_0x3f7719+'-'+_0x2b9f22+'/'+_0x548a6e)[_0x9730('0x23')](_0x2521a3);}return null;};}function patchUpdates(_0x1f54b6){return function(_0x11999a){try{jsonpatch['apply'](_0x11999a,_0x1f54b6,!![]);}catch(_0xe79fb9){return BPromise['reject'](_0xe79fb9);}return _0x11999a['save']();};}function saveUpdates(_0x189ebc,_0x10f416){return function(_0x413c22){if(_0x413c22){return _0x413c22[_0x9730('0x29')](_0x189ebc)[_0x9730('0x2a')](function(_0x3d20e7){return _0x3d20e7;});}return null;};}function removeEntity(_0x22a3b6,_0x1153ef){return function(_0x25e413){if(_0x25e413){return _0x25e413['destroy']()[_0x9730('0x2a')](function(){var _0x46cc0c=_0x25e413[_0x9730('0x2b')]({'plain':!![]});var _0x29d33e='Plugins';return db[_0x9730('0x2c')][_0x9730('0x2d')]({'where':{'type':_0x29d33e,'resourceId':_0x46cc0c['id']}})[_0x9730('0x2a')](function(){return _0x25e413;});})[_0x9730('0x2a')](function(){_0x22a3b6[_0x9730('0x21')](0xcc)[_0x9730('0x22')]();});}};}function handleEntityNotFound(_0x57bf0e,_0x3bf5c0){return function(_0x39313e){if(!_0x39313e){_0x57bf0e[_0x9730('0x2e')](0x194);}return _0x39313e;};}function handleError(_0x283751,_0x2adeb3){_0x2adeb3=_0x2adeb3||0x1f4;return function(_0x134593){logger['error'](_0x134593[_0x9730('0x2f')]);if(_0x134593['name']){delete _0x134593[_0x9730('0x30')];}_0x283751[_0x9730('0x21')](_0x2adeb3)['send'](_0x134593);};}exports[_0x9730('0x31')]=function(_0x1a19fb,_0x2ce981){var _0x353cf2={},_0x2f9b25={},_0x1edacc={'count':0x0,'rows':[]};var _0x1e522b=_[_0x9730('0x32')](db[_0x9730('0x33')][_0x9730('0x34')],function(_0xa6f4f0){return{'name':_0xa6f4f0[_0x9730('0x35')],'type':_0xa6f4f0[_0x9730('0x36')][_0x9730('0x37')]};});_0x2f9b25[_0x9730('0x38')]=_['map'](_0x1e522b,_0x9730('0x30'));_0x2f9b25[_0x9730('0x39')]=_['keys'](_0x1a19fb['query']);_0x2f9b25[_0x9730('0x3a')]=_[_0x9730('0x3b')](_0x2f9b25[_0x9730('0x38')],_0x2f9b25[_0x9730('0x39')]);_0x353cf2[_0x9730('0x3c')]=_[_0x9730('0x3b')](_0x2f9b25[_0x9730('0x38')],qs[_0x9730('0x3d')](_0x1a19fb[_0x9730('0x39')][_0x9730('0x3d')]));_0x353cf2[_0x9730('0x3c')]=_0x353cf2[_0x9730('0x3c')][_0x9730('0x3e')]?_0x353cf2['attributes']:_0x2f9b25['model'];if(!_0x1a19fb[_0x9730('0x39')][_0x9730('0x3f')](_0x9730('0x40'))){_0x353cf2[_0x9730('0x26')]=qs[_0x9730('0x26')](_0x1a19fb[_0x9730('0x39')][_0x9730('0x26')]);_0x353cf2[_0x9730('0x24')]=qs['offset'](_0x1a19fb[_0x9730('0x39')][_0x9730('0x24')]);}_0x353cf2['order']=qs[_0x9730('0x41')](_0x1a19fb['query']['sort']);_0x353cf2[_0x9730('0x42')]=qs[_0x9730('0x3a')](_[_0x9730('0x43')](_0x1a19fb[_0x9730('0x39')],_0x2f9b25[_0x9730('0x3a')]),_0x1e522b);if(_0x1a19fb[_0x9730('0x39')][_0x9730('0x44')]){_0x353cf2[_0x9730('0x42')]=_[_0x9730('0x45')](_0x353cf2[_0x9730('0x42')],{'$or':_[_0x9730('0x32')](_0x1e522b,function(_0x3e66ff){if(_0x3e66ff[_0x9730('0x36')]!==_0x9730('0x46')){var _0x4f77da={};_0x4f77da[_0x3e66ff[_0x9730('0x30')]]={'$like':'%'+_0x1a19fb[_0x9730('0x39')]['filter']+'%'};return _0x4f77da;}})});}_0x353cf2=_[_0x9730('0x45')]({},_0x353cf2,_0x1a19fb[_0x9730('0x47')]);var _0x5c00f7={'where':_0x353cf2[_0x9730('0x42')]};return db[_0x9730('0x33')][_0x9730('0x27')](_0x5c00f7)[_0x9730('0x2a')](function(_0x1fb8a3){_0x1edacc[_0x9730('0x27')]=_0x1fb8a3;if(_0x1a19fb[_0x9730('0x39')][_0x9730('0x48')]){_0x353cf2[_0x9730('0x49')]=[{'all':!![]}];}return db[_0x9730('0x33')]['findAll'](_0x353cf2);})['then'](function(_0x2bfe66){_0x1edacc[_0x9730('0x4a')]=_0x2bfe66;return _0x1edacc;})['then'](respondWithFilteredResult(_0x2ce981,_0x353cf2))['catch'](handleError(_0x2ce981,null));};exports[_0x9730('0x4b')]=function(_0x2efe11,_0x59224e){var _0x5eb83a={'raw':!![],'where':{'id':_0x2efe11[_0x9730('0x4c')]['id']}},_0x118bc6={};_0x118bc6[_0x9730('0x38')]=_[_0x9730('0x4d')](db[_0x9730('0x33')][_0x9730('0x34')]);_0x118bc6[_0x9730('0x39')]=_[_0x9730('0x4d')](_0x2efe11[_0x9730('0x39')]);_0x118bc6[_0x9730('0x3a')]=_[_0x9730('0x3b')](_0x118bc6[_0x9730('0x38')],_0x118bc6['query']);_0x5eb83a[_0x9730('0x3c')]=_[_0x9730('0x3b')](_0x118bc6[_0x9730('0x38')],qs[_0x9730('0x3d')](_0x2efe11[_0x9730('0x39')][_0x9730('0x3d')]));_0x5eb83a[_0x9730('0x3c')]=_0x5eb83a[_0x9730('0x3c')][_0x9730('0x3e')]?_0x5eb83a[_0x9730('0x3c')]:_0x118bc6[_0x9730('0x38')];if(_0x2efe11[_0x9730('0x39')][_0x9730('0x48')]){_0x5eb83a[_0x9730('0x49')]=[{'all':!![]}];}_0x5eb83a=_['merge']({},_0x5eb83a,_0x2efe11[_0x9730('0x47')]);return db[_0x9730('0x33')][_0x9730('0x4e')](_0x5eb83a)['then'](handleEntityNotFound(_0x59224e,null))[_0x9730('0x2a')](respondWithResult(_0x59224e,null))[_0x9730('0x4f')](handleError(_0x59224e,null));};exports['download']=function(_0x7722fd,_0x1627a2,_0x2628b7){return db['Plugin'][_0x9730('0x4e')]({'where':{'id':_0x7722fd[_0x9730('0x4c')]['id']},'attributes':[_0x9730('0x30'),_0x9730('0x9')],'raw':!![]})[_0x9730('0x2a')](handleEntityNotFound(_0x1627a2,null))[_0x9730('0x2a')](function(_0x4cb20d){if(_0x4cb20d){var _0x31e4b0=path[_0x9730('0x50')](config[_0x9730('0x51')],_0x9730('0x52'),util[_0x9730('0x53')]('%s.zip',path[_0x9730('0x54')](_0x4cb20d['path'])));var _0x2255be=fs['createWriteStream'](_0x31e4b0);var _0x124476=archiver(_0x9730('0x55'),{'zlib':{'level':0x9}});_0x124476['on']('warning',function(_0x122d81){if(_0x122d81[_0x9730('0x56')]===_0x9730('0x57')){logger[_0x9730('0x58')](_0x122d81);}else{throw new db[(_0x9730('0x59'))][(_0x9730('0x5a'))](_0x9730('0x5b'));}});_0x124476['on'](_0x9730('0x58'),function(_0x5f5a6f){throw new db[(_0x9730('0x59'))][(_0x9730('0x5a'))](_0x9730('0x5b'));});_0x124476[_0x9730('0x5c')](_0x2255be);_0x124476[_0x9730('0x5d')](_0x9730('0x5e'),{'cwd':path[_0x9730('0x50')](config[_0x9730('0x51')],_0x9730('0x52'),path[_0x9730('0x5f')](_0x4cb20d['path'])),'ignore':[path['join'](path[_0x9730('0x54')](_0x4cb20d[_0x9730('0x9')]),_0x9730('0x60')),path['join'](path[_0x9730('0x54')](_0x4cb20d['path']),_0x9730('0x61'))],'nodir':!![]})['finalize']();_0x2255be['on'](_0x9730('0x62'),function(){if(!fs[_0x9730('0x63')](_0x31e4b0)){throw new db[(_0x9730('0x59'))][(_0x9730('0x5a'))](_0x9730('0x64'));}return _0x1627a2[_0x9730('0x65')](_0x31e4b0,util[_0x9730('0x53')](_0x9730('0x66'),path[_0x9730('0x54')](_0x4cb20d[_0x9730('0x9')])),function(_0x51bac3){if(_0x51bac3){throw new db['Sequelize'][(_0x9730('0x5a'))](_0x9730('0x67'));}fs[_0x9730('0x68')](_0x31e4b0);logger['info'](_0x9730('0x69'));logger[_0x9730('0x6a')](_0x9730('0x6b'));});});}return null;})[_0x9730('0x4f')](handleError(_0x1627a2,null));};exports[_0x9730('0x6c')]=function(_0x577d4b,_0x34af0c,_0xdf2e9a){var _0x32d0ec=path[_0x9730('0x54')](_0x577d4b[_0x9730('0x6d')][_0x9730('0x6e')],path[_0x9730('0x6f')](_0x577d4b['file'][_0x9730('0x6e')]));var _0x621fc9=path[_0x9730('0x50')](config['root'],_0x9730('0x52'),_0x577d4b[_0x9730('0x6d')][_0x9730('0x6e')]);var _0x1c3afc=path[_0x9730('0x50')](config['root'],_0x9730('0x52'),_0x32d0ec);logger[_0x9730('0x6a')](_0x9730('0x70'),_0x621fc9);logger['info'](_0x9730('0x71'),_0x1c3afc);try{fs[_0x9730('0x72')](_0x621fc9,parseInt(_0x9730('0x73'),0x8));extract(_0x621fc9,{'dir':_0x1c3afc},function(_0x4ff70c){if(_0x4ff70c){logger[_0x9730('0x58')](_0x4ff70c);handleError(_0x4ff70c,!![]);};var _0x12536e=fs[_0x9730('0x74')](_0x1c3afc);if(_0x12536e[_0x9730('0x3e')]>0x1){removeReferences(_0x621fc9,_0x1c3afc);logger['error'](_0x9730('0x75'));return _0xdf2e9a(new Error(_0x9730('0x75')));}var _0x59a796=fs['lstatSync'](path[_0x9730('0x50')](_0x1c3afc,_0x12536e[0x0]));if(_0x59a796[_0x9730('0x76')]()){removeReferences(_0x621fc9,_0x1c3afc);logger[_0x9730('0x58')](_0x9730('0x75'));return _0xdf2e9a(new Error(_0x9730('0x75')));}if(_0x59a796[_0x9730('0x77')]()){var _0x3f7c13=fs[_0x9730('0x74')](path[_0x9730('0x50')](_0x1c3afc,_0x12536e[0x0]));if(_0x3f7c13['length']===0x0){removeReferences(_0x621fc9,_0x1c3afc);logger['error'](_0x9730('0x75'));return _0xdf2e9a(new Error(_0x9730('0x75')));}var _0x214387=_0x3f7c13[_0x9730('0x78')](function(_0xf95ca4){return _0xf95ca4===_0x9730('0x79');});if(!_0x214387){return _0xdf2e9a(new Error(_0x9730('0x7a')));}var _0x37b2d6=fs[_0x9730('0x7b')](path[_0x9730('0x50')](_0x1c3afc,_0x12536e[0x0],_0x9730('0x79')));var _0x454b0c=JSON[_0x9730('0x7c')](_0x37b2d6);if('undefined'==typeof _0x454b0c[_0x9730('0x30')]){return _0xdf2e9a(new Error(_0x9730('0x7d')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x36')]){return _0xdf2e9a(new Error(_0x9730('0x7e')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x7f')]){return _0xdf2e9a(new Error(_0x9730('0x80')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')]){return _0xdf2e9a(new Error(_0x9730('0x82')));}if(_0x454b0c['type']===_0x9730('0x83')){if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]){return _0xdf2e9a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]['admin']&&_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')]){return _0xdf2e9a(new Error(_0x9730('0x86')));}}else if(_0x454b0c[_0x9730('0x36')]===_0x9730('0x87')){if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')]['scriptName']){return _0xdf2e9a(new Error(_0x9730('0x88')));}if(_0x9730('0x25')==typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x89')]){return _0xdf2e9a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xdf2e9a(new Error(_0x9730('0x8a')));}var _0x3875a5=_0x454b0c[_0x9730('0x30')];var _0x392b13=_0x454b0c[_0x9730('0x8b')];var _0x175cee=_0x454b0c[_0x9730('0x36')];var _0x2e1de3=_0x454b0c[_0x9730('0x8c')]?_0x454b0c[_0x9730('0x8c')]:_0x9730('0x8d');var _0x415ffc=_0x454b0c[_0x9730('0x8e')]?_0x454b0c[_0x9730('0x8e')]:_0x9730('0x8f');var _0x45e30e='';var _0x56efde='';var _0x72fefd='';var _0x51007b='';var _0x3a65ae=_0x454b0c[_0x9730('0x7f')];if(_0x175cee===_0x9730('0x83')){if('undefined'!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x90')]){var _0x4eb752=_0x454b0c[_0x9730('0x81')]['views'][_0x9730('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4eb752)){_0x45e30e=path[_0x9730('0x50')]('plugins',_0x32d0ec,_0x12536e[0x0],_0x4eb752);}else{_0x45e30e=_0x4eb752;}}else{logger['info'](_0x9730('0x91'));}if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')]){var _0x368835=_0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x368835)){_0x56efde=path[_0x9730('0x50')](_0x9730('0x92'),_0x32d0ec,_0x12536e[0x0],_0x368835);}else{_0x56efde=_0x368835;}}else{logger['info'](_0x9730('0x93'));}}else if(_0x175cee===_0x9730('0x87')){_0x72fefd=_0x454b0c['parameters'][_0x9730('0x94')];_0x51007b=_0x454b0c[_0x9730('0x81')]['scriptPath'];if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]){if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')][_0x9730('0x84')]['admin']){var _0x4eb752=_0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4eb752)){_0x45e30e=path[_0x9730('0x50')](_0x9730('0x92'),_0x32d0ec,_0x12536e[0x0],_0x4eb752);}else{_0x45e30e=_0x4eb752;}}if(_0x9730('0x25')!=typeof _0x454b0c[_0x9730('0x81')]['views'][_0x9730('0x85')]){var _0x368835=_0x454b0c[_0x9730('0x81')][_0x9730('0x84')][_0x9730('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x368835)){_0x56efde=path[_0x9730('0x50')](_0x9730('0x92'),_0x32d0ec,_0x12536e[0x0],_0x368835);}else{_0x56efde=_0x368835;}}}}var _0x399ed6={'name':_0x3875a5,'description':_0x392b13,'path':path[_0x9730('0x50')](_0x32d0ec,_0x12536e[0x0]),'type':_0x175cee,'sidebar':_0x2e1de3,'icon':_0x415ffc,'adminUrl':_0x45e30e,'agentUrl':_0x56efde,'scriptName':_0x72fefd,'scriptPath':_0x51007b,'version':_0x3a65ae};removeReferences(_0x621fc9,null);return db[_0x9730('0x33')][_0x9730('0x95')](_0x399ed6)['then'](function(_0x4e9f83){var _0x3c2916={'role':_0x577d4b[_0x9730('0x96')]['role'],'userProfileId':_0x577d4b['body'][_0x9730('0x97')]};if(!_0x3c2916)throw new Error(_0x9730('0x98'));if(_0x3c2916['role']===_0x9730('0x99')){var _0xb1a44e=_0x4e9f83[_0x9730('0x2b')]({'plain':!![]});return db[_0x9730('0x9a')][_0x9730('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x3c2916[_0x9730('0x97')]},'raw':!![]})['then'](function(_0x5093b9){if(_0x5093b9&&_0x5093b9[_0x9730('0x9b')]===0x0){return db[_0x9730('0x2c')][_0x9730('0x95')]({'name':_0xb1a44e[_0x9730('0x30')],'resourceId':_0xb1a44e['id'],'type':_0x5093b9[_0x9730('0x30')],'sectionId':_0x5093b9['id']},{})[_0x9730('0x2a')](function(){return _0x4e9f83;});}else{return _0x4e9f83;}})[_0x9730('0x4f')](function(_0x463dcc){logger[_0x9730('0x58')](_0x9730('0x9c'),_0x463dcc);throw _0x463dcc;});}return _0x4e9f83;})[_0x9730('0x2a')](respondWithResult(_0x34af0c,null))[_0x9730('0x4f')](handleError(_0x34af0c,null));}});}catch(_0x3fe787){_0x34af0c['status'](0x1f4)['send'](_0x3fe787);}};function removeReferences(_0x3e5791,_0x4668a3){try{if(_0x3e5791){fs[_0x9730('0x68')](_0x3e5791);logger[_0x9730('0x6a')](_0x9730('0x9d'));}if(_0x4668a3){rimraf(_0x4668a3,function(){});logger[_0x9730('0x6a')](_0x9730('0x9e'));}}catch(_0x4c36bb){logger[_0x9730('0x58')](_0x4c36bb);}}exports[_0x9730('0x29')]=function(_0x422504,_0x4ea4d3,_0x315d5e){return db['Plugin'][_0x9730('0x4e')]({'where':{'id':_0x422504[_0x9730('0x4c')]['id']}})[_0x9730('0x2a')](handleEntityNotFound(_0x4ea4d3,null))['then'](saveUpdates(_0x422504['body'],null))[_0x9730('0x2a')](respondWithResult(_0x4ea4d3,null))[_0x9730('0x4f')](handleError(_0x4ea4d3,null));};exports['delete']=function(_0x14c270,_0xd210e1,_0x417998){return db[_0x9730('0x33')][_0x9730('0x4e')]({'where':{'id':_0x14c270[_0x9730('0x4c')]['id']}})[_0x9730('0x2a')](function(_0x47e84e){if(_0x47e84e){return _0x47e84e[_0x9730('0x2d')]();}})[_0x9730('0x2a')](function(_0x5d7baa){rimraf(path[_0x9730('0x50')](config[_0x9730('0x51')],_0x9730('0x52'),path[_0x9730('0x5f')](_0x5d7baa[_0x9730('0x9')])),function(){});return _0x5d7baa;})[_0x9730('0x2a')](handleEntityNotFound(_0xd210e1,null))['then'](respondWithStatusCode(_0xd210e1,null))['catch'](handleError(_0xd210e1,null));};exports['webhookGet']=function(_0x25dd70,_0x36fd42,_0x1bc3c0){return BPromise[_0x9730('0x9f')]()[_0x9730('0x2a')](function(){if(!_0x25dd70[_0x9730('0x39')][_0x9730('0x9')]){throw new Error(_0x9730('0xa0'));}if(!_0x25dd70['query'][_0x9730('0xa1')]){throw new Error(_0x9730('0xa2'));}var _0x1c7c59=_0x25dd70[_0x9730('0x39')]['hostname']?_0x25dd70[_0x9730('0x39')]['hostname']+':'+_0x25dd70[_0x9730('0x39')][_0x9730('0xa1')]:_0x9730('0xa3')+_0x25dd70['query'][_0x9730('0xa1')];var _0x13ab38=_0x25dd70[_0x9730('0x39')][_0x9730('0x23')]?_0x25dd70['query'][_0x9730('0x23')]:!![];var _0xa2f5e3=_0x25dd70[_0x9730('0x39')]['encoding']?_0x25dd70[_0x9730('0x39')][_0x9730('0xa4')]:null;var _0x46c910={'method':_0x25dd70[_0x9730('0xa5')],'uri':util[_0x9730('0x53')](_0x9730('0xa6'),_0x1c7c59,_0x25dd70['query']['path']),'json':_0x13ab38,'resolveWithFullResponse':!![],'encoding':_0xa2f5e3,'qs':_0x25dd70[_0x9730('0x39')]};if(_0x25dd70[_0x9730('0xa7')]){_0x46c910['headers']=_0x25dd70[_0x9730('0xa7')];if(_0x46c910['headers'][_0x9730('0xa8')]){delete _0x46c910[_0x9730('0xa7')][_0x9730('0xa8')];}}if(_0x46c910[_0x9730('0xa7')][_0x9730('0xa9')]){delete _0x46c910['headers']['content-type'];}return rp(_0x46c910);})[_0x9730('0x2a')](function(_0x50f4e5){if(_0x50f4e5){_0x36fd42[_0x9730('0x28')](_0x50f4e5[_0x9730('0xa7')]);logger[_0x9730('0x6a')](_0x50f4e5[_0x9730('0x96')]);if(_[_0x9730('0xaa')](_0x25dd70[_0x9730('0x39')]['path'],_0x9730('0x65'))&&_0x50f4e5[_0x9730('0xab')]==0x1f4){return _0x36fd42[_0x9730('0x2e')](_0x50f4e5[_0x9730('0xab')]);}else{return _0x36fd42['status'](_0x50f4e5['statusCode'])[_0x9730('0xac')](_0x50f4e5[_0x9730('0x96')]);}}else{return _0x36fd42[_0x9730('0x2e')](0xc8);}})[_0x9730('0x4f')](handleError(_0x36fd42,null));};exports['webhookPost']=function(_0x32071a,_0x47e3cf,_0x18da1c){return BPromise[_0x9730('0x9f')]()[_0x9730('0x2a')](function(){if(!_0x32071a[_0x9730('0x39')][_0x9730('0x9')]){throw new Error(_0x9730('0xa0'));}if(!_0x32071a['query'][_0x9730('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3544e4=_0x32071a[_0x9730('0x39')][_0x9730('0xad')]?_0x32071a[_0x9730('0x39')][_0x9730('0xad')]+':'+_0x32071a[_0x9730('0x39')]['port']:'http://localhost:'+_0x32071a[_0x9730('0x39')][_0x9730('0xa1')];var _0x4401f2=_0x32071a[_0x9730('0x39')][_0x9730('0x23')]?_0x32071a['query'][_0x9730('0x23')]:!![];var _0x2e99e8=_0x32071a[_0x9730('0x39')]['encoding']?_0x32071a[_0x9730('0x39')][_0x9730('0xa4')]:null;var _0x1dd1ab={'method':_0x32071a[_0x9730('0xa5')],'uri':util[_0x9730('0x53')]('%s%s',_0x3544e4,_0x32071a[_0x9730('0x39')][_0x9730('0x9')]),'json':_0x4401f2,'resolveWithFullResponse':!![],'encoding':_0x2e99e8,'body':_0x32071a[_0x9730('0x96')]};if(_0x32071a[_0x9730('0xa7')]){_0x1dd1ab[_0x9730('0xa7')]=_0x32071a['headers'];if(_0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa8')]){delete _0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa8')];}}if(_0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa9')]){delete _0x1dd1ab[_0x9730('0xa7')][_0x9730('0xa9')];}return rp(_0x1dd1ab);})[_0x9730('0x2a')](function(_0x2bc178){if(_0x2bc178){_0x47e3cf['set'](_0x2bc178[_0x9730('0xa7')]);logger['info'](_0x2bc178[_0x9730('0x96')]);return _0x47e3cf[_0x9730('0x21')](_0x2bc178[_0x9730('0xab')])[_0x9730('0xac')](_0x2bc178['body']);}else{return _0x47e3cf[_0x9730('0x2e')](0xc8);}})[_0x9730('0x4f')](handleError(_0x47e3cf,null));}; \ No newline at end of file +var _0xb415=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','get','Plugins','UserProfileResource','destroy','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','params','join','root','server/files/plugins','format','%s.zip','warning','ENOENT','error','Sequelize','Error','glob','**/*','dirname','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x199588,_0x14777c){var _0x478dd3=function(_0x437dc9){while(--_0x437dc9){_0x199588['push'](_0x199588['shift']());}};_0x478dd3(++_0x14777c);}(_0xb415,0x142));var _0x5b41=function(_0x478aa0,_0x30bb33){_0x478aa0=_0x478aa0-0x0;var _0xa60f72=_0xb415[_0x478aa0];return _0xa60f72;};'use strict';var emlformat=require(_0x5b41('0x0'));var rimraf=require(_0x5b41('0x1'));var zipdir=require(_0x5b41('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b41('0x3'));var BPromise=require(_0x5b41('0x4'));var Mustache=require('mustache');var util=require(_0x5b41('0x5'));var path=require(_0x5b41('0x6'));var sox=require('sox');var csv=require(_0x5b41('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b41('0x8'));var _=require(_0x5b41('0x9'));var squel=require(_0x5b41('0xa'));var crypto=require(_0x5b41('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5b41('0xc'));var toCsv=require(_0x5b41('0x7'));var querystring=require(_0x5b41('0xd'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x5b41('0xe'));var authService=require(_0x5b41('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5b41('0x10'));var hardwareService=require(_0x5b41('0x11'));var logger=require(_0x5b41('0x12'))(_0x5b41('0x13'));var utils=require(_0x5b41('0x14'));var config=require(_0x5b41('0x15'));var licenseUtil=require(_0x5b41('0x16'));var db=require(_0x5b41('0x17'))['db'];config[_0x5b41('0x18')]=_[_0x5b41('0x19')](config['redis'],{'host':_0x5b41('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5b41('0x1b'))[_0x5b41('0x1c')](socket);function respondWithStatusCode(_0x1b45a4,_0x3c3476){_0x3c3476=_0x3c3476||0xcc;return function(_0x1bc652){if(_0x1bc652){return _0x1b45a4[_0x5b41('0x1d')](_0x3c3476);}return _0x1b45a4['status'](_0x3c3476)[_0x5b41('0x1e')]();};}function respondWithResult(_0x7647ce,_0x34446c){_0x34446c=_0x34446c||0xc8;return function(_0x2402f0){if(_0x2402f0){return _0x7647ce[_0x5b41('0x1f')](_0x34446c)[_0x5b41('0x20')](_0x2402f0);}};}function respondWithFilteredResult(_0x150bbb,_0xb95687){return function(_0x120684){if(_0x120684){var _0x428ede=typeof _0xb95687[_0x5b41('0x21')]===_0x5b41('0x22')&&typeof _0xb95687[_0x5b41('0x23')]===_0x5b41('0x22');var _0x11ec3b=_0x120684[_0x5b41('0x24')];var _0x5d0b3e=_0x428ede?0x0:_0xb95687[_0x5b41('0x21')];var _0x1cf516=_0x428ede?_0x120684[_0x5b41('0x24')]:_0xb95687['offset']+_0xb95687[_0x5b41('0x23')];var _0x4e1b92;if(_0x1cf516>=_0x11ec3b){_0x1cf516=_0x11ec3b;_0x4e1b92=0xc8;}else{_0x4e1b92=0xce;}_0x150bbb[_0x5b41('0x1f')](_0x4e1b92);return _0x150bbb[_0x5b41('0x25')](_0x5b41('0x26'),_0x5d0b3e+'-'+_0x1cf516+'/'+_0x11ec3b)[_0x5b41('0x20')](_0x120684);}return null;};}function patchUpdates(_0x58ca7a){return function(_0x502e23){try{jsonpatch['apply'](_0x502e23,_0x58ca7a,!![]);}catch(_0x16b39b){return BPromise[_0x5b41('0x27')](_0x16b39b);}return _0x502e23['save']();};}function saveUpdates(_0x13492f,_0x12ba89){return function(_0x4201f7){if(_0x4201f7){return _0x4201f7['update'](_0x13492f)[_0x5b41('0x28')](function(_0x4e03b9){return _0x4e03b9;});}return null;};}function removeEntity(_0xa09959,_0x3a5978){return function(_0x5dd0d4){if(_0x5dd0d4){return _0x5dd0d4['destroy']()[_0x5b41('0x28')](function(){var _0x518f1=_0x5dd0d4[_0x5b41('0x29')]({'plain':!![]});var _0x10be4e=_0x5b41('0x2a');return db[_0x5b41('0x2b')][_0x5b41('0x2c')]({'where':{'type':_0x10be4e,'resourceId':_0x518f1['id']}})[_0x5b41('0x28')](function(){return _0x5dd0d4;});})[_0x5b41('0x28')](function(){_0xa09959[_0x5b41('0x1f')](0xcc)[_0x5b41('0x1e')]();});}};}function handleEntityNotFound(_0x103960,_0xc0852c){return function(_0x5bbef4){if(!_0x5bbef4){_0x103960[_0x5b41('0x1d')](0x194);}return _0x5bbef4;};}function handleError(_0x5bf32b,_0x3bfa99){_0x3bfa99=_0x3bfa99||0x1f4;return function(_0x2ba6e7){logger['error'](_0x2ba6e7[_0x5b41('0x2d')]);if(_0x2ba6e7[_0x5b41('0x2e')]){delete _0x2ba6e7['name'];}_0x5bf32b[_0x5b41('0x1f')](_0x3bfa99)[_0x5b41('0x2f')](_0x2ba6e7);};}exports[_0x5b41('0x30')]=function(_0x5a62b2,_0x1d5f12){var _0x279e2e={},_0x29549d={},_0x3541f5={'count':0x0,'rows':[]};var _0x4f7d46=_[_0x5b41('0x31')](db[_0x5b41('0x32')][_0x5b41('0x33')],function(_0x48d0df){return{'name':_0x48d0df[_0x5b41('0x34')],'type':_0x48d0df[_0x5b41('0x35')]['key']};});_0x29549d[_0x5b41('0x36')]=_['map'](_0x4f7d46,_0x5b41('0x2e'));_0x29549d[_0x5b41('0x37')]=_[_0x5b41('0x38')](_0x5a62b2[_0x5b41('0x37')]);_0x29549d[_0x5b41('0x39')]=_[_0x5b41('0x3a')](_0x29549d[_0x5b41('0x36')],_0x29549d[_0x5b41('0x37')]);_0x279e2e[_0x5b41('0x3b')]=_[_0x5b41('0x3a')](_0x29549d[_0x5b41('0x36')],qs['fields'](_0x5a62b2['query'][_0x5b41('0x3c')]));_0x279e2e[_0x5b41('0x3b')]=_0x279e2e[_0x5b41('0x3b')][_0x5b41('0x3d')]?_0x279e2e[_0x5b41('0x3b')]:_0x29549d[_0x5b41('0x36')];if(!_0x5a62b2[_0x5b41('0x37')][_0x5b41('0x3e')]('nolimit')){_0x279e2e[_0x5b41('0x23')]=qs[_0x5b41('0x23')](_0x5a62b2[_0x5b41('0x37')]['limit']);_0x279e2e[_0x5b41('0x21')]=qs[_0x5b41('0x21')](_0x5a62b2['query'][_0x5b41('0x21')]);}_0x279e2e[_0x5b41('0x3f')]=qs[_0x5b41('0x40')](_0x5a62b2[_0x5b41('0x37')][_0x5b41('0x40')]);_0x279e2e[_0x5b41('0x41')]=qs['filters'](_[_0x5b41('0x42')](_0x5a62b2[_0x5b41('0x37')],_0x29549d[_0x5b41('0x39')]),_0x4f7d46);if(_0x5a62b2[_0x5b41('0x37')][_0x5b41('0x43')]){_0x279e2e[_0x5b41('0x41')]=_[_0x5b41('0x44')](_0x279e2e[_0x5b41('0x41')],{'$or':_[_0x5b41('0x31')](_0x4f7d46,function(_0x17e094){if(_0x17e094['type']!==_0x5b41('0x45')){var _0x14fa34={};_0x14fa34[_0x17e094[_0x5b41('0x2e')]]={'$like':'%'+_0x5a62b2[_0x5b41('0x37')][_0x5b41('0x43')]+'%'};return _0x14fa34;}})});}_0x279e2e=_[_0x5b41('0x44')]({},_0x279e2e,_0x5a62b2[_0x5b41('0x46')]);var _0xfe783f={'where':_0x279e2e[_0x5b41('0x41')]};return db['Plugin'][_0x5b41('0x24')](_0xfe783f)['then'](function(_0x2a6d0c){_0x3541f5['count']=_0x2a6d0c;if(_0x5a62b2[_0x5b41('0x37')]['includeAll']){_0x279e2e[_0x5b41('0x47')]=[{'all':!![]}];}return db[_0x5b41('0x32')][_0x5b41('0x48')](_0x279e2e);})[_0x5b41('0x28')](function(_0x4858e2){_0x3541f5[_0x5b41('0x49')]=_0x4858e2;return _0x3541f5;})['then'](respondWithFilteredResult(_0x1d5f12,_0x279e2e))[_0x5b41('0x4a')](handleError(_0x1d5f12,null));};exports[_0x5b41('0x4b')]=function(_0x345d5a,_0x125413){var _0x52cd3e={'raw':!![],'where':{'id':_0x345d5a['params']['id']}},_0x65304a={};_0x65304a[_0x5b41('0x36')]=_['keys'](db[_0x5b41('0x32')]['rawAttributes']);_0x65304a[_0x5b41('0x37')]=_[_0x5b41('0x38')](_0x345d5a[_0x5b41('0x37')]);_0x65304a[_0x5b41('0x39')]=_[_0x5b41('0x3a')](_0x65304a[_0x5b41('0x36')],_0x65304a['query']);_0x52cd3e[_0x5b41('0x3b')]=_['intersection'](_0x65304a[_0x5b41('0x36')],qs['fields'](_0x345d5a[_0x5b41('0x37')][_0x5b41('0x3c')]));_0x52cd3e[_0x5b41('0x3b')]=_0x52cd3e[_0x5b41('0x3b')]['length']?_0x52cd3e['attributes']:_0x65304a['model'];if(_0x345d5a['query'][_0x5b41('0x4c')]){_0x52cd3e[_0x5b41('0x47')]=[{'all':!![]}];}_0x52cd3e=_[_0x5b41('0x44')]({},_0x52cd3e,_0x345d5a[_0x5b41('0x46')]);return db[_0x5b41('0x32')]['find'](_0x52cd3e)[_0x5b41('0x28')](handleEntityNotFound(_0x125413,null))[_0x5b41('0x28')](respondWithResult(_0x125413,null))['catch'](handleError(_0x125413,null));};exports['download']=function(_0x2dabd9,_0x1810d2,_0x2c1652){return db[_0x5b41('0x32')]['find']({'where':{'id':_0x2dabd9[_0x5b41('0x4d')]['id']},'attributes':[_0x5b41('0x2e'),_0x5b41('0x6')],'raw':!![]})[_0x5b41('0x28')](handleEntityNotFound(_0x1810d2,null))[_0x5b41('0x28')](function(_0xe694f){if(_0xe694f){var _0x2d642a=path[_0x5b41('0x4e')](config[_0x5b41('0x4f')],_0x5b41('0x50'),util[_0x5b41('0x51')](_0x5b41('0x52'),path['basename'](_0xe694f[_0x5b41('0x6')])));var _0x16a11d=fs['createWriteStream'](_0x2d642a);var _0x554697=archiver('zip',{'zlib':{'level':0x9}});_0x554697['on'](_0x5b41('0x53'),function(_0x55580a){if(_0x55580a['code']===_0x5b41('0x54')){logger[_0x5b41('0x55')](_0x55580a);}else{throw new db[(_0x5b41('0x56'))][(_0x5b41('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x554697['on'](_0x5b41('0x55'),function(_0x2ad881){throw new db['Sequelize'][(_0x5b41('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x554697['pipe'](_0x16a11d);_0x554697[_0x5b41('0x58')](_0x5b41('0x59'),{'cwd':path[_0x5b41('0x4e')](config[_0x5b41('0x4f')],'server/files/plugins',path[_0x5b41('0x5a')](_0xe694f[_0x5b41('0x6')])),'ignore':[path['join'](path['basename'](_0xe694f[_0x5b41('0x6')]),_0x5b41('0x5b')),path['join'](path[_0x5b41('0x5c')](_0xe694f[_0x5b41('0x6')]),_0x5b41('0x5d'))],'nodir':!![]})[_0x5b41('0x5e')]();_0x16a11d['on'](_0x5b41('0x5f'),function(){if(!fs[_0x5b41('0x60')](_0x2d642a)){throw new db[(_0x5b41('0x56'))][(_0x5b41('0x57'))](_0x5b41('0x61'));}return _0x1810d2['download'](_0x2d642a,util[_0x5b41('0x51')](_0x5b41('0x52'),path[_0x5b41('0x5c')](_0xe694f[_0x5b41('0x6')])),function(_0x2faf01){if(_0x2faf01){throw new db[(_0x5b41('0x56'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x5b41('0x62')](_0x2d642a);logger[_0x5b41('0x63')](_0x5b41('0x64'));logger[_0x5b41('0x63')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x1810d2,null));};exports[_0x5b41('0x65')]=function(_0x2df493,_0x2b6131,_0x431f93){var _0x4147c8=path[_0x5b41('0x5c')](_0x2df493[_0x5b41('0x66')][_0x5b41('0x67')],path[_0x5b41('0x68')](_0x2df493[_0x5b41('0x66')][_0x5b41('0x67')]));var _0x3dce65=path['join'](config['root'],_0x5b41('0x50'),_0x2df493[_0x5b41('0x66')][_0x5b41('0x67')]);var _0x48dcd4=path[_0x5b41('0x4e')](config[_0x5b41('0x4f')],_0x5b41('0x50'),_0x4147c8);logger[_0x5b41('0x63')](_0x5b41('0x69'),_0x3dce65);logger[_0x5b41('0x63')](_0x5b41('0x6a'),_0x48dcd4);try{fs[_0x5b41('0x6b')](_0x3dce65,parseInt(_0x5b41('0x6c'),0x8));extract(_0x3dce65,{'dir':_0x48dcd4},function(_0x54192a){if(_0x54192a){logger['error'](_0x54192a);handleError(_0x54192a,!![]);};var _0x46bbcc=fs['readdirSync'](_0x48dcd4);if(_0x46bbcc[_0x5b41('0x3d')]>0x1){removeReferences(_0x3dce65,_0x48dcd4);logger[_0x5b41('0x55')](_0x5b41('0x6d'));return _0x431f93(new Error(_0x5b41('0x6d')));}var _0x1bad85=fs['lstatSync'](path[_0x5b41('0x4e')](_0x48dcd4,_0x46bbcc[0x0]));if(_0x1bad85[_0x5b41('0x6e')]()){removeReferences(_0x3dce65,_0x48dcd4);logger[_0x5b41('0x55')](_0x5b41('0x6d'));return _0x431f93(new Error(_0x5b41('0x6d')));}if(_0x1bad85['isDirectory']()){var _0x15ac58=fs[_0x5b41('0x6f')](path[_0x5b41('0x4e')](_0x48dcd4,_0x46bbcc[0x0]));if(_0x15ac58[_0x5b41('0x3d')]===0x0){removeReferences(_0x3dce65,_0x48dcd4);logger[_0x5b41('0x55')](_0x5b41('0x6d'));return _0x431f93(new Error('Invalid\x20plugin\x20structure'));}var _0x5c1e05=_0x15ac58[_0x5b41('0x70')](function(_0x4f3cb1){return _0x4f3cb1==='manifest.json';});if(!_0x5c1e05){return _0x431f93(new Error(_0x5b41('0x71')));}var _0x729dab=fs[_0x5b41('0x72')](path[_0x5b41('0x4e')](_0x48dcd4,_0x46bbcc[0x0],_0x5b41('0x73')));var _0x91df80=JSON[_0x5b41('0x74')](_0x729dab);if(_0x5b41('0x22')==typeof _0x91df80[_0x5b41('0x2e')]){return _0x431f93(new Error(_0x5b41('0x75')));}if(_0x5b41('0x22')==typeof _0x91df80['type']){return _0x431f93(new Error(_0x5b41('0x76')));}if(_0x5b41('0x22')==typeof _0x91df80['version']){return _0x431f93(new Error(_0x5b41('0x77')));}if(_0x5b41('0x22')==typeof _0x91df80[_0x5b41('0x78')]){return _0x431f93(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x91df80[_0x5b41('0x35')]===_0x5b41('0x79')){if(_0x5b41('0x22')==typeof _0x91df80['parameters'][_0x5b41('0x7a')]){return _0x431f93(new Error(_0x5b41('0x7b')));}if(_0x5b41('0x22')==typeof _0x91df80[_0x5b41('0x78')]['views'][_0x5b41('0x7c')]&&_0x5b41('0x22')==typeof _0x91df80['parameters'][_0x5b41('0x7a')][_0x5b41('0x7d')]){return _0x431f93(new Error(_0x5b41('0x7e')));}}else if(_0x91df80[_0x5b41('0x35')]===_0x5b41('0x7f')){if(_0x5b41('0x22')==typeof _0x91df80[_0x5b41('0x78')][_0x5b41('0x80')]){return _0x431f93(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5b41('0x22')==typeof _0x91df80[_0x5b41('0x78')]['scriptPath']){return _0x431f93(new Error(_0x5b41('0x81')));}}else{return _0x431f93(new Error(_0x5b41('0x82')));}var _0x11beb2=_0x91df80[_0x5b41('0x2e')];var _0x175672=_0x91df80['description'];var _0x37b99e=_0x91df80[_0x5b41('0x35')];var _0x4c15bb=_0x91df80[_0x5b41('0x83')]?_0x91df80['sidebar']:_0x5b41('0x84');var _0x5ecd45=_0x91df80[_0x5b41('0x85')]?_0x91df80[_0x5b41('0x85')]:_0x5b41('0x86');var _0xe1b7ff='';var _0x422516='';var _0x42168a='';var _0x190114='';var _0x199e3a=_0x91df80['version'];if(_0x37b99e===_0x5b41('0x79')){if(_0x5b41('0x22')!=typeof _0x91df80['parameters'][_0x5b41('0x7a')][_0x5b41('0x7c')]){var _0x37a2ec=_0x91df80[_0x5b41('0x78')][_0x5b41('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x5b41('0x87')](_0x37a2ec)){_0xe1b7ff=path[_0x5b41('0x4e')](_0x5b41('0x88'),_0x4147c8,_0x46bbcc[0x0],_0x37a2ec);}else{_0xe1b7ff=_0x37a2ec;}}else{logger[_0x5b41('0x63')](_0x5b41('0x89'));}if('undefined'!=typeof _0x91df80[_0x5b41('0x78')][_0x5b41('0x7a')][_0x5b41('0x7d')]){var _0x41b8fc=_0x91df80[_0x5b41('0x78')][_0x5b41('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x41b8fc)){_0x422516=path[_0x5b41('0x4e')](_0x5b41('0x88'),_0x4147c8,_0x46bbcc[0x0],_0x41b8fc);}else{_0x422516=_0x41b8fc;}}else{logger[_0x5b41('0x63')](_0x5b41('0x8a'));}}else if(_0x37b99e===_0x5b41('0x7f')){_0x42168a=_0x91df80['parameters'][_0x5b41('0x80')];_0x190114=_0x91df80['parameters'][_0x5b41('0x8b')];if('undefined'!=typeof _0x91df80['parameters']['views']){if(_0x5b41('0x22')!=typeof _0x91df80[_0x5b41('0x78')]['views'][_0x5b41('0x7c')]){var _0x37a2ec=_0x91df80[_0x5b41('0x78')][_0x5b41('0x7a')][_0x5b41('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x5b41('0x87')](_0x37a2ec)){_0xe1b7ff=path['join'](_0x5b41('0x88'),_0x4147c8,_0x46bbcc[0x0],_0x37a2ec);}else{_0xe1b7ff=_0x37a2ec;}}if('undefined'!=typeof _0x91df80['parameters']['views'][_0x5b41('0x7d')]){var _0x41b8fc=_0x91df80[_0x5b41('0x78')][_0x5b41('0x7a')][_0x5b41('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x5b41('0x87')](_0x41b8fc)){_0x422516=path[_0x5b41('0x4e')](_0x5b41('0x88'),_0x4147c8,_0x46bbcc[0x0],_0x41b8fc);}else{_0x422516=_0x41b8fc;}}}}var _0x526138={'name':_0x11beb2,'description':_0x175672,'path':path[_0x5b41('0x4e')](_0x4147c8,_0x46bbcc[0x0]),'type':_0x37b99e,'sidebar':_0x4c15bb,'icon':_0x5ecd45,'adminUrl':_0xe1b7ff,'agentUrl':_0x422516,'scriptName':_0x42168a,'scriptPath':_0x190114,'version':_0x199e3a};removeReferences(_0x3dce65,null);return db['Plugin'][_0x5b41('0x8c')](_0x526138)[_0x5b41('0x28')](function(_0x274880){var _0x357a42={'role':_0x2df493[_0x5b41('0x8d')][_0x5b41('0x8e')],'userProfileId':_0x2df493[_0x5b41('0x8d')]['userProfileId']};if(!_0x357a42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x357a42['role']===_0x5b41('0x8f')){var _0x2d7a35=_0x274880['get']({'plain':!![]});return db[_0x5b41('0x90')][_0x5b41('0x91')]({'where':{'name':'Plugins','userProfileId':_0x357a42[_0x5b41('0x92')]},'raw':!![]})[_0x5b41('0x28')](function(_0x296ca3){if(_0x296ca3&&_0x296ca3[_0x5b41('0x93')]===0x0){return db[_0x5b41('0x2b')][_0x5b41('0x8c')]({'name':_0x2d7a35[_0x5b41('0x2e')],'resourceId':_0x2d7a35['id'],'type':_0x296ca3['name'],'sectionId':_0x296ca3['id']},{})[_0x5b41('0x28')](function(){return _0x274880;});}else{return _0x274880;}})[_0x5b41('0x4a')](function(_0x1e96bc){logger[_0x5b41('0x55')](_0x5b41('0x94'),_0x1e96bc);throw _0x1e96bc;});}return _0x274880;})['then'](respondWithResult(_0x2b6131,null))[_0x5b41('0x4a')](handleError(_0x2b6131,null));}});}catch(_0x34a9c6){_0x2b6131[_0x5b41('0x1f')](0x1f4)['send'](_0x34a9c6);}};function removeReferences(_0x2f51f9,_0x54a44f){try{if(_0x2f51f9){fs['unlinkSync'](_0x2f51f9);logger['info'](_0x5b41('0x95'));}if(_0x54a44f){rimraf(_0x54a44f,function(){});logger[_0x5b41('0x63')](_0x5b41('0x96'));}}catch(_0xb5110a){logger[_0x5b41('0x55')](_0xb5110a);}}exports[_0x5b41('0x97')]=function(_0x51c8b2,_0x5553f8,_0x33ef3f){return db[_0x5b41('0x32')]['find']({'where':{'id':_0x51c8b2['params']['id']}})[_0x5b41('0x28')](handleEntityNotFound(_0x5553f8,null))[_0x5b41('0x28')](saveUpdates(_0x51c8b2[_0x5b41('0x8d')],null))[_0x5b41('0x28')](respondWithResult(_0x5553f8,null))[_0x5b41('0x4a')](handleError(_0x5553f8,null));};exports['delete']=function(_0x1105b4,_0x3525b1,_0x225c63){return db[_0x5b41('0x32')][_0x5b41('0x91')]({'where':{'id':_0x1105b4[_0x5b41('0x4d')]['id']}})['then'](function(_0x4042b0){if(_0x4042b0){return _0x4042b0[_0x5b41('0x2c')]();}})[_0x5b41('0x28')](function(_0x4ef753){rimraf(path['join'](config['root'],_0x5b41('0x50'),path[_0x5b41('0x5a')](_0x4ef753['path'])),function(){});return _0x4ef753;})[_0x5b41('0x28')](handleEntityNotFound(_0x3525b1,null))[_0x5b41('0x28')](respondWithStatusCode(_0x3525b1,null))[_0x5b41('0x4a')](handleError(_0x3525b1,null));};exports[_0x5b41('0x98')]=function(_0x42c1ea,_0x4594e8,_0x561c0d){return BPromise[_0x5b41('0x99')]()[_0x5b41('0x28')](function(){if(!_0x42c1ea[_0x5b41('0x37')][_0x5b41('0x6')]){throw new Error(_0x5b41('0x9a'));}if(!_0x42c1ea[_0x5b41('0x37')][_0x5b41('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x27a70d=_0x42c1ea['query']['hostname']?_0x42c1ea[_0x5b41('0x37')][_0x5b41('0x9c')]+':'+_0x42c1ea[_0x5b41('0x37')]['port']:_0x5b41('0x9d')+_0x42c1ea['query']['port'];var _0x2cd69d=_0x42c1ea['query'][_0x5b41('0x20')]?_0x42c1ea[_0x5b41('0x37')][_0x5b41('0x20')]:!![];var _0x1edb44=_0x42c1ea[_0x5b41('0x37')][_0x5b41('0x9e')]?_0x42c1ea['query'][_0x5b41('0x9e')]:null;var _0x5ebe00={'method':_0x42c1ea[_0x5b41('0x9f')],'uri':util['format'](_0x5b41('0xa0'),_0x27a70d,_0x42c1ea['query']['path']),'json':_0x2cd69d,'resolveWithFullResponse':!![],'encoding':_0x1edb44,'qs':_0x42c1ea[_0x5b41('0x37')]};if(_0x42c1ea['headers']){_0x5ebe00[_0x5b41('0xa1')]=_0x42c1ea['headers'];if(_0x5ebe00[_0x5b41('0xa1')][_0x5b41('0xa2')]){delete _0x5ebe00[_0x5b41('0xa1')]['content-length'];}}if(_0x5ebe00[_0x5b41('0xa1')][_0x5b41('0xa3')]){delete _0x5ebe00['headers']['content-type'];}return rp(_0x5ebe00);})['then'](function(_0x3d5240){if(_0x3d5240){_0x4594e8[_0x5b41('0x25')](_0x3d5240[_0x5b41('0xa1')]);logger[_0x5b41('0x63')](_0x3d5240[_0x5b41('0x8d')]);if(_[_0x5b41('0xa4')](_0x42c1ea[_0x5b41('0x37')][_0x5b41('0x6')],_0x5b41('0xa5'))&&_0x3d5240[_0x5b41('0xa6')]==0x1f4){return _0x4594e8['sendStatus'](_0x3d5240[_0x5b41('0xa6')]);}else{return _0x4594e8['status'](_0x3d5240[_0x5b41('0xa6')])[_0x5b41('0x2f')](_0x3d5240[_0x5b41('0x8d')]);}}else{return _0x4594e8['sendStatus'](0xc8);}})[_0x5b41('0x4a')](handleError(_0x4594e8,null));};exports[_0x5b41('0xa7')]=function(_0x1c31e6,_0x186fa4,_0x6a913e){return BPromise['resolve']()['then'](function(){if(!_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x9b')]){throw new Error(_0x5b41('0xa8'));}var _0x553c4b=_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x9c')]?_0x1c31e6['query'][_0x5b41('0x9c')]+':'+_0x1c31e6[_0x5b41('0x37')]['port']:_0x5b41('0x9d')+_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x9b')];var _0x47eac8=_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x20')]?_0x1c31e6['query'][_0x5b41('0x20')]:!![];var _0x2d42b1=_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x9e')]?_0x1c31e6[_0x5b41('0x37')]['encoding']:null;var _0x349ea5={'method':_0x1c31e6[_0x5b41('0x9f')],'uri':util[_0x5b41('0x51')]('%s%s',_0x553c4b,_0x1c31e6[_0x5b41('0x37')][_0x5b41('0x6')]),'json':_0x47eac8,'resolveWithFullResponse':!![],'encoding':_0x2d42b1,'body':_0x1c31e6[_0x5b41('0x8d')]};if(_0x1c31e6['headers']){_0x349ea5[_0x5b41('0xa1')]=_0x1c31e6[_0x5b41('0xa1')];if(_0x349ea5['headers']['content-length']){delete _0x349ea5[_0x5b41('0xa1')][_0x5b41('0xa2')];}}if(_0x349ea5['headers'][_0x5b41('0xa3')]){delete _0x349ea5['headers'][_0x5b41('0xa3')];}return rp(_0x349ea5);})[_0x5b41('0x28')](function(_0x21e803){if(_0x21e803){_0x186fa4['set'](_0x21e803[_0x5b41('0xa1')]);logger[_0x5b41('0x63')](_0x21e803[_0x5b41('0x8d')]);return _0x186fa4['status'](_0x21e803[_0x5b41('0xa6')])[_0x5b41('0x2f')](_0x21e803['body']);}else{return _0x186fa4[_0x5b41('0x1d')](0xc8);}})[_0x5b41('0x4a')](handleError(_0x186fa4,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5081862..3c415c7 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 _0xc962=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x537b8f,_0x20568a){var _0x17e8e0=function(_0x80e62c){while(--_0x80e62c){_0x537b8f['push'](_0x537b8f['shift']());}};_0x17e8e0(++_0x20568a);}(_0xc962,0x6d));var _0x2c96=function(_0x2f8084,_0x4ce042){_0x2f8084=_0x2f8084-0x0;var _0xd474df=_0xc962[_0x2f8084];return _0xd474df;};'use strict';var EventEmitter=require(_0x2c96('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c96('0x1'),'afterUpdate':_0x2c96('0x2'),'afterDestroy':_0x2c96('0x3')};function emitEvent(_0x1a1faf){return function(_0x305702,_0x83568f,_0x451d99){PluginEvents[_0x2c96('0x4')](_0x1a1faf+':'+_0x305702['id'],_0x305702);PluginEvents['emit'](_0x1a1faf,_0x305702);_0x451d99(null);};}for(var e in events){if(events[_0x2c96('0x5')](e)){var event=events[e];Plugin[_0x2c96('0x6')](e,emitEvent(event));}}module[_0x2c96('0x7')]=PluginEvents; \ No newline at end of file +var _0x9300=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9300,0x153));var _0x0930=function(_0xacabb,_0x1fbcd9){_0xacabb=_0xacabb-0x0;var _0x2b4a14=_0x9300[_0xacabb];return _0x2b4a14;};'use strict';var EventEmitter=require(_0x0930('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x0930('0x1')](0x0);var events={'afterCreate':_0x0930('0x2'),'afterUpdate':_0x0930('0x3'),'afterDestroy':_0x0930('0x4')};function emitEvent(_0x4130f8){return function(_0x49d993,_0x298c01,_0x1a61a6){PluginEvents['emit'](_0x4130f8+':'+_0x49d993['id'],_0x49d993);PluginEvents[_0x0930('0x5')](_0x4130f8,_0x49d993);_0x1a61a6(null);};}for(var e in events){if(events[_0x0930('0x6')](e)){var event=events[e];Plugin[_0x0930('0x7')](e,emitEvent(event));}}module[_0x0930('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6a41676..5cbb6aa 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 _0x0637=['bluebird','request-promise','path','./plugin.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x0637,0x7e));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7063('0x0'));var util=require('util');var logger=require(_0x7063('0x1'))(_0x7063('0x2'));var moment=require(_0x7063('0x3'));var BPromise=require(_0x7063('0x4'));var rp=require(_0x7063('0x5'));var fs=require('fs');var path=require(_0x7063('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7063('0x7'));module[_0x7063('0x8')]=function(_0x4b8552,_0x11e9f){return _0x4b8552[_0x7063('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc114=['../../config/logger','api','moment','bluebird','request-promise','Plugin','plugins','util'];(function(_0xefe8df,_0x399303){var _0x55b239=function(_0xd0ba4f){while(--_0xd0ba4f){_0xefe8df['push'](_0xefe8df['shift']());}};_0x55b239(++_0x399303);}(_0xc114,0x1e7));var _0x4c11=function(_0x5be773,_0x1be551){_0x5be773=_0x5be773-0x0;var _0x2fc751=_0xc114[_0x5be773];return _0x2fc751;};'use strict';var _=require('lodash');var util=require(_0x4c11('0x0'));var logger=require(_0x4c11('0x1'))(_0x4c11('0x2'));var moment=require(_0x4c11('0x3'));var BPromise=require(_0x4c11('0x4'));var rp=require(_0x4c11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x50a3bd,_0x5002a7){return _0x50a3bd['define'](_0x4c11('0x6'),attributes,{'tableName':_0x4c11('0x7'),'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 ba826e8..5acb838 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 _0x2a50=['defaults','socket.io-emitter','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x13aa63,_0x4b64aa){var _0x34cda2=function(_0x121d0a){while(--_0x121d0a){_0x13aa63['push'](_0x13aa63['shift']());}};_0x34cda2(++_0x4b64aa);}(_0x2a50,0xe6));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x02a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x02a5('0x1'));var rs=require(_0x02a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02a5('0x3'))['db'];var utils=require(_0x02a5('0x4'));var logger=require(_0x02a5('0x5'))(_0x02a5('0x6'));var config=require(_0x02a5('0x7'));var jayson=require(_0x02a5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x02a5('0x9')]=_[_0x02a5('0xa')](config[_0x02a5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x02a5('0xb'))(new Redis(config[_0x02a5('0x9')]));require('./plugin.socket')[_0x02a5('0xc')](socket);function respondWithRpcPromise(_0x1e4aea,_0x3a8f8a,_0x40b414){return new BPromise(function(_0x5dca0f,_0x43f2f5){return client[_0x02a5('0xd')](_0x1e4aea,_0x40b414)['then'](function(_0x1886ca){logger[_0x02a5('0xe')](_0x02a5('0xf'),_0x3a8f8a,_0x02a5('0x10'));logger[_0x02a5('0x11')](_0x02a5('0x12'),_0x3a8f8a,_0x02a5('0x10'),JSON[_0x02a5('0x13')](_0x1886ca));if(_0x1886ca[_0x02a5('0x14')]){if(_0x1886ca[_0x02a5('0x14')]['code']===0x1f4){logger[_0x02a5('0x14')](_0x02a5('0xf'),_0x3a8f8a,_0x1886ca[_0x02a5('0x14')]['message']);return _0x43f2f5(_0x1886ca['error'][_0x02a5('0x15')]);}logger[_0x02a5('0x14')]('Plugin,\x20%s,\x20%s',_0x3a8f8a,_0x1886ca[_0x02a5('0x14')][_0x02a5('0x15')]);return _0x5dca0f(_0x1886ca[_0x02a5('0x14')][_0x02a5('0x15')]);}else{logger[_0x02a5('0xe')](_0x02a5('0xf'),_0x3a8f8a,'request\x20sent');_0x5dca0f(_0x1886ca[_0x02a5('0x16')][_0x02a5('0x15')]);}})[_0x02a5('0x17')](function(_0x3414a5){logger['error']('Plugin,\x20%s,\x20%s',_0x3a8f8a,_0x3414a5);_0x43f2f5(_0x3414a5);});});}exports[_0x02a5('0x18')]=function(_0x528b70){var _0x1bad3a=this;return new Promise(function(_0x51ee84,_0x218e27){return db[_0x02a5('0x19')][_0x02a5('0x1a')](_0x528b70[_0x02a5('0x1b')],{'raw':_0x528b70[_0x02a5('0x1c')]?_0x528b70[_0x02a5('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x02a5('0x1d')](function(_0x1d64f9){logger[_0x02a5('0xe')](_0x02a5('0x18'),_0x528b70);logger[_0x02a5('0x11')](_0x02a5('0x18'),_0x528b70,JSON[_0x02a5('0x13')](_0x1d64f9));_0x51ee84(_0x1d64f9);})[_0x02a5('0x17')](function(_0x3f9a8a){logger[_0x02a5('0x14')](_0x02a5('0x18'),_0x3f9a8a[_0x02a5('0x15')],_0x528b70);_0x218e27(_0x1bad3a['error'](0x1f4,_0x3f9a8a[_0x02a5('0x15')]));});});}; \ No newline at end of file +var _0x6f02=['error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x6f02,0xf0));var _0x26f0=function(_0x5b4506,_0x2ec972){_0x5b4506=_0x5b4506-0x0;var _0x27aad3=_0x6f02[_0x5b4506];return _0x27aad3;};'use strict';var _=require(_0x26f0('0x0'));var util=require(_0x26f0('0x1'));var moment=require('moment');var BPromise=require(_0x26f0('0x2'));var rs=require(_0x26f0('0x3'));var fs=require('fs');var Redis=require(_0x26f0('0x4'));var db=require(_0x26f0('0x5'))['db'];var utils=require(_0x26f0('0x6'));var logger=require(_0x26f0('0x7'))(_0x26f0('0x8'));var config=require(_0x26f0('0x9'));var jayson=require(_0x26f0('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x26f0('0xb')]=_[_0x26f0('0xc')](config[_0x26f0('0xb')],{'host':_0x26f0('0xd'),'port':0x18eb});var socket=require(_0x26f0('0xe'))(new Redis(config['redis']));require(_0x26f0('0xf'))[_0x26f0('0x10')](socket);function respondWithRpcPromise(_0x587fa9,_0x4b2431,_0x457474){return new BPromise(function(_0x3b75f6,_0x256b99){return client[_0x26f0('0x11')](_0x587fa9,_0x457474)[_0x26f0('0x12')](function(_0x31a858){logger[_0x26f0('0x13')]('Plugin,\x20%s,\x20%s',_0x4b2431,_0x26f0('0x14'));logger[_0x26f0('0x15')](_0x26f0('0x16'),_0x4b2431,'request\x20sent',JSON[_0x26f0('0x17')](_0x31a858));if(_0x31a858[_0x26f0('0x18')]){if(_0x31a858[_0x26f0('0x18')][_0x26f0('0x19')]===0x1f4){logger['error'](_0x26f0('0x1a'),_0x4b2431,_0x31a858['error'][_0x26f0('0x1b')]);return _0x256b99(_0x31a858['error'][_0x26f0('0x1b')]);}logger[_0x26f0('0x18')](_0x26f0('0x1a'),_0x4b2431,_0x31a858['error'][_0x26f0('0x1b')]);return _0x3b75f6(_0x31a858['error'][_0x26f0('0x1b')]);}else{logger[_0x26f0('0x13')](_0x26f0('0x1a'),_0x4b2431,_0x26f0('0x14'));_0x3b75f6(_0x31a858[_0x26f0('0x1c')]['message']);}})['catch'](function(_0x3fa81f){logger[_0x26f0('0x18')](_0x26f0('0x1a'),_0x4b2431,_0x3fa81f);_0x256b99(_0x3fa81f);});});}exports[_0x26f0('0x1d')]=function(_0xf84fbe){var _0xe74a37=this;return new Promise(function(_0xb1513c,_0x3ec0f7){return db[_0x26f0('0x1e')]['create'](_0xf84fbe['body'],{'raw':_0xf84fbe['options']?_0xf84fbe[_0x26f0('0x1f')][_0x26f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x3910ab){logger[_0x26f0('0x13')](_0x26f0('0x1d'),_0xf84fbe);logger[_0x26f0('0x15')]('CreatePlugin',_0xf84fbe,JSON[_0x26f0('0x17')](_0x3910ab));_0xb1513c(_0x3910ab);})['catch'](function(_0x48441d){logger[_0x26f0('0x18')](_0x26f0('0x1d'),_0x48441d[_0x26f0('0x1b')],_0xf84fbe);_0x3ec0f7(_0xe74a37[_0x26f0('0x18')](0x1f4,_0x48441d[_0x26f0('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9ac652e..02d0493 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 _0x3d5d=['plugin:','./plugin.events','save','remove','update','emit','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d5d,0x1b3));var _0xd3d5=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x3d5d[_0x4bfe08];return _0x1f9125;};'use strict';var PluginEvents=require(_0xd3d5('0x0'));var events=[_0xd3d5('0x1'),_0xd3d5('0x2'),_0xd3d5('0x3')];function createListener(_0x534021,_0x328889){return function(_0x5f3fd7){_0x328889[_0xd3d5('0x4')](_0x534021,_0x5f3fd7);};}function removeListener(_0x1e64d4,_0x5ea716){return function(){PluginEvents['removeListener'](_0x1e64d4,_0x5ea716);};}exports['register']=function(_0x1f22f8){for(var _0x5b532d=0x0,_0x4d1e58=events[_0xd3d5('0x5')];_0x5b532d<_0x4d1e58;_0x5b532d++){var _0x3191df=events[_0x5b532d];var _0x38003e=createListener(_0xd3d5('0x6')+_0x3191df,_0x1f22f8);PluginEvents['on'](_0x3191df,_0x38003e);}}; \ No newline at end of file +var _0x4ebc=['register','length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x2419d2,_0x63d417){var _0x1ea483=function(_0x5d85ff){while(--_0x5d85ff){_0x2419d2['push'](_0x2419d2['shift']());}};_0x1ea483(++_0x63d417);}(_0x4ebc,0x150));var _0xc4eb=function(_0x59fae8,_0x4f483f){_0x59fae8=_0x59fae8-0x0;var _0x1039bf=_0x4ebc[_0x59fae8];return _0x1039bf;};'use strict';var PluginEvents=require(_0xc4eb('0x0'));var events=[_0xc4eb('0x1'),_0xc4eb('0x2'),_0xc4eb('0x3')];function createListener(_0x378aee,_0x202683){return function(_0x2f7600){_0x202683[_0xc4eb('0x4')](_0x378aee,_0x2f7600);};}function removeListener(_0x1cb844,_0x1cf20f){return function(){PluginEvents[_0xc4eb('0x5')](_0x1cb844,_0x1cf20f);};}exports[_0xc4eb('0x6')]=function(_0xe27637){for(var _0x27e2fb=0x0,_0x2c31b6=events[_0xc4eb('0x7')];_0x27e2fb<_0x2c31b6;_0x27e2fb++){var _0x12e8b2=events[_0x27e2fb];var _0x4cea82=createListener(_0xc4eb('0x8')+_0x12e8b2,_0xe27637);PluginEvents['on'](_0x12e8b2,_0x4cea82);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f7af9ef..a42ed84 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(_0x19cf7a,_0x1dd21e){var _0x1a75bb=function(_0x31aa5f){while(--_0x31aa5f){_0x19cf7a['push'](_0x19cf7a['shift']());}};_0x1a75bb(++_0x1dd21e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x126895,_0x468fb0){var _0x2df6da=function(_0x3d1ee1){while(--_0x3d1ee1){_0x126895['push'](_0x126895['shift']());}};_0x2df6da(++_0x468fb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 d69197b..8d7637b 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 _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x4b19e3,_0x2b63c3){var _0x2ce22a=function(_0x5c1fac){while(--_0x5c1fac){_0x4b19e3['push'](_0x4b19e3['shift']());}};_0x2ce22a(++_0x2b63c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xcb91[_0x25c326];return _0x762452;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file +var _0xa74f=['child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','body','script','cwd','chdir','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','params','delete','dump','../../config/logger'];(function(_0x1ade47,_0x3b9723){var _0x431dd4=function(_0x402ac3){while(--_0x402ac3){_0x1ade47['push'](_0x1ade47['shift']());}};_0x431dd4(++_0x3b9723);}(_0xa74f,0x9a));var _0xfa74=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xa74f[_0x16aaef];return _0x1c82ef;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xfa74('0x0'))('api');var path=require('path');var exec=require(_0xfa74('0x1'))[_0xfa74('0x2')];var BPromise=require(_0xfa74('0x3'));function handleEntityNotFound(_0x25a9b7,_0x5b367b){return function(_0x141625){if(!_0x141625){_0x25a9b7['sendStatus'](0x194);;}return _0x141625;};}function respondWithResult(_0x543cfe,_0x43dd2f){_0x43dd2f=_0x43dd2f||0xc8;return function(_0x9ddbd2){if(_0x9ddbd2){return _0x543cfe[_0xfa74('0x4')](_0x43dd2f)[_0xfa74('0x5')](_0x9ddbd2);}return null;};}function handleError(_0x287921,_0x344e04){_0x344e04=_0x344e04||0x1f4;return function(_0x5c0eb2){logger[_0xfa74('0x6')](_0x5c0eb2[_0xfa74('0x7')]);if(_0x5c0eb2[_0xfa74('0x8')]){delete _0x5c0eb2[_0xfa74('0x8')];}_0x287921['status'](_0x344e04)[_0xfa74('0x9')](_0x5c0eb2);};}function execChildProcess(){return new BPromise(function(_0x4f8891,_0x48695c){exec(_0xfa74('0xa'),function(_0x1d919d,_0x30b2d5,_0x307d35){logger['info'](_0x30b2d5);logger[_0xfa74('0xb')](_0x307d35);if(_0x1d919d){logger[_0xfa74('0x6')](_0x1d919d);return _0x48695c(_0x1d919d);}return _0x4f8891(_0x30b2d5);});});}exports[_0xfa74('0xc')]=function(_0x278e8b,_0x4ad407){return pm2[_0xfa74('0xd')]()[_0xfa74('0xe')](function(_0x3eb49b){if(_0x3eb49b){var _0x3947ca=_[_0xfa74('0xf')](_0x3eb49b,function(_0x47c8fb){return _0x47c8fb[_0xfa74('0x8')]===_0xfa74('0x10')||_0x47c8fb[_0xfa74('0x8')]===_0xfa74('0x11');});return{'rows':_0x3947ca,'count':_0x3947ca[_0xfa74('0x12')]};}return null;})[_0xfa74('0xe')](respondWithResult(_0x4ad407,null))[_0xfa74('0x13')](handleError(_0x4ad407,null));};exports['show']=function(_0x58a67a,_0xe0e33d){return pm2['describe'](_0x58a67a['params']['id'])[_0xfa74('0xe')](respondWithResult(_0xe0e33d,null))[_0xfa74('0xe')](handleEntityNotFound(_0xe0e33d,null))[_0xfa74('0x13')](handleError(_0xe0e33d,null));};exports['create']=function(_0x3bede6,_0x2edebb){if(_0x3bede6[_0xfa74('0x14')]['name']&&_0x3bede6[_0xfa74('0x14')][_0xfa74('0x15')]){var _0x2e6c33=path['join'](__dirname,'../../files/plugins',_0x3bede6[_0xfa74('0x14')][_0xfa74('0x15')]);var _0x9932db=process[_0xfa74('0x16')]();process[_0xfa74('0x17')](path['dirname'](_0x2e6c33));return execChildProcess()['then'](function(_0x3721bf){process['chdir'](_0x9932db);return pm2['start']({'name':_0x3bede6['body'][_0xfa74('0x8')],'script':_0x2e6c33});})[_0xfa74('0xe')](function(_0x42d9bf){pm2['dump']();return _0x42d9bf[0x0];})['then'](respondWithResult(_0x2edebb,0xc9))[_0xfa74('0x13')](handleError(_0x2edebb,null));}else{return _0x2edebb[_0xfa74('0x4')](0x1f4)['send']({'message':_0xfa74('0x18')});}};exports['update']=function(_0x1a8cf7,_0x153b2a){if(_0x1a8cf7['body']['id']){delete _0x1a8cf7[_0xfa74('0x14')]['id'];}var _0x1130de={'online':_0xfa74('0x19'),'stopped':_0xfa74('0x1a')};if(_0x1130de['hasOwnProperty'](_0x1a8cf7[_0xfa74('0x14')][_0xfa74('0x4')])){return pm2[_0x1130de[_0x1a8cf7[_0xfa74('0x14')]['status']]](_0x1a8cf7['params']['id'])[_0xfa74('0xe')](respondWithResult(_0x153b2a,0xc8))[_0xfa74('0x13')](handleError(_0x153b2a,null));}else{return _0x153b2a['status'](0x1f4)['send']({'message':_0xfa74('0x1b')});}};exports['destroy']=function(_0x2238d4,_0x4d6d0a){if(_0x2238d4[_0xfa74('0x14')]['id']){delete _0x2238d4[_0xfa74('0x14')]['id'];}if(_0x2238d4[_0xfa74('0x1c')]['id']){return pm2[_0xfa74('0x1d')](_0x2238d4['params']['id'])[_0xfa74('0xe')](function(_0x102d47){pm2[_0xfa74('0x1e')]();return _0x102d47[0x0];})[_0xfa74('0xe')](respondWithResult(_0x4d6d0a,null))[_0xfa74('0x13')](handleError(_0x4d6d0a,null));}else{return _0x4d6d0a[_0xfa74('0x4')](0x1f4)[_0xfa74('0x9')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index ecf7536..153c893 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 _0x1084=['exports','express','Router','../../components/auth/service','get','/agents','getAgents','/queues','getQueues'];(function(_0x19d172,_0x21bf9b){var _0x4e1ccd=function(_0x144213){while(--_0x144213){_0x19d172['push'](_0x19d172['shift']());}};_0x4e1ccd(++_0x21bf9b);}(_0x1084,0x7f));var _0x4108=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0x1084[_0x3fc31d];return _0x31bb91;};'use strict';var express=require(_0x4108('0x0'));var router=express[_0x4108('0x1')]();var auth=require(_0x4108('0x2'));var controller=require('./realtime.controller');router[_0x4108('0x3')](_0x4108('0x4'),auth['isAuthenticated'](),controller[_0x4108('0x5')]);router['get'](_0x4108('0x6'),auth['isAuthenticated'](),controller[_0x4108('0x7')]);module[_0x4108('0x8')]=router; \ No newline at end of file +var _0x5fbe=['/agents','getAgents','get','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller'];(function(_0xf930,_0x51dc94){var _0x1c1541=function(_0x10a993){while(--_0x10a993){_0xf930['push'](_0xf930['shift']());}};_0x1c1541(++_0x51dc94);}(_0x5fbe,0x1d2));var _0xe5fb=function(_0x3ff94a,_0x2d3599){_0x3ff94a=_0x3ff94a-0x0;var _0xacea64=_0x5fbe[_0x3ff94a];return _0xacea64;};'use strict';var express=require(_0xe5fb('0x0'));var router=express[_0xe5fb('0x1')]();var auth=require(_0xe5fb('0x2'));var controller=require(_0xe5fb('0x3'));router['get'](_0xe5fb('0x4'),auth['isAuthenticated'](),controller[_0xe5fb('0x5')]);router[_0xe5fb('0x6')](_0xe5fb('0x7'),auth['isAuthenticated'](),controller[_0xe5fb('0x8')]);module[_0xe5fb('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 dd86e24..18c90ad 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 _0x788a=['chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','resolve','query','channel','join','order','globalQueueFilter','User','fieldName','type','role','agent','getOptions','raw','where','isEmpty','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','pauseTypeFilter','getQueues','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','status','set','Content-Range','json','stack','name','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','voice','request','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','agents','loggedInDb','talking','outbound','pTalking','originated','merge','pick','queue','length','busy','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','push','Queue','findAll','QueueId','idle','unknown','ringing','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','filter','voiceStatus','pause','every','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','whatsapp','toLowerCase','findOne','getAgents','all','value','fields','includes','startsWith','ASC','sort','globalStatus','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x788a,0xcc));var _0xa788=function(_0x47087,_0x24eadd){_0x47087=_0x47087-0x0;var _0x2fba8c=_0x788a[_0x47087];return _0x2fba8c;};'use strict';var util=require(_0xa788('0x0'));var _=require(_0xa788('0x1'));var jayson=require(_0xa788('0x2'));var qs=require(_0xa788('0x3'));var logger=require(_0xa788('0x4'))(_0xa788('0x5'));var db=require(_0xa788('0x6'))['db'];var amiClient=jayson['client'][_0xa788('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0xa788('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x235ce8,_0x2e939e){return function(_0x14576b){if(_0x14576b){var _0x1308a8=typeof _0x2e939e[_0xa788('0x8')]===_0xa788('0x9')&&typeof _0x2e939e[_0xa788('0xa')]===_0xa788('0x9');var _0x2b4ea3=_0x14576b[_0xa788('0xb')];var _0x21d515=_0x1308a8?0x0:_0x2e939e[_0xa788('0x8')];var _0x32fd10=_0x1308a8?_0x14576b[_0xa788('0xb')]:_0x2e939e[_0xa788('0x8')]+_0x2e939e[_0xa788('0xa')];var _0x2bb553;if(_0x32fd10>=_0x2b4ea3){_0x32fd10=_0x2b4ea3;_0x2bb553=0xc8;}else{_0x2bb553=0xce;}_0x235ce8[_0xa788('0xc')](_0x2bb553);return _0x235ce8[_0xa788('0xd')](_0xa788('0xe'),_0x21d515+'-'+_0x32fd10+'/'+_0x2b4ea3)[_0xa788('0xf')](_0x14576b);}return null;};}function handleError(_0x405007,_0x1e2645){_0x1e2645=_0x1e2645||0x1f4;return function(_0x563062){logger['error'](_0x563062[_0xa788('0x10')]);if(_0x563062[_0xa788('0x11')]){delete _0x563062['name'];}_0x405007[_0xa788('0xc')](_0x1e2645)['send'](_0x563062);};}function getRealtimeAgents(){return new Promise(function(_0xe23dd,_0x3543eb){return amiClient['request'](_0xa788('0x12'),{})[_0xa788('0x13')](function(_0x4d9362){if(_0x4d9362[_0xa788('0x14')])throw new Error(_0xa788('0x15'));var _0x67e981=_0x4d9362['result'];return routingClient['request'](_0xa788('0x12'),{})[_0xa788('0x13')](function(_0x415e41){if(_0x415e41['error'])throw new Error(_0xa788('0x16'));var _0x52ac78=_0x415e41[_0xa788('0x17')];return _0xe23dd(_['merge']({},_0x67e981,_0x52ac78));});})[_0xa788('0x18')](function(_0x1229ef){_0x3543eb(_0x1229ef);});});}function getRealtimeQueues(_0x1a837b,_0x2cb976){return new Promise(function(_0x4038f5,_0x56c51c){var _0x1e8c55=_0x2cb976===_0xa788('0x19')?amiClient:routingClient;return _0x1e8c55[_0xa788('0x1a')](_[_0xa788('0x1b')](_0x2cb976)+_0xa788('0x1c'),_0x1a837b)[_0xa788('0x13')](function(_0x392182){if(_0x392182[_0xa788('0x14')])throw new Error(util['format'](_0xa788('0x1d'),_0x2cb976));return _0x4038f5(_0x392182[_0xa788('0x17')]);})[_0xa788('0x18')](function(_0x1020a7){_0x56c51c(_0x1020a7);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5aa362,_0x2a8c6d){return amiClient[_0xa788('0x1a')](_0xa788('0x1e'),{})[_0xa788('0x13')](function(_0x4578ef){if(_0x4578ef[_0xa788('0x14')])throw new Error(_0xa788('0x1f'));return _0x5aa362(_0x4578ef[_0xa788('0x17')]);})[_0xa788('0x18')](function(_0x5c29ac){_0x2a8c6d(_0x5c29ac);});});}function initializeQueues(_0x513e41,_0x44e6de,_0x26419a,_0x5aaab0){var _0x6461ca=[_0xa788('0x20'),_0xa788('0x21'),_0xa788('0x22'),'talking',_0xa788('0x23')];if(_0x26419a==='voice'&&_0x5aaab0==='outbound'){_0x6461ca['push']('pTalking','originated',_0xa788('0x24'),_0xa788('0x25'),_0xa788('0x26'),_0xa788('0x27'),'startPredictive',_0xa788('0x28'),_0xa788('0x29'),_0xa788('0x2a'),_0xa788('0x2b'),_0xa788('0x2c'),_0xa788('0x2d'),'dialPredictiveIntervalMaxThreshold',_0xa788('0x2e'),'predictiveIntervalAvailable',_0xa788('0x2f'),_0xa788('0x30'),_0xa788('0x31'),_0xa788('0x32'),'predictiveIntervalAvgHoldtime',_0xa788('0x33'));}return _0x513e41[_0xa788('0x34')](function(_0x464988){var _0x26a687=_0x464988['get']({'plain':!![]});_0x26a687[_0xa788('0x35')]=[];_0x26a687[_0xa788('0x23')]=0x0;_0x26a687[_0xa788('0x36')]=0x0;_0x26a687[_0xa788('0x20')]=0x0;_0x26a687[_0xa788('0x21')]=0x0;_0x26a687['waiting']=0x0;if(_0x26419a==='voice'){_0x26a687[_0xa788('0x37')]=0x0;_0x26a687['busy']=0x0;if(_0x5aaab0===_0xa788('0x38')){_0x26a687[_0xa788('0x39')]=0x0;_0x26a687[_0xa788('0x3a')]=0x0;}}var _0x23de16=_['find'](_0x44e6de,['id',_0x26a687['id']]);if(_0x23de16)_[_0xa788('0x3b')](_0x26a687,_[_0xa788('0x3c')](_0x23de16,_0x6461ca));return _0x26a687;});}function updateAgentVoiceStatus(_0x4caa74,_0x2b2e29,_0xa14558){var _0x2a5e2d=_['filter'](_0xa14558,[_0xa788('0x3d'),_0x2b2e29[_0xa788('0x11')]]);if(_0x2a5e2d[_0xa788('0x3e')]===0x0)return _0x4caa74[_0xa788('0x3f')]=!![];if(_[_0xa788('0x40')](_0x2a5e2d,[_0xa788('0x41'),_0x4caa74[_0xa788('0x42')][_0xa788('0x43')]()]))return _0x4caa74['talking']=!![];if(!_0x4caa74[_0xa788('0x37')])return _0x4caa74[_0xa788('0x3f')]=!![];}function getVoiceQueueAgents(_0x5775af,_0x313f0d,_0x2d805f,_0x50d305){var _0xed8be8=_[_0xa788('0x44')](_0x313f0d,['id',_0x5775af['id']]);if(!_0xed8be8)return _0x5775af;return _0xed8be8['getMembers']({'raw':!![]})[_0xa788('0x13')](function(_0x5e3fae){for(var _0x3fb177=0x0;_0x3fb177<_0x5e3fae[_0xa788('0x3e')];_0x3fb177++){var _0x4aa87c=_[_0xa788('0x44')](_0x2d805f,['id',_0x5e3fae[_0x3fb177][_0xa788('0x45')]]);if(!_0x4aa87c){_0x4aa87c={'id':_0x5e3fae[_0x3fb177][_0xa788('0x45')],'name':_0x5e3fae[_0x3fb177][_0xa788('0x45')],'accountcode':'','online':![]};}var _0x2eec97={'id':_0x4aa87c['id'],'name':_0x4aa87c[_0xa788('0x11')],'internal':_0x4aa87c[_0xa788('0x46')],'online':Boolean(_0x4aa87c[_0xa788('0x47')]),'paused':Boolean(_0x5e3fae[_0x3fb177][_0xa788('0x23')])};if(_0x4aa87c['voiceStatus']===_0xa788('0x37'))updateAgentVoiceStatus(_0x2eec97,_0x5775af,_0x50d305);if(_0x2eec97['online'])_0x5775af['loggedInDb']++;if(_0x2eec97[_0xa788('0x3f')])_0x5775af[_0xa788('0x3f')]++;if(_0x2eec97['paused']&&!_0x2eec97[_0xa788('0x3f')]&&!_0x2eec97['talking'])_0x5775af[_0xa788('0x23')]++;_0x5775af['agents'][_0xa788('0x48')](_0x2eec97);}return _0x5775af;});}function getQueueAgents(_0x3f2bd3,_0x321370,_0x1afd72){var _0x1c00a7='User'+_[_0xa788('0x1b')](_0x1afd72)+_0xa788('0x49');var _0x37eaaf=_0x1afd72+'Pause';return db[_0x1c00a7][_0xa788('0x4a')]({'where':{[_[_0xa788('0x1b')](_0x1afd72)+_0xa788('0x4b')]:_0x3f2bd3['id']},'raw':!![]})[_0xa788('0x13')](function(_0x4c6d3c){for(var _0x4f4f4e=0x0;_0x4f4f4e<_0x4c6d3c[_0xa788('0x3e')];_0x4f4f4e++){var _0x8b2576=_[_0xa788('0x44')](_0x321370,['id',_0x4c6d3c[_0x4f4f4e]['UserId']]);if(!_0x8b2576){_0x8b2576={'id':_0x4c6d3c[_0x4f4f4e][_0xa788('0x45')],'name':_0x4c6d3c[_0x4f4f4e][_0xa788('0x45')],'online':![],['pauseField']:![]};}var _0x51f19d={'id':_0x8b2576['id'],'name':_0x8b2576[_0xa788('0x11')],'online':Boolean(_0x8b2576[_0xa788('0x47')]),'paused':Boolean(_0x8b2576[_0x37eaaf])};if(_0x51f19d[_0xa788('0x47')])_0x3f2bd3['loggedInDb']++;_0x3f2bd3[_0xa788('0x35')][_0xa788('0x48')](_0x51f19d);}return _0x3f2bd3;});}function isIdle(_0x1c18a8){return _0x1c18a8===_0xa788('0x4c')||_0x1c18a8===_0xa788('0x4d')||_0x1c18a8==='unavailable'||_0x1c18a8===_0xa788('0x4e')||_['isNil'](_0x1c18a8);}function isAgentPaused(_0x231276,_0x72f5cc){var _0x20a2fd=[_0x231276[_0xa788('0x4f')],_0x231276[_0xa788('0x50')],_0x231276[_0xa788('0x51')],_0x231276['openchannelPause'],_0x231276[_0xa788('0x52')],_0x231276[_0xa788('0x53')],_0x231276[_0xa788('0x54')]];if(!_0x72f5cc)return _['every'](_0x20a2fd);var _0x4e6c27=_[_0xa788('0x55')](_0x20a2fd);return _0x4e6c27[_0xa788('0x3e')]>0x0&&_0x4e6c27['length']<_0x20a2fd['length']?!![]:![];}function isAgentIdle(_0x70032b){if(_0x70032b['voiceStatus']!=='idle'&&_0x70032b[_0xa788('0x53')]){_0x70032b[_0xa788('0x56')]=_0xa788('0x57');return![];}return _[_0xa788('0x58')]([_0x70032b['chatStatus'],_0x70032b[_0xa788('0x59')],_0x70032b[_0xa788('0x5a')],_0x70032b[_0xa788('0x5b')],_0x70032b[_0xa788('0x5c')],_0x70032b[_0xa788('0x56')],_0x70032b[_0xa788('0x5d')]],isIdle);}function getAgentStatus(_0x3d2fac){var _0x4988e0=_0xa788('0x4d');if(isAgentPaused(_0x3d2fac))_0x4988e0=_0xa788('0x57');else if(isAgentPaused(_0x3d2fac,!![]))_0x4988e0=_0xa788('0x5e');else if(isAgentIdle(_0x3d2fac))_0x4988e0=_0xa788('0x4c');else _0x4988e0='busy';return _0x4988e0;}function validateChannel(_0x28cbef){var _0x179b0b=[_0xa788('0x5f'),_0xa788('0x60'),_0xa788('0x61'),_0xa788('0x62'),'fax',_0xa788('0x63'),_0xa788('0x19')];if(!_['includes'](_0x179b0b,_0x28cbef[_0xa788('0x64')]()))throw new Error('Invalid\x20channel');return _0x28cbef[_0xa788('0x64')]();}function getFilteredAgentIds(_0x476c2b,_0x5b16ef){var _0x3094f1=_['isArray'](_0x476c2b)?_0x476c2b:[_0x476c2b];var _0x37f9cf=_['map'](_0x3094f1,function(_0x7f543b){return db[_0x5b16ef][_0xa788('0x65')]({'where':{'name':_0x7f543b}})[_0xa788('0x13')](function(_0x1ea309){if(!_0x1ea309)return[];return _0x1ea309[_0xa788('0x66')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa788('0x67')](_0x37f9cf)['then'](function(_0x474822){var _0xfad477=_(_0x474822)['flatten']()[_0xa788('0x34')]('id')['uniq']()[_0xa788('0x68')]();return _0xfad477;});}function getUpdatedSortOptions(_0x4de4d9){var _0x4094bf={'fields':[],'order':null};var _0x385fca=_0x4de4d9['split'](',');_0x4094bf[_0xa788('0x69')]=_['filter'](_0x385fca,function(_0x5e534f){if(!_0x5e534f[_0xa788('0x6a')]('globalStatus'))return!![];_0x4094bf['order']=_[_0xa788('0x6b')](_0x5e534f,'-')?'DESC':_0xa788('0x6c');return![];});return _0x4094bf;}function orderAgentsByStatus(_0x2f0dc2,_0x5a3d44){return _0x2f0dc2[_0xa788('0x6d')](function(_0x2542e9,_0x821466){if(_0x2542e9['globalStatus']===_0x821466[_0xa788('0x6e')]&&_0x2542e9[_0xa788('0x6e')]===_0xa788('0x57')){if(_0x5a3d44===_0xa788('0x6f'))return(_0x2542e9[_0xa788('0x70')]||'')<(_0x821466[_0xa788('0x70')]||'')?0x1:-0x1;return _0x2542e9[_0xa788('0x70')]<_0x821466[_0xa788('0x70')]?-0x1:0x1;}else{if(_0x5a3d44===_0xa788('0x6f'))return _0x2542e9[_0xa788('0x6e')]<_0x821466['globalStatus']?0x1:-0x1;return _0x2542e9[_0xa788('0x6e')]<_0x821466[_0xa788('0x6e')]?-0x1:0x1;}});}exports[_0xa788('0x66')]=function(_0x2bdee4,_0x464ea0){var _0x4ded60={'count':0x0,'rows':[]},_0xd0269b={},_0x216d7d,_0x1dbe05,_0x31d975,_0x34ce83,_0x4fc73f=[_0xa788('0x71'),_0xa788('0x47'),_0xa788('0x72'),_0xa788('0x73'),_0xa788('0x70'),_0xa788('0x73'),'internal',_0xa788('0x74'),'chatPause','openchannelPause','mailPause','smsPause',_0xa788('0x54'),'faxPause',_0xa788('0x53'),_0xa788('0x75'),_0xa788('0x76'),_0xa788('0x77'),_0xa788('0x78'),_0xa788('0x79'),'faxCapacity',_0xa788('0x7a'),_0xa788('0x7b'),_0xa788('0x7c'),_0xa788('0x7d'),'whatsappCurrentCapacity',_0xa788('0x7e'),'chatStatus',_0xa788('0x5b'),_0xa788('0x5a'),_0xa788('0x5c'),_0xa788('0x5d'),'faxStatus',_0xa788('0x56'),'chatStatusTime',_0xa788('0x7f'),_0xa788('0x80'),_0xa788('0x81'),_0xa788('0x82'),'faxStatusTime',_0xa788('0x83'),_0xa788('0x3d'),_0xa788('0x84'),_0xa788('0x85'),_0xa788('0x86'),_0xa788('0x87'),_0xa788('0x88')],_0x5d5805=[_0xa788('0x4f'),_0xa788('0x89'),_0xa788('0x51'),_0xa788('0x52'),_0xa788('0x54'),'faxPause',_0xa788('0x53'),_0xa788('0x47')];Promise[_0xa788('0x8a')]()['then'](function(){if(_0x2bdee4[_0xa788('0x8b')][_0xa788('0x8c')])_0x216d7d=validateChannel(_0x2bdee4['query'][_0xa788('0x8c')]);if(!_0x2bdee4[_0xa788('0x8b')][_0xa788('0x6d')]||!_0x2bdee4[_0xa788('0x8b')][_0xa788('0x6d')][_0xa788('0x6a')](_0xa788('0x6e')))return;var _0x43dbfa=getUpdatedSortOptions(_0x2bdee4[_0xa788('0x8b')][_0xa788('0x6d')]);_0x2bdee4['query'][_0xa788('0x6d')]=_0x43dbfa[_0xa788('0x69')][_0xa788('0x8d')](',');_0x1dbe05=_0x43dbfa[_0xa788('0x8e')];})[_0xa788('0x13')](function(){if(!_0x2bdee4['query']['globalQueueFilter'])return[];var _0x3f4f42=_[_0xa788('0x1b')](_0x216d7d)+_0xa788('0x49');return getFilteredAgentIds(_0x2bdee4[_0xa788('0x8b')][_0xa788('0x8f')],_0x3f4f42);})['then'](function(_0x3ada19){var _0x13780a=_[_0xa788('0x34')](db[_0xa788('0x90')]['rawAttributes'],function(_0x4eb79e){return{'name':_0x4eb79e[_0xa788('0x91')],'type':_0x4eb79e[_0xa788('0x92')]['key']};});_0x2bdee4[_0xa788('0x8b')][_0xa788('0x93')]=_0xa788('0x94');_0x2bdee4[_0xa788('0x8b')][_0xa788('0x47')]=!![];_0xd0269b=qs[_0xa788('0x95')](_0x13780a,_0x2bdee4);_0xd0269b[_0xa788('0x96')]=!![];if(!_['isEmpty'](_0x3ada19)){_0xd0269b[_0xa788('0x97')]=_[_0xa788('0x3b')](_0xd0269b[_0xa788('0x97')],{'$and':[{'id':{'$in':_0x3ada19}}]});}else if(!_[_0xa788('0x98')](_0x2bdee4['query'][_0xa788('0x8f')])){return _0x4ded60;}if(_0x2bdee4[_0xa788('0x99')]['role']===_0xa788('0x99')){var _0x1e3390={'params':{'id':_0x2bdee4[_0xa788('0x99')][_0xa788('0x9a')]},'query':{'section':_0xa788('0x12'),'role':'agent','online':!![],'nolimit':_0x2bdee4[_0xa788('0x8b')][_0xa788('0x9b')],'sort':_0x2bdee4[_0xa788('0x8b')]['sort'],'filter':_0x2bdee4[_0xa788('0x8b')][_0xa788('0x55')],'raw':!![],'ids':_0x3ada19}};return db[_0xa788('0x9c')][_0xa788('0x9d')](_0x1e3390);}return db[_0xa788('0x90')][_0xa788('0x9e')](_0xd0269b);})[_0xa788('0x13')](function(_0x176f7a){_0x4ded60[_0xa788('0xb')]=_0x176f7a[_0xa788('0xb')];_0x31d975=_0x176f7a['rows'];return getRealtimeAgents();})[_0xa788('0x13')](function(_0x5b0271){_0x34ce83=_0x5b0271[_0xa788('0x9f')];return _0x31d975[_0xa788('0x34')](function(_0x24d781){var _0x18ac42=_[_0xa788('0x44')](_0x34ce83,['id',_0x24d781['id']]);if(_0x18ac42)_[_0xa788('0x3b')](_0x24d781,_[_0xa788('0x3c')](_['omit'](_0x18ac42,_0x5d5805),_0x4fc73f));_0x24d781['globalStatus']=getAgentStatus(_0x24d781);return _0x24d781;});})[_0xa788('0x13')](function(_0x234e42){var _0x225e3c;if(_0x2bdee4[_0xa788('0x8b')]['globalStatusFilter']){_0x225e3c=_['filter'](_0x234e42,[_0xa788('0x6e'),_0x2bdee4[_0xa788('0x8b')]['globalStatusFilter']]);if(_0x2bdee4[_0xa788('0x8b')][_0xa788('0xa0')]){_0x225e3c=_[_0xa788('0x55')](_0x225e3c,[_0xa788('0x70'),_0x2bdee4['query'][_0xa788('0xa0')]]);}}if(_0x225e3c)_0x234e42=_0x225e3c;if(!_0x1dbe05)return _0x234e42;return orderAgentsByStatus(_0x234e42,_0x1dbe05);})[_0xa788('0x13')](function(_0x3656c8){_0x4ded60['rows']=_0x3656c8;return _0x4ded60;})['then'](respondWithFilteredResult(_0x464ea0,_0xd0269b))[_0xa788('0x18')](handleError(_0x464ea0,null));};exports[_0xa788('0xa1')]=function(_0x2716b8,_0x3cc6d0){var _0x697a6a={'count':0x0,'rows':[]},_0x2189d8={},_0x3ef561,_0x44aee0,_0x51dce6,_0x307ac7,_0x8d4dd9;Promise[_0xa788('0x8a')]()[_0xa788('0x13')](function(){if(_0x2716b8[_0xa788('0x8b')][_0xa788('0x8c')])_0x3ef561=validateChannel(_0x2716b8[_0xa788('0x8b')][_0xa788('0x8c')]);var _0x4990fe=_[_0xa788('0x1b')](_0x3ef561)+'Queue';var _0x78e74d=_[_0xa788('0x34')](db[_0x4990fe]['rawAttributes'],function(_0x4c5abd){return{'name':_0x4c5abd[_0xa788('0x91')],'type':_0x4c5abd['type']['key']};});_0x2189d8=qs[_0xa788('0x95')](_0x78e74d,_0x2716b8);if(_0x2716b8['user'][_0xa788('0x93')]===_0xa788('0x99')){var _0x21d5e6={'params':{'id':_0x2716b8['user'][_0xa788('0x9a')]},'query':{'section':_0x3ef561===_0xa788('0x19')&&_0x2716b8[_0xa788('0x8b')][_0xa788('0x92')]==='outbound'?_0xa788('0xa2'):_[_0xa788('0x1b')](_0x3ef561)+_0xa788('0x1c'),'type':_0x2716b8[_0xa788('0x8b')][_0xa788('0x92')],'nolimit':!![],'sort':_0xa788('0x11'),'filter':_0x2716b8['query'][_0xa788('0x55')]}};return db['UserProfile']['getResources'](_0x21d5e6);}return db[_0x4990fe][_0xa788('0x9e')](_0x2189d8);})[_0xa788('0x13')](function(_0x486966){_0x697a6a[_0xa788('0xb')]=_0x486966[_0xa788('0xb')];_0x44aee0=_0x486966[_0xa788('0x9f')];return getRealtimeQueues(_0x2716b8,_0x3ef561);})[_0xa788('0x13')](function(_0x476ec0){_0x307ac7=_0x476ec0['rows'];return getRealtimeAgents();})[_0xa788('0x13')](function(_0x1bba44){_0x51dce6=_0x1bba44[_0xa788('0x9f')];if(_0x3ef561!=_0xa788('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0xa788('0x13')](function(_0x5f564b){_0x8d4dd9=_0x5f564b?_0x5f564b[_0xa788('0x9f')]:[];return initializeQueues(_0x44aee0,_0x307ac7,_0x3ef561,_0x2716b8[_0xa788('0x8b')]['type']);})[_0xa788('0x13')](function(_0x2beea1){var _0x42f833=_0x2beea1['map'](function(_0x536142){if(_0x3ef561==='voice')return getVoiceQueueAgents(_0x536142,_0x44aee0,_0x51dce6,_0x8d4dd9);else return getQueueAgents(_0x536142,_0x51dce6,_0x3ef561);});return Promise[_0xa788('0x67')](_0x42f833);})[_0xa788('0x13')](function(_0x350455){_0x697a6a['rows']=_0x350455;return _0x697a6a;})[_0xa788('0x13')](respondWithFilteredResult(_0x3cc6d0,_0x2189d8))[_0xa788('0x18')](handleError(_0x3cc6d0,null));}; \ No newline at end of file +var _0x3bbf=['agent','getOptions','raw','where','user','role','userProfileId','nolimit','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','QueueCampaigns','Queues','UserProfile','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','outbound','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','map','get','agents','paused','talking','busy','find','pick','filter','queue','length','some','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','push','User','Queue','QueueId','loggedInDb','idle','unavailable','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','sms','whatsapp','includes','Invalid\x20channel','isArray','findOne','getAgents','all','uniq','value','split','globalStatus','order','startsWith','DESC','ASC','sort','pause','pauseType','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','fields','globalQueueFilter','type','key'];(function(_0x48d55c,_0x475769){var _0x311b8a=function(_0xa9c1f4){while(--_0xa9c1f4){_0x48d55c['push'](_0x48d55c['shift']());}};_0x311b8a(++_0x475769);}(_0x3bbf,0xb4));var _0xf3bb=function(_0x12113b,_0x1a3c1c){_0x12113b=_0x12113b-0x0;var _0x525a50=_0x3bbf[_0x12113b];return _0x525a50;};'use strict';var util=require(_0xf3bb('0x0'));var _=require('lodash');var jayson=require(_0xf3bb('0x1'));var qs=require(_0xf3bb('0x2'));var logger=require(_0xf3bb('0x3'))(_0xf3bb('0x4'));var db=require(_0xf3bb('0x5'))['db'];var amiClient=jayson[_0xf3bb('0x6')][_0xf3bb('0x7')]({'port':0x232a});var routingClient=jayson[_0xf3bb('0x6')][_0xf3bb('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x444489,_0x15687b){return function(_0x3d89e0){if(_0x3d89e0){var _0x45e4e4=typeof _0x15687b[_0xf3bb('0x8')]===_0xf3bb('0x9')&&typeof _0x15687b[_0xf3bb('0xa')]==='undefined';var _0x38fb22=_0x3d89e0['count'];var _0x26d3b4=_0x45e4e4?0x0:_0x15687b[_0xf3bb('0x8')];var _0x2f8f10=_0x45e4e4?_0x3d89e0[_0xf3bb('0xb')]:_0x15687b[_0xf3bb('0x8')]+_0x15687b[_0xf3bb('0xa')];var _0x519e2b;if(_0x2f8f10>=_0x38fb22){_0x2f8f10=_0x38fb22;_0x519e2b=0xc8;}else{_0x519e2b=0xce;}_0x444489[_0xf3bb('0xc')](_0x519e2b);return _0x444489[_0xf3bb('0xd')](_0xf3bb('0xe'),_0x26d3b4+'-'+_0x2f8f10+'/'+_0x38fb22)['json'](_0x3d89e0);}return null;};}function handleError(_0xb59017,_0x4a5ec8){_0x4a5ec8=_0x4a5ec8||0x1f4;return function(_0x5d4ee9){logger[_0xf3bb('0xf')](_0x5d4ee9[_0xf3bb('0x10')]);if(_0x5d4ee9[_0xf3bb('0x11')]){delete _0x5d4ee9[_0xf3bb('0x11')];}_0xb59017[_0xf3bb('0xc')](_0x4a5ec8)[_0xf3bb('0x12')](_0x5d4ee9);};}function getRealtimeAgents(){return new Promise(function(_0x9fd93,_0x4ca266){return amiClient[_0xf3bb('0x13')](_0xf3bb('0x14'),{})[_0xf3bb('0x15')](function(_0x54f349){if(_0x54f349[_0xf3bb('0xf')])throw new Error(_0xf3bb('0x16'));var _0x5d843d=_0x54f349[_0xf3bb('0x17')];return routingClient[_0xf3bb('0x13')](_0xf3bb('0x14'),{})['then'](function(_0x105228){if(_0x105228[_0xf3bb('0xf')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x35e7c7=_0x105228[_0xf3bb('0x17')];return _0x9fd93(_[_0xf3bb('0x18')]({},_0x5d843d,_0x35e7c7));});})[_0xf3bb('0x19')](function(_0x35d96c){_0x4ca266(_0x35d96c);});});}function getRealtimeQueues(_0x5e5aee,_0x175e59){return new Promise(function(_0x1fd97d,_0x12e597){var _0xf6416e=_0x175e59===_0xf3bb('0x1a')?amiClient:routingClient;return _0xf6416e['request'](_[_0xf3bb('0x1b')](_0x175e59)+'Queues',_0x5e5aee)[_0xf3bb('0x15')](function(_0x569844){if(_0x569844['error'])throw new Error(util[_0xf3bb('0x1c')](_0xf3bb('0x1d'),_0x175e59));return _0x1fd97d(_0x569844[_0xf3bb('0x17')]);})['catch'](function(_0x263d51){_0x12e597(_0x263d51);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x456d0a,_0x51ad00){return amiClient[_0xf3bb('0x13')](_0xf3bb('0x1e'),{})[_0xf3bb('0x15')](function(_0x3e947e){if(_0x3e947e['error'])throw new Error(_0xf3bb('0x1f'));return _0x456d0a(_0x3e947e['result']);})[_0xf3bb('0x19')](function(_0x456287){_0x51ad00(_0x456287);});});}function initializeQueues(_0x16b41c,_0x9a714c,_0x10278d,_0x244837){var _0x1a91ed=[_0xf3bb('0x20'),_0xf3bb('0x21'),_0xf3bb('0x22'),'talking','paused'];if(_0x10278d===_0xf3bb('0x1a')&&_0x244837===_0xf3bb('0x23')){_0x1a91ed['push'](_0xf3bb('0x24'),_0xf3bb('0x25'),'message',_0xf3bb('0x26'),_0xf3bb('0x27'),_0xf3bb('0x28'),_0xf3bb('0x29'),'startProgressive',_0xf3bb('0x2a'),_0xf3bb('0x2b'),_0xf3bb('0x2c'),_0xf3bb('0x2d'),'dialPredictiveInterval',_0xf3bb('0x2e'),_0xf3bb('0x2f'),_0xf3bb('0x30'),'predictiveIntervalTotalCalls',_0xf3bb('0x31'),_0xf3bb('0x32'),'predictiveIntervalDroppedCallsCallersExit',_0xf3bb('0x33'),'predictiveIntervalAvgTalktime');}return _0x16b41c[_0xf3bb('0x34')](function(_0xa62062){var _0x18f586=_0xa62062[_0xf3bb('0x35')]({'plain':!![]});_0x18f586[_0xf3bb('0x36')]=[];_0x18f586[_0xf3bb('0x37')]=0x0;_0x18f586['loggedInDb']=0x0;_0x18f586[_0xf3bb('0x20')]=0x0;_0x18f586['available']=0x0;_0x18f586[_0xf3bb('0x22')]=0x0;if(_0x10278d===_0xf3bb('0x1a')){_0x18f586[_0xf3bb('0x38')]=0x0;_0x18f586[_0xf3bb('0x39')]=0x0;if(_0x244837==='outbound'){_0x18f586[_0xf3bb('0x24')]=0x0;_0x18f586['originated']=0x0;}}var _0x1ec0ca=_[_0xf3bb('0x3a')](_0x9a714c,['id',_0x18f586['id']]);if(_0x1ec0ca)_[_0xf3bb('0x18')](_0x18f586,_[_0xf3bb('0x3b')](_0x1ec0ca,_0x1a91ed));return _0x18f586;});}function updateAgentVoiceStatus(_0x40f635,_0x548454,_0x34fdaa){var _0x419988=_[_0xf3bb('0x3c')](_0x34fdaa,[_0xf3bb('0x3d'),_0x548454[_0xf3bb('0x11')]]);if(_0x419988[_0xf3bb('0x3e')]===0x0)return _0x40f635[_0xf3bb('0x39')]=!![];if(_[_0xf3bb('0x3f')](_0x419988,['connectedlinenum',_0x40f635[_0xf3bb('0x40')][_0xf3bb('0x41')]()]))return _0x40f635['talking']=!![];if(!_0x40f635['talking'])return _0x40f635[_0xf3bb('0x39')]=!![];}function getVoiceQueueAgents(_0x2af96a,_0x1d1c97,_0x256391,_0x1142cb){var _0x25c018=_[_0xf3bb('0x3a')](_0x1d1c97,['id',_0x2af96a['id']]);if(!_0x25c018)return _0x2af96a;return _0x25c018[_0xf3bb('0x42')]({'raw':!![]})[_0xf3bb('0x15')](function(_0x2c8c96){for(var _0x33442b=0x0;_0x33442b<_0x2c8c96[_0xf3bb('0x3e')];_0x33442b++){var _0xb63154=_[_0xf3bb('0x3a')](_0x256391,['id',_0x2c8c96[_0x33442b]['UserId']]);if(!_0xb63154){_0xb63154={'id':_0x2c8c96[_0x33442b][_0xf3bb('0x43')],'name':_0x2c8c96[_0x33442b]['UserId'],'accountcode':'','online':![]};}var _0x3b53d3={'id':_0xb63154['id'],'name':_0xb63154['name'],'internal':_0xb63154[_0xf3bb('0x44')],'online':Boolean(_0xb63154[_0xf3bb('0x45')]),'paused':Boolean(_0x2c8c96[_0x33442b][_0xf3bb('0x37')])};if(_0xb63154[_0xf3bb('0x46')]===_0xf3bb('0x38'))updateAgentVoiceStatus(_0x3b53d3,_0x2af96a,_0x1142cb);if(_0x3b53d3[_0xf3bb('0x45')])_0x2af96a['loggedInDb']++;if(_0x3b53d3[_0xf3bb('0x39')])_0x2af96a[_0xf3bb('0x39')]++;if(_0x3b53d3[_0xf3bb('0x37')]&&!_0x3b53d3[_0xf3bb('0x39')]&&!_0x3b53d3[_0xf3bb('0x38')])_0x2af96a['paused']++;_0x2af96a[_0xf3bb('0x36')][_0xf3bb('0x47')](_0x3b53d3);}return _0x2af96a;});}function getQueueAgents(_0x1c457c,_0x33eca8,_0x1e9443){var _0xfcd9c6=_0xf3bb('0x48')+_[_0xf3bb('0x1b')](_0x1e9443)+_0xf3bb('0x49');var _0x3ffc2b=_0x1e9443+'Pause';return db[_0xfcd9c6]['findAll']({'where':{[_[_0xf3bb('0x1b')](_0x1e9443)+_0xf3bb('0x4a')]:_0x1c457c['id']},'raw':!![]})[_0xf3bb('0x15')](function(_0x365de2){for(var _0x102ef4=0x0;_0x102ef4<_0x365de2[_0xf3bb('0x3e')];_0x102ef4++){var _0x286187=_[_0xf3bb('0x3a')](_0x33eca8,['id',_0x365de2[_0x102ef4]['UserId']]);if(!_0x286187){_0x286187={'id':_0x365de2[_0x102ef4][_0xf3bb('0x43')],'name':_0x365de2[_0x102ef4]['UserId'],'online':![],['pauseField']:![]};}var _0x1867c3={'id':_0x286187['id'],'name':_0x286187[_0xf3bb('0x11')],'online':Boolean(_0x286187[_0xf3bb('0x45')]),'paused':Boolean(_0x286187[_0x3ffc2b])};if(_0x1867c3[_0xf3bb('0x45')])_0x1c457c[_0xf3bb('0x4b')]++;_0x1c457c[_0xf3bb('0x36')][_0xf3bb('0x47')](_0x1867c3);}return _0x1c457c;});}function isIdle(_0x15b404){return _0x15b404===_0xf3bb('0x4c')||_0x15b404==='unknown'||_0x15b404===_0xf3bb('0x4d')||_0x15b404===_0xf3bb('0x4e')||_[_0xf3bb('0x4f')](_0x15b404);}function isAgentPaused(_0x335ff3,_0x4eac70){var _0x1e7946=[_0x335ff3[_0xf3bb('0x50')],_0x335ff3[_0xf3bb('0x51')],_0x335ff3[_0xf3bb('0x52')],_0x335ff3[_0xf3bb('0x53')],_0x335ff3[_0xf3bb('0x54')],_0x335ff3[_0xf3bb('0x55')],_0x335ff3[_0xf3bb('0x56')]];if(!_0x4eac70)return _[_0xf3bb('0x57')](_0x1e7946);var _0x314626=_[_0xf3bb('0x3c')](_0x1e7946);return _0x314626['length']>0x0&&_0x314626[_0xf3bb('0x3e')]<_0x1e7946[_0xf3bb('0x3e')]?!![]:![];}function isAgentIdle(_0x16561d){if(_0x16561d[_0xf3bb('0x46')]!=='idle'&&_0x16561d[_0xf3bb('0x55')]){_0x16561d[_0xf3bb('0x46')]='pause';return![];}return _['every']([_0x16561d[_0xf3bb('0x58')],_0x16561d['faxStatus'],_0x16561d[_0xf3bb('0x59')],_0x16561d[_0xf3bb('0x5a')],_0x16561d[_0xf3bb('0x5b')],_0x16561d[_0xf3bb('0x46')],_0x16561d[_0xf3bb('0x5c')]],isIdle);}function getAgentStatus(_0x455fb5){var _0x5429a4='unknown';if(isAgentPaused(_0x455fb5))_0x5429a4='pause';else if(isAgentPaused(_0x455fb5,!![]))_0x5429a4=_0xf3bb('0x5d');else if(isAgentIdle(_0x455fb5))_0x5429a4=_0xf3bb('0x4c');else _0x5429a4='busy';return _0x5429a4;}function validateChannel(_0x1d8d2e){var _0x55870a=[_0xf3bb('0x5e'),'chat',_0xf3bb('0x5f'),'openchannel','fax',_0xf3bb('0x60'),_0xf3bb('0x1a')];if(!_[_0xf3bb('0x61')](_0x55870a,_0x1d8d2e['toLowerCase']()))throw new Error(_0xf3bb('0x62'));return _0x1d8d2e['toLowerCase']();}function getFilteredAgentIds(_0x2737f7,_0xfdd00c){var _0x14ed0=_[_0xf3bb('0x63')](_0x2737f7)?_0x2737f7:[_0x2737f7];var _0x12489c=_['map'](_0x14ed0,function(_0x2c3967){return db[_0xfdd00c][_0xf3bb('0x64')]({'where':{'name':_0x2c3967}})[_0xf3bb('0x15')](function(_0x396d38){if(!_0x396d38)return[];return _0x396d38[_0xf3bb('0x65')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf3bb('0x66')](_0x12489c)[_0xf3bb('0x15')](function(_0x5b8ab2){var _0xf7cd11=_(_0x5b8ab2)['flatten']()[_0xf3bb('0x34')]('id')[_0xf3bb('0x67')]()[_0xf3bb('0x68')]();return _0xf7cd11;});}function getUpdatedSortOptions(_0x4577a1){var _0x231d38={'fields':[],'order':null};var _0x14f708=_0x4577a1[_0xf3bb('0x69')](',');_0x231d38['fields']=_['filter'](_0x14f708,function(_0x3eb5e8){if(!_0x3eb5e8[_0xf3bb('0x61')](_0xf3bb('0x6a')))return!![];_0x231d38[_0xf3bb('0x6b')]=_[_0xf3bb('0x6c')](_0x3eb5e8,'-')?_0xf3bb('0x6d'):_0xf3bb('0x6e');return![];});return _0x231d38;}function orderAgentsByStatus(_0x206393,_0x2113bd){return _0x206393[_0xf3bb('0x6f')](function(_0x2e088d,_0x5d1628){if(_0x2e088d[_0xf3bb('0x6a')]===_0x5d1628[_0xf3bb('0x6a')]&&_0x2e088d[_0xf3bb('0x6a')]===_0xf3bb('0x70')){if(_0x2113bd==='DESC')return(_0x2e088d[_0xf3bb('0x71')]||'')<(_0x5d1628[_0xf3bb('0x71')]||'')?0x1:-0x1;return _0x2e088d[_0xf3bb('0x71')]<_0x5d1628[_0xf3bb('0x71')]?-0x1:0x1;}else{if(_0x2113bd===_0xf3bb('0x6d'))return _0x2e088d[_0xf3bb('0x6a')]<_0x5d1628[_0xf3bb('0x6a')]?0x1:-0x1;return _0x2e088d[_0xf3bb('0x6a')]<_0x5d1628[_0xf3bb('0x6a')]?-0x1:0x1;}});}exports['getAgents']=function(_0x485e1b,_0x123187){var _0x3235c1={'count':0x0,'rows':[]},_0x2fae1e={},_0x1e6c39,_0x3f2747,_0x5b14db,_0x5ac2ac,_0x50f70a=[_0xf3bb('0x72'),'online',_0xf3bb('0x73'),_0xf3bb('0x74'),_0xf3bb('0x71'),_0xf3bb('0x74'),_0xf3bb('0x40'),_0xf3bb('0x75'),_0xf3bb('0x50'),'openchannelPause','mailPause','smsPause',_0xf3bb('0x56'),_0xf3bb('0x51'),_0xf3bb('0x55'),'chatCapacity',_0xf3bb('0x76'),'mailCapacity',_0xf3bb('0x77'),_0xf3bb('0x78'),'faxCapacity',_0xf3bb('0x79'),_0xf3bb('0x7a'),_0xf3bb('0x7b'),_0xf3bb('0x7c'),_0xf3bb('0x7d'),_0xf3bb('0x7e'),_0xf3bb('0x58'),'openchannelStatus',_0xf3bb('0x59'),_0xf3bb('0x5b'),_0xf3bb('0x5c'),_0xf3bb('0x7f'),_0xf3bb('0x46'),_0xf3bb('0x80'),_0xf3bb('0x81'),_0xf3bb('0x82'),_0xf3bb('0x83'),'whatsappStatusTime','faxStatusTime',_0xf3bb('0x84'),'queue','destconnectedlinenum',_0xf3bb('0x85'),_0xf3bb('0x86'),_0xf3bb('0x87'),_0xf3bb('0x88')],_0x209172=[_0xf3bb('0x50'),'openchannelPause',_0xf3bb('0x52'),_0xf3bb('0x54'),_0xf3bb('0x56'),_0xf3bb('0x51'),_0xf3bb('0x55'),_0xf3bb('0x45')];Promise[_0xf3bb('0x89')]()['then'](function(){if(_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x8b')])_0x1e6c39=validateChannel(_0x485e1b[_0xf3bb('0x8a')]['channel']);if(!_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x6f')]||!_0x485e1b['query'][_0xf3bb('0x6f')][_0xf3bb('0x61')]('globalStatus'))return;var _0x36a7ad=getUpdatedSortOptions(_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x6f')]);_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x6f')]=_0x36a7ad[_0xf3bb('0x8c')]['join'](',');_0x3f2747=_0x36a7ad[_0xf3bb('0x6b')];})[_0xf3bb('0x15')](function(){if(!_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x8d')])return[];var _0x3b5fe6=_[_0xf3bb('0x1b')](_0x1e6c39)+_0xf3bb('0x49');return getFilteredAgentIds(_0x485e1b['query']['globalQueueFilter'],_0x3b5fe6);})[_0xf3bb('0x15')](function(_0x3612b0){var _0x2648ef=_[_0xf3bb('0x34')](db[_0xf3bb('0x48')]['rawAttributes'],function(_0xe31139){return{'name':_0xe31139['fieldName'],'type':_0xe31139[_0xf3bb('0x8e')][_0xf3bb('0x8f')]};});_0x485e1b[_0xf3bb('0x8a')]['role']=_0xf3bb('0x90');_0x485e1b['query']['online']=!![];_0x2fae1e=qs[_0xf3bb('0x91')](_0x2648ef,_0x485e1b);_0x2fae1e[_0xf3bb('0x92')]=!![];if(!_['isEmpty'](_0x3612b0)){_0x2fae1e[_0xf3bb('0x93')]=_[_0xf3bb('0x18')](_0x2fae1e[_0xf3bb('0x93')],{'$and':[{'id':{'$in':_0x3612b0}}]});}else if(!_['isEmpty'](_0x485e1b[_0xf3bb('0x8a')]['globalQueueFilter'])){return _0x3235c1;}if(_0x485e1b[_0xf3bb('0x94')][_0xf3bb('0x95')]===_0xf3bb('0x94')){var _0x590d97={'params':{'id':_0x485e1b[_0xf3bb('0x94')][_0xf3bb('0x96')]},'query':{'section':_0xf3bb('0x14'),'role':_0xf3bb('0x90'),'online':!![],'nolimit':_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x97')],'sort':_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x6f')],'filter':_0x485e1b[_0xf3bb('0x8a')]['filter'],'raw':!![],'ids':_0x3612b0}};return db['UserProfile'][_0xf3bb('0x98')](_0x590d97);}return db[_0xf3bb('0x48')][_0xf3bb('0x99')](_0x2fae1e);})[_0xf3bb('0x15')](function(_0x518b26){_0x3235c1[_0xf3bb('0xb')]=_0x518b26[_0xf3bb('0xb')];_0x5b14db=_0x518b26[_0xf3bb('0x9a')];return getRealtimeAgents();})[_0xf3bb('0x15')](function(_0x3131ee){_0x5ac2ac=_0x3131ee['rows'];return _0x5b14db[_0xf3bb('0x34')](function(_0x100bb1){var _0x4d7612=_[_0xf3bb('0x3a')](_0x5ac2ac,['id',_0x100bb1['id']]);if(_0x4d7612)_[_0xf3bb('0x18')](_0x100bb1,_[_0xf3bb('0x3b')](_[_0xf3bb('0x9b')](_0x4d7612,_0x209172),_0x50f70a));_0x100bb1['globalStatus']=getAgentStatus(_0x100bb1);return _0x100bb1;});})[_0xf3bb('0x15')](function(_0x3d0950){var _0x517d57;if(_0x485e1b['query']['globalStatusFilter']){_0x517d57=_[_0xf3bb('0x3c')](_0x3d0950,[_0xf3bb('0x6a'),_0x485e1b[_0xf3bb('0x8a')][_0xf3bb('0x9c')]]);if(_0x485e1b[_0xf3bb('0x8a')]['pauseTypeFilter']){_0x517d57=_['filter'](_0x517d57,[_0xf3bb('0x71'),_0x485e1b['query'][_0xf3bb('0x9d')]]);}}if(_0x517d57)_0x3d0950=_0x517d57;if(!_0x3f2747)return _0x3d0950;return orderAgentsByStatus(_0x3d0950,_0x3f2747);})['then'](function(_0xb9c519){_0x3235c1[_0xf3bb('0x9a')]=_0xb9c519;return _0x3235c1;})[_0xf3bb('0x15')](respondWithFilteredResult(_0x123187,_0x2fae1e))[_0xf3bb('0x19')](handleError(_0x123187,null));};exports[_0xf3bb('0x9e')]=function(_0x50b3f6,_0x3aa200){var _0x4a7244={'count':0x0,'rows':[]},_0x5a5a48={},_0x32985f,_0x582cfb,_0x284ee6,_0x204b95,_0x2047da;Promise[_0xf3bb('0x89')]()[_0xf3bb('0x15')](function(){if(_0x50b3f6['query']['channel'])_0x32985f=validateChannel(_0x50b3f6['query']['channel']);var _0x34c3c3=_['startCase'](_0x32985f)+'Queue';var _0x8b9f7b=_[_0xf3bb('0x34')](db[_0x34c3c3]['rawAttributes'],function(_0x428f4a){return{'name':_0x428f4a['fieldName'],'type':_0x428f4a['type'][_0xf3bb('0x8f')]};});_0x5a5a48=qs[_0xf3bb('0x91')](_0x8b9f7b,_0x50b3f6);if(_0x50b3f6[_0xf3bb('0x94')][_0xf3bb('0x95')]===_0xf3bb('0x94')){var _0x196fe5={'params':{'id':_0x50b3f6[_0xf3bb('0x94')][_0xf3bb('0x96')]},'query':{'section':_0x32985f==='voice'&&_0x50b3f6[_0xf3bb('0x8a')][_0xf3bb('0x8e')]===_0xf3bb('0x23')?_0xf3bb('0x9f'):_[_0xf3bb('0x1b')](_0x32985f)+_0xf3bb('0xa0'),'type':_0x50b3f6[_0xf3bb('0x8a')]['type'],'nolimit':!![],'sort':_0xf3bb('0x11'),'filter':_0x50b3f6[_0xf3bb('0x8a')][_0xf3bb('0x3c')]}};return db[_0xf3bb('0xa1')][_0xf3bb('0x98')](_0x196fe5);}return db[_0x34c3c3][_0xf3bb('0x99')](_0x5a5a48);})['then'](function(_0x16c790){_0x4a7244[_0xf3bb('0xb')]=_0x16c790[_0xf3bb('0xb')];_0x582cfb=_0x16c790[_0xf3bb('0x9a')];return getRealtimeQueues(_0x50b3f6,_0x32985f);})[_0xf3bb('0x15')](function(_0x248eaa){_0x204b95=_0x248eaa['rows'];return getRealtimeAgents();})[_0xf3bb('0x15')](function(_0x54f5c8){_0x284ee6=_0x54f5c8[_0xf3bb('0x9a')];if(_0x32985f!='voice')return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x1a3be9){_0x2047da=_0x1a3be9?_0x1a3be9['rows']:[];return initializeQueues(_0x582cfb,_0x204b95,_0x32985f,_0x50b3f6[_0xf3bb('0x8a')]['type']);})[_0xf3bb('0x15')](function(_0x1310ad){var _0x60e87c=_0x1310ad[_0xf3bb('0x34')](function(_0x306f17){if(_0x32985f===_0xf3bb('0x1a'))return getVoiceQueueAgents(_0x306f17,_0x582cfb,_0x284ee6,_0x2047da);else return getQueueAgents(_0x306f17,_0x284ee6,_0x32985f);});return Promise[_0xf3bb('0x66')](_0x60e87c);})['then'](function(_0x11657f){_0x4a7244['rows']=_0x11657f;return _0x4a7244;})[_0xf3bb('0x15')](respondWithFilteredResult(_0x3aa200,_0x5a5a48))[_0xf3bb('0x19')](handleError(_0x3aa200,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d373a3a..634ac1c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c23cc,_0x3bac85){var _0x1add2d=function(_0x349672){while(--_0x349672){_0x5c23cc['push'](_0x5c23cc['shift']());}};_0x1add2d(++_0x3bac85);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3f415c,_0x310f72){var _0x8f2df8=function(_0x3e7afe){while(--_0x3e7afe){_0x3f415c['push'](_0x3f415c['shift']());}};_0x8f2df8(++_0x310f72);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 086baaa..e1d9a9f 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 _0x25fa=['DATE','sequelize','INTEGER','STRING'];(function(_0x2ad4af,_0x4f6b8f){var _0x22fb69=function(_0x28363e){while(--_0x28363e){_0x2ad4af['push'](_0x2ad4af['shift']());}};_0x22fb69(++_0x4f6b8f);}(_0x25fa,0x109));var _0xa25f=function(_0x37c553,_0x1b82ea){_0x37c553=_0x37c553-0x0;var _0xf80ce4=_0x25fa[_0x37c553];return _0xf80ce4;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'state':{'type':Sequelize[_0xa25f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa25f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xa25f('0x2')]},'starttime':{'type':Sequelize[_0xa25f('0x3')]},'responsetime':{'type':Sequelize[_0xa25f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa25f('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf1b=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x281ee8,_0x27acb7){var _0x2c11cc=function(_0x5f11d4){while(--_0x5f11d4){_0x281ee8['push'](_0x281ee8['shift']());}};_0x2c11cc(++_0x27acb7);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x293b70,_0x3b4ab2){_0x293b70=_0x293b70-0x0;var _0x31697b=_0xaf1b[_0x293b70];return _0x31697b;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'state':{'type':Sequelize[_0xbaf1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbaf1('0x3')]},'scheduledat':{'type':Sequelize[_0xbaf1('0x4')]},'uniqueid':{'type':Sequelize[_0xbaf1('0x3')]},'starttime':{'type':Sequelize[_0xbaf1('0x4')]},'responsetime':{'type':Sequelize[_0xbaf1('0x4')]},'ringtime':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xbaf1('0x3')]},'campaigntype':{'type':Sequelize[_0xbaf1('0x3')]},'membername':{'type':Sequelize[_0xbaf1('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index beb1c32..c98502f 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 _0xef23=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','util'];(function(_0x3dd62a,_0x5b78c4){var _0x1eab97=function(_0x56156b){while(--_0x56156b){_0x3dd62a['push'](_0x3dd62a['shift']());}};_0x1eab97(++_0x5b78c4);}(_0xef23,0x1d5));var _0x3ef2=function(_0x2bbed7,_0x1a4257){_0x2bbed7=_0x2bbed7-0x0;var _0x110106=_0xef23[_0x2bbed7];return _0x110106;};'use strict';var _=require('lodash');var util=require(_0x3ef2('0x0'));var logger=require(_0x3ef2('0x1'))(_0x3ef2('0x2'));var moment=require('moment');var BPromise=require(_0x3ef2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ef2('0x4'));var rimraf=require(_0x3ef2('0x5'));var config=require(_0x3ef2('0x6'));var attributes=require(_0x3ef2('0x7'));module['exports']=function(_0x36f6a7,_0x5eaa4e){return _0x36f6a7['define'](_0x3ef2('0x8'),attributes,{'tableName':_0x3ef2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f6=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x855676,_0x130028){var _0xcbcac0=function(_0x5206a6){while(--_0x5206a6){_0x855676['push'](_0x855676['shift']());}};_0xcbcac0(++_0x130028);}(_0xc4f6,0x16f));var _0x6c4f=function(_0x27c2f0,_0x2a12e1){_0x27c2f0=_0x27c2f0-0x0;var _0x110cd0=_0xc4f6[_0x27c2f0];return _0x110cd0;};'use strict';var _=require(_0x6c4f('0x0'));var util=require(_0x6c4f('0x1'));var logger=require(_0x6c4f('0x2'))(_0x6c4f('0x3'));var moment=require(_0x6c4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x6c4f('0x5'));var fs=require('fs');var path=require(_0x6c4f('0x6'));var rimraf=require(_0x6c4f('0x7'));var config=require(_0x6c4f('0x8'));var attributes=require(_0x6c4f('0x9'));module['exports']=function(_0x4926b9,_0xb73e01){return _0x4926b9[_0x6c4f('0xa')](_0x6c4f('0xb'),attributes,{'tableName':_0x6c4f('0xc'),'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 95fa760..bd4584b 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 _0xd913=['catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result'];(function(_0x5b88b4,_0x23f575){var _0x1ca30b=function(_0x382aea){while(--_0x382aea){_0x5b88b4['push'](_0x5b88b4['shift']());}};_0x1ca30b(++_0x23f575);}(_0xd913,0xee));var _0x3d91=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xd913[_0x30bd4d];return _0x306915;};'use strict';var _=require(_0x3d91('0x0'));var util=require(_0x3d91('0x1'));var moment=require(_0x3d91('0x2'));var BPromise=require(_0x3d91('0x3'));var rs=require(_0x3d91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d91('0x5'));var logger=require(_0x3d91('0x6'))(_0x3d91('0x7'));var config=require(_0x3d91('0x8'));var jayson=require(_0x3d91('0x9'));var client=jayson[_0x3d91('0xa')][_0x3d91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x497877,_0x5085c3,_0x461ecb){return new BPromise(function(_0x437257,_0x3a3cfd){return client[_0x3d91('0xc')](_0x497877,_0x461ecb)[_0x3d91('0xd')](function(_0x3d02d5){logger[_0x3d91('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x5085c3,_0x3d91('0xf'));logger[_0x3d91('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5085c3,_0x3d91('0xf'),JSON[_0x3d91('0x11')](_0x3d02d5));if(_0x3d02d5[_0x3d91('0x12')]){if(_0x3d02d5[_0x3d91('0x12')][_0x3d91('0x13')]===0x1f4){logger[_0x3d91('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5085c3,_0x3d02d5[_0x3d91('0x12')]['message']);return _0x3a3cfd(_0x3d02d5['error'][_0x3d91('0x14')]);}logger[_0x3d91('0x12')](_0x3d91('0x15'),_0x5085c3,_0x3d02d5[_0x3d91('0x12')][_0x3d91('0x14')]);return _0x437257(_0x3d02d5['error'][_0x3d91('0x14')]);}else{logger[_0x3d91('0xe')](_0x3d91('0x15'),_0x5085c3,'request\x20sent');_0x437257(_0x3d02d5[_0x3d91('0x16')]['message']);}})[_0x3d91('0x17')](function(_0x55b728){logger['error'](_0x3d91('0x15'),_0x5085c3,_0x55b728);_0x3a3cfd(_0x55b728);});});}exports[_0x3d91('0x18')]=function(_0x47453c){var _0x26d476=this;return new Promise(function(_0x1c3124,_0x1b44a1){return db[_0x3d91('0x19')][_0x3d91('0x1a')](_0x47453c[_0x3d91('0x1b')],{'raw':_0x47453c[_0x3d91('0x1c')]?_0x47453c[_0x3d91('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3d91('0xd')](function(_0x342758){logger['info'](_0x3d91('0x18'),_0x47453c);logger[_0x3d91('0x10')]('CreateReportAgentPreview',_0x47453c,JSON[_0x3d91('0x11')](_0x342758));_0x1c3124(_0x342758);})['catch'](function(_0xcc93ac){logger['error'](_0x3d91('0x18'),_0xcc93ac[_0x3d91('0x14')],_0x47453c);_0x1b44a1(_0x26d476[_0x3d91('0x12')](0x1f4,_0xcc93ac[_0x3d91('0x14')]));});});}; \ No newline at end of file +var _0xb760=['result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2733d2,_0x315770){var _0xf53cc3=function(_0x1c979b){while(--_0x1c979b){_0x2733d2['push'](_0x2733d2['shift']());}};_0xf53cc3(++_0x315770);}(_0xb760,0x171));var _0x0b76=function(_0x27e460,_0xee1cfc){_0x27e460=_0x27e460-0x0;var _0x1ee6f8=_0xb760[_0x27e460];return _0x1ee6f8;};'use strict';var _=require(_0x0b76('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0b76('0x1'));var rs=require(_0x0b76('0x2'));var fs=require('fs');var Redis=require(_0x0b76('0x3'));var db=require(_0x0b76('0x4'))['db'];var utils=require(_0x0b76('0x5'));var logger=require(_0x0b76('0x6'))(_0x0b76('0x7'));var config=require(_0x0b76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0b76('0x9')][_0x0b76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3edd19,_0x2df881,_0x5da043){return new BPromise(function(_0x3262e7,_0x30e95d){return client[_0x0b76('0xb')](_0x3edd19,_0x5da043)[_0x0b76('0xc')](function(_0x2b8e85){logger[_0x0b76('0xd')](_0x0b76('0xe'),_0x2df881,'request\x20sent');logger[_0x0b76('0xf')](_0x0b76('0x10'),_0x2df881,_0x0b76('0x11'),JSON['stringify'](_0x2b8e85));if(_0x2b8e85[_0x0b76('0x12')]){if(_0x2b8e85[_0x0b76('0x12')][_0x0b76('0x13')]===0x1f4){logger[_0x0b76('0x12')](_0x0b76('0xe'),_0x2df881,_0x2b8e85['error'][_0x0b76('0x14')]);return _0x30e95d(_0x2b8e85['error'][_0x0b76('0x14')]);}logger[_0x0b76('0x12')](_0x0b76('0xe'),_0x2df881,_0x2b8e85['error'][_0x0b76('0x14')]);return _0x3262e7(_0x2b8e85[_0x0b76('0x12')][_0x0b76('0x14')]);}else{logger['info'](_0x0b76('0xe'),_0x2df881,_0x0b76('0x11'));_0x3262e7(_0x2b8e85[_0x0b76('0x15')]['message']);}})[_0x0b76('0x16')](function(_0x3ebd1c){logger[_0x0b76('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2df881,_0x3ebd1c);_0x30e95d(_0x3ebd1c);});});}exports[_0x0b76('0x17')]=function(_0x4be154){var _0x3ff10c=this;return new Promise(function(_0x281e28,_0x258cee){return db[_0x0b76('0x18')][_0x0b76('0x19')](_0x4be154[_0x0b76('0x1a')],{'raw':_0x4be154[_0x0b76('0x1b')]?_0x4be154[_0x0b76('0x1b')][_0x0b76('0x1c')]===undefined?!![]:![]:!![]})[_0x0b76('0xc')](function(_0x3ab1f9){logger[_0x0b76('0xd')](_0x0b76('0x17'),_0x4be154);logger[_0x0b76('0xf')]('CreateReportAgentPreview',_0x4be154,JSON[_0x0b76('0x1d')](_0x3ab1f9));_0x281e28(_0x3ab1f9);})[_0x0b76('0x16')](function(_0x51dc41){logger[_0x0b76('0x12')](_0x0b76('0x17'),_0x51dc41[_0x0b76('0x14')],_0x4be154);_0x258cee(_0x3ff10c[_0x0b76('0x12')](0x1f4,_0x51dc41[_0x0b76('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1752bbf..094fa92 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 _0x79ef=['./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','multer','util','express','Router','../../components/auth/service'];(function(_0x5ccfe2,_0x5c0cae){var _0x5e1678=function(_0x16ffc2){while(--_0x16ffc2){_0x5ccfe2['push'](_0x5ccfe2['shift']());}};_0x5e1678(++_0x5c0cae);}(_0x79ef,0x13b));var _0xf79e=function(_0x10d08c,_0x3f690b){_0x10d08c=_0x10d08c-0x0;var _0x2b3e2c=_0x79ef[_0x10d08c];return _0x2b3e2c;};'use strict';var multer=require(_0xf79e('0x0'));var util=require(_0xf79e('0x1'));var path=require('path');var express=require(_0xf79e('0x2'));var router=express[_0xf79e('0x3')]();var auth=require(_0xf79e('0x4'));var controller=require(_0xf79e('0x5'));router[_0xf79e('0x6')](_0xf79e('0x7'),auth[_0xf79e('0x8')](),controller['voiceChannels']);router[_0xf79e('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xf79e('0x8')](),controller[_0xf79e('0x9')]);router[_0xf79e('0x6')](_0xf79e('0xa'),auth[_0xf79e('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xf79e('0x6')](_0xf79e('0xb'),auth['isAuthenticated'](),controller[_0xf79e('0xc')]);router[_0xf79e('0x6')](_0xf79e('0xd'),auth['isAuthenticated'](),controller[_0xf79e('0xe')]);router[_0xf79e('0x6')](_0xf79e('0xf'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x10')]);router[_0xf79e('0x6')](_0xf79e('0x11'),auth['isAuthenticated'](),controller[_0xf79e('0x12')]);router[_0xf79e('0x6')](_0xf79e('0x13'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x14')]);router[_0xf79e('0x6')](_0xf79e('0x15'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x16')]);router[_0xf79e('0x6')](_0xf79e('0x17'),auth['isAuthenticated'](),controller[_0xf79e('0x18')]);router[_0xf79e('0x6')]('/fax/queues',auth[_0xf79e('0x8')](),controller[_0xf79e('0x19')]);router['get']('/voice/queues/preview/:id',auth[_0xf79e('0x8')](),controller[_0xf79e('0x1a')]);router['get'](_0xf79e('0x1b'),auth['isAuthenticated'](),controller[_0xf79e('0x1c')]);router[_0xf79e('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xf79e('0x1d')]);router[_0xf79e('0x6')](_0xf79e('0x1e'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x1f')]);router[_0xf79e('0x6')](_0xf79e('0x20'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x21')]);router[_0xf79e('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xf79e('0x22')]);router['put']('/voice/queues/:id',auth[_0xf79e('0x8')](),controller[_0xf79e('0x23')]);router[_0xf79e('0x6')](_0xf79e('0x24'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x25')]);router[_0xf79e('0x6')](_0xf79e('0x26'),auth['isAuthenticated'](),controller[_0xf79e('0x27')]);router['get']('/agents',auth[_0xf79e('0x8')](),controller[_0xf79e('0x28')]);router[_0xf79e('0x29')](_0xf79e('0x2a'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x2b')]);router[_0xf79e('0x6')](_0xf79e('0x2c'),auth['isAuthenticated'](),controller['telephones']);router[_0xf79e('0x6')]('/trunks',auth[_0xf79e('0x8')](),controller[_0xf79e('0x2d')]);router[_0xf79e('0x6')]('/campaigns',auth[_0xf79e('0x8')](),controller[_0xf79e('0x2e')]);router['get'](_0xf79e('0x2f'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x30')]);router[_0xf79e('0x6')](_0xf79e('0x31'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x32')]);router[_0xf79e('0x6')](_0xf79e('0x33'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x34')]);router[_0xf79e('0x6')](_0xf79e('0x35'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x36')]);router[_0xf79e('0x6')](_0xf79e('0x37'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x38')]);router['get'](_0xf79e('0x39'),auth[_0xf79e('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xf79e('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xf79e('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xf79e('0x3a'),auth['isAuthenticated'](),controller[_0xf79e('0x3b')]);router[_0xf79e('0x3c')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf79e('0x3d')](_0xf79e('0x3e')));router['get'](_0xf79e('0x3f'),auth[_0xf79e('0x8')](),controller['showMailQueues']);router['post'](_0xf79e('0x40'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x41')));router['get'](_0xf79e('0x42'),auth[_0xf79e('0x8')](),controller['showChatQueues']);router[_0xf79e('0x3c')](_0xf79e('0x43'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x44')));router['get'](_0xf79e('0x45'),auth[_0xf79e('0x8')](),controller['showFaxQueues']);router[_0xf79e('0x3c')](_0xf79e('0x46'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x47')));router[_0xf79e('0x6')](_0xf79e('0x48'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x49')]);router[_0xf79e('0x3c')](_0xf79e('0x4a'),auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x4b')));router[_0xf79e('0x3c')]('/whatsapp/queues/:id/notify',auth[_0xf79e('0x8')](),controller[_0xf79e('0x3d')](_0xf79e('0x4c')));router['get'](_0xf79e('0x4d'),auth[_0xf79e('0x8')](),controller['showSmsQueues']);router[_0xf79e('0x6')](_0xf79e('0x4e'),auth[_0xf79e('0x8')](),controller['showWhatsappQueues']);router[_0xf79e('0x3c')](_0xf79e('0x4f'),auth[_0xf79e('0x8')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xbaf4=['sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x47abbc,_0x5a8c7a){var _0x55a157=function(_0x1e3f32){while(--_0x1e3f32){_0x47abbc['push'](_0x47abbc['shift']());}};_0x55a157(++_0x5a8c7a);}(_0xbaf4,0x13f));var _0x4baf=function(_0x1d80c9,_0x3c5a56){_0x1d80c9=_0x1d80c9-0x0;var _0x2bd6b4=_0xbaf4[_0x1d80c9];return _0x2bd6b4;};'use strict';var multer=require(_0x4baf('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4baf('0x1'));router[_0x4baf('0x2')](_0x4baf('0x3'),auth['isAuthenticated'](),controller[_0x4baf('0x4')]);router['get'](_0x4baf('0x5'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x7')]);router['get'](_0x4baf('0x8'),auth['isAuthenticated'](),controller[_0x4baf('0x9')]);router[_0x4baf('0x2')](_0x4baf('0xa'),auth[_0x4baf('0x6')](),controller['voiceQueues']);router['get'](_0x4baf('0xb'),auth['isAuthenticated'](),controller[_0x4baf('0xc')]);router[_0x4baf('0x2')](_0x4baf('0xd'),auth[_0x4baf('0x6')](),controller[_0x4baf('0xe')]);router[_0x4baf('0x2')]('/mail/accounts',auth[_0x4baf('0x6')](),controller[_0x4baf('0xf')]);router[_0x4baf('0x2')](_0x4baf('0x10'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get']('/sms/queues',auth[_0x4baf('0x6')](),controller[_0x4baf('0x11')]);router[_0x4baf('0x2')](_0x4baf('0x12'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x13')]);router['get']('/fax/queues',auth[_0x4baf('0x6')](),controller[_0x4baf('0x14')]);router[_0x4baf('0x2')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x4baf('0x15')]);router['get'](_0x4baf('0x16'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x17')]);router[_0x4baf('0x2')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x4baf('0x18')]);router['get'](_0x4baf('0x19'),auth['isAuthenticated'](),controller[_0x4baf('0x1a')]);router[_0x4baf('0x2')](_0x4baf('0x1b'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x1c')]);router[_0x4baf('0x2')](_0x4baf('0x1d'),auth['isAuthenticated'](),controller[_0x4baf('0x1e')]);router[_0x4baf('0x1f')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x4baf('0x20')]);router[_0x4baf('0x2')]('/outbound',auth[_0x4baf('0x6')](),controller[_0x4baf('0x21')]);router[_0x4baf('0x2')](_0x4baf('0x22'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x23')]);router[_0x4baf('0x2')](_0x4baf('0x24'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x25')]);router[_0x4baf('0x1f')](_0x4baf('0x26'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x27')]);router['get'](_0x4baf('0x28'),auth['isAuthenticated'](),controller['telephones']);router[_0x4baf('0x2')](_0x4baf('0x29'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x2a')]);router[_0x4baf('0x2')](_0x4baf('0x2b'),auth['isAuthenticated'](),controller['campaigns']);router[_0x4baf('0x2')](_0x4baf('0x2c'),auth[_0x4baf('0x6')](),controller['faxAccounts']);router[_0x4baf('0x2')](_0x4baf('0x2d'),auth[_0x4baf('0x6')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x4baf('0x2e'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x2f')]);router['get'](_0x4baf('0x30'),auth['isAuthenticated'](),controller[_0x4baf('0x31')]);router[_0x4baf('0x2')](_0x4baf('0x32'),auth['isAuthenticated'](),controller[_0x4baf('0x33')]);router[_0x4baf('0x2')](_0x4baf('0x34'),auth[_0x4baf('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x4baf('0x2')](_0x4baf('0x35'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x36')]);router['get'](_0x4baf('0x37'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x38')]);router[_0x4baf('0x39')]('/mail/queues/:id/notify',auth[_0x4baf('0x6')](),controller['queueNotify'](_0x4baf('0x3a')));router[_0x4baf('0x2')]('/mail/queues/:id',auth[_0x4baf('0x6')](),controller['showMailQueues']);router[_0x4baf('0x39')](_0x4baf('0x3b'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x3c')](_0x4baf('0x3d')));router[_0x4baf('0x2')]('/chat/queues/:id',auth[_0x4baf('0x6')](),controller[_0x4baf('0x3e')]);router[_0x4baf('0x39')](_0x4baf('0x3f'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x3c')](_0x4baf('0x40')));router[_0x4baf('0x2')](_0x4baf('0x41'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x42')]);router[_0x4baf('0x39')](_0x4baf('0x43'),auth['isAuthenticated'](),controller[_0x4baf('0x3c')](_0x4baf('0x44')));router['get']('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x4baf('0x45')]);router[_0x4baf('0x39')](_0x4baf('0x46'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x3c')](_0x4baf('0x47')));router['post']('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x4baf('0x3c')](_0x4baf('0x48')));router[_0x4baf('0x2')](_0x4baf('0x49'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x4a')]);router[_0x4baf('0x2')](_0x4baf('0x4b'),auth[_0x4baf('0x6')](),controller[_0x4baf('0x4c')]);router[_0x4baf('0x39')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x4baf('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 77915fe..6044239 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 _0xb4c7=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','messageId','queue','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels'];(function(_0x57591f,_0x381000){var _0x198e35=function(_0xfcd0f0){while(--_0xfcd0f0){_0x57591f['push'](_0x57591f['shift']());}};_0x198e35(++_0x381000);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2db327,_0x30ef30){_0x2db327=_0x2db327-0x0;var _0x203d6e=_0xb4c7[_0x2db327];return _0x203d6e;};'use strict';var BPromise=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var util=require(_0x7b4c('0x3'));var db=require(_0x7b4c('0x4'))['db'];var logger=require('../../config/logger')(_0x7b4c('0x5'));var jayson=require(_0x7b4c('0x6'));var amiClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232a});var mailClient=jayson[_0x7b4c('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){var _0x433aa2=_0x2d7b7e?_0x2d7b7e:amiClient;return _0x433aa2[_0x7b4c('0x9')](_0x2dd5c7,_0x4bf85d)[_0x7b4c('0xa')](function(_0x237e28){if(_0x237e28[_0x7b4c('0xb')]){if(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xc')]===0x1f4){return _0x570daa(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xd')]);}return _0x21687f(_0x237e28[_0x7b4c('0xb')]['message']);}else{_0x21687f(_0x237e28['result']);}})[_0x7b4c('0xe')](function(_0x18342b){_0x570daa(_0x18342b);});});}function respondWithResult(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xc8;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0xf')](_0x1722ad)[_0x7b4c('0x10')](_0x3e1558);}return _0x38656b[_0x7b4c('0x11')](0x194);};}function handleError(_0x25b90b,_0x387488){_0x387488=_0x387488||0x1f4;return function(_0x593a19){logger[_0x7b4c('0xb')](_0x593a19[_0x7b4c('0x12')]);if(_0x593a19[_0x7b4c('0x13')]){delete _0x593a19[_0x7b4c('0x13')];}_0x25b90b[_0x7b4c('0xf')](_0x387488)[_0x7b4c('0x14')](_0x593a19);};}function findById(_0x1642e1){return function(_0x22c409){if(!_['isNil'](_0x1642e1)&&!_[_0x7b4c('0x15')](_0x22c409)&&!_[_0x7b4c('0x15')](_0x22c409[_0x7b4c('0x16')])){return _[_0x7b4c('0x17')](_0x22c409['rows'],function(_0x3ce10c){return _0x3ce10c['id']==_0x1642e1;});}return null;};}exports[_0x7b4c('0x18')]=function(_0x32110e,_0x380b79){return respondWithRpcPromise(_0x7b4c('0x19'),_0x32110e[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x380b79,null))[_0x7b4c('0xe')](handleError(_0x380b79,null));};exports[_0x7b4c('0x1b')]=function(_0x55e3df,_0x1f06ec){return respondWithRpcPromise(_0x7b4c('0x1c'),_[_0x7b4c('0x1d')](_0x55e3df[_0x7b4c('0x1a')],_0x55e3df[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x1f06ec,null))[_0x7b4c('0xe')](handleError(_0x1f06ec,null));};exports[_0x7b4c('0x1f')]=function(_0x2ab9e1,_0x2c267c){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7b4c('0x1d')](_0x2ab9e1[_0x7b4c('0x1a')],_0x2ab9e1[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x2c267c,null))[_0x7b4c('0xe')](handleError(_0x2c267c,null));};exports[_0x7b4c('0x20')]=function(_0x37c059,_0x459eb4){return respondWithRpcPromise(_0x7b4c('0x21'),_0x37c059[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x459eb4,null))[_0x7b4c('0xe')](handleError(_0x459eb4,null));};exports[_0x7b4c('0x22')]=function(_0x501f75,_0x27f361){return respondWithRpcPromise(_0x7b4c('0x21'),_0x501f75[_0x7b4c('0x1a')])[_0x7b4c('0xa')](findById(_0x501f75[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x27f361,null))[_0x7b4c('0xe')](handleError(_0x27f361,null));};exports[_0x7b4c('0x23')]=function(_0x3e4a46,_0x9a799b){return respondWithRpcPromise(_0x7b4c('0x24'),_[_0x7b4c('0x1d')](_0x3e4a46[_0x7b4c('0x25')],_0x3e4a46[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9a799b,null))[_0x7b4c('0xe')](handleError(_0x9a799b,null));};exports[_0x7b4c('0x26')]=function(_0xce5781,_0x9d3d31){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0xce5781['query'],_0xce5781[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9d3d31,null))[_0x7b4c('0xe')](handleError(_0x9d3d31,null));};exports[_0x7b4c('0x27')]=function(_0x498391,_0x6e66e3){return respondWithRpcPromise(_0x7b4c('0x28'),_0x498391['query'])[_0x7b4c('0xa')](respondWithResult(_0x6e66e3,null))['catch'](handleError(_0x6e66e3,null));};exports[_0x7b4c('0x29')]=function(_0x3b9149,_0x159001){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x7b4c('0x1d')](_0x3b9149[_0x7b4c('0x1a')],_0x3b9149['params']))[_0x7b4c('0xa')](respondWithResult(_0x159001,null))[_0x7b4c('0xe')](handleError(_0x159001,null));};exports[_0x7b4c('0x2a')]=function(_0x2e0835,_0x56ff38){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x7b4c('0x1d')](_0x2e0835[_0x7b4c('0x1a')],_0x2e0835['params']))[_0x7b4c('0xa')](respondWithResult(_0x56ff38,null))['catch'](handleError(_0x56ff38,null));};exports['voiceQueuesChannelRedirect']=function(_0x11ca38,_0x16ae89){return respondWithRpcPromise(_0x7b4c('0x2b'),_[_0x7b4c('0x1d')](_0x11ca38['query'],_0x11ca38[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x16ae89,null))[_0x7b4c('0xe')](handleError(_0x16ae89,null));};exports[_0x7b4c('0x2c')]=function(_0x346e0c,_0xddd16){return respondWithRpcPromise(_0x7b4c('0x2d'),_0x346e0c['query'])['then'](respondWithResult(_0xddd16,null))[_0x7b4c('0xe')](handleError(_0xddd16,null));};exports[_0x7b4c('0x2e')]=function(_0x31ef1e,_0x123a3a){return respondWithRpcPromise(_0x7b4c('0x2f'),_0x31ef1e['query'])[_0x7b4c('0xa')](respondWithResult(_0x123a3a,null))[_0x7b4c('0xe')](handleError(_0x123a3a,null));};exports[_0x7b4c('0x30')]=function(_0x26346a,_0x22f71b){var _0x25659d;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a[_0x7b4c('0x1a')])[_0x7b4c('0xa')](function(_0x54cd10){_0x25659d=_0x54cd10;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a['query'],routingClient);})[_0x7b4c('0xa')](function(_0x4dc71f){return _[_0x7b4c('0x1d')]({},_0x4dc71f,_0x25659d);})[_0x7b4c('0xa')](respondWithResult(_0x22f71b,null))['catch'](handleError(_0x22f71b,null));};exports['agentCapacity']=function(_0x354578,_0x4314b6){if(_0x354578[_0x7b4c('0x25')]&&_0x354578[_0x7b4c('0x25')]['interaction']&&_0x354578[_0x7b4c('0x32')]&&_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')]){for(var _0x5d4ed8 in _0x354578[_0x7b4c('0x25')]['interaction']){if(_0x354578['body'][_0x7b4c('0x33')]['hasOwnProperty'](_0x5d4ed8)){db[_0x7b4c('0x34')][_0x7b4c('0x35')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'exitAt':null,'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]&&_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]['length']?{'$notIn':_0x354578[_0x7b4c('0x25')]['interaction'][_0x5d4ed8]}:{'$ne':null}}})['then'](function(_0x23372c){var _0x1f1653=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x255cca=0x0,_0x2ce694=_0x23372c[_0x7b4c('0x37')];_0x255cca<_0x2ce694;_0x255cca+=0x1){_0x23372c[_0x255cca][_0x7b4c('0x38')]({'exitAt':_0x1f1653});}});for(var _0x8ebf9b=0x0;_0x8ebf9b<_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x7b4c('0x37')];_0x8ebf9b+=0x1){db['MemberReport'][_0x7b4c('0x39')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b],'exitAt':null},'defaults':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'interface':_[_0x7b4c('0x15')](_0x354578['user']['interface'])?util[_0x7b4c('0x3a')](_0x7b4c('0x3b'),_0x354578[_0x7b4c('0x32')]['name']):_0x354578[_0x7b4c('0x32')][_0x7b4c('0x3c')],'type':'INTERACTION','enterAt':moment()[_0x7b4c('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x7b4c('0x3d'),'internal':_0x354578['user'][_0x7b4c('0x3e')],'uniqueid':_0x354578['body'][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b]}});}}}}return respondWithRpcPromise(_0x7b4c('0x3f'),{'id':_0x354578['params']['id'],'capacity':_0x354578['body'][_0x7b4c('0x40')]},routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4314b6,null))[_0x7b4c('0xe')](handleError(_0x4314b6,null));};exports['telephones']=function(_0x56233b,_0x2fc5b5){return respondWithRpcPromise(_0x7b4c('0x41'),_0x56233b['query'])['then'](respondWithResult(_0x2fc5b5,null))[_0x7b4c('0xe')](handleError(_0x2fc5b5,null));};exports[_0x7b4c('0x42')]=function(_0x166fd1,_0x4b2207){return respondWithRpcPromise(_0x7b4c('0x43'),_0x166fd1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x4b2207,null))['catch'](handleError(_0x4b2207,null));};exports[_0x7b4c('0x44')]=function(_0x4d8491,_0x59db20){return respondWithRpcPromise(_0x7b4c('0x45'),_0x4d8491['query'])['then'](respondWithResult(_0x59db20,null))[_0x7b4c('0xe')](handleError(_0x59db20,null));};exports[_0x7b4c('0x46')]=function(_0xde9f5,_0x17af17){return respondWithRpcPromise('ChatQueues',_0xde9f5['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x17af17,null))[_0x7b4c('0xe')](handleError(_0x17af17,null));};exports[_0x7b4c('0x47')]=function(_0x59b358,_0x255262){return respondWithRpcPromise(_0x7b4c('0x48'),_0x59b358[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x59b358[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x255262,null))['catch'](handleError(_0x255262,null));};exports[_0x7b4c('0x49')]=function(_0x186e7d,_0x30de26){return respondWithRpcPromise(_0x7b4c('0x4a'),_0x186e7d[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x30de26,null))[_0x7b4c('0xe')](handleError(_0x30de26,null));};exports['showMailQueues']=function(_0x4443d0,_0x2dc79a){return respondWithRpcPromise('MailQueues',_0x4443d0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x4443d0[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x2dc79a,null))['catch'](handleError(_0x2dc79a,null));};exports[_0x7b4c('0x4b')]=function(_0x4e84a3,_0x542b85){return respondWithRpcPromise(_0x7b4c('0x4c'),_0x4e84a3[_0x7b4c('0x1a')],mailClient)[_0x7b4c('0xa')](respondWithResult(_0x542b85,null))[_0x7b4c('0xe')](handleError(_0x542b85,null));};exports[_0x7b4c('0x4d')]=function(_0x5b24f6,_0x4fcc9d){return respondWithRpcPromise(_0x7b4c('0x4e'),_0x5b24f6[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4fcc9d,null))['catch'](handleError(_0x4fcc9d,null));};exports[_0x7b4c('0x4f')]=function(_0xc4dae0,_0x36fc5d){return respondWithRpcPromise('OpenchannelQueues',_0xc4dae0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0xc4dae0[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x36fc5d,null))[_0x7b4c('0xe')](handleError(_0x36fc5d,null));};exports[_0x7b4c('0x50')]=function(_0x4ac03e,_0x1c64d5){return respondWithRpcPromise('SmsQueues',_0x4ac03e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x1c64d5,null))[_0x7b4c('0xe')](handleError(_0x1c64d5,null));};exports['showSmsQueues']=function(_0x5af2af,_0x237921){return respondWithRpcPromise(_0x7b4c('0x51'),_0x5af2af[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x5af2af[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x237921,null))[_0x7b4c('0xe')](handleError(_0x237921,null));};exports[_0x7b4c('0x52')]=function(_0x1315bd,_0x5f3ed5){return respondWithRpcPromise(_0x7b4c('0x53'),_0x1315bd['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x5f3ed5,null))[_0x7b4c('0xe')](handleError(_0x5f3ed5,null));};exports['showWhatsappQueues']=function(_0x7a38e,_0x13a882){return respondWithRpcPromise(_0x7b4c('0x53'),_0x7a38e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x7a38e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x13a882,null))[_0x7b4c('0xe')](handleError(_0x13a882,null));};exports['faxQueues']=function(_0x10d5b3,_0x2dc9a4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x10d5b3[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x2dc9a4,null))[_0x7b4c('0xe')](handleError(_0x2dc9a4,null));};exports[_0x7b4c('0x55')]=function(_0x2a5f6e,_0x34fce4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x2a5f6e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x2a5f6e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x34fce4,null))[_0x7b4c('0xe')](handleError(_0x34fce4,null));};exports[_0x7b4c('0x56')]=function(_0x168aa1,_0x36c7d9){return respondWithRpcPromise(_0x7b4c('0x57'),_0x168aa1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x36c7d9,null))['catch'](handleError(_0x36c7d9,null));};exports[_0x7b4c('0x58')]=function(_0x15033e,_0x50069b){return respondWithRpcPromise(_0x7b4c('0x59'),_0x15033e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x50069b,null))[_0x7b4c('0xe')](handleError(_0x50069b,null));};exports[_0x7b4c('0x5a')]=function(_0x15df66,_0x22a254){return respondWithRpcPromise(_0x7b4c('0x5b'),_0x15df66[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x22a254,null))[_0x7b4c('0xe')](handleError(_0x22a254,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x35067f,_0x5477e3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x35067f[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x5477e3,null))['catch'](handleError(_0x5477e3,null));};exports[_0x7b4c('0x5c')]=function(_0x2d17ed,_0x328948){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2d17ed[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](function(_0x10e789){if(_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')]!==undefined){var _0x2837aa=_(_0x10e789[_0x7b4c('0x16')])[_0x7b4c('0x5e')]([_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')],_0x2d17ed[_0x7b4c('0x1e')]['id']])[_0x7b4c('0x5f')](_0x7b4c('0x60'))[_0x7b4c('0x61')]()['value']();return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x35e94a){return _0x2837aa[_0x7b4c('0x62')](_0x35e94a['queue_id'])>-0x1;});}else{return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x149d53){return _0x149d53[_0x7b4c('0x60')]===parseInt(_0x2d17ed[_0x7b4c('0x1e')]['id']);});}})[_0x7b4c('0xa')](respondWithResult(_0x328948,null))[_0x7b4c('0xe')](handleError(_0x328948,null));};exports['smsQueuesWaitingInteractions']=function(_0x11c809,_0x108c99){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x11c809['query'],routingClient)['then'](respondWithResult(_0x108c99,null))[_0x7b4c('0xe')](handleError(_0x108c99,null));};exports[_0x7b4c('0x63')]=function(_0x24d4f9,_0x19804d){return respondWithRpcPromise(_0x7b4c('0x64'),_0x24d4f9[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x19804d,null))[_0x7b4c('0xe')](handleError(_0x19804d,null));};exports[_0x7b4c('0x65')]=function(_0x2bc889,_0x83e8bb){return respondWithRpcPromise(_0x7b4c('0x66'),_0x2bc889[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x83e8bb,null))[_0x7b4c('0xe')](handleError(_0x83e8bb,null));};exports[_0x7b4c('0x67')]=function(_0x2afaa0){return function(_0x5dc6e6,_0x39c01d){var _0x392656,_0x1faa6f;var _0x3999bf=_[_0x7b4c('0x68')](_0x2afaa0);var _0x57f1a0=_0x2afaa0===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x3999bf+_0x7b4c('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x5dc6e6[_0x7b4c('0x1e')]['id']}})[_0x7b4c('0xa')](function(_0xdfa0bc){if(_['isNil'](_0xdfa0bc)){throw new Error(_0x3999bf+_0x7b4c('0x6d'));}_0x392656=_0xdfa0bc;return db[_0x3999bf+_0x7b4c('0x6e')][_0x7b4c('0x6f')]({'where':{'id':_0x5dc6e6[_0x7b4c('0x25')]['messageId']},'include':[{'model':db[_0x3999bf+_0x7b4c('0x70')],'as':_0x7b4c('0x70')},{'model':db[_0x3999bf+_0x57f1a0],'as':_0x7b4c('0x6b')}]});})[_0x7b4c('0xa')](function(_0x50c382){if(_[_0x7b4c('0x15')](_0x50c382)){throw new Error(_0x3999bf+'\x20Message\x20not\x20found');}_0x1faa6f=_0x50c382;return _0x50c382[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x24690a={'uniqueid':_0x2afaa0+'.'+_0x1faa6f['id']+'.'+_0x1faa6f[_0x7b4c('0x70')]['id'],'FromUserId':_0x5dc6e6[_0x7b4c('0x32')]['id'],'type':'queue'};_0x24690a[_0x3999bf+_0x7b4c('0x72')]=_0x1faa6f['id'];_0x24690a[_0x3999bf+'InteractionId']=_0x1faa6f[_0x7b4c('0x70')]['id'];_0x24690a[_0x7b4c('0x73')+_0x3999bf+_0x57f1a0+'Id']=_0x1faa6f['Account']['id'];_0x24690a['To'+_0x3999bf+_0x7b4c('0x74')]=_0x392656['id'];return db[_0x3999bf+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x24690a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x2afaa0,'interaction':_0x1faa6f[_0x7b4c('0x70')],'message':_0x1faa6f,'account':_0x1faa6f[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x392656[_0x7b4c('0x13')]+','+(_0x1faa6f[_0x7b4c('0x6b')][_0x7b4c('0x77')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x39c01d,null))[_0x7b4c('0xe')](handleError(_0x39c01d,null));};};exports[_0x7b4c('0x79')]=function(_0x4e9781,_0x5ec399){var _0xdb202,_0x433d74;if(_[_0x7b4c('0x15')](_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x228b2b=_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')];var _0x331db1=_['capitalize'](_0x228b2b);var _0x56ba6f=_0x228b2b===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x7b4c('0x7b')][_0x7b4c('0x6f')]({'raw':!![],'where':{'id':_0x4e9781['params']['id'],'role':_0x7b4c('0x3d')}})[_0x7b4c('0xa')](function(_0x450eca){if(_[_0x7b4c('0x15')](_0x450eca)){throw new Error('Agent\x20not\x20found');}_0xdb202=_0x450eca;return db[_0x331db1+'Message']['findOne']({'where':{'id':_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7c')]},'include':[{'model':db[_0x331db1+_0x7b4c('0x70')],'as':'Interaction'},{'model':db[_0x331db1+_0x56ba6f],'as':_0x7b4c('0x6b')}]});})['then'](function(_0x530030){if(_[_0x7b4c('0x15')](_0x530030)){throw new Error(_0x331db1+'\x20Message\x20not\x20found');}_0x433d74=_0x530030;return _0x530030[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b4c('0xa')](function(){var _0x5e444a={'uniqueid':_0x228b2b+'.'+_0x433d74['id']+'.'+_0x433d74['Interaction']['id'],'FromUserId':_0x4e9781[_0x7b4c('0x32')]['id'],'type':_0x7b4c('0x7d'),'ToUserId':_0xdb202['id']};_0x5e444a[_0x331db1+_0x7b4c('0x72')]=_0x433d74['id'];_0x5e444a[_0x331db1+_0x7b4c('0x7e')]=_0x433d74['Interaction']['id'];_0x5e444a['From'+_0x331db1+_0x56ba6f+'Id']=_0x433d74[_0x7b4c('0x6b')]['id'];return db[_0x331db1+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x5e444a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise(_0x7b4c('0x7f'),{'channel':_0x228b2b,'interaction':_0x433d74[_0x7b4c('0x70')],'message':_0x433d74,'account':_0x433d74[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xdb202[_0x7b4c('0x13')]+','+(_0x433d74[_0x7b4c('0x6b')][_0x7b4c('0x80')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x5ec399,null))[_0x7b4c('0xe')](handleError(_0x5ec399,null));}; \ No newline at end of file +var _0xac9d=['SIP/%s','INTERACTION','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','findOrCreate','interface','format'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xac9d,0x14d));var _0xdac9=function(_0x9f48e6,_0x8f87aa){_0x9f48e6=_0x9f48e6-0x0;var _0x45fc5c=_0xac9d[_0x9f48e6];return _0x45fc5c;};'use strict';var BPromise=require(_0xdac9('0x0'));var moment=require(_0xdac9('0x1'));var _=require(_0xdac9('0x2'));var util=require(_0xdac9('0x3'));var db=require(_0xdac9('0x4'))['db'];var logger=require(_0xdac9('0x5'))(_0xdac9('0x6'));var jayson=require(_0xdac9('0x7'));var amiClient=jayson['client'][_0xdac9('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xdac9('0x8')]({'port':0x232b});var routingClient=jayson[_0xdac9('0x9')][_0xdac9('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){var _0x47d9fd=_0x39f560?_0x39f560:amiClient;return _0x47d9fd[_0xdac9('0xa')](_0x776b6c,_0x1c78c5)[_0xdac9('0xb')](function(_0x39c92c){if(_0x39c92c[_0xdac9('0xc')]){if(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xd')]===0x1f4){return _0x2b1d6f(_0x39c92c[_0xdac9('0xc')][_0xdac9('0xe')]);}return _0x5531af(_0x39c92c[_0xdac9('0xc')]['message']);}else{_0x5531af(_0x39c92c[_0xdac9('0xf')]);}})[_0xdac9('0x10')](function(_0x5a9bde){_0x2b1d6f(_0x5a9bde);});});}function respondWithResult(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xc8;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['status'](_0xeddbc1)[_0xdac9('0x11')](_0xbfe6d8);}return _0x3d8e97[_0xdac9('0x12')](0x194);};}function handleError(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0x1f4;return function(_0x5dd536){logger[_0xdac9('0xc')](_0x5dd536[_0xdac9('0x13')]);if(_0x5dd536['name']){delete _0x5dd536[_0xdac9('0x14')];}_0x9e1bf6[_0xdac9('0x15')](_0x5f0bbd)[_0xdac9('0x16')](_0x5dd536);};}function findById(_0x5b2f1b){return function(_0x2221f8){if(!_[_0xdac9('0x17')](_0x5b2f1b)&&!_[_0xdac9('0x17')](_0x2221f8)&&!_[_0xdac9('0x17')](_0x2221f8['rows'])){return _[_0xdac9('0x18')](_0x2221f8[_0xdac9('0x19')],function(_0x571e07){return _0x571e07['id']==_0x5b2f1b;});}return null;};}exports[_0xdac9('0x1a')]=function(_0xa57f2d,_0x171df1){return respondWithRpcPromise(_0xdac9('0x1b'),_0xa57f2d['query'])['then'](respondWithResult(_0x171df1,null))[_0xdac9('0x10')](handleError(_0x171df1,null));};exports[_0xdac9('0x1c')]=function(_0x2b9d91,_0x395ec7){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xdac9('0x1d')](_0x2b9d91[_0xdac9('0x1e')],_0x2b9d91[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x395ec7,null))[_0xdac9('0x10')](handleError(_0x395ec7,null));};exports[_0xdac9('0x20')]=function(_0x41335a,_0xa1f726){return respondWithRpcPromise(_0xdac9('0x21'),_[_0xdac9('0x1d')](_0x41335a['query'],_0x41335a[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0xa1f726,null))[_0xdac9('0x10')](handleError(_0xa1f726,null));};exports[_0xdac9('0x22')]=function(_0x5ca076,_0x1e631a){return respondWithRpcPromise('VoiceQueues',_0x5ca076[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x1e631a,null))['catch'](handleError(_0x1e631a,null));};exports[_0xdac9('0x23')]=function(_0x5105f1,_0x450f91){return respondWithRpcPromise(_0xdac9('0x24'),_0x5105f1[_0xdac9('0x1e')])[_0xdac9('0xb')](findById(_0x5105f1['params']['id']))['then'](respondWithResult(_0x450f91,null))[_0xdac9('0x10')](handleError(_0x450f91,null));};exports[_0xdac9('0x25')]=function(_0x4fe3bd,_0x4c4e21){return respondWithRpcPromise(_0xdac9('0x26'),_[_0xdac9('0x1d')](_0x4fe3bd[_0xdac9('0x27')],_0x4fe3bd[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x4c4e21,null))[_0xdac9('0x10')](handleError(_0x4c4e21,null));};exports[_0xdac9('0x28')]=function(_0x2cda4d,_0x406ed0){return respondWithRpcPromise(_0xdac9('0x29'),_[_0xdac9('0x1d')](_0x2cda4d[_0xdac9('0x1e')],_0x2cda4d[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x406ed0,null))[_0xdac9('0x10')](handleError(_0x406ed0,null));};exports[_0xdac9('0x2a')]=function(_0x372f02,_0x44eff2){return respondWithRpcPromise(_0xdac9('0x2b'),_0x372f02[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x44eff2,null))['catch'](handleError(_0x44eff2,null));};exports['voiceQueuesChannel']=function(_0x1e6832,_0x416501){return respondWithRpcPromise(_0xdac9('0x2c'),_[_0xdac9('0x1d')](_0x1e6832[_0xdac9('0x1e')],_0x1e6832['params']))[_0xdac9('0xb')](respondWithResult(_0x416501,null))['catch'](handleError(_0x416501,null));};exports[_0xdac9('0x2d')]=function(_0x2a611e,_0x5cfebf){return respondWithRpcPromise(_0xdac9('0x2e'),_['merge'](_0x2a611e['query'],_0x2a611e[_0xdac9('0x1f')]))[_0xdac9('0xb')](respondWithResult(_0x5cfebf,null))[_0xdac9('0x10')](handleError(_0x5cfebf,null));};exports[_0xdac9('0x2f')]=function(_0x3bab10,_0x363d93){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xdac9('0x1d')](_0x3bab10[_0xdac9('0x1e')],_0x3bab10['params']))[_0xdac9('0xb')](respondWithResult(_0x363d93,null))[_0xdac9('0x10')](handleError(_0x363d93,null));};exports[_0xdac9('0x30')]=function(_0x27bdfb,_0x35aa58){return respondWithRpcPromise(_0xdac9('0x31'),_0x27bdfb[_0xdac9('0x1e')])['then'](respondWithResult(_0x35aa58,null))[_0xdac9('0x10')](handleError(_0x35aa58,null));};exports[_0xdac9('0x32')]=function(_0x238769,_0x4b6b09){return respondWithRpcPromise(_0xdac9('0x33'),_0x238769[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4b6b09,null))[_0xdac9('0x10')](handleError(_0x4b6b09,null));};exports['agents']=function(_0x58fd14,_0x1d0243){var _0xe47a3c;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14[_0xdac9('0x1e')])[_0xdac9('0xb')](function(_0x579581){_0xe47a3c=_0x579581;return respondWithRpcPromise(_0xdac9('0x34'),_0x58fd14['query'],routingClient);})[_0xdac9('0xb')](function(_0xaca43c){return _[_0xdac9('0x1d')]({},_0xaca43c,_0xe47a3c);})[_0xdac9('0xb')](respondWithResult(_0x1d0243,null))[_0xdac9('0x10')](handleError(_0x1d0243,null));};exports[_0xdac9('0x35')]=function(_0x413fb1,_0xb176e0){if(_0x413fb1[_0xdac9('0x27')]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]&&_0x413fb1[_0xdac9('0x37')]&&_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]){for(var _0x5335ae in _0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')]){if(_0x413fb1['body'][_0xdac9('0x36')][_0xdac9('0x38')](_0x5335ae)){db[_0xdac9('0x39')][_0xdac9('0x3a')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]&&_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')]?{'$notIn':_0x413fb1[_0xdac9('0x27')]['interaction'][_0x5335ae]}:{'$ne':null}}})['then'](function(_0x585f08){var _0xcb7b82=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4159fd=0x0,_0x15c332=_0x585f08['length'];_0x4159fd<_0x15c332;_0x4159fd+=0x1){_0x585f08[_0x4159fd]['updateAttributes']({'exitAt':_0xcb7b82});}});for(var _0x1666c5=0x0;_0x1666c5<_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0xdac9('0x3b')];_0x1666c5+=0x1){db[_0xdac9('0x39')][_0xdac9('0x3c')]({'where':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'type':'INTERACTION','uniqueid':_0x413fb1[_0xdac9('0x27')][_0xdac9('0x36')][_0x5335ae][_0x1666c5],'exitAt':null},'defaults':{'channel':_0x5335ae,'membername':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')],'interface':_[_0xdac9('0x17')](_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')])?util[_0xdac9('0x3e')](_0xdac9('0x3f'),_0x413fb1[_0xdac9('0x37')][_0xdac9('0x14')]):_0x413fb1[_0xdac9('0x37')][_0xdac9('0x3d')],'type':_0xdac9('0x40'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x413fb1[_0xdac9('0x37')][_0xdac9('0x41')],'uniqueid':_0x413fb1['body'][_0xdac9('0x36')][_0x5335ae][_0x1666c5]}});}}}}return respondWithRpcPromise(_0xdac9('0x42'),{'id':_0x413fb1[_0xdac9('0x1f')]['id'],'capacity':_0x413fb1['body'][_0xdac9('0x43')]},routingClient)[_0xdac9('0xb')](respondWithResult(_0xb176e0,null))['catch'](handleError(_0xb176e0,null));};exports['telephones']=function(_0x46f1c0,_0x4469d8){return respondWithRpcPromise(_0xdac9('0x44'),_0x46f1c0[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x4469d8,null))[_0xdac9('0x10')](handleError(_0x4469d8,null));};exports[_0xdac9('0x45')]=function(_0x3a77e3,_0x298c72){return respondWithRpcPromise(_0xdac9('0x46'),_0x3a77e3[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x298c72,null))[_0xdac9('0x10')](handleError(_0x298c72,null));};exports[_0xdac9('0x47')]=function(_0x35a378,_0x5d0b43){return respondWithRpcPromise(_0xdac9('0x48'),_0x35a378[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x5d0b43,null))[_0xdac9('0x10')](handleError(_0x5d0b43,null));};exports[_0xdac9('0x49')]=function(_0x3a391a,_0x4b118e){return respondWithRpcPromise(_0xdac9('0x4a'),_0x3a391a[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x4b118e,null))[_0xdac9('0x10')](handleError(_0x4b118e,null));};exports[_0xdac9('0x4b')]=function(_0x2a5bf9,_0x1eec39){return respondWithRpcPromise(_0xdac9('0x4a'),_0x2a5bf9[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2a5bf9[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x1eec39,null))[_0xdac9('0x10')](handleError(_0x1eec39,null));};exports[_0xdac9('0x4c')]=function(_0x2ca15d,_0x21ab3d){return respondWithRpcPromise('MailQueues',_0x2ca15d['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x21ab3d,null))[_0xdac9('0x10')](handleError(_0x21ab3d,null));};exports[_0xdac9('0x4d')]=function(_0x46017d,_0x1c1f5f){return respondWithRpcPromise(_0xdac9('0x4e'),_0x46017d['query'],routingClient)['then'](findById(_0x46017d['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x1c1f5f,null))[_0xdac9('0x10')](handleError(_0x1c1f5f,null));};exports[_0xdac9('0x4f')]=function(_0x2f581b,_0x52ad7b){return respondWithRpcPromise(_0xdac9('0x50'),_0x2f581b[_0xdac9('0x1e')],mailClient)[_0xdac9('0xb')](respondWithResult(_0x52ad7b,null))[_0xdac9('0x10')](handleError(_0x52ad7b,null));};exports[_0xdac9('0x51')]=function(_0x496d9c,_0x19a46e){return respondWithRpcPromise('OpenchannelQueues',_0x496d9c[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x19a46e,null))[_0xdac9('0x10')](handleError(_0x19a46e,null));};exports[_0xdac9('0x52')]=function(_0x2fd7c8,_0x360499){return respondWithRpcPromise(_0xdac9('0x53'),_0x2fd7c8[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x2fd7c8['params']['id']))['then'](respondWithResult(_0x360499,null))['catch'](handleError(_0x360499,null));};exports[_0xdac9('0x54')]=function(_0x42ba53,_0x830d54){return respondWithRpcPromise(_0xdac9('0x55'),_0x42ba53[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x830d54,null))[_0xdac9('0x10')](handleError(_0x830d54,null));};exports['showSmsQueues']=function(_0x2d81fc,_0x5b63d8){return respondWithRpcPromise('SmsQueues',_0x2d81fc[_0xdac9('0x1e')],routingClient)['then'](findById(_0x2d81fc['params']['id']))[_0xdac9('0xb')](respondWithResult(_0x5b63d8,null))[_0xdac9('0x10')](handleError(_0x5b63d8,null));};exports[_0xdac9('0x56')]=function(_0x55ce14,_0x552cac){return respondWithRpcPromise(_0xdac9('0x57'),_0x55ce14[_0xdac9('0x1e')],routingClient)['then'](respondWithResult(_0x552cac,null))[_0xdac9('0x10')](handleError(_0x552cac,null));};exports[_0xdac9('0x58')]=function(_0x26b9b5,_0x272f14){return respondWithRpcPromise(_0xdac9('0x57'),_0x26b9b5[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x26b9b5[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x272f14,null))[_0xdac9('0x10')](handleError(_0x272f14,null));};exports[_0xdac9('0x59')]=function(_0x1e2e7b,_0x5401e6){return respondWithRpcPromise(_0xdac9('0x5a'),_0x1e2e7b['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x5401e6,null))[_0xdac9('0x10')](handleError(_0x5401e6,null));};exports['showFaxQueues']=function(_0x3a6c78,_0x3bee81){return respondWithRpcPromise(_0xdac9('0x5a'),_0x3a6c78[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](findById(_0x3a6c78[_0xdac9('0x1f')]['id']))[_0xdac9('0xb')](respondWithResult(_0x3bee81,null))[_0xdac9('0x10')](handleError(_0x3bee81,null));};exports[_0xdac9('0x5b')]=function(_0x45f183,_0x263b84){return respondWithRpcPromise(_0xdac9('0x5c'),_0x45f183[_0xdac9('0x1e')])[_0xdac9('0xb')](respondWithResult(_0x263b84,null))[_0xdac9('0x10')](handleError(_0x263b84,null));};exports[_0xdac9('0x5d')]=function(_0x4c4a7b,_0x3a457b){return respondWithRpcPromise(_0xdac9('0x5e'),_0x4c4a7b[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x3a457b,null))['catch'](handleError(_0x3a457b,null));};exports[_0xdac9('0x5f')]=function(_0x31f56e,_0x1b6a68){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x31f56e[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x1b6a68,null))['catch'](handleError(_0x1b6a68,null));};exports[_0xdac9('0x60')]=function(_0x1b8ad9,_0x2a4d12){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1b8ad9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x2a4d12,null))[_0xdac9('0x10')](handleError(_0x2a4d12,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5c39e9,_0x108e03){return respondWithRpcPromise(_0xdac9('0x61'),_0x5c39e9[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](function(_0x4110da){if(_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')]!==undefined){var _0x2de535=_(_0x4110da[_0xdac9('0x19')])[_0xdac9('0x63')]([_0x5c39e9[_0xdac9('0x1e')][_0xdac9('0x62')],_0x5c39e9[_0xdac9('0x1f')]['id']])['map']('queue_id')[_0xdac9('0x64')]()['value']();return _0x4110da['rows'][_0xdac9('0x63')](function(_0x199518){return _0x2de535[_0xdac9('0x65')](_0x199518[_0xdac9('0x66')])>-0x1;});}else{return _0x4110da['rows'][_0xdac9('0x63')](function(_0xff5be){return _0xff5be[_0xdac9('0x66')]===parseInt(_0x5c39e9['params']['id']);});}})[_0xdac9('0xb')](respondWithResult(_0x108e03,null))[_0xdac9('0x10')](handleError(_0x108e03,null));};exports['smsQueuesWaitingInteractions']=function(_0x3cc0f9,_0x59b5b2){return respondWithRpcPromise(_0xdac9('0x67'),_0x3cc0f9['query'],routingClient)[_0xdac9('0xb')](respondWithResult(_0x59b5b2,null))[_0xdac9('0x10')](handleError(_0x59b5b2,null));};exports[_0xdac9('0x68')]=function(_0x251011,_0x9981f){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x251011[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x9981f,null))[_0xdac9('0x10')](handleError(_0x9981f,null));};exports[_0xdac9('0x69')]=function(_0x13be64,_0x227857){return respondWithRpcPromise(_0xdac9('0x6a'),_0x13be64[_0xdac9('0x1e')],routingClient)[_0xdac9('0xb')](respondWithResult(_0x227857,null))['catch'](handleError(_0x227857,null));};exports[_0xdac9('0x6b')]=function(_0x300738){return function(_0x12c15b,_0x4f7f63){var _0x571130,_0x5650d1;var _0x5adc83=_['capitalize'](_0x300738);var _0x325407=_0x300738===_0xdac9('0x6c')?_0xdac9('0x6d'):_0xdac9('0x6e');return db[_0x5adc83+'Queue'][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x12c15b['params']['id']}})[_0xdac9('0xb')](function(_0x750de7){if(_[_0xdac9('0x17')](_0x750de7)){throw new Error(_0x5adc83+_0xdac9('0x70'));}_0x571130=_0x750de7;return db[_0x5adc83+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x12c15b[_0xdac9('0x27')][_0xdac9('0x71')]},'include':[{'model':db[_0x5adc83+_0xdac9('0x72')],'as':'Interaction'},{'model':db[_0x5adc83+_0x325407],'as':'Account'}]});})[_0xdac9('0xb')](function(_0x414f8a){if(_[_0xdac9('0x17')](_0x414f8a)){throw new Error(_0x5adc83+'\x20Message\x20not\x20found');}_0x5650d1=_0x414f8a;return _0x414f8a['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x111bff={'uniqueid':_0x300738+'.'+_0x5650d1['id']+'.'+_0x5650d1[_0xdac9('0x72')]['id'],'FromUserId':_0x12c15b[_0xdac9('0x37')]['id'],'type':_0xdac9('0x73')};_0x111bff[_0x5adc83+_0xdac9('0x74')]=_0x5650d1['id'];_0x111bff[_0x5adc83+_0xdac9('0x75')]=_0x5650d1[_0xdac9('0x72')]['id'];_0x111bff[_0xdac9('0x76')+_0x5adc83+_0x325407+'Id']=_0x5650d1[_0xdac9('0x6e')]['id'];_0x111bff['To'+_0x5adc83+_0xdac9('0x77')]=_0x571130['id'];return db[_0x5adc83+_0xdac9('0x78')][_0xdac9('0x79')](_0x111bff);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x300738,'interaction':_0x5650d1[_0xdac9('0x72')],'message':_0x5650d1,'account':_0x5650d1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdac9('0x73'),'appdata':_0x571130['name']+','+(_0x5650d1[_0xdac9('0x6e')][_0xdac9('0x7b')]||0x12c),'interval':_0xdac9('0x7c')}]},routingClient);})[_0xdac9('0xb')](respondWithResult(_0x4f7f63,null))[_0xdac9('0x10')](handleError(_0x4f7f63,null));};};exports[_0xdac9('0x7d')]=function(_0x232876,_0x4463ca){var _0x171d38,_0x328fa2;if(_[_0xdac9('0x17')](_0x232876['body'][_0xdac9('0x7e')])){throw new Error(_0xdac9('0x7f'));}var _0x284247=_0x232876[_0xdac9('0x27')][_0xdac9('0x7e')];var _0x4d7208=_['capitalize'](_0x284247);var _0x363541=_0x284247==='chat'?'Website':_0xdac9('0x6e');return db[_0xdac9('0x80')][_0xdac9('0x6f')]({'raw':!![],'where':{'id':_0x232876[_0xdac9('0x1f')]['id'],'role':'agent'}})[_0xdac9('0xb')](function(_0x8f37df){if(_[_0xdac9('0x17')](_0x8f37df)){throw new Error('Agent\x20not\x20found');}_0x171d38=_0x8f37df;return db[_0x4d7208+'Message'][_0xdac9('0x6f')]({'where':{'id':_0x232876[_0xdac9('0x27')]['messageId']},'include':[{'model':db[_0x4d7208+'Interaction'],'as':'Interaction'},{'model':db[_0x4d7208+_0x363541],'as':_0xdac9('0x6e')}]});})[_0xdac9('0xb')](function(_0x131c78){if(_['isNil'](_0x131c78)){throw new Error(_0x4d7208+_0xdac9('0x81'));}_0x328fa2=_0x131c78;return _0x131c78[_0xdac9('0x82')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdac9('0xb')](function(){var _0x2ab89f={'uniqueid':_0x284247+'.'+_0x328fa2['id']+'.'+_0x328fa2[_0xdac9('0x72')]['id'],'FromUserId':_0x232876['user']['id'],'type':_0xdac9('0x73'),'ToUserId':_0x171d38['id']};_0x2ab89f[_0x4d7208+_0xdac9('0x74')]=_0x328fa2['id'];_0x2ab89f[_0x4d7208+'InteractionId']=_0x328fa2[_0xdac9('0x72')]['id'];_0x2ab89f[_0xdac9('0x76')+_0x4d7208+_0x363541+'Id']=_0x328fa2[_0xdac9('0x6e')]['id'];return db[_0x4d7208+_0xdac9('0x78')]['create'](_0x2ab89f);})['then'](function(){return respondWithRpcPromise(_0xdac9('0x7a'),{'channel':_0x284247,'interaction':_0x328fa2[_0xdac9('0x72')],'message':_0x328fa2,'account':_0x328fa2['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x171d38[_0xdac9('0x14')]+','+(_0x328fa2['Account'][_0xdac9('0x83')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x4463ca,null))[_0xdac9('0x10')](handleError(_0x4463ca,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 115f8a0..3cc5550 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 _0xd90d=['/:id/run','run','post','create','update','delete','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd90d,0x1db));var _0xdd90=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xd90d[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require('multer');var util=require(_0xdd90('0x0'));var path=require(_0xdd90('0x1'));var timeout=require(_0xdd90('0x2'));var express=require(_0xdd90('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd90('0x4'));var config=require(_0xdd90('0x5'));var controller=require(_0xdd90('0x6'));router[_0xdd90('0x7')]('/',auth[_0xdd90('0x8')](),controller['index']);router[_0xdd90('0x7')](_0xdd90('0x9'),auth[_0xdd90('0x8')](),controller[_0xdd90('0xa')]);router[_0xdd90('0x7')](_0xdd90('0xb'),auth[_0xdd90('0x8')](),controller[_0xdd90('0xc')]);router[_0xdd90('0xd')]('/',auth[_0xdd90('0x8')](),controller[_0xdd90('0xe')]);router['put']('/:id',auth[_0xdd90('0x8')](),controller[_0xdd90('0xf')]);router[_0xdd90('0x10')]('/:id',auth[_0xdd90('0x8')](),controller['destroy']);module[_0xdd90('0x11')]=router; \ No newline at end of file +var _0x4d22=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/run','post','create','put','update'];(function(_0x2d84c1,_0x5191eb){var _0x39fe4f=function(_0x47ff04){while(--_0x47ff04){_0x2d84c1['push'](_0x2d84c1['shift']());}};_0x39fe4f(++_0x5191eb);}(_0x4d22,0x1d0));var _0x24d2=function(_0x3d7450,_0x51a35c){_0x3d7450=_0x3d7450-0x0;var _0x5e895a=_0x4d22[_0x3d7450];return _0x5e895a;};'use strict';var multer=require(_0x24d2('0x0'));var util=require(_0x24d2('0x1'));var path=require(_0x24d2('0x2'));var timeout=require(_0x24d2('0x3'));var express=require(_0x24d2('0x4'));var router=express[_0x24d2('0x5')]();var fs_extra=require(_0x24d2('0x6'));var auth=require(_0x24d2('0x7'));var interaction=require(_0x24d2('0x8'));var config=require('../../config/environment');var controller=require('./schedule.controller');router['get']('/',auth[_0x24d2('0x9')](),controller[_0x24d2('0xa')]);router[_0x24d2('0xb')](_0x24d2('0xc'),auth['isAuthenticated'](),controller[_0x24d2('0xd')]);router[_0x24d2('0xb')](_0x24d2('0xe'),auth[_0x24d2('0x9')](),controller['run']);router[_0x24d2('0xf')]('/',auth[_0x24d2('0x9')](),controller[_0x24d2('0x10')]);router[_0x24d2('0x11')](_0x24d2('0xc'),auth[_0x24d2('0x9')](),controller[_0x24d2('0x12')]);router[_0x24d2('0x13')](_0x24d2('0xc'),auth[_0x24d2('0x9')](),controller[_0x24d2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f014d65..4700d83 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 _0x2a88=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','weeks','days','hours','ENUM','csv','xlsx','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a88,0x18e));var _0x82a8=function(_0x533cf6,_0x89b44d){_0x533cf6=_0x533cf6-0x0;var _0x505702=_0x2a88[_0x533cf6];return _0x505702;};'use strict';var Sequelize=require(_0x82a8('0x0'));module[_0x82a8('0x1')]={'name':{'type':Sequelize[_0x82a8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x82a8('0x2')]},'active':{'type':Sequelize[_0x82a8('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x82a8('0x2')],'allowNull':![],'defaultValue':_0x82a8('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x82a8('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x82a8('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x82a8('0x7'),_0x82a8('0x8'),_0x82a8('0x9'),_0x82a8('0xa'),_0x82a8('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x82a8('0xa')},'output':{'type':Sequelize[_0x82a8('0xc')](_0x82a8('0xd'),'pdf',_0x82a8('0xe')),'allowNull':![],'defaultValue':_0x82a8('0xd')},'type':{'type':Sequelize[_0x82a8('0xc')](_0x82a8('0xf'),_0x82a8('0x10')),'allowNull':![],'defaultValue':_0x82a8('0xf')},'sendMail':{'type':Sequelize[_0x82a8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x82a8('0x2')]},'cc':{'type':Sequelize[_0x82a8('0x11')]},'bcc':{'type':Sequelize[_0x82a8('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x82a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x01e1=['BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','hours','minutes','xlsx','csv','custom','default'];(function(_0x53e73e,_0x5d2b07){var _0x56758c=function(_0x27d8e2){while(--_0x27d8e2){_0x53e73e['push'](_0x53e73e['shift']());}};_0x56758c(++_0x5d2b07);}(_0x01e1,0x152));var _0x101e=function(_0x1368a4,_0x717e38){_0x1368a4=_0x1368a4-0x0;var _0x3961ae=_0x01e1[_0x1368a4];return _0x3961ae;};'use strict';var Sequelize=require(_0x101e('0x0'));module['exports']={'name':{'type':Sequelize[_0x101e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x101e('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x101e('0x2')},'startAt':{'type':Sequelize[_0x101e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x101e('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x101e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x101e('0x5')](_0x101e('0x6'),_0x101e('0x7'),'months','weeks','days',_0x101e('0x8'),_0x101e('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv','pdf',_0x101e('0xa')),'allowNull':![],'defaultValue':_0x101e('0xb')},'type':{'type':Sequelize[_0x101e('0x5')](_0x101e('0xc'),_0x101e('0xd')),'allowNull':![],'defaultValue':_0x101e('0xc')},'sendMail':{'type':Sequelize[_0x101e('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x101e('0x1')]},'cc':{'type':Sequelize[_0x101e('0xf')]},'bcc':{'type':Sequelize[_0x101e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x101e('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 452c6bf..e365009 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 _0x73b8=['role','user','UserProfileSection','userProfileId','update','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','Schedule','include','rows','catch','show','params','intersection','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x73b8,0xb0));var _0x873b=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x73b8[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0x873b('0x0'));var rimraf=require(_0x873b('0x1'));var zipdir=require(_0x873b('0x2'));var jsonpatch=require(_0x873b('0x3'));var rp=require('request-promise');var moment=require(_0x873b('0x4'));var BPromise=require(_0x873b('0x5'));var Mustache=require(_0x873b('0x6'));var util=require(_0x873b('0x7'));var path=require(_0x873b('0x8'));var sox=require(_0x873b('0x9'));var csv=require(_0x873b('0xa'));var ejs=require(_0x873b('0xb'));var fs=require('fs');var fs_extra=require(_0x873b('0xc'));var _=require(_0x873b('0xd'));var squel=require(_0x873b('0xe'));var crypto=require(_0x873b('0xf'));var jsforce=require(_0x873b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x873b('0xa'));var querystring=require('querystring');var Papa=require(_0x873b('0x11'));var Redis=require(_0x873b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x873b('0x13'));var as=require(_0x873b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x873b('0x15'))(_0x873b('0x16'));var utils=require(_0x873b('0x17'));var config=require(_0x873b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb407d3,_0x20795a){_0x20795a=_0x20795a||0xcc;return function(_0x3eecdf){if(_0x3eecdf){return _0xb407d3[_0x873b('0x19')](_0x20795a);}return _0xb407d3[_0x873b('0x1a')](_0x20795a)[_0x873b('0x1b')]();};}function respondWithResult(_0xac183f,_0xfa01af){_0xfa01af=_0xfa01af||0xc8;return function(_0x90209b){if(_0x90209b){return _0xac183f[_0x873b('0x1a')](_0xfa01af)[_0x873b('0x1c')](_0x90209b);}};}function respondWithFilteredResult(_0x39da83,_0x4987fc){return function(_0xda0c34){if(_0xda0c34){var _0x2bb598=typeof _0x4987fc['offset']===_0x873b('0x1d')&&typeof _0x4987fc[_0x873b('0x1e')]===_0x873b('0x1d');var _0x1af5b1=_0xda0c34[_0x873b('0x1f')];var _0x2b8411=_0x2bb598?0x0:_0x4987fc[_0x873b('0x20')];var _0x505c3d=_0x2bb598?_0xda0c34[_0x873b('0x1f')]:_0x4987fc['offset']+_0x4987fc['limit'];var _0x2b86ff;if(_0x505c3d>=_0x1af5b1){_0x505c3d=_0x1af5b1;_0x2b86ff=0xc8;}else{_0x2b86ff=0xce;}_0x39da83['status'](_0x2b86ff);return _0x39da83[_0x873b('0x21')](_0x873b('0x22'),_0x2b8411+'-'+_0x505c3d+'/'+_0x1af5b1)[_0x873b('0x1c')](_0xda0c34);}return null;};}function patchUpdates(_0x4c252b){return function(_0x1d5637){try{jsonpatch['apply'](_0x1d5637,_0x4c252b,!![]);}catch(_0x393bcc){return BPromise[_0x873b('0x23')](_0x393bcc);}return _0x1d5637[_0x873b('0x24')]();};}function saveUpdates(_0x504aa6,_0x48cd2d){return function(_0xb58320){if(_0xb58320){return _0xb58320['update'](_0x504aa6)[_0x873b('0x25')](function(_0x3a3e64){return _0x3a3e64;});}return null;};}function removeEntity(_0x410312,_0x24bc6c){return function(_0x289d70){if(_0x289d70){return _0x289d70['destroy']()[_0x873b('0x25')](function(){var _0x42b4b2=_0x289d70[_0x873b('0x26')]({'plain':!![]});var _0xd433bf=_0x873b('0x27');return db[_0x873b('0x28')][_0x873b('0x29')]({'where':{'type':_0xd433bf,'resourceId':_0x42b4b2['id']}})[_0x873b('0x25')](function(){return _0x289d70;});})[_0x873b('0x25')](function(){_0x410312[_0x873b('0x1a')](0xcc)[_0x873b('0x1b')]();});}};}function handleEntityNotFound(_0xe1bced,_0x31f8c1){return function(_0x594f4b){if(!_0x594f4b){_0xe1bced[_0x873b('0x19')](0x194);}return _0x594f4b;};}function handleError(_0xc76ddd,_0x48d3a1){_0x48d3a1=_0x48d3a1||0x1f4;return function(_0x3d594e){logger[_0x873b('0x2a')](_0x3d594e[_0x873b('0x2b')]);if(_0x3d594e[_0x873b('0x2c')]){delete _0x3d594e['name'];}_0xc76ddd[_0x873b('0x1a')](_0x48d3a1)[_0x873b('0x2d')](_0x3d594e);};}exports[_0x873b('0x2e')]=function(_0xcbf649,_0xd1c651){var _0x4693bd={},_0x57dbf0={},_0x304bd2={'count':0x0,'rows':[]};var _0xadb00e=_['map'](db['Schedule'][_0x873b('0x2f')],function(_0x43a917){return{'name':_0x43a917['fieldName'],'type':_0x43a917['type']['key']};});_0x57dbf0[_0x873b('0x30')]=_['map'](_0xadb00e,_0x873b('0x2c'));_0x57dbf0[_0x873b('0x31')]=_[_0x873b('0x32')](_0xcbf649['query']);_0x57dbf0[_0x873b('0x33')]=_['intersection'](_0x57dbf0[_0x873b('0x30')],_0x57dbf0['query']);_0x4693bd[_0x873b('0x34')]=_['intersection'](_0x57dbf0[_0x873b('0x30')],qs[_0x873b('0x35')](_0xcbf649[_0x873b('0x31')][_0x873b('0x35')]));_0x4693bd[_0x873b('0x34')]=_0x4693bd[_0x873b('0x34')][_0x873b('0x36')]?_0x4693bd[_0x873b('0x34')]:_0x57dbf0[_0x873b('0x30')];if(!_0xcbf649['query'][_0x873b('0x37')](_0x873b('0x38'))){_0x4693bd['limit']=qs['limit'](_0xcbf649[_0x873b('0x31')][_0x873b('0x1e')]);_0x4693bd['offset']=qs[_0x873b('0x20')](_0xcbf649[_0x873b('0x31')][_0x873b('0x20')]);}_0x4693bd[_0x873b('0x39')]=qs[_0x873b('0x3a')](_0xcbf649['query']['sort']);_0x4693bd[_0x873b('0x3b')]=qs[_0x873b('0x33')](_[_0x873b('0x3c')](_0xcbf649[_0x873b('0x31')],_0x57dbf0[_0x873b('0x33')]),_0xadb00e);if(_0xcbf649[_0x873b('0x31')][_0x873b('0x3d')]){_0x4693bd[_0x873b('0x3b')]=_[_0x873b('0x3e')](_0x4693bd['where'],{'$or':_[_0x873b('0x3f')](_0xadb00e,function(_0x56200f){if(_0x56200f[_0x873b('0x40')]!==_0x873b('0x41')){var _0x2f940d={};_0x2f940d[_0x56200f[_0x873b('0x2c')]]={'$like':'%'+_0xcbf649['query'][_0x873b('0x3d')]+'%'};return _0x2f940d;}})});}_0x4693bd=_['merge']({},_0x4693bd,_0xcbf649['options']);var _0x29a151={'where':_0x4693bd['where']};return db[_0x873b('0x42')]['count'](_0x29a151)[_0x873b('0x25')](function(_0x33ebcb){_0x304bd2[_0x873b('0x1f')]=_0x33ebcb;if(_0xcbf649[_0x873b('0x31')]['includeAll']){_0x4693bd[_0x873b('0x43')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x4693bd);})['then'](function(_0x44a683){_0x304bd2[_0x873b('0x44')]=_0x44a683;return _0x304bd2;})[_0x873b('0x25')](respondWithFilteredResult(_0xd1c651,_0x4693bd))[_0x873b('0x45')](handleError(_0xd1c651,null));};exports[_0x873b('0x46')]=function(_0x3450c4,_0x403cac){var _0xa3d794={'raw':![],'where':{'id':_0x3450c4[_0x873b('0x47')]['id']}},_0x3137a4={};_0x3137a4[_0x873b('0x30')]=_[_0x873b('0x32')](db[_0x873b('0x42')][_0x873b('0x2f')]);_0x3137a4[_0x873b('0x31')]=_['keys'](_0x3450c4['query']);_0x3137a4[_0x873b('0x33')]=_[_0x873b('0x48')](_0x3137a4[_0x873b('0x30')],_0x3137a4[_0x873b('0x31')]);_0xa3d794[_0x873b('0x34')]=_[_0x873b('0x48')](_0x3137a4[_0x873b('0x30')],qs[_0x873b('0x35')](_0x3450c4['query'][_0x873b('0x35')]));_0xa3d794[_0x873b('0x34')]=_0xa3d794['attributes']['length']?_0xa3d794[_0x873b('0x34')]:_0x3137a4[_0x873b('0x30')];if(_0x3450c4[_0x873b('0x31')][_0x873b('0x49')]){_0xa3d794[_0x873b('0x43')]=[{'all':!![]}];}_0xa3d794=_[_0x873b('0x3e')]({},_0xa3d794,_0x3450c4[_0x873b('0x4a')]);return db[_0x873b('0x42')][_0x873b('0x4b')](_0xa3d794)['then'](handleEntityNotFound(_0x403cac,null))['then'](respondWithResult(_0x403cac,null))[_0x873b('0x45')](handleError(_0x403cac,null));};exports[_0x873b('0x4c')]=function(_0x2c248a,_0x1fb2cf){return db[_0x873b('0x42')]['create'](_0x2c248a[_0x873b('0x4d')],{})[_0x873b('0x25')](function(_0x6fae88){var _0x2acbe0=_0x2c248a['user'][_0x873b('0x26')]({'plain':!![]});if(!_0x2acbe0)throw new Error(_0x873b('0x4e'));if(_0x2acbe0[_0x873b('0x4f')]===_0x873b('0x50')){var _0x2b294c=_0x6fae88['get']({'plain':!![]});var _0x2e4eaf=_0x873b('0x27');return db[_0x873b('0x51')][_0x873b('0x4b')]({'where':{'name':_0x2e4eaf,'userProfileId':_0x2acbe0[_0x873b('0x52')]},'raw':!![]})[_0x873b('0x25')](function(_0x46dbdf){if(_0x46dbdf&&_0x46dbdf['autoAssociation']===0x0){return db[_0x873b('0x28')][_0x873b('0x4c')]({'name':_0x2b294c[_0x873b('0x2c')],'resourceId':_0x2b294c['id'],'type':_0x46dbdf[_0x873b('0x2c')],'sectionId':_0x46dbdf['id']},{})[_0x873b('0x25')](function(){return _0x6fae88;});}else{return _0x6fae88;}})[_0x873b('0x45')](function(_0x4d9da2){logger[_0x873b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d9da2);throw _0x4d9da2;});}return _0x6fae88;})[_0x873b('0x25')](respondWithResult(_0x1fb2cf,0xc9))[_0x873b('0x45')](handleError(_0x1fb2cf,null));};exports[_0x873b('0x53')]=function(_0x14d211,_0x3a3c44){if(_0x14d211[_0x873b('0x4d')]['id']){delete _0x14d211[_0x873b('0x4d')]['id'];}return db[_0x873b('0x42')]['find']({'where':{'id':_0x14d211[_0x873b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a3c44,null))[_0x873b('0x25')](saveUpdates(_0x14d211[_0x873b('0x4d')],null))['then'](respondWithResult(_0x3a3c44,null))['catch'](handleError(_0x3a3c44,null));};exports[_0x873b('0x29')]=function(_0x1e460d,_0x3fd427){return db[_0x873b('0x42')][_0x873b('0x4b')]({'where':{'id':_0x1e460d[_0x873b('0x47')]['id']}})[_0x873b('0x25')](handleEntityNotFound(_0x3fd427,null))[_0x873b('0x25')](removeEntity(_0x3fd427,null))[_0x873b('0x45')](handleError(_0x3fd427,null));};exports['run']=function(_0x12d58e,_0x3d2f40,_0x69581f){var _0x5bd8e3=require('../../config/schedule');return db[_0x873b('0x42')][_0x873b('0x4b')]({'where':{'id':_0x12d58e[_0x873b('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3d2f40,null))['then'](function(){_0x5bd8e3[_0x873b('0x54')](_0x12d58e[_0x873b('0x47')]['id']);})['then'](respondWithStatusCode(_0x3d2f40,null))['catch'](handleError(_0x3d2f40,null));}; \ No newline at end of file +var _0x0291=['../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','rows','catch','find','create','body','user','userProfileId','autoAssociation','params','run'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x0291,0xf1));var _0x1029=function(_0x57d3c2,_0x589178){_0x57d3c2=_0x57d3c2-0x0;var _0x414954=_0x0291[_0x57d3c2];return _0x414954;};'use strict';var emlformat=require(_0x1029('0x0'));var rimraf=require(_0x1029('0x1'));var zipdir=require(_0x1029('0x2'));var jsonpatch=require(_0x1029('0x3'));var rp=require('request-promise');var moment=require(_0x1029('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1029('0x5'));var util=require('util');var path=require(_0x1029('0x6'));var sox=require(_0x1029('0x7'));var csv=require(_0x1029('0x8'));var ejs=require(_0x1029('0x9'));var fs=require('fs');var fs_extra=require(_0x1029('0xa'));var _=require('lodash');var squel=require(_0x1029('0xb'));var crypto=require(_0x1029('0xc'));var jsforce=require(_0x1029('0xd'));var deskjs=require(_0x1029('0xe'));var toCsv=require(_0x1029('0x8'));var querystring=require(_0x1029('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1029('0x10'));var as=require(_0x1029('0x11'));var hardwareService=require(_0x1029('0x12'));var logger=require(_0x1029('0x13'))(_0x1029('0x14'));var utils=require(_0x1029('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1029('0x16'));var db=require(_0x1029('0x17'))['db'];function respondWithStatusCode(_0x337c90,_0x5f3125){_0x5f3125=_0x5f3125||0xcc;return function(_0xba4264){if(_0xba4264){return _0x337c90[_0x1029('0x18')](_0x5f3125);}return _0x337c90[_0x1029('0x19')](_0x5f3125)[_0x1029('0x1a')]();};}function respondWithResult(_0x1043b6,_0x324621){_0x324621=_0x324621||0xc8;return function(_0x24a5f9){if(_0x24a5f9){return _0x1043b6[_0x1029('0x19')](_0x324621)[_0x1029('0x1b')](_0x24a5f9);}};}function respondWithFilteredResult(_0x23a054,_0x19c72d){return function(_0x185a5f){if(_0x185a5f){var _0xe2e1db=typeof _0x19c72d[_0x1029('0x1c')]===_0x1029('0x1d')&&typeof _0x19c72d[_0x1029('0x1e')]===_0x1029('0x1d');var _0x20c454=_0x185a5f['count'];var _0x542ff9=_0xe2e1db?0x0:_0x19c72d[_0x1029('0x1c')];var _0x5ab1f2=_0xe2e1db?_0x185a5f['count']:_0x19c72d[_0x1029('0x1c')]+_0x19c72d[_0x1029('0x1e')];var _0x1ad1f4;if(_0x5ab1f2>=_0x20c454){_0x5ab1f2=_0x20c454;_0x1ad1f4=0xc8;}else{_0x1ad1f4=0xce;}_0x23a054[_0x1029('0x19')](_0x1ad1f4);return _0x23a054['set'](_0x1029('0x1f'),_0x542ff9+'-'+_0x5ab1f2+'/'+_0x20c454)[_0x1029('0x1b')](_0x185a5f);}return null;};}function patchUpdates(_0xf51059){return function(_0x5b4a14){try{jsonpatch[_0x1029('0x20')](_0x5b4a14,_0xf51059,!![]);}catch(_0x247aef){return BPromise['reject'](_0x247aef);}return _0x5b4a14['save']();};}function saveUpdates(_0x475588,_0x50d213){return function(_0x1934d){if(_0x1934d){return _0x1934d[_0x1029('0x21')](_0x475588)[_0x1029('0x22')](function(_0x4d8eb9){return _0x4d8eb9;});}return null;};}function removeEntity(_0x13286c,_0x4fc6fd){return function(_0xb77bc){if(_0xb77bc){return _0xb77bc[_0x1029('0x23')]()[_0x1029('0x22')](function(){var _0x9a83f5=_0xb77bc[_0x1029('0x24')]({'plain':!![]});var _0x5b3d98=_0x1029('0x25');return db[_0x1029('0x26')][_0x1029('0x23')]({'where':{'type':_0x5b3d98,'resourceId':_0x9a83f5['id']}})[_0x1029('0x22')](function(){return _0xb77bc;});})[_0x1029('0x22')](function(){_0x13286c[_0x1029('0x19')](0xcc)[_0x1029('0x1a')]();});}};}function handleEntityNotFound(_0x4155a7,_0x2849e2){return function(_0x1a14ac){if(!_0x1a14ac){_0x4155a7['sendStatus'](0x194);}return _0x1a14ac;};}function handleError(_0x5d16d7,_0x4aad22){_0x4aad22=_0x4aad22||0x1f4;return function(_0x1135ee){logger[_0x1029('0x27')](_0x1135ee[_0x1029('0x28')]);if(_0x1135ee[_0x1029('0x29')]){delete _0x1135ee[_0x1029('0x29')];}_0x5d16d7['status'](_0x4aad22)[_0x1029('0x2a')](_0x1135ee);};}exports['index']=function(_0xbeaef,_0x4f2321){var _0x48bf8e={},_0x3bbf96={},_0x217668={'count':0x0,'rows':[]};var _0x976eba=_[_0x1029('0x2b')](db[_0x1029('0x2c')][_0x1029('0x2d')],function(_0x23fc7){return{'name':_0x23fc7[_0x1029('0x2e')],'type':_0x23fc7[_0x1029('0x2f')][_0x1029('0x30')]};});_0x3bbf96[_0x1029('0x31')]=_[_0x1029('0x2b')](_0x976eba,_0x1029('0x29'));_0x3bbf96['query']=_[_0x1029('0x32')](_0xbeaef['query']);_0x3bbf96['filters']=_[_0x1029('0x33')](_0x3bbf96[_0x1029('0x31')],_0x3bbf96[_0x1029('0x34')]);_0x48bf8e['attributes']=_['intersection'](_0x3bbf96[_0x1029('0x31')],qs[_0x1029('0x35')](_0xbeaef[_0x1029('0x34')][_0x1029('0x35')]));_0x48bf8e['attributes']=_0x48bf8e[_0x1029('0x36')][_0x1029('0x37')]?_0x48bf8e[_0x1029('0x36')]:_0x3bbf96[_0x1029('0x31')];if(!_0xbeaef['query'][_0x1029('0x38')](_0x1029('0x39'))){_0x48bf8e[_0x1029('0x1e')]=qs[_0x1029('0x1e')](_0xbeaef['query'][_0x1029('0x1e')]);_0x48bf8e['offset']=qs['offset'](_0xbeaef[_0x1029('0x34')]['offset']);}_0x48bf8e[_0x1029('0x3a')]=qs['sort'](_0xbeaef['query'][_0x1029('0x3b')]);_0x48bf8e[_0x1029('0x3c')]=qs[_0x1029('0x3d')](_[_0x1029('0x3e')](_0xbeaef[_0x1029('0x34')],_0x3bbf96[_0x1029('0x3d')]),_0x976eba);if(_0xbeaef['query'][_0x1029('0x3f')]){_0x48bf8e['where']=_[_0x1029('0x40')](_0x48bf8e[_0x1029('0x3c')],{'$or':_[_0x1029('0x2b')](_0x976eba,function(_0x2f32ce){if(_0x2f32ce[_0x1029('0x2f')]!=='VIRTUAL'){var _0x29ea7={};_0x29ea7[_0x2f32ce['name']]={'$like':'%'+_0xbeaef['query'][_0x1029('0x3f')]+'%'};return _0x29ea7;}})});}_0x48bf8e=_[_0x1029('0x40')]({},_0x48bf8e,_0xbeaef['options']);var _0x122aed={'where':_0x48bf8e[_0x1029('0x3c')]};return db[_0x1029('0x2c')][_0x1029('0x41')](_0x122aed)['then'](function(_0x5b7c9a){_0x217668['count']=_0x5b7c9a;if(_0xbeaef[_0x1029('0x34')][_0x1029('0x42')]){_0x48bf8e[_0x1029('0x43')]=[{'all':!![]}];}return db['Schedule'][_0x1029('0x44')](_0x48bf8e);})[_0x1029('0x22')](function(_0x46d78c){_0x217668[_0x1029('0x45')]=_0x46d78c;return _0x217668;})[_0x1029('0x22')](respondWithFilteredResult(_0x4f2321,_0x48bf8e))[_0x1029('0x46')](handleError(_0x4f2321,null));};exports['show']=function(_0x242cd8,_0x33b110){var _0x1e4615={'raw':![],'where':{'id':_0x242cd8['params']['id']}},_0x326dd3={};_0x326dd3['model']=_[_0x1029('0x32')](db[_0x1029('0x2c')]['rawAttributes']);_0x326dd3[_0x1029('0x34')]=_['keys'](_0x242cd8[_0x1029('0x34')]);_0x326dd3[_0x1029('0x3d')]=_[_0x1029('0x33')](_0x326dd3[_0x1029('0x31')],_0x326dd3[_0x1029('0x34')]);_0x1e4615[_0x1029('0x36')]=_[_0x1029('0x33')](_0x326dd3[_0x1029('0x31')],qs[_0x1029('0x35')](_0x242cd8[_0x1029('0x34')][_0x1029('0x35')]));_0x1e4615[_0x1029('0x36')]=_0x1e4615[_0x1029('0x36')][_0x1029('0x37')]?_0x1e4615[_0x1029('0x36')]:_0x326dd3[_0x1029('0x31')];if(_0x242cd8[_0x1029('0x34')]['includeAll']){_0x1e4615[_0x1029('0x43')]=[{'all':!![]}];}_0x1e4615=_['merge']({},_0x1e4615,_0x242cd8['options']);return db[_0x1029('0x2c')][_0x1029('0x47')](_0x1e4615)[_0x1029('0x22')](handleEntityNotFound(_0x33b110,null))[_0x1029('0x22')](respondWithResult(_0x33b110,null))[_0x1029('0x46')](handleError(_0x33b110,null));};exports[_0x1029('0x48')]=function(_0x27176,_0x38c2f5){return db[_0x1029('0x2c')][_0x1029('0x48')](_0x27176[_0x1029('0x49')],{})[_0x1029('0x22')](function(_0x4a4064){var _0xa69fbc=_0x27176['user'][_0x1029('0x24')]({'plain':!![]});if(!_0xa69fbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa69fbc['role']===_0x1029('0x4a')){var _0x9b06e6=_0x4a4064[_0x1029('0x24')]({'plain':!![]});var _0x3e069c=_0x1029('0x25');return db['UserProfileSection'][_0x1029('0x47')]({'where':{'name':_0x3e069c,'userProfileId':_0xa69fbc[_0x1029('0x4b')]},'raw':!![]})[_0x1029('0x22')](function(_0x25a201){if(_0x25a201&&_0x25a201[_0x1029('0x4c')]===0x0){return db[_0x1029('0x26')][_0x1029('0x48')]({'name':_0x9b06e6[_0x1029('0x29')],'resourceId':_0x9b06e6['id'],'type':_0x25a201[_0x1029('0x29')],'sectionId':_0x25a201['id']},{})[_0x1029('0x22')](function(){return _0x4a4064;});}else{return _0x4a4064;}})['catch'](function(_0x1dfc92){logger[_0x1029('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dfc92);throw _0x1dfc92;});}return _0x4a4064;})[_0x1029('0x22')](respondWithResult(_0x38c2f5,0xc9))[_0x1029('0x46')](handleError(_0x38c2f5,null));};exports[_0x1029('0x21')]=function(_0x38fa7d,_0x286f29){if(_0x38fa7d[_0x1029('0x49')]['id']){delete _0x38fa7d[_0x1029('0x49')]['id'];}return db[_0x1029('0x2c')][_0x1029('0x47')]({'where':{'id':_0x38fa7d[_0x1029('0x4d')]['id']}})['then'](handleEntityNotFound(_0x286f29,null))[_0x1029('0x22')](saveUpdates(_0x38fa7d[_0x1029('0x49')],null))[_0x1029('0x22')](respondWithResult(_0x286f29,null))[_0x1029('0x46')](handleError(_0x286f29,null));};exports[_0x1029('0x23')]=function(_0x562dbd,_0x2e5f76){return db[_0x1029('0x2c')][_0x1029('0x47')]({'where':{'id':_0x562dbd[_0x1029('0x4d')]['id']}})[_0x1029('0x22')](handleEntityNotFound(_0x2e5f76,null))[_0x1029('0x22')](removeEntity(_0x2e5f76,null))[_0x1029('0x46')](handleError(_0x2e5f76,null));};exports[_0x1029('0x4e')]=function(_0x81d291,_0x2f54c5,_0x4799bf){var _0x5b95b3=require(_0x1029('0x4f'));return db[_0x1029('0x2c')][_0x1029('0x47')]({'where':{'id':_0x81d291[_0x1029('0x4d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2f54c5,null))[_0x1029('0x22')](function(){_0x5b95b3[_0x1029('0x4e')](_0x81d291[_0x1029('0x4d')]['id']);})['then'](respondWithStatusCode(_0x2f54c5,null))[_0x1029('0x46')](handleError(_0x2f54c5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 64dc99d..29a5b9b 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 _0x1089=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0xddadc9,_0x5dbffa){var _0x112032=function(_0x685a4e){while(--_0x685a4e){_0xddadc9['push'](_0xddadc9['shift']());}};_0x112032(++_0x5dbffa);}(_0x1089,0x6f));var _0x9108=function(_0x556afe,_0x3f9359){_0x556afe=_0x556afe-0x0;var _0x3327a4=_0x1089[_0x556afe];return _0x3327a4;};'use strict';var _=require(_0x9108('0x0'));var util=require('util');var logger=require(_0x9108('0x1'))(_0x9108('0x2'));var moment=require(_0x9108('0x3'));var BPromise=require('bluebird');var rp=require(_0x9108('0x4'));var fs=require('fs');var path=require(_0x9108('0x5'));var rimraf=require(_0x9108('0x6'));var config=require(_0x9108('0x7'));var attributes=require(_0x9108('0x8'));module[_0x9108('0x9')]=function(_0x3b1f8f,_0x352db5){return _0x3b1f8f[_0x9108('0xa')](_0x9108('0xb'),attributes,{'tableName':_0x9108('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d61=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash'];(function(_0x36f39c,_0x3cc2b0){var _0x4dbd28=function(_0x13b194){while(--_0x13b194){_0x36f39c['push'](_0x36f39c['shift']());}};_0x4dbd28(++_0x3cc2b0);}(_0x8d61,0x196));var _0x18d6=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x8d61[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x18d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x18d6('0x1'));var moment=require(_0x18d6('0x2'));var BPromise=require(_0x18d6('0x3'));var rp=require(_0x18d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18d6('0x5'));var config=require(_0x18d6('0x6'));var attributes=require(_0x18d6('0x7'));module[_0x18d6('0x8')]=function(_0x533240,_0x2175ae){return _0x533240[_0x18d6('0x9')](_0x18d6('0xa'),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 08f3664..3b3cff5 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 _0x123f=['request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','Schedule,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5596e0,_0x3c2a3d){var _0x56640a=function(_0x58a22a){while(--_0x58a22a){_0x5596e0['push'](_0x5596e0['shift']());}};_0x56640a(++_0x3c2a3d);}(_0x123f,0xc3));var _0xf123=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0x123f[_0x1ebb10];return _0x20d709;};'use strict';var _=require(_0xf123('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf123('0x1'));var rs=require(_0xf123('0x2'));var fs=require('fs');var Redis=require(_0xf123('0x3'));var db=require(_0xf123('0x4'))['db'];var utils=require(_0xf123('0x5'));var logger=require(_0xf123('0x6'))(_0xf123('0x7'));var config=require(_0xf123('0x8'));var jayson=require(_0xf123('0x9'));var client=jayson[_0xf123('0xa')][_0xf123('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2645,_0x46f526,_0x302220){return new BPromise(function(_0x35b993,_0x412226){return client[_0xf123('0xc')](_0x1d2645,_0x302220)[_0xf123('0xd')](function(_0x3839bc){logger[_0xf123('0xe')]('Schedule,\x20%s,\x20%s',_0x46f526,_0xf123('0xf'));logger['debug'](_0xf123('0x10'),_0x46f526,_0xf123('0xf'),JSON['stringify'](_0x3839bc));if(_0x3839bc[_0xf123('0x11')]){if(_0x3839bc[_0xf123('0x11')][_0xf123('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x46f526,_0x3839bc[_0xf123('0x11')][_0xf123('0x13')]);return _0x412226(_0x3839bc['error']['message']);}logger[_0xf123('0x11')](_0xf123('0x14'),_0x46f526,_0x3839bc['error']['message']);return _0x35b993(_0x3839bc[_0xf123('0x11')]['message']);}else{logger['info'](_0xf123('0x14'),_0x46f526,_0xf123('0xf'));_0x35b993(_0x3839bc[_0xf123('0x15')][_0xf123('0x13')]);}})[_0xf123('0x16')](function(_0x3b537e){logger[_0xf123('0x11')](_0xf123('0x14'),_0x46f526,_0x3b537e);_0x412226(_0x3b537e);});});} \ No newline at end of file +var _0x1e4a=['../../config/environment','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2e5f21,_0x539f49){var _0x90fcb4=function(_0x33704f){while(--_0x33704f){_0x2e5f21['push'](_0x2e5f21['shift']());}};_0x90fcb4(++_0x539f49);}(_0x1e4a,0x92));var _0xa1e4=function(_0x10e557,_0xfb23c8){_0x10e557=_0x10e557-0x0;var _0x3e4e93=_0x1e4a[_0x10e557];return _0x3e4e93;};'use strict';var _=require(_0xa1e4('0x0'));var util=require('util');var moment=require(_0xa1e4('0x1'));var BPromise=require(_0xa1e4('0x2'));var rs=require(_0xa1e4('0x3'));var fs=require('fs');var Redis=require(_0xa1e4('0x4'));var db=require(_0xa1e4('0x5'))['db'];var utils=require(_0xa1e4('0x6'));var logger=require('../../config/logger')(_0xa1e4('0x7'));var config=require(_0xa1e4('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6467,_0x435644,_0x50a3e4){return new BPromise(function(_0x6dfe19,_0x50eb9d){return client[_0xa1e4('0x9')](_0x2b6467,_0x50a3e4)[_0xa1e4('0xa')](function(_0x2c2c28){logger[_0xa1e4('0xb')]('Schedule,\x20%s,\x20%s',_0x435644,_0xa1e4('0xc'));logger[_0xa1e4('0xd')](_0xa1e4('0xe'),_0x435644,_0xa1e4('0xc'),JSON[_0xa1e4('0xf')](_0x2c2c28));if(_0x2c2c28[_0xa1e4('0x10')]){if(_0x2c2c28[_0xa1e4('0x10')][_0xa1e4('0x11')]===0x1f4){logger['error'](_0xa1e4('0x12'),_0x435644,_0x2c2c28[_0xa1e4('0x10')]['message']);return _0x50eb9d(_0x2c2c28[_0xa1e4('0x10')][_0xa1e4('0x13')]);}logger[_0xa1e4('0x10')]('Schedule,\x20%s,\x20%s',_0x435644,_0x2c2c28['error']['message']);return _0x6dfe19(_0x2c2c28[_0xa1e4('0x10')][_0xa1e4('0x13')]);}else{logger['info'](_0xa1e4('0x12'),_0x435644,'request\x20sent');_0x6dfe19(_0x2c2c28[_0xa1e4('0x14')]['message']);}})[_0xa1e4('0x15')](function(_0x464bd8){logger['error'](_0xa1e4('0x12'),_0x435644,_0x464bd8);_0x50eb9d(_0x464bd8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 34dc10e..2de19c6 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 _0xb932=['download','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','/:id/download'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb932,0x10b));var _0x2b93=function(_0x2c9d42,_0x4ab260){_0x2c9d42=_0x2c9d42-0x0;var _0x5ccd7a=_0xb932[_0x2c9d42];return _0x5ccd7a;};'use strict';var multer=require(_0x2b93('0x0'));var util=require(_0x2b93('0x1'));var path=require(_0x2b93('0x2'));var timeout=require(_0x2b93('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b93('0x4'));var interaction=require(_0x2b93('0x5'));var config=require(_0x2b93('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x2b93('0x7')](),controller[_0x2b93('0x8')]);router['get'](_0x2b93('0x9'),auth[_0x2b93('0x7')](),controller['describe']);router[_0x2b93('0xa')](_0x2b93('0xb'),auth[_0x2b93('0x7')](),controller['show']);router[_0x2b93('0xa')](_0x2b93('0xc'),auth[_0x2b93('0x7')](),controller[_0x2b93('0xd')]);router[_0x2b93('0xe')]('/',auth[_0x2b93('0x7')](),controller['create']);router[_0x2b93('0xf')](_0x2b93('0xb'),auth['isAuthenticated'](),controller[_0x2b93('0x10')]);router[_0x2b93('0x11')]('/:id',auth[_0x2b93('0x7')](),controller[_0x2b93('0x12')]);module[_0x2b93('0x13')]=router; \ No newline at end of file +var _0x79a0=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','post','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x164eb1,_0x198a7d){var _0x73311=function(_0xde4d4a){while(--_0xde4d4a){_0x164eb1['push'](_0x164eb1['shift']());}};_0x73311(++_0x198a7d);}(_0x79a0,0x1c1));var _0x079a=function(_0x108fe3,_0xe4163f){_0x108fe3=_0x108fe3-0x0;var _0x48cbef=_0x79a0[_0x108fe3];return _0x48cbef;};'use strict';var multer=require('multer');var util=require(_0x079a('0x0'));var path=require(_0x079a('0x1'));var timeout=require(_0x079a('0x2'));var express=require(_0x079a('0x3'));var router=express[_0x079a('0x4')]();var fs_extra=require(_0x079a('0x5'));var auth=require(_0x079a('0x6'));var interaction=require(_0x079a('0x7'));var config=require(_0x079a('0x8'));var controller=require(_0x079a('0x9'));router[_0x079a('0xa')]('/',auth[_0x079a('0xb')](),controller[_0x079a('0xc')]);router[_0x079a('0xa')](_0x079a('0xd'),auth['isAuthenticated'](),controller[_0x079a('0xe')]);router['get']('/:id',auth[_0x079a('0xb')](),controller[_0x079a('0xf')]);router[_0x079a('0xa')](_0x079a('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x079a('0x11')]('/',auth[_0x079a('0xb')](),controller['create']);router[_0x079a('0x12')]('/:id',auth[_0x079a('0xb')](),controller[_0x079a('0x13')]);router[_0x079a('0x14')](_0x079a('0x15'),auth['isAuthenticated'](),controller[_0x079a('0x16')]);module[_0x079a('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 68019d6..a413deb 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 _0x58c9=['format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE'];(function(_0x449873,_0x3b4685){var _0x267f55=function(_0x404ac1){while(--_0x404ac1){_0x449873['push'](_0x449873['shift']());}};_0x267f55(++_0x3b4685);}(_0x58c9,0x1bc));var _0x958c=function(_0x9fcd24,_0x19cc96){_0x9fcd24=_0x9fcd24-0x0;var _0x21edb=_0x58c9[_0x9fcd24];return _0x21edb;};'use strict';var Sequelize=require(_0x958c('0x0'));var moment=require(_0x958c('0x1'));var path=require(_0x958c('0x2'));var config=require(_0x958c('0x3'));module[_0x958c('0x4')]={'format':{'type':Sequelize[_0x958c('0x5')],'get':function(){return this[_0x958c('0x6')](_0x958c('0x7'))?path[_0x958c('0x8')](this[_0x958c('0x6')](_0x958c('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x958c('0x9')]},'channel':{'type':Sequelize[_0x958c('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x158388){var _0xa44c9=_0x158388[_0x958c('0xa')](/\\/g,'/');this[_0x958c('0xb')](_0x958c('0x7'),_0xa44c9);}},'rating':{'type':Sequelize[_0x958c('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x958c('0xc')],'set':function(_0x128ef6){this[_0x958c('0xb')](_0x958c('0xd'),moment()[_0x958c('0xe')](_0x128ef6,'ms'));this['setDataValue'](_0x958c('0xf'),moment());this[_0x958c('0xb')](_0x958c('0x10'),_0x128ef6);}},'startedAt':{'type':Sequelize[_0x958c('0x11')],'get':function(){return moment(this[_0x958c('0x6')](_0x958c('0xd')))[_0x958c('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x958c('0x13')]();}},'closedAt':{'type':Sequelize[_0x958c('0x11')],'get':function(){return moment(this['getDataValue'](_0x958c('0xf')))[_0x958c('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x958c('0x13')]();}},'createdAt':{'type':Sequelize[_0x958c('0x11')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x958c('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x958c('0x6')](_0x958c('0x14')))[_0x958c('0x12')](_0x958c('0x15'))['toString']();}}}; \ No newline at end of file +var _0x8212=['moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize'];(function(_0xa51ba0,_0x3bf58d){var _0x17f343=function(_0x149d7a){while(--_0x149d7a){_0xa51ba0['push'](_0xa51ba0['shift']());}};_0x17f343(++_0x3bf58d);}(_0x8212,0xb3));var _0x2821=function(_0x312c24,_0x3fc1cc){_0x312c24=_0x312c24-0x0;var _0x4c80d9=_0x8212[_0x312c24];return _0x4c80d9;};'use strict';var Sequelize=require(_0x2821('0x0'));var moment=require(_0x2821('0x1'));var path=require('path');var config=require(_0x2821('0x2'));module[_0x2821('0x3')]={'format':{'type':Sequelize[_0x2821('0x4')],'get':function(){return this[_0x2821('0x5')](_0x2821('0x6'))?path[_0x2821('0x7')](this[_0x2821('0x5')](_0x2821('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2821('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x376c57){var _0x1dc078=_0x376c57['replace'](/\\/g,'/');this[_0x2821('0x9')](_0x2821('0x6'),_0x1dc078);}},'rating':{'type':Sequelize[_0x2821('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2821('0xa')],'set':function(_0x16003f){this[_0x2821('0x9')](_0x2821('0xb'),moment()[_0x2821('0xc')](_0x16003f,'ms'));this[_0x2821('0x9')]('closedAt',moment());this[_0x2821('0x9')](_0x2821('0xd'),_0x16003f);}},'startedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x2821('0xf')]();}},'closedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this[_0x2821('0x5')](_0x2821('0x10')))[_0x2821('0x11')](_0x2821('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x2821('0x11')](_0x2821('0x12'))[_0x2821('0xf')]();}},'updatedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue'](_0x2821('0x13')))['format'](_0x2821('0x12'))[_0x2821('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8e93bfb..23ece99 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 _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x128b9d,_0x4a085f){var _0x3906c6=function(_0x2ee338){while(--_0x2ee338){_0x128b9d['push'](_0x128b9d['shift']());}};_0x3906c6(++_0x4a085f);}(_0xee14,0x13a));var _0x4ee1=function(_0x3e83d2,_0x238f9f){_0x3e83d2=_0x3e83d2-0x0;var _0x4246d2=_0xee14[_0x3e83d2];return _0x4246d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5358ca,_0x41c67e){var _0x4175d2=function(_0x1fefab){while(--_0x1fefab){_0x5358ca['push'](_0x5358ca['shift']());}};_0x4175d2(++_0x41c67e);}(_0x8958,0x93));var _0x8895=function(_0x103bfe,_0x534617){_0x103bfe=_0x103bfe-0x0;var _0x38f00e=_0x8958[_0x103bfe];return _0x38f00e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2aad2e6..102f693 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 _0x3432=['api','moment','bluebird','request-promise','rimraf','./screenRecording.attributes','define','ScreenRecording','interactionid','util'];(function(_0x4c97f4,_0x114839){var _0x53f50b=function(_0x1e908c){while(--_0x1e908c){_0x4c97f4['push'](_0x4c97f4['shift']());}};_0x53f50b(++_0x114839);}(_0x3432,0x199));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2343('0x0'));var logger=require('../../config/logger')(_0x2343('0x1'));var moment=require(_0x2343('0x2'));var BPromise=require(_0x2343('0x3'));var rp=require(_0x2343('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2343('0x5'));var config=require('../../config/environment');var attributes=require(_0x2343('0x6'));module['exports']=function(_0x14f05e,_0x580555){return _0x14f05e[_0x2343('0x7')](_0x2343('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x2343('0x9'),'fields':[_0x2343('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d6f=['moment','bluebird','request-promise','path','rimraf','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger'];(function(_0x10e2b9,_0x3c7ab6){var _0x3fbc38=function(_0x115eda){while(--_0x115eda){_0x10e2b9['push'](_0x10e2b9['shift']());}};_0x3fbc38(++_0x3c7ab6);}(_0x8d6f,0x14d));var _0xf8d6=function(_0x22b1d2,_0x189aab){_0x22b1d2=_0x22b1d2-0x0;var _0x18dd75=_0x8d6f[_0x22b1d2];return _0x18dd75;};'use strict';var _=require(_0xf8d6('0x0'));var util=require(_0xf8d6('0x1'));var logger=require(_0xf8d6('0x2'))('api');var moment=require(_0xf8d6('0x3'));var BPromise=require(_0xf8d6('0x4'));var rp=require(_0xf8d6('0x5'));var fs=require('fs');var path=require(_0xf8d6('0x6'));var rimraf=require(_0xf8d6('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xf8d6('0x8')]=function(_0x558273,_0xfb91b){return _0x558273[_0xf8d6('0x9')](_0xf8d6('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xf8d6('0xb'),'fields':[_0xf8d6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 94e6377..638d6ba 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 _0x88b6=['request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x287d1b,_0x57e6bc){var _0x69c191=function(_0x217405){while(--_0x217405){_0x287d1b['push'](_0x287d1b['shift']());}};_0x69c191(++_0x57e6bc);}(_0x88b6,0xa5));var _0x688b=function(_0x3d0750,_0x29a3ed){_0x3d0750=_0x3d0750-0x0;var _0x58e9d4=_0x88b6[_0x3d0750];return _0x58e9d4;};'use strict';var _=require(_0x688b('0x0'));var util=require(_0x688b('0x1'));var moment=require('moment');var BPromise=require(_0x688b('0x2'));var rs=require(_0x688b('0x3'));var fs=require('fs');var Redis=require(_0x688b('0x4'));var db=require(_0x688b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x688b('0x6'))(_0x688b('0x7'));var config=require(_0x688b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x688b('0x9')][_0x688b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5692bc,_0x725694,_0x3827ca){return new BPromise(function(_0x39f389,_0x49e8c6){return client[_0x688b('0xb')](_0x5692bc,_0x3827ca)['then'](function(_0x3fff33){logger['info'](_0x688b('0xc'),_0x725694,_0x688b('0xd'));logger[_0x688b('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x725694,_0x688b('0xd'),JSON[_0x688b('0xf')](_0x3fff33));if(_0x3fff33[_0x688b('0x10')]){if(_0x3fff33['error'][_0x688b('0x11')]===0x1f4){logger[_0x688b('0x10')](_0x688b('0xc'),_0x725694,_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);return _0x49e8c6(_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);}logger[_0x688b('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x725694,_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);return _0x39f389(_0x3fff33[_0x688b('0x10')][_0x688b('0x12')]);}else{logger[_0x688b('0x13')](_0x688b('0xc'),_0x725694,_0x688b('0xd'));_0x39f389(_0x3fff33[_0x688b('0x14')]['message']);}})[_0x688b('0x15')](function(_0x505ece){logger[_0x688b('0x10')](_0x688b('0xc'),_0x725694,_0x505ece);_0x49e8c6(_0x505ece);});});} \ No newline at end of file +var _0x84a1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x2fa1f8,_0x3d5fb3){var _0x3a62b3=function(_0x56f394){while(--_0x56f394){_0x2fa1f8['push'](_0x2fa1f8['shift']());}};_0x3a62b3(++_0x3d5fb3);}(_0x84a1,0x1b2));var _0x184a=function(_0x35dc4c,_0x534f37){_0x35dc4c=_0x35dc4c-0x0;var _0x1f001f=_0x84a1[_0x35dc4c];return _0x1f001f;};'use strict';var _=require(_0x184a('0x0'));var util=require(_0x184a('0x1'));var moment=require(_0x184a('0x2'));var BPromise=require(_0x184a('0x3'));var rs=require(_0x184a('0x4'));var fs=require('fs');var Redis=require(_0x184a('0x5'));var db=require(_0x184a('0x6'))['db'];var utils=require(_0x184a('0x7'));var logger=require(_0x184a('0x8'))('rpc');var config=require(_0x184a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x184a('0xa')][_0x184a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bb97c,_0x4a4af8,_0x4b7b96){return new BPromise(function(_0x473636,_0x167c1b){return client[_0x184a('0xc')](_0x4bb97c,_0x4b7b96)[_0x184a('0xd')](function(_0x14c887){logger[_0x184a('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4a4af8,_0x184a('0xf'));logger['debug'](_0x184a('0x10'),_0x4a4af8,_0x184a('0xf'),JSON['stringify'](_0x14c887));if(_0x14c887[_0x184a('0x11')]){if(_0x14c887[_0x184a('0x11')][_0x184a('0x12')]===0x1f4){logger[_0x184a('0x11')](_0x184a('0x13'),_0x4a4af8,_0x14c887[_0x184a('0x11')][_0x184a('0x14')]);return _0x167c1b(_0x14c887[_0x184a('0x11')][_0x184a('0x14')]);}logger[_0x184a('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4a4af8,_0x14c887['error'][_0x184a('0x14')]);return _0x473636(_0x14c887[_0x184a('0x11')][_0x184a('0x14')]);}else{logger['info'](_0x184a('0x13'),_0x4a4af8,_0x184a('0xf'));_0x473636(_0x14c887[_0x184a('0x15')][_0x184a('0x14')]);}})[_0x184a('0x16')](function(_0x176bf8){logger[_0x184a('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4a4af8,_0x176bf8);_0x167c1b(_0x176bf8);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e101a39..4328044 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 _0x6e24=['format','originalname','post','single','addLogo','diskStorage','%s%s','logologin','file','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','put','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/'];(function(_0x16d60e,_0x2c83cb){var _0x254949=function(_0x2c49ae){while(--_0x2c49ae){_0x16d60e['push'](_0x16d60e['shift']());}};_0x254949(++_0x2c83cb);}(_0x6e24,0x10d));var _0x46e2=function(_0x47a3c2,_0x55d53d){_0x47a3c2=_0x47a3c2-0x0;var _0x3cf66e=_0x6e24[_0x47a3c2];return _0x3cf66e;};'use strict';var multer=require(_0x46e2('0x0'));var util=require(_0x46e2('0x1'));var path=require(_0x46e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x46e2('0x3'));var router=express['Router']();var fs_extra=require(_0x46e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x46e2('0x5'));var config=require('../../config/environment');var controller=require(_0x46e2('0x6'));router[_0x46e2('0x7')]('/',auth[_0x46e2('0x8')](),controller[_0x46e2('0x9')]);router[_0x46e2('0x7')]('/now',controller[_0x46e2('0xa')]);router['get'](_0x46e2('0xb'),controller['show']);router['get'](_0x46e2('0xc'),controller[_0x46e2('0xd')]);router[_0x46e2('0x7')](_0x46e2('0xe'),controller[_0x46e2('0xf')]);router[_0x46e2('0x7')](_0x46e2('0x10'),controller[_0x46e2('0x11')]);router[_0x46e2('0x7')](_0x46e2('0x12'),controller[_0x46e2('0x13')]);router[_0x46e2('0x7')](_0x46e2('0x14'),controller[_0x46e2('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x470998,_0xcb2eef,_0x5d91ac){_0x5d91ac(null,path[_0x46e2('0x16')](config[_0x46e2('0x17')],_0x46e2('0x18')));},'filename':function(_0x39b697,_0x56d3cb,_0x55c400){_0x55c400(null,util[_0x46e2('0x19')]('%s%s','logo',path['extname'](_0x56d3cb[_0x46e2('0x1a')])));}})});router[_0x46e2('0x1b')](_0x46e2('0xc'),upload[_0x46e2('0x1c')]('file'),controller[_0x46e2('0x1d')]);var upload=multer({'storage':multer[_0x46e2('0x1e')]({'destination':function(_0x66622b,_0x310d89,_0x1d0def){_0x1d0def(null,path[_0x46e2('0x16')](config[_0x46e2('0x17')],'server/files/images/logos/'));},'filename':function(_0x574774,_0x4e6041,_0x428092){_0x428092(null,util['format'](_0x46e2('0x1f'),_0x46e2('0x20'),path['extname'](_0x4e6041[_0x46e2('0x1a')])));}})});router[_0x46e2('0x1b')]('/:id/logo_login',upload[_0x46e2('0x1c')](_0x46e2('0x21')),controller[_0x46e2('0x22')]);var upload=multer({'storage':multer[_0x46e2('0x1e')]({'destination':function(_0x9b697f,_0x53b3dd,_0x12ad52){_0x12ad52(null,path['join'](config[_0x46e2('0x17')],_0x46e2('0x18')));},'filename':function(_0x119194,_0x40b617,_0x57652a){_0x57652a(null,util[_0x46e2('0x19')](_0x46e2('0x1f'),_0x46e2('0x23'),path[_0x46e2('0x24')](_0x40b617[_0x46e2('0x1a')])));}})});router[_0x46e2('0x1b')](_0x46e2('0x12'),upload[_0x46e2('0x1c')](_0x46e2('0x21')),controller[_0x46e2('0x25')]);var upload=multer({'storage':multer[_0x46e2('0x1e')]({'destination':function(_0x52906a,_0x2ee70a,_0x4dc3cc){_0x4dc3cc(null,path['join'](config[_0x46e2('0x17')],'server/files/images/logos/'));},'filename':function(_0x315459,_0x19b83e,_0x3e100e){_0x3e100e(null,util[_0x46e2('0x19')](_0x46e2('0x1f'),_0x46e2('0x26'),path[_0x46e2('0x24')](_0x19b83e[_0x46e2('0x1a')])));}})});router['post'](_0x46e2('0x14'),upload[_0x46e2('0x1c')](_0x46e2('0x21')),controller[_0x46e2('0x27')]);router[_0x46e2('0x28')](_0x46e2('0xb'),auth[_0x46e2('0x8')](),controller['update']);module[_0x46e2('0x29')]=router; \ No newline at end of file +var _0xb18e=['format','logologin','extname','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','join','root','server/files/images/logos/','%s%s','logo','originalname','post','/:id/logo','single','file','diskStorage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb18e,0x67));var _0xeb18=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0xb18e[_0x217ff6];return _0x417c93;};'use strict';var multer=require(_0xeb18('0x0'));var util=require(_0xeb18('0x1'));var path=require(_0xeb18('0x2'));var timeout=require(_0xeb18('0x3'));var express=require(_0xeb18('0x4'));var router=express['Router']();var fs_extra=require(_0xeb18('0x5'));var auth=require(_0xeb18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb18('0x7'));var controller=require(_0xeb18('0x8'));router[_0xeb18('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb18('0x9')](_0xeb18('0xa'),controller[_0xeb18('0xb')]);router[_0xeb18('0x9')](_0xeb18('0xc'),controller[_0xeb18('0xd')]);router['get']('/:id/logo',controller[_0xeb18('0xe')]);router['get'](_0xeb18('0xf'),controller[_0xeb18('0x10')]);router[_0xeb18('0x9')](_0xeb18('0x11'),controller[_0xeb18('0x12')]);router[_0xeb18('0x9')]('/:id/preferred',controller[_0xeb18('0x13')]);router[_0xeb18('0x9')](_0xeb18('0x14'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43c220,_0x402f18,_0x7b55d0){_0x7b55d0(null,path[_0xeb18('0x15')](config[_0xeb18('0x16')],_0xeb18('0x17')));},'filename':function(_0xcd2095,_0x13b1b3,_0x356d44){_0x356d44(null,util['format'](_0xeb18('0x18'),_0xeb18('0x19'),path['extname'](_0x13b1b3[_0xeb18('0x1a')])));}})});router[_0xeb18('0x1b')](_0xeb18('0x1c'),upload[_0xeb18('0x1d')](_0xeb18('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0xeb18('0x1f')]({'destination':function(_0x393836,_0x4e286b,_0x5c7009){_0x5c7009(null,path['join'](config['root'],_0xeb18('0x17')));},'filename':function(_0x2580a3,_0x507d50,_0x13ba6a){_0x13ba6a(null,util[_0xeb18('0x20')](_0xeb18('0x18'),_0xeb18('0x21'),path[_0xeb18('0x22')](_0x507d50[_0xeb18('0x1a')])));}})});router[_0xeb18('0x1b')](_0xeb18('0xf'),upload[_0xeb18('0x1d')](_0xeb18('0x1e')),controller[_0xeb18('0x23')]);var upload=multer({'storage':multer[_0xeb18('0x1f')]({'destination':function(_0x360b15,_0x2141be,_0x22ae36){_0x22ae36(null,path[_0xeb18('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5ba720,_0x20c90a,_0x54bd1d){_0x54bd1d(null,util['format'](_0xeb18('0x18'),_0xeb18('0x24'),path['extname'](_0x20c90a[_0xeb18('0x1a')])));}})});router[_0xeb18('0x1b')](_0xeb18('0x25'),upload[_0xeb18('0x1d')](_0xeb18('0x1e')),controller[_0xeb18('0x26')]);var upload=multer({'storage':multer[_0xeb18('0x1f')]({'destination':function(_0x378994,_0x1ae64d,_0x2ca8f0){_0x2ca8f0(null,path[_0xeb18('0x15')](config[_0xeb18('0x16')],_0xeb18('0x17')));},'filename':function(_0x15fdb7,_0x412b94,_0x3c922e){_0x3c922e(null,util['format'](_0xeb18('0x18'),_0xeb18('0x27'),path[_0xeb18('0x22')](_0x412b94[_0xeb18('0x1a')])));}})});router['post']('/:id/favicon',upload[_0xeb18('0x1d')](_0xeb18('0x1e')),controller[_0xeb18('0x28')]);router[_0xeb18('0x29')](_0xeb18('0xc'),auth[_0xeb18('0x2a')](),controller[_0xeb18('0x2b')]);module[_0xeb18('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 85085e0..23b19b1 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x6b11e4,_0x4a58f7){var _0x2b2325=function(_0x18a4d6){while(--_0x18a4d6){_0x6b11e4['push'](_0x6b11e4['shift']());}};_0x2b2325(++_0x4a58f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x22085a,_0x589318){var _0x528c36=function(_0x4bcd66){while(--_0x4bcd66){_0x22085a['push'](_0x22085a['shift']());}};_0x528c36(++_0x589318);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8f8b4b8..bf4c852 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 _0x397b=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','http','request','info','request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Setting','findAll','show','params','keys','body','find','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','default_logo.svg','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultLogo','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x2ecce1,_0x5b7ec9){var _0x3677eb=function(_0x45a6d8){while(--_0x45a6d8){_0x2ecce1['push'](_0x2ecce1['shift']());}};_0x3677eb(++_0x5b7ec9);}(_0x397b,0x168));var _0xb397=function(_0x3364e4,_0x3737fe){_0x3364e4=_0x3364e4-0x0;var _0x3f6057=_0x397b[_0x3364e4];return _0x3f6057;};'use strict';var emlformat=require(_0xb397('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb397('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb397('0x2'));var Mustache=require(_0xb397('0x3'));var util=require(_0xb397('0x4'));var path=require(_0xb397('0x5'));var sox=require('sox');var csv=require(_0xb397('0x6'));var ejs=require(_0xb397('0x7'));var fs=require('fs');var fs_extra=require(_0xb397('0x8'));var _=require('lodash');var squel=require(_0xb397('0x9'));var crypto=require(_0xb397('0xa'));var jsforce=require(_0xb397('0xb'));var deskjs=require(_0xb397('0xc'));var toCsv=require(_0xb397('0x6'));var querystring=require(_0xb397('0xd'));var Papa=require(_0xb397('0xe'));var Redis=require(_0xb397('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb397('0x10'));var as=require(_0xb397('0x11'));var hardwareService=require(_0xb397('0x12'));var logger=require('../../config/logger')(_0xb397('0x13'));var utils=require('../../config/utils');var config=require(_0xb397('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb397('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb397('0x16')][_0xb397('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1a4eae,_0x2a6f09,_0x3a68db,_0x208d9d){return new BPromise(function(_0x777111,_0x194cd6){var _0xd33555=_0x208d9d||client;return _0xd33555[_0xb397('0x18')](_0x1a4eae,_0x3a68db)['then'](function(_0x5dbfe0){logger[_0xb397('0x19')]('Setting,\x20%s,\x20%s',_0x2a6f09,_0xb397('0x1a'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2a6f09,_0xb397('0x1a'),JSON[_0xb397('0x1b')](_0x5dbfe0));if(_0x5dbfe0[_0xb397('0x1c')]){if(_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1d')]===0x1f4){logger[_0xb397('0x1c')]('Setting,\x20%s,\x20%s',_0x2a6f09,_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1e')]);return _0x194cd6(_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1e')]);}logger['error'](_0xb397('0x1f'),_0x2a6f09,_0x5dbfe0[_0xb397('0x1c')]['message']);return _0x777111(_0x5dbfe0[_0xb397('0x1c')][_0xb397('0x1e')]);}else{logger[_0xb397('0x19')](_0xb397('0x1f'),_0x2a6f09,_0xb397('0x1a'));_0x777111(_0x5dbfe0[_0xb397('0x20')]['message']);}})[_0xb397('0x21')](function(_0x3fa61b){logger['error'](_0xb397('0x1f'),_0x2a6f09,_0x3fa61b);_0x194cd6(_0x3fa61b);});});}function respondWithStatusCode(_0x2c24cd,_0x35f18f){_0x35f18f=_0x35f18f||0xcc;return function(_0x39ea24){if(_0x39ea24){return _0x2c24cd[_0xb397('0x22')](_0x35f18f);}return _0x2c24cd[_0xb397('0x23')](_0x35f18f)[_0xb397('0x24')]();};}function respondWithResult(_0x4a8427,_0x2ebc95){_0x2ebc95=_0x2ebc95||0xc8;return function(_0x5ce82d){if(_0x5ce82d){return _0x4a8427['status'](_0x2ebc95)[_0xb397('0x25')](_0x5ce82d);}};}function respondWithFilteredResult(_0x45675c,_0x4e7d77){return function(_0x163c3b){if(_0x163c3b){var _0x11735d=typeof _0x4e7d77['offset']===_0xb397('0x26')&&typeof _0x4e7d77['limit']===_0xb397('0x26');var _0x5c9029=_0x163c3b['count'];var _0x2c4f35=_0x11735d?0x0:_0x4e7d77['offset'];var _0x176f7d=_0x11735d?_0x163c3b[_0xb397('0x27')]:_0x4e7d77[_0xb397('0x28')]+_0x4e7d77[_0xb397('0x29')];var _0x5f00dc;if(_0x176f7d>=_0x5c9029){_0x176f7d=_0x5c9029;_0x5f00dc=0xc8;}else{_0x5f00dc=0xce;}_0x45675c['status'](_0x5f00dc);return _0x45675c[_0xb397('0x2a')](_0xb397('0x2b'),_0x2c4f35+'-'+_0x176f7d+'/'+_0x5c9029)[_0xb397('0x25')](_0x163c3b);}return null;};}function patchUpdates(_0xf8ab15){return function(_0x234bf0){try{jsonpatch[_0xb397('0x2c')](_0x234bf0,_0xf8ab15,!![]);}catch(_0x4cd2da){return BPromise[_0xb397('0x2d')](_0x4cd2da);}return _0x234bf0['save']();};}function saveUpdates(_0x3f3fc3,_0x2d4313){return function(_0x5adda6){if(_0x5adda6){return _0x5adda6[_0xb397('0x2e')](_0x3f3fc3)[_0xb397('0x2f')](function(_0x3affbc){return _0x3affbc;});}return null;};}function removeEntity(_0x4ddacf,_0x3bea4f){return function(_0x43d494){if(_0x43d494){return _0x43d494[_0xb397('0x30')]()['then'](function(){_0x4ddacf[_0xb397('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f78de,_0x5d24ed){return function(_0x4e8940){if(!_0x4e8940){_0x2f78de['sendStatus'](0x194);}return _0x4e8940;};}function handleError(_0x489186,_0x45f1a8){_0x45f1a8=_0x45f1a8||0x1f4;return function(_0x10081f){logger[_0xb397('0x1c')](_0x10081f[_0xb397('0x31')]);if(_0x10081f['name']){delete _0x10081f[_0xb397('0x32')];}_0x489186[_0xb397('0x23')](_0x45f1a8)[_0xb397('0x33')](_0x10081f);};}exports[_0xb397('0x34')]=function(_0x46c2c1,_0x11285c){var _0x4d66ba={},_0x3a9199={},_0x594cad={'count':0x0,'rows':[]};var _0x1b8a8a=_[_0xb397('0x35')](db['Setting'][_0xb397('0x36')],function(_0x5d3feb){return{'name':_0x5d3feb['fieldName'],'type':_0x5d3feb['type'][_0xb397('0x37')]};});_0x3a9199[_0xb397('0x38')]=_['map'](_0x1b8a8a,_0xb397('0x32'));_0x3a9199[_0xb397('0x39')]=_['keys'](_0x46c2c1['query']);_0x3a9199['filters']=_[_0xb397('0x3a')](_0x3a9199['model'],_0x3a9199['query']);_0x4d66ba[_0xb397('0x3b')]=_['intersection'](_0x3a9199[_0xb397('0x38')],qs['fields'](_0x46c2c1[_0xb397('0x39')][_0xb397('0x3c')]));_0x4d66ba[_0xb397('0x3b')]=_0x4d66ba[_0xb397('0x3b')][_0xb397('0x3d')]?_0x4d66ba['attributes']:_0x3a9199[_0xb397('0x38')];if(!_0x46c2c1[_0xb397('0x39')][_0xb397('0x3e')](_0xb397('0x3f'))){_0x4d66ba['limit']=qs['limit'](_0x46c2c1['query'][_0xb397('0x29')]);_0x4d66ba[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x46c2c1[_0xb397('0x39')][_0xb397('0x28')]);}_0x4d66ba[_0xb397('0x40')]=qs[_0xb397('0x41')](_0x46c2c1['query'][_0xb397('0x41')]);_0x4d66ba[_0xb397('0x42')]=qs[_0xb397('0x43')](_[_0xb397('0x44')](_0x46c2c1[_0xb397('0x39')],_0x3a9199[_0xb397('0x43')]),_0x1b8a8a);if(_0x46c2c1[_0xb397('0x39')][_0xb397('0x45')]){_0x4d66ba[_0xb397('0x42')]=_[_0xb397('0x46')](_0x4d66ba[_0xb397('0x42')],{'$or':_[_0xb397('0x35')](_0x1b8a8a,function(_0x91cf01){if(_0x91cf01[_0xb397('0x47')]!==_0xb397('0x48')){var _0x49d5d9={};_0x49d5d9[_0x91cf01['name']]={'$like':'%'+_0x46c2c1[_0xb397('0x39')][_0xb397('0x45')]+'%'};return _0x49d5d9;}})});}_0x4d66ba=_['merge']({},_0x4d66ba,_0x46c2c1[_0xb397('0x49')]);var _0x1adcf4={'where':_0x4d66ba[_0xb397('0x42')]};return db['Setting'][_0xb397('0x27')](_0x1adcf4)['then'](function(_0x14c400){_0x594cad[_0xb397('0x27')]=_0x14c400;if(_0x46c2c1[_0xb397('0x39')][_0xb397('0x4a')]){_0x4d66ba[_0xb397('0x4b')]=[{'all':!![]}];}return db[_0xb397('0x4c')][_0xb397('0x4d')](_0x4d66ba);})['then'](function(_0x530e8c){_0x594cad['rows']=_0x530e8c;return _0x594cad;})[_0xb397('0x2f')](respondWithFilteredResult(_0x11285c,_0x4d66ba))[_0xb397('0x21')](handleError(_0x11285c,null));};exports[_0xb397('0x4e')]=function(_0x339dec,_0x4316ea){var _0x1985c8={'raw':![],'where':{'id':_0x339dec[_0xb397('0x4f')]['id']}},_0xbc262={};_0xbc262[_0xb397('0x38')]=_['keys'](db[_0xb397('0x4c')][_0xb397('0x36')]);_0xbc262[_0xb397('0x39')]=_[_0xb397('0x50')](_0x339dec[_0xb397('0x39')]);_0xbc262[_0xb397('0x43')]=_[_0xb397('0x3a')](_0xbc262[_0xb397('0x38')],_0xbc262[_0xb397('0x39')]);_0x1985c8[_0xb397('0x3b')]=_[_0xb397('0x3a')](_0xbc262['model'],qs[_0xb397('0x3c')](_0x339dec[_0xb397('0x39')][_0xb397('0x3c')]));_0x1985c8[_0xb397('0x3b')]=_0x1985c8[_0xb397('0x3b')][_0xb397('0x3d')]?_0x1985c8[_0xb397('0x3b')]:_0xbc262[_0xb397('0x38')];if(_0x339dec[_0xb397('0x39')][_0xb397('0x4a')]){_0x1985c8[_0xb397('0x4b')]=[{'all':!![]}];}_0x1985c8=_[_0xb397('0x46')]({},_0x1985c8,_0x339dec[_0xb397('0x49')]);return db[_0xb397('0x4c')]['find'](_0x1985c8)[_0xb397('0x2f')](handleEntityNotFound(_0x4316ea,null))['then'](respondWithResult(_0x4316ea,null))[_0xb397('0x21')](handleError(_0x4316ea,null));};exports[_0xb397('0x2e')]=function(_0x2a7957,_0x2b89ee){if(_0x2a7957[_0xb397('0x51')]['id']){delete _0x2a7957['body']['id'];}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x2a7957[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x2b89ee,null))['then'](saveUpdates(_0x2a7957['body'],null))[_0xb397('0x2f')](respondWithResult(_0x2b89ee,null))[_0xb397('0x21')](handleError(_0x2b89ee,null));};exports[_0xb397('0x53')]=function(_0x1d69f9,_0x36104a,_0x2ba41b){if(_0x1d69f9[_0xb397('0x54')]&&_0x1d69f9[_0xb397('0x54')][_0xb397('0x55')]){_0x1d69f9[_0xb397('0x51')]['logo']=_0x1d69f9['file']['filename'];}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x1d69f9[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x36104a,null))[_0xb397('0x2f')](saveUpdates(_0x1d69f9[_0xb397('0x51')],null))[_0xb397('0x2f')](respondWithResult(_0x36104a,null))[_0xb397('0x21')](handleError(_0x36104a,null));};exports['addLogoLogin']=function(_0x1b3af8,_0x4cc78c,_0xcdd38){if(_0x1b3af8[_0xb397('0x54')]&&_0x1b3af8[_0xb397('0x54')][_0xb397('0x55')]){_0x1b3af8[_0xb397('0x51')][_0xb397('0x56')]=_0x1b3af8[_0xb397('0x54')][_0xb397('0x55')];}return db['Setting'][_0xb397('0x52')]({'where':{'id':_0x1b3af8[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x4cc78c,null))['then'](saveUpdates(_0x1b3af8[_0xb397('0x51')],null))[_0xb397('0x2f')](respondWithResult(_0x4cc78c,null))['catch'](handleError(_0x4cc78c,null));};var utilLicense=require(_0xb397('0x57'));exports[_0xb397('0x58')]=function(_0x744ed5,_0x2f1aed,_0x42c636){var _0x4a3e81='server/files/images/logos';var _0x389307={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0x91f1af){if(_0x91f1af){_0x389307=_0x91f1af;}return db['Setting'][_0xb397('0x52')]({'where':{'id':_0x744ed5['params']['id']},'attributes':[_0xb397('0x5a'),_0xb397('0x56'),_0xb397('0x5b'),_0xb397('0x5c'),'defaultLogo',_0xb397('0x5d'),_0xb397('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x2f1aed,null))[_0xb397('0x2f')](function(_0x27b01d){if(_0x27b01d){var _0x14d2aa=_0x27b01d[_0xb397('0x5a')]&&fs[_0xb397('0x5f')](path['join'](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0x27b01d['logo'])))?path['join'](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0x27b01d['logo'])):path[_0xb397('0x62')](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0xb397('0x63')));var _0x3ff864='default'+_[_0xb397('0x64')](_0xb397('0x5a'));if(_0x27b01d[_0x3ff864]||!_0x389307['custom']){_0x14d2aa=path[_0xb397('0x62')](config[_0xb397('0x60')],_0x4a3e81,_[_0xb397('0x61')](_0xb397('0x63')));}if(!fs[_0xb397('0x5f')](_0x14d2aa)){throw new db[(_0xb397('0x65'))][(_0xb397('0x66'))](_[_0xb397('0x64')](_0xb397('0x5a'))+_0xb397('0x67'));}return _0x2f1aed[_0xb397('0x68')](_0x14d2aa);}})[_0xb397('0x21')](handleError(_0x2f1aed,null));};var utilLicense=require('../../config/license/util');exports[_0xb397('0x69')]=function(_0x67e021,_0x126bb1,_0x9b3fe){var _0x3692aa=_0xb397('0x6a');var _0x301a57={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0xa59f7e){if(_0xa59f7e){_0x301a57=_0xa59f7e;}return db[_0xb397('0x4c')]['find']({'where':{'id':_0x67e021[_0xb397('0x4f')]['id']},'attributes':[_0xb397('0x5a'),'loginLogo','preferred',_0xb397('0x5c'),_0xb397('0x6b'),_0xb397('0x5d'),'defaultPreferred',_0xb397('0x6c')],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x126bb1,null))[_0xb397('0x2f')](function(_0x6d3468){if(_0x6d3468){var _0x1d0fde=_0x6d3468[_0xb397('0x56')]&&fs['existsSync'](path[_0xb397('0x62')](config[_0xb397('0x60')],_0x3692aa,_['toLower'](_0x6d3468[_0xb397('0x56')])))?path[_0xb397('0x62')](config[_0xb397('0x60')],_0x3692aa,_[_0xb397('0x61')](_0x6d3468['loginLogo'])):path['join'](config[_0xb397('0x60')],_0x3692aa,_[_0xb397('0x61')](_0xb397('0x6d')));var _0x4b4328='default'+_[_0xb397('0x64')]('loginLogo');if(_0x6d3468[_0x4b4328]||!_0x301a57[_0xb397('0x6e')]){_0x1d0fde=path[_0xb397('0x62')](config[_0xb397('0x60')],_0x3692aa,_[_0xb397('0x61')](_0xb397('0x6d')));}if(!fs['existsSync'](_0x1d0fde)){throw new db[(_0xb397('0x65'))][(_0xb397('0x66'))](_[_0xb397('0x64')](_0xb397('0x56'))+_0xb397('0x67'));}return _0x126bb1[_0xb397('0x68')](_0x1d0fde);}})['catch'](handleError(_0x126bb1,null));};exports[_0xb397('0x6f')]=function(_0x4188d8,_0x2e273b){return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x4188d8['params']['id']},'attributes':[_0xb397('0x70')]})[_0xb397('0x2f')](respondWithResult(_0x2e273b,null))[_0xb397('0x21')](handleError(_0x2e273b,null));};exports[_0xb397('0x71')]=function(_0x344b83,_0x49fa1a,_0x28665b){if(_0x344b83[_0xb397('0x54')]&&_0x344b83[_0xb397('0x54')]['filename']){_0x344b83[_0xb397('0x51')][_0xb397('0x5b')]=_0x344b83[_0xb397('0x54')][_0xb397('0x55')];}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x344b83[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x49fa1a,null))[_0xb397('0x2f')](saveUpdates(_0x344b83['body'],null))[_0xb397('0x2f')](respondWithResult(_0x49fa1a,null))[_0xb397('0x21')](handleError(_0x49fa1a,null));};var utilLicense=require('../../config/license/util');exports[_0xb397('0x72')]=function(_0x4ee7f5,_0x4ccaa3,_0x21acdd){var _0x583142=_0xb397('0x6a');var _0x769395={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0x4423cd){if(_0x4423cd){_0x769395=_0x4423cd;}return db[_0xb397('0x4c')]['find']({'where':{'id':_0x4ee7f5[_0xb397('0x4f')]['id']},'attributes':[_0xb397('0x5a'),_0xb397('0x56'),_0xb397('0x5b'),_0xb397('0x5c'),_0xb397('0x6b'),_0xb397('0x5d'),'defaultPreferred',_0xb397('0x6c')],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x4ccaa3,null))['then'](function(_0x202c28){if(_0x202c28){var _0xf9a3f9=_0x202c28[_0xb397('0x5b')]&&fs[_0xb397('0x5f')](path[_0xb397('0x62')](config['root'],_0x583142,_['toLower'](_0x202c28['preferred'])))?path[_0xb397('0x62')](config[_0xb397('0x60')],_0x583142,_[_0xb397('0x61')](_0x202c28['preferred'])):path[_0xb397('0x62')](config['root'],_0x583142,_[_0xb397('0x61')]('default_preferred.png'));var _0x2ad5f9=_0xb397('0x73')+_[_0xb397('0x64')](_0xb397('0x5b'));if(_0x202c28[_0x2ad5f9]||!_0x769395['custom']||!_0x769395[_0xb397('0x5b')]){_0xf9a3f9=path[_0xb397('0x62')](config[_0xb397('0x60')],_0x583142,_[_0xb397('0x61')](_0xb397('0x74')));}if(!fs['existsSync'](_0xf9a3f9)){throw new db['Sequelize'][(_0xb397('0x66'))](_[_0xb397('0x64')](_0xb397('0x5b'))+_0xb397('0x67'));}return _0x4ccaa3[_0xb397('0x68')](_0xf9a3f9);}})[_0xb397('0x21')](handleError(_0x4ccaa3,null));};exports[_0xb397('0x75')]=function(_0x54e9b8,_0x5e2e9a,_0x2bbddf){if(_0x54e9b8['file']&&_0x54e9b8[_0xb397('0x54')][_0xb397('0x55')]){_0x54e9b8[_0xb397('0x51')]['favicon']=_0x54e9b8[_0xb397('0x54')][_0xb397('0x55')];}return db['Setting'][_0xb397('0x52')]({'where':{'id':_0x54e9b8[_0xb397('0x4f')]['id']}})[_0xb397('0x2f')](handleEntityNotFound(_0x5e2e9a,null))[_0xb397('0x2f')](saveUpdates(_0x54e9b8[_0xb397('0x51')],null))[_0xb397('0x2f')](respondWithResult(_0x5e2e9a,null))[_0xb397('0x21')](handleError(_0x5e2e9a,null));};var utilLicense=require(_0xb397('0x57'));exports[_0xb397('0x76')]=function(_0x3a2ebb,_0x288aac,_0x4de951){var _0xfed19f='server/files/images/logos';var _0x58e301={'custom':![]};return utilLicense[_0xb397('0x59')]()[_0xb397('0x2f')](function(_0x2c52b7){if(_0x2c52b7){_0x58e301=_0x2c52b7;}return db[_0xb397('0x4c')][_0xb397('0x52')]({'where':{'id':_0x3a2ebb[_0xb397('0x4f')]['id']},'attributes':[_0xb397('0x5a'),_0xb397('0x56'),'preferred',_0xb397('0x5c'),_0xb397('0x6b'),_0xb397('0x5d'),_0xb397('0x5e'),_0xb397('0x6c')],'raw':!![]});})[_0xb397('0x2f')](handleEntityNotFound(_0x288aac,null))[_0xb397('0x2f')](function(_0x247d01){if(_0x247d01){var _0x3c73e7=_0x247d01[_0xb397('0x5c')]&&fs[_0xb397('0x5f')](path[_0xb397('0x62')](config[_0xb397('0x60')],_0xfed19f,_[_0xb397('0x61')](_0x247d01[_0xb397('0x5c')])))?path['join'](config[_0xb397('0x60')],_0xfed19f,_[_0xb397('0x61')](_0x247d01['favicon'])):path[_0xb397('0x62')](config[_0xb397('0x60')],_0xfed19f,_['toLower']('default_favicon.ico'));var _0x26ef95=_0xb397('0x73')+_['upperFirst'](_0xb397('0x5c'));if(_0x247d01[_0x26ef95]||!_0x58e301[_0xb397('0x6e')]){_0x3c73e7=path['join'](config[_0xb397('0x60')],_0xfed19f,_[_0xb397('0x61')](_0xb397('0x77')));}if(!fs[_0xb397('0x5f')](_0x3c73e7)){throw new db[(_0xb397('0x65'))][(_0xb397('0x66'))](_['upperFirst'](_0xb397('0x5c'))+_0xb397('0x67'));}return _0x288aac['download'](_0x3c73e7);}})[_0xb397('0x21')](handleError(_0x288aac,null));};exports['getDate']=function(_0x215bd1,_0x4f4d26){var _0x1bd7d1={'offset':moment()[_0xb397('0x78')]()};_0x1bd7d1[_0xb397('0x79')]=moment()['utcOffset'](_0x1bd7d1[_0xb397('0x28')])[_0xb397('0x7a')](_0xb397('0x7b'));return _0x4f4d26[_0xb397('0x23')](0xc8)[_0xb397('0x33')](_0x1bd7d1);}; \ No newline at end of file +var _0xbf04=['apply','save','update','stack','name','send','index','map','rawAttributes','type','key','keys','filters','model','query','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','Setting','includeAll','include','findAll','rows','show','params','length','find','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','logo','root','default_logo.svg','custom','Sequelize','ValidationError','\x20not\x20found','getLicense','default_loginLogo.svg','upperFirst','download','securePassword','addPreferred','defaultLogo','default_preferred.png','getFavicon','default_favicon.ico','default','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','Setting,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x5438a5,_0x29c8ed){var _0x4fedaa=function(_0x3d5c04){while(--_0x3d5c04){_0x5438a5['push'](_0x5438a5['shift']());}};_0x4fedaa(++_0x29c8ed);}(_0xbf04,0xc1));var _0x4bf0=function(_0x4f6ebc,_0x343ffb){_0x4f6ebc=_0x4f6ebc-0x0;var _0x43c18a=_0xbf04[_0x4f6ebc];return _0x43c18a;};'use strict';var emlformat=require(_0x4bf0('0x0'));var rimraf=require(_0x4bf0('0x1'));var zipdir=require(_0x4bf0('0x2'));var jsonpatch=require(_0x4bf0('0x3'));var rp=require('request-promise');var moment=require(_0x4bf0('0x4'));var BPromise=require(_0x4bf0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4bf0('0x6'));var sox=require(_0x4bf0('0x7'));var csv=require('to-csv');var ejs=require(_0x4bf0('0x8'));var fs=require('fs');var fs_extra=require(_0x4bf0('0x9'));var _=require(_0x4bf0('0xa'));var squel=require(_0x4bf0('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bf0('0xc'));var deskjs=require(_0x4bf0('0xd'));var toCsv=require(_0x4bf0('0xe'));var querystring=require(_0x4bf0('0xf'));var Papa=require(_0x4bf0('0x10'));var Redis=require('ioredis');var authService=require(_0x4bf0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4bf0('0x12'));var hardwareService=require(_0x4bf0('0x13'));var logger=require(_0x4bf0('0x14'))(_0x4bf0('0x15'));var utils=require('../../config/utils');var config=require(_0x4bf0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x4bf0('0x17'));var client=jayson[_0x4bf0('0x18')][_0x4bf0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2e3f67,_0x542545,_0x58a47c,_0x4b088f){return new BPromise(function(_0x2cfb14,_0x13a30e){var _0xaa8b5e=_0x4b088f||client;return _0xaa8b5e[_0x4bf0('0x1a')](_0x2e3f67,_0x58a47c)[_0x4bf0('0x1b')](function(_0x2659ad){logger[_0x4bf0('0x1c')]('Setting,\x20%s,\x20%s',_0x542545,_0x4bf0('0x1d'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x542545,_0x4bf0('0x1d'),JSON['stringify'](_0x2659ad));if(_0x2659ad[_0x4bf0('0x1e')]){if(_0x2659ad[_0x4bf0('0x1e')][_0x4bf0('0x1f')]===0x1f4){logger[_0x4bf0('0x1e')](_0x4bf0('0x20'),_0x542545,_0x2659ad[_0x4bf0('0x1e')]['message']);return _0x13a30e(_0x2659ad[_0x4bf0('0x1e')][_0x4bf0('0x21')]);}logger[_0x4bf0('0x1e')]('Setting,\x20%s,\x20%s',_0x542545,_0x2659ad['error'][_0x4bf0('0x21')]);return _0x2cfb14(_0x2659ad['error'][_0x4bf0('0x21')]);}else{logger[_0x4bf0('0x1c')]('Setting,\x20%s,\x20%s',_0x542545,_0x4bf0('0x1d'));_0x2cfb14(_0x2659ad['result']['message']);}})[_0x4bf0('0x22')](function(_0x4f9004){logger[_0x4bf0('0x1e')]('Setting,\x20%s,\x20%s',_0x542545,_0x4f9004);_0x13a30e(_0x4f9004);});});}function respondWithStatusCode(_0x202ad8,_0x40bf5a){_0x40bf5a=_0x40bf5a||0xcc;return function(_0x2ae478){if(_0x2ae478){return _0x202ad8['sendStatus'](_0x40bf5a);}return _0x202ad8[_0x4bf0('0x23')](_0x40bf5a)[_0x4bf0('0x24')]();};}function respondWithResult(_0x83e7ec,_0x28f065){_0x28f065=_0x28f065||0xc8;return function(_0x3f3708){if(_0x3f3708){return _0x83e7ec[_0x4bf0('0x23')](_0x28f065)[_0x4bf0('0x25')](_0x3f3708);}};}function respondWithFilteredResult(_0x150427,_0x2b0c8e){return function(_0x49bb67){if(_0x49bb67){var _0x421663=typeof _0x2b0c8e[_0x4bf0('0x26')]==='undefined'&&typeof _0x2b0c8e[_0x4bf0('0x27')]==='undefined';var _0x2773da=_0x49bb67[_0x4bf0('0x28')];var _0x4de014=_0x421663?0x0:_0x2b0c8e[_0x4bf0('0x26')];var _0x43d2d3=_0x421663?_0x49bb67['count']:_0x2b0c8e['offset']+_0x2b0c8e['limit'];var _0x332a66;if(_0x43d2d3>=_0x2773da){_0x43d2d3=_0x2773da;_0x332a66=0xc8;}else{_0x332a66=0xce;}_0x150427[_0x4bf0('0x23')](_0x332a66);return _0x150427[_0x4bf0('0x29')](_0x4bf0('0x2a'),_0x4de014+'-'+_0x43d2d3+'/'+_0x2773da)[_0x4bf0('0x25')](_0x49bb67);}return null;};}function patchUpdates(_0x443fac){return function(_0x7799a7){try{jsonpatch[_0x4bf0('0x2b')](_0x7799a7,_0x443fac,!![]);}catch(_0x3cc049){return BPromise['reject'](_0x3cc049);}return _0x7799a7[_0x4bf0('0x2c')]();};}function saveUpdates(_0x1868e4,_0x3d583d){return function(_0x1fae0f){if(_0x1fae0f){return _0x1fae0f[_0x4bf0('0x2d')](_0x1868e4)['then'](function(_0xb4f415){return _0xb4f415;});}return null;};}function removeEntity(_0x2102c9,_0x1cdbf3){return function(_0x2c009a){if(_0x2c009a){return _0x2c009a['destroy']()[_0x4bf0('0x1b')](function(){_0x2102c9[_0x4bf0('0x23')](0xcc)[_0x4bf0('0x24')]();});}};}function handleEntityNotFound(_0x22ad76,_0x53ab7f){return function(_0x4af327){if(!_0x4af327){_0x22ad76['sendStatus'](0x194);}return _0x4af327;};}function handleError(_0x43b2c6,_0x23306f){_0x23306f=_0x23306f||0x1f4;return function(_0x3cdf5f){logger[_0x4bf0('0x1e')](_0x3cdf5f[_0x4bf0('0x2e')]);if(_0x3cdf5f[_0x4bf0('0x2f')]){delete _0x3cdf5f[_0x4bf0('0x2f')];}_0x43b2c6['status'](_0x23306f)[_0x4bf0('0x30')](_0x3cdf5f);};}exports[_0x4bf0('0x31')]=function(_0x3630bc,_0x2853f8){var _0x5b7a0={},_0x5390b0={},_0x2c9fd1={'count':0x0,'rows':[]};var _0x33a207=_[_0x4bf0('0x32')](db['Setting'][_0x4bf0('0x33')],function(_0x2ba575){return{'name':_0x2ba575['fieldName'],'type':_0x2ba575[_0x4bf0('0x34')][_0x4bf0('0x35')]};});_0x5390b0['model']=_[_0x4bf0('0x32')](_0x33a207,'name');_0x5390b0['query']=_[_0x4bf0('0x36')](_0x3630bc['query']);_0x5390b0[_0x4bf0('0x37')]=_['intersection'](_0x5390b0[_0x4bf0('0x38')],_0x5390b0[_0x4bf0('0x39')]);_0x5b7a0[_0x4bf0('0x3a')]=_[_0x4bf0('0x3b')](_0x5390b0['model'],qs[_0x4bf0('0x3c')](_0x3630bc['query']['fields']));_0x5b7a0[_0x4bf0('0x3a')]=_0x5b7a0[_0x4bf0('0x3a')]['length']?_0x5b7a0[_0x4bf0('0x3a')]:_0x5390b0[_0x4bf0('0x38')];if(!_0x3630bc['query'][_0x4bf0('0x3d')]('nolimit')){_0x5b7a0[_0x4bf0('0x27')]=qs[_0x4bf0('0x27')](_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x27')]);_0x5b7a0[_0x4bf0('0x26')]=qs['offset'](_0x3630bc['query']['offset']);}_0x5b7a0[_0x4bf0('0x3e')]=qs['sort'](_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x3f')]);_0x5b7a0['where']=qs[_0x4bf0('0x37')](_['pick'](_0x3630bc[_0x4bf0('0x39')],_0x5390b0[_0x4bf0('0x37')]),_0x33a207);if(_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x40')]){_0x5b7a0[_0x4bf0('0x41')]=_[_0x4bf0('0x42')](_0x5b7a0[_0x4bf0('0x41')],{'$or':_[_0x4bf0('0x32')](_0x33a207,function(_0x90ff62){if(_0x90ff62[_0x4bf0('0x34')]!==_0x4bf0('0x43')){var _0x5e65b5={};_0x5e65b5[_0x90ff62[_0x4bf0('0x2f')]]={'$like':'%'+_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x40')]+'%'};return _0x5e65b5;}})});}_0x5b7a0=_[_0x4bf0('0x42')]({},_0x5b7a0,_0x3630bc[_0x4bf0('0x44')]);var _0xd787cc={'where':_0x5b7a0[_0x4bf0('0x41')]};return db[_0x4bf0('0x45')][_0x4bf0('0x28')](_0xd787cc)[_0x4bf0('0x1b')](function(_0x567d6d){_0x2c9fd1[_0x4bf0('0x28')]=_0x567d6d;if(_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x46')]){_0x5b7a0[_0x4bf0('0x47')]=[{'all':!![]}];}return db[_0x4bf0('0x45')][_0x4bf0('0x48')](_0x5b7a0);})[_0x4bf0('0x1b')](function(_0x5c5157){_0x2c9fd1[_0x4bf0('0x49')]=_0x5c5157;return _0x2c9fd1;})['then'](respondWithFilteredResult(_0x2853f8,_0x5b7a0))[_0x4bf0('0x22')](handleError(_0x2853f8,null));};exports[_0x4bf0('0x4a')]=function(_0x2561d8,_0x24dfd0){var _0x52dc0={'raw':![],'where':{'id':_0x2561d8[_0x4bf0('0x4b')]['id']}},_0x52f650={};_0x52f650['model']=_[_0x4bf0('0x36')](db[_0x4bf0('0x45')][_0x4bf0('0x33')]);_0x52f650[_0x4bf0('0x39')]=_[_0x4bf0('0x36')](_0x2561d8[_0x4bf0('0x39')]);_0x52f650['filters']=_['intersection'](_0x52f650[_0x4bf0('0x38')],_0x52f650[_0x4bf0('0x39')]);_0x52dc0[_0x4bf0('0x3a')]=_[_0x4bf0('0x3b')](_0x52f650[_0x4bf0('0x38')],qs['fields'](_0x2561d8['query'][_0x4bf0('0x3c')]));_0x52dc0['attributes']=_0x52dc0[_0x4bf0('0x3a')][_0x4bf0('0x4c')]?_0x52dc0[_0x4bf0('0x3a')]:_0x52f650[_0x4bf0('0x38')];if(_0x2561d8[_0x4bf0('0x39')][_0x4bf0('0x46')]){_0x52dc0[_0x4bf0('0x47')]=[{'all':!![]}];}_0x52dc0=_[_0x4bf0('0x42')]({},_0x52dc0,_0x2561d8['options']);return db[_0x4bf0('0x45')][_0x4bf0('0x4d')](_0x52dc0)[_0x4bf0('0x1b')](handleEntityNotFound(_0x24dfd0,null))[_0x4bf0('0x1b')](respondWithResult(_0x24dfd0,null))[_0x4bf0('0x22')](handleError(_0x24dfd0,null));};exports[_0x4bf0('0x2d')]=function(_0x443f46,_0x9df00d){if(_0x443f46[_0x4bf0('0x4e')]['id']){delete _0x443f46['body']['id'];}return db[_0x4bf0('0x45')]['find']({'where':{'id':_0x443f46[_0x4bf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x9df00d,null))[_0x4bf0('0x1b')](saveUpdates(_0x443f46['body'],null))[_0x4bf0('0x1b')](respondWithResult(_0x9df00d,null))[_0x4bf0('0x22')](handleError(_0x9df00d,null));};exports[_0x4bf0('0x4f')]=function(_0x311ad4,_0x143e0d,_0x5ab35c){if(_0x311ad4['file']&&_0x311ad4[_0x4bf0('0x50')]['filename']){_0x311ad4[_0x4bf0('0x4e')]['logo']=_0x311ad4['file'][_0x4bf0('0x51')];}return db['Setting']['find']({'where':{'id':_0x311ad4[_0x4bf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x143e0d,null))[_0x4bf0('0x1b')](saveUpdates(_0x311ad4[_0x4bf0('0x4e')],null))['then'](respondWithResult(_0x143e0d,null))['catch'](handleError(_0x143e0d,null));};exports[_0x4bf0('0x52')]=function(_0x476310,_0xbf04f7,_0x58c1b8){if(_0x476310[_0x4bf0('0x50')]&&_0x476310[_0x4bf0('0x50')][_0x4bf0('0x51')]){_0x476310['body'][_0x4bf0('0x53')]=_0x476310[_0x4bf0('0x50')][_0x4bf0('0x51')];}return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x476310[_0x4bf0('0x4b')]['id']}})[_0x4bf0('0x1b')](handleEntityNotFound(_0xbf04f7,null))[_0x4bf0('0x1b')](saveUpdates(_0x476310['body'],null))['then'](respondWithResult(_0xbf04f7,null))[_0x4bf0('0x22')](handleError(_0xbf04f7,null));};var utilLicense=require(_0x4bf0('0x54'));exports[_0x4bf0('0x55')]=function(_0x2bb0e8,_0x11a0aa,_0x57b422){var _0x164288=_0x4bf0('0x56');var _0x44a785={'custom':![]};return utilLicense['getLicense']()[_0x4bf0('0x1b')](function(_0x13a432){if(_0x13a432){_0x44a785=_0x13a432;}return db['Setting'][_0x4bf0('0x4d')]({'where':{'id':_0x2bb0e8[_0x4bf0('0x4b')]['id']},'attributes':['logo',_0x4bf0('0x53'),_0x4bf0('0x57'),_0x4bf0('0x58'),'defaultLogo',_0x4bf0('0x59'),_0x4bf0('0x5a'),_0x4bf0('0x5b')],'raw':!![]});})[_0x4bf0('0x1b')](handleEntityNotFound(_0x11a0aa,null))[_0x4bf0('0x1b')](function(_0x13a375){if(_0x13a375){var _0x51f393=_0x13a375['logo']&&fs[_0x4bf0('0x5c')](path[_0x4bf0('0x5d')](config['root'],_0x164288,_[_0x4bf0('0x5e')](_0x13a375[_0x4bf0('0x5f')])))?path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x164288,_[_0x4bf0('0x5e')](_0x13a375[_0x4bf0('0x5f')])):path[_0x4bf0('0x5d')](config['root'],_0x164288,_[_0x4bf0('0x5e')](_0x4bf0('0x61')));var _0x45b661='default'+_['upperFirst']('logo');if(_0x13a375[_0x45b661]||!_0x44a785[_0x4bf0('0x62')]){_0x51f393=path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x164288,_['toLower'](_0x4bf0('0x61')));}if(!fs[_0x4bf0('0x5c')](_0x51f393)){throw new db[(_0x4bf0('0x63'))][(_0x4bf0('0x64'))](_['upperFirst'](_0x4bf0('0x5f'))+_0x4bf0('0x65'));}return _0x11a0aa['download'](_0x51f393);}})[_0x4bf0('0x22')](handleError(_0x11a0aa,null));};var utilLicense=require(_0x4bf0('0x54'));exports['getLogoLogin']=function(_0x27d88d,_0x20319b,_0x24a0ba){var _0x5b9d4a=_0x4bf0('0x56');var _0x40fe20={'custom':![]};return utilLicense[_0x4bf0('0x66')]()['then'](function(_0x22fea4){if(_0x22fea4){_0x40fe20=_0x22fea4;}return db['Setting']['find']({'where':{'id':_0x27d88d['params']['id']},'attributes':['logo',_0x4bf0('0x53'),_0x4bf0('0x57'),'favicon','defaultLogo',_0x4bf0('0x59'),_0x4bf0('0x5a'),_0x4bf0('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x20319b,null))[_0x4bf0('0x1b')](function(_0x2d29f3){if(_0x2d29f3){var _0x42db29=_0x2d29f3[_0x4bf0('0x53')]&&fs['existsSync'](path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_[_0x4bf0('0x5e')](_0x2d29f3[_0x4bf0('0x53')])))?path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_['toLower'](_0x2d29f3['loginLogo'])):path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_[_0x4bf0('0x5e')](_0x4bf0('0x67')));var _0x1474d4='default'+_[_0x4bf0('0x68')](_0x4bf0('0x53'));if(_0x2d29f3[_0x1474d4]||!_0x40fe20['custom']){_0x42db29=path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_[_0x4bf0('0x5e')]('default_loginLogo.svg'));}if(!fs[_0x4bf0('0x5c')](_0x42db29)){throw new db['Sequelize'][(_0x4bf0('0x64'))](_[_0x4bf0('0x68')]('loginLogo')+_0x4bf0('0x65'));}return _0x20319b[_0x4bf0('0x69')](_0x42db29);}})[_0x4bf0('0x22')](handleError(_0x20319b,null));};exports['gdpr']=function(_0x398117,_0x4a622f){return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x398117['params']['id']},'attributes':[_0x4bf0('0x6a')]})[_0x4bf0('0x1b')](respondWithResult(_0x4a622f,null))[_0x4bf0('0x22')](handleError(_0x4a622f,null));};exports[_0x4bf0('0x6b')]=function(_0x7cfbfc,_0x4f43a9,_0x12d1fa){if(_0x7cfbfc[_0x4bf0('0x50')]&&_0x7cfbfc[_0x4bf0('0x50')][_0x4bf0('0x51')]){_0x7cfbfc[_0x4bf0('0x4e')][_0x4bf0('0x57')]=_0x7cfbfc[_0x4bf0('0x50')][_0x4bf0('0x51')];}return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x7cfbfc[_0x4bf0('0x4b')]['id']}})[_0x4bf0('0x1b')](handleEntityNotFound(_0x4f43a9,null))['then'](saveUpdates(_0x7cfbfc[_0x4bf0('0x4e')],null))[_0x4bf0('0x1b')](respondWithResult(_0x4f43a9,null))['catch'](handleError(_0x4f43a9,null));};var utilLicense=require(_0x4bf0('0x54'));exports['getPreferred']=function(_0x23fa18,_0x4120cd,_0x432c02){var _0x2719c7='server/files/images/logos';var _0x149a8e={'custom':![]};return utilLicense[_0x4bf0('0x66')]()[_0x4bf0('0x1b')](function(_0x1db4ae){if(_0x1db4ae){_0x149a8e=_0x1db4ae;}return db[_0x4bf0('0x45')]['find']({'where':{'id':_0x23fa18[_0x4bf0('0x4b')]['id']},'attributes':[_0x4bf0('0x5f'),_0x4bf0('0x53'),_0x4bf0('0x57'),_0x4bf0('0x58'),_0x4bf0('0x6c'),_0x4bf0('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4bf0('0x1b')](handleEntityNotFound(_0x4120cd,null))[_0x4bf0('0x1b')](function(_0x291bc0){if(_0x291bc0){var _0x57c3f2=_0x291bc0[_0x4bf0('0x57')]&&fs['existsSync'](path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_[_0x4bf0('0x5e')](_0x291bc0[_0x4bf0('0x57')])))?path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_['toLower'](_0x291bc0[_0x4bf0('0x57')])):path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_[_0x4bf0('0x5e')](_0x4bf0('0x6d')));var _0x2073e0='default'+_[_0x4bf0('0x68')](_0x4bf0('0x57'));if(_0x291bc0[_0x2073e0]||!_0x149a8e[_0x4bf0('0x62')]||!_0x149a8e['preferred']){_0x57c3f2=path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_['toLower']('default_preferred.png'));}if(!fs[_0x4bf0('0x5c')](_0x57c3f2)){throw new db[(_0x4bf0('0x63'))]['ValidationError'](_['upperFirst']('preferred')+_0x4bf0('0x65'));}return _0x4120cd[_0x4bf0('0x69')](_0x57c3f2);}})[_0x4bf0('0x22')](handleError(_0x4120cd,null));};exports['addFavicon']=function(_0x3a7667,_0x1e8976,_0x47c8fe){if(_0x3a7667[_0x4bf0('0x50')]&&_0x3a7667[_0x4bf0('0x50')]['filename']){_0x3a7667[_0x4bf0('0x4e')][_0x4bf0('0x58')]=_0x3a7667[_0x4bf0('0x50')][_0x4bf0('0x51')];}return db['Setting']['find']({'where':{'id':_0x3a7667['params']['id']}})[_0x4bf0('0x1b')](handleEntityNotFound(_0x1e8976,null))[_0x4bf0('0x1b')](saveUpdates(_0x3a7667['body'],null))[_0x4bf0('0x1b')](respondWithResult(_0x1e8976,null))[_0x4bf0('0x22')](handleError(_0x1e8976,null));};var utilLicense=require(_0x4bf0('0x54'));exports[_0x4bf0('0x6e')]=function(_0x3b4de3,_0x597c78,_0x530ee2){var _0x45aaf1=_0x4bf0('0x56');var _0x47d63b={'custom':![]};return utilLicense[_0x4bf0('0x66')]()['then'](function(_0x24b081){if(_0x24b081){_0x47d63b=_0x24b081;}return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x3b4de3['params']['id']},'attributes':[_0x4bf0('0x5f'),_0x4bf0('0x53'),_0x4bf0('0x57'),'favicon',_0x4bf0('0x6c'),_0x4bf0('0x59'),_0x4bf0('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x4bf0('0x1b')](handleEntityNotFound(_0x597c78,null))[_0x4bf0('0x1b')](function(_0x1d2b47){if(_0x1d2b47){var _0xd41f08=_0x1d2b47[_0x4bf0('0x58')]&&fs[_0x4bf0('0x5c')](path['join'](config[_0x4bf0('0x60')],_0x45aaf1,_['toLower'](_0x1d2b47['favicon'])))?path['join'](config['root'],_0x45aaf1,_[_0x4bf0('0x5e')](_0x1d2b47[_0x4bf0('0x58')])):path['join'](config[_0x4bf0('0x60')],_0x45aaf1,_[_0x4bf0('0x5e')](_0x4bf0('0x6f')));var _0x5e166a=_0x4bf0('0x70')+_[_0x4bf0('0x68')]('favicon');if(_0x1d2b47[_0x5e166a]||!_0x47d63b[_0x4bf0('0x62')]){_0xd41f08=path[_0x4bf0('0x5d')](config['root'],_0x45aaf1,_[_0x4bf0('0x5e')](_0x4bf0('0x6f')));}if(!fs[_0x4bf0('0x5c')](_0xd41f08)){throw new db[(_0x4bf0('0x63'))]['ValidationError'](_['upperFirst'](_0x4bf0('0x58'))+'\x20not\x20found');}return _0x597c78[_0x4bf0('0x69')](_0xd41f08);}})['catch'](handleError(_0x597c78,null));};exports[_0x4bf0('0x71')]=function(_0x9b8f85,_0xb46d0){var _0x5c37fa={'offset':moment()['utcOffset']()};_0x5c37fa[_0x4bf0('0x72')]=moment()[_0x4bf0('0x73')](_0x5c37fa[_0x4bf0('0x26')])[_0x4bf0('0x74')](_0x4bf0('0x75'));return _0xb46d0[_0x4bf0('0x23')](0xc8)[_0x4bf0('0x30')](_0x5c37fa);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ff909f7..e9cf535 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x4143ee,_0x10af5a){var _0x527c77=function(_0xd60ed9){while(--_0xd60ed9){_0x4143ee['push'](_0x4143ee['shift']());}};_0x527c77(++_0x10af5a);}(_0xe14b,0x93));var _0xbe14=function(_0x2913be,_0x3771dc){_0x2913be=_0x2913be-0x0;var _0x1ac74c=_0xe14b[_0x2913be];return _0x1ac74c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x402048,_0x217130){var _0x4340fd=function(_0x134916){while(--_0x134916){_0x402048['push'](_0x402048['shift']());}};_0x4340fd(++_0x217130);}(_0xedd9,0xfc));var _0x9edd=function(_0x5554da,_0x6cc7fc){_0x5554da=_0x5554da-0x0;var _0x447f56=_0xedd9[_0x5554da];return _0x447f56;};'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 5c68320..46a503a 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 _0xdbd5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','where','attributes','map','include','model','lodash','moment'];(function(_0x5631a8,_0x2ff3ab){var _0x1a4293=function(_0x28f304){while(--_0x28f304){_0x5631a8['push'](_0x5631a8['shift']());}};_0x1a4293(++_0x2ff3ab);}(_0xdbd5,0xb2));var _0x5dbd=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xdbd5[_0xb725be];return _0x2f2424;};'use strict';var _=require(_0x5dbd('0x0'));var util=require('util');var moment=require(_0x5dbd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dbd('0x2'));var db=require(_0x5dbd('0x3'))['db'];var utils=require(_0x5dbd('0x4'));var logger=require(_0x5dbd('0x5'))(_0x5dbd('0x6'));var config=require(_0x5dbd('0x7'));var jayson=require(_0x5dbd('0x8'));var client=jayson['client'][_0x5dbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b7e7e,_0x2bbf58,_0x210053){return new BPromise(function(_0xe7073e,_0x44c14c){return client[_0x5dbd('0xa')](_0x5b7e7e,_0x210053)[_0x5dbd('0xb')](function(_0x44c8d7){logger[_0x5dbd('0xc')](_0x5dbd('0xd'),_0x2bbf58,_0x5dbd('0xe'));logger['debug'](_0x5dbd('0xf'),_0x2bbf58,'request\x20sent',JSON[_0x5dbd('0x10')](_0x44c8d7));if(_0x44c8d7[_0x5dbd('0x11')]){if(_0x44c8d7['error']['code']===0x1f4){logger[_0x5dbd('0x11')]('Setting,\x20%s,\x20%s',_0x2bbf58,_0x44c8d7['error'][_0x5dbd('0x12')]);return _0x44c14c(_0x44c8d7['error']['message']);}logger[_0x5dbd('0x11')]('Setting,\x20%s,\x20%s',_0x2bbf58,_0x44c8d7['error'][_0x5dbd('0x12')]);return _0xe7073e(_0x44c8d7[_0x5dbd('0x11')]['message']);}else{logger[_0x5dbd('0xc')](_0x5dbd('0xd'),_0x2bbf58,_0x5dbd('0xe'));_0xe7073e(_0x44c8d7[_0x5dbd('0x13')][_0x5dbd('0x12')]);}})[_0x5dbd('0x14')](function(_0x576501){logger[_0x5dbd('0x11')]('Setting,\x20%s,\x20%s',_0x2bbf58,_0x576501);_0x44c14c(_0x576501);});});}exports[_0x5dbd('0x15')]=function(_0x4e66e7){var _0x41df4d=this;return new Promise(function(_0x2a2573,_0xc26627){return db[_0x5dbd('0x16')][_0x5dbd('0x17')]({'raw':_0x4e66e7[_0x5dbd('0x18')]?_0x4e66e7[_0x5dbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4e66e7[_0x5dbd('0x18')]?_0x4e66e7[_0x5dbd('0x18')][_0x5dbd('0x19')]||null:null,'attributes':_0x4e66e7['options']?_0x4e66e7[_0x5dbd('0x18')][_0x5dbd('0x1a')]||null:null,'include':_0x4e66e7[_0x5dbd('0x18')]?_0x4e66e7[_0x5dbd('0x18')]['include']?_[_0x5dbd('0x1b')](_0x4e66e7[_0x5dbd('0x18')][_0x5dbd('0x1c')],function(_0x2d89e1){return{'model':db[_0x2d89e1[_0x5dbd('0x1d')]],'as':_0x2d89e1['as'],'attributes':_0x2d89e1[_0x5dbd('0x1a')],'include':_0x2d89e1[_0x5dbd('0x1c')]?_[_0x5dbd('0x1b')](_0x2d89e1[_0x5dbd('0x1c')],function(_0x4751cd){return{'model':db[_0x4751cd[_0x5dbd('0x1d')]],'as':_0x4751cd['as'],'attributes':_0x4751cd['attributes'],'include':_0x4751cd[_0x5dbd('0x1c')]?_[_0x5dbd('0x1b')](_0x4751cd['include'],function(_0x1872f6){return{'model':db[_0x1872f6[_0x5dbd('0x1d')]],'as':_0x1872f6['as'],'attributes':_0x1872f6[_0x5dbd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5dbd('0xb')](function(_0x4addf8){logger[_0x5dbd('0xc')](_0x5dbd('0x15'),_0x4e66e7);logger['debug'](_0x5dbd('0x15'),_0x4e66e7,JSON['stringify'](_0x4addf8));_0x2a2573(_0x4addf8);})['catch'](function(_0x255ed6){logger['error'](_0x5dbd('0x15'),_0x255ed6['message'],_0x4e66e7);_0xc26627(_0x41df4d['error'](0x1f4,_0x255ed6[_0x5dbd('0x12')]));});});}; \ No newline at end of file +var _0x847d=['http','then','info','request\x20sent','debug','stringify','error','Setting,\x20%s,\x20%s','message','catch','ShowSetting','Setting','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x847d,0x13f));var _0xd847=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x847d[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xd847('0x0'));var util=require(_0xd847('0x1'));var moment=require(_0xd847('0x2'));var BPromise=require(_0xd847('0x3'));var rs=require(_0xd847('0x4'));var fs=require('fs');var Redis=require(_0xd847('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x6'));var logger=require(_0xd847('0x7'))('rpc');var config=require(_0xd847('0x8'));var jayson=require(_0xd847('0x9'));var client=jayson[_0xd847('0xa')][_0xd847('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x398936,_0x2ea586,_0x1c6fd3){return new BPromise(function(_0x1083e2,_0x5bc1e0){return client['request'](_0x398936,_0x1c6fd3)[_0xd847('0xc')](function(_0x28ec4f){logger[_0xd847('0xd')]('Setting,\x20%s,\x20%s',_0x2ea586,_0xd847('0xe'));logger[_0xd847('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x2ea586,_0xd847('0xe'),JSON[_0xd847('0x10')](_0x28ec4f));if(_0x28ec4f[_0xd847('0x11')]){if(_0x28ec4f[_0xd847('0x11')]['code']===0x1f4){logger['error'](_0xd847('0x12'),_0x2ea586,_0x28ec4f[_0xd847('0x11')]['message']);return _0x5bc1e0(_0x28ec4f[_0xd847('0x11')][_0xd847('0x13')]);}logger[_0xd847('0x11')](_0xd847('0x12'),_0x2ea586,_0x28ec4f[_0xd847('0x11')]['message']);return _0x1083e2(_0x28ec4f[_0xd847('0x11')][_0xd847('0x13')]);}else{logger[_0xd847('0xd')](_0xd847('0x12'),_0x2ea586,'request\x20sent');_0x1083e2(_0x28ec4f['result'][_0xd847('0x13')]);}})[_0xd847('0x14')](function(_0x1e30db){logger[_0xd847('0x11')](_0xd847('0x12'),_0x2ea586,_0x1e30db);_0x5bc1e0(_0x1e30db);});});}exports[_0xd847('0x15')]=function(_0x335cd2){var _0x34cdcc=this;return new Promise(function(_0x15ce0e,_0x6f368f){return db[_0xd847('0x16')]['find']({'raw':_0x335cd2['options']?_0x335cd2[_0xd847('0x17')][_0xd847('0x18')]===undefined?!![]:![]:!![],'where':_0x335cd2[_0xd847('0x17')]?_0x335cd2['options'][_0xd847('0x19')]||null:null,'attributes':_0x335cd2[_0xd847('0x17')]?_0x335cd2[_0xd847('0x17')][_0xd847('0x1a')]||null:null,'include':_0x335cd2['options']?_0x335cd2['options'][_0xd847('0x1b')]?_['map'](_0x335cd2[_0xd847('0x17')][_0xd847('0x1b')],function(_0x58ef64){return{'model':db[_0x58ef64[_0xd847('0x1c')]],'as':_0x58ef64['as'],'attributes':_0x58ef64['attributes'],'include':_0x58ef64['include']?_[_0xd847('0x1d')](_0x58ef64[_0xd847('0x1b')],function(_0x5bc130){return{'model':db[_0x5bc130[_0xd847('0x1c')]],'as':_0x5bc130['as'],'attributes':_0x5bc130['attributes'],'include':_0x5bc130[_0xd847('0x1b')]?_['map'](_0x5bc130[_0xd847('0x1b')],function(_0x65f475){return{'model':db[_0x65f475[_0xd847('0x1c')]],'as':_0x65f475['as'],'attributes':_0x65f475[_0xd847('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa72027){logger[_0xd847('0xd')]('ShowSetting',_0x335cd2);logger[_0xd847('0xf')](_0xd847('0x15'),_0x335cd2,JSON[_0xd847('0x10')](_0xa72027));_0x15ce0e(_0xa72027);})[_0xd847('0x14')](function(_0x78b2a1){logger[_0xd847('0x11')](_0xd847('0x15'),_0x78b2a1[_0xd847('0x13')],_0x335cd2);_0x6f368f(_0x34cdcc['error'](0x1f4,_0x78b2a1[_0xd847('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3910bd1..30f9092 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(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_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('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 _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x5f480f,_0x5807c9){var _0x34a4b0=function(_0x43f256){while(--_0x43f256){_0x5f480f['push'](_0x5f480f['shift']());}};_0x34a4b0(++_0x5807c9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x34246b,_0x1d5f54){_0x34246b=_0x34246b-0x0;var _0x314402=_0x7fbe[_0x34246b];return _0x314402;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 787a004..5d30dac 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 _0x8eb7=['skebby','connectel','clicksend','plivo','infobip','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x8eb7,0xa4));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));var rs=require(_0x78eb('0x1'));module[_0x78eb('0x2')]={'name':{'type':Sequelize[_0x78eb('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x78eb('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x78eb('0x3')],'defaultValue':function(){return rs[_0x78eb('0x4')]();}},'phone':{'type':Sequelize[_0x78eb('0x3')]},'type':{'type':Sequelize[_0x78eb('0x5')]('twilio',_0x78eb('0x6'),_0x78eb('0x7'),_0x78eb('0x8'),_0x78eb('0x9'),'clickatell','bandwidth','csc',_0x78eb('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x78eb('0x3')]},'authId':{'type':Sequelize[_0x78eb('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x78eb('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x78eb('0x3')]},'password':{'type':Sequelize[_0x78eb('0x3')]},'apiKey':{'type':Sequelize[_0x78eb('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x78eb('0x3')]},'senderString':{'type':Sequelize[_0x78eb('0x3')]},'deliveryReport':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x78eb('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[_0x78eb('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x78eb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x78eb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x78eb('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x78eb('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x78eb('0xb')],'defaultValue':![],'comment':_0x78eb('0xd'),'set':function(_0x4f2f4a){if(!_0x4f2f4a)this[_0x78eb('0xe')](_0x78eb('0xf'),null);this[_0x78eb('0xe')](_0x78eb('0x10'),_0x4f2f4a);}}}; \ No newline at end of file +var _0xea50=['generate','ENUM','connectel','clicksend','plivo','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xea50,0x100));var _0x0ea5=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0xea50[_0x2dbcef];return _0x5a90ea;};'use strict';var Sequelize=require(_0x0ea5('0x0'));var rs=require(_0x0ea5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0ea5('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0ea5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0ea5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0ea5('0x3')],'defaultValue':function(){return rs[_0x0ea5('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0ea5('0x5')]('twilio','skebby',_0x0ea5('0x6'),_0x0ea5('0x7'),_0x0ea5('0x8'),'clickatell',_0x0ea5('0x9'),'csc',_0x0ea5('0xa'),_0x0ea5('0xb'))},'accountSid':{'type':Sequelize[_0x0ea5('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x0ea5('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0ea5('0x3')]},'apiKey':{'type':Sequelize[_0x0ea5('0x3')]},'applicationId':{'type':Sequelize[_0x0ea5('0x3')]},'accountId':{'type':Sequelize[_0x0ea5('0x3')]},'senderString':{'type':Sequelize[_0x0ea5('0x3')]},'deliveryReport':{'type':Sequelize[_0x0ea5('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0ea5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0ea5('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0ea5('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0ea5('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0ea5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0ea5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0ea5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0ea5('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ea5('0xe')],'comment':_0x0ea5('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x0ea5('0xc')],'defaultValue':![],'comment':_0x0ea5('0x10'),'set':function(_0x561414){if(!_0x561414)this[_0x0ea5('0x11')](_0x0ea5('0x12'),null);this[_0x0ea5('0x11')](_0x0ea5('0x13'),_0x561414);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6dbcb02..cb4811b 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 _0x56a5=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','messageId','MessageSid','skebby','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','Start','startRouting','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra'];(function(_0x310024,_0xcf27a8){var _0x259db4=function(_0x542313){while(--_0x542313){_0x310024['push'](_0x310024['shift']());}};_0x259db4(++_0xcf27a8);}(_0x56a5,0x1ce));var _0x556a=function(_0x1b7f17,_0x54411f){_0x1b7f17=_0x1b7f17-0x0;var _0x454a80=_0x56a5[_0x1b7f17];return _0x454a80;};'use strict';var emlformat=require(_0x556a('0x0'));var rimraf=require(_0x556a('0x1'));var zipdir=require(_0x556a('0x2'));var jsonpatch=require(_0x556a('0x3'));var rp=require(_0x556a('0x4'));var moment=require(_0x556a('0x5'));var BPromise=require(_0x556a('0x6'));var Mustache=require(_0x556a('0x7'));var util=require('util');var path=require(_0x556a('0x8'));var sox=require(_0x556a('0x9'));var csv=require('to-csv');var ejs=require(_0x556a('0xa'));var fs=require('fs');var fs_extra=require(_0x556a('0xb'));var _=require(_0x556a('0xc'));var squel=require(_0x556a('0xd'));var crypto=require(_0x556a('0xe'));var jsforce=require(_0x556a('0xf'));var deskjs=require(_0x556a('0x10'));var toCsv=require(_0x556a('0x11'));var querystring=require(_0x556a('0x12'));var Papa=require('papaparse');var Redis=require(_0x556a('0x13'));var authService=require(_0x556a('0x14'));var qs=require(_0x556a('0x15'));var as=require(_0x556a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x556a('0x17'));var utils=require(_0x556a('0x18'));var config=require(_0x556a('0x19'));var licenseUtil=require(_0x556a('0x1a'));var db=require(_0x556a('0x1b'))['db'];config[_0x556a('0x1c')]=_[_0x556a('0x1d')](config[_0x556a('0x1c')],{'host':_0x556a('0x1e'),'port':0x18eb});var socket=require(_0x556a('0x1f'))(new Redis(config['redis']));require(_0x556a('0x20'))[_0x556a('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x556a('0x22')][_0x556a('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x249a81,_0x519e5a,_0xb8d1d2,_0xf24268){return new BPromise(function(_0x4e4e4b,_0x480510){var _0x1e92a6=_0xf24268||client;return _0x1e92a6[_0x556a('0x24')](_0x249a81,_0xb8d1d2)[_0x556a('0x25')](function(_0x3f1446){logger[_0x556a('0x26')]('SmsAccount,\x20%s,\x20%s',_0x519e5a,_0x556a('0x27'));logger[_0x556a('0x28')](_0x556a('0x29'),_0x519e5a,_0x556a('0x27'),JSON[_0x556a('0x2a')](_0x3f1446));if(_0x3f1446[_0x556a('0x2b')]){if(_0x3f1446['error'][_0x556a('0x2c')]===0x1f4){logger[_0x556a('0x2b')](_0x556a('0x2d'),_0x519e5a,_0x3f1446[_0x556a('0x2b')][_0x556a('0x2e')]);return _0x480510(_0x3f1446[_0x556a('0x2b')][_0x556a('0x2e')]);}logger['error'](_0x556a('0x2d'),_0x519e5a,_0x3f1446['error'][_0x556a('0x2e')]);return _0x4e4e4b(_0x3f1446[_0x556a('0x2b')][_0x556a('0x2e')]);}else{logger[_0x556a('0x26')]('SmsAccount,\x20%s,\x20%s',_0x519e5a,_0x556a('0x27'));_0x4e4e4b(_0x3f1446[_0x556a('0x2f')]['message']);}})['catch'](function(_0x31b309){logger['error'](_0x556a('0x2d'),_0x519e5a,_0x31b309);_0x480510(_0x31b309);});});}function respondWithStatusCode(_0x5e8466,_0x431968){_0x431968=_0x431968||0xcc;return function(_0x39f64a){if(_0x39f64a){return _0x5e8466[_0x556a('0x30')](_0x431968);}return _0x5e8466[_0x556a('0x31')](_0x431968)['end']();};}function respondWithResult(_0x5cc536,_0x380c09){_0x380c09=_0x380c09||0xc8;return function(_0x52dd33){if(_0x52dd33){return _0x5cc536[_0x556a('0x31')](_0x380c09)[_0x556a('0x32')](_0x52dd33);}};}function respondWithFilteredResult(_0x4f2f5d,_0x1ee918){return function(_0x24cf29){if(_0x24cf29){var _0x223dd6=typeof _0x1ee918[_0x556a('0x33')]==='undefined'&&typeof _0x1ee918[_0x556a('0x34')]===_0x556a('0x35');var _0x576879=_0x24cf29[_0x556a('0x36')];var _0x3febcb=_0x223dd6?0x0:_0x1ee918[_0x556a('0x33')];var _0x28d148=_0x223dd6?_0x24cf29[_0x556a('0x36')]:_0x1ee918[_0x556a('0x33')]+_0x1ee918['limit'];var _0x28a28d;if(_0x28d148>=_0x576879){_0x28d148=_0x576879;_0x28a28d=0xc8;}else{_0x28a28d=0xce;}_0x4f2f5d['status'](_0x28a28d);return _0x4f2f5d[_0x556a('0x37')](_0x556a('0x38'),_0x3febcb+'-'+_0x28d148+'/'+_0x576879)[_0x556a('0x32')](_0x24cf29);}return null;};}function patchUpdates(_0x5ad323){return function(_0xa3e7da){try{jsonpatch[_0x556a('0x39')](_0xa3e7da,_0x5ad323,!![]);}catch(_0x29bbd6){return BPromise[_0x556a('0x3a')](_0x29bbd6);}return _0xa3e7da[_0x556a('0x3b')]();};}function saveUpdates(_0x5e18e0,_0x17b44b){return function(_0x5c2877){if(_0x5c2877){return _0x5c2877['update'](_0x5e18e0)['then'](function(_0x19bf20){return _0x19bf20;});}return null;};}function removeEntity(_0x393e8f,_0x132445){return function(_0x58c422){if(_0x58c422){return _0x58c422[_0x556a('0x3c')]()['then'](function(){var _0x2ce247=_0x58c422['get']({'plain':!![]});var _0x69fa2d=_0x556a('0x3d');return db[_0x556a('0x3e')][_0x556a('0x3c')]({'where':{'type':_0x69fa2d,'resourceId':_0x2ce247['id']}})[_0x556a('0x25')](function(){return _0x58c422;});})[_0x556a('0x25')](function(){_0x393e8f[_0x556a('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351682,_0x316b73){return function(_0x4c992d){if(!_0x4c992d){_0x351682[_0x556a('0x30')](0x194);}return _0x4c992d;};}function handleError(_0x208040,_0x107157){_0x107157=_0x107157||0x1f4;return function(_0x56ee77){logger[_0x556a('0x2b')](_0x56ee77[_0x556a('0x3f')]);if(_0x56ee77[_0x556a('0x40')]){delete _0x56ee77['name'];}_0x208040['status'](_0x107157)[_0x556a('0x41')](_0x56ee77);};}exports[_0x556a('0x42')]=function(_0x34c9f6,_0x41f41c){var _0x1e3f5f={'include':[{'model':db[_0x556a('0x43')],'as':_0x556a('0x44')}]},_0x49ef59={},_0x185e96={'count':0x0,'rows':[]};var _0x53696b=_[_0x556a('0x45')](db[_0x556a('0x46')][_0x556a('0x47')],function(_0xeea94a){return{'name':_0xeea94a[_0x556a('0x48')],'type':_0xeea94a[_0x556a('0x49')][_0x556a('0x4a')]};});_0x49ef59[_0x556a('0x4b')]=_[_0x556a('0x45')](_0x53696b,_0x556a('0x40'));_0x49ef59['query']=_[_0x556a('0x4c')](_0x34c9f6[_0x556a('0x4d')]);_0x49ef59[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x49ef59[_0x556a('0x4b')],_0x49ef59[_0x556a('0x4d')]);_0x1e3f5f[_0x556a('0x50')]=_['intersection'](_0x49ef59[_0x556a('0x4b')],qs[_0x556a('0x51')](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x51')]));_0x1e3f5f[_0x556a('0x50')]=_0x1e3f5f[_0x556a('0x50')][_0x556a('0x52')]?_0x1e3f5f['attributes']:_0x49ef59[_0x556a('0x4b')];if(!_0x34c9f6['query']['hasOwnProperty'](_0x556a('0x53'))){_0x1e3f5f['limit']=qs['limit'](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x34')]);_0x1e3f5f[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x33')]);}_0x1e3f5f[_0x556a('0x54')]=qs[_0x556a('0x55')](_0x34c9f6[_0x556a('0x4d')][_0x556a('0x55')]);_0x1e3f5f[_0x556a('0x56')]=qs[_0x556a('0x4e')](_['pick'](_0x34c9f6[_0x556a('0x4d')],_0x49ef59['filters']),_0x53696b);if(_0x34c9f6[_0x556a('0x4d')][_0x556a('0x57')]){_0x1e3f5f['where']=_[_0x556a('0x58')](_0x1e3f5f[_0x556a('0x56')],{'$or':_[_0x556a('0x45')](_0x53696b,function(_0x1a0081){if(_0x1a0081[_0x556a('0x49')]!==_0x556a('0x59')){var _0x1ecc95={};_0x1ecc95[_0x1a0081[_0x556a('0x40')]]={'$like':'%'+_0x34c9f6[_0x556a('0x4d')][_0x556a('0x57')]+'%'};return _0x1ecc95;}})});}_0x1e3f5f=_['merge']({},_0x1e3f5f,_0x34c9f6[_0x556a('0x5a')]);var _0x371ec2={'where':_0x1e3f5f[_0x556a('0x56')]};return db[_0x556a('0x46')][_0x556a('0x36')](_0x371ec2)[_0x556a('0x25')](function(_0x2279b7){_0x185e96['count']=_0x2279b7;if(_0x34c9f6[_0x556a('0x4d')]['includeAll']){_0x1e3f5f[_0x556a('0x5b')]=[{'all':!![]}];}return db[_0x556a('0x46')][_0x556a('0x5c')](_0x1e3f5f);})[_0x556a('0x25')](function(_0x11dee0){_0x185e96[_0x556a('0x5d')]=_0x11dee0;return _0x185e96;})[_0x556a('0x25')](respondWithFilteredResult(_0x41f41c,_0x1e3f5f))['catch'](handleError(_0x41f41c,null));};exports[_0x556a('0x5e')]=function(_0x11ff44,_0x3d0119){var _0xe61361={'raw':![],'where':{'id':_0x11ff44[_0x556a('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x556a('0x44')}]},_0xb52fe1={};_0xb52fe1[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0x46')]['rawAttributes']);_0xb52fe1[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x11ff44['query']);_0xb52fe1[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0xb52fe1[_0x556a('0x4b')],_0xb52fe1[_0x556a('0x4d')]);_0xe61361[_0x556a('0x50')]=_[_0x556a('0x4f')](_0xb52fe1['model'],qs['fields'](_0x11ff44[_0x556a('0x4d')][_0x556a('0x51')]));_0xe61361[_0x556a('0x50')]=_0xe61361['attributes'][_0x556a('0x52')]?_0xe61361[_0x556a('0x50')]:_0xb52fe1[_0x556a('0x4b')];if(_0x11ff44['query'][_0x556a('0x60')]){_0xe61361['include']=[{'all':!![]}];}_0xe61361=_['merge']({},_0xe61361,_0x11ff44['options']);return db['SmsAccount'][_0x556a('0x61')](_0xe61361)[_0x556a('0x25')](handleEntityNotFound(_0x3d0119,null))[_0x556a('0x25')](respondWithResult(_0x3d0119,null))[_0x556a('0x62')](handleError(_0x3d0119,null));};exports[_0x556a('0x63')]=function(_0x5f21ea,_0x528c54){return db[_0x556a('0x46')][_0x556a('0x63')](_0x5f21ea['body'],{})[_0x556a('0x25')](function(_0x92e778){var _0x39eede=_0x5f21ea['user'][_0x556a('0x64')]({'plain':!![]});if(!_0x39eede)throw new Error(_0x556a('0x65'));if(_0x39eede[_0x556a('0x66')]===_0x556a('0x67')){var _0x39fd07=_0x92e778[_0x556a('0x64')]({'plain':!![]});var _0x4d9d96=_0x556a('0x3d');return db[_0x556a('0x68')]['find']({'where':{'name':_0x4d9d96,'userProfileId':_0x39eede[_0x556a('0x69')]},'raw':!![]})['then'](function(_0x345e96){if(_0x345e96&&_0x345e96[_0x556a('0x6a')]===0x0){return db[_0x556a('0x3e')][_0x556a('0x63')]({'name':_0x39fd07[_0x556a('0x40')],'resourceId':_0x39fd07['id'],'type':_0x345e96[_0x556a('0x40')],'sectionId':_0x345e96['id']},{})[_0x556a('0x25')](function(){return _0x92e778;});}else{return _0x92e778;}})[_0x556a('0x62')](function(_0x5011ff){logger[_0x556a('0x2b')](_0x556a('0x6b'),_0x5011ff);throw _0x5011ff;});}return _0x92e778;})[_0x556a('0x25')](respondWithResult(_0x528c54,0xc9))[_0x556a('0x62')](handleError(_0x528c54,null));};exports[_0x556a('0x6c')]=function(_0x3b9c69,_0x2e99c9){if(_0x3b9c69[_0x556a('0x6d')]['id']){delete _0x3b9c69[_0x556a('0x6d')]['id'];}return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x3b9c69[_0x556a('0x5f')]['id']},'include':[{'model':db[_0x556a('0x43')],'as':'mandatoryDispositionPause'}]})[_0x556a('0x25')](handleEntityNotFound(_0x2e99c9,null))['then'](saveUpdates(_0x3b9c69[_0x556a('0x6d')],null))[_0x556a('0x25')](respondWithResult(_0x2e99c9,null))['catch'](handleError(_0x2e99c9,null));};exports['destroy']=function(_0x103485,_0x9c25f5){return db['SmsAccount'][_0x556a('0x61')]({'where':{'id':_0x103485[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x9c25f5,null))[_0x556a('0x25')](removeEntity(_0x9c25f5,null))[_0x556a('0x62')](handleError(_0x9c25f5,null));};exports[_0x556a('0x6e')]=function(_0x54c505,_0x56d6e5){return db[_0x556a('0x46')][_0x556a('0x6e')]()['then'](respondWithResult(_0x56d6e5,null))[_0x556a('0x62')](handleError(_0x56d6e5,null));};exports['addDisposition']=function(_0x596149,_0x2a0c51,_0x47ede5){if(_0x596149[_0x556a('0x6d')]['id']){delete _0x596149['body']['id'];}return db[_0x556a('0x46')]['find']({'where':{'id':_0x596149[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a0c51,null))[_0x556a('0x25')](function(_0x7c9881){if(_0x7c9881){_0x596149['body'][_0x556a('0x6f')]=_0x7c9881['id'];return db[_0x556a('0x70')][_0x556a('0x63')](_0x596149['body']);}})['then'](respondWithResult(_0x2a0c51,null))[_0x556a('0x62')](handleError(_0x2a0c51,null));};exports[_0x556a('0x71')]=function(_0x582d84,_0x421c20,_0x2a5bde){var _0x411ef7={'raw':![],'where':{}};var _0xbc7dda={};var _0x4f7478={'count':0x0,'rows':[]};return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x582d84[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x421c20,null))[_0x556a('0x25')](function(_0x2cde6b){if(_0x2cde6b){_0xbc7dda[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0x70')][_0x556a('0x47')]);_0xbc7dda[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x582d84[_0x556a('0x4d')]);_0xbc7dda[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0xbc7dda[_0x556a('0x4b')],_0xbc7dda[_0x556a('0x4d')]);_0x411ef7['attributes']=_[_0x556a('0x4f')](_0xbc7dda[_0x556a('0x4b')],qs[_0x556a('0x51')](_0x582d84[_0x556a('0x4d')]['fields']));_0x411ef7[_0x556a('0x50')]=_0x411ef7[_0x556a('0x50')]['length']?_0x411ef7[_0x556a('0x50')]:_0xbc7dda[_0x556a('0x4b')];if(!_0x582d84[_0x556a('0x4d')][_0x556a('0x73')]('nolimit')){_0x411ef7['limit']=qs[_0x556a('0x34')](_0x582d84[_0x556a('0x4d')][_0x556a('0x34')]);_0x411ef7[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x582d84['query'][_0x556a('0x33')]);}_0x411ef7['order']=qs[_0x556a('0x55')](_0x582d84[_0x556a('0x4d')][_0x556a('0x55')]);_0x411ef7[_0x556a('0x56')]=qs[_0x556a('0x4e')](_[_0x556a('0x74')](_0x582d84[_0x556a('0x4d')],_0xbc7dda[_0x556a('0x4e')]));_0x411ef7['where'][_0x556a('0x6f')]=_0x2cde6b['id'];if(_0x582d84[_0x556a('0x4d')]['filter']){_0x411ef7[_0x556a('0x56')]=_[_0x556a('0x58')](_0x411ef7[_0x556a('0x56')],{'$or':_[_0x556a('0x45')](_0x411ef7[_0x556a('0x50')],function(_0x484b80){var _0x3644e1={};_0x3644e1[_0x484b80]={'$like':'%'+_0x582d84['query'][_0x556a('0x57')]+'%'};return _0x3644e1;})});}_0x411ef7=_[_0x556a('0x58')]({},_0x411ef7,_0x582d84['options']);return db[_0x556a('0x70')][_0x556a('0x36')]({'where':_0x411ef7['where']})[_0x556a('0x25')](function(_0x4a0b4e){_0x4f7478['count']=_0x4a0b4e;if(_0x582d84['query'][_0x556a('0x60')]){_0x411ef7[_0x556a('0x5b')]=[{'all':!![]}];}return db[_0x556a('0x70')][_0x556a('0x5c')](_0x411ef7);})['then'](function(_0x5dc9b3){_0x4f7478[_0x556a('0x5d')]=_0x5dc9b3;return _0x4f7478;});}})[_0x556a('0x25')](respondWithFilteredResult(_0x421c20,_0x411ef7))[_0x556a('0x62')](handleError(_0x421c20,null));};exports['removeDispositions']=function(_0x2c8ffe,_0x2ae3bc,_0x24e701){return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x2c8ffe[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x2ae3bc,null))[_0x556a('0x25')](function(_0x39f4f6){if(_0x39f4f6){return _0x39f4f6[_0x556a('0x75')](_0x2c8ffe[_0x556a('0x4d')][_0x556a('0x76')]);}})[_0x556a('0x25')](respondWithStatusCode(_0x2ae3bc,null))[_0x556a('0x62')](handleError(_0x2ae3bc,null));};exports[_0x556a('0x77')]=function(_0x58c508,_0x2632fc,_0x27c02f){if(_0x58c508[_0x556a('0x6d')]['id']){delete _0x58c508[_0x556a('0x6d')]['id'];}return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x58c508[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2632fc,null))[_0x556a('0x25')](function(_0x4e9178){if(_0x4e9178){_0x58c508[_0x556a('0x6d')][_0x556a('0x6f')]=_0x4e9178['id'];return db['CannedAnswer'][_0x556a('0x63')](_0x58c508['body']);}})[_0x556a('0x25')](respondWithResult(_0x2632fc,null))[_0x556a('0x62')](handleError(_0x2632fc,null));};exports[_0x556a('0x78')]=function(_0x320542,_0x2954c6,_0x471931){var _0x1b9713={'raw':![],'where':{}};var _0x1d24ef={};var _0x4b3d93={'count':0x0,'rows':[]};return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x320542[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2954c6,null))['then'](function(_0x2aa5cf){if(_0x2aa5cf){_0x1d24ef[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0x79')][_0x556a('0x47')]);_0x1d24ef[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x320542[_0x556a('0x4d')]);_0x1d24ef[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x1d24ef[_0x556a('0x4b')],_0x1d24ef[_0x556a('0x4d')]);_0x1b9713['attributes']=_['intersection'](_0x1d24ef[_0x556a('0x4b')],qs[_0x556a('0x51')](_0x320542['query'][_0x556a('0x51')]));_0x1b9713[_0x556a('0x50')]=_0x1b9713[_0x556a('0x50')][_0x556a('0x52')]?_0x1b9713[_0x556a('0x50')]:_0x1d24ef[_0x556a('0x4b')];if(!_0x320542[_0x556a('0x4d')][_0x556a('0x73')]('nolimit')){_0x1b9713[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x320542[_0x556a('0x4d')]['limit']);_0x1b9713[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x320542[_0x556a('0x4d')][_0x556a('0x33')]);}_0x1b9713['order']=qs[_0x556a('0x55')](_0x320542[_0x556a('0x4d')][_0x556a('0x55')]);_0x1b9713[_0x556a('0x56')]=qs[_0x556a('0x4e')](_[_0x556a('0x74')](_0x320542[_0x556a('0x4d')],_0x1d24ef[_0x556a('0x4e')]));_0x1b9713[_0x556a('0x56')][_0x556a('0x6f')]=_0x2aa5cf['id'];if(_0x320542['query']['filter']){_0x1b9713['where']=_[_0x556a('0x58')](_0x1b9713[_0x556a('0x56')],{'$or':_['map'](_0x1b9713[_0x556a('0x50')],function(_0x439b4f){var _0x389d6b={};_0x389d6b[_0x439b4f]={'$like':'%'+_0x320542[_0x556a('0x4d')][_0x556a('0x57')]+'%'};return _0x389d6b;})});}_0x1b9713=_['merge']({},_0x1b9713,_0x320542[_0x556a('0x5a')]);return db['CannedAnswer'][_0x556a('0x36')]({'where':_0x1b9713[_0x556a('0x56')]})['then'](function(_0x3ee588){_0x4b3d93['count']=_0x3ee588;if(_0x320542[_0x556a('0x4d')][_0x556a('0x60')]){_0x1b9713[_0x556a('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x556a('0x5c')](_0x1b9713);})['then'](function(_0x2664e8){_0x4b3d93[_0x556a('0x5d')]=_0x2664e8;return _0x4b3d93;});}})[_0x556a('0x25')](respondWithFilteredResult(_0x2954c6,_0x1b9713))[_0x556a('0x62')](handleError(_0x2954c6,null));};exports['removeAnswers']=function(_0x409dba,_0xa7f937,_0x160ae7){return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x409dba[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0xa7f937,null))[_0x556a('0x25')](function(_0x508359){if(_0x508359){return _0x508359[_0x556a('0x7a')](_0x409dba['query'][_0x556a('0x76')]);}})[_0x556a('0x25')](respondWithStatusCode(_0xa7f937,null))[_0x556a('0x62')](handleError(_0xa7f937,null));};exports[_0x556a('0x7b')]=function(_0x1bdf9f,_0x32dda8,_0x641baf){var _0x57f902={'channel':_0x556a('0x7c')};var _0xeee939=[];var _0x45c590=[];var _0x512113={};return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x1bdf9f[_0x556a('0x5f')]['id']},'include':[{'model':db[_0x556a('0x7d')],'as':_0x556a('0x7e')}]})[_0x556a('0x25')](handleEntityNotFound(_0x32dda8,null))[_0x556a('0x25')](function(_0x2e6685){_0x57f902['account']=_0x2e6685;_0x57f902[_0x556a('0x7f')]=_[_0x556a('0x80')](_0x2e6685[_0x556a('0x7e')],['priority'],['asc']);if(_0x57f902['account']['Applications']){delete _0x57f902[_0x556a('0x81')][_0x556a('0x7e')];}return db[_0x556a('0x82')][_0x556a('0x6e')]();})[_0x556a('0x25')](function(_0x309814){if(!_0x309814){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0x85'));}_0xeee939=_['difference'](_['keys'](_0x309814),[_0x556a('0x86'),'updatedAt']);_0x45c590=_['difference'](_['keys'](_0x309814),[_0x556a('0x86'),_0x556a('0x87'),_0x556a('0x88'),_0x556a('0x89')]);_0x57f902['body']={'mapKey':_0x556a('0x8a')};if(_0x57f902['account']['type']){switch(_0x57f902[_0x556a('0x81')][_0x556a('0x49')]){case _0x556a('0x8b'):_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f[_0x556a('0x6d')]['From'];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f['body']['Body'];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f['body'][_0x556a('0x8e')];break;case _0x556a('0x8f'):_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]='+'+_0x1bdf9f[_0x556a('0x6d')]['sender'];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f['body']['text'];break;case'connectel':_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x8c')];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x2e')];break;case _0x556a('0x90'):_0x57f902[_0x556a('0x6d')]['from']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x8c')];_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x6d')];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f['body'][_0x556a('0x91')];break;case _0x556a('0x92'):_0x57f902['body'][_0x556a('0x8c')]=_0x1bdf9f['body'][_0x556a('0x93')];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x94')];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x95')];break;case _0x556a('0x96'):_0x57f902['body'][_0x556a('0x8c')]='+'+_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x97')][0x0][_0x556a('0x8c')];_0x57f902['body']['body']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x97')][0x0][_0x556a('0x98')];_0x57f902['body'][_0x556a('0x8d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x97')][0x0][_0x556a('0x8d')];break;case'csc':_0x57f902[_0x556a('0x6d')]['from']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x99')];_0x57f902[_0x556a('0x6d')]['body']=_0x1bdf9f['body'][_0x556a('0x9a')][_0x556a('0x2e')];break;case'clickatell':_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f[_0x556a('0x6d')]['fromNumber'];_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x98')];_0x57f902[_0x556a('0x6d')]['messageId']=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x9b')];break;case _0x556a('0x9c'):_0x57f902[_0x556a('0x6d')]['messageId']=_0x1bdf9f['body'][0x0][_0x556a('0x2e')]['id'];_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')]=_0x1bdf9f['body'][0x0][_0x556a('0x2e')]['from'];_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]=_0x1bdf9f['body'][0x0][_0x556a('0x2e')]['text'];break;case _0x556a('0x9d'):_0x57f902['body'][_0x556a('0x8c')]=_0x1bdf9f['body']['from'];_0x57f902['body'][_0x556a('0x6d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x2e')];_0x57f902[_0x556a('0x6d')][_0x556a('0x8d')]=_0x1bdf9f[_0x556a('0x6d')][_0x556a('0x9e')];break;}}if(_0x57f902[_0x556a('0x6d')]['id']){delete _0x57f902['body']['id'];}if(_[_0x556a('0x9f')](_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')])){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0xa0'));}if(_[_0x556a('0x9f')](_0x57f902['body'][_0x556a('0x6d')])||_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')]===''){throw new db[(_0x556a('0x83'))]['ValidationError'](_0x556a('0xa1'));}if(_['isNil'](_0x57f902[_0x556a('0x6d')][_0x556a('0xa2')])){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0xa3')+_0x45c590);}if(!_[_0x556a('0xa4')](_0x45c590,_0x57f902[_0x556a('0x6d')][_0x556a('0xa2')])){throw new db[(_0x556a('0x83'))][(_0x556a('0x84'))](_0x556a('0xa5')+_0x45c590);}_0x512113[_0x57f902[_0x556a('0x6d')][_0x556a('0xa2')]]=_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')];return db[_0x556a('0xa6')][_0x556a('0x61')]({'where':{'id':_0x57f902[_0x556a('0x81')][_0x556a('0x89')]},'include':[{'model':db[_0x556a('0x82')],'as':_0x556a('0xa7'),'where':_0x512113,'limit':0x1,'order':[['updatedAt',_0x556a('0xa8')]]}]});})[_0x556a('0x25')](handleEntityNotFound(_0x32dda8,null))[_0x556a('0x25')](function(_0x19a6f1){if(_0x19a6f1){_0x57f902['list']=_[_0x556a('0xa9')](_0x19a6f1,['Contacts']);if(_0x19a6f1[_0x556a('0xa7')]['length']){return _0x19a6f1[_0x556a('0xa7')][0x0];}var _0x2622a1=_['defaults'](_0x57f902['body'],{'firstName':_0x57f902['body'][_0x556a('0x8c')],'ListId':_0x19a6f1['id']});_0x2622a1[_0x57f902['body'][_0x556a('0xa2')]]=_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')];return db[_0x556a('0x82')]['create'](_0x2622a1,{'fields':_0xeee939,'raw':!![]});}})[_0x556a('0x25')](handleEntityNotFound(_0x32dda8,null))[_0x556a('0x25')](function(_0x1f4051){if(_0x1f4051){_0x57f902['contact']=_0x1f4051;var _0x306f18={'ContactId':_0x1f4051['id'],'phone':_0x57f902['body'][_0x556a('0x8c')],'SmsAccountId':_0x1bdf9f[_0x556a('0x5f')]['id']};var _0x5efeee={'ContactId':_0x1f4051['id'],'SmsAccountId':_0x1bdf9f[_0x556a('0x5f')]['id'],'closed':![]};return db[_0x556a('0xaa')][_0x556a('0x61')]({'where':_0x5efeee})['then'](function(_0x2f653b){if(_0x2f653b){return[_0x2f653b,![]];}return db['SmsInteraction']['create'](_0x306f18)[_0x556a('0x25')](function(_0x555cfe){return[_0x555cfe,!![]];});});}})[_0x556a('0xab')](function(_0x117051,_0x4a6296){_0x57f902[_0x556a('0xac')]=_0x117051[_0x556a('0x64')]({'plain':!![]});_0x57f902[_0x556a('0xac')][_0x556a('0xad')]=![];if(_0x4a6296){if(_0x57f902[_0x556a('0x81')]['autoclose']){_0x57f902[_0x556a('0x7f')][_0x556a('0xae')]({'id':0x0,'priority':_0x57f902['applications']['length']+0x1,'app':_0x556a('0xaf'),'appdata':_0x556a('0xb0'),'interval':_0x556a('0xb1')});}_0x57f902['interaction'][_0x556a('0xad')]=!![];}return db[_0x556a('0xb2')]['create']({'phone':_0x57f902[_0x556a('0x6d')][_0x556a('0x8c')],'messageId':_0x57f902[_0x556a('0x6d')]['messageId'],'body':_0x57f902[_0x556a('0x6d')][_0x556a('0x6d')],'SmsAccountId':_0x1bdf9f[_0x556a('0x5f')]['id'],'SmsInteractionId':_0x117051['id'],'direction':'in','ContactId':_0x117051[_0x556a('0xb3')],'AttachmentId':_0x57f902[_0x556a('0x6d')][_0x556a('0xb4')]});})[_0x556a('0x25')](function(_0x82ca41){_0x57f902[_0x556a('0x2e')]=_0x82ca41;if(_0x57f902[_0x556a('0xac')][_0x556a('0xb5')]){return db[_0x556a('0xb6')][_0x556a('0x61')]({'attributes':['id',_0x556a('0x40')],'where':{'id':_0x57f902[_0x556a('0xac')][_0x556a('0xb5')]}})['then'](function(_0x37b93c){if(_0x37b93c){_0x57f902[_0x556a('0x7f')][_0x556a('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x37b93c[_0x556a('0x40')]+','+(_0x57f902[_0x556a('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x556a('0xb1')});}return respondWithRpcPromise(_0x556a('0xb8'),_0x556a('0xb9'),_0x57f902);});}return respondWithRpcPromise(_0x556a('0xb8'),_0x556a('0xb9'),_0x57f902);})['then'](function(_0x3f02c6){if(_0x3f02c6){var _0x10e0b9=0xc8;var _0x2ac1dd='receiveMessage';logger[_0x556a('0x26')](_0x556a('0x29'),_0x2ac1dd,_0x10e0b9,_0x556a('0xba'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2ac1dd,_0x10e0b9,_0x556a('0xba'),JSON[_0x556a('0x2a')](_0x3f02c6));if(_0x57f902[_0x556a('0x81')]['type']===_0x556a('0x8b')){return _0x32dda8[_0x556a('0x31')](_0x10e0b9)[_0x556a('0x37')](_0x556a('0xbb'),_0x556a('0xbc'))[_0x556a('0x41')](_0x556a('0xbd'));}else{return _0x32dda8[_0x556a('0x31')](_0x10e0b9)['json'](_0x3f02c6);}}})[_0x556a('0x62')](handleError(_0x32dda8,null));};exports[_0x556a('0xbe')]=function(_0xbfb62e,_0x37e7b7){var _0xbf168f=_0xbfb62e[_0x556a('0x5f')]['id'];var _0x42ce03=_0xbfb62e[_0x556a('0x6d')];var _0x5b9119=0xc8;var _0x506a64=null;return db[_0x556a('0xbf')]['transaction']({'isolationLevel':db[_0x556a('0xbf')][_0x556a('0xc0')]['ISOLATION_LEVELS'][_0x556a('0xc1')]},function(_0x50784e){return db['SmsAccount']['findOne']({'where':{'id':_0xbf168f},'transaction':_0x50784e})[_0x556a('0x25')](function(_0xda4ea7){if(_0xda4ea7){return db[_0x556a('0x7d')][_0x556a('0x3c')]({'where':{'SmsAccountId':_0xbf168f},'transaction':_0x50784e})['then'](function(){var _0x49ce96=_[_0x556a('0x45')](_0x42ce03,function(_0x502068){_0x502068['SmsAccountId']=_0xbf168f;return _0x502068;});return db['SmsApplication'][_0x556a('0xc2')](_0x49ce96,{'transaction':_0x50784e});});}else{_0x5b9119=0x194;_0x506a64=[];}});})[_0x556a('0x25')](function(){if(_0x5b9119!==0x194){return db[_0x556a('0x7d')][_0x556a('0xc3')]({'where':{'SmsAccountId':_0xbf168f},'order':_0x556a('0xc4')})[_0x556a('0x25')](function(_0x2ac40f){_0x506a64=_0x2ac40f;});}})[_0x556a('0x62')](function(_0x2d6673){_0x5b9119=0x1f4;logger[_0x556a('0x2b')](_0x2d6673[_0x556a('0x3f')]);if(_0x2d6673[_0x556a('0x40')]){delete _0x2d6673[_0x556a('0x40')];}_0x506a64=_0x2d6673;})['finally'](function(){if(_0x506a64===null){_0x37e7b7[_0x556a('0x30')](_0x5b9119);}else{if(_0x5b9119===0x1f4){_0x37e7b7['status'](_0x5b9119)[_0x556a('0x41')](_0x506a64);}else{_0x37e7b7[_0x556a('0x31')](_0x5b9119)[_0x556a('0x32')](_0x506a64);}}});};exports[_0x556a('0xc5')]=function(_0x25e85f,_0xe3b3e3,_0x3278df){var _0x944def={};var _0x3ec178={};var _0x2b3114;var _0x4774f6;return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x25e85f[_0x556a('0x5f')]['id']}})['then'](handleEntityNotFound(_0xe3b3e3,null))[_0x556a('0x25')](function(_0x57e922){if(_0x57e922){_0x2b3114=_0x57e922;_0x3ec178[_0x556a('0x4b')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x3ec178[_0x556a('0x4d')]=_[_0x556a('0x4c')](_0x25e85f['query']);_0x3ec178[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x3ec178['model'],_0x3ec178[_0x556a('0x4d')]);_0x944def['attributes']=_['intersection'](_0x3ec178['model'],qs[_0x556a('0x51')](_0x25e85f['query'][_0x556a('0x51')]));_0x944def['attributes']=_0x944def[_0x556a('0x50')]['length']?_0x944def[_0x556a('0x50')]:_0x3ec178[_0x556a('0x4b')];_0x944def[_0x556a('0x54')]=qs[_0x556a('0x55')](_0x25e85f[_0x556a('0x4d')][_0x556a('0x55')]);_0x944def['where']=qs[_0x556a('0x4e')](_[_0x556a('0x74')](_0x25e85f['query'],_0x3ec178['filters']));if(_0x25e85f[_0x556a('0x4d')][_0x556a('0x57')]){_0x944def[_0x556a('0x56')]=_[_0x556a('0x58')](_0x944def['where'],{'$or':_[_0x556a('0x45')](_0x944def[_0x556a('0x50')],function(_0x5b49f8){var _0x4bfb45={};_0x4bfb45[_0x5b49f8]={'$like':'%'+_0x25e85f[_0x556a('0x4d')]['filter']+'%'};return _0x4bfb45;})});}_0x944def=_[_0x556a('0x58')]({},_0x944def,_0x25e85f[_0x556a('0x5a')]);return _0x2b3114[_0x556a('0xc5')](_0x944def);}})[_0x556a('0x25')](function(_0x1709c4){if(_0x1709c4){_0x4774f6=_0x1709c4[_0x556a('0x52')];if(!_0x25e85f[_0x556a('0x4d')][_0x556a('0x73')](_0x556a('0x53'))){_0x944def[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x25e85f[_0x556a('0x4d')][_0x556a('0x34')]);_0x944def[_0x556a('0x33')]=qs[_0x556a('0x33')](_0x25e85f[_0x556a('0x4d')][_0x556a('0x33')]);}return _0x2b3114[_0x556a('0xc5')](_0x944def);}})[_0x556a('0x25')](function(_0x3dca0d){if(_0x3dca0d){return _0x3dca0d?{'count':_0x4774f6,'rows':_0x3dca0d}:null;}})[_0x556a('0x25')](respondWithResult(_0xe3b3e3,null))[_0x556a('0x62')](handleError(_0xe3b3e3,null));};exports[_0x556a('0xc6')]=function(_0x42e769,_0x4118d0,_0x10691b){var _0x2c20bb={'raw':![],'where':{}};var _0x3bd8a8={};var _0x559210={'count':0x0,'rows':[]};return db['SmsAccount'][_0x556a('0x72')]({'where':{'id':_0x42e769[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x4118d0,null))['then'](function(_0x564626){if(_0x564626){_0x3bd8a8[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0xaa')]['rawAttributes']);_0x3bd8a8[_0x556a('0x4d')]=_['keys'](_0x42e769[_0x556a('0x4d')]);_0x3bd8a8[_0x556a('0x4e')]=_['intersection'](_0x3bd8a8[_0x556a('0x4b')],_0x3bd8a8[_0x556a('0x4d')]);_0x2c20bb[_0x556a('0x50')]=_[_0x556a('0x4f')](_0x3bd8a8['model'],qs['fields'](_0x42e769['query'][_0x556a('0x51')]));_0x2c20bb[_0x556a('0x50')]=_0x2c20bb[_0x556a('0x50')][_0x556a('0x52')]?_0x2c20bb[_0x556a('0x50')]:_0x3bd8a8[_0x556a('0x4b')];if(!_0x42e769[_0x556a('0x4d')]['hasOwnProperty'](_0x556a('0x53'))){_0x2c20bb[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x42e769[_0x556a('0x4d')]['limit']);_0x2c20bb['offset']=qs[_0x556a('0x33')](_0x42e769['query']['offset']);}_0x2c20bb['order']=qs[_0x556a('0x55')](_0x42e769[_0x556a('0x4d')][_0x556a('0x55')]);_0x2c20bb[_0x556a('0x56')]=qs['filters'](_[_0x556a('0x74')](_0x42e769['query'],_0x3bd8a8[_0x556a('0x4e')]));_0x2c20bb[_0x556a('0x56')][_0x556a('0x6f')]=_0x564626['id'];if(_0x42e769[_0x556a('0x4d')][_0x556a('0x57')]){_0x2c20bb[_0x556a('0x56')]=_[_0x556a('0x58')](_0x2c20bb['where'],{'$or':_[_0x556a('0x45')](_0x2c20bb['attributes'],function(_0x4552a0){var _0x21daa4={};_0x21daa4[_0x4552a0]={'$like':'%'+_0x42e769[_0x556a('0x4d')]['filter']+'%'};return _0x21daa4;})});}_0x2c20bb=_['merge']({},_0x2c20bb,_0x42e769[_0x556a('0x5a')]);return db[_0x556a('0xaa')][_0x556a('0x36')]({'where':_0x2c20bb[_0x556a('0x56')]})['then'](function(_0x3dd6c8){_0x559210[_0x556a('0x36')]=_0x3dd6c8;if(_0x42e769['query'][_0x556a('0x60')]){_0x2c20bb[_0x556a('0x5b')]=[{'model':db[_0x556a('0x82')],'as':_0x556a('0xc7'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x556a('0x40'),_0x556a('0xc8'),_0x556a('0xc9')],'required':![]},{'model':db[_0x556a('0xca')],'as':_0x556a('0xcb'),'attributes':['id',_0x556a('0x40'),_0x556a('0xcc')],'where':_0x42e769['query'][_0x556a('0xcd')]?{'id':_0x42e769['query'][_0x556a('0xcd')]}:undefined,'required':_0x42e769[_0x556a('0x4d')][_0x556a('0xcd')]?!![]:![]}];}return db[_0x556a('0xaa')][_0x556a('0x5c')](_0x2c20bb);})[_0x556a('0x25')](function(_0x2e956b){_0x559210[_0x556a('0x5d')]=_0x2e956b;return _0x559210;});}})[_0x556a('0x25')](respondWithFilteredResult(_0x4118d0,_0x2c20bb))[_0x556a('0x62')](handleError(_0x4118d0,null));};exports[_0x556a('0x41')]=function(_0x2f378d,_0x24a2e5,_0x30097b){var _0x337b38,_0x1e9ce4,_0x4f9f88;if(_[_0x556a('0x9f')](_0x2f378d[_0x556a('0x6d')][_0x556a('0x6d')])||_0x2f378d[_0x556a('0x6d')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x556a('0xa1'));}if(_[_0x556a('0x9f')](_0x2f378d[_0x556a('0x6d')]['to'])){throw new db['Sequelize'][(_0x556a('0x84'))](_0x556a('0xce'));}_0x337b38=_0x2f378d[_0x556a('0x6d')]['to'];return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x2f378d['params']['id']},'include':[{'model':db[_0x556a('0xa6')],'as':'List','include':[{'model':db[_0x556a('0x82')],'as':'Contacts','where':{'mobile':_0x337b38},'limit':0x1,'order':[[_0x556a('0x87'),_0x556a('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x24a2e5,null))[_0x556a('0x25')](function(_0x139043){if(_0x139043&&_0x139043[_0x556a('0xcf')]){_0x1e9ce4=_0x139043['get']({'plain':!![]});if(_0x1e9ce4[_0x556a('0xcf')]&&_0x1e9ce4[_0x556a('0xcf')]['Contacts']['length']){return _0x1e9ce4[_0x556a('0xcf')]['Contacts'][0x0];}return db[_0x556a('0x82')][_0x556a('0x63')](_[_0x556a('0x1d')](_0x2f378d[_0x556a('0x6d')],{'firstName':_0x337b38,'mobile':_0x337b38,'phone':_0x337b38,'ListId':_0x1e9ce4[_0x556a('0x89')]}));}})[_0x556a('0x25')](handleEntityNotFound(_0x24a2e5,null))[_0x556a('0x25')](function(_0x544c57){if(_0x544c57){_0x4f9f88=_0x544c57;return db['SmsInteraction']['find']({'where':{'ContactId':_0x4f9f88['id'],'closed':![],'SmsAccountId':_0x1e9ce4['id']}})[_0x556a('0x25')](function(_0x4cfb25){if(_0x4cfb25){return[_0x4cfb25,![]];}return db[_0x556a('0xaa')][_0x556a('0x63')]({'UserId':_0x2f378d[_0x556a('0x67')]['id'],'ContactId':_0x4f9f88['id'],'SmsAccountId':_0x1e9ce4['id'],'phone':_0x337b38,'firstMsgDirection':_0x556a('0xd0'),'Messages':[_[_0x556a('0x58')](_0x2f378d[_0x556a('0x6d')],{'read':![],'body':_0x2f378d['body'][_0x556a('0x6d')],'phone':_0x337b38,'SmsAccountId':_0x1e9ce4['id'],'UserId':_0x2f378d[_0x556a('0x67')]['id'],'ContactId':_0x4f9f88['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x556a('0xd1')}]})[_0x556a('0x25')](function(_0x41ce1b){return[_0x41ce1b,!![]];});});}})[_0x556a('0xab')](function(_0x485d01,_0x153a20){if(_0x153a20){return _0x485d01;}return db[_0x556a('0xb2')]['create'](_[_0x556a('0x58')](_0x2f378d['body'],{'read':![],'body':_0x2f378d[_0x556a('0x6d')][_0x556a('0x6d')],'phone':_0x337b38,'SmsAccountId':_0x1e9ce4['id'],'SmsInteractionId':_0x485d01['id'],'UserId':_0x2f378d[_0x556a('0x67')]['id'],'ContactId':_0x4f9f88['id']}))[_0x556a('0x25')](function(_0x1dc6e5){_0x485d01[_0x556a('0xd2')][_0x556a('0xd1')]=[];_0x485d01[_0x556a('0xd2')][_0x556a('0xd1')]['push'](_0x1dc6e5['dataValues']);return _0x485d01;});})[_0x556a('0x25')](respondWithResult(_0x24a2e5,null))[_0x556a('0x62')](handleError(_0x24a2e5,null));};exports['status']=function(_0x49025d,_0x5465e7,_0x50d001){if(_0x49025d[_0x556a('0x6d')]['id']){delete _0x49025d['body']['id'];}var _0x191cd7,_0x497af9,_0x39a8b7;return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x49025d['params']['id']}})['then'](handleEntityNotFound(_0x5465e7,null))[_0x556a('0x25')](function(_0x167180){if(_0x167180){_0x39a8b7=_0x167180;logger[_0x556a('0x28')](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0xd3'),_0x167180[_0x556a('0x49')],util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));switch(_0x167180[_0x556a('0x49')]){case _0x556a('0x8f'):if(_0x49025d[_0x556a('0x6d')]['skebby_dispatch_id']&&_0x49025d['body'][_0x556a('0x31')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0x31')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0xd5')]}});}break;case _0x556a('0xd6'):if(_0x49025d[_0x556a('0x6d')][_0x556a('0xd7')]&&_0x49025d[_0x556a('0x6d')][_0x556a('0xd8')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0xd8')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d['body'][_0x556a('0xd7')]}});}break;case _0x556a('0x90'):if(_0x49025d[_0x556a('0x6d')][_0x556a('0x91')]&&_0x49025d['body'][_0x556a('0xd9')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0xd9')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0x91')]}});}break;case _0x556a('0x96'):var _0x529c79=_0x49025d[_0x556a('0x6d')][_0x556a('0x97')][0x0];if(_0x529c79[_0x556a('0x8d')]&&_0x529c79[_0x556a('0x31')][_0x556a('0xda')]===_0x556a('0xdb')){_0x497af9=_0x529c79[_0x556a('0x31')][_0x556a('0xda')];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x529c79[_0x556a('0x8d')]}});}break;case _0x556a('0xdc'):if(_0x49025d['body'][_0x556a('0x8d')]&&_0x49025d[_0x556a('0x6d')][_0x556a('0x31')]){_0x497af9=_0x49025d[_0x556a('0x6d')][_0x556a('0x31')];return db['SmsMessage'][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0x8d')]}});}break;case _0x556a('0x9c'):if(_0x49025d[_0x556a('0x6d')][0x0]['message']['id']){_0x497af9=_0x49025d['body'][0x0][_0x556a('0x49')];return db[_0x556a('0xb2')]['find']({'where':{'messageId':_0x49025d['body'][0x0]['message']['id']}});}break;case _0x556a('0x9d'):if(_0x49025d[_0x556a('0x6d')][_0x556a('0xdd')]&&_0x49025d[_0x556a('0x6d')][_0x556a('0x31')]){_0x497af9=_0x49025d['body']['status'];return db[_0x556a('0xb2')][_0x556a('0x61')]({'where':{'messageId':_0x49025d[_0x556a('0x6d')][_0x556a('0xdd')]}});}break;}}})['then'](handleEntityNotFound(_0x5465e7,null))['then'](function(_0x2dab57){if(_0x2dab57){_0x191cd7=_0x2dab57;switch(_0x39a8b7[_0x556a('0x49')]){case _0x556a('0x8f'):if(_0x497af9==='DELIVERED'){return _0x191cd7['update']({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x8f'),util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0xd6'):if(_0x497af9==='1'){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x8f'),util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x90'):if(!_0x49025d['body'][_0x556a('0xde')]&&_0x497af9>=0xc8&&_0x497af9<=0xce){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),'clicksend',util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x96'):var _0x5d1d51=_0x49025d[_0x556a('0x6d')][_0x556a('0x97')][0x0];if(_0x5d1d51['status'][_0x556a('0xda')]===_0x556a('0xdb')){return _0x191cd7['update']({'read':!![]});}else{logger[_0x556a('0x2b')](_0x556a('0x29'),_0x556a('0x31'),'infobip',util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x497af9==_0x556a('0xdf')||_0x497af9=='RECEIVED_BY_RECIPIENT'){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger['error'](_0x556a('0x29'),'status',_0x556a('0xdc'),util[_0x556a('0xd4')](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x9c'):if(_0x497af9==_0x556a('0xe0')){return _0x191cd7['update']({'read':!![]});}else{logger['error'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x9c'),util['inspect'](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;case _0x556a('0x9d'):if(_0x497af9===_0x556a('0xe1')||_0x497af9===_0x556a('0xe2')){return _0x191cd7[_0x556a('0x6c')]({'read':!![]});}else{logger[_0x556a('0x2b')](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0x9d'),util['inspect'](_0x49025d[_0x556a('0x6d')],{'showHidden':![],'depth':null}));}break;}return _0x191cd7;}})[_0x556a('0x25')](respondWithResult(_0x5465e7,null))[_0x556a('0x62')](handleError(_0x5465e7,null));};exports['statusGet']=function(_0x48673d,_0x5e127a,_0x32a556){var _0x339ed5,_0xb9a58a,_0x3f942e;return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x48673d[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x5e127a,null))[_0x556a('0x25')](function(_0x3b11d5){if(_0x3b11d5){_0x3f942e=_0x3b11d5;logger['debug'](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0xd3'),_0x3b11d5[_0x556a('0x49')],util[_0x556a('0xd4')](_0x48673d[_0x556a('0x4d')],{'showHidden':![],'depth':null}));switch(_0x3b11d5['type']){case _0x556a('0xe3'):if(_0x48673d[_0x556a('0x4d')][_0x556a('0xe4')]&&_0x48673d[_0x556a('0x4d')][_0x556a('0xe5')]){_0xb9a58a=_0x48673d[_0x556a('0x4d')][_0x556a('0xe5')];return db['SmsMessage'][_0x556a('0x61')]({'where':{'messageId':_0x48673d[_0x556a('0x4d')][_0x556a('0xe4')]}});}break;}}})[_0x556a('0x25')](handleEntityNotFound(_0x5e127a,null))[_0x556a('0x25')](function(_0x240a30){if(_0x240a30){_0x339ed5=_0x240a30;switch(_0x3f942e[_0x556a('0x49')]){case _0x556a('0xe3'):if(_0xb9a58a==='2'||_0xb9a58a==='6'){return _0x339ed5['update']({'read':!![]});}else{logger[_0x556a('0x2b')](_0x556a('0x29'),_0x556a('0x31'),_0x556a('0xe3'),util[_0x556a('0xd4')](_0x48673d[_0x556a('0x4d')],{'showHidden':![],'depth':null}));};break;}return _0x339ed5;}})[_0x556a('0x25')](respondWithResult(_0x5e127a,null))['catch'](handleError(_0x5e127a,null));};exports[_0x556a('0xe6')]=function(_0x4bb1db,_0x528e1b,_0x240472){return db[_0x556a('0x46')][_0x556a('0x61')]({'where':{'id':_0x4bb1db[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x528e1b,null))[_0x556a('0x25')](function(_0x43876b){if(_0x43876b){return _0x43876b[_0x556a('0xe6')](_0x4bb1db['body']['ids'],_[_0x556a('0xa9')](_0x4bb1db[_0x556a('0x6d')],[_0x556a('0x76'),'id'])||{})[_0x556a('0xab')](function(_0x11ab83){for(var _0x2df562=0x0;_0x2df562<_0x4bb1db['body'][_0x556a('0x76')][_0x556a('0x52')];_0x2df562+=0x1){socket['emit'](_0x556a('0xe7'),{'UserId':Number(_0x4bb1db[_0x556a('0x6d')][_0x556a('0x76')][_0x2df562]),'SmsAccountId':Number(_0x4bb1db[_0x556a('0x5f')]['id'])});}return _0x11ab83;});}})[_0x556a('0x25')](respondWithResult(_0x528e1b,null))[_0x556a('0x62')](handleError(_0x528e1b,null));};exports[_0x556a('0xe8')]=function(_0x21047e,_0x1dbf1c,_0x30c0a0){return db['SmsAccount'][_0x556a('0x61')]({'where':{'id':_0x21047e[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x1dbf1c,null))['then'](function(_0x1f9f35){if(_0x1f9f35){return _0x1f9f35['removeAgents'](_0x21047e[_0x556a('0x4d')]['ids'])['then'](function(){if(_[_0x556a('0xe9')](_0x21047e[_0x556a('0x4d')]['ids'])){for(var _0x389cee=0x0;_0x389cee<_0x21047e['query'][_0x556a('0x76')][_0x556a('0x52')];_0x389cee+=0x1){socket[_0x556a('0xea')](_0x556a('0xeb'),{'UserId':Number(_0x21047e[_0x556a('0x4d')][_0x556a('0x76')][_0x389cee]),'SmsAccountId':Number(_0x21047e[_0x556a('0x5f')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x21047e[_0x556a('0x4d')][_0x556a('0x76')]),'SmsAccountId':Number(_0x21047e[_0x556a('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dbf1c,null))['catch'](handleError(_0x1dbf1c,null));};exports[_0x556a('0xec')]=function(_0x32a7c0,_0x372eba,_0x5e3ad9){var _0x566c07={};var _0x3445c1={};var _0x56aa87;var _0x4503df;return db[_0x556a('0x46')][_0x556a('0x72')]({'where':{'id':_0x32a7c0[_0x556a('0x5f')]['id']}})[_0x556a('0x25')](handleEntityNotFound(_0x372eba,null))['then'](function(_0x4e7bd){if(_0x4e7bd){_0x56aa87=_0x4e7bd;_0x3445c1[_0x556a('0x4b')]=_[_0x556a('0x4c')](db[_0x556a('0xb6')]['rawAttributes']);_0x3445c1['query']=_[_0x556a('0x4c')](_0x32a7c0[_0x556a('0x4d')]);_0x3445c1[_0x556a('0x4e')]=_[_0x556a('0x4f')](_0x3445c1[_0x556a('0x4b')],_0x3445c1['query']);_0x566c07['attributes']=_[_0x556a('0x4f')](_0x3445c1[_0x556a('0x4b')],qs['fields'](_0x32a7c0['query']['fields']));_0x566c07[_0x556a('0x50')]=_0x566c07[_0x556a('0x50')][_0x556a('0x52')]?_0x566c07[_0x556a('0x50')]:_0x3445c1['model'];_0x566c07['order']=qs[_0x556a('0x55')](_0x32a7c0[_0x556a('0x4d')][_0x556a('0x55')]);_0x566c07['where']=qs['filters'](_['pick'](_0x32a7c0['query'],_0x3445c1['filters']));if(_0x32a7c0[_0x556a('0x4d')][_0x556a('0x57')]){_0x566c07[_0x556a('0x56')]=_[_0x556a('0x58')](_0x566c07[_0x556a('0x56')],{'$or':_[_0x556a('0x45')](_0x566c07[_0x556a('0x50')],function(_0x9a1a5d){var _0x4b3d2e={};_0x4b3d2e[_0x9a1a5d]={'$like':'%'+_0x32a7c0[_0x556a('0x4d')][_0x556a('0x57')]+'%'};return _0x4b3d2e;})});}_0x566c07=_['merge']({},_0x566c07,_0x32a7c0[_0x556a('0x5a')]);return _0x56aa87[_0x556a('0xec')](_0x566c07);}})[_0x556a('0x25')](function(_0x70d919){if(_0x70d919){_0x4503df=_0x70d919[_0x556a('0x52')];if(!_0x32a7c0[_0x556a('0x4d')]['hasOwnProperty'](_0x556a('0x53'))){_0x566c07[_0x556a('0x34')]=qs[_0x556a('0x34')](_0x32a7c0['query'][_0x556a('0x34')]);_0x566c07[_0x556a('0x33')]=qs['offset'](_0x32a7c0[_0x556a('0x4d')][_0x556a('0x33')]);}return _0x56aa87[_0x556a('0xec')](_0x566c07);}})[_0x556a('0x25')](function(_0x4d8fdd){if(_0x4d8fdd){return _0x4d8fdd?{'count':_0x4503df,'rows':_0x4d8fdd}:null;}})[_0x556a('0x25')](respondWithResult(_0x372eba,null))[_0x556a('0x62')](handleError(_0x372eba,null));}; \ No newline at end of file +var _0xe256=['connectel','clicksend','message_id','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','SmsMessage','requestid','statusInt','status_code','groupName','redif','error_code','DELIVERED','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','get','UserProfileResource','destroy','end','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','show','params','mandatoryDispositionPause','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','describe','SmsAccountId','Disposition','hasOwnProperty','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','type','twilio','Body','messageId','skebby','from','sender','text'];(function(_0x28df77,_0x2af511){var _0x18c84f=function(_0x22494c){while(--_0x22494c){_0x28df77['push'](_0x28df77['shift']());}};_0x18c84f(++_0x2af511);}(_0xe256,0x13e));var _0x6e25=function(_0x471ef2,_0x1e28ca){_0x471ef2=_0x471ef2-0x0;var _0x3a735d=_0xe256[_0x471ef2];return _0x3a735d;};'use strict';var emlformat=require(_0x6e25('0x0'));var rimraf=require(_0x6e25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e25('0x2'));var rp=require(_0x6e25('0x3'));var moment=require(_0x6e25('0x4'));var BPromise=require(_0x6e25('0x5'));var Mustache=require(_0x6e25('0x6'));var util=require(_0x6e25('0x7'));var path=require(_0x6e25('0x8'));var sox=require(_0x6e25('0x9'));var csv=require(_0x6e25('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e25('0xb'));var _=require('lodash');var squel=require(_0x6e25('0xc'));var crypto=require(_0x6e25('0xd'));var jsforce=require(_0x6e25('0xe'));var deskjs=require(_0x6e25('0xf'));var toCsv=require(_0x6e25('0xa'));var querystring=require(_0x6e25('0x10'));var Papa=require(_0x6e25('0x11'));var Redis=require(_0x6e25('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6e25('0x13'));var as=require(_0x6e25('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e25('0x15'));var utils=require(_0x6e25('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6e25('0x17'));var db=require('../../mysqldb')['db'];config[_0x6e25('0x18')]=_[_0x6e25('0x19')](config[_0x6e25('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e25('0x1a'))(new Redis(config[_0x6e25('0x18')]));require(_0x6e25('0x1b'))['register'](socket);var jayson=require(_0x6e25('0x1c'));var client=jayson[_0x6e25('0x1d')][_0x6e25('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1b96cc,_0x5ea4b6,_0x1f176a,_0x1cec2c){return new BPromise(function(_0x573198,_0x267a6a){var _0x488a47=_0x1cec2c||client;return _0x488a47[_0x6e25('0x1f')](_0x1b96cc,_0x1f176a)[_0x6e25('0x20')](function(_0x292e6b){logger[_0x6e25('0x21')](_0x6e25('0x22'),_0x5ea4b6,'request\x20sent');logger['debug'](_0x6e25('0x23'),_0x5ea4b6,_0x6e25('0x24'),JSON[_0x6e25('0x25')](_0x292e6b));if(_0x292e6b[_0x6e25('0x26')]){if(_0x292e6b[_0x6e25('0x26')][_0x6e25('0x27')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5ea4b6,_0x292e6b[_0x6e25('0x26')]['message']);return _0x267a6a(_0x292e6b[_0x6e25('0x26')][_0x6e25('0x28')]);}logger[_0x6e25('0x26')](_0x6e25('0x22'),_0x5ea4b6,_0x292e6b[_0x6e25('0x26')][_0x6e25('0x28')]);return _0x573198(_0x292e6b[_0x6e25('0x26')][_0x6e25('0x28')]);}else{logger['info'](_0x6e25('0x22'),_0x5ea4b6,_0x6e25('0x24'));_0x573198(_0x292e6b['result'][_0x6e25('0x28')]);}})[_0x6e25('0x29')](function(_0x235f87){logger[_0x6e25('0x26')](_0x6e25('0x22'),_0x5ea4b6,_0x235f87);_0x267a6a(_0x235f87);});});}function respondWithStatusCode(_0x275134,_0xf7653c){_0xf7653c=_0xf7653c||0xcc;return function(_0x780b32){if(_0x780b32){return _0x275134[_0x6e25('0x2a')](_0xf7653c);}return _0x275134[_0x6e25('0x2b')](_0xf7653c)['end']();};}function respondWithResult(_0x12d3d4,_0x50bc77){_0x50bc77=_0x50bc77||0xc8;return function(_0x46a21f){if(_0x46a21f){return _0x12d3d4[_0x6e25('0x2b')](_0x50bc77)['json'](_0x46a21f);}};}function respondWithFilteredResult(_0x3e37e5,_0x37e4e7){return function(_0x32390d){if(_0x32390d){var _0x5a0fe1=typeof _0x37e4e7[_0x6e25('0x2c')]===_0x6e25('0x2d')&&typeof _0x37e4e7[_0x6e25('0x2e')]===_0x6e25('0x2d');var _0x598955=_0x32390d['count'];var _0x34696e=_0x5a0fe1?0x0:_0x37e4e7[_0x6e25('0x2c')];var _0x482a08=_0x5a0fe1?_0x32390d['count']:_0x37e4e7[_0x6e25('0x2c')]+_0x37e4e7[_0x6e25('0x2e')];var _0x29e940;if(_0x482a08>=_0x598955){_0x482a08=_0x598955;_0x29e940=0xc8;}else{_0x29e940=0xce;}_0x3e37e5[_0x6e25('0x2b')](_0x29e940);return _0x3e37e5[_0x6e25('0x2f')](_0x6e25('0x30'),_0x34696e+'-'+_0x482a08+'/'+_0x598955)[_0x6e25('0x31')](_0x32390d);}return null;};}function patchUpdates(_0x3f0345){return function(_0x435853){try{jsonpatch[_0x6e25('0x32')](_0x435853,_0x3f0345,!![]);}catch(_0x26ce87){return BPromise[_0x6e25('0x33')](_0x26ce87);}return _0x435853['save']();};}function saveUpdates(_0x404884,_0xa5ee35){return function(_0x2231e1){if(_0x2231e1){return _0x2231e1[_0x6e25('0x34')](_0x404884)[_0x6e25('0x20')](function(_0x3d52e6){return _0x3d52e6;});}return null;};}function removeEntity(_0x23ce88,_0x4aac7a){return function(_0x13b0db){if(_0x13b0db){return _0x13b0db['destroy']()[_0x6e25('0x20')](function(){var _0x47bd70=_0x13b0db[_0x6e25('0x35')]({'plain':!![]});var _0x26b1a5='SmsAccounts';return db[_0x6e25('0x36')][_0x6e25('0x37')]({'where':{'type':_0x26b1a5,'resourceId':_0x47bd70['id']}})['then'](function(){return _0x13b0db;});})[_0x6e25('0x20')](function(){_0x23ce88[_0x6e25('0x2b')](0xcc)[_0x6e25('0x38')]();});}};}function handleEntityNotFound(_0x44d239,_0x131c28){return function(_0x54e534){if(!_0x54e534){_0x44d239['sendStatus'](0x194);}return _0x54e534;};}function handleError(_0x142fb2,_0x2f49f4){_0x2f49f4=_0x2f49f4||0x1f4;return function(_0x57f475){logger[_0x6e25('0x26')](_0x57f475['stack']);if(_0x57f475['name']){delete _0x57f475[_0x6e25('0x39')];}_0x142fb2[_0x6e25('0x2b')](_0x2f49f4)[_0x6e25('0x3a')](_0x57f475);};}exports[_0x6e25('0x3b')]=function(_0x4677a1,_0x3c76a6){var _0x293fc={'include':[{'model':db[_0x6e25('0x3c')],'as':'mandatoryDispositionPause'}]},_0x14c30c={},_0x361fcb={'count':0x0,'rows':[]};var _0x564815=_['map'](db[_0x6e25('0x3d')][_0x6e25('0x3e')],function(_0x43a3a0){return{'name':_0x43a3a0[_0x6e25('0x3f')],'type':_0x43a3a0['type'][_0x6e25('0x40')]};});_0x14c30c[_0x6e25('0x41')]=_[_0x6e25('0x42')](_0x564815,'name');_0x14c30c[_0x6e25('0x43')]=_[_0x6e25('0x44')](_0x4677a1[_0x6e25('0x43')]);_0x14c30c['filters']=_[_0x6e25('0x45')](_0x14c30c[_0x6e25('0x41')],_0x14c30c['query']);_0x293fc[_0x6e25('0x46')]=_[_0x6e25('0x45')](_0x14c30c[_0x6e25('0x41')],qs[_0x6e25('0x47')](_0x4677a1[_0x6e25('0x43')][_0x6e25('0x47')]));_0x293fc[_0x6e25('0x46')]=_0x293fc[_0x6e25('0x46')]['length']?_0x293fc['attributes']:_0x14c30c[_0x6e25('0x41')];if(!_0x4677a1[_0x6e25('0x43')]['hasOwnProperty'](_0x6e25('0x48'))){_0x293fc[_0x6e25('0x2e')]=qs['limit'](_0x4677a1[_0x6e25('0x43')]['limit']);_0x293fc['offset']=qs[_0x6e25('0x2c')](_0x4677a1['query']['offset']);}_0x293fc[_0x6e25('0x49')]=qs[_0x6e25('0x4a')](_0x4677a1[_0x6e25('0x43')][_0x6e25('0x4a')]);_0x293fc[_0x6e25('0x4b')]=qs[_0x6e25('0x4c')](_[_0x6e25('0x4d')](_0x4677a1['query'],_0x14c30c[_0x6e25('0x4c')]),_0x564815);if(_0x4677a1[_0x6e25('0x43')]['filter']){_0x293fc[_0x6e25('0x4b')]=_[_0x6e25('0x4e')](_0x293fc['where'],{'$or':_['map'](_0x564815,function(_0x10c0d2){if(_0x10c0d2['type']!==_0x6e25('0x4f')){var _0x215fa6={};_0x215fa6[_0x10c0d2[_0x6e25('0x39')]]={'$like':'%'+_0x4677a1[_0x6e25('0x43')][_0x6e25('0x50')]+'%'};return _0x215fa6;}})});}_0x293fc=_['merge']({},_0x293fc,_0x4677a1[_0x6e25('0x51')]);var _0x412607={'where':_0x293fc[_0x6e25('0x4b')]};return db['SmsAccount'][_0x6e25('0x52')](_0x412607)[_0x6e25('0x20')](function(_0x465305){_0x361fcb[_0x6e25('0x52')]=_0x465305;if(_0x4677a1['query']['includeAll']){_0x293fc[_0x6e25('0x53')]=[{'all':!![]}];}return db[_0x6e25('0x3d')][_0x6e25('0x54')](_0x293fc);})[_0x6e25('0x20')](function(_0xdf77f6){_0x361fcb[_0x6e25('0x55')]=_0xdf77f6;return _0x361fcb;})['then'](respondWithFilteredResult(_0x3c76a6,_0x293fc))['catch'](handleError(_0x3c76a6,null));};exports[_0x6e25('0x56')]=function(_0x35cbf7,_0x36cc10){var _0x280681={'raw':![],'where':{'id':_0x35cbf7[_0x6e25('0x57')]['id']},'include':[{'model':db[_0x6e25('0x3c')],'as':_0x6e25('0x58')}]},_0x3c7fd3={};_0x3c7fd3[_0x6e25('0x41')]=_['keys'](db[_0x6e25('0x3d')][_0x6e25('0x3e')]);_0x3c7fd3[_0x6e25('0x43')]=_[_0x6e25('0x44')](_0x35cbf7[_0x6e25('0x43')]);_0x3c7fd3[_0x6e25('0x4c')]=_[_0x6e25('0x45')](_0x3c7fd3[_0x6e25('0x41')],_0x3c7fd3['query']);_0x280681['attributes']=_[_0x6e25('0x45')](_0x3c7fd3[_0x6e25('0x41')],qs[_0x6e25('0x47')](_0x35cbf7[_0x6e25('0x43')][_0x6e25('0x47')]));_0x280681[_0x6e25('0x46')]=_0x280681[_0x6e25('0x46')][_0x6e25('0x59')]?_0x280681[_0x6e25('0x46')]:_0x3c7fd3['model'];if(_0x35cbf7[_0x6e25('0x43')][_0x6e25('0x5a')]){_0x280681[_0x6e25('0x53')]=[{'all':!![]}];}_0x280681=_[_0x6e25('0x4e')]({},_0x280681,_0x35cbf7[_0x6e25('0x51')]);return db[_0x6e25('0x3d')]['find'](_0x280681)['then'](handleEntityNotFound(_0x36cc10,null))[_0x6e25('0x20')](respondWithResult(_0x36cc10,null))['catch'](handleError(_0x36cc10,null));};exports[_0x6e25('0x5b')]=function(_0x2627a9,_0x504fcd){return db[_0x6e25('0x3d')][_0x6e25('0x5b')](_0x2627a9[_0x6e25('0x5c')],{})[_0x6e25('0x20')](function(_0x5e559e){var _0x4936da=_0x2627a9[_0x6e25('0x5d')]['get']({'plain':!![]});if(!_0x4936da)throw new Error(_0x6e25('0x5e'));if(_0x4936da['role']===_0x6e25('0x5d')){var _0x151c82=_0x5e559e[_0x6e25('0x35')]({'plain':!![]});var _0x2aaf7d='SmsAccounts';return db[_0x6e25('0x5f')][_0x6e25('0x60')]({'where':{'name':_0x2aaf7d,'userProfileId':_0x4936da[_0x6e25('0x61')]},'raw':!![]})[_0x6e25('0x20')](function(_0x4d07bd){if(_0x4d07bd&&_0x4d07bd[_0x6e25('0x62')]===0x0){return db['UserProfileResource'][_0x6e25('0x5b')]({'name':_0x151c82[_0x6e25('0x39')],'resourceId':_0x151c82['id'],'type':_0x4d07bd[_0x6e25('0x39')],'sectionId':_0x4d07bd['id']},{})[_0x6e25('0x20')](function(){return _0x5e559e;});}else{return _0x5e559e;}})[_0x6e25('0x29')](function(_0x15f874){logger[_0x6e25('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15f874);throw _0x15f874;});}return _0x5e559e;})[_0x6e25('0x20')](respondWithResult(_0x504fcd,0xc9))[_0x6e25('0x29')](handleError(_0x504fcd,null));};exports[_0x6e25('0x34')]=function(_0x5a1f17,_0x20a51a){if(_0x5a1f17[_0x6e25('0x5c')]['id']){delete _0x5a1f17[_0x6e25('0x5c')]['id'];}return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x5a1f17['params']['id']},'include':[{'model':db[_0x6e25('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x20a51a,null))[_0x6e25('0x20')](saveUpdates(_0x5a1f17[_0x6e25('0x5c')],null))[_0x6e25('0x20')](respondWithResult(_0x20a51a,null))[_0x6e25('0x29')](handleError(_0x20a51a,null));};exports[_0x6e25('0x37')]=function(_0xac1fb1,_0x2020eb){return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0xac1fb1[_0x6e25('0x57')]['id']}})['then'](handleEntityNotFound(_0x2020eb,null))['then'](removeEntity(_0x2020eb,null))[_0x6e25('0x29')](handleError(_0x2020eb,null));};exports[_0x6e25('0x63')]=function(_0x4080a0,_0x53baf8){return db[_0x6e25('0x3d')][_0x6e25('0x63')]()['then'](respondWithResult(_0x53baf8,null))[_0x6e25('0x29')](handleError(_0x53baf8,null));};exports['addDisposition']=function(_0x2ab506,_0x31f9c6,_0x21fce1){if(_0x2ab506['body']['id']){delete _0x2ab506[_0x6e25('0x5c')]['id'];}return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x2ab506['params']['id']}})['then'](handleEntityNotFound(_0x31f9c6,null))[_0x6e25('0x20')](function(_0x204b02){if(_0x204b02){_0x2ab506[_0x6e25('0x5c')][_0x6e25('0x64')]=_0x204b02['id'];return db['Disposition']['create'](_0x2ab506['body']);}})[_0x6e25('0x20')](respondWithResult(_0x31f9c6,null))[_0x6e25('0x29')](handleError(_0x31f9c6,null));};exports['getDispositions']=function(_0x1b8809,_0x333220,_0x137902){var _0x138eb6={'raw':![],'where':{}};var _0x2ffe0f={};var _0x4fc830={'count':0x0,'rows':[]};return db[_0x6e25('0x3d')]['findOne']({'where':{'id':_0x1b8809[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x333220,null))[_0x6e25('0x20')](function(_0x39c440){if(_0x39c440){_0x2ffe0f[_0x6e25('0x41')]=_[_0x6e25('0x44')](db[_0x6e25('0x65')][_0x6e25('0x3e')]);_0x2ffe0f[_0x6e25('0x43')]=_['keys'](_0x1b8809[_0x6e25('0x43')]);_0x2ffe0f[_0x6e25('0x4c')]=_[_0x6e25('0x45')](_0x2ffe0f[_0x6e25('0x41')],_0x2ffe0f['query']);_0x138eb6[_0x6e25('0x46')]=_['intersection'](_0x2ffe0f['model'],qs[_0x6e25('0x47')](_0x1b8809[_0x6e25('0x43')][_0x6e25('0x47')]));_0x138eb6['attributes']=_0x138eb6[_0x6e25('0x46')][_0x6e25('0x59')]?_0x138eb6[_0x6e25('0x46')]:_0x2ffe0f[_0x6e25('0x41')];if(!_0x1b8809[_0x6e25('0x43')][_0x6e25('0x66')](_0x6e25('0x48'))){_0x138eb6[_0x6e25('0x2e')]=qs['limit'](_0x1b8809['query']['limit']);_0x138eb6[_0x6e25('0x2c')]=qs[_0x6e25('0x2c')](_0x1b8809[_0x6e25('0x43')]['offset']);}_0x138eb6[_0x6e25('0x49')]=qs[_0x6e25('0x4a')](_0x1b8809[_0x6e25('0x43')][_0x6e25('0x4a')]);_0x138eb6[_0x6e25('0x4b')]=qs[_0x6e25('0x4c')](_[_0x6e25('0x4d')](_0x1b8809[_0x6e25('0x43')],_0x2ffe0f[_0x6e25('0x4c')]));_0x138eb6[_0x6e25('0x4b')][_0x6e25('0x64')]=_0x39c440['id'];if(_0x1b8809['query']['filter']){_0x138eb6[_0x6e25('0x4b')]=_[_0x6e25('0x4e')](_0x138eb6[_0x6e25('0x4b')],{'$or':_['map'](_0x138eb6[_0x6e25('0x46')],function(_0x36adca){var _0x56b28a={};_0x56b28a[_0x36adca]={'$like':'%'+_0x1b8809['query'][_0x6e25('0x50')]+'%'};return _0x56b28a;})});}_0x138eb6=_[_0x6e25('0x4e')]({},_0x138eb6,_0x1b8809['options']);return db[_0x6e25('0x65')][_0x6e25('0x52')]({'where':_0x138eb6[_0x6e25('0x4b')]})[_0x6e25('0x20')](function(_0xbbc9df){_0x4fc830['count']=_0xbbc9df;if(_0x1b8809[_0x6e25('0x43')][_0x6e25('0x5a')]){_0x138eb6[_0x6e25('0x53')]=[{'all':!![]}];}return db[_0x6e25('0x65')][_0x6e25('0x54')](_0x138eb6);})[_0x6e25('0x20')](function(_0xb51022){_0x4fc830[_0x6e25('0x55')]=_0xb51022;return _0x4fc830;});}})[_0x6e25('0x20')](respondWithFilteredResult(_0x333220,_0x138eb6))[_0x6e25('0x29')](handleError(_0x333220,null));};exports[_0x6e25('0x67')]=function(_0x5e6da4,_0x5c0cdf,_0xf9ce47){return db['SmsAccount'][_0x6e25('0x60')]({'where':{'id':_0x5e6da4[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x5c0cdf,null))['then'](function(_0xfba816){if(_0xfba816){return _0xfba816[_0x6e25('0x67')](_0x5e6da4['query'][_0x6e25('0x68')]);}})[_0x6e25('0x20')](respondWithStatusCode(_0x5c0cdf,null))['catch'](handleError(_0x5c0cdf,null));};exports['addAnswer']=function(_0x37a296,_0x505d70,_0x13fe66){if(_0x37a296[_0x6e25('0x5c')]['id']){delete _0x37a296[_0x6e25('0x5c')]['id'];}return db[_0x6e25('0x3d')]['find']({'where':{'id':_0x37a296['params']['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x505d70,null))[_0x6e25('0x20')](function(_0x5587b1){if(_0x5587b1){_0x37a296[_0x6e25('0x5c')][_0x6e25('0x64')]=_0x5587b1['id'];return db['CannedAnswer']['create'](_0x37a296[_0x6e25('0x5c')]);}})['then'](respondWithResult(_0x505d70,null))[_0x6e25('0x29')](handleError(_0x505d70,null));};exports[_0x6e25('0x69')]=function(_0x115ea9,_0x899601,_0x412bfe){var _0x5c2575={'raw':![],'where':{}};var _0x245ec8={};var _0x58ba07={'count':0x0,'rows':[]};return db[_0x6e25('0x3d')][_0x6e25('0x6a')]({'where':{'id':_0x115ea9[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x899601,null))[_0x6e25('0x20')](function(_0x3520fa){if(_0x3520fa){_0x245ec8[_0x6e25('0x41')]=_['keys'](db[_0x6e25('0x6b')][_0x6e25('0x3e')]);_0x245ec8[_0x6e25('0x43')]=_['keys'](_0x115ea9[_0x6e25('0x43')]);_0x245ec8[_0x6e25('0x4c')]=_[_0x6e25('0x45')](_0x245ec8[_0x6e25('0x41')],_0x245ec8[_0x6e25('0x43')]);_0x5c2575[_0x6e25('0x46')]=_[_0x6e25('0x45')](_0x245ec8['model'],qs[_0x6e25('0x47')](_0x115ea9[_0x6e25('0x43')][_0x6e25('0x47')]));_0x5c2575['attributes']=_0x5c2575[_0x6e25('0x46')]['length']?_0x5c2575[_0x6e25('0x46')]:_0x245ec8[_0x6e25('0x41')];if(!_0x115ea9[_0x6e25('0x43')]['hasOwnProperty'](_0x6e25('0x48'))){_0x5c2575[_0x6e25('0x2e')]=qs[_0x6e25('0x2e')](_0x115ea9[_0x6e25('0x43')][_0x6e25('0x2e')]);_0x5c2575[_0x6e25('0x2c')]=qs[_0x6e25('0x2c')](_0x115ea9[_0x6e25('0x43')][_0x6e25('0x2c')]);}_0x5c2575[_0x6e25('0x49')]=qs[_0x6e25('0x4a')](_0x115ea9['query'][_0x6e25('0x4a')]);_0x5c2575[_0x6e25('0x4b')]=qs['filters'](_['pick'](_0x115ea9['query'],_0x245ec8[_0x6e25('0x4c')]));_0x5c2575['where'][_0x6e25('0x64')]=_0x3520fa['id'];if(_0x115ea9[_0x6e25('0x43')]['filter']){_0x5c2575['where']=_[_0x6e25('0x4e')](_0x5c2575[_0x6e25('0x4b')],{'$or':_[_0x6e25('0x42')](_0x5c2575['attributes'],function(_0x195731){var _0x2a424c={};_0x2a424c[_0x195731]={'$like':'%'+_0x115ea9[_0x6e25('0x43')][_0x6e25('0x50')]+'%'};return _0x2a424c;})});}_0x5c2575=_['merge']({},_0x5c2575,_0x115ea9[_0x6e25('0x51')]);return db[_0x6e25('0x6b')][_0x6e25('0x52')]({'where':_0x5c2575['where']})[_0x6e25('0x20')](function(_0x5e5f45){_0x58ba07[_0x6e25('0x52')]=_0x5e5f45;if(_0x115ea9[_0x6e25('0x43')][_0x6e25('0x5a')]){_0x5c2575[_0x6e25('0x53')]=[{'all':!![]}];}return db[_0x6e25('0x6b')]['findAll'](_0x5c2575);})['then'](function(_0x3cc305){_0x58ba07[_0x6e25('0x55')]=_0x3cc305;return _0x58ba07;});}})[_0x6e25('0x20')](respondWithFilteredResult(_0x899601,_0x5c2575))[_0x6e25('0x29')](handleError(_0x899601,null));};exports[_0x6e25('0x6c')]=function(_0x24bc36,_0x139a90,_0x4a0b20){return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x24bc36[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x139a90,null))[_0x6e25('0x20')](function(_0x12ea7a){if(_0x12ea7a){return _0x12ea7a[_0x6e25('0x6c')](_0x24bc36[_0x6e25('0x43')][_0x6e25('0x68')]);}})[_0x6e25('0x20')](respondWithStatusCode(_0x139a90,null))['catch'](handleError(_0x139a90,null));};exports['notify']=function(_0x36f97b,_0x1cef79,_0x146171){var _0x28dd3b={'channel':_0x6e25('0x6d')};var _0x567ab6=[];var _0x23d6b2=[];var _0x5e6ee4={};return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x36f97b[_0x6e25('0x57')]['id']},'include':[{'model':db[_0x6e25('0x6e')],'as':_0x6e25('0x6f')}]})['then'](handleEntityNotFound(_0x1cef79,null))['then'](function(_0x5d9e2a){_0x28dd3b[_0x6e25('0x70')]=_0x5d9e2a;_0x28dd3b[_0x6e25('0x71')]=_[_0x6e25('0x72')](_0x5d9e2a[_0x6e25('0x6f')],[_0x6e25('0x73')],[_0x6e25('0x74')]);if(_0x28dd3b['account'][_0x6e25('0x6f')]){delete _0x28dd3b[_0x6e25('0x70')][_0x6e25('0x6f')];}return db[_0x6e25('0x75')]['describe']();})[_0x6e25('0x20')](function(_0x131c1c){if(!_0x131c1c){throw new db[(_0x6e25('0x76'))][(_0x6e25('0x77'))]('no\x20available\x20attributes');}_0x567ab6=_[_0x6e25('0x78')](_['keys'](_0x131c1c),['createdAt',_0x6e25('0x79')]);_0x23d6b2=_[_0x6e25('0x78')](_[_0x6e25('0x44')](_0x131c1c),[_0x6e25('0x7a'),'updatedAt',_0x6e25('0x7b'),_0x6e25('0x7c')]);_0x28dd3b[_0x6e25('0x5c')]={'mapKey':_0x6e25('0x7d')};if(_0x28dd3b['account'][_0x6e25('0x7e')]){switch(_0x28dd3b['account'][_0x6e25('0x7e')]){case _0x6e25('0x7f'):_0x28dd3b['body']['from']=_0x36f97b[_0x6e25('0x5c')]['From'];_0x28dd3b[_0x6e25('0x5c')]['body']=_0x36f97b['body'][_0x6e25('0x80')];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x81')]=_0x36f97b[_0x6e25('0x5c')]['MessageSid'];break;case _0x6e25('0x82'):_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')]='+'+_0x36f97b['body'][_0x6e25('0x84')];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x5c')]=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x85')];break;case _0x6e25('0x86'):_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')]=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x83')];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x5c')]=_0x36f97b[_0x6e25('0x5c')]['message'];break;case _0x6e25('0x87'):_0x28dd3b[_0x6e25('0x5c')]['from']=_0x36f97b[_0x6e25('0x5c')]['from'];_0x28dd3b['body']['body']=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x5c')];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x81')]=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x88')];break;case'plivo':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')]=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x89')];_0x28dd3b['body']['body']=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x8a')];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x81')]=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x8b')];break;case _0x6e25('0x8c'):_0x28dd3b['body'][_0x6e25('0x83')]='+'+_0x36f97b['body'][_0x6e25('0x8d')][0x0]['from'];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x5c')]=_0x36f97b['body'][_0x6e25('0x8d')][0x0][_0x6e25('0x85')];_0x28dd3b[_0x6e25('0x5c')]['messageId']=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x8d')][0x0][_0x6e25('0x81')];break;case _0x6e25('0x8e'):_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')]=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x8f')];_0x28dd3b['body'][_0x6e25('0x5c')]=_0x36f97b['body'][_0x6e25('0x90')][_0x6e25('0x28')];break;case _0x6e25('0x91'):_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')]=_0x36f97b['body'][_0x6e25('0x92')];_0x28dd3b['body'][_0x6e25('0x5c')]=_0x36f97b[_0x6e25('0x5c')]['text'];_0x28dd3b['body']['messageId']=_0x36f97b[_0x6e25('0x5c')]['replyMessageId'];break;case _0x6e25('0x93'):_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x81')]=_0x36f97b[_0x6e25('0x5c')][0x0][_0x6e25('0x28')]['id'];_0x28dd3b['body'][_0x6e25('0x83')]=_0x36f97b[_0x6e25('0x5c')][0x0][_0x6e25('0x28')][_0x6e25('0x83')];_0x28dd3b['body'][_0x6e25('0x5c')]=_0x36f97b[_0x6e25('0x5c')][0x0]['message']['text'];break;case _0x6e25('0x94'):_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')]=_0x36f97b[_0x6e25('0x5c')]['from'];_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x5c')]=_0x36f97b[_0x6e25('0x5c')]['message'];_0x28dd3b[_0x6e25('0x5c')]['messageId']=_0x36f97b[_0x6e25('0x5c')][_0x6e25('0x95')];break;}}if(_0x28dd3b['body']['id']){delete _0x28dd3b[_0x6e25('0x5c')]['id'];}if(_[_0x6e25('0x96')](_0x28dd3b['body'][_0x6e25('0x83')])){throw new db[(_0x6e25('0x76'))][(_0x6e25('0x77'))](_0x6e25('0x97'));}if(_[_0x6e25('0x96')](_0x28dd3b[_0x6e25('0x5c')]['body'])||_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x5c')]===''){throw new db[(_0x6e25('0x76'))][(_0x6e25('0x77'))](_0x6e25('0x98'));}if(_[_0x6e25('0x96')](_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x99')])){throw new db[(_0x6e25('0x76'))][(_0x6e25('0x77'))](_0x6e25('0x9a')+_0x23d6b2);}if(!_[_0x6e25('0x9b')](_0x23d6b2,_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x99')])){throw new db[(_0x6e25('0x76'))][(_0x6e25('0x77'))](_0x6e25('0x9c')+_0x23d6b2);}_0x5e6ee4[_0x28dd3b['body'][_0x6e25('0x99')]]=_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')];return db['CmList'][_0x6e25('0x60')]({'where':{'id':_0x28dd3b['account'][_0x6e25('0x7c')]},'include':[{'model':db['CmContact'],'as':_0x6e25('0x9d'),'where':_0x5e6ee4,'limit':0x1,'order':[['updatedAt',_0x6e25('0x9e')]]}]});})[_0x6e25('0x20')](handleEntityNotFound(_0x1cef79,null))[_0x6e25('0x20')](function(_0x77db75){if(_0x77db75){_0x28dd3b[_0x6e25('0x9f')]=_['omit'](_0x77db75,[_0x6e25('0x9d')]);if(_0x77db75[_0x6e25('0x9d')][_0x6e25('0x59')]){return _0x77db75[_0x6e25('0x9d')][0x0];}var _0x16a5a7=_['defaults'](_0x28dd3b[_0x6e25('0x5c')],{'firstName':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')],'ListId':_0x77db75['id']});_0x16a5a7[_0x28dd3b['body'][_0x6e25('0x99')]]=_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')];return db[_0x6e25('0x75')][_0x6e25('0x5b')](_0x16a5a7,{'fields':_0x567ab6,'raw':!![]});}})[_0x6e25('0x20')](handleEntityNotFound(_0x1cef79,null))['then'](function(_0x2c3256){if(_0x2c3256){_0x28dd3b[_0x6e25('0xa0')]=_0x2c3256;var _0x26c182={'ContactId':_0x2c3256['id'],'phone':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')],'SmsAccountId':_0x36f97b['params']['id']};var _0xb557af={'ContactId':_0x2c3256['id'],'SmsAccountId':_0x36f97b[_0x6e25('0x57')]['id'],'closed':![]};return db[_0x6e25('0xa1')][_0x6e25('0x60')]({'where':_0xb557af})['then'](function(_0x2b6e88){if(_0x2b6e88){return[_0x2b6e88,![]];}return db['SmsInteraction']['create'](_0x26c182)[_0x6e25('0x20')](function(_0x5009e3){return[_0x5009e3,!![]];});});}})[_0x6e25('0xa2')](function(_0xfa2098,_0x417af8){_0x28dd3b[_0x6e25('0xa3')]=_0xfa2098[_0x6e25('0x35')]({'plain':!![]});_0x28dd3b['interaction'][_0x6e25('0xa4')]=![];if(_0x417af8){if(_0x28dd3b[_0x6e25('0x70')][_0x6e25('0xa5')]){_0x28dd3b[_0x6e25('0x71')][_0x6e25('0xa6')]({'id':0x0,'priority':_0x28dd3b['applications'][_0x6e25('0x59')]+0x1,'app':_0x6e25('0xa7'),'appdata':_0x6e25('0xa8'),'interval':_0x6e25('0xa9')});}_0x28dd3b[_0x6e25('0xa3')][_0x6e25('0xa4')]=!![];}return db['SmsMessage'][_0x6e25('0x5b')]({'phone':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x83')],'messageId':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x81')],'body':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0x5c')],'SmsAccountId':_0x36f97b['params']['id'],'SmsInteractionId':_0xfa2098['id'],'direction':'in','ContactId':_0xfa2098[_0x6e25('0xaa')],'AttachmentId':_0x28dd3b[_0x6e25('0x5c')][_0x6e25('0xab')]});})[_0x6e25('0x20')](function(_0xa7cfc1){_0x28dd3b[_0x6e25('0x28')]=_0xa7cfc1;if(_0x28dd3b[_0x6e25('0xa3')][_0x6e25('0xac')]){return db['User'][_0x6e25('0x60')]({'attributes':['id','name'],'where':{'id':_0x28dd3b[_0x6e25('0xa3')][_0x6e25('0xac')]}})[_0x6e25('0x20')](function(_0x86145f){if(_0x86145f){_0x28dd3b['applications'][_0x6e25('0xad')]({'id':0x0,'priority':0x0,'app':_0x6e25('0xae'),'appdata':_0x86145f['name']+','+(_0x28dd3b[_0x6e25('0x70')]['waitForTheAssignedAgent']||0xa),'interval':_0x6e25('0xa9')});}return respondWithRpcPromise(_0x6e25('0xaf'),'startRouting',_0x28dd3b);});}return respondWithRpcPromise('Start',_0x6e25('0xb0'),_0x28dd3b);})[_0x6e25('0x20')](function(_0x139961){if(_0x139961){var _0x3958d4=0xc8;var _0xe753dd=_0x6e25('0xb1');logger[_0x6e25('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe753dd,_0x3958d4,_0x6e25('0xb2'));logger[_0x6e25('0xb3')](_0x6e25('0xb4'),_0xe753dd,_0x3958d4,_0x6e25('0xb2'),JSON[_0x6e25('0x25')](_0x139961));if(_0x28dd3b['account'][_0x6e25('0x7e')]===_0x6e25('0x7f')){return _0x1cef79['status'](_0x3958d4)[_0x6e25('0x2f')](_0x6e25('0xb5'),'text/xml')[_0x6e25('0x3a')](_0x6e25('0xb6'));}else{return _0x1cef79[_0x6e25('0x2b')](_0x3958d4)['json'](_0x139961);}}})[_0x6e25('0x29')](handleError(_0x1cef79,null));};exports[_0x6e25('0xb7')]=function(_0x2d00d6,_0x272b2d){var _0x53c834=_0x2d00d6[_0x6e25('0x57')]['id'];var _0x34234e=_0x2d00d6[_0x6e25('0x5c')];var _0x19d645=0xc8;var _0x409441=null;return db[_0x6e25('0xb8')][_0x6e25('0xb9')]({'isolationLevel':db[_0x6e25('0xb8')][_0x6e25('0xba')]['ISOLATION_LEVELS'][_0x6e25('0xbb')]},function(_0x3de78a){return db[_0x6e25('0x3d')][_0x6e25('0x6a')]({'where':{'id':_0x53c834},'transaction':_0x3de78a})[_0x6e25('0x20')](function(_0x3f3de9){if(_0x3f3de9){return db[_0x6e25('0x6e')][_0x6e25('0x37')]({'where':{'SmsAccountId':_0x53c834},'transaction':_0x3de78a})['then'](function(){var _0x462d92=_[_0x6e25('0x42')](_0x34234e,function(_0xa28320){_0xa28320[_0x6e25('0x64')]=_0x53c834;return _0xa28320;});return db['SmsApplication']['bulkCreate'](_0x462d92,{'transaction':_0x3de78a});});}else{_0x19d645=0x194;_0x409441=[];}});})[_0x6e25('0x20')](function(){if(_0x19d645!==0x194){return db['SmsApplication'][_0x6e25('0xbc')]({'where':{'SmsAccountId':_0x53c834},'order':_0x6e25('0x73')})['then'](function(_0x5163cc){_0x409441=_0x5163cc;});}})[_0x6e25('0x29')](function(_0x570848){_0x19d645=0x1f4;logger[_0x6e25('0x26')](_0x570848[_0x6e25('0xbd')]);if(_0x570848[_0x6e25('0x39')]){delete _0x570848[_0x6e25('0x39')];}_0x409441=_0x570848;})[_0x6e25('0xbe')](function(){if(_0x409441===null){_0x272b2d[_0x6e25('0x2a')](_0x19d645);}else{if(_0x19d645===0x1f4){_0x272b2d[_0x6e25('0x2b')](_0x19d645)['send'](_0x409441);}else{_0x272b2d[_0x6e25('0x2b')](_0x19d645)[_0x6e25('0x31')](_0x409441);}}});};exports['getApplications']=function(_0x487674,_0x32b254,_0x267326){var _0xf890c8={};var _0x250ca8={};var _0x383ae2;var _0x329f45;return db[_0x6e25('0x3d')][_0x6e25('0x6a')]({'where':{'id':_0x487674[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x32b254,null))[_0x6e25('0x20')](function(_0x28363d){if(_0x28363d){_0x383ae2=_0x28363d;_0x250ca8[_0x6e25('0x41')]=_[_0x6e25('0x44')](db[_0x6e25('0x6e')]['rawAttributes']);_0x250ca8[_0x6e25('0x43')]=_[_0x6e25('0x44')](_0x487674[_0x6e25('0x43')]);_0x250ca8[_0x6e25('0x4c')]=_[_0x6e25('0x45')](_0x250ca8[_0x6e25('0x41')],_0x250ca8[_0x6e25('0x43')]);_0xf890c8['attributes']=_['intersection'](_0x250ca8[_0x6e25('0x41')],qs[_0x6e25('0x47')](_0x487674[_0x6e25('0x43')][_0x6e25('0x47')]));_0xf890c8[_0x6e25('0x46')]=_0xf890c8[_0x6e25('0x46')][_0x6e25('0x59')]?_0xf890c8[_0x6e25('0x46')]:_0x250ca8[_0x6e25('0x41')];_0xf890c8[_0x6e25('0x49')]=qs[_0x6e25('0x4a')](_0x487674['query'][_0x6e25('0x4a')]);_0xf890c8[_0x6e25('0x4b')]=qs[_0x6e25('0x4c')](_['pick'](_0x487674[_0x6e25('0x43')],_0x250ca8[_0x6e25('0x4c')]));if(_0x487674['query']['filter']){_0xf890c8[_0x6e25('0x4b')]=_['merge'](_0xf890c8[_0x6e25('0x4b')],{'$or':_[_0x6e25('0x42')](_0xf890c8[_0x6e25('0x46')],function(_0x39f3cb){var _0x45a941={};_0x45a941[_0x39f3cb]={'$like':'%'+_0x487674[_0x6e25('0x43')][_0x6e25('0x50')]+'%'};return _0x45a941;})});}_0xf890c8=_[_0x6e25('0x4e')]({},_0xf890c8,_0x487674['options']);return _0x383ae2[_0x6e25('0xbf')](_0xf890c8);}})[_0x6e25('0x20')](function(_0xe666d9){if(_0xe666d9){_0x329f45=_0xe666d9[_0x6e25('0x59')];if(!_0x487674[_0x6e25('0x43')][_0x6e25('0x66')](_0x6e25('0x48'))){_0xf890c8[_0x6e25('0x2e')]=qs[_0x6e25('0x2e')](_0x487674[_0x6e25('0x43')][_0x6e25('0x2e')]);_0xf890c8[_0x6e25('0x2c')]=qs['offset'](_0x487674['query'][_0x6e25('0x2c')]);}return _0x383ae2[_0x6e25('0xbf')](_0xf890c8);}})['then'](function(_0x417b45){if(_0x417b45){return _0x417b45?{'count':_0x329f45,'rows':_0x417b45}:null;}})['then'](respondWithResult(_0x32b254,null))[_0x6e25('0x29')](handleError(_0x32b254,null));};exports[_0x6e25('0xc0')]=function(_0x377dcd,_0x4a4336,_0x439f07){var _0x5bf05b={'raw':![],'where':{}};var _0x13f2c0={};var _0x14a4a8={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x377dcd[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x4a4336,null))[_0x6e25('0x20')](function(_0x41f02f){if(_0x41f02f){_0x13f2c0[_0x6e25('0x41')]=_[_0x6e25('0x44')](db[_0x6e25('0xa1')]['rawAttributes']);_0x13f2c0['query']=_[_0x6e25('0x44')](_0x377dcd[_0x6e25('0x43')]);_0x13f2c0[_0x6e25('0x4c')]=_[_0x6e25('0x45')](_0x13f2c0['model'],_0x13f2c0[_0x6e25('0x43')]);_0x5bf05b[_0x6e25('0x46')]=_[_0x6e25('0x45')](_0x13f2c0['model'],qs[_0x6e25('0x47')](_0x377dcd[_0x6e25('0x43')][_0x6e25('0x47')]));_0x5bf05b[_0x6e25('0x46')]=_0x5bf05b[_0x6e25('0x46')][_0x6e25('0x59')]?_0x5bf05b[_0x6e25('0x46')]:_0x13f2c0[_0x6e25('0x41')];if(!_0x377dcd['query'][_0x6e25('0x66')](_0x6e25('0x48'))){_0x5bf05b[_0x6e25('0x2e')]=qs[_0x6e25('0x2e')](_0x377dcd['query']['limit']);_0x5bf05b[_0x6e25('0x2c')]=qs[_0x6e25('0x2c')](_0x377dcd[_0x6e25('0x43')][_0x6e25('0x2c')]);}_0x5bf05b['order']=qs[_0x6e25('0x4a')](_0x377dcd[_0x6e25('0x43')][_0x6e25('0x4a')]);_0x5bf05b[_0x6e25('0x4b')]=qs['filters'](_[_0x6e25('0x4d')](_0x377dcd[_0x6e25('0x43')],_0x13f2c0[_0x6e25('0x4c')]));_0x5bf05b['where']['SmsAccountId']=_0x41f02f['id'];if(_0x377dcd[_0x6e25('0x43')]['filter']){_0x5bf05b['where']=_[_0x6e25('0x4e')](_0x5bf05b[_0x6e25('0x4b')],{'$or':_[_0x6e25('0x42')](_0x5bf05b[_0x6e25('0x46')],function(_0x357b4b){var _0x14a538={};_0x14a538[_0x357b4b]={'$like':'%'+_0x377dcd[_0x6e25('0x43')][_0x6e25('0x50')]+'%'};return _0x14a538;})});}_0x5bf05b=_[_0x6e25('0x4e')]({},_0x5bf05b,_0x377dcd[_0x6e25('0x51')]);return db[_0x6e25('0xa1')]['count']({'where':_0x5bf05b[_0x6e25('0x4b')]})['then'](function(_0x57aa7f){_0x14a4a8[_0x6e25('0x52')]=_0x57aa7f;if(_0x377dcd[_0x6e25('0x43')]['includeAll']){_0x5bf05b[_0x6e25('0x53')]=[{'model':db[_0x6e25('0x75')],'as':_0x6e25('0xc1'),'required':![]},{'model':db['User'],'as':_0x6e25('0xc2'),'attributes':[_0x6e25('0x39'),_0x6e25('0xc3'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x6e25('0xc4'),'attributes':['id',_0x6e25('0x39'),_0x6e25('0xc5')],'where':_0x377dcd[_0x6e25('0x43')][_0x6e25('0xc6')]?{'id':_0x377dcd[_0x6e25('0x43')]['tag']}:undefined,'required':_0x377dcd[_0x6e25('0x43')][_0x6e25('0xc6')]?!![]:![]}];}return db['SmsInteraction'][_0x6e25('0x54')](_0x5bf05b);})[_0x6e25('0x20')](function(_0x149a58){_0x14a4a8[_0x6e25('0x55')]=_0x149a58;return _0x14a4a8;});}})[_0x6e25('0x20')](respondWithFilteredResult(_0x4a4336,_0x5bf05b))[_0x6e25('0x29')](handleError(_0x4a4336,null));};exports[_0x6e25('0x3a')]=function(_0x4968d6,_0x237180,_0x454764){var _0x5127f4,_0x66189f,_0x5be18e;if(_['isNil'](_0x4968d6['body'][_0x6e25('0x5c')])||_0x4968d6[_0x6e25('0x5c')][_0x6e25('0x5c')]===''){throw new db[(_0x6e25('0x76'))][(_0x6e25('0x77'))](_0x6e25('0x98'));}if(_[_0x6e25('0x96')](_0x4968d6['body']['to'])){throw new db[(_0x6e25('0x76'))]['ValidationError']('to\x20is\x20mandatory');}_0x5127f4=_0x4968d6[_0x6e25('0x5c')]['to'];return db['SmsAccount'][_0x6e25('0x60')]({'where':{'id':_0x4968d6['params']['id']},'include':[{'model':db['CmList'],'as':_0x6e25('0xc7'),'include':[{'model':db[_0x6e25('0x75')],'as':_0x6e25('0x9d'),'where':{'mobile':_0x5127f4},'limit':0x1,'order':[[_0x6e25('0x79'),_0x6e25('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x237180,null))[_0x6e25('0x20')](function(_0x40a619){if(_0x40a619&&_0x40a619['List']){_0x66189f=_0x40a619[_0x6e25('0x35')]({'plain':!![]});if(_0x66189f[_0x6e25('0xc7')]&&_0x66189f[_0x6e25('0xc7')]['Contacts'][_0x6e25('0x59')]){return _0x66189f['List'][_0x6e25('0x9d')][0x0];}return db['CmContact'][_0x6e25('0x5b')](_[_0x6e25('0x19')](_0x4968d6[_0x6e25('0x5c')],{'firstName':_0x5127f4,'mobile':_0x5127f4,'phone':_0x5127f4,'ListId':_0x66189f['ListId']}));}})[_0x6e25('0x20')](handleEntityNotFound(_0x237180,null))[_0x6e25('0x20')](function(_0x50063f){if(_0x50063f){_0x5be18e=_0x50063f;return db[_0x6e25('0xa1')][_0x6e25('0x60')]({'where':{'ContactId':_0x5be18e['id'],'closed':![],'SmsAccountId':_0x66189f['id']}})[_0x6e25('0x20')](function(_0x4f3306){if(_0x4f3306){return[_0x4f3306,![]];}return db['SmsInteraction'][_0x6e25('0x5b')]({'UserId':_0x4968d6['user']['id'],'ContactId':_0x5be18e['id'],'SmsAccountId':_0x66189f['id'],'phone':_0x5127f4,'firstMsgDirection':'out','Messages':[_[_0x6e25('0x4e')](_0x4968d6[_0x6e25('0x5c')],{'read':![],'body':_0x4968d6[_0x6e25('0x5c')][_0x6e25('0x5c')],'phone':_0x5127f4,'SmsAccountId':_0x66189f['id'],'UserId':_0x4968d6[_0x6e25('0x5d')]['id'],'ContactId':_0x5be18e['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6e25('0xc8')}]})[_0x6e25('0x20')](function(_0x32ac52){return[_0x32ac52,!![]];});});}})['spread'](function(_0x2567e4,_0x5ddff0){if(_0x5ddff0){return _0x2567e4;}return db['SmsMessage'][_0x6e25('0x5b')](_[_0x6e25('0x4e')](_0x4968d6[_0x6e25('0x5c')],{'read':![],'body':_0x4968d6[_0x6e25('0x5c')][_0x6e25('0x5c')],'phone':_0x5127f4,'SmsAccountId':_0x66189f['id'],'SmsInteractionId':_0x2567e4['id'],'UserId':_0x4968d6[_0x6e25('0x5d')]['id'],'ContactId':_0x5be18e['id']}))[_0x6e25('0x20')](function(_0x9afaca){_0x2567e4[_0x6e25('0xc9')][_0x6e25('0xc8')]=[];_0x2567e4[_0x6e25('0xc9')][_0x6e25('0xc8')][_0x6e25('0xa6')](_0x9afaca[_0x6e25('0xc9')]);return _0x2567e4;});})['then'](respondWithResult(_0x237180,null))[_0x6e25('0x29')](handleError(_0x237180,null));};exports['status']=function(_0x5bf43e,_0x5b5311,_0x221a4a){if(_0x5bf43e[_0x6e25('0x5c')]['id']){delete _0x5bf43e[_0x6e25('0x5c')]['id'];}var _0x16e21b,_0x5b6dad,_0x4ea41f;return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x5bf43e[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x5b5311,null))['then'](function(_0xfdaad0){if(_0xfdaad0){_0x4ea41f=_0xfdaad0;logger[_0x6e25('0xb3')](_0x6e25('0x23'),'status',_0x6e25('0xca'),_0xfdaad0[_0x6e25('0x7e')],util[_0x6e25('0xcb')](_0x5bf43e[_0x6e25('0x5c')],{'showHidden':![],'depth':null}));switch(_0xfdaad0['type']){case _0x6e25('0x82'):if(_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xcc')]&&_0x5bf43e[_0x6e25('0x5c')]['status']){_0x5b6dad=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x2b')];return db[_0x6e25('0xcd')]['find']({'where':{'messageId':_0x5bf43e['body']['skebby_dispatch_id']}});}break;case _0x6e25('0x86'):if(_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xce')]&&_0x5bf43e[_0x6e25('0x5c')]['statusInt']){_0x5b6dad=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xcf')];return db[_0x6e25('0xcd')][_0x6e25('0x60')]({'where':{'messageId':_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xce')]}});}break;case _0x6e25('0x87'):if(_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x88')]&&_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xd0')]){_0x5b6dad=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xd0')];return db[_0x6e25('0xcd')]['find']({'where':{'messageId':_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x88')]}});}break;case _0x6e25('0x8c'):var _0x151fbd=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x8d')][0x0];if(_0x151fbd[_0x6e25('0x81')]&&_0x151fbd[_0x6e25('0x2b')][_0x6e25('0xd1')]==='DELIVERED'){_0x5b6dad=_0x151fbd[_0x6e25('0x2b')][_0x6e25('0xd1')];return db[_0x6e25('0xcd')][_0x6e25('0x60')]({'where':{'messageId':_0x151fbd[_0x6e25('0x81')]}});}break;case'clickatell':if(_0x5bf43e[_0x6e25('0x5c')]['messageId']&&_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x2b')]){_0x5b6dad=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x81')]}});}break;case'bandwidth':if(_0x5bf43e[_0x6e25('0x5c')][0x0][_0x6e25('0x28')]['id']){_0x5b6dad=_0x5bf43e[_0x6e25('0x5c')][0x0][_0x6e25('0x7e')];return db[_0x6e25('0xcd')][_0x6e25('0x60')]({'where':{'messageId':_0x5bf43e['body'][0x0][_0x6e25('0x28')]['id']}});}break;case'intelepeer':if(_0x5bf43e['body']['redif']&&_0x5bf43e['body'][_0x6e25('0x2b')]){_0x5b6dad=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x2b')];return db[_0x6e25('0xcd')]['find']({'where':{'messageId':_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0xd2')]}});}break;}}})[_0x6e25('0x20')](handleEntityNotFound(_0x5b5311,null))['then'](function(_0x47c2fe){if(_0x47c2fe){_0x16e21b=_0x47c2fe;switch(_0x4ea41f[_0x6e25('0x7e')]){case _0x6e25('0x82'):if(_0x5b6dad==='DELIVERED'){return _0x16e21b[_0x6e25('0x34')]({'read':!![]});}else{logger[_0x6e25('0x26')](_0x6e25('0x23'),_0x6e25('0x2b'),_0x6e25('0x82'),util['inspect'](_0x5bf43e['body'],{'showHidden':![],'depth':null}));}break;case _0x6e25('0x86'):if(_0x5b6dad==='1'){return _0x16e21b[_0x6e25('0x34')]({'read':!![]});}else{logger[_0x6e25('0x26')](_0x6e25('0x23'),'status',_0x6e25('0x82'),util[_0x6e25('0xcb')](_0x5bf43e['body'],{'showHidden':![],'depth':null}));}break;case _0x6e25('0x87'):if(!_0x5bf43e['body'][_0x6e25('0xd3')]&&_0x5b6dad>=0xc8&&_0x5b6dad<=0xce){return _0x16e21b['update']({'read':!![]});}else{logger[_0x6e25('0x26')](_0x6e25('0x23'),_0x6e25('0x2b'),_0x6e25('0x87'),util['inspect'](_0x5bf43e[_0x6e25('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3b2cfd=_0x5bf43e[_0x6e25('0x5c')][_0x6e25('0x8d')][0x0];if(_0x3b2cfd[_0x6e25('0x2b')][_0x6e25('0xd1')]===_0x6e25('0xd4')){return _0x16e21b[_0x6e25('0x34')]({'read':!![]});}else{logger['error'](_0x6e25('0x23'),_0x6e25('0x2b'),_0x6e25('0x8c'),util[_0x6e25('0xcb')](_0x5bf43e[_0x6e25('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6e25('0x91'):if(_0x5b6dad=='DELIVERED_TO_GATEWAY'||_0x5b6dad=='RECEIVED_BY_RECIPIENT'){return _0x16e21b[_0x6e25('0x34')]({'read':!![]});}else{logger[_0x6e25('0x26')](_0x6e25('0x23'),'status',_0x6e25('0x91'),util['inspect'](_0x5bf43e['body'],{'showHidden':![],'depth':null}));}break;case _0x6e25('0x93'):if(_0x5b6dad==_0x6e25('0xd5')){return _0x16e21b['update']({'read':!![]});}else{logger[_0x6e25('0x26')](_0x6e25('0x23'),_0x6e25('0x2b'),_0x6e25('0x93'),util[_0x6e25('0xcb')](_0x5bf43e[_0x6e25('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6e25('0x94'):if(_0x5b6dad===_0x6e25('0xd6')||_0x5b6dad==='ACCEPTD'){return _0x16e21b[_0x6e25('0x34')]({'read':!![]});}else{logger[_0x6e25('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6e25('0x2b'),_0x6e25('0x94'),util['inspect'](_0x5bf43e[_0x6e25('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x16e21b;}})[_0x6e25('0x20')](respondWithResult(_0x5b5311,null))[_0x6e25('0x29')](handleError(_0x5b5311,null));};exports[_0x6e25('0xd7')]=function(_0x387c64,_0x566185,_0x31e80c){var _0x557715,_0x1da60d,_0x5f548a;return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x387c64[_0x6e25('0x57')]['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x566185,null))[_0x6e25('0x20')](function(_0x315e1a){if(_0x315e1a){_0x5f548a=_0x315e1a;logger[_0x6e25('0xb3')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6e25('0x2b'),'received\x20delivery\x20report\x20from',_0x315e1a['type'],util['inspect'](_0x387c64[_0x6e25('0x43')],{'showHidden':![],'depth':null}));switch(_0x315e1a['type']){case'csc':if(_0x387c64['query'][_0x6e25('0xd8')]&&_0x387c64[_0x6e25('0x43')][_0x6e25('0xd9')]){_0x1da60d=_0x387c64[_0x6e25('0x43')][_0x6e25('0xd9')];return db[_0x6e25('0xcd')][_0x6e25('0x60')]({'where':{'messageId':_0x387c64[_0x6e25('0x43')][_0x6e25('0xd8')]}});}break;}}})[_0x6e25('0x20')](handleEntityNotFound(_0x566185,null))[_0x6e25('0x20')](function(_0x4381a2){if(_0x4381a2){_0x557715=_0x4381a2;switch(_0x5f548a[_0x6e25('0x7e')]){case _0x6e25('0x8e'):if(_0x1da60d==='2'||_0x1da60d==='6'){return _0x557715[_0x6e25('0x34')]({'read':!![]});}else{logger['error'](_0x6e25('0x23'),_0x6e25('0x2b'),'csc',util[_0x6e25('0xcb')](_0x387c64[_0x6e25('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x557715;}})['then'](respondWithResult(_0x566185,null))['catch'](handleError(_0x566185,null));};exports['addAgents']=function(_0x864753,_0x4ae8e4,_0x399e34){return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x864753['params']['id']}})[_0x6e25('0x20')](handleEntityNotFound(_0x4ae8e4,null))[_0x6e25('0x20')](function(_0x5d46f7){if(_0x5d46f7){return _0x5d46f7[_0x6e25('0xda')](_0x864753[_0x6e25('0x5c')][_0x6e25('0x68')],_[_0x6e25('0xdb')](_0x864753[_0x6e25('0x5c')],[_0x6e25('0x68'),'id'])||{})['spread'](function(_0x20c9d8){for(var _0x1a6420=0x0;_0x1a6420<_0x864753[_0x6e25('0x5c')][_0x6e25('0x68')][_0x6e25('0x59')];_0x1a6420+=0x1){socket['emit'](_0x6e25('0xdc'),{'UserId':Number(_0x864753['body'][_0x6e25('0x68')][_0x1a6420]),'SmsAccountId':Number(_0x864753[_0x6e25('0x57')]['id'])});}return _0x20c9d8;});}})[_0x6e25('0x20')](respondWithResult(_0x4ae8e4,null))[_0x6e25('0x29')](handleError(_0x4ae8e4,null));};exports[_0x6e25('0xdd')]=function(_0x5b9009,_0x321b78,_0xd9af3d){return db[_0x6e25('0x3d')][_0x6e25('0x60')]({'where':{'id':_0x5b9009['params']['id']}})['then'](handleEntityNotFound(_0x321b78,null))[_0x6e25('0x20')](function(_0xe4509a){if(_0xe4509a){return _0xe4509a['removeAgents'](_0x5b9009[_0x6e25('0x43')]['ids'])['then'](function(){if(_[_0x6e25('0xde')](_0x5b9009[_0x6e25('0x43')][_0x6e25('0x68')])){for(var _0x12b419=0x0;_0x12b419<_0x5b9009['query']['ids'][_0x6e25('0x59')];_0x12b419+=0x1){socket['emit'](_0x6e25('0xdf'),{'UserId':Number(_0x5b9009[_0x6e25('0x43')][_0x6e25('0x68')][_0x12b419]),'SmsAccountId':Number(_0x5b9009[_0x6e25('0x57')]['id'])});}}else{socket[_0x6e25('0xe0')](_0x6e25('0xdf'),{'UserId':Number(_0x5b9009[_0x6e25('0x43')][_0x6e25('0x68')]),'SmsAccountId':Number(_0x5b9009[_0x6e25('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x321b78,null))['catch'](handleError(_0x321b78,null));};exports[_0x6e25('0xe1')]=function(_0x302aa7,_0x3bd063,_0x34cd95){var _0x47e3ee={};var _0x468c5b={};var _0x3234f8;var _0x54faec;return db[_0x6e25('0x3d')][_0x6e25('0x6a')]({'where':{'id':_0x302aa7[_0x6e25('0x57')]['id']}})['then'](handleEntityNotFound(_0x3bd063,null))['then'](function(_0x247d74){if(_0x247d74){_0x3234f8=_0x247d74;_0x468c5b[_0x6e25('0x41')]=_[_0x6e25('0x44')](db['User'][_0x6e25('0x3e')]);_0x468c5b[_0x6e25('0x43')]=_['keys'](_0x302aa7['query']);_0x468c5b[_0x6e25('0x4c')]=_['intersection'](_0x468c5b['model'],_0x468c5b[_0x6e25('0x43')]);_0x47e3ee[_0x6e25('0x46')]=_[_0x6e25('0x45')](_0x468c5b[_0x6e25('0x41')],qs[_0x6e25('0x47')](_0x302aa7[_0x6e25('0x43')][_0x6e25('0x47')]));_0x47e3ee[_0x6e25('0x46')]=_0x47e3ee[_0x6e25('0x46')]['length']?_0x47e3ee[_0x6e25('0x46')]:_0x468c5b[_0x6e25('0x41')];_0x47e3ee[_0x6e25('0x49')]=qs[_0x6e25('0x4a')](_0x302aa7[_0x6e25('0x43')][_0x6e25('0x4a')]);_0x47e3ee[_0x6e25('0x4b')]=qs[_0x6e25('0x4c')](_['pick'](_0x302aa7[_0x6e25('0x43')],_0x468c5b[_0x6e25('0x4c')]));if(_0x302aa7[_0x6e25('0x43')][_0x6e25('0x50')]){_0x47e3ee[_0x6e25('0x4b')]=_[_0x6e25('0x4e')](_0x47e3ee[_0x6e25('0x4b')],{'$or':_[_0x6e25('0x42')](_0x47e3ee['attributes'],function(_0x41db05){var _0x1d1f3d={};_0x1d1f3d[_0x41db05]={'$like':'%'+_0x302aa7[_0x6e25('0x43')][_0x6e25('0x50')]+'%'};return _0x1d1f3d;})});}_0x47e3ee=_[_0x6e25('0x4e')]({},_0x47e3ee,_0x302aa7[_0x6e25('0x51')]);return _0x3234f8['getAgents'](_0x47e3ee);}})[_0x6e25('0x20')](function(_0x5d9937){if(_0x5d9937){_0x54faec=_0x5d9937[_0x6e25('0x59')];if(!_0x302aa7[_0x6e25('0x43')][_0x6e25('0x66')](_0x6e25('0x48'))){_0x47e3ee[_0x6e25('0x2e')]=qs[_0x6e25('0x2e')](_0x302aa7[_0x6e25('0x43')][_0x6e25('0x2e')]);_0x47e3ee[_0x6e25('0x2c')]=qs[_0x6e25('0x2c')](_0x302aa7['query'][_0x6e25('0x2c')]);}return _0x3234f8[_0x6e25('0xe1')](_0x47e3ee);}})['then'](function(_0x51dec2){if(_0x51dec2){return _0x51dec2?{'count':_0x54faec,'rows':_0x51dec2}:null;}})['then'](respondWithResult(_0x3bd063,null))[_0x6e25('0x29')](handleError(_0x3bd063,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ef8e641..f18b948 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 _0x2dd8=['../../mysqldb','save','update','remove','hasOwnProperty','hook'];(function(_0x20ad70,_0x301f5b){var _0x53509c=function(_0x14c70f){while(--_0x14c70f){_0x20ad70['push'](_0x20ad70['shift']());}};_0x53509c(++_0x301f5b);}(_0x2dd8,0xf0));var _0x82dd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dd8[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x82dd('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82dd('0x1'),'afterUpdate':_0x82dd('0x2'),'afterDestroy':_0x82dd('0x3')};function emitEvent(_0x3993dc){return function(_0x537c13,_0x248e10,_0x4e3a5f){SmsAccountEvents['emit'](_0x3993dc+':'+_0x537c13['id'],_0x537c13);SmsAccountEvents['emit'](_0x3993dc,_0x537c13);_0x4e3a5f(null);};}for(var e in events){if(events[_0x82dd('0x4')](e)){var event=events[e];SmsAccount[_0x82dd('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xd8b9=['hook','exports','events','SmsAccount','setMaxListeners','emit','hasOwnProperty'];(function(_0x583929,_0x1c46a0){var _0x59b3ea=function(_0x176a71){while(--_0x176a71){_0x583929['push'](_0x583929['shift']());}};_0x59b3ea(++_0x1c46a0);}(_0xd8b9,0xf7));var _0x9d8b=function(_0x4ee207,_0x2fa141){_0x4ee207=_0x4ee207-0x0;var _0x338168=_0xd8b9[_0x4ee207];return _0x338168;};'use strict';var EventEmitter=require(_0x9d8b('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x9d8b('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9d8b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35467c){return function(_0x513ee0,_0x4839d7,_0x172984){SmsAccountEvents[_0x9d8b('0x3')](_0x35467c+':'+_0x513ee0['id'],_0x513ee0);SmsAccountEvents[_0x9d8b('0x3')](_0x35467c,_0x513ee0);_0x172984(null);};}for(var e in events){if(events[_0x9d8b('0x4')](e)){var event=events[e];SmsAccount[_0x9d8b('0x5')](e,emitEvent(event));}}module[_0x9d8b('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 5f1c58d..2601d35 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 _0x83c9=['bluebird','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','api'];(function(_0x5b3302,_0x2c5760){var _0x47f39d=function(_0x24fe9c){while(--_0x24fe9c){_0x5b3302['push'](_0x5b3302['shift']());}};_0x47f39d(++_0x2c5760);}(_0x83c9,0x1b5));var _0x983c=function(_0xa1671c,_0x57700d){_0xa1671c=_0xa1671c-0x0;var _0x2107f0=_0x83c9[_0xa1671c];return _0x2107f0;};'use strict';var _=require(_0x983c('0x0'));var util=require(_0x983c('0x1'));var logger=require('../../config/logger')(_0x983c('0x2'));var moment=require('moment');var BPromise=require(_0x983c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x983c('0x4'));var config=require(_0x983c('0x5'));var attributes=require('./smsAccount.attributes');module[_0x983c('0x6')]=function(_0x54b389,_0x4a9712){return _0x54b389[_0x983c('0x7')](_0x983c('0x8'),attributes,{'tableName':_0x983c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8f1=['lodash','util','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts'];(function(_0x300a4d,_0x30dd6f){var _0x291ef5=function(_0x287fcf){while(--_0x287fcf){_0x300a4d['push'](_0x300a4d['shift']());}};_0x291ef5(++_0x30dd6f);}(_0xc8f1,0xb0));var _0x1c8f=function(_0x3298cf,_0x20986b){_0x3298cf=_0x3298cf-0x0;var _0x414814=_0xc8f1[_0x3298cf];return _0x414814;};'use strict';var _=require(_0x1c8f('0x0'));var util=require(_0x1c8f('0x1'));var logger=require('../../config/logger')(_0x1c8f('0x2'));var moment=require(_0x1c8f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c8f('0x4'));var rimraf=require(_0x1c8f('0x5'));var config=require(_0x1c8f('0x6'));var attributes=require(_0x1c8f('0x7'));module[_0x1c8f('0x8')]=function(_0x36142d,_0x197dab){return _0x36142d['define'](_0x1c8f('0x9'),attributes,{'tableName':_0x1c8f('0xa'),'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 1a75f68..bfaf04b 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 _0xf279=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug'];(function(_0x1d402b,_0x37c73b){var _0x5a17ee=function(_0x1b41f4){while(--_0x1b41f4){_0x1d402b['push'](_0x1d402b['shift']());}};_0x5a17ee(++_0x37c73b);}(_0xf279,0xe4));var _0x9f27=function(_0x528ffb,_0x2df4e0){_0x528ffb=_0x528ffb-0x0;var _0x41895=_0xf279[_0x528ffb];return _0x41895;};'use strict';var _=require(_0x9f27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9f27('0x1'));var rs=require(_0x9f27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f27('0x3'))['db'];var utils=require(_0x9f27('0x4'));var logger=require('../../config/logger')(_0x9f27('0x5'));var config=require('../../config/environment');var jayson=require(_0x9f27('0x6'));var client=jayson[_0x9f27('0x7')][_0x9f27('0x8')]({'port':0x232a});config[_0x9f27('0x9')]=_[_0x9f27('0xa')](config[_0x9f27('0x9')],{'host':_0x9f27('0xb'),'port':0x18eb});var socket=require(_0x9f27('0xc'))(new Redis(config[_0x9f27('0x9')]));require(_0x9f27('0xd'))[_0x9f27('0xe')](socket);function respondWithRpcPromise(_0x528a27,_0x5d5dfc,_0x579ac1){return new BPromise(function(_0x110fe9,_0x1bcabe){return client[_0x9f27('0xf')](_0x528a27,_0x579ac1)[_0x9f27('0x10')](function(_0x50bad3){logger[_0x9f27('0x11')](_0x9f27('0x12'),_0x5d5dfc,'request\x20sent');logger['debug'](_0x9f27('0x13'),_0x5d5dfc,_0x9f27('0x14'),JSON[_0x9f27('0x15')](_0x50bad3));if(_0x50bad3[_0x9f27('0x16')]){if(_0x50bad3[_0x9f27('0x16')][_0x9f27('0x17')]===0x1f4){logger[_0x9f27('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5d5dfc,_0x50bad3['error'][_0x9f27('0x18')]);return _0x1bcabe(_0x50bad3[_0x9f27('0x16')][_0x9f27('0x18')]);}logger[_0x9f27('0x16')](_0x9f27('0x12'),_0x5d5dfc,_0x50bad3['error'][_0x9f27('0x18')]);return _0x110fe9(_0x50bad3[_0x9f27('0x16')][_0x9f27('0x18')]);}else{logger[_0x9f27('0x11')](_0x9f27('0x12'),_0x5d5dfc,'request\x20sent');_0x110fe9(_0x50bad3[_0x9f27('0x19')][_0x9f27('0x18')]);}})[_0x9f27('0x1a')](function(_0x2260c9){logger['error'](_0x9f27('0x12'),_0x5d5dfc,_0x2260c9);_0x1bcabe(_0x2260c9);});});}exports[_0x9f27('0x1b')]=function(_0x33ce89){var _0x36814a=this;return new Promise(function(_0xd2d698,_0x3dddcc){return db[_0x9f27('0x1c')][_0x9f27('0x1d')]({'raw':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x1f')]===undefined?!![]:![]:!![],'where':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x20')]||null:null,'attributes':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x21')]||null:null,'include':_0x33ce89[_0x9f27('0x1e')]?_0x33ce89[_0x9f27('0x1e')][_0x9f27('0x22')]?_[_0x9f27('0x23')](_0x33ce89['options'][_0x9f27('0x22')],function(_0x620382){return{'model':db[_0x620382[_0x9f27('0x24')]],'as':_0x620382['as'],'attributes':_0x620382['attributes'],'include':_0x620382['include']?_[_0x9f27('0x23')](_0x620382['include'],function(_0x1ed8d3){return{'model':db[_0x1ed8d3[_0x9f27('0x24')]],'as':_0x1ed8d3['as'],'attributes':_0x1ed8d3[_0x9f27('0x21')],'include':_0x1ed8d3[_0x9f27('0x22')]?_['map'](_0x1ed8d3[_0x9f27('0x22')],function(_0x143c9b){return{'model':db[_0x143c9b[_0x9f27('0x24')]],'as':_0x143c9b['as'],'attributes':_0x143c9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f27('0x10')](function(_0x176126){logger[_0x9f27('0x11')]('ShowSmsAccount',_0x33ce89);logger[_0x9f27('0x25')](_0x9f27('0x1b'),_0x33ce89,JSON[_0x9f27('0x15')](_0x176126));_0xd2d698(_0x176126);})[_0x9f27('0x1a')](function(_0x5d8651){logger[_0x9f27('0x16')]('ShowSmsAccount',_0x5d8651['message'],_0x33ce89);_0x3dddcc(_0x36814a[_0x9f27('0x16')](0x1f4,_0x5d8651['message']));});});}; \ No newline at end of file +var _0xd09d=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SmsAccount','options','where','attributes','include','map','model','ShowSmsAccount','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x2f3af7,_0x2c4f3e){var _0x1d399c=function(_0x2871ba){while(--_0x2871ba){_0x2f3af7['push'](_0x2f3af7['shift']());}};_0x1d399c(++_0x2c4f3e);}(_0xd09d,0x105));var _0xdd09=function(_0x388548,_0x12b4f0){_0x388548=_0x388548-0x0;var _0xcab9e7=_0xd09d[_0x388548];return _0xcab9e7;};'use strict';var _=require('lodash');var util=require(_0xdd09('0x0'));var moment=require(_0xdd09('0x1'));var BPromise=require(_0xdd09('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd09('0x3'))['db'];var utils=require(_0xdd09('0x4'));var logger=require(_0xdd09('0x5'))(_0xdd09('0x6'));var config=require(_0xdd09('0x7'));var jayson=require(_0xdd09('0x8'));var client=jayson['client'][_0xdd09('0x9')]({'port':0x232a});config[_0xdd09('0xa')]=_[_0xdd09('0xb')](config[_0xdd09('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd09('0xc'))(new Redis(config['redis']));require(_0xdd09('0xd'))[_0xdd09('0xe')](socket);function respondWithRpcPromise(_0xd00803,_0x21de83,_0x44e198){return new BPromise(function(_0x2d666a,_0x5ecc40){return client[_0xdd09('0xf')](_0xd00803,_0x44e198)[_0xdd09('0x10')](function(_0x3ed8e8){logger[_0xdd09('0x11')](_0xdd09('0x12'),_0x21de83,'request\x20sent');logger[_0xdd09('0x13')](_0xdd09('0x14'),_0x21de83,_0xdd09('0x15'),JSON[_0xdd09('0x16')](_0x3ed8e8));if(_0x3ed8e8[_0xdd09('0x17')]){if(_0x3ed8e8[_0xdd09('0x17')][_0xdd09('0x18')]===0x1f4){logger['error'](_0xdd09('0x12'),_0x21de83,_0x3ed8e8[_0xdd09('0x17')][_0xdd09('0x19')]);return _0x5ecc40(_0x3ed8e8['error'][_0xdd09('0x19')]);}logger['error'](_0xdd09('0x12'),_0x21de83,_0x3ed8e8[_0xdd09('0x17')][_0xdd09('0x19')]);return _0x2d666a(_0x3ed8e8['error'][_0xdd09('0x19')]);}else{logger[_0xdd09('0x11')](_0xdd09('0x12'),_0x21de83,_0xdd09('0x15'));_0x2d666a(_0x3ed8e8['result']['message']);}})[_0xdd09('0x1a')](function(_0x4d64fb){logger[_0xdd09('0x17')](_0xdd09('0x12'),_0x21de83,_0x4d64fb);_0x5ecc40(_0x4d64fb);});});}exports['ShowSmsAccount']=function(_0x4c3386){var _0x174bdb=this;return new Promise(function(_0x3f3f35,_0x4bce0e){return db[_0xdd09('0x1b')]['find']({'raw':_0x4c3386['options']?_0x4c3386['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c3386['options']?_0x4c3386[_0xdd09('0x1c')][_0xdd09('0x1d')]||null:null,'attributes':_0x4c3386['options']?_0x4c3386[_0xdd09('0x1c')][_0xdd09('0x1e')]||null:null,'include':_0x4c3386[_0xdd09('0x1c')]?_0x4c3386[_0xdd09('0x1c')][_0xdd09('0x1f')]?_[_0xdd09('0x20')](_0x4c3386[_0xdd09('0x1c')]['include'],function(_0x4b81df){return{'model':db[_0x4b81df['model']],'as':_0x4b81df['as'],'attributes':_0x4b81df[_0xdd09('0x1e')],'include':_0x4b81df['include']?_['map'](_0x4b81df[_0xdd09('0x1f')],function(_0x39ecae){return{'model':db[_0x39ecae[_0xdd09('0x21')]],'as':_0x39ecae['as'],'attributes':_0x39ecae[_0xdd09('0x1e')],'include':_0x39ecae['include']?_[_0xdd09('0x20')](_0x39ecae[_0xdd09('0x1f')],function(_0x500f73){return{'model':db[_0x500f73[_0xdd09('0x21')]],'as':_0x500f73['as'],'attributes':_0x500f73['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd09('0x10')](function(_0x5c9b2e){logger[_0xdd09('0x11')]('ShowSmsAccount',_0x4c3386);logger[_0xdd09('0x13')](_0xdd09('0x22'),_0x4c3386,JSON[_0xdd09('0x16')](_0x5c9b2e));_0x3f3f35(_0x5c9b2e);})[_0xdd09('0x1a')](function(_0x1a600d){logger[_0xdd09('0x17')]('ShowSmsAccount',_0x1a600d[_0xdd09('0x19')],_0x4c3386);_0x4bce0e(_0x174bdb[_0xdd09('0x17')](0x1f4,_0x1a600d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a6466f2..d91f2b7 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index b92827a..210ff25 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(_0x532af2,_0x176b93){var _0x1dbc4e=function(_0x43d3af){while(--_0x43d3af){_0x532af2['push'](_0x532af2['shift']());}};_0x1dbc4e(++_0x176b93);}(_0x55ca,0x126));var _0xa55c=function(_0x46f62c,_0x49eb41){_0x46f62c=_0x46f62c-0x0;var _0x46d994=_0x55ca[_0x46f62c];return _0x46d994;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 55abcf9..411cd1a 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 _0x872e=['TEXT','STRING','*,*,*,*','exports'];(function(_0x24d161,_0x38b6ce){var _0x3e0e8f=function(_0x35c6b4){while(--_0x35c6b4){_0x24d161['push'](_0x24d161['shift']());}};_0x3e0e8f(++_0x38b6ce);}(_0x872e,0x147));var _0xe872=function(_0x1be61e,_0x2a1203){_0x1be61e=_0x1be61e-0x0;var _0x29242d=_0x872e[_0x1be61e];return _0x29242d;};'use strict';var Sequelize=require('sequelize');module[_0xe872('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe872('0x1')]()},'description':{'type':Sequelize[_0xe872('0x2')]},'interval':{'type':Sequelize[_0xe872('0x2')],'defaultValue':_0xe872('0x3')}}; \ No newline at end of file +var _0xdc3e=['STRING','noop','exports','INTEGER'];(function(_0x1f3345,_0x42fbdb){var _0x26f672=function(_0x33ad20){while(--_0x33ad20){_0x1f3345['push'](_0x1f3345['shift']());}};_0x26f672(++_0x42fbdb);}(_0xdc3e,0xf2));var _0xedc3=function(_0x7dc993,_0x5c007a){_0x7dc993=_0x7dc993-0x0;var _0x2da520=_0xdc3e[_0x7dc993];return _0x2da520;};'use strict';var Sequelize=require('sequelize');module[_0xedc3('0x0')]={'priority':{'type':Sequelize[_0xedc3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xedc3('0x2')],'allowNull':![],'defaultValue':_0xedc3('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xedc3('0x2')]},'interval':{'type':Sequelize[_0xedc3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index cecb75c..c322ada 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 _0xcdf6=['offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','name','index','map','SmsApplication','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5393bd,_0x5f3020){var _0x5999d8=function(_0x13aa9d){while(--_0x13aa9d){_0x5393bd['push'](_0x5393bd['shift']());}};_0x5999d8(++_0x5f3020);}(_0xcdf6,0xc6));var _0x6cdf=function(_0x2146f0,_0x45f971){_0x2146f0=_0x2146f0-0x0;var _0x930692=_0xcdf6[_0x2146f0];return _0x930692;};'use strict';var emlformat=require(_0x6cdf('0x0'));var rimraf=require(_0x6cdf('0x1'));var zipdir=require(_0x6cdf('0x2'));var jsonpatch=require(_0x6cdf('0x3'));var rp=require(_0x6cdf('0x4'));var moment=require(_0x6cdf('0x5'));var BPromise=require(_0x6cdf('0x6'));var Mustache=require(_0x6cdf('0x7'));var util=require(_0x6cdf('0x8'));var path=require(_0x6cdf('0x9'));var sox=require(_0x6cdf('0xa'));var csv=require(_0x6cdf('0xb'));var ejs=require(_0x6cdf('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6cdf('0xd'));var crypto=require(_0x6cdf('0xe'));var jsforce=require(_0x6cdf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6cdf('0xb'));var querystring=require(_0x6cdf('0x10'));var Papa=require(_0x6cdf('0x11'));var Redis=require(_0x6cdf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6cdf('0x13'));var as=require(_0x6cdf('0x14'));var hardwareService=require(_0x6cdf('0x15'));var logger=require(_0x6cdf('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6cdf('0x17'));var licenseUtil=require(_0x6cdf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc8a90c,_0x25f26d){_0x25f26d=_0x25f26d||0xcc;return function(_0x288d0d){if(_0x288d0d){return _0xc8a90c[_0x6cdf('0x19')](_0x25f26d);}return _0xc8a90c[_0x6cdf('0x1a')](_0x25f26d)['end']();};}function respondWithResult(_0x143485,_0x2d832e){_0x2d832e=_0x2d832e||0xc8;return function(_0x193d23){if(_0x193d23){return _0x143485[_0x6cdf('0x1a')](_0x2d832e)['json'](_0x193d23);}};}function respondWithFilteredResult(_0xf9ef48,_0x154b6){return function(_0x6966a0){if(_0x6966a0){var _0x18c658=typeof _0x154b6[_0x6cdf('0x1b')]===_0x6cdf('0x1c')&&typeof _0x154b6[_0x6cdf('0x1d')]===_0x6cdf('0x1c');var _0x541464=_0x6966a0[_0x6cdf('0x1e')];var _0x503d63=_0x18c658?0x0:_0x154b6['offset'];var _0x11b04e=_0x18c658?_0x6966a0['count']:_0x154b6[_0x6cdf('0x1b')]+_0x154b6[_0x6cdf('0x1d')];var _0x18ad72;if(_0x11b04e>=_0x541464){_0x11b04e=_0x541464;_0x18ad72=0xc8;}else{_0x18ad72=0xce;}_0xf9ef48[_0x6cdf('0x1a')](_0x18ad72);return _0xf9ef48[_0x6cdf('0x1f')]('Content-Range',_0x503d63+'-'+_0x11b04e+'/'+_0x541464)[_0x6cdf('0x20')](_0x6966a0);}return null;};}function patchUpdates(_0x1dd6e8){return function(_0x44d84c){try{jsonpatch[_0x6cdf('0x21')](_0x44d84c,_0x1dd6e8,!![]);}catch(_0x13fe68){return BPromise[_0x6cdf('0x22')](_0x13fe68);}return _0x44d84c[_0x6cdf('0x23')]();};}function saveUpdates(_0xcb809a,_0x5bb1b1){return function(_0x2c0d85){if(_0x2c0d85){return _0x2c0d85[_0x6cdf('0x24')](_0xcb809a)[_0x6cdf('0x25')](function(_0xacba80){return _0xacba80;});}return null;};}function removeEntity(_0x1d89a1,_0x3d36f3){return function(_0xa95e44){if(_0xa95e44){return _0xa95e44[_0x6cdf('0x26')]()[_0x6cdf('0x25')](function(){_0x1d89a1[_0x6cdf('0x1a')](0xcc)[_0x6cdf('0x27')]();});}};}function handleEntityNotFound(_0x1e0b1f,_0x3c25fa){return function(_0x2cadc5){if(!_0x2cadc5){_0x1e0b1f[_0x6cdf('0x19')](0x194);}return _0x2cadc5;};}function handleError(_0x4c3370,_0x32ce3c){_0x32ce3c=_0x32ce3c||0x1f4;return function(_0x4b65b1){logger[_0x6cdf('0x28')](_0x4b65b1['stack']);if(_0x4b65b1[_0x6cdf('0x29')]){delete _0x4b65b1[_0x6cdf('0x29')];}_0x4c3370[_0x6cdf('0x1a')](_0x32ce3c)['send'](_0x4b65b1);};}exports[_0x6cdf('0x2a')]=function(_0x553ac3,_0x3544f0){var _0x46fbb3={},_0x3bf683={},_0x144649={'count':0x0,'rows':[]};var _0x349339=_[_0x6cdf('0x2b')](db[_0x6cdf('0x2c')][_0x6cdf('0x2d')],function(_0x34bbab){return{'name':_0x34bbab[_0x6cdf('0x2e')],'type':_0x34bbab[_0x6cdf('0x2f')]['key']};});_0x3bf683['model']=_[_0x6cdf('0x2b')](_0x349339,_0x6cdf('0x29'));_0x3bf683['query']=_[_0x6cdf('0x30')](_0x553ac3[_0x6cdf('0x31')]);_0x3bf683['filters']=_[_0x6cdf('0x32')](_0x3bf683['model'],_0x3bf683[_0x6cdf('0x31')]);_0x46fbb3[_0x6cdf('0x33')]=_[_0x6cdf('0x32')](_0x3bf683[_0x6cdf('0x34')],qs[_0x6cdf('0x35')](_0x553ac3[_0x6cdf('0x31')]['fields']));_0x46fbb3[_0x6cdf('0x33')]=_0x46fbb3['attributes'][_0x6cdf('0x36')]?_0x46fbb3[_0x6cdf('0x33')]:_0x3bf683[_0x6cdf('0x34')];if(!_0x553ac3[_0x6cdf('0x31')]['hasOwnProperty'](_0x6cdf('0x37'))){_0x46fbb3[_0x6cdf('0x1d')]=qs[_0x6cdf('0x1d')](_0x553ac3[_0x6cdf('0x31')][_0x6cdf('0x1d')]);_0x46fbb3['offset']=qs[_0x6cdf('0x1b')](_0x553ac3[_0x6cdf('0x31')][_0x6cdf('0x1b')]);}_0x46fbb3[_0x6cdf('0x38')]=qs[_0x6cdf('0x39')](_0x553ac3['query'][_0x6cdf('0x39')]);_0x46fbb3['where']=qs[_0x6cdf('0x3a')](_[_0x6cdf('0x3b')](_0x553ac3[_0x6cdf('0x31')],_0x3bf683[_0x6cdf('0x3a')]),_0x349339);if(_0x553ac3['query'][_0x6cdf('0x3c')]){_0x46fbb3[_0x6cdf('0x3d')]=_['merge'](_0x46fbb3[_0x6cdf('0x3d')],{'$or':_[_0x6cdf('0x2b')](_0x349339,function(_0x5da88d){if(_0x5da88d['type']!==_0x6cdf('0x3e')){var _0x31d406={};_0x31d406[_0x5da88d['name']]={'$like':'%'+_0x553ac3['query'][_0x6cdf('0x3c')]+'%'};return _0x31d406;}})});}_0x46fbb3=_[_0x6cdf('0x3f')]({},_0x46fbb3,_0x553ac3[_0x6cdf('0x40')]);var _0x5027f4={'where':_0x46fbb3['where']};return db[_0x6cdf('0x2c')][_0x6cdf('0x1e')](_0x5027f4)[_0x6cdf('0x25')](function(_0x3be497){_0x144649[_0x6cdf('0x1e')]=_0x3be497;if(_0x553ac3[_0x6cdf('0x31')][_0x6cdf('0x41')]){_0x46fbb3[_0x6cdf('0x42')]=[{'all':!![]}];}return db[_0x6cdf('0x2c')][_0x6cdf('0x43')](_0x46fbb3);})['then'](function(_0x2d5e3c){_0x144649[_0x6cdf('0x44')]=_0x2d5e3c;return _0x144649;})[_0x6cdf('0x25')](respondWithFilteredResult(_0x3544f0,_0x46fbb3))['catch'](handleError(_0x3544f0,null));};exports[_0x6cdf('0x45')]=function(_0x4f38cb,_0x1ca442){var _0x13c7ac={'raw':!![],'where':{'id':_0x4f38cb[_0x6cdf('0x46')]['id']}},_0xd26674={};_0xd26674[_0x6cdf('0x34')]=_[_0x6cdf('0x30')](db[_0x6cdf('0x2c')]['rawAttributes']);_0xd26674['query']=_[_0x6cdf('0x30')](_0x4f38cb['query']);_0xd26674[_0x6cdf('0x3a')]=_[_0x6cdf('0x32')](_0xd26674[_0x6cdf('0x34')],_0xd26674['query']);_0x13c7ac['attributes']=_['intersection'](_0xd26674['model'],qs[_0x6cdf('0x35')](_0x4f38cb[_0x6cdf('0x31')][_0x6cdf('0x35')]));_0x13c7ac[_0x6cdf('0x33')]=_0x13c7ac['attributes'][_0x6cdf('0x36')]?_0x13c7ac[_0x6cdf('0x33')]:_0xd26674[_0x6cdf('0x34')];if(_0x4f38cb['query'][_0x6cdf('0x41')]){_0x13c7ac[_0x6cdf('0x42')]=[{'all':!![]}];}_0x13c7ac=_[_0x6cdf('0x3f')]({},_0x13c7ac,_0x4f38cb[_0x6cdf('0x40')]);return db['SmsApplication']['find'](_0x13c7ac)[_0x6cdf('0x25')](handleEntityNotFound(_0x1ca442,null))[_0x6cdf('0x25')](respondWithResult(_0x1ca442,null))['catch'](handleError(_0x1ca442,null));};exports[_0x6cdf('0x47')]=function(_0x2afb12,_0x1010a4){return db['SmsApplication'][_0x6cdf('0x47')](_0x2afb12['body'],{})[_0x6cdf('0x25')](respondWithResult(_0x1010a4,0xc9))[_0x6cdf('0x48')](handleError(_0x1010a4,null));};exports[_0x6cdf('0x24')]=function(_0x87e504,_0x37c4e9){if(_0x87e504['body']['id']){delete _0x87e504[_0x6cdf('0x49')]['id'];}return db[_0x6cdf('0x2c')][_0x6cdf('0x4a')]({'where':{'id':_0x87e504[_0x6cdf('0x46')]['id']}})['then'](handleEntityNotFound(_0x37c4e9,null))[_0x6cdf('0x25')](saveUpdates(_0x87e504['body'],null))[_0x6cdf('0x25')](respondWithResult(_0x37c4e9,null))[_0x6cdf('0x48')](handleError(_0x37c4e9,null));};exports[_0x6cdf('0x26')]=function(_0x4f7c69,_0xaa7fc9){return db[_0x6cdf('0x2c')][_0x6cdf('0x4a')]({'where':{'id':_0x4f7c69[_0x6cdf('0x46')]['id']}})['then'](handleEntityNotFound(_0xaa7fc9,null))['then'](removeEntity(_0xaa7fc9,null))[_0x6cdf('0x48')](handleError(_0xaa7fc9,null));}; \ No newline at end of file +var _0x42e3=['reject','save','update','then','destroy','end','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','merge','type','filter','includeAll','findAll','rows','catch','show','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x2aa1e9,_0x1294b4){var _0x16faa5=function(_0x474302){while(--_0x474302){_0x2aa1e9['push'](_0x2aa1e9['shift']());}};_0x16faa5(++_0x1294b4);}(_0x42e3,0x189));var _0x342e=function(_0x34ca2d,_0x36e0ca){_0x34ca2d=_0x34ca2d-0x0;var _0x4e7669=_0x42e3[_0x34ca2d];return _0x4e7669;};'use strict';var emlformat=require(_0x342e('0x0'));var rimraf=require(_0x342e('0x1'));var zipdir=require(_0x342e('0x2'));var jsonpatch=require(_0x342e('0x3'));var rp=require(_0x342e('0x4'));var moment=require('moment');var BPromise=require(_0x342e('0x5'));var Mustache=require(_0x342e('0x6'));var util=require(_0x342e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x342e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x342e('0x9'));var _=require(_0x342e('0xa'));var squel=require(_0x342e('0xb'));var crypto=require(_0x342e('0xc'));var jsforce=require(_0x342e('0xd'));var deskjs=require(_0x342e('0xe'));var toCsv=require(_0x342e('0x8'));var querystring=require(_0x342e('0xf'));var Papa=require(_0x342e('0x10'));var Redis=require(_0x342e('0x11'));var authService=require(_0x342e('0x12'));var qs=require(_0x342e('0x13'));var as=require(_0x342e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x342e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x342e('0x16'));var licenseUtil=require(_0x342e('0x17'));var db=require(_0x342e('0x18'))['db'];function respondWithStatusCode(_0x326321,_0x40be97){_0x40be97=_0x40be97||0xcc;return function(_0x2d99b6){if(_0x2d99b6){return _0x326321[_0x342e('0x19')](_0x40be97);}return _0x326321['status'](_0x40be97)['end']();};}function respondWithResult(_0x3d2749,_0x45335f){_0x45335f=_0x45335f||0xc8;return function(_0x4010b8){if(_0x4010b8){return _0x3d2749[_0x342e('0x1a')](_0x45335f)[_0x342e('0x1b')](_0x4010b8);}};}function respondWithFilteredResult(_0x7f1c29,_0xcd9977){return function(_0x595328){if(_0x595328){var _0x51534f=typeof _0xcd9977[_0x342e('0x1c')]===_0x342e('0x1d')&&typeof _0xcd9977[_0x342e('0x1e')]==='undefined';var _0x3a0213=_0x595328[_0x342e('0x1f')];var _0x388042=_0x51534f?0x0:_0xcd9977[_0x342e('0x1c')];var _0x10b26d=_0x51534f?_0x595328[_0x342e('0x1f')]:_0xcd9977[_0x342e('0x1c')]+_0xcd9977['limit'];var _0x188cfa;if(_0x10b26d>=_0x3a0213){_0x10b26d=_0x3a0213;_0x188cfa=0xc8;}else{_0x188cfa=0xce;}_0x7f1c29[_0x342e('0x1a')](_0x188cfa);return _0x7f1c29['set'](_0x342e('0x20'),_0x388042+'-'+_0x10b26d+'/'+_0x3a0213)[_0x342e('0x1b')](_0x595328);}return null;};}function patchUpdates(_0x580b82){return function(_0x2a2936){try{jsonpatch['apply'](_0x2a2936,_0x580b82,!![]);}catch(_0x1542b0){return BPromise[_0x342e('0x21')](_0x1542b0);}return _0x2a2936[_0x342e('0x22')]();};}function saveUpdates(_0x50485f,_0x18f4ce){return function(_0x1b691c){if(_0x1b691c){return _0x1b691c[_0x342e('0x23')](_0x50485f)[_0x342e('0x24')](function(_0x29a895){return _0x29a895;});}return null;};}function removeEntity(_0x1c828f,_0x3d549c){return function(_0x437eb0){if(_0x437eb0){return _0x437eb0[_0x342e('0x25')]()['then'](function(){_0x1c828f[_0x342e('0x1a')](0xcc)[_0x342e('0x26')]();});}};}function handleEntityNotFound(_0x2266c7,_0x4d90be){return function(_0x189961){if(!_0x189961){_0x2266c7[_0x342e('0x19')](0x194);}return _0x189961;};}function handleError(_0x2195f5,_0x57800e){_0x57800e=_0x57800e||0x1f4;return function(_0x53af03){logger['error'](_0x53af03['stack']);if(_0x53af03[_0x342e('0x27')]){delete _0x53af03[_0x342e('0x27')];}_0x2195f5[_0x342e('0x1a')](_0x57800e)[_0x342e('0x28')](_0x53af03);};}exports[_0x342e('0x29')]=function(_0x29b9f3,_0x4e3660){var _0x216d04={},_0x9f53b9={},_0x1b4b50={'count':0x0,'rows':[]};var _0x1d7829=_[_0x342e('0x2a')](db[_0x342e('0x2b')][_0x342e('0x2c')],function(_0x2dfbae){return{'name':_0x2dfbae[_0x342e('0x2d')],'type':_0x2dfbae['type'][_0x342e('0x2e')]};});_0x9f53b9['model']=_[_0x342e('0x2a')](_0x1d7829,_0x342e('0x27'));_0x9f53b9[_0x342e('0x2f')]=_[_0x342e('0x30')](_0x29b9f3[_0x342e('0x2f')]);_0x9f53b9[_0x342e('0x31')]=_[_0x342e('0x32')](_0x9f53b9[_0x342e('0x33')],_0x9f53b9[_0x342e('0x2f')]);_0x216d04[_0x342e('0x34')]=_[_0x342e('0x32')](_0x9f53b9['model'],qs[_0x342e('0x35')](_0x29b9f3[_0x342e('0x2f')]['fields']));_0x216d04[_0x342e('0x34')]=_0x216d04[_0x342e('0x34')][_0x342e('0x36')]?_0x216d04[_0x342e('0x34')]:_0x9f53b9[_0x342e('0x33')];if(!_0x29b9f3[_0x342e('0x2f')]['hasOwnProperty'](_0x342e('0x37'))){_0x216d04[_0x342e('0x1e')]=qs[_0x342e('0x1e')](_0x29b9f3[_0x342e('0x2f')]['limit']);_0x216d04['offset']=qs[_0x342e('0x1c')](_0x29b9f3[_0x342e('0x2f')][_0x342e('0x1c')]);}_0x216d04['order']=qs[_0x342e('0x38')](_0x29b9f3[_0x342e('0x2f')]['sort']);_0x216d04['where']=qs[_0x342e('0x31')](_['pick'](_0x29b9f3[_0x342e('0x2f')],_0x9f53b9[_0x342e('0x31')]),_0x1d7829);if(_0x29b9f3['query']['filter']){_0x216d04[_0x342e('0x39')]=_[_0x342e('0x3a')](_0x216d04[_0x342e('0x39')],{'$or':_[_0x342e('0x2a')](_0x1d7829,function(_0x39a16f){if(_0x39a16f[_0x342e('0x3b')]!=='VIRTUAL'){var _0x2107d1={};_0x2107d1[_0x39a16f['name']]={'$like':'%'+_0x29b9f3[_0x342e('0x2f')][_0x342e('0x3c')]+'%'};return _0x2107d1;}})});}_0x216d04=_[_0x342e('0x3a')]({},_0x216d04,_0x29b9f3['options']);var _0x36879d={'where':_0x216d04[_0x342e('0x39')]};return db['SmsApplication'][_0x342e('0x1f')](_0x36879d)[_0x342e('0x24')](function(_0x39af05){_0x1b4b50[_0x342e('0x1f')]=_0x39af05;if(_0x29b9f3[_0x342e('0x2f')][_0x342e('0x3d')]){_0x216d04['include']=[{'all':!![]}];}return db[_0x342e('0x2b')][_0x342e('0x3e')](_0x216d04);})[_0x342e('0x24')](function(_0x316a61){_0x1b4b50[_0x342e('0x3f')]=_0x316a61;return _0x1b4b50;})[_0x342e('0x24')](respondWithFilteredResult(_0x4e3660,_0x216d04))[_0x342e('0x40')](handleError(_0x4e3660,null));};exports[_0x342e('0x41')]=function(_0x5193d3,_0x1676b8){var _0x27d702={'raw':!![],'where':{'id':_0x5193d3['params']['id']}},_0x2f69d8={};_0x2f69d8[_0x342e('0x33')]=_[_0x342e('0x30')](db[_0x342e('0x2b')][_0x342e('0x2c')]);_0x2f69d8[_0x342e('0x2f')]=_[_0x342e('0x30')](_0x5193d3[_0x342e('0x2f')]);_0x2f69d8['filters']=_['intersection'](_0x2f69d8[_0x342e('0x33')],_0x2f69d8['query']);_0x27d702[_0x342e('0x34')]=_['intersection'](_0x2f69d8['model'],qs[_0x342e('0x35')](_0x5193d3['query']['fields']));_0x27d702[_0x342e('0x34')]=_0x27d702[_0x342e('0x34')][_0x342e('0x36')]?_0x27d702[_0x342e('0x34')]:_0x2f69d8[_0x342e('0x33')];if(_0x5193d3[_0x342e('0x2f')][_0x342e('0x3d')]){_0x27d702['include']=[{'all':!![]}];}_0x27d702=_[_0x342e('0x3a')]({},_0x27d702,_0x5193d3[_0x342e('0x42')]);return db['SmsApplication']['find'](_0x27d702)[_0x342e('0x24')](handleEntityNotFound(_0x1676b8,null))[_0x342e('0x24')](respondWithResult(_0x1676b8,null))[_0x342e('0x40')](handleError(_0x1676b8,null));};exports[_0x342e('0x43')]=function(_0x4c0767,_0x50e53a){return db[_0x342e('0x2b')]['create'](_0x4c0767['body'],{})[_0x342e('0x24')](respondWithResult(_0x50e53a,0xc9))[_0x342e('0x40')](handleError(_0x50e53a,null));};exports[_0x342e('0x23')]=function(_0x358c15,_0xe60a09){if(_0x358c15['body']['id']){delete _0x358c15[_0x342e('0x44')]['id'];}return db[_0x342e('0x2b')][_0x342e('0x45')]({'where':{'id':_0x358c15[_0x342e('0x46')]['id']}})[_0x342e('0x24')](handleEntityNotFound(_0xe60a09,null))[_0x342e('0x24')](saveUpdates(_0x358c15[_0x342e('0x44')],null))[_0x342e('0x24')](respondWithResult(_0xe60a09,null))['catch'](handleError(_0xe60a09,null));};exports[_0x342e('0x25')]=function(_0x4bdb63,_0xfb44e4){return db[_0x342e('0x2b')][_0x342e('0x45')]({'where':{'id':_0x4bdb63[_0x342e('0x46')]['id']}})['then'](handleEntityNotFound(_0xfb44e4,null))[_0x342e('0x24')](removeEntity(_0xfb44e4,null))[_0x342e('0x40')](handleError(_0xfb44e4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e909b53..ae7d2a5 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 _0x1059=['moment','request-promise','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x1059,0x1ba));var _0x9105=function(_0xdcad6,_0x5b7cc9){_0xdcad6=_0xdcad6-0x0;var _0x294c34=_0x1059[_0xdcad6];return _0x294c34;};'use strict';var _=require(_0x9105('0x0'));var util=require('util');var logger=require(_0x9105('0x1'))('api');var moment=require(_0x9105('0x2'));var BPromise=require('bluebird');var rp=require(_0x9105('0x3'));var fs=require('fs');var path=require(_0x9105('0x4'));var rimraf=require(_0x9105('0x5'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x9105('0x6')]=function(_0x2e21eb,_0x3d8b47){return _0x2e21eb[_0x9105('0x7')](_0x9105('0x8'),attributes,{'tableName':_0x9105('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9105('0xa'),'collate':_0x9105('0xb')});}; \ No newline at end of file +var _0x9806=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x9806,0x193));var _0x6980=function(_0x23f044,_0x7b66b5){_0x23f044=_0x23f044-0x0;var _0x2fc4fb=_0x9806[_0x23f044];return _0x2fc4fb;};'use strict';var _=require(_0x6980('0x0'));var util=require(_0x6980('0x1'));var logger=require(_0x6980('0x2'))(_0x6980('0x3'));var moment=require(_0x6980('0x4'));var BPromise=require(_0x6980('0x5'));var rp=require(_0x6980('0x6'));var fs=require('fs');var path=require(_0x6980('0x7'));var rimraf=require(_0x6980('0x8'));var config=require(_0x6980('0x9'));var attributes=require(_0x6980('0xa'));module[_0x6980('0xb')]=function(_0x5b14fa,_0x2f5995){return _0x5b14fa[_0x6980('0xc')](_0x6980('0xd'),attributes,{'tableName':_0x6980('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6980('0xf'),'collate':_0x6980('0x10')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 82dfa72..1c5642c 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 _0xd142=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x49ea1a,_0x42f485){var _0x1f784f=function(_0x33b589){while(--_0x33b589){_0x49ea1a['push'](_0x49ea1a['shift']());}};_0x1f784f(++_0x42f485);}(_0xd142,0x11a));var _0x2d14=function(_0x12d79d,_0x3c4f12){_0x12d79d=_0x12d79d-0x0;var _0x5cbe01=_0xd142[_0x12d79d];return _0x5cbe01;};'use strict';var _=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var moment=require(_0x2d14('0x2'));var BPromise=require(_0x2d14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d14('0x4'))['db'];var utils=require(_0x2d14('0x5'));var logger=require(_0x2d14('0x6'))(_0x2d14('0x7'));var config=require(_0x2d14('0x8'));var jayson=require(_0x2d14('0x9'));var client=jayson[_0x2d14('0xa')][_0x2d14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb081,_0x2104d6,_0xba6306){return new BPromise(function(_0x1b2d92,_0x4e5f73){return client[_0x2d14('0xc')](_0x5eb081,_0xba6306)[_0x2d14('0xd')](function(_0x581f76){logger[_0x2d14('0xe')](_0x2d14('0xf'),_0x2104d6,_0x2d14('0x10'));logger['debug'](_0x2d14('0x11'),_0x2104d6,_0x2d14('0x10'),JSON['stringify'](_0x581f76));if(_0x581f76['error']){if(_0x581f76[_0x2d14('0x12')][_0x2d14('0x13')]===0x1f4){logger[_0x2d14('0x12')]('SmsApplication,\x20%s,\x20%s',_0x2104d6,_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);return _0x4e5f73(_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);}logger['error'](_0x2d14('0xf'),_0x2104d6,_0x581f76[_0x2d14('0x12')]['message']);return _0x1b2d92(_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);}else{logger[_0x2d14('0xe')](_0x2d14('0xf'),_0x2104d6,_0x2d14('0x10'));_0x1b2d92(_0x581f76['result'][_0x2d14('0x14')]);}})[_0x2d14('0x15')](function(_0x3e12d3){logger[_0x2d14('0x12')](_0x2d14('0xf'),_0x2104d6,_0x3e12d3);_0x4e5f73(_0x3e12d3);});});} \ No newline at end of file +var _0x68fd=['error','code','message','info','SmsApplication,\x20%s,\x20%s','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2cd051,_0x458b28){var _0x36a151=function(_0x32bcfd){while(--_0x32bcfd){_0x2cd051['push'](_0x2cd051['shift']());}};_0x36a151(++_0x458b28);}(_0x68fd,0x1e9));var _0xd68f=function(_0x29c6f,_0x38d350){_0x29c6f=_0x29c6f-0x0;var _0x17394e=_0x68fd[_0x29c6f];return _0x17394e;};'use strict';var _=require(_0xd68f('0x0'));var util=require('util');var moment=require(_0xd68f('0x1'));var BPromise=require(_0xd68f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd68f('0x3'));var db=require(_0xd68f('0x4'))['db'];var utils=require(_0xd68f('0x5'));var logger=require(_0xd68f('0x6'))(_0xd68f('0x7'));var config=require(_0xd68f('0x8'));var jayson=require(_0xd68f('0x9'));var client=jayson[_0xd68f('0xa')][_0xd68f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e59f5,_0xb3cb35,_0x182353){return new BPromise(function(_0x26f6ca,_0x22c199){return client[_0xd68f('0xc')](_0x4e59f5,_0x182353)[_0xd68f('0xd')](function(_0x18438e){logger['info']('SmsApplication,\x20%s,\x20%s',_0xb3cb35,_0xd68f('0xe'));logger['debug'](_0xd68f('0xf'),_0xb3cb35,_0xd68f('0xe'),JSON[_0xd68f('0x10')](_0x18438e));if(_0x18438e[_0xd68f('0x11')]){if(_0x18438e[_0xd68f('0x11')][_0xd68f('0x12')]===0x1f4){logger[_0xd68f('0x11')]('SmsApplication,\x20%s,\x20%s',_0xb3cb35,_0x18438e['error']['message']);return _0x22c199(_0x18438e['error'][_0xd68f('0x13')]);}logger[_0xd68f('0x11')]('SmsApplication,\x20%s,\x20%s',_0xb3cb35,_0x18438e[_0xd68f('0x11')][_0xd68f('0x13')]);return _0x26f6ca(_0x18438e[_0xd68f('0x11')][_0xd68f('0x13')]);}else{logger[_0xd68f('0x14')](_0xd68f('0x15'),_0xb3cb35,_0xd68f('0xe'));_0x26f6ca(_0x18438e['result'][_0xd68f('0x13')]);}})['catch'](function(_0x5db5b1){logger[_0xd68f('0x11')](_0xd68f('0x15'),_0xb3cb35,_0x5db5b1);_0x22c199(_0x5db5b1);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6963483..9a1ef74 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 _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x6ebe87,_0x1f02e9){var _0x31197e=function(_0xf8b026){while(--_0xf8b026){_0x6ebe87['push'](_0x6ebe87['shift']());}};_0x31197e(++_0x1f02e9);}(_0x4fc2,0x111));var _0x24fc=function(_0x5e6bb2,_0x5478c6){_0x5e6bb2=_0x5e6bb2-0x0;var _0x43721e=_0x4fc2[_0x5e6bb2];return _0x43721e;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x2251c9,_0x2a2091){var _0x56d17b=function(_0x3fd083){while(--_0x3fd083){_0x2251c9['push'](_0x2251c9['shift']());}};_0x56d17b(++_0x2a2091);}(_0x7708,0x188));var _0x8770=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0x7708[_0x4a7e98];return _0x27d10d;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 00fc939..26d9a53 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 _0xaf1b=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x302831,_0x368779){_0x302831=_0x302831-0x0;var _0x3b88ab=_0xaf1b[_0x302831];return _0x3b88ab;};'use strict';var Sequelize=require(_0xbaf1('0x0'));var moment=require(_0xbaf1('0x1'));module[_0xbaf1('0x2')]={'closed':{'type':Sequelize[_0xbaf1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbaf1('0x4')]},'disposition':{'type':Sequelize[_0xbaf1('0x5')]},'secondDisposition':{'type':Sequelize[_0xbaf1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xbaf1('0x5')]},'note':{'type':Sequelize[_0xbaf1('0x5')]},'phone':{'type':Sequelize[_0xbaf1('0x5')]},'read1stAt':{'type':Sequelize[_0xbaf1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbaf1('0x6')]('in',_0xbaf1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbaf1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbaf1('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3edc=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x41a7cc,_0x4700fd){_0x41a7cc=_0x41a7cc-0x0;var _0x4ed37d=_0x3edc[_0x41a7cc];return _0x4ed37d;};'use strict';var Sequelize=require(_0xc3ed('0x0'));var moment=require(_0xc3ed('0x1'));module[_0xc3ed('0x2')]={'closed':{'type':Sequelize[_0xc3ed('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc3ed('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc3ed('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc3ed('0x5')]},'phone':{'type':Sequelize[_0xc3ed('0x5')]},'read1stAt':{'type':Sequelize[_0xc3ed('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc3ed('0x6')]('in',_0xc3ed('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc3ed('0x6')]('in',_0xc3ed('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc3ed('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 19cdeee..0d75948 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 _0x5c9b=['user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','catch','params','includeAll','options','create','update','destroy','describe','addMessage','SmsMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','Messages','out','secret','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','save','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','unmanaged','UserId','closed','answered','total','index','SmsInteraction','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','body','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL'];(function(_0x2d6f5a,_0x46614b){var _0x58929d=function(_0x1d2309){while(--_0x1d2309){_0x2d6f5a['push'](_0x2d6f5a['shift']());}};_0x58929d(++_0x46614b);}(_0x5c9b,0x13b));var _0xb5c9=function(_0x530887,_0x5d1d33){_0x530887=_0x530887-0x0;var _0x2095d3=_0x5c9b[_0x530887];return _0x2095d3;};'use strict';var emlformat=require(_0xb5c9('0x0'));var rimraf=require(_0xb5c9('0x1'));var zipdir=require(_0xb5c9('0x2'));var jsonpatch=require(_0xb5c9('0x3'));var rp=require(_0xb5c9('0x4'));var moment=require(_0xb5c9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb5c9('0x6'));var util=require(_0xb5c9('0x7'));var path=require('path');var sox=require(_0xb5c9('0x8'));var csv=require(_0xb5c9('0x9'));var ejs=require(_0xb5c9('0xa'));var fs=require('fs');var fs_extra=require(_0xb5c9('0xb'));var _=require(_0xb5c9('0xc'));var squel=require(_0xb5c9('0xd'));var crypto=require('crypto');var jsforce=require(_0xb5c9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb5c9('0xf'));var Redis=require(_0xb5c9('0x10'));var authService=require(_0xb5c9('0x11'));var qs=require(_0xb5c9('0x12'));var as=require(_0xb5c9('0x13'));var pdf=require(_0xb5c9('0x14'));var hardwareService=require(_0xb5c9('0x15'));var logger=require(_0xb5c9('0x16'))(_0xb5c9('0x17'));var utils=require(_0xb5c9('0x18'));var config=require(_0xb5c9('0x19'));var licenseUtil=require(_0xb5c9('0x1a'));var db=require(_0xb5c9('0x1b'))['db'];config[_0xb5c9('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb5c9('0x1d'))(new Redis(config[_0xb5c9('0x1c')]));require(_0xb5c9('0x1e'))[_0xb5c9('0x1f')](socket);function respondWithStatusCode(_0x9473c9,_0x29c5c8){_0x29c5c8=_0x29c5c8||0xcc;return function(_0x1cb1e5){if(_0x1cb1e5){return _0x9473c9[_0xb5c9('0x20')](_0x29c5c8);}return _0x9473c9[_0xb5c9('0x21')](_0x29c5c8)[_0xb5c9('0x22')]();};}function respondWithResult(_0x34fbaa,_0x47d7e8){_0x47d7e8=_0x47d7e8||0xc8;return function(_0xe2781d){if(_0xe2781d){return _0x34fbaa[_0xb5c9('0x21')](_0x47d7e8)['json'](_0xe2781d);}};}function respondWithFilteredResult(_0x3ce1e3,_0x12eb18){return function(_0x404d0c){if(_0x404d0c){var _0x516810=typeof _0x12eb18[_0xb5c9('0x23')]==='undefined'&&typeof _0x12eb18[_0xb5c9('0x24')]===_0xb5c9('0x25');var _0x184265=_0x404d0c[_0xb5c9('0x26')];var _0x309bef=_0x516810?0x0:_0x12eb18['offset'];var _0x222f6c=_0x516810?_0x404d0c[_0xb5c9('0x26')]:_0x12eb18[_0xb5c9('0x23')]+_0x12eb18[_0xb5c9('0x24')];var _0x1c5226;if(_0x222f6c>=_0x184265){_0x222f6c=_0x184265;_0x1c5226=0xc8;}else{_0x1c5226=0xce;}_0x3ce1e3['status'](_0x1c5226);return _0x3ce1e3[_0xb5c9('0x27')]('Content-Range',_0x309bef+'-'+_0x222f6c+'/'+_0x184265)[_0xb5c9('0x28')](_0x404d0c);}return null;};}function patchUpdates(_0x279bc6){return function(_0x2d3628){try{jsonpatch['apply'](_0x2d3628,_0x279bc6,!![]);}catch(_0x406665){return BPromise[_0xb5c9('0x29')](_0x406665);}return _0x2d3628[_0xb5c9('0x2a')]();};}function saveUpdates(_0x40a7a1,_0x431d94){return function(_0x2109e4){if(_0x2109e4){return _0x2109e4['update'](_0x40a7a1)[_0xb5c9('0x2b')](function(_0x1b9f8b){return _0x1b9f8b;});}return null;};}function removeEntity(_0x2281af,_0x282eef){return function(_0x4416fd){if(_0x4416fd){return _0x4416fd['destroy']()[_0xb5c9('0x2b')](function(){_0x2281af[_0xb5c9('0x21')](0xcc)[_0xb5c9('0x22')]();});}};}function handleEntityNotFound(_0xda195c,_0x3ba11f){return function(_0x421bad){if(!_0x421bad){_0xda195c['sendStatus'](0x194);}return _0x421bad;};}function handleError(_0x1caa7b,_0xca267f){_0xca267f=_0xca267f||0x1f4;return function(_0x57335d){logger[_0xb5c9('0x2c')](_0x57335d['stack']);if(_0x57335d[_0xb5c9('0x2d')]){delete _0x57335d[_0xb5c9('0x2d')];}_0x1caa7b[_0xb5c9('0x21')](_0xca267f)[_0xb5c9('0x2e')](_0x57335d);};}function getInteractionUsers(_0x39eb84,_0x56186a){return new BPromise(function(_0x152d54,_0x403caa){try{if(_0x56186a[_0x39eb84['id']]){_0x39eb84[_0xb5c9('0x2f')]=_[_0xb5c9('0x30')](_0x56186a[_0x39eb84['id']],function(_0x2cb567){return{'id':_0x2cb567['id'],'fullname':_0x2cb567[_0xb5c9('0x31')]};});}}catch(_0x513691){_0x403caa(_0x513691);}_0x152d54(_0x39eb84);});}function getInteractionTags(_0x1c6145,_0x57ee60){return new BPromise(function(_0x2dcd43,_0x1d36ff){try{if(_0x1c6145[_0xb5c9('0x32')]){_0x1c6145[_0xb5c9('0x33')]=[];_0x1c6145[_0xb5c9('0x32')][_0xb5c9('0x34')](',')[_0xb5c9('0x35')](function(_0x3439d9){_0x1c6145[_0xb5c9('0x33')][_0xb5c9('0x36')](_0x57ee60[_0x3439d9]);});}delete _0x1c6145[_0xb5c9('0x32')];}catch(_0x440ed7){_0x1d36ff(_0x440ed7);}_0x2dcd43(_0x1c6145);});}function updateSmsInteraction(_0x51da61,_0x497bbd,_0x4f9fad){return new BPromise(function(_0x204c81,_0x2eed9e){return getInteractionUsers(_0x51da61,_0x4f9fad)[_0xb5c9('0x2b')](function(_0x23ddb9){return getInteractionTags(_0x23ddb9,_0x497bbd);})[_0xb5c9('0x2b')](function(_0x4bfd2d){return getStateInteraction(_0x4bfd2d);})['then'](function(_0x2b31dd){_0x204c81(_0x2b31dd);})['catch'](function(_0x298993){_0x2eed9e(_0x298993);});});}function getStateInteraction(_0x590039){return new BPromise(function(_0x1d30c9){_0x590039[_0xb5c9('0x37')]=0x0;_0x590039[_0xb5c9('0x38')]=0x0;_0x590039['answered']=0x0;_0x590039[_0xb5c9('0x39')]=0x0;_0x590039['total']=0x0;if(!_0x590039['closed']&&!_0x590039[_0xb5c9('0x3a')]){_0x590039['waiting']+=0x1;}if(!_0x590039[_0xb5c9('0x3b')]&&_0x590039['UserId']){_0x590039[_0xb5c9('0x38')]+=0x1;if(_0x590039[_0xb5c9('0x37')]){_0x590039[_0xb5c9('0x37')]-=0x1;}}if(_0x590039['closed']&&_0x590039[_0xb5c9('0x3a')]){_0x590039[_0xb5c9('0x3c')]+=0x1;if(_0x590039[_0xb5c9('0x38')]){_0x590039[_0xb5c9('0x38')]-=0x1;}}if(_0x590039['closed']&&!_0x590039[_0xb5c9('0x3a')]){_0x590039[_0xb5c9('0x39')]+=0x1;if(_0x590039[_0xb5c9('0x37')]){_0x590039[_0xb5c9('0x37')]-=0x1;}}_0x590039[_0xb5c9('0x3d')]+=0x1;_0x1d30c9(_0x590039);});}exports[_0xb5c9('0x3e')]=function(_0x2a0f5f,_0x190326){var _0x49f159={},_0x1586ae={},_0x109787={'count':0x0,'rows':[]};var _0x47afa8=_[_0xb5c9('0x30')](db[_0xb5c9('0x3f')][_0xb5c9('0x40')],function(_0x4eae){return{'name':_0x4eae[_0xb5c9('0x41')],'type':_0x4eae['type']['key']};});_0x1586ae['model']=_['map'](_0x47afa8,_0xb5c9('0x2d'));_0x1586ae[_0xb5c9('0x42')]=_[_0xb5c9('0x43')](_0x2a0f5f[_0xb5c9('0x42')]);_0x1586ae[_0xb5c9('0x44')]=_[_0xb5c9('0x45')](_0x1586ae[_0xb5c9('0x46')],_0x1586ae[_0xb5c9('0x42')]);_0x49f159[_0xb5c9('0x47')]=_[_0xb5c9('0x45')](_0x1586ae[_0xb5c9('0x46')],qs['fields'](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x48')]));_0x49f159[_0xb5c9('0x47')]=_0x49f159[_0xb5c9('0x47')][_0xb5c9('0x49')]?_0x49f159[_0xb5c9('0x47')]:_0x1586ae[_0xb5c9('0x46')];if(!_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x4a')](_0xb5c9('0x4b'))){_0x49f159['limit']=qs['limit'](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x24')]);_0x49f159[_0xb5c9('0x23')]=qs[_0xb5c9('0x23')](_0x2a0f5f['query']['offset']);}_0x49f159[_0xb5c9('0x4c')]=qs['sort'](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x4d')]);_0x49f159['where']=qs[_0xb5c9('0x44')](_[_0xb5c9('0x4e')](_0x2a0f5f['query'],_0x1586ae[_0xb5c9('0x44')]),_0x47afa8);var _0x2b1988=[];var _0x4acb6f=squel[_0xb5c9('0x4f')]()['field']('id')[_0xb5c9('0x50')](_0xb5c9('0x2d'))['field'](_0xb5c9('0x51'))[_0xb5c9('0x52')](_0xb5c9('0x53'));var _0x410d73=squel[_0xb5c9('0x4f')]()[_0xb5c9('0x50')]('u.id')[_0xb5c9('0x50')]('u.fullname')[_0xb5c9('0x50')](_0xb5c9('0x54'))[_0xb5c9('0x52')](_0xb5c9('0x55'),'ui')[_0xb5c9('0x56')](_0xb5c9('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x43f4c3=squel['select']()[_0xb5c9('0x52')](_0xb5c9('0x58'),'i')[_0xb5c9('0x56')](_0xb5c9('0x59'),'c',_0xb5c9('0x5a'))[_0xb5c9('0x56')](_0xb5c9('0x57'),'o',_0xb5c9('0x5b'))[_0xb5c9('0x56')](_0xb5c9('0x5c'),'a',_0xb5c9('0x5d'))['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xb5c9('0x56')](_0xb5c9('0x5e'),'it',_0xb5c9('0x5f'))[_0xb5c9('0x56')]('tools_tags','t',_0xb5c9('0x60'));var _0x5b5c91=squel[_0xb5c9('0x61')]();var _0x14a358=[];var _0x3dfdb0=squel[_0xb5c9('0x61')]();var _0x885d07;if(_0x2a0f5f['query'][_0xb5c9('0x62')]){_0x885d07=as[_0xb5c9('0x63')](_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x62')]);var _0xa549ae=_0x885d07[_0xb5c9('0x64')];for(var _0x4d9123=0x0;_0x4d9123<_0x885d07['conditions'][_0xb5c9('0x49')];_0x4d9123++){var _0x567546=_0x885d07[_0xb5c9('0x65')][_0x4d9123];var _0x736b19='i';var _0x2bcbda=_['find'](_0x47afa8,[_0xb5c9('0x2d'),_0x567546[_0xb5c9('0x50')]]);if(!_0x2bcbda){switch(_0x567546[_0xb5c9('0x50')]){case'unreadMessages':if(_0x567546['value']==0x1){_0x43f4c3[_0xb5c9('0x66')]('`'+_0x567546[_0xb5c9('0x50')]+_0xb5c9('0x67'));}else{_0x43f4c3[_0xb5c9('0x66')]('`'+_0x567546[_0xb5c9('0x50')]+'`\x20>\x200');}break;case _0xb5c9('0x68'):if(_0x567546[_0xb5c9('0x69')]==='$substring'){if(_0x567546[_0xb5c9('0x6a')]['split']('\x20')[_0xb5c9('0x49')]>0x1){_0x5b5c91[_0xa549ae](_0xb5c9('0x6b'),qs[_0xb5c9('0x6c')](_0x567546[_0xb5c9('0x6a')]),null);}else{var _0x4e0dff='%'+_0x567546[_0xb5c9('0x6a')]+'%';_0x5b5c91[_0xa549ae](_0xb5c9('0x6d'),_0x4e0dff,_0x4e0dff,_0x4e0dff);}}else{_0x2bcbda=_['find'](_0x47afa8,['name',_0xb5c9('0x6e')]);_0x567546[_0xb5c9('0x50')]=_0xb5c9('0x6e');_0x2587ac=as[_0xb5c9('0x6f')](_0x736b19,_0x2bcbda[_0xb5c9('0x70')],_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac[_0xb5c9('0x71')],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x72')],_0x2587ac[_0xb5c9('0x6a')]['end']);}break;case'Tag':var _0xe4ed1c=_0x567546[_0xb5c9('0x6a')]['split'](',')['map'](function(_0x14ff25){return Number(_0x14ff25);});_0xe4ed1c['forEach'](function(_0x21392b){_0x3dfdb0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x21392b+',%');});_0x14a358=_['union'](_0x14a358,_0xe4ed1c);break;case _0xb5c9('0x73'):if(_0x567546[_0xb5c9('0x69')]===_0xb5c9('0x74')){_0x5b5c91[_0xa549ae](_0xb5c9('0x75'),'%'+_0x567546[_0xb5c9('0x6a')]+'%',null);}else{_0x2bcbda=_[_0xb5c9('0x76')](_0x47afa8,['name',_0xb5c9('0x3a')]);_0x567546[_0xb5c9('0x50')]=_0xb5c9('0x3a');_0x2587ac=as[_0xb5c9('0x6f')](_0x736b19,_0x2bcbda[_0xb5c9('0x70')],_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac[_0xb5c9('0x71')],_0x2587ac['value'][_0xb5c9('0x72')],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x22')]);}break;case _0xb5c9('0x77'):_0x2587ac=as[_0xb5c9('0x6f')]('me',null,_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac[_0xb5c9('0x71')],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x72')],_0x2587ac['value']['end']);break;}}else{var _0x2587ac=as[_0xb5c9('0x6f')](_0x736b19,_0x2bcbda[_0xb5c9('0x70')],_0x567546);_0x5b5c91[_0xa549ae](_0x2587ac['text'],_0x2587ac[_0xb5c9('0x6a')]['start'],_0x2587ac[_0xb5c9('0x6a')][_0xb5c9('0x22')]);}}}else{var _0x276b86=_(_0x2a0f5f[_0xb5c9('0x42')])[_0xb5c9('0x43')]()[_0xb5c9('0x30')](function(_0x405852){return _[_0xb5c9('0x78')](_0x47afa8,[_0xb5c9('0x2d'),_0x405852])?_0x405852:undefined;})[_0xb5c9('0x79')]()[_0xb5c9('0x6a')]();if(!_[_0xb5c9('0x7a')](_0x276b86)){_0x276b86[_0xb5c9('0x35')](function(_0x48351a){if(_0x48351a===_0xb5c9('0x7b')){_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x7d'),[][_0xb5c9('0x7e')](_0x2a0f5f[_0xb5c9('0x42')][_0x48351a]));}else if(_0x48351a===_0xb5c9('0x7f')){var _0x36f812=JSON['parse'](_0x2a0f5f[_0xb5c9('0x42')][_0x48351a])['$gte'];var _0x856aa5=JSON[_0xb5c9('0x80')](_0x2a0f5f[_0xb5c9('0x42')][_0x48351a])['$lte'];_0x43f4c3['where'](_0xb5c9('0x81'),_0x36f812,_0x856aa5);}else{if(_0x2a0f5f['query'][_0x48351a]==='null'){_0x43f4c3[_0xb5c9('0x7c')]('i.'+_0x48351a+_0xb5c9('0x82'));}else{_0x43f4c3[_0xb5c9('0x7c')]('i.'+_0x48351a+'\x20=\x20?',_0x2a0f5f[_0xb5c9('0x42')][_0x48351a]);}}});}if(_0x2a0f5f[_0xb5c9('0x42')]['read']){if(_0x2a0f5f[_0xb5c9('0x42')]['read']==0x1){_0x43f4c3[_0xb5c9('0x66')](_0xb5c9('0x83'));}else{_0x43f4c3['having'](_0xb5c9('0x84'));}}if(_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x85')]){_0x14a358=_['isArray'](_0x2a0f5f[_0xb5c9('0x42')]['tag'])?_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x85')]:new Array(_0x2a0f5f[_0xb5c9('0x42')][_0xb5c9('0x85')]);_0x14a358[_0xb5c9('0x35')](function(_0x2a0ca2){_0x3dfdb0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a0ca2+',%');});}if(_0x2a0f5f['query'][_0xb5c9('0x86')]){var _0xa518d6=_0x2a0f5f['query']['filter']['replace']('\x5c','\x5c\x5c')[_0xb5c9('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xa518d6)){_0x5b5c91['or']('i.id\x20LIKE\x20?',_0xa518d6+'%')['or']('i.phone\x20LIKE\x20?',_0xa518d6+'%');}else{_0x5b5c91['or'](_0xb5c9('0x88'),qs[_0xb5c9('0x6c')](_0xa518d6))['or'](_0xb5c9('0x89'),_0xa518d6+'%');}}}_0x43f4c3[_0xb5c9('0x7c')](_0x5b5c91);_0x43f4c3['group'](_0xb5c9('0x8a'));var _0x3562c8={'type':db['Sequelize'][_0xb5c9('0x8b')][_0xb5c9('0x8c')],'raw':!![]};var _0x2af2c1=_0x43f4c3['clone']();_0x2af2c1[_0xb5c9('0x50')](_0xb5c9('0x8a'));_0x2af2c1[_0xb5c9('0x50')](_0xb5c9('0x8d'),_0xb5c9('0x8e'));if(_0x49f159['order']){_0x49f159[_0xb5c9('0x4c')][_0xb5c9('0x35')](function(_0x4d0fe4){var _0x3f2ee0=_0x4d0fe4[0x0]==='contactName'?_0x4d0fe4[0x0]:'i.'+_0x4d0fe4[0x0];_0x43f4c3[_0xb5c9('0x4c')](_0x3f2ee0,_0x4d0fe4[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb5c9('0x7a')](_0x14a358)){_0x43f4c3[_0xb5c9('0x66')](_0x3dfdb0);_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x8f'),_0x14a358);}BPromise['resolve']()[_0xb5c9('0x2b')](function(){if(!_0x885d07){if(_0x2a0f5f['query'][_0xb5c9('0x7b')])return;_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x90'));_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x90'));return;}if(_0x2a0f5f[_0xb5c9('0x91')][_0xb5c9('0x92')]!==_0xb5c9('0x93'))return;return _0x2a0f5f['user'][_0xb5c9('0x94')]({'attributes':['id'],'raw':!![]})[_0xb5c9('0x2b')](function(_0x178f57){if(_[_0xb5c9('0x7a')](_0x178f57)){_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x95'));_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x95'));}else{_0x2af2c1[_0xb5c9('0x7c')](_0xb5c9('0x7d'),_[_0xb5c9('0x30')](_0x178f57,'id'));_0x43f4c3[_0xb5c9('0x7c')](_0xb5c9('0x7d'),_[_0xb5c9('0x30')](_0x178f57,'id'));}});})[_0xb5c9('0x2b')](function(){if(_0x2a0f5f['user'][_0xb5c9('0x92')]===_0xb5c9('0x93')&&!_0x885d07&&!_0x2a0f5f[_0xb5c9('0x42')]['SmsAccountId'])return[];return db[_0xb5c9('0x96')][_0xb5c9('0x42')](_0x2af2c1[_0xb5c9('0x97')](),_0x3562c8);})[_0xb5c9('0x2b')](function(_0x5df180){_0x109787['count']=_0x5df180[_0xb5c9('0x49')];if(_0x109787['count']===0x0)return[];return db[_0xb5c9('0x96')][_0xb5c9('0x42')](_0x4acb6f[_0xb5c9('0x97')](),_0x3562c8)['then'](function(_0x2c8e20){_0x2b1988=_['keyBy'](_0x2c8e20,'id');_0x3562c8=_[_0xb5c9('0x98')](_0x3562c8,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a0f5f['query'][_0xb5c9('0x48')]){_0x49f159[_0xb5c9('0x47')][_0xb5c9('0x35')](function(_0x18e28c){_0x43f4c3[_0xb5c9('0x50')]('i.'+_0x18e28c);});}else{_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x8d'),_0xb5c9('0x8e'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x99'),'Account.key');_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x9a'),_0xb5c9('0x9b'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x9c'),_0xb5c9('0x9d'));_0x43f4c3['field'](_0xb5c9('0x9e'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0x9f'),_0xb5c9('0xa0'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xa1'),_0xb5c9('0xa2'));_0x43f4c3['field'](_0xb5c9('0xa3'),_0xb5c9('0xa4'));_0x43f4c3[_0xb5c9('0x50')]('c.phone',_0xb5c9('0xa5'));_0x43f4c3[_0xb5c9('0x50')]('c.mobile',_0xb5c9('0xa6'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xa7'),'Contact.fax');_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xa8'),'Owner.fullname');_0x43f4c3['field'](_0xb5c9('0xa9'),_0xb5c9('0xaa'));_0x43f4c3[_0xb5c9('0x50')](_0xb5c9('0xab'),_0xb5c9('0x32'));}if(_0x49f159[_0xb5c9('0x24')])_0x43f4c3[_0xb5c9('0x24')](_0x49f159['limit']);if(_0x49f159[_0xb5c9('0x23')])_0x43f4c3['offset'](_0x49f159[_0xb5c9('0x23')]);return db[_0xb5c9('0x96')][_0xb5c9('0x42')](_0x43f4c3[_0xb5c9('0x97')](),_0x3562c8);})[_0xb5c9('0x2b')](function(_0x1e0819){if(_0x1e0819[_0xb5c9('0x49')]>0x0)_0x410d73[_0xb5c9('0x7c')](_0xb5c9('0xac'),_[_0xb5c9('0x30')](_0x1e0819,'id'));return db['sequelize'][_0xb5c9('0x42')](_0x410d73[_0xb5c9('0x97')](),_0x3562c8)[_0xb5c9('0x2b')](function(_0x49170b){var _0x4954ab=_[_0xb5c9('0xad')](_0x49170b,_0xb5c9('0xae'));var _0x4cba25=[];_0x1e0819[_0xb5c9('0x35')](function(_0x4b4315){_0x4cba25[_0xb5c9('0x36')](updateSmsInteraction(_0x4b4315,_0x2b1988,_0x4954ab));});return BPromise['all'](_0x4cba25);});});})['then'](function(_0x5ce092){_0x109787['rows']=_0x5ce092;return _0x109787;})[_0xb5c9('0x2b')](respondWithFilteredResult(_0x190326,_0x49f159))[_0xb5c9('0xaf')](handleError(_0x190326,null));};exports['show']=function(_0x175fc8,_0x3140d7){var _0x1932ef={'raw':![],'where':{'id':_0x175fc8[_0xb5c9('0xb0')]['id']}},_0x52d362={};_0x52d362[_0xb5c9('0x46')]=_[_0xb5c9('0x43')](db['SmsInteraction']['rawAttributes']);_0x52d362['query']=_[_0xb5c9('0x43')](_0x175fc8[_0xb5c9('0x42')]);_0x52d362[_0xb5c9('0x44')]=_[_0xb5c9('0x45')](_0x52d362[_0xb5c9('0x46')],_0x52d362[_0xb5c9('0x42')]);_0x1932ef['attributes']=_[_0xb5c9('0x45')](_0x52d362['model'],qs[_0xb5c9('0x48')](_0x175fc8['query'][_0xb5c9('0x48')]));_0x1932ef[_0xb5c9('0x47')]=_0x1932ef[_0xb5c9('0x47')][_0xb5c9('0x49')]?_0x1932ef['attributes']:_0x52d362[_0xb5c9('0x46')];if(_0x175fc8[_0xb5c9('0x42')][_0xb5c9('0xb1')]){_0x1932ef['include']=[{'all':!![]}];}_0x1932ef=_['merge']({},_0x1932ef,_0x175fc8[_0xb5c9('0xb2')]);return db[_0xb5c9('0x3f')][_0xb5c9('0x76')](_0x1932ef)['then'](handleEntityNotFound(_0x3140d7,null))[_0xb5c9('0x2b')](respondWithResult(_0x3140d7,null))[_0xb5c9('0xaf')](handleError(_0x3140d7,null));};exports[_0xb5c9('0xb3')]=function(_0x35b571,_0x473dd5){return db['SmsInteraction'][_0xb5c9('0xb3')](_0x35b571[_0xb5c9('0x77')],{})[_0xb5c9('0x2b')](respondWithResult(_0x473dd5,0xc9))[_0xb5c9('0xaf')](handleError(_0x473dd5,null));};exports[_0xb5c9('0xb4')]=function(_0x127255,_0x393d51){if(_0x127255[_0xb5c9('0x77')]['id']){delete _0x127255[_0xb5c9('0x77')]['id'];}return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0x127255[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x393d51,null))[_0xb5c9('0x2b')](saveUpdates(_0x127255[_0xb5c9('0x77')],null))[_0xb5c9('0x2b')](respondWithResult(_0x393d51,null))[_0xb5c9('0xaf')](handleError(_0x393d51,null));};exports[_0xb5c9('0xb5')]=function(_0xc25157,_0x1d3681){return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0xc25157[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x1d3681,null))[_0xb5c9('0x2b')](removeEntity(_0x1d3681,null))[_0xb5c9('0xaf')](handleError(_0x1d3681,null));};exports['describe']=function(_0xe2ae81,_0x56d633){return db[_0xb5c9('0x3f')][_0xb5c9('0xb6')]()[_0xb5c9('0x2b')](respondWithResult(_0x56d633,null))[_0xb5c9('0xaf')](handleError(_0x56d633,null));};exports[_0xb5c9('0xb7')]=function(_0x275895,_0x3ad74b,_0x48fbc4){return db[_0xb5c9('0xb8')]['find']({'where':{'id':_0x275895[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x3ad74b,null))['then'](function(_0x5c9adb){if(_0x5c9adb){return _0x5c9adb[_0xb5c9('0xb7')](_0x275895[_0xb5c9('0x77')][_0xb5c9('0xb9')],_[_0xb5c9('0xba')](_0x275895[_0xb5c9('0x77')],[_0xb5c9('0xb9'),'id'])||{});}})[_0xb5c9('0x2b')](respondWithResult(_0x3ad74b,null))[_0xb5c9('0xaf')](handleError(_0x3ad74b,null));};exports['getMessages']=function(_0x387840,_0x43b2a4,_0x2d8d40){var _0x4682d3={'raw':![],'where':{}};var _0x522708={};var _0x5021dd={'count':0x0,'rows':[]};return db[_0xb5c9('0x3f')][_0xb5c9('0xbb')]({'where':{'id':_0x387840[_0xb5c9('0xb0')]['id']}})[_0xb5c9('0x2b')](handleEntityNotFound(_0x43b2a4,null))[_0xb5c9('0x2b')](function(_0x34d208){if(_0x34d208){_0x522708[_0xb5c9('0x46')]=_['keys'](db[_0xb5c9('0xb8')][_0xb5c9('0x40')]);_0x522708['query']=_[_0xb5c9('0x43')](_0x387840['query']);_0x522708[_0xb5c9('0x44')]=_['intersection'](_0x522708[_0xb5c9('0x46')],_0x522708[_0xb5c9('0x42')]);_0x4682d3[_0xb5c9('0x47')]=_[_0xb5c9('0x45')](_0x522708[_0xb5c9('0x46')],qs['fields'](_0x387840[_0xb5c9('0x42')][_0xb5c9('0x48')]));_0x4682d3[_0xb5c9('0x47')]=_0x4682d3[_0xb5c9('0x47')]['length']?_0x4682d3[_0xb5c9('0x47')]:_0x522708['model'];if(!_0x387840[_0xb5c9('0x42')][_0xb5c9('0x4a')](_0xb5c9('0x4b'))){_0x4682d3[_0xb5c9('0x24')]=qs['limit'](_0x387840['query'][_0xb5c9('0x24')]);_0x4682d3[_0xb5c9('0x23')]=qs[_0xb5c9('0x23')](_0x387840[_0xb5c9('0x42')][_0xb5c9('0x23')]);}_0x4682d3[_0xb5c9('0x4c')]=qs[_0xb5c9('0x4d')](_0x387840[_0xb5c9('0x42')][_0xb5c9('0x4d')]);_0x4682d3[_0xb5c9('0x7c')]=qs[_0xb5c9('0x44')](_[_0xb5c9('0x4e')](_0x387840['query'],_0x522708['filters']));_0x4682d3[_0xb5c9('0x7c')][_0xb5c9('0xae')]=_0x34d208['id'];if(_0x387840[_0xb5c9('0x42')][_0xb5c9('0x86')]){_0x4682d3[_0xb5c9('0x7c')]=_[_0xb5c9('0x98')](_0x4682d3['where'],{'$or':_[_0xb5c9('0x30')](_0x4682d3['attributes'],function(_0xa1fd05){var _0xc0d024={};_0xc0d024[_0xa1fd05]={'$like':'%'+_0x387840[_0xb5c9('0x42')]['filter']+'%'};return _0xc0d024;})});}if(_0x387840[_0xb5c9('0x42')][_0xb5c9('0xbc')]){var _0x152ff4=_0x387840[_0xb5c9('0x42')][_0xb5c9('0xbc')][_0xb5c9('0x34')](',');var _0x2886d0={};_0x2886d0[_0x152ff4[0x0]]={'$gte':moment(_0x152ff4[0x1])[_0xb5c9('0xbd')](_0xb5c9('0xbe'))};_0x4682d3[_0xb5c9('0x7c')]=_[_0xb5c9('0x98')](_0x4682d3[_0xb5c9('0x7c')],_0x2886d0);}_0x4682d3=_['merge']({},_0x4682d3,_0x387840[_0xb5c9('0xb2')]);return db['SmsMessage'][_0xb5c9('0x26')]({'where':_0x4682d3[_0xb5c9('0x7c')]})[_0xb5c9('0x2b')](function(_0x1d3184){_0x5021dd['count']=_0x1d3184;if(_0x387840[_0xb5c9('0x42')][_0xb5c9('0xb1')]){_0x4682d3['include']=[{'all':!![]}];}return db['SmsMessage'][_0xb5c9('0xbf')](_0x4682d3);})[_0xb5c9('0x2b')](function(_0x3a50bb){_0x5021dd[_0xb5c9('0xc0')]=_0x3a50bb;return _0x5021dd;});}})[_0xb5c9('0x2b')](respondWithFilteredResult(_0x43b2a4,_0x4682d3))[_0xb5c9('0xaf')](handleError(_0x43b2a4,null));};exports[_0xb5c9('0xc1')]=function(_0x2b2a5e,_0x406067,_0x440903){return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0x2b2a5e[_0xb5c9('0xb0')]['id']}})['then'](handleEntityNotFound(_0x406067,null))[_0xb5c9('0x2b')](function(_0x5942d1){if(_0x5942d1){return _0x5942d1[_0xb5c9('0xc2')](_0x2b2a5e[_0xb5c9('0x77')]['ids'],_[_0xb5c9('0xba')](_0x2b2a5e['body'],[_0xb5c9('0xb9'),'id'])||{})['spread'](function(){return db[_0xb5c9('0xc3')][_0xb5c9('0xbf')]({'attributes':['id',_0xb5c9('0x2d'),_0xb5c9('0x51')],'where':{'id':_0x2b2a5e[_0xb5c9('0x77')][_0xb5c9('0xb9')]}});})[_0xb5c9('0x2b')](function(_0x443def){socket[_0xb5c9('0xc4')](_0xb5c9('0xc5'),{'id':Number(_0x2b2a5e[_0xb5c9('0xb0')]['id']),'tags':_0x443def||[]});return{'id':Number(_0x2b2a5e[_0xb5c9('0xb0')]['id']),'tags':_0x443def||[]};});}})[_0xb5c9('0x2b')](respondWithResult(_0x406067,null))[_0xb5c9('0xaf')](handleError(_0x406067,null));};exports[_0xb5c9('0xc6')]=function(_0x38c261,_0x10f1b4,_0x361684){return db[_0xb5c9('0x3f')][_0xb5c9('0x76')]({'where':{'id':_0x38c261[_0xb5c9('0xb0')]['id']}})['then'](handleEntityNotFound(_0x10f1b4,null))['then'](function(_0xdab298){if(_0xdab298){return _0xdab298[_0xb5c9('0xc6')](_0x38c261[_0xb5c9('0x42')][_0xb5c9('0xb9')]);}})['then'](respondWithStatusCode(_0x10f1b4,null))[_0xb5c9('0xaf')](handleError(_0x10f1b4,null));};exports[_0xb5c9('0xc7')]=function(_0x86d5d3,_0x5dcbe3){var _0x20fc0b=moment()[_0xb5c9('0xc8')]()[_0xb5c9('0x97')]();var _0x249978=path[_0xb5c9('0xc9')](config[_0xb5c9('0xca')],_0xb5c9('0xcb'),_0xb5c9('0xcc'),_0xb5c9('0xcd'));var _0x201c5c=path[_0xb5c9('0xc9')](config[_0xb5c9('0xca')],'server',_0xb5c9('0xcc'),_0xb5c9('0xce'));var _0x680381=path[_0xb5c9('0xc9')](_0x249978,_0x20fc0b);var _0x2394f2=util['format'](_0xb5c9('0xcf'),_0x86d5d3[_0xb5c9('0xb0')]['id'],_0x20fc0b);var _0x473742=path[_0xb5c9('0xc9')](_0x249978,_0x2394f2);var _0x24dfaa=[];_0x24dfaa[_0xb5c9('0x36')]({'model':db[_0xb5c9('0x73')],'as':_0xb5c9('0x73'),'attributes':['id',_0xb5c9('0x31')],'raw':!![]});_0x24dfaa[_0xb5c9('0x36')]({'model':db['CmContact'],'as':_0xb5c9('0x68'),'attributes':['id',_0xb5c9('0xd0'),_0xb5c9('0xd1')],'raw':!![]});var _0x195f3a=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xb5c9('0x77'),'createdAt',_0xb5c9('0xd2'),'secret',_0xb5c9('0xd3')],'include':_0x24dfaa}];_0x195f3a['push']({'model':db[_0xb5c9('0xd4')],'as':_0xb5c9('0xd5'),'attributes':['id','name']});_0x195f3a[_0xb5c9('0x36')]({'model':db[_0xb5c9('0x73')],'as':'Owner','attributes':['id',_0xb5c9('0x31')]});return db['SmsInteraction'][_0xb5c9('0x76')]({'where':{'id':_0x86d5d3['params']['id']},'include':_0x195f3a})[_0xb5c9('0x2b')](handleEntityNotFound(_0x5dcbe3,null))[_0xb5c9('0x2b')](function(_0x5d9580){if(_0x5d9580){var _0x2db4d9=_0x5d9580[_0xb5c9('0xd6')]({'plain':!![]});fs[_0xb5c9('0xd7')](_0x680381);var _0x1ae8a4={'channel':_0xb5c9('0xd8'),'account':_0x2db4d9[_0xb5c9('0xd5')][_0xb5c9('0x2d')],'agent':_0x2db4d9[_0xb5c9('0xd9')]?_0x2db4d9[_0xb5c9('0xd9')][_0xb5c9('0x31')]:_0xb5c9('0xda'),'createdAt':moment(_0x2db4d9[_0xb5c9('0x7f')])['format'](_0xb5c9('0xbe'))[_0xb5c9('0x97')](),'closedAt':_0x2db4d9[_0xb5c9('0x3b')]?moment(_0x2db4d9[_0xb5c9('0xdb')])[_0xb5c9('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb5c9('0x97')]():'','disposition':_0x2db4d9[_0xb5c9('0xdc')],'messages':_(_0x2db4d9[_0xb5c9('0xdd')])[_0xb5c9('0x86')]({'secret':![]})[_0xb5c9('0x30')](function(_0x1c6b38){return{'date':moment(_0x1c6b38[_0xb5c9('0x7f')])[_0xb5c9('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1c6b38[_0xb5c9('0xd2')]===_0xb5c9('0xde')?_0x1c6b38[_0xb5c9('0x73')]?_0x1c6b38[_0xb5c9('0x73')][_0xb5c9('0x31')]:'System':_0x1c6b38[_0xb5c9('0x68')]['firstName']+(_0x1c6b38[_0xb5c9('0x68')]['lastName']?'\x20'+_0x1c6b38[_0xb5c9('0x68')][_0xb5c9('0xd1')]:''),'body':_0x1c6b38[_0xb5c9('0x77')],'direction':_0x1c6b38[_0xb5c9('0xd2')]==='out'?'A':'C','secret':_0x1c6b38[_0xb5c9('0xdf')],'read':_0x1c6b38['read']};})['value']()};return ejs['renderFile'](path[_0xb5c9('0xc9')](config[_0xb5c9('0xca')],_0xb5c9('0xcb'),_0xb5c9('0xe0'),_0xb5c9('0xe1')),{'interaction':_0x1ae8a4})[_0xb5c9('0x2b')](function(_0x3d2918){var _0x1fae91=path['join'](_0x680381,_0xb5c9('0xe2')+_0x2db4d9['id']+'-'+_0x20fc0b+'.pdf');var _0x313b62={'path':_0x1fae91,'channel':_0xb5c9('0xd8'),'interactionId':_0x2db4d9['id']};return pdf[_0xb5c9('0xe3')](_0x3d2918,_0x313b62);})[_0xb5c9('0x2b')](function(){return new BPromise(function(_0x1f6683,_0x3e12c8){zipdir(_0x680381,{'saveTo':_0x473742},function(_0x46b684,_0x423cb4){if(_0x46b684)return _0x3e12c8(_0x46b684);return _0x1f6683(_0x423cb4);});})['then'](function(){return new BPromise(function(_0x3c5caf,_0xdf828c){rimraf(_0x680381,function(_0x570c1c){if(_0x570c1c)_0xdf828c(_0x570c1c);return _0x3c5caf();});});})[_0xb5c9('0x2b')](function(){return _0x5dcbe3['download'](_0x473742,_0x2394f2,function(_0x22dac0){if(_0x22dac0){console['log'](_0xb5c9('0xe4'),_0x22dac0);}else{fs[_0xb5c9('0xe5')](_0x473742);}});});});}else{return _0x5dcbe3[_0xb5c9('0x20')](0xc8);}})[_0xb5c9('0xaf')](handleError(_0x5dcbe3,null));}; \ No newline at end of file +var _0xc8c8=['sort','where','pick','select','field','color','tools_tags','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','params','keys','includeAll','include','merge','options','create','body','destroy','describe','SmsMessage','addMessage','ids','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','omit','spread','findAll','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','firstName','lastName','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','disposition','Messages','System','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./smsInteraction.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','catch','talking','unmanaged','total','UserId','waiting','closed','SmsInteraction','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x5bf008,_0x489920){var _0x160e7b=function(_0x36f6ab){while(--_0x36f6ab){_0x5bf008['push'](_0x5bf008['shift']());}};_0x160e7b(++_0x489920);}(_0xc8c8,0x186));var _0x8c8c=function(_0x1612fe,_0x3e99ea){_0x1612fe=_0x1612fe-0x0;var _0x137e97=_0xc8c8[_0x1612fe];return _0x137e97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c8c('0x0'));var zipdir=require(_0x8c8c('0x1'));var jsonpatch=require(_0x8c8c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8c8c('0x3'));var Mustache=require(_0x8c8c('0x4'));var util=require(_0x8c8c('0x5'));var path=require(_0x8c8c('0x6'));var sox=require('sox');var csv=require(_0x8c8c('0x7'));var ejs=require(_0x8c8c('0x8'));var fs=require('fs');var fs_extra=require(_0x8c8c('0x9'));var _=require(_0x8c8c('0xa'));var squel=require(_0x8c8c('0xb'));var crypto=require(_0x8c8c('0xc'));var jsforce=require(_0x8c8c('0xd'));var deskjs=require(_0x8c8c('0xe'));var toCsv=require(_0x8c8c('0x7'));var querystring=require(_0x8c8c('0xf'));var Papa=require(_0x8c8c('0x10'));var Redis=require(_0x8c8c('0x11'));var authService=require(_0x8c8c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8c8c('0x13'));var pdf=require(_0x8c8c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c8c('0x15'))('api');var utils=require(_0x8c8c('0x16'));var config=require(_0x8c8c('0x17'));var licenseUtil=require(_0x8c8c('0x18'));var db=require(_0x8c8c('0x19'))['db'];config['redis']=_[_0x8c8c('0x1a')](config[_0x8c8c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c8c('0x1b')]));require(_0x8c8c('0x1c'))['register'](socket);function respondWithStatusCode(_0x2eea10,_0x59a92d){_0x59a92d=_0x59a92d||0xcc;return function(_0x1b23c2){if(_0x1b23c2){return _0x2eea10[_0x8c8c('0x1d')](_0x59a92d);}return _0x2eea10[_0x8c8c('0x1e')](_0x59a92d)[_0x8c8c('0x1f')]();};}function respondWithResult(_0x2efbcd,_0x5e38be){_0x5e38be=_0x5e38be||0xc8;return function(_0x2f7927){if(_0x2f7927){return _0x2efbcd[_0x8c8c('0x1e')](_0x5e38be)['json'](_0x2f7927);}};}function respondWithFilteredResult(_0x527abd,_0x2a0752){return function(_0x1fc3c8){if(_0x1fc3c8){var _0x247ce2=typeof _0x2a0752[_0x8c8c('0x20')]===_0x8c8c('0x21')&&typeof _0x2a0752['limit']===_0x8c8c('0x21');var _0x525cb1=_0x1fc3c8[_0x8c8c('0x22')];var _0x3051ea=_0x247ce2?0x0:_0x2a0752[_0x8c8c('0x20')];var _0x2d4653=_0x247ce2?_0x1fc3c8[_0x8c8c('0x22')]:_0x2a0752[_0x8c8c('0x20')]+_0x2a0752[_0x8c8c('0x23')];var _0xf83ff4;if(_0x2d4653>=_0x525cb1){_0x2d4653=_0x525cb1;_0xf83ff4=0xc8;}else{_0xf83ff4=0xce;}_0x527abd[_0x8c8c('0x1e')](_0xf83ff4);return _0x527abd[_0x8c8c('0x24')](_0x8c8c('0x25'),_0x3051ea+'-'+_0x2d4653+'/'+_0x525cb1)[_0x8c8c('0x26')](_0x1fc3c8);}return null;};}function patchUpdates(_0x135497){return function(_0x2374a4){try{jsonpatch[_0x8c8c('0x27')](_0x2374a4,_0x135497,!![]);}catch(_0x57c4b6){return BPromise['reject'](_0x57c4b6);}return _0x2374a4[_0x8c8c('0x28')]();};}function saveUpdates(_0x21f523,_0x1e6e7b){return function(_0x1a5ebd){if(_0x1a5ebd){return _0x1a5ebd[_0x8c8c('0x29')](_0x21f523)['then'](function(_0x436176){return _0x436176;});}return null;};}function removeEntity(_0x4dd305,_0x6f30f8){return function(_0x12b350){if(_0x12b350){return _0x12b350['destroy']()[_0x8c8c('0x2a')](function(){_0x4dd305[_0x8c8c('0x1e')](0xcc)[_0x8c8c('0x1f')]();});}};}function handleEntityNotFound(_0x532f3a,_0xda69d1){return function(_0x588251){if(!_0x588251){_0x532f3a[_0x8c8c('0x1d')](0x194);}return _0x588251;};}function handleError(_0x344ef3,_0x10524a){_0x10524a=_0x10524a||0x1f4;return function(_0x3eeedc){logger['error'](_0x3eeedc[_0x8c8c('0x2b')]);if(_0x3eeedc['name']){delete _0x3eeedc[_0x8c8c('0x2c')];}_0x344ef3[_0x8c8c('0x1e')](_0x10524a)[_0x8c8c('0x2d')](_0x3eeedc);};}function getInteractionUsers(_0x1ecd84,_0x528e5a){return new BPromise(function(_0x2274d6,_0x2ff03b){try{if(_0x528e5a[_0x1ecd84['id']]){_0x1ecd84[_0x8c8c('0x2e')]=_[_0x8c8c('0x2f')](_0x528e5a[_0x1ecd84['id']],function(_0x40ac4){return{'id':_0x40ac4['id'],'fullname':_0x40ac4[_0x8c8c('0x30')]};});}}catch(_0x2b10b3){_0x2ff03b(_0x2b10b3);}_0x2274d6(_0x1ecd84);});}function getInteractionTags(_0x5f2fcc,_0x316a32){return new BPromise(function(_0x4596b1,_0x149e5c){try{if(_0x5f2fcc[_0x8c8c('0x31')]){_0x5f2fcc['Tags']=[];_0x5f2fcc[_0x8c8c('0x31')][_0x8c8c('0x32')](',')[_0x8c8c('0x33')](function(_0x73d42c){_0x5f2fcc['Tags'][_0x8c8c('0x34')](_0x316a32[_0x73d42c]);});}delete _0x5f2fcc[_0x8c8c('0x31')];}catch(_0x8262d){_0x149e5c(_0x8262d);}_0x4596b1(_0x5f2fcc);});}function updateSmsInteraction(_0x5d94cc,_0x106a16,_0x180b78){return new BPromise(function(_0x5bb444,_0xdd0a81){return getInteractionUsers(_0x5d94cc,_0x180b78)[_0x8c8c('0x2a')](function(_0x4f19a4){return getInteractionTags(_0x4f19a4,_0x106a16);})['then'](function(_0x4f4d47){return getStateInteraction(_0x4f4d47);})[_0x8c8c('0x2a')](function(_0xb5f7c){_0x5bb444(_0xb5f7c);})[_0x8c8c('0x35')](function(_0x57a8e3){_0xdd0a81(_0x57a8e3);});});}function getStateInteraction(_0x5f1bab){return new BPromise(function(_0x41150a){_0x5f1bab['waiting']=0x0;_0x5f1bab[_0x8c8c('0x36')]=0x0;_0x5f1bab['answered']=0x0;_0x5f1bab[_0x8c8c('0x37')]=0x0;_0x5f1bab[_0x8c8c('0x38')]=0x0;if(!_0x5f1bab['closed']&&!_0x5f1bab[_0x8c8c('0x39')]){_0x5f1bab[_0x8c8c('0x3a')]+=0x1;}if(!_0x5f1bab[_0x8c8c('0x3b')]&&_0x5f1bab['UserId']){_0x5f1bab[_0x8c8c('0x36')]+=0x1;if(_0x5f1bab['waiting']){_0x5f1bab['waiting']-=0x1;}}if(_0x5f1bab[_0x8c8c('0x3b')]&&_0x5f1bab[_0x8c8c('0x39')]){_0x5f1bab['answered']+=0x1;if(_0x5f1bab[_0x8c8c('0x36')]){_0x5f1bab[_0x8c8c('0x36')]-=0x1;}}if(_0x5f1bab[_0x8c8c('0x3b')]&&!_0x5f1bab[_0x8c8c('0x39')]){_0x5f1bab['unmanaged']+=0x1;if(_0x5f1bab[_0x8c8c('0x3a')]){_0x5f1bab[_0x8c8c('0x3a')]-=0x1;}}_0x5f1bab[_0x8c8c('0x38')]+=0x1;_0x41150a(_0x5f1bab);});}exports['index']=function(_0x3843fe,_0xafe82f){var _0x3a6583={},_0x4b1c27={},_0x16b81e={'count':0x0,'rows':[]};var _0x4fa2ff=_[_0x8c8c('0x2f')](db[_0x8c8c('0x3c')]['rawAttributes'],function(_0x37955a){return{'name':_0x37955a[_0x8c8c('0x3d')],'type':_0x37955a[_0x8c8c('0x3e')]['key']};});_0x4b1c27[_0x8c8c('0x3f')]=_['map'](_0x4fa2ff,_0x8c8c('0x2c'));_0x4b1c27[_0x8c8c('0x40')]=_['keys'](_0x3843fe[_0x8c8c('0x40')]);_0x4b1c27[_0x8c8c('0x41')]=_[_0x8c8c('0x42')](_0x4b1c27[_0x8c8c('0x3f')],_0x4b1c27[_0x8c8c('0x40')]);_0x3a6583[_0x8c8c('0x43')]=_[_0x8c8c('0x42')](_0x4b1c27['model'],qs[_0x8c8c('0x44')](_0x3843fe['query'][_0x8c8c('0x44')]));_0x3a6583[_0x8c8c('0x43')]=_0x3a6583[_0x8c8c('0x43')][_0x8c8c('0x45')]?_0x3a6583[_0x8c8c('0x43')]:_0x4b1c27[_0x8c8c('0x3f')];if(!_0x3843fe['query'][_0x8c8c('0x46')]('nolimit')){_0x3a6583[_0x8c8c('0x23')]=qs[_0x8c8c('0x23')](_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x23')]);_0x3a6583[_0x8c8c('0x20')]=qs['offset'](_0x3843fe['query'][_0x8c8c('0x20')]);}_0x3a6583[_0x8c8c('0x47')]=qs[_0x8c8c('0x48')](_0x3843fe['query'][_0x8c8c('0x48')]);_0x3a6583[_0x8c8c('0x49')]=qs[_0x8c8c('0x41')](_[_0x8c8c('0x4a')](_0x3843fe[_0x8c8c('0x40')],_0x4b1c27[_0x8c8c('0x41')]),_0x4fa2ff);var _0x2318bc=[];var _0x11cded=squel[_0x8c8c('0x4b')]()['field']('id')[_0x8c8c('0x4c')](_0x8c8c('0x2c'))[_0x8c8c('0x4c')](_0x8c8c('0x4d'))['from'](_0x8c8c('0x4e'));var _0x18624a=squel[_0x8c8c('0x4b')]()[_0x8c8c('0x4c')]('u.id')[_0x8c8c('0x4c')](_0x8c8c('0x4f'))[_0x8c8c('0x4c')](_0x8c8c('0x50'))[_0x8c8c('0x51')](_0x8c8c('0x52'),'ui')[_0x8c8c('0x53')](_0x8c8c('0x54'),'u',_0x8c8c('0x55'));var _0x8dc7c1=squel[_0x8c8c('0x4b')]()['from'](_0x8c8c('0x56'),'i')['left_join']('cm_contacts','c',_0x8c8c('0x57'))[_0x8c8c('0x53')](_0x8c8c('0x54'),'o',_0x8c8c('0x58'))[_0x8c8c('0x53')](_0x8c8c('0x59'),'a',_0x8c8c('0x5a'))['left_join'](_0x8c8c('0x5b'),'me',_0x8c8c('0x5c'))[_0x8c8c('0x53')]('sms_interaction_has_tags','it',_0x8c8c('0x5d'))[_0x8c8c('0x53')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x560e35=squel['expr']();var _0x211e6a=[];var _0x5daade=squel[_0x8c8c('0x5e')]();var _0x5b2f84;if(_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x5f')]){_0x5b2f84=as['parseSearch'](_0x3843fe['query'][_0x8c8c('0x5f')]);var _0x4723b5=_0x5b2f84['sqlOperator'];for(var _0x20aa79=0x0;_0x20aa79<_0x5b2f84[_0x8c8c('0x60')][_0x8c8c('0x45')];_0x20aa79++){var _0x2da14e=_0x5b2f84[_0x8c8c('0x60')][_0x20aa79];var _0x332985='i';var _0x26a7dd=_[_0x8c8c('0x61')](_0x4fa2ff,[_0x8c8c('0x2c'),_0x2da14e['field']]);if(!_0x26a7dd){switch(_0x2da14e[_0x8c8c('0x4c')]){case _0x8c8c('0x62'):if(_0x2da14e[_0x8c8c('0x63')]==0x1){_0x8dc7c1[_0x8c8c('0x64')]('`'+_0x2da14e[_0x8c8c('0x4c')]+_0x8c8c('0x65'));}else{_0x8dc7c1[_0x8c8c('0x64')]('`'+_0x2da14e[_0x8c8c('0x4c')]+_0x8c8c('0x66'));}break;case _0x8c8c('0x67'):if(_0x2da14e[_0x8c8c('0x68')]===_0x8c8c('0x69')){if(_0x2da14e['value'][_0x8c8c('0x32')]('\x20')['length']>0x1){_0x560e35[_0x4723b5](_0x8c8c('0x6a'),qs[_0x8c8c('0x6b')](_0x2da14e['value']),null);}else{var _0x524d17='%'+_0x2da14e['value']+'%';_0x560e35[_0x4723b5](_0x8c8c('0x6c'),_0x524d17,_0x524d17,_0x524d17);}}else{_0x26a7dd=_['find'](_0x4fa2ff,[_0x8c8c('0x2c'),_0x8c8c('0x6d')]);_0x2da14e[_0x8c8c('0x4c')]='ContactId';_0x14027e=as['buildExpression'](_0x332985,_0x26a7dd[_0x8c8c('0x3e')],_0x2da14e);_0x560e35[_0x4723b5](_0x14027e[_0x8c8c('0x6e')],_0x14027e['value']['start'],_0x14027e[_0x8c8c('0x63')][_0x8c8c('0x1f')]);}break;case _0x8c8c('0x6f'):var _0x228403=_0x2da14e[_0x8c8c('0x63')]['split'](',')[_0x8c8c('0x2f')](function(_0x1057d0){return Number(_0x1057d0);});_0x228403[_0x8c8c('0x33')](function(_0x3b277b){_0x5daade['or'](_0x8c8c('0x70'),'%,'+_0x3b277b+',%');});_0x211e6a=_[_0x8c8c('0x71')](_0x211e6a,_0x228403);break;case'User':if(_0x2da14e[_0x8c8c('0x68')]===_0x8c8c('0x69')){_0x560e35[_0x4723b5](_0x8c8c('0x72'),'%'+_0x2da14e[_0x8c8c('0x63')]+'%',null);}else{_0x26a7dd=_['find'](_0x4fa2ff,['name',_0x8c8c('0x39')]);_0x2da14e[_0x8c8c('0x4c')]=_0x8c8c('0x39');_0x14027e=as[_0x8c8c('0x73')](_0x332985,_0x26a7dd[_0x8c8c('0x3e')],_0x2da14e);_0x560e35[_0x4723b5](_0x14027e['text'],_0x14027e[_0x8c8c('0x63')][_0x8c8c('0x74')],_0x14027e[_0x8c8c('0x63')]['end']);}break;case'body':_0x14027e=as[_0x8c8c('0x73')]('me',null,_0x2da14e);_0x560e35[_0x4723b5](_0x14027e[_0x8c8c('0x6e')],_0x14027e[_0x8c8c('0x63')][_0x8c8c('0x74')],_0x14027e[_0x8c8c('0x63')][_0x8c8c('0x1f')]);break;}}else{var _0x14027e=as[_0x8c8c('0x73')](_0x332985,_0x26a7dd[_0x8c8c('0x3e')],_0x2da14e);_0x560e35[_0x4723b5](_0x14027e[_0x8c8c('0x6e')],_0x14027e[_0x8c8c('0x63')][_0x8c8c('0x74')],_0x14027e[_0x8c8c('0x63')][_0x8c8c('0x1f')]);}}}else{var _0x3c7418=_(_0x3843fe[_0x8c8c('0x40')])['keys']()['map'](function(_0x4228f3){return _['some'](_0x4fa2ff,[_0x8c8c('0x2c'),_0x4228f3])?_0x4228f3:undefined;})[_0x8c8c('0x75')]()['value']();if(!_[_0x8c8c('0x76')](_0x3c7418)){_0x3c7418[_0x8c8c('0x33')](function(_0x58284c){if(_0x58284c===_0x8c8c('0x77')){_0x8dc7c1['where'](_0x8c8c('0x78'),[][_0x8c8c('0x79')](_0x3843fe['query'][_0x58284c]));}else if(_0x58284c===_0x8c8c('0x7a')){var _0x22b5a5=JSON[_0x8c8c('0x7b')](_0x3843fe['query'][_0x58284c])[_0x8c8c('0x7c')];var _0x1e9d27=JSON[_0x8c8c('0x7b')](_0x3843fe[_0x8c8c('0x40')][_0x58284c])[_0x8c8c('0x7d')];_0x8dc7c1[_0x8c8c('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x22b5a5,_0x1e9d27);}else{if(_0x3843fe[_0x8c8c('0x40')][_0x58284c]===_0x8c8c('0x7e')){_0x8dc7c1[_0x8c8c('0x49')]('i.'+_0x58284c+_0x8c8c('0x7f'));}else{_0x8dc7c1[_0x8c8c('0x49')]('i.'+_0x58284c+_0x8c8c('0x80'),_0x3843fe[_0x8c8c('0x40')][_0x58284c]);}}});}if(_0x3843fe[_0x8c8c('0x40')]['read']){if(_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x81')]==0x1){_0x8dc7c1[_0x8c8c('0x64')](_0x8c8c('0x82'));}else{_0x8dc7c1[_0x8c8c('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x83')]){_0x211e6a=_[_0x8c8c('0x84')](_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x83')])?_0x3843fe['query'][_0x8c8c('0x83')]:new Array(_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x83')]);_0x211e6a[_0x8c8c('0x33')](function(_0x35fb9e){_0x5daade['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35fb9e+',%');});}if(_0x3843fe[_0x8c8c('0x40')]['filter']){var _0x3edf99=_0x3843fe[_0x8c8c('0x40')][_0x8c8c('0x85')][_0x8c8c('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8c8c('0x87')](_0x3edf99)){_0x560e35['or']('i.id\x20LIKE\x20?',_0x3edf99+'%')['or'](_0x8c8c('0x88'),_0x3edf99+'%');}else{_0x560e35['or'](_0x8c8c('0x89'),qs[_0x8c8c('0x6b')](_0x3edf99))['or'](_0x8c8c('0x8a'),_0x3edf99+'%');}}}_0x8dc7c1[_0x8c8c('0x49')](_0x560e35);_0x8dc7c1[_0x8c8c('0x8b')](_0x8c8c('0x8c'));var _0x19f47a={'type':db['Sequelize'][_0x8c8c('0x8d')][_0x8c8c('0x8e')],'raw':!![]};var _0x3864c4=_0x8dc7c1[_0x8c8c('0x8f')]();_0x3864c4[_0x8c8c('0x4c')]('i.id');_0x3864c4[_0x8c8c('0x4c')](_0x8c8c('0x90'),_0x8c8c('0x62'));if(_0x3a6583[_0x8c8c('0x47')]){_0x3a6583[_0x8c8c('0x47')][_0x8c8c('0x33')](function(_0x4fe04e){var _0x86c2f2=_0x4fe04e[0x0]===_0x8c8c('0x91')?_0x4fe04e[0x0]:'i.'+_0x4fe04e[0x0];_0x8dc7c1[_0x8c8c('0x47')](_0x86c2f2,_0x4fe04e[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8c8c('0x76')](_0x211e6a)){_0x8dc7c1[_0x8c8c('0x64')](_0x5daade);_0x3864c4[_0x8c8c('0x49')]('t.id\x20IN\x20?',_0x211e6a);}BPromise['resolve']()['then'](function(){if(!_0x5b2f84){if(_0x3843fe['query'][_0x8c8c('0x77')])return;_0x3864c4[_0x8c8c('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x8dc7c1[_0x8c8c('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3843fe['user'][_0x8c8c('0x92')]!==_0x8c8c('0x93'))return;return _0x3843fe[_0x8c8c('0x94')][_0x8c8c('0x95')]({'attributes':['id'],'raw':!![]})[_0x8c8c('0x2a')](function(_0x27a7ba){if(_['isEmpty'](_0x27a7ba)){_0x3864c4['where']('i.SmsAccountId\x20IS\x20NULL');_0x8dc7c1['where'](_0x8c8c('0x96'));}else{_0x3864c4[_0x8c8c('0x49')]('i.SmsAccountId\x20IN\x20?',_[_0x8c8c('0x2f')](_0x27a7ba,'id'));_0x8dc7c1[_0x8c8c('0x49')]('i.SmsAccountId\x20IN\x20?',_[_0x8c8c('0x2f')](_0x27a7ba,'id'));}});})[_0x8c8c('0x2a')](function(){if(_0x3843fe[_0x8c8c('0x94')][_0x8c8c('0x92')]===_0x8c8c('0x93')&&!_0x5b2f84&&!_0x3843fe[_0x8c8c('0x40')]['SmsAccountId'])return[];return db[_0x8c8c('0x97')][_0x8c8c('0x40')](_0x3864c4[_0x8c8c('0x98')](),_0x19f47a);})['then'](function(_0x26732d){_0x16b81e['count']=_0x26732d[_0x8c8c('0x45')];if(_0x16b81e[_0x8c8c('0x22')]===0x0)return[];return db[_0x8c8c('0x97')]['query'](_0x11cded[_0x8c8c('0x98')](),_0x19f47a)[_0x8c8c('0x2a')](function(_0x41c416){_0x2318bc=_[_0x8c8c('0x99')](_0x41c416,'id');_0x19f47a=_['merge'](_0x19f47a,{'model':db[_0x8c8c('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3843fe[_0x8c8c('0x40')]['fields']){_0x3a6583[_0x8c8c('0x43')][_0x8c8c('0x33')](function(_0x4a4cf1){_0x8dc7c1['field']('i.'+_0x4a4cf1);});}else{_0x8dc7c1[_0x8c8c('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8c8c('0x62'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0x9a'),_0x8c8c('0x9b'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0x9c'),_0x8c8c('0x9d'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0x9e'),_0x8c8c('0x91'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0x9f'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0xa0'),_0x8c8c('0xa1'));_0x8dc7c1[_0x8c8c('0x4c')]('c.lastName',_0x8c8c('0xa2'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0xa3'),'Contact.email');_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0xa4'),_0x8c8c('0xa5'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0xa6'),_0x8c8c('0xa7'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0xa8'),_0x8c8c('0xa9'));_0x8dc7c1[_0x8c8c('0x4c')]('o.fullname',_0x8c8c('0xaa'));_0x8dc7c1[_0x8c8c('0x4c')]('o.internal',_0x8c8c('0xab'));_0x8dc7c1[_0x8c8c('0x4c')](_0x8c8c('0xac'),'TagIds');}if(_0x3a6583[_0x8c8c('0x23')])_0x8dc7c1[_0x8c8c('0x23')](_0x3a6583[_0x8c8c('0x23')]);if(_0x3a6583[_0x8c8c('0x20')])_0x8dc7c1[_0x8c8c('0x20')](_0x3a6583[_0x8c8c('0x20')]);return db['sequelize'][_0x8c8c('0x40')](_0x8dc7c1[_0x8c8c('0x98')](),_0x19f47a);})['then'](function(_0x30853d){if(_0x30853d['length']>0x0)_0x18624a[_0x8c8c('0x49')](_0x8c8c('0xad'),_[_0x8c8c('0x2f')](_0x30853d,'id'));return db[_0x8c8c('0x97')]['query'](_0x18624a[_0x8c8c('0x98')](),_0x19f47a)[_0x8c8c('0x2a')](function(_0x5126d9){var _0x5148af=_['groupBy'](_0x5126d9,_0x8c8c('0xae'));var _0x5a4147=[];_0x30853d[_0x8c8c('0x33')](function(_0x392962){_0x5a4147[_0x8c8c('0x34')](updateSmsInteraction(_0x392962,_0x2318bc,_0x5148af));});return BPromise[_0x8c8c('0xaf')](_0x5a4147);});});})[_0x8c8c('0x2a')](function(_0x3bcce6){_0x16b81e[_0x8c8c('0xb0')]=_0x3bcce6;return _0x16b81e;})[_0x8c8c('0x2a')](respondWithFilteredResult(_0xafe82f,_0x3a6583))['catch'](handleError(_0xafe82f,null));};exports['show']=function(_0x1a834d,_0x9b3836){var _0x27c5c8={'raw':![],'where':{'id':_0x1a834d[_0x8c8c('0xb1')]['id']}},_0x13594e={};_0x13594e[_0x8c8c('0x3f')]=_[_0x8c8c('0xb2')](db[_0x8c8c('0x3c')]['rawAttributes']);_0x13594e[_0x8c8c('0x40')]=_[_0x8c8c('0xb2')](_0x1a834d[_0x8c8c('0x40')]);_0x13594e[_0x8c8c('0x41')]=_[_0x8c8c('0x42')](_0x13594e[_0x8c8c('0x3f')],_0x13594e[_0x8c8c('0x40')]);_0x27c5c8[_0x8c8c('0x43')]=_[_0x8c8c('0x42')](_0x13594e[_0x8c8c('0x3f')],qs[_0x8c8c('0x44')](_0x1a834d['query']['fields']));_0x27c5c8[_0x8c8c('0x43')]=_0x27c5c8['attributes'][_0x8c8c('0x45')]?_0x27c5c8[_0x8c8c('0x43')]:_0x13594e[_0x8c8c('0x3f')];if(_0x1a834d[_0x8c8c('0x40')][_0x8c8c('0xb3')]){_0x27c5c8[_0x8c8c('0xb4')]=[{'all':!![]}];}_0x27c5c8=_[_0x8c8c('0xb5')]({},_0x27c5c8,_0x1a834d[_0x8c8c('0xb6')]);return db[_0x8c8c('0x3c')][_0x8c8c('0x61')](_0x27c5c8)[_0x8c8c('0x2a')](handleEntityNotFound(_0x9b3836,null))[_0x8c8c('0x2a')](respondWithResult(_0x9b3836,null))[_0x8c8c('0x35')](handleError(_0x9b3836,null));};exports[_0x8c8c('0xb7')]=function(_0x1f23d7,_0x1be23e){return db[_0x8c8c('0x3c')][_0x8c8c('0xb7')](_0x1f23d7[_0x8c8c('0xb8')],{})[_0x8c8c('0x2a')](respondWithResult(_0x1be23e,0xc9))[_0x8c8c('0x35')](handleError(_0x1be23e,null));};exports[_0x8c8c('0x29')]=function(_0x4c3531,_0x4235fa){if(_0x4c3531[_0x8c8c('0xb8')]['id']){delete _0x4c3531[_0x8c8c('0xb8')]['id'];}return db[_0x8c8c('0x3c')][_0x8c8c('0x61')]({'where':{'id':_0x4c3531['params']['id']}})[_0x8c8c('0x2a')](handleEntityNotFound(_0x4235fa,null))[_0x8c8c('0x2a')](saveUpdates(_0x4c3531['body'],null))['then'](respondWithResult(_0x4235fa,null))['catch'](handleError(_0x4235fa,null));};exports[_0x8c8c('0xb9')]=function(_0x5dbda5,_0x2ad74c){return db[_0x8c8c('0x3c')][_0x8c8c('0x61')]({'where':{'id':_0x5dbda5[_0x8c8c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x2ad74c,null))[_0x8c8c('0x2a')](removeEntity(_0x2ad74c,null))[_0x8c8c('0x35')](handleError(_0x2ad74c,null));};exports[_0x8c8c('0xba')]=function(_0x52571a,_0xbb0ae3){return db[_0x8c8c('0x3c')][_0x8c8c('0xba')]()[_0x8c8c('0x2a')](respondWithResult(_0xbb0ae3,null))[_0x8c8c('0x35')](handleError(_0xbb0ae3,null));};exports['addMessage']=function(_0x2761cb,_0x47f8d4,_0x481768){return db[_0x8c8c('0xbb')][_0x8c8c('0x61')]({'where':{'id':_0x2761cb[_0x8c8c('0xb1')]['id']}})[_0x8c8c('0x2a')](handleEntityNotFound(_0x47f8d4,null))[_0x8c8c('0x2a')](function(_0x521210){if(_0x521210){return _0x521210[_0x8c8c('0xbc')](_0x2761cb[_0x8c8c('0xb8')][_0x8c8c('0xbd')],_['omit'](_0x2761cb[_0x8c8c('0xb8')],[_0x8c8c('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x47f8d4,null))[_0x8c8c('0x35')](handleError(_0x47f8d4,null));};exports['getMessages']=function(_0x2612e2,_0x317513,_0x45d8b2){var _0x15c2ec={'raw':![],'where':{}};var _0x3b43b8={};var _0x141599={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x2612e2[_0x8c8c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x317513,null))[_0x8c8c('0x2a')](function(_0x3a58de){if(_0x3a58de){_0x3b43b8[_0x8c8c('0x3f')]=_[_0x8c8c('0xb2')](db['SmsMessage'][_0x8c8c('0xbe')]);_0x3b43b8[_0x8c8c('0x40')]=_[_0x8c8c('0xb2')](_0x2612e2[_0x8c8c('0x40')]);_0x3b43b8[_0x8c8c('0x41')]=_[_0x8c8c('0x42')](_0x3b43b8[_0x8c8c('0x3f')],_0x3b43b8[_0x8c8c('0x40')]);_0x15c2ec[_0x8c8c('0x43')]=_[_0x8c8c('0x42')](_0x3b43b8[_0x8c8c('0x3f')],qs[_0x8c8c('0x44')](_0x2612e2[_0x8c8c('0x40')][_0x8c8c('0x44')]));_0x15c2ec[_0x8c8c('0x43')]=_0x15c2ec[_0x8c8c('0x43')][_0x8c8c('0x45')]?_0x15c2ec[_0x8c8c('0x43')]:_0x3b43b8[_0x8c8c('0x3f')];if(!_0x2612e2['query'][_0x8c8c('0x46')]('nolimit')){_0x15c2ec[_0x8c8c('0x23')]=qs[_0x8c8c('0x23')](_0x2612e2['query']['limit']);_0x15c2ec[_0x8c8c('0x20')]=qs[_0x8c8c('0x20')](_0x2612e2['query'][_0x8c8c('0x20')]);}_0x15c2ec[_0x8c8c('0x47')]=qs[_0x8c8c('0x48')](_0x2612e2[_0x8c8c('0x40')][_0x8c8c('0x48')]);_0x15c2ec[_0x8c8c('0x49')]=qs[_0x8c8c('0x41')](_[_0x8c8c('0x4a')](_0x2612e2['query'],_0x3b43b8[_0x8c8c('0x41')]));_0x15c2ec['where']['SmsInteractionId']=_0x3a58de['id'];if(_0x2612e2[_0x8c8c('0x40')][_0x8c8c('0x85')]){_0x15c2ec['where']=_['merge'](_0x15c2ec[_0x8c8c('0x49')],{'$or':_['map'](_0x15c2ec[_0x8c8c('0x43')],function(_0x52b0ad){var _0x51fe8d={};_0x51fe8d[_0x52b0ad]={'$like':'%'+_0x2612e2[_0x8c8c('0x40')][_0x8c8c('0x85')]+'%'};return _0x51fe8d;})});}if(_0x2612e2[_0x8c8c('0x40')]['$gte']){var _0xf000ff=_0x2612e2[_0x8c8c('0x40')][_0x8c8c('0x7c')][_0x8c8c('0x32')](',');var _0x413a36={};_0x413a36[_0xf000ff[0x0]]={'$gte':moment(_0xf000ff[0x1])[_0x8c8c('0xbf')](_0x8c8c('0xc0'))};_0x15c2ec[_0x8c8c('0x49')]=_[_0x8c8c('0xb5')](_0x15c2ec[_0x8c8c('0x49')],_0x413a36);}_0x15c2ec=_[_0x8c8c('0xb5')]({},_0x15c2ec,_0x2612e2[_0x8c8c('0xb6')]);return db['SmsMessage'][_0x8c8c('0x22')]({'where':_0x15c2ec['where']})[_0x8c8c('0x2a')](function(_0x367b35){_0x141599[_0x8c8c('0x22')]=_0x367b35;if(_0x2612e2[_0x8c8c('0x40')][_0x8c8c('0xb3')]){_0x15c2ec[_0x8c8c('0xb4')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x15c2ec);})[_0x8c8c('0x2a')](function(_0x29887a){_0x141599[_0x8c8c('0xb0')]=_0x29887a;return _0x141599;});}})['then'](respondWithFilteredResult(_0x317513,_0x15c2ec))[_0x8c8c('0x35')](handleError(_0x317513,null));};exports['addTags']=function(_0x5c5c70,_0x2ee0dd,_0x5cf2c3){return db['SmsInteraction'][_0x8c8c('0x61')]({'where':{'id':_0x5c5c70[_0x8c8c('0xb1')]['id']}})[_0x8c8c('0x2a')](handleEntityNotFound(_0x2ee0dd,null))[_0x8c8c('0x2a')](function(_0x89a262){if(_0x89a262){return _0x89a262['setTags'](_0x5c5c70[_0x8c8c('0xb8')]['ids'],_[_0x8c8c('0xc1')](_0x5c5c70[_0x8c8c('0xb8')],[_0x8c8c('0xbd'),'id'])||{})[_0x8c8c('0xc2')](function(){return db[_0x8c8c('0x6f')][_0x8c8c('0xc3')]({'attributes':['id','name',_0x8c8c('0x4d')],'where':{'id':_0x5c5c70[_0x8c8c('0xb8')]['ids']}});})['then'](function(_0x558278){socket['emit'](_0x8c8c('0xc4'),{'id':Number(_0x5c5c70[_0x8c8c('0xb1')]['id']),'tags':_0x558278||[]});return{'id':Number(_0x5c5c70['params']['id']),'tags':_0x558278||[]};});}})[_0x8c8c('0x2a')](respondWithResult(_0x2ee0dd,null))[_0x8c8c('0x35')](handleError(_0x2ee0dd,null));};exports['removeTags']=function(_0x6c46b3,_0x2c94e8,_0x126441){return db[_0x8c8c('0x3c')][_0x8c8c('0x61')]({'where':{'id':_0x6c46b3[_0x8c8c('0xb1')]['id']}})[_0x8c8c('0x2a')](handleEntityNotFound(_0x2c94e8,null))[_0x8c8c('0x2a')](function(_0x321e94){if(_0x321e94){return _0x321e94[_0x8c8c('0xc5')](_0x6c46b3[_0x8c8c('0x40')][_0x8c8c('0xbd')]);}})[_0x8c8c('0x2a')](respondWithStatusCode(_0x2c94e8,null))['catch'](handleError(_0x2c94e8,null));};exports[_0x8c8c('0xc6')]=function(_0x3987d7,_0x151021){var _0x37379c=moment()[_0x8c8c('0xc7')]()[_0x8c8c('0x98')]();var _0x31699b=path[_0x8c8c('0xc8')](config[_0x8c8c('0xc9')],'server',_0x8c8c('0xca'),_0x8c8c('0xcb'));var _0x2f3260=path[_0x8c8c('0xc8')](config[_0x8c8c('0xc9')],_0x8c8c('0xcc'),_0x8c8c('0xca'),_0x8c8c('0xcd'));var _0x28f531=path[_0x8c8c('0xc8')](_0x31699b,_0x37379c);var _0x4da863=util[_0x8c8c('0xbf')](_0x8c8c('0xce'),_0x3987d7[_0x8c8c('0xb1')]['id'],_0x37379c);var _0x2e68ab=path[_0x8c8c('0xc8')](_0x31699b,_0x4da863);var _0x243e42=[];_0x243e42['push']({'model':db[_0x8c8c('0xcf')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x243e42[_0x8c8c('0x34')]({'model':db['CmContact'],'as':_0x8c8c('0x67'),'attributes':['id',_0x8c8c('0xd0'),_0x8c8c('0xd1')],'raw':!![]});var _0xbc2b59=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x8c8c('0xb8'),_0x8c8c('0x7a'),_0x8c8c('0xd2'),_0x8c8c('0xd3'),_0x8c8c('0x81')],'include':_0x243e42}];_0xbc2b59[_0x8c8c('0x34')]({'model':db[_0x8c8c('0xd4')],'as':_0x8c8c('0xd5'),'attributes':['id',_0x8c8c('0x2c')]});_0xbc2b59[_0x8c8c('0x34')]({'model':db[_0x8c8c('0xcf')],'as':_0x8c8c('0xd6'),'attributes':['id',_0x8c8c('0x30')]});return db['SmsInteraction']['find']({'where':{'id':_0x3987d7[_0x8c8c('0xb1')]['id']},'include':_0xbc2b59})[_0x8c8c('0x2a')](handleEntityNotFound(_0x151021,null))[_0x8c8c('0x2a')](function(_0x48312e){if(_0x48312e){var _0x5c340d=_0x48312e[_0x8c8c('0xd7')]({'plain':!![]});fs[_0x8c8c('0xd8')](_0x28f531);var _0x4fdfda={'channel':'Sms','account':_0x5c340d['Account'][_0x8c8c('0x2c')],'agent':_0x5c340d[_0x8c8c('0xd6')]?_0x5c340d[_0x8c8c('0xd6')][_0x8c8c('0x30')]:'N.A.','createdAt':moment(_0x5c340d[_0x8c8c('0x7a')])[_0x8c8c('0xbf')](_0x8c8c('0xc0'))[_0x8c8c('0x98')](),'closedAt':_0x5c340d[_0x8c8c('0x3b')]?moment(_0x5c340d['closedAt'])['format'](_0x8c8c('0xc0'))['toString']():'','disposition':_0x5c340d[_0x8c8c('0xd9')],'messages':_(_0x5c340d[_0x8c8c('0xda')])[_0x8c8c('0x85')]({'secret':![]})[_0x8c8c('0x2f')](function(_0x22a11b){return{'date':moment(_0x22a11b['createdAt'])['format'](_0x8c8c('0xc0'))[_0x8c8c('0x98')](),'sender':_0x22a11b[_0x8c8c('0xd2')]==='out'?_0x22a11b['User']?_0x22a11b[_0x8c8c('0xcf')][_0x8c8c('0x30')]:_0x8c8c('0xdb'):_0x22a11b[_0x8c8c('0x67')]['firstName']+(_0x22a11b[_0x8c8c('0x67')]['lastName']?'\x20'+_0x22a11b[_0x8c8c('0x67')][_0x8c8c('0xd1')]:''),'body':_0x22a11b[_0x8c8c('0xb8')],'direction':_0x22a11b['direction']===_0x8c8c('0xdc')?'A':'C','secret':_0x22a11b['secret'],'read':_0x22a11b[_0x8c8c('0x81')]};})[_0x8c8c('0x63')]()};return ejs[_0x8c8c('0xdd')](path[_0x8c8c('0xc8')](config['root'],_0x8c8c('0xcc'),_0x8c8c('0xde'),_0x8c8c('0xdf')),{'interaction':_0x4fdfda})[_0x8c8c('0x2a')](function(_0x491df8){var _0x4f75ed=path[_0x8c8c('0xc8')](_0x28f531,_0x8c8c('0xe0')+_0x5c340d['id']+'-'+_0x37379c+_0x8c8c('0xe1'));var _0x5cd179={'path':_0x4f75ed,'channel':_0x8c8c('0xe2'),'interactionId':_0x5c340d['id']};return pdf[_0x8c8c('0xe3')](_0x491df8,_0x5cd179);})[_0x8c8c('0x2a')](function(){return new BPromise(function(_0x5ad633,_0x44a3){zipdir(_0x28f531,{'saveTo':_0x2e68ab},function(_0x581345,_0x1e3730){if(_0x581345)return _0x44a3(_0x581345);return _0x5ad633(_0x1e3730);});})[_0x8c8c('0x2a')](function(){return new BPromise(function(_0x377d30,_0x5f09ef){rimraf(_0x28f531,function(_0x4bcebd){if(_0x4bcebd)_0x5f09ef(_0x4bcebd);return _0x377d30();});});})[_0x8c8c('0x2a')](function(){return _0x151021['download'](_0x2e68ab,_0x4da863,function(_0x4c6155){if(_0x4c6155){console[_0x8c8c('0xe4')](_0x8c8c('0xe5'),_0x4c6155);}else{fs[_0x8c8c('0xe6')](_0x2e68ab);}});});});}else{return _0x151021['sendStatus'](0xc8);}})[_0x8c8c('0x35')](handleError(_0x151021,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b818821..2380539 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 _0xb10b=['remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','update'];(function(_0x3ece20,_0x3d8777){var _0x14e828=function(_0x5d2539){while(--_0x5d2539){_0x3ece20['push'](_0x3ece20['shift']());}};_0x14e828(++_0x3d8777);}(_0xb10b,0x12a));var _0xbb10=function(_0x7f82c7,_0x2bec9d){_0x7f82c7=_0x7f82c7-0x0;var _0xccd46=_0xb10b[_0x7f82c7];return _0xccd46;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xbb10('0x1')];var SmsMessage=require(_0xbb10('0x2'))['db'][_0xbb10('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb10('0x4'),'afterUpdate':_0xbb10('0x5'),'afterDestroy':_0xbb10('0x6')};function emitEvent(_0x22320e){return function(_0x49baf4,_0x312b72,_0x481979){_0x49baf4[_0xbb10('0x7')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x8')](function(_0x513741){_0x49baf4[_0xbb10('0x9')](_0xbb10('0xa'),_0x513741[_0xbb10('0xb')](function(_0x1c3ee5){return{'id':_0x1c3ee5['id']};}));return SmsMessage[_0xbb10('0xc')]({'where':{'SmsInteractionId':_0x49baf4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb10('0x8')](function(_0x229887){_0x49baf4[_0xbb10('0x9')]('unreadMessages',_0x229887['length']);SmsInteractionEvents[_0xbb10('0xd')](_0x22320e+':'+_0x49baf4['id'],_0x49baf4);SmsInteractionEvents[_0xbb10('0xd')](_0x22320e,_0x49baf4);_0x481979(null);})[_0xbb10('0xe')](_0x481979(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xbb10('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x4991=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','events','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x10bcf9,_0x422019){var _0x554af6=function(_0x143f97){while(--_0x143f97){_0x10bcf9['push'](_0x10bcf9['shift']());}};_0x554af6(++_0x422019);}(_0x4991,0xf7));var _0x1499=function(_0x254c5d,_0x5763fa){_0x254c5d=_0x254c5d-0x0;var _0x5e4f74=_0x4991[_0x254c5d];return _0x5e4f74;};'use strict';var EventEmitter=require(_0x1499('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1499('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x1499('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1499('0x3')](0x0);var events={'afterCreate':_0x1499('0x4'),'afterUpdate':_0x1499('0x5'),'afterDestroy':_0x1499('0x6')};function emitEvent(_0x158134){return function(_0x19adff,_0x209616,_0x4b6154){_0x19adff[_0x1499('0x7')]({'attributes':['id'],'raw':!![]})[_0x1499('0x8')](function(_0x1c65c3){_0x19adff[_0x1499('0x9')](_0x1499('0xa'),_0x1c65c3[_0x1499('0xb')](function(_0x3277b3){return{'id':_0x3277b3['id']};}));return SmsMessage[_0x1499('0xc')]({'where':{'SmsInteractionId':_0x19adff['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x16e8ad){_0x19adff[_0x1499('0x9')]('unreadMessages',_0x16e8ad[_0x1499('0xd')]);SmsInteractionEvents[_0x1499('0xe')](_0x158134+':'+_0x19adff['id'],_0x19adff);SmsInteractionEvents['emit'](_0x158134,_0x19adff);_0x4b6154(null);})[_0x1499('0xf')](_0x4b6154(null));};}for(var e in events){if(events[_0x1499('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 61fa0f9..9c16018 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 _0xb80f=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2b3b1d,_0x2b3004){var _0x4b15cb=function(_0x78f031){while(--_0x78f031){_0x2b3b1d['push'](_0x2b3b1d['shift']());}};_0x4b15cb(++_0x2b3004);}(_0xb80f,0x12b));var _0xfb80=function(_0x53415f,_0x49f49d){_0x53415f=_0x53415f-0x0;var _0x192a85=_0xb80f[_0x53415f];return _0x192a85;};'use strict';var _=require(_0xfb80('0x0'));var util=require(_0xfb80('0x1'));var logger=require(_0xfb80('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfb80('0x3'));var rp=require(_0xfb80('0x4'));var fs=require('fs');var path=require(_0xfb80('0x5'));var rimraf=require(_0xfb80('0x6'));var config=require(_0xfb80('0x7'));var attributes=require(_0xfb80('0x8'));module[_0xfb80('0x9')]=function(_0x3cffae,_0x22dce3){return _0x3cffae['define'](_0xfb80('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36386a,_0x3a1dbc,_0x48e35a){if(_0x36386a[_0xfb80('0xb')](_0xfb80('0xc'))){_0x36386a[_0xfb80('0xd')]=moment()['format'](_0xfb80('0xe'));}_0x48e35a(null,_0x36386a);}}});}; \ No newline at end of file +var _0x8856=['exports','define','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8856,0x111));var _0x6885=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8856[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6885('0x0'))(_0x6885('0x1'));var moment=require('moment');var BPromise=require(_0x6885('0x2'));var rp=require(_0x6885('0x3'));var fs=require('fs');var path=require(_0x6885('0x4'));var rimraf=require(_0x6885('0x5'));var config=require(_0x6885('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x6885('0x7')]=function(_0x374a00,_0x5a60f7){return _0x374a00[_0x6885('0x8')](_0x6885('0x9'),attributes,{'tableName':_0x6885('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50a073,_0xa36429,_0x23c1b2){if(_0x50a073[_0x6885('0xb')]('closed')){_0x50a073[_0x6885('0xc')]=moment()['format'](_0x6885('0xd'));}_0x23c1b2(null,_0x50a073);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ad8eb54..e37455c 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 _0x90cc=['SmsInteraction,\x20%s,\x20%s','info','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x90cc,0x119));var _0xc90c=function(_0xa306da,_0x2ef307){_0xa306da=_0xa306da-0x0;var _0x29f2db=_0x90cc[_0xa306da];return _0x29f2db;};'use strict';var _=require(_0xc90c('0x0'));var util=require(_0xc90c('0x1'));var moment=require('moment');var BPromise=require(_0xc90c('0x2'));var rs=require(_0xc90c('0x3'));var fs=require('fs');var Redis=require(_0xc90c('0x4'));var db=require(_0xc90c('0x5'))['db'];var utils=require(_0xc90c('0x6'));var logger=require(_0xc90c('0x7'))(_0xc90c('0x8'));var config=require(_0xc90c('0x9'));var jayson=require(_0xc90c('0xa'));var client=jayson[_0xc90c('0xb')][_0xc90c('0xc')]({'port':0x232a});config[_0xc90c('0xd')]=_['defaults'](config[_0xc90c('0xd')],{'host':_0xc90c('0xe'),'port':0x18eb});var socket=require(_0xc90c('0xf'))(new Redis(config[_0xc90c('0xd')]));require(_0xc90c('0x10'))[_0xc90c('0x11')](socket);function respondWithRpcPromise(_0x550c0c,_0xf41598,_0x31b439){return new BPromise(function(_0x43147a,_0x5731cc){return client[_0xc90c('0x12')](_0x550c0c,_0x31b439)[_0xc90c('0x13')](function(_0x1ffd13){logger['info']('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0xc90c('0x14'));logger[_0xc90c('0x15')](_0xc90c('0x16'),_0xf41598,_0xc90c('0x14'),JSON[_0xc90c('0x17')](_0x1ffd13));if(_0x1ffd13[_0xc90c('0x18')]){if(_0x1ffd13[_0xc90c('0x18')][_0xc90c('0x19')]===0x1f4){logger[_0xc90c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0x1ffd13[_0xc90c('0x18')]['message']);return _0x5731cc(_0x1ffd13[_0xc90c('0x18')][_0xc90c('0x1a')]);}logger[_0xc90c('0x18')](_0xc90c('0x1b'),_0xf41598,_0x1ffd13[_0xc90c('0x18')][_0xc90c('0x1a')]);return _0x43147a(_0x1ffd13['error'][_0xc90c('0x1a')]);}else{logger[_0xc90c('0x1c')]('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0xc90c('0x14'));_0x43147a(_0x1ffd13[_0xc90c('0x1d')]['message']);}})[_0xc90c('0x1e')](function(_0x408294){logger[_0xc90c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xf41598,_0x408294);_0x5731cc(_0x408294);});});}exports[_0xc90c('0x1f')]=function(_0x1dfa93){var _0x4aaad2=this;return new Promise(function(_0x33026f,_0x462c87){return db[_0xc90c('0x20')]['update'](_0x1dfa93[_0xc90c('0x21')],{'raw':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')][_0xc90c('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')]['where']||null:null,'attributes':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')]['attributes']||null:null,'limit':_0x1dfa93[_0xc90c('0x22')]?_0x1dfa93[_0xc90c('0x22')][_0xc90c('0x24')]||null:null})[_0xc90c('0x13')](function(_0x385cf9){logger['info'](_0xc90c('0x1f'),_0x1dfa93);logger[_0xc90c('0x15')]('UpdateSmsInteraction',_0x1dfa93,JSON[_0xc90c('0x17')](_0x385cf9));_0x33026f(_0x385cf9);})[_0xc90c('0x1e')](function(_0x14650b){logger[_0xc90c('0x18')](_0xc90c('0x1f'),_0x14650b[_0xc90c('0x1a')],_0x1dfa93);_0x462c87(_0x4aaad2[_0xc90c('0x18')](0x1f4,_0x14650b['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x2996f1){return new Promise(function(_0x321b10,_0x3faf41){return db[_0xc90c('0x20')][_0xc90c('0x25')]({'where':_0x2996f1[_0xc90c('0x22')]?_0x2996f1['options'][_0xc90c('0x26')]||null:null})['then'](function(_0x4406c6){if(_0x4406c6){return _0x4406c6[_0xc90c('0x27')](_0x2996f1['body'][_0xc90c('0x28')],_[_0xc90c('0x29')](_0x2996f1[_0xc90c('0x21')],[_0xc90c('0x28'),'id'])||{});}})[_0xc90c('0x2a')](function(_0x288ba4){logger[_0xc90c('0x1c')](_0xc90c('0x2b'),_0x2996f1);logger[_0xc90c('0x15')](_0xc90c('0x2b'),_0x2996f1,JSON[_0xc90c('0x17')](_0x288ba4));_0x321b10(_0x288ba4);})[_0xc90c('0x1e')](function(_0x35de62){logger[_0xc90c('0x18')]('AddTags',_0x35de62[_0xc90c('0x1a')],_0x2996f1);_0x3faf41(_this[_0xc90c('0x18')](0x1f4,_0x35de62[_0xc90c('0x1a')]));});});}; \ No newline at end of file +var _0xb275=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','body','options','raw','where','attributes','limit','then','UpdateSmsInteraction','debug','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e1295,_0x7773f){var _0xffda50=function(_0x2a088f){while(--_0x2a088f){_0x5e1295['push'](_0x5e1295['shift']());}};_0xffda50(++_0x7773f);}(_0xb275,0x193));var _0x5b27=function(_0xcdf208,_0x4eaa81){_0xcdf208=_0xcdf208-0x0;var _0x448380=_0xb275[_0xcdf208];return _0x448380;};'use strict';var _=require('lodash');var util=require(_0x5b27('0x0'));var moment=require(_0x5b27('0x1'));var BPromise=require(_0x5b27('0x2'));var rs=require(_0x5b27('0x3'));var fs=require('fs');var Redis=require(_0x5b27('0x4'));var db=require(_0x5b27('0x5'))['db'];var utils=require(_0x5b27('0x6'));var logger=require(_0x5b27('0x7'))(_0x5b27('0x8'));var config=require(_0x5b27('0x9'));var jayson=require(_0x5b27('0xa'));var client=jayson[_0x5b27('0xb')][_0x5b27('0xc')]({'port':0x232a});config[_0x5b27('0xd')]=_[_0x5b27('0xe')](config['redis'],{'host':_0x5b27('0xf'),'port':0x18eb});var socket=require(_0x5b27('0x10'))(new Redis(config[_0x5b27('0xd')]));require('./smsInteraction.socket')[_0x5b27('0x11')](socket);function respondWithRpcPromise(_0x4cc41b,_0x14141b,_0x479730){return new BPromise(function(_0x1ceca2,_0xc6695c){return client['request'](_0x4cc41b,_0x479730)['then'](function(_0x19cb80){logger[_0x5b27('0x12')](_0x5b27('0x13'),_0x14141b,_0x5b27('0x14'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x14141b,'request\x20sent',JSON[_0x5b27('0x15')](_0x19cb80));if(_0x19cb80['error']){if(_0x19cb80[_0x5b27('0x16')]['code']===0x1f4){logger[_0x5b27('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x14141b,_0x19cb80[_0x5b27('0x16')]['message']);return _0xc6695c(_0x19cb80[_0x5b27('0x16')][_0x5b27('0x17')]);}logger[_0x5b27('0x16')](_0x5b27('0x13'),_0x14141b,_0x19cb80[_0x5b27('0x16')][_0x5b27('0x17')]);return _0x1ceca2(_0x19cb80[_0x5b27('0x16')][_0x5b27('0x17')]);}else{logger[_0x5b27('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x14141b,_0x5b27('0x14'));_0x1ceca2(_0x19cb80[_0x5b27('0x18')][_0x5b27('0x17')]);}})[_0x5b27('0x19')](function(_0x4996eb){logger[_0x5b27('0x16')](_0x5b27('0x13'),_0x14141b,_0x4996eb);_0xc6695c(_0x4996eb);});});}exports['UpdateSmsInteraction']=function(_0x4690a6){var _0x30c99a=this;return new Promise(function(_0x5c5ee0,_0x4ca0c4){return db['SmsInteraction']['update'](_0x4690a6[_0x5b27('0x1a')],{'raw':_0x4690a6[_0x5b27('0x1b')]?_0x4690a6[_0x5b27('0x1b')][_0x5b27('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4690a6[_0x5b27('0x1b')]?_0x4690a6['options'][_0x5b27('0x1d')]||null:null,'attributes':_0x4690a6[_0x5b27('0x1b')]?_0x4690a6[_0x5b27('0x1b')][_0x5b27('0x1e')]||null:null,'limit':_0x4690a6[_0x5b27('0x1b')]?_0x4690a6[_0x5b27('0x1b')][_0x5b27('0x1f')]||null:null})[_0x5b27('0x20')](function(_0x430f64){logger[_0x5b27('0x12')](_0x5b27('0x21'),_0x4690a6);logger[_0x5b27('0x22')]('UpdateSmsInteraction',_0x4690a6,JSON[_0x5b27('0x15')](_0x430f64));_0x5c5ee0(_0x430f64);})['catch'](function(_0x50cd46){logger['error'](_0x5b27('0x21'),_0x50cd46[_0x5b27('0x17')],_0x4690a6);_0x4ca0c4(_0x30c99a['error'](0x1f4,_0x50cd46['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x22ea8d){return new Promise(function(_0x4cb534,_0x16072a){return db['SmsInteraction'][_0x5b27('0x23')]({'where':_0x22ea8d[_0x5b27('0x1b')]?_0x22ea8d[_0x5b27('0x1b')][_0x5b27('0x1d')]||null:null})[_0x5b27('0x20')](function(_0x9410d7){if(_0x9410d7){return _0x9410d7[_0x5b27('0x24')](_0x22ea8d[_0x5b27('0x1a')]['ids'],_[_0x5b27('0x25')](_0x22ea8d['body'],[_0x5b27('0x26'),'id'])||{});}})[_0x5b27('0x27')](function(_0x3adc43){logger[_0x5b27('0x12')](_0x5b27('0x28'),_0x22ea8d);logger['debug']('AddTags',_0x22ea8d,JSON['stringify'](_0x3adc43));_0x4cb534(_0x3adc43);})['catch'](function(_0x46d9c1){logger[_0x5b27('0x16')](_0x5b27('0x28'),_0x46d9c1[_0x5b27('0x17')],_0x22ea8d);_0x16072a(_this[_0x5b27('0x16')](0x1f4,_0x46d9c1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 51450a2..8201b65 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 _0x694e=['removeListener','length','./smsInteraction.events','remove','update','emit'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x694e,0x1f4));var _0xe694=function(_0x5e2678,_0x28a810){_0x5e2678=_0x5e2678-0x0;var _0x123dac=_0x694e[_0x5e2678];return _0x123dac;};'use strict';var SmsInteractionEvents=require(_0xe694('0x0'));var events=['save',_0xe694('0x1'),_0xe694('0x2')];function createListener(_0x2d5f31,_0x519d0c){return function(_0x175189){_0x519d0c[_0xe694('0x3')](_0x2d5f31,_0x175189);};}function removeListener(_0x13a838,_0x3e4105){return function(){SmsInteractionEvents[_0xe694('0x4')](_0x13a838,_0x3e4105);};}exports['register']=function(_0x210814){for(var _0x35bc8c=0x0,_0xc6ba15=events[_0xe694('0x5')];_0x35bc8c<_0xc6ba15;_0x35bc8c++){var _0x434b48=events[_0x35bc8c];var _0x62a923=createListener('smsInteraction:'+_0x434b48,_0x210814);SmsInteractionEvents['on'](_0x434b48,_0x62a923);}}; \ No newline at end of file +var _0x35f4=['register','length','smsInteraction:','./smsInteraction.events','save','update','emit'];(function(_0xd99bcd,_0x11e7d4){var _0x9c77be=function(_0x126733){while(--_0x126733){_0xd99bcd['push'](_0xd99bcd['shift']());}};_0x9c77be(++_0x11e7d4);}(_0x35f4,0xc7));var _0x435f=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x35f4[_0x1911ed];return _0x11edaa;};'use strict';var SmsInteractionEvents=require(_0x435f('0x0'));var events=[_0x435f('0x1'),'remove',_0x435f('0x2')];function createListener(_0x3e8f80,_0x4096b4){return function(_0x216265){_0x4096b4[_0x435f('0x3')](_0x3e8f80,_0x216265);};}function removeListener(_0x5b8338,_0x17988f){return function(){SmsInteractionEvents['removeListener'](_0x5b8338,_0x17988f);};}exports[_0x435f('0x4')]=function(_0x255e0f){for(var _0x28b6c8=0x0,_0x2e9f89=events[_0x435f('0x5')];_0x28b6c8<_0x2e9f89;_0x28b6c8++){var _0x5530a4=events[_0x28b6c8];var _0x265969=createListener(_0x435f('0x6')+_0x5530a4,_0x255e0f);SmsInteractionEvents['on'](_0x5530a4,_0x265969);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9124d4f..fd66491 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 _0x1794=['Router','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','smsmessage:create','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express'];(function(_0xd22cfd,_0x4a15ea){var _0x12b386=function(_0x41313e){while(--_0x41313e){_0xd22cfd['push'](_0xd22cfd['shift']());}};_0x12b386(++_0x4a15ea);}(_0x1794,0x19d));var _0x4179=function(_0x15fca7,_0x382d0b){_0x15fca7=_0x15fca7-0x0;var _0x2dc354=_0x1794[_0x15fca7];return _0x2dc354;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4179('0x0'));var timeout=require(_0x4179('0x1'));var express=require(_0x4179('0x2'));var router=express[_0x4179('0x3')]();var fs_extra=require(_0x4179('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4179('0x5'));var controller=require(_0x4179('0x6'));router[_0x4179('0x7')]('/',auth[_0x4179('0x8')](),controller[_0x4179('0x9')]);router[_0x4179('0x7')](_0x4179('0xa'),auth[_0x4179('0x8')](),controller[_0x4179('0xb')]);router[_0x4179('0x7')]('/:id',auth[_0x4179('0x8')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/',auth['isAuthenticated'](),interaction[_0x4179('0xe')]('sms',_0x4179('0xf')),controller['create']);router[_0x4179('0xd')]('/:id/status',controller[_0x4179('0x10')]);router[_0x4179('0x11')](_0x4179('0x12'),auth['isAuthenticated'](),controller[_0x4179('0x13')]);router['put'](_0x4179('0x14'),auth[_0x4179('0x8')](),controller['accept']);router[_0x4179('0x11')](_0x4179('0x15'),auth['isAuthenticated'](),controller[_0x4179('0x16')]);router[_0x4179('0x17')](_0x4179('0x12'),auth[_0x4179('0x8')](),controller[_0x4179('0x18')]);module[_0x4179('0x19')]=router; \ No newline at end of file +var _0x7cc0=['describe','/:id','show','post','tracked','smsmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsMessage.controller','get','/describe','isAuthenticated'];(function(_0x27ddca,_0x4ab14d){var _0x4be413=function(_0x4e3525){while(--_0x4e3525){_0x27ddca['push'](_0x27ddca['shift']());}};_0x4be413(++_0x4ab14d);}(_0x7cc0,0x96));var _0x07cc=function(_0x459d34,_0x3c66f2){_0x459d34=_0x459d34-0x0;var _0x154781=_0x7cc0[_0x459d34];return _0x154781;};'use strict';var multer=require(_0x07cc('0x0'));var util=require(_0x07cc('0x1'));var path=require(_0x07cc('0x2'));var timeout=require(_0x07cc('0x3'));var express=require(_0x07cc('0x4'));var router=express[_0x07cc('0x5')]();var fs_extra=require(_0x07cc('0x6'));var auth=require(_0x07cc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x07cc('0x8'));router[_0x07cc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x07cc('0x9')](_0x07cc('0xa'),auth[_0x07cc('0xb')](),controller[_0x07cc('0xc')]);router[_0x07cc('0x9')](_0x07cc('0xd'),auth['isAuthenticated'](),controller[_0x07cc('0xe')]);router[_0x07cc('0xf')]('/',auth[_0x07cc('0xb')](),interaction[_0x07cc('0x10')]('sms',_0x07cc('0x11')),controller[_0x07cc('0x12')]);router[_0x07cc('0xf')]('/:id/status',controller['status']);router[_0x07cc('0x13')](_0x07cc('0xd'),auth['isAuthenticated'](),controller[_0x07cc('0x14')]);router[_0x07cc('0x13')](_0x07cc('0x15'),auth[_0x07cc('0xb')](),controller[_0x07cc('0x16')]);router[_0x07cc('0x13')](_0x07cc('0x17'),auth['isAuthenticated'](),controller[_0x07cc('0x18')]);router['delete'](_0x07cc('0xd'),auth['isAuthenticated'](),controller[_0x07cc('0x19')]);module[_0x07cc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 44112b7..cab4c2b 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 _0x3863=['STRING','DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3e7c7b,_0x233660){var _0x2938b2=function(_0x3e3e73){while(--_0x3e3e73){_0x3e7c7b['push'](_0x3e7c7b['shift']());}};_0x2938b2(++_0x233660);}(_0x3863,0x72));var _0x3386=function(_0x36da2c,_0x47404f){_0x36da2c=_0x36da2c-0x0;var _0x437a93=_0x3863[_0x36da2c];return _0x437a93;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3386('0x0')](_0x3386('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3386('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3386('0x3')]('in',_0x3386('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3386('0x5')]},'readAt':{'type':Sequelize[_0x3386('0x6')]},'secret':{'type':Sequelize[_0x3386('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3386('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb34e=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x154b4c,_0xa38e2){var _0x100586=function(_0x2912a8){while(--_0x2912a8){_0x154b4c['push'](_0x154b4c['shift']());}};_0x100586(++_0xa38e2);}(_0xb34e,0x181));var _0xeb34=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xb34e[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xeb34('0x0'));module[_0xeb34('0x1')]={'body':{'type':Sequelize[_0xeb34('0x2')](_0xeb34('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xeb34('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb34('0x5')]('in',_0xeb34('0x6')),'defaultValue':_0xeb34('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xeb34('0x7')](0xbe)},'phone':{'type':Sequelize[_0xeb34('0x7')]},'readAt':{'type':Sequelize[_0xeb34('0x8')]},'secret':{'type':Sequelize[_0xeb34('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xeb34('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index eef4fa3..57c4159 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 _0x3c85=['defaults','redis','localhost','./smsMessage.socket','jayson/promise','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','end','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','params','create','body','find','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','agent','fullname','email','internal','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','sms','RejectMessage','rejectMessage','ContactId','SELECT','User','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4b3b81,_0x2470ae){var _0x2f5b30=function(_0x4c4836){while(--_0x4c4836){_0x4b3b81['push'](_0x4b3b81['shift']());}};_0x2f5b30(++_0x2470ae);}(_0x3c85,0x1a0));var _0x53c8=function(_0x53cd56,_0x42028a){_0x53cd56=_0x53cd56-0x0;var _0x4ca0d7=_0x3c85[_0x53cd56];return _0x4ca0d7;};'use strict';var emlformat=require(_0x53c8('0x0'));var rimraf=require(_0x53c8('0x1'));var zipdir=require(_0x53c8('0x2'));var jsonpatch=require(_0x53c8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x53c8('0x4'));var Mustache=require(_0x53c8('0x5'));var util=require(_0x53c8('0x6'));var path=require('path');var sox=require(_0x53c8('0x7'));var csv=require(_0x53c8('0x8'));var ejs=require(_0x53c8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53c8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53c8('0xb'));var Papa=require(_0x53c8('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x53c8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53c8('0xe'));var utils=require(_0x53c8('0xf'));var config=require(_0x53c8('0x10'));var licenseUtil=require(_0x53c8('0x11'));var db=require(_0x53c8('0x12'))['db'];config['redis']=_[_0x53c8('0x13')](config[_0x53c8('0x14')],{'host':_0x53c8('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53c8('0x14')]));require(_0x53c8('0x16'))['register'](socket);var jayson=require(_0x53c8('0x17'));var client=jayson[_0x53c8('0x18')][_0x53c8('0x19')]({'port':0x232c});var client9002=jayson[_0x53c8('0x18')][_0x53c8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1c037f,_0x385c39,_0x27f14f,_0x2d9a6f){return new BPromise(function(_0x8a7c46,_0x28309c){var _0x44d6e4=_0x2d9a6f||client;return _0x44d6e4[_0x53c8('0x1a')](_0x1c037f,_0x27f14f)[_0x53c8('0x1b')](function(_0x59b253){logger[_0x53c8('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x385c39,'request\x20sent');logger[_0x53c8('0x1d')](_0x53c8('0x1e'),_0x385c39,_0x53c8('0x1f'),JSON[_0x53c8('0x20')](_0x59b253));if(_0x59b253['error']){if(_0x59b253[_0x53c8('0x21')][_0x53c8('0x22')]===0x1f4){logger[_0x53c8('0x21')](_0x53c8('0x23'),_0x385c39,_0x59b253[_0x53c8('0x21')][_0x53c8('0x24')]);return _0x28309c(_0x59b253[_0x53c8('0x21')]['message']);}logger[_0x53c8('0x21')]('SmsMessage,\x20%s,\x20%s',_0x385c39,_0x59b253[_0x53c8('0x21')][_0x53c8('0x24')]);return _0x8a7c46(_0x59b253[_0x53c8('0x21')][_0x53c8('0x24')]);}else{logger['info'](_0x53c8('0x23'),_0x385c39,_0x53c8('0x1f'));_0x8a7c46(_0x59b253[_0x53c8('0x25')][_0x53c8('0x24')]);}})[_0x53c8('0x26')](function(_0x454bc5){logger[_0x53c8('0x21')](_0x53c8('0x23'),_0x385c39,_0x454bc5);_0x28309c(_0x454bc5);});});}function respondWithStatusCode(_0x1b6be5,_0x2821ad){_0x2821ad=_0x2821ad||0xcc;return function(_0x5e9265){if(_0x5e9265){return _0x1b6be5[_0x53c8('0x27')](_0x2821ad);}return _0x1b6be5['status'](_0x2821ad)['end']();};}function respondWithResult(_0x2b22c3,_0x181e88){_0x181e88=_0x181e88||0xc8;return function(_0x1ea1dd){if(_0x1ea1dd){return _0x2b22c3[_0x53c8('0x28')](_0x181e88)[_0x53c8('0x29')](_0x1ea1dd);}};}function respondWithFilteredResult(_0x3f2c72,_0x320293){return function(_0x4031ba){if(_0x4031ba){var _0xf11181=typeof _0x320293[_0x53c8('0x2a')]===_0x53c8('0x2b')&&typeof _0x320293[_0x53c8('0x2c')]===_0x53c8('0x2b');var _0x1bcc5e=_0x4031ba[_0x53c8('0x2d')];var _0x1c1f09=_0xf11181?0x0:_0x320293[_0x53c8('0x2a')];var _0x467173=_0xf11181?_0x4031ba[_0x53c8('0x2d')]:_0x320293['offset']+_0x320293[_0x53c8('0x2c')];var _0x3dc1c1;if(_0x467173>=_0x1bcc5e){_0x467173=_0x1bcc5e;_0x3dc1c1=0xc8;}else{_0x3dc1c1=0xce;}_0x3f2c72[_0x53c8('0x28')](_0x3dc1c1);return _0x3f2c72['set'](_0x53c8('0x2e'),_0x1c1f09+'-'+_0x467173+'/'+_0x1bcc5e)[_0x53c8('0x29')](_0x4031ba);}return null;};}function patchUpdates(_0x32ba58){return function(_0xa05081){try{jsonpatch['apply'](_0xa05081,_0x32ba58,!![]);}catch(_0x592f78){return BPromise[_0x53c8('0x2f')](_0x592f78);}return _0xa05081[_0x53c8('0x30')]();};}function saveUpdates(_0x14039b,_0x1a1461){return function(_0x2f3a1a){if(_0x2f3a1a){return _0x2f3a1a['update'](_0x14039b)[_0x53c8('0x1b')](function(_0x4f8e7f){return _0x4f8e7f;});}return null;};}function removeEntity(_0x299266,_0x979c82){return function(_0x2f8755){if(_0x2f8755){return _0x2f8755[_0x53c8('0x31')]()['then'](function(){_0x299266['status'](0xcc)[_0x53c8('0x32')]();});}};}function handleEntityNotFound(_0x314a84,_0x398eb2){return function(_0x2f1230){if(!_0x2f1230){_0x314a84[_0x53c8('0x27')](0x194);}return _0x2f1230;};}function handleError(_0x1683ee,_0x203d71){_0x203d71=_0x203d71||0x1f4;return function(_0x11109f){logger['error'](_0x11109f[_0x53c8('0x33')]);if(_0x11109f[_0x53c8('0x34')]){delete _0x11109f['name'];}_0x1683ee[_0x53c8('0x28')](_0x203d71)[_0x53c8('0x35')](_0x11109f);};}exports[_0x53c8('0x36')]=function(_0x1cda8c,_0x88da41){var _0x8430dd={},_0x3d2f86={},_0x521cf9={'count':0x0,'rows':[]};var _0x5a3ab2=_['map'](db[_0x53c8('0x37')][_0x53c8('0x38')],function(_0x13f787){return{'name':_0x13f787[_0x53c8('0x39')],'type':_0x13f787[_0x53c8('0x3a')][_0x53c8('0x3b')]};});_0x3d2f86[_0x53c8('0x3c')]=_[_0x53c8('0x3d')](_0x5a3ab2,_0x53c8('0x34'));_0x3d2f86[_0x53c8('0x3e')]=_[_0x53c8('0x3f')](_0x1cda8c[_0x53c8('0x3e')]);_0x3d2f86[_0x53c8('0x40')]=_[_0x53c8('0x41')](_0x3d2f86[_0x53c8('0x3c')],_0x3d2f86[_0x53c8('0x3e')]);_0x8430dd[_0x53c8('0x42')]=_[_0x53c8('0x41')](_0x3d2f86['model'],qs[_0x53c8('0x43')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x43')]));_0x8430dd[_0x53c8('0x42')]=_0x8430dd[_0x53c8('0x42')][_0x53c8('0x44')]?_0x8430dd[_0x53c8('0x42')]:_0x3d2f86[_0x53c8('0x3c')];if(!_0x1cda8c['query'][_0x53c8('0x45')](_0x53c8('0x46'))){_0x8430dd[_0x53c8('0x2c')]=qs[_0x53c8('0x2c')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x2c')]);_0x8430dd[_0x53c8('0x2a')]=qs[_0x53c8('0x2a')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x2a')]);}_0x8430dd[_0x53c8('0x47')]=qs[_0x53c8('0x48')](_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x48')]);_0x8430dd['where']=qs[_0x53c8('0x40')](_[_0x53c8('0x49')](_0x1cda8c['query'],_0x3d2f86['filters']),_0x5a3ab2);if(_0x1cda8c[_0x53c8('0x3e')]['filter']){_0x8430dd[_0x53c8('0x4a')]=_['merge'](_0x8430dd[_0x53c8('0x4a')],{'$or':_[_0x53c8('0x3d')](_0x5a3ab2,function(_0x2f97e8){if(_0x2f97e8[_0x53c8('0x3a')]!=='VIRTUAL'){var _0x4e8011={};_0x4e8011[_0x2f97e8['name']]={'$like':'%'+_0x1cda8c[_0x53c8('0x3e')][_0x53c8('0x4b')]+'%'};return _0x4e8011;}})});}_0x8430dd=_[_0x53c8('0x4c')]({},_0x8430dd,_0x1cda8c[_0x53c8('0x4d')]);var _0x191fd0={'where':_0x8430dd['where']};return db[_0x53c8('0x37')][_0x53c8('0x2d')](_0x191fd0)[_0x53c8('0x1b')](function(_0xfc7fc1){_0x521cf9[_0x53c8('0x2d')]=_0xfc7fc1;if(_0x1cda8c['query'][_0x53c8('0x4e')]){_0x8430dd[_0x53c8('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x53c8('0x50')](_0x8430dd);})[_0x53c8('0x1b')](function(_0x376f5d){_0x521cf9[_0x53c8('0x51')]=_0x376f5d;return _0x521cf9;})[_0x53c8('0x1b')](respondWithFilteredResult(_0x88da41,_0x8430dd))['catch'](handleError(_0x88da41,null));};exports['show']=function(_0x58bfca,_0x47c0e5){var _0x27381a={'raw':!![],'where':{'id':_0x58bfca[_0x53c8('0x52')]['id']}},_0x39db9b={};_0x39db9b[_0x53c8('0x3c')]=_['keys'](db[_0x53c8('0x37')][_0x53c8('0x38')]);_0x39db9b[_0x53c8('0x3e')]=_[_0x53c8('0x3f')](_0x58bfca[_0x53c8('0x3e')]);_0x39db9b[_0x53c8('0x40')]=_[_0x53c8('0x41')](_0x39db9b[_0x53c8('0x3c')],_0x39db9b[_0x53c8('0x3e')]);_0x27381a[_0x53c8('0x42')]=_[_0x53c8('0x41')](_0x39db9b[_0x53c8('0x3c')],qs['fields'](_0x58bfca['query'][_0x53c8('0x43')]));_0x27381a[_0x53c8('0x42')]=_0x27381a[_0x53c8('0x42')][_0x53c8('0x44')]?_0x27381a['attributes']:_0x39db9b[_0x53c8('0x3c')];if(_0x58bfca['query'][_0x53c8('0x4e')]){_0x27381a[_0x53c8('0x4f')]=[{'all':!![]}];}_0x27381a=_[_0x53c8('0x4c')]({},_0x27381a,_0x58bfca[_0x53c8('0x4d')]);return db[_0x53c8('0x37')]['find'](_0x27381a)[_0x53c8('0x1b')](handleEntityNotFound(_0x47c0e5,null))[_0x53c8('0x1b')](respondWithResult(_0x47c0e5,null))[_0x53c8('0x26')](handleError(_0x47c0e5,null));};exports[_0x53c8('0x53')]=function(_0x198677,_0xe45995){return db[_0x53c8('0x37')][_0x53c8('0x53')](_0x198677['body'],{})[_0x53c8('0x1b')](respondWithResult(_0xe45995,0xc9))[_0x53c8('0x26')](handleError(_0xe45995,null));};exports['update']=function(_0x534811,_0x55f7fa){if(_0x534811['body']['id']){delete _0x534811[_0x53c8('0x54')]['id'];}return db['SmsMessage'][_0x53c8('0x55')]({'where':{'id':_0x534811[_0x53c8('0x52')]['id']}})[_0x53c8('0x1b')](handleEntityNotFound(_0x55f7fa,null))[_0x53c8('0x1b')](saveUpdates(_0x534811[_0x53c8('0x54')],null))[_0x53c8('0x1b')](respondWithResult(_0x55f7fa,null))[_0x53c8('0x26')](handleError(_0x55f7fa,null));};exports['destroy']=function(_0x74bb85,_0x5d98cb){return db[_0x53c8('0x37')][_0x53c8('0x55')]({'where':{'id':_0x74bb85['params']['id']}})[_0x53c8('0x1b')](handleEntityNotFound(_0x5d98cb,null))[_0x53c8('0x1b')](removeEntity(_0x5d98cb,null))['catch'](handleError(_0x5d98cb,null));};exports[_0x53c8('0x56')]=function(_0x2d9953,_0x28651b){return db[_0x53c8('0x37')][_0x53c8('0x56')]()[_0x53c8('0x1b')](respondWithResult(_0x28651b,null))[_0x53c8('0x26')](handleError(_0x28651b,null));};var interaction_log=require('../../config/logger')(_0x53c8('0x57'));exports[_0x53c8('0x58')]=function(_0x4ae2a0,_0x4c34f3,_0x4b13eb){var _0x480c4b={'agent':{},'channel':'sms'};if(_0x4ae2a0[_0x53c8('0x54')]['id']){delete _0x4ae2a0[_0x53c8('0x54')]['id'];}_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x59')]=!![];_0x4ae2a0['body'][_0x53c8('0x5a')]=moment()['format'](_0x53c8('0x5b'));_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')]=_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')]||_0x4ae2a0[_0x53c8('0x5d')]['id'];_0x480c4b['agent']['id']=_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')];return db[_0x53c8('0x37')]['find']({'where':{'id':_0x4ae2a0[_0x53c8('0x52')]['id'],'UserId':null}})[_0x53c8('0x1b')](handleEntityNotFound(_0x4c34f3,null))[_0x53c8('0x1b')](saveUpdates(_0x4ae2a0[_0x53c8('0x54')],null))[_0x53c8('0x1b')](function(_0x3fd82b){if(_0x3fd82b){_0x480c4b[_0x53c8('0x24')]=_0x3fd82b[_0x53c8('0x5e')]({'plain':!![]});return db[_0x53c8('0x5f')][_0x53c8('0x55')]({'where':{'id':_0x3fd82b[_0x53c8('0x60')]}});}return null;})[_0x53c8('0x1b')](handleEntityNotFound(_0x4c34f3,null))[_0x53c8('0x1b')](function(_0x3090f6){if(_0x3090f6){return _0x3090f6[_0x53c8('0x61')]({'UserId':_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')],'read1stAt':_[_0x53c8('0x62')](_0x3090f6[_0x53c8('0x63')])?moment()['format'](_0x53c8('0x5b')):undefined});}return null;})[_0x53c8('0x1b')](function(_0x366c9f){if(_0x366c9f){_0x480c4b['interaction']=_0x366c9f[_0x53c8('0x5e')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ae2a0['user']['id'],_0x4ae2a0[_0x53c8('0x5d')][_0x53c8('0x34')],_0x4ae2a0['user'][_0x53c8('0x64')],_0x480c4b[_0x53c8('0x65')]['id'],_0x4ae2a0['body']?JSON[_0x53c8('0x20')](_0x4ae2a0[_0x53c8('0x54')]):_0x53c8('0x66'));return respondWithRpcPromise(_0x53c8('0x67'),_0x53c8('0x68'),_0x480c4b);}return null;})[_0x53c8('0x1b')](function(_0x531ada){var _0x23a047=_0x53c8('0x69')+_0x531ada[_0x53c8('0x24')]['ContactId'];return db[_0x53c8('0x6a')][_0x53c8('0x3e')](_0x23a047,{'type':db[_0x53c8('0x6b')][_0x53c8('0x6c')]['SELECT'],'raw':!![]})[_0x53c8('0x1b')](function(_0x192892){return _0x192892;});})[_0x53c8('0x1b')](function(_0x1ee0d6){if(_0x1ee0d6){_0x480c4b[_0x53c8('0x24')][_0x53c8('0x6d')]=_0x1ee0d6[0x0];if(!_0x4ae2a0[_0x53c8('0x54')][_0x53c8('0x5c')])return;return db['User'][_0x53c8('0x55')]({'where':{'id':_0x4ae2a0['body']['UserId'],'role':_0x53c8('0x6e')},'attributes':['id',_0x53c8('0x34'),_0x53c8('0x6f'),_0x53c8('0x70'),_0x53c8('0x71')],'raw':!![]});}return null;})[_0x53c8('0x1b')](function(_0x10fa3f){if(!_0x10fa3f)return null;_0x480c4b[_0x53c8('0x24')]['agent']=_0x10fa3f;return _0x480c4b;})[_0x53c8('0x1b')](function(_0x49e129){if(_0x49e129){if(_0x4ae2a0['body'][_0x53c8('0x72')]){_0x480c4b[_0x53c8('0x24')][_0x53c8('0x73')]=util[_0x53c8('0x74')](_0x53c8('0x75'),_0x4ae2a0[_0x53c8('0x5d')][_0x53c8('0x34')]);_0x480c4b['message'][_0x53c8('0x76')]=_0x480c4b[_0x53c8('0x76')];_0x480c4b[_0x53c8('0x24')]['motionChannel']=_0x480c4b[_0x53c8('0x76')];_0x480c4b[_0x53c8('0x24')][_0x53c8('0x77')]=_0x53c8('0x58');return respondWithRpcPromise(_0x53c8('0x78'),_0x53c8('0x78'),{'event':_0x53c8('0x79'),'message':_0x480c4b['message']},client9002)[_0x53c8('0x1b')](function(){return _0x480c4b;});}return _0x480c4b;}return null;})[_0x53c8('0x1b')](respondWithResult(_0x4c34f3,null))[_0x53c8('0x26')](handleError(_0x4c34f3,null));};var interaction_log=require('../../config/logger')(_0x53c8('0x57'));exports['reject']=function(_0x1d9644,_0x13f550,_0x2c5cce){var _0x35aac7={'agent':{},'channel':_0x53c8('0x7a')};if(_0x1d9644[_0x53c8('0x54')]['id']){delete _0x1d9644[_0x53c8('0x54')]['id'];}_0x1d9644['body'][_0x53c8('0x5c')]=_0x1d9644[_0x53c8('0x54')]['UserId']||_0x1d9644[_0x53c8('0x5d')]['id'];_0x35aac7[_0x53c8('0x6e')]['id']=_0x1d9644[_0x53c8('0x54')]['UserId'];return db[_0x53c8('0x37')][_0x53c8('0x55')]({'where':{'id':_0x1d9644['params']['id'],'UserId':null}})[_0x53c8('0x1b')](handleEntityNotFound(_0x13f550,null))['then'](function(_0x1d39e7){if(_0x1d39e7){_0x35aac7[_0x53c8('0x24')]=_0x1d39e7[_0x53c8('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0x53c8('0x55')]({'where':{'id':_0x1d39e7[_0x53c8('0x60')]}});}return null;})[_0x53c8('0x1b')](handleEntityNotFound(_0x13f550,null))['then'](function(_0x45be10){if(_0x45be10){_0x35aac7[_0x53c8('0x65')]=_0x45be10[_0x53c8('0x5e')]({'plain':!![]});interaction_log[_0x53c8('0x1c')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d9644['user']['id'],_0x1d9644[_0x53c8('0x5d')]['name'],_0x1d9644['user'][_0x53c8('0x64')],_0x35aac7[_0x53c8('0x65')]['id'],_0x1d9644[_0x53c8('0x54')]?JSON['stringify'](_0x1d9644['body']):'null');return respondWithRpcPromise(_0x53c8('0x7b'),_0x53c8('0x7c'),_0x35aac7);}return null;})[_0x53c8('0x1b')](function(_0x2877b0){var _0x44fc96=_0x53c8('0x69')+_0x2877b0[_0x53c8('0x24')][_0x53c8('0x7d')];return db[_0x53c8('0x6a')][_0x53c8('0x3e')](_0x44fc96,{'type':db[_0x53c8('0x6b')][_0x53c8('0x6c')][_0x53c8('0x7e')],'raw':!![]})[_0x53c8('0x1b')](function(_0x37ea58){return _0x37ea58;});})['then'](function(_0x3f1f73){if(_0x3f1f73){_0x35aac7['message'][_0x53c8('0x6d')]=_0x3f1f73[0x0];if(!_0x1d9644['body'][_0x53c8('0x5c')])return;return db[_0x53c8('0x7f')]['find']({'where':{'id':_0x1d9644[_0x53c8('0x54')][_0x53c8('0x5c')],'role':_0x53c8('0x6e')},'attributes':['id',_0x53c8('0x34'),_0x53c8('0x6f'),_0x53c8('0x70'),_0x53c8('0x71')],'raw':!![]});}return null;})['then'](function(_0x5b59e3){if(!_0x5b59e3)return null;_0x35aac7[_0x53c8('0x24')][_0x53c8('0x6e')]=_0x5b59e3;return _0x35aac7;})[_0x53c8('0x1b')](function(_0x2948ef){if(_0x2948ef){_0x2948ef[_0x53c8('0x24')][_0x53c8('0x73')]=util[_0x53c8('0x74')](_0x53c8('0x75'),_0x1d9644['user'][_0x53c8('0x34')]);_0x2948ef[_0x53c8('0x24')]['channel']=_0x35aac7[_0x53c8('0x76')];_0x2948ef[_0x53c8('0x24')]['motionChannel']=_0x35aac7[_0x53c8('0x76')];_0x2948ef[_0x53c8('0x24')][_0x53c8('0x77')]='reject';respondWithRpcPromise(_0x53c8('0x78'),_0x53c8('0x78'),{'event':_0x53c8('0x80'),'message':_0x2948ef[_0x53c8('0x24')]},client9002);return _0x35aac7;}return null;})[_0x53c8('0x1b')](respondWithResult(_0x13f550,null))[_0x53c8('0x26')](handleError(_0x13f550,null));};exports[_0x53c8('0x28')]=function(_0x36edbc,_0x5c1c67,_0x50916f){if(_0x36edbc[_0x53c8('0x54')]['id']){delete _0x36edbc[_0x53c8('0x54')]['id'];}var _0x4aeb7f;return db[_0x53c8('0x37')][_0x53c8('0x55')]({'where':{'id':_0x36edbc['params']['id']}})['then'](handleEntityNotFound(_0x5c1c67,null))[_0x53c8('0x1b')](function(_0xcba153){if(_0xcba153){_0x4aeb7f=_0xcba153;return db[_0x53c8('0x81')]['find']({'where':{'id':_0xcba153['SmsAccountId']}});}})[_0x53c8('0x1b')](handleEntityNotFound(_0x5c1c67,null))[_0x53c8('0x1b')](function(_0x53083d){if(_0x53083d){logger['debug'](_0x53c8('0x1e'),_0x53c8('0x28'),_0x53c8('0x82'),_0x53083d[_0x53c8('0x3a')],util[_0x53c8('0x83')](_0x36edbc['body'],{'showHidden':![],'depth':null}));switch(_0x53083d[_0x53c8('0x3a')]){case _0x53c8('0x84'):if(_0x36edbc[_0x53c8('0x54')][_0x53c8('0x85')]&&_0x36edbc[_0x53c8('0x54')][_0x53c8('0x85')]===_0x4aeb7f[_0x53c8('0x86')]){return _0x4aeb7f['update']({'read':!![]});}else{logger['error'](_0x53c8('0x87'),_0x53c8('0x28'),_0x53c8('0x84'),util[_0x53c8('0x83')](_0x36edbc[_0x53c8('0x54')],{'showHidden':![],'depth':null}));}break;case _0x53c8('0x88'):if(_0x36edbc[_0x53c8('0x54')][_0x53c8('0x89')]&&_0x36edbc[_0x53c8('0x54')][_0x53c8('0x89')]===_0x4aeb7f[_0x53c8('0x86')]&&_[_0x53c8('0x8a')]([_0x53c8('0x8b'),'delivered'],_0x36edbc['body'][_0x53c8('0x8c')])>=0x0){return _0x4aeb7f[_0x53c8('0x61')]({'read':!![]});}else{logger['error'](_0x53c8('0x87'),_0x53c8('0x28'),'plivio',util[_0x53c8('0x83')](_0x36edbc['body'],{'showHidden':![],'depth':null}));}break;case _0x53c8('0x8d'):var _0x329c7e=_0x36edbc[_0x53c8('0x54')][_0x53c8('0x8e')][0x0];if(_0x329c7e[_0x53c8('0x28')][_0x53c8('0x8f')]===_0x53c8('0x90')){return _0x4aeb7f[_0x53c8('0x61')]({'read':!![]});}else{logger[_0x53c8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53c8('0x28'),_0x53c8('0x8d'),util[_0x53c8('0x83')](_0x36edbc[_0x53c8('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4aeb7f;}})['then'](respondWithResult(_0x5c1c67,null))[_0x53c8('0x26')](handleError(_0x5c1c67,null));}; \ No newline at end of file +var _0x2431=['user','UserId','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','SELECT','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','sendStatus','stack','name','send','SmsMessage','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','merge','options','includeAll','include','findAll','catch','params','find','create','body','describe','sms-interactions','accept','sms','readAt','format'];(function(_0x3dbf6b,_0x24ce2c){var _0x475c6a=function(_0x120c2a){while(--_0x120c2a){_0x3dbf6b['push'](_0x3dbf6b['shift']());}};_0x475c6a(++_0x24ce2c);}(_0x2431,0xc9));var _0x1243=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2431[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x1243('0x0'));var rimraf=require(_0x1243('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1243('0x2'));var rp=require(_0x1243('0x3'));var moment=require('moment');var BPromise=require(_0x1243('0x4'));var Mustache=require(_0x1243('0x5'));var util=require(_0x1243('0x6'));var path=require(_0x1243('0x7'));var sox=require(_0x1243('0x8'));var csv=require(_0x1243('0x9'));var ejs=require(_0x1243('0xa'));var fs=require('fs');var fs_extra=require(_0x1243('0xb'));var _=require(_0x1243('0xc'));var squel=require(_0x1243('0xd'));var crypto=require(_0x1243('0xe'));var jsforce=require(_0x1243('0xf'));var deskjs=require(_0x1243('0x10'));var toCsv=require(_0x1243('0x9'));var querystring=require('querystring');var Papa=require(_0x1243('0x11'));var Redis=require(_0x1243('0x12'));var authService=require(_0x1243('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1243('0x14'));var hardwareService=require(_0x1243('0x15'));var logger=require(_0x1243('0x16'))(_0x1243('0x17'));var utils=require(_0x1243('0x18'));var config=require(_0x1243('0x19'));var licenseUtil=require(_0x1243('0x1a'));var db=require(_0x1243('0x1b'))['db'];config['redis']=_[_0x1243('0x1c')](config[_0x1243('0x1d')],{'host':_0x1243('0x1e'),'port':0x18eb});var socket=require(_0x1243('0x1f'))(new Redis(config[_0x1243('0x1d')]));require(_0x1243('0x20'))[_0x1243('0x21')](socket);var jayson=require(_0x1243('0x22'));var client=jayson[_0x1243('0x23')][_0x1243('0x24')]({'port':0x232c});var client9002=jayson[_0x1243('0x23')][_0x1243('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x3d8428,_0x376a47,_0x59ad0e,_0x1400d9){return new BPromise(function(_0x49af55,_0x108e91){var _0x4dec1e=_0x1400d9||client;return _0x4dec1e[_0x1243('0x25')](_0x3d8428,_0x59ad0e)[_0x1243('0x26')](function(_0x29be66){logger[_0x1243('0x27')](_0x1243('0x28'),_0x376a47,_0x1243('0x29'));logger[_0x1243('0x2a')](_0x1243('0x2b'),_0x376a47,'request\x20sent',JSON['stringify'](_0x29be66));if(_0x29be66[_0x1243('0x2c')]){if(_0x29be66[_0x1243('0x2c')][_0x1243('0x2d')]===0x1f4){logger[_0x1243('0x2c')](_0x1243('0x28'),_0x376a47,_0x29be66['error']['message']);return _0x108e91(_0x29be66['error']['message']);}logger['error'](_0x1243('0x28'),_0x376a47,_0x29be66[_0x1243('0x2c')][_0x1243('0x2e')]);return _0x49af55(_0x29be66[_0x1243('0x2c')][_0x1243('0x2e')]);}else{logger[_0x1243('0x27')](_0x1243('0x28'),_0x376a47,'request\x20sent');_0x49af55(_0x29be66['result']['message']);}})['catch'](function(_0x1cf67c){logger[_0x1243('0x2c')](_0x1243('0x28'),_0x376a47,_0x1cf67c);_0x108e91(_0x1cf67c);});});}function respondWithStatusCode(_0x556cfd,_0x4fa15d){_0x4fa15d=_0x4fa15d||0xcc;return function(_0x390b9c){if(_0x390b9c){return _0x556cfd['sendStatus'](_0x4fa15d);}return _0x556cfd[_0x1243('0x2f')](_0x4fa15d)[_0x1243('0x30')]();};}function respondWithResult(_0x1fa82f,_0x44e8b8){_0x44e8b8=_0x44e8b8||0xc8;return function(_0x2cf8b8){if(_0x2cf8b8){return _0x1fa82f[_0x1243('0x2f')](_0x44e8b8)['json'](_0x2cf8b8);}};}function respondWithFilteredResult(_0x1499a2,_0x28bb8b){return function(_0x341d55){if(_0x341d55){var _0x36f424=typeof _0x28bb8b[_0x1243('0x31')]===_0x1243('0x32')&&typeof _0x28bb8b[_0x1243('0x33')]===_0x1243('0x32');var _0x33f58a=_0x341d55['count'];var _0x3d6ba3=_0x36f424?0x0:_0x28bb8b['offset'];var _0x3e9dc1=_0x36f424?_0x341d55[_0x1243('0x34')]:_0x28bb8b[_0x1243('0x31')]+_0x28bb8b[_0x1243('0x33')];var _0x2b2378;if(_0x3e9dc1>=_0x33f58a){_0x3e9dc1=_0x33f58a;_0x2b2378=0xc8;}else{_0x2b2378=0xce;}_0x1499a2[_0x1243('0x2f')](_0x2b2378);return _0x1499a2[_0x1243('0x35')](_0x1243('0x36'),_0x3d6ba3+'-'+_0x3e9dc1+'/'+_0x33f58a)[_0x1243('0x37')](_0x341d55);}return null;};}function patchUpdates(_0x5c3f85){return function(_0x2643b8){try{jsonpatch['apply'](_0x2643b8,_0x5c3f85,!![]);}catch(_0x37c02f){return BPromise[_0x1243('0x38')](_0x37c02f);}return _0x2643b8[_0x1243('0x39')]();};}function saveUpdates(_0x193f25,_0x5ef820){return function(_0x857273){if(_0x857273){return _0x857273[_0x1243('0x3a')](_0x193f25)[_0x1243('0x26')](function(_0x3a0efd){return _0x3a0efd;});}return null;};}function removeEntity(_0x2c4f38,_0xa9550c){return function(_0x4770dc){if(_0x4770dc){return _0x4770dc[_0x1243('0x3b')]()[_0x1243('0x26')](function(){_0x2c4f38['status'](0xcc)[_0x1243('0x30')]();});}};}function handleEntityNotFound(_0x30b9ba,_0x57013d){return function(_0x348b68){if(!_0x348b68){_0x30b9ba[_0x1243('0x3c')](0x194);}return _0x348b68;};}function handleError(_0x1a12d1,_0x156ef3){_0x156ef3=_0x156ef3||0x1f4;return function(_0x5c7967){logger['error'](_0x5c7967[_0x1243('0x3d')]);if(_0x5c7967['name']){delete _0x5c7967[_0x1243('0x3e')];}_0x1a12d1['status'](_0x156ef3)[_0x1243('0x3f')](_0x5c7967);};}exports['index']=function(_0x4a5ddb,_0x3c9d36){var _0x51ec09={},_0x2b47c6={},_0x3be51f={'count':0x0,'rows':[]};var _0x15d40a=_['map'](db[_0x1243('0x40')][_0x1243('0x41')],function(_0x14b6ab){return{'name':_0x14b6ab['fieldName'],'type':_0x14b6ab['type'][_0x1243('0x42')]};});_0x2b47c6[_0x1243('0x43')]=_[_0x1243('0x44')](_0x15d40a,_0x1243('0x3e'));_0x2b47c6[_0x1243('0x45')]=_[_0x1243('0x46')](_0x4a5ddb[_0x1243('0x45')]);_0x2b47c6[_0x1243('0x47')]=_[_0x1243('0x48')](_0x2b47c6['model'],_0x2b47c6[_0x1243('0x45')]);_0x51ec09[_0x1243('0x49')]=_[_0x1243('0x48')](_0x2b47c6[_0x1243('0x43')],qs['fields'](_0x4a5ddb[_0x1243('0x45')][_0x1243('0x4a')]));_0x51ec09[_0x1243('0x49')]=_0x51ec09[_0x1243('0x49')][_0x1243('0x4b')]?_0x51ec09['attributes']:_0x2b47c6[_0x1243('0x43')];if(!_0x4a5ddb['query']['hasOwnProperty'](_0x1243('0x4c'))){_0x51ec09[_0x1243('0x33')]=qs[_0x1243('0x33')](_0x4a5ddb[_0x1243('0x45')]['limit']);_0x51ec09[_0x1243('0x31')]=qs[_0x1243('0x31')](_0x4a5ddb[_0x1243('0x45')][_0x1243('0x31')]);}_0x51ec09[_0x1243('0x4d')]=qs['sort'](_0x4a5ddb[_0x1243('0x45')]['sort']);_0x51ec09[_0x1243('0x4e')]=qs[_0x1243('0x47')](_['pick'](_0x4a5ddb[_0x1243('0x45')],_0x2b47c6[_0x1243('0x47')]),_0x15d40a);if(_0x4a5ddb[_0x1243('0x45')]['filter']){_0x51ec09['where']=_['merge'](_0x51ec09[_0x1243('0x4e')],{'$or':_[_0x1243('0x44')](_0x15d40a,function(_0x2ef7fb){if(_0x2ef7fb['type']!=='VIRTUAL'){var _0x221981={};_0x221981[_0x2ef7fb[_0x1243('0x3e')]]={'$like':'%'+_0x4a5ddb[_0x1243('0x45')]['filter']+'%'};return _0x221981;}})});}_0x51ec09=_[_0x1243('0x4f')]({},_0x51ec09,_0x4a5ddb[_0x1243('0x50')]);var _0x1b19ea={'where':_0x51ec09[_0x1243('0x4e')]};return db['SmsMessage'][_0x1243('0x34')](_0x1b19ea)['then'](function(_0x2b56b0){_0x3be51f[_0x1243('0x34')]=_0x2b56b0;if(_0x4a5ddb['query'][_0x1243('0x51')]){_0x51ec09[_0x1243('0x52')]=[{'all':!![]}];}return db[_0x1243('0x40')][_0x1243('0x53')](_0x51ec09);})[_0x1243('0x26')](function(_0x227b36){_0x3be51f['rows']=_0x227b36;return _0x3be51f;})[_0x1243('0x26')](respondWithFilteredResult(_0x3c9d36,_0x51ec09))[_0x1243('0x54')](handleError(_0x3c9d36,null));};exports['show']=function(_0x4626af,_0x381ff1){var _0x2d74c0={'raw':!![],'where':{'id':_0x4626af[_0x1243('0x55')]['id']}},_0x22c945={};_0x22c945['model']=_[_0x1243('0x46')](db[_0x1243('0x40')][_0x1243('0x41')]);_0x22c945[_0x1243('0x45')]=_[_0x1243('0x46')](_0x4626af[_0x1243('0x45')]);_0x22c945[_0x1243('0x47')]=_['intersection'](_0x22c945[_0x1243('0x43')],_0x22c945['query']);_0x2d74c0[_0x1243('0x49')]=_[_0x1243('0x48')](_0x22c945[_0x1243('0x43')],qs[_0x1243('0x4a')](_0x4626af[_0x1243('0x45')][_0x1243('0x4a')]));_0x2d74c0['attributes']=_0x2d74c0[_0x1243('0x49')][_0x1243('0x4b')]?_0x2d74c0[_0x1243('0x49')]:_0x22c945[_0x1243('0x43')];if(_0x4626af[_0x1243('0x45')]['includeAll']){_0x2d74c0[_0x1243('0x52')]=[{'all':!![]}];}_0x2d74c0=_['merge']({},_0x2d74c0,_0x4626af[_0x1243('0x50')]);return db[_0x1243('0x40')][_0x1243('0x56')](_0x2d74c0)['then'](handleEntityNotFound(_0x381ff1,null))[_0x1243('0x26')](respondWithResult(_0x381ff1,null))['catch'](handleError(_0x381ff1,null));};exports['create']=function(_0x4c8f41,_0x3d2829){return db[_0x1243('0x40')][_0x1243('0x57')](_0x4c8f41['body'],{})[_0x1243('0x26')](respondWithResult(_0x3d2829,0xc9))[_0x1243('0x54')](handleError(_0x3d2829,null));};exports[_0x1243('0x3a')]=function(_0x5e35d7,_0x522121){if(_0x5e35d7[_0x1243('0x58')]['id']){delete _0x5e35d7[_0x1243('0x58')]['id'];}return db[_0x1243('0x40')][_0x1243('0x56')]({'where':{'id':_0x5e35d7[_0x1243('0x55')]['id']}})[_0x1243('0x26')](handleEntityNotFound(_0x522121,null))['then'](saveUpdates(_0x5e35d7[_0x1243('0x58')],null))['then'](respondWithResult(_0x522121,null))[_0x1243('0x54')](handleError(_0x522121,null));};exports[_0x1243('0x3b')]=function(_0x1529a4,_0x48b956){return db[_0x1243('0x40')][_0x1243('0x56')]({'where':{'id':_0x1529a4[_0x1243('0x55')]['id']}})[_0x1243('0x26')](handleEntityNotFound(_0x48b956,null))[_0x1243('0x26')](removeEntity(_0x48b956,null))[_0x1243('0x54')](handleError(_0x48b956,null));};exports[_0x1243('0x59')]=function(_0x5a7b79,_0x514679){return db['SmsMessage'][_0x1243('0x59')]()[_0x1243('0x26')](respondWithResult(_0x514679,null))['catch'](handleError(_0x514679,null));};var interaction_log=require(_0x1243('0x16'))(_0x1243('0x5a'));exports[_0x1243('0x5b')]=function(_0x133c60,_0x29f68d,_0x4084e3){var _0x5378ea={'agent':{},'channel':_0x1243('0x5c')};if(_0x133c60[_0x1243('0x58')]['id']){delete _0x133c60[_0x1243('0x58')]['id'];}_0x133c60['body']['read']=!![];_0x133c60[_0x1243('0x58')][_0x1243('0x5d')]=moment()[_0x1243('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x133c60[_0x1243('0x58')]['UserId']=_0x133c60[_0x1243('0x58')]['UserId']||_0x133c60[_0x1243('0x5f')]['id'];_0x5378ea['agent']['id']=_0x133c60['body'][_0x1243('0x60')];return db[_0x1243('0x40')][_0x1243('0x56')]({'where':{'id':_0x133c60[_0x1243('0x55')]['id'],'UserId':null}})[_0x1243('0x26')](handleEntityNotFound(_0x29f68d,null))[_0x1243('0x26')](saveUpdates(_0x133c60[_0x1243('0x58')],null))[_0x1243('0x26')](function(_0x1c3669){if(_0x1c3669){_0x5378ea['message']=_0x1c3669[_0x1243('0x61')]({'plain':!![]});return db[_0x1243('0x62')][_0x1243('0x56')]({'where':{'id':_0x1c3669[_0x1243('0x63')]}});}return null;})[_0x1243('0x26')](handleEntityNotFound(_0x29f68d,null))[_0x1243('0x26')](function(_0xa7e89c){if(_0xa7e89c){return _0xa7e89c['update']({'UserId':_0x133c60[_0x1243('0x58')][_0x1243('0x60')],'read1stAt':_[_0x1243('0x64')](_0xa7e89c['read1stAt'])?moment()[_0x1243('0x5e')](_0x1243('0x65')):undefined});}return null;})[_0x1243('0x26')](function(_0x58954a){if(_0x58954a){_0x5378ea[_0x1243('0x66')]=_0x58954a[_0x1243('0x61')]({'plain':!![]});interaction_log[_0x1243('0x27')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x133c60[_0x1243('0x5f')]['id'],_0x133c60[_0x1243('0x5f')][_0x1243('0x3e')],_0x133c60[_0x1243('0x5f')][_0x1243('0x67')],_0x5378ea[_0x1243('0x66')]['id'],_0x133c60['body']?JSON[_0x1243('0x68')](_0x133c60[_0x1243('0x58')]):_0x1243('0x69'));return respondWithRpcPromise(_0x1243('0x6a'),'acceptMessage',_0x5378ea);}return null;})[_0x1243('0x26')](function(_0x4a463a){var _0x17fc43=_0x1243('0x6b')+_0x4a463a['message']['ContactId'];return db['sequelize']['query'](_0x17fc43,{'type':db['Sequelize'][_0x1243('0x6c')]['SELECT'],'raw':!![]})[_0x1243('0x26')](function(_0x916bf0){return _0x916bf0;});})['then'](function(_0x805c73){if(_0x805c73){_0x5378ea[_0x1243('0x2e')][_0x1243('0x6d')]=_0x805c73[0x0];if(!_0x133c60[_0x1243('0x58')][_0x1243('0x60')])return;return db[_0x1243('0x6e')][_0x1243('0x56')]({'where':{'id':_0x133c60[_0x1243('0x58')]['UserId'],'role':_0x1243('0x6f')},'attributes':['id',_0x1243('0x3e'),_0x1243('0x70'),_0x1243('0x71'),_0x1243('0x72')],'raw':!![]});}return null;})[_0x1243('0x26')](function(_0x667c97){if(!_0x667c97)return null;_0x5378ea[_0x1243('0x2e')][_0x1243('0x6f')]=_0x667c97;return _0x5378ea;})[_0x1243('0x26')](function(_0x540221){if(_0x540221){if(_0x133c60[_0x1243('0x58')][_0x1243('0x73')]){_0x5378ea[_0x1243('0x2e')][_0x1243('0x74')]=util[_0x1243('0x5e')](_0x1243('0x75'),_0x133c60['user'][_0x1243('0x3e')]);_0x5378ea[_0x1243('0x2e')][_0x1243('0x76')]=_0x5378ea[_0x1243('0x76')];_0x5378ea['message'][_0x1243('0x77')]=_0x5378ea[_0x1243('0x76')];_0x5378ea[_0x1243('0x2e')][_0x1243('0x78')]='accept';return respondWithRpcPromise(_0x1243('0x79'),_0x1243('0x79'),{'event':_0x1243('0x7a'),'message':_0x5378ea[_0x1243('0x2e')]},client9002)[_0x1243('0x26')](function(){return _0x5378ea;});}return _0x5378ea;}return null;})['then'](respondWithResult(_0x29f68d,null))[_0x1243('0x54')](handleError(_0x29f68d,null));};var interaction_log=require(_0x1243('0x16'))(_0x1243('0x5a'));exports[_0x1243('0x38')]=function(_0x28a4a6,_0x487431,_0x2d8090){var _0x3d5b7d={'agent':{},'channel':_0x1243('0x5c')};if(_0x28a4a6[_0x1243('0x58')]['id']){delete _0x28a4a6[_0x1243('0x58')]['id'];}_0x28a4a6[_0x1243('0x58')][_0x1243('0x60')]=_0x28a4a6['body'][_0x1243('0x60')]||_0x28a4a6[_0x1243('0x5f')]['id'];_0x3d5b7d[_0x1243('0x6f')]['id']=_0x28a4a6[_0x1243('0x58')][_0x1243('0x60')];return db[_0x1243('0x40')][_0x1243('0x56')]({'where':{'id':_0x28a4a6['params']['id'],'UserId':null}})[_0x1243('0x26')](handleEntityNotFound(_0x487431,null))[_0x1243('0x26')](function(_0x4b0d4c){if(_0x4b0d4c){_0x3d5b7d[_0x1243('0x2e')]=_0x4b0d4c[_0x1243('0x61')]({'plain':!![]});return db[_0x1243('0x62')][_0x1243('0x56')]({'where':{'id':_0x4b0d4c[_0x1243('0x63')]}});}return null;})[_0x1243('0x26')](handleEntityNotFound(_0x487431,null))[_0x1243('0x26')](function(_0x3fc6ee){if(_0x3fc6ee){_0x3d5b7d[_0x1243('0x66')]=_0x3fc6ee[_0x1243('0x61')]({'plain':!![]});interaction_log[_0x1243('0x27')](_0x1243('0x7b'),_0x28a4a6[_0x1243('0x5f')]['id'],_0x28a4a6[_0x1243('0x5f')][_0x1243('0x3e')],_0x28a4a6[_0x1243('0x5f')]['role'],_0x3d5b7d[_0x1243('0x66')]['id'],_0x28a4a6[_0x1243('0x58')]?JSON[_0x1243('0x68')](_0x28a4a6[_0x1243('0x58')]):_0x1243('0x69'));return respondWithRpcPromise(_0x1243('0x7c'),_0x1243('0x7d'),_0x3d5b7d);}return null;})[_0x1243('0x26')](function(_0x5eda5f){var _0x49d26e=_0x1243('0x6b')+_0x5eda5f[_0x1243('0x2e')][_0x1243('0x7e')];return db[_0x1243('0x7f')][_0x1243('0x45')](_0x49d26e,{'type':db['Sequelize']['QueryTypes'][_0x1243('0x80')],'raw':!![]})['then'](function(_0x5e5833){return _0x5e5833;});})[_0x1243('0x26')](function(_0x2339da){if(_0x2339da){_0x3d5b7d[_0x1243('0x2e')]['contact']=_0x2339da[0x0];if(!_0x28a4a6[_0x1243('0x58')][_0x1243('0x60')])return;return db[_0x1243('0x6e')][_0x1243('0x56')]({'where':{'id':_0x28a4a6[_0x1243('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x1243('0x3e'),_0x1243('0x70'),_0x1243('0x71'),_0x1243('0x72')],'raw':!![]});}return null;})[_0x1243('0x26')](function(_0x220d54){if(!_0x220d54)return null;_0x3d5b7d[_0x1243('0x2e')][_0x1243('0x6f')]=_0x220d54;return _0x3d5b7d;})[_0x1243('0x26')](function(_0x14929b){if(_0x14929b){_0x14929b[_0x1243('0x2e')][_0x1243('0x74')]=util[_0x1243('0x5e')]('SIP/%s',_0x28a4a6[_0x1243('0x5f')][_0x1243('0x3e')]);_0x14929b['message'][_0x1243('0x76')]=_0x3d5b7d[_0x1243('0x76')];_0x14929b[_0x1243('0x2e')][_0x1243('0x77')]=_0x3d5b7d[_0x1243('0x76')];_0x14929b[_0x1243('0x2e')][_0x1243('0x78')]=_0x1243('0x38');respondWithRpcPromise(_0x1243('0x79'),_0x1243('0x79'),{'event':_0x1243('0x81'),'message':_0x14929b[_0x1243('0x2e')]},client9002);return _0x3d5b7d;}return null;})[_0x1243('0x26')](respondWithResult(_0x487431,null))['catch'](handleError(_0x487431,null));};exports[_0x1243('0x2f')]=function(_0x35ccff,_0x1f74dc,_0xa26ec2){if(_0x35ccff[_0x1243('0x58')]['id']){delete _0x35ccff[_0x1243('0x58')]['id'];}var _0x50eb80;return db[_0x1243('0x40')][_0x1243('0x56')]({'where':{'id':_0x35ccff['params']['id']}})[_0x1243('0x26')](handleEntityNotFound(_0x1f74dc,null))[_0x1243('0x26')](function(_0x5cfc2a){if(_0x5cfc2a){_0x50eb80=_0x5cfc2a;return db[_0x1243('0x82')][_0x1243('0x56')]({'where':{'id':_0x5cfc2a[_0x1243('0x83')]}});}})[_0x1243('0x26')](handleEntityNotFound(_0x1f74dc,null))[_0x1243('0x26')](function(_0x3ace40){if(_0x3ace40){logger['debug'](_0x1243('0x2b'),_0x1243('0x2f'),_0x1243('0x84'),_0x3ace40[_0x1243('0x85')],util[_0x1243('0x86')](_0x35ccff[_0x1243('0x58')],{'showHidden':![],'depth':null}));switch(_0x3ace40['type']){case'twilio':if(_0x35ccff[_0x1243('0x58')][_0x1243('0x87')]&&_0x35ccff[_0x1243('0x58')][_0x1243('0x87')]===_0x50eb80[_0x1243('0x88')]){return _0x50eb80[_0x1243('0x3a')]({'read':!![]});}else{logger[_0x1243('0x2c')](_0x1243('0x89'),_0x1243('0x2f'),_0x1243('0x8a'),util[_0x1243('0x86')](_0x35ccff['body'],{'showHidden':![],'depth':null}));}break;case _0x1243('0x8b'):if(_0x35ccff[_0x1243('0x58')]['MessageUUID']&&_0x35ccff['body']['MessageUUID']===_0x50eb80[_0x1243('0x88')]&&_[_0x1243('0x8c')]([_0x1243('0x8d'),_0x1243('0x8e')],_0x35ccff[_0x1243('0x58')][_0x1243('0x8f')])>=0x0){return _0x50eb80[_0x1243('0x3a')]({'read':!![]});}else{logger['error'](_0x1243('0x89'),_0x1243('0x2f'),_0x1243('0x90'),util[_0x1243('0x86')](_0x35ccff[_0x1243('0x58')],{'showHidden':![],'depth':null}));}break;case _0x1243('0x91'):var _0x29ee57=_0x35ccff['body']['results'][0x0];if(_0x29ee57[_0x1243('0x2f')][_0x1243('0x92')]===_0x1243('0x93')){return _0x50eb80[_0x1243('0x3a')]({'read':!![]});}else{logger[_0x1243('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1243('0x2f'),_0x1243('0x91'),util['inspect'](_0x35ccff[_0x1243('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x50eb80;}})[_0x1243('0x26')](respondWithResult(_0x1f74dc,null))['catch'](handleError(_0x1f74dc,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 48d8ee1..d08fb08 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 _0x9861=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x9861,0xb4));var _0x1986=function(_0xe2f5ee,_0x9d7134){_0xe2f5ee=_0xe2f5ee-0x0;var _0x1f6fa9=_0x9861[_0xe2f5ee];return _0x1f6fa9;};'use strict';var EventEmitter=require(_0x1986('0x0'));var SmsMessage=require(_0x1986('0x1'))['db'][_0x1986('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1986('0x3')](0x0);var events={'afterCreate':_0x1986('0x4'),'afterUpdate':_0x1986('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c9748){return function(_0x947397,_0x2cbd0a,_0x44d878){SmsMessageEvents[_0x1986('0x6')](_0x1c9748+':'+_0x947397['id'],_0x947397);SmsMessageEvents['emit'](_0x1c9748,_0x947397);_0x44d878(null);};}for(var e in events){if(events[_0x1986('0x7')](e)){var event=events[e];SmsMessage[_0x1986('0x8')](e,emitEvent(event));}}module[_0x1986('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x6ba5=['hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x6ba5,0x11a));var _0x56ba=function(_0x565374,_0x395149){_0x565374=_0x565374-0x0;var _0x31cd93=_0x6ba5[_0x565374];return _0x31cd93;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x56ba('0x0'))['db'][_0x56ba('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x56ba('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x56ba('0x3'),'afterDestroy':_0x56ba('0x4')};function emitEvent(_0x276ff7){return function(_0x5a4eab,_0x37b28a,_0x5db921){SmsMessageEvents[_0x56ba('0x5')](_0x276ff7+':'+_0x5a4eab['id'],_0x5a4eab);SmsMessageEvents[_0x56ba('0x5')](_0x276ff7,_0x5a4eab);_0x5db921(null);};}for(var e in events){if(events[_0x56ba('0x6')](e)){var event=events[e];SmsMessage[_0x56ba('0x7')](e,emitEvent(event));}}module[_0x56ba('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6358011..cc9dcef 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 _0xfb74=['total_sent','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','queued_count','head','data','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','remote','application/json','infobip','csc','crypto','login','timestamp','keys','sort','length','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','messageId','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','then','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','create','body','phone','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xfb74,0xc1));var _0x4fb7=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0xfb74[_0x1e8c4e];return _0x19088a;};'use strict';var _=require(_0x4fb7('0x0'));var util=require(_0x4fb7('0x1'));var logger=require(_0x4fb7('0x2'))(_0x4fb7('0x3'));var moment=require(_0x4fb7('0x4'));var BPromise=require(_0x4fb7('0x5'));var rp=require(_0x4fb7('0x6'));var fs=require('fs');var path=require(_0x4fb7('0x7'));var rimraf=require(_0x4fb7('0x8'));var config=require(_0x4fb7('0x9'));var attributes=require(_0x4fb7('0xa'));module['exports']=function(_0x2d54fe,_0x48734c){return _0x2d54fe['define'](_0x4fb7('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x4fb7('0xc'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x63079a,_0x406ffc,_0x3511ed){var _0x104b22=_0x2d54fe[_0x4fb7('0xd')];var _0x49a3b2=_0x63079a[_0x4fb7('0xe')]({'plain':!![]});if(_0x49a3b2[_0x4fb7('0xf')][_0x4fb7('0x10')]()==='in'||_0x49a3b2['direction'][_0x4fb7('0x10')]()===_0x4fb7('0x11')&&!_0x49a3b2[_0x4fb7('0x12')]&&!_['isNil'](_0x49a3b2[_0x4fb7('0x13')])&&!_[_0x4fb7('0x14')](_0x49a3b2['SmsInteractionId'])){_0x104b22['SmsInteraction'][_0x4fb7('0x15')]({'where':{'id':_0x49a3b2[_0x4fb7('0x16')]}})[_0x4fb7('0x17')](function(_0x3fe6ac){if(_0x3fe6ac){_0x3fe6ac['update']({'lastMsgAt':_0x49a3b2[_0x4fb7('0x18')],'lastMsgDirection':_0x49a3b2[_0x4fb7('0xf')][_0x4fb7('0x10')]()});}})[_0x4fb7('0x19')](function(_0x118a27){console[_0x4fb7('0x1a')](_0x118a27);});}if(_0x49a3b2[_0x4fb7('0xf')]===_0x4fb7('0x11')&&!_0x49a3b2[_0x4fb7('0x12')]){var _0x37988c;_0x104b22[_0x4fb7('0x1b')]['find']({'where':{'id':_0x49a3b2[_0x4fb7('0x1c')]},'raw':!![]})[_0x4fb7('0x17')](function(_0x1eef50){_0x37988c=_0x1eef50;if(_0x37988c&&_0x37988c[_0x4fb7('0x1d')]){switch(_0x37988c['type']){case _0x4fb7('0x1e'):var _0x1f3f43=require(_0x4fb7('0x1e'));if(_0x37988c['accountSid']&&_0x37988c['authToken']&&_0x37988c['phone']){var _0x305815=new _0x1f3f43(_0x37988c[_0x4fb7('0x1f')],_0x37988c[_0x4fb7('0x20')]);_0x305815['messages'][_0x4fb7('0x21')]({'body':_0x49a3b2[_0x4fb7('0x22')],'to':_0x49a3b2[_0x4fb7('0x23')],'from':_0x37988c[_0x4fb7('0x23')],'statusCallback':_0x37988c['remote']+_0x4fb7('0x24')+_0x49a3b2['id']+_0x4fb7('0x25')+_0x37988c[_0x4fb7('0x26')]})['then'](function(_0x286485){if(_0x286485[_0x4fb7('0x27')]){return _0x63079a[_0x4fb7('0x28')]({'messageId':_0x286485[_0x4fb7('0x27')]});}})[_0x4fb7('0x19')](function(_0x26e152){logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x1e'),util[_0x4fb7('0x2b')](_0x26e152,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x1e'),_0x4fb7('0x2c'));}break;case'skebby':var _0xd8f3f3=_0x4fb7('0x2d');if(_0x37988c[_0x4fb7('0x2e')]&&_0x37988c[_0x4fb7('0x2f')]){var _0x51f628={'recipient':[_0x49a3b2[_0x4fb7('0x23')]],'message':_0x49a3b2[_0x4fb7('0x22')],'message_type':_0x37988c[_0x4fb7('0x30')]};if(_0x37988c[_0x4fb7('0x30')]&&_0x37988c[_0x4fb7('0x30')]!=='SI'){_0x51f628[_0x4fb7('0x31')]=_0x37988c['phone'];}var _0x3decf2={'url':_0xd8f3f3+'login?username='+_0x37988c[_0x4fb7('0x2e')]+_0x4fb7('0x32')+_0x37988c['password'],'method':_0x4fb7('0x33')};rp(_0x3decf2)[_0x4fb7('0x17')](function(_0x55e260){var _0x2c19b5=_0x55e260[_0x4fb7('0x34')](';');var _0x305e2f={'user_key':_0x2c19b5[0x0],'session_key':_0x2c19b5[0x1]};_0x3decf2={'url':_0xd8f3f3+_0x4fb7('0x35'),'method':_0x4fb7('0x36'),'headers':{'user_key':_0x305e2f[_0x4fb7('0x37')],'Session_key':_0x305e2f[_0x4fb7('0x38')]},'json':!![],'body':_0x51f628};return rp(_0x3decf2);})['then'](function(_0x3c1f89){if(_0x3c1f89[_0x4fb7('0x39')]>=0x1){var _0x2580df={'messageId':_0x3c1f89['internal_order_id']};if(_0x37988c[_0x4fb7('0x30')]!=='GP'||!_0x37988c['deliveryReport']){_0x2580df[_0x4fb7('0x3a')]=!![];}return _0x63079a[_0x4fb7('0x28')](_0x2580df);}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'skebby',util[_0x4fb7('0x2b')](_0x3c1f89,{'showHidden':![],'depth':null}));}})[_0x4fb7('0x19')](function(_0x3d0af6){return logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x3b'),util[_0x4fb7('0x2b')](_0x3d0af6,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x3b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4fb7('0x3c'):if(_0x37988c[_0x4fb7('0x20')]){var _0x389b3e={'recipient':_0x49a3b2[_0x4fb7('0x23')],'message':_0x49a3b2['body'],'sender':_0x37988c[_0x4fb7('0x3d')]||_0x37988c[_0x4fb7('0x23')],'authorization':_0x37988c[_0x4fb7('0x20')]};var _0x406ffc={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x3e'),'body':_0x389b3e,'json':!![]};rp(_0x406ffc)[_0x4fb7('0x17')](function(_0x289308){var _0x49ec97={'messageId':_0x289308[_0x4fb7('0x3f')]};if(!_0x37988c[_0x4fb7('0x40')]){_0x49ec97[_0x4fb7('0x3a')]=!![];}return _0x63079a['update'](_0x49ec97);})[_0x4fb7('0x19')](function(_0x17cae0){logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x3c'),util['inspect'](_0x17cae0,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate','connectel',_0x4fb7('0x41'));}break;case _0x4fb7('0x42'):if(_0x37988c['username']&&_0x37988c[_0x4fb7('0x2f')]){var _0x389b3e={'messages':[{'source':_0x4fb7('0x43'),'to':_0x49a3b2['phone'],'body':_0x49a3b2[_0x4fb7('0x22')],'from':_0x37988c['senderString']||_0x37988c[_0x4fb7('0x23')]}]};var _0x50438b=util[_0x4fb7('0x44')](_0x4fb7('0x45'),_0x37988c[_0x4fb7('0x2e')],_0x37988c[_0x4fb7('0x2f')]);var _0x406ffc={'method':'POST','uri':_0x4fb7('0x46'),'body':_0x389b3e,'headers':{'Authorization':util['format'](_0x4fb7('0x47'),new Buffer(_0x50438b)['toString']('base64'))},'json':!![]};rp(_0x406ffc)['then'](function(_0x59d6bd){if(_0x59d6bd[_0x4fb7('0x48')]>=0xc8&&_0x59d6bd[_0x4fb7('0x48')]<=0xce){if(_0x59d6bd['data']&&_0x59d6bd['data'][_0x4fb7('0x49')]>0x0){var _0x392b4d=_[_0x4fb7('0x4a')](_0x59d6bd[_0x4fb7('0x4b')][_0x4fb7('0x4c')]);var _0x28aa73={'messageId':_0x392b4d[_0x4fb7('0x4d')]};if(!_0x37988c[_0x4fb7('0x40')]){_0x28aa73[_0x4fb7('0x3a')]=!![];}return _0x63079a[_0x4fb7('0x28')](_0x28aa73);}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x4e'),util[_0x4fb7('0x2b')](_0x59d6bd,{'showHidden':![],'depth':null}));}}else{logger[_0x4fb7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fb7('0x4e'),util[_0x4fb7('0x2b')](_0x59d6bd,{'showHidden':![],'depth':null}));}})[_0x4fb7('0x19')](function(_0x1074b4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fb7('0x2a'),_0x4fb7('0x4e'),util[_0x4fb7('0x2b')](_0x1074b4,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x4e'),_0x4fb7('0x4f'));}break;case'plivo':if(_0x37988c[_0x4fb7('0x50')]&&_0x37988c[_0x4fb7('0x20')]){var _0x389b3e={'dst':_0x49a3b2[_0x4fb7('0x23')],'text':_0x49a3b2[_0x4fb7('0x22')],'src':_0x37988c[_0x4fb7('0x3d')]||_0x37988c['phone'],'url':_0x37988c['remote']+'/api/sms/messages/'+_0x49a3b2['id']+_0x4fb7('0x25')+_0x37988c[_0x4fb7('0x26')]};var _0x50438b=util['format'](_0x4fb7('0x45'),_0x37988c[_0x4fb7('0x50')],_0x37988c[_0x4fb7('0x20')]);var _0x406ffc={'method':'POST','uri':util[_0x4fb7('0x44')](_0x4fb7('0x51'),_0x37988c[_0x4fb7('0x50')]),'body':_0x389b3e,'headers':{'Authorization':util['format'](_0x4fb7('0x47'),new Buffer(_0x50438b)[_0x4fb7('0x52')](_0x4fb7('0x53')))},'json':!![]};rp(_0x406ffc)[_0x4fb7('0x17')](function(_0x9a6e6d){var _0x58b465={'messageId':_0x9a6e6d[_0x4fb7('0x54')][0x0]};return _0x63079a[_0x4fb7('0x28')](_0x58b465);})[_0x4fb7('0x19')](function(_0x41b8d4){logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x55'),util[_0x4fb7('0x2b')](_0x41b8d4,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fb7('0x2a'),_0x4fb7('0x55'),_0x4fb7('0x56'));}break;case'infobip':if(_0x37988c[_0x4fb7('0x2e')]&&_0x37988c[_0x4fb7('0x2f')]){if(_0x37988c[_0x4fb7('0x57')]){var _0x1d6113={'method':_0x4fb7('0x36'),'uri':_0x37988c[_0x4fb7('0x57')]+_0x4fb7('0x58'),'body':{'username':_0x37988c[_0x4fb7('0x2e')],'password':_0x37988c[_0x4fb7('0x2f')]},'json':!![]};return rp(_0x1d6113)['then'](function(_0x151004){var _0x954835={'method':_0x4fb7('0x36'),'uri':_0x37988c[_0x4fb7('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x37988c[_0x4fb7('0x23')],'destinations':[{'to':_0x49a3b2[_0x4fb7('0x23')]}],'text':_0x49a3b2[_0x4fb7('0x22')],'notifyUrl':_0x37988c[_0x4fb7('0x59')]+_0x4fb7('0x24')+_0x49a3b2['id']+_0x4fb7('0x25')+_0x37988c[_0x4fb7('0x26')],'notifyContentType':_0x4fb7('0x5a'),'callbackData':_0x37988c[_0x4fb7('0x23')]+';'+_0x49a3b2[_0x4fb7('0x22')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x151004[_0x4fb7('0x26')]},'json':!![]};return rp(_0x954835)[_0x4fb7('0x17')](function(_0xafcd83){if(_0xafcd83[_0x4fb7('0x4c')]){var _0x2eb0c7={'messageId':_0xafcd83[_0x4fb7('0x4c')][0x0]['messageId']};if(!_0x37988c[_0x4fb7('0x40')]){_0x2eb0c7[_0x4fb7('0x3a')]=!![];}return _0x63079a['update'](_0x2eb0c7);}else{return logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x5b'),util[_0x4fb7('0x2b')](_0xafcd83,{'showHidden':![],'depth':null}));}});})[_0x4fb7('0x19')](function(_0x462a07){return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x5b'),util['inspect'](_0x462a07,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'infobip',_0x4fb7('0x4f'));}break;case _0x4fb7('0x5c'):var _0x5d2e83=require(_0x4fb7('0x5d'));if(_0x37988c['apiKey']){var _0x19e798={};_0x19e798[_0x4fb7('0x5e')]=_0x37988c[_0x4fb7('0x2e')];_0x19e798[_0x4fb7('0x23')]=_0x49a3b2[_0x4fb7('0x23')];_0x19e798['sender']=_0x37988c[_0x4fb7('0x23')];_0x19e798['text']=_0x49a3b2[_0x4fb7('0x22')];_0x19e798[_0x4fb7('0x5f')]=+new Date();var _0x1124f8='';var _0x3f1083='';var _0x2a4929=Object[_0x4fb7('0x60')](_0x19e798);_0x2a4929[_0x4fb7('0x61')]();for(var _0x1da764=0x0;_0x1da764<_0x2a4929[_0x4fb7('0x62')];_0x1da764++){if(_0x1124f8!=''){_0x1124f8+='&';}_0x1124f8+=_0x2a4929[_0x1da764]+'='+encodeURIComponent(_0x19e798[_0x2a4929[_0x1da764]]);_0x3f1083+=_0x19e798[_0x2a4929[_0x1da764]];}_0x3f1083+=_0x37988c['apiKey'];_0x3f1083=_0x5d2e83['createHash']('md5')[_0x4fb7('0x28')](_0x3f1083)[_0x4fb7('0x63')](_0x4fb7('0x64'));if(_0x1124f8!==''){_0x1124f8+='&';}_0x1124f8+=_0x4fb7('0x65')+_0x3f1083;var _0x3decf2={'method':_0x4fb7('0x33'),'uri':_0x37988c['baseUrl']+_0x4fb7('0x66')+_0x1124f8,'json':!![]};return rp(_0x3decf2)[_0x4fb7('0x17')](function(_0x158e41){var _0x59990b=Object['keys'](_0x158e41);if(_0x158e41[_0x59990b[0x0]][_0x4fb7('0x1a')]&&parseInt(_0x158e41[_0x59990b[0x0]][_0x4fb7('0x1a')])===0x0){var _0xfc858a={'messageId':_0x158e41[_0x59990b[0x0]][_0x4fb7('0x67')]};if(!_0x37988c['deliveryReport']){_0xfc858a['read']=!![];}return _0x63079a[_0x4fb7('0x28')](_0xfc858a);}else{return logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x5c'),util[_0x4fb7('0x2b')](_0x158e41[_0x4fb7('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x453d95){return logger['error'](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x5c'),util['inspect'](_0x453d95,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fb7('0x29'),'afterCreate',_0x4fb7('0x5c'),_0x4fb7('0x68'));}break;case _0x4fb7('0x69'):if(_0x37988c[_0x4fb7('0x6a')]){var _0x33b868={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x6b'),'headers':{'Authorization':_0x37988c[_0x4fb7('0x6a')]},'body':{'content':_0x49a3b2['body'],'to':[_0x49a3b2['phone']],'from':_0x37988c['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x4fb7('0x6c')},'json':!![]};rp(_0x33b868)['then'](function(_0x41aba3){if(!_0x41aba3[_0x4fb7('0x1a')]){var _0x4f314d={'messageId':_0x41aba3[_0x4fb7('0x4c')][0x0][_0x4fb7('0x6d')]};if(!_0x37988c[_0x4fb7('0x40')]){_0x4f314d['read']=!![];}return _0x63079a[_0x4fb7('0x28')](_0x4f314d);}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x69'),util[_0x4fb7('0x2b')](_0x41aba3[_0x4fb7('0x1a')],{'showHidden':![],'depth':null}));}})[_0x4fb7('0x19')](function(_0x53b5fe){return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x69'),util[_0x4fb7('0x2b')](_0x53b5fe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fb7('0x29'),_0x4fb7('0x2a'),'clickatell',_0x4fb7('0x68'));}break;case _0x4fb7('0x6e'):if(_0x37988c['username']&&_0x37988c['password']){var _0x50438b=util[_0x4fb7('0x44')](_0x4fb7('0x45'),_0x37988c[_0x4fb7('0x2e')],_0x37988c[_0x4fb7('0x2f')]);var _0x406ffc={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x6f')+_0x37988c[_0x4fb7('0x70')]+_0x4fb7('0x71'),'body':{'to':[_0x49a3b2[_0x4fb7('0x23')]],'text':_0x49a3b2[_0x4fb7('0x22')],'from':_0x37988c[_0x4fb7('0x23')],'applicationId':_0x37988c[_0x4fb7('0x72')]},'headers':{'Authorization':util['format'](_0x4fb7('0x47'),new Buffer(_0x50438b)[_0x4fb7('0x52')](_0x4fb7('0x53')))},'json':!![]};rp(_0x406ffc)['then'](function(_0x3a6cf0){if(_0x3a6cf0['id']){var _0x21c9f4={'messageId':_0x3a6cf0['id']};return _0x63079a[_0x4fb7('0x28')](_0x21c9f4);}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x6e'),util[_0x4fb7('0x2b')](_0x3a6cf0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d94f5){logger[_0x4fb7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fb7('0x6e'),util[_0x4fb7('0x2b')](_0x3d94f5,{'showHidden':![],'depth':null}));});}else{logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'bandwidth',_0x4fb7('0x4f'));}break;case _0x4fb7('0x73'):if(_0x37988c['apiKey']){var _0x578d00={};var _0x3decf2={'method':'POST','uri':_0x4fb7('0x74'),'headers':{'Authorization':_0x4fb7('0x75')+_0x37988c[_0x4fb7('0x6a')],'Content-Type':_0x4fb7('0x5a')},'body':{'from':_0x37988c[_0x4fb7('0x23')],'to':_0x49a3b2[_0x4fb7('0x23')],'text':_0x49a3b2['body']},'json':!![]};return rp(_0x3decf2)[_0x4fb7('0x17')](function(_0x4e93f8){if(_0x4e93f8[_0x4fb7('0x76')]==0xca){_0x578d00[_0x4fb7('0x77')]=_0x4e93f8;var _0x261105={'method':_0x4fb7('0x36'),'uri':_0x4fb7('0x78'),'headers':{'Authorization':_0x4fb7('0x75')+_0x37988c[_0x4fb7('0x6a')],'Content-Type':_0x4fb7('0x5a')},'body':{'refid':_0x578d00['message'][_0x4fb7('0x79')]},'json':!![]};return rp(_0x261105)[_0x4fb7('0x17')](function(_0x5251a6){_0x578d00[_0x4fb7('0x7a')]=_0x5251a6;var _0x17315b={'messageId':_0x578d00[_0x4fb7('0x77')][_0x4fb7('0x79')],'read':!![]};return _0x63079a[_0x4fb7('0x28')](_0x17315b);});}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x73'),util[_0x4fb7('0x2b')](_0x4e93f8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a6aca){return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),'intelepeer',util[_0x4fb7('0x2b')](_0x2a6aca,{'showHidden':![],'depth':null}));});}else{return logger[_0x4fb7('0x1a')](_0x4fb7('0x29'),_0x4fb7('0x2a'),_0x4fb7('0x73'),'Token\x20not\x20received');}break;}}})[_0x4fb7('0x7b')](function(){_0x3511ed();});}else{_0x3511ed();}}},'charset':_0x4fb7('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x63bf=['/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','toLowerCase','direction','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','messages','message_id','clickSend','authId','/status?token=','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','sort','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x63bf,0x100));var _0xf63b=function(_0x4c5dc1,_0x527f20){_0x4c5dc1=_0x4c5dc1-0x0;var _0x12055e=_0x63bf[_0x4c5dc1];return _0x12055e;};'use strict';var _=require(_0xf63b('0x0'));var util=require(_0xf63b('0x1'));var logger=require(_0xf63b('0x2'))('api');var moment=require(_0xf63b('0x3'));var BPromise=require(_0xf63b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf63b('0x5'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x1b6ea5,_0x291d68){return _0x1b6ea5[_0xf63b('0x6')](_0xf63b('0x7'),attributes,{'tableName':_0xf63b('0x8'),'paranoid':![],'indexes':[{'name':_0xf63b('0x9'),'fields':['messageId']},{'name':_0xf63b('0xa'),'fields':[_0xf63b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49e8ba,_0x126659,_0x4f6c6e){var _0x98b540=_0x1b6ea5[_0xf63b('0xc')];var _0x3bf42b=_0x49e8ba[_0xf63b('0xd')]({'plain':!![]});if(_0x3bf42b['direction'][_0xf63b('0xe')]()==='in'||_0x3bf42b[_0xf63b('0xf')][_0xf63b('0xe')]()==='out'&&!_0x3bf42b[_0xf63b('0x10')]&&!_[_0xf63b('0x11')](_0x3bf42b[_0xf63b('0x12')])&&!_['isNil'](_0x3bf42b[_0xf63b('0x13')])){_0x98b540[_0xf63b('0x14')][_0xf63b('0x15')]({'where':{'id':_0x3bf42b[_0xf63b('0x13')]}})[_0xf63b('0x16')](function(_0x3571fa){if(_0x3571fa){_0x3571fa['update']({'lastMsgAt':_0x3bf42b[_0xf63b('0x17')],'lastMsgDirection':_0x3bf42b['direction'][_0xf63b('0xe')]()});}})[_0xf63b('0x18')](function(_0x529bb4){console[_0xf63b('0x19')](_0x529bb4);});}if(_0x3bf42b[_0xf63b('0xf')]===_0xf63b('0x1a')&&!_0x3bf42b['secret']){var _0x4cf1b1;_0x98b540[_0xf63b('0x1b')][_0xf63b('0x1c')]({'where':{'id':_0x3bf42b[_0xf63b('0x1d')]},'raw':!![]})[_0xf63b('0x16')](function(_0x4cb41f){_0x4cf1b1=_0x4cb41f;if(_0x4cf1b1&&_0x4cf1b1[_0xf63b('0x1e')]){switch(_0x4cf1b1[_0xf63b('0x1e')]){case _0xf63b('0x1f'):var _0x19b2c9=require('twilio');if(_0x4cf1b1[_0xf63b('0x20')]&&_0x4cf1b1[_0xf63b('0x21')]&&_0x4cf1b1[_0xf63b('0x22')]){var _0x41d02e=new _0x19b2c9(_0x4cf1b1[_0xf63b('0x20')],_0x4cf1b1[_0xf63b('0x21')]);_0x41d02e['messages'][_0xf63b('0x23')]({'body':_0x3bf42b['body'],'to':_0x3bf42b[_0xf63b('0x22')],'from':_0x4cf1b1[_0xf63b('0x22')],'statusCallback':_0x4cf1b1[_0xf63b('0x24')]+_0xf63b('0x25')+_0x3bf42b['id']+'/status?token='+_0x4cf1b1[_0xf63b('0x26')]})['then'](function(_0x219b55){if(_0x219b55[_0xf63b('0x27')]){return _0x49e8ba[_0xf63b('0x28')]({'messageId':_0x219b55[_0xf63b('0x27')]});}})[_0xf63b('0x18')](function(_0x225116){logger[_0xf63b('0x19')](_0xf63b('0x29'),'afterCreate',_0xf63b('0x1f'),util[_0xf63b('0x2a')](_0x225116,{'showHidden':![],'depth':null}));});}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),'afterCreate',_0xf63b('0x1f'),_0xf63b('0x2b'));}break;case'skebby':var _0x98a5ea='https://api.skebby.it/API/v1.0/REST/';if(_0x4cf1b1[_0xf63b('0x2c')]&&_0x4cf1b1[_0xf63b('0x2d')]){var _0x485d68={'recipient':[_0x3bf42b[_0xf63b('0x22')]],'message':_0x3bf42b['body'],'message_type':_0x4cf1b1['smsMethod']};if(_0x4cf1b1[_0xf63b('0x2e')]&&_0x4cf1b1[_0xf63b('0x2e')]!=='SI'){_0x485d68[_0xf63b('0x2f')]=_0x4cf1b1[_0xf63b('0x22')];}var _0x5e3751={'url':_0x98a5ea+'login?username='+_0x4cf1b1['username']+_0xf63b('0x30')+_0x4cf1b1['password'],'method':'GET'};rp(_0x5e3751)['then'](function(_0x359841){var _0x5df74e=_0x359841['split'](';');var _0x551875={'user_key':_0x5df74e[0x0],'session_key':_0x5df74e[0x1]};_0x5e3751={'url':_0x98a5ea+_0xf63b('0x31'),'method':_0xf63b('0x32'),'headers':{'user_key':_0x551875[_0xf63b('0x33')],'Session_key':_0x551875[_0xf63b('0x34')]},'json':!![],'body':_0x485d68};return rp(_0x5e3751);})[_0xf63b('0x16')](function(_0x3679f8){if(_0x3679f8[_0xf63b('0x35')]>=0x1){var _0x440b4b={'messageId':_0x3679f8[_0xf63b('0x36')]};if(_0x4cf1b1[_0xf63b('0x2e')]!=='GP'||!_0x4cf1b1[_0xf63b('0x37')]){_0x440b4b[_0xf63b('0x38')]=!![];}return _0x49e8ba[_0xf63b('0x28')](_0x440b4b);}else{return logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),'skebby',util[_0xf63b('0x2a')](_0x3679f8,{'showHidden':![],'depth':null}));}})[_0xf63b('0x18')](function(_0x35e958){return logger['error'](_0xf63b('0x29'),'afterCreate',_0xf63b('0x3a'),util[_0xf63b('0x2a')](_0x35e958,{'showHidden':![],'depth':null}));});}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x3a'),_0xf63b('0x3b'));}break;case _0xf63b('0x3c'):if(_0x4cf1b1['authToken']){var _0x3d48f={'recipient':_0x3bf42b[_0xf63b('0x22')],'message':_0x3bf42b[_0xf63b('0xb')],'sender':_0x4cf1b1[_0xf63b('0x3d')]||_0x4cf1b1['phone'],'authorization':_0x4cf1b1[_0xf63b('0x21')]};var _0x126659={'method':_0xf63b('0x32'),'uri':_0xf63b('0x3e'),'body':_0x3d48f,'json':!![]};rp(_0x126659)['then'](function(_0x469e4a){var _0x3d8ae1={'messageId':_0x469e4a[_0xf63b('0x3f')]};if(!_0x4cf1b1[_0xf63b('0x37')]){_0x3d8ae1[_0xf63b('0x38')]=!![];}return _0x49e8ba[_0xf63b('0x28')](_0x3d8ae1);})[_0xf63b('0x18')](function(_0x32f752){logger[_0xf63b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf63b('0x39'),_0xf63b('0x3c'),util['inspect'](_0x32f752,{'showHidden':![],'depth':null}));});}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0xf63b('0x40'):if(_0x4cf1b1[_0xf63b('0x2c')]&&_0x4cf1b1['password']){var _0x3d48f={'messages':[{'source':'xCALLY\x20Motion','to':_0x3bf42b[_0xf63b('0x22')],'body':_0x3bf42b[_0xf63b('0xb')],'from':_0x4cf1b1['senderString']||_0x4cf1b1['phone']}]};var _0xa03842=util[_0xf63b('0x41')](_0xf63b('0x42'),_0x4cf1b1[_0xf63b('0x2c')],_0x4cf1b1[_0xf63b('0x2d')]);var _0x126659={'method':'POST','uri':_0xf63b('0x43'),'body':_0x3d48f,'headers':{'Authorization':util['format'](_0xf63b('0x44'),new Buffer(_0xa03842)[_0xf63b('0x45')]('base64'))},'json':!![]};rp(_0x126659)['then'](function(_0x301817){if(_0x301817[_0xf63b('0x46')]>=0xc8&&_0x301817[_0xf63b('0x46')]<=0xce){if(_0x301817['data']&&_0x301817[_0xf63b('0x47')][_0xf63b('0x48')]>0x0){var _0x27b26b=_[_0xf63b('0x49')](_0x301817[_0xf63b('0x47')][_0xf63b('0x4a')]);var _0xd75ca9={'messageId':_0x27b26b[_0xf63b('0x4b')]};if(!_0x4cf1b1[_0xf63b('0x37')]){_0xd75ca9[_0xf63b('0x38')]=!![];}return _0x49e8ba[_0xf63b('0x28')](_0xd75ca9);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf63b('0x39'),_0xf63b('0x4c'),util['inspect'](_0x301817,{'showHidden':![],'depth':null}));}}else{logger[_0xf63b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf63b('0x39'),_0xf63b('0x4c'),util['inspect'](_0x301817,{'showHidden':![],'depth':null}));}})[_0xf63b('0x18')](function(_0x5d714d){logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),'clickSend',util[_0xf63b('0x2a')](_0x5d714d,{'showHidden':![],'depth':null}));});}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x4c'),_0xf63b('0x3b'));}break;case'plivo':if(_0x4cf1b1[_0xf63b('0x4d')]&&_0x4cf1b1[_0xf63b('0x21')]){var _0x3d48f={'dst':_0x3bf42b['phone'],'text':_0x3bf42b[_0xf63b('0xb')],'src':_0x4cf1b1[_0xf63b('0x3d')]||_0x4cf1b1['phone'],'url':_0x4cf1b1[_0xf63b('0x24')]+_0xf63b('0x25')+_0x3bf42b['id']+_0xf63b('0x4e')+_0x4cf1b1[_0xf63b('0x26')]};var _0xa03842=util['format']('%s:%s',_0x4cf1b1['authId'],_0x4cf1b1[_0xf63b('0x21')]);var _0x126659={'method':_0xf63b('0x32'),'uri':util[_0xf63b('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4cf1b1['authId']),'body':_0x3d48f,'headers':{'Authorization':util[_0xf63b('0x41')](_0xf63b('0x44'),new Buffer(_0xa03842)['toString'](_0xf63b('0x4f')))},'json':!![]};rp(_0x126659)[_0xf63b('0x16')](function(_0x327d6c){var _0x41257b={'messageId':_0x327d6c['message_uuid'][0x0]};return _0x49e8ba[_0xf63b('0x28')](_0x41257b);})['catch'](function(_0x4e5fa4){logger[_0xf63b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util[_0xf63b('0x2a')](_0x4e5fa4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',_0xf63b('0x50'));}break;case _0xf63b('0x51'):if(_0x4cf1b1[_0xf63b('0x2c')]&&_0x4cf1b1[_0xf63b('0x2d')]){if(_0x4cf1b1[_0xf63b('0x52')]){var _0x169545={'method':'POST','uri':_0x4cf1b1[_0xf63b('0x52')]+'/auth/1/session','body':{'username':_0x4cf1b1[_0xf63b('0x2c')],'password':_0x4cf1b1[_0xf63b('0x2d')]},'json':!![]};return rp(_0x169545)['then'](function(_0x183266){var _0x5b303a={'method':_0xf63b('0x32'),'uri':_0x4cf1b1[_0xf63b('0x52')]+_0xf63b('0x53'),'body':{'messages':[{'from':_0x4cf1b1['phone'],'destinations':[{'to':_0x3bf42b['phone']}],'text':_0x3bf42b[_0xf63b('0xb')],'notifyUrl':_0x4cf1b1[_0xf63b('0x24')]+_0xf63b('0x25')+_0x3bf42b['id']+_0xf63b('0x4e')+_0x4cf1b1[_0xf63b('0x26')],'notifyContentType':_0xf63b('0x54'),'callbackData':_0x4cf1b1[_0xf63b('0x22')]+';'+_0x3bf42b[_0xf63b('0xb')]}]},'headers':{'Authorization':_0xf63b('0x55')+_0x183266[_0xf63b('0x26')]},'json':!![]};return rp(_0x5b303a)[_0xf63b('0x16')](function(_0x46f53c){if(_0x46f53c['messages']){var _0x4ce22e={'messageId':_0x46f53c[_0xf63b('0x4a')][0x0][_0xf63b('0x9')]};if(!_0x4cf1b1['deliveryReport']){_0x4ce22e[_0xf63b('0x38')]=!![];}return _0x49e8ba[_0xf63b('0x28')](_0x4ce22e);}else{return logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x51'),util[_0xf63b('0x2a')](_0x46f53c,{'showHidden':![],'depth':null}));}});})[_0xf63b('0x18')](function(_0x40fc69){return logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x51'),util[_0xf63b('0x2a')](_0x40fc69,{'showHidden':![],'depth':null}));});}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x51'),_0xf63b('0x56'));}}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),'infobip',_0xf63b('0x3b'));}break;case'csc':var _0x23a96d=require(_0xf63b('0x57'));if(_0x4cf1b1[_0xf63b('0x58')]){var _0x31c2d4={};_0x31c2d4[_0xf63b('0x59')]=_0x4cf1b1[_0xf63b('0x2c')];_0x31c2d4['phone']=_0x3bf42b[_0xf63b('0x22')];_0x31c2d4[_0xf63b('0x2f')]=_0x4cf1b1[_0xf63b('0x22')];_0x31c2d4[_0xf63b('0x5a')]=_0x3bf42b[_0xf63b('0xb')];_0x31c2d4[_0xf63b('0x5b')]=+new Date();var _0x479424='';var _0x40adbe='';var _0x540f47=Object['keys'](_0x31c2d4);_0x540f47[_0xf63b('0x5c')]();for(var _0x5b024f=0x0;_0x5b024f<_0x540f47['length'];_0x5b024f++){if(_0x479424!=''){_0x479424+='&';}_0x479424+=_0x540f47[_0x5b024f]+'='+encodeURIComponent(_0x31c2d4[_0x540f47[_0x5b024f]]);_0x40adbe+=_0x31c2d4[_0x540f47[_0x5b024f]];}_0x40adbe+=_0x4cf1b1[_0xf63b('0x58')];_0x40adbe=_0x23a96d[_0xf63b('0x5d')](_0xf63b('0x5e'))[_0xf63b('0x28')](_0x40adbe)['digest'](_0xf63b('0x5f'));if(_0x479424!==''){_0x479424+='&';}_0x479424+=_0xf63b('0x60')+_0x40adbe;var _0x5e3751={'method':'GET','uri':_0x4cf1b1['baseUrl']+_0xf63b('0x61')+_0x479424,'json':!![]};return rp(_0x5e3751)[_0xf63b('0x16')](function(_0x1e326c){var _0x2d4304=Object['keys'](_0x1e326c);if(_0x1e326c[_0x2d4304[0x0]]['error']&&parseInt(_0x1e326c[_0x2d4304[0x0]][_0xf63b('0x19')])===0x0){var _0xbcba60={'messageId':_0x1e326c[_0x2d4304[0x0]][_0xf63b('0x62')]};if(!_0x4cf1b1['deliveryReport']){_0xbcba60[_0xf63b('0x38')]=!![];}return _0x49e8ba[_0xf63b('0x28')](_0xbcba60);}else{return logger['error'](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x63'),util[_0xf63b('0x2a')](_0x1e326c[_0xf63b('0x19')],{'showHidden':![],'depth':null}));}})[_0xf63b('0x18')](function(_0x23ac4b){return logger['error'](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x63'),util[_0xf63b('0x2a')](_0x23ac4b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf63b('0x39'),'csc',_0xf63b('0x64'));}break;case _0xf63b('0x65'):if(_0x4cf1b1['apiKey']){var _0x245321={'method':_0xf63b('0x32'),'uri':_0xf63b('0x66'),'headers':{'Authorization':_0x4cf1b1['apiKey']},'body':{'content':_0x3bf42b[_0xf63b('0xb')],'to':[_0x3bf42b['phone']],'from':_0x4cf1b1[_0xf63b('0x22')],'binary':![],'clientMessageId':_0xf63b('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x245321)[_0xf63b('0x16')](function(_0x396f46){if(!_0x396f46[_0xf63b('0x19')]){var _0x57d54d={'messageId':_0x396f46['messages'][0x0][_0xf63b('0x68')]};if(!_0x4cf1b1[_0xf63b('0x37')]){_0x57d54d[_0xf63b('0x38')]=!![];}return _0x49e8ba[_0xf63b('0x28')](_0x57d54d);}else{return logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),'clickatell',util[_0xf63b('0x2a')](_0x396f46['error'],{'showHidden':![],'depth':null}));}})[_0xf63b('0x18')](function(_0x3e2e75){return logger['error'](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x65'),util['inspect'](_0x3e2e75,{'showHidden':![],'depth':null}));});}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0xf63b('0x69'):if(_0x4cf1b1[_0xf63b('0x2c')]&&_0x4cf1b1[_0xf63b('0x2d')]){var _0xa03842=util[_0xf63b('0x41')](_0xf63b('0x42'),_0x4cf1b1[_0xf63b('0x2c')],_0x4cf1b1[_0xf63b('0x2d')]);var _0x126659={'method':_0xf63b('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4cf1b1[_0xf63b('0x6a')]+_0xf63b('0x6b'),'body':{'to':[_0x3bf42b[_0xf63b('0x22')]],'text':_0x3bf42b[_0xf63b('0xb')],'from':_0x4cf1b1[_0xf63b('0x22')],'applicationId':_0x4cf1b1[_0xf63b('0x6c')]},'headers':{'Authorization':util[_0xf63b('0x41')](_0xf63b('0x44'),new Buffer(_0xa03842)[_0xf63b('0x45')](_0xf63b('0x4f')))},'json':!![]};rp(_0x126659)[_0xf63b('0x16')](function(_0x13c01c){if(_0x13c01c['id']){var _0xdf93fa={'messageId':_0x13c01c['id']};return _0x49e8ba['update'](_0xdf93fa);}else{logger[_0xf63b('0x19')](_0xf63b('0x29'),_0xf63b('0x39'),'bandwidth',util['inspect'](_0x13c01c,{'showHidden':![],'depth':null}));}})[_0xf63b('0x18')](function(_0x5a2c4e){logger['error'](_0xf63b('0x29'),_0xf63b('0x39'),_0xf63b('0x69'),util[_0xf63b('0x2a')](_0x5a2c4e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf63b('0x39'),_0xf63b('0x69'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf63b('0x6d'):if(_0x4cf1b1[_0xf63b('0x58')]){var _0x4042b6={};var _0x5e3751={'method':_0xf63b('0x32'),'uri':_0xf63b('0x6e'),'headers':{'Authorization':_0xf63b('0x6f')+_0x4cf1b1[_0xf63b('0x58')],'Content-Type':_0xf63b('0x54')},'body':{'from':_0x4cf1b1[_0xf63b('0x22')],'to':_0x3bf42b[_0xf63b('0x22')],'text':_0x3bf42b[_0xf63b('0xb')]},'json':!![]};return rp(_0x5e3751)[_0xf63b('0x16')](function(_0x536441){if(_0x536441[_0xf63b('0x70')]==0xca){_0x4042b6['message']=_0x536441;var _0x323456={'method':'POST','uri':_0xf63b('0x71'),'headers':{'Authorization':_0xf63b('0x6f')+_0x4cf1b1['apiKey'],'Content-Type':_0xf63b('0x54')},'body':{'refid':_0x4042b6[_0xf63b('0x72')][_0xf63b('0x73')]},'json':!![]};return rp(_0x323456)[_0xf63b('0x16')](function(_0x36ee79){_0x4042b6[_0xf63b('0x74')]=_0x36ee79;var _0x23890d={'messageId':_0x4042b6[_0xf63b('0x72')][_0xf63b('0x73')],'read':!![]};return _0x49e8ba['update'](_0x23890d);});}else{return logger[_0xf63b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf63b('0x6d'),util[_0xf63b('0x2a')](_0x536441,{'showHidden':![],'depth':null}));}})[_0xf63b('0x18')](function(_0x9a44){return logger[_0xf63b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf63b('0x39'),_0xf63b('0x6d'),util[_0xf63b('0x2a')](_0x9a44,{'showHidden':![],'depth':null}));});}else{return logger[_0xf63b('0x19')](_0xf63b('0x29'),'afterCreate',_0xf63b('0x6d'),_0xf63b('0x75'));}break;}}})[_0xf63b('0x76')](function(){_0x4f6c6e();});}else{_0x4f6c6e();}}},'charset':_0xf63b('0x77'),'collate':_0xf63b('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 26f46ab..d2687d0 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 _0x4567=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','body','options','raw','stringify','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4567,0xe1));var _0x7456=function(_0x127f99,_0x32d8a1){_0x127f99=_0x127f99-0x0;var _0x1a35e8=_0x4567[_0x127f99];return _0x1a35e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7456('0x0'));var fs=require('fs');var Redis=require(_0x7456('0x1'));var db=require(_0x7456('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7456('0x3'));var config=require(_0x7456('0x4'));var jayson=require(_0x7456('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7456('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x7456('0x7'))(new Redis(config[_0x7456('0x6')]));require(_0x7456('0x8'))['register'](socket);function respondWithRpcPromise(_0x5cadf8,_0x33d58a,_0x40ead6){return new BPromise(function(_0x5ae34c,_0x3882ec){return client['request'](_0x5cadf8,_0x40ead6)[_0x7456('0x9')](function(_0x25862e){logger[_0x7456('0xa')]('SmsMessage,\x20%s,\x20%s',_0x33d58a,_0x7456('0xb'));logger[_0x7456('0xc')](_0x7456('0xd'),_0x33d58a,_0x7456('0xb'),JSON['stringify'](_0x25862e));if(_0x25862e[_0x7456('0xe')]){if(_0x25862e[_0x7456('0xe')]['code']===0x1f4){logger[_0x7456('0xe')](_0x7456('0xf'),_0x33d58a,_0x25862e['error'][_0x7456('0x10')]);return _0x3882ec(_0x25862e[_0x7456('0xe')]['message']);}logger[_0x7456('0xe')](_0x7456('0xf'),_0x33d58a,_0x25862e[_0x7456('0xe')][_0x7456('0x10')]);return _0x5ae34c(_0x25862e[_0x7456('0xe')][_0x7456('0x10')]);}else{logger[_0x7456('0xa')](_0x7456('0xf'),_0x33d58a,_0x7456('0xb'));_0x5ae34c(_0x25862e[_0x7456('0x11')][_0x7456('0x10')]);}})['catch'](function(_0x2f2c30){logger[_0x7456('0xe')](_0x7456('0xf'),_0x33d58a,_0x2f2c30);_0x3882ec(_0x2f2c30);});});}exports[_0x7456('0x12')]=function(_0xcf9490){var _0x440f8a=this;return new Promise(function(_0x112c6f,_0x17b62f){return db[_0x7456('0x13')]['create'](_0xcf9490[_0x7456('0x14')],{'raw':_0xcf9490['options']?_0xcf9490[_0x7456('0x15')][_0x7456('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x4f6eb9){logger[_0x7456('0xa')](_0x7456('0x12'),_0xcf9490);logger[_0x7456('0xc')]('CreateSmsMessage',_0xcf9490,JSON[_0x7456('0x17')](_0x4f6eb9));_0x112c6f(_0x4f6eb9);})[_0x7456('0x18')](function(_0x249fa5){logger[_0x7456('0xe')]('CreateSmsMessage',_0x249fa5[_0x7456('0x10')],_0xcf9490);_0x17b62f(_0x440f8a['error'](0x1f4,_0x249fa5[_0x7456('0x10')]));});});}; \ No newline at end of file +var _0xbac7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw'];(function(_0x5062da,_0x4400d2){var _0x46d327=function(_0x269596){while(--_0x269596){_0x5062da['push'](_0x5062da['shift']());}};_0x46d327(++_0x4400d2);}(_0xbac7,0xc6));var _0x7bac=function(_0x3d7b62,_0x2cfb1d){_0x3d7b62=_0x3d7b62-0x0;var _0x44bcaf=_0xbac7[_0x3d7b62];return _0x44bcaf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7bac('0x0'));var BPromise=require(_0x7bac('0x1'));var rs=require(_0x7bac('0x2'));var fs=require('fs');var Redis=require(_0x7bac('0x3'));var db=require(_0x7bac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bac('0x5'))(_0x7bac('0x6'));var config=require(_0x7bac('0x7'));var jayson=require(_0x7bac('0x8'));var client=jayson[_0x7bac('0x9')]['http']({'port':0x232a});config[_0x7bac('0xa')]=_['defaults'](config[_0x7bac('0xa')],{'host':_0x7bac('0xb'),'port':0x18eb});var socket=require(_0x7bac('0xc'))(new Redis(config[_0x7bac('0xa')]));require(_0x7bac('0xd'))[_0x7bac('0xe')](socket);function respondWithRpcPromise(_0x149665,_0x37e5f6,_0xfa05cb){return new BPromise(function(_0x4fa1d8,_0x1e2281){return client[_0x7bac('0xf')](_0x149665,_0xfa05cb)[_0x7bac('0x10')](function(_0x1aea70){logger[_0x7bac('0x11')](_0x7bac('0x12'),_0x37e5f6,_0x7bac('0x13'));logger[_0x7bac('0x14')](_0x7bac('0x15'),_0x37e5f6,_0x7bac('0x13'),JSON['stringify'](_0x1aea70));if(_0x1aea70[_0x7bac('0x16')]){if(_0x1aea70[_0x7bac('0x16')][_0x7bac('0x17')]===0x1f4){logger[_0x7bac('0x16')](_0x7bac('0x12'),_0x37e5f6,_0x1aea70[_0x7bac('0x16')]['message']);return _0x1e2281(_0x1aea70['error'][_0x7bac('0x18')]);}logger['error'](_0x7bac('0x12'),_0x37e5f6,_0x1aea70['error']['message']);return _0x4fa1d8(_0x1aea70[_0x7bac('0x16')][_0x7bac('0x18')]);}else{logger[_0x7bac('0x11')](_0x7bac('0x12'),_0x37e5f6,_0x7bac('0x13'));_0x4fa1d8(_0x1aea70[_0x7bac('0x19')][_0x7bac('0x18')]);}})[_0x7bac('0x1a')](function(_0xd24724){logger[_0x7bac('0x16')](_0x7bac('0x12'),_0x37e5f6,_0xd24724);_0x1e2281(_0xd24724);});});}exports[_0x7bac('0x1b')]=function(_0x10fe83){var _0x1aff15=this;return new Promise(function(_0x28d500,_0x71fd34){return db[_0x7bac('0x1c')][_0x7bac('0x1d')](_0x10fe83[_0x7bac('0x1e')],{'raw':_0x10fe83[_0x7bac('0x1f')]?_0x10fe83[_0x7bac('0x1f')][_0x7bac('0x20')]===undefined?!![]:![]:!![]})[_0x7bac('0x10')](function(_0xef674c){logger[_0x7bac('0x11')](_0x7bac('0x1b'),_0x10fe83);logger[_0x7bac('0x14')](_0x7bac('0x1b'),_0x10fe83,JSON['stringify'](_0xef674c));_0x28d500(_0xef674c);})[_0x7bac('0x1a')](function(_0x567094){logger[_0x7bac('0x16')](_0x7bac('0x1b'),_0x567094[_0x7bac('0x18')],_0x10fe83);_0x71fd34(_0x1aff15['error'](0x1f4,_0x567094['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 005256f..c0ba696 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 _0xe340=['smsMessage:','./smsMessage.events','remove','emit','removeListener','length'];(function(_0x1ff97e,_0x73b58b){var _0x1a947f=function(_0xbff7f9){while(--_0xbff7f9){_0x1ff97e['push'](_0x1ff97e['shift']());}};_0x1a947f(++_0x73b58b);}(_0xe340,0x6d));var _0x0e34=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe340[_0x543084];return _0x306a57;};'use strict';var SmsMessageEvents=require(_0x0e34('0x0'));var events=['save',_0x0e34('0x1'),'update'];function createListener(_0x2d5a44,_0x1cdc4b){return function(_0x58d2ce){_0x1cdc4b[_0x0e34('0x2')](_0x2d5a44,_0x58d2ce);};}function removeListener(_0x21ddc4,_0x4d5cc4){return function(){SmsMessageEvents[_0x0e34('0x3')](_0x21ddc4,_0x4d5cc4);};}exports['register']=function(_0x3dfd01){for(var _0xf490e5=0x0,_0x1eede1=events[_0x0e34('0x4')];_0xf490e5<_0x1eede1;_0xf490e5++){var _0x4fce99=events[_0xf490e5];var _0x3a8eb9=createListener(_0x0e34('0x5')+_0x4fce99,_0x3dfd01);SmsMessageEvents['on'](_0x4fce99,_0x3a8eb9);}}; \ No newline at end of file +var _0x5743=['update','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x597f01,_0x83ba4a){var _0xa2ec4b=function(_0x4285ae){while(--_0x4285ae){_0x597f01['push'](_0x597f01['shift']());}};_0xa2ec4b(++_0x83ba4a);}(_0x5743,0x1bd));var _0x3574=function(_0x33f140,_0x577e45){_0x33f140=_0x33f140-0x0;var _0x5bbc77=_0x5743[_0x33f140];return _0x5bbc77;};'use strict';var SmsMessageEvents=require(_0x3574('0x0'));var events=[_0x3574('0x1'),_0x3574('0x2'),_0x3574('0x3')];function createListener(_0x4380c6,_0x46ad21){return function(_0x25c801){_0x46ad21['emit'](_0x4380c6,_0x25c801);};}function removeListener(_0xe14553,_0x8e4dd9){return function(){SmsMessageEvents[_0x3574('0x4')](_0xe14553,_0x8e4dd9);};}exports[_0x3574('0x5')]=function(_0x3f8ed2){for(var _0x2ed296=0x0,_0x35f42f=events[_0x3574('0x6')];_0x2ed296<_0x35f42f;_0x2ed296++){var _0x25551b=events[_0x2ed296];var _0x18b923=createListener(_0x3574('0x7')+_0x25551b,_0x3f8ed2);SmsMessageEvents['on'](_0x25551b,_0x18b923);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5b284cf..d6c1080 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 _0xe7a8=['getTeams','getAgents','post','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xe7a8,0xcf));var _0x8e7a=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0xe7a8[_0x4acfd2];return _0x12afbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e7a('0x0'));var timeout=require(_0x8e7a('0x1'));var express=require(_0x8e7a('0x2'));var router=express[_0x8e7a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8e7a('0x4'));var interaction=require(_0x8e7a('0x5'));var config=require(_0x8e7a('0x6'));var controller=require(_0x8e7a('0x7'));router[_0x8e7a('0x8')]('/',auth[_0x8e7a('0x9')](),controller['index']);router[_0x8e7a('0x8')](_0x8e7a('0xa'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0xb')]);router[_0x8e7a('0x8')](_0x8e7a('0xc'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0xd')]);router[_0x8e7a('0x8')](_0x8e7a('0xe'),auth['isAuthenticated'](),controller[_0x8e7a('0xf')]);router[_0x8e7a('0x8')](_0x8e7a('0x10'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x11')]);router[_0x8e7a('0x8')]('/:id/users',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x12')]);router[_0x8e7a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8e7a('0x13')]('/:id/teams',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x14')]);router[_0x8e7a('0x13')](_0x8e7a('0x15'),auth[_0x8e7a('0x9')](),controller['addAgents']);router[_0x8e7a('0x16')]('/:id',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x17')]);router[_0x8e7a('0x18')](_0x8e7a('0xc'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x19')]);router[_0x8e7a('0x18')]('/:id/teams',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x1a')]);router[_0x8e7a('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x8e7a('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe524=['/:id/users','addAgents','update','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','addTeams'];(function(_0x3b04c5,_0x5c4d3a){var _0xa0dc3a=function(_0x11051b){while(--_0x11051b){_0x3b04c5['push'](_0x3b04c5['shift']());}};_0xa0dc3a(++_0x5c4d3a);}(_0xe524,0x8d));var _0x4e52=function(_0x4aca44,_0x5aa3d5){_0x4aca44=_0x4aca44-0x0;var _0x55e521=_0xe524[_0x4aca44];return _0x55e521;};'use strict';var multer=require(_0x4e52('0x0'));var util=require(_0x4e52('0x1'));var path=require(_0x4e52('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e52('0x3'));var router=express[_0x4e52('0x4')]();var fs_extra=require(_0x4e52('0x5'));var auth=require(_0x4e52('0x6'));var interaction=require(_0x4e52('0x7'));var config=require(_0x4e52('0x8'));var controller=require(_0x4e52('0x9'));router[_0x4e52('0xa')]('/',auth[_0x4e52('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4e52('0xc')]);router[_0x4e52('0xa')](_0x4e52('0xd'),auth[_0x4e52('0xb')](),controller[_0x4e52('0xe')]);router['get'](_0x4e52('0xf'),auth[_0x4e52('0xb')](),controller['getMembers']);router[_0x4e52('0xa')](_0x4e52('0x10'),auth['isAuthenticated'](),controller[_0x4e52('0x11')]);router['get']('/:id/users',auth[_0x4e52('0xb')](),controller['getAgents']);router[_0x4e52('0x12')]('/',auth[_0x4e52('0xb')](),controller[_0x4e52('0x13')]);router[_0x4e52('0x12')]('/:id/teams',auth[_0x4e52('0xb')](),controller[_0x4e52('0x14')]);router[_0x4e52('0x12')](_0x4e52('0x15'),auth[_0x4e52('0xb')](),controller[_0x4e52('0x16')]);router['put'](_0x4e52('0xd'),auth[_0x4e52('0xb')](),controller[_0x4e52('0x17')]);router[_0x4e52('0x18')](_0x4e52('0xd'),auth[_0x4e52('0xb')](),controller['destroy']);router[_0x4e52('0x18')](_0x4e52('0x10'),auth[_0x4e52('0xb')](),controller['removeTeams']);router[_0x4e52('0x18')](_0x4e52('0x15'),auth[_0x4e52('0xb')](),controller[_0x4e52('0x19')]);module[_0x4e52('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index fb53736..4bbda9b 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 _0xac11=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x5dff45,_0x10cae1){var _0x33a904=function(_0x49bc33){while(--_0x49bc33){_0x5dff45['push'](_0x5dff45['shift']());}};_0x33a904(++_0x10cae1);}(_0xac11,0x75));var _0x1ac1=function(_0x2c31c2,_0x5cd6c4){_0x2c31c2=_0x2c31c2-0x0;var _0x46fd7d=_0xac11[_0x2c31c2];return _0x46fd7d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ac1('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ac1('0x0')]},'timeout':{'type':Sequelize[_0x1ac1('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ac1('0x2')](_0x1ac1('0x3'),_0x1ac1('0x4'),_0x1ac1('0x5'))}}; \ No newline at end of file +var _0x4b36=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x104c7f,_0x23fbcc){var _0x55856b=function(_0x46b543){while(--_0x46b543){_0x104c7f['push'](_0x104c7f['shift']());}};_0x55856b(++_0x23fbcc);}(_0x4b36,0x154));var _0x64b3=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x4b36[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x64b3('0x0'));module[_0x64b3('0x1')]={'name':{'type':Sequelize[_0x64b3('0x2')],'unique':_0x64b3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x64b3('0x2')]},'timeout':{'type':Sequelize[_0x64b3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x64b3('0x5')](_0x64b3('0x6'),_0x64b3('0x7'),_0x64b3('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3171c5f..b1ae292 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 _0xa567=['zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','end','status','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','get','SmsQueues','sendStatus','name','send','index','map','SmsQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','describe','findOne','UserSmsQueue','order','SmsQueueId','filter','User','UserId','updatedAt','createdAt','rows','format','%s/%s','smsPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','spread','isArray','userSmsQueue:remove','getAgents','rawAttributes','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa567,0x1ae));var _0x7a56=function(_0x4df28b,_0x362f3f){_0x4df28b=_0x4df28b-0x0;var _0x1ffba4=_0xa567[_0x4df28b];return _0x1ffba4;};'use strict';var emlformat=require(_0x7a56('0x0'));var rimraf=require(_0x7a56('0x1'));var zipdir=require(_0x7a56('0x2'));var jsonpatch=require(_0x7a56('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a56('0x4'));var Mustache=require('mustache');var util=require(_0x7a56('0x5'));var path=require(_0x7a56('0x6'));var sox=require(_0x7a56('0x7'));var csv=require(_0x7a56('0x8'));var ejs=require(_0x7a56('0x9'));var fs=require('fs');var fs_extra=require(_0x7a56('0xa'));var _=require(_0x7a56('0xb'));var squel=require(_0x7a56('0xc'));var crypto=require(_0x7a56('0xd'));var jsforce=require(_0x7a56('0xe'));var deskjs=require(_0x7a56('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7a56('0x10'));var Papa=require(_0x7a56('0x11'));var Redis=require(_0x7a56('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a56('0x13'));var logger=require(_0x7a56('0x14'))(_0x7a56('0x15'));var utils=require(_0x7a56('0x16'));var config=require(_0x7a56('0x17'));var licenseUtil=require(_0x7a56('0x18'));var db=require(_0x7a56('0x19'))['db'];config[_0x7a56('0x1a')]=_['defaults'](config[_0x7a56('0x1a')],{'host':_0x7a56('0x1b'),'port':0x18eb});var socket=require(_0x7a56('0x1c'))(new Redis(config[_0x7a56('0x1a')]));require(_0x7a56('0x1d'))[_0x7a56('0x1e')](socket);function respondWithStatusCode(_0x1e992d,_0x2e202c){_0x2e202c=_0x2e202c||0xcc;return function(_0x5a537f){if(_0x5a537f){return _0x1e992d['sendStatus'](_0x2e202c);}return _0x1e992d['status'](_0x2e202c)[_0x7a56('0x1f')]();};}function respondWithResult(_0x32a451,_0x168fa3){_0x168fa3=_0x168fa3||0xc8;return function(_0x1fc11b){if(_0x1fc11b){return _0x32a451[_0x7a56('0x20')](_0x168fa3)['json'](_0x1fc11b);}};}function respondWithFilteredResult(_0x245ebc,_0x57961c){return function(_0x23fa3a){if(_0x23fa3a){var _0x306635=typeof _0x57961c[_0x7a56('0x21')]==='undefined'&&typeof _0x57961c[_0x7a56('0x22')]===_0x7a56('0x23');var _0x399621=_0x23fa3a[_0x7a56('0x24')];var _0x5f359b=_0x306635?0x0:_0x57961c['offset'];var _0x5eef3b=_0x306635?_0x23fa3a[_0x7a56('0x24')]:_0x57961c[_0x7a56('0x21')]+_0x57961c[_0x7a56('0x22')];var _0x47bdbf;if(_0x5eef3b>=_0x399621){_0x5eef3b=_0x399621;_0x47bdbf=0xc8;}else{_0x47bdbf=0xce;}_0x245ebc[_0x7a56('0x20')](_0x47bdbf);return _0x245ebc['set']('Content-Range',_0x5f359b+'-'+_0x5eef3b+'/'+_0x399621)[_0x7a56('0x25')](_0x23fa3a);}return null;};}function patchUpdates(_0xe806d2){return function(_0x3eec8e){try{jsonpatch[_0x7a56('0x26')](_0x3eec8e,_0xe806d2,!![]);}catch(_0x2701b2){return BPromise[_0x7a56('0x27')](_0x2701b2);}return _0x3eec8e[_0x7a56('0x28')]();};}function saveUpdates(_0x1e7f96,_0xfc9b88){return function(_0x3e09ae){if(_0x3e09ae){return _0x3e09ae[_0x7a56('0x29')](_0x1e7f96)[_0x7a56('0x2a')](function(_0x2004ef){return _0x2004ef;});}return null;};}function removeEntity(_0x4c810f,_0x585f71){return function(_0x2b3e6e){if(_0x2b3e6e){return _0x2b3e6e[_0x7a56('0x2b')]()[_0x7a56('0x2a')](function(){var _0x46ee67=_0x2b3e6e[_0x7a56('0x2c')]({'plain':!![]});var _0x207c56=_0x7a56('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x207c56,'resourceId':_0x46ee67['id']}})[_0x7a56('0x2a')](function(){return _0x2b3e6e;});})['then'](function(){_0x4c810f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x144596,_0x14fc71){return function(_0x221b6f){if(!_0x221b6f){_0x144596[_0x7a56('0x2e')](0x194);}return _0x221b6f;};}function handleError(_0x3cbc47,_0x5e4942){_0x5e4942=_0x5e4942||0x1f4;return function(_0x44ea1a){logger['error'](_0x44ea1a['stack']);if(_0x44ea1a[_0x7a56('0x2f')]){delete _0x44ea1a[_0x7a56('0x2f')];}_0x3cbc47[_0x7a56('0x20')](_0x5e4942)[_0x7a56('0x30')](_0x44ea1a);};}exports[_0x7a56('0x31')]=function(_0x1aa94f,_0x43b1ad){var _0x1113b9={},_0x5906a2={},_0x2f8bfc={'count':0x0,'rows':[]};var _0x477a2b=_[_0x7a56('0x32')](db[_0x7a56('0x33')]['rawAttributes'],function(_0x49ad23){return{'name':_0x49ad23['fieldName'],'type':_0x49ad23['type'][_0x7a56('0x34')]};});_0x5906a2[_0x7a56('0x35')]=_['map'](_0x477a2b,_0x7a56('0x2f'));_0x5906a2[_0x7a56('0x36')]=_[_0x7a56('0x37')](_0x1aa94f[_0x7a56('0x36')]);_0x5906a2[_0x7a56('0x38')]=_[_0x7a56('0x39')](_0x5906a2[_0x7a56('0x35')],_0x5906a2[_0x7a56('0x36')]);_0x1113b9[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x5906a2['model'],qs[_0x7a56('0x3b')](_0x1aa94f['query'][_0x7a56('0x3b')]));_0x1113b9[_0x7a56('0x3a')]=_0x1113b9[_0x7a56('0x3a')][_0x7a56('0x3c')]?_0x1113b9['attributes']:_0x5906a2[_0x7a56('0x35')];if(!_0x1aa94f['query'][_0x7a56('0x3d')](_0x7a56('0x3e'))){_0x1113b9[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x1aa94f[_0x7a56('0x36')]['limit']);_0x1113b9[_0x7a56('0x21')]=qs[_0x7a56('0x21')](_0x1aa94f['query'][_0x7a56('0x21')]);}_0x1113b9['order']=qs[_0x7a56('0x3f')](_0x1aa94f[_0x7a56('0x36')][_0x7a56('0x3f')]);_0x1113b9[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_[_0x7a56('0x41')](_0x1aa94f[_0x7a56('0x36')],_0x5906a2[_0x7a56('0x38')]),_0x477a2b);if(_0x1aa94f[_0x7a56('0x36')]['filter']){_0x1113b9[_0x7a56('0x40')]=_[_0x7a56('0x42')](_0x1113b9[_0x7a56('0x40')],{'$or':_[_0x7a56('0x32')](_0x477a2b,function(_0x2681e8){if(_0x2681e8['type']!==_0x7a56('0x43')){var _0x13f0a2={};_0x13f0a2[_0x2681e8[_0x7a56('0x2f')]]={'$like':'%'+_0x1aa94f[_0x7a56('0x36')]['filter']+'%'};return _0x13f0a2;}})});}_0x1113b9=_[_0x7a56('0x42')]({},_0x1113b9,_0x1aa94f[_0x7a56('0x44')]);var _0x42dbf2={'where':_0x1113b9[_0x7a56('0x40')]};return db[_0x7a56('0x33')][_0x7a56('0x24')](_0x42dbf2)[_0x7a56('0x2a')](function(_0x2bd289){_0x2f8bfc[_0x7a56('0x24')]=_0x2bd289;if(_0x1aa94f[_0x7a56('0x36')][_0x7a56('0x45')]){_0x1113b9[_0x7a56('0x46')]=[{'all':!![]}];}return db[_0x7a56('0x33')][_0x7a56('0x47')](_0x1113b9);})['then'](function(_0x5aac49){_0x2f8bfc['rows']=_0x5aac49;return _0x2f8bfc;})[_0x7a56('0x2a')](respondWithFilteredResult(_0x43b1ad,_0x1113b9))[_0x7a56('0x48')](handleError(_0x43b1ad,null));};exports['show']=function(_0x581134,_0x596d78){var _0x272585={'raw':!![],'where':{'id':_0x581134[_0x7a56('0x49')]['id']}},_0x4c28aa={};_0x4c28aa[_0x7a56('0x35')]=_[_0x7a56('0x37')](db['SmsQueue']['rawAttributes']);_0x4c28aa['query']=_[_0x7a56('0x37')](_0x581134['query']);_0x4c28aa['filters']=_['intersection'](_0x4c28aa[_0x7a56('0x35')],_0x4c28aa[_0x7a56('0x36')]);_0x272585[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x4c28aa[_0x7a56('0x35')],qs[_0x7a56('0x3b')](_0x581134[_0x7a56('0x36')]['fields']));_0x272585[_0x7a56('0x3a')]=_0x272585[_0x7a56('0x3a')]['length']?_0x272585['attributes']:_0x4c28aa['model'];if(_0x581134['query'][_0x7a56('0x45')]){_0x272585[_0x7a56('0x46')]=[{'all':!![]}];}_0x272585=_[_0x7a56('0x42')]({},_0x272585,_0x581134[_0x7a56('0x44')]);return db[_0x7a56('0x33')][_0x7a56('0x4a')](_0x272585)[_0x7a56('0x2a')](handleEntityNotFound(_0x596d78,null))[_0x7a56('0x2a')](respondWithResult(_0x596d78,null))[_0x7a56('0x48')](handleError(_0x596d78,null));};exports[_0x7a56('0x4b')]=function(_0x4724d4,_0x469666){return db['SmsQueue'][_0x7a56('0x4b')](_0x4724d4['body'],{})[_0x7a56('0x2a')](function(_0x1336c4){var _0x572b26=_0x4724d4[_0x7a56('0x4c')][_0x7a56('0x2c')]({'plain':!![]});if(!_0x572b26)throw new Error(_0x7a56('0x4d'));if(_0x572b26[_0x7a56('0x4e')]===_0x7a56('0x4c')){var _0x214e4d=_0x1336c4[_0x7a56('0x2c')]({'plain':!![]});var _0x494016='SmsQueues';return db[_0x7a56('0x4f')][_0x7a56('0x4a')]({'where':{'name':_0x494016,'userProfileId':_0x572b26[_0x7a56('0x50')]},'raw':!![]})[_0x7a56('0x2a')](function(_0x324f0f){if(_0x324f0f&&_0x324f0f[_0x7a56('0x51')]===0x0){return db[_0x7a56('0x52')]['create']({'name':_0x214e4d['name'],'resourceId':_0x214e4d['id'],'type':_0x324f0f['name'],'sectionId':_0x324f0f['id']},{})[_0x7a56('0x2a')](function(){return _0x1336c4;});}else{return _0x1336c4;}})['catch'](function(_0x225918){logger[_0x7a56('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x225918);throw _0x225918;});}return _0x1336c4;})[_0x7a56('0x2a')](respondWithResult(_0x469666,0xc9))[_0x7a56('0x48')](handleError(_0x469666,null));};exports[_0x7a56('0x29')]=function(_0x391b6d,_0x2938ad){if(_0x391b6d[_0x7a56('0x54')]['id']){delete _0x391b6d[_0x7a56('0x54')]['id'];}return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x391b6d['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x2938ad,null))[_0x7a56('0x2a')](saveUpdates(_0x391b6d[_0x7a56('0x54')],null))['then'](respondWithResult(_0x2938ad,null))[_0x7a56('0x48')](handleError(_0x2938ad,null));};exports[_0x7a56('0x2b')]=function(_0x2302e3,_0x5a2a08){return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x2302e3['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x5a2a08,null))['then'](removeEntity(_0x5a2a08,null))[_0x7a56('0x48')](handleError(_0x5a2a08,null));};exports[_0x7a56('0x55')]=function(_0x427e5d,_0x307d3d){return db[_0x7a56('0x33')][_0x7a56('0x55')]()['then'](respondWithResult(_0x307d3d,null))[_0x7a56('0x48')](handleError(_0x307d3d,null));};exports['getMembers']=function(_0x465ba8,_0x46fcb4,_0x32bc9a){var _0x261949={'raw':!![],'where':{}},_0x200708={},_0x33ba8f;return db[_0x7a56('0x33')][_0x7a56('0x56')]({'where':{'id':_0x465ba8[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x46fcb4,null))[_0x7a56('0x2a')](function(_0x6b1511){if(_0x6b1511){_0x33ba8f=_0x6b1511[_0x7a56('0x2c')]({'plain':!![]});_0x200708[_0x7a56('0x35')]=_[_0x7a56('0x37')](db[_0x7a56('0x57')]['rawAttributes']);_0x200708[_0x7a56('0x36')]=_[_0x7a56('0x37')](_0x465ba8[_0x7a56('0x36')]);_0x200708[_0x7a56('0x38')]=_['intersection'](_0x200708[_0x7a56('0x35')],_0x200708[_0x7a56('0x36')]);_0x261949[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x200708[_0x7a56('0x35')],qs[_0x7a56('0x3b')](_0x465ba8[_0x7a56('0x36')]['fields']));_0x261949[_0x7a56('0x3a')]=_0x261949['attributes'][_0x7a56('0x3c')]?_0x261949['attributes']:_0x200708['model'];if(!_0x465ba8[_0x7a56('0x36')][_0x7a56('0x3d')](_0x7a56('0x3e'))){_0x261949[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x465ba8[_0x7a56('0x36')][_0x7a56('0x22')]);_0x261949[_0x7a56('0x21')]=qs['offset'](_0x465ba8[_0x7a56('0x36')]['offset']);}_0x261949[_0x7a56('0x58')]=qs[_0x7a56('0x3f')](_0x465ba8[_0x7a56('0x36')][_0x7a56('0x3f')]);_0x261949[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_[_0x7a56('0x41')](_0x465ba8[_0x7a56('0x36')],_0x200708['filters']));_0x261949[_0x7a56('0x40')][_0x7a56('0x59')]=_0x6b1511['id'];if(_0x465ba8[_0x7a56('0x36')][_0x7a56('0x5a')]){_0x261949[_0x7a56('0x40')]=_[_0x7a56('0x42')](_0x261949[_0x7a56('0x40')],{'$or':_[_0x7a56('0x32')](_0x261949[_0x7a56('0x3a')],function(_0x102417){var _0x24475d={};_0x24475d[_0x102417]={'$like':'%'+_0x465ba8[_0x7a56('0x36')][_0x7a56('0x5a')]+'%'};return _0x24475d;})});}_0x261949=_[_0x7a56('0x42')]({},_0x261949,_0x465ba8['options']);return db[_0x7a56('0x57')]['findAll'](_0x261949);}})['then'](function(_0x56609c){if(_0x56609c){return db[_0x7a56('0x5b')]['findAndCountAll']({'where':{'id':_[_0x7a56('0x32')](_0x56609c,_0x7a56('0x5c')),'role':'agent'},'attributes':['id',_0x7a56('0x2f'),'smsPause',_0x7a56('0x5d'),_0x7a56('0x5e')]});}})['then'](function(_0x4fbfd8){if(_0x4fbfd8){return{'count':_0x4fbfd8[_0x7a56('0x24')],'rows':_['map'](_0x4fbfd8[_0x7a56('0x5f')],function(_0x47c9dc){return{'membername':_0x47c9dc['name'],'UserId':_0x47c9dc['id'],'queue_name':_0x33ba8f[_0x7a56('0x2f')],'SmsQueueId':_0x33ba8f['id'],'interface':util[_0x7a56('0x60')](_0x7a56('0x61'),'SIP',_0x47c9dc[_0x7a56('0x2f')]),'penalty':0x0,'paused':_0x47c9dc[_0x7a56('0x62')],'createdAt':_0x47c9dc[_0x7a56('0x5e')],'updatedAt':_0x47c9dc[_0x7a56('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x46fcb4,_0x261949))['catch'](handleError(_0x46fcb4,null));};exports['getTeams']=function(_0x1502a8,_0x4dcd1c,_0x3a31fa){var _0x29a87f={};var _0x45cf3f={};var _0x4023f5;var _0x3cf54d;return db[_0x7a56('0x33')][_0x7a56('0x56')]({'where':{'id':_0x1502a8[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x4dcd1c,null))[_0x7a56('0x2a')](function(_0x54dda2){if(_0x54dda2){_0x4023f5=_0x54dda2;_0x45cf3f['model']=_[_0x7a56('0x37')](db[_0x7a56('0x63')]['rawAttributes']);_0x45cf3f[_0x7a56('0x36')]=_[_0x7a56('0x37')](_0x1502a8[_0x7a56('0x36')]);_0x45cf3f[_0x7a56('0x38')]=_['intersection'](_0x45cf3f[_0x7a56('0x35')],_0x45cf3f[_0x7a56('0x36')]);_0x29a87f[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x45cf3f['model'],qs['fields'](_0x1502a8[_0x7a56('0x36')]['fields']));_0x29a87f[_0x7a56('0x3a')]=_0x29a87f[_0x7a56('0x3a')]['length']?_0x29a87f[_0x7a56('0x3a')]:_0x45cf3f['model'];_0x29a87f[_0x7a56('0x58')]=qs[_0x7a56('0x3f')](_0x1502a8[_0x7a56('0x36')]['sort']);_0x29a87f[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_['pick'](_0x1502a8[_0x7a56('0x36')],_0x45cf3f[_0x7a56('0x38')]));if(_0x1502a8[_0x7a56('0x36')][_0x7a56('0x5a')]){_0x29a87f[_0x7a56('0x40')]=_[_0x7a56('0x42')](_0x29a87f[_0x7a56('0x40')],{'$or':_[_0x7a56('0x32')](_0x29a87f[_0x7a56('0x3a')],function(_0x31c772){var _0x373577={};_0x373577[_0x31c772]={'$like':'%'+_0x1502a8[_0x7a56('0x36')][_0x7a56('0x5a')]+'%'};return _0x373577;})});}_0x29a87f=_[_0x7a56('0x42')]({},_0x29a87f,_0x1502a8['options']);return _0x4023f5[_0x7a56('0x64')](_0x29a87f);}})['then'](function(_0x1b3dde){if(_0x1b3dde){_0x3cf54d=_0x1b3dde['length'];if(!_0x1502a8[_0x7a56('0x36')][_0x7a56('0x3d')](_0x7a56('0x3e'))){_0x29a87f[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x1502a8[_0x7a56('0x36')][_0x7a56('0x22')]);_0x29a87f[_0x7a56('0x21')]=qs[_0x7a56('0x21')](_0x1502a8[_0x7a56('0x36')][_0x7a56('0x21')]);}return _0x4023f5[_0x7a56('0x64')](_0x29a87f);}})[_0x7a56('0x2a')](function(_0x29cf11){if(_0x29cf11){return _0x29cf11?{'count':_0x3cf54d,'rows':_0x29cf11}:null;}})[_0x7a56('0x2a')](respondWithResult(_0x4dcd1c,null))[_0x7a56('0x48')](handleError(_0x4dcd1c,null));};exports[_0x7a56('0x65')]=function(_0x4f92b0,_0x3eaf36,_0x238d0f){var _0x1a8e37=_0x4f92b0[_0x7a56('0x54')][_0x7a56('0x66')];return db[_0x7a56('0x63')][_0x7a56('0x47')]({'where':{'id':_0x1a8e37},'attributes':['id'],'include':[{'model':db[_0x7a56('0x5b')],'as':_0x7a56('0x67'),'attributes':['id',_0x7a56('0x2f'),_0x7a56('0x68'),_0x7a56('0x69'),_0x7a56('0x6a')],'raw':!![]}]})[_0x7a56('0x2a')](function(_0x79c0cd){if(_0x79c0cd){var _0x45d3d2=_[_0x7a56('0x6b')](_0x79c0cd,function(_0xd44345){var _0x428205=_0xd44345[_0x7a56('0x2c')]({'plain':!![]});return _0x428205[_0x7a56('0x67')];});return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x4f92b0[_0x7a56('0x49')]['id']}})['then'](function(_0x1e946d){return db[_0x7a56('0x6c')][_0x7a56('0x6d')](function(_0x235f3f){return _0x1e946d[_0x7a56('0x65')](_0x1a8e37,{'transaction':_0x235f3f})[_0x7a56('0x2a')](function(){return BPromise[_0x7a56('0x6e')](_0x45d3d2,function(_0xfe1a25){return db[_0x7a56('0x57')]['findOrCreate']({'where':{'UserId':_0xfe1a25['id'],'SmsQueueId':_0x4f92b0[_0x7a56('0x49')]['id']},'transaction':_0x235f3f});});})['then'](function(){_0x45d3d2['forEach'](function(_0x309084){socket['emit'](_0x7a56('0x6f'),{'UserId':_0x309084['id'],'SmsQueueId':_0x1e946d['id']});});});});});}})['then'](respondWithStatusCode(_0x3eaf36,null))[_0x7a56('0x48')](handleError(_0x3eaf36,null));};exports[_0x7a56('0x70')]=function(_0x46e9b0,_0x492e94,_0x3077ee){return db['Team']['findAll']({'where':{'id':_0x46e9b0[_0x7a56('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a56('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7a56('0x2a')](handleEntityNotFound(_0x492e94,null))['then'](function(_0x1bc49b){var _0x1629a9=_[_0x7a56('0x32')](_0x1bc49b,'id');var _0x3c893d=[];var _0x2ff845=[];var _0x2bf075=squel[_0x7a56('0x71')]();_0x2bf075[_0x7a56('0x72')](_0x7a56('0x73'))[_0x7a56('0x74')](_0x7a56('0x75'),'tq')[_0x7a56('0x76')](_0x7a56('0x77'),'ut',_0x7a56('0x78'))[_0x7a56('0x40')](_0x7a56('0x79'),_0x46e9b0[_0x7a56('0x49')]['id']);for(var _0xb06e8d=0x0;_0xb06e8d<_0x1bc49b[_0x7a56('0x3c')];_0xb06e8d+=0x1){let _0x37ab60=_0x1bc49b[_0xb06e8d];for(var _0x11c49b=0x0;_0x11c49b<_0x37ab60['Agents'][_0x7a56('0x3c')];_0x11c49b+=0x1){let _0x226238=_0x37ab60[_0x7a56('0x67')][_0x11c49b];var _0x79bf1c=_0x2bf075[_0x7a56('0x7a')]();_0x79bf1c[_0x7a56('0x40')](_0x7a56('0x7b'),_0x226238['id']);_0x2ff845[_0x7a56('0x7c')](db['sequelize'][_0x7a56('0x36')](_0x79bf1c[_0x7a56('0x7d')](),{'type':db[_0x7a56('0x6c')][_0x7a56('0x7e')][_0x7a56('0x7f')]})['then'](function(_0x282671){if(_0x282671[_0x7a56('0x3c')]===0x1){return _0x226238['id'];}else{var _0x49c7a9=_[_0x7a56('0x80')](_[_0x7a56('0x32')](_0x282671,_0x7a56('0x81')),function(_0x5a9f69){return _[_0x7a56('0x82')](_0x1629a9,_0x5a9f69);});if(_0x49c7a9){return _0x226238['id'];}}}));}}return BPromise[_0x7a56('0x83')](_0x2ff845)[_0x7a56('0x2a')](function(_0x5064f3){_0x3c893d=_(_0x3c893d)[_0x7a56('0x84')](_0x5064f3)[_0x7a56('0x85')]()[_0x7a56('0x86')]();return db['SmsQueue'][_0x7a56('0x4a')]({'where':{'id':_0x46e9b0[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](function(_0x5c660d){return db[_0x7a56('0x6c')][_0x7a56('0x6d')](function(_0x184d8a){return _0x5c660d['removeTeams'](_0x46e9b0[_0x7a56('0x36')][_0x7a56('0x66')],{'transaction':_0x184d8a})['then'](function(){if(!_[_0x7a56('0x87')](_0x3c893d)){return _0x5c660d[_0x7a56('0x88')](_0x3c893d,{'transaction':_0x184d8a});}})[_0x7a56('0x2a')](function(){_0x3c893d['forEach'](function(_0x2535e6){socket[_0x7a56('0x89')]('userSmsQueue:remove',{'UserId':_0x2535e6,'SmsQueueId':_0x5c660d['id']});});});});});});})[_0x7a56('0x2a')](respondWithStatusCode(_0x492e94,null))[_0x7a56('0x48')](handleError(_0x492e94,null));};exports[_0x7a56('0x8a')]=function(_0x3e1ecb,_0x2a6ae8,_0x10ab93){return db['SmsQueue'][_0x7a56('0x4a')]({'where':{'id':_0x3e1ecb['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x2a6ae8,null))['then'](function(_0x546d50){if(_0x546d50){return _0x546d50[_0x7a56('0x8a')](_0x3e1ecb[_0x7a56('0x54')]['ids'],_['omit'](_0x3e1ecb[_0x7a56('0x54')],[_0x7a56('0x66'),'id'])||{})[_0x7a56('0x8b')](function(_0x3da642){for(var _0x27cb5d=0x0;_0x27cb5d<_0x3e1ecb[_0x7a56('0x54')][_0x7a56('0x66')][_0x7a56('0x3c')];_0x27cb5d+=0x1){socket[_0x7a56('0x89')]('userSmsQueue:save',{'UserId':Number(_0x3e1ecb[_0x7a56('0x54')][_0x7a56('0x66')][_0x27cb5d]),'SmsQueueId':Number(_0x3e1ecb['params']['id'])});}return _0x3da642;});}})[_0x7a56('0x2a')](respondWithResult(_0x2a6ae8,null))[_0x7a56('0x48')](handleError(_0x2a6ae8,null));};exports[_0x7a56('0x88')]=function(_0x4ace8f,_0x22e66d,_0x48c21a){return db['SmsQueue'][_0x7a56('0x4a')]({'where':{'id':_0x4ace8f['params']['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x22e66d,null))[_0x7a56('0x2a')](function(_0x5ba7a7){if(_0x5ba7a7){return _0x5ba7a7[_0x7a56('0x88')](_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')])['then'](function(){if(_[_0x7a56('0x8c')](_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')])){for(var _0x2883cf=0x0;_0x2883cf<_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')]['length'];_0x2883cf+=0x1){socket['emit'](_0x7a56('0x8d'),{'UserId':Number(_0x4ace8f[_0x7a56('0x36')][_0x7a56('0x66')][_0x2883cf]),'SmsQueueId':Number(_0x4ace8f[_0x7a56('0x49')]['id'])});}}else{socket[_0x7a56('0x89')](_0x7a56('0x8d'),{'UserId':Number(_0x4ace8f[_0x7a56('0x36')]['ids']),'SmsQueueId':Number(_0x4ace8f[_0x7a56('0x49')]['id'])});}});}})[_0x7a56('0x2a')](respondWithStatusCode(_0x22e66d,null))[_0x7a56('0x48')](handleError(_0x22e66d,null));};exports[_0x7a56('0x8e')]=function(_0x2402b8,_0x4544e0,_0x1ea78b){var _0x5dfa85={};var _0x52c942={};var _0x10dced;var _0x5e8c6f;return db[_0x7a56('0x33')][_0x7a56('0x56')]({'where':{'id':_0x2402b8[_0x7a56('0x49')]['id']}})[_0x7a56('0x2a')](handleEntityNotFound(_0x4544e0,null))[_0x7a56('0x2a')](function(_0x32f4f6){if(_0x32f4f6){_0x10dced=_0x32f4f6;_0x52c942[_0x7a56('0x35')]=_[_0x7a56('0x37')](db[_0x7a56('0x5b')][_0x7a56('0x8f')]);_0x52c942[_0x7a56('0x36')]=_['keys'](_0x2402b8[_0x7a56('0x36')]);_0x52c942['filters']=_[_0x7a56('0x39')](_0x52c942['model'],_0x52c942['query']);_0x5dfa85[_0x7a56('0x3a')]=_[_0x7a56('0x39')](_0x52c942[_0x7a56('0x35')],qs['fields'](_0x2402b8['query'][_0x7a56('0x3b')]));_0x5dfa85[_0x7a56('0x3a')]=_0x5dfa85['attributes'][_0x7a56('0x3c')]?_0x5dfa85[_0x7a56('0x3a')]:_0x52c942[_0x7a56('0x35')];_0x5dfa85['order']=qs[_0x7a56('0x3f')](_0x2402b8[_0x7a56('0x36')][_0x7a56('0x3f')]);_0x5dfa85[_0x7a56('0x40')]=qs[_0x7a56('0x38')](_[_0x7a56('0x41')](_0x2402b8['query'],_0x52c942['filters']));if(_0x2402b8[_0x7a56('0x36')]['filter']){_0x5dfa85[_0x7a56('0x40')]=_['merge'](_0x5dfa85[_0x7a56('0x40')],{'$or':_['map'](_0x5dfa85[_0x7a56('0x3a')],function(_0xbbed1c){var _0x464352={};_0x464352[_0xbbed1c]={'$like':'%'+_0x2402b8[_0x7a56('0x36')][_0x7a56('0x5a')]+'%'};return _0x464352;})});}_0x5dfa85=_[_0x7a56('0x42')]({},_0x5dfa85,_0x2402b8[_0x7a56('0x44')]);return _0x10dced['getAgents'](_0x5dfa85);}})['then'](function(_0x3c50e2){if(_0x3c50e2){_0x5e8c6f=_0x3c50e2[_0x7a56('0x3c')];if(!_0x2402b8[_0x7a56('0x36')][_0x7a56('0x3d')]('nolimit')){_0x5dfa85[_0x7a56('0x22')]=qs[_0x7a56('0x22')](_0x2402b8['query'][_0x7a56('0x22')]);_0x5dfa85[_0x7a56('0x21')]=qs[_0x7a56('0x21')](_0x2402b8[_0x7a56('0x36')]['offset']);}return _0x10dced['getAgents'](_0x5dfa85);}})[_0x7a56('0x2a')](function(_0x2431b2){if(_0x2431b2){return _0x2431b2?{'count':_0x5e8c6f,'rows':_0x2431b2}:null;}})['then'](respondWithResult(_0x4544e0,null))['catch'](handleError(_0x4544e0,null));}; \ No newline at end of file +var _0x442b=['register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','stack','name','index','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','include','findAll','rows','catch','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','format','SIP','createdAt','Team','getTeams','addTeams','ids','online','voicePause','flatMap','Agents','each','forEach','emit','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x442b,0x6f));var _0xb442=function(_0x87c2f0,_0xeb511f){_0x87c2f0=_0x87c2f0-0x0;var _0x2542af=_0x442b[_0x87c2f0];return _0x2542af;};'use strict';var emlformat=require(_0xb442('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb442('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb442('0x2'));var moment=require(_0xb442('0x3'));var BPromise=require(_0xb442('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb442('0x5'));var sox=require(_0xb442('0x6'));var csv=require('to-csv');var ejs=require(_0xb442('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb442('0x8'));var squel=require(_0xb442('0x9'));var crypto=require(_0xb442('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb442('0xb'));var toCsv=require(_0xb442('0xc'));var querystring=require(_0xb442('0xd'));var Papa=require(_0xb442('0xe'));var Redis=require('ioredis');var authService=require(_0xb442('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb442('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb442('0x11'))(_0xb442('0x12'));var utils=require(_0xb442('0x13'));var config=require(_0xb442('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb442('0x15'))['db'];config[_0xb442('0x16')]=_['defaults'](config[_0xb442('0x16')],{'host':_0xb442('0x17'),'port':0x18eb});var socket=require(_0xb442('0x18'))(new Redis(config[_0xb442('0x16')]));require(_0xb442('0x19'))[_0xb442('0x1a')](socket);function respondWithStatusCode(_0x2fd072,_0x25353a){_0x25353a=_0x25353a||0xcc;return function(_0x508052){if(_0x508052){return _0x2fd072[_0xb442('0x1b')](_0x25353a);}return _0x2fd072['status'](_0x25353a)[_0xb442('0x1c')]();};}function respondWithResult(_0x3c5487,_0x567fc9){_0x567fc9=_0x567fc9||0xc8;return function(_0x1cd20d){if(_0x1cd20d){return _0x3c5487[_0xb442('0x1d')](_0x567fc9)[_0xb442('0x1e')](_0x1cd20d);}};}function respondWithFilteredResult(_0x1f8eee,_0x301880){return function(_0x141695){if(_0x141695){var _0x33dcc3=typeof _0x301880[_0xb442('0x1f')]===_0xb442('0x20')&&typeof _0x301880[_0xb442('0x21')]===_0xb442('0x20');var _0x429e1c=_0x141695['count'];var _0xe816ba=_0x33dcc3?0x0:_0x301880['offset'];var _0x28c8b1=_0x33dcc3?_0x141695[_0xb442('0x22')]:_0x301880[_0xb442('0x1f')]+_0x301880['limit'];var _0x298b9a;if(_0x28c8b1>=_0x429e1c){_0x28c8b1=_0x429e1c;_0x298b9a=0xc8;}else{_0x298b9a=0xce;}_0x1f8eee[_0xb442('0x1d')](_0x298b9a);return _0x1f8eee[_0xb442('0x23')](_0xb442('0x24'),_0xe816ba+'-'+_0x28c8b1+'/'+_0x429e1c)[_0xb442('0x1e')](_0x141695);}return null;};}function patchUpdates(_0x1c5f3a){return function(_0x100afc){try{jsonpatch['apply'](_0x100afc,_0x1c5f3a,!![]);}catch(_0x2f57b4){return BPromise[_0xb442('0x25')](_0x2f57b4);}return _0x100afc[_0xb442('0x26')]();};}function saveUpdates(_0xedd848,_0x527a72){return function(_0x3c3940){if(_0x3c3940){return _0x3c3940['update'](_0xedd848)[_0xb442('0x27')](function(_0x1e4298){return _0x1e4298;});}return null;};}function removeEntity(_0x39d8ea,_0x521d87){return function(_0x3334ca){if(_0x3334ca){return _0x3334ca[_0xb442('0x28')]()[_0xb442('0x27')](function(){var _0x579b4c=_0x3334ca['get']({'plain':!![]});var _0x18fbd4='SmsQueues';return db[_0xb442('0x29')]['destroy']({'where':{'type':_0x18fbd4,'resourceId':_0x579b4c['id']}})[_0xb442('0x27')](function(){return _0x3334ca;});})[_0xb442('0x27')](function(){_0x39d8ea['status'](0xcc)[_0xb442('0x1c')]();});}};}function handleEntityNotFound(_0x47a1ae,_0x54a7b3){return function(_0x41f1c4){if(!_0x41f1c4){_0x47a1ae['sendStatus'](0x194);}return _0x41f1c4;};}function handleError(_0x6abfbf,_0x1264c3){_0x1264c3=_0x1264c3||0x1f4;return function(_0x2eac67){logger['error'](_0x2eac67[_0xb442('0x2a')]);if(_0x2eac67['name']){delete _0x2eac67[_0xb442('0x2b')];}_0x6abfbf[_0xb442('0x1d')](_0x1264c3)['send'](_0x2eac67);};}exports[_0xb442('0x2c')]=function(_0xf0274e,_0x12a79f){var _0x10c44d={},_0x1fc0c7={},_0x5167d4={'count':0x0,'rows':[]};var _0x24225e=_['map'](db[_0xb442('0x2d')][_0xb442('0x2e')],function(_0x27e5d8){return{'name':_0x27e5d8[_0xb442('0x2f')],'type':_0x27e5d8[_0xb442('0x30')][_0xb442('0x31')]};});_0x1fc0c7[_0xb442('0x32')]=_['map'](_0x24225e,_0xb442('0x2b'));_0x1fc0c7[_0xb442('0x33')]=_[_0xb442('0x34')](_0xf0274e['query']);_0x1fc0c7[_0xb442('0x35')]=_[_0xb442('0x36')](_0x1fc0c7[_0xb442('0x32')],_0x1fc0c7[_0xb442('0x33')]);_0x10c44d['attributes']=_[_0xb442('0x36')](_0x1fc0c7[_0xb442('0x32')],qs[_0xb442('0x37')](_0xf0274e[_0xb442('0x33')][_0xb442('0x37')]));_0x10c44d['attributes']=_0x10c44d[_0xb442('0x38')][_0xb442('0x39')]?_0x10c44d[_0xb442('0x38')]:_0x1fc0c7['model'];if(!_0xf0274e[_0xb442('0x33')][_0xb442('0x3a')](_0xb442('0x3b'))){_0x10c44d['limit']=qs[_0xb442('0x21')](_0xf0274e[_0xb442('0x33')][_0xb442('0x21')]);_0x10c44d[_0xb442('0x1f')]=qs[_0xb442('0x1f')](_0xf0274e[_0xb442('0x33')][_0xb442('0x1f')]);}_0x10c44d[_0xb442('0x3c')]=qs['sort'](_0xf0274e['query'][_0xb442('0x3d')]);_0x10c44d[_0xb442('0x3e')]=qs[_0xb442('0x35')](_[_0xb442('0x3f')](_0xf0274e[_0xb442('0x33')],_0x1fc0c7[_0xb442('0x35')]),_0x24225e);if(_0xf0274e[_0xb442('0x33')][_0xb442('0x40')]){_0x10c44d[_0xb442('0x3e')]=_['merge'](_0x10c44d['where'],{'$or':_[_0xb442('0x41')](_0x24225e,function(_0x2166c1){if(_0x2166c1[_0xb442('0x30')]!==_0xb442('0x42')){var _0x2c9f07={};_0x2c9f07[_0x2166c1[_0xb442('0x2b')]]={'$like':'%'+_0xf0274e[_0xb442('0x33')][_0xb442('0x40')]+'%'};return _0x2c9f07;}})});}_0x10c44d=_['merge']({},_0x10c44d,_0xf0274e['options']);var _0x414dbe={'where':_0x10c44d[_0xb442('0x3e')]};return db[_0xb442('0x2d')]['count'](_0x414dbe)[_0xb442('0x27')](function(_0x428cd4){_0x5167d4[_0xb442('0x22')]=_0x428cd4;if(_0xf0274e[_0xb442('0x33')]['includeAll']){_0x10c44d[_0xb442('0x43')]=[{'all':!![]}];}return db[_0xb442('0x2d')][_0xb442('0x44')](_0x10c44d);})[_0xb442('0x27')](function(_0x4ba9ff){_0x5167d4[_0xb442('0x45')]=_0x4ba9ff;return _0x5167d4;})['then'](respondWithFilteredResult(_0x12a79f,_0x10c44d))[_0xb442('0x46')](handleError(_0x12a79f,null));};exports['show']=function(_0x206235,_0x2db200){var _0x5efb0a={'raw':!![],'where':{'id':_0x206235['params']['id']}},_0xdac3f2={};_0xdac3f2['model']=_[_0xb442('0x34')](db[_0xb442('0x2d')][_0xb442('0x2e')]);_0xdac3f2[_0xb442('0x33')]=_[_0xb442('0x34')](_0x206235[_0xb442('0x33')]);_0xdac3f2[_0xb442('0x35')]=_[_0xb442('0x36')](_0xdac3f2[_0xb442('0x32')],_0xdac3f2[_0xb442('0x33')]);_0x5efb0a[_0xb442('0x38')]=_['intersection'](_0xdac3f2[_0xb442('0x32')],qs[_0xb442('0x37')](_0x206235['query'][_0xb442('0x37')]));_0x5efb0a[_0xb442('0x38')]=_0x5efb0a[_0xb442('0x38')][_0xb442('0x39')]?_0x5efb0a[_0xb442('0x38')]:_0xdac3f2[_0xb442('0x32')];if(_0x206235[_0xb442('0x33')][_0xb442('0x47')]){_0x5efb0a[_0xb442('0x43')]=[{'all':!![]}];}_0x5efb0a=_[_0xb442('0x48')]({},_0x5efb0a,_0x206235[_0xb442('0x49')]);return db[_0xb442('0x2d')][_0xb442('0x4a')](_0x5efb0a)[_0xb442('0x27')](handleEntityNotFound(_0x2db200,null))[_0xb442('0x27')](respondWithResult(_0x2db200,null))['catch'](handleError(_0x2db200,null));};exports['create']=function(_0x4cf3a9,_0x1f0a39){return db[_0xb442('0x2d')][_0xb442('0x4b')](_0x4cf3a9[_0xb442('0x4c')],{})[_0xb442('0x27')](function(_0xb09974){var _0x3a5806=_0x4cf3a9[_0xb442('0x4d')][_0xb442('0x4e')]({'plain':!![]});if(!_0x3a5806)throw new Error(_0xb442('0x4f'));if(_0x3a5806[_0xb442('0x50')]===_0xb442('0x4d')){var _0x4ae919=_0xb09974[_0xb442('0x4e')]({'plain':!![]});var _0x387865='SmsQueues';return db[_0xb442('0x51')][_0xb442('0x4a')]({'where':{'name':_0x387865,'userProfileId':_0x3a5806[_0xb442('0x52')]},'raw':!![]})[_0xb442('0x27')](function(_0x330fe6){if(_0x330fe6&&_0x330fe6[_0xb442('0x53')]===0x0){return db[_0xb442('0x29')][_0xb442('0x4b')]({'name':_0x4ae919[_0xb442('0x2b')],'resourceId':_0x4ae919['id'],'type':_0x330fe6['name'],'sectionId':_0x330fe6['id']},{})[_0xb442('0x27')](function(){return _0xb09974;});}else{return _0xb09974;}})[_0xb442('0x46')](function(_0x3cc712){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cc712);throw _0x3cc712;});}return _0xb09974;})[_0xb442('0x27')](respondWithResult(_0x1f0a39,0xc9))['catch'](handleError(_0x1f0a39,null));};exports[_0xb442('0x54')]=function(_0xeaecaf,_0x5e8f22){if(_0xeaecaf[_0xb442('0x4c')]['id']){delete _0xeaecaf[_0xb442('0x4c')]['id'];}return db[_0xb442('0x2d')][_0xb442('0x4a')]({'where':{'id':_0xeaecaf[_0xb442('0x55')]['id']}})[_0xb442('0x27')](handleEntityNotFound(_0x5e8f22,null))[_0xb442('0x27')](saveUpdates(_0xeaecaf[_0xb442('0x4c')],null))[_0xb442('0x27')](respondWithResult(_0x5e8f22,null))['catch'](handleError(_0x5e8f22,null));};exports[_0xb442('0x28')]=function(_0x1c0038,_0x1f9aaf){return db['SmsQueue']['find']({'where':{'id':_0x1c0038[_0xb442('0x55')]['id']}})[_0xb442('0x27')](handleEntityNotFound(_0x1f9aaf,null))[_0xb442('0x27')](removeEntity(_0x1f9aaf,null))[_0xb442('0x46')](handleError(_0x1f9aaf,null));};exports[_0xb442('0x56')]=function(_0x4021c6,_0x490e08){return db[_0xb442('0x2d')][_0xb442('0x56')]()[_0xb442('0x27')](respondWithResult(_0x490e08,null))[_0xb442('0x46')](handleError(_0x490e08,null));};exports[_0xb442('0x57')]=function(_0x35146c,_0x3aef4b,_0x369126){var _0x1fe4db={'raw':!![],'where':{}},_0x257d21={},_0x519188;return db[_0xb442('0x2d')][_0xb442('0x58')]({'where':{'id':_0x35146c[_0xb442('0x55')]['id']}})[_0xb442('0x27')](handleEntityNotFound(_0x3aef4b,null))[_0xb442('0x27')](function(_0x1e6722){if(_0x1e6722){_0x519188=_0x1e6722[_0xb442('0x4e')]({'plain':!![]});_0x257d21[_0xb442('0x32')]=_[_0xb442('0x34')](db[_0xb442('0x59')][_0xb442('0x2e')]);_0x257d21[_0xb442('0x33')]=_[_0xb442('0x34')](_0x35146c[_0xb442('0x33')]);_0x257d21[_0xb442('0x35')]=_[_0xb442('0x36')](_0x257d21['model'],_0x257d21['query']);_0x1fe4db[_0xb442('0x38')]=_[_0xb442('0x36')](_0x257d21['model'],qs[_0xb442('0x37')](_0x35146c[_0xb442('0x33')][_0xb442('0x37')]));_0x1fe4db[_0xb442('0x38')]=_0x1fe4db[_0xb442('0x38')][_0xb442('0x39')]?_0x1fe4db[_0xb442('0x38')]:_0x257d21[_0xb442('0x32')];if(!_0x35146c[_0xb442('0x33')][_0xb442('0x3a')](_0xb442('0x3b'))){_0x1fe4db['limit']=qs[_0xb442('0x21')](_0x35146c[_0xb442('0x33')][_0xb442('0x21')]);_0x1fe4db[_0xb442('0x1f')]=qs[_0xb442('0x1f')](_0x35146c[_0xb442('0x33')]['offset']);}_0x1fe4db[_0xb442('0x3c')]=qs[_0xb442('0x3d')](_0x35146c[_0xb442('0x33')][_0xb442('0x3d')]);_0x1fe4db[_0xb442('0x3e')]=qs[_0xb442('0x35')](_[_0xb442('0x3f')](_0x35146c[_0xb442('0x33')],_0x257d21[_0xb442('0x35')]));_0x1fe4db[_0xb442('0x3e')]['SmsQueueId']=_0x1e6722['id'];if(_0x35146c[_0xb442('0x33')][_0xb442('0x40')]){_0x1fe4db[_0xb442('0x3e')]=_[_0xb442('0x48')](_0x1fe4db[_0xb442('0x3e')],{'$or':_[_0xb442('0x41')](_0x1fe4db['attributes'],function(_0x2321c2){var _0x20b707={};_0x20b707[_0x2321c2]={'$like':'%'+_0x35146c[_0xb442('0x33')][_0xb442('0x40')]+'%'};return _0x20b707;})});}_0x1fe4db=_[_0xb442('0x48')]({},_0x1fe4db,_0x35146c['options']);return db[_0xb442('0x59')][_0xb442('0x44')](_0x1fe4db);}})[_0xb442('0x27')](function(_0x437047){if(_0x437047){return db[_0xb442('0x5a')][_0xb442('0x5b')]({'where':{'id':_[_0xb442('0x41')](_0x437047,_0xb442('0x5c')),'role':_0xb442('0x5d')},'attributes':['id',_0xb442('0x2b'),'smsPause',_0xb442('0x5e'),'createdAt']});}})[_0xb442('0x27')](function(_0x1830a0){if(_0x1830a0){return{'count':_0x1830a0[_0xb442('0x22')],'rows':_['map'](_0x1830a0['rows'],function(_0x43a4ad){return{'membername':_0x43a4ad[_0xb442('0x2b')],'UserId':_0x43a4ad['id'],'queue_name':_0x519188[_0xb442('0x2b')],'SmsQueueId':_0x519188['id'],'interface':util[_0xb442('0x5f')]('%s/%s',_0xb442('0x60'),_0x43a4ad['name']),'penalty':0x0,'paused':_0x43a4ad['smsPause'],'createdAt':_0x43a4ad[_0xb442('0x61')],'updatedAt':_0x43a4ad['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb442('0x27')](respondWithFilteredResult(_0x3aef4b,_0x1fe4db))[_0xb442('0x46')](handleError(_0x3aef4b,null));};exports['getTeams']=function(_0x1fdc1c,_0x21ff26,_0xad0d46){var _0x37b98a={};var _0x33307a={};var _0x3bff9d;var _0x104fbf;return db[_0xb442('0x2d')][_0xb442('0x58')]({'where':{'id':_0x1fdc1c[_0xb442('0x55')]['id']}})[_0xb442('0x27')](handleEntityNotFound(_0x21ff26,null))['then'](function(_0x1ed265){if(_0x1ed265){_0x3bff9d=_0x1ed265;_0x33307a[_0xb442('0x32')]=_[_0xb442('0x34')](db[_0xb442('0x62')][_0xb442('0x2e')]);_0x33307a['query']=_[_0xb442('0x34')](_0x1fdc1c[_0xb442('0x33')]);_0x33307a[_0xb442('0x35')]=_[_0xb442('0x36')](_0x33307a[_0xb442('0x32')],_0x33307a['query']);_0x37b98a['attributes']=_[_0xb442('0x36')](_0x33307a[_0xb442('0x32')],qs[_0xb442('0x37')](_0x1fdc1c[_0xb442('0x33')][_0xb442('0x37')]));_0x37b98a['attributes']=_0x37b98a[_0xb442('0x38')][_0xb442('0x39')]?_0x37b98a[_0xb442('0x38')]:_0x33307a[_0xb442('0x32')];_0x37b98a[_0xb442('0x3c')]=qs['sort'](_0x1fdc1c[_0xb442('0x33')][_0xb442('0x3d')]);_0x37b98a['where']=qs[_0xb442('0x35')](_[_0xb442('0x3f')](_0x1fdc1c[_0xb442('0x33')],_0x33307a['filters']));if(_0x1fdc1c[_0xb442('0x33')][_0xb442('0x40')]){_0x37b98a['where']=_[_0xb442('0x48')](_0x37b98a['where'],{'$or':_[_0xb442('0x41')](_0x37b98a['attributes'],function(_0x49bee6){var _0x1a5861={};_0x1a5861[_0x49bee6]={'$like':'%'+_0x1fdc1c[_0xb442('0x33')][_0xb442('0x40')]+'%'};return _0x1a5861;})});}_0x37b98a=_['merge']({},_0x37b98a,_0x1fdc1c[_0xb442('0x49')]);return _0x3bff9d[_0xb442('0x63')](_0x37b98a);}})['then'](function(_0x567455){if(_0x567455){_0x104fbf=_0x567455[_0xb442('0x39')];if(!_0x1fdc1c[_0xb442('0x33')][_0xb442('0x3a')](_0xb442('0x3b'))){_0x37b98a[_0xb442('0x21')]=qs[_0xb442('0x21')](_0x1fdc1c[_0xb442('0x33')]['limit']);_0x37b98a[_0xb442('0x1f')]=qs[_0xb442('0x1f')](_0x1fdc1c[_0xb442('0x33')][_0xb442('0x1f')]);}return _0x3bff9d[_0xb442('0x63')](_0x37b98a);}})[_0xb442('0x27')](function(_0x5234a1){if(_0x5234a1){return _0x5234a1?{'count':_0x104fbf,'rows':_0x5234a1}:null;}})[_0xb442('0x27')](respondWithResult(_0x21ff26,null))[_0xb442('0x46')](handleError(_0x21ff26,null));};exports[_0xb442('0x64')]=function(_0x9281aa,_0x41a3d5,_0xc58f72){var _0x32fe69=_0x9281aa[_0xb442('0x4c')][_0xb442('0x65')];return db['Team'][_0xb442('0x44')]({'where':{'id':_0x32fe69},'attributes':['id'],'include':[{'model':db[_0xb442('0x5a')],'as':'Agents','attributes':['id',_0xb442('0x2b'),_0xb442('0x66'),_0xb442('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x1e3943){if(_0x1e3943){var _0x33aa70=_[_0xb442('0x68')](_0x1e3943,function(_0x549cf9){var _0x5aa976=_0x549cf9[_0xb442('0x4e')]({'plain':!![]});return _0x5aa976[_0xb442('0x69')];});return db['SmsQueue'][_0xb442('0x4a')]({'where':{'id':_0x9281aa[_0xb442('0x55')]['id']}})['then'](function(_0x56d307){return db['sequelize']['transaction'](function(_0x4133ee){return _0x56d307[_0xb442('0x64')](_0x32fe69,{'transaction':_0x4133ee})[_0xb442('0x27')](function(){return BPromise[_0xb442('0x6a')](_0x33aa70,function(_0x2eda55){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x2eda55['id'],'SmsQueueId':_0x9281aa[_0xb442('0x55')]['id']},'transaction':_0x4133ee});});})[_0xb442('0x27')](function(){_0x33aa70[_0xb442('0x6b')](function(_0x145b5d){socket[_0xb442('0x6c')]('userSmsQueue:save',{'UserId':_0x145b5d['id'],'SmsQueueId':_0x56d307['id']});});});});});}})['then'](respondWithStatusCode(_0x41a3d5,null))[_0xb442('0x46')](handleError(_0x41a3d5,null));};exports['removeTeams']=function(_0x3436d7,_0x3e2630,_0x470027){return db['Team'][_0xb442('0x44')]({'where':{'id':_0x3436d7[_0xb442('0x33')][_0xb442('0x65')]},'attributes':['id'],'include':[{'model':db[_0xb442('0x5a')],'as':_0xb442('0x69'),'attributes':['id'],'raw':!![]}]})[_0xb442('0x27')](handleEntityNotFound(_0x3e2630,null))[_0xb442('0x27')](function(_0x35de2d){var _0x5c6de0=_[_0xb442('0x41')](_0x35de2d,'id');var _0x1cee12=[];var _0x59b55a=[];var _0x34759c=squel[_0xb442('0x6d')]();_0x34759c[_0xb442('0x6e')](_0xb442('0x6f'))[_0xb442('0x70')](_0xb442('0x71'),'tq')['join'](_0xb442('0x72'),'ut',_0xb442('0x73'))[_0xb442('0x3e')]('SmsQueueId\x20=\x20?',_0x3436d7[_0xb442('0x55')]['id']);for(var _0xfa3a50=0x0;_0xfa3a50<_0x35de2d[_0xb442('0x39')];_0xfa3a50+=0x1){let _0x39af85=_0x35de2d[_0xfa3a50];for(var _0x1d7d46=0x0;_0x1d7d46<_0x39af85[_0xb442('0x69')][_0xb442('0x39')];_0x1d7d46+=0x1){let _0x544a85=_0x39af85[_0xb442('0x69')][_0x1d7d46];var _0x29fbe2=_0x34759c['clone']();_0x29fbe2['where'](_0xb442('0x74'),_0x544a85['id']);_0x59b55a[_0xb442('0x75')](db['sequelize'][_0xb442('0x33')](_0x29fbe2[_0xb442('0x76')](),{'type':db[_0xb442('0x77')][_0xb442('0x78')][_0xb442('0x79')]})[_0xb442('0x27')](function(_0x1962ae){if(_0x1962ae[_0xb442('0x39')]===0x1){return _0x544a85['id'];}else{var _0x2b18a8=_[_0xb442('0x7a')](_[_0xb442('0x41')](_0x1962ae,_0xb442('0x7b')),function(_0x4d27bc){return _[_0xb442('0x7c')](_0x5c6de0,_0x4d27bc);});if(_0x2b18a8){return _0x544a85['id'];}}}));}}return BPromise['all'](_0x59b55a)[_0xb442('0x27')](function(_0x31da02){_0x1cee12=_(_0x1cee12)[_0xb442('0x7d')](_0x31da02)[_0xb442('0x7e')]()[_0xb442('0x7f')]();return db[_0xb442('0x2d')][_0xb442('0x4a')]({'where':{'id':_0x3436d7[_0xb442('0x55')]['id']}})['then'](function(_0x3984e3){return db[_0xb442('0x77')]['transaction'](function(_0x555f83){return _0x3984e3[_0xb442('0x80')](_0x3436d7['query'][_0xb442('0x65')],{'transaction':_0x555f83})[_0xb442('0x27')](function(){if(!_[_0xb442('0x81')](_0x1cee12)){return _0x3984e3[_0xb442('0x82')](_0x1cee12,{'transaction':_0x555f83});}})['then'](function(){_0x1cee12[_0xb442('0x6b')](function(_0x4d7ce8){socket[_0xb442('0x6c')](_0xb442('0x83'),{'UserId':_0x4d7ce8,'SmsQueueId':_0x3984e3['id']});});});});});});})[_0xb442('0x27')](respondWithStatusCode(_0x3e2630,null))[_0xb442('0x46')](handleError(_0x3e2630,null));};exports[_0xb442('0x84')]=function(_0x4e4eeb,_0x21f4cb,_0x2790a2){return db[_0xb442('0x2d')][_0xb442('0x4a')]({'where':{'id':_0x4e4eeb['params']['id']}})['then'](handleEntityNotFound(_0x21f4cb,null))[_0xb442('0x27')](function(_0x5f3a7e){if(_0x5f3a7e){return _0x5f3a7e['addAgents'](_0x4e4eeb[_0xb442('0x4c')][_0xb442('0x65')],_[_0xb442('0x85')](_0x4e4eeb[_0xb442('0x4c')],[_0xb442('0x65'),'id'])||{})['spread'](function(_0x3bfa11){for(var _0x33ea4c=0x0;_0x33ea4c<_0x4e4eeb['body']['ids'][_0xb442('0x39')];_0x33ea4c+=0x1){socket[_0xb442('0x6c')](_0xb442('0x86'),{'UserId':Number(_0x4e4eeb[_0xb442('0x4c')]['ids'][_0x33ea4c]),'SmsQueueId':Number(_0x4e4eeb['params']['id'])});}return _0x3bfa11;});}})[_0xb442('0x27')](respondWithResult(_0x21f4cb,null))[_0xb442('0x46')](handleError(_0x21f4cb,null));};exports[_0xb442('0x82')]=function(_0xa1b7bb,_0xb2fe65,_0x5e193f){return db[_0xb442('0x2d')][_0xb442('0x4a')]({'where':{'id':_0xa1b7bb[_0xb442('0x55')]['id']}})[_0xb442('0x27')](handleEntityNotFound(_0xb2fe65,null))['then'](function(_0x40cd27){if(_0x40cd27){return _0x40cd27[_0xb442('0x82')](_0xa1b7bb[_0xb442('0x33')][_0xb442('0x65')])[_0xb442('0x27')](function(){if(_[_0xb442('0x87')](_0xa1b7bb[_0xb442('0x33')][_0xb442('0x65')])){for(var _0x459cdc=0x0;_0x459cdc<_0xa1b7bb[_0xb442('0x33')][_0xb442('0x65')][_0xb442('0x39')];_0x459cdc+=0x1){socket[_0xb442('0x6c')](_0xb442('0x83'),{'UserId':Number(_0xa1b7bb[_0xb442('0x33')][_0xb442('0x65')][_0x459cdc]),'SmsQueueId':Number(_0xa1b7bb[_0xb442('0x55')]['id'])});}}else{socket[_0xb442('0x6c')](_0xb442('0x83'),{'UserId':Number(_0xa1b7bb['query']['ids']),'SmsQueueId':Number(_0xa1b7bb[_0xb442('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xb2fe65,null))[_0xb442('0x46')](handleError(_0xb2fe65,null));};exports[_0xb442('0x88')]=function(_0x3f877e,_0x353a73,_0x3a709f){var _0x484a65={};var _0x414af0={};var _0x415607;var _0x2ae8fd;return db[_0xb442('0x2d')][_0xb442('0x58')]({'where':{'id':_0x3f877e[_0xb442('0x55')]['id']}})[_0xb442('0x27')](handleEntityNotFound(_0x353a73,null))['then'](function(_0x1bb23b){if(_0x1bb23b){_0x415607=_0x1bb23b;_0x414af0['model']=_[_0xb442('0x34')](db[_0xb442('0x5a')][_0xb442('0x2e')]);_0x414af0[_0xb442('0x33')]=_[_0xb442('0x34')](_0x3f877e[_0xb442('0x33')]);_0x414af0[_0xb442('0x35')]=_['intersection'](_0x414af0['model'],_0x414af0['query']);_0x484a65[_0xb442('0x38')]=_[_0xb442('0x36')](_0x414af0['model'],qs[_0xb442('0x37')](_0x3f877e[_0xb442('0x33')][_0xb442('0x37')]));_0x484a65['attributes']=_0x484a65[_0xb442('0x38')][_0xb442('0x39')]?_0x484a65[_0xb442('0x38')]:_0x414af0[_0xb442('0x32')];_0x484a65[_0xb442('0x3c')]=qs[_0xb442('0x3d')](_0x3f877e[_0xb442('0x33')][_0xb442('0x3d')]);_0x484a65[_0xb442('0x3e')]=qs['filters'](_['pick'](_0x3f877e[_0xb442('0x33')],_0x414af0[_0xb442('0x35')]));if(_0x3f877e[_0xb442('0x33')][_0xb442('0x40')]){_0x484a65[_0xb442('0x3e')]=_[_0xb442('0x48')](_0x484a65[_0xb442('0x3e')],{'$or':_['map'](_0x484a65[_0xb442('0x38')],function(_0xd1f6fb){var _0x1763c0={};_0x1763c0[_0xd1f6fb]={'$like':'%'+_0x3f877e[_0xb442('0x33')]['filter']+'%'};return _0x1763c0;})});}_0x484a65=_['merge']({},_0x484a65,_0x3f877e[_0xb442('0x49')]);return _0x415607[_0xb442('0x88')](_0x484a65);}})[_0xb442('0x27')](function(_0x368976){if(_0x368976){_0x2ae8fd=_0x368976[_0xb442('0x39')];if(!_0x3f877e[_0xb442('0x33')][_0xb442('0x3a')](_0xb442('0x3b'))){_0x484a65['limit']=qs[_0xb442('0x21')](_0x3f877e[_0xb442('0x33')][_0xb442('0x21')]);_0x484a65[_0xb442('0x1f')]=qs['offset'](_0x3f877e[_0xb442('0x33')][_0xb442('0x1f')]);}return _0x415607[_0xb442('0x88')](_0x484a65);}})['then'](function(_0x45b912){if(_0x45b912){return _0x45b912?{'count':_0x2ae8fd,'rows':_0x45b912}:null;}})[_0xb442('0x27')](respondWithResult(_0x353a73,null))['catch'](handleError(_0x353a73,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b8ef476..8d6ed16 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 _0x8bc8=['hook','exports','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x8bc8,0x18e));var _0x88bc=function(_0x18a577,_0x25560c){_0x18a577=_0x18a577-0x0;var _0x1cb0c7=_0x8bc8[_0x18a577];return _0x1cb0c7;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x88bc('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x88bc('0x1')](0x0);var events={'afterCreate':_0x88bc('0x2'),'afterUpdate':_0x88bc('0x3'),'afterDestroy':_0x88bc('0x4')};function emitEvent(_0x4d0655){return function(_0x335481,_0x4b29cd,_0x106c4c){SmsQueueEvents[_0x88bc('0x5')](_0x4d0655+':'+_0x335481['id'],_0x335481);SmsQueueEvents[_0x88bc('0x5')](_0x4d0655,_0x335481);_0x106c4c(null);};}for(var e in events){if(events[_0x88bc('0x6')](e)){var event=events[e];SmsQueue[_0x88bc('0x7')](e,emitEvent(event));}}module[_0x88bc('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x3036=['save','hasOwnProperty','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0xf17d71,_0x3bbe72){var _0x2502f3=function(_0x2e7c34){while(--_0x2e7c34){_0xf17d71['push'](_0xf17d71['shift']());}};_0x2502f3(++_0x3bbe72);}(_0x3036,0x128));var _0x6303=function(_0x414765,_0x3b2bd4){_0x414765=_0x414765-0x0;var _0x2162bb=_0x3036[_0x414765];return _0x2162bb;};'use strict';var EventEmitter=require(_0x6303('0x0'));var SmsQueue=require(_0x6303('0x1'))['db'][_0x6303('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6303('0x3')](0x0);var events={'afterCreate':_0x6303('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2b8712){return function(_0x2b1d7f,_0x31bfa7,_0x568e29){SmsQueueEvents['emit'](_0x2b8712+':'+_0x2b1d7f['id'],_0x2b1d7f);SmsQueueEvents['emit'](_0x2b8712,_0x2b1d7f);_0x568e29(null);};}for(var e in events){if(events[_0x6303('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3848d40..1716519 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 _0x2af2=['define','SmsQueue','sms_queues','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x75fbc2,_0x5b6f24){var _0x20597b=function(_0x2a0411){while(--_0x2a0411){_0x75fbc2['push'](_0x75fbc2['shift']());}};_0x20597b(++_0x5b6f24);}(_0x2af2,0x19b));var _0x22af=function(_0x1224b9,_0x2da0ad){_0x1224b9=_0x1224b9-0x0;var _0x4273fa=_0x2af2[_0x1224b9];return _0x4273fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x22af('0x0'));var config=require(_0x22af('0x1'));var attributes=require(_0x22af('0x2'));module['exports']=function(_0x238d94,_0x517efd){return _0x238d94[_0x22af('0x3')](_0x22af('0x4'),attributes,{'tableName':_0x22af('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1527=['exports','define','SmsQueue','util','../../config/logger','api','moment','path','rimraf','./smsQueue.attributes'];(function(_0x347343,_0x213c66){var _0x37444e=function(_0x32bc77){while(--_0x32bc77){_0x347343['push'](_0x347343['shift']());}};_0x37444e(++_0x213c66);}(_0x1527,0xc1));var _0x7152=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x1527[_0x491faa];return _0x414440;};'use strict';var _=require('lodash');var util=require(_0x7152('0x0'));var logger=require(_0x7152('0x1'))(_0x7152('0x2'));var moment=require(_0x7152('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7152('0x4'));var rimraf=require(_0x7152('0x5'));var config=require('../../config/environment');var attributes=require(_0x7152('0x6'));module[_0x7152('0x7')]=function(_0x524660,_0x46595a){return _0x524660[_0x7152('0x8')](_0x7152('0x9'),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 5200f1c..8b5938a 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 _0x42c7=['result','catch','findAll','options','raw','limit','include','map','model','attributes','GetSmsQueue','SmsQueue','where','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x42c7,0x12d));var _0x742c=function(_0x2f125d,_0x4f2dd3){_0x2f125d=_0x2f125d-0x0;var _0x4e91cf=_0x42c7[_0x2f125d];return _0x4e91cf;};'use strict';var _=require(_0x742c('0x0'));var util=require(_0x742c('0x1'));var moment=require(_0x742c('0x2'));var BPromise=require(_0x742c('0x3'));var rs=require(_0x742c('0x4'));var fs=require('fs');var Redis=require(_0x742c('0x5'));var db=require(_0x742c('0x6'))['db'];var utils=require(_0x742c('0x7'));var logger=require(_0x742c('0x8'))(_0x742c('0x9'));var config=require(_0x742c('0xa'));var jayson=require(_0x742c('0xb'));var client=jayson[_0x742c('0xc')][_0x742c('0xd')]({'port':0x232a});config[_0x742c('0xe')]=_['defaults'](config[_0x742c('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x742c('0xf'))(new Redis(config[_0x742c('0xe')]));require(_0x742c('0x10'))['register'](socket);function respondWithRpcPromise(_0x18a43a,_0x34c936,_0x58f49c){return new BPromise(function(_0x1f1d90,_0x2c601c){return client[_0x742c('0x11')](_0x18a43a,_0x58f49c)[_0x742c('0x12')](function(_0x35fff6){logger[_0x742c('0x13')](_0x742c('0x14'),_0x34c936,_0x742c('0x15'));logger[_0x742c('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x34c936,_0x742c('0x15'),JSON[_0x742c('0x17')](_0x35fff6));if(_0x35fff6[_0x742c('0x18')]){if(_0x35fff6['error'][_0x742c('0x19')]===0x1f4){logger[_0x742c('0x18')](_0x742c('0x14'),_0x34c936,_0x35fff6[_0x742c('0x18')]['message']);return _0x2c601c(_0x35fff6[_0x742c('0x18')][_0x742c('0x1a')]);}logger[_0x742c('0x18')]('SmsQueue,\x20%s,\x20%s',_0x34c936,_0x35fff6['error']['message']);return _0x1f1d90(_0x35fff6[_0x742c('0x18')][_0x742c('0x1a')]);}else{logger[_0x742c('0x13')](_0x742c('0x14'),_0x34c936,_0x742c('0x15'));_0x1f1d90(_0x35fff6[_0x742c('0x1b')][_0x742c('0x1a')]);}})[_0x742c('0x1c')](function(_0x1851ce){logger['error'](_0x742c('0x14'),_0x34c936,_0x1851ce);_0x2c601c(_0x1851ce);});});}exports['GetSmsQueue']=function(_0xca85cd){var _0x1a9156=this;return new Promise(function(_0x136dfd,_0x207a97){return db['SmsQueue'][_0x742c('0x1d')]({'raw':_0xca85cd[_0x742c('0x1e')]?_0xca85cd[_0x742c('0x1e')][_0x742c('0x1f')]===undefined?!![]:![]:!![],'where':_0xca85cd['options']?_0xca85cd[_0x742c('0x1e')]['where']||null:null,'attributes':_0xca85cd[_0x742c('0x1e')]?_0xca85cd[_0x742c('0x1e')]['attributes']||null:null,'limit':_0xca85cd['options']?_0xca85cd[_0x742c('0x1e')][_0x742c('0x20')]||null:null,'include':_0xca85cd[_0x742c('0x1e')]?_0xca85cd[_0x742c('0x1e')][_0x742c('0x21')]?_[_0x742c('0x22')](_0xca85cd[_0x742c('0x1e')][_0x742c('0x21')],function(_0x163a3f){return{'model':db[_0x163a3f[_0x742c('0x23')]],'as':_0x163a3f['as'],'attributes':_0x163a3f['attributes'],'include':_0x163a3f[_0x742c('0x21')]?_['map'](_0x163a3f[_0x742c('0x21')],function(_0x54ad46){return{'model':db[_0x54ad46[_0x742c('0x23')]],'as':_0x54ad46['as'],'attributes':_0x54ad46[_0x742c('0x24')],'include':_0x54ad46['include']?_[_0x742c('0x22')](_0x54ad46[_0x742c('0x21')],function(_0x35f81e){return{'model':db[_0x35f81e[_0x742c('0x23')]],'as':_0x35f81e['as'],'attributes':_0x35f81e[_0x742c('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cb6b6){logger[_0x742c('0x13')](_0x742c('0x25'),_0xca85cd);logger[_0x742c('0x16')](_0x742c('0x25'),_0xca85cd,JSON[_0x742c('0x17')](_0x1cb6b6));_0x136dfd(_0x1cb6b6);})[_0x742c('0x1c')](function(_0x208de4){logger[_0x742c('0x18')](_0x742c('0x25'),_0x208de4[_0x742c('0x1a')],_0xca85cd);_0x207a97(_0x1a9156['error'](0x1f4,_0x208de4['message']));});});};exports['ShowSmsQueue']=function(_0x3a9b91){var _0x3b373b=this;return new Promise(function(_0x479bd0,_0x2f76f6){return db[_0x742c('0x26')]['find']({'raw':_0x3a9b91['options']?_0x3a9b91[_0x742c('0x1e')][_0x742c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a9b91[_0x742c('0x1e')]?_0x3a9b91['options'][_0x742c('0x27')]||null:null,'attributes':_0x3a9b91[_0x742c('0x1e')]?_0x3a9b91[_0x742c('0x1e')]['attributes']||null:null,'include':_0x3a9b91[_0x742c('0x1e')]?_0x3a9b91['options']['include']?_[_0x742c('0x22')](_0x3a9b91[_0x742c('0x1e')][_0x742c('0x21')],function(_0x3aa729){return{'model':db[_0x3aa729[_0x742c('0x23')]],'as':_0x3aa729['as'],'attributes':_0x3aa729['attributes'],'include':_0x3aa729[_0x742c('0x21')]?_['map'](_0x3aa729['include'],function(_0x222ec0){return{'model':db[_0x222ec0[_0x742c('0x23')]],'as':_0x222ec0['as'],'attributes':_0x222ec0[_0x742c('0x24')],'include':_0x222ec0[_0x742c('0x21')]?_[_0x742c('0x22')](_0x222ec0[_0x742c('0x21')],function(_0x9d508c){return{'model':db[_0x9d508c[_0x742c('0x23')]],'as':_0x9d508c['as'],'attributes':_0x9d508c[_0x742c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x742c('0x12')](function(_0x5f44f4){logger[_0x742c('0x13')](_0x742c('0x28'),_0x3a9b91);logger[_0x742c('0x16')](_0x742c('0x28'),_0x3a9b91,JSON[_0x742c('0x17')](_0x5f44f4));_0x479bd0(_0x5f44f4);})[_0x742c('0x1c')](function(_0x5248b6){logger[_0x742c('0x18')](_0x742c('0x28'),_0x5248b6[_0x742c('0x1a')],_0x3a9b91);_0x2f76f6(_0x3b373b[_0x742c('0x18')](0x1f4,_0x5248b6[_0x742c('0x1a')]));});});}; \ No newline at end of file +var _0x3abc=['socket.io-emitter','./smsQueue.socket','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','find','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4c34d8,_0x383073){var _0x4c21df=function(_0x36150e){while(--_0x36150e){_0x4c34d8['push'](_0x4c34d8['shift']());}};_0x4c21df(++_0x383073);}(_0x3abc,0xe8));var _0xc3ab=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x3abc[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0xc3ab('0x0'));var util=require(_0xc3ab('0x1'));var moment=require(_0xc3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3ab('0x3'));var fs=require('fs');var Redis=require(_0xc3ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc3ab('0x5'))(_0xc3ab('0x6'));var config=require(_0xc3ab('0x7'));var jayson=require(_0xc3ab('0x8'));var client=jayson[_0xc3ab('0x9')][_0xc3ab('0xa')]({'port':0x232a});config[_0xc3ab('0xb')]=_[_0xc3ab('0xc')](config[_0xc3ab('0xb')],{'host':_0xc3ab('0xd'),'port':0x18eb});var socket=require(_0xc3ab('0xe'))(new Redis(config['redis']));require(_0xc3ab('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f5d9e,_0x4a2427,_0x414151){return new BPromise(function(_0x20cd14,_0x4e4479){return client['request'](_0x2f5d9e,_0x414151)[_0xc3ab('0x10')](function(_0x223126){logger['info'](_0xc3ab('0x11'),_0x4a2427,'request\x20sent');logger[_0xc3ab('0x12')](_0xc3ab('0x13'),_0x4a2427,_0xc3ab('0x14'),JSON[_0xc3ab('0x15')](_0x223126));if(_0x223126[_0xc3ab('0x16')]){if(_0x223126[_0xc3ab('0x16')][_0xc3ab('0x17')]===0x1f4){logger[_0xc3ab('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4a2427,_0x223126[_0xc3ab('0x16')][_0xc3ab('0x18')]);return _0x4e4479(_0x223126[_0xc3ab('0x16')][_0xc3ab('0x18')]);}logger[_0xc3ab('0x16')](_0xc3ab('0x11'),_0x4a2427,_0x223126[_0xc3ab('0x16')]['message']);return _0x20cd14(_0x223126[_0xc3ab('0x16')][_0xc3ab('0x18')]);}else{logger[_0xc3ab('0x19')](_0xc3ab('0x11'),_0x4a2427,_0xc3ab('0x14'));_0x20cd14(_0x223126[_0xc3ab('0x1a')][_0xc3ab('0x18')]);}})['catch'](function(_0x600828){logger[_0xc3ab('0x16')](_0xc3ab('0x11'),_0x4a2427,_0x600828);_0x4e4479(_0x600828);});});}exports[_0xc3ab('0x1b')]=function(_0x120f4a){var _0x395a1a=this;return new Promise(function(_0x54e1c9,_0x44ec53){return db[_0xc3ab('0x1c')][_0xc3ab('0x1d')]({'raw':_0x120f4a[_0xc3ab('0x1e')]?_0x120f4a['options'][_0xc3ab('0x1f')]===undefined?!![]:![]:!![],'where':_0x120f4a[_0xc3ab('0x1e')]?_0x120f4a[_0xc3ab('0x1e')][_0xc3ab('0x20')]||null:null,'attributes':_0x120f4a[_0xc3ab('0x1e')]?_0x120f4a[_0xc3ab('0x1e')][_0xc3ab('0x21')]||null:null,'limit':_0x120f4a['options']?_0x120f4a[_0xc3ab('0x1e')][_0xc3ab('0x22')]||null:null,'include':_0x120f4a[_0xc3ab('0x1e')]?_0x120f4a[_0xc3ab('0x1e')][_0xc3ab('0x23')]?_['map'](_0x120f4a[_0xc3ab('0x1e')][_0xc3ab('0x23')],function(_0x1b1402){return{'model':db[_0x1b1402[_0xc3ab('0x24')]],'as':_0x1b1402['as'],'attributes':_0x1b1402[_0xc3ab('0x21')],'include':_0x1b1402[_0xc3ab('0x23')]?_[_0xc3ab('0x25')](_0x1b1402[_0xc3ab('0x23')],function(_0x3a4c70){return{'model':db[_0x3a4c70[_0xc3ab('0x24')]],'as':_0x3a4c70['as'],'attributes':_0x3a4c70[_0xc3ab('0x21')],'include':_0x3a4c70['include']?_[_0xc3ab('0x25')](_0x3a4c70[_0xc3ab('0x23')],function(_0x47da22){return{'model':db[_0x47da22[_0xc3ab('0x24')]],'as':_0x47da22['as'],'attributes':_0x47da22[_0xc3ab('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b2bd7){logger[_0xc3ab('0x19')]('GetSmsQueue',_0x120f4a);logger[_0xc3ab('0x12')](_0xc3ab('0x1b'),_0x120f4a,JSON[_0xc3ab('0x15')](_0x5b2bd7));_0x54e1c9(_0x5b2bd7);})[_0xc3ab('0x26')](function(_0x40a997){logger[_0xc3ab('0x16')](_0xc3ab('0x1b'),_0x40a997[_0xc3ab('0x18')],_0x120f4a);_0x44ec53(_0x395a1a[_0xc3ab('0x16')](0x1f4,_0x40a997[_0xc3ab('0x18')]));});});};exports['ShowSmsQueue']=function(_0x5a9d98){var _0x531530=this;return new Promise(function(_0x4a324c,_0x50e3e6){return db[_0xc3ab('0x1c')][_0xc3ab('0x27')]({'raw':_0x5a9d98['options']?_0x5a9d98['options'][_0xc3ab('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a9d98[_0xc3ab('0x1e')]?_0x5a9d98['options'][_0xc3ab('0x20')]||null:null,'attributes':_0x5a9d98[_0xc3ab('0x1e')]?_0x5a9d98[_0xc3ab('0x1e')][_0xc3ab('0x21')]||null:null,'include':_0x5a9d98[_0xc3ab('0x1e')]?_0x5a9d98[_0xc3ab('0x1e')]['include']?_[_0xc3ab('0x25')](_0x5a9d98[_0xc3ab('0x1e')]['include'],function(_0x3da2ed){return{'model':db[_0x3da2ed[_0xc3ab('0x24')]],'as':_0x3da2ed['as'],'attributes':_0x3da2ed['attributes'],'include':_0x3da2ed[_0xc3ab('0x23')]?_['map'](_0x3da2ed['include'],function(_0x31e954){return{'model':db[_0x31e954['model']],'as':_0x31e954['as'],'attributes':_0x31e954[_0xc3ab('0x21')],'include':_0x31e954[_0xc3ab('0x23')]?_['map'](_0x31e954[_0xc3ab('0x23')],function(_0x3e987e){return{'model':db[_0x3e987e[_0xc3ab('0x24')]],'as':_0x3e987e['as'],'attributes':_0x3e987e[_0xc3ab('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c016d){logger[_0xc3ab('0x19')]('ShowSmsQueue',_0x5a9d98);logger[_0xc3ab('0x12')]('ShowSmsQueue',_0x5a9d98,JSON[_0xc3ab('0x15')](_0x2c016d));_0x4a324c(_0x2c016d);})[_0xc3ab('0x26')](function(_0x546096){logger[_0xc3ab('0x16')](_0xc3ab('0x28'),_0x546096[_0xc3ab('0x18')],_0x5a9d98);_0x50e3e6(_0x531530[_0xc3ab('0x16')](0x1f4,_0x546096[_0xc3ab('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 08a3cb4..ddf20e7 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 _0x68bb=['save','emit','register','smsQueue:','./smsQueue.events'];(function(_0x1c6923,_0x336a65){var _0x3b674a=function(_0x2555ab){while(--_0x2555ab){_0x1c6923['push'](_0x1c6923['shift']());}};_0x3b674a(++_0x336a65);}(_0x68bb,0xa4));var _0xb68b=function(_0x30089c,_0x2e4737){_0x30089c=_0x30089c-0x0;var _0x4293de=_0x68bb[_0x30089c];return _0x4293de;};'use strict';var SmsQueueEvents=require(_0xb68b('0x0'));var events=[_0xb68b('0x1'),'remove','update'];function createListener(_0x3fb438,_0x3ca9a9){return function(_0x34121c){_0x3ca9a9[_0xb68b('0x2')](_0x3fb438,_0x34121c);};}function removeListener(_0x15e96f,_0x6bc514){return function(){SmsQueueEvents['removeListener'](_0x15e96f,_0x6bc514);};}exports[_0xb68b('0x3')]=function(_0x19b447){for(var _0x59c136=0x0,_0x5a0a9f=events['length'];_0x59c136<_0x5a0a9f;_0x59c136++){var _0x4fd75c=events[_0x59c136];var _0x35b08e=createListener(_0xb68b('0x4')+_0x4fd75c,_0x19b447);SmsQueueEvents['on'](_0x4fd75c,_0x35b08e);}}; \ No newline at end of file +var _0xecdd=['./smsQueue.events','save','remove','emit','removeListener','register','length','smsQueue:'];(function(_0x350f0e,_0x2d6eba){var _0x1355fe=function(_0x1a93bc){while(--_0x1a93bc){_0x350f0e['push'](_0x350f0e['shift']());}};_0x1355fe(++_0x2d6eba);}(_0xecdd,0xf8));var _0xdecd=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xecdd[_0x38a7ac];return _0x53061a;};'use strict';var SmsQueueEvents=require(_0xdecd('0x0'));var events=[_0xdecd('0x1'),_0xdecd('0x2'),'update'];function createListener(_0x277e0b,_0x36c19b){return function(_0x3b6c10){_0x36c19b[_0xdecd('0x3')](_0x277e0b,_0x3b6c10);};}function removeListener(_0x5b82ff,_0x5bd842){return function(){SmsQueueEvents[_0xdecd('0x4')](_0x5b82ff,_0x5bd842);};}exports[_0xdecd('0x5')]=function(_0x11fd10){for(var _0x4c54a0=0x0,_0x147811=events[_0xdecd('0x6')];_0x4c54a0<_0x147811;_0x4c54a0++){var _0xf000d4=events[_0x4c54a0];var _0x424a10=createListener(_0xdecd('0x7')+_0xf000d4,_0x11fd10);SmsQueueEvents['on'](_0xf000d4,_0x424a10);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index a52e0cf..de209e4 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 _0xdf48=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','/describe','get','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x5d9fd7,_0x289326){var _0x233ee8=function(_0x349117){while(--_0x349117){_0x5d9fd7['push'](_0x5d9fd7['shift']());}};_0x233ee8(++_0x289326);}(_0xdf48,0x113));var _0x8df4=function(_0x49530f,_0x58104c){_0x49530f=_0x49530f-0x0;var _0x4875d4=_0xdf48[_0x49530f];return _0x4875d4;};'use strict';var multer=require('multer');var util=require(_0x8df4('0x0'));var path=require('path');var timeout=require(_0x8df4('0x1'));var express=require(_0x8df4('0x2'));var router=express[_0x8df4('0x3')]();var fs_extra=require(_0x8df4('0x4'));var auth=require(_0x8df4('0x5'));var interaction=require(_0x8df4('0x6'));var config=require(_0x8df4('0x7'));var controller=require(_0x8df4('0x8'));router['get']('/',auth[_0x8df4('0x9')](),controller['index']);router['get'](_0x8df4('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8df4('0xb')](_0x8df4('0xc'),auth[_0x8df4('0x9')](),controller[_0x8df4('0xd')]);router[_0x8df4('0xe')]('/',auth[_0x8df4('0x9')](),controller[_0x8df4('0xf')]);router[_0x8df4('0x10')]('/:id',auth[_0x8df4('0x9')](),controller[_0x8df4('0x11')]);router['delete']('/:id',auth[_0x8df4('0x9')](),controller[_0x8df4('0x12')]);module[_0x8df4('0x13')]=router; \ No newline at end of file +var _0x5398=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5398,0xe2));var _0x8539=function(_0x41b8b8,_0x4a867a){_0x41b8b8=_0x41b8b8-0x0;var _0x431ada=_0x5398[_0x41b8b8];return _0x431ada;};'use strict';var multer=require('multer');var util=require(_0x8539('0x0'));var path=require(_0x8539('0x1'));var timeout=require(_0x8539('0x2'));var express=require(_0x8539('0x3'));var router=express[_0x8539('0x4')]();var fs_extra=require(_0x8539('0x5'));var auth=require(_0x8539('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8539('0x7'));router[_0x8539('0x8')]('/',auth[_0x8539('0x9')](),controller[_0x8539('0xa')]);router[_0x8539('0x8')](_0x8539('0xb'),auth['isAuthenticated'](),controller[_0x8539('0xc')]);router[_0x8539('0x8')](_0x8539('0xd'),auth[_0x8539('0x9')](),controller[_0x8539('0xe')]);router[_0x8539('0xf')]('/',auth[_0x8539('0x9')](),controller[_0x8539('0x10')]);router[_0x8539('0x11')](_0x8539('0xd'),auth['isAuthenticated'](),controller[_0x8539('0x12')]);router[_0x8539('0x13')](_0x8539('0xd'),auth['isAuthenticated'](),controller[_0x8539('0x14')]);module[_0x8539('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2add905..d60e5f8 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 _0xa368=['DATE','moment','exports'];(function(_0x29a1bb,_0x52859d){var _0x19f85e=function(_0x1b1000){while(--_0x1b1000){_0x29a1bb['push'](_0x29a1bb['shift']());}};_0x19f85e(++_0x52859d);}(_0xa368,0xd3));var _0x8a36=function(_0x221dcb,_0x147a94){_0x221dcb=_0x221dcb-0x0;var _0x411598=_0xa368[_0x221dcb];return _0x411598;};'use strict';var moment=require(_0x8a36('0x0'));var Sequelize=require('sequelize');module[_0x8a36('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8a36('0x2')]},'acceptAt':{'type':Sequelize[_0x8a36('0x2')]},'exitAt':{'type':Sequelize[_0x8a36('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe53c=['moment','sequelize','STRING','DATE'];(function(_0x1c051a,_0x16039f){var _0x350a44=function(_0x18523c){while(--_0x18523c){_0x1c051a['push'](_0x1c051a['shift']());}};_0x350a44(++_0x16039f);}(_0xe53c,0xbc));var _0xce53=function(_0x1b00d0,_0x265b67){_0x1b00d0=_0x1b00d0-0x0;var _0x31446c=_0xe53c[_0x1b00d0];return _0x31446c;};'use strict';var moment=require(_0xce53('0x0'));var Sequelize=require(_0xce53('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xce53('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xce53('0x3')]},'acceptAt':{'type':Sequelize[_0xce53('0x3')]},'exitAt':{'type':Sequelize[_0xce53('0x3')]},'reason':{'type':Sequelize[_0xce53('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bfffc17..12d0abe 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 _0x4944=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','stack','name','send','index','SmsQueueReport','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5d394b,_0xcd5fbf){var _0x3ae625=function(_0x39fbd6){while(--_0x39fbd6){_0x5d394b['push'](_0x5d394b['shift']());}};_0x3ae625(++_0xcd5fbf);}(_0x4944,0x1e7));var _0x4494=function(_0x5698ef,_0x3d15fd){_0x5698ef=_0x5698ef-0x0;var _0x250ba3=_0x4944[_0x5698ef];return _0x250ba3;};'use strict';var emlformat=require(_0x4494('0x0'));var rimraf=require(_0x4494('0x1'));var zipdir=require(_0x4494('0x2'));var jsonpatch=require(_0x4494('0x3'));var rp=require(_0x4494('0x4'));var moment=require(_0x4494('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4494('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4494('0x7'));var fs=require('fs');var fs_extra=require(_0x4494('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4494('0x9'));var deskjs=require(_0x4494('0xa'));var toCsv=require(_0x4494('0xb'));var querystring=require(_0x4494('0xc'));var Papa=require(_0x4494('0xd'));var Redis=require(_0x4494('0xe'));var authService=require(_0x4494('0xf'));var qs=require(_0x4494('0x10'));var as=require(_0x4494('0x11'));var hardwareService=require(_0x4494('0x12'));var logger=require('../../config/logger')(_0x4494('0x13'));var utils=require(_0x4494('0x14'));var config=require(_0x4494('0x15'));var licenseUtil=require(_0x4494('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a472c,_0x183945){_0x183945=_0x183945||0xcc;return function(_0x245340){if(_0x245340){return _0x4a472c['sendStatus'](_0x183945);}return _0x4a472c[_0x4494('0x17')](_0x183945)['end']();};}function respondWithResult(_0x388cae,_0x594e11){_0x594e11=_0x594e11||0xc8;return function(_0xa2fa9){if(_0xa2fa9){return _0x388cae[_0x4494('0x17')](_0x594e11)[_0x4494('0x18')](_0xa2fa9);}};}function respondWithFilteredResult(_0x36a91d,_0x470b33){return function(_0x1d8a53){if(_0x1d8a53){var _0x49c39d=typeof _0x470b33[_0x4494('0x19')]==='undefined'&&typeof _0x470b33[_0x4494('0x1a')]===_0x4494('0x1b');var _0x4c1474=_0x1d8a53[_0x4494('0x1c')];var _0xa762f8=_0x49c39d?0x0:_0x470b33[_0x4494('0x19')];var _0x4ef393=_0x49c39d?_0x1d8a53[_0x4494('0x1c')]:_0x470b33[_0x4494('0x19')]+_0x470b33[_0x4494('0x1a')];var _0x538e8e;if(_0x4ef393>=_0x4c1474){_0x4ef393=_0x4c1474;_0x538e8e=0xc8;}else{_0x538e8e=0xce;}_0x36a91d[_0x4494('0x17')](_0x538e8e);return _0x36a91d[_0x4494('0x1d')](_0x4494('0x1e'),_0xa762f8+'-'+_0x4ef393+'/'+_0x4c1474)[_0x4494('0x18')](_0x1d8a53);}return null;};}function patchUpdates(_0x50a6d7){return function(_0x4acdfe){try{jsonpatch[_0x4494('0x1f')](_0x4acdfe,_0x50a6d7,!![]);}catch(_0x26047e){return BPromise['reject'](_0x26047e);}return _0x4acdfe[_0x4494('0x20')]();};}function saveUpdates(_0x1a5c94,_0x38aaee){return function(_0x207f37){if(_0x207f37){return _0x207f37[_0x4494('0x21')](_0x1a5c94)[_0x4494('0x22')](function(_0x411d02){return _0x411d02;});}return null;};}function removeEntity(_0x38c258,_0x1452ac){return function(_0x46ba7d){if(_0x46ba7d){return _0x46ba7d['destroy']()[_0x4494('0x22')](function(){_0x38c258['status'](0xcc)[_0x4494('0x23')]();});}};}function handleEntityNotFound(_0x2d3631,_0x25b867){return function(_0x3b00de){if(!_0x3b00de){_0x2d3631[_0x4494('0x24')](0x194);}return _0x3b00de;};}function handleError(_0x4aac6b,_0x4cb5ea){_0x4cb5ea=_0x4cb5ea||0x1f4;return function(_0x3d185a){logger[_0x4494('0x25')](_0x3d185a[_0x4494('0x26')]);if(_0x3d185a[_0x4494('0x27')]){delete _0x3d185a[_0x4494('0x27')];}_0x4aac6b[_0x4494('0x17')](_0x4cb5ea)[_0x4494('0x28')](_0x3d185a);};}exports[_0x4494('0x29')]=function(_0x19df84,_0x161769){var _0x4d6ffa={},_0x58809b={},_0x764fcf={'count':0x0,'rows':[]};var _0x3e3f40=_['map'](db[_0x4494('0x2a')][_0x4494('0x2b')],function(_0x294336){return{'name':_0x294336['fieldName'],'type':_0x294336[_0x4494('0x2c')]['key']};});_0x58809b[_0x4494('0x2d')]=_[_0x4494('0x2e')](_0x3e3f40,_0x4494('0x27'));_0x58809b[_0x4494('0x2f')]=_[_0x4494('0x30')](_0x19df84[_0x4494('0x2f')]);_0x58809b[_0x4494('0x31')]=_[_0x4494('0x32')](_0x58809b[_0x4494('0x2d')],_0x58809b[_0x4494('0x2f')]);_0x4d6ffa['attributes']=_[_0x4494('0x32')](_0x58809b[_0x4494('0x2d')],qs[_0x4494('0x33')](_0x19df84[_0x4494('0x2f')][_0x4494('0x33')]));_0x4d6ffa[_0x4494('0x34')]=_0x4d6ffa[_0x4494('0x34')][_0x4494('0x35')]?_0x4d6ffa[_0x4494('0x34')]:_0x58809b[_0x4494('0x2d')];if(!_0x19df84[_0x4494('0x2f')]['hasOwnProperty'](_0x4494('0x36'))){_0x4d6ffa[_0x4494('0x1a')]=qs[_0x4494('0x1a')](_0x19df84['query'][_0x4494('0x1a')]);_0x4d6ffa[_0x4494('0x19')]=qs[_0x4494('0x19')](_0x19df84['query'][_0x4494('0x19')]);}_0x4d6ffa[_0x4494('0x37')]=qs[_0x4494('0x38')](_0x19df84[_0x4494('0x2f')]['sort']);_0x4d6ffa[_0x4494('0x39')]=qs[_0x4494('0x31')](_['pick'](_0x19df84[_0x4494('0x2f')],_0x58809b[_0x4494('0x31')]),_0x3e3f40);if(_0x19df84['query']['filter']){_0x4d6ffa[_0x4494('0x39')]=_['merge'](_0x4d6ffa['where'],{'$or':_['map'](_0x3e3f40,function(_0x7d64fc){if(_0x7d64fc[_0x4494('0x2c')]!==_0x4494('0x3a')){var _0xf30151={};_0xf30151[_0x7d64fc[_0x4494('0x27')]]={'$like':'%'+_0x19df84[_0x4494('0x2f')][_0x4494('0x3b')]+'%'};return _0xf30151;}})});}_0x4d6ffa=_[_0x4494('0x3c')]({},_0x4d6ffa,_0x19df84['options']);var _0x11c94f={'where':_0x4d6ffa[_0x4494('0x39')]};return db['SmsQueueReport'][_0x4494('0x1c')](_0x11c94f)[_0x4494('0x22')](function(_0x2997b5){_0x764fcf['count']=_0x2997b5;if(_0x19df84[_0x4494('0x2f')][_0x4494('0x3d')]){_0x4d6ffa[_0x4494('0x3e')]=[{'all':!![]}];}return db[_0x4494('0x2a')][_0x4494('0x3f')](_0x4d6ffa);})[_0x4494('0x22')](function(_0x37ccbb){_0x764fcf[_0x4494('0x40')]=_0x37ccbb;return _0x764fcf;})[_0x4494('0x22')](respondWithFilteredResult(_0x161769,_0x4d6ffa))['catch'](handleError(_0x161769,null));};exports['show']=function(_0x7df4b2,_0x2ad2da){var _0x2321a7={'raw':!![],'where':{'id':_0x7df4b2[_0x4494('0x41')]['id']}},_0x448915={};_0x448915['model']=_[_0x4494('0x30')](db[_0x4494('0x2a')][_0x4494('0x2b')]);_0x448915[_0x4494('0x2f')]=_[_0x4494('0x30')](_0x7df4b2[_0x4494('0x2f')]);_0x448915[_0x4494('0x31')]=_[_0x4494('0x32')](_0x448915[_0x4494('0x2d')],_0x448915[_0x4494('0x2f')]);_0x2321a7[_0x4494('0x34')]=_['intersection'](_0x448915[_0x4494('0x2d')],qs[_0x4494('0x33')](_0x7df4b2[_0x4494('0x2f')][_0x4494('0x33')]));_0x2321a7[_0x4494('0x34')]=_0x2321a7[_0x4494('0x34')][_0x4494('0x35')]?_0x2321a7[_0x4494('0x34')]:_0x448915[_0x4494('0x2d')];if(_0x7df4b2[_0x4494('0x2f')][_0x4494('0x3d')]){_0x2321a7[_0x4494('0x3e')]=[{'all':!![]}];}_0x2321a7=_[_0x4494('0x3c')]({},_0x2321a7,_0x7df4b2[_0x4494('0x42')]);return db[_0x4494('0x2a')][_0x4494('0x43')](_0x2321a7)['then'](handleEntityNotFound(_0x2ad2da,null))[_0x4494('0x22')](respondWithResult(_0x2ad2da,null))[_0x4494('0x44')](handleError(_0x2ad2da,null));};exports['create']=function(_0x57cd42,_0x4f8902){return db[_0x4494('0x2a')][_0x4494('0x45')](_0x57cd42[_0x4494('0x46')],{})[_0x4494('0x22')](respondWithResult(_0x4f8902,0xc9))[_0x4494('0x44')](handleError(_0x4f8902,null));};exports[_0x4494('0x21')]=function(_0x1acb9d,_0x1169ff){if(_0x1acb9d[_0x4494('0x46')]['id']){delete _0x1acb9d[_0x4494('0x46')]['id'];}return db['SmsQueueReport'][_0x4494('0x43')]({'where':{'id':_0x1acb9d['params']['id']}})[_0x4494('0x22')](handleEntityNotFound(_0x1169ff,null))['then'](saveUpdates(_0x1acb9d[_0x4494('0x46')],null))[_0x4494('0x22')](respondWithResult(_0x1169ff,null))[_0x4494('0x44')](handleError(_0x1169ff,null));};exports['destroy']=function(_0x112b2c,_0x481b4a){return db[_0x4494('0x2a')][_0x4494('0x43')]({'where':{'id':_0x112b2c[_0x4494('0x41')]['id']}})[_0x4494('0x22')](handleEntityNotFound(_0x481b4a,null))[_0x4494('0x22')](removeEntity(_0x481b4a,null))[_0x4494('0x44')](handleError(_0x481b4a,null));};exports[_0x4494('0x47')]=function(_0x59e5f3,_0x3d5fd3){return db[_0x4494('0x2a')]['describe']()['then'](respondWithResult(_0x3d5fd3,null))[_0x4494('0x44')](handleError(_0x3d5fd3,null));}; \ No newline at end of file +var _0x0aab=['status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','index','rawAttributes','key','model','map','keys','attributes','intersection','fields','query','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0aab,0x80));var _0xb0aa=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x0aab[_0x120bc2];return _0x454a41;};'use strict';var emlformat=require(_0xb0aa('0x0'));var rimraf=require(_0xb0aa('0x1'));var zipdir=require(_0xb0aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0aa('0x3'));var moment=require(_0xb0aa('0x4'));var BPromise=require(_0xb0aa('0x5'));var Mustache=require(_0xb0aa('0x6'));var util=require(_0xb0aa('0x7'));var path=require('path');var sox=require(_0xb0aa('0x8'));var csv=require(_0xb0aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0aa('0xa'));var _=require(_0xb0aa('0xb'));var squel=require(_0xb0aa('0xc'));var crypto=require(_0xb0aa('0xd'));var jsforce=require(_0xb0aa('0xe'));var deskjs=require(_0xb0aa('0xf'));var toCsv=require(_0xb0aa('0x9'));var querystring=require(_0xb0aa('0x10'));var Papa=require('papaparse');var Redis=require(_0xb0aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb0aa('0x12'));var as=require(_0xb0aa('0x13'));var hardwareService=require(_0xb0aa('0x14'));var logger=require(_0xb0aa('0x15'))(_0xb0aa('0x16'));var utils=require(_0xb0aa('0x17'));var config=require(_0xb0aa('0x18'));var licenseUtil=require(_0xb0aa('0x19'));var db=require(_0xb0aa('0x1a'))['db'];function respondWithStatusCode(_0x4067b0,_0x3165c7){_0x3165c7=_0x3165c7||0xcc;return function(_0x55bbc1){if(_0x55bbc1){return _0x4067b0[_0xb0aa('0x1b')](_0x3165c7);}return _0x4067b0[_0xb0aa('0x1c')](_0x3165c7)[_0xb0aa('0x1d')]();};}function respondWithResult(_0x3c2ff0,_0x5550bc){_0x5550bc=_0x5550bc||0xc8;return function(_0x4c1adc){if(_0x4c1adc){return _0x3c2ff0['status'](_0x5550bc)[_0xb0aa('0x1e')](_0x4c1adc);}};}function respondWithFilteredResult(_0x52859e,_0x1e9f09){return function(_0x2bd90d){if(_0x2bd90d){var _0x2b1c96=typeof _0x1e9f09[_0xb0aa('0x1f')]===_0xb0aa('0x20')&&typeof _0x1e9f09[_0xb0aa('0x21')]===_0xb0aa('0x20');var _0x491f36=_0x2bd90d['count'];var _0x231ad2=_0x2b1c96?0x0:_0x1e9f09[_0xb0aa('0x1f')];var _0x1a31a9=_0x2b1c96?_0x2bd90d[_0xb0aa('0x22')]:_0x1e9f09['offset']+_0x1e9f09['limit'];var _0x4541aa;if(_0x1a31a9>=_0x491f36){_0x1a31a9=_0x491f36;_0x4541aa=0xc8;}else{_0x4541aa=0xce;}_0x52859e['status'](_0x4541aa);return _0x52859e[_0xb0aa('0x23')]('Content-Range',_0x231ad2+'-'+_0x1a31a9+'/'+_0x491f36)[_0xb0aa('0x1e')](_0x2bd90d);}return null;};}function patchUpdates(_0x39249b){return function(_0x951584){try{jsonpatch[_0xb0aa('0x24')](_0x951584,_0x39249b,!![]);}catch(_0x242a00){return BPromise['reject'](_0x242a00);}return _0x951584['save']();};}function saveUpdates(_0x10be80,_0x4422a2){return function(_0x5119e0){if(_0x5119e0){return _0x5119e0[_0xb0aa('0x25')](_0x10be80)[_0xb0aa('0x26')](function(_0x260c82){return _0x260c82;});}return null;};}function removeEntity(_0xd86e9a,_0x4b7d3a){return function(_0x128c33){if(_0x128c33){return _0x128c33[_0xb0aa('0x27')]()[_0xb0aa('0x26')](function(){_0xd86e9a[_0xb0aa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa0536,_0x430fb3){return function(_0x151826){if(!_0x151826){_0xaa0536[_0xb0aa('0x1b')](0x194);}return _0x151826;};}function handleError(_0x511649,_0x5b333e){_0x5b333e=_0x5b333e||0x1f4;return function(_0x2acaa3){logger[_0xb0aa('0x28')](_0x2acaa3[_0xb0aa('0x29')]);if(_0x2acaa3[_0xb0aa('0x2a')]){delete _0x2acaa3[_0xb0aa('0x2a')];}_0x511649[_0xb0aa('0x1c')](_0x5b333e)[_0xb0aa('0x2b')](_0x2acaa3);};}exports[_0xb0aa('0x2c')]=function(_0x220df6,_0x327a9c){var _0x4aa830={},_0x3a8843={},_0x30771d={'count':0x0,'rows':[]};var _0x34a984=_['map'](db['SmsQueueReport'][_0xb0aa('0x2d')],function(_0x428a99){return{'name':_0x428a99['fieldName'],'type':_0x428a99['type'][_0xb0aa('0x2e')]};});_0x3a8843[_0xb0aa('0x2f')]=_[_0xb0aa('0x30')](_0x34a984,_0xb0aa('0x2a'));_0x3a8843['query']=_[_0xb0aa('0x31')](_0x220df6['query']);_0x3a8843['filters']=_['intersection'](_0x3a8843['model'],_0x3a8843['query']);_0x4aa830[_0xb0aa('0x32')]=_[_0xb0aa('0x33')](_0x3a8843['model'],qs[_0xb0aa('0x34')](_0x220df6[_0xb0aa('0x35')][_0xb0aa('0x34')]));_0x4aa830[_0xb0aa('0x32')]=_0x4aa830[_0xb0aa('0x32')][_0xb0aa('0x36')]?_0x4aa830[_0xb0aa('0x32')]:_0x3a8843['model'];if(!_0x220df6['query']['hasOwnProperty'](_0xb0aa('0x37'))){_0x4aa830[_0xb0aa('0x21')]=qs[_0xb0aa('0x21')](_0x220df6[_0xb0aa('0x35')][_0xb0aa('0x21')]);_0x4aa830[_0xb0aa('0x1f')]=qs[_0xb0aa('0x1f')](_0x220df6[_0xb0aa('0x35')][_0xb0aa('0x1f')]);}_0x4aa830[_0xb0aa('0x38')]=qs[_0xb0aa('0x39')](_0x220df6['query'][_0xb0aa('0x39')]);_0x4aa830[_0xb0aa('0x3a')]=qs[_0xb0aa('0x3b')](_[_0xb0aa('0x3c')](_0x220df6[_0xb0aa('0x35')],_0x3a8843['filters']),_0x34a984);if(_0x220df6[_0xb0aa('0x35')][_0xb0aa('0x3d')]){_0x4aa830[_0xb0aa('0x3a')]=_[_0xb0aa('0x3e')](_0x4aa830[_0xb0aa('0x3a')],{'$or':_[_0xb0aa('0x30')](_0x34a984,function(_0x3427ef){if(_0x3427ef[_0xb0aa('0x3f')]!==_0xb0aa('0x40')){var _0x140616={};_0x140616[_0x3427ef[_0xb0aa('0x2a')]]={'$like':'%'+_0x220df6[_0xb0aa('0x35')]['filter']+'%'};return _0x140616;}})});}_0x4aa830=_[_0xb0aa('0x3e')]({},_0x4aa830,_0x220df6[_0xb0aa('0x41')]);var _0x35d1ee={'where':_0x4aa830[_0xb0aa('0x3a')]};return db[_0xb0aa('0x42')][_0xb0aa('0x22')](_0x35d1ee)['then'](function(_0x30e397){_0x30771d[_0xb0aa('0x22')]=_0x30e397;if(_0x220df6[_0xb0aa('0x35')][_0xb0aa('0x43')]){_0x4aa830[_0xb0aa('0x44')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb0aa('0x45')](_0x4aa830);})['then'](function(_0x11d9c7){_0x30771d[_0xb0aa('0x46')]=_0x11d9c7;return _0x30771d;})[_0xb0aa('0x26')](respondWithFilteredResult(_0x327a9c,_0x4aa830))[_0xb0aa('0x47')](handleError(_0x327a9c,null));};exports[_0xb0aa('0x48')]=function(_0x3cae02,_0x5f1c96){var _0x5a6f00={'raw':!![],'where':{'id':_0x3cae02[_0xb0aa('0x49')]['id']}},_0x1558e0={};_0x1558e0[_0xb0aa('0x2f')]=_[_0xb0aa('0x31')](db[_0xb0aa('0x42')]['rawAttributes']);_0x1558e0[_0xb0aa('0x35')]=_[_0xb0aa('0x31')](_0x3cae02[_0xb0aa('0x35')]);_0x1558e0[_0xb0aa('0x3b')]=_[_0xb0aa('0x33')](_0x1558e0[_0xb0aa('0x2f')],_0x1558e0[_0xb0aa('0x35')]);_0x5a6f00[_0xb0aa('0x32')]=_[_0xb0aa('0x33')](_0x1558e0['model'],qs['fields'](_0x3cae02['query']['fields']));_0x5a6f00['attributes']=_0x5a6f00[_0xb0aa('0x32')][_0xb0aa('0x36')]?_0x5a6f00['attributes']:_0x1558e0[_0xb0aa('0x2f')];if(_0x3cae02['query'][_0xb0aa('0x43')]){_0x5a6f00[_0xb0aa('0x44')]=[{'all':!![]}];}_0x5a6f00=_[_0xb0aa('0x3e')]({},_0x5a6f00,_0x3cae02[_0xb0aa('0x41')]);return db[_0xb0aa('0x42')]['find'](_0x5a6f00)[_0xb0aa('0x26')](handleEntityNotFound(_0x5f1c96,null))[_0xb0aa('0x26')](respondWithResult(_0x5f1c96,null))[_0xb0aa('0x47')](handleError(_0x5f1c96,null));};exports[_0xb0aa('0x4a')]=function(_0xef91b7,_0x5f115d){return db[_0xb0aa('0x42')][_0xb0aa('0x4a')](_0xef91b7[_0xb0aa('0x4b')],{})[_0xb0aa('0x26')](respondWithResult(_0x5f115d,0xc9))['catch'](handleError(_0x5f115d,null));};exports[_0xb0aa('0x25')]=function(_0x59f937,_0x12039b){if(_0x59f937['body']['id']){delete _0x59f937[_0xb0aa('0x4b')]['id'];}return db[_0xb0aa('0x42')][_0xb0aa('0x4c')]({'where':{'id':_0x59f937[_0xb0aa('0x49')]['id']}})[_0xb0aa('0x26')](handleEntityNotFound(_0x12039b,null))[_0xb0aa('0x26')](saveUpdates(_0x59f937[_0xb0aa('0x4b')],null))[_0xb0aa('0x26')](respondWithResult(_0x12039b,null))[_0xb0aa('0x47')](handleError(_0x12039b,null));};exports['destroy']=function(_0x39c11e,_0x5f2ad9){return db[_0xb0aa('0x42')]['find']({'where':{'id':_0x39c11e[_0xb0aa('0x49')]['id']}})[_0xb0aa('0x26')](handleEntityNotFound(_0x5f2ad9,null))[_0xb0aa('0x26')](removeEntity(_0x5f2ad9,null))[_0xb0aa('0x47')](handleError(_0x5f2ad9,null));};exports[_0xb0aa('0x4d')]=function(_0xec9b5c,_0x2a85b3){return db[_0xb0aa('0x42')][_0xb0aa('0x4d')]()[_0xb0aa('0x26')](respondWithResult(_0x2a85b3,null))[_0xb0aa('0x47')](handleError(_0x2a85b3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0bf1579..83b2d36 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0xa69e0,_0x5a6bb6){var _0x3fc6d0=function(_0x339181){while(--_0x339181){_0xa69e0['push'](_0xa69e0['shift']());}};_0x3fc6d0(++_0x5a6bb6);}(_0x70e0,0x17b));var _0x070e=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0x70e0[_0x1b1948];return _0x3cbd38;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x4386ce,_0x2fd0b7){var _0x5de545=function(_0x4bfcda){while(--_0x4bfcda){_0x4386ce['push'](_0x4386ce['shift']());}};_0x5de545(++_0x2fd0b7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 21ca5c9..afa18db 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 _0x40ed=['catch','SmsQueueReport','create','body','options','CreateSmsQueueReport','debug','stringify','UpdateSmsQueueReport','update','raw','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x13fb4f,_0x42f6af){var _0x298a4e=function(_0x18c6c1){while(--_0x18c6c1){_0x13fb4f['push'](_0x13fb4f['shift']());}};_0x298a4e(++_0x42f6af);}(_0x40ed,0x123));var _0xd40e=function(_0x18056c,_0x22e9a2){_0x18056c=_0x18056c-0x0;var _0xe6068=_0x40ed[_0x18056c];return _0xe6068;};'use strict';var _=require(_0xd40e('0x0'));var util=require('util');var moment=require(_0xd40e('0x1'));var BPromise=require(_0xd40e('0x2'));var rs=require(_0xd40e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd40e('0x4'))['db'];var utils=require(_0xd40e('0x5'));var logger=require('../../config/logger')(_0xd40e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd40e('0x7')][_0xd40e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe795a6,_0x26cdc2,_0x5d5a3c){return new BPromise(function(_0x193278,_0x4f9655){return client[_0xd40e('0x9')](_0xe795a6,_0x5d5a3c)[_0xd40e('0xa')](function(_0x57e6a4){logger[_0xd40e('0xb')](_0xd40e('0xc'),_0x26cdc2,_0xd40e('0xd'));logger['debug'](_0xd40e('0xe'),_0x26cdc2,_0xd40e('0xd'),JSON['stringify'](_0x57e6a4));if(_0x57e6a4[_0xd40e('0xf')]){if(_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x10')]===0x1f4){logger[_0xd40e('0xf')](_0xd40e('0xc'),_0x26cdc2,_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);return _0x4f9655(_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);}logger[_0xd40e('0xf')](_0xd40e('0xc'),_0x26cdc2,_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);return _0x193278(_0x57e6a4[_0xd40e('0xf')][_0xd40e('0x11')]);}else{logger['info'](_0xd40e('0xc'),_0x26cdc2,_0xd40e('0xd'));_0x193278(_0x57e6a4[_0xd40e('0x12')]['message']);}})[_0xd40e('0x13')](function(_0xb88cd6){logger[_0xd40e('0xf')](_0xd40e('0xc'),_0x26cdc2,_0xb88cd6);_0x4f9655(_0xb88cd6);});});}exports['CreateSmsQueueReport']=function(_0x3fb314){var _0x47cb1c=this;return new Promise(function(_0x4bc50d,_0x180fb4){return db[_0xd40e('0x14')][_0xd40e('0x15')](_0x3fb314[_0xd40e('0x16')],{'raw':_0x3fb314[_0xd40e('0x17')]?_0x3fb314[_0xd40e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd40e('0xa')](function(_0x425b73){logger[_0xd40e('0xb')](_0xd40e('0x18'),_0x3fb314);logger[_0xd40e('0x19')](_0xd40e('0x18'),_0x3fb314,JSON[_0xd40e('0x1a')](_0x425b73));_0x4bc50d(_0x425b73);})[_0xd40e('0x13')](function(_0xac4746){logger[_0xd40e('0xf')](_0xd40e('0x18'),_0xac4746[_0xd40e('0x11')],_0x3fb314);_0x180fb4(_0x47cb1c[_0xd40e('0xf')](0x1f4,_0xac4746['message']));});});};exports[_0xd40e('0x1b')]=function(_0x2cca63){var _0x4a4b42=this;return new Promise(function(_0x5bef9a,_0x4c83e5){return db[_0xd40e('0x14')][_0xd40e('0x1c')](_0x2cca63[_0xd40e('0x16')],{'raw':_0x2cca63[_0xd40e('0x17')]?_0x2cca63[_0xd40e('0x17')][_0xd40e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cca63[_0xd40e('0x17')]?_0x2cca63['options']['where']||null:null,'attributes':_0x2cca63[_0xd40e('0x17')]?_0x2cca63[_0xd40e('0x17')][_0xd40e('0x1e')]||null:null,'limit':_0x2cca63[_0xd40e('0x17')]?_0x2cca63[_0xd40e('0x17')]['limit']||null:null})[_0xd40e('0xa')](function(_0xc3df08){logger['info']('UpdateSmsQueueReport',_0x2cca63);logger[_0xd40e('0x19')](_0xd40e('0x1b'),_0x2cca63,JSON[_0xd40e('0x1a')](_0xc3df08));_0x5bef9a(_0xc3df08);})[_0xd40e('0x13')](function(_0xe341f2){logger[_0xd40e('0xf')]('UpdateSmsQueueReport',_0xe341f2[_0xd40e('0x11')],_0x2cca63);_0x4c83e5(_0x4a4b42[_0xd40e('0xf')](0x1f4,_0xe341f2[_0xd40e('0x11')]));});});}; \ No newline at end of file +var _0x1ce4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','moment','bluebird'];(function(_0x4819c1,_0x11e719){var _0x45d265=function(_0x339f3f){while(--_0x339f3f){_0x4819c1['push'](_0x4819c1['shift']());}};_0x45d265(++_0x11e719);}(_0x1ce4,0xc3));var _0x41ce=function(_0x5cd0d3,_0x4979af){_0x5cd0d3=_0x5cd0d3-0x0;var _0x579dd8=_0x1ce4[_0x5cd0d3];return _0x579dd8;};'use strict';var _=require(_0x41ce('0x0'));var util=require('util');var moment=require(_0x41ce('0x1'));var BPromise=require(_0x41ce('0x2'));var rs=require(_0x41ce('0x3'));var fs=require('fs');var Redis=require(_0x41ce('0x4'));var db=require(_0x41ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41ce('0x6'))(_0x41ce('0x7'));var config=require(_0x41ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x41ce('0x9')][_0x41ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24aa08,_0xeec27b,_0x394ab0){return new BPromise(function(_0x27a053,_0x554147){return client[_0x41ce('0xb')](_0x24aa08,_0x394ab0)[_0x41ce('0xc')](function(_0x4ed1d7){logger['info'](_0x41ce('0xd'),_0xeec27b,'request\x20sent');logger[_0x41ce('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xeec27b,_0x41ce('0xf'),JSON[_0x41ce('0x10')](_0x4ed1d7));if(_0x4ed1d7[_0x41ce('0x11')]){if(_0x4ed1d7[_0x41ce('0x11')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0xeec27b,_0x4ed1d7[_0x41ce('0x11')][_0x41ce('0x12')]);return _0x554147(_0x4ed1d7[_0x41ce('0x11')]['message']);}logger['error'](_0x41ce('0xd'),_0xeec27b,_0x4ed1d7['error']['message']);return _0x27a053(_0x4ed1d7[_0x41ce('0x11')]['message']);}else{logger[_0x41ce('0x13')](_0x41ce('0xd'),_0xeec27b,_0x41ce('0xf'));_0x27a053(_0x4ed1d7[_0x41ce('0x14')][_0x41ce('0x12')]);}})[_0x41ce('0x15')](function(_0x957fb7){logger[_0x41ce('0x11')](_0x41ce('0xd'),_0xeec27b,_0x957fb7);_0x554147(_0x957fb7);});});}exports[_0x41ce('0x16')]=function(_0x46c0ed){var _0x44cac4=this;return new Promise(function(_0x48c908,_0x177cfb){return db[_0x41ce('0x17')][_0x41ce('0x18')](_0x46c0ed[_0x41ce('0x19')],{'raw':_0x46c0ed[_0x41ce('0x1a')]?_0x46c0ed[_0x41ce('0x1a')][_0x41ce('0x1b')]===undefined?!![]:![]:!![]})[_0x41ce('0xc')](function(_0x400cc3){logger[_0x41ce('0x13')](_0x41ce('0x16'),_0x46c0ed);logger['debug'](_0x41ce('0x16'),_0x46c0ed,JSON[_0x41ce('0x10')](_0x400cc3));_0x48c908(_0x400cc3);})['catch'](function(_0x47e2f6){logger[_0x41ce('0x11')](_0x41ce('0x16'),_0x47e2f6[_0x41ce('0x12')],_0x46c0ed);_0x177cfb(_0x44cac4[_0x41ce('0x11')](0x1f4,_0x47e2f6['message']));});});};exports[_0x41ce('0x1c')]=function(_0x3628c7){var _0x55f637=this;return new Promise(function(_0x3a32c2,_0x488e59){return db[_0x41ce('0x17')][_0x41ce('0x1d')](_0x3628c7[_0x41ce('0x19')],{'raw':_0x3628c7[_0x41ce('0x1a')]?_0x3628c7['options'][_0x41ce('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3628c7[_0x41ce('0x1a')]?_0x3628c7[_0x41ce('0x1a')][_0x41ce('0x1e')]||null:null,'attributes':_0x3628c7['options']?_0x3628c7[_0x41ce('0x1a')][_0x41ce('0x1f')]||null:null,'limit':_0x3628c7['options']?_0x3628c7['options'][_0x41ce('0x20')]||null:null})[_0x41ce('0xc')](function(_0x422374){logger[_0x41ce('0x13')]('UpdateSmsQueueReport',_0x3628c7);logger[_0x41ce('0xe')](_0x41ce('0x1c'),_0x3628c7,JSON[_0x41ce('0x10')](_0x422374));_0x3a32c2(_0x422374);})[_0x41ce('0x15')](function(_0x4b7d7e){logger['error'](_0x41ce('0x1c'),_0x4b7d7e[_0x41ce('0x12')],_0x3628c7);_0x488e59(_0x55f637[_0x41ce('0x11')](0x1f4,_0x4b7d7e[_0x41ce('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7da8e57..a7986d4 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 _0xd67b=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy'];(function(_0x5d2c9,_0x3f910d){var _0x327730=function(_0x146c20){while(--_0x146c20){_0x5d2c9['push'](_0x5d2c9['shift']());}};_0x327730(++_0x3f910d);}(_0xd67b,0x133));var _0xbd67=function(_0x5c67a2,_0x259b7c){_0x5c67a2=_0x5c67a2-0x0;var _0x53bbcc=_0xd67b[_0x5c67a2];return _0x53bbcc;};'use strict';var multer=require('multer');var util=require(_0xbd67('0x0'));var path=require('path');var timeout=require(_0xbd67('0x1'));var express=require(_0xbd67('0x2'));var router=express[_0xbd67('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbd67('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd67('0x5'));var controller=require('./smsTransferReport.controller');router[_0xbd67('0x6')]('/',auth[_0xbd67('0x7')](),controller[_0xbd67('0x8')]);router[_0xbd67('0x6')](_0xbd67('0x9'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xa')]);router[_0xbd67('0x6')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xc')]);router[_0xbd67('0xd')]('/',auth[_0xbd67('0x7')](),controller['create']);router['put'](_0xbd67('0xb'),auth['isAuthenticated'](),controller[_0xbd67('0xe')]);router[_0xbd67('0xf')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0x10')]);module[_0xbd67('0x11')]=router; \ No newline at end of file +var _0xf873=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x14aeff,_0x1e8ea7){var _0xa04f9f=function(_0xb48b4f){while(--_0xb48b4f){_0x14aeff['push'](_0x14aeff['shift']());}};_0xa04f9f(++_0x1e8ea7);}(_0xf873,0xb2));var _0x3f87=function(_0x2e439c,_0x2c2b08){_0x2e439c=_0x2e439c-0x0;var _0x190893=_0xf873[_0x2e439c];return _0x190893;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./smsTransferReport.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller['show']);router[_0x3f87('0xf')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0x10')]);router[_0x3f87('0x11')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x12')]);router[_0x3f87('0x13')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x14')]);module[_0x3f87('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1ae9d09..6d88826 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1419b5,_0x1c7dce){var _0x381c59=function(_0x1e6cfd){while(--_0x1e6cfd){_0x1419b5['push'](_0x1419b5['shift']());}};_0x381c59(++_0x1c7dce);}(_0xaa88,0x137));var _0x8aa8=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0xaa88[_0x5d6e30];return _0x3d3f3b;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x173dda,_0x511bac){var _0x524fcb=function(_0x1abeb1){while(--_0x1abeb1){_0x173dda['push'](_0x173dda['shift']());}};_0x524fcb(++_0x511bac);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1bae33,_0xdfa441){_0x1bae33=_0x1bae33-0x0;var _0x1af1c8=_0xf4eb[_0x1bae33];return _0x1af1c8;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e1c3312..251bdee 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 _0x067f=['offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x067f,0x7e));var _0xf067=function(_0x5868fd,_0x260693){_0x5868fd=_0x5868fd-0x0;var _0x46a9d6=_0x067f[_0x5868fd];return _0x46a9d6;};'use strict';var emlformat=require(_0xf067('0x0'));var rimraf=require(_0xf067('0x1'));var zipdir=require(_0xf067('0x2'));var jsonpatch=require(_0xf067('0x3'));var rp=require('request-promise');var moment=require(_0xf067('0x4'));var BPromise=require(_0xf067('0x5'));var Mustache=require(_0xf067('0x6'));var util=require(_0xf067('0x7'));var path=require(_0xf067('0x8'));var sox=require(_0xf067('0x9'));var csv=require(_0xf067('0xa'));var ejs=require(_0xf067('0xb'));var fs=require('fs');var fs_extra=require(_0xf067('0xc'));var _=require(_0xf067('0xd'));var squel=require(_0xf067('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf067('0xf'));var toCsv=require(_0xf067('0xa'));var querystring=require(_0xf067('0x10'));var Papa=require('papaparse');var Redis=require(_0xf067('0x11'));var authService=require(_0xf067('0x12'));var qs=require(_0xf067('0x13'));var as=require(_0xf067('0x14'));var hardwareService=require(_0xf067('0x15'));var logger=require('../../config/logger')(_0xf067('0x16'));var utils=require(_0xf067('0x17'));var config=require(_0xf067('0x18'));var licenseUtil=require(_0xf067('0x19'));var db=require(_0xf067('0x1a'))['db'];function respondWithStatusCode(_0x1e45da,_0x2d3716){_0x2d3716=_0x2d3716||0xcc;return function(_0x23a5df){if(_0x23a5df){return _0x1e45da[_0xf067('0x1b')](_0x2d3716);}return _0x1e45da['status'](_0x2d3716)[_0xf067('0x1c')]();};}function respondWithResult(_0xd8c9b9,_0xcdf4eb){_0xcdf4eb=_0xcdf4eb||0xc8;return function(_0x2c7638){if(_0x2c7638){return _0xd8c9b9['status'](_0xcdf4eb)[_0xf067('0x1d')](_0x2c7638);}};}function respondWithFilteredResult(_0x2401f9,_0x1ce7a0){return function(_0x33b0ff){if(_0x33b0ff){var _0x37b52c=typeof _0x1ce7a0['offset']==='undefined'&&typeof _0x1ce7a0[_0xf067('0x1e')]==='undefined';var _0x5aa46c=_0x33b0ff[_0xf067('0x1f')];var _0x5d80a7=_0x37b52c?0x0:_0x1ce7a0[_0xf067('0x20')];var _0x575c37=_0x37b52c?_0x33b0ff[_0xf067('0x1f')]:_0x1ce7a0[_0xf067('0x20')]+_0x1ce7a0['limit'];var _0xbf6472;if(_0x575c37>=_0x5aa46c){_0x575c37=_0x5aa46c;_0xbf6472=0xc8;}else{_0xbf6472=0xce;}_0x2401f9[_0xf067('0x21')](_0xbf6472);return _0x2401f9[_0xf067('0x22')](_0xf067('0x23'),_0x5d80a7+'-'+_0x575c37+'/'+_0x5aa46c)['json'](_0x33b0ff);}return null;};}function patchUpdates(_0x15388c){return function(_0x3c9fe9){try{jsonpatch[_0xf067('0x24')](_0x3c9fe9,_0x15388c,!![]);}catch(_0x4f3bbf){return BPromise[_0xf067('0x25')](_0x4f3bbf);}return _0x3c9fe9[_0xf067('0x26')]();};}function saveUpdates(_0x1b465d,_0x612837){return function(_0x212648){if(_0x212648){return _0x212648[_0xf067('0x27')](_0x1b465d)['then'](function(_0x44278b){return _0x44278b;});}return null;};}function removeEntity(_0x45d3f3,_0x47b818){return function(_0x3b9697){if(_0x3b9697){return _0x3b9697[_0xf067('0x28')]()[_0xf067('0x29')](function(){_0x45d3f3['status'](0xcc)[_0xf067('0x1c')]();});}};}function handleEntityNotFound(_0x34518a,_0x53f4ee){return function(_0xf76c03){if(!_0xf76c03){_0x34518a[_0xf067('0x1b')](0x194);}return _0xf76c03;};}function handleError(_0x3c000b,_0x1d07f8){_0x1d07f8=_0x1d07f8||0x1f4;return function(_0x1fe695){logger[_0xf067('0x2a')](_0x1fe695['stack']);if(_0x1fe695['name']){delete _0x1fe695[_0xf067('0x2b')];}_0x3c000b['status'](_0x1d07f8)[_0xf067('0x2c')](_0x1fe695);};}exports[_0xf067('0x2d')]=function(_0x3eda8a,_0x275887){var _0x3ba06d={},_0x87f89c={},_0x2714d1={'count':0x0,'rows':[]};var _0x4a8a11=_[_0xf067('0x2e')](db['SmsTransferReport']['rawAttributes'],function(_0x118e2f){return{'name':_0x118e2f[_0xf067('0x2f')],'type':_0x118e2f[_0xf067('0x30')][_0xf067('0x31')]};});_0x87f89c['model']=_[_0xf067('0x2e')](_0x4a8a11,_0xf067('0x2b'));_0x87f89c[_0xf067('0x32')]=_['keys'](_0x3eda8a['query']);_0x87f89c[_0xf067('0x33')]=_[_0xf067('0x34')](_0x87f89c[_0xf067('0x35')],_0x87f89c[_0xf067('0x32')]);_0x3ba06d['attributes']=_[_0xf067('0x34')](_0x87f89c[_0xf067('0x35')],qs[_0xf067('0x36')](_0x3eda8a[_0xf067('0x32')]['fields']));_0x3ba06d[_0xf067('0x37')]=_0x3ba06d[_0xf067('0x37')][_0xf067('0x38')]?_0x3ba06d[_0xf067('0x37')]:_0x87f89c[_0xf067('0x35')];if(!_0x3eda8a['query']['hasOwnProperty'](_0xf067('0x39'))){_0x3ba06d[_0xf067('0x1e')]=qs[_0xf067('0x1e')](_0x3eda8a[_0xf067('0x32')][_0xf067('0x1e')]);_0x3ba06d['offset']=qs[_0xf067('0x20')](_0x3eda8a[_0xf067('0x32')][_0xf067('0x20')]);}_0x3ba06d['order']=qs['sort'](_0x3eda8a['query'][_0xf067('0x3a')]);_0x3ba06d['where']=qs[_0xf067('0x33')](_[_0xf067('0x3b')](_0x3eda8a[_0xf067('0x32')],_0x87f89c['filters']),_0x4a8a11);if(_0x3eda8a[_0xf067('0x32')][_0xf067('0x3c')]){_0x3ba06d[_0xf067('0x3d')]=_[_0xf067('0x3e')](_0x3ba06d['where'],{'$or':_[_0xf067('0x2e')](_0x4a8a11,function(_0x4d69bb){if(_0x4d69bb[_0xf067('0x30')]!==_0xf067('0x3f')){var _0x22355d={};_0x22355d[_0x4d69bb[_0xf067('0x2b')]]={'$like':'%'+_0x3eda8a['query'][_0xf067('0x3c')]+'%'};return _0x22355d;}})});}_0x3ba06d=_[_0xf067('0x3e')]({},_0x3ba06d,_0x3eda8a[_0xf067('0x40')]);var _0x3579b5={'where':_0x3ba06d[_0xf067('0x3d')]};return db[_0xf067('0x41')][_0xf067('0x1f')](_0x3579b5)['then'](function(_0x2a6776){_0x2714d1['count']=_0x2a6776;if(_0x3eda8a[_0xf067('0x32')]['includeAll']){_0x3ba06d[_0xf067('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xf067('0x43')](_0x3ba06d);})[_0xf067('0x29')](function(_0x9bfb7b){_0x2714d1[_0xf067('0x44')]=_0x9bfb7b;return _0x2714d1;})[_0xf067('0x29')](respondWithFilteredResult(_0x275887,_0x3ba06d))[_0xf067('0x45')](handleError(_0x275887,null));};exports[_0xf067('0x46')]=function(_0x2eb5ee,_0x2a41c0){var _0xcb4c3={'raw':!![],'where':{'id':_0x2eb5ee[_0xf067('0x47')]['id']}},_0xb23d7d={};_0xb23d7d[_0xf067('0x35')]=_[_0xf067('0x48')](db[_0xf067('0x41')][_0xf067('0x49')]);_0xb23d7d[_0xf067('0x32')]=_[_0xf067('0x48')](_0x2eb5ee[_0xf067('0x32')]);_0xb23d7d['filters']=_[_0xf067('0x34')](_0xb23d7d['model'],_0xb23d7d[_0xf067('0x32')]);_0xcb4c3['attributes']=_[_0xf067('0x34')](_0xb23d7d[_0xf067('0x35')],qs[_0xf067('0x36')](_0x2eb5ee[_0xf067('0x32')][_0xf067('0x36')]));_0xcb4c3[_0xf067('0x37')]=_0xcb4c3[_0xf067('0x37')][_0xf067('0x38')]?_0xcb4c3[_0xf067('0x37')]:_0xb23d7d[_0xf067('0x35')];if(_0x2eb5ee[_0xf067('0x32')][_0xf067('0x4a')]){_0xcb4c3['include']=[{'all':!![]}];}_0xcb4c3=_[_0xf067('0x3e')]({},_0xcb4c3,_0x2eb5ee[_0xf067('0x40')]);return db[_0xf067('0x41')][_0xf067('0x4b')](_0xcb4c3)[_0xf067('0x29')](handleEntityNotFound(_0x2a41c0,null))[_0xf067('0x29')](respondWithResult(_0x2a41c0,null))['catch'](handleError(_0x2a41c0,null));};exports[_0xf067('0x4c')]=function(_0x5020df,_0x5c1abf){return db[_0xf067('0x41')][_0xf067('0x4c')](_0x5020df[_0xf067('0x4d')],{})[_0xf067('0x29')](respondWithResult(_0x5c1abf,0xc9))[_0xf067('0x45')](handleError(_0x5c1abf,null));};exports[_0xf067('0x27')]=function(_0x345360,_0x54ce89){if(_0x345360[_0xf067('0x4d')]['id']){delete _0x345360[_0xf067('0x4d')]['id'];}return db[_0xf067('0x41')][_0xf067('0x4b')]({'where':{'id':_0x345360['params']['id']}})[_0xf067('0x29')](handleEntityNotFound(_0x54ce89,null))['then'](saveUpdates(_0x345360[_0xf067('0x4d')],null))['then'](respondWithResult(_0x54ce89,null))[_0xf067('0x45')](handleError(_0x54ce89,null));};exports['destroy']=function(_0x54da52,_0x1c1fa4){return db[_0xf067('0x41')]['find']({'where':{'id':_0x54da52[_0xf067('0x47')]['id']}})[_0xf067('0x29')](handleEntityNotFound(_0x1c1fa4,null))[_0xf067('0x29')](removeEntity(_0x1c1fa4,null))[_0xf067('0x45')](handleError(_0x1c1fa4,null));};exports['describe']=function(_0x410203,_0x5a4383){return db[_0xf067('0x41')][_0xf067('0x4e')]()[_0xf067('0x29')](respondWithResult(_0x5a4383,null))['catch'](handleError(_0x5a4383,null));}; \ No newline at end of file +var _0xbfd8=['save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','describe','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x55b318,_0x530d80){var _0x4093b6=function(_0x5bb201){while(--_0x5bb201){_0x55b318['push'](_0x55b318['shift']());}};_0x4093b6(++_0x530d80);}(_0xbfd8,0x147));var _0x8bfd=function(_0x301f16,_0x70a095){_0x301f16=_0x301f16-0x0;var _0x358d25=_0xbfd8[_0x301f16];return _0x358d25;};'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(_0x8bfd('0x0'));var moment=require(_0x8bfd('0x1'));var BPromise=require(_0x8bfd('0x2'));var Mustache=require(_0x8bfd('0x3'));var util=require(_0x8bfd('0x4'));var path=require(_0x8bfd('0x5'));var sox=require(_0x8bfd('0x6'));var csv=require('to-csv');var ejs=require(_0x8bfd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bfd('0x8'));var squel=require(_0x8bfd('0x9'));var crypto=require(_0x8bfd('0xa'));var jsforce=require(_0x8bfd('0xb'));var deskjs=require(_0x8bfd('0xc'));var toCsv=require(_0x8bfd('0xd'));var querystring=require(_0x8bfd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8bfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8bfd('0x10'));var hardwareService=require(_0x8bfd('0x11'));var logger=require(_0x8bfd('0x12'))(_0x8bfd('0x13'));var utils=require(_0x8bfd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8bfd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x640c58,_0x128a85){_0x128a85=_0x128a85||0xcc;return function(_0x593ffc){if(_0x593ffc){return _0x640c58[_0x8bfd('0x16')](_0x128a85);}return _0x640c58[_0x8bfd('0x17')](_0x128a85)['end']();};}function respondWithResult(_0x51c53b,_0x4f34ba){_0x4f34ba=_0x4f34ba||0xc8;return function(_0x54fd05){if(_0x54fd05){return _0x51c53b[_0x8bfd('0x17')](_0x4f34ba)['json'](_0x54fd05);}};}function respondWithFilteredResult(_0x189024,_0x869025){return function(_0x4185b8){if(_0x4185b8){var _0xce8c36=typeof _0x869025[_0x8bfd('0x18')]===_0x8bfd('0x19')&&typeof _0x869025[_0x8bfd('0x1a')]===_0x8bfd('0x19');var _0x201237=_0x4185b8['count'];var _0x14c2b4=_0xce8c36?0x0:_0x869025[_0x8bfd('0x18')];var _0x522c47=_0xce8c36?_0x4185b8[_0x8bfd('0x1b')]:_0x869025[_0x8bfd('0x18')]+_0x869025[_0x8bfd('0x1a')];var _0x4c19cd;if(_0x522c47>=_0x201237){_0x522c47=_0x201237;_0x4c19cd=0xc8;}else{_0x4c19cd=0xce;}_0x189024[_0x8bfd('0x17')](_0x4c19cd);return _0x189024[_0x8bfd('0x1c')](_0x8bfd('0x1d'),_0x14c2b4+'-'+_0x522c47+'/'+_0x201237)[_0x8bfd('0x1e')](_0x4185b8);}return null;};}function patchUpdates(_0x56c2ac){return function(_0x365954){try{jsonpatch[_0x8bfd('0x1f')](_0x365954,_0x56c2ac,!![]);}catch(_0x22dceb){return BPromise[_0x8bfd('0x20')](_0x22dceb);}return _0x365954[_0x8bfd('0x21')]();};}function saveUpdates(_0x18eb46,_0x56de7a){return function(_0x557d3b){if(_0x557d3b){return _0x557d3b[_0x8bfd('0x22')](_0x18eb46)[_0x8bfd('0x23')](function(_0x17389c){return _0x17389c;});}return null;};}function removeEntity(_0x11a8ad,_0x40120d){return function(_0x2f7221){if(_0x2f7221){return _0x2f7221[_0x8bfd('0x24')]()[_0x8bfd('0x23')](function(){_0x11a8ad[_0x8bfd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e8fd,_0x2b18be){return function(_0x299194){if(!_0x299194){_0x24e8fd[_0x8bfd('0x16')](0x194);}return _0x299194;};}function handleError(_0x313aab,_0x4c96ee){_0x4c96ee=_0x4c96ee||0x1f4;return function(_0x2afe63){logger[_0x8bfd('0x25')](_0x2afe63[_0x8bfd('0x26')]);if(_0x2afe63[_0x8bfd('0x27')]){delete _0x2afe63[_0x8bfd('0x27')];}_0x313aab['status'](_0x4c96ee)['send'](_0x2afe63);};}exports[_0x8bfd('0x28')]=function(_0x493cd7,_0x3cab0f){var _0x1a93da={},_0x2e6ddd={},_0x55bff8={'count':0x0,'rows':[]};var _0x1173fb=_[_0x8bfd('0x29')](db[_0x8bfd('0x2a')][_0x8bfd('0x2b')],function(_0x2efa08){return{'name':_0x2efa08['fieldName'],'type':_0x2efa08['type'][_0x8bfd('0x2c')]};});_0x2e6ddd['model']=_['map'](_0x1173fb,'name');_0x2e6ddd[_0x8bfd('0x2d')]=_[_0x8bfd('0x2e')](_0x493cd7['query']);_0x2e6ddd[_0x8bfd('0x2f')]=_['intersection'](_0x2e6ddd[_0x8bfd('0x30')],_0x2e6ddd[_0x8bfd('0x2d')]);_0x1a93da[_0x8bfd('0x31')]=_['intersection'](_0x2e6ddd[_0x8bfd('0x30')],qs[_0x8bfd('0x32')](_0x493cd7[_0x8bfd('0x2d')]['fields']));_0x1a93da['attributes']=_0x1a93da[_0x8bfd('0x31')][_0x8bfd('0x33')]?_0x1a93da[_0x8bfd('0x31')]:_0x2e6ddd[_0x8bfd('0x30')];if(!_0x493cd7[_0x8bfd('0x2d')][_0x8bfd('0x34')](_0x8bfd('0x35'))){_0x1a93da['limit']=qs[_0x8bfd('0x1a')](_0x493cd7['query'][_0x8bfd('0x1a')]);_0x1a93da[_0x8bfd('0x18')]=qs[_0x8bfd('0x18')](_0x493cd7[_0x8bfd('0x2d')][_0x8bfd('0x18')]);}_0x1a93da['order']=qs[_0x8bfd('0x36')](_0x493cd7['query'][_0x8bfd('0x36')]);_0x1a93da['where']=qs[_0x8bfd('0x2f')](_[_0x8bfd('0x37')](_0x493cd7[_0x8bfd('0x2d')],_0x2e6ddd[_0x8bfd('0x2f')]),_0x1173fb);if(_0x493cd7[_0x8bfd('0x2d')]['filter']){_0x1a93da['where']=_[_0x8bfd('0x38')](_0x1a93da[_0x8bfd('0x39')],{'$or':_['map'](_0x1173fb,function(_0x1b332f){if(_0x1b332f['type']!=='VIRTUAL'){var _0xdd098a={};_0xdd098a[_0x1b332f['name']]={'$like':'%'+_0x493cd7['query'][_0x8bfd('0x3a')]+'%'};return _0xdd098a;}})});}_0x1a93da=_[_0x8bfd('0x38')]({},_0x1a93da,_0x493cd7[_0x8bfd('0x3b')]);var _0x11c6e5={'where':_0x1a93da[_0x8bfd('0x39')]};return db[_0x8bfd('0x2a')]['count'](_0x11c6e5)['then'](function(_0x4a36f6){_0x55bff8[_0x8bfd('0x1b')]=_0x4a36f6;if(_0x493cd7[_0x8bfd('0x2d')][_0x8bfd('0x3c')]){_0x1a93da[_0x8bfd('0x3d')]=[{'all':!![]}];}return db[_0x8bfd('0x2a')][_0x8bfd('0x3e')](_0x1a93da);})[_0x8bfd('0x23')](function(_0x2034aa){_0x55bff8[_0x8bfd('0x3f')]=_0x2034aa;return _0x55bff8;})[_0x8bfd('0x23')](respondWithFilteredResult(_0x3cab0f,_0x1a93da))['catch'](handleError(_0x3cab0f,null));};exports[_0x8bfd('0x40')]=function(_0x5bf88a,_0x3ef773){var _0x11e7c0={'raw':!![],'where':{'id':_0x5bf88a[_0x8bfd('0x41')]['id']}},_0x6723b4={};_0x6723b4[_0x8bfd('0x30')]=_[_0x8bfd('0x2e')](db[_0x8bfd('0x2a')][_0x8bfd('0x2b')]);_0x6723b4[_0x8bfd('0x2d')]=_[_0x8bfd('0x2e')](_0x5bf88a[_0x8bfd('0x2d')]);_0x6723b4[_0x8bfd('0x2f')]=_[_0x8bfd('0x42')](_0x6723b4['model'],_0x6723b4[_0x8bfd('0x2d')]);_0x11e7c0[_0x8bfd('0x31')]=_[_0x8bfd('0x42')](_0x6723b4[_0x8bfd('0x30')],qs['fields'](_0x5bf88a[_0x8bfd('0x2d')]['fields']));_0x11e7c0[_0x8bfd('0x31')]=_0x11e7c0[_0x8bfd('0x31')][_0x8bfd('0x33')]?_0x11e7c0[_0x8bfd('0x31')]:_0x6723b4[_0x8bfd('0x30')];if(_0x5bf88a['query'][_0x8bfd('0x3c')]){_0x11e7c0['include']=[{'all':!![]}];}_0x11e7c0=_['merge']({},_0x11e7c0,_0x5bf88a['options']);return db['SmsTransferReport'][_0x8bfd('0x43')](_0x11e7c0)['then'](handleEntityNotFound(_0x3ef773,null))[_0x8bfd('0x23')](respondWithResult(_0x3ef773,null))['catch'](handleError(_0x3ef773,null));};exports[_0x8bfd('0x44')]=function(_0x310d16,_0x3d3187){return db[_0x8bfd('0x2a')][_0x8bfd('0x44')](_0x310d16[_0x8bfd('0x45')],{})[_0x8bfd('0x23')](respondWithResult(_0x3d3187,0xc9))[_0x8bfd('0x46')](handleError(_0x3d3187,null));};exports[_0x8bfd('0x22')]=function(_0xaaf092,_0x450df0){if(_0xaaf092['body']['id']){delete _0xaaf092[_0x8bfd('0x45')]['id'];}return db[_0x8bfd('0x2a')][_0x8bfd('0x43')]({'where':{'id':_0xaaf092[_0x8bfd('0x41')]['id']}})[_0x8bfd('0x23')](handleEntityNotFound(_0x450df0,null))[_0x8bfd('0x23')](saveUpdates(_0xaaf092[_0x8bfd('0x45')],null))[_0x8bfd('0x23')](respondWithResult(_0x450df0,null))[_0x8bfd('0x46')](handleError(_0x450df0,null));};exports[_0x8bfd('0x24')]=function(_0x5b3799,_0x54c701){return db[_0x8bfd('0x2a')][_0x8bfd('0x43')]({'where':{'id':_0x5b3799['params']['id']}})[_0x8bfd('0x23')](handleEntityNotFound(_0x54c701,null))[_0x8bfd('0x23')](removeEntity(_0x54c701,null))[_0x8bfd('0x46')](handleError(_0x54c701,null));};exports[_0x8bfd('0x47')]=function(_0x189580,_0x4ccdbb){return db[_0x8bfd('0x2a')][_0x8bfd('0x47')]()[_0x8bfd('0x23')](respondWithResult(_0x4ccdbb,null))['catch'](handleError(_0x4ccdbb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 51a0ed4..0c72d41 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 _0xd679=['define','report_sms_transfer','uniqueid','lodash','api','moment','bluebird','path','rimraf','./smsTransferReport.attributes','exports'];(function(_0x3d14bd,_0x3e8c72){var _0x3c9ef9=function(_0x4a17df){while(--_0x4a17df){_0x3d14bd['push'](_0x3d14bd['shift']());}};_0x3c9ef9(++_0x3e8c72);}(_0xd679,0x14d));var _0x9d67=function(_0x4b32db,_0x4111e8){_0x4b32db=_0x4b32db-0x0;var _0x3b369d=_0xd679[_0x4b32db];return _0x3b369d;};'use strict';var _=require(_0x9d67('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d67('0x1'));var moment=require(_0x9d67('0x2'));var BPromise=require(_0x9d67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d67('0x4'));var rimraf=require(_0x9d67('0x5'));var config=require('../../config/environment');var attributes=require(_0x9d67('0x6'));module[_0x9d67('0x7')]=function(_0x24b2f4,_0x477014){return _0x24b2f4[_0x9d67('0x8')]('SmsTransferReport',attributes,{'tableName':_0x9d67('0x9'),'paranoid':![],'indexes':[{'name':_0x9d67('0xa'),'fields':[_0x9d67('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x850a=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4a73f2,_0xa4870d){var _0x7189be=function(_0x194b9d){while(--_0x194b9d){_0x4a73f2['push'](_0x4a73f2['shift']());}};_0x7189be(++_0xa4870d);}(_0x850a,0x123));var _0xa850=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x850a[_0x4914e2];return _0x2dcd07;};'use strict';var _=require(_0xa850('0x0'));var util=require(_0xa850('0x1'));var logger=require(_0xa850('0x2'))(_0xa850('0x3'));var moment=require(_0xa850('0x4'));var BPromise=require('bluebird');var rp=require(_0xa850('0x5'));var fs=require('fs');var path=require(_0xa850('0x6'));var rimraf=require(_0xa850('0x7'));var config=require(_0xa850('0x8'));var attributes=require(_0xa850('0x9'));module[_0xa850('0xa')]=function(_0x5501ab,_0x48a0a8){return _0x5501ab[_0xa850('0xb')](_0xa850('0xc'),attributes,{'tableName':_0xa850('0xd'),'paranoid':![],'indexes':[{'name':_0xa850('0xe'),'fields':[_0xa850('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4f22ded..b263ca6 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 _0xbe48=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','SmsTransferReport,\x20%s,\x20%s'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xbe48,0x121));var _0x8be4=function(_0x3e3193,_0x457ffa){_0x3e3193=_0x3e3193-0x0;var _0x58eaf5=_0xbe48[_0x3e3193];return _0x58eaf5;};'use strict';var _=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var moment=require(_0x8be4('0x2'));var BPromise=require(_0x8be4('0x3'));var rs=require(_0x8be4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8be4('0x5'));var logger=require(_0x8be4('0x6'))('rpc');var config=require(_0x8be4('0x7'));var jayson=require(_0x8be4('0x8'));var client=jayson[_0x8be4('0x9')][_0x8be4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe82da6,_0x4211b6,_0x35f862){return new BPromise(function(_0x554300,_0x3f87c6){return client[_0x8be4('0xb')](_0xe82da6,_0x35f862)['then'](function(_0x47ba2e){logger[_0x8be4('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4211b6,'request\x20sent');logger[_0x8be4('0xd')](_0x8be4('0xe'),_0x4211b6,_0x8be4('0xf'),JSON['stringify'](_0x47ba2e));if(_0x47ba2e['error']){if(_0x47ba2e['error'][_0x8be4('0x10')]===0x1f4){logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x47ba2e[_0x8be4('0x11')]['message']);return _0x3f87c6(_0x47ba2e['error'][_0x8be4('0x13')]);}logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x47ba2e[_0x8be4('0x11')]['message']);return _0x554300(_0x47ba2e[_0x8be4('0x11')]['message']);}else{logger[_0x8be4('0xc')](_0x8be4('0x12'),_0x4211b6,_0x8be4('0xf'));_0x554300(_0x47ba2e[_0x8be4('0x14')][_0x8be4('0x13')]);}})[_0x8be4('0x15')](function(_0x435906){logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x435906);_0x3f87c6(_0x435906);});});} \ No newline at end of file +var _0xa566=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info'];(function(_0x676eeb,_0xd633e7){var _0x100672=function(_0x2b5cc3){while(--_0x2b5cc3){_0x676eeb['push'](_0x676eeb['shift']());}};_0x100672(++_0xd633e7);}(_0xa566,0x1c1));var _0x6a56=function(_0x3af49f,_0xbb77f5){_0x3af49f=_0x3af49f-0x0;var _0x4297b1=_0xa566[_0x3af49f];return _0x4297b1;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var moment=require(_0x6a56('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a56('0x3'));var fs=require('fs');var Redis=require(_0x6a56('0x4'));var db=require(_0x6a56('0x5'))['db'];var utils=require(_0x6a56('0x6'));var logger=require('../../config/logger')(_0x6a56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3712ee,_0x50ae34,_0x472c60){return new BPromise(function(_0x4947a9,_0x33240c){return client[_0x6a56('0x8')](_0x3712ee,_0x472c60)['then'](function(_0x2f49ab){logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));logger['debug'](_0x6a56('0xc'),_0x50ae34,_0x6a56('0xb'),JSON['stringify'](_0x2f49ab));if(_0x2f49ab['error']){if(_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xe')]===0x1f4){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x33240c(_0x2f49ab[_0x6a56('0xd')]['message']);}logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x4947a9(_0x2f49ab[_0x6a56('0xd')]['message']);}else{logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));_0x4947a9(_0x2f49ab[_0x6a56('0x10')][_0x6a56('0xf')]);}})['catch'](function(_0x5e9895){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x5e9895);_0x33240c(_0x5e9895);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a86ad74..d8b3480 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 _0x87f7=['single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','extname'];(function(_0x873d48,_0x3cf3c0){var _0x50c8ca=function(_0x954fd0){while(--_0x954fd0){_0x873d48['push'](_0x873d48['shift']());}};_0x50c8ca(++_0x3cf3c0);}(_0x87f7,0x130));var _0x787f=function(_0x4fab9a,_0x3a390a){_0x4fab9a=_0x4fab9a-0x0;var _0x54aa91=_0x87f7[_0x4fab9a];return _0x54aa91;};'use strict';var multer=require(_0x787f('0x0'));var util=require(_0x787f('0x1'));var path=require(_0x787f('0x2'));var timeout=require(_0x787f('0x3'));var express=require(_0x787f('0x4'));var router=express[_0x787f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x787f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x787f('0x7')]('/',auth[_0x787f('0x8')](),controller[_0x787f('0x9')]);router[_0x787f('0x7')](_0x787f('0xa'),auth[_0x787f('0x8')](),controller[_0x787f('0xb')]);router['get'](_0x787f('0xc'),auth[_0x787f('0x8')](),controller[_0x787f('0xd')]);var upload=multer({'storage':multer[_0x787f('0xe')]({'destination':function(_0x212cdc,_0x26b379,_0x5cf299){_0x5cf299(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x23e628,_0x2c548d,_0x3e758e){_0x2c548d[_0x787f('0xf')]=_0x2c548d[_0x787f('0xf')][_0x787f('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e758e(null,util[_0x787f('0x11')](_0x787f('0x12'),path['basename'](_0x2c548d[_0x787f('0xf')],path['extname'](_0x2c548d['originalname'])),Date['now'](),path[_0x787f('0x13')](_0x2c548d[_0x787f('0xf')])));}})});router['post']('/',upload[_0x787f('0x14')](_0x787f('0x15')),controller[_0x787f('0x16')]);router[_0x787f('0x17')]('/:id',auth[_0x787f('0x8')](),controller[_0x787f('0x18')]);router[_0x787f('0x19')]('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x787f('0x1a')]=router; \ No newline at end of file +var _0xf1de=['download','diskStorage','join','root','originalname','replace','%s-%s%s','extname','single','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download'];(function(_0x2c60d8,_0x2d01a1){var _0xf24735=function(_0x432108){while(--_0x432108){_0x2c60d8['push'](_0x2c60d8['shift']());}};_0xf24735(++_0x2d01a1);}(_0xf1de,0x1d9));var _0xef1d=function(_0x274fdc,_0x3bb4b7){_0x274fdc=_0x274fdc-0x0;var _0x5552da=_0xf1de[_0x274fdc];return _0x5552da;};'use strict';var multer=require(_0xef1d('0x0'));var util=require(_0xef1d('0x1'));var path=require(_0xef1d('0x2'));var timeout=require('connect-timeout');var express=require(_0xef1d('0x3'));var router=express['Router']();var fs_extra=require(_0xef1d('0x4'));var auth=require(_0xef1d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef1d('0x6'));var controller=require(_0xef1d('0x7'));router[_0xef1d('0x8')]('/',auth[_0xef1d('0x9')](),controller[_0xef1d('0xa')]);router[_0xef1d('0x8')](_0xef1d('0xb'),auth[_0xef1d('0x9')](),controller['show']);router['get'](_0xef1d('0xc'),auth[_0xef1d('0x9')](),controller[_0xef1d('0xd')]);var upload=multer({'storage':multer[_0xef1d('0xe')]({'destination':function(_0x20a372,_0xbd0e4b,_0x56f648){_0x56f648(null,path[_0xef1d('0xf')](config[_0xef1d('0x10')],'server/files/sounds/original/'));},'filename':function(_0x1e151b,_0x548f90,_0x22d09){_0x548f90['originalname']=_0x548f90[_0xef1d('0x11')][_0xef1d('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x22d09(null,util['format'](_0xef1d('0x13'),path['basename'](_0x548f90['originalname'],path['extname'](_0x548f90['originalname'])),Date['now'](),path[_0xef1d('0x14')](_0x548f90[_0xef1d('0x11')])));}})});router['post']('/',upload[_0xef1d('0x15')]('file'),controller[_0xef1d('0x16')]);router[_0xef1d('0x17')]('/:id',auth[_0xef1d('0x9')](),controller[_0xef1d('0x18')]);router[_0xef1d('0x19')](_0xef1d('0xb'),auth[_0xef1d('0x9')](),controller[_0xef1d('0x19')]);module[_0xef1d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a551112..436609b 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 _0x244a=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x2ee97e,_0x5b7f3d){var _0x39412f=function(_0x2ccce5){while(--_0x2ccce5){_0x2ee97e['push'](_0x2ee97e['shift']());}};_0x39412f(++_0x5b7f3d);}(_0x244a,0x1ec));var _0xa244=function(_0x519dc2,_0x3b8548){_0x519dc2=_0x519dc2-0x0;var _0x53b69a=_0x244a[_0x519dc2];return _0x53b69a;};'use strict';var Sequelize=require(_0xa244('0x0'));module['exports']={'name':{'type':Sequelize[_0xa244('0x1')],'unique':_0xa244('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa244('0x1')]},'display_name':{'type':Sequelize[_0xa244('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa244('0x1')]},'original_format':{'type':Sequelize[_0xa244('0x1')]},'original_duration':{'type':Sequelize[_0xa244('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa244('0x4')]},'original_channelCount':{'type':Sequelize[_0xa244('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa244('0x5')]},'converted_format':{'type':Sequelize[_0xa244('0x1')]},'converted_duration':{'type':Sequelize[_0xa244('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xa244('0x4')]},'converted_channelCount':{'type':Sequelize[_0xa244('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa244('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa244('0x5')]}}; \ No newline at end of file +var _0x35fa=['INTEGER','FLOAT','BIGINT','sequelize','exports','STRING','name'];(function(_0x3c2efd,_0x405f28){var _0x433b01=function(_0xd9f231){while(--_0xd9f231){_0x3c2efd['push'](_0x3c2efd['shift']());}};_0x433b01(++_0x405f28);}(_0x35fa,0xb2));var _0xa35f=function(_0x396b02,_0x20798d){_0x396b02=_0x396b02-0x0;var _0x2c227c=_0x35fa[_0x396b02];return _0x2c227c;};'use strict';var Sequelize=require(_0xa35f('0x0'));module[_0xa35f('0x1')]={'name':{'type':Sequelize[_0xa35f('0x2')],'unique':_0xa35f('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa35f('0x2')]},'display_name':{'type':Sequelize[_0xa35f('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xa35f('0x2')]},'original_format':{'type':Sequelize[_0xa35f('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xa35f('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa35f('0x4')]},'converted_format':{'type':Sequelize[_0xa35f('0x2')]},'converted_duration':{'type':Sequelize[_0xa35f('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xa35f('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xa35f('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2e4a4be..c297bca 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 _0xba5a=['root','format','%s.%s','create','originalname','extname','basename','file','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','rimraf','fast-json-patch','request-promise','moment','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','destroy','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xba5a,0x1b1));var _0xaba5=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xba5a[_0x1dd532];return _0x3732aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaba5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaba5('0x1'));var rp=require(_0xaba5('0x2'));var moment=require(_0xaba5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaba5('0x4'));var path=require(_0xaba5('0x5'));var sox=require(_0xaba5('0x6'));var csv=require(_0xaba5('0x7'));var ejs=require(_0xaba5('0x8'));var fs=require('fs');var fs_extra=require(_0xaba5('0x9'));var _=require('lodash');var squel=require(_0xaba5('0xa'));var crypto=require(_0xaba5('0xb'));var jsforce=require(_0xaba5('0xc'));var deskjs=require(_0xaba5('0xd'));var toCsv=require(_0xaba5('0x7'));var querystring=require(_0xaba5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaba5('0xf'));var qs=require(_0xaba5('0x10'));var as=require(_0xaba5('0x11'));var hardwareService=require(_0xaba5('0x12'));var logger=require(_0xaba5('0x13'))(_0xaba5('0x14'));var utils=require(_0xaba5('0x15'));var config=require(_0xaba5('0x16'));var licenseUtil=require(_0xaba5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bcf0,_0x299080){_0x299080=_0x299080||0xcc;return function(_0x3b2a47){if(_0x3b2a47){return _0x54bcf0[_0xaba5('0x18')](_0x299080);}return _0x54bcf0[_0xaba5('0x19')](_0x299080)[_0xaba5('0x1a')]();};}function respondWithResult(_0xf78084,_0x50e0fe){_0x50e0fe=_0x50e0fe||0xc8;return function(_0x63bd39){if(_0x63bd39){return _0xf78084[_0xaba5('0x19')](_0x50e0fe)[_0xaba5('0x1b')](_0x63bd39);}};}function respondWithFilteredResult(_0x2794eb,_0x4a211){return function(_0x4a7043){if(_0x4a7043){var _0x33c131=typeof _0x4a211[_0xaba5('0x1c')]===_0xaba5('0x1d')&&typeof _0x4a211[_0xaba5('0x1e')]==='undefined';var _0x255f9f=_0x4a7043['count'];var _0x220676=_0x33c131?0x0:_0x4a211['offset'];var _0x1cbe18=_0x33c131?_0x4a7043[_0xaba5('0x1f')]:_0x4a211[_0xaba5('0x1c')]+_0x4a211['limit'];var _0x8034e1;if(_0x1cbe18>=_0x255f9f){_0x1cbe18=_0x255f9f;_0x8034e1=0xc8;}else{_0x8034e1=0xce;}_0x2794eb[_0xaba5('0x19')](_0x8034e1);return _0x2794eb[_0xaba5('0x20')]('Content-Range',_0x220676+'-'+_0x1cbe18+'/'+_0x255f9f)[_0xaba5('0x1b')](_0x4a7043);}return null;};}function patchUpdates(_0xd77007){return function(_0xab073d){try{jsonpatch[_0xaba5('0x21')](_0xab073d,_0xd77007,!![]);}catch(_0x568c22){return BPromise[_0xaba5('0x22')](_0x568c22);}return _0xab073d[_0xaba5('0x23')]();};}function saveUpdates(_0x2d55b9,_0x5da2de){return function(_0x1d2770){if(_0x1d2770){return _0x1d2770[_0xaba5('0x24')](_0x2d55b9)[_0xaba5('0x25')](function(_0x44df78){return _0x44df78;});}return null;};}function removeEntity(_0x11ea76,_0x17b9aa){return function(_0x254682){if(_0x254682){return _0x254682['destroy']()[_0xaba5('0x25')](function(){var _0x3a9023=_0x254682[_0xaba5('0x26')]({'plain':!![]});var _0x4c2ee3='Sounds';return db['UserProfileResource'][_0xaba5('0x27')]({'where':{'type':_0x4c2ee3,'resourceId':_0x3a9023['id']}})[_0xaba5('0x25')](function(){return _0x254682;});})[_0xaba5('0x25')](function(){_0x11ea76[_0xaba5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240827,_0x401b48){return function(_0xfdad7a){if(!_0xfdad7a){_0x240827[_0xaba5('0x18')](0x194);}return _0xfdad7a;};}function handleError(_0x4d9025,_0x248816){_0x248816=_0x248816||0x1f4;return function(_0x433a5d){logger[_0xaba5('0x28')](_0x433a5d[_0xaba5('0x29')]);if(_0x433a5d[_0xaba5('0x2a')]){delete _0x433a5d[_0xaba5('0x2a')];}_0x4d9025[_0xaba5('0x19')](_0x248816)[_0xaba5('0x2b')](_0x433a5d);};}exports[_0xaba5('0x2c')]=function(_0x5138a9,_0x75baea){var _0x24cf1b={},_0x51bb85={},_0x4986ff={'count':0x0,'rows':[]};var _0x3996a5=_['map'](db[_0xaba5('0x2d')][_0xaba5('0x2e')],function(_0x5aebb5){return{'name':_0x5aebb5[_0xaba5('0x2f')],'type':_0x5aebb5[_0xaba5('0x30')][_0xaba5('0x31')]};});_0x51bb85[_0xaba5('0x32')]=_[_0xaba5('0x33')](_0x3996a5,'name');_0x51bb85['query']=_[_0xaba5('0x34')](_0x5138a9[_0xaba5('0x35')]);_0x51bb85['filters']=_[_0xaba5('0x36')](_0x51bb85['model'],_0x51bb85[_0xaba5('0x35')]);_0x24cf1b[_0xaba5('0x37')]=_[_0xaba5('0x36')](_0x51bb85[_0xaba5('0x32')],qs[_0xaba5('0x38')](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x38')]));_0x24cf1b[_0xaba5('0x37')]=_0x24cf1b[_0xaba5('0x37')][_0xaba5('0x39')]?_0x24cf1b[_0xaba5('0x37')]:_0x51bb85[_0xaba5('0x32')];if(!_0x5138a9[_0xaba5('0x35')]['hasOwnProperty'](_0xaba5('0x3a'))){_0x24cf1b[_0xaba5('0x1e')]=qs[_0xaba5('0x1e')](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x1e')]);_0x24cf1b[_0xaba5('0x1c')]=qs['offset'](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x1c')]);}_0x24cf1b[_0xaba5('0x3b')]=qs[_0xaba5('0x3c')](_0x5138a9[_0xaba5('0x35')][_0xaba5('0x3c')]);_0x24cf1b[_0xaba5('0x3d')]=qs[_0xaba5('0x3e')](_[_0xaba5('0x3f')](_0x5138a9['query'],_0x51bb85[_0xaba5('0x3e')]),_0x3996a5);if(_0x5138a9[_0xaba5('0x35')][_0xaba5('0x40')]){_0x24cf1b[_0xaba5('0x3d')]=_[_0xaba5('0x41')](_0x24cf1b[_0xaba5('0x3d')],{'$or':_[_0xaba5('0x33')](_0x3996a5,function(_0x284651){if(_0x284651['type']!==_0xaba5('0x42')){var _0x3d6d3d={};_0x3d6d3d[_0x284651[_0xaba5('0x2a')]]={'$like':'%'+_0x5138a9[_0xaba5('0x35')][_0xaba5('0x40')]+'%'};return _0x3d6d3d;}})});}_0x24cf1b=_['merge']({},_0x24cf1b,_0x5138a9[_0xaba5('0x43')]);var _0x9195bc={'where':_0x24cf1b[_0xaba5('0x3d')]};return db[_0xaba5('0x2d')][_0xaba5('0x1f')](_0x9195bc)[_0xaba5('0x25')](function(_0xa2ec58){_0x4986ff[_0xaba5('0x1f')]=_0xa2ec58;if(_0x5138a9[_0xaba5('0x35')][_0xaba5('0x44')]){_0x24cf1b[_0xaba5('0x45')]=[{'all':!![]}];}return db['Sound'][_0xaba5('0x46')](_0x24cf1b);})[_0xaba5('0x25')](function(_0x39be3b){_0x4986ff[_0xaba5('0x47')]=_0x39be3b;return _0x4986ff;})[_0xaba5('0x25')](respondWithFilteredResult(_0x75baea,_0x24cf1b))['catch'](handleError(_0x75baea,null));};exports['show']=function(_0x476147,_0x3d388a){var _0xe59101={'raw':!![],'where':{'id':_0x476147[_0xaba5('0x48')]['id']}},_0x52ccb0={};_0x52ccb0[_0xaba5('0x32')]=_[_0xaba5('0x34')](db[_0xaba5('0x2d')][_0xaba5('0x2e')]);_0x52ccb0[_0xaba5('0x35')]=_[_0xaba5('0x34')](_0x476147[_0xaba5('0x35')]);_0x52ccb0[_0xaba5('0x3e')]=_[_0xaba5('0x36')](_0x52ccb0[_0xaba5('0x32')],_0x52ccb0[_0xaba5('0x35')]);_0xe59101[_0xaba5('0x37')]=_['intersection'](_0x52ccb0[_0xaba5('0x32')],qs[_0xaba5('0x38')](_0x476147['query'][_0xaba5('0x38')]));_0xe59101[_0xaba5('0x37')]=_0xe59101['attributes'][_0xaba5('0x39')]?_0xe59101[_0xaba5('0x37')]:_0x52ccb0[_0xaba5('0x32')];if(_0x476147['query'][_0xaba5('0x44')]){_0xe59101['include']=[{'all':!![]}];}_0xe59101=_['merge']({},_0xe59101,_0x476147[_0xaba5('0x43')]);return db['Sound'][_0xaba5('0x49')](_0xe59101)['then'](handleEntityNotFound(_0x3d388a,null))['then'](respondWithResult(_0x3d388a,null))[_0xaba5('0x4a')](handleError(_0x3d388a,null));};exports['download']=function(_0x1cfd12,_0xabd6ef,_0x332c3e){return db['Sound'][_0xaba5('0x49')]({'where':{'id':_0x1cfd12['params']['id']},'attributes':[_0xaba5('0x2a'),_0xaba5('0x4b'),_0xaba5('0x4c')],'raw':!![]})[_0xaba5('0x25')](handleEntityNotFound(_0xabd6ef,null))[_0xaba5('0x25')](function(_0xe64d31){if(_0xe64d31){if(!fs[_0xaba5('0x4d')](path['join'](config['root'],_0xaba5('0x4e'),_0xe64d31[_0xaba5('0x4b')]+'.'+_0xe64d31[_0xaba5('0x4c')]))){throw new db[(_0xaba5('0x4f'))]['ValidationError'](_0xaba5('0x50'));}return _0xabd6ef[_0xaba5('0x51')](path[_0xaba5('0x52')](config[_0xaba5('0x53')],_0xaba5('0x4e'),util[_0xaba5('0x54')]('%s.%s',_0xe64d31['save_name'],_0xe64d31['converted_format'])),util['format'](_0xaba5('0x55'),_0xe64d31[_0xaba5('0x2a')],_0xe64d31[_0xaba5('0x4c')]));}return null;})[_0xaba5('0x4a')](handleError(_0xabd6ef,null));};exports[_0xaba5('0x56')]=function(_0x2fee70,_0x17f350,_0x5a346b){var _0x1fbf7f={'name':path['basename'](_0x2fee70['file'][_0xaba5('0x57')],path[_0xaba5('0x58')](_0x2fee70['file'][_0xaba5('0x57')])),'save_name':path[_0xaba5('0x59')](_0x2fee70[_0xaba5('0x5a')]['filename'],path[_0xaba5('0x58')](_0x2fee70['file']['filename'])),'original_format':path[_0xaba5('0x58')](_0x2fee70[_0xaba5('0x5a')]['originalname'])[_0xaba5('0x5b')](0x1),'converted_format':_0xaba5('0x5c')};var _0xf80a21=path[_0xaba5('0x52')](config[_0xaba5('0x53')],_0xaba5('0x5d'),_0x2fee70[_0xaba5('0x5a')][_0xaba5('0x5e')]);var _0x3bc7ff=path[_0xaba5('0x52')](config[_0xaba5('0x53')],_0xaba5('0x4e'),util[_0xaba5('0x54')]('%s.%s',path[_0xaba5('0x59')](_0x2fee70[_0xaba5('0x5a')][_0xaba5('0x5e')],path[_0xaba5('0x58')](_0x2fee70[_0xaba5('0x5a')][_0xaba5('0x5e')])),_0x1fbf7f[_0xaba5('0x4c')]));logger[_0xaba5('0x5f')](_0xaba5('0x60'),_0xf80a21);logger[_0xaba5('0x5f')](_0xaba5('0x61'),_0x3bc7ff);try{fs[_0xaba5('0x62')](_0xf80a21,parseInt(_0xaba5('0x63'),0x8));var _0x13ce5d=sox[_0xaba5('0x64')](_0xf80a21,_0x3bc7ff,{'sampleRate':0x1f40,'format':_0xaba5('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13ce5d['on'](_0xaba5('0x28'),function(_0xdcac21){fs[_0xaba5('0x65')](_0xf80a21);_0x17f350[_0xaba5('0x19')](0x1f4)[_0xaba5('0x2b')](_0xdcac21);});_0x13ce5d['on']('src',function(_0x1afec2){_0x1fbf7f[_0xaba5('0x66')]=isNaN(_0x1afec2[_0xaba5('0x67')])?null:_0x1afec2[_0xaba5('0x67')]*0x3e8;_0x1fbf7f[_0xaba5('0x68')]=isNaN(_0x1afec2['sampleCount'])?null:_0x1afec2[_0xaba5('0x69')];_0x1fbf7f['original_channelCount']=isNaN(_0x1afec2[_0xaba5('0x6a')])?null:_0x1afec2['channelCount'];_0x1fbf7f[_0xaba5('0x6b')]=isNaN(_0x1afec2[_0xaba5('0x6c')])?null:_0x1afec2[_0xaba5('0x6c')];_0x1fbf7f[_0xaba5('0x6d')]=isNaN(_0x1afec2[_0xaba5('0x6e')])?null:_0x1afec2[_0xaba5('0x6e')];});_0x13ce5d['on'](_0xaba5('0x6f'),function(_0x5ec6a5){_0x1fbf7f[_0xaba5('0x70')]=isNaN(_0x5ec6a5[_0xaba5('0x67')])?null:_0x5ec6a5[_0xaba5('0x67')]*0x3e8;_0x1fbf7f['converted_sampleCount']=isNaN(_0x5ec6a5['sampleCount'])?null:_0x5ec6a5['sampleCount'];_0x1fbf7f[_0xaba5('0x71')]=isNaN(_0x5ec6a5[_0xaba5('0x6a')])?null:_0x5ec6a5[_0xaba5('0x6a')];_0x1fbf7f[_0xaba5('0x72')]=isNaN(_0x5ec6a5[_0xaba5('0x6c')])?null:_0x5ec6a5[_0xaba5('0x6c')];_0x1fbf7f[_0xaba5('0x73')]=isNaN(_0x5ec6a5[_0xaba5('0x6e')])?null:_0x5ec6a5['sampleRate'];});_0x13ce5d['on'](_0xaba5('0x1a'),function(){fs[_0xaba5('0x62')](_0x3bc7ff,parseInt(_0xaba5('0x63'),0x8));return db[_0xaba5('0x2d')][_0xaba5('0x56')](_0x1fbf7f)[_0xaba5('0x25')](function(_0x4a950e){var _0x2911f6={'role':_0x2fee70[_0xaba5('0x74')][_0xaba5('0x75')],'userProfileId':_0x2fee70[_0xaba5('0x74')][_0xaba5('0x76')]};if(!_0x2911f6)throw new Error(_0xaba5('0x77'));if(_0x2911f6['role']===_0xaba5('0x78')){var _0x1ef569=_0x4a950e[_0xaba5('0x26')]({'plain':!![]});return db[_0xaba5('0x79')]['find']({'where':{'name':_0xaba5('0x7a'),'userProfileId':_0x2911f6[_0xaba5('0x76')]},'raw':!![]})[_0xaba5('0x25')](function(_0x3d5f9b){if(_0x3d5f9b&&_0x3d5f9b[_0xaba5('0x7b')]===0x0){return db[_0xaba5('0x7c')][_0xaba5('0x56')]({'name':_0x1ef569[_0xaba5('0x2a')],'resourceId':_0x1ef569['id'],'type':_0x3d5f9b[_0xaba5('0x2a')],'sectionId':_0x3d5f9b['id']},{})['then'](function(){return _0x4a950e;});}else{return _0x4a950e;}})[_0xaba5('0x4a')](function(_0x1c2ee1){logger[_0xaba5('0x28')](_0xaba5('0x7d'),_0x1c2ee1);throw _0x1c2ee1;});}return _0x4a950e;})['then'](respondWithResult(_0x17f350,null))[_0xaba5('0x4a')](handleError(_0x17f350,null));});_0x13ce5d[_0xaba5('0x7e')]();}catch(_0x55b72b){_0x17f350[_0xaba5('0x19')](0x1f4)[_0xaba5('0x2b')](_0x55b72b);}};exports[_0xaba5('0x24')]=function(_0x2a25ab,_0x7acd84,_0x2a7124){return db[_0xaba5('0x2d')][_0xaba5('0x49')]({'where':{'id':_0x2a25ab['params']['id']}})[_0xaba5('0x25')](handleEntityNotFound(_0x7acd84,null))[_0xaba5('0x25')](saveUpdates(_[_0xaba5('0x3f')](_0x2a25ab[_0xaba5('0x74')],[_0xaba5('0x2a'),'description']),null))['then'](respondWithResult(_0x7acd84,null))[_0xaba5('0x4a')](handleError(_0x7acd84,null));};exports[_0xaba5('0x7f')]=function(_0x4dbe4f,_0x59b1f1,_0x19cdfd){return db['Sound'][_0xaba5('0x49')]({'where':{'id':_0x4dbe4f[_0xaba5('0x48')]['id']}})['then'](function(_0x1d08e5){if(_0x1d08e5){return _0x1d08e5[_0xaba5('0x27')]();}})['then'](function(_0xd3a5de){var _0x11813b=path['join'](config[_0xaba5('0x53')],_0xaba5('0x5d'),util[_0xaba5('0x54')]('%s.%s',_0xd3a5de['save_name'],_0xd3a5de[_0xaba5('0x80')]));var _0x29992a=path['join'](config[_0xaba5('0x53')],_0xaba5('0x4e'),util['format'](_0xaba5('0x55'),_0xd3a5de[_0xaba5('0x4b')],_0xd3a5de['converted_format']));fs[_0xaba5('0x65')](_0x11813b);fs[_0xaba5('0x65')](_0x29992a);return _0xd3a5de;})[_0xaba5('0x25')](function(_0x17b4aa){if(_0x17b4aa){return _0x59b1f1[_0xaba5('0x19')](0xcc)[_0xaba5('0x1a')]();}})['then'](handleEntityNotFound(_0x59b1f1,null))['catch'](handleError(_0x59b1f1,null));}; \ No newline at end of file +var _0x668f=['length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_sampleRate','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','original_format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','model','keys','query','filters','fields','attributes'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x668f,0x131));var _0xf668=function(_0x2c8b47,_0x4a3777){_0x2c8b47=_0x2c8b47-0x0;var _0x503983=_0x668f[_0x2c8b47];return _0x503983;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf668('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf668('0x1'));var rp=require(_0xf668('0x2'));var moment=require(_0xf668('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf668('0x4'));var util=require('util');var path=require(_0xf668('0x5'));var sox=require(_0xf668('0x6'));var csv=require(_0xf668('0x7'));var ejs=require(_0xf668('0x8'));var fs=require('fs');var fs_extra=require(_0xf668('0x9'));var _=require('lodash');var squel=require(_0xf668('0xa'));var crypto=require(_0xf668('0xb'));var jsforce=require(_0xf668('0xc'));var deskjs=require(_0xf668('0xd'));var toCsv=require(_0xf668('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf668('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf668('0xf'));var as=require(_0xf668('0x10'));var hardwareService=require(_0xf668('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf668('0x12'));var licenseUtil=require(_0xf668('0x13'));var db=require(_0xf668('0x14'))['db'];function respondWithStatusCode(_0x281f92,_0x5dc5fe){_0x5dc5fe=_0x5dc5fe||0xcc;return function(_0x34aa8d){if(_0x34aa8d){return _0x281f92[_0xf668('0x15')](_0x5dc5fe);}return _0x281f92[_0xf668('0x16')](_0x5dc5fe)[_0xf668('0x17')]();};}function respondWithResult(_0x3da670,_0x3c098c){_0x3c098c=_0x3c098c||0xc8;return function(_0x4fcae8){if(_0x4fcae8){return _0x3da670[_0xf668('0x16')](_0x3c098c)[_0xf668('0x18')](_0x4fcae8);}};}function respondWithFilteredResult(_0x370a69,_0x20f1f6){return function(_0x39458f){if(_0x39458f){var _0xe8cbe2=typeof _0x20f1f6['offset']==='undefined'&&typeof _0x20f1f6[_0xf668('0x19')]==='undefined';var _0x114867=_0x39458f[_0xf668('0x1a')];var _0x46b8a2=_0xe8cbe2?0x0:_0x20f1f6[_0xf668('0x1b')];var _0x4e5309=_0xe8cbe2?_0x39458f['count']:_0x20f1f6[_0xf668('0x1b')]+_0x20f1f6['limit'];var _0x374474;if(_0x4e5309>=_0x114867){_0x4e5309=_0x114867;_0x374474=0xc8;}else{_0x374474=0xce;}_0x370a69[_0xf668('0x16')](_0x374474);return _0x370a69[_0xf668('0x1c')](_0xf668('0x1d'),_0x46b8a2+'-'+_0x4e5309+'/'+_0x114867)[_0xf668('0x18')](_0x39458f);}return null;};}function patchUpdates(_0x2c2deb){return function(_0x12d882){try{jsonpatch['apply'](_0x12d882,_0x2c2deb,!![]);}catch(_0x1dff32){return BPromise['reject'](_0x1dff32);}return _0x12d882[_0xf668('0x1e')]();};}function saveUpdates(_0x56c9ab,_0x27d17c){return function(_0xb58dfb){if(_0xb58dfb){return _0xb58dfb[_0xf668('0x1f')](_0x56c9ab)[_0xf668('0x20')](function(_0x5ca734){return _0x5ca734;});}return null;};}function removeEntity(_0x43d0d9,_0xe63902){return function(_0x34bfc3){if(_0x34bfc3){return _0x34bfc3[_0xf668('0x21')]()[_0xf668('0x20')](function(){var _0x4a8901=_0x34bfc3[_0xf668('0x22')]({'plain':!![]});var _0x538300=_0xf668('0x23');return db[_0xf668('0x24')][_0xf668('0x21')]({'where':{'type':_0x538300,'resourceId':_0x4a8901['id']}})['then'](function(){return _0x34bfc3;});})[_0xf668('0x20')](function(){_0x43d0d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x589733,_0x5a96a9){return function(_0x32d94d){if(!_0x32d94d){_0x589733[_0xf668('0x15')](0x194);}return _0x32d94d;};}function handleError(_0x539295,_0x596719){_0x596719=_0x596719||0x1f4;return function(_0xd55346){logger[_0xf668('0x25')](_0xd55346[_0xf668('0x26')]);if(_0xd55346[_0xf668('0x27')]){delete _0xd55346[_0xf668('0x27')];}_0x539295[_0xf668('0x16')](_0x596719)[_0xf668('0x28')](_0xd55346);};}exports['index']=function(_0x3598b8,_0x57e8bb){var _0x2c6b0e={},_0x11742d={},_0x246e3b={'count':0x0,'rows':[]};var _0x133f5b=_[_0xf668('0x29')](db[_0xf668('0x2a')][_0xf668('0x2b')],function(_0x28f6e6){return{'name':_0x28f6e6[_0xf668('0x2c')],'type':_0x28f6e6[_0xf668('0x2d')]['key']};});_0x11742d[_0xf668('0x2e')]=_[_0xf668('0x29')](_0x133f5b,_0xf668('0x27'));_0x11742d['query']=_[_0xf668('0x2f')](_0x3598b8[_0xf668('0x30')]);_0x11742d[_0xf668('0x31')]=_['intersection'](_0x11742d[_0xf668('0x2e')],_0x11742d['query']);_0x2c6b0e['attributes']=_['intersection'](_0x11742d[_0xf668('0x2e')],qs['fields'](_0x3598b8['query'][_0xf668('0x32')]));_0x2c6b0e[_0xf668('0x33')]=_0x2c6b0e[_0xf668('0x33')][_0xf668('0x34')]?_0x2c6b0e['attributes']:_0x11742d[_0xf668('0x2e')];if(!_0x3598b8[_0xf668('0x30')]['hasOwnProperty']('nolimit')){_0x2c6b0e[_0xf668('0x19')]=qs[_0xf668('0x19')](_0x3598b8['query'][_0xf668('0x19')]);_0x2c6b0e[_0xf668('0x1b')]=qs[_0xf668('0x1b')](_0x3598b8['query'][_0xf668('0x1b')]);}_0x2c6b0e[_0xf668('0x35')]=qs[_0xf668('0x36')](_0x3598b8[_0xf668('0x30')][_0xf668('0x36')]);_0x2c6b0e[_0xf668('0x37')]=qs['filters'](_[_0xf668('0x38')](_0x3598b8[_0xf668('0x30')],_0x11742d[_0xf668('0x31')]),_0x133f5b);if(_0x3598b8['query'][_0xf668('0x39')]){_0x2c6b0e['where']=_[_0xf668('0x3a')](_0x2c6b0e[_0xf668('0x37')],{'$or':_[_0xf668('0x29')](_0x133f5b,function(_0xfa43e0){if(_0xfa43e0[_0xf668('0x2d')]!==_0xf668('0x3b')){var _0x271cf4={};_0x271cf4[_0xfa43e0[_0xf668('0x27')]]={'$like':'%'+_0x3598b8[_0xf668('0x30')]['filter']+'%'};return _0x271cf4;}})});}_0x2c6b0e=_['merge']({},_0x2c6b0e,_0x3598b8[_0xf668('0x3c')]);var _0x5102e0={'where':_0x2c6b0e[_0xf668('0x37')]};return db[_0xf668('0x2a')]['count'](_0x5102e0)[_0xf668('0x20')](function(_0x5ac521){_0x246e3b['count']=_0x5ac521;if(_0x3598b8[_0xf668('0x30')][_0xf668('0x3d')]){_0x2c6b0e[_0xf668('0x3e')]=[{'all':!![]}];}return db['Sound'][_0xf668('0x3f')](_0x2c6b0e);})['then'](function(_0x1e7f06){_0x246e3b[_0xf668('0x40')]=_0x1e7f06;return _0x246e3b;})['then'](respondWithFilteredResult(_0x57e8bb,_0x2c6b0e))['catch'](handleError(_0x57e8bb,null));};exports[_0xf668('0x41')]=function(_0x312dff,_0x3e1704){var _0x3cd01d={'raw':!![],'where':{'id':_0x312dff[_0xf668('0x42')]['id']}},_0x507936={};_0x507936[_0xf668('0x2e')]=_[_0xf668('0x2f')](db['Sound'][_0xf668('0x2b')]);_0x507936[_0xf668('0x30')]=_[_0xf668('0x2f')](_0x312dff['query']);_0x507936[_0xf668('0x31')]=_[_0xf668('0x43')](_0x507936['model'],_0x507936[_0xf668('0x30')]);_0x3cd01d['attributes']=_[_0xf668('0x43')](_0x507936[_0xf668('0x2e')],qs[_0xf668('0x32')](_0x312dff['query'][_0xf668('0x32')]));_0x3cd01d[_0xf668('0x33')]=_0x3cd01d[_0xf668('0x33')][_0xf668('0x34')]?_0x3cd01d[_0xf668('0x33')]:_0x507936[_0xf668('0x2e')];if(_0x312dff[_0xf668('0x30')][_0xf668('0x3d')]){_0x3cd01d[_0xf668('0x3e')]=[{'all':!![]}];}_0x3cd01d=_[_0xf668('0x3a')]({},_0x3cd01d,_0x312dff[_0xf668('0x3c')]);return db[_0xf668('0x2a')][_0xf668('0x44')](_0x3cd01d)[_0xf668('0x20')](handleEntityNotFound(_0x3e1704,null))[_0xf668('0x20')](respondWithResult(_0x3e1704,null))[_0xf668('0x45')](handleError(_0x3e1704,null));};exports[_0xf668('0x46')]=function(_0x20485c,_0x1049fb,_0x73c627){return db[_0xf668('0x2a')][_0xf668('0x44')]({'where':{'id':_0x20485c[_0xf668('0x42')]['id']},'attributes':[_0xf668('0x27'),_0xf668('0x47'),_0xf668('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x1049fb,null))['then'](function(_0x3c1b27){if(_0x3c1b27){if(!fs[_0xf668('0x49')](path[_0xf668('0x4a')](config[_0xf668('0x4b')],_0xf668('0x4c'),_0x3c1b27[_0xf668('0x47')]+'.'+_0x3c1b27['converted_format']))){throw new db[(_0xf668('0x4d'))][(_0xf668('0x4e'))](_0xf668('0x4f'));}return _0x1049fb[_0xf668('0x46')](path[_0xf668('0x4a')](config[_0xf668('0x4b')],_0xf668('0x4c'),util[_0xf668('0x50')](_0xf668('0x51'),_0x3c1b27[_0xf668('0x47')],_0x3c1b27[_0xf668('0x48')])),util[_0xf668('0x50')](_0xf668('0x51'),_0x3c1b27['name'],_0x3c1b27[_0xf668('0x48')]));}return null;})['catch'](handleError(_0x1049fb,null));};exports[_0xf668('0x52')]=function(_0x30c441,_0x5e8dee,_0xd8528f){var _0x22c100={'name':path[_0xf668('0x53')](_0x30c441[_0xf668('0x54')][_0xf668('0x55')],path[_0xf668('0x56')](_0x30c441[_0xf668('0x54')][_0xf668('0x55')])),'save_name':path[_0xf668('0x53')](_0x30c441[_0xf668('0x54')]['filename'],path['extname'](_0x30c441['file'][_0xf668('0x57')])),'original_format':path[_0xf668('0x56')](_0x30c441['file'][_0xf668('0x55')])[_0xf668('0x58')](0x1),'converted_format':'wav'};var _0x37487d=path['join'](config['root'],_0xf668('0x59'),_0x30c441[_0xf668('0x54')][_0xf668('0x57')]);var _0x377c3e=path[_0xf668('0x4a')](config['root'],'server/files/sounds/converted',util[_0xf668('0x50')](_0xf668('0x51'),path[_0xf668('0x53')](_0x30c441[_0xf668('0x54')][_0xf668('0x57')],path[_0xf668('0x56')](_0x30c441[_0xf668('0x54')][_0xf668('0x57')])),_0x22c100['converted_format']));logger[_0xf668('0x5a')](_0xf668('0x5b'),_0x37487d);logger[_0xf668('0x5a')](_0xf668('0x5c'),_0x377c3e);try{fs[_0xf668('0x5d')](_0x37487d,parseInt(_0xf668('0x5e'),0x8));var _0x7763cf=sox[_0xf668('0x5f')](_0x37487d,_0x377c3e,{'sampleRate':0x1f40,'format':_0xf668('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x7763cf['on']('error',function(_0x39cdee){fs[_0xf668('0x61')](_0x37487d);_0x5e8dee[_0xf668('0x16')](0x1f4)['send'](_0x39cdee);});_0x7763cf['on'](_0xf668('0x62'),function(_0x5b064a){_0x22c100[_0xf668('0x63')]=isNaN(_0x5b064a[_0xf668('0x64')])?null:_0x5b064a[_0xf668('0x64')]*0x3e8;_0x22c100[_0xf668('0x65')]=isNaN(_0x5b064a[_0xf668('0x66')])?null:_0x5b064a['sampleCount'];_0x22c100[_0xf668('0x67')]=isNaN(_0x5b064a[_0xf668('0x68')])?null:_0x5b064a['channelCount'];_0x22c100[_0xf668('0x69')]=isNaN(_0x5b064a[_0xf668('0x6a')])?null:_0x5b064a[_0xf668('0x6a')];_0x22c100[_0xf668('0x6b')]=isNaN(_0x5b064a[_0xf668('0x6c')])?null:_0x5b064a['sampleRate'];});_0x7763cf['on'](_0xf668('0x6d'),function(_0x347dc3){_0x22c100['converted_duration']=isNaN(_0x347dc3[_0xf668('0x64')])?null:_0x347dc3[_0xf668('0x64')]*0x3e8;_0x22c100[_0xf668('0x6e')]=isNaN(_0x347dc3['sampleCount'])?null:_0x347dc3[_0xf668('0x66')];_0x22c100['converted_channelCount']=isNaN(_0x347dc3[_0xf668('0x68')])?null:_0x347dc3[_0xf668('0x68')];_0x22c100['converted_bitRate']=isNaN(_0x347dc3[_0xf668('0x6a')])?null:_0x347dc3[_0xf668('0x6a')];_0x22c100[_0xf668('0x6f')]=isNaN(_0x347dc3[_0xf668('0x6c')])?null:_0x347dc3[_0xf668('0x6c')];});_0x7763cf['on'](_0xf668('0x17'),function(){fs[_0xf668('0x5d')](_0x377c3e,parseInt(_0xf668('0x5e'),0x8));return db[_0xf668('0x2a')][_0xf668('0x52')](_0x22c100)[_0xf668('0x20')](function(_0x3543c0){var _0x2d0fbb={'role':_0x30c441['body'][_0xf668('0x70')],'userProfileId':_0x30c441['body'][_0xf668('0x71')]};if(!_0x2d0fbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d0fbb[_0xf668('0x70')]===_0xf668('0x72')){var _0x4e9612=_0x3543c0[_0xf668('0x22')]({'plain':!![]});return db[_0xf668('0x73')][_0xf668('0x44')]({'where':{'name':'Sounds','userProfileId':_0x2d0fbb[_0xf668('0x71')]},'raw':!![]})['then'](function(_0x3aeadc){if(_0x3aeadc&&_0x3aeadc['autoAssociation']===0x0){return db[_0xf668('0x24')][_0xf668('0x52')]({'name':_0x4e9612[_0xf668('0x27')],'resourceId':_0x4e9612['id'],'type':_0x3aeadc[_0xf668('0x27')],'sectionId':_0x3aeadc['id']},{})[_0xf668('0x20')](function(){return _0x3543c0;});}else{return _0x3543c0;}})['catch'](function(_0x333afe){logger[_0xf668('0x25')](_0xf668('0x74'),_0x333afe);throw _0x333afe;});}return _0x3543c0;})[_0xf668('0x20')](respondWithResult(_0x5e8dee,null))['catch'](handleError(_0x5e8dee,null));});_0x7763cf['start']();}catch(_0x39add4){_0x5e8dee[_0xf668('0x16')](0x1f4)[_0xf668('0x28')](_0x39add4);}};exports['update']=function(_0x15268d,_0xf5a661,_0xa9f0d2){return db[_0xf668('0x2a')][_0xf668('0x44')]({'where':{'id':_0x15268d['params']['id']}})['then'](handleEntityNotFound(_0xf5a661,null))[_0xf668('0x20')](saveUpdates(_[_0xf668('0x38')](_0x15268d[_0xf668('0x75')],[_0xf668('0x27'),'description']),null))[_0xf668('0x20')](respondWithResult(_0xf5a661,null))[_0xf668('0x45')](handleError(_0xf5a661,null));};exports['delete']=function(_0x24ec86,_0x324113,_0x18a948){return db[_0xf668('0x2a')][_0xf668('0x44')]({'where':{'id':_0x24ec86[_0xf668('0x42')]['id']}})[_0xf668('0x20')](function(_0x4ba12b){if(_0x4ba12b){return _0x4ba12b[_0xf668('0x21')]();}})[_0xf668('0x20')](function(_0x1bde78){var _0x324324=path[_0xf668('0x4a')](config[_0xf668('0x4b')],_0xf668('0x59'),util[_0xf668('0x50')]('%s.%s',_0x1bde78[_0xf668('0x47')],_0x1bde78[_0xf668('0x76')]));var _0x4ef821=path[_0xf668('0x4a')](config['root'],_0xf668('0x4c'),util['format'](_0xf668('0x51'),_0x1bde78[_0xf668('0x47')],_0x1bde78[_0xf668('0x48')]));fs['unlinkSync'](_0x324324);fs[_0xf668('0x61')](_0x4ef821);return _0x1bde78;})['then'](function(_0x5c0b06){if(_0x5c0b06){return _0x324113[_0xf668('0x16')](0xcc)[_0xf668('0x17')]();}})[_0xf668('0x20')](handleEntityNotFound(_0x324113,null))[_0xf668('0x45')](handleError(_0x324113,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5b18795..e457414 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 _0xe092=['path','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c89ef,_0x296c7e){var _0x517710=function(_0x4fd0e7){while(--_0x4fd0e7){_0x5c89ef['push'](_0x5c89ef['shift']());}};_0x517710(++_0x296c7e);}(_0xe092,0x1c1));var _0x2e09=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xe092[_0x1bc013];return _0x55df36;};'use strict';var _=require('lodash');var util=require(_0x2e09('0x0'));var logger=require(_0x2e09('0x1'))(_0x2e09('0x2'));var moment=require(_0x2e09('0x3'));var BPromise=require(_0x2e09('0x4'));var rp=require(_0x2e09('0x5'));var fs=require('fs');var path=require(_0x2e09('0x6'));var rimraf=require('rimraf');var config=require(_0x2e09('0x7'));var attributes=require(_0x2e09('0x8'));module[_0x2e09('0x9')]=function(_0x2318c8,_0x4d0c33){return _0x2318c8[_0x2e09('0xa')](_0x2e09('0xb'),attributes,{'tableName':_0x2e09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e8=['Sound','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x93e8,0x173));var _0x893e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x93e8[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x893e('0x0'));var util=require(_0x893e('0x1'));var logger=require(_0x893e('0x2'))(_0x893e('0x3'));var moment=require('moment');var BPromise=require(_0x893e('0x4'));var rp=require(_0x893e('0x5'));var fs=require('fs');var path=require(_0x893e('0x6'));var rimraf=require(_0x893e('0x7'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x893e('0x8')]=function(_0x16cdc4,_0x150b30){return _0x16cdc4['define'](_0x893e('0x9'),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 a2a5d78..86bf3f5 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 _0xa3c9=['find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3c9,0x147));var _0x9a3c=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xa3c9[_0x1d0499];return _0x153fb3;};'use strict';var _=require(_0x9a3c('0x0'));var util=require(_0x9a3c('0x1'));var moment=require(_0x9a3c('0x2'));var BPromise=require(_0x9a3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a3c('0x4'))['db'];var utils=require(_0x9a3c('0x5'));var logger=require('../../config/logger')(_0x9a3c('0x6'));var config=require(_0x9a3c('0x7'));var jayson=require(_0x9a3c('0x8'));var client=jayson['client'][_0x9a3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x225268,_0x3c13ae,_0x5f1456){return new BPromise(function(_0x4415da,_0x6ede54){return client['request'](_0x225268,_0x5f1456)[_0x9a3c('0xa')](function(_0x42cc30){logger['info'](_0x9a3c('0xb'),_0x3c13ae,_0x9a3c('0xc'));logger[_0x9a3c('0xd')](_0x9a3c('0xe'),_0x3c13ae,_0x9a3c('0xc'),JSON[_0x9a3c('0xf')](_0x42cc30));if(_0x42cc30['error']){if(_0x42cc30[_0x9a3c('0x10')][_0x9a3c('0x11')]===0x1f4){logger[_0x9a3c('0x10')](_0x9a3c('0xb'),_0x3c13ae,_0x42cc30[_0x9a3c('0x10')]['message']);return _0x6ede54(_0x42cc30['error'][_0x9a3c('0x12')]);}logger[_0x9a3c('0x10')](_0x9a3c('0xb'),_0x3c13ae,_0x42cc30[_0x9a3c('0x10')][_0x9a3c('0x12')]);return _0x4415da(_0x42cc30['error'][_0x9a3c('0x12')]);}else{logger[_0x9a3c('0x13')]('Sound,\x20%s,\x20%s',_0x3c13ae,_0x9a3c('0xc'));_0x4415da(_0x42cc30['result'][_0x9a3c('0x12')]);}})['catch'](function(_0x13d515){logger['error']('Sound,\x20%s,\x20%s',_0x3c13ae,_0x13d515);_0x6ede54(_0x13d515);});});}exports[_0x9a3c('0x14')]=function(_0x41e6b0){var _0xf68bcd=this;return new Promise(function(_0x2a3cf3,_0x4d0956){return db['Sound'][_0x9a3c('0x15')]({'raw':_0x41e6b0[_0x9a3c('0x16')]?_0x41e6b0[_0x9a3c('0x16')][_0x9a3c('0x17')]===undefined?!![]:![]:!![],'where':_0x41e6b0[_0x9a3c('0x16')]?_0x41e6b0['options'][_0x9a3c('0x18')]||null:null,'attributes':_0x41e6b0['options']?_0x41e6b0[_0x9a3c('0x16')][_0x9a3c('0x19')]||null:null,'include':_0x41e6b0[_0x9a3c('0x16')]?_0x41e6b0[_0x9a3c('0x16')]['include']?_[_0x9a3c('0x1a')](_0x41e6b0[_0x9a3c('0x16')][_0x9a3c('0x1b')],function(_0x2c1775){return{'model':db[_0x2c1775[_0x9a3c('0x1c')]],'as':_0x2c1775['as'],'attributes':_0x2c1775[_0x9a3c('0x19')],'include':_0x2c1775[_0x9a3c('0x1b')]?_[_0x9a3c('0x1a')](_0x2c1775[_0x9a3c('0x1b')],function(_0x2f32ab){return{'model':db[_0x2f32ab[_0x9a3c('0x1c')]],'as':_0x2f32ab['as'],'attributes':_0x2f32ab[_0x9a3c('0x19')],'include':_0x2f32ab[_0x9a3c('0x1b')]?_[_0x9a3c('0x1a')](_0x2f32ab[_0x9a3c('0x1b')],function(_0x1c80f4){return{'model':db[_0x1c80f4['model']],'as':_0x1c80f4['as'],'attributes':_0x1c80f4[_0x9a3c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb27d45){logger[_0x9a3c('0x13')](_0x9a3c('0x14'),_0x41e6b0);logger[_0x9a3c('0xd')]('ShowSound',_0x41e6b0,JSON[_0x9a3c('0xf')](_0xb27d45));_0x2a3cf3(_0xb27d45);})['catch'](function(_0x730d50){logger[_0x9a3c('0x10')](_0x9a3c('0x14'),_0x730d50[_0x9a3c('0x12')],_0x41e6b0);_0x4d0956(_0xf68bcd[_0x9a3c('0x10')](0x1f4,_0x730d50[_0x9a3c('0x12')]));});});}; \ No newline at end of file +var _0x4ca3=['catch','ShowSound','Sound','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1adf54,_0x9214e5){var _0x4b46ca=function(_0x17b86f){while(--_0x17b86f){_0x1adf54['push'](_0x1adf54['shift']());}};_0x4b46ca(++_0x9214e5);}(_0x4ca3,0x1dc));var _0x34ca=function(_0x22e102,_0x501a33){_0x22e102=_0x22e102-0x0;var _0x553f21=_0x4ca3[_0x22e102];return _0x553f21;};'use strict';var _=require(_0x34ca('0x0'));var util=require(_0x34ca('0x1'));var moment=require(_0x34ca('0x2'));var BPromise=require(_0x34ca('0x3'));var rs=require(_0x34ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34ca('0x5'));var logger=require('../../config/logger')(_0x34ca('0x6'));var config=require(_0x34ca('0x7'));var jayson=require(_0x34ca('0x8'));var client=jayson[_0x34ca('0x9')][_0x34ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5b61,_0x4a020d,_0x3d1b90){return new BPromise(function(_0x509650,_0x1c8136){return client[_0x34ca('0xb')](_0x1b5b61,_0x3d1b90)[_0x34ca('0xc')](function(_0x1a487b){logger['info'](_0x34ca('0xd'),_0x4a020d,_0x34ca('0xe'));logger[_0x34ca('0xf')](_0x34ca('0x10'),_0x4a020d,'request\x20sent',JSON['stringify'](_0x1a487b));if(_0x1a487b[_0x34ca('0x11')]){if(_0x1a487b['error'][_0x34ca('0x12')]===0x1f4){logger[_0x34ca('0x11')](_0x34ca('0xd'),_0x4a020d,_0x1a487b['error'][_0x34ca('0x13')]);return _0x1c8136(_0x1a487b[_0x34ca('0x11')][_0x34ca('0x13')]);}logger[_0x34ca('0x11')](_0x34ca('0xd'),_0x4a020d,_0x1a487b['error'][_0x34ca('0x13')]);return _0x509650(_0x1a487b[_0x34ca('0x11')]['message']);}else{logger['info'](_0x34ca('0xd'),_0x4a020d,'request\x20sent');_0x509650(_0x1a487b['result'][_0x34ca('0x13')]);}})[_0x34ca('0x14')](function(_0x2e9773){logger[_0x34ca('0x11')]('Sound,\x20%s,\x20%s',_0x4a020d,_0x2e9773);_0x1c8136(_0x2e9773);});});}exports[_0x34ca('0x15')]=function(_0x422ea5){var _0x3a8835=this;return new Promise(function(_0x51c39f,_0x343655){return db[_0x34ca('0x16')]['find']({'raw':_0x422ea5[_0x34ca('0x17')]?_0x422ea5['options'][_0x34ca('0x18')]===undefined?!![]:![]:!![],'where':_0x422ea5[_0x34ca('0x17')]?_0x422ea5[_0x34ca('0x17')][_0x34ca('0x19')]||null:null,'attributes':_0x422ea5[_0x34ca('0x17')]?_0x422ea5['options'][_0x34ca('0x1a')]||null:null,'include':_0x422ea5['options']?_0x422ea5['options']['include']?_[_0x34ca('0x1b')](_0x422ea5[_0x34ca('0x17')][_0x34ca('0x1c')],function(_0x4b1c76){return{'model':db[_0x4b1c76['model']],'as':_0x4b1c76['as'],'attributes':_0x4b1c76[_0x34ca('0x1a')],'include':_0x4b1c76[_0x34ca('0x1c')]?_[_0x34ca('0x1b')](_0x4b1c76[_0x34ca('0x1c')],function(_0x203303){return{'model':db[_0x203303[_0x34ca('0x1d')]],'as':_0x203303['as'],'attributes':_0x203303['attributes'],'include':_0x203303['include']?_[_0x34ca('0x1b')](_0x203303['include'],function(_0x5d2f6e){return{'model':db[_0x5d2f6e[_0x34ca('0x1d')]],'as':_0x5d2f6e['as'],'attributes':_0x5d2f6e[_0x34ca('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x34ca('0xc')](function(_0x160077){logger['info'](_0x34ca('0x15'),_0x422ea5);logger['debug']('ShowSound',_0x422ea5,JSON[_0x34ca('0x1e')](_0x160077));_0x51c39f(_0x160077);})[_0x34ca('0x14')](function(_0x9db8f9){logger[_0x34ca('0x11')]('ShowSound',_0x9db8f9[_0x34ca('0x13')],_0x422ea5);_0x343655(_0x3a8835[_0x34ca('0x11')](0x1f4,_0x9db8f9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c04eb68..18833ae 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x5e1f45,_0x45795d){var _0xa9d684=function(_0x3bd8e9){while(--_0x3bd8e9){_0x5e1f45['push'](_0x5e1f45['shift']());}};_0xa9d684(++_0x45795d);}(_0x14a0,0x8e));var _0x014a=function(_0x3c2c1f,_0x4d93d3){_0x3c2c1f=_0x3c2c1f-0x0;var _0x5adf10=_0x14a0[_0x3c2c1f];return _0x5adf10;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x51b33e,_0xf6f8f5){var _0x4bfa5f=function(_0x270e60){while(--_0x270e60){_0x51b33e['push'](_0x51b33e['shift']());}};_0x4bfa5f(++_0xf6f8f5);}(_0x757a,0xde));var _0xa757=function(_0xb148f,_0x1d7602){_0xb148f=_0xb148f-0x0;var _0x1e5779=_0x757a[_0xb148f];return _0x1e5779;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d5f4ff5..2884e6c 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 _0x649b=['medium','out','STRING','sequelize','exports','TEXT'];(function(_0x2de04e,_0x3c3b69){var _0x4c9797=function(_0x9f00ab){while(--_0x9f00ab){_0x2de04e['push'](_0x2de04e['shift']());}};_0x4c9797(++_0x3c3b69);}(_0x649b,0x81));var _0xb649=function(_0x53317c,_0x4d9520){_0x53317c=_0x53317c-0x0;var _0x20a6c8=_0x649b[_0x53317c];return _0x20a6c8;};'use strict';var Sequelize=require(_0xb649('0x0'));module[_0xb649('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb649('0x2')](_0xb649('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb649('0x4')),'defaultValue':_0xb649('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb649('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8952=['out','TEXT','sequelize','exports','STRING','ENUM'];(function(_0xe409c1,_0x398654){var _0x418bf3=function(_0x2d5efc){while(--_0x2d5efc){_0xe409c1['push'](_0xe409c1['shift']());}};_0x418bf3(++_0x398654);}(_0x8952,0x1ca));var _0x2895=function(_0x24d19e,_0x390b3e){_0x24d19e=_0x24d19e-0x0;var _0x8cbda1=_0x8952[_0x24d19e];return _0x8cbda1;};'use strict';var Sequelize=require(_0x2895('0x0'));module[_0x2895('0x1')]={'uniqueid':{'type':Sequelize[_0x2895('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x2895('0x3')]('in','out'),'defaultValue':_0x2895('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2895('0x2')]},'providerResponse':{'type':Sequelize[_0x2895('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 36e5758..ef0a09e 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 _0xf69c=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','SquareMessage','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key'];(function(_0x2db84f,_0x23c61d){var _0x1e2295=function(_0x3960e2){while(--_0x3960e2){_0x2db84f['push'](_0x2db84f['shift']());}};_0x1e2295(++_0x23c61d);}(_0xf69c,0x1e2));var _0xcf69=function(_0x45b100,_0x29a4b1){_0x45b100=_0x45b100-0x0;var _0x1b41f8=_0xf69c[_0x45b100];return _0x1b41f8;};'use strict';var emlformat=require(_0xcf69('0x0'));var rimraf=require(_0xcf69('0x1'));var zipdir=require(_0xcf69('0x2'));var jsonpatch=require(_0xcf69('0x3'));var rp=require('request-promise');var moment=require(_0xcf69('0x4'));var BPromise=require(_0xcf69('0x5'));var Mustache=require(_0xcf69('0x6'));var util=require('util');var path=require(_0xcf69('0x7'));var sox=require(_0xcf69('0x8'));var csv=require(_0xcf69('0x9'));var ejs=require(_0xcf69('0xa'));var fs=require('fs');var fs_extra=require(_0xcf69('0xb'));var _=require(_0xcf69('0xc'));var squel=require(_0xcf69('0xd'));var crypto=require('crypto');var jsforce=require(_0xcf69('0xe'));var deskjs=require(_0xcf69('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf69('0x10'));var Papa=require(_0xcf69('0x11'));var Redis=require(_0xcf69('0x12'));var authService=require(_0xcf69('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcf69('0x14'));var hardwareService=require(_0xcf69('0x15'));var logger=require(_0xcf69('0x16'))('api');var utils=require(_0xcf69('0x17'));var config=require(_0xcf69('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf69('0x19'))['db'];function respondWithStatusCode(_0x25640b,_0x1055f2){_0x1055f2=_0x1055f2||0xcc;return function(_0x339c87){if(_0x339c87){return _0x25640b[_0xcf69('0x1a')](_0x1055f2);}return _0x25640b[_0xcf69('0x1b')](_0x1055f2)[_0xcf69('0x1c')]();};}function respondWithResult(_0x36b3c9,_0x5965d5){_0x5965d5=_0x5965d5||0xc8;return function(_0x32d71f){if(_0x32d71f){return _0x36b3c9['status'](_0x5965d5)[_0xcf69('0x1d')](_0x32d71f);}};}function respondWithFilteredResult(_0x4e32b0,_0x6b4f8e){return function(_0x1d2212){if(_0x1d2212){var _0x5e01be=typeof _0x6b4f8e['offset']===_0xcf69('0x1e')&&typeof _0x6b4f8e['limit']===_0xcf69('0x1e');var _0x561ce4=_0x1d2212[_0xcf69('0x1f')];var _0x50b557=_0x5e01be?0x0:_0x6b4f8e[_0xcf69('0x20')];var _0x5ea276=_0x5e01be?_0x1d2212[_0xcf69('0x1f')]:_0x6b4f8e[_0xcf69('0x20')]+_0x6b4f8e[_0xcf69('0x21')];var _0x5ef249;if(_0x5ea276>=_0x561ce4){_0x5ea276=_0x561ce4;_0x5ef249=0xc8;}else{_0x5ef249=0xce;}_0x4e32b0[_0xcf69('0x1b')](_0x5ef249);return _0x4e32b0[_0xcf69('0x22')](_0xcf69('0x23'),_0x50b557+'-'+_0x5ea276+'/'+_0x561ce4)[_0xcf69('0x1d')](_0x1d2212);}return null;};}function patchUpdates(_0x14b779){return function(_0x10c747){try{jsonpatch[_0xcf69('0x24')](_0x10c747,_0x14b779,!![]);}catch(_0x4a7409){return BPromise[_0xcf69('0x25')](_0x4a7409);}return _0x10c747[_0xcf69('0x26')]();};}function saveUpdates(_0x278c1a,_0x142283){return function(_0xa2031d){if(_0xa2031d){return _0xa2031d['update'](_0x278c1a)[_0xcf69('0x27')](function(_0x5a7e85){return _0x5a7e85;});}return null;};}function removeEntity(_0x1f8d99,_0xe28ca){return function(_0x48a1be){if(_0x48a1be){return _0x48a1be[_0xcf69('0x28')]()['then'](function(){_0x1f8d99[_0xcf69('0x1b')](0xcc)[_0xcf69('0x1c')]();});}};}function handleEntityNotFound(_0x597275,_0x58a7f3){return function(_0x28e837){if(!_0x28e837){_0x597275[_0xcf69('0x1a')](0x194);}return _0x28e837;};}function handleError(_0x410736,_0x229182){_0x229182=_0x229182||0x1f4;return function(_0x540c58){logger[_0xcf69('0x29')](_0x540c58[_0xcf69('0x2a')]);if(_0x540c58[_0xcf69('0x2b')]){delete _0x540c58[_0xcf69('0x2b')];}_0x410736[_0xcf69('0x1b')](_0x229182)['send'](_0x540c58);};}exports[_0xcf69('0x2c')]=function(_0x1e7e77,_0x10862e){var _0x332afd={},_0x200a7a={},_0x40f2bc={'count':0x0,'rows':[]};var _0x398929=_[_0xcf69('0x2d')](db['SquareMessage'][_0xcf69('0x2e')],function(_0x463733){return{'name':_0x463733[_0xcf69('0x2f')],'type':_0x463733[_0xcf69('0x30')][_0xcf69('0x31')]};});_0x200a7a[_0xcf69('0x32')]=_[_0xcf69('0x2d')](_0x398929,_0xcf69('0x2b'));_0x200a7a[_0xcf69('0x33')]=_[_0xcf69('0x34')](_0x1e7e77[_0xcf69('0x33')]);_0x200a7a[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x200a7a['model'],_0x200a7a['query']);_0x332afd[_0xcf69('0x37')]=_[_0xcf69('0x36')](_0x200a7a[_0xcf69('0x32')],qs[_0xcf69('0x38')](_0x1e7e77[_0xcf69('0x33')][_0xcf69('0x38')]));_0x332afd[_0xcf69('0x37')]=_0x332afd[_0xcf69('0x37')][_0xcf69('0x39')]?_0x332afd[_0xcf69('0x37')]:_0x200a7a[_0xcf69('0x32')];if(!_0x1e7e77[_0xcf69('0x33')]['hasOwnProperty'](_0xcf69('0x3a'))){_0x332afd[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x1e7e77['query'][_0xcf69('0x21')]);_0x332afd['offset']=qs[_0xcf69('0x20')](_0x1e7e77['query'][_0xcf69('0x20')]);}_0x332afd[_0xcf69('0x3b')]=qs['sort'](_0x1e7e77['query']['sort']);_0x332afd[_0xcf69('0x3c')]=qs[_0xcf69('0x35')](_[_0xcf69('0x3d')](_0x1e7e77['query'],_0x200a7a[_0xcf69('0x35')]),_0x398929);if(_0x1e7e77[_0xcf69('0x33')][_0xcf69('0x3e')]){_0x332afd[_0xcf69('0x3c')]=_[_0xcf69('0x3f')](_0x332afd[_0xcf69('0x3c')],{'$or':_[_0xcf69('0x2d')](_0x398929,function(_0x2301dc){if(_0x2301dc[_0xcf69('0x30')]!==_0xcf69('0x40')){var _0x1d7aa0={};_0x1d7aa0[_0x2301dc[_0xcf69('0x2b')]]={'$like':'%'+_0x1e7e77['query'][_0xcf69('0x3e')]+'%'};return _0x1d7aa0;}})});}_0x332afd=_[_0xcf69('0x3f')]({},_0x332afd,_0x1e7e77['options']);var _0x32eec9={'where':_0x332afd[_0xcf69('0x3c')]};return db[_0xcf69('0x41')][_0xcf69('0x1f')](_0x32eec9)[_0xcf69('0x27')](function(_0x129ebb){_0x40f2bc[_0xcf69('0x1f')]=_0x129ebb;if(_0x1e7e77['query'][_0xcf69('0x42')]){_0x332afd[_0xcf69('0x43')]=[{'all':!![]}];}return db[_0xcf69('0x41')][_0xcf69('0x44')](_0x332afd);})[_0xcf69('0x27')](function(_0x2a14e9){_0x40f2bc['rows']=_0x2a14e9;return _0x40f2bc;})[_0xcf69('0x27')](respondWithFilteredResult(_0x10862e,_0x332afd))[_0xcf69('0x45')](handleError(_0x10862e,null));};exports[_0xcf69('0x46')]=function(_0x201cd2,_0x1e27fa){var _0x274b85={'raw':!![],'where':{'id':_0x201cd2[_0xcf69('0x47')]['id']}},_0x2e0cb5={};_0x2e0cb5[_0xcf69('0x32')]=_['keys'](db[_0xcf69('0x41')][_0xcf69('0x2e')]);_0x2e0cb5[_0xcf69('0x33')]=_[_0xcf69('0x34')](_0x201cd2[_0xcf69('0x33')]);_0x2e0cb5[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x2e0cb5[_0xcf69('0x32')],_0x2e0cb5['query']);_0x274b85[_0xcf69('0x37')]=_[_0xcf69('0x36')](_0x2e0cb5[_0xcf69('0x32')],qs[_0xcf69('0x38')](_0x201cd2[_0xcf69('0x33')][_0xcf69('0x38')]));_0x274b85[_0xcf69('0x37')]=_0x274b85[_0xcf69('0x37')][_0xcf69('0x39')]?_0x274b85[_0xcf69('0x37')]:_0x2e0cb5[_0xcf69('0x32')];if(_0x201cd2[_0xcf69('0x33')]['includeAll']){_0x274b85[_0xcf69('0x43')]=[{'all':!![]}];}_0x274b85=_['merge']({},_0x274b85,_0x201cd2['options']);return db[_0xcf69('0x41')][_0xcf69('0x48')](_0x274b85)[_0xcf69('0x27')](handleEntityNotFound(_0x1e27fa,null))[_0xcf69('0x27')](respondWithResult(_0x1e27fa,null))[_0xcf69('0x45')](handleError(_0x1e27fa,null));};exports[_0xcf69('0x49')]=function(_0x2b9338,_0x217dae){return db[_0xcf69('0x41')][_0xcf69('0x49')](_0x2b9338[_0xcf69('0x4a')],{})[_0xcf69('0x27')](respondWithResult(_0x217dae,0xc9))[_0xcf69('0x45')](handleError(_0x217dae,null));};exports[_0xcf69('0x4b')]=function(_0x2b63e1,_0x524c08){if(_0x2b63e1[_0xcf69('0x4a')]['id']){delete _0x2b63e1[_0xcf69('0x4a')]['id'];}return db['SquareMessage'][_0xcf69('0x48')]({'where':{'id':_0x2b63e1[_0xcf69('0x47')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x524c08,null))[_0xcf69('0x27')](saveUpdates(_0x2b63e1['body'],null))[_0xcf69('0x27')](respondWithResult(_0x524c08,null))[_0xcf69('0x45')](handleError(_0x524c08,null));};exports['destroy']=function(_0xac5f90,_0x4ec08f){return db['SquareMessage'][_0xcf69('0x48')]({'where':{'id':_0xac5f90[_0xcf69('0x47')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x4ec08f,null))['then'](removeEntity(_0x4ec08f,null))[_0xcf69('0x45')](handleError(_0x4ec08f,null));}; \ No newline at end of file +var _0x5ef6=['VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','SquareMessage','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where'];(function(_0x43f326,_0x3c4cd3){var _0x3005b3=function(_0x279d86){while(--_0x279d86){_0x43f326['push'](_0x43f326['shift']());}};_0x3005b3(++_0x3c4cd3);}(_0x5ef6,0xe8));var _0x65ef=function(_0x83cc7b,_0x337a6b){_0x83cc7b=_0x83cc7b-0x0;var _0x77e5ab=_0x5ef6[_0x83cc7b];return _0x77e5ab;};'use strict';var emlformat=require(_0x65ef('0x0'));var rimraf=require(_0x65ef('0x1'));var zipdir=require(_0x65ef('0x2'));var jsonpatch=require(_0x65ef('0x3'));var rp=require(_0x65ef('0x4'));var moment=require(_0x65ef('0x5'));var BPromise=require(_0x65ef('0x6'));var Mustache=require('mustache');var util=require(_0x65ef('0x7'));var path=require(_0x65ef('0x8'));var sox=require(_0x65ef('0x9'));var csv=require(_0x65ef('0xa'));var ejs=require(_0x65ef('0xb'));var fs=require('fs');var fs_extra=require(_0x65ef('0xc'));var _=require(_0x65ef('0xd'));var squel=require('squel');var crypto=require(_0x65ef('0xe'));var jsforce=require(_0x65ef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x65ef('0xa'));var querystring=require(_0x65ef('0x10'));var Papa=require(_0x65ef('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x65ef('0x12'));var as=require(_0x65ef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65ef('0x14'))('api');var utils=require(_0x65ef('0x15'));var config=require(_0x65ef('0x16'));var licenseUtil=require(_0x65ef('0x17'));var db=require(_0x65ef('0x18'))['db'];function respondWithStatusCode(_0x5abd48,_0x3fc77c){_0x3fc77c=_0x3fc77c||0xcc;return function(_0x4bf04e){if(_0x4bf04e){return _0x5abd48['sendStatus'](_0x3fc77c);}return _0x5abd48[_0x65ef('0x19')](_0x3fc77c)[_0x65ef('0x1a')]();};}function respondWithResult(_0x227a4e,_0x2c4fee){_0x2c4fee=_0x2c4fee||0xc8;return function(_0x3d971b){if(_0x3d971b){return _0x227a4e[_0x65ef('0x19')](_0x2c4fee)['json'](_0x3d971b);}};}function respondWithFilteredResult(_0x1a441c,_0x542074){return function(_0x23db04){if(_0x23db04){var _0x81862=typeof _0x542074[_0x65ef('0x1b')]===_0x65ef('0x1c')&&typeof _0x542074[_0x65ef('0x1d')]==='undefined';var _0x2ffd75=_0x23db04[_0x65ef('0x1e')];var _0xf1c8ba=_0x81862?0x0:_0x542074['offset'];var _0x15168d=_0x81862?_0x23db04[_0x65ef('0x1e')]:_0x542074[_0x65ef('0x1b')]+_0x542074[_0x65ef('0x1d')];var _0x51d167;if(_0x15168d>=_0x2ffd75){_0x15168d=_0x2ffd75;_0x51d167=0xc8;}else{_0x51d167=0xce;}_0x1a441c[_0x65ef('0x19')](_0x51d167);return _0x1a441c[_0x65ef('0x1f')]('Content-Range',_0xf1c8ba+'-'+_0x15168d+'/'+_0x2ffd75)[_0x65ef('0x20')](_0x23db04);}return null;};}function patchUpdates(_0xda0630){return function(_0x5ef956){try{jsonpatch['apply'](_0x5ef956,_0xda0630,!![]);}catch(_0x2805b0){return BPromise[_0x65ef('0x21')](_0x2805b0);}return _0x5ef956[_0x65ef('0x22')]();};}function saveUpdates(_0x22df8b,_0x9b386a){return function(_0x5acdac){if(_0x5acdac){return _0x5acdac[_0x65ef('0x23')](_0x22df8b)[_0x65ef('0x24')](function(_0x349b27){return _0x349b27;});}return null;};}function removeEntity(_0xb37256,_0x27a8f7){return function(_0x42b35f){if(_0x42b35f){return _0x42b35f[_0x65ef('0x25')]()[_0x65ef('0x24')](function(){_0xb37256[_0x65ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46a7f3,_0x350ed6){return function(_0x4454e0){if(!_0x4454e0){_0x46a7f3[_0x65ef('0x26')](0x194);}return _0x4454e0;};}function handleError(_0x404bc9,_0x16bbfb){_0x16bbfb=_0x16bbfb||0x1f4;return function(_0xde36e0){logger[_0x65ef('0x27')](_0xde36e0[_0x65ef('0x28')]);if(_0xde36e0[_0x65ef('0x29')]){delete _0xde36e0[_0x65ef('0x29')];}_0x404bc9[_0x65ef('0x19')](_0x16bbfb)[_0x65ef('0x2a')](_0xde36e0);};}exports['index']=function(_0x4490e6,_0x1af6ec){var _0x31e277={},_0x2638fa={},_0x56ec1d={'count':0x0,'rows':[]};var _0x410a97=_[_0x65ef('0x2b')](db[_0x65ef('0x2c')][_0x65ef('0x2d')],function(_0x50254b){return{'name':_0x50254b['fieldName'],'type':_0x50254b[_0x65ef('0x2e')]['key']};});_0x2638fa['model']=_[_0x65ef('0x2b')](_0x410a97,'name');_0x2638fa[_0x65ef('0x2f')]=_['keys'](_0x4490e6[_0x65ef('0x2f')]);_0x2638fa['filters']=_[_0x65ef('0x30')](_0x2638fa[_0x65ef('0x31')],_0x2638fa[_0x65ef('0x2f')]);_0x31e277[_0x65ef('0x32')]=_['intersection'](_0x2638fa[_0x65ef('0x31')],qs[_0x65ef('0x33')](_0x4490e6[_0x65ef('0x2f')][_0x65ef('0x33')]));_0x31e277[_0x65ef('0x32')]=_0x31e277['attributes'][_0x65ef('0x34')]?_0x31e277[_0x65ef('0x32')]:_0x2638fa[_0x65ef('0x31')];if(!_0x4490e6[_0x65ef('0x2f')][_0x65ef('0x35')]('nolimit')){_0x31e277[_0x65ef('0x1d')]=qs[_0x65ef('0x1d')](_0x4490e6[_0x65ef('0x2f')][_0x65ef('0x1d')]);_0x31e277[_0x65ef('0x1b')]=qs[_0x65ef('0x1b')](_0x4490e6[_0x65ef('0x2f')][_0x65ef('0x1b')]);}_0x31e277[_0x65ef('0x36')]=qs[_0x65ef('0x37')](_0x4490e6[_0x65ef('0x2f')]['sort']);_0x31e277['where']=qs[_0x65ef('0x38')](_[_0x65ef('0x39')](_0x4490e6[_0x65ef('0x2f')],_0x2638fa[_0x65ef('0x38')]),_0x410a97);if(_0x4490e6['query'][_0x65ef('0x3a')]){_0x31e277[_0x65ef('0x3b')]=_['merge'](_0x31e277[_0x65ef('0x3b')],{'$or':_[_0x65ef('0x2b')](_0x410a97,function(_0x533488){if(_0x533488['type']!==_0x65ef('0x3c')){var _0x1ef92a={};_0x1ef92a[_0x533488['name']]={'$like':'%'+_0x4490e6[_0x65ef('0x2f')][_0x65ef('0x3a')]+'%'};return _0x1ef92a;}})});}_0x31e277=_[_0x65ef('0x3d')]({},_0x31e277,_0x4490e6[_0x65ef('0x3e')]);var _0x53c8da={'where':_0x31e277[_0x65ef('0x3b')]};return db[_0x65ef('0x2c')][_0x65ef('0x1e')](_0x53c8da)[_0x65ef('0x24')](function(_0x469b24){_0x56ec1d[_0x65ef('0x1e')]=_0x469b24;if(_0x4490e6[_0x65ef('0x2f')][_0x65ef('0x3f')]){_0x31e277['include']=[{'all':!![]}];}return db[_0x65ef('0x2c')][_0x65ef('0x40')](_0x31e277);})[_0x65ef('0x24')](function(_0x32ec9d){_0x56ec1d[_0x65ef('0x41')]=_0x32ec9d;return _0x56ec1d;})['then'](respondWithFilteredResult(_0x1af6ec,_0x31e277))['catch'](handleError(_0x1af6ec,null));};exports[_0x65ef('0x42')]=function(_0x53c9b6,_0xdeb4fe){var _0x4c169d={'raw':!![],'where':{'id':_0x53c9b6[_0x65ef('0x43')]['id']}},_0xe78d32={};_0xe78d32['model']=_['keys'](db[_0x65ef('0x2c')][_0x65ef('0x2d')]);_0xe78d32[_0x65ef('0x2f')]=_['keys'](_0x53c9b6['query']);_0xe78d32['filters']=_[_0x65ef('0x30')](_0xe78d32['model'],_0xe78d32['query']);_0x4c169d['attributes']=_['intersection'](_0xe78d32['model'],qs[_0x65ef('0x33')](_0x53c9b6['query'][_0x65ef('0x33')]));_0x4c169d['attributes']=_0x4c169d[_0x65ef('0x32')][_0x65ef('0x34')]?_0x4c169d[_0x65ef('0x32')]:_0xe78d32[_0x65ef('0x31')];if(_0x53c9b6['query'][_0x65ef('0x3f')]){_0x4c169d[_0x65ef('0x44')]=[{'all':!![]}];}_0x4c169d=_['merge']({},_0x4c169d,_0x53c9b6['options']);return db[_0x65ef('0x2c')][_0x65ef('0x45')](_0x4c169d)[_0x65ef('0x24')](handleEntityNotFound(_0xdeb4fe,null))[_0x65ef('0x24')](respondWithResult(_0xdeb4fe,null))[_0x65ef('0x46')](handleError(_0xdeb4fe,null));};exports['create']=function(_0x5afad2,_0x38d1fa){return db[_0x65ef('0x2c')][_0x65ef('0x47')](_0x5afad2[_0x65ef('0x48')],{})['then'](respondWithResult(_0x38d1fa,0xc9))[_0x65ef('0x46')](handleError(_0x38d1fa,null));};exports['update']=function(_0x45dde8,_0x1a9943){if(_0x45dde8['body']['id']){delete _0x45dde8[_0x65ef('0x48')]['id'];}return db['SquareMessage'][_0x65ef('0x45')]({'where':{'id':_0x45dde8[_0x65ef('0x43')]['id']}})[_0x65ef('0x24')](handleEntityNotFound(_0x1a9943,null))[_0x65ef('0x24')](saveUpdates(_0x45dde8[_0x65ef('0x48')],null))[_0x65ef('0x24')](respondWithResult(_0x1a9943,null))['catch'](handleError(_0x1a9943,null));};exports[_0x65ef('0x25')]=function(_0x5423ec,_0x46c385){return db[_0x65ef('0x2c')]['find']({'where':{'id':_0x5423ec[_0x65ef('0x43')]['id']}})['then'](handleEntityNotFound(_0x46c385,null))[_0x65ef('0x24')](removeEntity(_0x46c385,null))['catch'](handleError(_0x46c385,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0d45743..3dfa57a 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 _0x1048=['lodash','util','api','request-promise','rimraf','../../config/environment','exports','define','square_messages'];(function(_0x49e45c,_0x534d7e){var _0x29d34b=function(_0x23ecb3){while(--_0x23ecb3){_0x49e45c['push'](_0x49e45c['shift']());}};_0x29d34b(++_0x534d7e);}(_0x1048,0xbd));var _0x8104=function(_0x44cd47,_0x172f8e){_0x44cd47=_0x44cd47-0x0;var _0x474d07=_0x1048[_0x44cd47];return _0x474d07;};'use strict';var _=require(_0x8104('0x0'));var util=require(_0x8104('0x1'));var logger=require('../../config/logger')(_0x8104('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8104('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8104('0x4'));var config=require(_0x8104('0x5'));var attributes=require('./squareMessage.attributes');module[_0x8104('0x6')]=function(_0xec613a,_0x5a2db2){return _0xec613a[_0x8104('0x7')]('SquareMessage',attributes,{'tableName':_0x8104('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83b3=['define','SquareMessage','square_messages','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x4a1c00,_0x410a9e){var _0x387359=function(_0x4c8698){while(--_0x4c8698){_0x4a1c00['push'](_0x4a1c00['shift']());}};_0x387359(++_0x410a9e);}(_0x83b3,0x179));var _0x383b=function(_0x4f9e12,_0x5c3b24){_0x4f9e12=_0x4f9e12-0x0;var _0x4563b0=_0x83b3[_0x4f9e12];return _0x4563b0;};'use strict';var _=require(_0x383b('0x0'));var util=require(_0x383b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x383b('0x2'));var BPromise=require(_0x383b('0x3'));var rp=require(_0x383b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x383b('0x5'));var config=require(_0x383b('0x6'));var attributes=require(_0x383b('0x7'));module['exports']=function(_0x148fce,_0x1d7031){return _0x148fce[_0x383b('0x8')](_0x383b('0x9'),attributes,{'tableName':_0x383b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 04b10f2..f7886b6 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 _0xd8b0=['CreateSquareMessage','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','SquareMessage','create','body','options'];(function(_0x48087a,_0x18cdbb){var _0xd651c2=function(_0xbd16ba){while(--_0xbd16ba){_0x48087a['push'](_0x48087a['shift']());}};_0xd651c2(++_0x18cdbb);}(_0xd8b0,0x11f));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0d8b('0x0'));var rs=require(_0x0d8b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d8b('0x2'));var logger=require('../../config/logger')(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var jayson=require(_0x0d8b('0x5'));var client=jayson[_0x0d8b('0x6')][_0x0d8b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1098c1,_0x270356,_0x5b3e2a){return new BPromise(function(_0x3e7b64,_0x288c8f){return client[_0x0d8b('0x8')](_0x1098c1,_0x5b3e2a)[_0x0d8b('0x9')](function(_0x4fd8a8){logger[_0x0d8b('0xa')]('SquareMessage,\x20%s,\x20%s',_0x270356,_0x0d8b('0xb'));logger[_0x0d8b('0xc')](_0x0d8b('0xd'),_0x270356,_0x0d8b('0xb'),JSON[_0x0d8b('0xe')](_0x4fd8a8));if(_0x4fd8a8[_0x0d8b('0xf')]){if(_0x4fd8a8[_0x0d8b('0xf')][_0x0d8b('0x10')]===0x1f4){logger[_0x0d8b('0xf')](_0x0d8b('0x11'),_0x270356,_0x4fd8a8['error'][_0x0d8b('0x12')]);return _0x288c8f(_0x4fd8a8['error'][_0x0d8b('0x12')]);}logger[_0x0d8b('0xf')](_0x0d8b('0x11'),_0x270356,_0x4fd8a8['error']['message']);return _0x3e7b64(_0x4fd8a8[_0x0d8b('0xf')][_0x0d8b('0x12')]);}else{logger[_0x0d8b('0xa')](_0x0d8b('0x11'),_0x270356,_0x0d8b('0xb'));_0x3e7b64(_0x4fd8a8[_0x0d8b('0x13')][_0x0d8b('0x12')]);}})[_0x0d8b('0x14')](function(_0x20ddcd){logger[_0x0d8b('0xf')](_0x0d8b('0x11'),_0x270356,_0x20ddcd);_0x288c8f(_0x20ddcd);});});}exports['CreateSquareMessage']=function(_0x1b0155){var _0x41b98a=this;return new Promise(function(_0x4bc92b,_0x1f0ffd){return db[_0x0d8b('0x15')][_0x0d8b('0x16')](_0x1b0155[_0x0d8b('0x17')],{'raw':_0x1b0155[_0x0d8b('0x18')]?_0x1b0155[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0d8b('0x9')](function(_0x3abe67){logger[_0x0d8b('0xa')]('CreateSquareMessage',_0x1b0155);logger[_0x0d8b('0xc')](_0x0d8b('0x19'),_0x1b0155,JSON[_0x0d8b('0xe')](_0x3abe67));_0x4bc92b(_0x3abe67);})['catch'](function(_0x4ad2a2){logger['error'](_0x0d8b('0x19'),_0x4ad2a2[_0x0d8b('0x12')],_0x1b0155);_0x1f0ffd(_0x41b98a[_0x0d8b('0xf')](0x1f4,_0x4ad2a2[_0x0d8b('0x12')]));});});}; \ No newline at end of file +var _0x362a=['SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x362a,0x171));var _0xa362=function(_0x1ea9b6,_0xa01d61){_0x1ea9b6=_0x1ea9b6-0x0;var _0x2fbbf2=_0x362a[_0x1ea9b6];return _0x2fbbf2;};'use strict';var _=require(_0xa362('0x0'));var util=require(_0xa362('0x1'));var moment=require(_0xa362('0x2'));var BPromise=require(_0xa362('0x3'));var rs=require(_0xa362('0x4'));var fs=require('fs');var Redis=require(_0xa362('0x5'));var db=require(_0xa362('0x6'))['db'];var utils=require(_0xa362('0x7'));var logger=require(_0xa362('0x8'))(_0xa362('0x9'));var config=require(_0xa362('0xa'));var jayson=require(_0xa362('0xb'));var client=jayson[_0xa362('0xc')][_0xa362('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x177f8d,_0x327738,_0x109490){return new BPromise(function(_0x385a7f,_0x4a9729){return client['request'](_0x177f8d,_0x109490)[_0xa362('0xe')](function(_0x414716){logger[_0xa362('0xf')]('SquareMessage,\x20%s,\x20%s',_0x327738,_0xa362('0x10'));logger[_0xa362('0x11')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x327738,'request\x20sent',JSON[_0xa362('0x12')](_0x414716));if(_0x414716['error']){if(_0x414716[_0xa362('0x13')][_0xa362('0x14')]===0x1f4){logger[_0xa362('0x13')](_0xa362('0x15'),_0x327738,_0x414716[_0xa362('0x13')][_0xa362('0x16')]);return _0x4a9729(_0x414716[_0xa362('0x13')][_0xa362('0x16')]);}logger[_0xa362('0x13')](_0xa362('0x15'),_0x327738,_0x414716[_0xa362('0x13')][_0xa362('0x16')]);return _0x385a7f(_0x414716[_0xa362('0x13')][_0xa362('0x16')]);}else{logger[_0xa362('0xf')]('SquareMessage,\x20%s,\x20%s',_0x327738,'request\x20sent');_0x385a7f(_0x414716[_0xa362('0x17')]['message']);}})[_0xa362('0x18')](function(_0x572797){logger['error']('SquareMessage,\x20%s,\x20%s',_0x327738,_0x572797);_0x4a9729(_0x572797);});});}exports[_0xa362('0x19')]=function(_0x202740){var _0x2e1b15=this;return new Promise(function(_0x3e29b3,_0x49be62){return db[_0xa362('0x1a')][_0xa362('0x1b')](_0x202740['body'],{'raw':_0x202740[_0xa362('0x1c')]?_0x202740[_0xa362('0x1c')][_0xa362('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3d5fe1){logger[_0xa362('0xf')](_0xa362('0x19'),_0x202740);logger[_0xa362('0x11')](_0xa362('0x19'),_0x202740,JSON[_0xa362('0x12')](_0x3d5fe1));_0x3e29b3(_0x3d5fe1);})[_0xa362('0x18')](function(_0x51427b){logger[_0xa362('0x13')](_0xa362('0x19'),_0x51427b[_0xa362('0x16')],_0x202740);_0x49be62(_0x2e1b15[_0xa362('0x13')](0x1f4,_0x51427b[_0xa362('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1098bba..e975bbc 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 _0x8c22=['express','Router','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','test','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3d0870,_0x4888c2){var _0x2f17c0=function(_0x1a52c1){while(--_0x1a52c1){_0x3d0870['push'](_0x3d0870['shift']());}};_0x2f17c0(++_0x4888c2);}(_0x8c22,0x1f1));var _0x28c2=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x8c22[_0xed9fea];return _0x198f12;};'use strict';var multer=require(_0x28c2('0x0'));var util=require(_0x28c2('0x1'));var path=require('path');var timeout=require(_0x28c2('0x2'));var express=require(_0x28c2('0x3'));var router=express[_0x28c2('0x4')]();var fs_extra=require(_0x28c2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28c2('0x6'));var controller=require(_0x28c2('0x7'));router[_0x28c2('0x8')]('/',auth[_0x28c2('0x9')](),controller[_0x28c2('0xa')]);router['get'](_0x28c2('0xb'),auth[_0x28c2('0x9')](),controller['show']);router[_0x28c2('0x8')]('/:id/test',auth[_0x28c2('0x9')](),timeout('15s'),controller[_0x28c2('0xc')]);router[_0x28c2('0xd')]('/',auth['isAuthenticated'](),controller[_0x28c2('0xe')]);router[_0x28c2('0xf')](_0x28c2('0xb'),auth[_0x28c2('0x9')](),controller[_0x28c2('0x10')]);router[_0x28c2('0x11')](_0x28c2('0xb'),auth['isAuthenticated'](),controller[_0x28c2('0x12')]);module[_0x28c2('0x13')]=router; \ No newline at end of file +var _0xe670=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','15s','test','post','create','put','update','delete','destroy','exports','path'];(function(_0xd7e9f1,_0xdca35c){var _0x5eba2a=function(_0x5c64b2){while(--_0x5c64b2){_0xd7e9f1['push'](_0xd7e9f1['shift']());}};_0x5eba2a(++_0xdca35c);}(_0xe670,0xe6));var _0x0e67=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xe670[_0xb7a459];return _0x104ab5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0e67('0x0'));var timeout=require(_0x0e67('0x1'));var express=require(_0x0e67('0x2'));var router=express[_0x0e67('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0e67('0x4'));var interaction=require(_0x0e67('0x5'));var config=require(_0x0e67('0x6'));var controller=require('./squareOdbc.controller');router[_0x0e67('0x7')]('/',auth[_0x0e67('0x8')](),controller[_0x0e67('0x9')]);router[_0x0e67('0x7')](_0x0e67('0xa'),auth[_0x0e67('0x8')](),controller[_0x0e67('0xb')]);router[_0x0e67('0x7')]('/:id/test',auth[_0x0e67('0x8')](),timeout(_0x0e67('0xc')),controller[_0x0e67('0xd')]);router[_0x0e67('0xe')]('/',auth['isAuthenticated'](),controller[_0x0e67('0xf')]);router[_0x0e67('0x10')](_0x0e67('0xa'),auth['isAuthenticated'](),controller[_0x0e67('0x11')]);router[_0x0e67('0x12')]('/:id',auth[_0x0e67('0x8')](),controller[_0x0e67('0x13')]);module[_0x0e67('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 3d0ffb0..2c2e667 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 _0x8626=['sequelize','exports','STRING','name'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8626,0x104));var _0x6862=function(_0x1534a6,_0x3fc09a){_0x1534a6=_0x1534a6-0x0;var _0x518820=_0x8626[_0x1534a6];return _0x518820;};'use strict';var Sequelize=require(_0x6862('0x0'));module[_0x6862('0x1')]={'name':{'type':Sequelize[_0x6862('0x2')],'unique':_0x6862('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3de8=['STRING','sequelize','exports','name'];(function(_0x5df780,_0x3460c8){var _0x535f5b=function(_0x505237){while(--_0x505237){_0x5df780['push'](_0x5df780['shift']());}};_0x535f5b(++_0x3460c8);}(_0x3de8,0xe9));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x83de('0x0'));module[_0x83de('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x83de('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x83de('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8cfbf1e..9c079cb 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 _0x5114=['fast-json-patch','request-promise','bluebird','mustache','util','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','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','odbc','dsn','eml-format','rimraf','zip-dir'];(function(_0x34dbc3,_0x58d3bb){var _0x2763b4=function(_0x1cfd5f){while(--_0x1cfd5f){_0x34dbc3['push'](_0x34dbc3['shift']());}};_0x2763b4(++_0x58d3bb);}(_0x5114,0xab));var _0x4511=function(_0x34d867,_0x1cdf99){_0x34d867=_0x34d867-0x0;var _0x1663dc=_0x5114[_0x34d867];return _0x1663dc;};'use strict';var emlformat=require(_0x4511('0x0'));var rimraf=require(_0x4511('0x1'));var zipdir=require(_0x4511('0x2'));var jsonpatch=require(_0x4511('0x3'));var rp=require(_0x4511('0x4'));var moment=require('moment');var BPromise=require(_0x4511('0x5'));var Mustache=require(_0x4511('0x6'));var util=require(_0x4511('0x7'));var path=require(_0x4511('0x8'));var sox=require(_0x4511('0x9'));var csv=require(_0x4511('0xa'));var ejs=require(_0x4511('0xb'));var fs=require('fs');var fs_extra=require(_0x4511('0xc'));var _=require(_0x4511('0xd'));var squel=require(_0x4511('0xe'));var crypto=require('crypto');var jsforce=require(_0x4511('0xf'));var deskjs=require(_0x4511('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4511('0x11'));var Papa=require(_0x4511('0x12'));var Redis=require(_0x4511('0x13'));var authService=require(_0x4511('0x14'));var qs=require(_0x4511('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4511('0x16'));var logger=require(_0x4511('0x17'))(_0x4511('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4511('0x19'));var db=require(_0x4511('0x1a'))['db'];function respondWithStatusCode(_0xa40fe5,_0x750e63){_0x750e63=_0x750e63||0xcc;return function(_0x12273b){if(_0x12273b){return _0xa40fe5['sendStatus'](_0x750e63);}return _0xa40fe5['status'](_0x750e63)[_0x4511('0x1b')]();};}function respondWithResult(_0x3feae9,_0x85681b){_0x85681b=_0x85681b||0xc8;return function(_0x3d85cd){if(_0x3d85cd){return _0x3feae9[_0x4511('0x1c')](_0x85681b)[_0x4511('0x1d')](_0x3d85cd);}};}function respondWithFilteredResult(_0x2ef14e,_0x1976b5){return function(_0x4a15ad){if(_0x4a15ad){var _0xd09a10=typeof _0x1976b5[_0x4511('0x1e')]===_0x4511('0x1f')&&typeof _0x1976b5['limit']==='undefined';var _0x4116a1=_0x4a15ad[_0x4511('0x20')];var _0x10c9b6=_0xd09a10?0x0:_0x1976b5[_0x4511('0x1e')];var _0x16b410=_0xd09a10?_0x4a15ad[_0x4511('0x20')]:_0x1976b5[_0x4511('0x1e')]+_0x1976b5[_0x4511('0x21')];var _0x4c4e69;if(_0x16b410>=_0x4116a1){_0x16b410=_0x4116a1;_0x4c4e69=0xc8;}else{_0x4c4e69=0xce;}_0x2ef14e[_0x4511('0x1c')](_0x4c4e69);return _0x2ef14e[_0x4511('0x22')]('Content-Range',_0x10c9b6+'-'+_0x16b410+'/'+_0x4116a1)[_0x4511('0x1d')](_0x4a15ad);}return null;};}function patchUpdates(_0x7b489b){return function(_0x37d0b1){try{jsonpatch['apply'](_0x37d0b1,_0x7b489b,!![]);}catch(_0x1abd8c){return BPromise[_0x4511('0x23')](_0x1abd8c);}return _0x37d0b1[_0x4511('0x24')]();};}function saveUpdates(_0x438964,_0x5463df){return function(_0x557728){if(_0x557728){return _0x557728['update'](_0x438964)[_0x4511('0x25')](function(_0x186b5d){return _0x186b5d;});}return null;};}function removeEntity(_0x4beb4a,_0x43e615){return function(_0x5d997b){if(_0x5d997b){return _0x5d997b[_0x4511('0x26')]()[_0x4511('0x25')](function(){var _0x5a1270=_0x5d997b[_0x4511('0x27')]({'plain':!![]});var _0x327805=_0x4511('0x28');return db[_0x4511('0x29')][_0x4511('0x26')]({'where':{'type':_0x327805,'resourceId':_0x5a1270['id']}})['then'](function(){return _0x5d997b;});})[_0x4511('0x25')](function(){_0x4beb4a['status'](0xcc)[_0x4511('0x1b')]();});}};}function handleEntityNotFound(_0x2ff322,_0x28db90){return function(_0x3d8ebd){if(!_0x3d8ebd){_0x2ff322[_0x4511('0x2a')](0x194);}return _0x3d8ebd;};}function handleError(_0x4ca8be,_0x504896){_0x504896=_0x504896||0x1f4;return function(_0x252b80){logger[_0x4511('0x2b')](_0x252b80[_0x4511('0x2c')]);if(_0x252b80[_0x4511('0x2d')]){delete _0x252b80[_0x4511('0x2d')];}_0x4ca8be[_0x4511('0x1c')](_0x504896)[_0x4511('0x2e')](_0x252b80);};}exports['index']=function(_0x1574e5,_0x4ac689){var _0x170627={},_0x32535c={},_0xc1bf65={'count':0x0,'rows':[]};var _0x39f786=_['map'](db[_0x4511('0x2f')][_0x4511('0x30')],function(_0x50cbab){return{'name':_0x50cbab[_0x4511('0x31')],'type':_0x50cbab[_0x4511('0x32')][_0x4511('0x33')]};});_0x32535c[_0x4511('0x34')]=_[_0x4511('0x35')](_0x39f786,_0x4511('0x2d'));_0x32535c[_0x4511('0x36')]=_[_0x4511('0x37')](_0x1574e5['query']);_0x32535c['filters']=_['intersection'](_0x32535c[_0x4511('0x34')],_0x32535c['query']);_0x170627[_0x4511('0x38')]=_[_0x4511('0x39')](_0x32535c['model'],qs[_0x4511('0x3a')](_0x1574e5['query'][_0x4511('0x3a')]));_0x170627[_0x4511('0x38')]=_0x170627[_0x4511('0x38')][_0x4511('0x3b')]?_0x170627[_0x4511('0x38')]:_0x32535c[_0x4511('0x34')];if(!_0x1574e5['query']['hasOwnProperty'](_0x4511('0x3c'))){_0x170627[_0x4511('0x21')]=qs['limit'](_0x1574e5[_0x4511('0x36')][_0x4511('0x21')]);_0x170627[_0x4511('0x1e')]=qs[_0x4511('0x1e')](_0x1574e5[_0x4511('0x36')]['offset']);}_0x170627[_0x4511('0x3d')]=qs[_0x4511('0x3e')](_0x1574e5[_0x4511('0x36')][_0x4511('0x3e')]);_0x170627['where']=qs['filters'](_['pick'](_0x1574e5[_0x4511('0x36')],_0x32535c[_0x4511('0x3f')]),_0x39f786);if(_0x1574e5['query']['filter']){_0x170627[_0x4511('0x40')]=_[_0x4511('0x41')](_0x170627[_0x4511('0x40')],{'$or':_['map'](_0x39f786,function(_0x5a2542){if(_0x5a2542['type']!==_0x4511('0x42')){var _0x33560b={};_0x33560b[_0x5a2542['name']]={'$like':'%'+_0x1574e5[_0x4511('0x36')][_0x4511('0x43')]+'%'};return _0x33560b;}})});}_0x170627=_[_0x4511('0x41')]({},_0x170627,_0x1574e5[_0x4511('0x44')]);var _0x480ef5={'where':_0x170627[_0x4511('0x40')]};return db[_0x4511('0x2f')][_0x4511('0x20')](_0x480ef5)[_0x4511('0x25')](function(_0x236a65){_0xc1bf65['count']=_0x236a65;if(_0x1574e5['query'][_0x4511('0x45')]){_0x170627[_0x4511('0x46')]=[{'all':!![]}];}return db['SquareOdbc'][_0x4511('0x47')](_0x170627);})[_0x4511('0x25')](function(_0x3d1bd6){_0xc1bf65[_0x4511('0x48')]=_0x3d1bd6;return _0xc1bf65;})[_0x4511('0x25')](respondWithFilteredResult(_0x4ac689,_0x170627))[_0x4511('0x49')](handleError(_0x4ac689,null));};exports[_0x4511('0x4a')]=function(_0x20fcfb,_0x466224){var _0x1e50bb={'raw':!![],'where':{'id':_0x20fcfb[_0x4511('0x4b')]['id']}},_0xb66ae9={};_0xb66ae9[_0x4511('0x34')]=_[_0x4511('0x37')](db[_0x4511('0x2f')][_0x4511('0x30')]);_0xb66ae9[_0x4511('0x36')]=_[_0x4511('0x37')](_0x20fcfb[_0x4511('0x36')]);_0xb66ae9[_0x4511('0x3f')]=_['intersection'](_0xb66ae9[_0x4511('0x34')],_0xb66ae9[_0x4511('0x36')]);_0x1e50bb['attributes']=_[_0x4511('0x39')](_0xb66ae9[_0x4511('0x34')],qs[_0x4511('0x3a')](_0x20fcfb['query'][_0x4511('0x3a')]));_0x1e50bb[_0x4511('0x38')]=_0x1e50bb[_0x4511('0x38')][_0x4511('0x3b')]?_0x1e50bb[_0x4511('0x38')]:_0xb66ae9['model'];if(_0x20fcfb[_0x4511('0x36')][_0x4511('0x45')]){_0x1e50bb[_0x4511('0x46')]=[{'all':!![]}];}_0x1e50bb=_[_0x4511('0x41')]({},_0x1e50bb,_0x20fcfb['options']);return db['SquareOdbc']['find'](_0x1e50bb)[_0x4511('0x25')](handleEntityNotFound(_0x466224,null))['then'](respondWithResult(_0x466224,null))[_0x4511('0x49')](handleError(_0x466224,null));};exports['create']=function(_0x2630f2,_0x1ca4a1){return db[_0x4511('0x2f')][_0x4511('0x4c')](_0x2630f2['body'],{})[_0x4511('0x25')](function(_0x5265d6){var _0x279910=_0x2630f2[_0x4511('0x4d')]['get']({'plain':!![]});if(!_0x279910)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x279910['role']==='user'){var _0x493881=_0x5265d6['get']({'plain':!![]});var _0x3b5b02='ODBC';return db[_0x4511('0x4e')][_0x4511('0x4f')]({'where':{'name':_0x3b5b02,'userProfileId':_0x279910[_0x4511('0x50')]},'raw':!![]})[_0x4511('0x25')](function(_0x1227fe){if(_0x1227fe&&_0x1227fe[_0x4511('0x51')]===0x0){return db[_0x4511('0x29')]['create']({'name':_0x493881[_0x4511('0x2d')],'resourceId':_0x493881['id'],'type':_0x1227fe['name'],'sectionId':_0x1227fe['id']},{})[_0x4511('0x25')](function(){return _0x5265d6;});}else{return _0x5265d6;}})[_0x4511('0x49')](function(_0x211c88){logger['error'](_0x4511('0x52'),_0x211c88);throw _0x211c88;});}return _0x5265d6;})['then'](respondWithResult(_0x1ca4a1,0xc9))[_0x4511('0x49')](handleError(_0x1ca4a1,null));};exports[_0x4511('0x53')]=function(_0x5dd39a,_0x4738b5){if(_0x5dd39a[_0x4511('0x54')]['id']){delete _0x5dd39a[_0x4511('0x54')]['id'];}return db['SquareOdbc'][_0x4511('0x4f')]({'where':{'id':_0x5dd39a[_0x4511('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4738b5,null))['then'](saveUpdates(_0x5dd39a['body'],null))[_0x4511('0x25')](respondWithResult(_0x4738b5,null))[_0x4511('0x49')](handleError(_0x4738b5,null));};exports[_0x4511('0x26')]=function(_0x487ac7,_0x38e20d){return db[_0x4511('0x2f')][_0x4511('0x4f')]({'where':{'id':_0x487ac7['params']['id']}})[_0x4511('0x25')](handleEntityNotFound(_0x38e20d,null))[_0x4511('0x25')](removeEntity(_0x38e20d,null))['catch'](handleError(_0x38e20d,null));};exports['test']=function(_0x4b678d,_0x2f3eba,_0x4b784c){var _0x469f65;return db[_0x4511('0x2f')][_0x4511('0x4f')]({'where':{'id':_0x4b678d[_0x4511('0x4b')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x2f3eba,null))[_0x4511('0x25')](function(_0x2a575a){if(_0x2a575a){var _0x1ab7d0=require(_0x4511('0x55'))();_0x1ab7d0['openSync'](_0x2a575a[_0x4511('0x56')]);_0x1ab7d0['closeSync']();return _0x2a575a;}})[_0x4511('0x25')](respondWithResult(_0x2f3eba,null))[_0x4511('0x49')](handleError(_0x2f3eba,null));}; \ No newline at end of file +var _0x751f=['stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','openSync','dsn','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x751f,0x133));var _0xf751=function(_0x1fb43,_0x54ae6b){_0x1fb43=_0x1fb43-0x0;var _0x317af5=_0x751f[_0x1fb43];return _0x317af5;};'use strict';var emlformat=require(_0xf751('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf751('0x1'));var jsonpatch=require(_0xf751('0x2'));var rp=require(_0xf751('0x3'));var moment=require(_0xf751('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf751('0x5'));var path=require(_0xf751('0x6'));var sox=require(_0xf751('0x7'));var csv=require(_0xf751('0x8'));var ejs=require(_0xf751('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf751('0xa'));var squel=require(_0xf751('0xb'));var crypto=require(_0xf751('0xc'));var jsforce=require(_0xf751('0xd'));var deskjs=require(_0xf751('0xe'));var toCsv=require(_0xf751('0x8'));var querystring=require('querystring');var Papa=require(_0xf751('0xf'));var Redis=require(_0xf751('0x10'));var authService=require(_0xf751('0x11'));var qs=require(_0xf751('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf751('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf751('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x274f2a,_0x3c14bf){_0x3c14bf=_0x3c14bf||0xcc;return function(_0xce1982){if(_0xce1982){return _0x274f2a['sendStatus'](_0x3c14bf);}return _0x274f2a[_0xf751('0x15')](_0x3c14bf)[_0xf751('0x16')]();};}function respondWithResult(_0xeb8b8,_0x27daa6){_0x27daa6=_0x27daa6||0xc8;return function(_0x5a0bb3){if(_0x5a0bb3){return _0xeb8b8['status'](_0x27daa6)[_0xf751('0x17')](_0x5a0bb3);}};}function respondWithFilteredResult(_0x2246b9,_0x9ccb5b){return function(_0x42dc25){if(_0x42dc25){var _0x312fde=typeof _0x9ccb5b[_0xf751('0x18')]===_0xf751('0x19')&&typeof _0x9ccb5b[_0xf751('0x1a')]===_0xf751('0x19');var _0x5db4b8=_0x42dc25['count'];var _0xf10e88=_0x312fde?0x0:_0x9ccb5b['offset'];var _0x58ce67=_0x312fde?_0x42dc25[_0xf751('0x1b')]:_0x9ccb5b[_0xf751('0x18')]+_0x9ccb5b[_0xf751('0x1a')];var _0x371f12;if(_0x58ce67>=_0x5db4b8){_0x58ce67=_0x5db4b8;_0x371f12=0xc8;}else{_0x371f12=0xce;}_0x2246b9[_0xf751('0x15')](_0x371f12);return _0x2246b9[_0xf751('0x1c')](_0xf751('0x1d'),_0xf10e88+'-'+_0x58ce67+'/'+_0x5db4b8)[_0xf751('0x17')](_0x42dc25);}return null;};}function patchUpdates(_0x1a9af4){return function(_0x268e7f){try{jsonpatch[_0xf751('0x1e')](_0x268e7f,_0x1a9af4,!![]);}catch(_0x334acc){return BPromise[_0xf751('0x1f')](_0x334acc);}return _0x268e7f[_0xf751('0x20')]();};}function saveUpdates(_0x27bc1c,_0x5a151e){return function(_0x3fe78f){if(_0x3fe78f){return _0x3fe78f[_0xf751('0x21')](_0x27bc1c)[_0xf751('0x22')](function(_0x4149f3){return _0x4149f3;});}return null;};}function removeEntity(_0x1179eb,_0x5b21c8){return function(_0x43c406){if(_0x43c406){return _0x43c406[_0xf751('0x23')]()[_0xf751('0x22')](function(){var _0x18e28b=_0x43c406[_0xf751('0x24')]({'plain':!![]});var _0x132317=_0xf751('0x25');return db[_0xf751('0x26')][_0xf751('0x23')]({'where':{'type':_0x132317,'resourceId':_0x18e28b['id']}})[_0xf751('0x22')](function(){return _0x43c406;});})['then'](function(){_0x1179eb[_0xf751('0x15')](0xcc)[_0xf751('0x16')]();});}};}function handleEntityNotFound(_0x377112,_0x2a3239){return function(_0x4f1c5c){if(!_0x4f1c5c){_0x377112[_0xf751('0x27')](0x194);}return _0x4f1c5c;};}function handleError(_0xf7dc9c,_0x340555){_0x340555=_0x340555||0x1f4;return function(_0x26d217){logger[_0xf751('0x28')](_0x26d217[_0xf751('0x29')]);if(_0x26d217[_0xf751('0x2a')]){delete _0x26d217[_0xf751('0x2a')];}_0xf7dc9c[_0xf751('0x15')](_0x340555)[_0xf751('0x2b')](_0x26d217);};}exports[_0xf751('0x2c')]=function(_0x49f029,_0x43a913){var _0x54c9f9={},_0xca2552={},_0x185e58={'count':0x0,'rows':[]};var _0x20a0cd=_['map'](db[_0xf751('0x2d')][_0xf751('0x2e')],function(_0x512175){return{'name':_0x512175[_0xf751('0x2f')],'type':_0x512175[_0xf751('0x30')][_0xf751('0x31')]};});_0xca2552['model']=_['map'](_0x20a0cd,_0xf751('0x2a'));_0xca2552[_0xf751('0x32')]=_['keys'](_0x49f029['query']);_0xca2552[_0xf751('0x33')]=_['intersection'](_0xca2552['model'],_0xca2552[_0xf751('0x32')]);_0x54c9f9[_0xf751('0x34')]=_[_0xf751('0x35')](_0xca2552[_0xf751('0x36')],qs[_0xf751('0x37')](_0x49f029['query'][_0xf751('0x37')]));_0x54c9f9['attributes']=_0x54c9f9[_0xf751('0x34')][_0xf751('0x38')]?_0x54c9f9['attributes']:_0xca2552['model'];if(!_0x49f029[_0xf751('0x32')][_0xf751('0x39')](_0xf751('0x3a'))){_0x54c9f9['limit']=qs[_0xf751('0x1a')](_0x49f029['query']['limit']);_0x54c9f9[_0xf751('0x18')]=qs[_0xf751('0x18')](_0x49f029[_0xf751('0x32')][_0xf751('0x18')]);}_0x54c9f9[_0xf751('0x3b')]=qs[_0xf751('0x3c')](_0x49f029[_0xf751('0x32')]['sort']);_0x54c9f9[_0xf751('0x3d')]=qs[_0xf751('0x33')](_[_0xf751('0x3e')](_0x49f029[_0xf751('0x32')],_0xca2552[_0xf751('0x33')]),_0x20a0cd);if(_0x49f029['query'][_0xf751('0x3f')]){_0x54c9f9[_0xf751('0x3d')]=_[_0xf751('0x40')](_0x54c9f9[_0xf751('0x3d')],{'$or':_[_0xf751('0x41')](_0x20a0cd,function(_0x51afe5){if(_0x51afe5['type']!==_0xf751('0x42')){var _0x497ffb={};_0x497ffb[_0x51afe5[_0xf751('0x2a')]]={'$like':'%'+_0x49f029[_0xf751('0x32')][_0xf751('0x3f')]+'%'};return _0x497ffb;}})});}_0x54c9f9=_[_0xf751('0x40')]({},_0x54c9f9,_0x49f029['options']);var _0x1c2109={'where':_0x54c9f9[_0xf751('0x3d')]};return db[_0xf751('0x2d')][_0xf751('0x1b')](_0x1c2109)[_0xf751('0x22')](function(_0x54be5f){_0x185e58[_0xf751('0x1b')]=_0x54be5f;if(_0x49f029['query']['includeAll']){_0x54c9f9[_0xf751('0x43')]=[{'all':!![]}];}return db[_0xf751('0x2d')][_0xf751('0x44')](_0x54c9f9);})[_0xf751('0x22')](function(_0x5e77e8){_0x185e58['rows']=_0x5e77e8;return _0x185e58;})[_0xf751('0x22')](respondWithFilteredResult(_0x43a913,_0x54c9f9))[_0xf751('0x45')](handleError(_0x43a913,null));};exports[_0xf751('0x46')]=function(_0x171b19,_0x56c99c){var _0x25a673={'raw':!![],'where':{'id':_0x171b19[_0xf751('0x47')]['id']}},_0x5acf10={};_0x5acf10[_0xf751('0x36')]=_[_0xf751('0x48')](db['SquareOdbc']['rawAttributes']);_0x5acf10['query']=_[_0xf751('0x48')](_0x171b19['query']);_0x5acf10[_0xf751('0x33')]=_[_0xf751('0x35')](_0x5acf10[_0xf751('0x36')],_0x5acf10[_0xf751('0x32')]);_0x25a673['attributes']=_[_0xf751('0x35')](_0x5acf10['model'],qs[_0xf751('0x37')](_0x171b19[_0xf751('0x32')]['fields']));_0x25a673['attributes']=_0x25a673[_0xf751('0x34')][_0xf751('0x38')]?_0x25a673[_0xf751('0x34')]:_0x5acf10['model'];if(_0x171b19[_0xf751('0x32')][_0xf751('0x49')]){_0x25a673[_0xf751('0x43')]=[{'all':!![]}];}_0x25a673=_['merge']({},_0x25a673,_0x171b19[_0xf751('0x4a')]);return db['SquareOdbc'][_0xf751('0x4b')](_0x25a673)[_0xf751('0x22')](handleEntityNotFound(_0x56c99c,null))['then'](respondWithResult(_0x56c99c,null))[_0xf751('0x45')](handleError(_0x56c99c,null));};exports['create']=function(_0x8c8ab3,_0x25b2ee){return db[_0xf751('0x2d')][_0xf751('0x4c')](_0x8c8ab3[_0xf751('0x4d')],{})[_0xf751('0x22')](function(_0x319c43){var _0x12a765=_0x8c8ab3[_0xf751('0x4e')][_0xf751('0x24')]({'plain':!![]});if(!_0x12a765)throw new Error(_0xf751('0x4f'));if(_0x12a765['role']===_0xf751('0x4e')){var _0x2c53aa=_0x319c43[_0xf751('0x24')]({'plain':!![]});var _0xaa3cce=_0xf751('0x25');return db[_0xf751('0x50')]['find']({'where':{'name':_0xaa3cce,'userProfileId':_0x12a765[_0xf751('0x51')]},'raw':!![]})[_0xf751('0x22')](function(_0x385b48){if(_0x385b48&&_0x385b48['autoAssociation']===0x0){return db[_0xf751('0x26')]['create']({'name':_0x2c53aa[_0xf751('0x2a')],'resourceId':_0x2c53aa['id'],'type':_0x385b48[_0xf751('0x2a')],'sectionId':_0x385b48['id']},{})[_0xf751('0x22')](function(){return _0x319c43;});}else{return _0x319c43;}})[_0xf751('0x45')](function(_0x108960){logger[_0xf751('0x28')](_0xf751('0x52'),_0x108960);throw _0x108960;});}return _0x319c43;})[_0xf751('0x22')](respondWithResult(_0x25b2ee,0xc9))[_0xf751('0x45')](handleError(_0x25b2ee,null));};exports[_0xf751('0x21')]=function(_0x38b119,_0x2ae40e){if(_0x38b119[_0xf751('0x4d')]['id']){delete _0x38b119[_0xf751('0x4d')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x38b119[_0xf751('0x47')]['id']}})[_0xf751('0x22')](handleEntityNotFound(_0x2ae40e,null))['then'](saveUpdates(_0x38b119[_0xf751('0x4d')],null))['then'](respondWithResult(_0x2ae40e,null))[_0xf751('0x45')](handleError(_0x2ae40e,null));};exports[_0xf751('0x23')]=function(_0xf8ef83,_0x2a2440){return db[_0xf751('0x2d')][_0xf751('0x4b')]({'where':{'id':_0xf8ef83['params']['id']}})[_0xf751('0x22')](handleEntityNotFound(_0x2a2440,null))['then'](removeEntity(_0x2a2440,null))[_0xf751('0x45')](handleError(_0x2a2440,null));};exports[_0xf751('0x53')]=function(_0x1b684a,_0x2489c7,_0x2ecc9a){var _0x5bca06;return db['SquareOdbc'][_0xf751('0x4b')]({'where':{'id':_0x1b684a[_0xf751('0x47')]['id']},'attributes':['id','dsn']})[_0xf751('0x22')](handleEntityNotFound(_0x2489c7,null))[_0xf751('0x22')](function(_0x20ca04){if(_0x20ca04){var _0x29f466=require('odbc')();_0x29f466[_0xf751('0x54')](_0x20ca04[_0xf751('0x55')]);_0x29f466[_0xf751('0x56')]();return _0x20ca04;}})[_0xf751('0x22')](respondWithResult(_0x2489c7,null))['catch'](handleError(_0x2489c7,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2083009..cacb68a 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 _0x04b4=['request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','lodash','util','../../config/logger','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04b4,0x17b));var _0x404b=function(_0xd21fa4,_0xce2592){_0xd21fa4=_0xd21fa4-0x0;var _0x53395a=_0x04b4[_0xd21fa4];return _0x53395a;};'use strict';var _=require(_0x404b('0x0'));var util=require(_0x404b('0x1'));var logger=require(_0x404b('0x2'))('api');var moment=require(_0x404b('0x3'));var BPromise=require(_0x404b('0x4'));var rp=require(_0x404b('0x5'));var fs=require('fs');var path=require(_0x404b('0x6'));var rimraf=require(_0x404b('0x7'));var config=require(_0x404b('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x404b('0x9')]=function(_0x3910a6,_0x46c6a8){return _0x3910a6[_0x404b('0xa')](_0x404b('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed96=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','moment','bluebird','request-promise','path'];(function(_0x5a5322,_0x1d8e4d){var _0x3541db=function(_0x134246){while(--_0x134246){_0x5a5322['push'](_0x5a5322['shift']());}};_0x3541db(++_0x1d8e4d);}(_0xed96,0x1e6));var _0x6ed9=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xed96[_0x1b3564];return _0x504069;};'use strict';var _=require(_0x6ed9('0x0'));var util=require(_0x6ed9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6ed9('0x2'));var BPromise=require(_0x6ed9('0x3'));var rp=require(_0x6ed9('0x4'));var fs=require('fs');var path=require(_0x6ed9('0x5'));var rimraf=require('rimraf');var config=require(_0x6ed9('0x6'));var attributes=require(_0x6ed9('0x7'));module[_0x6ed9('0x8')]=function(_0x13f0d2,_0x4cf311){return _0x13f0d2[_0x6ed9('0x9')](_0x6ed9('0xa'),attributes,{'tableName':_0x6ed9('0xb'),'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 cbdb69f..20a4b3c 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 _0x021e=['map','include','model','then','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes'];(function(_0x3fbb91,_0x5ec106){var _0x3eb213=function(_0x118b9f){while(--_0x118b9f){_0x3fbb91['push'](_0x3fbb91['shift']());}};_0x3eb213(++_0x5ec106);}(_0x021e,0x1d5));var _0xe021=function(_0x541639,_0x698af3){_0x541639=_0x541639-0x0;var _0x414d6e=_0x021e[_0x541639];return _0x414d6e;};'use strict';var _=require(_0xe021('0x0'));var util=require('util');var moment=require(_0xe021('0x1'));var BPromise=require(_0xe021('0x2'));var rs=require(_0xe021('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe021('0x4'));var logger=require(_0xe021('0x5'))(_0xe021('0x6'));var config=require('../../config/environment');var jayson=require(_0xe021('0x7'));var client=jayson[_0xe021('0x8')][_0xe021('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x263ad5,_0x4569c0,_0x50cd75){return new BPromise(function(_0x4b3d6f,_0x268ec3){return client[_0xe021('0xa')](_0x263ad5,_0x50cd75)['then'](function(_0x1e6b3a){logger[_0xe021('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x4569c0,_0xe021('0xc'));logger[_0xe021('0xd')](_0xe021('0xe'),_0x4569c0,_0xe021('0xc'),JSON[_0xe021('0xf')](_0x1e6b3a));if(_0x1e6b3a['error']){if(_0x1e6b3a[_0xe021('0x10')]['code']===0x1f4){logger['error'](_0xe021('0x11'),_0x4569c0,_0x1e6b3a[_0xe021('0x10')][_0xe021('0x12')]);return _0x268ec3(_0x1e6b3a[_0xe021('0x10')]['message']);}logger[_0xe021('0x10')](_0xe021('0x11'),_0x4569c0,_0x1e6b3a[_0xe021('0x10')][_0xe021('0x12')]);return _0x4b3d6f(_0x1e6b3a[_0xe021('0x10')][_0xe021('0x12')]);}else{logger['info'](_0xe021('0x11'),_0x4569c0,_0xe021('0xc'));_0x4b3d6f(_0x1e6b3a['result']['message']);}})[_0xe021('0x13')](function(_0x3b9629){logger['error'](_0xe021('0x11'),_0x4569c0,_0x3b9629);_0x268ec3(_0x3b9629);});});}exports[_0xe021('0x14')]=function(_0x3a6c28){var _0x4b9860=this;return new Promise(function(_0x1de3f3,_0x4729ba){return db[_0xe021('0x15')][_0xe021('0x16')]({'raw':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28[_0xe021('0x17')][_0xe021('0x18')]===undefined?!![]:![]:!![],'where':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28['options'][_0xe021('0x19')]||null:null,'attributes':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28[_0xe021('0x17')][_0xe021('0x1a')]||null:null,'include':_0x3a6c28[_0xe021('0x17')]?_0x3a6c28[_0xe021('0x17')]['include']?_[_0xe021('0x1b')](_0x3a6c28[_0xe021('0x17')][_0xe021('0x1c')],function(_0x1e248f){return{'model':db[_0x1e248f[_0xe021('0x1d')]],'as':_0x1e248f['as'],'attributes':_0x1e248f[_0xe021('0x1a')],'include':_0x1e248f[_0xe021('0x1c')]?_[_0xe021('0x1b')](_0x1e248f[_0xe021('0x1c')],function(_0x516292){return{'model':db[_0x516292[_0xe021('0x1d')]],'as':_0x516292['as'],'attributes':_0x516292[_0xe021('0x1a')],'include':_0x516292['include']?_[_0xe021('0x1b')](_0x516292[_0xe021('0x1c')],function(_0x4c6426){return{'model':db[_0x4c6426['model']],'as':_0x4c6426['as'],'attributes':_0x4c6426[_0xe021('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe021('0x1e')](function(_0x380286){logger[_0xe021('0xb')]('ShowSquareOdbc',_0x3a6c28);logger[_0xe021('0xd')]('ShowSquareOdbc',_0x3a6c28,JSON[_0xe021('0xf')](_0x380286));_0x1de3f3(_0x380286);})[_0xe021('0x13')](function(_0x294cda){logger[_0xe021('0x10')](_0xe021('0x14'),_0x294cda['message'],_0x3a6c28);_0x4729ba(_0x4b9860[_0xe021('0x10')](0x1f4,_0x294cda[_0xe021('0x12')]));});});}; \ No newline at end of file +var _0xdc86=['map','model','attributes','ShowSquareOdbc','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','SquareOdbc','options','raw','where','include'];(function(_0x3cbb90,_0x3ffd66){var _0x392d10=function(_0x2b4560){while(--_0x2b4560){_0x3cbb90['push'](_0x3cbb90['shift']());}};_0x392d10(++_0x3ffd66);}(_0xdc86,0x1c5));var _0x6dc8=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xdc86[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0x6dc8('0x0'));var util=require(_0x6dc8('0x1'));var moment=require(_0x6dc8('0x2'));var BPromise=require(_0x6dc8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dc8('0x4'));var db=require(_0x6dc8('0x5'))['db'];var utils=require(_0x6dc8('0x6'));var logger=require(_0x6dc8('0x7'))(_0x6dc8('0x8'));var config=require(_0x6dc8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6dc8('0xa')][_0x6dc8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5969e9,_0x533355,_0x5938a7){return new BPromise(function(_0x4f2e82,_0x436f9a){return client['request'](_0x5969e9,_0x5938a7)[_0x6dc8('0xc')](function(_0x2a3784){logger[_0x6dc8('0xd')](_0x6dc8('0xe'),_0x533355,'request\x20sent');logger[_0x6dc8('0xf')](_0x6dc8('0x10'),_0x533355,'request\x20sent',JSON[_0x6dc8('0x11')](_0x2a3784));if(_0x2a3784[_0x6dc8('0x12')]){if(_0x2a3784[_0x6dc8('0x12')][_0x6dc8('0x13')]===0x1f4){logger[_0x6dc8('0x12')](_0x6dc8('0xe'),_0x533355,_0x2a3784[_0x6dc8('0x12')]['message']);return _0x436f9a(_0x2a3784['error'][_0x6dc8('0x14')]);}logger[_0x6dc8('0x12')](_0x6dc8('0xe'),_0x533355,_0x2a3784[_0x6dc8('0x12')][_0x6dc8('0x14')]);return _0x4f2e82(_0x2a3784[_0x6dc8('0x12')][_0x6dc8('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x533355,_0x6dc8('0x15'));_0x4f2e82(_0x2a3784['result'][_0x6dc8('0x14')]);}})['catch'](function(_0x2387f0){logger[_0x6dc8('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x533355,_0x2387f0);_0x436f9a(_0x2387f0);});});}exports['ShowSquareOdbc']=function(_0x1e7c0b){var _0x1857a2=this;return new Promise(function(_0x4e647b,_0x32ae7c){return db[_0x6dc8('0x16')]['find']({'raw':_0x1e7c0b[_0x6dc8('0x17')]?_0x1e7c0b[_0x6dc8('0x17')][_0x6dc8('0x18')]===undefined?!![]:![]:!![],'where':_0x1e7c0b[_0x6dc8('0x17')]?_0x1e7c0b[_0x6dc8('0x17')][_0x6dc8('0x19')]||null:null,'attributes':_0x1e7c0b[_0x6dc8('0x17')]?_0x1e7c0b[_0x6dc8('0x17')]['attributes']||null:null,'include':_0x1e7c0b['options']?_0x1e7c0b[_0x6dc8('0x17')][_0x6dc8('0x1a')]?_[_0x6dc8('0x1b')](_0x1e7c0b['options'][_0x6dc8('0x1a')],function(_0x2c4c51){return{'model':db[_0x2c4c51[_0x6dc8('0x1c')]],'as':_0x2c4c51['as'],'attributes':_0x2c4c51[_0x6dc8('0x1d')],'include':_0x2c4c51[_0x6dc8('0x1a')]?_['map'](_0x2c4c51['include'],function(_0x533f0f){return{'model':db[_0x533f0f['model']],'as':_0x533f0f['as'],'attributes':_0x533f0f[_0x6dc8('0x1d')],'include':_0x533f0f[_0x6dc8('0x1a')]?_[_0x6dc8('0x1b')](_0x533f0f[_0x6dc8('0x1a')],function(_0x3c79b0){return{'model':db[_0x3c79b0[_0x6dc8('0x1c')]],'as':_0x3c79b0['as'],'attributes':_0x3c79b0[_0x6dc8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b62d){logger[_0x6dc8('0xd')](_0x6dc8('0x1e'),_0x1e7c0b);logger[_0x6dc8('0xf')](_0x6dc8('0x1e'),_0x1e7c0b,JSON[_0x6dc8('0x11')](_0x37b62d));_0x4e647b(_0x37b62d);})[_0x6dc8('0x1f')](function(_0x5a05ef){logger[_0x6dc8('0x12')](_0x6dc8('0x1e'),_0x5a05ef['message'],_0x1e7c0b);_0x32ae7c(_0x1857a2[_0x6dc8('0x12')](0x1f4,_0x5a05ef[_0x6dc8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e2536f0..db3dddd 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 _0x58c8=['show','/:id/users','getUsers','post','addUsers','put','/:id','delete','destroy','removeUsers','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0x2e293b,_0x3a6cb1){var _0x5d7a68=function(_0x315233){while(--_0x315233){_0x2e293b['push'](_0x2e293b['shift']());}};_0x5d7a68(++_0x3a6cb1);}(_0x58c8,0x1d9));var _0x858c=function(_0x518ba6,_0x2f55b3){_0x518ba6=_0x518ba6-0x0;var _0x319f35=_0x58c8[_0x518ba6];return _0x319f35;};'use strict';var multer=require('multer');var util=require(_0x858c('0x0'));var path=require('path');var timeout=require(_0x858c('0x1'));var express=require('express');var router=express[_0x858c('0x2')]();var fs_extra=require(_0x858c('0x3'));var auth=require(_0x858c('0x4'));var interaction=require(_0x858c('0x5'));var config=require(_0x858c('0x6'));var controller=require(_0x858c('0x7'));router[_0x858c('0x8')]('/',auth[_0x858c('0x9')](),controller[_0x858c('0xa')]);router[_0x858c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x858c('0xb')]);router[_0x858c('0x8')](_0x858c('0xc'),auth[_0x858c('0x9')](),controller[_0x858c('0xd')]);router['post']('/',auth[_0x858c('0x9')](),controller['create']);router[_0x858c('0xe')](_0x858c('0xc'),auth['isAuthenticated'](),controller[_0x858c('0xf')]);router[_0x858c('0x10')](_0x858c('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x858c('0x12')](_0x858c('0x11'),auth['isAuthenticated'](),controller[_0x858c('0x13')]);router[_0x858c('0x12')](_0x858c('0xc'),auth[_0x858c('0x9')](),controller[_0x858c('0x14')]);module[_0x858c('0x15')]=router; \ No newline at end of file +var _0x9bb3=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','post','addUsers','put','destroy','delete','removeUsers','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5a6d21,_0x3f8681){var _0x1230b8=function(_0x5ab770){while(--_0x5ab770){_0x5a6d21['push'](_0x5a6d21['shift']());}};_0x1230b8(++_0x3f8681);}(_0x9bb3,0x134));var _0x39bb=function(_0x194b78,_0x28588b){_0x194b78=_0x194b78-0x0;var _0x414a0a=_0x9bb3[_0x194b78];return _0x414a0a;};'use strict';var multer=require(_0x39bb('0x0'));var util=require(_0x39bb('0x1'));var path=require(_0x39bb('0x2'));var timeout=require(_0x39bb('0x3'));var express=require(_0x39bb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x39bb('0x5'));var interaction=require(_0x39bb('0x6'));var config=require(_0x39bb('0x7'));var controller=require(_0x39bb('0x8'));router[_0x39bb('0x9')]('/',auth[_0x39bb('0xa')](),controller[_0x39bb('0xb')]);router[_0x39bb('0x9')](_0x39bb('0xc'),auth[_0x39bb('0xa')](),controller[_0x39bb('0xd')]);router[_0x39bb('0x9')](_0x39bb('0xe'),auth['isAuthenticated'](),controller['getUsers']);router[_0x39bb('0xf')]('/',auth[_0x39bb('0xa')](),controller['create']);router[_0x39bb('0xf')]('/:id/users',auth[_0x39bb('0xa')](),controller[_0x39bb('0x10')]);router[_0x39bb('0x11')]('/:id',auth[_0x39bb('0xa')](),controller['update']);router['delete'](_0x39bb('0xc'),auth[_0x39bb('0xa')](),controller[_0x39bb('0x12')]);router[_0x39bb('0x13')](_0x39bb('0xe'),auth[_0x39bb('0xa')](),controller[_0x39bb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0813900..5a18070 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 _0x4e25=['STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','exports'];(function(_0x5f4e19,_0x1f3030){var _0x10f3ee=function(_0x25cb24){while(--_0x25cb24){_0x5f4e19['push'](_0x5f4e19['shift']());}};_0x10f3ee(++_0x1f3030);}(_0x4e25,0x175));var _0x54e2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4e25[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x54e2('0x0')]={'name':{'type':Sequelize[_0x54e2('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x54e2('0x1')]},'notes':{'type':Sequelize[_0x54e2('0x2')]},'preproduction':{'type':Sequelize[_0x54e2('0x3')]('long'),'get':function(){if(this[_0x54e2('0x4')](_0x54e2('0x5'))){return this[_0x54e2('0x4')](_0x54e2('0x5'))[_0x54e2('0x6')](_0x54e2('0x7'));}}},'production':{'type':Sequelize[_0x54e2('0x3')](_0x54e2('0x8')),'get':function(){if(this['getDataValue'](_0x54e2('0x9'))){return this[_0x54e2('0x4')]('production')['toString'](_0x54e2('0x7'));}}},'savedAt':{'type':Sequelize[_0x54e2('0xa')]},'publishedAt':{'type':Sequelize[_0x54e2('0xa')]}}; \ No newline at end of file +var _0x221c=['getDataValue','preproduction','toString','utf8','production','DATE','STRING','name','TEXT','BLOB','long'];(function(_0x5b0e3d,_0x22f432){var _0x67a168=function(_0x1bf796){while(--_0x1bf796){_0x5b0e3d['push'](_0x5b0e3d['shift']());}};_0x67a168(++_0x22f432);}(_0x221c,0x17c));var _0xc221=function(_0x1eb162,_0x13aea0){_0x1eb162=_0x1eb162-0x0;var _0x1e3ef7=_0x221c[_0x1eb162];return _0x1e3ef7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc221('0x0')],'unique':_0xc221('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xc221('0x0')]},'notes':{'type':Sequelize[_0xc221('0x2')]},'preproduction':{'type':Sequelize[_0xc221('0x3')](_0xc221('0x4')),'get':function(){if(this[_0xc221('0x5')](_0xc221('0x6'))){return this[_0xc221('0x5')](_0xc221('0x6'))[_0xc221('0x7')](_0xc221('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0xc221('0x4')),'get':function(){if(this[_0xc221('0x5')]('production')){return this['getDataValue'](_0xc221('0x9'))[_0xc221('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0xc221('0xa')]},'publishedAt':{'type':Sequelize[_0xc221('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 009507f..bf7c3bc 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 _0xc1c6=['../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','SquareProjects','then','publish','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SquareProject','includeAll','include','rows','show','params','keys','find','catch','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','pick','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','lodash','ioredis'];(function(_0x5246dd,_0x5e824d){var _0x357762=function(_0x6855a7){while(--_0x6855a7){_0x5246dd['push'](_0x5246dd['shift']());}};_0x357762(++_0x5e824d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4ccb7e,_0x185e96){_0x4ccb7e=_0x4ccb7e-0x0;var _0x25fe87=_0xc1c6[_0x4ccb7e];return _0x25fe87;};'use strict';var _=require(_0x6c1c('0x0'));var Redis=require(_0x6c1c('0x1'));var qs=require(_0x6c1c('0x2'));var logger=require('../../config/logger')(_0x6c1c('0x3'));var config=require('../../config/environment');var db=require(_0x6c1c('0x4'))['db'];config[_0x6c1c('0x5')]=_[_0x6c1c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c1c('0x7'))(new Redis(config['redis']));require(_0x6c1c('0x8'))['register'](socket);function respondWithStatusCode(_0xe510ca,_0x2eb1ba){_0x2eb1ba=_0x2eb1ba||0xcc;return function(_0x38369d){if(_0x38369d){return _0xe510ca[_0x6c1c('0x9')](_0x2eb1ba);}return _0xe510ca['status'](_0x2eb1ba)[_0x6c1c('0xa')]();};}function respondWithResult(_0x3ca985,_0x524d21){_0x524d21=_0x524d21||0xc8;return function(_0x147c7b){if(_0x147c7b){return _0x3ca985[_0x6c1c('0xb')](_0x524d21)[_0x6c1c('0xc')](_0x147c7b);}};}function respondWithFilteredResult(_0x1137e8,_0x49fb01){return function(_0x3a25a2){if(_0x3a25a2){var _0x2a4fd4=typeof _0x49fb01[_0x6c1c('0xd')]==='undefined'&&typeof _0x49fb01[_0x6c1c('0xe')]===_0x6c1c('0xf');var _0x2067bd=_0x3a25a2['count'];var _0x2e82e9=_0x2a4fd4?0x0:_0x49fb01['offset'];var _0x357370=_0x2a4fd4?_0x3a25a2[_0x6c1c('0x10')]:_0x49fb01[_0x6c1c('0xd')]+_0x49fb01[_0x6c1c('0xe')];var _0x350e6f;if(_0x357370>=_0x2067bd){_0x357370=_0x2067bd;_0x350e6f=0xc8;}else{_0x350e6f=0xce;}_0x1137e8[_0x6c1c('0xb')](_0x350e6f);return _0x1137e8[_0x6c1c('0x11')](_0x6c1c('0x12'),_0x2e82e9+'-'+_0x357370+'/'+_0x2067bd)[_0x6c1c('0xc')](_0x3a25a2);}return null;};}function saveUpdates(_0x5f3758){return function(_0x3df1b7){if(_0x3df1b7){return _0x3df1b7[_0x6c1c('0x13')](_0x5f3758)['then'](function(_0x3a2d32){return _0x3a2d32;});}return null;};}function removeEntity(_0x237cac){return function(_0x494ffc){if(_0x494ffc){return _0x494ffc[_0x6c1c('0x14')]()['then'](function(){var _0x338dc2=_0x494ffc[_0x6c1c('0x15')]({'plain':!![]});var _0x5a3bb7=_0x6c1c('0x16');return db['UserProfileResource'][_0x6c1c('0x14')]({'where':{'type':_0x5a3bb7,'resourceId':_0x338dc2['id']}})[_0x6c1c('0x17')](function(){return _0x494ffc;});})[_0x6c1c('0x17')](function(){var _0x211f49=new Redis(config[_0x6c1c('0x5')]);_0x211f49[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON[_0x6c1c('0x1a')]({'id':_0x494ffc['id'],'deleted':!![]}));})[_0x6c1c('0x17')](function(){_0x237cac[_0x6c1c('0xb')](0xcc)[_0x6c1c('0xa')]();});}};}function handleEntityNotFound(_0x450b1f){return function(_0x2382c0){if(!_0x2382c0){_0x450b1f[_0x6c1c('0x9')](0x194);}return _0x2382c0;};}function handleError(_0x31fed2,_0x19c269){_0x19c269=_0x19c269||0x1f4;return function(_0x2319d3){logger[_0x6c1c('0x1b')](_0x2319d3[_0x6c1c('0x1c')]);if(_0x2319d3[_0x6c1c('0x1d')]){delete _0x2319d3[_0x6c1c('0x1d')];}_0x31fed2[_0x6c1c('0xb')](_0x19c269)[_0x6c1c('0x1e')](_0x2319d3);};}exports[_0x6c1c('0x1f')]=function(_0x18452d,_0x80bc05){var _0x3b7cc1={},_0x1b9d7d={},_0x2feaf4={'count':0x0,'rows':[]};var _0x5f4568=_[_0x6c1c('0x20')](db['SquareProject'][_0x6c1c('0x21')],function(_0x4c23f8){return{'name':_0x4c23f8[_0x6c1c('0x22')],'type':_0x4c23f8['type'][_0x6c1c('0x23')]};});_0x1b9d7d[_0x6c1c('0x24')]=_['map'](_0x5f4568,_0x6c1c('0x1d'));_0x1b9d7d[_0x6c1c('0x25')]=_['keys'](_0x18452d[_0x6c1c('0x25')]);_0x1b9d7d[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],_0x1b9d7d['query']);_0x3b7cc1['attributes']=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x28')]));_0x3b7cc1[_0x6c1c('0x29')]=_0x3b7cc1['attributes'][_0x6c1c('0x2a')]?_0x3b7cc1[_0x6c1c('0x29')]:_0x1b9d7d['model'];if(!_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2b')](_0x6c1c('0x2c'))){_0x3b7cc1[_0x6c1c('0xe')]=qs['limit'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0xe')]);_0x3b7cc1[_0x6c1c('0xd')]=qs['offset'](_0x18452d[_0x6c1c('0x25')]['offset']);}_0x3b7cc1[_0x6c1c('0x2d')]=qs['sort'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2e')]);_0x3b7cc1[_0x6c1c('0x2f')]=qs['filters'](_['pick'](_0x18452d[_0x6c1c('0x25')],_0x1b9d7d[_0x6c1c('0x26')]),_0x5f4568);if(_0x18452d[_0x6c1c('0x25')]['filter']){_0x3b7cc1[_0x6c1c('0x2f')]=_['merge'](_0x3b7cc1['where'],{'$or':_[_0x6c1c('0x20')](_0x5f4568,function(_0xbafcb3){if(_0xbafcb3[_0x6c1c('0x30')]!==_0x6c1c('0x31')){var _0x4bed10={};_0x4bed10[_0xbafcb3[_0x6c1c('0x1d')]]={'$like':'%'+_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4bed10;}})});}_0x3b7cc1=_[_0x6c1c('0x33')]({},_0x3b7cc1,_0x18452d[_0x6c1c('0x34')]);var _0x398e95={'where':_0x3b7cc1[_0x6c1c('0x2f')]};return db[_0x6c1c('0x35')][_0x6c1c('0x10')](_0x398e95)[_0x6c1c('0x17')](function(_0x47d75e){_0x2feaf4[_0x6c1c('0x10')]=_0x47d75e;if(_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x36')]){_0x3b7cc1[_0x6c1c('0x37')]=[{'all':!![]}];}return db[_0x6c1c('0x35')]['findAll'](_0x3b7cc1);})['then'](function(_0x549db1){_0x2feaf4[_0x6c1c('0x38')]=_0x549db1;return _0x2feaf4;})['then'](respondWithFilteredResult(_0x80bc05,_0x3b7cc1))['catch'](handleError(_0x80bc05,null));};exports[_0x6c1c('0x39')]=function(_0x37244e,_0x5f3f3e){var _0x2b2ae5={'raw':![],'where':{'id':_0x37244e[_0x6c1c('0x3a')]['id']}},_0x40645f={};_0x40645f['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x35')]['rawAttributes']);_0x40645f[_0x6c1c('0x25')]=_['keys'](_0x37244e[_0x6c1c('0x25')]);_0x40645f[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],_0x40645f[_0x6c1c('0x25')]);_0x2b2ae5['attributes']=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x37244e['query'][_0x6c1c('0x28')]));_0x2b2ae5[_0x6c1c('0x29')]=_0x2b2ae5[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x2b2ae5[_0x6c1c('0x29')]:_0x40645f['model'];if(_0x37244e[_0x6c1c('0x25')]['includeAll']){_0x2b2ae5['include']=[{'all':!![]}];}_0x2b2ae5=_['merge']({},_0x2b2ae5,_0x37244e[_0x6c1c('0x34')]);return db[_0x6c1c('0x35')][_0x6c1c('0x3c')](_0x2b2ae5)[_0x6c1c('0x17')](handleEntityNotFound(_0x5f3f3e,null))[_0x6c1c('0x17')](respondWithResult(_0x5f3f3e,null))[_0x6c1c('0x3d')](handleError(_0x5f3f3e,null));};exports[_0x6c1c('0x3e')]=function(_0x167f3b,_0x5ed2d7){return db[_0x6c1c('0x35')][_0x6c1c('0x3e')](_0x167f3b['body'],{})[_0x6c1c('0x17')](function(_0x5518f6){var _0x39e741=_0x167f3b[_0x6c1c('0x3f')][_0x6c1c('0x15')]({'plain':!![]});if(!_0x39e741)throw new Error(_0x6c1c('0x40'));if(_0x39e741[_0x6c1c('0x41')]==='user'){var _0x1fe6e8=_0x5518f6['get']({'plain':!![]});var _0x2a59bc=_0x6c1c('0x16');return db[_0x6c1c('0x42')][_0x6c1c('0x3c')]({'where':{'name':_0x2a59bc,'userProfileId':_0x39e741[_0x6c1c('0x43')]},'raw':!![]})[_0x6c1c('0x17')](function(_0x52c14d){if(_0x52c14d&&_0x52c14d[_0x6c1c('0x44')]===0x0){return db[_0x6c1c('0x45')]['create']({'name':_0x1fe6e8[_0x6c1c('0x1d')],'resourceId':_0x1fe6e8['id'],'type':_0x52c14d[_0x6c1c('0x1d')],'sectionId':_0x52c14d['id']},{})[_0x6c1c('0x17')](function(){return _0x5518f6;});}else{return _0x5518f6;}})[_0x6c1c('0x3d')](function(_0x5badb4){logger[_0x6c1c('0x1b')](_0x6c1c('0x46'),_0x5badb4);throw _0x5badb4;});}return _0x5518f6;})[_0x6c1c('0x17')](respondWithResult(_0x5ed2d7,0xc9))['catch'](handleError(_0x5ed2d7,null));};exports['update']=function(_0x56b367,_0x5714a6){if(_0x56b367['body']['id']){delete _0x56b367[_0x6c1c('0x47')]['id'];}return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x56b367[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x17')](saveUpdates(_0x56b367['body'],null))['then'](function(_0x28bd68){if(!_0x28bd68)return;var _0xd5936=_0x28bd68['get']({'plain':!![]});return _0xd5936;})[_0x6c1c('0x17')](function(_0x25dda9){var _0x3f4303=new Redis(config[_0x6c1c('0x5')]);_0x3f4303[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON['stringify'](_[_0x6c1c('0x48')](_0x25dda9,['id',_0x6c1c('0x1d'),'production'])));return _0x25dda9;})['then'](respondWithResult(_0x5714a6,null))[_0x6c1c('0x3d')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x14')]=function(_0x3a2fef,_0x58ac8d){return db[_0x6c1c('0x35')][_0x6c1c('0x3c')]({'where':{'id':_0x3a2fef[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x58ac8d,null))['then'](removeEntity(_0x58ac8d,null))['catch'](handleError(_0x58ac8d,null));};exports[_0x6c1c('0x49')]=function(_0x1ac7e4,_0x1a8e19){return db['SquareProject']['find']({'where':{'id':_0x1ac7e4[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x1a8e19,null))['then'](function(_0x2a334b){if(_0x2a334b){return _0x2a334b[_0x6c1c('0x49')](_0x1ac7e4[_0x6c1c('0x47')][_0x6c1c('0x4a')],_[_0x6c1c('0x4b')](_0x1ac7e4[_0x6c1c('0x47')],['ids','id'])||{});}})[_0x6c1c('0x17')](respondWithResult(_0x1a8e19,null))['catch'](handleError(_0x1a8e19,null));};exports[_0x6c1c('0x4c')]=function(_0x1930ea,_0x117240){return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x1930ea['params']['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x117240,null))[_0x6c1c('0x17')](function(_0x612be2){if(_0x612be2){return _0x612be2['removeUsers'](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])[_0x6c1c('0x17')](function(){if(_[_0x6c1c('0x4d')](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])){for(var _0xed095f=0x0;_0xed095f<_0x1930ea['query'][_0x6c1c('0x4a')]['length'];_0xed095f+=0x1){socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')][_0xed095f]),'SquareProjectId':Number(_0x1930ea['params']['id'])});}}else{socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')]),'SquareProjectId':Number(_0x1930ea[_0x6c1c('0x3a')]['id'])});}});}})[_0x6c1c('0x17')](respondWithStatusCode(_0x117240,null))[_0x6c1c('0x3d')](handleError(_0x117240,null));};exports[_0x6c1c('0x50')]=function(_0x2d248c,_0x13963a){var _0x26ee48={};var _0x4fa646={};var _0x43d379;var _0x6b05c7;return db[_0x6c1c('0x35')][_0x6c1c('0x51')]({'where':{'id':_0x2d248c[_0x6c1c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x13963a,null))[_0x6c1c('0x17')](function(_0x39636a){if(_0x39636a){_0x43d379=_0x39636a;_0x4fa646['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x52')][_0x6c1c('0x21')]);_0x4fa646['query']=_[_0x6c1c('0x3b')](_0x2d248c[_0x6c1c('0x25')]);_0x4fa646[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x4fa646[_0x6c1c('0x24')],_0x4fa646[_0x6c1c('0x25')]);_0x26ee48['attributes']=_['intersection'](_0x4fa646[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x2d248c['query']['fields']));_0x26ee48['attributes']=_0x26ee48[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x26ee48[_0x6c1c('0x29')]:_0x4fa646[_0x6c1c('0x24')];_0x26ee48['order']=qs[_0x6c1c('0x2e')](_0x2d248c['query']['sort']);_0x26ee48['where']=qs[_0x6c1c('0x26')](_[_0x6c1c('0x48')](_0x2d248c[_0x6c1c('0x25')],_0x4fa646[_0x6c1c('0x26')]));if(_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]){_0x26ee48['where']=_[_0x6c1c('0x33')](_0x26ee48[_0x6c1c('0x2f')],{'$or':_[_0x6c1c('0x20')](_0x26ee48['attributes'],function(_0x585a42){var _0x4ea97d={};_0x4ea97d[_0x585a42]={'$like':'%'+_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4ea97d;})});}_0x26ee48=_['merge']({},_0x26ee48,_0x2d248c[_0x6c1c('0x34')]);return _0x43d379['getUsers'](_0x26ee48);}})[_0x6c1c('0x17')](function(_0x1fc46f){if(_0x1fc46f){_0x6b05c7=_0x1fc46f[_0x6c1c('0x2a')];if(!_0x2d248c[_0x6c1c('0x25')]['hasOwnProperty'](_0x6c1c('0x2c'))){_0x26ee48[_0x6c1c('0xe')]=qs['limit'](_0x2d248c['query'][_0x6c1c('0xe')]);_0x26ee48[_0x6c1c('0xd')]=qs[_0x6c1c('0xd')](_0x2d248c['query'][_0x6c1c('0xd')]);}return _0x43d379[_0x6c1c('0x50')](_0x26ee48);}})['then'](function(_0x4a730a){if(_0x4a730a){return _0x4a730a?{'count':_0x6b05c7,'rows':_0x4a730a}:null;}})['then'](respondWithResult(_0x13963a,null))['catch'](handleError(_0x13963a,null));}; \ No newline at end of file +var _0xafc4=['VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','undefined','limit','count','offset','json','update','then','destroy','get','UserProfileResource','publish','agi','stringify','error','stack','name','send','index','SquareProject','rawAttributes','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type'];(function(_0x43635e,_0x12619b){var _0x1b972f=function(_0x1f0618){while(--_0x1f0618){_0x43635e['push'](_0x43635e['shift']());}};_0x1b972f(++_0x12619b);}(_0xafc4,0x69));var _0x4afc=function(_0x40575b,_0x8cf588){_0x40575b=_0x40575b-0x0;var _0x2fd04f=_0xafc4[_0x40575b];return _0x2fd04f;};'use strict';var _=require(_0x4afc('0x0'));var Redis=require('ioredis');var qs=require(_0x4afc('0x1'));var logger=require('../../config/logger')(_0x4afc('0x2'));var config=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];config[_0x4afc('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0x6'))(new Redis(config[_0x4afc('0x5')]));require(_0x4afc('0x7'))[_0x4afc('0x8')](socket);function respondWithStatusCode(_0xc828d9,_0xaf053d){_0xaf053d=_0xaf053d||0xcc;return function(_0x5e1e29){if(_0x5e1e29){return _0xc828d9[_0x4afc('0x9')](_0xaf053d);}return _0xc828d9[_0x4afc('0xa')](_0xaf053d)[_0x4afc('0xb')]();};}function respondWithResult(_0x1e6bf5,_0x1b8981){_0x1b8981=_0x1b8981||0xc8;return function(_0x458fde){if(_0x458fde){return _0x1e6bf5['status'](_0x1b8981)['json'](_0x458fde);}};}function respondWithFilteredResult(_0x7f127f,_0x49222e){return function(_0x281230){if(_0x281230){var _0x225793=typeof _0x49222e['offset']===_0x4afc('0xc')&&typeof _0x49222e[_0x4afc('0xd')]===_0x4afc('0xc');var _0x2768bf=_0x281230[_0x4afc('0xe')];var _0x2f1c59=_0x225793?0x0:_0x49222e[_0x4afc('0xf')];var _0x23b03e=_0x225793?_0x281230['count']:_0x49222e[_0x4afc('0xf')]+_0x49222e[_0x4afc('0xd')];var _0x2c636b;if(_0x23b03e>=_0x2768bf){_0x23b03e=_0x2768bf;_0x2c636b=0xc8;}else{_0x2c636b=0xce;}_0x7f127f[_0x4afc('0xa')](_0x2c636b);return _0x7f127f['set']('Content-Range',_0x2f1c59+'-'+_0x23b03e+'/'+_0x2768bf)[_0x4afc('0x10')](_0x281230);}return null;};}function saveUpdates(_0x4f3127){return function(_0x23ae30){if(_0x23ae30){return _0x23ae30[_0x4afc('0x11')](_0x4f3127)[_0x4afc('0x12')](function(_0x31eec4){return _0x31eec4;});}return null;};}function removeEntity(_0x3a306f){return function(_0x3ebdc8){if(_0x3ebdc8){return _0x3ebdc8[_0x4afc('0x13')]()[_0x4afc('0x12')](function(){var _0x16365f=_0x3ebdc8[_0x4afc('0x14')]({'plain':!![]});var _0x178229='SquareProjects';return db[_0x4afc('0x15')][_0x4afc('0x13')]({'where':{'type':_0x178229,'resourceId':_0x16365f['id']}})[_0x4afc('0x12')](function(){return _0x3ebdc8;});})[_0x4afc('0x12')](function(){var _0x557a7e=new Redis(config[_0x4afc('0x5')]);_0x557a7e[_0x4afc('0x16')](_0x4afc('0x17'),JSON[_0x4afc('0x18')]({'id':_0x3ebdc8['id'],'deleted':!![]}));})[_0x4afc('0x12')](function(){_0x3a306f[_0x4afc('0xa')](0xcc)[_0x4afc('0xb')]();});}};}function handleEntityNotFound(_0x573a75){return function(_0x5403e4){if(!_0x5403e4){_0x573a75[_0x4afc('0x9')](0x194);}return _0x5403e4;};}function handleError(_0x57f37c,_0x37debf){_0x37debf=_0x37debf||0x1f4;return function(_0x4e9a48){logger[_0x4afc('0x19')](_0x4e9a48[_0x4afc('0x1a')]);if(_0x4e9a48[_0x4afc('0x1b')]){delete _0x4e9a48[_0x4afc('0x1b')];}_0x57f37c[_0x4afc('0xa')](_0x37debf)[_0x4afc('0x1c')](_0x4e9a48);};}exports[_0x4afc('0x1d')]=function(_0x383a71,_0x2bb837){var _0x100220={},_0x4e8273={},_0x359c07={'count':0x0,'rows':[]};var _0x35f5b3=_['map'](db[_0x4afc('0x1e')][_0x4afc('0x1f')],function(_0x2d6112){return{'name':_0x2d6112['fieldName'],'type':_0x2d6112['type']['key']};});_0x4e8273[_0x4afc('0x20')]=_[_0x4afc('0x21')](_0x35f5b3,'name');_0x4e8273[_0x4afc('0x22')]=_[_0x4afc('0x23')](_0x383a71['query']);_0x4e8273['filters']=_['intersection'](_0x4e8273[_0x4afc('0x20')],_0x4e8273[_0x4afc('0x22')]);_0x100220[_0x4afc('0x24')]=_[_0x4afc('0x25')](_0x4e8273[_0x4afc('0x20')],qs[_0x4afc('0x26')](_0x383a71['query'][_0x4afc('0x26')]));_0x100220[_0x4afc('0x24')]=_0x100220[_0x4afc('0x24')][_0x4afc('0x27')]?_0x100220[_0x4afc('0x24')]:_0x4e8273[_0x4afc('0x20')];if(!_0x383a71[_0x4afc('0x22')][_0x4afc('0x28')]('nolimit')){_0x100220[_0x4afc('0xd')]=qs['limit'](_0x383a71['query'][_0x4afc('0xd')]);_0x100220[_0x4afc('0xf')]=qs[_0x4afc('0xf')](_0x383a71[_0x4afc('0x22')][_0x4afc('0xf')]);}_0x100220[_0x4afc('0x29')]=qs['sort'](_0x383a71[_0x4afc('0x22')][_0x4afc('0x2a')]);_0x100220[_0x4afc('0x2b')]=qs[_0x4afc('0x2c')](_[_0x4afc('0x2d')](_0x383a71[_0x4afc('0x22')],_0x4e8273['filters']),_0x35f5b3);if(_0x383a71[_0x4afc('0x22')][_0x4afc('0x2e')]){_0x100220[_0x4afc('0x2b')]=_[_0x4afc('0x2f')](_0x100220['where'],{'$or':_['map'](_0x35f5b3,function(_0x43c341){if(_0x43c341[_0x4afc('0x30')]!==_0x4afc('0x31')){var _0x5edfe1={};_0x5edfe1[_0x43c341['name']]={'$like':'%'+_0x383a71[_0x4afc('0x22')]['filter']+'%'};return _0x5edfe1;}})});}_0x100220=_['merge']({},_0x100220,_0x383a71[_0x4afc('0x32')]);var _0x1dc853={'where':_0x100220[_0x4afc('0x2b')]};return db[_0x4afc('0x1e')][_0x4afc('0xe')](_0x1dc853)[_0x4afc('0x12')](function(_0x453e12){_0x359c07[_0x4afc('0xe')]=_0x453e12;if(_0x383a71[_0x4afc('0x22')][_0x4afc('0x33')]){_0x100220[_0x4afc('0x34')]=[{'all':!![]}];}return db[_0x4afc('0x1e')][_0x4afc('0x35')](_0x100220);})[_0x4afc('0x12')](function(_0x46dd2a){_0x359c07['rows']=_0x46dd2a;return _0x359c07;})[_0x4afc('0x12')](respondWithFilteredResult(_0x2bb837,_0x100220))[_0x4afc('0x36')](handleError(_0x2bb837,null));};exports[_0x4afc('0x37')]=function(_0xe6db12,_0x12db1d){var _0x260b06={'raw':![],'where':{'id':_0xe6db12['params']['id']}},_0x3e87f0={};_0x3e87f0['model']=_['keys'](db[_0x4afc('0x1e')][_0x4afc('0x1f')]);_0x3e87f0['query']=_[_0x4afc('0x23')](_0xe6db12[_0x4afc('0x22')]);_0x3e87f0[_0x4afc('0x2c')]=_[_0x4afc('0x25')](_0x3e87f0['model'],_0x3e87f0[_0x4afc('0x22')]);_0x260b06[_0x4afc('0x24')]=_[_0x4afc('0x25')](_0x3e87f0[_0x4afc('0x20')],qs[_0x4afc('0x26')](_0xe6db12[_0x4afc('0x22')]['fields']));_0x260b06[_0x4afc('0x24')]=_0x260b06['attributes'][_0x4afc('0x27')]?_0x260b06[_0x4afc('0x24')]:_0x3e87f0[_0x4afc('0x20')];if(_0xe6db12['query']['includeAll']){_0x260b06[_0x4afc('0x34')]=[{'all':!![]}];}_0x260b06=_[_0x4afc('0x2f')]({},_0x260b06,_0xe6db12[_0x4afc('0x32')]);return db[_0x4afc('0x1e')][_0x4afc('0x38')](_0x260b06)[_0x4afc('0x12')](handleEntityNotFound(_0x12db1d,null))[_0x4afc('0x12')](respondWithResult(_0x12db1d,null))[_0x4afc('0x36')](handleError(_0x12db1d,null));};exports['create']=function(_0x658c5b,_0xb1e91e){return db['SquareProject'][_0x4afc('0x39')](_0x658c5b['body'],{})[_0x4afc('0x12')](function(_0x24a731){var _0x16c6c4=_0x658c5b['user'][_0x4afc('0x14')]({'plain':!![]});if(!_0x16c6c4)throw new Error(_0x4afc('0x3a'));if(_0x16c6c4[_0x4afc('0x3b')]===_0x4afc('0x3c')){var _0x4772db=_0x24a731[_0x4afc('0x14')]({'plain':!![]});var _0x5d9d90='SquareProjects';return db['UserProfileSection'][_0x4afc('0x38')]({'where':{'name':_0x5d9d90,'userProfileId':_0x16c6c4[_0x4afc('0x3d')]},'raw':!![]})[_0x4afc('0x12')](function(_0x269c24){if(_0x269c24&&_0x269c24[_0x4afc('0x3e')]===0x0){return db[_0x4afc('0x15')][_0x4afc('0x39')]({'name':_0x4772db[_0x4afc('0x1b')],'resourceId':_0x4772db['id'],'type':_0x269c24[_0x4afc('0x1b')],'sectionId':_0x269c24['id']},{})[_0x4afc('0x12')](function(){return _0x24a731;});}else{return _0x24a731;}})['catch'](function(_0x40bb3b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40bb3b);throw _0x40bb3b;});}return _0x24a731;})[_0x4afc('0x12')](respondWithResult(_0xb1e91e,0xc9))['catch'](handleError(_0xb1e91e,null));};exports[_0x4afc('0x11')]=function(_0x355198,_0x2fe2ae){if(_0x355198[_0x4afc('0x3f')]['id']){delete _0x355198['body']['id'];}return db[_0x4afc('0x1e')]['find']({'where':{'id':_0x355198[_0x4afc('0x40')]['id']}})[_0x4afc('0x12')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x12')](saveUpdates(_0x355198[_0x4afc('0x3f')],null))[_0x4afc('0x12')](function(_0xd46c35){if(!_0xd46c35)return;var _0x3d965d=_0xd46c35[_0x4afc('0x14')]({'plain':!![]});return _0x3d965d;})[_0x4afc('0x12')](function(_0x824900){var _0x322eb8=new Redis(config[_0x4afc('0x5')]);_0x322eb8['publish'](_0x4afc('0x17'),JSON[_0x4afc('0x18')](_[_0x4afc('0x2d')](_0x824900,['id',_0x4afc('0x1b'),_0x4afc('0x41')])));return _0x824900;})[_0x4afc('0x12')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x36')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x13')]=function(_0x369f01,_0x3df333){return db[_0x4afc('0x1e')][_0x4afc('0x38')]({'where':{'id':_0x369f01[_0x4afc('0x40')]['id']}})['then'](handleEntityNotFound(_0x3df333,null))[_0x4afc('0x12')](removeEntity(_0x3df333,null))['catch'](handleError(_0x3df333,null));};exports[_0x4afc('0x42')]=function(_0x2abc1b,_0x427122){return db[_0x4afc('0x1e')]['find']({'where':{'id':_0x2abc1b['params']['id']}})[_0x4afc('0x12')](handleEntityNotFound(_0x427122,null))[_0x4afc('0x12')](function(_0x5f16cb){if(_0x5f16cb){return _0x5f16cb[_0x4afc('0x42')](_0x2abc1b[_0x4afc('0x3f')][_0x4afc('0x43')],_[_0x4afc('0x44')](_0x2abc1b[_0x4afc('0x3f')],[_0x4afc('0x43'),'id'])||{});}})[_0x4afc('0x12')](respondWithResult(_0x427122,null))[_0x4afc('0x36')](handleError(_0x427122,null));};exports[_0x4afc('0x45')]=function(_0x3369a8,_0x4295a5){return db[_0x4afc('0x1e')][_0x4afc('0x38')]({'where':{'id':_0x3369a8[_0x4afc('0x40')]['id']}})['then'](handleEntityNotFound(_0x4295a5,null))[_0x4afc('0x12')](function(_0x59fb43){if(_0x59fb43){return _0x59fb43[_0x4afc('0x45')](_0x3369a8[_0x4afc('0x22')][_0x4afc('0x43')])[_0x4afc('0x12')](function(){if(_[_0x4afc('0x46')](_0x3369a8['query'][_0x4afc('0x43')])){for(var _0x323c65=0x0;_0x323c65<_0x3369a8['query']['ids'][_0x4afc('0x27')];_0x323c65+=0x1){socket[_0x4afc('0x47')](_0x4afc('0x48'),{'UserId':Number(_0x3369a8[_0x4afc('0x22')][_0x4afc('0x43')][_0x323c65]),'SquareProjectId':Number(_0x3369a8[_0x4afc('0x40')]['id'])});}}else{socket[_0x4afc('0x47')](_0x4afc('0x48'),{'UserId':Number(_0x3369a8[_0x4afc('0x22')][_0x4afc('0x43')]),'SquareProjectId':Number(_0x3369a8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4295a5,null))[_0x4afc('0x36')](handleError(_0x4295a5,null));};exports[_0x4afc('0x49')]=function(_0x5884f2,_0x38971b){var _0x25e470={};var _0x5be1a7={};var _0x56573a;var _0x1b49cd;return db[_0x4afc('0x1e')][_0x4afc('0x4a')]({'where':{'id':_0x5884f2['params']['id']}})[_0x4afc('0x12')](handleEntityNotFound(_0x38971b,null))['then'](function(_0x5a2be2){if(_0x5a2be2){_0x56573a=_0x5a2be2;_0x5be1a7[_0x4afc('0x20')]=_[_0x4afc('0x23')](db[_0x4afc('0x4b')][_0x4afc('0x1f')]);_0x5be1a7[_0x4afc('0x22')]=_[_0x4afc('0x23')](_0x5884f2[_0x4afc('0x22')]);_0x5be1a7[_0x4afc('0x2c')]=_[_0x4afc('0x25')](_0x5be1a7['model'],_0x5be1a7[_0x4afc('0x22')]);_0x25e470[_0x4afc('0x24')]=_[_0x4afc('0x25')](_0x5be1a7['model'],qs['fields'](_0x5884f2['query'][_0x4afc('0x26')]));_0x25e470[_0x4afc('0x24')]=_0x25e470[_0x4afc('0x24')]['length']?_0x25e470[_0x4afc('0x24')]:_0x5be1a7['model'];_0x25e470['order']=qs['sort'](_0x5884f2[_0x4afc('0x22')][_0x4afc('0x2a')]);_0x25e470[_0x4afc('0x2b')]=qs['filters'](_[_0x4afc('0x2d')](_0x5884f2[_0x4afc('0x22')],_0x5be1a7[_0x4afc('0x2c')]));if(_0x5884f2['query'][_0x4afc('0x2e')]){_0x25e470[_0x4afc('0x2b')]=_[_0x4afc('0x2f')](_0x25e470[_0x4afc('0x2b')],{'$or':_[_0x4afc('0x21')](_0x25e470['attributes'],function(_0x549e31){var _0x367224={};_0x367224[_0x549e31]={'$like':'%'+_0x5884f2[_0x4afc('0x22')][_0x4afc('0x2e')]+'%'};return _0x367224;})});}_0x25e470=_['merge']({},_0x25e470,_0x5884f2[_0x4afc('0x32')]);return _0x56573a[_0x4afc('0x49')](_0x25e470);}})[_0x4afc('0x12')](function(_0x306a45){if(_0x306a45){_0x1b49cd=_0x306a45[_0x4afc('0x27')];if(!_0x5884f2['query'][_0x4afc('0x28')](_0x4afc('0x4c'))){_0x25e470['limit']=qs[_0x4afc('0xd')](_0x5884f2[_0x4afc('0x22')][_0x4afc('0xd')]);_0x25e470['offset']=qs[_0x4afc('0xf')](_0x5884f2[_0x4afc('0x22')][_0x4afc('0xf')]);}return _0x56573a[_0x4afc('0x49')](_0x25e470);}})[_0x4afc('0x12')](function(_0x3c0339){if(_0x3c0339){return _0x3c0339?{'count':_0x1b49cd,'rows':_0x3c0339}:null;}})[_0x4afc('0x12')](respondWithResult(_0x38971b,null))[_0x4afc('0x36')](handleError(_0x38971b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 169861d..49c0bdb 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 _0x3eca=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x3eca,0xc9));var _0xa3ec=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x3eca[_0x845505];return _0x2513b9;};'use strict';var EventEmitter=require(_0xa3ec('0x0'));var SquareProject=require(_0xa3ec('0x1'))['db'][_0xa3ec('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa3ec('0x3')](0x0);var events={'afterCreate':_0xa3ec('0x4'),'afterUpdate':_0xa3ec('0x5'),'afterDestroy':_0xa3ec('0x6')};function emitEvent(_0x41b0c4){return function(_0x5b9de2,_0x41d480,_0x5d0839){SquareProjectEvents[_0xa3ec('0x7')](_0x41b0c4+':'+_0x5b9de2['id'],_0x5b9de2);SquareProjectEvents['emit'](_0x41b0c4,_0x5b9de2);_0x5d0839(null);};}for(var e in events){if(events[_0xa3ec('0x8')](e)){var event=events[e];SquareProject[_0xa3ec('0x9')](e,emitEvent(event));}}module[_0xa3ec('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xfab9=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x1bff99,_0x374547){var _0xd1ac27=function(_0x5d996d){while(--_0x5d996d){_0x1bff99['push'](_0x1bff99['shift']());}};_0xd1ac27(++_0x374547);}(_0xfab9,0x185));var _0x9fab=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfab9[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x9fab('0x0'));var SquareProject=require(_0x9fab('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9fab('0x2'),'afterUpdate':_0x9fab('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10384c){return function(_0x457f71,_0x3623c5,_0x40d5e7){SquareProjectEvents[_0x9fab('0x4')](_0x10384c+':'+_0x457f71['id'],_0x457f71);SquareProjectEvents['emit'](_0x10384c,_0x457f71);_0x40d5e7(null);};}for(var e in events){if(events[_0x9fab('0x5')](e)){var event=events[e];SquareProject[_0x9fab('0x6')](e,emitEvent(event));}}module[_0x9fab('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 768659d..6663130 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 _0x61df=['path','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','api','moment','request-promise'];(function(_0x137d56,_0x42c324){var _0xeb8b5=function(_0x3db051){while(--_0x3db051){_0x137d56['push'](_0x137d56['shift']());}};_0xeb8b5(++_0x42c324);}(_0x61df,0xbd));var _0xf61d=function(_0x45b1a6,_0x8b881d){_0x45b1a6=_0x45b1a6-0x0;var _0x5f530b=_0x61df[_0x45b1a6];return _0x5f530b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf61d('0x0'));var moment=require(_0xf61d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf61d('0x2'));var fs=require('fs');var path=require(_0xf61d('0x3'));var rimraf=require('rimraf');var config=require(_0xf61d('0x4'));var attributes=require(_0xf61d('0x5'));module[_0xf61d('0x6')]=function(_0x458eb9,_0x2d0791){return _0x458eb9[_0xf61d('0x7')]('SquareProject',attributes,{'tableName':_0xf61d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49523e,_0x32ad93,_0x2a07c5){if(_0x49523e[_0xf61d('0x9')](_0xf61d('0xa'))){_0x49523e[_0xf61d('0xb')]=moment()[_0xf61d('0xc')](_0xf61d('0xd'));}if(_0x49523e[_0xf61d('0x9')](_0xf61d('0xe'))){_0x49523e[_0xf61d('0xf')]=moment()[_0xf61d('0xc')](_0xf61d('0xd'));}_0x2a07c5(null,_0x49523e);}}});}; \ No newline at end of file +var _0xe007=['api','moment','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger'];(function(_0x4d3e21,_0x56be03){var _0x214312=function(_0x3758f9){while(--_0x3758f9){_0x4d3e21['push'](_0x4d3e21['shift']());}};_0x214312(++_0x56be03);}(_0xe007,0xa8));var _0x7e00=function(_0xf1eeeb,_0x5c0de4){_0xf1eeeb=_0xf1eeeb-0x0;var _0xe010d8=_0xe007[_0xf1eeeb];return _0xe010d8;};'use strict';var _=require('lodash');var util=require(_0x7e00('0x0'));var logger=require(_0x7e00('0x1'))(_0x7e00('0x2'));var moment=require(_0x7e00('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e00('0x4'));var config=require('../../config/environment');var attributes=require(_0x7e00('0x5'));module[_0x7e00('0x6')]=function(_0x29eb62,_0x12b189){return _0x29eb62[_0x7e00('0x7')](_0x7e00('0x8'),attributes,{'tableName':_0x7e00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x328948,_0x2853e2,_0x2c2dba){if(_0x328948[_0x7e00('0xa')](_0x7e00('0xb'))){_0x328948[_0x7e00('0xc')]=moment()[_0x7e00('0xd')](_0x7e00('0xe'));}if(_0x328948[_0x7e00('0xa')](_0x7e00('0xf'))){_0x328948[_0x7e00('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2c2dba(null,_0x328948);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 35a2a13..3e35b27 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 _0x2c4c=['include','map','model','info','GetSquareProjects','debug','stringify','catch','message','error','ShowSquareProject','find','then','lodash','../../mysqldb','rpc','redis','defaults','localhost','./squareProject.socket','register','findAll','options','raw','where','attributes','limit'];(function(_0x549444,_0x41c180){var _0x2348d2=function(_0x12e035){while(--_0x12e035){_0x549444['push'](_0x549444['shift']());}};_0x2348d2(++_0x41c180);}(_0x2c4c,0x94));var _0xc2c4=function(_0x3862e6,_0x168099){_0x3862e6=_0x3862e6-0x0;var _0x50b550=_0x2c4c[_0x3862e6];return _0x50b550;};'use strict';var _=require(_0xc2c4('0x0'));var Redis=require('ioredis');var db=require(_0xc2c4('0x1'))['db'];var logger=require('../../config/logger')(_0xc2c4('0x2'));var config=require('../../config/environment');config[_0xc2c4('0x3')]=_[_0xc2c4('0x4')](config[_0xc2c4('0x3')],{'host':_0xc2c4('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc2c4('0x6'))[_0xc2c4('0x7')](socket);exports['GetSquareProjects']=function(_0x2b079c){var _0x1e182e=this;return new Promise(function(_0x58921f,_0x2eb631){return db['SquareProject'][_0xc2c4('0x8')]({'raw':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c[_0xc2c4('0x9')][_0xc2c4('0xa')]===undefined?!![]:![]:!![],'where':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c[_0xc2c4('0x9')][_0xc2c4('0xb')]||null:null,'attributes':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c['options'][_0xc2c4('0xc')]||null:null,'limit':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c[_0xc2c4('0x9')][_0xc2c4('0xd')]||null:null,'include':_0x2b079c[_0xc2c4('0x9')]?_0x2b079c['options'][_0xc2c4('0xe')]?_[_0xc2c4('0xf')](_0x2b079c[_0xc2c4('0x9')]['include'],function(_0x13a698){return{'model':db[_0x13a698[_0xc2c4('0x10')]],'as':_0x13a698['as'],'attributes':_0x13a698[_0xc2c4('0xc')],'include':_0x13a698[_0xc2c4('0xe')]?_['map'](_0x13a698[_0xc2c4('0xe')],function(_0x16e84d){return{'model':db[_0x16e84d['model']],'as':_0x16e84d['as'],'attributes':_0x16e84d[_0xc2c4('0xc')],'include':_0x16e84d[_0xc2c4('0xe')]?_[_0xc2c4('0xf')](_0x16e84d['include'],function(_0x17b764){return{'model':db[_0x17b764['model']],'as':_0x17b764['as'],'attributes':_0x17b764[_0xc2c4('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x334f07){logger[_0xc2c4('0x11')](_0xc2c4('0x12'),_0x2b079c);logger[_0xc2c4('0x13')](_0xc2c4('0x12'),_0x2b079c,JSON[_0xc2c4('0x14')](_0x334f07));_0x58921f(_0x334f07);})[_0xc2c4('0x15')](function(_0x4fabc0){logger['error']('GetSquareProjects',_0x4fabc0[_0xc2c4('0x16')],_0x2b079c);_0x2eb631(_0x1e182e[_0xc2c4('0x17')](0x1f4,_0x4fabc0[_0xc2c4('0x16')]));});});};exports[_0xc2c4('0x18')]=function(_0x4f2b30){var _0x1983ae=this;return new Promise(function(_0x2ec520,_0x194a07){return db['SquareProject'][_0xc2c4('0x19')]({'raw':_0x4f2b30[_0xc2c4('0x9')]?_0x4f2b30[_0xc2c4('0x9')][_0xc2c4('0xa')]===undefined?!![]:![]:!![],'where':_0x4f2b30[_0xc2c4('0x9')]?_0x4f2b30[_0xc2c4('0x9')]['where']||null:null,'attributes':_0x4f2b30['options']?_0x4f2b30[_0xc2c4('0x9')][_0xc2c4('0xc')]||null:null,'include':_0x4f2b30[_0xc2c4('0x9')]?_0x4f2b30['options'][_0xc2c4('0xe')]?_['map'](_0x4f2b30[_0xc2c4('0x9')][_0xc2c4('0xe')],function(_0x20ef88){return{'model':db[_0x20ef88[_0xc2c4('0x10')]],'as':_0x20ef88['as'],'attributes':_0x20ef88[_0xc2c4('0xc')],'include':_0x20ef88['include']?_[_0xc2c4('0xf')](_0x20ef88[_0xc2c4('0xe')],function(_0x9b0f53){return{'model':db[_0x9b0f53[_0xc2c4('0x10')]],'as':_0x9b0f53['as'],'attributes':_0x9b0f53[_0xc2c4('0xc')],'include':_0x9b0f53[_0xc2c4('0xe')]?_['map'](_0x9b0f53[_0xc2c4('0xe')],function(_0x29bbc3){return{'model':db[_0x29bbc3['model']],'as':_0x29bbc3['as'],'attributes':_0x29bbc3[_0xc2c4('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc2c4('0x1a')](function(_0x3ef715){logger['info']('ShowSquareProject',_0x4f2b30);logger[_0xc2c4('0x13')](_0xc2c4('0x18'),_0x4f2b30,JSON['stringify'](_0x3ef715));_0x2ec520(_0x3ef715);})[_0xc2c4('0x15')](function(_0x4734d2){logger[_0xc2c4('0x17')]('ShowSquareProject',_0x4734d2[_0xc2c4('0x16')],_0x4f2b30);_0x194a07(_0x1983ae[_0xc2c4('0x17')](0x1f4,_0x4734d2[_0xc2c4('0x16')]));});});}; \ No newline at end of file +var _0x3178=['defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis'];(function(_0x56d1ed,_0x237e84){var _0x1b282b=function(_0x56648c){while(--_0x56648c){_0x56d1ed['push'](_0x56d1ed['shift']());}};_0x1b282b(++_0x237e84);}(_0x3178,0xbe));var _0x8317=function(_0x527930,_0x34c538){_0x527930=_0x527930-0x0;var _0x4e643c=_0x3178[_0x527930];return _0x4e643c;};'use strict';var _=require(_0x8317('0x0'));var Redis=require('ioredis');var db=require(_0x8317('0x1'))['db'];var logger=require(_0x8317('0x2'))(_0x8317('0x3'));var config=require(_0x8317('0x4'));config[_0x8317('0x5')]=_[_0x8317('0x6')](config[_0x8317('0x5')],{'host':_0x8317('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8317('0x8'))[_0x8317('0x9')](socket);exports[_0x8317('0xa')]=function(_0x4a9a1b){var _0x5440e5=this;return new Promise(function(_0x2117f8,_0x37da29){return db[_0x8317('0xb')][_0x8317('0xc')]({'raw':_0x4a9a1b[_0x8317('0xd')]?_0x4a9a1b[_0x8317('0xd')][_0x8317('0xe')]===undefined?!![]:![]:!![],'where':_0x4a9a1b[_0x8317('0xd')]?_0x4a9a1b[_0x8317('0xd')][_0x8317('0xf')]||null:null,'attributes':_0x4a9a1b[_0x8317('0xd')]?_0x4a9a1b[_0x8317('0xd')][_0x8317('0x10')]||null:null,'limit':_0x4a9a1b[_0x8317('0xd')]?_0x4a9a1b[_0x8317('0xd')]['limit']||null:null,'include':_0x4a9a1b[_0x8317('0xd')]?_0x4a9a1b[_0x8317('0xd')][_0x8317('0x11')]?_[_0x8317('0x12')](_0x4a9a1b[_0x8317('0xd')][_0x8317('0x11')],function(_0x2622b5){return{'model':db[_0x2622b5[_0x8317('0x13')]],'as':_0x2622b5['as'],'attributes':_0x2622b5[_0x8317('0x10')],'include':_0x2622b5['include']?_[_0x8317('0x12')](_0x2622b5[_0x8317('0x11')],function(_0x3e4881){return{'model':db[_0x3e4881[_0x8317('0x13')]],'as':_0x3e4881['as'],'attributes':_0x3e4881[_0x8317('0x10')],'include':_0x3e4881[_0x8317('0x11')]?_[_0x8317('0x12')](_0x3e4881[_0x8317('0x11')],function(_0x2a7ade){return{'model':db[_0x2a7ade['model']],'as':_0x2a7ade['as'],'attributes':_0x2a7ade[_0x8317('0x10')]};}):[]};}):[]};}):[]:[]})[_0x8317('0x14')](function(_0x565b91){logger[_0x8317('0x15')](_0x8317('0xa'),_0x4a9a1b);logger[_0x8317('0x16')]('GetSquareProjects',_0x4a9a1b,JSON[_0x8317('0x17')](_0x565b91));_0x2117f8(_0x565b91);})[_0x8317('0x18')](function(_0xef1b76){logger[_0x8317('0x19')]('GetSquareProjects',_0xef1b76[_0x8317('0x1a')],_0x4a9a1b);_0x37da29(_0x5440e5[_0x8317('0x19')](0x1f4,_0xef1b76[_0x8317('0x1a')]));});});};exports['ShowSquareProject']=function(_0x5037af){var _0xffe53b=this;return new Promise(function(_0x35c1b7,_0x18866d){return db['SquareProject']['find']({'raw':_0x5037af[_0x8317('0xd')]?_0x5037af[_0x8317('0xd')][_0x8317('0xe')]===undefined?!![]:![]:!![],'where':_0x5037af['options']?_0x5037af['options'][_0x8317('0xf')]||null:null,'attributes':_0x5037af[_0x8317('0xd')]?_0x5037af['options'][_0x8317('0x10')]||null:null,'include':_0x5037af['options']?_0x5037af[_0x8317('0xd')]['include']?_[_0x8317('0x12')](_0x5037af[_0x8317('0xd')][_0x8317('0x11')],function(_0xeb26ee){return{'model':db[_0xeb26ee[_0x8317('0x13')]],'as':_0xeb26ee['as'],'attributes':_0xeb26ee['attributes'],'include':_0xeb26ee['include']?_[_0x8317('0x12')](_0xeb26ee['include'],function(_0x5c9517){return{'model':db[_0x5c9517[_0x8317('0x13')]],'as':_0x5c9517['as'],'attributes':_0x5c9517['attributes'],'include':_0x5c9517[_0x8317('0x11')]?_[_0x8317('0x12')](_0x5c9517[_0x8317('0x11')],function(_0x343b4d){return{'model':db[_0x343b4d[_0x8317('0x13')]],'as':_0x343b4d['as'],'attributes':_0x343b4d[_0x8317('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3acf2d){logger['info'](_0x8317('0x1b'),_0x5037af);logger[_0x8317('0x16')]('ShowSquareProject',_0x5037af,JSON[_0x8317('0x17')](_0x3acf2d));_0x35c1b7(_0x3acf2d);})[_0x8317('0x18')](function(_0x1c2dfa){logger[_0x8317('0x19')]('ShowSquareProject',_0x1c2dfa['message'],_0x5037af);_0x18866d(_0xffe53b[_0x8317('0x19')](0x1f4,_0x1c2dfa[_0x8317('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2164a32..58b7a4e 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 _0x693a=['register','length','squareProject:','save','remove','update','emit','removeListener'];(function(_0x1b4892,_0x1d99c){var _0x254642=function(_0x51d2f9){while(--_0x51d2f9){_0x1b4892['push'](_0x1b4892['shift']());}};_0x254642(++_0x1d99c);}(_0x693a,0xbb));var _0xa693=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x693a[_0x5f6a8a];return _0x2cce4d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xa693('0x0'),_0xa693('0x1'),_0xa693('0x2')];function createListener(_0x5ba0dc,_0x45b1c0){return function(_0x5323fb){_0x45b1c0[_0xa693('0x3')](_0x5ba0dc,_0x5323fb);};}function removeListener(_0x34a2a9,_0x4bfc9e){return function(){SquareProjectEvents[_0xa693('0x4')](_0x34a2a9,_0x4bfc9e);};}exports[_0xa693('0x5')]=function(_0x213bbf){for(var _0x4f5aae=0x0,_0x3fab35=events[_0xa693('0x6')];_0x4f5aae<_0x3fab35;_0x4f5aae++){var _0x552b01=events[_0x4f5aae];var _0xb9a9f1=createListener(_0xa693('0x7')+_0x552b01,_0x213bbf);SquareProjectEvents['on'](_0x552b01,_0xb9a9f1);}}; \ No newline at end of file +var _0x997f=['save','remove','update','removeListener','register','squareProject:','./squareProject.events'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x997f,0xc3));var _0xf997=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x997f[_0x50007c];return _0x5c1ec7;};'use strict';var SquareProjectEvents=require(_0xf997('0x0'));var events=[_0xf997('0x1'),_0xf997('0x2'),_0xf997('0x3')];function createListener(_0x37b046,_0x106098){return function(_0x3a89eb){_0x106098['emit'](_0x37b046,_0x3a89eb);};}function removeListener(_0xe91766,_0x2848ca){return function(){SquareProjectEvents[_0xf997('0x4')](_0xe91766,_0x2848ca);};}exports[_0xf997('0x5')]=function(_0x19e2a2){for(var _0x2ab4a8=0x0,_0x56df7c=events['length'];_0x2ab4a8<_0x56df7c;_0x2ab4a8++){var _0x4a914e=events[_0x2ab4a8];var _0x322dc8=createListener(_0xf997('0x6')+_0x4a914e,_0x19e2a2);SquareProjectEvents['on'](_0x4a914e,_0x322dc8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 0913350..68e1f27 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x12c66d,_0x9fd894){var _0x48c456=function(_0x528b5d){while(--_0x528b5d){_0x12c66d['push'](_0x12c66d['shift']());}};_0x48c456(++_0x9fd894);}(_0xabce,0x103));var _0xeabc=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xabce[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x30c28,_0xb2caaa){var _0x4b4701=function(_0x2ec220){while(--_0x2ec220){_0x30c28['push'](_0x30c28['shift']());}};_0x4b4701(++_0xb2caaa);}(_0xf494,0x1c6));var _0x4f49=function(_0x4e5622,_0x4b41a0){_0x4e5622=_0x4e5622-0x0;var _0x1e9995=_0xf494[_0x4e5622];return _0x1e9995;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 597d188..d33d152 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 _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xf494,0x1c6));var _0x4f49=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0xf494[_0x37bab4];return _0x336d20;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file +var _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0xda19,0xd5));var _0x9da1=function(_0x5a8281,_0x3f6be7){_0x5a8281=_0x5a8281-0x0;var _0x49c418=_0xda19[_0x5a8281];return _0x49c418;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 889e05d..c20a703 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 _0xb7eb=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x13f1b8,_0x59f46e){var _0x1c5635=function(_0x4f09e2){while(--_0x4f09e2){_0x13f1b8['push'](_0x13f1b8['shift']());}};_0x1c5635(++_0x59f46e);}(_0xb7eb,0x130));var _0xbb7e=function(_0x5a1f24,_0x15df0d){_0x5a1f24=_0x5a1f24-0x0;var _0x47e330=_0xb7eb[_0x5a1f24];return _0x47e330;};'use strict';var emlformat=require(_0xbb7e('0x0'));var rimraf=require(_0xbb7e('0x1'));var zipdir=require(_0xbb7e('0x2'));var jsonpatch=require(_0xbb7e('0x3'));var rp=require(_0xbb7e('0x4'));var moment=require(_0xbb7e('0x5'));var BPromise=require(_0xbb7e('0x6'));var Mustache=require(_0xbb7e('0x7'));var util=require(_0xbb7e('0x8'));var path=require(_0xbb7e('0x9'));var sox=require(_0xbb7e('0xa'));var csv=require(_0xbb7e('0xb'));var ejs=require(_0xbb7e('0xc'));var fs=require('fs');var fs_extra=require(_0xbb7e('0xd'));var _=require(_0xbb7e('0xe'));var squel=require(_0xbb7e('0xf'));var crypto=require(_0xbb7e('0x10'));var jsforce=require(_0xbb7e('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb7e('0x12'));var Redis=require(_0xbb7e('0x13'));var authService=require(_0xbb7e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbb7e('0x15'));var hardwareService=require(_0xbb7e('0x16'));var logger=require('../../config/logger')(_0xbb7e('0x17'));var utils=require(_0xbb7e('0x18'));var config=require(_0xbb7e('0x19'));var licenseUtil=require(_0xbb7e('0x1a'));var db=require(_0xbb7e('0x1b'))['db'];function respondWithStatusCode(_0x98b2a5,_0x3ec80e){_0x3ec80e=_0x3ec80e||0xcc;return function(_0xf811e6){if(_0xf811e6){return _0x98b2a5['sendStatus'](_0x3ec80e);}return _0x98b2a5[_0xbb7e('0x1c')](_0x3ec80e)[_0xbb7e('0x1d')]();};}function respondWithResult(_0x26ee1d,_0x2c2566){_0x2c2566=_0x2c2566||0xc8;return function(_0x3f7d4f){if(_0x3f7d4f){return _0x26ee1d['status'](_0x2c2566)['json'](_0x3f7d4f);}};}function respondWithFilteredResult(_0x1f90bc,_0x27ca0c){return function(_0x4ab5d4){if(_0x4ab5d4){var _0x43d9b4=typeof _0x27ca0c[_0xbb7e('0x1e')]==='undefined'&&typeof _0x27ca0c[_0xbb7e('0x1f')]===_0xbb7e('0x20');var _0x13ce20=_0x4ab5d4[_0xbb7e('0x21')];var _0xc03582=_0x43d9b4?0x0:_0x27ca0c[_0xbb7e('0x1e')];var _0x27d421=_0x43d9b4?_0x4ab5d4[_0xbb7e('0x21')]:_0x27ca0c[_0xbb7e('0x1e')]+_0x27ca0c[_0xbb7e('0x1f')];var _0xe164f9;if(_0x27d421>=_0x13ce20){_0x27d421=_0x13ce20;_0xe164f9=0xc8;}else{_0xe164f9=0xce;}_0x1f90bc['status'](_0xe164f9);return _0x1f90bc[_0xbb7e('0x22')](_0xbb7e('0x23'),_0xc03582+'-'+_0x27d421+'/'+_0x13ce20)[_0xbb7e('0x24')](_0x4ab5d4);}return null;};}function patchUpdates(_0x2e9fc5){return function(_0x4cf19e){try{jsonpatch['apply'](_0x4cf19e,_0x2e9fc5,!![]);}catch(_0xd471f6){return BPromise['reject'](_0xd471f6);}return _0x4cf19e['save']();};}function saveUpdates(_0x2f1ce1,_0x30b81f){return function(_0x18c8bc){if(_0x18c8bc){return _0x18c8bc[_0xbb7e('0x25')](_0x2f1ce1)['then'](function(_0x565b7f){return _0x565b7f;});}return null;};}function removeEntity(_0xad5c47,_0x2dc634){return function(_0x4960cf){if(_0x4960cf){return _0x4960cf['destroy']()[_0xbb7e('0x26')](function(){_0xad5c47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5747bc,_0x351ed2){return function(_0x48d1a8){if(!_0x48d1a8){_0x5747bc[_0xbb7e('0x27')](0x194);}return _0x48d1a8;};}function handleError(_0x49b9d2,_0xf36f29){_0xf36f29=_0xf36f29||0x1f4;return function(_0x3f36eb){logger[_0xbb7e('0x28')](_0x3f36eb[_0xbb7e('0x29')]);if(_0x3f36eb[_0xbb7e('0x2a')]){delete _0x3f36eb[_0xbb7e('0x2a')];}_0x49b9d2[_0xbb7e('0x1c')](_0xf36f29)[_0xbb7e('0x2b')](_0x3f36eb);};}exports[_0xbb7e('0x2c')]=function(_0x6cdea5,_0x57a8c6){var _0x412ee2={},_0x159a0f={},_0x17655d={'count':0x0,'rows':[]};var _0x30343=_[_0xbb7e('0x2d')](db[_0xbb7e('0x2e')]['rawAttributes'],function(_0xff9c79){return{'name':_0xff9c79[_0xbb7e('0x2f')],'type':_0xff9c79['type'][_0xbb7e('0x30')]};});_0x159a0f[_0xbb7e('0x31')]=_['map'](_0x30343,'name');_0x159a0f['query']=_[_0xbb7e('0x32')](_0x6cdea5[_0xbb7e('0x33')]);_0x159a0f[_0xbb7e('0x34')]=_[_0xbb7e('0x35')](_0x159a0f[_0xbb7e('0x31')],_0x159a0f[_0xbb7e('0x33')]);_0x412ee2[_0xbb7e('0x36')]=_[_0xbb7e('0x35')](_0x159a0f[_0xbb7e('0x31')],qs[_0xbb7e('0x37')](_0x6cdea5[_0xbb7e('0x33')]['fields']));_0x412ee2['attributes']=_0x412ee2[_0xbb7e('0x36')][_0xbb7e('0x38')]?_0x412ee2['attributes']:_0x159a0f[_0xbb7e('0x31')];if(!_0x6cdea5['query'][_0xbb7e('0x39')]('nolimit')){_0x412ee2[_0xbb7e('0x1f')]=qs[_0xbb7e('0x1f')](_0x6cdea5['query'][_0xbb7e('0x1f')]);_0x412ee2[_0xbb7e('0x1e')]=qs[_0xbb7e('0x1e')](_0x6cdea5[_0xbb7e('0x33')][_0xbb7e('0x1e')]);}_0x412ee2['order']=qs[_0xbb7e('0x3a')](_0x6cdea5['query'][_0xbb7e('0x3a')]);_0x412ee2[_0xbb7e('0x3b')]=qs[_0xbb7e('0x34')](_['pick'](_0x6cdea5['query'],_0x159a0f[_0xbb7e('0x34')]),_0x30343);if(_0x6cdea5['query'][_0xbb7e('0x3c')]){_0x412ee2[_0xbb7e('0x3b')]=_[_0xbb7e('0x3d')](_0x412ee2[_0xbb7e('0x3b')],{'$or':_[_0xbb7e('0x2d')](_0x30343,function(_0xedfe63){if(_0xedfe63[_0xbb7e('0x3e')]!==_0xbb7e('0x3f')){var _0x216ede={};_0x216ede[_0xedfe63[_0xbb7e('0x2a')]]={'$like':'%'+_0x6cdea5[_0xbb7e('0x33')][_0xbb7e('0x3c')]+'%'};return _0x216ede;}})});}_0x412ee2=_['merge']({},_0x412ee2,_0x6cdea5[_0xbb7e('0x40')]);var _0x35dcaf={'where':_0x412ee2[_0xbb7e('0x3b')]};return db[_0xbb7e('0x2e')][_0xbb7e('0x21')](_0x35dcaf)[_0xbb7e('0x26')](function(_0x245761){_0x17655d[_0xbb7e('0x21')]=_0x245761;if(_0x6cdea5[_0xbb7e('0x33')][_0xbb7e('0x41')]){_0x412ee2[_0xbb7e('0x42')]=[{'all':!![]}];}return db[_0xbb7e('0x2e')][_0xbb7e('0x43')](_0x412ee2);})[_0xbb7e('0x26')](function(_0x33534a){_0x17655d[_0xbb7e('0x44')]=_0x33534a;return _0x17655d;})[_0xbb7e('0x26')](respondWithFilteredResult(_0x57a8c6,_0x412ee2))[_0xbb7e('0x45')](handleError(_0x57a8c6,null));};exports[_0xbb7e('0x46')]=function(_0x2c9815,_0x47f505){var _0x25c9c4={'raw':!![],'where':{'id':_0x2c9815['params']['id']}},_0x2f546f={};_0x2f546f['model']=_[_0xbb7e('0x32')](db['SquareRecording'][_0xbb7e('0x47')]);_0x2f546f[_0xbb7e('0x33')]=_[_0xbb7e('0x32')](_0x2c9815['query']);_0x2f546f['filters']=_[_0xbb7e('0x35')](_0x2f546f[_0xbb7e('0x31')],_0x2f546f[_0xbb7e('0x33')]);_0x25c9c4['attributes']=_['intersection'](_0x2f546f[_0xbb7e('0x31')],qs[_0xbb7e('0x37')](_0x2c9815[_0xbb7e('0x33')][_0xbb7e('0x37')]));_0x25c9c4[_0xbb7e('0x36')]=_0x25c9c4[_0xbb7e('0x36')][_0xbb7e('0x38')]?_0x25c9c4['attributes']:_0x2f546f[_0xbb7e('0x31')];if(_0x2c9815['query'][_0xbb7e('0x41')]){_0x25c9c4[_0xbb7e('0x42')]=[{'all':!![]}];}_0x25c9c4=_['merge']({},_0x25c9c4,_0x2c9815['options']);return db[_0xbb7e('0x2e')]['find'](_0x25c9c4)[_0xbb7e('0x26')](handleEntityNotFound(_0x47f505,null))['then'](respondWithResult(_0x47f505,null))['catch'](handleError(_0x47f505,null));};exports[_0xbb7e('0x48')]=function(_0x1d537d,_0x384442){return db[_0xbb7e('0x2e')][_0xbb7e('0x48')](_0x1d537d['body'],{})[_0xbb7e('0x26')](respondWithResult(_0x384442,0xc9))['catch'](handleError(_0x384442,null));};exports[_0xbb7e('0x25')]=function(_0xf9cf90,_0x142faa){if(_0xf9cf90[_0xbb7e('0x49')]['id']){delete _0xf9cf90[_0xbb7e('0x49')]['id'];}return db[_0xbb7e('0x2e')][_0xbb7e('0x4a')]({'where':{'id':_0xf9cf90[_0xbb7e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x142faa,null))[_0xbb7e('0x26')](saveUpdates(_0xf9cf90[_0xbb7e('0x49')],null))[_0xbb7e('0x26')](respondWithResult(_0x142faa,null))['catch'](handleError(_0x142faa,null));};exports[_0xbb7e('0x4c')]=function(_0x4a8ebd,_0x2a5bee,_0x572d04){var _0x1afafb=require(_0xbb7e('0x4d'));var _0x4160fa=![];var _0x1024b8={};if(_0x4a8ebd[_0xbb7e('0x33')][_0xbb7e('0x3e')]&&_0x4a8ebd[_0xbb7e('0x33')]['type']==='uniqueid'){_0x1024b8[_0xbb7e('0x4e')]=_0x4a8ebd[_0xbb7e('0x4b')]['id'];}else{_0x1024b8['id']=_0x4a8ebd[_0xbb7e('0x4b')]['id'];}return db[_0xbb7e('0x2e')]['find']({'where':_0x1024b8,'attributes':['id',_0xbb7e('0x4f'),_0xbb7e('0x50')],'raw':!![]})[_0xbb7e('0x26')](handleEntityNotFound(_0x2a5bee,null))[_0xbb7e('0x26')](function(_0x1c1143){if(_0x1c1143){var _0xe3d667=_0x1c1143[_0xbb7e('0x4f')];var _0x196e4f=util['format']('%s.cypher',_0xe3d667);if(fs['existsSync'](_0x196e4f)){_0x4160fa=!![];return _0x1afafb[_0xbb7e('0x51')](_0x196e4f,_0xe3d667,config[_0xbb7e('0x52')][_0xbb7e('0x53')])[_0xbb7e('0x26')](function(){return _0x1c1143;});}return _0x1c1143;}})[_0xbb7e('0x26')](function(_0x192c3a){if(_0x192c3a){var _0x2ba569=_0x192c3a[_0xbb7e('0x4f')];if(!fs[_0xbb7e('0x54')](_0x2ba569)){throw new db[(_0xbb7e('0x55'))][(_0xbb7e('0x56'))](_0xbb7e('0x57'));}if(_0x192c3a[_0xbb7e('0x50')]){return _0x2a5bee['download'](_0x2ba569,_0x192c3a[_0xbb7e('0x50')]+path[_0xbb7e('0x58')](_0x2ba569),function(){if(_0x4160fa){fs[_0xbb7e('0x59')](_0x2ba569);}});}else{return _0x2a5bee[_0xbb7e('0x4c')](_0x2ba569,function(_0x26223d){if(_0x4160fa){fs[_0xbb7e('0x59')](_0x2ba569);}});}}})[_0xbb7e('0x45')](function(_0x42ebd2){if(_0x42ebd2['message']===_0xbb7e('0x57')){_0x2a5bee[_0xbb7e('0x1c')](0x194)['send'](_0xbb7e('0x5a'));}else{return handleError(_0x2a5bee,null);}});};exports[_0xbb7e('0x5b')]=function(_0x5834a0,_0x93ace8){return db['SquareRecording']['find']({'where':{'id':_0x5834a0[_0xbb7e('0x4b')]['id']}})[_0xbb7e('0x26')](function(_0x7a9f90){if(_[_0xbb7e('0x5c')](_0x7a9f90)){throw new ReferenceError(_0xbb7e('0x5d'));}return _0x7a9f90;})[_0xbb7e('0x26')](function(_0x27b7e1){var _0x3f8aed=_0x27b7e1[_0xbb7e('0x4f')];logger[_0xbb7e('0x5e')](_0xbb7e('0x5f'),_0x3f8aed);if(!_[_0xbb7e('0x5c')](_0x27b7e1[_0xbb7e('0x4f')])&&fs[_0xbb7e('0x54')](_0x3f8aed)){logger[_0xbb7e('0x5e')]('File:\x20\x22'+_0x3f8aed+_0xbb7e('0x60'));fs[_0xbb7e('0x61')](_0x3f8aed);}_0x3f8aed=_0x3f8aed+_0xbb7e('0x62');if(!_['isNil'](_0x27b7e1[_0xbb7e('0x4f')])&&fs['existsSync'](_0x3f8aed)){logger[_0xbb7e('0x5e')](_0xbb7e('0x63')+_0x3f8aed+_0xbb7e('0x60'));fs[_0xbb7e('0x61')](_0x3f8aed);}return _0x27b7e1;})[_0xbb7e('0x26')](function(_0x1d221e){if(!_0x1d221e)throw new InternalError();return _0x1d221e[_0xbb7e('0x5b')]();})[_0xbb7e('0x26')](function(){_0x93ace8['status'](0xcc)[_0xbb7e('0x1d')]();})[_0xbb7e('0x45')](handleError(_0x93ace8,null));}; \ No newline at end of file +var _0x574d=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','params','options','create','body','download','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x574d,0x1a1));var _0xd574=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x574d[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xd574('0x0'));var rimraf=require(_0xd574('0x1'));var zipdir=require(_0xd574('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd574('0x3'));var Mustache=require('mustache');var util=require(_0xd574('0x4'));var path=require(_0xd574('0x5'));var sox=require(_0xd574('0x6'));var csv=require(_0xd574('0x7'));var ejs=require(_0xd574('0x8'));var fs=require('fs');var fs_extra=require(_0xd574('0x9'));var _=require(_0xd574('0xa'));var squel=require('squel');var crypto=require(_0xd574('0xb'));var jsforce=require(_0xd574('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd574('0x7'));var querystring=require(_0xd574('0xd'));var Papa=require(_0xd574('0xe'));var Redis=require(_0xd574('0xf'));var authService=require(_0xd574('0x10'));var qs=require(_0xd574('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd574('0x12'));var logger=require('../../config/logger')(_0xd574('0x13'));var utils=require('../../config/utils');var config=require(_0xd574('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd574('0x15'))['db'];function respondWithStatusCode(_0x44f3f0,_0x1df9f8){_0x1df9f8=_0x1df9f8||0xcc;return function(_0x150a83){if(_0x150a83){return _0x44f3f0[_0xd574('0x16')](_0x1df9f8);}return _0x44f3f0[_0xd574('0x17')](_0x1df9f8)[_0xd574('0x18')]();};}function respondWithResult(_0x475b74,_0x202285){_0x202285=_0x202285||0xc8;return function(_0x187c12){if(_0x187c12){return _0x475b74[_0xd574('0x17')](_0x202285)['json'](_0x187c12);}};}function respondWithFilteredResult(_0x5b44cd,_0x27fd14){return function(_0x20c43e){if(_0x20c43e){var _0x48ffeb=typeof _0x27fd14[_0xd574('0x19')]==='undefined'&&typeof _0x27fd14['limit']===_0xd574('0x1a');var _0x8c7c7a=_0x20c43e['count'];var _0x4b2cd2=_0x48ffeb?0x0:_0x27fd14[_0xd574('0x19')];var _0x44d5af=_0x48ffeb?_0x20c43e[_0xd574('0x1b')]:_0x27fd14['offset']+_0x27fd14[_0xd574('0x1c')];var _0x1a8221;if(_0x44d5af>=_0x8c7c7a){_0x44d5af=_0x8c7c7a;_0x1a8221=0xc8;}else{_0x1a8221=0xce;}_0x5b44cd[_0xd574('0x17')](_0x1a8221);return _0x5b44cd[_0xd574('0x1d')]('Content-Range',_0x4b2cd2+'-'+_0x44d5af+'/'+_0x8c7c7a)[_0xd574('0x1e')](_0x20c43e);}return null;};}function patchUpdates(_0x47f162){return function(_0x5951c3){try{jsonpatch[_0xd574('0x1f')](_0x5951c3,_0x47f162,!![]);}catch(_0x5ac1ce){return BPromise[_0xd574('0x20')](_0x5ac1ce);}return _0x5951c3[_0xd574('0x21')]();};}function saveUpdates(_0x45749e,_0x5b3efb){return function(_0x5f1a81){if(_0x5f1a81){return _0x5f1a81[_0xd574('0x22')](_0x45749e)[_0xd574('0x23')](function(_0x423b27){return _0x423b27;});}return null;};}function removeEntity(_0x4467ff,_0x40d4f4){return function(_0x21d422){if(_0x21d422){return _0x21d422[_0xd574('0x24')]()[_0xd574('0x23')](function(){_0x4467ff[_0xd574('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49faff,_0x24b3ed){return function(_0x224690){if(!_0x224690){_0x49faff[_0xd574('0x16')](0x194);}return _0x224690;};}function handleError(_0x37f71e,_0x1a6a59){_0x1a6a59=_0x1a6a59||0x1f4;return function(_0x4b45d3){logger[_0xd574('0x25')](_0x4b45d3[_0xd574('0x26')]);if(_0x4b45d3[_0xd574('0x27')]){delete _0x4b45d3['name'];}_0x37f71e['status'](_0x1a6a59)[_0xd574('0x28')](_0x4b45d3);};}exports[_0xd574('0x29')]=function(_0x192d7a,_0x31219f){var _0x17a329={},_0x5772ba={},_0x4a9c5f={'count':0x0,'rows':[]};var _0x3f7f2f=_[_0xd574('0x2a')](db[_0xd574('0x2b')][_0xd574('0x2c')],function(_0x3e7ebe){return{'name':_0x3e7ebe[_0xd574('0x2d')],'type':_0x3e7ebe[_0xd574('0x2e')][_0xd574('0x2f')]};});_0x5772ba[_0xd574('0x30')]=_['map'](_0x3f7f2f,_0xd574('0x27'));_0x5772ba[_0xd574('0x31')]=_[_0xd574('0x32')](_0x192d7a[_0xd574('0x31')]);_0x5772ba[_0xd574('0x33')]=_[_0xd574('0x34')](_0x5772ba['model'],_0x5772ba[_0xd574('0x31')]);_0x17a329[_0xd574('0x35')]=_['intersection'](_0x5772ba['model'],qs[_0xd574('0x36')](_0x192d7a[_0xd574('0x31')][_0xd574('0x36')]));_0x17a329[_0xd574('0x35')]=_0x17a329[_0xd574('0x35')][_0xd574('0x37')]?_0x17a329[_0xd574('0x35')]:_0x5772ba[_0xd574('0x30')];if(!_0x192d7a[_0xd574('0x31')]['hasOwnProperty'](_0xd574('0x38'))){_0x17a329[_0xd574('0x1c')]=qs[_0xd574('0x1c')](_0x192d7a[_0xd574('0x31')][_0xd574('0x1c')]);_0x17a329[_0xd574('0x19')]=qs[_0xd574('0x19')](_0x192d7a[_0xd574('0x31')]['offset']);}_0x17a329[_0xd574('0x39')]=qs[_0xd574('0x3a')](_0x192d7a['query'][_0xd574('0x3a')]);_0x17a329[_0xd574('0x3b')]=qs[_0xd574('0x33')](_[_0xd574('0x3c')](_0x192d7a[_0xd574('0x31')],_0x5772ba[_0xd574('0x33')]),_0x3f7f2f);if(_0x192d7a[_0xd574('0x31')][_0xd574('0x3d')]){_0x17a329[_0xd574('0x3b')]=_['merge'](_0x17a329[_0xd574('0x3b')],{'$or':_[_0xd574('0x2a')](_0x3f7f2f,function(_0x2113b5){if(_0x2113b5[_0xd574('0x2e')]!=='VIRTUAL'){var _0x2e6976={};_0x2e6976[_0x2113b5[_0xd574('0x27')]]={'$like':'%'+_0x192d7a[_0xd574('0x31')][_0xd574('0x3d')]+'%'};return _0x2e6976;}})});}_0x17a329=_['merge']({},_0x17a329,_0x192d7a['options']);var _0x29c008={'where':_0x17a329[_0xd574('0x3b')]};return db['SquareRecording']['count'](_0x29c008)[_0xd574('0x23')](function(_0xd13f19){_0x4a9c5f[_0xd574('0x1b')]=_0xd13f19;if(_0x192d7a[_0xd574('0x31')][_0xd574('0x3e')]){_0x17a329[_0xd574('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0xd574('0x40')](_0x17a329);})['then'](function(_0x119da6){_0x4a9c5f[_0xd574('0x41')]=_0x119da6;return _0x4a9c5f;})[_0xd574('0x23')](respondWithFilteredResult(_0x31219f,_0x17a329))[_0xd574('0x42')](handleError(_0x31219f,null));};exports['show']=function(_0xac635e,_0x3ea330){var _0x16befd={'raw':!![],'where':{'id':_0xac635e[_0xd574('0x43')]['id']}},_0x5c1ea3={};_0x5c1ea3[_0xd574('0x30')]=_[_0xd574('0x32')](db[_0xd574('0x2b')][_0xd574('0x2c')]);_0x5c1ea3[_0xd574('0x31')]=_[_0xd574('0x32')](_0xac635e[_0xd574('0x31')]);_0x5c1ea3[_0xd574('0x33')]=_[_0xd574('0x34')](_0x5c1ea3[_0xd574('0x30')],_0x5c1ea3[_0xd574('0x31')]);_0x16befd[_0xd574('0x35')]=_[_0xd574('0x34')](_0x5c1ea3[_0xd574('0x30')],qs['fields'](_0xac635e[_0xd574('0x31')]['fields']));_0x16befd[_0xd574('0x35')]=_0x16befd['attributes'][_0xd574('0x37')]?_0x16befd[_0xd574('0x35')]:_0x5c1ea3['model'];if(_0xac635e['query'][_0xd574('0x3e')]){_0x16befd[_0xd574('0x3f')]=[{'all':!![]}];}_0x16befd=_['merge']({},_0x16befd,_0xac635e[_0xd574('0x44')]);return db['SquareRecording']['find'](_0x16befd)[_0xd574('0x23')](handleEntityNotFound(_0x3ea330,null))[_0xd574('0x23')](respondWithResult(_0x3ea330,null))[_0xd574('0x42')](handleError(_0x3ea330,null));};exports[_0xd574('0x45')]=function(_0x54cb5e,_0x3df7e9){return db[_0xd574('0x2b')]['create'](_0x54cb5e['body'],{})[_0xd574('0x23')](respondWithResult(_0x3df7e9,0xc9))[_0xd574('0x42')](handleError(_0x3df7e9,null));};exports[_0xd574('0x22')]=function(_0x6c47b2,_0x42ec50){if(_0x6c47b2['body']['id']){delete _0x6c47b2['body']['id'];}return db[_0xd574('0x2b')]['find']({'where':{'id':_0x6c47b2[_0xd574('0x43')]['id']}})[_0xd574('0x23')](handleEntityNotFound(_0x42ec50,null))[_0xd574('0x23')](saveUpdates(_0x6c47b2[_0xd574('0x46')],null))[_0xd574('0x23')](respondWithResult(_0x42ec50,null))[_0xd574('0x42')](handleError(_0x42ec50,null));};exports[_0xd574('0x47')]=function(_0xc462a6,_0x48c333,_0x4233c5){var _0x28e83a=require('../../components/encryptor');var _0x14313f=![];var _0xb17bcf={};if(_0xc462a6[_0xd574('0x31')][_0xd574('0x2e')]&&_0xc462a6['query'][_0xd574('0x2e')]==='uniqueid'){_0xb17bcf[_0xd574('0x48')]=_0xc462a6[_0xd574('0x43')]['id'];}else{_0xb17bcf['id']=_0xc462a6['params']['id'];}return db[_0xd574('0x2b')][_0xd574('0x49')]({'where':_0xb17bcf,'attributes':['id',_0xd574('0x4a'),_0xd574('0x4b')],'raw':!![]})[_0xd574('0x23')](handleEntityNotFound(_0x48c333,null))[_0xd574('0x23')](function(_0x5f11b3){if(_0x5f11b3){var _0x1c5068=_0x5f11b3[_0xd574('0x4a')];var _0x57ba8b=util[_0xd574('0x4c')](_0xd574('0x4d'),_0x1c5068);if(fs[_0xd574('0x4e')](_0x57ba8b)){_0x14313f=!![];return _0x28e83a[_0xd574('0x4f')](_0x57ba8b,_0x1c5068,config['secrets'][_0xd574('0x50')])['then'](function(){return _0x5f11b3;});}return _0x5f11b3;}})['then'](function(_0x531a2e){if(_0x531a2e){var _0x32979d=_0x531a2e[_0xd574('0x4a')];if(!fs[_0xd574('0x4e')](_0x32979d)){throw new db[(_0xd574('0x51'))][(_0xd574('0x52'))](_0xd574('0x53'));}if(_0x531a2e['filename']){return _0x48c333[_0xd574('0x47')](_0x32979d,_0x531a2e['filename']+path[_0xd574('0x54')](_0x32979d),function(){if(_0x14313f){fs[_0xd574('0x55')](_0x32979d);}});}else{return _0x48c333[_0xd574('0x47')](_0x32979d,function(_0x109d48){if(_0x14313f){fs[_0xd574('0x55')](_0x32979d);}});}}})[_0xd574('0x42')](function(_0x3bb01a){if(_0x3bb01a[_0xd574('0x56')]==='SquareRecording\x20not\x20found'){_0x48c333[_0xd574('0x17')](0x194)[_0xd574('0x28')]('Not\x20found');}else{return handleError(_0x48c333,null);}});};exports[_0xd574('0x24')]=function(_0x2358e1,_0x2c2fdd){return db[_0xd574('0x2b')][_0xd574('0x49')]({'where':{'id':_0x2358e1['params']['id']}})[_0xd574('0x23')](function(_0x55b20e){if(_[_0xd574('0x57')](_0x55b20e)){throw new ReferenceError(_0xd574('0x58'));}return _0x55b20e;})['then'](function(_0xe831db){var _0x18c025=_0xe831db['savePath'];logger[_0xd574('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x18c025);if(!_['isNil'](_0xe831db[_0xd574('0x4a')])&&fs[_0xd574('0x4e')](_0x18c025)){logger[_0xd574('0x59')](_0xd574('0x5a')+_0x18c025+_0xd574('0x5b'));fs[_0xd574('0x5c')](_0x18c025);}_0x18c025=_0x18c025+'.cypher';if(!_[_0xd574('0x57')](_0xe831db['savePath'])&&fs[_0xd574('0x4e')](_0x18c025)){logger[_0xd574('0x59')](_0xd574('0x5a')+_0x18c025+_0xd574('0x5b'));fs['unlinkSync'](_0x18c025);}return _0xe831db;})[_0xd574('0x23')](function(_0x3e85e5){if(!_0x3e85e5)throw new InternalError();return _0x3e85e5[_0xd574('0x24')]();})['then'](function(){_0x2c2fdd['status'](0xcc)[_0xd574('0x18')]();})['catch'](handleError(_0x2c2fdd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d0d2db2..4ae48f2 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 _0xf9ac=['api','moment','request-promise','rimraf','exports','define','square_recordings','lodash'];(function(_0x13c4ca,_0x648be2){var _0x13b078=function(_0x30b03e){while(--_0x30b03e){_0x13c4ca['push'](_0x13c4ca['shift']());}};_0x13b078(++_0x648be2);}(_0xf9ac,0x87));var _0xcf9a=function(_0x575934,_0x4a6760){_0x575934=_0x575934-0x0;var _0x109a3d=_0xf9ac[_0x575934];return _0x109a3d;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf9a('0x1'));var moment=require(_0xcf9a('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf9a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf9a('0x4'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xcf9a('0x5')]=function(_0x3d77c8,_0x158971){return _0x3d77c8[_0xcf9a('0x6')]('SquareRecording',attributes,{'tableName':_0xcf9a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a6=['rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','util','../../config/logger','moment','bluebird','path'];(function(_0x40cc9f,_0x105496){var _0x5895c9=function(_0x197924){while(--_0x197924){_0x40cc9f['push'](_0x40cc9f['shift']());}};_0x5895c9(++_0x105496);}(_0x63a6,0x1c7));var _0x663a=function(_0x2a7210,_0x2f3d23){_0x2a7210=_0x2a7210-0x0;var _0x460766=_0x63a6[_0x2a7210];return _0x460766;};'use strict';var _=require('lodash');var util=require(_0x663a('0x0'));var logger=require(_0x663a('0x1'))('api');var moment=require(_0x663a('0x2'));var BPromise=require(_0x663a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x663a('0x4'));var rimraf=require(_0x663a('0x5'));var config=require(_0x663a('0x6'));var attributes=require(_0x663a('0x7'));module['exports']=function(_0x5aab49,_0x5907e8){return _0x5aab49[_0x663a('0x8')](_0x663a('0x9'),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 b6863ed..e0f3672 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 _0x28b4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','raw','debug','util','ioredis'];(function(_0x3a7ffc,_0x2f49a7){var _0xbba4dd=function(_0x5ee7b4){while(--_0x5ee7b4){_0x3a7ffc['push'](_0x3a7ffc['shift']());}};_0xbba4dd(++_0x2f49a7);}(_0x28b4,0x175));var _0x428b=function(_0x34b51b,_0x4af5f2){_0x34b51b=_0x34b51b-0x0;var _0xac5975=_0x28b4[_0x34b51b];return _0xac5975;};'use strict';var _=require('lodash');var util=require(_0x428b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x428b('0x1'));var db=require(_0x428b('0x2'))['db'];var utils=require(_0x428b('0x3'));var logger=require(_0x428b('0x4'))(_0x428b('0x5'));var config=require(_0x428b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x428b('0x7')][_0x428b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cd216,_0x146bcd,_0x3f0f9b){return new BPromise(function(_0x539f0b,_0x3587b2){return client[_0x428b('0x9')](_0x4cd216,_0x3f0f9b)[_0x428b('0xa')](function(_0x82aebb){logger[_0x428b('0xb')](_0x428b('0xc'),_0x146bcd,_0x428b('0xd'));logger['debug'](_0x428b('0xe'),_0x146bcd,_0x428b('0xd'),JSON['stringify'](_0x82aebb));if(_0x82aebb[_0x428b('0xf')]){if(_0x82aebb[_0x428b('0xf')][_0x428b('0x10')]===0x1f4){logger[_0x428b('0xf')]('SquareRecording,\x20%s,\x20%s',_0x146bcd,_0x82aebb[_0x428b('0xf')][_0x428b('0x11')]);return _0x3587b2(_0x82aebb[_0x428b('0xf')][_0x428b('0x11')]);}logger[_0x428b('0xf')](_0x428b('0xc'),_0x146bcd,_0x82aebb['error']['message']);return _0x539f0b(_0x82aebb[_0x428b('0xf')]['message']);}else{logger['info'](_0x428b('0xc'),_0x146bcd,_0x428b('0xd'));_0x539f0b(_0x82aebb['result']['message']);}})[_0x428b('0x12')](function(_0x1c1d4c){logger[_0x428b('0xf')]('SquareRecording,\x20%s,\x20%s',_0x146bcd,_0x1c1d4c);_0x3587b2(_0x1c1d4c);});});}exports[_0x428b('0x13')]=function(_0x18ba7b){var _0x2ff13a=this;return new Promise(function(_0x269b36,_0x310c5f){return db[_0x428b('0x14')][_0x428b('0x15')](_0x18ba7b[_0x428b('0x16')],{'raw':_0x18ba7b['options']?_0x18ba7b['options'][_0x428b('0x17')]===undefined?!![]:![]:!![]})[_0x428b('0xa')](function(_0x58d5c5){logger[_0x428b('0xb')](_0x428b('0x13'),_0x18ba7b);logger[_0x428b('0x18')]('CreateSquareRecording',_0x18ba7b,JSON['stringify'](_0x58d5c5));_0x269b36(_0x58d5c5);})[_0x428b('0x12')](function(_0x307fb5){logger[_0x428b('0xf')](_0x428b('0x13'),_0x307fb5[_0x428b('0x11')],_0x18ba7b);_0x310c5f(_0x2ff13a[_0x428b('0xf')](0x1f4,_0x307fb5[_0x428b('0x11')]));});});}; \ No newline at end of file +var _0x1c60=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird'];(function(_0x4acab0,_0x221db9){var _0x587ad4=function(_0x4c7162){while(--_0x4c7162){_0x4acab0['push'](_0x4acab0['shift']());}};_0x587ad4(++_0x221db9);}(_0x1c60,0xb9));var _0x01c6=function(_0x5d3550,_0x107033){_0x5d3550=_0x5d3550-0x0;var _0x5d1299=_0x1c60[_0x5d3550];return _0x5d1299;};'use strict';var _=require(_0x01c6('0x0'));var util=require(_0x01c6('0x1'));var moment=require(_0x01c6('0x2'));var BPromise=require(_0x01c6('0x3'));var rs=require(_0x01c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01c6('0x6'))(_0x01c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x01c6('0x8'));var client=jayson[_0x01c6('0x9')][_0x01c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa9060e,_0x39d1e7,_0x3d50a1){return new BPromise(function(_0x4f094c,_0x2171c7){return client[_0x01c6('0xb')](_0xa9060e,_0x3d50a1)[_0x01c6('0xc')](function(_0xbd2a49){logger[_0x01c6('0xd')](_0x01c6('0xe'),_0x39d1e7,_0x01c6('0xf'));logger[_0x01c6('0x10')](_0x01c6('0x11'),_0x39d1e7,'request\x20sent',JSON[_0x01c6('0x12')](_0xbd2a49));if(_0xbd2a49[_0x01c6('0x13')]){if(_0xbd2a49[_0x01c6('0x13')]['code']===0x1f4){logger[_0x01c6('0x13')](_0x01c6('0xe'),_0x39d1e7,_0xbd2a49['error'][_0x01c6('0x14')]);return _0x2171c7(_0xbd2a49[_0x01c6('0x13')][_0x01c6('0x14')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x39d1e7,_0xbd2a49['error'][_0x01c6('0x14')]);return _0x4f094c(_0xbd2a49['error'][_0x01c6('0x14')]);}else{logger[_0x01c6('0xd')](_0x01c6('0xe'),_0x39d1e7,_0x01c6('0xf'));_0x4f094c(_0xbd2a49['result'][_0x01c6('0x14')]);}})[_0x01c6('0x15')](function(_0x35dff3){logger[_0x01c6('0x13')]('SquareRecording,\x20%s,\x20%s',_0x39d1e7,_0x35dff3);_0x2171c7(_0x35dff3);});});}exports[_0x01c6('0x16')]=function(_0x3c31fa){var _0x3926bd=this;return new Promise(function(_0x1a4074,_0x534ab0){return db[_0x01c6('0x17')][_0x01c6('0x18')](_0x3c31fa['body'],{'raw':_0x3c31fa[_0x01c6('0x19')]?_0x3c31fa[_0x01c6('0x19')][_0x01c6('0x1a')]===undefined?!![]:![]:!![]})[_0x01c6('0xc')](function(_0x2c327b){logger['info'](_0x01c6('0x16'),_0x3c31fa);logger['debug'](_0x01c6('0x16'),_0x3c31fa,JSON[_0x01c6('0x12')](_0x2c327b));_0x1a4074(_0x2c327b);})[_0x01c6('0x15')](function(_0x311afe){logger[_0x01c6('0x13')](_0x01c6('0x16'),_0x311afe['message'],_0x3c31fa);_0x534ab0(_0x3926bd[_0x01c6('0x13')](0x1f4,_0x311afe[_0x01c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 496805c..93b7f65 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x401065,_0x4b92af){var _0x4162e5=function(_0x406ff5){while(--_0x406ff5){_0x401065['push'](_0x401065['shift']());}};_0x4162e5(++_0x4b92af);}(_0xb10b,0x12a));var _0xbb10=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0xb10b[_0x196ce1];return _0x360a64;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a19e86a..efe616b 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 _0x264b=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x264b,0x6f));var _0xb264=function(_0x770bee,_0x82f4df){_0x770bee=_0x770bee-0x0;var _0x140b18=_0x264b[_0x770bee];return _0x140b18;};'use strict';var Sequelize=require(_0xb264('0x0'));module[_0xb264('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xb264('0x2')]},'request':{'type':Sequelize[_0xb264('0x2')]},'channel':{'type':Sequelize[_0xb264('0x2')]},'language':{'type':Sequelize[_0xb264('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb264('0x2')]},'version':{'type':Sequelize[_0xb264('0x2')]},'callerid':{'type':Sequelize[_0xb264('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xb264('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xb264('0x2')]},'callingtns':{'type':Sequelize[_0xb264('0x2')]},'dnid':{'type':Sequelize[_0xb264('0x2')]},'rdnis':{'type':Sequelize[_0xb264('0x2')]},'context':{'type':Sequelize[_0xb264('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb264('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb264('0x2')]},'threadid':{'type':Sequelize[_0xb264('0x2')]},'project_name':{'type':Sequelize[_0xb264('0x2')]},'joinAt':{'type':Sequelize[_0xb264('0x3')]},'leaveAt':{'type':Sequelize[_0xb264('0x3')]},'bot':{'type':Sequelize[_0xb264('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x05ca=['STRING','DATE','BOOLEAN','sequelize'];(function(_0xa9100,_0x44f6d4){var _0x3fbbf6=function(_0x2faa2a){while(--_0x2faa2a){_0xa9100['push'](_0xa9100['shift']());}};_0x3fbbf6(++_0x44f6d4);}(_0x05ca,0xbf));var _0xa05c=function(_0x290bf1,_0x164867){_0x290bf1=_0x290bf1-0x0;var _0x37d086=_0x05ca[_0x290bf1];return _0x37d086;};'use strict';var Sequelize=require(_0xa05c('0x0'));module['exports']={'network':{'type':Sequelize[_0xa05c('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa05c('0x1')]},'channel':{'type':Sequelize[_0xa05c('0x1')]},'language':{'type':Sequelize[_0xa05c('0x1')]},'type':{'type':Sequelize[_0xa05c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xa05c('0x1')]},'callerid':{'type':Sequelize[_0xa05c('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xa05c('0x1')]},'callingtns':{'type':Sequelize[_0xa05c('0x1')]},'dnid':{'type':Sequelize[_0xa05c('0x1')]},'rdnis':{'type':Sequelize[_0xa05c('0x1')]},'context':{'type':Sequelize[_0xa05c('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa05c('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa05c('0x1')]},'threadid':{'type':Sequelize[_0xa05c('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa05c('0x2')]},'leaveAt':{'type':Sequelize[_0xa05c('0x2')]},'bot':{'type':Sequelize[_0xa05c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index e2699d2..88d6a61 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 _0x767c=['update','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find'];(function(_0x4d45b0,_0x508b1f){var _0x2d726d=function(_0x2e3ec3){while(--_0x2e3ec3){_0x4d45b0['push'](_0x4d45b0['shift']());}};_0x2d726d(++_0x508b1f);}(_0x767c,0x93));var _0xc767=function(_0xcfde1d,_0x47fcab){_0xcfde1d=_0xcfde1d-0x0;var _0x2abc9e=_0x767c[_0xcfde1d];return _0x2abc9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc767('0x0'));var zipdir=require(_0xc767('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc767('0x2'));var moment=require(_0xc767('0x3'));var BPromise=require(_0xc767('0x4'));var Mustache=require(_0xc767('0x5'));var util=require('util');var path=require(_0xc767('0x6'));var sox=require(_0xc767('0x7'));var csv=require(_0xc767('0x8'));var ejs=require(_0xc767('0x9'));var fs=require('fs');var fs_extra=require(_0xc767('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc767('0xb'));var jsforce=require(_0xc767('0xc'));var deskjs=require(_0xc767('0xd'));var toCsv=require(_0xc767('0x8'));var querystring=require(_0xc767('0xe'));var Papa=require('papaparse');var Redis=require(_0xc767('0xf'));var authService=require(_0xc767('0x10'));var qs=require(_0xc767('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc767('0x12'));var logger=require(_0xc767('0x13'))(_0xc767('0x14'));var utils=require('../../config/utils');var config=require(_0xc767('0x15'));var licenseUtil=require(_0xc767('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x485fd2,_0xa53e6c){_0xa53e6c=_0xa53e6c||0xcc;return function(_0x3b9760){if(_0x3b9760){return _0x485fd2[_0xc767('0x17')](_0xa53e6c);}return _0x485fd2[_0xc767('0x18')](_0xa53e6c)[_0xc767('0x19')]();};}function respondWithResult(_0x51e20e,_0x152dfe){_0x152dfe=_0x152dfe||0xc8;return function(_0x424963){if(_0x424963){return _0x51e20e['status'](_0x152dfe)['json'](_0x424963);}};}function respondWithFilteredResult(_0x5bfc00,_0x878663){return function(_0x28c2ae){if(_0x28c2ae){var _0x2942bc=typeof _0x878663[_0xc767('0x1a')]===_0xc767('0x1b')&&typeof _0x878663[_0xc767('0x1c')]===_0xc767('0x1b');var _0x3d809b=_0x28c2ae[_0xc767('0x1d')];var _0x2edb05=_0x2942bc?0x0:_0x878663[_0xc767('0x1a')];var _0x123e7c=_0x2942bc?_0x28c2ae['count']:_0x878663[_0xc767('0x1a')]+_0x878663['limit'];var _0x37df4e;if(_0x123e7c>=_0x3d809b){_0x123e7c=_0x3d809b;_0x37df4e=0xc8;}else{_0x37df4e=0xce;}_0x5bfc00['status'](_0x37df4e);return _0x5bfc00[_0xc767('0x1e')](_0xc767('0x1f'),_0x2edb05+'-'+_0x123e7c+'/'+_0x3d809b)['json'](_0x28c2ae);}return null;};}function patchUpdates(_0x661809){return function(_0x5178a7){try{jsonpatch[_0xc767('0x20')](_0x5178a7,_0x661809,!![]);}catch(_0x3d1827){return BPromise['reject'](_0x3d1827);}return _0x5178a7['save']();};}function saveUpdates(_0x2aabf9,_0x11ab98){return function(_0x5d8178){if(_0x5d8178){return _0x5d8178['update'](_0x2aabf9)[_0xc767('0x21')](function(_0x21cfca){return _0x21cfca;});}return null;};}function removeEntity(_0xa88b56,_0x470a7e){return function(_0x3afbef){if(_0x3afbef){return _0x3afbef[_0xc767('0x22')]()[_0xc767('0x21')](function(){_0xa88b56[_0xc767('0x18')](0xcc)[_0xc767('0x19')]();});}};}function handleEntityNotFound(_0x35dd7e,_0x18fd0f){return function(_0x42936b){if(!_0x42936b){_0x35dd7e[_0xc767('0x17')](0x194);}return _0x42936b;};}function handleError(_0xf4a5b5,_0x4c100c){_0x4c100c=_0x4c100c||0x1f4;return function(_0x5bef2e){logger['error'](_0x5bef2e['stack']);if(_0x5bef2e[_0xc767('0x23')]){delete _0x5bef2e[_0xc767('0x23')];}_0xf4a5b5[_0xc767('0x18')](_0x4c100c)[_0xc767('0x24')](_0x5bef2e);};}exports[_0xc767('0x25')]=function(_0x265f42,_0x433922){var _0x89f9aa={},_0x165ec8={},_0x5a49db={'count':0x0,'rows':[]};var _0x10ad02=_[_0xc767('0x26')](db[_0xc767('0x27')][_0xc767('0x28')],function(_0x3ac919){return{'name':_0x3ac919[_0xc767('0x29')],'type':_0x3ac919[_0xc767('0x2a')][_0xc767('0x2b')]};});_0x165ec8[_0xc767('0x2c')]=_['map'](_0x10ad02,_0xc767('0x23'));_0x165ec8[_0xc767('0x2d')]=_[_0xc767('0x2e')](_0x265f42[_0xc767('0x2d')]);_0x165ec8[_0xc767('0x2f')]=_['intersection'](_0x165ec8[_0xc767('0x2c')],_0x165ec8[_0xc767('0x2d')]);_0x89f9aa[_0xc767('0x30')]=_['intersection'](_0x165ec8[_0xc767('0x2c')],qs['fields'](_0x265f42['query'][_0xc767('0x31')]));_0x89f9aa[_0xc767('0x30')]=_0x89f9aa[_0xc767('0x30')][_0xc767('0x32')]?_0x89f9aa['attributes']:_0x165ec8[_0xc767('0x2c')];if(!_0x265f42[_0xc767('0x2d')][_0xc767('0x33')](_0xc767('0x34'))){_0x89f9aa['limit']=qs['limit'](_0x265f42[_0xc767('0x2d')]['limit']);_0x89f9aa[_0xc767('0x1a')]=qs[_0xc767('0x1a')](_0x265f42['query'][_0xc767('0x1a')]);}_0x89f9aa['order']=qs[_0xc767('0x35')](_0x265f42[_0xc767('0x2d')][_0xc767('0x35')]);_0x89f9aa[_0xc767('0x36')]=qs['filters'](_[_0xc767('0x37')](_0x265f42[_0xc767('0x2d')],_0x165ec8['filters']),_0x10ad02);if(_0x265f42['query'][_0xc767('0x38')]){_0x89f9aa[_0xc767('0x36')]=_[_0xc767('0x39')](_0x89f9aa[_0xc767('0x36')],{'$or':_['map'](_0x10ad02,function(_0x43e316){if(_0x43e316[_0xc767('0x2a')]!==_0xc767('0x3a')){var _0x10771b={};_0x10771b[_0x43e316[_0xc767('0x23')]]={'$like':'%'+_0x265f42['query'][_0xc767('0x38')]+'%'};return _0x10771b;}})});}_0x89f9aa=_[_0xc767('0x39')]({},_0x89f9aa,_0x265f42['options']);var _0x4dece={'where':_0x89f9aa['where']};return db[_0xc767('0x27')][_0xc767('0x1d')](_0x4dece)[_0xc767('0x21')](function(_0xd8ae7){_0x5a49db[_0xc767('0x1d')]=_0xd8ae7;if(_0x265f42[_0xc767('0x2d')][_0xc767('0x3b')]){_0x89f9aa[_0xc767('0x3c')]=[{'all':!![]}];}return db[_0xc767('0x27')][_0xc767('0x3d')](_0x89f9aa);})[_0xc767('0x21')](function(_0x138d70){_0x5a49db[_0xc767('0x3e')]=_0x138d70;return _0x5a49db;})[_0xc767('0x21')](respondWithFilteredResult(_0x433922,_0x89f9aa))[_0xc767('0x3f')](handleError(_0x433922,null));};exports[_0xc767('0x40')]=function(_0x1556c9,_0x1028d6){var _0x536ec6={'raw':!![],'where':{'id':_0x1556c9[_0xc767('0x41')]['id']}},_0xd168a4={};_0xd168a4['model']=_['keys'](db[_0xc767('0x27')][_0xc767('0x28')]);_0xd168a4[_0xc767('0x2d')]=_[_0xc767('0x2e')](_0x1556c9['query']);_0xd168a4[_0xc767('0x2f')]=_['intersection'](_0xd168a4['model'],_0xd168a4[_0xc767('0x2d')]);_0x536ec6[_0xc767('0x30')]=_[_0xc767('0x42')](_0xd168a4[_0xc767('0x2c')],qs['fields'](_0x1556c9[_0xc767('0x2d')][_0xc767('0x31')]));_0x536ec6[_0xc767('0x30')]=_0x536ec6[_0xc767('0x30')][_0xc767('0x32')]?_0x536ec6[_0xc767('0x30')]:_0xd168a4['model'];if(_0x1556c9['query'][_0xc767('0x3b')]){_0x536ec6[_0xc767('0x3c')]=[{'all':!![]}];}_0x536ec6=_[_0xc767('0x39')]({},_0x536ec6,_0x1556c9[_0xc767('0x43')]);return db[_0xc767('0x27')][_0xc767('0x44')](_0x536ec6)['then'](handleEntityNotFound(_0x1028d6,null))[_0xc767('0x21')](respondWithResult(_0x1028d6,null))[_0xc767('0x3f')](handleError(_0x1028d6,null));};exports['create']=function(_0x2e2f2f,_0xa58730){return db[_0xc767('0x27')]['create'](_0x2e2f2f['body'],{})[_0xc767('0x21')](respondWithResult(_0xa58730,0xc9))['catch'](handleError(_0xa58730,null));};exports[_0xc767('0x45')]=function(_0x3c661f,_0xfd9916){if(_0x3c661f[_0xc767('0x46')]['id']){delete _0x3c661f[_0xc767('0x46')]['id'];}return db['SquareReport'][_0xc767('0x44')]({'where':{'id':_0x3c661f[_0xc767('0x41')]['id']}})[_0xc767('0x21')](handleEntityNotFound(_0xfd9916,null))[_0xc767('0x21')](saveUpdates(_0x3c661f[_0xc767('0x46')],null))['then'](respondWithResult(_0xfd9916,null))['catch'](handleError(_0xfd9916,null));};exports[_0xc767('0x22')]=function(_0x274c28,_0x3578cc){return db[_0xc767('0x27')][_0xc767('0x44')]({'where':{'id':_0x274c28[_0xc767('0x41')]['id']}})['then'](handleEntityNotFound(_0x3578cc,null))['then'](removeEntity(_0x3578cc,null))[_0xc767('0x3f')](handleError(_0x3578cc,null));};exports[_0xc767('0x47')]=function(_0x46fb1b,_0x406a88){return db[_0xc767('0x27')]['describe']()[_0xc767('0x21')](respondWithResult(_0x406a88,null))['catch'](handleError(_0x406a88,null));}; \ No newline at end of file +var _0xa92d=['catch','show','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','reject','save','update','then','destroy','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include'];(function(_0x34f8ba,_0x2bb6a8){var _0xa5ed05=function(_0x497771){while(--_0x497771){_0x34f8ba['push'](_0x34f8ba['shift']());}};_0xa5ed05(++_0x2bb6a8);}(_0xa92d,0x130));var _0xda92=function(_0x4cc60f,_0x475f0a){_0x4cc60f=_0x4cc60f-0x0;var _0x25a0ee=_0xa92d[_0x4cc60f];return _0x25a0ee;};'use strict';var emlformat=require(_0xda92('0x0'));var rimraf=require(_0xda92('0x1'));var zipdir=require(_0xda92('0x2'));var jsonpatch=require(_0xda92('0x3'));var rp=require(_0xda92('0x4'));var moment=require('moment');var BPromise=require(_0xda92('0x5'));var Mustache=require(_0xda92('0x6'));var util=require(_0xda92('0x7'));var path=require(_0xda92('0x8'));var sox=require(_0xda92('0x9'));var csv=require(_0xda92('0xa'));var ejs=require(_0xda92('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda92('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda92('0xd'));var deskjs=require(_0xda92('0xe'));var toCsv=require(_0xda92('0xa'));var querystring=require(_0xda92('0xf'));var Papa=require(_0xda92('0x10'));var Redis=require(_0xda92('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xda92('0x12'));var as=require(_0xda92('0x13'));var hardwareService=require(_0xda92('0x14'));var logger=require(_0xda92('0x15'))(_0xda92('0x16'));var utils=require('../../config/utils');var config=require(_0xda92('0x17'));var licenseUtil=require(_0xda92('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7672,_0x5885b4){_0x5885b4=_0x5885b4||0xcc;return function(_0xff2e70){if(_0xff2e70){return _0x7672[_0xda92('0x19')](_0x5885b4);}return _0x7672[_0xda92('0x1a')](_0x5885b4)[_0xda92('0x1b')]();};}function respondWithResult(_0x12c76c,_0x55f376){_0x55f376=_0x55f376||0xc8;return function(_0x4fc8b3){if(_0x4fc8b3){return _0x12c76c['status'](_0x55f376)['json'](_0x4fc8b3);}};}function respondWithFilteredResult(_0x5d4ff9,_0x370657){return function(_0x348431){if(_0x348431){var _0x237ce4=typeof _0x370657['offset']===_0xda92('0x1c')&&typeof _0x370657[_0xda92('0x1d')]==='undefined';var _0x548896=_0x348431[_0xda92('0x1e')];var _0x2d10f8=_0x237ce4?0x0:_0x370657[_0xda92('0x1f')];var _0x1d4963=_0x237ce4?_0x348431[_0xda92('0x1e')]:_0x370657[_0xda92('0x1f')]+_0x370657[_0xda92('0x1d')];var _0xe6b02c;if(_0x1d4963>=_0x548896){_0x1d4963=_0x548896;_0xe6b02c=0xc8;}else{_0xe6b02c=0xce;}_0x5d4ff9[_0xda92('0x1a')](_0xe6b02c);return _0x5d4ff9[_0xda92('0x20')]('Content-Range',_0x2d10f8+'-'+_0x1d4963+'/'+_0x548896)['json'](_0x348431);}return null;};}function patchUpdates(_0x4b40c7){return function(_0x407f1a){try{jsonpatch['apply'](_0x407f1a,_0x4b40c7,!![]);}catch(_0x42a3ba){return BPromise[_0xda92('0x21')](_0x42a3ba);}return _0x407f1a[_0xda92('0x22')]();};}function saveUpdates(_0x4fe7d2,_0x5ef573){return function(_0x1cc49d){if(_0x1cc49d){return _0x1cc49d[_0xda92('0x23')](_0x4fe7d2)[_0xda92('0x24')](function(_0x364ec8){return _0x364ec8;});}return null;};}function removeEntity(_0x5dc61d,_0x177e69){return function(_0x18243a){if(_0x18243a){return _0x18243a[_0xda92('0x25')]()[_0xda92('0x24')](function(){_0x5dc61d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e9e4,_0x2fab39){return function(_0x50e71b){if(!_0x50e71b){_0x56e9e4[_0xda92('0x19')](0x194);}return _0x50e71b;};}function handleError(_0x39f4ff,_0x6c2458){_0x6c2458=_0x6c2458||0x1f4;return function(_0x34a81b){logger['error'](_0x34a81b[_0xda92('0x26')]);if(_0x34a81b[_0xda92('0x27')]){delete _0x34a81b[_0xda92('0x27')];}_0x39f4ff[_0xda92('0x1a')](_0x6c2458)[_0xda92('0x28')](_0x34a81b);};}exports[_0xda92('0x29')]=function(_0x2e1ecf,_0x4948d6){var _0x3eec78={},_0x472614={},_0x5f0cac={'count':0x0,'rows':[]};var _0x417dfb=_[_0xda92('0x2a')](db[_0xda92('0x2b')][_0xda92('0x2c')],function(_0x275af9){return{'name':_0x275af9[_0xda92('0x2d')],'type':_0x275af9[_0xda92('0x2e')][_0xda92('0x2f')]};});_0x472614['model']=_[_0xda92('0x2a')](_0x417dfb,_0xda92('0x27'));_0x472614['query']=_[_0xda92('0x30')](_0x2e1ecf[_0xda92('0x31')]);_0x472614[_0xda92('0x32')]=_[_0xda92('0x33')](_0x472614[_0xda92('0x34')],_0x472614[_0xda92('0x31')]);_0x3eec78['attributes']=_[_0xda92('0x33')](_0x472614[_0xda92('0x34')],qs[_0xda92('0x35')](_0x2e1ecf[_0xda92('0x31')][_0xda92('0x35')]));_0x3eec78[_0xda92('0x36')]=_0x3eec78[_0xda92('0x36')][_0xda92('0x37')]?_0x3eec78[_0xda92('0x36')]:_0x472614[_0xda92('0x34')];if(!_0x2e1ecf[_0xda92('0x31')][_0xda92('0x38')](_0xda92('0x39'))){_0x3eec78[_0xda92('0x1d')]=qs[_0xda92('0x1d')](_0x2e1ecf[_0xda92('0x31')][_0xda92('0x1d')]);_0x3eec78['offset']=qs[_0xda92('0x1f')](_0x2e1ecf[_0xda92('0x31')][_0xda92('0x1f')]);}_0x3eec78[_0xda92('0x3a')]=qs[_0xda92('0x3b')](_0x2e1ecf['query']['sort']);_0x3eec78['where']=qs[_0xda92('0x32')](_['pick'](_0x2e1ecf[_0xda92('0x31')],_0x472614[_0xda92('0x32')]),_0x417dfb);if(_0x2e1ecf[_0xda92('0x31')][_0xda92('0x3c')]){_0x3eec78['where']=_['merge'](_0x3eec78[_0xda92('0x3d')],{'$or':_[_0xda92('0x2a')](_0x417dfb,function(_0x3f0969){if(_0x3f0969[_0xda92('0x2e')]!==_0xda92('0x3e')){var _0x157677={};_0x157677[_0x3f0969['name']]={'$like':'%'+_0x2e1ecf['query']['filter']+'%'};return _0x157677;}})});}_0x3eec78=_['merge']({},_0x3eec78,_0x2e1ecf[_0xda92('0x3f')]);var _0x4d7e04={'where':_0x3eec78[_0xda92('0x3d')]};return db[_0xda92('0x2b')][_0xda92('0x1e')](_0x4d7e04)[_0xda92('0x24')](function(_0x519f02){_0x5f0cac[_0xda92('0x1e')]=_0x519f02;if(_0x2e1ecf[_0xda92('0x31')][_0xda92('0x40')]){_0x3eec78[_0xda92('0x41')]=[{'all':!![]}];}return db[_0xda92('0x2b')]['findAll'](_0x3eec78);})['then'](function(_0x1ef3df){_0x5f0cac['rows']=_0x1ef3df;return _0x5f0cac;})[_0xda92('0x24')](respondWithFilteredResult(_0x4948d6,_0x3eec78))[_0xda92('0x42')](handleError(_0x4948d6,null));};exports[_0xda92('0x43')]=function(_0x57dd33,_0x2aaaac){var _0x1a7d66={'raw':!![],'where':{'id':_0x57dd33['params']['id']}},_0x48328e={};_0x48328e[_0xda92('0x34')]=_['keys'](db[_0xda92('0x2b')][_0xda92('0x2c')]);_0x48328e[_0xda92('0x31')]=_[_0xda92('0x30')](_0x57dd33[_0xda92('0x31')]);_0x48328e[_0xda92('0x32')]=_[_0xda92('0x33')](_0x48328e[_0xda92('0x34')],_0x48328e[_0xda92('0x31')]);_0x1a7d66['attributes']=_[_0xda92('0x33')](_0x48328e['model'],qs[_0xda92('0x35')](_0x57dd33[_0xda92('0x31')]['fields']));_0x1a7d66[_0xda92('0x36')]=_0x1a7d66[_0xda92('0x36')]['length']?_0x1a7d66[_0xda92('0x36')]:_0x48328e[_0xda92('0x34')];if(_0x57dd33[_0xda92('0x31')]['includeAll']){_0x1a7d66[_0xda92('0x41')]=[{'all':!![]}];}_0x1a7d66=_[_0xda92('0x44')]({},_0x1a7d66,_0x57dd33[_0xda92('0x3f')]);return db[_0xda92('0x2b')][_0xda92('0x45')](_0x1a7d66)[_0xda92('0x24')](handleEntityNotFound(_0x2aaaac,null))[_0xda92('0x24')](respondWithResult(_0x2aaaac,null))[_0xda92('0x42')](handleError(_0x2aaaac,null));};exports[_0xda92('0x46')]=function(_0x2a4544,_0x19c310){return db['SquareReport'][_0xda92('0x46')](_0x2a4544['body'],{})[_0xda92('0x24')](respondWithResult(_0x19c310,0xc9))[_0xda92('0x42')](handleError(_0x19c310,null));};exports['update']=function(_0x47f916,_0x431733){if(_0x47f916['body']['id']){delete _0x47f916[_0xda92('0x47')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x47f916[_0xda92('0x48')]['id']}})[_0xda92('0x24')](handleEntityNotFound(_0x431733,null))[_0xda92('0x24')](saveUpdates(_0x47f916['body'],null))[_0xda92('0x24')](respondWithResult(_0x431733,null))['catch'](handleError(_0x431733,null));};exports[_0xda92('0x25')]=function(_0x23ab8a,_0x2ed6a1){return db[_0xda92('0x2b')]['find']({'where':{'id':_0x23ab8a[_0xda92('0x48')]['id']}})[_0xda92('0x24')](handleEntityNotFound(_0x2ed6a1,null))['then'](removeEntity(_0x2ed6a1,null))[_0xda92('0x42')](handleError(_0x2ed6a1,null));};exports[_0xda92('0x49')]=function(_0x40236a,_0x3c1cb6){return db[_0xda92('0x2b')][_0xda92('0x49')]()[_0xda92('0x24')](respondWithResult(_0x3c1cb6,null))[_0xda92('0x42')](handleError(_0x3c1cb6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7be0566..62fb158 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 _0xce02=['project_name','leaveAt','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid'];(function(_0xdd9bba,_0x2e6c98){var _0x39c164=function(_0xe5ccdd){while(--_0xe5ccdd){_0xdd9bba['push'](_0xdd9bba['shift']());}};_0x39c164(++_0x2e6c98);}(_0xce02,0xa7));var _0x2ce0=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xce02[_0x42020e];return _0x561551;};'use strict';var _=require('lodash');var util=require(_0x2ce0('0x0'));var logger=require(_0x2ce0('0x1'))('api');var moment=require(_0x2ce0('0x2'));var BPromise=require(_0x2ce0('0x3'));var rp=require(_0x2ce0('0x4'));var fs=require('fs');var path=require(_0x2ce0('0x5'));var rimraf=require('rimraf');var config=require(_0x2ce0('0x6'));var attributes=require(_0x2ce0('0x7'));module[_0x2ce0('0x8')]=function(_0x50d644,_0x289cc0){return _0x50d644[_0x2ce0('0x9')](_0x2ce0('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x2ce0('0xb'),'fields':[_0x2ce0('0xc'),_0x2ce0('0xd')]},{'name':_0x2ce0('0xe'),'fields':[_0x2ce0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x940c=['rimraf','../../config/environment','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','path'];(function(_0x44fe5d,_0x50366b){var _0x1526f0=function(_0x303672){while(--_0x303672){_0x44fe5d['push'](_0x44fe5d['shift']());}};_0x1526f0(++_0x50366b);}(_0x940c,0x18e));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc940('0x0'));var util=require(_0xc940('0x1'));var logger=require(_0xc940('0x2'))(_0xc940('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc940('0x4'));var rimraf=require(_0xc940('0x5'));var config=require(_0xc940('0x6'));var attributes=require(_0xc940('0x7'));module['exports']=function(_0x13e0f9,_0x3854d6){return _0x13e0f9['define'](_0xc940('0x8'),attributes,{'tableName':_0xc940('0x9'),'paranoid':![],'indexes':[{'name':_0xc940('0xa'),'fields':[_0xc940('0xb'),'project_name']},{'name':_0xc940('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9525c36..d363398 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 _0x7717=['message','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s'];(function(_0x528e64,_0x1e94fc){var _0x582907=function(_0x5bb456){while(--_0x5bb456){_0x528e64['push'](_0x528e64['shift']());}};_0x582907(++_0x1e94fc);}(_0x7717,0x9d));var _0x7771=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7717[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7771('0x0'));var util=require(_0x7771('0x1'));var moment=require(_0x7771('0x2'));var BPromise=require(_0x7771('0x3'));var rs=require(_0x7771('0x4'));var fs=require('fs');var Redis=require(_0x7771('0x5'));var db=require(_0x7771('0x6'))['db'];var utils=require(_0x7771('0x7'));var logger=require(_0x7771('0x8'))(_0x7771('0x9'));var config=require(_0x7771('0xa'));var jayson=require(_0x7771('0xb'));var client=jayson[_0x7771('0xc')][_0x7771('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x505e3a,_0x281ed3,_0xace122){return new BPromise(function(_0x3e2c89,_0x1ea602){return client['request'](_0x505e3a,_0xace122)[_0x7771('0xe')](function(_0x410f3c){logger[_0x7771('0xf')]('SquareReport,\x20%s,\x20%s',_0x281ed3,_0x7771('0x10'));logger[_0x7771('0x11')](_0x7771('0x12'),_0x281ed3,_0x7771('0x10'),JSON[_0x7771('0x13')](_0x410f3c));if(_0x410f3c[_0x7771('0x14')]){if(_0x410f3c['error'][_0x7771('0x15')]===0x1f4){logger[_0x7771('0x14')](_0x7771('0x16'),_0x281ed3,_0x410f3c[_0x7771('0x14')][_0x7771('0x17')]);return _0x1ea602(_0x410f3c[_0x7771('0x14')]['message']);}logger[_0x7771('0x14')](_0x7771('0x16'),_0x281ed3,_0x410f3c[_0x7771('0x14')]['message']);return _0x3e2c89(_0x410f3c[_0x7771('0x14')][_0x7771('0x17')]);}else{logger[_0x7771('0xf')](_0x7771('0x16'),_0x281ed3,_0x7771('0x10'));_0x3e2c89(_0x410f3c[_0x7771('0x18')]['message']);}})[_0x7771('0x19')](function(_0x331d0a){logger['error'](_0x7771('0x16'),_0x281ed3,_0x331d0a);_0x1ea602(_0x331d0a);});});}exports[_0x7771('0x1a')]=function(_0x379c53){var _0x2ca41f=this;return new Promise(function(_0x3ffb18,_0x1e1ac0){return db['SquareReport'][_0x7771('0x1b')](_0x379c53[_0x7771('0x1c')],{'raw':_0x379c53[_0x7771('0x1d')]?_0x379c53[_0x7771('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x7771('0xe')](function(_0x1f760e){logger[_0x7771('0xf')](_0x7771('0x1a'),_0x379c53);logger[_0x7771('0x11')](_0x7771('0x1a'),_0x379c53,JSON[_0x7771('0x13')](_0x1f760e));_0x3ffb18(_0x1f760e);})[_0x7771('0x19')](function(_0x20c8ad){logger[_0x7771('0x14')]('CreateSquareReport',_0x20c8ad[_0x7771('0x17')],_0x379c53);_0x1e1ac0(_0x2ca41f[_0x7771('0x14')](0x1f4,_0x20c8ad[_0x7771('0x17')]));});});};exports[_0x7771('0x1e')]=function(_0x4b619c){var _0xd61256=this;return new Promise(function(_0x3c974b,_0xff1332){return db['SquareReport'][_0x7771('0x1f')](_0x4b619c[_0x7771('0x1c')],{'raw':_0x4b619c[_0x7771('0x1d')]?_0x4b619c[_0x7771('0x1d')][_0x7771('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b619c['options']?_0x4b619c[_0x7771('0x1d')][_0x7771('0x21')]||null:null,'attributes':_0x4b619c['options']?_0x4b619c['options'][_0x7771('0x22')]||null:null,'limit':_0x4b619c[_0x7771('0x1d')]?_0x4b619c['options'][_0x7771('0x23')]||null:null})[_0x7771('0xe')](function(_0x3187aa){logger['info'](_0x7771('0x1e'),_0x4b619c);logger[_0x7771('0x11')](_0x7771('0x1e'),_0x4b619c,JSON[_0x7771('0x13')](_0x3187aa));_0x3c974b(_0x3187aa);})[_0x7771('0x19')](function(_0x32bffc){logger[_0x7771('0x14')]('UpdateSquareReport',_0x32bffc['message'],_0x4b619c);_0xff1332(_0xd61256['error'](0x1f4,_0x32bffc[_0x7771('0x17')]));});});}; \ No newline at end of file +var _0xbb6d=['rpc','../../config/environment','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x18cfed,_0x430563){var _0x25b422=function(_0x44ad28){while(--_0x44ad28){_0x18cfed['push'](_0x18cfed['shift']());}};_0x25b422(++_0x430563);}(_0xbb6d,0x132));var _0xdbb6=function(_0x4650e0,_0x5bc21d){_0x4650e0=_0x4650e0-0x0;var _0x4b9fab=_0xbb6d[_0x4650e0];return _0x4b9fab;};'use strict';var _=require(_0xdbb6('0x0'));var util=require(_0xdbb6('0x1'));var moment=require(_0xdbb6('0x2'));var BPromise=require(_0xdbb6('0x3'));var rs=require(_0xdbb6('0x4'));var fs=require('fs');var Redis=require(_0xdbb6('0x5'));var db=require(_0xdbb6('0x6'))['db'];var utils=require(_0xdbb6('0x7'));var logger=require(_0xdbb6('0x8'))(_0xdbb6('0x9'));var config=require(_0xdbb6('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3345ea,_0x88a6e5,_0x4d5ee3){return new BPromise(function(_0x35d4fa,_0x315bc5){return client[_0xdbb6('0xb')](_0x3345ea,_0x4d5ee3)[_0xdbb6('0xc')](function(_0x39ffba){logger[_0xdbb6('0xd')](_0xdbb6('0xe'),_0x88a6e5,_0xdbb6('0xf'));logger[_0xdbb6('0x10')](_0xdbb6('0x11'),_0x88a6e5,'request\x20sent',JSON[_0xdbb6('0x12')](_0x39ffba));if(_0x39ffba[_0xdbb6('0x13')]){if(_0x39ffba[_0xdbb6('0x13')][_0xdbb6('0x14')]===0x1f4){logger[_0xdbb6('0x13')]('SquareReport,\x20%s,\x20%s',_0x88a6e5,_0x39ffba[_0xdbb6('0x13')]['message']);return _0x315bc5(_0x39ffba[_0xdbb6('0x13')][_0xdbb6('0x15')]);}logger[_0xdbb6('0x13')](_0xdbb6('0xe'),_0x88a6e5,_0x39ffba[_0xdbb6('0x13')]['message']);return _0x35d4fa(_0x39ffba[_0xdbb6('0x13')][_0xdbb6('0x15')]);}else{logger[_0xdbb6('0xd')](_0xdbb6('0xe'),_0x88a6e5,_0xdbb6('0xf'));_0x35d4fa(_0x39ffba[_0xdbb6('0x16')]['message']);}})[_0xdbb6('0x17')](function(_0x1b7423){logger[_0xdbb6('0x13')](_0xdbb6('0xe'),_0x88a6e5,_0x1b7423);_0x315bc5(_0x1b7423);});});}exports[_0xdbb6('0x18')]=function(_0xf004c2){var _0x5aacf8=this;return new Promise(function(_0xc6550,_0x3b4d06){return db[_0xdbb6('0x19')][_0xdbb6('0x1a')](_0xf004c2[_0xdbb6('0x1b')],{'raw':_0xf004c2[_0xdbb6('0x1c')]?_0xf004c2[_0xdbb6('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xdbb6('0xc')](function(_0x4b371f){logger[_0xdbb6('0xd')]('CreateSquareReport',_0xf004c2);logger[_0xdbb6('0x10')](_0xdbb6('0x18'),_0xf004c2,JSON[_0xdbb6('0x12')](_0x4b371f));_0xc6550(_0x4b371f);})[_0xdbb6('0x17')](function(_0x9ce78){logger['error']('CreateSquareReport',_0x9ce78[_0xdbb6('0x15')],_0xf004c2);_0x3b4d06(_0x5aacf8[_0xdbb6('0x13')](0x1f4,_0x9ce78[_0xdbb6('0x15')]));});});};exports[_0xdbb6('0x1d')]=function(_0x546a9b){var _0x585abf=this;return new Promise(function(_0x4f937f,_0x371f82){return db['SquareReport'][_0xdbb6('0x1e')](_0x546a9b[_0xdbb6('0x1b')],{'raw':_0x546a9b[_0xdbb6('0x1c')]?_0x546a9b['options'][_0xdbb6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x546a9b[_0xdbb6('0x1c')]?_0x546a9b[_0xdbb6('0x1c')][_0xdbb6('0x20')]||null:null,'attributes':_0x546a9b[_0xdbb6('0x1c')]?_0x546a9b[_0xdbb6('0x1c')][_0xdbb6('0x21')]||null:null,'limit':_0x546a9b[_0xdbb6('0x1c')]?_0x546a9b[_0xdbb6('0x1c')][_0xdbb6('0x22')]||null:null})[_0xdbb6('0xc')](function(_0x5327bd){logger[_0xdbb6('0xd')]('UpdateSquareReport',_0x546a9b);logger[_0xdbb6('0x10')](_0xdbb6('0x1d'),_0x546a9b,JSON[_0xdbb6('0x12')](_0x5327bd));_0x4f937f(_0x5327bd);})[_0xdbb6('0x17')](function(_0x309e96){logger[_0xdbb6('0x13')]('UpdateSquareReport',_0x309e96[_0xdbb6('0x15')],_0x546a9b);_0x371f82(_0x585abf['error'](0x1f4,_0x309e96[_0xdbb6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f3c4458..a4c508b 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 _0xa591=['describe','show','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xa591,0x77));var _0x1a59=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa591[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x1a59('0x0'));var util=require(_0x1a59('0x1'));var path=require(_0x1a59('0x2'));var timeout=require(_0x1a59('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1a59('0x4'));var auth=require(_0x1a59('0x5'));var interaction=require(_0x1a59('0x6'));var config=require(_0x1a59('0x7'));var controller=require(_0x1a59('0x8'));router[_0x1a59('0x9')]('/',auth[_0x1a59('0xa')](),controller[_0x1a59('0xb')]);router[_0x1a59('0x9')](_0x1a59('0xc'),auth[_0x1a59('0xa')](),controller[_0x1a59('0xd')]);router[_0x1a59('0x9')]('/:id',auth[_0x1a59('0xa')](),controller[_0x1a59('0xe')]);router[_0x1a59('0xf')]('/',auth[_0x1a59('0xa')](),controller[_0x1a59('0x10')]);router[_0x1a59('0x11')]('/:id',auth[_0x1a59('0xa')](),controller[_0x1a59('0x12')]);router[_0x1a59('0x13')](_0x1a59('0x14'),auth[_0x1a59('0xa')](),controller['destroy']);module[_0x1a59('0x15')]=router; \ No newline at end of file +var _0xfb59=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x3499a6,_0xd09ace){var _0x5b2674=function(_0x6b39af){while(--_0x6b39af){_0x3499a6['push'](_0x3499a6['shift']());}};_0x5b2674(++_0xd09ace);}(_0xfb59,0x176));var _0x9fb5=function(_0x517431,_0x21efaf){_0x517431=_0x517431-0x0;var _0x13a675=_0xfb59[_0x517431];return _0x13a675;};'use strict';var multer=require('multer');var util=require(_0x9fb5('0x0'));var path=require(_0x9fb5('0x1'));var timeout=require(_0x9fb5('0x2'));var express=require(_0x9fb5('0x3'));var router=express[_0x9fb5('0x4')]();var fs_extra=require(_0x9fb5('0x5'));var auth=require(_0x9fb5('0x6'));var interaction=require(_0x9fb5('0x7'));var config=require('../../config/environment');var controller=require(_0x9fb5('0x8'));router[_0x9fb5('0x9')]('/',auth[_0x9fb5('0xa')](),controller[_0x9fb5('0xb')]);router[_0x9fb5('0x9')](_0x9fb5('0xc'),auth[_0x9fb5('0xa')](),controller[_0x9fb5('0xd')]);router[_0x9fb5('0x9')](_0x9fb5('0xe'),auth[_0x9fb5('0xa')](),controller[_0x9fb5('0xf')]);router[_0x9fb5('0x10')]('/',auth[_0x9fb5('0xa')](),controller[_0x9fb5('0x11')]);router[_0x9fb5('0x12')]('/:id',auth[_0x9fb5('0xa')](),controller['update']);router[_0x9fb5('0x13')]('/:id',auth[_0x9fb5('0xa')](),controller[_0x9fb5('0x14')]);module[_0x9fb5('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 45277eb..0f9894a 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 _0xefc6=['sequelize','exports','STRING','TEXT'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xefc6,0x148));var _0x6efc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xefc6[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x6efc('0x0'));module[_0x6efc('0x1')]={'uniqueid':{'type':Sequelize[_0x6efc('0x2')]},'node':{'type':Sequelize[_0x6efc('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x6efc('0x3')]},'project_name':{'type':Sequelize[_0x6efc('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1746=['sequelize','exports','STRING','TEXT'];(function(_0x4dfa14,_0x3e6fa1){var _0x367eca=function(_0x5cce45){while(--_0x5cce45){_0x4dfa14['push'](_0x4dfa14['shift']());}};_0x367eca(++_0x3e6fa1);}(_0x1746,0x1a0));var _0x6174=function(_0x31f15d,_0x5eebc7){_0x31f15d=_0x31f15d-0x0;var _0x1ad428=_0x1746[_0x31f15d];return _0x1ad428;};'use strict';var Sequelize=require(_0x6174('0x0'));module[_0x6174('0x1')]={'uniqueid':{'type':Sequelize[_0x6174('0x2')]},'node':{'type':Sequelize[_0x6174('0x2')]},'application':{'type':Sequelize[_0x6174('0x2')]},'data':{'type':Sequelize[_0x6174('0x3')]},'project_name':{'type':Sequelize[_0x6174('0x2')]},'callerid':{'type':Sequelize[_0x6174('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d2790b2..391cf37 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 _0x15e7=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf'];(function(_0x4d5353,_0x11fe19){var _0x3ae1db=function(_0x52e262){while(--_0x52e262){_0x4d5353['push'](_0x4d5353['shift']());}};_0x3ae1db(++_0x11fe19);}(_0x15e7,0x1ef));var _0x715e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x15e7[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x715e('0x0'));var rimraf=require(_0x715e('0x1'));var zipdir=require(_0x715e('0x2'));var jsonpatch=require(_0x715e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x715e('0x4'));var Mustache=require(_0x715e('0x5'));var util=require(_0x715e('0x6'));var path=require(_0x715e('0x7'));var sox=require(_0x715e('0x8'));var csv=require(_0x715e('0x9'));var ejs=require(_0x715e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x715e('0xb'));var squel=require(_0x715e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x715e('0xd'));var toCsv=require(_0x715e('0x9'));var querystring=require(_0x715e('0xe'));var Papa=require('papaparse');var Redis=require(_0x715e('0xf'));var authService=require(_0x715e('0x10'));var qs=require(_0x715e('0x11'));var as=require(_0x715e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x715e('0x13'))(_0x715e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x715e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f17f1,_0x483502){_0x483502=_0x483502||0xcc;return function(_0x44844d){if(_0x44844d){return _0x2f17f1[_0x715e('0x16')](_0x483502);}return _0x2f17f1[_0x715e('0x17')](_0x483502)[_0x715e('0x18')]();};}function respondWithResult(_0x5ef906,_0x5942d3){_0x5942d3=_0x5942d3||0xc8;return function(_0x3ebd3e){if(_0x3ebd3e){return _0x5ef906[_0x715e('0x17')](_0x5942d3)[_0x715e('0x19')](_0x3ebd3e);}};}function respondWithFilteredResult(_0x2ba3e4,_0x22dda9){return function(_0x3f400a){if(_0x3f400a){var _0x4393f7=typeof _0x22dda9['offset']==='undefined'&&typeof _0x22dda9[_0x715e('0x1a')]==='undefined';var _0x2a170b=_0x3f400a[_0x715e('0x1b')];var _0x4db6ac=_0x4393f7?0x0:_0x22dda9['offset'];var _0x66e709=_0x4393f7?_0x3f400a[_0x715e('0x1b')]:_0x22dda9[_0x715e('0x1c')]+_0x22dda9[_0x715e('0x1a')];var _0x599f49;if(_0x66e709>=_0x2a170b){_0x66e709=_0x2a170b;_0x599f49=0xc8;}else{_0x599f49=0xce;}_0x2ba3e4[_0x715e('0x17')](_0x599f49);return _0x2ba3e4[_0x715e('0x1d')](_0x715e('0x1e'),_0x4db6ac+'-'+_0x66e709+'/'+_0x2a170b)['json'](_0x3f400a);}return null;};}function patchUpdates(_0x181312){return function(_0x524202){try{jsonpatch['apply'](_0x524202,_0x181312,!![]);}catch(_0x27e582){return BPromise[_0x715e('0x1f')](_0x27e582);}return _0x524202['save']();};}function saveUpdates(_0x56d018,_0x2a6376){return function(_0x35654f){if(_0x35654f){return _0x35654f[_0x715e('0x20')](_0x56d018)[_0x715e('0x21')](function(_0x84ba5c){return _0x84ba5c;});}return null;};}function removeEntity(_0x578769,_0x2560f9){return function(_0x105bf7){if(_0x105bf7){return _0x105bf7[_0x715e('0x22')]()['then'](function(){_0x578769[_0x715e('0x17')](0xcc)[_0x715e('0x18')]();});}};}function handleEntityNotFound(_0x380558,_0x4fcaf3){return function(_0x255e05){if(!_0x255e05){_0x380558['sendStatus'](0x194);}return _0x255e05;};}function handleError(_0x6eb753,_0x525eac){_0x525eac=_0x525eac||0x1f4;return function(_0x7687fd){logger[_0x715e('0x23')](_0x7687fd[_0x715e('0x24')]);if(_0x7687fd[_0x715e('0x25')]){delete _0x7687fd['name'];}_0x6eb753['status'](_0x525eac)[_0x715e('0x26')](_0x7687fd);};}exports[_0x715e('0x27')]=function(_0x56d45e,_0x488f49){var _0x49ff3d={},_0x132746={},_0x44a9ef={'count':0x0,'rows':[]};var _0x1f3ec2=_[_0x715e('0x28')](db[_0x715e('0x29')][_0x715e('0x2a')],function(_0x235306){return{'name':_0x235306[_0x715e('0x2b')],'type':_0x235306['type'][_0x715e('0x2c')]};});_0x132746['model']=_[_0x715e('0x28')](_0x1f3ec2,'name');_0x132746[_0x715e('0x2d')]=_[_0x715e('0x2e')](_0x56d45e[_0x715e('0x2d')]);_0x132746['filters']=_['intersection'](_0x132746['model'],_0x132746['query']);_0x49ff3d['attributes']=_[_0x715e('0x2f')](_0x132746[_0x715e('0x30')],qs[_0x715e('0x31')](_0x56d45e[_0x715e('0x2d')][_0x715e('0x31')]));_0x49ff3d[_0x715e('0x32')]=_0x49ff3d['attributes'][_0x715e('0x33')]?_0x49ff3d[_0x715e('0x32')]:_0x132746[_0x715e('0x30')];if(!_0x56d45e[_0x715e('0x2d')][_0x715e('0x34')](_0x715e('0x35'))){_0x49ff3d['limit']=qs['limit'](_0x56d45e[_0x715e('0x2d')][_0x715e('0x1a')]);_0x49ff3d['offset']=qs[_0x715e('0x1c')](_0x56d45e[_0x715e('0x2d')]['offset']);}_0x49ff3d['order']=qs[_0x715e('0x36')](_0x56d45e[_0x715e('0x2d')][_0x715e('0x36')]);_0x49ff3d[_0x715e('0x37')]=qs[_0x715e('0x38')](_['pick'](_0x56d45e['query'],_0x132746[_0x715e('0x38')]),_0x1f3ec2);if(_0x56d45e['query'][_0x715e('0x39')]){_0x49ff3d[_0x715e('0x37')]=_[_0x715e('0x3a')](_0x49ff3d[_0x715e('0x37')],{'$or':_[_0x715e('0x28')](_0x1f3ec2,function(_0x5e4131){if(_0x5e4131['type']!==_0x715e('0x3b')){var _0x1c80f8={};_0x1c80f8[_0x5e4131[_0x715e('0x25')]]={'$like':'%'+_0x56d45e[_0x715e('0x2d')][_0x715e('0x39')]+'%'};return _0x1c80f8;}})});}_0x49ff3d=_[_0x715e('0x3a')]({},_0x49ff3d,_0x56d45e[_0x715e('0x3c')]);var _0x36f25d={'where':_0x49ff3d[_0x715e('0x37')]};return db[_0x715e('0x29')][_0x715e('0x1b')](_0x36f25d)[_0x715e('0x21')](function(_0xca4df6){_0x44a9ef[_0x715e('0x1b')]=_0xca4df6;if(_0x56d45e['query']['includeAll']){_0x49ff3d[_0x715e('0x3d')]=[{'all':!![]}];}return db[_0x715e('0x29')][_0x715e('0x3e')](_0x49ff3d);})['then'](function(_0x285754){_0x44a9ef[_0x715e('0x3f')]=_0x285754;return _0x44a9ef;})[_0x715e('0x21')](respondWithFilteredResult(_0x488f49,_0x49ff3d))[_0x715e('0x40')](handleError(_0x488f49,null));};exports[_0x715e('0x41')]=function(_0x3bad24,_0x34804c){var _0x552b46={'raw':!![],'where':{'id':_0x3bad24[_0x715e('0x42')]['id']}},_0x23092f={};_0x23092f[_0x715e('0x30')]=_[_0x715e('0x2e')](db['SquareDetailsReport'][_0x715e('0x2a')]);_0x23092f['query']=_['keys'](_0x3bad24[_0x715e('0x2d')]);_0x23092f['filters']=_[_0x715e('0x2f')](_0x23092f[_0x715e('0x30')],_0x23092f['query']);_0x552b46[_0x715e('0x32')]=_[_0x715e('0x2f')](_0x23092f['model'],qs['fields'](_0x3bad24[_0x715e('0x2d')][_0x715e('0x31')]));_0x552b46[_0x715e('0x32')]=_0x552b46[_0x715e('0x32')][_0x715e('0x33')]?_0x552b46[_0x715e('0x32')]:_0x23092f[_0x715e('0x30')];if(_0x3bad24[_0x715e('0x2d')][_0x715e('0x43')]){_0x552b46[_0x715e('0x3d')]=[{'all':!![]}];}_0x552b46=_['merge']({},_0x552b46,_0x3bad24[_0x715e('0x3c')]);return db[_0x715e('0x29')][_0x715e('0x44')](_0x552b46)[_0x715e('0x21')](handleEntityNotFound(_0x34804c,null))[_0x715e('0x21')](respondWithResult(_0x34804c,null))[_0x715e('0x40')](handleError(_0x34804c,null));};exports[_0x715e('0x45')]=function(_0x3889e7,_0x51e97){return db[_0x715e('0x29')][_0x715e('0x45')](_0x3889e7[_0x715e('0x46')],{})[_0x715e('0x21')](respondWithResult(_0x51e97,0xc9))[_0x715e('0x40')](handleError(_0x51e97,null));};exports[_0x715e('0x20')]=function(_0x387bf8,_0x4f1d22){if(_0x387bf8[_0x715e('0x46')]['id']){delete _0x387bf8[_0x715e('0x46')]['id'];}return db[_0x715e('0x29')]['find']({'where':{'id':_0x387bf8[_0x715e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f1d22,null))['then'](saveUpdates(_0x387bf8['body'],null))[_0x715e('0x21')](respondWithResult(_0x4f1d22,null))[_0x715e('0x40')](handleError(_0x4f1d22,null));};exports[_0x715e('0x22')]=function(_0x41803b,_0x15a6f6){return db[_0x715e('0x29')][_0x715e('0x44')]({'where':{'id':_0x41803b[_0x715e('0x42')]['id']}})[_0x715e('0x21')](handleEntityNotFound(_0x15a6f6,null))[_0x715e('0x21')](removeEntity(_0x15a6f6,null))[_0x715e('0x40')](handleError(_0x15a6f6,null));};exports['describe']=function(_0x48ef6f,_0x59dcf7){return db[_0x715e('0x29')]['describe']()[_0x715e('0x21')](respondWithResult(_0x59dcf7,null))['catch'](handleError(_0x59dcf7,null));}; \ No newline at end of file +var _0xe334=['query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','SquareDetailsReport','map'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xe334,0x199));var _0x4e33=function(_0x46595c,_0x48272f){_0x46595c=_0x46595c-0x0;var _0x1e8fab=_0xe334[_0x46595c];return _0x1e8fab;};'use strict';var emlformat=require(_0x4e33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e33('0x1'));var jsonpatch=require(_0x4e33('0x2'));var rp=require(_0x4e33('0x3'));var moment=require(_0x4e33('0x4'));var BPromise=require(_0x4e33('0x5'));var Mustache=require(_0x4e33('0x6'));var util=require(_0x4e33('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4e33('0x8'));var ejs=require(_0x4e33('0x9'));var fs=require('fs');var fs_extra=require(_0x4e33('0xa'));var _=require('lodash');var squel=require(_0x4e33('0xb'));var crypto=require(_0x4e33('0xc'));var jsforce=require(_0x4e33('0xd'));var deskjs=require(_0x4e33('0xe'));var toCsv=require(_0x4e33('0x8'));var querystring=require(_0x4e33('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e33('0x10'));var authService=require(_0x4e33('0x11'));var qs=require(_0x4e33('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e33('0x13'));var logger=require(_0x4e33('0x14'))(_0x4e33('0x15'));var utils=require('../../config/utils');var config=require(_0x4e33('0x16'));var licenseUtil=require(_0x4e33('0x17'));var db=require(_0x4e33('0x18'))['db'];function respondWithStatusCode(_0x537ea6,_0x8cc3b9){_0x8cc3b9=_0x8cc3b9||0xcc;return function(_0x3d0541){if(_0x3d0541){return _0x537ea6[_0x4e33('0x19')](_0x8cc3b9);}return _0x537ea6[_0x4e33('0x1a')](_0x8cc3b9)['end']();};}function respondWithResult(_0x129658,_0x323690){_0x323690=_0x323690||0xc8;return function(_0x459a00){if(_0x459a00){return _0x129658['status'](_0x323690)['json'](_0x459a00);}};}function respondWithFilteredResult(_0x49e874,_0x1103e9){return function(_0x10401e){if(_0x10401e){var _0x40749b=typeof _0x1103e9['offset']===_0x4e33('0x1b')&&typeof _0x1103e9[_0x4e33('0x1c')]===_0x4e33('0x1b');var _0x596068=_0x10401e[_0x4e33('0x1d')];var _0x4a8d0f=_0x40749b?0x0:_0x1103e9[_0x4e33('0x1e')];var _0x2e0beb=_0x40749b?_0x10401e['count']:_0x1103e9[_0x4e33('0x1e')]+_0x1103e9[_0x4e33('0x1c')];var _0x5d83fa;if(_0x2e0beb>=_0x596068){_0x2e0beb=_0x596068;_0x5d83fa=0xc8;}else{_0x5d83fa=0xce;}_0x49e874[_0x4e33('0x1a')](_0x5d83fa);return _0x49e874[_0x4e33('0x1f')](_0x4e33('0x20'),_0x4a8d0f+'-'+_0x2e0beb+'/'+_0x596068)[_0x4e33('0x21')](_0x10401e);}return null;};}function patchUpdates(_0x524cb0){return function(_0x26eef4){try{jsonpatch[_0x4e33('0x22')](_0x26eef4,_0x524cb0,!![]);}catch(_0x24c220){return BPromise[_0x4e33('0x23')](_0x24c220);}return _0x26eef4[_0x4e33('0x24')]();};}function saveUpdates(_0x3faaea,_0x4eb95f){return function(_0x488736){if(_0x488736){return _0x488736[_0x4e33('0x25')](_0x3faaea)[_0x4e33('0x26')](function(_0x28b069){return _0x28b069;});}return null;};}function removeEntity(_0x4b1bf0,_0x58d893){return function(_0x2ec1e5){if(_0x2ec1e5){return _0x2ec1e5[_0x4e33('0x27')]()['then'](function(){_0x4b1bf0[_0x4e33('0x1a')](0xcc)[_0x4e33('0x28')]();});}};}function handleEntityNotFound(_0x343b22,_0x269a8c){return function(_0x1aef6b){if(!_0x1aef6b){_0x343b22[_0x4e33('0x19')](0x194);}return _0x1aef6b;};}function handleError(_0x1e88a3,_0x115844){_0x115844=_0x115844||0x1f4;return function(_0x2a5530){logger['error'](_0x2a5530[_0x4e33('0x29')]);if(_0x2a5530[_0x4e33('0x2a')]){delete _0x2a5530[_0x4e33('0x2a')];}_0x1e88a3[_0x4e33('0x1a')](_0x115844)[_0x4e33('0x2b')](_0x2a5530);};}exports[_0x4e33('0x2c')]=function(_0x275042,_0x50b845){var _0x18069e={},_0x104b58={},_0x482c4d={'count':0x0,'rows':[]};var _0x2e8691=_['map'](db[_0x4e33('0x2d')]['rawAttributes'],function(_0x497fb2){return{'name':_0x497fb2['fieldName'],'type':_0x497fb2['type']['key']};});_0x104b58['model']=_[_0x4e33('0x2e')](_0x2e8691,_0x4e33('0x2a'));_0x104b58[_0x4e33('0x2f')]=_['keys'](_0x275042[_0x4e33('0x2f')]);_0x104b58[_0x4e33('0x30')]=_['intersection'](_0x104b58[_0x4e33('0x31')],_0x104b58[_0x4e33('0x2f')]);_0x18069e[_0x4e33('0x32')]=_[_0x4e33('0x33')](_0x104b58[_0x4e33('0x31')],qs['fields'](_0x275042[_0x4e33('0x2f')][_0x4e33('0x34')]));_0x18069e[_0x4e33('0x32')]=_0x18069e[_0x4e33('0x32')][_0x4e33('0x35')]?_0x18069e['attributes']:_0x104b58[_0x4e33('0x31')];if(!_0x275042['query']['hasOwnProperty'](_0x4e33('0x36'))){_0x18069e[_0x4e33('0x1c')]=qs['limit'](_0x275042[_0x4e33('0x2f')]['limit']);_0x18069e[_0x4e33('0x1e')]=qs['offset'](_0x275042[_0x4e33('0x2f')]['offset']);}_0x18069e[_0x4e33('0x37')]=qs[_0x4e33('0x38')](_0x275042['query'][_0x4e33('0x38')]);_0x18069e[_0x4e33('0x39')]=qs[_0x4e33('0x30')](_[_0x4e33('0x3a')](_0x275042['query'],_0x104b58[_0x4e33('0x30')]),_0x2e8691);if(_0x275042[_0x4e33('0x2f')]['filter']){_0x18069e[_0x4e33('0x39')]=_[_0x4e33('0x3b')](_0x18069e['where'],{'$or':_['map'](_0x2e8691,function(_0x2259c3){if(_0x2259c3[_0x4e33('0x3c')]!==_0x4e33('0x3d')){var _0x481b9a={};_0x481b9a[_0x2259c3[_0x4e33('0x2a')]]={'$like':'%'+_0x275042[_0x4e33('0x2f')][_0x4e33('0x3e')]+'%'};return _0x481b9a;}})});}_0x18069e=_['merge']({},_0x18069e,_0x275042[_0x4e33('0x3f')]);var _0x229e58={'where':_0x18069e[_0x4e33('0x39')]};return db[_0x4e33('0x2d')]['count'](_0x229e58)['then'](function(_0x4a6852){_0x482c4d[_0x4e33('0x1d')]=_0x4a6852;if(_0x275042[_0x4e33('0x2f')][_0x4e33('0x40')]){_0x18069e[_0x4e33('0x41')]=[{'all':!![]}];}return db[_0x4e33('0x2d')]['findAll'](_0x18069e);})[_0x4e33('0x26')](function(_0x49ba70){_0x482c4d[_0x4e33('0x42')]=_0x49ba70;return _0x482c4d;})[_0x4e33('0x26')](respondWithFilteredResult(_0x50b845,_0x18069e))[_0x4e33('0x43')](handleError(_0x50b845,null));};exports[_0x4e33('0x44')]=function(_0x1063e3,_0xb9d9e2){var _0x2b7515={'raw':!![],'where':{'id':_0x1063e3[_0x4e33('0x45')]['id']}},_0x1933dd={};_0x1933dd[_0x4e33('0x31')]=_['keys'](db[_0x4e33('0x2d')][_0x4e33('0x46')]);_0x1933dd[_0x4e33('0x2f')]=_[_0x4e33('0x47')](_0x1063e3[_0x4e33('0x2f')]);_0x1933dd[_0x4e33('0x30')]=_[_0x4e33('0x33')](_0x1933dd[_0x4e33('0x31')],_0x1933dd['query']);_0x2b7515[_0x4e33('0x32')]=_[_0x4e33('0x33')](_0x1933dd['model'],qs[_0x4e33('0x34')](_0x1063e3[_0x4e33('0x2f')]['fields']));_0x2b7515[_0x4e33('0x32')]=_0x2b7515[_0x4e33('0x32')][_0x4e33('0x35')]?_0x2b7515[_0x4e33('0x32')]:_0x1933dd['model'];if(_0x1063e3['query'][_0x4e33('0x40')]){_0x2b7515[_0x4e33('0x41')]=[{'all':!![]}];}_0x2b7515=_[_0x4e33('0x3b')]({},_0x2b7515,_0x1063e3[_0x4e33('0x3f')]);return db[_0x4e33('0x2d')]['find'](_0x2b7515)['then'](handleEntityNotFound(_0xb9d9e2,null))[_0x4e33('0x26')](respondWithResult(_0xb9d9e2,null))[_0x4e33('0x43')](handleError(_0xb9d9e2,null));};exports[_0x4e33('0x48')]=function(_0x1cc369,_0x5c19fb){return db[_0x4e33('0x2d')][_0x4e33('0x48')](_0x1cc369[_0x4e33('0x49')],{})[_0x4e33('0x26')](respondWithResult(_0x5c19fb,0xc9))[_0x4e33('0x43')](handleError(_0x5c19fb,null));};exports[_0x4e33('0x25')]=function(_0x5ee7a0,_0x266f8b){if(_0x5ee7a0[_0x4e33('0x49')]['id']){delete _0x5ee7a0['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x5ee7a0[_0x4e33('0x45')]['id']}})[_0x4e33('0x26')](handleEntityNotFound(_0x266f8b,null))['then'](saveUpdates(_0x5ee7a0[_0x4e33('0x49')],null))['then'](respondWithResult(_0x266f8b,null))['catch'](handleError(_0x266f8b,null));};exports[_0x4e33('0x27')]=function(_0x5d6a7d,_0x426473){return db[_0x4e33('0x2d')][_0x4e33('0x4a')]({'where':{'id':_0x5d6a7d[_0x4e33('0x45')]['id']}})[_0x4e33('0x26')](handleEntityNotFound(_0x426473,null))['then'](removeEntity(_0x426473,null))[_0x4e33('0x43')](handleError(_0x426473,null));};exports[_0x4e33('0x4b')]=function(_0x254636,_0x5ccda5){return db[_0x4e33('0x2d')][_0x4e33('0x4b')]()[_0x4e33('0x26')](respondWithResult(_0x5ccda5,null))['catch'](handleError(_0x5ccda5,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b31f14c..98be966 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 _0xa937=['moment','request-promise','path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xa937,0x194));var _0x7a93=function(_0x11899d,_0x27ef4b){_0x11899d=_0x11899d-0x0;var _0x559f82=_0xa937[_0x11899d];return _0x559f82;};'use strict';var _=require('lodash');var util=require(_0x7a93('0x0'));var logger=require(_0x7a93('0x1'))(_0x7a93('0x2'));var moment=require(_0x7a93('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a93('0x4'));var fs=require('fs');var path=require(_0x7a93('0x5'));var rimraf=require(_0x7a93('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a93('0x7'));module[_0x7a93('0x8')]=function(_0x5c0026,_0x5148e6){return _0x5c0026['define'](_0x7a93('0x9'),attributes,{'tableName':_0x7a93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcb9=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment','request-promise'];(function(_0xe540c0,_0x2d98e5){var _0x130549=function(_0x4cfd79){while(--_0x4cfd79){_0xe540c0['push'](_0xe540c0['shift']());}};_0x130549(++_0x2d98e5);}(_0xbcb9,0xa4));var _0x9bcb=function(_0x102c20,_0x187eb4){_0x102c20=_0x102c20-0x0;var _0x3ba7d5=_0xbcb9[_0x102c20];return _0x3ba7d5;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var logger=require('../../config/logger')(_0x9bcb('0x2'));var moment=require(_0x9bcb('0x3'));var BPromise=require('bluebird');var rp=require(_0x9bcb('0x4'));var fs=require('fs');var path=require(_0x9bcb('0x5'));var rimraf=require(_0x9bcb('0x6'));var config=require(_0x9bcb('0x7'));var attributes=require(_0x9bcb('0x8'));module[_0x9bcb('0x9')]=function(_0x58ecc8,_0x4b9fd4){return _0x58ecc8[_0x9bcb('0xa')](_0x9bcb('0xb'),attributes,{'tableName':_0x9bcb('0xc'),'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 0bb9edf..cca565d 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 _0x8d05=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch'];(function(_0x561a7f,_0x269589){var _0xe95f99=function(_0x10900a){while(--_0x10900a){_0x561a7f['push'](_0x561a7f['shift']());}};_0xe95f99(++_0x269589);}(_0x8d05,0xe8));var _0x58d0=function(_0x3c6800,_0x3f5362){_0x3c6800=_0x3c6800-0x0;var _0x1d05bd=_0x8d05[_0x3c6800];return _0x1d05bd;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58d0('0x5'));var logger=require(_0x58d0('0x6'))(_0x58d0('0x7'));var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58d0('0x9')][_0x58d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528303,_0x66aef1,_0x4e44e2){return new BPromise(function(_0xe744f4,_0x34ab60){return client[_0x58d0('0xb')](_0x528303,_0x4e44e2)[_0x58d0('0xc')](function(_0x1d070a){logger['info'](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));logger['debug'](_0x58d0('0xf'),_0x66aef1,_0x58d0('0xe'),JSON['stringify'](_0x1d070a));if(_0x1d070a['error']){if(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0x34ab60(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0xe744f4(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}else{logger[_0x58d0('0x13')](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));_0xe744f4(_0x1d070a[_0x58d0('0x14')][_0x58d0('0x12')]);}})['catch'](function(_0x10874e){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x10874e);_0x34ab60(_0x10874e);});});}exports[_0x58d0('0x15')]=function(_0xb8dd5f){var _0x2c7db6=this;return new Promise(function(_0x23dcfb,_0x41d221){return db[_0x58d0('0x16')][_0x58d0('0x17')](_0xb8dd5f[_0x58d0('0x18')],{'raw':_0xb8dd5f[_0x58d0('0x19')]?_0xb8dd5f[_0x58d0('0x19')][_0x58d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3072f9){logger[_0x58d0('0x13')](_0x58d0('0x15'),_0xb8dd5f);logger['debug'](_0x58d0('0x15'),_0xb8dd5f,JSON[_0x58d0('0x1b')](_0x3072f9));_0x23dcfb(_0x3072f9);})[_0x58d0('0x1c')](function(_0x575b34){logger[_0x58d0('0x10')]('CreateSquareDetailsReport',_0x575b34['message'],_0xb8dd5f);_0x41d221(_0x2c7db6[_0x58d0('0x10')](0x1f4,_0x575b34[_0x58d0('0x12')]));});});}; \ No newline at end of file +var _0x8603=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8603,0x190));var _0x3860=function(_0x318fc2,_0x4c5017){_0x318fc2=_0x318fc2-0x0;var _0x5295c0=_0x8603[_0x318fc2];return _0x5295c0;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5bba314..afce5c1 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 _0x278d=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x4e6312,_0x47e29c){var _0x2b5c20=function(_0x303e14){while(--_0x303e14){_0x4e6312['push'](_0x4e6312['shift']());}};_0x2b5c20(++_0x47e29c);}(_0x278d,0xac));var _0xd278=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0x278d[_0x179b74];return _0x268f76;};'use strict';var express=require(_0xd278('0x0'));var router=express[_0xd278('0x1')]();var auth=require(_0xd278('0x2'));var controller=require(_0xd278('0x3'));router[_0xd278('0x4')]('/',auth[_0xd278('0x5')](),controller[_0xd278('0x6')]);router[_0xd278('0x4')](_0xd278('0x7'),auth[_0xd278('0x5')](),controller[_0xd278('0x8')]);module[_0xd278('0x9')]=router; \ No newline at end of file +var _0xfdad=['index','killProcess','exports','express','Router','./system.controller','get','isAuthenticated'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0xfdad,0x14b));var _0xdfda=function(_0x760d71,_0x231004){_0x760d71=_0x760d71-0x0;var _0x8dfc7b=_0xfdad[_0x760d71];return _0x8dfc7b;};'use strict';var express=require(_0xdfda('0x0'));var router=express[_0xdfda('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xdfda('0x2'));router[_0xdfda('0x3')]('/',auth[_0xdfda('0x4')](),controller[_0xdfda('0x5')]);router[_0xdfda('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xdfda('0x6')]);module[_0xdfda('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bbea692..00b321b 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 _0xb959=['api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger'];(function(_0x58c654,_0x56f774){var _0x1b1164=function(_0x4ed7db){while(--_0x4ed7db){_0x58c654['push'](_0x58c654['shift']());}};_0x1b1164(++_0x56f774);}(_0xb959,0x10a));var _0x9b95=function(_0x824bce,_0x4c06fb){_0x824bce=_0x824bce-0x0;var _0x5428d4=_0xb959[_0x824bce];return _0x5428d4;};'use strict';var info=require(_0x9b95('0x0'));var exec=require(_0x9b95('0x1'))[_0x9b95('0x2')];var logger=require(_0x9b95('0x3'))(_0x9b95('0x4'));var util=require(_0x9b95('0x5'));var BPromise=require('bluebird');var _=require(_0x9b95('0x6'));function handleError(_0x1ee7fe,_0x5d5342,_0x398657){_0x5d5342=_0x5d5342||0x1f4;return function(_0x3f0a8a){logger[_0x9b95('0x7')](_0x9b95('0x8'),_0x398657,_0x5d5342,util[_0x9b95('0x9')](_0x3f0a8a,{'showHidden':![],'depth':null}));delete _0x3f0a8a['name'];_0x1ee7fe[_0x9b95('0xa')](_0x5d5342)[_0x9b95('0xb')](_0x3f0a8a);};}exports[_0x9b95('0xc')]=function(_0x583a9b,_0x31ec29){return info[_0x9b95('0xd')]()['then'](function(_0x595927){return _0x31ec29['status'](0xc8)['json'](_0x595927);})['catch'](function(_0x4ab9f6){return _0x31ec29[_0x9b95('0xa')](0x1f4)[_0x9b95('0xe')](_0x4ab9f6);});};exports['killProcess']=function(_0x2525cb,_0x446d7c){var _0x50d3b8=['components/import/cm'];return new BPromise(function(_0x4eb23e,_0x48f829){return exec(util[_0x9b95('0xf')](_0x9b95('0x10'),_0x2525cb['params'][_0x9b95('0x11')]),function(_0x45d687,_0x34fc64,_0x272a8b){if(_0x45d687){return _0x48f829(_0x45d687);}return _0x4eb23e(_0x34fc64);});})[_0x9b95('0x12')](function(_0x9b4703){var _0x1b543c=![];var _0x5b5d21=_0x9b4703[_0x9b95('0x13')](/\n/);for(var _0x5ae634=0x0,_0x705842=_0x50d3b8[_0x9b95('0x14')];_0x5ae634<_0x705842,_0x1b543c===![];_0x5ae634+=0x1){if(_0x9b4703['indexOf'](_0x50d3b8[_0x5ae634])>=0x0){_0x1b543c=!![];}}if(!_0x1b543c){throw new Error(util['format'](_0x9b95('0x15'),_0x2525cb['params'][_0x9b95('0x11')]));}process['kill'](_0x2525cb[_0x9b95('0x16')]['pid'],_0x9b95('0x17'));return _0x446d7c[_0x9b95('0xa')](0xc8)[_0x9b95('0xe')]({'message':util[_0x9b95('0xf')](_0x9b95('0x18'),_0x2525cb['params'][_0x9b95('0x11')])});})[_0x9b95('0x19')](handleError(_0x446d7c,null,_0x9b95('0x1a')));}; \ No newline at end of file +var _0x90e8=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','api','util','bluebird','error','inspect','name','send','index','getAllData','status','json','catch','format','params','pid','then','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill'];(function(_0x1db834,_0x5e564d){var _0x436f37=function(_0x47194a){while(--_0x47194a){_0x1db834['push'](_0x1db834['shift']());}};_0x436f37(++_0x5e564d);}(_0x90e8,0x1b7));var _0x890e=function(_0x133502,_0x302ac0){_0x133502=_0x133502-0x0;var _0x18b0ff=_0x90e8[_0x133502];return _0x18b0ff;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x890e('0x0')];var logger=require('../../config/logger')(_0x890e('0x1'));var util=require(_0x890e('0x2'));var BPromise=require(_0x890e('0x3'));var _=require('lodash');function handleError(_0x866bef,_0x59f730,_0x254eef){_0x59f730=_0x59f730||0x1f4;return function(_0x2079c8){logger[_0x890e('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x254eef,_0x59f730,util[_0x890e('0x5')](_0x2079c8,{'showHidden':![],'depth':null}));delete _0x2079c8[_0x890e('0x6')];_0x866bef['status'](_0x59f730)[_0x890e('0x7')](_0x2079c8);};}exports[_0x890e('0x8')]=function(_0xb6226,_0x30adf7){return info[_0x890e('0x9')]()['then'](function(_0x4f123a){return _0x30adf7[_0x890e('0xa')](0xc8)[_0x890e('0xb')](_0x4f123a);})[_0x890e('0xc')](function(_0x5ece5a){return _0x30adf7[_0x890e('0xa')](0x1f4)[_0x890e('0xb')](_0x5ece5a);});};exports['killProcess']=function(_0x59e510,_0x239b40){var _0x5427f3=['components/import/cm'];return new BPromise(function(_0x26a9b4,_0x52c349){return exec(util[_0x890e('0xd')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x59e510[_0x890e('0xe')][_0x890e('0xf')]),function(_0x7a0a01,_0x106ab1,_0x528188){if(_0x7a0a01){return _0x52c349(_0x7a0a01);}return _0x26a9b4(_0x106ab1);});})[_0x890e('0x10')](function(_0x2ceef0){var _0x290918=![];var _0x22ba46=_0x2ceef0['split'](/\n/);for(var _0x399f33=0x0,_0x2f2329=_0x5427f3[_0x890e('0x11')];_0x399f33<_0x2f2329,_0x290918===![];_0x399f33+=0x1){if(_0x2ceef0[_0x890e('0x12')](_0x5427f3[_0x399f33])>=0x0){_0x290918=!![];}}if(!_0x290918){throw new Error(util[_0x890e('0xd')](_0x890e('0x13'),_0x59e510['params']['pid']));}process[_0x890e('0x14')](_0x59e510['params'][_0x890e('0xf')],_0x890e('0x15'));return _0x239b40[_0x890e('0xa')](0xc8)[_0x890e('0xb')]({'message':util[_0x890e('0xd')](_0x890e('0x16'),_0x59e510[_0x890e('0xe')][_0x890e('0xf')])});})[_0x890e('0xc')](handleError(_0x239b40,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d990c66..6ebe1f1 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 _0x5087=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x92ba64,_0x4cefcb){var _0x176c7c=function(_0x55aed0){while(--_0x55aed0){_0x92ba64['push'](_0x92ba64['shift']());}};_0x176c7c(++_0x4cefcb);}(_0x5087,0x1da));var _0x7508=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x5087[_0x4e8286];return _0x44a440;};'use strict';var multer=require('multer');var util=require(_0x7508('0x0'));var path=require('path');var timeout=require(_0x7508('0x1'));var express=require(_0x7508('0x2'));var router=express[_0x7508('0x3')]();var fs_extra=require(_0x7508('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7508('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x7508('0x6')]('/',auth[_0x7508('0x7')](),controller[_0x7508('0x8')]);router[_0x7508('0x6')](_0x7508('0x9'),auth['isAuthenticated'](),controller[_0x7508('0xa')]);router['post']('/',auth[_0x7508('0x7')](),controller[_0x7508('0xb')]);router[_0x7508('0xc')](_0x7508('0x9'),auth[_0x7508('0x7')](),controller[_0x7508('0xd')]);router['delete'](_0x7508('0x9'),auth[_0x7508('0x7')](),controller[_0x7508('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbacd=['../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','update','/:id','destroy','exports','multer','util','path','express'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xbacd,0x194));var _0xdbac=function(_0x5200e3,_0x5386d8){_0x5200e3=_0x5200e3-0x0;var _0x1590da=_0xbacd[_0x5200e3];return _0x1590da;};'use strict';var multer=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var path=require(_0xdbac('0x2'));var timeout=require('connect-timeout');var express=require(_0xdbac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbac('0x4'));var config=require(_0xdbac('0x5'));var controller=require(_0xdbac('0x6'));router[_0xdbac('0x7')]('/',auth[_0xdbac('0x8')](),controller[_0xdbac('0x9')]);router[_0xdbac('0x7')]('/:id',auth[_0xdbac('0x8')](),controller[_0xdbac('0xa')]);router[_0xdbac('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbac('0xc')]);router['put']('/:id',auth[_0xdbac('0x8')](),controller[_0xdbac('0xd')]);router['delete'](_0xdbac('0xe'),auth['isAuthenticated'](),controller[_0xdbac('0xf')]);module[_0xdbac('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d9818d0..c8c9241 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 _0x9bc3=['exports','STRING','#0091EA','sequelize'];(function(_0x5d1d00,_0x3861d3){var _0x368b73=function(_0x1b78dd){while(--_0x1b78dd){_0x5d1d00['push'](_0x5d1d00['shift']());}};_0x368b73(++_0x3861d3);}(_0x9bc3,0x137));var _0x39bc=function(_0x386c0b,_0x25a98b){_0x386c0b=_0x386c0b-0x0;var _0x1ebc25=_0x9bc3[_0x386c0b];return _0x1ebc25;};'use strict';var Sequelize=require(_0x39bc('0x0'));module[_0x39bc('0x1')]={'name':{'type':Sequelize[_0x39bc('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x39bc('0x2')],'defaultValue':_0x39bc('0x3')},'description':{'type':Sequelize[_0x39bc('0x2')]}}; \ No newline at end of file +var _0xca1d=['#0091EA','sequelize','exports','STRING','name'];(function(_0x356880,_0x45bf61){var _0x27b743=function(_0x2acb65){while(--_0x2acb65){_0x356880['push'](_0x356880['shift']());}};_0x27b743(++_0x45bf61);}(_0xca1d,0x1e6));var _0xdca1=function(_0x2d538e,_0x3df38b){_0x2d538e=_0x2d538e-0x0;var _0x4a4712=_0xca1d[_0x2d538e];return _0x4a4712;};'use strict';var Sequelize=require(_0xdca1('0x0'));module[_0xdca1('0x1')]={'name':{'type':Sequelize[_0xdca1('0x2')],'unique':_0xdca1('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xdca1('0x2')],'defaultValue':_0xdca1('0x4')},'description':{'type':Sequelize[_0xdca1('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a077915..bc763ef 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 _0x24cd=['undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','Tag','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x267fa4,_0x3d27b){var _0x398e4b=function(_0x24d94d){while(--_0x24d94d){_0x267fa4['push'](_0x267fa4['shift']());}};_0x398e4b(++_0x3d27b);}(_0x24cd,0x83));var _0xd24c=function(_0x136b55,_0x253950){_0x136b55=_0x136b55-0x0;var _0x3029cb=_0x24cd[_0x136b55];return _0x3029cb;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd24c('0x2'));var rp=require('request-promise');var moment=require(_0xd24c('0x3'));var BPromise=require(_0xd24c('0x4'));var Mustache=require(_0xd24c('0x5'));var util=require('util');var path=require(_0xd24c('0x6'));var sox=require(_0xd24c('0x7'));var csv=require('to-csv');var ejs=require(_0xd24c('0x8'));var fs=require('fs');var fs_extra=require(_0xd24c('0x9'));var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0x10'));var authService=require(_0xd24c('0x11'));var qs=require(_0xd24c('0x12'));var as=require(_0xd24c('0x13'));var hardwareService=require(_0xd24c('0x14'));var logger=require(_0xd24c('0x15'))(_0xd24c('0x16'));var utils=require(_0xd24c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x18'));var db=require(_0xd24c('0x19'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x1a')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1b')](_0x3296ea)[_0xd24c('0x1c')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1d')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=typeof _0x528489[_0xd24c('0x1e')]===_0xd24c('0x1f')&&typeof _0x528489['limit']==='undefined';var _0xc87bb7=_0x34aa92[_0xd24c('0x20')];var _0x170d59=_0x3aa193?0x0:_0x528489['offset'];var _0x9f2d2d=_0x3aa193?_0x34aa92[_0xd24c('0x20')]:_0x528489[_0xd24c('0x1e')]+_0x528489[_0xd24c('0x21')];var _0x478a0f;if(_0x9f2d2d>=_0xc87bb7){_0x9f2d2d=_0xc87bb7;_0x478a0f=0xc8;}else{_0x478a0f=0xce;}_0xe096c[_0xd24c('0x1b')](_0x478a0f);return _0xe096c['set'](_0xd24c('0x22'),_0x170d59+'-'+_0x9f2d2d+'/'+_0xc87bb7)[_0xd24c('0x1d')](_0x34aa92);}return null;};}function patchUpdates(_0x1b3a2f){return function(_0x38c380){try{jsonpatch[_0xd24c('0x23')](_0x38c380,_0x1b3a2f,!![]);}catch(_0x4964e5){return BPromise[_0xd24c('0x24')](_0x4964e5);}return _0x38c380[_0xd24c('0x25')]();};}function saveUpdates(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')](_0x17375b)[_0xd24c('0x27')](function(_0x2549d0){return _0x2549d0;});}return null;};}function removeEntity(_0x5c862f,_0x44471f){return function(_0x2c3328){if(_0x2c3328){return _0x2c3328[_0xd24c('0x28')]()['then'](function(){var _0x4539e7=_0x2c3328[_0xd24c('0x29')]({'plain':!![]});var _0x848e0e=_0xd24c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x848e0e,'resourceId':_0x4539e7['id']}})[_0xd24c('0x27')](function(){return _0x2c3328;});})['then'](function(){_0x5c862f[_0xd24c('0x1b')](0xcc)[_0xd24c('0x1c')]();});}};}function handleEntityNotFound(_0x325fcc,_0x4c0d99){return function(_0x4cb1b3){if(!_0x4cb1b3){_0x325fcc[_0xd24c('0x1a')](0x194);}return _0x4cb1b3;};}function handleError(_0x14d44a,_0x1a18b7){_0x1a18b7=_0x1a18b7||0x1f4;return function(_0x160f03){logger[_0xd24c('0x2b')](_0x160f03[_0xd24c('0x2c')]);if(_0x160f03[_0xd24c('0x2d')]){delete _0x160f03[_0xd24c('0x2d')];}_0x14d44a[_0xd24c('0x1b')](_0x1a18b7)[_0xd24c('0x2e')](_0x160f03);};}exports[_0xd24c('0x2f')]=function(_0x59cbb6,_0x4e128b){var _0x305e90={},_0x445bc6={},_0x1dc70b={'count':0x0,'rows':[]};var _0x56260c=_['map'](db[_0xd24c('0x30')][_0xd24c('0x31')],function(_0x34a64c){return{'name':_0x34a64c[_0xd24c('0x32')],'type':_0x34a64c['type'][_0xd24c('0x33')]};});_0x445bc6[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x56260c,_0xd24c('0x2d'));_0x445bc6[_0xd24c('0x36')]=_[_0xd24c('0x37')](_0x59cbb6[_0xd24c('0x36')]);_0x445bc6[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x445bc6['model'],_0x445bc6[_0xd24c('0x36')]);_0x305e90['attributes']=_['intersection'](_0x445bc6[_0xd24c('0x34')],qs[_0xd24c('0x3a')](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3a')]));_0x305e90[_0xd24c('0x3b')]=_0x305e90[_0xd24c('0x3b')][_0xd24c('0x3c')]?_0x305e90['attributes']:_0x445bc6[_0xd24c('0x34')];if(!_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3d')](_0xd24c('0x3e'))){_0x305e90[_0xd24c('0x21')]=qs[_0xd24c('0x21')](_0x59cbb6['query'][_0xd24c('0x21')]);_0x305e90[_0xd24c('0x1e')]=qs['offset'](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x1e')]);}_0x305e90['order']=qs[_0xd24c('0x3f')](_0x59cbb6[_0xd24c('0x36')]['sort']);_0x305e90[_0xd24c('0x40')]=qs[_0xd24c('0x38')](_[_0xd24c('0x41')](_0x59cbb6[_0xd24c('0x36')],_0x445bc6['filters']),_0x56260c);if(_0x59cbb6[_0xd24c('0x36')]['filter']){_0x305e90[_0xd24c('0x40')]=_['merge'](_0x305e90['where'],{'$or':_['map'](_0x56260c,function(_0x4160fb){if(_0x4160fb['type']!=='VIRTUAL'){var _0x66f45={};_0x66f45[_0x4160fb[_0xd24c('0x2d')]]={'$like':'%'+_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x42')]+'%'};return _0x66f45;}})});}_0x305e90=_['merge']({},_0x305e90,_0x59cbb6[_0xd24c('0x43')]);var _0x54a924={'where':_0x305e90[_0xd24c('0x40')]};return db[_0xd24c('0x30')][_0xd24c('0x20')](_0x54a924)[_0xd24c('0x27')](function(_0x27eefa){_0x1dc70b[_0xd24c('0x20')]=_0x27eefa;if(_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x44')]){_0x305e90[_0xd24c('0x45')]=[{'all':!![]}];}return db[_0xd24c('0x30')]['findAll'](_0x305e90);})[_0xd24c('0x27')](function(_0x742082){_0x1dc70b['rows']=_0x742082;return _0x1dc70b;})[_0xd24c('0x27')](respondWithFilteredResult(_0x4e128b,_0x305e90))[_0xd24c('0x46')](handleError(_0x4e128b,null));};exports['show']=function(_0x2f2981,_0x5d91fe){var _0x39cd94={'raw':!![],'where':{'id':_0x2f2981[_0xd24c('0x47')]['id']}},_0x2d46b8={};_0x2d46b8[_0xd24c('0x34')]=_[_0xd24c('0x37')](db['Tag'][_0xd24c('0x31')]);_0x2d46b8['query']=_[_0xd24c('0x37')](_0x2f2981['query']);_0x2d46b8[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x2d46b8['model'],_0x2d46b8[_0xd24c('0x36')]);_0x39cd94[_0xd24c('0x3b')]=_['intersection'](_0x2d46b8[_0xd24c('0x34')],qs['fields'](_0x2f2981['query']['fields']));_0x39cd94[_0xd24c('0x3b')]=_0x39cd94[_0xd24c('0x3b')]['length']?_0x39cd94['attributes']:_0x2d46b8[_0xd24c('0x34')];if(_0x2f2981[_0xd24c('0x36')][_0xd24c('0x44')]){_0x39cd94[_0xd24c('0x45')]=[{'all':!![]}];}_0x39cd94=_['merge']({},_0x39cd94,_0x2f2981[_0xd24c('0x43')]);return db[_0xd24c('0x30')]['find'](_0x39cd94)[_0xd24c('0x27')](handleEntityNotFound(_0x5d91fe,null))[_0xd24c('0x27')](respondWithResult(_0x5d91fe,null))[_0xd24c('0x46')](handleError(_0x5d91fe,null));};exports['create']=function(_0x3039aa,_0x4b10c6){return db[_0xd24c('0x30')][_0xd24c('0x48')](_0x3039aa[_0xd24c('0x49')],{})[_0xd24c('0x27')](function(_0x47d5ce){var _0x14684c=_0x3039aa[_0xd24c('0x4a')][_0xd24c('0x29')]({'plain':!![]});if(!_0x14684c)throw new Error(_0xd24c('0x4b'));if(_0x14684c[_0xd24c('0x4c')]===_0xd24c('0x4a')){var _0x3ce7d0=_0x47d5ce[_0xd24c('0x29')]({'plain':!![]});var _0x47067c=_0xd24c('0x2a');return db[_0xd24c('0x4d')]['find']({'where':{'name':_0x47067c,'userProfileId':_0x14684c[_0xd24c('0x4e')]},'raw':!![]})[_0xd24c('0x27')](function(_0x48f011){if(_0x48f011&&_0x48f011['autoAssociation']===0x0){return db['UserProfileResource'][_0xd24c('0x48')]({'name':_0x3ce7d0[_0xd24c('0x2d')],'resourceId':_0x3ce7d0['id'],'type':_0x48f011[_0xd24c('0x2d')],'sectionId':_0x48f011['id']},{})[_0xd24c('0x27')](function(){return _0x47d5ce;});}else{return _0x47d5ce;}})[_0xd24c('0x46')](function(_0x2ea05a){logger[_0xd24c('0x2b')](_0xd24c('0x4f'),_0x2ea05a);throw _0x2ea05a;});}return _0x47d5ce;})[_0xd24c('0x27')](respondWithResult(_0x4b10c6,0xc9))[_0xd24c('0x46')](handleError(_0x4b10c6,null));};exports[_0xd24c('0x26')]=function(_0x4fbb0b,_0x3a8e76){if(_0x4fbb0b[_0xd24c('0x49')]['id']){delete _0x4fbb0b['body']['id'];}return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x4fbb0b[_0xd24c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a8e76,null))['then'](saveUpdates(_0x4fbb0b[_0xd24c('0x49')],null))[_0xd24c('0x27')](respondWithResult(_0x3a8e76,null))[_0xd24c('0x46')](handleError(_0x3a8e76,null));};exports[_0xd24c('0x28')]=function(_0x148685,_0x3dee09){return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x148685['params']['id']}})[_0xd24c('0x27')](handleEntityNotFound(_0x3dee09,null))['then'](removeEntity(_0x3dee09,null))['catch'](handleError(_0x3dee09,null));}; \ No newline at end of file +var _0xbec5=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','name','send','index','map','Tag','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','filter','where','options','includeAll','include','catch','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x5e1c4e,_0x3282fb){var _0x4fea36=function(_0x5d0fa3){while(--_0x5d0fa3){_0x5e1c4e['push'](_0x5e1c4e['shift']());}};_0x4fea36(++_0x3282fb);}(_0xbec5,0xe5));var _0x5bec=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0xbec5[_0x476b00];return _0x44ec8e;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];function respondWithStatusCode(_0x1c888f,_0x589d14){_0x589d14=_0x589d14||0xcc;return function(_0x2d2ba2){if(_0x2d2ba2){return _0x1c888f[_0x5bec('0x19')](_0x589d14);}return _0x1c888f[_0x5bec('0x1a')](_0x589d14)[_0x5bec('0x1b')]();};}function respondWithResult(_0x3198e0,_0xcd6d90){_0xcd6d90=_0xcd6d90||0xc8;return function(_0x24dcd6){if(_0x24dcd6){return _0x3198e0[_0x5bec('0x1a')](_0xcd6d90)[_0x5bec('0x1c')](_0x24dcd6);}};}function respondWithFilteredResult(_0x3ebc41,_0x31b9e4){return function(_0x325daf){if(_0x325daf){var _0x11fb8e=typeof _0x31b9e4['offset']==='undefined'&&typeof _0x31b9e4[_0x5bec('0x1d')]===_0x5bec('0x1e');var _0x31ad9c=_0x325daf[_0x5bec('0x1f')];var _0x5cd7ae=_0x11fb8e?0x0:_0x31b9e4['offset'];var _0x3cd354=_0x11fb8e?_0x325daf[_0x5bec('0x1f')]:_0x31b9e4['offset']+_0x31b9e4[_0x5bec('0x1d')];var _0xa7e223;if(_0x3cd354>=_0x31ad9c){_0x3cd354=_0x31ad9c;_0xa7e223=0xc8;}else{_0xa7e223=0xce;}_0x3ebc41[_0x5bec('0x1a')](_0xa7e223);return _0x3ebc41[_0x5bec('0x20')]('Content-Range',_0x5cd7ae+'-'+_0x3cd354+'/'+_0x31ad9c)[_0x5bec('0x1c')](_0x325daf);}return null;};}function patchUpdates(_0x5be91c){return function(_0x191c0f){try{jsonpatch[_0x5bec('0x21')](_0x191c0f,_0x5be91c,!![]);}catch(_0x3e1896){return BPromise[_0x5bec('0x22')](_0x3e1896);}return _0x191c0f[_0x5bec('0x23')]();};}function saveUpdates(_0x5e154e,_0x232584){return function(_0x4cfcb8){if(_0x4cfcb8){return _0x4cfcb8[_0x5bec('0x24')](_0x5e154e)[_0x5bec('0x25')](function(_0x5b2636){return _0x5b2636;});}return null;};}function removeEntity(_0xa414f8,_0xbef70b){return function(_0x4e0ca2){if(_0x4e0ca2){return _0x4e0ca2[_0x5bec('0x26')]()[_0x5bec('0x25')](function(){var _0x43d460=_0x4e0ca2[_0x5bec('0x27')]({'plain':!![]});var _0x226d55=_0x5bec('0x28');return db[_0x5bec('0x29')]['destroy']({'where':{'type':_0x226d55,'resourceId':_0x43d460['id']}})['then'](function(){return _0x4e0ca2;});})['then'](function(){_0xa414f8[_0x5bec('0x1a')](0xcc)[_0x5bec('0x1b')]();});}};}function handleEntityNotFound(_0x338c25,_0x4939a5){return function(_0x2b3b2c){if(!_0x2b3b2c){_0x338c25[_0x5bec('0x19')](0x194);}return _0x2b3b2c;};}function handleError(_0x57331b,_0x29e358){_0x29e358=_0x29e358||0x1f4;return function(_0x63ac8){logger['error'](_0x63ac8['stack']);if(_0x63ac8[_0x5bec('0x2a')]){delete _0x63ac8[_0x5bec('0x2a')];}_0x57331b[_0x5bec('0x1a')](_0x29e358)[_0x5bec('0x2b')](_0x63ac8);};}exports[_0x5bec('0x2c')]=function(_0x3f224c,_0x5d6621){var _0x2987ca={},_0x59b5b6={},_0x45863b={'count':0x0,'rows':[]};var _0xafbd94=_[_0x5bec('0x2d')](db[_0x5bec('0x2e')]['rawAttributes'],function(_0x2b42c8){return{'name':_0x2b42c8[_0x5bec('0x2f')],'type':_0x2b42c8[_0x5bec('0x30')]['key']};});_0x59b5b6[_0x5bec('0x31')]=_['map'](_0xafbd94,_0x5bec('0x2a'));_0x59b5b6[_0x5bec('0x32')]=_[_0x5bec('0x33')](_0x3f224c['query']);_0x59b5b6[_0x5bec('0x34')]=_[_0x5bec('0x35')](_0x59b5b6['model'],_0x59b5b6[_0x5bec('0x32')]);_0x2987ca[_0x5bec('0x36')]=_[_0x5bec('0x35')](_0x59b5b6[_0x5bec('0x31')],qs[_0x5bec('0x37')](_0x3f224c['query'][_0x5bec('0x37')]));_0x2987ca['attributes']=_0x2987ca[_0x5bec('0x36')][_0x5bec('0x38')]?_0x2987ca[_0x5bec('0x36')]:_0x59b5b6[_0x5bec('0x31')];if(!_0x3f224c[_0x5bec('0x32')][_0x5bec('0x39')]('nolimit')){_0x2987ca[_0x5bec('0x1d')]=qs[_0x5bec('0x1d')](_0x3f224c[_0x5bec('0x32')]['limit']);_0x2987ca[_0x5bec('0x3a')]=qs[_0x5bec('0x3a')](_0x3f224c['query'][_0x5bec('0x3a')]);}_0x2987ca['order']=qs[_0x5bec('0x3b')](_0x3f224c[_0x5bec('0x32')][_0x5bec('0x3b')]);_0x2987ca['where']=qs[_0x5bec('0x34')](_[_0x5bec('0x3c')](_0x3f224c[_0x5bec('0x32')],_0x59b5b6[_0x5bec('0x34')]),_0xafbd94);if(_0x3f224c[_0x5bec('0x32')][_0x5bec('0x3d')]){_0x2987ca[_0x5bec('0x3e')]=_['merge'](_0x2987ca[_0x5bec('0x3e')],{'$or':_[_0x5bec('0x2d')](_0xafbd94,function(_0x323812){if(_0x323812[_0x5bec('0x30')]!=='VIRTUAL'){var _0x27863b={};_0x27863b[_0x323812[_0x5bec('0x2a')]]={'$like':'%'+_0x3f224c[_0x5bec('0x32')]['filter']+'%'};return _0x27863b;}})});}_0x2987ca=_['merge']({},_0x2987ca,_0x3f224c[_0x5bec('0x3f')]);var _0x153d02={'where':_0x2987ca[_0x5bec('0x3e')]};return db[_0x5bec('0x2e')][_0x5bec('0x1f')](_0x153d02)['then'](function(_0x4fee8a){_0x45863b[_0x5bec('0x1f')]=_0x4fee8a;if(_0x3f224c['query'][_0x5bec('0x40')]){_0x2987ca[_0x5bec('0x41')]=[{'all':!![]}];}return db[_0x5bec('0x2e')]['findAll'](_0x2987ca);})[_0x5bec('0x25')](function(_0x26a4a5){_0x45863b['rows']=_0x26a4a5;return _0x45863b;})[_0x5bec('0x25')](respondWithFilteredResult(_0x5d6621,_0x2987ca))[_0x5bec('0x42')](handleError(_0x5d6621,null));};exports[_0x5bec('0x43')]=function(_0x2b51f7,_0x3b5631){var _0x2724cf={'raw':!![],'where':{'id':_0x2b51f7['params']['id']}},_0x3a795c={};_0x3a795c['model']=_[_0x5bec('0x33')](db['Tag']['rawAttributes']);_0x3a795c[_0x5bec('0x32')]=_['keys'](_0x2b51f7['query']);_0x3a795c['filters']=_[_0x5bec('0x35')](_0x3a795c[_0x5bec('0x31')],_0x3a795c[_0x5bec('0x32')]);_0x2724cf[_0x5bec('0x36')]=_['intersection'](_0x3a795c[_0x5bec('0x31')],qs[_0x5bec('0x37')](_0x2b51f7[_0x5bec('0x32')][_0x5bec('0x37')]));_0x2724cf['attributes']=_0x2724cf[_0x5bec('0x36')][_0x5bec('0x38')]?_0x2724cf[_0x5bec('0x36')]:_0x3a795c['model'];if(_0x2b51f7[_0x5bec('0x32')]['includeAll']){_0x2724cf[_0x5bec('0x41')]=[{'all':!![]}];}_0x2724cf=_[_0x5bec('0x44')]({},_0x2724cf,_0x2b51f7[_0x5bec('0x3f')]);return db[_0x5bec('0x2e')]['find'](_0x2724cf)[_0x5bec('0x25')](handleEntityNotFound(_0x3b5631,null))[_0x5bec('0x25')](respondWithResult(_0x3b5631,null))[_0x5bec('0x42')](handleError(_0x3b5631,null));};exports[_0x5bec('0x45')]=function(_0x35b250,_0x123758){return db[_0x5bec('0x2e')]['create'](_0x35b250[_0x5bec('0x46')],{})[_0x5bec('0x25')](function(_0x5775ca){var _0x273e09=_0x35b250[_0x5bec('0x47')][_0x5bec('0x27')]({'plain':!![]});if(!_0x273e09)throw new Error(_0x5bec('0x48'));if(_0x273e09[_0x5bec('0x49')]===_0x5bec('0x47')){var _0x3545a5=_0x5775ca['get']({'plain':!![]});var _0x101dcb='Tags';return db[_0x5bec('0x4a')][_0x5bec('0x4b')]({'where':{'name':_0x101dcb,'userProfileId':_0x273e09[_0x5bec('0x4c')]},'raw':!![]})[_0x5bec('0x25')](function(_0x158e8e){if(_0x158e8e&&_0x158e8e[_0x5bec('0x4d')]===0x0){return db[_0x5bec('0x29')][_0x5bec('0x45')]({'name':_0x3545a5[_0x5bec('0x2a')],'resourceId':_0x3545a5['id'],'type':_0x158e8e[_0x5bec('0x2a')],'sectionId':_0x158e8e['id']},{})['then'](function(){return _0x5775ca;});}else{return _0x5775ca;}})[_0x5bec('0x42')](function(_0x51af88){logger['error'](_0x5bec('0x4e'),_0x51af88);throw _0x51af88;});}return _0x5775ca;})['then'](respondWithResult(_0x123758,0xc9))['catch'](handleError(_0x123758,null));};exports[_0x5bec('0x24')]=function(_0x2114e5,_0x416058){if(_0x2114e5['body']['id']){delete _0x2114e5[_0x5bec('0x46')]['id'];}return db[_0x5bec('0x2e')][_0x5bec('0x4b')]({'where':{'id':_0x2114e5[_0x5bec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x416058,null))[_0x5bec('0x25')](saveUpdates(_0x2114e5[_0x5bec('0x46')],null))[_0x5bec('0x25')](respondWithResult(_0x416058,null))[_0x5bec('0x42')](handleError(_0x416058,null));};exports[_0x5bec('0x26')]=function(_0x3ddf28,_0x33b924){return db['Tag']['find']({'where':{'id':_0x3ddf28[_0x5bec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33b924,null))[_0x5bec('0x25')](removeEntity(_0x33b924,null))[_0x5bec('0x42')](handleError(_0x33b924,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index cbe91a1..2bca76b 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 _0xff91=['request-promise','path','rimraf','define','tools_tags','util','../../config/logger','api','moment','bluebird'];(function(_0x3d7365,_0x13ccfb){var _0x3d96ac=function(_0x24135e){while(--_0x24135e){_0x3d7365['push'](_0x3d7365['shift']());}};_0x3d96ac(++_0x13ccfb);}(_0xff91,0x1d1));var _0x1ff9=function(_0xce08a3,_0x3999e4){_0xce08a3=_0xce08a3-0x0;var _0x53ccb6=_0xff91[_0xce08a3];return _0x53ccb6;};'use strict';var _=require('lodash');var util=require(_0x1ff9('0x0'));var logger=require(_0x1ff9('0x1'))(_0x1ff9('0x2'));var moment=require(_0x1ff9('0x3'));var BPromise=require(_0x1ff9('0x4'));var rp=require(_0x1ff9('0x5'));var fs=require('fs');var path=require(_0x1ff9('0x6'));var rimraf=require(_0x1ff9('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x3ce8b8,_0x371e6d){return _0x3ce8b8[_0x1ff9('0x8')]('Tag',attributes,{'tableName':_0x1ff9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f69=['Tag','tools_tags','../../config/logger','moment','bluebird','path','rimraf','./tag.attributes','define'];(function(_0xddc8d,_0x28a9db){var _0xc78f00=function(_0x159fa0){while(--_0x159fa0){_0xddc8d['push'](_0xddc8d['shift']());}};_0xc78f00(++_0x28a9db);}(_0x0f69,0x173));var _0x90f6=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x0f69[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90f6('0x0'))('api');var moment=require(_0x90f6('0x1'));var BPromise=require(_0x90f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90f6('0x3'));var rimraf=require(_0x90f6('0x4'));var config=require('../../config/environment');var attributes=require(_0x90f6('0x5'));module['exports']=function(_0x1840a5,_0x3dfd95){return _0x1840a5[_0x90f6('0x6')](_0x90f6('0x7'),attributes,{'tableName':_0x90f6('0x8'),'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 4c1d9d3..57dc904 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 _0x8664=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5a16fa,_0x118162){var _0x52ff17=function(_0x5813e1){while(--_0x5813e1){_0x5a16fa['push'](_0x5a16fa['shift']());}};_0x52ff17(++_0x118162);}(_0x8664,0x11a));var _0x4866=function(_0x1216ec,_0x5e7bc1){_0x1216ec=_0x1216ec-0x0;var _0x47fc29=_0x8664[_0x1216ec];return _0x47fc29;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var moment=require(_0x4866('0x2'));var BPromise=require(_0x4866('0x3'));var rs=require(_0x4866('0x4'));var fs=require('fs');var Redis=require(_0x4866('0x5'));var db=require(_0x4866('0x6'))['db'];var utils=require(_0x4866('0x7'));var logger=require(_0x4866('0x8'))('rpc');var config=require(_0x4866('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4866('0xa')][_0x4866('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x439f55,_0x10f7c1,_0x2b4bb0){return new BPromise(function(_0x142f18,_0x4e07e3){return client[_0x4866('0xc')](_0x439f55,_0x2b4bb0)[_0x4866('0xd')](function(_0x10a369){logger[_0x4866('0xe')](_0x4866('0xf'),_0x10f7c1,'request\x20sent');logger[_0x4866('0x10')](_0x4866('0x11'),_0x10f7c1,'request\x20sent',JSON[_0x4866('0x12')](_0x10a369));if(_0x10a369[_0x4866('0x13')]){if(_0x10a369['error']['code']===0x1f4){logger['error'](_0x4866('0xf'),_0x10f7c1,_0x10a369[_0x4866('0x13')][_0x4866('0x14')]);return _0x4e07e3(_0x10a369[_0x4866('0x13')][_0x4866('0x14')]);}logger[_0x4866('0x13')]('Tag,\x20%s,\x20%s',_0x10f7c1,_0x10a369[_0x4866('0x13')][_0x4866('0x14')]);return _0x142f18(_0x10a369['error'][_0x4866('0x14')]);}else{logger[_0x4866('0xe')](_0x4866('0xf'),_0x10f7c1,_0x4866('0x15'));_0x142f18(_0x10a369[_0x4866('0x16')][_0x4866('0x14')]);}})[_0x4866('0x17')](function(_0x653916){logger[_0x4866('0x13')]('Tag,\x20%s,\x20%s',_0x10f7c1,_0x653916);_0x4e07e3(_0x653916);});});} \ No newline at end of file +var _0xac31=['code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xac31,0xca));var _0x1ac3=function(_0x545b9a,_0x1eff16){_0x545b9a=_0x545b9a-0x0;var _0x421120=_0xac31[_0x545b9a];return _0x421120;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('Tag,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index e61118f..78a2c42 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 8836315..4a14c4e 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 _0xb10b=['name','sequelize','STRING'];(function(_0x23d0e8,_0x1f514e){var _0x55cb1e=function(_0x117055){while(--_0x117055){_0x23d0e8['push'](_0x23d0e8['shift']());}};_0x55cb1e(++_0x1f514e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb10b[_0x3ab51d];return _0x29a04e;};'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 +var _0xd8b0=['exports','sequelize'];(function(_0xc78025,_0x40f2fc){var _0x11dacb=function(_0x38d8f8){while(--_0x38d8f8){_0xc78025['push'](_0xc78025['shift']());}};_0x11dacb(++_0x40f2fc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6d5e9f2..cd3afd5 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 _0xfd47=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','then','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','sequelize','Sequelize','QueryTypes','VoiceQueueId','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','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','OpenchannelQueueId','UserOpenchannelQueue','TeamVoicePrefix','VoicePrefixId','Teams','getQueues','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','options','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','transaction','through','QueueId','TeamVoiceQueue','penalty','User','Queue','emit','Queue:save','online','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','UserVoicePrefix','spread','removeAgents','Queue:remove','pick','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x31a68a,_0x366537){var _0x2c9995=function(_0x1c1c61){while(--_0x1c1c61){_0x31a68a['push'](_0x31a68a['shift']());}};_0x2c9995(++_0x366537);}(_0xfd47,0x1bd));var _0x7fd4=function(_0x314fa8,_0x1ff327){_0x314fa8=_0x314fa8-0x0;var _0x1c68bb=_0xfd47[_0x314fa8];return _0x1c68bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fd4('0x0'));var jsonpatch=require(_0x7fd4('0x1'));var rp=require(_0x7fd4('0x2'));var moment=require('moment');var BPromise=require(_0x7fd4('0x3'));var Mustache=require(_0x7fd4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7fd4('0x5'));var csv=require(_0x7fd4('0x6'));var ejs=require(_0x7fd4('0x7'));var fs=require('fs');var fs_extra=require(_0x7fd4('0x8'));var _=require('lodash');var squel=require(_0x7fd4('0x9'));var crypto=require(_0x7fd4('0xa'));var jsforce=require(_0x7fd4('0xb'));var deskjs=require(_0x7fd4('0xc'));var toCsv=require(_0x7fd4('0x6'));var querystring=require(_0x7fd4('0xd'));var Papa=require(_0x7fd4('0xe'));var Redis=require(_0x7fd4('0xf'));var authService=require(_0x7fd4('0x10'));var qs=require(_0x7fd4('0x11'));var as=require(_0x7fd4('0x12'));var hardwareService=require(_0x7fd4('0x13'));var logger=require(_0x7fd4('0x14'))(_0x7fd4('0x15'));var utils=require('../../config/utils');var config=require(_0x7fd4('0x16'));var licenseUtil=require(_0x7fd4('0x17'));var db=require(_0x7fd4('0x18'))['db'];config['redis']=_[_0x7fd4('0x19')](config[_0x7fd4('0x1a')],{'host':_0x7fd4('0x1b'),'port':0x18eb});var socket=require(_0x7fd4('0x1c'))(new Redis(config[_0x7fd4('0x1a')]));require('./team.socket')[_0x7fd4('0x1d')](socket);function respondWithStatusCode(_0x55f038,_0x5f446d){_0x5f446d=_0x5f446d||0xcc;return function(_0x3be6a){if(_0x3be6a){return _0x55f038[_0x7fd4('0x1e')](_0x5f446d);}return _0x55f038[_0x7fd4('0x1f')](_0x5f446d)[_0x7fd4('0x20')]();};}function respondWithResult(_0x1ee29e,_0x1ea4d6){_0x1ea4d6=_0x1ea4d6||0xc8;return function(_0x1f6c0b){if(_0x1f6c0b){return _0x1ee29e[_0x7fd4('0x1f')](_0x1ea4d6)[_0x7fd4('0x21')](_0x1f6c0b);}};}function respondWithFilteredResult(_0xbc17c,_0x48aad4){return function(_0x260c9a){if(_0x260c9a){var _0x45cf2f=typeof _0x48aad4['offset']===_0x7fd4('0x22')&&typeof _0x48aad4[_0x7fd4('0x23')]===_0x7fd4('0x22');var _0x1c67e0=_0x260c9a['count'];var _0x5559f6=_0x45cf2f?0x0:_0x48aad4[_0x7fd4('0x24')];var _0x1d000d=_0x45cf2f?_0x260c9a['count']:_0x48aad4[_0x7fd4('0x24')]+_0x48aad4[_0x7fd4('0x23')];var _0x79312d;if(_0x1d000d>=_0x1c67e0){_0x1d000d=_0x1c67e0;_0x79312d=0xc8;}else{_0x79312d=0xce;}_0xbc17c[_0x7fd4('0x1f')](_0x79312d);return _0xbc17c[_0x7fd4('0x25')](_0x7fd4('0x26'),_0x5559f6+'-'+_0x1d000d+'/'+_0x1c67e0)['json'](_0x260c9a);}return null;};}function patchUpdates(_0x5b659c){return function(_0x208d0f){try{jsonpatch[_0x7fd4('0x27')](_0x208d0f,_0x5b659c,!![]);}catch(_0x5ca14b){return BPromise[_0x7fd4('0x28')](_0x5ca14b);}return _0x208d0f[_0x7fd4('0x29')]();};}function saveUpdates(_0x445a13,_0x4adb6e){return function(_0x1ba75e){if(_0x1ba75e){return _0x1ba75e[_0x7fd4('0x2a')](_0x445a13)['then'](function(_0x5872bb){return _0x5872bb;});}return null;};}function handleEntityNotFound(_0x4841ba,_0x26dd99){return function(_0x556a54){if(!_0x556a54){_0x4841ba[_0x7fd4('0x1e')](0x194);}return _0x556a54;};}function handleError(_0x4475fd,_0x1423c5){_0x1423c5=_0x1423c5||0x1f4;return function(_0x11986c){logger['error'](_0x11986c[_0x7fd4('0x2b')]);if(_0x11986c['name']){delete _0x11986c[_0x7fd4('0x2c')];}_0x4475fd[_0x7fd4('0x1f')](_0x1423c5)[_0x7fd4('0x2d')](_0x11986c);};}exports['index']=function(_0x158bbf,_0x321d9e){var _0x4972ef={},_0x3a9901={},_0x3b1a80={'count':0x0,'rows':[]};var _0x137333=_['map'](db[_0x7fd4('0x2e')][_0x7fd4('0x2f')],function(_0x5794dd){return{'name':_0x5794dd[_0x7fd4('0x30')],'type':_0x5794dd[_0x7fd4('0x31')][_0x7fd4('0x32')]};});_0x3a9901[_0x7fd4('0x33')]=_[_0x7fd4('0x34')](_0x137333,_0x7fd4('0x2c'));_0x3a9901['query']=_[_0x7fd4('0x35')](_0x158bbf[_0x7fd4('0x36')]);_0x3a9901['filters']=_[_0x7fd4('0x37')](_0x3a9901[_0x7fd4('0x33')],_0x3a9901[_0x7fd4('0x36')]);_0x4972ef['attributes']=_[_0x7fd4('0x37')](_0x3a9901['model'],qs['fields'](_0x158bbf['query']['fields']));_0x4972ef[_0x7fd4('0x38')]=_0x4972ef[_0x7fd4('0x38')][_0x7fd4('0x39')]?_0x4972ef[_0x7fd4('0x38')]:_0x3a9901[_0x7fd4('0x33')];if(!_0x158bbf['query'][_0x7fd4('0x3a')](_0x7fd4('0x3b'))){_0x4972ef[_0x7fd4('0x23')]=qs['limit'](_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x23')]);_0x4972ef['offset']=qs[_0x7fd4('0x24')](_0x158bbf['query'][_0x7fd4('0x24')]);}_0x4972ef[_0x7fd4('0x3c')]=qs[_0x7fd4('0x3d')](_0x158bbf['query']['sort']);_0x4972ef[_0x7fd4('0x3e')]=qs['filters'](_['pick'](_0x158bbf['query'],_0x3a9901[_0x7fd4('0x3f')]),_0x137333);if(_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x40')]){_0x4972ef[_0x7fd4('0x3e')]=_[_0x7fd4('0x41')](_0x4972ef[_0x7fd4('0x3e')],{'$or':_[_0x7fd4('0x34')](_0x137333,function(_0x39fb77){if(_0x39fb77[_0x7fd4('0x31')]!==_0x7fd4('0x42')){var _0x439b48={};_0x439b48[_0x39fb77['name']]={'$like':'%'+_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x40')]+'%'};return _0x439b48;}})});}_0x4972ef=_['merge']({},_0x4972ef,_0x158bbf['options']);var _0x251320={'where':_0x4972ef[_0x7fd4('0x3e')]};return db['Team']['count'](_0x251320)[_0x7fd4('0x43')](function(_0x2914df){_0x3b1a80[_0x7fd4('0x44')]=_0x2914df;if(_0x158bbf[_0x7fd4('0x36')][_0x7fd4('0x45')]){_0x4972ef[_0x7fd4('0x46')]=[{'all':!![]}];}return db[_0x7fd4('0x2e')][_0x7fd4('0x47')](_0x4972ef);})[_0x7fd4('0x43')](function(_0x4d7b50){_0x3b1a80[_0x7fd4('0x48')]=_0x4d7b50;return _0x3b1a80;})[_0x7fd4('0x43')](respondWithFilteredResult(_0x321d9e,_0x4972ef))[_0x7fd4('0x49')](handleError(_0x321d9e,null));};exports[_0x7fd4('0x4a')]=function(_0x1b89d5,_0x2561b2){var _0x3339c7={'raw':![],'where':{'id':_0x1b89d5[_0x7fd4('0x4b')]['id']}},_0x462228={};_0x462228[_0x7fd4('0x33')]=_[_0x7fd4('0x35')](db[_0x7fd4('0x2e')]['rawAttributes']);_0x462228[_0x7fd4('0x36')]=_['keys'](_0x1b89d5[_0x7fd4('0x36')]);_0x462228[_0x7fd4('0x3f')]=_['intersection'](_0x462228['model'],_0x462228[_0x7fd4('0x36')]);_0x3339c7[_0x7fd4('0x38')]=_[_0x7fd4('0x37')](_0x462228[_0x7fd4('0x33')],qs[_0x7fd4('0x4c')](_0x1b89d5[_0x7fd4('0x36')][_0x7fd4('0x4c')]));_0x3339c7[_0x7fd4('0x38')]=_0x3339c7['attributes']['length']?_0x3339c7['attributes']:_0x462228['model'];if(_0x1b89d5[_0x7fd4('0x36')][_0x7fd4('0x45')]){_0x3339c7[_0x7fd4('0x46')]=[{'all':!![]}];}_0x3339c7=_[_0x7fd4('0x41')]({},_0x3339c7,_0x1b89d5['options']);return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')](_0x3339c7)[_0x7fd4('0x43')](handleEntityNotFound(_0x2561b2,null))['then'](respondWithResult(_0x2561b2,null))[_0x7fd4('0x49')](handleError(_0x2561b2,null));};exports['create']=function(_0x222b57,_0x4150b2){return db[_0x7fd4('0x2e')][_0x7fd4('0x4e')](_0x222b57['body'],{})[_0x7fd4('0x43')](function(_0x256349){var _0x49a30c=_0x222b57[_0x7fd4('0x4f')][_0x7fd4('0x50')]({'plain':!![]});if(!_0x49a30c)throw new Error(_0x7fd4('0x51'));if(_0x49a30c[_0x7fd4('0x52')]===_0x7fd4('0x4f')){var _0x12bb70=_0x256349[_0x7fd4('0x50')]({'plain':!![]});var _0x34eaa7='Teams';return db[_0x7fd4('0x53')][_0x7fd4('0x4d')]({'where':{'name':_0x34eaa7,'userProfileId':_0x49a30c[_0x7fd4('0x54')]},'raw':!![]})[_0x7fd4('0x43')](function(_0x1c52b6){if(_0x1c52b6&&_0x1c52b6[_0x7fd4('0x55')]===0x0){return db[_0x7fd4('0x56')][_0x7fd4('0x4e')]({'name':_0x12bb70['name'],'resourceId':_0x12bb70['id'],'type':_0x1c52b6[_0x7fd4('0x2c')],'sectionId':_0x1c52b6['id']},{})['then'](function(){return _0x256349;});}else{return _0x256349;}})[_0x7fd4('0x49')](function(_0x28f380){logger[_0x7fd4('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28f380);throw _0x28f380;});}return _0x256349;})[_0x7fd4('0x43')](respondWithResult(_0x4150b2,0xc9))['catch'](handleError(_0x4150b2,null));};exports[_0x7fd4('0x2a')]=function(_0x1f224d,_0x5248f0){if(_0x1f224d[_0x7fd4('0x58')]['id']){delete _0x1f224d['body']['id'];}return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')]({'where':{'id':_0x1f224d[_0x7fd4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5248f0,null))['then'](saveUpdates(_0x1f224d[_0x7fd4('0x58')],null))[_0x7fd4('0x43')](respondWithResult(_0x5248f0,null))[_0x7fd4('0x49')](handleError(_0x5248f0,null));};exports[_0x7fd4('0x59')]=function(_0x2bd828,_0x244e02){var _0x11832e=_0x2bd828[_0x7fd4('0x4b')]['id'];var _0x195a27=[];return db['sequelize']['transaction'](function(_0x49d2f8){var _0x31cff0=_0x7fd4('0x5a')+_0x11832e;return db['sequelize'][_0x7fd4('0x36')](_0x31cff0,{'type':db['Sequelize']['QueryTypes'][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8})[_0x7fd4('0x43')](function(_0x5118dd){_0x195a27=_[_0x7fd4('0x34')](_0x5118dd,function(_0x13521c){return Number(_0x13521c[_0x7fd4('0x5c')]);});})[_0x7fd4('0x43')](function(){var _0x2a1d5e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x2a1d5e,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x589a3f){var _0x42b106=_[_0x7fd4('0x34')](_0x589a3f,function(_0x119781){return Number(_0x119781[_0x7fd4('0x60')]);});return db['UserVoiceQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'VoiceQueueId':{'$in':_0x42b106}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x206b65='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db['sequelize']['query'](_0x206b65,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x319802){var _0x294c70=_[_0x7fd4('0x34')](_0x319802,function(_0x3945eb){return Number(_0x3945eb[_0x7fd4('0x61')]);});return db['UserMailQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'MailQueueId':{'$in':_0x294c70}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x1d952c=_0x7fd4('0x62')+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x1d952c,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x2415fd){var _0x1f5f13=_[_0x7fd4('0x34')](_0x2415fd,function(_0x4c75b0){return Number(_0x4c75b0[_0x7fd4('0x63')]);});return db[_0x7fd4('0x64')]['destroy']({'where':{'UserId':{'$in':_0x195a27},'SmsQueueId':{'$in':_0x1f5f13}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0xe87772=_0x7fd4('0x65')+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0xe87772,{'type':db[_0x7fd4('0x5e')][_0x7fd4('0x5f')]['SELECT'],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x20d06a){var _0x317442=_['map'](_0x20d06a,function(_0x2bed6b){return Number(_0x2bed6b[_0x7fd4('0x66')]);});return db['UserChatQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'ChatQueueId':{'$in':_0x317442}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x368a0d=_0x7fd4('0x67')+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x368a0d,{'type':db[_0x7fd4('0x5e')]['QueryTypes'][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x3f8559){var _0x58909c=_['map'](_0x3f8559,function(_0x3904a1){return Number(_0x3904a1[_0x7fd4('0x68')]);});return db[_0x7fd4('0x69')][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'FaxQueueId':{'$in':_0x58909c}},'transaction':_0x49d2f8});})['then'](function(){var _0xd5122c='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0xd5122c,{'type':db[_0x7fd4('0x5e')]['QueryTypes'][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x60c1ce){var _0x4a7b12=_[_0x7fd4('0x34')](_0x60c1ce,function(_0x3ade71){return Number(_0x3ade71[_0x7fd4('0x6a')]);});return db[_0x7fd4('0x6b')][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'OpenchannelQueueId':{'$in':_0x4a7b12}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){var _0x416619='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x11832e;return db[_0x7fd4('0x5d')][_0x7fd4('0x36')](_0x416619,{'type':db['Sequelize'][_0x7fd4('0x5f')][_0x7fd4('0x5b')],'raw':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x2b6372){var _0x3f49fc=_['map'](_0x2b6372,function(_0x38435e){return Number(_0x38435e['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'WhatsappQueueId':{'$in':_0x3f49fc}},'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(){return db[_0x7fd4('0x6c')]['find']({'where':{'TeamId':_0x11832e}});})['then'](function(_0x259d4a){if(_0x259d4a===null){return;}return db['UserVoicePrefix'][_0x7fd4('0x59')]({'where':{'UserId':{'$in':_0x195a27},'VoicePrefixId':_0x259d4a[_0x7fd4('0x6d')]},'transaction':_0x49d2f8});})['then'](function(){return db['Team'][_0x7fd4('0x59')]({'where':{'id':_0x11832e},'cascade':!![],'transaction':_0x49d2f8});})[_0x7fd4('0x43')](function(_0x3b2ab9){if(_0x3b2ab9===0x0){_0x244e02[_0x7fd4('0x1e')](0x194);}else{return db['UserProfileResource'][_0x7fd4('0x59')]({'where':{'type':_0x7fd4('0x6e'),'resourceId':_0x11832e},'cascade':!![],'transaction':_0x49d2f8})['then'](function(){_0x244e02[_0x7fd4('0x1f')](0xcc)[_0x7fd4('0x20')]();});}})['catch'](function(_0x54114a){_0x244e02[_0x7fd4('0x1f')](0x1f4)[_0x7fd4('0x2d')](_0x54114a);});});};exports[_0x7fd4('0x6f')]=function(_0x68f190,_0x54c52d,_0x34f52a){return db['Team']['findOne']({'where':{'id':_0x68f190[_0x7fd4('0x4b')]['id']}})[_0x7fd4('0x43')](handleEntityNotFound(_0x54c52d,null))['then'](function(_0x2ca76d){if(!_0x68f190[_0x7fd4('0x36')]['channel']||!utils[_0x7fd4('0x70')](_0x68f190['query']['channel'])){throw new db[(_0x7fd4('0x5e'))][(_0x7fd4('0x71'))](_0x7fd4('0x72'));}var _0x5efa7f={};var _0x117f50={};_0x117f50['model']=_[_0x7fd4('0x35')](db[_[_0x7fd4('0x73')](_0x68f190['query'][_0x7fd4('0x74')]['toLowerCase']())+'Queue'][_0x7fd4('0x2f')]);_0x117f50[_0x7fd4('0x36')]=_[_0x7fd4('0x35')](_0x68f190[_0x7fd4('0x36')]);_0x117f50[_0x7fd4('0x3f')]=_[_0x7fd4('0x37')](_0x117f50[_0x7fd4('0x33')],_0x117f50[_0x7fd4('0x36')]);_0x5efa7f[_0x7fd4('0x38')]=_['intersection'](_0x117f50[_0x7fd4('0x33')],qs['fields'](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x4c')]));_0x5efa7f[_0x7fd4('0x38')]=_0x5efa7f[_0x7fd4('0x38')][_0x7fd4('0x39')]?_0x5efa7f[_0x7fd4('0x38')]:_0x117f50['model'];_0x5efa7f[_0x7fd4('0x23')]=qs['limit'](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x23')]);_0x5efa7f[_0x7fd4('0x24')]=qs[_0x7fd4('0x24')](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x24')]);_0x5efa7f['order']=qs[_0x7fd4('0x3d')](_0x68f190[_0x7fd4('0x36')][_0x7fd4('0x3d')]);_0x5efa7f[_0x7fd4('0x3e')]=qs['filters'](_['pick'](_0x68f190['query'],_0x117f50[_0x7fd4('0x3f')]));_0x5efa7f=_[_0x7fd4('0x41')]({},_0x5efa7f,_0x68f190[_0x7fd4('0x75')]);return _0x2ca76d[_0x7fd4('0x50')+_['capitalize'](_0x68f190[_0x7fd4('0x36')]['channel'][_0x7fd4('0x76')]())+_0x7fd4('0x77')](_0x5efa7f);})[_0x7fd4('0x43')](respondWithResult(_0x54c52d,null))[_0x7fd4('0x49')](handleError(_0x54c52d,null));};exports[_0x7fd4('0x78')]=function(_0x58471e,_0x4068c5,_0xa11e8c){return db[_0x7fd4('0x2e')][_0x7fd4('0x79')]({'where':{'id':_0x58471e[_0x7fd4('0x4b')]['id']}})[_0x7fd4('0x43')](function(_0x37d832){if(_0x37d832){if(!_0x58471e[_0x7fd4('0x58')][_0x7fd4('0x74')]||!utils[_0x7fd4('0x70')](_0x58471e[_0x7fd4('0x58')][_0x7fd4('0x74')])){throw new db[(_0x7fd4('0x5e'))][(_0x7fd4('0x71'))](_0x7fd4('0x72'));}return _0x37d832[_0x7fd4('0x7a')+_[_0x7fd4('0x73')](_0x58471e['body'][_0x7fd4('0x74')][_0x7fd4('0x76')]())+_0x7fd4('0x77')](_0x58471e[_0x7fd4('0x58')][_0x7fd4('0x7b')]);}return null;})[_0x7fd4('0x43')](handleEntityNotFound(_0x4068c5,null))[_0x7fd4('0x43')](respondWithStatusCode(_0x4068c5,null))[_0x7fd4('0x49')](handleError(_0x4068c5,null));};exports[_0x7fd4('0x7c')]=function(_0x2e8581,_0x13601a,_0x4a9cf4){return db[_0x7fd4('0x2e')][_0x7fd4('0x79')]({'where':{'id':_0x2e8581[_0x7fd4('0x4b')]['id']}})['then'](function(_0x5e99e6){if(_0x5e99e6){if(!_0x2e8581[_0x7fd4('0x36')][_0x7fd4('0x74')]||!utils[_0x7fd4('0x70')](_0x2e8581[_0x7fd4('0x36')]['channel'])){throw new db[(_0x7fd4('0x5e'))][(_0x7fd4('0x71'))](_0x7fd4('0x72'));}return _0x5e99e6['remove'+_[_0x7fd4('0x73')](_0x2e8581['query']['channel'][_0x7fd4('0x76')]())+'Queues'](_0x2e8581['query'][_0x7fd4('0x7b')]);}return null;})[_0x7fd4('0x43')](handleEntityNotFound(_0x13601a,null))['then'](respondWithStatusCode(_0x13601a,null))[_0x7fd4('0x49')](handleError(_0x13601a,null));};exports[_0x7fd4('0x7d')]=function(_0x5cffa1,_0x180fd5){var _0xbb04cd=_[_0x7fd4('0x7e')](_0x5cffa1['body'][_0x7fd4('0x7b')])?_0x5cffa1[_0x7fd4('0x58')]['ids']:[_0x5cffa1[_0x7fd4('0x58')][_0x7fd4('0x7b')]];var _0x5c0376=_0x5cffa1[_0x7fd4('0x4b')]['id'];return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')]({'where':{'id':_0x5c0376}})[_0x7fd4('0x43')](handleEntityNotFound(_0x180fd5,null))[_0x7fd4('0x43')](function(_0x1fae5a){if(_0x1fae5a){var _0x50ec7f=[_0x7fd4('0x7f'),_0x7fd4('0x80'),_0x7fd4('0x81'),_0x7fd4('0x82'),_0x7fd4('0x83'),_0x7fd4('0x84'),'Whatsapp'];return db['sequelize'][_0x7fd4('0x85')](function(_0x2addc2){var _0x415479=_['map'](_0x50ec7f,function(_0x2d18b0){var _0x1e1f76={'attributes':['id',_0x7fd4('0x2c')]};if(_0x2d18b0==='Voice'){_0x1e1f76[_0x7fd4('0x86')]={'attributes':['penalty']};}return _0x1fae5a['get'+_0x2d18b0+'Queues'](_0x1e1f76)[_0x7fd4('0x43')](function(_0x14b5f6){var _0x405a9c=_[_0x7fd4('0x34')](_0x14b5f6,function(_0x1c84a1){var _0x277e5f=_[_0x7fd4('0x34')](_0xbb04cd,function(_0xf4888e){var _0x31a975={'where':{'UserId':_0xf4888e,[_0x2d18b0+_0x7fd4('0x87')]:_0x1c84a1['id']},'transaction':_0x2addc2};if(_0x2d18b0===_0x7fd4('0x7f')){_0x31a975[_0x7fd4('0x19')]={'penalty':_0x1c84a1[_0x7fd4('0x88')][_0x7fd4('0x89')]};}return db[_0x7fd4('0x8a')+_0x2d18b0+_0x7fd4('0x8b')]['findOrCreate'](_0x31a975)[_0x7fd4('0x43')](function(){socket[_0x7fd4('0x8c')](_0x7fd4('0x4f')+_0x2d18b0+_0x7fd4('0x8d'),{'UserId':_0xf4888e,[_0x2d18b0+_0x7fd4('0x87')]:_0x1c84a1['id']});if(_0x2d18b0!==_0x7fd4('0x7f')){return;}return db[_0x7fd4('0x8a')][_0x7fd4('0x47')]({'where':{'id':_0xbb04cd,'online':0x1},'attributes':['id',_0x7fd4('0x2c'),_0x7fd4('0x8e'),'voicePause','interface'],'raw':!![]})[_0x7fd4('0x43')](function(_0x508da6){var _0x49b822=_[_0x7fd4('0x34')](_0x508da6,function(_0x5592bd){return db[_0x7fd4('0x8f')][_0x7fd4('0x90')]({'membername':_0x5592bd[_0x7fd4('0x2c')],'UserId':_0x5592bd['id'],'queue_name':_0x1c84a1['name'],'VoiceQueueId':_0x1c84a1['id'],'interface':_[_0x7fd4('0x91')](_0x5592bd['interface'])?util[_0x7fd4('0x92')](_0x7fd4('0x93'),_0x5592bd[_0x7fd4('0x2c')]):_0x5592bd['interface'],'paused':_0x5592bd[_0x7fd4('0x94')]||![],'penalty':_0x1c84a1[_0x7fd4('0x88')][_0x7fd4('0x89')]},{'transaction':_0x2addc2});});return Promise['all'](_0x49b822);});});});return Promise['all'](_0x277e5f);});return Promise[_0x7fd4('0x95')](_0x405a9c);})['then'](function(){return db[_0x7fd4('0x6c')][_0x7fd4('0x79')]({'where':{'teamId':_0x5c0376}})[_0x7fd4('0x43')](function(_0x3de71d){if(_0x3de71d){var _0x4ab8a1=_[_0x7fd4('0x34')](_0xbb04cd,function(_0x35004c){db[_0x7fd4('0x96')][_0x7fd4('0x90')]({'UserId':_0x35004c,'VoicePrefixId':_0x3de71d[_0x7fd4('0x6d')]});});return Promise[_0x7fd4('0x95')](_0x4ab8a1);}});});});return Promise[_0x7fd4('0x95')](_0x415479)[_0x7fd4('0x43')](function(){return _0x1fae5a[_0x7fd4('0x7d')](_0xbb04cd,{'transaction':_0x2addc2})[_0x7fd4('0x97')](function(_0x3a3969){return _0x3a3969;});});});}})[_0x7fd4('0x43')](respondWithResult(_0x180fd5,null))[_0x7fd4('0x49')](handleError(_0x180fd5,null));};exports['removeAgents']=function(_0x3fc33a,_0x44ee0e){var _0x116e63=_[_0x7fd4('0x7e')](_0x3fc33a[_0x7fd4('0x36')]['ids'])?_0x3fc33a[_0x7fd4('0x36')][_0x7fd4('0x7b')]:[_0x3fc33a['query'][_0x7fd4('0x7b')]];var _0x2f794f=_0x3fc33a[_0x7fd4('0x4b')]['id'];return db[_0x7fd4('0x2e')][_0x7fd4('0x4d')]({'where':{'id':_0x2f794f}})[_0x7fd4('0x43')](handleEntityNotFound(_0x44ee0e,null))[_0x7fd4('0x43')](function(_0x85fc13){if(_0x85fc13){var _0x16ce07=[_0x7fd4('0x7f'),_0x7fd4('0x80'),_0x7fd4('0x81'),'Sms','Fax',_0x7fd4('0x84'),'Whatsapp'];return db[_0x7fd4('0x5d')][_0x7fd4('0x85')](function(_0x283df5){var _0x12f1b1=_[_0x7fd4('0x34')](_0x16ce07,function(_0x1777ed){var _0x4d2673={'attributes':['id',_0x7fd4('0x2c')]};return _0x85fc13[_0x7fd4('0x50')+_0x1777ed+'Queues'](_0x4d2673)[_0x7fd4('0x43')](function(_0x3519a1){var _0x1d046d=_[_0x7fd4('0x34')](_0x3519a1,function(_0xfd6d24){return _0xfd6d24[_0x7fd4('0x98')](_0x116e63,{'transaction':_0x283df5})[_0x7fd4('0x43')](function(){var _0x3f7a53=_['map'](_0x116e63,function(_0x48b7a4){socket['emit'](_0x7fd4('0x4f')+_0x1777ed+_0x7fd4('0x99'),{'UserId':Number(_0x48b7a4),[_0x1777ed+'QueueId']:_0xfd6d24['id']});if(_0x1777ed!==_0x7fd4('0x7f')){return;}return db[_0x7fd4('0x8f')][_0x7fd4('0x59')]({'where':{'VoiceQueueId':_0xfd6d24['id'],'UserId':_0x48b7a4},'transaction':_0x283df5});});return Promise[_0x7fd4('0x95')](_0x3f7a53);});});return Promise[_0x7fd4('0x95')](_0x1d046d);});});return Promise[_0x7fd4('0x95')](_0x12f1b1)[_0x7fd4('0x43')](function(){return _0x85fc13[_0x7fd4('0x98')](_0x116e63,{'transaction':_0x283df5});})[_0x7fd4('0x43')](function(){return db[_0x7fd4('0x6c')]['findOne']({'where':{'teamId':_0x2f794f}})[_0x7fd4('0x43')](function(_0x4441be){if(_0x4441be){var _0x2ba7f4=_[_0x7fd4('0x34')](_0x116e63,function(_0x4971c9){db[_0x7fd4('0x96')][_0x7fd4('0x59')]({'where':{'UserId':_0x4971c9,'VoicePrefixId':_0x4441be['VoicePrefixId']}});});return Promise['all'](_0x2ba7f4);}});});});}})['then'](respondWithStatusCode(_0x44ee0e,null))[_0x7fd4('0x49')](handleError(_0x44ee0e,null));};exports['getAgents']=function(_0x5607d9,_0x483961,_0x4412f6){var _0x18942d={};var _0x217d4f={};var _0x48d46a;var _0xd0fece;return db['Team']['findOne']({'where':{'id':_0x5607d9[_0x7fd4('0x4b')]['id']}})[_0x7fd4('0x43')](handleEntityNotFound(_0x483961,null))[_0x7fd4('0x43')](function(_0x2adaa3){if(_0x2adaa3){_0x48d46a=_0x2adaa3;_0x217d4f['model']=_[_0x7fd4('0x35')](db[_0x7fd4('0x8a')][_0x7fd4('0x2f')]);_0x217d4f[_0x7fd4('0x36')]=_[_0x7fd4('0x35')](_0x5607d9[_0x7fd4('0x36')]);_0x217d4f[_0x7fd4('0x3f')]=_['intersection'](_0x217d4f[_0x7fd4('0x33')],_0x217d4f['query']);_0x18942d[_0x7fd4('0x38')]=_[_0x7fd4('0x37')](_0x217d4f[_0x7fd4('0x33')],qs[_0x7fd4('0x4c')](_0x5607d9['query'][_0x7fd4('0x4c')]));_0x18942d[_0x7fd4('0x38')]=_0x18942d[_0x7fd4('0x38')]['length']?_0x18942d[_0x7fd4('0x38')]:_0x217d4f['model'];_0x18942d['order']=qs[_0x7fd4('0x3d')](_0x5607d9[_0x7fd4('0x36')][_0x7fd4('0x3d')]);_0x18942d[_0x7fd4('0x3e')]=qs[_0x7fd4('0x3f')](_[_0x7fd4('0x9a')](_0x5607d9[_0x7fd4('0x36')],_0x217d4f['filters']));if(_0x5607d9[_0x7fd4('0x36')]['filter']){_0x18942d[_0x7fd4('0x3e')]=_['merge'](_0x18942d[_0x7fd4('0x3e')],{'$or':_[_0x7fd4('0x34')](_0x18942d[_0x7fd4('0x38')],function(_0x501fdd){var _0x45c635={};_0x45c635[_0x501fdd]={'$like':'%'+_0x5607d9[_0x7fd4('0x36')]['filter']+'%'};return _0x45c635;})});}_0x18942d=_[_0x7fd4('0x41')]({},_0x18942d,_0x5607d9['options']);return _0x48d46a['getAgents'](_0x18942d);}})[_0x7fd4('0x43')](function(_0x10be61){if(_0x10be61){_0xd0fece=_0x10be61[_0x7fd4('0x39')];if(!_0x5607d9['query'][_0x7fd4('0x3a')](_0x7fd4('0x3b'))){_0x18942d[_0x7fd4('0x23')]=qs[_0x7fd4('0x23')](_0x5607d9[_0x7fd4('0x36')]['limit']);_0x18942d[_0x7fd4('0x24')]=qs[_0x7fd4('0x24')](_0x5607d9[_0x7fd4('0x36')][_0x7fd4('0x24')]);}return _0x48d46a['getAgents'](_0x18942d);}})[_0x7fd4('0x43')](function(_0x3dab5f){if(_0x3dab5f){return _0x3dab5f?{'count':_0xd0fece,'rows':_0x3dab5f}:null;}})['then'](respondWithResult(_0x483961,null))['catch'](handleError(_0x483961,null));}; \ No newline at end of file +var _0x0cf4=['./team.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','name','index','map','Team','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','VIRTUAL','merge','findAll','then','rows','show','params','includeAll','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','sequelize','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','UserMailQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','pick','options','toLowerCase','Queues','ids','removeQueues','isValidChannel','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','penalty','QueueId','User','findOrCreate','emit','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','TeamVoiceQueue','all','Openchannel','removeAgents','Queue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis'];(function(_0x32574a,_0x583170){var _0x534081=function(_0x3c6fb2){while(--_0x3c6fb2){_0x32574a['push'](_0x32574a['shift']());}};_0x534081(++_0x583170);}(_0x0cf4,0x7c));var _0x40cf=function(_0x1f2b50,_0x20b570){_0x1f2b50=_0x1f2b50-0x0;var _0x5675c1=_0x0cf4[_0x1f2b50];return _0x5675c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40cf('0x0'));var zipdir=require(_0x40cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40cf('0x2'));var moment=require(_0x40cf('0x3'));var BPromise=require(_0x40cf('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x40cf('0x5'));var sox=require('sox');var csv=require(_0x40cf('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40cf('0x7'));var squel=require(_0x40cf('0x8'));var crypto=require(_0x40cf('0x9'));var jsforce=require(_0x40cf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x40cf('0xb'));var Redis=require(_0x40cf('0xc'));var authService=require(_0x40cf('0xd'));var qs=require(_0x40cf('0xe'));var as=require(_0x40cf('0xf'));var hardwareService=require(_0x40cf('0x10'));var logger=require(_0x40cf('0x11'))(_0x40cf('0x12'));var utils=require(_0x40cf('0x13'));var config=require(_0x40cf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x40cf('0x15'))['db'];config['redis']=_[_0x40cf('0x16')](config['redis'],{'host':_0x40cf('0x17'),'port':0x18eb});var socket=require(_0x40cf('0x18'))(new Redis(config[_0x40cf('0x19')]));require(_0x40cf('0x1a'))[_0x40cf('0x1b')](socket);function respondWithStatusCode(_0x267345,_0x28f021){_0x28f021=_0x28f021||0xcc;return function(_0x4c40c4){if(_0x4c40c4){return _0x267345[_0x40cf('0x1c')](_0x28f021);}return _0x267345[_0x40cf('0x1d')](_0x28f021)[_0x40cf('0x1e')]();};}function respondWithResult(_0x87cadc,_0x22009b){_0x22009b=_0x22009b||0xc8;return function(_0x17086b){if(_0x17086b){return _0x87cadc[_0x40cf('0x1d')](_0x22009b)[_0x40cf('0x1f')](_0x17086b);}};}function respondWithFilteredResult(_0xcd61fe,_0x3b3bea){return function(_0x449f2e){if(_0x449f2e){var _0x4127fb=typeof _0x3b3bea[_0x40cf('0x20')]===_0x40cf('0x21')&&typeof _0x3b3bea['limit']===_0x40cf('0x21');var _0x5605ee=_0x449f2e[_0x40cf('0x22')];var _0x5e0d73=_0x4127fb?0x0:_0x3b3bea[_0x40cf('0x20')];var _0x5b8f9f=_0x4127fb?_0x449f2e[_0x40cf('0x22')]:_0x3b3bea[_0x40cf('0x20')]+_0x3b3bea['limit'];var _0x8bb950;if(_0x5b8f9f>=_0x5605ee){_0x5b8f9f=_0x5605ee;_0x8bb950=0xc8;}else{_0x8bb950=0xce;}_0xcd61fe[_0x40cf('0x1d')](_0x8bb950);return _0xcd61fe[_0x40cf('0x23')](_0x40cf('0x24'),_0x5e0d73+'-'+_0x5b8f9f+'/'+_0x5605ee)[_0x40cf('0x1f')](_0x449f2e);}return null;};}function patchUpdates(_0x483400){return function(_0x229e35){try{jsonpatch[_0x40cf('0x25')](_0x229e35,_0x483400,!![]);}catch(_0x107549){return BPromise[_0x40cf('0x26')](_0x107549);}return _0x229e35['save']();};}function saveUpdates(_0x251d84,_0xca0245){return function(_0x183ecf){if(_0x183ecf){return _0x183ecf[_0x40cf('0x27')](_0x251d84)['then'](function(_0x583b71){return _0x583b71;});}return null;};}function handleEntityNotFound(_0x230c7d,_0x1cb301){return function(_0x2c77df){if(!_0x2c77df){_0x230c7d['sendStatus'](0x194);}return _0x2c77df;};}function handleError(_0x2a2667,_0x418dee){_0x418dee=_0x418dee||0x1f4;return function(_0x65f5be){logger['error'](_0x65f5be['stack']);if(_0x65f5be[_0x40cf('0x28')]){delete _0x65f5be[_0x40cf('0x28')];}_0x2a2667[_0x40cf('0x1d')](_0x418dee)['send'](_0x65f5be);};}exports[_0x40cf('0x29')]=function(_0x576759,_0x15cb3b){var _0x1326ff={},_0x35b699={},_0x3c0fdf={'count':0x0,'rows':[]};var _0x2ee9e1=_[_0x40cf('0x2a')](db[_0x40cf('0x2b')][_0x40cf('0x2c')],function(_0x2fd341){return{'name':_0x2fd341['fieldName'],'type':_0x2fd341[_0x40cf('0x2d')][_0x40cf('0x2e')]};});_0x35b699[_0x40cf('0x2f')]=_[_0x40cf('0x2a')](_0x2ee9e1,'name');_0x35b699[_0x40cf('0x30')]=_[_0x40cf('0x31')](_0x576759[_0x40cf('0x30')]);_0x35b699[_0x40cf('0x32')]=_['intersection'](_0x35b699[_0x40cf('0x2f')],_0x35b699[_0x40cf('0x30')]);_0x1326ff[_0x40cf('0x33')]=_[_0x40cf('0x34')](_0x35b699[_0x40cf('0x2f')],qs['fields'](_0x576759[_0x40cf('0x30')][_0x40cf('0x35')]));_0x1326ff[_0x40cf('0x33')]=_0x1326ff[_0x40cf('0x33')][_0x40cf('0x36')]?_0x1326ff[_0x40cf('0x33')]:_0x35b699[_0x40cf('0x2f')];if(!_0x576759[_0x40cf('0x30')]['hasOwnProperty']('nolimit')){_0x1326ff['limit']=qs[_0x40cf('0x37')](_0x576759[_0x40cf('0x30')][_0x40cf('0x37')]);_0x1326ff[_0x40cf('0x20')]=qs[_0x40cf('0x20')](_0x576759[_0x40cf('0x30')][_0x40cf('0x20')]);}_0x1326ff[_0x40cf('0x38')]=qs[_0x40cf('0x39')](_0x576759[_0x40cf('0x30')][_0x40cf('0x39')]);_0x1326ff[_0x40cf('0x3a')]=qs[_0x40cf('0x32')](_['pick'](_0x576759[_0x40cf('0x30')],_0x35b699[_0x40cf('0x32')]),_0x2ee9e1);if(_0x576759[_0x40cf('0x30')][_0x40cf('0x3b')]){_0x1326ff[_0x40cf('0x3a')]=_['merge'](_0x1326ff['where'],{'$or':_['map'](_0x2ee9e1,function(_0x1b4d09){if(_0x1b4d09['type']!==_0x40cf('0x3c')){var _0x4a037b={};_0x4a037b[_0x1b4d09[_0x40cf('0x28')]]={'$like':'%'+_0x576759[_0x40cf('0x30')][_0x40cf('0x3b')]+'%'};return _0x4a037b;}})});}_0x1326ff=_[_0x40cf('0x3d')]({},_0x1326ff,_0x576759['options']);var _0x20bda5={'where':_0x1326ff[_0x40cf('0x3a')]};return db[_0x40cf('0x2b')][_0x40cf('0x22')](_0x20bda5)['then'](function(_0xd252d4){_0x3c0fdf[_0x40cf('0x22')]=_0xd252d4;if(_0x576759[_0x40cf('0x30')]['includeAll']){_0x1326ff['include']=[{'all':!![]}];}return db[_0x40cf('0x2b')][_0x40cf('0x3e')](_0x1326ff);})[_0x40cf('0x3f')](function(_0x20defd){_0x3c0fdf[_0x40cf('0x40')]=_0x20defd;return _0x3c0fdf;})[_0x40cf('0x3f')](respondWithFilteredResult(_0x15cb3b,_0x1326ff))['catch'](handleError(_0x15cb3b,null));};exports[_0x40cf('0x41')]=function(_0x3dd956,_0x3166b6){var _0x22add8={'raw':![],'where':{'id':_0x3dd956[_0x40cf('0x42')]['id']}},_0x2c9b26={};_0x2c9b26[_0x40cf('0x2f')]=_[_0x40cf('0x31')](db[_0x40cf('0x2b')][_0x40cf('0x2c')]);_0x2c9b26['query']=_[_0x40cf('0x31')](_0x3dd956['query']);_0x2c9b26[_0x40cf('0x32')]=_[_0x40cf('0x34')](_0x2c9b26[_0x40cf('0x2f')],_0x2c9b26['query']);_0x22add8['attributes']=_[_0x40cf('0x34')](_0x2c9b26['model'],qs[_0x40cf('0x35')](_0x3dd956[_0x40cf('0x30')][_0x40cf('0x35')]));_0x22add8['attributes']=_0x22add8[_0x40cf('0x33')][_0x40cf('0x36')]?_0x22add8[_0x40cf('0x33')]:_0x2c9b26[_0x40cf('0x2f')];if(_0x3dd956[_0x40cf('0x30')][_0x40cf('0x43')]){_0x22add8[_0x40cf('0x44')]=[{'all':!![]}];}_0x22add8=_[_0x40cf('0x3d')]({},_0x22add8,_0x3dd956['options']);return db[_0x40cf('0x2b')]['find'](_0x22add8)[_0x40cf('0x3f')](handleEntityNotFound(_0x3166b6,null))[_0x40cf('0x3f')](respondWithResult(_0x3166b6,null))['catch'](handleError(_0x3166b6,null));};exports[_0x40cf('0x45')]=function(_0x10e0f1,_0x368073){return db['Team'][_0x40cf('0x45')](_0x10e0f1['body'],{})['then'](function(_0x565694){var _0x2521f7=_0x10e0f1[_0x40cf('0x46')][_0x40cf('0x47')]({'plain':!![]});if(!_0x2521f7)throw new Error(_0x40cf('0x48'));if(_0x2521f7[_0x40cf('0x49')]==='user'){var _0x4064b6=_0x565694['get']({'plain':!![]});var _0x3eb24e=_0x40cf('0x4a');return db[_0x40cf('0x4b')]['find']({'where':{'name':_0x3eb24e,'userProfileId':_0x2521f7[_0x40cf('0x4c')]},'raw':!![]})[_0x40cf('0x3f')](function(_0x4cab7c){if(_0x4cab7c&&_0x4cab7c[_0x40cf('0x4d')]===0x0){return db[_0x40cf('0x4e')][_0x40cf('0x45')]({'name':_0x4064b6[_0x40cf('0x28')],'resourceId':_0x4064b6['id'],'type':_0x4cab7c[_0x40cf('0x28')],'sectionId':_0x4cab7c['id']},{})[_0x40cf('0x3f')](function(){return _0x565694;});}else{return _0x565694;}})[_0x40cf('0x4f')](function(_0xb552e8){logger[_0x40cf('0x50')](_0x40cf('0x51'),_0xb552e8);throw _0xb552e8;});}return _0x565694;})[_0x40cf('0x3f')](respondWithResult(_0x368073,0xc9))[_0x40cf('0x4f')](handleError(_0x368073,null));};exports[_0x40cf('0x27')]=function(_0x5b53b3,_0x5bf324){if(_0x5b53b3[_0x40cf('0x52')]['id']){delete _0x5b53b3['body']['id'];}return db[_0x40cf('0x2b')][_0x40cf('0x53')]({'where':{'id':_0x5b53b3['params']['id']}})['then'](handleEntityNotFound(_0x5bf324,null))[_0x40cf('0x3f')](saveUpdates(_0x5b53b3['body'],null))[_0x40cf('0x3f')](respondWithResult(_0x5bf324,null))[_0x40cf('0x4f')](handleError(_0x5bf324,null));};exports['destroy']=function(_0x5048e3,_0x253b9f){var _0x192160=_0x5048e3['params']['id'];var _0xd48ff7=[];return db[_0x40cf('0x54')][_0x40cf('0x55')](function(_0x202a8b){var _0x1a9b21='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x192160;return db[_0x40cf('0x54')][_0x40cf('0x30')](_0x1a9b21,{'type':db[_0x40cf('0x56')]['QueryTypes'][_0x40cf('0x57')],'raw':!![],'transaction':_0x202a8b})['then'](function(_0x3ed267){_0xd48ff7=_[_0x40cf('0x2a')](_0x3ed267,function(_0x15cfe0){return Number(_0x15cfe0[_0x40cf('0x58')]);});})[_0x40cf('0x3f')](function(){var _0x3539bc=_0x40cf('0x59')+_0x192160;return db['sequelize'][_0x40cf('0x30')](_0x3539bc,{'type':db[_0x40cf('0x56')]['QueryTypes'][_0x40cf('0x57')],'raw':!![],'transaction':_0x202a8b});})['then'](function(_0x71dfbb){var _0x61d9b4=_['map'](_0x71dfbb,function(_0x34bf4c){return Number(_0x34bf4c[_0x40cf('0x5a')]);});return db[_0x40cf('0x5b')]['destroy']({'where':{'UserId':{'$in':_0xd48ff7},'VoiceQueueId':{'$in':_0x61d9b4}},'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(){var _0x449041=_0x40cf('0x5c')+_0x192160;return db[_0x40cf('0x54')][_0x40cf('0x30')](_0x449041,{'type':db['Sequelize'][_0x40cf('0x5d')]['SELECT'],'raw':!![],'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(_0x1221fa){var _0x4ab33b=_[_0x40cf('0x2a')](_0x1221fa,function(_0x288582){return Number(_0x288582[_0x40cf('0x5e')]);});return db[_0x40cf('0x5f')][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'MailQueueId':{'$in':_0x4ab33b}},'transaction':_0x202a8b});})['then'](function(){var _0x55fddd=_0x40cf('0x61')+_0x192160;return db[_0x40cf('0x54')][_0x40cf('0x30')](_0x55fddd,{'type':db[_0x40cf('0x56')][_0x40cf('0x5d')]['SELECT'],'raw':!![],'transaction':_0x202a8b});})['then'](function(_0x3de43e){var _0x4a571d=_[_0x40cf('0x2a')](_0x3de43e,function(_0x22edcc){return Number(_0x22edcc[_0x40cf('0x62')]);});return db[_0x40cf('0x63')][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'SmsQueueId':{'$in':_0x4a571d}},'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(){var _0x3f61ea='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x192160;return db[_0x40cf('0x54')][_0x40cf('0x30')](_0x3f61ea,{'type':db['Sequelize'][_0x40cf('0x5d')][_0x40cf('0x57')],'raw':!![],'transaction':_0x202a8b});})['then'](function(_0x334ff7){var _0x3574af=_[_0x40cf('0x2a')](_0x334ff7,function(_0x5b5974){return Number(_0x5b5974[_0x40cf('0x64')]);});return db[_0x40cf('0x65')][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'ChatQueueId':{'$in':_0x3574af}},'transaction':_0x202a8b});})['then'](function(){var _0xa3aa78=_0x40cf('0x66')+_0x192160;return db[_0x40cf('0x54')]['query'](_0xa3aa78,{'type':db[_0x40cf('0x56')][_0x40cf('0x5d')][_0x40cf('0x57')],'raw':!![],'transaction':_0x202a8b});})['then'](function(_0x5b033f){var _0x58ac62=_[_0x40cf('0x2a')](_0x5b033f,function(_0x27c438){return Number(_0x27c438['FaxQueueId']);});return db['UserFaxQueue'][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'FaxQueueId':{'$in':_0x58ac62}},'transaction':_0x202a8b});})['then'](function(){var _0x5dbade='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x192160;return db[_0x40cf('0x54')][_0x40cf('0x30')](_0x5dbade,{'type':db[_0x40cf('0x56')][_0x40cf('0x5d')][_0x40cf('0x57')],'raw':!![],'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(_0x1a3278){var _0x1e7993=_[_0x40cf('0x2a')](_0x1a3278,function(_0x597782){return Number(_0x597782[_0x40cf('0x67')]);});return db[_0x40cf('0x68')][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'OpenchannelQueueId':{'$in':_0x1e7993}},'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(){var _0x5009c5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x192160;return db[_0x40cf('0x54')][_0x40cf('0x30')](_0x5009c5,{'type':db['Sequelize'][_0x40cf('0x5d')]['SELECT'],'raw':!![],'transaction':_0x202a8b});})['then'](function(_0x2cae66){var _0x3059fc=_['map'](_0x2cae66,function(_0x3c9be0){return Number(_0x3c9be0[_0x40cf('0x69')]);});return db[_0x40cf('0x6a')][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'WhatsappQueueId':{'$in':_0x3059fc}},'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(){return db[_0x40cf('0x6b')][_0x40cf('0x53')]({'where':{'TeamId':_0x192160}});})['then'](function(_0x285279){if(_0x285279===null){return;}return db[_0x40cf('0x6c')][_0x40cf('0x60')]({'where':{'UserId':{'$in':_0xd48ff7},'VoicePrefixId':_0x285279[_0x40cf('0x6d')]},'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(){return db['Team'][_0x40cf('0x60')]({'where':{'id':_0x192160},'cascade':!![],'transaction':_0x202a8b});})[_0x40cf('0x3f')](function(_0x2f9f7b){if(_0x2f9f7b===0x0){_0x253b9f[_0x40cf('0x1c')](0x194);}else{return db[_0x40cf('0x4e')][_0x40cf('0x60')]({'where':{'type':'Teams','resourceId':_0x192160},'cascade':!![],'transaction':_0x202a8b})[_0x40cf('0x3f')](function(){_0x253b9f['status'](0xcc)[_0x40cf('0x1e')]();});}})['catch'](function(_0x2721c6){_0x253b9f[_0x40cf('0x1d')](0x1f4)[_0x40cf('0x6e')](_0x2721c6);});});};exports['getQueues']=function(_0x3b6642,_0x538984,_0x106287){return db[_0x40cf('0x2b')][_0x40cf('0x6f')]({'where':{'id':_0x3b6642[_0x40cf('0x42')]['id']}})[_0x40cf('0x3f')](handleEntityNotFound(_0x538984,null))['then'](function(_0x118cee){if(!_0x3b6642['query'][_0x40cf('0x70')]||!utils['isValidChannel'](_0x3b6642[_0x40cf('0x30')]['channel'])){throw new db[(_0x40cf('0x56'))][(_0x40cf('0x71'))](_0x40cf('0x72'));}var _0x16c7c9={};var _0x2cce86={};_0x2cce86['model']=_[_0x40cf('0x31')](db[_[_0x40cf('0x73')](_0x3b6642[_0x40cf('0x30')]['channel']['toLowerCase']())+_0x40cf('0x74')][_0x40cf('0x2c')]);_0x2cce86['query']=_['keys'](_0x3b6642[_0x40cf('0x30')]);_0x2cce86[_0x40cf('0x32')]=_[_0x40cf('0x34')](_0x2cce86[_0x40cf('0x2f')],_0x2cce86['query']);_0x16c7c9[_0x40cf('0x33')]=_[_0x40cf('0x34')](_0x2cce86[_0x40cf('0x2f')],qs['fields'](_0x3b6642['query'][_0x40cf('0x35')]));_0x16c7c9[_0x40cf('0x33')]=_0x16c7c9['attributes']['length']?_0x16c7c9['attributes']:_0x2cce86[_0x40cf('0x2f')];_0x16c7c9[_0x40cf('0x37')]=qs[_0x40cf('0x37')](_0x3b6642['query']['limit']);_0x16c7c9['offset']=qs[_0x40cf('0x20')](_0x3b6642[_0x40cf('0x30')]['offset']);_0x16c7c9[_0x40cf('0x38')]=qs[_0x40cf('0x39')](_0x3b6642[_0x40cf('0x30')][_0x40cf('0x39')]);_0x16c7c9[_0x40cf('0x3a')]=qs[_0x40cf('0x32')](_[_0x40cf('0x75')](_0x3b6642[_0x40cf('0x30')],_0x2cce86[_0x40cf('0x32')]));_0x16c7c9=_[_0x40cf('0x3d')]({},_0x16c7c9,_0x3b6642[_0x40cf('0x76')]);return _0x118cee[_0x40cf('0x47')+_[_0x40cf('0x73')](_0x3b6642[_0x40cf('0x30')][_0x40cf('0x70')][_0x40cf('0x77')]())+_0x40cf('0x78')](_0x16c7c9);})[_0x40cf('0x3f')](respondWithResult(_0x538984,null))['catch'](handleError(_0x538984,null));};exports['addQueues']=function(_0x36e596,_0x4fd0a1,_0x2ee769){return db[_0x40cf('0x2b')]['findOne']({'where':{'id':_0x36e596['params']['id']}})[_0x40cf('0x3f')](function(_0x4a4b02){if(_0x4a4b02){if(!_0x36e596[_0x40cf('0x52')][_0x40cf('0x70')]||!utils['isValidChannel'](_0x36e596['body'][_0x40cf('0x70')])){throw new db['Sequelize'][(_0x40cf('0x71'))](_0x40cf('0x72'));}return _0x4a4b02['add'+_[_0x40cf('0x73')](_0x36e596['body'][_0x40cf('0x70')]['toLowerCase']())+_0x40cf('0x78')](_0x36e596[_0x40cf('0x52')][_0x40cf('0x79')]);}return null;})[_0x40cf('0x3f')](handleEntityNotFound(_0x4fd0a1,null))[_0x40cf('0x3f')](respondWithStatusCode(_0x4fd0a1,null))[_0x40cf('0x4f')](handleError(_0x4fd0a1,null));};exports[_0x40cf('0x7a')]=function(_0x3a36f6,_0xedea1a,_0x316cd7){return db['Team'][_0x40cf('0x6f')]({'where':{'id':_0x3a36f6[_0x40cf('0x42')]['id']}})[_0x40cf('0x3f')](function(_0x2a391e){if(_0x2a391e){if(!_0x3a36f6[_0x40cf('0x30')][_0x40cf('0x70')]||!utils[_0x40cf('0x7b')](_0x3a36f6[_0x40cf('0x30')][_0x40cf('0x70')])){throw new db['Sequelize'][(_0x40cf('0x71'))](_0x40cf('0x72'));}return _0x2a391e[_0x40cf('0x7c')+_[_0x40cf('0x73')](_0x3a36f6[_0x40cf('0x30')]['channel'][_0x40cf('0x77')]())+'Queues'](_0x3a36f6[_0x40cf('0x30')][_0x40cf('0x79')]);}return null;})[_0x40cf('0x3f')](handleEntityNotFound(_0xedea1a,null))['then'](respondWithStatusCode(_0xedea1a,null))[_0x40cf('0x4f')](handleError(_0xedea1a,null));};exports[_0x40cf('0x7d')]=function(_0x13528b,_0x5962b4){var _0x3382db=_[_0x40cf('0x7e')](_0x13528b[_0x40cf('0x52')][_0x40cf('0x79')])?_0x13528b[_0x40cf('0x52')][_0x40cf('0x79')]:[_0x13528b[_0x40cf('0x52')][_0x40cf('0x79')]];var _0x3b8dc8=_0x13528b[_0x40cf('0x42')]['id'];return db[_0x40cf('0x2b')][_0x40cf('0x53')]({'where':{'id':_0x3b8dc8}})[_0x40cf('0x3f')](handleEntityNotFound(_0x5962b4,null))[_0x40cf('0x3f')](function(_0x3ccfee){if(_0x3ccfee){var _0x5e97b2=[_0x40cf('0x7f'),_0x40cf('0x80'),_0x40cf('0x81'),_0x40cf('0x82'),_0x40cf('0x83'),'Openchannel',_0x40cf('0x84')];return db[_0x40cf('0x54')][_0x40cf('0x55')](function(_0x396e3c){var _0x57af42=_['map'](_0x5e97b2,function(_0x1f2e47){var _0x3d5392={'attributes':['id',_0x40cf('0x28')]};if(_0x1f2e47==='Voice'){_0x3d5392['through']={'attributes':[_0x40cf('0x85')]};}return _0x3ccfee['get'+_0x1f2e47+_0x40cf('0x78')](_0x3d5392)[_0x40cf('0x3f')](function(_0x1357cb){var _0x2e25a0=_['map'](_0x1357cb,function(_0xcb36cc){var _0xd6b992=_[_0x40cf('0x2a')](_0x3382db,function(_0x577f4f){var _0xe98211={'where':{'UserId':_0x577f4f,[_0x1f2e47+_0x40cf('0x86')]:_0xcb36cc['id']},'transaction':_0x396e3c};if(_0x1f2e47===_0x40cf('0x7f')){_0xe98211[_0x40cf('0x16')]={'penalty':_0xcb36cc['TeamVoiceQueue'][_0x40cf('0x85')]};}return db[_0x40cf('0x87')+_0x1f2e47+_0x40cf('0x74')][_0x40cf('0x88')](_0xe98211)['then'](function(){socket[_0x40cf('0x89')](_0x40cf('0x46')+_0x1f2e47+'Queue:save',{'UserId':_0x577f4f,[_0x1f2e47+'QueueId']:_0xcb36cc['id']});if(_0x1f2e47!==_0x40cf('0x7f')){return;}return db['User'][_0x40cf('0x3e')]({'where':{'id':_0x3382db,'online':0x1},'attributes':['id',_0x40cf('0x28'),'online',_0x40cf('0x8a'),_0x40cf('0x8b')],'raw':!![]})['then'](function(_0xfadc95){var _0xb16652=_[_0x40cf('0x2a')](_0xfadc95,function(_0x2bdf8f){return db[_0x40cf('0x8c')][_0x40cf('0x8d')]({'membername':_0x2bdf8f[_0x40cf('0x28')],'UserId':_0x2bdf8f['id'],'queue_name':_0xcb36cc[_0x40cf('0x28')],'VoiceQueueId':_0xcb36cc['id'],'interface':_['isNil'](_0x2bdf8f[_0x40cf('0x8b')])?util[_0x40cf('0x8e')](_0x40cf('0x8f'),_0x2bdf8f[_0x40cf('0x28')]):_0x2bdf8f['interface'],'paused':_0x2bdf8f[_0x40cf('0x8a')]||![],'penalty':_0xcb36cc[_0x40cf('0x90')]['penalty']},{'transaction':_0x396e3c});});return Promise['all'](_0xb16652);});});});return Promise[_0x40cf('0x91')](_0xd6b992);});return Promise[_0x40cf('0x91')](_0x2e25a0);})[_0x40cf('0x3f')](function(){return db[_0x40cf('0x6b')][_0x40cf('0x6f')]({'where':{'teamId':_0x3b8dc8}})[_0x40cf('0x3f')](function(_0x14f73d){if(_0x14f73d){var _0x485211=_[_0x40cf('0x2a')](_0x3382db,function(_0x2b4158){db[_0x40cf('0x6c')]['upsert']({'UserId':_0x2b4158,'VoicePrefixId':_0x14f73d[_0x40cf('0x6d')]});});return Promise[_0x40cf('0x91')](_0x485211);}});});});return Promise[_0x40cf('0x91')](_0x57af42)[_0x40cf('0x3f')](function(){return _0x3ccfee[_0x40cf('0x7d')](_0x3382db,{'transaction':_0x396e3c})['spread'](function(_0x281f59){return _0x281f59;});});});}})[_0x40cf('0x3f')](respondWithResult(_0x5962b4,null))[_0x40cf('0x4f')](handleError(_0x5962b4,null));};exports['removeAgents']=function(_0x2dc425,_0x2727f5){var _0xa4d416=_[_0x40cf('0x7e')](_0x2dc425['query']['ids'])?_0x2dc425[_0x40cf('0x30')][_0x40cf('0x79')]:[_0x2dc425['query'][_0x40cf('0x79')]];var _0x3b0389=_0x2dc425[_0x40cf('0x42')]['id'];return db[_0x40cf('0x2b')][_0x40cf('0x53')]({'where':{'id':_0x3b0389}})[_0x40cf('0x3f')](handleEntityNotFound(_0x2727f5,null))[_0x40cf('0x3f')](function(_0x289688){if(_0x289688){var _0x362d2e=[_0x40cf('0x7f'),_0x40cf('0x80'),'Mail',_0x40cf('0x82'),'Fax',_0x40cf('0x92'),'Whatsapp'];return db[_0x40cf('0x54')][_0x40cf('0x55')](function(_0x55bd7c){var _0x1e6486=_[_0x40cf('0x2a')](_0x362d2e,function(_0x5d7303){var _0x2a4e47={'attributes':['id',_0x40cf('0x28')]};return _0x289688[_0x40cf('0x47')+_0x5d7303+_0x40cf('0x78')](_0x2a4e47)[_0x40cf('0x3f')](function(_0x2f29d6){var _0x36fec1=_[_0x40cf('0x2a')](_0x2f29d6,function(_0xe23853){return _0xe23853[_0x40cf('0x93')](_0xa4d416,{'transaction':_0x55bd7c})[_0x40cf('0x3f')](function(){var _0x3b7c61=_[_0x40cf('0x2a')](_0xa4d416,function(_0x5cb6ed){socket['emit'](_0x40cf('0x46')+_0x5d7303+_0x40cf('0x94'),{'UserId':Number(_0x5cb6ed),[_0x5d7303+_0x40cf('0x86')]:_0xe23853['id']});if(_0x5d7303!==_0x40cf('0x7f')){return;}return db[_0x40cf('0x8c')][_0x40cf('0x60')]({'where':{'VoiceQueueId':_0xe23853['id'],'UserId':_0x5cb6ed},'transaction':_0x55bd7c});});return Promise['all'](_0x3b7c61);});});return Promise['all'](_0x36fec1);});});return Promise[_0x40cf('0x91')](_0x1e6486)[_0x40cf('0x3f')](function(){return _0x289688[_0x40cf('0x93')](_0xa4d416,{'transaction':_0x55bd7c});})[_0x40cf('0x3f')](function(){return db[_0x40cf('0x6b')][_0x40cf('0x6f')]({'where':{'teamId':_0x3b0389}})[_0x40cf('0x3f')](function(_0x397470){if(_0x397470){var _0xd6d11d=_[_0x40cf('0x2a')](_0xa4d416,function(_0x332f39){db[_0x40cf('0x6c')][_0x40cf('0x60')]({'where':{'UserId':_0x332f39,'VoicePrefixId':_0x397470['VoicePrefixId']}});});return Promise['all'](_0xd6d11d);}});});});}})[_0x40cf('0x3f')](respondWithStatusCode(_0x2727f5,null))['catch'](handleError(_0x2727f5,null));};exports[_0x40cf('0x95')]=function(_0x539ec7,_0x2f974e,_0x296854){var _0x3c1494={};var _0x56eafb={};var _0x58269a;var _0x1b2774;return db[_0x40cf('0x2b')][_0x40cf('0x6f')]({'where':{'id':_0x539ec7[_0x40cf('0x42')]['id']}})[_0x40cf('0x3f')](handleEntityNotFound(_0x2f974e,null))['then'](function(_0x37e593){if(_0x37e593){_0x58269a=_0x37e593;_0x56eafb[_0x40cf('0x2f')]=_['keys'](db[_0x40cf('0x87')][_0x40cf('0x2c')]);_0x56eafb[_0x40cf('0x30')]=_[_0x40cf('0x31')](_0x539ec7['query']);_0x56eafb[_0x40cf('0x32')]=_[_0x40cf('0x34')](_0x56eafb[_0x40cf('0x2f')],_0x56eafb[_0x40cf('0x30')]);_0x3c1494['attributes']=_[_0x40cf('0x34')](_0x56eafb[_0x40cf('0x2f')],qs[_0x40cf('0x35')](_0x539ec7[_0x40cf('0x30')]['fields']));_0x3c1494['attributes']=_0x3c1494[_0x40cf('0x33')][_0x40cf('0x36')]?_0x3c1494[_0x40cf('0x33')]:_0x56eafb[_0x40cf('0x2f')];_0x3c1494[_0x40cf('0x38')]=qs[_0x40cf('0x39')](_0x539ec7[_0x40cf('0x30')]['sort']);_0x3c1494['where']=qs[_0x40cf('0x32')](_[_0x40cf('0x75')](_0x539ec7[_0x40cf('0x30')],_0x56eafb['filters']));if(_0x539ec7[_0x40cf('0x30')][_0x40cf('0x3b')]){_0x3c1494[_0x40cf('0x3a')]=_[_0x40cf('0x3d')](_0x3c1494['where'],{'$or':_[_0x40cf('0x2a')](_0x3c1494[_0x40cf('0x33')],function(_0x40edf2){var _0x15855d={};_0x15855d[_0x40edf2]={'$like':'%'+_0x539ec7[_0x40cf('0x30')][_0x40cf('0x3b')]+'%'};return _0x15855d;})});}_0x3c1494=_['merge']({},_0x3c1494,_0x539ec7[_0x40cf('0x76')]);return _0x58269a[_0x40cf('0x95')](_0x3c1494);}})[_0x40cf('0x3f')](function(_0x4f02c1){if(_0x4f02c1){_0x1b2774=_0x4f02c1['length'];if(!_0x539ec7['query']['hasOwnProperty']('nolimit')){_0x3c1494[_0x40cf('0x37')]=qs[_0x40cf('0x37')](_0x539ec7[_0x40cf('0x30')]['limit']);_0x3c1494[_0x40cf('0x20')]=qs[_0x40cf('0x20')](_0x539ec7[_0x40cf('0x30')][_0x40cf('0x20')]);}return _0x58269a[_0x40cf('0x95')](_0x3c1494);}})[_0x40cf('0x3f')](function(_0x295d42){if(_0x295d42){return _0x295d42?{'count':_0x1b2774,'rows':_0x295d42}:null;}})['then'](respondWithResult(_0x2f974e,null))[_0x40cf('0x4f')](handleError(_0x2f974e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2e01f16..425b1cf 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 _0x4a9d=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','Team','setMaxListeners','save'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x4a9d,0x1b5));var _0xd4a9=function(_0x11d6f0,_0xe996b2){_0x11d6f0=_0x11d6f0-0x0;var _0x49d492=_0x4a9d[_0x11d6f0];return _0x49d492;};'use strict';var EventEmitter=require('events');var Team=require(_0xd4a9('0x0'))['db'][_0xd4a9('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd4a9('0x2')](0x0);var events={'afterCreate':_0xd4a9('0x3'),'afterUpdate':_0xd4a9('0x4'),'afterDestroy':_0xd4a9('0x5')};function emitEvent(_0x5de848){return function(_0x1e84a6,_0x448b30,_0x44032f){TeamEvents[_0xd4a9('0x6')](_0x5de848+':'+_0x1e84a6['id'],_0x1e84a6);TeamEvents[_0xd4a9('0x6')](_0x5de848,_0x1e84a6);_0x44032f(null);};}for(var e in events){if(events[_0xd4a9('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd4a9('0x8')]=TeamEvents; \ No newline at end of file +var _0x777b=['setMaxListeners','save','update','emit','hasOwnProperty','events','Team'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x777b,0x15c));var _0xb777=function(_0x1efa2a,_0x50ea23){_0x1efa2a=_0x1efa2a-0x0;var _0x38e115=_0x777b[_0x1efa2a];return _0x38e115;};'use strict';var EventEmitter=require(_0xb777('0x0'));var Team=require('../../mysqldb')['db'][_0xb777('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xb777('0x2')](0x0);var events={'afterCreate':_0xb777('0x3'),'afterUpdate':_0xb777('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa7f992){return function(_0x2c6bb7,_0x419ad9,_0x2d9635){TeamEvents[_0xb777('0x5')](_0xa7f992+':'+_0x2c6bb7['id'],_0x2c6bb7);TeamEvents['emit'](_0xa7f992,_0x2c6bb7);_0x2d9635(null);};}for(var e in events){if(events[_0xb777('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index add697c..180cb6c 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 _0xd8db=['define','Team','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','all','./team.attributes','Queues','then','map','setDataValue','channel','catch','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd8db,0xd0));var _0xbd8d=function(_0x3ba422,_0x53303c){_0x3ba422=_0x3ba422-0x0;var _0x20b5dd=_0xd8db[_0x3ba422];return _0x20b5dd;};'use strict';var _=require('lodash');var attributes=require(_0xbd8d('0x0'));function getQueuesByChannel(_0x5c6dfe,_0x5cf63f){var _0x285119='get'+_0x5cf63f+_0xbd8d('0x1');return _0x5c6dfe[_0x285119]()[_0xbd8d('0x2')](function(_0x28d7a2){return _[_0xbd8d('0x3')](_0x28d7a2,function(_0x41d361){_0x41d361[_0xbd8d('0x4')](_0xbd8d('0x5'),_0x5cf63f);return _0x41d361;});})[_0xbd8d('0x6')](function(_0x4a5984){throw _0x4a5984;});}module[_0xbd8d('0x7')]=function(_0x1068a6){return _0x1068a6[_0xbd8d('0x8')](_0xbd8d('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x37248d=this;var _0x29b706=[_0xbd8d('0xa'),_0xbd8d('0xb'),_0xbd8d('0xc'),_0xbd8d('0xd'),_0xbd8d('0xe'),_0xbd8d('0xf'),_0xbd8d('0x10')];return Promise['resolve']()[_0xbd8d('0x2')](function(){var _0x2f575d=_[_0xbd8d('0x3')](_0x29b706,function(_0x51dd12){return getQueuesByChannel(_0x37248d,_0x51dd12);});return Promise[_0xbd8d('0x11')](_0x2f575d);})[_0xbd8d('0x6')](function(_0x556acd){throw _0x556acd;});}}});}; \ No newline at end of file +var _0xc6cb=['channel','catch','exports','define','Team','teams','Chat','Mail','Openchannel','Sms','resolve','all','lodash','Queues','then','map','setDataValue'];(function(_0x236912,_0x4167cd){var _0x582904=function(_0x3d9a19){while(--_0x3d9a19){_0x236912['push'](_0x236912['shift']());}};_0x582904(++_0x4167cd);}(_0xc6cb,0x182));var _0xbc6c=function(_0x500a52,_0xbd1990){_0x500a52=_0x500a52-0x0;var _0x54f8c4=_0xc6cb[_0x500a52];return _0x54f8c4;};'use strict';var _=require(_0xbc6c('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x3ca782,_0x307498){var _0x115b69='get'+_0x307498+_0xbc6c('0x1');return _0x3ca782[_0x115b69]()[_0xbc6c('0x2')](function(_0x4d22e9){return _[_0xbc6c('0x3')](_0x4d22e9,function(_0x5494cb){_0x5494cb[_0xbc6c('0x4')](_0xbc6c('0x5'),_0x307498);return _0x5494cb;});})[_0xbc6c('0x6')](function(_0x233d7c){throw _0x233d7c;});}module[_0xbc6c('0x7')]=function(_0x524a40){return _0x524a40[_0xbc6c('0x8')](_0xbc6c('0x9'),attributes,{'tableName':_0xbc6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x446372=this;var _0x3404eb=[_0xbc6c('0xb'),'Fax',_0xbc6c('0xc'),_0xbc6c('0xd'),_0xbc6c('0xe'),'Voice','Whatsapp'];return Promise[_0xbc6c('0xf')]()[_0xbc6c('0x2')](function(){var _0x29b2d9=_[_0xbc6c('0x3')](_0x3404eb,function(_0xf3eb03){return getQueuesByChannel(_0x446372,_0xf3eb03);});return Promise[_0xbc6c('0x10')](_0x29b2d9);})[_0xbc6c('0x6')](function(_0xa8e7cd){throw _0xa8e7cd;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4320a0a..46b7cb6 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 _0x0411=['register','request','then','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','localhost','socket.io-emitter','redis','./team.socket'];(function(_0x594821,_0x153b6c){var _0x139112=function(_0x105337){while(--_0x105337){_0x594821['push'](_0x594821['shift']());}};_0x139112(++_0x153b6c);}(_0x0411,0x15d));var _0x1041=function(_0x1ccefa,_0x5f0dd9){_0x1ccefa=_0x1ccefa-0x0;var _0x2ffc70=_0x0411[_0x1ccefa];return _0x2ffc70;};'use strict';var _=require(_0x1041('0x0'));var util=require(_0x1041('0x1'));var moment=require(_0x1041('0x2'));var BPromise=require(_0x1041('0x3'));var rs=require(_0x1041('0x4'));var fs=require('fs');var Redis=require(_0x1041('0x5'));var db=require(_0x1041('0x6'))['db'];var utils=require(_0x1041('0x7'));var logger=require(_0x1041('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1041('0x9'));var client=jayson[_0x1041('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1041('0xb'),'port':0x18eb});var socket=require(_0x1041('0xc'))(new Redis(config[_0x1041('0xd')]));require(_0x1041('0xe'))[_0x1041('0xf')](socket);function respondWithRpcPromise(_0x3205e5,_0x6c62a1,_0x10a3bb){return new BPromise(function(_0x55c7e3,_0x2f02aa){return client[_0x1041('0x10')](_0x3205e5,_0x10a3bb)[_0x1041('0x11')](function(_0x1ac87b){logger['info']('Team,\x20%s,\x20%s',_0x6c62a1,'request\x20sent');logger[_0x1041('0x12')](_0x1041('0x13'),_0x6c62a1,_0x1041('0x14'),JSON[_0x1041('0x15')](_0x1ac87b));if(_0x1ac87b[_0x1041('0x16')]){if(_0x1ac87b[_0x1041('0x16')][_0x1041('0x17')]===0x1f4){logger[_0x1041('0x16')](_0x1041('0x18'),_0x6c62a1,_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);return _0x2f02aa(_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);}logger[_0x1041('0x16')](_0x1041('0x18'),_0x6c62a1,_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);return _0x55c7e3(_0x1ac87b[_0x1041('0x16')][_0x1041('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x6c62a1,_0x1041('0x14'));_0x55c7e3(_0x1ac87b[_0x1041('0x1a')]['message']);}})[_0x1041('0x1b')](function(_0x327c6c){logger['error'](_0x1041('0x18'),_0x6c62a1,_0x327c6c);_0x2f02aa(_0x327c6c);});});} \ No newline at end of file +var _0xa9c8=['randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0xa9c8,0x11c));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8a9c('0x0'));var BPromise=require(_0x8a9c('0x1'));var rs=require(_0x8a9c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a9c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a9c('0x4'))(_0x8a9c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a9c('0x6')][_0x8a9c('0x7')]({'port':0x232a});config[_0x8a9c('0x8')]=_[_0x8a9c('0x9')](config[_0x8a9c('0x8')],{'host':_0x8a9c('0xa'),'port':0x18eb});var socket=require(_0x8a9c('0xb'))(new Redis(config['redis']));require(_0x8a9c('0xc'))[_0x8a9c('0xd')](socket);function respondWithRpcPromise(_0x7d8b69,_0xfca5c6,_0x20a839){return new BPromise(function(_0x4719f5,_0x413792){return client[_0x8a9c('0xe')](_0x7d8b69,_0x20a839)[_0x8a9c('0xf')](function(_0x24d78a){logger[_0x8a9c('0x10')](_0x8a9c('0x11'),_0xfca5c6,'request\x20sent');logger[_0x8a9c('0x12')](_0x8a9c('0x13'),_0xfca5c6,_0x8a9c('0x14'),JSON[_0x8a9c('0x15')](_0x24d78a));if(_0x24d78a[_0x8a9c('0x16')]){if(_0x24d78a[_0x8a9c('0x16')][_0x8a9c('0x17')]===0x1f4){logger[_0x8a9c('0x16')](_0x8a9c('0x11'),_0xfca5c6,_0x24d78a[_0x8a9c('0x16')][_0x8a9c('0x18')]);return _0x413792(_0x24d78a[_0x8a9c('0x16')][_0x8a9c('0x18')]);}logger[_0x8a9c('0x16')]('Team,\x20%s,\x20%s',_0xfca5c6,_0x24d78a['error']['message']);return _0x4719f5(_0x24d78a[_0x8a9c('0x16')]['message']);}else{logger[_0x8a9c('0x10')](_0x8a9c('0x11'),_0xfca5c6,_0x8a9c('0x14'));_0x4719f5(_0x24d78a[_0x8a9c('0x19')][_0x8a9c('0x18')]);}})['catch'](function(_0xb20a61){logger['error']('Team,\x20%s,\x20%s',_0xfca5c6,_0xb20a61);_0x413792(_0xb20a61);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 98629bb..6743066 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 _0x0036=['removeListener','register','team:','./team.events','save','remove','update','emit'];(function(_0x175d2b,_0x334432){var _0x581c71=function(_0x5cee18){while(--_0x5cee18){_0x175d2b['push'](_0x175d2b['shift']());}};_0x581c71(++_0x334432);}(_0x0036,0x73));var _0x6003=function(_0x510810,_0x5ba056){_0x510810=_0x510810-0x0;var _0x3b2990=_0x0036[_0x510810];return _0x3b2990;};'use strict';var TeamEvents=require(_0x6003('0x0'));var events=[_0x6003('0x1'),_0x6003('0x2'),_0x6003('0x3')];function createListener(_0x31bb7e,_0x41a61d){return function(_0x3aa11b){_0x41a61d[_0x6003('0x4')](_0x31bb7e,_0x3aa11b);};}function removeListener(_0x45bed1,_0x46cd97){return function(){TeamEvents[_0x6003('0x5')](_0x45bed1,_0x46cd97);};}exports[_0x6003('0x6')]=function(_0x159d55){for(var _0x23976c=0x0,_0x3ddcff=events['length'];_0x23976c<_0x3ddcff;_0x23976c++){var _0x1674ba=events[_0x23976c];var _0x1b6954=createListener(_0x6003('0x7')+_0x1674ba,_0x159d55);TeamEvents['on'](_0x1674ba,_0x1b6954);}}; \ No newline at end of file +var _0x3fe7=['save','remove','update','emit','removeListener','register','./team.events'];(function(_0x40cacb,_0x2d291f){var _0x57491f=function(_0x4b22bb){while(--_0x4b22bb){_0x40cacb['push'](_0x40cacb['shift']());}};_0x57491f(++_0x2d291f);}(_0x3fe7,0x125));var _0x73fe=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0x3fe7[_0x15f724];return _0x49b152;};'use strict';var TeamEvents=require(_0x73fe('0x0'));var events=[_0x73fe('0x1'),_0x73fe('0x2'),_0x73fe('0x3')];function createListener(_0x4d70c0,_0x421c71){return function(_0x498b0e){_0x421c71[_0x73fe('0x4')](_0x4d70c0,_0x498b0e);};}function removeListener(_0x4b7460,_0x509ad5){return function(){TeamEvents[_0x73fe('0x5')](_0x4b7460,_0x509ad5);};}exports[_0x73fe('0x6')]=function(_0x556b87){for(var _0x44df50=0x0,_0x1bf8c8=events['length'];_0x44df50<_0x1bf8c8;_0x44df50++){var _0x1cbbb9=events[_0x44df50];var _0x19bd6f=createListener('team:'+_0x1cbbb9,_0x556b87);TeamEvents['on'](_0x1cbbb9,_0x19bd6f);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6358d20..d5b5f4d 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 _0x8653=['INTEGER'];(function(_0x1bf473,_0x22acfe){var _0x3570ce=function(_0xb3b650){while(--_0xb3b650){_0x1bf473['push'](_0x1bf473['shift']());}};_0x3570ce(++_0x22acfe);}(_0x8653,0x17a));var _0x3865=function(_0x294b48,_0x11b96f){_0x294b48=_0x294b48-0x0;var _0x227273=_0x8653[_0x294b48];return _0x227273;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3865('0x0')]}}; \ No newline at end of file +var _0xea12=['exports','INTEGER','sequelize'];(function(_0x3c4f7c,_0x462787){var _0xb5b7cc=function(_0x555b7a){while(--_0x555b7a){_0x3c4f7c['push'](_0x3c4f7c['shift']());}};_0xb5b7cc(++_0x462787);}(_0xea12,0x149));var _0x2ea1=function(_0x50ec23,_0x3c11c0){_0x50ec23=_0x50ec23-0x0;var _0x223fb5=_0xea12[_0x50ec23];return _0x223fb5;};'use strict';var Sequelize=require(_0x2ea1('0x0'));module[_0x2ea1('0x1')]={'TeamId':{'type':Sequelize[_0x2ea1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2ea1('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index b97d8ff..a6b3d63 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 _0x8ba6=['bluebird','request-promise','path','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','moment'];(function(_0x318155,_0x38ac1f){var _0x226c00=function(_0x453eb0){while(--_0x453eb0){_0x318155['push'](_0x318155['shift']());}};_0x226c00(++_0x38ac1f);}(_0x8ba6,0x11b));var _0x68ba=function(_0x1d7b84,_0x1df5bf){_0x1d7b84=_0x1d7b84-0x0;var _0x1b8df7=_0x8ba6[_0x1d7b84];return _0x1b8df7;};'use strict';var _=require(_0x68ba('0x0'));var util=require('util');var logger=require(_0x68ba('0x1'))('api');var moment=require(_0x68ba('0x2'));var BPromise=require(_0x68ba('0x3'));var rp=require(_0x68ba('0x4'));var fs=require('fs');var path=require(_0x68ba('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x68ba('0x6'));module[_0x68ba('0x7')]=function(_0x14f5f6,_0x183957){return _0x14f5f6[_0x68ba('0x8')](_0x68ba('0x9'),attributes,{'tableName':_0x68ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88c3=['../../config/logger','bluebird','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x3650cc,_0x2489d6){var _0x165164=function(_0x107bca){while(--_0x107bca){_0x3650cc['push'](_0x3650cc['shift']());}};_0x165164(++_0x2489d6);}(_0x88c3,0x1ee));var _0x388c=function(_0x1be011,_0x2c9ccd){_0x1be011=_0x1be011-0x0;var _0x5eaf84=_0x88c3[_0x1be011];return _0x5eaf84;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var logger=require(_0x388c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var attributes=require(_0x388c('0x5'));module[_0x388c('0x6')]=function(_0x28ed4d,_0x23199c){return _0x28ed4d['define'](_0x388c('0x7'),attributes,{'tableName':_0x388c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d030419..6e7c1da 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a1108,_0x3371c1){var _0x4656e3=function(_0x2b643b){while(--_0x2b643b){_0x2a1108['push'](_0x2a1108['shift']());}};_0x4656e3(++_0x3371c1);}(_0x70e0,0x17b));var _0x070e=function(_0x2752d2,_0x1a6312){_0x2752d2=_0x2752d2-0x0;var _0x2037a6=_0x70e0[_0x2752d2];return _0x2037a6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 31590bb..5f14c57 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 _0x7676=['INTEGER','sequelize','exports'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x7676,0xb8));var _0x6767=function(_0x1bac48,_0x597502){_0x1bac48=_0x1bac48-0x0;var _0x5eb030=_0x7676[_0x1bac48];return _0x5eb030;};'use strict';var Sequelize=require(_0x6767('0x0'));module[_0x6767('0x1')]={'penalty':{'type':Sequelize[_0x6767('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22c0=['sequelize','exports'];(function(_0x2c9f67,_0x2dd30a){var _0x4efd42=function(_0x4fdf83){while(--_0x4fdf83){_0x2c9f67['push'](_0x2c9f67['shift']());}};_0x4efd42(++_0x2dd30a);}(_0x22c0,0x1c4));var _0x022c=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0x22c0[_0x2142c8];return _0x4286e9;};'use strict';var Sequelize=require(_0x022c('0x0'));module[_0x022c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 6545e19..65c4dc5 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 _0x455d=['./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x455d,0x190));var _0xd455=function(_0xa09138,_0x4b4d4d){_0xa09138=_0xa09138-0x0;var _0x38befb=_0x455d[_0xa09138];return _0x38befb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd455('0x0'))(_0xd455('0x1'));var moment=require(_0xd455('0x2'));var BPromise=require('bluebird');var rp=require(_0xd455('0x3'));var fs=require('fs');var path=require(_0xd455('0x4'));var rimraf=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var attributes=require(_0xd455('0x7'));module[_0xd455('0x8')]=function(_0x41b357,_0x32a340){return _0x41b357[_0xd455('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xd455('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1db=['request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x3ce667,_0x504d04){var _0x4af254=function(_0x517f72){while(--_0x517f72){_0x3ce667['push'](_0x3ce667['shift']());}};_0x4af254(++_0x504d04);}(_0xa1db,0xb0));var _0xba1d=function(_0x241ada,_0x38127a){_0x241ada=_0x241ada-0x0;var _0x3662b7=_0xa1db[_0x241ada];return _0x3662b7;};'use strict';var _=require(_0xba1d('0x0'));var util=require(_0xba1d('0x1'));var logger=require(_0xba1d('0x2'))(_0xba1d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba1d('0x4'));var fs=require('fs');var path=require(_0xba1d('0x5'));var rimraf=require('rimraf');var config=require(_0xba1d('0x6'));var attributes=require(_0xba1d('0x7'));module[_0xba1d('0x8')]=function(_0xf79440,_0xea5887){return _0xf79440[_0xba1d('0x9')](_0xba1d('0xa'),attributes,{'tableName':_0xba1d('0xb'),'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 de87472..9c4e29b 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 _0x083e=['http','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x169d54,_0x26300){var _0xbbff5c=function(_0x5dd902){while(--_0x5dd902){_0x169d54['push'](_0x169d54['shift']());}};_0xbbff5c(++_0x26300);}(_0x083e,0x140));var _0xe083=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x083e[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0xe083('0x0'));var util=require(_0xe083('0x1'));var moment=require('moment');var BPromise=require(_0xe083('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe083('0x3'));var db=require(_0xe083('0x4'))['db'];var utils=require(_0xe083('0x5'));var logger=require(_0xe083('0x6'))(_0xe083('0x7'));var config=require(_0xe083('0x8'));var jayson=require(_0xe083('0x9'));var client=jayson['client'][_0xe083('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b81e3,_0x3eefa7,_0x35e969){return new BPromise(function(_0x8a8c3f,_0xd950e4){return client['request'](_0x1b81e3,_0x35e969)['then'](function(_0x34f7d7){logger[_0xe083('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0xe083('0xc'));logger[_0xe083('0xd')](_0xe083('0xe'),_0x3eefa7,_0xe083('0xc'),JSON[_0xe083('0xf')](_0x34f7d7));if(_0x34f7d7[_0xe083('0x10')]){if(_0x34f7d7[_0xe083('0x10')][_0xe083('0x11')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0x34f7d7['error'][_0xe083('0x12')]);return _0xd950e4(_0x34f7d7[_0xe083('0x10')][_0xe083('0x12')]);}logger[_0xe083('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0x34f7d7[_0xe083('0x10')][_0xe083('0x12')]);return _0x8a8c3f(_0x34f7d7[_0xe083('0x10')]['message']);}else{logger[_0xe083('0xb')](_0xe083('0x13'),_0x3eefa7,'request\x20sent');_0x8a8c3f(_0x34f7d7[_0xe083('0x14')]['message']);}})[_0xe083('0x15')](function(_0x52d0da){logger[_0xe083('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3eefa7,_0x52d0da);_0xd950e4(_0x52d0da);});});} \ No newline at end of file +var _0x887e=['../../config/logger','../../config/environment','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x21dd5e,_0x56ce80){var _0x3ff04b=function(_0x468db2){while(--_0x468db2){_0x21dd5e['push'](_0x21dd5e['shift']());}};_0x3ff04b(++_0x56ce80);}(_0x887e,0x14d));var _0xe887=function(_0x59a6db,_0x2442f6){_0x59a6db=_0x59a6db-0x0;var _0x5a34e6=_0x887e[_0x59a6db];return _0x5a34e6;};'use strict';var _=require(_0xe887('0x0'));var util=require(_0xe887('0x1'));var moment=require(_0xe887('0x2'));var BPromise=require(_0xe887('0x3'));var rs=require(_0xe887('0x4'));var fs=require('fs');var Redis=require(_0xe887('0x5'));var db=require(_0xe887('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe887('0x7'))('rpc');var config=require(_0xe887('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe887('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xddbe2a,_0x509280,_0x506c99){return new BPromise(function(_0xc48ea1,_0xf8e18d){return client[_0xe887('0xa')](_0xddbe2a,_0x506c99)['then'](function(_0x4beea3){logger[_0xe887('0xb')](_0xe887('0xc'),_0x509280,_0xe887('0xd'));logger['debug'](_0xe887('0xe'),_0x509280,_0xe887('0xd'),JSON[_0xe887('0xf')](_0x4beea3));if(_0x4beea3['error']){if(_0x4beea3[_0xe887('0x10')][_0xe887('0x11')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x509280,_0x4beea3[_0xe887('0x10')][_0xe887('0x12')]);return _0xf8e18d(_0x4beea3[_0xe887('0x10')]['message']);}logger[_0xe887('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x509280,_0x4beea3['error'][_0xe887('0x12')]);return _0xc48ea1(_0x4beea3[_0xe887('0x10')]['message']);}else{logger[_0xe887('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x509280,_0xe887('0xd'));_0xc48ea1(_0x4beea3['result']['message']);}})[_0xe887('0x13')](function(_0x2e82ea){logger[_0xe887('0x10')](_0xe887('0xc'),_0x509280,_0x2e82ea);_0xf8e18d(_0x2e82ea);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3d929be..5f24d5e 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 _0x288a=['../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x288a,0x188));var _0xa288=function(_0x4b0f49,_0x20c369){_0x4b0f49=_0x4b0f49-0x0;var _0x5a0771=_0x288a[_0x4b0f49];return _0x5a0771;};'use strict';var multer=require('multer');var util=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var timeout=require(_0xa288('0x2'));var express=require(_0xa288('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa288('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa288('0x5'));var controller=require(_0xa288('0x6'));router[_0xa288('0x7')]('/',auth['isAuthenticated'](),controller[_0xa288('0x8')]);router[_0xa288('0x7')](_0xa288('0x9'),auth['isAuthenticated'](),controller[_0xa288('0xa')]);router[_0xa288('0xb')]('/',auth[_0xa288('0xc')](),controller[_0xa288('0xd')]);router[_0xa288('0xe')](_0xa288('0x9'),auth[_0xa288('0xc')](),controller[_0xa288('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa288('0x10')]);module[_0xa288('0x11')]=router; \ No newline at end of file +var _0x59ac=['index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x587a45,_0x302087){var _0x22561c=function(_0x292083){while(--_0x292083){_0x587a45['push'](_0x587a45['shift']());}};_0x22561c(++_0x302087);}(_0x59ac,0x73));var _0xc59a=function(_0x56a69f,_0x1bf698){_0x56a69f=_0x56a69f-0x0;var _0x1cb629=_0x59ac[_0x56a69f];return _0x1cb629;};'use strict';var multer=require(_0xc59a('0x0'));var util=require(_0xc59a('0x1'));var path=require(_0xc59a('0x2'));var timeout=require(_0xc59a('0x3'));var express=require(_0xc59a('0x4'));var router=express['Router']();var fs_extra=require(_0xc59a('0x5'));var auth=require(_0xc59a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc59a('0x7'));var controller=require(_0xc59a('0x8'));router[_0xc59a('0x9')]('/',auth[_0xc59a('0xa')](),controller[_0xc59a('0xb')]);router['get'](_0xc59a('0xc'),auth['isAuthenticated'](),controller[_0xc59a('0xd')]);router['post']('/',auth[_0xc59a('0xa')](),controller['create']);router[_0xc59a('0xe')]('/:id',auth[_0xc59a('0xa')](),controller['update']);router[_0xc59a('0xf')]('/:id',auth[_0xc59a('0xa')](),controller[_0xc59a('0x10')]);module[_0xc59a('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index efef65a..b2f3027 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 _0x0c5a=['STRING','TEXT','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0c5a,0x126));var _0xa0c5=function(_0x49df19,_0x22eb80){_0x49df19=_0x49df19-0x0;var _0x154d18=_0x0c5a[_0x49df19];return _0x154d18;};'use strict';var Sequelize=require(_0xa0c5('0x0'));module[_0xa0c5('0x1')]={'name':{'type':Sequelize[_0xa0c5('0x2')]},'description':{'type':Sequelize[_0xa0c5('0x2')]},'html':{'type':Sequelize[_0xa0c5('0x3')]}}; \ No newline at end of file +var _0x9756=['exports','STRING','TEXT','sequelize'];(function(_0x19b840,_0x1c9624){var _0x4d76b8=function(_0x4e8989){while(--_0x4e8989){_0x19b840['push'](_0x19b840['shift']());}};_0x4d76b8(++_0x1c9624);}(_0x9756,0x1d7));var _0x6975=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9756[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x6975('0x0'));module[_0x6975('0x1')]={'name':{'type':Sequelize[_0x6975('0x2')]},'description':{'type':Sequelize[_0x6975('0x2')]},'html':{'type':Sequelize[_0x6975('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 48c59b5..f0ecd60 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 _0x084f=['save','update','then','get','Templates','destroy','error','stack','name','index','map','Template','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2e75d3,_0x3027a8){var _0x1a14f1=function(_0x6c8e71){while(--_0x6c8e71){_0x2e75d3['push'](_0x2e75d3['shift']());}};_0x1a14f1(++_0x3027a8);}(_0x084f,0x124));var _0xf084=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x084f[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xf084('0x0'));var rimraf=require(_0xf084('0x1'));var zipdir=require(_0xf084('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf084('0x3'));var moment=require(_0xf084('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf084('0x5'));var util=require('util');var path=require(_0xf084('0x6'));var sox=require(_0xf084('0x7'));var csv=require(_0xf084('0x8'));var ejs=require(_0xf084('0x9'));var fs=require('fs');var fs_extra=require(_0xf084('0xa'));var _=require(_0xf084('0xb'));var squel=require(_0xf084('0xc'));var crypto=require(_0xf084('0xd'));var jsforce=require(_0xf084('0xe'));var deskjs=require(_0xf084('0xf'));var toCsv=require(_0xf084('0x8'));var querystring=require(_0xf084('0x10'));var Papa=require(_0xf084('0x11'));var Redis=require(_0xf084('0x12'));var authService=require(_0xf084('0x13'));var qs=require(_0xf084('0x14'));var as=require(_0xf084('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf084('0x16'))(_0xf084('0x17'));var utils=require('../../config/utils');var config=require(_0xf084('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf084('0x19'))['db'];function respondWithStatusCode(_0x1facf4,_0x4a67c8){_0x4a67c8=_0x4a67c8||0xcc;return function(_0x145101){if(_0x145101){return _0x1facf4[_0xf084('0x1a')](_0x4a67c8);}return _0x1facf4[_0xf084('0x1b')](_0x4a67c8)[_0xf084('0x1c')]();};}function respondWithResult(_0x639e04,_0x5cc544){_0x5cc544=_0x5cc544||0xc8;return function(_0x3ca02d){if(_0x3ca02d){return _0x639e04[_0xf084('0x1b')](_0x5cc544)[_0xf084('0x1d')](_0x3ca02d);}};}function respondWithFilteredResult(_0x3fb979,_0x3bc925){return function(_0x4eb0b2){if(_0x4eb0b2){var _0x1fffdb=typeof _0x3bc925[_0xf084('0x1e')]===_0xf084('0x1f')&&typeof _0x3bc925[_0xf084('0x20')]===_0xf084('0x1f');var _0x568ec5=_0x4eb0b2[_0xf084('0x21')];var _0x4b58fa=_0x1fffdb?0x0:_0x3bc925['offset'];var _0x2cea40=_0x1fffdb?_0x4eb0b2['count']:_0x3bc925[_0xf084('0x1e')]+_0x3bc925[_0xf084('0x20')];var _0x21e892;if(_0x2cea40>=_0x568ec5){_0x2cea40=_0x568ec5;_0x21e892=0xc8;}else{_0x21e892=0xce;}_0x3fb979[_0xf084('0x1b')](_0x21e892);return _0x3fb979[_0xf084('0x22')](_0xf084('0x23'),_0x4b58fa+'-'+_0x2cea40+'/'+_0x568ec5)[_0xf084('0x1d')](_0x4eb0b2);}return null;};}function patchUpdates(_0x1f8be5){return function(_0x14c84a){try{jsonpatch['apply'](_0x14c84a,_0x1f8be5,!![]);}catch(_0x638c14){return BPromise['reject'](_0x638c14);}return _0x14c84a[_0xf084('0x24')]();};}function saveUpdates(_0x57446e,_0x1f8f30){return function(_0x16f2bc){if(_0x16f2bc){return _0x16f2bc[_0xf084('0x25')](_0x57446e)[_0xf084('0x26')](function(_0xa94faa){return _0xa94faa;});}return null;};}function removeEntity(_0x34ff21,_0x4fc381){return function(_0x219f04){if(_0x219f04){return _0x219f04['destroy']()[_0xf084('0x26')](function(){var _0xbb74f0=_0x219f04[_0xf084('0x27')]({'plain':!![]});var _0xaf7169=_0xf084('0x28');return db['UserProfileResource'][_0xf084('0x29')]({'where':{'type':_0xaf7169,'resourceId':_0xbb74f0['id']}})[_0xf084('0x26')](function(){return _0x219f04;});})[_0xf084('0x26')](function(){_0x34ff21[_0xf084('0x1b')](0xcc)[_0xf084('0x1c')]();});}};}function handleEntityNotFound(_0x2992cf,_0x2f970f){return function(_0x216db9){if(!_0x216db9){_0x2992cf[_0xf084('0x1a')](0x194);}return _0x216db9;};}function handleError(_0x5beac7,_0x2cd449){_0x2cd449=_0x2cd449||0x1f4;return function(_0x546fb4){logger[_0xf084('0x2a')](_0x546fb4[_0xf084('0x2b')]);if(_0x546fb4['name']){delete _0x546fb4[_0xf084('0x2c')];}_0x5beac7[_0xf084('0x1b')](_0x2cd449)['send'](_0x546fb4);};}exports[_0xf084('0x2d')]=function(_0x57dde0,_0x225039){var _0x7fa78e={},_0x4112b1={},_0x5d963e={'count':0x0,'rows':[]};var _0x5f547b=_[_0xf084('0x2e')](db[_0xf084('0x2f')][_0xf084('0x30')],function(_0x27bebe){return{'name':_0x27bebe[_0xf084('0x31')],'type':_0x27bebe['type'][_0xf084('0x32')]};});_0x4112b1[_0xf084('0x33')]=_[_0xf084('0x2e')](_0x5f547b,_0xf084('0x2c'));_0x4112b1[_0xf084('0x34')]=_['keys'](_0x57dde0['query']);_0x4112b1[_0xf084('0x35')]=_[_0xf084('0x36')](_0x4112b1[_0xf084('0x33')],_0x4112b1[_0xf084('0x34')]);_0x7fa78e['attributes']=_[_0xf084('0x36')](_0x4112b1[_0xf084('0x33')],qs[_0xf084('0x37')](_0x57dde0[_0xf084('0x34')][_0xf084('0x37')]));_0x7fa78e[_0xf084('0x38')]=_0x7fa78e[_0xf084('0x38')]['length']?_0x7fa78e[_0xf084('0x38')]:_0x4112b1[_0xf084('0x33')];if(!_0x57dde0['query']['hasOwnProperty']('nolimit')){_0x7fa78e[_0xf084('0x20')]=qs[_0xf084('0x20')](_0x57dde0['query'][_0xf084('0x20')]);_0x7fa78e[_0xf084('0x1e')]=qs['offset'](_0x57dde0[_0xf084('0x34')][_0xf084('0x1e')]);}_0x7fa78e[_0xf084('0x39')]=qs[_0xf084('0x3a')](_0x57dde0[_0xf084('0x34')][_0xf084('0x3a')]);_0x7fa78e[_0xf084('0x3b')]=qs[_0xf084('0x35')](_[_0xf084('0x3c')](_0x57dde0[_0xf084('0x34')],_0x4112b1[_0xf084('0x35')]),_0x5f547b);if(_0x57dde0['query']['filter']){_0x7fa78e['where']=_[_0xf084('0x3d')](_0x7fa78e[_0xf084('0x3b')],{'$or':_[_0xf084('0x2e')](_0x5f547b,function(_0x182519){if(_0x182519[_0xf084('0x3e')]!==_0xf084('0x3f')){var _0x3e39ba={};_0x3e39ba[_0x182519['name']]={'$like':'%'+_0x57dde0[_0xf084('0x34')][_0xf084('0x40')]+'%'};return _0x3e39ba;}})});}_0x7fa78e=_[_0xf084('0x3d')]({},_0x7fa78e,_0x57dde0[_0xf084('0x41')]);var _0x1c1689={'where':_0x7fa78e['where']};return db[_0xf084('0x2f')][_0xf084('0x21')](_0x1c1689)[_0xf084('0x26')](function(_0x5d6cb4){_0x5d963e[_0xf084('0x21')]=_0x5d6cb4;if(_0x57dde0['query'][_0xf084('0x42')]){_0x7fa78e[_0xf084('0x43')]=[{'all':!![]}];}return db[_0xf084('0x2f')][_0xf084('0x44')](_0x7fa78e);})[_0xf084('0x26')](function(_0x3b6399){_0x5d963e['rows']=_0x3b6399;return _0x5d963e;})[_0xf084('0x26')](respondWithFilteredResult(_0x225039,_0x7fa78e))['catch'](handleError(_0x225039,null));};exports[_0xf084('0x45')]=function(_0x43369d,_0x1434e9){var _0x942ea0={'raw':!![],'where':{'id':_0x43369d[_0xf084('0x46')]['id']}},_0x2aa715={};_0x2aa715['model']=_['keys'](db['Template']['rawAttributes']);_0x2aa715[_0xf084('0x34')]=_['keys'](_0x43369d[_0xf084('0x34')]);_0x2aa715[_0xf084('0x35')]=_[_0xf084('0x36')](_0x2aa715[_0xf084('0x33')],_0x2aa715[_0xf084('0x34')]);_0x942ea0[_0xf084('0x38')]=_[_0xf084('0x36')](_0x2aa715[_0xf084('0x33')],qs[_0xf084('0x37')](_0x43369d['query'][_0xf084('0x37')]));_0x942ea0[_0xf084('0x38')]=_0x942ea0[_0xf084('0x38')][_0xf084('0x47')]?_0x942ea0['attributes']:_0x2aa715[_0xf084('0x33')];if(_0x43369d['query'][_0xf084('0x42')]){_0x942ea0['include']=[{'all':!![]}];}_0x942ea0=_[_0xf084('0x3d')]({},_0x942ea0,_0x43369d[_0xf084('0x41')]);return db[_0xf084('0x2f')][_0xf084('0x48')](_0x942ea0)['then'](handleEntityNotFound(_0x1434e9,null))['then'](respondWithResult(_0x1434e9,null))[_0xf084('0x49')](handleError(_0x1434e9,null));};exports[_0xf084('0x4a')]=function(_0x4642f7,_0x18aa21){return db[_0xf084('0x2f')][_0xf084('0x4a')](_0x4642f7[_0xf084('0x4b')],{})['then'](function(_0x417309){var _0x386b84=_0x4642f7[_0xf084('0x4c')]['get']({'plain':!![]});if(!_0x386b84)throw new Error(_0xf084('0x4d'));if(_0x386b84['role']===_0xf084('0x4c')){var _0x45aed5=_0x417309['get']({'plain':!![]});var _0x20236c=_0xf084('0x28');return db[_0xf084('0x4e')][_0xf084('0x48')]({'where':{'name':_0x20236c,'userProfileId':_0x386b84[_0xf084('0x4f')]},'raw':!![]})['then'](function(_0x504ae9){if(_0x504ae9&&_0x504ae9[_0xf084('0x50')]===0x0){return db[_0xf084('0x51')][_0xf084('0x4a')]({'name':_0x45aed5[_0xf084('0x2c')],'resourceId':_0x45aed5['id'],'type':_0x504ae9[_0xf084('0x2c')],'sectionId':_0x504ae9['id']},{})[_0xf084('0x26')](function(){return _0x417309;});}else{return _0x417309;}})[_0xf084('0x49')](function(_0x518261){logger[_0xf084('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x518261);throw _0x518261;});}return _0x417309;})[_0xf084('0x26')](respondWithResult(_0x18aa21,0xc9))[_0xf084('0x49')](handleError(_0x18aa21,null));};exports[_0xf084('0x25')]=function(_0x2188e3,_0x475d26){if(_0x2188e3[_0xf084('0x4b')]['id']){delete _0x2188e3[_0xf084('0x4b')]['id'];}return db[_0xf084('0x2f')]['find']({'where':{'id':_0x2188e3[_0xf084('0x46')]['id']}})[_0xf084('0x26')](handleEntityNotFound(_0x475d26,null))['then'](saveUpdates(_0x2188e3[_0xf084('0x4b')],null))[_0xf084('0x26')](respondWithResult(_0x475d26,null))[_0xf084('0x49')](handleError(_0x475d26,null));};exports[_0xf084('0x29')]=function(_0x2ca31a,_0x3d5e5b){return db['Template'][_0xf084('0x48')]({'where':{'id':_0x2ca31a[_0xf084('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d5e5b,null))[_0xf084('0x26')](removeEntity(_0x3d5e5b,null))[_0xf084('0x49')](handleError(_0x3d5e5b,null));}; \ No newline at end of file +var _0x1bea=['Template','findAll','rows','catch','show','params','fields','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include'];(function(_0x577789,_0x24b8e8){var _0x403787=function(_0x4eca9a){while(--_0x4eca9a){_0x577789['push'](_0x577789['shift']());}};_0x403787(++_0x24b8e8);}(_0x1bea,0x67));var _0xa1be=function(_0x3ad202,_0x30668a){_0x3ad202=_0x3ad202-0x0;var _0x1bd6e4=_0x1bea[_0x3ad202];return _0x1bd6e4;};'use strict';var emlformat=require(_0xa1be('0x0'));var rimraf=require(_0xa1be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1be('0x2'));var rp=require(_0xa1be('0x3'));var moment=require(_0xa1be('0x4'));var BPromise=require(_0xa1be('0x5'));var Mustache=require('mustache');var util=require(_0xa1be('0x6'));var path=require(_0xa1be('0x7'));var sox=require(_0xa1be('0x8'));var csv=require('to-csv');var ejs=require(_0xa1be('0x9'));var fs=require('fs');var fs_extra=require(_0xa1be('0xa'));var _=require(_0xa1be('0xb'));var squel=require('squel');var crypto=require(_0xa1be('0xc'));var jsforce=require(_0xa1be('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa1be('0xe'));var querystring=require(_0xa1be('0xf'));var Papa=require(_0xa1be('0x10'));var Redis=require(_0xa1be('0x11'));var authService=require(_0xa1be('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa1be('0x13'));var hardwareService=require(_0xa1be('0x14'));var logger=require('../../config/logger')(_0xa1be('0x15'));var utils=require('../../config/utils');var config=require(_0xa1be('0x16'));var licenseUtil=require(_0xa1be('0x17'));var db=require(_0xa1be('0x18'))['db'];function respondWithStatusCode(_0x5db43a,_0x2f8e31){_0x2f8e31=_0x2f8e31||0xcc;return function(_0x36f359){if(_0x36f359){return _0x5db43a[_0xa1be('0x19')](_0x2f8e31);}return _0x5db43a[_0xa1be('0x1a')](_0x2f8e31)[_0xa1be('0x1b')]();};}function respondWithResult(_0x4d0f7b,_0x576526){_0x576526=_0x576526||0xc8;return function(_0x2fde12){if(_0x2fde12){return _0x4d0f7b[_0xa1be('0x1a')](_0x576526)[_0xa1be('0x1c')](_0x2fde12);}};}function respondWithFilteredResult(_0x44d7cc,_0x2066b4){return function(_0x1b6c5e){if(_0x1b6c5e){var _0x5d1566=typeof _0x2066b4[_0xa1be('0x1d')]==='undefined'&&typeof _0x2066b4[_0xa1be('0x1e')]===_0xa1be('0x1f');var _0x9ac3f0=_0x1b6c5e[_0xa1be('0x20')];var _0x63200=_0x5d1566?0x0:_0x2066b4[_0xa1be('0x1d')];var _0x422b01=_0x5d1566?_0x1b6c5e['count']:_0x2066b4['offset']+_0x2066b4[_0xa1be('0x1e')];var _0xe85e63;if(_0x422b01>=_0x9ac3f0){_0x422b01=_0x9ac3f0;_0xe85e63=0xc8;}else{_0xe85e63=0xce;}_0x44d7cc['status'](_0xe85e63);return _0x44d7cc[_0xa1be('0x21')](_0xa1be('0x22'),_0x63200+'-'+_0x422b01+'/'+_0x9ac3f0)[_0xa1be('0x1c')](_0x1b6c5e);}return null;};}function patchUpdates(_0x2e8159){return function(_0x18bb59){try{jsonpatch['apply'](_0x18bb59,_0x2e8159,!![]);}catch(_0x5905ac){return BPromise[_0xa1be('0x23')](_0x5905ac);}return _0x18bb59[_0xa1be('0x24')]();};}function saveUpdates(_0x46ff97,_0x504d98){return function(_0x2431b0){if(_0x2431b0){return _0x2431b0['update'](_0x46ff97)[_0xa1be('0x25')](function(_0x5282a2){return _0x5282a2;});}return null;};}function removeEntity(_0x4b4816,_0x2f35d1){return function(_0x29527d){if(_0x29527d){return _0x29527d[_0xa1be('0x26')]()['then'](function(){var _0x5c0dd9=_0x29527d[_0xa1be('0x27')]({'plain':!![]});var _0x17b1d2=_0xa1be('0x28');return db[_0xa1be('0x29')][_0xa1be('0x26')]({'where':{'type':_0x17b1d2,'resourceId':_0x5c0dd9['id']}})[_0xa1be('0x25')](function(){return _0x29527d;});})['then'](function(){_0x4b4816['status'](0xcc)[_0xa1be('0x1b')]();});}};}function handleEntityNotFound(_0x5427ba,_0x1e07be){return function(_0x24c2cf){if(!_0x24c2cf){_0x5427ba['sendStatus'](0x194);}return _0x24c2cf;};}function handleError(_0x509f03,_0x18edf4){_0x18edf4=_0x18edf4||0x1f4;return function(_0x1643c8){logger[_0xa1be('0x2a')](_0x1643c8[_0xa1be('0x2b')]);if(_0x1643c8['name']){delete _0x1643c8['name'];}_0x509f03['status'](_0x18edf4)[_0xa1be('0x2c')](_0x1643c8);};}exports[_0xa1be('0x2d')]=function(_0x40f102,_0x15ecfa){var _0x100afb={},_0x5a6f80={},_0x3ab681={'count':0x0,'rows':[]};var _0x391e94=_['map'](db['Template'][_0xa1be('0x2e')],function(_0x245bf7){return{'name':_0x245bf7[_0xa1be('0x2f')],'type':_0x245bf7[_0xa1be('0x30')][_0xa1be('0x31')]};});_0x5a6f80['model']=_['map'](_0x391e94,_0xa1be('0x32'));_0x5a6f80[_0xa1be('0x33')]=_[_0xa1be('0x34')](_0x40f102[_0xa1be('0x33')]);_0x5a6f80[_0xa1be('0x35')]=_[_0xa1be('0x36')](_0x5a6f80[_0xa1be('0x37')],_0x5a6f80[_0xa1be('0x33')]);_0x100afb['attributes']=_['intersection'](_0x5a6f80[_0xa1be('0x37')],qs['fields'](_0x40f102[_0xa1be('0x33')]['fields']));_0x100afb[_0xa1be('0x38')]=_0x100afb['attributes'][_0xa1be('0x39')]?_0x100afb[_0xa1be('0x38')]:_0x5a6f80[_0xa1be('0x37')];if(!_0x40f102[_0xa1be('0x33')][_0xa1be('0x3a')](_0xa1be('0x3b'))){_0x100afb['limit']=qs[_0xa1be('0x1e')](_0x40f102['query'][_0xa1be('0x1e')]);_0x100afb[_0xa1be('0x1d')]=qs['offset'](_0x40f102[_0xa1be('0x33')][_0xa1be('0x1d')]);}_0x100afb[_0xa1be('0x3c')]=qs[_0xa1be('0x3d')](_0x40f102[_0xa1be('0x33')]['sort']);_0x100afb['where']=qs['filters'](_[_0xa1be('0x3e')](_0x40f102[_0xa1be('0x33')],_0x5a6f80[_0xa1be('0x35')]),_0x391e94);if(_0x40f102[_0xa1be('0x33')][_0xa1be('0x3f')]){_0x100afb[_0xa1be('0x40')]=_[_0xa1be('0x41')](_0x100afb['where'],{'$or':_[_0xa1be('0x42')](_0x391e94,function(_0xe2a565){if(_0xe2a565['type']!==_0xa1be('0x43')){var _0x36268c={};_0x36268c[_0xe2a565[_0xa1be('0x32')]]={'$like':'%'+_0x40f102[_0xa1be('0x33')][_0xa1be('0x3f')]+'%'};return _0x36268c;}})});}_0x100afb=_['merge']({},_0x100afb,_0x40f102[_0xa1be('0x44')]);var _0x235027={'where':_0x100afb[_0xa1be('0x40')]};return db['Template'][_0xa1be('0x20')](_0x235027)['then'](function(_0x289978){_0x3ab681[_0xa1be('0x20')]=_0x289978;if(_0x40f102[_0xa1be('0x33')][_0xa1be('0x45')]){_0x100afb[_0xa1be('0x46')]=[{'all':!![]}];}return db[_0xa1be('0x47')][_0xa1be('0x48')](_0x100afb);})[_0xa1be('0x25')](function(_0x1b3c7c){_0x3ab681[_0xa1be('0x49')]=_0x1b3c7c;return _0x3ab681;})[_0xa1be('0x25')](respondWithFilteredResult(_0x15ecfa,_0x100afb))[_0xa1be('0x4a')](handleError(_0x15ecfa,null));};exports[_0xa1be('0x4b')]=function(_0x39c32f,_0x52a98d){var _0x20a7c9={'raw':!![],'where':{'id':_0x39c32f[_0xa1be('0x4c')]['id']}},_0x3a1530={};_0x3a1530[_0xa1be('0x37')]=_[_0xa1be('0x34')](db[_0xa1be('0x47')]['rawAttributes']);_0x3a1530[_0xa1be('0x33')]=_['keys'](_0x39c32f['query']);_0x3a1530[_0xa1be('0x35')]=_[_0xa1be('0x36')](_0x3a1530[_0xa1be('0x37')],_0x3a1530[_0xa1be('0x33')]);_0x20a7c9[_0xa1be('0x38')]=_['intersection'](_0x3a1530[_0xa1be('0x37')],qs['fields'](_0x39c32f[_0xa1be('0x33')][_0xa1be('0x4d')]));_0x20a7c9[_0xa1be('0x38')]=_0x20a7c9[_0xa1be('0x38')]['length']?_0x20a7c9[_0xa1be('0x38')]:_0x3a1530[_0xa1be('0x37')];if(_0x39c32f['query'][_0xa1be('0x45')]){_0x20a7c9[_0xa1be('0x46')]=[{'all':!![]}];}_0x20a7c9=_[_0xa1be('0x41')]({},_0x20a7c9,_0x39c32f[_0xa1be('0x44')]);return db[_0xa1be('0x47')]['find'](_0x20a7c9)[_0xa1be('0x25')](handleEntityNotFound(_0x52a98d,null))['then'](respondWithResult(_0x52a98d,null))[_0xa1be('0x4a')](handleError(_0x52a98d,null));};exports[_0xa1be('0x4e')]=function(_0x514a39,_0x14bb90){return db[_0xa1be('0x47')][_0xa1be('0x4e')](_0x514a39[_0xa1be('0x4f')],{})[_0xa1be('0x25')](function(_0x3ff107){var _0x49905c=_0x514a39[_0xa1be('0x50')]['get']({'plain':!![]});if(!_0x49905c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49905c['role']===_0xa1be('0x50')){var _0x3bc19f=_0x3ff107[_0xa1be('0x27')]({'plain':!![]});var _0x52ef4b=_0xa1be('0x28');return db[_0xa1be('0x51')][_0xa1be('0x52')]({'where':{'name':_0x52ef4b,'userProfileId':_0x49905c[_0xa1be('0x53')]},'raw':!![]})['then'](function(_0x413266){if(_0x413266&&_0x413266[_0xa1be('0x54')]===0x0){return db[_0xa1be('0x29')][_0xa1be('0x4e')]({'name':_0x3bc19f[_0xa1be('0x32')],'resourceId':_0x3bc19f['id'],'type':_0x413266[_0xa1be('0x32')],'sectionId':_0x413266['id']},{})[_0xa1be('0x25')](function(){return _0x3ff107;});}else{return _0x3ff107;}})[_0xa1be('0x4a')](function(_0x30eb18){logger[_0xa1be('0x2a')](_0xa1be('0x55'),_0x30eb18);throw _0x30eb18;});}return _0x3ff107;})['then'](respondWithResult(_0x14bb90,0xc9))[_0xa1be('0x4a')](handleError(_0x14bb90,null));};exports[_0xa1be('0x56')]=function(_0x31a6e5,_0x2d8bd3){if(_0x31a6e5[_0xa1be('0x4f')]['id']){delete _0x31a6e5[_0xa1be('0x4f')]['id'];}return db[_0xa1be('0x47')][_0xa1be('0x52')]({'where':{'id':_0x31a6e5[_0xa1be('0x4c')]['id']}})[_0xa1be('0x25')](handleEntityNotFound(_0x2d8bd3,null))['then'](saveUpdates(_0x31a6e5[_0xa1be('0x4f')],null))[_0xa1be('0x25')](respondWithResult(_0x2d8bd3,null))['catch'](handleError(_0x2d8bd3,null));};exports[_0xa1be('0x26')]=function(_0x57c19e,_0x41c707){return db['Template'][_0xa1be('0x52')]({'where':{'id':_0x57c19e[_0xa1be('0x4c')]['id']}})[_0xa1be('0x25')](handleEntityNotFound(_0x41c707,null))['then'](removeEntity(_0x41c707,null))['catch'](handleError(_0x41c707,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index fe426d9..b6730d7 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 _0x7057=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x173ea8,_0x3175a9){var _0x24332c=function(_0x5adbb8){while(--_0x5adbb8){_0x173ea8['push'](_0x173ea8['shift']());}};_0x24332c(++_0x3175a9);}(_0x7057,0x1f2));var _0x7705=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7057[_0x616290];return _0x453879;};'use strict';var _=require(_0x7705('0x0'));var util=require(_0x7705('0x1'));var logger=require(_0x7705('0x2'))(_0x7705('0x3'));var moment=require('moment');var BPromise=require(_0x7705('0x4'));var rp=require(_0x7705('0x5'));var fs=require('fs');var path=require(_0x7705('0x6'));var rimraf=require(_0x7705('0x7'));var config=require(_0x7705('0x8'));var attributes=require(_0x7705('0x9'));module[_0x7705('0xa')]=function(_0x1a5c9d,_0x2978c3){return _0x1a5c9d[_0x7705('0xb')](_0x7705('0xc'),attributes,{'tableName':_0x7705('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7248=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x535d8b,_0x44f161){var _0x40fcd4=function(_0x1ff4a0){while(--_0x1ff4a0){_0x535d8b['push'](_0x535d8b['shift']());}};_0x40fcd4(++_0x44f161);}(_0x7248,0x15c));var _0x8724=function(_0x5bcdb9,_0x2bef44){_0x5bcdb9=_0x5bcdb9-0x0;var _0x4f0dda=_0x7248[_0x5bcdb9];return _0x4f0dda;};'use strict';var _=require(_0x8724('0x0'));var util=require(_0x8724('0x1'));var logger=require(_0x8724('0x2'))(_0x8724('0x3'));var moment=require(_0x8724('0x4'));var BPromise=require(_0x8724('0x5'));var rp=require(_0x8724('0x6'));var fs=require('fs');var path=require(_0x8724('0x7'));var rimraf=require('rimraf');var config=require(_0x8724('0x8'));var attributes=require(_0x8724('0x9'));module[_0x8724('0xa')]=function(_0x11851f,_0x5a3229){return _0x11851f[_0x8724('0xb')](_0x8724('0xc'),attributes,{'tableName':_0x8724('0xd'),'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 c2b278c..2ad4146 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 _0x0299=['code','message','result','catch','Template','findAll','options','raw','attributes','limit','include','map','model','GetTemplate','stringify','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x4e62d7,_0x4b89c7){var _0x52923f=function(_0x3c05d3){while(--_0x3c05d3){_0x4e62d7['push'](_0x4e62d7['shift']());}};_0x52923f(++_0x4b89c7);}(_0x0299,0x93));var _0x9029=function(_0x30e657,_0x58c2e7){_0x30e657=_0x30e657-0x0;var _0x19dbe8=_0x0299[_0x30e657];return _0x19dbe8;};'use strict';var _=require(_0x9029('0x0'));var util=require(_0x9029('0x1'));var moment=require(_0x9029('0x2'));var BPromise=require('bluebird');var rs=require(_0x9029('0x3'));var fs=require('fs');var Redis=require(_0x9029('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9029('0x5'))(_0x9029('0x6'));var config=require('../../config/environment');var jayson=require(_0x9029('0x7'));var client=jayson[_0x9029('0x8')][_0x9029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x420e15,_0x2fa849,_0x3064e7){return new BPromise(function(_0x5e46f8,_0x3b467d){return client[_0x9029('0xa')](_0x420e15,_0x3064e7)[_0x9029('0xb')](function(_0x5e16aa){logger[_0x9029('0xc')](_0x9029('0xd'),_0x2fa849,_0x9029('0xe'));logger[_0x9029('0xf')](_0x9029('0x10'),_0x2fa849,_0x9029('0xe'),JSON['stringify'](_0x5e16aa));if(_0x5e16aa[_0x9029('0x11')]){if(_0x5e16aa[_0x9029('0x11')][_0x9029('0x12')]===0x1f4){logger[_0x9029('0x11')](_0x9029('0xd'),_0x2fa849,_0x5e16aa[_0x9029('0x11')][_0x9029('0x13')]);return _0x3b467d(_0x5e16aa[_0x9029('0x11')]['message']);}logger[_0x9029('0x11')](_0x9029('0xd'),_0x2fa849,_0x5e16aa[_0x9029('0x11')][_0x9029('0x13')]);return _0x5e46f8(_0x5e16aa[_0x9029('0x11')][_0x9029('0x13')]);}else{logger[_0x9029('0xc')](_0x9029('0xd'),_0x2fa849,_0x9029('0xe'));_0x5e46f8(_0x5e16aa[_0x9029('0x14')][_0x9029('0x13')]);}})[_0x9029('0x15')](function(_0x30ca00){logger['error']('Template,\x20%s,\x20%s',_0x2fa849,_0x30ca00);_0x3b467d(_0x30ca00);});});}exports['GetTemplate']=function(_0x3ea8be){var _0x49d7f7=this;return new Promise(function(_0x1c6055,_0xaf2051){return db[_0x9029('0x16')][_0x9029('0x17')]({'raw':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be[_0x9029('0x18')][_0x9029('0x19')]===undefined?!![]:![]:!![],'where':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be[_0x9029('0x18')]['where']||null:null,'attributes':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be['options'][_0x9029('0x1a')]||null:null,'limit':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be[_0x9029('0x18')][_0x9029('0x1b')]||null:null,'include':_0x3ea8be[_0x9029('0x18')]?_0x3ea8be['options'][_0x9029('0x1c')]?_[_0x9029('0x1d')](_0x3ea8be[_0x9029('0x18')]['include'],function(_0x1de2b9){return{'model':db[_0x1de2b9['model']],'as':_0x1de2b9['as'],'attributes':_0x1de2b9[_0x9029('0x1a')],'include':_0x1de2b9[_0x9029('0x1c')]?_[_0x9029('0x1d')](_0x1de2b9[_0x9029('0x1c')],function(_0x4fc560){return{'model':db[_0x4fc560[_0x9029('0x1e')]],'as':_0x4fc560['as'],'attributes':_0x4fc560[_0x9029('0x1a')],'include':_0x4fc560[_0x9029('0x1c')]?_[_0x9029('0x1d')](_0x4fc560[_0x9029('0x1c')],function(_0x20f4b3){return{'model':db[_0x20f4b3[_0x9029('0x1e')]],'as':_0x20f4b3['as'],'attributes':_0x20f4b3[_0x9029('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9029('0xb')](function(_0x48832e){logger['info'](_0x9029('0x1f'),_0x3ea8be);logger['debug'](_0x9029('0x1f'),_0x3ea8be,JSON[_0x9029('0x20')](_0x48832e));_0x1c6055(_0x48832e);})[_0x9029('0x15')](function(_0x4a0613){logger['error'](_0x9029('0x1f'),_0x4a0613[_0x9029('0x13')],_0x3ea8be);_0xaf2051(_0x49d7f7['error'](0x1f4,_0x4a0613[_0x9029('0x13')]));});});}; \ No newline at end of file +var _0x8549=['options','raw','attributes','include','map','model','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetTemplate','findAll'];(function(_0x6353ab,_0x34de58){var _0x19b8bd=function(_0x5e636c){while(--_0x5e636c){_0x6353ab['push'](_0x6353ab['shift']());}};_0x19b8bd(++_0x34de58);}(_0x8549,0xd3));var _0x9854=function(_0x33c342,_0x1ce8d7){_0x33c342=_0x33c342-0x0;var _0x46f946=_0x8549[_0x33c342];return _0x46f946;};'use strict';var _=require(_0x9854('0x0'));var util=require('util');var moment=require(_0x9854('0x1'));var BPromise=require(_0x9854('0x2'));var rs=require(_0x9854('0x3'));var fs=require('fs');var Redis=require(_0x9854('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9854('0x5'))(_0x9854('0x6'));var config=require(_0x9854('0x7'));var jayson=require(_0x9854('0x8'));var client=jayson['client'][_0x9854('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4737ab,_0x184a6a,_0x476204){return new BPromise(function(_0x2c4fdc,_0x5824de){return client['request'](_0x4737ab,_0x476204)[_0x9854('0xa')](function(_0x4ac59e){logger['info'](_0x9854('0xb'),_0x184a6a,'request\x20sent');logger['debug'](_0x9854('0xc'),_0x184a6a,_0x9854('0xd'),JSON['stringify'](_0x4ac59e));if(_0x4ac59e[_0x9854('0xe')]){if(_0x4ac59e[_0x9854('0xe')]['code']===0x1f4){logger[_0x9854('0xe')](_0x9854('0xb'),_0x184a6a,_0x4ac59e['error']['message']);return _0x5824de(_0x4ac59e[_0x9854('0xe')]['message']);}logger['error'](_0x9854('0xb'),_0x184a6a,_0x4ac59e[_0x9854('0xe')][_0x9854('0xf')]);return _0x2c4fdc(_0x4ac59e[_0x9854('0xe')]['message']);}else{logger[_0x9854('0x10')](_0x9854('0xb'),_0x184a6a,_0x9854('0xd'));_0x2c4fdc(_0x4ac59e[_0x9854('0x11')][_0x9854('0xf')]);}})[_0x9854('0x12')](function(_0x3cbe5b){logger[_0x9854('0xe')](_0x9854('0xb'),_0x184a6a,_0x3cbe5b);_0x5824de(_0x3cbe5b);});});}exports[_0x9854('0x13')]=function(_0x1ebdf9){var _0x269468=this;return new Promise(function(_0x4e378b,_0x3f913b){return db['Template'][_0x9854('0x14')]({'raw':_0x1ebdf9[_0x9854('0x15')]?_0x1ebdf9[_0x9854('0x15')][_0x9854('0x16')]===undefined?!![]:![]:!![],'where':_0x1ebdf9[_0x9854('0x15')]?_0x1ebdf9['options']['where']||null:null,'attributes':_0x1ebdf9['options']?_0x1ebdf9[_0x9854('0x15')][_0x9854('0x17')]||null:null,'limit':_0x1ebdf9[_0x9854('0x15')]?_0x1ebdf9[_0x9854('0x15')]['limit']||null:null,'include':_0x1ebdf9[_0x9854('0x15')]?_0x1ebdf9[_0x9854('0x15')][_0x9854('0x18')]?_[_0x9854('0x19')](_0x1ebdf9[_0x9854('0x15')][_0x9854('0x18')],function(_0xc26853){return{'model':db[_0xc26853[_0x9854('0x1a')]],'as':_0xc26853['as'],'attributes':_0xc26853[_0x9854('0x17')],'include':_0xc26853['include']?_[_0x9854('0x19')](_0xc26853[_0x9854('0x18')],function(_0x25425c){return{'model':db[_0x25425c['model']],'as':_0x25425c['as'],'attributes':_0x25425c['attributes'],'include':_0x25425c['include']?_[_0x9854('0x19')](_0x25425c[_0x9854('0x18')],function(_0x2a4f8c){return{'model':db[_0x2a4f8c['model']],'as':_0x2a4f8c['as'],'attributes':_0x2a4f8c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16c5a0){logger['info']('GetTemplate',_0x1ebdf9);logger[_0x9854('0x1b')](_0x9854('0x13'),_0x1ebdf9,JSON[_0x9854('0x1c')](_0x16c5a0));_0x4e378b(_0x16c5a0);})['catch'](function(_0x51186d){logger[_0x9854('0xe')](_0x9854('0x13'),_0x51186d[_0x9854('0xf')],_0x1ebdf9);_0x3f913b(_0x269468[_0x9854('0xe')](0x1f4,_0x51186d[_0x9854('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4ef3115..361ca83 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 _0xabf0=['fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','post','create','addAllCondition','/:id/actions','addAction','put','exports','util','path','connect-timeout','express'];(function(_0x45bfcc,_0x276a99){var _0x58a4d7=function(_0x1befbd){while(--_0x1befbd){_0x45bfcc['push'](_0x45bfcc['shift']());}};_0x58a4d7(++_0x276a99);}(_0xabf0,0x183));var _0x0abf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xabf0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x0abf('0x0'));var path=require(_0x0abf('0x1'));var timeout=require(_0x0abf('0x2'));var express=require(_0x0abf('0x3'));var router=express['Router']();var fs_extra=require(_0x0abf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0abf('0x5'));var config=require(_0x0abf('0x6'));var controller=require(_0x0abf('0x7'));router[_0x0abf('0x8')]('/',auth[_0x0abf('0x9')](),controller[_0x0abf('0xa')]);router['get'](_0x0abf('0xb'),auth[_0x0abf('0x9')](),controller['show']);router['get'](_0x0abf('0xc'),auth[_0x0abf('0x9')](),controller[_0x0abf('0xd')]);router['get'](_0x0abf('0xe'),auth[_0x0abf('0x9')](),controller['getAnyConditions']);router[_0x0abf('0x8')]('/:id/actions',auth[_0x0abf('0x9')](),controller[_0x0abf('0xf')]);router[_0x0abf('0x10')]('/',auth[_0x0abf('0x9')](),controller[_0x0abf('0x11')]);router[_0x0abf('0x10')]('/:id/all_conditions',auth[_0x0abf('0x9')](),controller[_0x0abf('0x12')]);router[_0x0abf('0x10')](_0x0abf('0xe'),auth[_0x0abf('0x9')](),controller['addAnyCondition']);router[_0x0abf('0x10')](_0x0abf('0x13'),auth[_0x0abf('0x9')](),controller[_0x0abf('0x14')]);router[_0x0abf('0x15')]('/:id',auth[_0x0abf('0x9')](),controller['update']);router['delete'](_0x0abf('0xb'),auth[_0x0abf('0x9')](),controller['destroy']);module[_0x0abf('0x16')]=router; \ No newline at end of file +var _0xb57d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','/:id','update','delete','exports','multer','util','path'];(function(_0x38ac44,_0x38c414){var _0x42e9ae=function(_0x5f261c){while(--_0x5f261c){_0x38ac44['push'](_0x38ac44['shift']());}};_0x42e9ae(++_0x38c414);}(_0xb57d,0x18d));var _0xdb57=function(_0x7320ec,_0x3a3a7f){_0x7320ec=_0x7320ec-0x0;var _0x3c3b1b=_0xb57d[_0x7320ec];return _0x3c3b1b;};'use strict';var multer=require(_0xdb57('0x0'));var util=require(_0xdb57('0x1'));var path=require(_0xdb57('0x2'));var timeout=require(_0xdb57('0x3'));var express=require(_0xdb57('0x4'));var router=express['Router']();var fs_extra=require(_0xdb57('0x5'));var auth=require(_0xdb57('0x6'));var interaction=require(_0xdb57('0x7'));var config=require(_0xdb57('0x8'));var controller=require('./trigger.controller');router[_0xdb57('0x9')]('/',auth[_0xdb57('0xa')](),controller['index']);router[_0xdb57('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdb57('0xb')]);router[_0xdb57('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xdb57('0xc')]);router[_0xdb57('0x9')](_0xdb57('0xd'),auth[_0xdb57('0xa')](),controller[_0xdb57('0xe')]);router[_0xdb57('0x9')]('/:id/actions',auth[_0xdb57('0xa')](),controller['getActions']);router[_0xdb57('0xf')]('/',auth[_0xdb57('0xa')](),controller[_0xdb57('0x10')]);router[_0xdb57('0xf')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xdb57('0x11')]);router[_0xdb57('0xf')](_0xdb57('0xd'),auth['isAuthenticated'](),controller[_0xdb57('0x12')]);router[_0xdb57('0xf')](_0xdb57('0x13'),auth[_0xdb57('0xa')](),controller[_0xdb57('0x14')]);router['put'](_0xdb57('0x15'),auth[_0xdb57('0xa')](),controller[_0xdb57('0x16')]);router[_0xdb57('0x17')]('/:id',auth[_0xdb57('0xa')](),controller['destroy']);module[_0xdb57('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index aa70f31..24fe527 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 _0xa600=['BOOLEAN','sequelize','STRING'];(function(_0x3adf08,_0x10d810){var _0xd14b6c=function(_0x1fb20e){while(--_0x1fb20e){_0x3adf08['push'](_0x3adf08['shift']());}};_0xd14b6c(++_0x10d810);}(_0xa600,0x166));var _0x0a60=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0xa600[_0xf10840];return _0x1fdf7e;};'use strict';var Sequelize=require(_0x0a60('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0a60('0x1')]},'description':{'type':Sequelize[_0x0a60('0x1')]},'status':{'type':Sequelize[_0x0a60('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe8a1=['exports','STRING','sequelize'];(function(_0x31aa2f,_0x130943){var _0x4864a6=function(_0x296714){while(--_0x296714){_0x31aa2f['push'](_0x31aa2f['shift']());}};_0x4864a6(++_0x130943);}(_0xe8a1,0xad));var _0x1e8a=function(_0x3b5f08,_0x9e52a3){_0x3b5f08=_0x3b5f08-0x0;var _0x1961d2=_0xe8a1[_0x3b5f08];return _0x1961d2;};'use strict';var Sequelize=require(_0x1e8a('0x0'));module[_0x1e8a('0x1')]={'name':{'type':Sequelize[_0x1e8a('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1e8a('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 dba791a..99408fd 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 _0xd164=['name','send','index','map','Trigger','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','catch','keys','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','Triggers','destroy','error','stack'];(function(_0x54818d,_0x2853a5){var _0x420ccb=function(_0xb4c6cd){while(--_0xb4c6cd){_0x54818d['push'](_0x54818d['shift']());}};_0x420ccb(++_0x2853a5);}(_0xd164,0xde));var _0x4d16=function(_0x43b5ce,_0x1158a4){_0x43b5ce=_0x43b5ce-0x0;var _0x295a0a=_0xd164[_0x43b5ce];return _0x295a0a;};'use strict';var emlformat=require(_0x4d16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d16('0x1'));var jsonpatch=require(_0x4d16('0x2'));var rp=require(_0x4d16('0x3'));var moment=require(_0x4d16('0x4'));var BPromise=require(_0x4d16('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d16('0x6'));var sox=require(_0x4d16('0x7'));var csv=require('to-csv');var ejs=require(_0x4d16('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d16('0x9'));var squel=require(_0x4d16('0xa'));var crypto=require('crypto');var jsforce=require(_0x4d16('0xb'));var deskjs=require(_0x4d16('0xc'));var toCsv=require(_0x4d16('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d16('0xe'));var authService=require(_0x4d16('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4d16('0x10'));var hardwareService=require(_0x4d16('0x11'));var logger=require('../../config/logger')(_0x4d16('0x12'));var utils=require('../../config/utils');var config=require(_0x4d16('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d16('0x14'))['db'];function respondWithStatusCode(_0x5bb676,_0x50ee67){_0x50ee67=_0x50ee67||0xcc;return function(_0x471a3c){if(_0x471a3c){return _0x5bb676[_0x4d16('0x15')](_0x50ee67);}return _0x5bb676[_0x4d16('0x16')](_0x50ee67)['end']();};}function respondWithResult(_0x1218eb,_0x159bb9){_0x159bb9=_0x159bb9||0xc8;return function(_0x12e55b){if(_0x12e55b){return _0x1218eb[_0x4d16('0x16')](_0x159bb9)[_0x4d16('0x17')](_0x12e55b);}};}function respondWithFilteredResult(_0x294d0a,_0x430ef5){return function(_0x274af8){if(_0x274af8){var _0x203d69=typeof _0x430ef5[_0x4d16('0x18')]==='undefined'&&typeof _0x430ef5[_0x4d16('0x19')]==='undefined';var _0x9b43bc=_0x274af8[_0x4d16('0x1a')];var _0x1c0a4c=_0x203d69?0x0:_0x430ef5[_0x4d16('0x18')];var _0x59d289=_0x203d69?_0x274af8[_0x4d16('0x1a')]:_0x430ef5[_0x4d16('0x18')]+_0x430ef5['limit'];var _0x39da6e;if(_0x59d289>=_0x9b43bc){_0x59d289=_0x9b43bc;_0x39da6e=0xc8;}else{_0x39da6e=0xce;}_0x294d0a['status'](_0x39da6e);return _0x294d0a['set']('Content-Range',_0x1c0a4c+'-'+_0x59d289+'/'+_0x9b43bc)[_0x4d16('0x17')](_0x274af8);}return null;};}function patchUpdates(_0x3ba279){return function(_0x8e81ac){try{jsonpatch[_0x4d16('0x1b')](_0x8e81ac,_0x3ba279,!![]);}catch(_0x18d8f0){return BPromise[_0x4d16('0x1c')](_0x18d8f0);}return _0x8e81ac[_0x4d16('0x1d')]();};}function saveUpdates(_0x1cd972,_0x39e4e9){return function(_0x366ce4){if(_0x366ce4){return _0x366ce4[_0x4d16('0x1e')](_0x1cd972)[_0x4d16('0x1f')](function(_0xe34f93){return _0xe34f93;});}return null;};}function removeEntity(_0x162c24,_0xbfbe7d){return function(_0x1c5d10){if(_0x1c5d10){return _0x1c5d10['destroy']()['then'](function(){var _0x22c341=_0x1c5d10['get']({'plain':!![]});var _0x40e890=_0x4d16('0x20');return db['UserProfileResource'][_0x4d16('0x21')]({'where':{'type':_0x40e890,'resourceId':_0x22c341['id']}})['then'](function(){return _0x1c5d10;});})[_0x4d16('0x1f')](function(){_0x162c24[_0x4d16('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eede0,_0x165c0f){return function(_0x2085ed){if(!_0x2085ed){_0x3eede0['sendStatus'](0x194);}return _0x2085ed;};}function handleError(_0x6aaf7c,_0x2a3125){_0x2a3125=_0x2a3125||0x1f4;return function(_0x1af3a1){logger[_0x4d16('0x22')](_0x1af3a1[_0x4d16('0x23')]);if(_0x1af3a1['name']){delete _0x1af3a1[_0x4d16('0x24')];}_0x6aaf7c[_0x4d16('0x16')](_0x2a3125)[_0x4d16('0x25')](_0x1af3a1);};}exports[_0x4d16('0x26')]=function(_0x3a56a4,_0x45f832){var _0x2c9707={},_0x3cc95d={},_0x331e54={'count':0x0,'rows':[]};var _0x2e1600=_[_0x4d16('0x27')](db[_0x4d16('0x28')][_0x4d16('0x29')],function(_0x51fe27){return{'name':_0x51fe27['fieldName'],'type':_0x51fe27['type'][_0x4d16('0x2a')]};});_0x3cc95d[_0x4d16('0x2b')]=_['map'](_0x2e1600,'name');_0x3cc95d[_0x4d16('0x2c')]=_['keys'](_0x3a56a4[_0x4d16('0x2c')]);_0x3cc95d[_0x4d16('0x2d')]=_['intersection'](_0x3cc95d['model'],_0x3cc95d['query']);_0x2c9707[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0x3cc95d[_0x4d16('0x2b')],qs['fields'](_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x30')]));_0x2c9707[_0x4d16('0x2e')]=_0x2c9707['attributes'][_0x4d16('0x31')]?_0x2c9707[_0x4d16('0x2e')]:_0x3cc95d[_0x4d16('0x2b')];if(!_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x32')](_0x4d16('0x33'))){_0x2c9707[_0x4d16('0x19')]=qs['limit'](_0x3a56a4['query'][_0x4d16('0x19')]);_0x2c9707['offset']=qs['offset'](_0x3a56a4['query']['offset']);}_0x2c9707[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x2c9707[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_['pick'](_0x3a56a4[_0x4d16('0x2c')],_0x3cc95d[_0x4d16('0x2d')]),_0x2e1600);if(_0x3a56a4[_0x4d16('0x2c')]['filter']){_0x2c9707[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x2c9707[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x2e1600,function(_0x54c786){if(_0x54c786['type']!==_0x4d16('0x38')){var _0x2f49c8={};_0x2f49c8[_0x54c786[_0x4d16('0x24')]]={'$like':'%'+_0x3a56a4['query'][_0x4d16('0x39')]+'%'};return _0x2f49c8;}})});}_0x2c9707=_['merge']({},_0x2c9707,_0x3a56a4['options']);var _0x2ea7e5={'where':_0x2c9707['where']};return db[_0x4d16('0x28')][_0x4d16('0x1a')](_0x2ea7e5)['then'](function(_0x2d49e1){_0x331e54[_0x4d16('0x1a')]=_0x2d49e1;if(_0x3a56a4[_0x4d16('0x2c')][_0x4d16('0x3a')]){_0x2c9707['include']=[{'all':!![]}];}return db['Trigger'][_0x4d16('0x3b')](_0x2c9707);})[_0x4d16('0x1f')](function(_0x1b7c3e){_0x331e54['rows']=_0x1b7c3e;return _0x331e54;})[_0x4d16('0x1f')](respondWithFilteredResult(_0x45f832,_0x2c9707))[_0x4d16('0x3c')](handleError(_0x45f832,null));};exports['show']=function(_0x3e0f54,_0x26e7eb){var _0xc106a5={'raw':![],'where':{'id':_0x3e0f54['params']['id']}},_0x24b695={};_0x24b695[_0x4d16('0x2b')]=_[_0x4d16('0x3d')](db['Trigger'][_0x4d16('0x29')]);_0x24b695[_0x4d16('0x2c')]=_[_0x4d16('0x3d')](_0x3e0f54[_0x4d16('0x2c')]);_0x24b695[_0x4d16('0x2d')]=_[_0x4d16('0x2f')](_0x24b695[_0x4d16('0x2b')],_0x24b695['query']);_0xc106a5[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0x24b695[_0x4d16('0x2b')],qs[_0x4d16('0x30')](_0x3e0f54['query'][_0x4d16('0x30')]));_0xc106a5[_0x4d16('0x2e')]=_0xc106a5[_0x4d16('0x2e')][_0x4d16('0x31')]?_0xc106a5[_0x4d16('0x2e')]:_0x24b695['model'];if(_0x3e0f54['query']['includeAll']){_0xc106a5[_0x4d16('0x3e')]=[{'all':!![]}];}_0xc106a5=_[_0x4d16('0x37')]({},_0xc106a5,_0x3e0f54[_0x4d16('0x3f')]);return db['Trigger'][_0x4d16('0x40')](_0xc106a5)['then'](handleEntityNotFound(_0x26e7eb,null))[_0x4d16('0x1f')](respondWithResult(_0x26e7eb,null))['catch'](handleError(_0x26e7eb,null));};exports[_0x4d16('0x41')]=function(_0x1ad52a,_0x5a3e81){return db[_0x4d16('0x28')][_0x4d16('0x41')](_0x1ad52a['body'],{})[_0x4d16('0x1f')](function(_0x4b0ff2){var _0x1b22fc=_0x1ad52a['user']['get']({'plain':!![]});if(!_0x1b22fc)throw new Error(_0x4d16('0x42'));if(_0x1b22fc[_0x4d16('0x43')]===_0x4d16('0x44')){var _0x29532e=_0x4b0ff2[_0x4d16('0x45')]({'plain':!![]});var _0x346f21=_0x4d16('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x346f21,'userProfileId':_0x1b22fc[_0x4d16('0x46')]},'raw':!![]})[_0x4d16('0x1f')](function(_0x4eee9a){if(_0x4eee9a&&_0x4eee9a[_0x4d16('0x47')]===0x0){return db['UserProfileResource'][_0x4d16('0x41')]({'name':_0x29532e[_0x4d16('0x24')],'resourceId':_0x29532e['id'],'type':_0x4eee9a['name'],'sectionId':_0x4eee9a['id']},{})[_0x4d16('0x1f')](function(){return _0x4b0ff2;});}else{return _0x4b0ff2;}})[_0x4d16('0x3c')](function(_0x3ba688){logger[_0x4d16('0x22')](_0x4d16('0x48'),_0x3ba688);throw _0x3ba688;});}return _0x4b0ff2;})[_0x4d16('0x1f')](respondWithResult(_0x5a3e81,0xc9))['catch'](handleError(_0x5a3e81,null));};exports['update']=function(_0x536faa,_0x1609a7){if(_0x536faa['body']['id']){delete _0x536faa[_0x4d16('0x49')]['id'];}return db['Trigger'][_0x4d16('0x40')]({'where':{'id':_0x536faa[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x1609a7,null))['then'](saveUpdates(_0x536faa['body'],null))['then'](respondWithResult(_0x1609a7,null))[_0x4d16('0x3c')](handleError(_0x1609a7,null));};exports[_0x4d16('0x21')]=function(_0x2d38d4,_0x303e9f){return db[_0x4d16('0x28')][_0x4d16('0x40')]({'where':{'id':_0x2d38d4['params']['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x303e9f,null))[_0x4d16('0x1f')](removeEntity(_0x303e9f,null))['catch'](handleError(_0x303e9f,null));};exports[_0x4d16('0x4b')]=function(_0x4a8a64,_0x179542,_0x4d2368){if(_0x4a8a64['body']['id']){delete _0x4a8a64['body']['id'];}return db[_0x4d16('0x28')][_0x4d16('0x40')]({'where':{'id':_0x4a8a64[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x179542,null))[_0x4d16('0x1f')](function(_0x3a7b13){if(_0x3a7b13){_0x4a8a64[_0x4d16('0x49')][_0x4d16('0x4c')]=_0x3a7b13['id'];return db[_0x4d16('0x4d')][_0x4d16('0x41')](_0x4a8a64['body']);}})[_0x4d16('0x1f')](respondWithResult(_0x179542,null))[_0x4d16('0x3c')](handleError(_0x179542,null));};exports['addAnyCondition']=function(_0x3a59e8,_0x1a2047,_0x4b45ef){if(_0x3a59e8[_0x4d16('0x49')]['id']){delete _0x3a59e8[_0x4d16('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3a59e8[_0x4d16('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a2047,null))[_0x4d16('0x1f')](function(_0x5199cf){if(_0x5199cf){_0x3a59e8[_0x4d16('0x49')][_0x4d16('0x4e')]=_0x5199cf['id'];return db[_0x4d16('0x4d')][_0x4d16('0x41')](_0x3a59e8['body']);}})[_0x4d16('0x1f')](respondWithResult(_0x1a2047,null))[_0x4d16('0x3c')](handleError(_0x1a2047,null));};exports[_0x4d16('0x4f')]=function(_0x15d8ff,_0x13e98e,_0x1e079d){var _0x2fa8e4={};var _0x2b9a6b={};var _0x31d6f3;var _0xa04450;return db['Trigger'][_0x4d16('0x50')]({'where':{'id':_0x15d8ff[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x13e98e,null))[_0x4d16('0x1f')](function(_0xa84848){if(_0xa84848){_0x31d6f3=_0xa84848;_0x2b9a6b['model']=_[_0x4d16('0x3d')](db[_0x4d16('0x4d')][_0x4d16('0x29')]);_0x2b9a6b[_0x4d16('0x2c')]=_[_0x4d16('0x3d')](_0x15d8ff[_0x4d16('0x2c')]);_0x2b9a6b['filters']=_['intersection'](_0x2b9a6b[_0x4d16('0x2b')],_0x2b9a6b[_0x4d16('0x2c')]);_0x2fa8e4[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0x2b9a6b[_0x4d16('0x2b')],qs[_0x4d16('0x30')](_0x15d8ff['query'][_0x4d16('0x30')]));_0x2fa8e4[_0x4d16('0x2e')]=_0x2fa8e4[_0x4d16('0x2e')][_0x4d16('0x31')]?_0x2fa8e4[_0x4d16('0x2e')]:_0x2b9a6b[_0x4d16('0x2b')];_0x2fa8e4[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x2fa8e4[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_[_0x4d16('0x51')](_0x15d8ff['query'],_0x2b9a6b[_0x4d16('0x2d')]));if(_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x39')]){_0x2fa8e4[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x2fa8e4[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x2fa8e4[_0x4d16('0x2e')],function(_0x3a0bd6){var _0x2812a9={};_0x2812a9[_0x3a0bd6]={'$like':'%'+_0x15d8ff[_0x4d16('0x2c')]['filter']+'%'};return _0x2812a9;})});}_0x2fa8e4=_[_0x4d16('0x37')]({},_0x2fa8e4,_0x15d8ff[_0x4d16('0x3f')]);return _0x31d6f3[_0x4d16('0x4f')](_0x2fa8e4);}})['then'](function(_0x2b5a13){if(_0x2b5a13){_0xa04450=_0x2b5a13[_0x4d16('0x31')];if(!_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x32')](_0x4d16('0x33'))){_0x2fa8e4[_0x4d16('0x19')]=qs[_0x4d16('0x19')](_0x15d8ff[_0x4d16('0x2c')]['limit']);_0x2fa8e4[_0x4d16('0x18')]=qs[_0x4d16('0x18')](_0x15d8ff[_0x4d16('0x2c')][_0x4d16('0x18')]);}return _0x31d6f3[_0x4d16('0x4f')](_0x2fa8e4);}})[_0x4d16('0x1f')](function(_0xa0bef6){if(_0xa0bef6){return _0xa0bef6?{'count':_0xa04450,'rows':_0xa0bef6}:null;}})[_0x4d16('0x1f')](respondWithResult(_0x13e98e,null))[_0x4d16('0x3c')](handleError(_0x13e98e,null));};exports[_0x4d16('0x52')]=function(_0x4ec974,_0x4db4f0,_0x1367d6){var _0x40ebf5={};var _0xfa0bae={};var _0xaa886a;var _0x3ae761;return db[_0x4d16('0x28')][_0x4d16('0x50')]({'where':{'id':_0x4ec974[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x4db4f0,null))[_0x4d16('0x1f')](function(_0x34950a){if(_0x34950a){_0xaa886a=_0x34950a;_0xfa0bae[_0x4d16('0x2b')]=_[_0x4d16('0x3d')](db[_0x4d16('0x4d')]['rawAttributes']);_0xfa0bae[_0x4d16('0x2c')]=_[_0x4d16('0x3d')](_0x4ec974[_0x4d16('0x2c')]);_0xfa0bae[_0x4d16('0x2d')]=_[_0x4d16('0x2f')](_0xfa0bae[_0x4d16('0x2b')],_0xfa0bae[_0x4d16('0x2c')]);_0x40ebf5[_0x4d16('0x2e')]=_[_0x4d16('0x2f')](_0xfa0bae[_0x4d16('0x2b')],qs[_0x4d16('0x30')](_0x4ec974['query']['fields']));_0x40ebf5[_0x4d16('0x2e')]=_0x40ebf5[_0x4d16('0x2e')]['length']?_0x40ebf5[_0x4d16('0x2e')]:_0xfa0bae['model'];_0x40ebf5[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x40ebf5[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_['pick'](_0x4ec974[_0x4d16('0x2c')],_0xfa0bae[_0x4d16('0x2d')]));if(_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x39')]){_0x40ebf5[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x40ebf5[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x40ebf5[_0x4d16('0x2e')],function(_0x26042f){var _0x3d5c8c={};_0x3d5c8c[_0x26042f]={'$like':'%'+_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x39')]+'%'};return _0x3d5c8c;})});}_0x40ebf5=_['merge']({},_0x40ebf5,_0x4ec974[_0x4d16('0x3f')]);return _0xaa886a[_0x4d16('0x52')](_0x40ebf5);}})[_0x4d16('0x1f')](function(_0x20cd36){if(_0x20cd36){_0x3ae761=_0x20cd36[_0x4d16('0x31')];if(!_0x4ec974['query'][_0x4d16('0x32')]('nolimit')){_0x40ebf5[_0x4d16('0x19')]=qs[_0x4d16('0x19')](_0x4ec974[_0x4d16('0x2c')]['limit']);_0x40ebf5[_0x4d16('0x18')]=qs[_0x4d16('0x18')](_0x4ec974[_0x4d16('0x2c')][_0x4d16('0x18')]);}return _0xaa886a[_0x4d16('0x52')](_0x40ebf5);}})['then'](function(_0x56af20){if(_0x56af20){return _0x56af20?{'count':_0x3ae761,'rows':_0x56af20}:null;}})['then'](respondWithResult(_0x4db4f0,null))['catch'](handleError(_0x4db4f0,null));};exports['addAction']=function(_0x2b63ed,_0x4da56c,_0x4960ca){if(_0x2b63ed[_0x4d16('0x49')]['id']){delete _0x2b63ed[_0x4d16('0x49')]['id'];}return db[_0x4d16('0x28')]['find']({'where':{'id':_0x2b63ed[_0x4d16('0x4a')]['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x4da56c,null))[_0x4d16('0x1f')](function(_0x2644aa){if(_0x2644aa){_0x2b63ed[_0x4d16('0x49')][_0x4d16('0x53')]=_0x2644aa['id'];return db[_0x4d16('0x54')][_0x4d16('0x41')](_0x2b63ed[_0x4d16('0x49')]);}})['then'](respondWithResult(_0x4da56c,null))[_0x4d16('0x3c')](handleError(_0x4da56c,null));};exports[_0x4d16('0x55')]=function(_0x55a729,_0x259b64,_0x1d5fab){var _0x1bfdb1={};var _0x5ca5bd={};var _0x6ade57;var _0x54d5a1;return db[_0x4d16('0x28')][_0x4d16('0x50')]({'where':{'id':_0x55a729['params']['id']}})[_0x4d16('0x1f')](handleEntityNotFound(_0x259b64,null))[_0x4d16('0x1f')](function(_0x5aaf9f){if(_0x5aaf9f){_0x6ade57=_0x5aaf9f;_0x5ca5bd['model']=_[_0x4d16('0x3d')](db['Action']['rawAttributes']);_0x5ca5bd['query']=_[_0x4d16('0x3d')](_0x55a729[_0x4d16('0x2c')]);_0x5ca5bd[_0x4d16('0x2d')]=_[_0x4d16('0x2f')](_0x5ca5bd[_0x4d16('0x2b')],_0x5ca5bd[_0x4d16('0x2c')]);_0x1bfdb1['attributes']=_['intersection'](_0x5ca5bd['model'],qs['fields'](_0x55a729['query'][_0x4d16('0x30')]));_0x1bfdb1[_0x4d16('0x2e')]=_0x1bfdb1['attributes'][_0x4d16('0x31')]?_0x1bfdb1[_0x4d16('0x2e')]:_0x5ca5bd[_0x4d16('0x2b')];_0x1bfdb1[_0x4d16('0x34')]=qs[_0x4d16('0x35')](_0x55a729[_0x4d16('0x2c')][_0x4d16('0x35')]);_0x1bfdb1[_0x4d16('0x36')]=qs[_0x4d16('0x2d')](_[_0x4d16('0x51')](_0x55a729[_0x4d16('0x2c')],_0x5ca5bd['filters']));if(_0x55a729['query']['filter']){_0x1bfdb1[_0x4d16('0x36')]=_[_0x4d16('0x37')](_0x1bfdb1[_0x4d16('0x36')],{'$or':_[_0x4d16('0x27')](_0x1bfdb1[_0x4d16('0x2e')],function(_0x1f6741){var _0x1a0e1c={};_0x1a0e1c[_0x1f6741]={'$like':'%'+_0x55a729['query'][_0x4d16('0x39')]+'%'};return _0x1a0e1c;})});}_0x1bfdb1=_['merge']({},_0x1bfdb1,_0x55a729['options']);return _0x6ade57[_0x4d16('0x55')](_0x1bfdb1);}})['then'](function(_0x403e1b){if(_0x403e1b){_0x54d5a1=_0x403e1b[_0x4d16('0x31')];if(!_0x55a729[_0x4d16('0x2c')]['hasOwnProperty'](_0x4d16('0x33'))){_0x1bfdb1[_0x4d16('0x19')]=qs[_0x4d16('0x19')](_0x55a729[_0x4d16('0x2c')][_0x4d16('0x19')]);_0x1bfdb1[_0x4d16('0x18')]=qs['offset'](_0x55a729[_0x4d16('0x2c')][_0x4d16('0x18')]);}return _0x6ade57[_0x4d16('0x55')](_0x1bfdb1);}})[_0x4d16('0x1f')](function(_0x4b0e47){if(_0x4b0e47){return _0x4b0e47?{'count':_0x54d5a1,'rows':_0x4b0e47}:null;}})['then'](respondWithResult(_0x259b64,null))[_0x4d16('0x3c')](handleError(_0x259b64,null));}; \ No newline at end of file +var _0x9bb2=['addAnyCondition','TriggerAnyId','filter','options','getAllConditions','nolimit','getAnyConditions','findOne','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Triggers','end','stack','name','send','index','Trigger','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition'];(function(_0x3c0615,_0x462546){var _0x10e867=function(_0x4a9668){while(--_0x4a9668){_0x3c0615['push'](_0x3c0615['shift']());}};_0x10e867(++_0x462546);}(_0x9bb2,0x128));var _0x29bb=function(_0x280b6c,_0x39daa7){_0x280b6c=_0x280b6c-0x0;var _0x4e8ed5=_0x9bb2[_0x280b6c];return _0x4e8ed5;};'use strict';var emlformat=require(_0x29bb('0x0'));var rimraf=require(_0x29bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29bb('0x2'));var rp=require(_0x29bb('0x3'));var moment=require(_0x29bb('0x4'));var BPromise=require(_0x29bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x29bb('0x6'));var ejs=require(_0x29bb('0x7'));var fs=require('fs');var fs_extra=require(_0x29bb('0x8'));var _=require(_0x29bb('0x9'));var squel=require(_0x29bb('0xa'));var crypto=require(_0x29bb('0xb'));var jsforce=require(_0x29bb('0xc'));var deskjs=require(_0x29bb('0xd'));var toCsv=require(_0x29bb('0x6'));var querystring=require(_0x29bb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x29bb('0xf'));var qs=require(_0x29bb('0x10'));var as=require(_0x29bb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29bb('0x12'))(_0x29bb('0x13'));var utils=require(_0x29bb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x29bb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84281c,_0x4e3a05){_0x4e3a05=_0x4e3a05||0xcc;return function(_0x546ad3){if(_0x546ad3){return _0x84281c[_0x29bb('0x16')](_0x4e3a05);}return _0x84281c[_0x29bb('0x17')](_0x4e3a05)['end']();};}function respondWithResult(_0x52bc62,_0x15a3f3){_0x15a3f3=_0x15a3f3||0xc8;return function(_0x371c67){if(_0x371c67){return _0x52bc62[_0x29bb('0x17')](_0x15a3f3)[_0x29bb('0x18')](_0x371c67);}};}function respondWithFilteredResult(_0x778721,_0x27c3b9){return function(_0x1b21e9){if(_0x1b21e9){var _0x269c16=typeof _0x27c3b9['offset']==='undefined'&&typeof _0x27c3b9[_0x29bb('0x19')]===_0x29bb('0x1a');var _0x51173b=_0x1b21e9[_0x29bb('0x1b')];var _0x395d46=_0x269c16?0x0:_0x27c3b9[_0x29bb('0x1c')];var _0x5b5be9=_0x269c16?_0x1b21e9[_0x29bb('0x1b')]:_0x27c3b9['offset']+_0x27c3b9[_0x29bb('0x19')];var _0x27e236;if(_0x5b5be9>=_0x51173b){_0x5b5be9=_0x51173b;_0x27e236=0xc8;}else{_0x27e236=0xce;}_0x778721[_0x29bb('0x17')](_0x27e236);return _0x778721[_0x29bb('0x1d')](_0x29bb('0x1e'),_0x395d46+'-'+_0x5b5be9+'/'+_0x51173b)[_0x29bb('0x18')](_0x1b21e9);}return null;};}function patchUpdates(_0x16e802){return function(_0x590ec0){try{jsonpatch[_0x29bb('0x1f')](_0x590ec0,_0x16e802,!![]);}catch(_0x47c725){return BPromise[_0x29bb('0x20')](_0x47c725);}return _0x590ec0[_0x29bb('0x21')]();};}function saveUpdates(_0xae103,_0x53adff){return function(_0x9009df){if(_0x9009df){return _0x9009df[_0x29bb('0x22')](_0xae103)[_0x29bb('0x23')](function(_0x10f6e1){return _0x10f6e1;});}return null;};}function removeEntity(_0x364d85,_0x5f3bd5){return function(_0x267064){if(_0x267064){return _0x267064[_0x29bb('0x24')]()[_0x29bb('0x23')](function(){var _0x20a554=_0x267064['get']({'plain':!![]});var _0x55fe62=_0x29bb('0x25');return db['UserProfileResource'][_0x29bb('0x24')]({'where':{'type':_0x55fe62,'resourceId':_0x20a554['id']}})[_0x29bb('0x23')](function(){return _0x267064;});})[_0x29bb('0x23')](function(){_0x364d85[_0x29bb('0x17')](0xcc)[_0x29bb('0x26')]();});}};}function handleEntityNotFound(_0x3430cc,_0x5781b3){return function(_0x5233cb){if(!_0x5233cb){_0x3430cc[_0x29bb('0x16')](0x194);}return _0x5233cb;};}function handleError(_0x2584bc,_0xd71bf8){_0xd71bf8=_0xd71bf8||0x1f4;return function(_0x4c3533){logger['error'](_0x4c3533[_0x29bb('0x27')]);if(_0x4c3533[_0x29bb('0x28')]){delete _0x4c3533[_0x29bb('0x28')];}_0x2584bc[_0x29bb('0x17')](_0xd71bf8)[_0x29bb('0x29')](_0x4c3533);};}exports[_0x29bb('0x2a')]=function(_0x3cc685,_0x3760cc){var _0x20f6c8={},_0x194bfc={},_0x321c1d={'count':0x0,'rows':[]};var _0x257744=_['map'](db[_0x29bb('0x2b')][_0x29bb('0x2c')],function(_0x2273b0){return{'name':_0x2273b0[_0x29bb('0x2d')],'type':_0x2273b0[_0x29bb('0x2e')][_0x29bb('0x2f')]};});_0x194bfc['model']=_[_0x29bb('0x30')](_0x257744,_0x29bb('0x28'));_0x194bfc[_0x29bb('0x31')]=_[_0x29bb('0x32')](_0x3cc685[_0x29bb('0x31')]);_0x194bfc['filters']=_['intersection'](_0x194bfc[_0x29bb('0x33')],_0x194bfc[_0x29bb('0x31')]);_0x20f6c8[_0x29bb('0x34')]=_['intersection'](_0x194bfc['model'],qs[_0x29bb('0x35')](_0x3cc685[_0x29bb('0x31')][_0x29bb('0x35')]));_0x20f6c8[_0x29bb('0x34')]=_0x20f6c8[_0x29bb('0x34')][_0x29bb('0x36')]?_0x20f6c8[_0x29bb('0x34')]:_0x194bfc[_0x29bb('0x33')];if(!_0x3cc685[_0x29bb('0x31')][_0x29bb('0x37')]('nolimit')){_0x20f6c8[_0x29bb('0x19')]=qs[_0x29bb('0x19')](_0x3cc685[_0x29bb('0x31')]['limit']);_0x20f6c8[_0x29bb('0x1c')]=qs[_0x29bb('0x1c')](_0x3cc685[_0x29bb('0x31')][_0x29bb('0x1c')]);}_0x20f6c8[_0x29bb('0x38')]=qs[_0x29bb('0x39')](_0x3cc685[_0x29bb('0x31')]['sort']);_0x20f6c8['where']=qs[_0x29bb('0x3a')](_[_0x29bb('0x3b')](_0x3cc685['query'],_0x194bfc[_0x29bb('0x3a')]),_0x257744);if(_0x3cc685[_0x29bb('0x31')]['filter']){_0x20f6c8['where']=_['merge'](_0x20f6c8[_0x29bb('0x3c')],{'$or':_['map'](_0x257744,function(_0x25c6d5){if(_0x25c6d5[_0x29bb('0x2e')]!==_0x29bb('0x3d')){var _0x3d41c6={};_0x3d41c6[_0x25c6d5[_0x29bb('0x28')]]={'$like':'%'+_0x3cc685[_0x29bb('0x31')]['filter']+'%'};return _0x3d41c6;}})});}_0x20f6c8=_[_0x29bb('0x3e')]({},_0x20f6c8,_0x3cc685['options']);var _0x300325={'where':_0x20f6c8[_0x29bb('0x3c')]};return db[_0x29bb('0x2b')]['count'](_0x300325)[_0x29bb('0x23')](function(_0x59a219){_0x321c1d[_0x29bb('0x1b')]=_0x59a219;if(_0x3cc685['query'][_0x29bb('0x3f')]){_0x20f6c8[_0x29bb('0x40')]=[{'all':!![]}];}return db[_0x29bb('0x2b')][_0x29bb('0x41')](_0x20f6c8);})[_0x29bb('0x23')](function(_0x4f17ef){_0x321c1d[_0x29bb('0x42')]=_0x4f17ef;return _0x321c1d;})['then'](respondWithFilteredResult(_0x3760cc,_0x20f6c8))['catch'](handleError(_0x3760cc,null));};exports[_0x29bb('0x43')]=function(_0x3ebcc5,_0x4d7857){var _0x42ef71={'raw':![],'where':{'id':_0x3ebcc5[_0x29bb('0x44')]['id']}},_0x344c32={};_0x344c32[_0x29bb('0x33')]=_[_0x29bb('0x32')](db[_0x29bb('0x2b')][_0x29bb('0x2c')]);_0x344c32['query']=_[_0x29bb('0x32')](_0x3ebcc5['query']);_0x344c32[_0x29bb('0x3a')]=_['intersection'](_0x344c32['model'],_0x344c32[_0x29bb('0x31')]);_0x42ef71[_0x29bb('0x34')]=_[_0x29bb('0x45')](_0x344c32[_0x29bb('0x33')],qs[_0x29bb('0x35')](_0x3ebcc5[_0x29bb('0x31')][_0x29bb('0x35')]));_0x42ef71[_0x29bb('0x34')]=_0x42ef71['attributes'][_0x29bb('0x36')]?_0x42ef71['attributes']:_0x344c32[_0x29bb('0x33')];if(_0x3ebcc5[_0x29bb('0x31')][_0x29bb('0x3f')]){_0x42ef71[_0x29bb('0x40')]=[{'all':!![]}];}_0x42ef71=_[_0x29bb('0x3e')]({},_0x42ef71,_0x3ebcc5['options']);return db[_0x29bb('0x2b')][_0x29bb('0x46')](_0x42ef71)['then'](handleEntityNotFound(_0x4d7857,null))[_0x29bb('0x23')](respondWithResult(_0x4d7857,null))[_0x29bb('0x47')](handleError(_0x4d7857,null));};exports[_0x29bb('0x48')]=function(_0xed9e3f,_0x5623a4){return db[_0x29bb('0x2b')]['create'](_0xed9e3f['body'],{})['then'](function(_0x938b3b){var _0x5e3bac=_0xed9e3f[_0x29bb('0x49')]['get']({'plain':!![]});if(!_0x5e3bac)throw new Error(_0x29bb('0x4a'));if(_0x5e3bac[_0x29bb('0x4b')]===_0x29bb('0x49')){var _0x49c61a=_0x938b3b[_0x29bb('0x4c')]({'plain':!![]});var _0x1a01a3=_0x29bb('0x25');return db[_0x29bb('0x4d')][_0x29bb('0x46')]({'where':{'name':_0x1a01a3,'userProfileId':_0x5e3bac['userProfileId']},'raw':!![]})[_0x29bb('0x23')](function(_0x5e8336){if(_0x5e8336&&_0x5e8336['autoAssociation']===0x0){return db[_0x29bb('0x4e')][_0x29bb('0x48')]({'name':_0x49c61a[_0x29bb('0x28')],'resourceId':_0x49c61a['id'],'type':_0x5e8336[_0x29bb('0x28')],'sectionId':_0x5e8336['id']},{})[_0x29bb('0x23')](function(){return _0x938b3b;});}else{return _0x938b3b;}})[_0x29bb('0x47')](function(_0x32f877){logger[_0x29bb('0x4f')](_0x29bb('0x50'),_0x32f877);throw _0x32f877;});}return _0x938b3b;})[_0x29bb('0x23')](respondWithResult(_0x5623a4,0xc9))[_0x29bb('0x47')](handleError(_0x5623a4,null));};exports[_0x29bb('0x22')]=function(_0x2b65e0,_0x5f2330){if(_0x2b65e0['body']['id']){delete _0x2b65e0['body']['id'];}return db[_0x29bb('0x2b')][_0x29bb('0x46')]({'where':{'id':_0x2b65e0['params']['id']}})[_0x29bb('0x23')](handleEntityNotFound(_0x5f2330,null))['then'](saveUpdates(_0x2b65e0[_0x29bb('0x51')],null))['then'](respondWithResult(_0x5f2330,null))[_0x29bb('0x47')](handleError(_0x5f2330,null));};exports[_0x29bb('0x24')]=function(_0x4326f5,_0x27758a){return db[_0x29bb('0x2b')][_0x29bb('0x46')]({'where':{'id':_0x4326f5['params']['id']}})['then'](handleEntityNotFound(_0x27758a,null))[_0x29bb('0x23')](removeEntity(_0x27758a,null))[_0x29bb('0x47')](handleError(_0x27758a,null));};exports[_0x29bb('0x52')]=function(_0x1013d1,_0x29f46f,_0x1c5fec){if(_0x1013d1['body']['id']){delete _0x1013d1[_0x29bb('0x51')]['id'];}return db[_0x29bb('0x2b')][_0x29bb('0x46')]({'where':{'id':_0x1013d1[_0x29bb('0x44')]['id']}})[_0x29bb('0x23')](handleEntityNotFound(_0x29f46f,null))['then'](function(_0x5f516a){if(_0x5f516a){_0x1013d1[_0x29bb('0x51')]['TriggerAllId']=_0x5f516a['id'];return db[_0x29bb('0x53')][_0x29bb('0x48')](_0x1013d1[_0x29bb('0x51')]);}})[_0x29bb('0x23')](respondWithResult(_0x29f46f,null))[_0x29bb('0x47')](handleError(_0x29f46f,null));};exports[_0x29bb('0x54')]=function(_0x5ace32,_0xdf118f,_0xc7c3dd){if(_0x5ace32[_0x29bb('0x51')]['id']){delete _0x5ace32[_0x29bb('0x51')]['id'];}return db['Trigger'][_0x29bb('0x46')]({'where':{'id':_0x5ace32['params']['id']}})['then'](handleEntityNotFound(_0xdf118f,null))[_0x29bb('0x23')](function(_0x581892){if(_0x581892){_0x5ace32['body'][_0x29bb('0x55')]=_0x581892['id'];return db[_0x29bb('0x53')]['create'](_0x5ace32[_0x29bb('0x51')]);}})['then'](respondWithResult(_0xdf118f,null))[_0x29bb('0x47')](handleError(_0xdf118f,null));};exports['getAllConditions']=function(_0x445a40,_0x412ac9,_0x51ed7b){var _0x5a5211={};var _0x4e2a7f={};var _0x3bd8cf;var _0x56f9d6;return db[_0x29bb('0x2b')]['findOne']({'where':{'id':_0x445a40['params']['id']}})[_0x29bb('0x23')](handleEntityNotFound(_0x412ac9,null))[_0x29bb('0x23')](function(_0x3f17f5){if(_0x3f17f5){_0x3bd8cf=_0x3f17f5;_0x4e2a7f[_0x29bb('0x33')]=_['keys'](db[_0x29bb('0x53')][_0x29bb('0x2c')]);_0x4e2a7f[_0x29bb('0x31')]=_['keys'](_0x445a40[_0x29bb('0x31')]);_0x4e2a7f['filters']=_[_0x29bb('0x45')](_0x4e2a7f['model'],_0x4e2a7f[_0x29bb('0x31')]);_0x5a5211['attributes']=_['intersection'](_0x4e2a7f[_0x29bb('0x33')],qs[_0x29bb('0x35')](_0x445a40['query']['fields']));_0x5a5211['attributes']=_0x5a5211[_0x29bb('0x34')]['length']?_0x5a5211[_0x29bb('0x34')]:_0x4e2a7f['model'];_0x5a5211[_0x29bb('0x38')]=qs['sort'](_0x445a40[_0x29bb('0x31')][_0x29bb('0x39')]);_0x5a5211['where']=qs[_0x29bb('0x3a')](_['pick'](_0x445a40[_0x29bb('0x31')],_0x4e2a7f[_0x29bb('0x3a')]));if(_0x445a40[_0x29bb('0x31')][_0x29bb('0x56')]){_0x5a5211[_0x29bb('0x3c')]=_[_0x29bb('0x3e')](_0x5a5211['where'],{'$or':_['map'](_0x5a5211[_0x29bb('0x34')],function(_0x4ff040){var _0x58ecd3={};_0x58ecd3[_0x4ff040]={'$like':'%'+_0x445a40[_0x29bb('0x31')][_0x29bb('0x56')]+'%'};return _0x58ecd3;})});}_0x5a5211=_[_0x29bb('0x3e')]({},_0x5a5211,_0x445a40[_0x29bb('0x57')]);return _0x3bd8cf[_0x29bb('0x58')](_0x5a5211);}})[_0x29bb('0x23')](function(_0x4d11d6){if(_0x4d11d6){_0x56f9d6=_0x4d11d6[_0x29bb('0x36')];if(!_0x445a40['query'][_0x29bb('0x37')](_0x29bb('0x59'))){_0x5a5211['limit']=qs[_0x29bb('0x19')](_0x445a40[_0x29bb('0x31')][_0x29bb('0x19')]);_0x5a5211['offset']=qs[_0x29bb('0x1c')](_0x445a40[_0x29bb('0x31')][_0x29bb('0x1c')]);}return _0x3bd8cf[_0x29bb('0x58')](_0x5a5211);}})[_0x29bb('0x23')](function(_0x38dff5){if(_0x38dff5){return _0x38dff5?{'count':_0x56f9d6,'rows':_0x38dff5}:null;}})[_0x29bb('0x23')](respondWithResult(_0x412ac9,null))[_0x29bb('0x47')](handleError(_0x412ac9,null));};exports[_0x29bb('0x5a')]=function(_0x23271b,_0x5eb056,_0x122900){var _0x54a532={};var _0x50c31c={};var _0xc57f9c;var _0x4459ff;return db[_0x29bb('0x2b')][_0x29bb('0x5b')]({'where':{'id':_0x23271b[_0x29bb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5eb056,null))[_0x29bb('0x23')](function(_0x22fc62){if(_0x22fc62){_0xc57f9c=_0x22fc62;_0x50c31c[_0x29bb('0x33')]=_['keys'](db[_0x29bb('0x53')][_0x29bb('0x2c')]);_0x50c31c[_0x29bb('0x31')]=_['keys'](_0x23271b['query']);_0x50c31c[_0x29bb('0x3a')]=_[_0x29bb('0x45')](_0x50c31c[_0x29bb('0x33')],_0x50c31c[_0x29bb('0x31')]);_0x54a532[_0x29bb('0x34')]=_[_0x29bb('0x45')](_0x50c31c[_0x29bb('0x33')],qs[_0x29bb('0x35')](_0x23271b[_0x29bb('0x31')][_0x29bb('0x35')]));_0x54a532['attributes']=_0x54a532[_0x29bb('0x34')][_0x29bb('0x36')]?_0x54a532[_0x29bb('0x34')]:_0x50c31c[_0x29bb('0x33')];_0x54a532[_0x29bb('0x38')]=qs[_0x29bb('0x39')](_0x23271b[_0x29bb('0x31')][_0x29bb('0x39')]);_0x54a532[_0x29bb('0x3c')]=qs[_0x29bb('0x3a')](_[_0x29bb('0x3b')](_0x23271b[_0x29bb('0x31')],_0x50c31c[_0x29bb('0x3a')]));if(_0x23271b[_0x29bb('0x31')][_0x29bb('0x56')]){_0x54a532[_0x29bb('0x3c')]=_[_0x29bb('0x3e')](_0x54a532[_0x29bb('0x3c')],{'$or':_[_0x29bb('0x30')](_0x54a532[_0x29bb('0x34')],function(_0xd87735){var _0x3691ad={};_0x3691ad[_0xd87735]={'$like':'%'+_0x23271b[_0x29bb('0x31')][_0x29bb('0x56')]+'%'};return _0x3691ad;})});}_0x54a532=_[_0x29bb('0x3e')]({},_0x54a532,_0x23271b[_0x29bb('0x57')]);return _0xc57f9c[_0x29bb('0x5a')](_0x54a532);}})[_0x29bb('0x23')](function(_0x5e5a5e){if(_0x5e5a5e){_0x4459ff=_0x5e5a5e[_0x29bb('0x36')];if(!_0x23271b['query']['hasOwnProperty'](_0x29bb('0x59'))){_0x54a532[_0x29bb('0x19')]=qs[_0x29bb('0x19')](_0x23271b['query'][_0x29bb('0x19')]);_0x54a532['offset']=qs[_0x29bb('0x1c')](_0x23271b[_0x29bb('0x31')][_0x29bb('0x1c')]);}return _0xc57f9c[_0x29bb('0x5a')](_0x54a532);}})['then'](function(_0x432cde){if(_0x432cde){return _0x432cde?{'count':_0x4459ff,'rows':_0x432cde}:null;}})['then'](respondWithResult(_0x5eb056,null))[_0x29bb('0x47')](handleError(_0x5eb056,null));};exports['addAction']=function(_0xc9d34e,_0x1ceb51,_0x39cedd){if(_0xc9d34e['body']['id']){delete _0xc9d34e[_0x29bb('0x51')]['id'];}return db['Trigger'][_0x29bb('0x46')]({'where':{'id':_0xc9d34e['params']['id']}})[_0x29bb('0x23')](handleEntityNotFound(_0x1ceb51,null))['then'](function(_0x3f0727){if(_0x3f0727){_0xc9d34e[_0x29bb('0x51')][_0x29bb('0x5c')]=_0x3f0727['id'];return db[_0x29bb('0x5d')][_0x29bb('0x48')](_0xc9d34e[_0x29bb('0x51')]);}})['then'](respondWithResult(_0x1ceb51,null))[_0x29bb('0x47')](handleError(_0x1ceb51,null));};exports['getActions']=function(_0x37f844,_0x2edb91,_0x2a9375){var _0x1d313d={};var _0x1effe5={};var _0x3aec97;var _0x4fc69a;return db[_0x29bb('0x2b')][_0x29bb('0x5b')]({'where':{'id':_0x37f844['params']['id']}})[_0x29bb('0x23')](handleEntityNotFound(_0x2edb91,null))[_0x29bb('0x23')](function(_0x537028){if(_0x537028){_0x3aec97=_0x537028;_0x1effe5['model']=_[_0x29bb('0x32')](db[_0x29bb('0x5d')][_0x29bb('0x2c')]);_0x1effe5[_0x29bb('0x31')]=_['keys'](_0x37f844['query']);_0x1effe5[_0x29bb('0x3a')]=_[_0x29bb('0x45')](_0x1effe5[_0x29bb('0x33')],_0x1effe5[_0x29bb('0x31')]);_0x1d313d[_0x29bb('0x34')]=_['intersection'](_0x1effe5['model'],qs[_0x29bb('0x35')](_0x37f844[_0x29bb('0x31')][_0x29bb('0x35')]));_0x1d313d['attributes']=_0x1d313d[_0x29bb('0x34')][_0x29bb('0x36')]?_0x1d313d[_0x29bb('0x34')]:_0x1effe5['model'];_0x1d313d['order']=qs[_0x29bb('0x39')](_0x37f844[_0x29bb('0x31')]['sort']);_0x1d313d[_0x29bb('0x3c')]=qs[_0x29bb('0x3a')](_[_0x29bb('0x3b')](_0x37f844[_0x29bb('0x31')],_0x1effe5['filters']));if(_0x37f844[_0x29bb('0x31')][_0x29bb('0x56')]){_0x1d313d[_0x29bb('0x3c')]=_[_0x29bb('0x3e')](_0x1d313d[_0x29bb('0x3c')],{'$or':_[_0x29bb('0x30')](_0x1d313d['attributes'],function(_0xc81415){var _0x3cd1bb={};_0x3cd1bb[_0xc81415]={'$like':'%'+_0x37f844[_0x29bb('0x31')][_0x29bb('0x56')]+'%'};return _0x3cd1bb;})});}_0x1d313d=_[_0x29bb('0x3e')]({},_0x1d313d,_0x37f844[_0x29bb('0x57')]);return _0x3aec97[_0x29bb('0x5e')](_0x1d313d);}})[_0x29bb('0x23')](function(_0x44dd6d){if(_0x44dd6d){_0x4fc69a=_0x44dd6d[_0x29bb('0x36')];if(!_0x37f844['query']['hasOwnProperty'](_0x29bb('0x59'))){_0x1d313d[_0x29bb('0x19')]=qs[_0x29bb('0x19')](_0x37f844[_0x29bb('0x31')][_0x29bb('0x19')]);_0x1d313d[_0x29bb('0x1c')]=qs[_0x29bb('0x1c')](_0x37f844[_0x29bb('0x31')][_0x29bb('0x1c')]);}return _0x3aec97[_0x29bb('0x5e')](_0x1d313d);}})['then'](function(_0x3d61ee){if(_0x3d61ee){return _0x3d61ee?{'count':_0x4fc69a,'rows':_0x3d61ee}:null;}})[_0x29bb('0x23')](respondWithResult(_0x2edb91,null))[_0x29bb('0x47')](handleError(_0x2edb91,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0ffa0e9..265888b 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 _0x746f=['../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfc6af9,_0x388de6){var _0x3a13a4=function(_0x2eb546){while(--_0x2eb546){_0xfc6af9['push'](_0xfc6af9['shift']());}};_0x3a13a4(++_0x388de6);}(_0x746f,0x9c));var _0xf746=function(_0x35ae69,_0x5e2f74){_0x35ae69=_0x35ae69-0x0;var _0x265e2b=_0x746f[_0x35ae69];return _0x265e2b;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var logger=require(_0xf746('0x2'))(_0xf746('0x3'));var moment=require(_0xf746('0x4'));var BPromise=require(_0xf746('0x5'));var rp=require(_0xf746('0x6'));var fs=require('fs');var path=require(_0xf746('0x7'));var rimraf=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var attributes=require(_0xf746('0xa'));module[_0xf746('0xb')]=function(_0x19d855,_0x2f0f3c){return _0x19d855[_0xf746('0xc')](_0xf746('0xd'),attributes,{'tableName':_0xf746('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2557=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','Trigger','tools_triggers'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2557,0x11e));var _0x7255=function(_0x37ef1a,_0x2485cb){_0x37ef1a=_0x37ef1a-0x0;var _0xf2faea=_0x2557[_0x37ef1a];return _0xf2faea;};'use strict';var _=require(_0x7255('0x0'));var util=require('util');var logger=require(_0x7255('0x1'))(_0x7255('0x2'));var moment=require(_0x7255('0x3'));var BPromise=require(_0x7255('0x4'));var rp=require(_0x7255('0x5'));var fs=require('fs');var path=require(_0x7255('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x7255('0x7')]=function(_0x937dce,_0x46c30e){return _0x937dce[_0x7255('0x8')](_0x7255('0x9'),attributes,{'tableName':_0x7255('0xa'),'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 116019c..106d758 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 _0x6b1b=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','model','attributes','debug','ShowTrigger','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5363a3,_0x3c6310){var _0x4cd0c6=function(_0x3d7747){while(--_0x3d7747){_0x5363a3['push'](_0x5363a3['shift']());}};_0x4cd0c6(++_0x3c6310);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x6b1b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13334e,_0x1a4cd0,_0x5b440a){return new BPromise(function(_0x2734cc,_0x52aa76){return client['request'](_0x13334e,_0x5b440a)[_0xb6b1('0xc')](function(_0x58027c){logger[_0xb6b1('0xd')]('Trigger,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x1a4cd0,_0xb6b1('0xe'),JSON[_0xb6b1('0xf')](_0x58027c));if(_0x58027c['error']){if(_0x58027c[_0xb6b1('0x10')]['code']===0x1f4){logger['error'](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x52aa76(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x2734cc(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}else{logger[_0xb6b1('0xd')]('Trigger,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');_0x2734cc(_0x58027c['result']['message']);}})[_0xb6b1('0x13')](function(_0x12c595){logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x12c595);_0x52aa76(_0x12c595);});});}exports[_0xb6b1('0x14')]=function(_0x51fb33){var _0x47a204=this;return new Promise(function(_0x581e28,_0x1bdf63){return db[_0xb6b1('0x15')][_0xb6b1('0x16')]({'raw':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x51fb33['options']?_0x51fb33['options'][_0xb6b1('0x19')]||null:null,'attributes':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33['options']['attributes']||null:null,'limit':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33['options']['limit']||null:null,'include':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x1a')]?_[_0xb6b1('0x1b')](_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x1a')],function(_0x1eb1b2){return{'model':db[_0x1eb1b2[_0xb6b1('0x1c')]],'as':_0x1eb1b2['as'],'attributes':_0x1eb1b2[_0xb6b1('0x1d')],'include':_0x1eb1b2[_0xb6b1('0x1a')]?_['map'](_0x1eb1b2[_0xb6b1('0x1a')],function(_0x4f1e2e){return{'model':db[_0x4f1e2e[_0xb6b1('0x1c')]],'as':_0x4f1e2e['as'],'attributes':_0x4f1e2e['attributes'],'include':_0x4f1e2e[_0xb6b1('0x1a')]?_['map'](_0x4f1e2e[_0xb6b1('0x1a')],function(_0x387603){return{'model':db[_0x387603[_0xb6b1('0x1c')]],'as':_0x387603['as'],'attributes':_0x387603[_0xb6b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb6b1('0xc')](function(_0x188627){logger[_0xb6b1('0xd')](_0xb6b1('0x14'),_0x51fb33);logger[_0xb6b1('0x1e')]('GetTrigger',_0x51fb33,JSON[_0xb6b1('0xf')](_0x188627));_0x581e28(_0x188627);})['catch'](function(_0x427efb){logger[_0xb6b1('0x10')](_0xb6b1('0x14'),_0x427efb[_0xb6b1('0x12')],_0x51fb33);_0x1bdf63(_0x47a204[_0xb6b1('0x10')](0x1f4,_0x427efb[_0xb6b1('0x12')]));});});};exports[_0xb6b1('0x1f')]=function(_0x59094f){var _0x427797=this;return new Promise(function(_0x2ccd37,_0x1791a2){return db['Trigger'][_0xb6b1('0x20')]({'raw':_0x59094f[_0xb6b1('0x17')]?_0x59094f['options'][_0xb6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')][_0xb6b1('0x19')]||null:null,'attributes':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')]['attributes']||null:null,'include':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')]['include']?_[_0xb6b1('0x1b')](_0x59094f['options'][_0xb6b1('0x1a')],function(_0x242ec3){return{'model':db[_0x242ec3[_0xb6b1('0x1c')]],'as':_0x242ec3['as'],'attributes':_0x242ec3[_0xb6b1('0x1d')],'include':_0x242ec3[_0xb6b1('0x1a')]?_[_0xb6b1('0x1b')](_0x242ec3['include'],function(_0x203d8e){return{'model':db[_0x203d8e[_0xb6b1('0x1c')]],'as':_0x203d8e['as'],'attributes':_0x203d8e[_0xb6b1('0x1d')],'include':_0x203d8e[_0xb6b1('0x1a')]?_['map'](_0x203d8e['include'],function(_0x4b9125){return{'model':db[_0x4b9125[_0xb6b1('0x1c')]],'as':_0x4b9125['as'],'attributes':_0x4b9125[_0xb6b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb6b1('0xc')](function(_0xe9cc){logger[_0xb6b1('0xd')](_0xb6b1('0x1f'),_0x59094f);logger[_0xb6b1('0x1e')](_0xb6b1('0x1f'),_0x59094f,JSON[_0xb6b1('0xf')](_0xe9cc));_0x2ccd37(_0xe9cc);})[_0xb6b1('0x13')](function(_0x9abbe1){logger[_0xb6b1('0x10')]('ShowTrigger',_0x9abbe1[_0xb6b1('0x12')],_0x59094f);_0x1791a2(_0x427797[_0xb6b1('0x10')](0x1f4,_0x9abbe1[_0xb6b1('0x12')]));});});}; \ No newline at end of file +var _0x9386=['GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrigger','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x9386,0x1cd));var _0x6938=function(_0x42d221,_0x5d2385){_0x42d221=_0x42d221-0x0;var _0x3b0816=_0x9386[_0x42d221];return _0x3b0816;};'use strict';var _=require(_0x6938('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6938('0x1'))['db'];var utils=require(_0x6938('0x2'));var logger=require(_0x6938('0x3'))('rpc');var config=require(_0x6938('0x4'));var jayson=require(_0x6938('0x5'));var client=jayson[_0x6938('0x6')][_0x6938('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x221830,_0x3f2052,_0x30d2f9){return new BPromise(function(_0x40e68d,_0x5825a8){return client['request'](_0x221830,_0x30d2f9)[_0x6938('0x8')](function(_0x2726cf){logger[_0x6938('0x9')](_0x6938('0xa'),_0x3f2052,_0x6938('0xb'));logger[_0x6938('0xc')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3f2052,_0x6938('0xb'),JSON[_0x6938('0xd')](_0x2726cf));if(_0x2726cf[_0x6938('0xe')]){if(_0x2726cf[_0x6938('0xe')][_0x6938('0xf')]===0x1f4){logger[_0x6938('0xe')]('Trigger,\x20%s,\x20%s',_0x3f2052,_0x2726cf[_0x6938('0xe')][_0x6938('0x10')]);return _0x5825a8(_0x2726cf[_0x6938('0xe')][_0x6938('0x10')]);}logger[_0x6938('0xe')](_0x6938('0xa'),_0x3f2052,_0x2726cf[_0x6938('0xe')]['message']);return _0x40e68d(_0x2726cf[_0x6938('0xe')][_0x6938('0x10')]);}else{logger[_0x6938('0x9')](_0x6938('0xa'),_0x3f2052,_0x6938('0xb'));_0x40e68d(_0x2726cf[_0x6938('0x11')][_0x6938('0x10')]);}})[_0x6938('0x12')](function(_0x4b79af){logger['error'](_0x6938('0xa'),_0x3f2052,_0x4b79af);_0x5825a8(_0x4b79af);});});}exports[_0x6938('0x13')]=function(_0x2a1e4e){var _0x1338d9=this;return new Promise(function(_0x1e4d2b,_0x2ea2cf){return db[_0x6938('0x14')][_0x6938('0x15')]({'raw':_0x2a1e4e[_0x6938('0x16')]?_0x2a1e4e[_0x6938('0x16')][_0x6938('0x17')]===undefined?!![]:![]:!![],'where':_0x2a1e4e[_0x6938('0x16')]?_0x2a1e4e[_0x6938('0x16')][_0x6938('0x18')]||null:null,'attributes':_0x2a1e4e['options']?_0x2a1e4e['options'][_0x6938('0x19')]||null:null,'limit':_0x2a1e4e[_0x6938('0x16')]?_0x2a1e4e[_0x6938('0x16')][_0x6938('0x1a')]||null:null,'include':_0x2a1e4e[_0x6938('0x16')]?_0x2a1e4e[_0x6938('0x16')][_0x6938('0x1b')]?_[_0x6938('0x1c')](_0x2a1e4e[_0x6938('0x16')][_0x6938('0x1b')],function(_0x173744){return{'model':db[_0x173744['model']],'as':_0x173744['as'],'attributes':_0x173744[_0x6938('0x19')],'include':_0x173744[_0x6938('0x1b')]?_[_0x6938('0x1c')](_0x173744['include'],function(_0x3983e2){return{'model':db[_0x3983e2['model']],'as':_0x3983e2['as'],'attributes':_0x3983e2[_0x6938('0x19')],'include':_0x3983e2[_0x6938('0x1b')]?_[_0x6938('0x1c')](_0x3983e2[_0x6938('0x1b')],function(_0x45a776){return{'model':db[_0x45a776[_0x6938('0x1d')]],'as':_0x45a776['as'],'attributes':_0x45a776[_0x6938('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6938('0x8')](function(_0x2ef25d){logger['info'](_0x6938('0x13'),_0x2a1e4e);logger[_0x6938('0xc')](_0x6938('0x13'),_0x2a1e4e,JSON[_0x6938('0xd')](_0x2ef25d));_0x1e4d2b(_0x2ef25d);})[_0x6938('0x12')](function(_0x34439b){logger[_0x6938('0xe')](_0x6938('0x13'),_0x34439b[_0x6938('0x10')],_0x2a1e4e);_0x2ea2cf(_0x1338d9[_0x6938('0xe')](0x1f4,_0x34439b[_0x6938('0x10')]));});});};exports['ShowTrigger']=function(_0x35f579){var _0x12d882=this;return new Promise(function(_0xec6e38,_0x4c08d6){return db['Trigger'][_0x6938('0x1e')]({'raw':_0x35f579['options']?_0x35f579['options'][_0x6938('0x17')]===undefined?!![]:![]:!![],'where':_0x35f579[_0x6938('0x16')]?_0x35f579[_0x6938('0x16')]['where']||null:null,'attributes':_0x35f579[_0x6938('0x16')]?_0x35f579['options'][_0x6938('0x19')]||null:null,'include':_0x35f579['options']?_0x35f579[_0x6938('0x16')]['include']?_['map'](_0x35f579[_0x6938('0x16')][_0x6938('0x1b')],function(_0x239804){return{'model':db[_0x239804[_0x6938('0x1d')]],'as':_0x239804['as'],'attributes':_0x239804[_0x6938('0x19')],'include':_0x239804[_0x6938('0x1b')]?_[_0x6938('0x1c')](_0x239804[_0x6938('0x1b')],function(_0x43f7a4){return{'model':db[_0x43f7a4['model']],'as':_0x43f7a4['as'],'attributes':_0x43f7a4[_0x6938('0x19')],'include':_0x43f7a4[_0x6938('0x1b')]?_[_0x6938('0x1c')](_0x43f7a4['include'],function(_0x4120c2){return{'model':db[_0x4120c2['model']],'as':_0x4120c2['as'],'attributes':_0x4120c2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bd82c){logger[_0x6938('0x9')](_0x6938('0x1f'),_0x35f579);logger['debug']('ShowTrigger',_0x35f579,JSON['stringify'](_0x1bd82c));_0xec6e38(_0x1bd82c);})[_0x6938('0x12')](function(_0x3c92c7){logger[_0x6938('0xe')]('ShowTrigger',_0x3c92c7[_0x6938('0x10')],_0x35f579);_0x4c08d6(_0x12d882[_0x6938('0xe')](0x1f4,_0x3c92c7[_0x6938('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8597247..55b4b20 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 _0x79d5=['../../components/auth/service','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x3afc57,_0x56b5b9){var _0x3c6ecf=function(_0x198d6d){while(--_0x198d6d){_0x3afc57['push'](_0x3afc57['shift']());}};_0x3c6ecf(++_0x56b5b9);}(_0x79d5,0x13b));var _0x579d=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x79d5[_0x40b3f2];return _0x4ce90c;};'use strict';var multer=require('multer');var util=require(_0x579d('0x0'));var path=require(_0x579d('0x1'));var timeout=require(_0x579d('0x2'));var express=require('express');var router=express[_0x579d('0x3')]();var fs_extra=require(_0x579d('0x4'));var auth=require(_0x579d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x579d('0x6'));router[_0x579d('0x7')]('/',auth['isAuthenticated'](),controller[_0x579d('0x8')]);router[_0x579d('0x7')](_0x579d('0x9'),auth[_0x579d('0xa')](),controller[_0x579d('0xb')]);router[_0x579d('0xc')](_0x579d('0xd'),auth[_0x579d('0xa')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0x579d('0xe')]);router[_0x579d('0xf')]('/:id',auth[_0x579d('0xa')](),controller[_0x579d('0x10')]);router[_0x579d('0x11')](_0x579d('0x9'),auth[_0x579d('0xa')](),controller[_0x579d('0x12')]);module[_0x579d('0x13')]=router; \ No newline at end of file +var _0xfebc=['express','fs-extra','../../components/auth/service','./trunk.controller','get','isAuthenticated','/:id','post','/:id/clone','clone','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5e7ee9,_0x4dbc4b){var _0xadb900=function(_0x5eecb3){while(--_0x5eecb3){_0x5e7ee9['push'](_0x5e7ee9['shift']());}};_0xadb900(++_0x4dbc4b);}(_0xfebc,0x189));var _0xcfeb=function(_0x3add10,_0x457d16){_0x3add10=_0x3add10-0x0;var _0x2da348=_0xfebc[_0x3add10];return _0x2da348;};'use strict';var multer=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var path=require('path');var timeout=require(_0xcfeb('0x2'));var express=require(_0xcfeb('0x3'));var router=express['Router']();var fs_extra=require(_0xcfeb('0x4'));var auth=require(_0xcfeb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcfeb('0x6'));router[_0xcfeb('0x7')]('/',auth[_0xcfeb('0x8')](),controller['index']);router['get'](_0xcfeb('0x9'),auth[_0xcfeb('0x8')](),controller['show']);router[_0xcfeb('0xa')](_0xcfeb('0xb'),auth[_0xcfeb('0x8')](),controller[_0xcfeb('0xc')]);router[_0xcfeb('0xa')]('/',auth[_0xcfeb('0x8')](),controller[_0xcfeb('0xd')]);router[_0xcfeb('0xe')]('/:id',auth[_0xcfeb('0x8')](),controller[_0xcfeb('0xf')]);router[_0xcfeb('0x10')](_0xcfeb('0x9'),auth[_0xcfeb('0x8')](),controller[_0xcfeb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f6fb2e4..d77627e 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 _0x7e8f=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','refuse','originate','uac','uas','fingerprint','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x505088,_0x23a321){var _0x3eb2c9=function(_0x2fcf8d){while(--_0x2fcf8d){_0x505088['push'](_0x505088['shift']());}};_0x3eb2c9(++_0x23a321);}(_0x7e8f,0x13f));var _0xf7e8=function(_0x5a6748,_0x4bcebf){_0x5a6748=_0x5a6748-0x0;var _0x2533a9=_0x7e8f[_0x5a6748];return _0x2533a9;};'use strict';var Sequelize=require(_0xf7e8('0x0'));module[_0xf7e8('0x1')]={'name':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':![],'unique':_0xf7e8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf7e8('0x4')]('friend','user',_0xf7e8('0x5')),'allowNull':![],'defaultValue':_0xf7e8('0x6')},'context':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':![],'defaultValue':_0xf7e8('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xf7e8('0x8'),'ALLOWED_PASSED_SCREEN',_0xf7e8('0x9'),_0xf7e8('0xa'),'PROHIB_NOT_SCREENED',_0xf7e8('0xb'),'PROHIB_FAILED_SCREEN',_0xf7e8('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xf7e8('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xf7e8('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':'udp','set':function(_0x29fbfc){this[_0xf7e8('0xd')](_0xf7e8('0xe'),_0x29fbfc?_0x29fbfc['join'](','):null);},'get':function(){return this[_0xf7e8('0xf')](_0xf7e8('0xe'))?this[_0xf7e8('0xf')](_0xf7e8('0xe'))[_0xf7e8('0x10')](','):null;},'comment':_0xf7e8('0x11')},'dtmfmode':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x12'),_0xf7e8('0x13'),_0xf7e8('0x14'),'inband',_0xf7e8('0x15')),'defaultValue':_0xf7e8('0x12')},'directmedia':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no',_0xf7e8('0x17'),'update',_0xf7e8('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf7e8('0x2')]},'directmediadeny':{'type':Sequelize[_0xf7e8('0x2')]},'nat':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':_0xf7e8('0x19'),'set':function(_0x250ffa){this['setDataValue'](_0xf7e8('0x1a'),_0x250ffa?_0x250ffa[_0xf7e8('0x1b')](','):null);},'get':function(){return this[_0xf7e8('0xf')](_0xf7e8('0x1a'))?this[_0xf7e8('0xf')](_0xf7e8('0x1a'))[_0xf7e8('0x10')](','):null;},'comment':_0xf7e8('0x1c')},'callgroup':{'type':Sequelize[_0xf7e8('0x2')]},'namedcallgroup':{'type':Sequelize[_0xf7e8('0x2')]},'pickupgroup':{'type':Sequelize[_0xf7e8('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xf7e8('0x2')]},'language':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xf7e8('0x1d')},'allow':{'type':Sequelize[_0xf7e8('0x2')],'allowNull':![],'defaultValue':_0xf7e8('0x1e'),'set':function(_0x508aea){this[_0xf7e8('0xd')](_0xf7e8('0x1f'),_0x508aea?_0x508aea['join'](';'):_0xf7e8('0x1e'));},'get':function(){return this['getDataValue']('allow')?this[_0xf7e8('0xf')](_0xf7e8('0x1f'))['split'](';'):null;},'comment':_0xf7e8('0x20')},'autoframing':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'insecure':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':'port,invite','set':function(_0x1b81ef){this[_0xf7e8('0xd')](_0xf7e8('0x21'),_0x1b81ef?_0x1b81ef['join'](','):null);},'get':function(){return this[_0xf7e8('0xf')]('insecure')?this[_0xf7e8('0xf')](_0xf7e8('0x21'))[_0xf7e8('0x10')](','):null;},'comment':_0xf7e8('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf7e8('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xf7e8('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'accountcode':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'setvar':{'type':Sequelize[_0xf7e8('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xf7e8('0x2')]},'callcounter':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xf7e8('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xf7e8('0x2')]},'template':{'type':Sequelize[_0xf7e8('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no',_0xf7e8('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'mailbox':{'type':Sequelize[_0xf7e8('0x2')]},'session_timers':{'type':Sequelize[_0xf7e8('0x4')]('accept',_0xf7e8('0x26'),_0xf7e8('0x27'))},'session_expires':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x28'),_0xf7e8('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf7e8('0x2')]},'regexten':{'type':Sequelize[_0xf7e8('0x2')]},'fromdomain':{'type':Sequelize[_0xf7e8('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf7e8('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf7e8('0x2')]},'rtptimeout':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf7e8('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf7e8('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf7e8('0x2')]},'contactacl':{'type':Sequelize[_0xf7e8('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf7e8('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'force_avp':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'icesupport':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xf7e8('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no',_0xf7e8('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xf7e8('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf7e8('0x2')]},'dtlscipher':{'type':Sequelize[_0xf7e8('0x2')]},'dtlscafile':{'type':Sequelize[_0xf7e8('0x2')]},'dtlscapath':{'type':Sequelize[_0xf7e8('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf7e8('0x2b'),_0xf7e8('0x2c'),_0xf7e8('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf7e8('0x2')]},'usereqphone':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf7e8('0x2')]},'recordofffeature':{'type':Sequelize[_0xf7e8('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xf7e8('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xf7e8('0x4')](_0xf7e8('0x16'),'no')},'vmexten':{'type':Sequelize[_0xf7e8('0x2')]},'mohinterpret':{'type':Sequelize[_0xf7e8('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xf7e8('0x2')]},'description':{'type':Sequelize[_0xf7e8('0x2')]},'host':{'type':Sequelize[_0xf7e8('0x2')],'defaultValue':_0xf7e8('0x2e')},'canreinvite':{'type':Sequelize[_0xf7e8('0x4')]('yes','no',_0xf7e8('0x17'),_0xf7e8('0x2f'),_0xf7e8('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf7e8('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf7e8('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x5871=['user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','BOOLEAN','exports','STRING','ENUM','friend'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x5871,0x128));var _0x1587=function(_0x3ec784,_0xffce2e){_0x3ec784=_0x3ec784-0x0;var _0x12001a=_0x5871[_0x3ec784];return _0x12001a;};'use strict';var Sequelize=require('sequelize');module[_0x1587('0x0')]={'name':{'type':Sequelize[_0x1587('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x3'),_0x1587('0x4'),_0x1587('0x5')),'allowNull':![],'defaultValue':_0x1587('0x3')},'context':{'type':Sequelize[_0x1587('0x1')],'allowNull':![],'defaultValue':_0x1587('0x6')},'callingpres':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x7'),_0x1587('0x8'),_0x1587('0x9'),_0x1587('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x1587('0xb'),_0x1587('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x1587('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x1587('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x1587('0xd'),'set':function(_0x364bd9){this[_0x1587('0xe')](_0x1587('0xf'),_0x364bd9?_0x364bd9[_0x1587('0x10')](','):null);},'get':function(){return this[_0x1587('0x11')](_0x1587('0xf'))?this['getDataValue'](_0x1587('0xf'))[_0x1587('0x12')](','):null;},'comment':_0x1587('0x13')},'dtmfmode':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x14'),'info','shortinfo',_0x1587('0x15'),_0x1587('0x16')),'defaultValue':_0x1587('0x14')},'directmedia':{'type':Sequelize[_0x1587('0x2')]('yes','no',_0x1587('0x17'),_0x1587('0x18'),_0x1587('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1587('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x1587('0x1')],'defaultValue':_0x1587('0x1b'),'set':function(_0x3c9005){this[_0x1587('0xe')](_0x1587('0x1c'),_0x3c9005?_0x3c9005[_0x1587('0x10')](','):null);},'get':function(){return this[_0x1587('0x11')](_0x1587('0x1c'))?this[_0x1587('0x11')]('nat')['split'](','):null;},'comment':_0x1587('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1587('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1587('0x1')]},'language':{'type':Sequelize[_0x1587('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1587('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1587('0x1')],'defaultValue':_0x1587('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x17662c){this[_0x1587('0xe')]('allow',_0x17662c?_0x17662c['join'](';'):_0x1587('0x1f'));},'get':function(){return this[_0x1587('0x11')](_0x1587('0x20'))?this['getDataValue'](_0x1587('0x20'))[_0x1587('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1587('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x1587('0x21'),'set':function(_0x455262){this[_0x1587('0xe')]('insecure',_0x455262?_0x455262[_0x1587('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x1587('0x22'))?this[_0x1587('0x11')](_0x1587('0x22'))[_0x1587('0x12')](','):null;},'comment':_0x1587('0x23')},'trustrpid':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no','never')},'promiscredir':{'type':Sequelize[_0x1587('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x1587('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x1587('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1587('0x1')]},'callcounter':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no'),'defaultValue':_0x1587('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x1587('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no',_0x1587('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1587('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x1587('0x1')]},'session_timers':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x26'),_0x1587('0x27'),_0x1587('0x28'))},'session_expires':{'type':Sequelize[_0x1587('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x1587('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x29'),_0x1587('0x2a')),'defaultValue':_0x1587('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no'),'defaultValue':_0x1587('0x1a')},'keepalive':{'type':Sequelize[_0x1587('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x1587('0x1')]},'defaultuser':{'type':Sequelize[_0x1587('0x1')]},'rtptimeout':{'type':Sequelize[_0x1587('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x1587('0x2')]('yes','no',_0x1587('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1587('0x1')]},'callbackextension':{'type':Sequelize[_0x1587('0x1')]},'timert1':{'type':Sequelize[_0x1587('0x24')](0xb)},'timerb':{'type':Sequelize[_0x1587('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1587('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x1587('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x1587('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x1587('0x1a'),'no',_0x1587('0x2c'),_0x1587('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x1587('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x1587('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1587('0x1')]},'dtlscapath':{'type':Sequelize[_0x1587('0x1')]},'dtlssetup':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x2e'),_0x1587('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1587('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1587('0x1')]},'recordofffeature':{'type':Sequelize[_0x1587('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1587('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1587('0x1')]},'description':{'type':Sequelize[_0x1587('0x1')]},'host':{'type':Sequelize[_0x1587('0x1')],'defaultValue':_0x1587('0x30')},'canreinvite':{'type':Sequelize[_0x1587('0x2')](_0x1587('0x1a'),'no',_0x1587('0x17'),_0x1587('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x1587('0x1')]},'active':{'type':Sequelize[_0x1587('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 38272d2..49d5310 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5047e3,_0x17719f){var _0x4aae7a=function(_0x16dd91){while(--_0x16dd91){_0x5047e3['push'](_0x5047e3['shift']());}};_0x4aae7a(++_0x17719f);}(_0x55ca,0x126));var _0xa55c=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x55ca[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4b4145,_0x359c02){var _0x46433a=function(_0x2980f6){while(--_0x2980f6){_0x4b4145['push'](_0x4b4145['shift']());}};_0x46433a(++_0x359c02);}(_0x24ca,0x1bc));var _0xa24c=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x24ca[_0x274dd7];return _0x148829;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index eb2ed31..fc4a715 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 _0xadb5=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./trunk.attributes','exports'];(function(_0x3d4af2,_0x415445){var _0x347c55=function(_0x1584ae){while(--_0x1584ae){_0x3d4af2['push'](_0x3d4af2['shift']());}};_0x347c55(++_0x415445);}(_0xadb5,0x1f1));var _0x5adb=function(_0x3d1586,_0x252acf){_0x3d1586=_0x3d1586-0x0;var _0x30de63=_0xadb5[_0x3d1586];return _0x30de63;};'use strict';var _=require(_0x5adb('0x0'));var util=require(_0x5adb('0x1'));var logger=require(_0x5adb('0x2'))(_0x5adb('0x3'));var moment=require(_0x5adb('0x4'));var BPromise=require('bluebird');var rp=require(_0x5adb('0x5'));var fs=require('fs');var path=require(_0x5adb('0x6'));var rimraf=require('rimraf');var config=require(_0x5adb('0x7'));var attributes=require(_0x5adb('0x8'));module[_0x5adb('0x9')]=function(_0x118e54,_0x4c31bd){return _0x118e54[_0x5adb('0xa')](_0x5adb('0xb'),attributes,{'tableName':_0x5adb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7130=['tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','Trunk'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7130,0x1cf));var _0x0713=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x7130[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x0713('0x0'));var util=require(_0x0713('0x1'));var logger=require(_0x0713('0x2'))(_0x0713('0x3'));var moment=require(_0x0713('0x4'));var BPromise=require(_0x0713('0x5'));var rp=require(_0x0713('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0713('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x32b667,_0x5bbecb){return _0x32b667[_0x0713('0x8')](_0x0713('0x9'),attributes,{'tableName':_0x0713('0xa'),'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 71264d1..e5e28bd 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 _0x7f94=['code','message','result','GetTrunk','Trunk','options','raw','where','attributes','include','model','catch','find','map','ShowTrunk','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f94,0xd5));var _0x47f9=function(_0x54ac9a,_0x1f66c1){_0x54ac9a=_0x54ac9a-0x0;var _0x3197ca=_0x7f94[_0x54ac9a];return _0x3197ca;};'use strict';var _=require(_0x47f9('0x0'));var util=require(_0x47f9('0x1'));var moment=require('moment');var BPromise=require(_0x47f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47f9('0x3'));var db=require(_0x47f9('0x4'))['db'];var utils=require(_0x47f9('0x5'));var logger=require(_0x47f9('0x6'))('rpc');var config=require(_0x47f9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x47f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbb9eb6,_0x20a49c,_0x3c84bd){return new BPromise(function(_0x26f951,_0x697e9d){return client[_0x47f9('0x9')](_0xbb9eb6,_0x3c84bd)[_0x47f9('0xa')](function(_0x553bbb){logger[_0x47f9('0xb')](_0x47f9('0xc'),_0x20a49c,_0x47f9('0xd'));logger[_0x47f9('0xe')](_0x47f9('0xf'),_0x20a49c,'request\x20sent',JSON[_0x47f9('0x10')](_0x553bbb));if(_0x553bbb[_0x47f9('0x11')]){if(_0x553bbb[_0x47f9('0x11')][_0x47f9('0x12')]===0x1f4){logger[_0x47f9('0x11')](_0x47f9('0xc'),_0x20a49c,_0x553bbb[_0x47f9('0x11')][_0x47f9('0x13')]);return _0x697e9d(_0x553bbb[_0x47f9('0x11')][_0x47f9('0x13')]);}logger[_0x47f9('0x11')]('Trunk,\x20%s,\x20%s',_0x20a49c,_0x553bbb['error'][_0x47f9('0x13')]);return _0x26f951(_0x553bbb['error']['message']);}else{logger[_0x47f9('0xb')]('Trunk,\x20%s,\x20%s',_0x20a49c,'request\x20sent');_0x26f951(_0x553bbb[_0x47f9('0x14')][_0x47f9('0x13')]);}})['catch'](function(_0x30caa5){logger[_0x47f9('0x11')](_0x47f9('0xc'),_0x20a49c,_0x30caa5);_0x697e9d(_0x30caa5);});});}exports[_0x47f9('0x15')]=function(_0x27c839){var _0x24a770=this;return new Promise(function(_0x4a59cd,_0x182191){return db[_0x47f9('0x16')]['findAll']({'raw':_0x27c839[_0x47f9('0x17')]?_0x27c839[_0x47f9('0x17')][_0x47f9('0x18')]===undefined?!![]:![]:!![],'where':_0x27c839[_0x47f9('0x17')]?_0x27c839[_0x47f9('0x17')][_0x47f9('0x19')]||null:null,'attributes':_0x27c839[_0x47f9('0x17')]?_0x27c839['options'][_0x47f9('0x1a')]||null:null,'limit':_0x27c839['options']?_0x27c839[_0x47f9('0x17')]['limit']||null:null,'include':_0x27c839[_0x47f9('0x17')]?_0x27c839[_0x47f9('0x17')][_0x47f9('0x1b')]?_['map'](_0x27c839[_0x47f9('0x17')][_0x47f9('0x1b')],function(_0x552be4){return{'model':db[_0x552be4['model']],'as':_0x552be4['as'],'attributes':_0x552be4[_0x47f9('0x1a')],'include':_0x552be4['include']?_['map'](_0x552be4[_0x47f9('0x1b')],function(_0x3ab4ab){return{'model':db[_0x3ab4ab['model']],'as':_0x3ab4ab['as'],'attributes':_0x3ab4ab[_0x47f9('0x1a')],'include':_0x3ab4ab['include']?_['map'](_0x3ab4ab[_0x47f9('0x1b')],function(_0xe0ee68){return{'model':db[_0xe0ee68[_0x47f9('0x1c')]],'as':_0xe0ee68['as'],'attributes':_0xe0ee68[_0x47f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47f9('0xa')](function(_0x2d86a2){logger[_0x47f9('0xb')](_0x47f9('0x15'),_0x27c839);logger[_0x47f9('0xe')](_0x47f9('0x15'),_0x27c839,JSON[_0x47f9('0x10')](_0x2d86a2));_0x4a59cd(_0x2d86a2);})[_0x47f9('0x1d')](function(_0x23995d){logger[_0x47f9('0x11')](_0x47f9('0x15'),_0x23995d[_0x47f9('0x13')],_0x27c839);_0x182191(_0x24a770[_0x47f9('0x11')](0x1f4,_0x23995d[_0x47f9('0x13')]));});});};exports['ShowTrunk']=function(_0x3f5689){var _0x3185b3=this;return new Promise(function(_0x41a1c7,_0x3107b3){return db[_0x47f9('0x16')][_0x47f9('0x1e')]({'raw':_0x3f5689['options']?_0x3f5689[_0x47f9('0x17')][_0x47f9('0x18')]===undefined?!![]:![]:!![],'where':_0x3f5689['options']?_0x3f5689[_0x47f9('0x17')][_0x47f9('0x19')]||null:null,'attributes':_0x3f5689[_0x47f9('0x17')]?_0x3f5689[_0x47f9('0x17')][_0x47f9('0x1a')]||null:null,'include':_0x3f5689['options']?_0x3f5689[_0x47f9('0x17')]['include']?_[_0x47f9('0x1f')](_0x3f5689[_0x47f9('0x17')]['include'],function(_0x367199){return{'model':db[_0x367199[_0x47f9('0x1c')]],'as':_0x367199['as'],'attributes':_0x367199[_0x47f9('0x1a')],'include':_0x367199[_0x47f9('0x1b')]?_[_0x47f9('0x1f')](_0x367199[_0x47f9('0x1b')],function(_0x559f2e){return{'model':db[_0x559f2e[_0x47f9('0x1c')]],'as':_0x559f2e['as'],'attributes':_0x559f2e[_0x47f9('0x1a')],'include':_0x559f2e['include']?_[_0x47f9('0x1f')](_0x559f2e[_0x47f9('0x1b')],function(_0xe485f0){return{'model':db[_0xe485f0[_0x47f9('0x1c')]],'as':_0xe485f0['as'],'attributes':_0xe485f0[_0x47f9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dae1d){logger[_0x47f9('0xb')](_0x47f9('0x20'),_0x3f5689);logger[_0x47f9('0xe')]('ShowTrunk',_0x3f5689,JSON['stringify'](_0x3dae1d));_0x41a1c7(_0x3dae1d);})[_0x47f9('0x1d')](function(_0x2f125b){logger[_0x47f9('0x11')](_0x47f9('0x20'),_0x2f125b[_0x47f9('0x13')],_0x3f5689);_0x3107b3(_0x3185b3['error'](0x1f4,_0x2f125b[_0x47f9('0x13')]));});});}; \ No newline at end of file +var _0x9780=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','then','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent'];(function(_0x33b6f6,_0x3e377f){var _0x230c01=function(_0x1a8cf5){while(--_0x1a8cf5){_0x33b6f6['push'](_0x33b6f6['shift']());}};_0x230c01(++_0x3e377f);}(_0x9780,0x196));var _0x0978=function(_0x35ef7a,_0x2b3df3){_0x35ef7a=_0x35ef7a-0x0;var _0x3e1c56=_0x9780[_0x35ef7a];return _0x3e1c56;};'use strict';var _=require(_0x0978('0x0'));var util=require('util');var moment=require(_0x0978('0x1'));var BPromise=require(_0x0978('0x2'));var rs=require(_0x0978('0x3'));var fs=require('fs');var Redis=require(_0x0978('0x4'));var db=require(_0x0978('0x5'))['db'];var utils=require(_0x0978('0x6'));var logger=require(_0x0978('0x7'))(_0x0978('0x8'));var config=require('../../config/environment');var jayson=require(_0x0978('0x9'));var client=jayson[_0x0978('0xa')][_0x0978('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13581c,_0x1936c3,_0x5b7c8a){return new BPromise(function(_0x1b9454,_0x1d3c41){return client['request'](_0x13581c,_0x5b7c8a)['then'](function(_0x483e86){logger[_0x0978('0xc')]('Trunk,\x20%s,\x20%s',_0x1936c3,_0x0978('0xd'));logger[_0x0978('0xe')](_0x0978('0xf'),_0x1936c3,'request\x20sent',JSON[_0x0978('0x10')](_0x483e86));if(_0x483e86['error']){if(_0x483e86['error'][_0x0978('0x11')]===0x1f4){logger[_0x0978('0x12')](_0x0978('0x13'),_0x1936c3,_0x483e86[_0x0978('0x12')][_0x0978('0x14')]);return _0x1d3c41(_0x483e86[_0x0978('0x12')]['message']);}logger[_0x0978('0x12')](_0x0978('0x13'),_0x1936c3,_0x483e86[_0x0978('0x12')]['message']);return _0x1b9454(_0x483e86[_0x0978('0x12')][_0x0978('0x14')]);}else{logger[_0x0978('0xc')]('Trunk,\x20%s,\x20%s',_0x1936c3,_0x0978('0xd'));_0x1b9454(_0x483e86[_0x0978('0x15')]['message']);}})[_0x0978('0x16')](function(_0x3f396b){logger[_0x0978('0x12')](_0x0978('0x13'),_0x1936c3,_0x3f396b);_0x1d3c41(_0x3f396b);});});}exports[_0x0978('0x17')]=function(_0x15f90d){var _0x2b8b8b=this;return new Promise(function(_0x448839,_0x25bc83){return db[_0x0978('0x18')][_0x0978('0x19')]({'raw':_0x15f90d[_0x0978('0x1a')]?_0x15f90d['options']['raw']===undefined?!![]:![]:!![],'where':_0x15f90d[_0x0978('0x1a')]?_0x15f90d[_0x0978('0x1a')][_0x0978('0x1b')]||null:null,'attributes':_0x15f90d['options']?_0x15f90d[_0x0978('0x1a')][_0x0978('0x1c')]||null:null,'limit':_0x15f90d['options']?_0x15f90d['options'][_0x0978('0x1d')]||null:null,'include':_0x15f90d[_0x0978('0x1a')]?_0x15f90d[_0x0978('0x1a')][_0x0978('0x1e')]?_[_0x0978('0x1f')](_0x15f90d[_0x0978('0x1a')][_0x0978('0x1e')],function(_0x579a5d){return{'model':db[_0x579a5d[_0x0978('0x20')]],'as':_0x579a5d['as'],'attributes':_0x579a5d['attributes'],'include':_0x579a5d[_0x0978('0x1e')]?_[_0x0978('0x1f')](_0x579a5d[_0x0978('0x1e')],function(_0x3fd8df){return{'model':db[_0x3fd8df[_0x0978('0x20')]],'as':_0x3fd8df['as'],'attributes':_0x3fd8df['attributes'],'include':_0x3fd8df[_0x0978('0x1e')]?_[_0x0978('0x1f')](_0x3fd8df[_0x0978('0x1e')],function(_0x1c563c){return{'model':db[_0x1c563c['model']],'as':_0x1c563c['as'],'attributes':_0x1c563c[_0x0978('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0978('0x21')](function(_0x25d8be){logger['info'](_0x0978('0x17'),_0x15f90d);logger[_0x0978('0xe')]('GetTrunk',_0x15f90d,JSON[_0x0978('0x10')](_0x25d8be));_0x448839(_0x25d8be);})[_0x0978('0x16')](function(_0x1de3ce){logger[_0x0978('0x12')](_0x0978('0x17'),_0x1de3ce['message'],_0x15f90d);_0x25bc83(_0x2b8b8b[_0x0978('0x12')](0x1f4,_0x1de3ce['message']));});});};exports['ShowTrunk']=function(_0x14b97f){var _0x2e649=this;return new Promise(function(_0x274933,_0x555c12){return db[_0x0978('0x18')]['find']({'raw':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')][_0x0978('0x1b')]||null:null,'attributes':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')][_0x0978('0x1c')]||null:null,'include':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')][_0x0978('0x1e')]?_['map'](_0x14b97f[_0x0978('0x1a')]['include'],function(_0x1d2112){return{'model':db[_0x1d2112[_0x0978('0x20')]],'as':_0x1d2112['as'],'attributes':_0x1d2112[_0x0978('0x1c')],'include':_0x1d2112[_0x0978('0x1e')]?_['map'](_0x1d2112['include'],function(_0x343cc7){return{'model':db[_0x343cc7['model']],'as':_0x343cc7['as'],'attributes':_0x343cc7[_0x0978('0x1c')],'include':_0x343cc7[_0x0978('0x1e')]?_['map'](_0x343cc7[_0x0978('0x1e')],function(_0x5ed3fd){return{'model':db[_0x5ed3fd[_0x0978('0x20')]],'as':_0x5ed3fd['as'],'attributes':_0x5ed3fd[_0x0978('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0978('0x21')](function(_0x41e600){logger[_0x0978('0xc')](_0x0978('0x22'),_0x14b97f);logger[_0x0978('0xe')]('ShowTrunk',_0x14b97f,JSON['stringify'](_0x41e600));_0x274933(_0x41e600);})[_0x0978('0x16')](function(_0x23f5fb){logger[_0x0978('0x12')](_0x0978('0x22'),_0x23f5fb['message'],_0x14b97f);_0x555c12(_0x2e649['error'](0x1f4,_0x23f5fb[_0x0978('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index fd65bf4..952b973 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 _0xcaf0=['/:id','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x34fa67,_0x1823ab){var _0x4bf61b=function(_0x152160){while(--_0x152160){_0x34fa67['push'](_0x34fa67['shift']());}};_0x4bf61b(++_0x1823ab);}(_0xcaf0,0xcf));var _0x0caf=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xcaf0[_0x232ec0];return _0x356705;};'use strict';var express=require(_0x0caf('0x0'));var router=express['Router']();var auth=require(_0x0caf('0x1'));var controller=require(_0x0caf('0x2'));router['put'](_0x0caf('0x3'),auth[_0x0caf('0x4')](),controller[_0x0caf('0x5')]);module[_0x0caf('0x6')]=router; \ No newline at end of file +var _0x3901=['/:id','isAuthenticated','update','exports','express','Router','./user-setting.controller','put'];(function(_0x316b5e,_0xa819a2){var _0x106a68=function(_0x27f991){while(--_0x27f991){_0x316b5e['push'](_0x316b5e['shift']());}};_0x106a68(++_0xa819a2);}(_0x3901,0xc4));var _0x1390=function(_0x2fc1e0,_0x3a77a9){_0x2fc1e0=_0x2fc1e0-0x0;var _0x2f29e7=_0x3901[_0x2fc1e0];return _0x2f29e7;};'use strict';var express=require(_0x1390('0x0'));var router=express[_0x1390('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1390('0x2'));router[_0x1390('0x3')](_0x1390('0x4'),auth[_0x1390('0x5')](),controller[_0x1390('0x6')]);module[_0x1390('0x7')]=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 a3649ea..1f27b2d 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 _0x6f7b=['exports','ENUM','error','BOOLEAN','TEXT','DATE','INTEGER','sequelize','warning','info','debug'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x6f7b,0x11a));var _0xb6f7=function(_0x36a99e,_0xe8e30e){_0x36a99e=_0x36a99e-0x0;var _0x34b61f=_0x6f7b[_0x36a99e];return _0x34b61f;};'use strict';var Sequelize=require(_0xb6f7('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb6f7('0x1'),_0xb6f7('0x2'),_0xb6f7('0x3')];module[_0xb6f7('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb6f7('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb6f7('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb6f7('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb6f7('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb6f7('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb6f7('0xa')],'unique':'UserId'}}; \ No newline at end of file +var _0x0d0f=['ENUM','BOOLEAN','TEXT','INTEGER','UserId','sequelize','error','warning','info','exports'];(function(_0x568ae0,_0x454193){var _0x5b7f0f=function(_0x20a4a2){while(--_0x20a4a2){_0x568ae0['push'](_0x568ae0['shift']());}};_0x5b7f0f(++_0x454193);}(_0x0d0f,0x1db));var _0xf0d0=function(_0x5e80fc,_0x1fec90){_0x5e80fc=_0x5e80fc-0x0;var _0x288ab8=_0x0d0f[_0x5e80fc];return _0x288ab8;};'use strict';var Sequelize=require(_0xf0d0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf0d0('0x1'),_0xf0d0('0x2'),_0xf0d0('0x3'),'debug'];module[_0xf0d0('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf0d0('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf0d0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf0d0('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf0d0('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf0d0('0x8')],'unique':_0xf0d0('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 7592bcc..3432df4 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 _0x2060=['status','send','user','role','admin','params','UserSetting','find','body','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','localhost','json','update','then','sendStatus','stack','name'];(function(_0x114463,_0xbe6dd9){var _0x138c9a=function(_0x487413){while(--_0x487413){_0x114463['push'](_0x114463['shift']());}};_0x138c9a(++_0xbe6dd9);}(_0x2060,0x1be));var _0x0206=function(_0x131634,_0x4959f1){_0x131634=_0x131634-0x0;var _0x4ac914=_0x2060[_0x131634];return _0x4ac914;};'use strict';var _=require(_0x0206('0x0'));var Redis=require('ioredis');var logger=require(_0x0206('0x1'))(_0x0206('0x2'));var config=require(_0x0206('0x3'));var db=require(_0x0206('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0206('0x5')]));require(_0x0206('0x6'))['register'](socket);config[_0x0206('0x5')]=_['defaults'](config[_0x0206('0x5')],{'host':_0x0206('0x7'),'port':0x18eb});function respondWithResult(_0x529d59,_0x2eda0e){_0x2eda0e=_0x2eda0e||0xc8;return function(_0x5c8dbb){if(_0x5c8dbb){return _0x529d59['status'](_0x2eda0e)[_0x0206('0x8')](_0x5c8dbb);}};}function saveUpdates(_0x3b9cd7){return function(_0x3bc420){if(_0x3bc420){return _0x3bc420[_0x0206('0x9')](_0x3b9cd7)[_0x0206('0xa')](function(_0x3e20d1){return _0x3e20d1;});}return null;};}function handleEntityNotFound(_0x2cdca9){return function(_0x138f07){if(!_0x138f07){_0x2cdca9[_0x0206('0xb')](0x194);}return _0x138f07;};}function handleError(_0x4223da,_0x3cc292){_0x3cc292=_0x3cc292||0x1f4;return function(_0x521d23){logger['error'](_0x521d23[_0x0206('0xc')]);if(_0x521d23[_0x0206('0xd')]){delete _0x521d23['name'];}_0x4223da[_0x0206('0xe')](_0x3cc292)[_0x0206('0xf')](_0x521d23);};}exports[_0x0206('0x9')]=function(_0x4a7bac,_0x2217e8){if(_0x4a7bac[_0x0206('0x10')][_0x0206('0x11')]!==_0x0206('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x4a7bac[_0x0206('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x0206('0x14')][_0x0206('0x15')]({'where':{'id':_0x4a7bac[_0x0206('0x13')]['id']}})[_0x0206('0xa')](handleEntityNotFound(_0x2217e8,null))[_0x0206('0xa')](saveUpdates(_0x4a7bac[_0x0206('0x16')],null))['then'](respondWithResult(_0x2217e8,null))['catch'](handleError(_0x2217e8,null));}; \ No newline at end of file +var _0x7217=['register','defaults','localhost','status','json','update','stack','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket'];(function(_0x57182a,_0x1f0016){var _0x4fddc6=function(_0x20e83c){while(--_0x20e83c){_0x57182a['push'](_0x57182a['shift']());}};_0x4fddc6(++_0x1f0016);}(_0x7217,0xa9));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x7721('0x0'))('api');var config=require(_0x7721('0x1'));var db=require(_0x7721('0x2'))['db'];var socket=require(_0x7721('0x3'))(new Redis(config[_0x7721('0x4')]));require(_0x7721('0x5'))[_0x7721('0x6')](socket);config[_0x7721('0x4')]=_[_0x7721('0x7')](config[_0x7721('0x4')],{'host':_0x7721('0x8'),'port':0x18eb});function respondWithResult(_0x560535,_0x45f1fa){_0x45f1fa=_0x45f1fa||0xc8;return function(_0x2ddbba){if(_0x2ddbba){return _0x560535[_0x7721('0x9')](_0x45f1fa)[_0x7721('0xa')](_0x2ddbba);}};}function saveUpdates(_0x5c609c){return function(_0x26a6e0){if(_0x26a6e0){return _0x26a6e0[_0x7721('0xb')](_0x5c609c)['then'](function(_0x938a36){return _0x938a36;});}return null;};}function handleEntityNotFound(_0x2d6e8d){return function(_0x3d73a3){if(!_0x3d73a3){_0x2d6e8d['sendStatus'](0x194);}return _0x3d73a3;};}function handleError(_0x72662d,_0x6ae385){_0x6ae385=_0x6ae385||0x1f4;return function(_0x199bae){logger['error'](_0x199bae[_0x7721('0xc')]);if(_0x199bae[_0x7721('0xd')]){delete _0x199bae['name'];}_0x72662d[_0x7721('0x9')](_0x6ae385)[_0x7721('0xe')](_0x199bae);};}exports['update']=function(_0x1c2545,_0x34bb02){if(_0x1c2545[_0x7721('0xf')][_0x7721('0x10')]!==_0x7721('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x1c2545[_0x7721('0x12')]['id'])))throw new Error(_0x7721('0x13'));return db[_0x7721('0x14')][_0x7721('0x15')]({'where':{'id':_0x1c2545['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x34bb02,null))['then'](saveUpdates(_0x1c2545[_0x7721('0x17')],null))['then'](respondWithResult(_0x34bb02,null))[_0x7721('0x18')](handleError(_0x34bb02,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 350b146..068af0e 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 _0xc196=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x246cbe,_0x19305c){var _0x855b0=function(_0x2c8d0d){while(--_0x2c8d0d){_0x246cbe['push'](_0x246cbe['shift']());}};_0x855b0(++_0x19305c);}(_0xc196,0x113));var _0x6c19=function(_0x17e2f2,_0x4835e8){_0x17e2f2=_0x17e2f2-0x0;var _0x1dedb3=_0xc196[_0x17e2f2];return _0x1dedb3;};'use strict';var EventEmitter=require(_0x6c19('0x0'));var UserSetting=require(_0x6c19('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6c19('0x2')](0x0);var events={'afterCreate':_0x6c19('0x3'),'afterUpdate':_0x6c19('0x4'),'afterDestroy':_0x6c19('0x5')};function emitEvent(_0x42bf1d){return function(_0x1e82e0,_0xb5beca,_0x7f2c71){UserSettingEvents[_0x6c19('0x6')](_0x42bf1d+':'+_0x1e82e0['id'],_0x1e82e0);UserSettingEvents[_0x6c19('0x6')](_0x42bf1d,_0x1e82e0);_0x7f2c71(null);};}for(var e in events){if(events[_0x6c19('0x7')](e)){var event=events[e];UserSetting[_0x6c19('0x8')](e,emitEvent(event));}}module[_0x6c19('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x7038=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x7038,0x160));var _0x8703=function(_0x255b66,_0x3d8084){_0x255b66=_0x255b66-0x0;var _0x49ad98=_0x7038[_0x255b66];return _0x49ad98;};'use strict';var EventEmitter=require(_0x8703('0x0'));var UserSetting=require(_0x8703('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x8703('0x2')](0x0);var events={'afterCreate':_0x8703('0x3'),'afterUpdate':_0x8703('0x4'),'afterDestroy':_0x8703('0x5')};function emitEvent(_0x13a362){return function(_0x56874c,_0x576e3d,_0x201608){UserSettingEvents[_0x8703('0x6')](_0x13a362+':'+_0x56874c['id'],_0x56874c);UserSettingEvents[_0x8703('0x6')](_0x13a362,_0x56874c);_0x201608(null);};}for(var e in events){if(events[_0x8703('0x7')](e)){var event=events[e];UserSetting[_0x8703('0x8')](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 38caed9..a8056f1 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 _0x3c2c=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x164759,_0x3fbc17){var _0x53868b=function(_0x1f73d5){while(--_0x1f73d5){_0x164759['push'](_0x164759['shift']());}};_0x53868b(++_0x3fbc17);}(_0x3c2c,0x160));var _0xc3c2=function(_0x562331,_0x45638f){_0x562331=_0x562331-0x0;var _0x3c0e48=_0x3c2c[_0x562331];return _0x3c0e48;};'use strict';var attributes=require(_0xc3c2('0x0'));module[_0xc3c2('0x1')]=function(_0x34190d){return _0x34190d[_0xc3c2('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x321ef5){if(!_0x321ef5[_0xc3c2('0x3')])_0x321ef5[_0xc3c2('0x4')]=null;else if(_0x321ef5[_0xc3c2('0x4')]===null)_0x321ef5['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x3715=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x3b7184,_0x53297b){var _0x3ef45e=function(_0x3c780e){while(--_0x3c780e){_0x3b7184['push'](_0x3b7184['shift']());}};_0x3ef45e(++_0x53297b);}(_0x3715,0xc3));var _0x5371=function(_0x328711,_0x1e608a){_0x328711=_0x328711-0x0;var _0x52c05f=_0x3715[_0x328711];return _0x52c05f;};'use strict';var attributes=require(_0x5371('0x0'));module[_0x5371('0x1')]=function(_0x7a44a0){return _0x7a44a0[_0x5371('0x2')](_0x5371('0x3'),attributes,{'tableName':_0x5371('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x132ef3){if(!_0x132ef3[_0x5371('0x5')])_0x132ef3[_0x5371('0x6')]=null;else if(_0x132ef3[_0x5371('0x6')]===null)_0x132ef3[_0x5371('0x6')]=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 7c4797d..19c42dd 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 _0xb9bf=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update'];(function(_0x47b794,_0x4d87ac){var _0x36223f=function(_0xfeec79){while(--_0xfeec79){_0x47b794['push'](_0x47b794['shift']());}};_0x36223f(++_0x4d87ac);}(_0xb9bf,0xaf));var _0xfb9b=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xb9bf[_0x2261ce];return _0x524640;};'use strict';var UserSettingEvents=require(_0xfb9b('0x0'));var events=[_0xfb9b('0x1'),_0xfb9b('0x2'),'update'];function createListener(_0xf7214a,_0x5085de){return function(_0x497e1d){_0x5085de[_0xfb9b('0x3')](_0xf7214a,_0x497e1d);if(_0xf7214a===_0xfb9b('0x4')){_0x5085de[_0xfb9b('0x3')](_0xfb9b('0x5')+_0x497e1d['UserId'],_0x497e1d);}};}exports[_0xfb9b('0x6')]=function(_0x2ef841){for(var _0x356d39=0x0,_0x466b70=events[_0xfb9b('0x7')];_0x356d39<_0x466b70;_0x356d39++){var _0x3eb465=events[_0x356d39];var _0x3e2a44=createListener(_0xfb9b('0x8')+_0x3eb465,_0x2ef841);UserSettingEvents['on'](_0x3eb465,_0x3e2a44);}}; \ No newline at end of file +var _0x6719=['UserId','register','length','user-setting:','./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-'];(function(_0x596033,_0x488f80){var _0x5194da=function(_0x4a45e9){while(--_0x4a45e9){_0x596033['push'](_0x596033['shift']());}};_0x5194da(++_0x488f80);}(_0x6719,0xf6));var _0x9671=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x6719[_0x420f2a];return _0x28f802;};'use strict';var UserSettingEvents=require(_0x9671('0x0'));var events=[_0x9671('0x1'),_0x9671('0x2'),_0x9671('0x3')];function createListener(_0x5e9f5f,_0x5bfdaa){return function(_0x21653c){_0x5bfdaa['emit'](_0x5e9f5f,_0x21653c);if(_0x5e9f5f===_0x9671('0x4')){_0x5bfdaa[_0x9671('0x5')](_0x9671('0x6')+_0x21653c[_0x9671('0x7')],_0x21653c);}};}exports[_0x9671('0x8')]=function(_0x5e536c){for(var _0x3674c2=0x0,_0x57bb95=events[_0x9671('0x9')];_0x3674c2<_0x57bb95;_0x3674c2++){var _0x9054ed=events[_0x3674c2];var _0x5388d3=createListener(_0x9671('0xa')+_0x9054ed,_0x5e536c);UserSettingEvents['on'](_0x9054ed,_0x5388d3);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e62e92d..0531eaf 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 _0xb786=['/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','update','put','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','getVoiceQueuesRt'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb786,0x64));var _0x6b78=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0xb786[_0x1c60bd];return _0xc46ef9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b78('0x0'));var timeout=require(_0x6b78('0x1'));var express=require(_0x6b78('0x2'));var router=express[_0x6b78('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b78('0x4'));var interaction=require(_0x6b78('0x5'));var config=require(_0x6b78('0x6'));var controller=require('./user.controller');router[_0x6b78('0x7')]('/',auth[_0x6b78('0x8')](),controller[_0x6b78('0x9')]);router[_0x6b78('0x7')](_0x6b78('0xa'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xb')]);router['get'](_0x6b78('0xc'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xd')]);router[_0x6b78('0x7')](_0x6b78('0xe'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xf')]);router[_0x6b78('0x7')](_0x6b78('0x10'),auth['isAuthenticated'](),controller[_0x6b78('0x11')]);router['get'](_0x6b78('0x12'),controller['getAvatar']);router[_0x6b78('0x7')](_0x6b78('0x13'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x14')]);router[_0x6b78('0x7')]('/:id/contacts',auth[_0x6b78('0x8')](),controller['getContacts']);router[_0x6b78('0x7')]('/:id/queues',auth[_0x6b78('0x8')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x6b78('0x15')]);router['get'](_0x6b78('0x16'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x17')]);router[_0x6b78('0x7')](_0x6b78('0x18'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x19')]);router['get'](_0x6b78('0x1a'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x1b')]);router['get'](_0x6b78('0x1c'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x1d')]);router['get']('/:id/openchannel/interactions',auth[_0x6b78('0x8')](),controller[_0x6b78('0x1e')]);router[_0x6b78('0x7')](_0x6b78('0x1f'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x20')]);router[_0x6b78('0x7')](_0x6b78('0x21'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x22')]);router[_0x6b78('0x7')]('/:id/fax/interactions',auth[_0x6b78('0x8')](),controller['getFaxInteractions']);router[_0x6b78('0x7')](_0x6b78('0x23'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x24')]);router['get'](_0x6b78('0x25'),auth[_0x6b78('0x8')](),controller['getTeams']);router[_0x6b78('0x7')](_0x6b78('0x26'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x27')]);router[_0x6b78('0x7')]('/:id/agents',auth[_0x6b78('0x8')](),controller[_0x6b78('0x28')]);router[_0x6b78('0x7')](_0x6b78('0x29'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x2a')]);router[_0x6b78('0x7')](_0x6b78('0x2b'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x2c')]);router[_0x6b78('0x7')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x2d')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x2e')]);router[_0x6b78('0x7')](_0x6b78('0x2f'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x30')]);router['get']('/:id/chat_websites',auth[_0x6b78('0x8')](),controller[_0x6b78('0x31')]);router[_0x6b78('0x7')]('/:id/whatsapp_accounts',auth[_0x6b78('0x8')](),controller[_0x6b78('0x32')]);router[_0x6b78('0x7')](_0x6b78('0x33'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x34')]);router[_0x6b78('0x7')](_0x6b78('0x35'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x36')]);router[_0x6b78('0x7')](_0x6b78('0x37'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x6b78('0x38')](_0x6b78('0x39'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x3a')]);router[_0x6b78('0x38')]('/',auth['isAuthenticated'](),controller[_0x6b78('0x3b')]);router[_0x6b78('0x38')](_0x6b78('0x3c'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x3d')]);router[_0x6b78('0x38')](_0x6b78('0x3e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x3f')]);var upload=multer({'storage':multer[_0x6b78('0x40')]({'destination':function(_0x155a44,_0x19000f,_0x542e9b){_0x542e9b(null,path[_0x6b78('0x41')](config[_0x6b78('0x42')],_0x6b78('0x43')));},'filename':function(_0x369775,_0x3476f4,_0x16a603){_0x16a603(null,util['format'](_0x6b78('0x44'),Date[_0x6b78('0x45')](),_0x3476f4[_0x6b78('0x46')]));}})});router[_0x6b78('0x38')]('/:id/avatar',upload[_0x6b78('0x47')](_0x6b78('0x48')),controller['addAvatar']);router[_0x6b78('0x38')](_0x6b78('0x49'),auth['isAuthenticated'](),controller[_0x6b78('0x4a')]);router[_0x6b78('0x38')](_0x6b78('0x4b'),auth[_0x6b78('0x8')](),controller['logout']);router['post'](_0x6b78('0x4c'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x4d')]);router[_0x6b78('0x38')](_0x6b78('0x4e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x4f')]);router[_0x6b78('0x38')](_0x6b78('0x25'),auth['isAuthenticated'](),controller[_0x6b78('0x50')]);router[_0x6b78('0x38')](_0x6b78('0x51'),auth['isAuthenticated'](),controller[_0x6b78('0x52')]);router['post'](_0x6b78('0x53'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x54')]);router[_0x6b78('0x38')](_0x6b78('0x55'),auth[_0x6b78('0x8')](),controller['addFaxInteractions']);router[_0x6b78('0x38')](_0x6b78('0x56'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x57')]);router[_0x6b78('0x38')]('/:id/openchannel_interactions',auth[_0x6b78('0x8')](),controller[_0x6b78('0x58')]);router[_0x6b78('0x38')]('/:id/whatsapp_interactions',auth[_0x6b78('0x8')](),controller['addWhatsappInteractions']);router[_0x6b78('0x38')]('/:id/fax_accounts',auth[_0x6b78('0x8')](),controller[_0x6b78('0x59')]);router[_0x6b78('0x38')]('/:id/mail_accounts',auth[_0x6b78('0x8')](),controller[_0x6b78('0x5a')]);router[_0x6b78('0x38')](_0x6b78('0x5b'),auth[_0x6b78('0x8')](),controller['addOpenchannelAccounts']);router[_0x6b78('0x38')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x5c')]);router[_0x6b78('0x38')]('/:id/chat_websites',auth[_0x6b78('0x8')](),controller[_0x6b78('0x5d')]);router[_0x6b78('0x38')](_0x6b78('0x5e'),auth[_0x6b78('0x8')](),controller['addWhatsappAccounts']);router[_0x6b78('0x38')](_0x6b78('0x33'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x6b78('0x38')](_0x6b78('0x37'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x5f')]);router['put']('/:id',auth[_0x6b78('0x8')](),controller[_0x6b78('0x60')]);router[_0x6b78('0x61')]('/:id/password',auth[_0x6b78('0x8')](),controller[_0x6b78('0x62')]);router[_0x6b78('0x63')](_0x6b78('0x3e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x64')]);router[_0x6b78('0x63')](_0x6b78('0x25'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x65')]);router[_0x6b78('0x63')](_0x6b78('0x10'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x66')]);router[_0x6b78('0x63')](_0x6b78('0x51'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x67')]);router[_0x6b78('0x63')](_0x6b78('0x53'),auth['isAuthenticated'](),controller[_0x6b78('0x68')]);router['delete'](_0x6b78('0x55'),auth['isAuthenticated'](),controller[_0x6b78('0x69')]);router[_0x6b78('0x63')](_0x6b78('0x56'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x6a')]);router[_0x6b78('0x63')](_0x6b78('0x6b'),auth['isAuthenticated'](),controller[_0x6b78('0x6c')]);router[_0x6b78('0x63')](_0x6b78('0x6d'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x6e')]);router[_0x6b78('0x63')](_0x6b78('0x2b'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x6f')]);router[_0x6b78('0x63')](_0x6b78('0x70'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x71')]);router[_0x6b78('0x63')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x6b78('0x72')]);router[_0x6b78('0x63')](_0x6b78('0x2f'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x73')]);router[_0x6b78('0x63')](_0x6b78('0x74'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x75')]);router[_0x6b78('0x63')](_0x6b78('0x5e'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x76')]);router[_0x6b78('0x63')](_0x6b78('0x33'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x77')]);router[_0x6b78('0x63')](_0x6b78('0x37'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x78')]);module[_0x6b78('0x79')]=router; \ No newline at end of file +var _0x2f5f=['index','/describe','describe','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','put','/:id/password','/:id/queues','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated'];(function(_0x26d7a1,_0x340669){var _0x339bdf=function(_0x30abe9){while(--_0x30abe9){_0x26d7a1['push'](_0x26d7a1['shift']());}};_0x339bdf(++_0x340669);}(_0x2f5f,0x65));var _0xf2f5=function(_0x3054a4,_0x2a270b){_0x3054a4=_0x3054a4-0x0;var _0x11292d=_0x2f5f[_0x3054a4];return _0x11292d;};'use strict';var multer=require('multer');var util=require(_0xf2f5('0x0'));var path=require('path');var timeout=require(_0xf2f5('0x1'));var express=require(_0xf2f5('0x2'));var router=express[_0xf2f5('0x3')]();var fs_extra=require(_0xf2f5('0x4'));var auth=require(_0xf2f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2f5('0x6'));var controller=require(_0xf2f5('0x7'));router[_0xf2f5('0x8')]('/',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0xa')]);router[_0xf2f5('0x8')](_0xf2f5('0xb'),auth['isAuthenticated'](),controller[_0xf2f5('0xc')]);router[_0xf2f5('0x8')]('/whoami',auth[_0xf2f5('0x9')](),controller['whoami']);router[_0xf2f5('0x8')](_0xf2f5('0xd'),auth['isAuthenticated'](),controller[_0xf2f5('0xe')]);router['get'](_0xf2f5('0xf'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x10')]);router[_0xf2f5('0x8')](_0xf2f5('0x11'),controller[_0xf2f5('0x12')]);router[_0xf2f5('0x8')](_0xf2f5('0x13'),auth[_0xf2f5('0x9')](),controller['getOpenTabs']);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xf2f5('0x14')]);router[_0xf2f5('0x8')]('/:id/queues',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x15')]);router[_0xf2f5('0x8')](_0xf2f5('0x16'),auth['isAuthenticated'](),controller[_0xf2f5('0x17')]);router[_0xf2f5('0x8')]('/:id/groups',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x18')]);router['get']('/:id/recordings',auth['isAuthenticated'](),controller[_0xf2f5('0x19')]);router[_0xf2f5('0x8')](_0xf2f5('0x1a'),auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0xf2f5('0x1b'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x1c')]);router[_0xf2f5('0x8')](_0xf2f5('0x1d'),auth['isAuthenticated'](),controller[_0xf2f5('0x1e')]);router[_0xf2f5('0x8')]('/:id/mail/interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x1f')]);router[_0xf2f5('0x8')]('/:id/sms/interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x20')]);router[_0xf2f5('0x8')](_0xf2f5('0x21'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x22')]);router[_0xf2f5('0x8')]('/:id/whatsapp/interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x23')]);router[_0xf2f5('0x8')](_0xf2f5('0x24'),auth[_0xf2f5('0x9')](),controller['getTeams']);router[_0xf2f5('0x8')](_0xf2f5('0x25'),auth[_0xf2f5('0x9')](),controller['getLists']);router[_0xf2f5('0x8')](_0xf2f5('0x26'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x27')]);router[_0xf2f5('0x8')]('/:id/prefixes',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x28')]);router[_0xf2f5('0x8')](_0xf2f5('0x29'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x2a')]);router[_0xf2f5('0x8')](_0xf2f5('0x2b'),auth['isAuthenticated'](),controller[_0xf2f5('0x2c')]);router[_0xf2f5('0x8')]('/:id/openchannel_accounts',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x2d')]);router['get'](_0xf2f5('0x2e'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x2f')]);router[_0xf2f5('0x8')]('/:id/chat_websites',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x30')]);router[_0xf2f5('0x8')]('/:id/whatsapp_accounts',auth[_0xf2f5('0x9')](),controller['getWhatsappAccounts']);router[_0xf2f5('0x8')](_0xf2f5('0x31'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x32')]);router[_0xf2f5('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xf2f5('0x33')]);router[_0xf2f5('0x8')](_0xf2f5('0x34'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x35')]);router[_0xf2f5('0x36')](_0xf2f5('0x37'),auth['isAuthenticated'](),controller['addContacts']);router[_0xf2f5('0x36')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf2f5('0x36')]('/create_many',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x38')]);router[_0xf2f5('0x36')]('/:id/queues',auth['isAuthenticated'](),controller[_0xf2f5('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36bfa3,_0x1e9522,_0x4b5a39){_0x4b5a39(null,path[_0xf2f5('0x3a')](config[_0xf2f5('0x3b')],_0xf2f5('0x3c')));},'filename':function(_0x204d78,_0x5b3ea5,_0x2a3e15){_0x2a3e15(null,util[_0xf2f5('0x3d')](_0xf2f5('0x3e'),Date[_0xf2f5('0x3f')](),_0x5b3ea5['originalname']));}})});router['post'](_0xf2f5('0x11'),upload['single']('file'),controller['addAvatar']);router[_0xf2f5('0x36')](_0xf2f5('0x40'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x41')]);router[_0xf2f5('0x36')](_0xf2f5('0x42'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x43')]);router[_0xf2f5('0x36')](_0xf2f5('0x44'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x45')]);router[_0xf2f5('0x36')]('/:id/unpause',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x46')]);router[_0xf2f5('0x36')]('/:id/teams',auth[_0xf2f5('0x9')](),controller['addTeams']);router[_0xf2f5('0x36')]('/:id/chat_interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x47')]);router[_0xf2f5('0x36')](_0xf2f5('0x48'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x49')]);router[_0xf2f5('0x36')](_0xf2f5('0x4a'),auth['isAuthenticated'](),controller[_0xf2f5('0x4b')]);router['post']('/:id/sms_interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x4c')]);router[_0xf2f5('0x36')](_0xf2f5('0x4d'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x4e')]);router[_0xf2f5('0x36')]('/:id/whatsapp_interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x4f')]);router[_0xf2f5('0x36')](_0xf2f5('0x29'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x50')]);router[_0xf2f5('0x36')](_0xf2f5('0x2b'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x51')]);router[_0xf2f5('0x36')]('/:id/openchannel_accounts',auth[_0xf2f5('0x9')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xf2f5('0x52')]);router[_0xf2f5('0x36')](_0xf2f5('0x53'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x54')]);router['post'](_0xf2f5('0x55'),auth['isAuthenticated'](),controller[_0xf2f5('0x56')]);router[_0xf2f5('0x36')](_0xf2f5('0x31'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x57')]);router[_0xf2f5('0x36')](_0xf2f5('0x34'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xf2f5('0x58')](_0xf2f5('0xf'),auth[_0xf2f5('0x9')](),controller['update']);router[_0xf2f5('0x58')](_0xf2f5('0x59'),auth[_0xf2f5('0x9')](),controller['changePassword']);router['delete'](_0xf2f5('0x5a'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x5b')]);router[_0xf2f5('0x5c')](_0xf2f5('0x24'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x5d')]);router[_0xf2f5('0x5c')](_0xf2f5('0xf'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x5e')]);router[_0xf2f5('0x5c')](_0xf2f5('0x5f'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x60')]);router[_0xf2f5('0x5c')]('/:id/mail_interactions',auth[_0xf2f5('0x9')](),controller['removeMailInteractions']);router['delete'](_0xf2f5('0x4a'),auth['isAuthenticated'](),controller[_0xf2f5('0x61')]);router[_0xf2f5('0x5c')]('/:id/sms_interactions',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x62')]);router[_0xf2f5('0x5c')](_0xf2f5('0x4d'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x63')]);router[_0xf2f5('0x5c')](_0xf2f5('0x64'),auth[_0xf2f5('0x9')](),controller['removeWhatsappInteractions']);router[_0xf2f5('0x5c')](_0xf2f5('0x29'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x65')]);router[_0xf2f5('0x5c')](_0xf2f5('0x2b'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x66')]);router[_0xf2f5('0x5c')](_0xf2f5('0x67'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x68')]);router[_0xf2f5('0x5c')]('/:id/sms_accounts',auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x69')]);router[_0xf2f5('0x5c')](_0xf2f5('0x53'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x6a')]);router['delete'](_0xf2f5('0x55'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x6b')]);router[_0xf2f5('0x5c')](_0xf2f5('0x31'),auth[_0xf2f5('0x9')](),controller[_0xf2f5('0x6c')]);router['delete'](_0xf2f5('0x34'),auth['isAuthenticated'](),controller[_0xf2f5('0x6d')]);module[_0xf2f5('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 7c5d9eb..038a02c 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 _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','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','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','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]'];(function(_0x5b280e,_0x16ca48){var _0xcc44a2=function(_0x3d76b8){while(--_0x3d76b8){_0x5b280e['push'](_0x5b280e['shift']());}};_0xcc44a2(++_0x16ca48);}(_0xedd9,0xfc));var _0x9edd=function(_0xd2d0a7,_0x39e2fc){_0xd2d0a7=_0xd2d0a7-0x0;var _0x429ed4=_0xedd9[_0xd2d0a7];return _0x429ed4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file +var _0x008c=['all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','wss','dtlsverify','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','getDataValue','internal','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x2fb531,_0xdb0c4e){var _0x1ad0bc=function(_0x2abb07){while(--_0x2abb07){_0x2fb531['push'](_0x2fb531['shift']());}};_0x1ad0bc(++_0xdb0c4e);}(_0x008c,0x188));var _0xc008=function(_0x3025e0,_0xf2c52d){_0x3025e0=_0x3025e0-0x0;var _0x4ee7c5=_0x008c[_0x3025e0];return _0x4ee7c5;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));module[_0xc008('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc008('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47063f){this[_0xc008('0x6')](_0xc008('0x5'),_0x47063f);this[_0xc008('0x6')](_0xc008('0x7'),_0x47063f);},'comment':_0xc008('0x8')},'fullname':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'set':function(_0x9c8cb2){this['setDataValue'](_0xc008('0xa'),_0x9c8cb2);this['setDataValue'](_0xc008('0xb'),util['format']('\x22%s\x22\x20<%s>',_0x9c8cb2,this[_0xc008('0xc')](_0xc008('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1eacfa){if(_0x1eacfa){this[_0xc008('0x6')]('email',_0x1eacfa[_0xc008('0xe')]());}}},'role':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x10'),_0xc008('0x11'),_0xc008('0x12'),_0xc008('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25e13f){this[_0xc008('0x6')](_0xc008('0xd'),_0x25e13f);this[_0xc008('0x6')](_0xc008('0x15'),_0x25e13f);this['setDataValue']('callerid',util['format'](_0xc008('0x16'),this[_0xc008('0xc')](_0xc008('0xa')),_0x25e13f));}},'salt':{'type':Sequelize[_0xc008('0x9')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc008('0x9')]},'city':{'type':Sequelize[_0xc008('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc008('0x18')]},'chatCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc008('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x19')},'ipaddr':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0xc008('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x1a'),_0xc008('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xc008('0x1a')},'context':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x1b')},'callingpres':{'type':Sequelize[_0xc008('0xf')]('ALLOWED_NOT_SCREENED',_0xc008('0x1c'),_0xc008('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc008('0x1e'),_0xc008('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x20'),'set':function(_0x2b862d){this[_0xc008('0x6')](_0xc008('0x21'),_0x2b862d?_0x2b862d['join'](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x21'))?this['getDataValue'](_0xc008('0x21'))[_0xc008('0x22')](','):null;},'comment':_0xc008('0x23')},'dtmfmode':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x24'),_0xc008('0x25'),_0xc008('0x26'),_0xc008('0x27'),_0xc008('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x2a'),_0xc008('0x2b'),_0xc008('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x399b64){this[_0xc008('0x6')]('nat',_0x399b64?_0x399b64[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x2e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0xc008('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc008('0x9')]},'pickupgroup':{'type':Sequelize[_0xc008('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xc008('0x9')]},'language':{'type':Sequelize[_0xc008('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc008('0x9')]},'disallow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x30')},'allow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x31'),'set':function(_0x387dfd){this[_0xc008('0x6')](_0xc008('0x32'),_0x387dfd?_0x387dfd[_0xc008('0x2d')](';'):_0xc008('0x31'));},'get':function(){return this['getDataValue'](_0xc008('0x32'))?this[_0xc008('0xc')](_0xc008('0x32'))[_0xc008('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'set':function(_0x36e7ae){this[_0xc008('0x6')]('insecure',_0x36e7ae?_0x36e7ae[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x33'))?this[_0xc008('0xc')](_0xc008('0x33'))['split'](','):null;},'comment':_0xc008('0x34')},'trustrpid':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xc008('0x37'),_0xc008('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x39'),_0xc008('0x3a')),'allowNull':!![],'defaultValue':_0xc008('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x3b'),_0xc008('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x3d'),'passive',_0xc008('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc008('0xf')]('yes','no',_0xc008('0x2a'),'update',_0xc008('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc008('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xc008('0x18')]},'passwordResetAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc008('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x375e71){this['setDataValue']('showWebBar',_0x375e71);var _0x37ce5e=this[_0xc008('0x41')]({'plain':!![]});switch(_0x375e71){case 0x0:case 0x1:var _0x56e755=_0x37ce5e[_0xc008('0x21')]?_[_0xc008('0x42')](_0x37ce5e[_0xc008('0x21')])?_0x37ce5e[_0xc008('0x21')][_0xc008('0x2d')]():_0x37ce5e[_0xc008('0x21')]:_0xc008('0x20');if(_0x56e755==='wss'){_0x56e755=_0xc008('0x20');}this[_0xc008('0x6')](_0xc008('0x21'),_0x56e755);this[_0xc008('0x6')](_0xc008('0x43'),'no');this[_0xc008('0x6')](_0xc008('0x44'),null);this[_0xc008('0x6')](_0xc008('0x45'),null);this[_0xc008('0x6')](_0xc008('0x46'),null);this[_0xc008('0x6')](_0xc008('0x47'),null);this[_0xc008('0x6')]('dtlsverify',null);this[_0xc008('0x6')](_0xc008('0x48'),null);this[_0xc008('0x6')]('dtlscertfile',null);this[_0xc008('0x6')](_0xc008('0x49'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc008('0x6')](_0xc008('0x21'),_0xc008('0x4a'));this[_0xc008('0x6')](_0xc008('0x43'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x44'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x45'),'yes');this[_0xc008('0x6')](_0xc008('0x46'),_0xc008('0x29'));this[_0xc008('0x6')]('dtlsenable',_0xc008('0x29'));this['setDataValue'](_0xc008('0x4b'),'no');this[_0xc008('0x6')](_0xc008('0x48'),'actpass');this[_0xc008('0x6')](_0xc008('0x4c'),_0x37ce5e[_0xc008('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0xc008('0x6')]('dtlsprivatekey',_0x37ce5e[_0xc008('0x49')]||_0xc008('0x4d'));this[_0xc008('0x6')](_0xc008('0x4e'),_0xc008('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3c30db){this[_0xc008('0x6')]('permissions',_0x3c30db?_0x3c30db[_0xc008('0x2d')](','):[]);},'get':function(){return this['getDataValue'](_0xc008('0x4f'))?_['map'](this[_0xc008('0xc')]('permissions')[_0xc008('0x22')](','),function(_0x103d75){return parseInt(_0x103d75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc008('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc008('0x50')],'get':function(){return this[_0xc008('0xc')](_0xc008('0x51'))?this[_0xc008('0xc')](_0xc008('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc008('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3b2669){if(typeof _0x3b2669===_0xc008('0x52')){var _0x2edb8e=_0x3b2669==='1'?!![]:_0x3b2669==='0'?![]:_0x3b2669===_0xc008('0x53')?!![]:_0x3b2669===_0xc008('0x54')?![]:![];this[_0xc008('0x6')](_0xc008('0x55'),_0x2edb8e);}else{this['setDataValue']('screenrecording',_0x3b2669);}}},'blocked':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3104cd){this[_0xc008('0x6')]('blocked',_0x3104cd);if(_0x3104cd===!![]){this[_0xc008('0x6')](_0xc008('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0xc008('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc008('0x14')](0x5)[_0xc008('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3f17ea5..1e5783b 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 _0x0388=['slice','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','bluebird','util','path','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../errors/api','APIBadRequestError','APINotFoundError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','emit','userNotification:recalc:','get','role','admin','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','name','User','fieldName','type','filter','password','salt','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','chat','dataValues','fax','mail','openchannel','whatsapp','all','catch','params','model','keys','rawAttributes','filters','intersection','fields','length','options','find','openTabs','sms','body','describe','addContacts','ids','omit','internal','Setting','validatePasswordPattern','max','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','104','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','autoAssociation','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','QueueId','Queue:save','voice','VoiceQueue','online','format','SIP/%s','voicePause','each','removeQueues','remove','isArray','Queue:remove','destroy','userpic','filename','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','sort','pick','merge','hasOwnProperty','CmList','Tag','tag','nolimit','limit','getQueues','isValidChannel','order','Queue','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','LOGININPAUSE','isMiddleware','resolve','pause','QueuePause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','%s%s','manual','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','sequelize','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','upsert','penalty','TeamVoicePrefix','UserVoicePrefix','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','spread','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notIn','$like','$notLike','$notILike','$overlap','$contained','firstName','CmContact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','Team','queues','inbound','lower','col','flatten','toString','desc','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','toUpperCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0388,0x19e));var _0x8038=function(_0x59edbc,_0x346398){_0x59edbc=_0x59edbc-0x0;var _0xe049e7=_0x0388[_0x59edbc];return _0xe049e7;};'use strict';var moment=require('moment');var BPromise=require(_0x8038('0x0'));var util=require(_0x8038('0x1'));var path=require(_0x8038('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8038('0x3'));var jayson=require('jayson/promise');var Redis=require(_0x8038('0x4'));var authService=require('../../components/auth/service');var qs=require(_0x8038('0x5'));var logger=require(_0x8038('0x6'))(_0x8038('0x7'));var utils=require(_0x8038('0x8'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x8038('0x9'))[_0x8038('0xa')];var APINotFoundError=require(_0x8038('0x9'))[_0x8038('0xb')];var APIHandleError=require(_0x8038('0x9'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0x8038('0xc'))(new Redis(config[_0x8038('0xd')]));require(_0x8038('0xe'))[_0x8038('0xf')](socket);config[_0x8038('0xd')]=_[_0x8038('0x10')](config['redis'],{'host':_0x8038('0x11'),'port':0x18eb});var client=jayson[_0x8038('0x12')][_0x8038('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4ae4e3,_0x4f1201,_0x2a502b,_0x5c7432){return new BPromise(function(_0x32d895,_0x11d42a){var _0xf1f563=_0x5c7432||client;return _0xf1f563[_0x8038('0x14')](_0x4ae4e3,_0x2a502b)[_0x8038('0x15')](function(_0x30365c){logger[_0x8038('0x16')](_0x8038('0x17'),_0x4f1201,'request\x20sent');logger[_0x8038('0x18')]('User,\x20%s,\x20%s,\x20%s',_0x4f1201,_0x8038('0x19'),JSON[_0x8038('0x1a')](_0x30365c));if(_0x30365c[_0x8038('0x1b')]){if(_0x30365c['error']['code']===0x1f4){logger[_0x8038('0x1b')]('User,\x20%s,\x20%s',_0x4f1201,_0x30365c['error'][_0x8038('0x1c')]);return _0x11d42a(_0x30365c[_0x8038('0x1b')]['message']);}logger[_0x8038('0x1b')]('User,\x20%s,\x20%s',_0x4f1201,_0x30365c['error'][_0x8038('0x1c')]);return _0x32d895(_0x30365c[_0x8038('0x1b')][_0x8038('0x1c')]);}else{logger['info']('User,\x20%s,\x20%s',_0x4f1201,_0x8038('0x19'));_0x32d895(_0x30365c[_0x8038('0x1d')][_0x8038('0x1c')]);}})['catch'](function(_0x550d5d){logger[_0x8038('0x1b')]('User,\x20%s,\x20%s',_0x4f1201,_0x550d5d);_0x11d42a(_0x550d5d);});});}function respondWithStatusCode(_0x5cf686,_0x2d7f7f){_0x2d7f7f=_0x2d7f7f||0xcc;return function(_0x29440e){if(_0x29440e){return _0x5cf686[_0x8038('0x1e')](_0x2d7f7f);}return _0x5cf686[_0x8038('0x1f')](_0x2d7f7f)[_0x8038('0x20')]();};}function respondWithResult(_0x167b9e,_0x4417c0){_0x4417c0=_0x4417c0||0xc8;return function(_0x2cdb46){if(_0x2cdb46){return _0x167b9e[_0x8038('0x1f')](_0x4417c0)['json'](_0x2cdb46);}};}function respondWithFilteredResult(_0x4f1622,_0x1ebbbf){return function(_0x398975){if(_0x398975){var _0x510450=typeof _0x1ebbbf[_0x8038('0x21')]==='undefined'&&typeof _0x1ebbbf['limit']===_0x8038('0x22');var _0x1cbeb1=_0x398975[_0x8038('0x23')];var _0x44a3ec=_0x510450?0x0:_0x1ebbbf[_0x8038('0x21')];var _0x33d615=_0x510450?_0x398975[_0x8038('0x23')]:_0x1ebbbf[_0x8038('0x21')]+_0x1ebbbf['limit'];var _0x1a3c1c;if(_0x33d615>=_0x1cbeb1){_0x33d615=_0x1cbeb1;_0x1a3c1c=0xc8;}else{_0x1a3c1c=0xce;}_0x4f1622[_0x8038('0x1f')](_0x1a3c1c);return _0x4f1622[_0x8038('0x24')](_0x8038('0x25'),_0x44a3ec+'-'+_0x33d615+'/'+_0x1cbeb1)[_0x8038('0x26')](_0x398975);}return null;};}function saveUpdates(_0x3773ef){return function(_0x32ae50){if(_0x32ae50){return _0x32ae50[_0x8038('0x27')](_0x3773ef)['then'](function(_0x212c49){socket[_0x8038('0x28')](_0x8038('0x29')+_0x212c49['id'],{});return _0x212c49;});}return null;};}function removeEntity(_0x42bc63){return function(_0x200aa6){if(_0x200aa6){return _0x200aa6['destroy']()[_0x8038('0x15')](function(){var _0x401c6a=_0x200aa6[_0x8038('0x2a')]({'plain':!![]});if(_0x401c6a[_0x8038('0x2b')]===_0x8038('0x2c'))return;var _0x22906e=[{'name':_0x8038('0x2d'),'value':_0x8038('0x2e'),'ignore':!![]},{'name':_0x8038('0x2f'),'value':_0x8038('0x30'),'ignore':![]},{'name':_0x8038('0x31'),'value':_0x8038('0x32'),'ignore':![]}];var _0x434b23=_(_0x22906e)['filter'](_0x8038('0x33'))[_0x8038('0x34')](_0x8038('0x35'))[_0x8038('0x35')]();if(_[_0x8038('0x36')](_0x434b23,_0x401c6a[_0x8038('0x2b')])){return;}var _0x465722=_['find'](_0x22906e,[_0x8038('0x35'),_0x401c6a['role']])[_0x8038('0x37')];return db['UserProfileResource']['destroy']({'where':{'type':_0x465722,'resourceId':_0x401c6a['id']}})[_0x8038('0x15')](function(){return _0x200aa6;});})['then'](function(){_0x42bc63[_0x8038('0x1f')](0xcc)[_0x8038('0x20')]();});}};}function handleEntityNotFound(_0x2a22f0){return function(_0x3a3b7f){if(!_0x3a3b7f){_0x2a22f0['sendStatus'](0x194);}return _0x3a3b7f;};}function handleError(_0x453bd4,_0xebd29a){_0xebd29a=_0xebd29a||0x1f4;return function(_0x3dcf99){logger[_0x8038('0x1b')](_0x3dcf99['stack']);if(_0x3dcf99[_0x8038('0x37')]){delete _0x3dcf99[_0x8038('0x37')];}_0x453bd4[_0x8038('0x1f')](_0xebd29a)['send'](_0x3dcf99);};}exports['index']=function(_0x54bce4,_0x3d010d){var _0x4fed01={},_0x34df3c={'count':0x0,'rows':[]};var _0x13bfbf=_(db[_0x8038('0x38')]['rawAttributes'])[_0x8038('0x34')](function(_0x3bb33a){return{'name':_0x3bb33a[_0x8038('0x39')],'type':_0x3bb33a[_0x8038('0x3a')]['key']};})[_0x8038('0x3b')](function(_0x1d8165){return!_[_0x8038('0x36')]([_0x8038('0x3c'),_0x8038('0x3d')],_0x1d8165[_0x8038('0x37')]);})[_0x8038('0x35')]();_0x4fed01=qs[_0x8038('0x3e')](_0x13bfbf,_0x54bce4);var _0x2a41ef={'where':_0x4fed01[_0x8038('0x3f')]};return db[_0x8038('0x38')][_0x8038('0x23')](_0x2a41ef)['then'](function(_0x488dde){_0x34df3c['count']=_0x488dde;if(_0x54bce4[_0x8038('0x40')][_0x8038('0x41')]){_0x4fed01[_0x8038('0x42')]=[{'all':!![]}];}if(_0x54bce4[_0x8038('0x40')][_0x8038('0x43')]===_0x8038('0x44')){_0x4fed01['include']=[{'model':db[_0x8038('0x45')],'as':_0x8038('0x43')}];}if(!_[_0x8038('0x36')](_0x4fed01[_0x8038('0x46')],'id')){_0x4fed01[_0x8038('0x46')][_0x8038('0x47')]('id');}return db[_0x8038('0x38')][_0x8038('0x48')](_0x4fed01);})['then'](function(_0x135d65){_0x34df3c['rows']=_0x135d65;if(_0x54bce4[_0x8038('0x40')]['openTabs']===_0x8038('0x44')){var _0x1bd60e=[];for(var _0x143682=0x0;_0x143682<_0x34df3c[_0x8038('0x49')]['length'];_0x143682++){_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4a'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));_0x1bd60e[_0x8038('0x47')](get_open_tabs('sms',_0x34df3c[_0x8038('0x49')][_0x143682]['dataValues']));_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4c'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4d'),_0x34df3c['rows'][_0x143682]['dataValues']));_0x1bd60e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4e'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));_0x1bd60e['push'](get_open_tabs(_0x8038('0x4f'),_0x34df3c[_0x8038('0x49')][_0x143682][_0x8038('0x4b')]));}return BPromise[_0x8038('0x50')](_0x1bd60e)['then'](function(){return _0x34df3c;});}else{return _0x34df3c;}})[_0x8038('0x15')](respondWithFilteredResult(_0x3d010d,_0x4fed01))[_0x8038('0x51')](handleError(_0x3d010d,null));};exports['show']=function(_0xc2901f,_0x1e3dcd){var _0x2b91d9={'raw':![],'where':{'id':_0xc2901f[_0x8038('0x52')]['id']}},_0x5f5685={};_0x5f5685[_0x8038('0x53')]=_['differenceBy'](_[_0x8038('0x54')](db[_0x8038('0x38')][_0x8038('0x55')]),[_0x8038('0x3c'),_0x8038('0x3d')]);_0x5f5685[_0x8038('0x40')]=_[_0x8038('0x54')](_0xc2901f['query']);_0x5f5685[_0x8038('0x56')]=_['intersection'](_0x5f5685[_0x8038('0x53')],_0x5f5685[_0x8038('0x40')]);_0x2b91d9['attributes']=_[_0x8038('0x57')](_0x5f5685[_0x8038('0x53')],qs[_0x8038('0x58')](_0xc2901f['query'][_0x8038('0x58')]));_0x2b91d9[_0x8038('0x46')]=_0x2b91d9[_0x8038('0x46')][_0x8038('0x59')]?_0x2b91d9[_0x8038('0x46')]:_0x5f5685[_0x8038('0x53')];if(_0xc2901f[_0x8038('0x40')][_0x8038('0x41')]){_0x2b91d9[_0x8038('0x42')]=[{'all':!![]}];}if(_0xc2901f[_0x8038('0x40')]['userSetting']===_0x8038('0x44')){_0x2b91d9[_0x8038('0x42')]=[{'model':db[_0x8038('0x45')],'as':_0x8038('0x43')}];}_0x2b91d9=_['merge']({},_0x2b91d9,_0xc2901f[_0x8038('0x5a')]);if(!_[_0x8038('0x36')](_0x2b91d9[_0x8038('0x46')],'id')){_0x2b91d9[_0x8038('0x46')][_0x8038('0x47')]('id');}return db[_0x8038('0x38')][_0x8038('0x5b')](_0x2b91d9)[_0x8038('0x15')](handleEntityNotFound(_0x1e3dcd,null))[_0x8038('0x15')](function(_0x4f42de){var _0x4a482e=[];values=_0x4f42de;if(_0xc2901f[_0x8038('0x40')][_0x8038('0x5c')]===_0x8038('0x44')){_0x4a482e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4a'),_0x4f42de['dataValues']));_0x4a482e[_0x8038('0x47')](get_open_tabs(_0x8038('0x5d'),_0x4f42de[_0x8038('0x4b')]));_0x4a482e['push'](get_open_tabs(_0x8038('0x4e'),_0x4f42de[_0x8038('0x4b')]));_0x4a482e[_0x8038('0x47')](get_open_tabs('whatsapp',_0x4f42de[_0x8038('0x4b')]));_0x4a482e[_0x8038('0x47')](get_open_tabs(_0x8038('0x4c'),_0x4f42de[_0x8038('0x4b')]));_0x4a482e['push'](get_open_tabs(_0x8038('0x4d'),_0x4f42de[_0x8038('0x4b')]));return BPromise[_0x8038('0x50')](_0x4a482e);}else{return values;}})['then'](function(){return values;})[_0x8038('0x15')](respondWithResult(_0x1e3dcd,null))['catch'](handleError(_0x1e3dcd,null));};exports[_0x8038('0x27')]=function(_0x319953,_0x24b825){if(_0x319953[_0x8038('0x5e')]['id']){delete _0x319953['body']['id'];}delete _0x319953['body']['role'];return db['User'][_0x8038('0x5b')]({'where':{'id':_0x319953[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x24b825,null))['then'](saveUpdates(_0x319953[_0x8038('0x5e')],null))[_0x8038('0x15')](respondWithResult(_0x24b825,null))['catch'](handleError(_0x24b825,null));};exports[_0x8038('0x5f')]=function(_0x2ae206,_0x1b5caf){return db[_0x8038('0x38')][_0x8038('0x5f')]()['then'](respondWithResult(_0x1b5caf,null))[_0x8038('0x51')](handleError(_0x1b5caf,null));};exports['addContacts']=function(_0x12b0d5,_0x1683f8){return db['User']['find']({'where':{'id':_0x12b0d5[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x1683f8,null))[_0x8038('0x15')](function(_0x4403e2){if(_0x4403e2){return _0x4403e2[_0x8038('0x60')](_0x12b0d5[_0x8038('0x5e')][_0x8038('0x61')],_[_0x8038('0x62')](_0x12b0d5['body'],[_0x8038('0x61'),'id'])||{});}})[_0x8038('0x15')](respondWithResult(_0x1683f8,null))[_0x8038('0x51')](handleError(_0x1683f8,null));};function validateUser(_0x5b278a){return new BPromise(function(_0x23b8c2,_0x5111c1){if(_0x5b278a[_0x8038('0x63')])return _0x23b8c2(_0x5b278a);return db[_0x8038('0x64')]['findById'](0x1)[_0x8038('0x15')](function(_0x45c9f2){if(_0x45c9f2['securePassword'])authService[_0x8038('0x65')](_0x5b278a['password']);db['User'][_0x8038('0x66')](_0x8038('0x63'))[_0x8038('0x15')](function(_0x2c925f){if(_['isNil'](_0x2c925f)){_0x5b278a[_0x8038('0x63')]=_0x45c9f2[_0x8038('0x67')]||0x1;return;}if(_[_0x8038('0x68')](_0x45c9f2['min_internal'])||_0x45c9f2['min_internal']===_0x2c925f){_0x5b278a[_0x8038('0x63')]=_0x2c925f+0x1;return;}if(_0x45c9f2[_0x8038('0x67')]>_0x2c925f){_0x5b278a[_0x8038('0x63')]=_0x45c9f2[_0x8038('0x67')];return;}return db['sequelize'][_0x8038('0x40')](_0x8038('0x69'),{'type':db['sequelize'][_0x8038('0x6a')][_0x8038('0x6b')]})['then'](function(_0xc94c3){if(_0xc94c3&&_0xc94c3[_0x8038('0x59')]){for(var _0xcca4b3=0x0,_0xd180be=_0xc94c3[_0x8038('0x59')];_0xcca4b3<_0xd180be&&_[_0x8038('0x68')](_0x5b278a[_0x8038('0x63')]);_0xcca4b3++){if(_0x45c9f2['min_internal']<=_0xc94c3[_0xcca4b3][_0x8038('0x6c')]){_0x5b278a[_0x8038('0x63')]=_0xc94c3[_0xcca4b3][_0x8038('0x6c')];}else if(_0x45c9f2[_0x8038('0x67')]>_0xc94c3[_0xcca4b3][_0x8038('0x6c')]&&_0x45c9f2['min_internal']<=_0xc94c3[_0xcca4b3]['to']){_0x5b278a[_0x8038('0x63')]=_0x45c9f2['min_internal'];}}}if(_['isNil'](_0x5b278a[_0x8038('0x63')])){_0x5b278a['internal']=_0x2c925f+0x1;}return _0x23b8c2(_0x5b278a);});});})[_0x8038('0x51')](function(_0x624091){_0x5111c1(_0x624091);});});}function updateUser(_0x560275){return new BPromise(function(_0x1b1d0a,_0xd2d012){try{if(_0x560275['voicemail']){_0x560275[_0x8038('0x6d')]=_0x560275['internal'];_0x560275[_0x8038('0x6e')]={'mailbox':_0x560275['internal'],'password':_0x560275[_0x8038('0x3c')],'fullname':_0x560275[_0x8038('0x6f')],'email':_0x560275[_0x8038('0x70')]};}if(_0x560275[_0x8038('0x2b')]===_0x8038('0x30')){if(!_0x560275[_0x8038('0x71')])_0x560275[_0x8038('0x71')]=[_0x8038('0x72'),_0x8038('0x73'),_0x8038('0x74'),_0x8038('0x75'),'110',_0x8038('0x76'),'105','106','107','108',_0x8038('0x77'),_0x8038('0x78'),_0x8038('0x79'),_0x8038('0x7a'),_0x8038('0x7b')];}_0x1b1d0a(_0x560275);}catch(_0x2d1cef){_0xd2d012(_0x2d1cef);}});}exports[_0x8038('0x7c')]=function(_0x1cbe1c,_0x42054f){if(_0x1cbe1c[_0x8038('0x2e')]['role']===_0x8038('0x30'))throw new Error(_0x8038('0x7d'));if(_0x1cbe1c[_0x8038('0x5e')]['role']===_0x8038('0x2e')&&_0x1cbe1c[_0x8038('0x2e')][_0x8038('0x2b')]!==_0x8038('0x2c')){throw new Error(_0x8038('0x7e'));}if(_0x1cbe1c[_0x8038('0x5e')][_0x8038('0x2b')]==='admin'&&_0x1cbe1c[_0x8038('0x2e')][_0x8038('0x2b')]!==_0x8038('0x2c')){throw new Error(_0x8038('0x7f'));}return licenseUtil[_0x8038('0x80')]([_0x1cbe1c[_0x8038('0x5e')]])['then'](function(){return validateUser(_0x1cbe1c[_0x8038('0x5e')]);})[_0x8038('0x15')](function(_0x2d151c){return updateUser(_0x2d151c)[_0x8038('0x15')](function(_0x292626){if(_0x292626['role']===_0x8038('0x2c')){_0x292626[_0x8038('0x81')]=_0x1cbe1c[_0x8038('0x2e')]['settingsEnabled'];delete _0x292626['userProfileId'];}return _0x292626;});})[_0x8038('0x15')](function(_0x3a87ca){return db['User']['create'](_0x3a87ca,{'include':[{'model':db[_0x8038('0x6e')],'as':_0x8038('0x6e')}]});})[_0x8038('0x15')](function(_0x234f09){if(_0x1cbe1c[_0x8038('0x5e')][_0x8038('0x2b')]===_0x8038('0x2e'))return _0x234f09;if(_0x1cbe1c[_0x8038('0x2e')][_0x8038('0x2b')]!=='user')return _0x234f09;return db['UserProfileSection']['find']({'where':{'name':_0x234f09[_0x8038('0x2b')]==='agent'?_0x8038('0x2f'):_0x8038('0x31'),'userProfileId':_0x1cbe1c[_0x8038('0x2e')]['userProfileId']},'raw':!![]})[_0x8038('0x15')](function(_0x5deb4b){if(!_0x5deb4b||_0x5deb4b[_0x8038('0x82')]!=0x0)return _0x234f09;return db[_0x8038('0x83')][_0x8038('0x7c')]({'name':_0x234f09[_0x8038('0x37')],'resourceId':_0x234f09['id'],'type':_0x5deb4b[_0x8038('0x37')],'sectionId':_0x5deb4b['id']},{})['then'](function(){return _0x234f09;});})[_0x8038('0x51')](function(_0x2acc1b){logger[_0x8038('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2acc1b);throw _0x2acc1b;});})[_0x8038('0x15')](respondWithResult(_0x42054f,0xc9))[_0x8038('0x51')](handleError(_0x42054f,null));};exports[_0x8038('0x84')]=function(_0x4f1b01,_0x49f87b){var _0x20c19a=_0x4f1b01[_0x8038('0x5e')];var _0x1f3541=[];if(_0x4f1b01[_0x8038('0x2e')][_0x8038('0x2b')]==='agent')throw new Error('Unauthorized');if(_[_0x8038('0x85')](_0x20c19a,[_0x8038('0x2b'),_0x8038('0x2e')])&&_0x4f1b01['user']['role']!==_0x8038('0x2c')){throw new Error(_0x8038('0x7e'));}if(_[_0x8038('0x85')](_0x20c19a,['role',_0x8038('0x2c')])&&_0x4f1b01[_0x8038('0x2e')][_0x8038('0x2b')]!==_0x8038('0x2c')){throw new Error(_0x8038('0x86'));}return licenseUtil[_0x8038('0x80')](_0x20c19a)[_0x8038('0x15')](function(){return validateUser(_0x20c19a[0x0]);})[_0x8038('0x15')](function(){for(var _0x493e1f=0x1;_0x493e1f<_0x20c19a[_0x8038('0x59')];_0x493e1f++){var _0x42ea15=_0x20c19a[_0x493e1f-0x1][_0x8038('0x63')];if(!_0x20c19a[_0x493e1f][_0x8038('0x63')])_0x20c19a[_0x493e1f][_0x8038('0x63')]=_0x42ea15+0x1;_0x1f3541[_0x8038('0x47')](validateUser(_0x20c19a[_0x493e1f]));}return BPromise['all'](_0x1f3541);})[_0x8038('0x15')](function(){_0x1f3541=[];for(var _0x4ec954=0x0;_0x4ec954<_0x20c19a[_0x8038('0x59')];_0x4ec954++){_0x1f3541['push'](updateUser(_0x20c19a[_0x4ec954]));}return BPromise[_0x8038('0x50')](_0x1f3541);})[_0x8038('0x15')](function(){return BPromise['each'](_0x20c19a,function(_0x19bc4d){return db[_0x8038('0x38')][_0x8038('0x7c')](_0x19bc4d,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x8038('0x15')](function(_0x3372cc){_0x19bc4d['id']=_0x3372cc['id'];return _0x19bc4d;});});})['then'](function(_0x59765d){if(_0x4f1b01[_0x8038('0x5e')][_0x8038('0x2b')]==='user')return _0x59765d;if(_0x4f1b01[_0x8038('0x2e')]['role']!==_0x8038('0x2e'))return _0x59765d;var _0x486c77=_['some'](_0x59765d,function(_0x46d5d2){return _0x46d5d2[_0x8038('0x2b')]===_0x8038('0x30')||_0x46d5d2[_0x8038('0x2b')]===_0x8038('0x32');});if(!_0x486c77)return _0x59765d;return db[_0x8038('0x87')][_0x8038('0x48')]({'where':{'name':{'$or':[_0x8038('0x2f'),_0x8038('0x31')]},'userProfileId':_0x4f1b01[_0x8038('0x2e')]['userProfileId']},'raw':!![]})[_0x8038('0x15')](function(_0x4f66d3){if(_[_0x8038('0x88')](_0x4f66d3)||!_['some'](_0x4f66d3,[_0x8038('0x82'),0x0]))return _0x59765d;_0x1f3541=[];var _0x24c1d2=_(_0x4f66d3)[_0x8038('0x34')](function(_0x484fc2){if(_0x484fc2[_0x8038('0x82')]===0x1)return;return _0x484fc2[_0x8038('0x37')]===_0x8038('0x2f')?_0x8038('0x30'):_0x8038('0x32');})[_0x8038('0x89')]()[_0x8038('0x35')]();for(var _0x4b27e0=0x0;_0x4b27e0<_0x59765d[_0x8038('0x59')];_0x4b27e0++){if(!_['includes'](_0x24c1d2,_0x59765d[_0x4b27e0][_0x8038('0x2b')]))return;var _0x461e9a=_0x59765d[_0x4b27e0][_0x8038('0x2b')]===_0x8038('0x30')?_0x8038('0x2f'):'Telephones';_0x1f3541['push'](db[_0x8038('0x83')][_0x8038('0x7c')]({'name':_0x59765d[_0x4b27e0][_0x8038('0x37')],'resourceId':_0x59765d[_0x4b27e0]['id'],'type':_0x461e9a,'sectionId':_[_0x8038('0x5b')](_0x4f66d3,[_0x8038('0x37'),_0x461e9a])['id']},{}));}return BPromise[_0x8038('0x50')](_0x1f3541);});})[_0x8038('0x15')](respondWithResult(_0x49f87b,0xc9))[_0x8038('0x51')](handleError(_0x49f87b,null));};exports[_0x8038('0x8a')]=function(_0x43eaec,_0x5e2d92){if(_0x43eaec[_0x8038('0x5e')]['id']){delete _0x43eaec[_0x8038('0x5e')]['id'];}return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x43eaec[_0x8038('0x52')]['id']}})[_0x8038('0x15')](function(_0x549219){if(!_0x549219)return null;if(_0x549219['id']===_0x43eaec[_0x8038('0x2e')]['id']){if(!_0x43eaec[_0x8038('0x5e')][_0x8038('0x8b')]||!_0x43eaec[_0x8038('0x5e')][_0x8038('0x8c')]){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x8f'));}if(!_0x549219[_0x8038('0x90')](_0x43eaec['body']['oldPassword'])){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x91'));}if(_0x43eaec[_0x8038('0x5e')][_0x8038('0x8b')]===_0x43eaec[_0x8038('0x5e')][_0x8038('0x8c')]){throw new db['Sequelize'][(_0x8038('0x8e'))](_0x8038('0x92'));}}else if(_0x43eaec[_0x8038('0x2e')][_0x8038('0x2b')]===_0x8038('0x2c')){if(!_0x43eaec[_0x8038('0x5e')]['newPassword']){throw new db[(_0x8038('0x8d'))]['ValidationError'](_0x8038('0x93'));}}else if(_0x43eaec[_0x8038('0x2e')][_0x8038('0x2b')]===_0x8038('0x2e')){if(!_0x43eaec[_0x8038('0x5e')][_0x8038('0x8c')]){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x93'));}if(_0x549219[_0x8038('0x2b')]!==_0x8038('0x30')){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))]('Unauthorized');}}else{throw new db['Sequelize']['ValidationError'](_0x8038('0x7d'));}return _0x549219;})[_0x8038('0x15')](handleEntityNotFound(_0x5e2d92,null))[_0x8038('0x15')](function(_0x2f54a6){return db[_0x8038('0x64')][_0x8038('0x94')]({'attributes':['id',_0x8038('0x95'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8038('0x15')](function(_0x122da6){if(_0x122da6['securePassword'])authService[_0x8038('0x65')](_0x43eaec['body'][_0x8038('0x8c')]);if(!_0x122da6['enforcePasswordHistory']||!_0x2f54a6[_0x8038('0x96')])return _0x2f54a6;authService[_0x8038('0x97')](_0x43eaec['body'][_0x8038('0x8c')],_0x2f54a6[_0x8038('0x96')],_0x122da6['passwordHistoryLimit']);return _0x2f54a6;})['then'](saveUpdates({'password':_0x43eaec['body'][_0x8038('0x8c')],'passwordResetAt':_0x43eaec[_0x8038('0x2e')]['id']==_0x43eaec[_0x8038('0x52')]['id']?moment():null,'previousPasswords':authService[_0x8038('0x98')](_0x43eaec['body'][_0x8038('0x8c')],_0x2f54a6['previousPasswords'])},null));})[_0x8038('0x15')](respondWithResult(_0x5e2d92,null))[_0x8038('0x51')](handleError(_0x5e2d92,null));};exports[_0x8038('0x99')]=function(_0x25f89c,_0x1870ee){var _0x505881=_0x25f89c[_0x8038('0x5e')][_0x8038('0x9a')];return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x25f89c[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b'),'online',_0x8038('0x9b'),'voicePause',_0x8038('0x9c')]})[_0x8038('0x15')](handleEntityNotFound(_0x1870ee,null))[_0x8038('0x15')](function(_0x5e20a2){if(_0x5e20a2){if(!utils['isValidChannel'](_0x505881)){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x9d'));}return _0x5e20a2[_0x8038('0x9e')+_[_0x8038('0x9f')](_0x505881[_0x8038('0xa0')]())+_0x8038('0xa1')](_0x25f89c[_0x8038('0x5e')][_0x8038('0x61')],{'penalty':_0x25f89c[_0x8038('0x5e')]['penalty']||0x0})['spread'](function(_0x33b5b3){for(var _0x84a009=0x0;_0x84a009<_0x25f89c[_0x8038('0x5e')][_0x8038('0x61')][_0x8038('0x59')];_0x84a009+=0x1){var _0x2aa74b={'UserId':Number(_0x25f89c['params']['id'])};_0x2aa74b[_['capitalize'](_0x505881[_0x8038('0xa0')]())+_0x8038('0xa2')]=Number(_0x25f89c[_0x8038('0x5e')][_0x8038('0x61')][_0x84a009]);socket[_0x8038('0x28')](_0x8038('0x2e')+_[_0x8038('0x9f')](_0x505881[_0x8038('0xa0')]())+_0x8038('0xa3'),_0x2aa74b);}return _0x33b5b3;})['then'](function(){if(_0x505881===_0x8038('0xa4')){return db[_0x8038('0xa5')][_0x8038('0x48')]({'where':{'id':_0x25f89c[_0x8038('0x5e')]['ids']||[]},'raw':!![],'attributes':['id',_0x8038('0x37')]});}})[_0x8038('0x15')](function(_0x367e9c){var _0x4c4c63=_0x5e20a2[_0x8038('0x2a')]({'plain':!![]});var _0x55f59f=[];if(_0x505881===_0x8038('0xa4')&&_0x4c4c63[_0x8038('0x2b')]===_0x8038('0x30')&&_0x4c4c63[_0x8038('0xa6')]){for(var _0x8722d2=0x0;_0x8722d2<_0x367e9c['length'];_0x8722d2+=0x1){_0x55f59f[_0x8038('0x47')]({'membername':_0x4c4c63['name'],'UserId':_0x4c4c63['id'],'queue_name':_0x367e9c[_0x8722d2][_0x8038('0x37')],'VoiceQueueId':_0x367e9c[_0x8722d2]['id'],'interface':_['isNil'](_0x4c4c63[_0x8038('0x9c')])?util[_0x8038('0xa7')](_0x8038('0xa8'),_0x4c4c63[_0x8038('0x37')]):_0x4c4c63[_0x8038('0x9c')],'paused':_0x4c4c63[_0x8038('0xa9')]||![],'penalty':_0x25f89c[_0x8038('0x5e')]['penalty']||0x0});}return BPromise[_0x8038('0xaa')](_0x55f59f,function(_0x2189ee){return db['UserVoiceQueueRt']['upsert'](_0x2189ee);});}return _0x5e20a2;});}})[_0x8038('0x15')](respondWithStatusCode(_0x1870ee,null))[_0x8038('0x51')](handleError(_0x1870ee,null));};exports[_0x8038('0xab')]=function(_0x5b73f9,_0x24c63a){var _0x31df5c,_0xa4bc85;return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x5b73f9[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b')]})['then'](handleEntityNotFound(_0x24c63a,null))[_0x8038('0x15')](function(_0x5909b1){if(_0x5909b1){_0x31df5c=_0x5909b1;if(!_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]||!utils['isValidChannel'](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')])){throw new db['Sequelize'][(_0x8038('0x8e'))](_0x8038('0x9d'));}return _0x5909b1[_0x8038('0xac')+_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')][_0x8038('0xa0')]())+_0x8038('0xa1')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x61')]);}})['then'](function(_0x44dfac){if(_[_0x8038('0xad')](_0x5b73f9[_0x8038('0x40')]['ids'])){for(var _0x12f82d=0x0;_0x12f82d<_0x5b73f9['query'][_0x8038('0x61')][_0x8038('0x59')];_0x12f82d+=0x1){_0xa4bc85={'UserId':Number(_0x5b73f9['params']['id'])};_0xa4bc85[_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')]['channel']['toLowerCase']())+_0x8038('0xa2')]=Number(_0x5b73f9[_0x8038('0x40')]['ids'][_0x12f82d]);socket[_0x8038('0x28')]('user'+_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]['toLowerCase']())+_0x8038('0xae'),_0xa4bc85);}}else{_0xa4bc85={'UserId':Number(_0x5b73f9[_0x8038('0x52')]['id'])};_0xa4bc85[_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]['toLowerCase']())+_0x8038('0xa2')]=Number(_0x5b73f9['query'][_0x8038('0x61')]);socket[_0x8038('0x28')](_0x8038('0x2e')+_[_0x8038('0x9f')](_0x5b73f9[_0x8038('0x40')]['channel'][_0x8038('0xa0')]())+_0x8038('0xae'),_0xa4bc85);}return _0x44dfac;})[_0x8038('0x15')](function(){if(_0x5b73f9[_0x8038('0x40')][_0x8038('0x9a')]===_0x8038('0xa4')){return db['UserVoiceQueueRt'][_0x8038('0xaf')]({'where':{'UserId':_0x5b73f9[_0x8038('0x52')]['id'],'VoiceQueueId':_0x5b73f9[_0x8038('0x40')]['ids']},'individualHooks':!![]})['then'](function(){return _0x31df5c;});}return _0x31df5c;})[_0x8038('0x15')](respondWithStatusCode(_0x24c63a,null))[_0x8038('0x51')](handleError(_0x24c63a,null));};exports['addAvatar']=function(_0x40c940,_0x3fa3de){_0x40c940[_0x8038('0x5e')][_0x8038('0xb0')]=_0x40c940['file'][_0x8038('0xb1')];return db['User']['find']({'where':{'id':_0x40c940['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x3fa3de,null))['then'](saveUpdates(_0x40c940[_0x8038('0x5e')],null))[_0x8038('0x15')](respondWithResult(_0x3fa3de,null))['catch'](handleError(_0x3fa3de,null));};exports['getAvatar']=function(_0x54449d,_0x371b1d){var _0x5abc43=path[_0x8038('0xb2')](config[_0x8038('0xb3')],_0x8038('0xb4'));return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x54449d['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8038('0x15')](handleEntityNotFound(_0x371b1d,null))[_0x8038('0x15')](function(_0x47b40e){if(_0x47b40e){if(_[_0x8038('0x68')](_0x47b40e[_0x8038('0xb0')])){return _0x371b1d[_0x8038('0xb5')](_0x5abc43);}else{if(!fs['existsSync'](path['join'](config[_0x8038('0xb3')],_0x8038('0xb6'),_0x47b40e['userpic']))){return _0x371b1d[_0x8038('0xb5')](_0x5abc43);}return _0x371b1d[_0x8038('0xb5')](path[_0x8038('0xb2')](config[_0x8038('0xb3')],_0x8038('0xb6'),_0x47b40e[_0x8038('0xb0')]));}}})['catch'](handleError(_0x371b1d,null));};exports[_0x8038('0xb7')]=function(_0x57cb8f,_0x5e3ad5){return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x57cb8f[_0x8038('0x52')]['id']},'attributes':['id']})[_0x8038('0x15')](handleEntityNotFound(_0x5e3ad5,null))['then'](function(_0x587973){var _0xfb43fc=[];values=_0x587973['dataValues'];_0xfb43fc[_0x8038('0x47')](get_open_tabs(_0x8038('0x4a'),_0x587973[_0x8038('0x4b')]));_0xfb43fc[_0x8038('0x47')](get_open_tabs('sms',_0x587973[_0x8038('0x4b')]));_0xfb43fc[_0x8038('0x47')](get_open_tabs('openchannel',_0x587973['dataValues']));_0xfb43fc['push'](get_open_tabs(_0x8038('0x4f'),_0x587973[_0x8038('0x4b')]));_0xfb43fc[_0x8038('0x47')](get_open_tabs(_0x8038('0x4c'),_0x587973[_0x8038('0x4b')]));_0xfb43fc['push'](get_open_tabs(_0x8038('0x4d'),_0x587973['dataValues']));return BPromise['all'](_0xfb43fc);})[_0x8038('0x15')](function(_0x37e267){if(_0x37e267){var _0x1d7269=_['map'](values[_0x8038('0xb8')],function(_0x5f1fe4){return{'channel':_0x8038('0xb9'),'id':_0x5f1fe4['id'],'createdAt':_0x5f1fe4['createdAt']};});var _0x100987=_[_0x8038('0x34')](values[_0x8038('0xba')],function(_0xc184fa){return{'channel':_0x8038('0xbb'),'id':_0xc184fa['id'],'createdAt':_0xc184fa[_0x8038('0xbc')]};});var _0x5acd85=_['map'](values[_0x8038('0xbd')],function(_0xb870ce){return{'channel':_0x8038('0xbe'),'id':_0xb870ce['id'],'createdAt':_0xb870ce[_0x8038('0xbc')]};});var _0x159fc9=_[_0x8038('0x34')](values['MailOpenTabs'],function(_0xad0af3){return{'channel':_0x8038('0xbf'),'id':_0xad0af3['id'],'createdAt':_0xad0af3[_0x8038('0xbc')]};});var _0x521cb8=_[_0x8038('0x34')](values[_0x8038('0xc0')],function(_0x63df1b){return{'channel':_0x8038('0xc1'),'id':_0x63df1b['id'],'createdAt':_0x63df1b[_0x8038('0xbc')]};});var _0x516b09=_[_0x8038('0x34')](values[_0x8038('0xc2')],function(_0x52e631){return{'channel':_0x8038('0xc3'),'id':_0x52e631['id'],'createdAt':_0x52e631[_0x8038('0xbc')]};});var _0x75888e=_[_0x8038('0xc4')](_0x1d7269,_0x100987,_0x5acd85,_0x159fc9,_0x521cb8,_0x516b09);var _0xaf605a={'count':_0x75888e[_0x8038('0x59')],'rows':_0x75888e};return _0xaf605a;}else return null;})[_0x8038('0x15')](respondWithResult(_0x5e3ad5,null))[_0x8038('0x51')](handleError(_0x5e3ad5,null));};exports[_0x8038('0xc5')]=function(_0x2ab24a,_0x45eb3f){var _0x11e982={};var _0x2f1747={};var _0x5a64c6;var _0x197cb7;return db['User'][_0x8038('0x94')]({'where':{'id':_0x2ab24a[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x45eb3f,null))[_0x8038('0x15')](function(_0x371205){if(_0x371205){_0x5a64c6=_0x371205;_0x2f1747['model']=_['keys'](db['CmContact'][_0x8038('0x55')]);_0x2f1747[_0x8038('0x40')]=_[_0x8038('0x54')](_0x2ab24a[_0x8038('0x40')]);_0x2f1747[_0x8038('0x56')]=_['intersection'](_0x2f1747[_0x8038('0x53')],_0x2f1747[_0x8038('0x40')]);_0x11e982[_0x8038('0x46')]=_[_0x8038('0x57')](_0x2f1747[_0x8038('0x53')],qs[_0x8038('0x58')](_0x2ab24a[_0x8038('0x40')][_0x8038('0x58')]));_0x11e982[_0x8038('0x46')]=_0x11e982[_0x8038('0x46')][_0x8038('0x59')]?_0x11e982[_0x8038('0x46')]:_0x2f1747['model'];_0x11e982['order']=qs[_0x8038('0xc6')](_0x2ab24a['query'][_0x8038('0xc6')]);_0x11e982[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x2ab24a[_0x8038('0x40')],_0x2f1747[_0x8038('0x56')]));if(_0x2ab24a['query'][_0x8038('0x3b')]){_0x11e982['where']=_[_0x8038('0xc8')](_0x11e982[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x11e982['attributes'],function(_0x32a5bc){var _0x5d6b7a={};_0x5d6b7a[_0x32a5bc]={'$like':'%'+_0x2ab24a[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x5d6b7a;})});}_0x11e982=_['merge']({},_0x11e982,_0x2ab24a[_0x8038('0x5a')]);return _0x5a64c6['getContacts'](_0x11e982);}})['then'](function(_0x30695a){if(_0x30695a){_0x197cb7=_0x30695a[_0x8038('0x59')];if(_0x2ab24a[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0x41'))){_0x11e982[_0x8038('0x42')]=[{'model':db[_0x8038('0xca')],'as':'List','required':![]},{'model':db[_0x8038('0xcb')],'as':'Tags','attributes':['id',_0x8038('0x37'),'color'],'where':_0x2ab24a[_0x8038('0x40')]['tag']?{'id':_0x2ab24a[_0x8038('0x40')][_0x8038('0xcc')]}:undefined,'required':_0x2ab24a[_0x8038('0x40')][_0x8038('0xcc')]?!![]:![]}];}if(!_0x2ab24a[_0x8038('0x40')]['hasOwnProperty'](_0x8038('0xcd'))){_0x11e982[_0x8038('0xce')]=qs['limit'](_0x2ab24a[_0x8038('0x40')][_0x8038('0xce')]);_0x11e982[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x2ab24a['query'][_0x8038('0x21')]);}return _0x5a64c6[_0x8038('0xc5')](_0x11e982);}})[_0x8038('0x15')](function(_0x16b147){if(_0x16b147){return _0x16b147?{'count':_0x197cb7,'rows':_0x16b147}:null;}})[_0x8038('0x15')](respondWithResult(_0x45eb3f,null))['catch'](handleError(_0x45eb3f,null));};exports[_0x8038('0xcf')]=function(_0x49eb64,_0x538c07){var _0x569ac9;var _0xbd0ca1={};var _0x453f74;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x49eb64[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b')]})[_0x8038('0x15')](handleEntityNotFound(_0x538c07,null))[_0x8038('0x15')](function(_0x1067d4){if(!utils[_0x8038('0xd0')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])){throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0x9d'));}_0x569ac9=_0x1067d4;var _0x4ed741={};_0x4ed741[_0x8038('0x53')]=_[_0x8038('0x54')](db[_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+'Queue'][_0x8038('0x55')]);_0x4ed741[_0x8038('0x40')]=_[_0x8038('0x54')](_0x49eb64['query']);_0x4ed741[_0x8038('0x56')]=_[_0x8038('0x57')](_0x4ed741['model'],_0x4ed741['query']);_0xbd0ca1[_0x8038('0x46')]=_[_0x8038('0x57')](_0x4ed741[_0x8038('0x53')],qs[_0x8038('0x58')](_0x49eb64[_0x8038('0x40')][_0x8038('0x58')]));_0xbd0ca1[_0x8038('0x46')]=_0xbd0ca1[_0x8038('0x46')][_0x8038('0x59')]?_0xbd0ca1[_0x8038('0x46')]:_0x4ed741[_0x8038('0x53')];_0xbd0ca1[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x49eb64[_0x8038('0x40')]['sort']);_0xbd0ca1[_0x8038('0x3f')]=qs['filters'](_[_0x8038('0xc7')](_0x49eb64['query'],_0x4ed741[_0x8038('0x56')]));if(_0x49eb64[_0x8038('0x40')][_0x8038('0x3b')]){_0xbd0ca1[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0xbd0ca1[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0xbd0ca1['attributes'],function(_0x119785){var _0x963ab9={};_0x963ab9[_0x119785]={'$like':'%'+_0x49eb64['query'][_0x8038('0x3b')]+'%'};return _0x963ab9;})});}_0xbd0ca1=_[_0x8038('0xc8')]({},_0xbd0ca1,_0x49eb64[_0x8038('0x5a')]);switch(_0x569ac9[_0x8038('0x2b')]){case _0x8038('0x2c'):return db[_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+_0x8038('0xd2')][_0x8038('0x48')](_0xbd0ca1);case _0x8038('0x2e'):case _0x8038('0x30'):return _0x569ac9[_0x8038('0x2a')+_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+_0x8038('0xa1')](_0xbd0ca1);default:throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0xd3'));}})[_0x8038('0x15')](function(_0x129cfd){_0x453f74=_0x129cfd['length'];if(!_0x49eb64[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0xbd0ca1[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x49eb64['query'][_0x8038('0xce')]);_0xbd0ca1[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x49eb64[_0x8038('0x40')]['offset']);}switch(_0x569ac9[_0x8038('0x2b')]){case'admin':return db[_['capitalize'](_0x49eb64['query']['channel'])+'Queue'][_0x8038('0x48')](_0xbd0ca1);case _0x8038('0x2e'):case _0x8038('0x30'):return _0x569ac9[_0x8038('0x2a')+_[_0x8038('0x9f')](_0x49eb64[_0x8038('0x40')][_0x8038('0x9a')])+_0x8038('0xa1')](_0xbd0ca1);}})[_0x8038('0x15')](function(_0x32221d){return{'count':_0x453f74,'rows':_0x32221d};})[_0x8038('0x15')](respondWithResult(_0x538c07,null))[_0x8038('0x51')](handleError(_0x538c07,null));};exports[_0x8038('0xd4')]=function(_0x5a28d5,_0x20b3fa){var _0x4f9428={};var _0x60065a={};var _0x2c3abc;var _0x5bf168;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x5a28d5['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x20b3fa,null))['then'](function(_0x2fa4e3){if(_0x2fa4e3){_0x2c3abc=_0x2fa4e3;_0x60065a['model']=_[_0x8038('0x54')](db[_0x8038('0xd5')][_0x8038('0x55')]);_0x60065a[_0x8038('0x40')]=_[_0x8038('0x54')](_0x5a28d5[_0x8038('0x40')]);_0x60065a[_0x8038('0x56')]=_[_0x8038('0x57')](_0x60065a[_0x8038('0x53')],_0x60065a['query']);_0x4f9428[_0x8038('0x46')]=_[_0x8038('0x57')](_0x60065a[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5a28d5[_0x8038('0x40')][_0x8038('0x58')]));_0x4f9428['attributes']=_0x4f9428[_0x8038('0x46')]['length']?_0x4f9428[_0x8038('0x46')]:_0x60065a[_0x8038('0x53')];_0x4f9428[_0x8038('0xd1')]=qs['sort'](_0x5a28d5['query'][_0x8038('0xc6')]);_0x4f9428['where']=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x5a28d5[_0x8038('0x40')],_0x60065a[_0x8038('0x56')]));if(_0x5a28d5[_0x8038('0x40')][_0x8038('0x3b')]){_0x4f9428['where']=_[_0x8038('0xc8')](_0x4f9428[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x4f9428['attributes'],function(_0x3d77a9){var _0x3e8321={};_0x3e8321[_0x3d77a9]={'$like':'%'+_0x5a28d5[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x3e8321;})});}_0x4f9428=_[_0x8038('0xc8')]({},_0x4f9428,_0x5a28d5[_0x8038('0x5a')]);return _0x2c3abc[_0x8038('0xd4')](_0x4f9428);}})['then'](function(_0x35be5b){if(_0x35be5b){_0x5bf168=_0x35be5b[_0x8038('0x59')];if(!_0x5a28d5['query'][_0x8038('0xc9')](_0x8038('0xcd'))){_0x4f9428['limit']=qs[_0x8038('0xce')](_0x5a28d5[_0x8038('0x40')][_0x8038('0xce')]);_0x4f9428[_0x8038('0x21')]=qs['offset'](_0x5a28d5[_0x8038('0x40')][_0x8038('0x21')]);}return _0x2c3abc[_0x8038('0xd4')](_0x4f9428);}})[_0x8038('0x15')](function(_0x509a23){if(_0x509a23){return _0x509a23?{'count':_0x5bf168,'rows':_0x509a23}:null;}})[_0x8038('0x15')](respondWithResult(_0x20b3fa,null))[_0x8038('0x51')](handleError(_0x20b3fa,null));};exports['getGroups']=function(_0x5af39c,_0x20f054){var _0x25bca2={};var _0x21fa79={};var _0x5c5953;var _0x426e8d;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x5af39c['params']['id']}})['then'](handleEntityNotFound(_0x20f054,null))[_0x8038('0x15')](function(_0x27ecf5){if(_0x27ecf5){_0x5c5953=_0x27ecf5;_0x21fa79[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xd6')][_0x8038('0x55')]);_0x21fa79['query']=_['keys'](_0x5af39c[_0x8038('0x40')]);_0x21fa79[_0x8038('0x56')]=_['intersection'](_0x21fa79[_0x8038('0x53')],_0x21fa79[_0x8038('0x40')]);_0x25bca2[_0x8038('0x46')]=_[_0x8038('0x57')](_0x21fa79[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5af39c[_0x8038('0x40')][_0x8038('0x58')]));_0x25bca2[_0x8038('0x46')]=_0x25bca2['attributes']['length']?_0x25bca2[_0x8038('0x46')]:_0x21fa79[_0x8038('0x53')];_0x25bca2[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x5af39c[_0x8038('0x40')][_0x8038('0xc6')]);_0x25bca2[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x5af39c[_0x8038('0x40')],_0x21fa79[_0x8038('0x56')]));if(_0x5af39c[_0x8038('0x40')]['filter']){_0x25bca2[_0x8038('0x3f')]=_['merge'](_0x25bca2[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x25bca2[_0x8038('0x46')],function(_0x195338){var _0x153041={};_0x153041[_0x195338]={'$like':'%'+_0x5af39c[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x153041;})});}_0x25bca2=_[_0x8038('0xc8')]({},_0x25bca2,_0x5af39c[_0x8038('0x5a')]);return _0x5c5953['getGroups'](_0x25bca2);}})['then'](function(_0x3a73d9){if(_0x3a73d9){_0x426e8d=_0x3a73d9[_0x8038('0x59')];if(!_0x5af39c['query'][_0x8038('0xc9')](_0x8038('0xcd'))){_0x25bca2[_0x8038('0xce')]=qs['limit'](_0x5af39c['query'][_0x8038('0xce')]);_0x25bca2[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x5af39c[_0x8038('0x40')][_0x8038('0x21')]);}return _0x5c5953['getGroups'](_0x25bca2);}})[_0x8038('0x15')](function(_0x18ae5e){if(_0x18ae5e){return _0x18ae5e?{'count':_0x426e8d,'rows':_0x18ae5e}:null;}})[_0x8038('0x15')](respondWithResult(_0x20f054,null))['catch'](handleError(_0x20f054,null));};exports[_0x8038('0xd7')]=function(_0x4c49bf,_0xb50ebf){var _0x1132a2={'raw':!![],'where':{}};var _0x685354={};var _0x357b79={'count':0x0,'rows':[]};return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x4c49bf[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0xb50ebf,null))[_0x8038('0x15')](function(_0x50f328){if(_0x50f328){_0x685354[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xd8')]['rawAttributes']);_0x685354[_0x8038('0x40')]=_[_0x8038('0x54')](_0x4c49bf['query']);_0x685354[_0x8038('0x56')]=_[_0x8038('0x57')](_0x685354['model'],_0x685354['query']);_0x1132a2[_0x8038('0x46')]=_[_0x8038('0x57')](_0x685354[_0x8038('0x53')],qs['fields'](_0x4c49bf[_0x8038('0x40')][_0x8038('0x58')]));_0x1132a2[_0x8038('0x46')]=_0x1132a2['attributes'][_0x8038('0x59')]?_0x1132a2[_0x8038('0x46')]:_0x685354[_0x8038('0x53')];if(!_0x4c49bf['query'][_0x8038('0xc9')](_0x8038('0xcd'))){_0x1132a2[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x4c49bf['query'][_0x8038('0xce')]);_0x1132a2['offset']=qs['offset'](_0x4c49bf['query']['offset']);}_0x1132a2[_0x8038('0xd1')]=qs['sort'](_0x4c49bf[_0x8038('0x40')][_0x8038('0xc6')]);_0x1132a2[_0x8038('0x3f')]=qs['filters'](_['pick'](_0x4c49bf[_0x8038('0x40')],_0x685354[_0x8038('0x56')]));_0x1132a2['where'][_0x8038('0xd9')]=_0x50f328['id'];if(_0x4c49bf['query'][_0x8038('0x3b')]){_0x1132a2[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x1132a2[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x1132a2[_0x8038('0x46')],function(_0x146105){var _0x367ee2={};_0x367ee2[_0x146105]={'$like':'%'+_0x4c49bf[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x367ee2;})});}_0x1132a2=_[_0x8038('0xc8')]({},_0x1132a2,_0x4c49bf[_0x8038('0x5a')]);return db['VoiceRecording'][_0x8038('0x23')]({'where':_0x1132a2[_0x8038('0x3f')]})[_0x8038('0x15')](function(_0x3ecd05){_0x357b79[_0x8038('0x23')]=_0x3ecd05;if(_0x4c49bf[_0x8038('0x40')]['includeAll']){_0x1132a2[_0x8038('0x42')]=[{'all':!![]}];}return db[_0x8038('0xd8')][_0x8038('0x48')](_0x1132a2);})['then'](function(_0x32772c){_0x357b79['rows']=_0x32772c;return _0x357b79;});}})[_0x8038('0x15')](respondWithFilteredResult(_0xb50ebf,_0x1132a2))[_0x8038('0x51')](handleError(_0xb50ebf,null));};exports['getScreenRecordings']=function(_0xf1f60a,_0x4ead3a){var _0xd193ca={'raw':!![],'where':{}};var _0x932954={};var _0x38b18e={'count':0x0,'rows':[]};return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0xf1f60a[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x4ead3a,null))[_0x8038('0x15')](function(_0x3f0204){if(_0x3f0204){_0x932954[_0x8038('0x53')]=_['keys'](db[_0x8038('0xda')][_0x8038('0x55')]);_0x932954[_0x8038('0x40')]=_[_0x8038('0x54')](_0xf1f60a[_0x8038('0x40')]);_0x932954[_0x8038('0x56')]=_[_0x8038('0x57')](_0x932954[_0x8038('0x53')],_0x932954[_0x8038('0x40')]);_0xd193ca['attributes']=_[_0x8038('0x57')](_0x932954[_0x8038('0x53')],qs['fields'](_0xf1f60a[_0x8038('0x40')][_0x8038('0x58')]));_0xd193ca['attributes']=_0xd193ca[_0x8038('0x46')][_0x8038('0x59')]?_0xd193ca[_0x8038('0x46')]:_0x932954[_0x8038('0x53')];if(!_0xf1f60a[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0xd193ca[_0x8038('0xce')]=qs[_0x8038('0xce')](_0xf1f60a[_0x8038('0x40')][_0x8038('0xce')]);_0xd193ca[_0x8038('0x21')]=qs[_0x8038('0x21')](_0xf1f60a[_0x8038('0x40')][_0x8038('0x21')]);}_0xd193ca[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0xf1f60a['query']['sort']);_0xd193ca[_0x8038('0x3f')]=qs['filters'](_['pick'](_0xf1f60a['query'],_0x932954['filters']));_0xd193ca[_0x8038('0x3f')][_0x8038('0xd9')]=_0x3f0204['id'];if(_0xf1f60a[_0x8038('0x40')][_0x8038('0x3b')]){_0xd193ca['where']=_[_0x8038('0xc8')](_0xd193ca['where'],{'$or':_[_0x8038('0x34')](_0xd193ca[_0x8038('0x46')],function(_0x3fc539){var _0x48ee04={};_0x48ee04[_0x3fc539]={'$like':'%'+_0xf1f60a['query'][_0x8038('0x3b')]+'%'};return _0x48ee04;})});}_0xd193ca=_[_0x8038('0xc8')]({},_0xd193ca,_0xf1f60a[_0x8038('0x5a')]);return db[_0x8038('0xda')][_0x8038('0x23')]({'where':_0xd193ca['where']})[_0x8038('0x15')](function(_0x2e3a82){_0x38b18e['count']=_0x2e3a82;if(_0xf1f60a[_0x8038('0x40')][_0x8038('0x41')]){_0xd193ca['include']=[{'all':!![]}];}return db[_0x8038('0xda')]['findAll'](_0xd193ca);})[_0x8038('0x15')](function(_0x2c3801){_0x38b18e[_0x8038('0x49')]=_0x2c3801;return _0x38b18e;});}})[_0x8038('0x15')](respondWithFilteredResult(_0x4ead3a,_0xd193ca))[_0x8038('0x51')](handleError(_0x4ead3a,null));};exports['getChatInteractions']=function(_0x41a415,_0x3ac2bc){var _0x39d65b={};var _0x16548d={};var _0x52d0e6;var _0x151a9c;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x41a415[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x3ac2bc,null))['then'](function(_0x5894c3){if(_0x5894c3){_0x52d0e6=_0x5894c3;_0x16548d[_0x8038('0x53')]=_['keys'](db[_0x8038('0xdb')][_0x8038('0x55')]);_0x16548d['query']=_['keys'](_0x41a415['query']);_0x16548d['filters']=_['intersection'](_0x16548d[_0x8038('0x53')],_0x16548d[_0x8038('0x40')]);_0x39d65b[_0x8038('0x46')]=_[_0x8038('0x57')](_0x16548d[_0x8038('0x53')],qs[_0x8038('0x58')](_0x41a415['query']['fields']));_0x39d65b[_0x8038('0x46')]=_0x39d65b[_0x8038('0x46')][_0x8038('0x59')]?_0x39d65b[_0x8038('0x46')]:_0x16548d[_0x8038('0x53')];_0x39d65b[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x41a415[_0x8038('0x40')][_0x8038('0xc6')]);_0x39d65b[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x41a415[_0x8038('0x40')],_0x16548d[_0x8038('0x56')]));if(_0x41a415[_0x8038('0x40')][_0x8038('0x3b')]){_0x39d65b['where']=_[_0x8038('0xc8')](_0x39d65b['where'],{'$or':_[_0x8038('0x34')](_0x39d65b[_0x8038('0x46')],function(_0x19d19b){var _0x2fb172={};_0x2fb172[_0x19d19b]={'$like':'%'+_0x41a415[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x2fb172;})});}_0x39d65b=_['merge']({},_0x39d65b,_0x41a415['options']);return _0x52d0e6['getChatInteractions'](_0x39d65b);}})[_0x8038('0x15')](function(_0x2b1212){if(_0x2b1212){_0x151a9c=_0x2b1212[_0x8038('0x59')];if(!_0x41a415[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x39d65b[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x41a415[_0x8038('0x40')]['limit']);_0x39d65b['offset']=qs[_0x8038('0x21')](_0x41a415['query'][_0x8038('0x21')]);}return _0x52d0e6['getChatInteractions'](_0x39d65b);}})[_0x8038('0x15')](function(_0x1e3650){if(_0x1e3650){return _0x1e3650?{'count':_0x151a9c,'rows':_0x1e3650}:null;}})[_0x8038('0x15')](respondWithResult(_0x3ac2bc,null))[_0x8038('0x51')](handleError(_0x3ac2bc,null));};exports['getOpenchannelInteractions']=function(_0x280740,_0x310154){var _0x387766={};var _0x11715c={};var _0x3befb7;var _0x1c5314;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x280740['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x310154,null))[_0x8038('0x15')](function(_0x2235ad){if(_0x2235ad){_0x3befb7=_0x2235ad;_0x11715c[_0x8038('0x53')]=_[_0x8038('0x54')](db['OpenchannelInteraction'][_0x8038('0x55')]);_0x11715c[_0x8038('0x40')]=_[_0x8038('0x54')](_0x280740[_0x8038('0x40')]);_0x11715c[_0x8038('0x56')]=_[_0x8038('0x57')](_0x11715c[_0x8038('0x53')],_0x11715c[_0x8038('0x40')]);_0x387766['attributes']=_[_0x8038('0x57')](_0x11715c[_0x8038('0x53')],qs[_0x8038('0x58')](_0x280740[_0x8038('0x40')]['fields']));_0x387766[_0x8038('0x46')]=_0x387766[_0x8038('0x46')][_0x8038('0x59')]?_0x387766[_0x8038('0x46')]:_0x11715c[_0x8038('0x53')];_0x387766[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x280740['query'][_0x8038('0xc6')]);_0x387766[_0x8038('0x3f')]=qs['filters'](_['pick'](_0x280740[_0x8038('0x40')],_0x11715c[_0x8038('0x56')]));if(_0x280740[_0x8038('0x40')]['filter']){_0x387766[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x387766['where'],{'$or':_[_0x8038('0x34')](_0x387766['attributes'],function(_0x21662d){var _0x5a14ae={};_0x5a14ae[_0x21662d]={'$like':'%'+_0x280740[_0x8038('0x40')]['filter']+'%'};return _0x5a14ae;})});}_0x387766=_[_0x8038('0xc8')]({},_0x387766,_0x280740['options']);return _0x3befb7['getOpenchannelInteractions'](_0x387766);}})[_0x8038('0x15')](function(_0x1d527a){if(_0x1d527a){_0x1c5314=_0x1d527a[_0x8038('0x59')];if(!_0x280740[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x387766[_0x8038('0xce')]=qs['limit'](_0x280740[_0x8038('0x40')]['limit']);_0x387766['offset']=qs[_0x8038('0x21')](_0x280740[_0x8038('0x40')]['offset']);}return _0x3befb7[_0x8038('0xdc')](_0x387766);}})[_0x8038('0x15')](function(_0x3e67f0){if(_0x3e67f0){return _0x3e67f0?{'count':_0x1c5314,'rows':_0x3e67f0}:null;}})['then'](respondWithResult(_0x310154,null))[_0x8038('0x51')](handleError(_0x310154,null));};exports[_0x8038('0xdd')]=function(_0x5baf03,_0x53fb8e){var _0x2678eb={'raw':!![],'where':{}};var _0x4448c5={};var _0x5c02f5={'count':0x0,'rows':[]};return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x5baf03[_0x8038('0x52')]['id']}})['then'](handleEntityNotFound(_0x53fb8e,null))['then'](function(_0x1d522f){if(_0x1d522f){_0x4448c5[_0x8038('0x53')]=_['keys'](db[_0x8038('0xde')]['rawAttributes']);_0x4448c5[_0x8038('0x40')]=_['keys'](_0x5baf03[_0x8038('0x40')]);_0x4448c5[_0x8038('0x56')]=_[_0x8038('0x57')](_0x4448c5['model'],_0x4448c5['query']);_0x2678eb[_0x8038('0x46')]=_[_0x8038('0x57')](_0x4448c5[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5baf03[_0x8038('0x40')]['fields']));_0x2678eb['attributes']=_0x2678eb['attributes']['length']?_0x2678eb[_0x8038('0x46')]:_0x4448c5[_0x8038('0x53')];if(!_0x5baf03[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x2678eb[_0x8038('0xce')]=qs['limit'](_0x5baf03['query'][_0x8038('0xce')]);_0x2678eb[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x5baf03[_0x8038('0x40')]['offset']);}_0x2678eb[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x5baf03[_0x8038('0x40')][_0x8038('0xc6')]);_0x2678eb[_0x8038('0x3f')]=qs[_0x8038('0x56')](_['pick'](_0x5baf03[_0x8038('0x40')],_0x4448c5[_0x8038('0x56')]));_0x2678eb['where']['UserId']=_0x1d522f['id'];if(_0x5baf03[_0x8038('0x40')][_0x8038('0x3b')]){_0x2678eb[_0x8038('0x3f')]=_['merge'](_0x2678eb['where'],{'$or':_[_0x8038('0x34')](_0x2678eb[_0x8038('0x46')],function(_0xe16d6d){var _0x1b039e={};_0x1b039e[_0xe16d6d]={'$like':'%'+_0x5baf03['query'][_0x8038('0x3b')]+'%'};return _0x1b039e;})});}_0x2678eb=_[_0x8038('0xc8')]({},_0x2678eb,_0x5baf03[_0x8038('0x5a')]);return db[_0x8038('0xde')][_0x8038('0x23')]({'where':_0x2678eb[_0x8038('0x3f')]})[_0x8038('0x15')](function(_0x1277fa){_0x5c02f5['count']=_0x1277fa;if(_0x5baf03[_0x8038('0x40')][_0x8038('0x41')]){_0x2678eb['include']=[{'all':!![]}];}return db[_0x8038('0xde')][_0x8038('0x48')](_0x2678eb);})[_0x8038('0x15')](function(_0x7bcc95){_0x5c02f5[_0x8038('0x49')]=_0x7bcc95;return _0x5c02f5;});}})[_0x8038('0x15')](respondWithFilteredResult(_0x53fb8e,_0x2678eb))[_0x8038('0x51')](handleError(_0x53fb8e,null));};exports[_0x8038('0xdf')]=function(_0x5496b6,_0x3e03bb){var _0x34ba80={};var _0xdf243d={};var _0x1f248;var _0x3412b8;return db['User'][_0x8038('0x94')]({'where':{'id':_0x5496b6[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x3e03bb,null))[_0x8038('0x15')](function(_0x399cae){if(_0x399cae){_0x1f248=_0x399cae;_0xdf243d[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xe0')]['rawAttributes']);_0xdf243d[_0x8038('0x40')]=_[_0x8038('0x54')](_0x5496b6[_0x8038('0x40')]);_0xdf243d[_0x8038('0x56')]=_[_0x8038('0x57')](_0xdf243d['model'],_0xdf243d[_0x8038('0x40')]);_0x34ba80[_0x8038('0x46')]=_[_0x8038('0x57')](_0xdf243d[_0x8038('0x53')],qs[_0x8038('0x58')](_0x5496b6[_0x8038('0x40')][_0x8038('0x58')]));_0x34ba80['attributes']=_0x34ba80[_0x8038('0x46')]['length']?_0x34ba80['attributes']:_0xdf243d[_0x8038('0x53')];_0x34ba80[_0x8038('0xd1')]=qs['sort'](_0x5496b6['query'][_0x8038('0xc6')]);_0x34ba80['where']=qs[_0x8038('0x56')](_['pick'](_0x5496b6['query'],_0xdf243d['filters']));if(_0x5496b6[_0x8038('0x40')][_0x8038('0x3b')]){_0x34ba80[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x34ba80['where'],{'$or':_[_0x8038('0x34')](_0x34ba80[_0x8038('0x46')],function(_0x5c8ada){var _0x5edafb={};_0x5edafb[_0x5c8ada]={'$like':'%'+_0x5496b6[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x5edafb;})});}_0x34ba80=_['merge']({},_0x34ba80,_0x5496b6['options']);return _0x1f248['getSmsInteractions'](_0x34ba80);}})[_0x8038('0x15')](function(_0x368f33){if(_0x368f33){_0x3412b8=_0x368f33[_0x8038('0x59')];if(!_0x5496b6[_0x8038('0x40')]['hasOwnProperty'](_0x8038('0xcd'))){_0x34ba80[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x5496b6[_0x8038('0x40')][_0x8038('0xce')]);_0x34ba80[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x5496b6['query']['offset']);}return _0x1f248[_0x8038('0xdf')](_0x34ba80);}})[_0x8038('0x15')](function(_0x12b440){if(_0x12b440){return _0x12b440?{'count':_0x3412b8,'rows':_0x12b440}:null;}})['then'](respondWithResult(_0x3e03bb,null))[_0x8038('0x51')](handleError(_0x3e03bb,null));};exports[_0x8038('0xe1')]=function(_0x31d1b9,_0x538a12){var _0x1b6ad3={};var _0x186e89={};var _0x40b001;var _0x2f937f;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x31d1b9[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x538a12,null))[_0x8038('0x15')](function(_0x273890){if(_0x273890){_0x40b001=_0x273890;_0x186e89[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xe2')][_0x8038('0x55')]);_0x186e89[_0x8038('0x40')]=_[_0x8038('0x54')](_0x31d1b9[_0x8038('0x40')]);_0x186e89[_0x8038('0x56')]=_[_0x8038('0x57')](_0x186e89[_0x8038('0x53')],_0x186e89[_0x8038('0x40')]);_0x1b6ad3[_0x8038('0x46')]=_['intersection'](_0x186e89[_0x8038('0x53')],qs[_0x8038('0x58')](_0x31d1b9[_0x8038('0x40')][_0x8038('0x58')]));_0x1b6ad3[_0x8038('0x46')]=_0x1b6ad3[_0x8038('0x46')][_0x8038('0x59')]?_0x1b6ad3[_0x8038('0x46')]:_0x186e89[_0x8038('0x53')];_0x1b6ad3[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x31d1b9['query'][_0x8038('0xc6')]);_0x1b6ad3[_0x8038('0x3f')]=qs['filters'](_['pick'](_0x31d1b9[_0x8038('0x40')],_0x186e89[_0x8038('0x56')]));if(_0x31d1b9['query'][_0x8038('0x3b')]){_0x1b6ad3[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x1b6ad3[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x1b6ad3[_0x8038('0x46')],function(_0x4eee8f){var _0x146d3c={};_0x146d3c[_0x4eee8f]={'$like':'%'+_0x31d1b9['query'][_0x8038('0x3b')]+'%'};return _0x146d3c;})});}_0x1b6ad3=_[_0x8038('0xc8')]({},_0x1b6ad3,_0x31d1b9[_0x8038('0x5a')]);return _0x40b001['getFaxInteractions'](_0x1b6ad3);}})[_0x8038('0x15')](function(_0x451bec){if(_0x451bec){_0x2f937f=_0x451bec['length'];if(!_0x31d1b9[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x1b6ad3[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x31d1b9['query'][_0x8038('0xce')]);_0x1b6ad3['offset']=qs[_0x8038('0x21')](_0x31d1b9[_0x8038('0x40')]['offset']);}return _0x40b001[_0x8038('0xe1')](_0x1b6ad3);}})[_0x8038('0x15')](function(_0x3948a8){if(_0x3948a8){return _0x3948a8?{'count':_0x2f937f,'rows':_0x3948a8}:null;}})[_0x8038('0x15')](respondWithResult(_0x538a12,null))[_0x8038('0x51')](handleError(_0x538a12,null));};exports['getWhatsappInteractions']=function(_0x3934f6,_0x593a89){var _0x2411bf={};var _0x386ed3={};var _0x5ac9b7;var _0x4228a9;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x3934f6[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x593a89,null))[_0x8038('0x15')](function(_0x4d3f41){if(_0x4d3f41){_0x5ac9b7=_0x4d3f41;_0x386ed3[_0x8038('0x53')]=_[_0x8038('0x54')](db[_0x8038('0xe3')]['rawAttributes']);_0x386ed3[_0x8038('0x40')]=_[_0x8038('0x54')](_0x3934f6[_0x8038('0x40')]);_0x386ed3[_0x8038('0x56')]=_[_0x8038('0x57')](_0x386ed3['model'],_0x386ed3['query']);_0x2411bf[_0x8038('0x46')]=_[_0x8038('0x57')](_0x386ed3['model'],qs['fields'](_0x3934f6[_0x8038('0x40')]['fields']));_0x2411bf[_0x8038('0x46')]=_0x2411bf['attributes'][_0x8038('0x59')]?_0x2411bf[_0x8038('0x46')]:_0x386ed3['model'];_0x2411bf['order']=qs['sort'](_0x3934f6[_0x8038('0x40')][_0x8038('0xc6')]);_0x2411bf[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x3934f6[_0x8038('0x40')],_0x386ed3['filters']));if(_0x3934f6[_0x8038('0x40')][_0x8038('0x3b')]){_0x2411bf[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x2411bf['where'],{'$or':_[_0x8038('0x34')](_0x2411bf[_0x8038('0x46')],function(_0x146427){var _0x491acc={};_0x491acc[_0x146427]={'$like':'%'+_0x3934f6[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x491acc;})});}_0x2411bf=_[_0x8038('0xc8')]({},_0x2411bf,_0x3934f6[_0x8038('0x5a')]);return _0x5ac9b7[_0x8038('0xe4')](_0x2411bf);}})[_0x8038('0x15')](function(_0x48f973){if(_0x48f973){_0x4228a9=_0x48f973[_0x8038('0x59')];if(!_0x3934f6[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x2411bf[_0x8038('0xce')]=qs['limit'](_0x3934f6['query'][_0x8038('0xce')]);_0x2411bf[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x3934f6['query'][_0x8038('0x21')]);}return _0x5ac9b7[_0x8038('0xe4')](_0x2411bf);}})[_0x8038('0x15')](function(_0x2c8be3){if(_0x2c8be3){return _0x2c8be3?{'count':_0x4228a9,'rows':_0x2c8be3}:null;}})[_0x8038('0x15')](respondWithResult(_0x593a89,null))['catch'](handleError(_0x593a89,null));};exports[_0x8038('0xe5')]=function(_0x374c2d,_0x42d5d6,_0x171baf){var _0xd57f87;var _0x5e407c;var _0x151021;var _0x517147=!_[_0x8038('0x68')](_0x374c2d['params']['id'])?_0x374c2d[_0x8038('0x52')]['id']:!_['isNil'](_0x374c2d[_0x8038('0x2e')]['id'])?_0x374c2d[_0x8038('0x2e')]['id']:null;return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x517147,'role':{'$or':[_0x8038('0x2c'),'user',_0x8038('0x30')]}},'attributes':['id','name',_0x8038('0xe6'),_0x8038('0xe7'),_0x8038('0x2b'),_0x8038('0x63'),_0x8038('0x9b')]})[_0x8038('0x15')](function(_0x5e4bd7){if(_0x5e4bd7){if(_0x5e4bd7['role']==='agent'){_0xd57f87=_0x5e4bd7;if(_0x374c2d[_0x8038('0x5e')][_0x8038('0x9c')]){_0x151021=util[_0x8038('0xa7')](_0x8038('0xe8'),_0xd57f87[_0x374c2d['body']['interface']]);}else if(_0x374c2d[_0x8038('0x5e')][_0x8038('0xe9')]){_0x151021=util[_0x8038('0xa7')](_0x8038('0xa8'),_0x374c2d[_0x8038('0x5e')][_0x8038('0xe9')]);}else{_0x151021=util[_0x8038('0xa7')](_0x8038('0xa8'),_0xd57f87[_0x8038('0x37')]);}socket['to'](util[_0x8038('0xa7')](_0x8038('0xea'),_0xd57f87[_0x8038('0x37')]))[_0x8038('0x28')](_0x8038('0xeb'),{'user':{'id':_0xd57f87['id'],'name':_0xd57f87[_0x8038('0x37')]},'ip':_0x374c2d[_0x8038('0xec')][_0x8038('0xed')]||_0x374c2d[_0x8038('0xee')]['remoteAddress']||_0x374c2d[_0x8038('0xef')][_0x8038('0xf0')]||_0x374c2d[_0x8038('0xee')]['socket'][_0x8038('0xf0')]});return db[_0x8038('0xd5')]['destroy']({'where':{'membername':_0xd57f87[_0x8038('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x8038('0x8d'))][(_0x8038('0x8e'))](_0x8038('0xf1'));}})[_0x8038('0x15')](function(){if(_0xd57f87){return _0xd57f87[_0x8038('0xf2')]({'raw':!![]});}})['then'](function(_0x56ace5){if(_0xd57f87){var _0x147a6e=[];if(_0x56ace5){_0x5e407c=_0x56ace5;if(_0x5e407c[_0x8038('0x59')]){for(var _0x142f09=0x0;_0x142f09<_0x5e407c[_0x8038('0x59')];_0x142f09++){_0x147a6e[_0x8038('0x47')]({'membername':_0xd57f87[_0x8038('0x37')],'UserId':_0xd57f87['id'],'queue_name':_0x5e407c[_0x142f09][_0x8038('0x37')],'VoiceQueueId':_0x5e407c[_0x142f09]['id'],'interface':_0x151021,'paused':_0xd57f87['loginInPause']||![],'penalty':_0x5e407c[_0x142f09][_0x8038('0xf3')]||0x0});}return BPromise['each'](_0x147a6e,function(_0x5b52e8){return db[_0x8038('0xd5')]['upsert'](_0x5b52e8);});}}}})[_0x8038('0x15')](function(){if(_0xd57f87){return db[_0x8038('0xf4')][_0x8038('0x48')]({'where':{'membername':_0xd57f87[_0x8038('0x37')],'exitAt':null}});}})[_0x8038('0x15')](function(_0x57b6b2){if(_0xd57f87){var _0x72746d=[];_0x57b6b2[_0x8038('0xf5')](function(_0x2ace67){_0x72746d[_0x8038('0x47')](_0x2ace67[_0x8038('0x27')]({'exitAt':moment()['format'](_0x8038('0xf6'))}));});return BPromise[_0x8038('0x50')](_0x72746d);}})['then'](function(){if(_0xd57f87){var _0x24c4c4=[];var _0xb2eba0=[];var _0x1bc17d=utils[_0x8038('0xf7')]();var _0x119b13={'membername':_0xd57f87[_0x8038('0x37')],'interface':_0x151021,'enterAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'role':_0xd57f87[_0x8038('0x2b')],'internal':_0xd57f87[_0x8038('0x63')]};_0x1bc17d[_0x8038('0xf5')](function(_0x1294ec){_0x24c4c4[_0x8038('0x47')](_[_0x8038('0xc8')]({'channel':_0x1294ec,'type':'LOGIN','data1':_0x374c2d[_0x8038('0x5e')][_0x8038('0xf8')],'data2':_0x151021},_0x119b13));if(_0xd57f87[_0x8038('0x9b')]){_0xb2eba0[_0x8038('0x47')](_[_0x8038('0xc8')]({'channel':_0x1294ec,'type':'PAUSE','data1':'LOGININPAUSE'},_0x119b13));}});return db[_0x8038('0xf4')][_0x8038('0x84')](_0x24c4c4[_0x8038('0xc4')](_0xb2eba0),{'individualHooks':!![]});}})[_0x8038('0x15')](function(){if(_0xd57f87){return _0xd57f87[_0x8038('0x27')]({'online':!![],'lastLoginAt':moment()[_0x8038('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xd57f87[_0x8038('0x9b')]||![],'mailPause':_0xd57f87[_0x8038('0x9b')]||![],'chatPause':_0xd57f87['loginInPause']||![],'faxPause':_0xd57f87[_0x8038('0x9b')]||![],'smsPause':_0xd57f87[_0x8038('0x9b')]||![],'openchannelPause':_0xd57f87[_0x8038('0x9b')]||![],'whatsappPause':_0xd57f87[_0x8038('0x9b')]||![],'pauseType':_0xd57f87['loginInPause']?_0x8038('0xf9'):null,'interface':_0x151021,'lastPauseAt':moment()[_0x8038('0xa7')](_0x8038('0xf6'))});}})[_0x8038('0x15')](function(_0x29c414){if(_0x374c2d[_0x8038('0xfa')]){return _0x171baf();}else{return BPromise[_0x8038('0xfb')](_0x29c414)[_0x8038('0x15')](respondWithResult(_0x42d5d6,null));}})[_0x8038('0x51')](handleError(_0x42d5d6,null));};exports['logout']=function(_0x218db5,_0x89848f){var _0x3d0f31;return db['User']['find']({'where':{'id':_0x218db5[_0x8038('0x52')]['id'],'role':_0x8038('0x30')},'attributes':['id','name',_0x8038('0x2b')]})[_0x8038('0x15')](handleEntityNotFound(_0x89848f,null))[_0x8038('0x15')](function(_0x3b7a60){if(_0x3b7a60){_0x3d0f31=_0x3b7a60;return db[_0x8038('0xd5')][_0x8038('0xaf')]({'where':{'membername':_0x3d0f31['name']},'individualHooks':!![]});}})[_0x8038('0x15')](function(){return db[_0x8038('0xf4')][_0x8038('0x48')]({'where':{'membername':_0x3d0f31['name'],'exitAt':null}});})[_0x8038('0x15')](function(_0x105646){var _0x2118c4=[];_0x105646[_0x8038('0xf5')](function(_0x7042a1){_0x2118c4[_0x8038('0x47')](_0x7042a1[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6'))}));});return BPromise[_0x8038('0x50')](_0x2118c4);})[_0x8038('0x15')](function(){return _0x3d0f31[_0x8038('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x89848f,null))[_0x8038('0x51')](handleError(_0x89848f,null));};exports[_0x8038('0xfc')]=function(_0x241e6f,_0x42d69f){var _0x23196a;return db['UserVoiceQueueRt'][_0x8038('0x27')]({'paused':0x1},{'where':{'UserId':_0x241e6f[_0x8038('0x52')]['id']},'individualHooks':!![]})[_0x8038('0x15')](function(){return db[_0x8038('0x38')][_0x8038('0x5b')]({'where':{'id':_0x241e6f[_0x8038('0x52')]['id'],'role':_0x8038('0x30')},'attributes':['id',_0x8038('0x37'),'role','internal',_0x8038('0x9c')]});})[_0x8038('0x15')](handleEntityNotFound(_0x42d69f,null))['then'](function(_0x2faaa2){if(_0x2faaa2){_0x23196a=_0x2faaa2;return respondWithRpcPromise(_0x8038('0xfd'),_0x8038('0xfc'),{'id':_0x23196a['id'],'name':_0x23196a[_0x8038('0x37')],'pause':!![]});}})[_0x8038('0x15')](function(){if(_0x23196a){return db[_0x8038('0xf4')]['findAll']({'where':{'membername':_0x23196a[_0x8038('0x37')],'type':_0x8038('0xfe'),'exitAt':null}});}})[_0x8038('0x15')](function(_0x44c637){if(_0x44c637[_0x8038('0x59')]){var _0x4bb5ea=moment()[_0x8038('0xa7')](_0x8038('0xf6'));for(var _0x118983=0x0,_0x5dc9b6=_0x44c637[_0x8038('0x59')];_0x118983<_0x5dc9b6;_0x118983++){_0x44c637[_0x118983][_0x8038('0xff')]({'exitAt':_0x4bb5ea});}}})[_0x8038('0x15')](function(){var _0x5b70d8=[];var _0x49f553=utils[_0x8038('0xf7')]();_0x49f553[_0x8038('0xf5')](function(_0x3e4216){_0x5b70d8[_0x8038('0x47')]({'channel':_0x3e4216,'membername':_0x23196a[_0x8038('0x37')],'interface':_['isNil'](_0x23196a[_0x8038('0x9c')])?util[_0x8038('0xa7')](_0x8038('0xa8'),_0x23196a[_0x8038('0x37')]):_0x23196a[_0x8038('0x9c')],'type':_0x8038('0xfe'),'enterAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data1':_0x241e6f[_0x8038('0x5e')]['type']||_0x8038('0x100'),'role':_0x23196a[_0x8038('0x2b')],'internal':_0x23196a[_0x8038('0x63')]});});return db[_0x8038('0xf4')][_0x8038('0x84')](_0x5b70d8,{'individualHooks':!![]});})['then'](function(){return _0x23196a[_0x8038('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x241e6f[_0x8038('0x5e')][_0x8038('0x3a')]||_0x8038('0x100'),'lastPauseAt':moment()[_0x8038('0xa7')](_0x8038('0xf6'))});})[_0x8038('0x15')](respondWithResult(_0x42d69f,null))[_0x8038('0x51')](handleError(_0x42d69f,null));};exports[_0x8038('0x101')]=function(_0x22edfe,_0x48826d){var _0x4656e6;return db['User'][_0x8038('0x5b')]({'where':{'id':_0x22edfe[_0x8038('0x52')]['id']},'attributes':['id',_0x8038('0x37'),_0x8038('0x2b'),'voicePause',_0x8038('0x102'),_0x8038('0x103'),_0x8038('0x104'),_0x8038('0x105'),_0x8038('0x106'),_0x8038('0x107'),_0x8038('0x108'),'lastPauseAt']})[_0x8038('0x15')](handleEntityNotFound(_0x48826d,null))[_0x8038('0x15')](function(_0x48b121){if(_0x48b121){_0x4656e6=_0x48b121;if(_0x22edfe['body']['channel']&&!utils[_0x8038('0xd0')](_0x22edfe[_0x8038('0x5e')][_0x8038('0x9a')])){throw new db['Sequelize'][(_0x8038('0x8e'))](_0x8038('0x9d'));}switch(_0x22edfe[_0x8038('0x5e')]['channel']){case _0x8038('0xa4'):return respondWithRpcPromise(_0x8038('0xfd'),_0x8038('0x101'),{'id':_0x4656e6['id'],'name':_0x4656e6['name'],'pause':![]})[_0x8038('0x15')](function(){return db['UserVoiceQueueRt'][_0x8038('0x27')]({'paused':0x0},{'where':{'UserId':_0x4656e6['id']},'individualHooks':!![]});})[_0x8038('0x15')](function(){return db[_0x8038('0xf4')][_0x8038('0x5b')]({'where':{'channel':_0x22edfe[_0x8038('0x5e')]['channel'],'membername':_0x4656e6[_0x8038('0x37')],'type':'PAUSE','exitAt':null}});})[_0x8038('0x15')](function(_0x5152b4){if(_0x5152b4){return _0x5152b4[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x8038('0x15')](function(){return _0x4656e6[_0x8038('0x27')]({'voicePause':![]});});case _0x8038('0x4d'):case _0x8038('0x4a'):case _0x8038('0x4c'):case _0x8038('0x5d'):case _0x8038('0x4f'):case _0x8038('0x4e'):return db['MemberReport'][_0x8038('0x5b')]({'where':{'channel':_0x22edfe['body']['channel'],'membername':_0x4656e6[_0x8038('0x37')],'type':_0x8038('0xfe'),'exitAt':null}})[_0x8038('0x15')](function(_0xd2e7d){if(_0xd2e7d){return _0xd2e7d[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x1a0858={};_['set'](_0x1a0858,util[_0x8038('0xa7')](_0x8038('0x109'),_0x22edfe['body'][_0x8038('0x9a')],'Pause'),![]);return _0x4656e6[_0x8038('0x27')](_0x1a0858);});default:return respondWithRpcPromise(_0x8038('0xfd'),_0x8038('0x101'),{'id':_0x4656e6['id'],'name':_0x4656e6[_0x8038('0x37')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x4656e6['id']}});})[_0x8038('0x15')](function(){return db[_0x8038('0xf4')]['findAll']({'where':{'membername':_0x4656e6[_0x8038('0x37')],'type':_0x8038('0xfe'),'exitAt':null}});})['then'](function(_0x467c2d){var _0x473281=[];_0x467c2d[_0x8038('0xf5')](function(_0x4b4119){_0x473281[_0x8038('0x47')](_0x4b4119[_0x8038('0x27')]({'exitAt':moment()[_0x8038('0xa7')](_0x8038('0xf6')),'data2':_0x8038('0x10a')}));});return BPromise[_0x8038('0x50')](_0x473281);})[_0x8038('0x15')](function(){return _0x4656e6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8038('0x15')](respondWithResult(_0x48826d,null))[_0x8038('0x51')](handleError(_0x48826d,null));};exports[_0x8038('0x10b')]=function(_0x3fcfa2,_0x257492){var _0x51630c={};var _0x559801={};var _0x1abb27;var _0x390871;return db[_0x8038('0x38')]['findOne']({'where':{'id':_0x3fcfa2['params']['id']}})['then'](handleEntityNotFound(_0x257492,null))[_0x8038('0x15')](function(_0x3bcc29){if(_0x3bcc29){_0x1abb27=_0x3bcc29;_0x559801[_0x8038('0x53')]=_[_0x8038('0x54')](db['Team']['rawAttributes']);_0x559801[_0x8038('0x40')]=_[_0x8038('0x54')](_0x3fcfa2[_0x8038('0x40')]);_0x559801[_0x8038('0x56')]=_[_0x8038('0x57')](_0x559801[_0x8038('0x53')],_0x559801['query']);_0x51630c[_0x8038('0x46')]=_[_0x8038('0x57')](_0x559801[_0x8038('0x53')],qs[_0x8038('0x58')](_0x3fcfa2['query']['fields']));_0x51630c[_0x8038('0x46')]=_0x51630c[_0x8038('0x46')][_0x8038('0x59')]?_0x51630c[_0x8038('0x46')]:_0x559801[_0x8038('0x53')];_0x51630c['order']=qs[_0x8038('0xc6')](_0x3fcfa2['query']['sort']);_0x51630c['where']=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x3fcfa2[_0x8038('0x40')],_0x559801[_0x8038('0x56')]));if(_0x3fcfa2[_0x8038('0x40')][_0x8038('0x3b')]){_0x51630c[_0x8038('0x3f')]=_[_0x8038('0xc8')](_0x51630c[_0x8038('0x3f')],{'$or':_[_0x8038('0x34')](_0x51630c[_0x8038('0x46')],function(_0x821053){var _0x282741={};_0x282741[_0x821053]={'$like':'%'+_0x3fcfa2[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0x282741;})});}_0x51630c=_[_0x8038('0xc8')]({},_0x51630c,_0x3fcfa2[_0x8038('0x5a')]);return _0x1abb27[_0x8038('0x10b')](_0x51630c);}})[_0x8038('0x15')](function(_0x4600cf){if(_0x4600cf){_0x390871=_0x4600cf['length'];if(!_0x3fcfa2[_0x8038('0x40')][_0x8038('0xc9')]('nolimit')){_0x51630c[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x3fcfa2['query'][_0x8038('0xce')]);_0x51630c[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x3fcfa2[_0x8038('0x40')][_0x8038('0x21')]);}return _0x1abb27['getTeams'](_0x51630c);}})[_0x8038('0x15')](function(_0x409ad8){if(_0x409ad8){return _0x409ad8?{'count':_0x390871,'rows':_0x409ad8}:null;}})[_0x8038('0x15')](respondWithResult(_0x257492,null))['catch'](handleError(_0x257492,null));};exports[_0x8038('0x10c')]=function(_0x1c1f77,_0x17cfc9){var _0xd153f9=_0x1c1f77['params']['id'];var _0x65bc5e=_0x1c1f77[_0x8038('0x5e')]?_0x1c1f77[_0x8038('0x5e')]['ids']:null;var _0x309634=[];return Promise['resolve']()['then'](function(){if(!_0x65bc5e)throw new APIBadRequestError(_0x8038('0x10d'));})[_0x8038('0x15')](function(){return db['User'][_0x8038('0x94')]({'where':{'id':_0xd153f9}});})[_0x8038('0x15')](function(_0x3a7e3d){if(!_0x3a7e3d)throw new APINotFoundError(util[_0x8038('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1c1f77[_0x8038('0x52')]['id']));return db[_0x8038('0x10e')][_0x8038('0x10f')](function(_0x591ad0){return _0x3a7e3d[_0x8038('0x10c')](_0x65bc5e,{'transaction':_0x591ad0})[_0x8038('0x15')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x65bc5e}}});})[_0x8038('0x15')](function(_0x1938a3){var _0x4133ba=_[_0x8038('0x34')](_0x1938a3,function(_0x2a8f1c){return _0x2a8f1c[_0x8038('0x110')]();});return Promise[_0x8038('0x50')](_0x4133ba);})['then'](function(_0x5c04f0){_0x309634=_[_0x8038('0x111')](_0x5c04f0);var _0x1b7b3a=_['map'](_0x309634,function(_0x2ca2d0){return _0x2ca2d0[_0x8038('0x112')](_0x3a7e3d['id'],{'transaction':_0x591ad0});});return Promise['all'](_0x1b7b3a);})[_0x8038('0x15')](function(){if(!_0x3a7e3d[_0x8038('0xa6')])return;var _0x238f74=_['filter'](_0x309634,function(_0x1a151b){return _0x1a151b[_0x8038('0x113')]('channel')===_0x8038('0x114');});var _0x98efb4=_[_0x8038('0x34')](_0x238f74,function(_0x5b3c5c){return db[_0x8038('0xd5')][_0x8038('0x115')]({'membername':_0x3a7e3d[_0x8038('0x37')],'UserId':_0x3a7e3d['id'],'queue_name':_0x5b3c5c[_0x8038('0x37')],'VoiceQueueId':_0x5b3c5c['id'],'interface':_['isNil'](_0x3a7e3d[_0x8038('0x9c')])?util['format'](_0x8038('0xa8'),_0x3a7e3d[_0x8038('0x37')]):_0x3a7e3d[_0x8038('0x9c')],'paused':_0x3a7e3d[_0x8038('0xa9')]||![],'penalty':_0x3a7e3d[_0x8038('0x116')]},{'transaction':_0x591ad0});});return Promise[_0x8038('0x50')](_0x98efb4);})[_0x8038('0x15')](function(){return db[_0x8038('0x117')][_0x8038('0x48')]({'where':{'teamId':{'$in':_0x65bc5e}}});})[_0x8038('0x15')](function(_0x14e6cb){var _0x35d54f=_[_0x8038('0x34')](_0x14e6cb,function(_0x31aea3){return db[_0x8038('0x118')][_0x8038('0x7c')]({'UserId':_0x3a7e3d['id'],'VoicePrefixId':_0x31aea3['VoicePrefixId']},{'transaction':_0x591ad0});});return Promise[_0x8038('0x50')](_0x35d54f);});});})[_0x8038('0x15')](function(){for(var _0x354606=0x0;_0x354606<_0x309634[_0x8038('0x59')];_0x354606++){var _0x27e864=_0x309634[_0x354606]['getDataValue'](_0x8038('0x9a'));var _0x124ca5=_0x27e864+_0x8038('0xa2');socket['emit'](_0x8038('0x2e')+_0x27e864+_0x8038('0xa3'),{'UserId':_0xd153f9,['queueField']:_0x309634[_0x354606]['id']});}})[_0x8038('0x15')](respondWithStatusCode(_0x17cfc9,null))[_0x8038('0x51')](APIHandleError(_0x17cfc9));};exports[_0x8038('0x119')]=function(_0x2157cd,_0x2208cc){var _0x1b5bc7=_0x2157cd['params']['id'];var _0x2d7f7d=null;if(_0x2157cd[_0x8038('0x40')]['ids']){_0x2d7f7d=_[_0x8038('0xad')](_0x2157cd[_0x8038('0x40')][_0x8038('0x61')])?_0x2157cd[_0x8038('0x40')]['ids']:[_0x2157cd[_0x8038('0x40')][_0x8038('0x61')]];}var _0x459865=[];return Promise['resolve']()[_0x8038('0x15')](function(){if(!_0x2d7f7d)throw new APIBadRequestError(_0x8038('0x11a'));})[_0x8038('0x15')](function(){return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x1b5bc7}});})[_0x8038('0x15')](function(_0x2b1a30){if(!_0x2b1a30)throw new APINotFoundError(util[_0x8038('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2157cd[_0x8038('0x52')]['id']));return db['sequelize'][_0x8038('0x10f')](function(_0x27d1bb){return _0x2b1a30[_0x8038('0x119')](_0x2d7f7d,{'transaction':_0x27d1bb})['then'](function(){return db['Team'][_0x8038('0x48')]({'where':{'id':{'$in':_0x2d7f7d}}});})[_0x8038('0x15')](function(_0x373ef1){var _0x4074f8=_['map'](_0x373ef1,function(_0x5cd5f9){return _0x5cd5f9[_0x8038('0x110')]();});return Promise[_0x8038('0x50')](_0x4074f8);})[_0x8038('0x15')](function(_0xea1b7c){_0x459865=_[_0x8038('0x111')](_0xea1b7c);var _0x5356e2=_[_0x8038('0x34')](_0x459865,function(_0x52b74d){return _0x52b74d[_0x8038('0x11b')](_0x2b1a30['id'],{'transaction':_0x27d1bb});});return Promise[_0x8038('0x50')](_0x5356e2);})[_0x8038('0x15')](function(){if(!_0x2b1a30[_0x8038('0xa6')])return;var _0x5ebbb1=_[_0x8038('0x3b')](_0x459865,function(_0x15c1d8){return _0x15c1d8[_0x8038('0x113')](_0x8038('0x9a'))===_0x8038('0x114');});var _0x36c9a5=_[_0x8038('0x34')](_0x5ebbb1,function(_0x56e6d6){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x56e6d6['id'],'UserId':_0x2b1a30['id']},'transaction':_0x27d1bb});});return Promise['all'](_0x36c9a5);})['then'](function(){return db[_0x8038('0x117')][_0x8038('0x48')]({'where':{'teamId':{'$in':_0x2d7f7d}}});})[_0x8038('0x15')](function(_0x347732){var _0x20f8c6=_[_0x8038('0x34')](_0x347732,function(_0x56826c){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2b1a30['id'],'VoicePrefixId':_0x56826c['VoicePrefixId']}},{'transaction':_0x27d1bb});});return Promise['all'](_0x20f8c6);});});})[_0x8038('0x15')](function(){for(var _0x462c34=0x0;_0x462c34<_0x459865[_0x8038('0x59')];_0x462c34++){var _0x428011=_0x459865[_0x462c34][_0x8038('0x113')]('channel');var _0x16600f=_0x428011+'QueueId';socket[_0x8038('0x28')](_0x8038('0x2e')+_0x428011+'Queue:remove',{'UserId':_0x1b5bc7,['queueField']:_0x459865[_0x462c34]['id']});}})[_0x8038('0x15')](respondWithStatusCode(_0x2208cc,null))['catch'](APIHandleError(_0x2208cc));};exports[_0x8038('0x11c')]=function(_0x1702f7,_0x272fc9){var _0x9c2789={};var _0x4ae2cf={};var _0x1610a2;var _0x1267ac;return db['User'][_0x8038('0x94')]({'where':{'id':_0x1702f7[_0x8038('0x52')]['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x272fc9,null))[_0x8038('0x15')](function(_0x125820){if(_0x125820){_0x1610a2=_0x125820;_0x4ae2cf['model']=_[_0x8038('0x54')](db[_0x8038('0xca')][_0x8038('0x55')]);_0x4ae2cf[_0x8038('0x40')]=_['keys'](_0x1702f7[_0x8038('0x40')]);_0x4ae2cf[_0x8038('0x56')]=_[_0x8038('0x57')](_0x4ae2cf['model'],_0x4ae2cf[_0x8038('0x40')]);_0x9c2789['attributes']=_['intersection'](_0x4ae2cf['model'],qs[_0x8038('0x58')](_0x1702f7['query'][_0x8038('0x58')]));_0x9c2789[_0x8038('0x46')]=_0x9c2789[_0x8038('0x46')][_0x8038('0x59')]?_0x9c2789[_0x8038('0x46')]:_0x4ae2cf['model'];_0x9c2789[_0x8038('0xd1')]=qs['sort'](_0x1702f7[_0x8038('0x40')][_0x8038('0xc6')]);_0x9c2789[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x1702f7[_0x8038('0x40')],_0x4ae2cf[_0x8038('0x56')]));if(_0x1702f7[_0x8038('0x40')][_0x8038('0x3b')]){_0x9c2789['where']=_[_0x8038('0xc8')](_0x9c2789[_0x8038('0x3f')],{'$or':_['map'](_0x9c2789[_0x8038('0x46')],function(_0x41d707){var _0x211c1a={};_0x211c1a[_0x41d707]={'$like':'%'+_0x1702f7[_0x8038('0x40')]['filter']+'%'};return _0x211c1a;})});}_0x9c2789=_[_0x8038('0xc8')]({},_0x9c2789,_0x1702f7[_0x8038('0x5a')]);return _0x1610a2[_0x8038('0x11c')](_0x9c2789);}})[_0x8038('0x15')](function(_0x1b0aeb){if(_0x1b0aeb){_0x1267ac=_0x1b0aeb['length'];if(!_0x1702f7[_0x8038('0x40')][_0x8038('0xc9')](_0x8038('0xcd'))){_0x9c2789[_0x8038('0xce')]=qs[_0x8038('0xce')](_0x1702f7['query'][_0x8038('0xce')]);_0x9c2789[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x1702f7[_0x8038('0x40')][_0x8038('0x21')]);}return _0x1610a2[_0x8038('0x11c')](_0x9c2789);}})[_0x8038('0x15')](function(_0xccf1de){if(_0xccf1de){return _0xccf1de?{'count':_0x1267ac,'rows':_0xccf1de}:null;}})[_0x8038('0x15')](respondWithResult(_0x272fc9,null))[_0x8038('0x51')](handleError(_0x272fc9,null));};exports[_0x8038('0x11d')]=function(_0x4c6cd6,_0x2b54f6){var _0x503804={};var _0xaf6027={};var _0x3ed394;return db[_0x8038('0x38')][_0x8038('0x94')]({'where':{'id':_0x4c6cd6['params']['id']}})[_0x8038('0x15')](handleEntityNotFound(_0x2b54f6,null))[_0x8038('0x15')](function(_0x69348b){if(_0x69348b){_0x3ed394=_0x69348b;_0xaf6027[_0x8038('0x53')]=_['keys'](db[_0x8038('0x38')]['rawAttributes']);_0xaf6027['query']=_['keys'](_0x4c6cd6[_0x8038('0x40')]);_0xaf6027['filters']=_[_0x8038('0x57')](_0xaf6027['model'],_0xaf6027[_0x8038('0x40')]);_0x503804[_0x8038('0x46')]=_['intersection'](_0xaf6027[_0x8038('0x53')],qs[_0x8038('0x58')](_0x4c6cd6[_0x8038('0x40')][_0x8038('0x58')]));_0x503804['attributes']=_0x503804[_0x8038('0x46')][_0x8038('0x59')]?_0x503804[_0x8038('0x46')]:_0xaf6027['model'];_0x503804[_0x8038('0xd1')]=qs[_0x8038('0xc6')](_0x4c6cd6[_0x8038('0x40')][_0x8038('0xc6')]);_0x503804[_0x8038('0x3f')]=qs[_0x8038('0x56')](_[_0x8038('0xc7')](_0x4c6cd6[_0x8038('0x40')],_0xaf6027[_0x8038('0x56')]));if(_0x4c6cd6[_0x8038('0x40')][_0x8038('0x3b')]){_0x503804['where']=_[_0x8038('0xc8')](_0x503804[_0x8038('0x3f')],{'$or':_['map'](_0x503804[_0x8038('0x46')],function(_0x5c113d){var _0xe5bd7b={};_0xe5bd7b[_0x5c113d]={'$like':'%'+_0x4c6cd6[_0x8038('0x40')][_0x8038('0x3b')]+'%'};return _0xe5bd7b;})});}_0x503804[_0x8038('0x53')]=db[_0x8038('0x38')];_0x503804['as']=_0x8038('0x2f');_0x503804=_[_0x8038('0xc8')]({},_0x503804,_0x4c6cd6[_0x8038('0x5a')]);return _0x3ed394[_0x8038('0xf2')]({'include':[_0x503804]});}})[_0x8038('0x15')](function(_0x39bfbb){if(_0x39bfbb){var _0x2a2707={},_0x4b96e3=[];for(var _0x4c4277=0x0;_0x4c4277<_0x39bfbb[_0x8038('0x59')];_0x4c4277+=0x1){for(var _0x32767e=0x0,_0xd6cc8e;_0x32767e<_0x39bfbb[_0x4c4277][_0x8038('0x2f')][_0x8038('0x59')];_0x32767e+=0x1){_0xd6cc8e=_0x39bfbb[_0x4c4277]['Agents'][_0x32767e][_0x8038('0x2a')]({'plain':!![]});_0x2a2707[_0xd6cc8e['id']]=_0xd6cc8e;}}_0x2a2707=_['values'](_0x2a2707);for(var _0x327628=qs[_0x8038('0x21')](_0x4c6cd6[_0x8038('0x40')]['offset']);_0x327628<_0x2a2707[_0x8038('0x59')]&&_0x4b96e3[_0x8038('0x59')]=_0x14c261){_0x3d7195=_0x14c261;_0x59063c=0xc8;}else{_0x59063c=0xce;}_0x270418['status'](_0x59063c);return _0x270418[_0x3d95('0x28')]('Content-Range',_0x5611c5+'-'+_0x3d7195+'/'+_0x14c261)['json'](_0x57b176);}return null;};}function saveUpdates(_0x4f9048){return function(_0x3d1090){if(_0x3d1090){return _0x3d1090['update'](_0x4f9048)[_0x3d95('0x16')](function(_0x4318b4){socket[_0x3d95('0x29')](_0x3d95('0x2a')+_0x4318b4['id'],{});return _0x4318b4;});}return null;};}function removeEntity(_0x521eb7){return function(_0x5cc23a){if(_0x5cc23a){return _0x5cc23a[_0x3d95('0x2b')]()[_0x3d95('0x16')](function(){var _0x330cb2=_0x5cc23a[_0x3d95('0x2c')]({'plain':!![]});if(_0x330cb2['role']===_0x3d95('0x2d'))return;var _0x342d30=[{'name':_0x3d95('0x2e'),'value':'user','ignore':!![]},{'name':_0x3d95('0x2f'),'value':_0x3d95('0x30'),'ignore':![]},{'name':_0x3d95('0x31'),'value':_0x3d95('0x32'),'ignore':![]}];var _0x4fb71c=_(_0x342d30)[_0x3d95('0x33')]('ignore')[_0x3d95('0x34')](_0x3d95('0x35'))['value']();if(_[_0x3d95('0x36')](_0x4fb71c,_0x330cb2[_0x3d95('0x37')])){return;}var _0x2a8d93=_[_0x3d95('0x38')](_0x342d30,[_0x3d95('0x35'),_0x330cb2[_0x3d95('0x37')]])[_0x3d95('0x39')];return db[_0x3d95('0x3a')][_0x3d95('0x2b')]({'where':{'type':_0x2a8d93,'resourceId':_0x330cb2['id']}})['then'](function(){return _0x5cc23a;});})[_0x3d95('0x16')](function(){_0x521eb7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x458aad){return function(_0x18af4d){if(!_0x18af4d){_0x458aad[_0x3d95('0x3b')](0x194);}return _0x18af4d;};}function handleError(_0x1878d5,_0x41a0c6){_0x41a0c6=_0x41a0c6||0x1f4;return function(_0x48b29a){logger['error'](_0x48b29a[_0x3d95('0x3c')]);if(_0x48b29a[_0x3d95('0x39')]){delete _0x48b29a[_0x3d95('0x39')];}_0x1878d5[_0x3d95('0x21')](_0x41a0c6)[_0x3d95('0x3d')](_0x48b29a);};}exports[_0x3d95('0x3e')]=function(_0x121939,_0x492d0b){var _0xe6c530={},_0x25bce7={'count':0x0,'rows':[]};var _0x464423=_(db['User'][_0x3d95('0x3f')])[_0x3d95('0x34')](function(_0x1d0e89){return{'name':_0x1d0e89[_0x3d95('0x40')],'type':_0x1d0e89[_0x3d95('0x41')][_0x3d95('0x42')]};})[_0x3d95('0x33')](function(_0x2bb783){return!_[_0x3d95('0x36')](['password',_0x3d95('0x43')],_0x2bb783['name']);})[_0x3d95('0x35')]();_0xe6c530=qs[_0x3d95('0x44')](_0x464423,_0x121939);var _0x2bc0e4={'where':_0xe6c530[_0x3d95('0x45')]};return db['User'][_0x3d95('0x27')](_0x2bc0e4)[_0x3d95('0x16')](function(_0x530f32){_0x25bce7[_0x3d95('0x27')]=_0x530f32;if(_0x121939['query'][_0x3d95('0x46')]){_0xe6c530['include']=[{'all':!![]}];}if(_0x121939[_0x3d95('0x47')][_0x3d95('0x48')]===_0x3d95('0x49')){_0xe6c530[_0x3d95('0x4a')]=[{'model':db[_0x3d95('0x4b')],'as':_0x3d95('0x48')}];}if(!_[_0x3d95('0x36')](_0xe6c530[_0x3d95('0x4c')],'id')){_0xe6c530[_0x3d95('0x4c')]['push']('id');}return db[_0x3d95('0x4d')][_0x3d95('0x4e')](_0xe6c530);})[_0x3d95('0x16')](function(_0x4e2406){_0x25bce7['rows']=_0x4e2406;if(_0x121939[_0x3d95('0x47')][_0x3d95('0x4f')]===_0x3d95('0x49')){var _0x10e649=[];for(var _0x34d7a3=0x0;_0x34d7a3<_0x25bce7['rows']['length'];_0x34d7a3++){_0x10e649[_0x3d95('0x50')](get_open_tabs('chat',_0x25bce7[_0x3d95('0x51')][_0x34d7a3][_0x3d95('0x52')]));_0x10e649[_0x3d95('0x50')](get_open_tabs('sms',_0x25bce7[_0x3d95('0x51')][_0x34d7a3][_0x3d95('0x52')]));_0x10e649[_0x3d95('0x50')](get_open_tabs(_0x3d95('0x53'),_0x25bce7['rows'][_0x34d7a3]['dataValues']));_0x10e649['push'](get_open_tabs(_0x3d95('0x54'),_0x25bce7['rows'][_0x34d7a3][_0x3d95('0x52')]));_0x10e649[_0x3d95('0x50')](get_open_tabs('openchannel',_0x25bce7[_0x3d95('0x51')][_0x34d7a3][_0x3d95('0x52')]));_0x10e649[_0x3d95('0x50')](get_open_tabs(_0x3d95('0x55'),_0x25bce7['rows'][_0x34d7a3][_0x3d95('0x52')]));}return BPromise[_0x3d95('0x56')](_0x10e649)[_0x3d95('0x16')](function(){return _0x25bce7;});}else{return _0x25bce7;}})[_0x3d95('0x16')](respondWithFilteredResult(_0x492d0b,_0xe6c530))[_0x3d95('0x20')](handleError(_0x492d0b,null));};exports[_0x3d95('0x57')]=function(_0x35f3c0,_0x1028e9){var _0x541e7c={'raw':![],'where':{'id':_0x35f3c0[_0x3d95('0x58')]['id']}},_0x212985={};_0x212985[_0x3d95('0x59')]=_['differenceBy'](_[_0x3d95('0x5a')](db['User'][_0x3d95('0x3f')]),['password',_0x3d95('0x43')]);_0x212985[_0x3d95('0x47')]=_['keys'](_0x35f3c0['query']);_0x212985[_0x3d95('0x5b')]=_['intersection'](_0x212985[_0x3d95('0x59')],_0x212985[_0x3d95('0x47')]);_0x541e7c[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x212985[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x35f3c0[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x541e7c[_0x3d95('0x4c')]=_0x541e7c['attributes'][_0x3d95('0x5e')]?_0x541e7c[_0x3d95('0x4c')]:_0x212985[_0x3d95('0x59')];if(_0x35f3c0[_0x3d95('0x47')][_0x3d95('0x46')]){_0x541e7c['include']=[{'all':!![]}];}if(_0x35f3c0[_0x3d95('0x47')][_0x3d95('0x48')]===_0x3d95('0x49')){_0x541e7c['include']=[{'model':db[_0x3d95('0x4b')],'as':_0x3d95('0x48')}];}_0x541e7c=_[_0x3d95('0x5f')]({},_0x541e7c,_0x35f3c0[_0x3d95('0x60')]);if(!_[_0x3d95('0x36')](_0x541e7c[_0x3d95('0x4c')],'id')){_0x541e7c[_0x3d95('0x4c')][_0x3d95('0x50')]('id');}return db[_0x3d95('0x4d')]['find'](_0x541e7c)[_0x3d95('0x16')](handleEntityNotFound(_0x1028e9,null))['then'](function(_0x3f42be){var _0x546f2f=[];values=_0x3f42be;if(_0x35f3c0['query'][_0x3d95('0x4f')]===_0x3d95('0x49')){_0x546f2f[_0x3d95('0x50')](get_open_tabs(_0x3d95('0x61'),_0x3f42be[_0x3d95('0x52')]));_0x546f2f[_0x3d95('0x50')](get_open_tabs(_0x3d95('0x62'),_0x3f42be[_0x3d95('0x52')]));_0x546f2f[_0x3d95('0x50')](get_open_tabs('openchannel',_0x3f42be['dataValues']));_0x546f2f[_0x3d95('0x50')](get_open_tabs(_0x3d95('0x55'),_0x3f42be[_0x3d95('0x52')]));_0x546f2f['push'](get_open_tabs('fax',_0x3f42be[_0x3d95('0x52')]));_0x546f2f[_0x3d95('0x50')](get_open_tabs(_0x3d95('0x54'),_0x3f42be[_0x3d95('0x52')]));return BPromise[_0x3d95('0x56')](_0x546f2f);}else{return values;}})[_0x3d95('0x16')](function(){return values;})['then'](respondWithResult(_0x1028e9,null))[_0x3d95('0x20')](handleError(_0x1028e9,null));};exports[_0x3d95('0x63')]=function(_0x2de522,_0x11c084){if(_0x2de522[_0x3d95('0x64')]['id']){delete _0x2de522[_0x3d95('0x64')]['id'];}delete _0x2de522[_0x3d95('0x64')][_0x3d95('0x37')];return db[_0x3d95('0x4d')]['find']({'where':{'id':_0x2de522[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x11c084,null))[_0x3d95('0x16')](saveUpdates(_0x2de522[_0x3d95('0x64')],null))[_0x3d95('0x16')](respondWithResult(_0x11c084,null))[_0x3d95('0x20')](handleError(_0x11c084,null));};exports['describe']=function(_0x53968f,_0x143042){return db['User'][_0x3d95('0x65')]()[_0x3d95('0x16')](respondWithResult(_0x143042,null))[_0x3d95('0x20')](handleError(_0x143042,null));};exports['addContacts']=function(_0x342c00,_0x5d5834){return db['User'][_0x3d95('0x38')]({'where':{'id':_0x342c00['params']['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x5d5834,null))[_0x3d95('0x16')](function(_0x2905fe){if(_0x2905fe){return _0x2905fe[_0x3d95('0x66')](_0x342c00['body'][_0x3d95('0x67')],_[_0x3d95('0x68')](_0x342c00[_0x3d95('0x64')],['ids','id'])||{});}})[_0x3d95('0x16')](respondWithResult(_0x5d5834,null))[_0x3d95('0x20')](handleError(_0x5d5834,null));};function validateUser(_0x708038){return new BPromise(function(_0x1ac6ad,_0xd50913){if(_0x708038['internal'])return _0x1ac6ad(_0x708038);return db[_0x3d95('0x69')][_0x3d95('0x6a')](0x1)[_0x3d95('0x16')](function(_0x2c2a82){if(_0x2c2a82[_0x3d95('0x6b')])authService[_0x3d95('0x6c')](_0x708038[_0x3d95('0x6d')]);db['User'][_0x3d95('0x6e')]('internal')[_0x3d95('0x16')](function(_0x5e2d61){if(_[_0x3d95('0x6f')](_0x5e2d61)){_0x708038[_0x3d95('0x70')]=_0x2c2a82['min_internal']||0x1;return;}if(_[_0x3d95('0x6f')](_0x2c2a82[_0x3d95('0x71')])||_0x2c2a82[_0x3d95('0x71')]===_0x5e2d61){_0x708038[_0x3d95('0x70')]=_0x5e2d61+0x1;return;}if(_0x2c2a82[_0x3d95('0x71')]>_0x5e2d61){_0x708038[_0x3d95('0x70')]=_0x2c2a82[_0x3d95('0x71')];return;}return db[_0x3d95('0x72')][_0x3d95('0x47')](_0x3d95('0x73'),{'type':db[_0x3d95('0x72')][_0x3d95('0x74')][_0x3d95('0x75')]})[_0x3d95('0x16')](function(_0x22d5c1){if(_0x22d5c1&&_0x22d5c1[_0x3d95('0x5e')]){for(var _0x2b03a9=0x0,_0xa8b235=_0x22d5c1['length'];_0x2b03a9<_0xa8b235&&_[_0x3d95('0x6f')](_0x708038[_0x3d95('0x70')]);_0x2b03a9++){if(_0x2c2a82[_0x3d95('0x71')]<=_0x22d5c1[_0x2b03a9][_0x3d95('0x76')]){_0x708038[_0x3d95('0x70')]=_0x22d5c1[_0x2b03a9]['from'];}else if(_0x2c2a82['min_internal']>_0x22d5c1[_0x2b03a9][_0x3d95('0x76')]&&_0x2c2a82['min_internal']<=_0x22d5c1[_0x2b03a9]['to']){_0x708038[_0x3d95('0x70')]=_0x2c2a82[_0x3d95('0x71')];}}}if(_[_0x3d95('0x6f')](_0x708038[_0x3d95('0x70')])){_0x708038['internal']=_0x5e2d61+0x1;}return _0x1ac6ad(_0x708038);});});})[_0x3d95('0x20')](function(_0x2d03e9){_0xd50913(_0x2d03e9);});});}function updateUser(_0x3a5d62){return new BPromise(function(_0x55563e,_0x253841){try{if(_0x3a5d62['voicemail']){_0x3a5d62[_0x3d95('0x77')]=_0x3a5d62[_0x3d95('0x70')];_0x3a5d62[_0x3d95('0x78')]={'mailbox':_0x3a5d62[_0x3d95('0x70')],'password':_0x3a5d62['password'],'fullname':_0x3a5d62[_0x3d95('0x79')],'email':_0x3a5d62[_0x3d95('0x7a')]};}if(_0x3a5d62['role']==='agent'){if(!_0x3a5d62[_0x3d95('0x7b')])_0x3a5d62[_0x3d95('0x7b')]=[_0x3d95('0x7c'),'102',_0x3d95('0x7d'),_0x3d95('0x7e'),'110',_0x3d95('0x7f'),'105',_0x3d95('0x80'),_0x3d95('0x81'),_0x3d95('0x82'),'109',_0x3d95('0x83'),_0x3d95('0x84'),'114',_0x3d95('0x85')];}_0x55563e(_0x3a5d62);}catch(_0x5f1805){_0x253841(_0x5f1805);}});}exports[_0x3d95('0x86')]=function(_0x5749e0,_0x2aa156){if(_0x5749e0[_0x3d95('0x87')][_0x3d95('0x37')]===_0x3d95('0x30'))throw new Error(_0x3d95('0x88'));if(_0x5749e0[_0x3d95('0x64')][_0x3d95('0x37')]==='user'&&_0x5749e0[_0x3d95('0x87')]['role']!==_0x3d95('0x2d')){throw new Error(_0x3d95('0x89'));}if(_0x5749e0[_0x3d95('0x64')][_0x3d95('0x37')]===_0x3d95('0x2d')&&_0x5749e0['user'][_0x3d95('0x37')]!=='admin'){throw new Error(_0x3d95('0x8a'));}return licenseUtil[_0x3d95('0x8b')]([_0x5749e0[_0x3d95('0x64')]])[_0x3d95('0x16')](function(){return validateUser(_0x5749e0[_0x3d95('0x64')]);})[_0x3d95('0x16')](function(_0x485a83){return updateUser(_0x485a83)[_0x3d95('0x16')](function(_0x28e891){if(_0x28e891[_0x3d95('0x37')]===_0x3d95('0x2d')){_0x28e891['settingsEnabled']=_0x5749e0[_0x3d95('0x87')]['settingsEnabled'];delete _0x28e891[_0x3d95('0x8c')];}return _0x28e891;});})[_0x3d95('0x16')](function(_0x555ec9){return db[_0x3d95('0x4d')]['create'](_0x555ec9,{'include':[{'model':db['VoiceMail'],'as':_0x3d95('0x78')}]});})[_0x3d95('0x16')](function(_0x14667d){if(_0x5749e0[_0x3d95('0x64')]['role']===_0x3d95('0x87'))return _0x14667d;if(_0x5749e0[_0x3d95('0x87')]['role']!==_0x3d95('0x87'))return _0x14667d;return db[_0x3d95('0x8d')][_0x3d95('0x38')]({'where':{'name':_0x14667d[_0x3d95('0x37')]==='agent'?_0x3d95('0x2f'):_0x3d95('0x31'),'userProfileId':_0x5749e0['user'][_0x3d95('0x8c')]},'raw':!![]})[_0x3d95('0x16')](function(_0x46ceae){if(!_0x46ceae||_0x46ceae['autoAssociation']!=0x0)return _0x14667d;return db[_0x3d95('0x3a')][_0x3d95('0x86')]({'name':_0x14667d[_0x3d95('0x39')],'resourceId':_0x14667d['id'],'type':_0x46ceae[_0x3d95('0x39')],'sectionId':_0x46ceae['id']},{})[_0x3d95('0x16')](function(){return _0x14667d;});})['catch'](function(_0x1788e5){logger[_0x3d95('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1788e5);throw _0x1788e5;});})['then'](respondWithResult(_0x2aa156,0xc9))[_0x3d95('0x20')](handleError(_0x2aa156,null));};exports[_0x3d95('0x8e')]=function(_0x630ada,_0x23f602){var _0x2d786f=_0x630ada[_0x3d95('0x64')];var _0x4ed0aa=[];if(_0x630ada['user'][_0x3d95('0x37')]===_0x3d95('0x30'))throw new Error(_0x3d95('0x88'));if(_[_0x3d95('0x8f')](_0x2d786f,[_0x3d95('0x37'),'user'])&&_0x630ada['user']['role']!=='admin'){throw new Error(_0x3d95('0x89'));}if(_['some'](_0x2d786f,[_0x3d95('0x37'),_0x3d95('0x2d')])&&_0x630ada[_0x3d95('0x87')][_0x3d95('0x37')]!==_0x3d95('0x2d')){throw new Error(_0x3d95('0x90'));}return licenseUtil[_0x3d95('0x8b')](_0x2d786f)[_0x3d95('0x16')](function(){return validateUser(_0x2d786f[0x0]);})[_0x3d95('0x16')](function(){for(var _0x51f668=0x1;_0x51f668<_0x2d786f[_0x3d95('0x5e')];_0x51f668++){var _0x240301=_0x2d786f[_0x51f668-0x1][_0x3d95('0x70')];if(!_0x2d786f[_0x51f668][_0x3d95('0x70')])_0x2d786f[_0x51f668][_0x3d95('0x70')]=_0x240301+0x1;_0x4ed0aa['push'](validateUser(_0x2d786f[_0x51f668]));}return BPromise[_0x3d95('0x56')](_0x4ed0aa);})[_0x3d95('0x16')](function(){_0x4ed0aa=[];for(var _0x215cf7=0x0;_0x215cf7<_0x2d786f[_0x3d95('0x5e')];_0x215cf7++){_0x4ed0aa['push'](updateUser(_0x2d786f[_0x215cf7]));}return BPromise[_0x3d95('0x56')](_0x4ed0aa);})['then'](function(){return BPromise[_0x3d95('0x91')](_0x2d786f,function(_0x1a4d51){return db['User'][_0x3d95('0x86')](_0x1a4d51,{'include':[{'model':db[_0x3d95('0x78')],'as':_0x3d95('0x78')}]})[_0x3d95('0x16')](function(_0x2ef3ad){_0x1a4d51['id']=_0x2ef3ad['id'];return _0x1a4d51;});});})[_0x3d95('0x16')](function(_0x36e4ca){if(_0x630ada[_0x3d95('0x64')]['role']===_0x3d95('0x87'))return _0x36e4ca;if(_0x630ada[_0x3d95('0x87')]['role']!==_0x3d95('0x87'))return _0x36e4ca;var _0x3d599c=_[_0x3d95('0x8f')](_0x36e4ca,function(_0x3eadca){return _0x3eadca['role']===_0x3d95('0x30')||_0x3eadca[_0x3d95('0x37')]===_0x3d95('0x32');});if(!_0x3d599c)return _0x36e4ca;return db[_0x3d95('0x8d')][_0x3d95('0x4e')]({'where':{'name':{'$or':[_0x3d95('0x2f'),_0x3d95('0x31')]},'userProfileId':_0x630ada[_0x3d95('0x87')][_0x3d95('0x8c')]},'raw':!![]})[_0x3d95('0x16')](function(_0x3f306c){if(_['isEmpty'](_0x3f306c)||!_[_0x3d95('0x8f')](_0x3f306c,[_0x3d95('0x92'),0x0]))return _0x36e4ca;_0x4ed0aa=[];var _0x31b769=_(_0x3f306c)[_0x3d95('0x34')](function(_0x30bfcf){if(_0x30bfcf[_0x3d95('0x92')]===0x1)return;return _0x30bfcf[_0x3d95('0x39')]===_0x3d95('0x2f')?_0x3d95('0x30'):'telephone';})[_0x3d95('0x93')]()['value']();for(var _0x1d6e72=0x0;_0x1d6e72<_0x36e4ca[_0x3d95('0x5e')];_0x1d6e72++){if(!_['includes'](_0x31b769,_0x36e4ca[_0x1d6e72]['role']))return;var _0x1e4fa5=_0x36e4ca[_0x1d6e72][_0x3d95('0x37')]===_0x3d95('0x30')?_0x3d95('0x2f'):_0x3d95('0x31');_0x4ed0aa['push'](db[_0x3d95('0x3a')][_0x3d95('0x86')]({'name':_0x36e4ca[_0x1d6e72][_0x3d95('0x39')],'resourceId':_0x36e4ca[_0x1d6e72]['id'],'type':_0x1e4fa5,'sectionId':_[_0x3d95('0x38')](_0x3f306c,[_0x3d95('0x39'),_0x1e4fa5])['id']},{}));}return BPromise[_0x3d95('0x56')](_0x4ed0aa);});})[_0x3d95('0x16')](respondWithResult(_0x23f602,0xc9))['catch'](handleError(_0x23f602,null));};exports[_0x3d95('0x94')]=function(_0x21ea8c,_0x12f4ec){if(_0x21ea8c['body']['id']){delete _0x21ea8c['body']['id'];}return db[_0x3d95('0x4d')][_0x3d95('0x38')]({'where':{'id':_0x21ea8c[_0x3d95('0x58')]['id']}})['then'](function(_0x25a6e9){if(!_0x25a6e9)return null;if(_0x25a6e9['id']===_0x21ea8c[_0x3d95('0x87')]['id']){if(!_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x95')]||!_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x96')]){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))](_0x3d95('0x99'));}if(!_0x25a6e9[_0x3d95('0x9a')](_0x21ea8c['body']['oldPassword'])){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))](_0x3d95('0x9b'));}if(_0x21ea8c['body'][_0x3d95('0x95')]===_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x96')]){throw new db['Sequelize'][(_0x3d95('0x98'))](_0x3d95('0x9c'));}}else if(_0x21ea8c[_0x3d95('0x87')][_0x3d95('0x37')]===_0x3d95('0x2d')){if(!_0x21ea8c['body']['newPassword']){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x21ea8c[_0x3d95('0x87')]['role']===_0x3d95('0x87')){if(!_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x96')]){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))](_0x3d95('0x9d'));}if(_0x25a6e9[_0x3d95('0x37')]!=='agent'){throw new db[(_0x3d95('0x97'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize']['ValidationError'](_0x3d95('0x88'));}return _0x25a6e9;})[_0x3d95('0x16')](handleEntityNotFound(_0x12f4ec,null))[_0x3d95('0x16')](function(_0x5ee48c){return db[_0x3d95('0x69')][_0x3d95('0x9e')]({'attributes':['id',_0x3d95('0x6b'),'enforcePasswordHistory',_0x3d95('0x9f')]})[_0x3d95('0x16')](function(_0x340bf9){if(_0x340bf9['securePassword'])authService[_0x3d95('0x6c')](_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x96')]);if(!_0x340bf9[_0x3d95('0xa0')]||!_0x5ee48c[_0x3d95('0xa1')])return _0x5ee48c;authService['validatePasswordHistory'](_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x96')],_0x5ee48c[_0x3d95('0xa1')],_0x340bf9[_0x3d95('0x9f')]);return _0x5ee48c;})['then'](saveUpdates({'password':_0x21ea8c[_0x3d95('0x64')][_0x3d95('0x96')],'passwordResetAt':_0x21ea8c[_0x3d95('0x87')]['id']==_0x21ea8c[_0x3d95('0x58')]['id']?moment():null,'previousPasswords':authService[_0x3d95('0xa2')](_0x21ea8c['body'][_0x3d95('0x96')],_0x5ee48c[_0x3d95('0xa1')])},null));})[_0x3d95('0x16')](respondWithResult(_0x12f4ec,null))[_0x3d95('0x20')](handleError(_0x12f4ec,null));};exports[_0x3d95('0xa3')]=function(_0x4ee5a5,_0x431036){var _0x5a0bf6=_0x4ee5a5['body'][_0x3d95('0xa4')];return db[_0x3d95('0x4d')][_0x3d95('0x38')]({'where':{'id':_0x4ee5a5[_0x3d95('0x58')]['id']},'attributes':['id','name',_0x3d95('0x37'),'online','loginInPause','voicePause','interface']})[_0x3d95('0x16')](handleEntityNotFound(_0x431036,null))['then'](function(_0x2c2279){if(_0x2c2279){if(!utils[_0x3d95('0xa5')](_0x5a0bf6)){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))](_0x3d95('0xa6'));}return _0x2c2279[_0x3d95('0xa7')+_['capitalize'](_0x5a0bf6[_0x3d95('0xa8')]())+_0x3d95('0xa9')](_0x4ee5a5[_0x3d95('0x64')]['ids'],{'penalty':_0x4ee5a5[_0x3d95('0x64')][_0x3d95('0xaa')]||0x0})[_0x3d95('0xab')](function(_0x369ce1){for(var _0x269b96=0x0;_0x269b96<_0x4ee5a5[_0x3d95('0x64')]['ids'][_0x3d95('0x5e')];_0x269b96+=0x1){var _0x159253={'UserId':Number(_0x4ee5a5['params']['id'])};_0x159253[_[_0x3d95('0xac')](_0x5a0bf6[_0x3d95('0xa8')]())+_0x3d95('0xad')]=Number(_0x4ee5a5[_0x3d95('0x64')][_0x3d95('0x67')][_0x269b96]);socket[_0x3d95('0x29')]('user'+_[_0x3d95('0xac')](_0x5a0bf6[_0x3d95('0xa8')]())+_0x3d95('0xae'),_0x159253);}return _0x369ce1;})[_0x3d95('0x16')](function(){if(_0x5a0bf6==='voice'){return db[_0x3d95('0xaf')][_0x3d95('0x4e')]({'where':{'id':_0x4ee5a5['body'][_0x3d95('0x67')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x3d95('0x16')](function(_0x5723d7){var _0x31db22=_0x2c2279[_0x3d95('0x2c')]({'plain':!![]});var _0x11c3d2=[];if(_0x5a0bf6===_0x3d95('0xb0')&&_0x31db22[_0x3d95('0x37')]===_0x3d95('0x30')&&_0x31db22[_0x3d95('0xb1')]){for(var _0x27ce15=0x0;_0x27ce15<_0x5723d7[_0x3d95('0x5e')];_0x27ce15+=0x1){_0x11c3d2[_0x3d95('0x50')]({'membername':_0x31db22[_0x3d95('0x39')],'UserId':_0x31db22['id'],'queue_name':_0x5723d7[_0x27ce15][_0x3d95('0x39')],'VoiceQueueId':_0x5723d7[_0x27ce15]['id'],'interface':_['isNil'](_0x31db22['interface'])?util['format']('SIP/%s',_0x31db22[_0x3d95('0x39')]):_0x31db22[_0x3d95('0xb2')],'paused':_0x31db22['voicePause']||![],'penalty':_0x4ee5a5[_0x3d95('0x64')][_0x3d95('0xaa')]||0x0});}return BPromise[_0x3d95('0x91')](_0x11c3d2,function(_0x54a737){return db[_0x3d95('0xb3')][_0x3d95('0xb4')](_0x54a737);});}return _0x2c2279;});}})['then'](respondWithStatusCode(_0x431036,null))[_0x3d95('0x20')](handleError(_0x431036,null));};exports[_0x3d95('0xb5')]=function(_0x528bd8,_0x58021d){var _0x130341,_0x52715e;return db[_0x3d95('0x4d')]['find']({'where':{'id':_0x528bd8[_0x3d95('0x58')]['id']},'attributes':['id',_0x3d95('0x39'),_0x3d95('0x37')]})[_0x3d95('0x16')](handleEntityNotFound(_0x58021d,null))['then'](function(_0xfca234){if(_0xfca234){_0x130341=_0xfca234;if(!_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')]||!utils[_0x3d95('0xa5')](_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')])){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))]('Unknown\x20channel');}return _0xfca234[_0x3d95('0xb6')+_[_0x3d95('0xac')](_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')][_0x3d95('0xa8')]())+_0x3d95('0xa9')](_0x528bd8['query'][_0x3d95('0x67')]);}})['then'](function(_0x3c7c8b){if(_[_0x3d95('0xb7')](_0x528bd8['query']['ids'])){for(var _0x1d5dd2=0x0;_0x1d5dd2<_0x528bd8[_0x3d95('0x47')][_0x3d95('0x67')][_0x3d95('0x5e')];_0x1d5dd2+=0x1){_0x52715e={'UserId':Number(_0x528bd8[_0x3d95('0x58')]['id'])};_0x52715e[_[_0x3d95('0xac')](_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')][_0x3d95('0xa8')]())+_0x3d95('0xad')]=Number(_0x528bd8['query'][_0x3d95('0x67')][_0x1d5dd2]);socket[_0x3d95('0x29')](_0x3d95('0x87')+_[_0x3d95('0xac')](_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')][_0x3d95('0xa8')]())+'Queue:remove',_0x52715e);}}else{_0x52715e={'UserId':Number(_0x528bd8[_0x3d95('0x58')]['id'])};_0x52715e[_[_0x3d95('0xac')](_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')]['toLowerCase']())+_0x3d95('0xad')]=Number(_0x528bd8['query']['ids']);socket[_0x3d95('0x29')](_0x3d95('0x87')+_['capitalize'](_0x528bd8[_0x3d95('0x47')][_0x3d95('0xa4')]['toLowerCase']())+_0x3d95('0xb8'),_0x52715e);}return _0x3c7c8b;})[_0x3d95('0x16')](function(){if(_0x528bd8[_0x3d95('0x47')]['channel']===_0x3d95('0xb0')){return db[_0x3d95('0xb3')]['destroy']({'where':{'UserId':_0x528bd8[_0x3d95('0x58')]['id'],'VoiceQueueId':_0x528bd8[_0x3d95('0x47')][_0x3d95('0x67')]},'individualHooks':!![]})['then'](function(){return _0x130341;});}return _0x130341;})[_0x3d95('0x16')](respondWithStatusCode(_0x58021d,null))['catch'](handleError(_0x58021d,null));};exports[_0x3d95('0xb9')]=function(_0x35a4e7,_0x6f1408){_0x35a4e7[_0x3d95('0x64')][_0x3d95('0xba')]=_0x35a4e7['file'][_0x3d95('0xbb')];return db['User'][_0x3d95('0x38')]({'where':{'id':_0x35a4e7[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x6f1408,null))[_0x3d95('0x16')](saveUpdates(_0x35a4e7[_0x3d95('0x64')],null))[_0x3d95('0x16')](respondWithResult(_0x6f1408,null))[_0x3d95('0x20')](handleError(_0x6f1408,null));};exports['getAvatar']=function(_0x312faa,_0x2dbdf3){var _0x56bd86=path[_0x3d95('0xbc')](config[_0x3d95('0xbd')],_0x3d95('0xbe'));return db['User']['find']({'where':{'id':_0x312faa['params']['id']},'attributes':['id',_0x3d95('0xba')],'raw':!![]})[_0x3d95('0x16')](handleEntityNotFound(_0x2dbdf3,null))[_0x3d95('0x16')](function(_0xe9fc8a){if(_0xe9fc8a){if(_[_0x3d95('0x6f')](_0xe9fc8a[_0x3d95('0xba')])){return _0x2dbdf3[_0x3d95('0xbf')](_0x56bd86);}else{if(!fs[_0x3d95('0xc0')](path['join'](config[_0x3d95('0xbd')],_0x3d95('0xc1'),_0xe9fc8a['userpic']))){return _0x2dbdf3[_0x3d95('0xbf')](_0x56bd86);}return _0x2dbdf3[_0x3d95('0xbf')](path['join'](config[_0x3d95('0xbd')],'server/files/images/',_0xe9fc8a[_0x3d95('0xba')]));}}})[_0x3d95('0x20')](handleError(_0x2dbdf3,null));};exports[_0x3d95('0xc2')]=function(_0x51da59,_0x5c15c1){return db[_0x3d95('0x4d')][_0x3d95('0x38')]({'where':{'id':_0x51da59[_0x3d95('0x58')]['id']},'attributes':['id']})[_0x3d95('0x16')](handleEntityNotFound(_0x5c15c1,null))[_0x3d95('0x16')](function(_0x3e5c8d){var _0x5a2284=[];values=_0x3e5c8d[_0x3d95('0x52')];_0x5a2284['push'](get_open_tabs('chat',_0x3e5c8d[_0x3d95('0x52')]));_0x5a2284['push'](get_open_tabs(_0x3d95('0x62'),_0x3e5c8d['dataValues']));_0x5a2284['push'](get_open_tabs(_0x3d95('0xc3'),_0x3e5c8d[_0x3d95('0x52')]));_0x5a2284['push'](get_open_tabs(_0x3d95('0x55'),_0x3e5c8d['dataValues']));_0x5a2284['push'](get_open_tabs(_0x3d95('0x53'),_0x3e5c8d['dataValues']));_0x5a2284['push'](get_open_tabs(_0x3d95('0x54'),_0x3e5c8d[_0x3d95('0x52')]));return BPromise[_0x3d95('0x56')](_0x5a2284);})[_0x3d95('0x16')](function(_0x358117){if(_0x358117){var _0x123a73=_[_0x3d95('0x34')](values[_0x3d95('0xc4')],function(_0x28280f){return{'channel':_0x3d95('0xc5'),'id':_0x28280f['id'],'createdAt':_0x28280f[_0x3d95('0xc6')]};});var _0x500ada=_['map'](values[_0x3d95('0xc7')],function(_0x21c76b){return{'channel':'FAX','id':_0x21c76b['id'],'createdAt':_0x21c76b[_0x3d95('0xc6')]};});var _0xe89f4a=_[_0x3d95('0x34')](values['OpenchannelOpenTabs'],function(_0x5a72b1){return{'channel':_0x3d95('0xc8'),'id':_0x5a72b1['id'],'createdAt':_0x5a72b1[_0x3d95('0xc6')]};});var _0x33fc5e=_[_0x3d95('0x34')](values[_0x3d95('0xc9')],function(_0x3e90d9){return{'channel':_0x3d95('0xca'),'id':_0x3e90d9['id'],'createdAt':_0x3e90d9[_0x3d95('0xc6')]};});var _0x3c16af=_['map'](values[_0x3d95('0xcb')],function(_0x4f0899){return{'channel':'SMS','id':_0x4f0899['id'],'createdAt':_0x4f0899['createdAt']};});var _0x2c10ef=_[_0x3d95('0x34')](values[_0x3d95('0xcc')],function(_0x5da00f){return{'channel':_0x3d95('0xcd'),'id':_0x5da00f['id'],'createdAt':_0x5da00f['createdAt']};});var _0x4f0996=_[_0x3d95('0xce')](_0x123a73,_0x500ada,_0xe89f4a,_0x33fc5e,_0x3c16af,_0x2c10ef);var _0x57aeff={'count':_0x4f0996[_0x3d95('0x5e')],'rows':_0x4f0996};return _0x57aeff;}else return null;})[_0x3d95('0x16')](respondWithResult(_0x5c15c1,null))[_0x3d95('0x20')](handleError(_0x5c15c1,null));};exports[_0x3d95('0xcf')]=function(_0x338700,_0x380077){var _0x276bb7={};var _0x4827a6={};var _0x262637;var _0x118660;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x338700[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x380077,null))[_0x3d95('0x16')](function(_0x216fe7){if(_0x216fe7){_0x262637=_0x216fe7;_0x4827a6[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_0x3d95('0xd0')][_0x3d95('0x3f')]);_0x4827a6[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x338700[_0x3d95('0x47')]);_0x4827a6[_0x3d95('0x5b')]=_['intersection'](_0x4827a6['model'],_0x4827a6['query']);_0x276bb7[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x4827a6[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x338700[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x276bb7['attributes']=_0x276bb7[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x276bb7[_0x3d95('0x4c')]:_0x4827a6[_0x3d95('0x59')];_0x276bb7[_0x3d95('0xd1')]=qs['sort'](_0x338700['query'][_0x3d95('0xd2')]);_0x276bb7[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0x338700['query'],_0x4827a6['filters']));if(_0x338700['query'][_0x3d95('0x33')]){_0x276bb7[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x276bb7[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x276bb7[_0x3d95('0x4c')],function(_0x5d17d3){var _0x360c2b={};_0x360c2b[_0x5d17d3]={'$like':'%'+_0x338700['query'][_0x3d95('0x33')]+'%'};return _0x360c2b;})});}_0x276bb7=_[_0x3d95('0x5f')]({},_0x276bb7,_0x338700[_0x3d95('0x60')]);return _0x262637['getContacts'](_0x276bb7);}})[_0x3d95('0x16')](function(_0x2d93c0){if(_0x2d93c0){_0x118660=_0x2d93c0[_0x3d95('0x5e')];if(_0x338700['query'][_0x3d95('0xd4')](_0x3d95('0x46'))){_0x276bb7[_0x3d95('0x4a')]=[{'model':db[_0x3d95('0xd5')],'as':_0x3d95('0xd6'),'required':![]},{'model':db['Tag'],'as':_0x3d95('0xd7'),'attributes':['id','name',_0x3d95('0xd8')],'where':_0x338700[_0x3d95('0x47')][_0x3d95('0xd9')]?{'id':_0x338700[_0x3d95('0x47')][_0x3d95('0xd9')]}:undefined,'required':_0x338700[_0x3d95('0x47')][_0x3d95('0xd9')]?!![]:![]}];}if(!_0x338700[_0x3d95('0x47')][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x276bb7[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x338700[_0x3d95('0x47')]['limit']);_0x276bb7[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x338700[_0x3d95('0x47')][_0x3d95('0x24')]);}return _0x262637['getContacts'](_0x276bb7);}})[_0x3d95('0x16')](function(_0x340e7e){if(_0x340e7e){return _0x340e7e?{'count':_0x118660,'rows':_0x340e7e}:null;}})[_0x3d95('0x16')](respondWithResult(_0x380077,null))[_0x3d95('0x20')](handleError(_0x380077,null));};exports[_0x3d95('0xdb')]=function(_0x5e97f7,_0x10418a){var _0x28def6;var _0x1c4da0={};var _0x17cee7;return db['User'][_0x3d95('0x9e')]({'where':{'id':_0x5e97f7['params']['id']},'attributes':['id',_0x3d95('0x39'),_0x3d95('0x37')]})[_0x3d95('0x16')](handleEntityNotFound(_0x10418a,null))[_0x3d95('0x16')](function(_0x3c61a1){if(!utils[_0x3d95('0xa5')](_0x5e97f7[_0x3d95('0x47')][_0x3d95('0xa4')])){throw new db['Sequelize'][(_0x3d95('0x98'))](_0x3d95('0xa6'));}_0x28def6=_0x3c61a1;var _0x21f4b3={};_0x21f4b3[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_['capitalize'](_0x5e97f7[_0x3d95('0x47')]['channel'])+_0x3d95('0xdc')]['rawAttributes']);_0x21f4b3['query']=_[_0x3d95('0x5a')](_0x5e97f7['query']);_0x21f4b3[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x21f4b3['model'],_0x21f4b3['query']);_0x1c4da0[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x21f4b3[_0x3d95('0x59')],qs['fields'](_0x5e97f7[_0x3d95('0x47')]['fields']));_0x1c4da0['attributes']=_0x1c4da0[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x1c4da0[_0x3d95('0x4c')]:_0x21f4b3[_0x3d95('0x59')];_0x1c4da0['order']=qs[_0x3d95('0xd2')](_0x5e97f7[_0x3d95('0x47')][_0x3d95('0xd2')]);_0x1c4da0[_0x3d95('0x45')]=qs['filters'](_[_0x3d95('0xd3')](_0x5e97f7[_0x3d95('0x47')],_0x21f4b3[_0x3d95('0x5b')]));if(_0x5e97f7['query'][_0x3d95('0x33')]){_0x1c4da0[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x1c4da0[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x1c4da0[_0x3d95('0x4c')],function(_0x1c01d2){var _0x23d649={};_0x23d649[_0x1c01d2]={'$like':'%'+_0x5e97f7['query'][_0x3d95('0x33')]+'%'};return _0x23d649;})});}_0x1c4da0=_[_0x3d95('0x5f')]({},_0x1c4da0,_0x5e97f7[_0x3d95('0x60')]);switch(_0x28def6[_0x3d95('0x37')]){case _0x3d95('0x2d'):return db[_['capitalize'](_0x5e97f7[_0x3d95('0x47')][_0x3d95('0xa4')])+_0x3d95('0xdc')][_0x3d95('0x4e')](_0x1c4da0);case _0x3d95('0x87'):case _0x3d95('0x30'):return _0x28def6[_0x3d95('0x2c')+_[_0x3d95('0xac')](_0x5e97f7[_0x3d95('0x47')][_0x3d95('0xa4')])+'Queues'](_0x1c4da0);default:throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))]('Unknown\x20role');}})[_0x3d95('0x16')](function(_0x2dabed){_0x17cee7=_0x2dabed[_0x3d95('0x5e')];if(!_0x5e97f7['query'][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x1c4da0[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x5e97f7[_0x3d95('0x47')][_0x3d95('0x26')]);_0x1c4da0['offset']=qs[_0x3d95('0x24')](_0x5e97f7[_0x3d95('0x47')][_0x3d95('0x24')]);}switch(_0x28def6['role']){case _0x3d95('0x2d'):return db[_['capitalize'](_0x5e97f7[_0x3d95('0x47')]['channel'])+_0x3d95('0xdc')]['findAll'](_0x1c4da0);case'user':case _0x3d95('0x30'):return _0x28def6[_0x3d95('0x2c')+_[_0x3d95('0xac')](_0x5e97f7[_0x3d95('0x47')]['channel'])+'Queues'](_0x1c4da0);}})['then'](function(_0x4c8c51){return{'count':_0x17cee7,'rows':_0x4c8c51};})['then'](respondWithResult(_0x10418a,null))[_0x3d95('0x20')](handleError(_0x10418a,null));};exports[_0x3d95('0xdd')]=function(_0x2f7db2,_0x5d978e){var _0x2b0144={};var _0x1977ed={};var _0x2f09f2;var _0x30f902;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x2f7db2[_0x3d95('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d978e,null))[_0x3d95('0x16')](function(_0x57130b){if(_0x57130b){_0x2f09f2=_0x57130b;_0x1977ed[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db['UserVoiceQueueRt']['rawAttributes']);_0x1977ed[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x2f7db2[_0x3d95('0x47')]);_0x1977ed[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x1977ed[_0x3d95('0x59')],_0x1977ed[_0x3d95('0x47')]);_0x2b0144[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x1977ed[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x2f7db2[_0x3d95('0x47')]['fields']));_0x2b0144[_0x3d95('0x4c')]=_0x2b0144[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x2b0144[_0x3d95('0x4c')]:_0x1977ed[_0x3d95('0x59')];_0x2b0144['order']=qs[_0x3d95('0xd2')](_0x2f7db2[_0x3d95('0x47')]['sort']);_0x2b0144['where']=qs[_0x3d95('0x5b')](_['pick'](_0x2f7db2[_0x3d95('0x47')],_0x1977ed['filters']));if(_0x2f7db2[_0x3d95('0x47')]['filter']){_0x2b0144[_0x3d95('0x45')]=_['merge'](_0x2b0144[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x2b0144[_0x3d95('0x4c')],function(_0xd36ef0){var _0xb0886a={};_0xb0886a[_0xd36ef0]={'$like':'%'+_0x2f7db2[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0xb0886a;})});}_0x2b0144=_['merge']({},_0x2b0144,_0x2f7db2['options']);return _0x2f09f2['getVoiceQueuesRt'](_0x2b0144);}})[_0x3d95('0x16')](function(_0x1febbd){if(_0x1febbd){_0x30f902=_0x1febbd[_0x3d95('0x5e')];if(!_0x2f7db2['query'][_0x3d95('0xd4')]('nolimit')){_0x2b0144[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x2f7db2[_0x3d95('0x47')][_0x3d95('0x26')]);_0x2b0144[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x2f7db2[_0x3d95('0x47')][_0x3d95('0x24')]);}return _0x2f09f2[_0x3d95('0xdd')](_0x2b0144);}})[_0x3d95('0x16')](function(_0x416792){if(_0x416792){return _0x416792?{'count':_0x30f902,'rows':_0x416792}:null;}})[_0x3d95('0x16')](respondWithResult(_0x5d978e,null))[_0x3d95('0x20')](handleError(_0x5d978e,null));};exports['getGroups']=function(_0x3a686a,_0x4d5c3c){var _0x15a4a1={};var _0x431275={};var _0x575d53;var _0x44fd52;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x3a686a['params']['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x4d5c3c,null))[_0x3d95('0x16')](function(_0x4534e4){if(_0x4534e4){_0x575d53=_0x4534e4;_0x431275[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_0x3d95('0xde')][_0x3d95('0x3f')]);_0x431275[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x3a686a[_0x3d95('0x47')]);_0x431275[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x431275['model'],_0x431275[_0x3d95('0x47')]);_0x15a4a1[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x431275[_0x3d95('0x59')],qs['fields'](_0x3a686a[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x15a4a1[_0x3d95('0x4c')]=_0x15a4a1[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x15a4a1[_0x3d95('0x4c')]:_0x431275[_0x3d95('0x59')];_0x15a4a1[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0x3a686a[_0x3d95('0x47')]['sort']);_0x15a4a1[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0x3a686a[_0x3d95('0x47')],_0x431275[_0x3d95('0x5b')]));if(_0x3a686a[_0x3d95('0x47')][_0x3d95('0x33')]){_0x15a4a1['where']=_[_0x3d95('0x5f')](_0x15a4a1[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x15a4a1[_0x3d95('0x4c')],function(_0x5ac44b){var _0x13cad2={};_0x13cad2[_0x5ac44b]={'$like':'%'+_0x3a686a[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x13cad2;})});}_0x15a4a1=_[_0x3d95('0x5f')]({},_0x15a4a1,_0x3a686a[_0x3d95('0x60')]);return _0x575d53[_0x3d95('0xdf')](_0x15a4a1);}})[_0x3d95('0x16')](function(_0x23e443){if(_0x23e443){_0x44fd52=_0x23e443[_0x3d95('0x5e')];if(!_0x3a686a[_0x3d95('0x47')]['hasOwnProperty'](_0x3d95('0xda'))){_0x15a4a1[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x3a686a[_0x3d95('0x47')][_0x3d95('0x26')]);_0x15a4a1[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x3a686a['query']['offset']);}return _0x575d53[_0x3d95('0xdf')](_0x15a4a1);}})[_0x3d95('0x16')](function(_0xe84068){if(_0xe84068){return _0xe84068?{'count':_0x44fd52,'rows':_0xe84068}:null;}})[_0x3d95('0x16')](respondWithResult(_0x4d5c3c,null))[_0x3d95('0x20')](handleError(_0x4d5c3c,null));};exports[_0x3d95('0xe0')]=function(_0x1d58af,_0x19333b){var _0x316966={'raw':!![],'where':{}};var _0x577d05={};var _0x27d3cd={'count':0x0,'rows':[]};return db[_0x3d95('0x4d')]['findOne']({'where':{'id':_0x1d58af['params']['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x19333b,null))[_0x3d95('0x16')](function(_0x165ac1){if(_0x165ac1){_0x577d05[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db['VoiceRecording'][_0x3d95('0x3f')]);_0x577d05['query']=_['keys'](_0x1d58af[_0x3d95('0x47')]);_0x577d05['filters']=_[_0x3d95('0x5c')](_0x577d05[_0x3d95('0x59')],_0x577d05[_0x3d95('0x47')]);_0x316966[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x577d05['model'],qs[_0x3d95('0x5d')](_0x1d58af['query'][_0x3d95('0x5d')]));_0x316966[_0x3d95('0x4c')]=_0x316966['attributes'][_0x3d95('0x5e')]?_0x316966['attributes']:_0x577d05[_0x3d95('0x59')];if(!_0x1d58af[_0x3d95('0x47')][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x316966[_0x3d95('0x26')]=qs['limit'](_0x1d58af[_0x3d95('0x47')][_0x3d95('0x26')]);_0x316966['offset']=qs[_0x3d95('0x24')](_0x1d58af[_0x3d95('0x47')][_0x3d95('0x24')]);}_0x316966['order']=qs[_0x3d95('0xd2')](_0x1d58af['query'][_0x3d95('0xd2')]);_0x316966['where']=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0x1d58af[_0x3d95('0x47')],_0x577d05['filters']));_0x316966[_0x3d95('0x45')][_0x3d95('0xe1')]=_0x165ac1['id'];if(_0x1d58af[_0x3d95('0x47')]['filter']){_0x316966[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x316966[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x316966[_0x3d95('0x4c')],function(_0x32c83f){var _0x1e2ec2={};_0x1e2ec2[_0x32c83f]={'$like':'%'+_0x1d58af[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x1e2ec2;})});}_0x316966=_[_0x3d95('0x5f')]({},_0x316966,_0x1d58af[_0x3d95('0x60')]);return db['VoiceRecording'][_0x3d95('0x27')]({'where':_0x316966[_0x3d95('0x45')]})[_0x3d95('0x16')](function(_0x41f07f){_0x27d3cd[_0x3d95('0x27')]=_0x41f07f;if(_0x1d58af[_0x3d95('0x47')][_0x3d95('0x46')]){_0x316966[_0x3d95('0x4a')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x316966);})[_0x3d95('0x16')](function(_0x7861d1){_0x27d3cd['rows']=_0x7861d1;return _0x27d3cd;});}})[_0x3d95('0x16')](respondWithFilteredResult(_0x19333b,_0x316966))[_0x3d95('0x20')](handleError(_0x19333b,null));};exports[_0x3d95('0xe2')]=function(_0x3bb7dd,_0x4babd9){var _0x430ce9={'raw':!![],'where':{}};var _0x82ee62={};var _0x38ed5d={'count':0x0,'rows':[]};return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x3bb7dd[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x4babd9,null))[_0x3d95('0x16')](function(_0x39c814){if(_0x39c814){_0x82ee62[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db['ScreenRecording']['rawAttributes']);_0x82ee62[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x3bb7dd[_0x3d95('0x47')]);_0x82ee62[_0x3d95('0x5b')]=_['intersection'](_0x82ee62[_0x3d95('0x59')],_0x82ee62['query']);_0x430ce9[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x82ee62[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x430ce9[_0x3d95('0x4c')]=_0x430ce9[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x430ce9[_0x3d95('0x4c')]:_0x82ee62[_0x3d95('0x59')];if(!_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x430ce9['limit']=qs[_0x3d95('0x26')](_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0x26')]);_0x430ce9[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0x24')]);}_0x430ce9[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0x3bb7dd['query']['sort']);_0x430ce9[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_['pick'](_0x3bb7dd[_0x3d95('0x47')],_0x82ee62[_0x3d95('0x5b')]));_0x430ce9[_0x3d95('0x45')][_0x3d95('0xe1')]=_0x39c814['id'];if(_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0x33')]){_0x430ce9[_0x3d95('0x45')]=_['merge'](_0x430ce9[_0x3d95('0x45')],{'$or':_['map'](_0x430ce9[_0x3d95('0x4c')],function(_0x159209){var _0x3edd64={};_0x3edd64[_0x159209]={'$like':'%'+_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x3edd64;})});}_0x430ce9=_['merge']({},_0x430ce9,_0x3bb7dd[_0x3d95('0x60')]);return db[_0x3d95('0xe3')][_0x3d95('0x27')]({'where':_0x430ce9[_0x3d95('0x45')]})[_0x3d95('0x16')](function(_0xf53681){_0x38ed5d[_0x3d95('0x27')]=_0xf53681;if(_0x3bb7dd[_0x3d95('0x47')][_0x3d95('0x46')]){_0x430ce9['include']=[{'all':!![]}];}return db[_0x3d95('0xe3')][_0x3d95('0x4e')](_0x430ce9);})[_0x3d95('0x16')](function(_0x45d9f1){_0x38ed5d[_0x3d95('0x51')]=_0x45d9f1;return _0x38ed5d;});}})[_0x3d95('0x16')](respondWithFilteredResult(_0x4babd9,_0x430ce9))[_0x3d95('0x20')](handleError(_0x4babd9,null));};exports[_0x3d95('0xe4')]=function(_0x219dae,_0x20fd47){var _0x2e20cc={};var _0xd17fa5={};var _0x46135a;var _0x39ed00;return db[_0x3d95('0x4d')]['findOne']({'where':{'id':_0x219dae['params']['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x20fd47,null))[_0x3d95('0x16')](function(_0x488640){if(_0x488640){_0x46135a=_0x488640;_0xd17fa5[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_0x3d95('0xe5')][_0x3d95('0x3f')]);_0xd17fa5[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x219dae['query']);_0xd17fa5[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0xd17fa5[_0x3d95('0x59')],_0xd17fa5['query']);_0x2e20cc[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0xd17fa5['model'],qs[_0x3d95('0x5d')](_0x219dae[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x2e20cc['attributes']=_0x2e20cc[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x2e20cc[_0x3d95('0x4c')]:_0xd17fa5[_0x3d95('0x59')];_0x2e20cc[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0x219dae[_0x3d95('0x47')][_0x3d95('0xd2')]);_0x2e20cc[_0x3d95('0x45')]=qs['filters'](_[_0x3d95('0xd3')](_0x219dae[_0x3d95('0x47')],_0xd17fa5['filters']));if(_0x219dae[_0x3d95('0x47')][_0x3d95('0x33')]){_0x2e20cc[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x2e20cc[_0x3d95('0x45')],{'$or':_['map'](_0x2e20cc['attributes'],function(_0x10694d){var _0x2f76a4={};_0x2f76a4[_0x10694d]={'$like':'%'+_0x219dae[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x2f76a4;})});}_0x2e20cc=_[_0x3d95('0x5f')]({},_0x2e20cc,_0x219dae[_0x3d95('0x60')]);return _0x46135a[_0x3d95('0xe4')](_0x2e20cc);}})['then'](function(_0x46132c){if(_0x46132c){_0x39ed00=_0x46132c['length'];if(!_0x219dae[_0x3d95('0x47')][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x2e20cc[_0x3d95('0x26')]=qs['limit'](_0x219dae[_0x3d95('0x47')][_0x3d95('0x26')]);_0x2e20cc[_0x3d95('0x24')]=qs['offset'](_0x219dae[_0x3d95('0x47')][_0x3d95('0x24')]);}return _0x46135a['getChatInteractions'](_0x2e20cc);}})['then'](function(_0x438dbc){if(_0x438dbc){return _0x438dbc?{'count':_0x39ed00,'rows':_0x438dbc}:null;}})[_0x3d95('0x16')](respondWithResult(_0x20fd47,null))[_0x3d95('0x20')](handleError(_0x20fd47,null));};exports[_0x3d95('0xe6')]=function(_0x20ab1c,_0x4fc308){var _0x1c6dff={};var _0x2f3669={};var _0x5f50a3;var _0x36a5eb;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x20ab1c[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x4fc308,null))[_0x3d95('0x16')](function(_0x4cbc50){if(_0x4cbc50){_0x5f50a3=_0x4cbc50;_0x2f3669[_0x3d95('0x59')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x2f3669[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x20ab1c[_0x3d95('0x47')]);_0x2f3669[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x2f3669[_0x3d95('0x59')],_0x2f3669[_0x3d95('0x47')]);_0x1c6dff[_0x3d95('0x4c')]=_['intersection'](_0x2f3669['model'],qs[_0x3d95('0x5d')](_0x20ab1c[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x1c6dff[_0x3d95('0x4c')]=_0x1c6dff[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x1c6dff['attributes']:_0x2f3669['model'];_0x1c6dff[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0x20ab1c[_0x3d95('0x47')]['sort']);_0x1c6dff[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0x20ab1c['query'],_0x2f3669[_0x3d95('0x5b')]));if(_0x20ab1c[_0x3d95('0x47')][_0x3d95('0x33')]){_0x1c6dff['where']=_['merge'](_0x1c6dff['where'],{'$or':_['map'](_0x1c6dff[_0x3d95('0x4c')],function(_0x474783){var _0xed9a8b={};_0xed9a8b[_0x474783]={'$like':'%'+_0x20ab1c[_0x3d95('0x47')]['filter']+'%'};return _0xed9a8b;})});}_0x1c6dff=_[_0x3d95('0x5f')]({},_0x1c6dff,_0x20ab1c[_0x3d95('0x60')]);return _0x5f50a3[_0x3d95('0xe6')](_0x1c6dff);}})[_0x3d95('0x16')](function(_0x504037){if(_0x504037){_0x36a5eb=_0x504037[_0x3d95('0x5e')];if(!_0x20ab1c[_0x3d95('0x47')]['hasOwnProperty'](_0x3d95('0xda'))){_0x1c6dff[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x20ab1c[_0x3d95('0x47')][_0x3d95('0x26')]);_0x1c6dff[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x20ab1c[_0x3d95('0x47')][_0x3d95('0x24')]);}return _0x5f50a3[_0x3d95('0xe6')](_0x1c6dff);}})[_0x3d95('0x16')](function(_0x2e7678){if(_0x2e7678){return _0x2e7678?{'count':_0x36a5eb,'rows':_0x2e7678}:null;}})[_0x3d95('0x16')](respondWithResult(_0x4fc308,null))['catch'](handleError(_0x4fc308,null));};exports['getMailInteractions']=function(_0x17f200,_0x2d6cc5){var _0x4d8b72={'raw':!![],'where':{}};var _0x485c4d={};var _0xe321fa={'count':0x0,'rows':[]};return db[_0x3d95('0x4d')]['findOne']({'where':{'id':_0x17f200['params']['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x2d6cc5,null))[_0x3d95('0x16')](function(_0x4aea81){if(_0x4aea81){_0x485c4d[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_0x3d95('0xe7')][_0x3d95('0x3f')]);_0x485c4d[_0x3d95('0x47')]=_['keys'](_0x17f200[_0x3d95('0x47')]);_0x485c4d['filters']=_[_0x3d95('0x5c')](_0x485c4d[_0x3d95('0x59')],_0x485c4d['query']);_0x4d8b72['attributes']=_[_0x3d95('0x5c')](_0x485c4d['model'],qs[_0x3d95('0x5d')](_0x17f200[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x4d8b72[_0x3d95('0x4c')]=_0x4d8b72['attributes'][_0x3d95('0x5e')]?_0x4d8b72[_0x3d95('0x4c')]:_0x485c4d[_0x3d95('0x59')];if(!_0x17f200[_0x3d95('0x47')][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x4d8b72['limit']=qs[_0x3d95('0x26')](_0x17f200[_0x3d95('0x47')][_0x3d95('0x26')]);_0x4d8b72['offset']=qs['offset'](_0x17f200[_0x3d95('0x47')][_0x3d95('0x24')]);}_0x4d8b72[_0x3d95('0xd1')]=qs['sort'](_0x17f200[_0x3d95('0x47')]['sort']);_0x4d8b72[_0x3d95('0x45')]=qs['filters'](_[_0x3d95('0xd3')](_0x17f200['query'],_0x485c4d[_0x3d95('0x5b')]));_0x4d8b72[_0x3d95('0x45')][_0x3d95('0xe1')]=_0x4aea81['id'];if(_0x17f200[_0x3d95('0x47')][_0x3d95('0x33')]){_0x4d8b72[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x4d8b72[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x4d8b72[_0x3d95('0x4c')],function(_0x2c70e9){var _0x1719df={};_0x1719df[_0x2c70e9]={'$like':'%'+_0x17f200[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x1719df;})});}_0x4d8b72=_['merge']({},_0x4d8b72,_0x17f200['options']);return db[_0x3d95('0xe7')]['count']({'where':_0x4d8b72[_0x3d95('0x45')]})[_0x3d95('0x16')](function(_0x4e8fcb){_0xe321fa[_0x3d95('0x27')]=_0x4e8fcb;if(_0x17f200['query']['includeAll']){_0x4d8b72[_0x3d95('0x4a')]=[{'all':!![]}];}return db[_0x3d95('0xe7')][_0x3d95('0x4e')](_0x4d8b72);})[_0x3d95('0x16')](function(_0x226030){_0xe321fa[_0x3d95('0x51')]=_0x226030;return _0xe321fa;});}})[_0x3d95('0x16')](respondWithFilteredResult(_0x2d6cc5,_0x4d8b72))['catch'](handleError(_0x2d6cc5,null));};exports[_0x3d95('0xe8')]=function(_0x5c1826,_0x1ded0a){var _0x3e5562={};var _0x5b8fe0={};var _0x2ab804;var _0x12d946;return db['User'][_0x3d95('0x9e')]({'where':{'id':_0x5c1826[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x1ded0a,null))['then'](function(_0x4c96bb){if(_0x4c96bb){_0x2ab804=_0x4c96bb;_0x5b8fe0[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db['SmsInteraction'][_0x3d95('0x3f')]);_0x5b8fe0[_0x3d95('0x47')]=_['keys'](_0x5c1826[_0x3d95('0x47')]);_0x5b8fe0[_0x3d95('0x5b')]=_['intersection'](_0x5b8fe0[_0x3d95('0x59')],_0x5b8fe0[_0x3d95('0x47')]);_0x3e5562[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x5b8fe0[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x5c1826[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x3e5562['attributes']=_0x3e5562['attributes'][_0x3d95('0x5e')]?_0x3e5562[_0x3d95('0x4c')]:_0x5b8fe0[_0x3d95('0x59')];_0x3e5562[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0x5c1826[_0x3d95('0x47')][_0x3d95('0xd2')]);_0x3e5562[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0x5c1826[_0x3d95('0x47')],_0x5b8fe0[_0x3d95('0x5b')]));if(_0x5c1826[_0x3d95('0x47')][_0x3d95('0x33')]){_0x3e5562[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x3e5562[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x3e5562[_0x3d95('0x4c')],function(_0x451bb7){var _0x5951bb={};_0x5951bb[_0x451bb7]={'$like':'%'+_0x5c1826['query']['filter']+'%'};return _0x5951bb;})});}_0x3e5562=_['merge']({},_0x3e5562,_0x5c1826[_0x3d95('0x60')]);return _0x2ab804[_0x3d95('0xe8')](_0x3e5562);}})[_0x3d95('0x16')](function(_0x2e60ff){if(_0x2e60ff){_0x12d946=_0x2e60ff[_0x3d95('0x5e')];if(!_0x5c1826[_0x3d95('0x47')][_0x3d95('0xd4')]('nolimit')){_0x3e5562[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x5c1826[_0x3d95('0x47')][_0x3d95('0x26')]);_0x3e5562[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x5c1826[_0x3d95('0x47')]['offset']);}return _0x2ab804[_0x3d95('0xe8')](_0x3e5562);}})[_0x3d95('0x16')](function(_0x4597b7){if(_0x4597b7){return _0x4597b7?{'count':_0x12d946,'rows':_0x4597b7}:null;}})['then'](respondWithResult(_0x1ded0a,null))[_0x3d95('0x20')](handleError(_0x1ded0a,null));};exports['getFaxInteractions']=function(_0x28e004,_0x3adbec){var _0x23af48={};var _0x577d85={};var _0x4736ba;var _0x9f8035;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x28e004[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x3adbec,null))[_0x3d95('0x16')](function(_0x177ae9){if(_0x177ae9){_0x4736ba=_0x177ae9;_0x577d85[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_0x3d95('0xe9')][_0x3d95('0x3f')]);_0x577d85[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x28e004['query']);_0x577d85[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x577d85[_0x3d95('0x59')],_0x577d85[_0x3d95('0x47')]);_0x23af48[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x577d85[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x28e004[_0x3d95('0x47')]['fields']));_0x23af48['attributes']=_0x23af48['attributes']['length']?_0x23af48[_0x3d95('0x4c')]:_0x577d85[_0x3d95('0x59')];_0x23af48[_0x3d95('0xd1')]=qs['sort'](_0x28e004[_0x3d95('0x47')]['sort']);_0x23af48['where']=qs['filters'](_[_0x3d95('0xd3')](_0x28e004[_0x3d95('0x47')],_0x577d85[_0x3d95('0x5b')]));if(_0x28e004[_0x3d95('0x47')][_0x3d95('0x33')]){_0x23af48[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x23af48[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x23af48['attributes'],function(_0x1598e2){var _0x53d346={};_0x53d346[_0x1598e2]={'$like':'%'+_0x28e004['query'][_0x3d95('0x33')]+'%'};return _0x53d346;})});}_0x23af48=_['merge']({},_0x23af48,_0x28e004[_0x3d95('0x60')]);return _0x4736ba[_0x3d95('0xea')](_0x23af48);}})[_0x3d95('0x16')](function(_0x3c2396){if(_0x3c2396){_0x9f8035=_0x3c2396['length'];if(!_0x28e004[_0x3d95('0x47')][_0x3d95('0xd4')](_0x3d95('0xda'))){_0x23af48[_0x3d95('0x26')]=qs[_0x3d95('0x26')](_0x28e004[_0x3d95('0x47')]['limit']);_0x23af48[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0x28e004[_0x3d95('0x47')][_0x3d95('0x24')]);}return _0x4736ba[_0x3d95('0xea')](_0x23af48);}})[_0x3d95('0x16')](function(_0x558947){if(_0x558947){return _0x558947?{'count':_0x9f8035,'rows':_0x558947}:null;}})[_0x3d95('0x16')](respondWithResult(_0x3adbec,null))[_0x3d95('0x20')](handleError(_0x3adbec,null));};exports[_0x3d95('0xeb')]=function(_0xe83dd8,_0x47a1be){var _0x2add31={};var _0x4ba733={};var _0x153c70;var _0x3942d7;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0xe83dd8[_0x3d95('0x58')]['id']}})[_0x3d95('0x16')](handleEntityNotFound(_0x47a1be,null))['then'](function(_0x27a630){if(_0x27a630){_0x153c70=_0x27a630;_0x4ba733[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db['WhatsappInteraction'][_0x3d95('0x3f')]);_0x4ba733[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0xe83dd8[_0x3d95('0x47')]);_0x4ba733[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x4ba733[_0x3d95('0x59')],_0x4ba733[_0x3d95('0x47')]);_0x2add31[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x4ba733['model'],qs[_0x3d95('0x5d')](_0xe83dd8[_0x3d95('0x47')][_0x3d95('0x5d')]));_0x2add31[_0x3d95('0x4c')]=_0x2add31[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x2add31[_0x3d95('0x4c')]:_0x4ba733[_0x3d95('0x59')];_0x2add31[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0xe83dd8['query'][_0x3d95('0xd2')]);_0x2add31[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0xe83dd8[_0x3d95('0x47')],_0x4ba733[_0x3d95('0x5b')]));if(_0xe83dd8[_0x3d95('0x47')][_0x3d95('0x33')]){_0x2add31[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x2add31[_0x3d95('0x45')],{'$or':_['map'](_0x2add31['attributes'],function(_0x54782e){var _0x7dd6fe={};_0x7dd6fe[_0x54782e]={'$like':'%'+_0xe83dd8[_0x3d95('0x47')]['filter']+'%'};return _0x7dd6fe;})});}_0x2add31=_[_0x3d95('0x5f')]({},_0x2add31,_0xe83dd8['options']);return _0x153c70[_0x3d95('0xeb')](_0x2add31);}})[_0x3d95('0x16')](function(_0x2c8fc5){if(_0x2c8fc5){_0x3942d7=_0x2c8fc5[_0x3d95('0x5e')];if(!_0xe83dd8[_0x3d95('0x47')][_0x3d95('0xd4')]('nolimit')){_0x2add31[_0x3d95('0x26')]=qs['limit'](_0xe83dd8[_0x3d95('0x47')][_0x3d95('0x26')]);_0x2add31[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0xe83dd8[_0x3d95('0x47')][_0x3d95('0x24')]);}return _0x153c70[_0x3d95('0xeb')](_0x2add31);}})[_0x3d95('0x16')](function(_0x40b520){if(_0x40b520){return _0x40b520?{'count':_0x3942d7,'rows':_0x40b520}:null;}})[_0x3d95('0x16')](respondWithResult(_0x47a1be,null))[_0x3d95('0x20')](handleError(_0x47a1be,null));};exports[_0x3d95('0xec')]=function(_0x54c3ee,_0x46de58,_0x2cb273){var _0x4b0475;var _0x24f971;var _0x2bf1da;var _0x3140b7=!_[_0x3d95('0x6f')](_0x54c3ee[_0x3d95('0x58')]['id'])?_0x54c3ee['params']['id']:!_[_0x3d95('0x6f')](_0x54c3ee['user']['id'])?_0x54c3ee[_0x3d95('0x87')]['id']:null;return db['User'][_0x3d95('0x38')]({'where':{'id':_0x3140b7,'role':{'$or':[_0x3d95('0x2d'),'user',_0x3d95('0x30')]}},'attributes':['id','name',_0x3d95('0xed'),_0x3d95('0xee'),_0x3d95('0x37'),_0x3d95('0x70'),_0x3d95('0xef')]})[_0x3d95('0x16')](function(_0x4ce4fb){if(_0x4ce4fb){if(_0x4ce4fb['role']==='agent'){_0x4b0475=_0x4ce4fb;if(_0x54c3ee[_0x3d95('0x64')]['interface']){_0x2bf1da=util[_0x3d95('0xf0')](_0x3d95('0xf1'),_0x4b0475[_0x54c3ee[_0x3d95('0x64')][_0x3d95('0xb2')]]);}else if(_0x54c3ee[_0x3d95('0x64')][_0x3d95('0xf2')]){_0x2bf1da=util[_0x3d95('0xf0')](_0x3d95('0xf3'),_0x54c3ee['body']['intrf']);}else{_0x2bf1da=util[_0x3d95('0xf0')](_0x3d95('0xf3'),_0x4b0475[_0x3d95('0x39')]);}socket['to'](util[_0x3d95('0xf0')](_0x3d95('0xf4'),_0x4b0475[_0x3d95('0x39')]))[_0x3d95('0x29')]('user:forcelogout',{'user':{'id':_0x4b0475['id'],'name':_0x4b0475[_0x3d95('0x39')]},'ip':_0x54c3ee['headers'][_0x3d95('0xf5')]||_0x54c3ee[_0x3d95('0xf6')]['remoteAddress']||_0x54c3ee['socket'][_0x3d95('0xf7')]||_0x54c3ee[_0x3d95('0xf6')]['socket']['remoteAddress']});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x4b0475['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x3d95('0x98'))](_0x3d95('0xf8'));}})['then'](function(){if(_0x4b0475){return _0x4b0475[_0x3d95('0xf9')]({'raw':!![]});}})['then'](function(_0x5abd3e){if(_0x4b0475){var _0x3d4517=[];if(_0x5abd3e){_0x24f971=_0x5abd3e;if(_0x24f971['length']){for(var _0x3c2ed9=0x0;_0x3c2ed9<_0x24f971[_0x3d95('0x5e')];_0x3c2ed9++){_0x3d4517['push']({'membername':_0x4b0475[_0x3d95('0x39')],'UserId':_0x4b0475['id'],'queue_name':_0x24f971[_0x3c2ed9][_0x3d95('0x39')],'VoiceQueueId':_0x24f971[_0x3c2ed9]['id'],'interface':_0x2bf1da,'paused':_0x4b0475['loginInPause']||![],'penalty':_0x24f971[_0x3c2ed9][_0x3d95('0xfa')]||0x0});}return BPromise[_0x3d95('0x91')](_0x3d4517,function(_0x4a52d8){return db['UserVoiceQueueRt'][_0x3d95('0xb4')](_0x4a52d8);});}}}})[_0x3d95('0x16')](function(){if(_0x4b0475){return db[_0x3d95('0xfb')][_0x3d95('0x4e')]({'where':{'membername':_0x4b0475[_0x3d95('0x39')],'exitAt':null}});}})[_0x3d95('0x16')](function(_0x3d0213){if(_0x4b0475){var _0x1ba4dc=[];_0x3d0213['forEach'](function(_0x2d0f47){_0x1ba4dc[_0x3d95('0x50')](_0x2d0f47[_0x3d95('0x63')]({'exitAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc'))}));});return BPromise[_0x3d95('0x56')](_0x1ba4dc);}})['then'](function(){if(_0x4b0475){var _0x410e3d=[];var _0x447f41=[];var _0x75bc2c=utils['getChannels']();var _0x1602c1={'membername':_0x4b0475[_0x3d95('0x39')],'interface':_0x2bf1da,'enterAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc')),'role':_0x4b0475[_0x3d95('0x37')],'internal':_0x4b0475[_0x3d95('0x70')]};_0x75bc2c[_0x3d95('0xfd')](function(_0x51152a){_0x410e3d[_0x3d95('0x50')](_['merge']({'channel':_0x51152a,'type':'LOGIN','data1':_0x54c3ee[_0x3d95('0x64')][_0x3d95('0xfe')],'data2':_0x2bf1da},_0x1602c1));if(_0x4b0475[_0x3d95('0xef')]){_0x447f41['push'](_[_0x3d95('0x5f')]({'channel':_0x51152a,'type':_0x3d95('0xff'),'data1':_0x3d95('0x100')},_0x1602c1));}});return db['MemberReport'][_0x3d95('0x8e')](_0x410e3d[_0x3d95('0xce')](_0x447f41),{'individualHooks':!![]});}})[_0x3d95('0x16')](function(){if(_0x4b0475){return _0x4b0475[_0x3d95('0x63')]({'online':!![],'lastLoginAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc')),'voicePause':_0x4b0475[_0x3d95('0xef')]||![],'mailPause':_0x4b0475[_0x3d95('0xef')]||![],'chatPause':_0x4b0475['loginInPause']||![],'faxPause':_0x4b0475[_0x3d95('0xef')]||![],'smsPause':_0x4b0475[_0x3d95('0xef')]||![],'openchannelPause':_0x4b0475[_0x3d95('0xef')]||![],'whatsappPause':_0x4b0475[_0x3d95('0xef')]||![],'pauseType':_0x4b0475['loginInPause']?_0x3d95('0x100'):null,'interface':_0x2bf1da,'lastPauseAt':moment()['format'](_0x3d95('0xfc'))});}})['then'](function(_0x596c23){if(_0x54c3ee[_0x3d95('0x101')]){return _0x2cb273();}else{return BPromise['resolve'](_0x596c23)[_0x3d95('0x16')](respondWithResult(_0x46de58,null));}})[_0x3d95('0x20')](handleError(_0x46de58,null));};exports[_0x3d95('0x102')]=function(_0x423ed0,_0x46ca58){var _0xf98d13;return db[_0x3d95('0x4d')][_0x3d95('0x38')]({'where':{'id':_0x423ed0[_0x3d95('0x58')]['id'],'role':_0x3d95('0x30')},'attributes':['id','name',_0x3d95('0x37')]})[_0x3d95('0x16')](handleEntityNotFound(_0x46ca58,null))[_0x3d95('0x16')](function(_0x467d17){if(_0x467d17){_0xf98d13=_0x467d17;return db[_0x3d95('0xb3')][_0x3d95('0x2b')]({'where':{'membername':_0xf98d13[_0x3d95('0x39')]},'individualHooks':!![]});}})[_0x3d95('0x16')](function(){return db['MemberReport'][_0x3d95('0x4e')]({'where':{'membername':_0xf98d13['name'],'exitAt':null}});})['then'](function(_0x24f032){var _0x14e81a=[];_0x24f032[_0x3d95('0xfd')](function(_0x352667){_0x14e81a[_0x3d95('0x50')](_0x352667[_0x3d95('0x63')]({'exitAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc'))}));});return BPromise[_0x3d95('0x56')](_0x14e81a);})[_0x3d95('0x16')](function(){return _0xf98d13[_0x3d95('0x63')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3d95('0x16')](respondWithResult(_0x46ca58,null))[_0x3d95('0x20')](handleError(_0x46ca58,null));};exports[_0x3d95('0x103')]=function(_0x592320,_0x5115ed){var _0x2d7548;return db[_0x3d95('0xb3')]['update']({'paused':0x1},{'where':{'UserId':_0x592320[_0x3d95('0x58')]['id']},'individualHooks':!![]})[_0x3d95('0x16')](function(){return db[_0x3d95('0x4d')][_0x3d95('0x38')]({'where':{'id':_0x592320[_0x3d95('0x58')]['id'],'role':'agent'},'attributes':['id','name',_0x3d95('0x37'),_0x3d95('0x70'),'interface']});})[_0x3d95('0x16')](handleEntityNotFound(_0x5115ed,null))['then'](function(_0x5c9628){if(_0x5c9628){_0x2d7548=_0x5c9628;return respondWithRpcPromise(_0x3d95('0x104'),_0x3d95('0x103'),{'id':_0x2d7548['id'],'name':_0x2d7548[_0x3d95('0x39')],'pause':!![]});}})[_0x3d95('0x16')](function(){if(_0x2d7548){return db['MemberReport'][_0x3d95('0x4e')]({'where':{'membername':_0x2d7548[_0x3d95('0x39')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x114de6){if(_0x114de6[_0x3d95('0x5e')]){var _0xf3f267=moment()[_0x3d95('0xf0')](_0x3d95('0xfc'));for(var _0x3fab7c=0x0,_0x9a533f=_0x114de6[_0x3d95('0x5e')];_0x3fab7c<_0x9a533f;_0x3fab7c++){_0x114de6[_0x3fab7c][_0x3d95('0x105')]({'exitAt':_0xf3f267});}}})[_0x3d95('0x16')](function(){var _0xb648e2=[];var _0x1e4377=utils['getChannels']();_0x1e4377[_0x3d95('0xfd')](function(_0x282185){_0xb648e2['push']({'channel':_0x282185,'membername':_0x2d7548['name'],'interface':_[_0x3d95('0x6f')](_0x2d7548[_0x3d95('0xb2')])?util[_0x3d95('0xf0')](_0x3d95('0xf3'),_0x2d7548['name']):_0x2d7548[_0x3d95('0xb2')],'type':'PAUSE','enterAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc')),'data1':_0x592320[_0x3d95('0x64')][_0x3d95('0x41')]||_0x3d95('0x106'),'role':_0x2d7548['role'],'internal':_0x2d7548[_0x3d95('0x70')]});});return db[_0x3d95('0xfb')][_0x3d95('0x8e')](_0xb648e2,{'individualHooks':!![]});})[_0x3d95('0x16')](function(){return _0x2d7548['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x592320['body'][_0x3d95('0x41')]||_0x3d95('0x106'),'lastPauseAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc'))});})[_0x3d95('0x16')](respondWithResult(_0x5115ed,null))[_0x3d95('0x20')](handleError(_0x5115ed,null));};exports[_0x3d95('0x107')]=function(_0xe4a9fb,_0x41888d){var _0x17a0e7;return db['User']['find']({'where':{'id':_0xe4a9fb[_0x3d95('0x58')]['id']},'attributes':['id',_0x3d95('0x39'),_0x3d95('0x37'),'voicePause',_0x3d95('0x108'),_0x3d95('0x109'),_0x3d95('0x10a'),_0x3d95('0x10b'),'smsPause',_0x3d95('0x10c'),_0x3d95('0x10d'),_0x3d95('0x10e')]})[_0x3d95('0x16')](handleEntityNotFound(_0x41888d,null))[_0x3d95('0x16')](function(_0x58e041){if(_0x58e041){_0x17a0e7=_0x58e041;if(_0xe4a9fb[_0x3d95('0x64')][_0x3d95('0xa4')]&&!utils['isValidChannel'](_0xe4a9fb[_0x3d95('0x64')][_0x3d95('0xa4')])){throw new db[(_0x3d95('0x97'))][(_0x3d95('0x98'))](_0x3d95('0xa6'));}switch(_0xe4a9fb[_0x3d95('0x64')][_0x3d95('0xa4')]){case _0x3d95('0xb0'):return respondWithRpcPromise(_0x3d95('0x104'),_0x3d95('0x107'),{'id':_0x17a0e7['id'],'name':_0x17a0e7[_0x3d95('0x39')],'pause':![]})[_0x3d95('0x16')](function(){return db[_0x3d95('0xb3')][_0x3d95('0x63')]({'paused':0x0},{'where':{'UserId':_0x17a0e7['id']},'individualHooks':!![]});})[_0x3d95('0x16')](function(){return db[_0x3d95('0xfb')]['find']({'where':{'channel':_0xe4a9fb[_0x3d95('0x64')][_0x3d95('0xa4')],'membername':_0x17a0e7[_0x3d95('0x39')],'type':'PAUSE','exitAt':null}});})[_0x3d95('0x16')](function(_0x28c938){if(_0x28c938){return _0x28c938[_0x3d95('0x63')]({'exitAt':moment()['format'](_0x3d95('0xfc')),'data2':_0x3d95('0x10f')},{'individualHooks':!![]});}return null;})[_0x3d95('0x16')](function(){return _0x17a0e7[_0x3d95('0x63')]({'voicePause':![]});});case _0x3d95('0x54'):case'chat':case'fax':case'sms':case'whatsapp':case _0x3d95('0xc3'):return db[_0x3d95('0xfb')][_0x3d95('0x38')]({'where':{'channel':_0xe4a9fb[_0x3d95('0x64')][_0x3d95('0xa4')],'membername':_0x17a0e7[_0x3d95('0x39')],'type':'PAUSE','exitAt':null}})['then'](function(_0x556b44){if(_0x556b44){return _0x556b44[_0x3d95('0x63')]({'exitAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc')),'data2':_0x3d95('0x10f')},{'individualHooks':!![]});}return null;})[_0x3d95('0x16')](function(){var _0x1020db={};_[_0x3d95('0x28')](_0x1020db,util[_0x3d95('0xf0')](_0x3d95('0x110'),_0xe4a9fb['body']['channel'],_0x3d95('0x111')),![]);return _0x17a0e7['update'](_0x1020db);});default:return respondWithRpcPromise(_0x3d95('0x104'),'unpause',{'id':_0x17a0e7['id'],'name':_0x17a0e7[_0x3d95('0x39')],'pause':![]})[_0x3d95('0x16')](function(){return db['UserVoiceQueueRt'][_0x3d95('0x63')]({'paused':0x0},{'where':{'UserId':_0x17a0e7['id']}});})[_0x3d95('0x16')](function(){return db[_0x3d95('0xfb')][_0x3d95('0x4e')]({'where':{'membername':_0x17a0e7[_0x3d95('0x39')],'type':_0x3d95('0xff'),'exitAt':null}});})[_0x3d95('0x16')](function(_0x1a7b5f){var _0xf371a7=[];_0x1a7b5f['forEach'](function(_0x123dfb){_0xf371a7[_0x3d95('0x50')](_0x123dfb[_0x3d95('0x63')]({'exitAt':moment()[_0x3d95('0xf0')](_0x3d95('0xfc')),'data2':_0x3d95('0x10f')}));});return BPromise['all'](_0xf371a7);})[_0x3d95('0x16')](function(){return _0x17a0e7[_0x3d95('0x63')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x3d95('0x16')](respondWithResult(_0x41888d,null))[_0x3d95('0x20')](handleError(_0x41888d,null));};exports[_0x3d95('0x112')]=function(_0x53d334,_0x226659){var _0x2ec221={};var _0x447309={};var _0x106df1;var _0x2b294d;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x53d334[_0x3d95('0x58')]['id']}})['then'](handleEntityNotFound(_0x226659,null))[_0x3d95('0x16')](function(_0xe4ff7a){if(_0xe4ff7a){_0x106df1=_0xe4ff7a;_0x447309[_0x3d95('0x59')]=_[_0x3d95('0x5a')](db[_0x3d95('0x113')][_0x3d95('0x3f')]);_0x447309[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x53d334['query']);_0x447309[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x447309['model'],_0x447309[_0x3d95('0x47')]);_0x2ec221[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x447309[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x53d334[_0x3d95('0x47')]['fields']));_0x2ec221[_0x3d95('0x4c')]=_0x2ec221[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x2ec221[_0x3d95('0x4c')]:_0x447309[_0x3d95('0x59')];_0x2ec221[_0x3d95('0xd1')]=qs[_0x3d95('0xd2')](_0x53d334[_0x3d95('0x47')][_0x3d95('0xd2')]);_0x2ec221[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_[_0x3d95('0xd3')](_0x53d334['query'],_0x447309[_0x3d95('0x5b')]));if(_0x53d334[_0x3d95('0x47')][_0x3d95('0x33')]){_0x2ec221[_0x3d95('0x45')]=_['merge'](_0x2ec221['where'],{'$or':_[_0x3d95('0x34')](_0x2ec221[_0x3d95('0x4c')],function(_0x31797d){var _0xa32929={};_0xa32929[_0x31797d]={'$like':'%'+_0x53d334['query']['filter']+'%'};return _0xa32929;})});}_0x2ec221=_[_0x3d95('0x5f')]({},_0x2ec221,_0x53d334[_0x3d95('0x60')]);return _0x106df1[_0x3d95('0x112')](_0x2ec221);}})[_0x3d95('0x16')](function(_0x2746ab){if(_0x2746ab){_0x2b294d=_0x2746ab['length'];if(!_0x53d334[_0x3d95('0x47')][_0x3d95('0xd4')]('nolimit')){_0x2ec221['limit']=qs[_0x3d95('0x26')](_0x53d334['query'][_0x3d95('0x26')]);_0x2ec221[_0x3d95('0x24')]=qs['offset'](_0x53d334['query']['offset']);}return _0x106df1[_0x3d95('0x112')](_0x2ec221);}})[_0x3d95('0x16')](function(_0x2fcd96){if(_0x2fcd96){return _0x2fcd96?{'count':_0x2b294d,'rows':_0x2fcd96}:null;}})[_0x3d95('0x16')](respondWithResult(_0x226659,null))[_0x3d95('0x20')](handleError(_0x226659,null));};exports[_0x3d95('0x114')]=function(_0x5279bb,_0x1bcf9b){var _0x122622=_0x5279bb[_0x3d95('0x58')]['id'];var _0x1ff562=_0x5279bb[_0x3d95('0x64')]?_0x5279bb['body'][_0x3d95('0x67')]:null;var _0x3989f0=[];return Promise[_0x3d95('0x115')]()[_0x3d95('0x16')](function(){if(!_0x1ff562)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x3d95('0x16')](function(){return db['User'][_0x3d95('0x9e')]({'where':{'id':_0x122622}});})[_0x3d95('0x16')](function(_0x29ba05){if(!_0x29ba05)throw new APINotFoundError(util['format'](_0x3d95('0x116'),_0x5279bb[_0x3d95('0x58')]['id']));return db['sequelize'][_0x3d95('0x117')](function(_0x2caa94){return _0x29ba05[_0x3d95('0x114')](_0x1ff562,{'transaction':_0x2caa94})[_0x3d95('0x16')](function(){return db[_0x3d95('0x113')][_0x3d95('0x4e')]({'where':{'id':{'$in':_0x1ff562}}});})[_0x3d95('0x16')](function(_0x2dceb3){var _0x38a63e=_[_0x3d95('0x34')](_0x2dceb3,function(_0x3cf33a){return _0x3cf33a['getAssociatedQueues']();});return Promise[_0x3d95('0x56')](_0x38a63e);})[_0x3d95('0x16')](function(_0x137de4){_0x3989f0=_[_0x3d95('0x118')](_0x137de4);var _0x419add=_['map'](_0x3989f0,function(_0x4959f7){return _0x4959f7[_0x3d95('0x119')](_0x29ba05['id'],{'transaction':_0x2caa94});});return Promise[_0x3d95('0x56')](_0x419add);})['then'](function(){if(!_0x29ba05['online'])return;var _0x49e732=_[_0x3d95('0x33')](_0x3989f0,function(_0x5b52d3){return _0x5b52d3['getDataValue'](_0x3d95('0xa4'))===_0x3d95('0x11a');});var _0x4b6e77=_[_0x3d95('0x34')](_0x49e732,function(_0x499730){return db[_0x3d95('0xb3')][_0x3d95('0xb4')]({'membername':_0x29ba05['name'],'UserId':_0x29ba05['id'],'queue_name':_0x499730['name'],'VoiceQueueId':_0x499730['id'],'interface':_[_0x3d95('0x6f')](_0x29ba05[_0x3d95('0xb2')])?util['format'](_0x3d95('0xf3'),_0x29ba05[_0x3d95('0x39')]):_0x29ba05['interface'],'paused':_0x29ba05[_0x3d95('0x11b')]||![],'penalty':_0x29ba05[_0x3d95('0xaa')]},{'transaction':_0x2caa94});});return Promise['all'](_0x4b6e77);})[_0x3d95('0x16')](function(){return db[_0x3d95('0x11c')][_0x3d95('0x4e')]({'where':{'teamId':{'$in':_0x1ff562}}});})[_0x3d95('0x16')](function(_0x411c7b){var _0x6fbdd7=_[_0x3d95('0x34')](_0x411c7b,function(_0x1b8647){return db[_0x3d95('0x11d')]['create']({'UserId':_0x29ba05['id'],'VoicePrefixId':_0x1b8647[_0x3d95('0x11e')]},{'transaction':_0x2caa94});});return Promise[_0x3d95('0x56')](_0x6fbdd7);});});})[_0x3d95('0x16')](function(){for(var _0x32900f=0x0;_0x32900f<_0x3989f0['length'];_0x32900f++){var _0x5e48bd=_0x3989f0[_0x32900f]['getDataValue']('channel');var _0x5e9634=_0x5e48bd+_0x3d95('0xad');socket[_0x3d95('0x29')](_0x3d95('0x87')+_0x5e48bd+_0x3d95('0xae'),{'UserId':_0x122622,['queueField']:_0x3989f0[_0x32900f]['id']});}})[_0x3d95('0x16')](respondWithStatusCode(_0x1bcf9b,null))[_0x3d95('0x20')](APIHandleError(_0x1bcf9b));};exports[_0x3d95('0x11f')]=function(_0x8eca6b,_0xa47043){var _0x1bd47f=_0x8eca6b[_0x3d95('0x58')]['id'];var _0x1e02bf=null;if(_0x8eca6b[_0x3d95('0x47')][_0x3d95('0x67')]){_0x1e02bf=_[_0x3d95('0xb7')](_0x8eca6b[_0x3d95('0x47')][_0x3d95('0x67')])?_0x8eca6b[_0x3d95('0x47')][_0x3d95('0x67')]:[_0x8eca6b[_0x3d95('0x47')][_0x3d95('0x67')]];}var _0x37ebff=[];return Promise[_0x3d95('0x115')]()['then'](function(){if(!_0x1e02bf)throw new APIBadRequestError(_0x3d95('0x120'));})['then'](function(){return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0x1bd47f}});})[_0x3d95('0x16')](function(_0x4dd284){if(!_0x4dd284)throw new APINotFoundError(util[_0x3d95('0xf0')](_0x3d95('0x116'),_0x8eca6b['params']['id']));return db[_0x3d95('0x72')][_0x3d95('0x117')](function(_0x54fad3){return _0x4dd284[_0x3d95('0x11f')](_0x1e02bf,{'transaction':_0x54fad3})['then'](function(){return db[_0x3d95('0x113')]['findAll']({'where':{'id':{'$in':_0x1e02bf}}});})[_0x3d95('0x16')](function(_0x5f509a){var _0x3b8f7f=_[_0x3d95('0x34')](_0x5f509a,function(_0xc51565){return _0xc51565[_0x3d95('0x121')]();});return Promise['all'](_0x3b8f7f);})[_0x3d95('0x16')](function(_0x3453e5){_0x37ebff=_[_0x3d95('0x118')](_0x3453e5);var _0x2d9392=_[_0x3d95('0x34')](_0x37ebff,function(_0x2bb1e7){return _0x2bb1e7[_0x3d95('0x122')](_0x4dd284['id'],{'transaction':_0x54fad3});});return Promise[_0x3d95('0x56')](_0x2d9392);})[_0x3d95('0x16')](function(){if(!_0x4dd284[_0x3d95('0xb1')])return;var _0x3ef9f4=_[_0x3d95('0x33')](_0x37ebff,function(_0x483b03){return _0x483b03[_0x3d95('0x123')]('channel')==='Voice';});var _0x25c53e=_[_0x3d95('0x34')](_0x3ef9f4,function(_0x51fa66){return db[_0x3d95('0xb3')][_0x3d95('0x2b')]({'where':{'VoiceQueueId':_0x51fa66['id'],'UserId':_0x4dd284['id']},'transaction':_0x54fad3});});return Promise[_0x3d95('0x56')](_0x25c53e);})[_0x3d95('0x16')](function(){return db[_0x3d95('0x11c')][_0x3d95('0x4e')]({'where':{'teamId':{'$in':_0x1e02bf}}});})['then'](function(_0x4f071b){var _0x55e259=_[_0x3d95('0x34')](_0x4f071b,function(_0xa12e13){return db[_0x3d95('0x11d')]['destroy']({'where':{'UserId':_0x4dd284['id'],'VoicePrefixId':_0xa12e13[_0x3d95('0x11e')]}},{'transaction':_0x54fad3});});return Promise[_0x3d95('0x56')](_0x55e259);});});})[_0x3d95('0x16')](function(){for(var _0x2a4e8d=0x0;_0x2a4e8d<_0x37ebff[_0x3d95('0x5e')];_0x2a4e8d++){var _0x22b0c9=_0x37ebff[_0x2a4e8d]['getDataValue']('channel');var _0x5d5b8a=_0x22b0c9+_0x3d95('0xad');socket[_0x3d95('0x29')]('user'+_0x22b0c9+_0x3d95('0xb8'),{'UserId':_0x1bd47f,['queueField']:_0x37ebff[_0x2a4e8d]['id']});}})[_0x3d95('0x16')](respondWithStatusCode(_0xa47043,null))[_0x3d95('0x20')](APIHandleError(_0xa47043));};exports['getLists']=function(_0xbe0039,_0x5337d3){var _0xd1ab97={};var _0x53a9d5={};var _0x5d0497;var _0x3ba37c;return db[_0x3d95('0x4d')][_0x3d95('0x9e')]({'where':{'id':_0xbe0039['params']['id']}})['then'](handleEntityNotFound(_0x5337d3,null))['then'](function(_0x166871){if(_0x166871){_0x5d0497=_0x166871;_0x53a9d5['model']=_['keys'](db[_0x3d95('0xd5')][_0x3d95('0x3f')]);_0x53a9d5[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0xbe0039[_0x3d95('0x47')]);_0x53a9d5['filters']=_[_0x3d95('0x5c')](_0x53a9d5['model'],_0x53a9d5['query']);_0xd1ab97[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x53a9d5[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0xbe0039[_0x3d95('0x47')][_0x3d95('0x5d')]));_0xd1ab97['attributes']=_0xd1ab97[_0x3d95('0x4c')]['length']?_0xd1ab97[_0x3d95('0x4c')]:_0x53a9d5['model'];_0xd1ab97['order']=qs[_0x3d95('0xd2')](_0xbe0039[_0x3d95('0x47')][_0x3d95('0xd2')]);_0xd1ab97[_0x3d95('0x45')]=qs['filters'](_[_0x3d95('0xd3')](_0xbe0039[_0x3d95('0x47')],_0x53a9d5[_0x3d95('0x5b')]));if(_0xbe0039['query'][_0x3d95('0x33')]){_0xd1ab97[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0xd1ab97[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0xd1ab97['attributes'],function(_0x2f9d94){var _0x116719={};_0x116719[_0x2f9d94]={'$like':'%'+_0xbe0039[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x116719;})});}_0xd1ab97=_[_0x3d95('0x5f')]({},_0xd1ab97,_0xbe0039[_0x3d95('0x60')]);return _0x5d0497['getLists'](_0xd1ab97);}})[_0x3d95('0x16')](function(_0x384826){if(_0x384826){_0x3ba37c=_0x384826['length'];if(!_0xbe0039['query'][_0x3d95('0xd4')]('nolimit')){_0xd1ab97[_0x3d95('0x26')]=qs['limit'](_0xbe0039[_0x3d95('0x47')][_0x3d95('0x26')]);_0xd1ab97[_0x3d95('0x24')]=qs[_0x3d95('0x24')](_0xbe0039['query'][_0x3d95('0x24')]);}return _0x5d0497['getLists'](_0xd1ab97);}})['then'](function(_0x478761){if(_0x478761){return _0x478761?{'count':_0x3ba37c,'rows':_0x478761}:null;}})[_0x3d95('0x16')](respondWithResult(_0x5337d3,null))['catch'](handleError(_0x5337d3,null));};exports[_0x3d95('0x124')]=function(_0x4e7d8b,_0x2cb782){var _0x2c5395={};var _0x4c4cd2={};var _0x598ea3;return db['User'][_0x3d95('0x9e')]({'where':{'id':_0x4e7d8b[_0x3d95('0x58')]['id']}})['then'](handleEntityNotFound(_0x2cb782,null))[_0x3d95('0x16')](function(_0x47093b){if(_0x47093b){_0x598ea3=_0x47093b;_0x4c4cd2[_0x3d95('0x59')]=_['keys'](db[_0x3d95('0x4d')][_0x3d95('0x3f')]);_0x4c4cd2[_0x3d95('0x47')]=_[_0x3d95('0x5a')](_0x4e7d8b[_0x3d95('0x47')]);_0x4c4cd2[_0x3d95('0x5b')]=_[_0x3d95('0x5c')](_0x4c4cd2[_0x3d95('0x59')],_0x4c4cd2[_0x3d95('0x47')]);_0x2c5395[_0x3d95('0x4c')]=_[_0x3d95('0x5c')](_0x4c4cd2[_0x3d95('0x59')],qs[_0x3d95('0x5d')](_0x4e7d8b[_0x3d95('0x47')]['fields']));_0x2c5395[_0x3d95('0x4c')]=_0x2c5395[_0x3d95('0x4c')][_0x3d95('0x5e')]?_0x2c5395[_0x3d95('0x4c')]:_0x4c4cd2[_0x3d95('0x59')];_0x2c5395['order']=qs['sort'](_0x4e7d8b[_0x3d95('0x47')]['sort']);_0x2c5395[_0x3d95('0x45')]=qs[_0x3d95('0x5b')](_['pick'](_0x4e7d8b['query'],_0x4c4cd2[_0x3d95('0x5b')]));if(_0x4e7d8b[_0x3d95('0x47')][_0x3d95('0x33')]){_0x2c5395[_0x3d95('0x45')]=_[_0x3d95('0x5f')](_0x2c5395[_0x3d95('0x45')],{'$or':_[_0x3d95('0x34')](_0x2c5395[_0x3d95('0x4c')],function(_0x28bed0){var _0x3ca79c={};_0x3ca79c[_0x28bed0]={'$like':'%'+_0x4e7d8b[_0x3d95('0x47')][_0x3d95('0x33')]+'%'};return _0x3ca79c;})});}_0x2c5395[_0x3d95('0x59')]=db['User'];_0x2c5395['as']=_0x3d95('0x2f');_0x2c5395=_[_0x3d95('0x5f')]({},_0x2c5395,_0x4e7d8b[_0x3d95('0x60')]);return _0x598ea3[_0x3d95('0xf9')]({'include':[_0x2c5395]});}})['then'](function(_0x131dcf){if(_0x131dcf){var _0x12c2ec={},_0x5c161b=[];for(var _0x4dcede=0x0;_0x4dcede<_0x131dcf[_0x3d95('0x5e')];_0x4dcede+=0x1){for(var _0x933fc0=0x0,_0x2f3d54;_0x933fc0<_0x131dcf[_0x4dcede][_0x3d95('0x2f')][_0x3d95('0x5e')];_0x933fc0+=0x1){_0x2f3d54=_0x131dcf[_0x4dcede][_0x3d95('0x2f')][_0x933fc0][_0x3d95('0x2c')]({'plain':!![]});_0x12c2ec[_0x2f3d54['id']]=_0x2f3d54;}}_0x12c2ec=_[_0x3d95('0x125')](_0x12c2ec);for(var _0x39fec0=qs['offset'](_0x4e7d8b[_0x3d95('0x47')][_0x3d95('0x24')]);_0x39fec0<_0x12c2ec[_0x3d95('0x5e')]&&_0x5c161b[_0x3d95('0x5e')]=_0x55c77e[_0x688e('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x688e('0x22')](function(){if(_0x40d9c9){return db[_0x688e('0x2b')][_0x688e('0x4b')]({'where':{'membername':_0x40d9c9[_0x688e('0x28')]},'individualHooks':!![]});}})[_0x688e('0x22')](function(){if(_0x40d9c9){return _0x40d9c9['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5985b9){if(_0x40d9c9){if(_0x5985b9){var _0x56fe46=[];_0x233f21=_0x5985b9;if(_0x233f21[_0x688e('0x30')]){for(var _0x5f159b=0x0;_0x5f159b<_0x233f21['length'];_0x5f159b++){_0x56fe46[_0x688e('0x48')](db['UserVoiceQueueRt'][_0x688e('0x53')]({'membername':_0x40d9c9[_0x688e('0x28')],'UserId':_0x40d9c9['id'],'queue_name':_0x233f21[_0x5f159b][_0x688e('0x28')],'VoiceQueueId':_0x233f21[_0x5f159b]['id'],'interface':_0x23a409,'paused':_0x40d9c9[_0x688e('0x4d')]||![],'penalty':_0x233f21[_0x5f159b][_0x688e('0x54')]||0x0}));}return BPromise['all'](_0x56fe46);}}}})[_0x688e('0x22')](function(){if(_0x40d9c9){return db[_0x688e('0x39')][_0x688e('0x1a')]({'where':{'membername':_0x40d9c9[_0x688e('0x28')],'exitAt':null}});}})[_0x688e('0x22')](function(_0x2c0311){if(_0x40d9c9){if(_0x2c0311&&_0x2c0311[_0x688e('0x30')]){var _0x51357e=[];_0x2c0311[_0x688e('0x32')](function(_0x35efa8){_0x51357e[_0x688e('0x48')](_0x35efa8[_0x688e('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x51357e);}}})[_0x688e('0x22')](function(_0x1083d3){if(_0x40d9c9){var _0x3d78aa=[];var _0x4523aa=[];var _0x355e6b=utils[_0x688e('0x31')]();var _0x5196c5={'membername':_0x40d9c9[_0x688e('0x28')],'interface':_0x23a409,'enterAt':moment()[_0x688e('0x2e')](_0x688e('0x2f')),'role':_0x40d9c9[_0x688e('0x29')],'internal':_0x40d9c9[_0x688e('0x38')]};_0x355e6b[_0x688e('0x32')](function(_0x444a21){_0x3d78aa[_0x688e('0x48')](_[_0x688e('0x55')]({'channel':_0x444a21,'type':_0x688e('0x56'),'data1':_0x688e('0x57'),'data2':_0x23a409},_0x5196c5));if(_0x40d9c9[_0x688e('0x4d')]){_0x4523aa[_0x688e('0x48')](_[_0x688e('0x55')]({'channel':_0x444a21,'type':_0x688e('0x2d'),'data1':_0x688e('0x58')},_0x5196c5));}});return db[_0x688e('0x39')]['bulkCreate'](_0x3d78aa[_0x688e('0x59')](_0x4523aa),{'individualHooks':!![]});}})['then'](function(){if(_0x40d9c9){return _0x40d9c9[_0x688e('0x2c')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x40d9c9['loginInPause']||![],'mailPause':_0x40d9c9[_0x688e('0x4d')]||![],'chatPause':_0x40d9c9[_0x688e('0x4d')]||![],'faxPause':_0x40d9c9[_0x688e('0x4d')]||![],'smsPause':_0x40d9c9[_0x688e('0x4d')]||![],'openchannelPause':_0x40d9c9[_0x688e('0x4d')]||![],'pauseType':_0x40d9c9['loginInPause']?_0x688e('0x58'):null,'lastPauseAt':moment()[_0x688e('0x2e')](_0x688e('0x2f')),'interface':_0x23a409});}})['then'](function(_0x3b79b5){_0x26915b(_0x3b79b5);})[_0x688e('0x18')](function(_0x50ab72){_0x5d03dd(_0x26f7c7[_0x688e('0x15')](0x1f4,_0x50ab72['message']));});});}; \ No newline at end of file +var _0xce65=['merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','socket.io-emitter','./user.socket','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetUser','User','findAll','options','raw','where','limit','include','map','attributes','model','then','ShowUser','find','PauseUser','role','internal','interface','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','UnpauseUser','findOne','channel','Unknown\x20channel','voice','UserVoiceQueueRt','system','mail','fax','sms','openchannel','whatsapp','Pause','forEach','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xce65,0xbf));var _0x5ce6=function(_0x2f1d40,_0x2d9c67){_0x2f1d40=_0x2f1d40-0x0;var _0x47f3c3=_0xce65[_0x2f1d40];return _0x47f3c3;};'use strict';var _=require(_0x5ce6('0x0'));var util=require(_0x5ce6('0x1'));var moment=require(_0x5ce6('0x2'));var BPromise=require(_0x5ce6('0x3'));var rs=require(_0x5ce6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce6('0x5'))['db'];var utils=require(_0x5ce6('0x6'));var logger=require('../../config/logger')(_0x5ce6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5ce6('0x8')][_0x5ce6('0x9')]({'port':0x232a});config[_0x5ce6('0xa')]=_[_0x5ce6('0xb')](config[_0x5ce6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ce6('0xc'))(new Redis(config['redis']));require(_0x5ce6('0xd'))['register'](socket);function respondWithRpcPromise(_0x440c19,_0x5254c7,_0x2effa9){return new BPromise(function(_0x2b332b,_0x2758ca){return client['request'](_0x440c19,_0x2effa9)['then'](function(_0x6fc61d){logger[_0x5ce6('0xe')](_0x5ce6('0xf'),_0x5254c7,_0x5ce6('0x10'));logger[_0x5ce6('0x11')](_0x5ce6('0x12'),_0x5254c7,_0x5ce6('0x10'),JSON[_0x5ce6('0x13')](_0x6fc61d));if(_0x6fc61d['error']){if(_0x6fc61d[_0x5ce6('0x14')][_0x5ce6('0x15')]===0x1f4){logger[_0x5ce6('0x14')]('User,\x20%s,\x20%s',_0x5254c7,_0x6fc61d[_0x5ce6('0x14')]['message']);return _0x2758ca(_0x6fc61d[_0x5ce6('0x14')][_0x5ce6('0x16')]);}logger[_0x5ce6('0x14')](_0x5ce6('0xf'),_0x5254c7,_0x6fc61d['error'][_0x5ce6('0x16')]);return _0x2b332b(_0x6fc61d[_0x5ce6('0x14')][_0x5ce6('0x16')]);}else{logger[_0x5ce6('0xe')](_0x5ce6('0xf'),_0x5254c7,_0x5ce6('0x10'));_0x2b332b(_0x6fc61d['result'][_0x5ce6('0x16')]);}})[_0x5ce6('0x17')](function(_0x3dca45){logger[_0x5ce6('0x14')](_0x5ce6('0xf'),_0x5254c7,_0x3dca45);_0x2758ca(_0x3dca45);});});}exports[_0x5ce6('0x18')]=function(_0x2a34a4){var _0x191f41=this;return new Promise(function(_0x47eb60,_0x3bc064){return db[_0x5ce6('0x19')][_0x5ce6('0x1a')]({'raw':_0x2a34a4['options']?_0x2a34a4[_0x5ce6('0x1b')][_0x5ce6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a34a4[_0x5ce6('0x1b')]?_0x2a34a4[_0x5ce6('0x1b')][_0x5ce6('0x1d')]||null:null,'attributes':_0x2a34a4[_0x5ce6('0x1b')]?_0x2a34a4[_0x5ce6('0x1b')]['attributes']||null:null,'limit':_0x2a34a4[_0x5ce6('0x1b')]?_0x2a34a4['options'][_0x5ce6('0x1e')]||null:null,'include':_0x2a34a4[_0x5ce6('0x1b')]?_0x2a34a4[_0x5ce6('0x1b')][_0x5ce6('0x1f')]?_['map'](_0x2a34a4[_0x5ce6('0x1b')][_0x5ce6('0x1f')],function(_0x458d71){return{'model':db[_0x458d71['model']],'as':_0x458d71['as'],'attributes':_0x458d71['attributes'],'include':_0x458d71[_0x5ce6('0x1f')]?_[_0x5ce6('0x20')](_0x458d71[_0x5ce6('0x1f')],function(_0x2d2b24){return{'model':db[_0x2d2b24['model']],'as':_0x2d2b24['as'],'attributes':_0x2d2b24[_0x5ce6('0x21')],'include':_0x2d2b24[_0x5ce6('0x1f')]?_[_0x5ce6('0x20')](_0x2d2b24[_0x5ce6('0x1f')],function(_0x187ab1){return{'model':db[_0x187ab1[_0x5ce6('0x22')]],'as':_0x187ab1['as'],'attributes':_0x187ab1[_0x5ce6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5ce6('0x23')](function(_0x3c92cb){logger[_0x5ce6('0xe')](_0x5ce6('0x18'),_0x2a34a4);logger[_0x5ce6('0x11')](_0x5ce6('0x18'),_0x2a34a4,JSON['stringify'](_0x3c92cb));_0x47eb60(_0x3c92cb);})['catch'](function(_0x50b433){logger[_0x5ce6('0x14')](_0x5ce6('0x18'),_0x50b433['message'],_0x2a34a4);_0x3bc064(_0x191f41[_0x5ce6('0x14')](0x1f4,_0x50b433['message']));});});};exports[_0x5ce6('0x24')]=function(_0x13a076){var _0x5194dc=this;return new Promise(function(_0x5801d6,_0x4b3410){return db[_0x5ce6('0x19')][_0x5ce6('0x25')]({'raw':_0x13a076['options']?_0x13a076[_0x5ce6('0x1b')][_0x5ce6('0x1c')]===undefined?!![]:![]:!![],'where':_0x13a076['options']?_0x13a076[_0x5ce6('0x1b')][_0x5ce6('0x1d')]||null:null,'attributes':_0x13a076['options']?_0x13a076[_0x5ce6('0x1b')]['attributes']||null:null,'include':_0x13a076[_0x5ce6('0x1b')]?_0x13a076[_0x5ce6('0x1b')][_0x5ce6('0x1f')]?_['map'](_0x13a076[_0x5ce6('0x1b')]['include'],function(_0x5c7cba){return{'model':db[_0x5c7cba[_0x5ce6('0x22')]],'as':_0x5c7cba['as'],'attributes':_0x5c7cba[_0x5ce6('0x21')],'include':_0x5c7cba[_0x5ce6('0x1f')]?_[_0x5ce6('0x20')](_0x5c7cba['include'],function(_0x75d942){return{'model':db[_0x75d942[_0x5ce6('0x22')]],'as':_0x75d942['as'],'attributes':_0x75d942[_0x5ce6('0x21')],'include':_0x75d942['include']?_[_0x5ce6('0x20')](_0x75d942['include'],function(_0xd420b4){return{'model':db[_0xd420b4['model']],'as':_0xd420b4['as'],'attributes':_0xd420b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ce6('0x23')](function(_0xa1a5ee){logger[_0x5ce6('0xe')](_0x5ce6('0x24'),_0x13a076);logger[_0x5ce6('0x11')](_0x5ce6('0x24'),_0x13a076,JSON[_0x5ce6('0x13')](_0xa1a5ee));_0x5801d6(_0xa1a5ee);})[_0x5ce6('0x17')](function(_0x2d440c){logger[_0x5ce6('0x14')](_0x5ce6('0x24'),_0x2d440c[_0x5ce6('0x16')],_0x13a076);_0x4b3410(_0x5194dc[_0x5ce6('0x14')](0x1f4,_0x2d440c[_0x5ce6('0x16')]));});});};exports[_0x5ce6('0x26')]=function(_0x2d1fa3){var _0x53dd48=this;return new Promise(function(_0x9fd159,_0x395712){var _0x133ee4;return db['User'][_0x5ce6('0x25')]({'where':_0x2d1fa3[_0x5ce6('0x1b')]['where']||{},'attributes':['id','name',_0x5ce6('0x27'),_0x5ce6('0x28'),_0x5ce6('0x29')]})[_0x5ce6('0x23')](function(_0x39da08){if(_0x39da08){_0x133ee4=_0x39da08;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x133ee4['id']},'individualHooks':!![]});}})['then'](function(){if(_0x133ee4){return db[_0x5ce6('0x2a')]['findAll']({'where':{'membername':_0x133ee4[_0x5ce6('0x2b')],'type':_0x5ce6('0x2c'),'exitAt':null}});}})[_0x5ce6('0x23')](function(_0x505a07){if(_0x133ee4){if(_0x505a07&&_0x505a07[_0x5ce6('0x2d')]){var _0x5070a3=moment()[_0x5ce6('0x2e')](_0x5ce6('0x2f'));for(var _0x30f1e6=0x0,_0x510f5a=_0x505a07['length'];_0x30f1e6<_0x510f5a;_0x30f1e6++){_0x505a07[_0x30f1e6][_0x5ce6('0x30')]({'exitAt':_0x5070a3});}}}})[_0x5ce6('0x23')](function(){if(_0x133ee4){var _0x26f710=[];var _0x430529=utils[_0x5ce6('0x31')]();_0x430529['forEach'](function(_0x28a66e){_0x26f710[_0x5ce6('0x32')]({'channel':_0x28a66e,'membername':_0x133ee4[_0x5ce6('0x2b')],'interface':_[_0x5ce6('0x33')](_0x133ee4[_0x5ce6('0x29')])?util[_0x5ce6('0x2e')](_0x5ce6('0x34'),_0x133ee4[_0x5ce6('0x2b')]):_0x133ee4[_0x5ce6('0x29')],'type':_0x5ce6('0x2c'),'enterAt':moment()['format'](_0x5ce6('0x2f')),'data1':_0x2d1fa3[_0x5ce6('0x35')][_0x5ce6('0x36')]||_0x5ce6('0x37'),'role':_0x133ee4[_0x5ce6('0x27')],'internal':_0x133ee4[_0x5ce6('0x28')],'uniqueid':_0x2d1fa3[_0x5ce6('0x35')][_0x5ce6('0x38')]||null});});return db[_0x5ce6('0x2a')][_0x5ce6('0x39')](_0x26f710,{'individualHooks':!![]});}})[_0x5ce6('0x23')](function(){if(_0x133ee4){return _0x133ee4[_0x5ce6('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2d1fa3['body'][_0x5ce6('0x36')]||_0x5ce6('0x37'),'lastPauseAt':moment()['format'](_0x5ce6('0x2f'))});}})[_0x5ce6('0x23')](function(_0x1159d8){_0x9fd159(_0x1159d8);})[_0x5ce6('0x17')](function(_0x43d59f){_0x395712(_0x53dd48[_0x5ce6('0x14')](0x1f4,_0x43d59f[_0x5ce6('0x16')]));});});};exports[_0x5ce6('0x3b')]=function(_0x46ecaf){var _0x1e9030=this;return new Promise(function(_0x27d105,_0x4a7e1d){var _0x503ce1;return db[_0x5ce6('0x19')][_0x5ce6('0x3c')]({'where':_0x46ecaf[_0x5ce6('0x1b')][_0x5ce6('0x1d')]||{},'attributes':['id',_0x5ce6('0x2b')]})['then'](function(_0x575c16){if(_0x575c16){_0x503ce1=_0x575c16;if(_0x46ecaf['body'][_0x5ce6('0x3d')]&&!utils['isValidChannel'](_0x46ecaf['body']['channel'])){throw new Error(_0x5ce6('0x3e'));}switch(_0x46ecaf[_0x5ce6('0x35')][_0x5ce6('0x3d')]){case _0x5ce6('0x3f'):return db[_0x5ce6('0x40')]['update']({'paused':0x0},{'where':{'UserId':_0x503ce1['id']}})[_0x5ce6('0x23')](function(){return db[_0x5ce6('0x2a')][_0x5ce6('0x25')]({'where':{'channel':_0x46ecaf[_0x5ce6('0x35')]['channel'],'membername':_0x503ce1[_0x5ce6('0x2b')],'type':_0x5ce6('0x2c'),'exitAt':null}});})[_0x5ce6('0x23')](function(_0x38ce4d){if(_0x38ce4d){return _0x38ce4d[_0x5ce6('0x3a')]({'exitAt':moment()['format'](_0x5ce6('0x2f')),'data2':_0x5ce6('0x41')},{'individualHooks':!![]});}return null;})[_0x5ce6('0x23')](function(){return _0x503ce1[_0x5ce6('0x3a')]({'voicePause':![]});});case _0x5ce6('0x42'):case'chat':case _0x5ce6('0x43'):case _0x5ce6('0x44'):case _0x5ce6('0x45'):case _0x5ce6('0x46'):return db['MemberReport'][_0x5ce6('0x25')]({'where':{'channel':_0x46ecaf[_0x5ce6('0x35')][_0x5ce6('0x3d')],'membername':_0x503ce1[_0x5ce6('0x2b')],'type':_0x5ce6('0x2c'),'exitAt':null}})['then'](function(_0x41db0f){return _0x41db0f['update']({'exitAt':moment()[_0x5ce6('0x2e')](_0x5ce6('0x2f')),'data2':_0x5ce6('0x41')},{'individualHooks':!![]});})[_0x5ce6('0x23')](function(){var _0x43aec5={};_['set'](_0x43aec5,util[_0x5ce6('0x2e')]('%s%s',_0x46ecaf[_0x5ce6('0x35')][_0x5ce6('0x3d')],_0x5ce6('0x47')),![]);return _0x503ce1['update'](_0x43aec5);});default:return db[_0x5ce6('0x40')]['update']({'paused':0x0},{'where':{'UserId':_0x503ce1['id']}})[_0x5ce6('0x23')](function(){return db['MemberReport'][_0x5ce6('0x1a')]({'where':{'membername':_0x503ce1['name'],'type':_0x5ce6('0x2c'),'exitAt':null}});})[_0x5ce6('0x23')](function(_0x16bcc){var _0x57a595=[];_0x16bcc[_0x5ce6('0x48')](function(_0x5486a9){_0x57a595['push'](_0x5486a9[_0x5ce6('0x3a')]({'exitAt':moment()['format'](_0x5ce6('0x2f')),'data2':_0x5ce6('0x41')}));});return BPromise[_0x5ce6('0x49')](_0x57a595);})[_0x5ce6('0x23')](function(){return _0x503ce1[_0x5ce6('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x1cb5e6){_0x27d105(_0x1cb5e6);})[_0x5ce6('0x17')](function(_0x7269ee){_0x4a7e1d(_0x1e9030['error'](0x1f4,_0x7269ee[_0x5ce6('0x16')]));});});};exports[_0x5ce6('0x4a')]=function(_0x3de3dc){var _0x57560d=this;return new Promise(function(_0x3ff3a6,_0x4b8e6b){var _0x3d00d2;return db['User'][_0x5ce6('0x3c')]({'where':_0x3de3dc[_0x5ce6('0x1b')][_0x5ce6('0x1d')]||{},'attributes':['id',_0x5ce6('0x2b')]})[_0x5ce6('0x23')](function(_0x3de8e1){if(_0x3de8e1){_0x3d00d2=_0x3de8e1;return db[_0x5ce6('0x40')][_0x5ce6('0x4b')]({'where':{'membername':_0x3d00d2['name']},'individualHooks':!![]});}})[_0x5ce6('0x23')](function(){if(_0x3d00d2){return db['MemberReport']['findAll']({'where':{'membername':_0x3d00d2[_0x5ce6('0x2b')],'exitAt':null}});}})[_0x5ce6('0x23')](function(_0x2af972){if(_0x3d00d2){if(_0x2af972&&_0x2af972[_0x5ce6('0x2d')]){var _0x55d56f=[];_0x2af972[_0x5ce6('0x48')](function(_0x35e303){_0x55d56f['push'](_0x35e303[_0x5ce6('0x3a')]({'exitAt':moment()[_0x5ce6('0x2e')](_0x5ce6('0x2f'))}));});return BPromise[_0x5ce6('0x49')](_0x55d56f);}}})[_0x5ce6('0x23')](function(){if(_0x3d00d2){return _0x3d00d2[_0x5ce6('0x3a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5ce6('0x23')](function(_0x753c5f){_0x3ff3a6(_0x753c5f);})[_0x5ce6('0x17')](function(_0x538770){_0x4b8e6b(_0x57560d[_0x5ce6('0x14')](0x1f4,_0x538770[_0x5ce6('0x16')]));});});};exports[_0x5ce6('0x4c')]=function(_0x548a2f){var _0x2da22e=this;return new Promise(function(_0x124430,_0x34ac64){var _0x17f1ea;var _0x183ec5;var _0x4edd18;var _0xe4e887;return db[_0x5ce6('0x19')][_0x5ce6('0x3c')]({'where':_0x548a2f[_0x5ce6('0x1b')]['where']||{},'attributes':['id',_0x5ce6('0x2b'),_0x5ce6('0x27'),_0x5ce6('0x4d'),_0x5ce6('0x4e'),'internal',_0x5ce6('0x4f'),_0x5ce6('0x29')]})[_0x5ce6('0x23')](function(_0x51c452){if(_0x51c452){_0x17f1ea=_0x51c452;_0xe4e887=_0x548a2f[_0x5ce6('0x35')]['interface']?_0x548a2f[_0x5ce6('0x35')]['interface']:util[_0x5ce6('0x2e')](_0x5ce6('0x34'),_0x17f1ea[_0x5ce6('0x2b')]);return db[_0x5ce6('0x19')][_0x5ce6('0x50')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x17f1ea['id']}}});}})[_0x5ce6('0x23')](function(_0x4cc0b8){if(_0x4cc0b8){_0x4edd18=_0x4cc0b8;return require(_0x5ce6('0x51'))[_0x5ce6('0x52')]();}})['then'](function(_0x305004){if(_0x305004&&_0x305004[_0x5ce6('0x53')]&&_0x4edd18>=_0x305004[_0x5ce6('0x53')]){throw new Error(_0x5ce6('0x54'));}})[_0x5ce6('0x23')](function(){if(_0x17f1ea){return db['UserVoiceQueueRt'][_0x5ce6('0x4b')]({'where':{'membername':_0x17f1ea[_0x5ce6('0x2b')]},'individualHooks':!![]});}})[_0x5ce6('0x23')](function(){if(_0x17f1ea){return _0x17f1ea[_0x5ce6('0x55')]({'raw':!![]});}})[_0x5ce6('0x23')](function(_0x5955e5){if(_0x17f1ea){if(_0x5955e5){var _0x5ea1a3=[];_0x183ec5=_0x5955e5;if(_0x183ec5['length']){for(var _0x2a1b77=0x0;_0x2a1b77<_0x183ec5[_0x5ce6('0x2d')];_0x2a1b77++){_0x5ea1a3[_0x5ce6('0x32')](db[_0x5ce6('0x40')][_0x5ce6('0x56')]({'membername':_0x17f1ea[_0x5ce6('0x2b')],'UserId':_0x17f1ea['id'],'queue_name':_0x183ec5[_0x2a1b77][_0x5ce6('0x2b')],'VoiceQueueId':_0x183ec5[_0x2a1b77]['id'],'interface':_0xe4e887,'paused':_0x17f1ea['loginInPause']||![],'penalty':_0x183ec5[_0x2a1b77][_0x5ce6('0x57')]||0x0}));}return BPromise['all'](_0x5ea1a3);}}}})[_0x5ce6('0x23')](function(){if(_0x17f1ea){return db['MemberReport'][_0x5ce6('0x1a')]({'where':{'membername':_0x17f1ea['name'],'exitAt':null}});}})[_0x5ce6('0x23')](function(_0x2759ab){if(_0x17f1ea){if(_0x2759ab&&_0x2759ab[_0x5ce6('0x2d')]){var _0x3546b6=[];_0x2759ab['forEach'](function(_0x59a8f0){_0x3546b6[_0x5ce6('0x32')](_0x59a8f0[_0x5ce6('0x3a')]({'exitAt':moment()[_0x5ce6('0x2e')](_0x5ce6('0x2f'))}));});return BPromise[_0x5ce6('0x49')](_0x3546b6);}}})[_0x5ce6('0x23')](function(_0x303722){if(_0x17f1ea){var _0x48ffd8=[];var _0x3c3ddb=[];var _0x41ff2c=utils[_0x5ce6('0x31')]();var _0x10ff38={'membername':_0x17f1ea[_0x5ce6('0x2b')],'interface':_0xe4e887,'enterAt':moment()[_0x5ce6('0x2e')](_0x5ce6('0x2f')),'role':_0x17f1ea[_0x5ce6('0x27')],'internal':_0x17f1ea[_0x5ce6('0x28')]};_0x41ff2c[_0x5ce6('0x48')](function(_0x11d3d9){_0x48ffd8[_0x5ce6('0x32')](_[_0x5ce6('0x58')]({'channel':_0x11d3d9,'type':_0x5ce6('0x59'),'data1':_0x5ce6('0x5a'),'data2':_0xe4e887},_0x10ff38));if(_0x17f1ea[_0x5ce6('0x4f')]){_0x3c3ddb[_0x5ce6('0x32')](_[_0x5ce6('0x58')]({'channel':_0x11d3d9,'type':_0x5ce6('0x2c'),'data1':'LOGININPAUSE'},_0x10ff38));}});return db['MemberReport'][_0x5ce6('0x39')](_0x48ffd8[_0x5ce6('0x5b')](_0x3c3ddb),{'individualHooks':!![]});}})[_0x5ce6('0x23')](function(){if(_0x17f1ea){return _0x17f1ea[_0x5ce6('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x5ce6('0x2e')](_0x5ce6('0x2f')),'voicePause':_0x17f1ea[_0x5ce6('0x4f')]||![],'mailPause':_0x17f1ea[_0x5ce6('0x4f')]||![],'chatPause':_0x17f1ea[_0x5ce6('0x4f')]||![],'faxPause':_0x17f1ea[_0x5ce6('0x4f')]||![],'smsPause':_0x17f1ea[_0x5ce6('0x4f')]||![],'openchannelPause':_0x17f1ea[_0x5ce6('0x4f')]||![],'pauseType':_0x17f1ea[_0x5ce6('0x4f')]?_0x5ce6('0x5c'):null,'lastPauseAt':moment()[_0x5ce6('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xe4e887});}})[_0x5ce6('0x23')](function(_0x354186){_0x124430(_0x354186);})['catch'](function(_0x4fbaef){_0x34ac64(_0x2da22e['error'](0x1f4,_0x4fbaef[_0x5ce6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ab061de..4becb30 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 _0x1a32=['register','length','./user.events','remove','update','emit','removeListener'];(function(_0x2e1e3d,_0x2d6648){var _0x129355=function(_0x2f341a){while(--_0x2f341a){_0x2e1e3d['push'](_0x2e1e3d['shift']());}};_0x129355(++_0x2d6648);}(_0x1a32,0x1c2));var _0x21a3=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x1a32[_0x471a85];return _0x5f2039;};'use strict';var UserEvents=require(_0x21a3('0x0'));var events=['save',_0x21a3('0x1'),_0x21a3('0x2')];function createListener(_0x3fbd41,_0x1ae843){return function(_0x3a0638){_0x1ae843[_0x21a3('0x3')](_0x3fbd41,_0x3a0638);};}function removeListener(_0x596924,_0x78af5d){return function(){UserEvents[_0x21a3('0x4')](_0x596924,_0x78af5d);};}exports[_0x21a3('0x5')]=function(_0x2474c2){for(var _0x2b0328=0x0,_0x24ffe6=events[_0x21a3('0x6')];_0x2b0328<_0x24ffe6;_0x2b0328++){var _0x3726a4=events[_0x2b0328];var _0x2bbd0d=createListener('user:'+_0x3726a4,_0x2474c2);UserEvents['on'](_0x3726a4,_0x2bbd0d);}}; \ No newline at end of file +var _0xe04c=['./user.events','save','update','emit','removeListener','length','user:'];(function(_0x4b01af,_0x566ed5){var _0x2ac08f=function(_0x4645aa){while(--_0x4645aa){_0x4b01af['push'](_0x4b01af['shift']());}};_0x2ac08f(++_0x566ed5);}(_0xe04c,0xaf));var _0xce04=function(_0x5e9995,_0x41f494){_0x5e9995=_0x5e9995-0x0;var _0x15b3bb=_0xe04c[_0x5e9995];return _0x15b3bb;};'use strict';var UserEvents=require(_0xce04('0x0'));var events=[_0xce04('0x1'),'remove',_0xce04('0x2')];function createListener(_0x26dd5d,_0x3da789){return function(_0xa7f59f){_0x3da789[_0xce04('0x3')](_0x26dd5d,_0xa7f59f);};}function removeListener(_0x38da59,_0x31f833){return function(){UserEvents[_0xce04('0x4')](_0x38da59,_0x31f833);};}exports['register']=function(_0x2b9479){for(var _0xc2cca6=0x0,_0x2edeaa=events[_0xce04('0x5')];_0xc2cca6<_0x2edeaa;_0xc2cca6++){var _0x460965=events[_0xc2cca6];var _0x4b9885=createListener(_0xce04('0x6')+_0x460965,_0x2b9479);UserEvents['on'](_0x460965,_0x4b9885);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 445c050..8e6ea82 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x20048c,_0x337690){var _0x1d7f4b=function(_0x420930){while(--_0x420930){_0x20048c['push'](_0x20048c['shift']());}};_0x1d7f4b(++_0x337690);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17b6ca,_0x1918f4){var _0x6d2d16=function(_0x84c7ce){while(--_0x84c7ce){_0x17b6ca['push'](_0x17b6ca['shift']());}};_0x6d2d16(++_0x1918f4);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 60c827b..8556f35 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 _0xc7a3=['INTEGER','exports'];(function(_0x4b3104,_0x2ca8ab){var _0x1c57da=function(_0x18ca66){while(--_0x18ca66){_0x4b3104['push'](_0x4b3104['shift']());}};_0x1c57da(++_0x2ca8ab);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x5d329b,_0x15387a){_0x5d329b=_0x5d329b-0x0;var _0x21eefb=_0xc7a3[_0x5d329b];return _0x21eefb;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'penalty':{'type':Sequelize[_0x3c7a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x385b=['sequelize','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x385b,0x17a));var _0xb385=function(_0xfaf19d,_0x57304b){_0xfaf19d=_0xfaf19d-0x0;var _0x14a9d9=_0x385b[_0xfaf19d];return _0x14a9d9;};'use strict';var Sequelize=require(_0xb385('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb385('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 31ff335..09fa301 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 _0x9528=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x208b82,_0xd915bf){var _0x3ee9bd=function(_0x7970dc){while(--_0x7970dc){_0x208b82['push'](_0x208b82['shift']());}};_0x3ee9bd(++_0xd915bf);}(_0x9528,0x1bc));var _0x8952=function(_0x1a7bb9,_0x31b400){_0x1a7bb9=_0x1a7bb9-0x0;var _0xd43994=_0x9528[_0x1a7bb9];return _0xd43994;};'use strict';var _=require(_0x8952('0x0'));var util=require(_0x8952('0x1'));var logger=require(_0x8952('0x2'))(_0x8952('0x3'));var moment=require(_0x8952('0x4'));var BPromise=require(_0x8952('0x5'));var rp=require(_0x8952('0x6'));var fs=require('fs');var path=require(_0x8952('0x7'));var rimraf=require(_0x8952('0x8'));var config=require(_0x8952('0x9'));var attributes=require(_0x8952('0xa'));module[_0x8952('0xb')]=function(_0x24eebd,_0x142f2f){return _0x24eebd[_0x8952('0xc')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6800=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','api','bluebird','request-promise','path'];(function(_0x565d0a,_0x4927cc){var _0x24c211=function(_0x18ae2b){while(--_0x18ae2b){_0x565d0a['push'](_0x565d0a['shift']());}};_0x24c211(++_0x4927cc);}(_0x6800,0x119));var _0x0680=function(_0x22b7ab,_0x434293){_0x22b7ab=_0x22b7ab-0x0;var _0x355417=_0x6800[_0x22b7ab];return _0x355417;};'use strict';var _=require(_0x0680('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0680('0x1'));var moment=require('moment');var BPromise=require(_0x0680('0x2'));var rp=require(_0x0680('0x3'));var fs=require('fs');var path=require(_0x0680('0x4'));var rimraf=require('rimraf');var config=require(_0x0680('0x5'));var attributes=require(_0x0680('0x6'));module[_0x0680('0x7')]=function(_0x28a5f6,_0x3b860c){return _0x28a5f6[_0x0680('0x8')](_0x0680('0x9'),attributes,{'tableName':_0x0680('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 04fccec..54757b7 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 _0xd6a9=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xd6a9,0x1e3));var _0x9d6a=function(_0x388ff1,_0x4a991f){_0x388ff1=_0x388ff1-0x0;var _0x38d4ae=_0xd6a9[_0x388ff1];return _0x38d4ae;};'use strict';var _=require('lodash');var util=require(_0x9d6a('0x0'));var moment=require(_0x9d6a('0x1'));var BPromise=require(_0x9d6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d6a('0x3'))['db'];var utils=require(_0x9d6a('0x4'));var logger=require('../../config/logger')(_0x9d6a('0x5'));var config=require('../../config/environment');var jayson=require(_0x9d6a('0x6'));var client=jayson[_0x9d6a('0x7')][_0x9d6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41fb69,_0x2e7411,_0x5712ee){return new BPromise(function(_0x13b4c9,_0x317a77){return client['request'](_0x41fb69,_0x5712ee)[_0x9d6a('0x9')](function(_0x30abaa){logger[_0x9d6a('0xa')](_0x9d6a('0xb'),_0x2e7411,_0x9d6a('0xc'));logger['debug'](_0x9d6a('0xd'),_0x2e7411,_0x9d6a('0xc'),JSON[_0x9d6a('0xe')](_0x30abaa));if(_0x30abaa[_0x9d6a('0xf')]){if(_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x10')]===0x1f4){logger[_0x9d6a('0xf')](_0x9d6a('0xb'),_0x2e7411,_0x30abaa['error'][_0x9d6a('0x11')]);return _0x317a77(_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x11')]);}logger[_0x9d6a('0xf')](_0x9d6a('0xb'),_0x2e7411,_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x11')]);return _0x13b4c9(_0x30abaa[_0x9d6a('0xf')][_0x9d6a('0x11')]);}else{logger[_0x9d6a('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x2e7411,_0x9d6a('0xc'));_0x13b4c9(_0x30abaa['result'][_0x9d6a('0x11')]);}})['catch'](function(_0x116cda){logger[_0x9d6a('0xf')](_0x9d6a('0xb'),_0x2e7411,_0x116cda);_0x317a77(_0x116cda);});});} \ No newline at end of file +var _0x8415=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird'];(function(_0x4cdb05,_0x478fb1){var _0x49b567=function(_0x8b9356){while(--_0x8b9356){_0x4cdb05['push'](_0x4cdb05['shift']());}};_0x49b567(++_0x478fb1);}(_0x8415,0xcd));var _0x5841=function(_0xa4c761,_0x573a7d){_0xa4c761=_0xa4c761-0x0;var _0x4ba2f7=_0x8415[_0xa4c761];return _0x4ba2f7;};'use strict';var _=require('lodash');var util=require(_0x5841('0x0'));var moment=require('moment');var BPromise=require(_0x5841('0x1'));var rs=require(_0x5841('0x2'));var fs=require('fs');var Redis=require(_0x5841('0x3'));var db=require(_0x5841('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5841('0x5'))(_0x5841('0x6'));var config=require(_0x5841('0x7'));var jayson=require(_0x5841('0x8'));var client=jayson[_0x5841('0x9')][_0x5841('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52c00a,_0x556638,_0x570bde){return new BPromise(function(_0x3c51ee,_0x26b13b){return client[_0x5841('0xb')](_0x52c00a,_0x570bde)[_0x5841('0xc')](function(_0x396631){logger[_0x5841('0xd')](_0x5841('0xe'),_0x556638,'request\x20sent');logger[_0x5841('0xf')](_0x5841('0x10'),_0x556638,_0x5841('0x11'),JSON[_0x5841('0x12')](_0x396631));if(_0x396631[_0x5841('0x13')]){if(_0x396631[_0x5841('0x13')]['code']===0x1f4){logger['error'](_0x5841('0xe'),_0x556638,_0x396631[_0x5841('0x13')][_0x5841('0x14')]);return _0x26b13b(_0x396631[_0x5841('0x13')][_0x5841('0x14')]);}logger['error'](_0x5841('0xe'),_0x556638,_0x396631[_0x5841('0x13')][_0x5841('0x14')]);return _0x3c51ee(_0x396631[_0x5841('0x13')][_0x5841('0x14')]);}else{logger['info'](_0x5841('0xe'),_0x556638,'request\x20sent');_0x3c51ee(_0x396631[_0x5841('0x15')][_0x5841('0x14')]);}})[_0x5841('0x16')](function(_0x1c97b1){logger[_0x5841('0x13')](_0x5841('0xe'),_0x556638,_0x1c97b1);_0x26b13b(_0x1c97b1);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 113edf9..93d390c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5155d5,_0x37283d){var _0x4daced=function(_0x265a4d){while(--_0x265a4d){_0x5155d5['push'](_0x5155d5['shift']());}};_0x4daced(++_0x37283d);}(_0xe706,0xa3));var _0x6e70=function(_0xd333a1,_0x1f61a0){_0xd333a1=_0xd333a1-0x0;var _0x553a60=_0xe706[_0xd333a1];return _0x553a60;};'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(_0x31d98a,_0x292465){var _0x56e10e=function(_0x54a82f){while(--_0x54a82f){_0x31d98a['push'](_0x31d98a['shift']());}};_0x56e10e(++_0x292465);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6839dc5..e0f4715 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 _0x446a=['INTEGER','STRING','sequelize'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0x446a,0x12e));var _0xa446=function(_0x24b219,_0x1ba8bd){_0x24b219=_0x24b219-0x0;var _0x538d48=_0x446a[_0x24b219];return _0x538d48;};'use strict';var Sequelize=require(_0xa446('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa446('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa446('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa446('0x2')]}}; \ No newline at end of file +var _0x6282=['STRING','sequelize','INTEGER'];(function(_0x2479f4,_0x540fee){var _0x2fda5b=function(_0x4fcef4){while(--_0x4fcef4){_0x2479f4['push'](_0x2479f4['shift']());}};_0x2fda5b(++_0x540fee);}(_0x6282,0x190));var _0x2628=function(_0xd6ebce,_0x36423b){_0xd6ebce=_0xd6ebce-0x0;var _0x58300c=_0x6282[_0xd6ebce];return _0x58300c;};'use strict';var Sequelize=require(_0x2628('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2628('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2628('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a20933f..8719771 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 _0x5c50=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x49e1b4,_0x480780){var _0x402f2a=function(_0x371ffe){while(--_0x371ffe){_0x49e1b4['push'](_0x49e1b4['shift']());}};_0x402f2a(++_0x480780);}(_0x5c50,0x184));var _0x05c5=function(_0x515be2,_0x51b3ff){_0x515be2=_0x515be2-0x0;var _0x514679=_0x5c50[_0x515be2];return _0x514679;};'use strict';var _=require(_0x05c5('0x0'));var util=require(_0x05c5('0x1'));var logger=require(_0x05c5('0x2'))('api');var moment=require(_0x05c5('0x3'));var BPromise=require(_0x05c5('0x4'));var rp=require(_0x05c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05c5('0x6'));var config=require(_0x05c5('0x7'));var attributes=require(_0x05c5('0x8'));module[_0x05c5('0x9')]=function(_0x47c0ca,_0x1d25e3){return _0x47c0ca[_0x05c5('0xa')](_0x05c5('0xb'),attributes,{'tableName':_0x05c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2efc=['../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x2efc,0x170));var _0xc2ef=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x2efc[_0x479160];return _0x47ac6d;};'use strict';var _=require(_0xc2ef('0x0'));var util=require('util');var logger=require(_0xc2ef('0x1'))('api');var moment=require(_0xc2ef('0x2'));var BPromise=require(_0xc2ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2ef('0x4'));var rimraf=require(_0xc2ef('0x5'));var config=require(_0xc2ef('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xc2ef('0x7')]=function(_0x2b86b7,_0x45e1e3){return _0x2b86b7[_0xc2ef('0x8')](_0xc2ef('0x9'),attributes,{'tableName':_0xc2ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4e8ec5b..0197146 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 _0x542c=['rpc','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x28bbb9,_0x319419){var _0x104c01=function(_0x24c401){while(--_0x24c401){_0x28bbb9['push'](_0x28bbb9['shift']());}};_0x104c01(++_0x319419);}(_0x542c,0x17f));var _0xc542=function(_0x23e32e,_0x2d78de){_0x23e32e=_0x23e32e-0x0;var _0x489bd8=_0x542c[_0x23e32e];return _0x489bd8;};'use strict';var _=require(_0xc542('0x0'));var util=require(_0xc542('0x1'));var moment=require(_0xc542('0x2'));var BPromise=require(_0xc542('0x3'));var rs=require(_0xc542('0x4'));var fs=require('fs');var Redis=require(_0xc542('0x5'));var db=require(_0xc542('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc542('0x7'))(_0xc542('0x8'));var config=require('../../config/environment');var jayson=require(_0xc542('0x9'));var client=jayson['client'][_0xc542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a193,_0x55f5ef,_0x4a0e56){return new BPromise(function(_0x420770,_0x5079b8){return client[_0xc542('0xb')](_0x12a193,_0x4a0e56)[_0xc542('0xc')](function(_0x4a601d){logger[_0xc542('0xd')](_0xc542('0xe'),_0x55f5ef,'request\x20sent');logger[_0xc542('0xf')](_0xc542('0x10'),_0x55f5ef,_0xc542('0x11'),JSON[_0xc542('0x12')](_0x4a601d));if(_0x4a601d['error']){if(_0x4a601d[_0xc542('0x13')][_0xc542('0x14')]===0x1f4){logger[_0xc542('0x13')](_0xc542('0xe'),_0x55f5ef,_0x4a601d[_0xc542('0x13')][_0xc542('0x15')]);return _0x5079b8(_0x4a601d[_0xc542('0x13')]['message']);}logger[_0xc542('0x13')](_0xc542('0xe'),_0x55f5ef,_0x4a601d['error'][_0xc542('0x15')]);return _0x420770(_0x4a601d[_0xc542('0x13')][_0xc542('0x15')]);}else{logger[_0xc542('0xd')](_0xc542('0xe'),_0x55f5ef,_0xc542('0x11'));_0x420770(_0x4a601d['result']['message']);}})[_0xc542('0x16')](function(_0xa4c23b){logger[_0xc542('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x55f5ef,_0xa4c23b);_0x5079b8(_0xa4c23b);});});} \ No newline at end of file +var _0xed28=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x165174,_0x1dbbcc){var _0xff11=function(_0x235ae4){while(--_0x235ae4){_0x165174['push'](_0x165174['shift']());}};_0xff11(++_0x1dbbcc);}(_0xed28,0x1e4));var _0x8ed2=function(_0x15cb9f,_0x339d2f){_0x15cb9f=_0x15cb9f-0x0;var _0x17fad8=_0xed28[_0x15cb9f];return _0x17fad8;};'use strict';var _=require(_0x8ed2('0x0'));var util=require(_0x8ed2('0x1'));var moment=require('moment');var BPromise=require(_0x8ed2('0x2'));var rs=require(_0x8ed2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ed2('0x4'))['db'];var utils=require(_0x8ed2('0x5'));var logger=require(_0x8ed2('0x6'))(_0x8ed2('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ed2('0x8'));var client=jayson['client'][_0x8ed2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48a67f,_0x473bac,_0x14a1aa){return new BPromise(function(_0x2531e5,_0xec11a8){return client['request'](_0x48a67f,_0x14a1aa)[_0x8ed2('0xa')](function(_0x238cc7){logger[_0x8ed2('0xb')](_0x8ed2('0xc'),_0x473bac,'request\x20sent');logger[_0x8ed2('0xd')](_0x8ed2('0xe'),_0x473bac,_0x8ed2('0xf'),JSON[_0x8ed2('0x10')](_0x238cc7));if(_0x238cc7[_0x8ed2('0x11')]){if(_0x238cc7[_0x8ed2('0x11')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x473bac,_0x238cc7[_0x8ed2('0x11')][_0x8ed2('0x12')]);return _0xec11a8(_0x238cc7[_0x8ed2('0x11')]['message']);}logger['error'](_0x8ed2('0xc'),_0x473bac,_0x238cc7[_0x8ed2('0x11')][_0x8ed2('0x12')]);return _0x2531e5(_0x238cc7['error'][_0x8ed2('0x12')]);}else{logger[_0x8ed2('0xb')](_0x8ed2('0xc'),_0x473bac,_0x8ed2('0xf'));_0x2531e5(_0x238cc7[_0x8ed2('0x13')][_0x8ed2('0x12')]);}})[_0x8ed2('0x14')](function(_0x5b54e5){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x473bac,_0x5b54e5);_0xec11a8(_0x5b54e5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f0d5e8e..5bd73e0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2e3ebb,_0x5afc59){var _0x8f027f=function(_0x29b2f3){while(--_0x29b2f3){_0x2e3ebb['push'](_0x2e3ebb['shift']());}};_0x8f027f(++_0x5afc59);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1a48f2,_0x5d2109){var _0x2b46c6=function(_0x32a496){while(--_0x32a496){_0x1a48f2['push'](_0x1a48f2['shift']());}};_0x2b46c6(++_0x5d2109);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 16254a7..6bf14a9 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 _0xbf54=['INTEGER','sequelize'];(function(_0x24be2d,_0x4b8647){var _0x4f74ec=function(_0x35e6f4){while(--_0x35e6f4){_0x24be2d['push'](_0x24be2d['shift']());}};_0x4f74ec(++_0x4b8647);}(_0xbf54,0x18f));var _0x4bf5=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xbf54[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x4bf5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4bf5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5547=['INTEGER','sequelize','exports'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x5547,0x76));var _0x7554=function(_0x39c0fe,_0x285b08){_0x39c0fe=_0x39c0fe-0x0;var _0x381a92=_0x5547[_0x39c0fe];return _0x381a92;};'use strict';var Sequelize=require(_0x7554('0x0'));module[_0x7554('0x1')]={'penalty':{'type':Sequelize[_0x7554('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f6d1e72..3e1a476 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 _0x97ce=['../../config/environment','./userMailQueue.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x31ee03,_0x17ab14){var _0x3bee07=function(_0x15102c){while(--_0x15102c){_0x31ee03['push'](_0x31ee03['shift']());}};_0x3bee07(++_0x17ab14);}(_0x97ce,0x193));var _0xe97c=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x97ce[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var logger=require(_0xe97c('0x2'))(_0xe97c('0x3'));var moment=require('moment');var BPromise=require(_0xe97c('0x4'));var rp=require(_0xe97c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe97c('0x6'));var config=require(_0xe97c('0x7'));var attributes=require(_0xe97c('0x8'));module['exports']=function(_0x452bb4,_0x5d8f05){return _0x452bb4[_0xe97c('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3161=['bluebird','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x424200,_0xc020e9){var _0x327265=function(_0x3cf5f9){while(--_0x3cf5f9){_0x424200['push'](_0x424200['shift']());}};_0x327265(++_0xc020e9);}(_0x3161,0xff));var _0x1316=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3161[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1316('0x0'));var util=require(_0x1316('0x1'));var logger=require(_0x1316('0x2'))(_0x1316('0x3'));var moment=require(_0x1316('0x4'));var BPromise=require(_0x1316('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1316('0x6'));var attributes=require(_0x1316('0x7'));module['exports']=function(_0x5d5175,_0x543cc8){return _0x5d5175[_0x1316('0x8')]('UserMailQueue',attributes,{'tableName':_0x1316('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 52f40d9..0bb97e3 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 _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(_0x968f7c,_0x3d48d1){var _0x5aadbe=function(_0x43a380){while(--_0x43a380){_0x968f7c['push'](_0x968f7c['shift']());}};_0x5aadbe(++_0x3d48d1);}(_0x34e8,0x12c));var _0x834e=function(_0x218280,_0x5a5b77){_0x218280=_0x218280-0x0;var _0x1041a2=_0x34e8[_0x218280];return _0x1041a2;};'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 +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x3354fd,_0xfe2fe8){var _0x393b53=function(_0x97a2c1){while(--_0x97a2c1){_0x3354fd['push'](_0x3354fd['shift']());}};_0x393b53(++_0xfe2fe8);}(_0x3e74,0x175));var _0x43e7=function(_0x1c204c,_0x5785a9){_0x1c204c=_0x1c204c-0x0;var _0x515600=_0x3e74[_0x1c204c];return _0x515600;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7942e13..3226848 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 _0x6cd3=['post','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x6cd3,0xf4));var _0x36cd=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x6cd3[_0x334fea];return _0x3c5829;};'use strict';var multer=require(_0x36cd('0x0'));var util=require('util');var path=require(_0x36cd('0x1'));var timeout=require(_0x36cd('0x2'));var express=require(_0x36cd('0x3'));var router=express[_0x36cd('0x4')]();var fs_extra=require(_0x36cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x36cd('0x6'));var config=require(_0x36cd('0x7'));var controller=require(_0x36cd('0x8'));router[_0x36cd('0x9')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x36cd('0xa')]=router; \ No newline at end of file +var _0x39ff=['sendUserNotification','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x39ff,0xfc));var _0xf39f=function(_0x1e43aa,_0x1015ae){_0x1e43aa=_0x1e43aa-0x0;var _0x244d16=_0x39ff[_0x1e43aa];return _0x244d16;};'use strict';var multer=require(_0xf39f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf39f('0x1'));var express=require(_0xf39f('0x2'));var router=express['Router']();var fs_extra=require(_0xf39f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf39f('0x4'));var controller=require(_0xf39f('0x5'));router[_0xf39f('0x6')]('/',auth[_0xf39f('0x7')](),controller[_0xf39f('0x8')]);module[_0xf39f('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 649486b..21a9869 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 _0xbcfb=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1928df,_0x51b325){var _0x260d12=function(_0x17908e){while(--_0x17908e){_0x1928df['push'](_0x1928df['shift']());}};_0x260d12(++_0x51b325);}(_0xbcfb,0xbd));var _0xbbcf=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xbcfb[_0x510b98];return _0x45e775;};'use strict';var Sequelize=require(_0xbbcf('0x0'));module[_0xbbcf('0x1')]={'body':{'type':Sequelize[_0xbbcf('0x2')]},'senderName':{'type':Sequelize[_0xbbcf('0x3')]},'recipientsId':{'type':Sequelize[_0xbbcf('0x2')]},'recipientsDescription':{'type':Sequelize[_0xbbcf('0x3')]},'beep':{'type':Sequelize[_0xbbcf('0x4')]}}; \ No newline at end of file +var _0xe5ef=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xe5ef,0xf8));var _0xfe5e=function(_0x52c6e1,_0x42a721){_0x52c6e1=_0x52c6e1-0x0;var _0x2dc089=_0xe5ef[_0x52c6e1];return _0x2dc089;};'use strict';var Sequelize=require(_0xfe5e('0x0'));module[_0xfe5e('0x1')]={'body':{'type':Sequelize[_0xfe5e('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xfe5e('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfe5e('0x3')]},'beep':{'type':Sequelize[_0xfe5e('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 99012d5..478185d 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 _0x121a=['user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','render','User','ids','queue','replace','Queue','push','all','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','text','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team'];(function(_0x371005,_0xf16eb4){var _0x2f79d3=function(_0x417e0f){while(--_0x417e0f){_0x371005['push'](_0x371005['shift']());}};_0x2f79d3(++_0xf16eb4);}(_0x121a,0x86));var _0xa121=function(_0x16dffa,_0x139bee){_0x16dffa=_0x16dffa-0x0;var _0x29a5c6=_0x121a[_0x16dffa];return _0x29a5c6;};'use strict';var emlformat=require(_0xa121('0x0'));var rimraf=require(_0xa121('0x1'));var zipdir=require(_0xa121('0x2'));var jsonpatch=require(_0xa121('0x3'));var rp=require('request-promise');var moment=require(_0xa121('0x4'));var BPromise=require(_0xa121('0x5'));var Mustache=require(_0xa121('0x6'));var util=require(_0xa121('0x7'));var path=require('path');var sox=require(_0xa121('0x8'));var csv=require(_0xa121('0x9'));var ejs=require(_0xa121('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa121('0xb'));var squel=require(_0xa121('0xc'));var crypto=require(_0xa121('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa121('0xe'));var toCsv=require(_0xa121('0x9'));var querystring=require('querystring');var Papa=require(_0xa121('0xf'));var Redis=require('ioredis');var authService=require(_0xa121('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa121('0x11'));var hardwareService=require(_0xa121('0x12'));var logger=require(_0xa121('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa121('0x14'));var licenseUtil=require(_0xa121('0x15'));var db=require(_0xa121('0x16'))['db'];config[_0xa121('0x17')]=_['defaults'](config[_0xa121('0x17')],{'host':_0xa121('0x18'),'port':0x18eb});var socket=require(_0xa121('0x19'))(new Redis(config[_0xa121('0x17')]));require('./userNotification.socket')[_0xa121('0x1a')](socket);function respondWithStatusCode(_0x509791,_0x30959e){_0x30959e=_0x30959e||0xcc;return function(_0x5ea177){if(_0x5ea177){return _0x509791[_0xa121('0x1b')](_0x30959e);}return _0x509791[_0xa121('0x1c')](_0x30959e)['end']();};}function respondWithResult(_0x5ca8e5,_0x52fa2d){_0x52fa2d=_0x52fa2d||0xc8;return function(_0x10a7c5){if(_0x10a7c5){return _0x5ca8e5[_0xa121('0x1c')](_0x52fa2d)[_0xa121('0x1d')](_0x10a7c5);}};}function respondWithFilteredResult(_0x34b93e,_0x9d6748){return function(_0xa45ae3){if(_0xa45ae3){var _0x2bbbec=typeof _0x9d6748['offset']===_0xa121('0x1e')&&typeof _0x9d6748[_0xa121('0x1f')]===_0xa121('0x1e');var _0x4ca7a7=_0xa45ae3[_0xa121('0x20')];var _0xcae367=_0x2bbbec?0x0:_0x9d6748[_0xa121('0x21')];var _0x429ca9=_0x2bbbec?_0xa45ae3[_0xa121('0x20')]:_0x9d6748['offset']+_0x9d6748[_0xa121('0x1f')];var _0x10c870;if(_0x429ca9>=_0x4ca7a7){_0x429ca9=_0x4ca7a7;_0x10c870=0xc8;}else{_0x10c870=0xce;}_0x34b93e[_0xa121('0x1c')](_0x10c870);return _0x34b93e['set'](_0xa121('0x22'),_0xcae367+'-'+_0x429ca9+'/'+_0x4ca7a7)[_0xa121('0x1d')](_0xa45ae3);}return null;};}function patchUpdates(_0x359631){return function(_0x1c6c38){try{jsonpatch[_0xa121('0x23')](_0x1c6c38,_0x359631,!![]);}catch(_0x2482e4){return BPromise[_0xa121('0x24')](_0x2482e4);}return _0x1c6c38['save']();};}function saveUpdates(_0x3484f1,_0x36e823){return function(_0x42d90c){if(_0x42d90c){return _0x42d90c[_0xa121('0x25')](_0x3484f1)[_0xa121('0x26')](function(_0x350bf8){return _0x350bf8;});}return null;};}function removeEntity(_0x5e5b7f,_0x429615){return function(_0x4f35ec){if(_0x4f35ec){return _0x4f35ec[_0xa121('0x27')]()[_0xa121('0x26')](function(){_0x5e5b7f[_0xa121('0x1c')](0xcc)[_0xa121('0x28')]();});}};}function handleEntityNotFound(_0x10cc8e,_0x2098cc){return function(_0xce46ce){if(!_0xce46ce){_0x10cc8e[_0xa121('0x1b')](0x194);}return _0xce46ce;};}function handleError(_0x51ef3e,_0x2524be){_0x2524be=_0x2524be||0x1f4;return function(_0x31bb90){logger['error'](_0x31bb90[_0xa121('0x29')]);if(_0x31bb90['name']){delete _0x31bb90[_0xa121('0x2a')];}_0x51ef3e[_0xa121('0x1c')](_0x2524be)[_0xa121('0x2b')](_0x31bb90);};}exports['sendUserNotification']=function(_0x2d24aa,_0x5be45d,_0x4cc508){if(!_0x2d24aa['body']['hasOwnProperty'](_0xa121('0x2c'))&&!_0x2d24aa[_0xa121('0x2d')][_0xa121('0x2e')](_0xa121('0x2f'))){throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2d24aa['body']['hasOwnProperty'](_0xa121('0x2f'))&&!_0x2d24aa['body'][_0xa121('0x2e')]('view')){throw new db['Sequelize']['ValidationError'](_0xa121('0x32'));}if(!_0x2d24aa['body'][_0xa121('0x2e')](_0xa121('0x33'))){throw new db['Sequelize'][(_0xa121('0x31'))](_0xa121('0x34'));}else{try{var _0x2f3e41=JSON[_0xa121('0x35')](_0x2d24aa[_0xa121('0x2d')]['recipients']);}catch(_0x957cd7){logger[_0xa121('0x36')](_0x957cd7);throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))](_0xa121('0x37'));}var _0x246a42=[_0xa121('0x38'),'faxqueue',_0xa121('0x39'),'openchannelqueue',_0xa121('0x3a'),_0xa121('0x3b'),_0xa121('0x3c'),_0xa121('0x3d'),_0xa121('0x3e')];if(_[_0xa121('0x3f')](_0x2f3e41,function(_0xc5ea7d){return!_[_0xa121('0x40')](_0x246a42,_0xc5ea7d[_0xa121('0x41')][_0xa121('0x42')]());})){throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))](_0xa121('0x43'));}}}var _0x241b15={};_0x241b15[_0xa121('0x44')]=_0x2d24aa[_0xa121('0x2d')][_0xa121('0x2e')]('senderName')?_0x2d24aa[_0xa121('0x2d')][_0xa121('0x44')]:_0x2d24aa[_0xa121('0x3e')][_0xa121('0x45')];_0x241b15[_0xa121('0x46')]=_[_0xa121('0x47')](_0x2d24aa[_0xa121('0x2d')]['recipientsDescription'])?null:_0x2d24aa['body'][_0xa121('0x46')];_0x241b15['beep']=_0x2d24aa[_0xa121('0x2d')][_0xa121('0x48')]||![];_0x241b15['SenderId']=_0x2d24aa['user']['id'];return getContent(_0x2d24aa[_0xa121('0x2d')])[_0xa121('0x26')](function(_0x59cb83){_0x241b15[_0xa121('0x2d')]=_0x59cb83;return getRecipients(_0x2f3e41);})[_0xa121('0x26')](function(_0x367be6){_0x241b15[_0xa121('0x49')]=_[_0xa121('0x4a')](_0x367be6)[_0xa121('0x4b')](',');return db[_0xa121('0x4c')][_0xa121('0x4d')](function(_0x3f802e){return db[_0xa121('0x4e')][_0xa121('0x4f')](_0x241b15,{'raw':!![],'transaction':_0x3f802e})[_0xa121('0x26')](function(_0x43fb44){var _0x314e77={'sender':_0x241b15[_0xa121('0x44')],'description':_0x241b15[_0xa121('0x46')],'content':_0x241b15[_0xa121('0x2d')],'beep':_0x241b15['beep']};_0x367be6[_0xa121('0x50')](function(_0x137ad8){_0x314e77[_0xa121('0x51')]=_0x137ad8;socket[_0xa121('0x52')](_0xa121('0x53'),_0x314e77);});return _0x43fb44;});});})[_0xa121('0x26')](respondWithResult(_0x5be45d,0xc9))[_0xa121('0x54')](handleError(_0x5be45d,null));};function getContent(_0x5410bb){return new BPromise(function(_0x3bc58d,_0x4f3287){if(_0x5410bb[_0xa121('0x2c')]){_0x3bc58d(_0x5410bb['text']);return;}return db[_0xa121('0x55')]['findOne']({'attributes':[_0xa121('0x56')],'where':{'id':_0x5410bb[_0xa121('0x2f')]},'raw':!![]})[_0xa121('0x26')](function(_0x3d9e83){if(!_0x3d9e83)throw new db[(_0xa121('0x30'))][(_0xa121('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x483627=Mustache[_0xa121('0x57')](_0x3d9e83[_0xa121('0x56')],_0x5410bb['view']);_0x3bc58d(_0x483627);})['catch'](function(_0x271872){_0x4f3287(_0x271872);});});}function getRecipients(_0xaffd97){return new BPromise(function(_0x1cdcba,_0x370012){var _0x52ebee=[];var _0x59c17b=[];_0xaffd97['forEach'](function(_0x4b58e1){var _0x1831ff=_['startCase'](_0x4b58e1[_0xa121('0x41')]['toLowerCase']());if(_0x1831ff===_0xa121('0x58')){_0x52ebee=_['union'](_0x52ebee,_0x4b58e1[_0xa121('0x59')]);}else{if(_[_0xa121('0x40')](_0x1831ff,_0xa121('0x5a')))_0x1831ff=_0x1831ff[_0xa121('0x5b')]('queue',_0xa121('0x5c'));_0x4b58e1['ids'][_0xa121('0x50')](function(_0x346561){_0x59c17b[_0xa121('0x5d')](getAgents(_0x1831ff,_0x346561));});}});return BPromise[_0xa121('0x5e')](_0x59c17b)[_0xa121('0x26')](function(_0x5a6af5){_0x52ebee=_['union'](_0x52ebee,_[_0xa121('0x5f')](_0x5a6af5));_0x1cdcba(_0x52ebee);})[_0xa121('0x54')](function(_0x59115b){_0x370012(_0x59115b);});});}function getAgents(_0x5d8e3b,_0x53f46e){return new BPromise(function(_0xa783ef,_0x263e3d){return db[_0x5d8e3b][_0xa121('0x60')]({'where':{'id':_0x53f46e}})['then'](function(_0x302eac){return _0x302eac[_0xa121('0x61')]({'attributes':['id'],'raw':!![]})[_0xa121('0x26')](function(_0x54ac65){var _0x1a8e44=_['map'](_0x54ac65,'id');_0xa783ef(_0x1a8e44);});})[_0xa121('0x54')](function(_0x3b99f6){_0x263e3d(_0x3b99f6);});});} \ No newline at end of file +var _0xf9da=['status','offset','undefined','count','Content-Range','json','reject','save','update','destroy','then','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','transaction','UserNotification','create','forEach','emit','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','toLowerCase','User','union','ids','replace','queue','all','flatten','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end'];(function(_0x175c5d,_0x4ff61b){var _0x4ff7f9=function(_0x41210e){while(--_0x41210e){_0x175c5d['push'](_0x175c5d['shift']());}};_0x4ff7f9(++_0x4ff61b);}(_0xf9da,0x1bc));var _0xaf9d=function(_0x11fff7,_0x46baaf){_0x11fff7=_0x11fff7-0x0;var _0x5214a5=_0xf9da[_0x11fff7];return _0x5214a5;};'use strict';var emlformat=require(_0xaf9d('0x0'));var rimraf=require(_0xaf9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf9d('0x2'));var rp=require(_0xaf9d('0x3'));var moment=require(_0xaf9d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf9d('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf9d('0x6'));var fs=require('fs');var fs_extra=require(_0xaf9d('0x7'));var _=require('lodash');var squel=require(_0xaf9d('0x8'));var crypto=require(_0xaf9d('0x9'));var jsforce=require(_0xaf9d('0xa'));var deskjs=require(_0xaf9d('0xb'));var toCsv=require(_0xaf9d('0xc'));var querystring=require('querystring');var Papa=require(_0xaf9d('0xd'));var Redis=require(_0xaf9d('0xe'));var authService=require(_0xaf9d('0xf'));var qs=require(_0xaf9d('0x10'));var as=require(_0xaf9d('0x11'));var hardwareService=require(_0xaf9d('0x12'));var logger=require(_0xaf9d('0x13'))(_0xaf9d('0x14'));var utils=require(_0xaf9d('0x15'));var config=require(_0xaf9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf9d('0x17'))['db'];config['redis']=_['defaults'](config[_0xaf9d('0x18')],{'host':_0xaf9d('0x19'),'port':0x18eb});var socket=require(_0xaf9d('0x1a'))(new Redis(config[_0xaf9d('0x18')]));require(_0xaf9d('0x1b'))[_0xaf9d('0x1c')](socket);function respondWithStatusCode(_0x4c12dc,_0xb7347d){_0xb7347d=_0xb7347d||0xcc;return function(_0x2107a7){if(_0x2107a7){return _0x4c12dc[_0xaf9d('0x1d')](_0xb7347d);}return _0x4c12dc['status'](_0xb7347d)[_0xaf9d('0x1e')]();};}function respondWithResult(_0x1c6385,_0x182365){_0x182365=_0x182365||0xc8;return function(_0x23e19a){if(_0x23e19a){return _0x1c6385[_0xaf9d('0x1f')](_0x182365)['json'](_0x23e19a);}};}function respondWithFilteredResult(_0xc3d085,_0x40e232){return function(_0x2830ce){if(_0x2830ce){var _0x311ccc=typeof _0x40e232[_0xaf9d('0x20')]==='undefined'&&typeof _0x40e232['limit']===_0xaf9d('0x21');var _0x2de5bb=_0x2830ce[_0xaf9d('0x22')];var _0x21ea80=_0x311ccc?0x0:_0x40e232[_0xaf9d('0x20')];var _0x15ecc7=_0x311ccc?_0x2830ce[_0xaf9d('0x22')]:_0x40e232[_0xaf9d('0x20')]+_0x40e232['limit'];var _0x5f34bc;if(_0x15ecc7>=_0x2de5bb){_0x15ecc7=_0x2de5bb;_0x5f34bc=0xc8;}else{_0x5f34bc=0xce;}_0xc3d085[_0xaf9d('0x1f')](_0x5f34bc);return _0xc3d085['set'](_0xaf9d('0x23'),_0x21ea80+'-'+_0x15ecc7+'/'+_0x2de5bb)[_0xaf9d('0x24')](_0x2830ce);}return null;};}function patchUpdates(_0x1273da){return function(_0x1c0cba){try{jsonpatch['apply'](_0x1c0cba,_0x1273da,!![]);}catch(_0x4388cd){return BPromise[_0xaf9d('0x25')](_0x4388cd);}return _0x1c0cba[_0xaf9d('0x26')]();};}function saveUpdates(_0x858b1f,_0x529bde){return function(_0x264998){if(_0x264998){return _0x264998[_0xaf9d('0x27')](_0x858b1f)['then'](function(_0x4a10b2){return _0x4a10b2;});}return null;};}function removeEntity(_0x3e22f1,_0x120a99){return function(_0x29e7da){if(_0x29e7da){return _0x29e7da[_0xaf9d('0x28')]()[_0xaf9d('0x29')](function(){_0x3e22f1['status'](0xcc)[_0xaf9d('0x1e')]();});}};}function handleEntityNotFound(_0x1fd3d8,_0xd969b){return function(_0x1caf5d){if(!_0x1caf5d){_0x1fd3d8[_0xaf9d('0x1d')](0x194);}return _0x1caf5d;};}function handleError(_0x4f94b5,_0x4e3084){_0x4e3084=_0x4e3084||0x1f4;return function(_0x3853e3){logger['error'](_0x3853e3['stack']);if(_0x3853e3[_0xaf9d('0x2a')]){delete _0x3853e3['name'];}_0x4f94b5['status'](_0x4e3084)[_0xaf9d('0x2b')](_0x3853e3);};}exports[_0xaf9d('0x2c')]=function(_0x5e23ed,_0x28b116,_0x4efa67){if(!_0x5e23ed[_0xaf9d('0x2d')]['hasOwnProperty'](_0xaf9d('0x2e'))&&!_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x2f')](_0xaf9d('0x30'))){throw new db[(_0xaf9d('0x31'))]['ValidationError'](_0xaf9d('0x32'));}else{if(_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x2f')](_0xaf9d('0x30'))&&!_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x2f')]('view')){throw new db['Sequelize'][(_0xaf9d('0x33'))](_0xaf9d('0x34'));}if(!_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x2f')](_0xaf9d('0x35'))){throw new db['Sequelize'][(_0xaf9d('0x33'))](_0xaf9d('0x36'));}else{try{var _0x3d94d8=JSON[_0xaf9d('0x37')](_0x5e23ed['body'][_0xaf9d('0x35')]);}catch(_0x278c02){logger[_0xaf9d('0x38')](_0x278c02);throw new db['Sequelize'][(_0xaf9d('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5e233f=[_0xaf9d('0x39'),'faxqueue',_0xaf9d('0x3a'),_0xaf9d('0x3b'),_0xaf9d('0x3c'),'voicequeue',_0xaf9d('0x3d'),_0xaf9d('0x3e'),_0xaf9d('0x3f')];if(_[_0xaf9d('0x40')](_0x3d94d8,function(_0x19cc95){return!_[_0xaf9d('0x41')](_0x5e233f,_0x19cc95[_0xaf9d('0x42')]['toLowerCase']());})){throw new db['Sequelize'][(_0xaf9d('0x33'))](_0xaf9d('0x43'));}}}var _0x3a8eff={};_0x3a8eff['senderName']=_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x2f')](_0xaf9d('0x44'))?_0x5e23ed['body'][_0xaf9d('0x44')]:_0x5e23ed[_0xaf9d('0x3f')]['fullname'];_0x3a8eff[_0xaf9d('0x45')]=_[_0xaf9d('0x46')](_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x45')])?null:_0x5e23ed[_0xaf9d('0x2d')][_0xaf9d('0x45')];_0x3a8eff[_0xaf9d('0x47')]=_0x5e23ed[_0xaf9d('0x2d')]['beep']||![];_0x3a8eff[_0xaf9d('0x48')]=_0x5e23ed[_0xaf9d('0x3f')]['id'];return getContent(_0x5e23ed[_0xaf9d('0x2d')])[_0xaf9d('0x29')](function(_0x27e895){_0x3a8eff[_0xaf9d('0x2d')]=_0x27e895;return getRecipients(_0x3d94d8);})['then'](function(_0x5a88b1){_0x3a8eff[_0xaf9d('0x49')]=_[_0xaf9d('0x4a')](_0x5a88b1)['join'](',');return db['sequelize'][_0xaf9d('0x4b')](function(_0x2d1bf3){return db[_0xaf9d('0x4c')][_0xaf9d('0x4d')](_0x3a8eff,{'raw':!![],'transaction':_0x2d1bf3})[_0xaf9d('0x29')](function(_0x4c8363){var _0x115f0b={'sender':_0x3a8eff[_0xaf9d('0x44')],'description':_0x3a8eff['recipientsDescription'],'content':_0x3a8eff[_0xaf9d('0x2d')],'beep':_0x3a8eff['beep']};_0x5a88b1[_0xaf9d('0x4e')](function(_0x469bb3){_0x115f0b['recipient']=_0x469bb3;socket[_0xaf9d('0x4f')]('userNotification:send',_0x115f0b);});return _0x4c8363;});});})[_0xaf9d('0x29')](respondWithResult(_0x28b116,0xc9))['catch'](handleError(_0x28b116,null));};function getContent(_0x20766d){return new BPromise(function(_0x835053,_0x5bd276){if(_0x20766d['text']){_0x835053(_0x20766d['text']);return;}return db[_0xaf9d('0x50')][_0xaf9d('0x51')]({'attributes':[_0xaf9d('0x52')],'where':{'id':_0x20766d[_0xaf9d('0x30')]},'raw':!![]})[_0xaf9d('0x29')](function(_0x109ece){if(!_0x109ece)throw new db[(_0xaf9d('0x31'))][(_0xaf9d('0x33'))](_0xaf9d('0x53'));var _0x3e48a6=Mustache[_0xaf9d('0x54')](_0x109ece['html'],_0x20766d['view']);_0x835053(_0x3e48a6);})[_0xaf9d('0x55')](function(_0x2ce274){_0x5bd276(_0x2ce274);});});}function getRecipients(_0x3cd371){return new BPromise(function(_0x5c7329,_0x42328b){var _0x4f453b=[];var _0x3b8db4=[];_0x3cd371[_0xaf9d('0x4e')](function(_0x138a6d){var _0x2ab99c=_[_0xaf9d('0x56')](_0x138a6d[_0xaf9d('0x42')][_0xaf9d('0x57')]());if(_0x2ab99c===_0xaf9d('0x58')){_0x4f453b=_[_0xaf9d('0x59')](_0x4f453b,_0x138a6d[_0xaf9d('0x5a')]);}else{if(_[_0xaf9d('0x41')](_0x2ab99c,'queue'))_0x2ab99c=_0x2ab99c[_0xaf9d('0x5b')](_0xaf9d('0x5c'),'Queue');_0x138a6d[_0xaf9d('0x5a')][_0xaf9d('0x4e')](function(_0x28d329){_0x3b8db4['push'](getAgents(_0x2ab99c,_0x28d329));});}});return BPromise[_0xaf9d('0x5d')](_0x3b8db4)['then'](function(_0x4441cd){_0x4f453b=_['union'](_0x4f453b,_[_0xaf9d('0x5e')](_0x4441cd));_0x5c7329(_0x4f453b);})[_0xaf9d('0x55')](function(_0x4e1a61){_0x42328b(_0x4e1a61);});});}function getAgents(_0x2c1e2c,_0x59c4fa){return new BPromise(function(_0x1a6071,_0x424daf){return db[_0x2c1e2c][_0xaf9d('0x51')]({'where':{'id':_0x59c4fa}})[_0xaf9d('0x29')](function(_0x5051c5){return _0x5051c5['getAgents']({'attributes':['id'],'raw':!![]})[_0xaf9d('0x29')](function(_0x8a97e7){var _0x25d90b=_['map'](_0x8a97e7,'id');_0x1a6071(_0x25d90b);});})['catch'](function(_0x2b4638){_0x424daf(_0x2b4638);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 5be5bbe..3e2a219 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 _0x5f54=['setMaxListeners','save','update','hasOwnProperty','hook','exports','../../mysqldb','UserNotification'];(function(_0x502a4c,_0x298a92){var _0x485b38=function(_0x75ffa0){while(--_0x75ffa0){_0x502a4c['push'](_0x502a4c['shift']());}};_0x485b38(++_0x298a92);}(_0x5f54,0xa6));var _0x45f5=function(_0x240926,_0x1aab68){_0x240926=_0x240926-0x0;var _0x4e6120=_0x5f54[_0x240926];return _0x4e6120;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x45f5('0x0'))['db'][_0x45f5('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x45f5('0x2')](0x0);var events={'afterCreate':_0x45f5('0x3'),'afterUpdate':_0x45f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a613b){return function(_0x4d1c08,_0xd0a956,_0x56083d){UserNotificationEvents['emit'](_0x4a613b+':'+_0x4d1c08['id'],_0x4d1c08);UserNotificationEvents['emit'](_0x4a613b,_0x4d1c08);_0x56083d(null);};}for(var e in events){if(events[_0x45f5('0x5')](e)){var event=events[e];UserNotification[_0x45f5('0x6')](e,emitEvent(event));}}module[_0x45f5('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x5dda=['../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x39f4e1,_0x23fcdf){var _0x2f74d9=function(_0x7fd732){while(--_0x7fd732){_0x39f4e1['push'](_0x39f4e1['shift']());}};_0x2f74d9(++_0x23fcdf);}(_0x5dda,0x149));var _0xa5dd=function(_0x3372fb,_0x3a4b3c){_0x3372fb=_0x3372fb-0x0;var _0x59690d=_0x5dda[_0x3372fb];return _0x59690d;};'use strict';var EventEmitter=require(_0xa5dd('0x0'));var UserNotification=require(_0xa5dd('0x1'))['db'][_0xa5dd('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa5dd('0x3')](0x0);var events={'afterCreate':_0xa5dd('0x4'),'afterUpdate':_0xa5dd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x15decc){return function(_0x16f0cc,_0x2367e6,_0xcf42af){UserNotificationEvents[_0xa5dd('0x6')](_0x15decc+':'+_0x16f0cc['id'],_0x16f0cc);UserNotificationEvents[_0xa5dd('0x6')](_0x15decc,_0x16f0cc);_0xcf42af(null);};}for(var e in events){if(events[_0xa5dd('0x7')](e)){var event=events[e];UserNotification[_0xa5dd('0x8')](e,emitEvent(event));}}module[_0xa5dd('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 710cae7..61306ab 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 _0xf5b7=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf5b7,0x74));var _0x7f5b=function(_0x37e77d,_0x54fd40){_0x37e77d=_0x37e77d-0x0;var _0x417410=_0xf5b7[_0x37e77d];return _0x417410;};'use strict';var _=require(_0x7f5b('0x0'));var util=require('util');var logger=require(_0x7f5b('0x1'))(_0x7f5b('0x2'));var moment=require(_0x7f5b('0x3'));var BPromise=require(_0x7f5b('0x4'));var rp=require(_0x7f5b('0x5'));var fs=require('fs');var path=require(_0x7f5b('0x6'));var rimraf=require(_0x7f5b('0x7'));var config=require(_0x7f5b('0x8'));var attributes=require(_0x7f5b('0x9'));module[_0x7f5b('0xa')]=function(_0x57ca78,_0x1c2364){return _0x57ca78[_0x7f5b('0xb')](_0x7f5b('0xc'),attributes,{'tableName':_0x7f5b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f5b('0xe'),'collate':_0x7f5b('0xf')});}; \ No newline at end of file +var _0x0972=['util','../../config/logger','api','bluebird','rimraf','./userNotification.attributes','exports','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3fd25b,_0x159e24){var _0x47d207=function(_0x279f9f){while(--_0x279f9f){_0x3fd25b['push'](_0x3fd25b['shift']());}};_0x47d207(++_0x159e24);}(_0x0972,0xa4));var _0x2097=function(_0x1e2aa4,_0x53801b){_0x1e2aa4=_0x1e2aa4-0x0;var _0x21b83f=_0x0972[_0x1e2aa4];return _0x21b83f;};'use strict';var _=require(_0x2097('0x0'));var util=require(_0x2097('0x1'));var logger=require(_0x2097('0x2'))(_0x2097('0x3'));var moment=require('moment');var BPromise=require(_0x2097('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x5'));var config=require('../../config/environment');var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x59fd76,_0x292784){return _0x59fd76['define']('UserNotification',attributes,{'tableName':_0x2097('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2097('0x9'),'collate':_0x2097('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 09253c4..4eaa860 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 _0xc4ca=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11c686,_0x12d5fb){var _0x459f55=function(_0x5307e8){while(--_0x5307e8){_0x11c686['push'](_0x11c686['shift']());}};_0x459f55(++_0x12d5fb);}(_0xc4ca,0x14b));var _0xac4c=function(_0x4f4d4a,_0x21bdaa){_0x4f4d4a=_0x4f4d4a-0x0;var _0x20b807=_0xc4ca[_0x4f4d4a];return _0x20b807;};'use strict';var _=require('lodash');var util=require(_0xac4c('0x0'));var moment=require(_0xac4c('0x1'));var BPromise=require(_0xac4c('0x2'));var rs=require(_0xac4c('0x3'));var fs=require('fs');var Redis=require(_0xac4c('0x4'));var db=require(_0xac4c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac4c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xac4c('0x7'));var client=jayson[_0xac4c('0x8')][_0xac4c('0x9')]({'port':0x232a});config[_0xac4c('0xa')]=_['defaults'](config['redis'],{'host':_0xac4c('0xb'),'port':0x18eb});var socket=require(_0xac4c('0xc'))(new Redis(config[_0xac4c('0xa')]));require(_0xac4c('0xd'))[_0xac4c('0xe')](socket);function respondWithRpcPromise(_0x4cb0ea,_0x5ccc4a,_0x3bb71c){return new BPromise(function(_0x1b0a2d,_0x3276ce){return client[_0xac4c('0xf')](_0x4cb0ea,_0x3bb71c)[_0xac4c('0x10')](function(_0x2b5bda){logger[_0xac4c('0x11')](_0xac4c('0x12'),_0x5ccc4a,_0xac4c('0x13'));logger['debug'](_0xac4c('0x14'),_0x5ccc4a,'request\x20sent',JSON[_0xac4c('0x15')](_0x2b5bda));if(_0x2b5bda['error']){if(_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x17')]===0x1f4){logger['error'](_0xac4c('0x12'),_0x5ccc4a,_0x2b5bda['error']['message']);return _0x3276ce(_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x18')]);}logger[_0xac4c('0x16')](_0xac4c('0x12'),_0x5ccc4a,_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x18')]);return _0x1b0a2d(_0x2b5bda[_0xac4c('0x16')][_0xac4c('0x18')]);}else{logger['info'](_0xac4c('0x12'),_0x5ccc4a,'request\x20sent');_0x1b0a2d(_0x2b5bda['result'][_0xac4c('0x18')]);}})[_0xac4c('0x19')](function(_0x1dbe0a){logger[_0xac4c('0x16')](_0xac4c('0x12'),_0x5ccc4a,_0x1dbe0a);_0x3276ce(_0x1dbe0a);});});} \ No newline at end of file +var _0xdcc5=['then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register'];(function(_0x27ba86,_0x4d2b94){var _0x1b2a7c=function(_0x1fcae4){while(--_0x1fcae4){_0x27ba86['push'](_0x27ba86['shift']());}};_0x1b2a7c(++_0x4d2b94);}(_0xdcc5,0xd6));var _0x5dcc=function(_0x56961f,_0x16e68a){_0x56961f=_0x56961f-0x0;var _0x16cc66=_0xdcc5[_0x56961f];return _0x16cc66;};'use strict';var _=require(_0x5dcc('0x0'));var util=require(_0x5dcc('0x1'));var moment=require('moment');var BPromise=require(_0x5dcc('0x2'));var rs=require(_0x5dcc('0x3'));var fs=require('fs');var Redis=require(_0x5dcc('0x4'));var db=require(_0x5dcc('0x5'))['db'];var utils=require(_0x5dcc('0x6'));var logger=require(_0x5dcc('0x7'))(_0x5dcc('0x8'));var config=require(_0x5dcc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5dcc('0xa')][_0x5dcc('0xb')]({'port':0x232a});config[_0x5dcc('0xc')]=_[_0x5dcc('0xd')](config[_0x5dcc('0xc')],{'host':_0x5dcc('0xe'),'port':0x18eb});var socket=require(_0x5dcc('0xf'))(new Redis(config[_0x5dcc('0xc')]));require(_0x5dcc('0x10'))[_0x5dcc('0x11')](socket);function respondWithRpcPromise(_0x2fe6f3,_0x3de46c,_0x163664){return new BPromise(function(_0x3d8f23,_0xe4e5ce){return client['request'](_0x2fe6f3,_0x163664)[_0x5dcc('0x12')](function(_0x180d73){logger['info']('UserNotification,\x20%s,\x20%s',_0x3de46c,_0x5dcc('0x13'));logger[_0x5dcc('0x14')](_0x5dcc('0x15'),_0x3de46c,'request\x20sent',JSON[_0x5dcc('0x16')](_0x180d73));if(_0x180d73[_0x5dcc('0x17')]){if(_0x180d73[_0x5dcc('0x17')][_0x5dcc('0x18')]===0x1f4){logger[_0x5dcc('0x17')]('UserNotification,\x20%s,\x20%s',_0x3de46c,_0x180d73[_0x5dcc('0x17')][_0x5dcc('0x19')]);return _0xe4e5ce(_0x180d73[_0x5dcc('0x17')][_0x5dcc('0x19')]);}logger[_0x5dcc('0x17')](_0x5dcc('0x1a'),_0x3de46c,_0x180d73[_0x5dcc('0x17')][_0x5dcc('0x19')]);return _0x3d8f23(_0x180d73[_0x5dcc('0x17')][_0x5dcc('0x19')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x3de46c,_0x5dcc('0x13'));_0x3d8f23(_0x180d73[_0x5dcc('0x1b')][_0x5dcc('0x19')]);}})[_0x5dcc('0x1c')](function(_0x438c9a){logger[_0x5dcc('0x17')]('UserNotification,\x20%s,\x20%s',_0x3de46c,_0x438c9a);_0xe4e5ce(_0x438c9a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f42268e..3433466 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 _0x7f54=['emit','removeListener','userNotification:','./userNotification.events','save'];(function(_0x3a0cde,_0xb0a95d){var _0x566af9=function(_0x5850f1){while(--_0x5850f1){_0x3a0cde['push'](_0x3a0cde['shift']());}};_0x566af9(++_0xb0a95d);}(_0x7f54,0x85));var _0x47f5=function(_0x305fc8,_0x16e31e){_0x305fc8=_0x305fc8-0x0;var _0x427cea=_0x7f54[_0x305fc8];return _0x427cea;};'use strict';var UserNotificationEvents=require(_0x47f5('0x0'));var events=[_0x47f5('0x1'),'remove','update'];function createListener(_0x96c872,_0x466fe1){return function(_0x306755){_0x466fe1[_0x47f5('0x2')](_0x96c872,_0x306755);};}function removeListener(_0x4afdf6,_0x42781b){return function(){UserNotificationEvents[_0x47f5('0x3')](_0x4afdf6,_0x42781b);};}exports['register']=function(_0x20294b){for(var _0xaf7ace=0x0,_0x559ff0=events['length'];_0xaf7ace<_0x559ff0;_0xaf7ace++){var _0x48e888=events[_0xaf7ace];var _0x3c9924=createListener(_0x47f5('0x4')+_0x48e888,_0x20294b);UserNotificationEvents['on'](_0x48e888,_0x3c9924);}}; \ No newline at end of file +var _0xfde0=['userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xfde0,0x171));var _0x0fde=function(_0x3e72b4,_0x549d01){_0x3e72b4=_0x3e72b4-0x0;var _0x4bc41f=_0xfde0[_0x3e72b4];return _0x4bc41f;};'use strict';var UserNotificationEvents=require(_0x0fde('0x0'));var events=[_0x0fde('0x1'),_0x0fde('0x2'),_0x0fde('0x3')];function createListener(_0x101da3,_0x12ed5d){return function(_0x5502cc){_0x12ed5d[_0x0fde('0x4')](_0x101da3,_0x5502cc);};}function removeListener(_0x92a79,_0x350594){return function(){UserNotificationEvents[_0x0fde('0x5')](_0x92a79,_0x350594);};}exports[_0x0fde('0x6')]=function(_0x119455){for(var _0x4553fd=0x0,_0x3bfe3d=events['length'];_0x4553fd<_0x3bfe3d;_0x4553fd++){var _0xa2515b=events[_0x4553fd];var _0x569097=createListener(_0x0fde('0x7')+_0xa2515b,_0x119455);UserNotificationEvents['on'](_0xa2515b,_0x569097);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3509bb9..1f7659c 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x525847,_0x240458){var _0x4b8fb9=function(_0x421075){while(--_0x421075){_0x525847['push'](_0x525847['shift']());}};_0x4b8fb9(++_0x240458);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x368964,_0x57fb42){var _0x5d74cd=function(_0x53d695){while(--_0x53d695){_0x368964['push'](_0x368964['shift']());}};_0x5d74cd(++_0x57fb42);}(_0xe706,0xa3));var _0x6e70=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0xe706[_0x3b3210];return _0x5b5484;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 17459a8..ef64dd4 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 _0x231a=['sequelize','exports','INTEGER'];(function(_0x4b18f9,_0x261ef5){var _0x1488cf=function(_0x414fa2){while(--_0x414fa2){_0x4b18f9['push'](_0x4b18f9['shift']());}};_0x1488cf(++_0x261ef5);}(_0x231a,0x7b));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa231('0x0'));module[_0xa231('0x1')]={'penalty':{'type':Sequelize[_0xa231('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d3e=['sequelize','exports','INTEGER'];(function(_0x29d42c,_0x2698b0){var _0x3c91b0=function(_0x498ac6){while(--_0x498ac6){_0x29d42c['push'](_0x29d42c['shift']());}};_0x3c91b0(++_0x2698b0);}(_0x6d3e,0x186));var _0xe6d3=function(_0x4a6bec,_0x5e1c11){_0x4a6bec=_0x4a6bec-0x0;var _0x29a59e=_0x6d3e[_0x4a6bec];return _0x29a59e;};'use strict';var Sequelize=require(_0xe6d3('0x0'));module[_0xe6d3('0x1')]={'penalty':{'type':Sequelize[_0xe6d3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 89cbdc0..b2a2f75 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 _0x0d33=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash'];(function(_0x13b6d3,_0x1c46c7){var _0x259bef=function(_0x53c272){while(--_0x53c272){_0x13b6d3['push'](_0x13b6d3['shift']());}};_0x259bef(++_0x1c46c7);}(_0x0d33,0xd7));var _0x30d3=function(_0x129726,_0x10fc4a){_0x129726=_0x129726-0x0;var _0x4257bd=_0x0d33[_0x129726];return _0x4257bd;};'use strict';var _=require(_0x30d3('0x0'));var util=require(_0x30d3('0x1'));var logger=require(_0x30d3('0x2'))(_0x30d3('0x3'));var moment=require('moment');var BPromise=require(_0x30d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d3('0x5'));var rimraf=require(_0x30d3('0x6'));var config=require(_0x30d3('0x7'));var attributes=require(_0x30d3('0x8'));module[_0x30d3('0x9')]=function(_0x15e267,_0x19696c){return _0x15e267[_0x30d3('0xa')](_0x30d3('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf9a=['moment','bluebird','path','../../config/environment','exports','define','user_has_openchannel_queues','util','../../config/logger','api'];(function(_0x333622,_0x339cd1){var _0x5f5196=function(_0x45c2ad){while(--_0x45c2ad){_0x333622['push'](_0x333622['shift']());}};_0x5f5196(++_0x339cd1);}(_0xbf9a,0x1d3));var _0xabf9=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0xbf9a[_0x114b7c];return _0x47185f;};'use strict';var _=require('lodash');var util=require(_0xabf9('0x0'));var logger=require(_0xabf9('0x1'))(_0xabf9('0x2'));var moment=require(_0xabf9('0x3'));var BPromise=require(_0xabf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xabf9('0x5'));var rimraf=require('rimraf');var config=require(_0xabf9('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xabf9('0x7')]=function(_0x265579,_0x57a1a8){return _0x265579[_0xabf9('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0xabf9('0x9'),'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 d97f5ae..8c784d1 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 _0x991a=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x57160c,_0x3c8e5c){var _0x35f682=function(_0x21ca37){while(--_0x21ca37){_0x57160c['push'](_0x57160c['shift']());}};_0x35f682(++_0x3c8e5c);}(_0x991a,0x7d));var _0xa991=function(_0x1e6a20,_0x3c6b33){_0x1e6a20=_0x1e6a20-0x0;var _0x3226be=_0x991a[_0x1e6a20];return _0x3226be;};'use strict';var _=require(_0xa991('0x0'));var util=require(_0xa991('0x1'));var moment=require(_0xa991('0x2'));var BPromise=require(_0xa991('0x3'));var rs=require(_0xa991('0x4'));var fs=require('fs');var Redis=require(_0xa991('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa991('0x6'));var logger=require(_0xa991('0x7'))(_0xa991('0x8'));var config=require(_0xa991('0x9'));var jayson=require(_0xa991('0xa'));var client=jayson[_0xa991('0xb')][_0xa991('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e9c4d,_0x10d5d5,_0x55679c){return new BPromise(function(_0x4d2331,_0x22a336){return client[_0xa991('0xd')](_0x5e9c4d,_0x55679c)['then'](function(_0x46bbe9){logger[_0xa991('0xe')](_0xa991('0xf'),_0x10d5d5,_0xa991('0x10'));logger[_0xa991('0x11')](_0xa991('0x12'),_0x10d5d5,_0xa991('0x10'),JSON[_0xa991('0x13')](_0x46bbe9));if(_0x46bbe9['error']){if(_0x46bbe9[_0xa991('0x14')][_0xa991('0x15')]===0x1f4){logger[_0xa991('0x14')](_0xa991('0xf'),_0x10d5d5,_0x46bbe9[_0xa991('0x14')][_0xa991('0x16')]);return _0x22a336(_0x46bbe9[_0xa991('0x14')][_0xa991('0x16')]);}logger[_0xa991('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x10d5d5,_0x46bbe9['error'][_0xa991('0x16')]);return _0x4d2331(_0x46bbe9[_0xa991('0x14')][_0xa991('0x16')]);}else{logger[_0xa991('0xe')](_0xa991('0xf'),_0x10d5d5,_0xa991('0x10'));_0x4d2331(_0x46bbe9[_0xa991('0x17')][_0xa991('0x16')]);}})[_0xa991('0x18')](function(_0x488813){logger[_0xa991('0x14')](_0xa991('0xf'),_0x10d5d5,_0x488813);_0x22a336(_0x488813);});});} \ No newline at end of file +var _0xeb42=['error','code','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x6c1c47,_0xe3da9c){var _0xbfa2ae=function(_0x1e04e5){while(--_0x1e04e5){_0x6c1c47['push'](_0x6c1c47['shift']());}};_0xbfa2ae(++_0xe3da9c);}(_0xeb42,0xcc));var _0x2eb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb42[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2eb4('0x0'));var moment=require('moment');var BPromise=require(_0x2eb4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2eb4('0x2'));var db=require(_0x2eb4('0x3'))['db'];var utils=require(_0x2eb4('0x4'));var logger=require(_0x2eb4('0x5'))(_0x2eb4('0x6'));var config=require(_0x2eb4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2eb4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5469f2,_0xc3c14c,_0x31548f){return new BPromise(function(_0x2e4bf9,_0x96a456){return client['request'](_0x5469f2,_0x31548f)[_0x2eb4('0x9')](function(_0x399354){logger[_0x2eb4('0xa')](_0x2eb4('0xb'),_0xc3c14c,'request\x20sent');logger[_0x2eb4('0xc')](_0x2eb4('0xd'),_0xc3c14c,_0x2eb4('0xe'),JSON[_0x2eb4('0xf')](_0x399354));if(_0x399354[_0x2eb4('0x10')]){if(_0x399354[_0x2eb4('0x10')][_0x2eb4('0x11')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0xc3c14c,_0x399354[_0x2eb4('0x10')]['message']);return _0x96a456(_0x399354[_0x2eb4('0x10')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0xc3c14c,_0x399354[_0x2eb4('0x10')][_0x2eb4('0x12')]);return _0x2e4bf9(_0x399354[_0x2eb4('0x10')][_0x2eb4('0x12')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0xc3c14c,_0x2eb4('0xe'));_0x2e4bf9(_0x399354[_0x2eb4('0x13')][_0x2eb4('0x12')]);}})['catch'](function(_0x44108e){logger[_0x2eb4('0x10')](_0x2eb4('0xb'),_0xc3c14c,_0x44108e);_0x96a456(_0x44108e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index aaaa572..c18c992 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 _0xcde0=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','clone','addSections','addResources','put','update','delete','destroy','removeSections','exports'];(function(_0x82ffeb,_0x3dd0d1){var _0x14f6bf=function(_0xcfc0ae){while(--_0xcfc0ae){_0x82ffeb['push'](_0x82ffeb['shift']());}};_0x14f6bf(++_0x3dd0d1);}(_0xcde0,0x14a));var _0x0cde=function(_0x2f85d2,_0x2b96e6){_0x2f85d2=_0x2f85d2-0x0;var _0x414923=_0xcde0[_0x2f85d2];return _0x414923;};'use strict';var multer=require(_0x0cde('0x0'));var util=require(_0x0cde('0x1'));var path=require(_0x0cde('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cde('0x3'));var router=express[_0x0cde('0x4')]();var fs_extra=require(_0x0cde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0cde('0x6'));var config=require(_0x0cde('0x7'));var controller=require(_0x0cde('0x8'));router[_0x0cde('0x9')]('/',auth[_0x0cde('0xa')](),controller[_0x0cde('0xb')]);router[_0x0cde('0x9')](_0x0cde('0xc'),auth[_0x0cde('0xa')](),controller[_0x0cde('0xd')]);router[_0x0cde('0x9')](_0x0cde('0xe'),auth['isAuthenticated'](),controller[_0x0cde('0xf')]);router['get'](_0x0cde('0x10'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x11')]);router['get'](_0x0cde('0x12'),auth[_0x0cde('0xa')](),controller['getResources']);router[_0x0cde('0x13')]('/',auth[_0x0cde('0xa')](),controller[_0x0cde('0x14')]);router[_0x0cde('0x13')]('/:id/clone',auth[_0x0cde('0xa')](),controller[_0x0cde('0x15')]);router[_0x0cde('0x13')](_0x0cde('0x10'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x16')]);router[_0x0cde('0x13')](_0x0cde('0x12'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x17')]);router[_0x0cde('0x18')](_0x0cde('0xe'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x19')]);router[_0x0cde('0x1a')](_0x0cde('0xe'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x1b')]);router[_0x0cde('0x1a')](_0x0cde('0x10'),auth[_0x0cde('0xa')](),controller[_0x0cde('0x1c')]);router[_0x0cde('0x1a')](_0x0cde('0x12'),auth[_0x0cde('0xa')](),controller['removeResources']);module[_0x0cde('0x1d')]=router; \ No newline at end of file +var _0x3b0b=['/:id/clone','clone','addSections','addResources','put','delete','destroy','removeSections','removeResources','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sections','getSections','/:id/resources','create','post'];(function(_0x255f6b,_0x17841a){var _0x462485=function(_0x570fb2){while(--_0x570fb2){_0x255f6b['push'](_0x255f6b['shift']());}};_0x462485(++_0x17841a);}(_0x3b0b,0xea));var _0xb3b0=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x3b0b[_0x13ea00];return _0x1f7347;};'use strict';var multer=require('multer');var util=require(_0xb3b0('0x0'));var path=require(_0xb3b0('0x1'));var timeout=require(_0xb3b0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb3b0('0x3'));var interaction=require(_0xb3b0('0x4'));var config=require(_0xb3b0('0x5'));var controller=require('./userProfile.controller');router[_0xb3b0('0x6')]('/',auth[_0xb3b0('0x7')](),controller[_0xb3b0('0x8')]);router['get']('/describe',auth[_0xb3b0('0x7')](),controller['describe']);router[_0xb3b0('0x6')](_0xb3b0('0x9'),auth['isAuthenticated'](),controller[_0xb3b0('0xa')]);router[_0xb3b0('0x6')](_0xb3b0('0xb'),auth['isAuthenticated'](),controller[_0xb3b0('0xc')]);router[_0xb3b0('0x6')](_0xb3b0('0xd'),auth[_0xb3b0('0x7')](),controller['getResources']);router['post']('/',auth[_0xb3b0('0x7')](),controller[_0xb3b0('0xe')]);router[_0xb3b0('0xf')](_0xb3b0('0x10'),auth['isAuthenticated'](),controller[_0xb3b0('0x11')]);router[_0xb3b0('0xf')](_0xb3b0('0xb'),auth[_0xb3b0('0x7')](),controller[_0xb3b0('0x12')]);router['post'](_0xb3b0('0xd'),auth[_0xb3b0('0x7')](),controller[_0xb3b0('0x13')]);router[_0xb3b0('0x14')]('/:id',auth[_0xb3b0('0x7')](),controller['update']);router[_0xb3b0('0x15')](_0xb3b0('0x9'),auth['isAuthenticated'](),controller[_0xb3b0('0x16')]);router[_0xb3b0('0x15')](_0xb3b0('0xb'),auth[_0xb3b0('0x7')](),controller[_0xb3b0('0x17')]);router[_0xb3b0('0x15')](_0xb3b0('0xd'),auth[_0xb3b0('0x7')](),controller[_0xb3b0('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6ce0709..82fc878 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 _0x3613=['STRING','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3613,0x1c9));var _0x3361=function(_0x240285,_0x2f2c46){_0x240285=_0x240285-0x0;var _0x44055a=_0x3613[_0x240285];return _0x44055a;};'use strict';var Sequelize=require(_0x3361('0x0'));module[_0x3361('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3361('0x2')},'crudPermissions':{'type':Sequelize[_0x3361('0x3')],'set':function(_0x5274d5){this[_0x3361('0x4')]('crudPermissions',_0x5274d5?_0x5274d5[_0x3361('0x5')](''):[]);},'get':function(){return this[_0x3361('0x6')](_0x3361('0x7'))?this[_0x3361('0x6')](_0x3361('0x7'))[_0x3361('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3361('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3361('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3361('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa8a5=['STRING','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x4a5308,_0x1f7513){var _0x3ae596=function(_0x1fdf50){while(--_0x1fdf50){_0x4a5308['push'](_0x4a5308['shift']());}};_0x3ae596(++_0x1f7513);}(_0xa8a5,0x1be));var _0x5a8a=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa8a5[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x5a8a('0x0'));module[_0x5a8a('0x1')]={'name':{'type':Sequelize[_0x5a8a('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x5a8a('0x2')],'set':function(_0x236c6c){this['setDataValue'](_0x5a8a('0x3'),_0x236c6c?_0x236c6c[_0x5a8a('0x4')](''):[]);},'get':function(){return this[_0x5a8a('0x5')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5a8a('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c96990f..7658576 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 _0x723c=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','autoAssociation','userProfileId','Resources','UserProfileResource','describe','addSections','sequelize','each','push','removeSections','enabled','includes','sectionId','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5fb9da,_0x1ac0d0){var _0x528081=function(_0x24793f){while(--_0x24793f){_0x5fb9da['push'](_0x5fb9da['shift']());}};_0x528081(++_0x1ac0d0);}(_0x723c,0x1ad));var _0xc723=function(_0x447e2f,_0x47a0ed){_0x447e2f=_0x447e2f-0x0;var _0x523ad4=_0x723c[_0x447e2f];return _0x523ad4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc723('0x0'));var zipdir=require(_0xc723('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc723('0x2'));var moment=require('moment');var BPromise=require(_0xc723('0x3'));var Mustache=require(_0xc723('0x4'));var util=require(_0xc723('0x5'));var path=require(_0xc723('0x6'));var sox=require(_0xc723('0x7'));var csv=require(_0xc723('0x8'));var ejs=require(_0xc723('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc723('0xa'));var squel=require(_0xc723('0xb'));var crypto=require('crypto');var jsforce=require(_0xc723('0xc'));var deskjs=require(_0xc723('0xd'));var toCsv=require(_0xc723('0x8'));var querystring=require(_0xc723('0xe'));var Papa=require(_0xc723('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc723('0x10'));var as=require(_0xc723('0x11'));var hardwareService=require(_0xc723('0x12'));var logger=require(_0xc723('0x13'))('api');var utils=require(_0xc723('0x14'));var config=require(_0xc723('0x15'));var licenseUtil=require(_0xc723('0x16'));var db=require(_0xc723('0x17'))['db'];config[_0xc723('0x18')]=_['defaults'](config[_0xc723('0x18')],{'host':_0xc723('0x19'),'port':0x18eb});var socket=require(_0xc723('0x1a'))(new Redis(config[_0xc723('0x18')]));require(_0xc723('0x1b'))['register'](socket);function respondWithStatusCode(_0x2e8be7,_0x5426f8){_0x5426f8=_0x5426f8||0xcc;return function(_0x5e37c1){if(_0x5e37c1){return _0x2e8be7[_0xc723('0x1c')](_0x5426f8);}return _0x2e8be7[_0xc723('0x1d')](_0x5426f8)[_0xc723('0x1e')]();};}function respondWithResult(_0x309574,_0x15f2c3){_0x15f2c3=_0x15f2c3||0xc8;return function(_0x165a8f){if(_0x165a8f){return _0x309574[_0xc723('0x1d')](_0x15f2c3)[_0xc723('0x1f')](_0x165a8f);}};}function respondWithFilteredResult(_0x5345a4,_0x931da1){return function(_0x41b4af){if(_0x41b4af){var _0x1f095e=typeof _0x931da1[_0xc723('0x20')]==='undefined'&&typeof _0x931da1['limit']===_0xc723('0x21');var _0x298470=_0x41b4af[_0xc723('0x22')];var _0xcae217=_0x1f095e?0x0:_0x931da1[_0xc723('0x20')];var _0x5478ec=_0x1f095e?_0x41b4af[_0xc723('0x22')]:_0x931da1[_0xc723('0x20')]+_0x931da1[_0xc723('0x23')];var _0x172cf0;if(_0x5478ec>=_0x298470){_0x5478ec=_0x298470;_0x172cf0=0xc8;}else{_0x172cf0=0xce;}_0x5345a4[_0xc723('0x1d')](_0x172cf0);return _0x5345a4[_0xc723('0x24')](_0xc723('0x25'),_0xcae217+'-'+_0x5478ec+'/'+_0x298470)[_0xc723('0x1f')](_0x41b4af);}return null;};}function patchUpdates(_0x1de575){return function(_0x43265c){try{jsonpatch[_0xc723('0x26')](_0x43265c,_0x1de575,!![]);}catch(_0xf77cc5){return BPromise['reject'](_0xf77cc5);}return _0x43265c[_0xc723('0x27')]();};}function saveUpdates(_0x4cd1ee,_0x2728a5){return function(_0x380fb5){if(_0x380fb5){return _0x380fb5[_0xc723('0x28')](_0x4cd1ee)['then'](function(_0x41fb45){return _0x41fb45;});}return null;};}function removeEntity(_0x1a4811,_0x4ed3ca){return function(_0x5acbda){if(_0x5acbda){return _0x5acbda[_0xc723('0x29')]()[_0xc723('0x2a')](function(){_0x1a4811[_0xc723('0x1d')](0xcc)[_0xc723('0x1e')]();});}};}function handleEntityNotFound(_0x4066cd,_0x40a594){return function(_0x1670cf){if(!_0x1670cf){_0x4066cd[_0xc723('0x1c')](0x194);}return _0x1670cf;};}function handleError(_0x5b9cb6,_0x567895){_0x567895=_0x567895||0x1f4;return function(_0x2ccef6){logger[_0xc723('0x2b')](_0x2ccef6[_0xc723('0x2c')]);if(_0x2ccef6['name']){delete _0x2ccef6[_0xc723('0x2d')];}_0x5b9cb6[_0xc723('0x1d')](_0x567895)[_0xc723('0x2e')](_0x2ccef6);};}exports[_0xc723('0x2f')]=function(_0x4e874b,_0x14186d){var _0x13407b={},_0x81801={},_0x5acc14={'count':0x0,'rows':[]};var _0x35f71e=_[_0xc723('0x30')](db[_0xc723('0x31')]['rawAttributes'],function(_0x25f85d){return{'name':_0x25f85d['fieldName'],'type':_0x25f85d['type']['key']};});_0x81801[_0xc723('0x32')]=_[_0xc723('0x30')](_0x35f71e,'name');_0x81801[_0xc723('0x33')]=_[_0xc723('0x34')](_0x4e874b[_0xc723('0x33')]);_0x81801[_0xc723('0x35')]=_[_0xc723('0x36')](_0x81801[_0xc723('0x32')],_0x81801[_0xc723('0x33')]);_0x13407b[_0xc723('0x37')]=_[_0xc723('0x36')](_0x81801[_0xc723('0x32')],qs[_0xc723('0x38')](_0x4e874b[_0xc723('0x33')]['fields']));_0x13407b[_0xc723('0x37')]=_0x13407b['attributes']['length']?_0x13407b[_0xc723('0x37')]:_0x81801['model'];if(!_0x4e874b['query'][_0xc723('0x39')](_0xc723('0x3a'))){_0x13407b[_0xc723('0x23')]=qs[_0xc723('0x23')](_0x4e874b['query'][_0xc723('0x23')]);_0x13407b[_0xc723('0x20')]=qs[_0xc723('0x20')](_0x4e874b[_0xc723('0x33')][_0xc723('0x20')]);}_0x13407b['order']=qs[_0xc723('0x3b')](_0x4e874b[_0xc723('0x33')][_0xc723('0x3b')]);_0x13407b[_0xc723('0x3c')]=qs[_0xc723('0x35')](_['pick'](_0x4e874b[_0xc723('0x33')],_0x81801['filters']),_0x35f71e);if(_0x4e874b[_0xc723('0x33')][_0xc723('0x3d')]){_0x13407b[_0xc723('0x3c')]=_[_0xc723('0x3e')](_0x13407b[_0xc723('0x3c')],{'$or':_['map'](_0x35f71e,function(_0x41e738){if(_0x41e738[_0xc723('0x3f')]!==_0xc723('0x40')){var _0x11682b={};_0x11682b[_0x41e738[_0xc723('0x2d')]]={'$like':'%'+_0x4e874b[_0xc723('0x33')]['filter']+'%'};return _0x11682b;}})});}_0x13407b=_['merge']({},_0x13407b,_0x4e874b[_0xc723('0x41')]);var _0x17926b={'where':_0x13407b[_0xc723('0x3c')]};return db[_0xc723('0x31')][_0xc723('0x22')](_0x17926b)['then'](function(_0x435b3b){_0x5acc14[_0xc723('0x22')]=_0x435b3b;if(_0x4e874b[_0xc723('0x33')][_0xc723('0x42')]){_0x13407b[_0xc723('0x43')]=[{'all':!![]}];}return db[_0xc723('0x31')][_0xc723('0x44')](_0x13407b);})[_0xc723('0x2a')](function(_0x3fd3ee){_0x5acc14[_0xc723('0x45')]=_0x3fd3ee;return _0x5acc14;})['then'](respondWithFilteredResult(_0x14186d,_0x13407b))['catch'](handleError(_0x14186d,null));};exports['show']=function(_0x379c5a,_0x50f4b7){var _0x926e98={'raw':![],'where':{'id':_0x379c5a[_0xc723('0x46')]['id']}},_0x26ad1e={};_0x26ad1e['model']=_['keys'](db['UserProfile'][_0xc723('0x47')]);_0x26ad1e[_0xc723('0x33')]=_[_0xc723('0x34')](_0x379c5a[_0xc723('0x33')]);_0x26ad1e['filters']=_[_0xc723('0x36')](_0x26ad1e[_0xc723('0x32')],_0x26ad1e[_0xc723('0x33')]);_0x926e98[_0xc723('0x37')]=_[_0xc723('0x36')](_0x26ad1e['model'],qs[_0xc723('0x38')](_0x379c5a[_0xc723('0x33')][_0xc723('0x38')]));_0x926e98[_0xc723('0x37')]=_0x926e98[_0xc723('0x37')][_0xc723('0x48')]?_0x926e98[_0xc723('0x37')]:_0x26ad1e['model'];if(_0x379c5a[_0xc723('0x33')][_0xc723('0x42')]){_0x926e98[_0xc723('0x43')]=[{'all':!![]}];}_0x926e98=_['merge']({},_0x926e98,_0x379c5a[_0xc723('0x41')]);return db[_0xc723('0x31')][_0xc723('0x49')](_0x926e98)[_0xc723('0x2a')](handleEntityNotFound(_0x50f4b7,null))[_0xc723('0x2a')](respondWithResult(_0x50f4b7,null))[_0xc723('0x4a')](handleError(_0x50f4b7,null));};exports[_0xc723('0x4b')]=function(_0x306b59,_0x21b2d3){return db[_0xc723('0x31')][_0xc723('0x4b')](_0x306b59[_0xc723('0x4c')],{})['then'](respondWithResult(_0x21b2d3,0xc9))['catch'](handleError(_0x21b2d3,null));};exports[_0xc723('0x4d')]=function(_0x50738d,_0x164c3d){var _0x2938d3={'where':{'id':_0x50738d[_0xc723('0x46')]['id']}},_0x1e6d72={};_0x1e6d72['model']=_[_0xc723('0x34')](db[_0xc723('0x31')][_0xc723('0x47')]);_0x2938d3[_0xc723('0x37')]=_[_0xc723('0x36')](_0x1e6d72[_0xc723('0x32')],qs[_0xc723('0x38')](_0x50738d['query'][_0xc723('0x38')]));_0x2938d3[_0xc723('0x37')]=_0x2938d3[_0xc723('0x37')][_0xc723('0x48')]?_0x2938d3[_0xc723('0x37')]:_0x1e6d72[_0xc723('0x32')];if(_0x50738d['query'][_0xc723('0x42')]){_0x2938d3[_0xc723('0x43')]=[{'all':!![]}];}_0x2938d3=_[_0xc723('0x3e')]({},_0x2938d3,_0x50738d['options']);return db[_0xc723('0x31')][_0xc723('0x49')](_0x2938d3)[_0xc723('0x2a')](handleEntityNotFound(_0x164c3d,null))[_0xc723('0x2a')](function(_0x3c0dfa){if(_0x3c0dfa){var _0x3a5fc2=_0x3c0dfa[_0xc723('0x4e')]({'plain':!![]});_0x3a5fc2=qs[_0xc723('0x4f')](_0x3a5fc2,['id','createdAt',_0xc723('0x50'),_0xc723('0x51')]);_0x50738d['body']=_[_0xc723('0x4f')](_0x50738d[_0xc723('0x4c')],['id',_0xc723('0x52'),'updatedAt']);return db['sequelize'][_0xc723('0x53')](function(_0x34274c){return db['UserProfile']['create'](_['merge'](_0x3a5fc2,_0x50738d[_0xc723('0x4c')]),{'include':_0x50738d['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x34274c})['then'](function(_0x1c03a9){var _0x33c962=_0x1c03a9[_0xc723('0x4e')]({'plain':!![]});return db[_0xc723('0x54')]['findAll']({'where':{'userProfileId':_0x50738d[_0xc723('0x46')]['id']},'raw':!![]})[_0xc723('0x2a')](function(_0x55d5c7){if(_0x55d5c7){return BPromise['each'](_0x55d5c7,function(_0x1fdd41){return new BPromise(function(_0x2395b3,_0x221d5a){if(_0x1fdd41[_0xc723('0x55')]===null||_0x1fdd41[_0xc723('0x55')]===0x1)_0x2395b3(null);return db['UserProfileResource'][_0xc723('0x44')]({'where':{'sectionId':_0x1fdd41['id']},'raw':!![]})['then'](function(_0x3cfd3b){var _0x184811=_['map'](_0x3cfd3b,function(_0x5ef4dd){return qs[_0xc723('0x4f')](_0x5ef4dd,['id',_0xc723('0x52'),'updatedAt','sectionId']);});_0x2395b3(_0x184811);})[_0xc723('0x4a')](function(_0x49c2e5){_0x221d5a(_0x49c2e5);});})[_0xc723('0x2a')](function(_0x6d750){var _0x40dc70=qs[_0xc723('0x4f')](_0x1fdd41,['id',_0xc723('0x52'),_0xc723('0x50')]);_0x40dc70[_0xc723('0x56')]=_0x33c962['id'];if(_0x6d750)_0x40dc70[_0xc723('0x57')]=_0x6d750;return _0x40dc70;})[_0xc723('0x2a')](function(_0x2e8983){return db[_0xc723('0x54')]['create'](_0x2e8983,{'include':[{'model':db[_0xc723('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x34274c});});})['then'](function(){return _0x33c962;});}});});});}})[_0xc723('0x2a')](respondWithResult(_0x164c3d,0xc9))[_0xc723('0x4a')](handleError(_0x164c3d,null));};exports['update']=function(_0x548e16,_0x38cc10){if(_0x548e16[_0xc723('0x4c')]['id']){delete _0x548e16[_0xc723('0x4c')]['id'];}return db[_0xc723('0x31')]['find']({'where':{'id':_0x548e16[_0xc723('0x46')]['id']}})[_0xc723('0x2a')](handleEntityNotFound(_0x38cc10,null))[_0xc723('0x2a')](saveUpdates(_0x548e16[_0xc723('0x4c')],null))[_0xc723('0x2a')](respondWithResult(_0x38cc10,null))[_0xc723('0x4a')](handleError(_0x38cc10,null));};exports[_0xc723('0x29')]=function(_0x42d6b5,_0x1f7f6f){return db['UserProfile'][_0xc723('0x49')]({'where':{'id':_0x42d6b5[_0xc723('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f7f6f,null))[_0xc723('0x2a')](removeEntity(_0x1f7f6f,null))[_0xc723('0x4a')](handleError(_0x1f7f6f,null));};exports[_0xc723('0x59')]=function(_0x1e1292,_0x182ab1){return db[_0xc723('0x31')]['describe']()[_0xc723('0x2a')](respondWithResult(_0x182ab1,null))['catch'](handleError(_0x182ab1,null));};exports[_0xc723('0x5a')]=function(_0x4126e7,_0x161c6e){var _0x3cbf88=_0x4126e7[_0xc723('0x4c')];return db[_0xc723('0x31')][_0xc723('0x49')]({'where':{'id':_0x4126e7['params']['id']}})[_0xc723('0x2a')](handleEntityNotFound(_0x161c6e,null))[_0xc723('0x2a')](function(_0x268b1f){if(_0x268b1f){return db[_0xc723('0x5b')][_0xc723('0x53')](function(_0x3d4fb5){return db['UserProfileSection'][_0xc723('0x29')]({'where':{'userProfileId':_0x4126e7[_0xc723('0x46')]['id'],'sectionId':_[_0xc723('0x30')](_0x3cbf88,function(_0x39e50b){return _0x39e50b['sectionId'];})},'transaction':_0x3d4fb5})['then'](function(){var _0x13f9b2=_[_0xc723('0x30')](_0x3cbf88,function(_0x4d771e){_0x4d771e['userProfileId']=_0x4126e7['params']['id'];return _0x4d771e;});var _0x1ca816=[];return BPromise[_0xc723('0x5c')](_0x13f9b2,function(_0x1f90a6){return db[_0xc723('0x54')][_0xc723('0x4b')](_0x1f90a6,{'include':[{'model':db[_0xc723('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x3d4fb5})[_0xc723('0x2a')](function(_0x531e06){_0x1ca816[_0xc723('0x5d')](_0x531e06[_0xc723('0x4e')]({'plain':!![]}));});})[_0xc723('0x2a')](function(){return _0x1ca816;});});});}})[_0xc723('0x2a')](function(_0x476c7b){return _0x476c7b;})['then'](respondWithResult(_0x161c6e,null))['catch'](handleError(_0x161c6e,null));};exports[_0xc723('0x5e')]=function(_0x442e78,_0x1abde5){var _0x1690d3;return db[_0xc723('0x31')]['find']({'where':{'id':_0x442e78['params']['id']},'attributes':['id',_0xc723('0x2d')]})[_0xc723('0x2a')](handleEntityNotFound(_0x1abde5,null))[_0xc723('0x2a')](function(_0x3a42ed){if(_0x3a42ed){_0x1690d3=_0x3a42ed;return db[_0xc723('0x54')][_0xc723('0x29')]({'where':{'userProfileId':_0x442e78[_0xc723('0x46')]['id'],'sectionId':_0x442e78[_0xc723('0x33')]['ids']}});}})[_0xc723('0x2a')](function(){return _0x1690d3;})[_0xc723('0x2a')](respondWithStatusCode(_0x1abde5,null))['catch'](handleError(_0x1abde5,null));};exports['getSections']=function(_0x160c84,_0x1518f3){var _0x16bfa0=[];var _0x1120dc=[];return db[_0xc723('0x54')]['findAll']({'where':{'userProfileId':_0x160c84[_0xc723('0x46')]['id']},'raw':!![]})[_0xc723('0x2a')](function(_0x32bd9a){_0x16bfa0=_[_0xc723('0x3d')](_0x32bd9a,function(_0x32a393){return _0x32a393[_0xc723('0x5f')]===0x1||_[_0xc723('0x60')]([0x3eb,0x709],_0x32a393[_0xc723('0x61')]);});if(!_[_0xc723('0x62')](_0x16bfa0)){return _['map'](_0x16bfa0,function(_0x73751){return _0x73751[_0xc723('0x61')];});}else{return;}})[_0xc723('0x2a')](function(_0x344f32){if(_0x344f32)_0x1120dc=_0x344f32;if(_[_0xc723('0x60')](_0x1120dc,0x64)){var _0x44c9de=_[_0xc723('0x49')](_0x16bfa0,{'sectionId':0x64});return hasDefaultDashboard(_0x44c9de)[_0xc723('0x2a')](function(_0x2f315c){return _[_0xc723('0x30')](_0x16bfa0,function(_0xd73d21){if(_0xd73d21[_0xc723('0x61')]===0x64){_0xd73d21[_0xc723('0x63')]=_0x2f315c;}return _0xd73d21;});});}else{return;}})[_0xc723('0x2a')](function(_0x4bab1a){if(_0x4bab1a)_0x16bfa0=_0x4bab1a;if(_[_0xc723('0x60')](_0x1120dc,0x3eb)){var _0x253771=_[_0xc723('0x49')](_0x16bfa0,{'sectionId':0x3eb});return getCustomDashboards(_0x253771)['then'](function(_0x1139cc){return _['map'](_0x16bfa0,function(_0x59c898){if(_0x253771[_0xc723('0x5f')]){if(_0x59c898[_0xc723('0x61')]===0x3eb){_0x59c898[_0xc723('0x63')]=_0x1139cc;}}else{if(_0x59c898['sectionId']===0x64){_0x59c898['subsections']=_0x1139cc;}}return _0x59c898;});});}else{return;}})['then'](function(_0x36ad6e){if(_0x36ad6e)_0x16bfa0=_0x36ad6e;if(_[_0xc723('0x60')](_0x1120dc,0x709)){var _0x2c7a19=_[_0xc723('0x49')](_0x16bfa0,{'sectionId':0x709});return getPlugins(_0x2c7a19)[_0xc723('0x2a')](function(_0x9dc0fa){if(_0x2c7a19[_0xc723('0x5f')]){return _[_0xc723('0x30')](_0x16bfa0,function(_0x49198a){if(_0x49198a['sectionId']===0x709){_0x49198a[_0xc723('0x63')]=_0x9dc0fa;}return _0x49198a;});}else{var _0x1a1c8a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9dc0fa};var _0x1a47f1=_[_0xc723('0x30')](_0x16bfa0);_0x1a47f1['push'](_0x1a1c8a);return _0x1a47f1;}});}else{return;}})[_0xc723('0x2a')](function(_0x2d7287){if(_0x2d7287)_0x16bfa0=_0x2d7287;return _['filter'](_0x16bfa0,[_0xc723('0x5f'),0x1]);})[_0xc723('0x2a')](respondWithResult(_0x1518f3,null))[_0xc723('0x4a')](handleError(_0x1518f3,null));};function hasDefaultDashboard(_0x5d36dc){var _0xcea9e4=[0x65];return new BPromise(function(_0x13fe7e,_0x4f1a65){try{if(_0x5d36dc[_0xc723('0x55')]){_0x13fe7e(_0xcea9e4);}else{return db['UserProfileResource'][_0xc723('0x64')]({'where':{'sectionId':_0x5d36dc['id']},'raw':!![]})['then'](function(_0x5c413a){_0x5c413a?_0x13fe7e(_0xcea9e4):_0x13fe7e();});}}catch(_0x459cc0){_0x4f1a65(_0x459cc0);}});}function getCustomDashboards(_0x4a5e90){var _0x5271eb=[];return new BPromise(function(_0x7dfbf6,_0x54525e){try{if(_0x4a5e90[_0xc723('0x55')]){return db[_0xc723('0x65')][_0xc723('0x44')]({'raw':!![]})[_0xc723('0x2a')](function(_0x4cb086){_0x4cb086[_0xc723('0x66')](function(_0x29eddb){_0x5271eb[_0xc723('0x5d')](_0x29eddb['id']+0x1869f);});_0x7dfbf6(_0x5271eb);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4a5e90['id']},'raw':!![]})['then'](function(_0x4c828e){_0x4c828e[_0xc723('0x66')](function(_0x4a7e65){_0x5271eb[_0xc723('0x5d')](_0x4a7e65['resourceId']+0x1869f);});_0x7dfbf6(_0x5271eb);});}}catch(_0x4da573){_0x54525e(_0x4da573);}});}function getPlugins(_0x460ba3){var _0x57f43b=[];return new BPromise(function(_0x2880e1,_0x5df523){try{if(_0x460ba3[_0xc723('0x55')]){return db[_0xc723('0x67')]['findAll']({'raw':!![]})[_0xc723('0x2a')](function(_0x2edcb8){_0x2edcb8[_0xc723('0x66')](function(_0x5438cc){_0x57f43b[_0xc723('0x5d')](_0x5438cc['id']+0x15b38);});_0x2880e1(_0x57f43b);});}else{return db[_0xc723('0x58')][_0xc723('0x44')]({'where':{'sectionId':_0x460ba3['id']},'raw':!![]})[_0xc723('0x2a')](function(_0x3e914e){_0x3e914e[_0xc723('0x66')](function(_0x1cc5dd){_0x57f43b[_0xc723('0x5d')](_0x1cc5dd[_0xc723('0x68')]+0x15b38);});_0x2880e1(_0x57f43b);});}}catch(_0xe0f626){_0x5df523(_0xe0f626);}});}exports[_0xc723('0x69')]=function(_0xdbe6c,_0x54ce4f){return db['UserProfile']['find']({'where':{'id':_0xdbe6c[_0xc723('0x46')]['id']}})[_0xc723('0x2a')](handleEntityNotFound(_0x54ce4f,null))[_0xc723('0x2a')](function(_0x21b35d){if(_0x21b35d){return db[_0xc723('0x5b')][_0xc723('0x53')](function(_0x1edca7){return db['UserProfileSection'][_0xc723('0x44')]({'where':{'userProfileId':_0xdbe6c[_0xc723('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xc723('0x2a')](function(_0x3552fe){if(_0x3552fe){return db[_0xc723('0x54')][_0xc723('0x29')]({'where':{'userProfileId':_0xdbe6c[_0xc723('0x46')]['id'],'id':_[_0xc723('0x30')](_0x3552fe,function(_0x45e413){return _0x45e413['id'];})},'transaction':_0x1edca7});}})[_0xc723('0x2a')](function(_0x17ed23){var _0x796d6b=_[_0xc723('0x30')](_0xdbe6c['body'],function(_0x570344){_0x570344[_0xc723('0x56')]=_0xdbe6c['params']['id'];return _0x570344;});return db[_0xc723('0x54')]['bulkCreate'](_0x796d6b,{'raw':!![],'transaction':_0x1edca7});})['then'](function(_0x1e44f4){var _0x3a6f35=_['filter'](_[_0xc723('0x30')](_0x1e44f4,function(_0x7d0722){return _0x7d0722[_0xc723('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x3a6f35){return db['UserProfileSection'][_0xc723('0x44')]({'where':{'userProfileId':_0xdbe6c[_0xc723('0x46')]['id'],'sectionId':_[_0xc723('0x30')](_0x3a6f35,function(_0x1a803b){return _0x1a803b[_0xc723('0x61')];})},'attributes':['id',_0xc723('0x61')],'raw':!![]})[_0xc723('0x2a')](function(_0x4b6848){var _0x16b572=_[_0xc723('0x30')](_0xdbe6c[_0xc723('0x4c')],function(_0x5d2f81){_0x5d2f81[_0xc723('0x56')]=_0xdbe6c[_0xc723('0x46')]['id'];return _0x5d2f81;});return db[_0xc723('0x58')][_0xc723('0x6a')](_0x16b572,{'raw':!![],'transaction':_0x1edca7});});}})[_0xc723('0x4a')](handleError(_0x54ce4f,null));});}})[_0xc723('0x2a')](function(_0x3bda59){var _0x3fe7d4=_[_0xc723('0x30')](_0x3bda59,function(_0x389323){return _0x389323[_0xc723('0x4e')]({'plain':!![]});});})[_0xc723('0x2a')](respondWithResult(_0x54ce4f,null))['catch'](handleError(_0x54ce4f,null));};exports[_0xc723('0x6b')]=function(_0x17ba11,_0x34dc9a,_0x12035c){return db[_0xc723('0x31')][_0xc723('0x49')]({'where':{'id':_0x17ba11['params']['id']}})['then'](handleEntityNotFound(_0x34dc9a,null))['then'](function(_0x4be1bc){if(_0x4be1bc){return _0x4be1bc[_0xc723('0x6b')](_0x17ba11[_0xc723('0x33')]['ids']);}})[_0xc723('0x2a')](respondWithStatusCode(_0x34dc9a,null))['catch'](handleError(_0x34dc9a,null));};exports[_0xc723('0x6c')]=function(_0x213900,_0x3a364b){var _0x112d68={};if(!_0x213900[_0xc723('0x33')][_0xc723('0x6d')])throw new Error(_0xc723('0x6e'));if(!_0x213900[_0xc723('0x33')][_0xc723('0x39')](_0xc723('0x3a'))){_0x112d68[_0xc723('0x23')]=qs[_0xc723('0x23')](_0x213900[_0xc723('0x33')]['limit']);_0x112d68[_0xc723('0x20')]=qs['offset'](_0x213900['query'][_0xc723('0x20')]);}return db['UserProfile'][_0xc723('0x49')]({'where':{'id':_0x213900[_0xc723('0x46')]['id']}})['then'](function(_0x8c2050){if(!_0x8c2050)throw new Error(_0xc723('0x6f')+_0x213900[_0xc723('0x46')]['id']);return db[_0xc723('0x31')][_0xc723('0x6c')](_0x213900);})[_0xc723('0x2a')](respondWithFilteredResult(_0x3a364b,_0x112d68))[_0xc723('0x4a')](handleError(_0x3a364b,null));}; \ No newline at end of file +var _0x57ef=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','limit','offset','count','set','apply','save','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','Resources','UserProfileResource','describe','addSections','sectionId','userProfileId','push','ids','getSections','includes','isEmpty','subsections','enabled','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ef,0xdb));var _0xf57e=function(_0x52b318,_0x4be22f){_0x52b318=_0x52b318-0x0;var _0x274755=_0x57ef[_0x52b318];return _0x274755;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf57e('0x0'));var zipdir=require(_0xf57e('0x1'));var jsonpatch=require(_0xf57e('0x2'));var rp=require(_0xf57e('0x3'));var moment=require(_0xf57e('0x4'));var BPromise=require(_0xf57e('0x5'));var Mustache=require(_0xf57e('0x6'));var util=require('util');var path=require(_0xf57e('0x7'));var sox=require(_0xf57e('0x8'));var csv=require(_0xf57e('0x9'));var ejs=require(_0xf57e('0xa'));var fs=require('fs');var fs_extra=require(_0xf57e('0xb'));var _=require(_0xf57e('0xc'));var squel=require(_0xf57e('0xd'));var crypto=require(_0xf57e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf57e('0xf'));var toCsv=require(_0xf57e('0x9'));var querystring=require(_0xf57e('0x10'));var Papa=require(_0xf57e('0x11'));var Redis=require(_0xf57e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf57e('0x13'));var as=require(_0xf57e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57e('0x15'))(_0xf57e('0x16'));var utils=require(_0xf57e('0x17'));var config=require(_0xf57e('0x18'));var licenseUtil=require(_0xf57e('0x19'));var db=require(_0xf57e('0x1a'))['db'];config['redis']=_[_0xf57e('0x1b')](config[_0xf57e('0x1c')],{'host':_0xf57e('0x1d'),'port':0x18eb});var socket=require(_0xf57e('0x1e'))(new Redis(config[_0xf57e('0x1c')]));require(_0xf57e('0x1f'))[_0xf57e('0x20')](socket);function respondWithStatusCode(_0x2f0d23,_0x122be7){_0x122be7=_0x122be7||0xcc;return function(_0x419b4a){if(_0x419b4a){return _0x2f0d23[_0xf57e('0x21')](_0x122be7);}return _0x2f0d23[_0xf57e('0x22')](_0x122be7)[_0xf57e('0x23')]();};}function respondWithResult(_0x302c46,_0x37e548){_0x37e548=_0x37e548||0xc8;return function(_0x20050d){if(_0x20050d){return _0x302c46[_0xf57e('0x22')](_0x37e548)[_0xf57e('0x24')](_0x20050d);}};}function respondWithFilteredResult(_0x236c0f,_0xe45878){return function(_0x186f69){if(_0x186f69){var _0x3858e4=typeof _0xe45878['offset']==='undefined'&&typeof _0xe45878[_0xf57e('0x25')]==='undefined';var _0x3100ce=_0x186f69['count'];var _0x5ada9b=_0x3858e4?0x0:_0xe45878[_0xf57e('0x26')];var _0x17afb0=_0x3858e4?_0x186f69[_0xf57e('0x27')]:_0xe45878['offset']+_0xe45878[_0xf57e('0x25')];var _0x582ca5;if(_0x17afb0>=_0x3100ce){_0x17afb0=_0x3100ce;_0x582ca5=0xc8;}else{_0x582ca5=0xce;}_0x236c0f[_0xf57e('0x22')](_0x582ca5);return _0x236c0f[_0xf57e('0x28')]('Content-Range',_0x5ada9b+'-'+_0x17afb0+'/'+_0x3100ce)['json'](_0x186f69);}return null;};}function patchUpdates(_0x2068bc){return function(_0x622649){try{jsonpatch[_0xf57e('0x29')](_0x622649,_0x2068bc,!![]);}catch(_0x297b2f){return BPromise['reject'](_0x297b2f);}return _0x622649[_0xf57e('0x2a')]();};}function saveUpdates(_0x1cd065,_0x4b0a0c){return function(_0x45843b){if(_0x45843b){return _0x45843b[_0xf57e('0x2b')](_0x1cd065)[_0xf57e('0x2c')](function(_0xa3072d){return _0xa3072d;});}return null;};}function removeEntity(_0x3eab72,_0x3666e8){return function(_0x5c7414){if(_0x5c7414){return _0x5c7414[_0xf57e('0x2d')]()['then'](function(){_0x3eab72[_0xf57e('0x22')](0xcc)[_0xf57e('0x23')]();});}};}function handleEntityNotFound(_0x1b7f19,_0x4df26d){return function(_0x52147d){if(!_0x52147d){_0x1b7f19[_0xf57e('0x21')](0x194);}return _0x52147d;};}function handleError(_0x22aeb6,_0x4f4c73){_0x4f4c73=_0x4f4c73||0x1f4;return function(_0x468048){logger[_0xf57e('0x2e')](_0x468048['stack']);if(_0x468048['name']){delete _0x468048[_0xf57e('0x2f')];}_0x22aeb6['status'](_0x4f4c73)[_0xf57e('0x30')](_0x468048);};}exports[_0xf57e('0x31')]=function(_0x93f436,_0x27ee9f){var _0x502211={},_0x4e5ec2={},_0xc821b7={'count':0x0,'rows':[]};var _0x4bfefb=_[_0xf57e('0x32')](db[_0xf57e('0x33')][_0xf57e('0x34')],function(_0x488fb0){return{'name':_0x488fb0[_0xf57e('0x35')],'type':_0x488fb0[_0xf57e('0x36')]['key']};});_0x4e5ec2['model']=_[_0xf57e('0x32')](_0x4bfefb,'name');_0x4e5ec2[_0xf57e('0x37')]=_[_0xf57e('0x38')](_0x93f436['query']);_0x4e5ec2['filters']=_[_0xf57e('0x39')](_0x4e5ec2[_0xf57e('0x3a')],_0x4e5ec2[_0xf57e('0x37')]);_0x502211[_0xf57e('0x3b')]=_['intersection'](_0x4e5ec2['model'],qs[_0xf57e('0x3c')](_0x93f436[_0xf57e('0x37')][_0xf57e('0x3c')]));_0x502211[_0xf57e('0x3b')]=_0x502211[_0xf57e('0x3b')]['length']?_0x502211[_0xf57e('0x3b')]:_0x4e5ec2['model'];if(!_0x93f436['query'][_0xf57e('0x3d')]('nolimit')){_0x502211[_0xf57e('0x25')]=qs[_0xf57e('0x25')](_0x93f436['query'][_0xf57e('0x25')]);_0x502211[_0xf57e('0x26')]=qs[_0xf57e('0x26')](_0x93f436[_0xf57e('0x37')][_0xf57e('0x26')]);}_0x502211[_0xf57e('0x3e')]=qs[_0xf57e('0x3f')](_0x93f436[_0xf57e('0x37')][_0xf57e('0x3f')]);_0x502211[_0xf57e('0x40')]=qs[_0xf57e('0x41')](_[_0xf57e('0x42')](_0x93f436[_0xf57e('0x37')],_0x4e5ec2[_0xf57e('0x41')]),_0x4bfefb);if(_0x93f436['query'][_0xf57e('0x43')]){_0x502211['where']=_['merge'](_0x502211['where'],{'$or':_[_0xf57e('0x32')](_0x4bfefb,function(_0x16da7f){if(_0x16da7f['type']!=='VIRTUAL'){var _0x526a62={};_0x526a62[_0x16da7f[_0xf57e('0x2f')]]={'$like':'%'+_0x93f436[_0xf57e('0x37')][_0xf57e('0x43')]+'%'};return _0x526a62;}})});}_0x502211=_[_0xf57e('0x44')]({},_0x502211,_0x93f436[_0xf57e('0x45')]);var _0x55ad0d={'where':_0x502211[_0xf57e('0x40')]};return db[_0xf57e('0x33')][_0xf57e('0x27')](_0x55ad0d)['then'](function(_0x2de3c7){_0xc821b7['count']=_0x2de3c7;if(_0x93f436['query']['includeAll']){_0x502211[_0xf57e('0x46')]=[{'all':!![]}];}return db[_0xf57e('0x33')][_0xf57e('0x47')](_0x502211);})['then'](function(_0x48d305){_0xc821b7['rows']=_0x48d305;return _0xc821b7;})[_0xf57e('0x2c')](respondWithFilteredResult(_0x27ee9f,_0x502211))[_0xf57e('0x48')](handleError(_0x27ee9f,null));};exports['show']=function(_0x41aff1,_0x17cf8d){var _0x1c6fb8={'raw':![],'where':{'id':_0x41aff1[_0xf57e('0x49')]['id']}},_0x2afd40={};_0x2afd40['model']=_[_0xf57e('0x38')](db['UserProfile']['rawAttributes']);_0x2afd40[_0xf57e('0x37')]=_[_0xf57e('0x38')](_0x41aff1[_0xf57e('0x37')]);_0x2afd40[_0xf57e('0x41')]=_[_0xf57e('0x39')](_0x2afd40['model'],_0x2afd40['query']);_0x1c6fb8[_0xf57e('0x3b')]=_[_0xf57e('0x39')](_0x2afd40[_0xf57e('0x3a')],qs[_0xf57e('0x3c')](_0x41aff1[_0xf57e('0x37')][_0xf57e('0x3c')]));_0x1c6fb8['attributes']=_0x1c6fb8[_0xf57e('0x3b')][_0xf57e('0x4a')]?_0x1c6fb8[_0xf57e('0x3b')]:_0x2afd40[_0xf57e('0x3a')];if(_0x41aff1[_0xf57e('0x37')][_0xf57e('0x4b')]){_0x1c6fb8[_0xf57e('0x46')]=[{'all':!![]}];}_0x1c6fb8=_[_0xf57e('0x44')]({},_0x1c6fb8,_0x41aff1['options']);return db[_0xf57e('0x33')][_0xf57e('0x4c')](_0x1c6fb8)['then'](handleEntityNotFound(_0x17cf8d,null))[_0xf57e('0x2c')](respondWithResult(_0x17cf8d,null))[_0xf57e('0x48')](handleError(_0x17cf8d,null));};exports[_0xf57e('0x4d')]=function(_0x31b625,_0x12aeac){return db[_0xf57e('0x33')][_0xf57e('0x4d')](_0x31b625[_0xf57e('0x4e')],{})['then'](respondWithResult(_0x12aeac,0xc9))[_0xf57e('0x48')](handleError(_0x12aeac,null));};exports[_0xf57e('0x4f')]=function(_0x1dfdb7,_0x3289f9){var _0x15d39c={'where':{'id':_0x1dfdb7['params']['id']}},_0x1c6ec8={};_0x1c6ec8[_0xf57e('0x3a')]=_[_0xf57e('0x38')](db[_0xf57e('0x33')][_0xf57e('0x34')]);_0x15d39c[_0xf57e('0x3b')]=_[_0xf57e('0x39')](_0x1c6ec8['model'],qs[_0xf57e('0x3c')](_0x1dfdb7[_0xf57e('0x37')][_0xf57e('0x3c')]));_0x15d39c['attributes']=_0x15d39c[_0xf57e('0x3b')]['length']?_0x15d39c['attributes']:_0x1c6ec8[_0xf57e('0x3a')];if(_0x1dfdb7[_0xf57e('0x37')][_0xf57e('0x4b')]){_0x15d39c[_0xf57e('0x46')]=[{'all':!![]}];}_0x15d39c=_[_0xf57e('0x44')]({},_0x15d39c,_0x1dfdb7[_0xf57e('0x45')]);return db[_0xf57e('0x33')][_0xf57e('0x4c')](_0x15d39c)['then'](handleEntityNotFound(_0x3289f9,null))[_0xf57e('0x2c')](function(_0x2a8edb){if(_0x2a8edb){var _0x22e1dc=_0x2a8edb[_0xf57e('0x50')]({'plain':!![]});_0x22e1dc=qs[_0xf57e('0x51')](_0x22e1dc,['id',_0xf57e('0x52'),_0xf57e('0x53'),_0xf57e('0x54')]);_0x1dfdb7[_0xf57e('0x4e')]=_[_0xf57e('0x51')](_0x1dfdb7[_0xf57e('0x4e')],['id',_0xf57e('0x52'),_0xf57e('0x53')]);return db[_0xf57e('0x55')][_0xf57e('0x56')](function(_0xe9b349){return db['UserProfile']['create'](_[_0xf57e('0x44')](_0x22e1dc,_0x1dfdb7[_0xf57e('0x4e')]),{'include':_0x1dfdb7[_0xf57e('0x37')][_0xf57e('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0xe9b349})['then'](function(_0x9bd532){var _0x57b75a=_0x9bd532['get']({'plain':!![]});return db[_0xf57e('0x57')][_0xf57e('0x47')]({'where':{'userProfileId':_0x1dfdb7['params']['id']},'raw':!![]})[_0xf57e('0x2c')](function(_0x1fbd6b){if(_0x1fbd6b){return BPromise[_0xf57e('0x58')](_0x1fbd6b,function(_0x3d2cde){return new BPromise(function(_0x9937b1,_0x8dd24f){if(_0x3d2cde[_0xf57e('0x59')]===null||_0x3d2cde[_0xf57e('0x59')]===0x1)_0x9937b1(null);return db['UserProfileResource'][_0xf57e('0x47')]({'where':{'sectionId':_0x3d2cde['id']},'raw':!![]})[_0xf57e('0x2c')](function(_0x539b41){var _0x4fc61c=_[_0xf57e('0x32')](_0x539b41,function(_0x14d410){return qs['omit'](_0x14d410,['id',_0xf57e('0x52'),_0xf57e('0x53'),'sectionId']);});_0x9937b1(_0x4fc61c);})[_0xf57e('0x48')](function(_0x26bd0f){_0x8dd24f(_0x26bd0f);});})[_0xf57e('0x2c')](function(_0x261b6c){var _0x13a349=qs['omit'](_0x3d2cde,['id','createdAt',_0xf57e('0x53')]);_0x13a349['userProfileId']=_0x57b75a['id'];if(_0x261b6c)_0x13a349[_0xf57e('0x5a')]=_0x261b6c;return _0x13a349;})[_0xf57e('0x2c')](function(_0x36b738){return db[_0xf57e('0x57')]['create'](_0x36b738,{'include':[{'model':db[_0xf57e('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0xe9b349});});})[_0xf57e('0x2c')](function(){return _0x57b75a;});}});});});}})[_0xf57e('0x2c')](respondWithResult(_0x3289f9,0xc9))['catch'](handleError(_0x3289f9,null));};exports[_0xf57e('0x2b')]=function(_0x5e7886,_0x6e0d02){if(_0x5e7886['body']['id']){delete _0x5e7886[_0xf57e('0x4e')]['id'];}return db[_0xf57e('0x33')][_0xf57e('0x4c')]({'where':{'id':_0x5e7886[_0xf57e('0x49')]['id']}})[_0xf57e('0x2c')](handleEntityNotFound(_0x6e0d02,null))[_0xf57e('0x2c')](saveUpdates(_0x5e7886[_0xf57e('0x4e')],null))[_0xf57e('0x2c')](respondWithResult(_0x6e0d02,null))[_0xf57e('0x48')](handleError(_0x6e0d02,null));};exports['destroy']=function(_0x30f689,_0x40a998){return db[_0xf57e('0x33')][_0xf57e('0x4c')]({'where':{'id':_0x30f689['params']['id']}})[_0xf57e('0x2c')](handleEntityNotFound(_0x40a998,null))['then'](removeEntity(_0x40a998,null))[_0xf57e('0x48')](handleError(_0x40a998,null));};exports[_0xf57e('0x5c')]=function(_0x5afed5,_0x662965){return db[_0xf57e('0x33')][_0xf57e('0x5c')]()[_0xf57e('0x2c')](respondWithResult(_0x662965,null))[_0xf57e('0x48')](handleError(_0x662965,null));};exports[_0xf57e('0x5d')]=function(_0x40647f,_0x5258d1){var _0x25745f=_0x40647f[_0xf57e('0x4e')];return db[_0xf57e('0x33')][_0xf57e('0x4c')]({'where':{'id':_0x40647f[_0xf57e('0x49')]['id']}})[_0xf57e('0x2c')](handleEntityNotFound(_0x5258d1,null))['then'](function(_0x41769f){if(_0x41769f){return db[_0xf57e('0x55')][_0xf57e('0x56')](function(_0x373344){return db[_0xf57e('0x57')][_0xf57e('0x2d')]({'where':{'userProfileId':_0x40647f[_0xf57e('0x49')]['id'],'sectionId':_[_0xf57e('0x32')](_0x25745f,function(_0x19c4be){return _0x19c4be[_0xf57e('0x5e')];})},'transaction':_0x373344})['then'](function(){var _0x4f7947=_[_0xf57e('0x32')](_0x25745f,function(_0x1c9190){_0x1c9190[_0xf57e('0x5f')]=_0x40647f[_0xf57e('0x49')]['id'];return _0x1c9190;});var _0x1664df=[];return BPromise[_0xf57e('0x58')](_0x4f7947,function(_0x255424){return db[_0xf57e('0x57')][_0xf57e('0x4d')](_0x255424,{'include':[{'model':db[_0xf57e('0x5b')],'as':_0xf57e('0x5a')}],'raw':!![],'transaction':_0x373344})[_0xf57e('0x2c')](function(_0x1278b6){_0x1664df[_0xf57e('0x60')](_0x1278b6['get']({'plain':!![]}));});})[_0xf57e('0x2c')](function(){return _0x1664df;});});});}})[_0xf57e('0x2c')](function(_0x52d728){return _0x52d728;})[_0xf57e('0x2c')](respondWithResult(_0x5258d1,null))[_0xf57e('0x48')](handleError(_0x5258d1,null));};exports['removeSections']=function(_0x2c4d22,_0x3fc0d1){var _0xcc5828;return db['UserProfile'][_0xf57e('0x4c')]({'where':{'id':_0x2c4d22[_0xf57e('0x49')]['id']},'attributes':['id',_0xf57e('0x2f')]})[_0xf57e('0x2c')](handleEntityNotFound(_0x3fc0d1,null))[_0xf57e('0x2c')](function(_0x26a61f){if(_0x26a61f){_0xcc5828=_0x26a61f;return db[_0xf57e('0x57')][_0xf57e('0x2d')]({'where':{'userProfileId':_0x2c4d22[_0xf57e('0x49')]['id'],'sectionId':_0x2c4d22[_0xf57e('0x37')][_0xf57e('0x61')]}});}})[_0xf57e('0x2c')](function(){return _0xcc5828;})[_0xf57e('0x2c')](respondWithStatusCode(_0x3fc0d1,null))['catch'](handleError(_0x3fc0d1,null));};exports[_0xf57e('0x62')]=function(_0x4fdbfa,_0x3a92f3){var _0x550b7d=[];var _0x21b8e7=[];return db['UserProfileSection'][_0xf57e('0x47')]({'where':{'userProfileId':_0x4fdbfa['params']['id']},'raw':!![]})['then'](function(_0x3c00ad){_0x550b7d=_[_0xf57e('0x43')](_0x3c00ad,function(_0xecd292){return _0xecd292['enabled']===0x1||_[_0xf57e('0x63')]([0x3eb,0x709],_0xecd292[_0xf57e('0x5e')]);});if(!_[_0xf57e('0x64')](_0x550b7d)){return _[_0xf57e('0x32')](_0x550b7d,function(_0x44aeee){return _0x44aeee['sectionId'];});}else{return;}})[_0xf57e('0x2c')](function(_0x16efcf){if(_0x16efcf)_0x21b8e7=_0x16efcf;if(_[_0xf57e('0x63')](_0x21b8e7,0x64)){var _0x5ac57f=_[_0xf57e('0x4c')](_0x550b7d,{'sectionId':0x64});return hasDefaultDashboard(_0x5ac57f)[_0xf57e('0x2c')](function(_0x51cbb2){return _[_0xf57e('0x32')](_0x550b7d,function(_0x2977d1){if(_0x2977d1['sectionId']===0x64){_0x2977d1[_0xf57e('0x65')]=_0x51cbb2;}return _0x2977d1;});});}else{return;}})['then'](function(_0x135c04){if(_0x135c04)_0x550b7d=_0x135c04;if(_[_0xf57e('0x63')](_0x21b8e7,0x3eb)){var _0xaaf2fd=_['find'](_0x550b7d,{'sectionId':0x3eb});return getCustomDashboards(_0xaaf2fd)[_0xf57e('0x2c')](function(_0x5ab676){return _[_0xf57e('0x32')](_0x550b7d,function(_0x475f3c){if(_0xaaf2fd[_0xf57e('0x66')]){if(_0x475f3c[_0xf57e('0x5e')]===0x3eb){_0x475f3c[_0xf57e('0x65')]=_0x5ab676;}}else{if(_0x475f3c[_0xf57e('0x5e')]===0x64){_0x475f3c[_0xf57e('0x65')]=_0x5ab676;}}return _0x475f3c;});});}else{return;}})[_0xf57e('0x2c')](function(_0x31f0e7){if(_0x31f0e7)_0x550b7d=_0x31f0e7;if(_['includes'](_0x21b8e7,0x709)){var _0x2b48ba=_[_0xf57e('0x4c')](_0x550b7d,{'sectionId':0x709});return getPlugins(_0x2b48ba)[_0xf57e('0x2c')](function(_0x3fa0a1){if(_0x2b48ba[_0xf57e('0x66')]){return _[_0xf57e('0x32')](_0x550b7d,function(_0x2c4cf9){if(_0x2c4cf9[_0xf57e('0x5e')]===0x709){_0x2c4cf9[_0xf57e('0x65')]=_0x3fa0a1;}return _0x2c4cf9;});}else{var _0x235194={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3fa0a1};var _0x2f3598=_[_0xf57e('0x32')](_0x550b7d);_0x2f3598[_0xf57e('0x60')](_0x235194);return _0x2f3598;}});}else{return;}})[_0xf57e('0x2c')](function(_0x156d47){if(_0x156d47)_0x550b7d=_0x156d47;return _['filter'](_0x550b7d,[_0xf57e('0x66'),0x1]);})[_0xf57e('0x2c')](respondWithResult(_0x3a92f3,null))[_0xf57e('0x48')](handleError(_0x3a92f3,null));};function hasDefaultDashboard(_0x14e17f){var _0x3db8b9=[0x65];return new BPromise(function(_0x2f8269,_0x28fb7e){try{if(_0x14e17f[_0xf57e('0x59')]){_0x2f8269(_0x3db8b9);}else{return db['UserProfileResource'][_0xf57e('0x67')]({'where':{'sectionId':_0x14e17f['id']},'raw':!![]})['then'](function(_0x1463ae){_0x1463ae?_0x2f8269(_0x3db8b9):_0x2f8269();});}}catch(_0xb29009){_0x28fb7e(_0xb29009);}});}function getCustomDashboards(_0x1e84f4){var _0x59ec8e=[];return new BPromise(function(_0x55cc7e,_0x275f72){try{if(_0x1e84f4['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0xf57e('0x2c')](function(_0x161c0e){_0x161c0e[_0xf57e('0x68')](function(_0x3107e4){_0x59ec8e[_0xf57e('0x60')](_0x3107e4['id']+0x1869f);});_0x55cc7e(_0x59ec8e);});}else{return db['UserProfileResource'][_0xf57e('0x47')]({'where':{'sectionId':_0x1e84f4['id']},'raw':!![]})[_0xf57e('0x2c')](function(_0x1fbf94){_0x1fbf94['forEach'](function(_0x47bdc7){_0x59ec8e['push'](_0x47bdc7[_0xf57e('0x69')]+0x1869f);});_0x55cc7e(_0x59ec8e);});}}catch(_0x12f92b){_0x275f72(_0x12f92b);}});}function getPlugins(_0x17b0ff){var _0x32044d=[];return new BPromise(function(_0x336916,_0x202a43){try{if(_0x17b0ff[_0xf57e('0x59')]){return db[_0xf57e('0x6a')][_0xf57e('0x47')]({'raw':!![]})[_0xf57e('0x2c')](function(_0x36b8e0){_0x36b8e0[_0xf57e('0x68')](function(_0x548c73){_0x32044d[_0xf57e('0x60')](_0x548c73['id']+0x15b38);});_0x336916(_0x32044d);});}else{return db[_0xf57e('0x5b')][_0xf57e('0x47')]({'where':{'sectionId':_0x17b0ff['id']},'raw':!![]})[_0xf57e('0x2c')](function(_0x42b48e){_0x42b48e[_0xf57e('0x68')](function(_0x64ef8a){_0x32044d[_0xf57e('0x60')](_0x64ef8a[_0xf57e('0x69')]+0x15b38);});_0x336916(_0x32044d);});}}catch(_0x114681){_0x202a43(_0x114681);}});}exports['addResources']=function(_0x4a909d,_0x357b9e){return db[_0xf57e('0x33')][_0xf57e('0x4c')]({'where':{'id':_0x4a909d[_0xf57e('0x49')]['id']}})[_0xf57e('0x2c')](handleEntityNotFound(_0x357b9e,null))['then'](function(_0x3c3652){if(_0x3c3652){return db['sequelize'][_0xf57e('0x56')](function(_0xfb335){return db[_0xf57e('0x57')][_0xf57e('0x47')]({'where':{'userProfileId':_0x4a909d[_0xf57e('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xf57e('0x2c')](function(_0x136876){if(_0x136876){return db[_0xf57e('0x57')][_0xf57e('0x2d')]({'where':{'userProfileId':_0x4a909d[_0xf57e('0x49')]['id'],'id':_[_0xf57e('0x32')](_0x136876,function(_0x2bdfa2){return _0x2bdfa2['id'];})},'transaction':_0xfb335});}})['then'](function(_0x32e5bc){var _0x95e89e=_[_0xf57e('0x32')](_0x4a909d[_0xf57e('0x4e')],function(_0x4896fa){_0x4896fa[_0xf57e('0x5f')]=_0x4a909d[_0xf57e('0x49')]['id'];return _0x4896fa;});return db['UserProfileSection']['bulkCreate'](_0x95e89e,{'raw':!![],'transaction':_0xfb335});})[_0xf57e('0x2c')](function(_0x440ec7){var _0x1c1762=_['filter'](_['map'](_0x440ec7,function(_0x28da91){return _0x28da91[_0xf57e('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1c1762){return db[_0xf57e('0x57')]['findAll']({'where':{'userProfileId':_0x4a909d[_0xf57e('0x49')]['id'],'sectionId':_[_0xf57e('0x32')](_0x1c1762,function(_0x6949c1){return _0x6949c1[_0xf57e('0x5e')];})},'attributes':['id',_0xf57e('0x5e')],'raw':!![]})[_0xf57e('0x2c')](function(_0x2fe011){var _0x1907b0=_[_0xf57e('0x32')](_0x4a909d['body'],function(_0x32c943){_0x32c943['userProfileId']=_0x4a909d[_0xf57e('0x49')]['id'];return _0x32c943;});return db[_0xf57e('0x5b')][_0xf57e('0x6b')](_0x1907b0,{'raw':!![],'transaction':_0xfb335});});}})[_0xf57e('0x48')](handleError(_0x357b9e,null));});}})[_0xf57e('0x2c')](function(_0x31220e){var _0x2aae9d=_[_0xf57e('0x32')](_0x31220e,function(_0x1b7e3c){return _0x1b7e3c[_0xf57e('0x50')]({'plain':!![]});});})[_0xf57e('0x2c')](respondWithResult(_0x357b9e,null))[_0xf57e('0x48')](handleError(_0x357b9e,null));};exports[_0xf57e('0x6c')]=function(_0x2a8c7c,_0x2a32af,_0x45859c){return db[_0xf57e('0x33')]['find']({'where':{'id':_0x2a8c7c[_0xf57e('0x49')]['id']}})[_0xf57e('0x2c')](handleEntityNotFound(_0x2a32af,null))['then'](function(_0x28e958){if(_0x28e958){return _0x28e958[_0xf57e('0x6c')](_0x2a8c7c['query']['ids']);}})[_0xf57e('0x2c')](respondWithStatusCode(_0x2a32af,null))[_0xf57e('0x48')](handleError(_0x2a32af,null));};exports[_0xf57e('0x6d')]=function(_0x27b460,_0x3d123d){var _0x448b5b={};if(!_0x27b460['query'][_0xf57e('0x6e')])throw new Error(_0xf57e('0x6f'));if(!_0x27b460[_0xf57e('0x37')]['hasOwnProperty'](_0xf57e('0x70'))){_0x448b5b[_0xf57e('0x25')]=qs[_0xf57e('0x25')](_0x27b460[_0xf57e('0x37')][_0xf57e('0x25')]);_0x448b5b[_0xf57e('0x26')]=qs[_0xf57e('0x26')](_0x27b460[_0xf57e('0x37')][_0xf57e('0x26')]);}return db[_0xf57e('0x33')]['find']({'where':{'id':_0x27b460['params']['id']}})[_0xf57e('0x2c')](function(_0x212dd3){if(!_0x212dd3)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x27b460['params']['id']);return db[_0xf57e('0x33')][_0xf57e('0x6d')](_0x27b460);})[_0xf57e('0x2c')](respondWithFilteredResult(_0x3d123d,_0x448b5b))[_0xf57e('0x48')](handleError(_0x3d123d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 97433ad..2ca6918 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 _0x9e6d=['save','remove','emit','exports','events','UserProfile','setMaxListeners'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x2f5a87,_0x450cb7){_0x2f5a87=_0x2f5a87-0x0;var _0x46b6c0=_0x9e6d[_0x2f5a87];return _0x46b6c0;};'use strict';var EventEmitter=require(_0xd9e6('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd9e6('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd9e6('0x2')](0x0);var events={'afterCreate':_0xd9e6('0x3'),'afterUpdate':'update','afterDestroy':_0xd9e6('0x4')};function emitEvent(_0x1d5756){return function(_0x2f1c0,_0x3b2951,_0x5e363d){UserProfileEvents[_0xd9e6('0x5')](_0x1d5756+':'+_0x2f1c0['id'],_0x2f1c0);UserProfileEvents[_0xd9e6('0x5')](_0x1d5756,_0x2f1c0);_0x5e363d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd9e6('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x7096=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x3cca8f,_0x3e3a0e){var _0x3ca038=function(_0x833601){while(--_0x833601){_0x3cca8f['push'](_0x3cca8f['shift']());}};_0x3ca038(++_0x3e3a0e);}(_0x7096,0x10c));var _0x6709=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7096[_0x5608a3];return _0x1ed50a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6709('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6709('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6709('0x2'),'afterDestroy':_0x6709('0x3')};function emitEvent(_0x3e85e4){return function(_0xccdcb5,_0x3cd087,_0x3c8599){UserProfileEvents[_0x6709('0x4')](_0x3e85e4+':'+_0xccdcb5['id'],_0xccdcb5);UserProfileEvents[_0x6709('0x4')](_0x3e85e4,_0xccdcb5);_0x3c8599(null);};}for(var e in events){if(events[_0x6709('0x5')](e)){var event=events[e];UserProfile[_0x6709('0x6')](e,emitEvent(event));}}module[_0x6709('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e563d59..bb63cc6 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 _0x3423=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','includeAll','DefaultReports','custom','rows','ids','count','Tags','color','tag','include','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','model','associatedResources','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','childModel','parentSections','projects','JscriptyProject','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','QueueCampaigns','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','triggers','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','charAt','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','sequelize','query','toString','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes'];(function(_0x580bfc,_0x53933c){var _0x45f9ad=function(_0x28c93b){while(--_0x28c93b){_0x580bfc['push'](_0x580bfc['shift']());}};_0x45f9ad(++_0x53933c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x3342('0x0'));var squel=require(_0x3342('0x1'));module[_0x3342('0x2')]=function(_0x3b763d){var _0x21bdc2=_0x3b763d[_0x3342('0x3')];function _0x2207ce(_0x3c5d8d,_0x3075f8){return new Promise(function(_0x19206f,_0x467453){if(!_0x3075f8)return _0x19206f(null);var _0x2ccbe0=_0x3075f8[_0x3342('0x4')]?{[_0x3075f8[_0x3342('0x4')][_0x3342('0x5')]]:_0x3075f8[_0x3342('0x4')][_0x3342('0x6')]}:undefined;return _0x21bdc2[_0x3c5d8d][_0x3342('0x7')]({'where':_0x2ccbe0,'raw':!![]})[_0x3342('0x8')](function(_0x4ae4f3){_0x3075f8['associatedResources']=_[_0x3342('0x9')](_0x4ae4f3,'id');_0x19206f(_0x3075f8);})['catch'](function(_0x5a1fba){_0x467453(_0x5a1fba);});});}function _0x51b276(_0x4f85e3,_0xb11eb9){return new Promise(function(_0x2f3c47,_0x51496d){var _0x2d14c4=_0x4f85e3['filter']?{[_0x4f85e3[_0x3342('0x4')][_0x3342('0x5')]]:_0x4f85e3['filter'][_0x3342('0x6')]}:undefined;return _0x21bdc2[_0x4f85e3[_0x3342('0xa')]][_0x3342('0x7')]({'where':_0x2d14c4,'raw':!![]})[_0x3342('0x8')](function(_0x61fcc0){_0xb11eb9[_0x3342('0xb')]=_[_0x3342('0x9')](_0x61fcc0,function(_0x59be1d){return _0x59be1d[_0x3342('0xc')];});_0x2f3c47(_0xb11eb9);})[_0x3342('0xd')](function(_0x49afe3){_0x51496d(_0x49afe3);});});}function _0x40d609(_0x2c9df0,_0x51ef91,_0x554f9c){if(!_0x51ef91)return Promise[_0x3342('0xe')](null);return new Promise(function(_0x143cf1,_0x6949fc){return _0x21bdc2[_0x3342('0xf')][_0x3342('0x7')]({'where':{'sectionId':_0x51ef91['id']},'raw':!![]})[_0x3342('0x8')](function(_0x45a3ca){if(_0x2c9df0[_0x3342('0x5')]&&_0x2c9df0[_0x3342('0x5')]!=='id'){_0x51ef91['associatedResources']=_[_0x3342('0x9')](_0x45a3ca,function(_0xda235a){return _0xda235a[_0x2c9df0[_0x3342('0x5')]];});}else{if(_0x554f9c==='AnalyticExtractedReport'){_0x51ef91[_0x3342('0xb')]=_[_0x3342('0x9')](_0x45a3ca,function(_0x52f7b7){return{'id':_0x52f7b7[_0x3342('0x10')],'type':_0x52f7b7[_0x3342('0x11')]};});}else{_0x51ef91['associatedResources']=_[_0x3342('0x9')](_0x45a3ca,function(_0x5a0658){return _0x5a0658[_0x3342('0x10')];});}}_0x143cf1(_0x51ef91);})[_0x3342('0xd')](function(_0xa23053){_0x6949fc(_0xa23053);});});}function _0x2dbad1(_0xd2b87d,_0x2925a2){var _0x26eb87={'parentSections':[]};switch(_0xd2b87d[_0x3342('0x12')]()){case'squareprojects':_0x26eb87[_0x3342('0x13')]='SquareProject';break;case'odbc':_0x26eb87[_0x3342('0x13')]='SquareOdbc';break;case'squarerecordings':_0x26eb87[_0x3342('0x13')]='SquareRecording';_0x26eb87[_0x3342('0x14')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0x3342('0x15'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x16');break;case'contacts':_0x26eb87[_0x3342('0x13')]=_0x3342('0x17');_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x18'),'field':'id','foreignKey':'ListId'}];break;case _0x3342('0x19'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x1a');break;case _0x3342('0x1b'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x1c');break;case _0x3342('0x1d'):_0x26eb87['childModel']=_0x3342('0x1e');break;case'chatqueues':_0x26eb87[_0x3342('0x13')]=_0x3342('0x1f');break;case'chatwebsites':_0x26eb87[_0x3342('0x13')]=_0x3342('0x20');break;case _0x3342('0x21'):_0x26eb87[_0x3342('0x13')]='FaxQueue';break;case _0x3342('0x22'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x23');break;case _0x3342('0x24'):case _0x3342('0x25'):case _0x3342('0x26'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x27');break;case _0x3342('0x28'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x29');break;case _0x3342('0x2a'):_0x26eb87['childModel']='VoiceMail';break;case _0x3342('0x2b'):_0x26eb87['childModel']=_0x3342('0x2c');_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x2d'),'field':_0x3342('0xc'),'foreignKey':_0x3342('0x2e'),'model':_0x3342('0x2f'),'filter':{'field':_0x3342('0x30'),'value':['agent']}},{'name':_0x3342('0x31'),'field':_0x3342('0xc'),'foreignKey':_0x3342('0x2e'),'model':_0x3342('0x2f'),'filter':{'field':_0x3342('0x30'),'value':['telephone']}},{'name':_0x3342('0x32'),'field':'name','foreignKey':_0x3342('0x33'),'model':_0x3342('0x34'),'filter':{'field':_0x3342('0x11'),'value':[_0x3342('0x35')]}},{'name':'QueueCampaigns','field':_0x3342('0xc'),'foreignKey':'queue','model':_0x3342('0x34'),'filter':{'field':_0x3342('0x11'),'value':[_0x3342('0x36')]}}];break;case _0x3342('0x37'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x38');break;case _0x3342('0x39'):_0x26eb87['childModel']=_0x3342('0x3a');break;case _0x3342('0x3b'):_0x26eb87['childModel']=_0x3342('0x3c');break;case _0x3342('0x3d'):_0x26eb87['childModel']=_0x3342('0x3e');break;case _0x3342('0x3f'):_0x26eb87['childModel']='MailQueue';break;case'mailaccounts':_0x26eb87[_0x3342('0x13')]=_0x3342('0x40');break;case'mailsubstatuses':_0x26eb87[_0x3342('0x13')]=_0x3342('0x41');break;case _0x3342('0x42'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x43');break;case _0x3342('0x44'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x45');break;case'smsqueues':_0x26eb87['childModel']=_0x3342('0x46');break;case _0x3342('0x47'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x48');break;case _0x3342('0x49'):_0x26eb87[_0x3342('0x13')]='WhatsappQueue';break;case _0x3342('0x4a'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x4b');break;case _0x3342('0x4c'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x4d');break;case'voicequeues':case _0x3342('0x4e'):_0x26eb87['childModel']=_0x3342('0x34');if(_0x2925a2){_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x32')},{'name':_0x3342('0x4f')}];}break;case'users':case _0x3342('0x50'):case _0x3342('0x51'):_0x26eb87['childModel']=_0x3342('0x2f');if(_0x2925a2){_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x52'),'filter':{'field':_0x3342('0x30'),'value':['admin',_0x3342('0x53')]},'ignore':!![]},{'name':_0x3342('0x2d')},{'name':'Telephones'}];}break;case _0x3342('0x54'):_0x26eb87['childModel']='ZendeskAccount';break;case _0x3342('0x55'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x56');break;case _0x3342('0x57'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x58');break;case _0x3342('0x59'):_0x26eb87['childModel']='SugarcrmAccount';break;case _0x3342('0x5a'):_0x26eb87['childModel']=_0x3342('0x5b');break;case'zohoaccounts':_0x26eb87['childModel']='ZohoAccount';break;case _0x3342('0x5c'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x2f');break;case _0x3342('0x5d'):_0x26eb87['childModel']=_0x3342('0x5e');break;case _0x3342('0x5f'):_0x26eb87['childModel']=_0x3342('0x60');break;case _0x3342('0x61'):_0x26eb87[_0x3342('0x13')]='Dashboard';break;case _0x3342('0x62'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x63');break;case _0x3342('0x64'):_0x26eb87[_0x3342('0x13')]='Pause';break;case _0x3342('0x65'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x66');break;case _0x3342('0x67'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x68');break;case _0x3342('0x69'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x6a');break;case'templates':_0x26eb87[_0x3342('0x13')]='Template';break;case _0x3342('0x6b'):_0x26eb87['childModel']='Trigger';break;case'trunks':_0x26eb87['childModel']=_0x3342('0x6c');break;case _0x3342('0x6d'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x6e');break;case _0x3342('0x6f'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x70');break;case _0x3342('0x71'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x72');_0x26eb87[_0x3342('0x14')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x3342('0x73'):_0x26eb87['childModel']=_0x3342('0x74');break;}return _0x26eb87;}function _0x59964b(_0x4c777e,_0x44faea){var _0x43d39f=_0x4c777e[_0x3342('0x75')](0x0)['toUpperCase']()+_0x4c777e['slice'](0x1);var _0x54b41d={'type':_0x21bdc2[_0x3342('0x76')]['QueryTypes'][_0x3342('0x77')],'raw':!![]};return new Promise(function(_0x219a17,_0x372af5){var _0x4d3660=squel[_0x3342('0x78')]()[_0x3342('0x5')](_0x3342('0x79')+_0x43d39f+_0x3342('0x7a'),'id')[_0x3342('0x5')](_0x3342('0x7b'))[_0x3342('0x7c')]('user_has_'+_0x4c777e+'_interactions','ui')[_0x3342('0x7d')]('ui.UserId\x20=\x20?',_0x44faea['id']);return _0x21bdc2[_0x3342('0x7e')][_0x3342('0x7f')](_0x4d3660[_0x3342('0x80')](),_0x54b41d)[_0x3342('0x8')](function(_0xe9b979){_0x44faea[_0x43d39f+'OpenTabs']=_0xe9b979;_0x219a17(_0xe9b979);})[_0x3342('0xd')](function(_0x3f2fcb){_0x372af5(_0x3f2fcb);});});}return _0x3b763d['define'](_0x3342('0x81'),attributes,{'tableName':_0x3342('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x10842c){var _0x2858a6={'raw':_0x10842c[_0x3342('0x7f')][_0x3342('0x83')],'where':{}};var _0x19fcc5={};var _0x2f6a48={'count':0x0,'rows':[]};var _0x16c3f3=_0x10842c[_0x3342('0x7f')][_0x3342('0x84')];var _0x28bbfa=_0x10842c[_0x3342('0x7f')]['mergeResources']||![];var _0x5c9399=_0x2dbad1(_0x16c3f3,_0x28bbfa);if(!_0x5c9399[_0x3342('0x13')])throw new Error(_0x3342('0x85')+_0x16c3f3+'\x27');var _0x14193b=[{'name':_0x16c3f3}];if(!_[_0x3342('0x86')](_0x5c9399['parentSections']))_0x14193b=_0x5c9399['parentSections'];var _0x3310ac=[];for(var _0x18751b=0x0;_0x18751b<_0x14193b[_0x3342('0x87')];_0x18751b++){_0x3310ac[_0x3342('0x88')](_0x21bdc2[_0x3342('0x89')][_0x3342('0x8a')]({'where':{'userProfileId':_0x10842c[_0x3342('0x8b')]['id'],'name':_0x14193b[_0x18751b][_0x3342('0xc')]},'raw':!![]}));}return Promise[_0x3342('0x8c')](_0x3310ac)[_0x3342('0x8')](function(_0x4887d4){var _0x3392a2=_['filter'](_0x4887d4,function(_0x1c5d7d){return _0x1c5d7d?_0x1c5d7d:undefined;});var _0xba7c0e=_['filter'](_0x14193b,[_0x3342('0x8d'),!![]]);var _0x3506d4=_['isEmpty'](_0x3392a2)&&_[_0x3342('0x86')](_0xba7c0e)?null:_[_0x3342('0x8e')](_0xba7c0e,_0x3392a2);if(!_0x3506d4)return null;var _0x1e3353=[];for(var _0x466e06=0x0;_0x466e06<_0x3506d4[_0x3342('0x87')];_0x466e06++){var _0x42bc3b=_[_0x3342('0x8a')](_0x14193b,function(_0x57b8ac){return _0x3506d4[_0x466e06]?_0x57b8ac[_0x3342('0xc')]===_0x3506d4[_0x466e06]['name']:null;});if(_0x42bc3b){if(_0x3506d4[_0x466e06]['ignore']){_0x1e3353[_0x3342('0x88')](_0x2207ce(_0x5c9399[_0x3342('0x13')],_0x3506d4[_0x466e06]));}else{if(!_0x3506d4[_0x466e06][_0x3342('0x8f')]){_0x1e3353[_0x3342('0x88')](_0x40d609(_0x42bc3b,_0x3506d4[_0x466e06],_0x5c9399[_0x3342('0x13')]));}else{if(_0x42bc3b[_0x3342('0xa')]){_0x1e3353[_0x3342('0x88')](_0x51b276(_0x42bc3b,_0x3506d4[_0x466e06]));}}}}}return Promise[_0x3342('0x8c')](_0x1e3353);})['then'](function(_0x3c8fd5){var _0x2766e8=_0x3c8fd5;var _0x2cfbee=null;if(_0x2766e8){_0x2cfbee=_0x2766e8[_0x3342('0x87')]===0x1?_0x2766e8[0x0]:null;}if(!_0x2cfbee&&!_0x2766e8)return _0x2f6a48;var _0x3c151b=_0x21bdc2[_0x5c9399[_0x3342('0x13')]][_0x3342('0x90')];_0x19fcc5['model']=_[_0x3342('0x91')](_0x3c151b);_0x19fcc5[_0x3342('0x7f')]=_[_0x3342('0x91')](_0x10842c[_0x3342('0x7f')]);_0x19fcc5[_0x3342('0x92')]=_[_0x3342('0x93')](_0x19fcc5['model'],_0x19fcc5['query']);_0x2858a6['attributes']=_[_0x3342('0x93')](_0x19fcc5[_0x3342('0xa')],qs[_0x3342('0x94')](_0x10842c[_0x3342('0x7f')][_0x3342('0x94')]));_0x2858a6[_0x3342('0x95')]=_0x2858a6[_0x3342('0x95')][_0x3342('0x87')]?_0x2858a6['attributes']:_0x19fcc5[_0x3342('0xa')];if(!_0x10842c[_0x3342('0x7f')][_0x3342('0x96')](_0x3342('0x97'))){_0x2858a6['limit']=qs[_0x3342('0x98')](_0x10842c[_0x3342('0x7f')][_0x3342('0x98')]);_0x2858a6[_0x3342('0x99')]=qs[_0x3342('0x99')](_0x10842c[_0x3342('0x7f')][_0x3342('0x99')]);}_0x2858a6[_0x3342('0x9a')]=qs[_0x3342('0x9b')](_0x10842c['query'][_0x3342('0x9b')]);_0x2858a6[_0x3342('0x7d')]=qs['filters'](_[_0x3342('0x9c')](_0x10842c['query'],_0x19fcc5[_0x3342('0x92')]));if(_0x10842c['query'][_0x3342('0x4')]){_0x2858a6['where']=_[_0x3342('0x9d')](_0x2858a6[_0x3342('0x7d')],{'$or':_['map'](_0x3c151b,function(_0x3a24b7){if(_0x3a24b7[_0x3342('0x11')]['key']!==_0x3342('0x9e')){var _0x24c9ef={};_0x24c9ef[_0x3a24b7[_0x3342('0x5')]]={'$like':'%'+_0x10842c[_0x3342('0x7f')][_0x3342('0x4')]+'%'};return _0x24c9ef;}})});}var _0x1d58cb=[];var _0x5cb6c5=null;var _0x29a7a1={};if(_0x2cfbee){_0x5cb6c5=_[_0x3342('0x8a')](_0x14193b,[_0x3342('0xc'),_0x2cfbee[_0x3342('0xc')]]);if(_0x5cb6c5[_0x3342('0x5')]){_0x29a7a1={};if(_0x5c9399[_0x3342('0x13')]===_0x3342('0x72')){_0x29a7a1[_0x5cb6c5[_0x3342('0x9f')]]=_[_0x3342('0x9')](_0x2cfbee[_0x3342('0xb')],'id');}else{_0x29a7a1[_0x5cb6c5['foreignKey']]=_0x2cfbee[_0x3342('0xb')];}_0x1d58cb[_0x3342('0x88')](_0x29a7a1);}else{_0x2858a6[_0x3342('0x7d')]['id']=_0x2cfbee['associatedResources'];}}else{for(var _0x5ef689=0x0;_0x5ef689<_0x2766e8[_0x3342('0x87')];_0x5ef689++){_0x5cb6c5=_['find'](_0x14193b,['name',_0x2766e8[_0x5ef689][_0x3342('0xc')]]);if(_0x5cb6c5[_0x3342('0x5')]){_0x29a7a1={};_0x29a7a1[_0x5cb6c5['foreignKey']]=_0x2766e8[_0x5ef689][_0x3342('0xb')];_0x1d58cb['push'](_0x29a7a1);}else{if(!_0x2858a6[_0x3342('0x7d')]['id'])_0x2858a6['where']['id']=[];_0x2766e8[_0x5ef689]['associatedResources'][_0x3342('0xa0')](function(_0x2d3f3e){_0x2858a6[_0x3342('0x7d')]['id']['push'](_0x2d3f3e);});}}}if(!_['isEmpty'](_0x1d58cb)){_0x2858a6[_0x3342('0x7d')]=_['merge'](_0x2858a6[_0x3342('0x7d')],{'$and':{'$or':_0x1d58cb}});}_0x2858a6=_[_0x3342('0x9d')]({},_0x2858a6,_0x10842c[_0x3342('0xa1')]);if(_0x2cfbee&&!_0x2cfbee[_0x3342('0x8f')]&&_0x5c9399['childModel']==='AnalyticExtractedReport'){if(_0x10842c[_0x3342('0x7f')][_0x3342('0xa2')]){_0x2858a6['include']=[{'all':!![]}];}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['findAll'](_0x2858a6)[_0x3342('0x8')](function(_0x21a2bc){var _0x45899e=[];_0x21a2bc[_0x3342('0xa0')](function(_0x22b415){var _0x5e368f;switch(_0x22b415['reportType']){case'default':_0x5e368f=_[_0x3342('0x8a')](_0x2cfbee[_0x3342('0xb')],function(_0x3aaf86){return _0x3aaf86['id']===_0x22b415['reportId']&&_0x3aaf86[_0x3342('0x11')]===_0x3342('0xa3');});break;case _0x3342('0xa4'):_0x5e368f=_[_0x3342('0x8a')](_0x2cfbee[_0x3342('0xb')],function(_0x2355c0){return _0x2355c0['id']===_0x22b415['reportId']&&_0x2355c0[_0x3342('0x11')]==='CustomReports';});break;}if(_0x5e368f)_0x45899e['push'](_0x22b415);});_0x2f6a48['count']=_0x45899e[_0x3342('0x87')];_0x2f6a48[_0x3342('0xa5')]=_0x45899e;return _0x2f6a48;});}else{if(!_['isEmpty'](_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')])){_0x2858a6['where']['id']=_0x2858a6[_0x3342('0x7d')]['id']?_[_0x3342('0x93')](_0x2858a6[_0x3342('0x7d')]['id'],_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')]):_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')];}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['count']({'where':_0x2858a6[_0x3342('0x7d')]})[_0x3342('0x8')](function(_0x13738c){_0x2f6a48[_0x3342('0xa7')]=_0x13738c;if(_0x10842c[_0x3342('0x7f')][_0x3342('0xa2')]){if(_0x5c9399[_0x3342('0x13')]==='CmContact'){_0x2858a6['include']=[{'model':_0x21bdc2[_0x3342('0x6a')],'as':_0x3342('0xa8'),'attributes':['id',_0x3342('0xc'),_0x3342('0xa9')],'required':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?!![]:![]},{'model':_0x21bdc2[_0x3342('0x6a')],'as':'ThroughTags','attributes':['id',_0x3342('0xc'),_0x3342('0xa9')],'through':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?{'attributes':[],'where':{'TagId':_0x10842c[_0x3342('0x7f')]['tag']||undefined}}:{},'required':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?!![]:![]}];}else{_0x2858a6[_0x3342('0xab')]=[{'all':!![]}];}}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['findAll'](_0x2858a6);})[_0x3342('0x8')](function(_0x250317){_0x2f6a48[_0x3342('0xa5')]=_0x250317;if(_0x16c3f3===_0x3342('0x2d')&&_0x10842c[_0x3342('0x7f')][_0x3342('0xac')]===_0x3342('0xad')){var _0x5ccbc6=[];for(var _0x53a9e1=0x0;_0x53a9e1<_0x2f6a48[_0x3342('0xa5')]['length'];_0x53a9e1++){_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xae'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b('sms',_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b('fax',_0x2f6a48['rows'][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb0'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb1'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb2'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1]['dataValues']));}return Promise['all'](_0x5ccbc6)['then'](function(){return _0x2f6a48;});}return _0x2f6a48;});}});}}});}; \ No newline at end of file +var _0xd943=['contacts','parentSections','lists','CmList','companies','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','ignore','autoAssociation','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','DefaultReports','count','ids','CmContact','Tags','color','ThroughTags','tag','openTabs','true','rows','chat','dataValues','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','field','filter','then','associatedResources','catch','value','model','name','UserProfileResource','findAll','AnalyticExtractedReport','map','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject'];(function(_0x352faf,_0x2ff7dd){var _0x17b07f=function(_0x431fa3){while(--_0x431fa3){_0x352faf['push'](_0x352faf['shift']());}};_0x17b07f(++_0x2ff7dd);}(_0xd943,0x15d));var _0x3d94=function(_0x26b542,_0x1f64c2){_0x26b542=_0x26b542-0x0;var _0x130b99=_0xd943[_0x26b542];return _0x130b99;};'use strict';var _=require(_0x3d94('0x0'));var attributes=require(_0x3d94('0x1'));var qs=require(_0x3d94('0x2'));var squel=require(_0x3d94('0x3'));module['exports']=function(_0x691e28){var _0x3edd1b=_0x691e28[_0x3d94('0x4')];function _0xc13b61(_0xaf8962,_0x5751f6){return new Promise(function(_0x54e692,_0x34c9c3){if(!_0x5751f6)return _0x54e692(null);var _0x51cf1f=_0x5751f6['filter']?{[_0x5751f6['filter'][_0x3d94('0x5')]]:_0x5751f6[_0x3d94('0x6')]['value']}:undefined;return _0x3edd1b[_0xaf8962]['findAll']({'where':_0x51cf1f,'raw':!![]})[_0x3d94('0x7')](function(_0x27e381){_0x5751f6[_0x3d94('0x8')]=_['map'](_0x27e381,'id');_0x54e692(_0x5751f6);})[_0x3d94('0x9')](function(_0x4ac968){_0x34c9c3(_0x4ac968);});});}function _0x39e2fa(_0x301536,_0x5f5041){return new Promise(function(_0x1897de,_0xe5c5fb){var _0x203aa0=_0x301536[_0x3d94('0x6')]?{[_0x301536[_0x3d94('0x6')]['field']]:_0x301536[_0x3d94('0x6')][_0x3d94('0xa')]}:undefined;return _0x3edd1b[_0x301536[_0x3d94('0xb')]]['findAll']({'where':_0x203aa0,'raw':!![]})[_0x3d94('0x7')](function(_0x29608d){_0x5f5041[_0x3d94('0x8')]=_['map'](_0x29608d,function(_0x14ea5f){return _0x14ea5f[_0x3d94('0xc')];});_0x1897de(_0x5f5041);})[_0x3d94('0x9')](function(_0x34098e){_0xe5c5fb(_0x34098e);});});}function _0xaf939a(_0xd8efaa,_0x31c6e8,_0x9893cb){if(!_0x31c6e8)return Promise['resolve'](null);return new Promise(function(_0x22676a,_0x1a9315){return _0x3edd1b[_0x3d94('0xd')][_0x3d94('0xe')]({'where':{'sectionId':_0x31c6e8['id']},'raw':!![]})[_0x3d94('0x7')](function(_0x3ca0e3){if(_0xd8efaa[_0x3d94('0x5')]&&_0xd8efaa['field']!=='id'){_0x31c6e8[_0x3d94('0x8')]=_['map'](_0x3ca0e3,function(_0x28bead){return _0x28bead[_0xd8efaa[_0x3d94('0x5')]];});}else{if(_0x9893cb===_0x3d94('0xf')){_0x31c6e8[_0x3d94('0x8')]=_[_0x3d94('0x10')](_0x3ca0e3,function(_0x4f0beb){return{'id':_0x4f0beb['resourceId'],'type':_0x4f0beb[_0x3d94('0x11')]};});}else{_0x31c6e8[_0x3d94('0x8')]=_[_0x3d94('0x10')](_0x3ca0e3,function(_0x4edee4){return _0x4edee4[_0x3d94('0x12')];});}}_0x22676a(_0x31c6e8);})[_0x3d94('0x9')](function(_0x123adc){_0x1a9315(_0x123adc);});});}function _0x384f76(_0x395133,_0x4093a4){var _0x295493={'parentSections':[]};switch(_0x395133[_0x3d94('0x13')]()){case _0x3d94('0x14'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x16');break;case _0x3d94('0x17'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x18');break;case _0x3d94('0x19'):_0x295493['childModel']=_0x3d94('0x1a');_0x295493['parentSections']=[{'name':_0x3d94('0x1b'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x1c')}];break;case _0x3d94('0x1d'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x1e');break;case _0x3d94('0x1f'):_0x295493['childModel']='CmContact';_0x295493[_0x3d94('0x20')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x3d94('0x21'):_0x295493['childModel']=_0x3d94('0x22');break;case _0x3d94('0x23'):_0x295493[_0x3d94('0x15')]='CmCompany';break;case _0x3d94('0x24'):_0x295493['childModel']=_0x3d94('0x25');break;case'chatqueues':_0x295493[_0x3d94('0x15')]=_0x3d94('0x26');break;case _0x3d94('0x27'):_0x295493[_0x3d94('0x15')]='ChatWebsite';break;case _0x3d94('0x28'):_0x295493['childModel']=_0x3d94('0x29');break;case _0x3d94('0x2a'):_0x295493['childModel']='FaxAccount';break;case _0x3d94('0x2b'):case _0x3d94('0x2c'):case _0x3d94('0x2d'):_0x295493['childModel']=_0x3d94('0x2e');break;case _0x3d94('0x2f'):_0x295493['childModel']=_0x3d94('0x30');break;case _0x3d94('0x31'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x32');break;case _0x3d94('0x33'):_0x295493['childModel']=_0x3d94('0x34');_0x295493[_0x3d94('0x20')]=[{'name':_0x3d94('0x35'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x36'),'model':_0x3d94('0x37'),'filter':{'field':'role','value':['agent']}},{'name':_0x3d94('0x38'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x36'),'model':_0x3d94('0x37'),'filter':{'field':_0x3d94('0x39'),'value':[_0x3d94('0x3a')]}},{'name':_0x3d94('0x3b'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x3c'),'model':_0x3d94('0x3d'),'filter':{'field':'type','value':[_0x3d94('0x3e')]}},{'name':_0x3d94('0x3f'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x3c'),'model':'VoiceQueue','filter':{'field':_0x3d94('0x11'),'value':[_0x3d94('0x40')]}}];break;case _0x3d94('0x41'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x42');break;case'chanspies':_0x295493[_0x3d94('0x15')]=_0x3d94('0x43');break;case _0x3d94('0x44'):_0x295493['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x295493['childModel']=_0x3d94('0x45');break;case _0x3d94('0x46'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x47');break;case _0x3d94('0x48'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x49');break;case'mailsubstatuses':_0x295493['childModel']=_0x3d94('0x4a');break;case _0x3d94('0x4b'):_0x295493['childModel']=_0x3d94('0x4c');break;case'openchannelaccounts':_0x295493[_0x3d94('0x15')]=_0x3d94('0x4d');break;case _0x3d94('0x4e'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x4f');break;case'smsaccounts':_0x295493[_0x3d94('0x15')]=_0x3d94('0x50');break;case _0x3d94('0x51'):_0x295493['childModel']=_0x3d94('0x52');break;case'whatsappaccounts':_0x295493['childModel']=_0x3d94('0x53');break;case _0x3d94('0x54'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x55');break;case'voicequeues':case _0x3d94('0x56'):_0x295493['childModel']=_0x3d94('0x3d');if(_0x4093a4){_0x295493[_0x3d94('0x20')]=[{'name':_0x3d94('0x3b')},{'name':_0x3d94('0x3f')}];}break;case _0x3d94('0x57'):case _0x3d94('0x58'):case _0x3d94('0x59'):_0x295493['childModel']=_0x3d94('0x37');if(_0x4093a4){_0x295493[_0x3d94('0x20')]=[{'name':'Users','filter':{'field':'role','value':[_0x3d94('0x5a'),_0x3d94('0x5b')]},'ignore':!![]},{'name':'Agents'},{'name':_0x3d94('0x38')}];}break;case _0x3d94('0x5c'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x5d');break;case _0x3d94('0x5e'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x5f');break;case _0x3d94('0x60'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x61');break;case _0x3d94('0x62'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x63');break;case _0x3d94('0x64'):_0x295493[_0x3d94('0x15')]='DeskAccount';break;case _0x3d94('0x65'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x66');break;case _0x3d94('0x67'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x37');break;case _0x3d94('0x68'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x69');break;case'dispositions':_0x295493[_0x3d94('0x15')]='Disposition';break;case _0x3d94('0x6a'):_0x295493[_0x3d94('0x15')]='Dashboard';break;case _0x3d94('0x6b'):_0x295493['childModel']='Interval';break;case _0x3d94('0x6c'):_0x295493['childModel']=_0x3d94('0x6d');break;case _0x3d94('0x6e'):_0x295493['childModel']=_0x3d94('0x6f');break;case'sounds':_0x295493['childModel']=_0x3d94('0x70');break;case _0x3d94('0x71'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x72');break;case _0x3d94('0x73'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x74');break;case _0x3d94('0x75'):_0x295493[_0x3d94('0x15')]='Trigger';break;case _0x3d94('0x76'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x77');break;case _0x3d94('0x78'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x79');break;case _0x3d94('0x7a'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x7b');break;case _0x3d94('0x7c'):_0x295493[_0x3d94('0x15')]='AnalyticExtractedReport';_0x295493[_0x3d94('0x20')]=[{'name':'Reports','field':'id','foreignKey':_0x3d94('0x7d')}];break;case _0x3d94('0x7e'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x7f');break;}return _0x295493;}function _0x3a837b(_0x36428e,_0x1c503d){var _0x169aa1=_0x36428e[_0x3d94('0x80')](0x0)['toUpperCase']()+_0x36428e['slice'](0x1);var _0x46bff3={'type':_0x3edd1b['Sequelize'][_0x3d94('0x81')][_0x3d94('0x82')],'raw':!![]};return new Promise(function(_0x557bb4,_0x211f0e){var _0x2d3fdd=squel[_0x3d94('0x83')]()[_0x3d94('0x5')](_0x3d94('0x84')+_0x169aa1+_0x3d94('0x85'),'id')[_0x3d94('0x5')]('ui.createdAt')[_0x3d94('0x86')](_0x3d94('0x87')+_0x36428e+_0x3d94('0x88'),'ui')['where'](_0x3d94('0x89'),_0x1c503d['id']);return _0x3edd1b[_0x3d94('0x8a')][_0x3d94('0x8b')](_0x2d3fdd[_0x3d94('0x8c')](),_0x46bff3)['then'](function(_0x5292cc){_0x1c503d[_0x169aa1+_0x3d94('0x8d')]=_0x5292cc;_0x557bb4(_0x5292cc);})[_0x3d94('0x9')](function(_0x4190ef){_0x211f0e(_0x4190ef);});});}return _0x691e28[_0x3d94('0x8e')]('UserProfile',attributes,{'tableName':_0x3d94('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c99d1){var _0x49bfb0={'raw':_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x90')],'where':{}};var _0x336e36={};var _0x4eee2b={'count':0x0,'rows':[]};var _0x3135f3=_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x91')];var _0x5747a8=_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x92')]||![];var _0x5c7aac=_0x384f76(_0x3135f3,_0x5747a8);if(!_0x5c7aac['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x3135f3+'\x27');var _0x3ac9ea=[{'name':_0x3135f3}];if(!_[_0x3d94('0x93')](_0x5c7aac[_0x3d94('0x20')]))_0x3ac9ea=_0x5c7aac[_0x3d94('0x20')];var _0x196ed6=[];for(var _0x4ecfa2=0x0;_0x4ecfa2<_0x3ac9ea[_0x3d94('0x94')];_0x4ecfa2++){_0x196ed6[_0x3d94('0x95')](_0x3edd1b[_0x3d94('0x96')][_0x3d94('0x97')]({'where':{'userProfileId':_0x1c99d1[_0x3d94('0x98')]['id'],'name':_0x3ac9ea[_0x4ecfa2][_0x3d94('0xc')]},'raw':!![]}));}return Promise['all'](_0x196ed6)[_0x3d94('0x7')](function(_0x4b6838){var _0x1f3551=_[_0x3d94('0x6')](_0x4b6838,function(_0x437fff){return _0x437fff?_0x437fff:undefined;});var _0x393ac9=_[_0x3d94('0x6')](_0x3ac9ea,[_0x3d94('0x99'),!![]]);var _0x48b108=_['isEmpty'](_0x1f3551)&&_[_0x3d94('0x93')](_0x393ac9)?null:_['union'](_0x393ac9,_0x1f3551);if(!_0x48b108)return null;var _0x56b5dc=[];for(var _0x5c5fb2=0x0;_0x5c5fb2<_0x48b108[_0x3d94('0x94')];_0x5c5fb2++){var _0x262a6a=_[_0x3d94('0x97')](_0x3ac9ea,function(_0x396146){return _0x48b108[_0x5c5fb2]?_0x396146[_0x3d94('0xc')]===_0x48b108[_0x5c5fb2][_0x3d94('0xc')]:null;});if(_0x262a6a){if(_0x48b108[_0x5c5fb2][_0x3d94('0x99')]){_0x56b5dc[_0x3d94('0x95')](_0xc13b61(_0x5c7aac['childModel'],_0x48b108[_0x5c5fb2]));}else{if(!_0x48b108[_0x5c5fb2][_0x3d94('0x9a')]){_0x56b5dc['push'](_0xaf939a(_0x262a6a,_0x48b108[_0x5c5fb2],_0x5c7aac[_0x3d94('0x15')]));}else{if(_0x262a6a[_0x3d94('0xb')]){_0x56b5dc[_0x3d94('0x95')](_0x39e2fa(_0x262a6a,_0x48b108[_0x5c5fb2]));}}}}}return Promise['all'](_0x56b5dc);})['then'](function(_0x4f0f84){var _0x426ef5=_0x4f0f84;var _0x406098=null;if(_0x426ef5){_0x406098=_0x426ef5[_0x3d94('0x94')]===0x1?_0x426ef5[0x0]:null;}if(!_0x406098&&!_0x426ef5)return _0x4eee2b;var _0x1c7ea5=_0x3edd1b[_0x5c7aac[_0x3d94('0x15')]]['rawAttributes'];_0x336e36['model']=_[_0x3d94('0x9b')](_0x1c7ea5);_0x336e36[_0x3d94('0x8b')]=_[_0x3d94('0x9b')](_0x1c99d1['query']);_0x336e36[_0x3d94('0x9c')]=_['intersection'](_0x336e36[_0x3d94('0xb')],_0x336e36[_0x3d94('0x8b')]);_0x49bfb0[_0x3d94('0x9d')]=_[_0x3d94('0x9e')](_0x336e36[_0x3d94('0xb')],qs[_0x3d94('0x9f')](_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x9f')]));_0x49bfb0[_0x3d94('0x9d')]=_0x49bfb0[_0x3d94('0x9d')][_0x3d94('0x94')]?_0x49bfb0[_0x3d94('0x9d')]:_0x336e36[_0x3d94('0xb')];if(!_0x1c99d1['query'][_0x3d94('0xa0')](_0x3d94('0xa1'))){_0x49bfb0[_0x3d94('0xa2')]=qs[_0x3d94('0xa2')](_0x1c99d1['query'][_0x3d94('0xa2')]);_0x49bfb0['offset']=qs['offset'](_0x1c99d1[_0x3d94('0x8b')]['offset']);}_0x49bfb0[_0x3d94('0xa3')]=qs[_0x3d94('0xa4')](_0x1c99d1['query'][_0x3d94('0xa4')]);_0x49bfb0['where']=qs[_0x3d94('0x9c')](_[_0x3d94('0xa5')](_0x1c99d1['query'],_0x336e36['filters']));if(_0x1c99d1['query'][_0x3d94('0x6')]){_0x49bfb0['where']=_['merge'](_0x49bfb0[_0x3d94('0xa6')],{'$or':_[_0x3d94('0x10')](_0x1c7ea5,function(_0x184c4b){if(_0x184c4b[_0x3d94('0x11')]['key']!==_0x3d94('0xa7')){var _0x3fc0e7={};_0x3fc0e7[_0x184c4b[_0x3d94('0x5')]]={'$like':'%'+_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x6')]+'%'};return _0x3fc0e7;}})});}var _0x200cc2=[];var _0x53c0f0=null;var _0x467ccb={};if(_0x406098){_0x53c0f0=_[_0x3d94('0x97')](_0x3ac9ea,[_0x3d94('0xc'),_0x406098[_0x3d94('0xc')]]);if(_0x53c0f0[_0x3d94('0x5')]){_0x467ccb={};if(_0x5c7aac[_0x3d94('0x15')]===_0x3d94('0xf')){_0x467ccb[_0x53c0f0[_0x3d94('0xa8')]]=_['map'](_0x406098['associatedResources'],'id');}else{_0x467ccb[_0x53c0f0[_0x3d94('0xa8')]]=_0x406098[_0x3d94('0x8')];}_0x200cc2[_0x3d94('0x95')](_0x467ccb);}else{_0x49bfb0['where']['id']=_0x406098[_0x3d94('0x8')];}}else{for(var _0xa193a1=0x0;_0xa193a1<_0x426ef5[_0x3d94('0x94')];_0xa193a1++){_0x53c0f0=_[_0x3d94('0x97')](_0x3ac9ea,[_0x3d94('0xc'),_0x426ef5[_0xa193a1]['name']]);if(_0x53c0f0['field']){_0x467ccb={};_0x467ccb[_0x53c0f0[_0x3d94('0xa8')]]=_0x426ef5[_0xa193a1][_0x3d94('0x8')];_0x200cc2[_0x3d94('0x95')](_0x467ccb);}else{if(!_0x49bfb0[_0x3d94('0xa6')]['id'])_0x49bfb0[_0x3d94('0xa6')]['id']=[];_0x426ef5[_0xa193a1][_0x3d94('0x8')][_0x3d94('0xa9')](function(_0x3bcc86){_0x49bfb0[_0x3d94('0xa6')]['id'][_0x3d94('0x95')](_0x3bcc86);});}}}if(!_[_0x3d94('0x93')](_0x200cc2)){_0x49bfb0[_0x3d94('0xa6')]=_[_0x3d94('0xaa')](_0x49bfb0['where'],{'$and':{'$or':_0x200cc2}});}_0x49bfb0=_[_0x3d94('0xaa')]({},_0x49bfb0,_0x1c99d1[_0x3d94('0xab')]);if(_0x406098&&!_0x406098['autoAssociation']&&_0x5c7aac['childModel']===_0x3d94('0xf')){if(_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xac')]){_0x49bfb0[_0x3d94('0xad')]=[{'all':!![]}];}return _0x3edd1b[_0x5c7aac['childModel']]['findAll'](_0x49bfb0)[_0x3d94('0x7')](function(_0x2ec7d9){var _0x243db0=[];_0x2ec7d9[_0x3d94('0xa9')](function(_0x106b3b){var _0x5350a3;switch(_0x106b3b[_0x3d94('0xae')]){case'default':_0x5350a3=_[_0x3d94('0x97')](_0x406098[_0x3d94('0x8')],function(_0x472151){return _0x472151['id']===_0x106b3b['reportId']&&_0x472151[_0x3d94('0x11')]===_0x3d94('0xaf');});break;case'custom':_0x5350a3=_[_0x3d94('0x97')](_0x406098['associatedResources'],function(_0x3c62ec){return _0x3c62ec['id']===_0x106b3b[_0x3d94('0x7d')]&&_0x3c62ec[_0x3d94('0x11')]==='CustomReports';});break;}if(_0x5350a3)_0x243db0[_0x3d94('0x95')](_0x106b3b);});_0x4eee2b[_0x3d94('0xb0')]=_0x243db0[_0x3d94('0x94')];_0x4eee2b['rows']=_0x243db0;return _0x4eee2b;});}else{if(!_[_0x3d94('0x93')](_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb1')])){_0x49bfb0[_0x3d94('0xa6')]['id']=_0x49bfb0[_0x3d94('0xa6')]['id']?_[_0x3d94('0x9e')](_0x49bfb0[_0x3d94('0xa6')]['id'],_0x1c99d1[_0x3d94('0x8b')]['ids']):_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb1')];}return _0x3edd1b[_0x5c7aac[_0x3d94('0x15')]][_0x3d94('0xb0')]({'where':_0x49bfb0[_0x3d94('0xa6')]})[_0x3d94('0x7')](function(_0x5716fd){_0x4eee2b[_0x3d94('0xb0')]=_0x5716fd;if(_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xac')]){if(_0x5c7aac['childModel']===_0x3d94('0xb2')){_0x49bfb0['include']=[{'model':_0x3edd1b[_0x3d94('0x72')],'as':_0x3d94('0xb3'),'attributes':['id','name',_0x3d94('0xb4')],'required':_0x1c99d1[_0x3d94('0x8b')]['tag']?!![]:![]},{'model':_0x3edd1b['Tag'],'as':_0x3d94('0xb5'),'attributes':['id',_0x3d94('0xc'),'color'],'through':_0x1c99d1['query']['tag']?{'attributes':[],'where':{'TagId':_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb6')]||undefined}}:{},'required':_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb6')]?!![]:![]}];}else{_0x49bfb0[_0x3d94('0xad')]=[{'all':!![]}];}}return _0x3edd1b[_0x5c7aac['childModel']][_0x3d94('0xe')](_0x49bfb0);})[_0x3d94('0x7')](function(_0x239992){_0x4eee2b['rows']=_0x239992;if(_0x3135f3===_0x3d94('0x35')&&_0x1c99d1['query'][_0x3d94('0xb7')]===_0x3d94('0xb8')){var _0x25015e=[];for(var _0xbf625a=0x0;_0xbf625a<_0x4eee2b[_0x3d94('0xb9')]['length'];_0xbf625a++){_0x25015e['push'](_0x3a837b(_0x3d94('0xba'),_0x4eee2b[_0x3d94('0xb9')][_0xbf625a]['dataValues']));_0x25015e[_0x3d94('0x95')](_0x3a837b('sms',_0x4eee2b[_0x3d94('0xb9')][_0xbf625a][_0x3d94('0xbb')]));_0x25015e[_0x3d94('0x95')](_0x3a837b('fax',_0x4eee2b[_0x3d94('0xb9')][_0xbf625a]['dataValues']));_0x25015e[_0x3d94('0x95')](_0x3a837b(_0x3d94('0xbc'),_0x4eee2b[_0x3d94('0xb9')][_0xbf625a][_0x3d94('0xbb')]));_0x25015e['push'](_0x3a837b('openchannel',_0x4eee2b[_0x3d94('0xb9')][_0xbf625a][_0x3d94('0xbb')]));_0x25015e[_0x3d94('0x95')](_0x3a837b(_0x3d94('0xbd'),_0x4eee2b['rows'][_0xbf625a][_0x3d94('0xbb')]));}return Promise['all'](_0x25015e)['then'](function(){return _0x4eee2b;});}return _0x4eee2b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 92af5ab..f19b7b2 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 _0xac6a=['localhost','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5eee1d,_0x578128){var _0x36e73f=function(_0x35a00e){while(--_0x35a00e){_0x5eee1d['push'](_0x5eee1d['shift']());}};_0x36e73f(++_0x578128);}(_0xac6a,0xc2));var _0xaac6=function(_0x2fd7ab,_0x5ceab9){_0x2fd7ab=_0x2fd7ab-0x0;var _0x562853=_0xac6a[_0x2fd7ab];return _0x562853;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});config[_0xaac6('0xc')]=_[_0xaac6('0xd')](config[_0xaac6('0xc')],{'host':_0xaac6('0xe'),'port':0x18eb});var socket=require(_0xaac6('0xf'))(new Redis(config[_0xaac6('0xc')]));require('./userProfile.socket')[_0xaac6('0x10')](socket);function respondWithRpcPromise(_0x160834,_0x31fa92,_0x37c3ba){return new BPromise(function(_0x19345a,_0x2b9460){return client['request'](_0x160834,_0x37c3ba)[_0xaac6('0x11')](function(_0x1605a3){logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));logger['debug'](_0xaac6('0x15'),_0x31fa92,_0xaac6('0x14'),JSON['stringify'](_0x1605a3));if(_0x1605a3['error']){if(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x17')]===0x1f4){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x2b9460(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);}logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x19345a(_0x1605a3['error']['message']);}else{logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));_0x19345a(_0x1605a3[_0xaac6('0x19')][_0xaac6('0x18')]);}})['catch'](function(_0x22d66e){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x22d66e);_0x2b9460(_0x22d66e);});});} \ No newline at end of file +var _0x27a0=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http'];(function(_0x178f1c,_0x343a61){var _0x568ab3=function(_0x283b33){while(--_0x283b33){_0x178f1c['push'](_0x178f1c['shift']());}};_0x568ab3(++_0x343a61);}(_0x27a0,0xbf));var _0x027a=function(_0x47aae2,_0x2ba7ea){_0x47aae2=_0x47aae2-0x0;var _0x549183=_0x27a0[_0x47aae2];return _0x549183;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});config[_0x027a('0x9')]=_[_0x027a('0xa')](config['redis'],{'host':_0x027a('0xb'),'port':0x18eb});var socket=require(_0x027a('0xc'))(new Redis(config[_0x027a('0x9')]));require('./userProfile.socket')[_0x027a('0xd')](socket);function respondWithRpcPromise(_0x42ccac,_0x2d13a2,_0x534902){return new BPromise(function(_0x6d5b04,_0xe5df59){return client[_0x027a('0xe')](_0x42ccac,_0x534902)[_0x027a('0xf')](function(_0x172eb4){logger[_0x027a('0x10')](_0x027a('0x11'),_0x2d13a2,_0x027a('0x12'));logger[_0x027a('0x13')](_0x027a('0x14'),_0x2d13a2,_0x027a('0x12'),JSON['stringify'](_0x172eb4));if(_0x172eb4[_0x027a('0x15')]){if(_0x172eb4[_0x027a('0x15')][_0x027a('0x16')]===0x1f4){logger[_0x027a('0x15')](_0x027a('0x11'),_0x2d13a2,_0x172eb4['error']['message']);return _0xe5df59(_0x172eb4[_0x027a('0x15')]['message']);}logger[_0x027a('0x15')]('UserProfile,\x20%s,\x20%s',_0x2d13a2,_0x172eb4[_0x027a('0x15')]['message']);return _0x6d5b04(_0x172eb4['error']['message']);}else{logger[_0x027a('0x10')](_0x027a('0x11'),_0x2d13a2,_0x027a('0x12'));_0x6d5b04(_0x172eb4[_0x027a('0x17')]['message']);}})[_0x027a('0x18')](function(_0x2fccf6){logger['error']('UserProfile,\x20%s,\x20%s',_0x2d13a2,_0x2fccf6);_0xe5df59(_0x2fccf6);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 111ef06..38b1ca0 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 _0xd8b1=['length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xd8b1,0x105));var _0x1d8b=function(_0x253d8f,_0x510e18){_0x253d8f=_0x253d8f-0x0;var _0x47a203=_0xd8b1[_0x253d8f];return _0x47a203;};'use strict';var UserProfileEvents=require(_0x1d8b('0x0'));var events=[_0x1d8b('0x1'),_0x1d8b('0x2'),_0x1d8b('0x3')];function createListener(_0x20c6dd,_0x5deaca){return function(_0x68d7af){_0x5deaca[_0x1d8b('0x4')](_0x20c6dd,_0x68d7af);};}function removeListener(_0x531170,_0xad218){return function(){UserProfileEvents['removeListener'](_0x531170,_0xad218);};}exports['register']=function(_0x4d5ba0){for(var _0x27534c=0x0,_0x5f5bbd=events[_0x1d8b('0x5')];_0x27534c<_0x5f5bbd;_0x27534c++){var _0xdba2e5=events[_0x27534c];var _0x2b28e2=createListener(_0x1d8b('0x6')+_0xdba2e5,_0x4d5ba0);UserProfileEvents['on'](_0xdba2e5,_0x2b28e2);}}; \ No newline at end of file +var _0x7b5a=['userProfile:','./userProfile.events','save','remove','update','emit','register','length'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x7b5a,0x1e1));var _0xa7b5=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x7b5a[_0x454018];return _0x24697d;};'use strict';var UserProfileEvents=require(_0xa7b5('0x0'));var events=[_0xa7b5('0x1'),_0xa7b5('0x2'),_0xa7b5('0x3')];function createListener(_0x2f4b25,_0x261a51){return function(_0x3617e7){_0x261a51[_0xa7b5('0x4')](_0x2f4b25,_0x3617e7);};}function removeListener(_0x4136d9,_0x433af9){return function(){UserProfileEvents['removeListener'](_0x4136d9,_0x433af9);};}exports[_0xa7b5('0x5')]=function(_0x168599){for(var _0x332808=0x0,_0x3b2280=events[_0xa7b5('0x6')];_0x332808<_0x3b2280;_0x332808++){var _0x254865=events[_0x332808];var _0x40ab22=createListener(_0xa7b5('0x7')+_0x254865,_0x168599);UserProfileEvents['on'](_0x254865,_0x40ab22);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 593af6a..df30997 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 _0x5da6=['express','Router','fs-extra','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5da6,0xd5));var _0x65da=function(_0x3a76f7,_0x2cd65d){_0x3a76f7=_0x3a76f7-0x0;var _0x4d4e44=_0x5da6[_0x3a76f7];return _0x4d4e44;};'use strict';var multer=require(_0x65da('0x0'));var util=require('util');var path=require(_0x65da('0x1'));var timeout=require(_0x65da('0x2'));var express=require(_0x65da('0x3'));var router=express[_0x65da('0x4')]();var fs_extra=require(_0x65da('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x65da('0x6'));router[_0x65da('0x7')]('/',auth['isAuthenticated'](),controller[_0x65da('0x8')]);router[_0x65da('0x7')](_0x65da('0x9'),auth[_0x65da('0xa')](),controller[_0x65da('0xb')]);router['get'](_0x65da('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x65da('0xa')](),controller[_0x65da('0xd')]);router[_0x65da('0xe')](_0x65da('0xc'),auth['isAuthenticated'](),controller[_0x65da('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x65da('0x10')]);module[_0x65da('0x11')]=router; \ No newline at end of file +var _0x9443=['create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','/:id','show'];(function(_0x2afd20,_0x5b2e59){var _0x56fa34=function(_0x4a5fc8){while(--_0x4a5fc8){_0x2afd20['push'](_0x2afd20['shift']());}};_0x56fa34(++_0x5b2e59);}(_0x9443,0xc3));var _0x3944=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0x9443[_0x4da356];return _0x321b07;};'use strict';var multer=require(_0x3944('0x0'));var util=require(_0x3944('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3944('0x2'));var router=express[_0x3944('0x3')]();var fs_extra=require(_0x3944('0x4'));var auth=require(_0x3944('0x5'));var interaction=require(_0x3944('0x6'));var config=require(_0x3944('0x7'));var controller=require(_0x3944('0x8'));router[_0x3944('0x9')]('/',auth['isAuthenticated'](),controller[_0x3944('0xa')]);router[_0x3944('0x9')]('/describe',auth[_0x3944('0xb')](),controller['describe']);router[_0x3944('0x9')](_0x3944('0xc'),auth[_0x3944('0xb')](),controller[_0x3944('0xd')]);router['post']('/',auth[_0x3944('0xb')](),controller[_0x3944('0xe')]);router[_0x3944('0xf')](_0x3944('0xc'),auth[_0x3944('0xb')](),controller[_0x3944('0x10')]);router[_0x3944('0x11')](_0x3944('0xc'),auth[_0x3944('0xb')](),controller['destroy']);module[_0x3944('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f687044..2214c91 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 _0xbd3a=['STRING'];(function(_0x1d2f7b,_0x394fac){var _0x2979ca=function(_0x53ab09){while(--_0x53ab09){_0x1d2f7b['push'](_0x1d2f7b['shift']());}};_0x2979ca(++_0x394fac);}(_0xbd3a,0xc8));var _0xabd3=function(_0x1012e3,_0x5bd06b){_0x1012e3=_0x1012e3-0x0;var _0x50bb35=_0xbd3a[_0x1012e3];return _0x50bb35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xabd3('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xabd3('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x8322=['exports','STRING','sequelize'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x8322,0xd1));var _0x2832=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x8322[_0x16629d];return _0x56ccee;};'use strict';var Sequelize=require(_0x2832('0x0'));module[_0x2832('0x1')]={'name':{'type':Sequelize[_0x2832('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x2832('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index dca6716..8c0edd5 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 _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x1f25ac,_0x5c3d9f){var _0x27d350=function(_0x564312){while(--_0x564312){_0x1f25ac['push'](_0x1f25ac['shift']());}};_0x27d350(++_0x5c3d9f);}(_0xf61e,0x191));var _0xef61=function(_0x341673,_0x53874e){_0x341673=_0x341673-0x0;var _0xd95370=_0xf61e[_0x341673];return _0xd95370;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file +var _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x6d38,0x1ef));var _0x86d3=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6d38[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['UserProfileResource'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 2a55dcd..daa3d17 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 _0x06b7=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1ec578,_0x2af79d){var _0x349c8a=function(_0x17e928){while(--_0x17e928){_0x1ec578['push'](_0x1ec578['shift']());}};_0x349c8a(++_0x2af79d);}(_0x06b7,0x1d6));var _0x706b=function(_0x4b527e,_0x4c85fe){_0x4b527e=_0x4b527e-0x0;var _0x1a1189=_0x06b7[_0x4b527e];return _0x1a1189;};'use strict';var _=require('lodash');var util=require(_0x706b('0x0'));var logger=require(_0x706b('0x1'))(_0x706b('0x2'));var moment=require(_0x706b('0x3'));var BPromise=require('bluebird');var rp=require(_0x706b('0x4'));var fs=require('fs');var path=require(_0x706b('0x5'));var rimraf=require(_0x706b('0x6'));var config=require(_0x706b('0x7'));var attributes=require(_0x706b('0x8'));module[_0x706b('0x9')]=function(_0x425730,_0x9d1084){return _0x425730[_0x706b('0xa')]('UserProfileResource',attributes,{'tableName':_0x706b('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x706b('0xc'),_0x706b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45b1=['./userProfileResource.attributes','exports','define','compositeIndex','sectionId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x45b1,0x123));var _0x145b=function(_0x38b099,_0x1148f8){_0x38b099=_0x38b099-0x0;var _0x40dd56=_0x45b1[_0x38b099];return _0x40dd56;};'use strict';var _=require(_0x145b('0x0'));var util=require(_0x145b('0x1'));var logger=require('../../config/logger')(_0x145b('0x2'));var moment=require(_0x145b('0x3'));var BPromise=require(_0x145b('0x4'));var rp=require(_0x145b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x145b('0x6'));var config=require(_0x145b('0x7'));var attributes=require(_0x145b('0x8'));module[_0x145b('0x9')]=function(_0x16fd7a,_0x27b28a){return _0x16fd7a[_0x145b('0xa')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x145b('0xb'),'fields':['resourceId',_0x145b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bab6322..692c028 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 _0x5e7c=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug'];(function(_0x436fcb,_0x384cba){var _0x5af55f=function(_0x5cf253){while(--_0x5cf253){_0x436fcb['push'](_0x436fcb['shift']());}};_0x5af55f(++_0x384cba);}(_0x5e7c,0x91));var _0xc5e7=function(_0x3bc147,_0x1cd58f){_0x3bc147=_0x3bc147-0x0;var _0x51ee75=_0x5e7c[_0x3bc147];return _0x51ee75;};'use strict';var _=require(_0xc5e7('0x0'));var util=require(_0xc5e7('0x1'));var moment=require(_0xc5e7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5e7('0x3'));var fs=require('fs');var Redis=require(_0xc5e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5e7('0x5'));var logger=require(_0xc5e7('0x6'))(_0xc5e7('0x7'));var config=require(_0xc5e7('0x8'));var jayson=require(_0xc5e7('0x9'));var client=jayson[_0xc5e7('0xa')][_0xc5e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4466d6,_0x4a7f11,_0x441136){return new BPromise(function(_0x54640c,_0x8b0492){return client['request'](_0x4466d6,_0x441136)[_0xc5e7('0xc')](function(_0x1cd149){logger[_0xc5e7('0xd')](_0xc5e7('0xe'),_0x4a7f11,'request\x20sent');logger[_0xc5e7('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4a7f11,'request\x20sent',JSON[_0xc5e7('0x10')](_0x1cd149));if(_0x1cd149[_0xc5e7('0x11')]){if(_0x1cd149[_0xc5e7('0x11')][_0xc5e7('0x12')]===0x1f4){logger['error'](_0xc5e7('0xe'),_0x4a7f11,_0x1cd149[_0xc5e7('0x11')][_0xc5e7('0x13')]);return _0x8b0492(_0x1cd149[_0xc5e7('0x11')]['message']);}logger[_0xc5e7('0x11')](_0xc5e7('0xe'),_0x4a7f11,_0x1cd149[_0xc5e7('0x11')]['message']);return _0x54640c(_0x1cd149['error'][_0xc5e7('0x13')]);}else{logger['info'](_0xc5e7('0xe'),_0x4a7f11,_0xc5e7('0x14'));_0x54640c(_0x1cd149[_0xc5e7('0x15')][_0xc5e7('0x13')]);}})[_0xc5e7('0x16')](function(_0x151f78){logger[_0xc5e7('0x11')](_0xc5e7('0xe'),_0x4a7f11,_0x151f78);_0x8b0492(_0x151f78);});});} \ No newline at end of file +var _0xb010=['client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xb010,0x8b));var _0x0b01=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb010[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x0b01('0x0'));var moment=require('moment');var BPromise=require(_0x0b01('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b01('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b01('0x3'));var logger=require(_0x0b01('0x4'))(_0x0b01('0x5'));var config=require(_0x0b01('0x6'));var jayson=require(_0x0b01('0x7'));var client=jayson[_0x0b01('0x8')][_0x0b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c65ed,_0x824a23,_0x33eb05){return new BPromise(function(_0xcdfdfd,_0x15364b){return client[_0x0b01('0xa')](_0x3c65ed,_0x33eb05)['then'](function(_0x46d839){logger[_0x0b01('0xb')](_0x0b01('0xc'),_0x824a23,_0x0b01('0xd'));logger[_0x0b01('0xe')](_0x0b01('0xf'),_0x824a23,_0x0b01('0xd'),JSON[_0x0b01('0x10')](_0x46d839));if(_0x46d839[_0x0b01('0x11')]){if(_0x46d839[_0x0b01('0x11')]['code']===0x1f4){logger[_0x0b01('0x11')](_0x0b01('0xc'),_0x824a23,_0x46d839[_0x0b01('0x11')][_0x0b01('0x12')]);return _0x15364b(_0x46d839[_0x0b01('0x11')][_0x0b01('0x12')]);}logger[_0x0b01('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x824a23,_0x46d839[_0x0b01('0x11')][_0x0b01('0x12')]);return _0xcdfdfd(_0x46d839[_0x0b01('0x11')][_0x0b01('0x12')]);}else{logger[_0x0b01('0xb')](_0x0b01('0xc'),_0x824a23,_0x0b01('0xd'));_0xcdfdfd(_0x46d839[_0x0b01('0x13')][_0x0b01('0x12')]);}})[_0x0b01('0x14')](function(_0x458baf){logger[_0x0b01('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x824a23,_0x458baf);_0x15364b(_0x458baf);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4863a7f..da0cdca 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 _0x39b9=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x39b9,0x99));var _0x939b=function(_0x28a418,_0x301838){_0x28a418=_0x28a418-0x0;var _0x29fd01=_0x39b9[_0x28a418];return _0x29fd01;};'use strict';var multer=require(_0x939b('0x0'));var util=require(_0x939b('0x1'));var path=require(_0x939b('0x2'));var timeout=require(_0x939b('0x3'));var express=require(_0x939b('0x4'));var router=express[_0x939b('0x5')]();var fs_extra=require(_0x939b('0x6'));var auth=require(_0x939b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x939b('0x8')]('/',auth[_0x939b('0x9')](),controller[_0x939b('0xa')]);router[_0x939b('0x8')](_0x939b('0xb'),auth['isAuthenticated'](),controller[_0x939b('0xc')]);router[_0x939b('0x8')](_0x939b('0xd'),auth[_0x939b('0x9')](),controller[_0x939b('0xe')]);router[_0x939b('0xf')]('/',auth[_0x939b('0x9')](),controller[_0x939b('0x10')]);router[_0x939b('0x11')](_0x939b('0xd'),auth[_0x939b('0x9')](),controller[_0x939b('0x12')]);router['delete'](_0x939b('0xd'),auth[_0x939b('0x9')](),controller[_0x939b('0x13')]);module[_0x939b('0x14')]=router; \ No newline at end of file +var _0xead1=['exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xead1,0x1c9));var _0x1ead=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xead1[_0x334841];return _0x5beb4b;};'use strict';var multer=require(_0x1ead('0x0'));var util=require(_0x1ead('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ead('0x2'));var router=express['Router']();var fs_extra=require(_0x1ead('0x3'));var auth=require(_0x1ead('0x4'));var interaction=require(_0x1ead('0x5'));var config=require('../../config/environment');var controller=require(_0x1ead('0x6'));router['get']('/',auth[_0x1ead('0x7')](),controller[_0x1ead('0x8')]);router[_0x1ead('0x9')](_0x1ead('0xa'),auth['isAuthenticated'](),controller[_0x1ead('0xb')]);router['get'](_0x1ead('0xc'),auth[_0x1ead('0x7')](),controller[_0x1ead('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1ead('0xe')]);router[_0x1ead('0xf')](_0x1ead('0xc'),auth[_0x1ead('0x7')](),controller[_0x1ead('0x10')]);router[_0x1ead('0x11')](_0x1ead('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1ead('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 966c741..ee9efa1 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 _0xcf66=['getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x214fe4,_0x20a197){var _0x5ab5d2=function(_0x48e105){while(--_0x48e105){_0x214fe4['push'](_0x214fe4['shift']());}};_0x5ab5d2(++_0x20a197);}(_0xcf66,0x71));var _0x6cf6=function(_0x4b2fd8,_0x49ec4c){_0x4b2fd8=_0x4b2fd8-0x0;var _0x33b91a=_0xcf66[_0x4b2fd8];return _0x33b91a;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6cf6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1c599d){this[_0x6cf6('0x5')]('crudPermissions',_0x1c599d?_0x1c599d[_0x6cf6('0x6')](''):[]);},'get':function(){return this[_0x6cf6('0x7')](_0x6cf6('0x8'))?this['getDataValue'](_0x6cf6('0x8'))[_0x6cf6('0x9')](''):[];}}}; \ No newline at end of file +var _0xf7b4=['getDataValue','split','sequelize','STRING','INTEGER','setDataValue','crudPermissions','join'];(function(_0x414d3b,_0x3a3741){var _0x374042=function(_0x40b8c5){while(--_0x40b8c5){_0x414d3b['push'](_0x414d3b['shift']());}};_0x374042(++_0x3a3741);}(_0xf7b4,0x152));var _0x4f7b=function(_0x17a6f8,_0x3c5730){_0x17a6f8=_0x17a6f8-0x0;var _0x16cf3f=_0xf7b4[_0x17a6f8];return _0x16cf3f;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4f7b('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4f7b('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4f7b('0x1')],'set':function(_0x3e18fd){this[_0x4f7b('0x3')](_0x4f7b('0x4'),_0x3e18fd?_0x3e18fd[_0x4f7b('0x5')](''):[]);},'get':function(){return this[_0x4f7b('0x6')](_0x4f7b('0x4'))?this[_0x4f7b('0x6')](_0x4f7b('0x4'))[_0x4f7b('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 30c31e4..6d49a66 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 _0xdcd5=['../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xa316a,_0x249375){var _0x4fa5da=function(_0x1bd3b3){while(--_0x1bd3b3){_0xa316a['push'](_0xa316a['shift']());}};_0x4fa5da(++_0x249375);}(_0xdcd5,0x1a0));var _0x5dcd=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0xdcd5[_0x450bf9];return _0x268350;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5dcd('0x0'));var rp=require('request-promise');var moment=require(_0x5dcd('0x1'));var BPromise=require(_0x5dcd('0x2'));var Mustache=require(_0x5dcd('0x3'));var util=require(_0x5dcd('0x4'));var path=require(_0x5dcd('0x5'));var sox=require('sox');var csv=require(_0x5dcd('0x6'));var ejs=require(_0x5dcd('0x7'));var fs=require('fs');var fs_extra=require(_0x5dcd('0x8'));var _=require('lodash');var squel=require(_0x5dcd('0x9'));var crypto=require(_0x5dcd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5dcd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5dcd('0xc'));var Papa=require(_0x5dcd('0xd'));var Redis=require(_0x5dcd('0xe'));var authService=require(_0x5dcd('0xf'));var qs=require(_0x5dcd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dcd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5dcd('0x12'));var licenseUtil=require(_0x5dcd('0x13'));var db=require(_0x5dcd('0x14'))['db'];function respondWithStatusCode(_0x2600cb,_0x4b0845){_0x4b0845=_0x4b0845||0xcc;return function(_0x3d38c3){if(_0x3d38c3){return _0x2600cb[_0x5dcd('0x15')](_0x4b0845);}return _0x2600cb['status'](_0x4b0845)[_0x5dcd('0x16')]();};}function respondWithResult(_0x176d36,_0x26d9b8){_0x26d9b8=_0x26d9b8||0xc8;return function(_0x1690c5){if(_0x1690c5){return _0x176d36[_0x5dcd('0x17')](_0x26d9b8)[_0x5dcd('0x18')](_0x1690c5);}};}function respondWithFilteredResult(_0xdaff19,_0x164506){return function(_0x2102d0){if(_0x2102d0){var _0x22f8a6=typeof _0x164506[_0x5dcd('0x19')]==='undefined'&&typeof _0x164506[_0x5dcd('0x1a')]==='undefined';var _0x12bff6=_0x2102d0[_0x5dcd('0x1b')];var _0x1d546e=_0x22f8a6?0x0:_0x164506[_0x5dcd('0x19')];var _0x16ec9b=_0x22f8a6?_0x2102d0[_0x5dcd('0x1b')]:_0x164506[_0x5dcd('0x19')]+_0x164506['limit'];var _0x49e42c;if(_0x16ec9b>=_0x12bff6){_0x16ec9b=_0x12bff6;_0x49e42c=0xc8;}else{_0x49e42c=0xce;}_0xdaff19[_0x5dcd('0x17')](_0x49e42c);return _0xdaff19[_0x5dcd('0x1c')](_0x5dcd('0x1d'),_0x1d546e+'-'+_0x16ec9b+'/'+_0x12bff6)['json'](_0x2102d0);}return null;};}function patchUpdates(_0x4f2d64){return function(_0x21d043){try{jsonpatch[_0x5dcd('0x1e')](_0x21d043,_0x4f2d64,!![]);}catch(_0x1bc932){return BPromise[_0x5dcd('0x1f')](_0x1bc932);}return _0x21d043['save']();};}function saveUpdates(_0x28a5bc,_0x17a78d){return function(_0x347d9b){if(_0x347d9b){return _0x347d9b[_0x5dcd('0x20')](_0x28a5bc)[_0x5dcd('0x21')](function(_0x196df9){return _0x196df9;});}return null;};}function removeEntity(_0x2f4996,_0x5c5cf3){return function(_0x382dd6){if(_0x382dd6){return _0x382dd6[_0x5dcd('0x22')]()['then'](function(){_0x2f4996['status'](0xcc)[_0x5dcd('0x16')]();});}};}function handleEntityNotFound(_0x45f3c3,_0x105e20){return function(_0x50ac23){if(!_0x50ac23){_0x45f3c3['sendStatus'](0x194);}return _0x50ac23;};}function handleError(_0x4e8d5b,_0x26bb8b){_0x26bb8b=_0x26bb8b||0x1f4;return function(_0x498cc1){logger[_0x5dcd('0x23')](_0x498cc1[_0x5dcd('0x24')]);if(_0x498cc1['name']){delete _0x498cc1['name'];}_0x4e8d5b[_0x5dcd('0x17')](_0x26bb8b)[_0x5dcd('0x25')](_0x498cc1);};}exports[_0x5dcd('0x26')]=function(_0x490f18,_0x1fc103){var _0x3e350={},_0x91cbaa={},_0x2e9938={'count':0x0,'rows':[]};var _0x14b7a3=_[_0x5dcd('0x27')](db[_0x5dcd('0x28')][_0x5dcd('0x29')],function(_0x58f66b){return{'name':_0x58f66b[_0x5dcd('0x2a')],'type':_0x58f66b['type'][_0x5dcd('0x2b')]};});_0x91cbaa[_0x5dcd('0x2c')]=_[_0x5dcd('0x27')](_0x14b7a3,_0x5dcd('0x2d'));_0x91cbaa[_0x5dcd('0x2e')]=_[_0x5dcd('0x2f')](_0x490f18[_0x5dcd('0x2e')]);_0x91cbaa[_0x5dcd('0x30')]=_[_0x5dcd('0x31')](_0x91cbaa['model'],_0x91cbaa[_0x5dcd('0x2e')]);_0x3e350[_0x5dcd('0x32')]=_['intersection'](_0x91cbaa[_0x5dcd('0x2c')],qs[_0x5dcd('0x33')](_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x33')]));_0x3e350[_0x5dcd('0x32')]=_0x3e350[_0x5dcd('0x32')]['length']?_0x3e350[_0x5dcd('0x32')]:_0x91cbaa['model'];if(!_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x34')](_0x5dcd('0x35'))){_0x3e350[_0x5dcd('0x1a')]=qs[_0x5dcd('0x1a')](_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x1a')]);_0x3e350['offset']=qs['offset'](_0x490f18['query'][_0x5dcd('0x19')]);}_0x3e350[_0x5dcd('0x36')]=qs[_0x5dcd('0x37')](_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x37')]);_0x3e350['where']=qs[_0x5dcd('0x30')](_['pick'](_0x490f18[_0x5dcd('0x2e')],_0x91cbaa[_0x5dcd('0x30')]),_0x14b7a3);if(_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x38')]){_0x3e350[_0x5dcd('0x39')]=_[_0x5dcd('0x3a')](_0x3e350[_0x5dcd('0x39')],{'$or':_['map'](_0x14b7a3,function(_0x55e8e7){if(_0x55e8e7[_0x5dcd('0x3b')]!=='VIRTUAL'){var _0x3296a2={};_0x3296a2[_0x55e8e7['name']]={'$like':'%'+_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x38')]+'%'};return _0x3296a2;}})});}_0x3e350=_[_0x5dcd('0x3a')]({},_0x3e350,_0x490f18[_0x5dcd('0x3c')]);var _0x3b25d5={'where':_0x3e350[_0x5dcd('0x39')]};return db['UserProfileSection'][_0x5dcd('0x1b')](_0x3b25d5)[_0x5dcd('0x21')](function(_0x5012e5){_0x2e9938['count']=_0x5012e5;if(_0x490f18[_0x5dcd('0x2e')][_0x5dcd('0x3d')]){_0x3e350[_0x5dcd('0x3e')]=[{'all':!![]}];}return db[_0x5dcd('0x28')]['findAll'](_0x3e350);})[_0x5dcd('0x21')](function(_0x1a2d7f){_0x2e9938[_0x5dcd('0x3f')]=_0x1a2d7f;return _0x2e9938;})[_0x5dcd('0x21')](respondWithFilteredResult(_0x1fc103,_0x3e350))[_0x5dcd('0x40')](handleError(_0x1fc103,null));};exports[_0x5dcd('0x41')]=function(_0x527fdb,_0x5e850e){var _0x3c2a68={'raw':![],'where':{'id':_0x527fdb['params']['id']}},_0x4b246d={};_0x4b246d['model']=_[_0x5dcd('0x2f')](db[_0x5dcd('0x28')]['rawAttributes']);_0x4b246d[_0x5dcd('0x2e')]=_[_0x5dcd('0x2f')](_0x527fdb[_0x5dcd('0x2e')]);_0x4b246d['filters']=_['intersection'](_0x4b246d[_0x5dcd('0x2c')],_0x4b246d[_0x5dcd('0x2e')]);_0x3c2a68['attributes']=_['intersection'](_0x4b246d[_0x5dcd('0x2c')],qs['fields'](_0x527fdb[_0x5dcd('0x2e')][_0x5dcd('0x33')]));_0x3c2a68[_0x5dcd('0x32')]=_0x3c2a68[_0x5dcd('0x32')][_0x5dcd('0x42')]?_0x3c2a68[_0x5dcd('0x32')]:_0x4b246d[_0x5dcd('0x2c')];if(_0x527fdb[_0x5dcd('0x2e')][_0x5dcd('0x3d')]){_0x3c2a68['include']=[{'all':!![]}];}_0x3c2a68=_[_0x5dcd('0x3a')]({},_0x3c2a68,_0x527fdb[_0x5dcd('0x3c')]);return db[_0x5dcd('0x28')][_0x5dcd('0x43')](_0x3c2a68)[_0x5dcd('0x21')](handleEntityNotFound(_0x5e850e,null))[_0x5dcd('0x21')](respondWithResult(_0x5e850e,null))['catch'](handleError(_0x5e850e,null));};exports['create']=function(_0x46ca83,_0x68f9e5){return db['UserProfileSection'][_0x5dcd('0x44')](_0x46ca83[_0x5dcd('0x45')],{})['then'](respondWithResult(_0x68f9e5,0xc9))['catch'](handleError(_0x68f9e5,null));};exports['update']=function(_0x29c7bf,_0x1a6545){if(_0x29c7bf[_0x5dcd('0x45')]['id']){delete _0x29c7bf[_0x5dcd('0x45')]['id'];}return db['UserProfileSection'][_0x5dcd('0x43')]({'where':{'id':_0x29c7bf[_0x5dcd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a6545,null))['then'](saveUpdates(_0x29c7bf['body'],null))[_0x5dcd('0x21')](respondWithResult(_0x1a6545,null))['catch'](handleError(_0x1a6545,null));};exports[_0x5dcd('0x22')]=function(_0x5a6862,_0x2758fa){return db['UserProfileSection']['find']({'where':{'id':_0x5a6862['params']['id']}})[_0x5dcd('0x21')](handleEntityNotFound(_0x2758fa,null))[_0x5dcd('0x21')](removeEntity(_0x2758fa,null))['catch'](handleError(_0x2758fa,null));};exports[_0x5dcd('0x47')]=function(_0x16869b,_0x4017e3){return db[_0x5dcd('0x28')][_0x5dcd('0x47')]()[_0x5dcd('0x21')](respondWithResult(_0x4017e3,null))['catch'](handleError(_0x4017e3,null));}; \ No newline at end of file +var _0x0181=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','save','update','then','destroy','end','error','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x470f71,_0x735e3a){var _0x4fdbb0=function(_0x51b3ff){while(--_0x51b3ff){_0x470f71['push'](_0x470f71['shift']());}};_0x4fdbb0(++_0x735e3a);}(_0x0181,0xc6));var _0x1018=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0181[_0x31a371];return _0x2a5bd6;};'use strict';var emlformat=require(_0x1018('0x0'));var rimraf=require(_0x1018('0x1'));var zipdir=require(_0x1018('0x2'));var jsonpatch=require(_0x1018('0x3'));var rp=require(_0x1018('0x4'));var moment=require(_0x1018('0x5'));var BPromise=require(_0x1018('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1018('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1018('0x8'));var fs=require('fs');var fs_extra=require(_0x1018('0x9'));var _=require(_0x1018('0xa'));var squel=require(_0x1018('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1018('0xc'));var querystring=require(_0x1018('0xd'));var Papa=require(_0x1018('0xe'));var Redis=require(_0x1018('0xf'));var authService=require(_0x1018('0x10'));var qs=require(_0x1018('0x11'));var as=require(_0x1018('0x12'));var hardwareService=require(_0x1018('0x13'));var logger=require('../../config/logger')(_0x1018('0x14'));var utils=require(_0x1018('0x15'));var config=require(_0x1018('0x16'));var licenseUtil=require(_0x1018('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4251ef,_0x585354){_0x585354=_0x585354||0xcc;return function(_0x561f13){if(_0x561f13){return _0x4251ef[_0x1018('0x18')](_0x585354);}return _0x4251ef[_0x1018('0x19')](_0x585354)['end']();};}function respondWithResult(_0x36e3c8,_0x4b39bf){_0x4b39bf=_0x4b39bf||0xc8;return function(_0x42c1e8){if(_0x42c1e8){return _0x36e3c8['status'](_0x4b39bf)[_0x1018('0x1a')](_0x42c1e8);}};}function respondWithFilteredResult(_0x265af2,_0x13af2a){return function(_0x139b2a){if(_0x139b2a){var _0x174d1f=typeof _0x13af2a[_0x1018('0x1b')]===_0x1018('0x1c')&&typeof _0x13af2a['limit']==='undefined';var _0x597249=_0x139b2a['count'];var _0x25b369=_0x174d1f?0x0:_0x13af2a['offset'];var _0x336170=_0x174d1f?_0x139b2a['count']:_0x13af2a['offset']+_0x13af2a['limit'];var _0x4aa000;if(_0x336170>=_0x597249){_0x336170=_0x597249;_0x4aa000=0xc8;}else{_0x4aa000=0xce;}_0x265af2[_0x1018('0x19')](_0x4aa000);return _0x265af2['set']('Content-Range',_0x25b369+'-'+_0x336170+'/'+_0x597249)['json'](_0x139b2a);}return null;};}function patchUpdates(_0x274a09){return function(_0x114918){try{jsonpatch['apply'](_0x114918,_0x274a09,!![]);}catch(_0xd86868){return BPromise['reject'](_0xd86868);}return _0x114918[_0x1018('0x1d')]();};}function saveUpdates(_0x53466b,_0x208bf4){return function(_0x4c6138){if(_0x4c6138){return _0x4c6138[_0x1018('0x1e')](_0x53466b)[_0x1018('0x1f')](function(_0x5f118b){return _0x5f118b;});}return null;};}function removeEntity(_0x3d1b52,_0x5018f5){return function(_0x17163a){if(_0x17163a){return _0x17163a[_0x1018('0x20')]()[_0x1018('0x1f')](function(){_0x3d1b52[_0x1018('0x19')](0xcc)[_0x1018('0x21')]();});}};}function handleEntityNotFound(_0x21c0c9,_0x317207){return function(_0x159207){if(!_0x159207){_0x21c0c9[_0x1018('0x18')](0x194);}return _0x159207;};}function handleError(_0x5a5127,_0x4a35d1){_0x4a35d1=_0x4a35d1||0x1f4;return function(_0x121543){logger[_0x1018('0x22')](_0x121543['stack']);if(_0x121543[_0x1018('0x23')]){delete _0x121543[_0x1018('0x23')];}_0x5a5127[_0x1018('0x19')](_0x4a35d1)['send'](_0x121543);};}exports[_0x1018('0x24')]=function(_0x44113b,_0x4fbb2a){var _0x3c4c64={},_0x908cf8={},_0x39a827={'count':0x0,'rows':[]};var _0x21b600=_[_0x1018('0x25')](db[_0x1018('0x26')][_0x1018('0x27')],function(_0x20d911){return{'name':_0x20d911[_0x1018('0x28')],'type':_0x20d911[_0x1018('0x29')][_0x1018('0x2a')]};});_0x908cf8[_0x1018('0x2b')]=_['map'](_0x21b600,_0x1018('0x23'));_0x908cf8[_0x1018('0x2c')]=_['keys'](_0x44113b[_0x1018('0x2c')]);_0x908cf8[_0x1018('0x2d')]=_['intersection'](_0x908cf8[_0x1018('0x2b')],_0x908cf8[_0x1018('0x2c')]);_0x3c4c64[_0x1018('0x2e')]=_[_0x1018('0x2f')](_0x908cf8[_0x1018('0x2b')],qs[_0x1018('0x30')](_0x44113b[_0x1018('0x2c')][_0x1018('0x30')]));_0x3c4c64[_0x1018('0x2e')]=_0x3c4c64[_0x1018('0x2e')][_0x1018('0x31')]?_0x3c4c64[_0x1018('0x2e')]:_0x908cf8[_0x1018('0x2b')];if(!_0x44113b['query'][_0x1018('0x32')](_0x1018('0x33'))){_0x3c4c64[_0x1018('0x34')]=qs['limit'](_0x44113b[_0x1018('0x2c')][_0x1018('0x34')]);_0x3c4c64[_0x1018('0x1b')]=qs['offset'](_0x44113b[_0x1018('0x2c')][_0x1018('0x1b')]);}_0x3c4c64[_0x1018('0x35')]=qs[_0x1018('0x36')](_0x44113b['query'][_0x1018('0x36')]);_0x3c4c64[_0x1018('0x37')]=qs['filters'](_['pick'](_0x44113b[_0x1018('0x2c')],_0x908cf8['filters']),_0x21b600);if(_0x44113b[_0x1018('0x2c')][_0x1018('0x38')]){_0x3c4c64[_0x1018('0x37')]=_[_0x1018('0x39')](_0x3c4c64[_0x1018('0x37')],{'$or':_[_0x1018('0x25')](_0x21b600,function(_0x2586da){if(_0x2586da[_0x1018('0x29')]!==_0x1018('0x3a')){var _0x407fdd={};_0x407fdd[_0x2586da[_0x1018('0x23')]]={'$like':'%'+_0x44113b[_0x1018('0x2c')][_0x1018('0x38')]+'%'};return _0x407fdd;}})});}_0x3c4c64=_[_0x1018('0x39')]({},_0x3c4c64,_0x44113b[_0x1018('0x3b')]);var _0x970b23={'where':_0x3c4c64[_0x1018('0x37')]};return db['UserProfileSection'][_0x1018('0x3c')](_0x970b23)[_0x1018('0x1f')](function(_0x2b57a7){_0x39a827[_0x1018('0x3c')]=_0x2b57a7;if(_0x44113b[_0x1018('0x2c')][_0x1018('0x3d')]){_0x3c4c64[_0x1018('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1018('0x3f')](_0x3c4c64);})['then'](function(_0x1009e9){_0x39a827[_0x1018('0x40')]=_0x1009e9;return _0x39a827;})[_0x1018('0x1f')](respondWithFilteredResult(_0x4fbb2a,_0x3c4c64))[_0x1018('0x41')](handleError(_0x4fbb2a,null));};exports[_0x1018('0x42')]=function(_0x1df5d3,_0x3e5216){var _0xfed37f={'raw':![],'where':{'id':_0x1df5d3[_0x1018('0x43')]['id']}},_0x424c24={};_0x424c24['model']=_['keys'](db[_0x1018('0x26')]['rawAttributes']);_0x424c24[_0x1018('0x2c')]=_['keys'](_0x1df5d3[_0x1018('0x2c')]);_0x424c24[_0x1018('0x2d')]=_[_0x1018('0x2f')](_0x424c24[_0x1018('0x2b')],_0x424c24[_0x1018('0x2c')]);_0xfed37f[_0x1018('0x2e')]=_[_0x1018('0x2f')](_0x424c24[_0x1018('0x2b')],qs[_0x1018('0x30')](_0x1df5d3[_0x1018('0x2c')]['fields']));_0xfed37f[_0x1018('0x2e')]=_0xfed37f[_0x1018('0x2e')]['length']?_0xfed37f[_0x1018('0x2e')]:_0x424c24['model'];if(_0x1df5d3['query'][_0x1018('0x3d')]){_0xfed37f[_0x1018('0x3e')]=[{'all':!![]}];}_0xfed37f=_['merge']({},_0xfed37f,_0x1df5d3[_0x1018('0x3b')]);return db[_0x1018('0x26')][_0x1018('0x44')](_0xfed37f)[_0x1018('0x1f')](handleEntityNotFound(_0x3e5216,null))[_0x1018('0x1f')](respondWithResult(_0x3e5216,null))[_0x1018('0x41')](handleError(_0x3e5216,null));};exports[_0x1018('0x45')]=function(_0x4a2a1c,_0x9e415c){return db['UserProfileSection']['create'](_0x4a2a1c[_0x1018('0x46')],{})[_0x1018('0x1f')](respondWithResult(_0x9e415c,0xc9))['catch'](handleError(_0x9e415c,null));};exports['update']=function(_0x50937d,_0x56dd18){if(_0x50937d[_0x1018('0x46')]['id']){delete _0x50937d[_0x1018('0x46')]['id'];}return db[_0x1018('0x26')][_0x1018('0x44')]({'where':{'id':_0x50937d[_0x1018('0x43')]['id']}})[_0x1018('0x1f')](handleEntityNotFound(_0x56dd18,null))['then'](saveUpdates(_0x50937d[_0x1018('0x46')],null))[_0x1018('0x1f')](respondWithResult(_0x56dd18,null))['catch'](handleError(_0x56dd18,null));};exports[_0x1018('0x20')]=function(_0x1eb57f,_0x5e9c23){return db['UserProfileSection'][_0x1018('0x44')]({'where':{'id':_0x1eb57f[_0x1018('0x43')]['id']}})[_0x1018('0x1f')](handleEntityNotFound(_0x5e9c23,null))[_0x1018('0x1f')](removeEntity(_0x5e9c23,null))[_0x1018('0x41')](handleError(_0x5e9c23,null));};exports[_0x1018('0x47')]=function(_0x1baea1,_0x405e31){return db[_0x1018('0x26')][_0x1018('0x47')]()['then'](respondWithResult(_0x405e31,null))[_0x1018('0x41')](handleError(_0x405e31,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index e21b7b7..8e9db3a 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 _0x3646=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3646,0x12c));var _0x6364=function(_0x27f593,_0x2e9209){_0x27f593=_0x27f593-0x0;var _0x451489=_0x3646[_0x27f593];return _0x451489;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var logger=require(_0x6364('0x2'))(_0x6364('0x3'));var moment=require(_0x6364('0x4'));var BPromise=require(_0x6364('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6364('0x6'));var rimraf=require('rimraf');var config=require(_0x6364('0x7'));var attributes=require(_0x6364('0x8'));module[_0x6364('0x9')]=function(_0x13d3e8,_0x465c85){return _0x13d3e8[_0x6364('0xa')](_0x6364('0xb'),attributes,{'tableName':_0x6364('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6364('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1279=['userProfileId','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','sectionId'];(function(_0x5eb64c,_0x2a3a54){var _0x5f00e1=function(_0x1d9b48){while(--_0x1d9b48){_0x5eb64c['push'](_0x5eb64c['shift']());}};_0x5f00e1(++_0x2a3a54);}(_0x1279,0x1b9));var _0x9127=function(_0x589ead,_0x3142ee){_0x589ead=_0x589ead-0x0;var _0x2a5499=_0x1279[_0x589ead];return _0x2a5499;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9127('0x0'))(_0x9127('0x1'));var moment=require('moment');var BPromise=require(_0x9127('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9127('0x3'));var rimraf=require(_0x9127('0x4'));var config=require(_0x9127('0x5'));var attributes=require(_0x9127('0x6'));module[_0x9127('0x7')]=function(_0x5eb983,_0x3e9e12){return _0x5eb983[_0x9127('0x8')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x9127('0x9'),_0x9127('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0e82f0f..80ccb56 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 _0xf97f=['result','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x254b1d,_0x50d7e7){var _0x5377b8=function(_0x1d42e9){while(--_0x1d42e9){_0x254b1d['push'](_0x254b1d['shift']());}};_0x5377b8(++_0x50d7e7);}(_0xf97f,0xc7));var _0xff97=function(_0x47e5f1,_0x1ee147){_0x47e5f1=_0x47e5f1-0x0;var _0x212888=_0xf97f[_0x47e5f1];return _0x212888;};'use strict';var _=require(_0xff97('0x0'));var util=require(_0xff97('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff97('0x2'));var db=require(_0xff97('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xff97('0x4'))(_0xff97('0x5'));var config=require(_0xff97('0x6'));var jayson=require(_0xff97('0x7'));var client=jayson[_0xff97('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce0bc,_0x293b8e,_0x4c302d){return new BPromise(function(_0x5141fa,_0x2c793b){return client[_0xff97('0x9')](_0x2ce0bc,_0x4c302d)['then'](function(_0x1fe445){logger['info'](_0xff97('0xa'),_0x293b8e,_0xff97('0xb'));logger['debug'](_0xff97('0xc'),_0x293b8e,_0xff97('0xb'),JSON[_0xff97('0xd')](_0x1fe445));if(_0x1fe445[_0xff97('0xe')]){if(_0x1fe445[_0xff97('0xe')]['code']===0x1f4){logger[_0xff97('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x293b8e,_0x1fe445['error'][_0xff97('0xf')]);return _0x2c793b(_0x1fe445[_0xff97('0xe')][_0xff97('0xf')]);}logger[_0xff97('0xe')](_0xff97('0xa'),_0x293b8e,_0x1fe445[_0xff97('0xe')][_0xff97('0xf')]);return _0x5141fa(_0x1fe445[_0xff97('0xe')][_0xff97('0xf')]);}else{logger[_0xff97('0x10')](_0xff97('0xa'),_0x293b8e,'request\x20sent');_0x5141fa(_0x1fe445[_0xff97('0x11')][_0xff97('0xf')]);}})['catch'](function(_0x4d48cd){logger[_0xff97('0xe')](_0xff97('0xa'),_0x293b8e,_0x4d48cd);_0x2c793b(_0x4d48cd);});});} \ No newline at end of file +var _0x1ddb=['info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x4eb933,_0xa5016b){var _0x3c24e6=function(_0x5ab0a2){while(--_0x5ab0a2){_0x4eb933['push'](_0x4eb933['shift']());}};_0x3c24e6(++_0xa5016b);}(_0x1ddb,0xa1));var _0xb1dd=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0x1ddb[_0x39758d];return _0x44ac11;};'use strict';var _=require(_0xb1dd('0x0'));var util=require(_0xb1dd('0x1'));var moment=require(_0xb1dd('0x2'));var BPromise=require(_0xb1dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb1dd('0x4'));var logger=require('../../config/logger')(_0xb1dd('0x5'));var config=require('../../config/environment');var jayson=require(_0xb1dd('0x6'));var client=jayson[_0xb1dd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x441807,_0x277f7d,_0x1a0840){return new BPromise(function(_0x75b4bc,_0x288d9a){return client[_0xb1dd('0x8')](_0x441807,_0x1a0840)[_0xb1dd('0x9')](function(_0x4dc243){logger[_0xb1dd('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x277f7d,_0xb1dd('0xb'));logger['debug'](_0xb1dd('0xc'),_0x277f7d,_0xb1dd('0xb'),JSON[_0xb1dd('0xd')](_0x4dc243));if(_0x4dc243[_0xb1dd('0xe')]){if(_0x4dc243[_0xb1dd('0xe')][_0xb1dd('0xf')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x277f7d,_0x4dc243['error']['message']);return _0x288d9a(_0x4dc243[_0xb1dd('0xe')][_0xb1dd('0x10')]);}logger[_0xb1dd('0xe')](_0xb1dd('0x11'),_0x277f7d,_0x4dc243[_0xb1dd('0xe')][_0xb1dd('0x10')]);return _0x75b4bc(_0x4dc243[_0xb1dd('0xe')][_0xb1dd('0x10')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x277f7d,_0xb1dd('0xb'));_0x75b4bc(_0x4dc243[_0xb1dd('0x12')][_0xb1dd('0x10')]);}})['catch'](function(_0x18ed9c){logger['error'](_0xb1dd('0x11'),_0x277f7d,_0x18ed9c);_0x288d9a(_0x18ed9c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 30a8713..dfc8913 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e958d,_0x45a0ae){var _0x2545c6=function(_0xa513b9){while(--_0xa513b9){_0x4e958d['push'](_0x4e958d['shift']());}};_0x2545c6(++_0x45a0ae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xcb91[_0x49d19d];return _0x4ebef1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xca8f32,_0xe6ba73){var _0x4c23f8=function(_0x469c16){while(--_0x469c16){_0xca8f32['push'](_0xca8f32['shift']());}};_0x4c23f8(++_0xe6ba73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b421294..2f35506 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 _0x1d03=['exports','INTEGER','sequelize'];(function(_0x511015,_0x375ec8){var _0x41b1a6=function(_0x17c895){while(--_0x17c895){_0x511015['push'](_0x511015['shift']());}};_0x41b1a6(++_0x375ec8);}(_0x1d03,0x6b));var _0x31d0=function(_0x440c0,_0x39578e){_0x440c0=_0x440c0-0x0;var _0x50ce14=_0x1d03[_0x440c0];return _0x50ce14;};'use strict';var Sequelize=require(_0x31d0('0x0'));module[_0x31d0('0x1')]={'penalty':{'type':Sequelize[_0x31d0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x59ca=['sequelize','exports','INTEGER'];(function(_0x1e3f81,_0x905eaa){var _0x254459=function(_0x54ee1a){while(--_0x54ee1a){_0x1e3f81['push'](_0x1e3f81['shift']());}};_0x254459(++_0x905eaa);}(_0x59ca,0x162));var _0xa59c=function(_0x309e39,_0xad34c5){_0x309e39=_0x309e39-0x0;var _0x4ac0ac=_0x59ca[_0x309e39];return _0x4ac0ac;};'use strict';var Sequelize=require(_0xa59c('0x0'));module[_0xa59c('0x1')]={'penalty':{'type':Sequelize[_0xa59c('0x2')],'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 833f924..2096060 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 _0x2eba=['user_has_sms_queues','util','../../config/logger','api','moment','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x2f2919,_0x37445e){var _0x2f3406=function(_0xa99c94){while(--_0xa99c94){_0x2f2919['push'](_0x2f2919['shift']());}};_0x2f3406(++_0x37445e);}(_0x2eba,0xc7));var _0xa2eb=function(_0x162c3c,_0x3bd756){_0x162c3c=_0x162c3c-0x0;var _0x21c060=_0x2eba[_0x162c3c];return _0x21c060;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('UserSmsQueue',attributes,{'tableName':_0xa2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'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'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 3474e27..2e467d2 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 _0xd044=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x5cedf5,_0x36fb97){var _0x55081a=function(_0x54f9f3){while(--_0x54f9f3){_0x5cedf5['push'](_0x5cedf5['shift']());}};_0x55081a(++_0x36fb97);}(_0xd044,0x1b9));var _0x4d04=function(_0x28dcf7,_0x2362a6){_0x28dcf7=_0x28dcf7-0x0;var _0x340b7d=_0xd044[_0x28dcf7];return _0x340b7d;};'use strict';var _=require('lodash');var util=require(_0x4d04('0x0'));var moment=require('moment');var BPromise=require(_0x4d04('0x1'));var rs=require(_0x4d04('0x2'));var fs=require('fs');var Redis=require(_0x4d04('0x3'));var db=require(_0x4d04('0x4'))['db'];var utils=require(_0x4d04('0x5'));var logger=require(_0x4d04('0x6'))(_0x4d04('0x7'));var config=require('../../config/environment');var jayson=require(_0x4d04('0x8'));var client=jayson[_0x4d04('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0724,_0x7b1628,_0x38abb7){return new BPromise(function(_0x3a02c0,_0x587ac9){return client[_0x4d04('0xa')](_0x2e0724,_0x38abb7)['then'](function(_0x152fb1){logger[_0x4d04('0xb')](_0x4d04('0xc'),_0x7b1628,'request\x20sent');logger['debug'](_0x4d04('0xd'),_0x7b1628,_0x4d04('0xe'),JSON[_0x4d04('0xf')](_0x152fb1));if(_0x152fb1[_0x4d04('0x10')]){if(_0x152fb1[_0x4d04('0x10')]['code']===0x1f4){logger['error'](_0x4d04('0xc'),_0x7b1628,_0x152fb1[_0x4d04('0x10')][_0x4d04('0x11')]);return _0x587ac9(_0x152fb1[_0x4d04('0x10')][_0x4d04('0x11')]);}logger['error'](_0x4d04('0xc'),_0x7b1628,_0x152fb1[_0x4d04('0x10')]['message']);return _0x3a02c0(_0x152fb1[_0x4d04('0x10')][_0x4d04('0x11')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x7b1628,_0x4d04('0xe'));_0x3a02c0(_0x152fb1[_0x4d04('0x12')][_0x4d04('0x11')]);}})[_0x4d04('0x13')](function(_0x8bab43){logger[_0x4d04('0x10')](_0x4d04('0xc'),_0x7b1628,_0x8bab43);_0x587ac9(_0x8bab43);});});} \ No newline at end of file +var _0xcd02=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x6848c7,_0x1d76d5){var _0x17d568=function(_0x3a9c28){while(--_0x3a9c28){_0x6848c7['push'](_0x6848c7['shift']());}};_0x17d568(++_0x1d76d5);}(_0xcd02,0x1e8));var _0x2cd0=function(_0x11ea72,_0x36c5ae){_0x11ea72=_0x11ea72-0x0;var _0x147bef=_0xcd02[_0x11ea72];return _0x147bef;};'use strict';var _=require(_0x2cd0('0x0'));var util=require(_0x2cd0('0x1'));var moment=require(_0x2cd0('0x2'));var BPromise=require(_0x2cd0('0x3'));var rs=require(_0x2cd0('0x4'));var fs=require('fs');var Redis=require(_0x2cd0('0x5'));var db=require(_0x2cd0('0x6'))['db'];var utils=require(_0x2cd0('0x7'));var logger=require(_0x2cd0('0x8'))('rpc');var config=require(_0x2cd0('0x9'));var jayson=require(_0x2cd0('0xa'));var client=jayson[_0x2cd0('0xb')][_0x2cd0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe247bc,_0x4264c2,_0x394ead){return new BPromise(function(_0x9bf382,_0x4abc87){return client['request'](_0xe247bc,_0x394ead)['then'](function(_0x2041ba){logger['info'](_0x2cd0('0xd'),_0x4264c2,_0x2cd0('0xe'));logger[_0x2cd0('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4264c2,_0x2cd0('0xe'),JSON[_0x2cd0('0x10')](_0x2041ba));if(_0x2041ba['error']){if(_0x2041ba[_0x2cd0('0x11')][_0x2cd0('0x12')]===0x1f4){logger[_0x2cd0('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x4264c2,_0x2041ba['error'][_0x2cd0('0x13')]);return _0x4abc87(_0x2041ba[_0x2cd0('0x11')][_0x2cd0('0x13')]);}logger[_0x2cd0('0x11')](_0x2cd0('0xd'),_0x4264c2,_0x2041ba[_0x2cd0('0x11')]['message']);return _0x9bf382(_0x2041ba[_0x2cd0('0x11')][_0x2cd0('0x13')]);}else{logger[_0x2cd0('0x14')](_0x2cd0('0xd'),_0x4264c2,'request\x20sent');_0x9bf382(_0x2041ba[_0x2cd0('0x15')][_0x2cd0('0x13')]);}})[_0x2cd0('0x16')](function(_0x174da4){logger[_0x2cd0('0x11')](_0x2cd0('0xd'),_0x4264c2,_0x174da4);_0x4abc87(_0x174da4);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 42e0ed0..e2f4d69 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 _0xab53=['INTEGER','sequelize'];(function(_0x538372,_0x53231f){var _0x168679=function(_0xbe1395){while(--_0xbe1395){_0x538372['push'](_0x538372['shift']());}};_0x168679(++_0x53231f);}(_0xab53,0x193));var _0x3ab5=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xab53[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x3ab5('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x3ab5('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1eec=['INTEGER','sequelize'];(function(_0x2eb8c1,_0x2c21ea){var _0x1299de=function(_0x3dfeb8){while(--_0x3dfeb8){_0x2eb8c1['push'](_0x2eb8c1['shift']());}};_0x1299de(++_0x2c21ea);}(_0x1eec,0x157));var _0xc1ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1eec[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xc1ee('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xc1ee('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 507d16a..1662875 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(_0xe11dc6,_0x1f8110){var _0xaf2106=function(_0x4aec73){while(--_0x4aec73){_0xe11dc6['push'](_0xe11dc6['shift']());}};_0xaf2106(++_0x1f8110);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x53649a,_0x5a278d){var _0x1a5c2f=function(_0x5b44db){while(--_0x5b44db){_0x53649a['push'](_0x53649a['shift']());}};_0x1a5c2f(++_0x5a278d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 4d8b379..cbaf324 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x351ebc,_0x341170){var _0x2f0ef3=function(_0x5ea2ff){while(--_0x5ea2ff){_0x351ebc['push'](_0x351ebc['shift']());}};_0x2f0ef3(++_0x341170);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xcb91[_0x65c0bb];return _0x320bd5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x36585e,_0x436e16){var _0x4a1816=function(_0x3cffa2){while(--_0x3cffa2){_0x36585e['push'](_0x36585e['shift']());}};_0x4a1816(++_0x436e16);}(_0x70e0,0x17b));var _0x070e=function(_0x5064d5,_0x1dedb5){_0x5064d5=_0x5064d5-0x0;var _0x1715a5=_0x70e0[_0x5064d5];return _0x1715a5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e4a77e9..71cf18c 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 _0x3cfa=['exports'];(function(_0x57fb7c,_0x5d9c02){var _0xf2dffd=function(_0x1c84bd){while(--_0x1c84bd){_0x57fb7c['push'](_0x57fb7c['shift']());}};_0xf2dffd(++_0x5d9c02);}(_0x3cfa,0x6d));var _0xa3cf=function(_0x56a118,_0x2147ff){_0x56a118=_0x56a118-0x0;var _0x1738c2=_0x3cfa[_0x56a118];return _0x1738c2;};'use strict';var Sequelize=require('sequelize');module[_0xa3cf('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe93b=['exports','INTEGER'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0xe93b,0x1c2));var _0xbe93=function(_0x32c3cc,_0x1cf566){_0x32c3cc=_0x32c3cc-0x0;var _0x3a8c35=_0xe93b[_0x32c3cc];return _0x3a8c35;};'use strict';var Sequelize=require('sequelize');module[_0xbe93('0x0')]={'penalty':{'type':Sequelize[_0xbe93('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0012eea..6835528 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 _0xc0f4=['user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0xc0f4,0xdd));var _0x4c0f=function(_0x1ba72a,_0x38fc48){_0x1ba72a=_0x1ba72a-0x0;var _0x5ca05d=_0xc0f4[_0x1ba72a];return _0x5ca05d;};'use strict';var _=require(_0x4c0f('0x0'));var util=require(_0x4c0f('0x1'));var logger=require(_0x4c0f('0x2'))(_0x4c0f('0x3'));var moment=require('moment');var BPromise=require(_0x4c0f('0x4'));var rp=require(_0x4c0f('0x5'));var fs=require('fs');var path=require(_0x4c0f('0x6'));var rimraf=require('rimraf');var config=require(_0x4c0f('0x7'));var attributes=require(_0x4c0f('0x8'));module[_0x4c0f('0x9')]=function(_0x4008f5,_0x47a921){return _0x4008f5['define']('UserVoiceQueue',attributes,{'tableName':_0x4c0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3004=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x5f445c,_0x42725b){var _0x4b44cf=function(_0x5580fd){while(--_0x5580fd){_0x5f445c['push'](_0x5f445c['shift']());}};_0x4b44cf(++_0x42725b);}(_0x3004,0x1c3));var _0x4300=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3004[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require(_0x4300('0x0'));var logger=require(_0x4300('0x1'))(_0x4300('0x2'));var moment=require('moment');var BPromise=require(_0x4300('0x3'));var rp=require(_0x4300('0x4'));var fs=require('fs');var path=require(_0x4300('0x5'));var rimraf=require(_0x4300('0x6'));var config=require(_0x4300('0x7'));var attributes=require(_0x4300('0x8'));module[_0x4300('0x9')]=function(_0x5f5421,_0x5785b8){return _0x5f5421[_0x4300('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','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 7ec90c9..b2a9966 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 _0x98b5=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x98b5,0x164));var _0x598b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x98b5[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x598b('0x0'));var moment=require(_0x598b('0x1'));var BPromise=require(_0x598b('0x2'));var rs=require(_0x598b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x598b('0x4'));var logger=require('../../config/logger')(_0x598b('0x5'));var config=require(_0x598b('0x6'));var jayson=require(_0x598b('0x7'));var client=jayson[_0x598b('0x8')][_0x598b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44b50d,_0x348018,_0x5a1ed1){return new BPromise(function(_0x50bca5,_0x2fc8b5){return client[_0x598b('0xa')](_0x44b50d,_0x5a1ed1)[_0x598b('0xb')](function(_0x3c3e26){logger[_0x598b('0xc')](_0x598b('0xd'),_0x348018,_0x598b('0xe'));logger['debug'](_0x598b('0xf'),_0x348018,_0x598b('0xe'),JSON['stringify'](_0x3c3e26));if(_0x3c3e26[_0x598b('0x10')]){if(_0x3c3e26[_0x598b('0x10')][_0x598b('0x11')]===0x1f4){logger['error'](_0x598b('0xd'),_0x348018,_0x3c3e26[_0x598b('0x10')][_0x598b('0x12')]);return _0x2fc8b5(_0x3c3e26[_0x598b('0x10')][_0x598b('0x12')]);}logger['error'](_0x598b('0xd'),_0x348018,_0x3c3e26[_0x598b('0x10')]['message']);return _0x50bca5(_0x3c3e26[_0x598b('0x10')][_0x598b('0x12')]);}else{logger['info'](_0x598b('0xd'),_0x348018,_0x598b('0xe'));_0x50bca5(_0x3c3e26['result']['message']);}})[_0x598b('0x13')](function(_0x5ce413){logger[_0x598b('0x10')](_0x598b('0xd'),_0x348018,_0x5ce413);_0x2fc8b5(_0x5ce413);});});} \ No newline at end of file +var _0x8c00=['code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d082d,_0x155828){var _0xcd82e9=function(_0x44a203){while(--_0x44a203){_0x4d082d['push'](_0x4d082d['shift']());}};_0xcd82e9(++_0x155828);}(_0x8c00,0x17e));var _0x08c0=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x8c00[_0xfb65aa];return _0x2aee31;};'use strict';var _=require('lodash');var util=require(_0x08c0('0x0'));var moment=require(_0x08c0('0x1'));var BPromise=require(_0x08c0('0x2'));var rs=require(_0x08c0('0x3'));var fs=require('fs');var Redis=require(_0x08c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x08c0('0x5'))(_0x08c0('0x6'));var config=require(_0x08c0('0x7'));var jayson=require(_0x08c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x442835,_0x56e582,_0x35e6d4){return new BPromise(function(_0x5d3e5a,_0x4172f8){return client[_0x08c0('0x9')](_0x442835,_0x35e6d4)[_0x08c0('0xa')](function(_0x29aff5){logger['info'](_0x08c0('0xb'),_0x56e582,_0x08c0('0xc'));logger[_0x08c0('0xd')](_0x08c0('0xe'),_0x56e582,_0x08c0('0xc'),JSON[_0x08c0('0xf')](_0x29aff5));if(_0x29aff5[_0x08c0('0x10')]){if(_0x29aff5[_0x08c0('0x10')][_0x08c0('0x11')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x56e582,_0x29aff5[_0x08c0('0x10')][_0x08c0('0x12')]);return _0x4172f8(_0x29aff5[_0x08c0('0x10')][_0x08c0('0x12')]);}logger[_0x08c0('0x10')](_0x08c0('0xb'),_0x56e582,_0x29aff5[_0x08c0('0x10')][_0x08c0('0x12')]);return _0x5d3e5a(_0x29aff5[_0x08c0('0x10')][_0x08c0('0x12')]);}else{logger[_0x08c0('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x56e582,_0x08c0('0xc'));_0x5d3e5a(_0x29aff5[_0x08c0('0x14')][_0x08c0('0x12')]);}})['catch'](function(_0x53aa6a){logger['error'](_0x08c0('0xb'),_0x56e582,_0x53aa6a);_0x4172f8(_0x53aa6a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 02e97b0..eace1b2 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3674e9,_0x4aa997){var _0x46fa11=function(_0xc953ca){while(--_0xc953ca){_0x3674e9['push'](_0x3674e9['shift']());}};_0x46fa11(++_0x4aa997);}(_0xe706,0xa3));var _0x6e70=function(_0x23d2a0,_0x516174){_0x23d2a0=_0x23d2a0-0x0;var _0x409e80=_0xe706[_0x23d2a0];return _0x409e80;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3ee4c9,_0xe764b1){var _0x4669ca=function(_0x21112a){while(--_0x21112a){_0x3ee4c9['push'](_0x3ee4c9['shift']());}};_0x4669ca(++_0xe764b1);}(_0x70e0,0x17b));var _0x070e=function(_0x19efb0,_0x3b193e){_0x19efb0=_0x19efb0-0x0;var _0x4cbda2=_0x70e0[_0x19efb0];return _0x4cbda2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8c7a76d..164329d 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 _0x5977=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x141b4e,_0x306d07){var _0x44c4a3=function(_0x42c20d){while(--_0x42c20d){_0x141b4e['push'](_0x141b4e['shift']());}};_0x44c4a3(++_0x306d07);}(_0x5977,0xe1));var _0x7597=function(_0x27073f,_0x261ce7){_0x27073f=_0x27073f-0x0;var _0x4eb744=_0x5977[_0x27073f];return _0x4eb744;};'use strict';var Sequelize=require(_0x7597('0x0'));module[_0x7597('0x1')]={'uniqueid':{'type':Sequelize[_0x7597('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7597('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x7597('0x3')},'UserId':{'type':Sequelize[_0x7597('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7597('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x7597('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7597('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x7597('0x4')],'allowNull':![],'unique':_0x7597('0x5'),'comment':_0x7597('0x3')},'penalty':{'type':Sequelize[_0x7597('0x2')](0xb),'defaultValue':0x0,'comment':_0x7597('0x3')},'paused':{'type':Sequelize[_0x7597('0x2')](0xb),'defaultValue':0x0,'comment':_0x7597('0x3')}}; \ No newline at end of file +var _0xa16e=['STRING','queue_interface','INTEGER','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa16e,0x189));var _0xea16=function(_0x57c741,_0x26dcc5){_0x57c741=_0x57c741-0x0;var _0x248821=_0xa16e[_0x57c741];return _0x248821;};'use strict';var Sequelize=require(_0xea16('0x0'));module[_0xea16('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xea16('0x2')},'membername':{'type':Sequelize[_0xea16('0x3')],'allowNull':![],'comment':_0xea16('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xea16('0x3')],'allowNull':![],'unique':_0xea16('0x4'),'comment':_0xea16('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xea16('0x3')],'allowNull':![],'unique':_0xea16('0x4'),'comment':_0xea16('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xea16('0x2')},'paused':{'type':Sequelize[_0xea16('0x5')](0xb),'defaultValue':0x0,'comment':_0xea16('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0007eb4..16743a4 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 _0x6125=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','exports'];(function(_0xdfd303,_0x48c7b6){var _0x57a73a=function(_0x337246){while(--_0x337246){_0xdfd303['push'](_0xdfd303['shift']());}};_0x57a73a(++_0x48c7b6);}(_0x6125,0x88));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5612('0x0'))['db'][_0x5612('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5612('0x2')](0x0);var events={'afterCreate':_0x5612('0x3'),'afterUpdate':'update','afterDestroy':_0x5612('0x4')};function emitEvent(_0x4fd86d){return function(_0x5e9ff2,_0x14ae69,_0x2e3436){UserVoiceQueueRtEvents[_0x5612('0x5')](_0x4fd86d+':'+_0x5e9ff2['id'],_0x5e9ff2);UserVoiceQueueRtEvents['emit'](_0x4fd86d,_0x5e9ff2);_0x2e3436(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5612('0x6')](e,emitEvent(event));}}module[_0x5612('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x18ff=['hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x18ff,0x1a7));var _0xf18f=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x18ff[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xf18f('0x0'))['db'][_0xf18f('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf18f('0x2')](0x0);var events={'afterCreate':_0xf18f('0x3'),'afterUpdate':_0xf18f('0x4'),'afterDestroy':_0xf18f('0x5')};function emitEvent(_0x5f1472){return function(_0x5d3eea,_0x1c7778,_0x3222fb){UserVoiceQueueRtEvents[_0xf18f('0x6')](_0x5f1472+':'+_0x5d3eea['id'],_0x5d3eea);UserVoiceQueueRtEvents[_0xf18f('0x6')](_0x5f1472,_0x5d3eea);_0x3222fb(null);};}for(var e in events){if(events[_0xf18f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf18f('0x8')](e,emitEvent(event));}}module[_0xf18f('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f0ef8af..1f52bb6 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 _0xdeda=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4c42ea,_0x54d3f3){var _0x57d7c5=function(_0x53ed8e){while(--_0x53ed8e){_0x4c42ea['push'](_0x4c42ea['shift']());}};_0x57d7c5(++_0x54d3f3);}(_0xdeda,0x1cd));var _0xaded=function(_0x3f0c12,_0xea4b1d){_0x3f0c12=_0x3f0c12-0x0;var _0x2b90e0=_0xdeda[_0x3f0c12];return _0x2b90e0;};'use strict';var _=require(_0xaded('0x0'));var util=require(_0xaded('0x1'));var logger=require(_0xaded('0x2'))('api');var moment=require(_0xaded('0x3'));var BPromise=require('bluebird');var rp=require(_0xaded('0x4'));var fs=require('fs');var path=require(_0xaded('0x5'));var rimraf=require(_0xaded('0x6'));var config=require(_0xaded('0x7'));var attributes=require(_0xaded('0x8'));module['exports']=function(_0x57bca2,_0x306159){return _0x57bca2[_0xaded('0x9')](_0xaded('0xa'),attributes,{'tableName':_0xaded('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b51=['exports','define','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x4750da,_0x25dd7e){var _0x38cb4d=function(_0x3cd17e){while(--_0x3cd17e){_0x4750da['push'](_0x4750da['shift']());}};_0x38cb4d(++_0x25dd7e);}(_0x7b51,0x92));var _0x17b5=function(_0x3199ea,_0x4d36e5){_0x3199ea=_0x3199ea-0x0;var _0x41abc4=_0x7b51[_0x3199ea];return _0x41abc4;};'use strict';var _=require(_0x17b5('0x0'));var util=require('util');var logger=require(_0x17b5('0x1'))(_0x17b5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x17b5('0x3'));var rimraf=require(_0x17b5('0x4'));var config=require(_0x17b5('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x17b5('0x6')]=function(_0x257e63,_0x5e9288){return _0x257e63[_0x17b5('0x7')]('UserVoiceQueueRt',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 769c8a5..cf57243 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 _0xc220=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x45502d,_0x5ca8b7){var _0x8813c9=function(_0xa53455){while(--_0xa53455){_0x45502d['push'](_0x45502d['shift']());}};_0x8813c9(++_0x5ca8b7);}(_0xc220,0xd8));var _0x0c22=function(_0x5c3781,_0x266c58){_0x5c3781=_0x5c3781-0x0;var _0x50dc13=_0xc220[_0x5c3781];return _0x50dc13;};'use strict';var _=require('lodash');var util=require(_0x0c22('0x0'));var moment=require(_0x0c22('0x1'));var BPromise=require(_0x0c22('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c22('0x3'))['db'];var utils=require(_0x0c22('0x4'));var logger=require(_0x0c22('0x5'))('rpc');var config=require(_0x0c22('0x6'));var jayson=require(_0x0c22('0x7'));var client=jayson['client'][_0x0c22('0x8')]({'port':0x232a});config[_0x0c22('0x9')]=_['defaults'](config[_0x0c22('0x9')],{'host':_0x0c22('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c22('0x9')]));require(_0x0c22('0xb'))['register'](socket);function respondWithRpcPromise(_0x12bd7b,_0x267afb,_0x212845){return new BPromise(function(_0x2437d3,_0x120f09){return client[_0x0c22('0xc')](_0x12bd7b,_0x212845)['then'](function(_0x457100){logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x267afb,_0x0c22('0xf'));logger[_0x0c22('0x10')](_0x0c22('0x11'),_0x267afb,_0x0c22('0xf'),JSON[_0x0c22('0x12')](_0x457100));if(_0x457100['error']){if(_0x457100[_0x0c22('0x13')]['code']===0x1f4){logger[_0x0c22('0x13')](_0x0c22('0xe'),_0x267afb,_0x457100[_0x0c22('0x13')][_0x0c22('0x14')]);return _0x120f09(_0x457100['error']['message']);}logger[_0x0c22('0x13')](_0x0c22('0xe'),_0x267afb,_0x457100[_0x0c22('0x13')][_0x0c22('0x14')]);return _0x2437d3(_0x457100[_0x0c22('0x13')][_0x0c22('0x14')]);}else{logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x267afb,'request\x20sent');_0x2437d3(_0x457100[_0x0c22('0x15')][_0x0c22('0x14')]);}})['catch'](function(_0x3b33f1){logger[_0x0c22('0x13')](_0x0c22('0xe'),_0x267afb,_0x3b33f1);_0x120f09(_0x3b33f1);});});}exports['GetVoiceQueueRtPauses']=function(_0x1e67ca){var _0x2197c0=this;return new Promise(function(_0x544087,_0x31967e){return db[_0x0c22('0x16')][_0x0c22('0x17')]({'raw':_0x1e67ca[_0x0c22('0x18')]?_0x1e67ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e67ca[_0x0c22('0x18')]?_0x1e67ca[_0x0c22('0x18')][_0x0c22('0x19')]||null:null,'attributes':[[db[_0x0c22('0x1a')]['fn'](_0x0c22('0x1b'),db[_0x0c22('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x0c22('0x1c')))),_0x0c22('0x1d')]]})[_0x0c22('0x1e')](function(_0x3a0443){logger['info'](_0x0c22('0x1f'),_0x1e67ca);logger[_0x0c22('0x10')](_0x0c22('0x1f'),_0x1e67ca,JSON[_0x0c22('0x12')](_0x3a0443));_0x544087(_0x3a0443);})[_0x0c22('0x20')](function(_0x478a5a){logger[_0x0c22('0x13')]('GetVoiceQueueRtPauses',_0x478a5a[_0x0c22('0x14')],_0x1e67ca);_0x31967e(_0x2197c0[_0x0c22('0x13')](0x1f4,_0x478a5a[_0x0c22('0x14')]));});});}; \ No newline at end of file +var _0x6006=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','raw','options','where','COUNT','sequelize','literal','outboundQueuePauses','lodash','util'];(function(_0x4e8db9,_0x15ff81){var _0x1fc3be=function(_0x1cc230){while(--_0x1cc230){_0x4e8db9['push'](_0x4e8db9['shift']());}};_0x1fc3be(++_0x15ff81);}(_0x6006,0xc1));var _0x6600=function(_0x162567,_0x320778){_0x162567=_0x162567-0x0;var _0x325239=_0x6006[_0x162567];return _0x325239;};'use strict';var _=require(_0x6600('0x0'));var util=require(_0x6600('0x1'));var moment=require(_0x6600('0x2'));var BPromise=require('bluebird');var rs=require(_0x6600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6600('0x4'))['db'];var utils=require(_0x6600('0x5'));var logger=require(_0x6600('0x6'))(_0x6600('0x7'));var config=require('../../config/environment');var jayson=require(_0x6600('0x8'));var client=jayson[_0x6600('0x9')][_0x6600('0xa')]({'port':0x232a});config[_0x6600('0xb')]=_[_0x6600('0xc')](config[_0x6600('0xb')],{'host':_0x6600('0xd'),'port':0x18eb});var socket=require(_0x6600('0xe'))(new Redis(config[_0x6600('0xb')]));require(_0x6600('0xf'))[_0x6600('0x10')](socket);function respondWithRpcPromise(_0x10c129,_0x35015c,_0x336fb6){return new BPromise(function(_0xf205d4,_0x5ce5b8){return client[_0x6600('0x11')](_0x10c129,_0x336fb6)[_0x6600('0x12')](function(_0x37f351){logger[_0x6600('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x35015c,_0x6600('0x14'));logger[_0x6600('0x15')](_0x6600('0x16'),_0x35015c,_0x6600('0x14'),JSON[_0x6600('0x17')](_0x37f351));if(_0x37f351[_0x6600('0x18')]){if(_0x37f351[_0x6600('0x18')][_0x6600('0x19')]===0x1f4){logger[_0x6600('0x18')](_0x6600('0x1a'),_0x35015c,_0x37f351[_0x6600('0x18')]['message']);return _0x5ce5b8(_0x37f351['error']['message']);}logger[_0x6600('0x18')](_0x6600('0x1a'),_0x35015c,_0x37f351[_0x6600('0x18')][_0x6600('0x1b')]);return _0xf205d4(_0x37f351[_0x6600('0x18')][_0x6600('0x1b')]);}else{logger[_0x6600('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x35015c,'request\x20sent');_0xf205d4(_0x37f351[_0x6600('0x1c')][_0x6600('0x1b')]);}})[_0x6600('0x1d')](function(_0x261b17){logger[_0x6600('0x18')](_0x6600('0x1a'),_0x35015c,_0x261b17);_0x5ce5b8(_0x261b17);});});}exports[_0x6600('0x1e')]=function(_0x39a9a3){var _0x44d3fd=this;return new Promise(function(_0x1224bd,_0xe7574c){return db[_0x6600('0x1f')]['findAll']({'raw':_0x39a9a3['options']?_0x39a9a3['options'][_0x6600('0x20')]===undefined?!![]:![]:!![],'where':_0x39a9a3[_0x6600('0x21')]?_0x39a9a3[_0x6600('0x21')][_0x6600('0x22')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6600('0x23'),db[_0x6600('0x24')]['fn']('IF',db['sequelize'][_0x6600('0x25')]('`paused`\x20=\x201,\x201,\x20null'))),_0x6600('0x26')]]})[_0x6600('0x12')](function(_0x5f3d94){logger['info']('GetVoiceQueueRtPauses',_0x39a9a3);logger['debug'](_0x6600('0x1e'),_0x39a9a3,JSON[_0x6600('0x17')](_0x5f3d94));_0x1224bd(_0x5f3d94);})['catch'](function(_0x51ca47){logger['error'](_0x6600('0x1e'),_0x51ca47[_0x6600('0x1b')],_0x39a9a3);_0xe7574c(_0x44d3fd[_0x6600('0x18')](0x1f4,_0x51ca47[_0x6600('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index fe9e804..c021a79 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 _0x4074=['./userVoiceQueueRt.events','save','remove','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x4074,0xf0));var _0x4407=function(_0x3e8312,_0xe08810){_0x3e8312=_0x3e8312-0x0;var _0x33afc3=_0x4074[_0x3e8312];return _0x33afc3;};'use strict';var UserVoiceQueueRtEvents=require(_0x4407('0x0'));var events=[_0x4407('0x1'),_0x4407('0x2'),'update'];function createListener(_0x1021e6,_0x2a756){return function(_0x14c0bc){_0x2a756[_0x4407('0x3')](_0x1021e6,_0x14c0bc);};}function removeListener(_0x188494,_0x3c9f5c){return function(){UserVoiceQueueRtEvents[_0x4407('0x4')](_0x188494,_0x3c9f5c);};}exports[_0x4407('0x5')]=function(_0x3f085d){for(var _0x35899d=0x0,_0x4933cf=events[_0x4407('0x6')];_0x35899d<_0x4933cf;_0x35899d++){var _0x5f0699=events[_0x35899d];var _0x414f0a=createListener(_0x4407('0x7')+_0x5f0699,_0x3f085d);UserVoiceQueueRtEvents['on'](_0x5f0699,_0x414f0a);}}; \ No newline at end of file +var _0xd6bb=['update','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0xd6bb[_0x7275e9];return _0x17b99d;};'use strict';var UserVoiceQueueRtEvents=require(_0xbd6b('0x0'));var events=['save',_0xbd6b('0x1'),_0xbd6b('0x2')];function createListener(_0x3c0eb7,_0x29f456){return function(_0x426b33){_0x29f456['emit'](_0x3c0eb7,_0x426b33);};}function removeListener(_0x43b80d,_0x1785c7){return function(){UserVoiceQueueRtEvents[_0xbd6b('0x3')](_0x43b80d,_0x1785c7);};}exports['register']=function(_0x256a94){for(var _0x15d0eb=0x0,_0xc309ad=events[_0xbd6b('0x4')];_0x15d0eb<_0xc309ad;_0x15d0eb++){var _0x31cae6=events[_0x15d0eb];var _0x315761=createListener(_0xbd6b('0x5')+_0x31cae6,_0x256a94);UserVoiceQueueRtEvents['on'](_0x31cae6,_0x315761);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3422d4f..5f9d53a 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x57c4ec,_0xfb1ad0){var _0x157f3c=function(_0x283be4){while(--_0x283be4){_0x57c4ec['push'](_0x57c4ec['shift']());}};_0x157f3c(++_0xfb1ad0);}(_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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2cf64e,_0x48e77e){var _0x3174ec=function(_0x26412b){while(--_0x26412b){_0x2cf64e['push'](_0x2cf64e['shift']());}};_0x3174ec(++_0x48e77e);}(_0x70e0,0x17b));var _0x070e=function(_0x182a38,_0x218b62){_0x182a38=_0x182a38-0x0;var _0x2c62dd=_0x70e0[_0x182a38];return _0x2c62dd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a90854a..9cb4e0c 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 _0x678e=['INTEGER','sequelize'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x678e,0x1b1));var _0xe678=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x678e[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xe678('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe678('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea1c=['INTEGER','exports'];(function(_0x2d385b,_0x33ca46){var _0x24c994=function(_0x27324e){while(--_0x27324e){_0x2d385b['push'](_0x2d385b['shift']());}};_0x24c994(++_0x33ca46);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xcea1('0x0')]={'penalty':{'type':Sequelize[_0xcea1('0x1')],'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 614b231..292ec5e 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 _0x605b=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x222ca6,_0x24b060){var _0x10f6dc=function(_0x4fce5b){while(--_0x4fce5b){_0x222ca6['push'](_0x222ca6['shift']());}};_0x10f6dc(++_0x24b060);}(_0x605b,0xe9));var _0xb605=function(_0x284ddf,_0x15451c){_0x284ddf=_0x284ddf-0x0;var _0x1a2e15=_0x605b[_0x284ddf];return _0x1a2e15;};'use strict';var _=require(_0xb605('0x0'));var util=require(_0xb605('0x1'));var logger=require(_0xb605('0x2'))(_0xb605('0x3'));var moment=require(_0xb605('0x4'));var BPromise=require(_0xb605('0x5'));var rp=require(_0xb605('0x6'));var fs=require('fs');var path=require(_0xb605('0x7'));var rimraf=require(_0xb605('0x8'));var config=require(_0xb605('0x9'));var attributes=require(_0xb605('0xa'));module[_0xb605('0xb')]=function(_0x3d4206,_0x5442f0){return _0x3d4206['define'](_0xb605('0xc'),attributes,{'tableName':_0xb605('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8e3=['user_has_whatsapp_queues','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x4433b,_0x1eded1){var _0xffc1da=function(_0x3d1d18){while(--_0x3d1d18){_0x4433b['push'](_0x4433b['shift']());}};_0xffc1da(++_0x1eded1);}(_0xa8e3,0x12d));var _0x3a8e=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0xa8e3[_0x1d2bbb];return _0x38082b;};'use strict';var _=require(_0x3a8e('0x0'));var util=require('util');var logger=require(_0x3a8e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3a8e('0x2'));var rp=require(_0x3a8e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a8e('0x4'));var attributes=require(_0x3a8e('0x5'));module[_0x3a8e('0x6')]=function(_0x545ba2,_0x23b1dd){return _0x545ba2[_0x3a8e('0x7')](_0x3a8e('0x8'),attributes,{'tableName':_0x3a8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c50caff..2a542b6 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 _0x53a2=['message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x305666,_0x42b4d7){var _0x5d3131=function(_0x44754d){while(--_0x44754d){_0x305666['push'](_0x305666['shift']());}};_0x5d3131(++_0x42b4d7);}(_0x53a2,0x9a));var _0x253a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x53a2[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x253a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x253a('0x1'));var fs=require('fs');var Redis=require(_0x253a('0x2'));var db=require(_0x253a('0x3'))['db'];var utils=require(_0x253a('0x4'));var logger=require(_0x253a('0x5'))('rpc');var config=require(_0x253a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x253a('0x7')][_0x253a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20a917,_0x5cc9bd,_0x1c633a){return new BPromise(function(_0x18e7c1,_0x347f3c){return client[_0x253a('0x9')](_0x20a917,_0x1c633a)[_0x253a('0xa')](function(_0x3c8344){logger[_0x253a('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5cc9bd,'request\x20sent');logger[_0x253a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5cc9bd,_0x253a('0xd'),JSON[_0x253a('0xe')](_0x3c8344));if(_0x3c8344[_0x253a('0xf')]){if(_0x3c8344['error']['code']===0x1f4){logger[_0x253a('0xf')](_0x253a('0x10'),_0x5cc9bd,_0x3c8344[_0x253a('0xf')][_0x253a('0x11')]);return _0x347f3c(_0x3c8344[_0x253a('0xf')][_0x253a('0x11')]);}logger[_0x253a('0xf')](_0x253a('0x10'),_0x5cc9bd,_0x3c8344[_0x253a('0xf')]['message']);return _0x18e7c1(_0x3c8344['error'][_0x253a('0x11')]);}else{logger['info'](_0x253a('0x10'),_0x5cc9bd,_0x253a('0xd'));_0x18e7c1(_0x3c8344['result'][_0x253a('0x11')]);}})[_0x253a('0x12')](function(_0x4ba99a){logger[_0x253a('0xf')](_0x253a('0x10'),_0x5cc9bd,_0x4ba99a);_0x347f3c(_0x4ba99a);});});} \ No newline at end of file +var _0x568d=['rpc','../../config/environment','jayson/promise','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0x568d,0x19d));var _0xd568=function(_0x33aefe,_0x371ccd){_0x33aefe=_0x33aefe-0x0;var _0x471d19=_0x568d[_0x33aefe];return _0x471d19;};'use strict';var _=require(_0xd568('0x0'));var util=require(_0xd568('0x1'));var moment=require(_0xd568('0x2'));var BPromise=require(_0xd568('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd568('0x4'));var db=require(_0xd568('0x5'))['db'];var utils=require(_0xd568('0x6'));var logger=require('../../config/logger')(_0xd568('0x7'));var config=require(_0xd568('0x8'));var jayson=require(_0xd568('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9aa1,_0xd34578,_0x381fed){return new BPromise(function(_0x5495f9,_0x5620b9){return client[_0xd568('0xa')](_0x3b9aa1,_0x381fed)[_0xd568('0xb')](function(_0x25566e){logger['info'](_0xd568('0xc'),_0xd34578,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xd34578,_0xd568('0xd'),JSON[_0xd568('0xe')](_0x25566e));if(_0x25566e[_0xd568('0xf')]){if(_0x25566e[_0xd568('0xf')][_0xd568('0x10')]===0x1f4){logger[_0xd568('0xf')](_0xd568('0xc'),_0xd34578,_0x25566e[_0xd568('0xf')]['message']);return _0x5620b9(_0x25566e[_0xd568('0xf')][_0xd568('0x11')]);}logger[_0xd568('0xf')](_0xd568('0xc'),_0xd34578,_0x25566e['error']['message']);return _0x5495f9(_0x25566e[_0xd568('0xf')]['message']);}else{logger[_0xd568('0x12')](_0xd568('0xc'),_0xd34578,_0xd568('0xd'));_0x5495f9(_0x25566e[_0xd568('0x13')][_0xd568('0x11')]);}})['catch'](function(_0x1b52ef){logger['error'](_0xd568('0xc'),_0xd34578,_0x1b52ef);_0x5620b9(_0x1b52ef);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c72db96..528c673 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 _0xa276=['../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x30ce,_0x17b61c){var _0x3114a0=function(_0xef3ce5){while(--_0xef3ce5){_0x30ce['push'](_0x30ce['shift']());}};_0x3114a0(++_0x17b61c);}(_0xa276,0x9a));var _0x6a27=function(_0xaa9c36,_0x4d05e5){_0xaa9c36=_0xaa9c36-0x0;var _0x5373b=_0xa276[_0xaa9c36];return _0x5373b;};'use strict';var multer=require('multer');var util=require(_0x6a27('0x0'));var path=require(_0x6a27('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a27('0x2'));var router=express[_0x6a27('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6a27('0x4'));var interaction=require(_0x6a27('0x5'));var config=require(_0x6a27('0x6'));var controller=require('./variable.controller');router[_0x6a27('0x7')]('/',auth[_0x6a27('0x8')](),controller[_0x6a27('0x9')]);router['get'](_0x6a27('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6a27('0xb')]);router[_0x6a27('0xc')](_0x6a27('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6a27('0xd')](_0x6a27('0xa'),auth[_0x6a27('0x8')](),controller[_0x6a27('0xe')]);module[_0x6a27('0xf')]=router; \ No newline at end of file +var _0xc252=['./variable.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xc252,0x118));var _0x2c25=function(_0xff8c81,_0xd6f787){_0xff8c81=_0xff8c81-0x0;var _0x50f2cf=_0xc252[_0xff8c81];return _0x50f2cf;};'use strict';var multer=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var path=require(_0x2c25('0x2'));var timeout=require(_0x2c25('0x3'));var express=require(_0x2c25('0x4'));var router=express[_0x2c25('0x5')]();var fs_extra=require(_0x2c25('0x6'));var auth=require(_0x2c25('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2c25('0x8'));router['get']('/',auth[_0x2c25('0x9')](),controller[_0x2c25('0xa')]);router[_0x2c25('0xb')](_0x2c25('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2c25('0xd')]('/',auth[_0x2c25('0x9')](),controller[_0x2c25('0xe')]);router[_0x2c25('0xf')](_0x2c25('0xc'),auth[_0x2c25('0x9')](),controller[_0x2c25('0x10')]);router['delete'](_0x2c25('0xc'),auth['isAuthenticated'](),controller[_0x2c25('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 22aeb7b..31f2a8e 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 _0x0bd3=['exports','STRING','sequelize'];(function(_0x568134,_0x1b286d){var _0x4bd132=function(_0x32fa50){while(--_0x32fa50){_0x568134['push'](_0x568134['shift']());}};_0x4bd132(++_0x1b286d);}(_0x0bd3,0x173));var _0x30bd=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x0bd3[_0x4bbe00];return _0x3999d2;};'use strict';var Sequelize=require(_0x30bd('0x0'));module[_0x30bd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x30bd('0x2')]}}; \ No newline at end of file +var _0x1e2a=['name','sequelize','exports'];(function(_0x2e9ec1,_0x12c249){var _0x36dbe3=function(_0x4802be){while(--_0x4802be){_0x2e9ec1['push'](_0x2e9ec1['shift']());}};_0x36dbe3(++_0x12c249);}(_0x1e2a,0x9d));var _0xa1e2=function(_0x118d5d,_0x3dbeda){_0x118d5d=_0x118d5d-0x0;var _0x31003c=_0x1e2a[_0x118d5d];return _0x31003c;};'use strict';var Sequelize=require(_0xa1e2('0x0'));module[_0xa1e2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa1e2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2a7c2b1..1f80cc9 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 _0x9851=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','get','Variables','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','Variable','includeAll','include','findAll','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x9851,0x1a3));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1985('0x0'));var rimraf=require(_0x1985('0x1'));var zipdir=require(_0x1985('0x2'));var jsonpatch=require(_0x1985('0x3'));var rp=require(_0x1985('0x4'));var moment=require(_0x1985('0x5'));var BPromise=require(_0x1985('0x6'));var Mustache=require(_0x1985('0x7'));var util=require(_0x1985('0x8'));var path=require('path');var sox=require(_0x1985('0x9'));var csv=require(_0x1985('0xa'));var ejs=require(_0x1985('0xb'));var fs=require('fs');var fs_extra=require(_0x1985('0xc'));var _=require(_0x1985('0xd'));var squel=require(_0x1985('0xe'));var crypto=require(_0x1985('0xf'));var jsforce=require(_0x1985('0x10'));var deskjs=require(_0x1985('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1985('0x12'));var Redis=require('ioredis');var authService=require(_0x1985('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1985('0x14'));var hardwareService=require(_0x1985('0x15'));var logger=require(_0x1985('0x16'))(_0x1985('0x17'));var utils=require(_0x1985('0x18'));var config=require(_0x1985('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ad955,_0x1957cb){_0x1957cb=_0x1957cb||0xcc;return function(_0x275961){if(_0x275961){return _0x2ad955[_0x1985('0x1a')](_0x1957cb);}return _0x2ad955[_0x1985('0x1b')](_0x1957cb)[_0x1985('0x1c')]();};}function respondWithResult(_0x279bc2,_0x4f96df){_0x4f96df=_0x4f96df||0xc8;return function(_0x533e9e){if(_0x533e9e){return _0x279bc2[_0x1985('0x1b')](_0x4f96df)[_0x1985('0x1d')](_0x533e9e);}};}function respondWithFilteredResult(_0x344673,_0x2a0430){return function(_0x117e7c){if(_0x117e7c){var _0x43257e=typeof _0x2a0430[_0x1985('0x1e')]===_0x1985('0x1f')&&typeof _0x2a0430[_0x1985('0x20')]===_0x1985('0x1f');var _0x72ad49=_0x117e7c[_0x1985('0x21')];var _0x147dc7=_0x43257e?0x0:_0x2a0430['offset'];var _0x583e8e=_0x43257e?_0x117e7c[_0x1985('0x21')]:_0x2a0430['offset']+_0x2a0430[_0x1985('0x20')];var _0x19f5ec;if(_0x583e8e>=_0x72ad49){_0x583e8e=_0x72ad49;_0x19f5ec=0xc8;}else{_0x19f5ec=0xce;}_0x344673['status'](_0x19f5ec);return _0x344673[_0x1985('0x22')]('Content-Range',_0x147dc7+'-'+_0x583e8e+'/'+_0x72ad49)[_0x1985('0x1d')](_0x117e7c);}return null;};}function patchUpdates(_0x490c06){return function(_0x549d33){try{jsonpatch['apply'](_0x549d33,_0x490c06,!![]);}catch(_0x509c1b){return BPromise[_0x1985('0x23')](_0x509c1b);}return _0x549d33[_0x1985('0x24')]();};}function saveUpdates(_0x3ef6a5,_0x593807){return function(_0x5153ad){if(_0x5153ad){return _0x5153ad['update'](_0x3ef6a5)[_0x1985('0x25')](function(_0x58f3fb){return _0x58f3fb;});}return null;};}function removeEntity(_0x18fb1b,_0x18f5d6){return function(_0x4cfd38){if(_0x4cfd38){return _0x4cfd38['destroy']()[_0x1985('0x25')](function(){var _0x13dc97=_0x4cfd38[_0x1985('0x26')]({'plain':!![]});var _0x2cfe02=_0x1985('0x27');return db['UserProfileResource'][_0x1985('0x28')]({'where':{'type':_0x2cfe02,'resourceId':_0x13dc97['id']}})[_0x1985('0x25')](function(){return _0x4cfd38;});})[_0x1985('0x25')](function(){_0x18fb1b[_0x1985('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27df22,_0x26eb9b){return function(_0x5fd7de){if(!_0x5fd7de){_0x27df22[_0x1985('0x1a')](0x194);}return _0x5fd7de;};}function handleError(_0x13d8c9,_0x3eb21b){_0x3eb21b=_0x3eb21b||0x1f4;return function(_0x4b2db7){logger['error'](_0x4b2db7['stack']);if(_0x4b2db7[_0x1985('0x29')]){delete _0x4b2db7['name'];}_0x13d8c9['status'](_0x3eb21b)[_0x1985('0x2a')](_0x4b2db7);};}exports['index']=function(_0x48c531,_0x17430b){var _0x17df7d={},_0x26c464={},_0x80210d={'count':0x0,'rows':[]};var _0x30e8d3=_[_0x1985('0x2b')](db['Variable'][_0x1985('0x2c')],function(_0x2167ee){return{'name':_0x2167ee[_0x1985('0x2d')],'type':_0x2167ee[_0x1985('0x2e')][_0x1985('0x2f')]};});_0x26c464['model']=_[_0x1985('0x2b')](_0x30e8d3,_0x1985('0x29'));_0x26c464[_0x1985('0x30')]=_[_0x1985('0x31')](_0x48c531[_0x1985('0x30')]);_0x26c464[_0x1985('0x32')]=_['intersection'](_0x26c464[_0x1985('0x33')],_0x26c464[_0x1985('0x30')]);_0x17df7d[_0x1985('0x34')]=_[_0x1985('0x35')](_0x26c464[_0x1985('0x33')],qs[_0x1985('0x36')](_0x48c531['query'][_0x1985('0x36')]));_0x17df7d[_0x1985('0x34')]=_0x17df7d[_0x1985('0x34')][_0x1985('0x37')]?_0x17df7d['attributes']:_0x26c464[_0x1985('0x33')];if(!_0x48c531[_0x1985('0x30')][_0x1985('0x38')](_0x1985('0x39'))){_0x17df7d['limit']=qs['limit'](_0x48c531[_0x1985('0x30')]['limit']);_0x17df7d[_0x1985('0x1e')]=qs['offset'](_0x48c531[_0x1985('0x30')][_0x1985('0x1e')]);}_0x17df7d[_0x1985('0x3a')]=qs[_0x1985('0x3b')](_0x48c531[_0x1985('0x30')][_0x1985('0x3b')]);_0x17df7d['where']=qs[_0x1985('0x32')](_['pick'](_0x48c531[_0x1985('0x30')],_0x26c464['filters']),_0x30e8d3);if(_0x48c531[_0x1985('0x30')][_0x1985('0x3c')]){_0x17df7d[_0x1985('0x3d')]=_[_0x1985('0x3e')](_0x17df7d[_0x1985('0x3d')],{'$or':_['map'](_0x30e8d3,function(_0x5f1e5d){if(_0x5f1e5d['type']!=='VIRTUAL'){var _0x376d9f={};_0x376d9f[_0x5f1e5d['name']]={'$like':'%'+_0x48c531[_0x1985('0x30')]['filter']+'%'};return _0x376d9f;}})});}_0x17df7d=_['merge']({},_0x17df7d,_0x48c531[_0x1985('0x3f')]);var _0x217ceb={'where':_0x17df7d[_0x1985('0x3d')]};return db[_0x1985('0x40')][_0x1985('0x21')](_0x217ceb)['then'](function(_0x665e48){_0x80210d[_0x1985('0x21')]=_0x665e48;if(_0x48c531['query'][_0x1985('0x41')]){_0x17df7d[_0x1985('0x42')]=[{'all':!![]}];}return db[_0x1985('0x40')][_0x1985('0x43')](_0x17df7d);})[_0x1985('0x25')](function(_0x37ce51){_0x80210d['rows']=_0x37ce51;return _0x80210d;})[_0x1985('0x25')](respondWithFilteredResult(_0x17430b,_0x17df7d))['catch'](handleError(_0x17430b,null));};exports[_0x1985('0x44')]=function(_0x3750b8,_0x5dc081){var _0x36736d={'raw':!![],'where':{'id':_0x3750b8[_0x1985('0x45')]['id']}},_0x3c30c4={};_0x3c30c4[_0x1985('0x33')]=_[_0x1985('0x31')](db[_0x1985('0x40')][_0x1985('0x2c')]);_0x3c30c4[_0x1985('0x30')]=_['keys'](_0x3750b8[_0x1985('0x30')]);_0x3c30c4['filters']=_[_0x1985('0x35')](_0x3c30c4[_0x1985('0x33')],_0x3c30c4[_0x1985('0x30')]);_0x36736d['attributes']=_[_0x1985('0x35')](_0x3c30c4[_0x1985('0x33')],qs[_0x1985('0x36')](_0x3750b8[_0x1985('0x30')][_0x1985('0x36')]));_0x36736d['attributes']=_0x36736d['attributes'][_0x1985('0x37')]?_0x36736d[_0x1985('0x34')]:_0x3c30c4[_0x1985('0x33')];if(_0x3750b8[_0x1985('0x30')][_0x1985('0x41')]){_0x36736d[_0x1985('0x42')]=[{'all':!![]}];}_0x36736d=_[_0x1985('0x3e')]({},_0x36736d,_0x3750b8[_0x1985('0x3f')]);return db[_0x1985('0x40')]['find'](_0x36736d)['then'](handleEntityNotFound(_0x5dc081,null))['then'](respondWithResult(_0x5dc081,null))[_0x1985('0x46')](handleError(_0x5dc081,null));};exports[_0x1985('0x47')]=function(_0x5923f7,_0x4a4cd8){return db[_0x1985('0x40')][_0x1985('0x47')](_0x5923f7['body'],{})[_0x1985('0x25')](function(_0x13a542){var _0x5f0b72=_0x5923f7[_0x1985('0x48')]['get']({'plain':!![]});if(!_0x5f0b72)throw new Error(_0x1985('0x49'));if(_0x5f0b72[_0x1985('0x4a')]===_0x1985('0x48')){var _0x2a9afb=_0x13a542[_0x1985('0x26')]({'plain':!![]});var _0x5e1bcd=_0x1985('0x27');return db['UserProfileSection'][_0x1985('0x4b')]({'where':{'name':_0x5e1bcd,'userProfileId':_0x5f0b72[_0x1985('0x4c')]},'raw':!![]})['then'](function(_0x4eed89){if(_0x4eed89&&_0x4eed89[_0x1985('0x4d')]===0x0){return db[_0x1985('0x4e')]['create']({'name':_0x2a9afb[_0x1985('0x29')],'resourceId':_0x2a9afb['id'],'type':_0x4eed89['name'],'sectionId':_0x4eed89['id']},{})[_0x1985('0x25')](function(){return _0x13a542;});}else{return _0x13a542;}})[_0x1985('0x46')](function(_0x52b689){logger[_0x1985('0x4f')](_0x1985('0x50'),_0x52b689);throw _0x52b689;});}return _0x13a542;})['then'](respondWithResult(_0x4a4cd8,0xc9))[_0x1985('0x46')](handleError(_0x4a4cd8,null));};exports[_0x1985('0x51')]=function(_0x563bee,_0x4e2e33){if(_0x563bee[_0x1985('0x52')]['id']){delete _0x563bee[_0x1985('0x52')]['id'];}return db['Variable']['find']({'where':{'id':_0x563bee[_0x1985('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e2e33,null))[_0x1985('0x25')](saveUpdates(_0x563bee['body'],null))[_0x1985('0x25')](respondWithResult(_0x4e2e33,null))[_0x1985('0x46')](handleError(_0x4e2e33,null));};exports['destroy']=function(_0x296e84,_0x9d6f70){return db[_0x1985('0x40')][_0x1985('0x4b')]({'where':{'id':_0x296e84[_0x1985('0x45')]['id']}})[_0x1985('0x25')](handleEntityNotFound(_0x9d6f70,null))[_0x1985('0x25')](removeEntity(_0x9d6f70,null))[_0x1985('0x46')](handleError(_0x9d6f70,null));}; \ No newline at end of file +var _0x6819=['find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','length','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0x6819,0x1e7));var _0x9681=function(_0x48b996,_0x2d6330){_0x48b996=_0x48b996-0x0;var _0x74516c=_0x6819[_0x48b996];return _0x74516c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9681('0x0'));var zipdir=require(_0x9681('0x1'));var jsonpatch=require(_0x9681('0x2'));var rp=require('request-promise');var moment=require(_0x9681('0x3'));var BPromise=require(_0x9681('0x4'));var Mustache=require(_0x9681('0x5'));var util=require(_0x9681('0x6'));var path=require(_0x9681('0x7'));var sox=require(_0x9681('0x8'));var csv=require(_0x9681('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9681('0xa'));var _=require(_0x9681('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9681('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9681('0x9'));var querystring=require(_0x9681('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9681('0xe'));var qs=require(_0x9681('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9681('0x10'));var logger=require(_0x9681('0x11'))('api');var utils=require(_0x9681('0x12'));var config=require(_0x9681('0x13'));var licenseUtil=require(_0x9681('0x14'));var db=require(_0x9681('0x15'))['db'];function respondWithStatusCode(_0x50e24d,_0x210f44){_0x210f44=_0x210f44||0xcc;return function(_0x4923a1){if(_0x4923a1){return _0x50e24d['sendStatus'](_0x210f44);}return _0x50e24d[_0x9681('0x16')](_0x210f44)[_0x9681('0x17')]();};}function respondWithResult(_0x9eff5f,_0xe760e2){_0xe760e2=_0xe760e2||0xc8;return function(_0x507044){if(_0x507044){return _0x9eff5f[_0x9681('0x16')](_0xe760e2)['json'](_0x507044);}};}function respondWithFilteredResult(_0x4e2568,_0x2755fe){return function(_0x2fb595){if(_0x2fb595){var _0x4dd1ef=typeof _0x2755fe[_0x9681('0x18')]==='undefined'&&typeof _0x2755fe[_0x9681('0x19')]===_0x9681('0x1a');var _0x466abe=_0x2fb595[_0x9681('0x1b')];var _0x42b747=_0x4dd1ef?0x0:_0x2755fe[_0x9681('0x18')];var _0x3890e6=_0x4dd1ef?_0x2fb595['count']:_0x2755fe[_0x9681('0x18')]+_0x2755fe[_0x9681('0x19')];var _0x54f1be;if(_0x3890e6>=_0x466abe){_0x3890e6=_0x466abe;_0x54f1be=0xc8;}else{_0x54f1be=0xce;}_0x4e2568[_0x9681('0x16')](_0x54f1be);return _0x4e2568[_0x9681('0x1c')](_0x9681('0x1d'),_0x42b747+'-'+_0x3890e6+'/'+_0x466abe)[_0x9681('0x1e')](_0x2fb595);}return null;};}function patchUpdates(_0x33cd46){return function(_0x5698a5){try{jsonpatch['apply'](_0x5698a5,_0x33cd46,!![]);}catch(_0xee1b69){return BPromise[_0x9681('0x1f')](_0xee1b69);}return _0x5698a5[_0x9681('0x20')]();};}function saveUpdates(_0x33a0a5,_0x2c6415){return function(_0x59a87e){if(_0x59a87e){return _0x59a87e[_0x9681('0x21')](_0x33a0a5)[_0x9681('0x22')](function(_0x5c320d){return _0x5c320d;});}return null;};}function removeEntity(_0x356b60,_0x57fad2){return function(_0x9763c3){if(_0x9763c3){return _0x9763c3[_0x9681('0x23')]()[_0x9681('0x22')](function(){var _0x20b408=_0x9763c3['get']({'plain':!![]});var _0x465354=_0x9681('0x24');return db[_0x9681('0x25')]['destroy']({'where':{'type':_0x465354,'resourceId':_0x20b408['id']}})['then'](function(){return _0x9763c3;});})[_0x9681('0x22')](function(){_0x356b60[_0x9681('0x16')](0xcc)[_0x9681('0x17')]();});}};}function handleEntityNotFound(_0x30c07c,_0xdd9702){return function(_0x2db629){if(!_0x2db629){_0x30c07c[_0x9681('0x26')](0x194);}return _0x2db629;};}function handleError(_0xbf4074,_0x538d20){_0x538d20=_0x538d20||0x1f4;return function(_0x2f71d6){logger[_0x9681('0x27')](_0x2f71d6[_0x9681('0x28')]);if(_0x2f71d6[_0x9681('0x29')]){delete _0x2f71d6['name'];}_0xbf4074['status'](_0x538d20)[_0x9681('0x2a')](_0x2f71d6);};}exports[_0x9681('0x2b')]=function(_0xfdd040,_0x986dd5){var _0x7328ea={},_0x51db50={},_0x50d317={'count':0x0,'rows':[]};var _0x365777=_[_0x9681('0x2c')](db[_0x9681('0x2d')][_0x9681('0x2e')],function(_0x1f796e){return{'name':_0x1f796e['fieldName'],'type':_0x1f796e[_0x9681('0x2f')][_0x9681('0x30')]};});_0x51db50['model']=_['map'](_0x365777,_0x9681('0x29'));_0x51db50[_0x9681('0x31')]=_[_0x9681('0x32')](_0xfdd040[_0x9681('0x31')]);_0x51db50[_0x9681('0x33')]=_[_0x9681('0x34')](_0x51db50[_0x9681('0x35')],_0x51db50[_0x9681('0x31')]);_0x7328ea[_0x9681('0x36')]=_[_0x9681('0x34')](_0x51db50[_0x9681('0x35')],qs['fields'](_0xfdd040['query'][_0x9681('0x37')]));_0x7328ea[_0x9681('0x36')]=_0x7328ea[_0x9681('0x36')]['length']?_0x7328ea[_0x9681('0x36')]:_0x51db50['model'];if(!_0xfdd040[_0x9681('0x31')][_0x9681('0x38')](_0x9681('0x39'))){_0x7328ea[_0x9681('0x19')]=qs['limit'](_0xfdd040[_0x9681('0x31')][_0x9681('0x19')]);_0x7328ea[_0x9681('0x18')]=qs[_0x9681('0x18')](_0xfdd040['query'][_0x9681('0x18')]);}_0x7328ea[_0x9681('0x3a')]=qs['sort'](_0xfdd040['query'][_0x9681('0x3b')]);_0x7328ea[_0x9681('0x3c')]=qs[_0x9681('0x33')](_[_0x9681('0x3d')](_0xfdd040[_0x9681('0x31')],_0x51db50[_0x9681('0x33')]),_0x365777);if(_0xfdd040[_0x9681('0x31')][_0x9681('0x3e')]){_0x7328ea['where']=_[_0x9681('0x3f')](_0x7328ea[_0x9681('0x3c')],{'$or':_[_0x9681('0x2c')](_0x365777,function(_0x353611){if(_0x353611[_0x9681('0x2f')]!=='VIRTUAL'){var _0x2e010f={};_0x2e010f[_0x353611[_0x9681('0x29')]]={'$like':'%'+_0xfdd040[_0x9681('0x31')][_0x9681('0x3e')]+'%'};return _0x2e010f;}})});}_0x7328ea=_[_0x9681('0x3f')]({},_0x7328ea,_0xfdd040[_0x9681('0x40')]);var _0xbba31d={'where':_0x7328ea[_0x9681('0x3c')]};return db[_0x9681('0x2d')][_0x9681('0x1b')](_0xbba31d)[_0x9681('0x22')](function(_0x49c77b){_0x50d317[_0x9681('0x1b')]=_0x49c77b;if(_0xfdd040[_0x9681('0x31')][_0x9681('0x41')]){_0x7328ea['include']=[{'all':!![]}];}return db[_0x9681('0x2d')][_0x9681('0x42')](_0x7328ea);})['then'](function(_0x588991){_0x50d317[_0x9681('0x43')]=_0x588991;return _0x50d317;})[_0x9681('0x22')](respondWithFilteredResult(_0x986dd5,_0x7328ea))['catch'](handleError(_0x986dd5,null));};exports[_0x9681('0x44')]=function(_0x1129c0,_0x4eefe7){var _0x3427be={'raw':!![],'where':{'id':_0x1129c0[_0x9681('0x45')]['id']}},_0x31b8ac={};_0x31b8ac[_0x9681('0x35')]=_[_0x9681('0x32')](db['Variable']['rawAttributes']);_0x31b8ac['query']=_[_0x9681('0x32')](_0x1129c0[_0x9681('0x31')]);_0x31b8ac[_0x9681('0x33')]=_[_0x9681('0x34')](_0x31b8ac[_0x9681('0x35')],_0x31b8ac[_0x9681('0x31')]);_0x3427be[_0x9681('0x36')]=_[_0x9681('0x34')](_0x31b8ac[_0x9681('0x35')],qs[_0x9681('0x37')](_0x1129c0[_0x9681('0x31')][_0x9681('0x37')]));_0x3427be[_0x9681('0x36')]=_0x3427be['attributes'][_0x9681('0x46')]?_0x3427be['attributes']:_0x31b8ac[_0x9681('0x35')];if(_0x1129c0[_0x9681('0x31')][_0x9681('0x41')]){_0x3427be[_0x9681('0x47')]=[{'all':!![]}];}_0x3427be=_[_0x9681('0x3f')]({},_0x3427be,_0x1129c0['options']);return db[_0x9681('0x2d')]['find'](_0x3427be)[_0x9681('0x22')](handleEntityNotFound(_0x4eefe7,null))[_0x9681('0x22')](respondWithResult(_0x4eefe7,null))[_0x9681('0x48')](handleError(_0x4eefe7,null));};exports[_0x9681('0x49')]=function(_0x1a2109,_0xa34c11){return db[_0x9681('0x2d')]['create'](_0x1a2109[_0x9681('0x4a')],{})[_0x9681('0x22')](function(_0x2efb63){var _0x1f413c=_0x1a2109['user']['get']({'plain':!![]});if(!_0x1f413c)throw new Error(_0x9681('0x4b'));if(_0x1f413c[_0x9681('0x4c')]==='user'){var _0x5800e2=_0x2efb63[_0x9681('0x4d')]({'plain':!![]});var _0x4f37fd=_0x9681('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x4f37fd,'userProfileId':_0x1f413c[_0x9681('0x4e')]},'raw':!![]})[_0x9681('0x22')](function(_0x3b2e9a){if(_0x3b2e9a&&_0x3b2e9a[_0x9681('0x4f')]===0x0){return db[_0x9681('0x25')][_0x9681('0x49')]({'name':_0x5800e2[_0x9681('0x29')],'resourceId':_0x5800e2['id'],'type':_0x3b2e9a[_0x9681('0x29')],'sectionId':_0x3b2e9a['id']},{})[_0x9681('0x22')](function(){return _0x2efb63;});}else{return _0x2efb63;}})[_0x9681('0x48')](function(_0x595f7b){logger[_0x9681('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x595f7b);throw _0x595f7b;});}return _0x2efb63;})[_0x9681('0x22')](respondWithResult(_0xa34c11,0xc9))[_0x9681('0x48')](handleError(_0xa34c11,null));};exports[_0x9681('0x21')]=function(_0x3c14e8,_0x2817d5){if(_0x3c14e8[_0x9681('0x4a')]['id']){delete _0x3c14e8[_0x9681('0x4a')]['id'];}return db['Variable'][_0x9681('0x50')]({'where':{'id':_0x3c14e8[_0x9681('0x45')]['id']}})[_0x9681('0x22')](handleEntityNotFound(_0x2817d5,null))[_0x9681('0x22')](saveUpdates(_0x3c14e8['body'],null))[_0x9681('0x22')](respondWithResult(_0x2817d5,null))['catch'](handleError(_0x2817d5,null));};exports[_0x9681('0x23')]=function(_0x25d51f,_0x4a16a9){return db['Variable'][_0x9681('0x50')]({'where':{'id':_0x25d51f[_0x9681('0x45')]['id']}})[_0x9681('0x22')](handleEntityNotFound(_0x4a16a9,null))['then'](removeEntity(_0x4a16a9,null))[_0x9681('0x48')](handleError(_0x4a16a9,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index fee0ed9..be4a98f 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 _0xf87d=['define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x552b9f,_0x544356){var _0x23ddef=function(_0x1249b6){while(--_0x1249b6){_0x552b9f['push'](_0x552b9f['shift']());}};_0x23ddef(++_0x544356);}(_0xf87d,0x13b));var _0xdf87=function(_0x4aef3e,_0x206580){_0x4aef3e=_0x4aef3e-0x0;var _0x596883=_0xf87d[_0x4aef3e];return _0x596883;};'use strict';var _=require(_0xdf87('0x0'));var util=require('util');var logger=require(_0xdf87('0x1'))(_0xdf87('0x2'));var moment=require(_0xdf87('0x3'));var BPromise=require(_0xdf87('0x4'));var rp=require(_0xdf87('0x5'));var fs=require('fs');var path=require(_0xdf87('0x6'));var rimraf=require(_0xdf87('0x7'));var config=require(_0xdf87('0x8'));var attributes=require(_0xdf87('0x9'));module['exports']=function(_0x5e3fac,_0x384355){return _0x5e3fac[_0xdf87('0xa')](_0xdf87('0xb'),attributes,{'tableName':_0xdf87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe12f=['bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','api'];(function(_0x417274,_0x5923ef){var _0xa0850a=function(_0x5433f0){while(--_0x5433f0){_0x417274['push'](_0x417274['shift']());}};_0xa0850a(++_0x5923ef);}(_0xe12f,0x99));var _0xfe12=function(_0x5e9e13,_0x2071ee){_0x5e9e13=_0x5e9e13-0x0;var _0x16f62c=_0xe12f[_0x5e9e13];return _0x16f62c;};'use strict';var _=require('lodash');var util=require(_0xfe12('0x0'));var logger=require(_0xfe12('0x1'))(_0xfe12('0x2'));var moment=require('moment');var BPromise=require(_0xfe12('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe12('0x4'));var rimraf=require(_0xfe12('0x5'));var config=require(_0xfe12('0x6'));var attributes=require(_0xfe12('0x7'));module[_0xfe12('0x8')]=function(_0x180364,_0x15bc57){return _0x180364[_0xfe12('0x9')](_0xfe12('0xa'),attributes,{'tableName':_0xfe12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 90e4598..ac03f02 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x506238,_0x234094){var _0x5d2654=function(_0x5acda1){while(--_0x5acda1){_0x506238['push'](_0x506238['shift']());}};_0x5d2654(++_0x234094);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x67e3f7,_0x440286){var _0x55d094=function(_0x26e2cb){while(--_0x26e2cb){_0x67e3f7['push'](_0x67e3f7['shift']());}};_0x55d094(++_0x440286);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4b6589b..2831602 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 _0xaf5b=['/pull','pull','/restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x560b95,_0x46ed21){var _0x385938=function(_0x4836dc){while(--_0x4836dc){_0x560b95['push'](_0x560b95['shift']());}};_0x385938(++_0x46ed21);}(_0xaf5b,0x1c5));var _0xbaf5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaf5b[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0xbaf5('0x0'));var router=express[_0xbaf5('0x1')]();var auth=require(_0xbaf5('0x2'));var controller=require(_0xbaf5('0x3'));router[_0xbaf5('0x4')]('/',controller[_0xbaf5('0x5')]);router[_0xbaf5('0x4')](_0xbaf5('0x6'),auth[_0xbaf5('0x7')](),auth[_0xbaf5('0x8')](),controller['fetch']);router[_0xbaf5('0x4')](_0xbaf5('0x9'),auth['isAuthenticated'](),auth[_0xbaf5('0x8')](),controller[_0xbaf5('0xa')]);router[_0xbaf5('0x4')](_0xbaf5('0xb'),auth[_0xbaf5('0x7')](),auth[_0xbaf5('0x8')](),controller[_0xbaf5('0xc')]);router[_0xbaf5('0x4')](_0xbaf5('0xd'),auth['isAuthenticated'](),controller['restart']);router[_0xbaf5('0x4')]('/migrations',controller[_0xbaf5('0xe')]);module[_0xbaf5('0xf')]=router; \ No newline at end of file +var _0x032f=['/fetch','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get','index'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x032f,0x15b));var _0xf032=function(_0xc6c92d,_0x4cde11){_0xc6c92d=_0xc6c92d-0x0;var _0x1e9d46=_0x032f[_0xc6c92d];return _0x1e9d46;};'use strict';var express=require(_0xf032('0x0'));var router=express[_0xf032('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf032('0x2'));router[_0xf032('0x3')]('/',controller[_0xf032('0x4')]);router[_0xf032('0x3')](_0xf032('0x5'),auth[_0xf032('0x6')](),auth[_0xf032('0x7')](),controller['fetch']);router[_0xf032('0x3')]('/reset',auth[_0xf032('0x6')](),auth['canUpdate'](),controller[_0xf032('0x8')]);router[_0xf032('0x3')](_0xf032('0x9'),auth[_0xf032('0x6')](),auth[_0xf032('0x7')](),controller[_0xf032('0xa')]);router[_0xf032('0x3')](_0xf032('0xb'),auth[_0xf032('0x6')](),controller[_0xf032('0xc')]);router[_0xf032('0x3')](_0xf032('0xd'),controller[_0xf032('0xe')]);module[_0xf032('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 6646831..6ddcb58 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 _0xa04e=['migrations','readdirSync','join','server','length','replace','push','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa04e,0x10f));var _0xea04=function(_0x38a426,_0x25094e){_0x38a426=_0x38a426-0x0;var _0xf507e8=_0xa04e[_0x38a426];return _0xf507e8;};'use strict';var Umzug=require(_0xea04('0x0'));var path=require(_0xea04('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xea04('0x2'))(module,_0xea04('0x3'));var compareVersions=require(_0xea04('0x4'));var exec=require(_0xea04('0x5'))[_0xea04('0x6')];var db=require(_0xea04('0x7'))['db'];var config=require(_0xea04('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xea04('0x9'))('update');var git=require(_0xea04('0xa'))(config[_0xea04('0xb')]);exports['index']=function(_0x171462,_0x251535){var _0x30167e={'current':module[_0xea04('0xc')][_0xea04('0x3')],'phonebar':0x2};if(_0x171462[_0xea04('0xd')]&&_0x171462[_0xea04('0xd')][_0xea04('0xe')]){return git[_0xea04('0xf')]()[_0xea04('0x10')](function(_0x119545,_0x3ae39a){_0x30167e[_0xea04('0xe')]=(_0x119545?module[_0xea04('0xc')][_0xea04('0x3')]:_0x3ae39a['latest'])||_0xea04('0x11');return _0x251535['status'](0xc8)[_0xea04('0x12')](_0x30167e);});}else{return _0x251535[_0xea04('0x13')](0xc8)[_0xea04('0x12')](_0x30167e);}};exports['fetch']=function(_0xbe4f56,_0x291418){return git[_0xea04('0xf')]([_0xea04('0x14'),_0xea04('0x15')],function(_0x450de1){if(_0x450de1){logger[_0xea04('0x16')](_0x450de1);return _0x291418['status'](0x1f4)['json'](_0x450de1);}logger[_0xea04('0x17')]('git\x20fetch');return _0x291418[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x18')});});};exports['reset']=function(_0xd6db6a,_0x5f07e9){return git[_0xea04('0x19')]([_0xea04('0x1a'),'FETCH_HEAD'],function(_0x5353b9){if(_0x5353b9){logger[_0xea04('0x16')](_0x5353b9);return _0x5f07e9[_0xea04('0x13')](0x1f4)[_0xea04('0x12')](_0x5353b9);}logger[_0xea04('0x17')](_0xea04('0x1b'));return _0x5f07e9[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x1c')});});};exports['pull']=function(_0x596d25,_0x37f8f2){exec('npm\x20install\x20--production',function(_0xfa655d,_0x3f9c57,_0x5d90c5){logger[_0xea04('0x17')](_0x3f9c57);logger[_0xea04('0x17')](_0x5d90c5);if(_0xfa655d){logger[_0xea04('0x16')](_0xfa655d);return _0x37f8f2[_0xea04('0x13')](0x1f4)['json'](_0xfa655d);}return _0x37f8f2[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0x3f9c57});});};exports[_0xea04('0x1d')]=function(_0x5f0bd7,_0x232f65){return pm2[_0xea04('0x1d')](_0xea04('0x1e'))[_0xea04('0x1f')](function(_0x583b5f){logger[_0xea04('0x17')](_0xea04('0x20'),_0x583b5f);return _0x232f65['status'](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x21')});})[_0xea04('0x22')](function(_0x30ee05){logger[_0xea04('0x16')](_0x30ee05);return _0x232f65[_0xea04('0x13')](0x1f4)['json'](_0x30ee05);});};exports[_0xea04('0x23')]=function(_0x1ac468,_0x183fb8){var _0x351e1a=fs[_0xea04('0x24')](path[_0xea04('0x25')](config[_0xea04('0xb')],_0xea04('0x26'),'migrations'));var _0x31c3=[];for(var _0x126c2e=0x0;_0x126c2e<_0x351e1a[_0xea04('0x27')];_0x126c2e++){var _0x577881=_0x351e1a[_0x126c2e][_0xea04('0x28')]('.js','');if(compareVersions(module[_0xea04('0xc')][_0xea04('0x3')],_0x577881)===-0x1){_0x31c3[_0xea04('0x29')](_0x577881);}}if(_0x31c3['length']){var _0x56bc1b=_0x31c3['sort'](compareVersions);var _0x286a0b=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xea04('0x2a'),'columnName':_0xea04('0x3')},'migrations':{'params':[db[_0xea04('0x2b')]['getQueryInterface'](),db['sequelize'][_0xea04('0x2c')],function(){throw new Error(_0xea04('0x2d'));}],'path':path[_0xea04('0x25')](config[_0xea04('0xb')],_0xea04('0x26'),_0xea04('0x23')),'pattern':/\.js$/}});_0x286a0b['up']({'migrations':_['map'](_0x56bc1b,function(_0x196fd4){return _0x196fd4+'.js';})})['then'](function(){return _0x183fb8[_0xea04('0x13')](0xc8)['json']({'output':_0xea04('0x2e')+module[_0xea04('0xc')][_0xea04('0x3')]+_0xea04('0x2f')+_[_0xea04('0x30')](_0x56bc1b),'migrations':_[_0xea04('0x25')](_0x56bc1b)});})[_0xea04('0x22')](function(_0x17efef){if(_0x17efef instanceof db[_0xea04('0x2b')][_0xea04('0x31')]){return _0x183fb8[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x32')});}else{return _0x183fb8['status'](0x1f4)['json'](_0x17efef);}});}else{return _0x183fb8[_0xea04('0x13')](0xc8)[_0xea04('0x12')]({'output':_0xea04('0x32')});}}; \ No newline at end of file +var _0xd6c8=['FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','length','.js','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','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','version','latest','fetch','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard'];(function(_0x384f44,_0xbaf7b6){var _0x49c3e3=function(_0x54d6c7){while(--_0x54d6c7){_0x384f44['push'](_0x384f44['shift']());}};_0x49c3e3(++_0xbaf7b6);}(_0xd6c8,0x84));var _0x8d6c=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xd6c8[_0x5beda8];return _0x2aa042;};'use strict';var Umzug=require(_0x8d6c('0x0'));var path=require(_0x8d6c('0x1'));var fs=require('fs');var _=require(_0x8d6c('0x2'));var pkginfo=require(_0x8d6c('0x3'))(module,'version');var compareVersions=require(_0x8d6c('0x4'));var exec=require(_0x8d6c('0x5'))[_0x8d6c('0x6')];var db=require(_0x8d6c('0x7'))['db'];var config=require(_0x8d6c('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x8d6c('0x9'))(_0x8d6c('0xa'));var git=require(_0x8d6c('0xb'))(config[_0x8d6c('0xc')]);exports[_0x8d6c('0xd')]=function(_0x33b928,_0x20d4ff){var _0x532289={'current':module['exports'][_0x8d6c('0xe')],'phonebar':0x2};if(_0x33b928['query']&&_0x33b928['query'][_0x8d6c('0xf')]){return git[_0x8d6c('0x10')]()['tags'](function(_0x3a12e4,_0x36f34a){_0x532289[_0x8d6c('0xf')]=(_0x3a12e4?module[_0x8d6c('0x11')][_0x8d6c('0xe')]:_0x36f34a[_0x8d6c('0xf')])||_0x8d6c('0x12');return _0x20d4ff[_0x8d6c('0x13')](0xc8)[_0x8d6c('0x14')](_0x532289);});}else{return _0x20d4ff['status'](0xc8)[_0x8d6c('0x14')](_0x532289);}};exports[_0x8d6c('0x10')]=function(_0xe1a9b0,_0x4759ee){return git[_0x8d6c('0x10')]([_0x8d6c('0x15'),'master'],function(_0xcf51a4){if(_0xcf51a4){logger[_0x8d6c('0x16')](_0xcf51a4);return _0x4759ee['status'](0x1f4)[_0x8d6c('0x14')](_0xcf51a4);}logger['info'](_0x8d6c('0x17'));return _0x4759ee[_0x8d6c('0x13')](0xc8)[_0x8d6c('0x14')]({'output':_0x8d6c('0x18')});});};exports[_0x8d6c('0x19')]=function(_0x1af5ba,_0x4d10b6){return git['reset']([_0x8d6c('0x1a'),_0x8d6c('0x1b')],function(_0x1bd5c2){if(_0x1bd5c2){logger[_0x8d6c('0x16')](_0x1bd5c2);return _0x4d10b6[_0x8d6c('0x13')](0x1f4)[_0x8d6c('0x14')](_0x1bd5c2);}logger[_0x8d6c('0x1c')](_0x8d6c('0x1d'));return _0x4d10b6[_0x8d6c('0x13')](0xc8)[_0x8d6c('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x8d6c('0x1e')]=function(_0x5a0cda,_0x436e3f){exec(_0x8d6c('0x1f'),function(_0x5133ee,_0x17eaf3,_0x1c6fbe){logger['info'](_0x17eaf3);logger[_0x8d6c('0x1c')](_0x1c6fbe);if(_0x5133ee){logger[_0x8d6c('0x16')](_0x5133ee);return _0x436e3f[_0x8d6c('0x13')](0x1f4)[_0x8d6c('0x14')](_0x5133ee);}return _0x436e3f[_0x8d6c('0x13')](0xc8)[_0x8d6c('0x14')]({'output':_0x17eaf3});});};exports['restart']=function(_0x3004ac,_0x534269){return pm2[_0x8d6c('0x20')](_0x8d6c('0x21'))[_0x8d6c('0x22')](function(_0x2ee6ce){logger[_0x8d6c('0x1c')](_0x8d6c('0x23'),_0x2ee6ce);return _0x534269['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x8d6c('0x24')](function(_0x47c9b8){logger['error'](_0x47c9b8);return _0x534269['status'](0x1f4)[_0x8d6c('0x14')](_0x47c9b8);});};exports[_0x8d6c('0x25')]=function(_0x589289,_0x1f3eb2){var _0x3b5aa0=fs[_0x8d6c('0x26')](path[_0x8d6c('0x27')](config[_0x8d6c('0xc')],'server',_0x8d6c('0x25')));var _0x63c70a=[];for(var _0x2ed4c7=0x0;_0x2ed4c7<_0x3b5aa0[_0x8d6c('0x28')];_0x2ed4c7++){var _0x134ca8=_0x3b5aa0[_0x2ed4c7]['replace'](_0x8d6c('0x29'),'');if(compareVersions(module['exports'][_0x8d6c('0xe')],_0x134ca8)===-0x1){_0x63c70a['push'](_0x134ca8);}}if(_0x63c70a[_0x8d6c('0x28')]){var _0x190690=_0x63c70a[_0x8d6c('0x2a')](compareVersions);var _0x1f37c4=new Umzug({'storage':_0x8d6c('0x2b'),'storageOptions':{'model':db[_0x8d6c('0x2c')],'modelName':_0x8d6c('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x8d6c('0x2b')][_0x8d6c('0x2d')](),db[_0x8d6c('0x2b')][_0x8d6c('0x2e')],function(){throw new Error(_0x8d6c('0x2f'));}],'path':path[_0x8d6c('0x27')](config[_0x8d6c('0xc')],'server',_0x8d6c('0x25')),'pattern':/\.js$/}});_0x1f37c4['up']({'migrations':_[_0x8d6c('0x30')](_0x190690,function(_0xcab4fe){return _0xcab4fe+'.js';})})['then'](function(){return _0x1f3eb2[_0x8d6c('0x13')](0xc8)[_0x8d6c('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x8d6c('0x11')][_0x8d6c('0xe')]+_0x8d6c('0x31')+_[_0x8d6c('0x32')](_0x190690),'migrations':_[_0x8d6c('0x27')](_0x190690)});})[_0x8d6c('0x24')](function(_0x39105b){if(_0x39105b instanceof db[_0x8d6c('0x2b')][_0x8d6c('0x33')]){return _0x1f3eb2[_0x8d6c('0x13')](0xc8)[_0x8d6c('0x14')]({'output':_0x8d6c('0x34')});}else{return _0x1f3eb2['status'](0x1f4)[_0x8d6c('0x14')](_0x39105b);}});}else{return _0x1f3eb2[_0x8d6c('0x13')](0xc8)['json']({'output':_0x8d6c('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index aae5aa3..53fea0d 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 _0x71ef=['express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4e6eea,_0xd3018d){var _0x1d5e23=function(_0x2e31e1){while(--_0x2e31e1){_0x4e6eea['push'](_0x4e6eea['shift']());}};_0x1d5e23(++_0xd3018d);}(_0x71ef,0x100));var _0xf71e=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x71ef[_0x384231];return _0x2480bf;};'use strict';var multer=require(_0xf71e('0x0'));var util=require(_0xf71e('0x1'));var path=require(_0xf71e('0x2'));var timeout=require(_0xf71e('0x3'));var express=require(_0xf71e('0x4'));var router=express[_0xf71e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf71e('0x6'));var config=require(_0xf71e('0x7'));var controller=require(_0xf71e('0x8'));router[_0xf71e('0x9')]('/',auth[_0xf71e('0xa')](),controller[_0xf71e('0xb')]);router[_0xf71e('0x9')]('/describe',auth[_0xf71e('0xa')](),controller['describe']);router[_0xf71e('0x9')](_0xf71e('0xc'),auth[_0xf71e('0xa')](),controller[_0xf71e('0xd')]);router[_0xf71e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf71e('0xf')](_0xf71e('0xc'),auth[_0xf71e('0xa')](),controller[_0xf71e('0x10')]);router[_0xf71e('0x11')](_0xf71e('0xc'),auth[_0xf71e('0xa')](),controller[_0xf71e('0x12')]);module[_0xf71e('0x13')]=router; \ No newline at end of file +var _0x7300=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x4ded0c,_0x33d52e){var _0x431cde=function(_0x18cb23){while(--_0x18cb23){_0x4ded0c['push'](_0x4ded0c['shift']());}};_0x431cde(++_0x33d52e);}(_0x7300,0x72));var _0x0730=function(_0x1be43c,_0x25856e){_0x1be43c=_0x1be43c-0x0;var _0x1567bf=_0x7300[_0x1be43c];return _0x1567bf;};'use strict';var multer=require(_0x0730('0x0'));var util=require(_0x0730('0x1'));var path=require('path');var timeout=require(_0x0730('0x2'));var express=require(_0x0730('0x3'));var router=express[_0x0730('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0730('0x5'));var interaction=require(_0x0730('0x6'));var config=require(_0x0730('0x7'));var controller=require(_0x0730('0x8'));router[_0x0730('0x9')]('/',auth[_0x0730('0xa')](),controller[_0x0730('0xb')]);router[_0x0730('0x9')]('/describe',auth[_0x0730('0xa')](),controller[_0x0730('0xc')]);router['get'](_0x0730('0xd'),auth['isAuthenticated'](),controller[_0x0730('0xe')]);router[_0x0730('0xf')]('/',auth[_0x0730('0xa')](),controller[_0x0730('0x10')]);router[_0x0730('0x11')](_0x0730('0xd'),auth[_0x0730('0xa')](),controller[_0x0730('0x12')]);router[_0x0730('0x13')]('/:id',auth[_0x0730('0xa')](),controller[_0x0730('0x14')]);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 07b0208..f9f58f4 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 _0x2272=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2272,0xd8));var _0x2227=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2272[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'type':{'type':Sequelize[_0x2227('0x2')]},'uniqueid':{'type':Sequelize[_0x2227('0x2')]},'calleridnum':{'type':Sequelize[_0x2227('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2227('0x2')]},'interface':{'type':Sequelize[_0x2227('0x2')]},'membername':{'type':Sequelize[_0x2227('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2227('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2227('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2227('0x3')]},'holdtime':{'type':Sequelize[_0x2227('0x4')]},'agentcomplete':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2227('0x4')]},'agentacw':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2227('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2227('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2227('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2227('0x2')]},'connectedlinename':{'type':Sequelize[_0x2227('0x2')]},'language':{'type':Sequelize[_0x2227('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2227('0x2')]},'exten':{'type':Sequelize[_0x2227('0x2')]},'priority':{'type':Sequelize[_0x2227('0x2')]},'destchannel':{'type':Sequelize[_0x2227('0x2')]},'destchannelstate':{'type':Sequelize[_0x2227('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2227('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2227('0x2')]},'destcontext':{'type':Sequelize[_0x2227('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2227('0x2')]},'destuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x2227('0x2')]},'transfer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2227('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2227('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2227('0x2')]},'agententerreason':{'type':Sequelize[_0x2227('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba37=['BOOLEAN','INTEGER','sequelize','STRING','DATE'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xba37,0xb6));var _0x7ba3=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xba37[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x7ba3('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ba3('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7ba3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7ba3('0x1')]},'interface':{'type':Sequelize[_0x7ba3('0x1')]},'membername':{'type':Sequelize[_0x7ba3('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7ba3('0x4')]},'agentacw':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7ba3('0x4')]},'reason':{'type':Sequelize[_0x7ba3('0x1')]},'lastevent':{'type':Sequelize[_0x7ba3('0x1')]},'channel':{'type':Sequelize[_0x7ba3('0x1')]},'channelstate':{'type':Sequelize[_0x7ba3('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7ba3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7ba3('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7ba3('0x1')]},'accountcode':{'type':Sequelize[_0x7ba3('0x1')]},'context':{'type':Sequelize[_0x7ba3('0x1')]},'exten':{'type':Sequelize[_0x7ba3('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7ba3('0x1')]},'destchannelstate':{'type':Sequelize[_0x7ba3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7ba3('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7ba3('0x1')]},'destcalleridname':{'type':Sequelize[_0x7ba3('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7ba3('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7ba3('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7ba3('0x1')]},'destcontext':{'type':Sequelize[_0x7ba3('0x1')]},'destexten':{'type':Sequelize[_0x7ba3('0x1')]},'destpriority':{'type':Sequelize[_0x7ba3('0x1')]},'destuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7ba3('0x1')]},'transfer':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7ba3('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'agententerreason':{'type':Sequelize[_0x7ba3('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index de9b874..cf0fc7c 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 7d00cd4..d83266b 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 _0xdc59=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4f41f4,_0x3c1c9b){var _0x3bb311=function(_0x29fe4e){while(--_0x29fe4e){_0x4f41f4['push'](_0x4f41f4['shift']());}};_0x3bb311(++_0x3c1c9b);}(_0xdc59,0x12c));var _0x9dc5=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xdc59[_0xd09668];return _0x68726;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9dc5('0x3'));var rp=require(_0x9dc5('0x4'));var fs=require('fs');var path=require(_0x9dc5('0x5'));var rimraf=require(_0x9dc5('0x6'));var config=require(_0x9dc5('0x7'));var attributes=require(_0x9dc5('0x8'));module[_0x9dc5('0x9')]=function(_0xf17598,_0x13e31c){return _0xf17598['define'](_0x9dc5('0xa'),attributes,{'tableName':_0x9dc5('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9dc5('0xc'),_0x9dc5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b19=['uniqueid','destuniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x4b19,0x195));var _0x94b1=function(_0x32dd4d,_0x123f37){_0x32dd4d=_0x32dd4d-0x0;var _0x595c55=_0x4b19[_0x32dd4d];return _0x595c55;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x94b1('0xb'),_0x94b1('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 4f3a7bb..c57c82b 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 _0xba16=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x56090c,_0x3a6133){var _0x11b44d=function(_0x1114f2){while(--_0x1114f2){_0x56090c['push'](_0x56090c['shift']());}};_0x11b44d(++_0x3a6133);}(_0xba16,0x1e9));var _0x6ba1=function(_0x24ae03,_0x334660){_0x24ae03=_0x24ae03-0x0;var _0x38a29e=_0xba16[_0x24ae03];return _0x38a29e;};'use strict';var _=require(_0x6ba1('0x0'));var util=require(_0x6ba1('0x1'));var moment=require(_0x6ba1('0x2'));var BPromise=require(_0x6ba1('0x3'));var rs=require(_0x6ba1('0x4'));var fs=require('fs');var Redis=require(_0x6ba1('0x5'));var db=require(_0x6ba1('0x6'))['db'];var utils=require(_0x6ba1('0x7'));var logger=require(_0x6ba1('0x8'))(_0x6ba1('0x9'));var config=require(_0x6ba1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ba1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e72f4,_0x5f5c0b,_0x2f2131){return new BPromise(function(_0x4b7943,_0x2030e9){return client[_0x6ba1('0xc')](_0x1e72f4,_0x2f2131)[_0x6ba1('0xd')](function(_0x27caa9){logger[_0x6ba1('0xe')](_0x6ba1('0xf'),_0x5f5c0b,_0x6ba1('0x10'));logger[_0x6ba1('0x11')](_0x6ba1('0x12'),_0x5f5c0b,_0x6ba1('0x10'),JSON['stringify'](_0x27caa9));if(_0x27caa9['error']){if(_0x27caa9[_0x6ba1('0x13')][_0x6ba1('0x14')]===0x1f4){logger[_0x6ba1('0x13')](_0x6ba1('0xf'),_0x5f5c0b,_0x27caa9[_0x6ba1('0x13')]['message']);return _0x2030e9(_0x27caa9[_0x6ba1('0x13')][_0x6ba1('0x15')]);}logger[_0x6ba1('0x13')](_0x6ba1('0xf'),_0x5f5c0b,_0x27caa9['error']['message']);return _0x4b7943(_0x27caa9[_0x6ba1('0x13')]['message']);}else{logger[_0x6ba1('0xe')](_0x6ba1('0xf'),_0x5f5c0b,_0x6ba1('0x10'));_0x4b7943(_0x27caa9['result'][_0x6ba1('0x15')]);}})[_0x6ba1('0x16')](function(_0x3cda77){logger['error'](_0x6ba1('0xf'),_0x5f5c0b,_0x3cda77);_0x2030e9(_0x3cda77);});});}exports[_0x6ba1('0x17')]=function(_0x11abde){var _0xea2c57=this;return new Promise(function(_0x1c7c1f,_0x10a012){return db[_0x6ba1('0x18')][_0x6ba1('0x19')](_0x11abde['body'],{'raw':_0x11abde[_0x6ba1('0x1a')]?_0x11abde['options'][_0x6ba1('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x286453){logger[_0x6ba1('0xe')](_0x6ba1('0x17'),_0x11abde);logger[_0x6ba1('0x11')](_0x6ba1('0x17'),_0x11abde,JSON[_0x6ba1('0x1c')](_0x286453));_0x1c7c1f(_0x286453);})[_0x6ba1('0x16')](function(_0xada5f8){logger[_0x6ba1('0x13')](_0x6ba1('0x17'),_0xada5f8['message'],_0x11abde);_0x10a012(_0xea2c57['error'](0x1f4,_0xada5f8['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x1c1447){var _0xcd20b8=this;return new Promise(function(_0xdadd33,_0xb1efe7){return db['VoiceAgentReport'][_0x6ba1('0x1d')](_0x1c1447['body'],{'raw':_0x1c1447[_0x6ba1('0x1a')]?_0x1c1447[_0x6ba1('0x1a')][_0x6ba1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1447[_0x6ba1('0x1a')]?_0x1c1447['options']['where']||null:null,'attributes':_0x1c1447['options']?_0x1c1447[_0x6ba1('0x1a')][_0x6ba1('0x1e')]||null:null,'limit':_0x1c1447[_0x6ba1('0x1a')]?_0x1c1447[_0x6ba1('0x1a')][_0x6ba1('0x1f')]||null:null})[_0x6ba1('0xd')](function(_0x4649b9){logger[_0x6ba1('0xe')]('UpdateVoiceAgentReport',_0x1c1447);logger[_0x6ba1('0x11')](_0x6ba1('0x20'),_0x1c1447,JSON[_0x6ba1('0x1c')](_0x4649b9));_0xdadd33(_0x4649b9);})['catch'](function(_0x4c27e5){logger[_0x6ba1('0x13')](_0x6ba1('0x20'),_0x4c27e5[_0x6ba1('0x15')],_0x1c1447);_0xb1efe7(_0xcd20b8[_0x6ba1('0x13')](0x1f4,_0x4c27e5['message']));});});}; \ No newline at end of file +var _0x42f5=['request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','info','debug','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x1ea3b9,_0x3c6b2c){var _0x206d41=function(_0x55ef0c){while(--_0x55ef0c){_0x1ea3b9['push'](_0x1ea3b9['shift']());}};_0x206d41(++_0x3c6b2c);}(_0x42f5,0x10c));var _0x542f=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x42f5[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x542f('0x0'));var util=require(_0x542f('0x1'));var moment=require(_0x542f('0x2'));var BPromise=require(_0x542f('0x3'));var rs=require(_0x542f('0x4'));var fs=require('fs');var Redis=require(_0x542f('0x5'));var db=require(_0x542f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x542f('0x7'))('rpc');var config=require(_0x542f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x542f('0x9')][_0x542f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25e229,_0x4dec49,_0x5b4eda){return new BPromise(function(_0x2939b0,_0x217abe){return client[_0x542f('0xb')](_0x25e229,_0x5b4eda)[_0x542f('0xc')](function(_0x5b601a){logger['info'](_0x542f('0xd'),_0x4dec49,_0x542f('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4dec49,_0x542f('0xe'),JSON[_0x542f('0xf')](_0x5b601a));if(_0x5b601a[_0x542f('0x10')]){if(_0x5b601a[_0x542f('0x10')]['code']===0x1f4){logger[_0x542f('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x4dec49,_0x5b601a['error']['message']);return _0x217abe(_0x5b601a[_0x542f('0x10')][_0x542f('0x11')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x4dec49,_0x5b601a[_0x542f('0x10')][_0x542f('0x11')]);return _0x2939b0(_0x5b601a['error'][_0x542f('0x11')]);}else{logger['info'](_0x542f('0xd'),_0x4dec49,_0x542f('0xe'));_0x2939b0(_0x5b601a[_0x542f('0x12')][_0x542f('0x11')]);}})[_0x542f('0x13')](function(_0xbc7be7){logger[_0x542f('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x4dec49,_0xbc7be7);_0x217abe(_0xbc7be7);});});}exports[_0x542f('0x14')]=function(_0x21976e){var _0x9f99ac=this;return new Promise(function(_0x451c5d,_0x477751){return db[_0x542f('0x15')]['create'](_0x21976e[_0x542f('0x16')],{'raw':_0x21976e[_0x542f('0x17')]?_0x21976e[_0x542f('0x17')][_0x542f('0x18')]===undefined?!![]:![]:!![]})[_0x542f('0xc')](function(_0x5099a1){logger[_0x542f('0x19')](_0x542f('0x14'),_0x21976e);logger[_0x542f('0x1a')](_0x542f('0x14'),_0x21976e,JSON[_0x542f('0xf')](_0x5099a1));_0x451c5d(_0x5099a1);})[_0x542f('0x13')](function(_0x3daf65){logger[_0x542f('0x10')](_0x542f('0x14'),_0x3daf65['message'],_0x21976e);_0x477751(_0x9f99ac['error'](0x1f4,_0x3daf65[_0x542f('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x109f6d){var _0x2cf7b0=this;return new Promise(function(_0x140085,_0x1630aa){return db[_0x542f('0x15')][_0x542f('0x1b')](_0x109f6d['body'],{'raw':_0x109f6d[_0x542f('0x17')]?_0x109f6d[_0x542f('0x17')][_0x542f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109f6d[_0x542f('0x17')]?_0x109f6d['options']['where']||null:null,'attributes':_0x109f6d[_0x542f('0x17')]?_0x109f6d['options'][_0x542f('0x1c')]||null:null,'limit':_0x109f6d[_0x542f('0x17')]?_0x109f6d[_0x542f('0x17')][_0x542f('0x1d')]||null:null})[_0x542f('0xc')](function(_0x1f6dce){logger[_0x542f('0x19')](_0x542f('0x1e'),_0x109f6d);logger[_0x542f('0x1a')](_0x542f('0x1e'),_0x109f6d,JSON['stringify'](_0x1f6dce));_0x140085(_0x1f6dce);})[_0x542f('0x13')](function(_0x4fbffb){logger['error'](_0x542f('0x1e'),_0x4fbffb[_0x542f('0x11')],_0x109f6d);_0x1630aa(_0x2cf7b0[_0x542f('0x10')](0x1f4,_0x4fbffb[_0x542f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0b6f01c..886f268 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 _0x56a4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0xd75a57,_0x4d8223){var _0x4b1560=function(_0x5ca42){while(--_0x5ca42){_0xd75a57['push'](_0xd75a57['shift']());}};_0x4b1560(++_0x4d8223);}(_0x56a4,0x11b));var _0x456a=function(_0xe06071,_0x4eeaa1){_0xe06071=_0xe06071-0x0;var _0x8ad8be=_0x56a4[_0xe06071];return _0x8ad8be;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/describe',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0x8')]('/:id',auth[_0x456a('0xa')](),controller['show']);router[_0x456a('0xc')]('/',auth[_0x456a('0xa')](),controller[_0x456a('0xd')]);router[_0x456a('0xe')](_0x456a('0xf'),auth[_0x456a('0xa')](),controller[_0x456a('0x10')]);router[_0x456a('0x11')](_0x456a('0xf'),auth[_0x456a('0xa')](),controller[_0x456a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa41a=['/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','describe'];(function(_0x1edd7d,_0x216fad){var _0x5c3d4d=function(_0x37ef3e){while(--_0x37ef3e){_0x1edd7d['push'](_0x1edd7d['shift']());}};_0x5c3d4d(++_0x216fad);}(_0xa41a,0x6b));var _0xaa41=function(_0x176be1,_0x6e3e71){_0x176be1=_0x176be1-0x0;var _0x67f92b=_0xa41a[_0x176be1];return _0x67f92b;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/describe',auth[_0xaa41('0xa')](),controller[_0xaa41('0xc')]);router['get'](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xf')]('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller['update']);router[_0xaa41('0x12')](_0xaa41('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa41('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 77f9d11..511cd2a 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 _0x2c91=['dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x22c326,_0x30cde5){var _0x4bcfcd=function(_0x5ac260){while(--_0x5ac260){_0x22c326['push'](_0x22c326['shift']());}};_0x4bcfcd(++_0x30cde5);}(_0x2c91,0x158));var _0x12c9=function(_0x49cd08,_0x5109a6){_0x49cd08=_0x49cd08-0x0;var _0x17c64c=_0x2c91[_0x49cd08];return _0x17c64c;};'use strict';var Sequelize=require(_0x12c9('0x0'));module[_0x12c9('0x1')]={'uniqueid':{'type':Sequelize[_0x12c9('0x2')]},'type':{'type':Sequelize[_0x12c9('0x3')](_0x12c9('0x4'),_0x12c9('0x5'),_0x12c9('0x6'),_0x12c9('0x7'),'outbound-fax',_0x12c9('0x8'))},'tag':{'type':Sequelize[_0x12c9('0x2')]},'accountcode':{'type':Sequelize[_0x12c9('0x2')]},'source':{'type':Sequelize[_0x12c9('0x2')]},'destination':{'type':Sequelize[_0x12c9('0x2')]},'destinationcontext':{'type':Sequelize[_0x12c9('0x2')]},'callerid':{'type':Sequelize[_0x12c9('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x12c9('0x2')]},'lastapplication':{'type':Sequelize[_0x12c9('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x12c9('0x9')]},'systemanswertime':{'type':Sequelize[_0x12c9('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x12c9('0x9')]},'duration':{'type':Sequelize[_0x12c9('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x12c9('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x12c9('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x12c9('0x2')]},'userDisposition':{'type':Sequelize[_0x12c9('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x12c9('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x12c9('0x2')]},'note':{'type':Sequelize[_0x12c9('0x2')]},'prefix':{'type':Sequelize[_0x12c9('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x12c9('0x2')]}}; \ No newline at end of file +var _0xa339=['outbound-fax','STRING','DATE','INTEGER','exports','inbound','internal','inbound-fax'];(function(_0x776d1f,_0x237ddb){var _0x314771=function(_0x4920b4){while(--_0x4920b4){_0x776d1f['push'](_0x776d1f['shift']());}};_0x314771(++_0x237ddb);}(_0xa339,0xac));var _0x9a33=function(_0x53490b,_0x1882fc){_0x53490b=_0x53490b-0x0;var _0x45ec86=_0xa339[_0x53490b];return _0x45ec86;};'use strict';var Sequelize=require('sequelize');module[_0x9a33('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x9a33('0x1'),_0x9a33('0x2'),'outbound',_0x9a33('0x3'),_0x9a33('0x4'),'dialer')},'tag':{'type':Sequelize[_0x9a33('0x5')]},'accountcode':{'type':Sequelize[_0x9a33('0x5')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x9a33('0x5')]},'destinationcontext':{'type':Sequelize[_0x9a33('0x5')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9a33('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x9a33('0x5')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x9a33('0x6')]},'systemanswertime':{'type':Sequelize[_0x9a33('0x6')]},'answertime':{'type':Sequelize[_0x9a33('0x6')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x9a33('0x7')]},'billableseconds':{'type':Sequelize[_0x9a33('0x7')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9a33('0x5')]},'amaflags':{'type':Sequelize[_0x9a33('0x5')]},'userfield':{'type':Sequelize[_0x9a33('0x5')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x9a33('0x5')]},'userThirdDisposition':{'type':Sequelize[_0x9a33('0x5')]},'note':{'type':Sequelize[_0x9a33('0x5')]},'prefix':{'type':Sequelize[_0x9a33('0x5')]},'routeid':{'type':Sequelize[_0x9a33('0x7')]},'sipcallid':{'type':Sequelize[_0x9a33('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2ba4ac6..0adc830 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x2ef3,0xba));var _0x32ef=function(_0x240a7e,_0x168e6e){_0x240a7e=_0x240a7e-0x0;var _0x5e6b9d=_0x2ef3[_0x240a7e];return _0x5e6b9d;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +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(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xadb5,0xad));var _0x5adb=function(_0x1ba3c6,_0x237e00){_0x1ba3c6=_0x1ba3c6-0x0;var _0x597a4c=_0xadb5[_0x1ba3c6];return _0x597a4c;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 36f23fe..f23fb1e 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 _0x09f0=['./voiceCallReport.attributes','exports','VoiceCallReport','report_call','util','moment','bluebird','path','../../config/environment'];(function(_0x598ee8,_0x2faf97){var _0x326800=function(_0x2d01bc){while(--_0x2d01bc){_0x598ee8['push'](_0x598ee8['shift']());}};_0x326800(++_0x2faf97);}(_0x09f0,0x79));var _0x009f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x009f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x009f('0x1'));var BPromise=require(_0x009f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x009f('0x3'));var rimraf=require('rimraf');var config=require(_0x009f('0x4'));var attributes=require(_0x009f('0x5'));module[_0x009f('0x6')]=function(_0x2ff875,_0x46eef7){return _0x2ff875['define'](_0x009f('0x7'),attributes,{'tableName':_0x009f('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ebd=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','report_call','uniqueid'];(function(_0x9c8bf7,_0x1f3655){var _0x586c15=function(_0x371e6c){while(--_0x371e6c){_0x9c8bf7['push'](_0x9c8bf7['shift']());}};_0x586c15(++_0x1f3655);}(_0x0ebd,0x13f));var _0xd0eb=function(_0x3fcd41,_0x209ac4){_0x3fcd41=_0x3fcd41-0x0;var _0x2e2979=_0x0ebd[_0x3fcd41];return _0x2e2979;};'use strict';var _=require(_0xd0eb('0x0'));var util=require(_0xd0eb('0x1'));var logger=require(_0xd0eb('0x2'))('api');var moment=require(_0xd0eb('0x3'));var BPromise=require('bluebird');var rp=require(_0xd0eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0eb('0x5'));var config=require(_0xd0eb('0x6'));var attributes=require(_0xd0eb('0x7'));module[_0xd0eb('0x8')]=function(_0x547b92,_0x6eb38b){return _0x547b92['define']('VoiceCallReport',attributes,{'tableName':_0xd0eb('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd0eb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a4610bc..fbabb35 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 _0xc9eb=['model','map','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include'];(function(_0x3506f0,_0x327849){var _0xe9fe24=function(_0x1f5bf9){while(--_0x1f5bf9){_0x3506f0['push'](_0x3506f0['shift']());}};_0xe9fe24(++_0x327849);}(_0xc9eb,0x1a2));var _0xbc9e=function(_0x1e5083,_0x7284b0){_0x1e5083=_0x1e5083-0x0;var _0x3312ab=_0xc9eb[_0x1e5083];return _0x3312ab;};'use strict';var _=require(_0xbc9e('0x0'));var util=require(_0xbc9e('0x1'));var moment=require(_0xbc9e('0x2'));var BPromise=require(_0xbc9e('0x3'));var rs=require(_0xbc9e('0x4'));var fs=require('fs');var Redis=require(_0xbc9e('0x5'));var db=require(_0xbc9e('0x6'))['db'];var utils=require(_0xbc9e('0x7'));var logger=require(_0xbc9e('0x8'))('rpc');var config=require(_0xbc9e('0x9'));var jayson=require(_0xbc9e('0xa'));var client=jayson['client'][_0xbc9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x295bcb,_0xbdfd84,_0x23cd73){return new BPromise(function(_0x132fdd,_0xfc2b44){return client[_0xbc9e('0xc')](_0x295bcb,_0x23cd73)[_0xbc9e('0xd')](function(_0x252f53){logger[_0xbc9e('0xe')](_0xbc9e('0xf'),_0xbdfd84,_0xbc9e('0x10'));logger['debug'](_0xbc9e('0x11'),_0xbdfd84,_0xbc9e('0x10'),JSON[_0xbc9e('0x12')](_0x252f53));if(_0x252f53['error']){if(_0x252f53[_0xbc9e('0x13')][_0xbc9e('0x14')]===0x1f4){logger['error'](_0xbc9e('0xf'),_0xbdfd84,_0x252f53[_0xbc9e('0x13')]['message']);return _0xfc2b44(_0x252f53['error'][_0xbc9e('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xbdfd84,_0x252f53[_0xbc9e('0x13')][_0xbc9e('0x15')]);return _0x132fdd(_0x252f53[_0xbc9e('0x13')]['message']);}else{logger[_0xbc9e('0xe')](_0xbc9e('0xf'),_0xbdfd84,'request\x20sent');_0x132fdd(_0x252f53[_0xbc9e('0x16')]['message']);}})[_0xbc9e('0x17')](function(_0x2e7540){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xbdfd84,_0x2e7540);_0xfc2b44(_0x2e7540);});});}exports[_0xbc9e('0x18')]=function(_0x5a2623){var _0x472124=this;return new Promise(function(_0x2b323e,_0x2cb01b){return db[_0xbc9e('0x19')][_0xbc9e('0x1a')]({'raw':_0x5a2623['options']?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1d')]||null:null,'attributes':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1e')]||null:null,'limit':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x1f')]||null:null,'include':_0x5a2623[_0xbc9e('0x1b')]?_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x20')]?_['map'](_0x5a2623[_0xbc9e('0x1b')][_0xbc9e('0x20')],function(_0x351726){return{'model':db[_0x351726['model']],'as':_0x351726['as'],'attributes':_0x351726[_0xbc9e('0x1e')],'include':_0x351726[_0xbc9e('0x20')]?_['map'](_0x351726['include'],function(_0x58ad64){return{'model':db[_0x58ad64[_0xbc9e('0x21')]],'as':_0x58ad64['as'],'attributes':_0x58ad64['attributes'],'include':_0x58ad64[_0xbc9e('0x20')]?_[_0xbc9e('0x22')](_0x58ad64[_0xbc9e('0x20')],function(_0x3c86f5){return{'model':db[_0x3c86f5[_0xbc9e('0x21')]],'as':_0x3c86f5['as'],'attributes':_0x3c86f5[_0xbc9e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27112b){logger[_0xbc9e('0xe')](_0xbc9e('0x18'),_0x5a2623);logger[_0xbc9e('0x23')](_0xbc9e('0x18'),_0x5a2623,JSON[_0xbc9e('0x12')](_0x27112b));_0x2b323e(_0x27112b);})[_0xbc9e('0x17')](function(_0x4b485b){logger[_0xbc9e('0x13')](_0xbc9e('0x18'),_0x4b485b[_0xbc9e('0x15')],_0x5a2623);_0x2cb01b(_0x472124[_0xbc9e('0x13')](0x1f4,_0x4b485b[_0xbc9e('0x15')]));});});};exports[_0xbc9e('0x24')]=function(_0x2a077c){var _0x53cbdc=this;return new Promise(function(_0x3c2109,_0x134186){return db[_0xbc9e('0x19')][_0xbc9e('0x25')](_0x2a077c[_0xbc9e('0x26')],{'raw':_0x2a077c[_0xbc9e('0x1b')]?_0x2a077c[_0xbc9e('0x1b')][_0xbc9e('0x1c')]===undefined?!![]:![]:!![]})[_0xbc9e('0xd')](function(_0x5bb619){logger[_0xbc9e('0xe')]('CreateVoiceCallReport',_0x2a077c);logger[_0xbc9e('0x23')]('CreateVoiceCallReport',_0x2a077c,JSON[_0xbc9e('0x12')](_0x5bb619));_0x3c2109(_0x5bb619);})[_0xbc9e('0x17')](function(_0x4a3734){logger['error'](_0xbc9e('0x24'),_0x4a3734[_0xbc9e('0x15')],_0x2a077c);_0x134186(_0x53cbdc[_0xbc9e('0x13')](0x1f4,_0x4a3734[_0xbc9e('0x15')]));});});};exports[_0xbc9e('0x27')]=function(_0x4f3383){var _0x34a104=this;return new Promise(function(_0x203717,_0x48dc80){return db[_0xbc9e('0x19')][_0xbc9e('0x28')](_0x4f3383['body'],{'raw':_0x4f3383[_0xbc9e('0x1b')]?_0x4f3383[_0xbc9e('0x1b')][_0xbc9e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3383[_0xbc9e('0x1b')]?_0x4f3383['options'][_0xbc9e('0x1d')]||null:null,'attributes':_0x4f3383[_0xbc9e('0x1b')]?_0x4f3383[_0xbc9e('0x1b')]['attributes']||null:null,'limit':_0x4f3383['options']?_0x4f3383['options'][_0xbc9e('0x1f')]||null:null})[_0xbc9e('0xd')](function(_0x51c7a0){logger[_0xbc9e('0xe')](_0xbc9e('0x27'),_0x4f3383);logger[_0xbc9e('0x23')](_0xbc9e('0x27'),_0x4f3383,JSON[_0xbc9e('0x12')](_0x51c7a0));_0x203717(_0x51c7a0);})[_0xbc9e('0x17')](function(_0x4aca9f){logger['error']('UpdateVoiceCallReport',_0x4aca9f[_0xbc9e('0x15')],_0x4f3383);_0x48dc80(_0x34a104[_0xbc9e('0x13')](0x1f4,_0x4aca9f[_0xbc9e('0x15')]));});});}; \ No newline at end of file +var _0xfb98=['model','GetVoiceCallReport','create','body','CreateVoiceCallReport','stringify','UpdateVoiceCallReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x3caabc,_0x5a30e0){var _0x1407a6=function(_0x1128b3){while(--_0x1128b3){_0x3caabc['push'](_0x3caabc['shift']());}};_0x1407a6(++_0x5a30e0);}(_0xfb98,0xd5));var _0x8fb9=function(_0x1a74a3,_0x508224){_0x1a74a3=_0x1a74a3-0x0;var _0x245084=_0xfb98[_0x1a74a3];return _0x245084;};'use strict';var _=require('lodash');var util=require(_0x8fb9('0x0'));var moment=require(_0x8fb9('0x1'));var BPromise=require(_0x8fb9('0x2'));var rs=require(_0x8fb9('0x3'));var fs=require('fs');var Redis=require(_0x8fb9('0x4'));var db=require(_0x8fb9('0x5'))['db'];var utils=require(_0x8fb9('0x6'));var logger=require(_0x8fb9('0x7'))(_0x8fb9('0x8'));var config=require(_0x8fb9('0x9'));var jayson=require(_0x8fb9('0xa'));var client=jayson[_0x8fb9('0xb')][_0x8fb9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x318e8c,_0x57b440,_0x4e5457){return new BPromise(function(_0x248700,_0x207bcd){return client[_0x8fb9('0xd')](_0x318e8c,_0x4e5457)[_0x8fb9('0xe')](function(_0x7af428){logger[_0x8fb9('0xf')](_0x8fb9('0x10'),_0x57b440,'request\x20sent');logger[_0x8fb9('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x57b440,_0x8fb9('0x12'),JSON['stringify'](_0x7af428));if(_0x7af428[_0x8fb9('0x13')]){if(_0x7af428[_0x8fb9('0x13')][_0x8fb9('0x14')]===0x1f4){logger['error'](_0x8fb9('0x10'),_0x57b440,_0x7af428[_0x8fb9('0x13')][_0x8fb9('0x15')]);return _0x207bcd(_0x7af428[_0x8fb9('0x13')][_0x8fb9('0x15')]);}logger[_0x8fb9('0x13')](_0x8fb9('0x10'),_0x57b440,_0x7af428[_0x8fb9('0x13')]['message']);return _0x248700(_0x7af428['error']['message']);}else{logger[_0x8fb9('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x57b440,_0x8fb9('0x12'));_0x248700(_0x7af428[_0x8fb9('0x16')][_0x8fb9('0x15')]);}})[_0x8fb9('0x17')](function(_0x26d56f){logger['error'](_0x8fb9('0x10'),_0x57b440,_0x26d56f);_0x207bcd(_0x26d56f);});});}exports['GetVoiceCallReport']=function(_0x1285fa){var _0x51a274=this;return new Promise(function(_0x466d98,_0x9c697d){return db[_0x8fb9('0x18')][_0x8fb9('0x19')]({'raw':_0x1285fa[_0x8fb9('0x1a')]?_0x1285fa[_0x8fb9('0x1a')][_0x8fb9('0x1b')]===undefined?!![]:![]:!![],'where':_0x1285fa[_0x8fb9('0x1a')]?_0x1285fa[_0x8fb9('0x1a')][_0x8fb9('0x1c')]||null:null,'attributes':_0x1285fa[_0x8fb9('0x1a')]?_0x1285fa['options'][_0x8fb9('0x1d')]||null:null,'limit':_0x1285fa[_0x8fb9('0x1a')]?_0x1285fa[_0x8fb9('0x1a')][_0x8fb9('0x1e')]||null:null,'include':_0x1285fa[_0x8fb9('0x1a')]?_0x1285fa[_0x8fb9('0x1a')]['include']?_[_0x8fb9('0x1f')](_0x1285fa['options'][_0x8fb9('0x20')],function(_0x2c6984){return{'model':db[_0x2c6984[_0x8fb9('0x21')]],'as':_0x2c6984['as'],'attributes':_0x2c6984[_0x8fb9('0x1d')],'include':_0x2c6984[_0x8fb9('0x20')]?_['map'](_0x2c6984[_0x8fb9('0x20')],function(_0x1951b2){return{'model':db[_0x1951b2[_0x8fb9('0x21')]],'as':_0x1951b2['as'],'attributes':_0x1951b2[_0x8fb9('0x1d')],'include':_0x1951b2['include']?_['map'](_0x1951b2['include'],function(_0xc78d98){return{'model':db[_0xc78d98[_0x8fb9('0x21')]],'as':_0xc78d98['as'],'attributes':_0xc78d98['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x8b5b34){logger[_0x8fb9('0xf')](_0x8fb9('0x22'),_0x1285fa);logger[_0x8fb9('0x11')](_0x8fb9('0x22'),_0x1285fa,JSON['stringify'](_0x8b5b34));_0x466d98(_0x8b5b34);})[_0x8fb9('0x17')](function(_0x5b2241){logger[_0x8fb9('0x13')](_0x8fb9('0x22'),_0x5b2241[_0x8fb9('0x15')],_0x1285fa);_0x9c697d(_0x51a274[_0x8fb9('0x13')](0x1f4,_0x5b2241[_0x8fb9('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0x8b0e1d){var _0x4dc4b0=this;return new Promise(function(_0x36da6f,_0x224e48){return db[_0x8fb9('0x18')][_0x8fb9('0x23')](_0x8b0e1d[_0x8fb9('0x24')],{'raw':_0x8b0e1d['options']?_0x8b0e1d[_0x8fb9('0x1a')][_0x8fb9('0x1b')]===undefined?!![]:![]:!![]})[_0x8fb9('0xe')](function(_0x32098e){logger[_0x8fb9('0xf')](_0x8fb9('0x25'),_0x8b0e1d);logger[_0x8fb9('0x11')](_0x8fb9('0x25'),_0x8b0e1d,JSON[_0x8fb9('0x26')](_0x32098e));_0x36da6f(_0x32098e);})[_0x8fb9('0x17')](function(_0x5525c3){logger[_0x8fb9('0x13')](_0x8fb9('0x25'),_0x5525c3['message'],_0x8b0e1d);_0x224e48(_0x4dc4b0[_0x8fb9('0x13')](0x1f4,_0x5525c3[_0x8fb9('0x15')]));});});};exports[_0x8fb9('0x27')]=function(_0x2d9910){var _0x40b9ea=this;return new Promise(function(_0x4f0b63,_0x410483){return db[_0x8fb9('0x18')][_0x8fb9('0x28')](_0x2d9910['body'],{'raw':_0x2d9910[_0x8fb9('0x1a')]?_0x2d9910[_0x8fb9('0x1a')][_0x8fb9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d9910['options']?_0x2d9910[_0x8fb9('0x1a')]['where']||null:null,'attributes':_0x2d9910[_0x8fb9('0x1a')]?_0x2d9910['options'][_0x8fb9('0x1d')]||null:null,'limit':_0x2d9910[_0x8fb9('0x1a')]?_0x2d9910[_0x8fb9('0x1a')][_0x8fb9('0x1e')]||null:null})[_0x8fb9('0xe')](function(_0x53d882){logger[_0x8fb9('0xf')]('UpdateVoiceCallReport',_0x2d9910);logger[_0x8fb9('0x11')]('UpdateVoiceCallReport',_0x2d9910,JSON[_0x8fb9('0x26')](_0x53d882));_0x4f0b63(_0x53d882);})[_0x8fb9('0x17')](function(_0x5e77c5){logger[_0x8fb9('0x13')](_0x8fb9('0x27'),_0x5e77c5[_0x8fb9('0x15')],_0x2d9910);_0x410483(_0x40b9ea[_0x8fb9('0x13')](0x1f4,_0x5e77c5[_0x8fb9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9654aa9..1c01f8f 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 _0xca46=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0xa83021,_0x41a4d6){var _0x13ee5b=function(_0x352654){while(--_0x352654){_0xa83021['push'](_0xa83021['shift']());}};_0x13ee5b(++_0x41a4d6);}(_0xca46,0x175));var _0x6ca4=function(_0x668a54,_0x512101){_0x668a54=_0x668a54-0x0;var _0x700b7e=_0xca46[_0x668a54];return _0x700b7e;};'use strict';var multer=require(_0x6ca4('0x0'));var util=require(_0x6ca4('0x1'));var path=require(_0x6ca4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ca4('0x3')]();var fs_extra=require(_0x6ca4('0x4'));var auth=require(_0x6ca4('0x5'));var interaction=require(_0x6ca4('0x6'));var config=require(_0x6ca4('0x7'));var controller=require(_0x6ca4('0x8'));router[_0x6ca4('0x9')]('/',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xb')]);router[_0x6ca4('0x9')]('/:id',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xc')]);router[_0x6ca4('0xd')]('/',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xe')]);router[_0x6ca4('0xf')](_0x6ca4('0x10'),auth[_0x6ca4('0xa')](),controller[_0x6ca4('0x11')]);router[_0x6ca4('0x12')]('/:id',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0x13')]);module[_0x6ca4('0x14')]=router; \ No newline at end of file +var _0x3b39=['isAuthenticated','/:id','show','create','put','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x12402e,_0xb8527){var _0x4ca7d7=function(_0x4f089b){while(--_0x4f089b){_0x12402e['push'](_0x12402e['shift']());}};_0x4ca7d7(++_0xb8527);}(_0x3b39,0x142));var _0x93b3=function(_0x6330a4,_0x31ce3f){_0x6330a4=_0x6330a4-0x0;var _0x3a9b65=_0x3b39[_0x6330a4];return _0x3a9b65;};'use strict';var multer=require(_0x93b3('0x0'));var util=require(_0x93b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x93b3('0x2'));var router=express[_0x93b3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x93b3('0x4'));var interaction=require(_0x93b3('0x5'));var config=require(_0x93b3('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x93b3('0x7')]('/',auth[_0x93b3('0x8')](),controller['index']);router[_0x93b3('0x7')](_0x93b3('0x9'),auth[_0x93b3('0x8')](),controller[_0x93b3('0xa')]);router['post']('/',auth[_0x93b3('0x8')](),controller[_0x93b3('0xb')]);router[_0x93b3('0xc')](_0x93b3('0x9'),auth[_0x93b3('0x8')](),controller['update']);router[_0x93b3('0xd')](_0x93b3('0x9'),auth[_0x93b3('0x8')](),controller['destroy']);module[_0x93b3('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 22bae9d..b1ad78b 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 _0x9e2f=['exports','STRING','name','setDataValue','getDataValue','options','BOOLEAN','sequelize'];(function(_0x3500a0,_0x1f6b04){var _0x1195c3=function(_0x365ab8){while(--_0x365ab8){_0x3500a0['push'](_0x3500a0['shift']());}};_0x1195c3(++_0x1f6b04);}(_0x9e2f,0xb7));var _0xf9e2=function(_0x3318d8,_0x1ecfdb){_0x3318d8=_0x3318d8-0x0;var _0x4bab7f=_0x9e2f[_0x3318d8];return _0x4bab7f;};'use strict';var Sequelize=require(_0xf9e2('0x0'));module[_0xf9e2('0x1')]={'name':{'type':Sequelize[_0xf9e2('0x2')]},'prefix':{'type':Sequelize[_0xf9e2('0x2')],'unique':_0xf9e2('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2c82a4){this[_0xf9e2('0x4')]('options',_0x2c82a4?_0x2c82a4['join'](''):[]);},'get':function(){return this[_0xf9e2('0x5')](_0xf9e2('0x6'))?this[_0xf9e2('0x5')](_0xf9e2('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0xf9e2('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xf9e2('0x2')]},'record':{'type':Sequelize[_0xf9e2('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf9e2('0x2')]}}; \ No newline at end of file +var _0xec34=['STRING','name','options','join','getDataValue','split','BOOLEAN','exports'];(function(_0x42946c,_0x577d97){var _0x5d7687=function(_0x4f7428){while(--_0x4f7428){_0x42946c['push'](_0x42946c['shift']());}};_0x5d7687(++_0x577d97);}(_0xec34,0xe7));var _0x4ec3=function(_0x31ebc9,_0x5aa9d0){_0x31ebc9=_0x31ebc9-0x0;var _0x849066=_0xec34[_0x31ebc9];return _0x849066;};'use strict';var Sequelize=require('sequelize');module[_0x4ec3('0x0')]={'name':{'type':Sequelize[_0x4ec3('0x1')]},'prefix':{'type':Sequelize[_0x4ec3('0x1')],'unique':_0x4ec3('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4ec3('0x1')],'set':function(_0x2fd708){this['setDataValue'](_0x4ec3('0x3'),_0x2fd708?_0x2fd708[_0x4ec3('0x4')](''):[]);},'get':function(){return this[_0x4ec3('0x5')](_0x4ec3('0x3'))?this[_0x4ec3('0x5')](_0x4ec3('0x3'))[_0x4ec3('0x6')](''):[];}},'auth':{'type':Sequelize[_0x4ec3('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x4ec3('0x1')]},'record':{'type':Sequelize[_0x4ec3('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4ec3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 68294af..18f589b 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 _0xb677=['type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','ChanSpies','stack','send','map','VoiceChanSpy','rawAttributes','fieldName'];(function(_0x1c3978,_0x2b9b06){var _0x3f92fb=function(_0x52986e){while(--_0x52986e){_0x1c3978['push'](_0x1c3978['shift']());}};_0x3f92fb(++_0x2b9b06);}(_0xb677,0x119));var _0x7b67=function(_0x1e78fe,_0x1a0475){_0x1e78fe=_0x1e78fe-0x0;var _0x42914f=_0xb677[_0x1e78fe];return _0x42914f;};'use strict';var emlformat=require(_0x7b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b67('0x1'));var jsonpatch=require(_0x7b67('0x2'));var rp=require(_0x7b67('0x3'));var moment=require(_0x7b67('0x4'));var BPromise=require(_0x7b67('0x5'));var Mustache=require(_0x7b67('0x6'));var util=require(_0x7b67('0x7'));var path=require(_0x7b67('0x8'));var sox=require('sox');var csv=require(_0x7b67('0x9'));var ejs=require(_0x7b67('0xa'));var fs=require('fs');var fs_extra=require(_0x7b67('0xb'));var _=require(_0x7b67('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b67('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7b67('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b67('0xf'));var authService=require(_0x7b67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b67('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b67('0x12'))(_0x7b67('0x13'));var utils=require(_0x7b67('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25b402,_0x454df4){_0x454df4=_0x454df4||0xcc;return function(_0x1e17fc){if(_0x1e17fc){return _0x25b402[_0x7b67('0x15')](_0x454df4);}return _0x25b402[_0x7b67('0x16')](_0x454df4)[_0x7b67('0x17')]();};}function respondWithResult(_0x4f15f5,_0x37eb7a){_0x37eb7a=_0x37eb7a||0xc8;return function(_0x473d10){if(_0x473d10){return _0x4f15f5[_0x7b67('0x16')](_0x37eb7a)[_0x7b67('0x18')](_0x473d10);}};}function respondWithFilteredResult(_0x377208,_0x309f1c){return function(_0x1861d1){if(_0x1861d1){var _0xf99987=typeof _0x309f1c['offset']===_0x7b67('0x19')&&typeof _0x309f1c[_0x7b67('0x1a')]===_0x7b67('0x19');var _0x41e23d=_0x1861d1[_0x7b67('0x1b')];var _0x18d9da=_0xf99987?0x0:_0x309f1c['offset'];var _0x33f462=_0xf99987?_0x1861d1[_0x7b67('0x1b')]:_0x309f1c[_0x7b67('0x1c')]+_0x309f1c[_0x7b67('0x1a')];var _0x4732dc;if(_0x33f462>=_0x41e23d){_0x33f462=_0x41e23d;_0x4732dc=0xc8;}else{_0x4732dc=0xce;}_0x377208[_0x7b67('0x16')](_0x4732dc);return _0x377208[_0x7b67('0x1d')](_0x7b67('0x1e'),_0x18d9da+'-'+_0x33f462+'/'+_0x41e23d)[_0x7b67('0x18')](_0x1861d1);}return null;};}function patchUpdates(_0x8f1cbe){return function(_0x5ddb36){try{jsonpatch[_0x7b67('0x1f')](_0x5ddb36,_0x8f1cbe,!![]);}catch(_0x16bc9b){return BPromise['reject'](_0x16bc9b);}return _0x5ddb36['save']();};}function saveUpdates(_0x48cd2e,_0x48944a){return function(_0x44b951){if(_0x44b951){return _0x44b951[_0x7b67('0x20')](_0x48cd2e)[_0x7b67('0x21')](function(_0x3042fe){return _0x3042fe;});}return null;};}function removeEntity(_0x2c3f11,_0x56b952){return function(_0x3b4fea){if(_0x3b4fea){return _0x3b4fea[_0x7b67('0x22')]()[_0x7b67('0x21')](function(){var _0x3f5202=_0x3b4fea[_0x7b67('0x23')]({'plain':!![]});var _0x3e9630=_0x7b67('0x24');return db['UserProfileResource'][_0x7b67('0x22')]({'where':{'type':_0x3e9630,'resourceId':_0x3f5202['id']}})['then'](function(){return _0x3b4fea;});})[_0x7b67('0x21')](function(){_0x2c3f11[_0x7b67('0x16')](0xcc)[_0x7b67('0x17')]();});}};}function handleEntityNotFound(_0x34a88d,_0x5f2a13){return function(_0x3cf152){if(!_0x3cf152){_0x34a88d[_0x7b67('0x15')](0x194);}return _0x3cf152;};}function handleError(_0x37e35f,_0x5c3f44){_0x5c3f44=_0x5c3f44||0x1f4;return function(_0x5e35c9){logger['error'](_0x5e35c9[_0x7b67('0x25')]);if(_0x5e35c9['name']){delete _0x5e35c9['name'];}_0x37e35f[_0x7b67('0x16')](_0x5c3f44)[_0x7b67('0x26')](_0x5e35c9);};}exports['index']=function(_0x2fe0c5,_0x5ee04b){var _0x4815ab={},_0x196f96={},_0x1caf69={'count':0x0,'rows':[]};var _0x3345af=_[_0x7b67('0x27')](db[_0x7b67('0x28')][_0x7b67('0x29')],function(_0x7af5fe){return{'name':_0x7af5fe[_0x7b67('0x2a')],'type':_0x7af5fe[_0x7b67('0x2b')][_0x7b67('0x2c')]};});_0x196f96[_0x7b67('0x2d')]=_[_0x7b67('0x27')](_0x3345af,_0x7b67('0x2e'));_0x196f96[_0x7b67('0x2f')]=_[_0x7b67('0x30')](_0x2fe0c5[_0x7b67('0x2f')]);_0x196f96[_0x7b67('0x31')]=_['intersection'](_0x196f96[_0x7b67('0x2d')],_0x196f96[_0x7b67('0x2f')]);_0x4815ab['attributes']=_[_0x7b67('0x32')](_0x196f96[_0x7b67('0x2d')],qs[_0x7b67('0x33')](_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x33')]));_0x4815ab[_0x7b67('0x34')]=_0x4815ab[_0x7b67('0x34')][_0x7b67('0x35')]?_0x4815ab[_0x7b67('0x34')]:_0x196f96[_0x7b67('0x2d')];if(!_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x36')](_0x7b67('0x37'))){_0x4815ab['limit']=qs[_0x7b67('0x1a')](_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x1a')]);_0x4815ab[_0x7b67('0x1c')]=qs['offset'](_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x1c')]);}_0x4815ab[_0x7b67('0x38')]=qs[_0x7b67('0x39')](_0x2fe0c5[_0x7b67('0x2f')]['sort']);_0x4815ab[_0x7b67('0x3a')]=qs[_0x7b67('0x31')](_[_0x7b67('0x3b')](_0x2fe0c5[_0x7b67('0x2f')],_0x196f96[_0x7b67('0x31')]),_0x3345af);if(_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x3c')]){_0x4815ab[_0x7b67('0x3a')]=_[_0x7b67('0x3d')](_0x4815ab[_0x7b67('0x3a')],{'$or':_[_0x7b67('0x27')](_0x3345af,function(_0x2e2888){if(_0x2e2888[_0x7b67('0x2b')]!==_0x7b67('0x3e')){var _0x28a278={};_0x28a278[_0x2e2888['name']]={'$like':'%'+_0x2fe0c5[_0x7b67('0x2f')][_0x7b67('0x3c')]+'%'};return _0x28a278;}})});}_0x4815ab=_[_0x7b67('0x3d')]({},_0x4815ab,_0x2fe0c5[_0x7b67('0x3f')]);var _0x317815={'where':_0x4815ab[_0x7b67('0x3a')]};return db['VoiceChanSpy']['count'](_0x317815)[_0x7b67('0x21')](function(_0x16d60a){_0x1caf69['count']=_0x16d60a;if(_0x2fe0c5['query'][_0x7b67('0x40')]){_0x4815ab[_0x7b67('0x41')]=[{'all':!![]}];}return db[_0x7b67('0x28')][_0x7b67('0x42')](_0x4815ab);})[_0x7b67('0x21')](function(_0x46629b){_0x1caf69['rows']=_0x46629b;return _0x1caf69;})[_0x7b67('0x21')](respondWithFilteredResult(_0x5ee04b,_0x4815ab))[_0x7b67('0x43')](handleError(_0x5ee04b,null));};exports[_0x7b67('0x44')]=function(_0x36615f,_0x5dcdd7){var _0x251a3c={'raw':![],'where':{'id':_0x36615f[_0x7b67('0x45')]['id']}},_0x40ba75={};_0x40ba75['model']=_['keys'](db[_0x7b67('0x28')]['rawAttributes']);_0x40ba75[_0x7b67('0x2f')]=_['keys'](_0x36615f['query']);_0x40ba75[_0x7b67('0x31')]=_['intersection'](_0x40ba75[_0x7b67('0x2d')],_0x40ba75['query']);_0x251a3c[_0x7b67('0x34')]=_[_0x7b67('0x32')](_0x40ba75['model'],qs[_0x7b67('0x33')](_0x36615f[_0x7b67('0x2f')][_0x7b67('0x33')]));_0x251a3c[_0x7b67('0x34')]=_0x251a3c[_0x7b67('0x34')][_0x7b67('0x35')]?_0x251a3c[_0x7b67('0x34')]:_0x40ba75[_0x7b67('0x2d')];if(_0x36615f[_0x7b67('0x2f')][_0x7b67('0x40')]){_0x251a3c[_0x7b67('0x41')]=[{'all':!![]}];}_0x251a3c=_[_0x7b67('0x3d')]({},_0x251a3c,_0x36615f[_0x7b67('0x3f')]);return db[_0x7b67('0x28')]['find'](_0x251a3c)[_0x7b67('0x21')](handleEntityNotFound(_0x5dcdd7,null))[_0x7b67('0x21')](respondWithResult(_0x5dcdd7,null))['catch'](handleError(_0x5dcdd7,null));};exports[_0x7b67('0x46')]=function(_0x4a96c5,_0x1c80e9){return db[_0x7b67('0x28')][_0x7b67('0x46')](_0x4a96c5[_0x7b67('0x47')],{})['then'](function(_0x385c6e){var _0x4c3d7f=_0x4a96c5[_0x7b67('0x48')]['get']({'plain':!![]});if(!_0x4c3d7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c3d7f[_0x7b67('0x49')]===_0x7b67('0x48')){var _0x5b3560=_0x385c6e['get']({'plain':!![]});var _0x3d35c3=_0x7b67('0x24');return db[_0x7b67('0x4a')][_0x7b67('0x4b')]({'where':{'name':_0x3d35c3,'userProfileId':_0x4c3d7f[_0x7b67('0x4c')]},'raw':!![]})['then'](function(_0xdad2b5){if(_0xdad2b5&&_0xdad2b5[_0x7b67('0x4d')]===0x0){return db[_0x7b67('0x4e')][_0x7b67('0x46')]({'name':_0x5b3560['name'],'resourceId':_0x5b3560['id'],'type':_0xdad2b5[_0x7b67('0x2e')],'sectionId':_0xdad2b5['id']},{})['then'](function(){return _0x385c6e;});}else{return _0x385c6e;}})[_0x7b67('0x43')](function(_0x1ea2b5){logger[_0x7b67('0x4f')](_0x7b67('0x50'),_0x1ea2b5);throw _0x1ea2b5;});}return _0x385c6e;})[_0x7b67('0x21')](respondWithResult(_0x1c80e9,0xc9))[_0x7b67('0x43')](handleError(_0x1c80e9,null));};exports[_0x7b67('0x20')]=function(_0x2023da,_0x56d18d){if(_0x2023da['body']['id']){delete _0x2023da['body']['id'];}return db['VoiceChanSpy'][_0x7b67('0x4b')]({'where':{'id':_0x2023da[_0x7b67('0x45')]['id']}})[_0x7b67('0x21')](handleEntityNotFound(_0x56d18d,null))[_0x7b67('0x21')](saveUpdates(_0x2023da[_0x7b67('0x47')],null))['then'](respondWithResult(_0x56d18d,null))[_0x7b67('0x43')](handleError(_0x56d18d,null));};exports['destroy']=function(_0x11313a,_0xe0cb78){return db[_0x7b67('0x28')][_0x7b67('0x4b')]({'where':{'id':_0x11313a[_0x7b67('0x45')]['id']}})['then'](handleEntityNotFound(_0xe0cb78,null))[_0x7b67('0x21')](removeEntity(_0xe0cb78,null))[_0x7b67('0x43')](handleError(_0xe0cb78,null));}; \ No newline at end of file +var _0xc831=['filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','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','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','rawAttributes','type','key','model','keys','query'];(function(_0x292a96,_0x2a82d5){var _0x52fc11=function(_0x23f634){while(--_0x23f634){_0x292a96['push'](_0x292a96['shift']());}};_0x52fc11(++_0x2a82d5);}(_0xc831,0x103));var _0x1c83=function(_0x5bb22f,_0x42faf5){_0x5bb22f=_0x5bb22f-0x0;var _0x2ad947=_0xc831[_0x5bb22f];return _0x2ad947;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];function respondWithStatusCode(_0x276377,_0x3128ec){_0x3128ec=_0x3128ec||0xcc;return function(_0x20a59f){if(_0x20a59f){return _0x276377[_0x1c83('0x17')](_0x3128ec);}return _0x276377[_0x1c83('0x18')](_0x3128ec)[_0x1c83('0x19')]();};}function respondWithResult(_0x5d5742,_0x43f74e){_0x43f74e=_0x43f74e||0xc8;return function(_0x1be133){if(_0x1be133){return _0x5d5742[_0x1c83('0x18')](_0x43f74e)[_0x1c83('0x1a')](_0x1be133);}};}function respondWithFilteredResult(_0x37ba9b,_0x4e1620){return function(_0x11acf1){if(_0x11acf1){var _0x18a06d=typeof _0x4e1620[_0x1c83('0x1b')]===_0x1c83('0x1c')&&typeof _0x4e1620['limit']===_0x1c83('0x1c');var _0x4a5025=_0x11acf1['count'];var _0x3b3369=_0x18a06d?0x0:_0x4e1620[_0x1c83('0x1b')];var _0x2ec743=_0x18a06d?_0x11acf1[_0x1c83('0x1d')]:_0x4e1620['offset']+_0x4e1620[_0x1c83('0x1e')];var _0x5642aa;if(_0x2ec743>=_0x4a5025){_0x2ec743=_0x4a5025;_0x5642aa=0xc8;}else{_0x5642aa=0xce;}_0x37ba9b[_0x1c83('0x18')](_0x5642aa);return _0x37ba9b[_0x1c83('0x1f')]('Content-Range',_0x3b3369+'-'+_0x2ec743+'/'+_0x4a5025)[_0x1c83('0x1a')](_0x11acf1);}return null;};}function patchUpdates(_0x1b5a71){return function(_0x5aa566){try{jsonpatch['apply'](_0x5aa566,_0x1b5a71,!![]);}catch(_0x4cd6bb){return BPromise['reject'](_0x4cd6bb);}return _0x5aa566['save']();};}function saveUpdates(_0x19abb8,_0x3e216d){return function(_0x5daab4){if(_0x5daab4){return _0x5daab4['update'](_0x19abb8)[_0x1c83('0x20')](function(_0x3c8123){return _0x3c8123;});}return null;};}function removeEntity(_0x2d041f,_0x58a7d5){return function(_0xb21f06){if(_0xb21f06){return _0xb21f06['destroy']()[_0x1c83('0x20')](function(){var _0x2b93f7=_0xb21f06[_0x1c83('0x21')]({'plain':!![]});var _0x1096ed=_0x1c83('0x22');return db[_0x1c83('0x23')][_0x1c83('0x24')]({'where':{'type':_0x1096ed,'resourceId':_0x2b93f7['id']}})[_0x1c83('0x20')](function(){return _0xb21f06;});})[_0x1c83('0x20')](function(){_0x2d041f['status'](0xcc)[_0x1c83('0x19')]();});}};}function handleEntityNotFound(_0x5c4e3c,_0x354cdf){return function(_0x4ef78a){if(!_0x4ef78a){_0x5c4e3c[_0x1c83('0x17')](0x194);}return _0x4ef78a;};}function handleError(_0x3a00e0,_0x46ff26){_0x46ff26=_0x46ff26||0x1f4;return function(_0x341d8d){logger[_0x1c83('0x25')](_0x341d8d[_0x1c83('0x26')]);if(_0x341d8d[_0x1c83('0x27')]){delete _0x341d8d[_0x1c83('0x27')];}_0x3a00e0[_0x1c83('0x18')](_0x46ff26)['send'](_0x341d8d);};}exports[_0x1c83('0x28')]=function(_0x56cd77,_0x4af140){var _0x3e9814={},_0x23210c={},_0x39f492={'count':0x0,'rows':[]};var _0x15bc67=_[_0x1c83('0x29')](db[_0x1c83('0x2a')][_0x1c83('0x2b')],function(_0x1499db){return{'name':_0x1499db['fieldName'],'type':_0x1499db[_0x1c83('0x2c')][_0x1c83('0x2d')]};});_0x23210c[_0x1c83('0x2e')]=_[_0x1c83('0x29')](_0x15bc67,_0x1c83('0x27'));_0x23210c['query']=_[_0x1c83('0x2f')](_0x56cd77[_0x1c83('0x30')]);_0x23210c[_0x1c83('0x31')]=_['intersection'](_0x23210c[_0x1c83('0x2e')],_0x23210c[_0x1c83('0x30')]);_0x3e9814[_0x1c83('0x32')]=_[_0x1c83('0x33')](_0x23210c[_0x1c83('0x2e')],qs[_0x1c83('0x34')](_0x56cd77[_0x1c83('0x30')][_0x1c83('0x34')]));_0x3e9814[_0x1c83('0x32')]=_0x3e9814['attributes'][_0x1c83('0x35')]?_0x3e9814[_0x1c83('0x32')]:_0x23210c[_0x1c83('0x2e')];if(!_0x56cd77[_0x1c83('0x30')][_0x1c83('0x36')]('nolimit')){_0x3e9814['limit']=qs['limit'](_0x56cd77[_0x1c83('0x30')]['limit']);_0x3e9814[_0x1c83('0x1b')]=qs[_0x1c83('0x1b')](_0x56cd77[_0x1c83('0x30')][_0x1c83('0x1b')]);}_0x3e9814[_0x1c83('0x37')]=qs['sort'](_0x56cd77['query']['sort']);_0x3e9814[_0x1c83('0x38')]=qs[_0x1c83('0x31')](_[_0x1c83('0x39')](_0x56cd77[_0x1c83('0x30')],_0x23210c[_0x1c83('0x31')]),_0x15bc67);if(_0x56cd77[_0x1c83('0x30')][_0x1c83('0x3a')]){_0x3e9814['where']=_['merge'](_0x3e9814[_0x1c83('0x38')],{'$or':_[_0x1c83('0x29')](_0x15bc67,function(_0x39f836){if(_0x39f836[_0x1c83('0x2c')]!==_0x1c83('0x3b')){var _0x3b3d2f={};_0x3b3d2f[_0x39f836[_0x1c83('0x27')]]={'$like':'%'+_0x56cd77['query'][_0x1c83('0x3a')]+'%'};return _0x3b3d2f;}})});}_0x3e9814=_[_0x1c83('0x3c')]({},_0x3e9814,_0x56cd77[_0x1c83('0x3d')]);var _0x15827a={'where':_0x3e9814[_0x1c83('0x38')]};return db[_0x1c83('0x2a')][_0x1c83('0x1d')](_0x15827a)[_0x1c83('0x20')](function(_0xd9c16c){_0x39f492[_0x1c83('0x1d')]=_0xd9c16c;if(_0x56cd77[_0x1c83('0x30')][_0x1c83('0x3e')]){_0x3e9814[_0x1c83('0x3f')]=[{'all':!![]}];}return db[_0x1c83('0x2a')]['findAll'](_0x3e9814);})[_0x1c83('0x20')](function(_0x124d55){_0x39f492['rows']=_0x124d55;return _0x39f492;})[_0x1c83('0x20')](respondWithFilteredResult(_0x4af140,_0x3e9814))[_0x1c83('0x40')](handleError(_0x4af140,null));};exports[_0x1c83('0x41')]=function(_0xdd92b9,_0x3d2c2b){var _0x413f5c={'raw':![],'where':{'id':_0xdd92b9[_0x1c83('0x42')]['id']}},_0x1201eb={};_0x1201eb['model']=_[_0x1c83('0x2f')](db[_0x1c83('0x2a')][_0x1c83('0x2b')]);_0x1201eb[_0x1c83('0x30')]=_[_0x1c83('0x2f')](_0xdd92b9[_0x1c83('0x30')]);_0x1201eb[_0x1c83('0x31')]=_[_0x1c83('0x33')](_0x1201eb['model'],_0x1201eb['query']);_0x413f5c[_0x1c83('0x32')]=_[_0x1c83('0x33')](_0x1201eb[_0x1c83('0x2e')],qs[_0x1c83('0x34')](_0xdd92b9[_0x1c83('0x30')]['fields']));_0x413f5c[_0x1c83('0x32')]=_0x413f5c['attributes']['length']?_0x413f5c['attributes']:_0x1201eb[_0x1c83('0x2e')];if(_0xdd92b9['query'][_0x1c83('0x3e')]){_0x413f5c[_0x1c83('0x3f')]=[{'all':!![]}];}_0x413f5c=_[_0x1c83('0x3c')]({},_0x413f5c,_0xdd92b9[_0x1c83('0x3d')]);return db[_0x1c83('0x2a')][_0x1c83('0x43')](_0x413f5c)[_0x1c83('0x20')](handleEntityNotFound(_0x3d2c2b,null))[_0x1c83('0x20')](respondWithResult(_0x3d2c2b,null))['catch'](handleError(_0x3d2c2b,null));};exports[_0x1c83('0x44')]=function(_0x2421d3,_0x320448){return db[_0x1c83('0x2a')][_0x1c83('0x44')](_0x2421d3['body'],{})['then'](function(_0x5956da){var _0x2c6354=_0x2421d3[_0x1c83('0x45')][_0x1c83('0x21')]({'plain':!![]});if(!_0x2c6354)throw new Error(_0x1c83('0x46'));if(_0x2c6354['role']===_0x1c83('0x45')){var _0x901dc5=_0x5956da[_0x1c83('0x21')]({'plain':!![]});var _0x4c1073=_0x1c83('0x22');return db[_0x1c83('0x47')][_0x1c83('0x43')]({'where':{'name':_0x4c1073,'userProfileId':_0x2c6354[_0x1c83('0x48')]},'raw':!![]})[_0x1c83('0x20')](function(_0xca58e6){if(_0xca58e6&&_0xca58e6[_0x1c83('0x49')]===0x0){return db[_0x1c83('0x23')]['create']({'name':_0x901dc5[_0x1c83('0x27')],'resourceId':_0x901dc5['id'],'type':_0xca58e6[_0x1c83('0x27')],'sectionId':_0xca58e6['id']},{})[_0x1c83('0x20')](function(){return _0x5956da;});}else{return _0x5956da;}})['catch'](function(_0x4a40a4){logger['error'](_0x1c83('0x4a'),_0x4a40a4);throw _0x4a40a4;});}return _0x5956da;})[_0x1c83('0x20')](respondWithResult(_0x320448,0xc9))['catch'](handleError(_0x320448,null));};exports[_0x1c83('0x4b')]=function(_0x2b64cb,_0x16542c){if(_0x2b64cb[_0x1c83('0x4c')]['id']){delete _0x2b64cb[_0x1c83('0x4c')]['id'];}return db[_0x1c83('0x2a')][_0x1c83('0x43')]({'where':{'id':_0x2b64cb[_0x1c83('0x42')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x16542c,null))[_0x1c83('0x20')](saveUpdates(_0x2b64cb['body'],null))['then'](respondWithResult(_0x16542c,null))[_0x1c83('0x40')](handleError(_0x16542c,null));};exports['destroy']=function(_0x516326,_0x2364ad){return db[_0x1c83('0x2a')]['find']({'where':{'id':_0x516326[_0x1c83('0x42')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x2364ad,null))[_0x1c83('0x20')](removeEntity(_0x2364ad,null))['catch'](handleError(_0x2364ad,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 74398f9..80d6c5d 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 _0xa9a4=['destroy','util','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate'];(function(_0x4d584f,_0x385fcd){var _0x383793=function(_0x309159){while(--_0x309159){_0x4d584f['push'](_0x4d584f['shift']());}};_0x383793(++_0x385fcd);}(_0xa9a4,0x76));var _0x4a9a=function(_0x42e51f,_0x14945a){_0x42e51f=_0x42e51f-0x0;var _0x50ff74=_0xa9a4[_0x42e51f];return _0x50ff74;};'use strict';var _=require('lodash');var util=require(_0x4a9a('0x0'));var BPromise=require('bluebird');var attributes=require(_0x4a9a('0x1'));var getUserApplications=function(_0x5a3580,_0x3f1452,_0x56e643){var _0xf81ac4=0x1;var _0x4f6265=[];var _0x1f47a6={'context':_0x3f1452['context']||_0x4a9a('0x2'),'exten':util['format'](_0x4a9a('0x3'),_0x5a3580[_0x4a9a('0x4')],_0x56e643),'type':_0x4a9a('0x5'),'isApp':![],'ChanSpyId':_0x5a3580['id'],'UserId':_0x3f1452['id']};_0x4f6265[_0x4a9a('0x6')](_[_0x4a9a('0x7')]({'app':_0x4a9a('0x8'),'appdata':util[_0x4a9a('0x9')](_0x4a9a('0xa'),_0x4a9a('0xb')),'priority':_0xf81ac4++},_0x1f47a6));if(_0x5a3580[_0x4a9a('0xc')]){_0x4f6265[_0x4a9a('0x6')](_['merge']({'app':_0x4a9a('0xd'),'appdata':util[_0x4a9a('0x9')](_0x4a9a('0xe'),_0x5a3580[_0x4a9a('0xf')]),'priority':_0xf81ac4++},_0x1f47a6));}if(_0x5a3580[_0x4a9a('0x10')]){_0x4f6265['push'](_[_0x4a9a('0x7')]({'app':_0x4a9a('0x11'),'appdata':_0x5a3580[_0x4a9a('0x12')],'priority':_0xf81ac4++},_0x1f47a6));}_0x4f6265['push'](_[_0x4a9a('0x7')]({'app':_0x4a9a('0x13'),'appdata':util[_0x4a9a('0x9')](_0x4a9a('0x14'),_0x3f1452[_0x4a9a('0x15')],_0x5a3580[_0x4a9a('0x16')]?_0x5a3580[_0x4a9a('0x16')][_0x4a9a('0x17')](''):''),'priority':_0xf81ac4++},_0x1f47a6));if(_0x5a3580['record']){_0x4f6265[_0x4a9a('0x6')](_['merge']({'app':_0x4a9a('0x18'),'priority':_0xf81ac4++},_0x1f47a6));}return _0x4f6265;};var getChanSpyApplications=function(_0x46fb31,_0x2f7d29){var _0x3bad2a=[];for(var _0x3afbc8=0x0,_0x35d8bc=0x1;_0x3afbc8<_0x2f7d29[_0x4a9a('0x19')];_0x3afbc8++,_0x35d8bc=0x1){_0x3bad2a=_0x3bad2a[_0x4a9a('0x1a')](getUserApplications(_0x46fb31,_0x2f7d29[_0x3afbc8],_0x2f7d29[_0x3afbc8]['internal']));if(_0x2f7d29[_0x3afbc8][_0x4a9a('0x1b')]!=_0x2f7d29[_0x3afbc8][_0x4a9a('0x15')]){_0x3bad2a=_0x3bad2a[_0x4a9a('0x1a')](getUserApplications(_0x46fb31,_0x2f7d29[_0x3afbc8],_0x2f7d29[_0x3afbc8][_0x4a9a('0x15')]));}}return _0x3bad2a;};var getChanSpyPromise=function(_0x18c339,_0x5cc422){return new BPromise(function(_0x3cd558,_0x405075){return _0x18c339['User']['findAll']({'attributes':['id',_0x4a9a('0x15'),_0x4a9a('0x1b')],'where':{'role':_0x4a9a('0x1c'),'chanspy':!![]},'raw':!![]})[_0x4a9a('0x1d')](function(_0x2e4fa3){if(_0x2e4fa3){return _0x3cd558(getChanSpyApplications(_0x5cc422,_0x2e4fa3));}return _0x3cd558([]);})[_0x4a9a('0x1e')](function(_0x423445){_0x405075(_0x423445);});});};module[_0x4a9a('0x1f')]=function(_0x31e6e7,_0x3d1923){var _0x410b31=_0x31e6e7[_0x4a9a('0x20')];return _0x31e6e7[_0x4a9a('0x21')](_0x4a9a('0x22'),attributes,{'tableName':_0x4a9a('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b2f09,_0x484619,_0x549e51){return getChanSpyPromise(_0x410b31,_0x5b2f09)[_0x4a9a('0x1d')](function(_0x5f596b){if(_0x5f596b&&_0x5f596b['length']){return _0x410b31[_0x4a9a('0x24')][_0x4a9a('0x25')](_0x5f596b);}})[_0x4a9a('0x1d')](function(){_0x549e51();})[_0x4a9a('0x1e')](function(_0x355902){_0x549e51(_0x355902);});},'afterUpdate':function(_0x3061a9,_0x364a20,_0x22d910){return _0x410b31[_0x4a9a('0x24')]['destroy']({'where':{'ChanSpyId':_0x3061a9['id']}})[_0x4a9a('0x1d')](function(){return getChanSpyPromise(_0x410b31,_0x3061a9);})[_0x4a9a('0x1d')](function(_0x49ff6b){if(_0x49ff6b&&_0x49ff6b[_0x4a9a('0x19')]){return _0x410b31[_0x4a9a('0x24')][_0x4a9a('0x25')](_0x49ff6b);}})[_0x4a9a('0x1d')](function(){_0x22d910();})[_0x4a9a('0x1e')](function(_0x2eae98){_0x22d910(_0x2eae98);});},'afterDestroy':function(_0x9e8b49,_0x3ca9,_0x41b4e8){return _0x410b31[_0x4a9a('0x24')][_0x4a9a('0x26')]({'where':{'ChanSpyId':_0x9e8b49['id']}})[_0x4a9a('0x1d')](function(){_0x41b4e8();})['catch'](function(_0x1ef73e){_0x41b4e8(_0x1ef73e);});}}});}; \ No newline at end of file +var _0xf571=['context','system','push','merge','Set','format','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','name','options','length','internal','concat','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','bulkCreate','VoiceExtension','destroy','util','./voiceChanSpy.attributes'];(function(_0x23d8f2,_0x3a586e){var _0x3f505d=function(_0x123f52){while(--_0x123f52){_0x23d8f2['push'](_0x23d8f2['shift']());}};_0x3f505d(++_0x3a586e);}(_0xf571,0x148));var _0x1f57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf571[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1f57('0x0'));var BPromise=require('bluebird');var attributes=require(_0x1f57('0x1'));var getUserApplications=function(_0xd64259,_0x2c5b04,_0x1495a){var _0x6e198e=0x1;var _0x3343ae=[];var _0x1006cf={'context':_0x2c5b04[_0x1f57('0x2')]||'from-sip','exten':util['format']('%s%s',_0xd64259['prefix'],_0x1495a),'type':_0x1f57('0x3'),'isApp':![],'ChanSpyId':_0xd64259['id'],'UserId':_0x2c5b04['id']};_0x3343ae[_0x1f57('0x4')](_[_0x1f57('0x5')]({'app':_0x1f57('0x6'),'appdata':util[_0x1f57('0x7')](_0x1f57('0x8'),_0x1f57('0x9')),'priority':_0x6e198e++},_0x1006cf));if(_0xd64259['record']){_0x3343ae[_0x1f57('0x4')](_['merge']({'app':_0x1f57('0xa'),'appdata':util[_0x1f57('0x7')](_0x1f57('0xb'),_0xd64259[_0x1f57('0xc')]),'priority':_0x6e198e++},_0x1006cf));}if(_0xd64259['auth']){_0x3343ae['push'](_[_0x1f57('0x5')]({'app':'Authenticate','appdata':_0xd64259[_0x1f57('0xd')],'priority':_0x6e198e++},_0x1006cf));}_0x3343ae[_0x1f57('0x4')](_[_0x1f57('0x5')]({'app':_0x1f57('0xe'),'appdata':util[_0x1f57('0x7')](_0x1f57('0xf'),_0x2c5b04[_0x1f57('0x10')],_0xd64259[_0x1f57('0x11')]?_0xd64259['options']['join'](''):''),'priority':_0x6e198e++},_0x1006cf));if(_0xd64259['record']){_0x3343ae[_0x1f57('0x4')](_[_0x1f57('0x5')]({'app':'StopMixMonitor','priority':_0x6e198e++},_0x1006cf));}return _0x3343ae;};var getChanSpyApplications=function(_0x521057,_0x158bcc){var _0x5b7ca4=[];for(var _0x3bc8c8=0x0,_0x43622d=0x1;_0x3bc8c8<_0x158bcc[_0x1f57('0x12')];_0x3bc8c8++,_0x43622d=0x1){_0x5b7ca4=_0x5b7ca4['concat'](getUserApplications(_0x521057,_0x158bcc[_0x3bc8c8],_0x158bcc[_0x3bc8c8][_0x1f57('0x13')]));if(_0x158bcc[_0x3bc8c8][_0x1f57('0x13')]!=_0x158bcc[_0x3bc8c8][_0x1f57('0x10')]){_0x5b7ca4=_0x5b7ca4[_0x1f57('0x14')](getUserApplications(_0x521057,_0x158bcc[_0x3bc8c8],_0x158bcc[_0x3bc8c8]['name']));}}return _0x5b7ca4;};var getChanSpyPromise=function(_0x15c031,_0x4dcf13){return new BPromise(function(_0x389ebc,_0x4417b5){return _0x15c031[_0x1f57('0x15')][_0x1f57('0x16')]({'attributes':['id',_0x1f57('0x10'),_0x1f57('0x13')],'where':{'role':_0x1f57('0x17'),'chanspy':!![]},'raw':!![]})[_0x1f57('0x18')](function(_0x997482){if(_0x997482){return _0x389ebc(getChanSpyApplications(_0x4dcf13,_0x997482));}return _0x389ebc([]);})[_0x1f57('0x19')](function(_0x5d5900){_0x4417b5(_0x5d5900);});});};module[_0x1f57('0x1a')]=function(_0x97543b,_0x3fd1d5){var _0x1bd1c3=_0x97543b[_0x1f57('0x1b')];return _0x97543b[_0x1f57('0x1c')](_0x1f57('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28c9b6,_0x4ee6d2,_0x3d9e34){return getChanSpyPromise(_0x1bd1c3,_0x28c9b6)[_0x1f57('0x18')](function(_0x249f94){if(_0x249f94&&_0x249f94[_0x1f57('0x12')]){return _0x1bd1c3['VoiceExtension'][_0x1f57('0x1e')](_0x249f94);}})[_0x1f57('0x18')](function(){_0x3d9e34();})[_0x1f57('0x19')](function(_0x5dba60){_0x3d9e34(_0x5dba60);});},'afterUpdate':function(_0x12a2f0,_0x58ad52,_0x3decbe){return _0x1bd1c3[_0x1f57('0x1f')][_0x1f57('0x20')]({'where':{'ChanSpyId':_0x12a2f0['id']}})[_0x1f57('0x18')](function(){return getChanSpyPromise(_0x1bd1c3,_0x12a2f0);})[_0x1f57('0x18')](function(_0x53fb18){if(_0x53fb18&&_0x53fb18[_0x1f57('0x12')]){return _0x1bd1c3[_0x1f57('0x1f')][_0x1f57('0x1e')](_0x53fb18);}})[_0x1f57('0x18')](function(){_0x3decbe();})[_0x1f57('0x19')](function(_0x1f9edc){_0x3decbe(_0x1f9edc);});},'afterDestroy':function(_0xc94c63,_0x21216a,_0x32ef29){return _0x1bd1c3[_0x1f57('0x1f')]['destroy']({'where':{'ChanSpyId':_0xc94c63['id']}})[_0x1f57('0x18')](function(){_0x32ef29();})[_0x1f57('0x19')](function(_0x53c0fb){_0x32ef29(_0x53c0fb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0c50081..ebd938a 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 _0xcea2=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x3f6336,_0x2ac0cc){var _0x5eecc7=function(_0x2ee921){while(--_0x2ee921){_0x3f6336['push'](_0x3f6336['shift']());}};_0x5eecc7(++_0x2ac0cc);}(_0xcea2,0x15a));var _0x2cea=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcea2[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});} \ No newline at end of file +var _0x6b20=['request','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2a6756,_0x131ca2){var _0x3bc520=function(_0x12266f){while(--_0x12266f){_0x2a6756['push'](_0x2a6756['shift']());}};_0x3bc520(++_0x131ca2);}(_0x6b20,0xd1));var _0x06b2=function(_0x32aceb,_0x5156a6){_0x32aceb=_0x32aceb-0x0;var _0x11affc=_0x6b20[_0x32aceb];return _0x11affc;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 82c2489..c018e03 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 _0x76f6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0xf36a76,_0x3967b3){var _0x414aa5=function(_0x84dc89){while(--_0x84dc89){_0xf36a76['push'](_0xf36a76['shift']());}};_0x414aa5(++_0x3967b3);}(_0x76f6,0x1a0));var _0x676f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x76f6[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x676f('0x0'));var path=require(_0x676f('0x1'));var timeout=require(_0x676f('0x2'));var express=require(_0x676f('0x3'));var router=express[_0x676f('0x4')]();var fs_extra=require(_0x676f('0x5'));var auth=require(_0x676f('0x6'));var interaction=require(_0x676f('0x7'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x676f('0x8')]('/',auth[_0x676f('0x9')](),controller[_0x676f('0xa')]);router[_0x676f('0x8')](_0x676f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x676f('0xc')]('/',auth[_0x676f('0x9')](),controller[_0x676f('0xd')]);router[_0x676f('0xe')](_0x676f('0xb'),auth[_0x676f('0x9')](),controller[_0x676f('0xf')]);router[_0x676f('0x10')](_0x676f('0xb'),auth['isAuthenticated'](),controller[_0x676f('0x11')]);module[_0x676f('0x12')]=router; \ No newline at end of file +var _0x01dc=['./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50ef4b,_0x46d84d){var _0x1ac700=function(_0x341f88){while(--_0x341f88){_0x50ef4b['push'](_0x50ef4b['shift']());}};_0x1ac700(++_0x46d84d);}(_0x01dc,0xad));var _0xc01d=function(_0x5bd37a,_0x411554){_0x5bd37a=_0x5bd37a-0x0;var _0x39cd74=_0x01dc[_0x5bd37a];return _0x39cd74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc01d('0x0'));var timeout=require(_0xc01d('0x1'));var express=require(_0xc01d('0x2'));var router=express[_0xc01d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc01d('0x4'));var interaction=require(_0xc01d('0x5'));var config=require(_0xc01d('0x6'));var controller=require(_0xc01d('0x7'));router[_0xc01d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc01d('0x9')]);router[_0xc01d('0x8')](_0xc01d('0xa'),auth[_0xc01d('0xb')](),controller[_0xc01d('0xc')]);router[_0xc01d('0xd')]('/',auth[_0xc01d('0xb')](),controller[_0xc01d('0xe')]);router[_0xc01d('0xf')](_0xc01d('0xa'),auth['isAuthenticated'](),controller[_0xc01d('0x10')]);router[_0xc01d('0x11')]('/:id',auth[_0xc01d('0xb')](),controller[_0xc01d('0x12')]);module[_0xc01d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 956e6c2..3eb7491 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 _0x8a9f=['exports','STRING','name'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x8a9f,0x90));var _0xf8a9=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x8a9f[_0x15cbce];return _0x257f29;};'use strict';var Sequelize=require('sequelize');module[_0xf8a9('0x0')]={'name':{'type':Sequelize[_0xf8a9('0x1')],'unique':_0xf8a9('0x2')},'description':{'type':Sequelize[_0xf8a9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x02f9=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x02f9,0x14d));var _0x902f=function(_0x47e554,_0x4d1dda){_0x47e554=_0x47e554-0x0;var _0x4190db=_0x02f9[_0x47e554];return _0x4190db;};'use strict';var Sequelize=require(_0x902f('0x0'));module[_0x902f('0x1')]={'name':{'type':Sequelize[_0x902f('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x902f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9e60b2b..97e3c71 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 _0xaa7d=['offset','set','Content-Range','apply','save','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','VoiceContext','findAll','rows','rawAttributes','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count'];(function(_0x39d32d,_0xdffcd5){var _0x33b077=function(_0x2dd835){while(--_0x2dd835){_0x39d32d['push'](_0x39d32d['shift']());}};_0x33b077(++_0xdffcd5);}(_0xaa7d,0x1e7));var _0xdaa7=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xaa7d[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0xdaa7('0x0'));var rimraf=require(_0xdaa7('0x1'));var zipdir=require(_0xdaa7('0x2'));var jsonpatch=require(_0xdaa7('0x3'));var rp=require('request-promise');var moment=require(_0xdaa7('0x4'));var BPromise=require(_0xdaa7('0x5'));var Mustache=require(_0xdaa7('0x6'));var util=require(_0xdaa7('0x7'));var path=require('path');var sox=require(_0xdaa7('0x8'));var csv=require(_0xdaa7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaa7('0xa'));var squel=require(_0xdaa7('0xb'));var crypto=require(_0xdaa7('0xc'));var jsforce=require(_0xdaa7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdaa7('0x9'));var querystring=require('querystring');var Papa=require(_0xdaa7('0xe'));var Redis=require(_0xdaa7('0xf'));var authService=require(_0xdaa7('0x10'));var qs=require(_0xdaa7('0x11'));var as=require(_0xdaa7('0x12'));var hardwareService=require(_0xdaa7('0x13'));var logger=require(_0xdaa7('0x14'))(_0xdaa7('0x15'));var utils=require(_0xdaa7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdaa7('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdaa7('0x18'));var client=jayson[_0xdaa7('0x19')][_0xdaa7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x210944,_0x3014c4,_0x2eefe4,_0x5a9223){return new BPromise(function(_0x55edca,_0x3965bf){var _0x478881=_0x5a9223||client;return _0x478881[_0xdaa7('0x1b')](_0x210944,_0x2eefe4)['then'](function(_0x5c4af0){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3014c4,_0xdaa7('0x1c'));logger[_0xdaa7('0x1d')](_0xdaa7('0x1e'),_0x3014c4,_0xdaa7('0x1c'),JSON[_0xdaa7('0x1f')](_0x5c4af0));if(_0x5c4af0['error']){if(_0x5c4af0['error']['code']===0x1f4){logger[_0xdaa7('0x20')](_0xdaa7('0x21'),_0x3014c4,_0x5c4af0[_0xdaa7('0x20')][_0xdaa7('0x22')]);return _0x3965bf(_0x5c4af0[_0xdaa7('0x20')][_0xdaa7('0x22')]);}logger[_0xdaa7('0x20')](_0xdaa7('0x21'),_0x3014c4,_0x5c4af0['error'][_0xdaa7('0x22')]);return _0x55edca(_0x5c4af0['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3014c4,_0xdaa7('0x1c'));_0x55edca(_0x5c4af0[_0xdaa7('0x23')]['message']);}})[_0xdaa7('0x24')](function(_0xf62fef){logger[_0xdaa7('0x20')](_0xdaa7('0x21'),_0x3014c4,_0xf62fef);_0x3965bf(_0xf62fef);});});}function respondWithStatusCode(_0x15357f,_0x230269){_0x230269=_0x230269||0xcc;return function(_0x10465){if(_0x10465){return _0x15357f['sendStatus'](_0x230269);}return _0x15357f[_0xdaa7('0x25')](_0x230269)[_0xdaa7('0x26')]();};}function respondWithResult(_0x27812f,_0x2d4377){_0x2d4377=_0x2d4377||0xc8;return function(_0x9486dd){if(_0x9486dd){return _0x27812f[_0xdaa7('0x25')](_0x2d4377)[_0xdaa7('0x27')](_0x9486dd);}};}function respondWithFilteredResult(_0x45ce94,_0x1c1ec0){return function(_0x29f512){if(_0x29f512){var _0x2fa5ec=typeof _0x1c1ec0['offset']===_0xdaa7('0x28')&&typeof _0x1c1ec0[_0xdaa7('0x29')]===_0xdaa7('0x28');var _0xb9f5d1=_0x29f512[_0xdaa7('0x2a')];var _0x345c33=_0x2fa5ec?0x0:_0x1c1ec0[_0xdaa7('0x2b')];var _0x8b36ac=_0x2fa5ec?_0x29f512[_0xdaa7('0x2a')]:_0x1c1ec0[_0xdaa7('0x2b')]+_0x1c1ec0[_0xdaa7('0x29')];var _0x181ede;if(_0x8b36ac>=_0xb9f5d1){_0x8b36ac=_0xb9f5d1;_0x181ede=0xc8;}else{_0x181ede=0xce;}_0x45ce94[_0xdaa7('0x25')](_0x181ede);return _0x45ce94[_0xdaa7('0x2c')](_0xdaa7('0x2d'),_0x345c33+'-'+_0x8b36ac+'/'+_0xb9f5d1)['json'](_0x29f512);}return null;};}function patchUpdates(_0x39ce89){return function(_0x1263ac){try{jsonpatch[_0xdaa7('0x2e')](_0x1263ac,_0x39ce89,!![]);}catch(_0x517d3e){return BPromise['reject'](_0x517d3e);}return _0x1263ac[_0xdaa7('0x2f')]();};}function saveUpdates(_0x1b55a9,_0x4c58c6){return function(_0x4c5973){if(_0x4c5973){return _0x4c5973[_0xdaa7('0x30')](_0x1b55a9)[_0xdaa7('0x31')](function(_0x4f50f0){return _0x4f50f0;});}return null;};}function removeEntity(_0xa89b1d,_0x56a5b){return function(_0x12b702){if(_0x12b702){return _0x12b702[_0xdaa7('0x32')]()[_0xdaa7('0x31')](function(){var _0x1979c1=_0x12b702[_0xdaa7('0x33')]({'plain':!![]});var _0x370dfc=_0xdaa7('0x34');return db[_0xdaa7('0x35')][_0xdaa7('0x32')]({'where':{'type':_0x370dfc,'resourceId':_0x1979c1['id']}})[_0xdaa7('0x31')](function(){return _0x12b702;});})[_0xdaa7('0x31')](function(){_0xa89b1d[_0xdaa7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ee2f,_0x57da63){return function(_0xc1e419){if(!_0xc1e419){_0x55ee2f[_0xdaa7('0x36')](0x194);}return _0xc1e419;};}function handleError(_0xc224f6,_0xd6a1bc){_0xd6a1bc=_0xd6a1bc||0x1f4;return function(_0x26a0c4){logger[_0xdaa7('0x20')](_0x26a0c4[_0xdaa7('0x37')]);if(_0x26a0c4[_0xdaa7('0x38')]){delete _0x26a0c4[_0xdaa7('0x38')];}_0xc224f6[_0xdaa7('0x25')](_0xd6a1bc)['send'](_0x26a0c4);};}exports[_0xdaa7('0x39')]=function(_0x23d5fd,_0x3b4f5f){var _0x1b833c={},_0x37d756={},_0x16363c={'count':0x0,'rows':[]};var _0x22ab20=_['map'](db['VoiceContext']['rawAttributes'],function(_0x2a7ddc){return{'name':_0x2a7ddc[_0xdaa7('0x3a')],'type':_0x2a7ddc[_0xdaa7('0x3b')][_0xdaa7('0x3c')]};});_0x37d756[_0xdaa7('0x3d')]=_[_0xdaa7('0x3e')](_0x22ab20,_0xdaa7('0x38'));_0x37d756[_0xdaa7('0x3f')]=_[_0xdaa7('0x40')](_0x23d5fd['query']);_0x37d756[_0xdaa7('0x41')]=_[_0xdaa7('0x42')](_0x37d756[_0xdaa7('0x3d')],_0x37d756['query']);_0x1b833c['attributes']=_[_0xdaa7('0x42')](_0x37d756[_0xdaa7('0x3d')],qs[_0xdaa7('0x43')](_0x23d5fd[_0xdaa7('0x3f')][_0xdaa7('0x43')]));_0x1b833c['attributes']=_0x1b833c['attributes'][_0xdaa7('0x44')]?_0x1b833c[_0xdaa7('0x45')]:_0x37d756[_0xdaa7('0x3d')];if(!_0x23d5fd[_0xdaa7('0x3f')][_0xdaa7('0x46')](_0xdaa7('0x47'))){_0x1b833c[_0xdaa7('0x29')]=qs[_0xdaa7('0x29')](_0x23d5fd[_0xdaa7('0x3f')]['limit']);_0x1b833c[_0xdaa7('0x2b')]=qs['offset'](_0x23d5fd[_0xdaa7('0x3f')]['offset']);}_0x1b833c[_0xdaa7('0x48')]=qs[_0xdaa7('0x49')](_0x23d5fd['query'][_0xdaa7('0x49')]);_0x1b833c[_0xdaa7('0x4a')]=qs[_0xdaa7('0x41')](_[_0xdaa7('0x4b')](_0x23d5fd[_0xdaa7('0x3f')],_0x37d756[_0xdaa7('0x41')]),_0x22ab20);if(_0x23d5fd[_0xdaa7('0x3f')]['filter']){_0x1b833c[_0xdaa7('0x4a')]=_[_0xdaa7('0x4c')](_0x1b833c[_0xdaa7('0x4a')],{'$or':_[_0xdaa7('0x3e')](_0x22ab20,function(_0x5c4d46){if(_0x5c4d46[_0xdaa7('0x3b')]!==_0xdaa7('0x4d')){var _0x31479c={};_0x31479c[_0x5c4d46[_0xdaa7('0x38')]]={'$like':'%'+_0x23d5fd['query'][_0xdaa7('0x4e')]+'%'};return _0x31479c;}})});}_0x1b833c=_[_0xdaa7('0x4c')]({},_0x1b833c,_0x23d5fd[_0xdaa7('0x4f')]);var _0x153a41={'where':_0x1b833c[_0xdaa7('0x4a')]};return db['VoiceContext'][_0xdaa7('0x2a')](_0x153a41)[_0xdaa7('0x31')](function(_0x2e6d4e){_0x16363c['count']=_0x2e6d4e;if(_0x23d5fd[_0xdaa7('0x3f')][_0xdaa7('0x50')]){_0x1b833c[_0xdaa7('0x51')]=[{'all':!![]}];}return db[_0xdaa7('0x52')][_0xdaa7('0x53')](_0x1b833c);})[_0xdaa7('0x31')](function(_0x48d1ae){_0x16363c[_0xdaa7('0x54')]=_0x48d1ae;return _0x16363c;})[_0xdaa7('0x31')](respondWithFilteredResult(_0x3b4f5f,_0x1b833c))[_0xdaa7('0x24')](handleError(_0x3b4f5f,null));};exports['show']=function(_0x5164cb,_0x49c77f){var _0x3e9951={'raw':![],'where':{'id':_0x5164cb['params']['id']}},_0x48fc4a={};_0x48fc4a[_0xdaa7('0x3d')]=_[_0xdaa7('0x40')](db[_0xdaa7('0x52')][_0xdaa7('0x55')]);_0x48fc4a[_0xdaa7('0x3f')]=_[_0xdaa7('0x40')](_0x5164cb[_0xdaa7('0x3f')]);_0x48fc4a[_0xdaa7('0x41')]=_[_0xdaa7('0x42')](_0x48fc4a[_0xdaa7('0x3d')],_0x48fc4a['query']);_0x3e9951[_0xdaa7('0x45')]=_[_0xdaa7('0x42')](_0x48fc4a[_0xdaa7('0x3d')],qs[_0xdaa7('0x43')](_0x5164cb[_0xdaa7('0x3f')][_0xdaa7('0x43')]));_0x3e9951['attributes']=_0x3e9951[_0xdaa7('0x45')][_0xdaa7('0x44')]?_0x3e9951['attributes']:_0x48fc4a[_0xdaa7('0x3d')];if(_0x5164cb[_0xdaa7('0x3f')][_0xdaa7('0x50')]){_0x3e9951[_0xdaa7('0x51')]=[{'all':!![]}];}_0x3e9951=_[_0xdaa7('0x4c')]({},_0x3e9951,_0x5164cb['options']);return db[_0xdaa7('0x52')][_0xdaa7('0x56')](_0x3e9951)['then'](handleEntityNotFound(_0x49c77f,null))[_0xdaa7('0x31')](respondWithResult(_0x49c77f,null))['catch'](handleError(_0x49c77f,null));};exports[_0xdaa7('0x57')]=function(_0x27f423,_0x5432d8,_0x4eef19){var _0x5b095b;return db[_0xdaa7('0x52')][_0xdaa7('0x57')](_0x27f423[_0xdaa7('0x58')],{'raw':!![]})[_0xdaa7('0x31')](function(_0x2563d5){_0x5b095b=_0x2563d5;return db[_0xdaa7('0x52')]['findAll']({'raw':!![]});})[_0xdaa7('0x31')](function(_0x396fcc){var _0x5216ec=fs[_0xdaa7('0x59')](path['join'](config[_0xdaa7('0x5a')],_0xdaa7('0x5b')),_0xdaa7('0x5c'));var _0x2924b1=ejs[_0xdaa7('0x5d')](_0x5216ec,{'contexts':_0x396fcc||[]});fs['writeFileSync'](_0xdaa7('0x5e'),_0x2924b1);})['then'](function(){return respondWithRpcPromise(_0xdaa7('0x5f'),'create',{'module':_0xdaa7('0x60')});})['then'](function(){var _0x14ffb2=_0x27f423[_0xdaa7('0x61')]['get']({'plain':!![]});if(!_0x14ffb2)throw new Error(_0xdaa7('0x62'));if(_0x14ffb2[_0xdaa7('0x63')]==='user'){var _0x5bf5d0=_0x5b095b['get']({'plain':!![]});return db[_0xdaa7('0x64')][_0xdaa7('0x56')]({'where':{'name':_0xdaa7('0x34'),'userProfileId':_0x14ffb2['userProfileId']},'raw':!![]})[_0xdaa7('0x31')](function(_0x47730b){if(_0x47730b&&_0x47730b[_0xdaa7('0x65')]===0x0){return db['UserProfileResource'][_0xdaa7('0x57')]({'name':_0x5bf5d0[_0xdaa7('0x38')],'resourceId':_0x5bf5d0['id'],'type':_0x47730b['name'],'sectionId':_0x47730b['id']},{})[_0xdaa7('0x31')](function(){return _0x5b095b;});}else{return _0x5b095b;}})[_0xdaa7('0x24')](function(_0x289048){logger[_0xdaa7('0x20')](_0xdaa7('0x66'),_0x289048);throw _0x289048;});}return _0x5b095b;})['then'](respondWithResult(_0x5432d8,0xc9))[_0xdaa7('0x24')](handleError(_0x5432d8,null));};exports[_0xdaa7('0x30')]=function(_0x2f84ce,_0x405423,_0x4ac7f0){var _0x749a16;return db['VoiceContext']['find']({'where':{'id':_0x2f84ce[_0xdaa7('0x67')]['id']}})['then'](handleEntityNotFound(_0x405423,null))[_0xdaa7('0x31')](saveUpdates(_0x2f84ce[_0xdaa7('0x58')],null))[_0xdaa7('0x31')](function(_0x4ccbb0){if(_0x4ccbb0){_0x749a16=_0x4ccbb0;return db[_0xdaa7('0x52')][_0xdaa7('0x53')]({'raw':!![]});}})[_0xdaa7('0x31')](function(_0x1fe9bb){var _0x5d97ce=fs[_0xdaa7('0x59')](path[_0xdaa7('0x68')](config['root'],_0xdaa7('0x5b')),_0xdaa7('0x5c'));var _0x368f0a=ejs[_0xdaa7('0x5d')](_0x5d97ce,{'contexts':_0x1fe9bb||[]});fs[_0xdaa7('0x69')](_0xdaa7('0x5e'),_0x368f0a);})[_0xdaa7('0x31')](function(){return respondWithRpcPromise(_0xdaa7('0x5f'),_0xdaa7('0x30'),{'module':_0xdaa7('0x60')});})[_0xdaa7('0x31')](function(){return _0x749a16;})['then'](respondWithResult(_0x405423,null))[_0xdaa7('0x24')](handleError(_0x405423,null));};exports['destroy']=function(_0x25bd1e,_0x4c9772,_0x47ca59){var _0x7454b8;return db[_0xdaa7('0x52')][_0xdaa7('0x56')]({'where':{'id':_0x25bd1e[_0xdaa7('0x67')]['id']}})[_0xdaa7('0x31')](handleEntityNotFound(_0x4c9772,null))[_0xdaa7('0x31')](removeEntity(_0x4c9772,null))[_0xdaa7('0x31')](function(){return db[_0xdaa7('0x52')][_0xdaa7('0x53')]({'raw':!![]});})[_0xdaa7('0x31')](function(_0x595195){var _0x6673df=fs[_0xdaa7('0x59')](path[_0xdaa7('0x68')](config[_0xdaa7('0x5a')],_0xdaa7('0x5b')),_0xdaa7('0x5c'));var _0x220064=ejs[_0xdaa7('0x5d')](_0x6673df,{'contexts':_0x595195});fs[_0xdaa7('0x69')](_0xdaa7('0x5e'),_0x220064);return respondWithRpcPromise(_0xdaa7('0x5f'),_0xdaa7('0x32'),{'module':'chan_sip.so'});})[_0xdaa7('0x24')](handleError(_0x4c9772,null));}; \ No newline at end of file +var _0x7ecc=['keys','merge','find','create','body','findAll','root','utf8','render','writeFileSync','Reload','chan_sip.so','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readFileSync','join','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','options','count','includeAll','VoiceContext','rows','show'];(function(_0x263949,_0x416ee7){var _0x587fae=function(_0x2edaaf){while(--_0x2edaaf){_0x263949['push'](_0x263949['shift']());}};_0x587fae(++_0x416ee7);}(_0x7ecc,0x1ae));var _0xc7ec=function(_0x5b2e2a,_0x486a67){_0x5b2e2a=_0x5b2e2a-0x0;var _0xa71707=_0x7ecc[_0x5b2e2a];return _0xa71707;};'use strict';var emlformat=require(_0xc7ec('0x0'));var rimraf=require(_0xc7ec('0x1'));var zipdir=require(_0xc7ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7ec('0x3'));var moment=require(_0xc7ec('0x4'));var BPromise=require(_0xc7ec('0x5'));var Mustache=require(_0xc7ec('0x6'));var util=require(_0xc7ec('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc7ec('0x8'));var ejs=require(_0xc7ec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc7ec('0xa'));var squel=require('squel');var crypto=require(_0xc7ec('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc7ec('0xc'));var toCsv=require(_0xc7ec('0x8'));var querystring=require(_0xc7ec('0xd'));var Papa=require(_0xc7ec('0xe'));var Redis=require(_0xc7ec('0xf'));var authService=require(_0xc7ec('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc7ec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7ec('0x12'))(_0xc7ec('0x13'));var utils=require('../../config/utils');var config=require(_0xc7ec('0x14'));var licenseUtil=require(_0xc7ec('0x15'));var db=require(_0xc7ec('0x16'))['db'];var jayson=require(_0xc7ec('0x17'));var client=jayson[_0xc7ec('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18366a,_0x2a402b,_0x37a434,_0x149da4){return new BPromise(function(_0x17ff21,_0x819f24){var _0x3dae43=_0x149da4||client;return _0x3dae43[_0xc7ec('0x19')](_0x18366a,_0x37a434)[_0xc7ec('0x1a')](function(_0x45a3c6){logger[_0xc7ec('0x1b')](_0xc7ec('0x1c'),_0x2a402b,'request\x20sent');logger['debug'](_0xc7ec('0x1d'),_0x2a402b,_0xc7ec('0x1e'),JSON[_0xc7ec('0x1f')](_0x45a3c6));if(_0x45a3c6[_0xc7ec('0x20')]){if(_0x45a3c6[_0xc7ec('0x20')][_0xc7ec('0x21')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2a402b,_0x45a3c6[_0xc7ec('0x20')]['message']);return _0x819f24(_0x45a3c6[_0xc7ec('0x20')][_0xc7ec('0x22')]);}logger[_0xc7ec('0x20')](_0xc7ec('0x1c'),_0x2a402b,_0x45a3c6[_0xc7ec('0x20')][_0xc7ec('0x22')]);return _0x17ff21(_0x45a3c6[_0xc7ec('0x20')][_0xc7ec('0x22')]);}else{logger[_0xc7ec('0x1b')](_0xc7ec('0x1c'),_0x2a402b,_0xc7ec('0x1e'));_0x17ff21(_0x45a3c6[_0xc7ec('0x23')][_0xc7ec('0x22')]);}})[_0xc7ec('0x24')](function(_0x9f9148){logger[_0xc7ec('0x20')](_0xc7ec('0x1c'),_0x2a402b,_0x9f9148);_0x819f24(_0x9f9148);});});}function respondWithStatusCode(_0x149bab,_0x54f646){_0x54f646=_0x54f646||0xcc;return function(_0xec566e){if(_0xec566e){return _0x149bab['sendStatus'](_0x54f646);}return _0x149bab[_0xc7ec('0x25')](_0x54f646)[_0xc7ec('0x26')]();};}function respondWithResult(_0x3203b5,_0x5a1952){_0x5a1952=_0x5a1952||0xc8;return function(_0x4cb4ef){if(_0x4cb4ef){return _0x3203b5[_0xc7ec('0x25')](_0x5a1952)[_0xc7ec('0x27')](_0x4cb4ef);}};}function respondWithFilteredResult(_0x12bd69,_0x16fdb4){return function(_0x588e0b){if(_0x588e0b){var _0xdd66e0=typeof _0x16fdb4['offset']===_0xc7ec('0x28')&&typeof _0x16fdb4[_0xc7ec('0x29')]==='undefined';var _0x26f7cd=_0x588e0b['count'];var _0x13ddf5=_0xdd66e0?0x0:_0x16fdb4['offset'];var _0xfc99b5=_0xdd66e0?_0x588e0b['count']:_0x16fdb4[_0xc7ec('0x2a')]+_0x16fdb4[_0xc7ec('0x29')];var _0x2333a8;if(_0xfc99b5>=_0x26f7cd){_0xfc99b5=_0x26f7cd;_0x2333a8=0xc8;}else{_0x2333a8=0xce;}_0x12bd69[_0xc7ec('0x25')](_0x2333a8);return _0x12bd69[_0xc7ec('0x2b')](_0xc7ec('0x2c'),_0x13ddf5+'-'+_0xfc99b5+'/'+_0x26f7cd)[_0xc7ec('0x27')](_0x588e0b);}return null;};}function patchUpdates(_0x5d565b){return function(_0xc6e9cb){try{jsonpatch[_0xc7ec('0x2d')](_0xc6e9cb,_0x5d565b,!![]);}catch(_0x9d48d8){return BPromise[_0xc7ec('0x2e')](_0x9d48d8);}return _0xc6e9cb[_0xc7ec('0x2f')]();};}function saveUpdates(_0x2b8383,_0x68329){return function(_0x2c3fff){if(_0x2c3fff){return _0x2c3fff[_0xc7ec('0x30')](_0x2b8383)[_0xc7ec('0x1a')](function(_0x2f6629){return _0x2f6629;});}return null;};}function removeEntity(_0xc2168c,_0x303dfd){return function(_0x447f68){if(_0x447f68){return _0x447f68['destroy']()[_0xc7ec('0x1a')](function(){var _0x2b3473=_0x447f68[_0xc7ec('0x31')]({'plain':!![]});var _0x15f730=_0xc7ec('0x32');return db[_0xc7ec('0x33')][_0xc7ec('0x34')]({'where':{'type':_0x15f730,'resourceId':_0x2b3473['id']}})[_0xc7ec('0x1a')](function(){return _0x447f68;});})[_0xc7ec('0x1a')](function(){_0xc2168c[_0xc7ec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x580e2f,_0x19e3c1){return function(_0x553abe){if(!_0x553abe){_0x580e2f[_0xc7ec('0x35')](0x194);}return _0x553abe;};}function handleError(_0x5f36fe,_0x3baf36){_0x3baf36=_0x3baf36||0x1f4;return function(_0x6b4cf8){logger[_0xc7ec('0x20')](_0x6b4cf8['stack']);if(_0x6b4cf8[_0xc7ec('0x36')]){delete _0x6b4cf8[_0xc7ec('0x36')];}_0x5f36fe[_0xc7ec('0x25')](_0x3baf36)[_0xc7ec('0x37')](_0x6b4cf8);};}exports[_0xc7ec('0x38')]=function(_0x4651ea,_0x1799ec){var _0x4b8576={},_0x148aab={},_0x2e0505={'count':0x0,'rows':[]};var _0x398c97=_[_0xc7ec('0x39')](db['VoiceContext'][_0xc7ec('0x3a')],function(_0x41371e){return{'name':_0x41371e[_0xc7ec('0x3b')],'type':_0x41371e[_0xc7ec('0x3c')][_0xc7ec('0x3d')]};});_0x148aab[_0xc7ec('0x3e')]=_[_0xc7ec('0x39')](_0x398c97,_0xc7ec('0x36'));_0x148aab[_0xc7ec('0x3f')]=_['keys'](_0x4651ea['query']);_0x148aab[_0xc7ec('0x40')]=_[_0xc7ec('0x41')](_0x148aab[_0xc7ec('0x3e')],_0x148aab[_0xc7ec('0x3f')]);_0x4b8576[_0xc7ec('0x42')]=_['intersection'](_0x148aab[_0xc7ec('0x3e')],qs[_0xc7ec('0x43')](_0x4651ea[_0xc7ec('0x3f')][_0xc7ec('0x43')]));_0x4b8576[_0xc7ec('0x42')]=_0x4b8576[_0xc7ec('0x42')][_0xc7ec('0x44')]?_0x4b8576[_0xc7ec('0x42')]:_0x148aab[_0xc7ec('0x3e')];if(!_0x4651ea[_0xc7ec('0x3f')]['hasOwnProperty'](_0xc7ec('0x45'))){_0x4b8576['limit']=qs[_0xc7ec('0x29')](_0x4651ea['query'][_0xc7ec('0x29')]);_0x4b8576['offset']=qs[_0xc7ec('0x2a')](_0x4651ea[_0xc7ec('0x3f')]['offset']);}_0x4b8576['order']=qs[_0xc7ec('0x46')](_0x4651ea['query'][_0xc7ec('0x46')]);_0x4b8576['where']=qs[_0xc7ec('0x40')](_[_0xc7ec('0x47')](_0x4651ea[_0xc7ec('0x3f')],_0x148aab[_0xc7ec('0x40')]),_0x398c97);if(_0x4651ea[_0xc7ec('0x3f')][_0xc7ec('0x48')]){_0x4b8576[_0xc7ec('0x49')]=_['merge'](_0x4b8576[_0xc7ec('0x49')],{'$or':_['map'](_0x398c97,function(_0x1b2cea){if(_0x1b2cea['type']!=='VIRTUAL'){var _0x53d879={};_0x53d879[_0x1b2cea['name']]={'$like':'%'+_0x4651ea[_0xc7ec('0x3f')][_0xc7ec('0x48')]+'%'};return _0x53d879;}})});}_0x4b8576=_['merge']({},_0x4b8576,_0x4651ea[_0xc7ec('0x4a')]);var _0x4ff646={'where':_0x4b8576[_0xc7ec('0x49')]};return db['VoiceContext'][_0xc7ec('0x4b')](_0x4ff646)['then'](function(_0x55164b){_0x2e0505[_0xc7ec('0x4b')]=_0x55164b;if(_0x4651ea[_0xc7ec('0x3f')][_0xc7ec('0x4c')]){_0x4b8576['include']=[{'all':!![]}];}return db[_0xc7ec('0x4d')]['findAll'](_0x4b8576);})['then'](function(_0x3f4888){_0x2e0505[_0xc7ec('0x4e')]=_0x3f4888;return _0x2e0505;})[_0xc7ec('0x1a')](respondWithFilteredResult(_0x1799ec,_0x4b8576))['catch'](handleError(_0x1799ec,null));};exports[_0xc7ec('0x4f')]=function(_0x4b5069,_0x3c80ce){var _0x4a07f8={'raw':![],'where':{'id':_0x4b5069['params']['id']}},_0x4ffcfc={};_0x4ffcfc[_0xc7ec('0x3e')]=_[_0xc7ec('0x50')](db[_0xc7ec('0x4d')]['rawAttributes']);_0x4ffcfc[_0xc7ec('0x3f')]=_[_0xc7ec('0x50')](_0x4b5069[_0xc7ec('0x3f')]);_0x4ffcfc['filters']=_['intersection'](_0x4ffcfc[_0xc7ec('0x3e')],_0x4ffcfc[_0xc7ec('0x3f')]);_0x4a07f8[_0xc7ec('0x42')]=_[_0xc7ec('0x41')](_0x4ffcfc['model'],qs[_0xc7ec('0x43')](_0x4b5069['query']['fields']));_0x4a07f8[_0xc7ec('0x42')]=_0x4a07f8[_0xc7ec('0x42')]['length']?_0x4a07f8[_0xc7ec('0x42')]:_0x4ffcfc[_0xc7ec('0x3e')];if(_0x4b5069['query'][_0xc7ec('0x4c')]){_0x4a07f8['include']=[{'all':!![]}];}_0x4a07f8=_[_0xc7ec('0x51')]({},_0x4a07f8,_0x4b5069[_0xc7ec('0x4a')]);return db[_0xc7ec('0x4d')][_0xc7ec('0x52')](_0x4a07f8)[_0xc7ec('0x1a')](handleEntityNotFound(_0x3c80ce,null))[_0xc7ec('0x1a')](respondWithResult(_0x3c80ce,null))[_0xc7ec('0x24')](handleError(_0x3c80ce,null));};exports[_0xc7ec('0x53')]=function(_0x59b1dd,_0x262561,_0x3adbb2){var _0x23ca24;return db[_0xc7ec('0x4d')]['create'](_0x59b1dd[_0xc7ec('0x54')],{'raw':!![]})['then'](function(_0x4f3212){_0x23ca24=_0x4f3212;return db['VoiceContext'][_0xc7ec('0x55')]({'raw':!![]});})['then'](function(_0x2186aa){var _0x4fce11=fs['readFileSync'](path['join'](config[_0xc7ec('0x56')],'server/files/templates/context.ejs'),_0xc7ec('0x57'));var _0x454607=ejs[_0xc7ec('0x58')](_0x4fce11,{'contexts':_0x2186aa||[]});fs[_0xc7ec('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x454607);})['then'](function(){return respondWithRpcPromise(_0xc7ec('0x5a'),_0xc7ec('0x53'),{'module':_0xc7ec('0x5b')});})['then'](function(){var _0x2b3f09=_0x59b1dd[_0xc7ec('0x5c')][_0xc7ec('0x31')]({'plain':!![]});if(!_0x2b3f09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b3f09[_0xc7ec('0x5d')]===_0xc7ec('0x5c')){var _0x52fc84=_0x23ca24['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xc7ec('0x32'),'userProfileId':_0x2b3f09[_0xc7ec('0x5e')]},'raw':!![]})[_0xc7ec('0x1a')](function(_0x1b5504){if(_0x1b5504&&_0x1b5504[_0xc7ec('0x5f')]===0x0){return db[_0xc7ec('0x33')][_0xc7ec('0x53')]({'name':_0x52fc84['name'],'resourceId':_0x52fc84['id'],'type':_0x1b5504['name'],'sectionId':_0x1b5504['id']},{})[_0xc7ec('0x1a')](function(){return _0x23ca24;});}else{return _0x23ca24;}})[_0xc7ec('0x24')](function(_0x3255c5){logger[_0xc7ec('0x20')](_0xc7ec('0x60'),_0x3255c5);throw _0x3255c5;});}return _0x23ca24;})[_0xc7ec('0x1a')](respondWithResult(_0x262561,0xc9))['catch'](handleError(_0x262561,null));};exports[_0xc7ec('0x30')]=function(_0x4b73cd,_0xb538b2,_0x25ea7f){var _0x2647f6;return db[_0xc7ec('0x4d')][_0xc7ec('0x52')]({'where':{'id':_0x4b73cd[_0xc7ec('0x61')]['id']}})[_0xc7ec('0x1a')](handleEntityNotFound(_0xb538b2,null))[_0xc7ec('0x1a')](saveUpdates(_0x4b73cd['body'],null))[_0xc7ec('0x1a')](function(_0x564faf){if(_0x564faf){_0x2647f6=_0x564faf;return db[_0xc7ec('0x4d')][_0xc7ec('0x55')]({'raw':!![]});}})[_0xc7ec('0x1a')](function(_0x4f47c8){var _0x273678=fs[_0xc7ec('0x62')](path[_0xc7ec('0x63')](config['root'],_0xc7ec('0x64')),_0xc7ec('0x57'));var _0x4477ef=ejs[_0xc7ec('0x58')](_0x273678,{'contexts':_0x4f47c8||[]});fs[_0xc7ec('0x59')](_0xc7ec('0x65'),_0x4477ef);})[_0xc7ec('0x1a')](function(){return respondWithRpcPromise(_0xc7ec('0x5a'),_0xc7ec('0x30'),{'module':_0xc7ec('0x5b')});})[_0xc7ec('0x1a')](function(){return _0x2647f6;})['then'](respondWithResult(_0xb538b2,null))[_0xc7ec('0x24')](handleError(_0xb538b2,null));};exports[_0xc7ec('0x34')]=function(_0x5e34eb,_0x2c8350,_0x2b307a){var _0x3f1e71;return db[_0xc7ec('0x4d')][_0xc7ec('0x52')]({'where':{'id':_0x5e34eb[_0xc7ec('0x61')]['id']}})[_0xc7ec('0x1a')](handleEntityNotFound(_0x2c8350,null))['then'](removeEntity(_0x2c8350,null))['then'](function(){return db[_0xc7ec('0x4d')][_0xc7ec('0x55')]({'raw':!![]});})[_0xc7ec('0x1a')](function(_0x13d69e){var _0x1e782c=fs[_0xc7ec('0x62')](path[_0xc7ec('0x63')](config[_0xc7ec('0x56')],_0xc7ec('0x64')),_0xc7ec('0x57'));var _0x2b5a25=ejs['render'](_0x1e782c,{'contexts':_0x13d69e});fs['writeFileSync'](_0xc7ec('0x65'),_0x2b5a25);return respondWithRpcPromise(_0xc7ec('0x5a'),'destroy',{'module':'chan_sip.so'});})[_0xc7ec('0x24')](handleError(_0x2c8350,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a58d9fe..5a12268 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 _0x22be=['rimraf','exports','define','voice_contexts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x30348f,_0x3f7f64){var _0x4e61cc=function(_0x5e6b1b){while(--_0x5e6b1b){_0x30348f['push'](_0x30348f['shift']());}};_0x4e61cc(++_0x3f7f64);}(_0x22be,0x108));var _0xe22b=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x22be[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0xe22b('0x0'));var util=require(_0xe22b('0x1'));var logger=require(_0xe22b('0x2'))('api');var moment=require(_0xe22b('0x3'));var BPromise=require(_0xe22b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe22b('0x5'));var rimraf=require(_0xe22b('0x6'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xe22b('0x7')]=function(_0x4d91a9,_0xaa0ac9){return _0x4d91a9[_0xe22b('0x8')]('VoiceContext',attributes,{'tableName':_0xe22b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x737b=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0x737b,0x16c));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb737('0x0'));var util=require(_0xb737('0x1'));var logger=require('../../config/logger')(_0xb737('0x2'));var moment=require(_0xb737('0x3'));var BPromise=require(_0xb737('0x4'));var rp=require(_0xb737('0x5'));var fs=require('fs');var path=require(_0xb737('0x6'));var rimraf=require(_0xb737('0x7'));var config=require(_0xb737('0x8'));var attributes=require(_0xb737('0x9'));module[_0xb737('0xa')]=function(_0x3a718e,_0x1c1cf4){return _0x3a718e[_0xb737('0xb')](_0xb737('0xc'),attributes,{'tableName':_0xb737('0xd'),'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 5f6d3d0..437202e 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 _0xfe36=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xfe36,0x1b6));var _0x6fe3=function(_0x419676,_0xfcdcb9){_0x419676=_0x419676-0x0;var _0x4eee1d=_0xfe36[_0x419676];return _0x4eee1d;};'use strict';var _=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var moment=require('moment');var BPromise=require(_0x6fe3('0x2'));var rs=require(_0x6fe3('0x3'));var fs=require('fs');var Redis=require(_0x6fe3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fe3('0x5'));var logger=require(_0x6fe3('0x6'))(_0x6fe3('0x7'));var config=require(_0x6fe3('0x8'));var jayson=require(_0x6fe3('0x9'));var client=jayson[_0x6fe3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef797,_0x36998c,_0x373ed8){return new BPromise(function(_0x3b725c,_0x55e152){return client[_0x6fe3('0xb')](_0x5ef797,_0x373ed8)[_0x6fe3('0xc')](function(_0x5242de){logger[_0x6fe3('0xd')](_0x6fe3('0xe'),_0x36998c,_0x6fe3('0xf'));logger[_0x6fe3('0x10')](_0x6fe3('0x11'),_0x36998c,_0x6fe3('0xf'),JSON[_0x6fe3('0x12')](_0x5242de));if(_0x5242de['error']){if(_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x14')]===0x1f4){logger[_0x6fe3('0x13')](_0x6fe3('0xe'),_0x36998c,_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x15')]);return _0x55e152(_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x15')]);}logger[_0x6fe3('0x13')](_0x6fe3('0xe'),_0x36998c,_0x5242de[_0x6fe3('0x13')][_0x6fe3('0x15')]);return _0x3b725c(_0x5242de['error']['message']);}else{logger[_0x6fe3('0xd')]('VoiceContext,\x20%s,\x20%s',_0x36998c,_0x6fe3('0xf'));_0x3b725c(_0x5242de[_0x6fe3('0x16')][_0x6fe3('0x15')]);}})[_0x6fe3('0x17')](function(_0x5dea64){logger[_0x6fe3('0x13')](_0x6fe3('0xe'),_0x36998c,_0x5dea64);_0x55e152(_0x5dea64);});});} \ No newline at end of file +var _0x0a6b=['http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\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','jayson/promise'];(function(_0x3f4d09,_0x21635c){var _0x1737c1=function(_0x2dd223){while(--_0x2dd223){_0x3f4d09['push'](_0x3f4d09['shift']());}};_0x1737c1(++_0x21635c);}(_0x0a6b,0x120));var _0xb0a6=function(_0x261a4a,_0x389a4f){_0x261a4a=_0x261a4a-0x0;var _0xc8d5b4=_0x0a6b[_0x261a4a];return _0xc8d5b4;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require(_0xb0a6('0x1'));var BPromise=require(_0xb0a6('0x2'));var rs=require(_0xb0a6('0x3'));var fs=require('fs');var Redis=require(_0xb0a6('0x4'));var db=require(_0xb0a6('0x5'))['db'];var utils=require(_0xb0a6('0x6'));var logger=require(_0xb0a6('0x7'))(_0xb0a6('0x8'));var config=require(_0xb0a6('0x9'));var jayson=require(_0xb0a6('0xa'));var client=jayson['client'][_0xb0a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x504a45,_0x23e004,_0x490cfc){return new BPromise(function(_0x597b68,_0xdaa894){return client['request'](_0x504a45,_0x490cfc)[_0xb0a6('0xc')](function(_0x423683){logger['info'](_0xb0a6('0xd'),_0x23e004,_0xb0a6('0xe'));logger['debug'](_0xb0a6('0xf'),_0x23e004,_0xb0a6('0xe'),JSON[_0xb0a6('0x10')](_0x423683));if(_0x423683[_0xb0a6('0x11')]){if(_0x423683[_0xb0a6('0x11')][_0xb0a6('0x12')]===0x1f4){logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x423683['error'][_0xb0a6('0x13')]);return _0xdaa894(_0x423683[_0xb0a6('0x11')][_0xb0a6('0x13')]);}logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x423683['error'][_0xb0a6('0x13')]);return _0x597b68(_0x423683[_0xb0a6('0x11')]['message']);}else{logger[_0xb0a6('0x14')]('VoiceContext,\x20%s,\x20%s',_0x23e004,'request\x20sent');_0x597b68(_0x423683[_0xb0a6('0x15')][_0xb0a6('0x13')]);}})[_0xb0a6('0x16')](function(_0x2ef938){logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x2ef938);_0xdaa894(_0x2ef938);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b3682d2..8b27bdf 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 _0x59a0=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0xbd9d14,_0x399efb){var _0x382602=function(_0x2ca7e1){while(--_0x2ca7e1){_0xbd9d14['push'](_0xbd9d14['shift']());}};_0x382602(++_0x399efb);}(_0x59a0,0x184));var _0x059a=function(_0x4ad5a2,_0x2f7245){_0x4ad5a2=_0x4ad5a2-0x0;var _0x1bdbe6=_0x59a0[_0x4ad5a2];return _0x1bdbe6;};'use strict';var multer=require(_0x059a('0x0'));var util=require(_0x059a('0x1'));var path=require(_0x059a('0x2'));var timeout=require('connect-timeout');var express=require(_0x059a('0x3'));var router=express[_0x059a('0x4')]();var fs_extra=require(_0x059a('0x5'));var auth=require(_0x059a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x059a('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x059a('0x8')](),controller['index']);router[_0x059a('0x9')](_0x059a('0xa'),auth[_0x059a('0x8')](),controller[_0x059a('0xb')]);router[_0x059a('0x9')](_0x059a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x059a('0xd')]('/',auth[_0x059a('0x8')](),controller[_0x059a('0xe')]);router[_0x059a('0xf')](_0x059a('0xc'),auth[_0x059a('0x8')](),controller[_0x059a('0x10')]);router[_0x059a('0x11')]('/:id',auth[_0x059a('0x8')](),controller[_0x059a('0x12')]);module[_0x059a('0x13')]=router; \ No newline at end of file +var _0xbfc2=['post','create','put','/:id','update','delete','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','get'];(function(_0x11d075,_0x393f84){var _0x2d3908=function(_0x483bbf){while(--_0x483bbf){_0x11d075['push'](_0x11d075['shift']());}};_0x2d3908(++_0x393f84);}(_0xbfc2,0xcc));var _0x2bfc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xbfc2[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x2bfc('0x0'));var path=require(_0x2bfc('0x1'));var timeout=require('connect-timeout');var express=require(_0x2bfc('0x2'));var router=express[_0x2bfc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2bfc('0x4'));var interaction=require(_0x2bfc('0x5'));var config=require(_0x2bfc('0x6'));var controller=require(_0x2bfc('0x7'));router['get']('/',auth[_0x2bfc('0x8')](),controller[_0x2bfc('0x9')]);router['get'](_0x2bfc('0xa'),auth[_0x2bfc('0x8')](),controller['describe']);router[_0x2bfc('0xb')]('/:id',auth[_0x2bfc('0x8')](),controller['show']);router[_0x2bfc('0xc')]('/',auth['isAuthenticated'](),controller[_0x2bfc('0xd')]);router[_0x2bfc('0xe')](_0x2bfc('0xf'),auth[_0x2bfc('0x8')](),controller[_0x2bfc('0x10')]);router[_0x2bfc('0x11')]('/:id',auth[_0x2bfc('0x8')](),controller['destroy']);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 e3baee6..e806177 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 _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x103f99,_0x447300){var _0x4a972b=function(_0x1ef0c8){while(--_0x1ef0c8){_0x103f99['push'](_0x103f99['shift']());}};_0x4a972b(++_0x447300);}(_0xa41a,0x6b));var _0xaa41=function(_0x3d7668,_0x5eb4e6){_0x3d7668=_0x3d7668-0x0;var _0x3d6711=_0xa41a[_0x3d7668];return _0x3d6711;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file +var _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x23ce52,_0x3e568e){var _0x543721=function(_0x3b1e99){while(--_0x3b1e99){_0x23ce52['push'](_0x23ce52['shift']());}};_0x543721(++_0x3e568e);}(_0xb821,0xa7));var _0x1b82=function(_0x5e5c26,_0x40beba){_0x5e5c26=_0x5e5c26-0x0;var _0x1f25fc=_0xb821[_0x5e5c26];return _0x1f25fc;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index fd6ac6c..d1c65f3 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 _0xdbc9=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','save','update','then','destroy','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','describe','rimraf','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdbc9,0x1b4));var _0x9dbc=function(_0x22fcfa,_0x217372){_0x22fcfa=_0x22fcfa-0x0;var _0x4ebc17=_0xdbc9[_0x22fcfa];return _0x4ebc17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9dbc('0x1'));var moment=require(_0x9dbc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9dbc('0x3'));var util=require(_0x9dbc('0x4'));var path=require(_0x9dbc('0x5'));var sox=require(_0x9dbc('0x6'));var csv=require(_0x9dbc('0x7'));var ejs=require(_0x9dbc('0x8'));var fs=require('fs');var fs_extra=require(_0x9dbc('0x9'));var _=require(_0x9dbc('0xa'));var squel=require(_0x9dbc('0xb'));var crypto=require(_0x9dbc('0xc'));var jsforce=require(_0x9dbc('0xd'));var deskjs=require(_0x9dbc('0xe'));var toCsv=require(_0x9dbc('0x7'));var querystring=require(_0x9dbc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9dbc('0x10'));var qs=require(_0x9dbc('0x11'));var as=require(_0x9dbc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dbc('0x13'))(_0x9dbc('0x14'));var utils=require(_0x9dbc('0x15'));var config=require(_0x9dbc('0x16'));var licenseUtil=require(_0x9dbc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2677,_0x428acd){_0x428acd=_0x428acd||0xcc;return function(_0x4978b2){if(_0x4978b2){return _0x4c2677[_0x9dbc('0x18')](_0x428acd);}return _0x4c2677[_0x9dbc('0x19')](_0x428acd)[_0x9dbc('0x1a')]();};}function respondWithResult(_0x1cce1a,_0x1bb901){_0x1bb901=_0x1bb901||0xc8;return function(_0x8b71c0){if(_0x8b71c0){return _0x1cce1a[_0x9dbc('0x19')](_0x1bb901)['json'](_0x8b71c0);}};}function respondWithFilteredResult(_0xc73906,_0x1fc8fb){return function(_0x321d23){if(_0x321d23){var _0x585580=typeof _0x1fc8fb['offset']===_0x9dbc('0x1b')&&typeof _0x1fc8fb[_0x9dbc('0x1c')]==='undefined';var _0x2e585a=_0x321d23[_0x9dbc('0x1d')];var _0x4952a8=_0x585580?0x0:_0x1fc8fb[_0x9dbc('0x1e')];var _0x235044=_0x585580?_0x321d23[_0x9dbc('0x1d')]:_0x1fc8fb[_0x9dbc('0x1e')]+_0x1fc8fb[_0x9dbc('0x1c')];var _0x4e9101;if(_0x235044>=_0x2e585a){_0x235044=_0x2e585a;_0x4e9101=0xc8;}else{_0x4e9101=0xce;}_0xc73906[_0x9dbc('0x19')](_0x4e9101);return _0xc73906['set'](_0x9dbc('0x1f'),_0x4952a8+'-'+_0x235044+'/'+_0x2e585a)['json'](_0x321d23);}return null;};}function patchUpdates(_0x31d0c2){return function(_0x52b34b){try{jsonpatch['apply'](_0x52b34b,_0x31d0c2,!![]);}catch(_0x22ff51){return BPromise['reject'](_0x22ff51);}return _0x52b34b[_0x9dbc('0x20')]();};}function saveUpdates(_0xbcc904,_0x2dc300){return function(_0x5df5da){if(_0x5df5da){return _0x5df5da[_0x9dbc('0x21')](_0xbcc904)[_0x9dbc('0x22')](function(_0x103617){return _0x103617;});}return null;};}function removeEntity(_0x19e449,_0x592324){return function(_0x51f946){if(_0x51f946){return _0x51f946[_0x9dbc('0x23')]()[_0x9dbc('0x22')](function(){_0x19e449[_0x9dbc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38be33,_0x484a52){return function(_0x43d63c){if(!_0x43d63c){_0x38be33[_0x9dbc('0x18')](0x194);}return _0x43d63c;};}function handleError(_0x31e533,_0x21d3c8){_0x21d3c8=_0x21d3c8||0x1f4;return function(_0x8d551f){logger['error'](_0x8d551f[_0x9dbc('0x24')]);if(_0x8d551f[_0x9dbc('0x25')]){delete _0x8d551f[_0x9dbc('0x25')];}_0x31e533[_0x9dbc('0x19')](_0x21d3c8)[_0x9dbc('0x26')](_0x8d551f);};}exports[_0x9dbc('0x27')]=function(_0x235970,_0x4ee081){var _0x5be05b={},_0xb5ba12={},_0x29f807={'count':0x0,'rows':[]};var _0x175bbb=_[_0x9dbc('0x28')](db[_0x9dbc('0x29')][_0x9dbc('0x2a')],function(_0xb59574){return{'name':_0xb59574[_0x9dbc('0x2b')],'type':_0xb59574[_0x9dbc('0x2c')][_0x9dbc('0x2d')]};});_0xb5ba12[_0x9dbc('0x2e')]=_[_0x9dbc('0x28')](_0x175bbb,'name');_0xb5ba12['query']=_[_0x9dbc('0x2f')](_0x235970[_0x9dbc('0x30')]);_0xb5ba12[_0x9dbc('0x31')]=_['intersection'](_0xb5ba12['model'],_0xb5ba12[_0x9dbc('0x30')]);_0x5be05b[_0x9dbc('0x32')]=_[_0x9dbc('0x33')](_0xb5ba12[_0x9dbc('0x2e')],qs['fields'](_0x235970[_0x9dbc('0x30')]['fields']));_0x5be05b[_0x9dbc('0x32')]=_0x5be05b[_0x9dbc('0x32')][_0x9dbc('0x34')]?_0x5be05b[_0x9dbc('0x32')]:_0xb5ba12[_0x9dbc('0x2e')];if(!_0x235970[_0x9dbc('0x30')]['hasOwnProperty'](_0x9dbc('0x35'))){_0x5be05b[_0x9dbc('0x1c')]=qs['limit'](_0x235970['query'][_0x9dbc('0x1c')]);_0x5be05b[_0x9dbc('0x1e')]=qs['offset'](_0x235970[_0x9dbc('0x30')][_0x9dbc('0x1e')]);}_0x5be05b['order']=qs['sort'](_0x235970['query'][_0x9dbc('0x36')]);_0x5be05b['where']=qs['filters'](_[_0x9dbc('0x37')](_0x235970['query'],_0xb5ba12[_0x9dbc('0x31')]),_0x175bbb);if(_0x235970[_0x9dbc('0x30')][_0x9dbc('0x38')]){_0x5be05b[_0x9dbc('0x39')]=_[_0x9dbc('0x3a')](_0x5be05b['where'],{'$or':_['map'](_0x175bbb,function(_0x2cedb3){if(_0x2cedb3[_0x9dbc('0x2c')]!==_0x9dbc('0x3b')){var _0x35ee2d={};_0x35ee2d[_0x2cedb3['name']]={'$like':'%'+_0x235970['query'][_0x9dbc('0x38')]+'%'};return _0x35ee2d;}})});}_0x5be05b=_['merge']({},_0x5be05b,_0x235970[_0x9dbc('0x3c')]);var _0x3a429b={'where':_0x5be05b[_0x9dbc('0x39')]};return db[_0x9dbc('0x29')][_0x9dbc('0x1d')](_0x3a429b)[_0x9dbc('0x22')](function(_0x488227){_0x29f807[_0x9dbc('0x1d')]=_0x488227;if(_0x235970[_0x9dbc('0x30')][_0x9dbc('0x3d')]){_0x5be05b['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x9dbc('0x3e')](_0x5be05b);})['then'](function(_0x295711){_0x29f807[_0x9dbc('0x3f')]=_0x295711;return _0x29f807;})['then'](respondWithFilteredResult(_0x4ee081,_0x5be05b))[_0x9dbc('0x40')](handleError(_0x4ee081,null));};exports[_0x9dbc('0x41')]=function(_0x33c04d,_0x9b6e2f){var _0x1b25fd={'raw':!![],'where':{'id':_0x33c04d['params']['id']}},_0x55c97f={};_0x55c97f[_0x9dbc('0x2e')]=_[_0x9dbc('0x2f')](db[_0x9dbc('0x29')][_0x9dbc('0x2a')]);_0x55c97f[_0x9dbc('0x30')]=_['keys'](_0x33c04d[_0x9dbc('0x30')]);_0x55c97f[_0x9dbc('0x31')]=_[_0x9dbc('0x33')](_0x55c97f[_0x9dbc('0x2e')],_0x55c97f[_0x9dbc('0x30')]);_0x1b25fd[_0x9dbc('0x32')]=_[_0x9dbc('0x33')](_0x55c97f[_0x9dbc('0x2e')],qs[_0x9dbc('0x42')](_0x33c04d[_0x9dbc('0x30')][_0x9dbc('0x42')]));_0x1b25fd[_0x9dbc('0x32')]=_0x1b25fd[_0x9dbc('0x32')][_0x9dbc('0x34')]?_0x1b25fd['attributes']:_0x55c97f[_0x9dbc('0x2e')];if(_0x33c04d['query'][_0x9dbc('0x3d')]){_0x1b25fd[_0x9dbc('0x43')]=[{'all':!![]}];}_0x1b25fd=_['merge']({},_0x1b25fd,_0x33c04d[_0x9dbc('0x3c')]);return db[_0x9dbc('0x29')][_0x9dbc('0x44')](_0x1b25fd)[_0x9dbc('0x22')](handleEntityNotFound(_0x9b6e2f,null))['then'](respondWithResult(_0x9b6e2f,null))[_0x9dbc('0x40')](handleError(_0x9b6e2f,null));};exports[_0x9dbc('0x45')]=function(_0xf31301,_0x38c823){return db[_0x9dbc('0x29')][_0x9dbc('0x45')](_0xf31301['body'],{})[_0x9dbc('0x22')](respondWithResult(_0x38c823,0xc9))[_0x9dbc('0x40')](handleError(_0x38c823,null));};exports['update']=function(_0x319268,_0x15d627){if(_0x319268[_0x9dbc('0x46')]['id']){delete _0x319268[_0x9dbc('0x46')]['id'];}return db[_0x9dbc('0x29')]['find']({'where':{'id':_0x319268[_0x9dbc('0x47')]['id']}})[_0x9dbc('0x22')](handleEntityNotFound(_0x15d627,null))[_0x9dbc('0x22')](saveUpdates(_0x319268[_0x9dbc('0x46')],null))[_0x9dbc('0x22')](respondWithResult(_0x15d627,null))['catch'](handleError(_0x15d627,null));};exports[_0x9dbc('0x23')]=function(_0xe78e0,_0x532944){return db[_0x9dbc('0x29')][_0x9dbc('0x44')]({'where':{'id':_0xe78e0[_0x9dbc('0x47')]['id']}})['then'](handleEntityNotFound(_0x532944,null))[_0x9dbc('0x22')](removeEntity(_0x532944,null))[_0x9dbc('0x40')](handleError(_0x532944,null));};exports[_0x9dbc('0x48')]=function(_0x5a71de,_0x500ead){return db[_0x9dbc('0x29')][_0x9dbc('0x48')]()['then'](respondWithResult(_0x500ead,null))['catch'](handleError(_0x500ead,null));}; \ No newline at end of file +var _0x2d3d=['options','VoiceDialReport','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x19bd47,_0x24570f){var _0x2f4d65=function(_0x1fbe0f){while(--_0x1fbe0f){_0x19bd47['push'](_0x19bd47['shift']());}};_0x2f4d65(++_0x24570f);}(_0x2d3d,0x1e4));var _0xd2d3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2d3d[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xd2d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd2d3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2d3('0x2'));var BPromise=require(_0xd2d3('0x3'));var Mustache=require(_0xd2d3('0x4'));var util=require(_0xd2d3('0x5'));var path=require(_0xd2d3('0x6'));var sox=require(_0xd2d3('0x7'));var csv=require(_0xd2d3('0x8'));var ejs=require(_0xd2d3('0x9'));var fs=require('fs');var fs_extra=require(_0xd2d3('0xa'));var _=require(_0xd2d3('0xb'));var squel=require(_0xd2d3('0xc'));var crypto=require(_0xd2d3('0xd'));var jsforce=require(_0xd2d3('0xe'));var deskjs=require(_0xd2d3('0xf'));var toCsv=require(_0xd2d3('0x8'));var querystring=require(_0xd2d3('0x10'));var Papa=require(_0xd2d3('0x11'));var Redis=require(_0xd2d3('0x12'));var authService=require(_0xd2d3('0x13'));var qs=require(_0xd2d3('0x14'));var as=require(_0xd2d3('0x15'));var hardwareService=require(_0xd2d3('0x16'));var logger=require(_0xd2d3('0x17'))(_0xd2d3('0x18'));var utils=require(_0xd2d3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd2d3('0x1a'));var db=require(_0xd2d3('0x1b'))['db'];function respondWithStatusCode(_0x2c26b5,_0xcce441){_0xcce441=_0xcce441||0xcc;return function(_0x398a6b){if(_0x398a6b){return _0x2c26b5['sendStatus'](_0xcce441);}return _0x2c26b5[_0xd2d3('0x1c')](_0xcce441)[_0xd2d3('0x1d')]();};}function respondWithResult(_0x302127,_0x2fd36b){_0x2fd36b=_0x2fd36b||0xc8;return function(_0x505d75){if(_0x505d75){return _0x302127[_0xd2d3('0x1c')](_0x2fd36b)[_0xd2d3('0x1e')](_0x505d75);}};}function respondWithFilteredResult(_0x5acf2e,_0x3b7fa8){return function(_0x2a0a12){if(_0x2a0a12){var _0xd1e523=typeof _0x3b7fa8['offset']===_0xd2d3('0x1f')&&typeof _0x3b7fa8[_0xd2d3('0x20')]===_0xd2d3('0x1f');var _0x2ff5b0=_0x2a0a12[_0xd2d3('0x21')];var _0x511410=_0xd1e523?0x0:_0x3b7fa8[_0xd2d3('0x22')];var _0x1623a8=_0xd1e523?_0x2a0a12[_0xd2d3('0x21')]:_0x3b7fa8['offset']+_0x3b7fa8[_0xd2d3('0x20')];var _0x720ee4;if(_0x1623a8>=_0x2ff5b0){_0x1623a8=_0x2ff5b0;_0x720ee4=0xc8;}else{_0x720ee4=0xce;}_0x5acf2e['status'](_0x720ee4);return _0x5acf2e[_0xd2d3('0x23')](_0xd2d3('0x24'),_0x511410+'-'+_0x1623a8+'/'+_0x2ff5b0)['json'](_0x2a0a12);}return null;};}function patchUpdates(_0x247821){return function(_0x178aff){try{jsonpatch[_0xd2d3('0x25')](_0x178aff,_0x247821,!![]);}catch(_0x57ea9f){return BPromise['reject'](_0x57ea9f);}return _0x178aff['save']();};}function saveUpdates(_0x21bb51,_0x13661c){return function(_0x373d0b){if(_0x373d0b){return _0x373d0b[_0xd2d3('0x26')](_0x21bb51)['then'](function(_0x150c9f){return _0x150c9f;});}return null;};}function removeEntity(_0x4ee466,_0x856f0f){return function(_0x25d466){if(_0x25d466){return _0x25d466[_0xd2d3('0x27')]()['then'](function(){_0x4ee466[_0xd2d3('0x1c')](0xcc)[_0xd2d3('0x1d')]();});}};}function handleEntityNotFound(_0x1b1745,_0x3514ba){return function(_0x730637){if(!_0x730637){_0x1b1745['sendStatus'](0x194);}return _0x730637;};}function handleError(_0x5f0b4c,_0x3b74d7){_0x3b74d7=_0x3b74d7||0x1f4;return function(_0x176c84){logger['error'](_0x176c84[_0xd2d3('0x28')]);if(_0x176c84[_0xd2d3('0x29')]){delete _0x176c84[_0xd2d3('0x29')];}_0x5f0b4c[_0xd2d3('0x1c')](_0x3b74d7)['send'](_0x176c84);};}exports[_0xd2d3('0x2a')]=function(_0x1cb4d9,_0x7c3cc1){var _0x21cb9d={},_0x3affeb={},_0x4c7b9b={'count':0x0,'rows':[]};var _0x553dd6=_[_0xd2d3('0x2b')](db['VoiceDialReport']['rawAttributes'],function(_0x7b9bbb){return{'name':_0x7b9bbb[_0xd2d3('0x2c')],'type':_0x7b9bbb[_0xd2d3('0x2d')][_0xd2d3('0x2e')]};});_0x3affeb[_0xd2d3('0x2f')]=_[_0xd2d3('0x2b')](_0x553dd6,_0xd2d3('0x29'));_0x3affeb[_0xd2d3('0x30')]=_['keys'](_0x1cb4d9['query']);_0x3affeb[_0xd2d3('0x31')]=_['intersection'](_0x3affeb[_0xd2d3('0x2f')],_0x3affeb['query']);_0x21cb9d['attributes']=_[_0xd2d3('0x32')](_0x3affeb[_0xd2d3('0x2f')],qs[_0xd2d3('0x33')](_0x1cb4d9[_0xd2d3('0x30')][_0xd2d3('0x33')]));_0x21cb9d['attributes']=_0x21cb9d[_0xd2d3('0x34')]['length']?_0x21cb9d[_0xd2d3('0x34')]:_0x3affeb['model'];if(!_0x1cb4d9[_0xd2d3('0x30')][_0xd2d3('0x35')](_0xd2d3('0x36'))){_0x21cb9d[_0xd2d3('0x20')]=qs[_0xd2d3('0x20')](_0x1cb4d9['query'][_0xd2d3('0x20')]);_0x21cb9d[_0xd2d3('0x22')]=qs['offset'](_0x1cb4d9[_0xd2d3('0x30')][_0xd2d3('0x22')]);}_0x21cb9d[_0xd2d3('0x37')]=qs[_0xd2d3('0x38')](_0x1cb4d9['query']['sort']);_0x21cb9d[_0xd2d3('0x39')]=qs[_0xd2d3('0x31')](_[_0xd2d3('0x3a')](_0x1cb4d9['query'],_0x3affeb[_0xd2d3('0x31')]),_0x553dd6);if(_0x1cb4d9[_0xd2d3('0x30')][_0xd2d3('0x3b')]){_0x21cb9d[_0xd2d3('0x39')]=_[_0xd2d3('0x3c')](_0x21cb9d['where'],{'$or':_['map'](_0x553dd6,function(_0x4038d4){if(_0x4038d4[_0xd2d3('0x2d')]!==_0xd2d3('0x3d')){var _0x22fe1d={};_0x22fe1d[_0x4038d4[_0xd2d3('0x29')]]={'$like':'%'+_0x1cb4d9[_0xd2d3('0x30')]['filter']+'%'};return _0x22fe1d;}})});}_0x21cb9d=_['merge']({},_0x21cb9d,_0x1cb4d9[_0xd2d3('0x3e')]);var _0x58dbe1={'where':_0x21cb9d['where']};return db[_0xd2d3('0x3f')][_0xd2d3('0x21')](_0x58dbe1)[_0xd2d3('0x40')](function(_0x5e906b){_0x4c7b9b[_0xd2d3('0x21')]=_0x5e906b;if(_0x1cb4d9[_0xd2d3('0x30')][_0xd2d3('0x41')]){_0x21cb9d[_0xd2d3('0x42')]=[{'all':!![]}];}return db[_0xd2d3('0x3f')][_0xd2d3('0x43')](_0x21cb9d);})[_0xd2d3('0x40')](function(_0x56194d){_0x4c7b9b[_0xd2d3('0x44')]=_0x56194d;return _0x4c7b9b;})[_0xd2d3('0x40')](respondWithFilteredResult(_0x7c3cc1,_0x21cb9d))[_0xd2d3('0x45')](handleError(_0x7c3cc1,null));};exports[_0xd2d3('0x46')]=function(_0x308eb7,_0xbdcbf3){var _0x597ef1={'raw':!![],'where':{'id':_0x308eb7[_0xd2d3('0x47')]['id']}},_0x31ba89={};_0x31ba89[_0xd2d3('0x2f')]=_[_0xd2d3('0x48')](db[_0xd2d3('0x3f')][_0xd2d3('0x49')]);_0x31ba89[_0xd2d3('0x30')]=_[_0xd2d3('0x48')](_0x308eb7[_0xd2d3('0x30')]);_0x31ba89[_0xd2d3('0x31')]=_[_0xd2d3('0x32')](_0x31ba89[_0xd2d3('0x2f')],_0x31ba89[_0xd2d3('0x30')]);_0x597ef1[_0xd2d3('0x34')]=_[_0xd2d3('0x32')](_0x31ba89[_0xd2d3('0x2f')],qs[_0xd2d3('0x33')](_0x308eb7[_0xd2d3('0x30')][_0xd2d3('0x33')]));_0x597ef1[_0xd2d3('0x34')]=_0x597ef1[_0xd2d3('0x34')]['length']?_0x597ef1[_0xd2d3('0x34')]:_0x31ba89['model'];if(_0x308eb7[_0xd2d3('0x30')]['includeAll']){_0x597ef1['include']=[{'all':!![]}];}_0x597ef1=_[_0xd2d3('0x3c')]({},_0x597ef1,_0x308eb7['options']);return db[_0xd2d3('0x3f')][_0xd2d3('0x4a')](_0x597ef1)[_0xd2d3('0x40')](handleEntityNotFound(_0xbdcbf3,null))[_0xd2d3('0x40')](respondWithResult(_0xbdcbf3,null))['catch'](handleError(_0xbdcbf3,null));};exports[_0xd2d3('0x4b')]=function(_0x4c542e,_0x42d7a9){return db['VoiceDialReport'][_0xd2d3('0x4b')](_0x4c542e['body'],{})[_0xd2d3('0x40')](respondWithResult(_0x42d7a9,0xc9))[_0xd2d3('0x45')](handleError(_0x42d7a9,null));};exports[_0xd2d3('0x26')]=function(_0x4d6c97,_0xc4625b){if(_0x4d6c97[_0xd2d3('0x4c')]['id']){delete _0x4d6c97[_0xd2d3('0x4c')]['id'];}return db[_0xd2d3('0x3f')][_0xd2d3('0x4a')]({'where':{'id':_0x4d6c97[_0xd2d3('0x47')]['id']}})[_0xd2d3('0x40')](handleEntityNotFound(_0xc4625b,null))[_0xd2d3('0x40')](saveUpdates(_0x4d6c97[_0xd2d3('0x4c')],null))[_0xd2d3('0x40')](respondWithResult(_0xc4625b,null))['catch'](handleError(_0xc4625b,null));};exports[_0xd2d3('0x27')]=function(_0x159d60,_0x22e3fd){return db[_0xd2d3('0x3f')]['find']({'where':{'id':_0x159d60['params']['id']}})[_0xd2d3('0x40')](handleEntityNotFound(_0x22e3fd,null))[_0xd2d3('0x40')](removeEntity(_0x22e3fd,null))[_0xd2d3('0x45')](handleError(_0x22e3fd,null));};exports[_0xd2d3('0x4d')]=function(_0x2c1695,_0x131266){return db[_0xd2d3('0x3f')][_0xd2d3('0x4d')]()['then'](respondWithResult(_0x131266,null))[_0xd2d3('0x45')](handleError(_0x131266,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5391661..2328e95 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 _0x18fe=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x80ba8c,_0x5a0c71){var _0x1c8d12=function(_0xc848c9){while(--_0xc848c9){_0x80ba8c['push'](_0x80ba8c['shift']());}};_0x1c8d12(++_0x5a0c71);}(_0x18fe,0x13a));var _0xe18f=function(_0x4e4c4e,_0x24e8d6){_0x4e4c4e=_0x4e4c4e-0x0;var _0x5d04d7=_0x18fe[_0x4e4c4e];return _0x5d04d7;};'use strict';var _=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var logger=require(_0xe18f('0x2'))(_0xe18f('0x3'));var moment=require(_0xe18f('0x4'));var BPromise=require(_0xe18f('0x5'));var rp=require(_0xe18f('0x6'));var fs=require('fs');var path=require(_0xe18f('0x7'));var rimraf=require(_0xe18f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe18f('0x9'));module[_0xe18f('0xa')]=function(_0x5ba26c,_0x227062){return _0x5ba26c[_0xe18f('0xb')](_0xe18f('0xc'),attributes,{'tableName':_0xe18f('0xd'),'paranoid':![],'indexes':[{'fields':[_0xe18f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54b2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x54b2,0x6e));var _0x254b=function(_0x3bad07,_0x3401a1){_0x3bad07=_0x3bad07-0x0;var _0x1f5873=_0x54b2[_0x3bad07];return _0x1f5873;};'use strict';var _=require(_0x254b('0x0'));var util=require('util');var logger=require(_0x254b('0x1'))(_0x254b('0x2'));var moment=require(_0x254b('0x3'));var BPromise=require(_0x254b('0x4'));var rp=require(_0x254b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x254b('0x6'));var config=require(_0x254b('0x7'));var attributes=require(_0x254b('0x8'));module[_0x254b('0x9')]=function(_0x106c90,_0x48e16a){return _0x106c90[_0x254b('0xa')](_0x254b('0xb'),attributes,{'tableName':_0x254b('0xc'),'paranoid':![],'indexes':[{'fields':[_0x254b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9b368bd..c93a1b2 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 _0x5128=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','update','options','where','attributes','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5128,0x18d));var _0x8512=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5128[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x8512('0x0'));var util=require(_0x8512('0x1'));var moment=require('moment');var BPromise=require(_0x8512('0x2'));var rs=require(_0x8512('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8512('0x5'))(_0x8512('0x6'));var config=require(_0x8512('0x7'));var jayson=require(_0x8512('0x8'));var client=jayson[_0x8512('0x9')][_0x8512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375671,_0x2208ee,_0x45fb44){return new BPromise(function(_0x523c35,_0x428c37){return client['request'](_0x375671,_0x45fb44)[_0x8512('0xb')](function(_0x56f075){logger[_0x8512('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x2208ee,_0x8512('0xd'));logger[_0x8512('0xe')](_0x8512('0xf'),_0x2208ee,_0x8512('0xd'),JSON[_0x8512('0x10')](_0x56f075));if(_0x56f075[_0x8512('0x11')]){if(_0x56f075[_0x8512('0x11')][_0x8512('0x12')]===0x1f4){logger[_0x8512('0x11')](_0x8512('0x13'),_0x2208ee,_0x56f075[_0x8512('0x11')][_0x8512('0x14')]);return _0x428c37(_0x56f075[_0x8512('0x11')][_0x8512('0x14')]);}logger[_0x8512('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x2208ee,_0x56f075[_0x8512('0x11')][_0x8512('0x14')]);return _0x523c35(_0x56f075[_0x8512('0x11')]['message']);}else{logger[_0x8512('0xc')](_0x8512('0x13'),_0x2208ee,'request\x20sent');_0x523c35(_0x56f075[_0x8512('0x15')][_0x8512('0x14')]);}})[_0x8512('0x16')](function(_0xd773c9){logger[_0x8512('0x11')](_0x8512('0x13'),_0x2208ee,_0xd773c9);_0x428c37(_0xd773c9);});});}exports[_0x8512('0x17')]=function(_0x295d47){var _0x458b0b=this;return new Promise(function(_0x26806c,_0x3d3797){return db['VoiceDialReport'][_0x8512('0x18')](_0x295d47[_0x8512('0x19')],{'raw':_0x295d47['options']?_0x295d47['options']['raw']===undefined?!![]:![]:!![]})[_0x8512('0xb')](function(_0x3a892a){logger['info']('CreateVoiceDialReport',_0x295d47);logger['debug'](_0x8512('0x17'),_0x295d47,JSON[_0x8512('0x10')](_0x3a892a));_0x26806c(_0x3a892a);})[_0x8512('0x16')](function(_0x3a9620){logger[_0x8512('0x11')](_0x8512('0x17'),_0x3a9620[_0x8512('0x14')],_0x295d47);_0x3d3797(_0x458b0b[_0x8512('0x11')](0x1f4,_0x3a9620[_0x8512('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x3ccc5b){var _0x9fb666=this;return new Promise(function(_0x39b817,_0x14af7b){return db['VoiceDialReport'][_0x8512('0x1a')](_0x3ccc5b[_0x8512('0x19')],{'raw':_0x3ccc5b['options']?_0x3ccc5b[_0x8512('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ccc5b[_0x8512('0x1b')]?_0x3ccc5b[_0x8512('0x1b')][_0x8512('0x1c')]||null:null,'attributes':_0x3ccc5b['options']?_0x3ccc5b[_0x8512('0x1b')][_0x8512('0x1d')]||null:null,'limit':_0x3ccc5b[_0x8512('0x1b')]?_0x3ccc5b[_0x8512('0x1b')]['limit']||null:null})[_0x8512('0xb')](function(_0x46378e){logger['info'](_0x8512('0x1e'),_0x3ccc5b);logger[_0x8512('0xe')](_0x8512('0x1e'),_0x3ccc5b,JSON[_0x8512('0x10')](_0x46378e));_0x39b817(_0x46378e);})[_0x8512('0x16')](function(_0x3d196a){logger['error'](_0x8512('0x1e'),_0x3d196a[_0x8512('0x14')],_0x3ccc5b);_0x14af7b(_0x9fb666[_0x8512('0x11')](0x1f4,_0x3d196a[_0x8512('0x14')]));});});}; \ No newline at end of file +var _0x1d90=['jayson/promise','client','request','then','info','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent','result','catch','create','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x9e3d90,_0x2904a4){var _0x2de4de=function(_0x19b8ba){while(--_0x19b8ba){_0x9e3d90['push'](_0x9e3d90['shift']());}};_0x2de4de(++_0x2904a4);}(_0x1d90,0x100));var _0x01d9=function(_0xc3cacb,_0x135342){_0xc3cacb=_0xc3cacb-0x0;var _0x42d7eb=_0x1d90[_0xc3cacb];return _0x42d7eb;};'use strict';var _=require(_0x01d9('0x0'));var util=require(_0x01d9('0x1'));var moment=require(_0x01d9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01d9('0x3'));var db=require(_0x01d9('0x4'))['db'];var utils=require(_0x01d9('0x5'));var logger=require(_0x01d9('0x6'))(_0x01d9('0x7'));var config=require('../../config/environment');var jayson=require(_0x01d9('0x8'));var client=jayson[_0x01d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10ee48,_0x251eec,_0x18f3af){return new BPromise(function(_0x58d9fc,_0x4e768a){return client[_0x01d9('0xa')](_0x10ee48,_0x18f3af)[_0x01d9('0xb')](function(_0x295ad8){logger[_0x01d9('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x251eec,'request\x20sent');logger[_0x01d9('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x251eec,'request\x20sent',JSON[_0x01d9('0xe')](_0x295ad8));if(_0x295ad8[_0x01d9('0xf')]){if(_0x295ad8[_0x01d9('0xf')][_0x01d9('0x10')]===0x1f4){logger[_0x01d9('0xf')](_0x01d9('0x11'),_0x251eec,_0x295ad8[_0x01d9('0xf')][_0x01d9('0x12')]);return _0x4e768a(_0x295ad8['error'][_0x01d9('0x12')]);}logger[_0x01d9('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x251eec,_0x295ad8[_0x01d9('0xf')]['message']);return _0x58d9fc(_0x295ad8[_0x01d9('0xf')][_0x01d9('0x12')]);}else{logger[_0x01d9('0xc')](_0x01d9('0x11'),_0x251eec,_0x01d9('0x13'));_0x58d9fc(_0x295ad8[_0x01d9('0x14')]['message']);}})[_0x01d9('0x15')](function(_0x3c3ce5){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x251eec,_0x3c3ce5);_0x4e768a(_0x3c3ce5);});});}exports['CreateVoiceDialReport']=function(_0x26f5fc){var _0x131681=this;return new Promise(function(_0x4930b1,_0x35de07){return db['VoiceDialReport'][_0x01d9('0x16')](_0x26f5fc[_0x01d9('0x17')],{'raw':_0x26f5fc[_0x01d9('0x18')]?_0x26f5fc[_0x01d9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x01d9('0xb')](function(_0x219e6f){logger[_0x01d9('0xc')](_0x01d9('0x19'),_0x26f5fc);logger[_0x01d9('0xd')](_0x01d9('0x19'),_0x26f5fc,JSON[_0x01d9('0xe')](_0x219e6f));_0x4930b1(_0x219e6f);})[_0x01d9('0x15')](function(_0x388e60){logger[_0x01d9('0xf')](_0x01d9('0x19'),_0x388e60[_0x01d9('0x12')],_0x26f5fc);_0x35de07(_0x131681[_0x01d9('0xf')](0x1f4,_0x388e60[_0x01d9('0x12')]));});});};exports[_0x01d9('0x1a')]=function(_0x504afb){var _0x2a7d35=this;return new Promise(function(_0x2dab5c,_0x45ca3f){return db[_0x01d9('0x1b')][_0x01d9('0x1c')](_0x504afb[_0x01d9('0x17')],{'raw':_0x504afb['options']?_0x504afb['options'][_0x01d9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x504afb['options']?_0x504afb[_0x01d9('0x18')][_0x01d9('0x1e')]||null:null,'attributes':_0x504afb[_0x01d9('0x18')]?_0x504afb[_0x01d9('0x18')][_0x01d9('0x1f')]||null:null,'limit':_0x504afb[_0x01d9('0x18')]?_0x504afb[_0x01d9('0x18')][_0x01d9('0x20')]||null:null})['then'](function(_0x2a8856){logger[_0x01d9('0xc')]('UpdateVoiceDialReport',_0x504afb);logger['debug'](_0x01d9('0x1a'),_0x504afb,JSON[_0x01d9('0xe')](_0x2a8856));_0x2dab5c(_0x2a8856);})[_0x01d9('0x15')](function(_0x8ecfae){logger['error'](_0x01d9('0x1a'),_0x8ecfae[_0x01d9('0x12')],_0x504afb);_0x45ca3f(_0x2a7d35[_0x01d9('0xf')](0x1f4,_0x8ecfae[_0x01d9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0b3d5c6..9c7d64c 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 _0xa035=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','show','create','post','/:id/applications','addApplications','put','update','delete','exports'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0xa035,0xbd));var _0x5a03=function(_0x4e8a4c,_0x5369f4){_0x4e8a4c=_0x4e8a4c-0x0;var _0x42460e=_0xa035[_0x4e8a4c];return _0x42460e;};'use strict';var multer=require('multer');var util=require(_0x5a03('0x0'));var path=require(_0x5a03('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a03('0x2'));var router=express[_0x5a03('0x3')]();var fs_extra=require(_0x5a03('0x4'));var auth=require(_0x5a03('0x5'));var interaction=require(_0x5a03('0x6'));var config=require(_0x5a03('0x7'));var controller=require(_0x5a03('0x8'));router['get']('/',auth[_0x5a03('0x9')](),controller[_0x5a03('0xa')]);router['get'](_0x5a03('0xb'),auth[_0x5a03('0x9')](),controller[_0x5a03('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a03('0xd')]);router[_0x5a03('0xe')](_0x5a03('0xf'),auth[_0x5a03('0x9')](),controller[_0x5a03('0x10')]);router[_0x5a03('0x11')](_0x5a03('0xb'),auth['isAuthenticated'](),controller[_0x5a03('0x12')]);router[_0x5a03('0x13')](_0x5a03('0xb'),auth[_0x5a03('0x9')](),controller['destroy']);module[_0x5a03('0x14')]=router; \ No newline at end of file +var _0x9a9c=['index','/:id','show','post','isAuthenticated','create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x40835c,_0xba813e){var _0x11d003=function(_0x5480fe){while(--_0x5480fe){_0x40835c['push'](_0x40835c['shift']());}};_0x11d003(++_0xba813e);}(_0x9a9c,0x14e));var _0xc9a9=function(_0x5f04ed,_0x505adf){_0x5f04ed=_0x5f04ed-0x0;var _0x162e3f=_0x9a9c[_0x5f04ed];return _0x162e3f;};'use strict';var multer=require(_0xc9a9('0x0'));var util=require(_0xc9a9('0x1'));var path=require(_0xc9a9('0x2'));var timeout=require(_0xc9a9('0x3'));var express=require(_0xc9a9('0x4'));var router=express['Router']();var fs_extra=require(_0xc9a9('0x5'));var auth=require(_0xc9a9('0x6'));var interaction=require(_0xc9a9('0x7'));var config=require(_0xc9a9('0x8'));var controller=require(_0xc9a9('0x9'));router[_0xc9a9('0xa')]('/',auth['isAuthenticated'](),controller[_0xc9a9('0xb')]);router[_0xc9a9('0xa')](_0xc9a9('0xc'),auth['isAuthenticated'](),controller[_0xc9a9('0xd')]);router[_0xc9a9('0xe')]('/',auth[_0xc9a9('0xf')](),controller[_0xc9a9('0x10')]);router['post'](_0xc9a9('0x11'),auth[_0xc9a9('0xf')](),controller[_0xc9a9('0x12')]);router[_0xc9a9('0x13')](_0xc9a9('0xc'),auth[_0xc9a9('0xf')](),controller[_0xc9a9('0x14')]);router[_0xc9a9('0x15')](_0xc9a9('0xc'),auth[_0xc9a9('0xf')](),controller[_0xc9a9('0x16')]);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 d0c9bca..7fe52af 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 _0x28df=['outbound','internal','system','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x13f66f,_0x17bcd2){var _0x1a3b8c=function(_0x2a8ff1){while(--_0x2a8ff1){_0x13f66f['push'](_0x13f66f['shift']());}};_0x1a3b8c(++_0x17bcd2);}(_0x28df,0xd8));var _0xf28d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x28df[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'unique':_0xf28d('0x1')},'priority':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':'1','unique':_0xf28d('0x1')},'tag':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':_0xf28d('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf28d('0x3')](_0xf28d('0x4'),_0xf28d('0x5'),_0xf28d('0x6'),'inbound-fax','outbound-fax',_0xf28d('0x7'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf28d('0x0')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xf28d('0x8')]},'isApp':{'type':Sequelize[_0xf28d('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf28d('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf28d('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xf28d('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf28d('0x8')]},'recordingFormat':{'type':Sequelize[_0xf28d('0x0')],'defaultValue':_0xf28d('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xf28d('0xb')],'get':function(_0x44329e){return this[_0xf28d('0xc')]('exten');}},'alias':{'type':Sequelize[_0xf28d('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xe125=['outbound-fax','system','any','*,*,*,*','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x4baa11,_0x7c6290){var _0x219273=function(_0x4a3887){while(--_0x4a3887){_0x4baa11['push'](_0x4baa11['shift']());}};_0x219273(++_0x7c6290);}(_0xe125,0x128));var _0x5e12=function(_0x163e06,_0x4a30d6){_0x163e06=_0x163e06-0x0;var _0x15e10b=_0xe125[_0x163e06];return _0x15e10b;};'use strict';var Sequelize=require(_0x5e12('0x0'));module[_0x5e12('0x1')]={'context':{'type':Sequelize[_0x5e12('0x2')],'allowNull':![],'unique':_0x5e12('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5e12('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x5e12('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x5e12('0x3')},'tag':{'type':Sequelize[_0x5e12('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5e12('0x2')],'allowNull':![],'defaultValue':_0x5e12('0x4')},'appdata':{'type':Sequelize[_0x5e12('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5e12('0x5')](_0x5e12('0x6'),_0x5e12('0x7'),_0x5e12('0x8'),_0x5e12('0x9'),_0x5e12('0xa'),_0x5e12('0xb'),_0x5e12('0xc')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e12('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5e12('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x5e12('0x2')],'defaultValue':_0x5e12('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x5e12('0xf')],'get':function(_0x48d9ef){return this[_0x5e12('0x10')](_0x5e12('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a846f6a..bdf7485 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 _0xbb30=['./voiceExtension.socket','register','status','end','json','offset','undefined','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','map','value','includes','find','type','name','UserProfileResource','error','stack','VoiceExtension','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','length','create','startsWith','body','exten','concat','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','send','lodash','../../components/parsers/qs','api','../../config/environment','redis','socket.io-emitter'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbb30,0x1a8));var _0x0bb3=function(_0x3578c4,_0x2f5cf0){_0x3578c4=_0x3578c4-0x0;var _0x336e24=_0xbb30[_0x3578c4];return _0x336e24;};'use strict';var _=require(_0x0bb3('0x0'));var Redis=require('ioredis');var qs=require(_0x0bb3('0x1'));var logger=require('../../config/logger')(_0x0bb3('0x2'));var config=require(_0x0bb3('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0bb3('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bb3('0x5'))(new Redis(config[_0x0bb3('0x4')]));require(_0x0bb3('0x6'))[_0x0bb3('0x7')](socket);function respondWithStatusCode(_0xfa5f7d,_0x3c4c5d){_0x3c4c5d=_0x3c4c5d||0xcc;return function(_0x269fc6){if(_0x269fc6){return _0xfa5f7d['sendStatus'](_0x3c4c5d);}return _0xfa5f7d[_0x0bb3('0x8')](_0x3c4c5d)[_0x0bb3('0x9')]();};}function respondWithResult(_0x2453b,_0x15bddd){_0x15bddd=_0x15bddd||0xc8;return function(_0x321a33){if(_0x321a33){return _0x2453b[_0x0bb3('0x8')](_0x15bddd)[_0x0bb3('0xa')](_0x321a33);}};}function respondWithFilteredResult(_0x3130b4,_0x11f175){return function(_0x4375f9){if(_0x4375f9){var _0x11c20b=typeof _0x11f175[_0x0bb3('0xb')]===_0x0bb3('0xc')&&typeof _0x11f175['limit']==='undefined';var _0x573ff8=_0x4375f9['count'];var _0x31d69d=_0x11c20b?0x0:_0x11f175['offset'];var _0x440c29=_0x11c20b?_0x4375f9[_0x0bb3('0xd')]:_0x11f175[_0x0bb3('0xb')]+_0x11f175['limit'];var _0x21a8a1;if(_0x440c29>=_0x573ff8){_0x440c29=_0x573ff8;_0x21a8a1=0xc8;}else{_0x21a8a1=0xce;}_0x3130b4[_0x0bb3('0x8')](_0x21a8a1);return _0x3130b4['set'](_0x0bb3('0xe'),_0x31d69d+'-'+_0x440c29+'/'+_0x573ff8)[_0x0bb3('0xa')](_0x4375f9);}return null;};}function removeEntity(_0x4cda43){return function(_0x179c0){if(_0x179c0){return _0x179c0[_0x0bb3('0xf')]()[_0x0bb3('0x10')](function(){var _0x350e37=_0x179c0[_0x0bb3('0x11')]({'plain':!![]});var _0x26e0ab=[{'name':_0x0bb3('0x12'),'value':_0x0bb3('0x13'),'ignore':![]},{'name':_0x0bb3('0x14'),'value':_0x0bb3('0x15'),'ignore':![]},{'name':_0x0bb3('0x16'),'value':_0x0bb3('0x17'),'ignore':![]}];var _0x33af06=_(_0x26e0ab)['filter']('ignore')[_0x0bb3('0x18')](_0x0bb3('0x19'))['value']();if(_[_0x0bb3('0x1a')](_0x33af06,_0x350e37['type'])){return;}var _0x386c49=_[_0x0bb3('0x1b')](_0x26e0ab,[_0x0bb3('0x19'),_0x350e37[_0x0bb3('0x1c')]])[_0x0bb3('0x1d')];return db[_0x0bb3('0x1e')][_0x0bb3('0xf')]({'where':{'type':_0x386c49,'resourceId':_0x350e37['id']}})['then'](function(){return _0x179c0;});})[_0x0bb3('0x10')](function(){_0x4cda43[_0x0bb3('0x8')](0xcc)[_0x0bb3('0x9')]();});}};}function handleEntityNotFound(_0x1e6bb0){return function(_0x5f0766){if(!_0x5f0766){_0x1e6bb0['sendStatus'](0x194);}return _0x5f0766;};}function handleError(_0x3545f5,_0x524c05){_0x524c05=_0x524c05||0x1f4;return function(_0x13813f){logger[_0x0bb3('0x1f')](_0x13813f[_0x0bb3('0x20')]);if(_0x13813f['name']){delete _0x13813f[_0x0bb3('0x1d')];}_0x3545f5[_0x0bb3('0x8')](_0x524c05)['send'](_0x13813f);};}exports['index']=function(_0x27fd8a,_0x24f74f){var _0x3d8ff7={},_0x32bc96={},_0x3e1d07={'count':0x0,'rows':[]};var _0x4616ef=_['map'](db[_0x0bb3('0x21')]['rawAttributes'],function(_0x5c29e8){return{'name':_0x5c29e8[_0x0bb3('0x22')],'type':_0x5c29e8[_0x0bb3('0x1c')]['key']};});_0x32bc96[_0x0bb3('0x23')]=_[_0x0bb3('0x18')](_0x4616ef,'name');_0x32bc96[_0x0bb3('0x24')]=_[_0x0bb3('0x25')](_0x27fd8a[_0x0bb3('0x24')]);_0x32bc96[_0x0bb3('0x26')]=_[_0x0bb3('0x27')](_0x32bc96[_0x0bb3('0x23')],_0x32bc96[_0x0bb3('0x24')]);_0x3d8ff7[_0x0bb3('0x28')]=_[_0x0bb3('0x27')](_0x32bc96[_0x0bb3('0x23')],qs[_0x0bb3('0x29')](_0x27fd8a['query'][_0x0bb3('0x29')]));_0x3d8ff7[_0x0bb3('0x28')]=_0x3d8ff7['attributes']['length']?_0x3d8ff7['attributes']:_0x32bc96[_0x0bb3('0x23')];if(!_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x2a')](_0x0bb3('0x2b'))){_0x3d8ff7[_0x0bb3('0x2c')]=qs[_0x0bb3('0x2c')](_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x2c')]);_0x3d8ff7[_0x0bb3('0xb')]=qs['offset'](_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0xb')]);}_0x3d8ff7['order']=qs['sort'](_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x2d')]);_0x3d8ff7[_0x0bb3('0x2e')]=qs[_0x0bb3('0x26')](_['pick'](_0x27fd8a[_0x0bb3('0x24')],_0x32bc96[_0x0bb3('0x26')]),_0x4616ef);if(_0x27fd8a['query']['filter']){_0x3d8ff7[_0x0bb3('0x2e')]=_[_0x0bb3('0x2f')](_0x3d8ff7[_0x0bb3('0x2e')],{'$or':_[_0x0bb3('0x18')](_0x4616ef,function(_0x2494b9){if(_0x2494b9[_0x0bb3('0x1c')]!==_0x0bb3('0x30')){var _0x3392cd={};_0x3392cd[_0x2494b9[_0x0bb3('0x1d')]]={'$like':'%'+_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x31')]+'%'};return _0x3392cd;}})});}_0x3d8ff7=_['merge']({},_0x3d8ff7,_0x27fd8a[_0x0bb3('0x32')]);var _0x2faf0c={'where':_0x3d8ff7['where']};return db[_0x0bb3('0x21')][_0x0bb3('0xd')](_0x2faf0c)[_0x0bb3('0x10')](function(_0x167b26){_0x3e1d07[_0x0bb3('0xd')]=_0x167b26;if(_0x27fd8a[_0x0bb3('0x24')][_0x0bb3('0x33')]){_0x3d8ff7[_0x0bb3('0x34')]=[{'all':!![]}];}return db[_0x0bb3('0x21')][_0x0bb3('0x35')](_0x3d8ff7);})[_0x0bb3('0x10')](function(_0x368176){_0x3e1d07[_0x0bb3('0x36')]=_0x368176;return _0x3e1d07;})[_0x0bb3('0x10')](respondWithFilteredResult(_0x24f74f,_0x3d8ff7))[_0x0bb3('0x37')](handleError(_0x24f74f,null));};exports['show']=function(_0x3451b6,_0x5da73e){var _0x595104={'raw':![],'where':{'id':_0x3451b6[_0x0bb3('0x38')]['id']}},_0x41c84f={};_0x41c84f['model']=_['keys'](db['VoiceExtension']['rawAttributes']);_0x41c84f[_0x0bb3('0x24')]=_[_0x0bb3('0x25')](_0x3451b6[_0x0bb3('0x24')]);_0x41c84f['filters']=_[_0x0bb3('0x27')](_0x41c84f[_0x0bb3('0x23')],_0x41c84f[_0x0bb3('0x24')]);_0x595104[_0x0bb3('0x28')]=_['intersection'](_0x41c84f[_0x0bb3('0x23')],qs['fields'](_0x3451b6['query'][_0x0bb3('0x29')]));_0x595104[_0x0bb3('0x28')]=_0x595104[_0x0bb3('0x28')][_0x0bb3('0x39')]?_0x595104['attributes']:_0x41c84f[_0x0bb3('0x23')];if(_0x3451b6[_0x0bb3('0x24')][_0x0bb3('0x33')]){_0x595104['include']=[{'all':!![]}];}_0x595104=_['merge']({},_0x595104,_0x3451b6[_0x0bb3('0x32')]);return db[_0x0bb3('0x21')][_0x0bb3('0x1b')](_0x595104)[_0x0bb3('0x10')](handleEntityNotFound(_0x5da73e,null))['then'](respondWithResult(_0x5da73e,null))['catch'](handleError(_0x5da73e,null));};exports[_0x0bb3('0xf')]=function(_0x51860d,_0x4b5403){return db[_0x0bb3('0x21')][_0x0bb3('0x1b')]({'where':{'id':_0x51860d[_0x0bb3('0x38')]['id']}})['then'](handleEntityNotFound(_0x4b5403,null))[_0x0bb3('0x10')](removeEntity(_0x4b5403,null))[_0x0bb3('0x37')](handleError(_0x4b5403,null));};exports[_0x0bb3('0x3a')]=function(_0x2a636f,_0x2122e0){if(_0x2a636f['body']['type']===_0x0bb3('0x15')&&!_[_0x0bb3('0x3b')](_0x2a636f['body']['exten'],'_')){_0x2a636f[_0x0bb3('0x3c')][_0x0bb3('0x3d')]='_'[_0x0bb3('0x3e')](_0x2a636f['body'][_0x0bb3('0x3d')]);}return db[_0x0bb3('0x21')][_0x0bb3('0x3a')](_0x2a636f[_0x0bb3('0x3c')],{'raw':![]})[_0x0bb3('0x10')](function(_0x304d9d){var _0x47b382=_0x2a636f[_0x0bb3('0x3f')][_0x0bb3('0x11')]({'plain':!![]});if(!_0x47b382)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47b382[_0x0bb3('0x40')]===_0x0bb3('0x3f')){var _0x21b3b1=_0x304d9d['get']({'plain':!![]});var _0xbebb73=[{'name':_0x0bb3('0x12'),'value':_0x0bb3('0x13')},{'name':_0x0bb3('0x14'),'value':'outbound'},{'name':_0x0bb3('0x16'),'value':_0x0bb3('0x17')}];var _0xbed8c5=_[_0x0bb3('0x1b')](_0xbebb73,['value',_0x21b3b1['type']])[_0x0bb3('0x1d')];return db[_0x0bb3('0x41')][_0x0bb3('0x1b')]({'where':{'name':_0xbed8c5,'userProfileId':_0x47b382[_0x0bb3('0x42')]},'raw':!![]})['then'](function(_0x1262fc){if(_0x1262fc&&_0x1262fc[_0x0bb3('0x43')]===0x0){return db[_0x0bb3('0x1e')]['create']({'name':_0x21b3b1[_0x0bb3('0x1d')],'resourceId':_0x21b3b1['id'],'type':_0x1262fc[_0x0bb3('0x1d')],'sectionId':_0x1262fc['id']},{})[_0x0bb3('0x10')](function(){return _0x304d9d;});}else{return _0x304d9d;}})[_0x0bb3('0x37')](function(_0x1d5a20){logger[_0x0bb3('0x1f')](_0x0bb3('0x44'),_0x1d5a20);throw _0x1d5a20;});}return _0x304d9d;})['then'](respondWithResult(_0x2122e0,0xc9))['catch'](handleError(_0x2122e0,null));};exports[_0x0bb3('0x45')]=function(_0x1bddb0,_0xc8c659){if(_0x1bddb0['body']['id']){delete _0x1bddb0[_0x0bb3('0x3c')]['id'];}return db[_0x0bb3('0x21')][_0x0bb3('0x1b')]({'where':{'id':_0x1bddb0[_0x0bb3('0x38')]['id']}})[_0x0bb3('0x10')](handleEntityNotFound(_0xc8c659,null))[_0x0bb3('0x10')](function(_0x316592){if(_0x316592){return db[_0x0bb3('0x21')]['update'](_[_0x0bb3('0x46')](_0x1bddb0[_0x0bb3('0x3c')],[_0x0bb3('0x3d'),_0x0bb3('0x47'),_0x0bb3('0x48'),'recordingFormat',_0x0bb3('0x49'),_0x0bb3('0x4a'),_0x0bb3('0x4b')]),{'where':{'context':_0x316592['context'],'exten':_0x316592['exten']},'individualHooks':!![]})[_0x0bb3('0x10')](function(_0x343bcb){return _0x343bcb;});}return null;})[_0x0bb3('0x10')](respondWithStatusCode(_0xc8c659,null))[_0x0bb3('0x37')](handleError(_0xc8c659,null));};exports[_0x0bb3('0x4c')]=function(_0x42860a,_0x3fe5ab){var _0x19c17d=_0x42860a[_0x0bb3('0x38')]['id'];var _0xe9e191=_0x42860a['body'];var _0x28c511=0xc8;var _0x404437=null;return db[_0x0bb3('0x4d')][_0x0bb3('0x4e')]({'isolationLevel':db[_0x0bb3('0x4d')]['Transaction'][_0x0bb3('0x4f')][_0x0bb3('0x50')]},function(_0x3a04a3){return db[_0x0bb3('0x21')]['findOne']({'where':{'id':_0x19c17d},'transaction':_0x3a04a3})[_0x0bb3('0x10')](function(_0x503d30){if(_0x503d30){return db[_0x0bb3('0x21')]['destroy']({'where':{'VoiceExtensionId':_0x19c17d},'transaction':_0x3a04a3})[_0x0bb3('0x10')](function(){var _0x2fa825=_['map'](_0xe9e191,function(_0x1393f8){_0x1393f8['VoiceExtensionId']=_0x19c17d;_0x1393f8[_0x0bb3('0x51')]=!![];return _0x1393f8;});return _0x503d30[_0x0bb3('0x52')](_0x2fa825);})['then'](function(_0x504f64){return db[_0x0bb3('0x21')][_0x0bb3('0x53')](_0x504f64,{'transaction':_0x3a04a3});});}else{_0x28c511=0x194;_0x404437=[];}});})[_0x0bb3('0x10')](function(){if(_0x28c511!==0x194){return db[_0x0bb3('0x21')][_0x0bb3('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x19c17d},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x569785){_0x404437=_0x569785;});}})['catch'](function(_0x4e0ea9){_0x28c511=0x1f4;logger[_0x0bb3('0x1f')](_0x4e0ea9['stack']);if(_0x4e0ea9[_0x0bb3('0x1d')]){delete _0x4e0ea9['name'];}_0x404437=_0x4e0ea9;})['finally'](function(){if(_0x404437===null){_0x3fe5ab['sendStatus'](_0x28c511);}else{if(_0x28c511===0x1f4){_0x3fe5ab['status'](_0x28c511)[_0x0bb3('0x55')](_0x404437);}else{_0x3fe5ab['status'](_0x28c511)[_0x0bb3('0xa')](_0x404437);}}});}; \ No newline at end of file +var _0x5b84=['createRouting','findAndCountAll','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','end','status','json','offset','limit','undefined','count','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','then','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x5b84,0x173));var _0x45b8=function(_0x37a3a2,_0x32d6a5){_0x37a3a2=_0x37a3a2-0x0;var _0x1cf64e=_0x5b84[_0x37a3a2];return _0x1cf64e;};'use strict';var _=require('lodash');var Redis=require(_0x45b8('0x0'));var qs=require(_0x45b8('0x1'));var logger=require('../../config/logger')(_0x45b8('0x2'));var config=require(_0x45b8('0x3'));var db=require(_0x45b8('0x4'))['db'];config[_0x45b8('0x5')]=_['defaults'](config[_0x45b8('0x5')],{'host':_0x45b8('0x6'),'port':0x18eb});var socket=require(_0x45b8('0x7'))(new Redis(config[_0x45b8('0x5')]));require(_0x45b8('0x8'))[_0x45b8('0x9')](socket);function respondWithStatusCode(_0x57ff74,_0x303294){_0x303294=_0x303294||0xcc;return function(_0x4f2ff0){if(_0x4f2ff0){return _0x57ff74['sendStatus'](_0x303294);}return _0x57ff74['status'](_0x303294)[_0x45b8('0xa')]();};}function respondWithResult(_0xf3ccab,_0x593b18){_0x593b18=_0x593b18||0xc8;return function(_0xab7178){if(_0xab7178){return _0xf3ccab[_0x45b8('0xb')](_0x593b18)[_0x45b8('0xc')](_0xab7178);}};}function respondWithFilteredResult(_0x17f832,_0x3b082f){return function(_0x3a4a86){if(_0x3a4a86){var _0x3de427=typeof _0x3b082f[_0x45b8('0xd')]==='undefined'&&typeof _0x3b082f[_0x45b8('0xe')]===_0x45b8('0xf');var _0x58a36=_0x3a4a86[_0x45b8('0x10')];var _0x2c4ba9=_0x3de427?0x0:_0x3b082f[_0x45b8('0xd')];var _0x3c7bcc=_0x3de427?_0x3a4a86[_0x45b8('0x10')]:_0x3b082f[_0x45b8('0xd')]+_0x3b082f[_0x45b8('0xe')];var _0x4a2ba0;if(_0x3c7bcc>=_0x58a36){_0x3c7bcc=_0x58a36;_0x4a2ba0=0xc8;}else{_0x4a2ba0=0xce;}_0x17f832[_0x45b8('0xb')](_0x4a2ba0);return _0x17f832['set']('Content-Range',_0x2c4ba9+'-'+_0x3c7bcc+'/'+_0x58a36)[_0x45b8('0xc')](_0x3a4a86);}return null;};}function removeEntity(_0x1d905c){return function(_0x51bf31){if(_0x51bf31){return _0x51bf31['destroy']()['then'](function(){var _0x2cfda7=_0x51bf31['get']({'plain':!![]});var _0x28f082=[{'name':_0x45b8('0x11'),'value':_0x45b8('0x12'),'ignore':![]},{'name':_0x45b8('0x13'),'value':_0x45b8('0x14'),'ignore':![]},{'name':_0x45b8('0x15'),'value':_0x45b8('0x16'),'ignore':![]}];var _0x15ef1b=_(_0x28f082)['filter'](_0x45b8('0x17'))[_0x45b8('0x18')]('value')[_0x45b8('0x19')]();if(_[_0x45b8('0x1a')](_0x15ef1b,_0x2cfda7[_0x45b8('0x1b')])){return;}var _0x31fce0=_[_0x45b8('0x1c')](_0x28f082,[_0x45b8('0x19'),_0x2cfda7[_0x45b8('0x1b')]])[_0x45b8('0x1d')];return db[_0x45b8('0x1e')][_0x45b8('0x1f')]({'where':{'type':_0x31fce0,'resourceId':_0x2cfda7['id']}})[_0x45b8('0x20')](function(){return _0x51bf31;});})[_0x45b8('0x20')](function(){_0x1d905c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e026a){return function(_0x180b22){if(!_0x180b22){_0x7e026a[_0x45b8('0x21')](0x194);}return _0x180b22;};}function handleError(_0x4984e7,_0x162bb8){_0x162bb8=_0x162bb8||0x1f4;return function(_0x4ae6ed){logger[_0x45b8('0x22')](_0x4ae6ed[_0x45b8('0x23')]);if(_0x4ae6ed[_0x45b8('0x1d')]){delete _0x4ae6ed[_0x45b8('0x1d')];}_0x4984e7[_0x45b8('0xb')](_0x162bb8)[_0x45b8('0x24')](_0x4ae6ed);};}exports[_0x45b8('0x25')]=function(_0x1efc5b,_0x2796ff){var _0x523bda={},_0x23d551={},_0x5c69c3={'count':0x0,'rows':[]};var _0x427701=_[_0x45b8('0x18')](db[_0x45b8('0x26')][_0x45b8('0x27')],function(_0x3f9ba1){return{'name':_0x3f9ba1[_0x45b8('0x28')],'type':_0x3f9ba1[_0x45b8('0x1b')][_0x45b8('0x29')]};});_0x23d551[_0x45b8('0x2a')]=_[_0x45b8('0x18')](_0x427701,_0x45b8('0x1d'));_0x23d551['query']=_['keys'](_0x1efc5b[_0x45b8('0x2b')]);_0x23d551[_0x45b8('0x2c')]=_[_0x45b8('0x2d')](_0x23d551[_0x45b8('0x2a')],_0x23d551[_0x45b8('0x2b')]);_0x523bda[_0x45b8('0x2e')]=_['intersection'](_0x23d551[_0x45b8('0x2a')],qs['fields'](_0x1efc5b[_0x45b8('0x2b')]['fields']));_0x523bda['attributes']=_0x523bda[_0x45b8('0x2e')][_0x45b8('0x2f')]?_0x523bda[_0x45b8('0x2e')]:_0x23d551['model'];if(!_0x1efc5b[_0x45b8('0x2b')]['hasOwnProperty'](_0x45b8('0x30'))){_0x523bda['limit']=qs[_0x45b8('0xe')](_0x1efc5b['query'][_0x45b8('0xe')]);_0x523bda[_0x45b8('0xd')]=qs[_0x45b8('0xd')](_0x1efc5b[_0x45b8('0x2b')][_0x45b8('0xd')]);}_0x523bda[_0x45b8('0x31')]=qs['sort'](_0x1efc5b[_0x45b8('0x2b')]['sort']);_0x523bda[_0x45b8('0x32')]=qs[_0x45b8('0x2c')](_[_0x45b8('0x33')](_0x1efc5b[_0x45b8('0x2b')],_0x23d551['filters']),_0x427701);if(_0x1efc5b[_0x45b8('0x2b')][_0x45b8('0x34')]){_0x523bda['where']=_[_0x45b8('0x35')](_0x523bda[_0x45b8('0x32')],{'$or':_[_0x45b8('0x18')](_0x427701,function(_0x43c447){if(_0x43c447[_0x45b8('0x1b')]!==_0x45b8('0x36')){var _0x13613c={};_0x13613c[_0x43c447['name']]={'$like':'%'+_0x1efc5b[_0x45b8('0x2b')][_0x45b8('0x34')]+'%'};return _0x13613c;}})});}_0x523bda=_[_0x45b8('0x35')]({},_0x523bda,_0x1efc5b[_0x45b8('0x37')]);var _0x27beee={'where':_0x523bda[_0x45b8('0x32')]};return db['VoiceExtension'][_0x45b8('0x10')](_0x27beee)[_0x45b8('0x20')](function(_0x1f5b51){_0x5c69c3[_0x45b8('0x10')]=_0x1f5b51;if(_0x1efc5b[_0x45b8('0x2b')][_0x45b8('0x38')]){_0x523bda[_0x45b8('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x45b8('0x3a')](_0x523bda);})['then'](function(_0x12513c){_0x5c69c3[_0x45b8('0x3b')]=_0x12513c;return _0x5c69c3;})[_0x45b8('0x20')](respondWithFilteredResult(_0x2796ff,_0x523bda))[_0x45b8('0x3c')](handleError(_0x2796ff,null));};exports[_0x45b8('0x3d')]=function(_0x1928fa,_0x1eb931){var _0x3dff5c={'raw':![],'where':{'id':_0x1928fa[_0x45b8('0x3e')]['id']}},_0x27406e={};_0x27406e[_0x45b8('0x2a')]=_[_0x45b8('0x3f')](db[_0x45b8('0x26')][_0x45b8('0x27')]);_0x27406e[_0x45b8('0x2b')]=_['keys'](_0x1928fa[_0x45b8('0x2b')]);_0x27406e[_0x45b8('0x2c')]=_[_0x45b8('0x2d')](_0x27406e['model'],_0x27406e['query']);_0x3dff5c[_0x45b8('0x2e')]=_['intersection'](_0x27406e[_0x45b8('0x2a')],qs[_0x45b8('0x40')](_0x1928fa[_0x45b8('0x2b')][_0x45b8('0x40')]));_0x3dff5c[_0x45b8('0x2e')]=_0x3dff5c[_0x45b8('0x2e')]['length']?_0x3dff5c[_0x45b8('0x2e')]:_0x27406e[_0x45b8('0x2a')];if(_0x1928fa[_0x45b8('0x2b')]['includeAll']){_0x3dff5c[_0x45b8('0x39')]=[{'all':!![]}];}_0x3dff5c=_[_0x45b8('0x35')]({},_0x3dff5c,_0x1928fa[_0x45b8('0x37')]);return db['VoiceExtension'][_0x45b8('0x1c')](_0x3dff5c)[_0x45b8('0x20')](handleEntityNotFound(_0x1eb931,null))[_0x45b8('0x20')](respondWithResult(_0x1eb931,null))[_0x45b8('0x3c')](handleError(_0x1eb931,null));};exports[_0x45b8('0x1f')]=function(_0x47a9db,_0xb2fffd){return db[_0x45b8('0x26')][_0x45b8('0x1c')]({'where':{'id':_0x47a9db[_0x45b8('0x3e')]['id']}})[_0x45b8('0x20')](handleEntityNotFound(_0xb2fffd,null))['then'](removeEntity(_0xb2fffd,null))['catch'](handleError(_0xb2fffd,null));};exports[_0x45b8('0x41')]=function(_0x381204,_0x415a99){if(_0x381204[_0x45b8('0x42')][_0x45b8('0x1b')]===_0x45b8('0x14')&&!_[_0x45b8('0x43')](_0x381204[_0x45b8('0x42')][_0x45b8('0x44')],'_')){_0x381204['body'][_0x45b8('0x44')]='_'[_0x45b8('0x45')](_0x381204[_0x45b8('0x42')][_0x45b8('0x44')]);}return db[_0x45b8('0x26')][_0x45b8('0x41')](_0x381204[_0x45b8('0x42')],{'raw':![]})[_0x45b8('0x20')](function(_0x1711eb){var _0x37716a=_0x381204[_0x45b8('0x46')][_0x45b8('0x47')]({'plain':!![]});if(!_0x37716a)throw new Error(_0x45b8('0x48'));if(_0x37716a[_0x45b8('0x49')]===_0x45b8('0x46')){var _0xa04f7d=_0x1711eb[_0x45b8('0x47')]({'plain':!![]});var _0x373b63=[{'name':'InboundRoutes','value':_0x45b8('0x12')},{'name':_0x45b8('0x13'),'value':_0x45b8('0x14')},{'name':_0x45b8('0x15'),'value':_0x45b8('0x16')}];var _0x27d2c2=_[_0x45b8('0x1c')](_0x373b63,['value',_0xa04f7d[_0x45b8('0x1b')]])['name'];return db['UserProfileSection'][_0x45b8('0x1c')]({'where':{'name':_0x27d2c2,'userProfileId':_0x37716a[_0x45b8('0x4a')]},'raw':!![]})[_0x45b8('0x20')](function(_0x2aff80){if(_0x2aff80&&_0x2aff80['autoAssociation']===0x0){return db['UserProfileResource'][_0x45b8('0x41')]({'name':_0xa04f7d[_0x45b8('0x1d')],'resourceId':_0xa04f7d['id'],'type':_0x2aff80[_0x45b8('0x1d')],'sectionId':_0x2aff80['id']},{})[_0x45b8('0x20')](function(){return _0x1711eb;});}else{return _0x1711eb;}})[_0x45b8('0x3c')](function(_0x4b79f4){logger[_0x45b8('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b79f4);throw _0x4b79f4;});}return _0x1711eb;})['then'](respondWithResult(_0x415a99,0xc9))[_0x45b8('0x3c')](handleError(_0x415a99,null));};exports[_0x45b8('0x4b')]=function(_0x292ba0,_0xa59e52){if(_0x292ba0[_0x45b8('0x42')]['id']){delete _0x292ba0[_0x45b8('0x42')]['id'];}return db[_0x45b8('0x26')][_0x45b8('0x1c')]({'where':{'id':_0x292ba0[_0x45b8('0x3e')]['id']}})[_0x45b8('0x20')](handleEntityNotFound(_0xa59e52,null))[_0x45b8('0x20')](function(_0x4d4ddd){if(_0x4d4ddd){return db['VoiceExtension'][_0x45b8('0x4b')](_[_0x45b8('0x33')](_0x292ba0[_0x45b8('0x42')],[_0x45b8('0x44'),'context',_0x45b8('0x4c'),_0x45b8('0x4d'),_0x45b8('0x4e'),_0x45b8('0x4f'),_0x45b8('0x50')]),{'where':{'context':_0x4d4ddd[_0x45b8('0x51')],'exten':_0x4d4ddd[_0x45b8('0x44')]},'individualHooks':!![]})['then'](function(_0x5a74d0){return _0x5a74d0;});}return null;})[_0x45b8('0x20')](respondWithStatusCode(_0xa59e52,null))[_0x45b8('0x3c')](handleError(_0xa59e52,null));};exports[_0x45b8('0x52')]=function(_0x454345,_0x51f1fb){var _0x29c440=_0x454345['params']['id'];var _0x3daafb=_0x454345['body'];var _0xa4c8=0xc8;var _0x4d938c=null;return db[_0x45b8('0x53')][_0x45b8('0x54')]({'isolationLevel':db[_0x45b8('0x53')]['Transaction'][_0x45b8('0x55')][_0x45b8('0x56')]},function(_0x418f7e){return db[_0x45b8('0x26')][_0x45b8('0x57')]({'where':{'id':_0x29c440},'transaction':_0x418f7e})['then'](function(_0xd90049){if(_0xd90049){return db[_0x45b8('0x26')][_0x45b8('0x1f')]({'where':{'VoiceExtensionId':_0x29c440},'transaction':_0x418f7e})['then'](function(){var _0x2e57a7=_[_0x45b8('0x18')](_0x3daafb,function(_0x11a1ee){_0x11a1ee[_0x45b8('0x58')]=_0x29c440;_0x11a1ee['isApp']=!![];return _0x11a1ee;});return _0xd90049[_0x45b8('0x59')](_0x2e57a7);})[_0x45b8('0x20')](function(_0x5489cc){return db['VoiceExtension']['bulkCreate'](_0x5489cc,{'transaction':_0x418f7e});});}else{_0xa4c8=0x194;_0x4d938c=[];}});})['then'](function(){if(_0xa4c8!==0x194){return db[_0x45b8('0x26')][_0x45b8('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x29c440},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x1ac85f){_0x4d938c=_0x1ac85f;});}})[_0x45b8('0x3c')](function(_0x58066d){_0xa4c8=0x1f4;logger[_0x45b8('0x22')](_0x58066d['stack']);if(_0x58066d[_0x45b8('0x1d')]){delete _0x58066d[_0x45b8('0x1d')];}_0x4d938c=_0x58066d;})[_0x45b8('0x5b')](function(){if(_0x4d938c===null){_0x51f1fb[_0x45b8('0x21')](_0xa4c8);}else{if(_0xa4c8===0x1f4){_0x51f1fb[_0x45b8('0xb')](_0xa4c8)[_0x45b8('0x24')](_0x4d938c);}else{_0x51f1fb['status'](_0xa4c8)[_0x45b8('0xc')](_0x4d938c);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index d50f01a..fadab82 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 _0x118f=['emit','hasOwnProperty','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x264eeb,_0xc05998){var _0xa45c83=function(_0x2a82d9){while(--_0x2a82d9){_0x264eeb['push'](_0x264eeb['shift']());}};_0xa45c83(++_0xc05998);}(_0x118f,0x1b2));var _0xf118=function(_0x24ff3c,_0x1e7534){_0x24ff3c=_0x24ff3c-0x0;var _0xc84e8f=_0x118f[_0x24ff3c];return _0xc84e8f;};'use strict';var EventEmitter=require(_0xf118('0x0'));var VoiceExtension=require(_0xf118('0x1'))['db'][_0xf118('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf118('0x3')](0x0);var events={'afterCreate':_0xf118('0x4'),'afterUpdate':_0xf118('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d6fad){return function(_0x3045c6,_0x17d3a6,_0x5880aa){VoiceExtensionEvents[_0xf118('0x6')](_0x5d6fad+':'+_0x3045c6['id'],_0x3045c6);VoiceExtensionEvents[_0xf118('0x6')](_0x5d6fad,_0x3045c6);_0x5880aa(null);};}for(var e in events){if(events[_0xf118('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x9009=['exports','../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x40d1ba,_0x3cb77c){var _0x565261=function(_0x1a5b54){while(--_0x1a5b54){_0x40d1ba['push'](_0x40d1ba['shift']());}};_0x565261(++_0x3cb77c);}(_0x9009,0x184));var _0x9900=function(_0x3beb8d,_0x411eec){_0x3beb8d=_0x3beb8d-0x0;var _0x2bde56=_0x9009[_0x3beb8d];return _0x2bde56;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9900('0x0'))['db'][_0x9900('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9900('0x2'),'afterUpdate':_0x9900('0x3'),'afterDestroy':_0x9900('0x4')};function emitEvent(_0xfe2f85){return function(_0x2e23a6,_0x496b0b,_0x57c7df){VoiceExtensionEvents['emit'](_0xfe2f85+':'+_0x2e23a6['id'],_0x2e23a6);VoiceExtensionEvents[_0x9900('0x5')](_0xfe2f85,_0x2e23a6);_0x57c7df(null);};}for(var e in events){if(events[_0x9900('0x6')](e)){var event=events[e];VoiceExtension[_0x9900('0x7')](e,emitEvent(event));}}module[_0x9900('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 07e0367..b8a7036 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 _0xccd7=['phone','prefix','${EXTEN:','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','intervals','map','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','CDR(type)=','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param'];(function(_0x1080f5,_0x1021d3){var _0x193ed3=function(_0x39d0a3){while(--_0x39d0a3){_0x1080f5['push'](_0x1080f5['shift']());}};_0x193ed3(++_0x1021d3);}(_0xccd7,0x75));var _0x7ccd=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xccd7[_0x3fb9dd];return _0x20136a;};'use strict';var _=require('lodash');var attributes=require(_0x7ccd('0x0'));module[_0x7ccd('0x1')]=function(_0x34cf48){var _0x17e0f2=_0x34cf48[_0x7ccd('0x2')];function _0x17bd10(_0x34626f){var _0x1ec9a1=0x2;var _0x4aac3b=[{'type':_0x34626f[_0x7ccd('0x3')],'app':'Set','appdata':_0x7ccd('0x4')+_0x34626f[_0x7ccd('0x3')],'context':_0x34626f['context'],'exten':_0x34626f['exten'],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']},{'type':_0x34626f['type'],'app':_0x34626f[_0x7ccd('0x5')]?_0x7ccd('0x6'):_0x7ccd('0x7'),'appdata':_0x34626f[_0x7ccd('0x5')]?_0x7ccd('0x8')+_0x34626f[_0x7ccd('0x5')]:_0x7ccd('0x9'),'context':_0x34626f[_0x7ccd('0xa')],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']}];if(_0x34626f['type']===_0x7ccd('0xc')){_0x4aac3b[_0x7ccd('0xd')]({'type':_0x7ccd('0xc'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xe')+_0x34626f['id'],'context':_0x34626f[_0x7ccd('0xa')],'exten':_0x34626f['exten'],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']});}_0x4aac3b[_0x7ccd('0xd')]({'type':_0x34626f[_0x7ccd('0x3')],'app':_0x7ccd('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x34626f[_0x7ccd('0xa')],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']},{'type':_0x34626f[_0x7ccd('0x3')],'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xf'),'context':_0x34626f['context'],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']},{'type':_0x34626f[_0x7ccd('0x3')],'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x10'),'context':_0x34626f['context'],'exten':_0x34626f[_0x7ccd('0xb')],'priority':_0x1ec9a1++,'VoiceExtensionId':_0x34626f['id']});return _0x4aac3b;}function _0x16335e(_0x156616){var _0x225321=0x2;var _0x14141c=[{'type':_0x7ccd('0x11'),'app':'Set','appdata':_0x7ccd('0x12'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x156616[_0x7ccd('0x5')]?'Set':'NoOp','appdata':_0x156616[_0x7ccd('0x5')]?'CDR(routeAlias)='+_0x156616[_0x7ccd('0x5')]:_0x7ccd('0x9'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616['exten'],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':'Set','appdata':_0x7ccd('0x13')+(_0x156616['cutdigits']?'${EXTEN:'+_0x156616[_0x7ccd('0x14')]+'}':_0x7ccd('0x15')),'context':_0x156616['context'],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xe')+_0x156616['id'],'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':_0x7ccd('0x16'),'appdata':_0x7ccd('0x17')+(_0x225321+0x2)+_0x7ccd('0x18')+(_0x225321+0x1)+')','context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':'Set','appdata':_0x156616[_0x7ccd('0x14')]?_0x7ccd('0x19')+_0x156616[_0x7ccd('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x1a'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616['exten'],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x7ccd('0x6'),'appdata':_0x7ccd('0xf'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x10'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':'outbound','app':'Set','appdata':_0x7ccd('0x1b')+_0x156616['id'],'context':_0x156616['context'],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']}];if(_0x156616[_0x7ccd('0x1c')](_0x7ccd('0x1d'))&&_0x156616['recordingFormat']!==_0x7ccd('0x1e')){_0x14141c[_0x7ccd('0xd')]({'type':_0x7ccd('0x11'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x1f'),'context':_0x156616[_0x7ccd('0xa')],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']},{'type':_0x7ccd('0x11'),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x20')+_0x156616[_0x7ccd('0x1d')]||_0x7ccd('0x21'),'context':_0x156616['context'],'exten':_0x156616[_0x7ccd('0xb')],'priority':_0x225321++,'VoiceExtensionId':_0x156616['id']});}return _0x14141c;}function _0x13d8a6(_0x3b8d3a,_0x1a4821){var _0x2a598c=[{'name':_0x7ccd('0x22'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x7ccd('0x23'),'param':0x2},{'name':_0x7ccd('0x24'),'param':0x3}];var _0x2fd0ab={};var _0x45d2d6=_0x1a4821[_0x7ccd('0x25')](',');var _0x171600=[];for(var _0x2fac2e=0x0;_0x2fac2e<_0x2a598c[_0x7ccd('0x26')];_0x2fac2e++){switch(_0x2a598c[_0x2fac2e][_0x7ccd('0x27')]){case _0x7ccd('0x22'):_0x2fd0ab[_0x7ccd('0x22')]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]][_0x7ccd('0x25')]('/')[0x1];_0x2fd0ab[_0x7ccd('0x29')]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]][_0x7ccd('0x25')]('/')[0x2];_0x2fd0ab[_0x7ccd('0x2a')]=_0x2fd0ab[_0x7ccd('0x29')]?_0x2fd0ab[_0x7ccd('0x29')][_0x7ccd('0x25')]('$')[0x0]:undefined;_0x2fd0ab[_0x7ccd('0x29')]=_0x3b8d3a['cutdigits']?(_0x2fd0ab['prefix']||'')+_0x7ccd('0x2b')+_0x3b8d3a['cutdigits']+'}':(_0x2fd0ab[_0x7ccd('0x2a')]||'')+_0x7ccd('0x15');_0x171600[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]]=[_0x7ccd('0x2c'),_0x2fd0ab[_0x7ccd('0x22')],_0x2fd0ab[_0x7ccd('0x29')]][_0x7ccd('0x2d')]('/');break;case _0x7ccd('0x23'):_0x2fd0ab[_0x7ccd('0x23')]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]];if(_0x3b8d3a[_0x7ccd('0x1d')]!==_0x7ccd('0x1e')){if(_0x2fd0ab['options']['indexOf'](_0x7ccd('0x2e'))<0x0){_0x2fd0ab['options']+=_0x7ccd('0x2e');}}else{_0x2fd0ab['options']=_0x2fd0ab[_0x7ccd('0x23')][_0x7ccd('0x2f')]('U(xcally-mixmonitor-context)','');}_0x171600[_0x2a598c[_0x2fac2e]['param']]=_0x2fd0ab[_0x7ccd('0x23')];break;default:_0x171600[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]]=_0x45d2d6[_0x2a598c[_0x2fac2e][_0x7ccd('0x28')]];}}return _0x171600['join'](',');}function _0x5b6dba(_0x54e0b8,_0x526184,_0x18e537){return new Promise(function(_0x1e1471,_0x5d88ba){var _0x11bcc5=[];if(_[_0x7ccd('0x30')](_0x526184))return _0x1e1471(_0x11bcc5);_0x17e0f2[_0x7ccd('0x31')]['findAll']({'attributes':['id',_0x7ccd('0x32'),_0x7ccd('0x33')],'raw':!![]})[_0x7ccd('0x34')](function(_0x2db5a7){for(var _0x2922af=0x0,_0x41cad7=0x0;_0x2922af<_0x526184[_0x7ccd('0x26')];_0x2922af++,_0x41cad7=0x0){var _0x38cb23=_0x526184[_0x2922af];var _0x2efbf0=[];var _0x6b1763=[];delete _0x38cb23['id'];if(_0x38cb23[_0x7ccd('0x32')]!=='*,*,*,*'){_0x38cb23[_0x7ccd('0x35')]=[_0x38cb23[_0x7ccd('0x32')]];}else{_0x38cb23['intervals']=_0x38cb23['IntervalId']?_[_0x7ccd('0x36')](_['filter'](_0x2db5a7,{'IntervalId':_0x38cb23[_0x7ccd('0x33')]}),'interval'):[];}_0x38cb23[_0x7ccd('0xa')]=_0x54e0b8[_0x7ccd('0xa')];_0x38cb23[_0x7ccd('0xb')]=_0x54e0b8[_0x7ccd('0xb')];if(_0x38cb23[_0x7ccd('0x3')])_0x38cb23['type']=_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')]();if(_0x54e0b8[_0x7ccd('0x3')]===_0x7ccd('0x11')){if(_0x38cb23[_0x7ccd('0x1c')](_0x7ccd('0x38'))&&_0x38cb23['tag']&&_0x38cb23[_0x7ccd('0x38')]!=='--'){_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x39')+_0x38cb23['tag'],'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}_0x2efbf0['push']({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x38cb23['callerID']?'Set(CALLERID(all)='+_0x38cb23[_0x7ccd('0x3a')]+')':_0x7ccd('0x3b')),'context':_0x54e0b8['context'],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}else{if(_0x38cb23[_0x7ccd('0x1c')](_0x7ccd('0x3c'))){if([_0x7ccd('0x3d'),'playback'][_0x7ccd('0x3e')](_0x38cb23['app'][_0x7ccd('0x37')]())&&_0x38cb23[_0x7ccd('0x3f')]!=='custom'){if(_0x38cb23[_0x7ccd('0x3c')]){_0x2efbf0['push']({'type':_0x38cb23[_0x7ccd('0x3')]['toLowerCase'](),'app':_0x7ccd('0x16'),'appdata':_0x7ccd('0x40'),'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x41'),'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}else{_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23[_0x7ccd('0x3')][_0x7ccd('0x37')](),'app':_0x7ccd('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8[_0x7ccd('0xb')],'priority':_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});_0x2efbf0[_0x7ccd('0xd')]({'type':_0x38cb23['type'][_0x7ccd('0x37')](),'app':_0x7ccd('0x6'),'appdata':_0x7ccd('0x42'),'context':_0x54e0b8[_0x7ccd('0xa')],'exten':_0x54e0b8['exten'],'priority':_0x38cb23['intervals'][_0x7ccd('0x26')]+_0x18e537+_0x41cad7++,'VoiceExtensionId':_0x54e0b8['id']});}}}}for(var _0x5f2af6=0x0;_0x5f2af6<_0x38cb23[_0x7ccd('0x35')]['length'];_0x5f2af6++){var _0x2fb965=_0x18e537+_0x38cb23[_0x7ccd('0x35')][_0x7ccd('0x26')];var _0x2dc5ec=_0x5f2af6===_0x38cb23['intervals'][_0x7ccd('0x26')]-0x1?_0x18e537+_0x2efbf0[_0x7ccd('0x26')]+_0x6b1763['length']+0x2:_0x18e537+_0x5f2af6+0x1;_0x2efbf0[_0x7ccd('0x43')](_0x5f2af6,0x0,{'type':_0x54e0b8[_0x7ccd('0x3')],'app':_0x7ccd('0x44'),'appdata':_0x38cb23[_0x7ccd('0x35')][_0x5f2af6]+'?'+_0x54e0b8[_0x7ccd('0xa')]+_0x7ccd('0x45')+_0x2fb965+':'+_0x54e0b8[_0x7ccd('0xa')]+_0x7ccd('0x45')+_0x2dc5ec,'exten':_0x54e0b8['exten'],'context':_0x54e0b8[_0x7ccd('0xa')],'priority':_0x18e537+_0x5f2af6,'VoiceExtensionId':_0x54e0b8['id']});}if(_0x38cb23['appType']===_0x7ccd('0x46'))_0x38cb23[_0x7ccd('0x47')]=_0x13d8a6(_0x54e0b8,_0x38cb23['appdata']);_0x38cb23[_0x7ccd('0x48')]=_0x2efbf0['length']?_[_0x7ccd('0x49')](_0x2efbf0)[_0x7ccd('0x48')]+0x1:_0x18e537;_0x11bcc5=_[_0x7ccd('0x4a')](_0x11bcc5,_0x2efbf0,[_0x38cb23],_0x6b1763);_0x18e537=_[_0x7ccd('0x49')](_0x11bcc5)[_0x7ccd('0x48')]+0x1;}return _0x1e1471(_0x11bcc5);})[_0x7ccd('0x4b')](function(_0x55f9ae){_0x5d88ba(_0x55f9ae);});});}return _0x34cf48['define']('VoiceExtension',attributes,{'tableName':_0x7ccd('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x322240){var _0x3adfc9=this[_0x7ccd('0x4d')]({'plain':!![]});var _0x153479=_0x3adfc9[_0x7ccd('0x3')]===_0x7ccd('0x11')?_0x16335e(_0x3adfc9):_0x17bd10(_0x3adfc9);return _0x5b6dba(_0x3adfc9,_0x322240,_['last'](_0x153479)[_0x7ccd('0x48')]+0x1)[_0x7ccd('0x34')](function(_0x3e59f9){var _0x13c67c=_['concat'](_0x153479,_0x3e59f9);_0x13c67c['push']({'type':_0x3adfc9['type'],'app':_0x7ccd('0x4e'),'exten':_0x3adfc9['exten'],'context':_0x3adfc9[_0x7ccd('0xa')],'priority':_[_0x7ccd('0x49')](_0x13c67c)[_0x7ccd('0x48')]+0x1,'VoiceExtensionId':_0x3adfc9['id']});return _0x13c67c;});}}});}; \ No newline at end of file +var _0xf534=['Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','then','intervals','IntervalId','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type'];(function(_0x4fbc87,_0x157ab8){var _0x156e5a=function(_0x11d44e){while(--_0x11d44e){_0x4fbc87['push'](_0x4fbc87['shift']());}};_0x156e5a(++_0x157ab8);}(_0xf534,0x9a));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4f53('0x0'));var attributes=require(_0x4f53('0x1'));module['exports']=function(_0x149113){var _0x50a0a3=_0x149113[_0x4f53('0x2')];function _0x499965(_0x32ba25){var _0xc35145=0x2;var _0x1fd3d2=[{'type':_0x32ba25[_0x4f53('0x3')],'app':_0x4f53('0x4'),'appdata':_0x4f53('0x5')+_0x32ba25[_0x4f53('0x3')],'context':_0x32ba25['context'],'exten':_0x32ba25[_0x4f53('0x6')],'priority':_0xc35145++,'VoiceExtensionId':_0x32ba25['id']},{'type':_0x32ba25['type'],'app':_0x32ba25[_0x4f53('0x7')]?_0x4f53('0x4'):_0x4f53('0x8'),'appdata':_0x32ba25[_0x4f53('0x7')]?_0x4f53('0x9')+_0x32ba25[_0x4f53('0x7')]:_0x4f53('0xa'),'context':_0x32ba25[_0x4f53('0xb')],'exten':_0x32ba25['exten'],'priority':_0xc35145++,'VoiceExtensionId':_0x32ba25['id']}];if(_0x32ba25[_0x4f53('0x3')]===_0x4f53('0xc')){_0x1fd3d2[_0x4f53('0xd')]({'type':_0x4f53('0xc'),'app':'Set','appdata':_0x4f53('0xe')+_0x32ba25['id'],'context':_0x32ba25[_0x4f53('0xb')],'exten':_0x32ba25[_0x4f53('0x6')],'priority':_0xc35145++,'VoiceExtensionId':_0x32ba25['id']});}_0x1fd3d2['push']({'type':_0x32ba25[_0x4f53('0x3')],'app':_0x4f53('0x4'),'appdata':_0x4f53('0xf'),'context':_0x32ba25[_0x4f53('0xb')],'exten':_0x32ba25[_0x4f53('0x6')],'priority':_0xc35145++,'VoiceExtensionId':_0x32ba25['id']},{'type':_0x32ba25['type'],'app':_0x4f53('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x32ba25[_0x4f53('0xb')],'exten':_0x32ba25[_0x4f53('0x6')],'priority':_0xc35145++,'VoiceExtensionId':_0x32ba25['id']},{'type':_0x32ba25[_0x4f53('0x3')],'app':_0x4f53('0x4'),'appdata':_0x4f53('0x10'),'context':_0x32ba25['context'],'exten':_0x32ba25['exten'],'priority':_0xc35145++,'VoiceExtensionId':_0x32ba25['id']});return _0x1fd3d2;}function _0x50a841(_0x325ff0){var _0xadc447=0x2;var _0x4f3932=[{'type':_0x4f53('0x11'),'app':_0x4f53('0x4'),'appdata':'CDR(type)=outbound','context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':_0x325ff0[_0x4f53('0x7')]?'Set':_0x4f53('0x8'),'appdata':_0x325ff0[_0x4f53('0x7')]?_0x4f53('0x9')+_0x325ff0[_0x4f53('0x7')]:_0x4f53('0xa'),'context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':'Set','appdata':_0x4f53('0x12')+(_0x325ff0[_0x4f53('0x13')]?'${EXTEN:'+_0x325ff0[_0x4f53('0x13')]+'}':_0x4f53('0x14')),'context':_0x325ff0['context'],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':'outbound','app':_0x4f53('0x4'),'appdata':_0x4f53('0xe')+_0x325ff0['id'],'context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':_0x4f53('0x15'),'appdata':_0x4f53('0x16')+(_0xadc447+0x2)+_0x4f53('0x17')+(_0xadc447+0x1)+')','context':_0x325ff0['context'],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':_0x4f53('0x4'),'appdata':_0x325ff0[_0x4f53('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x325ff0['cutdigits']+'}':_0x4f53('0x18'),'context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':_0x4f53('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x325ff0['context'],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':'outbound','app':_0x4f53('0x4'),'appdata':_0x4f53('0x19'),'context':_0x325ff0['context'],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':'Set','appdata':_0x4f53('0x10'),'context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':'outbound','app':_0x4f53('0x4'),'appdata':_0x4f53('0x1a')+_0x325ff0['id'],'context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']}];if(_0x325ff0[_0x4f53('0x1b')](_0x4f53('0x1c'))&&_0x325ff0[_0x4f53('0x1c')]!==_0x4f53('0x1d')){_0x4f3932[_0x4f53('0xd')]({'type':'outbound','app':_0x4f53('0x4'),'appdata':_0x4f53('0x1e'),'context':_0x325ff0['context'],'exten':_0x325ff0['exten'],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']},{'type':_0x4f53('0x11'),'app':_0x4f53('0x4'),'appdata':_0x4f53('0x1f')+_0x325ff0[_0x4f53('0x1c')]||_0x4f53('0x20'),'context':_0x325ff0[_0x4f53('0xb')],'exten':_0x325ff0[_0x4f53('0x6')],'priority':_0xadc447++,'VoiceExtensionId':_0x325ff0['id']});}return _0x4f3932;}function _0x32898f(_0x399d90,_0x59d490){var _0x5b356c=[{'name':_0x4f53('0x21'),'param':0x0},{'name':_0x4f53('0x22'),'param':0x1},{'name':_0x4f53('0x23'),'param':0x2},{'name':_0x4f53('0x24'),'param':0x3}];var _0x2d3068={};var _0x4543ba=_0x59d490[_0x4f53('0x25')](',');var _0x11d86f=[];for(var _0x1db797=0x0;_0x1db797<_0x5b356c[_0x4f53('0x26')];_0x1db797++){switch(_0x5b356c[_0x1db797][_0x4f53('0x27')]){case _0x4f53('0x21'):_0x2d3068[_0x4f53('0x21')]=_0x4543ba[_0x5b356c[_0x1db797][_0x4f53('0x28')]][_0x4f53('0x25')]('/')[0x1];_0x2d3068[_0x4f53('0x29')]=_0x4543ba[_0x5b356c[_0x1db797]['param']][_0x4f53('0x25')]('/')[0x2];_0x2d3068[_0x4f53('0x2a')]=_0x2d3068[_0x4f53('0x29')]?_0x2d3068[_0x4f53('0x29')][_0x4f53('0x25')]('$')[0x0]:undefined;_0x2d3068[_0x4f53('0x29')]=_0x399d90[_0x4f53('0x13')]?(_0x2d3068[_0x4f53('0x2a')]||'')+'${EXTEN:'+_0x399d90[_0x4f53('0x13')]+'}':(_0x2d3068[_0x4f53('0x2a')]||'')+_0x4f53('0x14');_0x11d86f[_0x5b356c[_0x1db797][_0x4f53('0x28')]]=[_0x4f53('0x2b'),_0x2d3068['trunk'],_0x2d3068[_0x4f53('0x29')]][_0x4f53('0x2c')]('/');break;case _0x4f53('0x23'):_0x2d3068[_0x4f53('0x23')]=_0x4543ba[_0x5b356c[_0x1db797][_0x4f53('0x28')]];if(_0x399d90[_0x4f53('0x1c')]!=='none'){if(_0x2d3068[_0x4f53('0x23')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x2d3068[_0x4f53('0x23')]+='U(xcally-mixmonitor-context)';}}else{_0x2d3068[_0x4f53('0x23')]=_0x2d3068['options']['replace'](_0x4f53('0x2d'),'');}_0x11d86f[_0x5b356c[_0x1db797]['param']]=_0x2d3068[_0x4f53('0x23')];break;default:_0x11d86f[_0x5b356c[_0x1db797]['param']]=_0x4543ba[_0x5b356c[_0x1db797][_0x4f53('0x28')]];}}return _0x11d86f[_0x4f53('0x2c')](',');}function _0x196059(_0x5e4d5b,_0x29599d,_0x1acc1e){return new Promise(function(_0xb3417f,_0xee52ca){var _0x3e7e0e=[];if(_[_0x4f53('0x2e')](_0x29599d))return _0xb3417f(_0x3e7e0e);_0x50a0a3[_0x4f53('0x2f')]['findAll']({'attributes':['id',_0x4f53('0x30'),'IntervalId'],'raw':!![]})[_0x4f53('0x31')](function(_0xc0eba5){for(var _0x4d0a94=0x0,_0x126dbc=0x0;_0x4d0a94<_0x29599d[_0x4f53('0x26')];_0x4d0a94++,_0x126dbc=0x0){var _0x3da72c=_0x29599d[_0x4d0a94];var _0xb67ca=[];var _0x23e644=[];delete _0x3da72c['id'];if(_0x3da72c[_0x4f53('0x30')]!=='*,*,*,*'){_0x3da72c[_0x4f53('0x32')]=[_0x3da72c[_0x4f53('0x30')]];}else{_0x3da72c[_0x4f53('0x32')]=_0x3da72c[_0x4f53('0x33')]?_['map'](_[_0x4f53('0x34')](_0xc0eba5,{'IntervalId':_0x3da72c[_0x4f53('0x33')]}),'interval'):[];}_0x3da72c[_0x4f53('0xb')]=_0x5e4d5b[_0x4f53('0xb')];_0x3da72c[_0x4f53('0x6')]=_0x5e4d5b[_0x4f53('0x6')];if(_0x3da72c[_0x4f53('0x3')])_0x3da72c[_0x4f53('0x3')]=_0x3da72c[_0x4f53('0x3')][_0x4f53('0x35')]();if(_0x5e4d5b[_0x4f53('0x3')]===_0x4f53('0x11')){if(_0x3da72c[_0x4f53('0x1b')]('tag')&&_0x3da72c['tag']&&_0x3da72c[_0x4f53('0x36')]!=='--'){_0xb67ca[_0x4f53('0xd')]({'type':_0x3da72c[_0x4f53('0x3')][_0x4f53('0x35')](),'app':'Set','appdata':'CDR(tag)='+_0x3da72c['tag'],'context':_0x5e4d5b[_0x4f53('0xb')],'exten':_0x5e4d5b[_0x4f53('0x6')],'priority':_0x3da72c[_0x4f53('0x32')][_0x4f53('0x26')]+_0x1acc1e+_0x126dbc++,'VoiceExtensionId':_0x5e4d5b['id']});}_0xb67ca[_0x4f53('0xd')]({'type':_0x3da72c[_0x4f53('0x3')][_0x4f53('0x35')](),'app':_0x4f53('0x15'),'appdata':_0x4f53('0x37')+(_0x3da72c[_0x4f53('0x38')]?_0x4f53('0x39')+_0x3da72c[_0x4f53('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x5e4d5b['context'],'exten':_0x5e4d5b[_0x4f53('0x6')],'priority':_0x3da72c[_0x4f53('0x32')][_0x4f53('0x26')]+_0x1acc1e+_0x126dbc++,'VoiceExtensionId':_0x5e4d5b['id']});}else{if(_0x3da72c[_0x4f53('0x1b')](_0x4f53('0x3a'))){if(['queue',_0x4f53('0x3b')][_0x4f53('0x3c')](_0x3da72c[_0x4f53('0x3d')][_0x4f53('0x35')]())&&_0x3da72c[_0x4f53('0x3e')]!=='custom'){if(_0x3da72c[_0x4f53('0x3a')]){_0xb67ca['push']({'type':_0x3da72c[_0x4f53('0x3')][_0x4f53('0x35')](),'app':_0x4f53('0x15'),'appdata':_0x4f53('0x3f'),'context':_0x5e4d5b[_0x4f53('0xb')],'exten':_0x5e4d5b[_0x4f53('0x6')],'priority':_0x3da72c[_0x4f53('0x32')]['length']+_0x1acc1e+_0x126dbc++,'VoiceExtensionId':_0x5e4d5b['id']});_0xb67ca[_0x4f53('0xd')]({'type':_0x3da72c[_0x4f53('0x3')][_0x4f53('0x35')](),'app':'Set','appdata':_0x4f53('0x40'),'context':_0x5e4d5b[_0x4f53('0xb')],'exten':_0x5e4d5b[_0x4f53('0x6')],'priority':_0x3da72c[_0x4f53('0x32')][_0x4f53('0x26')]+_0x1acc1e+_0x126dbc++,'VoiceExtensionId':_0x5e4d5b['id']});}else{_0xb67ca[_0x4f53('0xd')]({'type':_0x3da72c[_0x4f53('0x3')][_0x4f53('0x35')](),'app':_0x4f53('0x15'),'appdata':_0x4f53('0x41'),'context':_0x5e4d5b['context'],'exten':_0x5e4d5b['exten'],'priority':_0x3da72c[_0x4f53('0x32')]['length']+_0x1acc1e+_0x126dbc++,'VoiceExtensionId':_0x5e4d5b['id']});_0xb67ca['push']({'type':_0x3da72c[_0x4f53('0x3')]['toLowerCase'](),'app':_0x4f53('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5e4d5b['context'],'exten':_0x5e4d5b[_0x4f53('0x6')],'priority':_0x3da72c[_0x4f53('0x32')][_0x4f53('0x26')]+_0x1acc1e+_0x126dbc++,'VoiceExtensionId':_0x5e4d5b['id']});}}}}for(var _0x413394=0x0;_0x413394<_0x3da72c['intervals']['length'];_0x413394++){var _0x353db8=_0x1acc1e+_0x3da72c[_0x4f53('0x32')][_0x4f53('0x26')];var _0x4af4ae=_0x413394===_0x3da72c['intervals']['length']-0x1?_0x1acc1e+_0xb67ca[_0x4f53('0x26')]+_0x23e644['length']+0x2:_0x1acc1e+_0x413394+0x1;_0xb67ca[_0x4f53('0x42')](_0x413394,0x0,{'type':_0x5e4d5b[_0x4f53('0x3')],'app':_0x4f53('0x43'),'appdata':_0x3da72c[_0x4f53('0x32')][_0x413394]+'?'+_0x5e4d5b[_0x4f53('0xb')]+_0x4f53('0x44')+_0x353db8+':'+_0x5e4d5b[_0x4f53('0xb')]+_0x4f53('0x44')+_0x4af4ae,'exten':_0x5e4d5b[_0x4f53('0x6')],'context':_0x5e4d5b[_0x4f53('0xb')],'priority':_0x1acc1e+_0x413394,'VoiceExtensionId':_0x5e4d5b['id']});}if(_0x3da72c['appType']===_0x4f53('0x45'))_0x3da72c['appdata']=_0x32898f(_0x5e4d5b,_0x3da72c[_0x4f53('0x46')]);_0x3da72c[_0x4f53('0x47')]=_0xb67ca[_0x4f53('0x26')]?_['last'](_0xb67ca)[_0x4f53('0x47')]+0x1:_0x1acc1e;_0x3e7e0e=_[_0x4f53('0x48')](_0x3e7e0e,_0xb67ca,[_0x3da72c],_0x23e644);_0x1acc1e=_[_0x4f53('0x49')](_0x3e7e0e)[_0x4f53('0x47')]+0x1;}return _0xb3417f(_0x3e7e0e);})[_0x4f53('0x4a')](function(_0x16e446){_0xee52ca(_0x16e446);});});}return _0x149113[_0x4f53('0x4b')]('VoiceExtension',attributes,{'tableName':_0x4f53('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x31b163){var _0x5b91aa=this[_0x4f53('0x4d')]({'plain':!![]});var _0x3a20c7=_0x5b91aa[_0x4f53('0x3')]===_0x4f53('0x11')?_0x50a841(_0x5b91aa):_0x499965(_0x5b91aa);return _0x196059(_0x5b91aa,_0x31b163,_['last'](_0x3a20c7)[_0x4f53('0x47')]+0x1)[_0x4f53('0x31')](function(_0x5792a6){var _0x5edb1b=_[_0x4f53('0x48')](_0x3a20c7,_0x5792a6);_0x5edb1b[_0x4f53('0xd')]({'type':_0x5b91aa[_0x4f53('0x3')],'app':_0x4f53('0x4e'),'exten':_0x5b91aa['exten'],'context':_0x5b91aa[_0x4f53('0xb')],'priority':_[_0x4f53('0x49')](_0x5edb1b)[_0x4f53('0x47')]+0x1,'VoiceExtensionId':_0x5b91aa['id']});return _0x5edb1b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2c18f0a..60b391b 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 _0x9576=['attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where'];(function(_0xaf2427,_0x504859){var _0x67addb=function(_0x14b655){while(--_0x14b655){_0xaf2427['push'](_0xaf2427['shift']());}};_0x67addb(++_0x504859);}(_0x9576,0x182));var _0x6957=function(_0x10bf75,_0x20869){_0x10bf75=_0x10bf75-0x0;var _0x2675f8=_0x9576[_0x10bf75];return _0x2675f8;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});config[_0x6957('0xb')]=_[_0x6957('0xc')](config[_0x6957('0xb')],{'host':_0x6957('0xd'),'port':0x18eb});var socket=require(_0x6957('0xe'))(new Redis(config[_0x6957('0xb')]));require('./voiceExtension.socket')[_0x6957('0xf')](socket);function respondWithRpcPromise(_0x1dded8,_0x483af0,_0x55078f){return new BPromise(function(_0x3e0520,_0x25c338){return client[_0x6957('0x10')](_0x1dded8,_0x55078f)[_0x6957('0x11')](function(_0x3e2f16){logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x483af0,_0x6957('0x14'),JSON[_0x6957('0x15')](_0x3e2f16));if(_0x3e2f16[_0x6957('0x16')]){if(_0x3e2f16[_0x6957('0x16')][_0x6957('0x17')]===0x1f4){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16['error']['message']);return _0x25c338(_0x3e2f16['error'][_0x6957('0x18')]);}logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16[_0x6957('0x16')]['message']);return _0x3e0520(_0x3e2f16[_0x6957('0x16')]['message']);}else{logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');_0x3e0520(_0x3e2f16[_0x6957('0x19')][_0x6957('0x18')]);}})[_0x6957('0x1a')](function(_0x4c527c){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x4c527c);_0x25c338(_0x4c527c);});});}exports[_0x6957('0x1b')]=function(_0x135893){var _0x1ce753=this;return new Promise(function(_0x26d3fd,_0x35ee5b){return db[_0x6957('0x1c')]['findAll']({'raw':_0x135893['options']?_0x135893[_0x6957('0x1d')][_0x6957('0x1e')]===undefined?!![]:![]:!![],'where':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x1f')]||null:null,'attributes':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x20')]||null:null,'limit':_0x135893['options']?_0x135893[_0x6957('0x1d')][_0x6957('0x21')]||null:null,'include':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')]['include']?_['map'](_0x135893[_0x6957('0x1d')][_0x6957('0x22')],function(_0x5c4e49){return{'model':db[_0x5c4e49['model']],'as':_0x5c4e49['as'],'attributes':_0x5c4e49[_0x6957('0x20')],'include':_0x5c4e49[_0x6957('0x22')]?_[_0x6957('0x23')](_0x5c4e49['include'],function(_0x330015){return{'model':db[_0x330015[_0x6957('0x24')]],'as':_0x330015['as'],'attributes':_0x330015[_0x6957('0x20')],'include':_0x330015[_0x6957('0x22')]?_[_0x6957('0x23')](_0x330015[_0x6957('0x22')],function(_0x2d33ef){return{'model':db[_0x2d33ef[_0x6957('0x24')]],'as':_0x2d33ef['as'],'attributes':_0x2d33ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x6957('0x11')](function(_0x3a6e07){logger[_0x6957('0x12')](_0x6957('0x1b'),_0x135893);logger[_0x6957('0x25')](_0x6957('0x1b'),_0x135893,JSON[_0x6957('0x15')](_0x3a6e07));_0x26d3fd(_0x3a6e07);})[_0x6957('0x1a')](function(_0x1300b1){logger[_0x6957('0x16')](_0x6957('0x1b'),_0x1300b1['message'],_0x135893);_0x35ee5b(_0x1ce753['error'](0x1f4,_0x1300b1[_0x6957('0x18')]));});});}; \ No newline at end of file +var _0xcb66=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','VoiceExtension','findAll','raw','options','where','attributes','limit','include','map','model','then','GetVoiceExtension','util','moment','bluebird'];(function(_0x1f80c3,_0x129b83){var _0x3c0a25=function(_0x2cac18){while(--_0x2cac18){_0x1f80c3['push'](_0x1f80c3['shift']());}};_0x3c0a25(++_0x129b83);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xcb66[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));var BPromise=require(_0x6cb6('0x2'));var rs=require(_0x6cb6('0x3'));var fs=require('fs');var Redis=require(_0x6cb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cb6('0x5'));var logger=require(_0x6cb6('0x6'))(_0x6cb6('0x7'));var config=require(_0x6cb6('0x8'));var jayson=require(_0x6cb6('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6cb6('0xa')]=_[_0x6cb6('0xb')](config[_0x6cb6('0xa')],{'host':_0x6cb6('0xc'),'port':0x18eb});var socket=require(_0x6cb6('0xd'))(new Redis(config[_0x6cb6('0xa')]));require(_0x6cb6('0xe'))[_0x6cb6('0xf')](socket);function respondWithRpcPromise(_0x332bce,_0x357ada,_0x3aa2b5){return new BPromise(function(_0xb7e9e,_0x1828f6){return client['request'](_0x332bce,_0x3aa2b5)['then'](function(_0x576aea){logger['info'](_0x6cb6('0x10'),_0x357ada,_0x6cb6('0x11'));logger[_0x6cb6('0x12')](_0x6cb6('0x13'),_0x357ada,'request\x20sent',JSON[_0x6cb6('0x14')](_0x576aea));if(_0x576aea[_0x6cb6('0x15')]){if(_0x576aea['error'][_0x6cb6('0x16')]===0x1f4){logger[_0x6cb6('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x357ada,_0x576aea[_0x6cb6('0x15')][_0x6cb6('0x17')]);return _0x1828f6(_0x576aea['error']['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x357ada,_0x576aea[_0x6cb6('0x15')][_0x6cb6('0x17')]);return _0xb7e9e(_0x576aea[_0x6cb6('0x15')][_0x6cb6('0x17')]);}else{logger[_0x6cb6('0x18')](_0x6cb6('0x10'),_0x357ada,'request\x20sent');_0xb7e9e(_0x576aea[_0x6cb6('0x19')][_0x6cb6('0x17')]);}})['catch'](function(_0x4b9da5){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x357ada,_0x4b9da5);_0x1828f6(_0x4b9da5);});});}exports['GetVoiceExtension']=function(_0x5e5349){var _0x390c9b=this;return new Promise(function(_0xcd1afa,_0x407455){return db[_0x6cb6('0x1a')][_0x6cb6('0x1b')]({'raw':_0x5e5349['options']?_0x5e5349['options'][_0x6cb6('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e5349[_0x6cb6('0x1d')]?_0x5e5349[_0x6cb6('0x1d')][_0x6cb6('0x1e')]||null:null,'attributes':_0x5e5349['options']?_0x5e5349[_0x6cb6('0x1d')][_0x6cb6('0x1f')]||null:null,'limit':_0x5e5349['options']?_0x5e5349['options'][_0x6cb6('0x20')]||null:null,'include':_0x5e5349['options']?_0x5e5349[_0x6cb6('0x1d')][_0x6cb6('0x21')]?_[_0x6cb6('0x22')](_0x5e5349[_0x6cb6('0x1d')][_0x6cb6('0x21')],function(_0x16db1d){return{'model':db[_0x16db1d[_0x6cb6('0x23')]],'as':_0x16db1d['as'],'attributes':_0x16db1d[_0x6cb6('0x1f')],'include':_0x16db1d[_0x6cb6('0x21')]?_[_0x6cb6('0x22')](_0x16db1d['include'],function(_0x5c525b){return{'model':db[_0x5c525b['model']],'as':_0x5c525b['as'],'attributes':_0x5c525b[_0x6cb6('0x1f')],'include':_0x5c525b[_0x6cb6('0x21')]?_[_0x6cb6('0x22')](_0x5c525b[_0x6cb6('0x21')],function(_0x1f8c9d){return{'model':db[_0x1f8c9d[_0x6cb6('0x23')]],'as':_0x1f8c9d['as'],'attributes':_0x1f8c9d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cb6('0x24')](function(_0x4d4ad9){logger[_0x6cb6('0x18')]('GetVoiceExtension',_0x5e5349);logger[_0x6cb6('0x12')](_0x6cb6('0x25'),_0x5e5349,JSON[_0x6cb6('0x14')](_0x4d4ad9));_0xcd1afa(_0x4d4ad9);})['catch'](function(_0x417dec){logger[_0x6cb6('0x15')](_0x6cb6('0x25'),_0x417dec['message'],_0x5e5349);_0x407455(_0x390c9b[_0x6cb6('0x15')](0x1f4,_0x417dec[_0x6cb6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4fd48a8..0596dc7 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x251699,_0x549104){var _0xcf1b50=function(_0xce46e8){while(--_0xce46e8){_0x251699['push'](_0x251699['shift']());}};_0xcf1b50(++_0x549104);}(_0x53ec,0x192));var _0xc53e=function(_0x29632e,_0x40f63f){_0x29632e=_0x29632e-0x0;var _0xda5a7e=_0x53ec[_0x29632e];return _0xda5a7e;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4258fb,_0x3425ff){_0x4258fb=_0x4258fb-0x0;var _0x4c89b5=_0x1cb9[_0x4258fb];return _0x4c89b5;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 636a799..a4c6b64 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 _0x4991=['show','/:id/messages','post','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated'];(function(_0x5ea72f,_0x1ad3c6){var _0x49be44=function(_0x3fa258){while(--_0x3fa258){_0x5ea72f['push'](_0x5ea72f['shift']());}};_0x49be44(++_0x1ad3c6);}(_0x4991,0xf7));var _0x1499=function(_0x5e1ddd,_0x24438e){_0x5e1ddd=_0x5e1ddd-0x0;var _0x3addc5=_0x4991[_0x5e1ddd];return _0x3addc5;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['getMessages']);router[_0x1499('0xf')]('/',auth[_0x1499('0xc')](),controller['create']);router[_0x1499('0x10')](_0x1499('0xb'),auth['isAuthenticated'](),controller[_0x1499('0x11')]);router[_0x1499('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1499('0x13')]=router; \ No newline at end of file +var _0x82c4=['express','Router','fs-extra','../../components/interaction/service','./voiceMail.controller','isAuthenticated','get','/:id','show','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x82c4,0x1ca));var _0x482c=function(_0x2ba279,_0x4297a0){_0x2ba279=_0x2ba279-0x0;var _0xea4ae1=_0x82c4[_0x2ba279];return _0xea4ae1;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var fs_extra=require(_0x482c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x482c('0x7'));var config=require('../../config/environment');var controller=require(_0x482c('0x8'));router['get']('/',auth[_0x482c('0x9')](),controller['index']);router[_0x482c('0xa')](_0x482c('0xb'),auth[_0x482c('0x9')](),controller[_0x482c('0xc')]);router[_0x482c('0xa')]('/:id/messages',auth[_0x482c('0x9')](),controller[_0x482c('0xd')]);router[_0x482c('0xe')]('/',auth[_0x482c('0x9')](),controller[_0x482c('0xf')]);router[_0x482c('0x10')]('/:id',auth[_0x482c('0x9')](),controller[_0x482c('0x11')]);router[_0x482c('0x12')]('/:id',auth[_0x482c('0x9')](),controller[_0x482c('0x13')]);module[_0x482c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 30245b6..a4f2d8d 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 _0xcde0=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x40ce01,_0x1e39c8){var _0xa0f16e=function(_0x2356ad){while(--_0x2356ad){_0x40ce01['push'](_0x40ce01['shift']());}};_0xa0f16e(++_0x1e39c8);}(_0xcde0,0x193));var _0x0cde=function(_0x3a6dbb,_0x484fc8){_0x3a6dbb=_0x3a6dbb-0x0;var _0x1a4f5c=_0xcde0[_0x3a6dbb];return _0x1a4f5c;};'use strict';var Sequelize=require('sequelize');module[_0x0cde('0x0')]={'customer_id':{'type':Sequelize[_0x0cde('0x1')]},'context':{'type':Sequelize[_0x0cde('0x1')],'defaultValue':_0x0cde('0x2'),'unique':_0x0cde('0x3')},'mailbox':{'type':Sequelize[_0x0cde('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0cde('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0cde('0x1')],'validate':{'isEmail':!![]},'set':function(_0x2e57ac){this[_0x0cde('0x4')]('email',typeof _0x2e57ac===_0x0cde('0x5')&&_0x2e57ac[_0x0cde('0x6')]()?_0x2e57ac[_0x0cde('0x6')]():null);}},'pager':{'type':Sequelize[_0x0cde('0x1')]},'tz':{'type':Sequelize[_0x0cde('0x1')],'defaultValue':_0x0cde('0x7')},'attach':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0cde('0x1')]},'callback':{'type':Sequelize[_0x0cde('0x1')]},'review':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0cde('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0cde('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0cde('0x8')]('yes','no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0cde('0x8')](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0cde('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0cde('0x8')]('yes','no'),'defaultValue':_0x0cde('0x9'),'allowNull':![]},'stamp':{'type':_0x0cde('0xb')},'emailsubject':{'type':Sequelize[_0x0cde('0x1')]},'emailbody':{'type':Sequelize[_0x0cde('0x1')]},'maxsecs':{'type':Sequelize[_0x0cde('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0cde('0xd')],'get':function(){return this[_0x0cde('0xe')](_0x0cde('0xf'))+_0x0cde('0x10')+this[_0x0cde('0xe')](_0x0cde('0x11'));}}}; \ No newline at end of file +var _0xfc2a=['\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname'];(function(_0x2a1338,_0x29f7aa){var _0xc02469=function(_0x475e5f){while(--_0x475e5f){_0x2a1338['push'](_0x2a1338['shift']());}};_0xc02469(++_0x29f7aa);}(_0xfc2a,0xb7));var _0xafc2=function(_0x103589,_0x2acf11){_0x103589=_0x103589-0x0;var _0x3ea116=_0xfc2a[_0x103589];return _0x3ea116;};'use strict';var Sequelize=require(_0xafc2('0x0'));module[_0xafc2('0x1')]={'customer_id':{'type':Sequelize[_0xafc2('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0xafc2('0x3')},'mailbox':{'type':Sequelize[_0xafc2('0x2')],'defaultValue':'','allowNull':![],'unique':_0xafc2('0x3')},'password':{'type':Sequelize[_0xafc2('0x2')]},'fullname':{'type':Sequelize[_0xafc2('0x2')]},'email':{'type':Sequelize[_0xafc2('0x2')],'validate':{'isEmail':!![]},'set':function(_0x414b5d){this[_0xafc2('0x4')]('email',typeof _0x414b5d===_0xafc2('0x5')&&_0x414b5d[_0xafc2('0x6')]()?_0x414b5d['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xafc2('0x2')],'defaultValue':_0xafc2('0x7')},'attach':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':_0xafc2('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':_0xafc2('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xafc2('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xafc2('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xafc2('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':_0xafc2('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xafc2('0x8')](_0xafc2('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xafc2('0xb')},'emailsubject':{'type':Sequelize[_0xafc2('0x2')]},'emailbody':{'type':Sequelize[_0xafc2('0x2')]},'maxsecs':{'type':Sequelize[_0xafc2('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xafc2('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xafc2('0xd')],'get':function(){return this['getDataValue'](_0xafc2('0xe'))+_0xafc2('0xf')+this[_0xafc2('0x10')](_0xafc2('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 58d3a06..4267cbf 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 _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb574,0x106));var _0x4b57=function(_0x3ff5ea,_0x40f5a7){_0x3ff5ea=_0x3ff5ea-0x0;var _0xcc5b36=_0xb574[_0x3ff5ea];return _0xcc5b36;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file +var _0xb688=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','nolimit','filter','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','get','Voicemails','end','error','name','send','index','map','VoiceMail'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xb688,0xcf));var _0x8b68=function(_0x14dfee,_0x1b9ba0){_0x14dfee=_0x14dfee-0x0;var _0x16f529=_0xb688[_0x14dfee];return _0x16f529;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){var _0x4ca77d=_0x59bb8a[_0x8b68('0x27')]({'plain':!![]});var _0x3cf8d2=_0x8b68('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cf8d2,'resourceId':_0x4ca77d['id']}})['then'](function(){return _0x59bb8a;});})[_0x8b68('0x25')](function(){_0x32ddc5[_0x8b68('0x1c')](0xcc)[_0x8b68('0x29')]();});}};}function handleEntityNotFound(_0x583476,_0x3311c7){return function(_0x53aaa2){if(!_0x53aaa2){_0x583476['sendStatus'](0x194);}return _0x53aaa2;};}function handleError(_0x3865ea,_0x59b3ce){_0x59b3ce=_0x59b3ce||0x1f4;return function(_0x26cad7){logger[_0x8b68('0x2a')](_0x26cad7['stack']);if(_0x26cad7['name']){delete _0x26cad7[_0x8b68('0x2b')];}_0x3865ea[_0x8b68('0x1c')](_0x59b3ce)[_0x8b68('0x2c')](_0x26cad7);};}exports[_0x8b68('0x2d')]=function(_0x210926,_0x2ad2df){var _0x460c37={},_0x5b7ed1={},_0x3b6d1b={'count':0x0,'rows':[]};var _0x50a1e9=_[_0x8b68('0x2e')](db[_0x8b68('0x2f')]['rawAttributes'],function(_0x216aa6){return{'name':_0x216aa6[_0x8b68('0x30')],'type':_0x216aa6[_0x8b68('0x31')]['key']};});_0x5b7ed1['model']=_[_0x8b68('0x2e')](_0x50a1e9,_0x8b68('0x2b'));_0x5b7ed1[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x210926[_0x8b68('0x32')]);_0x5b7ed1[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],_0x5b7ed1[_0x8b68('0x32')]);_0x460c37[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x210926[_0x8b68('0x32')][_0x8b68('0x38')]));_0x460c37[_0x8b68('0x37')]=_0x460c37[_0x8b68('0x37')][_0x8b68('0x39')]?_0x460c37[_0x8b68('0x37')]:_0x5b7ed1[_0x8b68('0x36')];if(!_0x210926[_0x8b68('0x32')][_0x8b68('0x3a')]('nolimit')){_0x460c37['limit']=qs[_0x8b68('0x1f')](_0x210926[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x460c37[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x210926[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x460c37[_0x8b68('0x3b')]=qs['sort'](_0x210926[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x460c37[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x210926[_0x8b68('0x32')],_0x5b7ed1[_0x8b68('0x34')]),_0x50a1e9);if(_0x210926[_0x8b68('0x32')]['filter']){_0x460c37[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x460c37[_0x8b68('0x3d')],{'$or':_[_0x8b68('0x2e')](_0x50a1e9,function(_0x3ecc60){if(_0x3ecc60[_0x8b68('0x31')]!==_0x8b68('0x40')){var _0x50a9c6={};_0x50a9c6[_0x3ecc60[_0x8b68('0x2b')]]={'$like':'%'+_0x210926[_0x8b68('0x32')]['filter']+'%'};return _0x50a9c6;}})});}_0x460c37=_[_0x8b68('0x3f')]({},_0x460c37,_0x210926[_0x8b68('0x41')]);var _0x50b2f1={'where':_0x460c37['where']};return db['VoiceMail']['count'](_0x50b2f1)[_0x8b68('0x25')](function(_0x23d24a){_0x3b6d1b['count']=_0x23d24a;if(_0x210926[_0x8b68('0x32')]['includeAll']){_0x460c37[_0x8b68('0x42')]=[{'all':!![]}];}return db[_0x8b68('0x2f')]['findAll'](_0x460c37);})[_0x8b68('0x25')](function(_0x5ae345){_0x3b6d1b['rows']=_0x5ae345;return _0x3b6d1b;})['then'](respondWithFilteredResult(_0x2ad2df,_0x460c37))[_0x8b68('0x43')](handleError(_0x2ad2df,null));};exports[_0x8b68('0x44')]=function(_0x3ba80e,_0xa70f60){var _0x50e425={'raw':!![],'where':{'id':_0x3ba80e['params']['id']}},_0x20162a={};_0x20162a[_0x8b68('0x36')]=_[_0x8b68('0x33')](db['VoiceMail'][_0x8b68('0x45')]);_0x20162a[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ba80e[_0x8b68('0x32')]);_0x20162a['filters']=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],_0x20162a[_0x8b68('0x32')]);_0x50e425[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x50e425[_0x8b68('0x37')]=_0x50e425[_0x8b68('0x37')][_0x8b68('0x39')]?_0x50e425[_0x8b68('0x37')]:_0x20162a[_0x8b68('0x36')];if(_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x46')]){_0x50e425['include']=[{'all':!![]}];}_0x50e425=_[_0x8b68('0x3f')]({},_0x50e425,_0x3ba80e[_0x8b68('0x41')]);return db['VoiceMail'][_0x8b68('0x47')](_0x50e425)['then'](handleEntityNotFound(_0xa70f60,null))['then'](respondWithResult(_0xa70f60,null))['catch'](handleError(_0xa70f60,null));};exports[_0x8b68('0x48')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2f')]['create'](_0x35874b['body'],{})[_0x8b68('0x25')](function(_0x163fd5){var _0x1e900f=_0x35874b['user'][_0x8b68('0x27')]({'plain':!![]});if(!_0x1e900f)throw new Error(_0x8b68('0x49'));if(_0x1e900f['role']===_0x8b68('0x4a')){var _0xacac82=_0x163fd5['get']({'plain':!![]});var _0x18a9ae=_0x8b68('0x28');return db['UserProfileSection'][_0x8b68('0x47')]({'where':{'name':_0x18a9ae,'userProfileId':_0x1e900f[_0x8b68('0x4b')]},'raw':!![]})['then'](function(_0x543d74){if(_0x543d74&&_0x543d74['autoAssociation']===0x0){return db[_0x8b68('0x4c')][_0x8b68('0x48')]({'name':_0xacac82[_0x8b68('0x2b')],'resourceId':_0xacac82['id'],'type':_0x543d74[_0x8b68('0x2b')],'sectionId':_0x543d74['id']},{})['then'](function(){return _0x163fd5;});}else{return _0x163fd5;}})['catch'](function(_0x4492fd){logger[_0x8b68('0x2a')](_0x8b68('0x4d'),_0x4492fd);throw _0x4492fd;});}return _0x163fd5;})['then'](respondWithResult(_0x34047c,0xc9))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports[_0x8b68('0x24')]=function(_0x3f9d34,_0x4dda69){if(_0x3f9d34[_0x8b68('0x4e')]['id']){delete _0x3f9d34['body']['id'];}return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x3f9d34['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x4dda69,null))[_0x8b68('0x25')](saveUpdates(_0x3f9d34[_0x8b68('0x4e')],null))[_0x8b68('0x25')](respondWithResult(_0x4dda69,null))[_0x8b68('0x43')](handleError(_0x4dda69,null));};exports['destroy']=function(_0x241166,_0x3f3e43){return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x241166[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x3f3e43,null))[_0x8b68('0x25')](removeEntity(_0x3f3e43,null))[_0x8b68('0x43')](handleError(_0x3f3e43,null));};exports['getMessages']=function(_0x3f423e,_0x1a85da,_0x1e8694){return db[_0x8b68('0x2f')][_0x8b68('0x50')]({'where':{'id':_0x3f423e[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x25')](function(_0x6d63cb){var _0x271dbe;var _0x368c86={},_0x42871e={};_0x42871e[_0x8b68('0x36')]=_[_0x8b68('0x33')](db[_0x8b68('0x51')][_0x8b68('0x45')]);_0x42871e[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3f423e[_0x8b68('0x32')]);_0x42871e[_0x8b68('0x34')]=_['intersection'](_0x42871e[_0x8b68('0x36')],_0x42871e['query']);_0x368c86['attributes']=_[_0x8b68('0x35')](_0x42871e['model'],qs[_0x8b68('0x38')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x368c86['attributes']=_0x368c86[_0x8b68('0x37')][_0x8b68('0x39')]?_0x368c86[_0x8b68('0x37')]:_0x42871e[_0x8b68('0x36')];if(!_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3a')](_0x8b68('0x52'))){_0x368c86['limit']=qs['limit'](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x368c86[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x368c86[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x368c86[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x3f423e[_0x8b68('0x32')],_0x42871e[_0x8b68('0x34')]));if(_0x3f423e[_0x8b68('0x32')][_0x8b68('0x53')]){_0x368c86[_0x8b68('0x3d')]=_['merge'](_0x368c86['where'],{'$or':_[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x37')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x3f423e['query'][_0x8b68('0x53')]+'%'};return _0x48d57a;})});}_0x368c86[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x368c86[_0x8b68('0x3d')],{'mailboxuser':_0x6d63cb[_0x8b68('0x54')]});_0x368c86=_['merge']({},_0x368c86,_0x3f423e[_0x8b68('0x41')]);return db[_0x8b68('0x51')]['findAndCountAll'](_0x368c86)[_0x8b68('0x25')](respondWithFilteredResult(_0x1a85da,_0x368c86));})['catch'](handleError(_0x1a85da,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b7f1523..8fabc4d 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 _0x5385=['exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x526c9a,_0x571d87){var _0x22f2eb=function(_0x1c9e9e){while(--_0x1c9e9e){_0x526c9a['push'](_0x526c9a['shift']());}};_0x22f2eb(++_0x571d87);}(_0x5385,0x106));var _0x5538=function(_0x10f50f,_0x5d655c){_0x10f50f=_0x10f50f-0x0;var _0x3ea740=_0x5385[_0x10f50f];return _0x3ea740;};'use strict';var _=require(_0x5538('0x0'));var util=require('util');var logger=require(_0x5538('0x1'))(_0x5538('0x2'));var moment=require(_0x5538('0x3'));var BPromise=require(_0x5538('0x4'));var rp=require(_0x5538('0x5'));var fs=require('fs');var path=require(_0x5538('0x6'));var rimraf=require(_0x5538('0x7'));var config=require(_0x5538('0x8'));var attributes=require(_0x5538('0x9'));module[_0x5538('0xa')]=function(_0x1b92b6,_0x55ece9){return _0x1b92b6[_0x5538('0xb')](_0x5538('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x5538('0xd'),'fields':[_0x5538('0xe'),_0x5538('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5212=['exports','mailbox','context','lodash','../../config/logger','bluebird','rimraf'];(function(_0x22c965,_0x2297e7){var _0x8cf3a9=function(_0x1a816b){while(--_0x1a816b){_0x22c965['push'](_0x22c965['shift']());}};_0x8cf3a9(++_0x2297e7);}(_0x5212,0x65));var _0x2521=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x5212[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x2521('0x0'));var util=require('util');var logger=require(_0x2521('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2521('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2521('0x3'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x2521('0x4')]=function(_0x1539ef,_0x4375c8){return _0x1539ef['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x2521('0x5'),_0x2521('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 79f7741..8714c31 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 _0x618f=['bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x34f554,_0x4535cf){var _0x3fd23b=function(_0x5d1aff){while(--_0x5d1aff){_0x34f554['push'](_0x34f554['shift']());}};_0x3fd23b(++_0x4535cf);}(_0x618f,0x19f));var _0xf618=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x618f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf618('0x0'));var util=require(_0xf618('0x1'));var moment=require(_0xf618('0x2'));var BPromise=require(_0xf618('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf618('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf618('0x5'))('rpc');var config=require(_0xf618('0x6'));var jayson=require(_0xf618('0x7'));var client=jayson[_0xf618('0x8')][_0xf618('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6352b5,_0x25696b,_0x399fe4){return new BPromise(function(_0x42e773,_0x573ea8){return client['request'](_0x6352b5,_0x399fe4)[_0xf618('0xa')](function(_0x5947e8){logger['info'](_0xf618('0xb'),_0x25696b,_0xf618('0xc'));logger[_0xf618('0xd')](_0xf618('0xe'),_0x25696b,_0xf618('0xc'),JSON[_0xf618('0xf')](_0x5947e8));if(_0x5947e8[_0xf618('0x10')]){if(_0x5947e8[_0xf618('0x10')][_0xf618('0x11')]===0x1f4){logger[_0xf618('0x10')](_0xf618('0xb'),_0x25696b,_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);return _0x573ea8(_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x25696b,_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);return _0x42e773(_0x5947e8[_0xf618('0x10')][_0xf618('0x12')]);}else{logger[_0xf618('0x13')](_0xf618('0xb'),_0x25696b,'request\x20sent');_0x42e773(_0x5947e8[_0xf618('0x14')][_0xf618('0x12')]);}})[_0xf618('0x15')](function(_0x132708){logger[_0xf618('0x10')](_0xf618('0xb'),_0x25696b,_0x132708);_0x573ea8(_0x132708);});});} \ No newline at end of file +var _0x9c16=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x52eb75,_0x545010){var _0x10294a=function(_0x25399f){while(--_0x25399f){_0x52eb75['push'](_0x52eb75['shift']());}};_0x10294a(++_0x545010);}(_0x9c16,0x6f));var _0x69c1=function(_0x202fc8,_0x175b50){_0x202fc8=_0x202fc8-0x0;var _0x511804=_0x9c16[_0x202fc8];return _0x511804;};'use strict';var _=require(_0x69c1('0x0'));var util=require('util');var moment=require(_0x69c1('0x1'));var BPromise=require(_0x69c1('0x2'));var rs=require(_0x69c1('0x3'));var fs=require('fs');var Redis=require(_0x69c1('0x4'));var db=require(_0x69c1('0x5'))['db'];var utils=require(_0x69c1('0x6'));var logger=require(_0x69c1('0x7'))(_0x69c1('0x8'));var config=require('../../config/environment');var jayson=require(_0x69c1('0x9'));var client=jayson['client'][_0x69c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x555474,_0x36c3b9,_0x425e2d){return new BPromise(function(_0x1f89f1,_0x5a631b){return client[_0x69c1('0xb')](_0x555474,_0x425e2d)[_0x69c1('0xc')](function(_0x18a219){logger[_0x69c1('0xd')](_0x69c1('0xe'),_0x36c3b9,_0x69c1('0xf'));logger[_0x69c1('0x10')](_0x69c1('0x11'),_0x36c3b9,_0x69c1('0xf'),JSON['stringify'](_0x18a219));if(_0x18a219['error']){if(_0x18a219['error']['code']===0x1f4){logger[_0x69c1('0x12')]('VoiceMail,\x20%s,\x20%s',_0x36c3b9,_0x18a219[_0x69c1('0x12')][_0x69c1('0x13')]);return _0x5a631b(_0x18a219['error']['message']);}logger[_0x69c1('0x12')](_0x69c1('0xe'),_0x36c3b9,_0x18a219['error'][_0x69c1('0x13')]);return _0x1f89f1(_0x18a219[_0x69c1('0x12')][_0x69c1('0x13')]);}else{logger['info'](_0x69c1('0xe'),_0x36c3b9,_0x69c1('0xf'));_0x1f89f1(_0x18a219[_0x69c1('0x14')][_0x69c1('0x13')]);}})[_0x69c1('0x15')](function(_0x18386c){logger[_0x69c1('0x12')](_0x69c1('0xe'),_0x36c3b9,_0x18386c);_0x5a631b(_0x18386c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4496f94..53ae883 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 _0x05c4=['index','show','get','/:id/download','download','create','put','update','delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated'];(function(_0x4e0691,_0x168052){var _0x138faa=function(_0x3dd722){while(--_0x3dd722){_0x4e0691['push'](_0x4e0691['shift']());}};_0x138faa(++_0x168052);}(_0x05c4,0x1d7));var _0x405c=function(_0x2ff6b7,_0x131c69){_0x2ff6b7=_0x2ff6b7-0x0;var _0x1881ec=_0x05c4[_0x2ff6b7];return _0x1881ec;};'use strict';var multer=require(_0x405c('0x0'));var util=require(_0x405c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x405c('0x2'));var router=express[_0x405c('0x3')]();var fs_extra=require(_0x405c('0x4'));var auth=require(_0x405c('0x5'));var interaction=require(_0x405c('0x6'));var config=require('../../config/environment');var controller=require(_0x405c('0x7'));router['get']('/',auth[_0x405c('0x8')](),controller[_0x405c('0x9')]);router['get']('/:id',auth[_0x405c('0x8')](),controller[_0x405c('0xa')]);router[_0x405c('0xb')](_0x405c('0xc'),auth[_0x405c('0x8')](),controller[_0x405c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x405c('0xe')]);router[_0x405c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x405c('0x10')]);router[_0x405c('0x11')](_0x405c('0x12'),auth[_0x405c('0x8')](),controller['destroy']);module[_0x405c('0x13')]=router; \ No newline at end of file +var _0x04eb=['../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id/download','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x04eb,0x79));var _0xb04e=function(_0x123c38,_0x2c5188){_0x123c38=_0x123c38-0x0;var _0x203c01=_0x04eb[_0x123c38];return _0x203c01;};'use strict';var multer=require(_0xb04e('0x0'));var util=require('util');var path=require(_0xb04e('0x1'));var timeout=require(_0xb04e('0x2'));var express=require('express');var router=express[_0xb04e('0x3')]();var fs_extra=require(_0xb04e('0x4'));var auth=require(_0xb04e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb04e('0x6'));var controller=require(_0xb04e('0x7'));router['get']('/',auth[_0xb04e('0x8')](),controller[_0xb04e('0x9')]);router[_0xb04e('0xa')]('/:id',auth[_0xb04e('0x8')](),controller['show']);router[_0xb04e('0xa')](_0xb04e('0xb'),auth[_0xb04e('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xb04e('0xc')]);router[_0xb04e('0xd')](_0xb04e('0xe'),auth[_0xb04e('0x8')](),controller[_0xb04e('0xf')]);router['delete'](_0xb04e('0xe'),auth[_0xb04e('0x8')](),controller[_0xb04e('0x10')]);module[_0xb04e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b77d095..0139fe8 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 _0x3e5a=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3e5a,0x198));var _0xa3e5=function(_0x1daf41,_0x4081aa){_0x1daf41=_0x1daf41-0x0;var _0xf7c5b3=_0x3e5a[_0x1daf41];return _0xf7c5b3;};'use strict';var Sequelize=require(_0xa3e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3e5('0x1')],'get':function(_0x5a7e26){return this[_0xa3e5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa3e5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa3e5('0x5')](_0xa3e5('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa3e5('0x4')],'defaultValue':''},'stamp':{'type':_0xa3e5('0x7'),'defaultValue':Sequelize[_0xa3e5('0x8')](_0xa3e5('0x9'))}}; \ No newline at end of file +var _0x9b1f=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','BLOB'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x9b1f,0x113));var _0xf9b1=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x9b1f[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require('sequelize');module[_0xf9b1('0x0')]={'name':{'type':Sequelize[_0xf9b1('0x1')],'get':function(_0x5ef58b){return this[_0xf9b1('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xf9b1('0x4')](_0xf9b1('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf9b1('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf9b1('0x6')](_0xf9b1('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f7da2d8..47706dd 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 _0xf61c=['catch','show','params','create','body','find','download','msg_id','recording','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','rows'];(function(_0xb23b5f,_0x27b6a3){var _0x21e54c=function(_0xc9ea85){while(--_0xc9ea85){_0xb23b5f['push'](_0xb23b5f['shift']());}};_0x21e54c(++_0x27b6a3);}(_0xf61c,0x114));var _0xcf61=function(_0x42bd4b,_0xde9b3f){_0x42bd4b=_0x42bd4b-0x0;var _0x2c4f1a=_0xf61c[_0x42bd4b];return _0x2c4f1a;};'use strict';var emlformat=require(_0xcf61('0x0'));var rimraf=require(_0xcf61('0x1'));var zipdir=require(_0xcf61('0x2'));var jsonpatch=require(_0xcf61('0x3'));var rp=require(_0xcf61('0x4'));var moment=require(_0xcf61('0x5'));var BPromise=require(_0xcf61('0x6'));var Mustache=require('mustache');var util=require(_0xcf61('0x7'));var path=require(_0xcf61('0x8'));var sox=require(_0xcf61('0x9'));var csv=require(_0xcf61('0xa'));var ejs=require(_0xcf61('0xb'));var fs=require('fs');var fs_extra=require(_0xcf61('0xc'));var _=require(_0xcf61('0xd'));var squel=require('squel');var crypto=require(_0xcf61('0xe'));var jsforce=require(_0xcf61('0xf'));var deskjs=require(_0xcf61('0x10'));var toCsv=require(_0xcf61('0xa'));var querystring=require(_0xcf61('0x11'));var Papa=require(_0xcf61('0x12'));var Redis=require('ioredis');var authService=require(_0xcf61('0x13'));var qs=require(_0xcf61('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf61('0x15'));var logger=require('../../config/logger')(_0xcf61('0x16'));var utils=require(_0xcf61('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf61('0x18'))['db'];function respondWithStatusCode(_0x330f94,_0x28bae8){_0x28bae8=_0x28bae8||0xcc;return function(_0x31fc03){if(_0x31fc03){return _0x330f94[_0xcf61('0x19')](_0x28bae8);}return _0x330f94[_0xcf61('0x1a')](_0x28bae8)[_0xcf61('0x1b')]();};}function respondWithResult(_0xfe41bd,_0x496c74){_0x496c74=_0x496c74||0xc8;return function(_0x3ad915){if(_0x3ad915){return _0xfe41bd[_0xcf61('0x1a')](_0x496c74)[_0xcf61('0x1c')](_0x3ad915);}};}function respondWithFilteredResult(_0x4ee5ee,_0x29e439){return function(_0x3e4c90){if(_0x3e4c90){var _0x4488da=typeof _0x29e439[_0xcf61('0x1d')]===_0xcf61('0x1e')&&typeof _0x29e439['limit']===_0xcf61('0x1e');var _0x1468e9=_0x3e4c90[_0xcf61('0x1f')];var _0x42a5d1=_0x4488da?0x0:_0x29e439[_0xcf61('0x1d')];var _0x13bde2=_0x4488da?_0x3e4c90['count']:_0x29e439[_0xcf61('0x1d')]+_0x29e439[_0xcf61('0x20')];var _0x597281;if(_0x13bde2>=_0x1468e9){_0x13bde2=_0x1468e9;_0x597281=0xc8;}else{_0x597281=0xce;}_0x4ee5ee[_0xcf61('0x1a')](_0x597281);return _0x4ee5ee[_0xcf61('0x21')]('Content-Range',_0x42a5d1+'-'+_0x13bde2+'/'+_0x1468e9)[_0xcf61('0x1c')](_0x3e4c90);}return null;};}function patchUpdates(_0x2dd2fd){return function(_0x1ee17c){try{jsonpatch['apply'](_0x1ee17c,_0x2dd2fd,!![]);}catch(_0x5b24a2){return BPromise[_0xcf61('0x22')](_0x5b24a2);}return _0x1ee17c[_0xcf61('0x23')]();};}function saveUpdates(_0x58aef5,_0x3f1475){return function(_0x15a64e){if(_0x15a64e){return _0x15a64e[_0xcf61('0x24')](_0x58aef5)[_0xcf61('0x25')](function(_0x476839){return _0x476839;});}return null;};}function removeEntity(_0x17f277,_0x35c456){return function(_0xe30600){if(_0xe30600){return _0xe30600[_0xcf61('0x26')]()[_0xcf61('0x25')](function(){_0x17f277[_0xcf61('0x1a')](0xcc)[_0xcf61('0x1b')]();});}};}function handleEntityNotFound(_0x30d3c2,_0x1725dd){return function(_0x4452e6){if(!_0x4452e6){_0x30d3c2['sendStatus'](0x194);}return _0x4452e6;};}function handleError(_0x28afd2,_0x459097){_0x459097=_0x459097||0x1f4;return function(_0x6c7d3){logger[_0xcf61('0x27')](_0x6c7d3[_0xcf61('0x28')]);if(_0x6c7d3[_0xcf61('0x29')]){delete _0x6c7d3[_0xcf61('0x29')];}_0x28afd2[_0xcf61('0x1a')](_0x459097)[_0xcf61('0x2a')](_0x6c7d3);};}exports[_0xcf61('0x2b')]=function(_0x47b368,_0x303638){var _0x52064f={},_0x3b13e3={},_0x442690={'count':0x0,'rows':[]};var _0x33c213=_[_0xcf61('0x2c')](db['VoiceMailMessage'][_0xcf61('0x2d')],function(_0x3e1ecc){return{'name':_0x3e1ecc[_0xcf61('0x2e')],'type':_0x3e1ecc[_0xcf61('0x2f')][_0xcf61('0x30')]};});_0x3b13e3['model']=_[_0xcf61('0x31')](_[_0xcf61('0x2c')](_0x33c213,_0xcf61('0x29')),[_0xcf61('0x29')]);_0x3b13e3[_0xcf61('0x32')]=_[_0xcf61('0x33')](_0x47b368[_0xcf61('0x32')]);_0x3b13e3[_0xcf61('0x34')]=_[_0xcf61('0x35')](_0x3b13e3[_0xcf61('0x36')],_0x3b13e3[_0xcf61('0x32')]);_0x52064f[_0xcf61('0x37')]=_['intersection'](_0x3b13e3[_0xcf61('0x36')],qs[_0xcf61('0x38')](_0x47b368[_0xcf61('0x32')][_0xcf61('0x38')]));_0x52064f[_0xcf61('0x37')]=_0x52064f[_0xcf61('0x37')][_0xcf61('0x39')]?_0x52064f[_0xcf61('0x37')]:_0x3b13e3[_0xcf61('0x36')];if(!_0x47b368['query'][_0xcf61('0x3a')](_0xcf61('0x3b'))){_0x52064f[_0xcf61('0x20')]=qs[_0xcf61('0x20')](_0x47b368[_0xcf61('0x32')][_0xcf61('0x20')]);_0x52064f[_0xcf61('0x1d')]=qs['offset'](_0x47b368[_0xcf61('0x32')][_0xcf61('0x1d')]);}_0x52064f[_0xcf61('0x3c')]=qs[_0xcf61('0x3d')](_0x47b368['query'][_0xcf61('0x3d')]);_0x52064f[_0xcf61('0x3e')]=qs[_0xcf61('0x34')](_[_0xcf61('0x3f')](_0x47b368[_0xcf61('0x32')],_0x3b13e3[_0xcf61('0x34')]),_0x33c213);if(_0x47b368[_0xcf61('0x32')][_0xcf61('0x40')]){_0x52064f[_0xcf61('0x3e')]=_[_0xcf61('0x41')](_0x52064f[_0xcf61('0x3e')],{'$or':_[_0xcf61('0x2c')](_0x33c213,function(_0x412d88){if(_0x412d88[_0xcf61('0x2f')]!==_0xcf61('0x42')){var _0x3d12a7={};_0x3d12a7[_0x412d88[_0xcf61('0x29')]]={'$like':'%'+_0x47b368[_0xcf61('0x32')][_0xcf61('0x40')]+'%'};return _0x3d12a7;}})});}_0x52064f=_['merge']({},_0x52064f,_0x47b368[_0xcf61('0x43')]);var _0x2598b2={'where':_0x52064f['where']};return db[_0xcf61('0x44')][_0xcf61('0x1f')](_0x2598b2)[_0xcf61('0x25')](function(_0x56d0fb){_0x442690[_0xcf61('0x1f')]=_0x56d0fb;if(_0x47b368['query'][_0xcf61('0x45')]){_0x52064f[_0xcf61('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x52064f);})[_0xcf61('0x25')](function(_0x7e07ea){_0x442690[_0xcf61('0x47')]=_0x7e07ea;return _0x442690;})[_0xcf61('0x25')](respondWithFilteredResult(_0x303638,_0x52064f))[_0xcf61('0x48')](handleError(_0x303638,null));};exports[_0xcf61('0x49')]=function(_0x323ab9,_0x3f0dd7){var _0x5e30ac={'raw':!![],'where':{'id':_0x323ab9[_0xcf61('0x4a')]['id']}},_0x146ea8={};_0x146ea8[_0xcf61('0x36')]=_[_0xcf61('0x33')](db[_0xcf61('0x44')][_0xcf61('0x2d')]);_0x146ea8[_0xcf61('0x32')]=_[_0xcf61('0x33')](_0x323ab9[_0xcf61('0x32')]);_0x146ea8[_0xcf61('0x34')]=_[_0xcf61('0x35')](_0x146ea8[_0xcf61('0x36')],_0x146ea8[_0xcf61('0x32')]);_0x5e30ac[_0xcf61('0x37')]=_['intersection'](_0x146ea8[_0xcf61('0x36')],qs[_0xcf61('0x38')](_0x323ab9['query'][_0xcf61('0x38')]));_0x5e30ac[_0xcf61('0x37')]=_0x5e30ac[_0xcf61('0x37')][_0xcf61('0x39')]?_0x5e30ac[_0xcf61('0x37')]:_0x146ea8['model'];if(_0x323ab9['query'][_0xcf61('0x45')]){_0x5e30ac['include']=[{'all':!![]}];}_0x5e30ac=_[_0xcf61('0x41')]({},_0x5e30ac,_0x323ab9['options']);return db[_0xcf61('0x44')]['find'](_0x5e30ac)[_0xcf61('0x25')](handleEntityNotFound(_0x3f0dd7,null))['then'](respondWithResult(_0x3f0dd7,null))[_0xcf61('0x48')](handleError(_0x3f0dd7,null));};exports[_0xcf61('0x4b')]=function(_0xa7da6,_0x32baec){return db[_0xcf61('0x44')][_0xcf61('0x4b')](_0xa7da6[_0xcf61('0x4c')],{})['then'](respondWithResult(_0x32baec,0xc9))[_0xcf61('0x48')](handleError(_0x32baec,null));};exports[_0xcf61('0x24')]=function(_0x51db1a,_0x53f2db){if(_0x51db1a['body']['id']){delete _0x51db1a[_0xcf61('0x4c')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x51db1a[_0xcf61('0x4a')]['id']}})[_0xcf61('0x25')](handleEntityNotFound(_0x53f2db,null))[_0xcf61('0x25')](saveUpdates(_0x51db1a[_0xcf61('0x4c')],null))[_0xcf61('0x25')](respondWithResult(_0x53f2db,null))['catch'](handleError(_0x53f2db,null));};exports[_0xcf61('0x26')]=function(_0x4c4d26,_0x1b45e7){return db[_0xcf61('0x44')][_0xcf61('0x4d')]({'where':{'id':_0x4c4d26[_0xcf61('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b45e7,null))['then'](removeEntity(_0x1b45e7,null))[_0xcf61('0x48')](handleError(_0x1b45e7,null));};exports[_0xcf61('0x4e')]=function(_0x31d21b,_0xab27c9,_0x1a6902){return db[_0xcf61('0x44')][_0xcf61('0x4d')]({'where':{'id':_0x31d21b[_0xcf61('0x4a')]['id']},'attributes':['id','recording',_0xcf61('0x4f')]})[_0xcf61('0x25')](handleEntityNotFound(_0xab27c9,null))[_0xcf61('0x25')](function(_0x2f6334){if(_0x2f6334){if(!_0x2f6334[_0xcf61('0x50')]){throw new db[(_0xcf61('0x51'))][(_0xcf61('0x52'))]('VoiceMailMessage\x20not\x20found');}var _0x5a427e={'Content-Type':_0xcf61('0x53'),'Content-Disposition':'attachment'};if(_0x2f6334[_0xcf61('0x4f')]){_0x5a427e[_0xcf61('0x54')]=_0xcf61('0x55')+_0x2f6334['msg_id']+_0xcf61('0x56');}_0xab27c9['set'](_0x5a427e);return _0xab27c9[_0xcf61('0x2a')](new Buffer(_0x2f6334[_0xcf61('0x50')]));}})['catch'](handleError(_0xab27c9,null));}; \ No newline at end of file +var _0x2016=['map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send'];(function(_0x377743,_0x584cab){var _0x30ae30=function(_0x5dde9b){while(--_0x5dde9b){_0x377743['push'](_0x377743['shift']());}};_0x30ae30(++_0x584cab);}(_0x2016,0x166));var _0x6201=function(_0x292d5b,_0x2d8819){_0x292d5b=_0x292d5b-0x0;var _0x968786=_0x2016[_0x292d5b];return _0x968786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6201('0x0'));var zipdir=require(_0x6201('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6201('0x2'));var moment=require(_0x6201('0x3'));var BPromise=require(_0x6201('0x4'));var Mustache=require(_0x6201('0x5'));var util=require(_0x6201('0x6'));var path=require('path');var sox=require(_0x6201('0x7'));var csv=require(_0x6201('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6201('0x9'));var crypto=require('crypto');var jsforce=require(_0x6201('0xa'));var deskjs=require(_0x6201('0xb'));var toCsv=require(_0x6201('0x8'));var querystring=require(_0x6201('0xc'));var Papa=require('papaparse');var Redis=require(_0x6201('0xd'));var authService=require(_0x6201('0xe'));var qs=require(_0x6201('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6201('0x10'));var logger=require(_0x6201('0x11'))(_0x6201('0x12'));var utils=require(_0x6201('0x13'));var config=require(_0x6201('0x14'));var licenseUtil=require(_0x6201('0x15'));var db=require(_0x6201('0x16'))['db'];function respondWithStatusCode(_0x5e630e,_0x46afe7){_0x46afe7=_0x46afe7||0xcc;return function(_0x1b5612){if(_0x1b5612){return _0x5e630e[_0x6201('0x17')](_0x46afe7);}return _0x5e630e[_0x6201('0x18')](_0x46afe7)['end']();};}function respondWithResult(_0x19ff61,_0x5e7ad6){_0x5e7ad6=_0x5e7ad6||0xc8;return function(_0x40f79d){if(_0x40f79d){return _0x19ff61[_0x6201('0x18')](_0x5e7ad6)[_0x6201('0x19')](_0x40f79d);}};}function respondWithFilteredResult(_0xa876c7,_0xaa0c97){return function(_0x5a79d2){if(_0x5a79d2){var _0x4e82c3=typeof _0xaa0c97['offset']===_0x6201('0x1a')&&typeof _0xaa0c97[_0x6201('0x1b')]===_0x6201('0x1a');var _0x3a0c5a=_0x5a79d2[_0x6201('0x1c')];var _0x4d8690=_0x4e82c3?0x0:_0xaa0c97[_0x6201('0x1d')];var _0x45c1bd=_0x4e82c3?_0x5a79d2[_0x6201('0x1c')]:_0xaa0c97['offset']+_0xaa0c97[_0x6201('0x1b')];var _0x242583;if(_0x45c1bd>=_0x3a0c5a){_0x45c1bd=_0x3a0c5a;_0x242583=0xc8;}else{_0x242583=0xce;}_0xa876c7[_0x6201('0x18')](_0x242583);return _0xa876c7[_0x6201('0x1e')](_0x6201('0x1f'),_0x4d8690+'-'+_0x45c1bd+'/'+_0x3a0c5a)['json'](_0x5a79d2);}return null;};}function patchUpdates(_0x2575e4){return function(_0x463ff3){try{jsonpatch[_0x6201('0x20')](_0x463ff3,_0x2575e4,!![]);}catch(_0x3cbc02){return BPromise[_0x6201('0x21')](_0x3cbc02);}return _0x463ff3[_0x6201('0x22')]();};}function saveUpdates(_0x514f30,_0x3ba4ce){return function(_0x1aec15){if(_0x1aec15){return _0x1aec15[_0x6201('0x23')](_0x514f30)['then'](function(_0x122222){return _0x122222;});}return null;};}function removeEntity(_0x2c7c27,_0x54448d){return function(_0x4884c4){if(_0x4884c4){return _0x4884c4[_0x6201('0x24')]()[_0x6201('0x25')](function(){_0x2c7c27[_0x6201('0x18')](0xcc)[_0x6201('0x26')]();});}};}function handleEntityNotFound(_0xa59553,_0x5d185f){return function(_0x5537b2){if(!_0x5537b2){_0xa59553['sendStatus'](0x194);}return _0x5537b2;};}function handleError(_0x1e83d1,_0x1d913f){_0x1d913f=_0x1d913f||0x1f4;return function(_0x3497da){logger['error'](_0x3497da[_0x6201('0x27')]);if(_0x3497da[_0x6201('0x28')]){delete _0x3497da[_0x6201('0x28')];}_0x1e83d1['status'](_0x1d913f)[_0x6201('0x29')](_0x3497da);};}exports['index']=function(_0x39dac4,_0x384ab5){var _0x50785e={},_0x480497={},_0x4a71df={'count':0x0,'rows':[]};var _0x31c46d=_[_0x6201('0x2a')](db[_0x6201('0x2b')][_0x6201('0x2c')],function(_0x490c2f){return{'name':_0x490c2f[_0x6201('0x2d')],'type':_0x490c2f[_0x6201('0x2e')]['key']};});_0x480497[_0x6201('0x2f')]=_[_0x6201('0x30')](_[_0x6201('0x2a')](_0x31c46d,'name'),[_0x6201('0x28')]);_0x480497['query']=_[_0x6201('0x31')](_0x39dac4[_0x6201('0x32')]);_0x480497['filters']=_[_0x6201('0x33')](_0x480497[_0x6201('0x2f')],_0x480497[_0x6201('0x32')]);_0x50785e[_0x6201('0x34')]=_['intersection'](_0x480497[_0x6201('0x2f')],qs[_0x6201('0x35')](_0x39dac4[_0x6201('0x32')][_0x6201('0x35')]));_0x50785e[_0x6201('0x34')]=_0x50785e[_0x6201('0x34')]['length']?_0x50785e[_0x6201('0x34')]:_0x480497[_0x6201('0x2f')];if(!_0x39dac4[_0x6201('0x32')][_0x6201('0x36')]('nolimit')){_0x50785e['limit']=qs[_0x6201('0x1b')](_0x39dac4[_0x6201('0x32')][_0x6201('0x1b')]);_0x50785e[_0x6201('0x1d')]=qs[_0x6201('0x1d')](_0x39dac4[_0x6201('0x32')]['offset']);}_0x50785e['order']=qs[_0x6201('0x37')](_0x39dac4[_0x6201('0x32')][_0x6201('0x37')]);_0x50785e[_0x6201('0x38')]=qs[_0x6201('0x39')](_[_0x6201('0x3a')](_0x39dac4['query'],_0x480497['filters']),_0x31c46d);if(_0x39dac4['query']['filter']){_0x50785e[_0x6201('0x38')]=_[_0x6201('0x3b')](_0x50785e[_0x6201('0x38')],{'$or':_[_0x6201('0x2a')](_0x31c46d,function(_0x1f6037){if(_0x1f6037[_0x6201('0x2e')]!=='VIRTUAL'){var _0x2bdb64={};_0x2bdb64[_0x1f6037['name']]={'$like':'%'+_0x39dac4[_0x6201('0x32')][_0x6201('0x3c')]+'%'};return _0x2bdb64;}})});}_0x50785e=_[_0x6201('0x3b')]({},_0x50785e,_0x39dac4[_0x6201('0x3d')]);var _0x341501={'where':_0x50785e[_0x6201('0x38')]};return db[_0x6201('0x2b')][_0x6201('0x1c')](_0x341501)['then'](function(_0x23fa75){_0x4a71df['count']=_0x23fa75;if(_0x39dac4['query'][_0x6201('0x3e')]){_0x50785e[_0x6201('0x3f')]=[{'all':!![]}];}return db[_0x6201('0x2b')][_0x6201('0x40')](_0x50785e);})[_0x6201('0x25')](function(_0x33d8b6){_0x4a71df[_0x6201('0x41')]=_0x33d8b6;return _0x4a71df;})[_0x6201('0x25')](respondWithFilteredResult(_0x384ab5,_0x50785e))['catch'](handleError(_0x384ab5,null));};exports[_0x6201('0x42')]=function(_0x4a9a15,_0x20c5a4){var _0x40c76e={'raw':!![],'where':{'id':_0x4a9a15[_0x6201('0x43')]['id']}},_0x4ca46d={};_0x4ca46d[_0x6201('0x2f')]=_[_0x6201('0x31')](db[_0x6201('0x2b')][_0x6201('0x2c')]);_0x4ca46d[_0x6201('0x32')]=_['keys'](_0x4a9a15[_0x6201('0x32')]);_0x4ca46d['filters']=_['intersection'](_0x4ca46d[_0x6201('0x2f')],_0x4ca46d['query']);_0x40c76e[_0x6201('0x34')]=_[_0x6201('0x33')](_0x4ca46d[_0x6201('0x2f')],qs[_0x6201('0x35')](_0x4a9a15[_0x6201('0x32')][_0x6201('0x35')]));_0x40c76e['attributes']=_0x40c76e[_0x6201('0x34')]['length']?_0x40c76e[_0x6201('0x34')]:_0x4ca46d['model'];if(_0x4a9a15['query'][_0x6201('0x3e')]){_0x40c76e[_0x6201('0x3f')]=[{'all':!![]}];}_0x40c76e=_[_0x6201('0x3b')]({},_0x40c76e,_0x4a9a15[_0x6201('0x3d')]);return db[_0x6201('0x2b')][_0x6201('0x44')](_0x40c76e)[_0x6201('0x25')](handleEntityNotFound(_0x20c5a4,null))[_0x6201('0x25')](respondWithResult(_0x20c5a4,null))[_0x6201('0x45')](handleError(_0x20c5a4,null));};exports[_0x6201('0x46')]=function(_0x34f928,_0x597bbe){return db[_0x6201('0x2b')][_0x6201('0x46')](_0x34f928['body'],{})['then'](respondWithResult(_0x597bbe,0xc9))[_0x6201('0x45')](handleError(_0x597bbe,null));};exports['update']=function(_0x4ecc90,_0x5165ce){if(_0x4ecc90[_0x6201('0x47')]['id']){delete _0x4ecc90['body']['id'];}return db[_0x6201('0x2b')]['find']({'where':{'id':_0x4ecc90[_0x6201('0x43')]['id']}})['then'](handleEntityNotFound(_0x5165ce,null))['then'](saveUpdates(_0x4ecc90[_0x6201('0x47')],null))[_0x6201('0x25')](respondWithResult(_0x5165ce,null))[_0x6201('0x45')](handleError(_0x5165ce,null));};exports['destroy']=function(_0x32b15d,_0x234090){return db[_0x6201('0x2b')][_0x6201('0x44')]({'where':{'id':_0x32b15d[_0x6201('0x43')]['id']}})['then'](handleEntityNotFound(_0x234090,null))[_0x6201('0x25')](removeEntity(_0x234090,null))[_0x6201('0x45')](handleError(_0x234090,null));};exports[_0x6201('0x48')]=function(_0x14110a,_0x3ee1ba,_0x2acec7){return db[_0x6201('0x2b')]['find']({'where':{'id':_0x14110a[_0x6201('0x43')]['id']},'attributes':['id','recording',_0x6201('0x49')]})[_0x6201('0x25')](handleEntityNotFound(_0x3ee1ba,null))[_0x6201('0x25')](function(_0x34844a){if(_0x34844a){if(!_0x34844a['recording']){throw new db[(_0x6201('0x4a'))][(_0x6201('0x4b'))](_0x6201('0x4c'));}var _0x3e80f3={'Content-Type':_0x6201('0x4d'),'Content-Disposition':'attachment'};if(_0x34844a[_0x6201('0x49')]){_0x3e80f3['Content-Disposition']=_0x6201('0x4e')+_0x34844a[_0x6201('0x49')]+_0x6201('0x4f');}_0x3ee1ba['set'](_0x3e80f3);return _0x3ee1ba[_0x6201('0x29')](new Buffer(_0x34844a['recording']));}})[_0x6201('0x45')](handleError(_0x3ee1ba,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2185f3e..a065681 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 _0x00f9=['api','moment','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00f9,0xe8));var _0x900f=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x00f9[_0x17406e];return _0x2bfc5a;};'use strict';var _=require('lodash');var util=require(_0x900f('0x0'));var logger=require(_0x900f('0x1'))(_0x900f('0x2'));var moment=require(_0x900f('0x3'));var BPromise=require(_0x900f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x900f('0x5'));var config=require(_0x900f('0x6'));var attributes=require(_0x900f('0x7'));module[_0x900f('0x8')]=function(_0x2e7b2c,_0x3ff6cb){return _0x2e7b2c[_0x900f('0x9')](_0x900f('0xa'),attributes,{'tableName':_0x900f('0xb'),'paranoid':![],'indexes':[{'name':_0x900f('0xc'),'fields':[_0x900f('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x97a6=['exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x590ef7,_0x175f08){var _0x4c2634=function(_0xf94570){while(--_0xf94570){_0x590ef7['push'](_0x590ef7['shift']());}};_0x4c2634(++_0x175f08);}(_0x97a6,0x11c));var _0x697a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x697a('0x0'));var logger=require(_0x697a('0x1'))(_0x697a('0x2'));var moment=require(_0x697a('0x3'));var BPromise=require(_0x697a('0x4'));var rp=require(_0x697a('0x5'));var fs=require('fs');var path=require(_0x697a('0x6'));var rimraf=require(_0x697a('0x7'));var config=require(_0x697a('0x8'));var attributes=require(_0x697a('0x9'));module[_0x697a('0xa')]=function(_0x13882e,_0xa2000c){return _0x13882e['define'](_0x697a('0xb'),attributes,{'tableName':_0x697a('0xc'),'paranoid':![],'indexes':[{'name':_0x697a('0xd'),'fields':[_0x697a('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index b9bdcf1..b6a593e 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 _0xa1b0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x833f32,_0x96443f){var _0x25879d=function(_0x7fb4d4){while(--_0x7fb4d4){_0x833f32['push'](_0x833f32['shift']());}};_0x25879d(++_0x96443f);}(_0xa1b0,0x81));var _0x0a1b=function(_0x422953,_0x5f404a){_0x422953=_0x422953-0x0;var _0x1c8903=_0xa1b0[_0x422953];return _0x1c8903;};'use strict';var _=require(_0x0a1b('0x0'));var util=require(_0x0a1b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a1b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a1b('0x3'));var logger=require('../../config/logger')(_0x0a1b('0x4'));var config=require(_0x0a1b('0x5'));var jayson=require(_0x0a1b('0x6'));var client=jayson[_0x0a1b('0x7')][_0x0a1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f1c64,_0x37316c,_0x430fe4){return new BPromise(function(_0x17266d,_0x5dbdc4){return client[_0x0a1b('0x9')](_0x3f1c64,_0x430fe4)[_0x0a1b('0xa')](function(_0x17352a){logger[_0x0a1b('0xb')](_0x0a1b('0xc'),_0x37316c,_0x0a1b('0xd'));logger[_0x0a1b('0xe')](_0x0a1b('0xf'),_0x37316c,_0x0a1b('0xd'),JSON[_0x0a1b('0x10')](_0x17352a));if(_0x17352a[_0x0a1b('0x11')]){if(_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x12')]===0x1f4){logger['error'](_0x0a1b('0xc'),_0x37316c,_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x13')]);return _0x5dbdc4(_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x13')]);}logger[_0x0a1b('0x11')](_0x0a1b('0xc'),_0x37316c,_0x17352a[_0x0a1b('0x11')]['message']);return _0x17266d(_0x17352a[_0x0a1b('0x11')][_0x0a1b('0x13')]);}else{logger[_0x0a1b('0xb')](_0x0a1b('0xc'),_0x37316c,_0x0a1b('0xd'));_0x17266d(_0x17352a[_0x0a1b('0x14')][_0x0a1b('0x13')]);}})[_0x0a1b('0x15')](function(_0x1bbd1b){logger['error'](_0x0a1b('0xc'),_0x37316c,_0x1bbd1b);_0x5dbdc4(_0x1bbd1b);});});} \ No newline at end of file +var _0xcf16=['code','message','info','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x6a202,_0x5f292f){var _0x22839f=function(_0x267710){while(--_0x267710){_0x6a202['push'](_0x6a202['shift']());}};_0x22839f(++_0x5f292f);}(_0xcf16,0x1e4));var _0x6cf1=function(_0x33b045,_0x4d8ec8){_0x33b045=_0x33b045-0x0;var _0x216414=_0xcf16[_0x33b045];return _0x216414;};'use strict';var _=require(_0x6cf1('0x0'));var util=require(_0x6cf1('0x1'));var moment=require('moment');var BPromise=require(_0x6cf1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cf1('0x3'))['db'];var utils=require(_0x6cf1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6cf1('0x5'));var jayson=require(_0x6cf1('0x6'));var client=jayson[_0x6cf1('0x7')][_0x6cf1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdd00d2,_0x23e148,_0x4444bb){return new BPromise(function(_0x254dd7,_0x4e4082){return client['request'](_0xdd00d2,_0x4444bb)[_0x6cf1('0x9')](function(_0x3ef964){logger['info'](_0x6cf1('0xa'),_0x23e148,_0x6cf1('0xb'));logger[_0x6cf1('0xc')](_0x6cf1('0xd'),_0x23e148,'request\x20sent',JSON[_0x6cf1('0xe')](_0x3ef964));if(_0x3ef964['error']){if(_0x3ef964[_0x6cf1('0xf')][_0x6cf1('0x10')]===0x1f4){logger[_0x6cf1('0xf')](_0x6cf1('0xa'),_0x23e148,_0x3ef964[_0x6cf1('0xf')][_0x6cf1('0x11')]);return _0x4e4082(_0x3ef964[_0x6cf1('0xf')][_0x6cf1('0x11')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x23e148,_0x3ef964['error'][_0x6cf1('0x11')]);return _0x254dd7(_0x3ef964[_0x6cf1('0xf')][_0x6cf1('0x11')]);}else{logger[_0x6cf1('0x12')](_0x6cf1('0xa'),_0x23e148,_0x6cf1('0xb'));_0x254dd7(_0x3ef964['result']['message']);}})[_0x6cf1('0x13')](function(_0x13ce48){logger[_0x6cf1('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x23e148,_0x13ce48);_0x4e4082(_0x13ce48);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b662bed..110f591 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 _0x0796=['post','create','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x254dcc,_0x4d5a5f){var _0x5bc8fd=function(_0x9949dc){while(--_0x9949dc){_0x254dcc['push'](_0x254dcc['shift']());}};_0x5bc8fd(++_0x4d5a5f);}(_0x0796,0x129));var _0x6079=function(_0x92b3ae,_0x201d08){_0x92b3ae=_0x92b3ae-0x0;var _0x4da89c=_0x0796[_0x92b3ae];return _0x4da89c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6079('0x0'));var timeout=require(_0x6079('0x1'));var express=require(_0x6079('0x2'));var router=express['Router']();var fs_extra=require(_0x6079('0x3'));var auth=require(_0x6079('0x4'));var interaction=require(_0x6079('0x5'));var config=require(_0x6079('0x6'));var controller=require(_0x6079('0x7'));router[_0x6079('0x8')]('/',auth[_0x6079('0x9')](),controller[_0x6079('0xa')]);router['get'](_0x6079('0xb'),auth[_0x6079('0x9')](),controller[_0x6079('0xc')]);router['get'](_0x6079('0xd'),auth[_0x6079('0x9')](),controller[_0x6079('0xe')]);router[_0x6079('0xf')]('/',auth[_0x6079('0x9')](),controller[_0x6079('0x10')]);router[_0x6079('0xf')](_0x6079('0xd'),auth[_0x6079('0x9')](),controller[_0x6079('0x11')]);router[_0x6079('0x12')](_0x6079('0xb'),auth[_0x6079('0x9')](),controller[_0x6079('0x13')]);router[_0x6079('0x14')]('/:id',auth[_0x6079('0x9')](),controller['destroy']);router[_0x6079('0x14')](_0x6079('0x15'),auth['isAuthenticated'](),controller[_0x6079('0x16')]);module[_0x6079('0x17')]=router; \ No newline at end of file +var _0x2a72=['/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','index'];(function(_0x5ef17b,_0x107cc9){var _0x472064=function(_0xd82362){while(--_0xd82362){_0x5ef17b['push'](_0x5ef17b['shift']());}};_0x472064(++_0x107cc9);}(_0x2a72,0x1f1));var _0x22a7=function(_0x3de8a2,_0x1c8615){_0x3de8a2=_0x3de8a2-0x0;var _0x267573=_0x2a72[_0x3de8a2];return _0x267573;};'use strict';var multer=require(_0x22a7('0x0'));var util=require(_0x22a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x22a7('0x2')]();var fs_extra=require(_0x22a7('0x3'));var auth=require(_0x22a7('0x4'));var interaction=require(_0x22a7('0x5'));var config=require('../../config/environment');var controller=require(_0x22a7('0x6'));router[_0x22a7('0x7')]('/',auth['isAuthenticated'](),controller[_0x22a7('0x8')]);router[_0x22a7('0x7')](_0x22a7('0x9'),auth[_0x22a7('0xa')](),controller[_0x22a7('0xb')]);router[_0x22a7('0x7')](_0x22a7('0xc'),auth['isAuthenticated'](),controller[_0x22a7('0xd')]);router[_0x22a7('0xe')]('/',auth[_0x22a7('0xa')](),controller[_0x22a7('0xf')]);router[_0x22a7('0xe')](_0x22a7('0xc'),auth[_0x22a7('0xa')](),controller[_0x22a7('0x10')]);router[_0x22a7('0x11')](_0x22a7('0x9'),auth[_0x22a7('0xa')](),controller[_0x22a7('0x12')]);router[_0x22a7('0x13')](_0x22a7('0x9'),auth[_0x22a7('0xa')](),controller[_0x22a7('0x14')]);router[_0x22a7('0x13')](_0x22a7('0x15'),auth[_0x22a7('0xa')](),controller[_0x22a7('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 33d9c80..8682abf 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 _0xb1ea=['quietmp3nb','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb'];(function(_0x3aac69,_0x81d09f){var _0x38d35b=function(_0x58ef90){while(--_0x58ef90){_0x3aac69['push'](_0x3aac69['shift']());}};_0x38d35b(++_0x81d09f);}(_0xb1ea,0x9e));var _0xab1e=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xb1ea[_0xb833b1];return _0x1ab87a;};'use strict';var Sequelize=require(_0xab1e('0x0'));module[_0xab1e('0x1')]={'name':{'type':Sequelize[_0xab1e('0x2')],'allowNull':![],'unique':_0xab1e('0x3')},'mode':{'type':Sequelize['ENUM'](_0xab1e('0x4'),_0xab1e('0x5'),_0xab1e('0x6'),_0xab1e('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xab1e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xab1e('0x2')],'allowNull':!![],'defaultValue':_0xab1e('0x8')},'format':{'type':Sequelize[_0xab1e('0x2')],'allowNull':!![]},'stamp':{'type':_0xab1e('0x9')},'defaultEntry':{'type':Sequelize[_0xab1e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x190e=['exports','name','custom','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN'];(function(_0x44a4a8,_0x26633e){var _0x74206=function(_0x42afe3){while(--_0x42afe3){_0x44a4a8['push'](_0x44a4a8['shift']());}};_0x74206(++_0x26633e);}(_0x190e,0x129));var _0xe190=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x190e[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module[_0xe190('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe190('0x1')},'mode':{'type':Sequelize['ENUM'](_0xe190('0x2'),_0xe190('0x3'),_0xe190('0x4'),'quietmp3nb',_0xe190('0x5'),_0xe190('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe190('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xe190('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe190('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe190('0x7')],'allowNull':!![],'defaultValue':_0xe190('0x8')},'format':{'type':Sequelize[_0xe190('0x7')],'allowNull':!![]},'stamp':{'type':_0xe190('0x9')},'defaultEntry':{'type':Sequelize[_0xe190('0xa')],'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 26d4b3f..cd03c85 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 _0xd050=['Content-Range','json','apply','reject','save','update','destroy','get','MusicOnHolds','then','error','stack','name','send','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','length','options','body','find','params','catch','create','sequelize','transaction','files','directory','join','root','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','extname','converted_format','format','symlinkSync','Sequelize','message','removeSound','id2','Sound','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd050,0x13d));var _0x0d05=function(_0x25382a,_0x28c993){_0x25382a=_0x25382a-0x0;var _0x305590=_0xd050[_0x25382a];return _0x305590;};'use strict';var emlformat=require(_0x0d05('0x0'));var rimraf=require(_0x0d05('0x1'));var zipdir=require(_0x0d05('0x2'));var jsonpatch=require(_0x0d05('0x3'));var rp=require(_0x0d05('0x4'));var moment=require(_0x0d05('0x5'));var BPromise=require(_0x0d05('0x6'));var Mustache=require('mustache');var util=require(_0x0d05('0x7'));var path=require(_0x0d05('0x8'));var sox=require(_0x0d05('0x9'));var csv=require('to-csv');var ejs=require(_0x0d05('0xa'));var fs=require('fs');var fs_extra=require(_0x0d05('0xb'));var _=require(_0x0d05('0xc'));var squel=require(_0x0d05('0xd'));var crypto=require(_0x0d05('0xe'));var jsforce=require(_0x0d05('0xf'));var deskjs=require(_0x0d05('0x10'));var toCsv=require(_0x0d05('0x11'));var querystring=require(_0x0d05('0x12'));var Papa=require(_0x0d05('0x13'));var Redis=require(_0x0d05('0x14'));var authService=require(_0x0d05('0x15'));var qs=require(_0x0d05('0x16'));var as=require(_0x0d05('0x17'));var hardwareService=require(_0x0d05('0x18'));var logger=require(_0x0d05('0x19'))(_0x0d05('0x1a'));var utils=require(_0x0d05('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x0d05('0x1c'));var db=require(_0x0d05('0x1d'))['db'];function respondWithStatusCode(_0x549aa8,_0x1bda31){_0x1bda31=_0x1bda31||0xcc;return function(_0x8a5f03){if(_0x8a5f03){return _0x549aa8[_0x0d05('0x1e')](_0x1bda31);}return _0x549aa8['status'](_0x1bda31)[_0x0d05('0x1f')]();};}function respondWithResult(_0x4e871d,_0x466cee){_0x466cee=_0x466cee||0xc8;return function(_0x1e96fe){if(_0x1e96fe){return _0x4e871d['status'](_0x466cee)['json'](_0x1e96fe);}};}function respondWithFilteredResult(_0x5da97e,_0xfea59e){return function(_0x1deff4){if(_0x1deff4){var _0x2c328e=typeof _0xfea59e['offset']===_0x0d05('0x20')&&typeof _0xfea59e[_0x0d05('0x21')]==='undefined';var _0x2b6b45=_0x1deff4[_0x0d05('0x22')];var _0x391754=_0x2c328e?0x0:_0xfea59e[_0x0d05('0x23')];var _0x30a1c2=_0x2c328e?_0x1deff4['count']:_0xfea59e[_0x0d05('0x23')]+_0xfea59e[_0x0d05('0x21')];var _0x720730;if(_0x30a1c2>=_0x2b6b45){_0x30a1c2=_0x2b6b45;_0x720730=0xc8;}else{_0x720730=0xce;}_0x5da97e[_0x0d05('0x24')](_0x720730);return _0x5da97e['set'](_0x0d05('0x25'),_0x391754+'-'+_0x30a1c2+'/'+_0x2b6b45)[_0x0d05('0x26')](_0x1deff4);}return null;};}function patchUpdates(_0x6fb66){return function(_0x4be0d4){try{jsonpatch[_0x0d05('0x27')](_0x4be0d4,_0x6fb66,!![]);}catch(_0x45c4af){return BPromise[_0x0d05('0x28')](_0x45c4af);}return _0x4be0d4[_0x0d05('0x29')]();};}function saveUpdates(_0x57322c,_0x68e210){return function(_0x40ab66){if(_0x40ab66){return _0x40ab66[_0x0d05('0x2a')](_0x57322c)['then'](function(_0x1b6c74){return _0x1b6c74;});}return null;};}function removeEntity(_0x500aff,_0x245cda){return function(_0x5a05c8){if(_0x5a05c8){return _0x5a05c8[_0x0d05('0x2b')]()['then'](function(){var _0x4cd7fa=_0x5a05c8[_0x0d05('0x2c')]({'plain':!![]});var _0x460977=_0x0d05('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x460977,'resourceId':_0x4cd7fa['id']}})[_0x0d05('0x2e')](function(){return _0x5a05c8;});})[_0x0d05('0x2e')](function(){_0x500aff[_0x0d05('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22b899,_0x3fc79a){return function(_0x10c682){if(!_0x10c682){_0x22b899[_0x0d05('0x1e')](0x194);}return _0x10c682;};}function handleError(_0x3cc80a,_0x2a023c){_0x2a023c=_0x2a023c||0x1f4;return function(_0x1489d1){logger[_0x0d05('0x2f')](_0x1489d1[_0x0d05('0x30')]);if(_0x1489d1[_0x0d05('0x31')]){delete _0x1489d1[_0x0d05('0x31')];}_0x3cc80a[_0x0d05('0x24')](_0x2a023c)[_0x0d05('0x32')](_0x1489d1);};}exports['index']=function(_0x48bf9e,_0x4db6ad){var _0x4b3576={},_0x4807c2={},_0x16a8b8={'count':0x0,'rows':[]};var _0x3e938e=_['map'](db[_0x0d05('0x33')][_0x0d05('0x34')],function(_0x204523){return{'name':_0x204523[_0x0d05('0x35')],'type':_0x204523['type'][_0x0d05('0x36')]};});_0x4807c2[_0x0d05('0x37')]=_[_0x0d05('0x38')](_0x3e938e,_0x0d05('0x31'));_0x4807c2[_0x0d05('0x39')]=_[_0x0d05('0x3a')](_0x48bf9e[_0x0d05('0x39')]);_0x4807c2[_0x0d05('0x3b')]=_[_0x0d05('0x3c')](_0x4807c2['model'],_0x4807c2[_0x0d05('0x39')]);_0x4b3576[_0x0d05('0x3d')]=_[_0x0d05('0x3c')](_0x4807c2[_0x0d05('0x37')],qs[_0x0d05('0x3e')](_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x3e')]));_0x4b3576['attributes']=_0x4b3576['attributes']['length']?_0x4b3576[_0x0d05('0x3d')]:_0x4807c2['model'];if(!_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x3f')]('nolimit')){_0x4b3576[_0x0d05('0x21')]=qs[_0x0d05('0x21')](_0x48bf9e[_0x0d05('0x39')]['limit']);_0x4b3576[_0x0d05('0x23')]=qs[_0x0d05('0x23')](_0x48bf9e[_0x0d05('0x39')]['offset']);}_0x4b3576[_0x0d05('0x40')]=qs[_0x0d05('0x41')](_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x41')]);delete _0x48bf9e['query'][_0x0d05('0x41')];_0x4b3576[_0x0d05('0x42')]=qs[_0x0d05('0x3b')](_['pick'](_0x48bf9e[_0x0d05('0x39')],_0x4807c2['filters']),_0x3e938e);if(_0x48bf9e['query'][_0x0d05('0x43')]){_0x4b3576[_0x0d05('0x42')]=_[_0x0d05('0x44')](_0x4b3576[_0x0d05('0x42')],{'$or':_[_0x0d05('0x38')](_0x3e938e,function(_0x39dd22){if(_0x39dd22['type']!=='VIRTUAL'){var _0x5415e3={};_0x5415e3[_0x39dd22['name']]={'$like':'%'+_0x48bf9e[_0x0d05('0x39')][_0x0d05('0x43')]+'%'};return _0x5415e3;}})});}_0x4b3576=_[_0x0d05('0x44')]({},_0x4b3576,_0x48bf9e['options']);var _0x3e0468={'where':_0x4b3576[_0x0d05('0x42')]};return db[_0x0d05('0x33')][_0x0d05('0x22')](_0x3e0468)[_0x0d05('0x2e')](function(_0x2368e6){_0x16a8b8[_0x0d05('0x22')]=_0x2368e6;if(_0x48bf9e['query'][_0x0d05('0x45')]){_0x4b3576[_0x0d05('0x46')]=[{'all':!![]}];}return db[_0x0d05('0x33')][_0x0d05('0x47')](_0x4b3576);})[_0x0d05('0x2e')](function(_0x258098){_0x16a8b8[_0x0d05('0x48')]=_0x258098;return _0x16a8b8;})[_0x0d05('0x2e')](respondWithFilteredResult(_0x4db6ad,_0x4b3576))['catch'](handleError(_0x4db6ad,null));};exports['show']=function(_0x441bff,_0x428fd1){var _0xbced34={'raw':![],'where':{'id':_0x441bff['params']['id']}},_0x38c60d={};_0x38c60d[_0x0d05('0x37')]=_[_0x0d05('0x3a')](db[_0x0d05('0x33')]['rawAttributes']);_0x38c60d['query']=_['keys'](_0x441bff[_0x0d05('0x39')]);_0x38c60d[_0x0d05('0x3b')]=_[_0x0d05('0x3c')](_0x38c60d[_0x0d05('0x37')],_0x38c60d[_0x0d05('0x39')]);_0xbced34[_0x0d05('0x3d')]=_[_0x0d05('0x3c')](_0x38c60d[_0x0d05('0x37')],qs[_0x0d05('0x3e')](_0x441bff['query'][_0x0d05('0x3e')]));_0xbced34[_0x0d05('0x3d')]=_0xbced34[_0x0d05('0x3d')][_0x0d05('0x49')]?_0xbced34[_0x0d05('0x3d')]:_0x38c60d[_0x0d05('0x37')];if(_0x441bff[_0x0d05('0x39')][_0x0d05('0x45')]){_0xbced34[_0x0d05('0x46')]=[{'all':!![]}];}_0xbced34=_[_0x0d05('0x44')]({},_0xbced34,_0x441bff[_0x0d05('0x4a')]);return db['VoiceMusicOnHold']['find'](_0xbced34)[_0x0d05('0x2e')](handleEntityNotFound(_0x428fd1,null))[_0x0d05('0x2e')](respondWithResult(_0x428fd1,null))['catch'](handleError(_0x428fd1,null));};exports[_0x0d05('0x2a')]=function(_0xea67f1,_0x2fad4e){if(_0xea67f1[_0x0d05('0x4b')]['id']){delete _0xea67f1['body']['id'];}return db[_0x0d05('0x33')][_0x0d05('0x4c')]({'where':{'id':_0xea67f1[_0x0d05('0x4d')]['id']}})[_0x0d05('0x2e')](handleEntityNotFound(_0x2fad4e,null))[_0x0d05('0x2e')](saveUpdates(_0xea67f1[_0x0d05('0x4b')],null))[_0x0d05('0x2e')](respondWithResult(_0x2fad4e,null))[_0x0d05('0x4e')](handleError(_0x2fad4e,null));};exports[_0x0d05('0x4f')]=function(_0x26a2d0,_0x16bb1c,_0x2bf5e2){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x3e5a30){if(_0x26a2d0['body']['mode']===_0x0d05('0x52')){_0x26a2d0[_0x0d05('0x4b')][_0x0d05('0x53')]=path[_0x0d05('0x54')](config[_0x0d05('0x55')],'server/files/moh',_0x26a2d0['body'][_0x0d05('0x31')]);}return db[_0x0d05('0x33')][_0x0d05('0x4f')](_0x26a2d0[_0x0d05('0x4b')],{'transaction':_0x3e5a30})[_0x0d05('0x2e')](function(_0x527cf6){if(_0x26a2d0[_0x0d05('0x4b')][_0x0d05('0x56')]===_0x0d05('0x52')){fs[_0x0d05('0x57')](_0x527cf6[_0x0d05('0x53')],parseInt(_0x0d05('0x58'),0x8));}var _0x394cd1=_0x26a2d0[_0x0d05('0x59')]['get']({'plain':!![]});if(!_0x394cd1)throw new Error(_0x0d05('0x5a'));if(_0x394cd1[_0x0d05('0x5b')]===_0x0d05('0x59')){var _0xd88eff=_0x527cf6[_0x0d05('0x2c')]({'plain':!![]});return db[_0x0d05('0x5c')][_0x0d05('0x4c')]({'where':{'name':_0x0d05('0x2d'),'userProfileId':_0x394cd1[_0x0d05('0x5d')]},'raw':!![]})[_0x0d05('0x2e')](function(_0x3b6f82){if(_0x3b6f82&&_0x3b6f82[_0x0d05('0x5e')]===0x0){return db[_0x0d05('0x5f')]['create']({'name':_0xd88eff[_0x0d05('0x31')],'resourceId':_0xd88eff['id'],'type':_0x3b6f82[_0x0d05('0x31')],'sectionId':_0x3b6f82['id']},{})[_0x0d05('0x2e')](function(){return _0x527cf6;});}else{return _0x527cf6;}})['catch'](function(_0x2351bd){logger[_0x0d05('0x2f')](_0x0d05('0x60'),_0x2351bd);});}return _0x527cf6;});})[_0x0d05('0x2e')](respondWithResult(_0x16bb1c,0xc9))[_0x0d05('0x4e')](handleError(_0x16bb1c,null));};exports['destroy']=function(_0x14c652,_0x263fb0,_0x4f4a6d){var _0x299e5e;return db[_0x0d05('0x33')][_0x0d05('0x4c')]({'where':{'id':_0x14c652['params']['id']}})[_0x0d05('0x2e')](function(_0x3f1210){if(_0x3f1210){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x4c02f6){return _0x3f1210[_0x0d05('0x2b')]({'transaction':_0x4c02f6,'raw':!![]})[_0x0d05('0x2e')](function(_0x5780ba){if(_0x5780ba[_0x0d05('0x53')]){fs[_0x0d05('0x61')](_0x5780ba['directory'])[_0x0d05('0x62')](function(_0x5cdbd0){fs[_0x0d05('0x63')](path[_0x0d05('0x54')](_0x5780ba[_0x0d05('0x53')],_0x5cdbd0));});fs[_0x0d05('0x64')](_0x5780ba[_0x0d05('0x53')]);}return _0x5780ba;});})[_0x0d05('0x4e')](function(_0x46cbc9){throw new db['Sequelize'][(_0x0d05('0x65'))](_0x46cbc9['message']);});}})['then'](handleEntityNotFound(_0x263fb0,null))[_0x0d05('0x2e')](removeEntity(_0x263fb0,null))[_0x0d05('0x4e')](handleError(_0x263fb0,null));};exports[_0x0d05('0x66')]=function(_0x565116,_0x54bc34,_0x501f87){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x36186f){var _0x2bf020;return db[_0x0d05('0x33')][_0x0d05('0x4c')]({'where':{'id':_0x565116[_0x0d05('0x4d')]['id']}})[_0x0d05('0x2e')](function(_0x18c69d){if(_0x18c69d){_0x2bf020=_0x18c69d;return _0x18c69d[_0x0d05('0x66')](_0x565116[_0x0d05('0x4b')]['id'],{'transaction':_0x36186f});}})[_0x0d05('0x2e')](function(_0x2929a1){if(_0x2929a1){return db['Sound'][_0x0d05('0x67')]({'where':{'id':_0x565116[_0x0d05('0x4b')]['id']},'attributes':['id','name',_0x0d05('0x68'),'converted_format',_0x0d05('0x69')],'raw':!![]});}})[_0x0d05('0x2e')](function(_0x3b0704){if(_0x3b0704){var _0x1aa515=path[_0x0d05('0x54')](config[_0x0d05('0x55')],_0x0d05('0x6a'),util['format'](_0x0d05('0x6b'),path['basename'](_0x3b0704[_0x0d05('0x68')],path[_0x0d05('0x6c')](_0x3b0704[_0x0d05('0x68')])),_0x3b0704[_0x0d05('0x6d')]));var _0x5d7253=path[_0x0d05('0x54')](config['root'],'server/files/moh',_0x2bf020[_0x0d05('0x31')],util[_0x0d05('0x6e')](_0x0d05('0x6b'),_0x3b0704[_0x0d05('0x31')],_0x3b0704[_0x0d05('0x6d')]));fs[_0x0d05('0x6f')](_0x1aa515,_0x5d7253);return _0x3b0704;}})[_0x0d05('0x4e')](function(_0x4cb441){throw new db[(_0x0d05('0x70'))][(_0x0d05('0x65'))](_0x4cb441[_0x0d05('0x71')]);});})[_0x0d05('0x2e')](handleEntityNotFound(_0x54bc34,null))[_0x0d05('0x2e')](respondWithResult(_0x54bc34,0xc9))[_0x0d05('0x4e')](handleError(_0x54bc34,null));};exports[_0x0d05('0x72')]=function(_0x3d3860,_0x18ef03,_0x594fda){return db[_0x0d05('0x50')][_0x0d05('0x51')](function(_0x35a244){var _0x42fe4f;return db[_0x0d05('0x33')][_0x0d05('0x67')]({'where':{'id':_0x3d3860[_0x0d05('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18ef03,null))[_0x0d05('0x2e')](function(_0x44bb56){if(_0x44bb56){_0x42fe4f=_0x44bb56;return _0x44bb56['removeSound'](_0x3d3860[_0x0d05('0x4d')][_0x0d05('0x73')]);}})[_0x0d05('0x2e')](function(_0x14bceb){if(_0x14bceb){return db[_0x0d05('0x74')][_0x0d05('0x67')]({'where':{'id':_0x3d3860[_0x0d05('0x4d')][_0x0d05('0x73')]},'attributes':['id',_0x0d05('0x31'),_0x0d05('0x68'),'converted_format',_0x0d05('0x69')],'raw':!![]});}})[_0x0d05('0x2e')](function(_0x434a10){if(_0x434a10){fs[_0x0d05('0x63')](path[_0x0d05('0x54')](_0x42fe4f[_0x0d05('0x53')],util[_0x0d05('0x6e')](_0x0d05('0x6b'),_0x434a10['name'],_0x434a10[_0x0d05('0x6d')])));return _0x434a10;}})['catch'](function(_0x430929){throw new db[(_0x0d05('0x70'))][(_0x0d05('0x65'))](_0x430929[_0x0d05('0x71')]);});})[_0x0d05('0x2e')](handleEntityNotFound(_0x18ef03,null))['then'](respondWithStatusCode(_0x18ef03,0xcc))[_0x0d05('0x4e')](handleError(_0x18ef03,null));};exports[_0x0d05('0x75')]=function(_0x1270f6,_0x9a002b,_0x1ea600){var _0x56e3b4={};var _0x120c95={};var _0x3e5ad8;var _0x1aa692;return db[_0x0d05('0x33')]['findOne']({'where':{'id':_0x1270f6[_0x0d05('0x4d')]['id']}})[_0x0d05('0x2e')](handleEntityNotFound(_0x9a002b,null))['then'](function(_0x446068){if(_0x446068){_0x3e5ad8=_0x446068;_0x120c95[_0x0d05('0x37')]=_[_0x0d05('0x3a')](db['Sound'][_0x0d05('0x34')]);_0x120c95[_0x0d05('0x39')]=_[_0x0d05('0x3a')](_0x1270f6[_0x0d05('0x39')]);_0x120c95['filters']=_['intersection'](_0x120c95['model'],_0x120c95[_0x0d05('0x39')]);_0x56e3b4[_0x0d05('0x3d')]=_[_0x0d05('0x3c')](_0x120c95[_0x0d05('0x37')],qs[_0x0d05('0x3e')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x3e')]));_0x56e3b4[_0x0d05('0x3d')]=_0x56e3b4[_0x0d05('0x3d')][_0x0d05('0x49')]?_0x56e3b4[_0x0d05('0x3d')]:_0x120c95[_0x0d05('0x37')];_0x56e3b4['order']=qs[_0x0d05('0x41')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x41')]);_0x56e3b4[_0x0d05('0x42')]=qs[_0x0d05('0x3b')](_['pick'](_0x1270f6[_0x0d05('0x39')],_0x120c95[_0x0d05('0x3b')]));if(_0x1270f6['query']['filter']){_0x56e3b4[_0x0d05('0x42')]=_[_0x0d05('0x44')](_0x56e3b4[_0x0d05('0x42')],{'$or':_[_0x0d05('0x38')](_0x56e3b4[_0x0d05('0x3d')],function(_0x155880){var _0x1f5392={};_0x1f5392[_0x155880]={'$like':'%'+_0x1270f6['query'][_0x0d05('0x43')]+'%'};return _0x1f5392;})});}_0x56e3b4=_['merge']({},_0x56e3b4,_0x1270f6[_0x0d05('0x4a')]);return _0x3e5ad8['getSounds'](_0x56e3b4);}})[_0x0d05('0x2e')](function(_0x3e5e8b){if(_0x3e5e8b){_0x1aa692=_0x3e5e8b['length'];if(!_0x1270f6[_0x0d05('0x39')][_0x0d05('0x3f')]('nolimit')){_0x56e3b4[_0x0d05('0x21')]=qs[_0x0d05('0x21')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x21')]);_0x56e3b4[_0x0d05('0x23')]=qs[_0x0d05('0x23')](_0x1270f6[_0x0d05('0x39')][_0x0d05('0x23')]);}return _0x3e5ad8[_0x0d05('0x75')](_0x56e3b4);}})['then'](function(_0x2c47e5){if(_0x2c47e5){return _0x2c47e5?{'count':_0x1aa692,'rows':_0x2c47e5}:null;}})[_0x0d05('0x2e')](respondWithResult(_0x9a002b,null))[_0x0d05('0x4e')](handleError(_0x9a002b,null));}; \ No newline at end of file +var _0x678e=['getSounds','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','get','MusicOnHolds','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','rows','catch','params','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','removeSound','id2'];(function(_0x1aa617,_0x23271a){var _0x38653c=function(_0x1f17be){while(--_0x1f17be){_0x1aa617['push'](_0x1aa617['shift']());}};_0x38653c(++_0x23271a);}(_0x678e,0x71));var _0xe678=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x678e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xe678('0x0'));var rimraf=require(_0xe678('0x1'));var zipdir=require(_0xe678('0x2'));var jsonpatch=require(_0xe678('0x3'));var rp=require(_0xe678('0x4'));var moment=require('moment');var BPromise=require(_0xe678('0x5'));var Mustache=require(_0xe678('0x6'));var util=require(_0xe678('0x7'));var path=require(_0xe678('0x8'));var sox=require('sox');var csv=require(_0xe678('0x9'));var ejs=require(_0xe678('0xa'));var fs=require('fs');var fs_extra=require(_0xe678('0xb'));var _=require(_0xe678('0xc'));var squel=require(_0xe678('0xd'));var crypto=require(_0xe678('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe678('0xf'));var toCsv=require(_0xe678('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe678('0x10'));var authService=require(_0xe678('0x11'));var qs=require(_0xe678('0x12'));var as=require(_0xe678('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe678('0x14'));var utils=require(_0xe678('0x15'));var config=require(_0xe678('0x16'));var licenseUtil=require(_0xe678('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43484e,_0x3806a4){_0x3806a4=_0x3806a4||0xcc;return function(_0x510997){if(_0x510997){return _0x43484e[_0xe678('0x18')](_0x3806a4);}return _0x43484e[_0xe678('0x19')](_0x3806a4)[_0xe678('0x1a')]();};}function respondWithResult(_0x2903a4,_0x9d26e5){_0x9d26e5=_0x9d26e5||0xc8;return function(_0x45478d){if(_0x45478d){return _0x2903a4['status'](_0x9d26e5)[_0xe678('0x1b')](_0x45478d);}};}function respondWithFilteredResult(_0x585537,_0xd28f22){return function(_0x11a8af){if(_0x11a8af){var _0x4ac028=typeof _0xd28f22[_0xe678('0x1c')]===_0xe678('0x1d')&&typeof _0xd28f22[_0xe678('0x1e')]==='undefined';var _0x546121=_0x11a8af[_0xe678('0x1f')];var _0x5ceee3=_0x4ac028?0x0:_0xd28f22['offset'];var _0xa159b2=_0x4ac028?_0x11a8af[_0xe678('0x1f')]:_0xd28f22[_0xe678('0x1c')]+_0xd28f22[_0xe678('0x1e')];var _0x25c7dd;if(_0xa159b2>=_0x546121){_0xa159b2=_0x546121;_0x25c7dd=0xc8;}else{_0x25c7dd=0xce;}_0x585537[_0xe678('0x19')](_0x25c7dd);return _0x585537[_0xe678('0x20')]('Content-Range',_0x5ceee3+'-'+_0xa159b2+'/'+_0x546121)[_0xe678('0x1b')](_0x11a8af);}return null;};}function patchUpdates(_0x5831dc){return function(_0x122c84){try{jsonpatch[_0xe678('0x21')](_0x122c84,_0x5831dc,!![]);}catch(_0x5a2673){return BPromise['reject'](_0x5a2673);}return _0x122c84['save']();};}function saveUpdates(_0x503433,_0x2da9bb){return function(_0x5cd3a4){if(_0x5cd3a4){return _0x5cd3a4[_0xe678('0x22')](_0x503433)[_0xe678('0x23')](function(_0x433acd){return _0x433acd;});}return null;};}function removeEntity(_0x185f2e,_0x337d18){return function(_0x1498d2){if(_0x1498d2){return _0x1498d2[_0xe678('0x24')]()[_0xe678('0x23')](function(){var _0x3eb7ab=_0x1498d2[_0xe678('0x25')]({'plain':!![]});var _0x5cd5b2=_0xe678('0x26');return db['UserProfileResource'][_0xe678('0x24')]({'where':{'type':_0x5cd5b2,'resourceId':_0x3eb7ab['id']}})[_0xe678('0x23')](function(){return _0x1498d2;});})['then'](function(){_0x185f2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f172,_0xecf429){return function(_0x27e012){if(!_0x27e012){_0x13f172[_0xe678('0x18')](0x194);}return _0x27e012;};}function handleError(_0x54b661,_0x124a81){_0x124a81=_0x124a81||0x1f4;return function(_0xd97e83){logger['error'](_0xd97e83[_0xe678('0x27')]);if(_0xd97e83[_0xe678('0x28')]){delete _0xd97e83[_0xe678('0x28')];}_0x54b661[_0xe678('0x19')](_0x124a81)[_0xe678('0x29')](_0xd97e83);};}exports[_0xe678('0x2a')]=function(_0xbb3a4d,_0x6816d7){var _0x58b5ce={},_0x565b94={},_0xa89859={'count':0x0,'rows':[]};var _0x308304=_[_0xe678('0x2b')](db['VoiceMusicOnHold'][_0xe678('0x2c')],function(_0x4031d8){return{'name':_0x4031d8['fieldName'],'type':_0x4031d8[_0xe678('0x2d')][_0xe678('0x2e')]};});_0x565b94[_0xe678('0x2f')]=_['map'](_0x308304,_0xe678('0x28'));_0x565b94['query']=_[_0xe678('0x30')](_0xbb3a4d[_0xe678('0x31')]);_0x565b94[_0xe678('0x32')]=_[_0xe678('0x33')](_0x565b94['model'],_0x565b94['query']);_0x58b5ce[_0xe678('0x34')]=_[_0xe678('0x33')](_0x565b94[_0xe678('0x2f')],qs['fields'](_0xbb3a4d[_0xe678('0x31')][_0xe678('0x35')]));_0x58b5ce['attributes']=_0x58b5ce[_0xe678('0x34')][_0xe678('0x36')]?_0x58b5ce[_0xe678('0x34')]:_0x565b94[_0xe678('0x2f')];if(!_0xbb3a4d[_0xe678('0x31')][_0xe678('0x37')](_0xe678('0x38'))){_0x58b5ce[_0xe678('0x1e')]=qs[_0xe678('0x1e')](_0xbb3a4d[_0xe678('0x31')][_0xe678('0x1e')]);_0x58b5ce['offset']=qs[_0xe678('0x1c')](_0xbb3a4d[_0xe678('0x31')]['offset']);}_0x58b5ce[_0xe678('0x39')]=qs[_0xe678('0x3a')](_0xbb3a4d[_0xe678('0x31')]['sort']);delete _0xbb3a4d[_0xe678('0x31')][_0xe678('0x3a')];_0x58b5ce[_0xe678('0x3b')]=qs[_0xe678('0x32')](_[_0xe678('0x3c')](_0xbb3a4d['query'],_0x565b94[_0xe678('0x32')]),_0x308304);if(_0xbb3a4d[_0xe678('0x31')]['filter']){_0x58b5ce['where']=_[_0xe678('0x3d')](_0x58b5ce[_0xe678('0x3b')],{'$or':_[_0xe678('0x2b')](_0x308304,function(_0x353527){if(_0x353527[_0xe678('0x2d')]!==_0xe678('0x3e')){var _0x119b19={};_0x119b19[_0x353527[_0xe678('0x28')]]={'$like':'%'+_0xbb3a4d[_0xe678('0x31')]['filter']+'%'};return _0x119b19;}})});}_0x58b5ce=_[_0xe678('0x3d')]({},_0x58b5ce,_0xbb3a4d[_0xe678('0x3f')]);var _0x5773df={'where':_0x58b5ce[_0xe678('0x3b')]};return db['VoiceMusicOnHold']['count'](_0x5773df)[_0xe678('0x23')](function(_0x3951ea){_0xa89859[_0xe678('0x1f')]=_0x3951ea;if(_0xbb3a4d[_0xe678('0x31')][_0xe678('0x40')]){_0x58b5ce[_0xe678('0x41')]=[{'all':!![]}];}return db[_0xe678('0x42')][_0xe678('0x43')](_0x58b5ce);})['then'](function(_0x10070d){_0xa89859[_0xe678('0x44')]=_0x10070d;return _0xa89859;})['then'](respondWithFilteredResult(_0x6816d7,_0x58b5ce))[_0xe678('0x45')](handleError(_0x6816d7,null));};exports['show']=function(_0x4efbb3,_0x1b01ea){var _0xec4e41={'raw':![],'where':{'id':_0x4efbb3[_0xe678('0x46')]['id']}},_0x5de2e5={};_0x5de2e5[_0xe678('0x2f')]=_['keys'](db[_0xe678('0x42')][_0xe678('0x2c')]);_0x5de2e5[_0xe678('0x31')]=_[_0xe678('0x30')](_0x4efbb3[_0xe678('0x31')]);_0x5de2e5['filters']=_[_0xe678('0x33')](_0x5de2e5[_0xe678('0x2f')],_0x5de2e5['query']);_0xec4e41['attributes']=_[_0xe678('0x33')](_0x5de2e5[_0xe678('0x2f')],qs[_0xe678('0x35')](_0x4efbb3[_0xe678('0x31')][_0xe678('0x35')]));_0xec4e41['attributes']=_0xec4e41[_0xe678('0x34')][_0xe678('0x36')]?_0xec4e41[_0xe678('0x34')]:_0x5de2e5[_0xe678('0x2f')];if(_0x4efbb3[_0xe678('0x31')][_0xe678('0x40')]){_0xec4e41[_0xe678('0x41')]=[{'all':!![]}];}_0xec4e41=_[_0xe678('0x3d')]({},_0xec4e41,_0x4efbb3[_0xe678('0x3f')]);return db[_0xe678('0x42')][_0xe678('0x47')](_0xec4e41)[_0xe678('0x23')](handleEntityNotFound(_0x1b01ea,null))[_0xe678('0x23')](respondWithResult(_0x1b01ea,null))['catch'](handleError(_0x1b01ea,null));};exports['update']=function(_0x45ec11,_0x58f39a){if(_0x45ec11['body']['id']){delete _0x45ec11[_0xe678('0x48')]['id'];}return db[_0xe678('0x42')][_0xe678('0x47')]({'where':{'id':_0x45ec11[_0xe678('0x46')]['id']}})[_0xe678('0x23')](handleEntityNotFound(_0x58f39a,null))[_0xe678('0x23')](saveUpdates(_0x45ec11[_0xe678('0x48')],null))['then'](respondWithResult(_0x58f39a,null))[_0xe678('0x45')](handleError(_0x58f39a,null));};exports[_0xe678('0x49')]=function(_0x39d74d,_0x23c55f,_0x3f81a7){return db[_0xe678('0x4a')][_0xe678('0x4b')](function(_0x9a5d69){if(_0x39d74d[_0xe678('0x48')][_0xe678('0x4c')]===_0xe678('0x4d')){_0x39d74d[_0xe678('0x48')][_0xe678('0x4e')]=path[_0xe678('0x4f')](config[_0xe678('0x50')],_0xe678('0x51'),_0x39d74d[_0xe678('0x48')][_0xe678('0x28')]);}return db['VoiceMusicOnHold'][_0xe678('0x49')](_0x39d74d['body'],{'transaction':_0x9a5d69})[_0xe678('0x23')](function(_0x3dc377){if(_0x39d74d[_0xe678('0x48')]['mode']===_0xe678('0x4d')){fs[_0xe678('0x52')](_0x3dc377['directory'],parseInt(_0xe678('0x53'),0x8));}var _0x58548d=_0x39d74d['user'][_0xe678('0x25')]({'plain':!![]});if(!_0x58548d)throw new Error(_0xe678('0x54'));if(_0x58548d[_0xe678('0x55')]===_0xe678('0x56')){var _0x1b9428=_0x3dc377[_0xe678('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xe678('0x47')]({'where':{'name':_0xe678('0x26'),'userProfileId':_0x58548d['userProfileId']},'raw':!![]})[_0xe678('0x23')](function(_0x136b27){if(_0x136b27&&_0x136b27[_0xe678('0x57')]===0x0){return db['UserProfileResource'][_0xe678('0x49')]({'name':_0x1b9428[_0xe678('0x28')],'resourceId':_0x1b9428['id'],'type':_0x136b27[_0xe678('0x28')],'sectionId':_0x136b27['id']},{})[_0xe678('0x23')](function(){return _0x3dc377;});}else{return _0x3dc377;}})[_0xe678('0x45')](function(_0x283576){logger['error'](_0xe678('0x58'),_0x283576);});}return _0x3dc377;});})[_0xe678('0x23')](respondWithResult(_0x23c55f,0xc9))[_0xe678('0x45')](handleError(_0x23c55f,null));};exports['destroy']=function(_0x1cd157,_0x49f9d4,_0x4958a8){var _0x285c5b;return db[_0xe678('0x42')][_0xe678('0x47')]({'where':{'id':_0x1cd157['params']['id']}})[_0xe678('0x23')](function(_0x3ba128){if(_0x3ba128){return db[_0xe678('0x4a')][_0xe678('0x4b')](function(_0xe8ce5e){return _0x3ba128[_0xe678('0x24')]({'transaction':_0xe8ce5e,'raw':!![]})['then'](function(_0x40cdcd){if(_0x40cdcd[_0xe678('0x4e')]){fs[_0xe678('0x59')](_0x40cdcd[_0xe678('0x4e')])[_0xe678('0x5a')](function(_0x33cff4){fs[_0xe678('0x5b')](path[_0xe678('0x4f')](_0x40cdcd[_0xe678('0x4e')],_0x33cff4));});fs[_0xe678('0x5c')](_0x40cdcd[_0xe678('0x4e')]);}return _0x40cdcd;});})[_0xe678('0x45')](function(_0x46289f){throw new db[(_0xe678('0x5d'))][(_0xe678('0x5e'))](_0x46289f[_0xe678('0x5f')]);});}})[_0xe678('0x23')](handleEntityNotFound(_0x49f9d4,null))[_0xe678('0x23')](removeEntity(_0x49f9d4,null))['catch'](handleError(_0x49f9d4,null));};exports['addSound']=function(_0x457f79,_0x55efc4,_0x5834ce){return db[_0xe678('0x4a')]['transaction'](function(_0x405f64){var _0x2c0771;return db['VoiceMusicOnHold'][_0xe678('0x47')]({'where':{'id':_0x457f79[_0xe678('0x46')]['id']}})['then'](function(_0xe58bb3){if(_0xe58bb3){_0x2c0771=_0xe58bb3;return _0xe58bb3[_0xe678('0x60')](_0x457f79[_0xe678('0x48')]['id'],{'transaction':_0x405f64});}})[_0xe678('0x23')](function(_0x4b67d7){if(_0x4b67d7){return db[_0xe678('0x61')][_0xe678('0x62')]({'where':{'id':_0x457f79['body']['id']},'attributes':['id',_0xe678('0x28'),_0xe678('0x63'),_0xe678('0x64'),_0xe678('0x65')],'raw':!![]});}})[_0xe678('0x23')](function(_0x31cbcc){if(_0x31cbcc){var _0x21e4d2=path[_0xe678('0x4f')](config['root'],_0xe678('0x66'),util[_0xe678('0x67')](_0xe678('0x68'),path['basename'](_0x31cbcc[_0xe678('0x63')],path[_0xe678('0x69')](_0x31cbcc[_0xe678('0x63')])),_0x31cbcc['converted_format']));var _0x2416a2=path['join'](config[_0xe678('0x50')],_0xe678('0x51'),_0x2c0771[_0xe678('0x28')],util['format'](_0xe678('0x68'),_0x31cbcc[_0xe678('0x28')],_0x31cbcc['converted_format']));fs[_0xe678('0x6a')](_0x21e4d2,_0x2416a2);return _0x31cbcc;}})[_0xe678('0x45')](function(_0x7f3f57){throw new db[(_0xe678('0x5d'))][(_0xe678('0x5e'))](_0x7f3f57[_0xe678('0x5f')]);});})['then'](handleEntityNotFound(_0x55efc4,null))[_0xe678('0x23')](respondWithResult(_0x55efc4,0xc9))[_0xe678('0x45')](handleError(_0x55efc4,null));};exports['removeSound']=function(_0x200746,_0x533dc6,_0x965fd2){return db[_0xe678('0x4a')][_0xe678('0x4b')](function(_0x552ca7){var _0xbfd642;return db[_0xe678('0x42')]['findOne']({'where':{'id':_0x200746[_0xe678('0x46')]['id']}})[_0xe678('0x23')](handleEntityNotFound(_0x533dc6,null))[_0xe678('0x23')](function(_0x582238){if(_0x582238){_0xbfd642=_0x582238;return _0x582238[_0xe678('0x6b')](_0x200746[_0xe678('0x46')]['id2']);}})['then'](function(_0x332a5f){if(_0x332a5f){return db[_0xe678('0x61')][_0xe678('0x62')]({'where':{'id':_0x200746[_0xe678('0x46')][_0xe678('0x6c')]},'attributes':['id',_0xe678('0x28'),_0xe678('0x63'),_0xe678('0x64'),_0xe678('0x65')],'raw':!![]});}})[_0xe678('0x23')](function(_0x5ef1c8){if(_0x5ef1c8){fs[_0xe678('0x5b')](path[_0xe678('0x4f')](_0xbfd642[_0xe678('0x4e')],util['format'](_0xe678('0x68'),_0x5ef1c8[_0xe678('0x28')],_0x5ef1c8[_0xe678('0x64')])));return _0x5ef1c8;}})[_0xe678('0x45')](function(_0x3a3f65){throw new db[(_0xe678('0x5d'))][(_0xe678('0x5e'))](_0x3a3f65[_0xe678('0x5f')]);});})[_0xe678('0x23')](handleEntityNotFound(_0x533dc6,null))[_0xe678('0x23')](respondWithStatusCode(_0x533dc6,0xcc))['catch'](handleError(_0x533dc6,null));};exports[_0xe678('0x6d')]=function(_0xced913,_0x56fa74,_0x117889){var _0x144e06={};var _0xcf4c63={};var _0x5af0ab;var _0x346d51;return db[_0xe678('0x42')][_0xe678('0x62')]({'where':{'id':_0xced913[_0xe678('0x46')]['id']}})[_0xe678('0x23')](handleEntityNotFound(_0x56fa74,null))[_0xe678('0x23')](function(_0x25b6de){if(_0x25b6de){_0x5af0ab=_0x25b6de;_0xcf4c63[_0xe678('0x2f')]=_[_0xe678('0x30')](db[_0xe678('0x61')][_0xe678('0x2c')]);_0xcf4c63[_0xe678('0x31')]=_[_0xe678('0x30')](_0xced913['query']);_0xcf4c63[_0xe678('0x32')]=_[_0xe678('0x33')](_0xcf4c63[_0xe678('0x2f')],_0xcf4c63[_0xe678('0x31')]);_0x144e06[_0xe678('0x34')]=_[_0xe678('0x33')](_0xcf4c63[_0xe678('0x2f')],qs[_0xe678('0x35')](_0xced913[_0xe678('0x31')][_0xe678('0x35')]));_0x144e06[_0xe678('0x34')]=_0x144e06[_0xe678('0x34')]['length']?_0x144e06[_0xe678('0x34')]:_0xcf4c63[_0xe678('0x2f')];_0x144e06[_0xe678('0x39')]=qs[_0xe678('0x3a')](_0xced913[_0xe678('0x31')][_0xe678('0x3a')]);_0x144e06[_0xe678('0x3b')]=qs[_0xe678('0x32')](_[_0xe678('0x3c')](_0xced913['query'],_0xcf4c63['filters']));if(_0xced913[_0xe678('0x31')][_0xe678('0x6e')]){_0x144e06[_0xe678('0x3b')]=_[_0xe678('0x3d')](_0x144e06[_0xe678('0x3b')],{'$or':_[_0xe678('0x2b')](_0x144e06[_0xe678('0x34')],function(_0x560232){var _0x16629e={};_0x16629e[_0x560232]={'$like':'%'+_0xced913[_0xe678('0x31')][_0xe678('0x6e')]+'%'};return _0x16629e;})});}_0x144e06=_[_0xe678('0x3d')]({},_0x144e06,_0xced913[_0xe678('0x3f')]);return _0x5af0ab[_0xe678('0x6d')](_0x144e06);}})['then'](function(_0x506e94){if(_0x506e94){_0x346d51=_0x506e94[_0xe678('0x36')];if(!_0xced913[_0xe678('0x31')]['hasOwnProperty'](_0xe678('0x38'))){_0x144e06[_0xe678('0x1e')]=qs[_0xe678('0x1e')](_0xced913[_0xe678('0x31')][_0xe678('0x1e')]);_0x144e06['offset']=qs['offset'](_0xced913[_0xe678('0x31')][_0xe678('0x1c')]);}return _0x5af0ab[_0xe678('0x6d')](_0x144e06);}})[_0xe678('0x23')](function(_0x4d20f7){if(_0x4d20f7){return _0x4d20f7?{'count':_0x346d51,'rows':_0x4d20f7}:null;}})['then'](respondWithResult(_0x56fa74,null))[_0xe678('0x45')](handleError(_0x56fa74,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8bd5b3e..c66ebe2 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 _0x02dd=['voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x02dd,0xc5));var _0xd02d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x02dd[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xd02d('0x0'));var util=require(_0xd02d('0x1'));var logger=require(_0xd02d('0x2'))(_0xd02d('0x3'));var moment=require(_0xd02d('0x4'));var BPromise=require(_0xd02d('0x5'));var rp=require(_0xd02d('0x6'));var fs=require('fs');var path=require(_0xd02d('0x7'));var rimraf=require(_0xd02d('0x8'));var config=require('../../config/environment');var attributes=require(_0xd02d('0x9'));module[_0xd02d('0xa')]=function(_0x14bc95,_0x2841a7){return _0x14bc95[_0xd02d('0xb')](_0xd02d('0xc'),attributes,{'tableName':_0xd02d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d0f=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','path'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x5d0f,0x14f));var _0xf5d0=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x5d0f[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xf5d0('0x0'));var util=require(_0xf5d0('0x1'));var logger=require(_0xf5d0('0x2'))(_0xf5d0('0x3'));var moment=require(_0xf5d0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5d0('0x5'));var rimraf=require(_0xf5d0('0x6'));var config=require(_0xf5d0('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xf5d0('0x8')]=function(_0x47a06d,_0x3dbbe3){return _0x47a06d[_0xf5d0('0x9')](_0xf5d0('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 6bf3ab7..0d2b21b 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0xb8c0e3,_0x117bb7){var _0x18547c=function(_0x2880a4){while(--_0x2880a4){_0xb8c0e3['push'](_0xb8c0e3['shift']());}};_0x18547c(++_0x117bb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 _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(_0x36fc7f,_0x18f627){var _0x135a0d=function(_0x108bb3){while(--_0x108bb3){_0x36fc7f['push'](_0x36fc7f['shift']());}};_0x135a0d(++_0x18f627);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 e57bbb6..b66b275 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 _0x487d=['/:id','show','getAgents','getTeams','post','create','/:id/users','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x26ffd9,_0x380473){var _0x32c2a3=function(_0x3eff4e){while(--_0x3eff4e){_0x26ffd9['push'](_0x26ffd9['shift']());}};_0x32c2a3(++_0x380473);}(_0x487d,0x1b4));var _0xd487=function(_0x5773e7,_0x435e69){_0x5773e7=_0x5773e7-0x0;var _0x5e6621=_0x487d[_0x5773e7];return _0x5e6621;};'use strict';var multer=require(_0xd487('0x0'));var util=require(_0xd487('0x1'));var path=require(_0xd487('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd487('0x3')]();var fs_extra=require(_0xd487('0x4'));var auth=require(_0xd487('0x5'));var interaction=require(_0xd487('0x6'));var config=require(_0xd487('0x7'));var controller=require('./voicePrefix.controller');router[_0xd487('0x8')]('/',auth[_0xd487('0x9')](),controller['index']);router[_0xd487('0x8')](_0xd487('0xa'),auth[_0xd487('0x9')](),controller[_0xd487('0xb')]);router['get'](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0xd')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xd487('0xe')]);router[_0xd487('0x8')]('/:id/teams',auth[_0xd487('0x9')](),controller[_0xd487('0xf')]);router[_0xd487('0x10')]('/',auth[_0xd487('0x9')](),controller[_0xd487('0x11')]);router[_0xd487('0x10')](_0xd487('0x12'),auth[_0xd487('0x9')](),controller['addAgents']);router[_0xd487('0x10')](_0xd487('0x13'),auth[_0xd487('0x9')](),controller[_0xd487('0x14')]);router[_0xd487('0x15')](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0x16')]);router[_0xd487('0x17')](_0xd487('0xc'),auth[_0xd487('0x9')](),controller[_0xd487('0x18')]);router['delete'](_0xd487('0x12'),auth[_0xd487('0x9')](),controller[_0xd487('0x19')]);router[_0xd487('0x17')]('/:id/teams',auth[_0xd487('0x9')](),controller[_0xd487('0x1a')]);module[_0xd487('0x1b')]=router; \ No newline at end of file +var _0x75a2=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','put','/:id','update','delete','destroy','removeAgents'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x75a2,0x187));var _0x275a=function(_0x1b9090,_0x577b31){_0x1b9090=_0x1b9090-0x0;var _0x1d6c61=_0x75a2[_0x1b9090];return _0x1d6c61;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require('connect-timeout');var express=require(_0x275a('0x3'));var router=express[_0x275a('0x4')]();var fs_extra=require(_0x275a('0x5'));var auth=require(_0x275a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x275a('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x275a('0x8')](_0x275a('0x9'),auth[_0x275a('0xa')](),controller[_0x275a('0xb')]);router['get']('/:id',auth[_0x275a('0xa')](),controller[_0x275a('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x275a('0xd')]);router[_0x275a('0x8')](_0x275a('0xe'),auth[_0x275a('0xa')](),controller[_0x275a('0xf')]);router[_0x275a('0x10')]('/',auth[_0x275a('0xa')](),controller[_0x275a('0x11')]);router[_0x275a('0x10')](_0x275a('0x12'),auth[_0x275a('0xa')](),controller['addAgents']);router[_0x275a('0x10')](_0x275a('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x275a('0x13')](_0x275a('0x14'),auth[_0x275a('0xa')](),controller[_0x275a('0x15')]);router[_0x275a('0x16')](_0x275a('0x14'),auth[_0x275a('0xa')](),controller[_0x275a('0x17')]);router[_0x275a('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x275a('0x18')]);router[_0x275a('0x16')]('/:id/teams',auth[_0x275a('0xa')](),controller['removeTeams']);module[_0x275a('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 2c4c926..197c813 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 _0xd3cf=['INTEGER','sequelize','exports','STRING','VIRTUAL','system-','getDataValue','name'];(function(_0x4688d3,_0x400ed5){var _0x572067=function(_0x4601f1){while(--_0x4601f1){_0x4688d3['push'](_0x4688d3['shift']());}};_0x572067(++_0x400ed5);}(_0xd3cf,0x149));var _0xfd3c=function(_0x245b4f,_0x181e27){_0x245b4f=_0x245b4f-0x0;var _0x257559=_0xd3cf[_0x245b4f];return _0x257559;};'use strict';var Sequelize=require(_0xfd3c('0x0'));module[_0xfd3c('0x1')]={'name':{'type':Sequelize[_0xfd3c('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xfd3c('0x3')],'get':function(_0x1770ca){return _0xfd3c('0x4')+this[_0xfd3c('0x5')](_0xfd3c('0x6'))+'-';}},'description':{'type':Sequelize[_0xfd3c('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xfd3c('0x7')]}}; \ No newline at end of file +var _0x9be5=['STRING','INTEGER','sequelize','name','system-','getDataValue'];(function(_0x38d42d,_0x30a00f){var _0x41e57a=function(_0x384dff){while(--_0x384dff){_0x38d42d['push'](_0x38d42d['shift']());}};_0x41e57a(++_0x30a00f);}(_0x9be5,0x74));var _0x59be=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x9be5[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x59be('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x59be('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5ce97a){return _0x59be('0x2')+this[_0x59be('0x3')](_0x59be('0x1'))+'-';}},'description':{'type':Sequelize[_0x59be('0x4')]},'callerIdAll':{'type':Sequelize[_0x59be('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x59be('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 37c1016..4559e8f 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 _0x3266=['index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','emit','userVoicePrefix:save','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','getTeams','Team','interface','Agents','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x3266,0x6a));var _0x6326=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x3266[_0x270adf];return _0x29eda9;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];config[_0x6326('0x1c')]=_['defaults'](config['redis'],{'host':_0x6326('0x1d'),'port':0x18eb});var socket=require(_0x6326('0x1e'))(new Redis(config['redis']));require(_0x6326('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2d9b,_0x20dcc6){_0x20dcc6=_0x20dcc6||0xcc;return function(_0x3d6ac0){if(_0x3d6ac0){return _0x2d2d9b[_0x6326('0x20')](_0x20dcc6);}return _0x2d2d9b[_0x6326('0x21')](_0x20dcc6)[_0x6326('0x22')]();};}function respondWithResult(_0x55923a,_0x1104c5){_0x1104c5=_0x1104c5||0xc8;return function(_0x518e6f){if(_0x518e6f){return _0x55923a['status'](_0x1104c5)['json'](_0x518e6f);}};}function respondWithFilteredResult(_0x51e7b9,_0x5d402d){return function(_0x58e960){if(_0x58e960){var _0xdf5ced=typeof _0x5d402d[_0x6326('0x23')]===_0x6326('0x24')&&typeof _0x5d402d['limit']==='undefined';var _0x954ed5=_0x58e960[_0x6326('0x25')];var _0x272b5c=_0xdf5ced?0x0:_0x5d402d[_0x6326('0x23')];var _0x3c08db=_0xdf5ced?_0x58e960[_0x6326('0x25')]:_0x5d402d[_0x6326('0x23')]+_0x5d402d['limit'];var _0x22307f;if(_0x3c08db>=_0x954ed5){_0x3c08db=_0x954ed5;_0x22307f=0xc8;}else{_0x22307f=0xce;}_0x51e7b9['status'](_0x22307f);return _0x51e7b9[_0x6326('0x26')](_0x6326('0x27'),_0x272b5c+'-'+_0x3c08db+'/'+_0x954ed5)[_0x6326('0x28')](_0x58e960);}return null;};}function patchUpdates(_0x24fb78){return function(_0x43cdfc){try{jsonpatch[_0x6326('0x29')](_0x43cdfc,_0x24fb78,!![]);}catch(_0x225555){return BPromise[_0x6326('0x2a')](_0x225555);}return _0x43cdfc[_0x6326('0x2b')]();};}function saveUpdates(_0x2d0d00,_0x34954b){return function(_0x4933e1){if(_0x4933e1){return _0x4933e1[_0x6326('0x2c')](_0x2d0d00)[_0x6326('0x2d')](function(_0x575701){return _0x575701;});}return null;};}function removeEntity(_0x4e272b,_0x4d28fd){return function(_0x405474){if(_0x405474){return _0x405474['destroy']()[_0x6326('0x2d')](function(){var _0x1a48da=_0x405474['get']({'plain':!![]});var _0x15e33d=_0x6326('0x2e');return db[_0x6326('0x2f')][_0x6326('0x30')]({'where':{'type':_0x15e33d,'resourceId':_0x1a48da['id']}})[_0x6326('0x2d')](function(){return _0x405474;});})[_0x6326('0x2d')](function(){_0x4e272b[_0x6326('0x21')](0xcc)[_0x6326('0x22')]();});}};}function handleEntityNotFound(_0x461e0f,_0x127744){return function(_0x4980f6){if(!_0x4980f6){_0x461e0f[_0x6326('0x20')](0x194);}return _0x4980f6;};}function handleError(_0x331772,_0x134524){_0x134524=_0x134524||0x1f4;return function(_0x2e0445){logger[_0x6326('0x31')](_0x2e0445['stack']);if(_0x2e0445[_0x6326('0x32')]){delete _0x2e0445[_0x6326('0x32')];}_0x331772[_0x6326('0x21')](_0x134524)['send'](_0x2e0445);};}exports[_0x6326('0x33')]=function(_0x4d7807,_0x4e703a){var _0xfb6b62={},_0x7ac8d9={},_0x160a12={'count':0x0,'rows':[]};var _0x103b1c=_[_0x6326('0x34')](db[_0x6326('0x35')][_0x6326('0x36')],function(_0x46c803){return{'name':_0x46c803[_0x6326('0x37')],'type':_0x46c803[_0x6326('0x38')][_0x6326('0x39')]};});_0x7ac8d9[_0x6326('0x3a')]=_['map'](_0x103b1c,_0x6326('0x32'));_0x7ac8d9[_0x6326('0x3b')]=_['keys'](_0x4d7807[_0x6326('0x3b')]);_0x7ac8d9[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x7ac8d9['model'],_0x7ac8d9[_0x6326('0x3b')]);_0xfb6b62['attributes']=_['intersection'](_0x7ac8d9[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x4d7807[_0x6326('0x3b')]['fields']));_0xfb6b62[_0x6326('0x3f')]=_0xfb6b62['attributes'][_0x6326('0x40')]?_0xfb6b62['attributes']:_0x7ac8d9[_0x6326('0x3a')];if(!_0x4d7807[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0xfb6b62[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x4d7807['query'][_0x6326('0x43')]);_0xfb6b62[_0x6326('0x23')]=qs['offset'](_0x4d7807[_0x6326('0x3b')]['offset']);}_0xfb6b62['order']=qs[_0x6326('0x44')](_0x4d7807[_0x6326('0x3b')][_0x6326('0x44')]);_0xfb6b62[_0x6326('0x45')]=qs[_0x6326('0x3c')](_[_0x6326('0x46')](_0x4d7807['query'],_0x7ac8d9['filters']),_0x103b1c);if(_0x4d7807[_0x6326('0x3b')]['filter']){_0xfb6b62[_0x6326('0x45')]=_['merge'](_0xfb6b62[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x103b1c,function(_0x335feb){if(_0x335feb[_0x6326('0x38')]!==_0x6326('0x47')){var _0x1b754d={};_0x1b754d[_0x335feb[_0x6326('0x32')]]={'$like':'%'+_0x4d7807[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x1b754d;}})});}_0xfb6b62=_[_0x6326('0x49')]({},_0xfb6b62,_0x4d7807[_0x6326('0x4a')]);var _0x5d36b1={'where':_0xfb6b62[_0x6326('0x45')]};return db['VoicePrefix'][_0x6326('0x25')](_0x5d36b1)[_0x6326('0x2d')](function(_0x16fc33){_0x160a12[_0x6326('0x25')]=_0x16fc33;if(_0x4d7807['query'][_0x6326('0x4b')]){_0xfb6b62[_0x6326('0x4c')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6326('0x4d')](_0xfb6b62);})[_0x6326('0x2d')](function(_0x7a5057){_0x160a12[_0x6326('0x4e')]=_0x7a5057;return _0x160a12;})['then'](respondWithFilteredResult(_0x4e703a,_0xfb6b62))[_0x6326('0x4f')](handleError(_0x4e703a,null));};exports[_0x6326('0x50')]=function(_0x231e15,_0x28504f){var _0x44d852={'raw':![],'where':{'id':_0x231e15[_0x6326('0x51')]['id']}},_0x165953={};_0x165953['model']=_[_0x6326('0x52')](db[_0x6326('0x35')][_0x6326('0x36')]);_0x165953[_0x6326('0x3b')]=_['keys'](_0x231e15[_0x6326('0x3b')]);_0x165953['filters']=_[_0x6326('0x3d')](_0x165953[_0x6326('0x3a')],_0x165953[_0x6326('0x3b')]);_0x44d852[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x165953['model'],qs[_0x6326('0x3e')](_0x231e15['query']['fields']));_0x44d852[_0x6326('0x3f')]=_0x44d852[_0x6326('0x3f')]['length']?_0x44d852[_0x6326('0x3f')]:_0x165953[_0x6326('0x3a')];if(_0x231e15[_0x6326('0x3b')][_0x6326('0x4b')]){_0x44d852[_0x6326('0x4c')]=[{'all':!![]}];}_0x44d852=_['merge']({},_0x44d852,_0x231e15['options']);return db[_0x6326('0x35')][_0x6326('0x53')](_0x44d852)[_0x6326('0x2d')](handleEntityNotFound(_0x28504f,null))[_0x6326('0x2d')](respondWithResult(_0x28504f,null))[_0x6326('0x4f')](handleError(_0x28504f,null));};exports[_0x6326('0x30')]=function(_0xdc4522,_0x55bcd6){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0xdc4522[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x55bcd6,null))[_0x6326('0x2d')](removeEntity(_0x55bcd6,null))['catch'](handleError(_0x55bcd6,null));};exports[_0x6326('0x54')]=function(_0x55537a,_0x216972){return db[_0x6326('0x35')]['describe']()[_0x6326('0x2d')](respondWithResult(_0x216972,null))['catch'](handleError(_0x216972,null));};exports[_0x6326('0x55')]=function(_0x202fd3,_0x2ee8df){var _0x35400e;return db['sequelize'][_0x6326('0x56')](function(_0xbe6b3e){return db['VoicePrefix'][_0x6326('0x55')](_0x202fd3[_0x6326('0x57')],{'transaction':_0xbe6b3e})[_0x6326('0x2d')](function(_0x4a42ae){_0x35400e=_0x4a42ae[_0x6326('0x58')]({'plain':!![]});return db[_0x6326('0x59')]['find']({'where':{'id':_0x35400e[_0x6326('0x5a')]},'raw':!![]})['then'](function(_0x1f1463){return createVoicePrefixExtensions(_0x35400e,_0x1f1463,_0xbe6b3e);});});})[_0x6326('0x2d')](function(){var _0x3e9825=_0x202fd3[_0x6326('0x5b')][_0x6326('0x58')]({'plain':!![]});if(!_0x3e9825)throw new Error(_0x6326('0x5c'));if(_0x3e9825[_0x6326('0x5d')]==='user'){var _0x51adce=_0x35400e;return db['UserProfileSection'][_0x6326('0x53')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9825[_0x6326('0x5e')]},'raw':!![]})[_0x6326('0x2d')](function(_0xcae454){if(_0xcae454&&_0xcae454[_0x6326('0x5f')]===0x0){return db[_0x6326('0x2f')]['create']({'name':_0x51adce[_0x6326('0x32')],'resourceId':_0x51adce['id'],'type':_0xcae454[_0x6326('0x32')],'sectionId':_0xcae454['id']},{})['then'](function(){return _0x35400e;});}else{return _0x35400e;}})[_0x6326('0x4f')](function(_0xdeba28){logger[_0x6326('0x31')](_0x6326('0x60'),_0xdeba28);throw _0xdeba28;});}return _0x35400e;})[_0x6326('0x2d')](respondWithResult(_0x2ee8df,null))[_0x6326('0x4f')](handleError(_0x2ee8df,null));};function Extension(_0x320d43,_0x2f624f,_0x2c7a8d,_0x37506f){this['context']=_0x6326('0x61');this[_0x6326('0x62')]=_0x320d43;this[_0x6326('0x63')]=_0x2c7a8d;this[_0x6326('0x38')]='system';this['description']=_0x6326('0x64');this[_0x6326('0x65')]=_0x2f624f;this[_0x6326('0x66')]=_0x37506f;}function createVoicePrefixExtensions(_0x10f54b,_0x3ac39d,_0x54a9eb){return new BPromise(function(_0x4cec50,_0x13fc10){var _0x447b34=new Extension(formatPrefixName(_0x10f54b[_0x6326('0x67')]),0x1,_0x6326('0x68'),'Voice\x20Prefix');_0x447b34[_0x6326('0x69')]=_0x10f54b['id'];return db[_0x6326('0x59')][_0x6326('0x55')](_0x447b34,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x4197d6){var _0xc8f404=_0x4197d6['get']({'plain':!![]});var _0x2bc08a=_['map'](addVoicePrefixExtensions(_0x10f54b,_0x3ac39d),function(_0x4877c8){_0x4877c8[_0x6326('0x5a')]=_0xc8f404['id'];_0x4877c8['VoicePrefixId']=_0x10f54b['id'];return _0x4877c8;});return db[_0x6326('0x59')][_0x6326('0x6a')](_0x2bc08a,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x3b6de7){if(!_0x3b6de7){return _0x13fc10(_0x6326('0x6b'));}else{return _0x4cec50(_0x3b6de7);}})[_0x6326('0x4f')](function(_0x1e8d86){return _0x13fc10(_0x1e8d86);});});;});};function addVoicePrefixExtensions(_0x75e3a7,_0xa2928e){var _0x3f5e2e=[];var _0x53ff60=formatPrefixName(_0x75e3a7[_0x6326('0x67')]);_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x2,_0x6326('0x6d'),_0x6326('0x6e')+_0x75e3a7[_0x6326('0x32')]));if(_0x75e3a7['callerIdAll']){_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,_0x6326('0x6d'),_0x6326('0x6f')+_0x75e3a7[_0x6326('0x70')]));}else{_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,'NoOp',_0x6326('0x71')));}_0x3f5e2e['push'](new Extension(_0x53ff60,0x4,'goto',_0xa2928e[_0x6326('0x72')]+','+_0x6326('0x73')+(0x8+_0x75e3a7[_0x6326('0x32')][_0x6326('0x40')])+'}'+','+0x1));return _0x3f5e2e;}function formatPrefixName(_0x4fd921){var _0x4fbede='_';for(var _0x5cadb2=0x0;_0x5cadb2<_0x4fd921['length'];_0x5cadb2++){if(_0x4fd921[_0x6326('0x74')](_0x5cadb2)=='-'){_0x4fbede+=_0x4fd921['charAt'](_0x5cadb2);}else{_0x4fbede+='['+_0x4fd921[_0x6326('0x74')](_0x5cadb2)+']';}}_0x4fbede+='.';return _0x4fbede;}exports[_0x6326('0x2c')]=function(_0x54730e,_0x4c1d7e,_0x5401cf){var _0x5e86bc=_0x54730e['body'];_0x5e86bc[_0x6326('0x67')]='system-'+_0x5e86bc['name']+'-';return db['sequelize']['transaction'](function(_0x19916e){return db['VoicePrefix'][_0x6326('0x2c')](_0x5e86bc,{'where':{'id':_0x5e86bc['id']},'transaction':_0x19916e})[_0x6326('0x2d')](function(){return db['VoiceExtension'][_0x6326('0x30')]({'where':{'VoicePrefixId':_0x5e86bc['id']},'transaction':_0x19916e})['then'](function(){return db[_0x6326('0x59')][_0x6326('0x53')]({'where':{'id':_0x5e86bc[_0x6326('0x5a')]},'raw':!![]})[_0x6326('0x2d')](function(_0x339838){return createVoicePrefixExtensions(_0x5e86bc,_0x339838,_0x19916e);});});});})[_0x6326('0x2d')](function(){return db[_0x6326('0x35')][_0x6326('0x75')](_0x5e86bc['id']);})[_0x6326('0x2d')](respondWithResult(_0x4c1d7e,null))[_0x6326('0x4f')](handleError(_0x4c1d7e,null));};exports[_0x6326('0x76')]=function(_0x19cc2b,_0x3bc5f3,_0x27a505){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0x19cc2b[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x3bc5f3,null))['then'](function(_0x543792){if(_0x543792){return _0x543792['addAgents'](_0x19cc2b[_0x6326('0x57')]['ids'],_['omit'](_0x19cc2b['body'],['ids','id'])||{})['spread'](function(_0x5a1a9f){for(var _0xe845d6=0x0;_0xe845d6<_0x19cc2b[_0x6326('0x57')]['ids'][_0x6326('0x40')];_0xe845d6+=0x1){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':Number(_0x19cc2b['body'][_0x6326('0x79')][_0xe845d6]),'VoicePrefixId':Number(_0x19cc2b[_0x6326('0x51')]['id'])});}return _0x5a1a9f;});}})[_0x6326('0x2d')](respondWithResult(_0x3bc5f3,null))[_0x6326('0x4f')](handleError(_0x3bc5f3,null));};exports[_0x6326('0x7a')]=function(_0x483813,_0x3bff09,_0x4aec22){return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x483813['params']['id']}})['then'](handleEntityNotFound(_0x3bff09,null))['then'](function(_0x491f2e){if(_0x491f2e){return _0x491f2e['removeAgents'](_0x483813['query']['ids'])[_0x6326('0x2d')](function(){if(_[_0x6326('0x7b')](_0x483813[_0x6326('0x3b')][_0x6326('0x79')])){for(var _0x590e06=0x0;_0x590e06<_0x483813['query']['ids'][_0x6326('0x40')];_0x590e06+=0x1){socket[_0x6326('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x483813[_0x6326('0x3b')]['ids'][_0x590e06]),'VoicePrefixId':Number(_0x483813['params']['id'])});}}else{socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':Number(_0x483813[_0x6326('0x3b')][_0x6326('0x79')]),'VoicePrefixId':Number(_0x483813[_0x6326('0x51')]['id'])});}});}})[_0x6326('0x2d')](respondWithStatusCode(_0x3bff09,null))[_0x6326('0x4f')](handleError(_0x3bff09,null));};exports['getAgents']=function(_0x5afd24,_0x4c8bde,_0x1ec0ef){var _0x5223f4={};var _0x48631a={};var _0xaea64f;var _0x429c41;return db['VoicePrefix'][_0x6326('0x7d')]({'where':{'id':_0x5afd24['params']['id']}})['then'](handleEntityNotFound(_0x4c8bde,null))[_0x6326('0x2d')](function(_0xbca686){if(_0xbca686){_0xaea64f=_0xbca686;_0x48631a['model']=_['keys'](db[_0x6326('0x7e')][_0x6326('0x36')]);_0x48631a[_0x6326('0x3b')]=_[_0x6326('0x52')](_0x5afd24['query']);_0x48631a['filters']=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],_0x48631a[_0x6326('0x3b')]);_0x5223f4[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x5afd24[_0x6326('0x3b')]['fields']));_0x5223f4[_0x6326('0x3f')]=_0x5223f4['attributes'][_0x6326('0x40')]?_0x5223f4[_0x6326('0x3f')]:_0x48631a[_0x6326('0x3a')];_0x5223f4[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x5afd24[_0x6326('0x3b')]['sort']);_0x5223f4[_0x6326('0x45')]=qs[_0x6326('0x3c')](_['pick'](_0x5afd24[_0x6326('0x3b')],_0x48631a[_0x6326('0x3c')]));if(_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]){_0x5223f4[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5223f4[_0x6326('0x45')],{'$or':_['map'](_0x5223f4[_0x6326('0x3f')],function(_0x21ccbf){var _0x458a7e={};_0x458a7e[_0x21ccbf]={'$like':'%'+_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x458a7e;})});}_0x5223f4=_['merge']({},_0x5223f4,_0x5afd24[_0x6326('0x4a')]);return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})['then'](function(_0x411fe5){if(_0x411fe5){_0x429c41=_0x411fe5[_0x6326('0x40')];if(!_0x5afd24[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5223f4[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x5afd24[_0x6326('0x3b')]['limit']);_0x5223f4[_0x6326('0x23')]=qs[_0x6326('0x23')](_0x5afd24[_0x6326('0x3b')][_0x6326('0x23')]);}return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})[_0x6326('0x2d')](function(_0xcb5683){if(_0xcb5683){return _0xcb5683?{'count':_0x429c41,'rows':_0xcb5683}:null;}})['then'](respondWithResult(_0x4c8bde,null))[_0x6326('0x4f')](handleError(_0x4c8bde,null));};exports['getTeams']=function(_0x44cea5,_0x57e6ad,_0x3a9312){var _0x5b251f={};var _0x2b885b={};var _0xda3005;var _0x29682b;return db[_0x6326('0x35')][_0x6326('0x7d')]({'where':{'id':_0x44cea5[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x57e6ad,null))['then'](function(_0x1da431){if(_0x1da431){_0xda3005=_0x1da431;_0x2b885b[_0x6326('0x3a')]=_[_0x6326('0x52')](db['Team'][_0x6326('0x36')]);_0x2b885b['query']=_[_0x6326('0x52')](_0x44cea5[_0x6326('0x3b')]);_0x2b885b[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x2b885b[_0x6326('0x3a')],_0x2b885b[_0x6326('0x3b')]);_0x5b251f[_0x6326('0x3f')]=_['intersection'](_0x2b885b[_0x6326('0x3a')],qs['fields'](_0x44cea5[_0x6326('0x3b')][_0x6326('0x3e')]));_0x5b251f[_0x6326('0x3f')]=_0x5b251f[_0x6326('0x3f')]['length']?_0x5b251f['attributes']:_0x2b885b[_0x6326('0x3a')];_0x5b251f[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x44cea5[_0x6326('0x3b')]['sort']);_0x5b251f[_0x6326('0x45')]=qs['filters'](_['pick'](_0x44cea5[_0x6326('0x3b')],_0x2b885b[_0x6326('0x3c')]));if(_0x44cea5[_0x6326('0x3b')][_0x6326('0x48')]){_0x5b251f[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5b251f[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x5b251f[_0x6326('0x3f')],function(_0x3884db){var _0x5ccb35={};_0x5ccb35[_0x3884db]={'$like':'%'+_0x44cea5['query'][_0x6326('0x48')]+'%'};return _0x5ccb35;})});}_0x5b251f=_['merge']({},_0x5b251f,_0x44cea5[_0x6326('0x4a')]);return _0xda3005['getTeams'](_0x5b251f);}})['then'](function(_0x10d3c6){if(_0x10d3c6){_0x29682b=_0x10d3c6[_0x6326('0x40')];if(!_0x44cea5[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5b251f[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x44cea5[_0x6326('0x3b')]['limit']);_0x5b251f['offset']=qs[_0x6326('0x23')](_0x44cea5['query'][_0x6326('0x23')]);}return _0xda3005[_0x6326('0x81')](_0x5b251f);}})['then'](function(_0x5c57e5){if(_0x5c57e5){return _0x5c57e5?{'count':_0x29682b,'rows':_0x5c57e5}:null;}})[_0x6326('0x2d')](respondWithResult(_0x57e6ad,null))['catch'](handleError(_0x57e6ad,null));};exports['addTeams']=function(_0x50d766,_0x4f45a6,_0x3a9a9e){var _0x22c60d=_0x50d766[_0x6326('0x57')][_0x6326('0x79')];var _0x26f784;return db[_0x6326('0x82')]['findAll']({'where':{'id':_0x22c60d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0x6326('0x83')],'raw':!![]}]})[_0x6326('0x2d')](function(_0x215db1){if(_0x215db1){_0x26f784=_0x215db1;var _0x2a9f5c=_['flatMap'](_0x215db1,function(_0x20f5ea){var _0x293f72=_0x20f5ea['get']({'plain':!![]});return _0x293f72[_0x6326('0x84')];});return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x50d766[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](function(_0x5d4b0a){return db['sequelize'][_0x6326('0x56')](function(_0xf912fe){return _0x5d4b0a[_0x6326('0x85')](_0x22c60d,{'transaction':_0xf912fe})['then'](function(){return BPromise[_0x6326('0x86')](_0x26f784,function(_0x464914){return db[_0x6326('0x87')]['upsert']({'TeamId':_0x464914['id'],'VoicePrefixId':_0x50d766[_0x6326('0x51')]['id']},{'transaction':_0xf912fe});});})['then'](function(){return BPromise[_0x6326('0x86')](_0x2a9f5c,function(_0x5a7b49){return db[_0x6326('0x88')][_0x6326('0x89')]({'where':{'UserId':_0x5a7b49['id'],'VoicePrefixId':_0x50d766['params']['id']},'transaction':_0xf912fe});});})[_0x6326('0x2d')](function(){_0x2a9f5c[_0x6326('0x8a')](function(_0x38d8c8){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':_0x38d8c8['id'],'VoicePrefixId':_0x5d4b0a['id']});});});});});}})[_0x6326('0x2d')](respondWithStatusCode(_0x4f45a6,null))[_0x6326('0x4f')](handleError(_0x4f45a6,null));};exports[_0x6326('0x8b')]=function(_0x43dc1e,_0x26ea69,_0x1a4b94){return db[_0x6326('0x82')][_0x6326('0x4d')]({'where':{'id':_0x43dc1e['query'][_0x6326('0x79')]},'attributes':['id'],'include':[{'model':db[_0x6326('0x7e')],'as':_0x6326('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26ea69,null))['then'](function(_0x489226){var _0x5db6b3=_[_0x6326('0x34')](_0x489226,'id');var _0x5135df=[];var _0x4c15d2=[];var _0xd9c385=squel['select']();_0xd9c385['field'](_0x6326('0x8c'))['from'](_0x6326('0x8d'),'tq')[_0x6326('0x8e')](_0x6326('0x8f'),'ut',_0x6326('0x90'))[_0x6326('0x45')](_0x6326('0x91'),_0x43dc1e[_0x6326('0x51')]['id']);for(var _0x26391c=0x0;_0x26391c<_0x489226[_0x6326('0x40')];_0x26391c+=0x1){let _0x1adcbc=_0x489226[_0x26391c];for(var _0x46bece=0x0;_0x46bece<_0x1adcbc[_0x6326('0x84')][_0x6326('0x40')];_0x46bece+=0x1){let _0x30d31a=_0x1adcbc[_0x6326('0x84')][_0x46bece];var _0x3ec241=_0xd9c385[_0x6326('0x92')]();_0x3ec241[_0x6326('0x45')](_0x6326('0x93'),_0x30d31a['id']);_0x4c15d2[_0x6326('0x6c')](db['sequelize'][_0x6326('0x3b')](_0x3ec241[_0x6326('0x94')](),{'type':db[_0x6326('0x95')][_0x6326('0x96')][_0x6326('0x97')]})[_0x6326('0x2d')](function(_0x292657){if(_0x292657[_0x6326('0x40')]===0x1){return _0x30d31a['id'];}else{var _0x909cce=_[_0x6326('0x98')](_['map'](_0x292657,_0x6326('0x99')),function(_0x4b493a){return _[_0x6326('0x9a')](_0x5db6b3,_0x4b493a);});if(_0x909cce){return _0x30d31a['id'];}}}));}}return BPromise[_0x6326('0x9b')](_0x4c15d2)['then'](function(_0x2b98a4){_0x5135df=_(_0x5135df)[_0x6326('0x9c')](_0x2b98a4)['compact']()['value']();return db[_0x6326('0x35')]['find']({'where':{'id':_0x43dc1e[_0x6326('0x51')]['id']}})['then'](function(_0x4a470e){return db[_0x6326('0x95')][_0x6326('0x56')](function(_0x298a11){return _0x4a470e[_0x6326('0x8b')](_0x43dc1e[_0x6326('0x3b')][_0x6326('0x79')],{'transaction':_0x298a11})[_0x6326('0x2d')](function(){if(!_['isEmpty'](_0x5135df)){return _0x4a470e['removeAgents'](_0x5135df,{'transaction':_0x298a11});}})[_0x6326('0x2d')](function(){_0x5135df[_0x6326('0x8a')](function(_0x42d1db){socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':_0x42d1db,'VoicePrefixId':_0x4a470e['id']});});});});});});})['then'](respondWithStatusCode(_0x26ea69,null))[_0x6326('0x4f')](handleError(_0x26ea69,null));}; \ No newline at end of file +var _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0x49dd26,_0x9e5a5d){var _0x45f549=function(_0x8a8d93){while(--_0x8a8d93){_0x49dd26['push'](_0x49dd26['shift']());}};_0x45f549(++_0x9e5a5d);}(_0x4888,0x198));var _0x8488=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0x4888[_0x185063];return _0x16d9d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2698817..103c4b2 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 _0xe497=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xe497,0x17b));var _0x7e49=function(_0x4ddfc0,_0x2447b5){_0x4ddfc0=_0x4ddfc0-0x0;var _0x1ff2de=_0xe497[_0x4ddfc0];return _0x1ff2de;};'use strict';var EventEmitter=require(_0x7e49('0x0'));var VoicePrefix=require(_0x7e49('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7e49('0x2')](0x0);var events={'afterCreate':_0x7e49('0x3'),'afterUpdate':_0x7e49('0x4'),'afterDestroy':_0x7e49('0x5')};function emitEvent(_0x218541){return function(_0x29074c,_0x215984,_0xcfc4db){VoicePrefixEvents['emit'](_0x218541+':'+_0x29074c['id'],_0x29074c);VoicePrefixEvents[_0x7e49('0x6')](_0x218541,_0x29074c);_0xcfc4db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7e49('0x7')](e,emitEvent(event));}}module[_0x7e49('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x1d8a=['events','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1d8a,0x117));var _0xa1d8=function(_0x590a94,_0x61e61){_0x590a94=_0x590a94-0x0;var _0x865e8=_0x1d8a[_0x590a94];return _0x865e8;};'use strict';var EventEmitter=require(_0xa1d8('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xa1d8('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa1d8('0x2')](0x0);var events={'afterCreate':_0xa1d8('0x3'),'afterUpdate':_0xa1d8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x550ea7){return function(_0x3ca371,_0x3a3251,_0x214dd0){VoicePrefixEvents[_0xa1d8('0x5')](_0x550ea7+':'+_0x3ca371['id'],_0x3ca371);VoicePrefixEvents[_0xa1d8('0x5')](_0x550ea7,_0x3ca371);_0x214dd0(null);};}for(var e in events){if(events[_0xa1d8('0x6')](e)){var event=events[e];VoicePrefix[_0xa1d8('0x7')](e,emitEvent(event));}}module[_0xa1d8('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ccd02a6..a19cff7 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 _0x59f4=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x59f4,0x99));var _0x459f=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x59f4[_0x290fa6];return _0x47f1f3;};'use strict';var _=require(_0x459f('0x0'));var util=require(_0x459f('0x1'));var logger=require(_0x459f('0x2'))(_0x459f('0x3'));var moment=require(_0x459f('0x4'));var BPromise=require(_0x459f('0x5'));var rp=require(_0x459f('0x6'));var fs=require('fs');var path=require(_0x459f('0x7'));var rimraf=require(_0x459f('0x8'));var config=require(_0x459f('0x9'));var attributes=require(_0x459f('0xa'));module[_0x459f('0xb')]=function(_0xb4795f,_0x18dd77){return _0xb4795f[_0x459f('0xc')](_0x459f('0xd'),attributes,{'tableName':_0x459f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61bc=['voice_prefixes','lodash','util','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoicePrefix'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x61bc,0x1d7));var _0xc61b=function(_0x4a00a8,_0x487794){_0x4a00a8=_0x4a00a8-0x0;var _0x5d46d3=_0x61bc[_0x4a00a8];return _0x5d46d3;};'use strict';var _=require(_0xc61b('0x0'));var util=require(_0xc61b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc61b('0x2'));var rp=require(_0xc61b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc61b('0x4'));var config=require(_0xc61b('0x5'));var attributes=require('./voicePrefix.attributes');module[_0xc61b('0x6')]=function(_0x48797c,_0x184dc3){return _0x48797c[_0xc61b('0x7')](_0xc61b('0x8'),attributes,{'tableName':_0xc61b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 364734d..debff99 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 _0x3cb7=['http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x472ded,_0x7b9b67){var _0x4cdf81=function(_0xb56ef){while(--_0xb56ef){_0x472ded['push'](_0x472ded['shift']());}};_0x4cdf81(++_0x7b9b67);}(_0x3cb7,0xcf));var _0x73cb=function(_0x4eb3ec,_0x51b871){_0x4eb3ec=_0x4eb3ec-0x0;var _0x1a3de8=_0x3cb7[_0x4eb3ec];return _0x1a3de8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});config[_0x73cb('0xa')]=_[_0x73cb('0xb')](config[_0x73cb('0xa')],{'host':_0x73cb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73cb('0xa')]));require(_0x73cb('0xd'))[_0x73cb('0xe')](socket);function respondWithRpcPromise(_0x29deae,_0x1826dd,_0xc1a63e){return new BPromise(function(_0x43eab2,_0x501542){return client[_0x73cb('0xf')](_0x29deae,_0xc1a63e)[_0x73cb('0x10')](function(_0x35900e){logger[_0x73cb('0x11')](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));logger['debug'](_0x73cb('0x14'),_0x1826dd,_0x73cb('0x13'),JSON[_0x73cb('0x15')](_0x35900e));if(_0x35900e[_0x73cb('0x16')]){if(_0x35900e[_0x73cb('0x16')][_0x73cb('0x17')]===0x1f4){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x501542(_0x35900e['error']['message']);}logger['error'](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x43eab2(_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);}else{logger['info'](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));_0x43eab2(_0x35900e[_0x73cb('0x19')][_0x73cb('0x18')]);}})[_0x73cb('0x1a')](function(_0x28ee3b){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x28ee3b);_0x501542(_0x28ee3b);});});} \ No newline at end of file +var _0x62f1=['register','request','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x518d6a,_0x5a0164){var _0x58446b=function(_0x4c4ab6){while(--_0x4c4ab6){_0x518d6a['push'](_0x518d6a['shift']());}};_0x58446b(++_0x5a0164);}(_0x62f1,0x112));var _0x162f=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0x62f1[_0x332d5c];return _0x47448d;};'use strict';var _=require(_0x162f('0x0'));var util=require('util');var moment=require(_0x162f('0x1'));var BPromise=require(_0x162f('0x2'));var rs=require(_0x162f('0x3'));var fs=require('fs');var Redis=require(_0x162f('0x4'));var db=require(_0x162f('0x5'))['db'];var utils=require(_0x162f('0x6'));var logger=require(_0x162f('0x7'))(_0x162f('0x8'));var config=require(_0x162f('0x9'));var jayson=require(_0x162f('0xa'));var client=jayson['client'][_0x162f('0xb')]({'port':0x232a});config[_0x162f('0xc')]=_['defaults'](config[_0x162f('0xc')],{'host':_0x162f('0xd'),'port':0x18eb});var socket=require(_0x162f('0xe'))(new Redis(config['redis']));require(_0x162f('0xf'))[_0x162f('0x10')](socket);function respondWithRpcPromise(_0x16938e,_0x2107d1,_0x54c970){return new BPromise(function(_0x1eeef3,_0x14aaa6){return client[_0x162f('0x11')](_0x16938e,_0x54c970)['then'](function(_0x577238){logger['info'](_0x162f('0x12'),_0x2107d1,'request\x20sent');logger[_0x162f('0x13')](_0x162f('0x14'),_0x2107d1,_0x162f('0x15'),JSON[_0x162f('0x16')](_0x577238));if(_0x577238['error']){if(_0x577238[_0x162f('0x17')][_0x162f('0x18')]===0x1f4){logger[_0x162f('0x17')](_0x162f('0x12'),_0x2107d1,_0x577238['error'][_0x162f('0x19')]);return _0x14aaa6(_0x577238['error'][_0x162f('0x19')]);}logger[_0x162f('0x17')](_0x162f('0x12'),_0x2107d1,_0x577238[_0x162f('0x17')]['message']);return _0x1eeef3(_0x577238['error'][_0x162f('0x19')]);}else{logger[_0x162f('0x1a')](_0x162f('0x12'),_0x2107d1,_0x162f('0x15'));_0x1eeef3(_0x577238[_0x162f('0x1b')][_0x162f('0x19')]);}})[_0x162f('0x1c')](function(_0x5723f3){logger[_0x162f('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2107d1,_0x5723f3);_0x14aaa6(_0x5723f3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0c5b938..d0205bf 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 _0x4198=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x182095,_0x39aa0c){var _0x579570=function(_0x1e0205){while(--_0x1e0205){_0x182095['push'](_0x182095['shift']());}};_0x579570(++_0x39aa0c);}(_0x4198,0x69));var _0x8419=function(_0xde8c8a,_0x4234c8){_0xde8c8a=_0xde8c8a-0x0;var _0xfa2dde=_0x4198[_0xde8c8a];return _0xfa2dde;};'use strict';var VoicePrefixEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){VoicePrefixEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);VoicePrefixEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file +var _0x31c2=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','update'];(function(_0x41a4bb,_0x36b115){var _0x4d4239=function(_0x572b5c){while(--_0x572b5c){_0x41a4bb['push'](_0x41a4bb['shift']());}};_0x4d4239(++_0x36b115);}(_0x31c2,0x98));var _0x231c=function(_0x2c2b51,_0x570fb8){_0x2c2b51=_0x2c2b51-0x0;var _0x5a8220=_0x31c2[_0x2c2b51];return _0x5a8220;};'use strict';var VoicePrefixEvents=require(_0x231c('0x0'));var events=['save','remove',_0x231c('0x1')];function createListener(_0x1426bb,_0x4bcfa6){return function(_0x2f0b2c){_0x4bcfa6[_0x231c('0x2')](_0x1426bb,_0x2f0b2c);};}function removeListener(_0x396f04,_0xe1bfea){return function(){VoicePrefixEvents[_0x231c('0x3')](_0x396f04,_0xe1bfea);};}exports[_0x231c('0x4')]=function(_0x21b4df){for(var _0x4442b9=0x0,_0x5afc76=events[_0x231c('0x5')];_0x4442b9<_0x5afc76;_0x4442b9++){var _0x4fd8b8=events[_0x4442b9];var _0x3dfccb=createListener(_0x231c('0x6')+_0x4fd8b8,_0x21b4df);VoicePrefixEvents['on'](_0x4fd8b8,_0x3dfccb);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7bdf265..f7d4af2 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xf8195c,_0x35c404){var _0x259b88=function(_0x432c20){while(--_0x432c20){_0xf8195c['push'](_0xf8195c['shift']());}};_0x259b88(++_0x35c404);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x537239,_0xb22eac){var _0xf787ce=function(_0x3021f6){while(--_0x3021f6){_0x537239['push'](_0x537239['shift']());}};_0xf787ce(++_0xb22eac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ce875d5..6b94c97 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 _0x171d=['BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','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.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty'];(function(_0x1e4166,_0x1abeec){var _0x22fef1=function(_0x3c587b){while(--_0x3c587b){_0x1e4166['push'](_0x1e4166['shift']());}};_0x22fef1(++_0x1abeec);}(_0x171d,0x1cc));var _0xd171=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x171d[_0x58efa6];return _0x5d643c;};'use strict';var Sequelize=require(_0xd171('0x0'));module[_0xd171('0x1')]={'name':{'type':Sequelize[_0xd171('0x2')],'allowNull':![],'unique':_0xd171('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x5'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xd171('0x6')},'announce':{'type':Sequelize[_0xd171('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd171('0x4')]('rr',_0xd171('0x7'),'leastrecent',_0xd171('0x8'),_0xd171('0x9'),_0xd171('0xa'),_0xd171('0xb'),_0xd171('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0xd171('0x7'),'set':function(_0x24d380){this[_0xd171('0xd')](_0xd171('0xe'),_0x24d380?_0x24d380:_0xd171('0xa'));},'get':function(){var _0x4ab62f=this[_0xd171('0xf')](_0xd171('0x10'));var _0x76d53e=this['getDataValue'](_0xd171('0x11'));var _0x59865c=this[_0xd171('0xf')]('strategy');if(_0x4ab62f===_0xd171('0x5')){return _0x59865c;}if(_0x76d53e===_0xd171('0x12')&&_0x59865c===_0xd171('0xa')||_0x76d53e===_0xd171('0x12')&&_0x59865c===_0xd171('0x13')){return _0x59865c;}if(_0x76d53e===_0xd171('0x14')||_0x76d53e==='predictive'||_0x76d53e===_0xd171('0x15')){return _0x59865c;}return null;}},'servicelevel':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd171('0x16')](0xb)},'timeout':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd171('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':_0xd171('0x17')},'autopause':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no',_0xd171('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd171('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd171('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd171('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xd171('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd171('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':_0xd171('0x17')},'announce_holdtime':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no',_0xd171('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd171('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xd171('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd171('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd171('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd171('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd171('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xd171('0x2')]},'queue_less_than':{'type':Sequelize[_0xd171('0x2')]},'periodic_announce':{'type':Sequelize[_0xd171('0x1a')],'set':function(_0x3b3252){this['setDataValue']('periodic_announce',_0x3b3252?_0x3b3252[_0xd171('0x1b')](','):[]);},'get':function(){return this[_0xd171('0xf')]('periodic_announce')?this['getDataValue'](_0xd171('0x1c'))[_0xd171('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xd171('0x2')],'defaultValue':_0xd171('0x17'),'set':function(_0x5e8248){this[_0xd171('0xd')](_0xd171('0x1e'),_0x5e8248?_0x5e8248[_0xd171('0x1b')](','):undefined);},'get':function(){return this[_0xd171('0xf')](_0xd171('0x1e'))?this[_0xd171('0xf')]('joinempty')[_0xd171('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd171('0x2')],'defaultValue':'no','set':function(_0x22653b){this['setDataValue'](_0xd171('0x1f'),_0x22653b?_0x22653b[_0xd171('0x1b')](','):undefined);},'get':function(){return this[_0xd171('0xf')](_0xd171('0x1f'))?this[_0xd171('0xf')](_0xd171('0x1f'))[_0xd171('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd171('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd171('0x2')]},'description':{'type':Sequelize[_0xd171('0x2')]},'acw':{'type':Sequelize[_0xd171('0x20')],'defaultValue':0x0,'set':function(_0x133874){this[_0xd171('0xd')](_0xd171('0x21'),_0x133874);if(_0x133874){if(this[_0xd171('0xf')]('wrapuptime')<0x2){this[_0xd171('0xd')](_0xd171('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd171('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd171('0x20')],'defaultValue':0x0,'comment':_0xd171('0x23')},'dialMethod':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x24'),_0xd171('0x14'),_0xd171('0x15'),'predictive',_0xd171('0x12')),'defaultValue':_0xd171('0x14'),'comment':_0xd171('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xd171('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd171('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xd171('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd171('0x28')},'dialPowerLevel':{'type':Sequelize[_0xd171('0x29')](0x2)[_0xd171('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd171('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xd171('0x4')](_0xd171('0x2b'),_0xd171('0x2c')),'defaultValue':_0xd171('0x2c'),'comment':_0xd171('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd171('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd171('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xd171('0x2')],'defaultValue':_0xd171('0x2f'),'comment':_0xd171('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xd171('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xd171('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0x3,'comment':_0xd171('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd171('0x38')},'dialTimezone':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd171('0x2')],'defaultValue':_0xd171('0x39')},'dialPrefix':{'type':Sequelize[_0xd171('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xd171('0x3a'),'never',_0xd171('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd171('0x20')],'defaultValue':0x0,'comment':_0xd171('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0xd171('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd171('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd171('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd171('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd171('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd171('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd171('0x16')](0x9)[_0xd171('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd171('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd171('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd171('0x43')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd171('0x44'),_0xd171('0x45')),'defaultValue':_0xd171('0x44')},'dialQueueProject2':{'type':Sequelize[_0xd171('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd171('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd171('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd171('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd171('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd171('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd171('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd171('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd171('0x16')],'allowNull':!![],'comment':_0xd171('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xd171('0x20')],'defaultValue':![],'comment':_0xd171('0x4f'),'set':function(_0x4987cd){if(!_0x4987cd)this['setDataValue'](_0xd171('0x50'),null);this[_0xd171('0xd')](_0xd171('0x51'),_0x4987cd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd171('0x16')](0x3)[_0xd171('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd171('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xd171('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8e7d=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','outbound','STRING','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\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)','07:00-22:00,*,*,*','never','always','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0xb6662c,_0x24a09d){var _0x199011=function(_0x246583){while(--_0x246583){_0xb6662c['push'](_0xb6662c['shift']());}};_0x199011(++_0x24a09d);}(_0x8e7d,0xa6));var _0xd8e7=function(_0x354afe,_0x2a46aa){_0x354afe=_0x354afe-0x0;var _0x21442f=_0x8e7d[_0x354afe];return _0x21442f;};'use strict';var Sequelize=require(_0xd8e7('0x0'));module[_0xd8e7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd8e7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x4'),_0xd8e7('0x5')),'allowNull':![],'defaultValue':_0xd8e7('0x4')},'musiconhold':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd8e7('0x3')]('rr',_0xd8e7('0x7'),_0xd8e7('0x8'),_0xd8e7('0x9'),_0xd8e7('0xa'),'rrmemory',_0xd8e7('0xb'),_0xd8e7('0xc'),_0xd8e7('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x24f00c){this[_0xd8e7('0xe')](_0xd8e7('0xf'),_0x24f00c?_0x24f00c:_0xd8e7('0x10'));},'get':function(){var _0x2b373a=this[_0xd8e7('0x11')](_0xd8e7('0x12'));var _0x991024=this['getDataValue'](_0xd8e7('0x13'));var _0x59f086=this[_0xd8e7('0x11')]('strategy');if(_0x2b373a===_0xd8e7('0x4')){return _0x59f086;}if(_0x991024==='booked'&&_0x59f086===_0xd8e7('0x10')||_0x991024===_0xd8e7('0x14')&&_0x59f086===_0xd8e7('0x15')){return _0x59f086;}if(_0x991024===_0xd8e7('0x16')||_0x991024===_0xd8e7('0x17')||_0x991024===_0xd8e7('0x18')){return _0x59f086;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd8e7('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no',_0xd8e7('0x1b')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd8e7('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd8e7('0x3')]('yes','no'),'defaultValue':_0xd8e7('0x1a')},'announce_holdtime':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xd8e7('0x1a'),'no')},'announce_position_limit':{'type':Sequelize[_0xd8e7('0x19')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd8e7('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd8e7('0x6')]},'queue_youarenext':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd8e7('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd8e7('0x6')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xd8e7('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0xd8e7('0x6')]},'queue_less_than':{'type':Sequelize[_0xd8e7('0x6')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x358b35){this[_0xd8e7('0xe')](_0xd8e7('0x1c'),_0x358b35?_0x358b35[_0xd8e7('0x1d')](','):[]);},'get':function(){return this[_0xd8e7('0x11')](_0xd8e7('0x1c'))?this['getDataValue'](_0xd8e7('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xd8e7('0x1a'),'set':function(_0x22ea38){this[_0xd8e7('0xe')](_0xd8e7('0x1e'),_0x22ea38?_0x22ea38[_0xd8e7('0x1d')](','):undefined);},'get':function(){return this[_0xd8e7('0x11')](_0xd8e7('0x1e'))?this[_0xd8e7('0x11')]('joinempty')[_0xd8e7('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x45a10d){this[_0xd8e7('0xe')](_0xd8e7('0x20'),_0x45a10d?_0x45a10d[_0xd8e7('0x1d')](','):undefined);},'get':function(){return this[_0xd8e7('0x11')]('leavewhenempty')?this['getDataValue']('leavewhenempty')[_0xd8e7('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd8e7('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x1a'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd8e7('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':0x0,'set':function(_0x32b3b5){this[_0xd8e7('0xe')](_0xd8e7('0x22'),_0x32b3b5);if(_0x32b3b5){if(this['getDataValue'](_0xd8e7('0x23'))<0x2){this[_0xd8e7('0xe')](_0xd8e7('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd8e7('0x19')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd8e7('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0xd8e7('0x25'),'progressive','power',_0xd8e7('0x17'),_0xd8e7('0x14')),'defaultValue':_0xd8e7('0x16'),'comment':_0xd8e7('0x26')},'dialLimitChannel':{'type':Sequelize[_0xd8e7('0x19')](0x4)[_0xd8e7('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd8e7('0x28')},'dialLimitQueue':{'type':Sequelize[_0xd8e7('0x19')](0x4)[_0xd8e7('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xd8e7('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd8e7('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xd8e7('0x3')](_0xd8e7('0x2b'),_0xd8e7('0x2c')),'defaultValue':'dropRate','comment':_0xd8e7('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd8e7('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd8e7('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0xd8e7('0x19')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd8e7('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd8e7('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd8e7('0x6')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x30')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xd8e7('0x31'),'comment':_0xd8e7('0x32')},'dialQueueTimeout':{'type':Sequelize[_0xd8e7('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x33')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xd8e7('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd8e7('0x19')](0x5)[_0xd8e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x36')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x37')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd8e7('0x19')](0x5)[_0xd8e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0x3,'comment':_0xd8e7('0x39')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd8e7('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x3a')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':_0xd8e7('0x3b')},'dialPrefix':{'type':Sequelize[_0xd8e7('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xd8e7('0x3')]('always',_0xd8e7('0x3c'),'onlyIfOpen'),'defaultValue':_0xd8e7('0x3d')},'dialAMDActive':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd8e7('0x19')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd8e7('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0xd8e7('0x19')](0x9)[_0xd8e7('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd8e7('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd8e7('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd8e7('0x19')](0x9)[_0xd8e7('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd8e7('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0xd8e7('0x19')](0x9)[_0xd8e7('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd8e7('0x19')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd8e7('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd8e7('0x19')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd8e7('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd8e7('0x19')](0x5)[_0xd8e7('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd8e7('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd8e7('0x19')](0x9)[_0xd8e7('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xd8e7('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd8e7('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':0x0,'comment':_0xd8e7('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd8e7('0x3')]('DESC','ASC'),'defaultValue':_0xd8e7('0x46')},'dialQueueProject2':{'type':Sequelize[_0xd8e7('0x6')],'comment':_0xd8e7('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8e7('0x47')},'dialCutDigit':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd8e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xd8e7('0x19')](0x5)[_0xd8e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x4c')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd8e7('0x19')](0x5)[_0xd8e7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8e7('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd8e7('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8e7('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8e7('0x19')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':![],'comment':_0xd8e7('0x50'),'set':function(_0x5d22c4){if(!_0x5d22c4)this[_0xd8e7('0xe')](_0xd8e7('0x51'),null);this[_0xd8e7('0xe')]('mandatoryDisposition',_0x5d22c4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd8e7('0x19')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xd8e7('0x19')](0x3)[_0xd8e7('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xd8e7('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 089933d..3d84aab 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 _0xed5c=['length','nolimit','order','sort','pick','where','merge','count','includeAll','include','VoiceQueue','rows','catch','show','params','create','body','role','user','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','SIP/%s','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','type','name','UserProfileResource','destroy','end','error','stack','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x527845,_0x526c4e){var _0x2187ba=function(_0x183888){while(--_0x183888){_0x527845['push'](_0x527845['shift']());}};_0x2187ba(++_0x526c4e);}(_0xed5c,0x81));var _0xced5=function(_0x7d76e3,_0x5850ea){_0x7d76e3=_0x7d76e3-0x0;var _0x32edb8=_0xed5c[_0x7d76e3];return _0x32edb8;};'use strict';var emlformat=require(_0xced5('0x0'));var rimraf=require(_0xced5('0x1'));var zipdir=require(_0xced5('0x2'));var jsonpatch=require(_0xced5('0x3'));var rp=require(_0xced5('0x4'));var moment=require(_0xced5('0x5'));var BPromise=require(_0xced5('0x6'));var Mustache=require(_0xced5('0x7'));var util=require(_0xced5('0x8'));var path=require(_0xced5('0x9'));var sox=require('sox');var csv=require(_0xced5('0xa'));var ejs=require(_0xced5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xced5('0xc'));var crypto=require(_0xced5('0xd'));var jsforce=require(_0xced5('0xe'));var deskjs=require(_0xced5('0xf'));var toCsv=require(_0xced5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xced5('0x10'));var authService=require(_0xced5('0x11'));var qs=require(_0xced5('0x12'));var as=require(_0xced5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced5('0x14'))('api');var utils=require(_0xced5('0x15'));var config=require(_0xced5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xced5('0x17'))['db'];config['redis']=_[_0xced5('0x18')](config[_0xced5('0x19')],{'host':_0xced5('0x1a'),'port':0x18eb});var socket=require(_0xced5('0x1b'))(new Redis(config[_0xced5('0x19')]));require(_0xced5('0x1c'))[_0xced5('0x1d')](socket);function respondWithStatusCode(_0x4bee02,_0x4b2533){_0x4b2533=_0x4b2533||0xcc;return function(_0x23ca09){if(_0x23ca09){return _0x4bee02[_0xced5('0x1e')](_0x4b2533);}return _0x4bee02[_0xced5('0x1f')](_0x4b2533)['end']();};}function respondWithResult(_0x4fa2a3,_0x456843){_0x456843=_0x456843||0xc8;return function(_0x1c8c90){if(_0x1c8c90){return _0x4fa2a3[_0xced5('0x1f')](_0x456843)[_0xced5('0x20')](_0x1c8c90);}};}function respondWithFilteredResult(_0x17e4eb,_0x13928f){return function(_0x54c5a4){if(_0x54c5a4){var _0x29a3ba=typeof _0x13928f[_0xced5('0x21')]==='undefined'&&typeof _0x13928f[_0xced5('0x22')]===_0xced5('0x23');var _0x14e3ec=_0x54c5a4['count'];var _0x127eb4=_0x29a3ba?0x0:_0x13928f[_0xced5('0x21')];var _0x2a5aca=_0x29a3ba?_0x54c5a4['count']:_0x13928f[_0xced5('0x21')]+_0x13928f[_0xced5('0x22')];var _0xf84ec;if(_0x2a5aca>=_0x14e3ec){_0x2a5aca=_0x14e3ec;_0xf84ec=0xc8;}else{_0xf84ec=0xce;}_0x17e4eb[_0xced5('0x1f')](_0xf84ec);return _0x17e4eb[_0xced5('0x24')](_0xced5('0x25'),_0x127eb4+'-'+_0x2a5aca+'/'+_0x14e3ec)['json'](_0x54c5a4);}return null;};}function patchUpdates(_0x1ba520){return function(_0x4a56a4){try{jsonpatch[_0xced5('0x26')](_0x4a56a4,_0x1ba520,!![]);}catch(_0x5b11c5){return BPromise[_0xced5('0x27')](_0x5b11c5);}return _0x4a56a4[_0xced5('0x28')]();};}function saveUpdates(_0x1c18e0,_0x45766f){return function(_0xe536f8){if(_0xe536f8){return _0xe536f8[_0xced5('0x29')](_0x1c18e0)[_0xced5('0x2a')](function(_0x2f092b){return _0x2f092b;});}return null;};}function removeEntity(_0x548cbb,_0x92ac47){return function(_0x4de26f){if(_0x4de26f){return _0x4de26f['destroy']()[_0xced5('0x2a')](function(){var _0x2cd6c4=_0x4de26f[_0xced5('0x2b')]({'plain':!![]});var _0x2e4774=[{'name':_0xced5('0x2c'),'value':_0xced5('0x2d'),'ignore':![]},{'name':_0xced5('0x2e'),'value':_0xced5('0x2f'),'ignore':![]}];var _0x239b32=_(_0x2e4774)[_0xced5('0x30')](_0xced5('0x31'))['map'](_0xced5('0x32'))[_0xced5('0x32')]();if(_['includes'](_0x239b32,_0x2cd6c4['type'])){return;}var _0x499040=_['find'](_0x2e4774,[_0xced5('0x32'),_0x2cd6c4[_0xced5('0x33')]])[_0xced5('0x34')];return db[_0xced5('0x35')][_0xced5('0x36')]({'where':{'type':_0x499040,'resourceId':_0x2cd6c4['id']}})['then'](function(){return _0x4de26f;});})[_0xced5('0x2a')](function(){_0x548cbb['status'](0xcc)[_0xced5('0x37')]();});}};}function handleEntityNotFound(_0x1fa141,_0x4d56c6){return function(_0x5d8f4f){if(!_0x5d8f4f){_0x1fa141[_0xced5('0x1e')](0x194);}return _0x5d8f4f;};}function handleError(_0x579b4a,_0x2faacb){_0x2faacb=_0x2faacb||0x1f4;return function(_0x3bd7d5){logger[_0xced5('0x38')](_0x3bd7d5[_0xced5('0x39')]);if(_0x3bd7d5[_0xced5('0x34')]){delete _0x3bd7d5[_0xced5('0x34')];}_0x579b4a[_0xced5('0x1f')](_0x2faacb)['send'](_0x3bd7d5);};}exports[_0xced5('0x3a')]=function(_0x213569,_0x5dca26){var _0x39fb2c={},_0x3ff95d={},_0x542afe={'count':0x0,'rows':[]};var _0x288ab0=_[_0xced5('0x3b')](db['VoiceQueue'][_0xced5('0x3c')],function(_0x4ea2fa){return{'name':_0x4ea2fa[_0xced5('0x3d')],'type':_0x4ea2fa['type'][_0xced5('0x3e')]};});_0x3ff95d[_0xced5('0x3f')]=_['map'](_0x288ab0,'name');_0x3ff95d[_0xced5('0x40')]=_[_0xced5('0x41')](_0x213569['query']);_0x3ff95d[_0xced5('0x42')]=_[_0xced5('0x43')](_0x3ff95d['model'],_0x3ff95d[_0xced5('0x40')]);_0x39fb2c[_0xced5('0x44')]=_[_0xced5('0x43')](_0x3ff95d['model'],qs[_0xced5('0x45')](_0x213569[_0xced5('0x40')][_0xced5('0x45')]));_0x39fb2c['attributes']=_0x39fb2c[_0xced5('0x44')][_0xced5('0x46')]?_0x39fb2c[_0xced5('0x44')]:_0x3ff95d['model'];if(!_0x213569[_0xced5('0x40')]['hasOwnProperty'](_0xced5('0x47'))){_0x39fb2c[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x213569[_0xced5('0x40')][_0xced5('0x22')]);_0x39fb2c[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x213569['query'][_0xced5('0x21')]);}_0x39fb2c[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x213569['query'][_0xced5('0x49')]);_0x39fb2c['where']=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x213569[_0xced5('0x40')],_0x3ff95d[_0xced5('0x42')]),_0x288ab0);if(_0x213569[_0xced5('0x40')][_0xced5('0x30')]){_0x39fb2c[_0xced5('0x4b')]=_['merge'](_0x39fb2c[_0xced5('0x4b')],{'$or':_['map'](_0x288ab0,function(_0x466e6a){if(_0x466e6a[_0xced5('0x33')]!=='VIRTUAL'){var _0x2f2a57={};_0x2f2a57[_0x466e6a[_0xced5('0x34')]]={'$like':'%'+_0x213569[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x2f2a57;}})});}_0x39fb2c=_[_0xced5('0x4c')]({},_0x39fb2c,_0x213569['options']);var _0x53636f={'where':_0x39fb2c[_0xced5('0x4b')]};return db['VoiceQueue'][_0xced5('0x4d')](_0x53636f)[_0xced5('0x2a')](function(_0xf38fab){_0x542afe[_0xced5('0x4d')]=_0xf38fab;if(_0x213569[_0xced5('0x40')][_0xced5('0x4e')]){_0x39fb2c[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x50')]['findAll'](_0x39fb2c);})['then'](function(_0x5c8a1c){_0x542afe[_0xced5('0x51')]=_0x5c8a1c;return _0x542afe;})[_0xced5('0x2a')](respondWithFilteredResult(_0x5dca26,_0x39fb2c))[_0xced5('0x52')](handleError(_0x5dca26,null));};exports[_0xced5('0x53')]=function(_0x1849b9,_0x1539a2){var _0xeb8839={'raw':![],'where':{'id':_0x1849b9[_0xced5('0x54')]['id']}},_0x1cab90={};_0x1cab90[_0xced5('0x3f')]=_[_0xced5('0x41')](db['VoiceQueue'][_0xced5('0x3c')]);_0x1cab90[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1849b9[_0xced5('0x40')]);_0x1cab90[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1cab90['model'],_0x1cab90[_0xced5('0x40')]);_0xeb8839[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1cab90[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x1849b9[_0xced5('0x40')][_0xced5('0x45')]));_0xeb8839[_0xced5('0x44')]=_0xeb8839['attributes'][_0xced5('0x46')]?_0xeb8839[_0xced5('0x44')]:_0x1cab90[_0xced5('0x3f')];if(_0x1849b9[_0xced5('0x40')][_0xced5('0x4e')]){_0xeb8839[_0xced5('0x4f')]=[{'all':!![]}];}_0xeb8839=_['merge']({},_0xeb8839,_0x1849b9['options']);return db[_0xced5('0x50')]['find'](_0xeb8839)[_0xced5('0x2a')](handleEntityNotFound(_0x1539a2,null))['then'](respondWithResult(_0x1539a2,null))[_0xced5('0x52')](handleError(_0x1539a2,null));};exports['create']=function(_0xbefa95,_0xfda45c){return db[_0xced5('0x50')][_0xced5('0x55')](_0xbefa95[_0xced5('0x56')],{})[_0xced5('0x2a')](function(_0xcb1ec1){var _0x3a958f=_0xbefa95['user'][_0xced5('0x2b')]({'plain':!![]});if(!_0x3a958f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a958f[_0xced5('0x57')]===_0xced5('0x58')){var _0x4a47bb=_0xcb1ec1[_0xced5('0x2b')]({'plain':!![]});var _0x50e559=[{'name':_0xced5('0x2c'),'value':_0xced5('0x2d')},{'name':_0xced5('0x2e'),'value':_0xced5('0x2f')}];var _0x590def=_[_0xced5('0x59')](_0x50e559,[_0xced5('0x32'),_0x4a47bb[_0xced5('0x33')]])[_0xced5('0x34')];return db[_0xced5('0x5a')]['find']({'where':{'name':_0x590def,'userProfileId':_0x3a958f[_0xced5('0x5b')]},'raw':!![]})[_0xced5('0x2a')](function(_0xd6315d){if(_0xd6315d&&_0xd6315d[_0xced5('0x5c')]===0x0){return db[_0xced5('0x35')][_0xced5('0x55')]({'name':_0x4a47bb[_0xced5('0x34')],'resourceId':_0x4a47bb['id'],'type':_0xd6315d[_0xced5('0x34')],'sectionId':_0xd6315d['id']},{})[_0xced5('0x2a')](function(){return _0xcb1ec1;});}else{return _0xcb1ec1;}})[_0xced5('0x52')](function(_0x442094){logger[_0xced5('0x38')](_0xced5('0x5d'),_0x442094);throw _0x442094;});}return _0xcb1ec1;})[_0xced5('0x2a')](respondWithResult(_0xfda45c,0xc9))[_0xced5('0x52')](handleError(_0xfda45c,null));};exports[_0xced5('0x5e')]=function(_0x8301b8,_0x4a6e1d){var _0x44cb19={'where':{'id':_0x8301b8[_0xced5('0x54')]['id']}},_0x11f019={};_0x11f019[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x50')]['rawAttributes']);_0x44cb19[_0xced5('0x44')]=_['intersection'](_0x11f019[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x8301b8[_0xced5('0x40')][_0xced5('0x45')]));_0x44cb19[_0xced5('0x44')]=_0x44cb19[_0xced5('0x44')]['length']?_0x44cb19[_0xced5('0x44')]:_0x11f019[_0xced5('0x3f')];if(_0x8301b8['query'][_0xced5('0x4e')]){_0x44cb19['include']=[{'all':!![]}];}_0x44cb19=_['merge']({},_0x44cb19,_0x8301b8[_0xced5('0x5f')]);return db[_0xced5('0x50')][_0xced5('0x59')](_0x44cb19)[_0xced5('0x2a')](handleEntityNotFound(_0x4a6e1d,null))['then'](function(_0x2259d2){if(_0x2259d2){var _0xea78be=_0x2259d2[_0xced5('0x2b')]({'plain':!![]});_0xea78be=qs['omit'](_0xea78be,['id',_0xced5('0x60'),_0xced5('0x61')]);_0x8301b8['body']=_['omit'](_0x8301b8[_0xced5('0x56')],['id',_0xced5('0x60'),'updatedAt']);return db['VoiceQueue'][_0xced5('0x55')](_[_0xced5('0x4c')](_0xea78be,_0x8301b8[_0xced5('0x56')]),{'include':_0x8301b8['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x426b3b){var _0x599327=_0x8301b8[_0xced5('0x58')][_0xced5('0x2b')]({'plain':!![]});if(!_0x599327)throw new Error(_0xced5('0x62'));if(_0x599327[_0xced5('0x57')]===_0xced5('0x58')){var _0x50d5fd=_0x426b3b[_0xced5('0x2b')]({'plain':!![]});var _0x448a33=[{'name':_0xced5('0x2c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xced5('0x2f')}];var _0x4dde63=_['find'](_0x448a33,[_0xced5('0x32'),_0x50d5fd['type']])[_0xced5('0x34')];return db['UserProfileSection'][_0xced5('0x59')]({'where':{'name':_0x4dde63,'userProfileId':_0x599327[_0xced5('0x5b')]},'raw':!![]})[_0xced5('0x2a')](function(_0x39a7f2){if(_0x39a7f2&&_0x39a7f2[_0xced5('0x5c')]===0x0){return db['UserProfileResource'][_0xced5('0x55')]({'name':_0x50d5fd[_0xced5('0x34')],'resourceId':_0x50d5fd['id'],'type':_0x39a7f2['name'],'sectionId':_0x39a7f2['id']},{})[_0xced5('0x2a')](function(){return _0x426b3b;});}else{return _0x426b3b;}})[_0xced5('0x52')](function(_0x546420){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x546420);throw _0x546420;});}return _0x426b3b;});}})[_0xced5('0x2a')](respondWithResult(_0x4a6e1d,0xc9))[_0xced5('0x52')](handleError(_0x4a6e1d,null));};exports[_0xced5('0x29')]=function(_0x3f202c,_0x248535){if(_0x3f202c[_0xced5('0x56')]['id']){delete _0x3f202c[_0xced5('0x56')]['id'];}return db[_0xced5('0x50')]['find']({'where':{'id':_0x3f202c[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x248535,null))[_0xced5('0x2a')](saveUpdates(_0x3f202c[_0xced5('0x56')],null))[_0xced5('0x2a')](respondWithResult(_0x248535,null))[_0xced5('0x52')](handleError(_0x248535,null));};exports[_0xced5('0x36')]=function(_0x425a1e,_0x474b1f){return db[_0xced5('0x50')]['find']({'where':{'id':_0x425a1e['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x474b1f,null))[_0xced5('0x2a')](removeEntity(_0x474b1f,null))[_0xced5('0x52')](handleError(_0x474b1f,null));};exports[_0xced5('0x63')]=function(_0x43abb9,_0x35a2d6,_0x5ed3bc){var _0x3dcfbc={'raw':![],'where':{}};var _0x216223={};var _0x451e90={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x43abb9['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x35a2d6,null))[_0xced5('0x2a')](function(_0x5d80d5){if(_0x5d80d5){_0x216223[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x65')][_0xced5('0x3c')]);_0x216223['query']=_[_0xced5('0x41')](_0x43abb9[_0xced5('0x40')]);_0x216223['filters']=_[_0xced5('0x43')](_0x216223[_0xced5('0x3f')],_0x216223[_0xced5('0x40')]);_0x3dcfbc[_0xced5('0x44')]=_[_0xced5('0x43')](_0x216223[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x43abb9[_0xced5('0x40')]['fields']));_0x3dcfbc[_0xced5('0x44')]=_0x3dcfbc[_0xced5('0x44')]['length']?_0x3dcfbc[_0xced5('0x44')]:_0x216223[_0xced5('0x3f')];if(!_0x43abb9['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x3dcfbc['limit']=qs[_0xced5('0x22')](_0x43abb9[_0xced5('0x40')]['limit']);_0x3dcfbc[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x43abb9[_0xced5('0x40')][_0xced5('0x21')]);}_0x3dcfbc[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x43abb9[_0xced5('0x40')][_0xced5('0x49')]);_0x3dcfbc[_0xced5('0x4b')]=qs['filters'](_[_0xced5('0x4a')](_0x43abb9[_0xced5('0x40')],_0x216223[_0xced5('0x42')]));_0x3dcfbc[_0xced5('0x4b')][_0xced5('0x67')]=_0x5d80d5['id'];if(_0x43abb9[_0xced5('0x40')][_0xced5('0x30')]){_0x3dcfbc[_0xced5('0x4b')]=_['merge'](_0x3dcfbc['where'],{'$or':_[_0xced5('0x3b')](_0x3dcfbc[_0xced5('0x44')],function(_0x38abe9){var _0x262d48={};_0x262d48[_0x38abe9]={'$like':'%'+_0x43abb9[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x262d48;})});}_0x3dcfbc=_[_0xced5('0x4c')]({},_0x3dcfbc,_0x43abb9['options']);return db['CmHopper'][_0xced5('0x4d')]({'where':_0x3dcfbc['where']})[_0xced5('0x2a')](function(_0x2f9ae5){_0x451e90[_0xced5('0x4d')]=_0x2f9ae5;if(_0x43abb9[_0xced5('0x40')]['includeAll']){_0x3dcfbc[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x65')]['findAll'](_0x3dcfbc);})[_0xced5('0x2a')](function(_0x4bb793){_0x451e90[_0xced5('0x51')]=_0x4bb793;return _0x451e90;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x35a2d6,_0x3dcfbc))[_0xced5('0x52')](handleError(_0x35a2d6,null));};exports['getHopperHistories']=function(_0x38512b,_0x59b8ca,_0xcf0652){var _0x5e9b3f={'raw':!![],'where':{}};var _0x426915={};var _0x4eeb79={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x38512b['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x59b8ca,null))[_0xced5('0x2a')](function(_0x33bd7e){if(_0x33bd7e){_0x426915[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x68')][_0xced5('0x3c')]);_0x426915[_0xced5('0x40')]=_[_0xced5('0x41')](_0x38512b['query']);_0x426915[_0xced5('0x42')]=_[_0xced5('0x43')](_0x426915[_0xced5('0x3f')],_0x426915[_0xced5('0x40')]);_0x5e9b3f[_0xced5('0x44')]=_[_0xced5('0x43')](_0x426915['model'],qs[_0xced5('0x45')](_0x38512b['query'][_0xced5('0x45')]));_0x5e9b3f[_0xced5('0x44')]=_0x5e9b3f[_0xced5('0x44')][_0xced5('0x46')]?_0x5e9b3f[_0xced5('0x44')]:_0x426915[_0xced5('0x3f')];if(!_0x38512b[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x5e9b3f[_0xced5('0x22')]=qs['limit'](_0x38512b['query'][_0xced5('0x22')]);_0x5e9b3f['offset']=qs[_0xced5('0x21')](_0x38512b['query']['offset']);}_0x5e9b3f[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x38512b[_0xced5('0x40')]['sort']);_0x5e9b3f[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x38512b[_0xced5('0x40')],_0x426915['filters']));_0x5e9b3f[_0xced5('0x4b')]['VoiceQueueId']=_0x33bd7e['id'];if(_0x38512b[_0xced5('0x40')]['filter']){_0x5e9b3f[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x5e9b3f[_0xced5('0x4b')],{'$or':_['map'](_0x5e9b3f['attributes'],function(_0x5fcbed){var _0x1f412a={};_0x1f412a[_0x5fcbed]={'$like':'%'+_0x38512b['query'][_0xced5('0x30')]+'%'};return _0x1f412a;})});}_0x5e9b3f=_[_0xced5('0x4c')]({},_0x5e9b3f,_0x38512b[_0xced5('0x5f')]);return db[_0xced5('0x68')][_0xced5('0x4d')]({'where':_0x5e9b3f[_0xced5('0x4b')]})[_0xced5('0x2a')](function(_0x247b1e){_0x4eeb79[_0xced5('0x4d')]=_0x247b1e;if(_0x38512b[_0xced5('0x40')][_0xced5('0x4e')]){_0x5e9b3f[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x68')][_0xced5('0x69')](_0x5e9b3f);})[_0xced5('0x2a')](function(_0x582ef4){_0x4eeb79[_0xced5('0x51')]=_0x582ef4;return _0x4eeb79;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x59b8ca,_0x5e9b3f))[_0xced5('0x52')](handleError(_0x59b8ca,null));};exports[_0xced5('0x6a')]=function(_0x1c9857,_0x289ae2,_0xe8e587){var _0xd6dcbd={'raw':!![],'where':{}};var _0x302405={};var _0x535f56={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x1c9857[_0xced5('0x54')]['id']}})['then'](handleEntityNotFound(_0x289ae2,null))[_0xced5('0x2a')](function(_0x3380bd){if(_0x3380bd){_0x302405[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x6b')][_0xced5('0x3c')]);_0x302405[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1c9857[_0xced5('0x40')]);_0x302405['filters']=_['intersection'](_0x302405[_0xced5('0x3f')],_0x302405['query']);_0xd6dcbd['attributes']=_[_0xced5('0x43')](_0x302405['model'],qs[_0xced5('0x45')](_0x1c9857['query'][_0xced5('0x45')]));_0xd6dcbd['attributes']=_0xd6dcbd['attributes'][_0xced5('0x46')]?_0xd6dcbd[_0xced5('0x44')]:_0x302405['model'];if(!_0x1c9857[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0xd6dcbd[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x1c9857[_0xced5('0x40')][_0xced5('0x22')]);_0xd6dcbd[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x1c9857[_0xced5('0x40')]['offset']);}_0xd6dcbd[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x1c9857[_0xced5('0x40')][_0xced5('0x49')]);_0xd6dcbd[_0xced5('0x4b')]=qs['filters'](_['pick'](_0x1c9857['query'],_0x302405[_0xced5('0x42')]));_0xd6dcbd['where'][_0xced5('0x67')]=_0x3380bd['id'];if(_0x1c9857['query']['filter']){_0xd6dcbd['where']=_[_0xced5('0x4c')](_0xd6dcbd['where'],{'$or':_['map'](_0xd6dcbd[_0xced5('0x44')],function(_0x31c1e1){var _0x5631a1={};_0x5631a1[_0x31c1e1]={'$like':'%'+_0x1c9857[_0xced5('0x40')]['filter']+'%'};return _0x5631a1;})});}_0xd6dcbd=_[_0xced5('0x4c')]({},_0xd6dcbd,_0x1c9857[_0xced5('0x5f')]);return db['CmHopperFinal'][_0xced5('0x4d')]({'where':_0xd6dcbd['where']})[_0xced5('0x2a')](function(_0x19753a){_0x535f56['count']=_0x19753a;if(_0x1c9857[_0xced5('0x40')][_0xced5('0x4e')]){_0xd6dcbd['include']=[{'all':!![]}];}return db[_0xced5('0x6b')]['findAll'](_0xd6dcbd);})[_0xced5('0x2a')](function(_0x482575){_0x535f56['rows']=_0x482575;return _0x535f56;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x289ae2,_0xd6dcbd))[_0xced5('0x52')](handleError(_0x289ae2,null));};exports['getHopperBlacks']=function(_0x1286d9,_0x44608e,_0x27ffad){var _0x7aac76={'raw':!![],'where':{}};var _0x31d78b={};var _0x206f87={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x1286d9[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x44608e,null))[_0xced5('0x2a')](function(_0x52f53a){if(_0x52f53a){_0x31d78b['model']=_[_0xced5('0x41')](db[_0xced5('0x6c')][_0xced5('0x3c')]);_0x31d78b[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1286d9['query']);_0x31d78b[_0xced5('0x42')]=_[_0xced5('0x43')](_0x31d78b[_0xced5('0x3f')],_0x31d78b['query']);_0x7aac76[_0xced5('0x44')]=_[_0xced5('0x43')](_0x31d78b[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x1286d9[_0xced5('0x40')][_0xced5('0x45')]));_0x7aac76[_0xced5('0x44')]=_0x7aac76['attributes'][_0xced5('0x46')]?_0x7aac76[_0xced5('0x44')]:_0x31d78b[_0xced5('0x3f')];if(!_0x1286d9[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x7aac76[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x1286d9['query'][_0xced5('0x22')]);_0x7aac76[_0xced5('0x21')]=qs['offset'](_0x1286d9[_0xced5('0x40')][_0xced5('0x21')]);}_0x7aac76[_0xced5('0x48')]=qs['sort'](_0x1286d9['query'][_0xced5('0x49')]);_0x7aac76[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x1286d9['query'],_0x31d78b[_0xced5('0x42')]));_0x7aac76['where'][_0xced5('0x67')]=_0x52f53a['id'];if(_0x1286d9['query']['filter']){_0x7aac76[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x7aac76[_0xced5('0x4b')],{'$or':_[_0xced5('0x3b')](_0x7aac76['attributes'],function(_0x541062){var _0x33646e={};_0x33646e[_0x541062]={'$like':'%'+_0x1286d9[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x33646e;})});}_0x7aac76=_[_0xced5('0x4c')]({},_0x7aac76,_0x1286d9[_0xced5('0x5f')]);return db[_0xced5('0x6c')][_0xced5('0x4d')]({'where':_0x7aac76[_0xced5('0x4b')]})[_0xced5('0x2a')](function(_0x13ad22){_0x206f87[_0xced5('0x4d')]=_0x13ad22;if(_0x1286d9['query'][_0xced5('0x4e')]){_0x7aac76[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x6c')]['findAll'](_0x7aac76);})[_0xced5('0x2a')](function(_0x4a5e13){_0x206f87['rows']=_0x4a5e13;return _0x206f87;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x44608e,_0x7aac76))[_0xced5('0x52')](handleError(_0x44608e,null));};exports[_0xced5('0x6d')]=function(_0x151721,_0x5dd260,_0x2845af){var _0x4ce63f={};var _0x35668a={};var _0x338639;var _0x25dbb9;return db[_0xced5('0x50')]['findOne']({'where':{'id':_0x151721[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x5dd260,null))['then'](function(_0x5c2a19){if(_0x5c2a19){_0x338639=_0x5c2a19;_0x35668a['model']=_[_0xced5('0x41')](db[_0xced5('0x6e')][_0xced5('0x3c')]);_0x35668a[_0xced5('0x40')]=_[_0xced5('0x41')](_0x151721[_0xced5('0x40')]);_0x35668a[_0xced5('0x42')]=_[_0xced5('0x43')](_0x35668a['model'],_0x35668a[_0xced5('0x40')]);_0x4ce63f[_0xced5('0x44')]=_[_0xced5('0x43')](_0x35668a[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x151721[_0xced5('0x40')]['fields']));_0x4ce63f[_0xced5('0x44')]=_0x4ce63f[_0xced5('0x44')]['length']?_0x4ce63f['attributes']:_0x35668a[_0xced5('0x3f')];_0x4ce63f['order']=qs['sort'](_0x151721[_0xced5('0x40')][_0xced5('0x49')]);_0x4ce63f[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x151721[_0xced5('0x40')],_0x35668a[_0xced5('0x42')]));if(_0x151721[_0xced5('0x40')]['filter']){_0x4ce63f[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x4ce63f['where'],{'$or':_[_0xced5('0x3b')](_0x4ce63f[_0xced5('0x44')],function(_0x4a8b34){var _0x51d710={};_0x51d710[_0x4a8b34]={'$like':'%'+_0x151721['query'][_0xced5('0x30')]+'%'};return _0x51d710;})});}_0x4ce63f=_[_0xced5('0x4c')]({},_0x4ce63f,_0x151721[_0xced5('0x5f')]);return _0x338639[_0xced5('0x6d')](_0x4ce63f);}})[_0xced5('0x2a')](function(_0x3bed24){if(_0x3bed24){_0x25dbb9=_0x3bed24[_0xced5('0x46')];if(!_0x151721['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x4ce63f[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x151721[_0xced5('0x40')][_0xced5('0x22')]);_0x4ce63f[_0xced5('0x21')]=qs['offset'](_0x151721[_0xced5('0x40')]['offset']);}return _0x338639['getTeams'](_0x4ce63f);}})[_0xced5('0x2a')](function(_0x44a238){if(_0x44a238){return _0x44a238?{'count':_0x25dbb9,'rows':_0x44a238}:null;}})[_0xced5('0x2a')](respondWithResult(_0x5dd260,null))[_0xced5('0x52')](handleError(_0x5dd260,null));};exports[_0xced5('0x6f')]=function(_0x40f724,_0x5e4e68,_0x512f23){var _0x573eb6=_0x40f724['body']['teams'];var _0x530bbc=_['map'](_0x573eb6,'id');return db[_0xced5('0x6e')]['findAll']({'where':{'id':_0x530bbc},'attributes':['id'],'include':[{'model':db[_0xced5('0x70')],'as':_0xced5('0x71'),'attributes':['id',_0xced5('0x34'),_0xced5('0x72'),'voicePause',_0xced5('0x73')],'raw':!![]}]})[_0xced5('0x2a')](function(_0x590f82){if(_0x590f82){var _0x575456=_[_0xced5('0x74')](_0x590f82,function(_0x1138b){var _0x973ffd=_0x1138b[_0xced5('0x2b')]({'plain':!![]});_0x973ffd[_0xced5('0x71')][_0xced5('0x75')](function(_0x37efb8){_0x37efb8['penalty']=_['find'](_0x573eb6,{'id':_0x973ffd['id']})[_0xced5('0x76')];});return _0x973ffd[_0xced5('0x71')];});return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x40f724[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](function(_0x2aa01c){return db[_0xced5('0x77')][_0xced5('0x78')](function(_0x52d75b){return _0x2aa01c['addTeams'](_0x530bbc,{'transaction':_0x52d75b})[_0xced5('0x2a')](function(){return BPromise[_0xced5('0x79')](_0x573eb6,function(_0x52d165){return db[_0xced5('0x7a')][_0xced5('0x7b')]({'TeamId':_0x52d165['id'],'VoiceQueueId':_0x40f724[_0xced5('0x54')]['id'],'penalty':_0x52d165[_0xced5('0x76')]},{'transaction':_0x52d75b});});})['then'](function(){return BPromise['each'](_0x575456,function(_0x1fb030){return db[_0xced5('0x7c')][_0xced5('0x7d')]({'where':{'UserId':_0x1fb030['id'],'VoiceQueueId':_0x40f724['params']['id']},'defaults':{'penalty':_0x1fb030[_0xced5('0x76')]},'transaction':_0x52d75b});});})['then'](function(){return BPromise[_0xced5('0x79')](_[_0xced5('0x30')](_0x575456,{'online':!![]}),function(_0x1ea70b){return db[_0xced5('0x7e')][_0xced5('0x7b')]({'membername':_0x1ea70b['name'],'UserId':_0x1ea70b['id'],'queue_name':_0x2aa01c[_0xced5('0x34')],'VoiceQueueId':_0x2aa01c['id'],'interface':_[_0xced5('0x7f')](_0x1ea70b[_0xced5('0x73')])?util[_0xced5('0x80')]('SIP/%s',_0x1ea70b['name']):_0x1ea70b[_0xced5('0x73')],'paused':_0x1ea70b[_0xced5('0x81')]||![],'penalty':_0x1ea70b[_0xced5('0x76')]},{'transaction':_0x52d75b});});})['then'](function(){_0x575456[_0xced5('0x75')](function(_0x42c06b){socket[_0xced5('0x82')](_0xced5('0x83'),{'UserId':_0x42c06b['id'],'VoiceQueueId':_0x2aa01c['id']});});});});});}})[_0xced5('0x2a')](respondWithStatusCode(_0x5e4e68,null))[_0xced5('0x52')](handleError(_0x5e4e68,null));};exports[_0xced5('0x84')]=function(_0x5cce35,_0x53b436,_0x3c8d00){return db[_0xced5('0x6e')][_0xced5('0x69')]({'where':{'id':_0x5cce35[_0xced5('0x40')][_0xced5('0x85')]},'attributes':['id'],'include':[{'model':db[_0xced5('0x70')],'as':_0xced5('0x71'),'attributes':['id'],'raw':!![]}]})[_0xced5('0x2a')](handleEntityNotFound(_0x53b436,null))[_0xced5('0x2a')](function(_0x5c0cc8){var _0x4fa3a0=_['map'](_0x5c0cc8,'id');var _0x15f48b=[];var _0x2e924f=[];var _0x2c698c=squel[_0xced5('0x86')]();_0x2c698c[_0xced5('0x87')](_0xced5('0x88'))[_0xced5('0x89')]('team_has_voice_queues','tq')[_0xced5('0x8a')](_0xced5('0x8b'),'ut',_0xced5('0x8c'))['where']('VoiceQueueId\x20=\x20?',_0x5cce35[_0xced5('0x54')]['id']);for(var _0x1cc673=0x0;_0x1cc673<_0x5c0cc8['length'];_0x1cc673+=0x1){let _0x4a755d=_0x5c0cc8[_0x1cc673];for(var _0x580ffb=0x0;_0x580ffb<_0x4a755d[_0xced5('0x71')][_0xced5('0x46')];_0x580ffb+=0x1){let _0x3de78a=_0x4a755d[_0xced5('0x71')][_0x580ffb];var _0x4cb9ca=_0x2c698c[_0xced5('0x5e')]();_0x4cb9ca[_0xced5('0x4b')]('ut.UserId\x20=\x20?',_0x3de78a['id']);_0x2e924f[_0xced5('0x8d')](db['sequelize']['query'](_0x4cb9ca['toString'](),{'type':db[_0xced5('0x77')][_0xced5('0x8e')]['SELECT']})[_0xced5('0x2a')](function(_0x2609a1){if(_0x2609a1['length']===0x1){return _0x3de78a['id'];}else{var _0x58d319=_[_0xced5('0x8f')](_[_0xced5('0x3b')](_0x2609a1,'TeamId'),function(_0x1afa96){return _[_0xced5('0x90')](_0x4fa3a0,_0x1afa96);});if(_0x58d319){return _0x3de78a['id'];}}}));}}return BPromise[_0xced5('0x91')](_0x2e924f)[_0xced5('0x2a')](function(_0x4c1e40){_0x15f48b=_(_0x15f48b)[_0xced5('0x92')](_0x4c1e40)[_0xced5('0x93')]()['value']();return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x5cce35['params']['id']}})[_0xced5('0x2a')](function(_0x20e3ca){return db[_0xced5('0x77')][_0xced5('0x78')](function(_0x335e8d){return _0x20e3ca[_0xced5('0x84')](_0x5cce35['query']['ids'],{'transaction':_0x335e8d})[_0xced5('0x2a')](function(){if(!_[_0xced5('0x94')](_0x15f48b)){return _0x20e3ca[_0xced5('0x95')](_0x15f48b,{'transaction':_0x335e8d})[_0xced5('0x2a')](function(){return db[_0xced5('0x7e')][_0xced5('0x36')]({'where':{'VoiceQueueId':_0x5cce35['params']['id'],'UserId':_0x15f48b},'transaction':_0x335e8d});});}})[_0xced5('0x2a')](function(){_0x15f48b[_0xced5('0x75')](function(_0x1a32a1){socket['emit'](_0xced5('0x96'),{'UserId':_0x1a32a1,'VoiceQueueId':_0x20e3ca['id']});});});});});});})['then'](respondWithStatusCode(_0x53b436,null))['catch'](handleError(_0x53b436,null));};exports['addAgents']=function(_0x14e5db,_0x2ac4d5,_0x30f57b){var _0x298cf8,_0x58522b;return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x14e5db['params']['id']}})['then'](handleEntityNotFound(_0x2ac4d5,null))['then'](function(_0x2690d7){if(_0x2690d7){_0x58522b=_0x2690d7;return _0x2690d7[_0xced5('0x97')](_0x14e5db[_0xced5('0x56')][_0xced5('0x85')],_[_0xced5('0x98')](_0x14e5db[_0xced5('0x56')],[_0xced5('0x85'),'id'])||{})[_0xced5('0x99')](function(_0x475083){for(var _0x28d57b=0x0;_0x28d57b<_0x14e5db['body'][_0xced5('0x85')][_0xced5('0x46')];_0x28d57b+=0x1){socket[_0xced5('0x82')](_0xced5('0x83'),{'UserId':Number(_0x14e5db[_0xced5('0x56')][_0xced5('0x85')][_0x28d57b]),'VoiceQueueId':Number(_0x14e5db[_0xced5('0x54')]['id'])});}return _0x475083;});}})[_0xced5('0x2a')](function(_0x25a584){_0x298cf8=_0x25a584||[];if(_0x58522b){return db['User']['findAll']({'where':{'id':_0x14e5db[_0xced5('0x56')][_0xced5('0x85')]},'attributes':['id',_0xced5('0x34'),_0xced5('0x72'),_0xced5('0x81'),_0xced5('0x73')],'raw':!![]});}})[_0xced5('0x2a')](function(_0x491fb7){if(!_[_0xced5('0x94')](_0x491fb7)){var _0x45a1d1=[];for(var _0x5e4dfe=0x0;_0x5e4dfe<_0x491fb7[_0xced5('0x46')];_0x5e4dfe++){if(_0x491fb7[_0x5e4dfe]['online']){_0x45a1d1['push'](db[_0xced5('0x7e')]['upsert']({'membername':_0x491fb7[_0x5e4dfe][_0xced5('0x34')],'UserId':_0x491fb7[_0x5e4dfe]['id'],'queue_name':_0x58522b[_0xced5('0x34')],'VoiceQueueId':_0x58522b['id'],'interface':_[_0xced5('0x7f')](_0x491fb7[_0x5e4dfe]['interface'])?util[_0xced5('0x80')](_0xced5('0x9a'),_0x491fb7[_0x5e4dfe][_0xced5('0x34')]):_0x491fb7[_0x5e4dfe][_0xced5('0x73')],'paused':_0x491fb7[_0x5e4dfe][_0xced5('0x81')]||![],'penalty':_0x14e5db[_0xced5('0x56')][_0xced5('0x76')]||0x0}));}}return BPromise['all'](_0x45a1d1);}})[_0xced5('0x2a')](function(){return _0x298cf8;})[_0xced5('0x2a')](respondWithResult(_0x2ac4d5,null))[_0xced5('0x52')](handleError(_0x2ac4d5,null));};exports[_0xced5('0x95')]=function(_0x46081c,_0x6d114f,_0x5545fb){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x46081c['params']['id']}})['then'](handleEntityNotFound(_0x6d114f,null))[_0xced5('0x2a')](function(_0x2a4bf1){if(_0x2a4bf1){return _0x2a4bf1['removeAgents'](_0x46081c['query'][_0xced5('0x85')])[_0xced5('0x2a')](function(){if(_[_0xced5('0x9b')](_0x46081c[_0xced5('0x40')][_0xced5('0x85')])){for(var _0x1bc1e4=0x0;_0x1bc1e4<_0x46081c[_0xced5('0x40')]['ids'][_0xced5('0x46')];_0x1bc1e4+=0x1){socket[_0xced5('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0x46081c[_0xced5('0x40')][_0xced5('0x85')][_0x1bc1e4]),'VoiceQueueId':Number(_0x46081c['params']['id'])});}}else{socket['emit'](_0xced5('0x96'),{'UserId':Number(_0x46081c[_0xced5('0x40')]['ids']),'VoiceQueueId':Number(_0x46081c['params']['id'])});}});}})['then'](function(_0x542f0d){return db['UserVoiceQueueRt'][_0xced5('0x36')]({'where':{'VoiceQueueId':_0x46081c[_0xced5('0x54')]['id'],'UserId':_0x46081c['query'][_0xced5('0x85')]}})[_0xced5('0x2a')](function(){return _0x542f0d;});})['then'](respondWithStatusCode(_0x6d114f,null))[_0xced5('0x52')](handleError(_0x6d114f,null));};exports[_0xced5('0x9c')]=function(_0x40429e,_0x4b3d25,_0x47134b){var _0x121ddc={};var _0x1d7b28={};var _0x2a2eaa;var _0x53d0d8;return db[_0xced5('0x50')]['findOne']({'where':{'id':_0x40429e[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x4b3d25,null))['then'](function(_0x17087c){if(_0x17087c){_0x2a2eaa=_0x17087c;_0x1d7b28[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x70')][_0xced5('0x3c')]);_0x1d7b28[_0xced5('0x40')]=_[_0xced5('0x41')](_0x40429e[_0xced5('0x40')]);_0x1d7b28[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1d7b28['model'],_0x1d7b28[_0xced5('0x40')]);_0x121ddc[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1d7b28[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x40429e['query']['fields']));_0x121ddc[_0xced5('0x44')]=_0x121ddc[_0xced5('0x44')][_0xced5('0x46')]?_0x121ddc[_0xced5('0x44')]:_0x1d7b28[_0xced5('0x3f')];_0x121ddc['order']=qs[_0xced5('0x49')](_0x40429e[_0xced5('0x40')]['sort']);_0x121ddc[_0xced5('0x4b')]=qs['filters'](_[_0xced5('0x4a')](_0x40429e[_0xced5('0x40')],_0x1d7b28[_0xced5('0x42')]));if(_0x40429e['query']['filter']){_0x121ddc[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x121ddc['where'],{'$or':_[_0xced5('0x3b')](_0x121ddc['attributes'],function(_0x2a1eb6){var _0x59c5cf={};_0x59c5cf[_0x2a1eb6]={'$like':'%'+_0x40429e['query'][_0xced5('0x30')]+'%'};return _0x59c5cf;})});}_0x121ddc=_[_0xced5('0x4c')]({},_0x121ddc,_0x40429e[_0xced5('0x5f')]);return _0x2a2eaa['getAgents'](_0x121ddc);}})[_0xced5('0x2a')](function(_0x206050){if(_0x206050){_0x53d0d8=_0x206050['length'];if(!_0x40429e[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x121ddc['limit']=qs[_0xced5('0x22')](_0x40429e[_0xced5('0x40')]['limit']);_0x121ddc[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x40429e[_0xced5('0x40')][_0xced5('0x21')]);}return _0x2a2eaa[_0xced5('0x9c')](_0x121ddc);}})[_0xced5('0x2a')](function(_0x211b7a){if(_0x211b7a){return _0x211b7a?{'count':_0x53d0d8,'rows':_0x211b7a}:null;}})[_0xced5('0x2a')](respondWithResult(_0x4b3d25,null))[_0xced5('0x52')](handleError(_0x4b3d25,null));};exports[_0xced5('0x9d')]=function(_0x435e14,_0x191fcb,_0x5487f4){var _0x47caa3={};var _0x1a2ab5={};var _0x28afb0;var _0x2b02f3;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x435e14[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x191fcb,null))[_0xced5('0x2a')](function(_0x18c67e){if(_0x18c67e){_0x28afb0=_0x18c67e;_0x1a2ab5[_0xced5('0x3f')]=_[_0xced5('0x41')](db['UserVoiceQueueRt'][_0xced5('0x3c')]);_0x1a2ab5['query']=_[_0xced5('0x41')](_0x435e14[_0xced5('0x40')]);_0x1a2ab5[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1a2ab5[_0xced5('0x3f')],_0x1a2ab5['query']);_0x47caa3[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1a2ab5[_0xced5('0x3f')],qs['fields'](_0x435e14[_0xced5('0x40')][_0xced5('0x45')]));_0x47caa3[_0xced5('0x44')]=_0x47caa3['attributes']['length']?_0x47caa3[_0xced5('0x44')]:_0x1a2ab5[_0xced5('0x3f')];_0x47caa3[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x435e14['query'][_0xced5('0x49')]);_0x47caa3['where']=qs[_0xced5('0x42')](_['pick'](_0x435e14[_0xced5('0x40')],_0x1a2ab5[_0xced5('0x42')]));if(_0x435e14[_0xced5('0x40')][_0xced5('0x30')]){_0x47caa3[_0xced5('0x4b')]=_['merge'](_0x47caa3[_0xced5('0x4b')],{'$or':_[_0xced5('0x3b')](_0x47caa3[_0xced5('0x44')],function(_0x56d82b){var _0x56b4f2={};_0x56b4f2[_0x56d82b]={'$like':'%'+_0x435e14[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x56b4f2;})});}_0x47caa3=_[_0xced5('0x4c')]({},_0x47caa3,_0x435e14['options']);return _0x28afb0[_0xced5('0x9d')](_0x47caa3);}})[_0xced5('0x2a')](function(_0x21d5d2){if(_0x21d5d2){_0x2b02f3=_0x21d5d2[_0xced5('0x46')];if(!_0x435e14[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x47caa3[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x435e14['query']['limit']);_0x47caa3[_0xced5('0x21')]=qs['offset'](_0x435e14[_0xced5('0x40')][_0xced5('0x21')]);}return _0x28afb0[_0xced5('0x9d')](_0x47caa3);}})[_0xced5('0x2a')](function(_0x15395e){return _0x15395e?{'count':_0x2b02f3,'rows':_0x15395e}:null;})[_0xced5('0x2a')](respondWithResult(_0x191fcb,null))[_0xced5('0x52')](handleError(_0x191fcb,null));};exports['getLists']=function(_0x319be2,_0x2a3438,_0x527753){var _0x251991={};var _0x4650da={};var _0x4a5fcb;var _0xbc24ca;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x319be2['params']['id']}})['then'](handleEntityNotFound(_0x2a3438,null))[_0xced5('0x2a')](function(_0x340608){if(_0x340608){_0x4a5fcb=_0x340608;_0x4650da[_0xced5('0x3f')]=_['keys'](db[_0xced5('0x9e')]['rawAttributes']);_0x4650da[_0xced5('0x40')]=_[_0xced5('0x41')](_0x319be2[_0xced5('0x40')]);_0x4650da[_0xced5('0x42')]=_['intersection'](_0x4650da['model'],_0x4650da[_0xced5('0x40')]);_0x251991[_0xced5('0x44')]=_[_0xced5('0x43')](_0x4650da['model'],qs[_0xced5('0x45')](_0x319be2[_0xced5('0x40')][_0xced5('0x45')]));_0x251991[_0xced5('0x44')]=_0x251991[_0xced5('0x44')][_0xced5('0x46')]?_0x251991[_0xced5('0x44')]:_0x4650da[_0xced5('0x3f')];_0x251991[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x319be2[_0xced5('0x40')][_0xced5('0x49')]);_0x251991[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x319be2[_0xced5('0x40')],_0x4650da['filters']));if(_0x319be2[_0xced5('0x40')]['filter']){_0x251991[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x251991[_0xced5('0x4b')],{'$or':_['map'](_0x251991[_0xced5('0x44')],function(_0xa93acf){var _0x126cf0={};_0x126cf0[_0xa93acf]={'$like':'%'+_0x319be2[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x126cf0;})});}_0x251991=_[_0xced5('0x4c')]({},_0x251991,_0x319be2[_0xced5('0x5f')]);return _0x4a5fcb['getLists'](_0x251991);}})[_0xced5('0x2a')](function(_0x1a185b){if(_0x1a185b){_0xbc24ca=_0x1a185b[_0xced5('0x46')];if(!_0x319be2['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x251991[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x319be2[_0xced5('0x40')][_0xced5('0x22')]);_0x251991[_0xced5('0x21')]=qs['offset'](_0x319be2[_0xced5('0x40')]['offset']);}return _0x4a5fcb[_0xced5('0x9f')](_0x251991);}})[_0xced5('0x2a')](function(_0x18ff11){if(_0x18ff11){return _0x18ff11?{'count':_0xbc24ca,'rows':_0x18ff11}:null;}})['then'](respondWithResult(_0x2a3438,null))[_0xced5('0x52')](handleError(_0x2a3438,null));};exports[_0xced5('0xa0')]=function(_0x2b4903,_0x539393,_0x26e288){var _0x45dd46=moment()[_0xced5('0x80')]('YYYY-MM-DD\x20HH:mm:ss');var _0xab1896,_0x31da3c;return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x2b4903[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x539393,null))[_0xced5('0x2a')](function(_0x165f87){if(_0x165f87){_0x31da3c=_0x165f87;return _0x165f87[_0xced5('0xa0')](_0x2b4903[_0xced5('0x56')]['ids'],_['omit'](_0x2b4903[_0xced5('0x56')],[_0xced5('0x85'),'id'])||{});}return null;})['spread'](function(_0x835dbb){var _0x15f489;_0xab1896=_0x835dbb||[];var _0x2e2e46=[];if(_0x835dbb){for(var _0x15ba88=0x0;_0x15ba88<_0x835dbb['length'];_0x15ba88+=0x1){var _0x1dea62=_0x835dbb[_0x15ba88][_0xced5('0x2b')]({'plain':!![]});_0x31da3c[_0xced5('0xa1')]=_0x2b4903[_0xced5('0x56')][_0xced5('0xa1')]?_0x2b4903[_0xced5('0x56')][_0xced5('0xa1')]:_0x31da3c[_0xced5('0xa1')];switch(_0x31da3c[_0xced5('0xa1')]){case _0xced5('0xa2'):_0x15f489=squel[_0xced5('0xa3')]()[_0xced5('0xa4')](_0xced5('0xa5'))[_0xced5('0xa6')](['phone',_0xced5('0xa7'),'ContactId',_0xced5('0xa8'),_0xced5('0x67'),'createdAt',_0xced5('0x61')],squel['select']()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id','ContactId')[_0xced5('0x87')](_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))[_0xced5('0x87')](_0x2b4903['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')](_0xced5('0xac'))[_0xced5('0x4b')](_0xced5('0xad'))[_0xced5('0x4b')]('ListId\x20=\x20?',_0x1dea62[_0xced5('0xaa')]['toString']())[_0xced5('0x4b')](_0xced5('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xaf'))[_0xced5('0x89')](_0xced5('0xb0'))['where'](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]()))['where'](_0xced5('0xb2'),squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xb3'))[_0xced5('0x89')](_0xced5('0xa5'))['where'](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]())))['toString']();break;case _0xced5('0xb4'):_0x15f489=squel[_0xced5('0xa3')]()[_0xced5('0xa4')]('cm_hopper')['fromQuery']([_0xced5('0xa9'),_0xced5('0xa7'),_0xced5('0xb5'),_0xced5('0xa8'),'VoiceQueueId','createdAt',_0xced5('0x61')],squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id',_0xced5('0xb5'))['field'](_0x1dea62['CmListId']['toString'](),'ListId')[_0xced5('0x87')](_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')]('cm_contacts')['where'](_0xced5('0xad'))[_0xced5('0x4b')](_0xced5('0xb6'),_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xced5('0x4b')](_0xced5('0xb2'),squel[_0xced5('0x86')]()['field']('COALESCE(phone,\x27\x27)')[_0xced5('0x89')](_0xced5('0xa5'))[_0xced5('0x4b')](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]())))['toString']();break;default:_0x15f489=squel[_0xced5('0xa3')]()['into'](_0xced5('0xa5'))[_0xced5('0xa6')]([_0xced5('0xa9'),'scheduledAt','ContactId',_0xced5('0xa8'),'VoiceQueueId',_0xced5('0x60'),_0xced5('0x61')],squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id',_0xced5('0xb5'))[_0xced5('0x87')](_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))['field'](_0x2b4903['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27','updatedAt')[_0xced5('0x89')]('cm_contacts')[_0xced5('0x4b')](_0xced5('0xad'))[_0xced5('0x4b')](_0xced5('0xb6'),_0x1dea62['CmListId'][_0xced5('0xab')]())['where'](_0xced5('0xae')))[_0xced5('0xab')]();}_0x2e2e46[_0xced5('0x8d')](db[_0xced5('0x77')][_0xced5('0x40')](_0x15f489));}return BPromise[_0xced5('0x91')](_0x2e2e46);}})['then'](function(){var _0x1799ce=[];var _0x4b1af1=squel['insert']()[_0xced5('0xa4')](_0xced5('0xb7'))[_0xced5('0xa6')]([_0xced5('0xb8'),_0xced5('0xa9'),_0xced5('0xb9'),_0xced5('0x60'),'updatedAt'],squel[_0xced5('0x86')]()['field'](_0xced5('0xba'))[_0xced5('0x87')]('ci.item')[_0xced5('0x87')](_0xced5('0xbb'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')](_0xced5('0xbc'),'ci')['join']('cm_hopper','h',_0xced5('0xbd'))[_0xced5('0x4b')](_0xced5('0xbe'),_0x45dd46)[_0xced5('0x4b')](_0xced5('0xbf'),_0xced5('0xc0')))['toString']();_0x1799ce[_0xced5('0x8d')](db[_0xced5('0x77')][_0xced5('0x40')](_0x4b1af1));return BPromise[_0xced5('0x91')](_0x1799ce);})[_0xced5('0x2a')](function(){return _0xab1896;})[_0xced5('0x2a')](respondWithResult(_0x539393,null))[_0xced5('0x52')](handleError(_0x539393,null));};exports['removeLists']=function(_0x460edc,_0x2b5b8b,_0x1dbbd5){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x460edc['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x2b5b8b,null))[_0xced5('0x2a')](function(_0x3b306b){if(_0x3b306b){return _0x3b306b[_0xced5('0xc1')](_0x460edc[_0xced5('0x40')]['ids']);}})[_0xced5('0x2a')](function(_0x455fb9){if(_0x455fb9){return db[_0xced5('0x65')]['destroy']({'where':{'ListId':_0x460edc['query'][_0xced5('0x85')],'VoiceQueueId':_0x460edc[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](function(){return _0x455fb9;});}})[_0xced5('0x2a')](respondWithStatusCode(_0x2b5b8b,null))[_0xced5('0x52')](handleError(_0x2b5b8b,null));};exports['getBlackLists']=function(_0x422629,_0x2ae75c,_0xdd023d){var _0x471af0={};var _0x2c82c6={};var _0xa03e29;var _0x207cfc;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x422629[_0xced5('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ae75c,null))[_0xced5('0x2a')](function(_0x2e9c49){if(_0x2e9c49){_0xa03e29=_0x2e9c49;_0x2c82c6['model']=_[_0xced5('0x41')](db[_0xced5('0x9e')][_0xced5('0x3c')]);_0x2c82c6[_0xced5('0x40')]=_[_0xced5('0x41')](_0x422629[_0xced5('0x40')]);_0x2c82c6['filters']=_[_0xced5('0x43')](_0x2c82c6[_0xced5('0x3f')],_0x2c82c6[_0xced5('0x40')]);_0x471af0[_0xced5('0x44')]=_[_0xced5('0x43')](_0x2c82c6[_0xced5('0x3f')],qs['fields'](_0x422629[_0xced5('0x40')]['fields']));_0x471af0[_0xced5('0x44')]=_0x471af0[_0xced5('0x44')][_0xced5('0x46')]?_0x471af0[_0xced5('0x44')]:_0x2c82c6[_0xced5('0x3f')];_0x471af0[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x422629['query'][_0xced5('0x49')]);_0x471af0['where']=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x422629['query'],_0x2c82c6[_0xced5('0x42')]));if(_0x422629['query'][_0xced5('0x30')]){_0x471af0[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x471af0['where'],{'$or':_['map'](_0x471af0[_0xced5('0x44')],function(_0x5d0b72){var _0x109cbd={};_0x109cbd[_0x5d0b72]={'$like':'%'+_0x422629[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x109cbd;})});}_0x471af0=_[_0xced5('0x4c')]({},_0x471af0,_0x422629[_0xced5('0x5f')]);return _0xa03e29[_0xced5('0xc2')](_0x471af0);}})[_0xced5('0x2a')](function(_0x4be1c5){if(_0x4be1c5){_0x207cfc=_0x4be1c5[_0xced5('0x46')];if(!_0x422629[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x471af0[_0xced5('0x22')]=qs['limit'](_0x422629[_0xced5('0x40')][_0xced5('0x22')]);_0x471af0[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x422629[_0xced5('0x40')]['offset']);}return _0xa03e29[_0xced5('0xc2')](_0x471af0);}})[_0xced5('0x2a')](function(_0x2b5cf7){if(_0x2b5cf7){return _0x2b5cf7?{'count':_0x207cfc,'rows':_0x2b5cf7}:null;}})[_0xced5('0x2a')](respondWithResult(_0x2ae75c,null))[_0xced5('0x52')](handleError(_0x2ae75c,null));};exports[_0xced5('0xc3')]=function(_0x5e07ef,_0x261063,_0xe68a26){var _0x3600c2,_0x515afc;return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x5e07ef[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x261063,null))[_0xced5('0x2a')](function(_0x215df1){if(_0x215df1){_0x515afc=_0x215df1;return _0x215df1[_0xced5('0xc3')](_0x5e07ef[_0xced5('0x56')][_0xced5('0x85')],_[_0xced5('0x98')](_0x5e07ef[_0xced5('0x56')],['ids','id'])||{});}return null;})[_0xced5('0x99')](function(_0x25277f){var _0x30e0fc;_0x3600c2=_0x25277f||[];var _0x269438=[];if(_0x25277f){for(var _0x5191c4=0x0;_0x5191c4<_0x25277f[_0xced5('0x46')];_0x5191c4+=0x1){var _0xc86886=_0x25277f[_0x5191c4][_0xced5('0x2b')]({'plain':!![]});_0x30e0fc=squel[_0xced5('0xa3')]()[_0xced5('0xa4')](_0xced5('0xc4'))[_0xced5('0xa6')]([_0xced5('0xa9'),_0xced5('0xb5'),_0xced5('0xa8'),_0xced5('0x67'),_0xced5('0x60'),_0xced5('0x61')],squel['select']()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))['field']('id','ContactId')['field'](_0xc86886[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))[_0xced5('0x87')](_0x5e07ef['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('NOW()',_0xced5('0x60'))['field'](_0xced5('0xc5'),'updatedAt')[_0xced5('0x89')](_0xced5('0xac'))[_0xced5('0x4b')]('deletedAt\x20IS\x20NULL')[_0xced5('0x4b')]('ListId\x20=\x20?',_0xc86886['CmListId'][_0xced5('0xab')]())[_0xced5('0x4b')](_0xced5('0xae')))[_0xced5('0xab')]();_0x269438[_0xced5('0x8d')](db['sequelize'][_0xced5('0x40')](_0x30e0fc));}return BPromise['all'](_0x269438);}})[_0xced5('0x2a')](function(){return _0x3600c2;})['then'](respondWithResult(_0x261063,null))['catch'](handleError(_0x261063,null));};exports[_0xced5('0xc6')]=function(_0x586f18,_0x1451dc,_0x2cb10d){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x586f18[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x1451dc,null))[_0xced5('0x2a')](function(_0x441118){if(_0x441118){return _0x441118[_0xced5('0xc6')](_0x586f18[_0xced5('0x40')][_0xced5('0x85')]);}})[_0xced5('0x2a')](function(_0x2b2da8){if(_0x2b2da8){return db[_0xced5('0x6c')][_0xced5('0x36')]({'where':{'ListId':_0x586f18['query']['ids'],'VoiceQueueId':_0x586f18['params']['id']}})[_0xced5('0x2a')](function(){return _0x2b2da8;});}})['then'](respondWithStatusCode(_0x1451dc,null))[_0xced5('0x52')](handleError(_0x1451dc,null));}; \ No newline at end of file +var _0xbdb9=['socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','end','error','index','VoiceQueue','rawAttributes','fieldName','model','keys','filters','intersection','fields','attributes','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','get','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','online','voicePause','interface','flatMap','Agents','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','ids','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','transaction','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','getMembers','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x58c995,_0x2c05b7){var _0x266cde=function(_0x5a68de){while(--_0x5a68de){_0x58c995['push'](_0x58c995['shift']());}};_0x266cde(++_0x2c05b7);}(_0xbdb9,0xac));var _0x9bdb=function(_0xc72ff1,_0x2f94ce){_0xc72ff1=_0xc72ff1-0x0;var _0x265bbc=_0xbdb9[_0xc72ff1];return _0x265bbc;};'use strict';var emlformat=require(_0x9bdb('0x0'));var rimraf=require(_0x9bdb('0x1'));var zipdir=require(_0x9bdb('0x2'));var jsonpatch=require(_0x9bdb('0x3'));var rp=require(_0x9bdb('0x4'));var moment=require('moment');var BPromise=require(_0x9bdb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9bdb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bdb('0x7'));var _=require('lodash');var squel=require(_0x9bdb('0x8'));var crypto=require(_0x9bdb('0x9'));var jsforce=require(_0x9bdb('0xa'));var deskjs=require(_0x9bdb('0xb'));var toCsv=require(_0x9bdb('0x6'));var querystring=require(_0x9bdb('0xc'));var Papa=require(_0x9bdb('0xd'));var Redis=require('ioredis');var authService=require(_0x9bdb('0xe'));var qs=require(_0x9bdb('0xf'));var as=require(_0x9bdb('0x10'));var hardwareService=require(_0x9bdb('0x11'));var logger=require(_0x9bdb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9bdb('0x13'));var licenseUtil=require(_0x9bdb('0x14'));var db=require(_0x9bdb('0x15'))['db'];config[_0x9bdb('0x16')]=_[_0x9bdb('0x17')](config[_0x9bdb('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bdb('0x18'))(new Redis(config[_0x9bdb('0x16')]));require(_0x9bdb('0x19'))[_0x9bdb('0x1a')](socket);function respondWithStatusCode(_0x17b647,_0x4af695){_0x4af695=_0x4af695||0xcc;return function(_0x1378e0){if(_0x1378e0){return _0x17b647[_0x9bdb('0x1b')](_0x4af695);}return _0x17b647[_0x9bdb('0x1c')](_0x4af695)['end']();};}function respondWithResult(_0x3d759e,_0xfc16a4){_0xfc16a4=_0xfc16a4||0xc8;return function(_0x1cb06d){if(_0x1cb06d){return _0x3d759e[_0x9bdb('0x1c')](_0xfc16a4)[_0x9bdb('0x1d')](_0x1cb06d);}};}function respondWithFilteredResult(_0x13c07b,_0xf5ca10){return function(_0x112d0f){if(_0x112d0f){var _0x1f4e49=typeof _0xf5ca10[_0x9bdb('0x1e')]==='undefined'&&typeof _0xf5ca10[_0x9bdb('0x1f')]===_0x9bdb('0x20');var _0x5204ba=_0x112d0f[_0x9bdb('0x21')];var _0x16a953=_0x1f4e49?0x0:_0xf5ca10[_0x9bdb('0x1e')];var _0x582a46=_0x1f4e49?_0x112d0f[_0x9bdb('0x21')]:_0xf5ca10[_0x9bdb('0x1e')]+_0xf5ca10[_0x9bdb('0x1f')];var _0x4da7a5;if(_0x582a46>=_0x5204ba){_0x582a46=_0x5204ba;_0x4da7a5=0xc8;}else{_0x4da7a5=0xce;}_0x13c07b[_0x9bdb('0x1c')](_0x4da7a5);return _0x13c07b[_0x9bdb('0x22')](_0x9bdb('0x23'),_0x16a953+'-'+_0x582a46+'/'+_0x5204ba)[_0x9bdb('0x1d')](_0x112d0f);}return null;};}function patchUpdates(_0x41a213){return function(_0x310256){try{jsonpatch['apply'](_0x310256,_0x41a213,!![]);}catch(_0x5b5262){return BPromise[_0x9bdb('0x24')](_0x5b5262);}return _0x310256[_0x9bdb('0x25')]();};}function saveUpdates(_0x1bba44,_0x5b84cf){return function(_0x4062a3){if(_0x4062a3){return _0x4062a3[_0x9bdb('0x26')](_0x1bba44)[_0x9bdb('0x27')](function(_0x1725aa){return _0x1725aa;});}return null;};}function removeEntity(_0x561f9f,_0x37a02a){return function(_0x5958c0){if(_0x5958c0){return _0x5958c0[_0x9bdb('0x28')]()[_0x9bdb('0x27')](function(){var _0x369bb3=_0x5958c0['get']({'plain':!![]});var _0x158604=[{'name':_0x9bdb('0x29'),'value':_0x9bdb('0x2a'),'ignore':![]},{'name':_0x9bdb('0x2b'),'value':_0x9bdb('0x2c'),'ignore':![]}];var _0x14fb6a=_(_0x158604)[_0x9bdb('0x2d')](_0x9bdb('0x2e'))[_0x9bdb('0x2f')](_0x9bdb('0x30'))['value']();if(_[_0x9bdb('0x31')](_0x14fb6a,_0x369bb3[_0x9bdb('0x32')])){return;}var _0x15edd5=_[_0x9bdb('0x33')](_0x158604,[_0x9bdb('0x30'),_0x369bb3[_0x9bdb('0x32')]])[_0x9bdb('0x34')];return db['UserProfileResource'][_0x9bdb('0x28')]({'where':{'type':_0x15edd5,'resourceId':_0x369bb3['id']}})['then'](function(){return _0x5958c0;});})[_0x9bdb('0x27')](function(){_0x561f9f[_0x9bdb('0x1c')](0xcc)[_0x9bdb('0x35')]();});}};}function handleEntityNotFound(_0x273316,_0x2fdd9b){return function(_0x46d9a7){if(!_0x46d9a7){_0x273316[_0x9bdb('0x1b')](0x194);}return _0x46d9a7;};}function handleError(_0x5f4d21,_0x31ba33){_0x31ba33=_0x31ba33||0x1f4;return function(_0x1d877c){logger[_0x9bdb('0x36')](_0x1d877c['stack']);if(_0x1d877c['name']){delete _0x1d877c['name'];}_0x5f4d21[_0x9bdb('0x1c')](_0x31ba33)['send'](_0x1d877c);};}exports[_0x9bdb('0x37')]=function(_0x19df51,_0x24f02a){var _0x1d798e={},_0x1a45ef={},_0x29c9f8={'count':0x0,'rows':[]};var _0x1f75ac=_['map'](db[_0x9bdb('0x38')][_0x9bdb('0x39')],function(_0x1c0e56){return{'name':_0x1c0e56[_0x9bdb('0x3a')],'type':_0x1c0e56[_0x9bdb('0x32')]['key']};});_0x1a45ef[_0x9bdb('0x3b')]=_[_0x9bdb('0x2f')](_0x1f75ac,_0x9bdb('0x34'));_0x1a45ef['query']=_[_0x9bdb('0x3c')](_0x19df51['query']);_0x1a45ef[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0x1a45ef[_0x9bdb('0x3b')],_0x1a45ef['query']);_0x1d798e['attributes']=_['intersection'](_0x1a45ef[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x19df51['query'][_0x9bdb('0x3f')]));_0x1d798e['attributes']=_0x1d798e[_0x9bdb('0x40')]['length']?_0x1d798e[_0x9bdb('0x40')]:_0x1a45ef[_0x9bdb('0x3b')];if(!_0x19df51[_0x9bdb('0x41')][_0x9bdb('0x42')](_0x9bdb('0x43'))){_0x1d798e[_0x9bdb('0x1f')]=qs['limit'](_0x19df51[_0x9bdb('0x41')][_0x9bdb('0x1f')]);_0x1d798e['offset']=qs['offset'](_0x19df51[_0x9bdb('0x41')]['offset']);}_0x1d798e[_0x9bdb('0x44')]=qs[_0x9bdb('0x45')](_0x19df51['query'][_0x9bdb('0x45')]);_0x1d798e[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_[_0x9bdb('0x47')](_0x19df51[_0x9bdb('0x41')],_0x1a45ef['filters']),_0x1f75ac);if(_0x19df51[_0x9bdb('0x41')]['filter']){_0x1d798e['where']=_[_0x9bdb('0x48')](_0x1d798e['where'],{'$or':_['map'](_0x1f75ac,function(_0xbdf62c){if(_0xbdf62c[_0x9bdb('0x32')]!=='VIRTUAL'){var _0x5c51fd={};_0x5c51fd[_0xbdf62c[_0x9bdb('0x34')]]={'$like':'%'+_0x19df51[_0x9bdb('0x41')][_0x9bdb('0x2d')]+'%'};return _0x5c51fd;}})});}_0x1d798e=_[_0x9bdb('0x48')]({},_0x1d798e,_0x19df51[_0x9bdb('0x49')]);var _0xe7fd7f={'where':_0x1d798e[_0x9bdb('0x46')]};return db['VoiceQueue'][_0x9bdb('0x21')](_0xe7fd7f)['then'](function(_0x3f11a2){_0x29c9f8[_0x9bdb('0x21')]=_0x3f11a2;if(_0x19df51[_0x9bdb('0x41')][_0x9bdb('0x4a')]){_0x1d798e[_0x9bdb('0x4b')]=[{'all':!![]}];}return db[_0x9bdb('0x38')][_0x9bdb('0x4c')](_0x1d798e);})['then'](function(_0x9b70f0){_0x29c9f8[_0x9bdb('0x4d')]=_0x9b70f0;return _0x29c9f8;})['then'](respondWithFilteredResult(_0x24f02a,_0x1d798e))[_0x9bdb('0x4e')](handleError(_0x24f02a,null));};exports[_0x9bdb('0x4f')]=function(_0x1ca0e5,_0x5314ce){var _0x5ab89e={'raw':![],'where':{'id':_0x1ca0e5[_0x9bdb('0x50')]['id']}},_0x485222={};_0x485222[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db['VoiceQueue'][_0x9bdb('0x39')]);_0x485222[_0x9bdb('0x41')]=_['keys'](_0x1ca0e5['query']);_0x485222[_0x9bdb('0x3d')]=_['intersection'](_0x485222[_0x9bdb('0x3b')],_0x485222[_0x9bdb('0x41')]);_0x5ab89e[_0x9bdb('0x40')]=_[_0x9bdb('0x3e')](_0x485222[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x1ca0e5[_0x9bdb('0x41')][_0x9bdb('0x3f')]));_0x5ab89e['attributes']=_0x5ab89e['attributes']['length']?_0x5ab89e[_0x9bdb('0x40')]:_0x485222[_0x9bdb('0x3b')];if(_0x1ca0e5[_0x9bdb('0x41')][_0x9bdb('0x4a')]){_0x5ab89e[_0x9bdb('0x4b')]=[{'all':!![]}];}_0x5ab89e=_['merge']({},_0x5ab89e,_0x1ca0e5['options']);return db[_0x9bdb('0x38')]['find'](_0x5ab89e)[_0x9bdb('0x27')](handleEntityNotFound(_0x5314ce,null))[_0x9bdb('0x27')](respondWithResult(_0x5314ce,null))[_0x9bdb('0x4e')](handleError(_0x5314ce,null));};exports[_0x9bdb('0x51')]=function(_0xb5d346,_0x2a59bf){return db[_0x9bdb('0x38')][_0x9bdb('0x51')](_0xb5d346['body'],{})[_0x9bdb('0x27')](function(_0xb03fd1){var _0x3629ff=_0xb5d346['user']['get']({'plain':!![]});if(!_0x3629ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3629ff['role']===_0x9bdb('0x52')){var _0x5ab4c5=_0xb03fd1['get']({'plain':!![]});var _0x2d5177=[{'name':_0x9bdb('0x29'),'value':_0x9bdb('0x2a')},{'name':_0x9bdb('0x2b'),'value':_0x9bdb('0x2c')}];var _0x21735b=_['find'](_0x2d5177,['value',_0x5ab4c5[_0x9bdb('0x32')]])['name'];return db[_0x9bdb('0x53')]['find']({'where':{'name':_0x21735b,'userProfileId':_0x3629ff[_0x9bdb('0x54')]},'raw':!![]})['then'](function(_0x21ce33){if(_0x21ce33&&_0x21ce33['autoAssociation']===0x0){return db['UserProfileResource'][_0x9bdb('0x51')]({'name':_0x5ab4c5['name'],'resourceId':_0x5ab4c5['id'],'type':_0x21ce33[_0x9bdb('0x34')],'sectionId':_0x21ce33['id']},{})['then'](function(){return _0xb03fd1;});}else{return _0xb03fd1;}})[_0x9bdb('0x4e')](function(_0x4635c5){logger[_0x9bdb('0x36')](_0x9bdb('0x55'),_0x4635c5);throw _0x4635c5;});}return _0xb03fd1;})[_0x9bdb('0x27')](respondWithResult(_0x2a59bf,0xc9))[_0x9bdb('0x4e')](handleError(_0x2a59bf,null));};exports[_0x9bdb('0x56')]=function(_0x46ab04,_0x20bee1){var _0x33d228={'where':{'id':_0x46ab04[_0x9bdb('0x50')]['id']}},_0x15a2c0={};_0x15a2c0[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db[_0x9bdb('0x38')][_0x9bdb('0x39')]);_0x33d228[_0x9bdb('0x40')]=_[_0x9bdb('0x3e')](_0x15a2c0[_0x9bdb('0x3b')],qs['fields'](_0x46ab04[_0x9bdb('0x41')][_0x9bdb('0x3f')]));_0x33d228[_0x9bdb('0x40')]=_0x33d228['attributes'][_0x9bdb('0x57')]?_0x33d228[_0x9bdb('0x40')]:_0x15a2c0[_0x9bdb('0x3b')];if(_0x46ab04['query'][_0x9bdb('0x4a')]){_0x33d228[_0x9bdb('0x4b')]=[{'all':!![]}];}_0x33d228=_[_0x9bdb('0x48')]({},_0x33d228,_0x46ab04[_0x9bdb('0x49')]);return db['VoiceQueue'][_0x9bdb('0x33')](_0x33d228)['then'](handleEntityNotFound(_0x20bee1,null))[_0x9bdb('0x27')](function(_0x5bcc50){if(_0x5bcc50){var _0x3a5720=_0x5bcc50[_0x9bdb('0x58')]({'plain':!![]});_0x3a5720=qs[_0x9bdb('0x59')](_0x3a5720,['id',_0x9bdb('0x5a'),_0x9bdb('0x5b')]);_0x46ab04[_0x9bdb('0x5c')]=_['omit'](_0x46ab04['body'],['id',_0x9bdb('0x5a'),_0x9bdb('0x5b')]);return db[_0x9bdb('0x38')][_0x9bdb('0x51')](_[_0x9bdb('0x48')](_0x3a5720,_0x46ab04[_0x9bdb('0x5c')]),{'include':_0x46ab04[_0x9bdb('0x41')][_0x9bdb('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0xd0b0a3){var _0x452c21=_0x46ab04[_0x9bdb('0x52')][_0x9bdb('0x58')]({'plain':!![]});if(!_0x452c21)throw new Error(_0x9bdb('0x5d'));if(_0x452c21[_0x9bdb('0x5e')]==='user'){var _0x335e4d=_0xd0b0a3[_0x9bdb('0x58')]({'plain':!![]});var _0x176877=[{'name':'VoiceQueues','value':_0x9bdb('0x2a')},{'name':_0x9bdb('0x2b'),'value':_0x9bdb('0x2c')}];var _0x10776b=_[_0x9bdb('0x33')](_0x176877,[_0x9bdb('0x30'),_0x335e4d[_0x9bdb('0x32')]])['name'];return db[_0x9bdb('0x53')][_0x9bdb('0x33')]({'where':{'name':_0x10776b,'userProfileId':_0x452c21[_0x9bdb('0x54')]},'raw':!![]})['then'](function(_0x50a7e1){if(_0x50a7e1&&_0x50a7e1['autoAssociation']===0x0){return db[_0x9bdb('0x5f')][_0x9bdb('0x51')]({'name':_0x335e4d[_0x9bdb('0x34')],'resourceId':_0x335e4d['id'],'type':_0x50a7e1[_0x9bdb('0x34')],'sectionId':_0x50a7e1['id']},{})[_0x9bdb('0x27')](function(){return _0xd0b0a3;});}else{return _0xd0b0a3;}})[_0x9bdb('0x4e')](function(_0x2b8d87){logger[_0x9bdb('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b8d87);throw _0x2b8d87;});}return _0xd0b0a3;});}})[_0x9bdb('0x27')](respondWithResult(_0x20bee1,0xc9))[_0x9bdb('0x4e')](handleError(_0x20bee1,null));};exports[_0x9bdb('0x26')]=function(_0x496c6f,_0x300eb5){if(_0x496c6f[_0x9bdb('0x5c')]['id']){delete _0x496c6f['body']['id'];}return db['VoiceQueue'][_0x9bdb('0x33')]({'where':{'id':_0x496c6f[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x300eb5,null))[_0x9bdb('0x27')](saveUpdates(_0x496c6f['body'],null))[_0x9bdb('0x27')](respondWithResult(_0x300eb5,null))[_0x9bdb('0x4e')](handleError(_0x300eb5,null));};exports[_0x9bdb('0x28')]=function(_0x43804a,_0x13d3cc){return db[_0x9bdb('0x38')][_0x9bdb('0x33')]({'where':{'id':_0x43804a[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x13d3cc,null))['then'](removeEntity(_0x13d3cc,null))[_0x9bdb('0x4e')](handleError(_0x13d3cc,null));};exports[_0x9bdb('0x60')]=function(_0x1c4099,_0x47d341,_0x261d73){var _0x4671cf={'raw':![],'where':{}};var _0x312a2e={};var _0x451d5c={'count':0x0,'rows':[]};return db[_0x9bdb('0x38')][_0x9bdb('0x61')]({'where':{'id':_0x1c4099[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x47d341,null))[_0x9bdb('0x27')](function(_0x36093){if(_0x36093){_0x312a2e[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db[_0x9bdb('0x62')]['rawAttributes']);_0x312a2e[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x1c4099['query']);_0x312a2e[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0x312a2e[_0x9bdb('0x3b')],_0x312a2e[_0x9bdb('0x41')]);_0x4671cf[_0x9bdb('0x40')]=_[_0x9bdb('0x3e')](_0x312a2e[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x1c4099[_0x9bdb('0x41')][_0x9bdb('0x3f')]));_0x4671cf[_0x9bdb('0x40')]=_0x4671cf[_0x9bdb('0x40')][_0x9bdb('0x57')]?_0x4671cf['attributes']:_0x312a2e[_0x9bdb('0x3b')];if(!_0x1c4099[_0x9bdb('0x41')][_0x9bdb('0x42')](_0x9bdb('0x43'))){_0x4671cf['limit']=qs[_0x9bdb('0x1f')](_0x1c4099[_0x9bdb('0x41')][_0x9bdb('0x1f')]);_0x4671cf['offset']=qs['offset'](_0x1c4099[_0x9bdb('0x41')]['offset']);}_0x4671cf['order']=qs[_0x9bdb('0x45')](_0x1c4099[_0x9bdb('0x41')][_0x9bdb('0x45')]);_0x4671cf[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_['pick'](_0x1c4099['query'],_0x312a2e[_0x9bdb('0x3d')]));_0x4671cf[_0x9bdb('0x46')][_0x9bdb('0x63')]=_0x36093['id'];if(_0x1c4099[_0x9bdb('0x41')][_0x9bdb('0x2d')]){_0x4671cf[_0x9bdb('0x46')]=_['merge'](_0x4671cf[_0x9bdb('0x46')],{'$or':_[_0x9bdb('0x2f')](_0x4671cf[_0x9bdb('0x40')],function(_0xbac034){var _0x58d5eb={};_0x58d5eb[_0xbac034]={'$like':'%'+_0x1c4099['query']['filter']+'%'};return _0x58d5eb;})});}_0x4671cf=_[_0x9bdb('0x48')]({},_0x4671cf,_0x1c4099[_0x9bdb('0x49')]);return db[_0x9bdb('0x62')][_0x9bdb('0x21')]({'where':_0x4671cf[_0x9bdb('0x46')]})[_0x9bdb('0x27')](function(_0x23fb8e){_0x451d5c[_0x9bdb('0x21')]=_0x23fb8e;if(_0x1c4099['query'][_0x9bdb('0x4a')]){_0x4671cf['include']=[{'all':!![]}];}return db[_0x9bdb('0x62')]['findAll'](_0x4671cf);})[_0x9bdb('0x27')](function(_0xb5cd21){_0x451d5c[_0x9bdb('0x4d')]=_0xb5cd21;return _0x451d5c;});}})['then'](respondWithFilteredResult(_0x47d341,_0x4671cf))[_0x9bdb('0x4e')](handleError(_0x47d341,null));};exports[_0x9bdb('0x64')]=function(_0x181658,_0x4088a1,_0x5b5a46){var _0x56ff1f={'raw':!![],'where':{}};var _0xaa406d={};var _0xe79042={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9bdb('0x61')]({'where':{'id':_0x181658[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x4088a1,null))[_0x9bdb('0x27')](function(_0x224fa6){if(_0x224fa6){_0xaa406d[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db[_0x9bdb('0x65')][_0x9bdb('0x39')]);_0xaa406d[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x181658[_0x9bdb('0x41')]);_0xaa406d[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0xaa406d['model'],_0xaa406d['query']);_0x56ff1f[_0x9bdb('0x40')]=_['intersection'](_0xaa406d['model'],qs['fields'](_0x181658[_0x9bdb('0x41')][_0x9bdb('0x3f')]));_0x56ff1f[_0x9bdb('0x40')]=_0x56ff1f['attributes'][_0x9bdb('0x57')]?_0x56ff1f['attributes']:_0xaa406d['model'];if(!_0x181658[_0x9bdb('0x41')][_0x9bdb('0x42')]('nolimit')){_0x56ff1f[_0x9bdb('0x1f')]=qs['limit'](_0x181658[_0x9bdb('0x41')][_0x9bdb('0x1f')]);_0x56ff1f[_0x9bdb('0x1e')]=qs['offset'](_0x181658[_0x9bdb('0x41')][_0x9bdb('0x1e')]);}_0x56ff1f[_0x9bdb('0x44')]=qs[_0x9bdb('0x45')](_0x181658[_0x9bdb('0x41')][_0x9bdb('0x45')]);_0x56ff1f[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_[_0x9bdb('0x47')](_0x181658['query'],_0xaa406d[_0x9bdb('0x3d')]));_0x56ff1f[_0x9bdb('0x46')]['VoiceQueueId']=_0x224fa6['id'];if(_0x181658['query'][_0x9bdb('0x2d')]){_0x56ff1f[_0x9bdb('0x46')]=_[_0x9bdb('0x48')](_0x56ff1f['where'],{'$or':_[_0x9bdb('0x2f')](_0x56ff1f[_0x9bdb('0x40')],function(_0x58ea72){var _0x1e7a5e={};_0x1e7a5e[_0x58ea72]={'$like':'%'+_0x181658[_0x9bdb('0x41')][_0x9bdb('0x2d')]+'%'};return _0x1e7a5e;})});}_0x56ff1f=_[_0x9bdb('0x48')]({},_0x56ff1f,_0x181658[_0x9bdb('0x49')]);return db[_0x9bdb('0x65')][_0x9bdb('0x21')]({'where':_0x56ff1f[_0x9bdb('0x46')]})[_0x9bdb('0x27')](function(_0x67c41d){_0xe79042[_0x9bdb('0x21')]=_0x67c41d;if(_0x181658[_0x9bdb('0x41')][_0x9bdb('0x4a')]){_0x56ff1f[_0x9bdb('0x4b')]=[{'all':!![]}];}return db[_0x9bdb('0x65')][_0x9bdb('0x4c')](_0x56ff1f);})[_0x9bdb('0x27')](function(_0x2d1d7d){_0xe79042['rows']=_0x2d1d7d;return _0xe79042;});}})[_0x9bdb('0x27')](respondWithFilteredResult(_0x4088a1,_0x56ff1f))[_0x9bdb('0x4e')](handleError(_0x4088a1,null));};exports[_0x9bdb('0x66')]=function(_0x399973,_0x1472af,_0x343f72){var _0x421808={'raw':!![],'where':{}};var _0x2dfe1f={};var _0x20c038={'count':0x0,'rows':[]};return db[_0x9bdb('0x38')][_0x9bdb('0x61')]({'where':{'id':_0x399973['params']['id']}})['then'](handleEntityNotFound(_0x1472af,null))[_0x9bdb('0x27')](function(_0x3a6a32){if(_0x3a6a32){_0x2dfe1f[_0x9bdb('0x3b')]=_['keys'](db[_0x9bdb('0x67')]['rawAttributes']);_0x2dfe1f[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x399973['query']);_0x2dfe1f['filters']=_[_0x9bdb('0x3e')](_0x2dfe1f['model'],_0x2dfe1f['query']);_0x421808['attributes']=_[_0x9bdb('0x3e')](_0x2dfe1f[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x399973[_0x9bdb('0x41')][_0x9bdb('0x3f')]));_0x421808[_0x9bdb('0x40')]=_0x421808[_0x9bdb('0x40')][_0x9bdb('0x57')]?_0x421808['attributes']:_0x2dfe1f['model'];if(!_0x399973[_0x9bdb('0x41')][_0x9bdb('0x42')](_0x9bdb('0x43'))){_0x421808['limit']=qs[_0x9bdb('0x1f')](_0x399973[_0x9bdb('0x41')][_0x9bdb('0x1f')]);_0x421808[_0x9bdb('0x1e')]=qs[_0x9bdb('0x1e')](_0x399973[_0x9bdb('0x41')][_0x9bdb('0x1e')]);}_0x421808[_0x9bdb('0x44')]=qs[_0x9bdb('0x45')](_0x399973[_0x9bdb('0x41')]['sort']);_0x421808[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_[_0x9bdb('0x47')](_0x399973['query'],_0x2dfe1f[_0x9bdb('0x3d')]));_0x421808[_0x9bdb('0x46')]['VoiceQueueId']=_0x3a6a32['id'];if(_0x399973[_0x9bdb('0x41')][_0x9bdb('0x2d')]){_0x421808[_0x9bdb('0x46')]=_[_0x9bdb('0x48')](_0x421808[_0x9bdb('0x46')],{'$or':_[_0x9bdb('0x2f')](_0x421808[_0x9bdb('0x40')],function(_0x1558a2){var _0x538808={};_0x538808[_0x1558a2]={'$like':'%'+_0x399973[_0x9bdb('0x41')][_0x9bdb('0x2d')]+'%'};return _0x538808;})});}_0x421808=_[_0x9bdb('0x48')]({},_0x421808,_0x399973['options']);return db[_0x9bdb('0x67')][_0x9bdb('0x21')]({'where':_0x421808[_0x9bdb('0x46')]})[_0x9bdb('0x27')](function(_0x4e6338){_0x20c038[_0x9bdb('0x21')]=_0x4e6338;if(_0x399973['query'][_0x9bdb('0x4a')]){_0x421808[_0x9bdb('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x421808);})['then'](function(_0xf3e933){_0x20c038[_0x9bdb('0x4d')]=_0xf3e933;return _0x20c038;});}})[_0x9bdb('0x27')](respondWithFilteredResult(_0x1472af,_0x421808))[_0x9bdb('0x4e')](handleError(_0x1472af,null));};exports[_0x9bdb('0x68')]=function(_0x53348d,_0x933e4d,_0x2406b4){var _0x5e2482={'raw':!![],'where':{}};var _0x1e3a92={};var _0x306e08={'count':0x0,'rows':[]};return db[_0x9bdb('0x38')][_0x9bdb('0x61')]({'where':{'id':_0x53348d[_0x9bdb('0x50')]['id']}})['then'](handleEntityNotFound(_0x933e4d,null))[_0x9bdb('0x27')](function(_0x5d9c14){if(_0x5d9c14){_0x1e3a92[_0x9bdb('0x3b')]=_['keys'](db[_0x9bdb('0x69')]['rawAttributes']);_0x1e3a92[_0x9bdb('0x41')]=_['keys'](_0x53348d['query']);_0x1e3a92['filters']=_[_0x9bdb('0x3e')](_0x1e3a92[_0x9bdb('0x3b')],_0x1e3a92['query']);_0x5e2482['attributes']=_[_0x9bdb('0x3e')](_0x1e3a92[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x53348d['query'][_0x9bdb('0x3f')]));_0x5e2482[_0x9bdb('0x40')]=_0x5e2482[_0x9bdb('0x40')][_0x9bdb('0x57')]?_0x5e2482[_0x9bdb('0x40')]:_0x1e3a92[_0x9bdb('0x3b')];if(!_0x53348d['query']['hasOwnProperty']('nolimit')){_0x5e2482[_0x9bdb('0x1f')]=qs[_0x9bdb('0x1f')](_0x53348d[_0x9bdb('0x41')][_0x9bdb('0x1f')]);_0x5e2482[_0x9bdb('0x1e')]=qs[_0x9bdb('0x1e')](_0x53348d[_0x9bdb('0x41')]['offset']);}_0x5e2482['order']=qs[_0x9bdb('0x45')](_0x53348d[_0x9bdb('0x41')][_0x9bdb('0x45')]);_0x5e2482['where']=qs[_0x9bdb('0x3d')](_[_0x9bdb('0x47')](_0x53348d['query'],_0x1e3a92[_0x9bdb('0x3d')]));_0x5e2482[_0x9bdb('0x46')][_0x9bdb('0x63')]=_0x5d9c14['id'];if(_0x53348d[_0x9bdb('0x41')][_0x9bdb('0x2d')]){_0x5e2482['where']=_[_0x9bdb('0x48')](_0x5e2482['where'],{'$or':_[_0x9bdb('0x2f')](_0x5e2482[_0x9bdb('0x40')],function(_0x178487){var _0x49d629={};_0x49d629[_0x178487]={'$like':'%'+_0x53348d[_0x9bdb('0x41')][_0x9bdb('0x2d')]+'%'};return _0x49d629;})});}_0x5e2482=_[_0x9bdb('0x48')]({},_0x5e2482,_0x53348d[_0x9bdb('0x49')]);return db[_0x9bdb('0x69')][_0x9bdb('0x21')]({'where':_0x5e2482[_0x9bdb('0x46')]})['then'](function(_0x244967){_0x306e08[_0x9bdb('0x21')]=_0x244967;if(_0x53348d[_0x9bdb('0x41')][_0x9bdb('0x4a')]){_0x5e2482[_0x9bdb('0x4b')]=[{'all':!![]}];}return db[_0x9bdb('0x69')][_0x9bdb('0x4c')](_0x5e2482);})[_0x9bdb('0x27')](function(_0x8c9faa){_0x306e08[_0x9bdb('0x4d')]=_0x8c9faa;return _0x306e08;});}})['then'](respondWithFilteredResult(_0x933e4d,_0x5e2482))[_0x9bdb('0x4e')](handleError(_0x933e4d,null));};exports[_0x9bdb('0x6a')]=function(_0x2d0a2f,_0x2864b7,_0x51fa7c){var _0x4b0bb8={};var _0x2e1c79={};var _0x5ee421;var _0xc8daee;return db[_0x9bdb('0x38')][_0x9bdb('0x61')]({'where':{'id':_0x2d0a2f[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x2864b7,null))[_0x9bdb('0x27')](function(_0x3c207f){if(_0x3c207f){_0x5ee421=_0x3c207f;_0x2e1c79[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db['Team'][_0x9bdb('0x39')]);_0x2e1c79[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x2d0a2f[_0x9bdb('0x41')]);_0x2e1c79[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0x2e1c79[_0x9bdb('0x3b')],_0x2e1c79[_0x9bdb('0x41')]);_0x4b0bb8[_0x9bdb('0x40')]=_[_0x9bdb('0x3e')](_0x2e1c79[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x2d0a2f['query'][_0x9bdb('0x3f')]));_0x4b0bb8[_0x9bdb('0x40')]=_0x4b0bb8[_0x9bdb('0x40')][_0x9bdb('0x57')]?_0x4b0bb8[_0x9bdb('0x40')]:_0x2e1c79[_0x9bdb('0x3b')];_0x4b0bb8[_0x9bdb('0x44')]=qs[_0x9bdb('0x45')](_0x2d0a2f[_0x9bdb('0x41')][_0x9bdb('0x45')]);_0x4b0bb8[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_['pick'](_0x2d0a2f[_0x9bdb('0x41')],_0x2e1c79[_0x9bdb('0x3d')]));if(_0x2d0a2f['query'][_0x9bdb('0x2d')]){_0x4b0bb8[_0x9bdb('0x46')]=_[_0x9bdb('0x48')](_0x4b0bb8[_0x9bdb('0x46')],{'$or':_[_0x9bdb('0x2f')](_0x4b0bb8[_0x9bdb('0x40')],function(_0x478693){var _0x225274={};_0x225274[_0x478693]={'$like':'%'+_0x2d0a2f[_0x9bdb('0x41')][_0x9bdb('0x2d')]+'%'};return _0x225274;})});}_0x4b0bb8=_[_0x9bdb('0x48')]({},_0x4b0bb8,_0x2d0a2f[_0x9bdb('0x49')]);return _0x5ee421[_0x9bdb('0x6a')](_0x4b0bb8);}})[_0x9bdb('0x27')](function(_0xec8687){if(_0xec8687){_0xc8daee=_0xec8687[_0x9bdb('0x57')];if(!_0x2d0a2f[_0x9bdb('0x41')]['hasOwnProperty'](_0x9bdb('0x43'))){_0x4b0bb8[_0x9bdb('0x1f')]=qs[_0x9bdb('0x1f')](_0x2d0a2f[_0x9bdb('0x41')][_0x9bdb('0x1f')]);_0x4b0bb8['offset']=qs[_0x9bdb('0x1e')](_0x2d0a2f[_0x9bdb('0x41')][_0x9bdb('0x1e')]);}return _0x5ee421['getTeams'](_0x4b0bb8);}})['then'](function(_0x104af2){if(_0x104af2){return _0x104af2?{'count':_0xc8daee,'rows':_0x104af2}:null;}})[_0x9bdb('0x27')](respondWithResult(_0x2864b7,null))[_0x9bdb('0x4e')](handleError(_0x2864b7,null));};exports[_0x9bdb('0x6b')]=function(_0x564f45,_0x215e44,_0xc3f921){var _0xfbc6ef=_0x564f45[_0x9bdb('0x5c')][_0x9bdb('0x6c')];var _0x3c0f42=_['map'](_0xfbc6ef,'id');return db[_0x9bdb('0x6d')][_0x9bdb('0x4c')]({'where':{'id':_0x3c0f42},'attributes':['id'],'include':[{'model':db[_0x9bdb('0x6e')],'as':'Agents','attributes':['id','name',_0x9bdb('0x6f'),_0x9bdb('0x70'),_0x9bdb('0x71')],'raw':!![]}]})[_0x9bdb('0x27')](function(_0x51c073){if(_0x51c073){var _0x554d42=_[_0x9bdb('0x72')](_0x51c073,function(_0x3830d8){var _0x5b6ced=_0x3830d8[_0x9bdb('0x58')]({'plain':!![]});_0x5b6ced[_0x9bdb('0x73')]['forEach'](function(_0xeae96d){_0xeae96d[_0x9bdb('0x74')]=_[_0x9bdb('0x33')](_0xfbc6ef,{'id':_0x5b6ced['id']})[_0x9bdb('0x74')];});return _0x5b6ced[_0x9bdb('0x73')];});return db['VoiceQueue']['find']({'where':{'id':_0x564f45[_0x9bdb('0x50')]['id']}})['then'](function(_0x1a307f){return db[_0x9bdb('0x75')]['transaction'](function(_0x10265d){return _0x1a307f[_0x9bdb('0x6b')](_0x3c0f42,{'transaction':_0x10265d})[_0x9bdb('0x27')](function(){return BPromise[_0x9bdb('0x76')](_0xfbc6ef,function(_0x4603a6){return db[_0x9bdb('0x77')][_0x9bdb('0x78')]({'TeamId':_0x4603a6['id'],'VoiceQueueId':_0x564f45[_0x9bdb('0x50')]['id'],'penalty':_0x4603a6[_0x9bdb('0x74')]},{'transaction':_0x10265d});});})['then'](function(){return BPromise[_0x9bdb('0x76')](_0x554d42,function(_0x36850f){return db[_0x9bdb('0x79')][_0x9bdb('0x7a')]({'where':{'UserId':_0x36850f['id'],'VoiceQueueId':_0x564f45[_0x9bdb('0x50')]['id']},'defaults':{'penalty':_0x36850f[_0x9bdb('0x74')]},'transaction':_0x10265d});});})[_0x9bdb('0x27')](function(){return BPromise['each'](_['filter'](_0x554d42,{'online':!![]}),function(_0x327c59){return db[_0x9bdb('0x7b')][_0x9bdb('0x78')]({'membername':_0x327c59['name'],'UserId':_0x327c59['id'],'queue_name':_0x1a307f[_0x9bdb('0x34')],'VoiceQueueId':_0x1a307f['id'],'interface':_[_0x9bdb('0x7c')](_0x327c59[_0x9bdb('0x71')])?util[_0x9bdb('0x7d')](_0x9bdb('0x7e'),_0x327c59[_0x9bdb('0x34')]):_0x327c59[_0x9bdb('0x71')],'paused':_0x327c59['voicePause']||![],'penalty':_0x327c59[_0x9bdb('0x74')]},{'transaction':_0x10265d});});})[_0x9bdb('0x27')](function(){_0x554d42[_0x9bdb('0x7f')](function(_0x39b3d1){socket[_0x9bdb('0x80')](_0x9bdb('0x81'),{'UserId':_0x39b3d1['id'],'VoiceQueueId':_0x1a307f['id']});});});});});}})['then'](respondWithStatusCode(_0x215e44,null))[_0x9bdb('0x4e')](handleError(_0x215e44,null));};exports['removeTeams']=function(_0x58469a,_0x3a92b7,_0x1462d0){return db[_0x9bdb('0x6d')][_0x9bdb('0x4c')]({'where':{'id':_0x58469a[_0x9bdb('0x41')][_0x9bdb('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9bdb('0x73'),'attributes':['id'],'raw':!![]}]})[_0x9bdb('0x27')](handleEntityNotFound(_0x3a92b7,null))[_0x9bdb('0x27')](function(_0x38294d){var _0x51dc6c=_['map'](_0x38294d,'id');var _0x52e34b=[];var _0x58fbf4=[];var _0x3b454c=squel['select']();_0x3b454c[_0x9bdb('0x83')](_0x9bdb('0x84'))['from'](_0x9bdb('0x85'),'tq')[_0x9bdb('0x86')](_0x9bdb('0x87'),'ut',_0x9bdb('0x88'))['where'](_0x9bdb('0x89'),_0x58469a[_0x9bdb('0x50')]['id']);for(var _0x38c2dc=0x0;_0x38c2dc<_0x38294d[_0x9bdb('0x57')];_0x38c2dc+=0x1){let _0x470eb2=_0x38294d[_0x38c2dc];for(var _0x28f3b1=0x0;_0x28f3b1<_0x470eb2[_0x9bdb('0x73')][_0x9bdb('0x57')];_0x28f3b1+=0x1){let _0x526c5e=_0x470eb2[_0x9bdb('0x73')][_0x28f3b1];var _0x331a31=_0x3b454c[_0x9bdb('0x56')]();_0x331a31[_0x9bdb('0x46')](_0x9bdb('0x8a'),_0x526c5e['id']);_0x58fbf4[_0x9bdb('0x8b')](db['sequelize'][_0x9bdb('0x41')](_0x331a31['toString'](),{'type':db[_0x9bdb('0x75')][_0x9bdb('0x8c')][_0x9bdb('0x8d')]})[_0x9bdb('0x27')](function(_0x2fea7a){if(_0x2fea7a[_0x9bdb('0x57')]===0x1){return _0x526c5e['id'];}else{var _0x5594c8=_[_0x9bdb('0x8e')](_['map'](_0x2fea7a,'TeamId'),function(_0x5d354f){return _[_0x9bdb('0x31')](_0x51dc6c,_0x5d354f);});if(_0x5594c8){return _0x526c5e['id'];}}}));}}return BPromise[_0x9bdb('0x8f')](_0x58fbf4)[_0x9bdb('0x27')](function(_0x28b5f2){_0x52e34b=_(_0x52e34b)[_0x9bdb('0x90')](_0x28b5f2)[_0x9bdb('0x91')]()[_0x9bdb('0x30')]();return db[_0x9bdb('0x38')][_0x9bdb('0x33')]({'where':{'id':_0x58469a[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](function(_0x15374d){return db[_0x9bdb('0x75')][_0x9bdb('0x92')](function(_0x2b9275){return _0x15374d[_0x9bdb('0x93')](_0x58469a['query'][_0x9bdb('0x82')],{'transaction':_0x2b9275})[_0x9bdb('0x27')](function(){if(!_[_0x9bdb('0x94')](_0x52e34b)){return _0x15374d['removeAgents'](_0x52e34b,{'transaction':_0x2b9275})['then'](function(){return db[_0x9bdb('0x7b')][_0x9bdb('0x28')]({'where':{'VoiceQueueId':_0x58469a['params']['id'],'UserId':_0x52e34b},'transaction':_0x2b9275});});}})[_0x9bdb('0x27')](function(){_0x52e34b[_0x9bdb('0x7f')](function(_0x37448e){socket[_0x9bdb('0x80')](_0x9bdb('0x95'),{'UserId':_0x37448e,'VoiceQueueId':_0x15374d['id']});});});});});});})[_0x9bdb('0x27')](respondWithStatusCode(_0x3a92b7,null))[_0x9bdb('0x4e')](handleError(_0x3a92b7,null));};exports[_0x9bdb('0x96')]=function(_0x9bd58d,_0x28b699,_0x161283){var _0xf50367,_0x1d7184;return db['VoiceQueue'][_0x9bdb('0x33')]({'where':{'id':_0x9bd58d[_0x9bdb('0x50')]['id']}})['then'](handleEntityNotFound(_0x28b699,null))[_0x9bdb('0x27')](function(_0xc6596d){if(_0xc6596d){_0x1d7184=_0xc6596d;return _0xc6596d[_0x9bdb('0x96')](_0x9bd58d[_0x9bdb('0x5c')][_0x9bdb('0x82')],_[_0x9bdb('0x59')](_0x9bd58d[_0x9bdb('0x5c')],['ids','id'])||{})[_0x9bdb('0x97')](function(_0x270d32){for(var _0x2d1125=0x0;_0x2d1125<_0x9bd58d[_0x9bdb('0x5c')][_0x9bdb('0x82')]['length'];_0x2d1125+=0x1){socket[_0x9bdb('0x80')]('userVoiceQueue:save',{'UserId':Number(_0x9bd58d['body'][_0x9bdb('0x82')][_0x2d1125]),'VoiceQueueId':Number(_0x9bd58d['params']['id'])});}return _0x270d32;});}})[_0x9bdb('0x27')](function(_0x5593ec){_0xf50367=_0x5593ec||[];if(_0x1d7184){return db[_0x9bdb('0x6e')][_0x9bdb('0x4c')]({'where':{'id':_0x9bd58d['body'][_0x9bdb('0x82')]},'attributes':['id',_0x9bdb('0x34'),_0x9bdb('0x6f'),_0x9bdb('0x70'),_0x9bdb('0x71')],'raw':!![]});}})[_0x9bdb('0x27')](function(_0x28bca6){if(!_[_0x9bdb('0x94')](_0x28bca6)){var _0x2f7e41=[];for(var _0x182e01=0x0;_0x182e01<_0x28bca6[_0x9bdb('0x57')];_0x182e01++){if(_0x28bca6[_0x182e01]['online']){_0x2f7e41[_0x9bdb('0x8b')](db[_0x9bdb('0x7b')][_0x9bdb('0x78')]({'membername':_0x28bca6[_0x182e01][_0x9bdb('0x34')],'UserId':_0x28bca6[_0x182e01]['id'],'queue_name':_0x1d7184[_0x9bdb('0x34')],'VoiceQueueId':_0x1d7184['id'],'interface':_['isNil'](_0x28bca6[_0x182e01][_0x9bdb('0x71')])?util[_0x9bdb('0x7d')](_0x9bdb('0x7e'),_0x28bca6[_0x182e01][_0x9bdb('0x34')]):_0x28bca6[_0x182e01][_0x9bdb('0x71')],'paused':_0x28bca6[_0x182e01][_0x9bdb('0x70')]||![],'penalty':_0x9bd58d[_0x9bdb('0x5c')][_0x9bdb('0x74')]||0x0}));}}return BPromise[_0x9bdb('0x8f')](_0x2f7e41);}})[_0x9bdb('0x27')](function(){return _0xf50367;})[_0x9bdb('0x27')](respondWithResult(_0x28b699,null))[_0x9bdb('0x4e')](handleError(_0x28b699,null));};exports[_0x9bdb('0x98')]=function(_0x5d7617,_0x56c658,_0x1e0f47){return db[_0x9bdb('0x38')][_0x9bdb('0x33')]({'where':{'id':_0x5d7617[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x56c658,null))[_0x9bdb('0x27')](function(_0x1079fb){if(_0x1079fb){return _0x1079fb[_0x9bdb('0x98')](_0x5d7617[_0x9bdb('0x41')][_0x9bdb('0x82')])['then'](function(){if(_[_0x9bdb('0x99')](_0x5d7617[_0x9bdb('0x41')][_0x9bdb('0x82')])){for(var _0x4abe63=0x0;_0x4abe63<_0x5d7617[_0x9bdb('0x41')][_0x9bdb('0x82')][_0x9bdb('0x57')];_0x4abe63+=0x1){socket[_0x9bdb('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x5d7617[_0x9bdb('0x41')]['ids'][_0x4abe63]),'VoiceQueueId':Number(_0x5d7617[_0x9bdb('0x50')]['id'])});}}else{socket[_0x9bdb('0x80')](_0x9bdb('0x95'),{'UserId':Number(_0x5d7617[_0x9bdb('0x41')]['ids']),'VoiceQueueId':Number(_0x5d7617['params']['id'])});}});}})[_0x9bdb('0x27')](function(_0x3ba468){return db[_0x9bdb('0x7b')][_0x9bdb('0x28')]({'where':{'VoiceQueueId':_0x5d7617[_0x9bdb('0x50')]['id'],'UserId':_0x5d7617[_0x9bdb('0x41')][_0x9bdb('0x82')]}})[_0x9bdb('0x27')](function(){return _0x3ba468;});})['then'](respondWithStatusCode(_0x56c658,null))[_0x9bdb('0x4e')](handleError(_0x56c658,null));};exports[_0x9bdb('0x9a')]=function(_0x4c5fe6,_0x5d63ff,_0xe6fe10){var _0x50ffab={};var _0x5a1f59={};var _0x54f6be;var _0x4c6142;return db['VoiceQueue'][_0x9bdb('0x61')]({'where':{'id':_0x4c5fe6[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x5d63ff,null))[_0x9bdb('0x27')](function(_0x1807c2){if(_0x1807c2){_0x54f6be=_0x1807c2;_0x5a1f59[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db[_0x9bdb('0x6e')]['rawAttributes']);_0x5a1f59['query']=_['keys'](_0x4c5fe6['query']);_0x5a1f59['filters']=_[_0x9bdb('0x3e')](_0x5a1f59[_0x9bdb('0x3b')],_0x5a1f59[_0x9bdb('0x41')]);_0x50ffab[_0x9bdb('0x40')]=_[_0x9bdb('0x3e')](_0x5a1f59[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x4c5fe6[_0x9bdb('0x41')][_0x9bdb('0x3f')]));_0x50ffab[_0x9bdb('0x40')]=_0x50ffab['attributes']['length']?_0x50ffab[_0x9bdb('0x40')]:_0x5a1f59[_0x9bdb('0x3b')];_0x50ffab[_0x9bdb('0x44')]=qs[_0x9bdb('0x45')](_0x4c5fe6[_0x9bdb('0x41')][_0x9bdb('0x45')]);_0x50ffab[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_['pick'](_0x4c5fe6[_0x9bdb('0x41')],_0x5a1f59[_0x9bdb('0x3d')]));if(_0x4c5fe6[_0x9bdb('0x41')][_0x9bdb('0x2d')]){_0x50ffab[_0x9bdb('0x46')]=_['merge'](_0x50ffab['where'],{'$or':_['map'](_0x50ffab['attributes'],function(_0x44d8e3){var _0x4b8252={};_0x4b8252[_0x44d8e3]={'$like':'%'+_0x4c5fe6[_0x9bdb('0x41')][_0x9bdb('0x2d')]+'%'};return _0x4b8252;})});}_0x50ffab=_[_0x9bdb('0x48')]({},_0x50ffab,_0x4c5fe6[_0x9bdb('0x49')]);return _0x54f6be[_0x9bdb('0x9a')](_0x50ffab);}})[_0x9bdb('0x27')](function(_0x5a9b1e){if(_0x5a9b1e){_0x4c6142=_0x5a9b1e[_0x9bdb('0x57')];if(!_0x4c5fe6['query'][_0x9bdb('0x42')](_0x9bdb('0x43'))){_0x50ffab[_0x9bdb('0x1f')]=qs[_0x9bdb('0x1f')](_0x4c5fe6[_0x9bdb('0x41')]['limit']);_0x50ffab[_0x9bdb('0x1e')]=qs[_0x9bdb('0x1e')](_0x4c5fe6[_0x9bdb('0x41')][_0x9bdb('0x1e')]);}return _0x54f6be[_0x9bdb('0x9a')](_0x50ffab);}})['then'](function(_0x33699c){if(_0x33699c){return _0x33699c?{'count':_0x4c6142,'rows':_0x33699c}:null;}})[_0x9bdb('0x27')](respondWithResult(_0x5d63ff,null))[_0x9bdb('0x4e')](handleError(_0x5d63ff,null));};exports[_0x9bdb('0x9b')]=function(_0x4f507b,_0x38f7d8,_0x1510a8){var _0x1a583b={};var _0x4a465e={};var _0x2f2009;var _0x4fcd24;return db[_0x9bdb('0x38')][_0x9bdb('0x61')]({'where':{'id':_0x4f507b[_0x9bdb('0x50')]['id']}})['then'](handleEntityNotFound(_0x38f7d8,null))[_0x9bdb('0x27')](function(_0x336168){if(_0x336168){_0x2f2009=_0x336168;_0x4a465e[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db[_0x9bdb('0x7b')][_0x9bdb('0x39')]);_0x4a465e[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x4f507b[_0x9bdb('0x41')]);_0x4a465e[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0x4a465e[_0x9bdb('0x3b')],_0x4a465e['query']);_0x1a583b['attributes']=_['intersection'](_0x4a465e[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x4f507b[_0x9bdb('0x41')]['fields']));_0x1a583b[_0x9bdb('0x40')]=_0x1a583b['attributes'][_0x9bdb('0x57')]?_0x1a583b[_0x9bdb('0x40')]:_0x4a465e['model'];_0x1a583b[_0x9bdb('0x44')]=qs[_0x9bdb('0x45')](_0x4f507b[_0x9bdb('0x41')]['sort']);_0x1a583b['where']=qs[_0x9bdb('0x3d')](_['pick'](_0x4f507b[_0x9bdb('0x41')],_0x4a465e[_0x9bdb('0x3d')]));if(_0x4f507b[_0x9bdb('0x41')]['filter']){_0x1a583b[_0x9bdb('0x46')]=_[_0x9bdb('0x48')](_0x1a583b[_0x9bdb('0x46')],{'$or':_[_0x9bdb('0x2f')](_0x1a583b['attributes'],function(_0x39c75b){var _0x493eee={};_0x493eee[_0x39c75b]={'$like':'%'+_0x4f507b['query'][_0x9bdb('0x2d')]+'%'};return _0x493eee;})});}_0x1a583b=_[_0x9bdb('0x48')]({},_0x1a583b,_0x4f507b['options']);return _0x2f2009['getMembers'](_0x1a583b);}})[_0x9bdb('0x27')](function(_0x5e9abe){if(_0x5e9abe){_0x4fcd24=_0x5e9abe[_0x9bdb('0x57')];if(!_0x4f507b['query'][_0x9bdb('0x42')](_0x9bdb('0x43'))){_0x1a583b[_0x9bdb('0x1f')]=qs[_0x9bdb('0x1f')](_0x4f507b['query']['limit']);_0x1a583b['offset']=qs[_0x9bdb('0x1e')](_0x4f507b[_0x9bdb('0x41')][_0x9bdb('0x1e')]);}return _0x2f2009[_0x9bdb('0x9b')](_0x1a583b);}})[_0x9bdb('0x27')](function(_0x1fc7b0){return _0x1fc7b0?{'count':_0x4fcd24,'rows':_0x1fc7b0}:null;})[_0x9bdb('0x27')](respondWithResult(_0x38f7d8,null))[_0x9bdb('0x4e')](handleError(_0x38f7d8,null));};exports['getLists']=function(_0x547411,_0x36d106,_0x281bca){var _0x29320f={};var _0x128d90={};var _0x4e7034;var _0x4a3c35;return db[_0x9bdb('0x38')][_0x9bdb('0x61')]({'where':{'id':_0x547411[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x36d106,null))['then'](function(_0x4ea361){if(_0x4ea361){_0x4e7034=_0x4ea361;_0x128d90['model']=_[_0x9bdb('0x3c')](db['CmList'][_0x9bdb('0x39')]);_0x128d90[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x547411[_0x9bdb('0x41')]);_0x128d90[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0x128d90[_0x9bdb('0x3b')],_0x128d90['query']);_0x29320f[_0x9bdb('0x40')]=_[_0x9bdb('0x3e')](_0x128d90[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x547411[_0x9bdb('0x41')]['fields']));_0x29320f[_0x9bdb('0x40')]=_0x29320f['attributes'][_0x9bdb('0x57')]?_0x29320f[_0x9bdb('0x40')]:_0x128d90[_0x9bdb('0x3b')];_0x29320f[_0x9bdb('0x44')]=qs['sort'](_0x547411[_0x9bdb('0x41')]['sort']);_0x29320f[_0x9bdb('0x46')]=qs[_0x9bdb('0x3d')](_['pick'](_0x547411[_0x9bdb('0x41')],_0x128d90[_0x9bdb('0x3d')]));if(_0x547411[_0x9bdb('0x41')][_0x9bdb('0x2d')]){_0x29320f[_0x9bdb('0x46')]=_['merge'](_0x29320f[_0x9bdb('0x46')],{'$or':_[_0x9bdb('0x2f')](_0x29320f[_0x9bdb('0x40')],function(_0x2c9ff2){var _0x5f547e={};_0x5f547e[_0x2c9ff2]={'$like':'%'+_0x547411['query']['filter']+'%'};return _0x5f547e;})});}_0x29320f=_[_0x9bdb('0x48')]({},_0x29320f,_0x547411[_0x9bdb('0x49')]);return _0x4e7034['getLists'](_0x29320f);}})[_0x9bdb('0x27')](function(_0x249cb8){if(_0x249cb8){_0x4a3c35=_0x249cb8[_0x9bdb('0x57')];if(!_0x547411[_0x9bdb('0x41')][_0x9bdb('0x42')]('nolimit')){_0x29320f[_0x9bdb('0x1f')]=qs[_0x9bdb('0x1f')](_0x547411['query'][_0x9bdb('0x1f')]);_0x29320f[_0x9bdb('0x1e')]=qs[_0x9bdb('0x1e')](_0x547411[_0x9bdb('0x41')]['offset']);}return _0x4e7034['getLists'](_0x29320f);}})[_0x9bdb('0x27')](function(_0x5ba5e9){if(_0x5ba5e9){return _0x5ba5e9?{'count':_0x4a3c35,'rows':_0x5ba5e9}:null;}})['then'](respondWithResult(_0x36d106,null))[_0x9bdb('0x4e')](handleError(_0x36d106,null));};exports[_0x9bdb('0x9c')]=function(_0x3a5c9e,_0xb5f403,_0x34a758){var _0x547c8e=moment()[_0x9bdb('0x7d')](_0x9bdb('0x9d'));var _0x49a290,_0x2f7b79;return db['VoiceQueue']['find']({'where':{'id':_0x3a5c9e[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0xb5f403,null))[_0x9bdb('0x27')](function(_0x43be76){if(_0x43be76){_0x2f7b79=_0x43be76;return _0x43be76[_0x9bdb('0x9c')](_0x3a5c9e[_0x9bdb('0x5c')][_0x9bdb('0x82')],_[_0x9bdb('0x59')](_0x3a5c9e['body'],[_0x9bdb('0x82'),'id'])||{});}return null;})['spread'](function(_0x55d7e3){var _0x3ce5be;_0x49a290=_0x55d7e3||[];var _0x4b9100=[];if(_0x55d7e3){for(var _0x458e78=0x0;_0x458e78<_0x55d7e3[_0x9bdb('0x57')];_0x458e78+=0x1){var _0x44c7f2=_0x55d7e3[_0x458e78][_0x9bdb('0x58')]({'plain':!![]});_0x2f7b79[_0x9bdb('0x9e')]=_0x3a5c9e['body'][_0x9bdb('0x9e')]?_0x3a5c9e[_0x9bdb('0x5c')][_0x9bdb('0x9e')]:_0x2f7b79[_0x9bdb('0x9e')];switch(_0x2f7b79['dialCheckDuplicateType']){case _0x9bdb('0x9f'):_0x3ce5be=squel[_0x9bdb('0xa0')]()[_0x9bdb('0xa1')]('cm_hopper')['fromQuery']([_0x9bdb('0xa2'),_0x9bdb('0xa3'),_0x9bdb('0xa4'),_0x9bdb('0xa5'),'VoiceQueueId',_0x9bdb('0x5a'),_0x9bdb('0x5b')],squel[_0x9bdb('0xa6')]()['field'](_0x9bdb('0xa2'),'phone')[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0xa3'))[_0x9bdb('0x83')]('id','ContactId')[_0x9bdb('0x83')](_0x44c7f2[_0x9bdb('0xa7')][_0x9bdb('0xa8')](),_0x9bdb('0xa5'))[_0x9bdb('0x83')](_0x3a5c9e['params']['id'][_0x9bdb('0xa8')](),'VoiceQueueId')[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27','createdAt')[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0x5b'))[_0x9bdb('0xa9')](_0x9bdb('0xaa'))[_0x9bdb('0x46')](_0x9bdb('0xab'))[_0x9bdb('0x46')](_0x9bdb('0xac'),_0x44c7f2[_0x9bdb('0xa7')][_0x9bdb('0xa8')]())[_0x9bdb('0x46')](_0x9bdb('0xad'))[_0x9bdb('0x46')](_0x9bdb('0xae'),squel[_0x9bdb('0xa6')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x9bdb('0xa9')]('cm_hopper_final')[_0x9bdb('0x46')](_0x9bdb('0x89'),_0x3a5c9e['params']['id']['toString']()))[_0x9bdb('0x46')](_0x9bdb('0xae'),squel[_0x9bdb('0xa6')]()['field'](_0x9bdb('0xaf'))[_0x9bdb('0xa9')](_0x9bdb('0xb0'))['where']('VoiceQueueId\x20=\x20?',_0x3a5c9e[_0x9bdb('0x50')]['id']['toString']())))[_0x9bdb('0xa8')]();break;case _0x9bdb('0xb1'):_0x3ce5be=squel[_0x9bdb('0xa0')]()['into'](_0x9bdb('0xb0'))['fromQuery'](['phone',_0x9bdb('0xa3'),'ContactId',_0x9bdb('0xa5'),_0x9bdb('0x63'),_0x9bdb('0x5a'),_0x9bdb('0x5b')],squel[_0x9bdb('0xa6')]()[_0x9bdb('0x83')](_0x9bdb('0xa2'),_0x9bdb('0xa2'))[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0xa3'))[_0x9bdb('0x83')]('id',_0x9bdb('0xa4'))[_0x9bdb('0x83')](_0x44c7f2[_0x9bdb('0xa7')][_0x9bdb('0xa8')](),_0x9bdb('0xa5'))[_0x9bdb('0x83')](_0x3a5c9e[_0x9bdb('0x50')]['id']['toString'](),_0x9bdb('0x63'))[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27','createdAt')[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0x5b'))[_0x9bdb('0xa9')]('cm_contacts')['where'](_0x9bdb('0xab'))[_0x9bdb('0x46')](_0x9bdb('0xac'),_0x44c7f2[_0x9bdb('0xa7')]['toString']())[_0x9bdb('0x46')](_0x9bdb('0xad'))[_0x9bdb('0x46')](_0x9bdb('0xae'),squel[_0x9bdb('0xa6')]()['field'](_0x9bdb('0xaf'))['from'](_0x9bdb('0xb0'))[_0x9bdb('0x46')]('VoiceQueueId\x20=\x20?',_0x3a5c9e['params']['id'][_0x9bdb('0xa8')]())))[_0x9bdb('0xa8')]();break;default:_0x3ce5be=squel[_0x9bdb('0xa0')]()[_0x9bdb('0xa1')](_0x9bdb('0xb0'))['fromQuery']([_0x9bdb('0xa2'),_0x9bdb('0xa3'),_0x9bdb('0xa4'),_0x9bdb('0xa5'),_0x9bdb('0x63'),'createdAt',_0x9bdb('0x5b')],squel['select']()['field'](_0x9bdb('0xa2'),_0x9bdb('0xa2'))[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0xa3'))[_0x9bdb('0x83')]('id','ContactId')['field'](_0x44c7f2['CmListId'][_0x9bdb('0xa8')](),_0x9bdb('0xa5'))[_0x9bdb('0x83')](_0x3a5c9e[_0x9bdb('0x50')]['id'][_0x9bdb('0xa8')](),_0x9bdb('0x63'))[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27','createdAt')['field']('\x27'+_0x547c8e+'\x27','updatedAt')['from'](_0x9bdb('0xaa'))[_0x9bdb('0x46')](_0x9bdb('0xab'))['where'](_0x9bdb('0xac'),_0x44c7f2[_0x9bdb('0xa7')][_0x9bdb('0xa8')]())[_0x9bdb('0x46')](_0x9bdb('0xad')))[_0x9bdb('0xa8')]();}_0x4b9100[_0x9bdb('0x8b')](db[_0x9bdb('0x75')][_0x9bdb('0x41')](_0x3ce5be));}return BPromise['all'](_0x4b9100);}})[_0x9bdb('0x27')](function(){var _0x3b190=[];var _0x4a419d=squel[_0x9bdb('0xa0')]()[_0x9bdb('0xa1')](_0x9bdb('0xb2'))[_0x9bdb('0xb3')]([_0x9bdb('0xb4'),_0x9bdb('0xa2'),_0x9bdb('0xb5'),'createdAt',_0x9bdb('0x5b')],squel[_0x9bdb('0xa6')]()[_0x9bdb('0x83')](_0x9bdb('0xb6'))[_0x9bdb('0x83')](_0x9bdb('0xb7'))[_0x9bdb('0x83')](_0x9bdb('0xb8'))[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0x5a'))[_0x9bdb('0x83')]('\x27'+_0x547c8e+'\x27',_0x9bdb('0x5b'))[_0x9bdb('0xa9')](_0x9bdb('0xb9'),'ci')[_0x9bdb('0x86')](_0x9bdb('0xb0'),'h',_0x9bdb('0xba'))[_0x9bdb('0x46')](_0x9bdb('0xbb'),_0x547c8e)[_0x9bdb('0x46')](_0x9bdb('0xbc'),_0x9bdb('0xbd')))['toString']();_0x3b190['push'](db[_0x9bdb('0x75')][_0x9bdb('0x41')](_0x4a419d));return BPromise['all'](_0x3b190);})[_0x9bdb('0x27')](function(){return _0x49a290;})['then'](respondWithResult(_0xb5f403,null))['catch'](handleError(_0xb5f403,null));};exports[_0x9bdb('0xbe')]=function(_0x498f41,_0x25a192,_0x343ed2){return db[_0x9bdb('0x38')][_0x9bdb('0x33')]({'where':{'id':_0x498f41[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x25a192,null))[_0x9bdb('0x27')](function(_0x200370){if(_0x200370){return _0x200370['removeLists'](_0x498f41[_0x9bdb('0x41')][_0x9bdb('0x82')]);}})['then'](function(_0x2d5d8e){if(_0x2d5d8e){return db[_0x9bdb('0x62')][_0x9bdb('0x28')]({'where':{'ListId':_0x498f41[_0x9bdb('0x41')][_0x9bdb('0x82')],'VoiceQueueId':_0x498f41[_0x9bdb('0x50')]['id']}})[_0x9bdb('0x27')](function(){return _0x2d5d8e;});}})[_0x9bdb('0x27')](respondWithStatusCode(_0x25a192,null))['catch'](handleError(_0x25a192,null));};exports[_0x9bdb('0xbf')]=function(_0x2590ae,_0x251494,_0x585077){var _0x3875d1={};var _0x15df7d={};var _0x3898b0;var _0x7fed57;return db[_0x9bdb('0x38')]['findOne']({'where':{'id':_0x2590ae['params']['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x251494,null))[_0x9bdb('0x27')](function(_0x5a8b90){if(_0x5a8b90){_0x3898b0=_0x5a8b90;_0x15df7d[_0x9bdb('0x3b')]=_[_0x9bdb('0x3c')](db[_0x9bdb('0xc0')]['rawAttributes']);_0x15df7d[_0x9bdb('0x41')]=_[_0x9bdb('0x3c')](_0x2590ae[_0x9bdb('0x41')]);_0x15df7d[_0x9bdb('0x3d')]=_[_0x9bdb('0x3e')](_0x15df7d['model'],_0x15df7d['query']);_0x3875d1[_0x9bdb('0x40')]=_['intersection'](_0x15df7d[_0x9bdb('0x3b')],qs[_0x9bdb('0x3f')](_0x2590ae['query'][_0x9bdb('0x3f')]));_0x3875d1['attributes']=_0x3875d1[_0x9bdb('0x40')][_0x9bdb('0x57')]?_0x3875d1[_0x9bdb('0x40')]:_0x15df7d[_0x9bdb('0x3b')];_0x3875d1[_0x9bdb('0x44')]=qs['sort'](_0x2590ae[_0x9bdb('0x41')][_0x9bdb('0x45')]);_0x3875d1[_0x9bdb('0x46')]=qs['filters'](_[_0x9bdb('0x47')](_0x2590ae['query'],_0x15df7d['filters']));if(_0x2590ae[_0x9bdb('0x41')]['filter']){_0x3875d1[_0x9bdb('0x46')]=_[_0x9bdb('0x48')](_0x3875d1[_0x9bdb('0x46')],{'$or':_['map'](_0x3875d1['attributes'],function(_0x46d95c){var _0x350f7b={};_0x350f7b[_0x46d95c]={'$like':'%'+_0x2590ae['query'][_0x9bdb('0x2d')]+'%'};return _0x350f7b;})});}_0x3875d1=_[_0x9bdb('0x48')]({},_0x3875d1,_0x2590ae[_0x9bdb('0x49')]);return _0x3898b0[_0x9bdb('0xbf')](_0x3875d1);}})[_0x9bdb('0x27')](function(_0x2f7dfe){if(_0x2f7dfe){_0x7fed57=_0x2f7dfe[_0x9bdb('0x57')];if(!_0x2590ae[_0x9bdb('0x41')][_0x9bdb('0x42')]('nolimit')){_0x3875d1[_0x9bdb('0x1f')]=qs[_0x9bdb('0x1f')](_0x2590ae['query'][_0x9bdb('0x1f')]);_0x3875d1['offset']=qs[_0x9bdb('0x1e')](_0x2590ae[_0x9bdb('0x41')]['offset']);}return _0x3898b0['getBlackLists'](_0x3875d1);}})['then'](function(_0x26309c){if(_0x26309c){return _0x26309c?{'count':_0x7fed57,'rows':_0x26309c}:null;}})['then'](respondWithResult(_0x251494,null))[_0x9bdb('0x4e')](handleError(_0x251494,null));};exports['addBlackLists']=function(_0x362858,_0x29a7c0,_0x33bbe6){var _0x5d15ea,_0x13c7b0;return db[_0x9bdb('0x38')][_0x9bdb('0x33')]({'where':{'id':_0x362858['params']['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x29a7c0,null))[_0x9bdb('0x27')](function(_0x546b25){if(_0x546b25){_0x13c7b0=_0x546b25;return _0x546b25['addBlackLists'](_0x362858[_0x9bdb('0x5c')][_0x9bdb('0x82')],_[_0x9bdb('0x59')](_0x362858['body'],[_0x9bdb('0x82'),'id'])||{});}return null;})['spread'](function(_0x1ca244){var _0xc49351;_0x5d15ea=_0x1ca244||[];var _0x1075ea=[];if(_0x1ca244){for(var _0x37fec1=0x0;_0x37fec1<_0x1ca244[_0x9bdb('0x57')];_0x37fec1+=0x1){var _0xb544ba=_0x1ca244[_0x37fec1][_0x9bdb('0x58')]({'plain':!![]});_0xc49351=squel[_0x9bdb('0xa0')]()[_0x9bdb('0xa1')](_0x9bdb('0xc1'))[_0x9bdb('0xb3')]([_0x9bdb('0xa2'),_0x9bdb('0xa4'),_0x9bdb('0xa5'),_0x9bdb('0x63'),_0x9bdb('0x5a'),_0x9bdb('0x5b')],squel[_0x9bdb('0xa6')]()[_0x9bdb('0x83')](_0x9bdb('0xa2'),_0x9bdb('0xa2'))[_0x9bdb('0x83')]('id',_0x9bdb('0xa4'))[_0x9bdb('0x83')](_0xb544ba[_0x9bdb('0xa7')]['toString'](),'ListId')[_0x9bdb('0x83')](_0x362858[_0x9bdb('0x50')]['id'][_0x9bdb('0xa8')](),'VoiceQueueId')['field'](_0x9bdb('0xc2'),'createdAt')[_0x9bdb('0x83')](_0x9bdb('0xc2'),_0x9bdb('0x5b'))['from'](_0x9bdb('0xaa'))[_0x9bdb('0x46')](_0x9bdb('0xab'))[_0x9bdb('0x46')](_0x9bdb('0xac'),_0xb544ba['CmListId'][_0x9bdb('0xa8')]())[_0x9bdb('0x46')](_0x9bdb('0xad')))[_0x9bdb('0xa8')]();_0x1075ea[_0x9bdb('0x8b')](db[_0x9bdb('0x75')][_0x9bdb('0x41')](_0xc49351));}return BPromise['all'](_0x1075ea);}})['then'](function(){return _0x5d15ea;})[_0x9bdb('0x27')](respondWithResult(_0x29a7c0,null))['catch'](handleError(_0x29a7c0,null));};exports[_0x9bdb('0xc3')]=function(_0x3286fe,_0x3e0bf1,_0x441ddb){return db['VoiceQueue'][_0x9bdb('0x33')]({'where':{'id':_0x3286fe['params']['id']}})[_0x9bdb('0x27')](handleEntityNotFound(_0x3e0bf1,null))[_0x9bdb('0x27')](function(_0x4b68ef){if(_0x4b68ef){return _0x4b68ef[_0x9bdb('0xc3')](_0x3286fe[_0x9bdb('0x41')][_0x9bdb('0x82')]);}})[_0x9bdb('0x27')](function(_0x314c55){if(_0x314c55){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x3286fe[_0x9bdb('0x41')][_0x9bdb('0x82')],'VoiceQueueId':_0x3286fe[_0x9bdb('0x50')]['id']}})['then'](function(){return _0x314c55;});}})[_0x9bdb('0x27')](respondWithStatusCode(_0x3e0bf1,null))[_0x9bdb('0x4e')](handleError(_0x3e0bf1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5ed9cf4..754a9b3 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 _0x5a9e=['VoiceQueue','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x5a9e,0xb6));var _0xe5a9=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x5a9e[_0x55a89e];return _0x3aa2bd;};'use strict';var EventEmitter=require(_0xe5a9('0x0'));var VoiceQueue=require(_0xe5a9('0x1'))['db'][_0xe5a9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe5a9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5a9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1257dc){return function(_0x9e88d,_0x161669,_0x2dc160){VoiceQueueEvents[_0xe5a9('0x5')](_0x1257dc+':'+_0x9e88d['id'],_0x9e88d);VoiceQueueEvents[_0xe5a9('0x5')](_0x1257dc,_0x9e88d);_0x2dc160(null);};}for(var e in events){if(events[_0xe5a9('0x6')](e)){var event=events[e];VoiceQueue[_0xe5a9('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xd9b6=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd9b6,0x193));var _0x6d9b=function(_0x15cc17,_0x5a498d){_0x15cc17=_0x15cc17-0x0;var _0x9607cc=_0xd9b6[_0x15cc17];return _0x9607cc;};'use strict';var EventEmitter=require(_0x6d9b('0x0'));var VoiceQueue=require(_0x6d9b('0x1'))['db'][_0x6d9b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6d9b('0x3')](0x0);var events={'afterCreate':_0x6d9b('0x4'),'afterUpdate':_0x6d9b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48512f){return function(_0x3592c9,_0x46dfef,_0x22a086){VoiceQueueEvents[_0x6d9b('0x6')](_0x48512f+':'+_0x3592c9['id'],_0x3592c9);VoiceQueueEvents[_0x6d9b('0x6')](_0x48512f,_0x3592c9);_0x22a086(null);};}for(var e in events){if(events[_0x6d9b('0x7')](e)){var event=events[e];VoiceQueue[_0x6d9b('0x8')](e,emitEvent(event));}}module[_0x6d9b('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a6c43e8..73bcaee 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(_0x289fd4,_0xd34ba6){var _0x3d4a88=function(_0x2a3726){while(--_0x2a3726){_0x289fd4['push'](_0x289fd4['shift']());}};_0x3d4a88(++_0xd34ba6);}(_0x008c,0x188));var _0xc008=function(_0x54ce4a,_0x502cba){_0x54ce4a=_0x54ce4a-0x0;var _0x279dce=_0x008c[_0x54ce4a];return _0x279dce;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x7ea297,_0x1e25e7){var _0x2288fb=function(_0x161e05){while(--_0x161e05){_0x7ea297['push'](_0x7ea297['shift']());}};_0x2288fb(++_0x1e25e7);}(_0xedd9,0xfc));var _0x9edd=function(_0x12bb8b,_0x204d03){_0x12bb8b=_0x12bb8b-0x0;var _0x58c9f3=_0xedd9[_0x12bb8b];return _0x58c9f3;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 81ceb41..f177016 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 _0xe64d=['VoiceQueue','findAll','options','raw','where','include','model','attributes','map','ShowVoiceQueue','find','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue'];(function(_0x4091b4,_0x2e6fc4){var _0x5120f1=function(_0xf27c2c){while(--_0xf27c2c){_0x4091b4['push'](_0x4091b4['shift']());}};_0x5120f1(++_0x2e6fc4);}(_0xe64d,0xa3));var _0xde64=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xe64d[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0xde64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde64('0x1'));var rs=require(_0xde64('0x2'));var fs=require('fs');var Redis=require(_0xde64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde64('0x4'));var logger=require(_0xde64('0x5'))(_0xde64('0x6'));var config=require('../../config/environment');var jayson=require(_0xde64('0x7'));var client=jayson[_0xde64('0x8')][_0xde64('0x9')]({'port':0x232a});config[_0xde64('0xa')]=_['defaults'](config['redis'],{'host':_0xde64('0xb'),'port':0x18eb});var socket=require(_0xde64('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1a1300,_0x1a455a,_0x23ddb9){return new BPromise(function(_0x1b8bcc,_0x3adc88){return client[_0xde64('0xd')](_0x1a1300,_0x23ddb9)[_0xde64('0xe')](function(_0x54d5db){logger[_0xde64('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x1a455a,'request\x20sent');logger[_0xde64('0x10')](_0xde64('0x11'),_0x1a455a,_0xde64('0x12'),JSON[_0xde64('0x13')](_0x54d5db));if(_0x54d5db[_0xde64('0x14')]){if(_0x54d5db[_0xde64('0x14')][_0xde64('0x15')]===0x1f4){logger['error'](_0xde64('0x16'),_0x1a455a,_0x54d5db[_0xde64('0x14')][_0xde64('0x17')]);return _0x3adc88(_0x54d5db[_0xde64('0x14')][_0xde64('0x17')]);}logger[_0xde64('0x14')](_0xde64('0x16'),_0x1a455a,_0x54d5db['error'][_0xde64('0x17')]);return _0x1b8bcc(_0x54d5db[_0xde64('0x14')][_0xde64('0x17')]);}else{logger['info'](_0xde64('0x16'),_0x1a455a,'request\x20sent');_0x1b8bcc(_0x54d5db[_0xde64('0x18')][_0xde64('0x17')]);}})[_0xde64('0x19')](function(_0x3bf478){logger[_0xde64('0x14')](_0xde64('0x16'),_0x1a455a,_0x3bf478);_0x3adc88(_0x3bf478);});});}exports[_0xde64('0x1a')]=function(_0x65960b){var _0xf89beb=this;return new Promise(function(_0x3afad0,_0x4cc593){return db[_0xde64('0x1b')][_0xde64('0x1c')]({'raw':_0x65960b[_0xde64('0x1d')]?_0x65960b[_0xde64('0x1d')][_0xde64('0x1e')]===undefined?!![]:![]:!![],'where':_0x65960b[_0xde64('0x1d')]?_0x65960b[_0xde64('0x1d')][_0xde64('0x1f')]||null:null,'attributes':_0x65960b[_0xde64('0x1d')]?_0x65960b[_0xde64('0x1d')]['attributes']||null:null,'limit':_0x65960b[_0xde64('0x1d')]?_0x65960b['options']['limit']||null:null,'include':_0x65960b['options']?_0x65960b[_0xde64('0x1d')][_0xde64('0x20')]?_['map'](_0x65960b[_0xde64('0x1d')][_0xde64('0x20')],function(_0x249fe8){return{'model':db[_0x249fe8[_0xde64('0x21')]],'as':_0x249fe8['as'],'attributes':_0x249fe8[_0xde64('0x22')],'include':_0x249fe8[_0xde64('0x20')]?_[_0xde64('0x23')](_0x249fe8[_0xde64('0x20')],function(_0x37f206){return{'model':db[_0x37f206[_0xde64('0x21')]],'as':_0x37f206['as'],'attributes':_0x37f206[_0xde64('0x22')],'include':_0x37f206[_0xde64('0x20')]?_['map'](_0x37f206[_0xde64('0x20')],function(_0x597d1e){return{'model':db[_0x597d1e[_0xde64('0x21')]],'as':_0x597d1e['as'],'attributes':_0x597d1e[_0xde64('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53e297){logger['info']('GetVoiceQueue',_0x65960b);logger[_0xde64('0x10')](_0xde64('0x1a'),_0x65960b,JSON[_0xde64('0x13')](_0x53e297));_0x3afad0(_0x53e297);})[_0xde64('0x19')](function(_0x3387e9){logger[_0xde64('0x14')]('GetVoiceQueue',_0x3387e9[_0xde64('0x17')],_0x65960b);_0x4cc593(_0xf89beb[_0xde64('0x14')](0x1f4,_0x3387e9[_0xde64('0x17')]));});});};exports[_0xde64('0x24')]=function(_0x51961f){var _0x424bd2=this;return new Promise(function(_0x23f7e5,_0x5b2bae){return db[_0xde64('0x1b')][_0xde64('0x25')]({'raw':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')][_0xde64('0x1e')]===undefined?!![]:![]:!![],'where':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')][_0xde64('0x1f')]||null:null,'attributes':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')]['attributes']||null:null,'include':_0x51961f[_0xde64('0x1d')]?_0x51961f[_0xde64('0x1d')][_0xde64('0x20')]?_[_0xde64('0x23')](_0x51961f[_0xde64('0x1d')][_0xde64('0x20')],function(_0x510e08){return{'model':db[_0x510e08['model']],'as':_0x510e08['as'],'attributes':_0x510e08[_0xde64('0x22')],'include':_0x510e08[_0xde64('0x20')]?_[_0xde64('0x23')](_0x510e08[_0xde64('0x20')],function(_0x2abbd1){return{'model':db[_0x2abbd1['model']],'as':_0x2abbd1['as'],'attributes':_0x2abbd1['attributes'],'include':_0x2abbd1[_0xde64('0x20')]?_[_0xde64('0x23')](_0x2abbd1[_0xde64('0x20')],function(_0x1389ea){return{'model':db[_0x1389ea[_0xde64('0x21')]],'as':_0x1389ea['as'],'attributes':_0x1389ea[_0xde64('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e6696){logger[_0xde64('0xf')]('ShowVoiceQueue',_0x51961f);logger[_0xde64('0x10')]('ShowVoiceQueue',_0x51961f,JSON[_0xde64('0x13')](_0x5e6696));_0x23f7e5(_0x5e6696);})['catch'](function(_0x4fc39f){logger[_0xde64('0x14')](_0xde64('0x24'),_0x4fc39f[_0xde64('0x17')],_0x51961f);_0x5b2bae(_0x424bd2['error'](0x1f4,_0x4fc39f[_0xde64('0x17')]));});});}; \ No newline at end of file +var _0x2157=['map','model','ShowVoiceQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0x2157,0x82));var _0x7215=function(_0x562244,_0x59072a){_0x562244=_0x562244-0x0;var _0x1785d0=_0x2157[_0x562244];return _0x1785d0;};'use strict';var _=require(_0x7215('0x0'));var util=require(_0x7215('0x1'));var moment=require(_0x7215('0x2'));var BPromise=require('bluebird');var rs=require(_0x7215('0x3'));var fs=require('fs');var Redis=require(_0x7215('0x4'));var db=require(_0x7215('0x5'))['db'];var utils=require(_0x7215('0x6'));var logger=require(_0x7215('0x7'))(_0x7215('0x8'));var config=require(_0x7215('0x9'));var jayson=require(_0x7215('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7215('0xb')](config[_0x7215('0xc')],{'host':_0x7215('0xd'),'port':0x18eb});var socket=require(_0x7215('0xe'))(new Redis(config['redis']));require(_0x7215('0xf'))[_0x7215('0x10')](socket);function respondWithRpcPromise(_0x2ab838,_0x3e3b89,_0x455b28){return new BPromise(function(_0x52f88e,_0x3139fc){return client[_0x7215('0x11')](_0x2ab838,_0x455b28)[_0x7215('0x12')](function(_0x5bf45b){logger[_0x7215('0x13')](_0x7215('0x14'),_0x3e3b89,_0x7215('0x15'));logger[_0x7215('0x16')](_0x7215('0x17'),_0x3e3b89,_0x7215('0x15'),JSON[_0x7215('0x18')](_0x5bf45b));if(_0x5bf45b['error']){if(_0x5bf45b[_0x7215('0x19')][_0x7215('0x1a')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x3e3b89,_0x5bf45b[_0x7215('0x19')]['message']);return _0x3139fc(_0x5bf45b[_0x7215('0x19')][_0x7215('0x1b')]);}logger['error'](_0x7215('0x14'),_0x3e3b89,_0x5bf45b['error']['message']);return _0x52f88e(_0x5bf45b[_0x7215('0x19')][_0x7215('0x1b')]);}else{logger[_0x7215('0x13')](_0x7215('0x14'),_0x3e3b89,'request\x20sent');_0x52f88e(_0x5bf45b[_0x7215('0x1c')][_0x7215('0x1b')]);}})[_0x7215('0x1d')](function(_0x532e11){logger[_0x7215('0x19')](_0x7215('0x14'),_0x3e3b89,_0x532e11);_0x3139fc(_0x532e11);});});}exports[_0x7215('0x1e')]=function(_0x1bcf50){var _0x12935b=this;return new Promise(function(_0xdb2519,_0x156d2f){return db[_0x7215('0x1f')]['findAll']({'raw':_0x1bcf50[_0x7215('0x20')]?_0x1bcf50['options'][_0x7215('0x21')]===undefined?!![]:![]:!![],'where':_0x1bcf50['options']?_0x1bcf50[_0x7215('0x20')][_0x7215('0x22')]||null:null,'attributes':_0x1bcf50['options']?_0x1bcf50[_0x7215('0x20')][_0x7215('0x23')]||null:null,'limit':_0x1bcf50[_0x7215('0x20')]?_0x1bcf50['options'][_0x7215('0x24')]||null:null,'include':_0x1bcf50[_0x7215('0x20')]?_0x1bcf50[_0x7215('0x20')][_0x7215('0x25')]?_[_0x7215('0x26')](_0x1bcf50[_0x7215('0x20')]['include'],function(_0x1cfe85){return{'model':db[_0x1cfe85[_0x7215('0x27')]],'as':_0x1cfe85['as'],'attributes':_0x1cfe85[_0x7215('0x23')],'include':_0x1cfe85[_0x7215('0x25')]?_[_0x7215('0x26')](_0x1cfe85[_0x7215('0x25')],function(_0x15edae){return{'model':db[_0x15edae[_0x7215('0x27')]],'as':_0x15edae['as'],'attributes':_0x15edae[_0x7215('0x23')],'include':_0x15edae[_0x7215('0x25')]?_['map'](_0x15edae['include'],function(_0x254965){return{'model':db[_0x254965[_0x7215('0x27')]],'as':_0x254965['as'],'attributes':_0x254965[_0x7215('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7215('0x12')](function(_0x12dee3){logger[_0x7215('0x13')](_0x7215('0x1e'),_0x1bcf50);logger[_0x7215('0x16')](_0x7215('0x1e'),_0x1bcf50,JSON[_0x7215('0x18')](_0x12dee3));_0xdb2519(_0x12dee3);})[_0x7215('0x1d')](function(_0x19e749){logger[_0x7215('0x19')](_0x7215('0x1e'),_0x19e749['message'],_0x1bcf50);_0x156d2f(_0x12935b['error'](0x1f4,_0x19e749[_0x7215('0x1b')]));});});};exports[_0x7215('0x28')]=function(_0x3fa621){var _0x3bf207=this;return new Promise(function(_0x1f146c,_0x1184ad){return db['VoiceQueue'][_0x7215('0x29')]({'raw':_0x3fa621[_0x7215('0x20')]?_0x3fa621[_0x7215('0x20')][_0x7215('0x21')]===undefined?!![]:![]:!![],'where':_0x3fa621['options']?_0x3fa621[_0x7215('0x20')][_0x7215('0x22')]||null:null,'attributes':_0x3fa621[_0x7215('0x20')]?_0x3fa621[_0x7215('0x20')][_0x7215('0x23')]||null:null,'include':_0x3fa621['options']?_0x3fa621[_0x7215('0x20')][_0x7215('0x25')]?_['map'](_0x3fa621[_0x7215('0x20')][_0x7215('0x25')],function(_0x116e0e){return{'model':db[_0x116e0e[_0x7215('0x27')]],'as':_0x116e0e['as'],'attributes':_0x116e0e[_0x7215('0x23')],'include':_0x116e0e[_0x7215('0x25')]?_[_0x7215('0x26')](_0x116e0e[_0x7215('0x25')],function(_0x37b802){return{'model':db[_0x37b802[_0x7215('0x27')]],'as':_0x37b802['as'],'attributes':_0x37b802['attributes'],'include':_0x37b802[_0x7215('0x25')]?_['map'](_0x37b802[_0x7215('0x25')],function(_0x50c67f){return{'model':db[_0x50c67f[_0x7215('0x27')]],'as':_0x50c67f['as'],'attributes':_0x50c67f[_0x7215('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7215('0x12')](function(_0x508513){logger[_0x7215('0x13')]('ShowVoiceQueue',_0x3fa621);logger[_0x7215('0x16')](_0x7215('0x28'),_0x3fa621,JSON[_0x7215('0x18')](_0x508513));_0x1f146c(_0x508513);})['catch'](function(_0xf3cf57){logger['error'](_0x7215('0x28'),_0xf3cf57[_0x7215('0x1b')],_0x3fa621);_0x1184ad(_0x3bf207[_0x7215('0x19')](0x1f4,_0xf3cf57[_0x7215('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 06c5794..1b59121 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 _0xc9f9=['./voiceQueue.events','save','remove','emit','removeListener','register','voiceQueue:'];(function(_0x401658,_0xa8fb28){var _0x55b212=function(_0x1854cf){while(--_0x1854cf){_0x401658['push'](_0x401658['shift']());}};_0x55b212(++_0xa8fb28);}(_0xc9f9,0x1d5));var _0x9c9f=function(_0x43dd42,_0x3afd34){_0x43dd42=_0x43dd42-0x0;var _0x599621=_0xc9f9[_0x43dd42];return _0x599621;};'use strict';var VoiceQueueEvents=require(_0x9c9f('0x0'));var events=[_0x9c9f('0x1'),_0x9c9f('0x2'),'update'];function createListener(_0x384bf7,_0x22daa6){return function(_0x1e9fc8){_0x22daa6[_0x9c9f('0x3')](_0x384bf7,_0x1e9fc8);};}function removeListener(_0x351131,_0x5a5f9d){return function(){VoiceQueueEvents[_0x9c9f('0x4')](_0x351131,_0x5a5f9d);};}exports[_0x9c9f('0x5')]=function(_0x45bbd5){for(var _0xb8e133=0x0,_0x39a330=events['length'];_0xb8e133<_0x39a330;_0xb8e133++){var _0x15dfda=events[_0xb8e133];var _0x3a183a=createListener(_0x9c9f('0x6')+_0x15dfda,_0x45bbd5);VoiceQueueEvents['on'](_0x15dfda,_0x3a183a);}}; \ No newline at end of file +var _0x73fd=['emit','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0x5b23bb,_0xdfb512){var _0x1996d7=function(_0x3badd4){while(--_0x3badd4){_0x5b23bb['push'](_0x5b23bb['shift']());}};_0x1996d7(++_0xdfb512);}(_0x73fd,0xca));var _0xd73f=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x73fd[_0x38e177];return _0x1faf15;};'use strict';var VoiceQueueEvents=require(_0xd73f('0x0'));var events=['save',_0xd73f('0x1'),_0xd73f('0x2')];function createListener(_0x4e8ae0,_0x33b122){return function(_0x3c99e8){_0x33b122[_0xd73f('0x3')](_0x4e8ae0,_0x3c99e8);};}function removeListener(_0x55e777,_0x57352d){return function(){VoiceQueueEvents['removeListener'](_0x55e777,_0x57352d);};}exports['register']=function(_0x34b3e6){for(var _0x40fc17=0x0,_0x65cab7=events['length'];_0x40fc17<_0x65cab7;_0x40fc17++){var _0x188574=events[_0x40fc17];var _0x2e0677=createListener(_0xd73f('0x4')+_0x188574,_0x34b3e6);VoiceQueueEvents['on'](_0x188574,_0x2e0677);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 3b07b1b..a88c44d 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 _0xd673=['index','/describe','isAuthenticated','describe','/index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x213e28,_0x1c5271){var _0x3f50d=function(_0x13f1bd){while(--_0x13f1bd){_0x213e28['push'](_0x213e28['shift']());}};_0x3f50d(++_0x1c5271);}(_0xd673,0x198));var _0x3d67=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd673[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x3d67('0x0'));var util=require(_0x3d67('0x1'));var path=require(_0x3d67('0x2'));var timeout=require(_0x3d67('0x3'));var express=require(_0x3d67('0x4'));var router=express[_0x3d67('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3d67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d67('0x7'));var controller=require(_0x3d67('0x8'));router[_0x3d67('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d67('0xa')]);router[_0x3d67('0x9')](_0x3d67('0xb'),auth[_0x3d67('0xc')](),controller[_0x3d67('0xd')]);router[_0x3d67('0x9')](_0x3d67('0xe'),auth[_0x3d67('0xc')](),controller['getVoiceQueuesReport']);router[_0x3d67('0x9')](_0x3d67('0xf'),auth[_0x3d67('0xc')](),controller[_0x3d67('0x10')]);router[_0x3d67('0x11')]('/',auth[_0x3d67('0xc')](),controller[_0x3d67('0x12')]);router[_0x3d67('0x13')](_0x3d67('0xf'),auth[_0x3d67('0xc')](),controller[_0x3d67('0x14')]);router[_0x3d67('0x15')](_0x3d67('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd994=['/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','/describe','isAuthenticated','get','/index','getVoiceQueuesReport'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd994,0xd6));var _0x4d99=function(_0x4dbe8c,_0x320bd){_0x4dbe8c=_0x4dbe8c-0x0;var _0x237c4a=_0xd994[_0x4dbe8c];return _0x237c4a;};'use strict';var multer=require(_0x4d99('0x0'));var util=require(_0x4d99('0x1'));var path=require(_0x4d99('0x2'));var timeout=require(_0x4d99('0x3'));var express=require('express');var router=express[_0x4d99('0x4')]();var fs_extra=require(_0x4d99('0x5'));var auth=require(_0x4d99('0x6'));var interaction=require(_0x4d99('0x7'));var config=require(_0x4d99('0x8'));var controller=require(_0x4d99('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4d99('0xa')]);router['get'](_0x4d99('0xb'),auth[_0x4d99('0xc')](),controller['describe']);router[_0x4d99('0xd')](_0x4d99('0xe'),auth['isAuthenticated'](),controller[_0x4d99('0xf')]);router[_0x4d99('0xd')](_0x4d99('0x10'),auth[_0x4d99('0xc')](),controller['show']);router[_0x4d99('0x11')]('/',auth[_0x4d99('0xc')](),controller[_0x4d99('0x12')]);router['put'](_0x4d99('0x10'),auth[_0x4d99('0xc')](),controller[_0x4d99('0x13')]);router[_0x4d99('0x14')](_0x4d99('0x10'),auth[_0x4d99('0xc')](),controller[_0x4d99('0x15')]);module[_0x4d99('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 86ee506..1170b1c 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 _0x7795=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x4056fc,_0x230d63){var _0x57594e=function(_0xc342){while(--_0xc342){_0x4056fc['push'](_0x4056fc['shift']());}};_0x57594e(++_0x230d63);}(_0x7795,0x141));var _0x5779=function(_0xd8cc73,_0x52ff25){_0xd8cc73=_0xd8cc73-0x0;var _0x1e9339=_0x7795[_0xd8cc73];return _0x1e9339;};'use strict';var Sequelize=require(_0x5779('0x0'));var moment=require(_0x5779('0x1'));module['exports']={'type':{'type':Sequelize[_0x5779('0x2')]},'uniqueid':{'type':Sequelize[_0x5779('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x5779('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5779('0x3')],'set':function(_0x583f83){var _0x3e0c06=moment(_0x583f83);var _0xa1ce06=moment(this[_0x5779('0x4')](_0x5779('0x5')))[_0x5779('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x576850=_0x3e0c06[_0x5779('0x7')](_0xa1ce06,_0x5779('0x8'));this[_0x5779('0x9')](_0x5779('0xa'),_0x583f83);this['setDataValue'](_0x5779('0xb'),_0x576850||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x5779('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5779('0x3')]},'queuecallerexit':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x5779('0xe')},'originalposition':{'type':Sequelize[_0x5779('0xc')]},'channel':{'type':Sequelize[_0x5779('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5779('0x2')]},'connectedlinename':{'type':Sequelize[_0x5779('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5779('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5779('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5779('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5779('0x2')]},'transfer':{'type':Sequelize[_0x5779('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5779('0x2')],'comment':_0x5779('0xf')},'transferexten':{'type':Sequelize[_0x5779('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5779('0x2')]},'disposition':{'type':Sequelize[_0x5779('0x2')]},'secondDisposition':{'type':Sequelize[_0x5779('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5779('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5779('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1116=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x1349bc,_0x1f6a23){var _0x41d28e=function(_0x1e3ca4){while(--_0x1e3ca4){_0x1349bc['push'](_0x1349bc['shift']());}};_0x41d28e(++_0x1f6a23);}(_0x1116,0x132));var _0x6111=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x1116[_0x25248b];return _0x509939;};'use strict';var Sequelize=require(_0x6111('0x0'));var moment=require('moment');module[_0x6111('0x1')]={'type':{'type':Sequelize[_0x6111('0x2')]},'uniqueid':{'type':Sequelize[_0x6111('0x2')]},'calleridnum':{'type':Sequelize[_0x6111('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6111('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x6111('0x3')],'set':function(_0x42b484){var _0x3e4c70=moment(_0x42b484);var _0x583ae5=moment(this[_0x6111('0x4')](_0x6111('0x5')))[_0x6111('0x6')](_0x6111('0x7'));var _0x4d1a96=_0x3e4c70[_0x6111('0x8')](_0x583ae5,_0x6111('0x9'));this[_0x6111('0xa')](_0x6111('0xb'),_0x42b484);this[_0x6111('0xa')](_0x6111('0xc'),_0x4d1a96||null);}},'position':{'type':Sequelize[_0x6111('0xd')]},'count':{'type':Sequelize[_0x6111('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6111('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6111('0x3')]},'queuecallerexit':{'type':Sequelize[_0x6111('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6111('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x6111('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x6111('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6111('0x2')]},'connectedlinename':{'type':Sequelize[_0x6111('0x2')]},'accountcode':{'type':Sequelize[_0x6111('0x2')]},'context':{'type':Sequelize[_0x6111('0x2')]},'exten':{'type':Sequelize[_0x6111('0x2')]},'priority':{'type':Sequelize[_0x6111('0x2')]},'holdtime':{'type':Sequelize[_0x6111('0xd')]},'mohtime':{'type':Sequelize[_0x6111('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6111('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6111('0x2')]},'transfer':{'type':Sequelize[_0x6111('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6111('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6111('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6111('0x2')]},'secondDisposition':{'type':Sequelize[_0x6111('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6111('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6111('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 6d2e3c7..3e66b39 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 _0x2f56=['fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','name','index','map','VoiceQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2f56,0x19e));var _0x62f5=function(_0x2dba2e,_0x1120bf){_0x2dba2e=_0x2dba2e-0x0;var _0x58f8ca=_0x2f56[_0x2dba2e];return _0x58f8ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62f5('0x0'));var zipdir=require(_0x62f5('0x1'));var jsonpatch=require(_0x62f5('0x2'));var rp=require(_0x62f5('0x3'));var moment=require(_0x62f5('0x4'));var BPromise=require(_0x62f5('0x5'));var Mustache=require(_0x62f5('0x6'));var util=require(_0x62f5('0x7'));var path=require(_0x62f5('0x8'));var sox=require(_0x62f5('0x9'));var csv=require('to-csv');var ejs=require(_0x62f5('0xa'));var fs=require('fs');var fs_extra=require(_0x62f5('0xb'));var _=require(_0x62f5('0xc'));var squel=require(_0x62f5('0xd'));var crypto=require(_0x62f5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x62f5('0xf'));var toCsv=require(_0x62f5('0x10'));var querystring=require(_0x62f5('0x11'));var Papa=require(_0x62f5('0x12'));var Redis=require(_0x62f5('0x13'));var authService=require(_0x62f5('0x14'));var qs=require(_0x62f5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62f5('0x16'));var logger=require(_0x62f5('0x17'))(_0x62f5('0x18'));var utils=require('../../config/utils');var config=require(_0x62f5('0x19'));var licenseUtil=require(_0x62f5('0x1a'));var db=require(_0x62f5('0x1b'))['db'];config['redis']=_[_0x62f5('0x1c')](config[_0x62f5('0x1d')],{'host':_0x62f5('0x1e'),'port':0x18eb});var socket=require(_0x62f5('0x1f'))(new Redis(config[_0x62f5('0x1d')]));require(_0x62f5('0x20'))[_0x62f5('0x21')](socket);function respondWithStatusCode(_0x33fa71,_0x329099){_0x329099=_0x329099||0xcc;return function(_0x133cb9){if(_0x133cb9){return _0x33fa71[_0x62f5('0x22')](_0x329099);}return _0x33fa71[_0x62f5('0x23')](_0x329099)[_0x62f5('0x24')]();};}function respondWithResult(_0x2ed8d0,_0x342c5d){_0x342c5d=_0x342c5d||0xc8;return function(_0x2dcdc9){if(_0x2dcdc9){return _0x2ed8d0[_0x62f5('0x23')](_0x342c5d)[_0x62f5('0x25')](_0x2dcdc9);}};}function respondWithFilteredResult(_0x5a22e7,_0x250337){return function(_0x27b9c3){if(_0x27b9c3){var _0x50176a=typeof _0x250337[_0x62f5('0x26')]==='undefined'&&typeof _0x250337['limit']===_0x62f5('0x27');var _0x23cdd4=_0x27b9c3[_0x62f5('0x28')];var _0x147125=_0x50176a?0x0:_0x250337[_0x62f5('0x26')];var _0x167a14=_0x50176a?_0x27b9c3[_0x62f5('0x28')]:_0x250337[_0x62f5('0x26')]+_0x250337['limit'];var _0x5555da;if(_0x167a14>=_0x23cdd4){_0x167a14=_0x23cdd4;_0x5555da=0xc8;}else{_0x5555da=0xce;}_0x5a22e7['status'](_0x5555da);return _0x5a22e7[_0x62f5('0x29')]('Content-Range',_0x147125+'-'+_0x167a14+'/'+_0x23cdd4)[_0x62f5('0x25')](_0x27b9c3);}return null;};}function patchUpdates(_0x3dec13){return function(_0x1a45f4){try{jsonpatch[_0x62f5('0x2a')](_0x1a45f4,_0x3dec13,!![]);}catch(_0x545ac3){return BPromise[_0x62f5('0x2b')](_0x545ac3);}return _0x1a45f4[_0x62f5('0x2c')]();};}function saveUpdates(_0x3dc16f,_0x16cb9e){return function(_0x3e7666){if(_0x3e7666){return _0x3e7666[_0x62f5('0x2d')](_0x3dc16f)[_0x62f5('0x2e')](function(_0x42a5ef){return _0x42a5ef;});}return null;};}function removeEntity(_0x44dc63,_0x105e0c){return function(_0x12690a){if(_0x12690a){return _0x12690a[_0x62f5('0x2f')]()[_0x62f5('0x2e')](function(){_0x44dc63[_0x62f5('0x23')](0xcc)[_0x62f5('0x24')]();});}};}function handleEntityNotFound(_0x4dac11,_0x9c6f06){return function(_0x2010fd){if(!_0x2010fd){_0x4dac11[_0x62f5('0x22')](0x194);}return _0x2010fd;};}function handleError(_0xec76d6,_0x4b2e5b){_0x4b2e5b=_0x4b2e5b||0x1f4;return function(_0xe2bf6e){logger['error'](_0xe2bf6e['stack']);if(_0xe2bf6e[_0x62f5('0x30')]){delete _0xe2bf6e['name'];}_0xec76d6[_0x62f5('0x23')](_0x4b2e5b)['send'](_0xe2bf6e);};}exports[_0x62f5('0x31')]=function(_0x54c79d,_0x377d88){var _0x49e768={},_0x3cf7a2={},_0x4b1525={'count':0x0,'rows':[]};var _0x1eae04=_[_0x62f5('0x32')](db[_0x62f5('0x33')]['rawAttributes'],function(_0x6cde23){return{'name':_0x6cde23[_0x62f5('0x34')],'type':_0x6cde23[_0x62f5('0x35')]['key']};});_0x3cf7a2[_0x62f5('0x36')]=_[_0x62f5('0x32')](_0x1eae04,_0x62f5('0x30'));_0x3cf7a2[_0x62f5('0x37')]=_[_0x62f5('0x38')](_0x54c79d[_0x62f5('0x37')]);_0x3cf7a2[_0x62f5('0x39')]=_[_0x62f5('0x3a')](_0x3cf7a2[_0x62f5('0x36')],_0x3cf7a2[_0x62f5('0x37')]);_0x49e768[_0x62f5('0x3b')]=_['intersection'](_0x3cf7a2[_0x62f5('0x36')],qs['fields'](_0x54c79d[_0x62f5('0x37')][_0x62f5('0x3c')]));_0x49e768[_0x62f5('0x3b')]=_0x49e768[_0x62f5('0x3b')][_0x62f5('0x3d')]?_0x49e768[_0x62f5('0x3b')]:_0x3cf7a2['model'];if(!_0x54c79d[_0x62f5('0x37')][_0x62f5('0x3e')](_0x62f5('0x3f'))){_0x49e768[_0x62f5('0x40')]=qs['limit'](_0x54c79d[_0x62f5('0x37')][_0x62f5('0x40')]);_0x49e768[_0x62f5('0x26')]=qs[_0x62f5('0x26')](_0x54c79d[_0x62f5('0x37')][_0x62f5('0x26')]);}_0x49e768[_0x62f5('0x41')]=qs[_0x62f5('0x42')](_0x54c79d['query']['sort']);_0x49e768[_0x62f5('0x43')]=qs[_0x62f5('0x39')](_[_0x62f5('0x44')](_0x54c79d[_0x62f5('0x37')],_0x3cf7a2[_0x62f5('0x39')]),_0x1eae04);if(_0x54c79d[_0x62f5('0x37')][_0x62f5('0x45')]){_0x49e768[_0x62f5('0x43')]=_[_0x62f5('0x46')](_0x49e768[_0x62f5('0x43')],{'$or':_[_0x62f5('0x32')](_0x1eae04,function(_0x273d15){if(_0x273d15[_0x62f5('0x35')]!=='VIRTUAL'){var _0x8d6952={};_0x8d6952[_0x273d15['name']]={'$like':'%'+_0x54c79d[_0x62f5('0x37')][_0x62f5('0x45')]+'%'};return _0x8d6952;}})});}_0x49e768=_[_0x62f5('0x46')]({},_0x49e768,_0x54c79d[_0x62f5('0x47')]);var _0x45f070={'where':_0x49e768[_0x62f5('0x43')]};return db[_0x62f5('0x33')]['count'](_0x45f070)[_0x62f5('0x2e')](function(_0x143bb9){_0x4b1525[_0x62f5('0x28')]=_0x143bb9;if(_0x54c79d['query'][_0x62f5('0x48')]){_0x49e768[_0x62f5('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x62f5('0x4a')](_0x49e768);})['then'](function(_0x1ce2db){_0x4b1525[_0x62f5('0x4b')]=_0x1ce2db;return _0x4b1525;})[_0x62f5('0x2e')](respondWithFilteredResult(_0x377d88,_0x49e768))[_0x62f5('0x4c')](handleError(_0x377d88,null));};exports[_0x62f5('0x4d')]=function(_0x4b2d0d,_0x2be7ce){var _0x4275ee={'raw':![],'where':{'id':_0x4b2d0d[_0x62f5('0x4e')]['id']}},_0x318fb0={};_0x318fb0[_0x62f5('0x36')]=_[_0x62f5('0x38')](db['VoiceQueueReport'][_0x62f5('0x4f')]);_0x318fb0[_0x62f5('0x37')]=_['keys'](_0x4b2d0d[_0x62f5('0x37')]);_0x318fb0[_0x62f5('0x39')]=_[_0x62f5('0x3a')](_0x318fb0['model'],_0x318fb0[_0x62f5('0x37')]);_0x4275ee['attributes']=_[_0x62f5('0x3a')](_0x318fb0[_0x62f5('0x36')],qs[_0x62f5('0x3c')](_0x4b2d0d[_0x62f5('0x37')][_0x62f5('0x3c')]));_0x4275ee['attributes']=_0x4275ee[_0x62f5('0x3b')][_0x62f5('0x3d')]?_0x4275ee[_0x62f5('0x3b')]:_0x318fb0[_0x62f5('0x36')];if(_0x4b2d0d[_0x62f5('0x37')][_0x62f5('0x48')]){_0x4275ee['include']=[{'all':!![]}];}_0x4275ee=_[_0x62f5('0x46')]({},_0x4275ee,_0x4b2d0d[_0x62f5('0x47')]);return db[_0x62f5('0x33')][_0x62f5('0x50')](_0x4275ee)[_0x62f5('0x2e')](handleEntityNotFound(_0x2be7ce,null))['then'](respondWithResult(_0x2be7ce,null))[_0x62f5('0x4c')](handleError(_0x2be7ce,null));};exports[_0x62f5('0x51')]=function(_0x545d8f,_0x1d071d){return db[_0x62f5('0x33')][_0x62f5('0x51')](_0x545d8f['body'],{})[_0x62f5('0x2e')](respondWithResult(_0x1d071d,0xc9))[_0x62f5('0x4c')](handleError(_0x1d071d,null));};exports[_0x62f5('0x2d')]=function(_0xa6375c,_0x3d9818){if(_0xa6375c[_0x62f5('0x52')]['id']){delete _0xa6375c[_0x62f5('0x52')]['id'];}return db[_0x62f5('0x33')][_0x62f5('0x50')]({'where':{'id':_0xa6375c['params']['id']}})['then'](handleEntityNotFound(_0x3d9818,null))[_0x62f5('0x2e')](saveUpdates(_0xa6375c[_0x62f5('0x52')],null))[_0x62f5('0x2e')](respondWithResult(_0x3d9818,null))[_0x62f5('0x4c')](handleError(_0x3d9818,null));};exports['destroy']=function(_0x2ce624,_0x1e9ceb){return db[_0x62f5('0x33')][_0x62f5('0x50')]({'where':{'id':_0x2ce624[_0x62f5('0x4e')]['id']}})[_0x62f5('0x2e')](handleEntityNotFound(_0x1e9ceb,null))[_0x62f5('0x2e')](removeEntity(_0x1e9ceb,null))['catch'](handleError(_0x1e9ceb,null));};exports['describe']=function(_0x491604,_0x4bf574){return db[_0x62f5('0x33')][_0x62f5('0x53')]()[_0x62f5('0x2e')](respondWithResult(_0x4bf574,null))['catch'](handleError(_0x4bf574,null));};exports[_0x62f5('0x54')]=function(_0x3c68e2,_0x96ad2b){var _0x5adaaa={},_0x128fc8={},_0x35a3b3={'count':0x0,'rows':[]};_0x128fc8[_0x62f5('0x36')]=_[_0x62f5('0x38')](db[_0x62f5('0x33')][_0x62f5('0x4f')]);_0x128fc8[_0x62f5('0x37')]=_[_0x62f5('0x38')](_0x3c68e2[_0x62f5('0x37')]);_0x128fc8[_0x62f5('0x39')]=_[_0x62f5('0x3a')](_0x128fc8[_0x62f5('0x36')],_0x128fc8[_0x62f5('0x37')]);_0x5adaaa['attributes']=_[_0x62f5('0x3a')](_0x128fc8['model'],qs['fields'](_0x3c68e2['query'][_0x62f5('0x3c')]));_0x5adaaa[_0x62f5('0x3b')]=_0x5adaaa['attributes']['length']?_0x5adaaa['attributes']:_0x128fc8[_0x62f5('0x36')];if(!_0x3c68e2[_0x62f5('0x37')]['hasOwnProperty'](_0x62f5('0x3f'))){_0x5adaaa[_0x62f5('0x40')]=qs['limit'](_0x3c68e2['query'][_0x62f5('0x40')]);_0x5adaaa[_0x62f5('0x26')]=qs[_0x62f5('0x26')](_0x3c68e2[_0x62f5('0x37')][_0x62f5('0x26')]);}_0x5adaaa[_0x62f5('0x41')]=qs[_0x62f5('0x42')](_0x3c68e2[_0x62f5('0x37')]['sort']);_0x5adaaa[_0x62f5('0x43')]=qs[_0x62f5('0x39')](_[_0x62f5('0x44')](_0x3c68e2[_0x62f5('0x37')],_0x128fc8['filters']));if(_0x3c68e2[_0x62f5('0x37')]['filter']){_0x5adaaa[_0x62f5('0x43')]=_[_0x62f5('0x46')](_0x5adaaa[_0x62f5('0x43')],{'$or':_['map'](_0x5adaaa[_0x62f5('0x3b')],function(_0x102e10){var _0x2cd191={};_0x2cd191[_0x102e10]={'$like':'%'+_0x3c68e2['query']['filter']+'%'};return _0x2cd191;})});}_0x5adaaa=_['merge']({},_0x5adaaa,_0x3c68e2[_0x62f5('0x47')]);var _0x197166={'where':_0x5adaaa[_0x62f5('0x43')]};return db[_0x62f5('0x33')][_0x62f5('0x28')](_0x197166)[_0x62f5('0x2e')](function(_0x5f2589){_0x35a3b3[_0x62f5('0x28')]=_0x5f2589;if(_0x3c68e2[_0x62f5('0x37')][_0x62f5('0x48')]){_0x5adaaa[_0x62f5('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x62f5('0x4a')](_0x5adaaa);})[_0x62f5('0x2e')](function(_0x5e1aa7){_0x35a3b3[_0x62f5('0x4b')]=_0x5e1aa7;return _0x35a3b3;})[_0x62f5('0x2e')](respondWithFilteredResult(_0x96ad2b,_0x5adaaa,_0x62f5('0x54')))[_0x62f5('0x4c')](handleError(_0x96ad2b,null,_0x62f5('0x54')));}; \ No newline at end of file +var _0x426e=['redis','defaults','./voiceQueueReport.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','then','end','error','name','send','VoiceQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','merge','filter','options','include','show','params','includeAll','find','catch','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','order','rows','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x426e,0x86));var _0xe426=function(_0x519d1c,_0x1935a2){_0x519d1c=_0x519d1c-0x0;var _0x1662e4=_0x426e[_0x519d1c];return _0x1662e4;};'use strict';var emlformat=require(_0xe426('0x0'));var rimraf=require(_0xe426('0x1'));var zipdir=require(_0xe426('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe426('0x3'));var moment=require(_0xe426('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe426('0x5'));var util=require(_0xe426('0x6'));var path=require(_0xe426('0x7'));var sox=require('sox');var csv=require(_0xe426('0x8'));var ejs=require(_0xe426('0x9'));var fs=require('fs');var fs_extra=require(_0xe426('0xa'));var _=require('lodash');var squel=require(_0xe426('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe426('0xc'));var toCsv=require(_0xe426('0x8'));var querystring=require('querystring');var Papa=require(_0xe426('0xd'));var Redis=require(_0xe426('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe426('0xf'));var as=require(_0xe426('0x10'));var hardwareService=require(_0xe426('0x11'));var logger=require(_0xe426('0x12'))(_0xe426('0x13'));var utils=require(_0xe426('0x14'));var config=require(_0xe426('0x15'));var licenseUtil=require(_0xe426('0x16'));var db=require(_0xe426('0x17'))['db'];config[_0xe426('0x18')]=_[_0xe426('0x19')](config[_0xe426('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe426('0x1a'))[_0xe426('0x1b')](socket);function respondWithStatusCode(_0x3a8f5e,_0x18a2b9){_0x18a2b9=_0x18a2b9||0xcc;return function(_0x291947){if(_0x291947){return _0x3a8f5e[_0xe426('0x1c')](_0x18a2b9);}return _0x3a8f5e[_0xe426('0x1d')](_0x18a2b9)['end']();};}function respondWithResult(_0x2a9ddf,_0x599bb2){_0x599bb2=_0x599bb2||0xc8;return function(_0x4e02bc){if(_0x4e02bc){return _0x2a9ddf[_0xe426('0x1d')](_0x599bb2)[_0xe426('0x1e')](_0x4e02bc);}};}function respondWithFilteredResult(_0x152eed,_0x3f8bb3){return function(_0x15dbff){if(_0x15dbff){var _0x421a61=typeof _0x3f8bb3[_0xe426('0x1f')]==='undefined'&&typeof _0x3f8bb3[_0xe426('0x20')]===_0xe426('0x21');var _0x4be106=_0x15dbff[_0xe426('0x22')];var _0x3757a2=_0x421a61?0x0:_0x3f8bb3[_0xe426('0x1f')];var _0x28be79=_0x421a61?_0x15dbff[_0xe426('0x22')]:_0x3f8bb3['offset']+_0x3f8bb3[_0xe426('0x20')];var _0x252626;if(_0x28be79>=_0x4be106){_0x28be79=_0x4be106;_0x252626=0xc8;}else{_0x252626=0xce;}_0x152eed['status'](_0x252626);return _0x152eed[_0xe426('0x23')]('Content-Range',_0x3757a2+'-'+_0x28be79+'/'+_0x4be106)['json'](_0x15dbff);}return null;};}function patchUpdates(_0x346219){return function(_0x2933fc){try{jsonpatch[_0xe426('0x24')](_0x2933fc,_0x346219,!![]);}catch(_0x55571f){return BPromise['reject'](_0x55571f);}return _0x2933fc[_0xe426('0x25')]();};}function saveUpdates(_0x531bef,_0x4da178){return function(_0x3cd436){if(_0x3cd436){return _0x3cd436[_0xe426('0x26')](_0x531bef)['then'](function(_0x1ce9ec){return _0x1ce9ec;});}return null;};}function removeEntity(_0x24b411,_0x5651ad){return function(_0x2a70e8){if(_0x2a70e8){return _0x2a70e8[_0xe426('0x27')]()[_0xe426('0x28')](function(){_0x24b411['status'](0xcc)[_0xe426('0x29')]();});}};}function handleEntityNotFound(_0x4417db,_0x57da25){return function(_0x312407){if(!_0x312407){_0x4417db['sendStatus'](0x194);}return _0x312407;};}function handleError(_0x138635,_0x59fbc4){_0x59fbc4=_0x59fbc4||0x1f4;return function(_0x293f81){logger[_0xe426('0x2a')](_0x293f81['stack']);if(_0x293f81[_0xe426('0x2b')]){delete _0x293f81[_0xe426('0x2b')];}_0x138635['status'](_0x59fbc4)[_0xe426('0x2c')](_0x293f81);};}exports['index']=function(_0x1b5593,_0x339911){var _0x37cb52={},_0x1f3f04={},_0x53d438={'count':0x0,'rows':[]};var _0x32081e=_['map'](db[_0xe426('0x2d')][_0xe426('0x2e')],function(_0x5e2290){return{'name':_0x5e2290[_0xe426('0x2f')],'type':_0x5e2290[_0xe426('0x30')][_0xe426('0x31')]};});_0x1f3f04['model']=_[_0xe426('0x32')](_0x32081e,'name');_0x1f3f04[_0xe426('0x33')]=_[_0xe426('0x34')](_0x1b5593[_0xe426('0x33')]);_0x1f3f04[_0xe426('0x35')]=_[_0xe426('0x36')](_0x1f3f04[_0xe426('0x37')],_0x1f3f04[_0xe426('0x33')]);_0x37cb52['attributes']=_[_0xe426('0x36')](_0x1f3f04[_0xe426('0x37')],qs['fields'](_0x1b5593['query'][_0xe426('0x38')]));_0x37cb52['attributes']=_0x37cb52[_0xe426('0x39')][_0xe426('0x3a')]?_0x37cb52['attributes']:_0x1f3f04['model'];if(!_0x1b5593['query']['hasOwnProperty']('nolimit')){_0x37cb52[_0xe426('0x20')]=qs[_0xe426('0x20')](_0x1b5593[_0xe426('0x33')][_0xe426('0x20')]);_0x37cb52[_0xe426('0x1f')]=qs['offset'](_0x1b5593['query'][_0xe426('0x1f')]);}_0x37cb52['order']=qs[_0xe426('0x3b')](_0x1b5593['query'][_0xe426('0x3b')]);_0x37cb52[_0xe426('0x3c')]=qs['filters'](_[_0xe426('0x3d')](_0x1b5593[_0xe426('0x33')],_0x1f3f04['filters']),_0x32081e);if(_0x1b5593[_0xe426('0x33')]['filter']){_0x37cb52[_0xe426('0x3c')]=_[_0xe426('0x3e')](_0x37cb52[_0xe426('0x3c')],{'$or':_[_0xe426('0x32')](_0x32081e,function(_0x4fd546){if(_0x4fd546[_0xe426('0x30')]!=='VIRTUAL'){var _0x37d000={};_0x37d000[_0x4fd546[_0xe426('0x2b')]]={'$like':'%'+_0x1b5593[_0xe426('0x33')][_0xe426('0x3f')]+'%'};return _0x37d000;}})});}_0x37cb52=_['merge']({},_0x37cb52,_0x1b5593[_0xe426('0x40')]);var _0x54734e={'where':_0x37cb52[_0xe426('0x3c')]};return db[_0xe426('0x2d')][_0xe426('0x22')](_0x54734e)['then'](function(_0x93fa01){_0x53d438[_0xe426('0x22')]=_0x93fa01;if(_0x1b5593[_0xe426('0x33')]['includeAll']){_0x37cb52[_0xe426('0x41')]=[{'all':!![]}];}return db[_0xe426('0x2d')]['findAll'](_0x37cb52);})[_0xe426('0x28')](function(_0x1923db){_0x53d438['rows']=_0x1923db;return _0x53d438;})[_0xe426('0x28')](respondWithFilteredResult(_0x339911,_0x37cb52))['catch'](handleError(_0x339911,null));};exports[_0xe426('0x42')]=function(_0x207ec0,_0x302605){var _0x252a69={'raw':![],'where':{'id':_0x207ec0[_0xe426('0x43')]['id']}},_0x3c6a83={};_0x3c6a83['model']=_[_0xe426('0x34')](db[_0xe426('0x2d')][_0xe426('0x2e')]);_0x3c6a83['query']=_[_0xe426('0x34')](_0x207ec0[_0xe426('0x33')]);_0x3c6a83['filters']=_['intersection'](_0x3c6a83[_0xe426('0x37')],_0x3c6a83[_0xe426('0x33')]);_0x252a69['attributes']=_[_0xe426('0x36')](_0x3c6a83[_0xe426('0x37')],qs[_0xe426('0x38')](_0x207ec0[_0xe426('0x33')]['fields']));_0x252a69[_0xe426('0x39')]=_0x252a69['attributes']['length']?_0x252a69[_0xe426('0x39')]:_0x3c6a83[_0xe426('0x37')];if(_0x207ec0[_0xe426('0x33')][_0xe426('0x44')]){_0x252a69['include']=[{'all':!![]}];}_0x252a69=_[_0xe426('0x3e')]({},_0x252a69,_0x207ec0['options']);return db[_0xe426('0x2d')][_0xe426('0x45')](_0x252a69)[_0xe426('0x28')](handleEntityNotFound(_0x302605,null))['then'](respondWithResult(_0x302605,null))[_0xe426('0x46')](handleError(_0x302605,null));};exports['create']=function(_0x94b89c,_0x34f027){return db[_0xe426('0x2d')][_0xe426('0x47')](_0x94b89c[_0xe426('0x48')],{})[_0xe426('0x28')](respondWithResult(_0x34f027,0xc9))[_0xe426('0x46')](handleError(_0x34f027,null));};exports[_0xe426('0x26')]=function(_0x1db559,_0x4b749f){if(_0x1db559[_0xe426('0x48')]['id']){delete _0x1db559[_0xe426('0x48')]['id'];}return db[_0xe426('0x2d')][_0xe426('0x45')]({'where':{'id':_0x1db559['params']['id']}})[_0xe426('0x28')](handleEntityNotFound(_0x4b749f,null))['then'](saveUpdates(_0x1db559[_0xe426('0x48')],null))[_0xe426('0x28')](respondWithResult(_0x4b749f,null))[_0xe426('0x46')](handleError(_0x4b749f,null));};exports[_0xe426('0x27')]=function(_0x369a2d,_0x57ec67){return db[_0xe426('0x2d')][_0xe426('0x45')]({'where':{'id':_0x369a2d[_0xe426('0x43')]['id']}})[_0xe426('0x28')](handleEntityNotFound(_0x57ec67,null))['then'](removeEntity(_0x57ec67,null))[_0xe426('0x46')](handleError(_0x57ec67,null));};exports['describe']=function(_0x398e9c,_0x4081da){return db[_0xe426('0x2d')][_0xe426('0x49')]()[_0xe426('0x28')](respondWithResult(_0x4081da,null))[_0xe426('0x46')](handleError(_0x4081da,null));};exports[_0xe426('0x4a')]=function(_0x2d3cf2,_0x8caabf){var _0x30b4da={},_0x1d965b={},_0x48c61f={'count':0x0,'rows':[]};_0x1d965b[_0xe426('0x37')]=_[_0xe426('0x34')](db['VoiceQueueReport']['rawAttributes']);_0x1d965b[_0xe426('0x33')]=_[_0xe426('0x34')](_0x2d3cf2['query']);_0x1d965b[_0xe426('0x35')]=_[_0xe426('0x36')](_0x1d965b['model'],_0x1d965b[_0xe426('0x33')]);_0x30b4da[_0xe426('0x39')]=_[_0xe426('0x36')](_0x1d965b[_0xe426('0x37')],qs['fields'](_0x2d3cf2[_0xe426('0x33')][_0xe426('0x38')]));_0x30b4da[_0xe426('0x39')]=_0x30b4da[_0xe426('0x39')][_0xe426('0x3a')]?_0x30b4da[_0xe426('0x39')]:_0x1d965b['model'];if(!_0x2d3cf2[_0xe426('0x33')][_0xe426('0x4b')](_0xe426('0x4c'))){_0x30b4da[_0xe426('0x20')]=qs[_0xe426('0x20')](_0x2d3cf2['query'][_0xe426('0x20')]);_0x30b4da[_0xe426('0x1f')]=qs[_0xe426('0x1f')](_0x2d3cf2[_0xe426('0x33')][_0xe426('0x1f')]);}_0x30b4da[_0xe426('0x4d')]=qs[_0xe426('0x3b')](_0x2d3cf2[_0xe426('0x33')][_0xe426('0x3b')]);_0x30b4da[_0xe426('0x3c')]=qs[_0xe426('0x35')](_[_0xe426('0x3d')](_0x2d3cf2[_0xe426('0x33')],_0x1d965b[_0xe426('0x35')]));if(_0x2d3cf2[_0xe426('0x33')]['filter']){_0x30b4da[_0xe426('0x3c')]=_[_0xe426('0x3e')](_0x30b4da[_0xe426('0x3c')],{'$or':_[_0xe426('0x32')](_0x30b4da[_0xe426('0x39')],function(_0x32f7b6){var _0x4e9cfa={};_0x4e9cfa[_0x32f7b6]={'$like':'%'+_0x2d3cf2[_0xe426('0x33')][_0xe426('0x3f')]+'%'};return _0x4e9cfa;})});}_0x30b4da=_[_0xe426('0x3e')]({},_0x30b4da,_0x2d3cf2[_0xe426('0x40')]);var _0x118963={'where':_0x30b4da[_0xe426('0x3c')]};return db[_0xe426('0x2d')][_0xe426('0x22')](_0x118963)[_0xe426('0x28')](function(_0x24fe3c){_0x48c61f[_0xe426('0x22')]=_0x24fe3c;if(_0x2d3cf2[_0xe426('0x33')][_0xe426('0x44')]){_0x30b4da[_0xe426('0x41')]=[{'all':!![]}];}return db[_0xe426('0x2d')]['findAll'](_0x30b4da);})['then'](function(_0x6174cf){_0x48c61f[_0xe426('0x4e')]=_0x6174cf;return _0x48c61f;})[_0xe426('0x28')](respondWithFilteredResult(_0x8caabf,_0x30b4da,_0xe426('0x4a')))[_0xe426('0x46')](handleError(_0x8caabf,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 14e516e..81b12bd 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 _0x4b54=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x4b54,0x17a));var _0x44b5=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x4b54[_0x27bd2c];return _0x3784ea;};'use strict';var EventEmitter=require(_0x44b5('0x0'));var VoiceQueueReport=require(_0x44b5('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44b5('0x2'),'afterUpdate':_0x44b5('0x3'),'afterDestroy':_0x44b5('0x4')};function emitEvent(_0x3be756){return function(_0x41f525,_0x3eb325,_0x29f645){VoiceQueueReportEvents[_0x44b5('0x5')](_0x3be756+':'+_0x41f525['id'],_0x41f525);VoiceQueueReportEvents[_0x44b5('0x5')](_0x3be756,_0x41f525);_0x29f645(null);};}for(var e in events){if(events[_0x44b5('0x6')](e)){var event=events[e];VoiceQueueReport[_0x44b5('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x817b=['save','remove','emit','events','../../mysqldb','VoiceQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x817b,0x1b9));var _0xb817=function(_0x4da76b,_0x4bd3ac){_0x4da76b=_0x4da76b-0x0;var _0x21a112=_0x817b[_0x4da76b];return _0x21a112;};'use strict';var EventEmitter=require(_0xb817('0x0'));var VoiceQueueReport=require(_0xb817('0x1'))['db'][_0xb817('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb817('0x3'),'afterUpdate':'update','afterDestroy':_0xb817('0x4')};function emitEvent(_0x29bc54){return function(_0x9610b1,_0x6bde14,_0x28f711){VoiceQueueReportEvents[_0xb817('0x5')](_0x29bc54+':'+_0x9610b1['id'],_0x9610b1);VoiceQueueReportEvents[_0xb817('0x5')](_0x29bc54,_0x9610b1);_0x28f711(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 99a3796..974931e 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 _0x0663=['define','report_queue','calleridnum','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes'];(function(_0x2545d0,_0x397e79){var _0x10111b=function(_0x2fdcd8){while(--_0x2fdcd8){_0x2545d0['push'](_0x2545d0['shift']());}};_0x10111b(++_0x397e79);}(_0x0663,0xea));var _0x3066=function(_0x5ce798,_0x458f99){_0x5ce798=_0x5ce798-0x0;var _0x279321=_0x0663[_0x5ce798];return _0x279321;};'use strict';var _=require(_0x3066('0x0'));var util=require(_0x3066('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3066('0x2'));var BPromise=require(_0x3066('0x3'));var rp=require(_0x3066('0x4'));var fs=require('fs');var path=require(_0x3066('0x5'));var rimraf=require(_0x3066('0x6'));var config=require('../../config/environment');var attributes=require(_0x3066('0x7'));module['exports']=function(_0x464500,_0x38fc77){return _0x464500[_0x3066('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x3066('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x3066('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x601f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util','../../config/logger','api'];(function(_0x416d9b,_0xa49561){var _0x354be0=function(_0x4652d1){while(--_0x4652d1){_0x416d9b['push'](_0x416d9b['shift']());}};_0x354be0(++_0xa49561);}(_0x601f,0x138));var _0xf601=function(_0x387d26,_0x13c985){_0x387d26=_0x387d26-0x0;var _0x5d073a=_0x601f[_0x387d26];return _0x5d073a;};'use strict';var _=require('lodash');var util=require(_0xf601('0x0'));var logger=require(_0xf601('0x1'))(_0xf601('0x2'));var moment=require(_0xf601('0x3'));var BPromise=require(_0xf601('0x4'));var rp=require(_0xf601('0x5'));var fs=require('fs');var path=require(_0xf601('0x6'));var rimraf=require(_0xf601('0x7'));var config=require(_0xf601('0x8'));var attributes=require(_0xf601('0x9'));module[_0xf601('0xa')]=function(_0x22e043,_0x47c7c3){return _0x22e043[_0xf601('0xb')](_0xf601('0xc'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf601('0xd')]},{'fields':[_0xf601('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9eae272..7563a6a 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 _0xae06=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceQueueReport','options','where','limit','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','catch','update','raw','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x150152,_0x3752ae){var _0x315897=function(_0x1b1362){while(--_0x1b1362){_0x150152['push'](_0x150152['shift']());}};_0x315897(++_0x3752ae);}(_0xae06,0xb4));var _0x6ae0=function(_0x163c7e,_0x41aa01){_0x163c7e=_0x163c7e-0x0;var _0xa5eb7d=_0xae06[_0x163c7e];return _0xa5eb7d;};'use strict';var _=require(_0x6ae0('0x0'));var util=require(_0x6ae0('0x1'));var moment=require(_0x6ae0('0x2'));var BPromise=require(_0x6ae0('0x3'));var rs=require(_0x6ae0('0x4'));var fs=require('fs');var Redis=require(_0x6ae0('0x5'));var db=require(_0x6ae0('0x6'))['db'];var utils=require(_0x6ae0('0x7'));var logger=require(_0x6ae0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ae0('0x9'));var client=jayson['client'][_0x6ae0('0xa')]({'port':0x232a});config[_0x6ae0('0xb')]=_['defaults'](config[_0x6ae0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ae0('0xc'))(new Redis(config[_0x6ae0('0xb')]));require(_0x6ae0('0xd'))[_0x6ae0('0xe')](socket);function respondWithRpcPromise(_0xa7d8b9,_0x507bbe,_0x1ca236){return new BPromise(function(_0x412720,_0x3275b4){return client[_0x6ae0('0xf')](_0xa7d8b9,_0x1ca236)[_0x6ae0('0x10')](function(_0x401e0f){logger[_0x6ae0('0x11')](_0x6ae0('0x12'),_0x507bbe,_0x6ae0('0x13'));logger['debug'](_0x6ae0('0x14'),_0x507bbe,'request\x20sent',JSON[_0x6ae0('0x15')](_0x401e0f));if(_0x401e0f[_0x6ae0('0x16')]){if(_0x401e0f[_0x6ae0('0x16')]['code']===0x1f4){logger[_0x6ae0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x507bbe,_0x401e0f['error']['message']);return _0x3275b4(_0x401e0f['error']['message']);}logger[_0x6ae0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x507bbe,_0x401e0f[_0x6ae0('0x16')][_0x6ae0('0x17')]);return _0x412720(_0x401e0f['error'][_0x6ae0('0x17')]);}else{logger[_0x6ae0('0x11')](_0x6ae0('0x12'),_0x507bbe,_0x6ae0('0x13'));_0x412720(_0x401e0f[_0x6ae0('0x18')][_0x6ae0('0x17')]);}})['catch'](function(_0x3415c7){logger[_0x6ae0('0x16')](_0x6ae0('0x12'),_0x507bbe,_0x3415c7);_0x3275b4(_0x3415c7);});});}exports['GetVoiceQueueReport']=function(_0x2fba81){var _0x5d98cb=this;return new Promise(function(_0x3f9730,_0x7624d2){return db[_0x6ae0('0x19')]['findAll']({'raw':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')][_0x6ae0('0x1b')]||null:null,'attributes':_0x2fba81['options']?_0x2fba81[_0x6ae0('0x1a')]['attributes']||null:null,'limit':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')][_0x6ae0('0x1c')]||null:null,'include':_0x2fba81[_0x6ae0('0x1a')]?_0x2fba81[_0x6ae0('0x1a')][_0x6ae0('0x1d')]?_[_0x6ae0('0x1e')](_0x2fba81[_0x6ae0('0x1a')]['include'],function(_0x4e08c7){return{'model':db[_0x4e08c7[_0x6ae0('0x1f')]],'as':_0x4e08c7['as'],'attributes':_0x4e08c7[_0x6ae0('0x20')],'include':_0x4e08c7[_0x6ae0('0x1d')]?_[_0x6ae0('0x1e')](_0x4e08c7[_0x6ae0('0x1d')],function(_0x8b332){return{'model':db[_0x8b332['model']],'as':_0x8b332['as'],'attributes':_0x8b332[_0x6ae0('0x20')],'include':_0x8b332[_0x6ae0('0x1d')]?_['map'](_0x8b332[_0x6ae0('0x1d')],function(_0x5ee1b8){return{'model':db[_0x5ee1b8[_0x6ae0('0x1f')]],'as':_0x5ee1b8['as'],'attributes':_0x5ee1b8[_0x6ae0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6ae0('0x10')](function(_0x4ca2dd){logger[_0x6ae0('0x11')]('GetVoiceQueueReport',_0x2fba81);logger['debug'](_0x6ae0('0x21'),_0x2fba81,JSON[_0x6ae0('0x15')](_0x4ca2dd));_0x3f9730(_0x4ca2dd);})['catch'](function(_0x485cd2){logger[_0x6ae0('0x16')](_0x6ae0('0x21'),_0x485cd2[_0x6ae0('0x17')],_0x2fba81);_0x7624d2(_0x5d98cb[_0x6ae0('0x16')](0x1f4,_0x485cd2[_0x6ae0('0x17')]));});});};exports[_0x6ae0('0x22')]=function(_0x257b01){var _0x44ae6f=this;return new Promise(function(_0x5812bc,_0x272159){return db['VoiceQueueReport'][_0x6ae0('0x23')](_0x257b01['body'],{'raw':_0x257b01[_0x6ae0('0x1a')]?_0x257b01['options']['raw']===undefined?!![]:![]:!![]})[_0x6ae0('0x10')](function(_0x282102){logger['info'](_0x6ae0('0x22'),_0x257b01);logger['debug'](_0x6ae0('0x22'),_0x257b01,JSON['stringify'](_0x282102));_0x5812bc(_0x282102);})[_0x6ae0('0x24')](function(_0x4d14b6){logger['error'](_0x6ae0('0x22'),_0x4d14b6[_0x6ae0('0x17')],_0x257b01);_0x272159(_0x44ae6f[_0x6ae0('0x16')](0x1f4,_0x4d14b6[_0x6ae0('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x480bd9){var _0x31e68a=this;return new Promise(function(_0xc9dead,_0x3d1ba7){return db[_0x6ae0('0x19')][_0x6ae0('0x25')](_0x480bd9['body'],{'raw':_0x480bd9[_0x6ae0('0x1a')]?_0x480bd9['options'][_0x6ae0('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480bd9['options']?_0x480bd9[_0x6ae0('0x1a')]['where']||null:null,'attributes':_0x480bd9[_0x6ae0('0x1a')]?_0x480bd9[_0x6ae0('0x1a')][_0x6ae0('0x20')]||null:null,'limit':_0x480bd9[_0x6ae0('0x1a')]?_0x480bd9[_0x6ae0('0x1a')][_0x6ae0('0x1c')]||null:null})[_0x6ae0('0x10')](function(_0x8bb567){logger['info']('UpdateVoiceQueueReport',_0x480bd9);logger['debug'](_0x6ae0('0x27'),_0x480bd9,JSON[_0x6ae0('0x15')](_0x8bb567));_0xc9dead(_0x8bb567);})['catch'](function(_0x18a519){logger[_0x6ae0('0x16')]('UpdateVoiceQueueReport',_0x18a519[_0x6ae0('0x17')],_0x480bd9);_0x3d1ba7(_0x31e68a[_0x6ae0('0x16')](0x1f4,_0x18a519[_0x6ae0('0x17')]));});});}; \ No newline at end of file +var _0x4282=['stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d2998,_0x4783d8){var _0x3c9531=function(_0x5789df){while(--_0x5789df){_0x2d2998['push'](_0x2d2998['shift']());}};_0x3c9531(++_0x4783d8);}(_0x4282,0x16d));var _0x2428=function(_0x2bf2ff,_0x27bb45){_0x2bf2ff=_0x2bf2ff-0x0;var _0x357790=_0x4282[_0x2bf2ff];return _0x357790;};'use strict';var _=require(_0x2428('0x0'));var util=require(_0x2428('0x1'));var moment=require('moment');var BPromise=require(_0x2428('0x2'));var rs=require(_0x2428('0x3'));var fs=require('fs');var Redis=require(_0x2428('0x4'));var db=require(_0x2428('0x5'))['db'];var utils=require(_0x2428('0x6'));var logger=require(_0x2428('0x7'))(_0x2428('0x8'));var config=require('../../config/environment');var jayson=require(_0x2428('0x9'));var client=jayson[_0x2428('0xa')]['http']({'port':0x232a});config[_0x2428('0xb')]=_[_0x2428('0xc')](config['redis'],{'host':_0x2428('0xd'),'port':0x18eb});var socket=require(_0x2428('0xe'))(new Redis(config['redis']));require(_0x2428('0xf'))[_0x2428('0x10')](socket);function respondWithRpcPromise(_0x1a4283,_0x1f876b,_0x39a9c6){return new BPromise(function(_0x539a4c,_0x194bb6){return client['request'](_0x1a4283,_0x39a9c6)[_0x2428('0x11')](function(_0x47c9da){logger[_0x2428('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1f876b,'request\x20sent');logger[_0x2428('0x13')](_0x2428('0x14'),_0x1f876b,_0x2428('0x15'),JSON[_0x2428('0x16')](_0x47c9da));if(_0x47c9da[_0x2428('0x17')]){if(_0x47c9da[_0x2428('0x17')]['code']===0x1f4){logger[_0x2428('0x17')](_0x2428('0x18'),_0x1f876b,_0x47c9da[_0x2428('0x17')]['message']);return _0x194bb6(_0x47c9da['error'][_0x2428('0x19')]);}logger[_0x2428('0x17')](_0x2428('0x18'),_0x1f876b,_0x47c9da['error'][_0x2428('0x19')]);return _0x539a4c(_0x47c9da[_0x2428('0x17')][_0x2428('0x19')]);}else{logger[_0x2428('0x12')](_0x2428('0x18'),_0x1f876b,_0x2428('0x15'));_0x539a4c(_0x47c9da[_0x2428('0x1a')]['message']);}})[_0x2428('0x1b')](function(_0x39d1a2){logger[_0x2428('0x17')](_0x2428('0x18'),_0x1f876b,_0x39d1a2);_0x194bb6(_0x39d1a2);});});}exports[_0x2428('0x1c')]=function(_0x1af80e){var _0x4cfa39=this;return new Promise(function(_0x417382,_0x3ec508){return db[_0x2428('0x1d')]['findAll']({'raw':_0x1af80e[_0x2428('0x1e')]?_0x1af80e['options'][_0x2428('0x1f')]===undefined?!![]:![]:!![],'where':_0x1af80e[_0x2428('0x1e')]?_0x1af80e[_0x2428('0x1e')]['where']||null:null,'attributes':_0x1af80e[_0x2428('0x1e')]?_0x1af80e['options'][_0x2428('0x20')]||null:null,'limit':_0x1af80e[_0x2428('0x1e')]?_0x1af80e[_0x2428('0x1e')][_0x2428('0x21')]||null:null,'include':_0x1af80e['options']?_0x1af80e[_0x2428('0x1e')][_0x2428('0x22')]?_[_0x2428('0x23')](_0x1af80e[_0x2428('0x1e')][_0x2428('0x22')],function(_0x2412ff){return{'model':db[_0x2412ff[_0x2428('0x24')]],'as':_0x2412ff['as'],'attributes':_0x2412ff[_0x2428('0x20')],'include':_0x2412ff[_0x2428('0x22')]?_['map'](_0x2412ff[_0x2428('0x22')],function(_0x2971fe){return{'model':db[_0x2971fe['model']],'as':_0x2971fe['as'],'attributes':_0x2971fe[_0x2428('0x20')],'include':_0x2971fe['include']?_[_0x2428('0x23')](_0x2971fe[_0x2428('0x22')],function(_0x139bc3){return{'model':db[_0x139bc3[_0x2428('0x24')]],'as':_0x139bc3['as'],'attributes':_0x139bc3[_0x2428('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x85ccb3){logger['info'](_0x2428('0x1c'),_0x1af80e);logger[_0x2428('0x13')](_0x2428('0x1c'),_0x1af80e,JSON[_0x2428('0x16')](_0x85ccb3));_0x417382(_0x85ccb3);})[_0x2428('0x1b')](function(_0x2699e3){logger[_0x2428('0x17')]('GetVoiceQueueReport',_0x2699e3[_0x2428('0x19')],_0x1af80e);_0x3ec508(_0x4cfa39[_0x2428('0x17')](0x1f4,_0x2699e3['message']));});});};exports[_0x2428('0x25')]=function(_0x29eeef){var _0x366f7b=this;return new Promise(function(_0x5daa84,_0x305df2){return db[_0x2428('0x1d')][_0x2428('0x26')](_0x29eeef[_0x2428('0x27')],{'raw':_0x29eeef['options']?_0x29eeef[_0x2428('0x1e')][_0x2428('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3da088){logger['info']('CreateVoiceQueueReport',_0x29eeef);logger[_0x2428('0x13')](_0x2428('0x25'),_0x29eeef,JSON[_0x2428('0x16')](_0x3da088));_0x5daa84(_0x3da088);})[_0x2428('0x1b')](function(_0x1b9182){logger['error'](_0x2428('0x25'),_0x1b9182['message'],_0x29eeef);_0x305df2(_0x366f7b[_0x2428('0x17')](0x1f4,_0x1b9182[_0x2428('0x19')]));});});};exports[_0x2428('0x28')]=function(_0x1485a4){var _0x9743a3=this;return new Promise(function(_0x57ded3,_0x37234a){return db[_0x2428('0x1d')][_0x2428('0x29')](_0x1485a4[_0x2428('0x27')],{'raw':_0x1485a4[_0x2428('0x1e')]?_0x1485a4['options'][_0x2428('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1485a4[_0x2428('0x1e')]?_0x1485a4[_0x2428('0x1e')][_0x2428('0x2a')]||null:null,'attributes':_0x1485a4[_0x2428('0x1e')]?_0x1485a4[_0x2428('0x1e')][_0x2428('0x20')]||null:null,'limit':_0x1485a4[_0x2428('0x1e')]?_0x1485a4[_0x2428('0x1e')][_0x2428('0x21')]||null:null})[_0x2428('0x11')](function(_0xc59e7c){logger['info'](_0x2428('0x28'),_0x1485a4);logger[_0x2428('0x13')]('UpdateVoiceQueueReport',_0x1485a4,JSON[_0x2428('0x16')](_0xc59e7c));_0x57ded3(_0xc59e7c);})[_0x2428('0x1b')](function(_0x506596){logger[_0x2428('0x17')]('UpdateVoiceQueueReport',_0x506596['message'],_0x1485a4);_0x37234a(_0x9743a3['error'](0x1f4,_0x506596[_0x2428('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 73e3d01..0252613 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 _0x121d=['register','length','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x34f8a8,_0x186230){var _0x111f52=function(_0x4b075c){while(--_0x4b075c){_0x34f8a8['push'](_0x34f8a8['shift']());}};_0x111f52(++_0x186230);}(_0x121d,0xea));var _0xd121=function(_0x9a0c2e,_0x3381d3){_0x9a0c2e=_0x9a0c2e-0x0;var _0x56bd45=_0x121d[_0x9a0c2e];return _0x56bd45;};'use strict';var VoiceQueueReportEvents=require(_0xd121('0x0'));var events=[_0xd121('0x1'),_0xd121('0x2'),_0xd121('0x3')];function createListener(_0x16ed51,_0x40e506){return function(_0x233726){_0x40e506[_0xd121('0x4')](_0x16ed51,_0x233726);};}function removeListener(_0x20a687,_0x349fc5){return function(){VoiceQueueReportEvents[_0xd121('0x5')](_0x20a687,_0x349fc5);};}exports[_0xd121('0x6')]=function(_0x2b2f41){for(var _0x31c727=0x0,_0x540cf2=events[_0xd121('0x7')];_0x31c727<_0x540cf2;_0x31c727++){var _0x5b67f7=events[_0x31c727];var _0x1da01c=createListener('voiceQueueReport:'+_0x5b67f7,_0x2b2f41);VoiceQueueReportEvents['on'](_0x5b67f7,_0x1da01c);}}; \ No newline at end of file +var _0x34f8=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','voiceQueueReport:'];(function(_0x5bf77b,_0x5ca5e6){var _0x28b2e9=function(_0x4662f0){while(--_0x4662f0){_0x5bf77b['push'](_0x5bf77b['shift']());}};_0x28b2e9(++_0x5ca5e6);}(_0x34f8,0x80));var _0x834f=function(_0x46cfb3,_0x448152){_0x46cfb3=_0x46cfb3-0x0;var _0x1af70e=_0x34f8[_0x46cfb3];return _0x1af70e;};'use strict';var VoiceQueueReportEvents=require(_0x834f('0x0'));var events=[_0x834f('0x1'),_0x834f('0x2'),_0x834f('0x3')];function createListener(_0x2cf91a,_0x495ca8){return function(_0x521ceb){_0x495ca8[_0x834f('0x4')](_0x2cf91a,_0x521ceb);};}function removeListener(_0x92264b,_0x4d23b1){return function(){VoiceQueueReportEvents[_0x834f('0x5')](_0x92264b,_0x4d23b1);};}exports[_0x834f('0x6')]=function(_0x9e052f){for(var _0x3498dd=0x0,_0x5378c4=events['length'];_0x3498dd<_0x5378c4;_0x3498dd++){var _0xf778e4=events[_0x3498dd];var _0x2597c6=createListener(_0x834f('0x7')+_0xf778e4,_0x9e052f);VoiceQueueReportEvents['on'](_0xf778e4,_0x2597c6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1f5c4e9..0a7b539 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 _0x5cd8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x3ae3df,_0x122a4e){var _0xde8953=function(_0x3b35cb){while(--_0x3b35cb){_0x3ae3df['push'](_0x3ae3df['shift']());}};_0xde8953(++_0x122a4e);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x54c70b,_0x219a96){_0x54c70b=_0x54c70b-0x0;var _0x43c2cd=_0x5cd8[_0x54c70b];return _0x43c2cd;};'use strict';var multer=require(_0x85cd('0x0'));var util=require('util');var path=require(_0x85cd('0x1'));var timeout=require(_0x85cd('0x2'));var express=require(_0x85cd('0x3'));var router=express[_0x85cd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85cd('0x6'));var controller=require(_0x85cd('0x7'));router[_0x85cd('0x8')]('/',auth[_0x85cd('0x9')](),controller[_0x85cd('0xa')]);router['get'](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller['show']);router[_0x85cd('0xc')]('/',auth[_0x85cd('0x9')](),controller[_0x85cd('0xd')]);router[_0x85cd('0xe')](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller[_0x85cd('0xf')]);router[_0x85cd('0x10')](_0x85cd('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x85cd('0x11')]=router; \ No newline at end of file +var _0xfb29=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','get'];(function(_0x39cc47,_0x499346){var _0x37aea9=function(_0x3ec2ce){while(--_0x3ec2ce){_0x39cc47['push'](_0x39cc47['shift']());}};_0x37aea9(++_0x499346);}(_0xfb29,0x119));var _0x9fb2=function(_0x2d79e7,_0x421ce5){_0x2d79e7=_0x2d79e7-0x0;var _0x3d4546=_0xfb29[_0x2d79e7];return _0x3d4546;};'use strict';var multer=require(_0x9fb2('0x0'));var util=require('util');var path=require(_0x9fb2('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fb2('0x2'));var router=express['Router']();var fs_extra=require(_0x9fb2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9fb2('0x4'));var config=require('../../config/environment');var controller=require(_0x9fb2('0x5'));router[_0x9fb2('0x6')]('/',auth[_0x9fb2('0x7')](),controller[_0x9fb2('0x8')]);router[_0x9fb2('0x6')](_0x9fb2('0x9'),auth[_0x9fb2('0x7')](),controller[_0x9fb2('0xa')]);router['post']('/',auth[_0x9fb2('0x7')](),controller[_0x9fb2('0xb')]);router[_0x9fb2('0xc')]('/:id',auth[_0x9fb2('0x7')](),controller[_0x9fb2('0xd')]);router[_0x9fb2('0xe')](_0x9fb2('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9fb2('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 95474a0..9b1ba7d 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 _0x98bb=['format','sequelize','STRING','DATE'];(function(_0x5ccaa1,_0xc6b075){var _0x48bb3f=function(_0x443d57){while(--_0x443d57){_0x5ccaa1['push'](_0x5ccaa1['shift']());}};_0x48bb3f(++_0xc6b075);}(_0x98bb,0x1d5));var _0xb98b=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x98bb[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0xb98b('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xb98b('0x1')]},'callid':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb98b('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb98b('0x2')],'allowNull':![],'defaultValue':moment()[_0xb98b('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xb288=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xb288,0x1b3));var _0x8b28=function(_0x773a2e,_0x4196b3){_0x773a2e=_0x773a2e-0x0;var _0x19683d=_0xb288[_0x773a2e];return _0x19683d;};'use strict';var Sequelize=require(_0x8b28('0x0'));var moment=require(_0x8b28('0x1'));module[_0x8b28('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8b28('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x8b28('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x8b28('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index cd31443..0689706 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 _0x9049=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','VoiceQueuesLog','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0x9049,0x194));var _0x9904=function(_0x4357db,_0x5ecf79){_0x4357db=_0x4357db-0x0;var _0x77c7e=_0x9049[_0x4357db];return _0x77c7e;};'use strict';var emlformat=require(_0x9904('0x0'));var rimraf=require(_0x9904('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9904('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9904('0x3'));var Mustache=require(_0x9904('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9904('0x5'));var csv=require(_0x9904('0x6'));var ejs=require(_0x9904('0x7'));var fs=require('fs');var fs_extra=require(_0x9904('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9904('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9904('0xa'));var Papa=require(_0x9904('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9904('0xc'));var as=require(_0x9904('0xd'));var hardwareService=require(_0x9904('0xe'));var logger=require(_0x9904('0xf'))(_0x9904('0x10'));var utils=require('../../config/utils');var config=require(_0x9904('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9904('0x12'))['db'];function respondWithStatusCode(_0x510c25,_0xedec91){_0xedec91=_0xedec91||0xcc;return function(_0x41d624){if(_0x41d624){return _0x510c25[_0x9904('0x13')](_0xedec91);}return _0x510c25[_0x9904('0x14')](_0xedec91)[_0x9904('0x15')]();};}function respondWithResult(_0xc1d55,_0x3e8eaa){_0x3e8eaa=_0x3e8eaa||0xc8;return function(_0x38dc82){if(_0x38dc82){return _0xc1d55[_0x9904('0x14')](_0x3e8eaa)[_0x9904('0x16')](_0x38dc82);}};}function respondWithFilteredResult(_0x27774e,_0x2c6de2){return function(_0x533fd6){if(_0x533fd6){var _0x2ac4d3=typeof _0x2c6de2['offset']===_0x9904('0x17')&&typeof _0x2c6de2[_0x9904('0x18')]==='undefined';var _0x3ed47e=_0x533fd6['count'];var _0x4f452e=_0x2ac4d3?0x0:_0x2c6de2[_0x9904('0x19')];var _0x20dd25=_0x2ac4d3?_0x533fd6[_0x9904('0x1a')]:_0x2c6de2[_0x9904('0x19')]+_0x2c6de2[_0x9904('0x18')];var _0x36fc6d;if(_0x20dd25>=_0x3ed47e){_0x20dd25=_0x3ed47e;_0x36fc6d=0xc8;}else{_0x36fc6d=0xce;}_0x27774e[_0x9904('0x14')](_0x36fc6d);return _0x27774e['set'](_0x9904('0x1b'),_0x4f452e+'-'+_0x20dd25+'/'+_0x3ed47e)['json'](_0x533fd6);}return null;};}function patchUpdates(_0x10b237){return function(_0x4b2832){try{jsonpatch[_0x9904('0x1c')](_0x4b2832,_0x10b237,!![]);}catch(_0x2d6d89){return BPromise[_0x9904('0x1d')](_0x2d6d89);}return _0x4b2832[_0x9904('0x1e')]();};}function saveUpdates(_0x5975e0,_0x12d609){return function(_0x9413f){if(_0x9413f){return _0x9413f[_0x9904('0x1f')](_0x5975e0)[_0x9904('0x20')](function(_0x4837f4){return _0x4837f4;});}return null;};}function removeEntity(_0x24f7df,_0x3f8327){return function(_0x2e8f33){if(_0x2e8f33){return _0x2e8f33[_0x9904('0x21')]()[_0x9904('0x20')](function(){_0x24f7df[_0x9904('0x14')](0xcc)[_0x9904('0x15')]();});}};}function handleEntityNotFound(_0x595839,_0x3398dd){return function(_0x106e9e){if(!_0x106e9e){_0x595839[_0x9904('0x13')](0x194);}return _0x106e9e;};}function handleError(_0x3439c5,_0x400321){_0x400321=_0x400321||0x1f4;return function(_0x36cc09){logger[_0x9904('0x22')](_0x36cc09[_0x9904('0x23')]);if(_0x36cc09[_0x9904('0x24')]){delete _0x36cc09[_0x9904('0x24')];}_0x3439c5[_0x9904('0x14')](_0x400321)['send'](_0x36cc09);};}exports[_0x9904('0x25')]=function(_0x4edf4c,_0x51bc56){var _0x16a7aa={},_0x3e77ed={},_0x58549f={'count':0x0,'rows':[]};var _0x2858a1=_['map'](db[_0x9904('0x26')]['rawAttributes'],function(_0xb861f3){return{'name':_0xb861f3[_0x9904('0x27')],'type':_0xb861f3[_0x9904('0x28')][_0x9904('0x29')]};});_0x3e77ed[_0x9904('0x2a')]=_[_0x9904('0x2b')](_0x2858a1,_0x9904('0x24'));_0x3e77ed[_0x9904('0x2c')]=_[_0x9904('0x2d')](_0x4edf4c[_0x9904('0x2c')]);_0x3e77ed[_0x9904('0x2e')]=_[_0x9904('0x2f')](_0x3e77ed['model'],_0x3e77ed[_0x9904('0x2c')]);_0x16a7aa[_0x9904('0x30')]=_[_0x9904('0x2f')](_0x3e77ed['model'],qs[_0x9904('0x31')](_0x4edf4c[_0x9904('0x2c')][_0x9904('0x31')]));_0x16a7aa[_0x9904('0x30')]=_0x16a7aa[_0x9904('0x30')]['length']?_0x16a7aa[_0x9904('0x30')]:_0x3e77ed['model'];if(!_0x4edf4c[_0x9904('0x2c')][_0x9904('0x32')]('nolimit')){_0x16a7aa[_0x9904('0x18')]=qs[_0x9904('0x18')](_0x4edf4c['query'][_0x9904('0x18')]);_0x16a7aa[_0x9904('0x19')]=qs['offset'](_0x4edf4c[_0x9904('0x2c')][_0x9904('0x19')]);}_0x16a7aa[_0x9904('0x33')]=qs[_0x9904('0x34')](_0x4edf4c[_0x9904('0x2c')]['sort']);_0x16a7aa['where']=qs[_0x9904('0x2e')](_[_0x9904('0x35')](_0x4edf4c[_0x9904('0x2c')],_0x3e77ed[_0x9904('0x2e')]),_0x2858a1);if(_0x4edf4c['query'][_0x9904('0x36')]){_0x16a7aa[_0x9904('0x37')]=_['merge'](_0x16a7aa[_0x9904('0x37')],{'$or':_[_0x9904('0x2b')](_0x2858a1,function(_0x34fc20){if(_0x34fc20[_0x9904('0x28')]!==_0x9904('0x38')){var _0x174d30={};_0x174d30[_0x34fc20['name']]={'$like':'%'+_0x4edf4c[_0x9904('0x2c')][_0x9904('0x36')]+'%'};return _0x174d30;}})});}_0x16a7aa=_[_0x9904('0x39')]({},_0x16a7aa,_0x4edf4c[_0x9904('0x3a')]);var _0x47ab10={'where':_0x16a7aa[_0x9904('0x37')]};return db['VoiceQueuesLog'][_0x9904('0x1a')](_0x47ab10)[_0x9904('0x20')](function(_0x191146){_0x58549f[_0x9904('0x1a')]=_0x191146;if(_0x4edf4c['query'][_0x9904('0x3b')]){_0x16a7aa[_0x9904('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9904('0x3d')](_0x16a7aa);})[_0x9904('0x20')](function(_0x3ebb48){_0x58549f[_0x9904('0x3e')]=_0x3ebb48;return _0x58549f;})[_0x9904('0x20')](respondWithFilteredResult(_0x51bc56,_0x16a7aa))[_0x9904('0x3f')](handleError(_0x51bc56,null));};exports['show']=function(_0x26429e,_0x4d6ba4){var _0x3070de={'raw':!![],'where':{'id':_0x26429e[_0x9904('0x40')]['id']}},_0x30bd89={};_0x30bd89[_0x9904('0x2a')]=_[_0x9904('0x2d')](db[_0x9904('0x26')][_0x9904('0x41')]);_0x30bd89[_0x9904('0x2c')]=_[_0x9904('0x2d')](_0x26429e[_0x9904('0x2c')]);_0x30bd89[_0x9904('0x2e')]=_['intersection'](_0x30bd89['model'],_0x30bd89[_0x9904('0x2c')]);_0x3070de['attributes']=_[_0x9904('0x2f')](_0x30bd89[_0x9904('0x2a')],qs[_0x9904('0x31')](_0x26429e[_0x9904('0x2c')][_0x9904('0x31')]));_0x3070de[_0x9904('0x30')]=_0x3070de[_0x9904('0x30')][_0x9904('0x42')]?_0x3070de[_0x9904('0x30')]:_0x30bd89[_0x9904('0x2a')];if(_0x26429e[_0x9904('0x2c')][_0x9904('0x3b')]){_0x3070de[_0x9904('0x3c')]=[{'all':!![]}];}_0x3070de=_['merge']({},_0x3070de,_0x26429e[_0x9904('0x3a')]);return db[_0x9904('0x26')][_0x9904('0x43')](_0x3070de)[_0x9904('0x20')](handleEntityNotFound(_0x4d6ba4,null))[_0x9904('0x20')](respondWithResult(_0x4d6ba4,null))['catch'](handleError(_0x4d6ba4,null));};exports[_0x9904('0x44')]=function(_0x4ced03,_0x230bb4){return db[_0x9904('0x26')][_0x9904('0x44')](_0x4ced03[_0x9904('0x45')],{})[_0x9904('0x20')](respondWithResult(_0x230bb4,0xc9))[_0x9904('0x3f')](handleError(_0x230bb4,null));};exports[_0x9904('0x1f')]=function(_0x59f085,_0x1d5079){if(_0x59f085[_0x9904('0x45')]['id']){delete _0x59f085[_0x9904('0x45')]['id'];}return db[_0x9904('0x26')]['find']({'where':{'id':_0x59f085[_0x9904('0x40')]['id']}})[_0x9904('0x20')](handleEntityNotFound(_0x1d5079,null))[_0x9904('0x20')](saveUpdates(_0x59f085['body'],null))[_0x9904('0x20')](respondWithResult(_0x1d5079,null))[_0x9904('0x3f')](handleError(_0x1d5079,null));};exports[_0x9904('0x21')]=function(_0x35fc45,_0x17ae9b){return db[_0x9904('0x26')][_0x9904('0x43')]({'where':{'id':_0x35fc45[_0x9904('0x40')]['id']}})[_0x9904('0x20')](handleEntityNotFound(_0x17ae9b,null))[_0x9904('0x20')](removeEntity(_0x17ae9b,null))[_0x9904('0x3f')](handleError(_0x17ae9b,null));}; \ No newline at end of file +var _0xbb47=['apply','reject','save','destroy','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','intersection','length','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x1c2948,_0x47cc33){var _0x1d28bf=function(_0x230eb4){while(--_0x230eb4){_0x1c2948['push'](_0x1c2948['shift']());}};_0x1d28bf(++_0x47cc33);}(_0xbb47,0x103));var _0x7bb4=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0xbb47[_0x4370c7];return _0xce78a9;};'use strict';var emlformat=require(_0x7bb4('0x0'));var rimraf=require(_0x7bb4('0x1'));var zipdir=require(_0x7bb4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7bb4('0x3'));var moment=require(_0x7bb4('0x4'));var BPromise=require(_0x7bb4('0x5'));var Mustache=require(_0x7bb4('0x6'));var util=require(_0x7bb4('0x7'));var path=require('path');var sox=require(_0x7bb4('0x8'));var csv=require(_0x7bb4('0x9'));var ejs=require(_0x7bb4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7bb4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7bb4('0xc'));var toCsv=require(_0x7bb4('0x9'));var querystring=require(_0x7bb4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7bb4('0xe'));var as=require(_0x7bb4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bb4('0x10'))(_0x7bb4('0x11'));var utils=require(_0x7bb4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7bb4('0x13'));var db=require(_0x7bb4('0x14'))['db'];function respondWithStatusCode(_0x74f491,_0xc3988){_0xc3988=_0xc3988||0xcc;return function(_0x25b01a){if(_0x25b01a){return _0x74f491['sendStatus'](_0xc3988);}return _0x74f491[_0x7bb4('0x15')](_0xc3988)['end']();};}function respondWithResult(_0x580854,_0x19195f){_0x19195f=_0x19195f||0xc8;return function(_0x65e181){if(_0x65e181){return _0x580854[_0x7bb4('0x15')](_0x19195f)[_0x7bb4('0x16')](_0x65e181);}};}function respondWithFilteredResult(_0x2ba1b5,_0x23f414){return function(_0x2a3a4a){if(_0x2a3a4a){var _0x194062=typeof _0x23f414['offset']==='undefined'&&typeof _0x23f414[_0x7bb4('0x17')]===_0x7bb4('0x18');var _0x3b17ec=_0x2a3a4a[_0x7bb4('0x19')];var _0xef14ce=_0x194062?0x0:_0x23f414[_0x7bb4('0x1a')];var _0x341e7e=_0x194062?_0x2a3a4a['count']:_0x23f414[_0x7bb4('0x1a')]+_0x23f414[_0x7bb4('0x17')];var _0x58f3cd;if(_0x341e7e>=_0x3b17ec){_0x341e7e=_0x3b17ec;_0x58f3cd=0xc8;}else{_0x58f3cd=0xce;}_0x2ba1b5[_0x7bb4('0x15')](_0x58f3cd);return _0x2ba1b5[_0x7bb4('0x1b')](_0x7bb4('0x1c'),_0xef14ce+'-'+_0x341e7e+'/'+_0x3b17ec)[_0x7bb4('0x16')](_0x2a3a4a);}return null;};}function patchUpdates(_0x20887a){return function(_0x1f637e){try{jsonpatch[_0x7bb4('0x1d')](_0x1f637e,_0x20887a,!![]);}catch(_0x4edce7){return BPromise[_0x7bb4('0x1e')](_0x4edce7);}return _0x1f637e[_0x7bb4('0x1f')]();};}function saveUpdates(_0x2867ea,_0x162760){return function(_0x151735){if(_0x151735){return _0x151735['update'](_0x2867ea)['then'](function(_0x223790){return _0x223790;});}return null;};}function removeEntity(_0x369072,_0x5aa8ec){return function(_0x3d8c73){if(_0x3d8c73){return _0x3d8c73[_0x7bb4('0x20')]()[_0x7bb4('0x21')](function(){_0x369072[_0x7bb4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10e2c4,_0x39a08e){return function(_0x52c613){if(!_0x52c613){_0x10e2c4['sendStatus'](0x194);}return _0x52c613;};}function handleError(_0x1c290f,_0x283e75){_0x283e75=_0x283e75||0x1f4;return function(_0x292548){logger[_0x7bb4('0x22')](_0x292548[_0x7bb4('0x23')]);if(_0x292548[_0x7bb4('0x24')]){delete _0x292548[_0x7bb4('0x24')];}_0x1c290f[_0x7bb4('0x15')](_0x283e75)[_0x7bb4('0x25')](_0x292548);};}exports[_0x7bb4('0x26')]=function(_0x5df17d,_0x2aa9d0){var _0x51f87a={},_0x1b6a34={},_0x13b012={'count':0x0,'rows':[]};var _0x34d3b4=_['map'](db[_0x7bb4('0x27')][_0x7bb4('0x28')],function(_0x160ac){return{'name':_0x160ac[_0x7bb4('0x29')],'type':_0x160ac[_0x7bb4('0x2a')][_0x7bb4('0x2b')]};});_0x1b6a34['model']=_[_0x7bb4('0x2c')](_0x34d3b4,'name');_0x1b6a34[_0x7bb4('0x2d')]=_[_0x7bb4('0x2e')](_0x5df17d[_0x7bb4('0x2d')]);_0x1b6a34[_0x7bb4('0x2f')]=_['intersection'](_0x1b6a34[_0x7bb4('0x30')],_0x1b6a34[_0x7bb4('0x2d')]);_0x51f87a[_0x7bb4('0x31')]=_['intersection'](_0x1b6a34['model'],qs[_0x7bb4('0x32')](_0x5df17d[_0x7bb4('0x2d')][_0x7bb4('0x32')]));_0x51f87a[_0x7bb4('0x31')]=_0x51f87a[_0x7bb4('0x31')]['length']?_0x51f87a[_0x7bb4('0x31')]:_0x1b6a34[_0x7bb4('0x30')];if(!_0x5df17d[_0x7bb4('0x2d')][_0x7bb4('0x33')](_0x7bb4('0x34'))){_0x51f87a[_0x7bb4('0x17')]=qs[_0x7bb4('0x17')](_0x5df17d[_0x7bb4('0x2d')][_0x7bb4('0x17')]);_0x51f87a[_0x7bb4('0x1a')]=qs[_0x7bb4('0x1a')](_0x5df17d[_0x7bb4('0x2d')]['offset']);}_0x51f87a[_0x7bb4('0x35')]=qs[_0x7bb4('0x36')](_0x5df17d[_0x7bb4('0x2d')][_0x7bb4('0x36')]);_0x51f87a[_0x7bb4('0x37')]=qs['filters'](_[_0x7bb4('0x38')](_0x5df17d['query'],_0x1b6a34['filters']),_0x34d3b4);if(_0x5df17d['query']['filter']){_0x51f87a[_0x7bb4('0x37')]=_[_0x7bb4('0x39')](_0x51f87a[_0x7bb4('0x37')],{'$or':_[_0x7bb4('0x2c')](_0x34d3b4,function(_0x55bbbf){if(_0x55bbbf[_0x7bb4('0x2a')]!==_0x7bb4('0x3a')){var _0x114ade={};_0x114ade[_0x55bbbf[_0x7bb4('0x24')]]={'$like':'%'+_0x5df17d[_0x7bb4('0x2d')][_0x7bb4('0x3b')]+'%'};return _0x114ade;}})});}_0x51f87a=_[_0x7bb4('0x39')]({},_0x51f87a,_0x5df17d[_0x7bb4('0x3c')]);var _0x3e4d4e={'where':_0x51f87a[_0x7bb4('0x37')]};return db[_0x7bb4('0x27')][_0x7bb4('0x19')](_0x3e4d4e)[_0x7bb4('0x21')](function(_0x5d72bf){_0x13b012['count']=_0x5d72bf;if(_0x5df17d[_0x7bb4('0x2d')][_0x7bb4('0x3d')]){_0x51f87a['include']=[{'all':!![]}];}return db[_0x7bb4('0x27')][_0x7bb4('0x3e')](_0x51f87a);})[_0x7bb4('0x21')](function(_0x4795e5){_0x13b012[_0x7bb4('0x3f')]=_0x4795e5;return _0x13b012;})[_0x7bb4('0x21')](respondWithFilteredResult(_0x2aa9d0,_0x51f87a))[_0x7bb4('0x40')](handleError(_0x2aa9d0,null));};exports[_0x7bb4('0x41')]=function(_0x7a3753,_0x4801ac){var _0x334621={'raw':!![],'where':{'id':_0x7a3753['params']['id']}},_0x253d06={};_0x253d06['model']=_[_0x7bb4('0x2e')](db['VoiceQueuesLog'][_0x7bb4('0x28')]);_0x253d06['query']=_[_0x7bb4('0x2e')](_0x7a3753['query']);_0x253d06['filters']=_[_0x7bb4('0x42')](_0x253d06['model'],_0x253d06[_0x7bb4('0x2d')]);_0x334621[_0x7bb4('0x31')]=_[_0x7bb4('0x42')](_0x253d06['model'],qs[_0x7bb4('0x32')](_0x7a3753[_0x7bb4('0x2d')][_0x7bb4('0x32')]));_0x334621[_0x7bb4('0x31')]=_0x334621[_0x7bb4('0x31')][_0x7bb4('0x43')]?_0x334621[_0x7bb4('0x31')]:_0x253d06[_0x7bb4('0x30')];if(_0x7a3753[_0x7bb4('0x2d')][_0x7bb4('0x3d')]){_0x334621[_0x7bb4('0x44')]=[{'all':!![]}];}_0x334621=_[_0x7bb4('0x39')]({},_0x334621,_0x7a3753['options']);return db['VoiceQueuesLog']['find'](_0x334621)[_0x7bb4('0x21')](handleEntityNotFound(_0x4801ac,null))['then'](respondWithResult(_0x4801ac,null))[_0x7bb4('0x40')](handleError(_0x4801ac,null));};exports[_0x7bb4('0x45')]=function(_0x4531c5,_0xe75220){return db[_0x7bb4('0x27')][_0x7bb4('0x45')](_0x4531c5[_0x7bb4('0x46')],{})[_0x7bb4('0x21')](respondWithResult(_0xe75220,0xc9))[_0x7bb4('0x40')](handleError(_0xe75220,null));};exports['update']=function(_0x32069f,_0x46d387){if(_0x32069f[_0x7bb4('0x46')]['id']){delete _0x32069f[_0x7bb4('0x46')]['id'];}return db[_0x7bb4('0x27')][_0x7bb4('0x47')]({'where':{'id':_0x32069f['params']['id']}})[_0x7bb4('0x21')](handleEntityNotFound(_0x46d387,null))[_0x7bb4('0x21')](saveUpdates(_0x32069f[_0x7bb4('0x46')],null))[_0x7bb4('0x21')](respondWithResult(_0x46d387,null))[_0x7bb4('0x40')](handleError(_0x46d387,null));};exports[_0x7bb4('0x20')]=function(_0x6365d6,_0x1a40b4){return db[_0x7bb4('0x27')][_0x7bb4('0x47')]({'where':{'id':_0x6365d6['params']['id']}})[_0x7bb4('0x21')](handleEntityNotFound(_0x1a40b4,null))[_0x7bb4('0x21')](removeEntity(_0x1a40b4,null))[_0x7bb4('0x40')](handleError(_0x1a40b4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 4ec1181..bd55674 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 _0xc185=['rimraf','../../config/environment','define','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x32c364,_0xc70257){var _0x163e0c=function(_0x4a59be){while(--_0x4a59be){_0x32c364['push'](_0x32c364['shift']());}};_0x163e0c(++_0xc70257);}(_0xc185,0x96));var _0x5c18=function(_0x2d903a,_0x2d0dd2){_0x2d903a=_0x2d903a-0x0;var _0x5b2a8a=_0xc185[_0x2d903a];return _0x5b2a8a;};'use strict';var _=require('lodash');var util=require(_0x5c18('0x0'));var logger=require(_0x5c18('0x1'))('api');var moment=require(_0x5c18('0x2'));var BPromise=require(_0x5c18('0x3'));var rp=require(_0x5c18('0x4'));var fs=require('fs');var path=require(_0x5c18('0x5'));var rimraf=require(_0x5c18('0x6'));var config=require(_0x5c18('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x4c5e6b,_0xc354ac){return _0x4c5e6b[_0x5c18('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x5c18('0x9'),'paranoid':![],'indexes':[{'name':_0x5c18('0xa'),'fields':[_0x5c18('0xb'),_0x5c18('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xcc7f=['lodash','moment','path','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x5b0466,_0x2d723f){var _0x3eddb6=function(_0x1886fe){while(--_0x1886fe){_0x5b0466['push'](_0x5b0466['shift']());}};_0x3eddb6(++_0x2d723f);}(_0xcc7f,0x1cc));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfcc7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfcc7('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcc7('0x2'));var rimraf=require('rimraf');var config=require(_0xfcc7('0x3'));var attributes=require('./voiceQueuesLog.attributes');module[_0xfcc7('0x4')]=function(_0x52654e,_0xf2278){return _0x52654e[_0xfcc7('0x5')](_0xfcc7('0x6'),attributes,{'tableName':_0xfcc7('0x7'),'paranoid':![],'indexes':[{'name':_0xfcc7('0x8'),'fields':[_0xfcc7('0x9'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3afee9b..fc734c3 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 _0xbc48=['stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x3e92aa,_0x113124){var _0x249178=function(_0x2fdefa){while(--_0x2fdefa){_0x3e92aa['push'](_0x3e92aa['shift']());}};_0x249178(++_0x113124);}(_0xbc48,0x16b));var _0x8bc4=function(_0x47020f,_0x36f16b){_0x47020f=_0x47020f-0x0;var _0x2c6749=_0xbc48[_0x47020f];return _0x2c6749;};'use strict';var _=require('lodash');var util=require(_0x8bc4('0x0'));var moment=require(_0x8bc4('0x1'));var BPromise=require(_0x8bc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bc4('0x4'));var logger=require(_0x8bc4('0x5'))(_0x8bc4('0x6'));var config=require(_0x8bc4('0x7'));var jayson=require(_0x8bc4('0x8'));var client=jayson[_0x8bc4('0x9')][_0x8bc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe686,_0x32e271,_0x2f2372){return new BPromise(function(_0x10c6c2,_0x2dcbfa){return client['request'](_0x2fe686,_0x2f2372)[_0x8bc4('0xb')](function(_0x3ef891){logger[_0x8bc4('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x32e271,_0x8bc4('0xd'));logger[_0x8bc4('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x32e271,_0x8bc4('0xd'),JSON[_0x8bc4('0xf')](_0x3ef891));if(_0x3ef891[_0x8bc4('0x10')]){if(_0x3ef891[_0x8bc4('0x10')]['code']===0x1f4){logger[_0x8bc4('0x10')](_0x8bc4('0x11'),_0x32e271,_0x3ef891[_0x8bc4('0x10')][_0x8bc4('0x12')]);return _0x2dcbfa(_0x3ef891[_0x8bc4('0x10')]['message']);}logger[_0x8bc4('0x10')](_0x8bc4('0x11'),_0x32e271,_0x3ef891[_0x8bc4('0x10')][_0x8bc4('0x12')]);return _0x10c6c2(_0x3ef891[_0x8bc4('0x10')][_0x8bc4('0x12')]);}else{logger[_0x8bc4('0xc')](_0x8bc4('0x11'),_0x32e271,_0x8bc4('0xd'));_0x10c6c2(_0x3ef891[_0x8bc4('0x13')][_0x8bc4('0x12')]);}})[_0x8bc4('0x14')](function(_0xced882){logger[_0x8bc4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x32e271,_0xced882);_0x2dcbfa(_0xced882);});});} \ No newline at end of file +var _0xca07=['stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0xca07,0xb1));var _0x7ca0=function(_0xb8c43b,_0x36f526){_0xb8c43b=_0xb8c43b-0x0;var _0x24df7c=_0xca07[_0xb8c43b];return _0x24df7c;};'use strict';var _=require('lodash');var util=require(_0x7ca0('0x0'));var moment=require('moment');var BPromise=require(_0x7ca0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ca0('0x2'));var db=require(_0x7ca0('0x3'))['db'];var utils=require(_0x7ca0('0x4'));var logger=require('../../config/logger')(_0x7ca0('0x5'));var config=require(_0x7ca0('0x6'));var jayson=require(_0x7ca0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51a2ba,_0x3c29ad,_0x3934cd){return new BPromise(function(_0x530ce7,_0x2e7f4b){return client['request'](_0x51a2ba,_0x3934cd)[_0x7ca0('0x8')](function(_0x5d7f49){logger['info'](_0x7ca0('0x9'),_0x3c29ad,'request\x20sent');logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3c29ad,_0x7ca0('0xc'),JSON[_0x7ca0('0xd')](_0x5d7f49));if(_0x5d7f49[_0x7ca0('0xe')]){if(_0x5d7f49['error'][_0x7ca0('0xf')]===0x1f4){logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);return _0x2e7f4b(_0x5d7f49['error'][_0x7ca0('0x10')]);}logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);return _0x530ce7(_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x3c29ad,'request\x20sent');_0x530ce7(_0x5d7f49[_0x7ca0('0x11')][_0x7ca0('0x10')]);}})[_0x7ca0('0x12')](function(_0x1cbd1d){logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x1cbd1d);_0x2e7f4b(_0x1cbd1d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 75d9083..468967e 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 _0xdc3e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x23eaf0,_0x347b70){var _0x353da4=function(_0x22a504){while(--_0x22a504){_0x23eaf0['push'](_0x23eaf0['shift']());}};_0x353da4(++_0x347b70);}(_0xdc3e,0x169));var _0xedc3=function(_0x3e18c8,_0x124343){_0x3e18c8=_0x3e18c8-0x0;var _0x14b686=_0xdc3e[_0x3e18c8];return _0x14b686;};'use strict';var multer=require(_0xedc3('0x0'));var util=require(_0xedc3('0x1'));var path=require('path');var timeout=require(_0xedc3('0x2'));var express=require(_0xedc3('0x3'));var router=express[_0xedc3('0x4')]();var fs_extra=require(_0xedc3('0x5'));var auth=require(_0xedc3('0x6'));var interaction=require(_0xedc3('0x7'));var config=require(_0xedc3('0x8'));var controller=require(_0xedc3('0x9'));router[_0xedc3('0xa')]('/',auth[_0xedc3('0xb')](),controller[_0xedc3('0xc')]);router[_0xedc3('0xa')](_0xedc3('0xd'),auth[_0xedc3('0xb')](),controller[_0xedc3('0xe')]);router[_0xedc3('0xa')](_0xedc3('0xf'),auth[_0xedc3('0xb')](),controller['show']);router['get'](_0xedc3('0x10'),auth['isAuthenticated'](),controller[_0xedc3('0x11')]);router[_0xedc3('0xa')](_0xedc3('0x12'),controller[_0xedc3('0x13')]);router[_0xedc3('0xa')](_0xedc3('0x14'),auth[_0xedc3('0xb')](),controller[_0xedc3('0x15')]);router[_0xedc3('0x16')]('/',auth['isAuthenticated'](),controller[_0xedc3('0x17')]);router[_0xedc3('0x16')](_0xedc3('0x14'),auth[_0xedc3('0xb')](),controller['runTranscribe']);router[_0xedc3('0x18')](_0xedc3('0xf'),auth[_0xedc3('0xb')](),controller[_0xedc3('0x19')]);router[_0xedc3('0x1a')](_0xedc3('0xf'),auth[_0xedc3('0xb')](),controller['destroy']);module[_0xedc3('0x1b')]=router; \ No newline at end of file +var _0x2dc8=['show','download','/:id/downloads','downloads','/:id/transcribe','post','runTranscribe','/:id','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x44e487,_0x457420){var _0x347512=function(_0x1f6c38){while(--_0x1f6c38){_0x44e487['push'](_0x44e487['shift']());}};_0x347512(++_0x457420);}(_0x2dc8,0x1a3));var _0x82dc=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0x2dc8[_0x1a12c8];return _0x305109;};'use strict';var multer=require(_0x82dc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x82dc('0x1'));var express=require('express');var router=express[_0x82dc('0x2')]();var fs_extra=require(_0x82dc('0x3'));var auth=require(_0x82dc('0x4'));var interaction=require(_0x82dc('0x5'));var config=require(_0x82dc('0x6'));var controller=require(_0x82dc('0x7'));router[_0x82dc('0x8')]('/',auth[_0x82dc('0x9')](),controller[_0x82dc('0xa')]);router[_0x82dc('0x8')](_0x82dc('0xb'),auth[_0x82dc('0x9')](),controller[_0x82dc('0xc')]);router[_0x82dc('0x8')]('/:id',auth[_0x82dc('0x9')](),controller[_0x82dc('0xd')]);router[_0x82dc('0x8')]('/:id/download',auth[_0x82dc('0x9')](),controller[_0x82dc('0xe')]);router[_0x82dc('0x8')](_0x82dc('0xf'),controller[_0x82dc('0x10')]);router[_0x82dc('0x8')](_0x82dc('0x11'),auth[_0x82dc('0x9')](),controller['downloadTranscribe']);router[_0x82dc('0x12')]('/',auth[_0x82dc('0x9')](),controller['create']);router[_0x82dc('0x12')](_0x82dc('0x11'),auth[_0x82dc('0x9')](),controller[_0x82dc('0x13')]);router['put'](_0x82dc('0x14'),auth[_0x82dc('0x9')](),controller['update']);router[_0x82dc('0x15')]('/:id',auth[_0x82dc('0x9')](),controller[_0x82dc('0x16')]);module[_0x82dc('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 24d06fb..a57ddc3 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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 a96d394..ac1b236 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 _0xc642=['catch','show','keys','find','create','body','params','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','Not\x20found','sequelize','col','token','$and','push','%s.cypher','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','type','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x3abac4,_0x418685){var _0x2d97d7=function(_0x5c9a34){while(--_0x5c9a34){_0x3abac4['push'](_0x3abac4['shift']());}};_0x2d97d7(++_0x418685);}(_0xc642,0x185));var _0x2c64=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc642[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x2c64('0x0'));var rimraf=require(_0x2c64('0x1'));var zipdir=require(_0x2c64('0x2'));var jsonpatch=require(_0x2c64('0x3'));var rp=require(_0x2c64('0x4'));var moment=require(_0x2c64('0x5'));var BPromise=require(_0x2c64('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c64('0x7'));var sox=require(_0x2c64('0x8'));var csv=require(_0x2c64('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c64('0xa'));var _=require(_0x2c64('0xb'));var squel=require(_0x2c64('0xc'));var crypto=require(_0x2c64('0xd'));var jsforce=require(_0x2c64('0xe'));var deskjs=require(_0x2c64('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c64('0x10'));var Papa=require(_0x2c64('0x11'));var AWS=require(_0x2c64('0x12'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c64('0x13'));var as=require(_0x2c64('0x14'));var hardwareService=require(_0x2c64('0x15'));var logger=require(_0x2c64('0x16'))('api');var utils=require(_0x2c64('0x17'));var config=require(_0x2c64('0x18'));var licenseUtil=require(_0x2c64('0x19'));var db=require(_0x2c64('0x1a'))['db'];function respondWithStatusCode(_0x423364,_0x277a44){_0x277a44=_0x277a44||0xcc;return function(_0x87c24f){if(_0x87c24f){return _0x423364[_0x2c64('0x1b')](_0x277a44);}return _0x423364[_0x2c64('0x1c')](_0x277a44)[_0x2c64('0x1d')]();};}function respondWithResult(_0x5ca8bd,_0x496329){_0x496329=_0x496329||0xc8;return function(_0x72ae5){if(_0x72ae5){return _0x5ca8bd[_0x2c64('0x1c')](_0x496329)[_0x2c64('0x1e')](_0x72ae5);}};}function respondWithFilteredResult(_0x4352f7,_0x5d894b){return function(_0xe2fea2){if(_0xe2fea2){var _0x4cb365=typeof _0x5d894b[_0x2c64('0x1f')]===_0x2c64('0x20')&&typeof _0x5d894b[_0x2c64('0x21')]===_0x2c64('0x20');var _0x536171=_0xe2fea2[_0x2c64('0x22')];var _0x6ea931=_0x4cb365?0x0:_0x5d894b[_0x2c64('0x1f')];var _0x2c492a=_0x4cb365?_0xe2fea2[_0x2c64('0x22')]:_0x5d894b[_0x2c64('0x1f')]+_0x5d894b[_0x2c64('0x21')];var _0xdb2987;if(_0x2c492a>=_0x536171){_0x2c492a=_0x536171;_0xdb2987=0xc8;}else{_0xdb2987=0xce;}_0x4352f7['status'](_0xdb2987);return _0x4352f7[_0x2c64('0x23')](_0x2c64('0x24'),_0x6ea931+'-'+_0x2c492a+'/'+_0x536171)['json'](_0xe2fea2);}return null;};}function patchUpdates(_0xaff558){return function(_0x1cf056){try{jsonpatch[_0x2c64('0x25')](_0x1cf056,_0xaff558,!![]);}catch(_0x258103){return BPromise['reject'](_0x258103);}return _0x1cf056[_0x2c64('0x26')]();};}function saveUpdates(_0x52f0d2,_0x4807dd){return function(_0x404c44){if(_0x404c44){return _0x404c44[_0x2c64('0x27')](_0x52f0d2)['then'](function(_0x22ac4f){return _0x22ac4f;});}return null;};}function removeEntity(_0x29a7ad,_0x3efc53){return function(_0x524269){if(_0x524269){return _0x524269[_0x2c64('0x28')]()[_0x2c64('0x29')](function(){_0x29a7ad[_0x2c64('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f0d5,_0x1f9bb5){return function(_0x240aa5){if(!_0x240aa5){_0x11f0d5[_0x2c64('0x1b')](0x194);}return _0x240aa5;};}function handleError(_0x255f2f,_0x4ba2fb){_0x4ba2fb=_0x4ba2fb||0x1f4;return function(_0x271311){logger[_0x2c64('0x2a')](_0x271311[_0x2c64('0x2b')]);if(_0x271311[_0x2c64('0x2c')]){delete _0x271311[_0x2c64('0x2c')];}_0x255f2f[_0x2c64('0x1c')](_0x4ba2fb)[_0x2c64('0x2d')](_0x271311);};}exports[_0x2c64('0x2e')]=function(_0x523f70,_0x5dff8a){var _0x189d54={},_0x12a19d={},_0x50a4c6={'count':0x0,'rows':[]};var _0x44c944=_[_0x2c64('0x2f')](db[_0x2c64('0x30')]['rawAttributes'],function(_0x2b0286){return{'name':_0x2b0286['fieldName'],'type':_0x2b0286[_0x2c64('0x31')][_0x2c64('0x32')]};});_0x12a19d['model']=_[_0x2c64('0x33')](_['map'](_0x44c944,'name'),[_0x2c64('0x34')]);_0x12a19d[_0x2c64('0x35')]=_['keys'](_0x523f70[_0x2c64('0x35')]);_0x12a19d[_0x2c64('0x36')]=_[_0x2c64('0x37')](_0x12a19d[_0x2c64('0x38')],_0x12a19d[_0x2c64('0x35')]);_0x189d54['attributes']=_[_0x2c64('0x37')](_0x12a19d['model'],qs[_0x2c64('0x39')](_0x523f70[_0x2c64('0x35')][_0x2c64('0x39')]));_0x189d54[_0x2c64('0x3a')]=_0x189d54[_0x2c64('0x3a')][_0x2c64('0x3b')]?_0x189d54['attributes']:_0x12a19d[_0x2c64('0x38')];if(!_0x523f70['query'][_0x2c64('0x3c')](_0x2c64('0x3d'))){_0x189d54[_0x2c64('0x21')]=qs[_0x2c64('0x21')](_0x523f70[_0x2c64('0x35')][_0x2c64('0x21')]);_0x189d54[_0x2c64('0x1f')]=qs[_0x2c64('0x1f')](_0x523f70['query'][_0x2c64('0x1f')]);}_0x189d54[_0x2c64('0x3e')]=qs[_0x2c64('0x3f')](_0x523f70[_0x2c64('0x35')][_0x2c64('0x3f')]);_0x189d54[_0x2c64('0x40')]=qs['filters'](_[_0x2c64('0x41')](_0x523f70['query'],_0x12a19d['filters']),_0x44c944);if(_0x523f70[_0x2c64('0x35')][_0x2c64('0x42')]){_0x189d54['where']=_['merge'](_0x189d54['where'],{'$or':_[_0x2c64('0x2f')](_0x44c944,function(_0x22e194){if(_0x22e194[_0x2c64('0x31')]!=='VIRTUAL'){var _0x4a3028={};_0x4a3028[_0x22e194['name']]={'$like':'%'+_0x523f70[_0x2c64('0x35')][_0x2c64('0x42')]+'%'};return _0x4a3028;}})});}_0x189d54=_[_0x2c64('0x43')]({},_0x189d54,_0x523f70[_0x2c64('0x44')]);var _0x215278={'where':_0x189d54['where']};return db[_0x2c64('0x30')][_0x2c64('0x22')](_0x215278)[_0x2c64('0x29')](function(_0x2165a0){_0x50a4c6[_0x2c64('0x22')]=_0x2165a0;if(_0x523f70[_0x2c64('0x35')][_0x2c64('0x45')]){_0x189d54[_0x2c64('0x46')]=[{'all':!![]}];}return db[_0x2c64('0x30')][_0x2c64('0x47')](_0x189d54);})['then'](function(_0x22e42d){_0x50a4c6[_0x2c64('0x48')]=_0x22e42d;return _0x50a4c6;})[_0x2c64('0x29')](respondWithFilteredResult(_0x5dff8a,_0x189d54))[_0x2c64('0x49')](handleError(_0x5dff8a,null));};exports[_0x2c64('0x4a')]=function(_0x145c4d,_0x1c18cf){var _0x35ae4b={'raw':![],'where':{'id':_0x145c4d['params']['id']}},_0x582fe1={};_0x582fe1[_0x2c64('0x38')]=_['keys'](db[_0x2c64('0x30')]['rawAttributes']);_0x582fe1[_0x2c64('0x35')]=_[_0x2c64('0x4b')](_0x145c4d[_0x2c64('0x35')]);_0x582fe1[_0x2c64('0x36')]=_[_0x2c64('0x37')](_0x582fe1[_0x2c64('0x38')],_0x582fe1[_0x2c64('0x35')]);_0x35ae4b['attributes']=_[_0x2c64('0x37')](_0x582fe1[_0x2c64('0x38')],qs[_0x2c64('0x39')](_0x145c4d[_0x2c64('0x35')][_0x2c64('0x39')]));_0x35ae4b[_0x2c64('0x3a')]=_0x35ae4b['attributes'][_0x2c64('0x3b')]?_0x35ae4b[_0x2c64('0x3a')]:_0x582fe1[_0x2c64('0x38')];if(_0x145c4d[_0x2c64('0x35')][_0x2c64('0x45')]){_0x35ae4b[_0x2c64('0x46')]=[{'all':!![]}];}_0x35ae4b=_[_0x2c64('0x43')]({},_0x35ae4b,_0x145c4d[_0x2c64('0x44')]);return db[_0x2c64('0x30')][_0x2c64('0x4c')](_0x35ae4b)[_0x2c64('0x29')](handleEntityNotFound(_0x1c18cf,null))[_0x2c64('0x29')](respondWithResult(_0x1c18cf,null))[_0x2c64('0x49')](handleError(_0x1c18cf,null));};exports[_0x2c64('0x4d')]=function(_0x5e018f,_0x3c293a){return db[_0x2c64('0x30')][_0x2c64('0x4d')](_0x5e018f[_0x2c64('0x4e')],{})['then'](respondWithResult(_0x3c293a,0xc9))[_0x2c64('0x49')](handleError(_0x3c293a,null));};exports[_0x2c64('0x27')]=function(_0x5e286d,_0x42bdbd){if(_0x5e286d[_0x2c64('0x4e')]['id']){delete _0x5e286d['body']['id'];}return db['VoiceRecording'][_0x2c64('0x4c')]({'where':{'id':_0x5e286d[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](handleEntityNotFound(_0x42bdbd,null))[_0x2c64('0x29')](saveUpdates(_0x5e286d[_0x2c64('0x4e')],null))[_0x2c64('0x29')](respondWithResult(_0x42bdbd,null))[_0x2c64('0x49')](handleError(_0x42bdbd,null));};exports['describe']=function(_0x2da88b,_0x55e791){return db[_0x2c64('0x30')][_0x2c64('0x50')]()['then'](respondWithResult(_0x55e791,null))[_0x2c64('0x49')](handleError(_0x55e791,null));};exports['download']=function(_0x2d7580,_0x66d43,_0x2df1b2){var _0x19c5fb=require(_0x2c64('0x51'));var _0x34eae7=![];var _0x2b45ba={};if(_0x2d7580[_0x2c64('0x35')][_0x2c64('0x31')]&&_0x2d7580['query'][_0x2c64('0x31')]===_0x2c64('0x52')){_0x2b45ba[_0x2c64('0x52')]=_0x2d7580[_0x2c64('0x4f')]['id'];}else{_0x2b45ba['id']=_0x2d7580['params']['id'];}return db[_0x2c64('0x30')][_0x2c64('0x4c')]({'where':_0x2b45ba,'attributes':['id',_0x2c64('0x53')],'raw':!![]})[_0x2c64('0x29')](handleEntityNotFound(_0x66d43,null))[_0x2c64('0x29')](function(_0x4c21b1){if(_0x4c21b1){var _0x5ac62f=_0x4c21b1[_0x2c64('0x53')];var _0x2f3477=util[_0x2c64('0x34')]('%s.cypher',_0x5ac62f);if(fs[_0x2c64('0x54')](_0x2f3477)){_0x34eae7=!![];return _0x19c5fb[_0x2c64('0x55')](_0x2f3477,_0x5ac62f,config[_0x2c64('0x56')][_0x2c64('0x57')])[_0x2c64('0x29')](function(){return _0x4c21b1;});}return _0x4c21b1;}})[_0x2c64('0x29')](function(_0x32337c){if(_0x32337c){var _0x3af561=_0x32337c[_0x2c64('0x53')];if(!fs[_0x2c64('0x54')](_0x3af561)){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x59'));}if(_0x32337c[_0x2c64('0x5a')]){return _0x66d43[_0x2c64('0x5b')](_0x3af561,_0x32337c[_0x2c64('0x5a')]+path['extname'](_0x3af561),function(){if(_0x34eae7){fs['unlink'](_0x3af561);}});}else{return _0x66d43[_0x2c64('0x5b')](_0x3af561,function(_0x4b017d){if(_0x34eae7){fs[_0x2c64('0x5c')](_0x3af561);}});}}})['catch'](function(_0x118bc9){if(_0x118bc9['message']==='VoiceRecording\x20not\x20found'){_0x66d43['status'](0x194)[_0x2c64('0x2d')](_0x2c64('0x5d'));}else{return handleError(_0x66d43,null);}});};exports['downloads']=function(_0xf40ccf,_0x9d1340,_0x56da29){var _0x4ee038=require(_0x2c64('0x51'));var _0x4ee46c=![];var _0x35de6d={'$and':[db[_0x2c64('0x5e')][_0x2c64('0x40')](db['sequelize']['fn']('MD5',db['sequelize'][_0x2c64('0x5f')](_0x2c64('0x52'))),_0xf40ccf[_0x2c64('0x35')][_0x2c64('0x60')])]};if(_0xf40ccf[_0x2c64('0x35')][_0x2c64('0x31')]&&_0xf40ccf[_0x2c64('0x35')][_0x2c64('0x31')]==='uniqueid'){_0x35de6d[_0x2c64('0x61')][_0x2c64('0x62')]({'uniqueid':_0xf40ccf[_0x2c64('0x4f')]['id']});}else{_0x35de6d[_0x2c64('0x61')][_0x2c64('0x62')]({'id':_0xf40ccf[_0x2c64('0x4f')]['id']});}return db['VoiceRecording'][_0x2c64('0x4c')]({'where':_0x35de6d,'attributes':['id',_0x2c64('0x53')],'raw':!![]})[_0x2c64('0x29')](handleEntityNotFound(_0x9d1340,null))[_0x2c64('0x29')](function(_0x8165b3){if(_0x8165b3){var _0x5385d2=util[_0x2c64('0x34')](_0x2c64('0x63'),_0x8165b3[_0x2c64('0x53')]);if(fs[_0x2c64('0x54')](_0x5385d2)){_0x4ee46c=!![];return _0x4ee038[_0x2c64('0x55')](_0x5385d2,_0x8165b3[_0x2c64('0x53')],config['secrets'][_0x2c64('0x57')])[_0x2c64('0x29')](function(){return _0x8165b3;});}return _0x8165b3;}})[_0x2c64('0x29')](function(_0xd96ca){if(_0xd96ca){if(!fs['existsSync'](_0xd96ca['value'])){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x59'));}if(_0xd96ca[_0x2c64('0x5a')]){return _0x9d1340[_0x2c64('0x5b')](_0xd96ca[_0x2c64('0x53')],_0xd96ca[_0x2c64('0x5a')]+path[_0x2c64('0x64')](_0xd96ca[_0x2c64('0x53')]),function(){if(_0x4ee46c){fs[_0x2c64('0x5c')](_0xd96ca[_0x2c64('0x53')]);}});}else{return _0x9d1340[_0x2c64('0x5b')](_0xd96ca[_0x2c64('0x53')],function(_0x44384d){if(_0x4ee46c){fs[_0x2c64('0x5c')](_0xd96ca['value']);}});}}})[_0x2c64('0x49')](handleError(_0x9d1340,null));};exports[_0x2c64('0x28')]=function(_0x3a0154,_0x39e896){return db['VoiceRecording'][_0x2c64('0x4c')]({'where':{'id':_0x3a0154[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](function(_0x321e87){if(_[_0x2c64('0x65')](_0x321e87)){throw new ReferenceError(_0x2c64('0x66'));}return _0x321e87;})[_0x2c64('0x29')](function(_0x217924){var _0x302774=_0x217924[_0x2c64('0x53')];logger['info'](_0x2c64('0x67'),_0x302774);if(!_[_0x2c64('0x65')](_0x217924['value'])&&fs[_0x2c64('0x54')](_0x302774)){logger[_0x2c64('0x68')](_0x2c64('0x69')+_0x302774+_0x2c64('0x6a'));fs['unlinkSync'](_0x302774);}_0x302774=_0x302774+'.cypher';if(!_['isNil'](_0x217924['value'])&&fs[_0x2c64('0x54')](_0x302774)){logger['info'](_0x2c64('0x69')+_0x302774+_0x2c64('0x6a'));fs['unlinkSync'](_0x302774);}return _0x217924;})[_0x2c64('0x29')](function(_0x12f7ab){if(!_0x12f7ab)throw new InternalError();return _0x12f7ab[_0x2c64('0x28')]();})[_0x2c64('0x29')](function(){_0x39e896[_0x2c64('0x1c')](0xcc)[_0x2c64('0x1d')]();})['catch'](handleError(_0x39e896,null));};function getBucketslist(_0x370ed0,_0x52f819,_0x422ab9){return new Promise(function(_0x53b380,_0x2c13b8){var _0x118380=new AWS['S3']({'accessKeyId':_0x52f819,'secretAccessKey':_0x370ed0,'region':_0x422ab9});_0x118380[_0x2c64('0x6b')]({},function(_0x1696c1,_0x2104f2){if(_0x1696c1){return _0x2c13b8(_0x1696c1);}else{return _0x53b380(_0x2104f2);}});});}function createBucket(_0x212b68,_0x39c4d3,_0x214593,_0x21d8b8){return new Promise(function(_0x3638cc,_0x32f037){var _0x4c7efa=new AWS['S3']({'accessKeyId':_0x39c4d3,'secretAccessKey':_0x212b68,'region':_0x214593});_0x4c7efa[_0x2c64('0x6c')]({'Bucket':_0x21d8b8},function(_0x3eb76a,_0x402475){if(_0x3eb76a){return _0x32f037(_0x3eb76a);}else{return _0x3638cc(_0x402475);}});});}function uploadFile(_0x221ed9,_0x331b41,_0x2efffa,_0x1d0f6f,_0x4d72bb,_0x51139d){return new Promise(function(_0x39d29a,_0x373366){var _0x48ec07=new AWS['S3']({'accessKeyId':_0x331b41,'secretAccessKey':_0x221ed9,'region':_0x2efffa});_0x48ec07[_0x2c64('0x6d')]({'Bucket':_0x1d0f6f,'Key':_0x4d72bb,'Body':_0x51139d},function(_0x1ae399,_0x3fb46f){if(_0x1ae399){return _0x373366(_0x1ae399);}else{return _0x39d29a(_0x3fb46f);}});});}function startTranscribe(_0x2ecc7d,_0x17c11e,_0x361b74,_0x2a303a,_0x42bb4e,_0x1546ef){return new Promise(function(_0x2ad128,_0x5c1f48){var _0x58ba70=new AWS['TranscribeService']({'accessKeyId':_0x17c11e,'secretAccessKey':_0x2ecc7d,'region':_0x361b74});_0x58ba70[_0x2c64('0x6e')]({'TranscriptionJobName':_0x2a303a,'LanguageCode':_0x42bb4e,'Media':{'MediaFileUri':_0x1546ef}},function(_0x3304da,_0x24618f){if(_0x3304da){return _0x5c1f48(_0x3304da);}else{return _0x2ad128(_0x24618f);}});});}function transcribe(_0x36124b,_0x2b5110,_0x5ed309,_0x462569,_0x49aac5,_0x11b60d,_0x150d79){return new Promise(function(_0x2add35,_0x273120){var _0x34d39d={};logger['info'](util[_0x2c64('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x36124b,_0x49aac5));return uploadFile(_0x2b5110,_0x5ed309,_0x462569,_0x49aac5,path[_0x2c64('0x6f')](_0x11b60d),fs[_0x2c64('0x70')](_0x11b60d))['then'](function(_0x51bd8a){logger[_0x2c64('0x68')](util['format'](_0x2c64('0x71'),_0x36124b,_0x49aac5,_0x51bd8a[_0x2c64('0x72')]));_0x34d39d[_0x2c64('0x73')]=_0x51bd8a[_0x2c64('0x74')];_0x34d39d[_0x2c64('0x75')]=_0x51bd8a['Location'];logger[_0x2c64('0x68')](util[_0x2c64('0x34')](_0x2c64('0x76'),_0x36124b));return startTranscribe(_0x2b5110,_0x5ed309,_0x462569,uuidv4(),_0x150d79,_0x51bd8a['Location']);})[_0x2c64('0x29')](function(_0x4aefce){logger[_0x2c64('0x68')](util[_0x2c64('0x34')](_0x2c64('0x77'),_0x36124b,_0x4aefce[_0x2c64('0x78')][_0x2c64('0x79')]));_0x34d39d['transcribeName']=_0x4aefce['TranscriptionJob'][_0x2c64('0x79')];_0x34d39d[_0x2c64('0x7a')]=_0x4aefce[_0x2c64('0x78')]['TranscriptionJobStatus'];return _0x2add35(_0x34d39d);})[_0x2c64('0x49')](function(_0x3e8eeb){return _0x273120(_0x3e8eeb);});});}exports[_0x2c64('0x7b')]=function(_0x52bc85,_0x61c9a8,_0x3a508f){var _0x26698a;var _0x30dc16;var _0x17e1f1;var _0xf70aff=require('../../components/encryptor');return db['VoiceRecording'][_0x2c64('0x7c')]({'where':{'id':_0x52bc85[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](function(_0x2d9c5a){if(_0x2d9c5a){var _0x2ad251=util[_0x2c64('0x34')]('%s.cypher',_0x2d9c5a['value']);if(fs[_0x2c64('0x54')](_0x2ad251)){cypher=!![];return _0xf70aff[_0x2c64('0x55')](_0x2ad251,_0x2d9c5a[_0x2c64('0x53')],config['secrets'][_0x2c64('0x57')])[_0x2c64('0x29')](function(){return _0x2d9c5a;});}return _0x2d9c5a;}})['then'](function(_0x4282ef){if(!_0x4282ef){throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))](_0x2c64('0x7e'));}_0x30dc16=_0x4282ef;return db[_0x2c64('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x2c64('0x29')](handleEntityNotFound(_0x61c9a8,null))[_0x2c64('0x29')](function(_0x432ba1){if(_0x432ba1){_0x26698a=_0x432ba1;if(!_0x26698a['transcribe']||!_0x26698a[_0x2c64('0x80')]||!_0x26698a[_0x2c64('0x81')]||!_0x26698a[_0x2c64('0x82')]||!_0x26698a[_0x2c64('0x73')]){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x83'));}if(_0x52bc85[_0x2c64('0x4e')]['runSentiment']&&(!_0x26698a[_0x2c64('0x84')]||!_0x26698a[_0x2c64('0x85')]||!_0x26698a[_0x2c64('0x86')]||!_0x26698a[_0x2c64('0x82')]||!_0x26698a[_0x2c64('0x73')])){throw new db['Sequelize'][(_0x2c64('0x58'))](_0x2c64('0x87'));}return db[_0x2c64('0x88')][_0x2c64('0x7c')]({'where':{'id':_0x26698a[_0x2c64('0x80')]}});}})[_0x2c64('0x29')](function(_0x115424){if(!_0x115424){throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))](_0x2c64('0x89'));}if(!_0x115424[_0x2c64('0x8a')]||!_0x115424[_0x2c64('0x8b')]){throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))](_0x2c64('0x8c'));}_0x17e1f1=_0x115424;return getBucketslist(_0x17e1f1[_0x2c64('0x8a')],_0x17e1f1[_0x2c64('0x8b')],_0x26698a[_0x2c64('0x81')]);})[_0x2c64('0x29')](function(_0x58438c){if(_0x58438c&&_0x58438c[_0x2c64('0x8d')]){var _0xddca31=_[_0x2c64('0x4c')](_0x58438c[_0x2c64('0x8d')],function(_0x3749db){return _0x3749db[_0x2c64('0x8e')]===_0x26698a[_0x2c64('0x73')];});if(!_0xddca31){logger['info'](util[_0x2c64('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x52bc85[_0x2c64('0x4f')]['id'],_0x26698a['bucket']));return createBucket(_0x17e1f1[_0x2c64('0x8a')],_0x17e1f1[_0x2c64('0x8b')],_0x26698a[_0x2c64('0x81')],_0x26698a[_0x2c64('0x73')]);}logger['info'](util[_0x2c64('0x34')](_0x2c64('0x8f'),_0x52bc85[_0x2c64('0x4f')]['id'],_0x26698a[_0x2c64('0x73')]));return;}})['then'](function(_0x47ed42){if(_0x30dc16['transcribeStatus']===_0x2c64('0x90')){return transcribe(_0x52bc85[_0x2c64('0x4f')]['id'],_0x17e1f1[_0x2c64('0x8a')],_0x17e1f1[_0x2c64('0x8b')],_0x26698a['transcribeRegion'],_0x26698a[_0x2c64('0x73')],_0x30dc16[_0x2c64('0x53')],_0x26698a[_0x2c64('0x82')]);}else{logger[_0x2c64('0x68')](util[_0x2c64('0x34')](_0x2c64('0x91'),_0x52bc85['params']['id']));return{'transcribeStatus':_0x2c64('0x92')};}})['then'](function(_0x164fed){if(_0x164fed){_0x164fed['tempSentiment']=_0x52bc85['body'][_0x2c64('0x93')];return _0x30dc16[_0x2c64('0x94')](_0x164fed);}})[_0x2c64('0x29')](respondWithResult(_0x61c9a8,null))[_0x2c64('0x49')](handleError(_0x61c9a8,null));};function writeFile(_0x4b8c21,_0x3d051c){return new Promise(function(_0x597c79,_0x57957a){fs[_0x2c64('0x95')](_0x3d051c,_0x4b8c21,function(_0x41ede3,_0x510e76){if(_0x41ede3){return _0x57957a(_0x41ede3);}else{return _0x597c79(_0x510e76);}});});}exports[_0x2c64('0x96')]=function(_0x8046bf,_0x3d604b,_0x3a5409){return db[_0x2c64('0x30')][_0x2c64('0x7c')]({'where':{'id':_0x8046bf[_0x2c64('0x4f')]['id']}})[_0x2c64('0x29')](handleEntityNotFound(_0x3d604b))[_0x2c64('0x29')](function(_0x298801){if(_0x298801&&_0x298801['fileText']){var _0x1c7d02=_0x298801[_0x2c64('0x97')];var _0x4fd5fa=config[_0x2c64('0x98')]+_0x2c64('0x99')+_0x298801['id']+'.txt';if(fs[_0x2c64('0x54')](_0x4fd5fa)){return _0x4fd5fa;}return writeFile(_0x1c7d02,_0x4fd5fa)[_0x2c64('0x29')](function(){return _0x4fd5fa;});}else{throw new db[(_0x2c64('0x7d'))][(_0x2c64('0x58'))]('Transcript\x20not\x20available');}})['then'](function(_0x573d75){return _0x3d604b[_0x2c64('0x5b')](_0x573d75);})[_0x2c64('0x49')](handleError(_0x3d604b));}; \ No newline at end of file +var _0x39ca=['moment','bluebird','util','path','to-csv','fs-extra','squel','desk.js','papaparse','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','offset','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','create','body','params','describe','download','../../components/encryptor','uniqueid','find','value','format','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','$and','secrets','extname','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','fileText','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x18a749,_0x426749){var _0x1823a4=function(_0x5aead6){while(--_0x5aead6){_0x18a749['push'](_0x18a749['shift']());}};_0x1823a4(++_0x426749);}(_0x39ca,0x1c0));var _0xa39c=function(_0x169d90,_0x1e8ddf){_0x169d90=_0x169d90-0x0;var _0x2b501e=_0x39ca[_0x169d90];return _0x2b501e;};'use strict';var emlformat=require(_0xa39c('0x0'));var rimraf=require(_0xa39c('0x1'));var zipdir=require(_0xa39c('0x2'));var jsonpatch=require(_0xa39c('0x3'));var rp=require(_0xa39c('0x4'));var moment=require(_0xa39c('0x5'));var BPromise=require(_0xa39c('0x6'));var Mustache=require('mustache');var util=require(_0xa39c('0x7'));var path=require(_0xa39c('0x8'));var sox=require('sox');var csv=require(_0xa39c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa39c('0xa'));var _=require('lodash');var squel=require(_0xa39c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa39c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa39c('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0xa39c('0xe'));var Redis=require(_0xa39c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa39c('0x10'));var as=require(_0xa39c('0x11'));var hardwareService=require(_0xa39c('0x12'));var logger=require(_0xa39c('0x13'))(_0xa39c('0x14'));var utils=require(_0xa39c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa39c('0x16'));var db=require(_0xa39c('0x17'))['db'];function respondWithStatusCode(_0x21862d,_0xdd015d){_0xdd015d=_0xdd015d||0xcc;return function(_0x7da74f){if(_0x7da74f){return _0x21862d[_0xa39c('0x18')](_0xdd015d);}return _0x21862d[_0xa39c('0x19')](_0xdd015d)['end']();};}function respondWithResult(_0x41ff06,_0x4828f6){_0x4828f6=_0x4828f6||0xc8;return function(_0x4f82dd){if(_0x4f82dd){return _0x41ff06[_0xa39c('0x19')](_0x4828f6)[_0xa39c('0x1a')](_0x4f82dd);}};}function respondWithFilteredResult(_0x21eef3,_0x3dd451){return function(_0x54ef04){if(_0x54ef04){var _0x2e0a3b=typeof _0x3dd451['offset']===_0xa39c('0x1b')&&typeof _0x3dd451['limit']===_0xa39c('0x1b');var _0x4fef8d=_0x54ef04[_0xa39c('0x1c')];var _0xe60247=_0x2e0a3b?0x0:_0x3dd451['offset'];var _0x19f27f=_0x2e0a3b?_0x54ef04['count']:_0x3dd451['offset']+_0x3dd451[_0xa39c('0x1d')];var _0x3125ba;if(_0x19f27f>=_0x4fef8d){_0x19f27f=_0x4fef8d;_0x3125ba=0xc8;}else{_0x3125ba=0xce;}_0x21eef3[_0xa39c('0x19')](_0x3125ba);return _0x21eef3[_0xa39c('0x1e')](_0xa39c('0x1f'),_0xe60247+'-'+_0x19f27f+'/'+_0x4fef8d)[_0xa39c('0x1a')](_0x54ef04);}return null;};}function patchUpdates(_0x2e86d4){return function(_0x20bacd){try{jsonpatch[_0xa39c('0x20')](_0x20bacd,_0x2e86d4,!![]);}catch(_0x518a86){return BPromise['reject'](_0x518a86);}return _0x20bacd['save']();};}function saveUpdates(_0x2cca79,_0x1a5f5d){return function(_0x20580d){if(_0x20580d){return _0x20580d[_0xa39c('0x21')](_0x2cca79)[_0xa39c('0x22')](function(_0x99063d){return _0x99063d;});}return null;};}function removeEntity(_0x2c8783,_0x156ab7){return function(_0x52253c){if(_0x52253c){return _0x52253c[_0xa39c('0x23')]()[_0xa39c('0x22')](function(){_0x2c8783[_0xa39c('0x19')](0xcc)[_0xa39c('0x24')]();});}};}function handleEntityNotFound(_0x1e2a8b,_0x104cef){return function(_0x174f52){if(!_0x174f52){_0x1e2a8b[_0xa39c('0x18')](0x194);}return _0x174f52;};}function handleError(_0x54ec54,_0x55b2cd){_0x55b2cd=_0x55b2cd||0x1f4;return function(_0x47613b){logger[_0xa39c('0x25')](_0x47613b[_0xa39c('0x26')]);if(_0x47613b[_0xa39c('0x27')]){delete _0x47613b[_0xa39c('0x27')];}_0x54ec54[_0xa39c('0x19')](_0x55b2cd)[_0xa39c('0x28')](_0x47613b);};}exports[_0xa39c('0x29')]=function(_0x48d01d,_0x79bd9b){var _0x5e4fa6={},_0x33ce15={},_0x8c22fa={'count':0x0,'rows':[]};var _0x2171e4=_[_0xa39c('0x2a')](db[_0xa39c('0x2b')][_0xa39c('0x2c')],function(_0x14e216){return{'name':_0x14e216[_0xa39c('0x2d')],'type':_0x14e216[_0xa39c('0x2e')][_0xa39c('0x2f')]};});_0x33ce15['model']=_['differenceBy'](_[_0xa39c('0x2a')](_0x2171e4,_0xa39c('0x27')),['format']);_0x33ce15[_0xa39c('0x30')]=_[_0xa39c('0x31')](_0x48d01d[_0xa39c('0x30')]);_0x33ce15[_0xa39c('0x32')]=_[_0xa39c('0x33')](_0x33ce15['model'],_0x33ce15[_0xa39c('0x30')]);_0x5e4fa6['attributes']=_[_0xa39c('0x33')](_0x33ce15['model'],qs[_0xa39c('0x34')](_0x48d01d[_0xa39c('0x30')][_0xa39c('0x34')]));_0x5e4fa6[_0xa39c('0x35')]=_0x5e4fa6['attributes'][_0xa39c('0x36')]?_0x5e4fa6[_0xa39c('0x35')]:_0x33ce15[_0xa39c('0x37')];if(!_0x48d01d['query'][_0xa39c('0x38')]('nolimit')){_0x5e4fa6['limit']=qs[_0xa39c('0x1d')](_0x48d01d['query'][_0xa39c('0x1d')]);_0x5e4fa6[_0xa39c('0x39')]=qs[_0xa39c('0x39')](_0x48d01d[_0xa39c('0x30')][_0xa39c('0x39')]);}_0x5e4fa6[_0xa39c('0x3a')]=qs[_0xa39c('0x3b')](_0x48d01d[_0xa39c('0x30')][_0xa39c('0x3b')]);_0x5e4fa6[_0xa39c('0x3c')]=qs[_0xa39c('0x32')](_[_0xa39c('0x3d')](_0x48d01d[_0xa39c('0x30')],_0x33ce15[_0xa39c('0x32')]),_0x2171e4);if(_0x48d01d['query']['filter']){_0x5e4fa6[_0xa39c('0x3c')]=_[_0xa39c('0x3e')](_0x5e4fa6[_0xa39c('0x3c')],{'$or':_[_0xa39c('0x2a')](_0x2171e4,function(_0x78eb91){if(_0x78eb91[_0xa39c('0x2e')]!=='VIRTUAL'){var _0x28f05c={};_0x28f05c[_0x78eb91[_0xa39c('0x27')]]={'$like':'%'+_0x48d01d[_0xa39c('0x30')]['filter']+'%'};return _0x28f05c;}})});}_0x5e4fa6=_[_0xa39c('0x3e')]({},_0x5e4fa6,_0x48d01d[_0xa39c('0x3f')]);var _0x140018={'where':_0x5e4fa6[_0xa39c('0x3c')]};return db['VoiceRecording']['count'](_0x140018)['then'](function(_0x34fdb4){_0x8c22fa[_0xa39c('0x1c')]=_0x34fdb4;if(_0x48d01d[_0xa39c('0x30')][_0xa39c('0x40')]){_0x5e4fa6[_0xa39c('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0xa39c('0x42')](_0x5e4fa6);})[_0xa39c('0x22')](function(_0x3d0742){_0x8c22fa['rows']=_0x3d0742;return _0x8c22fa;})[_0xa39c('0x22')](respondWithFilteredResult(_0x79bd9b,_0x5e4fa6))[_0xa39c('0x43')](handleError(_0x79bd9b,null));};exports[_0xa39c('0x44')]=function(_0x2c1707,_0x4b0d13){var _0x3361cb={'raw':![],'where':{'id':_0x2c1707['params']['id']}},_0x4b2e50={};_0x4b2e50[_0xa39c('0x37')]=_[_0xa39c('0x31')](db['VoiceRecording'][_0xa39c('0x2c')]);_0x4b2e50[_0xa39c('0x30')]=_[_0xa39c('0x31')](_0x2c1707[_0xa39c('0x30')]);_0x4b2e50[_0xa39c('0x32')]=_[_0xa39c('0x33')](_0x4b2e50['model'],_0x4b2e50['query']);_0x3361cb['attributes']=_[_0xa39c('0x33')](_0x4b2e50[_0xa39c('0x37')],qs[_0xa39c('0x34')](_0x2c1707[_0xa39c('0x30')]['fields']));_0x3361cb['attributes']=_0x3361cb[_0xa39c('0x35')]['length']?_0x3361cb[_0xa39c('0x35')]:_0x4b2e50[_0xa39c('0x37')];if(_0x2c1707[_0xa39c('0x30')][_0xa39c('0x40')]){_0x3361cb[_0xa39c('0x41')]=[{'all':!![]}];}_0x3361cb=_[_0xa39c('0x3e')]({},_0x3361cb,_0x2c1707['options']);return db['VoiceRecording']['find'](_0x3361cb)[_0xa39c('0x22')](handleEntityNotFound(_0x4b0d13,null))['then'](respondWithResult(_0x4b0d13,null))[_0xa39c('0x43')](handleError(_0x4b0d13,null));};exports[_0xa39c('0x45')]=function(_0x321e5e,_0x405237){return db[_0xa39c('0x2b')][_0xa39c('0x45')](_0x321e5e[_0xa39c('0x46')],{})[_0xa39c('0x22')](respondWithResult(_0x405237,0xc9))[_0xa39c('0x43')](handleError(_0x405237,null));};exports[_0xa39c('0x21')]=function(_0x47c4f7,_0x40287d){if(_0x47c4f7[_0xa39c('0x46')]['id']){delete _0x47c4f7[_0xa39c('0x46')]['id'];}return db[_0xa39c('0x2b')]['find']({'where':{'id':_0x47c4f7[_0xa39c('0x47')]['id']}})['then'](handleEntityNotFound(_0x40287d,null))[_0xa39c('0x22')](saveUpdates(_0x47c4f7[_0xa39c('0x46')],null))[_0xa39c('0x22')](respondWithResult(_0x40287d,null))[_0xa39c('0x43')](handleError(_0x40287d,null));};exports[_0xa39c('0x48')]=function(_0xf2f6f5,_0x21ddce){return db[_0xa39c('0x2b')][_0xa39c('0x48')]()[_0xa39c('0x22')](respondWithResult(_0x21ddce,null))['catch'](handleError(_0x21ddce,null));};exports[_0xa39c('0x49')]=function(_0x392f50,_0x4812da,_0x5b71de){var _0x519053=require(_0xa39c('0x4a'));var _0x52ea19=![];var _0x442fc6={};if(_0x392f50[_0xa39c('0x30')][_0xa39c('0x2e')]&&_0x392f50[_0xa39c('0x30')][_0xa39c('0x2e')]==='uniqueid'){_0x442fc6[_0xa39c('0x4b')]=_0x392f50['params']['id'];}else{_0x442fc6['id']=_0x392f50[_0xa39c('0x47')]['id'];}return db[_0xa39c('0x2b')][_0xa39c('0x4c')]({'where':_0x442fc6,'attributes':['id',_0xa39c('0x4d')],'raw':!![]})[_0xa39c('0x22')](handleEntityNotFound(_0x4812da,null))[_0xa39c('0x22')](function(_0x45d519){if(_0x45d519){var _0x4b0f0e=_0x45d519[_0xa39c('0x4d')];var _0x5a65dc=util[_0xa39c('0x4e')](_0xa39c('0x4f'),_0x4b0f0e);if(fs['existsSync'](_0x5a65dc)){_0x52ea19=!![];return _0x519053[_0xa39c('0x50')](_0x5a65dc,_0x4b0f0e,config['secrets'][_0xa39c('0x51')])[_0xa39c('0x22')](function(){return _0x45d519;});}return _0x45d519;}})[_0xa39c('0x22')](function(_0x5208f1){if(_0x5208f1){var _0x23273a=_0x5208f1['value'];if(!fs[_0xa39c('0x52')](_0x23273a)){throw new db[(_0xa39c('0x53'))][(_0xa39c('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x5208f1[_0xa39c('0x55')]){return _0x4812da[_0xa39c('0x49')](_0x23273a,_0x5208f1['filename']+path['extname'](_0x23273a),function(){if(_0x52ea19){fs['unlink'](_0x23273a);}});}else{return _0x4812da[_0xa39c('0x49')](_0x23273a,function(_0xf1446c){if(_0x52ea19){fs[_0xa39c('0x56')](_0x23273a);}});}}})['catch'](function(_0x31d331){if(_0x31d331[_0xa39c('0x57')]===_0xa39c('0x58')){_0x4812da[_0xa39c('0x19')](0x194)[_0xa39c('0x28')](_0xa39c('0x59'));}else{return handleError(_0x4812da,null);}});};exports[_0xa39c('0x5a')]=function(_0x3252ba,_0x1d1b64,_0x1a90ed){var _0x3f5581=require(_0xa39c('0x4a'));var _0x2d0edb=![];var _0x3320d8={'$and':[db[_0xa39c('0x5b')][_0xa39c('0x3c')](db[_0xa39c('0x5b')]['fn'](_0xa39c('0x5c'),db[_0xa39c('0x5b')][_0xa39c('0x5d')](_0xa39c('0x4b'))),_0x3252ba[_0xa39c('0x30')][_0xa39c('0x5e')])]};if(_0x3252ba[_0xa39c('0x30')]['type']&&_0x3252ba['query'][_0xa39c('0x2e')]==='uniqueid'){_0x3320d8[_0xa39c('0x5f')]['push']({'uniqueid':_0x3252ba['params']['id']});}else{_0x3320d8[_0xa39c('0x5f')]['push']({'id':_0x3252ba['params']['id']});}return db[_0xa39c('0x2b')][_0xa39c('0x4c')]({'where':_0x3320d8,'attributes':['id','value'],'raw':!![]})[_0xa39c('0x22')](handleEntityNotFound(_0x1d1b64,null))[_0xa39c('0x22')](function(_0x33e69c){if(_0x33e69c){var _0x1caee0=util['format']('%s.cypher',_0x33e69c[_0xa39c('0x4d')]);if(fs[_0xa39c('0x52')](_0x1caee0)){_0x2d0edb=!![];return _0x3f5581[_0xa39c('0x50')](_0x1caee0,_0x33e69c[_0xa39c('0x4d')],config[_0xa39c('0x60')][_0xa39c('0x51')])[_0xa39c('0x22')](function(){return _0x33e69c;});}return _0x33e69c;}})[_0xa39c('0x22')](function(_0x133bcc){if(_0x133bcc){if(!fs[_0xa39c('0x52')](_0x133bcc[_0xa39c('0x4d')])){throw new db[(_0xa39c('0x53'))][(_0xa39c('0x54'))](_0xa39c('0x58'));}if(_0x133bcc[_0xa39c('0x55')]){return _0x1d1b64['download'](_0x133bcc['value'],_0x133bcc[_0xa39c('0x55')]+path[_0xa39c('0x61')](_0x133bcc[_0xa39c('0x4d')]),function(){if(_0x2d0edb){fs[_0xa39c('0x56')](_0x133bcc[_0xa39c('0x4d')]);}});}else{return _0x1d1b64[_0xa39c('0x49')](_0x133bcc[_0xa39c('0x4d')],function(_0x56cc38){if(_0x2d0edb){fs[_0xa39c('0x56')](_0x133bcc[_0xa39c('0x4d')]);}});}}})[_0xa39c('0x43')](handleError(_0x1d1b64,null));};exports[_0xa39c('0x23')]=function(_0x52ed23,_0x325065){return db[_0xa39c('0x2b')][_0xa39c('0x4c')]({'where':{'id':_0x52ed23['params']['id']}})[_0xa39c('0x22')](function(_0x55acdd){if(_['isNil'](_0x55acdd)){throw new ReferenceError(_0xa39c('0x62'));}return _0x55acdd;})['then'](function(_0x2675ca){var _0x5a5870=_0x2675ca[_0xa39c('0x4d')];logger['info'](_0xa39c('0x63'),_0x5a5870);if(!_[_0xa39c('0x64')](_0x2675ca[_0xa39c('0x4d')])&&fs['existsSync'](_0x5a5870)){logger['info'](_0xa39c('0x65')+_0x5a5870+_0xa39c('0x66'));fs[_0xa39c('0x67')](_0x5a5870);}_0x5a5870=_0x5a5870+_0xa39c('0x68');if(!_['isNil'](_0x2675ca[_0xa39c('0x4d')])&&fs[_0xa39c('0x52')](_0x5a5870)){logger[_0xa39c('0x69')]('File:\x20\x22'+_0x5a5870+_0xa39c('0x66'));fs['unlinkSync'](_0x5a5870);}return _0x2675ca;})[_0xa39c('0x22')](function(_0x45ec2d){if(!_0x45ec2d)throw new InternalError();return _0x45ec2d[_0xa39c('0x23')]();})['then'](function(){_0x325065[_0xa39c('0x19')](0xcc)[_0xa39c('0x24')]();})[_0xa39c('0x43')](handleError(_0x325065,null));};function getBucketslist(_0x52418c,_0x4ff44c,_0x1e7671){return new Promise(function(_0x3b449f,_0x65b7a7){var _0x400872=new AWS['S3']({'accessKeyId':_0x4ff44c,'secretAccessKey':_0x52418c,'region':_0x1e7671});_0x400872[_0xa39c('0x6a')]({},function(_0x213606,_0x34ac81){if(_0x213606){return _0x65b7a7(_0x213606);}else{return _0x3b449f(_0x34ac81);}});});}function createBucket(_0x362d21,_0xee4b90,_0x53c4aa,_0x1dcb71){return new Promise(function(_0x3184a4,_0x47905f){var _0x103ad1=new AWS['S3']({'accessKeyId':_0xee4b90,'secretAccessKey':_0x362d21,'region':_0x53c4aa});_0x103ad1['createBucket']({'Bucket':_0x1dcb71},function(_0x4c1035,_0x402424){if(_0x4c1035){return _0x47905f(_0x4c1035);}else{return _0x3184a4(_0x402424);}});});}function uploadFile(_0x333501,_0x3b9aad,_0x4fd435,_0x38001a,_0xc6d80e,_0x1825c8){return new Promise(function(_0x3a8b9c,_0x5a87df){var _0x5d0f8e=new AWS['S3']({'accessKeyId':_0x3b9aad,'secretAccessKey':_0x333501,'region':_0x4fd435});_0x5d0f8e[_0xa39c('0x6b')]({'Bucket':_0x38001a,'Key':_0xc6d80e,'Body':_0x1825c8},function(_0x55461b,_0x396e85){if(_0x55461b){return _0x5a87df(_0x55461b);}else{return _0x3a8b9c(_0x396e85);}});});}function startTranscribe(_0x9a502c,_0x2ffa79,_0x7bb258,_0x1cba5e,_0x6264b3,_0x31d56c){return new Promise(function(_0x511a82,_0x1e968d){var _0x4e75bd=new AWS[(_0xa39c('0x6c'))]({'accessKeyId':_0x2ffa79,'secretAccessKey':_0x9a502c,'region':_0x7bb258});_0x4e75bd[_0xa39c('0x6d')]({'TranscriptionJobName':_0x1cba5e,'LanguageCode':_0x6264b3,'Media':{'MediaFileUri':_0x31d56c}},function(_0x179314,_0x420581){if(_0x179314){return _0x1e968d(_0x179314);}else{return _0x511a82(_0x420581);}});});}function transcribe(_0x525203,_0x51ad5d,_0x303838,_0x39c027,_0x13ce6c,_0x48e402,_0x3200bc){return new Promise(function(_0x2b59d4,_0x66a48f){var _0x1616a0={};logger[_0xa39c('0x69')](util[_0xa39c('0x4e')](_0xa39c('0x6e'),_0x525203,_0x13ce6c));return uploadFile(_0x51ad5d,_0x303838,_0x39c027,_0x13ce6c,path[_0xa39c('0x6f')](_0x48e402),fs[_0xa39c('0x70')](_0x48e402))['then'](function(_0x41764d){logger['info'](util[_0xa39c('0x4e')](_0xa39c('0x71'),_0x525203,_0x13ce6c,_0x41764d[_0xa39c('0x72')]));_0x1616a0[_0xa39c('0x73')]=_0x41764d[_0xa39c('0x74')];_0x1616a0[_0xa39c('0x75')]=_0x41764d[_0xa39c('0x72')];logger['info'](util[_0xa39c('0x4e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x525203));return startTranscribe(_0x51ad5d,_0x303838,_0x39c027,uuidv4(),_0x3200bc,_0x41764d['Location']);})[_0xa39c('0x22')](function(_0x2ae129){logger['info'](util[_0xa39c('0x4e')](_0xa39c('0x76'),_0x525203,_0x2ae129['TranscriptionJob'][_0xa39c('0x77')]));_0x1616a0[_0xa39c('0x78')]=_0x2ae129['TranscriptionJob'][_0xa39c('0x77')];_0x1616a0['transcribeStatus']=_0x2ae129[_0xa39c('0x79')][_0xa39c('0x7a')];return _0x2b59d4(_0x1616a0);})['catch'](function(_0x233f16){return _0x66a48f(_0x233f16);});});}exports[_0xa39c('0x7b')]=function(_0x4c61c0,_0x1f9709,_0x4a3883){var _0x5bfa33;var _0x57dfda;var _0x5e0f2c;var _0x33cc51=require(_0xa39c('0x4a'));return db[_0xa39c('0x2b')][_0xa39c('0x7c')]({'where':{'id':_0x4c61c0['params']['id']}})[_0xa39c('0x22')](function(_0x3af58e){if(_0x3af58e){var _0xf4c1d4=util['format'](_0xa39c('0x4f'),_0x3af58e['value']);if(fs['existsSync'](_0xf4c1d4)){cypher=!![];return _0x33cc51[_0xa39c('0x50')](_0xf4c1d4,_0x3af58e[_0xa39c('0x4d')],config['secrets'][_0xa39c('0x51')])[_0xa39c('0x22')](function(){return _0x3af58e;});}return _0x3af58e;}})[_0xa39c('0x22')](function(_0x46b4ca){if(!_0x46b4ca){throw new db[(_0xa39c('0x53'))]['ValidationError'](_0xa39c('0x7d'));}_0x57dfda=_0x46b4ca;return db[_0xa39c('0x7e')][_0xa39c('0x7c')]({'where':{'id':0x1}});})[_0xa39c('0x22')](handleEntityNotFound(_0x1f9709,null))[_0xa39c('0x22')](function(_0x3f2846){if(_0x3f2846){_0x5bfa33=_0x3f2846;if(!_0x5bfa33[_0xa39c('0x7f')]||!_0x5bfa33[_0xa39c('0x80')]||!_0x5bfa33[_0xa39c('0x81')]||!_0x5bfa33[_0xa39c('0x82')]||!_0x5bfa33['bucket']){throw new db[(_0xa39c('0x53'))][(_0xa39c('0x54'))](_0xa39c('0x83'));}if(_0x4c61c0['body']['runSentiment']&&(!_0x5bfa33[_0xa39c('0x84')]||!_0x5bfa33[_0xa39c('0x85')]||!_0x5bfa33['sentimentRegion']||!_0x5bfa33[_0xa39c('0x82')]||!_0x5bfa33['bucket'])){throw new db['Sequelize'][(_0xa39c('0x54'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xa39c('0x86')][_0xa39c('0x7c')]({'where':{'id':_0x5bfa33['transcribeAccountId']}});}})[_0xa39c('0x22')](function(_0x49cd0c){if(!_0x49cd0c){throw new db[(_0xa39c('0x53'))][(_0xa39c('0x54'))](_0xa39c('0x87'));}if(!_0x49cd0c[_0xa39c('0x88')]||!_0x49cd0c['data2']){throw new db[(_0xa39c('0x53'))]['ValidationError'](_0xa39c('0x89'));}_0x5e0f2c=_0x49cd0c;return getBucketslist(_0x5e0f2c[_0xa39c('0x88')],_0x5e0f2c[_0xa39c('0x8a')],_0x5bfa33['transcribeRegion']);})[_0xa39c('0x22')](function(_0xedc8db){if(_0xedc8db&&_0xedc8db[_0xa39c('0x8b')]){var _0x1e87bb=_['find'](_0xedc8db['Buckets'],function(_0x316889){return _0x316889['Name']===_0x5bfa33[_0xa39c('0x73')];});if(!_0x1e87bb){logger[_0xa39c('0x69')](util[_0xa39c('0x4e')](_0xa39c('0x8c'),_0x4c61c0[_0xa39c('0x47')]['id'],_0x5bfa33[_0xa39c('0x73')]));return createBucket(_0x5e0f2c['data1'],_0x5e0f2c[_0xa39c('0x8a')],_0x5bfa33[_0xa39c('0x81')],_0x5bfa33[_0xa39c('0x73')]);}logger['info'](util['format'](_0xa39c('0x8d'),_0x4c61c0[_0xa39c('0x47')]['id'],_0x5bfa33[_0xa39c('0x73')]));return;}})['then'](function(_0x169c2e){if(_0x57dfda[_0xa39c('0x8e')]===_0xa39c('0x8f')){return transcribe(_0x4c61c0['params']['id'],_0x5e0f2c[_0xa39c('0x88')],_0x5e0f2c[_0xa39c('0x8a')],_0x5bfa33[_0xa39c('0x81')],_0x5bfa33[_0xa39c('0x73')],_0x57dfda[_0xa39c('0x4d')],_0x5bfa33['language']);}else{logger[_0xa39c('0x69')](util[_0xa39c('0x4e')](_0xa39c('0x90'),_0x4c61c0[_0xa39c('0x47')]['id']));return{'transcribeStatus':_0xa39c('0x91')};}})[_0xa39c('0x22')](function(_0x40b66f){if(_0x40b66f){_0x40b66f[_0xa39c('0x92')]=_0x4c61c0[_0xa39c('0x46')][_0xa39c('0x93')];return _0x57dfda['updateAttributes'](_0x40b66f);}})['then'](respondWithResult(_0x1f9709,null))[_0xa39c('0x43')](handleError(_0x1f9709,null));};function writeFile(_0x376683,_0x8f204b){return new Promise(function(_0x28bb9f,_0x4422e7){fs[_0xa39c('0x94')](_0x8f204b,_0x376683,function(_0x35f0ab,_0x39bf15){if(_0x35f0ab){return _0x4422e7(_0x35f0ab);}else{return _0x28bb9f(_0x39bf15);}});});}exports['downloadTranscribe']=function(_0x2abc5d,_0x4ff63f,_0x26bc53){return db[_0xa39c('0x2b')]['findOne']({'where':{'id':_0x2abc5d['params']['id']}})[_0xa39c('0x22')](handleEntityNotFound(_0x4ff63f))[_0xa39c('0x22')](function(_0x4e4b2b){if(_0x4e4b2b&&_0x4e4b2b[_0xa39c('0x95')]){var _0x41f866=_0x4e4b2b[_0xa39c('0x95')];var _0x53746a=config['root']+_0xa39c('0x96')+_0x4e4b2b['id']+'.txt';if(fs[_0xa39c('0x52')](_0x53746a)){return _0x53746a;}return writeFile(_0x41f866,_0x53746a)[_0xa39c('0x22')](function(){return _0x53746a;});}else{throw new db[(_0xa39c('0x53'))][(_0xa39c('0x54'))]('Transcript\x20not\x20available');}})[_0xa39c('0x22')](function(_0x4f6650){return _0x4ff63f[_0xa39c('0x49')](_0x4f6650);})[_0xa39c('0x43')](handleError(_0x4ff63f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d05868e..9f832ce 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 _0xfb51=['path','rimraf','./voiceRecording.attributes','define','voice_recordings','uniqueid','util','../../config/logger','api'];(function(_0x54aedc,_0x496913){var _0x426586=function(_0x4f6337){while(--_0x4f6337){_0x54aedc['push'](_0x54aedc['shift']());}};_0x426586(++_0x496913);}(_0xfb51,0xc3));var _0x1fb5=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xfb51[_0x397f37];return _0x31cae6;};'use strict';var _=require('lodash');var util=require(_0x1fb5('0x0'));var logger=require(_0x1fb5('0x1'))(_0x1fb5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb5('0x3'));var rimraf=require(_0x1fb5('0x4'));var config=require('../../config/environment');var attributes=require(_0x1fb5('0x5'));module['exports']=function(_0x3b6061,_0x39aca7){return _0x3b6061[_0x1fb5('0x6')]('VoiceRecording',attributes,{'tableName':_0x1fb5('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1fb5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85de=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','define'];(function(_0xfcf737,_0x132075){var _0x5eccbe=function(_0x2dc482){while(--_0x2dc482){_0xfcf737['push'](_0xfcf737['shift']());}};_0x5eccbe(++_0x132075);}(_0x85de,0x65));var _0xe85d=function(_0xa3633f,_0x19efea){_0xa3633f=_0xa3633f-0x0;var _0x559e56=_0x85de[_0xa3633f];return _0x559e56;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var logger=require(_0xe85d('0x2'))(_0xe85d('0x3'));var moment=require(_0xe85d('0x4'));var BPromise=require(_0xe85d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe85d('0x6'));var rimraf=require(_0xe85d('0x7'));var config=require(_0xe85d('0x8'));var attributes=require(_0xe85d('0x9'));module['exports']=function(_0x5f12a2,_0x2797cd){return _0x5f12a2[_0xe85d('0xa')](_0xe85d('0xb'),attributes,{'tableName':_0xe85d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe85d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 97d97cd..4cbc44c 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x478735,_0x21d957){var _0x16623b=function(_0x204be2){while(--_0x204be2){_0x478735['push'](_0x478735['shift']());}};_0x16623b(++_0x21d957);}(_0x1623,0xab));var _0x3162=function(_0x1344a7,_0x3fdc04){_0x1344a7=_0x1344a7-0x0;var _0x17a642=_0x1623[_0x1344a7];return _0x17a642;};'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')]('VoiceRecording,\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')]('VoiceRecording,\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);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x1a')]?_0x1eed46['options']['attributes']||null:null,'limit':_0x1eed46[_0x3162('0x1a')]?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1c')]||null:null})[_0x3162('0xa')](function(_0x31b27b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('UpdateVoiceRecording',_0x1eed46,JSON[_0x3162('0xf')](_0x31b27b));_0x4b2bf3(_0x31b27b);})[_0x3162('0x15')](function(_0x3919e7){logger[_0x3162('0x10')](_0x3162('0x16'),_0x3919e7[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x3919e7[_0x3162('0x13')]));});});};exports[_0x3162('0x1d')]=function(_0x356c5d){var _0x8fa09f=this;return new Promise(function(_0x2f62d7,_0x1c03a4){var _0x48de45=require(_0x3162('0x1e'));var _0x552469;return db[_0x3162('0x1f')][_0x3162('0x20')]({'attributes':['id',_0x3162('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x4903e7){_0x552469=_0x4903e7;return db[_0x3162('0x17')][_0x3162('0x22')](_0x356c5d[_0x3162('0x19')]);})[_0x3162('0xa')](function(_0x2f88ec){if(_0x552469['callRecordingEncryption']&&fs[_0x3162('0x23')](_0x2f88ec['value'])){var _0xf11765=util[_0x3162('0x24')](_0x3162('0x25'),_0x2f88ec[_0x3162('0x26')]);return _0x48de45[_0x3162('0x27')](_0x2f88ec[_0x3162('0x26')],_0xf11765,config[_0x3162('0x28')][_0x3162('0x29')])['then'](function(){fs[_0x3162('0x2a')](_0x2f88ec[_0x3162('0x26')]);logger['info'](_0x3162('0x2b'));return _0x2f88ec;});}return _0x2f88ec;})[_0x3162('0xa')](function(_0x528340){logger['info'](_0x3162('0x1d'),_0x356c5d);logger['debug'](_0x3162('0x1d'),_0x356c5d,JSON[_0x3162('0xf')](_0x528340));_0x2f62d7(_0x528340);})[_0x3162('0x15')](function(_0x551442){logger['error'](_0x3162('0x1d'),_0x551442[_0x3162('0x13')],_0x356c5d);_0x1c03a4(_0x8fa09f['error'](0x1f4,_0x551442[_0x3162('0x13')]));});});}; \ No newline at end of file +var _0x32f4=['unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','../../components/encryptor','findOne','callRecordingEncryption','existsSync','format','encryptFile','value','secrets','recording'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x32f4,0x154));var _0x432f=function(_0x57f1b7,_0xf52ae8){_0x57f1b7=_0x57f1b7-0x0;var _0x4629b6=_0x32f4[_0x57f1b7];return _0x4629b6;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});}exports[_0x432f('0x16')]=function(_0x243cf){var _0x3cd5da=this;return new Promise(function(_0x129582,_0x5ae24e){return db[_0x432f('0x17')]['update'](_0x243cf[_0x432f('0x18')],{'raw':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1b')]||null:null,'attributes':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1c')]||null:null,'limit':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')]['limit']||null:null})['then'](function(_0x343d13){logger['info'](_0x432f('0x16'),_0x243cf);logger['debug'](_0x432f('0x16'),_0x243cf,JSON[_0x432f('0x10')](_0x343d13));_0x129582(_0x343d13);})[_0x432f('0x15')](function(_0x89ea50){logger[_0x432f('0x11')](_0x432f('0x16'),_0x89ea50['message'],_0x243cf);_0x5ae24e(_0x3cd5da[_0x432f('0x11')](0x1f4,_0x89ea50[_0x432f('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x2cbde9){var _0x3e37ec=this;return new Promise(function(_0x2bcbb4,_0x23347e){var _0x44839=require(_0x432f('0x1d'));var _0x138a6a;return db['Setting'][_0x432f('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x432f('0xb')](function(_0x573cc5){_0x138a6a=_0x573cc5;return db[_0x432f('0x17')]['create'](_0x2cbde9[_0x432f('0x18')]);})['then'](function(_0x325a9c){if(_0x138a6a[_0x432f('0x1f')]&&fs[_0x432f('0x20')](_0x325a9c['value'])){var _0x6a116e=util[_0x432f('0x21')]('%s.cypher',_0x325a9c['value']);return _0x44839[_0x432f('0x22')](_0x325a9c[_0x432f('0x23')],_0x6a116e,config[_0x432f('0x24')][_0x432f('0x25')])[_0x432f('0xb')](function(){fs[_0x432f('0x26')](_0x325a9c['value']);logger['info'](_0x432f('0x27'));return _0x325a9c;});}return _0x325a9c;})[_0x432f('0xb')](function(_0x184203){logger['info'](_0x432f('0x28'),_0x2cbde9);logger[_0x432f('0x29')](_0x432f('0x28'),_0x2cbde9,JSON[_0x432f('0x10')](_0x184203));_0x2bcbb4(_0x184203);})[_0x432f('0x15')](function(_0x3ad632){logger[_0x432f('0x11')](_0x432f('0x28'),_0x3ad632['message'],_0x2cbde9);_0x23347e(_0x3e37ec['error'](0x1f4,_0x3ad632[_0x432f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 83f06e7..0ac96bd 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 _0xe5b1=['index','/describe','describe','/:id','show','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe5b1,0xb4));var _0x1e5b=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xe5b1[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require(_0x1e5b('0x0'));var util=require('util');var path=require(_0x1e5b('0x1'));var timeout=require(_0x1e5b('0x2'));var express=require(_0x1e5b('0x3'));var router=express[_0x1e5b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1e5b('0x5'));var config=require(_0x1e5b('0x6'));var controller=require(_0x1e5b('0x7'));router[_0x1e5b('0x8')]('/',auth[_0x1e5b('0x9')](),controller[_0x1e5b('0xa')]);router[_0x1e5b('0x8')](_0x1e5b('0xb'),auth[_0x1e5b('0x9')](),controller[_0x1e5b('0xc')]);router[_0x1e5b('0x8')](_0x1e5b('0xd'),auth['isAuthenticated'](),controller[_0x1e5b('0xe')]);router['post']('/',auth[_0x1e5b('0x9')](),controller[_0x1e5b('0xf')]);router[_0x1e5b('0x10')]('/:id',auth[_0x1e5b('0x9')](),controller[_0x1e5b('0x11')]);router[_0x1e5b('0x12')]('/:id',auth[_0x1e5b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ff6=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0x5ff6,0x87));var _0x65ff=function(_0x17650b,_0x3adc11){_0x17650b=_0x17650b-0x0;var _0x10c33c=_0x5ff6[_0x17650b];return _0x10c33c;};'use strict';var multer=require(_0x65ff('0x0'));var util=require(_0x65ff('0x1'));var path=require(_0x65ff('0x2'));var timeout=require(_0x65ff('0x3'));var express=require(_0x65ff('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x65ff('0x5'));var config=require(_0x65ff('0x6'));var controller=require(_0x65ff('0x7'));router[_0x65ff('0x8')]('/',auth['isAuthenticated'](),controller[_0x65ff('0x9')]);router[_0x65ff('0x8')](_0x65ff('0xa'),auth[_0x65ff('0xb')](),controller[_0x65ff('0xc')]);router[_0x65ff('0x8')](_0x65ff('0xd'),auth[_0x65ff('0xb')](),controller[_0x65ff('0xe')]);router[_0x65ff('0xf')]('/',auth[_0x65ff('0xb')](),controller[_0x65ff('0x10')]);router[_0x65ff('0x11')]('/:id',auth[_0x65ff('0xb')](),controller[_0x65ff('0x12')]);router[_0x65ff('0x13')](_0x65ff('0xd'),auth['isAuthenticated'](),controller[_0x65ff('0x14')]);module[_0x65ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b5862fb..532e4be 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 _0x740e=['blind','STRING','Yes','sequelize','exports'];(function(_0x8386ea,_0x45474d){var _0x369414=function(_0x2b9f28){while(--_0x2b9f28){_0x8386ea['push'](_0x8386ea['shift']());}};_0x369414(++_0x45474d);}(_0x740e,0x1c5));var _0xe740=function(_0x1d1b7b,_0x15f59e){_0x1d1b7b=_0x1d1b7b-0x0;var _0x481669=_0x740e[_0x1d1b7b];return _0x481669;};'use strict';var Sequelize=require(_0xe740('0x0'));var moment=require('moment');module[_0xe740('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe740('0x2'),'attended')},'result':{'type':Sequelize[_0xe740('0x3')]},'transfererchannel':{'type':Sequelize[_0xe740('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xe740('0x3')]},'transferercalleridname':{'type':Sequelize[_0xe740('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe740('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xe740('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xe740('0x3')]},'transferercontext':{'type':Sequelize[_0xe740('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xe740('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xe740('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xe740('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe740('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe740('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xe740('0x3')]},'transfereecontext':{'type':Sequelize[_0xe740('0x3')]},'transfereeexten':{'type':Sequelize[_0xe740('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xe740('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xe740('0x4'),'No')},'context':{'type':Sequelize[_0xe740('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4cc=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x564878,_0x32b7db){var _0x26e2fb=function(_0x3fa780){while(--_0x3fa780){_0x564878['push'](_0x564878['shift']());}};_0x26e2fb(++_0x32b7db);}(_0xf4cc,0x181));var _0xcf4c=function(_0x38d0a7,_0x548a0b){_0x38d0a7=_0x38d0a7-0x0;var _0xbaa08f=_0xf4cc[_0x38d0a7];return _0xbaa08f;};'use strict';var Sequelize=require(_0xcf4c('0x0'));var moment=require(_0xcf4c('0x1'));module[_0xcf4c('0x2')]={'type':{'type':Sequelize[_0xcf4c('0x3')](_0xcf4c('0x4'),_0xcf4c('0x5'))},'result':{'type':Sequelize[_0xcf4c('0x6')]},'transfererchannel':{'type':Sequelize[_0xcf4c('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xcf4c('0x6')]},'transferercalleridname':{'type':Sequelize[_0xcf4c('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xcf4c('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xcf4c('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xcf4c('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xcf4c('0x6')]},'transfereechannel':{'type':Sequelize[_0xcf4c('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xcf4c('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xcf4c('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xcf4c('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xcf4c('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xcf4c('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xcf4c('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0xcf4c('0x7'),'No')},'context':{'type':Sequelize[_0xcf4c('0x6')]},'extension':{'type':Sequelize[_0xcf4c('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1b3eec0..368d718 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 _0x673a=['save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','VoiceTransferReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x41cb86,_0x4a705c){var _0x39a7d2=function(_0x22c960){while(--_0x22c960){_0x41cb86['push'](_0x41cb86['shift']());}};_0x39a7d2(++_0x4a705c);}(_0x673a,0x1ca));var _0xa673=function(_0x43371b,_0x1cb4cf){_0x43371b=_0x43371b-0x0;var _0x19cd26=_0x673a[_0x43371b];return _0x19cd26;};'use strict';var emlformat=require(_0xa673('0x0'));var rimraf=require(_0xa673('0x1'));var zipdir=require(_0xa673('0x2'));var jsonpatch=require(_0xa673('0x3'));var rp=require(_0xa673('0x4'));var moment=require(_0xa673('0x5'));var BPromise=require(_0xa673('0x6'));var Mustache=require(_0xa673('0x7'));var util=require('util');var path=require(_0xa673('0x8'));var sox=require(_0xa673('0x9'));var csv=require(_0xa673('0xa'));var ejs=require(_0xa673('0xb'));var fs=require('fs');var fs_extra=require(_0xa673('0xc'));var _=require(_0xa673('0xd'));var squel=require('squel');var crypto=require(_0xa673('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa673('0xf'));var toCsv=require(_0xa673('0xa'));var querystring=require(_0xa673('0x10'));var Papa=require('papaparse');var Redis=require(_0xa673('0x11'));var authService=require(_0xa673('0x12'));var qs=require(_0xa673('0x13'));var as=require(_0xa673('0x14'));var hardwareService=require(_0xa673('0x15'));var logger=require(_0xa673('0x16'))(_0xa673('0x17'));var utils=require(_0xa673('0x18'));var config=require(_0xa673('0x19'));var licenseUtil=require(_0xa673('0x1a'));var db=require(_0xa673('0x1b'))['db'];function respondWithStatusCode(_0x24c48a,_0x16a444){_0x16a444=_0x16a444||0xcc;return function(_0x3fe9bf){if(_0x3fe9bf){return _0x24c48a[_0xa673('0x1c')](_0x16a444);}return _0x24c48a[_0xa673('0x1d')](_0x16a444)[_0xa673('0x1e')]();};}function respondWithResult(_0x2cfa8f,_0x1cb586){_0x1cb586=_0x1cb586||0xc8;return function(_0x30709b){if(_0x30709b){return _0x2cfa8f[_0xa673('0x1d')](_0x1cb586)[_0xa673('0x1f')](_0x30709b);}};}function respondWithFilteredResult(_0x266e28,_0x1c5457){return function(_0x200b7f){if(_0x200b7f){var _0x97fe13=typeof _0x1c5457[_0xa673('0x20')]===_0xa673('0x21')&&typeof _0x1c5457['limit']===_0xa673('0x21');var _0x1ad4a1=_0x200b7f[_0xa673('0x22')];var _0x184bc3=_0x97fe13?0x0:_0x1c5457[_0xa673('0x20')];var _0x297dbe=_0x97fe13?_0x200b7f[_0xa673('0x22')]:_0x1c5457['offset']+_0x1c5457[_0xa673('0x23')];var _0x40f64d;if(_0x297dbe>=_0x1ad4a1){_0x297dbe=_0x1ad4a1;_0x40f64d=0xc8;}else{_0x40f64d=0xce;}_0x266e28['status'](_0x40f64d);return _0x266e28[_0xa673('0x24')](_0xa673('0x25'),_0x184bc3+'-'+_0x297dbe+'/'+_0x1ad4a1)[_0xa673('0x1f')](_0x200b7f);}return null;};}function patchUpdates(_0x4fe5e3){return function(_0x34d72e){try{jsonpatch[_0xa673('0x26')](_0x34d72e,_0x4fe5e3,!![]);}catch(_0x477297){return BPromise[_0xa673('0x27')](_0x477297);}return _0x34d72e[_0xa673('0x28')]();};}function saveUpdates(_0x3a4cda,_0x23e412){return function(_0xb4c16c){if(_0xb4c16c){return _0xb4c16c[_0xa673('0x29')](_0x3a4cda)[_0xa673('0x2a')](function(_0x472c54){return _0x472c54;});}return null;};}function removeEntity(_0x4b3b06,_0x449016){return function(_0x5c57e3){if(_0x5c57e3){return _0x5c57e3[_0xa673('0x2b')]()[_0xa673('0x2a')](function(){_0x4b3b06[_0xa673('0x1d')](0xcc)[_0xa673('0x1e')]();});}};}function handleEntityNotFound(_0x8bcef0,_0x53e8e9){return function(_0x1fbc8e){if(!_0x1fbc8e){_0x8bcef0[_0xa673('0x1c')](0x194);}return _0x1fbc8e;};}function handleError(_0x4317f0,_0x4edb27){_0x4edb27=_0x4edb27||0x1f4;return function(_0x2b020c){logger['error'](_0x2b020c[_0xa673('0x2c')]);if(_0x2b020c['name']){delete _0x2b020c[_0xa673('0x2d')];}_0x4317f0[_0xa673('0x1d')](_0x4edb27)[_0xa673('0x2e')](_0x2b020c);};}exports[_0xa673('0x2f')]=function(_0x5ee6e9,_0x285790){var _0xd0464c={},_0x252ce8={},_0x234a0a={'count':0x0,'rows':[]};var _0x383f7f=_[_0xa673('0x30')](db['VoiceTransferReport'][_0xa673('0x31')],function(_0x2e7d7f){return{'name':_0x2e7d7f[_0xa673('0x32')],'type':_0x2e7d7f['type'][_0xa673('0x33')]};});_0x252ce8[_0xa673('0x34')]=_[_0xa673('0x30')](_0x383f7f,'name');_0x252ce8[_0xa673('0x35')]=_[_0xa673('0x36')](_0x5ee6e9['query']);_0x252ce8['filters']=_['intersection'](_0x252ce8[_0xa673('0x34')],_0x252ce8[_0xa673('0x35')]);_0xd0464c[_0xa673('0x37')]=_[_0xa673('0x38')](_0x252ce8[_0xa673('0x34')],qs[_0xa673('0x39')](_0x5ee6e9[_0xa673('0x35')][_0xa673('0x39')]));_0xd0464c[_0xa673('0x37')]=_0xd0464c[_0xa673('0x37')][_0xa673('0x3a')]?_0xd0464c[_0xa673('0x37')]:_0x252ce8['model'];if(!_0x5ee6e9[_0xa673('0x35')][_0xa673('0x3b')](_0xa673('0x3c'))){_0xd0464c[_0xa673('0x23')]=qs[_0xa673('0x23')](_0x5ee6e9[_0xa673('0x35')]['limit']);_0xd0464c[_0xa673('0x20')]=qs[_0xa673('0x20')](_0x5ee6e9[_0xa673('0x35')][_0xa673('0x20')]);}_0xd0464c[_0xa673('0x3d')]=qs['sort'](_0x5ee6e9[_0xa673('0x35')][_0xa673('0x3e')]);_0xd0464c[_0xa673('0x3f')]=qs[_0xa673('0x40')](_[_0xa673('0x41')](_0x5ee6e9[_0xa673('0x35')],_0x252ce8[_0xa673('0x40')]),_0x383f7f);if(_0x5ee6e9[_0xa673('0x35')][_0xa673('0x42')]){_0xd0464c[_0xa673('0x3f')]=_['merge'](_0xd0464c[_0xa673('0x3f')],{'$or':_['map'](_0x383f7f,function(_0x43824c){if(_0x43824c[_0xa673('0x43')]!==_0xa673('0x44')){var _0x22b5b7={};_0x22b5b7[_0x43824c[_0xa673('0x2d')]]={'$like':'%'+_0x5ee6e9[_0xa673('0x35')][_0xa673('0x42')]+'%'};return _0x22b5b7;}})});}_0xd0464c=_[_0xa673('0x45')]({},_0xd0464c,_0x5ee6e9[_0xa673('0x46')]);var _0x3bcefc={'where':_0xd0464c[_0xa673('0x3f')]};return db[_0xa673('0x47')][_0xa673('0x22')](_0x3bcefc)[_0xa673('0x2a')](function(_0x20ff6a){_0x234a0a[_0xa673('0x22')]=_0x20ff6a;if(_0x5ee6e9[_0xa673('0x35')]['includeAll']){_0xd0464c[_0xa673('0x48')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xa673('0x49')](_0xd0464c);})[_0xa673('0x2a')](function(_0x10ea91){_0x234a0a[_0xa673('0x4a')]=_0x10ea91;return _0x234a0a;})[_0xa673('0x2a')](respondWithFilteredResult(_0x285790,_0xd0464c))[_0xa673('0x4b')](handleError(_0x285790,null));};exports[_0xa673('0x4c')]=function(_0x5c7ef9,_0xfeba4f){var _0x2d9e40={'raw':!![],'where':{'id':_0x5c7ef9[_0xa673('0x4d')]['id']}},_0xe9d311={};_0xe9d311[_0xa673('0x34')]=_['keys'](db['VoiceTransferReport'][_0xa673('0x31')]);_0xe9d311[_0xa673('0x35')]=_[_0xa673('0x36')](_0x5c7ef9[_0xa673('0x35')]);_0xe9d311['filters']=_[_0xa673('0x38')](_0xe9d311['model'],_0xe9d311[_0xa673('0x35')]);_0x2d9e40[_0xa673('0x37')]=_[_0xa673('0x38')](_0xe9d311[_0xa673('0x34')],qs[_0xa673('0x39')](_0x5c7ef9[_0xa673('0x35')][_0xa673('0x39')]));_0x2d9e40[_0xa673('0x37')]=_0x2d9e40[_0xa673('0x37')][_0xa673('0x3a')]?_0x2d9e40[_0xa673('0x37')]:_0xe9d311[_0xa673('0x34')];if(_0x5c7ef9[_0xa673('0x35')][_0xa673('0x4e')]){_0x2d9e40[_0xa673('0x48')]=[{'all':!![]}];}_0x2d9e40=_['merge']({},_0x2d9e40,_0x5c7ef9[_0xa673('0x46')]);return db[_0xa673('0x47')][_0xa673('0x4f')](_0x2d9e40)['then'](handleEntityNotFound(_0xfeba4f,null))[_0xa673('0x2a')](respondWithResult(_0xfeba4f,null))[_0xa673('0x4b')](handleError(_0xfeba4f,null));};exports['create']=function(_0x458907,_0x11963c){return db[_0xa673('0x47')][_0xa673('0x50')](_0x458907[_0xa673('0x51')],{})[_0xa673('0x2a')](respondWithResult(_0x11963c,0xc9))[_0xa673('0x4b')](handleError(_0x11963c,null));};exports[_0xa673('0x29')]=function(_0x53a107,_0x15469b){if(_0x53a107[_0xa673('0x51')]['id']){delete _0x53a107[_0xa673('0x51')]['id'];}return db['VoiceTransferReport'][_0xa673('0x4f')]({'where':{'id':_0x53a107[_0xa673('0x4d')]['id']}})[_0xa673('0x2a')](handleEntityNotFound(_0x15469b,null))[_0xa673('0x2a')](saveUpdates(_0x53a107[_0xa673('0x51')],null))[_0xa673('0x2a')](respondWithResult(_0x15469b,null))['catch'](handleError(_0x15469b,null));};exports[_0xa673('0x2b')]=function(_0x45be4e,_0x2673b5){return db[_0xa673('0x47')][_0xa673('0x4f')]({'where':{'id':_0x45be4e[_0xa673('0x4d')]['id']}})[_0xa673('0x2a')](handleEntityNotFound(_0x2673b5,null))[_0xa673('0x2a')](removeEntity(_0x2673b5,null))[_0xa673('0x4b')](handleError(_0x2673b5,null));};exports[_0xa673('0x52')]=function(_0x218887,_0x59b97b){return db[_0xa673('0x47')][_0xa673('0x52')]()[_0xa673('0x2a')](respondWithResult(_0x59b97b,null))['catch'](handleError(_0x59b97b,null));}; \ No newline at end of file +var _0xc89e=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x203adb,_0x26d4bc){var _0x52e7d0=function(_0x372ef7){while(--_0x372ef7){_0x203adb['push'](_0x203adb['shift']());}};_0x52e7d0(++_0x26d4bc);}(_0xc89e,0xd1));var _0xec89=function(_0x4b5ae2,_0x298c5b){_0x4b5ae2=_0x4b5ae2-0x0;var _0x310f0c=_0xc89e[_0x4b5ae2];return _0x310f0c;};'use strict';var emlformat=require(_0xec89('0x0'));var rimraf=require(_0xec89('0x1'));var zipdir=require(_0xec89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec89('0x3'));var moment=require('moment');var BPromise=require(_0xec89('0x4'));var Mustache=require(_0xec89('0x5'));var util=require('util');var path=require(_0xec89('0x6'));var sox=require('sox');var csv=require(_0xec89('0x7'));var ejs=require(_0xec89('0x8'));var fs=require('fs');var fs_extra=require(_0xec89('0x9'));var _=require('lodash');var squel=require(_0xec89('0xa'));var crypto=require(_0xec89('0xb'));var jsforce=require(_0xec89('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec89('0x7'));var querystring=require(_0xec89('0xd'));var Papa=require(_0xec89('0xe'));var Redis=require(_0xec89('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xec89('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec89('0x11'));var logger=require(_0xec89('0x12'))('api');var utils=require(_0xec89('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xec89('0x14'))['db'];function respondWithStatusCode(_0x30e844,_0x3d6691){_0x3d6691=_0x3d6691||0xcc;return function(_0x2ddf25){if(_0x2ddf25){return _0x30e844[_0xec89('0x15')](_0x3d6691);}return _0x30e844[_0xec89('0x16')](_0x3d6691)[_0xec89('0x17')]();};}function respondWithResult(_0x50d224,_0x18b236){_0x18b236=_0x18b236||0xc8;return function(_0x9f5680){if(_0x9f5680){return _0x50d224[_0xec89('0x16')](_0x18b236)[_0xec89('0x18')](_0x9f5680);}};}function respondWithFilteredResult(_0x43e4a1,_0x42c713){return function(_0x47c6f7){if(_0x47c6f7){var _0x8312b4=typeof _0x42c713[_0xec89('0x19')]===_0xec89('0x1a')&&typeof _0x42c713['limit']===_0xec89('0x1a');var _0x3b6da8=_0x47c6f7[_0xec89('0x1b')];var _0x5a407b=_0x8312b4?0x0:_0x42c713[_0xec89('0x19')];var _0x1dbd0f=_0x8312b4?_0x47c6f7['count']:_0x42c713[_0xec89('0x19')]+_0x42c713['limit'];var _0x310ca5;if(_0x1dbd0f>=_0x3b6da8){_0x1dbd0f=_0x3b6da8;_0x310ca5=0xc8;}else{_0x310ca5=0xce;}_0x43e4a1[_0xec89('0x16')](_0x310ca5);return _0x43e4a1[_0xec89('0x1c')]('Content-Range',_0x5a407b+'-'+_0x1dbd0f+'/'+_0x3b6da8)[_0xec89('0x18')](_0x47c6f7);}return null;};}function patchUpdates(_0x51c164){return function(_0x496349){try{jsonpatch['apply'](_0x496349,_0x51c164,!![]);}catch(_0x43d4b8){return BPromise[_0xec89('0x1d')](_0x43d4b8);}return _0x496349[_0xec89('0x1e')]();};}function saveUpdates(_0xcf8a32,_0x58b101){return function(_0x3870ac){if(_0x3870ac){return _0x3870ac[_0xec89('0x1f')](_0xcf8a32)[_0xec89('0x20')](function(_0x4e46c4){return _0x4e46c4;});}return null;};}function removeEntity(_0x1133df,_0x2ba803){return function(_0x1d530d){if(_0x1d530d){return _0x1d530d[_0xec89('0x21')]()[_0xec89('0x20')](function(){_0x1133df[_0xec89('0x16')](0xcc)[_0xec89('0x17')]();});}};}function handleEntityNotFound(_0x5e30da,_0x2aed49){return function(_0xa70fa6){if(!_0xa70fa6){_0x5e30da['sendStatus'](0x194);}return _0xa70fa6;};}function handleError(_0x5c6e39,_0x3cec92){_0x3cec92=_0x3cec92||0x1f4;return function(_0x535c65){logger[_0xec89('0x22')](_0x535c65[_0xec89('0x23')]);if(_0x535c65[_0xec89('0x24')]){delete _0x535c65[_0xec89('0x24')];}_0x5c6e39[_0xec89('0x16')](_0x3cec92)['send'](_0x535c65);};}exports[_0xec89('0x25')]=function(_0x4f0bd0,_0x465b1f){var _0x22b09b={},_0x40ae91={},_0x57c68f={'count':0x0,'rows':[]};var _0x3a9938=_[_0xec89('0x26')](db[_0xec89('0x27')][_0xec89('0x28')],function(_0x538fc0){return{'name':_0x538fc0[_0xec89('0x29')],'type':_0x538fc0[_0xec89('0x2a')][_0xec89('0x2b')]};});_0x40ae91[_0xec89('0x2c')]=_[_0xec89('0x26')](_0x3a9938,_0xec89('0x24'));_0x40ae91[_0xec89('0x2d')]=_[_0xec89('0x2e')](_0x4f0bd0['query']);_0x40ae91[_0xec89('0x2f')]=_[_0xec89('0x30')](_0x40ae91[_0xec89('0x2c')],_0x40ae91[_0xec89('0x2d')]);_0x22b09b[_0xec89('0x31')]=_[_0xec89('0x30')](_0x40ae91['model'],qs[_0xec89('0x32')](_0x4f0bd0[_0xec89('0x2d')]['fields']));_0x22b09b[_0xec89('0x31')]=_0x22b09b[_0xec89('0x31')][_0xec89('0x33')]?_0x22b09b['attributes']:_0x40ae91[_0xec89('0x2c')];if(!_0x4f0bd0[_0xec89('0x2d')][_0xec89('0x34')](_0xec89('0x35'))){_0x22b09b[_0xec89('0x36')]=qs['limit'](_0x4f0bd0['query'][_0xec89('0x36')]);_0x22b09b[_0xec89('0x19')]=qs[_0xec89('0x19')](_0x4f0bd0[_0xec89('0x2d')]['offset']);}_0x22b09b[_0xec89('0x37')]=qs['sort'](_0x4f0bd0[_0xec89('0x2d')][_0xec89('0x38')]);_0x22b09b[_0xec89('0x39')]=qs[_0xec89('0x2f')](_[_0xec89('0x3a')](_0x4f0bd0[_0xec89('0x2d')],_0x40ae91[_0xec89('0x2f')]),_0x3a9938);if(_0x4f0bd0[_0xec89('0x2d')][_0xec89('0x3b')]){_0x22b09b[_0xec89('0x39')]=_[_0xec89('0x3c')](_0x22b09b[_0xec89('0x39')],{'$or':_['map'](_0x3a9938,function(_0x2b9c29){if(_0x2b9c29['type']!==_0xec89('0x3d')){var _0x382c6b={};_0x382c6b[_0x2b9c29[_0xec89('0x24')]]={'$like':'%'+_0x4f0bd0['query'][_0xec89('0x3b')]+'%'};return _0x382c6b;}})});}_0x22b09b=_[_0xec89('0x3c')]({},_0x22b09b,_0x4f0bd0[_0xec89('0x3e')]);var _0x4279be={'where':_0x22b09b[_0xec89('0x39')]};return db['VoiceTransferReport'][_0xec89('0x1b')](_0x4279be)[_0xec89('0x20')](function(_0x37cd08){_0x57c68f[_0xec89('0x1b')]=_0x37cd08;if(_0x4f0bd0['query'][_0xec89('0x3f')]){_0x22b09b['include']=[{'all':!![]}];}return db[_0xec89('0x27')]['findAll'](_0x22b09b);})[_0xec89('0x20')](function(_0x29a157){_0x57c68f[_0xec89('0x40')]=_0x29a157;return _0x57c68f;})['then'](respondWithFilteredResult(_0x465b1f,_0x22b09b))['catch'](handleError(_0x465b1f,null));};exports[_0xec89('0x41')]=function(_0x164bd1,_0xbc6892){var _0x54ca6f={'raw':!![],'where':{'id':_0x164bd1[_0xec89('0x42')]['id']}},_0x537b2c={};_0x537b2c[_0xec89('0x2c')]=_[_0xec89('0x2e')](db[_0xec89('0x27')][_0xec89('0x28')]);_0x537b2c['query']=_[_0xec89('0x2e')](_0x164bd1[_0xec89('0x2d')]);_0x537b2c['filters']=_['intersection'](_0x537b2c[_0xec89('0x2c')],_0x537b2c[_0xec89('0x2d')]);_0x54ca6f[_0xec89('0x31')]=_[_0xec89('0x30')](_0x537b2c[_0xec89('0x2c')],qs[_0xec89('0x32')](_0x164bd1[_0xec89('0x2d')]['fields']));_0x54ca6f['attributes']=_0x54ca6f[_0xec89('0x31')][_0xec89('0x33')]?_0x54ca6f[_0xec89('0x31')]:_0x537b2c[_0xec89('0x2c')];if(_0x164bd1[_0xec89('0x2d')][_0xec89('0x3f')]){_0x54ca6f[_0xec89('0x43')]=[{'all':!![]}];}_0x54ca6f=_[_0xec89('0x3c')]({},_0x54ca6f,_0x164bd1[_0xec89('0x3e')]);return db[_0xec89('0x27')][_0xec89('0x44')](_0x54ca6f)[_0xec89('0x20')](handleEntityNotFound(_0xbc6892,null))[_0xec89('0x20')](respondWithResult(_0xbc6892,null))[_0xec89('0x45')](handleError(_0xbc6892,null));};exports[_0xec89('0x46')]=function(_0x549c7b,_0x1502e5){return db['VoiceTransferReport'][_0xec89('0x46')](_0x549c7b[_0xec89('0x47')],{})['then'](respondWithResult(_0x1502e5,0xc9))[_0xec89('0x45')](handleError(_0x1502e5,null));};exports[_0xec89('0x1f')]=function(_0x580c7c,_0x56808f){if(_0x580c7c[_0xec89('0x47')]['id']){delete _0x580c7c[_0xec89('0x47')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x580c7c[_0xec89('0x42')]['id']}})[_0xec89('0x20')](handleEntityNotFound(_0x56808f,null))[_0xec89('0x20')](saveUpdates(_0x580c7c[_0xec89('0x47')],null))[_0xec89('0x20')](respondWithResult(_0x56808f,null))[_0xec89('0x45')](handleError(_0x56808f,null));};exports[_0xec89('0x21')]=function(_0x1aa236,_0x1f45f1){return db['VoiceTransferReport'][_0xec89('0x44')]({'where':{'id':_0x1aa236['params']['id']}})[_0xec89('0x20')](handleEntityNotFound(_0x1f45f1,null))[_0xec89('0x20')](removeEntity(_0x1f45f1,null))['catch'](handleError(_0x1f45f1,null));};exports[_0xec89('0x48')]=function(_0x238f50,_0x3c9ade){return db[_0xec89('0x27')][_0xec89('0x48')]()[_0xec89('0x20')](respondWithResult(_0x3c9ade,null))[_0xec89('0x45')](handleError(_0x3c9ade,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 158e801..c3e43c4 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 _0x644a=['rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','path'];(function(_0x128f3a,_0x4d9402){var _0xe7c692=function(_0x8f8048){while(--_0x8f8048){_0x128f3a['push'](_0x128f3a['shift']());}};_0xe7c692(++_0x4d9402);}(_0x644a,0x123));var _0xa644=function(_0x3fafb9,_0x5d6612){_0x3fafb9=_0x3fafb9-0x0;var _0xada4d4=_0x644a[_0x3fafb9];return _0xada4d4;};'use strict';var _=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var logger=require('../../config/logger')(_0xa644('0x2'));var moment=require(_0xa644('0x3'));var BPromise=require(_0xa644('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa644('0x5'));var rimraf=require(_0xa644('0x6'));var config=require('../../config/environment');var attributes=require(_0xa644('0x7'));module[_0xa644('0x8')]=function(_0x106d4d,_0x3f3cba){return _0x106d4d['define'](_0xa644('0x9'),attributes,{'tableName':_0xa644('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc14a=['request-promise','path','rimraf','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1c7621,_0x5296a4){var _0x5c59cc=function(_0x1e28f1){while(--_0x1e28f1){_0x1c7621['push'](_0x1c7621['shift']());}};_0x5c59cc(++_0x5296a4);}(_0xc14a,0x13f));var _0xac14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc14a[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xac14('0x0'));var util=require('util');var logger=require(_0xac14('0x1'))(_0xac14('0x2'));var moment=require(_0xac14('0x3'));var BPromise=require(_0xac14('0x4'));var rp=require(_0xac14('0x5'));var fs=require('fs');var path=require(_0xac14('0x6'));var rimraf=require(_0xac14('0x7'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0xac14('0x8')]=function(_0x50b816,_0x3c503c){return _0x50b816[_0xac14('0x9')](_0xac14('0xa'),attributes,{'tableName':_0xac14('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index e79ac9b..4de8f61 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 _0x5021=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateVoiceTransferReport','create','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3fc45a,_0x32e470){var _0x3096e0=function(_0x2d6a53){while(--_0x2d6a53){_0x3fc45a['push'](_0x3fc45a['shift']());}};_0x3096e0(++_0x32e470);}(_0x5021,0x135));var _0x1502=function(_0x4d0ae5,_0x2546ec){_0x4d0ae5=_0x4d0ae5-0x0;var _0xc26f12=_0x5021[_0x4d0ae5];return _0xc26f12;};'use strict';var _=require(_0x1502('0x0'));var util=require(_0x1502('0x1'));var moment=require('moment');var BPromise=require(_0x1502('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1502('0x3'));var db=require(_0x1502('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1502('0x5'))(_0x1502('0x6'));var config=require(_0x1502('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1502('0x8')][_0x1502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93ceb4,_0x211da6,_0x4c555f){return new BPromise(function(_0x536c4a,_0x395745){return client[_0x1502('0xa')](_0x93ceb4,_0x4c555f)[_0x1502('0xb')](function(_0x417cb9){logger[_0x1502('0xc')](_0x1502('0xd'),_0x211da6,_0x1502('0xe'));logger[_0x1502('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x211da6,_0x1502('0xe'),JSON[_0x1502('0x10')](_0x417cb9));if(_0x417cb9['error']){if(_0x417cb9[_0x1502('0x11')][_0x1502('0x12')]===0x1f4){logger[_0x1502('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x211da6,_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);return _0x395745(_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);}logger[_0x1502('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x211da6,_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);return _0x536c4a(_0x417cb9[_0x1502('0x11')][_0x1502('0x13')]);}else{logger['info'](_0x1502('0xd'),_0x211da6,_0x1502('0xe'));_0x536c4a(_0x417cb9['result']['message']);}})['catch'](function(_0x438e62){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x211da6,_0x438e62);_0x395745(_0x438e62);});});}exports[_0x1502('0x14')]=function(_0x552a2c){var _0x10aa31=this;return new Promise(function(_0x6ccdf7,_0x59b0a0){return db['VoiceTransferReport'][_0x1502('0x15')](_0x552a2c['body'],{'raw':_0x552a2c[_0x1502('0x16')]?_0x552a2c[_0x1502('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x8c35fa){logger[_0x1502('0xc')](_0x1502('0x14'),_0x552a2c);logger[_0x1502('0xf')](_0x1502('0x14'),_0x552a2c,JSON[_0x1502('0x10')](_0x8c35fa));_0x6ccdf7(_0x8c35fa);})['catch'](function(_0x30efa4){logger[_0x1502('0x11')]('CreateVoiceTransferReport',_0x30efa4[_0x1502('0x13')],_0x552a2c);_0x59b0a0(_0x10aa31[_0x1502('0x11')](0x1f4,_0x30efa4['message']));});});}; \ No newline at end of file +var _0x89a0=['code','message','info','result','catch','CreateVoiceTransferReport','create','body','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x89a0,0x168));var _0x089a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x089a('0x0'));var util=require(_0x089a('0x1'));var moment=require('moment');var BPromise=require(_0x089a('0x2'));var rs=require(_0x089a('0x3'));var fs=require('fs');var Redis=require(_0x089a('0x4'));var db=require(_0x089a('0x5'))['db'];var utils=require(_0x089a('0x6'));var logger=require('../../config/logger')(_0x089a('0x7'));var config=require('../../config/environment');var jayson=require(_0x089a('0x8'));var client=jayson[_0x089a('0x9')][_0x089a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x114aac,_0x42ffdd,_0x305817){return new BPromise(function(_0x443710,_0x29ed67){return client[_0x089a('0xb')](_0x114aac,_0x305817)[_0x089a('0xc')](function(_0x45818f){logger['info'](_0x089a('0xd'),_0x42ffdd,_0x089a('0xe'));logger[_0x089a('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x42ffdd,'request\x20sent',JSON[_0x089a('0x10')](_0x45818f));if(_0x45818f['error']){if(_0x45818f[_0x089a('0x11')][_0x089a('0x12')]===0x1f4){logger[_0x089a('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x42ffdd,_0x45818f[_0x089a('0x11')]['message']);return _0x29ed67(_0x45818f['error'][_0x089a('0x13')]);}logger[_0x089a('0x11')](_0x089a('0xd'),_0x42ffdd,_0x45818f[_0x089a('0x11')][_0x089a('0x13')]);return _0x443710(_0x45818f[_0x089a('0x11')][_0x089a('0x13')]);}else{logger[_0x089a('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x42ffdd,_0x089a('0xe'));_0x443710(_0x45818f[_0x089a('0x15')][_0x089a('0x13')]);}})[_0x089a('0x16')](function(_0x2e9bd8){logger[_0x089a('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x42ffdd,_0x2e9bd8);_0x29ed67(_0x2e9bd8);});});}exports[_0x089a('0x17')]=function(_0x2f6209){var _0x59ae46=this;return new Promise(function(_0x3b9827,_0x59e57d){return db['VoiceTransferReport'][_0x089a('0x18')](_0x2f6209[_0x089a('0x19')],{'raw':_0x2f6209['options']?_0x2f6209['options'][_0x089a('0x1a')]===undefined?!![]:![]:!![]})[_0x089a('0xc')](function(_0xe78625){logger['info'](_0x089a('0x17'),_0x2f6209);logger['debug'](_0x089a('0x17'),_0x2f6209,JSON[_0x089a('0x10')](_0xe78625));_0x3b9827(_0xe78625);})[_0x089a('0x16')](function(_0x2d97e4){logger[_0x089a('0x11')]('CreateVoiceTransferReport',_0x2d97e4[_0x089a('0x13')],_0x2f6209);_0x59e57d(_0x59ae46[_0x089a('0x11')](0x1f4,_0x2d97e4[_0x089a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ee8dea5..da70ff7 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 _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x486398,_0x370d53){var _0x2d4bc5=function(_0x4013f9){while(--_0x4013f9){_0x486398['push'](_0x486398['shift']());}};_0x2d4bc5(++_0x370d53);}(_0xe14d,0x1ee));var _0xde14=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe14d[_0x3826ad];return _0x17b900;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file +var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xf3cd[_0x175e89];return _0x2ed996;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 8b096f5..3108a97 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 _0xe600=['redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','message','result','User','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','format','user:%s','catch','hangup\x20fired:','userId','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','all','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis'];(function(_0x3b375e,_0x565734){var _0x55419f=function(_0x56dd1e){while(--_0x56dd1e){_0x3b375e['push'](_0x3b375e['shift']());}};_0x55419f(++_0x565734);}(_0xe600,0x159));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0e60('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0e60('0x1'));var util=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var jayson=require(_0x0e60('0x4'));var amiClient=jayson[_0x0e60('0x5')][_0x0e60('0x6')]({'port':0x232a});var logger=require(_0x0e60('0x7'))(_0x0e60('0x8'));var Redis=require(_0x0e60('0x9'));config[_0x0e60('0xa')]=_['defaults'](config[_0x0e60('0xa')],{'host':_0x0e60('0xb'),'port':0x18eb});var io=require(_0x0e60('0xc'))(new Redis(config[_0x0e60('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'callNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x10')]},'callerId':{'type':_0x0e60('0xf')},'callbackUrl':{'type':_0x0e60('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]}});function emit(_0x5ab4ba,_0x2a8b5a,_0x3f2d13){logger[_0x0e60('0x12')](_0x5ab4ba,_0x2a8b5a,JSON[_0x0e60('0x13')](_0x3f2d13));io['to'](_0x5ab4ba)[_0x0e60('0x14')](_0x2a8b5a,_0x3f2d13);}function handleError(_0x4ed292){return function(_0x992490){console[_0x0e60('0x15')]('handleError:',_0x992490,_0x992490 instanceof RangeError);logger[_0x0e60('0x16')](_0x992490[_0x0e60('0x17')]);if(_0x992490 instanceof RangeError){if(_0x992490[_0x0e60('0x18')]){delete _0x992490['name'];}_0x4ed292[_0x0e60('0x19')](0x194)['send'](_0x992490);}else{if(_0x992490[_0x0e60('0x18')]){delete _0x992490[_0x0e60('0x18')];}_0x4ed292[_0x0e60('0x19')](0x1f4)[_0x0e60('0x1a')](_0x992490);}};}function checkError(){return function(_0x329620){if(!_0x329620){throw new RangeError(_0x0e60('0x1b'));}return _0x329620;};}function respondWithRpcPromise(_0x38f677,_0x2ed72f){return new BPromise(function(_0x352633,_0x10f875){var _0x22c0e0=amiClient;return _0x22c0e0[_0x0e60('0x1c')](_0x38f677,_0x2ed72f)[_0x0e60('0x1d')](function(_0x16985f){if(_0x16985f[_0x0e60('0x16')]){if(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1e')]===0x1f4){return _0x10f875(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1f')]);}return _0x352633(_0x16985f['error'][_0x0e60('0x1f')]);}else{_0x352633(_0x16985f[_0x0e60('0x20')]);}})['catch'](function(_0x10451f){_0x10f875(_0x10451f);});});}function getAgent(_0x5ddd18){return db[_0x0e60('0x21')]['findOne']({'where':{'id':_0x5ddd18,'role':'agent'}})[_0x0e60('0x1d')](checkError());}function getAgentCheckSession(_0x39dae2,_0x526aaa){return new BPromise(function(_0x4eb9b8,_0x3ca649){var _0x54d7ce=respondWithRpcPromise(_0x0e60('0x22'));var _0x548919=getAgent(_0x39dae2);Promise['all']([_0x54d7ce,_0x548919])[_0x0e60('0x1d')](function(_0x3d3c13){var _0x2a282d=_0x3d3c13[0x0];var _0x4d9b18=_0x3d3c13[0x1];var _0x473813=_['filter'](_0x2a282d[_0x0e60('0x23')],function(_0x1d54c0){return _0x1d54c0[_0x0e60('0x24')]==_0x4d9b18['id']&&_0x1d54c0['sessionId']==_0x526aaa;});if(_0x473813[_0x0e60('0x25')]==0x1){_0x4eb9b8(_0x4d9b18);}else{_0x3ca649(new RangeError(_0x0e60('0x26')+_0x526aaa+_0x0e60('0x27')));}});});}exports['originate']=function(_0x17e210,_0x3ea4ac){logger[_0x0e60('0x12')](_0x0e60('0x28'),_0x17e210[_0x0e60('0x29')]);var _0x588e9d=originateValidation[_0x0e60('0x2a')](_0x17e210['body']);if(_0x588e9d[_0x0e60('0x25')]>0x0){return _0x3ea4ac['status'](0x190)[_0x0e60('0x2b')](_0x588e9d);}var _0x2388a7=_0x17e210[_0x0e60('0x29')]['userId'];var _0xf29971=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2c')];var _0x81a892=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2d')];var _0x9302fe=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2e')];return getAgent(_0x2388a7)[_0x0e60('0x1d')](function(_0x2533a9){logger[_0x0e60('0x12')]('entityFound:',_0x2533a9[_0x0e60('0x18')]);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x2533a9[_0x0e60('0x18')]),'webbar:originate',{'callNumber':_0xf29971,'callerId':_0x81a892,'callbackUrl':_0x9302fe});return _0x3ea4ac['status'](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0x0e60('0x31')](handleError(_0x3ea4ac));};exports['hangup']=function(_0x4582b8,_0x44db32){logger[_0x0e60('0x12')](_0x0e60('0x32'),_0x4582b8[_0x0e60('0x29')]);var _0x25761d=hangupValidation[_0x0e60('0x2a')](_0x4582b8[_0x0e60('0x29')]);if(_0x25761d[_0x0e60('0x25')]>0x0){return _0x44db32[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x25761d);}var _0x3becf9=_0x4582b8['body'][_0x0e60('0x33')];var _0x56ce38=_0x4582b8[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x3becf9)['then'](function(_0x482583){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x482583['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x482583['name']),_0x0e60('0x36'),{'sessionId':_0x56ce38});return _0x44db32[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x37')});})[_0x0e60('0x31')](handleError(_0x44db32));};exports[_0x0e60('0x38')]=function(_0x8244f,_0x233743){logger[_0x0e60('0x12')]('answer\x20fired:',_0x8244f['body']);var _0x535c06=answerValidation[_0x0e60('0x2a')](_0x8244f['body']);if(_0x535c06[_0x0e60('0x25')]>0x0){return _0x233743[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x535c06);}var _0x4bfebf=_0x8244f[_0x0e60('0x29')][_0x0e60('0x33')];var _0x4ce029=_0x8244f['body'][_0x0e60('0x34')];return getAgent(_0x4bfebf)[_0x0e60('0x1d')](function(_0xd4f785){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0xd4f785[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0xd4f785[_0x0e60('0x18')]),_0x0e60('0x39'),{'sessionId':_0x4ce029});return _0x233743[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x233743));};exports['hold']=function(_0x36f90e,_0x449f38){logger[_0x0e60('0x12')](_0x0e60('0x3a'),_0x36f90e['body']);var _0x5b9cf6=holdValidation['validate'](_0x36f90e[_0x0e60('0x29')]);if(_0x5b9cf6[_0x0e60('0x25')]>0x0){return _0x449f38[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x5b9cf6);}var _0x8777f4=_0x36f90e['body']['userId'];var _0x3c3ab7=_0x36f90e[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x8777f4)[_0x0e60('0x1d')](function(_0x4ad156){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x4ad156[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x4ad156[_0x0e60('0x18')]),'webbar:hold',{'sessionId':_0x3c3ab7});return _0x449f38[_0x0e60('0x19')](0xc8)['json']({'error':![],'message':_0x0e60('0x3b')});})[_0x0e60('0x31')](handleError(_0x449f38));};exports[_0x0e60('0x3c')]=function(_0x2e887c,_0x477a99){logger['info'](_0x0e60('0x3d'),_0x2e887c[_0x0e60('0x29')]);var _0x103c30=unholdValidation[_0x0e60('0x2a')](_0x2e887c['body']);if(_0x103c30[_0x0e60('0x25')]>0x0){return _0x477a99[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x103c30);}var _0x2d7403=_0x2e887c['body'][_0x0e60('0x33')];var _0x4c6f07=_0x2e887c[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x2d7403)[_0x0e60('0x1d')](function(_0x9e4340){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x9e4340[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x9e4340['name']),_0x0e60('0x3e'),{'sessionId':_0x4c6f07});return _0x477a99[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x3f')});})['catch'](handleError(_0x477a99));};exports['calls']=function(_0x3282b8,_0x5a6c01){logger[_0x0e60('0x12')](_0x0e60('0x40'),_0x5a6c01[_0x0e60('0x29')]);var _0x24ada9=callsValidation[_0x0e60('0x2a')](_0x3282b8[_0x0e60('0x29')]);if(_0x24ada9[_0x0e60('0x25')]>0x0){return _0x5a6c01[_0x0e60('0x19')](0x190)['json'](_0x24ada9);}var _0x33b560=_0x3282b8[_0x0e60('0x29')][_0x0e60('0x33')];var _0x1249b2=respondWithRpcPromise(_0x0e60('0x22'));var _0x52ac12=getAgent(_0x33b560);return Promise[_0x0e60('0x41')]([_0x1249b2,_0x52ac12])[_0x0e60('0x1d')](function(_0x3ee5e2){var _0x221608=_0x3ee5e2[0x0];var _0x565eab=_0x3ee5e2[0x1];var _0x88b035=_['filter'](_0x221608[_0x0e60('0x23')],function(_0x37c13c){return _0x37c13c[_0x0e60('0x24')]==_0x565eab['id'];});return _0x5a6c01[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'count':_0x88b035['length'],'rows':_0x88b035});})[_0x0e60('0x31')](handleError(_0x5a6c01));};exports[_0x0e60('0x42')]=function(_0x55d4e7,_0x472ebe){logger['info'](_0x0e60('0x43'),_0x55d4e7[_0x0e60('0x29')]);var _0x5e50ad=conferenceValidation['validate'](_0x55d4e7[_0x0e60('0x29')]);if(_0x5e50ad[_0x0e60('0x25')]>0x0){return _0x472ebe['status'](0x190)['json'](_0x5e50ad);}var _0x33bc63=_0x55d4e7[_0x0e60('0x29')][_0x0e60('0x33')];return getAgent(_0x33bc63)[_0x0e60('0x1d')](function(_0x58fa48){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x58fa48[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x58fa48[_0x0e60('0x18')]),'webbar:conference');return _0x472ebe[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0x0e60('0x31')](handleError(_0x472ebe));};exports[_0x0e60('0x44')]=function(_0x5f383e,_0x5cc420){logger[_0x0e60('0x12')](_0x0e60('0x45'),_0x5f383e[_0x0e60('0x29')]);var _0x234cc5=transferValidation[_0x0e60('0x2a')](_0x5f383e[_0x0e60('0x29')]);if(_0x234cc5[_0x0e60('0x25')]>0x0){return _0x5cc420[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x234cc5);}var _0x2d0c5d=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x33')];var _0x2546f8=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x34')];var _0x200d81=_0x5f383e[_0x0e60('0x29')]['transferNumber'];return getAgent(_0x2d0c5d)['then'](function(_0x1a8efe){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x1a8efe['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x1a8efe['name']),_0x0e60('0x46'),{'sessionId':_0x2546f8,'transferNumber':_0x200d81});return _0x5cc420[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x5cc420));}; \ No newline at end of file +var _0x0f9f=['hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','name','status','send','NotFound','then','code','message','result','catch','User','agent','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','validate','webbar:answer','answer\x20executed!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xb52a30,_0x9b4336){_0xb52a30=_0xb52a30-0x0;var _0x160875=_0x0f9f[_0xb52a30];return _0x160875;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var config=require(_0xf0f9('0x2'));var util=require('util');var BPromise=require(_0xf0f9('0x3'));var jayson=require(_0xf0f9('0x4'));var amiClient=jayson[_0xf0f9('0x5')][_0xf0f9('0x6')]({'port':0x232a});var logger=require(_0xf0f9('0x7'))(_0xf0f9('0x8'));var Redis=require(_0xf0f9('0x9'));config[_0xf0f9('0xa')]=_[_0xf0f9('0xb')](config[_0xf0f9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf0f9('0xc'))(new Redis(config[_0xf0f9('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'callNumber':{'type':_0xf0f9('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xf0f9('0xf')},'callbackUrl':{'type':_0xf0f9('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':[!![],_0xf0f9('0x10')]},'transferNumber':{'type':'string','required':[!![],_0xf0f9('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});function emit(_0x2f5bec,_0x2f75da,_0x16a928){logger[_0xf0f9('0x12')](_0x2f5bec,_0x2f75da,JSON[_0xf0f9('0x13')](_0x16a928));io['to'](_0x2f5bec)['emit'](_0x2f75da,_0x16a928);}function handleError(_0x526fff){return function(_0x350a48){console[_0xf0f9('0x14')]('handleError:',_0x350a48,_0x350a48 instanceof RangeError);logger[_0xf0f9('0x15')](_0x350a48['stack']);if(_0x350a48 instanceof RangeError){if(_0x350a48['name']){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff[_0xf0f9('0x17')](0x194)[_0xf0f9('0x18')](_0x350a48);}else{if(_0x350a48[_0xf0f9('0x16')]){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff['status'](0x1f4)['send'](_0x350a48);}};}function checkError(){return function(_0x5294ac){if(!_0x5294ac){throw new RangeError(_0xf0f9('0x19'));}return _0x5294ac;};}function respondWithRpcPromise(_0x1c8c39,_0x126ba7){return new BPromise(function(_0x5d87a9,_0x4a8726){var _0x209cd4=amiClient;return _0x209cd4['request'](_0x1c8c39,_0x126ba7)[_0xf0f9('0x1a')](function(_0x414f87){if(_0x414f87[_0xf0f9('0x15')]){if(_0x414f87['error'][_0xf0f9('0x1b')]===0x1f4){return _0x4a8726(_0x414f87[_0xf0f9('0x15')][_0xf0f9('0x1c')]);}return _0x5d87a9(_0x414f87['error'][_0xf0f9('0x1c')]);}else{_0x5d87a9(_0x414f87[_0xf0f9('0x1d')]);}})[_0xf0f9('0x1e')](function(_0x185e1e){_0x4a8726(_0x185e1e);});});}function getAgent(_0x16f639){return db[_0xf0f9('0x1f')]['findOne']({'where':{'id':_0x16f639,'role':_0xf0f9('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x1288e0,_0x30e85c){return new BPromise(function(_0x519a46,_0x4b75b2){var _0x119793=respondWithRpcPromise('VoiceChannels');var _0x2121b8=getAgent(_0x1288e0);Promise[_0xf0f9('0x21')]([_0x119793,_0x2121b8])[_0xf0f9('0x1a')](function(_0x353502){var _0x3ec658=_0x353502[0x0];var _0x39cd34=_0x353502[0x1];var _0x1377ed=_[_0xf0f9('0x22')](_0x3ec658[_0xf0f9('0x23')],function(_0x4e4e08){return _0x4e4e08[_0xf0f9('0x24')]==_0x39cd34['id']&&_0x4e4e08[_0xf0f9('0x25')]==_0x30e85c;});if(_0x1377ed['length']==0x1){_0x519a46(_0x39cd34);}else{_0x4b75b2(new RangeError('sessionId\x20'+_0x30e85c+_0xf0f9('0x26')));}});});}exports['originate']=function(_0x483a8c,_0x14f3cb){logger['info'](_0xf0f9('0x27'),_0x483a8c[_0xf0f9('0x28')]);var _0x5305e0=originateValidation['validate'](_0x483a8c[_0xf0f9('0x28')]);if(_0x5305e0[_0xf0f9('0x29')]>0x0){return _0x14f3cb[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x5305e0);}var _0x278192=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x30bc8e=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2c')];var _0x2a7648=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2d')];var _0x5a8b35=_0x483a8c[_0xf0f9('0x28')]['callbackUrl'];return getAgent(_0x278192)[_0xf0f9('0x1a')](function(_0x44c9ed){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x44c9ed[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x44c9ed['name']),'webbar:originate',{'callNumber':_0x30bc8e,'callerId':_0x2a7648,'callbackUrl':_0x5a8b35});return _0x14f3cb[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x31')});})[_0xf0f9('0x1e')](handleError(_0x14f3cb));};exports[_0xf0f9('0x32')]=function(_0x4ac1d2,_0x2b9d56){logger[_0xf0f9('0x12')](_0xf0f9('0x33'),_0x4ac1d2[_0xf0f9('0x28')]);var _0x32a248=hangupValidation['validate'](_0x4ac1d2[_0xf0f9('0x28')]);if(_0x32a248[_0xf0f9('0x29')]>0x0){return _0x2b9d56[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x32a248);}var _0x7cf75a=_0x4ac1d2[_0xf0f9('0x28')]['userId'];var _0x3a0f27=_0x4ac1d2[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x7cf75a)['then'](function(_0x3b52e3){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x3b52e3[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x3b52e3[_0xf0f9('0x16')]),_0xf0f9('0x34'),{'sessionId':_0x3a0f27});return _0x2b9d56[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x35')});})[_0xf0f9('0x1e')](handleError(_0x2b9d56));};exports[_0xf0f9('0x36')]=function(_0x5153b5,_0x4ff1f0){logger[_0xf0f9('0x12')]('answer\x20fired:',_0x5153b5['body']);var _0x4e8234=answerValidation[_0xf0f9('0x37')](_0x5153b5[_0xf0f9('0x28')]);if(_0x4e8234[_0xf0f9('0x29')]>0x0){return _0x4ff1f0[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x4e8234);}var _0xfef8ad=_0x5153b5[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x1a3a6b=_0x5153b5['body'][_0xf0f9('0x25')];return getAgent(_0xfef8ad)[_0xf0f9('0x1a')](function(_0x434fc1){logger['info'](_0xf0f9('0x2e'),_0x434fc1[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')]('user:%s',_0x434fc1[_0xf0f9('0x16')]),_0xf0f9('0x38'),{'sessionId':_0x1a3a6b});return _0x4ff1f0['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x39')});})[_0xf0f9('0x1e')](handleError(_0x4ff1f0));};exports[_0xf0f9('0x3a')]=function(_0x4be16e,_0x35bcf8){logger[_0xf0f9('0x12')](_0xf0f9('0x3b'),_0x4be16e[_0xf0f9('0x28')]);var _0x226bda=holdValidation[_0xf0f9('0x37')](_0x4be16e['body']);if(_0x226bda[_0xf0f9('0x29')]>0x0){return _0x35bcf8['status'](0x190)[_0xf0f9('0x2a')](_0x226bda);}var _0x38956b=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x44b00d=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x38956b)[_0xf0f9('0x1a')](function(_0x1f47fa){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x1f47fa[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x1f47fa[_0xf0f9('0x16')]),_0xf0f9('0x3c'),{'sessionId':_0x44b00d});return _0x35bcf8[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x3d')});})[_0xf0f9('0x1e')](handleError(_0x35bcf8));};exports[_0xf0f9('0x3e')]=function(_0x40711c,_0x3db0b2){logger[_0xf0f9('0x12')]('unhold\x20fired:',_0x40711c['body']);var _0x2eb8b4=unholdValidation['validate'](_0x40711c[_0xf0f9('0x28')]);if(_0x2eb8b4[_0xf0f9('0x29')]>0x0){return _0x3db0b2[_0xf0f9('0x17')](0x190)['json'](_0x2eb8b4);}var _0x2b2604=_0x40711c['body'][_0xf0f9('0x2b')];var _0x603804=_0x40711c[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x2b2604)[_0xf0f9('0x1a')](function(_0x593b54){logger[_0xf0f9('0x12')]('entityFound:',_0x593b54[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x593b54[_0xf0f9('0x16')]),_0xf0f9('0x3f'),{'sessionId':_0x603804});return _0x3db0b2['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x40')});})[_0xf0f9('0x1e')](handleError(_0x3db0b2));};exports[_0xf0f9('0x41')]=function(_0x1dbc9d,_0x2a8aae){logger[_0xf0f9('0x12')](_0xf0f9('0x42'),_0x2a8aae[_0xf0f9('0x28')]);var _0x406b45=callsValidation[_0xf0f9('0x37')](_0x1dbc9d[_0xf0f9('0x28')]);if(_0x406b45[_0xf0f9('0x29')]>0x0){return _0x2a8aae[_0xf0f9('0x17')](0x190)['json'](_0x406b45);}var _0x329b59=_0x1dbc9d[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x59d7bd=respondWithRpcPromise(_0xf0f9('0x43'));var _0x32f641=getAgent(_0x329b59);return Promise[_0xf0f9('0x21')]([_0x59d7bd,_0x32f641])[_0xf0f9('0x1a')](function(_0x6979f){var _0x586022=_0x6979f[0x0];var _0x3b1d45=_0x6979f[0x1];var _0x838550=_[_0xf0f9('0x22')](_0x586022[_0xf0f9('0x23')],function(_0x2807f9){return _0x2807f9[_0xf0f9('0x24')]==_0x3b1d45['id'];});return _0x2a8aae[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'count':_0x838550[_0xf0f9('0x29')],'rows':_0x838550});})[_0xf0f9('0x1e')](handleError(_0x2a8aae));};exports['conference']=function(_0x3777ae,_0x3fa078){logger['info'](_0xf0f9('0x44'),_0x3777ae['body']);var _0x3ac206=conferenceValidation[_0xf0f9('0x37')](_0x3777ae[_0xf0f9('0x28')]);if(_0x3ac206['length']>0x0){return _0x3fa078[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x3ac206);}var _0x28879c=_0x3777ae[_0xf0f9('0x28')][_0xf0f9('0x2b')];return getAgent(_0x28879c)[_0xf0f9('0x1a')](function(_0xdb0e6c){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0xdb0e6c[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0xdb0e6c['name']),_0xf0f9('0x45'));return _0x3fa078[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x46')});})['catch'](handleError(_0x3fa078));};exports[_0xf0f9('0x47')]=function(_0xb29b92,_0xb47567){logger['info'](_0xf0f9('0x48'),_0xb29b92[_0xf0f9('0x28')]);var _0x56e467=transferValidation[_0xf0f9('0x37')](_0xb29b92[_0xf0f9('0x28')]);if(_0x56e467['length']>0x0){return _0xb47567[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x56e467);}var _0x3d1542=_0xb29b92[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x16564d=_0xb29b92[_0xf0f9('0x28')]['sessionId'];var _0x392ffa=_0xb29b92[_0xf0f9('0x28')]['transferNumber'];return getAgent(_0x3d1542)[_0xf0f9('0x1a')](function(_0x539ac6){logger['info'](_0xf0f9('0x2e'),_0x539ac6[_0xf0f9('0x16')]);emit(util['format'](_0xf0f9('0x30'),_0x539ac6['name']),_0xf0f9('0x49'),{'sessionId':_0x16564d,'transferNumber':_0x392ffa});return _0xb47567[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0xf0f9('0x1e')](handleError(_0xb47567));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9b80adb..6fb6d8e 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 _0xd7d1=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/users','getAgents','getApplications','create','post','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','/:id/send','send','put','update'];(function(_0x2a70b2,_0x22ddcc){var _0x72e18d=function(_0x4929ba){while(--_0x4929ba){_0x2a70b2['push'](_0x2a70b2['shift']());}};_0x72e18d(++_0x22ddcc);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x496a1d,_0x294ee6){_0x496a1d=_0x496a1d-0x0;var _0x485f92=_0xd7d1[_0x496a1d];return _0x485f92;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xb')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xb')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['getDispositions']);router[_0x1d7d('0xb')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0xb')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x14')]);router['get']('/:id/applications',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d7d('0x16')]);router[_0x1d7d('0x17')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x18')]);router['post'](_0x1d7d('0x19'),auth[_0x1d7d('0xc')](),controller['addAnswer']);router[_0x1d7d('0x17')](_0x1d7d('0x13'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1a')]);router[_0x1d7d('0x17')]('/:id/applications',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1b')]);router['post']('/:id/notify',controller[_0x1d7d('0x1c')]);router[_0x1d7d('0x17')](_0x1d7d('0x1d'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1e')]);router[_0x1d7d('0x1f')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x20')]);router[_0x1d7d('0x21')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x22')]);router['delete']('/:id/dispositions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x23')]);router[_0x1d7d('0x21')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x24')]);router[_0x1d7d('0x21')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x25')]);module[_0x1d7d('0x26')]=router; \ No newline at end of file +var _0x57ca=['addDisposition','addAnswer','addApplications','/:id/notify','notify','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','/:id/dispositions'];(function(_0x495650,_0x144774){var _0x287025=function(_0x329116){while(--_0x329116){_0x495650['push'](_0x495650['shift']());}};_0x287025(++_0x144774);}(_0x57ca,0x108));var _0xa57c=function(_0x4ed4fe,_0x412bf0){_0x4ed4fe=_0x4ed4fe-0x0;var _0x24f50a=_0x57ca[_0x4ed4fe];return _0x24f50a;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0x8')]('/:id/dispositions',auth[_0xa57c('0x9')](),controller['getDispositions']);router[_0xa57c('0x8')](_0xa57c('0xf'),auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['get'](_0xa57c('0x11'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);router[_0xa57c('0x8')](_0xa57c('0x13'),auth['isAuthenticated'](),controller[_0xa57c('0x14')]);router['post']('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0x15')]);router[_0xa57c('0x16')](_0xa57c('0x17'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x18')]);router[_0xa57c('0x16')]('/:id/canned_answers',auth[_0xa57c('0x9')](),controller[_0xa57c('0x19')]);router[_0xa57c('0x16')]('/:id/users',auth[_0xa57c('0x9')](),controller['addAgents']);router[_0xa57c('0x16')](_0xa57c('0x13'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x1a')]);router[_0xa57c('0x16')](_0xa57c('0x1b'),controller[_0xa57c('0x1c')]);router[_0xa57c('0x16')]('/:id/send',auth[_0xa57c('0x9')](),controller['send']);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x1d')]);router[_0xa57c('0x1e')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x1f')]);router[_0xa57c('0x1e')](_0xa57c('0x17'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x20')]);router[_0xa57c('0x1e')](_0xa57c('0xf'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x21')]);router[_0xa57c('0x1e')](_0xa57c('0x11'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x22')]);module[_0xa57c('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1b8a75d..a2f6921 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 _0x24eb=['setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x24eb,0x13d));var _0xb24e=function(_0x5b3a35,_0x312e9b){_0x5b3a35=_0x5b3a35-0x0;var _0x4383df=_0x24eb[_0x5b3a35];return _0x4383df;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb24e('0x0'));module[_0xb24e('0x1')]={'name':{'type':Sequelize[_0xb24e('0x2')],'unique':_0xb24e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb24e('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb24e('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb24e('0x4')](_0xb24e('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0xb24e('0x2')]},'baseUrl':{'type':Sequelize[_0xb24e('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb24e('0x6')],'defaultValue':function(){return _0xb24e('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb24e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb24e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb24e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb24e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb24e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb24e('0x9')],'comment':_0xb24e('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb24e('0xb'),'set':function(_0x3b7e50){if(!_0x3b7e50){this['setDataValue'](_0xb24e('0xc'),null);}this[_0xb24e('0xd')](_0xb24e('0xe'),_0x3b7e50);}},'description':{'type':Sequelize[_0xb24e('0x2')]}}; \ No newline at end of file +var _0x193e=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x15194c,_0x5ca287){var _0x312a9a=function(_0x4a22aa){while(--_0x4a22aa){_0x15194c['push'](_0x15194c['shift']());}};_0x312a9a(++_0x5ca287);}(_0x193e,0xa8));var _0xe193=function(_0x3a7932,_0x5baf02){_0x3a7932=_0x3a7932-0x0;var _0x21896b=_0x193e[_0x3a7932];return _0x21896b;};'use strict';var Sequelize=require(_0xe193('0x0'));var rs=require(_0xe193('0x1'));module['exports']={'name':{'type':Sequelize[_0xe193('0x2')],'unique':_0xe193('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe193('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe193('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe193('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe193('0x4')](_0xe193('0x5'),_0xe193('0x6'))},'accountSid':{'type':Sequelize[_0xe193('0x2')]},'baseUrl':{'type':Sequelize[_0xe193('0x2')]},'authToken':{'type':Sequelize[_0xe193('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe193('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe193('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe193('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe193('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe193('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe193('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe193('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe193('0x9')],'comment':_0xe193('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xe193('0x8')],'defaultValue':![],'comment':_0xe193('0xb'),'set':function(_0x4542d8){if(!_0x4542d8){this['setDataValue'](_0xe193('0xc'),null);}this[_0xe193('0xd')](_0xe193('0xe'),_0x4542d8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index de02b7f..6c75de2 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 _0xb5dd=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','name','index','Pause','map','WhatsappAccount','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','send','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb5dd,0x17b));var _0xdb5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb5dd[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xdb5d('0x0'));var rimraf=require(_0xdb5d('0x1'));var zipdir=require(_0xdb5d('0x2'));var jsonpatch=require(_0xdb5d('0x3'));var rp=require(_0xdb5d('0x4'));var moment=require('moment');var BPromise=require(_0xdb5d('0x5'));var Mustache=require(_0xdb5d('0x6'));var util=require(_0xdb5d('0x7'));var path=require(_0xdb5d('0x8'));var sox=require('sox');var csv=require(_0xdb5d('0x9'));var ejs=require(_0xdb5d('0xa'));var fs=require('fs');var fs_extra=require(_0xdb5d('0xb'));var _=require(_0xdb5d('0xc'));var squel=require(_0xdb5d('0xd'));var crypto=require(_0xdb5d('0xe'));var jsforce=require(_0xdb5d('0xf'));var deskjs=require(_0xdb5d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdb5d('0x11'));var Papa=require('papaparse');var Redis=require(_0xdb5d('0x12'));var authService=require(_0xdb5d('0x13'));var qs=require(_0xdb5d('0x14'));var as=require(_0xdb5d('0x15'));var hardwareService=require(_0xdb5d('0x16'));var logger=require(_0xdb5d('0x17'))(_0xdb5d('0x18'));var utils=require(_0xdb5d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdb5d('0x1a'));var db=require(_0xdb5d('0x1b'))['db'];config['redis']=_['defaults'](config[_0xdb5d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb5d('0x1d'))(new Redis(config['redis']));require(_0xdb5d('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdb5d('0x1f')][_0xdb5d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1d81bb,_0x305250,_0x5e2000,_0x23db87){return new BPromise(function(_0x4ed4c9,_0x2f2921){var _0x53cdfc=_0x23db87||client;return _0x53cdfc[_0xdb5d('0x21')](_0x1d81bb,_0x5e2000)[_0xdb5d('0x22')](function(_0x43b84d){logger[_0xdb5d('0x23')](_0xdb5d('0x24'),_0x305250,_0xdb5d('0x25'));logger[_0xdb5d('0x26')](_0xdb5d('0x27'),_0x305250,_0xdb5d('0x25'),JSON['stringify'](_0x43b84d));if(_0x43b84d[_0xdb5d('0x28')]){if(_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x29')]===0x1f4){logger['error'](_0xdb5d('0x24'),_0x305250,_0x43b84d['error'][_0xdb5d('0x2a')]);return _0x2f2921(_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x2a')]);}logger['error'](_0xdb5d('0x24'),_0x305250,_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x2a')]);return _0x4ed4c9(_0x43b84d[_0xdb5d('0x28')][_0xdb5d('0x2a')]);}else{logger[_0xdb5d('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x305250,_0xdb5d('0x25'));_0x4ed4c9(_0x43b84d[_0xdb5d('0x2b')][_0xdb5d('0x2a')]);}})['catch'](function(_0x46bbf1){logger['error'](_0xdb5d('0x24'),_0x305250,_0x46bbf1);_0x2f2921(_0x46bbf1);});});}function respondWithStatusCode(_0x5b3e13,_0x4a9fff){_0x4a9fff=_0x4a9fff||0xcc;return function(_0x298bd4){if(_0x298bd4){return _0x5b3e13[_0xdb5d('0x2c')](_0x4a9fff);}return _0x5b3e13['status'](_0x4a9fff)['end']();};}function respondWithResult(_0x16c8be,_0x161e35){_0x161e35=_0x161e35||0xc8;return function(_0x4a7669){if(_0x4a7669){return _0x16c8be[_0xdb5d('0x2d')](_0x161e35)[_0xdb5d('0x2e')](_0x4a7669);}};}function respondWithFilteredResult(_0x525c53,_0x169825){return function(_0x155dca){if(_0x155dca){var _0xe4f57f=typeof _0x169825['offset']===_0xdb5d('0x2f')&&typeof _0x169825[_0xdb5d('0x30')]===_0xdb5d('0x2f');var _0x13a843=_0x155dca[_0xdb5d('0x31')];var _0x1db6d9=_0xe4f57f?0x0:_0x169825[_0xdb5d('0x32')];var _0x146f3e=_0xe4f57f?_0x155dca[_0xdb5d('0x31')]:_0x169825[_0xdb5d('0x32')]+_0x169825[_0xdb5d('0x30')];var _0x381c5f;if(_0x146f3e>=_0x13a843){_0x146f3e=_0x13a843;_0x381c5f=0xc8;}else{_0x381c5f=0xce;}_0x525c53[_0xdb5d('0x2d')](_0x381c5f);return _0x525c53['set']('Content-Range',_0x1db6d9+'-'+_0x146f3e+'/'+_0x13a843)['json'](_0x155dca);}return null;};}function patchUpdates(_0x2a0788){return function(_0x1aeb5a){try{jsonpatch[_0xdb5d('0x33')](_0x1aeb5a,_0x2a0788,!![]);}catch(_0x15f14a){return BPromise[_0xdb5d('0x34')](_0x15f14a);}return _0x1aeb5a[_0xdb5d('0x35')]();};}function saveUpdates(_0x24a75b,_0x30b20b){return function(_0x44595c){if(_0x44595c){return _0x44595c[_0xdb5d('0x36')](_0x24a75b)[_0xdb5d('0x22')](function(_0x554a11){return _0x554a11;});}return null;};}function removeEntity(_0x484f52,_0x190434){return function(_0x317086){if(_0x317086){return _0x317086[_0xdb5d('0x37')]()[_0xdb5d('0x22')](function(){var _0x12072e=_0x317086[_0xdb5d('0x38')]({'plain':!![]});var _0x218fd9=_0xdb5d('0x39');return db[_0xdb5d('0x3a')]['destroy']({'where':{'type':_0x218fd9,'resourceId':_0x12072e['id']}})[_0xdb5d('0x22')](function(){return _0x317086;});})['then'](function(){_0x484f52[_0xdb5d('0x2d')](0xcc)[_0xdb5d('0x3b')]();});}};}function handleEntityNotFound(_0x376ab4,_0x26ee34){return function(_0x431533){if(!_0x431533){_0x376ab4[_0xdb5d('0x2c')](0x194);}return _0x431533;};}function handleError(_0x214431,_0x5dcd96){_0x5dcd96=_0x5dcd96||0x1f4;return function(_0x36421a){logger[_0xdb5d('0x28')](_0x36421a['stack']);if(_0x36421a[_0xdb5d('0x3c')]){delete _0x36421a[_0xdb5d('0x3c')];}_0x214431[_0xdb5d('0x2d')](_0x5dcd96)['send'](_0x36421a);};}exports[_0xdb5d('0x3d')]=function(_0x1bbbe9,_0x3fd1ef){var _0x3a95b4={'include':[{'model':db[_0xdb5d('0x3e')],'as':'mandatoryDispositionPause'}]},_0x168485={},_0x1f7d8b={'count':0x0,'rows':[]};var _0xd9ea94=_[_0xdb5d('0x3f')](db[_0xdb5d('0x40')][_0xdb5d('0x41')],function(_0x1f89d6){return{'name':_0x1f89d6['fieldName'],'type':_0x1f89d6['type']['key']};});_0x168485['model']=_[_0xdb5d('0x3f')](_0xd9ea94,_0xdb5d('0x3c'));_0x168485[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x1bbbe9[_0xdb5d('0x42')]);_0x168485[_0xdb5d('0x44')]=_[_0xdb5d('0x45')](_0x168485[_0xdb5d('0x46')],_0x168485[_0xdb5d('0x42')]);_0x3a95b4['attributes']=_[_0xdb5d('0x45')](_0x168485[_0xdb5d('0x46')],qs[_0xdb5d('0x47')](_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0x3a95b4[_0xdb5d('0x48')]=_0x3a95b4['attributes'][_0xdb5d('0x49')]?_0x3a95b4[_0xdb5d('0x48')]:_0x168485[_0xdb5d('0x46')];if(!_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x4a')]('nolimit')){_0x3a95b4[_0xdb5d('0x30')]=qs[_0xdb5d('0x30')](_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x30')]);_0x3a95b4[_0xdb5d('0x32')]=qs['offset'](_0x1bbbe9['query'][_0xdb5d('0x32')]);}_0x3a95b4[_0xdb5d('0x4b')]=qs[_0xdb5d('0x4c')](_0x1bbbe9['query']['sort']);_0x3a95b4[_0xdb5d('0x4d')]=qs[_0xdb5d('0x44')](_[_0xdb5d('0x4e')](_0x1bbbe9[_0xdb5d('0x42')],_0x168485['filters']),_0xd9ea94);if(_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x4f')]){_0x3a95b4[_0xdb5d('0x4d')]=_[_0xdb5d('0x50')](_0x3a95b4[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0xd9ea94,function(_0x2184f4){if(_0x2184f4[_0xdb5d('0x51')]!==_0xdb5d('0x52')){var _0x48e0db={};_0x48e0db[_0x2184f4['name']]={'$like':'%'+_0x1bbbe9['query']['filter']+'%'};return _0x48e0db;}})});}_0x3a95b4=_[_0xdb5d('0x50')]({},_0x3a95b4,_0x1bbbe9[_0xdb5d('0x53')]);var _0x5b9551={'where':_0x3a95b4[_0xdb5d('0x4d')]};return db[_0xdb5d('0x40')]['count'](_0x5b9551)[_0xdb5d('0x22')](function(_0x20d2a2){_0x1f7d8b['count']=_0x20d2a2;if(_0x1bbbe9[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0x3a95b4[_0xdb5d('0x55')]=[{'all':!![]}];}return db[_0xdb5d('0x40')][_0xdb5d('0x56')](_0x3a95b4);})[_0xdb5d('0x22')](function(_0x27bcc1){_0x1f7d8b[_0xdb5d('0x57')]=_0x27bcc1;return _0x1f7d8b;})[_0xdb5d('0x22')](respondWithFilteredResult(_0x3fd1ef,_0x3a95b4))[_0xdb5d('0x58')](handleError(_0x3fd1ef,null));};exports[_0xdb5d('0x59')]=function(_0xccae2a,_0x1d164c){var _0x67e07b={'raw':![],'where':{'id':_0xccae2a[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0x3e')],'as':_0xdb5d('0x5b')}]},_0x305655={};_0x305655[_0xdb5d('0x46')]=_['keys'](db[_0xdb5d('0x40')][_0xdb5d('0x41')]);_0x305655[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0xccae2a['query']);_0x305655['filters']=_['intersection'](_0x305655[_0xdb5d('0x46')],_0x305655[_0xdb5d('0x42')]);_0x67e07b[_0xdb5d('0x48')]=_[_0xdb5d('0x45')](_0x305655[_0xdb5d('0x46')],qs['fields'](_0xccae2a['query']['fields']));_0x67e07b[_0xdb5d('0x48')]=_0x67e07b['attributes'][_0xdb5d('0x49')]?_0x67e07b[_0xdb5d('0x48')]:_0x305655[_0xdb5d('0x46')];if(_0xccae2a[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0x67e07b[_0xdb5d('0x55')]=[{'all':!![]}];}_0x67e07b=_[_0xdb5d('0x50')]({},_0x67e07b,_0xccae2a['options']);return db[_0xdb5d('0x40')][_0xdb5d('0x5c')](_0x67e07b)[_0xdb5d('0x22')](handleEntityNotFound(_0x1d164c,null))[_0xdb5d('0x22')](respondWithResult(_0x1d164c,null))[_0xdb5d('0x58')](handleError(_0x1d164c,null));};exports[_0xdb5d('0x5d')]=function(_0x38cb93,_0xaff544){return db['WhatsappAccount'][_0xdb5d('0x5d')](_0x38cb93[_0xdb5d('0x5e')],{})[_0xdb5d('0x22')](function(_0x17bf5d){var _0x154f4f=_0x38cb93[_0xdb5d('0x5f')][_0xdb5d('0x38')]({'plain':!![]});if(!_0x154f4f)throw new Error(_0xdb5d('0x60'));if(_0x154f4f[_0xdb5d('0x61')]===_0xdb5d('0x5f')){var _0x1f80f7=_0x17bf5d[_0xdb5d('0x38')]({'plain':!![]});var _0x2731a2=_0xdb5d('0x39');return db[_0xdb5d('0x62')]['find']({'where':{'name':_0x2731a2,'userProfileId':_0x154f4f['userProfileId']},'raw':!![]})[_0xdb5d('0x22')](function(_0x1ce54b){if(_0x1ce54b&&_0x1ce54b['autoAssociation']===0x0){return db[_0xdb5d('0x3a')][_0xdb5d('0x5d')]({'name':_0x1f80f7[_0xdb5d('0x3c')],'resourceId':_0x1f80f7['id'],'type':_0x1ce54b[_0xdb5d('0x3c')],'sectionId':_0x1ce54b['id']},{})[_0xdb5d('0x22')](function(){return _0x17bf5d;});}else{return _0x17bf5d;}})[_0xdb5d('0x58')](function(_0x582b2b){logger[_0xdb5d('0x28')](_0xdb5d('0x63'),_0x582b2b);throw _0x582b2b;});}return _0x17bf5d;})['then'](respondWithResult(_0xaff544,0xc9))['catch'](handleError(_0xaff544,null));};exports[_0xdb5d('0x36')]=function(_0xe86464,_0x28012c){if(_0xe86464[_0xdb5d('0x5e')]['id']){delete _0xe86464[_0xdb5d('0x5e')]['id'];}return db['WhatsappAccount'][_0xdb5d('0x5c')]({'where':{'id':_0xe86464[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xdb5d('0x22')](handleEntityNotFound(_0x28012c,null))['then'](saveUpdates(_0xe86464[_0xdb5d('0x5e')],null))['then'](respondWithResult(_0x28012c,null))[_0xdb5d('0x58')](handleError(_0x28012c,null));};exports['destroy']=function(_0x532f60,_0x8e4ee5){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x532f60[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x8e4ee5,null))[_0xdb5d('0x22')](removeEntity(_0x8e4ee5,null))[_0xdb5d('0x58')](handleError(_0x8e4ee5,null));};exports[_0xdb5d('0x64')]=function(_0x17e85b,_0x5049a5){return db[_0xdb5d('0x40')][_0xdb5d('0x64')]()[_0xdb5d('0x22')](respondWithResult(_0x5049a5,null))[_0xdb5d('0x58')](handleError(_0x5049a5,null));};exports['addDisposition']=function(_0x11298f,_0x4f8f50,_0x39b7e8){if(_0x11298f['body']['id']){delete _0x11298f[_0xdb5d('0x5e')]['id'];}return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x11298f[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x4f8f50,null))[_0xdb5d('0x22')](function(_0x579899){if(_0x579899){_0x11298f['body'][_0xdb5d('0x65')]=_0x579899['id'];return db['Disposition']['create'](_0x11298f['body']);}})[_0xdb5d('0x22')](respondWithResult(_0x4f8f50,null))[_0xdb5d('0x58')](handleError(_0x4f8f50,null));};exports[_0xdb5d('0x66')]=function(_0x5529f3,_0x414415,_0x386495){var _0xe3a474={'raw':![],'where':{}};var _0x1647dc={};var _0x46746d={'count':0x0,'rows':[]};return db[_0xdb5d('0x40')]['findOne']({'where':{'id':_0x5529f3[_0xdb5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x414415,null))[_0xdb5d('0x22')](function(_0x591cc5){if(_0x591cc5){_0x1647dc[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db[_0xdb5d('0x67')]['rawAttributes']);_0x1647dc[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x5529f3[_0xdb5d('0x42')]);_0x1647dc['filters']=_[_0xdb5d('0x45')](_0x1647dc['model'],_0x1647dc['query']);_0xe3a474[_0xdb5d('0x48')]=_[_0xdb5d('0x45')](_0x1647dc['model'],qs[_0xdb5d('0x47')](_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0xe3a474['attributes']=_0xe3a474[_0xdb5d('0x48')]['length']?_0xe3a474[_0xdb5d('0x48')]:_0x1647dc[_0xdb5d('0x46')];if(!_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x4a')]('nolimit')){_0xe3a474['limit']=qs[_0xdb5d('0x30')](_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x30')]);_0xe3a474[_0xdb5d('0x32')]=qs[_0xdb5d('0x32')](_0x5529f3[_0xdb5d('0x42')]['offset']);}_0xe3a474['order']=qs[_0xdb5d('0x4c')](_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x4c')]);_0xe3a474[_0xdb5d('0x4d')]=qs['filters'](_[_0xdb5d('0x4e')](_0x5529f3[_0xdb5d('0x42')],_0x1647dc[_0xdb5d('0x44')]));_0xe3a474['where'][_0xdb5d('0x65')]=_0x591cc5['id'];if(_0x5529f3['query'][_0xdb5d('0x4f')]){_0xe3a474[_0xdb5d('0x4d')]=_[_0xdb5d('0x50')](_0xe3a474[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0xe3a474['attributes'],function(_0x2347c0){var _0x5926d9={};_0x5926d9[_0x2347c0]={'$like':'%'+_0x5529f3[_0xdb5d('0x42')]['filter']+'%'};return _0x5926d9;})});}_0xe3a474=_[_0xdb5d('0x50')]({},_0xe3a474,_0x5529f3[_0xdb5d('0x53')]);return db['Disposition'][_0xdb5d('0x31')]({'where':_0xe3a474[_0xdb5d('0x4d')]})[_0xdb5d('0x22')](function(_0x57c884){_0x46746d[_0xdb5d('0x31')]=_0x57c884;if(_0x5529f3[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0xe3a474[_0xdb5d('0x55')]=[{'all':!![]}];}return db[_0xdb5d('0x67')][_0xdb5d('0x56')](_0xe3a474);})[_0xdb5d('0x22')](function(_0x4907d3){_0x46746d[_0xdb5d('0x57')]=_0x4907d3;return _0x46746d;});}})[_0xdb5d('0x22')](respondWithFilteredResult(_0x414415,_0xe3a474))[_0xdb5d('0x58')](handleError(_0x414415,null));};exports[_0xdb5d('0x68')]=function(_0xfe9809,_0x1e1d45,_0x3552ce){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0xfe9809[_0xdb5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e1d45,null))[_0xdb5d('0x22')](function(_0x168082){if(_0x168082){return _0x168082['removeDispositions'](_0xfe9809[_0xdb5d('0x42')][_0xdb5d('0x69')]);}})['then'](respondWithStatusCode(_0x1e1d45,null))['catch'](handleError(_0x1e1d45,null));};exports[_0xdb5d('0x6a')]=function(_0xb4a3a1,_0x28d85f,_0x177d1d){if(_0xb4a3a1[_0xdb5d('0x5e')]['id']){delete _0xb4a3a1[_0xdb5d('0x5e')]['id'];}return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0xb4a3a1['params']['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x28d85f,null))['then'](function(_0xa692a4){if(_0xa692a4){_0xb4a3a1[_0xdb5d('0x5e')][_0xdb5d('0x65')]=_0xa692a4['id'];return db[_0xdb5d('0x6b')][_0xdb5d('0x5d')](_0xb4a3a1[_0xdb5d('0x5e')]);}})[_0xdb5d('0x22')](respondWithResult(_0x28d85f,null))[_0xdb5d('0x58')](handleError(_0x28d85f,null));};exports[_0xdb5d('0x6c')]=function(_0x25e08a,_0x4d3acd,_0x26755c){var _0x2970e4={'raw':![],'where':{}};var _0x261368={};var _0x81deb4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xdb5d('0x6d')]({'where':{'id':_0x25e08a[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x4d3acd,null))['then'](function(_0xe66407){if(_0xe66407){_0x261368[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db[_0xdb5d('0x6b')][_0xdb5d('0x41')]);_0x261368[_0xdb5d('0x42')]=_['keys'](_0x25e08a[_0xdb5d('0x42')]);_0x261368[_0xdb5d('0x44')]=_[_0xdb5d('0x45')](_0x261368['model'],_0x261368[_0xdb5d('0x42')]);_0x2970e4[_0xdb5d('0x48')]=_['intersection'](_0x261368[_0xdb5d('0x46')],qs[_0xdb5d('0x47')](_0x25e08a['query'][_0xdb5d('0x47')]));_0x2970e4[_0xdb5d('0x48')]=_0x2970e4['attributes'][_0xdb5d('0x49')]?_0x2970e4['attributes']:_0x261368[_0xdb5d('0x46')];if(!_0x25e08a['query'][_0xdb5d('0x4a')](_0xdb5d('0x6e'))){_0x2970e4[_0xdb5d('0x30')]=qs[_0xdb5d('0x30')](_0x25e08a[_0xdb5d('0x42')][_0xdb5d('0x30')]);_0x2970e4[_0xdb5d('0x32')]=qs['offset'](_0x25e08a[_0xdb5d('0x42')][_0xdb5d('0x32')]);}_0x2970e4[_0xdb5d('0x4b')]=qs['sort'](_0x25e08a['query'][_0xdb5d('0x4c')]);_0x2970e4[_0xdb5d('0x4d')]=qs[_0xdb5d('0x44')](_[_0xdb5d('0x4e')](_0x25e08a['query'],_0x261368['filters']));_0x2970e4[_0xdb5d('0x4d')][_0xdb5d('0x65')]=_0xe66407['id'];if(_0x25e08a[_0xdb5d('0x42')]['filter']){_0x2970e4['where']=_[_0xdb5d('0x50')](_0x2970e4[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0x2970e4[_0xdb5d('0x48')],function(_0x406b22){var _0x568422={};_0x568422[_0x406b22]={'$like':'%'+_0x25e08a[_0xdb5d('0x42')]['filter']+'%'};return _0x568422;})});}_0x2970e4=_['merge']({},_0x2970e4,_0x25e08a[_0xdb5d('0x53')]);return db[_0xdb5d('0x6b')][_0xdb5d('0x31')]({'where':_0x2970e4[_0xdb5d('0x4d')]})[_0xdb5d('0x22')](function(_0x5a931f){_0x81deb4[_0xdb5d('0x31')]=_0x5a931f;if(_0x25e08a[_0xdb5d('0x42')][_0xdb5d('0x54')]){_0x2970e4[_0xdb5d('0x55')]=[{'all':!![]}];}return db[_0xdb5d('0x6b')][_0xdb5d('0x56')](_0x2970e4);})[_0xdb5d('0x22')](function(_0x125543){_0x81deb4['rows']=_0x125543;return _0x81deb4;});}})['then'](respondWithFilteredResult(_0x4d3acd,_0x2970e4))[_0xdb5d('0x58')](handleError(_0x4d3acd,null));};exports[_0xdb5d('0x6f')]=function(_0x3db182,_0x353416,_0x2c81ae){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x3db182[_0xdb5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x353416,null))[_0xdb5d('0x22')](function(_0x158700){if(_0x158700){return _0x158700[_0xdb5d('0x6f')](_0x3db182[_0xdb5d('0x42')][_0xdb5d('0x69')]);}})[_0xdb5d('0x22')](respondWithStatusCode(_0x353416,null))[_0xdb5d('0x58')](handleError(_0x353416,null));};exports[_0xdb5d('0x70')]=function(_0x5e850e,_0x954a6b,_0x5e4e14){return db[_0xdb5d('0x40')]['find']({'where':{'id':_0x5e850e[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x954a6b,null))[_0xdb5d('0x22')](function(_0x379d84){if(_0x379d84){return _0x379d84[_0xdb5d('0x70')](_0x5e850e[_0xdb5d('0x5e')]['ids'],_[_0xdb5d('0x71')](_0x5e850e[_0xdb5d('0x5e')],[_0xdb5d('0x69'),'id'])||{})[_0xdb5d('0x72')](function(_0x4d5bdf){for(var _0x4736ed=0x0;_0x4736ed<_0x5e850e[_0xdb5d('0x5e')]['ids'][_0xdb5d('0x49')];_0x4736ed+=0x1){socket[_0xdb5d('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x5e850e[_0xdb5d('0x5e')][_0xdb5d('0x69')][_0x4736ed]),'WhatsappAccountId':Number(_0x5e850e['params']['id'])});}return _0x4d5bdf;});}})['then'](respondWithResult(_0x954a6b,null))['catch'](handleError(_0x954a6b,null));};exports[_0xdb5d('0x74')]=function(_0x34800c,_0x468829,_0x49c045){return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x34800c[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x468829,null))[_0xdb5d('0x22')](function(_0x19709b){if(_0x19709b){return _0x19709b[_0xdb5d('0x74')](_0x34800c[_0xdb5d('0x42')][_0xdb5d('0x69')])[_0xdb5d('0x22')](function(){if(_['isArray'](_0x34800c[_0xdb5d('0x42')][_0xdb5d('0x69')])){for(var _0x5b6f77=0x0;_0x5b6f77<_0x34800c['query']['ids'][_0xdb5d('0x49')];_0x5b6f77+=0x1){socket[_0xdb5d('0x73')](_0xdb5d('0x75'),{'UserId':Number(_0x34800c[_0xdb5d('0x42')]['ids'][_0x5b6f77]),'WhatsappAccountId':Number(_0x34800c[_0xdb5d('0x5a')]['id'])});}}else{socket[_0xdb5d('0x73')](_0xdb5d('0x75'),{'UserId':Number(_0x34800c[_0xdb5d('0x42')][_0xdb5d('0x69')]),'WhatsappAccountId':Number(_0x34800c[_0xdb5d('0x5a')]['id'])});}});}})[_0xdb5d('0x22')](respondWithStatusCode(_0x468829,null))[_0xdb5d('0x58')](handleError(_0x468829,null));};exports[_0xdb5d('0x76')]=function(_0x33d366,_0x228783,_0x43c14a){var _0x52e334={};var _0x4f2371={};var _0xb5020f;var _0x33da0a;return db[_0xdb5d('0x40')][_0xdb5d('0x6d')]({'where':{'id':_0x33d366[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x228783,null))['then'](function(_0x410af5){if(_0x410af5){_0xb5020f=_0x410af5;_0x4f2371[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db['User'][_0xdb5d('0x41')]);_0x4f2371[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x33d366[_0xdb5d('0x42')]);_0x4f2371[_0xdb5d('0x44')]=_['intersection'](_0x4f2371[_0xdb5d('0x46')],_0x4f2371[_0xdb5d('0x42')]);_0x52e334[_0xdb5d('0x48')]=_[_0xdb5d('0x45')](_0x4f2371[_0xdb5d('0x46')],qs[_0xdb5d('0x47')](_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0x52e334[_0xdb5d('0x48')]=_0x52e334[_0xdb5d('0x48')]['length']?_0x52e334[_0xdb5d('0x48')]:_0x4f2371[_0xdb5d('0x46')];_0x52e334[_0xdb5d('0x4b')]=qs[_0xdb5d('0x4c')](_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4c')]);_0x52e334[_0xdb5d('0x4d')]=qs[_0xdb5d('0x44')](_[_0xdb5d('0x4e')](_0x33d366['query'],_0x4f2371[_0xdb5d('0x44')]));if(_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4f')]){_0x52e334[_0xdb5d('0x4d')]=_['merge'](_0x52e334[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0x52e334[_0xdb5d('0x48')],function(_0x22bfcf){var _0x32f027={};_0x32f027[_0x22bfcf]={'$like':'%'+_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4f')]+'%'};return _0x32f027;})});}_0x52e334=_[_0xdb5d('0x50')]({},_0x52e334,_0x33d366[_0xdb5d('0x53')]);return _0xb5020f[_0xdb5d('0x76')](_0x52e334);}})[_0xdb5d('0x22')](function(_0x2101ea){if(_0x2101ea){_0x33da0a=_0x2101ea['length'];if(!_0x33d366[_0xdb5d('0x42')][_0xdb5d('0x4a')](_0xdb5d('0x6e'))){_0x52e334[_0xdb5d('0x30')]=qs[_0xdb5d('0x30')](_0x33d366['query'][_0xdb5d('0x30')]);_0x52e334['offset']=qs['offset'](_0x33d366[_0xdb5d('0x42')]['offset']);}return _0xb5020f[_0xdb5d('0x76')](_0x52e334);}})['then'](function(_0x4e61c4){if(_0x4e61c4){return _0x4e61c4?{'count':_0x33da0a,'rows':_0x4e61c4}:null;}})[_0xdb5d('0x22')](respondWithResult(_0x228783,null))[_0xdb5d('0x58')](handleError(_0x228783,null));};exports[_0xdb5d('0x77')]=function(_0x14f880,_0x4f58b6){var _0x2a5c62=_0x14f880['params']['id'];var _0x152fd6=_0x14f880[_0xdb5d('0x5e')];var _0x4f0fd1=0xc8;var _0x5ecd96=null;return db[_0xdb5d('0x78')][_0xdb5d('0x79')]({'isolationLevel':db[_0xdb5d('0x78')]['Transaction']['ISOLATION_LEVELS'][_0xdb5d('0x7a')]},function(_0x5b88df){return db['WhatsappAccount']['findOne']({'where':{'id':_0x2a5c62},'transaction':_0x5b88df})[_0xdb5d('0x22')](function(_0x4a98e8){if(_0x4a98e8){return db['WhatsappApplication'][_0xdb5d('0x37')]({'where':{'WhatsappAccountId':_0x2a5c62},'transaction':_0x5b88df})[_0xdb5d('0x22')](function(){var _0x5cb5f2=_[_0xdb5d('0x3f')](_0x152fd6,function(_0x21309b){_0x21309b[_0xdb5d('0x65')]=_0x2a5c62;return _0x21309b;});return db[_0xdb5d('0x7b')][_0xdb5d('0x7c')](_0x5cb5f2,{'transaction':_0x5b88df});});}else{_0x4f0fd1=0x194;_0x5ecd96=[];}});})[_0xdb5d('0x22')](function(){if(_0x4f0fd1!==0x194){return db[_0xdb5d('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2a5c62},'order':_0xdb5d('0x7d')})['then'](function(_0xcd4690){_0x5ecd96=_0xcd4690;});}})[_0xdb5d('0x58')](function(_0x506133){_0x4f0fd1=0x1f4;logger[_0xdb5d('0x28')](_0x506133[_0xdb5d('0x7e')]);if(_0x506133[_0xdb5d('0x3c')]){delete _0x506133['name'];}_0x5ecd96=_0x506133;})['finally'](function(){if(_0x5ecd96===null){_0x4f58b6[_0xdb5d('0x2c')](_0x4f0fd1);}else{if(_0x4f0fd1===0x1f4){_0x4f58b6[_0xdb5d('0x2d')](_0x4f0fd1)['send'](_0x5ecd96);}else{_0x4f58b6[_0xdb5d('0x2d')](_0x4f0fd1)[_0xdb5d('0x2e')](_0x5ecd96);}}});};exports[_0xdb5d('0x7f')]=function(_0x218714,_0x3aa919,_0x5b54c9){var _0xa8dae1={};var _0x82a8b7={};var _0x2e7579;var _0x1ce1ed;return db[_0xdb5d('0x40')][_0xdb5d('0x6d')]({'where':{'id':_0x218714[_0xdb5d('0x5a')]['id']}})[_0xdb5d('0x22')](handleEntityNotFound(_0x3aa919,null))[_0xdb5d('0x22')](function(_0x520fb8){if(_0x520fb8){_0x2e7579=_0x520fb8;_0x82a8b7[_0xdb5d('0x46')]=_[_0xdb5d('0x43')](db['WhatsappApplication']['rawAttributes']);_0x82a8b7[_0xdb5d('0x42')]=_[_0xdb5d('0x43')](_0x218714[_0xdb5d('0x42')]);_0x82a8b7[_0xdb5d('0x44')]=_[_0xdb5d('0x45')](_0x82a8b7[_0xdb5d('0x46')],_0x82a8b7[_0xdb5d('0x42')]);_0xa8dae1['attributes']=_[_0xdb5d('0x45')](_0x82a8b7['model'],qs[_0xdb5d('0x47')](_0x218714[_0xdb5d('0x42')][_0xdb5d('0x47')]));_0xa8dae1['attributes']=_0xa8dae1[_0xdb5d('0x48')][_0xdb5d('0x49')]?_0xa8dae1['attributes']:_0x82a8b7[_0xdb5d('0x46')];_0xa8dae1['order']=qs[_0xdb5d('0x4c')](_0x218714[_0xdb5d('0x42')][_0xdb5d('0x4c')]);_0xa8dae1['where']=qs[_0xdb5d('0x44')](_['pick'](_0x218714[_0xdb5d('0x42')],_0x82a8b7['filters']));if(_0x218714[_0xdb5d('0x42')]['filter']){_0xa8dae1[_0xdb5d('0x4d')]=_['merge'](_0xa8dae1[_0xdb5d('0x4d')],{'$or':_[_0xdb5d('0x3f')](_0xa8dae1['attributes'],function(_0x3db510){var _0x116c13={};_0x116c13[_0x3db510]={'$like':'%'+_0x218714[_0xdb5d('0x42')][_0xdb5d('0x4f')]+'%'};return _0x116c13;})});}_0xa8dae1=_[_0xdb5d('0x50')]({},_0xa8dae1,_0x218714['options']);return _0x2e7579[_0xdb5d('0x7f')](_0xa8dae1);}})[_0xdb5d('0x22')](function(_0x1afc43){if(_0x1afc43){_0x1ce1ed=_0x1afc43[_0xdb5d('0x49')];if(!_0x218714[_0xdb5d('0x42')][_0xdb5d('0x4a')]('nolimit')){_0xa8dae1[_0xdb5d('0x30')]=qs['limit'](_0x218714[_0xdb5d('0x42')]['limit']);_0xa8dae1[_0xdb5d('0x32')]=qs[_0xdb5d('0x32')](_0x218714[_0xdb5d('0x42')][_0xdb5d('0x32')]);}return _0x2e7579['getApplications'](_0xa8dae1);}})[_0xdb5d('0x22')](function(_0xad264d){if(_0xad264d){return _0xad264d?{'count':_0x1ce1ed,'rows':_0xad264d}:null;}})['then'](respondWithResult(_0x3aa919,null))[_0xdb5d('0x58')](handleError(_0x3aa919,null));};exports[_0xdb5d('0x80')]=function(_0x1c896d,_0x1e8da,_0x5f237d){var _0x1504fc={'channel':'whatsapp'};var _0x21309f=[];var _0x382def=[];var _0x236aeb={};return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x1c896d[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0x7b')],'as':_0xdb5d('0x81')}]})['then'](handleEntityNotFound(_0x1e8da,null))[_0xdb5d('0x22')](function(_0x3de202){_0x1504fc[_0xdb5d('0x82')]=_0x3de202;if(_0x1504fc[_0xdb5d('0x82')]&&_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]==='sinch'&&_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x83')]){if(_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x83')][_0xdb5d('0x49')]===0x0)return;if(_0x1c896d[_0xdb5d('0x5e')]['statuses'][0x0][_0xdb5d('0x84')]!=='read')return;return db[_0xdb5d('0x85')]['update']({'read':!![],'readAt':_0x1c896d[_0xdb5d('0x5e')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x1c896d['body'][_0xdb5d('0x83')][0x0]['message_id']},'individualHooks':!![]})[_0xdb5d('0x22')](function(_0x42d9b3){return _0x1e8da['status'](0xc8)[_0xdb5d('0x2e')](_0x42d9b3);});}_0x1504fc[_0xdb5d('0x86')]=_[_0xdb5d('0x87')](_0x3de202[_0xdb5d('0x81')],[_0xdb5d('0x7d')],[_0xdb5d('0x88')]);if(_0x1504fc[_0xdb5d('0x82')]['Applications']){delete _0x1504fc['account'][_0xdb5d('0x81')];}return db[_0xdb5d('0x89')][_0xdb5d('0x64')]()['then'](function(_0x59f9dd){if(!_0x59f9dd){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0x8c'));}_0x21309f=_[_0xdb5d('0x8d')](_[_0xdb5d('0x43')](_0x59f9dd),['createdAt',_0xdb5d('0x8e')]);_0x382def=_[_0xdb5d('0x8d')](_['keys'](_0x59f9dd),[_0xdb5d('0x8f'),'updatedAt',_0xdb5d('0x90'),_0xdb5d('0x91')]);_0x1504fc[_0xdb5d('0x5e')]={'mapKey':_0xdb5d('0x92')};if(_0x1504fc[_0xdb5d('0x82')]&&_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]===_0xdb5d('0x93')){_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')]=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x95')]['replace'](_0xdb5d('0x96'),'');_0x1504fc[_0xdb5d('0x5e')]['body']=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x97')];_0x1504fc['body'][_0xdb5d('0x98')]=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x99')];}if(_0x1504fc['account']&&_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]==='sinch'){_0x1504fc['body']['from']=_0x1c896d[_0xdb5d('0x5e')]['notifications'][0x0][_0xdb5d('0x94')];_0x1504fc[_0xdb5d('0x5e')]['body']=_0x1c896d[_0xdb5d('0x5e')][_0xdb5d('0x9a')][0x0][_0xdb5d('0x2a')][_0xdb5d('0x5e')];_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x98')]=_0x1c896d['body']['notifications'][0x0][_0xdb5d('0x9b')];}if(_0x1504fc[_0xdb5d('0x5e')]['id']){delete _0x1504fc[_0xdb5d('0x5e')]['id'];}if(_[_0xdb5d('0x9c')](_0x1504fc[_0xdb5d('0x5e')]['from'])){throw new db['Sequelize'][(_0xdb5d('0x8b'))](_0xdb5d('0x9d'));}if(_[_0xdb5d('0x9c')](_0x1504fc['body']['body'])||_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x5e')]===''){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0x9e'));}if(_[_0xdb5d('0x9c')](_0x1504fc['body'][_0xdb5d('0x9f')])){throw new db[(_0xdb5d('0x8a'))]['ValidationError'](_0xdb5d('0xa0')+_0x382def);}if(!_[_0xdb5d('0xa1')](_0x382def,_0x1504fc['body'][_0xdb5d('0x9f')])){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0xa2')+_0x382def);}_0x236aeb[_0x1504fc['body']['mapKey']]=_0x1504fc['body']['from'];return db[_0xdb5d('0xa3')][_0xdb5d('0x5c')]({'where':{'id':_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x91')]},'include':[{'model':db[_0xdb5d('0x89')],'as':_0xdb5d('0xa4'),'where':_0x236aeb,'limit':0x1,'order':[[_0xdb5d('0x8e'),_0xdb5d('0xa5')]]}]});})[_0xdb5d('0x22')](handleEntityNotFound(_0x1e8da,null))[_0xdb5d('0x22')](function(_0x27824f){if(_0x27824f){_0x1504fc['list']=_[_0xdb5d('0x71')](_0x27824f,[_0xdb5d('0xa4')]);if(_0x27824f[_0xdb5d('0xa4')][_0xdb5d('0x49')]){return _0x27824f[_0xdb5d('0xa4')][0x0];}var _0xed9a6e=_['defaults'](_0x1504fc[_0xdb5d('0x5e')],{'firstName':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')],'ListId':_0x27824f['id']});_0xed9a6e[_0x1504fc['body']['mapKey']]=_0x1504fc['body']['from'];return db[_0xdb5d('0x89')][_0xdb5d('0x5d')](_0xed9a6e,{'fields':_0x21309f,'raw':!![]});}})['then'](handleEntityNotFound(_0x1e8da,null))[_0xdb5d('0x22')](function(_0x2587d3){if(_0x2587d3){_0x1504fc['contact']=_0x2587d3;var _0x285ac8={'ContactId':_0x2587d3['id'],'phone':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')],'WhatsappAccountId':_0x1c896d[_0xdb5d('0x5a')]['id']};var _0x32fa8f={'ContactId':_0x2587d3['id'],'WhatsappAccountId':_0x1c896d[_0xdb5d('0x5a')]['id'],'closed':![]};return db[_0xdb5d('0xa6')][_0xdb5d('0x5c')]({'where':_0x32fa8f})[_0xdb5d('0x22')](function(_0x938403){if(_0x938403){return[_0x938403,![]];}return db[_0xdb5d('0xa6')]['create'](_0x285ac8)['then'](function(_0x3946af){return[_0x3946af,!![]];});});}})[_0xdb5d('0x72')](function(_0x4226ef,_0x44c01b){_0x1504fc[_0xdb5d('0xa7')]=_0x4226ef[_0xdb5d('0x38')]({'plain':!![]});_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xa8')]=![];if(_0x44c01b){if(_0x1504fc['account'][_0xdb5d('0xa9')]){_0x1504fc[_0xdb5d('0x86')][_0xdb5d('0xaa')]({'id':0x0,'priority':_0x1504fc[_0xdb5d('0x86')][_0xdb5d('0x49')]+0x1,'app':_0xdb5d('0xab'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xa8')]=!![];}return db[_0xdb5d('0x85')][_0xdb5d('0x5d')]({'phone':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x94')],'messageId':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x98')],'body':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0x5e')],'WhatsappAccountId':_0x1c896d[_0xdb5d('0x5a')]['id'],'WhatsappInteractionId':_0x4226ef['id'],'direction':'in','ContactId':_0x4226ef[_0xdb5d('0xac')],'AttachmentId':_0x1504fc[_0xdb5d('0x5e')][_0xdb5d('0xad')]});})[_0xdb5d('0x22')](function(_0x5b1d84){_0x1504fc[_0xdb5d('0x2a')]=_0x5b1d84;if(_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xae')]){return db[_0xdb5d('0xaf')]['find']({'attributes':['id',_0xdb5d('0x3c')],'where':{'id':_0x1504fc[_0xdb5d('0xa7')][_0xdb5d('0xae')]}})['then'](function(_0x21782b){if(_0x21782b){_0x1504fc[_0xdb5d('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdb5d('0xb0'),'appdata':_0x21782b[_0xdb5d('0x3c')]+','+(_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0xb1')]||0xa),'interval':_0xdb5d('0xb2')});}return respondWithRpcPromise(_0xdb5d('0xb3'),_0xdb5d('0xb4'),_0x1504fc);});}return respondWithRpcPromise(_0xdb5d('0xb3'),_0xdb5d('0xb4'),_0x1504fc);})[_0xdb5d('0x22')](function(_0x381399){if(_0x381399){var _0x34f232=0xc8;var _0x4e2094=_0xdb5d('0xb5');logger[_0xdb5d('0x23')](_0xdb5d('0x27'),_0x4e2094,_0x34f232,_0xdb5d('0xb6'));logger[_0xdb5d('0x26')](_0xdb5d('0xb7'),_0x4e2094,_0x34f232,'entity\x20found',JSON['stringify'](_0x381399));if(_0x1504fc[_0xdb5d('0x82')][_0xdb5d('0x51')]===_0xdb5d('0x93')){return _0x1e8da[_0xdb5d('0x2d')](_0x34f232)[_0xdb5d('0xb8')]('Content-Type',_0xdb5d('0xb9'))[_0xdb5d('0xba')](_0xdb5d('0xbb'));}else{return _0x1e8da[_0xdb5d('0x2d')](_0x34f232)['json'](_0x381399);}}});})['catch'](handleError(_0x1e8da,null));};exports[_0xdb5d('0xba')]=function(_0x22aa6f,_0x486927,_0x537d84){var _0x379979,_0x223da5,_0x9f4981;if(_['isNil'](_0x22aa6f[_0xdb5d('0x5e')][_0xdb5d('0x5e')])||_0x22aa6f[_0xdb5d('0x5e')]['body']===''){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdb5d('0x9c')](_0x22aa6f[_0xdb5d('0x5e')]['to'])){throw new db[(_0xdb5d('0x8a'))][(_0xdb5d('0x8b'))](_0xdb5d('0xbc'));}_0x379979=_0x22aa6f[_0xdb5d('0x5e')]['to'];return db[_0xdb5d('0x40')][_0xdb5d('0x5c')]({'where':{'id':_0x22aa6f[_0xdb5d('0x5a')]['id']},'include':[{'model':db[_0xdb5d('0xa3')],'as':_0xdb5d('0xbd'),'include':[{'model':db['CmContact'],'as':_0xdb5d('0xa4'),'where':{'mobile':_0x379979},'limit':0x1,'order':[[_0xdb5d('0x8e'),_0xdb5d('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x486927,null))[_0xdb5d('0x22')](function(_0xda8082){if(_0xda8082&&_0xda8082[_0xdb5d('0xbd')]){_0x223da5=_0xda8082[_0xdb5d('0x38')]({'plain':!![]});if(_0x223da5['List']&&_0x223da5[_0xdb5d('0xbd')]['Contacts'][_0xdb5d('0x49')]){return _0x223da5[_0xdb5d('0xbd')][_0xdb5d('0xa4')][0x0];}return db[_0xdb5d('0x89')]['create'](_['defaults'](_0x22aa6f[_0xdb5d('0x5e')],{'firstName':_0x379979,'mobile':_0x379979,'phone':_0x379979,'ListId':_0x223da5['ListId']}));}})[_0xdb5d('0x22')](handleEntityNotFound(_0x486927,null))[_0xdb5d('0x22')](function(_0x2abbe0){if(_0x2abbe0){_0x9f4981=_0x2abbe0;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x9f4981['id'],'closed':![],'WhatsappAccountId':_0x223da5['id']}})[_0xdb5d('0x22')](function(_0x5b4738){if(_0x5b4738){return[_0x5b4738,![]];}return db[_0xdb5d('0xa6')][_0xdb5d('0x5d')]({'UserId':_0x22aa6f[_0xdb5d('0x5f')]['id'],'ContactId':_0x9f4981['id'],'WhatsappAccountId':_0x223da5['id'],'phone':_0x379979,'firstMsgDirection':_0xdb5d('0xbe'),'Messages':[_[_0xdb5d('0x50')](_0x22aa6f[_0xdb5d('0x5e')],{'read':![],'body':_0x22aa6f[_0xdb5d('0x5e')][_0xdb5d('0x5e')],'phone':_0x379979,'WhatsappAccountId':_0x223da5['id'],'UserId':_0x22aa6f['user']['id'],'ContactId':_0x9f4981['id']})]},{'include':[{'model':db[_0xdb5d('0x85')],'as':'Messages'}]})['then'](function(_0x1371ca){return[_0x1371ca,!![]];});});}})[_0xdb5d('0x72')](function(_0x2601a8,_0xd138a0){if(_0xd138a0){return _0x2601a8;}return db['WhatsappMessage'][_0xdb5d('0x5d')](_[_0xdb5d('0x50')](_0x22aa6f[_0xdb5d('0x5e')],{'read':![],'body':_0x22aa6f[_0xdb5d('0x5e')][_0xdb5d('0x5e')],'phone':_0x379979,'WhatsappAccountId':_0x223da5['id'],'WhatsappInteractionId':_0x2601a8['id'],'UserId':_0x22aa6f['user']['id'],'ContactId':_0x9f4981['id']}))[_0xdb5d('0x22')](function(_0x32f41e){_0x2601a8[_0xdb5d('0xbf')][_0xdb5d('0xc0')]=[];_0x2601a8[_0xdb5d('0xbf')]['Messages']['push'](_0x32f41e['dataValues']);return _0x2601a8;});})[_0xdb5d('0x22')](respondWithResult(_0x486927,null))[_0xdb5d('0x58')](handleError(_0x486927,null));}; \ No newline at end of file +var _0x8823=['info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','WhatsappAccount','include','findAll','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','pick','map','removeDispositions','addAnswer','CannedAnswer','rows','removeAnswers','ids','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','finally','getApplications','whatsapp','Applications','account','statuses','state','read','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','spread','interaction','push','unmanaged','*,*,*,*','AttachmentId','User','unshift','agent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then'];(function(_0xfd5211,_0x490686){var _0x19797d=function(_0x496d08){while(--_0x496d08){_0xfd5211['push'](_0xfd5211['shift']());}};_0x19797d(++_0x490686);}(_0x8823,0xa2));var _0x3882=function(_0x4f5e50,_0x226757){_0x4f5e50=_0x4f5e50-0x0;var _0x89e4e8=_0x8823[_0x4f5e50];return _0x89e4e8;};'use strict';var emlformat=require(_0x3882('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3882('0x1'));var jsonpatch=require(_0x3882('0x2'));var rp=require(_0x3882('0x3'));var moment=require(_0x3882('0x4'));var BPromise=require(_0x3882('0x5'));var Mustache=require(_0x3882('0x6'));var util=require(_0x3882('0x7'));var path=require('path');var sox=require(_0x3882('0x8'));var csv=require(_0x3882('0x9'));var ejs=require(_0x3882('0xa'));var fs=require('fs');var fs_extra=require(_0x3882('0xb'));var _=require(_0x3882('0xc'));var squel=require('squel');var crypto=require(_0x3882('0xd'));var jsforce=require(_0x3882('0xe'));var deskjs=require(_0x3882('0xf'));var toCsv=require(_0x3882('0x9'));var querystring=require(_0x3882('0x10'));var Papa=require(_0x3882('0x11'));var Redis=require(_0x3882('0x12'));var authService=require(_0x3882('0x13'));var qs=require(_0x3882('0x14'));var as=require(_0x3882('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3882('0x16'))(_0x3882('0x17'));var utils=require(_0x3882('0x18'));var config=require(_0x3882('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3882('0x1a'))['db'];config['redis']=_[_0x3882('0x1b')](config[_0x3882('0x1c')],{'host':_0x3882('0x1d'),'port':0x18eb});var socket=require(_0x3882('0x1e'))(new Redis(config[_0x3882('0x1c')]));require('./whatsappAccount.socket')[_0x3882('0x1f')](socket);var jayson=require(_0x3882('0x20'));var client=jayson[_0x3882('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x15d64e,_0xf32c3f,_0x114b62,_0x3c44ae){return new BPromise(function(_0x5db9ee,_0x1d0eb6){var _0x3be4a7=_0x3c44ae||client;return _0x3be4a7[_0x3882('0x22')](_0x15d64e,_0x114b62)[_0x3882('0x23')](function(_0x509058){logger[_0x3882('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0xf32c3f,'request\x20sent');logger[_0x3882('0x25')](_0x3882('0x26'),_0xf32c3f,_0x3882('0x27'),JSON[_0x3882('0x28')](_0x509058));if(_0x509058[_0x3882('0x29')]){if(_0x509058[_0x3882('0x29')][_0x3882('0x2a')]===0x1f4){logger[_0x3882('0x29')](_0x3882('0x2b'),_0xf32c3f,_0x509058[_0x3882('0x29')][_0x3882('0x2c')]);return _0x1d0eb6(_0x509058[_0x3882('0x29')]['message']);}logger['error'](_0x3882('0x2b'),_0xf32c3f,_0x509058[_0x3882('0x29')][_0x3882('0x2c')]);return _0x5db9ee(_0x509058[_0x3882('0x29')]['message']);}else{logger['info'](_0x3882('0x2b'),_0xf32c3f,_0x3882('0x27'));_0x5db9ee(_0x509058['result'][_0x3882('0x2c')]);}})['catch'](function(_0x5db087){logger['error'](_0x3882('0x2b'),_0xf32c3f,_0x5db087);_0x1d0eb6(_0x5db087);});});}function respondWithStatusCode(_0x39c461,_0x42f644){_0x42f644=_0x42f644||0xcc;return function(_0x2f1dad){if(_0x2f1dad){return _0x39c461['sendStatus'](_0x42f644);}return _0x39c461[_0x3882('0x2d')](_0x42f644)[_0x3882('0x2e')]();};}function respondWithResult(_0x346af8,_0x17490d){_0x17490d=_0x17490d||0xc8;return function(_0x3c4650){if(_0x3c4650){return _0x346af8[_0x3882('0x2d')](_0x17490d)[_0x3882('0x2f')](_0x3c4650);}};}function respondWithFilteredResult(_0x194b3f,_0x5bd31f){return function(_0x4c08e2){if(_0x4c08e2){var _0x3998f7=typeof _0x5bd31f[_0x3882('0x30')]===_0x3882('0x31')&&typeof _0x5bd31f[_0x3882('0x32')]==='undefined';var _0xaa237e=_0x4c08e2[_0x3882('0x33')];var _0x2f348c=_0x3998f7?0x0:_0x5bd31f[_0x3882('0x30')];var _0x4e63c4=_0x3998f7?_0x4c08e2['count']:_0x5bd31f[_0x3882('0x30')]+_0x5bd31f[_0x3882('0x32')];var _0x3121e6;if(_0x4e63c4>=_0xaa237e){_0x4e63c4=_0xaa237e;_0x3121e6=0xc8;}else{_0x3121e6=0xce;}_0x194b3f[_0x3882('0x2d')](_0x3121e6);return _0x194b3f['set'](_0x3882('0x34'),_0x2f348c+'-'+_0x4e63c4+'/'+_0xaa237e)['json'](_0x4c08e2);}return null;};}function patchUpdates(_0x296385){return function(_0x2528d4){try{jsonpatch[_0x3882('0x35')](_0x2528d4,_0x296385,!![]);}catch(_0x12408b){return BPromise[_0x3882('0x36')](_0x12408b);}return _0x2528d4[_0x3882('0x37')]();};}function saveUpdates(_0x11788b,_0x404597){return function(_0x19ddfc){if(_0x19ddfc){return _0x19ddfc[_0x3882('0x38')](_0x11788b)[_0x3882('0x23')](function(_0x52fcb0){return _0x52fcb0;});}return null;};}function removeEntity(_0x1ae120,_0x9ddb78){return function(_0x56051c){if(_0x56051c){return _0x56051c[_0x3882('0x39')]()[_0x3882('0x23')](function(){var _0x421932=_0x56051c[_0x3882('0x3a')]({'plain':!![]});var _0x433bd4='WhatsappAccounts';return db[_0x3882('0x3b')][_0x3882('0x39')]({'where':{'type':_0x433bd4,'resourceId':_0x421932['id']}})[_0x3882('0x23')](function(){return _0x56051c;});})[_0x3882('0x23')](function(){_0x1ae120[_0x3882('0x2d')](0xcc)[_0x3882('0x2e')]();});}};}function handleEntityNotFound(_0x4d3320,_0x38ce97){return function(_0x58960a){if(!_0x58960a){_0x4d3320[_0x3882('0x3c')](0x194);}return _0x58960a;};}function handleError(_0x532c8e,_0x1a2385){_0x1a2385=_0x1a2385||0x1f4;return function(_0x3f4dad){logger[_0x3882('0x29')](_0x3f4dad[_0x3882('0x3d')]);if(_0x3f4dad[_0x3882('0x3e')]){delete _0x3f4dad[_0x3882('0x3e')];}_0x532c8e[_0x3882('0x2d')](_0x1a2385)[_0x3882('0x3f')](_0x3f4dad);};}exports[_0x3882('0x40')]=function(_0x55e203,_0x3d0a87){var _0x1c7180={'include':[{'model':db[_0x3882('0x41')],'as':'mandatoryDispositionPause'}]},_0x407680={},_0x2640b7={'count':0x0,'rows':[]};var _0x5adcfd=_['map'](db['WhatsappAccount'][_0x3882('0x42')],function(_0xf91330){return{'name':_0xf91330['fieldName'],'type':_0xf91330['type'][_0x3882('0x43')]};});_0x407680[_0x3882('0x44')]=_['map'](_0x5adcfd,_0x3882('0x3e'));_0x407680[_0x3882('0x45')]=_[_0x3882('0x46')](_0x55e203['query']);_0x407680[_0x3882('0x47')]=_[_0x3882('0x48')](_0x407680[_0x3882('0x44')],_0x407680[_0x3882('0x45')]);_0x1c7180[_0x3882('0x49')]=_['intersection'](_0x407680[_0x3882('0x44')],qs[_0x3882('0x4a')](_0x55e203[_0x3882('0x45')][_0x3882('0x4a')]));_0x1c7180[_0x3882('0x49')]=_0x1c7180[_0x3882('0x49')]['length']?_0x1c7180[_0x3882('0x49')]:_0x407680['model'];if(!_0x55e203[_0x3882('0x45')][_0x3882('0x4b')]('nolimit')){_0x1c7180[_0x3882('0x32')]=qs[_0x3882('0x32')](_0x55e203[_0x3882('0x45')]['limit']);_0x1c7180[_0x3882('0x30')]=qs[_0x3882('0x30')](_0x55e203['query'][_0x3882('0x30')]);}_0x1c7180[_0x3882('0x4c')]=qs[_0x3882('0x4d')](_0x55e203[_0x3882('0x45')][_0x3882('0x4d')]);_0x1c7180[_0x3882('0x4e')]=qs[_0x3882('0x47')](_['pick'](_0x55e203['query'],_0x407680[_0x3882('0x47')]),_0x5adcfd);if(_0x55e203[_0x3882('0x45')][_0x3882('0x4f')]){_0x1c7180[_0x3882('0x4e')]=_[_0x3882('0x50')](_0x1c7180[_0x3882('0x4e')],{'$or':_['map'](_0x5adcfd,function(_0x96f8f1){if(_0x96f8f1[_0x3882('0x51')]!==_0x3882('0x52')){var _0x5e0613={};_0x5e0613[_0x96f8f1[_0x3882('0x3e')]]={'$like':'%'+_0x55e203[_0x3882('0x45')][_0x3882('0x4f')]+'%'};return _0x5e0613;}})});}_0x1c7180=_[_0x3882('0x50')]({},_0x1c7180,_0x55e203[_0x3882('0x53')]);var _0x37bc83={'where':_0x1c7180['where']};return db[_0x3882('0x54')][_0x3882('0x33')](_0x37bc83)[_0x3882('0x23')](function(_0x1f9689){_0x2640b7[_0x3882('0x33')]=_0x1f9689;if(_0x55e203[_0x3882('0x45')]['includeAll']){_0x1c7180[_0x3882('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x3882('0x56')](_0x1c7180);})[_0x3882('0x23')](function(_0x2174c8){_0x2640b7['rows']=_0x2174c8;return _0x2640b7;})[_0x3882('0x23')](respondWithFilteredResult(_0x3d0a87,_0x1c7180))[_0x3882('0x57')](handleError(_0x3d0a87,null));};exports[_0x3882('0x58')]=function(_0x328dce,_0x324962){var _0x51a77d={'raw':![],'where':{'id':_0x328dce[_0x3882('0x59')]['id']},'include':[{'model':db[_0x3882('0x41')],'as':'mandatoryDispositionPause'}]},_0x19f0d1={};_0x19f0d1[_0x3882('0x44')]=_[_0x3882('0x46')](db[_0x3882('0x54')][_0x3882('0x42')]);_0x19f0d1['query']=_['keys'](_0x328dce[_0x3882('0x45')]);_0x19f0d1[_0x3882('0x47')]=_[_0x3882('0x48')](_0x19f0d1['model'],_0x19f0d1['query']);_0x51a77d[_0x3882('0x49')]=_[_0x3882('0x48')](_0x19f0d1[_0x3882('0x44')],qs['fields'](_0x328dce[_0x3882('0x45')]['fields']));_0x51a77d[_0x3882('0x49')]=_0x51a77d[_0x3882('0x49')][_0x3882('0x5a')]?_0x51a77d['attributes']:_0x19f0d1[_0x3882('0x44')];if(_0x328dce[_0x3882('0x45')][_0x3882('0x5b')]){_0x51a77d[_0x3882('0x55')]=[{'all':!![]}];}_0x51a77d=_['merge']({},_0x51a77d,_0x328dce['options']);return db[_0x3882('0x54')][_0x3882('0x5c')](_0x51a77d)[_0x3882('0x23')](handleEntityNotFound(_0x324962,null))['then'](respondWithResult(_0x324962,null))[_0x3882('0x57')](handleError(_0x324962,null));};exports[_0x3882('0x5d')]=function(_0x3dc03a,_0x4bfec4){return db['WhatsappAccount'][_0x3882('0x5d')](_0x3dc03a[_0x3882('0x5e')],{})[_0x3882('0x23')](function(_0x5a8128){var _0x42f04a=_0x3dc03a['user'][_0x3882('0x3a')]({'plain':!![]});if(!_0x42f04a)throw new Error(_0x3882('0x5f'));if(_0x42f04a[_0x3882('0x60')]===_0x3882('0x61')){var _0x4e11e5=_0x5a8128[_0x3882('0x3a')]({'plain':!![]});var _0x18f90d=_0x3882('0x62');return db[_0x3882('0x63')][_0x3882('0x5c')]({'where':{'name':_0x18f90d,'userProfileId':_0x42f04a[_0x3882('0x64')]},'raw':!![]})[_0x3882('0x23')](function(_0x5a2250){if(_0x5a2250&&_0x5a2250[_0x3882('0x65')]===0x0){return db[_0x3882('0x3b')]['create']({'name':_0x4e11e5['name'],'resourceId':_0x4e11e5['id'],'type':_0x5a2250['name'],'sectionId':_0x5a2250['id']},{})[_0x3882('0x23')](function(){return _0x5a8128;});}else{return _0x5a8128;}})[_0x3882('0x57')](function(_0x41fca6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41fca6);throw _0x41fca6;});}return _0x5a8128;})[_0x3882('0x23')](respondWithResult(_0x4bfec4,0xc9))[_0x3882('0x57')](handleError(_0x4bfec4,null));};exports[_0x3882('0x38')]=function(_0x5a79e1,_0x5291b5){if(_0x5a79e1['body']['id']){delete _0x5a79e1[_0x3882('0x5e')]['id'];}return db['WhatsappAccount'][_0x3882('0x5c')]({'where':{'id':_0x5a79e1[_0x3882('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x3882('0x66')}]})[_0x3882('0x23')](handleEntityNotFound(_0x5291b5,null))[_0x3882('0x23')](saveUpdates(_0x5a79e1['body'],null))['then'](respondWithResult(_0x5291b5,null))['catch'](handleError(_0x5291b5,null));};exports[_0x3882('0x39')]=function(_0x281d63,_0x4381d2){return db[_0x3882('0x54')][_0x3882('0x5c')]({'where':{'id':_0x281d63[_0x3882('0x59')]['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x4381d2,null))[_0x3882('0x23')](removeEntity(_0x4381d2,null))[_0x3882('0x57')](handleError(_0x4381d2,null));};exports[_0x3882('0x67')]=function(_0xbd0196,_0x238f83){return db['WhatsappAccount']['describe']()[_0x3882('0x23')](respondWithResult(_0x238f83,null))[_0x3882('0x57')](handleError(_0x238f83,null));};exports[_0x3882('0x68')]=function(_0x4468b6,_0x2fdfb1,_0x36b2d3){if(_0x4468b6[_0x3882('0x5e')]['id']){delete _0x4468b6[_0x3882('0x5e')]['id'];}return db[_0x3882('0x54')]['find']({'where':{'id':_0x4468b6['params']['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x2fdfb1,null))[_0x3882('0x23')](function(_0x3c8bb8){if(_0x3c8bb8){_0x4468b6[_0x3882('0x5e')][_0x3882('0x69')]=_0x3c8bb8['id'];return db[_0x3882('0x6a')][_0x3882('0x5d')](_0x4468b6[_0x3882('0x5e')]);}})[_0x3882('0x23')](respondWithResult(_0x2fdfb1,null))[_0x3882('0x57')](handleError(_0x2fdfb1,null));};exports[_0x3882('0x6b')]=function(_0x4fcdfb,_0x4a34c3,_0xbbd1bf){var _0x407938={'raw':![],'where':{}};var _0x459b18={};var _0x1de9eb={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3882('0x6c')]({'where':{'id':_0x4fcdfb[_0x3882('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a34c3,null))[_0x3882('0x23')](function(_0x43bba7){if(_0x43bba7){_0x459b18[_0x3882('0x44')]=_[_0x3882('0x46')](db[_0x3882('0x6a')][_0x3882('0x42')]);_0x459b18[_0x3882('0x45')]=_[_0x3882('0x46')](_0x4fcdfb[_0x3882('0x45')]);_0x459b18[_0x3882('0x47')]=_[_0x3882('0x48')](_0x459b18[_0x3882('0x44')],_0x459b18[_0x3882('0x45')]);_0x407938[_0x3882('0x49')]=_[_0x3882('0x48')](_0x459b18[_0x3882('0x44')],qs[_0x3882('0x4a')](_0x4fcdfb[_0x3882('0x45')][_0x3882('0x4a')]));_0x407938['attributes']=_0x407938[_0x3882('0x49')][_0x3882('0x5a')]?_0x407938[_0x3882('0x49')]:_0x459b18[_0x3882('0x44')];if(!_0x4fcdfb[_0x3882('0x45')]['hasOwnProperty'](_0x3882('0x6d'))){_0x407938[_0x3882('0x32')]=qs[_0x3882('0x32')](_0x4fcdfb['query'][_0x3882('0x32')]);_0x407938[_0x3882('0x30')]=qs['offset'](_0x4fcdfb[_0x3882('0x45')][_0x3882('0x30')]);}_0x407938['order']=qs[_0x3882('0x4d')](_0x4fcdfb[_0x3882('0x45')][_0x3882('0x4d')]);_0x407938[_0x3882('0x4e')]=qs['filters'](_[_0x3882('0x6e')](_0x4fcdfb['query'],_0x459b18['filters']));_0x407938['where'][_0x3882('0x69')]=_0x43bba7['id'];if(_0x4fcdfb[_0x3882('0x45')][_0x3882('0x4f')]){_0x407938[_0x3882('0x4e')]=_[_0x3882('0x50')](_0x407938[_0x3882('0x4e')],{'$or':_[_0x3882('0x6f')](_0x407938['attributes'],function(_0x5cd29a){var _0x5f2239={};_0x5f2239[_0x5cd29a]={'$like':'%'+_0x4fcdfb['query'][_0x3882('0x4f')]+'%'};return _0x5f2239;})});}_0x407938=_['merge']({},_0x407938,_0x4fcdfb['options']);return db[_0x3882('0x6a')][_0x3882('0x33')]({'where':_0x407938[_0x3882('0x4e')]})['then'](function(_0x3018ff){_0x1de9eb[_0x3882('0x33')]=_0x3018ff;if(_0x4fcdfb[_0x3882('0x45')]['includeAll']){_0x407938['include']=[{'all':!![]}];}return db[_0x3882('0x6a')][_0x3882('0x56')](_0x407938);})[_0x3882('0x23')](function(_0x331875){_0x1de9eb['rows']=_0x331875;return _0x1de9eb;});}})[_0x3882('0x23')](respondWithFilteredResult(_0x4a34c3,_0x407938))[_0x3882('0x57')](handleError(_0x4a34c3,null));};exports['removeDispositions']=function(_0x302a27,_0x501855,_0x22e645){return db[_0x3882('0x54')][_0x3882('0x5c')]({'where':{'id':_0x302a27[_0x3882('0x59')]['id']}})['then'](handleEntityNotFound(_0x501855,null))[_0x3882('0x23')](function(_0xad1b6f){if(_0xad1b6f){return _0xad1b6f[_0x3882('0x70')](_0x302a27[_0x3882('0x45')]['ids']);}})[_0x3882('0x23')](respondWithStatusCode(_0x501855,null))[_0x3882('0x57')](handleError(_0x501855,null));};exports[_0x3882('0x71')]=function(_0x5594f9,_0x3e80db,_0x5bd188){if(_0x5594f9[_0x3882('0x5e')]['id']){delete _0x5594f9[_0x3882('0x5e')]['id'];}return db[_0x3882('0x54')][_0x3882('0x5c')]({'where':{'id':_0x5594f9[_0x3882('0x59')]['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x3e80db,null))[_0x3882('0x23')](function(_0x3ec4b9){if(_0x3ec4b9){_0x5594f9[_0x3882('0x5e')][_0x3882('0x69')]=_0x3ec4b9['id'];return db[_0x3882('0x72')][_0x3882('0x5d')](_0x5594f9[_0x3882('0x5e')]);}})[_0x3882('0x23')](respondWithResult(_0x3e80db,null))[_0x3882('0x57')](handleError(_0x3e80db,null));};exports['getAnswers']=function(_0x1c62ae,_0x4ef4cf,_0x3609b2){var _0x48824e={'raw':![],'where':{}};var _0x283de4={};var _0x114e43={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3882('0x6c')]({'where':{'id':_0x1c62ae[_0x3882('0x59')]['id']}})['then'](handleEntityNotFound(_0x4ef4cf,null))[_0x3882('0x23')](function(_0x181891){if(_0x181891){_0x283de4[_0x3882('0x44')]=_['keys'](db[_0x3882('0x72')][_0x3882('0x42')]);_0x283de4[_0x3882('0x45')]=_[_0x3882('0x46')](_0x1c62ae[_0x3882('0x45')]);_0x283de4[_0x3882('0x47')]=_[_0x3882('0x48')](_0x283de4[_0x3882('0x44')],_0x283de4['query']);_0x48824e['attributes']=_[_0x3882('0x48')](_0x283de4[_0x3882('0x44')],qs[_0x3882('0x4a')](_0x1c62ae[_0x3882('0x45')]['fields']));_0x48824e['attributes']=_0x48824e[_0x3882('0x49')][_0x3882('0x5a')]?_0x48824e[_0x3882('0x49')]:_0x283de4[_0x3882('0x44')];if(!_0x1c62ae[_0x3882('0x45')][_0x3882('0x4b')](_0x3882('0x6d'))){_0x48824e[_0x3882('0x32')]=qs[_0x3882('0x32')](_0x1c62ae[_0x3882('0x45')]['limit']);_0x48824e[_0x3882('0x30')]=qs[_0x3882('0x30')](_0x1c62ae[_0x3882('0x45')][_0x3882('0x30')]);}_0x48824e[_0x3882('0x4c')]=qs[_0x3882('0x4d')](_0x1c62ae[_0x3882('0x45')][_0x3882('0x4d')]);_0x48824e['where']=qs[_0x3882('0x47')](_[_0x3882('0x6e')](_0x1c62ae['query'],_0x283de4[_0x3882('0x47')]));_0x48824e[_0x3882('0x4e')]['WhatsappAccountId']=_0x181891['id'];if(_0x1c62ae[_0x3882('0x45')][_0x3882('0x4f')]){_0x48824e[_0x3882('0x4e')]=_[_0x3882('0x50')](_0x48824e[_0x3882('0x4e')],{'$or':_[_0x3882('0x6f')](_0x48824e['attributes'],function(_0x239a08){var _0x1e0097={};_0x1e0097[_0x239a08]={'$like':'%'+_0x1c62ae['query']['filter']+'%'};return _0x1e0097;})});}_0x48824e=_[_0x3882('0x50')]({},_0x48824e,_0x1c62ae[_0x3882('0x53')]);return db[_0x3882('0x72')][_0x3882('0x33')]({'where':_0x48824e[_0x3882('0x4e')]})['then'](function(_0xd3d84c){_0x114e43[_0x3882('0x33')]=_0xd3d84c;if(_0x1c62ae['query']['includeAll']){_0x48824e[_0x3882('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x48824e);})[_0x3882('0x23')](function(_0xcd274d){_0x114e43[_0x3882('0x73')]=_0xcd274d;return _0x114e43;});}})[_0x3882('0x23')](respondWithFilteredResult(_0x4ef4cf,_0x48824e))['catch'](handleError(_0x4ef4cf,null));};exports['removeAnswers']=function(_0x24817c,_0x5bcfb7,_0x40f081){return db['WhatsappAccount'][_0x3882('0x5c')]({'where':{'id':_0x24817c[_0x3882('0x59')]['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x5bcfb7,null))[_0x3882('0x23')](function(_0x483163){if(_0x483163){return _0x483163[_0x3882('0x74')](_0x24817c[_0x3882('0x45')][_0x3882('0x75')]);}})[_0x3882('0x23')](respondWithStatusCode(_0x5bcfb7,null))[_0x3882('0x57')](handleError(_0x5bcfb7,null));};exports[_0x3882('0x76')]=function(_0x521272,_0x71a820,_0x302224){return db[_0x3882('0x54')][_0x3882('0x5c')]({'where':{'id':_0x521272['params']['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x71a820,null))[_0x3882('0x23')](function(_0x4f7165){if(_0x4f7165){return _0x4f7165[_0x3882('0x76')](_0x521272['body'][_0x3882('0x75')],_['omit'](_0x521272[_0x3882('0x5e')],[_0x3882('0x75'),'id'])||{})['spread'](function(_0x103eef){for(var _0x544f18=0x0;_0x544f18<_0x521272[_0x3882('0x5e')][_0x3882('0x75')][_0x3882('0x5a')];_0x544f18+=0x1){socket[_0x3882('0x77')](_0x3882('0x78'),{'UserId':Number(_0x521272['body'][_0x3882('0x75')][_0x544f18]),'WhatsappAccountId':Number(_0x521272[_0x3882('0x59')]['id'])});}return _0x103eef;});}})[_0x3882('0x23')](respondWithResult(_0x71a820,null))[_0x3882('0x57')](handleError(_0x71a820,null));};exports['removeAgents']=function(_0x18d74b,_0x2fc662,_0x39352d){return db[_0x3882('0x54')][_0x3882('0x5c')]({'where':{'id':_0x18d74b[_0x3882('0x59')]['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x2fc662,null))[_0x3882('0x23')](function(_0x42545e){if(_0x42545e){return _0x42545e[_0x3882('0x79')](_0x18d74b[_0x3882('0x45')][_0x3882('0x75')])['then'](function(){if(_[_0x3882('0x7a')](_0x18d74b[_0x3882('0x45')][_0x3882('0x75')])){for(var _0x584f99=0x0;_0x584f99<_0x18d74b[_0x3882('0x45')]['ids'][_0x3882('0x5a')];_0x584f99+=0x1){socket[_0x3882('0x77')](_0x3882('0x7b'),{'UserId':Number(_0x18d74b[_0x3882('0x45')][_0x3882('0x75')][_0x584f99]),'WhatsappAccountId':Number(_0x18d74b[_0x3882('0x59')]['id'])});}}else{socket[_0x3882('0x77')](_0x3882('0x7b'),{'UserId':Number(_0x18d74b[_0x3882('0x45')][_0x3882('0x75')]),'WhatsappAccountId':Number(_0x18d74b[_0x3882('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fc662,null))[_0x3882('0x57')](handleError(_0x2fc662,null));};exports['getAgents']=function(_0x48c49d,_0x4de868,_0x54ee27){var _0x48fd44={};var _0x32790c={};var _0x4a0b64;var _0x670223;return db[_0x3882('0x54')][_0x3882('0x6c')]({'where':{'id':_0x48c49d[_0x3882('0x59')]['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x4de868,null))[_0x3882('0x23')](function(_0x3c99d4){if(_0x3c99d4){_0x4a0b64=_0x3c99d4;_0x32790c[_0x3882('0x44')]=_[_0x3882('0x46')](db['User'][_0x3882('0x42')]);_0x32790c[_0x3882('0x45')]=_['keys'](_0x48c49d[_0x3882('0x45')]);_0x32790c[_0x3882('0x47')]=_[_0x3882('0x48')](_0x32790c[_0x3882('0x44')],_0x32790c['query']);_0x48fd44[_0x3882('0x49')]=_[_0x3882('0x48')](_0x32790c[_0x3882('0x44')],qs[_0x3882('0x4a')](_0x48c49d['query'][_0x3882('0x4a')]));_0x48fd44[_0x3882('0x49')]=_0x48fd44[_0x3882('0x49')]['length']?_0x48fd44['attributes']:_0x32790c['model'];_0x48fd44[_0x3882('0x4c')]=qs[_0x3882('0x4d')](_0x48c49d[_0x3882('0x45')]['sort']);_0x48fd44[_0x3882('0x4e')]=qs[_0x3882('0x47')](_[_0x3882('0x6e')](_0x48c49d[_0x3882('0x45')],_0x32790c[_0x3882('0x47')]));if(_0x48c49d['query'][_0x3882('0x4f')]){_0x48fd44[_0x3882('0x4e')]=_[_0x3882('0x50')](_0x48fd44[_0x3882('0x4e')],{'$or':_[_0x3882('0x6f')](_0x48fd44[_0x3882('0x49')],function(_0x3510fb){var _0x17979d={};_0x17979d[_0x3510fb]={'$like':'%'+_0x48c49d[_0x3882('0x45')]['filter']+'%'};return _0x17979d;})});}_0x48fd44=_[_0x3882('0x50')]({},_0x48fd44,_0x48c49d[_0x3882('0x53')]);return _0x4a0b64[_0x3882('0x7c')](_0x48fd44);}})[_0x3882('0x23')](function(_0x42a0d4){if(_0x42a0d4){_0x670223=_0x42a0d4[_0x3882('0x5a')];if(!_0x48c49d[_0x3882('0x45')][_0x3882('0x4b')]('nolimit')){_0x48fd44['limit']=qs['limit'](_0x48c49d['query']['limit']);_0x48fd44[_0x3882('0x30')]=qs[_0x3882('0x30')](_0x48c49d[_0x3882('0x45')][_0x3882('0x30')]);}return _0x4a0b64[_0x3882('0x7c')](_0x48fd44);}})[_0x3882('0x23')](function(_0x2711e3){if(_0x2711e3){return _0x2711e3?{'count':_0x670223,'rows':_0x2711e3}:null;}})['then'](respondWithResult(_0x4de868,null))[_0x3882('0x57')](handleError(_0x4de868,null));};exports[_0x3882('0x7d')]=function(_0x54f264,_0x23ba65){var _0xe3a003=_0x54f264[_0x3882('0x59')]['id'];var _0xaaa5c1=_0x54f264[_0x3882('0x5e')];var _0x405301=0xc8;var _0xc7b575=null;return db[_0x3882('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x3882('0x7f')][_0x3882('0x80')][_0x3882('0x81')]},function(_0x339441){return db['WhatsappAccount']['findOne']({'where':{'id':_0xe3a003},'transaction':_0x339441})[_0x3882('0x23')](function(_0x4df4aa){if(_0x4df4aa){return db['WhatsappApplication'][_0x3882('0x39')]({'where':{'WhatsappAccountId':_0xe3a003},'transaction':_0x339441})[_0x3882('0x23')](function(){var _0x274838=_['map'](_0xaaa5c1,function(_0xf18a4){_0xf18a4[_0x3882('0x69')]=_0xe3a003;return _0xf18a4;});return db[_0x3882('0x82')]['bulkCreate'](_0x274838,{'transaction':_0x339441});});}else{_0x405301=0x194;_0xc7b575=[];}});})[_0x3882('0x23')](function(){if(_0x405301!==0x194){return db[_0x3882('0x82')][_0x3882('0x83')]({'where':{'WhatsappAccountId':_0xe3a003},'order':'priority'})['then'](function(_0x36d259){_0xc7b575=_0x36d259;});}})[_0x3882('0x57')](function(_0x13e46b){_0x405301=0x1f4;logger[_0x3882('0x29')](_0x13e46b['stack']);if(_0x13e46b[_0x3882('0x3e')]){delete _0x13e46b[_0x3882('0x3e')];}_0xc7b575=_0x13e46b;})[_0x3882('0x84')](function(){if(_0xc7b575===null){_0x23ba65[_0x3882('0x3c')](_0x405301);}else{if(_0x405301===0x1f4){_0x23ba65[_0x3882('0x2d')](_0x405301)[_0x3882('0x3f')](_0xc7b575);}else{_0x23ba65[_0x3882('0x2d')](_0x405301)['json'](_0xc7b575);}}});};exports[_0x3882('0x85')]=function(_0x39a6b5,_0x54dbc2,_0x144816){var _0x6d2bdc={};var _0xfbf3be={};var _0x29a71e;var _0x467d33;return db[_0x3882('0x54')]['findOne']({'where':{'id':_0x39a6b5['params']['id']}})[_0x3882('0x23')](handleEntityNotFound(_0x54dbc2,null))[_0x3882('0x23')](function(_0x549d10){if(_0x549d10){_0x29a71e=_0x549d10;_0xfbf3be[_0x3882('0x44')]=_[_0x3882('0x46')](db[_0x3882('0x82')][_0x3882('0x42')]);_0xfbf3be[_0x3882('0x45')]=_[_0x3882('0x46')](_0x39a6b5[_0x3882('0x45')]);_0xfbf3be[_0x3882('0x47')]=_[_0x3882('0x48')](_0xfbf3be[_0x3882('0x44')],_0xfbf3be['query']);_0x6d2bdc['attributes']=_[_0x3882('0x48')](_0xfbf3be[_0x3882('0x44')],qs[_0x3882('0x4a')](_0x39a6b5[_0x3882('0x45')][_0x3882('0x4a')]));_0x6d2bdc['attributes']=_0x6d2bdc[_0x3882('0x49')][_0x3882('0x5a')]?_0x6d2bdc['attributes']:_0xfbf3be[_0x3882('0x44')];_0x6d2bdc[_0x3882('0x4c')]=qs[_0x3882('0x4d')](_0x39a6b5['query'][_0x3882('0x4d')]);_0x6d2bdc[_0x3882('0x4e')]=qs[_0x3882('0x47')](_[_0x3882('0x6e')](_0x39a6b5[_0x3882('0x45')],_0xfbf3be[_0x3882('0x47')]));if(_0x39a6b5[_0x3882('0x45')][_0x3882('0x4f')]){_0x6d2bdc['where']=_['merge'](_0x6d2bdc['where'],{'$or':_[_0x3882('0x6f')](_0x6d2bdc['attributes'],function(_0x3dfffd){var _0x2d4039={};_0x2d4039[_0x3dfffd]={'$like':'%'+_0x39a6b5[_0x3882('0x45')]['filter']+'%'};return _0x2d4039;})});}_0x6d2bdc=_[_0x3882('0x50')]({},_0x6d2bdc,_0x39a6b5['options']);return _0x29a71e[_0x3882('0x85')](_0x6d2bdc);}})[_0x3882('0x23')](function(_0x1df257){if(_0x1df257){_0x467d33=_0x1df257[_0x3882('0x5a')];if(!_0x39a6b5['query'][_0x3882('0x4b')](_0x3882('0x6d'))){_0x6d2bdc[_0x3882('0x32')]=qs['limit'](_0x39a6b5[_0x3882('0x45')][_0x3882('0x32')]);_0x6d2bdc['offset']=qs[_0x3882('0x30')](_0x39a6b5[_0x3882('0x45')][_0x3882('0x30')]);}return _0x29a71e[_0x3882('0x85')](_0x6d2bdc);}})[_0x3882('0x23')](function(_0x515b4a){if(_0x515b4a){return _0x515b4a?{'count':_0x467d33,'rows':_0x515b4a}:null;}})[_0x3882('0x23')](respondWithResult(_0x54dbc2,null))[_0x3882('0x57')](handleError(_0x54dbc2,null));};exports['notify']=function(_0x437938,_0x596cae,_0x1fdb72){var _0x9d228b={'channel':_0x3882('0x86')};var _0xb54688=[];var _0x328862=[];var _0x114d4f={};return db[_0x3882('0x54')]['find']({'where':{'id':_0x437938[_0x3882('0x59')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3882('0x87')}]})[_0x3882('0x23')](handleEntityNotFound(_0x596cae,null))[_0x3882('0x23')](function(_0x18af39){_0x9d228b[_0x3882('0x88')]=_0x18af39;if(_0x9d228b[_0x3882('0x88')]&&_0x9d228b[_0x3882('0x88')]['type']==='sinch'&&_0x437938[_0x3882('0x5e')][_0x3882('0x89')]){if(_0x437938[_0x3882('0x5e')][_0x3882('0x89')][_0x3882('0x5a')]===0x0)return;if(_0x437938[_0x3882('0x5e')][_0x3882('0x89')][0x0][_0x3882('0x8a')]!==_0x3882('0x8b'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x437938[_0x3882('0x5e')][_0x3882('0x89')][0x0][_0x3882('0x8c')]},{'where':{'messageId':_0x437938['body']['statuses'][0x0][_0x3882('0x8d')]},'individualHooks':!![]})[_0x3882('0x23')](function(_0x3a0faf){return _0x596cae[_0x3882('0x2d')](0xc8)[_0x3882('0x2f')](_0x3a0faf);});}_0x9d228b[_0x3882('0x8e')]=_[_0x3882('0x8f')](_0x18af39['Applications'],['priority'],[_0x3882('0x90')]);if(_0x9d228b['account'][_0x3882('0x87')]){delete _0x9d228b[_0x3882('0x88')][_0x3882('0x87')];}return db[_0x3882('0x91')][_0x3882('0x67')]()[_0x3882('0x23')](function(_0x27c5a6){if(!_0x27c5a6){throw new db[(_0x3882('0x92'))][(_0x3882('0x93'))](_0x3882('0x94'));}_0xb54688=_['difference'](_[_0x3882('0x46')](_0x27c5a6),[_0x3882('0x95'),_0x3882('0x96')]);_0x328862=_['difference'](_[_0x3882('0x46')](_0x27c5a6),['createdAt',_0x3882('0x96'),_0x3882('0x97'),_0x3882('0x98')]);_0x9d228b[_0x3882('0x5e')]={'mapKey':'mobile'};if(_0x9d228b[_0x3882('0x88')]&&_0x9d228b['account'][_0x3882('0x51')]===_0x3882('0x99')){_0x9d228b['body'][_0x3882('0x9a')]=_0x437938[_0x3882('0x5e')][_0x3882('0x9b')][_0x3882('0x9c')](_0x3882('0x9d'),'');_0x9d228b[_0x3882('0x5e')][_0x3882('0x5e')]=_0x437938[_0x3882('0x5e')][_0x3882('0x9e')];_0x9d228b[_0x3882('0x5e')]['messageId']=_0x437938[_0x3882('0x5e')][_0x3882('0x9f')];}if(_0x9d228b[_0x3882('0x88')]&&_0x9d228b[_0x3882('0x88')][_0x3882('0x51')]===_0x3882('0xa0')){_0x9d228b[_0x3882('0x5e')][_0x3882('0x9a')]=_0x437938['body'][_0x3882('0xa1')][0x0][_0x3882('0x9a')];_0x9d228b[_0x3882('0x5e')][_0x3882('0x5e')]=_0x437938[_0x3882('0x5e')][_0x3882('0xa1')][0x0]['message']['body'];_0x9d228b[_0x3882('0x5e')][_0x3882('0xa2')]=_0x437938[_0x3882('0x5e')][_0x3882('0xa1')][0x0][_0x3882('0x8d')];}if(_0x9d228b[_0x3882('0x5e')]['id']){delete _0x9d228b[_0x3882('0x5e')]['id'];}if(_[_0x3882('0xa3')](_0x9d228b[_0x3882('0x5e')]['from'])){throw new db[(_0x3882('0x92'))][(_0x3882('0x93'))](_0x3882('0xa4'));}if(_[_0x3882('0xa3')](_0x9d228b[_0x3882('0x5e')][_0x3882('0x5e')])||_0x9d228b[_0x3882('0x5e')][_0x3882('0x5e')]===''){throw new db[(_0x3882('0x92'))][(_0x3882('0x93'))](_0x3882('0xa5'));}if(_['isNil'](_0x9d228b[_0x3882('0x5e')][_0x3882('0xa6')])){throw new db[(_0x3882('0x92'))][(_0x3882('0x93'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x328862);}if(!_['includes'](_0x328862,_0x9d228b['body'][_0x3882('0xa6')])){throw new db[(_0x3882('0x92'))]['ValidationError'](_0x3882('0xa7')+_0x328862);}_0x114d4f[_0x9d228b[_0x3882('0x5e')][_0x3882('0xa6')]]=_0x9d228b[_0x3882('0x5e')][_0x3882('0x9a')];return db[_0x3882('0xa8')][_0x3882('0x5c')]({'where':{'id':_0x9d228b[_0x3882('0x88')]['ListId']},'include':[{'model':db[_0x3882('0x91')],'as':_0x3882('0xa9'),'where':_0x114d4f,'limit':0x1,'order':[['updatedAt',_0x3882('0xaa')]]}]});})[_0x3882('0x23')](handleEntityNotFound(_0x596cae,null))[_0x3882('0x23')](function(_0x1a398c){if(_0x1a398c){_0x9d228b[_0x3882('0xab')]=_[_0x3882('0xac')](_0x1a398c,[_0x3882('0xa9')]);if(_0x1a398c['Contacts'][_0x3882('0x5a')]){return _0x1a398c[_0x3882('0xa9')][0x0];}var _0x4a2469=_[_0x3882('0x1b')](_0x9d228b[_0x3882('0x5e')],{'firstName':_0x9d228b['body'][_0x3882('0x9a')],'ListId':_0x1a398c['id']});_0x4a2469[_0x9d228b[_0x3882('0x5e')]['mapKey']]=_0x9d228b[_0x3882('0x5e')][_0x3882('0x9a')];return db[_0x3882('0x91')][_0x3882('0x5d')](_0x4a2469,{'fields':_0xb54688,'raw':!![]});}})[_0x3882('0x23')](handleEntityNotFound(_0x596cae,null))[_0x3882('0x23')](function(_0x8bad2a){if(_0x8bad2a){_0x9d228b[_0x3882('0xad')]=_0x8bad2a;var _0x3a11cd={'ContactId':_0x8bad2a['id'],'phone':_0x9d228b[_0x3882('0x5e')][_0x3882('0x9a')],'WhatsappAccountId':_0x437938[_0x3882('0x59')]['id']};var _0x18270e={'ContactId':_0x8bad2a['id'],'WhatsappAccountId':_0x437938[_0x3882('0x59')]['id'],'closed':![]};return db[_0x3882('0xae')][_0x3882('0x5c')]({'where':_0x18270e})[_0x3882('0x23')](function(_0x35ef8e){if(_0x35ef8e){return[_0x35ef8e,![]];}return db[_0x3882('0xae')][_0x3882('0x5d')](_0x3a11cd)[_0x3882('0x23')](function(_0x4ad315){return[_0x4ad315,!![]];});});}})[_0x3882('0xaf')](function(_0x124722,_0x51b5f6){_0x9d228b[_0x3882('0xb0')]=_0x124722[_0x3882('0x3a')]({'plain':!![]});_0x9d228b[_0x3882('0xb0')]['created']=![];if(_0x51b5f6){if(_0x9d228b[_0x3882('0x88')]['autoclose']){_0x9d228b[_0x3882('0x8e')][_0x3882('0xb1')]({'id':0x0,'priority':_0x9d228b['applications'][_0x3882('0x5a')]+0x1,'app':'close','appdata':_0x3882('0xb2'),'interval':_0x3882('0xb3')});}_0x9d228b[_0x3882('0xb0')]['created']=!![];}return db['WhatsappMessage'][_0x3882('0x5d')]({'phone':_0x9d228b[_0x3882('0x5e')][_0x3882('0x9a')],'messageId':_0x9d228b['body'][_0x3882('0xa2')],'body':_0x9d228b['body'][_0x3882('0x5e')],'WhatsappAccountId':_0x437938[_0x3882('0x59')]['id'],'WhatsappInteractionId':_0x124722['id'],'direction':'in','ContactId':_0x124722['ContactId'],'AttachmentId':_0x9d228b[_0x3882('0x5e')][_0x3882('0xb4')]});})['then'](function(_0x46884b){_0x9d228b[_0x3882('0x2c')]=_0x46884b;if(_0x9d228b['interaction']['UserId']){return db[_0x3882('0xb5')][_0x3882('0x5c')]({'attributes':['id',_0x3882('0x3e')],'where':{'id':_0x9d228b[_0x3882('0xb0')]['UserId']}})[_0x3882('0x23')](function(_0xd38552){if(_0xd38552){_0x9d228b['applications'][_0x3882('0xb6')]({'id':0x0,'priority':0x0,'app':_0x3882('0xb7'),'appdata':_0xd38552[_0x3882('0x3e')]+','+(_0x9d228b[_0x3882('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x3882('0xb3')});}return respondWithRpcPromise('Start',_0x3882('0xb8'),_0x9d228b);});}return respondWithRpcPromise(_0x3882('0xb9'),_0x3882('0xb8'),_0x9d228b);})[_0x3882('0x23')](function(_0x23ec09){if(_0x23ec09){var _0x5d1757=0xc8;var _0x46847f=_0x3882('0xba');logger[_0x3882('0x24')](_0x3882('0x26'),_0x46847f,_0x5d1757,_0x3882('0xbb'));logger[_0x3882('0x25')](_0x3882('0xbc'),_0x46847f,_0x5d1757,_0x3882('0xbb'),JSON['stringify'](_0x23ec09));if(_0x9d228b['account'][_0x3882('0x51')]===_0x3882('0x99')){return _0x596cae[_0x3882('0x2d')](_0x5d1757)[_0x3882('0xbd')](_0x3882('0xbe'),'text/xml')[_0x3882('0x3f')](_0x3882('0xbf'));}else{return _0x596cae['status'](_0x5d1757)[_0x3882('0x2f')](_0x23ec09);}}});})['catch'](handleError(_0x596cae,null));};exports['send']=function(_0x6cdc21,_0x33249f,_0x22dfe2){var _0x226421,_0x453ee1,_0x1d6a3f;if(_['isNil'](_0x6cdc21[_0x3882('0x5e')]['body'])||_0x6cdc21[_0x3882('0x5e')][_0x3882('0x5e')]===''){throw new db[(_0x3882('0x92'))]['ValidationError'](_0x3882('0xa5'));}if(_[_0x3882('0xa3')](_0x6cdc21[_0x3882('0x5e')]['to'])){throw new db[(_0x3882('0x92'))]['ValidationError'](_0x3882('0xc0'));}_0x226421=_0x6cdc21[_0x3882('0x5e')]['to'];return db[_0x3882('0x54')][_0x3882('0x5c')]({'where':{'id':_0x6cdc21[_0x3882('0x59')]['id']},'include':[{'model':db[_0x3882('0xa8')],'as':_0x3882('0xc1'),'include':[{'model':db[_0x3882('0x91')],'as':_0x3882('0xa9'),'where':{'mobile':_0x226421},'limit':0x1,'order':[[_0x3882('0x96'),_0x3882('0xaa')]]}]}]})[_0x3882('0x23')](handleEntityNotFound(_0x33249f,null))[_0x3882('0x23')](function(_0x317e24){if(_0x317e24&&_0x317e24[_0x3882('0xc1')]){_0x453ee1=_0x317e24[_0x3882('0x3a')]({'plain':!![]});if(_0x453ee1[_0x3882('0xc1')]&&_0x453ee1[_0x3882('0xc1')]['Contacts'][_0x3882('0x5a')]){return _0x453ee1[_0x3882('0xc1')][_0x3882('0xa9')][0x0];}return db[_0x3882('0x91')][_0x3882('0x5d')](_[_0x3882('0x1b')](_0x6cdc21['body'],{'firstName':_0x226421,'mobile':_0x226421,'phone':_0x226421,'ListId':_0x453ee1['ListId']}));}})[_0x3882('0x23')](handleEntityNotFound(_0x33249f,null))['then'](function(_0x5f0344){if(_0x5f0344){_0x1d6a3f=_0x5f0344;return db['WhatsappInteraction'][_0x3882('0x5c')]({'where':{'ContactId':_0x1d6a3f['id'],'closed':![],'WhatsappAccountId':_0x453ee1['id']}})[_0x3882('0x23')](function(_0xaf5163){if(_0xaf5163){return[_0xaf5163,![]];}return db[_0x3882('0xae')][_0x3882('0x5d')]({'UserId':_0x6cdc21[_0x3882('0x61')]['id'],'ContactId':_0x1d6a3f['id'],'WhatsappAccountId':_0x453ee1['id'],'phone':_0x226421,'firstMsgDirection':_0x3882('0xc2'),'Messages':[_[_0x3882('0x50')](_0x6cdc21[_0x3882('0x5e')],{'read':![],'body':_0x6cdc21[_0x3882('0x5e')][_0x3882('0x5e')],'phone':_0x226421,'WhatsappAccountId':_0x453ee1['id'],'UserId':_0x6cdc21[_0x3882('0x61')]['id'],'ContactId':_0x1d6a3f['id']})]},{'include':[{'model':db[_0x3882('0xc3')],'as':_0x3882('0xc4')}]})[_0x3882('0x23')](function(_0x3bb97b){return[_0x3bb97b,!![]];});});}})[_0x3882('0xaf')](function(_0xca32c8,_0x3aca4e){if(_0x3aca4e){return _0xca32c8;}return db[_0x3882('0xc3')][_0x3882('0x5d')](_[_0x3882('0x50')](_0x6cdc21[_0x3882('0x5e')],{'read':![],'body':_0x6cdc21[_0x3882('0x5e')][_0x3882('0x5e')],'phone':_0x226421,'WhatsappAccountId':_0x453ee1['id'],'WhatsappInteractionId':_0xca32c8['id'],'UserId':_0x6cdc21[_0x3882('0x61')]['id'],'ContactId':_0x1d6a3f['id']}))['then'](function(_0xc0bea){_0xca32c8[_0x3882('0xc5')][_0x3882('0xc4')]=[];_0xca32c8['dataValues'][_0x3882('0xc4')]['push'](_0xc0bea[_0x3882('0xc5')]);return _0xca32c8;});})['then'](respondWithResult(_0x33249f,null))[_0x3882('0x57')](handleError(_0x33249f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 557bd9d..40a1469 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 _0xfbc1=['WhatsappAccount','setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x338693,_0x3ac648){var _0x33d894=function(_0x2d658a){while(--_0x2d658a){_0x338693['push'](_0x338693['shift']());}};_0x33d894(++_0x3ac648);}(_0xfbc1,0xd7));var _0x1fbc=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xfbc1[_0x879e31];return _0x3467e8;};'use strict';var EventEmitter=require(_0x1fbc('0x0'));var WhatsappAccount=require(_0x1fbc('0x1'))['db'][_0x1fbc('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1fbc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e7e86){return function(_0x3eadd7,_0x1c6652,_0x5437cf){WhatsappAccountEvents[_0x1fbc('0x4')](_0x4e7e86+':'+_0x3eadd7['id'],_0x3eadd7);WhatsappAccountEvents[_0x1fbc('0x4')](_0x4e7e86,_0x3eadd7);_0x5437cf(null);};}for(var e in events){if(events[_0x1fbc('0x5')](e)){var event=events[e];WhatsappAccount[_0x1fbc('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x067c=['events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x067c,0xf0));var _0xc067=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x067c[_0x4e9d3c];return _0x2d0825;};'use strict';var EventEmitter=require(_0xc067('0x0'));var WhatsappAccount=require(_0xc067('0x1'))['db'][_0xc067('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc067('0x3'),'afterUpdate':_0xc067('0x4'),'afterDestroy':_0xc067('0x5')};function emitEvent(_0x53af94){return function(_0x4f0423,_0x36b57a,_0x239776){WhatsappAccountEvents[_0xc067('0x6')](_0x53af94+':'+_0x4f0423['id'],_0x4f0423);WhatsappAccountEvents[_0xc067('0x6')](_0x53af94,_0x4f0423);_0x239776(null);};}for(var e in events){if(events[_0xc067('0x7')](e)){var event=events[e];WhatsappAccount[_0xc067('0x8')](e,emitEvent(event));}}module[_0xc067('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 575604d..e7a5457 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 _0xd9d2=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x3e9f24,_0x488fb9){var _0x614e20=function(_0x7425e1){while(--_0x7425e1){_0x3e9f24['push'](_0x3e9f24['shift']());}};_0x614e20(++_0x488fb9);}(_0xd9d2,0x1bf));var _0x2d9d=function(_0x4eeb66,_0x1d7553){_0x4eeb66=_0x4eeb66-0x0;var _0x4aa808=_0xd9d2[_0x4eeb66];return _0x4aa808;};'use strict';var _=require(_0x2d9d('0x0'));var util=require(_0x2d9d('0x1'));var logger=require(_0x2d9d('0x2'))(_0x2d9d('0x3'));var moment=require('moment');var BPromise=require(_0x2d9d('0x4'));var rp=require(_0x2d9d('0x5'));var fs=require('fs');var path=require(_0x2d9d('0x6'));var rimraf=require(_0x2d9d('0x7'));var config=require('../../config/environment');var attributes=require(_0x2d9d('0x8'));module['exports']=function(_0xb34b0a,_0x2cdb09){return _0xb34b0a['define'](_0x2d9d('0x9'),attributes,{'tableName':_0x2d9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42b9=['util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash'];(function(_0x1cc991,_0x11e263){var _0x33b45=function(_0x112884){while(--_0x112884){_0x1cc991['push'](_0x1cc991['shift']());}};_0x33b45(++_0x11e263);}(_0x42b9,0x1df));var _0x942b=function(_0x2c8266,_0x23f2df){_0x2c8266=_0x2c8266-0x0;var _0x4cb855=_0x42b9[_0x2c8266];return _0x4cb855;};'use strict';var _=require(_0x942b('0x0'));var util=require(_0x942b('0x1'));var logger=require(_0x942b('0x2'))(_0x942b('0x3'));var moment=require(_0x942b('0x4'));var BPromise=require(_0x942b('0x5'));var rp=require(_0x942b('0x6'));var fs=require('fs');var path=require(_0x942b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x942b('0x8'));module[_0x942b('0x9')]=function(_0x4f4a19,_0x2a9fd6){return _0x4f4a19[_0x942b('0xa')](_0x942b('0xb'),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 37513ef..3ecbb28 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 _0x81b8=['include','model','map','then','ShowWhatsappAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount','find','options','raw','attributes'];(function(_0x15d756,_0x135c84){var _0x5a3bcc=function(_0x5aee46){while(--_0x5aee46){_0x15d756['push'](_0x15d756['shift']());}};_0x5a3bcc(++_0x135c84);}(_0x81b8,0x1ce));var _0x881b=function(_0x5e9429,_0x1b3a1e){_0x5e9429=_0x5e9429-0x0;var _0xb9a33f=_0x81b8[_0x5e9429];return _0xb9a33f;};'use strict';var _=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var moment=require(_0x881b('0x2'));var BPromise=require(_0x881b('0x3'));var rs=require(_0x881b('0x4'));var fs=require('fs');var Redis=require(_0x881b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x881b('0x6'));var config=require('../../config/environment');var jayson=require(_0x881b('0x7'));var client=jayson[_0x881b('0x8')][_0x881b('0x9')]({'port':0x232a});config[_0x881b('0xa')]=_[_0x881b('0xb')](config['redis'],{'host':_0x881b('0xc'),'port':0x18eb});var socket=require(_0x881b('0xd'))(new Redis(config['redis']));require(_0x881b('0xe'))[_0x881b('0xf')](socket);function respondWithRpcPromise(_0x38b88e,_0x545e88,_0x1c7729){return new BPromise(function(_0x447d95,_0x14aafd){return client[_0x881b('0x10')](_0x38b88e,_0x1c7729)['then'](function(_0x234aa4){logger[_0x881b('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x545e88,_0x881b('0x12'));logger['debug'](_0x881b('0x13'),_0x545e88,_0x881b('0x12'),JSON[_0x881b('0x14')](_0x234aa4));if(_0x234aa4[_0x881b('0x15')]){if(_0x234aa4[_0x881b('0x15')][_0x881b('0x16')]===0x1f4){logger[_0x881b('0x15')](_0x881b('0x17'),_0x545e88,_0x234aa4[_0x881b('0x15')][_0x881b('0x18')]);return _0x14aafd(_0x234aa4[_0x881b('0x15')][_0x881b('0x18')]);}logger[_0x881b('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x545e88,_0x234aa4['error'][_0x881b('0x18')]);return _0x447d95(_0x234aa4['error']['message']);}else{logger[_0x881b('0x11')](_0x881b('0x17'),_0x545e88,_0x881b('0x12'));_0x447d95(_0x234aa4[_0x881b('0x19')][_0x881b('0x18')]);}})[_0x881b('0x1a')](function(_0x415852){logger['error'](_0x881b('0x17'),_0x545e88,_0x415852);_0x14aafd(_0x415852);});});}exports['ShowWhatsappAccount']=function(_0x279cc0){var _0x279b6b=this;return new Promise(function(_0x5e9af8,_0x3d86d8){return db[_0x881b('0x1b')][_0x881b('0x1c')]({'raw':_0x279cc0[_0x881b('0x1d')]?_0x279cc0['options'][_0x881b('0x1e')]===undefined?!![]:![]:!![],'where':_0x279cc0[_0x881b('0x1d')]?_0x279cc0['options']['where']||null:null,'attributes':_0x279cc0['options']?_0x279cc0[_0x881b('0x1d')][_0x881b('0x1f')]||null:null,'include':_0x279cc0[_0x881b('0x1d')]?_0x279cc0[_0x881b('0x1d')][_0x881b('0x20')]?_['map'](_0x279cc0[_0x881b('0x1d')][_0x881b('0x20')],function(_0x61bcd8){return{'model':db[_0x61bcd8[_0x881b('0x21')]],'as':_0x61bcd8['as'],'attributes':_0x61bcd8['attributes'],'include':_0x61bcd8[_0x881b('0x20')]?_[_0x881b('0x22')](_0x61bcd8[_0x881b('0x20')],function(_0x49b4af){return{'model':db[_0x49b4af['model']],'as':_0x49b4af['as'],'attributes':_0x49b4af[_0x881b('0x1f')],'include':_0x49b4af[_0x881b('0x20')]?_['map'](_0x49b4af[_0x881b('0x20')],function(_0x7d6859){return{'model':db[_0x7d6859[_0x881b('0x21')]],'as':_0x7d6859['as'],'attributes':_0x7d6859['attributes']};}):[]};}):[]};}):[]:[]})[_0x881b('0x23')](function(_0x2e0561){logger[_0x881b('0x11')](_0x881b('0x24'),_0x279cc0);logger[_0x881b('0x25')](_0x881b('0x24'),_0x279cc0,JSON['stringify'](_0x2e0561));_0x5e9af8(_0x2e0561);})['catch'](function(_0x2efd0c){logger['error'](_0x881b('0x24'),_0x2efd0c[_0x881b('0x18')],_0x279cc0);_0x3d86d8(_0x279b6b[_0x881b('0x15')](0x1f4,_0x2efd0c[_0x881b('0x18')]));});});}; \ No newline at end of file +var _0xa7a0=['client','localhost','redis','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','map','include','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xa7a0,0x181));var _0x0a7a=function(_0x497785,_0x50e08f){_0x497785=_0x497785-0x0;var _0x5da638=_0xa7a0[_0x497785];return _0x5da638;};'use strict';var _=require('lodash');var util=require(_0x0a7a('0x0'));var moment=require(_0x0a7a('0x1'));var BPromise=require(_0x0a7a('0x2'));var rs=require(_0x0a7a('0x3'));var fs=require('fs');var Redis=require(_0x0a7a('0x4'));var db=require(_0x0a7a('0x5'))['db'];var utils=require(_0x0a7a('0x6'));var logger=require(_0x0a7a('0x7'))(_0x0a7a('0x8'));var config=require(_0x0a7a('0x9'));var jayson=require(_0x0a7a('0xa'));var client=jayson[_0x0a7a('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0a7a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a7a('0xd')]));require(_0x0a7a('0xe'))[_0x0a7a('0xf')](socket);function respondWithRpcPromise(_0x5deea5,_0x479a98,_0x5eb32f){return new BPromise(function(_0x236937,_0x459a72){return client[_0x0a7a('0x10')](_0x5deea5,_0x5eb32f)[_0x0a7a('0x11')](function(_0x3903a1){logger['info'](_0x0a7a('0x12'),_0x479a98,'request\x20sent');logger[_0x0a7a('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x479a98,_0x0a7a('0x14'),JSON[_0x0a7a('0x15')](_0x3903a1));if(_0x3903a1[_0x0a7a('0x16')]){if(_0x3903a1['error'][_0x0a7a('0x17')]===0x1f4){logger[_0x0a7a('0x16')](_0x0a7a('0x12'),_0x479a98,_0x3903a1['error'][_0x0a7a('0x18')]);return _0x459a72(_0x3903a1['error']['message']);}logger[_0x0a7a('0x16')](_0x0a7a('0x12'),_0x479a98,_0x3903a1[_0x0a7a('0x16')][_0x0a7a('0x18')]);return _0x236937(_0x3903a1[_0x0a7a('0x16')][_0x0a7a('0x18')]);}else{logger['info'](_0x0a7a('0x12'),_0x479a98,_0x0a7a('0x14'));_0x236937(_0x3903a1['result']['message']);}})[_0x0a7a('0x19')](function(_0x5859b9){logger['error'](_0x0a7a('0x12'),_0x479a98,_0x5859b9);_0x459a72(_0x5859b9);});});}exports[_0x0a7a('0x1a')]=function(_0x397252){var _0x11e718=this;return new Promise(function(_0x5391fb,_0x4375b1){return db[_0x0a7a('0x1b')][_0x0a7a('0x1c')]({'raw':_0x397252[_0x0a7a('0x1d')]?_0x397252['options'][_0x0a7a('0x1e')]===undefined?!![]:![]:!![],'where':_0x397252[_0x0a7a('0x1d')]?_0x397252['options']['where']||null:null,'attributes':_0x397252[_0x0a7a('0x1d')]?_0x397252['options'][_0x0a7a('0x1f')]||null:null,'include':_0x397252[_0x0a7a('0x1d')]?_0x397252[_0x0a7a('0x1d')]['include']?_[_0x0a7a('0x20')](_0x397252[_0x0a7a('0x1d')][_0x0a7a('0x21')],function(_0x5a85ff){return{'model':db[_0x5a85ff[_0x0a7a('0x22')]],'as':_0x5a85ff['as'],'attributes':_0x5a85ff['attributes'],'include':_0x5a85ff['include']?_[_0x0a7a('0x20')](_0x5a85ff['include'],function(_0x4094cc){return{'model':db[_0x4094cc[_0x0a7a('0x22')]],'as':_0x4094cc['as'],'attributes':_0x4094cc[_0x0a7a('0x1f')],'include':_0x4094cc[_0x0a7a('0x21')]?_[_0x0a7a('0x20')](_0x4094cc[_0x0a7a('0x21')],function(_0x564e95){return{'model':db[_0x564e95[_0x0a7a('0x22')]],'as':_0x564e95['as'],'attributes':_0x564e95[_0x0a7a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a7a('0x11')](function(_0x586051){logger[_0x0a7a('0x23')](_0x0a7a('0x1a'),_0x397252);logger[_0x0a7a('0x13')](_0x0a7a('0x1a'),_0x397252,JSON[_0x0a7a('0x15')](_0x586051));_0x5391fb(_0x586051);})[_0x0a7a('0x19')](function(_0x293b84){logger[_0x0a7a('0x16')](_0x0a7a('0x1a'),_0x293b84[_0x0a7a('0x18')],_0x397252);_0x4375b1(_0x11e718[_0x0a7a('0x16')](0x1f4,_0x293b84[_0x0a7a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 29d1f32..21394ce 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 _0x1fb3=['register','length','whatsappAccount:','save','remove','update','emit','removeListener'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0x1fb3,0xeb));var _0x31fb=function(_0x4fcbdb,_0xd92d3f){_0x4fcbdb=_0x4fcbdb-0x0;var _0x2a8e78=_0x1fb3[_0x4fcbdb];return _0x2a8e78;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x31fb('0x0'),_0x31fb('0x1'),_0x31fb('0x2')];function createListener(_0x5027b4,_0x2e6188){return function(_0x2a3a51){_0x2e6188[_0x31fb('0x3')](_0x5027b4,_0x2a3a51);};}function removeListener(_0x5b6a62,_0x11681d){return function(){WhatsappAccountEvents[_0x31fb('0x4')](_0x5b6a62,_0x11681d);};}exports[_0x31fb('0x5')]=function(_0x1daddc){for(var _0x19efd7=0x0,_0x2849a3=events[_0x31fb('0x6')];_0x19efd7<_0x2849a3;_0x19efd7++){var _0x360520=events[_0x19efd7];var _0xc2d270=createListener(_0x31fb('0x7')+_0x360520,_0x1daddc);WhatsappAccountEvents['on'](_0x360520,_0xc2d270);}}; \ No newline at end of file +var _0xcb48=['./whatsappAccount.events','save','remove','update','emit','register','length','whatsappAccount:'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xcb48,0xb8));var _0x8cb4=function(_0x51b94a,_0x43bc68){_0x51b94a=_0x51b94a-0x0;var _0x5f285c=_0xcb48[_0x51b94a];return _0x5f285c;};'use strict';var WhatsappAccountEvents=require(_0x8cb4('0x0'));var events=[_0x8cb4('0x1'),_0x8cb4('0x2'),_0x8cb4('0x3')];function createListener(_0x424129,_0x287d43){return function(_0x1f7c80){_0x287d43[_0x8cb4('0x4')](_0x424129,_0x1f7c80);};}function removeListener(_0x314df6,_0x5a1b51){return function(){WhatsappAccountEvents['removeListener'](_0x314df6,_0x5a1b51);};}exports[_0x8cb4('0x5')]=function(_0x4be833){for(var _0x32983a=0x0,_0x202219=events[_0x8cb4('0x6')];_0x32983a<_0x202219;_0x32983a++){var _0x2316b9=events[_0x32983a];var _0x5ddbfc=createListener(_0x8cb4('0x7')+_0x2316b9,_0x4be833);WhatsappAccountEvents['on'](_0x2316b9,_0x5ddbfc);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e9987e1..271f250 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 _0x28f9=['destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x234da0,_0x5cbfb9){var _0x2f2124=function(_0x513cca){while(--_0x513cca){_0x234da0['push'](_0x234da0['shift']());}};_0x2f2124(++_0x5cbfb9);}(_0x28f9,0xbc));var _0x928f=function(_0x4da1f4,_0x14a3c2){_0x4da1f4=_0x4da1f4-0x0;var _0x566565=_0x28f9[_0x4da1f4];return _0x566565;};'use strict';var multer=require('multer');var util=require(_0x928f('0x0'));var path=require(_0x928f('0x1'));var timeout=require(_0x928f('0x2'));var express=require(_0x928f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x928f('0x4'));var interaction=require(_0x928f('0x5'));var config=require(_0x928f('0x6'));var controller=require(_0x928f('0x7'));router[_0x928f('0x8')]('/',auth[_0x928f('0x9')](),controller['index']);router['get'](_0x928f('0xa'),auth[_0x928f('0x9')](),controller[_0x928f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x928f('0xc')]);router[_0x928f('0xd')]('/:id',auth[_0x928f('0x9')](),controller[_0x928f('0xe')]);router[_0x928f('0xf')](_0x928f('0xa'),auth[_0x928f('0x9')](),controller[_0x928f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0812=['post','create','update','destroy','exports','path','express','Router','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ac86d,_0xe15e9a){var _0x10e1b0=function(_0x5d29d5){while(--_0x5d29d5){_0x5ac86d['push'](_0x5ac86d['shift']());}};_0x10e1b0(++_0xe15e9a);}(_0x0812,0x1c7));var _0x2081=function(_0x35d2eb,_0x285dd6){_0x35d2eb=_0x35d2eb-0x0;var _0x1fcf00=_0x0812[_0x35d2eb];return _0x1fcf00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2081('0x0'));var timeout=require('connect-timeout');var express=require(_0x2081('0x1'));var router=express[_0x2081('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2081('0x3'));var config=require('../../config/environment');var controller=require(_0x2081('0x4'));router[_0x2081('0x5')]('/',auth[_0x2081('0x6')](),controller[_0x2081('0x7')]);router['get'](_0x2081('0x8'),auth[_0x2081('0x6')](),controller[_0x2081('0x9')]);router[_0x2081('0xa')]('/',auth[_0x2081('0x6')](),controller[_0x2081('0xb')]);router['put'](_0x2081('0x8'),auth[_0x2081('0x6')](),controller[_0x2081('0xc')]);router['delete'](_0x2081('0x8'),auth['isAuthenticated'](),controller[_0x2081('0xd')]);module[_0x2081('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index aa7b692..d5a7c02 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 _0xfa20=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3bf3f1,_0x5b8238){var _0x5a0c0c=function(_0x303fac){while(--_0x303fac){_0x3bf3f1['push'](_0x3bf3f1['shift']());}};_0x5a0c0c(++_0x5b8238);}(_0xfa20,0xf9));var _0x0fa2=function(_0x433cbe,_0x1e2ce5){_0x433cbe=_0x433cbe-0x0;var _0x110b24=_0xfa20[_0x433cbe];return _0x110b24;};'use strict';var Sequelize=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]={'priority':{'type':Sequelize[_0x0fa2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0fa2('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0fa2('0x4')]()},'description':{'type':Sequelize[_0x0fa2('0x3')]},'interval':{'type':Sequelize[_0x0fa2('0x3')],'defaultValue':_0x0fa2('0x5')}}; \ No newline at end of file +var _0x23e8=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x541202,_0x32c6be){var _0x4bd4ab=function(_0x24db7a){while(--_0x24db7a){_0x541202['push'](_0x541202['shift']());}};_0x4bd4ab(++_0x32c6be);}(_0x23e8,0xe9));var _0x823e=function(_0x1ae7f6,_0x3259a9){_0x1ae7f6=_0x1ae7f6-0x0;var _0x273264=_0x23e8[_0x1ae7f6];return _0x273264;};'use strict';var Sequelize=require(_0x823e('0x0'));module[_0x823e('0x1')]={'priority':{'type':Sequelize[_0x823e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x823e('0x3')},'appdata':{'type':Sequelize[_0x823e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x823e('0x5')],'defaultValue':_0x823e('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7c1be98..c01ae34 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 _0xe785=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','create','body','find'];(function(_0x1e7587,_0x55b4ed){var _0x513e2b=function(_0x26c763){while(--_0x26c763){_0x1e7587['push'](_0x1e7587['shift']());}};_0x513e2b(++_0x55b4ed);}(_0xe785,0x128));var _0x5e78=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0xe785[_0x3f042c];return _0x280d2e;};'use strict';var emlformat=require(_0x5e78('0x0'));var rimraf=require(_0x5e78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e78('0x2'));var rp=require(_0x5e78('0x3'));var moment=require(_0x5e78('0x4'));var BPromise=require(_0x5e78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e78('0x6'));var sox=require(_0x5e78('0x7'));var csv=require(_0x5e78('0x8'));var ejs=require(_0x5e78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e78('0xa'));var crypto=require(_0x5e78('0xb'));var jsforce=require(_0x5e78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e78('0x8'));var querystring=require('querystring');var Papa=require(_0x5e78('0xd'));var Redis=require('ioredis');var authService=require(_0x5e78('0xe'));var qs=require(_0x5e78('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e78('0x10'));var logger=require(_0x5e78('0x11'))(_0x5e78('0x12'));var utils=require(_0x5e78('0x13'));var config=require(_0x5e78('0x14'));var licenseUtil=require(_0x5e78('0x15'));var db=require(_0x5e78('0x16'))['db'];function respondWithStatusCode(_0x53edaa,_0x46b082){_0x46b082=_0x46b082||0xcc;return function(_0x104712){if(_0x104712){return _0x53edaa[_0x5e78('0x17')](_0x46b082);}return _0x53edaa['status'](_0x46b082)[_0x5e78('0x18')]();};}function respondWithResult(_0x2528ba,_0x9e71a4){_0x9e71a4=_0x9e71a4||0xc8;return function(_0x1e49bf){if(_0x1e49bf){return _0x2528ba['status'](_0x9e71a4)[_0x5e78('0x19')](_0x1e49bf);}};}function respondWithFilteredResult(_0x60a88d,_0x1e39e2){return function(_0xc0786e){if(_0xc0786e){var _0x399424=typeof _0x1e39e2[_0x5e78('0x1a')]==='undefined'&&typeof _0x1e39e2['limit']===_0x5e78('0x1b');var _0x263109=_0xc0786e[_0x5e78('0x1c')];var _0x5d6063=_0x399424?0x0:_0x1e39e2['offset'];var _0x53f6a8=_0x399424?_0xc0786e['count']:_0x1e39e2[_0x5e78('0x1a')]+_0x1e39e2[_0x5e78('0x1d')];var _0xe0ccf4;if(_0x53f6a8>=_0x263109){_0x53f6a8=_0x263109;_0xe0ccf4=0xc8;}else{_0xe0ccf4=0xce;}_0x60a88d[_0x5e78('0x1e')](_0xe0ccf4);return _0x60a88d[_0x5e78('0x1f')](_0x5e78('0x20'),_0x5d6063+'-'+_0x53f6a8+'/'+_0x263109)['json'](_0xc0786e);}return null;};}function patchUpdates(_0xa20b19){return function(_0x2b3f5e){try{jsonpatch[_0x5e78('0x21')](_0x2b3f5e,_0xa20b19,!![]);}catch(_0x10166e){return BPromise[_0x5e78('0x22')](_0x10166e);}return _0x2b3f5e[_0x5e78('0x23')]();};}function saveUpdates(_0xbab14d,_0x39e685){return function(_0x56a804){if(_0x56a804){return _0x56a804[_0x5e78('0x24')](_0xbab14d)[_0x5e78('0x25')](function(_0x5d001a){return _0x5d001a;});}return null;};}function removeEntity(_0x341429,_0x1e4e03){return function(_0x3e297e){if(_0x3e297e){return _0x3e297e[_0x5e78('0x26')]()[_0x5e78('0x25')](function(){_0x341429['status'](0xcc)[_0x5e78('0x18')]();});}};}function handleEntityNotFound(_0x874a24,_0x454404){return function(_0x3b39f4){if(!_0x3b39f4){_0x874a24[_0x5e78('0x17')](0x194);}return _0x3b39f4;};}function handleError(_0x341b1e,_0x441b9f){_0x441b9f=_0x441b9f||0x1f4;return function(_0xced025){logger['error'](_0xced025[_0x5e78('0x27')]);if(_0xced025[_0x5e78('0x28')]){delete _0xced025['name'];}_0x341b1e['status'](_0x441b9f)[_0x5e78('0x29')](_0xced025);};}exports['index']=function(_0x8d0a4a,_0x24713c){var _0x4872c5={},_0x1ac4fe={},_0x42db02={'count':0x0,'rows':[]};var _0x54a558=_[_0x5e78('0x2a')](db['WhatsappApplication'][_0x5e78('0x2b')],function(_0x2b27be){return{'name':_0x2b27be[_0x5e78('0x2c')],'type':_0x2b27be[_0x5e78('0x2d')]['key']};});_0x1ac4fe[_0x5e78('0x2e')]=_['map'](_0x54a558,_0x5e78('0x28'));_0x1ac4fe['query']=_[_0x5e78('0x2f')](_0x8d0a4a[_0x5e78('0x30')]);_0x1ac4fe[_0x5e78('0x31')]=_['intersection'](_0x1ac4fe[_0x5e78('0x2e')],_0x1ac4fe[_0x5e78('0x30')]);_0x4872c5['attributes']=_[_0x5e78('0x32')](_0x1ac4fe['model'],qs[_0x5e78('0x33')](_0x8d0a4a[_0x5e78('0x30')]['fields']));_0x4872c5[_0x5e78('0x34')]=_0x4872c5[_0x5e78('0x34')][_0x5e78('0x35')]?_0x4872c5[_0x5e78('0x34')]:_0x1ac4fe[_0x5e78('0x2e')];if(!_0x8d0a4a[_0x5e78('0x30')][_0x5e78('0x36')](_0x5e78('0x37'))){_0x4872c5[_0x5e78('0x1d')]=qs['limit'](_0x8d0a4a[_0x5e78('0x30')]['limit']);_0x4872c5[_0x5e78('0x1a')]=qs['offset'](_0x8d0a4a[_0x5e78('0x30')]['offset']);}_0x4872c5[_0x5e78('0x38')]=qs[_0x5e78('0x39')](_0x8d0a4a[_0x5e78('0x30')]['sort']);_0x4872c5[_0x5e78('0x3a')]=qs[_0x5e78('0x31')](_['pick'](_0x8d0a4a['query'],_0x1ac4fe[_0x5e78('0x31')]),_0x54a558);if(_0x8d0a4a[_0x5e78('0x30')][_0x5e78('0x3b')]){_0x4872c5[_0x5e78('0x3a')]=_[_0x5e78('0x3c')](_0x4872c5[_0x5e78('0x3a')],{'$or':_[_0x5e78('0x2a')](_0x54a558,function(_0x215631){if(_0x215631[_0x5e78('0x2d')]!==_0x5e78('0x3d')){var _0x38b083={};_0x38b083[_0x215631['name']]={'$like':'%'+_0x8d0a4a[_0x5e78('0x30')][_0x5e78('0x3b')]+'%'};return _0x38b083;}})});}_0x4872c5=_[_0x5e78('0x3c')]({},_0x4872c5,_0x8d0a4a[_0x5e78('0x3e')]);var _0x5a0115={'where':_0x4872c5[_0x5e78('0x3a')]};return db[_0x5e78('0x3f')][_0x5e78('0x1c')](_0x5a0115)[_0x5e78('0x25')](function(_0x450974){_0x42db02[_0x5e78('0x1c')]=_0x450974;if(_0x8d0a4a['query'][_0x5e78('0x40')]){_0x4872c5[_0x5e78('0x41')]=[{'all':!![]}];}return db[_0x5e78('0x3f')][_0x5e78('0x42')](_0x4872c5);})[_0x5e78('0x25')](function(_0x4d1ed6){_0x42db02[_0x5e78('0x43')]=_0x4d1ed6;return _0x42db02;})['then'](respondWithFilteredResult(_0x24713c,_0x4872c5))[_0x5e78('0x44')](handleError(_0x24713c,null));};exports[_0x5e78('0x45')]=function(_0x50f558,_0x1b8ccc){var _0x223cde={'raw':!![],'where':{'id':_0x50f558[_0x5e78('0x46')]['id']}},_0x525a3e={};_0x525a3e[_0x5e78('0x2e')]=_[_0x5e78('0x2f')](db['WhatsappApplication'][_0x5e78('0x2b')]);_0x525a3e['query']=_[_0x5e78('0x2f')](_0x50f558[_0x5e78('0x30')]);_0x525a3e[_0x5e78('0x31')]=_[_0x5e78('0x32')](_0x525a3e['model'],_0x525a3e[_0x5e78('0x30')]);_0x223cde[_0x5e78('0x34')]=_['intersection'](_0x525a3e['model'],qs[_0x5e78('0x33')](_0x50f558[_0x5e78('0x30')][_0x5e78('0x33')]));_0x223cde[_0x5e78('0x34')]=_0x223cde[_0x5e78('0x34')]['length']?_0x223cde[_0x5e78('0x34')]:_0x525a3e[_0x5e78('0x2e')];if(_0x50f558[_0x5e78('0x30')][_0x5e78('0x40')]){_0x223cde[_0x5e78('0x41')]=[{'all':!![]}];}_0x223cde=_['merge']({},_0x223cde,_0x50f558[_0x5e78('0x3e')]);return db[_0x5e78('0x3f')]['find'](_0x223cde)['then'](handleEntityNotFound(_0x1b8ccc,null))['then'](respondWithResult(_0x1b8ccc,null))[_0x5e78('0x44')](handleError(_0x1b8ccc,null));};exports[_0x5e78('0x47')]=function(_0x10462a,_0x29bfc0){return db[_0x5e78('0x3f')]['create'](_0x10462a[_0x5e78('0x48')],{})[_0x5e78('0x25')](respondWithResult(_0x29bfc0,0xc9))[_0x5e78('0x44')](handleError(_0x29bfc0,null));};exports['update']=function(_0x2ae6dd,_0xd6522e){if(_0x2ae6dd[_0x5e78('0x48')]['id']){delete _0x2ae6dd[_0x5e78('0x48')]['id'];}return db[_0x5e78('0x3f')]['find']({'where':{'id':_0x2ae6dd[_0x5e78('0x46')]['id']}})[_0x5e78('0x25')](handleEntityNotFound(_0xd6522e,null))['then'](saveUpdates(_0x2ae6dd[_0x5e78('0x48')],null))[_0x5e78('0x25')](respondWithResult(_0xd6522e,null))[_0x5e78('0x44')](handleError(_0xd6522e,null));};exports[_0x5e78('0x26')]=function(_0x29bd68,_0x2bdf3d){return db[_0x5e78('0x3f')][_0x5e78('0x49')]({'where':{'id':_0x29bd68[_0x5e78('0x46')]['id']}})[_0x5e78('0x25')](handleEntityNotFound(_0x2bdf3d,null))['then'](removeEntity(_0x2bdf3d,null))[_0x5e78('0x44')](handleError(_0x2bdf3d,null));}; \ No newline at end of file +var _0xd1f8=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x2649e2,_0x3e73be){var _0x4797d4=function(_0xfa2d8b){while(--_0xfa2d8b){_0x2649e2['push'](_0x2649e2['shift']());}};_0x4797d4(++_0x3e73be);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xd1f8[_0x13606d];return _0x1b85b0;};'use strict';var emlformat=require(_0x8d1f('0x0'));var rimraf=require(_0x8d1f('0x1'));var zipdir=require(_0x8d1f('0x2'));var jsonpatch=require(_0x8d1f('0x3'));var rp=require('request-promise');var moment=require(_0x8d1f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d1f('0x5'));var util=require('util');var path=require(_0x8d1f('0x6'));var sox=require('sox');var csv=require(_0x8d1f('0x7'));var ejs=require(_0x8d1f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d1f('0x9'));var squel=require(_0x8d1f('0xa'));var crypto=require(_0x8d1f('0xb'));var jsforce=require(_0x8d1f('0xc'));var deskjs=require(_0x8d1f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d1f('0xe'));var Papa=require(_0x8d1f('0xf'));var Redis=require('ioredis');var authService=require(_0x8d1f('0x10'));var qs=require(_0x8d1f('0x11'));var as=require(_0x8d1f('0x12'));var hardwareService=require(_0x8d1f('0x13'));var logger=require(_0x8d1f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8d1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d1f('0x16'))['db'];function respondWithStatusCode(_0x38e8bb,_0x4f31d0){_0x4f31d0=_0x4f31d0||0xcc;return function(_0x52cd91){if(_0x52cd91){return _0x38e8bb[_0x8d1f('0x17')](_0x4f31d0);}return _0x38e8bb[_0x8d1f('0x18')](_0x4f31d0)['end']();};}function respondWithResult(_0x7d9ae5,_0x8c423c){_0x8c423c=_0x8c423c||0xc8;return function(_0x443511){if(_0x443511){return _0x7d9ae5[_0x8d1f('0x18')](_0x8c423c)[_0x8d1f('0x19')](_0x443511);}};}function respondWithFilteredResult(_0x3ea57a,_0x187e8b){return function(_0x1af7e2){if(_0x1af7e2){var _0x2463c9=typeof _0x187e8b[_0x8d1f('0x1a')]===_0x8d1f('0x1b')&&typeof _0x187e8b[_0x8d1f('0x1c')]===_0x8d1f('0x1b');var _0x2036ee=_0x1af7e2[_0x8d1f('0x1d')];var _0xb5c2e5=_0x2463c9?0x0:_0x187e8b[_0x8d1f('0x1a')];var _0x495655=_0x2463c9?_0x1af7e2['count']:_0x187e8b[_0x8d1f('0x1a')]+_0x187e8b[_0x8d1f('0x1c')];var _0x1cb538;if(_0x495655>=_0x2036ee){_0x495655=_0x2036ee;_0x1cb538=0xc8;}else{_0x1cb538=0xce;}_0x3ea57a[_0x8d1f('0x18')](_0x1cb538);return _0x3ea57a[_0x8d1f('0x1e')](_0x8d1f('0x1f'),_0xb5c2e5+'-'+_0x495655+'/'+_0x2036ee)['json'](_0x1af7e2);}return null;};}function patchUpdates(_0x194fe0){return function(_0xa52d89){try{jsonpatch[_0x8d1f('0x20')](_0xa52d89,_0x194fe0,!![]);}catch(_0x9ce15f){return BPromise['reject'](_0x9ce15f);}return _0xa52d89['save']();};}function saveUpdates(_0x4519bc,_0x102e98){return function(_0x5175a5){if(_0x5175a5){return _0x5175a5[_0x8d1f('0x21')](_0x4519bc)['then'](function(_0x285e7f){return _0x285e7f;});}return null;};}function removeEntity(_0x3d2016,_0x307990){return function(_0x2279b9){if(_0x2279b9){return _0x2279b9[_0x8d1f('0x22')]()[_0x8d1f('0x23')](function(){_0x3d2016[_0x8d1f('0x18')](0xcc)[_0x8d1f('0x24')]();});}};}function handleEntityNotFound(_0x296d0c,_0x4ba072){return function(_0x24c04a){if(!_0x24c04a){_0x296d0c[_0x8d1f('0x17')](0x194);}return _0x24c04a;};}function handleError(_0x584157,_0x391e79){_0x391e79=_0x391e79||0x1f4;return function(_0x860eda){logger['error'](_0x860eda[_0x8d1f('0x25')]);if(_0x860eda[_0x8d1f('0x26')]){delete _0x860eda[_0x8d1f('0x26')];}_0x584157['status'](_0x391e79)[_0x8d1f('0x27')](_0x860eda);};}exports[_0x8d1f('0x28')]=function(_0x4ca54a,_0x4e7e41){var _0x3c15de={},_0x564920={},_0x4c60bb={'count':0x0,'rows':[]};var _0x15d661=_[_0x8d1f('0x29')](db[_0x8d1f('0x2a')][_0x8d1f('0x2b')],function(_0x409788){return{'name':_0x409788[_0x8d1f('0x2c')],'type':_0x409788[_0x8d1f('0x2d')][_0x8d1f('0x2e')]};});_0x564920['model']=_[_0x8d1f('0x29')](_0x15d661,_0x8d1f('0x26'));_0x564920[_0x8d1f('0x2f')]=_[_0x8d1f('0x30')](_0x4ca54a[_0x8d1f('0x2f')]);_0x564920[_0x8d1f('0x31')]=_['intersection'](_0x564920[_0x8d1f('0x32')],_0x564920[_0x8d1f('0x2f')]);_0x3c15de['attributes']=_[_0x8d1f('0x33')](_0x564920[_0x8d1f('0x32')],qs['fields'](_0x4ca54a['query']['fields']));_0x3c15de[_0x8d1f('0x34')]=_0x3c15de[_0x8d1f('0x34')][_0x8d1f('0x35')]?_0x3c15de[_0x8d1f('0x34')]:_0x564920[_0x8d1f('0x32')];if(!_0x4ca54a[_0x8d1f('0x2f')][_0x8d1f('0x36')](_0x8d1f('0x37'))){_0x3c15de['limit']=qs['limit'](_0x4ca54a['query'][_0x8d1f('0x1c')]);_0x3c15de[_0x8d1f('0x1a')]=qs[_0x8d1f('0x1a')](_0x4ca54a[_0x8d1f('0x2f')][_0x8d1f('0x1a')]);}_0x3c15de[_0x8d1f('0x38')]=qs['sort'](_0x4ca54a[_0x8d1f('0x2f')]['sort']);_0x3c15de[_0x8d1f('0x39')]=qs[_0x8d1f('0x31')](_['pick'](_0x4ca54a['query'],_0x564920[_0x8d1f('0x31')]),_0x15d661);if(_0x4ca54a[_0x8d1f('0x2f')][_0x8d1f('0x3a')]){_0x3c15de[_0x8d1f('0x39')]=_[_0x8d1f('0x3b')](_0x3c15de[_0x8d1f('0x39')],{'$or':_['map'](_0x15d661,function(_0x42de98){if(_0x42de98[_0x8d1f('0x2d')]!==_0x8d1f('0x3c')){var _0x19273f={};_0x19273f[_0x42de98[_0x8d1f('0x26')]]={'$like':'%'+_0x4ca54a[_0x8d1f('0x2f')][_0x8d1f('0x3a')]+'%'};return _0x19273f;}})});}_0x3c15de=_[_0x8d1f('0x3b')]({},_0x3c15de,_0x4ca54a[_0x8d1f('0x3d')]);var _0x2f1c93={'where':_0x3c15de[_0x8d1f('0x39')]};return db['WhatsappApplication'][_0x8d1f('0x1d')](_0x2f1c93)[_0x8d1f('0x23')](function(_0x1dfa97){_0x4c60bb['count']=_0x1dfa97;if(_0x4ca54a['query']['includeAll']){_0x3c15de[_0x8d1f('0x3e')]=[{'all':!![]}];}return db[_0x8d1f('0x2a')]['findAll'](_0x3c15de);})[_0x8d1f('0x23')](function(_0x1dfd62){_0x4c60bb[_0x8d1f('0x3f')]=_0x1dfd62;return _0x4c60bb;})[_0x8d1f('0x23')](respondWithFilteredResult(_0x4e7e41,_0x3c15de))[_0x8d1f('0x40')](handleError(_0x4e7e41,null));};exports[_0x8d1f('0x41')]=function(_0x345d19,_0x279e9a){var _0x1b8186={'raw':!![],'where':{'id':_0x345d19[_0x8d1f('0x42')]['id']}},_0x2d891e={};_0x2d891e['model']=_[_0x8d1f('0x30')](db[_0x8d1f('0x2a')]['rawAttributes']);_0x2d891e[_0x8d1f('0x2f')]=_[_0x8d1f('0x30')](_0x345d19[_0x8d1f('0x2f')]);_0x2d891e[_0x8d1f('0x31')]=_['intersection'](_0x2d891e['model'],_0x2d891e['query']);_0x1b8186['attributes']=_[_0x8d1f('0x33')](_0x2d891e[_0x8d1f('0x32')],qs['fields'](_0x345d19[_0x8d1f('0x2f')]['fields']));_0x1b8186['attributes']=_0x1b8186['attributes'][_0x8d1f('0x35')]?_0x1b8186[_0x8d1f('0x34')]:_0x2d891e[_0x8d1f('0x32')];if(_0x345d19[_0x8d1f('0x2f')]['includeAll']){_0x1b8186[_0x8d1f('0x3e')]=[{'all':!![]}];}_0x1b8186=_['merge']({},_0x1b8186,_0x345d19['options']);return db[_0x8d1f('0x2a')][_0x8d1f('0x43')](_0x1b8186)[_0x8d1f('0x23')](handleEntityNotFound(_0x279e9a,null))[_0x8d1f('0x23')](respondWithResult(_0x279e9a,null))[_0x8d1f('0x40')](handleError(_0x279e9a,null));};exports[_0x8d1f('0x44')]=function(_0x103957,_0x436125){return db[_0x8d1f('0x2a')]['create'](_0x103957[_0x8d1f('0x45')],{})[_0x8d1f('0x23')](respondWithResult(_0x436125,0xc9))[_0x8d1f('0x40')](handleError(_0x436125,null));};exports[_0x8d1f('0x21')]=function(_0x174093,_0x239111){if(_0x174093[_0x8d1f('0x45')]['id']){delete _0x174093[_0x8d1f('0x45')]['id'];}return db[_0x8d1f('0x2a')][_0x8d1f('0x43')]({'where':{'id':_0x174093[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x23')](handleEntityNotFound(_0x239111,null))[_0x8d1f('0x23')](saveUpdates(_0x174093[_0x8d1f('0x45')],null))[_0x8d1f('0x23')](respondWithResult(_0x239111,null))[_0x8d1f('0x40')](handleError(_0x239111,null));};exports['destroy']=function(_0x21a44a,_0xe7e4e3){return db[_0x8d1f('0x2a')][_0x8d1f('0x43')]({'where':{'id':_0x21a44a[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x23')](handleEntityNotFound(_0xe7e4e3,null))[_0x8d1f('0x23')](removeEntity(_0xe7e4e3,null))[_0x8d1f('0x40')](handleError(_0xe7e4e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 0d91ec4..cd30352 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 _0x43fd=['path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','moment','bluebird'];(function(_0x3212ab,_0x460399){var _0x3412e4=function(_0x40c8d7){while(--_0x40c8d7){_0x3212ab['push'](_0x3212ab['shift']());}};_0x3412e4(++_0x460399);}(_0x43fd,0x1ec));var _0xd43f=function(_0x45c04a,_0x208355){_0x45c04a=_0x45c04a-0x0;var _0x3cc695=_0x43fd[_0x45c04a];return _0x3cc695;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd43f('0x1'));var BPromise=require(_0xd43f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43f('0x3'));var rimraf=require('rimraf');var config=require(_0xd43f('0x4'));var attributes=require(_0xd43f('0x5'));module[_0xd43f('0x6')]=function(_0x33ddff,_0x52e75f){return _0x33ddff[_0xd43f('0x7')](_0xd43f('0x8'),attributes,{'tableName':_0xd43f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd43f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6bff=['bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','api'];(function(_0x5c8a11,_0x10805f){var _0x116b22=function(_0x10a697){while(--_0x10a697){_0x5c8a11['push'](_0x5c8a11['shift']());}};_0x116b22(++_0x10805f);}(_0x6bff,0xa6));var _0xf6bf=function(_0x2b6816,_0x5e7c8b){_0x2b6816=_0x2b6816-0x0;var _0x4710b7=_0x6bff[_0x2b6816];return _0x4710b7;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var moment=require('moment');var BPromise=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var fs=require('fs');var path=require(_0xf6bf('0x5'));var rimraf=require(_0xf6bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6bf('0x7'));module[_0xf6bf('0x8')]=function(_0x27cdda,_0x239d17){return _0x27cdda[_0xf6bf('0x9')](_0xf6bf('0xa'),attributes,{'tableName':_0xf6bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6bf('0xc'),'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 84ff11e..b833857 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 _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x54e356,_0x360588){var _0xd1b961=function(_0x2ab84f){while(--_0x2ab84f){_0x54e356['push'](_0x54e356['shift']());}};_0xd1b961(++_0x360588);}(_0xa8a8,0xec));var _0x8a8a=function(_0xe20d34,_0x2d817a){_0xe20d34=_0xe20d34-0x0;var _0xf7abe0=_0xa8a8[_0xe20d34];return _0xf7abe0;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xdace,0xc5));var _0xedac=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0xdace[_0x1dfa63];return _0x26f2a9;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 491d7d4..68dd461 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 _0x6050=['tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','describe','get','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x395c52,_0x5deff4){var _0x2a5ea4=function(_0x2c9893){while(--_0x2c9893){_0x395c52['push'](_0x395c52['shift']());}};_0x2a5ea4(++_0x5deff4);}(_0x6050,0x196));var _0x0605=function(_0x1db929,_0x2de4c2){_0x1db929=_0x1db929-0x0;var _0x50e042=_0x6050[_0x1db929];return _0x50e042;};'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('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['get'](_0x0605('0xf'),auth[_0x0605('0xd')](),controller[_0x0605('0x10')]);router[_0x0605('0xb')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')]('/',auth[_0x0605('0xd')](),controller[_0x0605('0x14')]);router[_0x0605('0x13')](_0x0605('0xf'),auth[_0x0605('0xd')](),controller[_0x0605('0x15')]);router[_0x0605('0x13')](_0x0605('0x16'),auth[_0x0605('0xd')](),interaction[_0x0605('0x17')](_0x0605('0x18'),'whatsappinteraction:addtags'),controller[_0x0605('0x19')]);router[_0x0605('0x1a')](_0x0605('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x0605('0x18'),_0x0605('0x1b')),controller[_0x0605('0x1c')]);router[_0x0605('0x1d')](_0x0605('0xc'),auth[_0x0605('0xd')](),interaction[_0x0605('0x17')](_0x0605('0x18'),_0x0605('0x1e')),controller[_0x0605('0x1f')]);router[_0x0605('0x1d')](_0x0605('0x16'),auth[_0x0605('0xd')](),controller[_0x0605('0x20')]);module['exports']=router; \ No newline at end of file +var _0x7046=['whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','update','delete'];(function(_0x31dfdd,_0x391df2){var _0x50a29a=function(_0x361c25){while(--_0x361c25){_0x31dfdd['push'](_0x31dfdd['shift']());}};_0x50a29a(++_0x391df2);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['download']);router[_0x6704('0x11')]('/',auth[_0x6704('0xa')](),controller['create']);router[_0x6704('0x11')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0x12')]);router[_0x6704('0x11')](_0x6704('0x13'),auth[_0x6704('0xa')](),interaction[_0x6704('0x14')](_0x6704('0x15'),'whatsappinteraction:addtags'),controller[_0x6704('0x16')]);router[_0x6704('0x17')](_0x6704('0x18'),auth['isAuthenticated'](),interaction[_0x6704('0x14')](_0x6704('0x15'),_0x6704('0x19')),controller[_0x6704('0x1a')]);router[_0x6704('0x1b')]('/:id',auth[_0x6704('0xa')](),interaction[_0x6704('0x14')](_0x6704('0x15'),_0x6704('0x1c')),controller[_0x6704('0x1d')]);router['delete'](_0x6704('0x13'),auth[_0x6704('0xa')](),controller[_0x6704('0x1e')]);module[_0x6704('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index e621f54..97720a4 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 _0x3079=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x5767b2,_0x4da302){var _0x5c746a=function(_0x518061){while(--_0x518061){_0x5767b2['push'](_0x5767b2['shift']());}};_0x5c746a(++_0x4da302);}(_0x3079,0x110));var _0x9307=function(_0x5ac6d9,_0x28cdea){_0x5ac6d9=_0x5ac6d9-0x0;var _0x3eea6e=_0x3079[_0x5ac6d9];return _0x3eea6e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9307('0x0'));module[_0x9307('0x1')]={'closed':{'type':Sequelize[_0x9307('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9307('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9307('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9307('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9307('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in',_0x9307('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9307('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5398=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x5398,0xe2));var _0x8539=function(_0x3cd97d,_0x400ff2){_0x3cd97d=_0x3cd97d-0x0;var _0x54ac9a=_0x5398[_0x3cd97d];return _0x54ac9a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8539('0x0'));module[_0x8539('0x1')]={'closed':{'type':Sequelize[_0x8539('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8539('0x3')]},'disposition':{'type':Sequelize[_0x8539('0x4')]},'secondDisposition':{'type':Sequelize[_0x8539('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8539('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8539('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8539('0x5')]('in',_0x8539('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8539('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8539('0x5')]('in',_0x8539('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index fe7678a..be0f6dc 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 _0xc113=['total','index','WhatsappInteraction','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','tools_tags','select','u.id','left_join','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','params','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','pick','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closedAt','disposition','filter','basename','pipe','createWriteStream','direction','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','Users','fullname','Tags','TagIds','split','forEach','catch','talking','answered','unmanaged','closed','waiting','UserId'];(function(_0x54eff2,_0x327673){var _0x1a9f2a=function(_0x484a76){while(--_0x484a76){_0x54eff2['push'](_0x54eff2['shift']());}};_0x1a9f2a(++_0x327673);}(_0xc113,0x1ab));var _0x3c11=function(_0x3a871e,_0x35a706){_0x3a871e=_0x3a871e-0x0;var _0x25d571=_0xc113[_0x3a871e];return _0x25d571;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require(_0x3c11('0x2'));var jsonpatch=require(_0x3c11('0x3'));var rp=require(_0x3c11('0x4'));var moment=require(_0x3c11('0x5'));var BPromise=require(_0x3c11('0x6'));var Mustache=require(_0x3c11('0x7'));var util=require(_0x3c11('0x8'));var path=require('path');var sox=require(_0x3c11('0x9'));var csv=require(_0x3c11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require(_0x3c11('0xc'));var squel=require(_0x3c11('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c11('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3c11('0x11'));var as=require(_0x3c11('0x12'));var pdf=require(_0x3c11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c11('0x14'))(_0x3c11('0x15'));var utils=require(_0x3c11('0x16'));var config=require(_0x3c11('0x17'));var licenseUtil=require(_0x3c11('0x18'));var db=require('../../mysqldb')['db'];config[_0x3c11('0x19')]=_[_0x3c11('0x1a')](config['redis'],{'host':_0x3c11('0x1b'),'port':0x18eb});var socket=require(_0x3c11('0x1c'))(new Redis(config[_0x3c11('0x19')]));require(_0x3c11('0x1d'))[_0x3c11('0x1e')](socket);function respondWithStatusCode(_0x546338,_0xb33319){_0xb33319=_0xb33319||0xcc;return function(_0x2ba437){if(_0x2ba437){return _0x546338[_0x3c11('0x1f')](_0xb33319);}return _0x546338[_0x3c11('0x20')](_0xb33319)[_0x3c11('0x21')]();};}function respondWithResult(_0x5b223f,_0x51ee19){_0x51ee19=_0x51ee19||0xc8;return function(_0x575e69){if(_0x575e69){return _0x5b223f[_0x3c11('0x20')](_0x51ee19)[_0x3c11('0x22')](_0x575e69);}};}function respondWithFilteredResult(_0x474c59,_0x42db8d){return function(_0x1a80a5){if(_0x1a80a5){var _0x35d32f=typeof _0x42db8d[_0x3c11('0x23')]===_0x3c11('0x24')&&typeof _0x42db8d[_0x3c11('0x25')]==='undefined';var _0x4f5f3d=_0x1a80a5[_0x3c11('0x26')];var _0x483d5c=_0x35d32f?0x0:_0x42db8d[_0x3c11('0x23')];var _0x5540b7=_0x35d32f?_0x1a80a5[_0x3c11('0x26')]:_0x42db8d['offset']+_0x42db8d[_0x3c11('0x25')];var _0x4c1759;if(_0x5540b7>=_0x4f5f3d){_0x5540b7=_0x4f5f3d;_0x4c1759=0xc8;}else{_0x4c1759=0xce;}_0x474c59['status'](_0x4c1759);return _0x474c59[_0x3c11('0x27')]('Content-Range',_0x483d5c+'-'+_0x5540b7+'/'+_0x4f5f3d)[_0x3c11('0x22')](_0x1a80a5);}return null;};}function patchUpdates(_0x3695e1){return function(_0xf29434){try{jsonpatch[_0x3c11('0x28')](_0xf29434,_0x3695e1,!![]);}catch(_0x1a8fd4){return BPromise['reject'](_0x1a8fd4);}return _0xf29434[_0x3c11('0x29')]();};}function saveUpdates(_0x4993de,_0x32a0ee){return function(_0x414c02){if(_0x414c02){return _0x414c02['update'](_0x4993de)[_0x3c11('0x2a')](function(_0x20ec9b){return _0x20ec9b;});}return null;};}function removeEntity(_0x2ff8bc,_0x2df95d){return function(_0xd42228){if(_0xd42228){return _0xd42228[_0x3c11('0x2b')]()[_0x3c11('0x2a')](function(){_0x2ff8bc[_0x3c11('0x20')](0xcc)[_0x3c11('0x21')]();});}};}function handleEntityNotFound(_0x3d638c,_0x500073){return function(_0x1a0154){if(!_0x1a0154){_0x3d638c[_0x3c11('0x1f')](0x194);}return _0x1a0154;};}function handleError(_0x3cdf77,_0x9cc373){_0x9cc373=_0x9cc373||0x1f4;return function(_0x50aec6){logger[_0x3c11('0x2c')](_0x50aec6[_0x3c11('0x2d')]);if(_0x50aec6['name']){delete _0x50aec6[_0x3c11('0x2e')];}_0x3cdf77[_0x3c11('0x20')](_0x9cc373)[_0x3c11('0x2f')](_0x50aec6);};}function getInteractionUsers(_0x661068,_0x36a5b4){return new BPromise(function(_0x1e4834,_0x3c5377){try{if(_0x36a5b4[_0x661068['id']]){_0x661068[_0x3c11('0x30')]=_['map'](_0x36a5b4[_0x661068['id']],function(_0x40030d){return{'id':_0x40030d['id'],'fullname':_0x40030d[_0x3c11('0x31')]};});}}catch(_0x1ec787){_0x3c5377(_0x1ec787);}_0x1e4834(_0x661068);});}function getInteractionTags(_0x2d0195,_0xf17e98){return new BPromise(function(_0x196623,_0x12d644){try{if(_0x2d0195['TagIds']){_0x2d0195[_0x3c11('0x32')]=[];_0x2d0195[_0x3c11('0x33')][_0x3c11('0x34')](',')[_0x3c11('0x35')](function(_0xd8a8f2){_0x2d0195[_0x3c11('0x32')]['push'](_0xf17e98[_0xd8a8f2]);});}delete _0x2d0195[_0x3c11('0x33')];}catch(_0x47a450){_0x12d644(_0x47a450);}_0x196623(_0x2d0195);});}function updateWhatsappInteraction(_0x4c374f,_0x325fd9,_0x392790){return new BPromise(function(_0x5140d4,_0x31d88d){return getInteractionUsers(_0x4c374f,_0x392790)[_0x3c11('0x2a')](function(_0x19b137){return getInteractionTags(_0x19b137,_0x325fd9);})['then'](function(_0x2ec870){return getStateInteraction(_0x2ec870);})[_0x3c11('0x2a')](function(_0x25e4d6){_0x5140d4(_0x25e4d6);})[_0x3c11('0x36')](function(_0x482d92){_0x31d88d(_0x482d92);});});}function getStateInteraction(_0x199ab9){return new BPromise(function(_0x3e42bf){_0x199ab9['waiting']=0x0;_0x199ab9[_0x3c11('0x37')]=0x0;_0x199ab9[_0x3c11('0x38')]=0x0;_0x199ab9[_0x3c11('0x39')]=0x0;_0x199ab9['total']=0x0;if(!_0x199ab9[_0x3c11('0x3a')]&&!_0x199ab9['UserId']){_0x199ab9[_0x3c11('0x3b')]+=0x1;}if(!_0x199ab9['closed']&&_0x199ab9['UserId']){_0x199ab9[_0x3c11('0x37')]+=0x1;if(_0x199ab9['waiting']){_0x199ab9[_0x3c11('0x3b')]-=0x1;}}if(_0x199ab9['closed']&&_0x199ab9[_0x3c11('0x3c')]){_0x199ab9[_0x3c11('0x38')]+=0x1;if(_0x199ab9['talking']){_0x199ab9[_0x3c11('0x37')]-=0x1;}}if(_0x199ab9['closed']&&!_0x199ab9[_0x3c11('0x3c')]){_0x199ab9[_0x3c11('0x39')]+=0x1;if(_0x199ab9[_0x3c11('0x3b')]){_0x199ab9['waiting']-=0x1;}}_0x199ab9[_0x3c11('0x3d')]+=0x1;_0x3e42bf(_0x199ab9);});}exports[_0x3c11('0x3e')]=function(_0x16776e,_0x1ffd36){var _0x1859ce={},_0x2ccc27={},_0x3009e2={'count':0x0,'rows':[]};var _0x155d35=_['map'](db[_0x3c11('0x3f')][_0x3c11('0x40')],function(_0x63e7b6){return{'name':_0x63e7b6['fieldName'],'type':_0x63e7b6['type']['key']};});_0x2ccc27[_0x3c11('0x41')]=_[_0x3c11('0x42')](_0x155d35,_0x3c11('0x2e'));_0x2ccc27['query']=_['keys'](_0x16776e[_0x3c11('0x43')]);_0x2ccc27[_0x3c11('0x44')]=_[_0x3c11('0x45')](_0x2ccc27[_0x3c11('0x41')],_0x2ccc27[_0x3c11('0x43')]);_0x1859ce[_0x3c11('0x46')]=_[_0x3c11('0x45')](_0x2ccc27[_0x3c11('0x41')],qs[_0x3c11('0x47')](_0x16776e['query'][_0x3c11('0x47')]));_0x1859ce[_0x3c11('0x46')]=_0x1859ce[_0x3c11('0x46')][_0x3c11('0x48')]?_0x1859ce[_0x3c11('0x46')]:_0x2ccc27[_0x3c11('0x41')];if(!_0x16776e[_0x3c11('0x43')][_0x3c11('0x49')](_0x3c11('0x4a'))){_0x1859ce[_0x3c11('0x25')]=qs['limit'](_0x16776e[_0x3c11('0x43')][_0x3c11('0x25')]);_0x1859ce[_0x3c11('0x23')]=qs['offset'](_0x16776e[_0x3c11('0x43')][_0x3c11('0x23')]);}_0x1859ce[_0x3c11('0x4b')]=qs[_0x3c11('0x4c')](_0x16776e['query']['sort']);_0x1859ce[_0x3c11('0x4d')]=qs[_0x3c11('0x44')](_['pick'](_0x16776e[_0x3c11('0x43')],_0x2ccc27[_0x3c11('0x44')]),_0x155d35);var _0x2e2398=[];var _0x2b3224=squel['select']()['field']('id')[_0x3c11('0x4e')](_0x3c11('0x2e'))[_0x3c11('0x4e')](_0x3c11('0x4f'))['from'](_0x3c11('0x50'));var _0x22bcae=squel[_0x3c11('0x51')]()[_0x3c11('0x4e')](_0x3c11('0x52'))[_0x3c11('0x4e')]('u.fullname')['field']('ui.WhatsappInteractionId')['from']('user_has_whatsapp_interactions','ui')[_0x3c11('0x53')]('users','u','u.id\x20=\x20ui.UserId');var _0x21643a=squel[_0x3c11('0x51')]()['from'](_0x3c11('0x54'),'i')['left_join'](_0x3c11('0x55'),'c',_0x3c11('0x56'))[_0x3c11('0x53')](_0x3c11('0x57'),'o','o.id\x20=\x20i.UserId')[_0x3c11('0x53')](_0x3c11('0x58'),'a',_0x3c11('0x59'))[_0x3c11('0x53')]('whatsapp_messages','me',_0x3c11('0x5a'))['left_join'](_0x3c11('0x5b'),'it',_0x3c11('0x5c'))[_0x3c11('0x53')](_0x3c11('0x50'),'t',_0x3c11('0x5d'));var _0x457571=squel[_0x3c11('0x5e')]();var _0x4e1c98=[];var _0x31dc5b=squel[_0x3c11('0x5e')]();var _0x58a9a0;if(_0x16776e[_0x3c11('0x43')]['search']){_0x58a9a0=as['parseSearch'](_0x16776e[_0x3c11('0x43')][_0x3c11('0x5f')]);var _0x36f1bd=_0x58a9a0[_0x3c11('0x60')];for(var _0x531ebf=0x0;_0x531ebf<_0x58a9a0['conditions'][_0x3c11('0x48')];_0x531ebf++){var _0x31e6d8=_0x58a9a0[_0x3c11('0x61')][_0x531ebf];var _0x29c783='i';var _0x1dd01c=_[_0x3c11('0x62')](_0x155d35,[_0x3c11('0x2e'),_0x31e6d8[_0x3c11('0x4e')]]);if(!_0x1dd01c){switch(_0x31e6d8[_0x3c11('0x4e')]){case _0x3c11('0x63'):if(_0x31e6d8[_0x3c11('0x64')]==0x1){_0x21643a[_0x3c11('0x65')]('`'+_0x31e6d8['field']+'`\x20=\x200');}else{_0x21643a['having']('`'+_0x31e6d8[_0x3c11('0x4e')]+'`\x20>\x200');}break;case _0x3c11('0x66'):if(_0x31e6d8[_0x3c11('0x67')]==='$substring'){if(_0x31e6d8[_0x3c11('0x64')][_0x3c11('0x34')]('\x20')[_0x3c11('0x48')]>0x1){_0x457571[_0x36f1bd](_0x3c11('0x68'),qs[_0x3c11('0x69')](_0x31e6d8['value']),null);}else{var _0x429d95='%'+_0x31e6d8[_0x3c11('0x64')]+'%';_0x457571[_0x36f1bd](_0x3c11('0x6a'),_0x429d95,_0x429d95,_0x429d95);}}else{_0x1dd01c=_[_0x3c11('0x62')](_0x155d35,['name',_0x3c11('0x6b')]);_0x31e6d8[_0x3c11('0x4e')]='ContactId';_0x152f5a=as[_0x3c11('0x6c')](_0x29c783,_0x1dd01c[_0x3c11('0x6d')],_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a[_0x3c11('0x6e')],_0x152f5a[_0x3c11('0x64')]['start'],_0x152f5a['value']['end']);}break;case'Tag':var _0xb6bf30=_0x31e6d8[_0x3c11('0x64')]['split'](',')['map'](function(_0x28d93a){return Number(_0x28d93a);});_0xb6bf30[_0x3c11('0x35')](function(_0x2815ca){_0x31dc5b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2815ca+',%');});_0x4e1c98=_['union'](_0x4e1c98,_0xb6bf30);break;case'User':if(_0x31e6d8[_0x3c11('0x67')]===_0x3c11('0x6f')){_0x457571[_0x36f1bd](_0x3c11('0x70'),'%'+_0x31e6d8[_0x3c11('0x64')]+'%',null);}else{_0x1dd01c=_['find'](_0x155d35,[_0x3c11('0x2e'),'UserId']);_0x31e6d8[_0x3c11('0x4e')]=_0x3c11('0x3c');_0x152f5a=as[_0x3c11('0x6c')](_0x29c783,_0x1dd01c[_0x3c11('0x6d')],_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a[_0x3c11('0x6e')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x71')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x21')]);}break;case _0x3c11('0x72'):_0x152f5a=as[_0x3c11('0x6c')]('me',null,_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a['text'],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x71')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x21')]);break;}}else{var _0x152f5a=as['buildExpression'](_0x29c783,_0x1dd01c[_0x3c11('0x6d')],_0x31e6d8);_0x457571[_0x36f1bd](_0x152f5a[_0x3c11('0x6e')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x71')],_0x152f5a[_0x3c11('0x64')][_0x3c11('0x21')]);}}}else{var _0x58f420=_(_0x16776e[_0x3c11('0x43')])['keys']()['map'](function(_0x4ae4ba){return _[_0x3c11('0x73')](_0x155d35,[_0x3c11('0x2e'),_0x4ae4ba])?_0x4ae4ba:undefined;})[_0x3c11('0x74')]()[_0x3c11('0x64')]();if(!_[_0x3c11('0x75')](_0x58f420)){_0x58f420['forEach'](function(_0x2ccccb){if(_0x2ccccb==='WhatsappAccountId'){_0x21643a['where']('i.WhatsappAccountId\x20IN\x20?',[][_0x3c11('0x76')](_0x16776e[_0x3c11('0x43')][_0x2ccccb]));}else if(_0x2ccccb===_0x3c11('0x77')){var _0x1bb682=JSON['parse'](_0x16776e[_0x3c11('0x43')][_0x2ccccb])['$gte'];var _0x9791fe=JSON[_0x3c11('0x78')](_0x16776e['query'][_0x2ccccb])[_0x3c11('0x79')];_0x21643a[_0x3c11('0x4d')](_0x3c11('0x7a'),_0x1bb682,_0x9791fe);}else{if(_0x16776e['query'][_0x2ccccb]===_0x3c11('0x7b')){_0x21643a[_0x3c11('0x4d')]('i.'+_0x2ccccb+_0x3c11('0x7c'));}else{_0x21643a[_0x3c11('0x4d')]('i.'+_0x2ccccb+_0x3c11('0x7d'),_0x16776e[_0x3c11('0x43')][_0x2ccccb]);}}});}if(_0x16776e[_0x3c11('0x43')][_0x3c11('0x7e')]){if(_0x16776e['query'][_0x3c11('0x7e')]==0x1){_0x21643a[_0x3c11('0x65')](_0x3c11('0x7f'));}else{_0x21643a[_0x3c11('0x65')](_0x3c11('0x80'));}}if(_0x16776e['query'][_0x3c11('0x81')]){_0x4e1c98=_[_0x3c11('0x82')](_0x16776e[_0x3c11('0x43')]['tag'])?_0x16776e[_0x3c11('0x43')][_0x3c11('0x81')]:new Array(_0x16776e['query'][_0x3c11('0x81')]);_0x4e1c98[_0x3c11('0x35')](function(_0x21a2b0){_0x31dc5b['or'](_0x3c11('0x83'),'%,'+_0x21a2b0+',%');});}if(_0x16776e[_0x3c11('0x43')]['filter']){var _0x423fad=_0x16776e[_0x3c11('0x43')]['filter'][_0x3c11('0x84')]('\x5c','\x5c\x5c')[_0x3c11('0x84')](/'/g,'\x27\x27');if(qs[_0x3c11('0x85')](_0x423fad)){_0x457571['or'](_0x3c11('0x86'),_0x423fad+'%')['or'](_0x3c11('0x87'),_0x423fad+'%');}else{_0x457571['or'](_0x3c11('0x88'),qs[_0x3c11('0x69')](_0x423fad))['or'](_0x3c11('0x89'),_0x423fad+'%');}}}_0x21643a[_0x3c11('0x4d')](_0x457571);_0x21643a[_0x3c11('0x8a')](_0x3c11('0x8b'));var _0x1822e1={'type':db[_0x3c11('0x8c')][_0x3c11('0x8d')][_0x3c11('0x8e')],'raw':!![]};var _0x15b648=_0x21643a[_0x3c11('0x8f')]();_0x15b648['field'](_0x3c11('0x8b'));_0x15b648[_0x3c11('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3c11('0x63'));if(_0x1859ce['order']){_0x1859ce[_0x3c11('0x4b')][_0x3c11('0x35')](function(_0x3603d1){var _0x342ba2=_0x3603d1[0x0]===_0x3c11('0x90')?_0x3603d1[0x0]:'i.'+_0x3603d1[0x0];_0x21643a[_0x3c11('0x4b')](_0x342ba2,_0x3603d1[0x1]===_0x3c11('0x91')?![]:!![]);});}if(!_[_0x3c11('0x75')](_0x4e1c98)){_0x21643a[_0x3c11('0x65')](_0x31dc5b);_0x15b648[_0x3c11('0x4d')](_0x3c11('0x92'),_0x4e1c98);}BPromise[_0x3c11('0x93')]()['then'](function(){if(!_0x58a9a0){if(_0x16776e[_0x3c11('0x43')][_0x3c11('0x94')])return;_0x15b648[_0x3c11('0x4d')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x21643a[_0x3c11('0x4d')](_0x3c11('0x95'));return;}if(_0x16776e[_0x3c11('0x96')][_0x3c11('0x97')]!==_0x3c11('0x98'))return;return _0x16776e['user'][_0x3c11('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ab45f){if(_[_0x3c11('0x75')](_0x3ab45f)){_0x15b648['where'](_0x3c11('0x9a'));_0x21643a['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x15b648[_0x3c11('0x4d')]('i.WhatsappAccountId\x20IN\x20?',_[_0x3c11('0x42')](_0x3ab45f,'id'));_0x21643a[_0x3c11('0x4d')](_0x3c11('0x9b'),_[_0x3c11('0x42')](_0x3ab45f,'id'));}});})[_0x3c11('0x2a')](function(){if(_0x16776e[_0x3c11('0x96')]['role']===_0x3c11('0x98')&&!_0x58a9a0&&!_0x16776e[_0x3c11('0x43')][_0x3c11('0x94')])return[];return db['sequelize'][_0x3c11('0x43')](_0x15b648[_0x3c11('0x9c')](),_0x1822e1);})[_0x3c11('0x2a')](function(_0x6479f8){_0x3009e2[_0x3c11('0x26')]=_0x6479f8[_0x3c11('0x48')];if(_0x3009e2[_0x3c11('0x26')]===0x0)return[];return db[_0x3c11('0x9d')][_0x3c11('0x43')](_0x2b3224[_0x3c11('0x9c')](),_0x1822e1)[_0x3c11('0x2a')](function(_0xc3d81f){_0x2e2398=_[_0x3c11('0x9e')](_0xc3d81f,'id');_0x1822e1=_['merge'](_0x1822e1,{'model':db[_0x3c11('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16776e['query'][_0x3c11('0x47')]){_0x1859ce[_0x3c11('0x46')][_0x3c11('0x35')](function(_0x2a01cf){_0x21643a[_0x3c11('0x4e')]('i.'+_0x2a01cf);});}else{_0x21643a[_0x3c11('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x21643a[_0x3c11('0x4e')]('a.key',_0x3c11('0x9f'));_0x21643a['field'](_0x3c11('0xa0'),_0x3c11('0xa1'));_0x21643a[_0x3c11('0x4e')]('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');_0x21643a[_0x3c11('0x4e')]('i.*');_0x21643a[_0x3c11('0x4e')](_0x3c11('0xa2'),_0x3c11('0xa3'));_0x21643a['field'](_0x3c11('0xa4'),_0x3c11('0xa5'));_0x21643a[_0x3c11('0x4e')](_0x3c11('0xa6'),'Contact.email');_0x21643a['field']('c.phone',_0x3c11('0xa7'));_0x21643a['field'](_0x3c11('0xa8'),'Contact.mobile');_0x21643a[_0x3c11('0x4e')]('c.fax','Contact.fax');_0x21643a[_0x3c11('0x4e')](_0x3c11('0xa9'),_0x3c11('0xaa'));_0x21643a[_0x3c11('0x4e')](_0x3c11('0xab'),_0x3c11('0xac'));_0x21643a[_0x3c11('0x4e')](_0x3c11('0xad'),_0x3c11('0x33'));}if(_0x1859ce[_0x3c11('0x25')])_0x21643a[_0x3c11('0x25')](_0x1859ce[_0x3c11('0x25')]);if(_0x1859ce[_0x3c11('0x23')])_0x21643a['offset'](_0x1859ce['offset']);return db[_0x3c11('0x9d')][_0x3c11('0x43')](_0x21643a['toString'](),_0x1822e1);})[_0x3c11('0x2a')](function(_0x5a5d40){if(_0x5a5d40[_0x3c11('0x48')]>0x0)_0x22bcae[_0x3c11('0x4d')](_0x3c11('0xae'),_[_0x3c11('0x42')](_0x5a5d40,'id'));return db['sequelize'][_0x3c11('0x43')](_0x22bcae[_0x3c11('0x9c')](),_0x1822e1)[_0x3c11('0x2a')](function(_0x57c20f){var _0x635b51=_[_0x3c11('0xaf')](_0x57c20f,_0x3c11('0xb0'));var _0x1fdf2f=[];_0x5a5d40[_0x3c11('0x35')](function(_0x258f84){_0x1fdf2f[_0x3c11('0xb1')](updateWhatsappInteraction(_0x258f84,_0x2e2398,_0x635b51));});return BPromise[_0x3c11('0xb2')](_0x1fdf2f);});});})[_0x3c11('0x2a')](function(_0x299aaf){_0x3009e2[_0x3c11('0xb3')]=_0x299aaf;return _0x3009e2;})[_0x3c11('0x2a')](respondWithFilteredResult(_0x1ffd36,_0x1859ce))[_0x3c11('0x36')](handleError(_0x1ffd36,null));};exports['show']=function(_0x5a4714,_0x4ad9b0){var _0x5f1c09={'raw':![],'where':{'id':_0x5a4714[_0x3c11('0xb4')]['id']}},_0x4dc93a={};_0x4dc93a[_0x3c11('0x41')]=_['keys'](db[_0x3c11('0x3f')][_0x3c11('0x40')]);_0x4dc93a[_0x3c11('0x43')]=_['keys'](_0x5a4714['query']);_0x4dc93a[_0x3c11('0x44')]=_[_0x3c11('0x45')](_0x4dc93a[_0x3c11('0x41')],_0x4dc93a['query']);_0x5f1c09[_0x3c11('0x46')]=_[_0x3c11('0x45')](_0x4dc93a[_0x3c11('0x41')],qs[_0x3c11('0x47')](_0x5a4714[_0x3c11('0x43')][_0x3c11('0x47')]));_0x5f1c09[_0x3c11('0x46')]=_0x5f1c09[_0x3c11('0x46')][_0x3c11('0x48')]?_0x5f1c09[_0x3c11('0x46')]:_0x4dc93a[_0x3c11('0x41')];if(_0x5a4714[_0x3c11('0x43')][_0x3c11('0xb5')]){_0x5f1c09[_0x3c11('0xb6')]=[{'all':!![]}];}_0x5f1c09=_['merge']({},_0x5f1c09,_0x5a4714[_0x3c11('0xb7')]);return db['WhatsappInteraction']['find'](_0x5f1c09)[_0x3c11('0x2a')](handleEntityNotFound(_0x4ad9b0,null))['then'](respondWithResult(_0x4ad9b0,null))[_0x3c11('0x36')](handleError(_0x4ad9b0,null));};exports[_0x3c11('0xb8')]=function(_0x4b3aaf,_0x9e2d92){return db[_0x3c11('0x3f')][_0x3c11('0xb8')](_0x4b3aaf['body'],{})[_0x3c11('0x2a')](respondWithResult(_0x9e2d92,0xc9))[_0x3c11('0x36')](handleError(_0x9e2d92,null));};exports[_0x3c11('0xb9')]=function(_0x180501,_0x4ae013){if(_0x180501[_0x3c11('0x72')]['id']){delete _0x180501['body']['id'];}return db['WhatsappInteraction'][_0x3c11('0x62')]({'where':{'id':_0x180501['params']['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x4ae013,null))[_0x3c11('0x2a')](saveUpdates(_0x180501[_0x3c11('0x72')],null))[_0x3c11('0x2a')](respondWithResult(_0x4ae013,null))[_0x3c11('0x36')](handleError(_0x4ae013,null));};exports[_0x3c11('0x2b')]=function(_0x12b432,_0x4a82d4){return db[_0x3c11('0x3f')][_0x3c11('0x62')]({'where':{'id':_0x12b432[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x4a82d4,null))[_0x3c11('0x2a')](removeEntity(_0x4a82d4,null))[_0x3c11('0x36')](handleError(_0x4a82d4,null));};exports[_0x3c11('0xba')]=function(_0x3251cb,_0x4b71ba){return db[_0x3c11('0x3f')][_0x3c11('0xba')]()[_0x3c11('0x2a')](respondWithResult(_0x4b71ba,null))[_0x3c11('0x36')](handleError(_0x4b71ba,null));};exports[_0x3c11('0xbb')]=function(_0x2ce7fb,_0x3a5996,_0x69719a){return db[_0x3c11('0xbc')][_0x3c11('0x62')]({'where':{'id':_0x2ce7fb[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x3a5996,null))['then'](function(_0x22355b){if(_0x22355b){return _0x22355b[_0x3c11('0xbb')](_0x2ce7fb[_0x3c11('0x72')][_0x3c11('0xbd')],_['omit'](_0x2ce7fb[_0x3c11('0x72')],[_0x3c11('0xbd'),'id'])||{});}})[_0x3c11('0x2a')](respondWithResult(_0x3a5996,null))[_0x3c11('0x36')](handleError(_0x3a5996,null));};exports[_0x3c11('0xbe')]=function(_0xf9fdcf,_0x456382,_0x140461){var _0x36adbb={'raw':![],'where':{}};var _0x30bc31={};var _0xef0942={'count':0x0,'rows':[]};return db[_0x3c11('0x3f')][_0x3c11('0xbf')]({'where':{'id':_0xf9fdcf['params']['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x456382,null))[_0x3c11('0x2a')](function(_0x477260){if(_0x477260){_0x30bc31['model']=_['keys'](db[_0x3c11('0xbc')][_0x3c11('0x40')]);_0x30bc31[_0x3c11('0x43')]=_['keys'](_0xf9fdcf[_0x3c11('0x43')]);_0x30bc31[_0x3c11('0x44')]=_[_0x3c11('0x45')](_0x30bc31[_0x3c11('0x41')],_0x30bc31['query']);_0x36adbb[_0x3c11('0x46')]=_[_0x3c11('0x45')](_0x30bc31[_0x3c11('0x41')],qs[_0x3c11('0x47')](_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0x47')]));_0x36adbb[_0x3c11('0x46')]=_0x36adbb[_0x3c11('0x46')][_0x3c11('0x48')]?_0x36adbb[_0x3c11('0x46')]:_0x30bc31['model'];if(!_0xf9fdcf['query'][_0x3c11('0x49')](_0x3c11('0x4a'))){_0x36adbb[_0x3c11('0x25')]=qs['limit'](_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0x25')]);_0x36adbb[_0x3c11('0x23')]=qs['offset'](_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0x23')]);}_0x36adbb['order']=qs['sort'](_0xf9fdcf['query'][_0x3c11('0x4c')]);_0x36adbb[_0x3c11('0x4d')]=qs['filters'](_[_0x3c11('0xc0')](_0xf9fdcf[_0x3c11('0x43')],_0x30bc31[_0x3c11('0x44')]));_0x36adbb[_0x3c11('0x4d')][_0x3c11('0xb0')]=_0x477260['id'];if(_0xf9fdcf[_0x3c11('0x43')]['filter']){_0x36adbb[_0x3c11('0x4d')]=_[_0x3c11('0xc1')](_0x36adbb[_0x3c11('0x4d')],{'$or':_['map'](_0x36adbb['attributes'],function(_0x30674e){var _0x18e2b5={};_0x18e2b5[_0x30674e]={'$like':'%'+_0xf9fdcf[_0x3c11('0x43')]['filter']+'%'};return _0x18e2b5;})});}if(_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0xc2')]){var _0x2ee6b3=_0xf9fdcf[_0x3c11('0x43')][_0x3c11('0xc2')][_0x3c11('0x34')](',');var _0x327050={};_0x327050[_0x2ee6b3[0x0]]={'$gte':moment(_0x2ee6b3[0x1])[_0x3c11('0xc3')](_0x3c11('0xc4'))};_0x36adbb['where']=_[_0x3c11('0xc1')](_0x36adbb['where'],_0x327050);}_0x36adbb=_[_0x3c11('0xc1')]({},_0x36adbb,_0xf9fdcf[_0x3c11('0xb7')]);return db[_0x3c11('0xbc')][_0x3c11('0x26')]({'where':_0x36adbb[_0x3c11('0x4d')]})[_0x3c11('0x2a')](function(_0x352121){_0xef0942[_0x3c11('0x26')]=_0x352121;if(_0xf9fdcf[_0x3c11('0x43')]['includeAll']){_0x36adbb[_0x3c11('0xb6')]=[{'all':!![]}];}return db[_0x3c11('0xbc')]['findAll'](_0x36adbb);})[_0x3c11('0x2a')](function(_0x287f02){_0xef0942['rows']=_0x287f02;return _0xef0942;});}})[_0x3c11('0x2a')](respondWithFilteredResult(_0x456382,_0x36adbb))[_0x3c11('0x36')](handleError(_0x456382,null));};exports[_0x3c11('0xc5')]=function(_0x31d373,_0x57948a,_0x542443){return db[_0x3c11('0x3f')][_0x3c11('0x62')]({'where':{'id':_0x31d373[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x57948a,null))[_0x3c11('0x2a')](function(_0x5500cc){if(_0x5500cc){return _0x5500cc[_0x3c11('0xc6')](_0x31d373[_0x3c11('0x72')][_0x3c11('0xbd')],_[_0x3c11('0xc7')](_0x31d373[_0x3c11('0x72')],[_0x3c11('0xbd'),'id'])||{})[_0x3c11('0xc8')](function(){return db[_0x3c11('0xc9')][_0x3c11('0xca')]({'attributes':['id',_0x3c11('0x2e'),'color'],'where':{'id':_0x31d373[_0x3c11('0x72')][_0x3c11('0xbd')]}});})[_0x3c11('0x2a')](function(_0x370db5){socket[_0x3c11('0xcb')](_0x3c11('0xcc'),{'id':Number(_0x31d373[_0x3c11('0xb4')]['id']),'tags':_0x370db5||[]});return{'id':Number(_0x31d373['params']['id']),'tags':_0x370db5||[]};});}})[_0x3c11('0x2a')](respondWithResult(_0x57948a,null))[_0x3c11('0x36')](handleError(_0x57948a,null));};exports['removeTags']=function(_0x504a06,_0x4ea809,_0x45994e){return db[_0x3c11('0x3f')]['find']({'where':{'id':_0x504a06[_0x3c11('0xb4')]['id']}})[_0x3c11('0x2a')](handleEntityNotFound(_0x4ea809,null))['then'](function(_0x17aa46){if(_0x17aa46){return _0x17aa46[_0x3c11('0xcd')](_0x504a06[_0x3c11('0x43')][_0x3c11('0xbd')]);}})['then'](respondWithStatusCode(_0x4ea809,null))[_0x3c11('0x36')](handleError(_0x4ea809,null));};exports[_0x3c11('0xce')]=function(_0x1c39f2,_0xc1419b){var _0x255d55=moment()[_0x3c11('0xcf')]()[_0x3c11('0x9c')]();var _0x1f6bc9=path[_0x3c11('0xd0')](config['root'],'server',_0x3c11('0xd1'),_0x3c11('0xd2'));var _0x300e0c=path[_0x3c11('0xd0')](config[_0x3c11('0xd3')],_0x3c11('0xd4'),_0x3c11('0xd1'),'attachments');var _0x1a9c9a=path[_0x3c11('0xd0')](_0x1f6bc9,_0x255d55);var _0x48157d=util[_0x3c11('0xc3')](_0x3c11('0xd5'),_0x1c39f2[_0x3c11('0xb4')]['id'],_0x255d55);var _0x317df7=path[_0x3c11('0xd0')](_0x1f6bc9,_0x48157d);var _0x2bbad0=[];_0x2bbad0[_0x3c11('0xb1')]({'model':db[_0x3c11('0xd6')],'as':_0x3c11('0xd6'),'attributes':['id',_0x3c11('0x31')],'raw':!![]});_0x2bbad0[_0x3c11('0xb1')]({'model':db[_0x3c11('0xd7')],'as':_0x3c11('0x66'),'attributes':['id','firstName',_0x3c11('0xd8')],'raw':!![]});if(_0x1c39f2[_0x3c11('0x43')]['attachments']){_0x2bbad0[_0x3c11('0xb1')]({'model':db[_0x3c11('0xd9')],'as':_0x3c11('0xd9'),'raw':!![]});}var _0x43aa78=[{'model':db[_0x3c11('0xbc')],'as':_0x3c11('0xda'),'attributes':['id','body','createdAt','direction',_0x3c11('0xdb'),_0x3c11('0x7e')],'include':_0x2bbad0}];_0x43aa78[_0x3c11('0xb1')]({'model':db[_0x3c11('0xdc')],'as':_0x3c11('0xdd'),'attributes':['id','name']});_0x43aa78[_0x3c11('0xb1')]({'model':db['User'],'as':_0x3c11('0xde'),'attributes':['id',_0x3c11('0x31')]});return db[_0x3c11('0x3f')]['find']({'where':{'id':_0x1c39f2[_0x3c11('0xb4')]['id']},'include':_0x43aa78})[_0x3c11('0x2a')](handleEntityNotFound(_0xc1419b,null))[_0x3c11('0x2a')](function(_0x5d9f14){if(_0x5d9f14){var _0x45f96b=_0x5d9f14[_0x3c11('0xdf')]({'plain':!![]});fs[_0x3c11('0xe0')](_0x1a9c9a);var _0x43c86e={'channel':_0x3c11('0xe1'),'account':_0x45f96b[_0x3c11('0xdd')][_0x3c11('0x2e')],'agent':_0x45f96b[_0x3c11('0xde')]?_0x45f96b[_0x3c11('0xde')][_0x3c11('0x31')]:'N.A.','createdAt':moment(_0x45f96b[_0x3c11('0x77')])[_0x3c11('0xc3')](_0x3c11('0xc4'))[_0x3c11('0x9c')](),'closedAt':_0x45f96b[_0x3c11('0x3a')]?moment(_0x45f96b[_0x3c11('0xe2')])[_0x3c11('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3c11('0x9c')]():'','disposition':_0x45f96b[_0x3c11('0xe3')],'messages':_(_0x45f96b[_0x3c11('0xda')])[_0x3c11('0xe4')]({'secret':![]})[_0x3c11('0x42')](function(_0x2e2692){if(_0x2e2692[_0x3c11('0xd9')]){var _0x11901c=path['join'](_0x300e0c,_0x2e2692[_0x3c11('0xd9')][_0x3c11('0xe5')]);if(fs['existsSync'](_0x11901c)){fs['createReadStream'](_0x11901c)[_0x3c11('0xe6')](fs[_0x3c11('0xe7')](path[_0x3c11('0xd0')](_0x1a9c9a,_0x2e2692['Attachment']['basename'])));}}return{'date':moment(_0x2e2692[_0x3c11('0x77')])[_0x3c11('0xc3')](_0x3c11('0xc4'))[_0x3c11('0x9c')](),'sender':_0x2e2692[_0x3c11('0xe8')]===_0x3c11('0xe9')?_0x2e2692[_0x3c11('0xd6')]?_0x2e2692[_0x3c11('0xd6')][_0x3c11('0x31')]:_0x3c11('0xea'):_0x2e2692[_0x3c11('0x66')][_0x3c11('0xeb')]+(_0x2e2692[_0x3c11('0x66')][_0x3c11('0xd8')]?'\x20'+_0x2e2692['Contact']['lastName']:''),'body':_0x2e2692[_0x3c11('0xd9')]?_0x2e2692[_0x3c11('0xd9')][_0x3c11('0xe5')]:_0x2e2692[_0x3c11('0x72')],'direction':_0x2e2692[_0x3c11('0xe8')]===_0x3c11('0xe9')?'A':'C','secret':_0x2e2692[_0x3c11('0xdb')],'read':_0x2e2692[_0x3c11('0x7e')],'attachment':_0x2e2692[_0x3c11('0xd9')]};})[_0x3c11('0x64')]()};return ejs[_0x3c11('0xec')](path[_0x3c11('0xd0')](config[_0x3c11('0xd3')],_0x3c11('0xd4'),_0x3c11('0xed'),_0x3c11('0xee')),{'interaction':_0x43c86e})[_0x3c11('0x2a')](function(_0x88d3f9){var _0x34a4a6=path[_0x3c11('0xd0')](_0x1a9c9a,_0x3c11('0xef')+_0x45f96b['id']+'-'+_0x255d55+_0x3c11('0xf0'));var _0x1747c3={'path':_0x34a4a6,'channel':_0x3c11('0xe1'),'interactionId':_0x45f96b['id']};return pdf['createPdfFromHTML'](_0x88d3f9,_0x1747c3);})[_0x3c11('0x2a')](function(){return new BPromise(function(_0x251784,_0x1639a2){zipdir(_0x1a9c9a,{'saveTo':_0x317df7},function(_0x13d18e,_0x4d69b1){if(_0x13d18e)return _0x1639a2(_0x13d18e);return _0x251784(_0x4d69b1);});})[_0x3c11('0x2a')](function(){return new BPromise(function(_0x2f0701,_0x21ab0c){rimraf(_0x1a9c9a,function(_0x43aa10){if(_0x43aa10)_0x21ab0c(_0x43aa10);return _0x2f0701();});});})[_0x3c11('0x2a')](function(){return _0xc1419b['download'](_0x317df7,_0x48157d,function(_0x34099c){if(_0x34099c){console[_0x3c11('0xf1')](_0x3c11('0xf2'),_0x34099c);}else{fs[_0x3c11('0xf3')](_0x317df7);}});});});}else{return _0xc1419b[_0x3c11('0x1f')](0xc8);}})['catch'](handleError(_0xc1419b,null));}; \ No newline at end of file +var _0x147b=['sqlOperator','conditions','find','unreadMessages','having','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','rawAttributes','include','create','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','WhatsappInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','format','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','WhatsappAccount','Account','Owner','get','N.A.','createdAt','closedAt','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','lastName','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','offset','count','limit','set','Content-Range','json','reject','save','update','destroy','then','status','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','unmanaged','total','closed','UserId','waiting','answered','talking','index','WhatsappInteraction','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','users','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x147b,0x193));var _0xb147=function(_0xc033f3,_0x4edd5c){_0xc033f3=_0xc033f3-0x0;var _0x57eb11=_0x147b[_0xc033f3];return _0x57eb11;};'use strict';var emlformat=require(_0xb147('0x0'));var rimraf=require(_0xb147('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb147('0x2'));var rp=require(_0xb147('0x3'));var moment=require('moment');var BPromise=require(_0xb147('0x4'));var Mustache=require(_0xb147('0x5'));var util=require(_0xb147('0x6'));var path=require('path');var sox=require(_0xb147('0x7'));var csv=require('to-csv');var ejs=require(_0xb147('0x8'));var fs=require('fs');var fs_extra=require(_0xb147('0x9'));var _=require(_0xb147('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb147('0xb'));var deskjs=require(_0xb147('0xc'));var toCsv=require(_0xb147('0xd'));var querystring=require(_0xb147('0xe'));var Papa=require(_0xb147('0xf'));var Redis=require(_0xb147('0x10'));var authService=require(_0xb147('0x11'));var qs=require(_0xb147('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb147('0x13'));var logger=require(_0xb147('0x14'))(_0xb147('0x15'));var utils=require(_0xb147('0x16'));var config=require(_0xb147('0x17'));var licenseUtil=require(_0xb147('0x18'));var db=require(_0xb147('0x19'))['db'];config[_0xb147('0x1a')]=_[_0xb147('0x1b')](config[_0xb147('0x1a')],{'host':_0xb147('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb147('0x1a')]));require(_0xb147('0x1d'))[_0xb147('0x1e')](socket);function respondWithStatusCode(_0x2c1952,_0x5479b4){_0x5479b4=_0x5479b4||0xcc;return function(_0x2a0eeb){if(_0x2a0eeb){return _0x2c1952[_0xb147('0x1f')](_0x5479b4);}return _0x2c1952['status'](_0x5479b4)['end']();};}function respondWithResult(_0x1f424a,_0x1e735c){_0x1e735c=_0x1e735c||0xc8;return function(_0x34e3c1){if(_0x34e3c1){return _0x1f424a['status'](_0x1e735c)['json'](_0x34e3c1);}};}function respondWithFilteredResult(_0xe5aa93,_0x5e3235){return function(_0x3a9bca){if(_0x3a9bca){var _0x107b35=typeof _0x5e3235[_0xb147('0x20')]==='undefined'&&typeof _0x5e3235['limit']==='undefined';var _0xad4b38=_0x3a9bca[_0xb147('0x21')];var _0x411a3b=_0x107b35?0x0:_0x5e3235['offset'];var _0x39c15c=_0x107b35?_0x3a9bca[_0xb147('0x21')]:_0x5e3235[_0xb147('0x20')]+_0x5e3235[_0xb147('0x22')];var _0x163151;if(_0x39c15c>=_0xad4b38){_0x39c15c=_0xad4b38;_0x163151=0xc8;}else{_0x163151=0xce;}_0xe5aa93['status'](_0x163151);return _0xe5aa93[_0xb147('0x23')](_0xb147('0x24'),_0x411a3b+'-'+_0x39c15c+'/'+_0xad4b38)[_0xb147('0x25')](_0x3a9bca);}return null;};}function patchUpdates(_0x420452){return function(_0x353b8b){try{jsonpatch['apply'](_0x353b8b,_0x420452,!![]);}catch(_0x565acd){return BPromise[_0xb147('0x26')](_0x565acd);}return _0x353b8b[_0xb147('0x27')]();};}function saveUpdates(_0x24efa0,_0x39f833){return function(_0x5f2806){if(_0x5f2806){return _0x5f2806[_0xb147('0x28')](_0x24efa0)['then'](function(_0x5930a5){return _0x5930a5;});}return null;};}function removeEntity(_0x2b7c3a,_0x2cf3b5){return function(_0x444d58){if(_0x444d58){return _0x444d58[_0xb147('0x29')]()[_0xb147('0x2a')](function(){_0x2b7c3a[_0xb147('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5691de,_0x3bf2ae){return function(_0x456718){if(!_0x456718){_0x5691de['sendStatus'](0x194);}return _0x456718;};}function handleError(_0xf23eed,_0x45887f){_0x45887f=_0x45887f||0x1f4;return function(_0x50f831){logger['error'](_0x50f831[_0xb147('0x2c')]);if(_0x50f831[_0xb147('0x2d')]){delete _0x50f831[_0xb147('0x2d')];}_0xf23eed[_0xb147('0x2b')](_0x45887f)[_0xb147('0x2e')](_0x50f831);};}function getInteractionUsers(_0x589010,_0x3e6a3c){return new BPromise(function(_0x315896,_0x273fff){try{if(_0x3e6a3c[_0x589010['id']]){_0x589010[_0xb147('0x2f')]=_[_0xb147('0x30')](_0x3e6a3c[_0x589010['id']],function(_0x4afede){return{'id':_0x4afede['id'],'fullname':_0x4afede[_0xb147('0x31')]};});}}catch(_0x7c6129){_0x273fff(_0x7c6129);}_0x315896(_0x589010);});}function getInteractionTags(_0x9a2bb2,_0x35102b){return new BPromise(function(_0x3b2eb2,_0x28a923){try{if(_0x9a2bb2[_0xb147('0x32')]){_0x9a2bb2[_0xb147('0x33')]=[];_0x9a2bb2[_0xb147('0x32')]['split'](',')[_0xb147('0x34')](function(_0x3f91f8){_0x9a2bb2[_0xb147('0x33')][_0xb147('0x35')](_0x35102b[_0x3f91f8]);});}delete _0x9a2bb2[_0xb147('0x32')];}catch(_0x3d0b9d){_0x28a923(_0x3d0b9d);}_0x3b2eb2(_0x9a2bb2);});}function updateWhatsappInteraction(_0x1e5799,_0x25b7ca,_0x5a8261){return new BPromise(function(_0x2103bc,_0x2c03e0){return getInteractionUsers(_0x1e5799,_0x5a8261)[_0xb147('0x2a')](function(_0x26ccc6){return getInteractionTags(_0x26ccc6,_0x25b7ca);})[_0xb147('0x2a')](function(_0x3e8115){return getStateInteraction(_0x3e8115);})[_0xb147('0x2a')](function(_0x4a8460){_0x2103bc(_0x4a8460);})[_0xb147('0x36')](function(_0x48cc99){_0x2c03e0(_0x48cc99);});});}function getStateInteraction(_0x221a7c){return new BPromise(function(_0x2977fe){_0x221a7c['waiting']=0x0;_0x221a7c['talking']=0x0;_0x221a7c['answered']=0x0;_0x221a7c[_0xb147('0x37')]=0x0;_0x221a7c[_0xb147('0x38')]=0x0;if(!_0x221a7c[_0xb147('0x39')]&&!_0x221a7c[_0xb147('0x3a')]){_0x221a7c[_0xb147('0x3b')]+=0x1;}if(!_0x221a7c['closed']&&_0x221a7c[_0xb147('0x3a')]){_0x221a7c['talking']+=0x1;if(_0x221a7c['waiting']){_0x221a7c['waiting']-=0x1;}}if(_0x221a7c[_0xb147('0x39')]&&_0x221a7c[_0xb147('0x3a')]){_0x221a7c[_0xb147('0x3c')]+=0x1;if(_0x221a7c[_0xb147('0x3d')]){_0x221a7c[_0xb147('0x3d')]-=0x1;}}if(_0x221a7c[_0xb147('0x39')]&&!_0x221a7c['UserId']){_0x221a7c[_0xb147('0x37')]+=0x1;if(_0x221a7c[_0xb147('0x3b')]){_0x221a7c[_0xb147('0x3b')]-=0x1;}}_0x221a7c[_0xb147('0x38')]+=0x1;_0x2977fe(_0x221a7c);});}exports[_0xb147('0x3e')]=function(_0xcbe3d8,_0x5443f4){var _0x46cc57={},_0x22043c={},_0x2fc312={'count':0x0,'rows':[]};var _0x53a9af=_[_0xb147('0x30')](db[_0xb147('0x3f')]['rawAttributes'],function(_0x57c8e7){return{'name':_0x57c8e7['fieldName'],'type':_0x57c8e7[_0xb147('0x40')]['key']};});_0x22043c['model']=_[_0xb147('0x30')](_0x53a9af,_0xb147('0x2d'));_0x22043c[_0xb147('0x41')]=_[_0xb147('0x42')](_0xcbe3d8['query']);_0x22043c[_0xb147('0x43')]=_['intersection'](_0x22043c[_0xb147('0x44')],_0x22043c[_0xb147('0x41')]);_0x46cc57[_0xb147('0x45')]=_[_0xb147('0x46')](_0x22043c[_0xb147('0x44')],qs[_0xb147('0x47')](_0xcbe3d8[_0xb147('0x41')][_0xb147('0x47')]));_0x46cc57['attributes']=_0x46cc57[_0xb147('0x45')][_0xb147('0x48')]?_0x46cc57[_0xb147('0x45')]:_0x22043c[_0xb147('0x44')];if(!_0xcbe3d8[_0xb147('0x41')][_0xb147('0x49')]('nolimit')){_0x46cc57[_0xb147('0x22')]=qs['limit'](_0xcbe3d8[_0xb147('0x41')][_0xb147('0x22')]);_0x46cc57[_0xb147('0x20')]=qs[_0xb147('0x20')](_0xcbe3d8['query'][_0xb147('0x20')]);}_0x46cc57[_0xb147('0x4a')]=qs[_0xb147('0x4b')](_0xcbe3d8['query'][_0xb147('0x4b')]);_0x46cc57['where']=qs[_0xb147('0x43')](_[_0xb147('0x4c')](_0xcbe3d8[_0xb147('0x41')],_0x22043c[_0xb147('0x43')]),_0x53a9af);var _0x1d679e=[];var _0x17975d=squel[_0xb147('0x4d')]()[_0xb147('0x4e')]('id')[_0xb147('0x4e')](_0xb147('0x2d'))[_0xb147('0x4e')](_0xb147('0x4f'))[_0xb147('0x50')](_0xb147('0x51'));var _0x31e2b3=squel['select']()[_0xb147('0x4e')](_0xb147('0x52'))[_0xb147('0x4e')](_0xb147('0x53'))[_0xb147('0x4e')]('ui.WhatsappInteractionId')[_0xb147('0x50')](_0xb147('0x54'),'ui')['left_join'](_0xb147('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x5a2472=squel[_0xb147('0x4d')]()[_0xb147('0x50')]('whatsapp_interactions','i')[_0xb147('0x56')](_0xb147('0x57'),'c',_0xb147('0x58'))[_0xb147('0x56')](_0xb147('0x55'),'o','o.id\x20=\x20i.UserId')[_0xb147('0x56')](_0xb147('0x59'),'a',_0xb147('0x5a'))[_0xb147('0x56')](_0xb147('0x5b'),'me',_0xb147('0x5c'))[_0xb147('0x56')](_0xb147('0x5d'),'it',_0xb147('0x5e'))[_0xb147('0x56')](_0xb147('0x51'),'t','t.id\x20=\x20it.TagId');var _0x153d0c=squel[_0xb147('0x5f')]();var _0x4dde95=[];var _0x2c031f=squel[_0xb147('0x5f')]();var _0xf0ade0;if(_0xcbe3d8['query'][_0xb147('0x60')]){_0xf0ade0=as['parseSearch'](_0xcbe3d8[_0xb147('0x41')][_0xb147('0x60')]);var _0x598666=_0xf0ade0[_0xb147('0x61')];for(var _0x46b633=0x0;_0x46b633<_0xf0ade0['conditions'][_0xb147('0x48')];_0x46b633++){var _0x132d83=_0xf0ade0[_0xb147('0x62')][_0x46b633];var _0x454b13='i';var _0x1cdfc3=_[_0xb147('0x63')](_0x53a9af,[_0xb147('0x2d'),_0x132d83[_0xb147('0x4e')]]);if(!_0x1cdfc3){switch(_0x132d83[_0xb147('0x4e')]){case _0xb147('0x64'):if(_0x132d83['value']==0x1){_0x5a2472[_0xb147('0x65')]('`'+_0x132d83[_0xb147('0x4e')]+'`\x20=\x200');}else{_0x5a2472[_0xb147('0x65')]('`'+_0x132d83[_0xb147('0x4e')]+'`\x20>\x200');}break;case _0xb147('0x66'):if(_0x132d83[_0xb147('0x67')]===_0xb147('0x68')){if(_0x132d83[_0xb147('0x69')][_0xb147('0x6a')]('\x20')[_0xb147('0x48')]>0x1){_0x153d0c[_0x598666](_0xb147('0x6b'),qs[_0xb147('0x6c')](_0x132d83[_0xb147('0x69')]),null);}else{var _0x3b310b='%'+_0x132d83['value']+'%';_0x153d0c[_0x598666]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b310b,_0x3b310b,_0x3b310b);}}else{_0x1cdfc3=_[_0xb147('0x63')](_0x53a9af,[_0xb147('0x2d'),_0xb147('0x6d')]);_0x132d83['field']='ContactId';_0x758762=as[_0xb147('0x6e')](_0x454b13,_0x1cdfc3[_0xb147('0x40')],_0x132d83);_0x153d0c[_0x598666](_0x758762['text'],_0x758762['value'][_0xb147('0x6f')],_0x758762[_0xb147('0x69')][_0xb147('0x70')]);}break;case'Tag':var _0xe2d085=_0x132d83[_0xb147('0x69')][_0xb147('0x6a')](',')[_0xb147('0x30')](function(_0x9f1298){return Number(_0x9f1298);});_0xe2d085['forEach'](function(_0x23b6b6){_0x2c031f['or'](_0xb147('0x71'),'%,'+_0x23b6b6+',%');});_0x4dde95=_['union'](_0x4dde95,_0xe2d085);break;case _0xb147('0x72'):if(_0x132d83[_0xb147('0x67')]===_0xb147('0x68')){_0x153d0c[_0x598666](_0xb147('0x73'),'%'+_0x132d83['value']+'%',null);}else{_0x1cdfc3=_[_0xb147('0x63')](_0x53a9af,[_0xb147('0x2d'),'UserId']);_0x132d83[_0xb147('0x4e')]='UserId';_0x758762=as[_0xb147('0x6e')](_0x454b13,_0x1cdfc3[_0xb147('0x40')],_0x132d83);_0x153d0c[_0x598666](_0x758762[_0xb147('0x74')],_0x758762['value'][_0xb147('0x6f')],_0x758762[_0xb147('0x69')]['end']);}break;case _0xb147('0x75'):_0x758762=as[_0xb147('0x6e')]('me',null,_0x132d83);_0x153d0c[_0x598666](_0x758762['text'],_0x758762[_0xb147('0x69')]['start'],_0x758762[_0xb147('0x69')][_0xb147('0x70')]);break;}}else{var _0x758762=as[_0xb147('0x6e')](_0x454b13,_0x1cdfc3[_0xb147('0x40')],_0x132d83);_0x153d0c[_0x598666](_0x758762['text'],_0x758762[_0xb147('0x69')]['start'],_0x758762[_0xb147('0x69')][_0xb147('0x70')]);}}}else{var _0x1d3fb8=_(_0xcbe3d8[_0xb147('0x41')])['keys']()[_0xb147('0x30')](function(_0x130851){return _[_0xb147('0x76')](_0x53a9af,['name',_0x130851])?_0x130851:undefined;})[_0xb147('0x77')]()[_0xb147('0x69')]();if(!_['isEmpty'](_0x1d3fb8)){_0x1d3fb8[_0xb147('0x34')](function(_0x2bc948){if(_0x2bc948===_0xb147('0x78')){_0x5a2472['where'](_0xb147('0x79'),[][_0xb147('0x7a')](_0xcbe3d8[_0xb147('0x41')][_0x2bc948]));}else if(_0x2bc948==='createdAt'){var _0x222b5a=JSON['parse'](_0xcbe3d8['query'][_0x2bc948])[_0xb147('0x7b')];var _0x31f9ee=JSON[_0xb147('0x7c')](_0xcbe3d8[_0xb147('0x41')][_0x2bc948])['$lte'];_0x5a2472[_0xb147('0x7d')](_0xb147('0x7e'),_0x222b5a,_0x31f9ee);}else{if(_0xcbe3d8['query'][_0x2bc948]===_0xb147('0x7f')){_0x5a2472['where']('i.'+_0x2bc948+_0xb147('0x80'));}else{_0x5a2472['where']('i.'+_0x2bc948+_0xb147('0x81'),_0xcbe3d8['query'][_0x2bc948]);}}});}if(_0xcbe3d8['query']['read']){if(_0xcbe3d8[_0xb147('0x41')][_0xb147('0x82')]==0x1){_0x5a2472[_0xb147('0x65')](_0xb147('0x83'));}else{_0x5a2472[_0xb147('0x65')](_0xb147('0x84'));}}if(_0xcbe3d8[_0xb147('0x41')]['tag']){_0x4dde95=_[_0xb147('0x85')](_0xcbe3d8[_0xb147('0x41')][_0xb147('0x86')])?_0xcbe3d8[_0xb147('0x41')]['tag']:new Array(_0xcbe3d8[_0xb147('0x41')][_0xb147('0x86')]);_0x4dde95[_0xb147('0x34')](function(_0x1b6698){_0x2c031f['or'](_0xb147('0x71'),'%,'+_0x1b6698+',%');});}if(_0xcbe3d8[_0xb147('0x41')]['filter']){var _0x215602=_0xcbe3d8['query'][_0xb147('0x87')][_0xb147('0x88')]('\x5c','\x5c\x5c')[_0xb147('0x88')](/'/g,'\x27\x27');if(qs[_0xb147('0x89')](_0x215602)){_0x153d0c['or'](_0xb147('0x8a'),_0x215602+'%')['or'](_0xb147('0x8b'),_0x215602+'%');}else{_0x153d0c['or'](_0xb147('0x8c'),qs[_0xb147('0x6c')](_0x215602))['or'](_0xb147('0x8d'),_0x215602+'%');}}}_0x5a2472[_0xb147('0x7d')](_0x153d0c);_0x5a2472[_0xb147('0x8e')](_0xb147('0x8f'));var _0x5afcef={'type':db['Sequelize'][_0xb147('0x90')][_0xb147('0x91')],'raw':!![]};var _0x909e4d=_0x5a2472[_0xb147('0x92')]();_0x909e4d[_0xb147('0x4e')]('i.id');_0x909e4d[_0xb147('0x4e')](_0xb147('0x93'),_0xb147('0x64'));if(_0x46cc57['order']){_0x46cc57[_0xb147('0x4a')][_0xb147('0x34')](function(_0x20479c){var _0x12d56f=_0x20479c[0x0]===_0xb147('0x94')?_0x20479c[0x0]:'i.'+_0x20479c[0x0];_0x5a2472['order'](_0x12d56f,_0x20479c[0x1]===_0xb147('0x95')?![]:!![]);});}if(!_[_0xb147('0x96')](_0x4dde95)){_0x5a2472['having'](_0x2c031f);_0x909e4d[_0xb147('0x7d')]('t.id\x20IN\x20?',_0x4dde95);}BPromise[_0xb147('0x97')]()[_0xb147('0x2a')](function(){if(!_0xf0ade0){if(_0xcbe3d8[_0xb147('0x41')][_0xb147('0x78')])return;_0x909e4d['where'](_0xb147('0x98'));_0x5a2472[_0xb147('0x7d')](_0xb147('0x98'));return;}if(_0xcbe3d8[_0xb147('0x99')][_0xb147('0x9a')]!==_0xb147('0x9b'))return;return _0xcbe3d8[_0xb147('0x99')][_0xb147('0x9c')]({'attributes':['id'],'raw':!![]})[_0xb147('0x2a')](function(_0x16a0d9){if(_[_0xb147('0x96')](_0x16a0d9)){_0x909e4d[_0xb147('0x7d')](_0xb147('0x9d'));_0x5a2472[_0xb147('0x7d')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x909e4d[_0xb147('0x7d')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb147('0x30')](_0x16a0d9,'id'));_0x5a2472[_0xb147('0x7d')](_0xb147('0x79'),_[_0xb147('0x30')](_0x16a0d9,'id'));}});})[_0xb147('0x2a')](function(){if(_0xcbe3d8['user'][_0xb147('0x9a')]===_0xb147('0x9b')&&!_0xf0ade0&&!_0xcbe3d8[_0xb147('0x41')][_0xb147('0x78')])return[];return db[_0xb147('0x9e')]['query'](_0x909e4d['toString'](),_0x5afcef);})[_0xb147('0x2a')](function(_0x39dc9d){_0x2fc312['count']=_0x39dc9d['length'];if(_0x2fc312[_0xb147('0x21')]===0x0)return[];return db[_0xb147('0x9e')][_0xb147('0x41')](_0x17975d[_0xb147('0x9f')](),_0x5afcef)['then'](function(_0x19c2e0){_0x1d679e=_[_0xb147('0xa0')](_0x19c2e0,'id');_0x5afcef=_[_0xb147('0xa1')](_0x5afcef,{'model':db[_0xb147('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xcbe3d8['query'][_0xb147('0x47')]){_0x46cc57['attributes']['forEach'](function(_0x3508e4){_0x5a2472[_0xb147('0x4e')]('i.'+_0x3508e4);});}else{_0x5a2472[_0xb147('0x4e')](_0xb147('0x93'),'unreadMessages');_0x5a2472[_0xb147('0x4e')](_0xb147('0xa2'),_0xb147('0xa3'));_0x5a2472['field'](_0xb147('0xa4'),_0xb147('0xa5'));_0x5a2472[_0xb147('0x4e')](_0xb147('0xa6'),_0xb147('0x94'));_0x5a2472['field'](_0xb147('0xa7'));_0x5a2472[_0xb147('0x4e')](_0xb147('0xa8'),'Contact.firstName');_0x5a2472[_0xb147('0x4e')](_0xb147('0xa9'),'Contact.lastName');_0x5a2472[_0xb147('0x4e')](_0xb147('0xaa'),_0xb147('0xab'));_0x5a2472[_0xb147('0x4e')](_0xb147('0xac'),_0xb147('0xad'));_0x5a2472[_0xb147('0x4e')]('c.mobile',_0xb147('0xae'));_0x5a2472[_0xb147('0x4e')](_0xb147('0xaf'),_0xb147('0xb0'));_0x5a2472['field'](_0xb147('0xb1'),_0xb147('0xb2'));_0x5a2472['field'](_0xb147('0xb3'),_0xb147('0xb4'));_0x5a2472[_0xb147('0x4e')](_0xb147('0xb5'),'TagIds');}if(_0x46cc57[_0xb147('0x22')])_0x5a2472['limit'](_0x46cc57[_0xb147('0x22')]);if(_0x46cc57[_0xb147('0x20')])_0x5a2472[_0xb147('0x20')](_0x46cc57[_0xb147('0x20')]);return db[_0xb147('0x9e')][_0xb147('0x41')](_0x5a2472[_0xb147('0x9f')](),_0x5afcef);})[_0xb147('0x2a')](function(_0x25cdef){if(_0x25cdef[_0xb147('0x48')]>0x0)_0x31e2b3['where'](_0xb147('0xb6'),_[_0xb147('0x30')](_0x25cdef,'id'));return db[_0xb147('0x9e')][_0xb147('0x41')](_0x31e2b3['toString'](),_0x5afcef)[_0xb147('0x2a')](function(_0x5eb326){var _0x43bd76=_[_0xb147('0xb7')](_0x5eb326,'WhatsappInteractionId');var _0x38ebad=[];_0x25cdef['forEach'](function(_0x1f80fe){_0x38ebad[_0xb147('0x35')](updateWhatsappInteraction(_0x1f80fe,_0x1d679e,_0x43bd76));});return BPromise[_0xb147('0xb8')](_0x38ebad);});});})['then'](function(_0x4ea515){_0x2fc312[_0xb147('0xb9')]=_0x4ea515;return _0x2fc312;})['then'](respondWithFilteredResult(_0x5443f4,_0x46cc57))[_0xb147('0x36')](handleError(_0x5443f4,null));};exports[_0xb147('0xba')]=function(_0x2a95a4,_0x5130d1){var _0x595a3b={'raw':![],'where':{'id':_0x2a95a4['params']['id']}},_0x2ac52d={};_0x2ac52d['model']=_[_0xb147('0x42')](db[_0xb147('0x3f')][_0xb147('0xbb')]);_0x2ac52d[_0xb147('0x41')]=_[_0xb147('0x42')](_0x2a95a4[_0xb147('0x41')]);_0x2ac52d[_0xb147('0x43')]=_['intersection'](_0x2ac52d['model'],_0x2ac52d['query']);_0x595a3b[_0xb147('0x45')]=_[_0xb147('0x46')](_0x2ac52d[_0xb147('0x44')],qs[_0xb147('0x47')](_0x2a95a4[_0xb147('0x41')][_0xb147('0x47')]));_0x595a3b['attributes']=_0x595a3b['attributes']['length']?_0x595a3b['attributes']:_0x2ac52d['model'];if(_0x2a95a4[_0xb147('0x41')]['includeAll']){_0x595a3b[_0xb147('0xbc')]=[{'all':!![]}];}_0x595a3b=_['merge']({},_0x595a3b,_0x2a95a4['options']);return db['WhatsappInteraction']['find'](_0x595a3b)['then'](handleEntityNotFound(_0x5130d1,null))[_0xb147('0x2a')](respondWithResult(_0x5130d1,null))['catch'](handleError(_0x5130d1,null));};exports[_0xb147('0xbd')]=function(_0x2f73bb,_0x7df2a6){return db[_0xb147('0x3f')][_0xb147('0xbd')](_0x2f73bb['body'],{})[_0xb147('0x2a')](respondWithResult(_0x7df2a6,0xc9))['catch'](handleError(_0x7df2a6,null));};exports[_0xb147('0x28')]=function(_0x1d5a86,_0x403d36){if(_0x1d5a86[_0xb147('0x75')]['id']){delete _0x1d5a86[_0xb147('0x75')]['id'];}return db[_0xb147('0x3f')][_0xb147('0x63')]({'where':{'id':_0x1d5a86[_0xb147('0xbe')]['id']}})[_0xb147('0x2a')](handleEntityNotFound(_0x403d36,null))[_0xb147('0x2a')](saveUpdates(_0x1d5a86[_0xb147('0x75')],null))[_0xb147('0x2a')](respondWithResult(_0x403d36,null))['catch'](handleError(_0x403d36,null));};exports[_0xb147('0x29')]=function(_0x405365,_0x14ed39){return db[_0xb147('0x3f')][_0xb147('0x63')]({'where':{'id':_0x405365[_0xb147('0xbe')]['id']}})[_0xb147('0x2a')](handleEntityNotFound(_0x14ed39,null))['then'](removeEntity(_0x14ed39,null))[_0xb147('0x36')](handleError(_0x14ed39,null));};exports[_0xb147('0xbf')]=function(_0x1c1427,_0x5edbf4){return db[_0xb147('0x3f')][_0xb147('0xbf')]()[_0xb147('0x2a')](respondWithResult(_0x5edbf4,null))[_0xb147('0x36')](handleError(_0x5edbf4,null));};exports[_0xb147('0xc0')]=function(_0x2b4b2f,_0x511d5f,_0x5c81c1){return db[_0xb147('0xc1')][_0xb147('0x63')]({'where':{'id':_0x2b4b2f[_0xb147('0xbe')]['id']}})[_0xb147('0x2a')](handleEntityNotFound(_0x511d5f,null))['then'](function(_0x54c80b){if(_0x54c80b){return _0x54c80b[_0xb147('0xc0')](_0x2b4b2f[_0xb147('0x75')][_0xb147('0xc2')],_['omit'](_0x2b4b2f[_0xb147('0x75')],[_0xb147('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x511d5f,null))[_0xb147('0x36')](handleError(_0x511d5f,null));};exports[_0xb147('0xc3')]=function(_0x20faa3,_0x40c959,_0x1bd0df){var _0x57cd8a={'raw':![],'where':{}};var _0x779149={};var _0x4988e5={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb147('0xc4')]({'where':{'id':_0x20faa3['params']['id']}})['then'](handleEntityNotFound(_0x40c959,null))[_0xb147('0x2a')](function(_0x5a0b86){if(_0x5a0b86){_0x779149[_0xb147('0x44')]=_[_0xb147('0x42')](db[_0xb147('0xc1')][_0xb147('0xbb')]);_0x779149[_0xb147('0x41')]=_[_0xb147('0x42')](_0x20faa3['query']);_0x779149[_0xb147('0x43')]=_['intersection'](_0x779149[_0xb147('0x44')],_0x779149[_0xb147('0x41')]);_0x57cd8a['attributes']=_[_0xb147('0x46')](_0x779149[_0xb147('0x44')],qs[_0xb147('0x47')](_0x20faa3['query'][_0xb147('0x47')]));_0x57cd8a[_0xb147('0x45')]=_0x57cd8a[_0xb147('0x45')][_0xb147('0x48')]?_0x57cd8a[_0xb147('0x45')]:_0x779149[_0xb147('0x44')];if(!_0x20faa3[_0xb147('0x41')][_0xb147('0x49')](_0xb147('0xc5'))){_0x57cd8a[_0xb147('0x22')]=qs[_0xb147('0x22')](_0x20faa3[_0xb147('0x41')][_0xb147('0x22')]);_0x57cd8a[_0xb147('0x20')]=qs[_0xb147('0x20')](_0x20faa3[_0xb147('0x41')]['offset']);}_0x57cd8a[_0xb147('0x4a')]=qs[_0xb147('0x4b')](_0x20faa3[_0xb147('0x41')][_0xb147('0x4b')]);_0x57cd8a[_0xb147('0x7d')]=qs['filters'](_[_0xb147('0x4c')](_0x20faa3[_0xb147('0x41')],_0x779149[_0xb147('0x43')]));_0x57cd8a['where'][_0xb147('0xc6')]=_0x5a0b86['id'];if(_0x20faa3[_0xb147('0x41')]['filter']){_0x57cd8a[_0xb147('0x7d')]=_[_0xb147('0xa1')](_0x57cd8a[_0xb147('0x7d')],{'$or':_[_0xb147('0x30')](_0x57cd8a['attributes'],function(_0xab3d07){var _0x495ca0={};_0x495ca0[_0xab3d07]={'$like':'%'+_0x20faa3[_0xb147('0x41')][_0xb147('0x87')]+'%'};return _0x495ca0;})});}if(_0x20faa3[_0xb147('0x41')]['$gte']){var _0x5293e9=_0x20faa3[_0xb147('0x41')][_0xb147('0x7b')]['split'](',');var _0x2efd0a={};_0x2efd0a[_0x5293e9[0x0]]={'$gte':moment(_0x5293e9[0x1])['format'](_0xb147('0xc7'))};_0x57cd8a[_0xb147('0x7d')]=_[_0xb147('0xa1')](_0x57cd8a[_0xb147('0x7d')],_0x2efd0a);}_0x57cd8a=_['merge']({},_0x57cd8a,_0x20faa3[_0xb147('0xc8')]);return db[_0xb147('0xc1')]['count']({'where':_0x57cd8a[_0xb147('0x7d')]})[_0xb147('0x2a')](function(_0x1a8aa5){_0x4988e5['count']=_0x1a8aa5;if(_0x20faa3['query'][_0xb147('0xc9')]){_0x57cd8a[_0xb147('0xbc')]=[{'all':!![]}];}return db[_0xb147('0xc1')][_0xb147('0xca')](_0x57cd8a);})[_0xb147('0x2a')](function(_0x5182a2){_0x4988e5[_0xb147('0xb9')]=_0x5182a2;return _0x4988e5;});}})[_0xb147('0x2a')](respondWithFilteredResult(_0x40c959,_0x57cd8a))[_0xb147('0x36')](handleError(_0x40c959,null));};exports[_0xb147('0xcb')]=function(_0x98066c,_0xb27159,_0x3bc737){return db[_0xb147('0x3f')][_0xb147('0x63')]({'where':{'id':_0x98066c[_0xb147('0xbe')]['id']}})['then'](handleEntityNotFound(_0xb27159,null))[_0xb147('0x2a')](function(_0x6f3baa){if(_0x6f3baa){return _0x6f3baa[_0xb147('0xcc')](_0x98066c[_0xb147('0x75')][_0xb147('0xc2')],_[_0xb147('0xcd')](_0x98066c[_0xb147('0x75')],['ids','id'])||{})[_0xb147('0xce')](function(){return db[_0xb147('0xcf')][_0xb147('0xca')]({'attributes':['id',_0xb147('0x2d'),_0xb147('0x4f')],'where':{'id':_0x98066c[_0xb147('0x75')][_0xb147('0xc2')]}});})[_0xb147('0x2a')](function(_0x306c91){socket[_0xb147('0xd0')](_0xb147('0xd1'),{'id':Number(_0x98066c[_0xb147('0xbe')]['id']),'tags':_0x306c91||[]});return{'id':Number(_0x98066c[_0xb147('0xbe')]['id']),'tags':_0x306c91||[]};});}})['then'](respondWithResult(_0xb27159,null))[_0xb147('0x36')](handleError(_0xb27159,null));};exports['removeTags']=function(_0x294b46,_0x2e3c77,_0x2ae606){return db[_0xb147('0x3f')][_0xb147('0x63')]({'where':{'id':_0x294b46[_0xb147('0xbe')]['id']}})[_0xb147('0x2a')](handleEntityNotFound(_0x2e3c77,null))[_0xb147('0x2a')](function(_0x13ce83){if(_0x13ce83){return _0x13ce83[_0xb147('0xd2')](_0x294b46[_0xb147('0x41')][_0xb147('0xc2')]);}})[_0xb147('0x2a')](respondWithStatusCode(_0x2e3c77,null))[_0xb147('0x36')](handleError(_0x2e3c77,null));};exports[_0xb147('0xd3')]=function(_0x2d2e96,_0x4903ab){var _0x535a5f=moment()[_0xb147('0xd4')]()['toString']();var _0x5ee54c=path[_0xb147('0xd5')](config['root'],_0xb147('0xd6'),_0xb147('0xd7'),_0xb147('0xd8'));var _0x159409=path[_0xb147('0xd5')](config[_0xb147('0xd9')],_0xb147('0xd6'),_0xb147('0xd7'),'attachments');var _0x2c5eea=path[_0xb147('0xd5')](_0x5ee54c,_0x535a5f);var _0x1eee30=util[_0xb147('0xda')](_0xb147('0xdb'),_0x2d2e96[_0xb147('0xbe')]['id'],_0x535a5f);var _0x403a85=path['join'](_0x5ee54c,_0x1eee30);var _0x5d54e1=[];_0x5d54e1[_0xb147('0x35')]({'model':db[_0xb147('0x72')],'as':_0xb147('0x72'),'attributes':['id',_0xb147('0x31')],'raw':!![]});_0x5d54e1[_0xb147('0x35')]({'model':db[_0xb147('0xdc')],'as':_0xb147('0x66'),'attributes':['id',_0xb147('0xdd'),'lastName'],'raw':!![]});if(_0x2d2e96[_0xb147('0x41')]['attachments']){_0x5d54e1['push']({'model':db[_0xb147('0xde')],'as':_0xb147('0xde'),'raw':!![]});}var _0x45ba88=[{'model':db[_0xb147('0xc1')],'as':_0xb147('0xdf'),'attributes':['id','body','createdAt',_0xb147('0xe0'),'secret',_0xb147('0x82')],'include':_0x5d54e1}];_0x45ba88[_0xb147('0x35')]({'model':db[_0xb147('0xe1')],'as':_0xb147('0xe2'),'attributes':['id','name']});_0x45ba88[_0xb147('0x35')]({'model':db['User'],'as':_0xb147('0xe3'),'attributes':['id',_0xb147('0x31')]});return db['WhatsappInteraction'][_0xb147('0x63')]({'where':{'id':_0x2d2e96[_0xb147('0xbe')]['id']},'include':_0x45ba88})[_0xb147('0x2a')](handleEntityNotFound(_0x4903ab,null))['then'](function(_0x2b5775){if(_0x2b5775){var _0x109f71=_0x2b5775[_0xb147('0xe4')]({'plain':!![]});fs['mkdirSync'](_0x2c5eea);var _0x597411={'channel':'Whatsapp','account':_0x109f71['Account']['name'],'agent':_0x109f71[_0xb147('0xe3')]?_0x109f71[_0xb147('0xe3')][_0xb147('0x31')]:_0xb147('0xe5'),'createdAt':moment(_0x109f71[_0xb147('0xe6')])['format'](_0xb147('0xc7'))[_0xb147('0x9f')](),'closedAt':_0x109f71['closed']?moment(_0x109f71[_0xb147('0xe7')])[_0xb147('0xda')](_0xb147('0xc7'))['toString']():'','disposition':_0x109f71['disposition'],'messages':_(_0x109f71[_0xb147('0xdf')])[_0xb147('0x87')]({'secret':![]})[_0xb147('0x30')](function(_0x11a51f){if(_0x11a51f[_0xb147('0xde')]){var _0x2dbc4e=path[_0xb147('0xd5')](_0x159409,_0x11a51f[_0xb147('0xde')]['basename']);if(fs[_0xb147('0xe8')](_0x2dbc4e)){fs[_0xb147('0xe9')](_0x2dbc4e)[_0xb147('0xea')](fs[_0xb147('0xeb')](path['join'](_0x2c5eea,_0x11a51f['Attachment'][_0xb147('0xec')])));}}return{'date':moment(_0x11a51f['createdAt'])['format'](_0xb147('0xc7'))[_0xb147('0x9f')](),'sender':_0x11a51f[_0xb147('0xe0')]===_0xb147('0xed')?_0x11a51f[_0xb147('0x72')]?_0x11a51f[_0xb147('0x72')]['fullname']:_0xb147('0xee'):_0x11a51f['Contact'][_0xb147('0xdd')]+(_0x11a51f[_0xb147('0x66')][_0xb147('0xef')]?'\x20'+_0x11a51f['Contact'][_0xb147('0xef')]:''),'body':_0x11a51f['Attachment']?_0x11a51f[_0xb147('0xde')][_0xb147('0xec')]:_0x11a51f[_0xb147('0x75')],'direction':_0x11a51f['direction']===_0xb147('0xed')?'A':'C','secret':_0x11a51f[_0xb147('0xf0')],'read':_0x11a51f[_0xb147('0x82')],'attachment':_0x11a51f['Attachment']};})[_0xb147('0x69')]()};return ejs[_0xb147('0xf1')](path[_0xb147('0xd5')](config[_0xb147('0xd9')],'server','views',_0xb147('0xf2')),{'interaction':_0x597411})[_0xb147('0x2a')](function(_0x46708a){var _0x597ed8=path[_0xb147('0xd5')](_0x2c5eea,_0xb147('0xf3')+_0x109f71['id']+'-'+_0x535a5f+_0xb147('0xf4'));var _0x15009c={'path':_0x597ed8,'channel':_0xb147('0xf5'),'interactionId':_0x109f71['id']};return pdf[_0xb147('0xf6')](_0x46708a,_0x15009c);})['then'](function(){return new BPromise(function(_0x35c708,_0x3b40db){zipdir(_0x2c5eea,{'saveTo':_0x403a85},function(_0x1ee83c,_0x8857c3){if(_0x1ee83c)return _0x3b40db(_0x1ee83c);return _0x35c708(_0x8857c3);});})[_0xb147('0x2a')](function(){return new BPromise(function(_0x2f5a44,_0x46343d){rimraf(_0x2c5eea,function(_0xe2855c){if(_0xe2855c)_0x46343d(_0xe2855c);return _0x2f5a44();});});})[_0xb147('0x2a')](function(){return _0x4903ab[_0xb147('0xd3')](_0x403a85,_0x1eee30,function(_0x289070){if(_0x289070){console[_0xb147('0xf7')](_0xb147('0xf8'),_0x289070);}else{fs[_0xb147('0xf9')](_0x403a85);}});});});}else{return _0x4903ab['sendStatus'](0xc8);}})['catch'](handleError(_0x4903ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ec2b688..b420164 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 _0x3b75=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then'];(function(_0x37ecca,_0x379262){var _0x5e81d6=function(_0x128bbd){while(--_0x128bbd){_0x37ecca['push'](_0x37ecca['shift']());}};_0x5e81d6(++_0x379262);}(_0x3b75,0xdc));var _0x53b7=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x3b75[_0x2f0057];return _0x17f2c3;};'use strict';var EventEmitter=require(_0x53b7('0x0'));var WhatsappInteraction=require(_0x53b7('0x1'))['db'][_0x53b7('0x2')];var WhatsappMessage=require(_0x53b7('0x1'))['db'][_0x53b7('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53b7('0x4'),'afterUpdate':'update','afterDestroy':_0x53b7('0x5')};function emitEvent(_0x4c9b8f){return function(_0x357ece,_0xb78251,_0x331d88){_0x357ece[_0x53b7('0x6')]({'attributes':['id'],'raw':!![]})[_0x53b7('0x7')](function(_0x5ee630){_0x357ece[_0x53b7('0x8')](_0x53b7('0x9'),_0x5ee630[_0x53b7('0xa')](function(_0x509608){return{'id':_0x509608['id']};}));return WhatsappMessage[_0x53b7('0xb')]({'where':{'WhatsappInteractionId':_0x357ece['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a107a){_0x357ece[_0x53b7('0x8')](_0x53b7('0xc'),_0x3a107a[_0x53b7('0xd')]);WhatsappInteractionEvents[_0x53b7('0xe')](_0x4c9b8f+':'+_0x357ece['id'],_0x357ece);WhatsappInteractionEvents['emit'](_0x4c9b8f,_0x357ece);_0x331d88(null);})[_0x53b7('0xf')](_0x331d88(null));};}for(var e in events){if(events[_0x53b7('0x10')](e)){var event=events[e];WhatsappInteraction[_0x53b7('0x11')](e,emitEvent(event));}}module[_0x53b7('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3495=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','Users','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x4008e4,_0x81a00c){var _0x430a2b=function(_0x333d56){while(--_0x333d56){_0x4008e4['push'](_0x4008e4['shift']());}};_0x430a2b(++_0x81a00c);}(_0x3495,0x1de));var _0x5349=function(_0x1ec942,_0x4c1555){_0x1ec942=_0x1ec942-0x0;var _0x48abc3=_0x3495[_0x1ec942];return _0x48abc3;};'use strict';var EventEmitter=require(_0x5349('0x0'));var WhatsappInteraction=require(_0x5349('0x1'))['db'][_0x5349('0x2')];var WhatsappMessage=require(_0x5349('0x1'))['db'][_0x5349('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5349('0x4')](0x0);var events={'afterCreate':_0x5349('0x5'),'afterUpdate':_0x5349('0x6'),'afterDestroy':_0x5349('0x7')};function emitEvent(_0x5912ac){return function(_0x4034ba,_0x8283b5,_0x5ce2cd){_0x4034ba[_0x5349('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6fb5dc){_0x4034ba['setDataValue'](_0x5349('0x9'),_0x6fb5dc['map'](function(_0x1751b2){return{'id':_0x1751b2['id']};}));return WhatsappMessage[_0x5349('0xa')]({'where':{'WhatsappInteractionId':_0x4034ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5349('0xb')](function(_0x23a1c7){_0x4034ba[_0x5349('0xc')](_0x5349('0xd'),_0x23a1c7[_0x5349('0xe')]);WhatsappInteractionEvents['emit'](_0x5912ac+':'+_0x4034ba['id'],_0x4034ba);WhatsappInteractionEvents[_0x5349('0xf')](_0x5912ac,_0x4034ba);_0x5ce2cd(null);})['catch'](_0x5ce2cd(null));};}for(var e in events){if(events[_0x5349('0x10')](e)){var event=events[e];WhatsappInteraction[_0x5349('0x11')](e,emitEvent(event));}}module[_0x5349('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 40fe7d4..03f3e22 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 _0xba2f=['util','../../config/logger','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','format','lodash'];(function(_0x4c9e47,_0x2505be){var _0x2a20d5=function(_0x19df9a){while(--_0x19df9a){_0x4c9e47['push'](_0x4c9e47['shift']());}};_0x2a20d5(++_0x2505be);}(_0xba2f,0x151));var _0xfba2=function(_0x2180f3,_0xafbc93){_0x2180f3=_0x2180f3-0x0;var _0x2bb01d=_0xba2f[_0x2180f3];return _0x2bb01d;};'use strict';var _=require(_0xfba2('0x0'));var util=require(_0xfba2('0x1'));var logger=require(_0xfba2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfba2('0x3'));var fs=require('fs');var path=require(_0xfba2('0x4'));var rimraf=require('rimraf');var config=require(_0xfba2('0x5'));var attributes=require(_0xfba2('0x6'));module[_0xfba2('0x7')]=function(_0x277fec,_0x3ca3a6){return _0x277fec[_0xfba2('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xfba2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11c127,_0x2b3fe1,_0xdbf15c){if(_0x11c127[_0xfba2('0xa')](_0xfba2('0xb'))){_0x11c127['closedAt']=moment()[_0xfba2('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0xdbf15c(null,_0x11c127);}}});}; \ No newline at end of file +var _0x5686=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','util'];(function(_0x20b6e2,_0x1105f2){var _0x1e6dde=function(_0x47aa91){while(--_0x47aa91){_0x20b6e2['push'](_0x20b6e2['shift']());}};_0x1e6dde(++_0x1105f2);}(_0x5686,0x167));var _0x6568=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x5686[_0x473738];return _0x1df4ae;};'use strict';var _=require('lodash');var util=require(_0x6568('0x0'));var logger=require(_0x6568('0x1'))(_0x6568('0x2'));var moment=require(_0x6568('0x3'));var BPromise=require(_0x6568('0x4'));var rp=require(_0x6568('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6568('0x6'));var attributes=require(_0x6568('0x7'));module[_0x6568('0x8')]=function(_0x22db0e,_0x54bdf3){return _0x22db0e['define'](_0x6568('0x9'),attributes,{'tableName':_0x6568('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a49f9,_0x394408,_0x5190c0){if(_0x2a49f9[_0x6568('0xb')](_0x6568('0xc'))){_0x2a49f9[_0x6568('0xd')]=moment()[_0x6568('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5190c0(null,_0x2a49f9);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b310989..c286d5b 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 _0x65d2=['catch','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x65d2,0x85));var _0x265d=function(_0x3efc1d,_0xd364c7){_0x3efc1d=_0x3efc1d-0x0;var _0x51c67c=_0x65d2[_0x3efc1d];return _0x51c67c;};'use strict';var _=require(_0x265d('0x0'));var util=require(_0x265d('0x1'));var moment=require(_0x265d('0x2'));var BPromise=require(_0x265d('0x3'));var rs=require(_0x265d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x265d('0x5'))['db'];var utils=require(_0x265d('0x6'));var logger=require('../../config/logger')(_0x265d('0x7'));var config=require(_0x265d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x265d('0x9')][_0x265d('0xa')]({'port':0x232a});config[_0x265d('0xb')]=_[_0x265d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x265d('0xd'))(new Redis(config[_0x265d('0xb')]));require(_0x265d('0xe'))['register'](socket);function respondWithRpcPromise(_0x53a47c,_0x524773,_0x6ad2ab){return new BPromise(function(_0x31fc8a,_0x5c294d){return client[_0x265d('0xf')](_0x53a47c,_0x6ad2ab)[_0x265d('0x10')](function(_0x5ac745){logger[_0x265d('0x11')](_0x265d('0x12'),_0x524773,_0x265d('0x13'));logger[_0x265d('0x14')](_0x265d('0x15'),_0x524773,'request\x20sent',JSON[_0x265d('0x16')](_0x5ac745));if(_0x5ac745[_0x265d('0x17')]){if(_0x5ac745[_0x265d('0x17')][_0x265d('0x18')]===0x1f4){logger[_0x265d('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x524773,_0x5ac745[_0x265d('0x17')][_0x265d('0x19')]);return _0x5c294d(_0x5ac745['error'][_0x265d('0x19')]);}logger['error'](_0x265d('0x12'),_0x524773,_0x5ac745[_0x265d('0x17')][_0x265d('0x19')]);return _0x31fc8a(_0x5ac745[_0x265d('0x17')][_0x265d('0x19')]);}else{logger['info'](_0x265d('0x12'),_0x524773,_0x265d('0x13'));_0x31fc8a(_0x5ac745['result'][_0x265d('0x19')]);}})['catch'](function(_0x1a5fec){logger[_0x265d('0x17')](_0x265d('0x12'),_0x524773,_0x1a5fec);_0x5c294d(_0x1a5fec);});});}exports[_0x265d('0x1a')]=function(_0x4db880){var _0x171ceb=this;return new Promise(function(_0x20e961,_0x521916){return db[_0x265d('0x1b')][_0x265d('0x1c')](_0x4db880[_0x265d('0x1d')],{'raw':_0x4db880[_0x265d('0x1e')]?_0x4db880[_0x265d('0x1e')][_0x265d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db880[_0x265d('0x1e')]?_0x4db880[_0x265d('0x1e')][_0x265d('0x20')]||null:null,'attributes':_0x4db880['options']?_0x4db880['options'][_0x265d('0x21')]||null:null,'limit':_0x4db880[_0x265d('0x1e')]?_0x4db880[_0x265d('0x1e')][_0x265d('0x22')]||null:null})[_0x265d('0x10')](function(_0x439c94){logger[_0x265d('0x11')](_0x265d('0x1a'),_0x4db880);logger[_0x265d('0x14')](_0x265d('0x1a'),_0x4db880,JSON[_0x265d('0x16')](_0x439c94));_0x20e961(_0x439c94);})[_0x265d('0x23')](function(_0x859e07){logger[_0x265d('0x17')](_0x265d('0x1a'),_0x859e07['message'],_0x4db880);_0x521916(_0x171ceb[_0x265d('0x17')](0x1f4,_0x859e07[_0x265d('0x19')]));});});};exports[_0x265d('0x24')]=function(_0x1cf2f5){return new Promise(function(_0x217b05,_0x86919){return db[_0x265d('0x1b')][_0x265d('0x25')]({'where':_0x1cf2f5[_0x265d('0x1e')]?_0x1cf2f5['options'][_0x265d('0x20')]||null:null})['then'](function(_0x1f5b12){if(_0x1f5b12){return _0x1f5b12[_0x265d('0x26')](_0x1cf2f5[_0x265d('0x1d')][_0x265d('0x27')],_['omit'](_0x1cf2f5['body'],['ids','id'])||{});}})[_0x265d('0x28')](function(_0x10c762){logger[_0x265d('0x11')](_0x265d('0x29'),_0x1cf2f5);logger[_0x265d('0x14')](_0x265d('0x29'),_0x1cf2f5,JSON[_0x265d('0x16')](_0x10c762));_0x217b05(_0x10c762);})[_0x265d('0x23')](function(_0x34ca24){logger[_0x265d('0x17')]('AddTags',_0x34ca24['message'],_0x1cf2f5);_0x86919(_this['error'](0x1f4,_0x34ca24[_0x265d('0x19')]));});});}; \ No newline at end of file +var _0x6c58=['client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1890d2,_0x307871){var _0x35480c=function(_0x24944e){while(--_0x24944e){_0x1890d2['push'](_0x1890d2['shift']());}};_0x35480c(++_0x307871);}(_0x6c58,0x19b));var _0x86c5=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6c58[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x86c5('0x0'));var util=require(_0x86c5('0x1'));var moment=require(_0x86c5('0x2'));var BPromise=require(_0x86c5('0x3'));var rs=require(_0x86c5('0x4'));var fs=require('fs');var Redis=require(_0x86c5('0x5'));var db=require(_0x86c5('0x6'))['db'];var utils=require(_0x86c5('0x7'));var logger=require(_0x86c5('0x8'))(_0x86c5('0x9'));var config=require(_0x86c5('0xa'));var jayson=require(_0x86c5('0xb'));var client=jayson[_0x86c5('0xc')][_0x86c5('0xd')]({'port':0x232a});config[_0x86c5('0xe')]=_['defaults'](config['redis'],{'host':_0x86c5('0xf'),'port':0x18eb});var socket=require(_0x86c5('0x10'))(new Redis(config[_0x86c5('0xe')]));require(_0x86c5('0x11'))[_0x86c5('0x12')](socket);function respondWithRpcPromise(_0x4ec2fb,_0x94415a,_0xb12c8a){return new BPromise(function(_0x2f7557,_0x2327dd){return client['request'](_0x4ec2fb,_0xb12c8a)[_0x86c5('0x13')](function(_0x2ef307){logger[_0x86c5('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x94415a,_0x86c5('0x15'));logger[_0x86c5('0x16')](_0x86c5('0x17'),_0x94415a,_0x86c5('0x15'),JSON[_0x86c5('0x18')](_0x2ef307));if(_0x2ef307[_0x86c5('0x19')]){if(_0x2ef307[_0x86c5('0x19')][_0x86c5('0x1a')]===0x1f4){logger[_0x86c5('0x19')](_0x86c5('0x1b'),_0x94415a,_0x2ef307['error'][_0x86c5('0x1c')]);return _0x2327dd(_0x2ef307[_0x86c5('0x19')][_0x86c5('0x1c')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x94415a,_0x2ef307[_0x86c5('0x19')][_0x86c5('0x1c')]);return _0x2f7557(_0x2ef307[_0x86c5('0x19')]['message']);}else{logger[_0x86c5('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x94415a,_0x86c5('0x15'));_0x2f7557(_0x2ef307[_0x86c5('0x1d')][_0x86c5('0x1c')]);}})[_0x86c5('0x1e')](function(_0x5c8593){logger[_0x86c5('0x19')](_0x86c5('0x1b'),_0x94415a,_0x5c8593);_0x2327dd(_0x5c8593);});});}exports[_0x86c5('0x1f')]=function(_0x11cb4b){var _0x105f0e=this;return new Promise(function(_0x2f8cf2,_0x4b6206){return db[_0x86c5('0x20')][_0x86c5('0x21')](_0x11cb4b[_0x86c5('0x22')],{'raw':_0x11cb4b[_0x86c5('0x23')]?_0x11cb4b[_0x86c5('0x23')][_0x86c5('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11cb4b['options']?_0x11cb4b['options'][_0x86c5('0x25')]||null:null,'attributes':_0x11cb4b[_0x86c5('0x23')]?_0x11cb4b[_0x86c5('0x23')][_0x86c5('0x26')]||null:null,'limit':_0x11cb4b[_0x86c5('0x23')]?_0x11cb4b[_0x86c5('0x23')][_0x86c5('0x27')]||null:null})[_0x86c5('0x13')](function(_0xa4c348){logger[_0x86c5('0x14')](_0x86c5('0x1f'),_0x11cb4b);logger['debug'](_0x86c5('0x1f'),_0x11cb4b,JSON[_0x86c5('0x18')](_0xa4c348));_0x2f8cf2(_0xa4c348);})[_0x86c5('0x1e')](function(_0x337dfa){logger[_0x86c5('0x19')]('UpdateWhatsappInteraction',_0x337dfa[_0x86c5('0x1c')],_0x11cb4b);_0x4b6206(_0x105f0e[_0x86c5('0x19')](0x1f4,_0x337dfa[_0x86c5('0x1c')]));});});};exports[_0x86c5('0x28')]=function(_0x1f3980){return new Promise(function(_0x1c97ac,_0x4f0e9c){return db[_0x86c5('0x20')][_0x86c5('0x29')]({'where':_0x1f3980[_0x86c5('0x23')]?_0x1f3980[_0x86c5('0x23')][_0x86c5('0x25')]||null:null})['then'](function(_0x41c8a7){if(_0x41c8a7){return _0x41c8a7[_0x86c5('0x2a')](_0x1f3980[_0x86c5('0x22')][_0x86c5('0x2b')],_[_0x86c5('0x2c')](_0x1f3980[_0x86c5('0x22')],['ids','id'])||{});}})[_0x86c5('0x2d')](function(_0x386235){logger['info'](_0x86c5('0x2e'),_0x1f3980);logger[_0x86c5('0x16')](_0x86c5('0x2e'),_0x1f3980,JSON[_0x86c5('0x18')](_0x386235));_0x1c97ac(_0x386235);})[_0x86c5('0x1e')](function(_0x455717){logger['error'](_0x86c5('0x2e'),_0x455717['message'],_0x1f3980);_0x4f0e9c(_this[_0x86c5('0x19')](0x1f4,_0x455717['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 3780e6c..74ced27 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 _0xfac1=['length','./whatsappInteraction.events','save','remove','update','removeListener','register'];(function(_0x1eb10f,_0x122f85){var _0x2f51fc=function(_0x59de9a){while(--_0x59de9a){_0x1eb10f['push'](_0x1eb10f['shift']());}};_0x2f51fc(++_0x122f85);}(_0xfac1,0xa2));var _0x1fac=function(_0x5ed082,_0x12c0ef){_0x5ed082=_0x5ed082-0x0;var _0x1423a9=_0xfac1[_0x5ed082];return _0x1423a9;};'use strict';var WhatsappInteractionEvents=require(_0x1fac('0x0'));var events=[_0x1fac('0x1'),_0x1fac('0x2'),_0x1fac('0x3')];function createListener(_0x25ab6c,_0x1ef58b){return function(_0x25e019){_0x1ef58b['emit'](_0x25ab6c,_0x25e019);};}function removeListener(_0x787279,_0x142580){return function(){WhatsappInteractionEvents[_0x1fac('0x4')](_0x787279,_0x142580);};}exports[_0x1fac('0x5')]=function(_0x5b8896){for(var _0x4352d7=0x0,_0x37de8f=events[_0x1fac('0x6')];_0x4352d7<_0x37de8f;_0x4352d7++){var _0x5d5a7b=events[_0x4352d7];var _0x17bbcd=createListener('whatsappInteraction:'+_0x5d5a7b,_0x5b8896);WhatsappInteractionEvents['on'](_0x5d5a7b,_0x17bbcd);}}; \ No newline at end of file +var _0x9647=['save','update','emit','removeListener','register','./whatsappInteraction.events'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x9647,0xf5));var _0x7964=function(_0x50d5d9,_0x4ac058){_0x50d5d9=_0x50d5d9-0x0;var _0x44b0f1=_0x9647[_0x50d5d9];return _0x44b0f1;};'use strict';var WhatsappInteractionEvents=require(_0x7964('0x0'));var events=[_0x7964('0x1'),'remove',_0x7964('0x2')];function createListener(_0x3cbda7,_0x5bb1a9){return function(_0x3adc45){_0x5bb1a9[_0x7964('0x3')](_0x3cbda7,_0x3adc45);};}function removeListener(_0x3077e1,_0x4c4d13){return function(){WhatsappInteractionEvents[_0x7964('0x4')](_0x3077e1,_0x4c4d13);};}exports[_0x7964('0x5')]=function(_0x3375e6){for(var _0x248aa4=0x0,_0x222110=events['length'];_0x248aa4<_0x222110;_0x248aa4++){var _0x56bbdd=events[_0x248aa4];var _0x8ac0b2=createListener('whatsappInteraction:'+_0x56bbdd,_0x3375e6);WhatsappInteractionEvents['on'](_0x56bbdd,_0x8ac0b2);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 69d8f53..09f5267 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 _0x5258=['isAuthenticated','show','post','whatsappmessage:create','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','index','/describe'];(function(_0x59478e,_0x5d98d6){var _0x3c6ea1=function(_0x8ec690){while(--_0x8ec690){_0x59478e['push'](_0x59478e['shift']());}};_0x3c6ea1(++_0x5d98d6);}(_0x5258,0x147));var _0x8525=function(_0x480ab2,_0x20b3a7){_0x480ab2=_0x480ab2-0x0;var _0x35c362=_0x5258[_0x480ab2];return _0x35c362;};'use strict';var multer=require(_0x8525('0x0'));var util=require(_0x8525('0x1'));var path=require('path');var timeout=require(_0x8525('0x2'));var express=require(_0x8525('0x3'));var router=express[_0x8525('0x4')]();var fs_extra=require(_0x8525('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8525('0x6'));var config=require('../../config/environment');var controller=require(_0x8525('0x7'));router[_0x8525('0x8')]('/',auth['isAuthenticated'](),controller[_0x8525('0x9')]);router[_0x8525('0x8')](_0x8525('0xa'),auth[_0x8525('0xb')](),controller['describe']);router[_0x8525('0x8')]('/:id',auth[_0x8525('0xb')](),controller[_0x8525('0xc')]);router[_0x8525('0xd')]('/',auth[_0x8525('0xb')](),interaction['tracked']('whatsapp',_0x8525('0xe')),controller['create']);router['post'](_0x8525('0xf'),controller[_0x8525('0x10')]);router[_0x8525('0x11')](_0x8525('0x12'),auth[_0x8525('0xb')](),controller[_0x8525('0x13')]);router['put'](_0x8525('0x14'),auth[_0x8525('0xb')](),controller['accept']);router[_0x8525('0x11')](_0x8525('0x15'),auth[_0x8525('0xb')](),controller[_0x8525('0x16')]);router[_0x8525('0x17')]('/:id',auth[_0x8525('0xb')](),controller[_0x8525('0x18')]);module[_0x8525('0x19')]=router; \ No newline at end of file +var _0x8b21=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports'];(function(_0x563c70,_0x3a8058){var _0x5a2367=function(_0x4fcf5e){while(--_0x4fcf5e){_0x563c70['push'](_0x563c70['shift']());}};_0x5a2367(++_0x3a8058);}(_0x8b21,0xe0));var _0x18b2=function(_0x308a93,_0x38a6c1){_0x308a93=_0x308a93-0x0;var _0x252e22=_0x8b21[_0x308a93];return _0x252e22;};'use strict';var multer=require(_0x18b2('0x0'));var util=require(_0x18b2('0x1'));var path=require(_0x18b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x18b2('0x3'));var router=express[_0x18b2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18b2('0x5'));var interaction=require(_0x18b2('0x6'));var config=require(_0x18b2('0x7'));var controller=require('./whatsappMessage.controller');router[_0x18b2('0x8')]('/',auth[_0x18b2('0x9')](),controller[_0x18b2('0xa')]);router['get'](_0x18b2('0xb'),auth[_0x18b2('0x9')](),controller[_0x18b2('0xc')]);router[_0x18b2('0x8')](_0x18b2('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x18b2('0xe')]('/',auth[_0x18b2('0x9')](),interaction[_0x18b2('0xf')](_0x18b2('0x10'),_0x18b2('0x11')),controller[_0x18b2('0x12')]);router[_0x18b2('0xe')](_0x18b2('0x13'),controller['status']);router[_0x18b2('0x14')](_0x18b2('0xd'),auth['isAuthenticated'](),controller[_0x18b2('0x15')]);router['put'](_0x18b2('0x16'),auth[_0x18b2('0x9')](),controller[_0x18b2('0x17')]);router[_0x18b2('0x14')](_0x18b2('0x18'),auth[_0x18b2('0x9')](),controller[_0x18b2('0x19')]);router['delete'](_0x18b2('0xd'),auth['isAuthenticated'](),controller[_0x18b2('0x1a')]);module[_0x18b2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index e0ab3e8..a89d2ff 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 _0xf101=['TEXT','medium','BOOLEAN','ENUM','STRING','DATE','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf101,0x141));var _0x1f10=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xf101[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require('sequelize');module[_0x1f10('0x0')]={'body':{'type':Sequelize[_0x1f10('0x1')](_0x1f10('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1f10('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f10('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1f10('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1f10('0x5')]},'readAt':{'type':Sequelize[_0x1f10('0x6')]},'secret':{'type':Sequelize[_0x1f10('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f10('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2873=['sequelize','exports','ENUM','out','STRING','DATE','BOOLEAN','TEXT'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0x2873,0x168));var _0x3287=function(_0x3c21a3,_0x4e109c){_0x3c21a3=_0x3c21a3-0x0;var _0x54581e=_0x2873[_0x3c21a3];return _0x54581e;};'use strict';var Sequelize=require(_0x3287('0x0'));module[_0x3287('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3287('0x2')]('in',_0x3287('0x3')),'defaultValue':_0x3287('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3287('0x4')]},'readAt':{'type':Sequelize[_0x3287('0x5')]},'secret':{'type':Sequelize[_0x3287('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3287('0x4')]},'providerResponse':{'type':Sequelize[_0x3287('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c663478..8c02d95 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 _0xdeb9=['acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','whatsapp-interactions','reject','WhatsappInteraction','role','RejectMessage','rejectMessage','contact','email','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','end','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','describe','../../config/logger','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage'];(function(_0x30f836,_0x3fac56){var _0x8dd7d0=function(_0x486ddc){while(--_0x486ddc){_0x30f836['push'](_0x30f836['shift']());}};_0x8dd7d0(++_0x3fac56);}(_0xdeb9,0x132));var _0x9deb=function(_0x2f723a,_0x139ccf){_0x2f723a=_0x2f723a-0x0;var _0x9e148b=_0xdeb9[_0x2f723a];return _0x9e148b;};'use strict';var emlformat=require(_0x9deb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9deb('0x1'));var jsonpatch=require(_0x9deb('0x2'));var rp=require(_0x9deb('0x3'));var moment=require(_0x9deb('0x4'));var BPromise=require(_0x9deb('0x5'));var Mustache=require(_0x9deb('0x6'));var util=require(_0x9deb('0x7'));var path=require(_0x9deb('0x8'));var sox=require(_0x9deb('0x9'));var csv=require(_0x9deb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9deb('0xb'));var _=require('lodash');var squel=require(_0x9deb('0xc'));var crypto=require('crypto');var jsforce=require(_0x9deb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9deb('0xa'));var querystring=require('querystring');var Papa=require(_0x9deb('0xe'));var Redis=require('ioredis');var authService=require(_0x9deb('0xf'));var qs=require(_0x9deb('0x10'));var as=require(_0x9deb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9deb('0x12'));var config=require(_0x9deb('0x13'));var licenseUtil=require(_0x9deb('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9deb('0x15')](config['redis'],{'host':_0x9deb('0x16'),'port':0x18eb});var socket=require(_0x9deb('0x17'))(new Redis(config[_0x9deb('0x18')]));require(_0x9deb('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9deb('0x1a')]({'port':0x232c});var client9002=jayson[_0x9deb('0x1b')][_0x9deb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xa6012c,_0x109c91,_0x51daf2,_0x1ff8c6){return new BPromise(function(_0x7a9abf,_0x452734){var _0x3c50ab=_0x1ff8c6||client;return _0x3c50ab[_0x9deb('0x1c')](_0xa6012c,_0x51daf2)['then'](function(_0x32f6dc){logger[_0x9deb('0x1d')](_0x9deb('0x1e'),_0x109c91,'request\x20sent');logger[_0x9deb('0x1f')](_0x9deb('0x20'),_0x109c91,'request\x20sent',JSON[_0x9deb('0x21')](_0x32f6dc));if(_0x32f6dc[_0x9deb('0x22')]){if(_0x32f6dc[_0x9deb('0x22')][_0x9deb('0x23')]===0x1f4){logger['error'](_0x9deb('0x1e'),_0x109c91,_0x32f6dc[_0x9deb('0x22')][_0x9deb('0x24')]);return _0x452734(_0x32f6dc[_0x9deb('0x22')]['message']);}logger[_0x9deb('0x22')](_0x9deb('0x1e'),_0x109c91,_0x32f6dc[_0x9deb('0x22')][_0x9deb('0x24')]);return _0x7a9abf(_0x32f6dc[_0x9deb('0x22')]['message']);}else{logger['info'](_0x9deb('0x1e'),_0x109c91,_0x9deb('0x25'));_0x7a9abf(_0x32f6dc['result'][_0x9deb('0x24')]);}})[_0x9deb('0x26')](function(_0x3fe95c){logger[_0x9deb('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x109c91,_0x3fe95c);_0x452734(_0x3fe95c);});});}function respondWithStatusCode(_0x2d45a9,_0x341373){_0x341373=_0x341373||0xcc;return function(_0x21a89d){if(_0x21a89d){return _0x2d45a9[_0x9deb('0x27')](_0x341373);}return _0x2d45a9[_0x9deb('0x28')](_0x341373)['end']();};}function respondWithResult(_0x89ab32,_0x5cdd16){_0x5cdd16=_0x5cdd16||0xc8;return function(_0x5a267e){if(_0x5a267e){return _0x89ab32[_0x9deb('0x28')](_0x5cdd16)[_0x9deb('0x29')](_0x5a267e);}};}function respondWithFilteredResult(_0x3a89be,_0x19acd8){return function(_0x3d464f){if(_0x3d464f){var _0x437550=typeof _0x19acd8[_0x9deb('0x2a')]===_0x9deb('0x2b')&&typeof _0x19acd8[_0x9deb('0x2c')]==='undefined';var _0x326935=_0x3d464f[_0x9deb('0x2d')];var _0xdcdd36=_0x437550?0x0:_0x19acd8[_0x9deb('0x2a')];var _0x497834=_0x437550?_0x3d464f[_0x9deb('0x2d')]:_0x19acd8[_0x9deb('0x2a')]+_0x19acd8[_0x9deb('0x2c')];var _0x321067;if(_0x497834>=_0x326935){_0x497834=_0x326935;_0x321067=0xc8;}else{_0x321067=0xce;}_0x3a89be[_0x9deb('0x28')](_0x321067);return _0x3a89be[_0x9deb('0x2e')]('Content-Range',_0xdcdd36+'-'+_0x497834+'/'+_0x326935)['json'](_0x3d464f);}return null;};}function patchUpdates(_0x1776e6){return function(_0x5461ee){try{jsonpatch['apply'](_0x5461ee,_0x1776e6,!![]);}catch(_0x1932e1){return BPromise['reject'](_0x1932e1);}return _0x5461ee['save']();};}function saveUpdates(_0x22ba01,_0x2f3468){return function(_0x4560b8){if(_0x4560b8){return _0x4560b8[_0x9deb('0x2f')](_0x22ba01)['then'](function(_0x5984b0){return _0x5984b0;});}return null;};}function removeEntity(_0x10ecec,_0x546fa7){return function(_0x391ad7){if(_0x391ad7){return _0x391ad7[_0x9deb('0x30')]()[_0x9deb('0x31')](function(){_0x10ecec[_0x9deb('0x28')](0xcc)[_0x9deb('0x32')]();});}};}function handleEntityNotFound(_0x33066f,_0x15ac16){return function(_0x3852ad){if(!_0x3852ad){_0x33066f[_0x9deb('0x27')](0x194);}return _0x3852ad;};}function handleError(_0x2505ab,_0x8cdd6c){_0x8cdd6c=_0x8cdd6c||0x1f4;return function(_0x4e9a27){logger[_0x9deb('0x22')](_0x4e9a27[_0x9deb('0x33')]);if(_0x4e9a27[_0x9deb('0x34')]){delete _0x4e9a27[_0x9deb('0x34')];}_0x2505ab[_0x9deb('0x28')](_0x8cdd6c)[_0x9deb('0x35')](_0x4e9a27);};}exports['index']=function(_0x6c5eb2,_0x3fd3eb){var _0x33aced={},_0x3560f7={},_0x441eb1={'count':0x0,'rows':[]};var _0x5b4d41=_[_0x9deb('0x36')](db[_0x9deb('0x37')][_0x9deb('0x38')],function(_0x27b6c7){return{'name':_0x27b6c7[_0x9deb('0x39')],'type':_0x27b6c7[_0x9deb('0x3a')][_0x9deb('0x3b')]};});_0x3560f7['model']=_['map'](_0x5b4d41,_0x9deb('0x34'));_0x3560f7[_0x9deb('0x3c')]=_[_0x9deb('0x3d')](_0x6c5eb2['query']);_0x3560f7[_0x9deb('0x3e')]=_[_0x9deb('0x3f')](_0x3560f7[_0x9deb('0x40')],_0x3560f7[_0x9deb('0x3c')]);_0x33aced['attributes']=_[_0x9deb('0x3f')](_0x3560f7['model'],qs['fields'](_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x41')]));_0x33aced[_0x9deb('0x42')]=_0x33aced[_0x9deb('0x42')][_0x9deb('0x43')]?_0x33aced['attributes']:_0x3560f7[_0x9deb('0x40')];if(!_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x44')](_0x9deb('0x45'))){_0x33aced[_0x9deb('0x2c')]=qs[_0x9deb('0x2c')](_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x2c')]);_0x33aced[_0x9deb('0x2a')]=qs['offset'](_0x6c5eb2[_0x9deb('0x3c')]['offset']);}_0x33aced[_0x9deb('0x46')]=qs[_0x9deb('0x47')](_0x6c5eb2['query'][_0x9deb('0x47')]);_0x33aced[_0x9deb('0x48')]=qs[_0x9deb('0x3e')](_[_0x9deb('0x49')](_0x6c5eb2[_0x9deb('0x3c')],_0x3560f7[_0x9deb('0x3e')]),_0x5b4d41);if(_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x4a')]){_0x33aced[_0x9deb('0x48')]=_[_0x9deb('0x4b')](_0x33aced['where'],{'$or':_[_0x9deb('0x36')](_0x5b4d41,function(_0x28f25a){if(_0x28f25a[_0x9deb('0x3a')]!==_0x9deb('0x4c')){var _0x3981e7={};_0x3981e7[_0x28f25a['name']]={'$like':'%'+_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x4a')]+'%'};return _0x3981e7;}})});}_0x33aced=_['merge']({},_0x33aced,_0x6c5eb2[_0x9deb('0x4d')]);var _0x39ef79={'where':_0x33aced[_0x9deb('0x48')]};return db[_0x9deb('0x37')][_0x9deb('0x2d')](_0x39ef79)[_0x9deb('0x31')](function(_0x50e504){_0x441eb1['count']=_0x50e504;if(_0x6c5eb2[_0x9deb('0x3c')][_0x9deb('0x4e')]){_0x33aced[_0x9deb('0x4f')]=[{'all':!![]}];}return db[_0x9deb('0x37')][_0x9deb('0x50')](_0x33aced);})[_0x9deb('0x31')](function(_0x52b0a2){_0x441eb1['rows']=_0x52b0a2;return _0x441eb1;})[_0x9deb('0x31')](respondWithFilteredResult(_0x3fd3eb,_0x33aced))[_0x9deb('0x26')](handleError(_0x3fd3eb,null));};exports[_0x9deb('0x51')]=function(_0x2b5be1,_0x38cea3){var _0x3daf69={'raw':!![],'where':{'id':_0x2b5be1[_0x9deb('0x52')]['id']}},_0x4287ff={};_0x4287ff['model']=_[_0x9deb('0x3d')](db['WhatsappMessage'][_0x9deb('0x38')]);_0x4287ff['query']=_[_0x9deb('0x3d')](_0x2b5be1['query']);_0x4287ff[_0x9deb('0x3e')]=_[_0x9deb('0x3f')](_0x4287ff[_0x9deb('0x40')],_0x4287ff[_0x9deb('0x3c')]);_0x3daf69[_0x9deb('0x42')]=_[_0x9deb('0x3f')](_0x4287ff[_0x9deb('0x40')],qs[_0x9deb('0x41')](_0x2b5be1['query'][_0x9deb('0x41')]));_0x3daf69[_0x9deb('0x42')]=_0x3daf69['attributes']['length']?_0x3daf69['attributes']:_0x4287ff[_0x9deb('0x40')];if(_0x2b5be1[_0x9deb('0x3c')]['includeAll']){_0x3daf69[_0x9deb('0x4f')]=[{'all':!![]}];}_0x3daf69=_[_0x9deb('0x4b')]({},_0x3daf69,_0x2b5be1[_0x9deb('0x4d')]);return db[_0x9deb('0x37')][_0x9deb('0x53')](_0x3daf69)[_0x9deb('0x31')](handleEntityNotFound(_0x38cea3,null))[_0x9deb('0x31')](respondWithResult(_0x38cea3,null))[_0x9deb('0x26')](handleError(_0x38cea3,null));};exports[_0x9deb('0x54')]=function(_0x5d353d,_0x4e9fbf){return db['WhatsappMessage'][_0x9deb('0x54')](_0x5d353d[_0x9deb('0x55')],{})['then'](respondWithResult(_0x4e9fbf,0xc9))[_0x9deb('0x26')](handleError(_0x4e9fbf,null));};exports[_0x9deb('0x2f')]=function(_0x57114b,_0x14db8b){if(_0x57114b[_0x9deb('0x55')]['id']){delete _0x57114b[_0x9deb('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x57114b[_0x9deb('0x52')]['id']}})[_0x9deb('0x31')](handleEntityNotFound(_0x14db8b,null))[_0x9deb('0x31')](saveUpdates(_0x57114b[_0x9deb('0x55')],null))[_0x9deb('0x31')](respondWithResult(_0x14db8b,null))[_0x9deb('0x26')](handleError(_0x14db8b,null));};exports['destroy']=function(_0x360bcd,_0x3f4414){return db['WhatsappMessage'][_0x9deb('0x53')]({'where':{'id':_0x360bcd[_0x9deb('0x52')]['id']}})[_0x9deb('0x31')](handleEntityNotFound(_0x3f4414,null))['then'](removeEntity(_0x3f4414,null))[_0x9deb('0x26')](handleError(_0x3f4414,null));};exports['describe']=function(_0x35ad9a,_0x58466a){return db['WhatsappMessage'][_0x9deb('0x56')]()['then'](respondWithResult(_0x58466a,null))[_0x9deb('0x26')](handleError(_0x58466a,null));};var interaction_log=require(_0x9deb('0x57'))('whatsapp-interactions');exports[_0x9deb('0x58')]=function(_0x561bdd,_0x327f27,_0xf8a357){var _0x116061={'agent':{},'channel':_0x9deb('0x59')};if(_0x561bdd['body']['id']){delete _0x561bdd[_0x9deb('0x55')]['id'];}_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5a')]=!![];_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5b')]=moment()['format'](_0x9deb('0x5c'));_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')]=_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')]||_0x561bdd['user']['id'];_0x116061[_0x9deb('0x5e')]['id']=_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')];return db[_0x9deb('0x37')]['find']({'where':{'id':_0x561bdd[_0x9deb('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x327f27,null))[_0x9deb('0x31')](saveUpdates(_0x561bdd['body'],null))[_0x9deb('0x31')](function(_0x4e739a){if(_0x4e739a){_0x116061[_0x9deb('0x24')]=_0x4e739a['get']({'plain':!![]});return db['WhatsappInteraction'][_0x9deb('0x53')]({'where':{'id':_0x4e739a[_0x9deb('0x5f')]}});}return null;})[_0x9deb('0x31')](handleEntityNotFound(_0x327f27,null))['then'](function(_0x3dea87){if(_0x3dea87){return _0x3dea87['update']({'UserId':_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')],'read1stAt':_[_0x9deb('0x60')](_0x3dea87[_0x9deb('0x61')])?moment()[_0x9deb('0x62')](_0x9deb('0x5c')):undefined});}return null;})[_0x9deb('0x31')](function(_0x339664){if(_0x339664){_0x116061[_0x9deb('0x63')]=_0x339664[_0x9deb('0x64')]({'plain':!![]});interaction_log[_0x9deb('0x1d')](_0x9deb('0x65'),_0x561bdd[_0x9deb('0x66')]['id'],_0x561bdd[_0x9deb('0x66')]['name'],_0x561bdd['user']['role'],_0x116061[_0x9deb('0x63')]['id'],_0x561bdd[_0x9deb('0x55')]?JSON[_0x9deb('0x21')](_0x561bdd[_0x9deb('0x55')]):_0x9deb('0x67'));return respondWithRpcPromise(_0x9deb('0x68'),_0x9deb('0x69'),_0x116061);}return null;})['then'](function(_0x1382a8){var _0x44550c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1382a8[_0x9deb('0x24')][_0x9deb('0x6a')];return db[_0x9deb('0x6b')][_0x9deb('0x3c')](_0x44550c,{'type':db[_0x9deb('0x6c')][_0x9deb('0x6d')][_0x9deb('0x6e')],'raw':!![]})[_0x9deb('0x31')](function(_0x4eef30){return _0x4eef30;});})['then'](function(_0x51c335){if(_0x51c335){_0x116061[_0x9deb('0x24')]['contact']=_0x51c335[0x0];if(!_0x561bdd[_0x9deb('0x55')][_0x9deb('0x5d')])return;return db['User']['find']({'where':{'id':_0x561bdd['body'][_0x9deb('0x5d')],'role':_0x9deb('0x5e')},'attributes':['id',_0x9deb('0x34'),_0x9deb('0x6f'),'email',_0x9deb('0x70')],'raw':!![]});}return null;})[_0x9deb('0x31')](function(_0x47677e){if(!_0x47677e)return null;_0x116061[_0x9deb('0x24')][_0x9deb('0x5e')]=_0x47677e;return _0x116061;})['then'](function(_0x1aa1cf){if(_0x1aa1cf){if(_0x561bdd[_0x9deb('0x55')][_0x9deb('0x71')]){_0x116061[_0x9deb('0x24')][_0x9deb('0x72')]=util[_0x9deb('0x62')](_0x9deb('0x73'),_0x561bdd[_0x9deb('0x66')][_0x9deb('0x34')]);_0x116061[_0x9deb('0x24')][_0x9deb('0x74')]=_0x116061[_0x9deb('0x74')];_0x116061[_0x9deb('0x24')][_0x9deb('0x75')]=_0x116061[_0x9deb('0x74')];_0x116061[_0x9deb('0x24')][_0x9deb('0x76')]=_0x9deb('0x58');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9deb('0x77'),'message':_0x116061['message']},client9002)[_0x9deb('0x31')](function(){return _0x116061;});}return _0x116061;}return null;})[_0x9deb('0x31')](respondWithResult(_0x327f27,null))[_0x9deb('0x26')](handleError(_0x327f27,null));};var interaction_log=require(_0x9deb('0x57'))(_0x9deb('0x78'));exports[_0x9deb('0x79')]=function(_0x208d03,_0x1400db,_0x286018){var _0x408a6a={'agent':{},'channel':_0x9deb('0x59')};if(_0x208d03[_0x9deb('0x55')]['id']){delete _0x208d03[_0x9deb('0x55')]['id'];}_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')]=_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')]||_0x208d03['user']['id'];_0x408a6a[_0x9deb('0x5e')]['id']=_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')];return db[_0x9deb('0x37')]['find']({'where':{'id':_0x208d03[_0x9deb('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1400db,null))[_0x9deb('0x31')](function(_0x29a787){if(_0x29a787){_0x408a6a['message']=_0x29a787[_0x9deb('0x64')]({'plain':!![]});return db[_0x9deb('0x7a')][_0x9deb('0x53')]({'where':{'id':_0x29a787[_0x9deb('0x5f')]}});}return null;})[_0x9deb('0x31')](handleEntityNotFound(_0x1400db,null))['then'](function(_0x138b20){if(_0x138b20){_0x408a6a[_0x9deb('0x63')]=_0x138b20['get']({'plain':!![]});interaction_log[_0x9deb('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x208d03[_0x9deb('0x66')]['id'],_0x208d03[_0x9deb('0x66')]['name'],_0x208d03[_0x9deb('0x66')][_0x9deb('0x7b')],_0x408a6a[_0x9deb('0x63')]['id'],_0x208d03[_0x9deb('0x55')]?JSON['stringify'](_0x208d03[_0x9deb('0x55')]):'null');return respondWithRpcPromise(_0x9deb('0x7c'),_0x9deb('0x7d'),_0x408a6a);}return null;})[_0x9deb('0x31')](function(_0x29c19c){var _0x31c0db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29c19c[_0x9deb('0x24')]['ContactId'];return db[_0x9deb('0x6b')]['query'](_0x31c0db,{'type':db[_0x9deb('0x6c')][_0x9deb('0x6d')]['SELECT'],'raw':!![]})[_0x9deb('0x31')](function(_0x47be51){return _0x47be51;});})[_0x9deb('0x31')](function(_0x8386b5){if(_0x8386b5){_0x408a6a[_0x9deb('0x24')][_0x9deb('0x7e')]=_0x8386b5[0x0];if(!_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')])return;return db['User']['find']({'where':{'id':_0x208d03[_0x9deb('0x55')][_0x9deb('0x5d')],'role':'agent'},'attributes':['id',_0x9deb('0x34'),'fullname',_0x9deb('0x7f'),_0x9deb('0x70')],'raw':!![]});}return null;})[_0x9deb('0x31')](function(_0x4dc09e){if(!_0x4dc09e)return null;_0x408a6a[_0x9deb('0x24')]['agent']=_0x4dc09e;return _0x408a6a;})['then'](function(_0x4b8568){if(_0x4b8568){_0x4b8568['message'][_0x9deb('0x72')]=util[_0x9deb('0x62')](_0x9deb('0x73'),_0x208d03[_0x9deb('0x66')][_0x9deb('0x34')]);_0x4b8568['message'][_0x9deb('0x74')]=_0x408a6a['channel'];_0x4b8568['message'][_0x9deb('0x75')]=_0x408a6a[_0x9deb('0x74')];_0x4b8568['message'][_0x9deb('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x9deb('0x80'),'message':_0x4b8568['message']},client9002);return _0x408a6a;}return null;})[_0x9deb('0x31')](respondWithResult(_0x1400db,null))[_0x9deb('0x26')](handleError(_0x1400db,null));};exports[_0x9deb('0x28')]=function(_0x4d3abb,_0x55a6b3,_0x29316e){if(_0x4d3abb[_0x9deb('0x55')]['id']){delete _0x4d3abb['body']['id'];}var _0x1f0148;return db['WhatsappMessage'][_0x9deb('0x53')]({'where':{'id':_0x4d3abb[_0x9deb('0x52')]['id']}})[_0x9deb('0x31')](handleEntityNotFound(_0x55a6b3,null))[_0x9deb('0x31')](function(_0xe0409e){if(_0xe0409e){_0x1f0148=_0xe0409e;return db[_0x9deb('0x81')]['find']({'where':{'id':_0xe0409e[_0x9deb('0x82')]}});}})[_0x9deb('0x31')](handleEntityNotFound(_0x55a6b3,null))[_0x9deb('0x31')](function(_0x1cfe25){if(_0x1cfe25){logger[_0x9deb('0x1f')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x9deb('0x28'),_0x9deb('0x83'),_0x1cfe25['type'],util[_0x9deb('0x84')](_0x4d3abb[_0x9deb('0x55')],{'showHidden':![],'depth':null}));switch(_0x1cfe25[_0x9deb('0x3a')]){case _0x9deb('0x85'):if(_0x4d3abb['body']['MessageSid']&&_0x4d3abb[_0x9deb('0x55')][_0x9deb('0x86')]===_0x1f0148['messageId']&&_0x4d3abb['body'][_0x9deb('0x87')]&&_0x4d3abb[_0x9deb('0x55')][_0x9deb('0x87')]===_0x9deb('0x5a')){return _0x1f0148['update']({'read':!![]});}else{logger[_0x9deb('0x22')](_0x9deb('0x88'),'status','twilio',util['inspect'](_0x4d3abb[_0x9deb('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1f0148;}})[_0x9deb('0x31')](respondWithResult(_0x55a6b3,null))['catch'](handleError(_0x55a6b3,null));}; \ No newline at end of file +var _0xff25=['body','params','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','update','isNil','read1stAt','interaction','get','name','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','internal','SIP/%s','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','type','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','end','stack','map','WhatsappMessage','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','fields','find','create'];(function(_0x477395,_0x576f73){var _0x42cc2c=function(_0x5d1cc9){while(--_0x5d1cc9){_0x477395['push'](_0x477395['shift']());}};_0x42cc2c(++_0x576f73);}(_0xff25,0xc7));var _0x5ff2=function(_0x23f9a2,_0x30eef5){_0x23f9a2=_0x23f9a2-0x0;var _0x3b9c50=_0xff25[_0x23f9a2];return _0x3b9c50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ff2('0x0'));var jsonpatch=require(_0x5ff2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ff2('0x2'));var Mustache=require(_0x5ff2('0x3'));var util=require(_0x5ff2('0x4'));var path=require('path');var sox=require(_0x5ff2('0x5'));var csv=require(_0x5ff2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ff2('0x7'));var _=require('lodash');var squel=require(_0x5ff2('0x8'));var crypto=require(_0x5ff2('0x9'));var jsforce=require(_0x5ff2('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ff2('0xb'));var Papa=require(_0x5ff2('0xc'));var Redis=require(_0x5ff2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5ff2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ff2('0xf'))(_0x5ff2('0x10'));var utils=require(_0x5ff2('0x11'));var config=require(_0x5ff2('0x12'));var licenseUtil=require(_0x5ff2('0x13'));var db=require(_0x5ff2('0x14'))['db'];config[_0x5ff2('0x15')]=_[_0x5ff2('0x16')](config[_0x5ff2('0x15')],{'host':_0x5ff2('0x17'),'port':0x18eb});var socket=require(_0x5ff2('0x18'))(new Redis(config['redis']));require(_0x5ff2('0x19'))[_0x5ff2('0x1a')](socket);var jayson=require(_0x5ff2('0x1b'));var client=jayson[_0x5ff2('0x1c')][_0x5ff2('0x1d')]({'port':0x232c});var client9002=jayson[_0x5ff2('0x1c')][_0x5ff2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x40db9b,_0x395965,_0x15f0e5,_0x460b59){return new BPromise(function(_0x54297e,_0x2225d6){var _0x120970=_0x460b59||client;return _0x120970[_0x5ff2('0x1e')](_0x40db9b,_0x15f0e5)[_0x5ff2('0x1f')](function(_0x277b01){logger['info'](_0x5ff2('0x20'),_0x395965,_0x5ff2('0x21'));logger[_0x5ff2('0x22')](_0x5ff2('0x23'),_0x395965,'request\x20sent',JSON['stringify'](_0x277b01));if(_0x277b01['error']){if(_0x277b01['error']['code']===0x1f4){logger[_0x5ff2('0x24')](_0x5ff2('0x20'),_0x395965,_0x277b01[_0x5ff2('0x24')][_0x5ff2('0x25')]);return _0x2225d6(_0x277b01[_0x5ff2('0x24')][_0x5ff2('0x25')]);}logger[_0x5ff2('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x395965,_0x277b01[_0x5ff2('0x24')][_0x5ff2('0x25')]);return _0x54297e(_0x277b01[_0x5ff2('0x24')][_0x5ff2('0x25')]);}else{logger[_0x5ff2('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x395965,_0x5ff2('0x21'));_0x54297e(_0x277b01['result'][_0x5ff2('0x25')]);}})['catch'](function(_0x1ac364){logger[_0x5ff2('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x395965,_0x1ac364);_0x2225d6(_0x1ac364);});});}function respondWithStatusCode(_0x15726b,_0x288c58){_0x288c58=_0x288c58||0xcc;return function(_0xd0e159){if(_0xd0e159){return _0x15726b[_0x5ff2('0x27')](_0x288c58);}return _0x15726b[_0x5ff2('0x28')](_0x288c58)['end']();};}function respondWithResult(_0x3e0d2b,_0xd82466){_0xd82466=_0xd82466||0xc8;return function(_0x1026fe){if(_0x1026fe){return _0x3e0d2b[_0x5ff2('0x28')](_0xd82466)[_0x5ff2('0x29')](_0x1026fe);}};}function respondWithFilteredResult(_0x484682,_0x21eb7f){return function(_0x30348c){if(_0x30348c){var _0x2d915b=typeof _0x21eb7f['offset']===_0x5ff2('0x2a')&&typeof _0x21eb7f[_0x5ff2('0x2b')]===_0x5ff2('0x2a');var _0x4c8093=_0x30348c[_0x5ff2('0x2c')];var _0x51ba3a=_0x2d915b?0x0:_0x21eb7f[_0x5ff2('0x2d')];var _0x17c885=_0x2d915b?_0x30348c[_0x5ff2('0x2c')]:_0x21eb7f[_0x5ff2('0x2d')]+_0x21eb7f['limit'];var _0x2ca4a5;if(_0x17c885>=_0x4c8093){_0x17c885=_0x4c8093;_0x2ca4a5=0xc8;}else{_0x2ca4a5=0xce;}_0x484682[_0x5ff2('0x28')](_0x2ca4a5);return _0x484682[_0x5ff2('0x2e')](_0x5ff2('0x2f'),_0x51ba3a+'-'+_0x17c885+'/'+_0x4c8093)[_0x5ff2('0x29')](_0x30348c);}return null;};}function patchUpdates(_0xf29c5f){return function(_0x361400){try{jsonpatch[_0x5ff2('0x30')](_0x361400,_0xf29c5f,!![]);}catch(_0x53017f){return BPromise[_0x5ff2('0x31')](_0x53017f);}return _0x361400[_0x5ff2('0x32')]();};}function saveUpdates(_0x43c84c,_0x1e8d4b){return function(_0x8365ff){if(_0x8365ff){return _0x8365ff['update'](_0x43c84c)[_0x5ff2('0x1f')](function(_0x1b9ce5){return _0x1b9ce5;});}return null;};}function removeEntity(_0x246ff2,_0x27db3f){return function(_0x8f343f){if(_0x8f343f){return _0x8f343f[_0x5ff2('0x33')]()['then'](function(){_0x246ff2[_0x5ff2('0x28')](0xcc)[_0x5ff2('0x34')]();});}};}function handleEntityNotFound(_0x4bab8b,_0x1ac068){return function(_0x566784){if(!_0x566784){_0x4bab8b[_0x5ff2('0x27')](0x194);}return _0x566784;};}function handleError(_0x404577,_0x2694f7){_0x2694f7=_0x2694f7||0x1f4;return function(_0x5e07ae){logger[_0x5ff2('0x24')](_0x5e07ae[_0x5ff2('0x35')]);if(_0x5e07ae['name']){delete _0x5e07ae['name'];}_0x404577[_0x5ff2('0x28')](_0x2694f7)['send'](_0x5e07ae);};}exports['index']=function(_0x4a51bb,_0xbdda17){var _0xada3cd={},_0x2e8f1c={},_0x4ce705={'count':0x0,'rows':[]};var _0x5d8b56=_[_0x5ff2('0x36')](db[_0x5ff2('0x37')]['rawAttributes'],function(_0xdf1165){return{'name':_0xdf1165[_0x5ff2('0x38')],'type':_0xdf1165['type']['key']};});_0x2e8f1c[_0x5ff2('0x39')]=_[_0x5ff2('0x36')](_0x5d8b56,'name');_0x2e8f1c[_0x5ff2('0x3a')]=_['keys'](_0x4a51bb[_0x5ff2('0x3a')]);_0x2e8f1c[_0x5ff2('0x3b')]=_[_0x5ff2('0x3c')](_0x2e8f1c[_0x5ff2('0x39')],_0x2e8f1c[_0x5ff2('0x3a')]);_0xada3cd['attributes']=_[_0x5ff2('0x3c')](_0x2e8f1c[_0x5ff2('0x39')],qs['fields'](_0x4a51bb[_0x5ff2('0x3a')]['fields']));_0xada3cd[_0x5ff2('0x3d')]=_0xada3cd[_0x5ff2('0x3d')][_0x5ff2('0x3e')]?_0xada3cd[_0x5ff2('0x3d')]:_0x2e8f1c[_0x5ff2('0x39')];if(!_0x4a51bb[_0x5ff2('0x3a')][_0x5ff2('0x3f')]('nolimit')){_0xada3cd[_0x5ff2('0x2b')]=qs['limit'](_0x4a51bb[_0x5ff2('0x3a')][_0x5ff2('0x2b')]);_0xada3cd[_0x5ff2('0x2d')]=qs[_0x5ff2('0x2d')](_0x4a51bb[_0x5ff2('0x3a')][_0x5ff2('0x2d')]);}_0xada3cd[_0x5ff2('0x40')]=qs[_0x5ff2('0x41')](_0x4a51bb[_0x5ff2('0x3a')]['sort']);_0xada3cd['where']=qs[_0x5ff2('0x3b')](_[_0x5ff2('0x42')](_0x4a51bb[_0x5ff2('0x3a')],_0x2e8f1c[_0x5ff2('0x3b')]),_0x5d8b56);if(_0x4a51bb[_0x5ff2('0x3a')][_0x5ff2('0x43')]){_0xada3cd['where']=_[_0x5ff2('0x44')](_0xada3cd['where'],{'$or':_[_0x5ff2('0x36')](_0x5d8b56,function(_0x304b98){if(_0x304b98['type']!==_0x5ff2('0x45')){var _0x5ac9f9={};_0x5ac9f9[_0x304b98['name']]={'$like':'%'+_0x4a51bb[_0x5ff2('0x3a')][_0x5ff2('0x43')]+'%'};return _0x5ac9f9;}})});}_0xada3cd=_[_0x5ff2('0x44')]({},_0xada3cd,_0x4a51bb[_0x5ff2('0x46')]);var _0x5524ef={'where':_0xada3cd[_0x5ff2('0x47')]};return db[_0x5ff2('0x37')][_0x5ff2('0x2c')](_0x5524ef)[_0x5ff2('0x1f')](function(_0x514dfd){_0x4ce705[_0x5ff2('0x2c')]=_0x514dfd;if(_0x4a51bb[_0x5ff2('0x3a')][_0x5ff2('0x48')]){_0xada3cd[_0x5ff2('0x49')]=[{'all':!![]}];}return db[_0x5ff2('0x37')][_0x5ff2('0x4a')](_0xada3cd);})['then'](function(_0x1b075a){_0x4ce705[_0x5ff2('0x4b')]=_0x1b075a;return _0x4ce705;})['then'](respondWithFilteredResult(_0xbdda17,_0xada3cd))[_0x5ff2('0x4c')](handleError(_0xbdda17,null));};exports[_0x5ff2('0x4d')]=function(_0x22a948,_0x1f931f){var _0x558fa8={'raw':!![],'where':{'id':_0x22a948['params']['id']}},_0x136968={};_0x136968[_0x5ff2('0x39')]=_[_0x5ff2('0x4e')](db[_0x5ff2('0x37')][_0x5ff2('0x4f')]);_0x136968[_0x5ff2('0x3a')]=_['keys'](_0x22a948[_0x5ff2('0x3a')]);_0x136968[_0x5ff2('0x3b')]=_[_0x5ff2('0x3c')](_0x136968['model'],_0x136968[_0x5ff2('0x3a')]);_0x558fa8[_0x5ff2('0x3d')]=_[_0x5ff2('0x3c')](_0x136968[_0x5ff2('0x39')],qs[_0x5ff2('0x50')](_0x22a948[_0x5ff2('0x3a')][_0x5ff2('0x50')]));_0x558fa8['attributes']=_0x558fa8[_0x5ff2('0x3d')][_0x5ff2('0x3e')]?_0x558fa8[_0x5ff2('0x3d')]:_0x136968[_0x5ff2('0x39')];if(_0x22a948[_0x5ff2('0x3a')]['includeAll']){_0x558fa8[_0x5ff2('0x49')]=[{'all':!![]}];}_0x558fa8=_[_0x5ff2('0x44')]({},_0x558fa8,_0x22a948[_0x5ff2('0x46')]);return db['WhatsappMessage'][_0x5ff2('0x51')](_0x558fa8)[_0x5ff2('0x1f')](handleEntityNotFound(_0x1f931f,null))[_0x5ff2('0x1f')](respondWithResult(_0x1f931f,null))['catch'](handleError(_0x1f931f,null));};exports['create']=function(_0x48f58b,_0x54be57){return db['WhatsappMessage'][_0x5ff2('0x52')](_0x48f58b[_0x5ff2('0x53')],{})[_0x5ff2('0x1f')](respondWithResult(_0x54be57,0xc9))[_0x5ff2('0x4c')](handleError(_0x54be57,null));};exports['update']=function(_0x24cd0d,_0x32f13d){if(_0x24cd0d[_0x5ff2('0x53')]['id']){delete _0x24cd0d[_0x5ff2('0x53')]['id'];}return db[_0x5ff2('0x37')][_0x5ff2('0x51')]({'where':{'id':_0x24cd0d[_0x5ff2('0x54')]['id']}})['then'](handleEntityNotFound(_0x32f13d,null))[_0x5ff2('0x1f')](saveUpdates(_0x24cd0d[_0x5ff2('0x53')],null))[_0x5ff2('0x1f')](respondWithResult(_0x32f13d,null))['catch'](handleError(_0x32f13d,null));};exports[_0x5ff2('0x33')]=function(_0x42993e,_0x2290ee){return db[_0x5ff2('0x37')][_0x5ff2('0x51')]({'where':{'id':_0x42993e[_0x5ff2('0x54')]['id']}})[_0x5ff2('0x1f')](handleEntityNotFound(_0x2290ee,null))[_0x5ff2('0x1f')](removeEntity(_0x2290ee,null))[_0x5ff2('0x4c')](handleError(_0x2290ee,null));};exports['describe']=function(_0x6dedab,_0x5ca7f8){return db[_0x5ff2('0x37')][_0x5ff2('0x55')]()['then'](respondWithResult(_0x5ca7f8,null))[_0x5ff2('0x4c')](handleError(_0x5ca7f8,null));};var interaction_log=require(_0x5ff2('0xf'))(_0x5ff2('0x56'));exports['accept']=function(_0x411e7f,_0x1765fe,_0x19e2a3){var _0x32f069={'agent':{},'channel':_0x5ff2('0x57')};if(_0x411e7f[_0x5ff2('0x53')]['id']){delete _0x411e7f['body']['id'];}_0x411e7f[_0x5ff2('0x53')][_0x5ff2('0x58')]=!![];_0x411e7f['body'][_0x5ff2('0x59')]=moment()[_0x5ff2('0x5a')](_0x5ff2('0x5b'));_0x411e7f[_0x5ff2('0x53')]['UserId']=_0x411e7f[_0x5ff2('0x53')][_0x5ff2('0x5c')]||_0x411e7f[_0x5ff2('0x5d')]['id'];_0x32f069[_0x5ff2('0x5e')]['id']=_0x411e7f[_0x5ff2('0x53')][_0x5ff2('0x5c')];return db[_0x5ff2('0x37')][_0x5ff2('0x51')]({'where':{'id':_0x411e7f[_0x5ff2('0x54')]['id'],'UserId':null}})[_0x5ff2('0x1f')](handleEntityNotFound(_0x1765fe,null))[_0x5ff2('0x1f')](saveUpdates(_0x411e7f[_0x5ff2('0x53')],null))[_0x5ff2('0x1f')](function(_0x407b14){if(_0x407b14){_0x32f069[_0x5ff2('0x25')]=_0x407b14['get']({'plain':!![]});return db[_0x5ff2('0x5f')][_0x5ff2('0x51')]({'where':{'id':_0x407b14['WhatsappInteractionId']}});}return null;})[_0x5ff2('0x1f')](handleEntityNotFound(_0x1765fe,null))[_0x5ff2('0x1f')](function(_0x84299d){if(_0x84299d){return _0x84299d[_0x5ff2('0x60')]({'UserId':_0x411e7f[_0x5ff2('0x53')][_0x5ff2('0x5c')],'read1stAt':_[_0x5ff2('0x61')](_0x84299d[_0x5ff2('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5ff2('0x1f')](function(_0x5d985b){if(_0x5d985b){_0x32f069[_0x5ff2('0x63')]=_0x5d985b[_0x5ff2('0x64')]({'plain':!![]});interaction_log[_0x5ff2('0x26')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x411e7f[_0x5ff2('0x5d')]['id'],_0x411e7f[_0x5ff2('0x5d')][_0x5ff2('0x65')],_0x411e7f[_0x5ff2('0x5d')]['role'],_0x32f069[_0x5ff2('0x63')]['id'],_0x411e7f[_0x5ff2('0x53')]?JSON[_0x5ff2('0x66')](_0x411e7f['body']):_0x5ff2('0x67'));return respondWithRpcPromise(_0x5ff2('0x68'),_0x5ff2('0x69'),_0x32f069);}return null;})[_0x5ff2('0x1f')](function(_0x156f16){var _0x3b60f7=_0x5ff2('0x6a')+_0x156f16[_0x5ff2('0x25')][_0x5ff2('0x6b')];return db[_0x5ff2('0x6c')][_0x5ff2('0x3a')](_0x3b60f7,{'type':db[_0x5ff2('0x6d')][_0x5ff2('0x6e')][_0x5ff2('0x6f')],'raw':!![]})['then'](function(_0x4208cf){return _0x4208cf;});})['then'](function(_0xd739){if(_0xd739){_0x32f069['message'][_0x5ff2('0x70')]=_0xd739[0x0];if(!_0x411e7f[_0x5ff2('0x53')][_0x5ff2('0x5c')])return;return db['User'][_0x5ff2('0x51')]({'where':{'id':_0x411e7f['body'][_0x5ff2('0x5c')],'role':'agent'},'attributes':['id','name',_0x5ff2('0x71'),_0x5ff2('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x51f4e6){if(!_0x51f4e6)return null;_0x32f069[_0x5ff2('0x25')]['agent']=_0x51f4e6;return _0x32f069;})[_0x5ff2('0x1f')](function(_0x5424d6){if(_0x5424d6){if(_0x411e7f['body']['manual']){_0x32f069[_0x5ff2('0x25')][_0x5ff2('0x73')]=util[_0x5ff2('0x5a')]('SIP/%s',_0x411e7f[_0x5ff2('0x5d')][_0x5ff2('0x65')]);_0x32f069[_0x5ff2('0x25')]['channel']=_0x32f069[_0x5ff2('0x74')];_0x32f069[_0x5ff2('0x25')][_0x5ff2('0x75')]=_0x32f069['channel'];_0x32f069[_0x5ff2('0x25')][_0x5ff2('0x76')]=_0x5ff2('0x77');return respondWithRpcPromise('EventManager',_0x5ff2('0x78'),{'event':_0x5ff2('0x79'),'message':_0x32f069[_0x5ff2('0x25')]},client9002)['then'](function(){return _0x32f069;});}return _0x32f069;}return null;})['then'](respondWithResult(_0x1765fe,null))[_0x5ff2('0x4c')](handleError(_0x1765fe,null));};var interaction_log=require(_0x5ff2('0xf'))(_0x5ff2('0x56'));exports[_0x5ff2('0x31')]=function(_0x4c76ef,_0x588f3b,_0x48dde3){var _0x25354b={'agent':{},'channel':_0x5ff2('0x57')};if(_0x4c76ef[_0x5ff2('0x53')]['id']){delete _0x4c76ef[_0x5ff2('0x53')]['id'];}_0x4c76ef['body'][_0x5ff2('0x5c')]=_0x4c76ef[_0x5ff2('0x53')][_0x5ff2('0x5c')]||_0x4c76ef[_0x5ff2('0x5d')]['id'];_0x25354b[_0x5ff2('0x5e')]['id']=_0x4c76ef[_0x5ff2('0x53')][_0x5ff2('0x5c')];return db['WhatsappMessage'][_0x5ff2('0x51')]({'where':{'id':_0x4c76ef['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x588f3b,null))[_0x5ff2('0x1f')](function(_0x4abbfd){if(_0x4abbfd){_0x25354b['message']=_0x4abbfd['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4abbfd[_0x5ff2('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x588f3b,null))[_0x5ff2('0x1f')](function(_0x519ef8){if(_0x519ef8){_0x25354b[_0x5ff2('0x63')]=_0x519ef8[_0x5ff2('0x64')]({'plain':!![]});interaction_log['info'](_0x5ff2('0x7b'),_0x4c76ef[_0x5ff2('0x5d')]['id'],_0x4c76ef[_0x5ff2('0x5d')][_0x5ff2('0x65')],_0x4c76ef[_0x5ff2('0x5d')][_0x5ff2('0x7c')],_0x25354b[_0x5ff2('0x63')]['id'],_0x4c76ef[_0x5ff2('0x53')]?JSON[_0x5ff2('0x66')](_0x4c76ef[_0x5ff2('0x53')]):_0x5ff2('0x67'));return respondWithRpcPromise(_0x5ff2('0x7d'),_0x5ff2('0x7e'),_0x25354b);}return null;})[_0x5ff2('0x1f')](function(_0x5a4421){var _0x1b5e0c=_0x5ff2('0x6a')+_0x5a4421[_0x5ff2('0x25')]['ContactId'];return db['sequelize'][_0x5ff2('0x3a')](_0x1b5e0c,{'type':db[_0x5ff2('0x6d')][_0x5ff2('0x6e')][_0x5ff2('0x6f')],'raw':!![]})[_0x5ff2('0x1f')](function(_0x47a8c1){return _0x47a8c1;});})[_0x5ff2('0x1f')](function(_0x23a499){if(_0x23a499){_0x25354b[_0x5ff2('0x25')]['contact']=_0x23a499[0x0];if(!_0x4c76ef['body'][_0x5ff2('0x5c')])return;return db[_0x5ff2('0x7f')][_0x5ff2('0x51')]({'where':{'id':_0x4c76ef[_0x5ff2('0x53')][_0x5ff2('0x5c')],'role':_0x5ff2('0x5e')},'attributes':['id',_0x5ff2('0x65'),'fullname',_0x5ff2('0x72'),_0x5ff2('0x80')],'raw':!![]});}return null;})[_0x5ff2('0x1f')](function(_0x49d966){if(!_0x49d966)return null;_0x25354b['message'][_0x5ff2('0x5e')]=_0x49d966;return _0x25354b;})['then'](function(_0x139b6b){if(_0x139b6b){_0x139b6b[_0x5ff2('0x25')]['interface']=util[_0x5ff2('0x5a')](_0x5ff2('0x81'),_0x4c76ef[_0x5ff2('0x5d')][_0x5ff2('0x65')]);_0x139b6b[_0x5ff2('0x25')]['channel']=_0x25354b[_0x5ff2('0x74')];_0x139b6b[_0x5ff2('0x25')][_0x5ff2('0x75')]=_0x25354b[_0x5ff2('0x74')];_0x139b6b[_0x5ff2('0x25')]['event']=_0x5ff2('0x31');respondWithRpcPromise('EventManager','EventManager',{'event':_0x5ff2('0x82'),'message':_0x139b6b['message']},client9002);return _0x25354b;}return null;})[_0x5ff2('0x1f')](respondWithResult(_0x588f3b,null))[_0x5ff2('0x4c')](handleError(_0x588f3b,null));};exports[_0x5ff2('0x28')]=function(_0x186e19,_0x569bc0,_0x548462){if(_0x186e19['body']['id']){delete _0x186e19[_0x5ff2('0x53')]['id'];}var _0x1150a2;return db[_0x5ff2('0x37')][_0x5ff2('0x51')]({'where':{'id':_0x186e19[_0x5ff2('0x54')]['id']}})[_0x5ff2('0x1f')](handleEntityNotFound(_0x569bc0,null))['then'](function(_0x5d1618){if(_0x5d1618){_0x1150a2=_0x5d1618;return db['WhatsappAccount'][_0x5ff2('0x51')]({'where':{'id':_0x5d1618[_0x5ff2('0x83')]}});}})['then'](handleEntityNotFound(_0x569bc0,null))[_0x5ff2('0x1f')](function(_0x292b72){if(_0x292b72){logger[_0x5ff2('0x22')](_0x5ff2('0x84'),'status',_0x5ff2('0x85'),_0x292b72['type'],util[_0x5ff2('0x86')](_0x186e19[_0x5ff2('0x53')],{'showHidden':![],'depth':null}));switch(_0x292b72[_0x5ff2('0x87')]){case'twilio':if(_0x186e19['body']['MessageSid']&&_0x186e19['body'][_0x5ff2('0x88')]===_0x1150a2[_0x5ff2('0x89')]&&_0x186e19[_0x5ff2('0x53')][_0x5ff2('0x8a')]&&_0x186e19[_0x5ff2('0x53')][_0x5ff2('0x8a')]===_0x5ff2('0x58')){return _0x1150a2['update']({'read':!![]});}else{logger[_0x5ff2('0x24')](_0x5ff2('0x8b'),_0x5ff2('0x28'),_0x5ff2('0x8c'),util['inspect'](_0x186e19[_0x5ff2('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x1150a2;}})[_0x5ff2('0x1f')](respondWithResult(_0x569bc0,null))['catch'](handleError(_0x569bc0,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c5166c6..556f482 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 _0xa699=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x2b9c0c,_0x4678a3){var _0xd8577b=function(_0x2dd9eb){while(--_0x2dd9eb){_0x2b9c0c['push'](_0x2b9c0c['shift']());}};_0xd8577b(++_0x4678a3);}(_0xa699,0x6b));var _0x9a69=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0xa699[_0x4a45b4];return _0x1a99c9;};'use strict';var EventEmitter=require(_0x9a69('0x0'));var WhatsappMessage=require(_0x9a69('0x1'))['db'][_0x9a69('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9a69('0x3')](0x0);var events={'afterCreate':_0x9a69('0x4'),'afterUpdate':_0x9a69('0x5'),'afterDestroy':_0x9a69('0x6')};function emitEvent(_0x2d3e1f){return function(_0xadacc9,_0x3edccc,_0x143c4f){WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f+':'+_0xadacc9['id'],_0xadacc9);WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f,_0xadacc9);_0x143c4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x9a69('0x8')](e,emitEvent(event));}}module[_0x9a69('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x574d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x38d082,_0x17c03c){var _0xfc4cb9=function(_0x593301){while(--_0x593301){_0x38d082['push'](_0x38d082['shift']());}};_0xfc4cb9(++_0x17c03c);}(_0x574d,0xc0));var _0xd574=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x574d[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xd574('0x0'));var WhatsappMessage=require(_0xd574('0x1'))['db'][_0xd574('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd574('0x3')](0x0);var events={'afterCreate':_0xd574('0x4'),'afterUpdate':_0xd574('0x5'),'afterDestroy':_0xd574('0x6')};function emitEvent(_0x593d3c){return function(_0x2a54ff,_0x1be154,_0x469ad7){WhatsappMessageEvents[_0xd574('0x7')](_0x593d3c+':'+_0x2a54ff['id'],_0x2a54ff);WhatsappMessageEvents['emit'](_0x593d3c,_0x2a54ff);_0x469ad7(null);};}for(var e in events){if(events[_0xd574('0x8')](e)){var event=events[e];WhatsappMessage[_0xd574('0x9')](e,emitEvent(event));}}module[_0xd574('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1d2a10e..8016c3c 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 _0x2433=['api','moment','bluebird','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','update','err','finally','utf8mb4','lodash','util','../../config/logger'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0x2433,0xe5));var _0x3243=function(_0x50ee1a,_0xcb8ddd){_0x50ee1a=_0x50ee1a-0x0;var _0x1500ee=_0x2433[_0x50ee1a];return _0x1500ee;};'use strict';var _=require(_0x3243('0x0'));var util=require(_0x3243('0x1'));var logger=require(_0x3243('0x2'))(_0x3243('0x3'));var moment=require(_0x3243('0x4'));var BPromise=require(_0x3243('0x5'));var rp=require('request-promise');var fetch=require(_0x3243('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3243('0x7'));var config=require(_0x3243('0x8'));var attributes=require(_0x3243('0x9'));module['exports']=function(_0x126626,_0x1e9978){return _0x126626[_0x3243('0xa')]('WhatsappMessage',attributes,{'tableName':_0x3243('0xb'),'paranoid':![],'indexes':[{'name':_0x3243('0xc'),'fields':['messageId']},{'name':_0x3243('0xd'),'fields':[_0x3243('0xe')],'type':_0x3243('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5700,_0x53d2f6,_0x3a0880){var _0xaecb31=_0x126626[_0x3243('0x10')];var _0x453db2=_0x1c5700['get']({'plain':!![]});if(_0x453db2[_0x3243('0x11')][_0x3243('0x12')]()==='in'||_0x453db2[_0x3243('0x11')]['toLowerCase']()===_0x3243('0x13')&&!_0x453db2[_0x3243('0x14')]&&!_[_0x3243('0x15')](_0x453db2['UserId'])){_0xaecb31[_0x3243('0x16')][_0x3243('0x17')]({'where':{'id':_0x453db2[_0x3243('0x18')]}})[_0x3243('0x19')](function(_0x455055){if(_0x455055){_0x455055['update']({'lastMsgAt':_0x453db2[_0x3243('0x1a')],'lastMsgDirection':_0x453db2[_0x3243('0x11')][_0x3243('0x12')]()});}})['catch'](function(_0x1d4827){console[_0x3243('0x1b')](_0x1d4827);});}if(_0x453db2[_0x3243('0x11')]===_0x3243('0x13')&&!_0x453db2[_0x3243('0x14')]){var _0x28c067;_0xaecb31[_0x3243('0x1c')]['find']({'where':{'id':_0x453db2[_0x3243('0x1d')]},'raw':!![]})[_0x3243('0x19')](function(_0x2cd8ab){_0x28c067=_0x2cd8ab;if(_0x28c067&&_0x28c067[_0x3243('0x1e')]){switch(_0x28c067['type']){case _0x3243('0x1f'):var _0x58b6c4=require('twilio');if(_0x28c067[_0x3243('0x20')]&&_0x28c067[_0x3243('0x21')]&&_0x28c067[_0x3243('0x22')]){var _0xb11629=new _0x58b6c4(_0x28c067[_0x3243('0x20')],_0x28c067[_0x3243('0x21')]);_0xb11629[_0x3243('0x23')][_0x3243('0x24')]({'body':_0x453db2[_0x3243('0xe')],'to':_0x3243('0x25')+_0x453db2[_0x3243('0x22')],'from':_0x3243('0x25')+_0x28c067['phone'],'statusCallback':_0x28c067[_0x3243('0x26')]+_0x3243('0x27')+_0x453db2['id']+'/status?token='+_0x28c067[_0x3243('0x28')]})[_0x3243('0x19')](function(_0xb1dd8d){if(_0xb1dd8d[_0x3243('0x29')]){return _0x1c5700['update']({'messageId':_0xb1dd8d[_0x3243('0x29')]});}})[_0x3243('0x2a')](function(_0x110a4d){logger[_0x3243('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3243('0x2b'),'twilio',util[_0x3243('0x2c')](_0x110a4d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3243('0x2d'),_0x3243('0x2b'),_0x3243('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3243('0x2e'):var _0x179add=_0x28c067[_0x3243('0x20')];var _0x4c18a7=_0x28c067['authToken'];var _0x3ed9c7=_0x28c067[_0x3243('0x2f')]+_0x3243('0x30')+_0x179add+'/messages/';var _0x582ccc={'to':[_0x453db2[_0x3243('0x22')]],'message':{'type':_0x3243('0x31'),'text':_0x453db2[_0x3243('0xe')]}};var _0x17399a={'method':_0x3243('0x32'),'uri':_0x3ed9c7,'headers':{'Authorization':_0x3243('0x33')+_0x4c18a7,'Content-Type':_0x3243('0x34')},'body':_0x582ccc,'json':!![]};rp(_0x17399a)[_0x3243('0x19')](function(_0x1599f7){if(_0x1599f7['statuses'][0x0][_0x3243('0x35')]){return _0x1c5700[_0x3243('0x36')]({'messageId':_0x1599f7['statuses'][0x0][_0x3243('0x35')]});}})[_0x3243('0x2a')](function(_0xbe516a){logger[_0x3243('0x37')]('WhatsappMessage,\x20%s',_0xbe516a);});break;}}})[_0x3243('0x38')](function(){_0x3a0880();});}else{_0x3a0880();}}},'charset':_0x3243('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x453e=['/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','findOne','then','update','createdAt','catch','error','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','create','whatsapp:','/api/whatsapp/messages/','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl'];(function(_0x1b06ae,_0x3db6f1){var _0x5f4972=function(_0x3b5bbc){while(--_0x3b5bbc){_0x1b06ae['push'](_0x1b06ae['shift']());}};_0x5f4972(++_0x3db6f1);}(_0x453e,0xdd));var _0xe453=function(_0x299027,_0x5d2e4f){_0x299027=_0x299027-0x0;var _0x1bc622=_0x453e[_0x299027];return _0x1bc622;};'use strict';var _=require(_0xe453('0x0'));var util=require('util');var logger=require(_0xe453('0x1'))(_0xe453('0x2'));var moment=require(_0xe453('0x3'));var BPromise=require('bluebird');var rp=require(_0xe453('0x4'));var fetch=require(_0xe453('0x5'));var fs=require('fs');var path=require(_0xe453('0x6'));var rimraf=require(_0xe453('0x7'));var config=require(_0xe453('0x8'));var attributes=require(_0xe453('0x9'));module['exports']=function(_0x23f399,_0x4981de){return _0x23f399[_0xe453('0xa')](_0xe453('0xb'),attributes,{'tableName':_0xe453('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xe453('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0xe453('0xe')],'type':_0xe453('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x348df6,_0x33b34e,_0x34d12b){var _0x37cadc=_0x23f399[_0xe453('0x10')];var _0x2eeb4f=_0x348df6['get']({'plain':!![]});if(_0x2eeb4f[_0xe453('0x11')][_0xe453('0x12')]()==='in'||_0x2eeb4f[_0xe453('0x11')][_0xe453('0x12')]()===_0xe453('0x13')&&!_0x2eeb4f[_0xe453('0x14')]&&!_[_0xe453('0x15')](_0x2eeb4f['UserId'])){_0x37cadc['WhatsappInteraction'][_0xe453('0x16')]({'where':{'id':_0x2eeb4f['WhatsappInteractionId']}})[_0xe453('0x17')](function(_0x27a545){if(_0x27a545){_0x27a545[_0xe453('0x18')]({'lastMsgAt':_0x2eeb4f[_0xe453('0x19')],'lastMsgDirection':_0x2eeb4f['direction'][_0xe453('0x12')]()});}})[_0xe453('0x1a')](function(_0x319920){console[_0xe453('0x1b')](_0x319920);});}if(_0x2eeb4f['direction']===_0xe453('0x13')&&!_0x2eeb4f[_0xe453('0x14')]){var _0x56cfb0;_0x37cadc['WhatsappAccount'][_0xe453('0x1c')]({'where':{'id':_0x2eeb4f[_0xe453('0x1d')]},'raw':!![]})['then'](function(_0x35fb53){_0x56cfb0=_0x35fb53;if(_0x56cfb0&&_0x56cfb0[_0xe453('0x1e')]){switch(_0x56cfb0['type']){case _0xe453('0x1f'):var _0x797062=require(_0xe453('0x1f'));if(_0x56cfb0[_0xe453('0x20')]&&_0x56cfb0['authToken']&&_0x56cfb0[_0xe453('0x21')]){var _0x580df9=new _0x797062(_0x56cfb0['accountSid'],_0x56cfb0[_0xe453('0x22')]);_0x580df9['messages'][_0xe453('0x23')]({'body':_0x2eeb4f[_0xe453('0xe')],'to':_0xe453('0x24')+_0x2eeb4f['phone'],'from':_0xe453('0x24')+_0x56cfb0[_0xe453('0x21')],'statusCallback':_0x56cfb0['remote']+_0xe453('0x25')+_0x2eeb4f['id']+'/status?token='+_0x56cfb0['token']})['then'](function(_0x1ae21c){if(_0x1ae21c['sid']){return _0x348df6[_0xe453('0x18')]({'messageId':_0x1ae21c[_0xe453('0x26')]});}})[_0xe453('0x1a')](function(_0x224c31){logger[_0xe453('0x1b')](_0xe453('0x27'),_0xe453('0x28'),'twilio',util[_0xe453('0x29')](_0x224c31,{'showHidden':![],'depth':null}));});}else{logger[_0xe453('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xe453('0x28'),_0xe453('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe453('0x2a'):var _0x26f419=_0x56cfb0[_0xe453('0x20')];var _0x49f855=_0x56cfb0[_0xe453('0x22')];var _0x383acf=_0x56cfb0[_0xe453('0x2b')]+_0xe453('0x2c')+_0x26f419+_0xe453('0x2d');var _0x4a418e={'to':[_0x2eeb4f[_0xe453('0x21')]],'message':{'type':'text','text':_0x2eeb4f[_0xe453('0xe')]}};var _0xc1235a={'method':_0xe453('0x2e'),'uri':_0x383acf,'headers':{'Authorization':_0xe453('0x2f')+_0x49f855,'Content-Type':_0xe453('0x30')},'body':_0x4a418e,'json':!![]};rp(_0xc1235a)[_0xe453('0x17')](function(_0x1cd5f5){if(_0x1cd5f5[_0xe453('0x31')][0x0][_0xe453('0x32')]){return _0x348df6['update']({'messageId':_0x1cd5f5['statuses'][0x0][_0xe453('0x32')]});}})[_0xe453('0x1a')](function(_0x427d1f){logger['err']('WhatsappMessage,\x20%s',_0x427d1f);});break;}}})['finally'](function(){_0x34d12b();});}else{_0x34d12b();}}},'charset':_0xe453('0x33'),'collate':_0xe453('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cadb0e0..5647743 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 _0xce30=['options','CreateWhatsappMessage','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create'];(function(_0x21c5d9,_0x509aca){var _0x3b2160=function(_0x4fc704){while(--_0x4fc704){_0x21c5d9['push'](_0x21c5d9['shift']());}};_0x3b2160(++_0x509aca);}(_0xce30,0x124));var _0x0ce3=function(_0x54aef6,_0x4155fc){_0x54aef6=_0x54aef6-0x0;var _0x1a2d10=_0xce30[_0x54aef6];return _0x1a2d10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ce3('0x0'));var BPromise=require('bluebird');var rs=require(_0x0ce3('0x1'));var fs=require('fs');var Redis=require(_0x0ce3('0x2'));var db=require(_0x0ce3('0x3'))['db'];var utils=require(_0x0ce3('0x4'));var logger=require(_0x0ce3('0x5'))('rpc');var config=require(_0x0ce3('0x6'));var jayson=require(_0x0ce3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0ce3('0x8')]=_[_0x0ce3('0x9')](config[_0x0ce3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ce3('0xa'))(new Redis(config[_0x0ce3('0x8')]));require(_0x0ce3('0xb'))['register'](socket);function respondWithRpcPromise(_0x53466d,_0x212dfd,_0x3cc11c){return new BPromise(function(_0x1b92e7,_0x40b36a){return client[_0x0ce3('0xc')](_0x53466d,_0x3cc11c)[_0x0ce3('0xd')](function(_0x53f250){logger[_0x0ce3('0xe')](_0x0ce3('0xf'),_0x212dfd,_0x0ce3('0x10'));logger[_0x0ce3('0x11')](_0x0ce3('0x12'),_0x212dfd,_0x0ce3('0x10'),JSON[_0x0ce3('0x13')](_0x53f250));if(_0x53f250[_0x0ce3('0x14')]){if(_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x15')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x212dfd,_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x16')]);return _0x40b36a(_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x16')]);}logger[_0x0ce3('0x14')](_0x0ce3('0xf'),_0x212dfd,_0x53f250[_0x0ce3('0x14')][_0x0ce3('0x16')]);return _0x1b92e7(_0x53f250['error']['message']);}else{logger['info'](_0x0ce3('0xf'),_0x212dfd,_0x0ce3('0x10'));_0x1b92e7(_0x53f250[_0x0ce3('0x17')][_0x0ce3('0x16')]);}})[_0x0ce3('0x18')](function(_0x2c1fbc){logger['error'](_0x0ce3('0xf'),_0x212dfd,_0x2c1fbc);_0x40b36a(_0x2c1fbc);});});}exports['CreateWhatsappMessage']=function(_0x39c847){var _0x7f2bed=this;return new Promise(function(_0x155a60,_0x72d396){return db[_0x0ce3('0x19')][_0x0ce3('0x1a')](_0x39c847['body'],{'raw':_0x39c847[_0x0ce3('0x1b')]?_0x39c847[_0x0ce3('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0ce3('0xd')](function(_0x131c23){logger[_0x0ce3('0xe')]('CreateWhatsappMessage',_0x39c847);logger[_0x0ce3('0x11')](_0x0ce3('0x1c'),_0x39c847,JSON['stringify'](_0x131c23));_0x155a60(_0x131c23);})[_0x0ce3('0x18')](function(_0x5bb632){logger[_0x0ce3('0x14')](_0x0ce3('0x1c'),_0x5bb632[_0x0ce3('0x16')],_0x39c847);_0x72d396(_0x7f2bed[_0x0ce3('0x14')](0x1f4,_0x5bb632[_0x0ce3('0x16')]));});});}; \ No newline at end of file +var _0xfec3=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateWhatsappMessage','create','body','options','raw','debug'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xfec3,0x1e0));var _0x3fec=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfec3[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3fec('0x0'));var util=require(_0x3fec('0x1'));var moment=require(_0x3fec('0x2'));var BPromise=require(_0x3fec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fec('0x4'));var db=require(_0x3fec('0x5'))['db'];var utils=require(_0x3fec('0x6'));var logger=require('../../config/logger')(_0x3fec('0x7'));var config=require(_0x3fec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fec('0x9')]['http']({'port':0x232a});config['redis']=_[_0x3fec('0xa')](config[_0x3fec('0xb')],{'host':_0x3fec('0xc'),'port':0x18eb});var socket=require(_0x3fec('0xd'))(new Redis(config[_0x3fec('0xb')]));require('./whatsappMessage.socket')[_0x3fec('0xe')](socket);function respondWithRpcPromise(_0x17b597,_0x3c16d4,_0x5ca321){return new BPromise(function(_0x4bb8a7,_0x4ec717){return client[_0x3fec('0xf')](_0x17b597,_0x5ca321)[_0x3fec('0x10')](function(_0x1b6271){logger['info'](_0x3fec('0x11'),_0x3c16d4,_0x3fec('0x12'));logger['debug'](_0x3fec('0x13'),_0x3c16d4,_0x3fec('0x12'),JSON[_0x3fec('0x14')](_0x1b6271));if(_0x1b6271[_0x3fec('0x15')]){if(_0x1b6271['error'][_0x3fec('0x16')]===0x1f4){logger[_0x3fec('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x3c16d4,_0x1b6271[_0x3fec('0x15')][_0x3fec('0x17')]);return _0x4ec717(_0x1b6271[_0x3fec('0x15')][_0x3fec('0x17')]);}logger[_0x3fec('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x3c16d4,_0x1b6271['error'][_0x3fec('0x17')]);return _0x4bb8a7(_0x1b6271[_0x3fec('0x15')][_0x3fec('0x17')]);}else{logger[_0x3fec('0x18')](_0x3fec('0x11'),_0x3c16d4,_0x3fec('0x12'));_0x4bb8a7(_0x1b6271['result']['message']);}})[_0x3fec('0x19')](function(_0x26c17d){logger['error'](_0x3fec('0x11'),_0x3c16d4,_0x26c17d);_0x4ec717(_0x26c17d);});});}exports[_0x3fec('0x1a')]=function(_0x585c41){var _0x221280=this;return new Promise(function(_0x1a83aa,_0x313e8b){return db['WhatsappMessage'][_0x3fec('0x1b')](_0x585c41[_0x3fec('0x1c')],{'raw':_0x585c41['options']?_0x585c41[_0x3fec('0x1d')][_0x3fec('0x1e')]===undefined?!![]:![]:!![]})[_0x3fec('0x10')](function(_0xc5c2f4){logger[_0x3fec('0x18')](_0x3fec('0x1a'),_0x585c41);logger[_0x3fec('0x1f')](_0x3fec('0x1a'),_0x585c41,JSON[_0x3fec('0x14')](_0xc5c2f4));_0x1a83aa(_0xc5c2f4);})[_0x3fec('0x19')](function(_0x5afc9b){logger['error'](_0x3fec('0x1a'),_0x5afc9b['message'],_0x585c41);_0x313e8b(_0x221280[_0x3fec('0x15')](0x1f4,_0x5afc9b[_0x3fec('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 92dcd27..492cd98 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 _0xc451=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x3d2479,_0x250991){var _0x5e0b21=function(_0x232d91){while(--_0x232d91){_0x3d2479['push'](_0x3d2479['shift']());}};_0x5e0b21(++_0x250991);}(_0xc451,0xe8));var _0x1c45=function(_0x564b5f,_0x509958){_0x564b5f=_0x564b5f-0x0;var _0x282788=_0xc451[_0x564b5f];return _0x282788;};'use strict';var WhatsappMessageEvents=require(_0x1c45('0x0'));var events=[_0x1c45('0x1'),_0x1c45('0x2'),_0x1c45('0x3')];function createListener(_0x56d253,_0x80ae55){return function(_0x3baaf8){_0x80ae55[_0x1c45('0x4')](_0x56d253,_0x3baaf8);};}function removeListener(_0xc8e7d7,_0xe557c2){return function(){WhatsappMessageEvents[_0x1c45('0x5')](_0xc8e7d7,_0xe557c2);};}exports[_0x1c45('0x6')]=function(_0x118cf7){for(var _0x3221dd=0x0,_0x52b642=events[_0x1c45('0x7')];_0x3221dd<_0x52b642;_0x3221dd++){var _0x4937b4=events[_0x3221dd];var _0x91e2b4=createListener(_0x1c45('0x8')+_0x4937b4,_0x118cf7);WhatsappMessageEvents['on'](_0x4937b4,_0x91e2b4);}}; \ No newline at end of file +var _0xc9d5=['removeListener','register','length','whatsappMessage:','save','remove','emit'];(function(_0x4dd733,_0x627c8b){var _0x4ff708=function(_0x378fc7){while(--_0x378fc7){_0x4dd733['push'](_0x4dd733['shift']());}};_0x4ff708(++_0x627c8b);}(_0xc9d5,0xc8));var _0x5c9d=function(_0x2432f2,_0x45fe3a){_0x2432f2=_0x2432f2-0x0;var _0x5750fe=_0xc9d5[_0x2432f2];return _0x5750fe;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x5c9d('0x0'),_0x5c9d('0x1'),'update'];function createListener(_0x1baebc,_0x42e9f1){return function(_0x5166de){_0x42e9f1[_0x5c9d('0x2')](_0x1baebc,_0x5166de);};}function removeListener(_0xc39152,_0x3ef0f3){return function(){WhatsappMessageEvents[_0x5c9d('0x3')](_0xc39152,_0x3ef0f3);};}exports[_0x5c9d('0x4')]=function(_0x58b908){for(var _0x58b024=0x0,_0x384d03=events[_0x5c9d('0x5')];_0x58b024<_0x384d03;_0x58b024++){var _0x5e7e81=events[_0x58b024];var _0x506cde=createListener(_0x5c9d('0x6')+_0x5e7e81,_0x58b908);WhatsappMessageEvents['on'](_0x5e7e81,_0x506cde);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d2f1ab7..70e89c7 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 _0x1cb8=['/:id/members','/:id/teams','getTeams','getAgents','create','post','/:id/users','put','/:id','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1cb8,0xe5));var _0x81cb=function(_0x180c0f,_0x5d6a54){_0x180c0f=_0x180c0f-0x0;var _0x42ed22=_0x1cb8[_0x180c0f];return _0x42ed22;};'use strict';var multer=require(_0x81cb('0x0'));var util=require('util');var path=require(_0x81cb('0x1'));var timeout=require(_0x81cb('0x2'));var express=require(_0x81cb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x81cb('0x4'));var config=require(_0x81cb('0x5'));var controller=require(_0x81cb('0x6'));router[_0x81cb('0x7')]('/',auth[_0x81cb('0x8')](),controller['index']);router[_0x81cb('0x7')](_0x81cb('0x9'),auth[_0x81cb('0x8')](),controller[_0x81cb('0xa')]);router[_0x81cb('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x81cb('0x7')](_0x81cb('0xb'),auth[_0x81cb('0x8')](),controller['getMembers']);router['get'](_0x81cb('0xc'),auth[_0x81cb('0x8')](),controller[_0x81cb('0xd')]);router[_0x81cb('0x7')]('/:id/users',auth[_0x81cb('0x8')](),controller[_0x81cb('0xe')]);router['post']('/',auth[_0x81cb('0x8')](),controller[_0x81cb('0xf')]);router[_0x81cb('0x10')]('/:id/teams',auth[_0x81cb('0x8')](),controller['addTeams']);router[_0x81cb('0x10')](_0x81cb('0x11'),auth[_0x81cb('0x8')](),controller['addAgents']);router[_0x81cb('0x12')](_0x81cb('0x13'),auth[_0x81cb('0x8')](),controller['update']);router[_0x81cb('0x14')](_0x81cb('0x13'),auth[_0x81cb('0x8')](),controller[_0x81cb('0x15')]);router[_0x81cb('0x14')](_0x81cb('0xc'),auth['isAuthenticated'](),controller[_0x81cb('0x16')]);router[_0x81cb('0x14')](_0x81cb('0x11'),auth[_0x81cb('0x8')](),controller[_0x81cb('0x17')]);module['exports']=router; \ No newline at end of file +var _0x13d7=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer'];(function(_0x558d2f,_0x36a0bf){var _0xafcf11=function(_0x10302e){while(--_0x10302e){_0x558d2f['push'](_0x558d2f['shift']());}};_0xafcf11(++_0x36a0bf);}(_0x13d7,0xa7));var _0x713d=function(_0x994307,_0x2e2762){_0x994307=_0x994307-0x0;var _0x503ced=_0x13d7[_0x994307];return _0x503ced;};'use strict';var multer=require(_0x713d('0x0'));var util=require(_0x713d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x713d('0x2'));var router=express[_0x713d('0x3')]();var fs_extra=require(_0x713d('0x4'));var auth=require(_0x713d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x713d('0x6'));var controller=require(_0x713d('0x7'));router['get']('/',auth[_0x713d('0x8')](),controller[_0x713d('0x9')]);router[_0x713d('0xa')](_0x713d('0xb'),auth['isAuthenticated'](),controller[_0x713d('0xc')]);router['get'](_0x713d('0xd'),auth[_0x713d('0x8')](),controller['show']);router[_0x713d('0xa')](_0x713d('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x713d('0xa')](_0x713d('0xf'),auth[_0x713d('0x8')](),controller[_0x713d('0x10')]);router[_0x713d('0xa')](_0x713d('0x11'),auth[_0x713d('0x8')](),controller[_0x713d('0x12')]);router[_0x713d('0x13')]('/',auth[_0x713d('0x8')](),controller['create']);router['post'](_0x713d('0xf'),auth[_0x713d('0x8')](),controller[_0x713d('0x14')]);router[_0x713d('0x13')](_0x713d('0x11'),auth[_0x713d('0x8')](),controller[_0x713d('0x15')]);router[_0x713d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x713d('0x17')]);router[_0x713d('0x18')]('/:id',auth[_0x713d('0x8')](),controller[_0x713d('0x19')]);router['delete'](_0x713d('0xf'),auth[_0x713d('0x8')](),controller[_0x713d('0x1a')]);router[_0x713d('0x18')](_0x713d('0x11'),auth[_0x713d('0x8')](),controller[_0x713d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e6b098a..4f900fc 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 _0xe148=['name','INTEGER','rrmemory','beepall','roundrobin','STRING','sequelize','exports'];(function(_0x3e1d97,_0xe83c60){var _0x33193a=function(_0x1ceba8){while(--_0x1ceba8){_0x3e1d97['push'](_0x3e1d97['shift']());}};_0x33193a(++_0xe83c60);}(_0xe148,0x9e));var _0x8e14=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xe148[_0x3efe87];return _0x56a4cc;};'use strict';var Sequelize=require(_0x8e14('0x0'));module[_0x8e14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8e14('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8e14('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8e14('0x4'),_0x8e14('0x5'),_0x8e14('0x6'))},'description':{'type':Sequelize[_0x8e14('0x7')]}}; \ No newline at end of file +var _0x4b07=['rrmemory','beepall','exports','STRING','INTEGER','ENUM'];(function(_0x1bfe25,_0x2d7357){var _0x34ec99=function(_0x4da629){while(--_0x4da629){_0x1bfe25['push'](_0x1bfe25['shift']());}};_0x34ec99(++_0x2d7357);}(_0x4b07,0x1d6));var _0x74b0=function(_0x34ce53,_0x2a93dc){_0x34ce53=_0x34ce53-0x0;var _0x26a388=_0x4b07[_0x34ce53];return _0x26a388;};'use strict';var Sequelize=require('sequelize');module[_0x74b0('0x0')]={'name':{'type':Sequelize[_0x74b0('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x74b0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x74b0('0x3')](_0x74b0('0x4'),_0x74b0('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x74b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ee54240..481edb8 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 _0x5bb7=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','whatsappPause','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','flatMap','sequelize','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','set','apply','save','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','query','keys','filters','intersection','model','fields'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x5bb7,0x15b));var _0x75bb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5bb7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x75bb('0x0'));var rimraf=require(_0x75bb('0x1'));var zipdir=require(_0x75bb('0x2'));var jsonpatch=require(_0x75bb('0x3'));var rp=require(_0x75bb('0x4'));var moment=require('moment');var BPromise=require(_0x75bb('0x5'));var Mustache=require(_0x75bb('0x6'));var util=require(_0x75bb('0x7'));var path=require(_0x75bb('0x8'));var sox=require(_0x75bb('0x9'));var csv=require(_0x75bb('0xa'));var ejs=require(_0x75bb('0xb'));var fs=require('fs');var fs_extra=require(_0x75bb('0xc'));var _=require('lodash');var squel=require(_0x75bb('0xd'));var crypto=require(_0x75bb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x75bb('0xa'));var querystring=require(_0x75bb('0xf'));var Papa=require(_0x75bb('0x10'));var Redis=require('ioredis');var authService=require(_0x75bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x75bb('0x12'));var hardwareService=require(_0x75bb('0x13'));var logger=require('../../config/logger')(_0x75bb('0x14'));var utils=require('../../config/utils');var config=require(_0x75bb('0x15'));var licenseUtil=require(_0x75bb('0x16'));var db=require(_0x75bb('0x17'))['db'];config[_0x75bb('0x18')]=_[_0x75bb('0x19')](config[_0x75bb('0x18')],{'host':_0x75bb('0x1a'),'port':0x18eb});var socket=require(_0x75bb('0x1b'))(new Redis(config['redis']));require(_0x75bb('0x1c'))[_0x75bb('0x1d')](socket);function respondWithStatusCode(_0x1735f2,_0x17a46d){_0x17a46d=_0x17a46d||0xcc;return function(_0x1e42c2){if(_0x1e42c2){return _0x1735f2['sendStatus'](_0x17a46d);}return _0x1735f2['status'](_0x17a46d)['end']();};}function respondWithResult(_0x3f672c,_0x1f1902){_0x1f1902=_0x1f1902||0xc8;return function(_0x4f9bb5){if(_0x4f9bb5){return _0x3f672c[_0x75bb('0x1e')](_0x1f1902)[_0x75bb('0x1f')](_0x4f9bb5);}};}function respondWithFilteredResult(_0x2bfacc,_0x401b1e){return function(_0x1bb616){if(_0x1bb616){var _0x1236c0=typeof _0x401b1e[_0x75bb('0x20')]===_0x75bb('0x21')&&typeof _0x401b1e[_0x75bb('0x22')]===_0x75bb('0x21');var _0x113f51=_0x1bb616[_0x75bb('0x23')];var _0x2588de=_0x1236c0?0x0:_0x401b1e[_0x75bb('0x20')];var _0x34f5a3=_0x1236c0?_0x1bb616['count']:_0x401b1e[_0x75bb('0x20')]+_0x401b1e[_0x75bb('0x22')];var _0x2987d4;if(_0x34f5a3>=_0x113f51){_0x34f5a3=_0x113f51;_0x2987d4=0xc8;}else{_0x2987d4=0xce;}_0x2bfacc[_0x75bb('0x1e')](_0x2987d4);return _0x2bfacc[_0x75bb('0x24')]('Content-Range',_0x2588de+'-'+_0x34f5a3+'/'+_0x113f51)[_0x75bb('0x1f')](_0x1bb616);}return null;};}function patchUpdates(_0x11d516){return function(_0x203c3c){try{jsonpatch[_0x75bb('0x25')](_0x203c3c,_0x11d516,!![]);}catch(_0x482d3c){return BPromise['reject'](_0x482d3c);}return _0x203c3c[_0x75bb('0x26')]();};}function saveUpdates(_0x28291f,_0x33dab6){return function(_0x74a399){if(_0x74a399){return _0x74a399['update'](_0x28291f)['then'](function(_0x355408){return _0x355408;});}return null;};}function removeEntity(_0x267bf5,_0x596b56){return function(_0x3f2e7c){if(_0x3f2e7c){return _0x3f2e7c[_0x75bb('0x27')]()[_0x75bb('0x28')](function(){var _0x40cb9b=_0x3f2e7c[_0x75bb('0x29')]({'plain':!![]});var _0x17dd80=_0x75bb('0x2a');return db[_0x75bb('0x2b')][_0x75bb('0x27')]({'where':{'type':_0x17dd80,'resourceId':_0x40cb9b['id']}})[_0x75bb('0x28')](function(){return _0x3f2e7c;});})[_0x75bb('0x28')](function(){_0x267bf5[_0x75bb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9aca,_0x336268){return function(_0xb8e64c){if(!_0xb8e64c){_0x4d9aca[_0x75bb('0x2c')](0x194);}return _0xb8e64c;};}function handleError(_0x338c1b,_0x972058){_0x972058=_0x972058||0x1f4;return function(_0x253c87){logger[_0x75bb('0x2d')](_0x253c87[_0x75bb('0x2e')]);if(_0x253c87[_0x75bb('0x2f')]){delete _0x253c87[_0x75bb('0x2f')];}_0x338c1b[_0x75bb('0x1e')](_0x972058)[_0x75bb('0x30')](_0x253c87);};}exports[_0x75bb('0x31')]=function(_0x49369d,_0x4a5e2d){var _0x4b5a14={},_0x47b726={},_0x199cae={'count':0x0,'rows':[]};var _0x992d1f=_[_0x75bb('0x32')](db[_0x75bb('0x33')][_0x75bb('0x34')],function(_0x1f2d7f){return{'name':_0x1f2d7f['fieldName'],'type':_0x1f2d7f[_0x75bb('0x35')][_0x75bb('0x36')]};});_0x47b726['model']=_['map'](_0x992d1f,_0x75bb('0x2f'));_0x47b726[_0x75bb('0x37')]=_[_0x75bb('0x38')](_0x49369d[_0x75bb('0x37')]);_0x47b726[_0x75bb('0x39')]=_['intersection'](_0x47b726['model'],_0x47b726['query']);_0x4b5a14['attributes']=_[_0x75bb('0x3a')](_0x47b726[_0x75bb('0x3b')],qs[_0x75bb('0x3c')](_0x49369d[_0x75bb('0x37')][_0x75bb('0x3c')]));_0x4b5a14['attributes']=_0x4b5a14[_0x75bb('0x3d')][_0x75bb('0x3e')]?_0x4b5a14[_0x75bb('0x3d')]:_0x47b726[_0x75bb('0x3b')];if(!_0x49369d[_0x75bb('0x37')][_0x75bb('0x3f')](_0x75bb('0x40'))){_0x4b5a14[_0x75bb('0x22')]=qs['limit'](_0x49369d[_0x75bb('0x37')][_0x75bb('0x22')]);_0x4b5a14[_0x75bb('0x20')]=qs[_0x75bb('0x20')](_0x49369d[_0x75bb('0x37')][_0x75bb('0x20')]);}_0x4b5a14[_0x75bb('0x41')]=qs[_0x75bb('0x42')](_0x49369d['query'][_0x75bb('0x42')]);_0x4b5a14['where']=qs[_0x75bb('0x39')](_[_0x75bb('0x43')](_0x49369d[_0x75bb('0x37')],_0x47b726[_0x75bb('0x39')]),_0x992d1f);if(_0x49369d['query']['filter']){_0x4b5a14[_0x75bb('0x44')]=_[_0x75bb('0x45')](_0x4b5a14['where'],{'$or':_[_0x75bb('0x32')](_0x992d1f,function(_0x4956d5){if(_0x4956d5['type']!==_0x75bb('0x46')){var _0x4b6599={};_0x4b6599[_0x4956d5['name']]={'$like':'%'+_0x49369d[_0x75bb('0x37')][_0x75bb('0x47')]+'%'};return _0x4b6599;}})});}_0x4b5a14=_[_0x75bb('0x45')]({},_0x4b5a14,_0x49369d['options']);var _0x4a7e1d={'where':_0x4b5a14[_0x75bb('0x44')]};return db['WhatsappQueue'][_0x75bb('0x23')](_0x4a7e1d)['then'](function(_0x4186dc){_0x199cae[_0x75bb('0x23')]=_0x4186dc;if(_0x49369d['query'][_0x75bb('0x48')]){_0x4b5a14[_0x75bb('0x49')]=[{'all':!![]}];}return db[_0x75bb('0x33')][_0x75bb('0x4a')](_0x4b5a14);})[_0x75bb('0x28')](function(_0x3aa57b){_0x199cae[_0x75bb('0x4b')]=_0x3aa57b;return _0x199cae;})[_0x75bb('0x28')](respondWithFilteredResult(_0x4a5e2d,_0x4b5a14))[_0x75bb('0x4c')](handleError(_0x4a5e2d,null));};exports[_0x75bb('0x4d')]=function(_0x3f8677,_0xd79311){var _0x4389cc={'raw':!![],'where':{'id':_0x3f8677[_0x75bb('0x4e')]['id']}},_0x4d16af={};_0x4d16af[_0x75bb('0x3b')]=_[_0x75bb('0x38')](db[_0x75bb('0x33')]['rawAttributes']);_0x4d16af[_0x75bb('0x37')]=_[_0x75bb('0x38')](_0x3f8677['query']);_0x4d16af[_0x75bb('0x39')]=_[_0x75bb('0x3a')](_0x4d16af['model'],_0x4d16af['query']);_0x4389cc[_0x75bb('0x3d')]=_[_0x75bb('0x3a')](_0x4d16af[_0x75bb('0x3b')],qs[_0x75bb('0x3c')](_0x3f8677[_0x75bb('0x37')][_0x75bb('0x3c')]));_0x4389cc['attributes']=_0x4389cc[_0x75bb('0x3d')][_0x75bb('0x3e')]?_0x4389cc[_0x75bb('0x3d')]:_0x4d16af[_0x75bb('0x3b')];if(_0x3f8677[_0x75bb('0x37')][_0x75bb('0x48')]){_0x4389cc[_0x75bb('0x49')]=[{'all':!![]}];}_0x4389cc=_[_0x75bb('0x45')]({},_0x4389cc,_0x3f8677[_0x75bb('0x4f')]);return db['WhatsappQueue']['find'](_0x4389cc)['then'](handleEntityNotFound(_0xd79311,null))[_0x75bb('0x28')](respondWithResult(_0xd79311,null))[_0x75bb('0x4c')](handleError(_0xd79311,null));};exports['create']=function(_0x434df3,_0x36ac5c){return db[_0x75bb('0x33')][_0x75bb('0x50')](_0x434df3[_0x75bb('0x51')],{})['then'](function(_0xbc6aa8){var _0x56fa92=_0x434df3[_0x75bb('0x52')]['get']({'plain':!![]});if(!_0x56fa92)throw new Error(_0x75bb('0x53'));if(_0x56fa92[_0x75bb('0x54')]===_0x75bb('0x52')){var _0x377cc1=_0xbc6aa8[_0x75bb('0x29')]({'plain':!![]});var _0x1607a7=_0x75bb('0x2a');return db[_0x75bb('0x55')][_0x75bb('0x56')]({'where':{'name':_0x1607a7,'userProfileId':_0x56fa92['userProfileId']},'raw':!![]})[_0x75bb('0x28')](function(_0x4b05d4){if(_0x4b05d4&&_0x4b05d4['autoAssociation']===0x0){return db[_0x75bb('0x2b')][_0x75bb('0x50')]({'name':_0x377cc1['name'],'resourceId':_0x377cc1['id'],'type':_0x4b05d4[_0x75bb('0x2f')],'sectionId':_0x4b05d4['id']},{})[_0x75bb('0x28')](function(){return _0xbc6aa8;});}else{return _0xbc6aa8;}})[_0x75bb('0x4c')](function(_0x41183f){logger[_0x75bb('0x2d')](_0x75bb('0x57'),_0x41183f);throw _0x41183f;});}return _0xbc6aa8;})[_0x75bb('0x28')](respondWithResult(_0x36ac5c,0xc9))[_0x75bb('0x4c')](handleError(_0x36ac5c,null));};exports[_0x75bb('0x58')]=function(_0x466b7b,_0x6fd36b){if(_0x466b7b[_0x75bb('0x51')]['id']){delete _0x466b7b['body']['id'];}return db['WhatsappQueue'][_0x75bb('0x56')]({'where':{'id':_0x466b7b[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x6fd36b,null))[_0x75bb('0x28')](saveUpdates(_0x466b7b[_0x75bb('0x51')],null))['then'](respondWithResult(_0x6fd36b,null))[_0x75bb('0x4c')](handleError(_0x6fd36b,null));};exports['destroy']=function(_0x7e4960,_0x4ebb96){return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x7e4960[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x4ebb96,null))[_0x75bb('0x28')](removeEntity(_0x4ebb96,null))['catch'](handleError(_0x4ebb96,null));};exports[_0x75bb('0x59')]=function(_0x4e5de6,_0x4c3f0d){return db[_0x75bb('0x33')][_0x75bb('0x59')]()['then'](respondWithResult(_0x4c3f0d,null))[_0x75bb('0x4c')](handleError(_0x4c3f0d,null));};exports['getMembers']=function(_0x83e44d,_0x58c3a7,_0x435c5f){var _0xb487b3={'raw':!![],'where':{}},_0x46f2f2={},_0x10474c;return db[_0x75bb('0x33')][_0x75bb('0x5a')]({'where':{'id':_0x83e44d[_0x75bb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58c3a7,null))[_0x75bb('0x28')](function(_0x4307e1){if(_0x4307e1){_0x10474c=_0x4307e1[_0x75bb('0x29')]({'plain':!![]});_0x46f2f2[_0x75bb('0x3b')]=_[_0x75bb('0x38')](db[_0x75bb('0x5b')][_0x75bb('0x34')]);_0x46f2f2[_0x75bb('0x37')]=_['keys'](_0x83e44d['query']);_0x46f2f2[_0x75bb('0x39')]=_['intersection'](_0x46f2f2[_0x75bb('0x3b')],_0x46f2f2[_0x75bb('0x37')]);_0xb487b3['attributes']=_[_0x75bb('0x3a')](_0x46f2f2[_0x75bb('0x3b')],qs['fields'](_0x83e44d[_0x75bb('0x37')][_0x75bb('0x3c')]));_0xb487b3[_0x75bb('0x3d')]=_0xb487b3['attributes'][_0x75bb('0x3e')]?_0xb487b3[_0x75bb('0x3d')]:_0x46f2f2['model'];if(!_0x83e44d[_0x75bb('0x37')][_0x75bb('0x3f')](_0x75bb('0x40'))){_0xb487b3['limit']=qs[_0x75bb('0x22')](_0x83e44d[_0x75bb('0x37')][_0x75bb('0x22')]);_0xb487b3[_0x75bb('0x20')]=qs[_0x75bb('0x20')](_0x83e44d['query']['offset']);}_0xb487b3[_0x75bb('0x41')]=qs[_0x75bb('0x42')](_0x83e44d['query'][_0x75bb('0x42')]);_0xb487b3[_0x75bb('0x44')]=qs[_0x75bb('0x39')](_[_0x75bb('0x43')](_0x83e44d['query'],_0x46f2f2[_0x75bb('0x39')]));_0xb487b3[_0x75bb('0x44')][_0x75bb('0x5c')]=_0x4307e1['id'];if(_0x83e44d[_0x75bb('0x37')][_0x75bb('0x47')]){_0xb487b3['where']=_['merge'](_0xb487b3[_0x75bb('0x44')],{'$or':_[_0x75bb('0x32')](_0xb487b3[_0x75bb('0x3d')],function(_0x218bb0){var _0x4c374d={};_0x4c374d[_0x218bb0]={'$like':'%'+_0x83e44d[_0x75bb('0x37')][_0x75bb('0x47')]+'%'};return _0x4c374d;})});}_0xb487b3=_['merge']({},_0xb487b3,_0x83e44d['options']);return db[_0x75bb('0x5b')][_0x75bb('0x4a')](_0xb487b3);}})[_0x75bb('0x28')](function(_0x158c65){if(_0x158c65){return db['User'][_0x75bb('0x5d')]({'where':{'id':_['map'](_0x158c65,'UserId'),'role':'agent'},'attributes':['id',_0x75bb('0x2f'),_0x75bb('0x5e'),'updatedAt',_0x75bb('0x5f')]});}})[_0x75bb('0x28')](function(_0x4ea9d8){if(_0x4ea9d8){return{'count':_0x4ea9d8['count'],'rows':_[_0x75bb('0x32')](_0x4ea9d8['rows'],function(_0x43b5fa){return{'membername':_0x43b5fa[_0x75bb('0x2f')],'UserId':_0x43b5fa['id'],'queue_name':_0x10474c[_0x75bb('0x2f')],'WhatsappQueueId':_0x10474c['id'],'interface':util['format'](_0x75bb('0x60'),_0x75bb('0x61'),_0x43b5fa[_0x75bb('0x2f')]),'penalty':0x0,'paused':_0x43b5fa['whatsappPause'],'createdAt':_0x43b5fa[_0x75bb('0x5f')],'updatedAt':_0x43b5fa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x75bb('0x28')](respondWithFilteredResult(_0x58c3a7,_0xb487b3))[_0x75bb('0x4c')](handleError(_0x58c3a7,null));};exports[_0x75bb('0x62')]=function(_0x5a8a25,_0x5f7d8d,_0x1e11f7){var _0x55419c={};var _0x3b4f71={};var _0xc8e918;var _0x1a738e;return db['WhatsappQueue'][_0x75bb('0x5a')]({'where':{'id':_0x5a8a25[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x5f7d8d,null))['then'](function(_0x453536){if(_0x453536){_0xc8e918=_0x453536;_0x3b4f71['model']=_[_0x75bb('0x38')](db[_0x75bb('0x63')][_0x75bb('0x34')]);_0x3b4f71[_0x75bb('0x37')]=_[_0x75bb('0x38')](_0x5a8a25[_0x75bb('0x37')]);_0x3b4f71[_0x75bb('0x39')]=_['intersection'](_0x3b4f71[_0x75bb('0x3b')],_0x3b4f71[_0x75bb('0x37')]);_0x55419c['attributes']=_[_0x75bb('0x3a')](_0x3b4f71[_0x75bb('0x3b')],qs['fields'](_0x5a8a25['query'][_0x75bb('0x3c')]));_0x55419c[_0x75bb('0x3d')]=_0x55419c[_0x75bb('0x3d')][_0x75bb('0x3e')]?_0x55419c[_0x75bb('0x3d')]:_0x3b4f71[_0x75bb('0x3b')];_0x55419c['order']=qs[_0x75bb('0x42')](_0x5a8a25[_0x75bb('0x37')][_0x75bb('0x42')]);_0x55419c[_0x75bb('0x44')]=qs[_0x75bb('0x39')](_['pick'](_0x5a8a25['query'],_0x3b4f71[_0x75bb('0x39')]));if(_0x5a8a25[_0x75bb('0x37')]['filter']){_0x55419c['where']=_['merge'](_0x55419c[_0x75bb('0x44')],{'$or':_[_0x75bb('0x32')](_0x55419c[_0x75bb('0x3d')],function(_0x357f29){var _0x4de248={};_0x4de248[_0x357f29]={'$like':'%'+_0x5a8a25['query'][_0x75bb('0x47')]+'%'};return _0x4de248;})});}_0x55419c=_[_0x75bb('0x45')]({},_0x55419c,_0x5a8a25[_0x75bb('0x4f')]);return _0xc8e918[_0x75bb('0x62')](_0x55419c);}})[_0x75bb('0x28')](function(_0x52b51d){if(_0x52b51d){_0x1a738e=_0x52b51d[_0x75bb('0x3e')];if(!_0x5a8a25['query'][_0x75bb('0x3f')](_0x75bb('0x40'))){_0x55419c[_0x75bb('0x22')]=qs[_0x75bb('0x22')](_0x5a8a25[_0x75bb('0x37')][_0x75bb('0x22')]);_0x55419c[_0x75bb('0x20')]=qs[_0x75bb('0x20')](_0x5a8a25['query']['offset']);}return _0xc8e918[_0x75bb('0x62')](_0x55419c);}})[_0x75bb('0x28')](function(_0x18e784){if(_0x18e784){return _0x18e784?{'count':_0x1a738e,'rows':_0x18e784}:null;}})['then'](respondWithResult(_0x5f7d8d,null))[_0x75bb('0x4c')](handleError(_0x5f7d8d,null));};exports[_0x75bb('0x64')]=function(_0x165103,_0x2a7a85,_0x4a9a5f){var _0x44b98b=_0x165103['body'][_0x75bb('0x65')];return db['Team'][_0x75bb('0x4a')]({'where':{'id':_0x44b98b},'attributes':['id'],'include':[{'model':db[_0x75bb('0x66')],'as':_0x75bb('0x67'),'attributes':['id','name',_0x75bb('0x68'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x4ecda9){if(_0x4ecda9){var _0xb9ad80=_[_0x75bb('0x69')](_0x4ecda9,function(_0x438992){var _0x5ebcc2=_0x438992[_0x75bb('0x29')]({'plain':!![]});return _0x5ebcc2[_0x75bb('0x67')];});return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x165103[_0x75bb('0x4e')]['id']}})['then'](function(_0x1e5f3b){return db[_0x75bb('0x6a')]['transaction'](function(_0xf4f16d){return _0x1e5f3b[_0x75bb('0x64')](_0x44b98b,{'transaction':_0xf4f16d})[_0x75bb('0x28')](function(){return BPromise['each'](_0xb9ad80,function(_0x438a82){return db[_0x75bb('0x5b')][_0x75bb('0x6b')]({'where':{'UserId':_0x438a82['id'],'WhatsappQueueId':_0x165103['params']['id']},'transaction':_0xf4f16d});});})[_0x75bb('0x28')](function(){_0xb9ad80[_0x75bb('0x6c')](function(_0x1bb3b8){socket['emit'](_0x75bb('0x6d'),{'UserId':_0x1bb3b8['id'],'WhatsappQueueId':_0x1e5f3b['id']});});});});});}})[_0x75bb('0x28')](respondWithStatusCode(_0x2a7a85,null))[_0x75bb('0x4c')](handleError(_0x2a7a85,null));};exports[_0x75bb('0x6e')]=function(_0x3cb7cc,_0x2cb75a,_0x121a65){return db['Team']['findAll']({'where':{'id':_0x3cb7cc[_0x75bb('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x75bb('0x66')],'as':_0x75bb('0x67'),'attributes':['id'],'raw':!![]}]})[_0x75bb('0x28')](handleEntityNotFound(_0x2cb75a,null))['then'](function(_0x5180c1){var _0x441b=_[_0x75bb('0x32')](_0x5180c1,'id');var _0x3ae125=[];var _0x338d59=[];var _0x1a8403=squel[_0x75bb('0x6f')]();_0x1a8403[_0x75bb('0x70')]('tq.TeamId')[_0x75bb('0x71')](_0x75bb('0x72'),'tq')[_0x75bb('0x73')](_0x75bb('0x74'),'ut',_0x75bb('0x75'))[_0x75bb('0x44')](_0x75bb('0x76'),_0x3cb7cc[_0x75bb('0x4e')]['id']);for(var _0x40360c=0x0;_0x40360c<_0x5180c1['length'];_0x40360c+=0x1){let _0xe15041=_0x5180c1[_0x40360c];for(var _0x336c41=0x0;_0x336c41<_0xe15041[_0x75bb('0x67')][_0x75bb('0x3e')];_0x336c41+=0x1){let _0x1110ab=_0xe15041[_0x75bb('0x67')][_0x336c41];var _0x1c7cd8=_0x1a8403['clone']();_0x1c7cd8[_0x75bb('0x44')]('ut.UserId\x20=\x20?',_0x1110ab['id']);_0x338d59['push'](db[_0x75bb('0x6a')][_0x75bb('0x37')](_0x1c7cd8[_0x75bb('0x77')](),{'type':db[_0x75bb('0x6a')][_0x75bb('0x78')][_0x75bb('0x79')]})[_0x75bb('0x28')](function(_0x270ba8){if(_0x270ba8['length']===0x1){return _0x1110ab['id'];}else{var _0x27b2c9=_['every'](_[_0x75bb('0x32')](_0x270ba8,_0x75bb('0x7a')),function(_0x391468){return _[_0x75bb('0x7b')](_0x441b,_0x391468);});if(_0x27b2c9){return _0x1110ab['id'];}}}));}}return BPromise[_0x75bb('0x7c')](_0x338d59)[_0x75bb('0x28')](function(_0x596f85){_0x3ae125=_(_0x3ae125)[_0x75bb('0x7d')](_0x596f85)[_0x75bb('0x7e')]()['value']();return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x3cb7cc[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](function(_0x52279a){return db[_0x75bb('0x6a')][_0x75bb('0x7f')](function(_0x123e43){return _0x52279a[_0x75bb('0x6e')](_0x3cb7cc[_0x75bb('0x37')][_0x75bb('0x65')],{'transaction':_0x123e43})[_0x75bb('0x28')](function(){if(!_[_0x75bb('0x80')](_0x3ae125)){return _0x52279a[_0x75bb('0x81')](_0x3ae125,{'transaction':_0x123e43});}})[_0x75bb('0x28')](function(){_0x3ae125[_0x75bb('0x6c')](function(_0x43ca7d){socket[_0x75bb('0x82')](_0x75bb('0x83'),{'UserId':_0x43ca7d,'WhatsappQueueId':_0x52279a['id']});});});});});});})['then'](respondWithStatusCode(_0x2cb75a,null))[_0x75bb('0x4c')](handleError(_0x2cb75a,null));};exports[_0x75bb('0x84')]=function(_0x47e607,_0xbce05c,_0x5704bd){return db['WhatsappQueue']['find']({'where':{'id':_0x47e607[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0xbce05c,null))['then'](function(_0x2ce74a){if(_0x2ce74a){return _0x2ce74a[_0x75bb('0x84')](_0x47e607[_0x75bb('0x51')][_0x75bb('0x65')],_['omit'](_0x47e607[_0x75bb('0x51')],['ids','id'])||{})[_0x75bb('0x85')](function(_0x1a2cae){for(var _0x25ecdd=0x0;_0x25ecdd<_0x47e607[_0x75bb('0x51')]['ids'][_0x75bb('0x3e')];_0x25ecdd+=0x1){socket[_0x75bb('0x82')](_0x75bb('0x6d'),{'UserId':Number(_0x47e607[_0x75bb('0x51')]['ids'][_0x25ecdd]),'WhatsappQueueId':Number(_0x47e607[_0x75bb('0x4e')]['id'])});}return _0x1a2cae;});}})[_0x75bb('0x28')](respondWithResult(_0xbce05c,null))[_0x75bb('0x4c')](handleError(_0xbce05c,null));};exports[_0x75bb('0x81')]=function(_0x1ed846,_0x5dc518,_0x3e9b79){return db[_0x75bb('0x33')][_0x75bb('0x56')]({'where':{'id':_0x1ed846[_0x75bb('0x4e')]['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x5dc518,null))[_0x75bb('0x28')](function(_0x15f357){if(_0x15f357){return _0x15f357['removeAgents'](_0x1ed846['query'][_0x75bb('0x65')])[_0x75bb('0x28')](function(){if(_[_0x75bb('0x86')](_0x1ed846[_0x75bb('0x37')]['ids'])){for(var _0x4887d9=0x0;_0x4887d9<_0x1ed846['query'][_0x75bb('0x65')][_0x75bb('0x3e')];_0x4887d9+=0x1){socket[_0x75bb('0x82')](_0x75bb('0x83'),{'UserId':Number(_0x1ed846[_0x75bb('0x37')][_0x75bb('0x65')][_0x4887d9]),'WhatsappQueueId':Number(_0x1ed846['params']['id'])});}}else{socket[_0x75bb('0x82')](_0x75bb('0x83'),{'UserId':Number(_0x1ed846[_0x75bb('0x37')]['ids']),'WhatsappQueueId':Number(_0x1ed846['params']['id'])});}});}})[_0x75bb('0x28')](respondWithStatusCode(_0x5dc518,null))[_0x75bb('0x4c')](handleError(_0x5dc518,null));};exports[_0x75bb('0x87')]=function(_0x18e70e,_0x76415,_0x335559){var _0x358c9a={};var _0x336fa2={};var _0x30fe6d;var _0x492bbe;return db[_0x75bb('0x33')][_0x75bb('0x5a')]({'where':{'id':_0x18e70e['params']['id']}})[_0x75bb('0x28')](handleEntityNotFound(_0x76415,null))[_0x75bb('0x28')](function(_0x51b3ed){if(_0x51b3ed){_0x30fe6d=_0x51b3ed;_0x336fa2[_0x75bb('0x3b')]=_[_0x75bb('0x38')](db[_0x75bb('0x66')][_0x75bb('0x34')]);_0x336fa2['query']=_[_0x75bb('0x38')](_0x18e70e[_0x75bb('0x37')]);_0x336fa2[_0x75bb('0x39')]=_[_0x75bb('0x3a')](_0x336fa2[_0x75bb('0x3b')],_0x336fa2[_0x75bb('0x37')]);_0x358c9a[_0x75bb('0x3d')]=_[_0x75bb('0x3a')](_0x336fa2['model'],qs[_0x75bb('0x3c')](_0x18e70e[_0x75bb('0x37')]['fields']));_0x358c9a[_0x75bb('0x3d')]=_0x358c9a[_0x75bb('0x3d')]['length']?_0x358c9a[_0x75bb('0x3d')]:_0x336fa2[_0x75bb('0x3b')];_0x358c9a[_0x75bb('0x41')]=qs['sort'](_0x18e70e[_0x75bb('0x37')][_0x75bb('0x42')]);_0x358c9a[_0x75bb('0x44')]=qs[_0x75bb('0x39')](_['pick'](_0x18e70e['query'],_0x336fa2[_0x75bb('0x39')]));if(_0x18e70e[_0x75bb('0x37')]['filter']){_0x358c9a[_0x75bb('0x44')]=_['merge'](_0x358c9a['where'],{'$or':_[_0x75bb('0x32')](_0x358c9a[_0x75bb('0x3d')],function(_0x530799){var _0x434816={};_0x434816[_0x530799]={'$like':'%'+_0x18e70e['query']['filter']+'%'};return _0x434816;})});}_0x358c9a=_[_0x75bb('0x45')]({},_0x358c9a,_0x18e70e['options']);return _0x30fe6d['getAgents'](_0x358c9a);}})['then'](function(_0x201b6f){if(_0x201b6f){_0x492bbe=_0x201b6f[_0x75bb('0x3e')];if(!_0x18e70e[_0x75bb('0x37')]['hasOwnProperty'](_0x75bb('0x40'))){_0x358c9a[_0x75bb('0x22')]=qs['limit'](_0x18e70e['query'][_0x75bb('0x22')]);_0x358c9a['offset']=qs[_0x75bb('0x20')](_0x18e70e[_0x75bb('0x37')][_0x75bb('0x20')]);}return _0x30fe6d[_0x75bb('0x87')](_0x358c9a);}})[_0x75bb('0x28')](function(_0x9b83d){if(_0x9b83d){return _0x9b83d?{'count':_0x492bbe,'rows':_0x9b83d}:null;}})[_0x75bb('0x28')](respondWithResult(_0x76415,null))[_0x75bb('0x4c')](handleError(_0x76415,null));}; \ No newline at end of file +var _0x2925=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','pick','WhatsappQueueId','findAll','User','findAndCountAll','updatedAt','format','%s/%s','SIP','whatsappPause','createdAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2925,0x168));var _0x5292=function(_0x3cc0e2,_0xf41d9d){_0x3cc0e2=_0x3cc0e2-0x0;var _0x5a073f=_0x2925[_0x3cc0e2];return _0x5a073f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5292('0x0'));var zipdir=require(_0x5292('0x1'));var jsonpatch=require(_0x5292('0x2'));var rp=require(_0x5292('0x3'));var moment=require(_0x5292('0x4'));var BPromise=require(_0x5292('0x5'));var Mustache=require(_0x5292('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5292('0x7'));var csv=require(_0x5292('0x8'));var ejs=require(_0x5292('0x9'));var fs=require('fs');var fs_extra=require(_0x5292('0xa'));var _=require(_0x5292('0xb'));var squel=require(_0x5292('0xc'));var crypto=require(_0x5292('0xd'));var jsforce=require(_0x5292('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5292('0x8'));var querystring=require(_0x5292('0xf'));var Papa=require(_0x5292('0x10'));var Redis=require('ioredis');var authService=require(_0x5292('0x11'));var qs=require(_0x5292('0x12'));var as=require(_0x5292('0x13'));var hardwareService=require(_0x5292('0x14'));var logger=require(_0x5292('0x15'))(_0x5292('0x16'));var utils=require(_0x5292('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5292('0x18'))['db'];config[_0x5292('0x19')]=_[_0x5292('0x1a')](config[_0x5292('0x19')],{'host':_0x5292('0x1b'),'port':0x18eb});var socket=require(_0x5292('0x1c'))(new Redis(config[_0x5292('0x19')]));require('./whatsappQueue.socket')[_0x5292('0x1d')](socket);function respondWithStatusCode(_0x56315b,_0x3f3190){_0x3f3190=_0x3f3190||0xcc;return function(_0x5838f0){if(_0x5838f0){return _0x56315b[_0x5292('0x1e')](_0x3f3190);}return _0x56315b[_0x5292('0x1f')](_0x3f3190)['end']();};}function respondWithResult(_0x2d4426,_0x27b0f4){_0x27b0f4=_0x27b0f4||0xc8;return function(_0x1fee79){if(_0x1fee79){return _0x2d4426[_0x5292('0x1f')](_0x27b0f4)[_0x5292('0x20')](_0x1fee79);}};}function respondWithFilteredResult(_0x3f8c63,_0x1051da){return function(_0x302604){if(_0x302604){var _0x204ef8=typeof _0x1051da[_0x5292('0x21')]===_0x5292('0x22')&&typeof _0x1051da[_0x5292('0x23')]===_0x5292('0x22');var _0x69ed99=_0x302604[_0x5292('0x24')];var _0x2ef5eb=_0x204ef8?0x0:_0x1051da['offset'];var _0x31cef5=_0x204ef8?_0x302604['count']:_0x1051da[_0x5292('0x21')]+_0x1051da[_0x5292('0x23')];var _0x2b55f1;if(_0x31cef5>=_0x69ed99){_0x31cef5=_0x69ed99;_0x2b55f1=0xc8;}else{_0x2b55f1=0xce;}_0x3f8c63[_0x5292('0x1f')](_0x2b55f1);return _0x3f8c63[_0x5292('0x25')](_0x5292('0x26'),_0x2ef5eb+'-'+_0x31cef5+'/'+_0x69ed99)['json'](_0x302604);}return null;};}function patchUpdates(_0x2af980){return function(_0x493379){try{jsonpatch[_0x5292('0x27')](_0x493379,_0x2af980,!![]);}catch(_0x13c518){return BPromise[_0x5292('0x28')](_0x13c518);}return _0x493379[_0x5292('0x29')]();};}function saveUpdates(_0x24a433,_0x47f178){return function(_0x515c9e){if(_0x515c9e){return _0x515c9e['update'](_0x24a433)[_0x5292('0x2a')](function(_0x1266cf){return _0x1266cf;});}return null;};}function removeEntity(_0x17f06f,_0x40727a){return function(_0x3b69cd){if(_0x3b69cd){return _0x3b69cd[_0x5292('0x2b')]()[_0x5292('0x2a')](function(){var _0xf81ae4=_0x3b69cd[_0x5292('0x2c')]({'plain':!![]});var _0x2b0b4c='WhatsappQueues';return db[_0x5292('0x2d')][_0x5292('0x2b')]({'where':{'type':_0x2b0b4c,'resourceId':_0xf81ae4['id']}})['then'](function(){return _0x3b69cd;});})[_0x5292('0x2a')](function(){_0x17f06f[_0x5292('0x1f')](0xcc)[_0x5292('0x2e')]();});}};}function handleEntityNotFound(_0x229e79,_0x15c802){return function(_0x24fdd1){if(!_0x24fdd1){_0x229e79[_0x5292('0x1e')](0x194);}return _0x24fdd1;};}function handleError(_0x3b7942,_0x41949a){_0x41949a=_0x41949a||0x1f4;return function(_0x133f12){logger[_0x5292('0x2f')](_0x133f12['stack']);if(_0x133f12[_0x5292('0x30')]){delete _0x133f12[_0x5292('0x30')];}_0x3b7942[_0x5292('0x1f')](_0x41949a)[_0x5292('0x31')](_0x133f12);};}exports[_0x5292('0x32')]=function(_0x284a45,_0x4bedbc){var _0x4ed5ef={},_0x34b19b={},_0x59d0e={'count':0x0,'rows':[]};var _0x2aeaf3=_[_0x5292('0x33')](db['WhatsappQueue'][_0x5292('0x34')],function(_0xea2702){return{'name':_0xea2702[_0x5292('0x35')],'type':_0xea2702[_0x5292('0x36')][_0x5292('0x37')]};});_0x34b19b[_0x5292('0x38')]=_['map'](_0x2aeaf3,_0x5292('0x30'));_0x34b19b[_0x5292('0x39')]=_['keys'](_0x284a45['query']);_0x34b19b[_0x5292('0x3a')]=_[_0x5292('0x3b')](_0x34b19b['model'],_0x34b19b[_0x5292('0x39')]);_0x4ed5ef[_0x5292('0x3c')]=_[_0x5292('0x3b')](_0x34b19b[_0x5292('0x38')],qs[_0x5292('0x3d')](_0x284a45[_0x5292('0x39')][_0x5292('0x3d')]));_0x4ed5ef[_0x5292('0x3c')]=_0x4ed5ef['attributes'][_0x5292('0x3e')]?_0x4ed5ef[_0x5292('0x3c')]:_0x34b19b[_0x5292('0x38')];if(!_0x284a45[_0x5292('0x39')][_0x5292('0x3f')](_0x5292('0x40'))){_0x4ed5ef[_0x5292('0x23')]=qs[_0x5292('0x23')](_0x284a45['query'][_0x5292('0x23')]);_0x4ed5ef['offset']=qs['offset'](_0x284a45[_0x5292('0x39')][_0x5292('0x21')]);}_0x4ed5ef[_0x5292('0x41')]=qs[_0x5292('0x42')](_0x284a45[_0x5292('0x39')][_0x5292('0x42')]);_0x4ed5ef[_0x5292('0x43')]=qs[_0x5292('0x3a')](_['pick'](_0x284a45[_0x5292('0x39')],_0x34b19b[_0x5292('0x3a')]),_0x2aeaf3);if(_0x284a45[_0x5292('0x39')][_0x5292('0x44')]){_0x4ed5ef[_0x5292('0x43')]=_[_0x5292('0x45')](_0x4ed5ef['where'],{'$or':_[_0x5292('0x33')](_0x2aeaf3,function(_0x37c4f4){if(_0x37c4f4['type']!==_0x5292('0x46')){var _0x34b83f={};_0x34b83f[_0x37c4f4[_0x5292('0x30')]]={'$like':'%'+_0x284a45[_0x5292('0x39')][_0x5292('0x44')]+'%'};return _0x34b83f;}})});}_0x4ed5ef=_[_0x5292('0x45')]({},_0x4ed5ef,_0x284a45[_0x5292('0x47')]);var _0x41cd64={'where':_0x4ed5ef[_0x5292('0x43')]};return db[_0x5292('0x48')][_0x5292('0x24')](_0x41cd64)[_0x5292('0x2a')](function(_0x430e41){_0x59d0e[_0x5292('0x24')]=_0x430e41;if(_0x284a45[_0x5292('0x39')][_0x5292('0x49')]){_0x4ed5ef[_0x5292('0x4a')]=[{'all':!![]}];}return db[_0x5292('0x48')]['findAll'](_0x4ed5ef);})['then'](function(_0x5ef0e7){_0x59d0e[_0x5292('0x4b')]=_0x5ef0e7;return _0x59d0e;})[_0x5292('0x2a')](respondWithFilteredResult(_0x4bedbc,_0x4ed5ef))[_0x5292('0x4c')](handleError(_0x4bedbc,null));};exports[_0x5292('0x4d')]=function(_0x1bbb95,_0x6ca687){var _0x2c81f4={'raw':!![],'where':{'id':_0x1bbb95[_0x5292('0x4e')]['id']}},_0x224ce9={};_0x224ce9[_0x5292('0x38')]=_[_0x5292('0x4f')](db[_0x5292('0x48')]['rawAttributes']);_0x224ce9[_0x5292('0x39')]=_['keys'](_0x1bbb95[_0x5292('0x39')]);_0x224ce9[_0x5292('0x3a')]=_[_0x5292('0x3b')](_0x224ce9[_0x5292('0x38')],_0x224ce9[_0x5292('0x39')]);_0x2c81f4['attributes']=_[_0x5292('0x3b')](_0x224ce9[_0x5292('0x38')],qs[_0x5292('0x3d')](_0x1bbb95['query'][_0x5292('0x3d')]));_0x2c81f4[_0x5292('0x3c')]=_0x2c81f4['attributes']['length']?_0x2c81f4[_0x5292('0x3c')]:_0x224ce9[_0x5292('0x38')];if(_0x1bbb95[_0x5292('0x39')][_0x5292('0x49')]){_0x2c81f4[_0x5292('0x4a')]=[{'all':!![]}];}_0x2c81f4=_[_0x5292('0x45')]({},_0x2c81f4,_0x1bbb95[_0x5292('0x47')]);return db[_0x5292('0x48')][_0x5292('0x50')](_0x2c81f4)['then'](handleEntityNotFound(_0x6ca687,null))[_0x5292('0x2a')](respondWithResult(_0x6ca687,null))[_0x5292('0x4c')](handleError(_0x6ca687,null));};exports['create']=function(_0x3ffea4,_0x4037bf){return db[_0x5292('0x48')][_0x5292('0x51')](_0x3ffea4[_0x5292('0x52')],{})['then'](function(_0x3e1414){var _0xb1f2d9=_0x3ffea4[_0x5292('0x53')][_0x5292('0x2c')]({'plain':!![]});if(!_0xb1f2d9)throw new Error(_0x5292('0x54'));if(_0xb1f2d9['role']===_0x5292('0x53')){var _0x187a0d=_0x3e1414[_0x5292('0x2c')]({'plain':!![]});var _0x4ab9a5=_0x5292('0x55');return db[_0x5292('0x56')]['find']({'where':{'name':_0x4ab9a5,'userProfileId':_0xb1f2d9['userProfileId']},'raw':!![]})[_0x5292('0x2a')](function(_0x3dc320){if(_0x3dc320&&_0x3dc320[_0x5292('0x57')]===0x0){return db[_0x5292('0x2d')]['create']({'name':_0x187a0d['name'],'resourceId':_0x187a0d['id'],'type':_0x3dc320[_0x5292('0x30')],'sectionId':_0x3dc320['id']},{})[_0x5292('0x2a')](function(){return _0x3e1414;});}else{return _0x3e1414;}})[_0x5292('0x4c')](function(_0x3de502){logger[_0x5292('0x2f')](_0x5292('0x58'),_0x3de502);throw _0x3de502;});}return _0x3e1414;})[_0x5292('0x2a')](respondWithResult(_0x4037bf,0xc9))[_0x5292('0x4c')](handleError(_0x4037bf,null));};exports[_0x5292('0x59')]=function(_0x2704b4,_0x37ba57){if(_0x2704b4[_0x5292('0x52')]['id']){delete _0x2704b4[_0x5292('0x52')]['id'];}return db[_0x5292('0x48')][_0x5292('0x50')]({'where':{'id':_0x2704b4[_0x5292('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37ba57,null))[_0x5292('0x2a')](saveUpdates(_0x2704b4[_0x5292('0x52')],null))[_0x5292('0x2a')](respondWithResult(_0x37ba57,null))[_0x5292('0x4c')](handleError(_0x37ba57,null));};exports['destroy']=function(_0x29bf44,_0x120af4){return db[_0x5292('0x48')][_0x5292('0x50')]({'where':{'id':_0x29bf44[_0x5292('0x4e')]['id']}})[_0x5292('0x2a')](handleEntityNotFound(_0x120af4,null))['then'](removeEntity(_0x120af4,null))[_0x5292('0x4c')](handleError(_0x120af4,null));};exports[_0x5292('0x5a')]=function(_0x2ab638,_0x1eb670){return db[_0x5292('0x48')]['describe']()['then'](respondWithResult(_0x1eb670,null))['catch'](handleError(_0x1eb670,null));};exports['getMembers']=function(_0x37a001,_0xe43e8b,_0x3adcbc){var _0x5ce94={'raw':!![],'where':{}},_0x507192={},_0x461b64;return db['WhatsappQueue'][_0x5292('0x5b')]({'where':{'id':_0x37a001['params']['id']}})[_0x5292('0x2a')](handleEntityNotFound(_0xe43e8b,null))[_0x5292('0x2a')](function(_0x1ce9cb){if(_0x1ce9cb){_0x461b64=_0x1ce9cb[_0x5292('0x2c')]({'plain':!![]});_0x507192[_0x5292('0x38')]=_[_0x5292('0x4f')](db['UserWhatsappQueue'][_0x5292('0x34')]);_0x507192[_0x5292('0x39')]=_[_0x5292('0x4f')](_0x37a001[_0x5292('0x39')]);_0x507192[_0x5292('0x3a')]=_[_0x5292('0x3b')](_0x507192[_0x5292('0x38')],_0x507192[_0x5292('0x39')]);_0x5ce94[_0x5292('0x3c')]=_[_0x5292('0x3b')](_0x507192[_0x5292('0x38')],qs[_0x5292('0x3d')](_0x37a001[_0x5292('0x39')]['fields']));_0x5ce94['attributes']=_0x5ce94[_0x5292('0x3c')][_0x5292('0x3e')]?_0x5ce94[_0x5292('0x3c')]:_0x507192['model'];if(!_0x37a001['query'][_0x5292('0x3f')](_0x5292('0x40'))){_0x5ce94[_0x5292('0x23')]=qs[_0x5292('0x23')](_0x37a001['query'][_0x5292('0x23')]);_0x5ce94[_0x5292('0x21')]=qs[_0x5292('0x21')](_0x37a001['query']['offset']);}_0x5ce94[_0x5292('0x41')]=qs[_0x5292('0x42')](_0x37a001[_0x5292('0x39')]['sort']);_0x5ce94[_0x5292('0x43')]=qs[_0x5292('0x3a')](_[_0x5292('0x5c')](_0x37a001['query'],_0x507192[_0x5292('0x3a')]));_0x5ce94['where'][_0x5292('0x5d')]=_0x1ce9cb['id'];if(_0x37a001['query']['filter']){_0x5ce94[_0x5292('0x43')]=_['merge'](_0x5ce94[_0x5292('0x43')],{'$or':_[_0x5292('0x33')](_0x5ce94['attributes'],function(_0x3daa70){var _0x148a3e={};_0x148a3e[_0x3daa70]={'$like':'%'+_0x37a001['query']['filter']+'%'};return _0x148a3e;})});}_0x5ce94=_[_0x5292('0x45')]({},_0x5ce94,_0x37a001[_0x5292('0x47')]);return db['UserWhatsappQueue'][_0x5292('0x5e')](_0x5ce94);}})[_0x5292('0x2a')](function(_0x1842e1){if(_0x1842e1){return db[_0x5292('0x5f')][_0x5292('0x60')]({'where':{'id':_['map'](_0x1842e1,'UserId'),'role':'agent'},'attributes':['id',_0x5292('0x30'),'whatsappPause',_0x5292('0x61'),'createdAt']});}})[_0x5292('0x2a')](function(_0x41940a){if(_0x41940a){return{'count':_0x41940a[_0x5292('0x24')],'rows':_[_0x5292('0x33')](_0x41940a[_0x5292('0x4b')],function(_0x1abd90){return{'membername':_0x1abd90[_0x5292('0x30')],'UserId':_0x1abd90['id'],'queue_name':_0x461b64[_0x5292('0x30')],'WhatsappQueueId':_0x461b64['id'],'interface':util[_0x5292('0x62')](_0x5292('0x63'),_0x5292('0x64'),_0x1abd90[_0x5292('0x30')]),'penalty':0x0,'paused':_0x1abd90[_0x5292('0x65')],'createdAt':_0x1abd90[_0x5292('0x66')],'updatedAt':_0x1abd90['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe43e8b,_0x5ce94))[_0x5292('0x4c')](handleError(_0xe43e8b,null));};exports['getTeams']=function(_0x119983,_0x516261,_0x588735){var _0x257ef2={};var _0x43a7e9={};var _0x1b516e;var _0x57d311;return db[_0x5292('0x48')][_0x5292('0x5b')]({'where':{'id':_0x119983[_0x5292('0x4e')]['id']}})[_0x5292('0x2a')](handleEntityNotFound(_0x516261,null))[_0x5292('0x2a')](function(_0x27cdc0){if(_0x27cdc0){_0x1b516e=_0x27cdc0;_0x43a7e9[_0x5292('0x38')]=_[_0x5292('0x4f')](db[_0x5292('0x67')][_0x5292('0x34')]);_0x43a7e9['query']=_[_0x5292('0x4f')](_0x119983[_0x5292('0x39')]);_0x43a7e9[_0x5292('0x3a')]=_[_0x5292('0x3b')](_0x43a7e9['model'],_0x43a7e9[_0x5292('0x39')]);_0x257ef2[_0x5292('0x3c')]=_[_0x5292('0x3b')](_0x43a7e9[_0x5292('0x38')],qs[_0x5292('0x3d')](_0x119983[_0x5292('0x39')][_0x5292('0x3d')]));_0x257ef2[_0x5292('0x3c')]=_0x257ef2['attributes'][_0x5292('0x3e')]?_0x257ef2[_0x5292('0x3c')]:_0x43a7e9[_0x5292('0x38')];_0x257ef2[_0x5292('0x41')]=qs[_0x5292('0x42')](_0x119983['query'][_0x5292('0x42')]);_0x257ef2[_0x5292('0x43')]=qs[_0x5292('0x3a')](_['pick'](_0x119983[_0x5292('0x39')],_0x43a7e9[_0x5292('0x3a')]));if(_0x119983['query'][_0x5292('0x44')]){_0x257ef2['where']=_['merge'](_0x257ef2[_0x5292('0x43')],{'$or':_['map'](_0x257ef2[_0x5292('0x3c')],function(_0x5089ad){var _0x1f29c8={};_0x1f29c8[_0x5089ad]={'$like':'%'+_0x119983['query'][_0x5292('0x44')]+'%'};return _0x1f29c8;})});}_0x257ef2=_[_0x5292('0x45')]({},_0x257ef2,_0x119983[_0x5292('0x47')]);return _0x1b516e['getTeams'](_0x257ef2);}})[_0x5292('0x2a')](function(_0xd19ecf){if(_0xd19ecf){_0x57d311=_0xd19ecf[_0x5292('0x3e')];if(!_0x119983[_0x5292('0x39')][_0x5292('0x3f')](_0x5292('0x40'))){_0x257ef2[_0x5292('0x23')]=qs['limit'](_0x119983[_0x5292('0x39')][_0x5292('0x23')]);_0x257ef2[_0x5292('0x21')]=qs[_0x5292('0x21')](_0x119983['query'][_0x5292('0x21')]);}return _0x1b516e[_0x5292('0x68')](_0x257ef2);}})[_0x5292('0x2a')](function(_0x5b61e9){if(_0x5b61e9){return _0x5b61e9?{'count':_0x57d311,'rows':_0x5b61e9}:null;}})[_0x5292('0x2a')](respondWithResult(_0x516261,null))[_0x5292('0x4c')](handleError(_0x516261,null));};exports[_0x5292('0x69')]=function(_0x2c1720,_0x5f1c91,_0x1de867){var _0x5ce4b7=_0x2c1720[_0x5292('0x52')][_0x5292('0x6a')];return db[_0x5292('0x67')][_0x5292('0x5e')]({'where':{'id':_0x5ce4b7},'attributes':['id'],'include':[{'model':db[_0x5292('0x5f')],'as':_0x5292('0x6b'),'attributes':['id','name',_0x5292('0x6c'),_0x5292('0x6d'),_0x5292('0x6e')],'raw':!![]}]})[_0x5292('0x2a')](function(_0x46dcf3){if(_0x46dcf3){var _0x386a70=_[_0x5292('0x6f')](_0x46dcf3,function(_0x5d5599){var _0x3ee59b=_0x5d5599[_0x5292('0x2c')]({'plain':!![]});return _0x3ee59b['Agents'];});return db[_0x5292('0x48')][_0x5292('0x50')]({'where':{'id':_0x2c1720['params']['id']}})[_0x5292('0x2a')](function(_0x35e857){return db[_0x5292('0x70')][_0x5292('0x71')](function(_0x510253){return _0x35e857[_0x5292('0x69')](_0x5ce4b7,{'transaction':_0x510253})['then'](function(){return BPromise['each'](_0x386a70,function(_0x3965f0){return db['UserWhatsappQueue'][_0x5292('0x72')]({'where':{'UserId':_0x3965f0['id'],'WhatsappQueueId':_0x2c1720['params']['id']},'transaction':_0x510253});});})[_0x5292('0x2a')](function(){_0x386a70[_0x5292('0x73')](function(_0xbc866c){socket[_0x5292('0x74')](_0x5292('0x75'),{'UserId':_0xbc866c['id'],'WhatsappQueueId':_0x35e857['id']});});});});});}})[_0x5292('0x2a')](respondWithStatusCode(_0x5f1c91,null))[_0x5292('0x4c')](handleError(_0x5f1c91,null));};exports[_0x5292('0x76')]=function(_0x5b8541,_0x884dd8,_0x22c98e){return db[_0x5292('0x67')][_0x5292('0x5e')]({'where':{'id':_0x5b8541[_0x5292('0x39')][_0x5292('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x5292('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5292('0x2a')](handleEntityNotFound(_0x884dd8,null))[_0x5292('0x2a')](function(_0x745407){var _0x58ad80=_[_0x5292('0x33')](_0x745407,'id');var _0x1e1e76=[];var _0x24c68c=[];var _0xc02e54=squel[_0x5292('0x77')]();_0xc02e54[_0x5292('0x78')](_0x5292('0x79'))['from'](_0x5292('0x7a'),'tq')[_0x5292('0x7b')](_0x5292('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x5292('0x7d'),_0x5b8541[_0x5292('0x4e')]['id']);for(var _0x4b2197=0x0;_0x4b2197<_0x745407[_0x5292('0x3e')];_0x4b2197+=0x1){let _0x5bc96a=_0x745407[_0x4b2197];for(var _0xc26ca2=0x0;_0xc26ca2<_0x5bc96a[_0x5292('0x6b')][_0x5292('0x3e')];_0xc26ca2+=0x1){let _0x119dd5=_0x5bc96a[_0x5292('0x6b')][_0xc26ca2];var _0x58abab=_0xc02e54['clone']();_0x58abab[_0x5292('0x43')]('ut.UserId\x20=\x20?',_0x119dd5['id']);_0x24c68c[_0x5292('0x7e')](db[_0x5292('0x70')][_0x5292('0x39')](_0x58abab[_0x5292('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x5292('0x80')]})['then'](function(_0x402676){if(_0x402676[_0x5292('0x3e')]===0x1){return _0x119dd5['id'];}else{var _0x409911=_[_0x5292('0x81')](_[_0x5292('0x33')](_0x402676,'TeamId'),function(_0x3cde0f){return _[_0x5292('0x82')](_0x58ad80,_0x3cde0f);});if(_0x409911){return _0x119dd5['id'];}}}));}}return BPromise[_0x5292('0x83')](_0x24c68c)[_0x5292('0x2a')](function(_0x1980b2){_0x1e1e76=_(_0x1e1e76)[_0x5292('0x84')](_0x1980b2)[_0x5292('0x85')]()['value']();return db[_0x5292('0x48')][_0x5292('0x50')]({'where':{'id':_0x5b8541['params']['id']}})['then'](function(_0x2b630e){return db['sequelize']['transaction'](function(_0x22c20b){return _0x2b630e[_0x5292('0x76')](_0x5b8541[_0x5292('0x39')]['ids'],{'transaction':_0x22c20b})[_0x5292('0x2a')](function(){if(!_[_0x5292('0x86')](_0x1e1e76)){return _0x2b630e[_0x5292('0x87')](_0x1e1e76,{'transaction':_0x22c20b});}})[_0x5292('0x2a')](function(){_0x1e1e76[_0x5292('0x73')](function(_0x2ac9c7){socket[_0x5292('0x74')](_0x5292('0x88'),{'UserId':_0x2ac9c7,'WhatsappQueueId':_0x2b630e['id']});});});});});});})['then'](respondWithStatusCode(_0x884dd8,null))[_0x5292('0x4c')](handleError(_0x884dd8,null));};exports['addAgents']=function(_0x486192,_0xd5aef5,_0x58d6f1){return db[_0x5292('0x48')][_0x5292('0x50')]({'where':{'id':_0x486192[_0x5292('0x4e')]['id']}})[_0x5292('0x2a')](handleEntityNotFound(_0xd5aef5,null))['then'](function(_0x2e2e44){if(_0x2e2e44){return _0x2e2e44['addAgents'](_0x486192[_0x5292('0x52')][_0x5292('0x6a')],_['omit'](_0x486192[_0x5292('0x52')],[_0x5292('0x6a'),'id'])||{})[_0x5292('0x89')](function(_0x259b7c){for(var _0x5f4580=0x0;_0x5f4580<_0x486192[_0x5292('0x52')][_0x5292('0x6a')][_0x5292('0x3e')];_0x5f4580+=0x1){socket[_0x5292('0x74')](_0x5292('0x75'),{'UserId':Number(_0x486192['body'][_0x5292('0x6a')][_0x5f4580]),'WhatsappQueueId':Number(_0x486192[_0x5292('0x4e')]['id'])});}return _0x259b7c;});}})[_0x5292('0x2a')](respondWithResult(_0xd5aef5,null))[_0x5292('0x4c')](handleError(_0xd5aef5,null));};exports[_0x5292('0x87')]=function(_0x4f8b28,_0x39e862,_0x174bb1){return db[_0x5292('0x48')][_0x5292('0x50')]({'where':{'id':_0x4f8b28[_0x5292('0x4e')]['id']}})[_0x5292('0x2a')](handleEntityNotFound(_0x39e862,null))[_0x5292('0x2a')](function(_0x3096db){if(_0x3096db){return _0x3096db[_0x5292('0x87')](_0x4f8b28[_0x5292('0x39')][_0x5292('0x6a')])[_0x5292('0x2a')](function(){if(_[_0x5292('0x8a')](_0x4f8b28[_0x5292('0x39')][_0x5292('0x6a')])){for(var _0x3f7e7a=0x0;_0x3f7e7a<_0x4f8b28[_0x5292('0x39')][_0x5292('0x6a')][_0x5292('0x3e')];_0x3f7e7a+=0x1){socket[_0x5292('0x74')](_0x5292('0x88'),{'UserId':Number(_0x4f8b28[_0x5292('0x39')][_0x5292('0x6a')][_0x3f7e7a]),'WhatsappQueueId':Number(_0x4f8b28['params']['id'])});}}else{socket[_0x5292('0x74')](_0x5292('0x88'),{'UserId':Number(_0x4f8b28[_0x5292('0x39')][_0x5292('0x6a')]),'WhatsappQueueId':Number(_0x4f8b28[_0x5292('0x4e')]['id'])});}});}})[_0x5292('0x2a')](respondWithStatusCode(_0x39e862,null))[_0x5292('0x4c')](handleError(_0x39e862,null));};exports[_0x5292('0x8b')]=function(_0x190068,_0x27e2cd,_0x1e2cf0){var _0x19a2d2={};var _0x5a21ed={};var _0x85d54c;var _0x240cbe;return db[_0x5292('0x48')]['findOne']({'where':{'id':_0x190068['params']['id']}})['then'](handleEntityNotFound(_0x27e2cd,null))[_0x5292('0x2a')](function(_0x2bb2e7){if(_0x2bb2e7){_0x85d54c=_0x2bb2e7;_0x5a21ed['model']=_[_0x5292('0x4f')](db[_0x5292('0x5f')]['rawAttributes']);_0x5a21ed[_0x5292('0x39')]=_['keys'](_0x190068[_0x5292('0x39')]);_0x5a21ed[_0x5292('0x3a')]=_[_0x5292('0x3b')](_0x5a21ed[_0x5292('0x38')],_0x5a21ed['query']);_0x19a2d2[_0x5292('0x3c')]=_[_0x5292('0x3b')](_0x5a21ed[_0x5292('0x38')],qs[_0x5292('0x3d')](_0x190068['query'][_0x5292('0x3d')]));_0x19a2d2[_0x5292('0x3c')]=_0x19a2d2['attributes'][_0x5292('0x3e')]?_0x19a2d2[_0x5292('0x3c')]:_0x5a21ed[_0x5292('0x38')];_0x19a2d2[_0x5292('0x41')]=qs[_0x5292('0x42')](_0x190068['query'][_0x5292('0x42')]);_0x19a2d2['where']=qs[_0x5292('0x3a')](_[_0x5292('0x5c')](_0x190068[_0x5292('0x39')],_0x5a21ed[_0x5292('0x3a')]));if(_0x190068[_0x5292('0x39')][_0x5292('0x44')]){_0x19a2d2['where']=_[_0x5292('0x45')](_0x19a2d2['where'],{'$or':_['map'](_0x19a2d2['attributes'],function(_0x3992f8){var _0x1723ac={};_0x1723ac[_0x3992f8]={'$like':'%'+_0x190068['query'][_0x5292('0x44')]+'%'};return _0x1723ac;})});}_0x19a2d2=_[_0x5292('0x45')]({},_0x19a2d2,_0x190068[_0x5292('0x47')]);return _0x85d54c[_0x5292('0x8b')](_0x19a2d2);}})[_0x5292('0x2a')](function(_0x2ac9fa){if(_0x2ac9fa){_0x240cbe=_0x2ac9fa['length'];if(!_0x190068[_0x5292('0x39')][_0x5292('0x3f')](_0x5292('0x40'))){_0x19a2d2[_0x5292('0x23')]=qs[_0x5292('0x23')](_0x190068[_0x5292('0x39')]['limit']);_0x19a2d2[_0x5292('0x21')]=qs['offset'](_0x190068[_0x5292('0x39')][_0x5292('0x21')]);}return _0x85d54c[_0x5292('0x8b')](_0x19a2d2);}})[_0x5292('0x2a')](function(_0xec9a25){if(_0xec9a25){return _0xec9a25?{'count':_0x240cbe,'rows':_0xec9a25}:null;}})['then'](respondWithResult(_0x27e2cd,null))[_0x5292('0x4c')](handleError(_0x27e2cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b43b31f..f52d8a5 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 _0xc4c6=['events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0xc4c6,0x104));var _0x6c4c=function(_0x4054b1,_0x565f95){_0x4054b1=_0x4054b1-0x0;var _0x108764=_0xc4c6[_0x4054b1];return _0x108764;};'use strict';var EventEmitter=require(_0x6c4c('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6c4c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6c4c('0x2')](0x0);var events={'afterCreate':_0x6c4c('0x3'),'afterUpdate':_0x6c4c('0x4'),'afterDestroy':_0x6c4c('0x5')};function emitEvent(_0x10cad7){return function(_0x1da53d,_0x2ec29b,_0xa36d46){WhatsappQueueEvents[_0x6c4c('0x6')](_0x10cad7+':'+_0x1da53d['id'],_0x1da53d);WhatsappQueueEvents[_0x6c4c('0x6')](_0x10cad7,_0x1da53d);_0xa36d46(null);};}for(var e in events){if(events[_0x6c4c('0x7')](e)){var event=events[e];WhatsappQueue[_0x6c4c('0x8')](e,emitEvent(event));}}module[_0x6c4c('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6639=['setMaxListeners','save','hook','exports','events','WhatsappQueue'];(function(_0x24e8f8,_0x4f3436){var _0x3f8852=function(_0xfa2c6d){while(--_0xfa2c6d){_0x24e8f8['push'](_0x24e8f8['shift']());}};_0x3f8852(++_0x4f3436);}(_0x6639,0xb8));var _0x9663=function(_0x2d73d7,_0x29e178){_0x2d73d7=_0x2d73d7-0x0;var _0x9fc822=_0x6639[_0x2d73d7];return _0x9fc822;};'use strict';var EventEmitter=require(_0x9663('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x9663('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9663('0x2')](0x0);var events={'afterCreate':_0x9663('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x53d8e4){return function(_0x57267b,_0x17ea0a,_0x289478){WhatsappQueueEvents['emit'](_0x53d8e4+':'+_0x57267b['id'],_0x57267b);WhatsappQueueEvents['emit'](_0x53d8e4,_0x57267b);_0x289478(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9663('0x4')](e,emitEvent(event));}}module[_0x9663('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2467a88..fe6c545 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 _0x4714=['moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api'];(function(_0x11a890,_0x59b390){var _0x220a4c=function(_0x2ada9e){while(--_0x2ada9e){_0x11a890['push'](_0x11a890['shift']());}};_0x220a4c(++_0x59b390);}(_0x4714,0xe7));var _0x4471=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4714[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4471('0x0'));var util=require(_0x4471('0x1'));var logger=require('../../config/logger')(_0x4471('0x2'));var moment=require(_0x4471('0x3'));var BPromise=require(_0x4471('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4471('0x5'));var rimraf=require(_0x4471('0x6'));var config=require(_0x4471('0x7'));var attributes=require(_0x4471('0x8'));module[_0x4471('0x9')]=function(_0x2e2fcd,_0x5c550a){return _0x2e2fcd[_0x4471('0xa')](_0x4471('0xb'),attributes,{'tableName':_0x4471('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe579=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x5828c0,_0x4cdc04){var _0x1adaff=function(_0x9f7626){while(--_0x9f7626){_0x5828c0['push'](_0x5828c0['shift']());}};_0x1adaff(++_0x4cdc04);}(_0xe579,0xc1));var _0x9e57=function(_0x11fab8,_0xffbbbd){_0x11fab8=_0x11fab8-0x0;var _0x5eb95f=_0xe579[_0x11fab8];return _0x5eb95f;};'use strict';var _=require(_0x9e57('0x0'));var util=require(_0x9e57('0x1'));var logger=require('../../config/logger')(_0x9e57('0x2'));var moment=require(_0x9e57('0x3'));var BPromise=require(_0x9e57('0x4'));var rp=require(_0x9e57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e57('0x6'));var config=require(_0x9e57('0x7'));var attributes=require(_0x9e57('0x8'));module[_0x9e57('0x9')]=function(_0x594cd6,_0x120a9d){return _0x594cd6[_0x9e57('0xa')](_0x9e57('0xb'),attributes,{'tableName':_0x9e57('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index ab86d70..69821a5 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 _0xb4ab=['attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','raw','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueue','findAll','options','where'];(function(_0x430352,_0x55b64a){var _0x2e6cca=function(_0x24ffeb){while(--_0x24ffeb){_0x430352['push'](_0x430352['shift']());}};_0x2e6cca(++_0x55b64a);}(_0xb4ab,0x11b));var _0xbb4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4ab[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xbb4a('0x0'));var moment=require(_0xbb4a('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb4a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb4a('0x3'))['db'];var utils=require(_0xbb4a('0x4'));var logger=require(_0xbb4a('0x5'))(_0xbb4a('0x6'));var config=require('../../config/environment');var jayson=require(_0xbb4a('0x7'));var client=jayson['client'][_0xbb4a('0x8')]({'port':0x232a});config[_0xbb4a('0x9')]=_['defaults'](config[_0xbb4a('0x9')],{'host':_0xbb4a('0xa'),'port':0x18eb});var socket=require(_0xbb4a('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xbb4a('0xc')](socket);function respondWithRpcPromise(_0x172499,_0x396b13,_0x496a7a){return new BPromise(function(_0x1bcaec,_0x252976){return client[_0xbb4a('0xd')](_0x172499,_0x496a7a)[_0xbb4a('0xe')](function(_0x144475){logger[_0xbb4a('0xf')](_0xbb4a('0x10'),_0x396b13,_0xbb4a('0x11'));logger[_0xbb4a('0x12')](_0xbb4a('0x13'),_0x396b13,_0xbb4a('0x11'),JSON['stringify'](_0x144475));if(_0x144475[_0xbb4a('0x14')]){if(_0x144475[_0xbb4a('0x14')][_0xbb4a('0x15')]===0x1f4){logger[_0xbb4a('0x14')](_0xbb4a('0x10'),_0x396b13,_0x144475[_0xbb4a('0x14')]['message']);return _0x252976(_0x144475[_0xbb4a('0x14')]['message']);}logger['error'](_0xbb4a('0x10'),_0x396b13,_0x144475[_0xbb4a('0x14')][_0xbb4a('0x16')]);return _0x1bcaec(_0x144475['error']['message']);}else{logger[_0xbb4a('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x396b13,_0xbb4a('0x11'));_0x1bcaec(_0x144475[_0xbb4a('0x17')][_0xbb4a('0x16')]);}})[_0xbb4a('0x18')](function(_0x5309ff){logger[_0xbb4a('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x396b13,_0x5309ff);_0x252976(_0x5309ff);});});}exports['GetWhatsappQueue']=function(_0x5173c9){var _0x4cb723=this;return new Promise(function(_0x3f4751,_0x25c527){return db[_0xbb4a('0x19')][_0xbb4a('0x1a')]({'raw':_0x5173c9['options']?_0x5173c9[_0xbb4a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5173c9[_0xbb4a('0x1b')]?_0x5173c9[_0xbb4a('0x1b')][_0xbb4a('0x1c')]||null:null,'attributes':_0x5173c9['options']?_0x5173c9['options'][_0xbb4a('0x1d')]||null:null,'limit':_0x5173c9[_0xbb4a('0x1b')]?_0x5173c9[_0xbb4a('0x1b')][_0xbb4a('0x1e')]||null:null,'include':_0x5173c9[_0xbb4a('0x1b')]?_0x5173c9['options'][_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x5173c9[_0xbb4a('0x1b')][_0xbb4a('0x1f')],function(_0x246628){return{'model':db[_0x246628[_0xbb4a('0x21')]],'as':_0x246628['as'],'attributes':_0x246628[_0xbb4a('0x1d')],'include':_0x246628[_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x246628[_0xbb4a('0x1f')],function(_0x5e7afb){return{'model':db[_0x5e7afb[_0xbb4a('0x21')]],'as':_0x5e7afb['as'],'attributes':_0x5e7afb['attributes'],'include':_0x5e7afb[_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x5e7afb[_0xbb4a('0x1f')],function(_0x2ed205){return{'model':db[_0x2ed205[_0xbb4a('0x21')]],'as':_0x2ed205['as'],'attributes':_0x2ed205[_0xbb4a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c34df){logger[_0xbb4a('0xf')](_0xbb4a('0x22'),_0x5173c9);logger[_0xbb4a('0x12')](_0xbb4a('0x22'),_0x5173c9,JSON[_0xbb4a('0x23')](_0x1c34df));_0x3f4751(_0x1c34df);})[_0xbb4a('0x18')](function(_0x310fe4){logger[_0xbb4a('0x14')]('GetWhatsappQueue',_0x310fe4[_0xbb4a('0x16')],_0x5173c9);_0x25c527(_0x4cb723[_0xbb4a('0x14')](0x1f4,_0x310fe4[_0xbb4a('0x16')]));});});};exports[_0xbb4a('0x24')]=function(_0x3e4a2c){var _0x3f06bf=this;return new Promise(function(_0x16eb25,_0xa01ac0){return db[_0xbb4a('0x19')][_0xbb4a('0x25')]({'raw':_0x3e4a2c[_0xbb4a('0x1b')]?_0x3e4a2c[_0xbb4a('0x1b')][_0xbb4a('0x26')]===undefined?!![]:![]:!![],'where':_0x3e4a2c[_0xbb4a('0x1b')]?_0x3e4a2c[_0xbb4a('0x1b')][_0xbb4a('0x1c')]||null:null,'attributes':_0x3e4a2c[_0xbb4a('0x1b')]?_0x3e4a2c['options'][_0xbb4a('0x1d')]||null:null,'include':_0x3e4a2c['options']?_0x3e4a2c[_0xbb4a('0x1b')][_0xbb4a('0x1f')]?_[_0xbb4a('0x20')](_0x3e4a2c[_0xbb4a('0x1b')]['include'],function(_0x56162d){return{'model':db[_0x56162d[_0xbb4a('0x21')]],'as':_0x56162d['as'],'attributes':_0x56162d[_0xbb4a('0x1d')],'include':_0x56162d[_0xbb4a('0x1f')]?_['map'](_0x56162d[_0xbb4a('0x1f')],function(_0x55285b){return{'model':db[_0x55285b[_0xbb4a('0x21')]],'as':_0x55285b['as'],'attributes':_0x55285b[_0xbb4a('0x1d')],'include':_0x55285b[_0xbb4a('0x1f')]?_['map'](_0x55285b[_0xbb4a('0x1f')],function(_0x18c7da){return{'model':db[_0x18c7da[_0xbb4a('0x21')]],'as':_0x18c7da['as'],'attributes':_0x18c7da[_0xbb4a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbb4a('0xe')](function(_0x4cf9d3){logger['info']('ShowWhatsappQueue',_0x3e4a2c);logger[_0xbb4a('0x12')](_0xbb4a('0x24'),_0x3e4a2c,JSON['stringify'](_0x4cf9d3));_0x16eb25(_0x4cf9d3);})[_0xbb4a('0x18')](function(_0x1dc714){logger[_0xbb4a('0x14')](_0xbb4a('0x24'),_0x1dc714[_0xbb4a('0x16')],_0x3e4a2c);_0xa01ac0(_0x3f06bf['error'](0x1f4,_0x1dc714[_0xbb4a('0x16')]));});});}; \ No newline at end of file +var _0x5d01=['code','message','request\x20sent','GetWhatsappQueue','findAll','options','where','map','include','model','attributes','stringify','catch','find','raw','then','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x3c5f3d,_0x575b32){var _0x4d29b7=function(_0x5da305){while(--_0x5da305){_0x3c5f3d['push'](_0x3c5f3d['shift']());}};_0x4d29b7(++_0x575b32);}(_0x5d01,0xf5));var _0x15d0=function(_0x484c1b,_0x1ce1a){_0x484c1b=_0x484c1b-0x0;var _0x55a365=_0x5d01[_0x484c1b];return _0x55a365;};'use strict';var _=require(_0x15d0('0x0'));var util=require(_0x15d0('0x1'));var moment=require('moment');var BPromise=require(_0x15d0('0x2'));var rs=require(_0x15d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15d0('0x4'))['db'];var utils=require(_0x15d0('0x5'));var logger=require(_0x15d0('0x6'))(_0x15d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x15d0('0x8'));var client=jayson['client'][_0x15d0('0x9')]({'port':0x232a});config['redis']=_[_0x15d0('0xa')](config[_0x15d0('0xb')],{'host':_0x15d0('0xc'),'port':0x18eb});var socket=require(_0x15d0('0xd'))(new Redis(config['redis']));require(_0x15d0('0xe'))[_0x15d0('0xf')](socket);function respondWithRpcPromise(_0x484b96,_0x336cdb,_0xd5568f){return new BPromise(function(_0x3bdb5c,_0x45636b){return client['request'](_0x484b96,_0xd5568f)['then'](function(_0x8264af){logger[_0x15d0('0x10')](_0x15d0('0x11'),_0x336cdb,'request\x20sent');logger[_0x15d0('0x12')](_0x15d0('0x13'),_0x336cdb,'request\x20sent',JSON['stringify'](_0x8264af));if(_0x8264af[_0x15d0('0x14')]){if(_0x8264af[_0x15d0('0x14')][_0x15d0('0x15')]===0x1f4){logger[_0x15d0('0x14')](_0x15d0('0x11'),_0x336cdb,_0x8264af[_0x15d0('0x14')][_0x15d0('0x16')]);return _0x45636b(_0x8264af[_0x15d0('0x14')][_0x15d0('0x16')]);}logger[_0x15d0('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x336cdb,_0x8264af['error'][_0x15d0('0x16')]);return _0x3bdb5c(_0x8264af['error'][_0x15d0('0x16')]);}else{logger[_0x15d0('0x10')](_0x15d0('0x11'),_0x336cdb,_0x15d0('0x17'));_0x3bdb5c(_0x8264af['result'][_0x15d0('0x16')]);}})['catch'](function(_0x17205e){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x336cdb,_0x17205e);_0x45636b(_0x17205e);});});}exports[_0x15d0('0x18')]=function(_0x541d4f){var _0x59c8c6=this;return new Promise(function(_0x35e679,_0x99d964){return db['WhatsappQueue'][_0x15d0('0x19')]({'raw':_0x541d4f[_0x15d0('0x1a')]?_0x541d4f['options']['raw']===undefined?!![]:![]:!![],'where':_0x541d4f['options']?_0x541d4f['options'][_0x15d0('0x1b')]||null:null,'attributes':_0x541d4f[_0x15d0('0x1a')]?_0x541d4f[_0x15d0('0x1a')]['attributes']||null:null,'limit':_0x541d4f['options']?_0x541d4f[_0x15d0('0x1a')]['limit']||null:null,'include':_0x541d4f[_0x15d0('0x1a')]?_0x541d4f[_0x15d0('0x1a')]['include']?_[_0x15d0('0x1c')](_0x541d4f[_0x15d0('0x1a')][_0x15d0('0x1d')],function(_0x28f885){return{'model':db[_0x28f885[_0x15d0('0x1e')]],'as':_0x28f885['as'],'attributes':_0x28f885[_0x15d0('0x1f')],'include':_0x28f885[_0x15d0('0x1d')]?_[_0x15d0('0x1c')](_0x28f885[_0x15d0('0x1d')],function(_0x42e990){return{'model':db[_0x42e990[_0x15d0('0x1e')]],'as':_0x42e990['as'],'attributes':_0x42e990['attributes'],'include':_0x42e990[_0x15d0('0x1d')]?_['map'](_0x42e990[_0x15d0('0x1d')],function(_0x14fbdf){return{'model':db[_0x14fbdf[_0x15d0('0x1e')]],'as':_0x14fbdf['as'],'attributes':_0x14fbdf[_0x15d0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d65e4){logger[_0x15d0('0x10')](_0x15d0('0x18'),_0x541d4f);logger[_0x15d0('0x12')]('GetWhatsappQueue',_0x541d4f,JSON[_0x15d0('0x20')](_0x2d65e4));_0x35e679(_0x2d65e4);})[_0x15d0('0x21')](function(_0x53cb9a){logger[_0x15d0('0x14')](_0x15d0('0x18'),_0x53cb9a['message'],_0x541d4f);_0x99d964(_0x59c8c6[_0x15d0('0x14')](0x1f4,_0x53cb9a[_0x15d0('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x2a3dc4){var _0x5bde85=this;return new Promise(function(_0x2ad2fe,_0x4b956f){return db['WhatsappQueue'][_0x15d0('0x22')]({'raw':_0x2a3dc4[_0x15d0('0x1a')]?_0x2a3dc4['options'][_0x15d0('0x23')]===undefined?!![]:![]:!![],'where':_0x2a3dc4[_0x15d0('0x1a')]?_0x2a3dc4['options'][_0x15d0('0x1b')]||null:null,'attributes':_0x2a3dc4[_0x15d0('0x1a')]?_0x2a3dc4[_0x15d0('0x1a')][_0x15d0('0x1f')]||null:null,'include':_0x2a3dc4[_0x15d0('0x1a')]?_0x2a3dc4[_0x15d0('0x1a')][_0x15d0('0x1d')]?_[_0x15d0('0x1c')](_0x2a3dc4['options'][_0x15d0('0x1d')],function(_0x93859b){return{'model':db[_0x93859b[_0x15d0('0x1e')]],'as':_0x93859b['as'],'attributes':_0x93859b[_0x15d0('0x1f')],'include':_0x93859b[_0x15d0('0x1d')]?_['map'](_0x93859b[_0x15d0('0x1d')],function(_0x4b1d21){return{'model':db[_0x4b1d21[_0x15d0('0x1e')]],'as':_0x4b1d21['as'],'attributes':_0x4b1d21[_0x15d0('0x1f')],'include':_0x4b1d21[_0x15d0('0x1d')]?_['map'](_0x4b1d21[_0x15d0('0x1d')],function(_0x22f24c){return{'model':db[_0x22f24c[_0x15d0('0x1e')]],'as':_0x22f24c['as'],'attributes':_0x22f24c['attributes']};}):[]};}):[]};}):[]:[]})[_0x15d0('0x24')](function(_0x486e34){logger['info'](_0x15d0('0x25'),_0x2a3dc4);logger[_0x15d0('0x12')]('ShowWhatsappQueue',_0x2a3dc4,JSON[_0x15d0('0x20')](_0x486e34));_0x2ad2fe(_0x486e34);})[_0x15d0('0x21')](function(_0xb807eb){logger['error'](_0x15d0('0x25'),_0xb807eb[_0x15d0('0x16')],_0x2a3dc4);_0x4b956f(_0x5bde85[_0x15d0('0x14')](0x1f4,_0xb807eb[_0x15d0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a633e0e..b9aaf29 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 _0x8ad5=['register','length','whatsappQueue:','save','remove','emit','removeListener'];(function(_0x21b2b7,_0x1159a6){var _0xba015c=function(_0x1870c5){while(--_0x1870c5){_0x21b2b7['push'](_0x21b2b7['shift']());}};_0xba015c(++_0x1159a6);}(_0x8ad5,0x1d1));var _0x58ad=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8ad5[_0x1ac595];return _0x455fff;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x58ad('0x0'),_0x58ad('0x1'),'update'];function createListener(_0x48ca52,_0x537662){return function(_0x4d71ea){_0x537662[_0x58ad('0x2')](_0x48ca52,_0x4d71ea);};}function removeListener(_0x1d94fd,_0x2f7aec){return function(){WhatsappQueueEvents[_0x58ad('0x3')](_0x1d94fd,_0x2f7aec);};}exports[_0x58ad('0x4')]=function(_0x1a389e){for(var _0x4ff25d=0x0,_0x481a4e=events[_0x58ad('0x5')];_0x4ff25d<_0x481a4e;_0x4ff25d++){var _0x305466=events[_0x4ff25d];var _0x1073b3=createListener(_0x58ad('0x6')+_0x305466,_0x1a389e);WhatsappQueueEvents['on'](_0x305466,_0x1073b3);}}; \ No newline at end of file +var _0x9c11=['removeListener','register','whatsappQueue:','save','update','emit'];(function(_0x4ea889,_0x9d9cfb){var _0x27adc3=function(_0x1d03b2){while(--_0x1d03b2){_0x4ea889['push'](_0x4ea889['shift']());}};_0x27adc3(++_0x9d9cfb);}(_0x9c11,0x1ef));var _0x19c1=function(_0x28851,_0x1903df){_0x28851=_0x28851-0x0;var _0x27fd2d=_0x9c11[_0x28851];return _0x27fd2d;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x19c1('0x0'),'remove',_0x19c1('0x1')];function createListener(_0x5e077f,_0x307c7a){return function(_0x2aa8de){_0x307c7a[_0x19c1('0x2')](_0x5e077f,_0x2aa8de);};}function removeListener(_0x1efb39,_0x3a5437){return function(){WhatsappQueueEvents[_0x19c1('0x3')](_0x1efb39,_0x3a5437);};}exports[_0x19c1('0x4')]=function(_0x492fbe){for(var _0x875030=0x0,_0xb269ed=events['length'];_0x875030<_0xb269ed;_0x875030++){var _0x4ce61b=events[_0x875030];var _0x477b13=createListener(_0x19c1('0x5')+_0x4ce61b,_0x492fbe);WhatsappQueueEvents['on'](_0x4ce61b,_0x477b13);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 499ffbd..9554724 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 _0xda2a=['post','create','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x55922f,_0x5b79f4){var _0x530f8a=function(_0x3476fd){while(--_0x3476fd){_0x55922f['push'](_0x55922f['shift']());}};_0x530f8a(++_0x5b79f4);}(_0xda2a,0xb9));var _0xada2=function(_0x321bd2,_0x2b9488){_0x321bd2=_0x321bd2-0x0;var _0x480262=_0xda2a[_0x321bd2];return _0x480262;};'use strict';var multer=require(_0xada2('0x0'));var util=require('util');var path=require(_0xada2('0x1'));var timeout=require(_0xada2('0x2'));var express=require(_0xada2('0x3'));var router=express[_0xada2('0x4')]();var fs_extra=require(_0xada2('0x5'));var auth=require(_0xada2('0x6'));var interaction=require(_0xada2('0x7'));var config=require(_0xada2('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0xada2('0x9')]('/',auth[_0xada2('0xa')](),controller[_0xada2('0xb')]);router[_0xada2('0x9')](_0xada2('0xc'),auth[_0xada2('0xa')](),controller[_0xada2('0xd')]);router[_0xada2('0x9')]('/:id',auth[_0xada2('0xa')](),controller[_0xada2('0xe')]);router[_0xada2('0xf')]('/',auth[_0xada2('0xa')](),controller[_0xada2('0x10')]);router['put']('/:id',auth[_0xada2('0xa')](),controller['update']);router[_0xada2('0x11')](_0xada2('0x12'),auth[_0xada2('0xa')](),controller['destroy']);module[_0xada2('0x13')]=router; \ No newline at end of file +var _0xcbb5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3a3b3a,_0x1fb59b){var _0x5df2c8=function(_0x1cb9e6){while(--_0x1cb9e6){_0x3a3b3a['push'](_0x3a3b3a['shift']());}};_0x5df2c8(++_0x1fb59b);}(_0xcbb5,0x141));var _0x5cbb=function(_0x46444c,_0x157f8f){_0x46444c=_0x46444c-0x0;var _0x35926b=_0xcbb5[_0x46444c];return _0x35926b;};'use strict';var multer=require(_0x5cbb('0x0'));var util=require('util');var path=require(_0x5cbb('0x1'));var timeout=require('connect-timeout');var express=require(_0x5cbb('0x2'));var router=express[_0x5cbb('0x3')]();var fs_extra=require(_0x5cbb('0x4'));var auth=require(_0x5cbb('0x5'));var interaction=require(_0x5cbb('0x6'));var config=require(_0x5cbb('0x7'));var controller=require(_0x5cbb('0x8'));router[_0x5cbb('0x9')]('/',auth[_0x5cbb('0xa')](),controller[_0x5cbb('0xb')]);router[_0x5cbb('0x9')](_0x5cbb('0xc'),auth[_0x5cbb('0xa')](),controller[_0x5cbb('0xd')]);router[_0x5cbb('0x9')](_0x5cbb('0xe'),auth[_0x5cbb('0xa')](),controller[_0x5cbb('0xf')]);router[_0x5cbb('0x10')]('/',auth[_0x5cbb('0xa')](),controller[_0x5cbb('0x11')]);router[_0x5cbb('0x12')](_0x5cbb('0xe'),auth['isAuthenticated'](),controller[_0x5cbb('0x13')]);router[_0x5cbb('0x14')](_0x5cbb('0xe'),auth[_0x5cbb('0xa')](),controller[_0x5cbb('0x15')]);module[_0x5cbb('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b32cc19..ac6634e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4c05ee,_0x13f5a6){var _0x219c53=function(_0x69ff35){while(--_0x69ff35){_0x4c05ee['push'](_0x4c05ee['shift']());}};_0x219c53(++_0x13f5a6);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x55096c,_0x4edd3b){var _0x46e012=function(_0x2eb056){while(--_0x2eb056){_0x55096c['push'](_0x55096c['shift']());}};_0x46e012(++_0x4edd3b);}(_0x7a54,0x106));var _0x47a5=function(_0x4ef6b3,_0x42687c){_0x4ef6b3=_0x4ef6b3-0x0;var _0x499ff1=_0x7a54[_0x4ef6b3];return _0x499ff1;};'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 15b6ca8..92d33dc 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 _0x7072=['moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','map','query','keys','filters','intersection','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','attributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7072,0x138));var _0x2707=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7072[_0x15c421];return _0x5e5ed5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x3f6976,_0x171add){return function(_0x2ad386){if(!_0x2ad386){_0x3f6976[_0x2707('0x1a')](0x194);}return _0x2ad386;};}function handleError(_0x528b20,_0x2dce16){_0x2dce16=_0x2dce16||0x1f4;return function(_0x4ca05d){logger[_0x2707('0x2a')](_0x4ca05d[_0x2707('0x2b')]);if(_0x4ca05d[_0x2707('0x2c')]){delete _0x4ca05d['name'];}_0x528b20[_0x2707('0x1c')](_0x2dce16)[_0x2707('0x2d')](_0x4ca05d);};}exports[_0x2707('0x2e')]=function(_0x529be8,_0x31e990){var _0x42adf8={},_0x4a99ce={},_0xd63d3f={'count':0x0,'rows':[]};var _0x497c92=_['map'](db[_0x2707('0x2f')]['rawAttributes'],function(_0x2a0d24){return{'name':_0x2a0d24[_0x2707('0x30')],'type':_0x2a0d24[_0x2707('0x31')][_0x2707('0x32')]};});_0x4a99ce['model']=_[_0x2707('0x33')](_0x497c92,_0x2707('0x2c'));_0x4a99ce[_0x2707('0x34')]=_[_0x2707('0x35')](_0x529be8[_0x2707('0x34')]);_0x4a99ce[_0x2707('0x36')]=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],_0x4a99ce[_0x2707('0x34')]);_0x42adf8['attributes']=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],qs['fields'](_0x529be8['query']['fields']));_0x42adf8['attributes']=_0x42adf8['attributes'][_0x2707('0x39')]?_0x42adf8['attributes']:_0x4a99ce['model'];if(!_0x529be8[_0x2707('0x34')][_0x2707('0x3a')]('nolimit')){_0x42adf8[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x529be8['query']['limit']);_0x42adf8[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x529be8['query']['offset']);}_0x42adf8[_0x2707('0x3b')]=qs[_0x2707('0x3c')](_0x529be8['query'][_0x2707('0x3c')]);_0x42adf8[_0x2707('0x3d')]=qs[_0x2707('0x36')](_[_0x2707('0x3e')](_0x529be8[_0x2707('0x34')],_0x4a99ce[_0x2707('0x36')]),_0x497c92);if(_0x529be8['query'][_0x2707('0x3f')]){_0x42adf8[_0x2707('0x3d')]=_[_0x2707('0x40')](_0x42adf8[_0x2707('0x3d')],{'$or':_[_0x2707('0x33')](_0x497c92,function(_0x1b9d71){if(_0x1b9d71[_0x2707('0x31')]!=='VIRTUAL'){var _0x3f85a0={};_0x3f85a0[_0x1b9d71[_0x2707('0x2c')]]={'$like':'%'+_0x529be8[_0x2707('0x34')][_0x2707('0x3f')]+'%'};return _0x3f85a0;}})});}_0x42adf8=_[_0x2707('0x40')]({},_0x42adf8,_0x529be8[_0x2707('0x41')]);var _0x3ed513={'where':_0x42adf8[_0x2707('0x3d')]};return db[_0x2707('0x2f')][_0x2707('0x20')](_0x3ed513)[_0x2707('0x29')](function(_0x3368cd){_0xd63d3f[_0x2707('0x20')]=_0x3368cd;if(_0x529be8[_0x2707('0x34')][_0x2707('0x42')]){_0x42adf8[_0x2707('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x2707('0x44')](_0x42adf8);})[_0x2707('0x29')](function(_0x5053ba){_0xd63d3f[_0x2707('0x45')]=_0x5053ba;return _0xd63d3f;})['then'](respondWithFilteredResult(_0x31e990,_0x42adf8))[_0x2707('0x46')](handleError(_0x31e990,null));};exports[_0x2707('0x47')]=function(_0x3a91da,_0x1d69d3){var _0x13e1c0={'raw':!![],'where':{'id':_0x3a91da[_0x2707('0x48')]['id']}},_0xdeec24={};_0xdeec24['model']=_[_0x2707('0x35')](db[_0x2707('0x2f')]['rawAttributes']);_0xdeec24[_0x2707('0x34')]=_[_0x2707('0x35')](_0x3a91da[_0x2707('0x34')]);_0xdeec24['filters']=_['intersection'](_0xdeec24[_0x2707('0x38')],_0xdeec24[_0x2707('0x34')]);_0x13e1c0['attributes']=_[_0x2707('0x37')](_0xdeec24['model'],qs[_0x2707('0x49')](_0x3a91da[_0x2707('0x34')][_0x2707('0x49')]));_0x13e1c0[_0x2707('0x4a')]=_0x13e1c0['attributes'][_0x2707('0x39')]?_0x13e1c0[_0x2707('0x4a')]:_0xdeec24[_0x2707('0x38')];if(_0x3a91da[_0x2707('0x34')][_0x2707('0x42')]){_0x13e1c0[_0x2707('0x43')]=[{'all':!![]}];}_0x13e1c0=_[_0x2707('0x40')]({},_0x13e1c0,_0x3a91da['options']);return db[_0x2707('0x2f')][_0x2707('0x4b')](_0x13e1c0)[_0x2707('0x29')](handleEntityNotFound(_0x1d69d3,null))[_0x2707('0x29')](respondWithResult(_0x1d69d3,null))[_0x2707('0x46')](handleError(_0x1d69d3,null));};exports['create']=function(_0x35917d,_0x4a6eea){return db[_0x2707('0x2f')][_0x2707('0x4c')](_0x35917d['body'],{})[_0x2707('0x29')](respondWithResult(_0x4a6eea,0xc9))[_0x2707('0x46')](handleError(_0x4a6eea,null));};exports[_0x2707('0x27')]=function(_0x4ae196,_0x1a8034){if(_0x4ae196['body']['id']){delete _0x4ae196[_0x2707('0x4d')]['id'];}return db[_0x2707('0x2f')]['find']({'where':{'id':_0x4ae196[_0x2707('0x48')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x1a8034,null))[_0x2707('0x29')](saveUpdates(_0x4ae196['body'],null))['then'](respondWithResult(_0x1a8034,null))[_0x2707('0x46')](handleError(_0x1a8034,null));};exports[_0x2707('0x28')]=function(_0x292b44,_0x2515dc){return db[_0x2707('0x2f')]['find']({'where':{'id':_0x292b44['params']['id']}})['then'](handleEntityNotFound(_0x2515dc,null))[_0x2707('0x29')](removeEntity(_0x2515dc,null))[_0x2707('0x46')](handleError(_0x2515dc,null));};exports[_0x2707('0x4e')]=function(_0x1dcf74,_0x1ffcce){return db['WhatsappQueueReport'][_0x2707('0x4e')]()[_0x2707('0x29')](respondWithResult(_0x1ffcce,null))['catch'](handleError(_0x1ffcce,null));}; \ No newline at end of file +var _0x087b=['name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','update','params','describe','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','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack'];(function(_0x562088,_0x4281fd){var _0x16f24f=function(_0x2b273d){while(--_0x2b273d){_0x562088['push'](_0x562088['shift']());}};_0x16f24f(++_0x4281fd);}(_0x087b,0x11a));var _0xb087=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x087b[_0x25d386];return _0x857f4a;};'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'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={},_0x263259={},_0x593b78={'count':0x0,'rows':[]};var _0x37393a=_[_0xb087('0x2d')](db[_0xb087('0x2e')][_0xb087('0x2f')],function(_0x22d441){return{'name':_0x22d441[_0xb087('0x30')],'type':_0x22d441[_0xb087('0x31')][_0xb087('0x32')]};});_0x263259['model']=_['map'](_0x37393a,_0xb087('0x2a'));_0x263259[_0xb087('0x33')]=_['keys'](_0x18058c[_0xb087('0x33')]);_0x263259[_0xb087('0x34')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],_0x263259[_0xb087('0x33')]);_0xb0baf6[_0xb087('0x37')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],qs[_0xb087('0x38')](_0x18058c[_0xb087('0x33')][_0xb087('0x38')]));_0xb0baf6[_0xb087('0x37')]=_0xb0baf6['attributes'][_0xb087('0x39')]?_0xb0baf6['attributes']:_0x263259[_0xb087('0x36')];if(!_0x18058c[_0xb087('0x33')][_0xb087('0x3a')](_0xb087('0x3b'))){_0xb0baf6[_0xb087('0x20')]=qs[_0xb087('0x20')](_0x18058c[_0xb087('0x33')][_0xb087('0x20')]);_0xb0baf6[_0xb087('0x1f')]=qs['offset'](_0x18058c['query'][_0xb087('0x1f')]);}_0xb0baf6[_0xb087('0x3c')]=qs[_0xb087('0x3d')](_0x18058c[_0xb087('0x33')][_0xb087('0x3d')]);_0xb0baf6['where']=qs[_0xb087('0x34')](_[_0xb087('0x3e')](_0x18058c['query'],_0x263259['filters']),_0x37393a);if(_0x18058c[_0xb087('0x33')][_0xb087('0x3f')]){_0xb0baf6[_0xb087('0x40')]=_['merge'](_0xb0baf6[_0xb087('0x40')],{'$or':_[_0xb087('0x2d')](_0x37393a,function(_0x1caa6e){if(_0x1caa6e[_0xb087('0x31')]!==_0xb087('0x41')){var _0x5db6b9={};_0x5db6b9[_0x1caa6e[_0xb087('0x2a')]]={'$like':'%'+_0x18058c['query'][_0xb087('0x3f')]+'%'};return _0x5db6b9;}})});}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x42')]);var _0xc9f9e9={'where':_0xb0baf6['where']};return db[_0xb087('0x2e')]['count'](_0xc9f9e9)[_0xb087('0x27')](function(_0x4a360c){_0x593b78[_0xb087('0x22')]=_0x4a360c;if(_0x18058c[_0xb087('0x33')][_0xb087('0x43')]){_0xb0baf6[_0xb087('0x44')]=[{'all':!![]}];}return db[_0xb087('0x2e')][_0xb087('0x45')](_0xb0baf6);})[_0xb087('0x27')](function(_0x5e7690){_0x593b78[_0xb087('0x46')]=_0x5e7690;return _0x593b78;})['then'](respondWithFilteredResult(_0x31e3e6,_0xb0baf6))[_0xb087('0x47')](handleError(_0x31e3e6,null));};exports[_0xb087('0x48')]=function(_0x5b6924,_0xb662bf){var _0x45dc6f={'raw':!![],'where':{'id':_0x5b6924['params']['id']}},_0x7650c5={};_0x7650c5[_0xb087('0x36')]=_['keys'](db[_0xb087('0x2e')][_0xb087('0x2f')]);_0x7650c5['query']=_[_0xb087('0x49')](_0x5b6924[_0xb087('0x33')]);_0x7650c5['filters']=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],_0x7650c5['query']);_0x45dc6f[_0xb087('0x37')]=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],qs[_0xb087('0x38')](_0x5b6924['query']['fields']));_0x45dc6f[_0xb087('0x37')]=_0x45dc6f[_0xb087('0x37')][_0xb087('0x39')]?_0x45dc6f[_0xb087('0x37')]:_0x7650c5[_0xb087('0x36')];if(_0x5b6924[_0xb087('0x33')]['includeAll']){_0x45dc6f['include']=[{'all':!![]}];}_0x45dc6f=_[_0xb087('0x4a')]({},_0x45dc6f,_0x5b6924['options']);return db[_0xb087('0x2e')][_0xb087('0x4b')](_0x45dc6f)[_0xb087('0x27')](handleEntityNotFound(_0xb662bf,null))[_0xb087('0x27')](respondWithResult(_0xb662bf,null))['catch'](handleError(_0xb662bf,null));};exports[_0xb087('0x4c')]=function(_0x562751,_0x2fe8a0){return db[_0xb087('0x2e')][_0xb087('0x4c')](_0x562751[_0xb087('0x4d')],{})[_0xb087('0x27')](respondWithResult(_0x2fe8a0,0xc9))['catch'](handleError(_0x2fe8a0,null));};exports[_0xb087('0x4e')]=function(_0xb15e28,_0x588d96){if(_0xb15e28['body']['id']){delete _0xb15e28[_0xb087('0x4d')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0xb15e28[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x588d96,null))['then'](saveUpdates(_0xb15e28[_0xb087('0x4d')],null))[_0xb087('0x27')](respondWithResult(_0x588d96,null))[_0xb087('0x47')](handleError(_0x588d96,null));};exports['destroy']=function(_0x5ba160,_0x30cc83){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5ba160[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x30cc83,null))[_0xb087('0x27')](removeEntity(_0x30cc83,null))[_0xb087('0x47')](handleError(_0x30cc83,null));};exports[_0xb087('0x50')]=function(_0x148642,_0xbd849d){return db[_0xb087('0x2e')][_0xb087('0x50')]()[_0xb087('0x27')](respondWithResult(_0xbd849d,null))[_0xb087('0x47')](handleError(_0xbd849d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index abe8ad9..7f25c7e 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 _0xe720=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue'];(function(_0x5adfbf,_0x35a827){var _0x5ab7ba=function(_0xe32168){while(--_0xe32168){_0x5adfbf['push'](_0x5adfbf['shift']());}};_0x5ab7ba(++_0x35a827);}(_0xe720,0x1ec));var _0x0e72=function(_0x35d3c5,_0x3e2ba0){_0x35d3c5=_0x35d3c5-0x0;var _0x17b4a2=_0xe720[_0x35d3c5];return _0x17b4a2;};'use strict';var _=require(_0x0e72('0x0'));var util=require('util');var logger=require(_0x0e72('0x1'))(_0x0e72('0x2'));var moment=require(_0x0e72('0x3'));var BPromise=require(_0x0e72('0x4'));var rp=require(_0x0e72('0x5'));var fs=require('fs');var path=require(_0x0e72('0x6'));var rimraf=require(_0x0e72('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e72('0x8'));module[_0x0e72('0x9')]=function(_0x5038e6,_0x296004){return _0x5038e6[_0x0e72('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x0e72('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0440=['api','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0440,0xca));var _0x0044=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x0440[_0x1de43c];return _0x296d3e;};'use strict';var _=require('lodash');var util=require(_0x0044('0x0'));var logger=require(_0x0044('0x1'))(_0x0044('0x2'));var moment=require('moment');var BPromise=require(_0x0044('0x3'));var rp=require(_0x0044('0x4'));var fs=require('fs');var path=require(_0x0044('0x5'));var rimraf=require('rimraf');var config=require(_0x0044('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0044('0x7')]=function(_0x1f0ae4,_0x29c923){return _0x1f0ae4[_0x0044('0x8')](_0x0044('0x9'),attributes,{'tableName':_0x0044('0xa'),'paranoid':![],'indexes':[{'name':_0x0044('0xb'),'fields':[_0x0044('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 f1dfa96..16f610a 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 _0x5a1d=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','debug','lodash','util'];(function(_0x10dc5f,_0x3be7d7){var _0x4bdf6b=function(_0x40b9c7){while(--_0x40b9c7){_0x10dc5f['push'](_0x10dc5f['shift']());}};_0x4bdf6b(++_0x3be7d7);}(_0x5a1d,0x11e));var _0xd5a1=function(_0x4eb8f6,_0x3d96ae){_0x4eb8f6=_0x4eb8f6-0x0;var _0x5bc24d=_0x5a1d[_0x4eb8f6];return _0x5bc24d;};'use strict';var _=require(_0xd5a1('0x0'));var util=require(_0xd5a1('0x1'));var moment=require(_0xd5a1('0x2'));var BPromise=require(_0xd5a1('0x3'));var rs=require(_0xd5a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5a1('0x6'));var config=require(_0xd5a1('0x7'));var jayson=require(_0xd5a1('0x8'));var client=jayson[_0xd5a1('0x9')][_0xd5a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52c457,_0x27cb4b,_0x4deaf4){return new BPromise(function(_0xf7ee78,_0x351b13){return client['request'](_0x52c457,_0x4deaf4)['then'](function(_0x4799df){logger[_0xd5a1('0xb')](_0xd5a1('0xc'),_0x27cb4b,_0xd5a1('0xd'));logger['debug'](_0xd5a1('0xe'),_0x27cb4b,_0xd5a1('0xd'),JSON[_0xd5a1('0xf')](_0x4799df));if(_0x4799df[_0xd5a1('0x10')]){if(_0x4799df[_0xd5a1('0x10')][_0xd5a1('0x11')]===0x1f4){logger[_0xd5a1('0x10')](_0xd5a1('0xc'),_0x27cb4b,_0x4799df[_0xd5a1('0x10')][_0xd5a1('0x12')]);return _0x351b13(_0x4799df[_0xd5a1('0x10')][_0xd5a1('0x12')]);}logger[_0xd5a1('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x27cb4b,_0x4799df['error'][_0xd5a1('0x12')]);return _0xf7ee78(_0x4799df[_0xd5a1('0x10')]['message']);}else{logger[_0xd5a1('0xb')](_0xd5a1('0xc'),_0x27cb4b,'request\x20sent');_0xf7ee78(_0x4799df[_0xd5a1('0x13')][_0xd5a1('0x12')]);}})[_0xd5a1('0x14')](function(_0x4fd684){logger[_0xd5a1('0x10')](_0xd5a1('0xc'),_0x27cb4b,_0x4fd684);_0x351b13(_0x4fd684);});});}exports['CreateWhatsappQueueReport']=function(_0x260f31){var _0x2a1dfa=this;return new Promise(function(_0x83d974,_0x54004e){return db[_0xd5a1('0x15')][_0xd5a1('0x16')](_0x260f31[_0xd5a1('0x17')],{'raw':_0x260f31['options']?_0x260f31[_0xd5a1('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd5a1('0x19')](function(_0x4e21cd){logger[_0xd5a1('0xb')](_0xd5a1('0x1a'),_0x260f31);logger['debug']('CreateWhatsappQueueReport',_0x260f31,JSON[_0xd5a1('0xf')](_0x4e21cd));_0x83d974(_0x4e21cd);})['catch'](function(_0x428cec){logger[_0xd5a1('0x10')](_0xd5a1('0x1a'),_0x428cec[_0xd5a1('0x12')],_0x260f31);_0x54004e(_0x2a1dfa['error'](0x1f4,_0x428cec['message']));});});};exports[_0xd5a1('0x1b')]=function(_0x41a0df){var _0xc13d66=this;return new Promise(function(_0x2fa630,_0x569473){return db[_0xd5a1('0x15')][_0xd5a1('0x1c')](_0x41a0df[_0xd5a1('0x17')],{'raw':_0x41a0df[_0xd5a1('0x18')]?_0x41a0df[_0xd5a1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41a0df['options']?_0x41a0df[_0xd5a1('0x18')][_0xd5a1('0x1d')]||null:null,'attributes':_0x41a0df[_0xd5a1('0x18')]?_0x41a0df[_0xd5a1('0x18')][_0xd5a1('0x1e')]||null:null,'limit':_0x41a0df[_0xd5a1('0x18')]?_0x41a0df[_0xd5a1('0x18')]['limit']||null:null})['then'](function(_0x3147a1){logger[_0xd5a1('0xb')](_0xd5a1('0x1b'),_0x41a0df);logger[_0xd5a1('0x1f')]('UpdateWhatsappQueueReport',_0x41a0df,JSON[_0xd5a1('0xf')](_0x3147a1));_0x2fa630(_0x3147a1);})[_0xd5a1('0x14')](function(_0x74d3f6){logger[_0xd5a1('0x10')]('UpdateWhatsappQueueReport',_0x74d3f6[_0xd5a1('0x12')],_0x41a0df);_0x569473(_0xc13d66['error'](0x1f4,_0x74d3f6[_0xd5a1('0x12')]));});});}; \ No newline at end of file +var _0xf2a0=['attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update'];(function(_0x1ec494,_0x177f47){var _0x5dc1c7=function(_0x383663){while(--_0x383663){_0x1ec494['push'](_0x1ec494['shift']());}};_0x5dc1c7(++_0x177f47);}(_0xf2a0,0x7e));var _0x0f2a=function(_0x2d2201,_0x3cfe3d){_0x2d2201=_0x2d2201-0x0;var _0x12e6cd=_0xf2a0[_0x2d2201];return _0x12e6cd;};'use strict';var _=require('lodash');var util=require(_0x0f2a('0x0'));var moment=require(_0x0f2a('0x1'));var BPromise=require(_0x0f2a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f2a('0x3'));var db=require(_0x0f2a('0x4'))['db'];var utils=require(_0x0f2a('0x5'));var logger=require(_0x0f2a('0x6'))(_0x0f2a('0x7'));var config=require(_0x0f2a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0f2a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fdb21,_0x3feb8b,_0x3ac230){return new BPromise(function(_0x204315,_0x572f92){return client[_0x0f2a('0xa')](_0x1fdb21,_0x3ac230)[_0x0f2a('0xb')](function(_0x467f03){logger[_0x0f2a('0xc')](_0x0f2a('0xd'),_0x3feb8b,_0x0f2a('0xe'));logger[_0x0f2a('0xf')](_0x0f2a('0x10'),_0x3feb8b,'request\x20sent',JSON[_0x0f2a('0x11')](_0x467f03));if(_0x467f03[_0x0f2a('0x12')]){if(_0x467f03[_0x0f2a('0x12')]['code']===0x1f4){logger['error'](_0x0f2a('0xd'),_0x3feb8b,_0x467f03['error'][_0x0f2a('0x13')]);return _0x572f92(_0x467f03[_0x0f2a('0x12')]['message']);}logger[_0x0f2a('0x12')](_0x0f2a('0xd'),_0x3feb8b,_0x467f03[_0x0f2a('0x12')]['message']);return _0x204315(_0x467f03[_0x0f2a('0x12')][_0x0f2a('0x13')]);}else{logger[_0x0f2a('0xc')](_0x0f2a('0xd'),_0x3feb8b,_0x0f2a('0xe'));_0x204315(_0x467f03['result'][_0x0f2a('0x13')]);}})[_0x0f2a('0x14')](function(_0x1f0907){logger[_0x0f2a('0x12')](_0x0f2a('0xd'),_0x3feb8b,_0x1f0907);_0x572f92(_0x1f0907);});});}exports[_0x0f2a('0x15')]=function(_0x4868e6){var _0x3afec9=this;return new Promise(function(_0xef78ac,_0x2901bb){return db[_0x0f2a('0x16')][_0x0f2a('0x17')](_0x4868e6[_0x0f2a('0x18')],{'raw':_0x4868e6[_0x0f2a('0x19')]?_0x4868e6[_0x0f2a('0x19')][_0x0f2a('0x1a')]===undefined?!![]:![]:!![]})[_0x0f2a('0xb')](function(_0x19d36d){logger[_0x0f2a('0xc')](_0x0f2a('0x15'),_0x4868e6);logger['debug'](_0x0f2a('0x15'),_0x4868e6,JSON[_0x0f2a('0x11')](_0x19d36d));_0xef78ac(_0x19d36d);})[_0x0f2a('0x14')](function(_0x1075d8){logger[_0x0f2a('0x12')](_0x0f2a('0x15'),_0x1075d8[_0x0f2a('0x13')],_0x4868e6);_0x2901bb(_0x3afec9[_0x0f2a('0x12')](0x1f4,_0x1075d8[_0x0f2a('0x13')]));});});};exports[_0x0f2a('0x1b')]=function(_0x412626){var _0x289ca5=this;return new Promise(function(_0x10c808,_0x4100c4){return db[_0x0f2a('0x16')][_0x0f2a('0x1c')](_0x412626[_0x0f2a('0x18')],{'raw':_0x412626[_0x0f2a('0x19')]?_0x412626[_0x0f2a('0x19')][_0x0f2a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x412626['options']?_0x412626['options']['where']||null:null,'attributes':_0x412626[_0x0f2a('0x19')]?_0x412626[_0x0f2a('0x19')][_0x0f2a('0x1d')]||null:null,'limit':_0x412626[_0x0f2a('0x19')]?_0x412626[_0x0f2a('0x19')][_0x0f2a('0x1e')]||null:null})[_0x0f2a('0xb')](function(_0x32fdc5){logger[_0x0f2a('0xc')](_0x0f2a('0x1b'),_0x412626);logger[_0x0f2a('0xf')]('UpdateWhatsappQueueReport',_0x412626,JSON[_0x0f2a('0x11')](_0x32fdc5));_0x10c808(_0x32fdc5);})[_0x0f2a('0x14')](function(_0x24cf75){logger['error'](_0x0f2a('0x1b'),_0x24cf75[_0x0f2a('0x13')],_0x412626);_0x4100c4(_0x289ca5[_0x0f2a('0x12')](0x1f4,_0x24cf75[_0x0f2a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a0b4701..3416b7d 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 _0x953f=['create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x50b0e6,_0x4fe3c3){var _0x182cef=function(_0x5041d6){while(--_0x5041d6){_0x50b0e6['push'](_0x50b0e6['shift']());}};_0x182cef(++_0x4fe3c3);}(_0x953f,0x99));var _0xf953=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x953f[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0xf953('0x0'));var path=require(_0xf953('0x1'));var timeout=require(_0xf953('0x2'));var express=require(_0xf953('0x3'));var router=express[_0xf953('0x4')]();var fs_extra=require(_0xf953('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf953('0x6'));var config=require(_0xf953('0x7'));var controller=require(_0xf953('0x8'));router[_0xf953('0x9')]('/',auth[_0xf953('0xa')](),controller[_0xf953('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf953('0xc')]);router[_0xf953('0x9')]('/:id',auth[_0xf953('0xa')](),controller[_0xf953('0xd')]);router[_0xf953('0xe')]('/',auth[_0xf953('0xa')](),controller[_0xf953('0xf')]);router[_0xf953('0x10')](_0xf953('0x11'),auth[_0xf953('0xa')](),controller[_0xf953('0x12')]);router['delete'](_0xf953('0x11'),auth[_0xf953('0xa')](),controller[_0xf953('0x13')]);module[_0xf953('0x14')]=router; \ No newline at end of file +var _0x9d17=['express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','destroy','exports','multer','util','path','connect-timeout'];(function(_0x444555,_0x3aa00e){var _0x3a2052=function(_0xef3844){while(--_0xef3844){_0x444555['push'](_0x444555['shift']());}};_0x3a2052(++_0x3aa00e);}(_0x9d17,0x19e));var _0x79d1=function(_0x5b6234,_0x41e345){_0x5b6234=_0x5b6234-0x0;var _0x2eb8be=_0x9d17[_0x5b6234];return _0x2eb8be;};'use strict';var multer=require(_0x79d1('0x0'));var util=require(_0x79d1('0x1'));var path=require(_0x79d1('0x2'));var timeout=require(_0x79d1('0x3'));var express=require(_0x79d1('0x4'));var router=express[_0x79d1('0x5')]();var fs_extra=require(_0x79d1('0x6'));var auth=require(_0x79d1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79d1('0x8'));router['get']('/',auth[_0x79d1('0x9')](),controller[_0x79d1('0xa')]);router[_0x79d1('0xb')](_0x79d1('0xc'),auth[_0x79d1('0x9')](),controller[_0x79d1('0xd')]);router[_0x79d1('0xb')](_0x79d1('0xe'),auth[_0x79d1('0x9')](),controller[_0x79d1('0xf')]);router[_0x79d1('0x10')]('/',auth[_0x79d1('0x9')](),controller['create']);router['put'](_0x79d1('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x79d1('0x11')]);module[_0x79d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 25d85d4..0a30021 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 _0x4cdf=['exports','STRING','ENUM','account','agent','DATE','sequelize'];(function(_0x5830f1,_0x1a5dd8){var _0x1a35eb=function(_0x4a829c){while(--_0x4a829c){_0x5830f1['push'](_0x5830f1['shift']());}};_0x1a35eb(++_0x1a5dd8);}(_0x4cdf,0x180));var _0xf4cd=function(_0x535b03,_0x31b3f5){_0x535b03=_0x535b03-0x0;var _0x30908d=_0x4cdf[_0x535b03];return _0x30908d;};'use strict';var Sequelize=require(_0xf4cd('0x0'));module[_0xf4cd('0x1')]={'uniqueid':{'type':Sequelize[_0xf4cd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf4cd('0x3')](_0xf4cd('0x4'),_0xf4cd('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf4cd('0x6')]}}; \ No newline at end of file +var _0x225b=['account','queue','sequelize','exports','ENUM'];(function(_0x46b166,_0x1c98df){var _0x43e1a3=function(_0x2c8324){while(--_0x2c8324){_0x46b166['push'](_0x46b166['shift']());}};_0x43e1a3(++_0x1c98df);}(_0x225b,0xb1));var _0xb225=function(_0x41eacc,_0x2fea79){_0x41eacc=_0x41eacc-0x0;var _0x5a06db=_0x225b[_0x41eacc];return _0x5a06db;};'use strict';var Sequelize=require(_0xb225('0x0'));module[_0xb225('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb225('0x2')](_0xb225('0x3'),'agent',_0xb225('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 80b2392..9867e03 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 _0xfbf7=['save','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','update','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xfbf7,0x14b));var _0x7fbf=function(_0x5cb71a,_0x263bdf){_0x5cb71a=_0x5cb71a-0x0;var _0x3f380f=_0xfbf7[_0x5cb71a];return _0x3f380f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fbf('0x0'));var zipdir=require(_0x7fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fbf('0x2'));var moment=require(_0x7fbf('0x3'));var BPromise=require(_0x7fbf('0x4'));var Mustache=require(_0x7fbf('0x5'));var util=require(_0x7fbf('0x6'));var path=require('path');var sox=require(_0x7fbf('0x7'));var csv=require(_0x7fbf('0x8'));var ejs=require(_0x7fbf('0x9'));var fs=require('fs');var fs_extra=require(_0x7fbf('0xa'));var _=require(_0x7fbf('0xb'));var squel=require('squel');var crypto=require(_0x7fbf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7fbf('0xd'));var toCsv=require(_0x7fbf('0x8'));var querystring=require(_0x7fbf('0xe'));var Papa=require(_0x7fbf('0xf'));var Redis=require('ioredis');var authService=require(_0x7fbf('0x10'));var qs=require(_0x7fbf('0x11'));var as=require(_0x7fbf('0x12'));var hardwareService=require(_0x7fbf('0x13'));var logger=require(_0x7fbf('0x14'))(_0x7fbf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7fbf('0x16'));var db=require(_0x7fbf('0x17'))['db'];function respondWithStatusCode(_0x5653c3,_0x259e94){_0x259e94=_0x259e94||0xcc;return function(_0x218f7e){if(_0x218f7e){return _0x5653c3['sendStatus'](_0x259e94);}return _0x5653c3[_0x7fbf('0x18')](_0x259e94)[_0x7fbf('0x19')]();};}function respondWithResult(_0x336e60,_0x18ae46){_0x18ae46=_0x18ae46||0xc8;return function(_0x1978d7){if(_0x1978d7){return _0x336e60[_0x7fbf('0x18')](_0x18ae46)['json'](_0x1978d7);}};}function respondWithFilteredResult(_0x4bdab2,_0x254dbb){return function(_0x5657f6){if(_0x5657f6){var _0x12db14=typeof _0x254dbb[_0x7fbf('0x1a')]==='undefined'&&typeof _0x254dbb[_0x7fbf('0x1b')]===_0x7fbf('0x1c');var _0x2dfc38=_0x5657f6[_0x7fbf('0x1d')];var _0x54d853=_0x12db14?0x0:_0x254dbb['offset'];var _0x1bdcc5=_0x12db14?_0x5657f6[_0x7fbf('0x1d')]:_0x254dbb[_0x7fbf('0x1a')]+_0x254dbb[_0x7fbf('0x1b')];var _0x3a3d78;if(_0x1bdcc5>=_0x2dfc38){_0x1bdcc5=_0x2dfc38;_0x3a3d78=0xc8;}else{_0x3a3d78=0xce;}_0x4bdab2[_0x7fbf('0x18')](_0x3a3d78);return _0x4bdab2[_0x7fbf('0x1e')]('Content-Range',_0x54d853+'-'+_0x1bdcc5+'/'+_0x2dfc38)[_0x7fbf('0x1f')](_0x5657f6);}return null;};}function patchUpdates(_0x5b01db){return function(_0x40208f){try{jsonpatch[_0x7fbf('0x20')](_0x40208f,_0x5b01db,!![]);}catch(_0x126a94){return BPromise[_0x7fbf('0x21')](_0x126a94);}return _0x40208f[_0x7fbf('0x22')]();};}function saveUpdates(_0x2bbc8b,_0x5c1a46){return function(_0x28f9a0){if(_0x28f9a0){return _0x28f9a0['update'](_0x2bbc8b)[_0x7fbf('0x23')](function(_0x42f7f7){return _0x42f7f7;});}return null;};}function removeEntity(_0xcf0966,_0x2e1d74){return function(_0x1bf47f){if(_0x1bf47f){return _0x1bf47f[_0x7fbf('0x24')]()[_0x7fbf('0x23')](function(){_0xcf0966[_0x7fbf('0x18')](0xcc)[_0x7fbf('0x19')]();});}};}function handleEntityNotFound(_0x42c898,_0x2bf3bc){return function(_0x57b6d4){if(!_0x57b6d4){_0x42c898['sendStatus'](0x194);}return _0x57b6d4;};}function handleError(_0x4f4ebd,_0x35eeba){_0x35eeba=_0x35eeba||0x1f4;return function(_0x578400){logger[_0x7fbf('0x25')](_0x578400[_0x7fbf('0x26')]);if(_0x578400[_0x7fbf('0x27')]){delete _0x578400['name'];}_0x4f4ebd['status'](_0x35eeba)[_0x7fbf('0x28')](_0x578400);};}exports[_0x7fbf('0x29')]=function(_0x90603a,_0x2c25be){var _0x2872b3={},_0x5346a6={},_0x224ab4={'count':0x0,'rows':[]};var _0x2f6d79=_[_0x7fbf('0x2a')](db[_0x7fbf('0x2b')][_0x7fbf('0x2c')],function(_0xe505d4){return{'name':_0xe505d4[_0x7fbf('0x2d')],'type':_0xe505d4[_0x7fbf('0x2e')]['key']};});_0x5346a6[_0x7fbf('0x2f')]=_[_0x7fbf('0x2a')](_0x2f6d79,_0x7fbf('0x27'));_0x5346a6['query']=_['keys'](_0x90603a[_0x7fbf('0x30')]);_0x5346a6[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x5346a6[_0x7fbf('0x2f')],_0x5346a6[_0x7fbf('0x30')]);_0x2872b3[_0x7fbf('0x33')]=_[_0x7fbf('0x32')](_0x5346a6[_0x7fbf('0x2f')],qs[_0x7fbf('0x34')](_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x34')]));_0x2872b3[_0x7fbf('0x33')]=_0x2872b3[_0x7fbf('0x33')][_0x7fbf('0x35')]?_0x2872b3[_0x7fbf('0x33')]:_0x5346a6[_0x7fbf('0x2f')];if(!_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x36')]('nolimit')){_0x2872b3[_0x7fbf('0x1b')]=qs['limit'](_0x90603a['query'][_0x7fbf('0x1b')]);_0x2872b3[_0x7fbf('0x1a')]=qs['offset'](_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x1a')]);}_0x2872b3['order']=qs[_0x7fbf('0x37')](_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x37')]);_0x2872b3[_0x7fbf('0x38')]=qs[_0x7fbf('0x31')](_[_0x7fbf('0x39')](_0x90603a[_0x7fbf('0x30')],_0x5346a6[_0x7fbf('0x31')]),_0x2f6d79);if(_0x90603a[_0x7fbf('0x30')]['filter']){_0x2872b3[_0x7fbf('0x38')]=_['merge'](_0x2872b3['where'],{'$or':_[_0x7fbf('0x2a')](_0x2f6d79,function(_0x5ba8e8){if(_0x5ba8e8[_0x7fbf('0x2e')]!=='VIRTUAL'){var _0x2900c3={};_0x2900c3[_0x5ba8e8[_0x7fbf('0x27')]]={'$like':'%'+_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x3a')]+'%'};return _0x2900c3;}})});}_0x2872b3=_[_0x7fbf('0x3b')]({},_0x2872b3,_0x90603a[_0x7fbf('0x3c')]);var _0x15476f={'where':_0x2872b3[_0x7fbf('0x38')]};return db['WhatsappTransferReport'][_0x7fbf('0x1d')](_0x15476f)[_0x7fbf('0x23')](function(_0xf81431){_0x224ab4[_0x7fbf('0x1d')]=_0xf81431;if(_0x90603a[_0x7fbf('0x30')][_0x7fbf('0x3d')]){_0x2872b3[_0x7fbf('0x3e')]=[{'all':!![]}];}return db[_0x7fbf('0x2b')][_0x7fbf('0x3f')](_0x2872b3);})[_0x7fbf('0x23')](function(_0x418ae6){_0x224ab4['rows']=_0x418ae6;return _0x224ab4;})[_0x7fbf('0x23')](respondWithFilteredResult(_0x2c25be,_0x2872b3))[_0x7fbf('0x40')](handleError(_0x2c25be,null));};exports[_0x7fbf('0x41')]=function(_0x3e41a7,_0x1cda2e){var _0x366ab4={'raw':!![],'where':{'id':_0x3e41a7['params']['id']}},_0x5b107d={};_0x5b107d[_0x7fbf('0x2f')]=_[_0x7fbf('0x42')](db[_0x7fbf('0x2b')]['rawAttributes']);_0x5b107d[_0x7fbf('0x30')]=_[_0x7fbf('0x42')](_0x3e41a7[_0x7fbf('0x30')]);_0x5b107d[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x5b107d[_0x7fbf('0x2f')],_0x5b107d[_0x7fbf('0x30')]);_0x366ab4[_0x7fbf('0x33')]=_['intersection'](_0x5b107d[_0x7fbf('0x2f')],qs[_0x7fbf('0x34')](_0x3e41a7[_0x7fbf('0x30')]['fields']));_0x366ab4[_0x7fbf('0x33')]=_0x366ab4[_0x7fbf('0x33')]['length']?_0x366ab4[_0x7fbf('0x33')]:_0x5b107d[_0x7fbf('0x2f')];if(_0x3e41a7[_0x7fbf('0x30')][_0x7fbf('0x3d')]){_0x366ab4[_0x7fbf('0x3e')]=[{'all':!![]}];}_0x366ab4=_[_0x7fbf('0x3b')]({},_0x366ab4,_0x3e41a7[_0x7fbf('0x3c')]);return db['WhatsappTransferReport'][_0x7fbf('0x43')](_0x366ab4)['then'](handleEntityNotFound(_0x1cda2e,null))[_0x7fbf('0x23')](respondWithResult(_0x1cda2e,null))['catch'](handleError(_0x1cda2e,null));};exports[_0x7fbf('0x44')]=function(_0x46f991,_0xccd0a3){return db[_0x7fbf('0x2b')]['create'](_0x46f991['body'],{})[_0x7fbf('0x23')](respondWithResult(_0xccd0a3,0xc9))['catch'](handleError(_0xccd0a3,null));};exports[_0x7fbf('0x45')]=function(_0x2d5c9e,_0x47173b){if(_0x2d5c9e[_0x7fbf('0x46')]['id']){delete _0x2d5c9e[_0x7fbf('0x46')]['id'];}return db[_0x7fbf('0x2b')]['find']({'where':{'id':_0x2d5c9e['params']['id']}})[_0x7fbf('0x23')](handleEntityNotFound(_0x47173b,null))[_0x7fbf('0x23')](saveUpdates(_0x2d5c9e['body'],null))[_0x7fbf('0x23')](respondWithResult(_0x47173b,null))[_0x7fbf('0x40')](handleError(_0x47173b,null));};exports[_0x7fbf('0x24')]=function(_0x214123,_0x588558){return db[_0x7fbf('0x2b')][_0x7fbf('0x43')]({'where':{'id':_0x214123[_0x7fbf('0x47')]['id']}})[_0x7fbf('0x23')](handleEntityNotFound(_0x588558,null))[_0x7fbf('0x23')](removeEntity(_0x588558,null))[_0x7fbf('0x40')](handleError(_0x588558,null));};exports[_0x7fbf('0x48')]=function(_0x2e9ae0,_0x18708a){return db['WhatsappTransferReport'][_0x7fbf('0x48')]()[_0x7fbf('0x23')](respondWithResult(_0x18708a,null))[_0x7fbf('0x40')](handleError(_0x18708a,null));}; \ No newline at end of file +var _0x2b47=['end','json','offset','undefined','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','send','index','map','WhatsappTransferReport','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status'];(function(_0x4f94ee,_0x26e8fd){var _0x1bb8ec=function(_0x466638){while(--_0x466638){_0x4f94ee['push'](_0x4f94ee['shift']());}};_0x1bb8ec(++_0x26e8fd);}(_0x2b47,0x77));var _0x72b4=function(_0x24ff7a,_0x4db614){_0x24ff7a=_0x24ff7a-0x0;var _0x4908b4=_0x2b47[_0x24ff7a];return _0x4908b4;};'use strict';var emlformat=require(_0x72b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x72b4('0x1'));var rp=require(_0x72b4('0x2'));var moment=require(_0x72b4('0x3'));var BPromise=require(_0x72b4('0x4'));var Mustache=require(_0x72b4('0x5'));var util=require('util');var path=require(_0x72b4('0x6'));var sox=require('sox');var csv=require(_0x72b4('0x7'));var ejs=require(_0x72b4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x72b4('0x9'));var jsforce=require(_0x72b4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x72b4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72b4('0xb'));var authService=require(_0x72b4('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72b4('0xd'));var logger=require('../../config/logger')(_0x72b4('0xe'));var utils=require(_0x72b4('0xf'));var config=require(_0x72b4('0x10'));var licenseUtil=require(_0x72b4('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37803b,_0x9c8f03){_0x9c8f03=_0x9c8f03||0xcc;return function(_0x4c57a0){if(_0x4c57a0){return _0x37803b['sendStatus'](_0x9c8f03);}return _0x37803b[_0x72b4('0x12')](_0x9c8f03)[_0x72b4('0x13')]();};}function respondWithResult(_0x1fab98,_0x6f7b90){_0x6f7b90=_0x6f7b90||0xc8;return function(_0x383706){if(_0x383706){return _0x1fab98[_0x72b4('0x12')](_0x6f7b90)[_0x72b4('0x14')](_0x383706);}};}function respondWithFilteredResult(_0x265f11,_0x2f41d8){return function(_0x2a7a05){if(_0x2a7a05){var _0x2f54aa=typeof _0x2f41d8[_0x72b4('0x15')]===_0x72b4('0x16')&&typeof _0x2f41d8['limit']===_0x72b4('0x16');var _0x20b639=_0x2a7a05['count'];var _0x44ec76=_0x2f54aa?0x0:_0x2f41d8[_0x72b4('0x15')];var _0x19e52d=_0x2f54aa?_0x2a7a05['count']:_0x2f41d8['offset']+_0x2f41d8[_0x72b4('0x17')];var _0x1443f6;if(_0x19e52d>=_0x20b639){_0x19e52d=_0x20b639;_0x1443f6=0xc8;}else{_0x1443f6=0xce;}_0x265f11[_0x72b4('0x12')](_0x1443f6);return _0x265f11[_0x72b4('0x18')]('Content-Range',_0x44ec76+'-'+_0x19e52d+'/'+_0x20b639)[_0x72b4('0x14')](_0x2a7a05);}return null;};}function patchUpdates(_0x278d58){return function(_0x12af31){try{jsonpatch[_0x72b4('0x19')](_0x12af31,_0x278d58,!![]);}catch(_0x10c0d6){return BPromise['reject'](_0x10c0d6);}return _0x12af31[_0x72b4('0x1a')]();};}function saveUpdates(_0x1074e7,_0x4f6af0){return function(_0x2df539){if(_0x2df539){return _0x2df539[_0x72b4('0x1b')](_0x1074e7)[_0x72b4('0x1c')](function(_0xe0abfe){return _0xe0abfe;});}return null;};}function removeEntity(_0xef1d23,_0x2e603c){return function(_0x93b070){if(_0x93b070){return _0x93b070[_0x72b4('0x1d')]()['then'](function(){_0xef1d23[_0x72b4('0x12')](0xcc)[_0x72b4('0x13')]();});}};}function handleEntityNotFound(_0x53cc63,_0x29deba){return function(_0x34bc6b){if(!_0x34bc6b){_0x53cc63[_0x72b4('0x1e')](0x194);}return _0x34bc6b;};}function handleError(_0x4e8300,_0x2e4feb){_0x2e4feb=_0x2e4feb||0x1f4;return function(_0x52b425){logger[_0x72b4('0x1f')](_0x52b425[_0x72b4('0x20')]);if(_0x52b425['name']){delete _0x52b425['name'];}_0x4e8300[_0x72b4('0x12')](_0x2e4feb)[_0x72b4('0x21')](_0x52b425);};}exports[_0x72b4('0x22')]=function(_0x4dd0df,_0x52c6e1){var _0x2bf3ef={},_0x4c19bb={},_0x282227={'count':0x0,'rows':[]};var _0x2717f2=_[_0x72b4('0x23')](db[_0x72b4('0x24')]['rawAttributes'],function(_0x3f552b){return{'name':_0x3f552b[_0x72b4('0x25')],'type':_0x3f552b[_0x72b4('0x26')][_0x72b4('0x27')]};});_0x4c19bb[_0x72b4('0x28')]=_[_0x72b4('0x23')](_0x2717f2,_0x72b4('0x29'));_0x4c19bb[_0x72b4('0x2a')]=_[_0x72b4('0x2b')](_0x4dd0df[_0x72b4('0x2a')]);_0x4c19bb['filters']=_[_0x72b4('0x2c')](_0x4c19bb[_0x72b4('0x28')],_0x4c19bb[_0x72b4('0x2a')]);_0x2bf3ef['attributes']=_[_0x72b4('0x2c')](_0x4c19bb[_0x72b4('0x28')],qs['fields'](_0x4dd0df[_0x72b4('0x2a')][_0x72b4('0x2d')]));_0x2bf3ef[_0x72b4('0x2e')]=_0x2bf3ef['attributes'][_0x72b4('0x2f')]?_0x2bf3ef[_0x72b4('0x2e')]:_0x4c19bb[_0x72b4('0x28')];if(!_0x4dd0df[_0x72b4('0x2a')][_0x72b4('0x30')](_0x72b4('0x31'))){_0x2bf3ef['limit']=qs[_0x72b4('0x17')](_0x4dd0df['query'][_0x72b4('0x17')]);_0x2bf3ef[_0x72b4('0x15')]=qs[_0x72b4('0x15')](_0x4dd0df['query']['offset']);}_0x2bf3ef[_0x72b4('0x32')]=qs[_0x72b4('0x33')](_0x4dd0df['query'][_0x72b4('0x33')]);_0x2bf3ef[_0x72b4('0x34')]=qs[_0x72b4('0x35')](_['pick'](_0x4dd0df[_0x72b4('0x2a')],_0x4c19bb[_0x72b4('0x35')]),_0x2717f2);if(_0x4dd0df[_0x72b4('0x2a')][_0x72b4('0x36')]){_0x2bf3ef[_0x72b4('0x34')]=_[_0x72b4('0x37')](_0x2bf3ef[_0x72b4('0x34')],{'$or':_[_0x72b4('0x23')](_0x2717f2,function(_0x4517f0){if(_0x4517f0[_0x72b4('0x26')]!=='VIRTUAL'){var _0x57661f={};_0x57661f[_0x4517f0[_0x72b4('0x29')]]={'$like':'%'+_0x4dd0df[_0x72b4('0x2a')][_0x72b4('0x36')]+'%'};return _0x57661f;}})});}_0x2bf3ef=_[_0x72b4('0x37')]({},_0x2bf3ef,_0x4dd0df[_0x72b4('0x38')]);var _0x3373dd={'where':_0x2bf3ef['where']};return db[_0x72b4('0x24')][_0x72b4('0x39')](_0x3373dd)[_0x72b4('0x1c')](function(_0xe3696a){_0x282227['count']=_0xe3696a;if(_0x4dd0df[_0x72b4('0x2a')][_0x72b4('0x3a')]){_0x2bf3ef['include']=[{'all':!![]}];}return db[_0x72b4('0x24')][_0x72b4('0x3b')](_0x2bf3ef);})[_0x72b4('0x1c')](function(_0x3a4667){_0x282227[_0x72b4('0x3c')]=_0x3a4667;return _0x282227;})['then'](respondWithFilteredResult(_0x52c6e1,_0x2bf3ef))[_0x72b4('0x3d')](handleError(_0x52c6e1,null));};exports['show']=function(_0x4d1cb7,_0x451195){var _0x1f60ff={'raw':!![],'where':{'id':_0x4d1cb7['params']['id']}},_0x26a1e1={};_0x26a1e1[_0x72b4('0x28')]=_[_0x72b4('0x2b')](db['WhatsappTransferReport'][_0x72b4('0x3e')]);_0x26a1e1[_0x72b4('0x2a')]=_[_0x72b4('0x2b')](_0x4d1cb7[_0x72b4('0x2a')]);_0x26a1e1['filters']=_[_0x72b4('0x2c')](_0x26a1e1['model'],_0x26a1e1[_0x72b4('0x2a')]);_0x1f60ff[_0x72b4('0x2e')]=_[_0x72b4('0x2c')](_0x26a1e1[_0x72b4('0x28')],qs[_0x72b4('0x2d')](_0x4d1cb7[_0x72b4('0x2a')]['fields']));_0x1f60ff[_0x72b4('0x2e')]=_0x1f60ff['attributes']['length']?_0x1f60ff[_0x72b4('0x2e')]:_0x26a1e1[_0x72b4('0x28')];if(_0x4d1cb7['query'][_0x72b4('0x3a')]){_0x1f60ff[_0x72b4('0x3f')]=[{'all':!![]}];}_0x1f60ff=_[_0x72b4('0x37')]({},_0x1f60ff,_0x4d1cb7[_0x72b4('0x38')]);return db[_0x72b4('0x24')][_0x72b4('0x40')](_0x1f60ff)[_0x72b4('0x1c')](handleEntityNotFound(_0x451195,null))[_0x72b4('0x1c')](respondWithResult(_0x451195,null))[_0x72b4('0x3d')](handleError(_0x451195,null));};exports[_0x72b4('0x41')]=function(_0x39c0fa,_0x47a11c){return db[_0x72b4('0x24')][_0x72b4('0x41')](_0x39c0fa[_0x72b4('0x42')],{})['then'](respondWithResult(_0x47a11c,0xc9))[_0x72b4('0x3d')](handleError(_0x47a11c,null));};exports[_0x72b4('0x1b')]=function(_0x3f0d04,_0x5c2644){if(_0x3f0d04[_0x72b4('0x42')]['id']){delete _0x3f0d04[_0x72b4('0x42')]['id'];}return db['WhatsappTransferReport'][_0x72b4('0x40')]({'where':{'id':_0x3f0d04['params']['id']}})[_0x72b4('0x1c')](handleEntityNotFound(_0x5c2644,null))[_0x72b4('0x1c')](saveUpdates(_0x3f0d04[_0x72b4('0x42')],null))['then'](respondWithResult(_0x5c2644,null))[_0x72b4('0x3d')](handleError(_0x5c2644,null));};exports[_0x72b4('0x1d')]=function(_0x577d15,_0x4000e8){return db[_0x72b4('0x24')]['find']({'where':{'id':_0x577d15[_0x72b4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4000e8,null))[_0x72b4('0x1c')](removeEntity(_0x4000e8,null))[_0x72b4('0x3d')](handleError(_0x4000e8,null));};exports[_0x72b4('0x44')]=function(_0x3b6bf5,_0x37901e){return db[_0x72b4('0x24')]['describe']()[_0x72b4('0x1c')](respondWithResult(_0x37901e,null))[_0x72b4('0x3d')](handleError(_0x37901e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6f3913d..2c6a082 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 _0x18cd=['exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x478927,_0x137268){var _0x37223f=function(_0x16faf8){while(--_0x16faf8){_0x478927['push'](_0x478927['shift']());}};_0x37223f(++_0x137268);}(_0x18cd,0x103));var _0xd18c=function(_0x202b22,_0x2e8402){_0x202b22=_0x202b22-0x0;var _0x495469=_0x18cd[_0x202b22];return _0x495469;};'use strict';var _=require(_0xd18c('0x0'));var util=require(_0xd18c('0x1'));var logger=require(_0xd18c('0x2'))(_0xd18c('0x3'));var moment=require(_0xd18c('0x4'));var BPromise=require(_0xd18c('0x5'));var rp=require(_0xd18c('0x6'));var fs=require('fs');var path=require(_0xd18c('0x7'));var rimraf=require(_0xd18c('0x8'));var config=require(_0xd18c('0x9'));var attributes=require(_0xd18c('0xa'));module[_0xd18c('0xb')]=function(_0x555c7a,_0x9109c5){return _0x555c7a[_0xd18c('0xc')](_0xd18c('0xd'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd18c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa549=['request-promise','path','rimraf','../../config/environment','define','WhatsappTransferReport','uniqueid','lodash','api','moment'];(function(_0x29aae6,_0x889579){var _0x41927b=function(_0xc00729){while(--_0xc00729){_0x29aae6['push'](_0x29aae6['shift']());}};_0x41927b(++_0x889579);}(_0xa549,0xcf));var _0x9a54=function(_0xab0a07,_0x408700){_0xab0a07=_0xab0a07-0x0;var _0x4a9207=_0xa549[_0xab0a07];return _0x4a9207;};'use strict';var _=require(_0x9a54('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9a54('0x1'));var moment=require(_0x9a54('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a54('0x3'));var fs=require('fs');var path=require(_0x9a54('0x4'));var rimraf=require(_0x9a54('0x5'));var config=require(_0x9a54('0x6'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x3c9629,_0x416498){return _0x3c9629[_0x9a54('0x7')](_0x9a54('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9a54('0x9'),'fields':[_0x9a54('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 a286a3a..ea76333 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 _0x3f4d=['../../config/logger','../../config/environment','jayson/promise','client','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8b1d29,_0xb306df){var _0x29fe0e=function(_0x1dae4d){while(--_0x1dae4d){_0x8b1d29['push'](_0x8b1d29['shift']());}};_0x29fe0e(++_0xb306df);}(_0x3f4d,0xae));var _0xd3f4=function(_0x97688b,_0x24a0aa){_0x97688b=_0x97688b-0x0;var _0x4e0ca4=_0x3f4d[_0x97688b];return _0x4e0ca4;};'use strict';var _=require(_0xd3f4('0x0'));var util=require(_0xd3f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3f4('0x2'));var fs=require('fs');var Redis=require(_0xd3f4('0x3'));var db=require(_0xd3f4('0x4'))['db'];var utils=require(_0xd3f4('0x5'));var logger=require(_0xd3f4('0x6'))('rpc');var config=require(_0xd3f4('0x7'));var jayson=require(_0xd3f4('0x8'));var client=jayson[_0xd3f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x446639,_0x11cce7,_0x2a4090){return new BPromise(function(_0x3a5253,_0x45faff){return client[_0xd3f4('0xa')](_0x446639,_0x2a4090)['then'](function(_0x34dea8){logger['info'](_0xd3f4('0xb'),_0x11cce7,_0xd3f4('0xc'));logger['debug'](_0xd3f4('0xd'),_0x11cce7,'request\x20sent',JSON[_0xd3f4('0xe')](_0x34dea8));if(_0x34dea8[_0xd3f4('0xf')]){if(_0x34dea8[_0xd3f4('0xf')][_0xd3f4('0x10')]===0x1f4){logger[_0xd3f4('0xf')](_0xd3f4('0xb'),_0x11cce7,_0x34dea8['error'][_0xd3f4('0x11')]);return _0x45faff(_0x34dea8['error'][_0xd3f4('0x11')]);}logger['error'](_0xd3f4('0xb'),_0x11cce7,_0x34dea8[_0xd3f4('0xf')][_0xd3f4('0x11')]);return _0x3a5253(_0x34dea8[_0xd3f4('0xf')][_0xd3f4('0x11')]);}else{logger['info'](_0xd3f4('0xb'),_0x11cce7,'request\x20sent');_0x3a5253(_0x34dea8[_0xd3f4('0x12')][_0xd3f4('0x11')]);}})[_0xd3f4('0x13')](function(_0x471b8f){logger[_0xd3f4('0xf')](_0xd3f4('0xb'),_0x11cce7,_0x471b8f);_0x45faff(_0x471b8f);});});} \ No newline at end of file +var _0xac14=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2edced,_0x33ef3e){var _0x43db7d=function(_0x18b323){while(--_0x18b323){_0x2edced['push'](_0x2edced['shift']());}};_0x43db7d(++_0x33ef3e);}(_0xac14,0x173));var _0x4ac1=function(_0x24618e,_0x2cba8a){_0x24618e=_0x24618e-0x0;var _0xc4ec6d=_0xac14[_0x24618e];return _0xc4ec6d;};'use strict';var _=require(_0x4ac1('0x0'));var util=require(_0x4ac1('0x1'));var moment=require(_0x4ac1('0x2'));var BPromise=require(_0x4ac1('0x3'));var rs=require(_0x4ac1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ac1('0x5'))['db'];var utils=require(_0x4ac1('0x6'));var logger=require('../../config/logger')(_0x4ac1('0x7'));var config=require(_0x4ac1('0x8'));var jayson=require(_0x4ac1('0x9'));var client=jayson[_0x4ac1('0xa')][_0x4ac1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48acc6,_0x185738,_0x7d43f0){return new BPromise(function(_0x3dd9d,_0x4eb61f){return client[_0x4ac1('0xc')](_0x48acc6,_0x7d43f0)[_0x4ac1('0xd')](function(_0x3fa5fe){logger['info'](_0x4ac1('0xe'),_0x185738,'request\x20sent');logger[_0x4ac1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x185738,_0x4ac1('0x10'),JSON[_0x4ac1('0x11')](_0x3fa5fe));if(_0x3fa5fe[_0x4ac1('0x12')]){if(_0x3fa5fe['error'][_0x4ac1('0x13')]===0x1f4){logger[_0x4ac1('0x12')](_0x4ac1('0xe'),_0x185738,_0x3fa5fe['error'][_0x4ac1('0x14')]);return _0x4eb61f(_0x3fa5fe[_0x4ac1('0x12')][_0x4ac1('0x14')]);}logger['error'](_0x4ac1('0xe'),_0x185738,_0x3fa5fe[_0x4ac1('0x12')][_0x4ac1('0x14')]);return _0x3dd9d(_0x3fa5fe[_0x4ac1('0x12')]['message']);}else{logger['info'](_0x4ac1('0xe'),_0x185738,_0x4ac1('0x10'));_0x3dd9d(_0x3fa5fe['result']['message']);}})[_0x4ac1('0x15')](function(_0x5ea092){logger['error'](_0x4ac1('0xe'),_0x185738,_0x5ea092);_0x4eb61f(_0x5ea092);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 99dcd06..b6a43c3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13f5=['exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','None','log','App\x20Ready!','catch','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','info','filter'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x513f('0x0'));var db=require(_0x513f('0x1'))['db'];var seedDb=require(_0x513f('0x2'));var checkLicense=require(_0x513f('0x3'));var rpc=require('./rpc');var config=require(_0x513f('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0x513f('0x5'));var pm2Config=require(_0x513f('0x6'));var schedule=require(_0x513f('0x7'));var chat=require(_0x513f('0x8'));var whatsapp=require(_0x513f('0x9'));var transcribe=require(_0x513f('0xa'));var provider=require(_0x513f('0xb'));function main(){return db[_0x513f('0xc')][_0x513f('0xd')]()[_0x513f('0xe')](function(){if(config[_0x513f('0xf')]){return seedDb[_0x513f('0x10')]();}})['then'](function(){return checkLicense[_0x513f('0x10')]();})[_0x513f('0xe')](function(){return rpc[_0x513f('0x11')]();})[_0x513f('0xe')](function(_0x88288b){logger['info'](_0x88288b);return chat[_0x513f('0x12')]();})[_0x513f('0xe')](function(){return whatsapp['start']();})[_0x513f('0xe')](function(){return schedule[_0x513f('0x12')]();})[_0x513f('0xe')](function(){return transcribe[_0x513f('0x12')]();})[_0x513f('0xe')](function(){return provider[_0x513f('0x12')]();})[_0x513f('0xe')](function(_0x265cd7){logger[_0x513f('0x13')](_0x265cd7);return pm2[_0x513f('0x12')](pm2Config);})[_0x513f('0xe')](function(_0x359478){var _0x3874d1=_0x359478[_0x513f('0x14')](function(_0x57fd65){return typeof _0x57fd65[_0x513f('0x15')]==='number'&&_0x57fd65[_0x513f('0x15')]>=0x0;});if(_0x3874d1[_0x513f('0x16')]>0x0){throw new Error(_0x3874d1[_0x513f('0x16')]+_0x513f('0x17')+_[_0x513f('0x18')](_0x3874d1,function(_0x584305){return'\x22'+_0x584305[_0x513f('0x19')][_0x513f('0x1a')]+'\x22';}));}logger['info'](_0x513f('0x1b'),_['map'](_[_0x513f('0x14')](_0x359478,{'status':_0x513f('0x1c')}),'name')[_0x513f('0x1d')]());logger[_0x513f('0x13')](_0x513f('0x1e'),_[_0x513f('0x18')](_[_0x513f('0x14')](_0x359478,function(_0x1e3a46){return _0x1e3a46['status']!==_0x513f('0x1c');}),_0x513f('0x1a'))['join']()||_0x513f('0x1f'));console[_0x513f('0x20')](_0x513f('0x21'));})[_0x513f('0x22')](function(_0x3d85f7){console[_0x513f('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3d85f7);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3d85f7);process[_0x513f('0x23')](0x1);});}main(); \ No newline at end of file +var _0x5e0c=['filter','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','seedDB','default','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:'];(function(_0x3863eb,_0x4bbb2d){var _0x7bb9f8=function(_0x1358aa){while(--_0x1358aa){_0x3863eb['push'](_0x3863eb['shift']());}};_0x7bb9f8(++_0x4bbb2d);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x18c530,_0x1ef42a){_0x18c530=_0x18c530-0x0;var _0x560b6d=_0x5e0c[_0x18c530];return _0x560b6d;};'use strict';var _=require('lodash');var db=require(_0xc5e0('0x0'))['db'];var seedDb=require(_0xc5e0('0x1'));var checkLicense=require(_0xc5e0('0x2'));var rpc=require(_0xc5e0('0x3'));var config=require(_0xc5e0('0x4'));var logger=require(_0xc5e0('0x5'))('app');var pm2=require(_0xc5e0('0x6'));var pm2Config=require(_0xc5e0('0x7'));var schedule=require(_0xc5e0('0x8'));var chat=require(_0xc5e0('0x9'));var whatsapp=require(_0xc5e0('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc5e0('0xb')]['sync']()[_0xc5e0('0xc')](function(){if(config[_0xc5e0('0xd')]){return seedDb[_0xc5e0('0xe')]();}})[_0xc5e0('0xc')](function(){return checkLicense['default']();})[_0xc5e0('0xc')](function(){return rpc['listen']();})[_0xc5e0('0xc')](function(_0x33d821){logger[_0xc5e0('0xf')](_0x33d821);return chat[_0xc5e0('0x10')]();})[_0xc5e0('0xc')](function(){return whatsapp[_0xc5e0('0x10')]();})['then'](function(){return schedule[_0xc5e0('0x10')]();})[_0xc5e0('0xc')](function(){return transcribe[_0xc5e0('0x10')]();})[_0xc5e0('0xc')](function(){return provider[_0xc5e0('0x10')]();})['then'](function(_0x3d0503){logger[_0xc5e0('0xf')](_0x3d0503);return pm2['start'](pm2Config);})['then'](function(_0x2fa026){var _0x481453=_0x2fa026['filter'](function(_0xcf0eba){return typeof _0xcf0eba[_0xc5e0('0x11')]===_0xc5e0('0x12')&&_0xcf0eba[_0xc5e0('0x11')]>=0x0;});if(_0x481453[_0xc5e0('0x13')]>0x0){throw new Error(_0x481453[_0xc5e0('0x13')]+_0xc5e0('0x14')+_[_0xc5e0('0x15')](_0x481453,function(_0x21bb3e){return'\x22'+_0x21bb3e[_0xc5e0('0x16')][_0xc5e0('0x17')]+'\x22';}));}logger[_0xc5e0('0xf')](_0xc5e0('0x18'),_[_0xc5e0('0x15')](_['filter'](_0x2fa026,{'status':'online'}),_0xc5e0('0x17'))[_0xc5e0('0x19')]());logger[_0xc5e0('0xf')](_0xc5e0('0x1a'),_[_0xc5e0('0x15')](_[_0xc5e0('0x1b')](_0x2fa026,function(_0x4a07e8){return _0x4a07e8['status']!=='online';}),_0xc5e0('0x17'))['join']()||_0xc5e0('0x1c'));console[_0xc5e0('0x1d')](_0xc5e0('0x1e'));})[_0xc5e0('0x1f')](function(_0x3edaea){console[_0xc5e0('0x1d')](_0xc5e0('0x20'),_0x3edaea);logger['error'](_0xc5e0('0x21'),_0x3edaea);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 59c96f0..fdb474d 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 _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x3920f3,_0x726d50){var _0x4daaa1=function(_0x144351){while(--_0x144351){_0x3920f3['push'](_0x3920f3['shift']());}};_0x4daaa1(++_0x726d50);}(_0x34e8,0x12c));var _0x834e=function(_0x1fbe61,_0x327893){_0x1fbe61=_0x1fbe61-0x0;var _0x3d14ef=_0x34e8[_0x1fbe61];return _0x3d14ef;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file +var _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x57a09b,_0x3acbdc){var _0x4c5dc3=function(_0x373650){while(--_0x373650){_0x57a09b['push'](_0x57a09b['shift']());}};_0x4c5dc3(++_0x3acbdc);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1a422a,_0x3468fd){_0x1a422a=_0x1a422a-0x0;var _0x4dcab4=_0xf3cd[_0x1a422a];return _0x4dcab4;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ad288d9..23a60d6 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 _0x0e9c=['indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString','createCipher','utf8','base64','decryptString','secret','bluebird','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter'];(function(_0x197043,_0x3ebf47){var _0x233e33=function(_0x17bd0f){while(--_0x17bd0f){_0x197043['push'](_0x197043['shift']());}};_0x233e33(++_0x3ebf47);}(_0x0e9c,0x17f));var _0xc0e9=function(_0x5784e6,_0xd4acb7){_0x5784e6=_0x5784e6-0x0;var _0x43c849=_0x0e9c[_0x5784e6];return _0x43c849;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc0e9('0x0'));var _=require('lodash');var config=require(_0xc0e9('0x1'));var logger=require(_0xc0e9('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc0e9('0x3')][_0xc0e9('0x4')],'algorithm':_0xc0e9('0x5')};const fileOptions={'algorithm':_0xc0e9('0x6')};if(config[_0xc0e9('0x7')]&&config[_0xc0e9('0x7')][_0xc0e9('0x8')]){var isSupported=isAlgorithmSupported(config[_0xc0e9('0x7')]['algorithm']);if(isSupported){fileOptions[_0xc0e9('0x8')]=config[_0xc0e9('0x7')][_0xc0e9('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xc0e9('0x9')](config[_0xc0e9('0x7')][_0xc0e9('0x8')],_0xc0e9('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x3d05ca){return AES_SUPPORTED_RX['test'](_0x3d05ca);}function getSupportedCiphers(){return crypto[_0xc0e9('0xb')]()[_0xc0e9('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x58e08b){return getSupportedCiphers()[_0xc0e9('0xd')](_0x58e08b)>-0x1;}function combineOptions(_0x3be307){var _0x5b44c4={};for(var _0x470384 in fileOptions){if(fileOptions[_0xc0e9('0xe')](_0x470384)){_0x5b44c4[_0x470384]=fileOptions[_0x470384];}}if(_0x3be307){for(var _0x3a81b3 in _0x3be307){if(_0x3be307[_0xc0e9('0xe')](_0x3a81b3)){_0x5b44c4[_0x3a81b3]=_0x3be307[_0x3a81b3];}}}return _0x5b44c4;}exports['encryptFile']=function(_0x498d4f,_0x3a0213,_0xc7beed,_0x487903){return new BPromise(function(_0x1a3217,_0x1381b3){_0x487903=combineOptions(_0x487903);var _0x51be7b=new Buffer(_0xc7beed);var _0x5be2ac=fs[_0xc0e9('0xf')](_0x498d4f);var _0x35dd63=fs[_0xc0e9('0x10')](_0x3a0213);var _0x260886=crypto['createCipher'](_0x487903[_0xc0e9('0x8')],_0x51be7b);_0x5be2ac['on'](_0xc0e9('0x11'),function(_0x2e0268){var _0x85620c=new Buffer(_0x260886[_0xc0e9('0x12')](_0x2e0268),_0xc0e9('0x13'));_0x35dd63[_0xc0e9('0x14')](_0x85620c);});_0x5be2ac['on'](_0xc0e9('0x15'),function(){try{var _0x4b2af6=new Buffer(_0x260886[_0xc0e9('0x16')](_0xc0e9('0x13')),'binary');_0x35dd63[_0xc0e9('0x14')](_0x4b2af6);_0x35dd63[_0xc0e9('0x15')]();_0x35dd63['on'](_0xc0e9('0x17'),function(){return _0x1a3217(_0x3a0213);});}catch(_0x5807cd){fs[_0xc0e9('0x18')](_0x3a0213);return _0x1381b3(_0x5807cd);}});});};exports[_0xc0e9('0x19')]=function(_0x4384b7,_0x1a5058,_0x5c912b,_0x143371){return new BPromise(function(_0x51e837,_0x556b8e){_0x143371=combineOptions(_0x143371);var _0x30e6b5=new Buffer(_0x5c912b);var _0x1f673e=fs['createReadStream'](_0x4384b7);var _0x2b224f=fs['createWriteStream'](_0x1a5058);var _0x3d8ea1=crypto[_0xc0e9('0x1a')](_0x143371[_0xc0e9('0x8')],_0x30e6b5);_0x1f673e['on'](_0xc0e9('0x11'),function(_0x2a7dfc){var _0x4102d7=new Buffer(_0x3d8ea1[_0xc0e9('0x12')](_0x2a7dfc),'binary');_0x2b224f[_0xc0e9('0x14')](_0x4102d7);});_0x1f673e['on'](_0xc0e9('0x15'),function(){try{var _0x259efe=new Buffer(_0x3d8ea1[_0xc0e9('0x16')]('binary'),_0xc0e9('0x13'));_0x2b224f['write'](_0x259efe);_0x2b224f['end']();_0x2b224f['on'](_0xc0e9('0x17'),function(){return _0x51e837(_0x1a5058);});}catch(_0x5e5509){fs[_0xc0e9('0x18')](_0x1a5058);return _0x556b8e(_0x5e5509);}});});};exports[_0xc0e9('0x1b')]=function(_0xfdc79d,_0x2856f6,_0x32625c){var _0xff1281=_0x32625c||stringOptions[_0xc0e9('0x8')];var _0x5af180=_0x2856f6||stringOptions['secret'];var _0x27ea4a=crypto[_0xc0e9('0x1c')](_0xff1281,_0x5af180);var _0x6e3951=_0x27ea4a[_0xc0e9('0x12')](_0xfdc79d,_0xc0e9('0x1d'),_0xc0e9('0x1e'));_0x6e3951+=_0x27ea4a[_0xc0e9('0x16')]('base64');return _0x6e3951;};exports[_0xc0e9('0x1f')]=function(_0x4c6aaf,_0x55b818,_0x215a4a){var _0x322438=_0x215a4a||stringOptions[_0xc0e9('0x8')];var _0x185226=_0x55b818||stringOptions[_0xc0e9('0x20')];var _0x45d652=crypto[_0xc0e9('0x1a')](_0x322438,_0x185226);var _0x25950c=_0x45d652[_0xc0e9('0x12')](_0x4c6aaf,_0xc0e9('0x1e'),_0xc0e9('0x1d'));_0x25950c+=_0x45d652[_0xc0e9('0x16')]('utf8');return _0x25950c;}; \ No newline at end of file +var _0xf7c3=['secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','binary','end','close','unlink','createDecipher','write','encryptString','utf8','base64','final'];(function(_0x3cb155,_0x5bb43d){var _0x1ccb0c=function(_0x42ec57){while(--_0x42ec57){_0x3cb155['push'](_0x3cb155['shift']());}};_0x1ccb0c(++_0x5bb43d);}(_0xf7c3,0xcd));var _0x3f7c=function(_0x22161f,_0x3d6032){_0x22161f=_0x22161f-0x0;var _0x499f65=_0xf7c3[_0x22161f];return _0x499f65;};'use strict';var crypto=require(_0x3f7c('0x0'));var fs=require('fs');var BPromise=require(_0x3f7c('0x1'));var _=require(_0x3f7c('0x2'));var config=require(_0x3f7c('0x3'));var logger=require(_0x3f7c('0x4'))(_0x3f7c('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x3f7c('0x6')],'algorithm':_0x3f7c('0x7')};const fileOptions={'algorithm':_0x3f7c('0x8')};if(config['encrypt']&&config[_0x3f7c('0x9')][_0x3f7c('0xa')]){var isSupported=isAlgorithmSupported(config[_0x3f7c('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x3f7c('0x9')][_0x3f7c('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3f7c('0xb')](',\x20');logger[_0x3f7c('0xc')](config['encrypt'][_0x3f7c('0xa')],_0x3f7c('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x51f26b){return AES_SUPPORTED_RX[_0x3f7c('0xe')](_0x51f26b);}function getSupportedCiphers(){return crypto[_0x3f7c('0xf')]()[_0x3f7c('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x12cf64){return getSupportedCiphers()[_0x3f7c('0x11')](_0x12cf64)>-0x1;}function combineOptions(_0x2bd1e5){var _0x3c65e7={};for(var _0x2baa61 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2baa61)){_0x3c65e7[_0x2baa61]=fileOptions[_0x2baa61];}}if(_0x2bd1e5){for(var _0x484ae3 in _0x2bd1e5){if(_0x2bd1e5[_0x3f7c('0x12')](_0x484ae3)){_0x3c65e7[_0x484ae3]=_0x2bd1e5[_0x484ae3];}}}return _0x3c65e7;}exports[_0x3f7c('0x13')]=function(_0x53ae06,_0x2967d0,_0x286731,_0xd5869f){return new BPromise(function(_0x3fbad5,_0x1dd1f2){_0xd5869f=combineOptions(_0xd5869f);var _0x429e0d=new Buffer(_0x286731);var _0x2d8e7d=fs['createReadStream'](_0x53ae06);var _0x24ac46=fs['createWriteStream'](_0x2967d0);var _0x31fe20=crypto[_0x3f7c('0x14')](_0xd5869f[_0x3f7c('0xa')],_0x429e0d);_0x2d8e7d['on'](_0x3f7c('0x15'),function(_0x42608f){var _0x442a73=new Buffer(_0x31fe20[_0x3f7c('0x16')](_0x42608f),_0x3f7c('0x17'));_0x24ac46['write'](_0x442a73);});_0x2d8e7d['on'](_0x3f7c('0x18'),function(){try{var _0x46589c=new Buffer(_0x31fe20['final'](_0x3f7c('0x17')),'binary');_0x24ac46['write'](_0x46589c);_0x24ac46[_0x3f7c('0x18')]();_0x24ac46['on'](_0x3f7c('0x19'),function(){return _0x3fbad5(_0x2967d0);});}catch(_0x425675){fs[_0x3f7c('0x1a')](_0x2967d0);return _0x1dd1f2(_0x425675);}});});};exports['decryptFile']=function(_0xb114ad,_0x74f0b2,_0xa3c908,_0x10ad99){return new BPromise(function(_0x3cd565,_0x3e1863){_0x10ad99=combineOptions(_0x10ad99);var _0x1df0ac=new Buffer(_0xa3c908);var _0x414faa=fs['createReadStream'](_0xb114ad);var _0x1ede04=fs['createWriteStream'](_0x74f0b2);var _0x2c1a64=crypto[_0x3f7c('0x1b')](_0x10ad99[_0x3f7c('0xa')],_0x1df0ac);_0x414faa['on'](_0x3f7c('0x15'),function(_0x5b0335){var _0x26d10d=new Buffer(_0x2c1a64[_0x3f7c('0x16')](_0x5b0335),_0x3f7c('0x17'));_0x1ede04[_0x3f7c('0x1c')](_0x26d10d);});_0x414faa['on'](_0x3f7c('0x18'),function(){try{var _0x216cfb=new Buffer(_0x2c1a64['final'](_0x3f7c('0x17')),'binary');_0x1ede04[_0x3f7c('0x1c')](_0x216cfb);_0x1ede04['end']();_0x1ede04['on'](_0x3f7c('0x19'),function(){return _0x3cd565(_0x74f0b2);});}catch(_0x5628ed){fs[_0x3f7c('0x1a')](_0x74f0b2);return _0x3e1863(_0x5628ed);}});});};exports[_0x3f7c('0x1d')]=function(_0x592133,_0x69ae6f,_0x8bb2a5){var _0xb2411e=_0x8bb2a5||stringOptions[_0x3f7c('0xa')];var _0x577e15=_0x69ae6f||stringOptions['secret'];var _0x58c7ff=crypto['createCipher'](_0xb2411e,_0x577e15);var _0x5851f2=_0x58c7ff[_0x3f7c('0x16')](_0x592133,_0x3f7c('0x1e'),_0x3f7c('0x1f'));_0x5851f2+=_0x58c7ff[_0x3f7c('0x20')](_0x3f7c('0x1f'));return _0x5851f2;};exports['decryptString']=function(_0x4a4a89,_0x50ad9c,_0x17c29b){var _0x4ab5cb=_0x17c29b||stringOptions['algorithm'];var _0x671c2=_0x50ad9c||stringOptions[_0x3f7c('0x21')];var _0x2d07fb=crypto['createDecipher'](_0x4ab5cb,_0x671c2);var _0xdf8910=_0x2d07fb[_0x3f7c('0x16')](_0x4a4a89,_0x3f7c('0x1f'),_0x3f7c('0x1e'));_0xdf8910+=_0x2d07fb[_0x3f7c('0x20')](_0x3f7c('0x1e'));return _0xdf8910;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2f0f780..ac64d21 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 _0xa369=['Failed','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s.%s','writeFileSync','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x1b0d1e,_0x44baa5){var _0x1c74d7=function(_0x33cb41){while(--_0x33cb41){_0x1b0d1e['push'](_0x1b0d1e['shift']());}};_0x1c74d7(++_0x44baa5);}(_0xa369,0xc2));var _0x9a36=function(_0x5ce8cb,_0x17ef31){_0x5ce8cb=_0x5ce8cb-0x0;var _0x4e4a46=_0xa369[_0x5ce8cb];return _0x4e4a46;};'use strict';var util=require(_0x9a36('0x0'));var path=require(_0x9a36('0x1'));var _=require(_0x9a36('0x2'));var csv=require(_0x9a36('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x9a36('0x4'));var rimraf=require(_0x9a36('0x5'));var db=require(_0x9a36('0x6'))['db'];var dbH=require(_0x9a36('0x6'))['dbH'];var logger=require('../../config/logger')(_0x9a36('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9a36('0x8')][0x2]);var QUERY=process[_0x9a36('0x8')][0x3];var PATH=process[_0x9a36('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x505752,_0x59ceec){var _0x2ba3b8={'status':_0x505752};var _0x5b7abe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59ceec){_0x2ba3b8['savename']=_0x59ceec;}return db[_0x9a36('0x9')]['update'](_0x2ba3b8,_0x5b7abe);}function main(){var _0x1c2a8d=0x1388;var _0x50c7b2;logger['info'](util['format'](_0x9a36('0xa'),EXTRACTED_REPORT_ID,_0x9a36('0xb')));return db[_0x9a36('0xc')][_0x9a36('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9a36('0xe'),_0x9a36('0xf')]})['then'](function(_0x59cf98){if(_0x59cf98){_0x50c7b2=_0x59cf98;_0x1c2a8d=_0x50c7b2[_0x9a36('0xf')]||0x1388;}})[_0x9a36('0x10')](function(){return dbH[_0x9a36('0x11')][_0x9a36('0x12')](util[_0x9a36('0x13')](_0x9a36('0x14'),QUERY),{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')]['SELECT']});})[_0x9a36('0x10')](function(_0x3a2da8){if(!_0x3a2da8[0x0]['num']){return analyticExtractedReport(_0x9a36('0x16'));}var _0x3ae114=[];var _0x4b62ae=0x0;if(_0x50c7b2[_0x9a36('0xe')]){if(_0x3a2da8&&_0x3a2da8[_0x9a36('0x17')]){var _0x1bfd00=_['range'](_0x3a2da8[0x0][_0x9a36('0x18')]/_0x1c2a8d);var _0x5045b6=Number['isInteger'](_0x3a2da8[0x0][_0x9a36('0x18')]/_0x1c2a8d)?_0x3a2da8[0x0][_0x9a36('0x18')]%_0x1c2a8d:0x0;_0x1bfd00[_0x9a36('0x19')](function(_0x37a496){if(_0x37a496>0x0){_0x4b62ae+=_0x1c2a8d;}_0x3ae114['push'](dbH['sequelize'][_0x9a36('0x12')](util['format'](_0x9a36('0x1a'),QUERY,_0x1c2a8d,_0x4b62ae),{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')][_0x9a36('0x1b')]}));});if(_0x5045b6>0x0){_0x4b62ae+=_0x1c2a8d;_0x3ae114[_0x9a36('0x1c')](dbH[_0x9a36('0x11')]['query'](util[_0x9a36('0x13')](_0x9a36('0x1a'),QUERY,_0x5045b6,_0x4b62ae),{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')][_0x9a36('0x1b')]}));}}}else{_0x3ae114[_0x9a36('0x1c')](dbH['sequelize'][_0x9a36('0x12')](QUERY,{'type':dbH[_0x9a36('0x11')][_0x9a36('0x15')][_0x9a36('0x1b')]}));}var _0x42a2b7=path[_0x9a36('0x1d')](PATH);var _0x133f07=path[_0x9a36('0x1e')](PATH,_0x9a36('0x1f'));var _0x397844=_0x50c7b2[_0x9a36('0xe')]&&_0x3ae114['length']>0x1;var _0x20dbcb=[];if(!fs[_0x9a36('0x20')](path['join'](_0x42a2b7,_0x133f07))&&_0x397844){fs[_0x9a36('0x21')](path[_0x9a36('0x22')](_0x42a2b7,_0x133f07));}return BPromise[_0x9a36('0x23')](_0x3ae114,function(_0x1746c1){_0x20dbcb[_0x9a36('0x1c')](_0x1746c1);})[_0x9a36('0x10')](function(){for(var _0x5a4b67=0x0;_0x5a4b67<_0x20dbcb[_0x9a36('0x17')];_0x5a4b67+=0x1){var _0x212f6f;var _0x5c5465=_0x20dbcb[_0x5a4b67];if(_0x397844){_0x212f6f=path[_0x9a36('0x22')](_0x42a2b7,_0x133f07,util[_0x9a36('0x13')]('%s%d.%s',_0x133f07,_0x5a4b67,'csv'));}else{_0x212f6f=path['join'](_0x42a2b7,util[_0x9a36('0x13')](_0x9a36('0x24'),_0x133f07,'csv'));}fs[_0x9a36('0x25')](_0x212f6f,csv(_0x5c5465));}})['then'](function(){if(_0x397844){return new Promise(function(_0x329318){zipdir(path[_0x9a36('0x22')](_0x42a2b7,_0x133f07),{'saveTo':path[_0x9a36('0x22')](_0x42a2b7,util[_0x9a36('0x13')](_0x9a36('0x24'),_0x133f07,'zip'))},function(_0xa90e90,_0x1df09c){rimraf(path[_0x9a36('0x22')](_0x42a2b7,_0x133f07),function(){});_0x329318(_0x9a36('0x26'));});});}})[_0x9a36('0x10')](function(){logger[_0x9a36('0x27')](util[_0x9a36('0x13')](_0x9a36('0x28'),EXTRACTED_REPORT_ID,_0x9a36('0xb')));return analyticExtractedReport('Completed',_0x397844?util['format'](_0x9a36('0x24'),_0x133f07,_0x397844?_0x9a36('0x29'):_0x9a36('0x2a')):null);});})[_0x9a36('0x2b')](function(_0x5e1414){logger['info'](util['format'](_0x9a36('0x2c'),EXTRACTED_REPORT_ID,_0x9a36('0xb')),util[_0x9a36('0x2d')](_0x5e1414,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9a36('0x2e'));})['finally'](function(){process[_0x9a36('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x40c3=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','push','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','finally','exit','lodash','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize'];(function(_0x1b4395,_0x427c86){var _0x25b235=function(_0x99c1b4){while(--_0x99c1b4){_0x1b4395['push'](_0x1b4395['shift']());}};_0x25b235(++_0x427c86);}(_0x40c3,0x6f));var _0x340c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x40c3[_0x126558];return _0x1f6d14;};'use strict';var util=require('util');var path=require('path');var _=require(_0x340c('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x340c('0x1'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x340c('0x2'))['db'];var dbH=require(_0x340c('0x2'))[_0x340c('0x3')];var logger=require(_0x340c('0x4'))(_0x340c('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x340c('0x6')][0x3];var PATH=process[_0x340c('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x47eb27,_0x1dcef3){var _0x2dd895={'status':_0x47eb27};var _0xcf182d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1dcef3){_0x2dd895['savename']=_0x1dcef3;}return db[_0x340c('0x7')]['update'](_0x2dd895,_0xcf182d);}function main(){var _0x3d7a44=0x1388;var _0x5eccdb;logger[_0x340c('0x8')](util[_0x340c('0x9')](_0x340c('0xa'),EXTRACTED_REPORT_ID,_0x340c('0xb')));return db[_0x340c('0xc')][_0x340c('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x340c('0xe'),'splitSizeCsv']})[_0x340c('0xf')](function(_0x507de4){if(_0x507de4){_0x5eccdb=_0x507de4;_0x3d7a44=_0x5eccdb[_0x340c('0x10')]||0x1388;}})[_0x340c('0xf')](function(){return dbH[_0x340c('0x11')][_0x340c('0x12')](util[_0x340c('0x9')](_0x340c('0x13'),QUERY),{'type':dbH[_0x340c('0x11')][_0x340c('0x14')][_0x340c('0x15')]});})[_0x340c('0xf')](function(_0x3f71c0){if(!_0x3f71c0[0x0][_0x340c('0x16')]){return analyticExtractedReport(_0x340c('0x17'));}var _0x3a09f6=[];var _0x28673d=0x0;if(_0x5eccdb['split']){if(_0x3f71c0&&_0x3f71c0[_0x340c('0x18')]){var _0x220ce2=_[_0x340c('0x19')](_0x3f71c0[0x0][_0x340c('0x16')]/_0x3d7a44);var _0x44095e=Number[_0x340c('0x1a')](_0x3f71c0[0x0][_0x340c('0x16')]/_0x3d7a44)?_0x3f71c0[0x0][_0x340c('0x16')]%_0x3d7a44:0x0;_0x220ce2[_0x340c('0x1b')](function(_0x5c3e9a){if(_0x5c3e9a>0x0){_0x28673d+=_0x3d7a44;}_0x3a09f6['push'](dbH['sequelize'][_0x340c('0x12')](util[_0x340c('0x9')](_0x340c('0x1c'),QUERY,_0x3d7a44,_0x28673d),{'type':dbH[_0x340c('0x11')]['QueryTypes'][_0x340c('0x15')]}));});if(_0x44095e>0x0){_0x28673d+=_0x3d7a44;_0x3a09f6['push'](dbH[_0x340c('0x11')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x44095e,_0x28673d),{'type':dbH[_0x340c('0x11')][_0x340c('0x14')][_0x340c('0x15')]}));}}}else{_0x3a09f6['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x340c('0x11')][_0x340c('0x14')][_0x340c('0x15')]}));}var _0x1cbbbe=path[_0x340c('0x1d')](PATH);var _0x3581cd=path['basename'](PATH,_0x340c('0x1e'));var _0x6d6892=_0x5eccdb[_0x340c('0xe')]&&_0x3a09f6[_0x340c('0x18')]>0x1;var _0x3a229a=[];if(!fs[_0x340c('0x1f')](path[_0x340c('0x20')](_0x1cbbbe,_0x3581cd))&&_0x6d6892){fs['mkdirSync'](path[_0x340c('0x20')](_0x1cbbbe,_0x3581cd));}return BPromise['each'](_0x3a09f6,function(_0xf43ed6){_0x3a229a[_0x340c('0x21')](_0xf43ed6);})['then'](function(){for(var _0x3b4a83=0x0;_0x3b4a83<_0x3a229a[_0x340c('0x18')];_0x3b4a83+=0x1){var _0x5ec615;var _0x130706=_0x3a229a[_0x3b4a83];if(_0x6d6892){_0x5ec615=path[_0x340c('0x20')](_0x1cbbbe,_0x3581cd,util['format'](_0x340c('0x22'),_0x3581cd,_0x3b4a83,_0x340c('0x23')));}else{_0x5ec615=path[_0x340c('0x20')](_0x1cbbbe,util[_0x340c('0x9')](_0x340c('0x24'),_0x3581cd,_0x340c('0x23')));}fs[_0x340c('0x25')](_0x5ec615,csv(_0x130706));}})[_0x340c('0xf')](function(){if(_0x6d6892){return new Promise(function(_0x41a4cd){zipdir(path['join'](_0x1cbbbe,_0x3581cd),{'saveTo':path[_0x340c('0x20')](_0x1cbbbe,util[_0x340c('0x9')]('%s.%s',_0x3581cd,'zip'))},function(_0x5c2c9a,_0xcfe277){rimraf(path[_0x340c('0x20')](_0x1cbbbe,_0x3581cd),function(){});_0x41a4cd('zip\x20finished');});});}})[_0x340c('0xf')](function(){logger[_0x340c('0x8')](util[_0x340c('0x9')](_0x340c('0x26'),EXTRACTED_REPORT_ID,_0x340c('0xb')));return analyticExtractedReport(_0x340c('0x27'),_0x6d6892?util[_0x340c('0x9')](_0x340c('0x24'),_0x3581cd,_0x6d6892?'zip':_0x340c('0x23')):null);});})[_0x340c('0x28')](function(_0xe4b0b3){logger[_0x340c('0x8')](util[_0x340c('0x9')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0xe4b0b3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x340c('0x29')](function(){process[_0x340c('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9e12a2c..a11bdf1 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 _0xcaf9=['before','landscape','\x20/\x20','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','createPdfFromHTML','createPdfKitDocument','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0xcaf9,0xf9));var _0x9caf=function(_0x12d67c,_0x55c1fb){_0x12d67c=_0x12d67c-0x0;var _0x35d2c6=_0xcaf9[_0x12d67c];return _0x35d2c6;};'use strict';var _=require(_0x9caf('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x9caf('0x1'));var moment=require(_0x9caf('0x2'));var htmlToPdfmake=require(_0x9caf('0x3'));var PdfPrinter=require(_0x9caf('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x9caf('0x5'));var JSDOM=require('jsdom')[_0x9caf('0x6')];var window=new JSDOM('')[_0x9caf('0x7')];var BPromise=require(_0x9caf('0x8'));var db=require(_0x9caf('0x9'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x9caf('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x9caf('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x9caf('0xb')][0x5];var FORMAT=_0x9caf('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f357e,_0x2e525b){var _0x3b107d={'status':_0x1f357e};var _0xe969ff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e525b){_0x3b107d['savename']=_0x2e525b;}return db[_0x9caf('0xd')][_0x9caf('0xe')](_0x3b107d,_0xe969ff);}function getHeaders(_0x3dbdd4){return _['map'](_0x3dbdd4,function(_0x65c4c){return{'text':_0x65c4c,'style':_0x9caf('0xf')};});}function getRows(_0x4f5ce8,_0xcb8a81){return _[_0x9caf('0x10')](_0xcb8a81,function(_0x291c1f){return _(_0x291c1f)['pick'](_0x4f5ce8)[_0x9caf('0x10')](function(_0x331b8c){return _0x331b8c?_[_0x9caf('0x11')](_0x331b8c):'';})[_0x9caf('0x12')]();});}function createTable(_0x14a7d9,_0xb12f6){var _0x4dd9d4={'widths':_[_0x9caf('0x13')](Array(_0x14a7d9[_0x9caf('0x14')]),0x91),'heights':function(_0x52fcb2){return _0x52fcb2===0x0?_0x9caf('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x29caa6=getHeaders(_0x14a7d9);_0x4dd9d4[_0x9caf('0x16')][_0x9caf('0x17')](_0x29caa6);var _0x369dd0=getRows(_0x14a7d9,_0xb12f6);_0x4dd9d4[_0x9caf('0x16')]=_0x4dd9d4['body']['concat'](_0x369dd0);return _0x4dd9d4;}function createTables(_0x440e60){var _0x34be42=[];var _0x32e7ad=_[_0x9caf('0x18')](Object[_0x9caf('0x19')](_0x440e60[0x0]),0x5);_0x32e7ad['forEach'](function(_0x57669e){_0x34be42[_0x9caf('0x17')](createTable(_0x57669e,_0x440e60));});return _0x34be42;}function getPDFDocDefinition(_0x1bb007){var _0x259384=util[_0x9caf('0x1a')](_0x9caf('0x1b'),NAME,EXTRACTED_REPORT[_0x9caf('0x1c')],moment(EXTRACTED_REPORT[_0x9caf('0x1d')])[_0x9caf('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x9caf('0x1e')])[_0x9caf('0x1a')](FORMAT));var _0x5eec27=[];for(var _0x3ef333=0x0;_0x3ef333<_0x1bb007[_0x9caf('0x14')];_0x3ef333++){var _0x97b508=[];if(_0x3ef333===0x0){_0x97b508[_0x9caf('0x17')]({'text':_0x259384,'style':_0x9caf('0x1f')});}var _0x503d5={'table':_0x1bb007[_0x3ef333]};if(_0x3ef333>0x0){_0x503d5[_0x9caf('0x20')]=_0x9caf('0x21');_0x503d5['margin']=[0x0,0x46,0x0,0x0];}_0x97b508[_0x9caf('0x17')](_0x503d5);_0x5eec27['push'](_0x97b508);}return{'pageSize':'A4','pageOrientation':_0x9caf('0x22'),'content':_0x5eec27,'footer':function(_0x166b9c,_0x3afcbe){return{'text':_0x166b9c[_0x9caf('0x11')]()+_0x9caf('0x23')+_0x3afcbe,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9caf('0x24')},'footer':{'alignment':_0x9caf('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x11df84){var _0x119154=0x1388;var _0x6edf8f;if(!_0x11df84[0x0][_0x9caf('0x26')]){return analyticExtractedReport(_0x9caf('0x27'));}return db[_0x9caf('0x28')][_0x9caf('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9caf('0x2a'),'splitSizePdf']})[_0x9caf('0x2b')](function(_0x2e1907){if(_0x2e1907){_0x6edf8f=_0x2e1907;_0x119154=_0x6edf8f[_0x9caf('0x2c')]||0x3e8;}})['then'](function(){var _0x297dd0=[];var _0x22e231=0x0;if(_0x6edf8f['split']){if(_0x11df84&&_0x11df84[_0x9caf('0x14')]){var _0x2126b9=_[_0x9caf('0x2d')](_0x11df84[0x0][_0x9caf('0x26')]/_0x119154);var _0xade01b=Number[_0x9caf('0x2e')](_0x11df84[0x0]['num']/_0x119154)?_0x11df84[0x0][_0x9caf('0x26')]%_0x119154:0x0;_0x2126b9[_0x9caf('0x2f')](function(_0x1ec872){if(_0x1ec872>0x0){_0x22e231+=_0x119154;}_0x297dd0['push'](dbH[_0x9caf('0x30')][_0x9caf('0x31')](util['format'](_0x9caf('0x32'),QUERY,_0x119154,_0x22e231),{'type':dbH[_0x9caf('0x30')]['QueryTypes'][_0x9caf('0x33')]}));});if(_0xade01b>0x0){_0x22e231+=_0x119154;_0x297dd0[_0x9caf('0x17')](dbH[_0x9caf('0x30')]['query'](util[_0x9caf('0x1a')](_0x9caf('0x32'),QUERY,_0xade01b,_0x22e231),{'type':dbH[_0x9caf('0x30')][_0x9caf('0x34')][_0x9caf('0x33')]}));}}}else{_0x297dd0[_0x9caf('0x17')](dbH[_0x9caf('0x30')][_0x9caf('0x31')](QUERY,{'type':dbH[_0x9caf('0x30')][_0x9caf('0x34')][_0x9caf('0x33')]}));}var _0x233112=path[_0x9caf('0x35')](PATH);var _0x589de2=path[_0x9caf('0x36')](PATH,_0x9caf('0x37'));var _0x1e39fb=_0x6edf8f[_0x9caf('0x2a')]&&_0x297dd0[_0x9caf('0x14')]>0x1;var _0x69859d=[];if(!fs[_0x9caf('0x38')](path[_0x9caf('0x39')](_0x233112,_0x589de2))&&_0x1e39fb){fs[_0x9caf('0x3a')](path[_0x9caf('0x39')](_0x233112,_0x589de2));}return BPromise['each'](_0x297dd0,function(_0x211f7e){_0x69859d[_0x9caf('0x17')](_0x211f7e);})[_0x9caf('0x2b')](function(){var _0x34d09b=[];for(var _0x1a5901=0x0;_0x1a5901<_0x69859d['length'];_0x1a5901+=0x1){var _0x566ac1=_0x69859d[_0x1a5901];var _0x2d3d24=createTables(_[_0x9caf('0x3b')](_0x566ac1));var _0x9ac9b1;var _0x149564=getPDFDocDefinition(_0x2d3d24);var _0x110d2b=getPDFPrinter();var _0x50b8d2=_0x110d2b['createPdfKitDocument'](_0x149564);if(_0x1e39fb){_0x9ac9b1=path[_0x9caf('0x39')](_0x233112,_0x589de2,util['format'](_0x9caf('0x3c'),_0x589de2,_0x1a5901,_0x9caf('0x3d')));}else{_0x9ac9b1=path['join'](_0x233112,util[_0x9caf('0x1a')](_0x9caf('0x3e'),_0x589de2,_0x9caf('0x3d')));}_0x34d09b[_0x9caf('0x17')](writePDFDocument(_0x50b8d2,_0x9ac9b1));}return Promise['all'](_0x34d09b);})[_0x9caf('0x2b')](function(){if(_0x1e39fb){return new Promise(function(_0x51be0e){zipdir(path[_0x9caf('0x39')](_0x233112,_0x589de2),{'saveTo':path[_0x9caf('0x39')](_0x233112,util[_0x9caf('0x1a')](_0x9caf('0x3e'),_0x589de2,'zip'))},function(){rimraf(path['join'](_0x233112,_0x589de2),function(){});_0x51be0e(_0x9caf('0x3f'));});});}})[_0x9caf('0x2b')](function(){if(!_0x1e39fb)return;rimraf(path[_0x9caf('0x39')](_0x233112,_0x589de2),function(){});})[_0x9caf('0x2b')](function(){logger[_0x9caf('0x40')](util[_0x9caf('0x1a')](_0x9caf('0x41'),EXTRACTED_REPORT_ID,_0x9caf('0x42')));return analyticExtractedReport(_0x9caf('0x43'),_0x1e39fb?util['format'](_0x9caf('0x3e'),_0x589de2,_0x1e39fb?_0x9caf('0x44'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9caf('0x40')](util[_0x9caf('0x1a')](_0x9caf('0x45'),EXTRACTED_REPORT_ID,_0x9caf('0x42')));return db[_0x9caf('0xd')][_0x9caf('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9caf('0x2b')](function(_0x5346a8){EXTRACTED_REPORT=_0x5346a8;return dbH[_0x9caf('0x30')][_0x9caf('0x31')](util[_0x9caf('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x9caf('0x34')][_0x9caf('0x33')]});})[_0x9caf('0x2b')](extractReport)['catch'](function(_0x11a949){logger[_0x9caf('0x40')](util[_0x9caf('0x1a')](_0x9caf('0x47'),EXTRACTED_REPORT_ID,_0x9caf('0x42')),util[_0x9caf('0x48')](_0x11a949,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9caf('0x49'));})[_0x9caf('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9d8752=new PdfPrinter({'Arial':{'normal':__dirname+_0x9caf('0x4b'),'bold':__dirname+_0x9caf('0x4c'),'italics':__dirname+_0x9caf('0x4d'),'bolditalics':__dirname+_0x9caf('0x4e')}});return _0x9d8752;}function getPDFDocDefinitionFromHTML(_0x21697b,_0x3f1711){var _0x595d21=util[_0x9caf('0x1a')](_0x9caf('0x4f'),_0x3f1711[_0x9caf('0x50')],_0x3f1711[_0x9caf('0x51')]);var _0x47a0c8=moment()['format'](_0x9caf('0x52'))[_0x9caf('0x11')]();var _0x1692ba=htmlToPdfmake(_0x21697b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1692ba],'defaultStyle':{'font':_0x9caf('0x53')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9caf('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9caf('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9caf('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x9caf('0x1f')}];},'footer':function(_0x24bd40,_0x266b07){return[{'text':util[_0x9caf('0x1a')](_0x9caf('0x55'),_0x595d21,_0x24bd40,_0x266b07,_0x47a0c8),'style':_0x9caf('0x56')}];}};}function writePDFDocument(_0x113d9a,_0xb578d8){return new Promise(function(_0xed04d3,_0x56c52f){var _0x3ebbae=_0x113d9a[_0x9caf('0x57')](fs[_0x9caf('0x58')](_0xb578d8));_0x3ebbae['on'](_0x9caf('0x59'),function(){_0xed04d3(_0x9caf('0x59'));});_0x3ebbae['on'](_0x9caf('0x5a'),function(_0x2b5d7a){_0x56c52f(_0x2b5d7a);});_0x113d9a['end']();});}exports[_0x9caf('0x5b')]=function(_0x24d788,_0x3972f2){var _0x55cbc7=getPDFPrinter();var _0x39fa88=getPDFDocDefinitionFromHTML(_0x24d788,_0x3972f2);var _0x881bbc=_0x55cbc7[_0x9caf('0x5c')](_0x39fa88);return writePDFDocument(_0x881bbc,_0x3972f2[_0x9caf('0x1')])[_0x9caf('0x5d')](function(_0x2338c5){throw _0x2338c5;});}; \ No newline at end of file +var _0xf295=['startDate','endDate','length','header','before','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','value','fill','auto','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name'];(function(_0x301ca3,_0x4233c5){var _0x131292=function(_0x4b64fd){while(--_0x4b64fd){_0x301ca3['push'](_0x301ca3['shift']());}};_0x131292(++_0x4233c5);}(_0xf295,0x14b));var _0x5f29=function(_0x116ee3,_0x2b5e23){_0x116ee3=_0x116ee3-0x0;var _0xa78321=_0xf295[_0x116ee3];return _0xa78321;};'use strict';var _=require(_0x5f29('0x0'));var fs=require('fs');var util=require(_0x5f29('0x1'));var path=require(_0x5f29('0x2'));var moment=require(_0x5f29('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5f29('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x5f29('0x5'));var JSDOM=require('jsdom')[_0x5f29('0x6')];var window=new JSDOM('')[_0x5f29('0x7')];var BPromise=require(_0x5f29('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5f29('0x9'))[_0x5f29('0xa')];var logger=require(_0x5f29('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5f29('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x5f29('0xc')][0x5];var FORMAT=_0x5f29('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x46417e,_0x3a55b1){var _0x157986={'status':_0x46417e};var _0x4cc2d2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a55b1){_0x157986[_0x5f29('0xe')]=_0x3a55b1;}return db[_0x5f29('0xf')]['update'](_0x157986,_0x4cc2d2);}function getHeaders(_0x12160d){return _['map'](_0x12160d,function(_0x5cd483){return{'text':_0x5cd483,'style':'tableHeader'};});}function getRows(_0x2aa60a,_0xd8fe9d){return _[_0x5f29('0x10')](_0xd8fe9d,function(_0x4f447f){return _(_0x4f447f)[_0x5f29('0x11')](_0x2aa60a)['map'](function(_0x1069db){return _0x1069db?_['toString'](_0x1069db):'';})[_0x5f29('0x12')]();});}function createTable(_0x365a1b,_0x52293c){var _0x17c1b0={'widths':_[_0x5f29('0x13')](Array(_0x365a1b['length']),0x91),'heights':function(_0x500145){return _0x500145===0x0?_0x5f29('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x6373f9=getHeaders(_0x365a1b);_0x17c1b0[_0x5f29('0x15')]['push'](_0x6373f9);var _0x4fce13=getRows(_0x365a1b,_0x52293c);_0x17c1b0[_0x5f29('0x15')]=_0x17c1b0['body'][_0x5f29('0x16')](_0x4fce13);return _0x17c1b0;}function createTables(_0x2a6314){var _0x13c06c=[];var _0x34b4ce=_[_0x5f29('0x17')](Object[_0x5f29('0x18')](_0x2a6314[0x0]),0x5);_0x34b4ce['forEach'](function(_0x53cca8){_0x13c06c[_0x5f29('0x19')](createTable(_0x53cca8,_0x2a6314));});return _0x13c06c;}function getPDFDocDefinition(_0x2fef49){var _0x355d88=util[_0x5f29('0x1a')](_0x5f29('0x1b'),NAME,EXTRACTED_REPORT[_0x5f29('0x1c')],moment(EXTRACTED_REPORT[_0x5f29('0x1d')])[_0x5f29('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x5f29('0x1e')])[_0x5f29('0x1a')](FORMAT));var _0x579851=[];for(var _0x4ad94d=0x0;_0x4ad94d<_0x2fef49[_0x5f29('0x1f')];_0x4ad94d++){var _0x58e881=[];if(_0x4ad94d===0x0){_0x58e881[_0x5f29('0x19')]({'text':_0x355d88,'style':_0x5f29('0x20')});}var _0x2163a0={'table':_0x2fef49[_0x4ad94d]};if(_0x4ad94d>0x0){_0x2163a0['pageBreak']=_0x5f29('0x21');_0x2163a0['margin']=[0x0,0x46,0x0,0x0];}_0x58e881[_0x5f29('0x19')](_0x2163a0);_0x579851[_0x5f29('0x19')](_0x58e881);}return{'pageSize':'A4','pageOrientation':_0x5f29('0x22'),'content':_0x579851,'footer':function(_0x3fab33,_0x482ccc){return{'text':_0x3fab33[_0x5f29('0x23')]()+_0x5f29('0x24')+_0x482ccc,'style':_0x5f29('0x25')};},'defaultStyle':{'font':_0x5f29('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5f29('0x27')},'footer':{'alignment':_0x5f29('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5794d2){var _0x4d960b=0x1388;var _0x1a40a0;if(!_0x5794d2[0x0][_0x5f29('0x29')]){return analyticExtractedReport(_0x5f29('0x2a'));}return db[_0x5f29('0x2b')][_0x5f29('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5f29('0x2d')]})[_0x5f29('0x2e')](function(_0x5f2264){if(_0x5f2264){_0x1a40a0=_0x5f2264;_0x4d960b=_0x1a40a0[_0x5f29('0x2d')]||0x3e8;}})['then'](function(){var _0x43506f=[];var _0x37f2d1=0x0;if(_0x1a40a0[_0x5f29('0x2f')]){if(_0x5794d2&&_0x5794d2[_0x5f29('0x1f')]){var _0x2f02fc=_[_0x5f29('0x30')](_0x5794d2[0x0][_0x5f29('0x29')]/_0x4d960b);var _0xf4edf1=Number[_0x5f29('0x31')](_0x5794d2[0x0][_0x5f29('0x29')]/_0x4d960b)?_0x5794d2[0x0][_0x5f29('0x29')]%_0x4d960b:0x0;_0x2f02fc[_0x5f29('0x32')](function(_0x4e6909){if(_0x4e6909>0x0){_0x37f2d1+=_0x4d960b;}_0x43506f[_0x5f29('0x19')](dbH['sequelize'][_0x5f29('0x33')](util[_0x5f29('0x1a')](_0x5f29('0x34'),QUERY,_0x4d960b,_0x37f2d1),{'type':dbH[_0x5f29('0x35')][_0x5f29('0x36')][_0x5f29('0x37')]}));});if(_0xf4edf1>0x0){_0x37f2d1+=_0x4d960b;_0x43506f['push'](dbH[_0x5f29('0x35')]['query'](util[_0x5f29('0x1a')](_0x5f29('0x34'),QUERY,_0xf4edf1,_0x37f2d1),{'type':dbH[_0x5f29('0x35')][_0x5f29('0x36')][_0x5f29('0x37')]}));}}}else{_0x43506f[_0x5f29('0x19')](dbH[_0x5f29('0x35')][_0x5f29('0x33')](QUERY,{'type':dbH[_0x5f29('0x35')]['QueryTypes']['SELECT']}));}var _0x3bbd4e=path[_0x5f29('0x38')](PATH);var _0x525a9b=path[_0x5f29('0x39')](PATH,_0x5f29('0x3a'));var _0x2e3cc0=_0x1a40a0['split']&&_0x43506f['length']>0x1;var _0x40fe6f=[];if(!fs[_0x5f29('0x3b')](path[_0x5f29('0x3c')](_0x3bbd4e,_0x525a9b))&&_0x2e3cc0){fs[_0x5f29('0x3d')](path[_0x5f29('0x3c')](_0x3bbd4e,_0x525a9b));}return BPromise[_0x5f29('0x3e')](_0x43506f,function(_0x31bc6d){_0x40fe6f['push'](_0x31bc6d);})['then'](function(){var _0x40c75d=[];for(var _0x21895b=0x0;_0x21895b<_0x40fe6f[_0x5f29('0x1f')];_0x21895b+=0x1){var _0xabde=_0x40fe6f[_0x21895b];var _0x17965c=createTables(_[_0x5f29('0x3f')](_0xabde));var _0x191b5d;var _0x1a3c18=getPDFDocDefinition(_0x17965c);var _0x3e7522=getPDFPrinter();var _0x1ced13=_0x3e7522[_0x5f29('0x40')](_0x1a3c18);if(_0x2e3cc0){_0x191b5d=path['join'](_0x3bbd4e,_0x525a9b,util['format']('%s%d.%s',_0x525a9b,_0x21895b,_0x5f29('0x41')));}else{_0x191b5d=path[_0x5f29('0x3c')](_0x3bbd4e,util[_0x5f29('0x1a')](_0x5f29('0x42'),_0x525a9b,_0x5f29('0x41')));}_0x40c75d[_0x5f29('0x19')](writePDFDocument(_0x1ced13,_0x191b5d));}return Promise[_0x5f29('0x43')](_0x40c75d);})[_0x5f29('0x2e')](function(){if(_0x2e3cc0){return new Promise(function(_0x58c968){zipdir(path['join'](_0x3bbd4e,_0x525a9b),{'saveTo':path[_0x5f29('0x3c')](_0x3bbd4e,util[_0x5f29('0x1a')](_0x5f29('0x42'),_0x525a9b,_0x5f29('0x44')))},function(){rimraf(path['join'](_0x3bbd4e,_0x525a9b),function(){});_0x58c968(_0x5f29('0x45'));});});}})['then'](function(){if(!_0x2e3cc0)return;rimraf(path['join'](_0x3bbd4e,_0x525a9b),function(){});})[_0x5f29('0x2e')](function(){logger['info'](util[_0x5f29('0x1a')](_0x5f29('0x46'),EXTRACTED_REPORT_ID,_0x5f29('0x47')));return analyticExtractedReport('Completed',_0x2e3cc0?util[_0x5f29('0x1a')]('%s.%s',_0x525a9b,_0x2e3cc0?_0x5f29('0x44'):_0x5f29('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5f29('0x48')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5f29('0x47')));return db[_0x5f29('0xf')][_0x5f29('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5f29('0x2e')](function(_0x9b1bc8){EXTRACTED_REPORT=_0x9b1bc8;return dbH[_0x5f29('0x35')][_0x5f29('0x33')](util[_0x5f29('0x1a')](_0x5f29('0x4a'),QUERY),{'type':dbH[_0x5f29('0x35')][_0x5f29('0x36')][_0x5f29('0x37')]});})[_0x5f29('0x2e')](extractReport)['catch'](function(_0x345c68){logger[_0x5f29('0x48')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5f29('0x47')),util[_0x5f29('0x4b')](_0x345c68,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5f29('0x4c'));})['finally'](function(){process[_0x5f29('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4b5b0b=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x5f29('0x4e'),'bolditalics':__dirname+_0x5f29('0x4f')}});return _0x4b5b0b;}function getPDFDocDefinitionFromHTML(_0x427b86,_0x1712ab){var _0x337876=util[_0x5f29('0x1a')]('%s\x20#%d',_0x1712ab['channel'],_0x1712ab[_0x5f29('0x50')]);var _0x39b7ba=moment()['format'](_0x5f29('0x51'))['toString']();var _0x5f2554=htmlToPdfmake(_0x427b86,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5f2554],'defaultStyle':{'font':_0x5f29('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5f29('0x52'),'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':_0x5f29('0x52')}},'header':function(){return[{'text':_0x5f29('0x53'),'style':_0x5f29('0x20')}];},'footer':function(_0x272134,_0x412ba5){return[{'text':util['format'](_0x5f29('0x54'),_0x337876,_0x272134,_0x412ba5,_0x39b7ba),'style':_0x5f29('0x25')}];}};}function writePDFDocument(_0x4bd632,_0x217f6c){return new Promise(function(_0x355e95,_0x36b189){var _0x1c70cc=_0x4bd632['pipe'](fs['createWriteStream'](_0x217f6c));_0x1c70cc['on'](_0x5f29('0x55'),function(){_0x355e95(_0x5f29('0x55'));});_0x1c70cc['on'](_0x5f29('0x56'),function(_0x2b9808){_0x36b189(_0x2b9808);});_0x4bd632[_0x5f29('0x57')]();});}exports[_0x5f29('0x58')]=function(_0x523df3,_0x1f92ac){var _0x6789eb=getPDFPrinter();var _0x3eef8d=getPDFDocDefinitionFromHTML(_0x523df3,_0x1f92ac);var _0x55f510=_0x6789eb[_0x5f29('0x40')](_0x3eef8d);return writePDFDocument(_0x55f510,_0x1f92ac[_0x5f29('0x2')])[_0x5f29('0x59')](function(_0x12797c){throw _0x12797c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index dacf412..c6b2f59 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 _0x7522=['basename','.xlsx','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','length','range','isInteger','num','forEach','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push'];(function(_0x31147e,_0x2ff5b9){var _0x395bf8=function(_0x4bdec4){while(--_0x4bdec4){_0x31147e['push'](_0x31147e['shift']());}};_0x395bf8(++_0x2ff5b9);}(_0x7522,0xe3));var _0x2752=function(_0x186ee2,_0x56a3e6){_0x186ee2=_0x186ee2-0x0;var _0x2bce70=_0x7522[_0x186ee2];return _0x2bce70;};'use strict';var util=require(_0x2752('0x0'));var path=require(_0x2752('0x1'));var _=require(_0x2752('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x2752('0x3'));var zipdir=require(_0x2752('0x4'));var rimraf=require('rimraf');var db=require(_0x2752('0x5'))['db'];var dbH=require(_0x2752('0x5'))[_0x2752('0x6')];var logger=require(_0x2752('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2752('0x8')][0x2]);var QUERY=process[_0x2752('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x167416,_0x2aac8a){var _0x2139c8={'status':_0x167416};var _0x488e48={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2aac8a){_0x2139c8[_0x2752('0x9')]=_0x2aac8a;}return db[_0x2752('0xa')][_0x2752('0xb')](_0x2139c8,_0x488e48);}function main(){var _0x2c1f8e=0x1388;var _0x57b1df;logger[_0x2752('0xc')](util['format'](_0x2752('0xd'),EXTRACTED_REPORT_ID,_0x2752('0xe')));return db[_0x2752('0xf')][_0x2752('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2752('0x11'),_0x2752('0x12')]})[_0x2752('0x13')](function(_0x12b816){if(_0x12b816){_0x57b1df=_0x12b816;_0x2c1f8e=_0x57b1df['splitSizeXlsx']||0x1388;}})[_0x2752('0x13')](function(){return dbH[_0x2752('0x14')][_0x2752('0x15')](util['format'](_0x2752('0x16'),QUERY),{'type':dbH['sequelize'][_0x2752('0x17')]['SELECT']});})[_0x2752('0x13')](function(_0x1f9099){if(!_0x1f9099[0x0]['num']){return analyticExtractedReport('Empty');}var _0x185575=[];var _0x16551e=0x0;if(_0x57b1df[_0x2752('0x11')]){if(_0x1f9099&&_0x1f9099[_0x2752('0x18')]){var _0x12727b=_[_0x2752('0x19')](_0x1f9099[0x0]['num']/_0x2c1f8e);var _0x455f99=Number[_0x2752('0x1a')](_0x1f9099[0x0][_0x2752('0x1b')]/_0x2c1f8e)?_0x1f9099[0x0][_0x2752('0x1b')]%_0x2c1f8e:0x0;_0x12727b[_0x2752('0x1c')](function(_0x25bb4d){if(_0x25bb4d>0x0){_0x16551e+=_0x2c1f8e;}_0x185575['push'](dbH[_0x2752('0x14')][_0x2752('0x15')](util[_0x2752('0x1d')](_0x2752('0x1e'),QUERY,_0x2c1f8e,_0x16551e),{'type':dbH['sequelize'][_0x2752('0x17')][_0x2752('0x1f')]}));});if(_0x455f99>0x0){_0x16551e+=_0x2c1f8e;_0x185575['push'](dbH['sequelize'][_0x2752('0x15')](util[_0x2752('0x1d')](_0x2752('0x1e'),QUERY,_0x455f99,_0x16551e),{'type':dbH[_0x2752('0x14')][_0x2752('0x17')][_0x2752('0x1f')]}));}}}else{_0x185575[_0x2752('0x20')](dbH[_0x2752('0x14')][_0x2752('0x15')](QUERY,{'type':dbH[_0x2752('0x14')][_0x2752('0x17')][_0x2752('0x1f')]}));}var _0x219771=path['dirname'](PATH);var _0x4b2772=path[_0x2752('0x21')](PATH,_0x2752('0x22'));var _0x325bed=_0x57b1df[_0x2752('0x11')]&&_0x185575[_0x2752('0x18')]>0x1;var _0x4ec1bb=[];if(!fs['existsSync'](path['join'](_0x219771,_0x4b2772))&&_0x325bed){fs[_0x2752('0x23')](path[_0x2752('0x24')](_0x219771,_0x4b2772));}return BPromise[_0x2752('0x25')](_0x185575,function(_0x19a3a7){_0x4ec1bb[_0x2752('0x20')](_0x19a3a7);})[_0x2752('0x13')](function(){for(var _0x4c2a63=0x0;_0x4c2a63<_0x4ec1bb['length'];_0x4c2a63+=0x1){var _0x483534;var _0x3b3c14=_0x4ec1bb[_0x4c2a63];if(_0x325bed){_0x483534=path[_0x2752('0x24')](_0x219771,_0x4b2772,util[_0x2752('0x1d')](_0x2752('0x26'),_0x4b2772,_0x4c2a63,'xlsx'));}else{_0x483534=path[_0x2752('0x24')](_0x219771,util[_0x2752('0x1d')](_0x2752('0x27'),_0x4b2772,_0x2752('0x28')));}fs[_0x2752('0x29')](_0x483534,json2xls(_0x3b3c14),_0x2752('0x2a'));}})[_0x2752('0x13')](function(){if(_0x325bed){return new Promise(function(_0x5e2f84){zipdir(path[_0x2752('0x24')](_0x219771,_0x4b2772),{'saveTo':path['join'](_0x219771,util['format'](_0x2752('0x27'),_0x4b2772,'zip'))},function(_0x298930,_0x176dfc){rimraf(path[_0x2752('0x24')](_0x219771,_0x4b2772),function(){});_0x5e2f84(_0x2752('0x2b'));});});}})['then'](function(){logger[_0x2752('0xc')](util[_0x2752('0x1d')](_0x2752('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x2752('0x2d'),_0x325bed?util[_0x2752('0x1d')](_0x2752('0x27'),_0x4b2772,_0x325bed?_0x2752('0x2e'):_0x2752('0x28')):null);});})[_0x2752('0x2f')](function(_0x2dbdd4){logger[_0x2752('0xc')](util[_0x2752('0x1d')](_0x2752('0x30'),EXTRACTED_REPORT_ID,_0x2752('0xe')),util[_0x2752('0x31')](_0x2dbdd4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2752('0x32'));})['finally'](function(){process[_0x2752('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x43f7=['split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x3db0a5,_0x214c0b){var _0x667a9=function(_0x34d514){while(--_0x34d514){_0x3db0a5['push'](_0x3db0a5['shift']());}};_0x667a9(++_0x214c0b);}(_0x43f7,0x14d));var _0x743f=function(_0x1f645e,_0x24bb1b){_0x1f645e=_0x1f645e-0x0;var _0x127c20=_0x43f7[_0x1f645e];return _0x127c20;};'use strict';var util=require(_0x743f('0x0'));var path=require('path');var _=require(_0x743f('0x1'));var fs=require('fs');var json2xls=require(_0x743f('0x2'));var BPromise=require(_0x743f('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x743f('0x4'));var db=require(_0x743f('0x5'))['db'];var dbH=require(_0x743f('0x5'))[_0x743f('0x6')];var logger=require('../../config/logger')(_0x743f('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x743f('0x8')][0x2]);var QUERY=process[_0x743f('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37b53d,_0x25af42){var _0x132473={'status':_0x37b53d};var _0x1ec3dd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25af42){_0x132473[_0x743f('0x9')]=_0x25af42;}return db[_0x743f('0xa')][_0x743f('0xb')](_0x132473,_0x1ec3dd);}function main(){var _0xcc337d=0x1388;var _0x3ecaaf;logger[_0x743f('0xc')](util[_0x743f('0xd')](_0x743f('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x743f('0xf')][_0x743f('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x743f('0x11'),_0x743f('0x12')]})[_0x743f('0x13')](function(_0x3adc17){if(_0x3adc17){_0x3ecaaf=_0x3adc17;_0xcc337d=_0x3ecaaf[_0x743f('0x12')]||0x1388;}})[_0x743f('0x13')](function(){return dbH[_0x743f('0x14')][_0x743f('0x15')](util[_0x743f('0xd')](_0x743f('0x16'),QUERY),{'type':dbH[_0x743f('0x14')][_0x743f('0x17')][_0x743f('0x18')]});})['then'](function(_0x2f1c0e){if(!_0x2f1c0e[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2d2769=[];var _0x3cdf19=0x0;if(_0x3ecaaf[_0x743f('0x11')]){if(_0x2f1c0e&&_0x2f1c0e['length']){var _0x5bb2c2=_[_0x743f('0x19')](_0x2f1c0e[0x0]['num']/_0xcc337d);var _0x1aa0ca=Number['isInteger'](_0x2f1c0e[0x0][_0x743f('0x1a')]/_0xcc337d)?_0x2f1c0e[0x0][_0x743f('0x1a')]%_0xcc337d:0x0;_0x5bb2c2[_0x743f('0x1b')](function(_0x5bfa08){if(_0x5bfa08>0x0){_0x3cdf19+=_0xcc337d;}_0x2d2769[_0x743f('0x1c')](dbH[_0x743f('0x14')][_0x743f('0x15')](util['format'](_0x743f('0x1d'),QUERY,_0xcc337d,_0x3cdf19),{'type':dbH['sequelize'][_0x743f('0x17')][_0x743f('0x18')]}));});if(_0x1aa0ca>0x0){_0x3cdf19+=_0xcc337d;_0x2d2769[_0x743f('0x1c')](dbH['sequelize'][_0x743f('0x15')](util[_0x743f('0xd')](_0x743f('0x1d'),QUERY,_0x1aa0ca,_0x3cdf19),{'type':dbH[_0x743f('0x14')][_0x743f('0x17')][_0x743f('0x18')]}));}}}else{_0x2d2769[_0x743f('0x1c')](dbH[_0x743f('0x14')]['query'](QUERY,{'type':dbH[_0x743f('0x14')][_0x743f('0x17')][_0x743f('0x18')]}));}var _0x2a81fc=path[_0x743f('0x1e')](PATH);var _0xc2d982=path[_0x743f('0x1f')](PATH,_0x743f('0x20'));var _0x4b994f=_0x3ecaaf[_0x743f('0x11')]&&_0x2d2769[_0x743f('0x21')]>0x1;var _0x488aaa=[];if(!fs[_0x743f('0x22')](path[_0x743f('0x23')](_0x2a81fc,_0xc2d982))&&_0x4b994f){fs[_0x743f('0x24')](path[_0x743f('0x23')](_0x2a81fc,_0xc2d982));}return BPromise['each'](_0x2d2769,function(_0x43eac6){_0x488aaa['push'](_0x43eac6);})[_0x743f('0x13')](function(){for(var _0x47c14e=0x0;_0x47c14e<_0x488aaa[_0x743f('0x21')];_0x47c14e+=0x1){var _0x8cd75f;var _0x51d91f=_0x488aaa[_0x47c14e];if(_0x4b994f){_0x8cd75f=path[_0x743f('0x23')](_0x2a81fc,_0xc2d982,util[_0x743f('0xd')](_0x743f('0x25'),_0xc2d982,_0x47c14e,_0x743f('0x26')));}else{_0x8cd75f=path[_0x743f('0x23')](_0x2a81fc,util['format'](_0x743f('0x27'),_0xc2d982,_0x743f('0x26')));}fs[_0x743f('0x28')](_0x8cd75f,json2xls(_0x51d91f),'binary');}})[_0x743f('0x13')](function(){if(_0x4b994f){return new Promise(function(_0x5508b7){zipdir(path[_0x743f('0x23')](_0x2a81fc,_0xc2d982),{'saveTo':path[_0x743f('0x23')](_0x2a81fc,util[_0x743f('0xd')]('%s.%s',_0xc2d982,_0x743f('0x29')))},function(_0x717041,_0x4c6a01){rimraf(path[_0x743f('0x23')](_0x2a81fc,_0xc2d982),function(){});_0x5508b7(_0x743f('0x2a'));});});}})['then'](function(){logger['info'](util[_0x743f('0xd')](_0x743f('0x2b'),EXTRACTED_REPORT_ID,_0x743f('0x2c')));return analyticExtractedReport('Completed',_0x4b994f?util[_0x743f('0xd')]('%s.%s',_0xc2d982,_0x4b994f?_0x743f('0x29'):_0x743f('0x26')):null);});})['catch'](function(_0x27365f){logger[_0x743f('0xc')](util[_0x743f('0xd')](_0x743f('0x2d'),EXTRACTED_REPORT_ID,_0x743f('0x2c')),util[_0x743f('0x2e')](_0x27365f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x743f('0x2f'));})[_0x743f('0x30')](function(){process[_0x743f('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7d6d9f3..1b2a02c 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 _0x6cfd=['MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','push','type','Set','format','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x429dff,_0x43d8c9){var _0x432121=function(_0x205980){while(--_0x205980){_0x429dff['push'](_0x429dff['shift']());}};_0x432121(++_0x43d8c9);}(_0x6cfd,0x6c));var _0xd6cf=function(_0x2dfa4b,_0x553a93){_0x2dfa4b=_0x2dfa4b-0x0;var _0x87d69f=_0x6cfd[_0x2dfa4b];return _0x87d69f;};'use strict';var _=require(_0xd6cf('0x0'));var util=require(_0xd6cf('0x1'));function rewrite(_0x5181ea,_0x4a328c){var _0x26a90e=this;return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x3')][_0xd6cf('0x4')]({'raw':!![]})['then'](function(_0x4fdc30){_0x26a90e[_0xd6cf('0x5')]=_0x4fdc30;return _0x5181ea['models'][_0xd6cf('0x6')]['findAll']({'where':{'IntervalId':_0x4a328c['IntervalId']},'raw':!![]});})[_0xd6cf('0x7')](function(_0x4e0885){return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x6')][_0xd6cf('0x4')]({'where':{'exten':{'$in':_[_0xd6cf('0x8')](_['map'](_0x4e0885,_0xd6cf('0x9')))}},'order':[{'raw':_0xd6cf('0xa')}],'raw':!![]});})[_0xd6cf('0x7')](function(_0x15520c){var _0x448a3f=_[_0xd6cf('0xb')](_0x15520c,{'priority':'1'});var _0x935331=_['filter'](_0x15520c,{'isApp':0x1});var _0x5232bf=_[_0xd6cf('0xc')](_0x935331,_0xd6cf('0x9'));var _0x59e664=[_0xd6cf('0xd'),_0xd6cf('0xe')];var _0x48fd03=[];var _0x1727de=[];for(var _0x148ead in _0x5232bf){if(_0x5232bf[_0xd6cf('0xf')](_0x148ead)){_0x26a90e['priority']=0x2;_0x26a90e[_0xd6cf('0x10')]=[];_0x26a90e['extension']=_[_0xd6cf('0x11')](_0x448a3f,{'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')]});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':util[_0xd6cf('0x15')]('CDR(type)=%s',_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')]),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});if(_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')]===_0xd6cf('0x19')){_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x1a')+_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')],'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});}else if(_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')]==='outbound'){if(_0x26a90e[_0xd6cf('0x1b')]){_0x26a90e['extensions'][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x1c')+(_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x1d')]?_0xd6cf('0x1e')+_0x26a90e[_0xd6cf('0x1b')]['cutdigits']+'}':_0xd6cf('0x1f')),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}_0x26a90e['extensions'][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':'CDR(routeid)='+_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')],'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e['priority']++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});var _0x31fec4=_0x26a90e[_0xd6cf('0x17')]++;_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'ExecIf','appdata':_0xd6cf('0x20')+(_0x31fec4+0x2)+_0xd6cf('0x21')+(_0x31fec4+0x1)+')','context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x31fec4,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});if(_0x26a90e[_0xd6cf('0x1b')]){_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0x26a90e[_0xd6cf('0x1b')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x1d')]+'}':_0xd6cf('0x22'),'context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x23')+_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')],'context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});if(_0x26a90e['extension']&&_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0xf')](_0xd6cf('0x24'))&&_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x24')]!==_0xd6cf('0x25')){_0x26a90e['extensions'][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'Set','appdata':_0xd6cf('0x26'),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x27')+_0x26a90e[_0xd6cf('0x1b')][_0xd6cf('0x24')]||'wav','context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}}_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x28'),'context':_0x5232bf[_0x148ead][0x0]['context'],'exten':_0x5232bf[_0x148ead][0x0]['exten'],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'Set','appdata':_0xd6cf('0x29'),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0]['VoiceExtensionId']});_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x2a'),'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'priority':_0x26a90e[_0xd6cf('0x17')]++,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});for(var _0x543487=0x0,_0x14a554=0x0;_0x543487<_0x5232bf[_0x148ead][_0xd6cf('0x2b')];_0x543487+=0x1,_0x14a554=0x0){var _0xc4c612=_0x5232bf[_0x148ead][_0x543487];if(_0xc4c612[_0xd6cf('0x13')]){_0xc4c612[_0xd6cf('0x13')]=_0xc4c612[_0xd6cf('0x13')]['toLowerCase']();}var _0x5d4022=[];var _0x2629d8=[];delete _0xc4c612['id'];delete _0xc4c612[_0xd6cf('0x2c')];delete _0xc4c612[_0xd6cf('0x2d')];var _0x349d9e=_0xc4c612[_0xd6cf('0x2e')]!==_0xd6cf('0x2f')?[_0xc4c612[_0xd6cf('0x2e')]]:_0xc4c612[_0xd6cf('0x30')]?_[_0xd6cf('0x31')](_[_0xd6cf('0xb')](_0x26a90e[_0xd6cf('0x5')],{'IntervalId':_0xc4c612['IntervalId']}),_0xd6cf('0x2e')):[];if(_0xc4c612[_0xd6cf('0xf')](_0xd6cf('0x32'))){if(_0xc4c612['tag']&&_0xc4c612[_0xd6cf('0x32')]!=='--'){_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':_0xd6cf('0x33')+_0xc4c612[_0xd6cf('0x32')],'context':_0xc4c612['context'],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e['priority']+_0x14a554++,'VoiceExtensionId':_0xc4c612['VoiceExtensionId']});}}if(_0xc4c612[_0xd6cf('0x13')]===_0xd6cf('0x34')&&_0xc4c612[_0xd6cf('0xf')](_0xd6cf('0x35'))){if(_0xc4c612[_0xd6cf('0x35')]){_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':'ExecIf','appdata':_0xd6cf('0x36')+_0xc4c612[_0xd6cf('0x35')]+')','context':_0xc4c612['context'],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e['length']+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}else{_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x37'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xc4c612[_0xd6cf('0x16')],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}}if(_0xc4c612[_0xd6cf('0xf')](_0xd6cf('0x38'))){if(_0x59e664[_0xd6cf('0x39')](_0xc4c612[_0xd6cf('0x3a')][_0xd6cf('0x3b')]())>=0x0&&_0xc4c612[_0xd6cf('0x3c')]!==_0xd6cf('0x3d')){if(_0xc4c612[_0xd6cf('0x38')]){_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612['type'],'app':_0xd6cf('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xc4c612[_0xd6cf('0x16')],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e['length']+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xc4c612['context'],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}else{_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x37'),'appdata':_0xd6cf('0x3e'),'context':_0xc4c612[_0xd6cf('0x16')],'exten':_0xc4c612[_0xd6cf('0x9')],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});_0x5d4022[_0xd6cf('0x12')]({'type':_0xc4c612[_0xd6cf('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xc4c612['context'],'exten':_0xc4c612['exten'],'priority':_0x349d9e[_0xd6cf('0x2b')]+_0x26a90e[_0xd6cf('0x17')]+_0x14a554++,'VoiceExtensionId':_0xc4c612[_0xd6cf('0x18')]});}}}for(var _0x5d2ea8=0x0;_0x5d2ea8<_0x349d9e['length'];_0x5d2ea8+=0x1){var _0x2dd5a3=_0x26a90e[_0xd6cf('0x17')]+_0x349d9e['length'];var _0x52e1e3=_0x5d2ea8===_0x349d9e[_0xd6cf('0x2b')]-0x1?_0x26a90e[_0xd6cf('0x17')]+_0x5d4022[_0xd6cf('0x2b')]+_0x2629d8['length']+0x2:_0x26a90e['priority']+_0x5d2ea8+0x1;_0x5d4022[_0xd6cf('0x3f')](_0x5d2ea8,0x0,{'type':_0xc4c612[_0xd6cf('0x13')],'app':_0xd6cf('0x40'),'appdata':_0x349d9e[_0x5d2ea8]+'?'+_0xc4c612[_0xd6cf('0x16')]+_0xd6cf('0x41')+_0x2dd5a3+':'+_0xc4c612['context']+_0xd6cf('0x41')+_0x52e1e3,'exten':_0xc4c612['exten'],'context':_0xc4c612['context'],'priority':_0x26a90e[_0xd6cf('0x17')]+_0x5d2ea8,'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});}_0xc4c612['priority']=_0x5d4022['length']?_[_0xd6cf('0x42')](_0x5d4022)[_0xd6cf('0x17')]+0x1:_0x26a90e[_0xd6cf('0x17')];_0x26a90e[_0xd6cf('0x17')]=(_0x2629d8[_0xd6cf('0x2b')]?_[_0xd6cf('0x42')](_0x2629d8)[_0xd6cf('0x17')]:_0xc4c612[_0xd6cf('0x17')])+0x1;_0x26a90e[_0xd6cf('0x10')]=_['concat'](_0x26a90e[_0xd6cf('0x10')],_0x5d4022,[_0xc4c612],_0x2629d8);}_0x26a90e[_0xd6cf('0x10')][_0xd6cf('0x12')]({'type':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x13')],'app':'Hangup','exten':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x9')],'context':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x16')],'priority':_0x26a90e['priority'],'VoiceExtensionId':_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]});_0x48fd03[_0xd6cf('0x12')](_0x5232bf[_0x148ead][0x0][_0xd6cf('0x18')]);_0x1727de=_[_0xd6cf('0x43')](_0x1727de,_0x26a90e[_0xd6cf('0x10')]);}}return _0x5181ea[_0xd6cf('0x44')](function(_0xe7b933){return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x6')][_0xd6cf('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x48fd03}},'transaction':_0xe7b933})[_0xd6cf('0x7')](function(_0x14d9b5){return _0x5181ea[_0xd6cf('0x2')][_0xd6cf('0x6')][_0xd6cf('0x46')](_[_0xd6cf('0x47')](_0x1727de,_0xd6cf('0x17')),{'transaction':_0xe7b933});});});})[_0xd6cf('0x48')](function(_0x5cfc6a){console[_0xd6cf('0x49')](_0x5cfc6a);});}exports[_0xd6cf('0x4a')]=rewrite; \ No newline at end of file +var _0x1d50=['app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','inbound','Set','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf'];(function(_0x230dd3,_0x26024b){var _0x7987fa=function(_0x36a021){while(--_0x36a021){_0x230dd3['push'](_0x230dd3['shift']());}};_0x7987fa(++_0x26024b);}(_0x1d50,0x126));var _0x01d5=function(_0x22eb8a,_0x19da9c){_0x22eb8a=_0x22eb8a-0x0;var _0x1a0286=_0x1d50[_0x22eb8a];return _0x1a0286;};'use strict';var _=require(_0x01d5('0x0'));var util=require(_0x01d5('0x1'));function rewrite(_0x10d1c3,_0x159f17){var _0x23f89e=this;return _0x10d1c3[_0x01d5('0x2')]['Interval'][_0x01d5('0x3')]({'raw':!![]})['then'](function(_0x1d6233){_0x23f89e[_0x01d5('0x4')]=_0x1d6233;return _0x10d1c3['models'][_0x01d5('0x5')][_0x01d5('0x3')]({'where':{'IntervalId':_0x159f17[_0x01d5('0x6')]},'raw':!![]});})['then'](function(_0x41d3e1){return _0x10d1c3[_0x01d5('0x2')][_0x01d5('0x5')][_0x01d5('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x01d5('0x7')](_0x41d3e1,_0x01d5('0x8')))}},'order':[{'raw':_0x01d5('0x9')}],'raw':!![]});})['then'](function(_0x23d902){var _0x1a3564=_[_0x01d5('0xa')](_0x23d902,{'priority':'1'});var _0x304475=_[_0x01d5('0xa')](_0x23d902,{'isApp':0x1});var _0xcb08bd=_[_0x01d5('0xb')](_0x304475,_0x01d5('0x8'));var _0xbad779=[_0x01d5('0xc'),_0x01d5('0xd')];var _0x3be1e9=[];var _0x9cfa9f=[];for(var _0x11e13c in _0xcb08bd){if(_0xcb08bd[_0x01d5('0xe')](_0x11e13c)){_0x23f89e[_0x01d5('0xf')]=0x2;_0x23f89e[_0x01d5('0x10')]=[];_0x23f89e[_0x01d5('0x11')]=_[_0x01d5('0x12')](_0x1a3564,{'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')]});_0x23f89e['extensions'][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':'Set','appdata':util[_0x01d5('0x15')](_0x01d5('0x16'),_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')]),'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0]['VoiceExtensionId']});if(_0xcb08bd[_0x11e13c][0x0]['type']===_0x01d5('0x18')){_0x23f89e['extensions'][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':_0x01d5('0x19'),'appdata':_0x01d5('0x1a')+_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')],'context':_0xcb08bd[_0x11e13c][0x0]['context'],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});}else if(_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')]===_0x01d5('0x1c')){if(_0x23f89e['extension']){_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':'Set','appdata':_0x01d5('0x1d')+(_0x23f89e[_0x01d5('0x11')][_0x01d5('0x1e')]?_0x01d5('0x1f')+_0x23f89e[_0x01d5('0x11')][_0x01d5('0x1e')]+'}':_0x01d5('0x20')),'context':_0xcb08bd[_0x11e13c][0x0]['context'],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e['priority']++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});}_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0]['type'],'app':_0x01d5('0x19'),'appdata':_0x01d5('0x1a')+_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')],'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0]['exten'],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});var _0x510ee7=_0x23f89e['priority']++;_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0]['type'],'app':_0x01d5('0x21'),'appdata':_0x01d5('0x22')+(_0x510ee7+0x2)+_0x01d5('0x23')+(_0x510ee7+0x1)+')','context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x510ee7,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});if(_0x23f89e[_0x01d5('0x11')]){_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':_0x01d5('0x19'),'appdata':_0x23f89e[_0x01d5('0x11')][_0x01d5('0x1e')]?_0x01d5('0x24')+_0x23f89e['extension'][_0x01d5('0x1e')]+'}':_0x01d5('0x25'),'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});}_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':'Set','appdata':_0x01d5('0x26')+_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')],'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0]['exten'],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});if(_0x23f89e[_0x01d5('0x11')]&&_0x23f89e[_0x01d5('0x11')][_0x01d5('0xe')](_0x01d5('0x27'))&&_0x23f89e[_0x01d5('0x11')]['recordingFormat']!==_0x01d5('0x28')){_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0]['type'],'app':_0x01d5('0x19'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0]['exten'],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});_0x23f89e[_0x01d5('0x10')]['push']({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':_0x01d5('0x19'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x23f89e[_0x01d5('0x11')][_0x01d5('0x27')]||_0x01d5('0x29'),'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});}}_0x23f89e[_0x01d5('0x10')]['push']({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':'Set','appdata':_0x01d5('0x2a'),'context':_0xcb08bd[_0x11e13c][0x0]['context'],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0]['VoiceExtensionId']});_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':'Set','appdata':_0x01d5('0x2b'),'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0]['VoiceExtensionId']});_0x23f89e['extensions']['push']({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':_0x01d5('0x19'),'appdata':'MONITOR_OPTIONS=ab','context':_0xcb08bd[_0x11e13c][0x0]['context'],'exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'priority':_0x23f89e[_0x01d5('0xf')]++,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});for(var _0x4c5988=0x0,_0x21034e=0x0;_0x4c5988<_0xcb08bd[_0x11e13c][_0x01d5('0x2c')];_0x4c5988+=0x1,_0x21034e=0x0){var _0x2cbecc=_0xcb08bd[_0x11e13c][_0x4c5988];if(_0x2cbecc[_0x01d5('0x14')]){_0x2cbecc[_0x01d5('0x14')]=_0x2cbecc[_0x01d5('0x14')]['toLowerCase']();}var _0x2aaada=[];var _0x5e32e4=[];delete _0x2cbecc['id'];delete _0x2cbecc[_0x01d5('0x2d')];delete _0x2cbecc[_0x01d5('0x2e')];var _0x3d4322=_0x2cbecc[_0x01d5('0x2f')]!==_0x01d5('0x30')?[_0x2cbecc[_0x01d5('0x2f')]]:_0x2cbecc[_0x01d5('0x6')]?_[_0x01d5('0x7')](_['filter'](_0x23f89e[_0x01d5('0x4')],{'IntervalId':_0x2cbecc['IntervalId']}),'interval'):[];if(_0x2cbecc[_0x01d5('0xe')](_0x01d5('0x31'))){if(_0x2cbecc['tag']&&_0x2cbecc['tag']!=='--'){_0x2aaada['push']({'type':_0x2cbecc['type'],'app':_0x01d5('0x19'),'appdata':_0x01d5('0x32')+_0x2cbecc[_0x01d5('0x31')],'context':_0x2cbecc[_0x01d5('0x17')],'exten':_0x2cbecc['exten'],'priority':_0x3d4322['length']+_0x23f89e[_0x01d5('0xf')]+_0x21034e++,'VoiceExtensionId':_0x2cbecc[_0x01d5('0x1b')]});}}if(_0x2cbecc[_0x01d5('0x14')]==='outbound'&&_0x2cbecc[_0x01d5('0xe')]('callerID')){if(_0x2cbecc[_0x01d5('0x33')]){_0x2aaada[_0x01d5('0x13')]({'type':_0x2cbecc['type'],'app':'ExecIf','appdata':_0x01d5('0x34')+_0x2cbecc['callerID']+')','context':_0x2cbecc[_0x01d5('0x17')],'exten':_0x2cbecc['exten'],'priority':_0x3d4322[_0x01d5('0x2c')]+_0x23f89e[_0x01d5('0xf')]+_0x21034e++,'VoiceExtensionId':_0x2cbecc['VoiceExtensionId']});}else{_0x2aaada[_0x01d5('0x13')]({'type':_0x2cbecc[_0x01d5('0x14')],'app':_0x01d5('0x21'),'appdata':_0x01d5('0x35'),'context':_0x2cbecc['context'],'exten':_0x2cbecc['exten'],'priority':_0x3d4322['length']+_0x23f89e['priority']+_0x21034e++,'VoiceExtensionId':_0x2cbecc[_0x01d5('0x1b')]});}}if(_0x2cbecc[_0x01d5('0xe')](_0x01d5('0x36'))){if(_0xbad779[_0x01d5('0x37')](_0x2cbecc[_0x01d5('0x38')][_0x01d5('0x39')]())>=0x0&&_0x2cbecc['appType']!=='custom'){if(_0x2cbecc[_0x01d5('0x36')]){_0x2aaada['push']({'type':_0x2cbecc[_0x01d5('0x14')],'app':_0x01d5('0x21'),'appdata':_0x01d5('0x3a'),'context':_0x2cbecc['context'],'exten':_0x2cbecc[_0x01d5('0x8')],'priority':_0x3d4322[_0x01d5('0x2c')]+_0x23f89e['priority']+_0x21034e++,'VoiceExtensionId':_0x2cbecc[_0x01d5('0x1b')]});_0x2aaada[_0x01d5('0x13')]({'type':_0x2cbecc[_0x01d5('0x14')],'app':_0x01d5('0x19'),'appdata':_0x01d5('0x3b'),'context':_0x2cbecc[_0x01d5('0x17')],'exten':_0x2cbecc[_0x01d5('0x8')],'priority':_0x3d4322[_0x01d5('0x2c')]+_0x23f89e[_0x01d5('0xf')]+_0x21034e++,'VoiceExtensionId':_0x2cbecc[_0x01d5('0x1b')]});}else{_0x2aaada[_0x01d5('0x13')]({'type':_0x2cbecc[_0x01d5('0x14')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2cbecc[_0x01d5('0x17')],'exten':_0x2cbecc[_0x01d5('0x8')],'priority':_0x3d4322[_0x01d5('0x2c')]+_0x23f89e[_0x01d5('0xf')]+_0x21034e++,'VoiceExtensionId':_0x2cbecc[_0x01d5('0x1b')]});_0x2aaada[_0x01d5('0x13')]({'type':_0x2cbecc[_0x01d5('0x14')],'app':_0x01d5('0x19'),'appdata':_0x01d5('0x3c'),'context':_0x2cbecc[_0x01d5('0x17')],'exten':_0x2cbecc[_0x01d5('0x8')],'priority':_0x3d4322[_0x01d5('0x2c')]+_0x23f89e[_0x01d5('0xf')]+_0x21034e++,'VoiceExtensionId':_0x2cbecc[_0x01d5('0x1b')]});}}}for(var _0xf888ca=0x0;_0xf888ca<_0x3d4322[_0x01d5('0x2c')];_0xf888ca+=0x1){var _0x12a251=_0x23f89e['priority']+_0x3d4322[_0x01d5('0x2c')];var _0x441ed0=_0xf888ca===_0x3d4322['length']-0x1?_0x23f89e['priority']+_0x2aaada[_0x01d5('0x2c')]+_0x5e32e4[_0x01d5('0x2c')]+0x2:_0x23f89e[_0x01d5('0xf')]+_0xf888ca+0x1;_0x2aaada[_0x01d5('0x3d')](_0xf888ca,0x0,{'type':_0x2cbecc[_0x01d5('0x14')],'app':'GotoIfTime','appdata':_0x3d4322[_0xf888ca]+'?'+_0x2cbecc[_0x01d5('0x17')]+_0x01d5('0x3e')+_0x12a251+':'+_0x2cbecc[_0x01d5('0x17')]+_0x01d5('0x3e')+_0x441ed0,'exten':_0x2cbecc[_0x01d5('0x8')],'context':_0x2cbecc[_0x01d5('0x17')],'priority':_0x23f89e[_0x01d5('0xf')]+_0xf888ca,'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]});}_0x2cbecc['priority']=_0x2aaada[_0x01d5('0x2c')]?_[_0x01d5('0x3f')](_0x2aaada)['priority']+0x1:_0x23f89e[_0x01d5('0xf')];_0x23f89e[_0x01d5('0xf')]=(_0x5e32e4['length']?_[_0x01d5('0x3f')](_0x5e32e4)[_0x01d5('0xf')]:_0x2cbecc[_0x01d5('0xf')])+0x1;_0x23f89e['extensions']=_['concat'](_0x23f89e[_0x01d5('0x10')],_0x2aaada,[_0x2cbecc],_0x5e32e4);}_0x23f89e[_0x01d5('0x10')][_0x01d5('0x13')]({'type':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x14')],'app':'Hangup','exten':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x8')],'context':_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x17')],'priority':_0x23f89e[_0x01d5('0xf')],'VoiceExtensionId':_0xcb08bd[_0x11e13c][0x0]['VoiceExtensionId']});_0x3be1e9['push'](_0xcb08bd[_0x11e13c][0x0][_0x01d5('0x1b')]);_0x9cfa9f=_[_0x01d5('0x40')](_0x9cfa9f,_0x23f89e['extensions']);}}return _0x10d1c3[_0x01d5('0x41')](function(_0xe8b740){return _0x10d1c3['models']['VoiceExtension'][_0x01d5('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x3be1e9}},'transaction':_0xe8b740})['then'](function(_0x5e4734){return _0x10d1c3['models']['VoiceExtension'][_0x01d5('0x43')](_[_0x01d5('0x44')](_0x9cfa9f,_0x01d5('0xf')),{'transaction':_0xe8b740});});});})['catch'](function(_0x6ca8c3){console['error'](_0x6ca8c3);});}exports[_0x01d5('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8b7887d..f9a5959 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 _0x0df4=['Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_final','insert','str','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','get','push','sequelize','onlyIfOpen','query','VoiceQueueId','all','findAll','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x0df4,0x1b8));var _0x40df=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0df4[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x40df('0x0'));var util=require(_0x40df('0x1'));var _=require(_0x40df('0x2'));var fs=require('fs');var squel=require(_0x40df('0x3'));var Papa=require(_0x40df('0x4'));var Redis=require(_0x40df('0x5'));var db=require(_0x40df('0x6'))['db'];var config=require(_0x40df('0x7'));var logger=require(_0x40df('0x8'))(_0x40df('0x9'));config[_0x40df('0xa')]=_[_0x40df('0xb')](config[_0x40df('0xa')],{'host':_0x40df('0xc'),'port':0x18eb});var socket=require(_0x40df('0xd'))(new Redis(config['redis']));require(_0x40df('0xe'))[_0x40df('0xf')](socket);try{if(!process[_0x40df('0x10')][0x2]||process[_0x40df('0x10')][0x2]===_0x40df('0x11')||process[_0x40df('0x10')][0x2]==='null'){throw new Error(_0x40df('0x12'));}var FILEPATH=process[_0x40df('0x10')][0x2];if(!process['argv'][0x3]||process[_0x40df('0x10')][0x3]===_0x40df('0x11')||process['argv'][0x3]===_0x40df('0x13')||!process['argv'][0x4]||process['argv'][0x4]===_0x40df('0x11')||process[_0x40df('0x10')][0x4]===_0x40df('0x13')){throw new Error(_0x40df('0x14'));}var FIELDS=_[_0x40df('0x15')](process[_0x40df('0x10')][0x3][_0x40df('0x16')](','),process[_0x40df('0x10')][0x4][_0x40df('0x16')](','));if(!process['argv'][0x5]||process[_0x40df('0x10')][0x5]==='undefined'||process[_0x40df('0x10')][0x5]===_0x40df('0x13')){throw new Error(_0x40df('0x17'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x40df('0x10')][0x6]&&process[_0x40df('0x10')][0x6]!=='undefined'&&process[_0x40df('0x10')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x40df('0x10')][0x7]&&process['argv'][0x7]!==_0x40df('0x11')&&process[_0x40df('0x10')][0x7]!==_0x40df('0x13')?process[_0x40df('0x10')][0x7]:null;if(!process[_0x40df('0x10')][0x8]||process[_0x40df('0x10')][0x8]===_0x40df('0x11')||process[_0x40df('0x10')][0x8]===_0x40df('0x13')){throw new Error(_0x40df('0x18'));}var SOCKET_TIMESTAMP=process[_0x40df('0x10')][0x8];}catch(_0x29fa2b){logger[_0x40df('0x19')](_0x29fa2b);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(_0x52b70f,_0x596f23,_0x319536,_0x9bbd53){var _0x6e054f={'message':_0x596f23};_0x6e054f[_0x52b70f]=!![];if(_0x319536){_0x6e054f[_0x40df('0x1a')]=_0x319536;}if(_0x9bbd53){_0x6e054f['index']=_0x9bbd53;}return _0x6e054f;}function isEmail(_0x442a8e){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))*$/[_0x40df('0x1b')](_0x442a8e);}function checkRow(_0x3ab55c,_0x1045a0,_0xb82b1e){return new BPromise(function(_0x2e3e9f,_0x38381f){if(_[_0x40df('0x1c')](_0x3ab55c)){return _0x38381f(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xb82b1e));}if(_0x3ab55c['errors']&&_0x3ab55c[_0x40df('0x1d')][_0x40df('0x1e')]){var _0x296756=_[_0x40df('0x1f')](_0x3ab55c['errors'],'message')['join'](';');return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x296756,null,_0xb82b1e));}var _0x39c5d0={};for(var _0x2c560b in FIELDS){if(FIELDS[_0x40df('0x20')](_0x2c560b)&&FIELDS[_0x2c560b]){_0x39c5d0[_0x2c560b]=_0x3ab55c[_0x40df('0x21')][0x0][FIELDS[_0x2c560b]]||_0x3ab55c[_0x40df('0x21')][0x0]['\ufeff'+FIELDS[_0x2c560b]];}}if(!_0x39c5d0[_0x40df('0x22')]){return _0x38381f(handleCheckRowError('error',_0x40df('0x23'),null,_0xb82b1e));}if(!_0x39c5d0[_0x40df('0x24')]){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x25'),null,_0xb82b1e));}if(_0x39c5d0['birthDate']){var _0x1989b5=moment(_0x39c5d0[_0x40df('0x26')],'YYYY-MM-DD');if(!_0x1989b5['isValid']()){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x27'),null,_0xb82b1e));}}if(_0x39c5d0[_0x40df('0x28')]){if(!isEmail(_0x39c5d0[_0x40df('0x28')])){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x29'),null,_0xb82b1e));}}_0x39c5d0[_0x40df('0x2a')]=LISTID;_0x39c5d0[_0x40df('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x40df('0x1e')]&&_0x1045a0){var _0x1bebe3={};for(var _0x4a709f=0x0,_0x356030=DUPLICATES['length'];_0x4a709f<_0x356030;_0x4a709f+=0x1){_0x1bebe3[DUPLICATES[_0x4a709f]]=_0x39c5d0[DUPLICATES[_0x4a709f]];}var _0x496b64=_[_0x40df('0x2c')](_0x1045a0,_0x1bebe3);if(_0x496b64){return _0x38381f(handleCheckRowError('duplicate',_0x40df('0x2d'),_0x496b64,_0xb82b1e));}}return db[_0x40df('0x2e')][_0x40df('0x2f')](_0x39c5d0,{'raw':!![],'hooks':![],'fields':_['keys'](_0x39c5d0)})['then'](function(_0x2187a9){if(DUPLICATES&&DUPLICATES['length']&&_0x1045a0){_0x1045a0['push'](_[_0x40df('0x30')](_0x39c5d0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2187a9['id'];return _0x2e3e9f();})[_0x40df('0x31')](function(_0x14ea1d){return _0x38381f(handleCheckRowError(_0x40df('0x19'),_0x40df('0x32')+(_0x14ea1d['message']||JSON[_0x40df('0x33')](_0x14ea1d)),null,_0xb82b1e));});});}function checkHopper(){function _0x4f137f(){return function(_0x52f1e5){logger[_0x40df('0x19')]('cmContact',_0x40df('0x34'),util[_0x40df('0x35')](_0x52f1e5,{'showHidden':![],'depth':null}));};}var _0x3a2700=function(_0x262a7b,_0x557c1a){var _0x192193=squel['insert']()[_0x40df('0x36')](_0x40df('0x37'))[_0x40df('0x38')]([_0x40df('0x24'),_0x40df('0x39'),_0x40df('0x3a'),'ListId',_0x557c1a,_0x40df('0x3b'),_0x40df('0x3c')],squel[_0x40df('0x3d')]()[_0x40df('0x3e')]('phone',_0x40df('0x24'))[_0x40df('0x3e')]('NOW()','scheduledAt')[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID[_0x40df('0x3f')](),_0x40df('0x2a'))[_0x40df('0x3e')](_0x262a7b['id'][_0x40df('0x3f')](),_0x557c1a)[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3b'))[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3c'))[_0x40df('0x41')]('cm_contacts')[_0x40df('0x42')]('deletedAt\x20IS\x20NULL')[_0x40df('0x42')](_0x40df('0x43'),LISTID[_0x40df('0x3f')]())[_0x40df('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x40df('0x42')](_0x40df('0x44'),squel[_0x40df('0x3d')]()[_0x40df('0x3e')]('phone')[_0x40df('0x41')](_0x40df('0x37'))[_0x40df('0x42')](_0x557c1a+_0x40df('0x45'),_0x262a7b['id'][_0x40df('0x3f')]())))[_0x40df('0x3f')]();return _0x192193;};var _0x9c8e1a=function(_0x1d15db,_0x59ddbc){var _0x3e9b35=squel['insert']()[_0x40df('0x36')](_0x40df('0x37'))[_0x40df('0x38')](['phone',_0x40df('0x39'),_0x40df('0x3a'),_0x40df('0x2a'),_0x59ddbc,_0x40df('0x3b'),_0x40df('0x3c')],squel[_0x40df('0x3d')]()['field'](_0x40df('0x24'),_0x40df('0x24'))[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x39'))[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID['toString'](),_0x40df('0x2a'))['field'](_0x1d15db['id'][_0x40df('0x3f')](),_0x59ddbc)[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3b'))['field'](_0x40df('0x40'),_0x40df('0x3c'))[_0x40df('0x41')](_0x40df('0x46'))[_0x40df('0x42')](_0x40df('0x47'))['where'](_0x40df('0x43'),LISTID[_0x40df('0x3f')]())[_0x40df('0x42')](_0x40df('0x48'),squel['str'](hopperContacts))[_0x40df('0x42')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x40df('0x3e')]('calleridnum')['from'](_0x40df('0x49'))[_0x40df('0x42')](_0x59ddbc+_0x40df('0x45'),_0x1d15db['id'][_0x40df('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x40df('0x3d')]()[_0x40df('0x3e')](_0x40df('0x24'))['from'](_0x40df('0x37'))[_0x40df('0x42')](_0x59ddbc+_0x40df('0x45'),_0x1d15db['id'][_0x40df('0x3f')]())))[_0x40df('0x3f')]();return _0x3e9b35;};function _0x306d6c(_0x2bd470,_0x5660a6){var _0x4377fe=squel[_0x40df('0x4a')]()[_0x40df('0x36')]('cm_hopper')['fromQuery']([_0x40df('0x24'),'scheduledAt',_0x40df('0x3a'),_0x40df('0x2a'),_0x5660a6,_0x40df('0x3b'),_0x40df('0x3c')],squel['select']()[_0x40df('0x3e')](_0x40df('0x24'),_0x40df('0x24'))[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x39'))[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID[_0x40df('0x3f')](),_0x40df('0x2a'))[_0x40df('0x3e')](_0x2bd470['id'][_0x40df('0x3f')](),_0x5660a6)[_0x40df('0x3e')]('NOW()',_0x40df('0x3b'))[_0x40df('0x3e')]('NOW()','updatedAt')['from'](_0x40df('0x46'))[_0x40df('0x42')](_0x40df('0x47'))[_0x40df('0x42')](_0x40df('0x43'),LISTID[_0x40df('0x3f')]())['where'](_0x40df('0x48'),squel[_0x40df('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x40df('0x3f')]();return _0x4377fe;}function _0x41f2b2(_0x49cdd7,_0x12c41b){var _0x4b6900=squel[_0x40df('0x4a')]()[_0x40df('0x36')](_0x40df('0x4c'))['fromQuery']([_0x40df('0x24'),_0x40df('0x3a'),'ListId',_0x12c41b,_0x40df('0x3b'),_0x40df('0x3c')],squel[_0x40df('0x3d')]()[_0x40df('0x3e')](_0x40df('0x24'),_0x40df('0x24'))[_0x40df('0x3e')]('id',_0x40df('0x3a'))[_0x40df('0x3e')](LISTID['toString'](),_0x40df('0x2a'))[_0x40df('0x3e')](_0x49cdd7['id']['toString'](),_0x12c41b)[_0x40df('0x3e')]('NOW()','createdAt')[_0x40df('0x3e')](_0x40df('0x40'),_0x40df('0x3c'))['from'](_0x40df('0x46'))['where'](_0x40df('0x47'))[_0x40df('0x42')]('ListId\x20=\x20?',LISTID[_0x40df('0x3f')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x40df('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x40df('0x3f')]();return _0x4b6900;}return db[_0x40df('0x4d')]['findAll']({'where':{'type':_0x40df('0x4e')},'attributes':['id',_0x40df('0x4f')],'include':[{'model':db[_0x40df('0x50')],'as':_0x40df('0x51'),'where':{'id':LISTID}}]})[_0x40df('0x52')](function(_0x59c481){var _0x475ae5=[];if(_0x59c481){var _0x3e0b88;for(var _0x45dd38=0x0,_0x1e1704;_0x45dd38<_0x59c481[_0x40df('0x1e')];_0x45dd38+=0x1){_0x1e1704=_0x59c481[_0x45dd38][_0x40df('0x53')]({'plain':!![]});switch(_0x1e1704['dialCheckDuplicateType']){case'always':_0x475ae5[_0x40df('0x54')](db[_0x40df('0x55')]['query'](_0x9c8e1a(_0x1e1704,'VoiceQueueId'))[_0x40df('0x52')](function(){})['catch'](_0x4f137f()));break;case _0x40df('0x56'):_0x475ae5[_0x40df('0x54')](db['sequelize'][_0x40df('0x57')](_0x3a2700(_0x1e1704,'VoiceQueueId'))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));break;default:_0x475ae5[_0x40df('0x54')](db[_0x40df('0x55')]['query'](_0x306d6c(_0x1e1704,_0x40df('0x58')))['then'](function(){})['catch'](_0x4f137f()));}}}return _0x475ae5;})[_0x40df('0x59')]()['then'](function(){return db[_0x40df('0x4d')][_0x40df('0x5a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x40df('0x50')],'as':_0x40df('0x5b'),'where':{'id':LISTID}}]})[_0x40df('0x52')](function(_0x5c3222){var _0x5c5b6b=[];if(_0x5c3222){var _0x6e0b09;for(var _0x36cd7b=0x0,_0x3aa9e0;_0x36cd7b<_0x5c3222[_0x40df('0x1e')];_0x36cd7b+=0x1){_0x3aa9e0=_0x5c3222[_0x36cd7b]['get']({'plain':!![]});_0x5c5b6b['push'](db['sequelize']['query'](_0x41f2b2(_0x3aa9e0,'VoiceQueueId'))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));}}return _0x5c5b6b;})[_0x40df('0x59')]();})[_0x40df('0x52')](function(){return db[_0x40df('0x5c')][_0x40df('0x5a')]({'attributes':['id',_0x40df('0x4f')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x56a986){var _0x35b634=[];if(_0x56a986){for(var _0x4a7602=0x0,_0x2f206e;_0x4a7602<_0x56a986[_0x40df('0x1e')];_0x4a7602+=0x1){_0x2f206e=_0x56a986[_0x4a7602]['get']({'plain':!![]});switch(_0x2f206e[_0x40df('0x4f')]){case _0x40df('0x5d'):_0x35b634[_0x40df('0x54')](db[_0x40df('0x55')][_0x40df('0x57')](_0x9c8e1a(_0x2f206e,_0x40df('0x5e')))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));break;case _0x40df('0x56'):_0x35b634[_0x40df('0x54')](db[_0x40df('0x55')][_0x40df('0x57')](_0x3a2700(_0x2f206e,_0x40df('0x5e')))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));break;default:_0x35b634[_0x40df('0x54')](db[_0x40df('0x55')]['query'](_0x306d6c(_0x2f206e,_0x40df('0x5e')))[_0x40df('0x52')](function(){})[_0x40df('0x31')](_0x4f137f()));}}}return _0x35b634;})[_0x40df('0x59')]();})[_0x40df('0x52')](function(){return db[_0x40df('0x5c')][_0x40df('0x5a')]({'attributes':['id'],'include':[{'model':db[_0x40df('0x50')],'as':_0x40df('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x2f6dcb){var _0x33539d=[];if(_0x2f6dcb){for(var _0x3e228e=0x0,_0x2d3da3;_0x3e228e<_0x2f6dcb[_0x40df('0x1e')];_0x3e228e+=0x1){_0x2d3da3=_0x2f6dcb[_0x3e228e][_0x40df('0x53')]({'plain':!![]});_0x33539d[_0x40df('0x54')](db[_0x40df('0x55')][_0x40df('0x57')](_0x41f2b2(_0x2d3da3,_0x40df('0x5e')))[_0x40df('0x52')](function(){})['catch'](_0x4f137f()));}}return _0x33539d;})[_0x40df('0x59')]();})['catch'](function(_0xd6ec24){logger[_0x40df('0x19')](_0x40df('0x5f'),_0x40df('0x60'),_0xd6ec24[_0x40df('0x61')]);});}var processPromises=function(_0x52a0e6){return BPromise[_0x40df('0x59')](promises)[_0x40df('0x52')](function(_0x27650c){})[_0x40df('0x31')](function(_0x4c8c56){logger[_0x40df('0x19')]('Error\x20processing\x20rows\x20block:',JSON[_0x40df('0x33')](_0x4c8c56));})[_0x40df('0x62')](function(){socket['emit'](_0x40df('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x52a0e6){return _0x52a0e6[_0x40df('0x64')]();}});};var endCsv=function(){return BPromise[_0x40df('0x65')]()[_0x40df('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x40df('0x52')](function(){socket[_0x40df('0x66')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x40df('0x67')](FILEPATH);}catch(_0x5d0d35){logger['error'](_0x40df('0x68'),JSON[_0x40df('0x33')](_0x5d0d35));}finally{process[_0x40df('0x69')](0x0);}});};process['on'](_0x40df('0x6a'),function(){logger['info'](_0x40df('0x6b'));endCsv();});function main(){return BPromise['resolve']()[_0x40df('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x40df('0x16')](',');return db[_0x40df('0x2e')][_0x40df('0x5a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x46b39c){var _0x21f62a=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x40df('0x6c')](_0x21f62a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x40aed3,_0x1a26d5){total+=0x1;var _0x159e81=total;promises[_0x40df('0x54')](checkRow(_0x40aed3,_0x46b39c,_0x159e81)[_0x40df('0x52')](function(){success+=0x1;})[_0x40df('0x31')](function(_0x515bf6){if(_0x515bf6[_0x40df('0x19')]){errors+=0x1;delete _0x515bf6[_0x40df('0x19')];}else if(_0x515bf6[_0x40df('0x6d')]){duplicates+=0x1;delete _0x515bf6[_0x40df('0x6d')];}rows[_0x40df('0x54')](_0x515bf6);}));if(total%0xc8===0x0){_0x1a26d5[_0x40df('0x6e')]();return processPromises(_0x1a26d5);}},'complete':function(){return processPromises()[_0x40df('0x52')](function(){logger[_0x40df('0x6f')](_0x40df('0x70'));endCsv();});},'error':function(_0x5ae8b7,_0x243e52){logger[_0x40df('0x6f')](_0x40df('0x71'),JSON[_0x40df('0x33')](_0x5ae8b7));endCsv();}});})['catch'](function(_0x1f1ac9){logger[_0x40df('0x19')](_0x40df('0x72'),JSON[_0x40df('0x33')](_0x1f1ac9));});}main(); \ No newline at end of file +var _0xdbce=['CompanyId','find','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','insert','fromQuery','deletedAt\x20IS\x20NULL','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','all','outbound','BlackLists','Campaign','CampaignId','onlyIfOpen','findAll','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xdbce,0x12e));var _0xedbc=function(_0x3889ae,_0x4770c3){_0x3889ae=_0x3889ae-0x0;var _0x6533dd=_0xdbce[_0x3889ae];return _0x6533dd;};'use strict';var BPromise=require(_0xedbc('0x0'));var util=require(_0xedbc('0x1'));var _=require(_0xedbc('0x2'));var fs=require('fs');var squel=require(_0xedbc('0x3'));var Papa=require(_0xedbc('0x4'));var Redis=require(_0xedbc('0x5'));var db=require(_0xedbc('0x6'))['db'];var config=require(_0xedbc('0x7'));var logger=require(_0xedbc('0x8'))(_0xedbc('0x9'));config['redis']=_[_0xedbc('0xa')](config[_0xedbc('0xb')],{'host':_0xedbc('0xc'),'port':0x18eb});var socket=require(_0xedbc('0xd'))(new Redis(config[_0xedbc('0xb')]));require('../../../api/cmContact/cmContact.socket')[_0xedbc('0xe')](socket);try{if(!process[_0xedbc('0xf')][0x2]||process[_0xedbc('0xf')][0x2]===_0xedbc('0x10')||process[_0xedbc('0xf')][0x2]===_0xedbc('0x11')){throw new Error(_0xedbc('0x12'));}var FILEPATH=process[_0xedbc('0xf')][0x2];if(!process[_0xedbc('0xf')][0x3]||process[_0xedbc('0xf')][0x3]==='undefined'||process[_0xedbc('0xf')][0x3]===_0xedbc('0x11')||!process[_0xedbc('0xf')][0x4]||process[_0xedbc('0xf')][0x4]===_0xedbc('0x10')||process[_0xedbc('0xf')][0x4]===_0xedbc('0x11')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xedbc('0x13')](process[_0xedbc('0xf')][0x3][_0xedbc('0x14')](','),process[_0xedbc('0xf')][0x4][_0xedbc('0x14')](','));if(!process[_0xedbc('0xf')][0x5]||process[_0xedbc('0xf')][0x5]===_0xedbc('0x10')||process[_0xedbc('0xf')][0x5]==='null'){throw new Error(_0xedbc('0x15'));}var LISTID=process[_0xedbc('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xedbc('0xf')][0x6]!==_0xedbc('0x10')&&process[_0xedbc('0xf')][0x6]!=='null'?process[_0xedbc('0xf')][0x6]:null;var DUPLICATES=process[_0xedbc('0xf')][0x7]&&process[_0xedbc('0xf')][0x7]!=='undefined'&&process[_0xedbc('0xf')][0x7]!==_0xedbc('0x11')?process['argv'][0x7]:null;if(!process[_0xedbc('0xf')][0x8]||process['argv'][0x8]===_0xedbc('0x10')||process[_0xedbc('0xf')][0x8]===_0xedbc('0x11')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xedbc('0xf')][0x8];}catch(_0x440599){logger[_0xedbc('0x16')](_0x440599);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(_0x4e367e,_0x1b1f07,_0x480b8b,_0x157e94){var _0x23bf5c={'message':_0x1b1f07};_0x23bf5c[_0x4e367e]=!![];if(_0x480b8b){_0x23bf5c[_0xedbc('0x17')]=_0x480b8b;}if(_0x157e94){_0x23bf5c[_0xedbc('0x18')]=_0x157e94;}return _0x23bf5c;}function isEmail(_0x14f9d0){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))*$/[_0xedbc('0x19')](_0x14f9d0);}function checkRow(_0x4f7f43,_0x276cb4,_0x1c9dcd){return new BPromise(function(_0x1bb012,_0x19f8b1){if(_[_0xedbc('0x1a')](_0x4f7f43)){return _0x19f8b1(handleCheckRowError('error',_0xedbc('0x1b'),null,_0x1c9dcd));}if(_0x4f7f43[_0xedbc('0x1c')]&&_0x4f7f43[_0xedbc('0x1c')][_0xedbc('0x1d')]){var _0xa9a1c7=_[_0xedbc('0x1e')](_0x4f7f43[_0xedbc('0x1c')],_0xedbc('0x1f'))['join'](';');return _0x19f8b1(handleCheckRowError(_0xedbc('0x16'),_0xa9a1c7,null,_0x1c9dcd));}var _0x2caa50={};for(var _0x4e1c89 in FIELDS){if(FIELDS['hasOwnProperty'](_0x4e1c89)&&FIELDS[_0x4e1c89]){_0x2caa50[_0x4e1c89]=_0x4f7f43[_0xedbc('0x20')][0x0][FIELDS[_0x4e1c89]]||_0x4f7f43['data'][0x0]['\ufeff'+FIELDS[_0x4e1c89]];}}if(!_0x2caa50[_0xedbc('0x21')]){return _0x19f8b1(handleCheckRowError(_0xedbc('0x16'),_0xedbc('0x22'),null,_0x1c9dcd));}if(!_0x2caa50[_0xedbc('0x23')]){return _0x19f8b1(handleCheckRowError(_0xedbc('0x16'),'phone\x20not\x20specified!',null,_0x1c9dcd));}if(_0x2caa50[_0xedbc('0x24')]){var _0x368efa=moment(_0x2caa50['birthDate'],_0xedbc('0x25'));if(!_0x368efa['isValid']()){return _0x19f8b1(handleCheckRowError(_0xedbc('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1c9dcd));}}if(_0x2caa50['email']){if(!isEmail(_0x2caa50[_0xedbc('0x26')])){return _0x19f8b1(handleCheckRowError(_0xedbc('0x16'),_0xedbc('0x27'),null,_0x1c9dcd));}}_0x2caa50['ListId']=LISTID;_0x2caa50[_0xedbc('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xedbc('0x1d')]&&_0x276cb4){var _0x50c318={};for(var _0x334280=0x0,_0x453eaf=DUPLICATES[_0xedbc('0x1d')];_0x334280<_0x453eaf;_0x334280+=0x1){_0x50c318[DUPLICATES[_0x334280]]=_0x2caa50[DUPLICATES[_0x334280]];}var _0x2ed818=_[_0xedbc('0x29')](_0x276cb4,_0x50c318);if(_0x2ed818){return _0x19f8b1(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x2ed818,_0x1c9dcd));}}return db[_0xedbc('0x2a')][_0xedbc('0x2b')](_0x2caa50,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2caa50)})[_0xedbc('0x2c')](function(_0x9dbd75){if(DUPLICATES&&DUPLICATES[_0xedbc('0x1d')]&&_0x276cb4){_0x276cb4[_0xedbc('0x2d')](_[_0xedbc('0x2e')](_0x2caa50,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9dbd75['id'];return _0x1bb012();})[_0xedbc('0x2f')](function(_0x328d89){return _0x19f8b1(handleCheckRowError(_0xedbc('0x16'),_0xedbc('0x30')+(_0x328d89[_0xedbc('0x1f')]||JSON[_0xedbc('0x31')](_0x328d89)),null,_0x1c9dcd));});});}function checkHopper(){function _0x2e59bd(){return function(_0xe46480){logger[_0xedbc('0x16')](_0xedbc('0x32'),_0xedbc('0x33'),util[_0xedbc('0x34')](_0xe46480,{'showHidden':![],'depth':null}));};}var _0x10a475=function(_0x552093,_0x67f8e9){var _0x16aed1=squel['insert']()[_0xedbc('0x35')](_0xedbc('0x36'))['fromQuery']([_0xedbc('0x23'),_0xedbc('0x37'),_0xedbc('0x38'),_0xedbc('0x39'),_0x67f8e9,_0xedbc('0x3a'),_0xedbc('0x3b')],squel[_0xedbc('0x3c')]()[_0xedbc('0x3d')](_0xedbc('0x23'),_0xedbc('0x23'))[_0xedbc('0x3d')](_0xedbc('0x3e'),'scheduledAt')[_0xedbc('0x3d')]('id',_0xedbc('0x38'))[_0xedbc('0x3d')](LISTID['toString'](),_0xedbc('0x39'))[_0xedbc('0x3d')](_0x552093['id'][_0xedbc('0x3f')](),_0x67f8e9)[_0xedbc('0x3d')](_0xedbc('0x3e'),'createdAt')['field'](_0xedbc('0x3e'),_0xedbc('0x3b'))['from'](_0xedbc('0x40'))[_0xedbc('0x41')]('deletedAt\x20IS\x20NULL')[_0xedbc('0x41')](_0xedbc('0x42'),LISTID[_0xedbc('0x3f')]())[_0xedbc('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xedbc('0x41')](_0xedbc('0x43'),squel[_0xedbc('0x3c')]()[_0xedbc('0x3d')](_0xedbc('0x23'))[_0xedbc('0x44')](_0xedbc('0x36'))[_0xedbc('0x41')](_0x67f8e9+_0xedbc('0x45'),_0x552093['id'][_0xedbc('0x3f')]())))[_0xedbc('0x3f')]();return _0x16aed1;};var _0x438cc4=function(_0x46e553,_0x40de4f){var _0x193965=squel[_0xedbc('0x46')]()['into'](_0xedbc('0x36'))[_0xedbc('0x47')]([_0xedbc('0x23'),'scheduledAt','ContactId',_0xedbc('0x39'),_0x40de4f,_0xedbc('0x3a'),_0xedbc('0x3b')],squel[_0xedbc('0x3c')]()[_0xedbc('0x3d')](_0xedbc('0x23'),'phone')[_0xedbc('0x3d')]('NOW()',_0xedbc('0x37'))['field']('id',_0xedbc('0x38'))[_0xedbc('0x3d')](LISTID[_0xedbc('0x3f')](),_0xedbc('0x39'))[_0xedbc('0x3d')](_0x46e553['id']['toString'](),_0x40de4f)[_0xedbc('0x3d')](_0xedbc('0x3e'),_0xedbc('0x3a'))[_0xedbc('0x3d')]('NOW()','updatedAt')[_0xedbc('0x44')](_0xedbc('0x40'))[_0xedbc('0x41')](_0xedbc('0x48'))[_0xedbc('0x41')](_0xedbc('0x42'),LISTID[_0xedbc('0x3f')]())[_0xedbc('0x41')](_0xedbc('0x49'),squel['str'](hopperContacts))['where'](_0xedbc('0x4a'))[_0xedbc('0x41')](_0xedbc('0x43'),squel[_0xedbc('0x3c')]()['field'](_0xedbc('0x4b'))['from'](_0xedbc('0x4c'))[_0xedbc('0x41')](_0x40de4f+_0xedbc('0x45'),_0x46e553['id'][_0xedbc('0x3f')]()))[_0xedbc('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xedbc('0x3d')]('phone')[_0xedbc('0x44')]('cm_hopper')['where'](_0x40de4f+_0xedbc('0x45'),_0x46e553['id'][_0xedbc('0x3f')]())))[_0xedbc('0x3f')]();return _0x193965;};function _0x11c60f(_0x53c64d,_0x515187){var _0x369794=squel[_0xedbc('0x46')]()[_0xedbc('0x35')](_0xedbc('0x36'))[_0xedbc('0x47')](['phone',_0xedbc('0x37'),_0xedbc('0x38'),_0xedbc('0x39'),_0x515187,_0xedbc('0x3a'),'updatedAt'],squel[_0xedbc('0x3c')]()['field']('phone','phone')[_0xedbc('0x3d')](_0xedbc('0x3e'),'scheduledAt')[_0xedbc('0x3d')]('id',_0xedbc('0x38'))[_0xedbc('0x3d')](LISTID['toString'](),_0xedbc('0x39'))['field'](_0x53c64d['id'][_0xedbc('0x3f')](),_0x515187)[_0xedbc('0x3d')](_0xedbc('0x3e'),_0xedbc('0x3a'))[_0xedbc('0x3d')](_0xedbc('0x3e'),_0xedbc('0x3b'))[_0xedbc('0x44')](_0xedbc('0x40'))[_0xedbc('0x41')](_0xedbc('0x48'))[_0xedbc('0x41')](_0xedbc('0x42'),LISTID['toString']())['where'](_0xedbc('0x49'),squel[_0xedbc('0x4d')](hopperContacts))[_0xedbc('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0xedbc('0x3f')]();return _0x369794;}function _0x2929fd(_0x3df7af,_0x574a44){var _0x9d4578=squel['insert']()[_0xedbc('0x35')](_0xedbc('0x4e'))[_0xedbc('0x47')]([_0xedbc('0x23'),_0xedbc('0x38'),_0xedbc('0x39'),_0x574a44,_0xedbc('0x3a'),'updatedAt'],squel[_0xedbc('0x3c')]()['field']('phone',_0xedbc('0x23'))[_0xedbc('0x3d')]('id',_0xedbc('0x38'))[_0xedbc('0x3d')](LISTID[_0xedbc('0x3f')](),'ListId')[_0xedbc('0x3d')](_0x3df7af['id'][_0xedbc('0x3f')](),_0x574a44)[_0xedbc('0x3d')](_0xedbc('0x3e'),'createdAt')['field']('NOW()','updatedAt')[_0xedbc('0x44')](_0xedbc('0x40'))[_0xedbc('0x41')]('deletedAt\x20IS\x20NULL')[_0xedbc('0x41')](_0xedbc('0x42'),LISTID['toString']())[_0xedbc('0x41')]('id\x20IN\x20?',squel[_0xedbc('0x4d')](hopperContacts))[_0xedbc('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0xedbc('0x3f')]();return _0x9d4578;}return db[_0xedbc('0x4f')]['findAll']({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xedbc('0x50')],'as':_0xedbc('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x58d5ac){var _0x3eb083=[];if(_0x58d5ac){var _0x4b4cad;for(var _0x5f0437=0x0,_0x507514;_0x5f0437<_0x58d5ac[_0xedbc('0x1d')];_0x5f0437+=0x1){_0x507514=_0x58d5ac[_0x5f0437][_0xedbc('0x52')]({'plain':!![]});switch(_0x507514[_0xedbc('0x53')]){case _0xedbc('0x54'):_0x3eb083[_0xedbc('0x2d')](db[_0xedbc('0x55')][_0xedbc('0x56')](_0x438cc4(_0x507514,_0xedbc('0x57')))[_0xedbc('0x2c')](function(){})['catch'](_0x2e59bd()));break;case'onlyIfOpen':_0x3eb083[_0xedbc('0x2d')](db['sequelize'][_0xedbc('0x56')](_0x10a475(_0x507514,'VoiceQueueId'))[_0xedbc('0x2c')](function(){})[_0xedbc('0x2f')](_0x2e59bd()));break;default:_0x3eb083[_0xedbc('0x2d')](db[_0xedbc('0x55')][_0xedbc('0x56')](_0x11c60f(_0x507514,_0xedbc('0x57')))['then'](function(){})[_0xedbc('0x2f')](_0x2e59bd()));}}}return _0x3eb083;})[_0xedbc('0x58')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xedbc('0x59')},'attributes':['id'],'include':[{'model':db[_0xedbc('0x50')],'as':_0xedbc('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x497ba6){var _0x2c9700=[];if(_0x497ba6){var _0x358024;for(var _0x3ef4e2=0x0,_0x4ebe46;_0x3ef4e2<_0x497ba6['length'];_0x3ef4e2+=0x1){_0x4ebe46=_0x497ba6[_0x3ef4e2][_0xedbc('0x52')]({'plain':!![]});_0x2c9700[_0xedbc('0x2d')](db[_0xedbc('0x55')]['query'](_0x2929fd(_0x4ebe46,_0xedbc('0x57')))['then'](function(){})[_0xedbc('0x2f')](_0x2e59bd()));}}return _0x2c9700;})[_0xedbc('0x58')]();})[_0xedbc('0x2c')](function(){return db[_0xedbc('0x5b')]['findAll']({'attributes':['id',_0xedbc('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xedbc('0x2c')](function(_0x238934){var _0x3f7839=[];if(_0x238934){for(var _0x2e5bc3=0x0,_0x3a2f42;_0x2e5bc3<_0x238934[_0xedbc('0x1d')];_0x2e5bc3+=0x1){_0x3a2f42=_0x238934[_0x2e5bc3][_0xedbc('0x52')]({'plain':!![]});switch(_0x3a2f42[_0xedbc('0x53')]){case'always':_0x3f7839[_0xedbc('0x2d')](db['sequelize'][_0xedbc('0x56')](_0x438cc4(_0x3a2f42,_0xedbc('0x5c')))[_0xedbc('0x2c')](function(){})[_0xedbc('0x2f')](_0x2e59bd()));break;case _0xedbc('0x5d'):_0x3f7839[_0xedbc('0x2d')](db[_0xedbc('0x55')][_0xedbc('0x56')](_0x10a475(_0x3a2f42,'CampaignId'))[_0xedbc('0x2c')](function(){})[_0xedbc('0x2f')](_0x2e59bd()));break;default:_0x3f7839['push'](db['sequelize'][_0xedbc('0x56')](_0x11c60f(_0x3a2f42,_0xedbc('0x5c')))[_0xedbc('0x2c')](function(){})[_0xedbc('0x2f')](_0x2e59bd()));}}}return _0x3f7839;})[_0xedbc('0x58')]();})[_0xedbc('0x2c')](function(){return db[_0xedbc('0x5b')][_0xedbc('0x5e')]({'attributes':['id'],'include':[{'model':db[_0xedbc('0x50')],'as':_0xedbc('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x171a32){var _0x4a9d8e=[];if(_0x171a32){for(var _0xa5b6b9=0x0,_0x8015af;_0xa5b6b9<_0x171a32[_0xedbc('0x1d')];_0xa5b6b9+=0x1){_0x8015af=_0x171a32[_0xa5b6b9]['get']({'plain':!![]});_0x4a9d8e[_0xedbc('0x2d')](db['sequelize'][_0xedbc('0x56')](_0x2929fd(_0x8015af,_0xedbc('0x5c')))['then'](function(){})[_0xedbc('0x2f')](_0x2e59bd()));}}return _0x4a9d8e;})['all']();})[_0xedbc('0x2f')](function(_0x64b67b){logger[_0xedbc('0x16')](_0xedbc('0x5f'),_0xedbc('0x60'),_0x64b67b['message']);});}var processPromises=function(_0x3507f1){return BPromise['all'](promises)[_0xedbc('0x2c')](function(_0x2cbb3f){})[_0xedbc('0x2f')](function(_0x50f2ba){logger[_0xedbc('0x16')](_0xedbc('0x61'),JSON[_0xedbc('0x31')](_0x50f2ba));})['finally'](function(){socket[_0xedbc('0x62')](_0xedbc('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3507f1){return _0x3507f1[_0xedbc('0x64')]();}});};var endCsv=function(){return BPromise[_0xedbc('0x65')]()[_0xedbc('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xedbc('0x2c')](function(){socket['emit'](_0xedbc('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xedbc('0x66')](FILEPATH);}catch(_0x4024ec){logger[_0xedbc('0x16')](_0xedbc('0x67'),JSON[_0xedbc('0x31')](_0x4024ec));}finally{process[_0xedbc('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0xedbc('0x69')](_0xedbc('0x6a'));endCsv();});function main(){return BPromise[_0xedbc('0x65')]()[_0xedbc('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xedbc('0x14')](',');return db[_0xedbc('0x2a')][_0xedbc('0x5e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xedbc('0x2c')](function(_0x2f3884){var _0x2111ae=fs[_0xedbc('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xedbc('0x6c')](_0x2111ae,{'header':!![],'skipEmptyLines':!![],'step':function(_0x24ec3f,_0x3bf17d){total+=0x1;var _0x2e23d8=total;promises['push'](checkRow(_0x24ec3f,_0x2f3884,_0x2e23d8)[_0xedbc('0x2c')](function(){success+=0x1;})[_0xedbc('0x2f')](function(_0x435ab7){if(_0x435ab7[_0xedbc('0x16')]){errors+=0x1;delete _0x435ab7['error'];}else if(_0x435ab7[_0xedbc('0x6d')]){duplicates+=0x1;delete _0x435ab7[_0xedbc('0x6d')];}rows[_0xedbc('0x2d')](_0x435ab7);}));if(total%0xc8===0x0){_0x3bf17d[_0xedbc('0x6e')]();return processPromises(_0x3bf17d);}},'complete':function(){return processPromises()[_0xedbc('0x2c')](function(){logger['info'](_0xedbc('0x6f'));endCsv();});},'error':function(_0x582114,_0x32bbba){logger[_0xedbc('0x69')](_0xedbc('0x70'),JSON[_0xedbc('0x31')](_0x582114));endCsv();}});})['catch'](function(_0x2735ca){logger[_0xedbc('0x16')](_0xedbc('0x71'),JSON['stringify'](_0x2735ca));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f921e00..a8090e8 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 _0xf6e6=['includes','header','ContactItemType','name','_description','parse','data','find','hasOwnProperty','trim','replace','isValid','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','filter','split','findOne','updated','CmContactHasItem','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','updatedAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.id\x20=\x20','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','phone','ListId','createdAt','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts','cm_hopper_black','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','isNil','utcOffset','set','offset','dialTimezone','main','send','binding','socket_timestamp','server/files/tmp','.csv'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x33bd9f,_0x3aa9f3){_0x33bd9f=_0x33bd9f-0x0;var _0x26136a=_0xf6e6[_0x33bd9f];return _0x26136a;};'use strict';var fs=require('fs');var path=require(_0x6f6e('0x0'));var _=require(_0x6f6e('0x1'));var Papa=require(_0x6f6e('0x2'));var util=require(_0x6f6e('0x3'));var BPromise=require(_0x6f6e('0x4'));var moment=require(_0x6f6e('0x5'));var squel=require(_0x6f6e('0x6'));var Redis=require(_0x6f6e('0x7'));var db=require(_0x6f6e('0x8'))['db'];var config=require(_0x6f6e('0x9'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')('import');config[_0x6f6e('0xa')]=_['defaults'](config[_0x6f6e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f6e('0xb'))(new Redis(config[_0x6f6e('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('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()['format'](_0x6f6e('0xc'));function isEmail(_0x5a3dca){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))*$/[_0x6f6e('0xd')](_0x5a3dca);}function selectNotIn(_0x4bbb02,_0x43e07a,_0x1c8923,_0x85090c,_0x3fc62b){return squel[_0x6f6e('0xe')]()[_0x6f6e('0xf')]('phone')['from'](_0x85090c)[_0x6f6e('0x10')](_0x43e07a,null,_0x43e07a+'.id\x20=\x20'+_0x85090c+'.'+_0x1c8923)['where'](_0x85090c+'.'+_0x1c8923+'\x20=\x20'+_0x4bbb02+'.'+_0x1c8923)['where'](_0x43e07a+_0x6f6e('0x11')+_0x3fc62b[_0x6f6e('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x50332a,_0x220ae7){promisesAdditionalPhones=[];return db['CmContact'][_0x6f6e('0x12')]({'raw':!![],'attributes':['id',_0x6f6e('0x13')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6f6e('0x14')](function(_0x15139c){if(_0x15139c!==null){var _0xfac229=[];for(var _0x1a6ffc=0x0;_0x1a6ffc<_0x15139c[_0x6f6e('0x15')];_0x1a6ffc++){var _0x5d4a7f=_0x15139c[_0x1a6ffc];_0xfac229[_0x6f6e('0x16')](insertAdditionalPhones(_0x5d4a7f));}}Promise[_0x6f6e('0x17')](_0xfac229)[_0x6f6e('0x14')](function(){_0x50332a({'val':0x1});});});});}function insertAdditionalPhones(_0x2cccaf){return new Promise(function(_0x155e91,_0x29d153){var _0x35f8d0=_0x2cccaf[_0x6f6e('0x13')];var _0x867a1=_0x35f8d0['split'](';');var _0x37f0ad=[];orderBy=0x0;for(var _0x54103c=0x0;_0x54103c<_0x867a1[_0x6f6e('0x15')];_0x54103c++){_0x37f0ad[_0x6f6e('0x16')](splitAdditionalPhone(_0x2cccaf['id'],_0x867a1[_0x54103c]));}Promise[_0x6f6e('0x17')](_0x37f0ad)[_0x6f6e('0x14')](function(){_0x155e91({'val':_0x867a1[_0x6f6e('0x15')]});});});}function splitAdditionalPhone(_0x130970,_0x1b31ec){return new Promise(function(_0x156ce3,_0xc12e2){var _0x3a35d0=_0x1b31ec['split'](':');var _0x251bfa=_0x3a35d0[0x0];var _0x123152=_0x3a35d0[0x1];if(!_['isNil'](_0x123152)){var _0x3dff1b=_0x123152['split']('|');var _0x58f46e=[];for(var _0x49d92c=0x0;_0x49d92c<_0x3dff1b[_0x6f6e('0x15')];_0x49d92c++){if(_0x3dff1b[_0x49d92c]!==''){var _0x3b50bd=_[_0x6f6e('0x18')](promisesAdditionalPhones,{'contactId':_0x130970,'phone':_0x3dff1b[_0x49d92c]});if(_0x3b50bd[_0x6f6e('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0x6f6e('0x16')]({'contactId':_0x130970,'contactTypeId':_0x251bfa,'phone':_0x3dff1b[_0x49d92c],'orderBy':orderBy});}}}_0x156ce3({'ok':0x1});}else _0x156ce3({'res':0x0});});}function createAdditionalPhone(_0x4685b6,_0x376402,_0x14aaef,_0xbbfbe1){var _0x125fa8='';var _0x21019d='';var _0xdb0684=_0x14aaef[_0x6f6e('0x19')]('§');_0x125fa8=_0xdb0684[0x0];if(_0xdb0684[_0x6f6e('0x15')]==0x2)_0x21019d=_0xdb0684[0x1];return new Promise(function(_0x18852b,_0x479956){return db['CmContactHasItem'][_0x6f6e('0x1a')]({'where':{'CmContactId':_0x4685b6,'item':_0x125fa8}})[_0x6f6e('0x14')](function(_0x4fbc90){if(_0x4fbc90){return db['CmContactHasItem']['update']({'ItemTypeId':_0x376402,'description':_0x21019d,'OrderBy':_0xbbfbe1},{'where':{'CmContactId':_0x4685b6,'item':_0x125fa8}})[_0x6f6e('0x14')](function(_0x46f90d){_0x18852b({'res':_0x6f6e('0x1b')});});}else{return db[_0x6f6e('0x1c')][_0x6f6e('0x1d')]({'CmContactId':_0x4685b6,'item':_0x125fa8,'description':_0x21019d,'ItemTypeId':_0x376402,'OrderBy':_0xbbfbe1,'ItemClass':_0x6f6e('0x1e')})[_0x6f6e('0x14')](function(_0x303756){_0x18852b({'res':_0x6f6e('0x1f')});});}});});}function insertCmHopper(_0x4dd384,_0x3c22f1,_0x783821,_0x51579d,_0x1c9a4a){var _0x338706=['cm_contacts.phone',_0x6f6e('0x20'),_0x6f6e('0x21'),_0x6f6e('0x22'),_0x3c22f1+'.'+_0x51579d,_0x6f6e('0x23'),_0x6f6e('0x24'),_0x6f6e('0x25'),_0x6f6e('0x26'),'\x22'+_0x1c9a4a+'\x22'];return squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')](_0x6f6e('0x29'))[_0x6f6e('0x2a')](['phone',_0x6f6e('0x2b'),_0x6f6e('0x2c'),'ListId',_0x51579d,'createdAt',_0x6f6e('0x2d'),'priority',_0x6f6e('0x2e'),_0x6f6e('0x2f')],squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0x338706)[_0x6f6e('0x31')](_0x3c22f1)[_0x6f6e('0x10')]('cm_contacts',null,_0x6f6e('0x32')+_0x3c22f1+'.CmListId')[_0x6f6e('0x10')](_0x783821,null,_0x783821+_0x6f6e('0x33')+_0x3c22f1+'.'+_0x51579d)[_0x6f6e('0x34')](_0x3c22f1+'.CmListId\x20=\x20?',_0x4dd384)['where'](_0x6f6e('0x35'),NOW)[_0x6f6e('0x34')](_0x6f6e('0x36'),selectNotIn(_0x3c22f1,_0x783821,_0x51579d,'cm_hopper',[_0x6f6e('0x37'),_0x6f6e('0x38')]))[_0x6f6e('0x34')](_0x6f6e('0x36'),selectNotIn(_0x3c22f1,_0x783821,_0x51579d,_0x6f6e('0x29'),[_0x6f6e('0x37')])))[_0x6f6e('0x39')]();}function insertCmHopperBlack(_0x3303fe,_0x57f921,_0xa183f3,_0x2846ce){var _0xf9159e=[_0x6f6e('0x3a'),_0x6f6e('0x21'),_0x6f6e('0x22'),_0x57f921+'.'+_0x2846ce,'cm_contacts.createdAt',_0x6f6e('0x24')];return squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')]('cm_hopper_black')[_0x6f6e('0x2a')]([_0x6f6e('0x3b'),_0x6f6e('0x2c'),_0x6f6e('0x3c'),_0x2846ce,_0x6f6e('0x3d'),'updatedAt'],squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0xf9159e)['from'](_0x57f921)[_0x6f6e('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x57f921+_0x6f6e('0x3e'))[_0x6f6e('0x10')](_0xa183f3,null,_0xa183f3+_0x6f6e('0x33')+_0x57f921+'.'+_0x2846ce)[_0x6f6e('0x34')](_0x57f921+_0x6f6e('0x3f'),_0x3303fe)['where'](_0x6f6e('0x35'),NOW)[_0x6f6e('0x34')](_0x6f6e('0x36'),squel[_0x6f6e('0xe')]()['field'](_0x6f6e('0x3b'))[_0x6f6e('0x31')]('cm_hopper_black')[_0x6f6e('0x34')](_0x6f6e('0x40'),_0x3303fe)[_0x6f6e('0x34')](_0x2846ce+'\x20=\x20'+_0x57f921+'.'+_0x2846ce)))['toString']();}function insertTzCmHopper(_0x11b6ec,_0x42e682,_0x16266b,_0x58f752,_0x3ddf48,_0x1fec79){var _0x47e284=[_0x6f6e('0x3a'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x1fec79+_0x6f6e('0x41'),_0x6f6e('0x21'),_0x6f6e('0x22'),_0x42e682+'.'+_0x58f752,_0x6f6e('0x23'),'cm_contacts.updatedAt',_0x6f6e('0x25'),_0x6f6e('0x26'),'\x22'+_0x3ddf48+'\x22'];var _0x3a65e6=squel[_0x6f6e('0x27')]()['into'](_0x6f6e('0x29'))[_0x6f6e('0x2a')](['phone','scheduledat',_0x6f6e('0x2c'),'ListId',_0x58f752,_0x6f6e('0x3d'),'updatedAt','priority',_0x6f6e('0x2e'),_0x6f6e('0x2f')],squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0x47e284)[_0x6f6e('0x31')](_0x42e682)[_0x6f6e('0x10')](_0x6f6e('0x42'),null,_0x6f6e('0x32')+_0x42e682+_0x6f6e('0x3e'))[_0x6f6e('0x10')](_0x16266b,null,_0x16266b+_0x6f6e('0x33')+_0x42e682+'.'+_0x58f752)['join'](_0x1fec79,null,_0x1fec79+'.id\x20=\x20'+_0x42e682+'.'+_0x58f752)[_0x6f6e('0x34')](_0x42e682+_0x6f6e('0x3f'),_0x11b6ec)[_0x6f6e('0x34')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x42e682,_0x16266b,_0x58f752,_0x6f6e('0x29'),['\x22always\x22',_0x6f6e('0x38')]))['where'](_0x6f6e('0x36'),selectNotIn(_0x42e682,_0x16266b,_0x58f752,_0x6f6e('0x29'),[_0x6f6e('0x37')])))['toString']();return _0x3a65e6;}function insertTzCmHopperBlack(_0x27f5f0,_0x551416,_0x96ea87,_0x45f1fd){var _0x3074ee=['cm_contacts.phone',_0x6f6e('0x21'),_0x6f6e('0x22'),_0x551416+'.'+_0x45f1fd,'cm_contacts.createdAt',_0x6f6e('0x24')];return squel[_0x6f6e('0x27')]()['into'](_0x6f6e('0x43'))['fromQuery']([_0x6f6e('0x3b'),_0x6f6e('0x2c'),_0x6f6e('0x3c'),_0x45f1fd,_0x6f6e('0x3d'),_0x6f6e('0x2d')],squel['select']()['fields'](_0x3074ee)[_0x6f6e('0x31')](_0x551416)['join']('cm_contacts',null,_0x6f6e('0x32')+_0x551416+_0x6f6e('0x3e'))[_0x6f6e('0x10')](_0x96ea87,null,_0x96ea87+_0x6f6e('0x33')+_0x551416+'.'+_0x45f1fd)[_0x6f6e('0x34')](_0x551416+_0x6f6e('0x3f'),_0x27f5f0)['where'](_0x6f6e('0x35'),NOW)[_0x6f6e('0x34')](_0x6f6e('0x36'),squel['select']()[_0x6f6e('0xf')]('phone')['from']('cm_hopper_black')['where']('ListId\x20=\x20?',_0x27f5f0)['where'](_0x45f1fd+_0x6f6e('0x44')+_0x551416+'.'+_0x45f1fd)))[_0x6f6e('0x39')]();}function insertCmHopperAdditionalPhones(_0x117334){var _0x5dfa8c=[_0x6f6e('0x45'),_0x6f6e('0x46'),_0x6f6e('0x47'),'cm_contact_has_items.createdAt',_0x6f6e('0x48')];return squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')](_0x6f6e('0x49'))[_0x6f6e('0x2a')]([_0x6f6e('0x4a'),_0x6f6e('0x3b'),_0x6f6e('0x4b'),'createdAt','updatedAt'],squel['select']()[_0x6f6e('0x30')](_0x5dfa8c)[_0x6f6e('0x31')]('cm_hopper')[_0x6f6e('0x10')](_0x6f6e('0x42'),null,_0x6f6e('0x4c'))[_0x6f6e('0x10')](_0x6f6e('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6f6e('0x34')](_0x6f6e('0x4e'),_0x117334)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6f6e('0x39')]();}function insertCmContact(_0x352536,_0x3c2e53,_0x1b45b6,_0x23ba86){var _0x12a4fa=_[_0x6f6e('0x4f')](_[_0x6f6e('0x50')](_0x23ba86),[_0x6f6e('0x3c'),_0x6f6e('0x51'),_0x6f6e('0x3d'),_0x6f6e('0x2d')]);return squel[_0x6f6e('0x27')]()['into'](_0x6f6e('0x42'))['fromQuery'](_0x12a4fa,squel['select']()['fields'](_0x12a4fa)['from'](_0x3c2e53)['where']('('+_0x1b45b6[_0x6f6e('0x10')](',')+_0x6f6e('0x52'),squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')](_0x1b45b6)['from']('cm_contacts')[_0x6f6e('0x34')](_0x6f6e('0x40'),_0x352536)[_0x6f6e('0x34')]('deletedAt\x20IS\x20NULL'))[_0x6f6e('0x34')](_0x6f6e('0x53'),squel[_0x6f6e('0xe')]()[_0x6f6e('0xf')](_0x6f6e('0x54'),_0x6f6e('0x55'))['from'](_0x3c2e53)['group'](_0x1b45b6['join'](','))))[_0x6f6e('0x39')]();}function handleStop(){logger['info'](_0x6f6e('0x56'));stopped=!![];}function handleUncaughtException(_0x4013db){logger[_0x6f6e('0x57')](_0x4013db[_0x6f6e('0x58')]);process[_0x6f6e('0x59')](0x1);}function handleError(_0x4eebd5,_0x3f8d80){stats[_0x6f6e('0x5a')]['push']({'name':_0x3f8d80[_0x6f6e('0x5b')],'message':_0x3f8d80['message'],'row':_0x4eebd5});}function handleQuery(_0x4f579a){logger[_0x6f6e('0x5c')](_0x4f579a);return db[_0x6f6e('0x5d')][_0x6f6e('0x5e')](_0x4f579a)['spread'](function(_0x3e7a28){results['push'](_0x3e7a28);})[_0x6f6e('0x5f')](function(_0x4c74bc){logger[_0x6f6e('0x57')](_0x4c74bc[_0x6f6e('0x58')]);});}function updateTzCampaigns(_0x53600c){return new Promise(function(_0x498cea,_0x497589){var _0xf72a24=squel[_0x6f6e('0xe')]()[_0x6f6e('0x30')]([_0x6f6e('0x60'),_0x6f6e('0x61')])[_0x6f6e('0x31')](_0x6f6e('0x62'))[_0x6f6e('0x10')](_0x6f6e('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x6f6e('0x34')](_0x6f6e('0x64')+_0x53600c);db[_0x6f6e('0x5d')][_0x6f6e('0x5e')](_0xf72a24[_0x6f6e('0x39')]())[_0x6f6e('0x65')](function(_0xea285a){var _0x30799c=[];for(var _0x10e6ae=0x0;_0x10e6ae<_0xea285a[_0x6f6e('0x15')];_0x10e6ae++){_0x30799c[_0x6f6e('0x16')](getTimezoneData(_0xea285a[_0x10e6ae],tmp_campaigns));}BPromise[_0x6f6e('0x17')](_0x30799c)[_0x6f6e('0x14')](function(){_0x498cea({'val':0x1});});})[_0x6f6e('0x5f')](function(_0x2f6612){logger[_0x6f6e('0x57')](_0x2f6612[_0x6f6e('0x58')]);_0x498cea({'val':0x0});});});}function updateTzVoiceQueues(_0x514baf){return new Promise(function(_0x211c75,_0x343673){var _0x2ff985=squel[_0x6f6e('0xe')]()['fields'](['voice_queues.id',_0x6f6e('0x66')])[_0x6f6e('0x31')](_0x6f6e('0x67'))['join'](_0x6f6e('0x68'),null,_0x6f6e('0x69'))[_0x6f6e('0x34')](_0x6f6e('0x6a')+_0x514baf);db[_0x6f6e('0x5d')]['query'](_0x2ff985['toString']())['spread'](function(_0x3cfe4a){var _0x3a7c01=[];for(var _0x23624e=0x0;_0x23624e<_0x3cfe4a[_0x6f6e('0x15')];_0x23624e++){_0x3a7c01[_0x6f6e('0x16')](getTimezoneData(_0x3cfe4a[_0x23624e],tmp_voice_queues));}BPromise[_0x6f6e('0x17')](_0x3a7c01)['then'](function(){_0x211c75({'val':0x1});});})[_0x6f6e('0x5f')](function(_0x2206c5){logger[_0x6f6e('0x57')](_0x2206c5['message']);_0x211c75({'val':0x0});});});}function getTimezoneData(_0x415d94,_0x2afcc5){return new Promise(function(_0x35a659,_0x469504){var _0x5506a8=shared[_0x6f6e('0x6b')];var _0x2d5a22=_0x5506a8[_0x415d94['dialTimezone']];if(_[_0x6f6e('0x6c')](_0x2d5a22)){_0x35a659({'ret':0x1});}else{var _0x196935=_0x2d5a22[_0x6f6e('0x6d')];var _0x350bb2=squel[_0x6f6e('0x27')]()[_0x6f6e('0x28')](_0x2afcc5)[_0x6f6e('0x6e')]('id',_0x415d94['id'])['set'](_0x6f6e('0x6f'),_0x196935)['set'](_0x6f6e('0x70'),_0x415d94[_0x6f6e('0x70')])[_0x6f6e('0x39')]();return db[_0x6f6e('0x5d')][_0x6f6e('0x5e')](_0x350bb2)[_0x6f6e('0x65')](function(_0x1b4f65){_0x35a659({'ret':0x1});})[_0x6f6e('0x5f')](function(_0x4e4d8d){logger[_0x6f6e('0x57')](_0x4e4d8d['message']);_0x469504({'ret':0x1});});}});}function handleTZQuery(_0x3feb97){logger[_0x6f6e('0x5c')](_0x3feb97);return db['sequelize'][_0x6f6e('0x5e')](_0x3feb97)['spread'](function(_0x552242){})[_0x6f6e('0x5f')](function(_0x42dcbb){logger[_0x6f6e('0x57')](_0x42dcbb['message']);});}function main(_0x561ab1,_0x3d9c79,_0x5b6af0,_0xc32259){logger[_0x6f6e('0x5c')](_0x6f6e('0x71'),_0x561ab1,JSON['stringify'](_0x3d9c79));process[_0x6f6e('0x72')]('start');var _0x53cf1=_0x3d9c79[_0x6f6e('0x73')];var _0x3d7953=_['clone'](_0x53cf1);var _0x55d5e6=_0x3d9c79[_0x6f6e('0x74')];var _0x155a42=path[_0x6f6e('0x10')](config['root'],_0x6f6e('0x75'),_0x55d5e6+_0x6f6e('0x76'));hasTZ=_[_0x6f6e('0x50')](_0x53cf1)[_0x6f6e('0x77')]('dialTimezone');var _0x3b159f=_[_0x6f6e('0x50')](_0x53cf1)[_0x6f6e('0x10')]();logger[_0x6f6e('0x5c')](_0x6f6e('0x78'),_0x3b159f);db[_0x6f6e('0x79')][_0x6f6e('0x12')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x16bc76){for(var _0x38c631=0x0;_0x38c631<_0x16bc76['length'];_0x38c631++){if(_0x16bc76[_0x38c631][_0x6f6e('0x7a')]in _0x53cf1){contactItemTypes[_0x6f6e('0x16')](_0x16bc76[_0x38c631]);delete _0x3d7953[_0x16bc76[_0x38c631][_0x6f6e('0x7a')]];hasAdditionalPhones=!![];}for(var _0x907727 in _0x53cf1){if(_0x16bc76[_0x38c631]['name']+_0x6f6e('0x7b')===_0x907727){phoneDescriptions['push']({'itemTypeId':_0x16bc76[_0x38c631]['id'],'description':_0x907727});delete _0x3d7953[_0x907727];}}}if(hasAdditionalPhones)_0x3d7953[_0x6f6e('0x13')]='';var _0x19b123=_[_0x6f6e('0x50')](_0x3d7953)['join']();logger['info'](_0x6f6e('0x78'),_0x19b123);fs['writeFileSync'](_0x155a42,_0x19b123+'\x0a');Papa[_0x6f6e('0x7c')](fs['createReadStream'](_0x561ab1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4300b4,_0x5f16a6){try{for(var _0x2c497c=0x0,_0xfcae0=[];_0x2c497c<_0x4300b4['data'][_0x6f6e('0x15')];_0x2c497c++){stats['rows']+=0x1;if(_0x4300b4[_0x6f6e('0x5a')][_0x2c497c]){handleError(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c],_0x4300b4[_0x6f6e('0x5a')][_0x2c497c]);}else{var _0x4c3b82=[];var _0x284180=[];var _0x3648ac={};for(var _0x4ecf37 in _0x53cf1){let _0x3743c9=contactItemTypes[_0x6f6e('0x7e')](_0x4f6672=>_0x4f6672[_0x6f6e('0x7a')]===_0x4ecf37);let _0x32953f=contactItemTypes[_0x6f6e('0x7e')](_0x9f771f=>_0x9f771f[_0x6f6e('0x7a')]+'_description'===_0x4ecf37);if(_[_0x6f6e('0x6c')](_0x3743c9)&&_['isNil'](_0x32953f)){if(_0x53cf1[_0x6f6e('0x7f')](_0x4ecf37)){if(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x4ecf37]]){var _0xe34817=_[_0x6f6e('0x80')](_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x4ecf37]][_0x6f6e('0x81')](/"/g,'\x27'));switch(_0x4ecf37){case'scheduledat':var _0x3e9c08=moment(_0xe34817,_0x6f6e('0xc'),!![]);if(_0x3e9c08[_0x6f6e('0x82')]()){_0xfcae0['push']('\x22'+_0xe34817+'\x22');}else{_0x4c3b82['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x621f75=parseInt(_0xe34817);_0xe34817=_[_0x6f6e('0x83')](_0x621f75)||_0x621f75<0x0||_0x621f75>0x4?_0xc32259?0x3:0x2:_0x621f75;_0xfcae0[_0x6f6e('0x16')]('\x22'+_0xe34817+'\x22');break;case _0x6f6e('0x2e'):var _0xca79af=parseInt(_0xe34817);if(_['isNumber'](_0xca79af)&&_[_0x6f6e('0x77')](_0x5b6af0,_0xca79af)){_0xfcae0[_0x6f6e('0x16')]('\x22'+_0xca79af+'\x22');}else{_0x4c3b82[_0x6f6e('0x16')](_0x6f6e('0x84'));}break;case _0x6f6e('0x85'):if(isEmail(_0xe34817)){_0xfcae0[_0x6f6e('0x16')]('\x22'+_0xe34817+'\x22');}else{_0x4c3b82['push'](_0x6f6e('0x86'));}break;case _0x6f6e('0x87'):var _0x4ebc19=moment(_0xe34817,_0x6f6e('0x88'),!![]);if(_0x4ebc19[_0x6f6e('0x82')]()){_0xfcae0['push']('\x22'+_0xe34817+'\x22');}else{_0x4c3b82[_0x6f6e('0x16')](_0x6f6e('0x89'));}break;case _0x6f6e('0x70'):var _0x2ae49a=shared[_0x6f6e('0x6b')];var _0x1cb571=_0x2ae49a[_0xe34817];if(!_['isNil'](_0x1cb571)){var _0x170130=_0x1cb571['utcOffset'];_0xfcae0['push']('\x22'+_0xe34817+'\x22');_0xfcae0['push']('\x22'+_0x170130+'\x22');}break;default:_0xfcae0['push']('\x22'+_0xe34817+'\x22');}}else{switch(_0x4ecf37){case _0x6f6e('0x8a'):case _0x6f6e('0x3b'):_0x4c3b82[_0x6f6e('0x16')](_0x4ecf37+'\x20not\x20specified');break;default:_0xfcae0[_0x6f6e('0x16')]('\x22\x22');}}}}else{var _0xf183d1='';if(!_[_0x6f6e('0x6c')](_0x3743c9)){if(!_0x3648ac[_0x6f6e('0x7f')](_0x3743c9['id'])){if(!_['isNil'](_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x4ecf37]])){var _0xe34817=_[_0x6f6e('0x80')](_0x4300b4['data'][_0x2c497c][_0x53cf1[_0x4ecf37]][_0x6f6e('0x81')](/"/g,'\x27'));var _0x1f5e3b=phoneDescriptions[_0x6f6e('0x7e')](_0x51133c=>_0x51133c[_0x6f6e('0x8b')]===_0x3743c9['id']);if(!_[_0x6f6e('0x6c')](_0x1f5e3b)){var _0x3bc989=_[_0x6f6e('0x80')](_0x4300b4[_0x6f6e('0x7d')][_0x2c497c][_0x53cf1[_0x1f5e3b[_0x6f6e('0x8c')]]][_0x6f6e('0x81')](/"/g,'\x27'));if(!_[_0x6f6e('0x6c')](_0x3bc989))_0xe34817=_0xe34817+'§'+_0x3bc989;}if(_0xf183d1=='')_0xf183d1=_0xe34817;else _0xf183d1+='|'+_0xe34817;}_0x284180[_0x6f6e('0x16')](_0x3743c9['id']+':'+_0xf183d1);_0x3648ac[_0x3743c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0xfcae0[_0x6f6e('0x16')]('\x22'+_0x284180[_0x6f6e('0x10')](';')+'\x22');}if(_0x4c3b82[_0x6f6e('0x15')]){handleError(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c],{'code':_0x6f6e('0x8d'),'message':_0x4c3b82[_0x6f6e('0x10')]()});}else{fs[_0x6f6e('0x8e')](_0x155a42,_0xfcae0['join']()+'\x0a');}_0xfcae0=[];}if(!(stats[_0x6f6e('0x8f')]%0xc8)){socket[_0x6f6e('0x90')](_0x6f6e('0x91')+_0x55d5e6,stats);stats[_0x6f6e('0x5a')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x5f16a6[_0x6f6e('0x92')]();}}catch(_0x3e54f5){handleError(_0x4300b4[_0x6f6e('0x7d')][_0x2c497c],{'code':_0x6f6e('0x93'),'message':_0x3e54f5['message']});logger[_0x6f6e('0x57')](_0x6f6e('0x94'),_0x3e54f5['message']);}},'complete':function(){try{var _0x478da4=[];var _0x1dce3e=[];var _0x1e9da2=_0x6f6e('0x42');if(_0x3d9c79[_0x6f6e('0x95')]&&_0x3d9c79[_0x6f6e('0x95')][_0x6f6e('0x15')]){_0x1e9da2=_0x6f6e('0x96')+_0x55d5e6;_0x478da4[_0x6f6e('0x16')](_0x6f6e('0x97')+_0x1e9da2+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x6f6e('0x98')+_0x55d5e6;tmp_voice_queues=_0x6f6e('0x99')+_0x55d5e6;_0x1dce3e[_0x6f6e('0x16')](_0x6f6e('0x97')+tmp_campaigns+_0x6f6e('0x9a'));_0x1dce3e[_0x6f6e('0x16')](_0x6f6e('0x97')+tmp_voice_queues+_0x6f6e('0x9a'));BPromise[_0x6f6e('0x9b')](_0x1dce3e,handleTZQuery)['then'](function(_0x447909){updateTzCampaigns(_0x3d9c79[_0x6f6e('0x3c')])[_0x6f6e('0x14')](function(_0x24d6d3){updateTzVoiceQueues(_0x3d9c79[_0x6f6e('0x3c')])[_0x6f6e('0x14')](function(_0x2bff8a){if(hasTZ)_0x19b123=_0x19b123[_0x6f6e('0x81')](_0x6f6e('0x70'),'dialTimezone,utcOffset');var _0x26cbe7=util[_0x6f6e('0x9c')](_0x6f6e('0x9d'),_0x155a42,_0x1e9da2,_0x19b123,_0x3d9c79[_0x6f6e('0x3c')],_0x3d9c79[_0x6f6e('0x51')]||null,NOW,NOW);if(_[_0x6f6e('0x6c')](_0x53cf1[_0x6f6e('0x2b')])){_0x26cbe7+=',\x20scheduledAt\x20=\x20NOW()';}_0x478da4[_0x6f6e('0x16')](_0x26cbe7);if(_0x3d9c79[_0x6f6e('0x95')]&&_0x3d9c79[_0x6f6e('0x95')]['length']){_0x478da4['push'](insertCmContact(_0x3d9c79[_0x6f6e('0x3c')],_0x1e9da2,_0x3d9c79[_0x6f6e('0x95')],_0x53cf1));_0x478da4[_0x6f6e('0x16')](_0x6f6e('0x9e')+_0x1e9da2+';');}BPromise[_0x6f6e('0x9b')](_0x478da4,handleQuery)[_0x6f6e('0x14')](function(_0x453e91){BPromise['all']([handleAdditionalPhones()])[_0x6f6e('0x14')](function(){_0x478da4=[];for(var _0x47b68d=0x0;_0x47b68d\x20\x20','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','split','all','isNil','filter','CmContactHasItem','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','insert','cm_hopper_black','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)','recallme','cm_hopper.id'];(function(_0x2569dc,_0x4355b9){var _0x1c5622=function(_0x49cb7e){while(--_0x49cb7e){_0x2569dc['push'](_0x2569dc['shift']());}};_0x1c5622(++_0x4355b9);}(_0xa786,0x71));var _0x6a78=function(_0x775d18,_0x5407b0){_0x775d18=_0x775d18-0x0;var _0x16ab57=_0xa786[_0x775d18];return _0x16ab57;};'use strict';var fs=require('fs');var path=require(_0x6a78('0x0'));var _=require(_0x6a78('0x1'));var Papa=require(_0x6a78('0x2'));var util=require('util');var BPromise=require(_0x6a78('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x6a78('0x4'));var db=require(_0x6a78('0x5'))['db'];var config=require(_0x6a78('0x6'));var shared=require(_0x6a78('0x7'));var logger=require(_0x6a78('0x8'))(_0x6a78('0x9'));config[_0x6a78('0xa')]=_['defaults'](config[_0x6a78('0xa')],{'host':_0x6a78('0xb'),'port':0x18eb});var socket=require(_0x6a78('0xc'))(new Redis(config[_0x6a78('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6a78('0xd')](_0x6a78('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6a78('0xd')](_0x6a78('0xe'));function isEmail(_0x43e233){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x43e233);}function selectNotIn(_0x25b436,_0x1fca69,_0x1d0fac,_0x562d96,_0x2a433a){return squel[_0x6a78('0xf')]()[_0x6a78('0x10')](_0x6a78('0x11'))[_0x6a78('0x12')](_0x562d96)['join'](_0x1fca69,null,_0x1fca69+_0x6a78('0x13')+_0x562d96+'.'+_0x1d0fac)[_0x6a78('0x14')](_0x562d96+'.'+_0x1d0fac+_0x6a78('0x15')+_0x25b436+'.'+_0x1d0fac)['where'](_0x1fca69+_0x6a78('0x16')+_0x2a433a[_0x6a78('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4c5351,_0x476d18){promisesAdditionalPhones=[];return db[_0x6a78('0x18')][_0x6a78('0x19')]({'raw':!![],'attributes':['id',_0x6a78('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6a78('0x1b')](function(_0x36e824){if(_0x36e824!==null){var _0x4e9031=[];for(var _0x27d687=0x0;_0x27d687<_0x36e824[_0x6a78('0x1c')];_0x27d687++){var _0x4746c0=_0x36e824[_0x27d687];_0x4e9031[_0x6a78('0x1d')](insertAdditionalPhones(_0x4746c0));}}Promise['all'](_0x4e9031)['then'](function(){_0x4c5351({'val':0x1});});});});}function insertAdditionalPhones(_0x460991){return new Promise(function(_0x585917,_0x5be128){var _0x4efb20=_0x460991[_0x6a78('0x1a')];var _0xed3863=_0x4efb20[_0x6a78('0x1e')](';');var _0x5e7922=[];orderBy=0x0;for(var _0x552e8f=0x0;_0x552e8f<_0xed3863[_0x6a78('0x1c')];_0x552e8f++){_0x5e7922[_0x6a78('0x1d')](splitAdditionalPhone(_0x460991['id'],_0xed3863[_0x552e8f]));}Promise[_0x6a78('0x1f')](_0x5e7922)[_0x6a78('0x1b')](function(){_0x585917({'val':_0xed3863['length']});});});}function splitAdditionalPhone(_0x5e7c1e,_0x4bd03c){return new Promise(function(_0xd57884,_0x5869fd){var _0xd938cd=_0x4bd03c[_0x6a78('0x1e')](':');var _0x107cda=_0xd938cd[0x0];var _0x4b47b6=_0xd938cd[0x1];if(!_[_0x6a78('0x20')](_0x4b47b6)){var _0xa5f42f=_0x4b47b6[_0x6a78('0x1e')]('|');var _0x2a363f=[];for(var _0x246f6c=0x0;_0x246f6c<_0xa5f42f[_0x6a78('0x1c')];_0x246f6c++){if(_0xa5f42f[_0x246f6c]!==''){var _0x401ff9=_[_0x6a78('0x21')](promisesAdditionalPhones,{'contactId':_0x5e7c1e,'phone':_0xa5f42f[_0x246f6c]});if(_0x401ff9['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6a78('0x1d')]({'contactId':_0x5e7c1e,'contactTypeId':_0x107cda,'phone':_0xa5f42f[_0x246f6c],'orderBy':orderBy});}}}_0xd57884({'ok':0x1});}else _0xd57884({'res':0x0});});}function createAdditionalPhone(_0xf17e35,_0x1e91ad,_0x57a859,_0x19860c){var _0x47bb83='';var _0xbe2627='';var _0x196b81=_0x57a859['split']('§');_0x47bb83=_0x196b81[0x0];if(_0x196b81[_0x6a78('0x1c')]==0x2)_0xbe2627=_0x196b81[0x1];return new Promise(function(_0x159b96,_0xfdd266){return db[_0x6a78('0x22')]['findOne']({'where':{'CmContactId':_0xf17e35,'item':_0x47bb83}})[_0x6a78('0x1b')](function(_0x125ca2){if(_0x125ca2){return db[_0x6a78('0x22')][_0x6a78('0x23')]({'ItemTypeId':_0x1e91ad,'description':_0xbe2627,'OrderBy':_0x19860c},{'where':{'CmContactId':_0xf17e35,'item':_0x47bb83}})['then'](function(_0x1389d9){_0x159b96({'res':_0x6a78('0x24')});});}else{return db[_0x6a78('0x22')]['create']({'CmContactId':_0xf17e35,'item':_0x47bb83,'description':_0xbe2627,'ItemTypeId':_0x1e91ad,'OrderBy':_0x19860c,'ItemClass':_0x6a78('0x25')})[_0x6a78('0x1b')](function(_0x4f89b5){_0x159b96({'res':_0x6a78('0x26')});});}});});}function insertCmHopper(_0xc39fee,_0x232c1c,_0xc40df3,_0x356e32,_0x4d5fa4){var _0x42296a=[_0x6a78('0x27'),'cm_contacts.scheduledat',_0x6a78('0x28'),_0x6a78('0x29'),_0x232c1c+'.'+_0x356e32,_0x6a78('0x2a'),_0x6a78('0x2b'),_0x6a78('0x2c'),_0x6a78('0x2d'),'\x22'+_0x4d5fa4+'\x22'];return squel['insert']()[_0x6a78('0x2e')]('cm_hopper')[_0x6a78('0x2f')]([_0x6a78('0x11'),_0x6a78('0x30'),_0x6a78('0x31'),_0x6a78('0x32'),_0x356e32,_0x6a78('0x33'),_0x6a78('0x34'),_0x6a78('0x35'),_0x6a78('0x36'),'recallme'],squel['select']()[_0x6a78('0x37')](_0x42296a)['from'](_0x232c1c)[_0x6a78('0x17')](_0x6a78('0x38'),null,_0x6a78('0x39')+_0x232c1c+_0x6a78('0x3a'))[_0x6a78('0x17')](_0xc40df3,null,_0xc40df3+_0x6a78('0x13')+_0x232c1c+'.'+_0x356e32)[_0x6a78('0x14')](_0x232c1c+_0x6a78('0x3b'),_0xc39fee)['where'](_0x6a78('0x3c'),NOW)[_0x6a78('0x14')](_0x6a78('0x3d'),selectNotIn(_0x232c1c,_0xc40df3,_0x356e32,'cm_hopper',[_0x6a78('0x3e'),'\x22onlyIfOpen\x22']))[_0x6a78('0x14')](_0x6a78('0x3d'),selectNotIn(_0x232c1c,_0xc40df3,_0x356e32,_0x6a78('0x3f'),[_0x6a78('0x3e')])))['toString']();}function insertCmHopperBlack(_0x5a6dd6,_0x4a15e9,_0x716729,_0xf25c9b){var _0x48eafa=[_0x6a78('0x27'),_0x6a78('0x28'),_0x6a78('0x29'),_0x4a15e9+'.'+_0xf25c9b,_0x6a78('0x2a'),_0x6a78('0x2b')];return squel[_0x6a78('0x40')]()['into'](_0x6a78('0x41'))[_0x6a78('0x2f')]([_0x6a78('0x11'),_0x6a78('0x31'),_0x6a78('0x32'),_0xf25c9b,_0x6a78('0x33'),_0x6a78('0x34')],squel['select']()[_0x6a78('0x37')](_0x48eafa)['from'](_0x4a15e9)[_0x6a78('0x17')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4a15e9+_0x6a78('0x3a'))[_0x6a78('0x17')](_0x716729,null,_0x716729+'.id\x20=\x20'+_0x4a15e9+'.'+_0xf25c9b)[_0x6a78('0x14')](_0x4a15e9+_0x6a78('0x3b'),_0x5a6dd6)[_0x6a78('0x14')](_0x6a78('0x3c'),NOW)[_0x6a78('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6a78('0x10')](_0x6a78('0x11'))[_0x6a78('0x12')](_0x6a78('0x41'))[_0x6a78('0x14')](_0x6a78('0x42'),_0x5a6dd6)[_0x6a78('0x14')](_0xf25c9b+'\x20=\x20'+_0x4a15e9+'.'+_0xf25c9b)))[_0x6a78('0x43')]();}function insertTzCmHopper(_0x41e924,_0x4d9092,_0x2f4e70,_0x22a584,_0x2ad4c4,_0x4732b7){var _0x33a221=[_0x6a78('0x27'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x4732b7+_0x6a78('0x44'),_0x6a78('0x28'),_0x6a78('0x29'),_0x4d9092+'.'+_0x22a584,_0x6a78('0x2a'),_0x6a78('0x2b'),'cm_contacts.priority',_0x6a78('0x2d'),'\x22'+_0x2ad4c4+'\x22'];var _0x59a4c1=squel[_0x6a78('0x40')]()[_0x6a78('0x2e')]('cm_hopper')[_0x6a78('0x2f')](['phone',_0x6a78('0x30'),_0x6a78('0x31'),_0x6a78('0x32'),_0x22a584,_0x6a78('0x33'),_0x6a78('0x34'),'priority','UserId',_0x6a78('0x45')],squel[_0x6a78('0xf')]()[_0x6a78('0x37')](_0x33a221)[_0x6a78('0x12')](_0x4d9092)['join'](_0x6a78('0x38'),null,_0x6a78('0x39')+_0x4d9092+_0x6a78('0x3a'))['join'](_0x2f4e70,null,_0x2f4e70+'.id\x20=\x20'+_0x4d9092+'.'+_0x22a584)[_0x6a78('0x17')](_0x4732b7,null,_0x4732b7+'.id\x20=\x20'+_0x4d9092+'.'+_0x22a584)['where'](_0x4d9092+_0x6a78('0x3b'),_0x41e924)[_0x6a78('0x14')](_0x6a78('0x3c'),NOW)[_0x6a78('0x14')](_0x6a78('0x3d'),selectNotIn(_0x4d9092,_0x2f4e70,_0x22a584,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x6a78('0x14')](_0x6a78('0x3d'),selectNotIn(_0x4d9092,_0x2f4e70,_0x22a584,_0x6a78('0x3f'),['\x22always\x22'])))[_0x6a78('0x43')]();return _0x59a4c1;}function insertTzCmHopperBlack(_0x2ff842,_0x5b1da3,_0x4e486f,_0x318d47){var _0x2a50df=[_0x6a78('0x27'),_0x6a78('0x28'),_0x6a78('0x29'),_0x5b1da3+'.'+_0x318d47,_0x6a78('0x2a'),'cm_contacts.updatedAt'];return squel['insert']()['into'](_0x6a78('0x41'))['fromQuery']([_0x6a78('0x11'),_0x6a78('0x31'),_0x6a78('0x32'),_0x318d47,_0x6a78('0x33'),'updatedAt'],squel[_0x6a78('0xf')]()[_0x6a78('0x37')](_0x2a50df)['from'](_0x5b1da3)[_0x6a78('0x17')](_0x6a78('0x38'),null,_0x6a78('0x39')+_0x5b1da3+_0x6a78('0x3a'))[_0x6a78('0x17')](_0x4e486f,null,_0x4e486f+'.id\x20=\x20'+_0x5b1da3+'.'+_0x318d47)[_0x6a78('0x14')](_0x5b1da3+_0x6a78('0x3b'),_0x2ff842)[_0x6a78('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x6a78('0x3d'),squel[_0x6a78('0xf')]()['field'](_0x6a78('0x11'))[_0x6a78('0x12')](_0x6a78('0x41'))[_0x6a78('0x14')](_0x6a78('0x42'),_0x2ff842)[_0x6a78('0x14')](_0x318d47+'\x20=\x20'+_0x5b1da3+'.'+_0x318d47)))['toString']();}function insertCmHopperAdditionalPhones(_0x1e4929){var _0x9fd4f3=[_0x6a78('0x46'),_0x6a78('0x47'),_0x6a78('0x48'),_0x6a78('0x49'),_0x6a78('0x4a')];return squel[_0x6a78('0x40')]()[_0x6a78('0x2e')](_0x6a78('0x4b'))[_0x6a78('0x2f')](['CmHopperId',_0x6a78('0x11'),_0x6a78('0x4c'),_0x6a78('0x33'),_0x6a78('0x34')],squel[_0x6a78('0xf')]()['fields'](_0x9fd4f3)[_0x6a78('0x12')](_0x6a78('0x3f'))[_0x6a78('0x17')](_0x6a78('0x38'),null,_0x6a78('0x4d'))[_0x6a78('0x17')](_0x6a78('0x4e'),null,_0x6a78('0x4f'))[_0x6a78('0x14')]('cm_hopper.ListId\x20=\x20?',_0x1e4929)[_0x6a78('0x14')](_0x6a78('0x3c'),NOW))[_0x6a78('0x43')]();}function insertCmContact(_0x3d370b,_0x462f83,_0x3a2d8a,_0x18beeb){var _0x2f7807=_[_0x6a78('0x50')](_[_0x6a78('0x51')](_0x18beeb),[_0x6a78('0x32'),_0x6a78('0x52'),_0x6a78('0x33'),_0x6a78('0x34')]);return squel['insert']()[_0x6a78('0x2e')](_0x6a78('0x38'))[_0x6a78('0x2f')](_0x2f7807,squel[_0x6a78('0xf')]()['fields'](_0x2f7807)['from'](_0x462f83)[_0x6a78('0x14')]('('+_0x3a2d8a[_0x6a78('0x17')](',')+_0x6a78('0x53'),squel[_0x6a78('0xf')]()[_0x6a78('0x37')](_0x3a2d8a)['from'](_0x6a78('0x38'))[_0x6a78('0x14')](_0x6a78('0x42'),_0x3d370b)[_0x6a78('0x14')]('deletedAt\x20IS\x20NULL'))[_0x6a78('0x14')](_0x6a78('0x54'),squel[_0x6a78('0xf')]()['field']('MIN(id)',_0x6a78('0x55'))['from'](_0x462f83)[_0x6a78('0x56')](_0x3a2d8a[_0x6a78('0x17')](','))))[_0x6a78('0x43')]();}function handleStop(){logger[_0x6a78('0x57')](_0x6a78('0x58'));stopped=!![];}function handleUncaughtException(_0x3391f1){logger[_0x6a78('0x59')](_0x3391f1['message']);process[_0x6a78('0x5a')](0x1);}function handleError(_0x364144,_0x27fcce){stats[_0x6a78('0x5b')][_0x6a78('0x1d')]({'name':_0x27fcce[_0x6a78('0x5c')],'message':_0x27fcce[_0x6a78('0x5d')],'row':_0x364144});}function handleQuery(_0x3044a4){logger[_0x6a78('0x57')](_0x3044a4);return db[_0x6a78('0x5e')]['query'](_0x3044a4)[_0x6a78('0x5f')](function(_0x10a5f0){results['push'](_0x10a5f0);})[_0x6a78('0x60')](function(_0x297714){logger['error'](_0x297714[_0x6a78('0x5d')]);});}function updateTzCampaigns(_0x4c9117){return new Promise(function(_0x35c4de,_0x4b06eb){var _0x311f79=squel[_0x6a78('0xf')]()[_0x6a78('0x37')]([_0x6a78('0x61'),_0x6a78('0x62')])['from']('campaigns')[_0x6a78('0x17')](_0x6a78('0x63'),null,_0x6a78('0x64'))[_0x6a78('0x14')](_0x6a78('0x65')+_0x4c9117);db['sequelize'][_0x6a78('0x66')](_0x311f79[_0x6a78('0x43')]())['spread'](function(_0x37a323){var _0x176a52=[];for(var _0x51385f=0x0;_0x51385f<_0x37a323[_0x6a78('0x1c')];_0x51385f++){_0x176a52[_0x6a78('0x1d')](getTimezoneData(_0x37a323[_0x51385f],tmp_campaigns));}BPromise[_0x6a78('0x1f')](_0x176a52)[_0x6a78('0x1b')](function(){_0x35c4de({'val':0x1});});})[_0x6a78('0x60')](function(_0x11ce9d){logger[_0x6a78('0x59')](_0x11ce9d[_0x6a78('0x5d')]);_0x35c4de({'val':0x0});});});}function updateTzVoiceQueues(_0x1f2be2){return new Promise(function(_0x217ed2,_0x4b5ad9){var _0x572089=squel[_0x6a78('0xf')]()['fields']([_0x6a78('0x67'),_0x6a78('0x68')])[_0x6a78('0x12')](_0x6a78('0x69'))[_0x6a78('0x17')](_0x6a78('0x6a'),null,_0x6a78('0x6b'))['where'](_0x6a78('0x6c')+_0x1f2be2);db[_0x6a78('0x5e')][_0x6a78('0x66')](_0x572089['toString']())[_0x6a78('0x5f')](function(_0x31b825){var _0x1e3756=[];for(var _0x55557d=0x0;_0x55557d<_0x31b825[_0x6a78('0x1c')];_0x55557d++){_0x1e3756[_0x6a78('0x1d')](getTimezoneData(_0x31b825[_0x55557d],tmp_voice_queues));}BPromise[_0x6a78('0x1f')](_0x1e3756)[_0x6a78('0x1b')](function(){_0x217ed2({'val':0x1});});})[_0x6a78('0x60')](function(_0x1812aa){logger['error'](_0x1812aa['message']);_0x217ed2({'val':0x0});});});}function getTimezoneData(_0x4b59ef,_0x1e1a2e){return new Promise(function(_0x3d3038,_0x416c0a){var _0x2846fd=shared[_0x6a78('0x6d')];var _0x367bbd=_0x2846fd[_0x4b59ef['dialTimezone']];if(_[_0x6a78('0x20')](_0x367bbd)){_0x3d3038({'ret':0x1});}else{var _0x39190c=_0x367bbd[_0x6a78('0x6e')];var _0x3b374d=squel[_0x6a78('0x40')]()[_0x6a78('0x2e')](_0x1e1a2e)[_0x6a78('0x6f')]('id',_0x4b59ef['id'])['set'](_0x6a78('0x70'),_0x39190c)[_0x6a78('0x6f')]('dialTimezone',_0x4b59ef[_0x6a78('0x71')])[_0x6a78('0x43')]();return db[_0x6a78('0x5e')][_0x6a78('0x66')](_0x3b374d)['spread'](function(_0x389193){_0x3d3038({'ret':0x1});})[_0x6a78('0x60')](function(_0x58d209){logger['error'](_0x58d209[_0x6a78('0x5d')]);_0x416c0a({'ret':0x1});});}});}function handleTZQuery(_0x19fb4b){logger[_0x6a78('0x57')](_0x19fb4b);return db['sequelize']['query'](_0x19fb4b)[_0x6a78('0x5f')](function(_0x5869ee){})[_0x6a78('0x60')](function(_0x3ca622){logger[_0x6a78('0x59')](_0x3ca622[_0x6a78('0x5d')]);});}function main(_0x6409af,_0x51c285,_0x2ccefe,_0x177047){logger[_0x6a78('0x57')]('main',_0x6409af,JSON[_0x6a78('0x72')](_0x51c285));process['send'](_0x6a78('0x73'));var _0x41e79d=_0x51c285[_0x6a78('0x74')];var _0x217b47=_[_0x6a78('0x75')](_0x41e79d);var _0x3ae9f6=_0x51c285[_0x6a78('0x76')];var _0x26391=path[_0x6a78('0x17')](config[_0x6a78('0x77')],_0x6a78('0x78'),_0x3ae9f6+'.csv');hasTZ=_[_0x6a78('0x51')](_0x41e79d)[_0x6a78('0x79')](_0x6a78('0x71'));var _0x1203ab=_[_0x6a78('0x51')](_0x41e79d)[_0x6a78('0x17')]();logger[_0x6a78('0x57')](_0x6a78('0x7a'),_0x1203ab);db[_0x6a78('0x7b')][_0x6a78('0x19')]({'raw':!![],'attributes':['id',_0x6a78('0x7c')]})[_0x6a78('0x1b')](function(_0x78b9be){for(var _0x781868=0x0;_0x781868<_0x78b9be['length'];_0x781868++){if(_0x78b9be[_0x781868][_0x6a78('0x7c')]in _0x41e79d){contactItemTypes[_0x6a78('0x1d')](_0x78b9be[_0x781868]);delete _0x217b47[_0x78b9be[_0x781868][_0x6a78('0x7c')]];hasAdditionalPhones=!![];}for(var _0xa53b54 in _0x41e79d){if(_0x78b9be[_0x781868]['name']+_0x6a78('0x7d')===_0xa53b54){phoneDescriptions[_0x6a78('0x1d')]({'itemTypeId':_0x78b9be[_0x781868]['id'],'description':_0xa53b54});delete _0x217b47[_0xa53b54];}}}if(hasAdditionalPhones)_0x217b47['AdditionalPhones']='';var _0x48a90a=_[_0x6a78('0x51')](_0x217b47)[_0x6a78('0x17')]();logger['info'](_0x6a78('0x7a'),_0x48a90a);fs[_0x6a78('0x7e')](_0x26391,_0x48a90a+'\x0a');Papa[_0x6a78('0x7f')](fs[_0x6a78('0x80')](_0x6409af),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5f0279,_0x261727){try{for(var _0x5aa901=0x0,_0x4ace22=[];_0x5aa901<_0x5f0279[_0x6a78('0x81')]['length'];_0x5aa901++){stats[_0x6a78('0x82')]+=0x1;if(_0x5f0279['errors'][_0x5aa901]){handleError(_0x5f0279[_0x6a78('0x81')][_0x5aa901],_0x5f0279[_0x6a78('0x5b')][_0x5aa901]);}else{var _0x3142b3=[];var _0x5c8a9c=[];var _0x296193={};for(var _0x362735 in _0x41e79d){let _0x28e2c0=contactItemTypes[_0x6a78('0x83')](_0x4d41d9=>_0x4d41d9[_0x6a78('0x7c')]===_0x362735);let _0x5020c7=contactItemTypes['find'](_0x1f7446=>_0x1f7446[_0x6a78('0x7c')]+_0x6a78('0x7d')===_0x362735);if(_[_0x6a78('0x20')](_0x28e2c0)&&_[_0x6a78('0x20')](_0x5020c7)){if(_0x41e79d[_0x6a78('0x84')](_0x362735)){if(_0x5f0279[_0x6a78('0x81')][_0x5aa901][_0x41e79d[_0x362735]]){var _0x3cd0f7=_['trim'](_0x5f0279['data'][_0x5aa901][_0x41e79d[_0x362735]][_0x6a78('0x85')](/"/g,'\x27'));switch(_0x362735){case _0x6a78('0x30'):var _0x5bd43f=moment(_0x3cd0f7,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5bd43f[_0x6a78('0x86')]()){_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x3cd0f7+'\x22');}else{_0x3142b3['push'](_0x6a78('0x87'));}break;case _0x6a78('0x35'):var _0x3380a2=parseInt(_0x3cd0f7);_0x3cd0f7=_['isNaN'](_0x3380a2)||_0x3380a2<0x0||_0x3380a2>0x4?_0x177047?0x3:0x2:_0x3380a2;_0x4ace22['push']('\x22'+_0x3cd0f7+'\x22');break;case _0x6a78('0x36'):var _0x517d10=parseInt(_0x3cd0f7);if(_[_0x6a78('0x88')](_0x517d10)&&_['includes'](_0x2ccefe,_0x517d10)){_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x517d10+'\x22');}else{_0x3142b3[_0x6a78('0x1d')](_0x6a78('0x89'));}break;case _0x6a78('0x8a'):if(isEmail(_0x3cd0f7)){_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x3cd0f7+'\x22');}else{_0x3142b3[_0x6a78('0x1d')](_0x6a78('0x8b'));}break;case _0x6a78('0x8c'):var _0x2fa3b4=moment(_0x3cd0f7,'YYYY-MM-DD',!![]);if(_0x2fa3b4[_0x6a78('0x86')]()){_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x3cd0f7+'\x22');}else{_0x3142b3['push'](_0x6a78('0x8d'));}break;case _0x6a78('0x71'):var _0x25db15=shared[_0x6a78('0x6d')];var _0x748e6=_0x25db15[_0x3cd0f7];if(!_['isNil'](_0x748e6)){var _0x3f5381=_0x748e6['utcOffset'];_0x4ace22['push']('\x22'+_0x3cd0f7+'\x22');_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x3f5381+'\x22');}break;default:_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x3cd0f7+'\x22');}}else{switch(_0x362735){case _0x6a78('0x8e'):case'phone':_0x3142b3['push'](_0x362735+_0x6a78('0x8f'));break;default:_0x4ace22[_0x6a78('0x1d')]('\x22\x22');}}}}else{var _0x5c1ea1='';if(!_[_0x6a78('0x20')](_0x28e2c0)){if(!_0x296193[_0x6a78('0x84')](_0x28e2c0['id'])){if(!_['isNil'](_0x5f0279['data'][_0x5aa901][_0x41e79d[_0x362735]])){var _0x3cd0f7=_[_0x6a78('0x90')](_0x5f0279[_0x6a78('0x81')][_0x5aa901][_0x41e79d[_0x362735]]['replace'](/"/g,'\x27'));var _0x10ab24=phoneDescriptions[_0x6a78('0x83')](_0x9f8616=>_0x9f8616[_0x6a78('0x91')]===_0x28e2c0['id']);if(!_[_0x6a78('0x20')](_0x10ab24)){var _0x4fdf2d=_[_0x6a78('0x90')](_0x5f0279[_0x6a78('0x81')][_0x5aa901][_0x41e79d[_0x10ab24[_0x6a78('0x92')]]][_0x6a78('0x85')](/"/g,'\x27'));if(!_[_0x6a78('0x20')](_0x4fdf2d))_0x3cd0f7=_0x3cd0f7+'§'+_0x4fdf2d;}if(_0x5c1ea1=='')_0x5c1ea1=_0x3cd0f7;else _0x5c1ea1+='|'+_0x3cd0f7;}_0x5c8a9c['push'](_0x28e2c0['id']+':'+_0x5c1ea1);_0x296193[_0x28e2c0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4ace22[_0x6a78('0x1d')]('\x22'+_0x5c8a9c['join'](';')+'\x22');}if(_0x3142b3[_0x6a78('0x1c')]){handleError(_0x5f0279['data'][_0x5aa901],{'code':_0x6a78('0x93'),'message':_0x3142b3[_0x6a78('0x17')]()});}else{fs[_0x6a78('0x94')](_0x26391,_0x4ace22['join']()+'\x0a');}_0x4ace22=[];}if(!(stats[_0x6a78('0x82')]%0xc8)){socket[_0x6a78('0x95')](_0x6a78('0x96')+_0x3ae9f6,stats);stats['errors']=[];}}if(stopped){logger[_0x6a78('0x57')]('Abort\x20parser');_0x261727[_0x6a78('0x97')]();}}catch(_0x59a4d8){handleError(_0x5f0279['data'][_0x5aa901],{'code':'SystemError','message':_0x59a4d8['message']});logger[_0x6a78('0x59')](_0x6a78('0x98'),_0x59a4d8[_0x6a78('0x5d')]);}},'complete':function(){try{var _0x132443=[];var _0x5f47f0=[];var _0x1e767a=_0x6a78('0x38');if(_0x51c285[_0x6a78('0x99')]&&_0x51c285[_0x6a78('0x99')][_0x6a78('0x1c')]){_0x1e767a=_0x6a78('0x9a')+_0x3ae9f6;_0x132443[_0x6a78('0x1d')](_0x6a78('0x9b')+_0x1e767a+_0x6a78('0x9c'));}tmp_campaigns=_0x6a78('0x9d')+_0x3ae9f6;tmp_voice_queues=_0x6a78('0x9e')+_0x3ae9f6;_0x5f47f0[_0x6a78('0x1d')](_0x6a78('0x9b')+tmp_campaigns+_0x6a78('0x9f'));_0x5f47f0[_0x6a78('0x1d')](_0x6a78('0x9b')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x6a78('0xa0')](_0x5f47f0,handleTZQuery)[_0x6a78('0x1b')](function(_0x5584e3){updateTzCampaigns(_0x51c285['ListId'])[_0x6a78('0x1b')](function(_0x5cae11){updateTzVoiceQueues(_0x51c285[_0x6a78('0x32')])[_0x6a78('0x1b')](function(_0xe89941){if(hasTZ)_0x48a90a=_0x48a90a['replace'](_0x6a78('0x71'),'dialTimezone,utcOffset');var _0x382e35=util[_0x6a78('0xd')](_0x6a78('0xa1'),_0x26391,_0x1e767a,_0x48a90a,_0x51c285['ListId'],_0x51c285['CompanyId']||null,NOW,NOW);if(_[_0x6a78('0x20')](_0x41e79d[_0x6a78('0x30')])){_0x382e35+=_0x6a78('0xa2');}_0x132443[_0x6a78('0x1d')](_0x382e35);if(_0x51c285[_0x6a78('0x99')]&&_0x51c285[_0x6a78('0x99')][_0x6a78('0x1c')]){_0x132443[_0x6a78('0x1d')](insertCmContact(_0x51c285[_0x6a78('0x32')],_0x1e767a,_0x51c285[_0x6a78('0x99')],_0x41e79d));_0x132443[_0x6a78('0x1d')](_0x6a78('0xa3')+_0x1e767a+';');}BPromise[_0x6a78('0xa0')](_0x132443,handleQuery)[_0x6a78('0x1b')](function(_0x20a1d9){BPromise[_0x6a78('0x1f')]([handleAdditionalPhones()])[_0x6a78('0x1b')](function(){_0x132443=[];for(var _0x4ef6f0=0x0;_0x4ef6f0_0x511f87['name']===_0x3562cd);let _0x2d5ffd=contactItemTypes[_0xf6f4('0x65')](_0x488243=>_0x488243[_0xf6f4('0x5f')]+_0xf6f4('0x60')===_0x3562cd);if(_[_0xf6f4('0x16')](_0x2bf341)&&_[_0xf6f4('0x16')](_0x2d5ffd)){if(_0x42d262[_0xf6f4('0x66')](_0x3562cd)){if(_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3562cd]]){var _0x2bf96f=_[_0xf6f4('0x67')](_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3562cd]]['replace'](/"/g,'\x27'));switch(_0x3562cd){case _0xf6f4('0x2e'):var _0x181097=moment(_0x2bf96f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x181097['isValid']()){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');}else{_0x330647[_0xf6f4('0x1d')](_0xf6f4('0x68'));}break;case _0xf6f4('0x69'):var _0x8bfc44=parseInt(_0x2bf96f);_0x2bf96f=_[_0xf6f4('0x6a')](_0x8bfc44)||_0x8bfc44<0x0||_0x8bfc44>0x4?_0x1c2d91?0x3:0x2:_0x8bfc44;_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');break;case _0xf6f4('0x2f'):var _0x1a2111=parseInt(_0x2bf96f);if(_[_0xf6f4('0x6b')](_0x1a2111)&&_['includes'](_0xf5bfa8,_0x1a2111)){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x1a2111+'\x22');}else{_0x330647[_0xf6f4('0x1d')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2bf96f)){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');}else{_0x330647[_0xf6f4('0x1d')](_0xf6f4('0x6c'));}break;case'dateOfBirth':var _0x880ac2=moment(_0x2bf96f,'YYYY-MM-DD',!![]);if(_0x880ac2[_0xf6f4('0x6d')]()){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x2bf96f+'\x22');}else{_0x330647['push'](_0xf6f4('0x6e'));}break;default:_0x594fd1['push']('\x22'+_0x2bf96f+'\x22');}}else{switch(_0x3562cd){case _0xf6f4('0x6f'):case'phone':_0x330647[_0xf6f4('0x1d')](_0x3562cd+_0xf6f4('0x70'));break;default:_0x594fd1[_0xf6f4('0x1d')]('\x22\x22');}}}}else{var _0x1aaafd='';if(!_[_0xf6f4('0x16')](_0x2bf341)){if(!_0x494be3[_0xf6f4('0x66')](_0x2bf341['id'])){for(var _0x310c4a=0x0;_0x310c4a<_0x42d262[_0x3562cd][_0xf6f4('0x15')];_0x310c4a++){var _0x2bf96f=_[_0xf6f4('0x67')](_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3562cd][_0x310c4a]]['replace'](/"/g,'\x27'));var _0x3f149c=phoneDescriptions[_0xf6f4('0x65')](_0x5bf279=>_0x5bf279[_0xf6f4('0x71')]===_0x2bf341['id']);if(!_[_0xf6f4('0x16')](_0x3f149c)){var _0x221e6=_[_0xf6f4('0x67')](_0x12f5e0[_0xf6f4('0x64')][_0x119999][_0x42d262[_0x3f149c[_0xf6f4('0x72')]][0x0]][_0xf6f4('0x73')](/"/g,'\x27'));if(!_[_0xf6f4('0x16')](_0x221e6))_0x2bf96f=_0x2bf96f+'§'+_0x221e6;}if(_0x1aaafd=='')_0x1aaafd=_0x2bf96f;else _0x1aaafd+='|'+_0x2bf96f;}_0x16b007[_0xf6f4('0x1d')](_0x2bf341['id']+':'+_0x1aaafd);_0x494be3[_0x2bf341['id']]=0x1;}}}}if(hasAdditionalPhones){_0x594fd1[_0xf6f4('0x1d')]('\x22'+_0x16b007[_0xf6f4('0xe')](';')+'\x22');}if(_0x330647[_0xf6f4('0x15')]){handleError(_0x12f5e0[_0xf6f4('0x64')][_0x119999],{'code':_0xf6f4('0x74'),'message':_0x330647[_0xf6f4('0xe')]()});}else{fs['appendFileSync'](_0x3274cc,_0x594fd1['join']()+'\x0a');}_0x594fd1=[];}if(!(stats[_0xf6f4('0x75')]%0xc8)){socket[_0xf6f4('0x76')](_0xf6f4('0x77')+_0x30ca0b,stats);stats[_0xf6f4('0x54')]=[];}}if(stopped){logger[_0xf6f4('0x51')](_0xf6f4('0x78'));_0x5930fb['abort']();}}catch(_0x7aa20a){handleError(_0x12f5e0['data'][_0x119999],{'code':_0xf6f4('0x79'),'message':_0x7aa20a[_0xf6f4('0x52')]});logger['error']('step',_0x7aa20a[_0xf6f4('0x52')]);}},'complete':function(){try{var _0x14d44d=[];var _0x37c915=tempTableName;_0x14d44d['push'](_0xf6f4('0x7a')+_0x37c915+_0xf6f4('0x7b'));logger[_0xf6f4('0x51')]('CIS\x20len',contactItemTypes['length']);var _0x5da426=util[_0xf6f4('0x8')]('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',_0x3274cc,_0x37c915,_0x2f7b3d,_0x43c592[_0xf6f4('0x3c')],_0x43c592[_0xf6f4('0x4b')]||null,NOW,NOW);if(_[_0xf6f4('0x16')](_0x42d262['scheduledat'])){_0x5da426+=_0xf6f4('0x7c');}_0x14d44d[_0xf6f4('0x1d')](_0x5da426);BPromise[_0xf6f4('0x7d')](_0x14d44d,handleQuery)[_0xf6f4('0x19')](function(_0x1938ad){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x14d44d=[];for(var _0x5e1aa1=0x0;_0x5e1aa1\x20\x20');}var _0x114815=path[_0xf6f4('0xe')](config[_0xf6f4('0x84')],_0xf6f4('0x5b'),process[_0xf6f4('0x83')][0x2]);if(!fs[_0xf6f4('0x85')](_0x114815)){throw new Error(_0xf6f4('0x86'));}var _0x171a90={};try{_0x171a90=JSON[_0xf6f4('0x62')](process[_0xf6f4('0x83')][0x3]);if(!_0x171a90['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x2f0ef2=0x0;if(_0x171a90[_0xf6f4('0x87')][_0xf6f4('0x2f')]){_0x2f0ef2=0x1;}if(!_0x171a90[_0xf6f4('0x3c')]){throw new Error(_0xf6f4('0x88'));}}catch(_0x25460f){throw new Error('body\x20id\x20mandatory');}var _0x521630=[];try{_0x521630=_[_0xf6f4('0x89')](JSON[_0xf6f4('0x62')](process['argv'][0x4]),'id');}catch(_0x45b487){logger[_0xf6f4('0x51')](_0xf6f4('0x8a'));}main(_0x114815,_0x171a90,_0x521630,_0x2f0ef2);}validate();process['on'](_0xf6f4('0x8b'),handleStop);process['on'](_0xf6f4('0x8c'),handleUncaughtException); \ No newline at end of file +var _0x5454=['agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','abort','SystemError','\x20LIKE\x20cm_contacts;','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',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','push','all','message','then','split','length','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','scheduledat','ListId','createdAt','updatedAt','priority','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','cm_hopper_black','fromQuery','ContactId','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','fields','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','query','catch','main','stringify','send','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','createReadStream','data','find','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes'];(function(_0x35490f,_0xd9da3f){var _0x381b38=function(_0x2d5ee5){while(--_0x2d5ee5){_0x35490f['push'](_0x35490f['shift']());}};_0x381b38(++_0xd9da3f);}(_0x5454,0x15b));var _0x4545=function(_0x225198,_0x5711ca){_0x225198=_0x225198-0x0;var _0x1c76f4=_0x5454[_0x225198];return _0x1c76f4;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x4545('0x0'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0x4545('0x1'));var db=require(_0x4545('0x2'))['db'];var config=require(_0x4545('0x3'));var logger=require(_0x4545('0x4'))('import');config[_0x4545('0x5')]=_[_0x4545('0x6')](config[_0x4545('0x5')],{'host':_0x4545('0x7'),'port':0x18eb});var socket=require(_0x4545('0x8'))(new Redis(config[_0x4545('0x5')]));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()[_0x4545('0x9')](_0x4545('0xa'));var tempTableName=_0x4545('0xb')+moment()[_0x4545('0x9')](_0x4545('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x40cd1c){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))*$/[_0x4545('0xd')](_0x40cd1c);}function selectNotIn(_0x491b7b,_0x869994,_0x38fc64,_0x237cc6,_0x16b0c6){return squel[_0x4545('0xe')]()[_0x4545('0xf')]('phone')[_0x4545('0x10')](_0x237cc6)[_0x4545('0x11')](_0x869994,null,_0x869994+_0x4545('0x12')+_0x237cc6+'.'+_0x38fc64)[_0x4545('0x13')](_0x237cc6+'.'+_0x38fc64+_0x4545('0x14')+_0x491b7b+'.'+_0x38fc64)[_0x4545('0x13')](_0x869994+_0x4545('0x15')+_0x16b0c6[_0x4545('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36bb8e,_0xab7856){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4545('0x16')]['query'](_0x4545('0x17')+tempTableName)[_0x4545('0x18')](function(_0x2416b0){if(_0x2416b0!==null){var _0x3bb165=[];for(var _0x5a332e=0x0;_0x5a332e<_0x2416b0['length'];_0x5a332e++){var _0x3bf878=_0x2416b0[_0x5a332e];if(!_[_0x4545('0x19')](_0x3bf878[_0x4545('0x1a')])){if(!_[_0x4545('0x19')](_0x3bf878[_0x4545('0x1b')]))_0x3bb165[_0x4545('0x1c')](insertAdditionalPhones(_0x3bf878));promisesContact[_0x4545('0x1c')]({'contact':_0x3bf878});}}}Promise[_0x4545('0x1d')](_0x3bb165)['then'](function(){_0x36bb8e({'val':0x1});});})['catch'](function(_0x262669){logger['error'](_0x262669[_0x4545('0x1e')]);});});}function insertAdditionalPhones(_0x669f9){return new Promise(function(_0x67e408,_0x6b3bc){var _0x7e47e5=_0x669f9[_0x4545('0x1b')];if(_[_0x4545('0x19')](_0x7e47e5))_0x6b3bc({'val':0x0});else{var _0x13f497=_0x7e47e5['split'](';');var _0x580b57=[];orderBy=0x0;for(var _0x431b5d=0x0;_0x431b5d<_0x13f497['length'];_0x431b5d++){_0x580b57[_0x4545('0x1c')](splitAdditionalPhone(_0x669f9['id'],_0x13f497[_0x431b5d]));}Promise['all'](_0x580b57)[_0x4545('0x1f')](function(){_0x67e408({'val':_0x13f497['length']});});}});}function splitAdditionalPhone(_0x519489,_0x21dbc2){return new Promise(function(_0xdd21e4,_0x38815e){var _0x34d4c1=_0x21dbc2[_0x4545('0x20')](':');var _0x39eaa1=_0x34d4c1[0x0];var _0x43033c=_0x34d4c1[0x1];if(_0x43033c!==''){var _0x889814=_0x43033c[_0x4545('0x20')]('|');var _0x2a6842=[];for(var _0x3e5807=0x0;_0x3e5807<_0x889814[_0x4545('0x21')];_0x3e5807++){if(_0x889814[_0x3e5807]!==''){var _0xab0b00=_[_0x4545('0x22')](promisesAdditionalPhones,{'contactId':_0x519489,'phone':_0x889814[_0x3e5807]});if(_0xab0b00[_0x4545('0x21')]==0x0){orderBy++;promisesAdditionalPhones[_0x4545('0x1c')]({'contactId':_0x519489,'contactTypeId':_0x39eaa1,'phone':_0x889814[_0x3e5807],'orderBy':orderBy});}}}_0xdd21e4({'ok':0x1});}else _0xdd21e4({'res':0x0});});}function createAdditionalPhone(_0x576200,_0x1540f0,_0x2c256b,_0x853476){var _0x394a8e='';var _0xb9c5ee='';var _0x531250=_0x2c256b[_0x4545('0x20')]('§');_0x394a8e=_0x531250[0x0];if(_0x531250[_0x4545('0x21')]==0x2)_0xb9c5ee=_0x531250[0x1];return new Promise(function(_0x24ebd3,_0x247762){return db[_0x4545('0x23')][_0x4545('0x24')]({'where':{'CmContactId':_0x576200,'item':_0x394a8e}})['then'](function(_0x406920){if(_0x406920){return db[_0x4545('0x23')][_0x4545('0x25')]({'ItemTypeId':_0x1540f0,'description':_0xb9c5ee,'OrderBy':_0x853476},{'where':{'CmContactId':_0x576200,'item':_0x394a8e}})[_0x4545('0x1f')](function(_0x2f532f){_0x24ebd3({'res':_0x4545('0x26')});});}else{return db[_0x4545('0x23')][_0x4545('0x27')]({'CmContactId':_0x576200,'item':_0x394a8e,'ItemTypeId':_0x1540f0,'description':_0xb9c5ee,'OrderBy':_0x853476,'ItemClass':_0x4545('0x28')})[_0x4545('0x1f')](function(_0x196884){_0x24ebd3({'res':'inserted'});});}});});}function updateContact(_0x1e3a47){return new Promise(function(_0x5d3f61,_0x2848ac){var _0x9bffd8=_0x1e3a47['id'];delete _0x1e3a47['id'];return db['CmContact'][_0x4545('0x25')](_0x1e3a47,{'where':{'id':_0x9bffd8}})[_0x4545('0x1f')](function(_0x46e814){updatedRows+=0x1;return db[_0x4545('0x29')][_0x4545('0x25')]({'phone':_0x1e3a47[_0x4545('0x1a')]},{'where':{'ContactId':_0x9bffd8}})[_0x4545('0x1f')](function(_0x54ea62){_0x5d3f61({'ret':'OK'});});});});}function insertCmHopper(_0x1abc06,_0x386b38,_0x36f4b9,_0x1b7a11,_0x2893a6){var _0x13059d=['cm_contacts.phone',_0x4545('0x2a'),_0x4545('0x2b'),_0x4545('0x2c'),_0x386b38+'.'+_0x1b7a11,_0x4545('0x2d'),_0x4545('0x2e'),_0x4545('0x2f'),_0x4545('0x30'),'\x22'+_0x2893a6+'\x22'];return squel[_0x4545('0x31')]()[_0x4545('0x32')]('cm_hopper')['fromQuery'](['phone',_0x4545('0x33'),'ContactId',_0x4545('0x34'),_0x1b7a11,_0x4545('0x35'),_0x4545('0x36'),_0x4545('0x37'),'UserId','recallme'],squel[_0x4545('0xe')]()['fields'](_0x13059d)[_0x4545('0x10')](_0x386b38)[_0x4545('0x11')](_0x4545('0x38'),null,_0x4545('0x39')+_0x386b38+_0x4545('0x3a'))['join'](_0x36f4b9,null,_0x36f4b9+'.id\x20=\x20'+_0x386b38+'.'+_0x1b7a11)[_0x4545('0x13')](_0x386b38+_0x4545('0x3b'),_0x1abc06)[_0x4545('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4545('0x13')](_0x4545('0x3c'),selectNotIn(_0x386b38,_0x36f4b9,_0x1b7a11,'cm_hopper',[_0x4545('0x3d'),'\x22onlyIfOpen\x22']))[_0x4545('0x13')](_0x4545('0x3c'),selectNotIn(_0x386b38,_0x36f4b9,_0x1b7a11,_0x4545('0x3e'),[_0x4545('0x3d')])))['toString']();}function insertCmHopperBlack(_0x1ca5d3,_0x632ec1,_0x3d308e,_0x299869){var _0x549557=['cm_contacts.phone',_0x4545('0x2b'),'cm_contacts.ListId',_0x632ec1+'.'+_0x299869,_0x4545('0x2d'),_0x4545('0x2e')];return squel[_0x4545('0x31')]()[_0x4545('0x32')](_0x4545('0x3f'))[_0x4545('0x40')]([_0x4545('0x1a'),_0x4545('0x41'),'ListId',_0x299869,_0x4545('0x35'),_0x4545('0x36')],squel[_0x4545('0xe')]()['fields'](_0x549557)[_0x4545('0x10')](_0x632ec1)[_0x4545('0x11')](_0x4545('0x38'),null,_0x4545('0x39')+_0x632ec1+_0x4545('0x3a'))[_0x4545('0x11')](_0x3d308e,null,_0x3d308e+_0x4545('0x12')+_0x632ec1+'.'+_0x299869)[_0x4545('0x13')](_0x632ec1+'.CmListId\x20=\x20?',_0x1ca5d3)[_0x4545('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4545('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x4545('0xe')]()[_0x4545('0xf')](_0x4545('0x1a'))['from'](_0x4545('0x3f'))[_0x4545('0x13')](_0x4545('0x42'),_0x1ca5d3)[_0x4545('0x13')](_0x299869+_0x4545('0x43'),_0x632ec1+'.'+_0x299869)))[_0x4545('0x44')]();}function insertCmHopperAdditionalPhones(_0x51a22e){var _0x59d00c=['cm_hopper.id','cm_contact_has_items.item',_0x4545('0x45'),_0x4545('0x46'),_0x4545('0x47')];return squel[_0x4545('0x31')]()[_0x4545('0x32')](_0x4545('0x48'))[_0x4545('0x40')](['CmHopperId','phone',_0x4545('0x49'),_0x4545('0x35'),_0x4545('0x36')],squel[_0x4545('0xe')]()[_0x4545('0x4a')](_0x59d00c)[_0x4545('0x10')]('cm_hopper')[_0x4545('0x11')](_0x4545('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x4545('0x11')]('cm_contact_has_items',null,_0x4545('0x4b'))[_0x4545('0x13')](_0x4545('0x4c'),_0x51a22e)[_0x4545('0x13')](_0x4545('0x4d'),NOW))[_0x4545('0x44')]();}function insertCmContact(_0x2bc1ce,_0x569fa6,_0x992cb,_0x56cb97){var _0x3cad88=_['concat'](_[_0x4545('0x4e')](_0x56cb97),[_0x4545('0x34'),_0x4545('0x4f'),'createdAt',_0x4545('0x36')]);return squel[_0x4545('0x31')]()['into'](_0x4545('0x38'))['fromQuery'](_0x3cad88,squel[_0x4545('0xe')]()[_0x4545('0x4a')](_0x3cad88)[_0x4545('0x10')](_0x569fa6)[_0x4545('0x13')]('('+_0x992cb[_0x4545('0x11')](',')+_0x4545('0x50'),squel[_0x4545('0xe')]()[_0x4545('0x4a')](_0x992cb)[_0x4545('0x10')]('cm_contacts')[_0x4545('0x13')](_0x4545('0x42'),_0x2bc1ce))[_0x4545('0x13')](_0x4545('0x51'),squel[_0x4545('0xe')]()['field'](_0x4545('0x52'),_0x4545('0x53'))[_0x4545('0x10')](_0x569fa6)[_0x4545('0x54')](_0x992cb[_0x4545('0x11')](','))))[_0x4545('0x44')]();}function handleStop(){logger[_0x4545('0x55')](_0x4545('0x56'));stopped=!![];}function handleUncaughtException(_0x5f088f){logger[_0x4545('0x57')](_0x5f088f[_0x4545('0x1e')]);process[_0x4545('0x58')](0x1);}function handleError(_0x237564,_0x261de2){stats[_0x4545('0x59')][_0x4545('0x1c')]({'name':_0x261de2[_0x4545('0x5a')],'message':_0x261de2['message'],'row':_0x237564});}function handleQuery(_0x3b4f01){logger[_0x4545('0x55')](_0x3b4f01);return db[_0x4545('0x16')][_0x4545('0x5b')](_0x3b4f01)[_0x4545('0x18')](function(_0x537f8f){results[_0x4545('0x1c')](_0x537f8f);})[_0x4545('0x5c')](function(_0x30da95){logger[_0x4545('0x57')](_0x30da95[_0x4545('0x1e')]);});}function main(_0x3bfeab,_0x374361,_0x40393b,_0x3b4b86){logger[_0x4545('0x55')](_0x4545('0x5d'),_0x3bfeab,JSON[_0x4545('0x5e')](_0x374361));process[_0x4545('0x5f')]('start');var _0x44f068=_0x374361[_0x4545('0x60')];var _0x220d78=_[_0x4545('0x61')](_0x44f068);var _0x2768ef=_0x374361[_0x4545('0x62')];var _0x589d06=path['join'](config[_0x4545('0x63')],_0x4545('0x64'),_0x2768ef+_0x4545('0x65'));logger[_0x4545('0x55')](_0x4545('0x66'),_0x374361);db[_0x4545('0x67')][_0x4545('0x68')]({'raw':!![],'attributes':['id',_0x4545('0x69')]})[_0x4545('0x1f')](function(_0xceedf1){for(var _0xcc1913=0x0;_0xcc1913<_0xceedf1[_0x4545('0x21')];_0xcc1913++){if(_0xceedf1[_0xcc1913]['name']in _0x44f068){contactItemTypes[_0x4545('0x1c')](_0xceedf1[_0xcc1913]);delete _0x220d78[_0xceedf1[_0xcc1913]['name']];hasAdditionalPhones=!![];}for(var _0xceccec in _0x44f068){if(_0xceedf1[_0xcc1913]['name']+_0x4545('0x6a')===_0xceccec){phoneDescriptions['push']({'itemTypeId':_0xceedf1[_0xcc1913]['id'],'description':_0xceccec});delete _0x220d78[_0xceccec];}}}if(hasAdditionalPhones)_0x220d78[_0x4545('0x1b')]='';var _0x2f80e5=_[_0x4545('0x4e')](_0x220d78)['join']();logger['info'](_0x4545('0x6b'),_0x2f80e5);fs[_0x4545('0x6c')](_0x589d06,_0x2f80e5+'\x0a');Papa['parse'](fs[_0x4545('0x6d')](_0x3bfeab),{'header':!![],'skipEmptyLines':!![],'step':function(_0x8839ed,_0x52b8da){try{for(var _0x5400a5=0x0,_0x59333c=[];_0x5400a5<_0x8839ed[_0x4545('0x6e')][_0x4545('0x21')];_0x5400a5++){stats['rows']+=0x1;if(_0x8839ed['errors'][_0x5400a5]){handleError(_0x8839ed[_0x4545('0x6e')][_0x5400a5],_0x8839ed['errors'][_0x5400a5]);}else{var _0x598c2e=[];var _0x18acc7=[];var _0xf1f85e={};for(var _0x559b06 in _0x44f068){let _0x3b1862=contactItemTypes[_0x4545('0x6f')](_0x485b09=>_0x485b09['name']===_0x559b06);let _0x5e8b41=contactItemTypes[_0x4545('0x6f')](_0x95bd11=>_0x95bd11[_0x4545('0x69')]+'_description'===_0x559b06);if(_[_0x4545('0x19')](_0x3b1862)&&_[_0x4545('0x19')](_0x5e8b41)){if(_0x44f068['hasOwnProperty'](_0x559b06)){if(_0x8839ed[_0x4545('0x6e')][_0x5400a5][_0x44f068[_0x559b06]]){var _0x3a4e95=_['trim'](_0x8839ed['data'][_0x5400a5][_0x44f068[_0x559b06]][_0x4545('0x70')](/"/g,'\x27'));switch(_0x559b06){case _0x4545('0x33'):var _0x5784bc=moment(_0x3a4e95,_0x4545('0xa'),!![]);if(_0x5784bc['isValid']()){_0x59333c[_0x4545('0x1c')]('\x22'+_0x3a4e95+'\x22');}else{_0x598c2e['push'](_0x4545('0x71'));}break;case'priority':var _0x1178f3=parseInt(_0x3a4e95);_0x3a4e95=_[_0x4545('0x72')](_0x1178f3)||_0x1178f3<0x0||_0x1178f3>0x4?_0x3b4b86?0x3:0x2:_0x1178f3;_0x59333c[_0x4545('0x1c')]('\x22'+_0x3a4e95+'\x22');break;case _0x4545('0x73'):var _0x10070a=parseInt(_0x3a4e95);if(_[_0x4545('0x74')](_0x10070a)&&_[_0x4545('0x75')](_0x40393b,_0x10070a)){_0x59333c['push']('\x22'+_0x10070a+'\x22');}else{_0x598c2e[_0x4545('0x1c')](_0x4545('0x76'));}break;case _0x4545('0x77'):if(isEmail(_0x3a4e95)){_0x59333c[_0x4545('0x1c')]('\x22'+_0x3a4e95+'\x22');}else{_0x598c2e[_0x4545('0x1c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x28ae98=moment(_0x3a4e95,_0x4545('0x78'),!![]);if(_0x28ae98['isValid']()){_0x59333c[_0x4545('0x1c')]('\x22'+_0x3a4e95+'\x22');}else{_0x598c2e[_0x4545('0x1c')](_0x4545('0x79'));}break;default:_0x59333c['push']('\x22'+_0x3a4e95+'\x22');}}else{switch(_0x559b06){case'firstName':case _0x4545('0x1a'):_0x598c2e[_0x4545('0x1c')](_0x559b06+_0x4545('0x7a'));break;default:_0x59333c[_0x4545('0x1c')]('\x22\x22');}}}}else{var _0x33a934='';if(!_[_0x4545('0x19')](_0x3b1862)){if(!_0xf1f85e['hasOwnProperty'](_0x3b1862['id'])){for(var _0x45ee11=0x0;_0x45ee11<_0x44f068[_0x559b06][_0x4545('0x21')];_0x45ee11++){var _0x3a4e95=_[_0x4545('0x7b')](_0x8839ed[_0x4545('0x6e')][_0x5400a5][_0x44f068[_0x559b06][_0x45ee11]][_0x4545('0x70')](/"/g,'\x27'));var _0x158a15=phoneDescriptions[_0x4545('0x6f')](_0x1b26bc=>_0x1b26bc[_0x4545('0x7c')]===_0x3b1862['id']);if(!_[_0x4545('0x19')](_0x158a15)){var _0x272f56=_[_0x4545('0x7b')](_0x8839ed[_0x4545('0x6e')][_0x5400a5][_0x44f068[_0x158a15[_0x4545('0x7d')]][0x0]][_0x4545('0x70')](/"/g,'\x27'));if(!_[_0x4545('0x19')](_0x272f56))_0x3a4e95=_0x3a4e95+'§'+_0x272f56;}if(_0x33a934=='')_0x33a934=_0x3a4e95;else _0x33a934+='|'+_0x3a4e95;}_0x18acc7['push'](_0x3b1862['id']+':'+_0x33a934);_0xf1f85e[_0x3b1862['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59333c[_0x4545('0x1c')]('\x22'+_0x18acc7[_0x4545('0x11')](';')+'\x22');}if(_0x598c2e[_0x4545('0x21')]){handleError(_0x8839ed[_0x4545('0x6e')][_0x5400a5],{'code':_0x4545('0x7e'),'message':_0x598c2e['join']()});}else{fs[_0x4545('0x7f')](_0x589d06,_0x59333c[_0x4545('0x11')]()+'\x0a');}_0x59333c=[];}if(!(stats[_0x4545('0x80')]%0xc8)){socket[_0x4545('0x81')](_0x4545('0x82')+_0x2768ef,stats);stats['errors']=[];}}if(stopped){logger[_0x4545('0x55')]('Abort\x20parser');_0x52b8da[_0x4545('0x83')]();}}catch(_0x3f096a){handleError(_0x8839ed[_0x4545('0x6e')][_0x5400a5],{'code':_0x4545('0x84'),'message':_0x3f096a[_0x4545('0x1e')]});logger[_0x4545('0x57')]('step',_0x3f096a[_0x4545('0x1e')]);}},'complete':function(){try{var _0x3a5638=[];var _0x332ec4=tempTableName;_0x3a5638['push']('CREATE\x20TABLE\x20'+_0x332ec4+_0x4545('0x85'));logger[_0x4545('0x55')](_0x4545('0x86'),contactItemTypes[_0x4545('0x21')]);var _0x5309d=util[_0x4545('0x9')](_0x4545('0x87'),_0x589d06,_0x332ec4,_0x2f80e5,_0x374361[_0x4545('0x34')],_0x374361[_0x4545('0x4f')]||null,NOW,NOW);if(_['isNil'](_0x44f068['scheduledat'])){_0x5309d+=_0x4545('0x88');}_0x3a5638[_0x4545('0x1c')](_0x5309d);BPromise[_0x4545('0x89')](_0x3a5638,handleQuery)[_0x4545('0x1f')](function(_0x260ee9){BPromise[_0x4545('0x1d')]([handleAdditionalPhones()])[_0x4545('0x1f')](function(){_0x3a5638=[];for(var _0x1b0758=0x0;_0x1b0758\x20\x20');}var _0x4c6764=path['join'](config['root'],'server/files/tmp',process[_0x4545('0x90')][0x2]);if(!fs[_0x4545('0x91')](_0x4c6764)){throw new Error(_0x4545('0x92'));}var _0x36b1a1={};try{_0x36b1a1=JSON[_0x4545('0x93')](process[_0x4545('0x90')][0x3]);if(!_0x36b1a1[_0x4545('0x60')]){throw new Error(_0x4545('0x94'));}var _0x427f83=0x0;if(_0x36b1a1[_0x4545('0x60')][_0x4545('0x73')]){_0x427f83=0x1;}if(!_0x36b1a1[_0x4545('0x34')]){throw new Error(_0x4545('0x95'));}}catch(_0x4c566a){throw new Error(_0x4545('0x96'));}var _0x43c839=[];try{_0x43c839=_[_0x4545('0x97')](JSON[_0x4545('0x93')](process[_0x4545('0x90')][0x4]),'id');}catch(_0x2274f4){logger['info'](_0x4545('0x98'));}main(_0x4c6764,_0x36b1a1,_0x43c839,_0x427f83);}validate();process['on'](_0x4545('0x99'),handleStop);process['on'](_0x4545('0x9a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 63d009a..e511339 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bae=['Call\x20To','destexten','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','Called\x20Number','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name'];(function(_0x3ee8d1,_0x54afbd){var _0x5e6660=function(_0x3414a5){while(--_0x3414a5){_0x3ee8d1['push'](_0x3ee8d1['shift']());}};_0x5e6660(++_0x54afbd);}(_0x0bae,0xc1));var _0xe0ba=function(_0x353c86,_0x2511cd){_0x353c86=_0x353c86-0x0;var _0x579b73=_0x0bae[_0x353c86];return _0x579b73;};'use strict';exports[_0xe0ba('0x0')]=function(_0x255f2c,_0x5c7c76){var _0x5a3ba6=[{'type':_0xe0ba('0x1'),'content':_0xe0ba('0x2'),'variableName':null}];switch(_0x255f2c[_0xe0ba('0x3')]()){case _0xe0ba('0x4'):switch(_0x5c7c76[_0xe0ba('0x3')]()){case _0xe0ba('0x5'):_0x5a3ba6[_0xe0ba('0x6')]({'type':_0xe0ba('0x7'),'content':'','variableName':_0xe0ba('0x8')});_0x5a3ba6[_0xe0ba('0x6')]({'type':_0xe0ba('0x7'),'content':'','variableName':_0xe0ba('0x9')});break;case _0xe0ba('0xa'):_0x5a3ba6[_0xe0ba('0x6')]({'type':_0xe0ba('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5a3ba6[_0xe0ba('0x6')]({'type':'variable','content':'','variableName':_0xe0ba('0xb')});break;}}return _0x5a3ba6;};exports[_0xe0ba('0xc')]=function(_0x30beb1,_0x44ab80){var _0x436714=[];switch(_0x30beb1['toLowerCase']()){case _0xe0ba('0x4'):switch(_0x44ab80['toLowerCase']()){case _0xe0ba('0x5'):_0x436714=[{'type':_0xe0ba('0x1'),'content':_0xe0ba('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0xf'),'keyType':'variable','variableName':_0xe0ba('0x9')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x10'),'keyType':_0xe0ba('0x7'),'variableName':'calleridname'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x11'),'keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x12')},{'type':'keyValue','content':'','key':_0xe0ba('0x13'),'keyType':'variable','variableName':_0xe0ba('0x8')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x14'),'keyType':_0xe0ba('0x7'),'variableName':'uniqueid'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x15'),'keyType':_0xe0ba('0x7'),'variableName':'agentcalledAt'},{'type':_0xe0ba('0x1'),'content':_0xe0ba('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x17')},{'type':_0xe0ba('0xe'),'content':'','key':'Agent\x20Number','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0xb')},{'type':_0xe0ba('0x1'),'content':_0xe0ba('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x19'),'keyType':'variable','variableName':_0xe0ba('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x1b')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x1c'),'keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x1d')},{'type':_0xe0ba('0xe'),'content':'','key':'Hold\x20Time','keyType':_0xe0ba('0x7'),'variableName':_0xe0ba('0x1e')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x1f'),'keyType':_0xe0ba('0x7'),'variableName':'talktime'}];break;case _0xe0ba('0xa'):_0x436714=[{'type':'string','content':_0xe0ba('0xd'),'variableName':null},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x20'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xe0ba('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x14'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':_0xe0ba('0x21')},{'type':_0xe0ba('0xe'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xe0ba('0x22')},{'type':_0xe0ba('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x23'),'keyType':'variable','keyContent':'','variableName':_0xe0ba('0x24')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x25'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x26'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':_0xe0ba('0x27')},{'type':_0xe0ba('0xe'),'content':'','key':_0xe0ba('0x28'),'keyType':_0xe0ba('0x7'),'keyContent':'','variableName':_0xe0ba('0x29')}];break;}}return _0x436714;}; \ No newline at end of file +var _0x0575=['Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Member\x20Name','membername','Answer\x20Time','answertime','Complete\x20Time','endtime'];(function(_0x4a16c8,_0x5ac996){var _0x597a09=function(_0xd180a8){while(--_0xd180a8){_0x4a16c8['push'](_0x4a16c8['shift']());}};_0x597a09(++_0x5ac996);}(_0x0575,0xf3));var _0x5057=function(_0x1d3e26,_0x379b08){_0x1d3e26=_0x1d3e26-0x0;var _0x1331fe=_0x0575[_0x1d3e26];return _0x1331fe;};'use strict';exports[_0x5057('0x0')]=function(_0x37d6aa,_0x120aa1){var _0x32c968=[{'type':_0x5057('0x1'),'content':_0x5057('0x2'),'variableName':null}];switch(_0x37d6aa[_0x5057('0x3')]()){case _0x5057('0x4'):switch(_0x120aa1[_0x5057('0x3')]()){case _0x5057('0x5'):_0x32c968[_0x5057('0x6')]({'type':_0x5057('0x7'),'content':'','variableName':_0x5057('0x8')});_0x32c968[_0x5057('0x6')]({'type':_0x5057('0x7'),'content':'','variableName':'calleridnum'});break;case _0x5057('0x9'):_0x32c968[_0x5057('0x6')]({'type':_0x5057('0x1'),'content':_0x5057('0xa'),'variableName':null});_0x32c968[_0x5057('0x6')]({'type':_0x5057('0x7'),'content':'','variableName':_0x5057('0xb')});break;}}return _0x32c968;};exports['getDescriptions']=function(_0x5391af,_0x2de670){var _0x3e4038=[];switch(_0x5391af[_0x5057('0x3')]()){case _0x5057('0x4'):switch(_0x2de670[_0x5057('0x3')]()){case _0x5057('0x5'):_0x3e4038=[{'type':_0x5057('0x1'),'content':_0x5057('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0xe'),'keyType':_0x5057('0x7'),'variableName':_0x5057('0xf')},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x10'),'keyType':_0x5057('0x7'),'variableName':_0x5057('0x11')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0x5057('0xd'),'content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x12'),'keyType':'variable','variableName':'uniqueid'},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x13'),'keyType':'variable','variableName':_0x5057('0x14')},{'type':'string','content':_0x5057('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x16'),'keyType':_0x5057('0x7'),'variableName':'destcalleridname'},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x17'),'keyType':_0x5057('0x7'),'variableName':_0x5057('0xb')},{'type':_0x5057('0x1'),'content':_0x5057('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x19'),'keyType':_0x5057('0x7'),'variableName':_0x5057('0x14')},{'type':_0x5057('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0x5057('0x7'),'variableName':_0x5057('0x1a')},{'type':_0x5057('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x5057('0x7'),'variableName':_0x5057('0x1b')},{'type':'keyValue','content':'','key':_0x5057('0x1c'),'keyType':_0x5057('0x7'),'variableName':_0x5057('0x1d')},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x1e'),'keyType':_0x5057('0x7'),'variableName':'talktime'}];break;case _0x5057('0x9'):_0x3e4038=[{'type':_0x5057('0x1'),'content':_0x5057('0xc'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x5057('0xb')},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x5057('0x20')},{'type':'keyValue','content':'','key':_0x5057('0x12'),'keyType':_0x5057('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x13'),'keyType':_0x5057('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x5057('0x1'),'content':_0x5057('0x18')},{'type':'keyValue','content':'','key':_0x5057('0x21'),'keyType':'variable','keyContent':'','variableName':_0x5057('0x22')},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x23'),'keyType':_0x5057('0x7'),'keyContent':'','variableName':_0x5057('0x24')},{'type':_0x5057('0xd'),'content':'','key':_0x5057('0x25'),'keyType':_0x5057('0x7'),'keyContent':'','variableName':_0x5057('0x26')},{'type':'keyValue','content':'','key':_0x5057('0x27'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x3e4038;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 45661bd..9f21ab0 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0525=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','info','catch','error','tracked','query','omit','body','html','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','unknown','toLowerCase'];(function(_0x3495cd,_0x369163){var _0x550a1c=function(_0x5a607e){while(--_0x5a607e){_0x3495cd['push'](_0x3495cd['shift']());}};_0x550a1c(++_0x369163);}(_0x0525,0x116));var _0x5052=function(_0x8dc025,_0x438ff5){_0x8dc025=_0x8dc025-0x0;var _0x371ba6=_0x0525[_0x8dc025];return _0x371ba6;};'use strict';var _=require(_0x5052('0x0'));var db=require(_0x5052('0x1'))['db'];var loggers={'openchannel':require(_0x5052('0x2'))(_0x5052('0x3')),'mail':require(_0x5052('0x2'))(_0x5052('0x4')),'fax':require(_0x5052('0x2'))(_0x5052('0x5')),'sms':require(_0x5052('0x2'))(_0x5052('0x6')),'chat':require(_0x5052('0x2'))(_0x5052('0x7')),'whatsapp':require(_0x5052('0x2'))(_0x5052('0x8'))};function getInteractionId(_0x597b8d,_0x27724e,_0x3e7e56){if(_0x597b8d&&_0x597b8d[_[_0x5052('0x9')](_0x3e7e56)+'InteractionId']){return _0x597b8d[_[_0x5052('0x9')](_0x3e7e56)+'InteractionId'];}else if(_0x597b8d&&_0x597b8d['id']){return _0x597b8d['id'];}else if(_0x27724e&&_0x27724e['id']){return _0x27724e['id'];}else{return _0x5052('0xa');}}function log(_0x3faf8d,_0x16fdee,_0x3c7757,_0x46a93e,_0x3fcacb,_0x1b89b2){loggers[_0x3fcacb[_0x5052('0xb')]()][_0x3faf8d](_0x5052('0xc'),_0x1b89b2['toUpperCase'](),_0x16fdee?_0x16fdee['id']:null,_0x16fdee?_0x16fdee[_0x5052('0xd')]:null,_0x16fdee?_0x16fdee[_0x5052('0xe')]:null,getInteractionId(_0x3c7757,_0x46a93e,_0x3fcacb),_0x3c7757?JSON[_0x5052('0xf')](_0x3c7757):_0x5052('0x10'));}function updateUser(_0x351ba0,_0x150068,_0x2bbd13,_0xbb1cbb,_0x3937cc){db[_[_0x5052('0x9')](_0xbb1cbb)+_0x5052('0x11')][_0x5052('0x12')]({'where':{'id':getInteractionId(_0x150068,_0x2bbd13,_0xbb1cbb)}})[_0x5052('0x13')](function(_0x4c9c88){if(_0x4c9c88){return _0x4c9c88['update']({'UserId':_0x351ba0?_0x351ba0['id']:null});}})['then'](function(_0x3a06ce){if(_0x3a06ce){log(_0x5052('0x14'),_0x351ba0,_0x150068,_0x2bbd13,_0xbb1cbb,_0x3937cc);}})[_0x5052('0x15')](function(){log(_0x5052('0x16'),_0x351ba0,_0x150068,_0x2bbd13,_0xbb1cbb,_0x3937cc);});}exports[_0x5052('0x17')]=function(_0x3b6a48,_0x5a5107){return function(_0x299c59,_0x55fd95,_0x5ec52b){var _0x36449a=_0x299c59['user'];var _0xa42268={};var _0x19f97f=_0x299c59[_0x5052('0x18')];if(_0xa42268){_0xa42268=_['clone'](_0x299c59['body']);_0xa42268=_[_0x5052('0x19')](_0xa42268,[_0x5052('0x1a'),_0x5052('0x1b'),'phone','fax',_0x5052('0x1c')]);}updateUser(_0x36449a,_0xa42268,_0x19f97f,_0x3b6a48,_0x5a5107);_0x5ec52b(null);};}; \ No newline at end of file +var _0x0726=['InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','info','catch','error','tracked','user','query','body','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst'];(function(_0x219ca3,_0x2a0e8c){var _0x3600e9=function(_0x31c9e0){while(--_0x31c9e0){_0x219ca3['push'](_0x219ca3['shift']());}};_0x3600e9(++_0x2a0e8c);}(_0x0726,0x16b));var _0x6072=function(_0xd3a548,_0x5cc68d){_0xd3a548=_0xd3a548-0x0;var _0x40fcfc=_0x0726[_0xd3a548];return _0x40fcfc;};'use strict';var _=require(_0x6072('0x0'));var db=require(_0x6072('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x6072('0x2')),'mail':require(_0x6072('0x3'))(_0x6072('0x4')),'fax':require(_0x6072('0x3'))(_0x6072('0x5')),'sms':require(_0x6072('0x3'))(_0x6072('0x6')),'chat':require(_0x6072('0x3'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x6072('0x7'))};function getInteractionId(_0x5159c2,_0x5c79c4,_0x5047e0){if(_0x5159c2&&_0x5159c2[_[_0x6072('0x8')](_0x5047e0)+'InteractionId']){return _0x5159c2[_[_0x6072('0x8')](_0x5047e0)+_0x6072('0x9')];}else if(_0x5159c2&&_0x5159c2['id']){return _0x5159c2['id'];}else if(_0x5c79c4&&_0x5c79c4['id']){return _0x5c79c4['id'];}else{return'unknown';}}function log(_0x4ccf89,_0x1d07ae,_0x2861cd,_0x495c58,_0x314efc,_0x3040d0){loggers[_0x314efc[_0x6072('0xa')]()][_0x4ccf89](_0x6072('0xb'),_0x3040d0[_0x6072('0xc')](),_0x1d07ae?_0x1d07ae['id']:null,_0x1d07ae?_0x1d07ae[_0x6072('0xd')]:null,_0x1d07ae?_0x1d07ae[_0x6072('0xe')]:null,getInteractionId(_0x2861cd,_0x495c58,_0x314efc),_0x2861cd?JSON[_0x6072('0xf')](_0x2861cd):_0x6072('0x10'));}function updateUser(_0xbbd8d3,_0x53051a,_0x396ba7,_0xa6e5f3,_0xc56bba){db[_[_0x6072('0x8')](_0xa6e5f3)+_0x6072('0x11')][_0x6072('0x12')]({'where':{'id':getInteractionId(_0x53051a,_0x396ba7,_0xa6e5f3)}})['then'](function(_0x1e79ee){if(_0x1e79ee){return _0x1e79ee[_0x6072('0x13')]({'UserId':_0xbbd8d3?_0xbbd8d3['id']:null});}})['then'](function(_0x222c6a){if(_0x222c6a){log(_0x6072('0x14'),_0xbbd8d3,_0x53051a,_0x396ba7,_0xa6e5f3,_0xc56bba);}})[_0x6072('0x15')](function(){log(_0x6072('0x16'),_0xbbd8d3,_0x53051a,_0x396ba7,_0xa6e5f3,_0xc56bba);});}exports[_0x6072('0x17')]=function(_0x36361d,_0x263305){return function(_0x43d78f,_0x41752d,_0x16ad21){var _0x21fe58=_0x43d78f[_0x6072('0x18')];var _0x20e9a9={};var _0x521c68=_0x43d78f[_0x6072('0x19')];if(_0x20e9a9){_0x20e9a9=_['clone'](_0x43d78f[_0x6072('0x1a')]);_0x20e9a9=_['omit'](_0x20e9a9,['body',_0x6072('0x1b'),_0x6072('0x1c'),_0x6072('0x1d'),_0x6072('0x1e')]);}updateUser(_0x21fe58,_0x20e9a9,_0x521c68,_0x36361d,_0x263305);_0x16ad21(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index f76dff8..502c0d1 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 _0x83d4=['hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse'];(function(_0x2fac7d,_0x1c74e0){var _0x21b733=function(_0x1a442f){while(--_0x1a442f){_0x2fac7d['push'](_0x2fac7d['shift']());}};_0x21b733(++_0x1c74e0);}(_0x83d4,0x1cb));var _0x483d=function(_0x264dfd,_0x35a1ce){_0x264dfd=_0x264dfd-0x0;var _0x5e04fd=_0x83d4[_0x264dfd];return _0x5e04fd;};'use strict';var crypto=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var compose=require(_0x483d('0x2'));var db=require(_0x483d('0x3'))['db'];var config=require(_0x483d('0x4'));function getValueFromLicense(_0x19bd34,_0xf8d790){if(_0x19bd34&&_0xf8d790){if(_0xf8d790[_0x483d('0x5')]&&_0xf8d790[_0x483d('0x6')]){var _0x2fd754=_0xf8d790['data1'];var _0x2e3b4f=_0xf8d790[_0x483d('0x6')];var _0x7d3fea=_0x2fd754[_0x483d('0x7')]('-')[0x4];var _0x47ccfc=_0x2fd754[_0x483d('0x7')]('-')[0x0];var _0x1373bb=crypto[_0x483d('0x8')](_0x483d('0x9'),util[_0x483d('0xa')](_0x483d('0xb'),_0x7d3fea,_0x2fd754,_0x47ccfc));var _0x12585f=_0x1373bb[_0x483d('0xc')](_0x2e3b4f,_0x483d('0xd'),_0x483d('0xe'));_0x12585f+=_0x1373bb[_0x483d('0xf')](_0x483d('0xe'));var _0x5bd449=JSON[_0x483d('0x10')](_0x12585f);return _0x5bd449[_0x483d('0x11')](_0x19bd34)?_0x5bd449[_0x19bd34]:null;}}return null;}function isLimit(_0x1a2fef,_0xdfbe72,_0x1ed18b,_0x449f3e){var _0x241fc9=_0xdfbe72;return compose()[_0x483d('0x12')](function(_0xa45a82,_0x5bb954,_0x55bbfc){return db[_0x483d('0x13')][_0x483d('0x14')]({'where':{'id':0x1},'raw':!![]})[_0x483d('0x15')](function(_0x55f42a){var _0x3a9d31=getValueFromLicense(_0x1a2fef,_0x55f42a);return _0x3a9d31?_0x3a9d31:_0x241fc9;})[_0x483d('0x15')](function(_0xf12d9){_0x241fc9=_0xf12d9;return _0x1ed18b[_0x483d('0x16')](_0x449f3e);})[_0x483d('0x15')](function(_0x5f3214){if(_0x5f3214>=_0x241fc9){return _0x5bb954[_0x483d('0x17')](0x193)['json']({'message':util[_0x483d('0xa')](_0x483d('0x18'),_0x1a2fef)});}_0x55bbfc();})['catch'](function(_0x347c22){_0x55bbfc(_0x347c22);});});}function isUserLimit(){return isLimit(_0x483d('0x19'),0x1,db['User'],{'where':{'$or':[{'role':_0x483d('0x1a')},{'role':'user'}]}});}exports[_0x483d('0x1b')]=isUserLimit; \ No newline at end of file +var _0x269c=['admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','User'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x269c,0xb2));var _0xc269=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x269c[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xc269('0x0'));var util=require(_0xc269('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xc269('0x2'));function getValueFromLicense(_0x485e29,_0x3b0ef5){if(_0x485e29&&_0x3b0ef5){if(_0x3b0ef5[_0xc269('0x3')]&&_0x3b0ef5['license']){var _0x49ff49=_0x3b0ef5[_0xc269('0x3')];var _0x418839=_0x3b0ef5[_0xc269('0x4')];var _0x131834=_0x49ff49['split']('-')[0x4];var _0x1e9ad4=_0x49ff49[_0xc269('0x5')]('-')[0x0];var _0x19bb6b=crypto[_0xc269('0x6')]('aes-256-ctr',util[_0xc269('0x7')](_0xc269('0x8'),_0x131834,_0x49ff49,_0x1e9ad4));var _0x558de4=_0x19bb6b['update'](_0x418839,_0xc269('0x9'),_0xc269('0xa'));_0x558de4+=_0x19bb6b[_0xc269('0xb')](_0xc269('0xa'));var _0x2e3512=JSON[_0xc269('0xc')](_0x558de4);return _0x2e3512[_0xc269('0xd')](_0x485e29)?_0x2e3512[_0x485e29]:null;}}return null;}function isLimit(_0x886e5c,_0x6780e,_0x1845e4,_0x325d11){var _0x439685=_0x6780e;return compose()[_0xc269('0xe')](function(_0x15b374,_0x3e7f4d,_0x435003){return db[_0xc269('0xf')][_0xc269('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xc269('0x11')](function(_0x2ad28e){var _0x188ba6=getValueFromLicense(_0x886e5c,_0x2ad28e);return _0x188ba6?_0x188ba6:_0x439685;})['then'](function(_0x556085){_0x439685=_0x556085;return _0x1845e4[_0xc269('0x12')](_0x325d11);})[_0xc269('0x11')](function(_0x22fd49){if(_0x22fd49>=_0x439685){return _0x3e7f4d[_0xc269('0x13')](0x193)[_0xc269('0x14')]({'message':util[_0xc269('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x886e5c)});}_0x435003();})['catch'](function(_0x19f243){_0x435003(_0x19f243);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xc269('0x15')],{'where':{'$or':[{'role':_0xc269('0x16')},{'role':_0xc269('0x17')}]}});}exports[_0xc269('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c3dbcfc..ba14f22 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 _0xf98d=['add','hours','minutes','parseSearch','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','>=\x20?','start','$substring','pop','utcOffset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf98d,0x16f));var _0xdf98=function(_0x4f1986,_0x5c65c5){_0x4f1986=_0x4f1986-0x0;var _0x25d085=_0xf98d[_0x4f1986];return _0x25d085;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xdf98('0x0')]=function(_0x76472e){var _0x29127d={'conditions':[]};_0x29127d['sqlOperator']=_[_0xdf98('0x1')](_0x76472e,_0xdf98('0x2'))?'or':_0xdf98('0x3');var _0x38d85d=_0x76472e[_0xdf98('0x4')](_0xdf98('0x5'),'')['replace'](_0xdf98('0x2'),'')['split']('||');for(var _0x2537b6=0x0;_0x2537b6<_0x38d85d[_0xdf98('0x6')];_0x2537b6++){var _0x1b3a2c=_0x38d85d[_0x2537b6][_0xdf98('0x7')](':=');var _0x317161=_0x1b3a2c[0x0];var _0x129135=_0x1b3a2c[_0xdf98('0x8')](0x1);_0x129135['forEach'](function(_0x112ff8){var _0x557567=_0x112ff8[_0xdf98('0x7')]('[')[_0xdf98('0x9')]();var _0x1b1276=_0x112ff8['match'](/\[(.*?)\]/g);_0x1b1276[_0xdf98('0xa')](function(_0x5e8362){var _0x1af4f1=_0x5e8362['split']('[')['filter'](function(_0x5cedb1){return _0x5cedb1[_0xdf98('0xb')](']')>-0x1;})[_0xdf98('0xc')](function(_0x39d406){return _0x39d406['split'](']')[0x0];})[0x0];_0x29127d[_0xdf98('0xd')][_0xdf98('0xe')]({'field':_0x317161,'operator':_0x557567,'value':_0x1af4f1});});});}return _0x29127d;};exports[_0xdf98('0xf')]=function(_0x556627,_0x2be100,_0x4075ea){var _0x3d2461={};if(_0x2be100===_0xdf98('0x10')){if(_0x4075ea[_0xdf98('0x11')]===_0xdf98('0x12')){_0x4075ea[_0xdf98('0x11')]=_0xdf98('0x13');_0x4075ea[_0xdf98('0x14')]+=','+_0x4075ea['value'];}else if(_[_0xdf98('0x15')]([_0xdf98('0x16'),_0xdf98('0x17')],_0x4075ea['operator'])){_0x4075ea['value']=moment(_0x4075ea[_0xdf98('0x14')])['add'](0x1,_0xdf98('0x18'))[_0xdf98('0x19')](_0xdf98('0x1a'));}}if(_0x4075ea[_0xdf98('0x1b')]){_0x2be100=_0x4075ea[_0xdf98('0x1b')];_0x3d2461[_0xdf98('0x1c')]=_0xdf98('0x1d')+_0x556627+'.'+_0x4075ea[_0xdf98('0x1e')]+_0xdf98('0x1f')+_0x4075ea[_0xdf98('0x1b')]+')\x20'+parseOperator(_0x4075ea[_0xdf98('0x11')]);}else{_0x3d2461[_0xdf98('0x1c')]=_0x556627+'.'+_0x4075ea[_0xdf98('0x1e')]+'\x20'+parseOperator(_0x4075ea[_0xdf98('0x11')]);}if(_['includes']([_0xdf98('0x20'),_0xdf98('0x21')],_0x4075ea[_0xdf98('0x11')]))_0x3d2461['text']='('+_0x3d2461[_0xdf98('0x1c')]+_0xdf98('0x22')+_0x556627+'.'+_0x4075ea[_0xdf98('0x1e')]+'\x20IS\x20NULL)';_0x3d2461['value']=parseValue(_0x2be100,_0x4075ea[_0xdf98('0x11')],_0x4075ea[_0xdf98('0x14')]);return _0x3d2461;};function parseOperator(_0x57cccf){var _0x5ab20e;switch(_0x57cccf){case _0xdf98('0x23'):_0x5ab20e='IN\x20?';break;case'$notIn':_0x5ab20e='NOT\x20IN\x20?';break;case'$eq':_0x5ab20e=_0xdf98('0x24');break;case'$ne':_0x5ab20e=_0xdf98('0x25');break;case'$substring':case _0xdf98('0x26'):case _0xdf98('0x27'):_0x5ab20e=_0xdf98('0x28');break;case _0xdf98('0x29'):_0x5ab20e=_0xdf98('0x2a');break;case'$gt':_0x5ab20e=_0xdf98('0x2b');break;case _0xdf98('0x17'):_0x5ab20e='<=\x20?';break;case'$gte':_0x5ab20e=_0xdf98('0x2c');break;case _0xdf98('0x13'):_0x5ab20e='BETWEEN\x20?\x20AND\x20?';break;}return _0x5ab20e;}function parseValue(_0x334cc3,_0x58647d,_0xa5585c){var _0x4893b5={'start':undefined,'end':undefined};switch(_0x58647d){case _0xdf98('0x23'):case _0xdf98('0x21'):_0x4893b5[_0xdf98('0x2d')]=_0xa5585c[_0xdf98('0x7')](',');break;case _0xdf98('0x2e'):_0x4893b5[_0xdf98('0x2d')]='%'+_0xa5585c+'%';break;case _0xdf98('0x26'):_0x4893b5[_0xdf98('0x2d')]=_0xa5585c+'%';break;case _0xdf98('0x27'):_0x4893b5['start']='%'+_0xa5585c;break;case'$between':var _0x4da6b9=_0xa5585c[_0xdf98('0x7')](',');var _0xa5585c=_0x4da6b9[_0xdf98('0x9')]();var _0x4dd197=_0x4da6b9[_0xdf98('0x2f')]();if(_0x334cc3===_0xdf98('0x10')){_0xa5585c=moment(_0xa5585c)['utcOffset'](0x0,!![])[_0xdf98('0x19')]();_0x4dd197=moment(_0x4dd197)[_0xdf98('0x30')](0x0,!![])[_0xdf98('0x31')](0x17,_0xdf98('0x32'))['add'](0x3b,_0xdf98('0x33'))[_0xdf98('0x31')](0x3b,'seconds')[_0xdf98('0x19')]();}_0x4893b5={'start':_0xa5585c,'end':_0x4dd197};break;default:_0x4893b5['start']=_0xa5585c;break;}return _0x4893b5;} \ No newline at end of file +var _0x56ee=['IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','$lte','$gte','start','$substring','pop','format','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','filter','indexOf','map','buildExpression','DATE','$eq','$between','value','includes','$gt','operator','add','days','YYYY-MM-DD','castTo','CAST(','field','text','$ne','\x20OR\x20','\x20IS\x20NULL)','$in'];(function(_0x2aea67,_0xc83555){var _0x55460f=function(_0x2c5f45){while(--_0x2c5f45){_0x2aea67['push'](_0x2aea67['shift']());}};_0x55460f(++_0xc83555);}(_0x56ee,0x7c));var _0xe56e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x56ee[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xe56e('0x0'));var moment=require(_0xe56e('0x1'));exports[_0xe56e('0x2')]=function(_0x5b5c78){var _0x3d1456={'conditions':[]};_0x3d1456[_0xe56e('0x3')]=_[_0xe56e('0x4')](_0x5b5c78,_0xe56e('0x5'))?'or':_0xe56e('0x6');var _0x1016a6=_0x5b5c78[_0xe56e('0x7')]('[$and]','')[_0xe56e('0x7')](_0xe56e('0x5'),'')[_0xe56e('0x8')]('||');for(var _0x5dcf46=0x0;_0x5dcf46<_0x1016a6[_0xe56e('0x9')];_0x5dcf46++){var _0x207401=_0x1016a6[_0x5dcf46][_0xe56e('0x8')](':=');var _0x1c99b1=_0x207401[0x0];var _0x142813=_0x207401[_0xe56e('0xa')](0x1);_0x142813[_0xe56e('0xb')](function(_0x3ed45a){var _0x30f49a=_0x3ed45a['split']('[')[_0xe56e('0xc')]();var _0x8fed76=_0x3ed45a['match'](/\[(.*?)\]/g);_0x8fed76['forEach'](function(_0x487d4d){var _0x1605ec=_0x487d4d['split']('[')[_0xe56e('0xd')](function(_0x33cc29){return _0x33cc29[_0xe56e('0xe')](']')>-0x1;})[_0xe56e('0xf')](function(_0x40fc23){return _0x40fc23['split'](']')[0x0];})[0x0];_0x3d1456['conditions']['push']({'field':_0x1c99b1,'operator':_0x30f49a,'value':_0x1605ec});});});}return _0x3d1456;};exports[_0xe56e('0x10')]=function(_0xf191a4,_0x19e685,_0x21e385){var _0xcd4729={};if(_0x19e685===_0xe56e('0x11')){if(_0x21e385['operator']===_0xe56e('0x12')){_0x21e385['operator']=_0xe56e('0x13');_0x21e385[_0xe56e('0x14')]+=','+_0x21e385[_0xe56e('0x14')];}else if(_[_0xe56e('0x15')]([_0xe56e('0x16'),'$lte'],_0x21e385[_0xe56e('0x17')])){_0x21e385[_0xe56e('0x14')]=moment(_0x21e385[_0xe56e('0x14')])[_0xe56e('0x18')](0x1,_0xe56e('0x19'))['format'](_0xe56e('0x1a'));}}if(_0x21e385['castTo']){_0x19e685=_0x21e385[_0xe56e('0x1b')];_0xcd4729['text']=_0xe56e('0x1c')+_0xf191a4+'.'+_0x21e385[_0xe56e('0x1d')]+'\x20AS\x20'+_0x21e385[_0xe56e('0x1b')]+')\x20'+parseOperator(_0x21e385['operator']);}else{_0xcd4729[_0xe56e('0x1e')]=_0xf191a4+'.'+_0x21e385[_0xe56e('0x1d')]+'\x20'+parseOperator(_0x21e385['operator']);}if(_[_0xe56e('0x15')]([_0xe56e('0x1f'),'$notIn'],_0x21e385[_0xe56e('0x17')]))_0xcd4729['text']='('+_0xcd4729['text']+_0xe56e('0x20')+_0xf191a4+'.'+_0x21e385[_0xe56e('0x1d')]+_0xe56e('0x21');_0xcd4729[_0xe56e('0x14')]=parseValue(_0x19e685,_0x21e385[_0xe56e('0x17')],_0x21e385['value']);return _0xcd4729;};function parseOperator(_0x1cad41){var _0x422e37;switch(_0x1cad41){case _0xe56e('0x22'):_0x422e37=_0xe56e('0x23');break;case _0xe56e('0x24'):_0x422e37=_0xe56e('0x25');break;case _0xe56e('0x12'):_0x422e37=_0xe56e('0x26');break;case _0xe56e('0x1f'):_0x422e37=_0xe56e('0x27');break;case'$substring':case _0xe56e('0x28'):case _0xe56e('0x29'):_0x422e37='LIKE\x20?';break;case'$lt':_0x422e37=_0xe56e('0x2a');break;case'$gt':_0x422e37=_0xe56e('0x2b');break;case _0xe56e('0x2c'):_0x422e37='<=\x20?';break;case _0xe56e('0x2d'):_0x422e37='>=\x20?';break;case _0xe56e('0x13'):_0x422e37='BETWEEN\x20?\x20AND\x20?';break;}return _0x422e37;}function parseValue(_0x38dd59,_0x2b1922,_0x32d881){var _0x3ca05b={'start':undefined,'end':undefined};switch(_0x2b1922){case _0xe56e('0x22'):case _0xe56e('0x24'):_0x3ca05b[_0xe56e('0x2e')]=_0x32d881[_0xe56e('0x8')](',');break;case _0xe56e('0x2f'):_0x3ca05b[_0xe56e('0x2e')]='%'+_0x32d881+'%';break;case _0xe56e('0x28'):_0x3ca05b[_0xe56e('0x2e')]=_0x32d881+'%';break;case _0xe56e('0x29'):_0x3ca05b[_0xe56e('0x2e')]='%'+_0x32d881;break;case _0xe56e('0x13'):var _0x23cb07=_0x32d881[_0xe56e('0x8')](',');var _0x32d881=_0x23cb07[_0xe56e('0xc')]();var _0x3860bc=_0x23cb07[_0xe56e('0x30')]();if(_0x38dd59===_0xe56e('0x11')){_0x32d881=moment(_0x32d881)['utcOffset'](0x0,!![])[_0xe56e('0x31')]();_0x3860bc=moment(_0x3860bc)[_0xe56e('0x32')](0x0,!![])[_0xe56e('0x18')](0x17,_0xe56e('0x33'))[_0xe56e('0x18')](0x3b,'minutes')['add'](0x3b,_0xe56e('0x34'))['format']();}_0x3ca05b={'start':_0x32d881,'end':_0x3860bc};break;default:_0x3ca05b[_0xe56e('0x2e')]=_0x32d881;break;}return _0x3ca05b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 82e5c02..df83b9e 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 _0x2675=['value','where','merge','col','options','lodash','keys','parse','fields','split','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','cast','priority','unsigned','substr','ASC','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','push','join','getOptions','query','$id','filters','intersection','model','attributes','nolimit','sort','filter','object','includes'];(function(_0x1549fd,_0x56022c){var _0x358e14=function(_0x15f7fd){while(--_0x15f7fd){_0x1549fd['push'](_0x1549fd['shift']());}};_0x358e14(++_0x56022c);}(_0x2675,0x75));var _0x5267=function(_0x3c6631,_0x5dc148){_0x3c6631=_0x3c6631-0x0;var _0x5b165b=_0x2675[_0x3c6631];return _0x5b165b;};'use strict';var _=require(_0x5267('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4f8fae){var _0x1da342=['ne'];try{var _0x2ae442=JSON['parse'](_0x4f8fae);var _0x4600fa=Object[_0x5267('0x1')](_0x2ae442)[0x0];return _0x1da342['includes'](_0x4600fa);}catch(_0x328776){return![];}}function getOperatorValue(_0xf2b350){var _0x4bd042=JSON[_0x5267('0x2')](_0xf2b350);var _0x20f065=Object[_0x5267('0x1')](_0x4bd042)[0x0];var _0x527c16=_0x4bd042[_0x20f065];return{['$'+_0x20f065]:_0x527c16};}exports[_0x5267('0x3')]=function(_0x46bfdf){var _0x506fd7=null;if(_0x46bfdf){_0x506fd7=_0x46bfdf[_0x5267('0x4')](',');}return _0x506fd7;};exports['filters']=function(_0x3ff4e9,_0x207d47){var _0x26e22b={};if(!_['isEmpty'](_0x3ff4e9)){_[_0x5267('0x5')](_0x3ff4e9,function(_0x5060b3,_0x445151){try{if(_0x207d47){var _0x5bbf00=_[_0x5267('0x6')](_0x207d47,{'name':_0x445151})||{};if(hasSequelizeOperator(_0x5060b3)){_0x26e22b[_0x445151]=getOperatorValue(_0x5060b3);}else if(_0x5bbf00[_0x5267('0x7')]===_0x5267('0x8')&&_[_0x5267('0x9')](_0x5060b3)){var _0x1d7090=JSON[_0x5267('0x2')](_0x5060b3);var _0x20785c={'$gte':moment(moment(_0x1d7090[_0x5267('0xa')])[_0x5267('0xb')](_0x5267('0xc')))[_0x5267('0xd')]()[_0x5267('0xb')](),'$lte':moment(moment(_0x1d7090[_0x5267('0xe')])['format']('YYYY-MM-DD'))[_0x5267('0xd')]()[_0x5267('0xf')](0x1,'s')[_0x5267('0xb')]()};_0x26e22b[_0x445151]=_0x20785c;}else if(_0x5bbf00[_0x5267('0x10')]===_0x5267('0x11')){_0x26e22b[_0x445151]=_0x5060b3;}else{_0x26e22b[_0x445151]=_[_0x5267('0x12')](_0x5060b3)?_0x5060b3:JSON[_0x5267('0x2')](_0x5060b3);}}else{_0x26e22b[_0x445151]=_[_0x5267('0x12')](_0x5060b3)?_0x5060b3:JSON[_0x5267('0x2')](_0x5060b3);}}catch(_0xb1c97a){_0x26e22b[_0x445151]=_0x5060b3[_0x5267('0x4')](',');}});}return _0x26e22b;};exports[_0x5267('0x13')]=function(_0x528d61){_0x528d61=parseInt(_0x528d61,0xa);if(!_0x528d61||_0x528d61<0x0){_0x528d61=LIMIT_VALUE;}return _0x528d61;};exports[_0x5267('0x14')]=function(_0x2afd38){_0x2afd38=parseInt(_0x2afd38,0xa);if(!_0x2afd38||_0x2afd38<0x0){_0x2afd38=0x0;}return _0x2afd38;};exports['sort']=function(_0x20cb50){var _0x56733e,_0x1cf835=null;if(_0x20cb50){_0x56733e=_0x20cb50[_0x5267('0x4')](',');_0x1cf835=_[_0x5267('0x15')](_0x56733e,function(_0x2a9f99){if(_0x2a9f99[_0x5267('0x16')]('-')===0x0){return[_0x2a9f99==='priority'?sequelize[_0x5267('0x17')](sequelize['col'](_0x5267('0x18')),_0x5267('0x19')):_0x2a9f99[_0x5267('0x1a')](0x1),'DESC'];}else{return[_0x2a9f99==='priority'?sequelize['cast'](sequelize['col']('priority'),_0x5267('0x19')):_0x2a9f99,_0x5267('0x1b')];}});}return _0x1cf835;};exports[_0x5267('0x1c')]=function(_0x279377,_0x11c8ea){if(_[_0x5267('0x1d')](_0x279377)){return _0x279377;}if(_[_0x5267('0x12')](_0x279377)){for(var _0x220e03=0x0;_0x220e03<_0x279377[_0x5267('0x1e')];_0x220e03+=0x1){_0x279377[_0x220e03]=this['omit'](_0x279377[_0x220e03],_0x11c8ea);}return _0x279377;}if(!_['isObject'](_0x279377)){return _0x279377;}if(_[_0x5267('0x1f')](_0x11c8ea)){_0x11c8ea=[_0x11c8ea];}if(!_[_0x5267('0x12')](_0x11c8ea)){return _0x279377;}for(var _0x5abf95=0x0;_0x5abf95<_0x11c8ea[_0x5267('0x1e')];_0x5abf95+=0x1){_['unset'](_0x279377,_0x11c8ea[_0x5abf95]);}for(var _0x4d7c2a in _0x279377){if(_0x279377[_0x5267('0x20')](_0x4d7c2a)){_0x279377[_0x4d7c2a]=this[_0x5267('0x1c')](_0x279377[_0x4d7c2a],_0x11c8ea);}}return _0x279377;};exports[_0x5267('0x21')]=function(_0x2d2ace){return _0x2d2ace[_0x5267('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x18020c){return _0x18020c[_0x5267('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x5267('0x23')]=function(_0x549a66){var _0x58d685=[];_0x549a66[_0x5267('0x4')](/[ ,]+/)[_0x5267('0x24')](function(_0x1fa725){_0x1fa725=_0x1fa725['replace'](/([^:]")"+/g,'$1');_0x1fa725='+'+_0x1fa725+'*';var _0x59b091=/[ `!@#$%^&*()_\-?~]/;if(_0x1fa725[_0x5267('0x22')](_0x59b091))_0x1fa725='\x22'+_0x1fa725+'\x22';_0x58d685[_0x5267('0x25')](_0x1fa725);});return _0x58d685[_0x5267('0x26')]('\x20');};exports[_0x5267('0x27')]=function(_0x5bbb83,_0x33e456,_0x1a7f4b){var _0x4344c5={},_0xf8d7a3={};if(_0x33e456[_0x5267('0x28')][_0x5267('0x29')]){_0x33e456[_0x5267('0x28')]['id']=_0x33e456[_0x5267('0x28')]['$id'];delete _0x33e456['query'][_0x5267('0x29')];}_0x4344c5['model']=_[_0x5267('0x15')](_0x5bbb83,_0x5267('0x10'));_0x4344c5[_0x5267('0x28')]=_[_0x5267('0x1')](_0x33e456['query']);_0x4344c5[_0x5267('0x2a')]=_[_0x5267('0x2b')](_0x4344c5[_0x5267('0x2c')],_0x4344c5[_0x5267('0x28')]);_0xf8d7a3[_0x5267('0x2d')]=_[_0x5267('0x2b')](_0x4344c5[_0x5267('0x2c')],this[_0x5267('0x3')](_0x33e456['query'][_0x5267('0x3')]));_0xf8d7a3['attributes']=_0xf8d7a3[_0x5267('0x2d')][_0x5267('0x1e')]?_0xf8d7a3[_0x5267('0x2d')]:_0x4344c5[_0x5267('0x2c')];if(!_0x33e456[_0x5267('0x28')][_0x5267('0x20')](_0x5267('0x2e'))){_0xf8d7a3['limit']=this[_0x5267('0x13')](_0x33e456[_0x5267('0x28')][_0x5267('0x13')]);_0xf8d7a3[_0x5267('0x14')]=this[_0x5267('0x14')](_0x33e456[_0x5267('0x28')][_0x5267('0x14')]);}_0xf8d7a3['order']=this[_0x5267('0x2f')](_0x33e456['query'][_0x5267('0x2f')]);_0xf8d7a3['where']=this['filters'](_['pick'](_0x33e456[_0x5267('0x28')],_0x4344c5['filters']),_0x5bbb83);if(_0x33e456[_0x5267('0x28')][_0x5267('0x30')]){var _0x3d4b19=_0x5bbb83;var _0x235982=_0x33e456['query'][_0x5267('0x30')];if(typeof _0x235982===_0x5267('0x31')){_0x3d4b19=_['filter'](_0x5bbb83,function(_0x54a5e5){return _[_0x5267('0x32')](_0x235982['columns'],_0x54a5e5[_0x5267('0x10')]);});_0x235982=_0x235982[_0x5267('0x33')];}_0xf8d7a3[_0x5267('0x34')]=_[_0x5267('0x35')](_0xf8d7a3[_0x5267('0x34')],{'$or':_[_0x5267('0x15')](_0x3d4b19,function(_0x27add5){if(_0x27add5['type']!=='VIRTUAL'){if(_0x1a7f4b){return sequelize[_0x5267('0x34')](sequelize['fn']('lower',sequelize[_0x5267('0x36')](_0x27add5[_0x5267('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x33e456[_0x5267('0x28')][_0x5267('0x30')]+'%')});}else{var _0x299a13={};_0x299a13[_0x27add5[_0x5267('0x10')]]={'$like':'%'+_0x33e456[_0x5267('0x28')][_0x5267('0x30')]+'%'};return _0x299a13;}}})});}_0xf8d7a3=_[_0x5267('0x35')]({},_0xf8d7a3,_0x33e456[_0x5267('0x37')]);return _0xf8d7a3;}; \ No newline at end of file +var _0x9c5a=['YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','indexOf','col','priority','unsigned','substr','DESC','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','push','join','getOptions','query','$id','name','intersection','model','attributes','nolimit','order','filter','object','columns','value','where','VIRTUAL','lower','merge','options','lodash','sequelize','parse','keys','includes','fields','split','filters','find','type','DATE','isPlainObject','format'];(function(_0x33c1cc,_0x4841d5){var _0x35f979=function(_0x655ee3){while(--_0x655ee3){_0x33c1cc['push'](_0x33c1cc['shift']());}};_0x35f979(++_0x4841d5);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x323401,_0x48854a){_0x323401=_0x323401-0x0;var _0x2d5701=_0x9c5a[_0x323401];return _0x2d5701;};'use strict';var _=require(_0xa9c5('0x0'));var sequelize=require(_0xa9c5('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x32ab4d){var _0x1cd14d=['ne'];try{var _0x1d0ee9=JSON[_0xa9c5('0x2')](_0x32ab4d);var _0x4f5552=Object[_0xa9c5('0x3')](_0x1d0ee9)[0x0];return _0x1cd14d[_0xa9c5('0x4')](_0x4f5552);}catch(_0x4e9403){return![];}}function getOperatorValue(_0x1e3c83){var _0x4d9c7a=JSON[_0xa9c5('0x2')](_0x1e3c83);var _0x3df556=Object['keys'](_0x4d9c7a)[0x0];var _0x4b6db6=_0x4d9c7a[_0x3df556];return{['$'+_0x3df556]:_0x4b6db6};}exports[_0xa9c5('0x5')]=function(_0x16f331){var _0x52afb2=null;if(_0x16f331){_0x52afb2=_0x16f331[_0xa9c5('0x6')](',');}return _0x52afb2;};exports[_0xa9c5('0x7')]=function(_0x51c14c,_0x2e4f45){var _0x40a79d={};if(!_['isEmpty'](_0x51c14c)){_['forOwn'](_0x51c14c,function(_0x38e106,_0x11421c){try{if(_0x2e4f45){var _0x45f8d8=_[_0xa9c5('0x8')](_0x2e4f45,{'name':_0x11421c})||{};if(hasSequelizeOperator(_0x38e106)){_0x40a79d[_0x11421c]=getOperatorValue(_0x38e106);}else if(_0x45f8d8[_0xa9c5('0x9')]===_0xa9c5('0xa')&&_[_0xa9c5('0xb')](_0x38e106)){var _0x42d5cf=JSON[_0xa9c5('0x2')](_0x38e106);var _0x1ea48={'$gte':moment(moment(_0x42d5cf['$gte'])[_0xa9c5('0xc')](_0xa9c5('0xd')))[_0xa9c5('0xe')]()[_0xa9c5('0xc')](),'$lte':moment(moment(_0x42d5cf[_0xa9c5('0xf')])[_0xa9c5('0xc')](_0xa9c5('0xd')))[_0xa9c5('0xe')]()[_0xa9c5('0x10')](0x1,'s')[_0xa9c5('0xc')]()};_0x40a79d[_0x11421c]=_0x1ea48;}else if(_0x45f8d8['name']===_0xa9c5('0x11')){_0x40a79d[_0x11421c]=_0x38e106;}else{_0x40a79d[_0x11421c]=_[_0xa9c5('0x12')](_0x38e106)?_0x38e106:JSON[_0xa9c5('0x2')](_0x38e106);}}else{_0x40a79d[_0x11421c]=_['isArray'](_0x38e106)?_0x38e106:JSON[_0xa9c5('0x2')](_0x38e106);}}catch(_0x1142d9){_0x40a79d[_0x11421c]=_0x38e106[_0xa9c5('0x6')](',');}});}return _0x40a79d;};exports[_0xa9c5('0x13')]=function(_0x452a9b){_0x452a9b=parseInt(_0x452a9b,0xa);if(!_0x452a9b||_0x452a9b<0x0){_0x452a9b=LIMIT_VALUE;}return _0x452a9b;};exports[_0xa9c5('0x14')]=function(_0x3b8d4d){_0x3b8d4d=parseInt(_0x3b8d4d,0xa);if(!_0x3b8d4d||_0x3b8d4d<0x0){_0x3b8d4d=0x0;}return _0x3b8d4d;};exports[_0xa9c5('0x15')]=function(_0x2c7cd5){var _0x36c486,_0x113c8f=null;if(_0x2c7cd5){_0x36c486=_0x2c7cd5[_0xa9c5('0x6')](',');_0x113c8f=_['map'](_0x36c486,function(_0x1115ad){if(_0x1115ad[_0xa9c5('0x16')]('-')===0x0){return[_0x1115ad==='priority'?sequelize['cast'](sequelize[_0xa9c5('0x17')](_0xa9c5('0x18')),_0xa9c5('0x19')):_0x1115ad[_0xa9c5('0x1a')](0x1),_0xa9c5('0x1b')];}else{return[_0x1115ad===_0xa9c5('0x18')?sequelize['cast'](sequelize['col'](_0xa9c5('0x18')),_0xa9c5('0x19')):_0x1115ad,'ASC'];}});}return _0x113c8f;};exports[_0xa9c5('0x1c')]=function(_0x424b4c,_0x306c9b){if(_[_0xa9c5('0x1d')](_0x424b4c)){return _0x424b4c;}if(_[_0xa9c5('0x12')](_0x424b4c)){for(var _0x40f08b=0x0;_0x40f08b<_0x424b4c[_0xa9c5('0x1e')];_0x40f08b+=0x1){_0x424b4c[_0x40f08b]=this['omit'](_0x424b4c[_0x40f08b],_0x306c9b);}return _0x424b4c;}if(!_['isObject'](_0x424b4c)){return _0x424b4c;}if(_[_0xa9c5('0x1f')](_0x306c9b)){_0x306c9b=[_0x306c9b];}if(!_['isArray'](_0x306c9b)){return _0x424b4c;}for(var _0x1762ac=0x0;_0x1762ac<_0x306c9b[_0xa9c5('0x1e')];_0x1762ac+=0x1){_['unset'](_0x424b4c,_0x306c9b[_0x1762ac]);}for(var _0x11a723 in _0x424b4c){if(_0x424b4c[_0xa9c5('0x20')](_0x11a723)){_0x424b4c[_0x11a723]=this['omit'](_0x424b4c[_0x11a723],_0x306c9b);}}return _0x424b4c;};exports[_0xa9c5('0x21')]=function(_0x32baf9){return _0x32baf9[_0xa9c5('0x22')](RegExp(_0xa9c5('0x23')))?!![]:![];};exports[_0xa9c5('0x24')]=function(_0x4f6e70){return _0x4f6e70[_0xa9c5('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3c3da7){var _0x1ef388=[];_0x3c3da7[_0xa9c5('0x6')](/[ ,]+/)['forEach'](function(_0xc6d0c1){_0xc6d0c1=_0xc6d0c1[_0xa9c5('0x25')](/([^:]")"+/g,'$1');_0xc6d0c1='+'+_0xc6d0c1+'*';var _0x5bc9bb=/[ `!@#$%^&*()_\-?~]/;if(_0xc6d0c1[_0xa9c5('0x22')](_0x5bc9bb))_0xc6d0c1='\x22'+_0xc6d0c1+'\x22';_0x1ef388[_0xa9c5('0x26')](_0xc6d0c1);});return _0x1ef388[_0xa9c5('0x27')]('\x20');};exports[_0xa9c5('0x28')]=function(_0x22ee21,_0x3392d0,_0x3a66d8){var _0x4b9104={},_0x452330={};if(_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')]){_0x3392d0[_0xa9c5('0x29')]['id']=_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')];delete _0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')];}_0x4b9104['model']=_['map'](_0x22ee21,_0xa9c5('0x2b'));_0x4b9104[_0xa9c5('0x29')]=_[_0xa9c5('0x3')](_0x3392d0[_0xa9c5('0x29')]);_0x4b9104[_0xa9c5('0x7')]=_[_0xa9c5('0x2c')](_0x4b9104['model'],_0x4b9104['query']);_0x452330['attributes']=_[_0xa9c5('0x2c')](_0x4b9104[_0xa9c5('0x2d')],this['fields'](_0x3392d0[_0xa9c5('0x29')]['fields']));_0x452330[_0xa9c5('0x2e')]=_0x452330[_0xa9c5('0x2e')][_0xa9c5('0x1e')]?_0x452330[_0xa9c5('0x2e')]:_0x4b9104['model'];if(!_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x20')](_0xa9c5('0x2f'))){_0x452330[_0xa9c5('0x13')]=this[_0xa9c5('0x13')](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x13')]);_0x452330[_0xa9c5('0x14')]=this['offset'](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x14')]);}_0x452330[_0xa9c5('0x30')]=this[_0xa9c5('0x15')](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x15')]);_0x452330['where']=this[_0xa9c5('0x7')](_['pick'](_0x3392d0[_0xa9c5('0x29')],_0x4b9104['filters']),_0x22ee21);if(_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]){var _0x37fb1b=_0x22ee21;var _0x5d09c5=_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')];if(typeof _0x5d09c5===_0xa9c5('0x32')){_0x37fb1b=_[_0xa9c5('0x31')](_0x22ee21,function(_0x5914d2){return _[_0xa9c5('0x4')](_0x5d09c5[_0xa9c5('0x33')],_0x5914d2[_0xa9c5('0x2b')]);});_0x5d09c5=_0x5d09c5[_0xa9c5('0x34')];}_0x452330[_0xa9c5('0x35')]=_['merge'](_0x452330[_0xa9c5('0x35')],{'$or':_['map'](_0x37fb1b,function(_0x1de605){if(_0x1de605[_0xa9c5('0x9')]!==_0xa9c5('0x36')){if(_0x3a66d8){return sequelize[_0xa9c5('0x35')](sequelize['fn'](_0xa9c5('0x37'),sequelize[_0xa9c5('0x17')](_0x1de605[_0xa9c5('0x2b')])),{'$like':sequelize['fn'](_0xa9c5('0x37'),'%'+_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]+'%')});}else{var _0x4aa4dd={};_0x4aa4dd[_0x1de605[_0xa9c5('0x2b')]]={'$like':'%'+_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]+'%'};return _0x4aa4dd;}}})});}_0x452330=_[_0xa9c5('0x38')]({},_0x452330,_0x3392d0[_0xa9c5('0x39')]);return _0x452330;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1291235..89acc7a 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4de7ab,_0x44a6c3){var _0x1f3f06=function(_0x55c66b){while(--_0x55c66b){_0x4de7ab['push'](_0x4de7ab['shift']());}};_0x1f3f06(++_0x44a6c3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 7c6c7ee..f4ddcd1 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 _0x5096=['cpus','map','model','join','createHash','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','../environment','orderBy','keys','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x56dd58,_0xb1287d){var _0x103e75=function(_0x369507){while(--_0x369507){_0x56dd58['push'](_0x56dd58['shift']());}};_0x103e75(++_0xb1287d);}(_0x5096,0x96));var _0x6509=function(_0x407654,_0x275ae3){_0x407654=_0x407654-0x0;var _0x521dbd=_0x5096[_0x407654];return _0x521dbd;};'use strict';var _=require(_0x6509('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x6509('0x1'));var exec=require(_0x6509('0x2'))['execSync'];var config=require(_0x6509('0x3'));function getInterfaces(){var _0xf7689f=[];var _0x1d8627=os['networkInterfaces']();var _0x35f521=_[_0x6509('0x4')](_[_0x6509('0x5')](_0x1d8627));for(var _0x2e5271=0x0;_0x2e5271<_0x35f521['length'];_0x2e5271++){var _0xb9a4b6=_0x1d8627[_0x35f521[_0x2e5271]]['filter'](function(_0x2547ba){return _0x2547ba[_0x6509('0x6')]===_0x6509('0x7')&&_0x2547ba[_0x6509('0x8')]===![];});_0xf7689f=_0xf7689f[_0x6509('0x9')](_0xb9a4b6);}return _0xf7689f;}function getFirstInterface(){var _0x21ee18=_[_0x6509('0xa')](getInterfaces());return{'macAddress':_0x21ee18&&_0x21ee18[_0x6509('0xb')]?_0x21ee18['mac']:_0x6509('0xc'),'ipAddress':_0x21ee18&&_0x21ee18[_0x6509('0xd')]?_0x21ee18['address']:_0x6509('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x593731=_['orderBy'](os[_0x6509('0xf')]()[_0x6509('0x10')](function(_0x42d59d){return _0x42d59d[_0x6509('0x11')];}))[_0x6509('0x12')](':');return crypto[_0x6509('0x13')]('md5')[_0x6509('0x14')](_0x593731)[_0x6509('0x15')](_0x6509('0x16'));}exports['getUuid']=function(){var _0x1df2a6=os[_0x6509('0x17')]();var _0x51e325=/[0-9a-f-]{36}/;if(config[_0x6509('0x18')]&&_0x51e325[_0x6509('0x19')](config['licenseToken'])){return config[_0x6509('0x18')];}else if(_0x1df2a6===_0x6509('0x1a')){return exec(_0x6509('0x1b'),{'encoding':_0x6509('0x1c')})[_0x6509('0x1d')]('\x0d\x0a','');}else{var _0x4d88b1=getFirstInterface();var _0x3a7564=getCPUhash();var _0x15c666=_0x3a7564+'|'+os['hostname']()+'|'+_0x4d88b1[_0x6509('0x1e')]+'|'+_0x4d88b1[_0x6509('0x1f')];var _0x1f4f6b=crypto['createHash']('md5')[_0x6509('0x14')](_0x15c666)[_0x6509('0x15')](_0x6509('0x16'));return _0x1f4f6b[_0x6509('0x20')](0x0,0x8)+'-'+_0x1f4f6b[_0x6509('0x20')](0x8,0xc)+'-'+_0x1f4f6b[_0x6509('0x20')](0xc,0x10)+'-'+_0x1f4f6b[_0x6509('0x20')](0x10,0x14)+'-'+_0x1f4f6b['substring'](0x14);}}; \ No newline at end of file +var _0x2e99=['getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','md5','substring','lodash','bimedia-machine-uuid','execSync','../environment','orderBy','keys','length','IPv4','internal','concat','head','mac','address','127.0.0.1'];(function(_0x2d4df1,_0x4e79ff){var _0x271953=function(_0x1b18eb){while(--_0x1b18eb){_0x2d4df1['push'](_0x2d4df1['shift']());}};_0x271953(++_0x4e79ff);}(_0x2e99,0x18a));var _0x92e9=function(_0x50f866,_0xa4b3b9){_0x50f866=_0x50f866-0x0;var _0x48e861=_0x2e99[_0x50f866];return _0x48e861;};'use strict';var _=require(_0x92e9('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x92e9('0x1'));var exec=require('child_process')[_0x92e9('0x2')];var config=require(_0x92e9('0x3'));function getInterfaces(){var _0x5aabf8=[];var _0xee6103=os['networkInterfaces']();var _0x19dad8=_[_0x92e9('0x4')](_[_0x92e9('0x5')](_0xee6103));for(var _0x219bd2=0x0;_0x219bd2<_0x19dad8[_0x92e9('0x6')];_0x219bd2++){var _0xf2fbc6=_0xee6103[_0x19dad8[_0x219bd2]]['filter'](function(_0x3f5005){return _0x3f5005['family']===_0x92e9('0x7')&&_0x3f5005[_0x92e9('0x8')]===![];});_0x5aabf8=_0x5aabf8[_0x92e9('0x9')](_0xf2fbc6);}return _0x5aabf8;}function getFirstInterface(){var _0x1c1d70=_[_0x92e9('0xa')](getInterfaces());return{'macAddress':_0x1c1d70&&_0x1c1d70['mac']?_0x1c1d70[_0x92e9('0xb')]:'00:00:00:00:00:00','ipAddress':_0x1c1d70&&_0x1c1d70[_0x92e9('0xc')]?_0x1c1d70['address']:_0x92e9('0xd')};}exports[_0x92e9('0xe')]=getFirstInterface;function getCPUhash(){var _0x10415f=_[_0x92e9('0x4')](os[_0x92e9('0xf')]()[_0x92e9('0x10')](function(_0x1152f5){return _0x1152f5[_0x92e9('0x11')];}))[_0x92e9('0x12')](':');return crypto[_0x92e9('0x13')]('md5')[_0x92e9('0x14')](_0x10415f)[_0x92e9('0x15')](_0x92e9('0x16'));}exports['getUuid']=function(){var _0x5d2f21=os[_0x92e9('0x17')]();var _0x132bde=/[0-9a-f-]{36}/;if(config[_0x92e9('0x18')]&&_0x132bde[_0x92e9('0x19')](config['licenseToken'])){return config[_0x92e9('0x18')];}else if(_0x5d2f21===_0x92e9('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x92e9('0x1b')})[_0x92e9('0x1c')]('\x0d\x0a','');}else{var _0x5c3a37=getFirstInterface();var _0x3f6085=getCPUhash();var _0x5703a9=_0x3f6085+'|'+os[_0x92e9('0x1d')]()+'|'+_0x5c3a37[_0x92e9('0x1e')]+'|'+_0x5c3a37[_0x92e9('0x1f')];var _0x13e421=crypto['createHash'](_0x92e9('0x20'))[_0x92e9('0x14')](_0x5703a9)[_0x92e9('0x15')](_0x92e9('0x16'));return _0x13e421[_0x92e9('0x21')](0x0,0x8)+'-'+_0x13e421[_0x92e9('0x21')](0x8,0xc)+'-'+_0x13e421[_0x92e9('0x21')](0xc,0x10)+'-'+_0x13e421[_0x92e9('0x21')](0x10,0x14)+'-'+_0x13e421[_0x92e9('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0cdc2d6..8a2e4a1 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 _0x742a=['default','util','moment','request-promise','bluebird','pkginfo','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','then','catch','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x59c2bb,_0xec103a){var _0x33cf88=function(_0x17f547){while(--_0x17f547){_0x59c2bb['push'](_0x59c2bb['shift']());}};_0x33cf88(++_0xec103a);}(_0x742a,0x19b));var _0xa742=function(_0x16c2e0,_0x3dc335){_0x16c2e0=_0x16c2e0-0x0;var _0x49b690=_0x742a[_0x16c2e0];return _0x49b690;};'use strict';var util=require(_0xa742('0x0'));var moment=require(_0xa742('0x1'));var rp=require(_0xa742('0x2'));var BPromise=require(_0xa742('0x3'));var pkginfo=require(_0xa742('0x4'))(module,_0xa742('0x5'));var db=require(_0xa742('0x6'))['db'];var encryptor=require(_0xa742('0x7'));var hardware=require(_0xa742('0x8'));var logger=require(_0xa742('0x9'))(_0xa742('0xa'));var HOST=_0xa742('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x45ce24){return new BPromise(function(_0x20afa7,_0x328bb0){var _0x298e33=util[_0xa742('0xc')](_0xa742('0xd'),HOST,_0x45ce24,module[_0xa742('0xe')][_0xa742('0x5')]);if(oldToken){_0x298e33=util[_0xa742('0xc')](_0xa742('0xf'),HOST,_0x45ce24,module[_0xa742('0xe')]['version'],oldToken);}var _0x27ab98={'uri':_0x298e33,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x27ab98)[_0xa742('0x10')](function(_0xc89b7){_0x20afa7(_0xc89b7);})[_0xa742('0x11')](function(_0x1de045){_0x328bb0(_0x1de045);});});}function manageLicense(_0x593105,_0x2a414e){var _0x81c828=_0x2a414e[_0xa742('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x81c828['data1']!==_0x593105&&!_0x81c828['data2']){oldToken=_0x81c828['data1'];}httpRequest(_0x593105)[_0xa742('0x10')](function(_0x1c2736){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1c2736['active']){isOldTokenSent=![];if(!_0x81c828['license']&&_0x81c828[_0xa742('0xa')]!=_0x1c2736[_0xa742('0xa')]||_0x81c828['license']&&_0x81c828[_0xa742('0x13')]){logger[_0xa742('0x14')](_0xa742('0x15'));}if(_0x81c828[_0xa742('0xa')]&&!_0x81c828['data2']&&_0x81c828['license']!=_0x1c2736[_0xa742('0xa')]){logger[_0xa742('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x81c828[_0xa742('0xa')]&&!_0x81c828['data2']&&_0x81c828[_0xa742('0xa')]==_0x1c2736[_0xa742('0xa')]){return _0x2a414e;}return _0x2a414e[_0xa742('0x16')]({'data1':_0x593105,'data2':null,'license':_0x1c2736['license']});}else{if(_0x1c2736[_0xa742('0xa')]||_0x81c828[_0xa742('0xa')]){if(!_0x81c828[_0xa742('0x13')]){if(_0x81c828[_0xa742('0x17')]==_0x593105){GRAY_PERIOD_REASON='Disabled';logger[_0xa742('0x14')](_0xa742('0x18'));}else{GRAY_PERIOD_REASON=_0xa742('0x19');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x81c828[_0xa742('0x17')],_0x593105);}logger[_0xa742('0x14')](_0xa742('0x1a'),GRAY_PERIOD_REASON[_0xa742('0x1b')](),moment()[_0xa742('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x2a414e[_0xa742('0x16')]({'data2':encryptor['encryptString'](moment()['format'](_0xa742('0x1c')))});}else{if(moment()[_0xa742('0x1d')](encryptor[_0xa742('0x1e')](_0x81c828[_0xa742('0x13')]),_0xa742('0x1f'))>DAYS){logger[_0xa742('0x14')](_0xa742('0x20'),moment()[_0xa742('0xc')](_0xa742('0x1c')));isOldTokenSent=![];return _0x2a414e[_0xa742('0x16')]({'data1':_0x593105,'data2':null,'license':null});}}}else{if(_0x81c828[_0xa742('0x17')]!=_0x593105){logger[_0xa742('0x14')](_0xa742('0x21'),_0x81c828[_0xa742('0x17')],_0x593105);return _0x2a414e['update']({'data1':_0x593105,'data2':null,'license':null});}}}return _0x2a414e;})[_0xa742('0x10')](function(_0x317fde){_0x2a414e=_0x317fde;})['catch'](function(_0x3844df){logger[_0xa742('0x22')](_0x3844df['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xa742('0x23')](),_0x2a414e);},TIME);});}function defaultLicense(){var _0x36cce5=hardware['getUuid']();if(_0x36cce5){return db[_0xa742('0x24')][_0xa742('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x36cce5}})[_0xa742('0x26')](function(_0x4da242,_0x5a9543){logger[_0xa742('0x14')](_0xa742('0x27'),_0x36cce5);manageLicense(_0x36cce5,_0x4da242);})[_0xa742('0x11')](function(_0x5f3c47){logger[_0xa742('0x22')](_0x5f3c47['message']);});}}exports[_0xa742('0x28')]=defaultLicense; \ No newline at end of file +var _0xcac7=['update','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x1da448,_0x565a9f){var _0xdb7a13=function(_0x48bfc7){while(--_0x48bfc7){_0x1da448['push'](_0x1da448['shift']());}};_0xdb7a13(++_0x565a9f);}(_0xcac7,0x19b));var _0x7cac=function(_0x529f30,_0x326845){_0x529f30=_0x529f30-0x0;var _0x2514bf=_0xcac7[_0x529f30];return _0x2514bf;};'use strict';var util=require('util');var moment=require(_0x7cac('0x0'));var rp=require(_0x7cac('0x1'));var BPromise=require(_0x7cac('0x2'));var pkginfo=require(_0x7cac('0x3'))(module,_0x7cac('0x4'));var db=require(_0x7cac('0x5'))['db'];var encryptor=require(_0x7cac('0x6'));var hardware=require('./hardware');var logger=require(_0x7cac('0x7'))(_0x7cac('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4592a0){return new BPromise(function(_0x21ca35,_0x2ed2fe){var _0x41adca=util[_0x7cac('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x4592a0,module[_0x7cac('0xa')][_0x7cac('0x4')]);if(oldToken){_0x41adca=util[_0x7cac('0x9')](_0x7cac('0xb'),HOST,_0x4592a0,module[_0x7cac('0xa')][_0x7cac('0x4')],oldToken);}var _0x3b8fe7={'uri':_0x41adca,'method':_0x7cac('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3b8fe7)[_0x7cac('0xd')](function(_0x13be0b){_0x21ca35(_0x13be0b);})['catch'](function(_0x277da8){_0x2ed2fe(_0x277da8);});});}function manageLicense(_0x367e91,_0xd7c14e){var _0x1b4053=_0xd7c14e[_0x7cac('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1b4053[_0x7cac('0xf')]!==_0x367e91&&!_0x1b4053[_0x7cac('0x10')]){oldToken=_0x1b4053[_0x7cac('0xf')];}httpRequest(_0x367e91)[_0x7cac('0xd')](function(_0x1ea87e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1ea87e[_0x7cac('0x11')]){isOldTokenSent=![];if(!_0x1b4053['license']&&_0x1b4053[_0x7cac('0x8')]!=_0x1ea87e[_0x7cac('0x8')]||_0x1b4053[_0x7cac('0x8')]&&_0x1b4053[_0x7cac('0x10')]){logger[_0x7cac('0x12')](_0x7cac('0x13'));}if(_0x1b4053[_0x7cac('0x8')]&&!_0x1b4053[_0x7cac('0x10')]&&_0x1b4053[_0x7cac('0x8')]!=_0x1ea87e[_0x7cac('0x8')]){logger[_0x7cac('0x12')](_0x7cac('0x14'));}if(_0x1b4053[_0x7cac('0x8')]&&!_0x1b4053[_0x7cac('0x10')]&&_0x1b4053[_0x7cac('0x8')]==_0x1ea87e[_0x7cac('0x8')]){return _0xd7c14e;}return _0xd7c14e[_0x7cac('0x15')]({'data1':_0x367e91,'data2':null,'license':_0x1ea87e[_0x7cac('0x8')]});}else{if(_0x1ea87e[_0x7cac('0x8')]||_0x1b4053[_0x7cac('0x8')]){if(!_0x1b4053[_0x7cac('0x10')]){if(_0x1b4053[_0x7cac('0xf')]==_0x367e91){GRAY_PERIOD_REASON='Disabled';logger[_0x7cac('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x7cac('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1b4053['data1'],_0x367e91);}logger[_0x7cac('0x12')](_0x7cac('0x16'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x7cac('0x9')](_0x7cac('0x17')));return _0xd7c14e[_0x7cac('0x15')]({'data2':encryptor[_0x7cac('0x18')](moment()[_0x7cac('0x9')](_0x7cac('0x17')))});}else{if(moment()[_0x7cac('0x19')](encryptor['decryptString'](_0x1b4053['data2']),_0x7cac('0x1a'))>DAYS){logger[_0x7cac('0x12')](_0x7cac('0x1b'),moment()['format'](_0x7cac('0x17')));isOldTokenSent=![];return _0xd7c14e[_0x7cac('0x15')]({'data1':_0x367e91,'data2':null,'license':null});}}}else{if(_0x1b4053[_0x7cac('0xf')]!=_0x367e91){logger[_0x7cac('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1b4053[_0x7cac('0xf')],_0x367e91);return _0xd7c14e['update']({'data1':_0x367e91,'data2':null,'license':null});}}}return _0xd7c14e;})[_0x7cac('0xd')](function(_0x479be5){_0xd7c14e=_0x479be5;})[_0x7cac('0x1c')](function(_0x55034b){logger[_0x7cac('0x1d')](_0x55034b[_0x7cac('0x1e')]);})[_0x7cac('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x7cac('0x20')](),_0xd7c14e);},TIME);});}function defaultLicense(){var _0x1db86c=hardware[_0x7cac('0x20')]();if(_0x1db86c){return db[_0x7cac('0x21')][_0x7cac('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x1db86c}})[_0x7cac('0x23')](function(_0x379315,_0x3d8e55){logger[_0x7cac('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1db86c);manageLicense(_0x1db86c,_0x379315);})[_0x7cac('0x1c')](function(_0x5522b2){logger[_0x7cac('0x1d')](_0x5522b2[_0x7cac('0x1e')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bb5aae3..385a95a 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 _0xa209=['%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','telephone','telephones','forEach','user','count','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','format'];(function(_0x5a7733,_0x3e8240){var _0xd72306=function(_0x233f31){while(--_0x233f31){_0x5a7733['push'](_0x5a7733['shift']());}};_0xd72306(++_0x3e8240);}(_0xa209,0xab));var _0x9a20=function(_0x2b981e,_0x3a9c55){_0x2b981e=_0x2b981e-0x0;var _0x4a80a2=_0xa209[_0x2b981e];return _0x4a80a2;};'use strict';var util=require(_0x9a20('0x0'));var _=require(_0x9a20('0x1'));var moment=require(_0x9a20('0x2'));var BPromise=require(_0x9a20('0x3'));var hardware=require(_0x9a20('0x4'));var encryptor=require(_0x9a20('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a20('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9a20('0x7'),'machineUuid':hardware[_0x9a20('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9a20('0x9'),'machineUuid':hardware[_0x9a20('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x20bf39){return new BPromise(function(_0x5b47ea,_0x3d6c8a){return db[_0x9a20('0xa')][_0x9a20('0xb')](_[_0x9a20('0xc')](_0x20bf39,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2063dc){return checkLicense(_0x2063dc,null);})[_0x9a20('0xd')](function(_0x4bc6c9){_0x5b47ea(_0x4bc6c9);return;})[_0x9a20('0xe')](function(_0x424291){_0x3d6c8a(_0x424291);});});}function checkLicense(_0x32963d,_0x4a0bc3){if(!_0x32963d){demoLicense['uuid']=_0x32963d[_0x9a20('0xf')];return demoLicense;}try{var _0x395a1f=_0x4a0bc3||_0x32963d[_0x9a20('0x10')];if(_['isEmpty'](_0x395a1f)){throw new Error(_0x9a20('0x11'));}var _0x1782cb=_0x32963d[_0x9a20('0xf')];var _0x1eda27=_0x32963d[_0x9a20('0x12')];var _0x351705=_0x1782cb[_0x9a20('0x13')]('-')[0x4];var _0x37b552=_0x1782cb[_0x9a20('0x13')]('-')[0x0];var _0x415c8b=encryptor['decryptString'](_0x395a1f,util[_0x9a20('0x14')](_0x9a20('0x15'),_0x351705,_0x1782cb,_0x37b552));var _0x3aa00c=JSON[_0x9a20('0x16')](_0x415c8b);_0x3aa00c[_0x9a20('0x17')]=![];_0x3aa00c[_0x9a20('0x18')]=_0x1782cb;_0x3aa00c[_0x9a20('0x19')]=hardware['getUuid']();if(_0x1eda27){var _0x49035e=encryptor[_0x9a20('0x1a')](_0x1eda27);_0x3aa00c['gray']=_0x49035e;_0x3aa00c[_0x9a20('0x1b')]=moment(_0x49035e)[_0x9a20('0x1c')](0x7,_0x9a20('0x1d'))[_0x9a20('0x14')]();_0x3aa00c['grayReason']=_0x3aa00c['uuid']!=_0x3aa00c[_0x9a20('0x19')]?_0x9a20('0x1e'):_0x9a20('0x1f');}return _0x3aa00c;}catch(_0x3371b9){breakingLicense[_0x9a20('0x18')]=_0x32963d[_0x9a20('0xf')];breakingLicense['message']=_0x3371b9[_0x9a20('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3cc189,_0x3af116){getLicense()[_0x9a20('0xd')](function(_0x228710){return db[_0x9a20('0x21')][_0x9a20('0x22')]({'attributes':[_0x9a20('0x23'),[db[_0x9a20('0x24')]['fn'](_0x9a20('0x25'),db[_0x9a20('0x24')][_0x9a20('0x26')](_0x9a20('0x23'))),'count']],'group':_0x9a20('0x23'),'where':{'role':{'$or':[_0x9a20('0x27'),'user',_0x9a20('0x28')]}},'raw':!![]})['then'](function(_0x63cfc5){var _0x511da9={'user':_0x228710['users']||0x0,'telephone':_0x228710[_0x9a20('0x29')]||0x0};_0x63cfc5[_0x9a20('0x2a')](function(_0x5bf646){var _0x30e343=_0x5bf646[_0x9a20('0x23')]==='admin'?_0x9a20('0x2b'):_0x5bf646['role'];_0x511da9[_0x30e343]-=_0x5bf646[_0x9a20('0x2c')];if(_0x511da9[_0x30e343]<0x0)_0x511da9[_0x30e343]=0x0;});_0x3cc189(_0x511da9);return;});})[_0x9a20('0xe')](function(_0x5c4574){_0x3af116(_0x5c4574);});});}function checkUserLimits(_0x13f0a){return new BPromise(function(_0x5b5fdd,_0xeb6a67){getLimits()['then'](function(_0x4b8b0e){var _0x4e9418=_['pick'](_['countBy'](_0x13f0a,'role'),[_0x9a20('0x27'),'user',_0x9a20('0x28')]);var _0x7244e4=(_0x4e9418['admin']||0x0)+(_0x4e9418[_0x9a20('0x2b')]||0x0);var _0x3cec25=_0x4e9418[_0x9a20('0x28')]||0x0;if(_0x7244e4>_0x4b8b0e[_0x9a20('0x2b')])return _0xeb6a67(_0x9a20('0x2d'));if(_0x3cec25>_0x4b8b0e[_0x9a20('0x28')])return _0xeb6a67(_0x9a20('0x2e'));return _0x5b5fdd();})[_0x9a20('0xe')](function(_0x2abb53){_0xeb6a67(_0x2abb53);});});}module[_0x9a20('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x728b=['Demo\x20license','getUuid','License','find','then','catch','uuid','data1','License\x20key\x20value\x20not\x20found','split','format','parse','demo','gray','deadline','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x47a002,_0x4427ad){var _0x422a31=function(_0x2ba352){while(--_0x2ba352){_0x47a002['push'](_0x47a002['shift']());}};_0x422a31(++_0x4427ad);}(_0x728b,0xfc));var _0xb728=function(_0x304e87,_0x39f801){_0x304e87=_0x304e87-0x0;var _0x2f5650=_0x728b[_0x304e87];return _0x2f5650;};'use strict';var util=require(_0xb728('0x0'));var _=require(_0xb728('0x1'));var moment=require(_0xb728('0x2'));var BPromise=require('bluebird');var hardware=require(_0xb728('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xb728('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb728('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb728('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb728('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xb728('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xb8762d){return new BPromise(function(_0x23150e,_0x4b60f3){return db[_0xb728('0x8')][_0xb728('0x9')](_['defaults'](_0xb8762d,{'raw':!![],'where':{'id':0x1}}))[_0xb728('0xa')](function(_0x596a4f){return checkLicense(_0x596a4f,null);})[_0xb728('0xa')](function(_0x3ecdc3){_0x23150e(_0x3ecdc3);return;})[_0xb728('0xb')](function(_0x35d412){_0x4b60f3(_0x35d412);});});}function checkLicense(_0x1b7cb2,_0x6ccca8){if(!_0x1b7cb2){demoLicense[_0xb728('0xc')]=_0x1b7cb2[_0xb728('0xd')];return demoLicense;}try{var _0x566f8a=_0x6ccca8||_0x1b7cb2['license'];if(_['isEmpty'](_0x566f8a)){throw new Error(_0xb728('0xe'));}var _0x17eadf=_0x1b7cb2[_0xb728('0xd')];var _0x50b3cc=_0x1b7cb2['data2'];var _0x7e4c46=_0x17eadf['split']('-')[0x4];var _0x436198=_0x17eadf[_0xb728('0xf')]('-')[0x0];var _0x131f1e=encryptor['decryptString'](_0x566f8a,util[_0xb728('0x10')]('%s:%s:%s',_0x7e4c46,_0x17eadf,_0x436198));var _0x48dd1c=JSON[_0xb728('0x11')](_0x131f1e);_0x48dd1c[_0xb728('0x12')]=![];_0x48dd1c[_0xb728('0xc')]=_0x17eadf;_0x48dd1c['machineUuid']=hardware[_0xb728('0x7')]();if(_0x50b3cc){var _0xd47e04=encryptor['decryptString'](_0x50b3cc);_0x48dd1c[_0xb728('0x13')]=_0xd47e04;_0x48dd1c[_0xb728('0x14')]=moment(_0xd47e04)['add'](0x7,'days')[_0xb728('0x10')]();_0x48dd1c[_0xb728('0x15')]=_0x48dd1c[_0xb728('0xc')]!=_0x48dd1c[_0xb728('0x16')]?_0xb728('0x17'):_0xb728('0x18');}return _0x48dd1c;}catch(_0x4c0bf6){breakingLicense[_0xb728('0xc')]=_0x1b7cb2[_0xb728('0xd')];breakingLicense[_0xb728('0x19')]=_0x4c0bf6['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4d9b5e,_0x112e30){getLicense()[_0xb728('0xa')](function(_0xfe577d){return db[_0xb728('0x1a')][_0xb728('0x1b')]({'attributes':[_0xb728('0x1c'),[db[_0xb728('0x1d')]['fn'](_0xb728('0x1e'),db[_0xb728('0x1d')][_0xb728('0x1f')]('role')),_0xb728('0x20')]],'group':'role','where':{'role':{'$or':[_0xb728('0x21'),'user',_0xb728('0x22')]}},'raw':!![]})['then'](function(_0x207303){var _0x3d26c8={'user':_0xfe577d[_0xb728('0x23')]||0x0,'telephone':_0xfe577d[_0xb728('0x24')]||0x0};_0x207303[_0xb728('0x25')](function(_0x53dca1){var _0x5678f6=_0x53dca1[_0xb728('0x1c')]==='admin'?_0xb728('0x26'):_0x53dca1[_0xb728('0x1c')];_0x3d26c8[_0x5678f6]-=_0x53dca1[_0xb728('0x20')];if(_0x3d26c8[_0x5678f6]<0x0)_0x3d26c8[_0x5678f6]=0x0;});_0x4d9b5e(_0x3d26c8);return;});})[_0xb728('0xb')](function(_0x5110c9){_0x112e30(_0x5110c9);});});}function checkUserLimits(_0x1d46b5){return new BPromise(function(_0x4d99ce,_0x931178){getLimits()[_0xb728('0xa')](function(_0x5d94d4){var _0xb2a0cd=_[_0xb728('0x27')](_[_0xb728('0x28')](_0x1d46b5,_0xb728('0x1c')),['admin',_0xb728('0x26'),'telephone']);var _0x4ad374=(_0xb2a0cd[_0xb728('0x21')]||0x0)+(_0xb2a0cd[_0xb728('0x26')]||0x0);var _0xcba848=_0xb2a0cd['telephone']||0x0;if(_0x4ad374>_0x5d94d4[_0xb728('0x26')])return _0x931178(_0xb728('0x29'));if(_0xcba848>_0x5d94d4['telephone'])return _0x931178('License\x20limit\x20reached\x20for\x20telephones');return _0x4d99ce();})['catch'](function(_0x2de47e){_0x931178(_0x2de47e);});});}module[_0xb728('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 eb0eb86..64b3c0e 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 _0x0598=['http://localhost:9000','app-id','exports'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x0598,0x92));var _0x8059=function(_0x2b0f2d,_0x51342d){_0x2b0f2d=_0x2b0f2d-0x0;var _0x38d24f=_0x0598[_0x2b0f2d];return _0x38d24f;};'use strict';module[_0x8059('0x0')]={'DOMAIN':_0x8059('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8059('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x7708=['http://localhost:9000','app-id','exports'];(function(_0x57ed97,_0x1a4458){var _0x54788a=function(_0x542bce){while(--_0x542bce){_0x57ed97['push'](_0x57ed97['shift']());}};_0x54788a(++_0x1a4458);}(_0x7708,0x188));var _0x8770=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7708[_0x55f8b4];return _0x2475f9;};'use strict';module[_0x8770('0x0')]={'DOMAIN':_0x8770('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8770('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 72d1211..e7895d8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaef=['fileLogger','exports'];(function(_0x156367,_0x5d745f){var _0x2efd96=function(_0x2d9805){while(--_0x2d9805){_0x156367['push'](_0x156367['shift']());}};_0x2efd96(++_0x5d745f);}(_0xcaef,0x94));var _0xfcae=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xcaef[_0x32b542];return _0x554d54;};'use strict';var fileLogger=require('../utils/loggers')[_0xfcae('0x0')];module[_0xfcae('0x1')]=fileLogger; \ No newline at end of file +var _0x75a2=['fileLogger','../utils/loggers'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x75a2,0xf1));var _0x275a=function(_0xd0f9f4,_0xe74790){_0xd0f9f4=_0xd0f9f4-0x0;var _0x444782=_0x75a2[_0xd0f9f4];return _0x444782;};'use strict';var fileLogger=require(_0x275a('0x0'))[_0x275a('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7e5bb03..bf3e516 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 _0x16cb=['../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x4170d8,_0x49f2b5){var _0x7a7276=function(_0x1976f4){while(--_0x1976f4){_0x4170d8['push'](_0x4170d8['shift']());}};_0x7a7276(++_0x49f2b5);}(_0x16cb,0x163));var _0xb16c=function(_0x1d0ce7,_0x5938f1){_0x1d0ce7=_0x1d0ce7-0x0;var _0x27d94d=_0x16cb[_0x1d0ce7];return _0x27d94d;};'use strict';var path=require(_0xb16c('0x0'));var os=require('os');var config={'apps':[{'name':_0xb16c('0x1'),'script':path[_0xb16c('0x2')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xb16c('0x2')](__dirname,_0xb16c('0x3'))},{'name':_0xb16c('0x4'),'script':path[_0xb16c('0x2')](__dirname,_0xb16c('0x5'))},{'name':_0xb16c('0x6'),'script':path[_0xb16c('0x2')](__dirname,_0xb16c('0x7'))},{'name':'routing','script':path['join'](__dirname,_0xb16c('0x8'))},{'name':_0xb16c('0x9'),'script':path[_0xb16c('0x2')](__dirname,_0xb16c('0xa'))}]};module['exports']=config; \ No newline at end of file +var _0x365c=['../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x52b397,_0x1a5fda){var _0x1f5c02=function(_0x3196f9){while(--_0x3196f9){_0x52b397['push'](_0x52b397['shift']());}};_0x1f5c02(++_0x1a5fda);}(_0x365c,0xc6));var _0xc365=function(_0xdcbf1c,_0x438874){_0xdcbf1c=_0xdcbf1c-0x0;var _0x57116e=_0x365c[_0xdcbf1c];return _0x57116e;};'use strict';var path=require(_0xc365('0x0'));var os=require('os');var config={'apps':[{'name':_0xc365('0x1'),'script':path[_0xc365('0x2')](__dirname,_0xc365('0x3'))},{'name':'ami','script':path[_0xc365('0x2')](__dirname,_0xc365('0x4'))},{'name':_0xc365('0x5'),'script':path['join'](__dirname,_0xc365('0x6'))},{'name':_0xc365('0x7'),'script':path['join'](__dirname,_0xc365('0x8'))},{'name':_0xc365('0x9'),'script':path[_0xc365('0x2')](__dirname,_0xc365('0xa'))},{'name':_0xc365('0xb'),'script':path[_0xc365('0x2')](__dirname,_0xc365('0xc'))}]};module[_0xc365('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ce2df69..e5f7270 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 _0x3b48=['dump','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x3b48,0x15f));var _0x83b4=function(_0x4ab8d2,_0x2446b5){_0x4ab8d2=_0x4ab8d2-0x0;var _0x1bcdca=_0x3b48[_0x4ab8d2];return _0x1bcdca;};'use strict';var pm2=require(_0x83b4('0x0'));var BPromise=require(_0x83b4('0x1'));var config=require(_0x83b4('0x2'));function connect(){return new BPromise(function(_0x5d4d7b,_0x36c67a){return pm2[_0x83b4('0x3')](function(_0x59ba29){if(_0x59ba29){return _0x36c67a(_0x59ba29);}return _0x5d4d7b(_0x83b4('0x4'));});});};exports['start']=function(_0x3e98f0){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0x2d8a60,_0x3b91e0){return pm2[_0x83b4('0x6')](_0x3e98f0,function(_0x5ecd3e,_0x48537d){if(_0x5ecd3e){return _0x3b91e0(_0x5ecd3e);}pm2[_0x83b4('0x7')]();return _0x2d8a60(_0x48537d);});});});};exports['stop']=function(_0x2f5bbf){return connect()['then'](function(){return new BPromise(function(_0xab19ef,_0x3feb09){return pm2[_0x83b4('0x8')](_0x2f5bbf,function(_0x310029,_0x361bfe){if(_0x310029){return _0x3feb09(_0x310029);}pm2[_0x83b4('0x7')]();return _0xab19ef(_0x361bfe);});});});};exports[_0x83b4('0x9')]=function(_0x3ab91f){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0x2e5bb8,_0x286ca2){return pm2[_0x83b4('0x9')](_0x3ab91f,function(_0xd751b9,_0x4ccca8){if(_0xd751b9){return _0x286ca2(_0xd751b9);}pm2['disconnect']();return _0x2e5bb8(_0x4ccca8);});});});};exports[_0x83b4('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x46d101,_0xea3c83){return pm2[_0x83b4('0xa')](function(_0x2b59f,_0xe713e6){if(_0x2b59f){return _0xea3c83(_0x2b59f);}pm2[_0x83b4('0x7')]();return _0x46d101(_0xe713e6);});});});};exports[_0x83b4('0xb')]=function(_0x8dc22e){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0x1cf3eb,_0x38cc73){return pm2['describe'](_0x8dc22e,function(_0x4c5810,_0x358b53){if(_0x4c5810){return _0x38cc73(_0x4c5810);}pm2[_0x83b4('0x7')]();return _0x1cf3eb(_0x358b53);});});});};exports[_0x83b4('0xc')]=function(_0x229aee){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0xb45758,_0x34af81){return pm2[_0x83b4('0xc')](_0x229aee,function(_0x2fe4a7,_0x40eeec){if(_0x2fe4a7){return _0x34af81(_0x2fe4a7);}pm2[_0x83b4('0x7')]();return _0xb45758(_0x40eeec);});});});};exports[_0x83b4('0xd')]=function(){return connect()[_0x83b4('0x5')](function(){return new BPromise(function(_0xd46322,_0x425134){return pm2['dump'](function(_0x35db15){if(_0x35db15){return _0x425134(_0x35db15);}return _0xd46322('saved');});});});}; \ No newline at end of file +var _0x12fe=['list','describe','delete','dump','bluebird','connect','connected','then','start','disconnect','restart'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12fe,0x1e8));var _0xe12f=function(_0x495500,_0x3c6de2){_0x495500=_0x495500-0x0;var _0x5625dc=_0x12fe[_0x495500];return _0x5625dc;};'use strict';var pm2=require('pm2');var BPromise=require(_0xe12f('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0xe1009e,_0x43e0c1){return pm2[_0xe12f('0x1')](function(_0x14ac20){if(_0x14ac20){return _0x43e0c1(_0x14ac20);}return _0xe1009e(_0xe12f('0x2'));});});};exports['start']=function(_0x2d62fd){return connect()[_0xe12f('0x3')](function(){return new BPromise(function(_0x4aad75,_0x20cdbb){return pm2[_0xe12f('0x4')](_0x2d62fd,function(_0x349fde,_0x319865){if(_0x349fde){return _0x20cdbb(_0x349fde);}pm2['disconnect']();return _0x4aad75(_0x319865);});});});};exports['stop']=function(_0x20fc41){return connect()['then'](function(){return new BPromise(function(_0x3648f3,_0x82e98a){return pm2['stop'](_0x20fc41,function(_0x56ffe7,_0x3dcd57){if(_0x56ffe7){return _0x82e98a(_0x56ffe7);}pm2[_0xe12f('0x5')]();return _0x3648f3(_0x3dcd57);});});});};exports[_0xe12f('0x6')]=function(_0x17a0f0){return connect()[_0xe12f('0x3')](function(){return new BPromise(function(_0x4ac479,_0x569203){return pm2[_0xe12f('0x6')](_0x17a0f0,function(_0x206fba,_0x56708c){if(_0x206fba){return _0x569203(_0x206fba);}pm2[_0xe12f('0x5')]();return _0x4ac479(_0x56708c);});});});};exports[_0xe12f('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x20d51d,_0xad1e05){return pm2[_0xe12f('0x7')](function(_0x11f06b,_0x184ec3){if(_0x11f06b){return _0xad1e05(_0x11f06b);}pm2[_0xe12f('0x5')]();return _0x20d51d(_0x184ec3);});});});};exports[_0xe12f('0x8')]=function(_0x3c4981){return connect()[_0xe12f('0x3')](function(){return new BPromise(function(_0x652b2e,_0x5cff0e){return pm2[_0xe12f('0x8')](_0x3c4981,function(_0x15df7a,_0x1bf2e0){if(_0x15df7a){return _0x5cff0e(_0x15df7a);}pm2[_0xe12f('0x5')]();return _0x652b2e(_0x1bf2e0);});});});};exports[_0xe12f('0x9')]=function(_0x1f27db){return connect()[_0xe12f('0x3')](function(){return new BPromise(function(_0x5b493f,_0x589415){return pm2[_0xe12f('0x9')](_0x1f27db,function(_0x44281b,_0x58cb93){if(_0x44281b){return _0x589415(_0x44281b);}pm2['disconnect']();return _0x5b493f(_0x58cb93);});});});};exports[_0xe12f('0xa')]=function(){return connect()[_0xe12f('0x3')](function(){return new BPromise(function(_0x5f5760,_0x1f0d80){return pm2[_0xe12f('0xa')](function(_0x5c3339){if(_0x5c3339){return _0x1f0d80(_0x5c3339);}return _0x5f5760('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a27c987..5b5a562 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 _0xbf9a=['chatTimeout','findAll','minutes','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find'];(function(_0x428132,_0x58ecc1){var _0x140eae=function(_0x333d61){while(--_0x333d61){_0x428132['push'](_0x428132['shift']());}};_0x140eae(++_0x58ecc1);}(_0xbf9a,0xbf));var _0xabf9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xbf9a[_0x2ff762];return _0x158b02;};'use strict';var _=require(_0xabf9('0x0'));var moment=require(_0xabf9('0x1'));var Redis=require(_0xabf9('0x2'));var util=require(_0xabf9('0x3'));var config=require(_0xabf9('0x4'));var db=require(_0xabf9('0x5'))['db'];var logger=require(_0xabf9('0x6'))(_0xabf9('0x7'));config[_0xabf9('0x8')]=_[_0xabf9('0x9')](config[_0xabf9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xabf9('0xa'))(new Redis(config[_0xabf9('0x8')]));function closeInteractions(){var _0x527ad4=0x0;var _0x3f6ed6=[];return db[_0xabf9('0xb')][_0xabf9('0xc')]({'raw':!![],'attributes':['id',_0xabf9('0xd')],'where':{'id':0x1}})['then'](function(_0x2c880e){_0x527ad4=_0x2c880e[_0xabf9('0xd')];if(_0x527ad4){return db['ChatInteraction'][_0xabf9('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2c880e['chatTimeout'],_0xabf9('0xf'))}}});}else{return[];}})[_0xabf9('0x10')](function(_0x29d307){if(_0x29d307&&_0x29d307['length']){_0x3f6ed6=_[_0xabf9('0x11')](_0x29d307||[],'id');logger[_0xabf9('0x12')](_0xabf9('0x13'),_0x3f6ed6[_0xabf9('0x14')]());return db[_0xabf9('0x15')][_0xabf9('0x16')]({'closeReason':_0xabf9('0x17'),'disposition':_0xabf9('0x18'),'closed':!![],'closedAt':moment()[_0xabf9('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3f6ed6}});}})[_0xabf9('0x10')](function(){if(_0x3f6ed6&&_0x3f6ed6['length']){logger['info'](_0xabf9('0x1a'),_0x3f6ed6[_0xabf9('0x14')]());for(var _0xde2e1c=0x0;_0xde2e1c<_0x3f6ed6[_0xabf9('0x1b')];_0xde2e1c++){io[_0xabf9('0x1c')]('chatInteraction:update',{'id':_0x3f6ed6[_0xde2e1c],'closed':!![]});}}})[_0xabf9('0x1d')](function(_0x3ab1f2){logger[_0xabf9('0x1e')](_0xabf9('0x1f'),_0x3ab1f2?util[_0xabf9('0x20')](_0x3ab1f2,{'showHidden':![],'depth':null}):'');});}exports[_0xabf9('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdab0=['start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','localhost','socket.io-emitter','redis','Setting','find','chatTimeout','findAll','lastMsgAt','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss','join','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xdab0,0x1c1));var _0x0dab=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xdab0[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x0dab('0x0'));var moment=require('moment');var Redis=require(_0x0dab('0x1'));var util=require(_0x0dab('0x2'));var config=require(_0x0dab('0x3'));var db=require(_0x0dab('0x4'))['db'];var logger=require(_0x0dab('0x5'))('schedule');config['redis']=_[_0x0dab('0x6')](config['redis'],{'host':_0x0dab('0x7'),'port':0x18eb});var io=require(_0x0dab('0x8'))(new Redis(config[_0x0dab('0x9')]));function closeInteractions(){var _0x1166f3=0x0;var _0x55816f=[];return db[_0x0dab('0xa')][_0x0dab('0xb')]({'raw':!![],'attributes':['id',_0x0dab('0xc')],'where':{'id':0x1}})['then'](function(_0x4f970f){_0x1166f3=_0x4f970f[_0x0dab('0xc')];if(_0x1166f3){return db['ChatInteraction'][_0x0dab('0xd')]({'raw':!![],'attributes':['id',_0x0dab('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4f970f['chatTimeout'],_0x0dab('0xf'))}}});}else{return[];}})[_0x0dab('0x10')](function(_0x5361d8){if(_0x5361d8&&_0x5361d8[_0x0dab('0x11')]){_0x55816f=_[_0x0dab('0x12')](_0x5361d8||[],'id');logger[_0x0dab('0x13')](_0x0dab('0x14'),_0x55816f['join']());return db['ChatInteraction'][_0x0dab('0x15')]({'closeReason':_0x0dab('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x0dab('0x17')](_0x0dab('0x18'))},{'where':{'id':_0x55816f}});}})[_0x0dab('0x10')](function(){if(_0x55816f&&_0x55816f[_0x0dab('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x55816f[_0x0dab('0x19')]());for(var _0x4d5467=0x0;_0x4d5467<_0x55816f[_0x0dab('0x11')];_0x4d5467++){io['emit'](_0x0dab('0x1a'),{'id':_0x55816f[_0x4d5467],'closed':!![]});}}})[_0x0dab('0x1b')](function(_0x36077f){logger[_0x0dab('0x1c')](_0x0dab('0x1d'),_0x36077f?util[_0x0dab('0x1e')](_0x36077f,{'showHidden':![],'depth':null}):'');});}exports[_0x0dab('0x1f')]=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 ff07ccf..0c00854 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 _0xec0a=['exports','startAllRefreshIntervals'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xec0a,0x169));var _0xaec0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xec0a[_0x1facfa];return _0x9ec701;};'use strict';function start(){var _0x430ddb=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x430ddb[_0xaec0('0x0')]();}module[_0xaec0('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf3ce=['exports'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xf3ce,0x121));var _0xef3c=function(_0x3f2146,_0x4e86a4){_0x3f2146=_0x3f2146-0x0;var _0xc33e7d=_0xf3ce[_0x3f2146];return _0xc33e7d;};'use strict';function start(){var _0x30339d=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x30339d['startAllRefreshIntervals']();}module[_0xef3c('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 2403395..1beef0f 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 _0x3997=['bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','savename','format','%s.%s','extname','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','difference','intersection','length','exists','stop','delete\x20cron','toRun','toString','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','deleteJob','stop\x20cron','run','path','moment','cron-job-manager','jayson/promise'];(function(_0x129046,_0x519448){var _0x4d06d9=function(_0x425c26){while(--_0x425c26){_0x129046['push'](_0x129046['shift']());}};_0x4d06d9(++_0x519448);}(_0x3997,0xef));var _0x7399=function(_0x1af790,_0x720c04){_0x1af790=_0x1af790-0x0;var _0x2aad1e=_0x3997[_0x1af790];return _0x2aad1e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x7399('0x0'));var _=require('lodash');var moment=require(_0x7399('0x1'));var CronJobManager=require(_0x7399('0x2'));var jayson=require(_0x7399('0x3'));var BPromise=require(_0x7399('0x4'));var logger=require(_0x7399('0x5'))(_0x7399('0x6'));var db=require(_0x7399('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x7399('0x8'));var client=jayson[_0x7399('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5d784d,_0x382d39){return function(){logger['info'](_0x7399('0xa'),_0x5d784d[_0x7399('0xb')]);var _0x387c8f=!![];var _0x33d5f1=_0x5d784d[_0x7399('0xc')][_0x7399('0xd')]();var _0x3bf4d3={'account':_0x33d5f1,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5d784d[_0x7399('0xc')][_0x7399('0xe')],_0x5d784d[_0x7399('0xc')][_0x7399('0xb')]||_0x5d784d['MailAccount'][_0x7399('0xf')][_0x7399('0x10')]),'to':_0x5d784d[_0x7399('0xb')],'cc':_0x5d784d['cc'],'bcc':_0x5d784d['bcc'],'subject':util['format'](_0x7399('0x11'),_0x382d39[_0x7399('0xe')],_0x5d784d['subtractNumber'],_0x5d784d[_0x7399('0x12')])}};var _0xb03eed=path['join'](__dirname,'../../files/reports');var _0x31bb71=_0x382d39[_0x7399('0x13')];var _0x4ec85c=util[_0x7399('0x14')](_0x7399('0x15'),path['basename'](_0x382d39['savename'],path[_0x7399('0x16')](_0x382d39['savename'])),_0x7399('0x17'));var _0x3efb73=path[_0x7399('0x18')](_0xb03eed,_0x31bb71);var _0x4e79e9=path['join'](_0xb03eed,_0x4ec85c);if(fs[_0x7399('0x19')](_0x3efb73)){_0x382d39[_0x7399('0x1a')]=_0x7399('0x1b');_0x3bf4d3[_0x7399('0x1c')][_0x7399('0x1d')]=[{'filename':_0x31bb71,'path':_0x3efb73}];_0x3bf4d3[_0x7399('0x1c')]['text']=util[_0x7399('0x14')](_0x7399('0x1e'),JSON[_0x7399('0x1f')](_0x382d39,null,0x2));}else if(fs['existsSync'](_0x4e79e9)){_0x382d39['status']=_0x7399('0x1b');_0x3bf4d3['message']['attachments']=[{'filename':_0x4ec85c,'path':_0x4e79e9}];}else{_0x3bf4d3[_0x7399('0x1c')][_0x7399('0x20')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5d784d[_0x7399('0x21')]){_0x387c8f=![];logger[_0x7399('0x22')](_0x7399('0x23'));}}if(_0x387c8f){return client[_0x7399('0x24')]('SendMail',_0x3bf4d3)[_0x7399('0x25')](function(_0x53b649){if(_0x53b649[_0x7399('0x26')]){return logger[_0x7399('0x26')](_0x7399('0x27'),JSON[_0x7399('0x1f')](_0x53b649));}return logger[_0x7399('0x22')](_0x7399('0x28'));})['catch'](function(_0x43ed6c){return logger[_0x7399('0x26')]('error\x20mail',JSON[_0x7399('0x1f')](_0x43ed6c));});}};}function handleError(){return function(_0x2bd12f){return logger[_0x7399('0x26')](JSON[_0x7399('0x1f')](_0x2bd12f));};}function handleResult(_0x1c958c){return function(_0x319cc5){logger[_0x7399('0x22')](_0x7399('0x29'),JSON[_0x7399('0x1f')](_0x319cc5));if(_0x1c958c['MailAccount']&&_0x1c958c[_0x7399('0xc')][_0x7399('0xf')]&&!_['isNil'](_0x1c958c[_0x7399('0xb')])){setTimeout(handleSendEmail(_0x1c958c,_0x319cc5),0x3c*0x3e8);}};}function handleJob(_0x1c2d5c){return function(){try{if(_[_0x7399('0x2a')](_0x1c2d5c['subtractNumber'])){return logger[_0x7399('0x22')](_0x7399('0x2b'));}if(_[_0x7399('0x2a')](_0x1c2d5c[_0x7399('0x12')])){return logger[_0x7399('0x22')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3872c9={'startDate':moment()[_0x7399('0x2c')](_0x1c2d5c['subtractNumber'],_0x1c2d5c['subtractUnit'])['format'](_0x7399('0x2d')),'endDate':moment()[_0x7399('0x14')](_0x7399('0x2d')),'type':_0x7399('0x2e'),'output':_0x1c2d5c[_0x7399('0x2f')],'name':_0x1c2d5c[_0x7399('0xe')]};if(!_['isNil'](_0x1c2d5c[_0x7399('0x30')])){logger[_0x7399('0x22')](_0x7399('0x31'),_0x1c2d5c[_0x7399('0x30')]);return analyticDefaultReportController[_0x7399('0x32')]({'id':_0x1c2d5c[_0x7399('0x30')]},_0x3872c9)[_0x7399('0x25')](handleResult(_0x1c2d5c))[_0x7399('0x33')](handleError());}if(!_[_0x7399('0x2a')](_0x1c2d5c['CustomReportId'])){logger[_0x7399('0x22')](_0x7399('0x34'),_0x1c2d5c[_0x7399('0x35')]);return analyticCustomReportController[_0x7399('0x32')]({'id':_0x1c2d5c[_0x7399('0x35')]},_0x3872c9)[_0x7399('0x25')](handleResult(_0x1c2d5c))['catch'](handleError());}}catch(_0x2db367){logger[_0x7399('0x26')](JSON[_0x7399('0x1f')](_0x2db367));}return logger[_0x7399('0x22')](_0x7399('0x36'));};}function getJobs(_0x539653){var _0x348905={};if(_0x539653){_0x348905['id']=_0x539653;}return db['Schedule'][_0x7399('0x37')]({'where':_0x348905,'include':[{'model':db[_0x7399('0xc')],'attributes':['id','name',_0x7399('0xb')],'include':[{'model':db[_0x7399('0x38')],'as':_0x7399('0xf'),'include':[{'model':db[_0x7399('0x39')],'as':_0x7399('0x39')}]}]}]})[_0x7399('0x25')](function(_0x5654f5){var _0x42b4f6=_[_0x7399('0x3a')](manager[_0x7399('0x3b')]);var _0x53f59e=_[_0x7399('0x3c')](_0x5654f5,function(_0x49f56e){return _0x49f56e['id']['toString']();});var _0x33ece2=_['keyBy'](_0x5654f5,function(_0x4b5732){return _0x4b5732['id']['toString']();});var _0x33008c=_0x539653?_0x53f59e:_[_0x7399('0x3d')](_0x53f59e,_0x42b4f6);var _0x4358cc=_[_0x7399('0x3e')](_0x53f59e,_0x42b4f6);var _0x4bc476=_['difference'](_0x42b4f6,_0x53f59e);var _0x1437ce;var _0x164c64;for(_0x1437ce=0x0;_0x1437ce<_0x4bc476[_0x7399('0x3f')]&&!_0x539653;_0x1437ce+=0x1){_0x164c64=_0x4bc476[_0x1437ce]['toString']();if(manager[_0x7399('0x40')](_0x164c64)){manager[_0x7399('0x41')](_0x164c64);manager['deleteJob'](_0x164c64);logger[_0x7399('0x22')](_0x7399('0x42'),_0x164c64);}}logger[_0x7399('0x22')](_0x7399('0x43'),JSON['stringify'](_0x33008c));for(_0x1437ce=0x0;_0x1437ce<_0x33008c[_0x7399('0x3f')];_0x1437ce+=0x1){_0x164c64=_0x33008c[_0x1437ce][_0x7399('0x44')]();logger[_0x7399('0x22')](_0x7399('0x45'),_0x164c64);if(_0x539653){logger['info']('my\x20id',_0x539653);logger['info'](JSON['stringify'](_0x33ece2[_0x164c64]));BPromise[_0x7399('0x46')]()[_0x7399('0x25')](handleJob(_0x33ece2[_0x164c64]));logger[_0x7399('0x22')](_0x7399('0x47'),_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64][_0x7399('0x48')]);}else if(_0x33ece2[_0x164c64][_0x7399('0x48')]&&_0x33ece2[_0x164c64][_0x7399('0x49')]&&moment()[_0x7399('0x4a')](_0x33ece2[_0x164c64][_0x7399('0x4b')],_0x33ece2[_0x164c64][_0x7399('0x4c')])){manager['add'](_0x164c64,_0x33ece2[_0x164c64][_0x7399('0x48')],handleJob(_0x33ece2[_0x164c64]));manager[_0x7399('0x4d')](_0x164c64);logger[_0x7399('0x22')]('add\x20cron',_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64][_0x7399('0x48')]);}else if(manager['exists'](_0x164c64)){manager[_0x7399('0x41')](_0x164c64);manager[_0x7399('0x4e')](_0x164c64);logger[_0x7399('0x22')](_0x7399('0x4f'),_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64]['cron']);}}for(_0x1437ce=0x0,_0x164c64;_0x1437ce<_0x4358cc[_0x7399('0x3f')]&&!_0x539653;_0x1437ce+=0x1){_0x164c64=_0x4358cc[_0x1437ce][_0x7399('0x44')]();if(manager['exists'](_0x164c64)){if(_0x33ece2[_0x164c64][_0x7399('0x48')]&&_0x33ece2[_0x164c64][_0x7399('0x49')]&&moment()['isBetween'](_0x33ece2[_0x164c64]['startAt'],_0x33ece2[_0x164c64][_0x7399('0x4c')])){manager['update'](_0x164c64,_0x33ece2[_0x164c64][_0x7399('0x48')],handleJob(_0x33ece2[_0x164c64]));logger[_0x7399('0x22')]('update\x20cron',_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64][_0x7399('0x48')]);}else{manager[_0x7399('0x41')](_0x164c64);manager['deleteJob'](_0x164c64);logger[_0x7399('0x22')](_0x7399('0x4f'),_0x33ece2[_0x164c64][_0x7399('0xe')],_0x33ece2[_0x164c64]['cron']);}}}})[_0x7399('0x33')](function(_0x2d9f54){logger['error'](JSON['stringify'](_0x2d9f54));});}exports[_0x7399('0x50')]=function(_0x36c0fc){return getJobs(_0x36c0fc);};exports[_0x7399('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1d44=['Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','stringify','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','intersection','exists','stop','delete\x20cron','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','deleteJob','stop\x20cron','update','run','start','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','MailAccount','Smtp','user','email'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0x1d44,0x95));var _0x41d4=function(_0xe1a964,_0x5ec09d){_0xe1a964=_0xe1a964-0x0;var _0x3de37b=_0x1d44[_0xe1a964];return _0x3de37b;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x41d4('0x0'));var _=require('lodash');var moment=require(_0x41d4('0x1'));var CronJobManager=require(_0x41d4('0x2'));var jayson=require(_0x41d4('0x3'));var BPromise=require(_0x41d4('0x4'));var logger=require(_0x41d4('0x5'))(_0x41d4('0x6'));var db=require(_0x41d4('0x7'))['db'];var analyticCustomReportController=require(_0x41d4('0x8'));var analyticDefaultReportController=require(_0x41d4('0x9'));var client=jayson[_0x41d4('0xa')][_0x41d4('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1eb484,_0x1416da){return function(){logger['info'](_0x41d4('0xc'),_0x1eb484['email']);var _0x2d423f=!![];var _0x1a0b99=_0x1eb484['MailAccount'][_0x41d4('0xd')]();var _0x4fa686={'account':_0x1a0b99,'message':{'from':util[_0x41d4('0xe')](_0x41d4('0xf'),_0x1eb484['MailAccount'][_0x41d4('0x10')],_0x1eb484[_0x41d4('0x11')]['email']||_0x1eb484[_0x41d4('0x11')][_0x41d4('0x12')][_0x41d4('0x13')]),'to':_0x1eb484[_0x41d4('0x14')],'cc':_0x1eb484['cc'],'bcc':_0x1eb484['bcc'],'subject':util['format'](_0x41d4('0x15'),_0x1416da[_0x41d4('0x10')],_0x1eb484[_0x41d4('0x16')],_0x1eb484[_0x41d4('0x17')])}};var _0x1f2fae=path['join'](__dirname,_0x41d4('0x18'));var _0x4f5de3=_0x1416da[_0x41d4('0x19')];var _0x30d520=util[_0x41d4('0xe')](_0x41d4('0x1a'),path['basename'](_0x1416da[_0x41d4('0x19')],path[_0x41d4('0x1b')](_0x1416da[_0x41d4('0x19')])),_0x41d4('0x1c'));var _0x14c6fd=path[_0x41d4('0x1d')](_0x1f2fae,_0x4f5de3);var _0x2e7b43=path['join'](_0x1f2fae,_0x30d520);if(fs[_0x41d4('0x1e')](_0x14c6fd)){_0x1416da[_0x41d4('0x1f')]='Sent';_0x4fa686[_0x41d4('0x20')][_0x41d4('0x21')]=[{'filename':_0x4f5de3,'path':_0x14c6fd}];_0x4fa686['message'][_0x41d4('0x22')]=util[_0x41d4('0xe')](_0x41d4('0x23'),JSON['stringify'](_0x1416da,null,0x2));}else if(fs[_0x41d4('0x1e')](_0x2e7b43)){_0x1416da[_0x41d4('0x1f')]='Sent';_0x4fa686['message']['attachments']=[{'filename':_0x30d520,'path':_0x2e7b43}];}else{_0x4fa686[_0x41d4('0x20')]['text']=_0x41d4('0x24');if(!_0x1eb484['sendIfEmpty']){_0x2d423f=![];logger[_0x41d4('0x25')](_0x41d4('0x26'));}}if(_0x2d423f){return client[_0x41d4('0x27')]('SendMail',_0x4fa686)[_0x41d4('0x28')](function(_0x330ed9){if(_0x330ed9[_0x41d4('0x29')]){return logger[_0x41d4('0x29')]('error\x20mail',JSON[_0x41d4('0x2a')](_0x330ed9));}return logger[_0x41d4('0x25')]('email\x20sent');})[_0x41d4('0x2b')](function(_0x216d71){return logger[_0x41d4('0x29')](_0x41d4('0x2c'),JSON[_0x41d4('0x2a')](_0x216d71));});}};}function handleError(){return function(_0x1110ee){return logger[_0x41d4('0x29')](JSON['stringify'](_0x1110ee));};}function handleResult(_0x4190bb){return function(_0xf45f04){logger[_0x41d4('0x25')](_0x41d4('0x2d'),JSON[_0x41d4('0x2a')](_0xf45f04));if(_0x4190bb['MailAccount']&&_0x4190bb[_0x41d4('0x11')][_0x41d4('0x12')]&&!_['isNil'](_0x4190bb[_0x41d4('0x14')])){setTimeout(handleSendEmail(_0x4190bb,_0xf45f04),0x3c*0x3e8);}};}function handleJob(_0x45eb6c){return function(){try{if(_[_0x41d4('0x2e')](_0x45eb6c[_0x41d4('0x16')])){return logger[_0x41d4('0x25')](_0x41d4('0x2f'));}if(_['isNil'](_0x45eb6c['subtractUnit'])){return logger[_0x41d4('0x25')](_0x41d4('0x30'));}var _0x30b7d9={'startDate':moment()[_0x41d4('0x31')](_0x45eb6c[_0x41d4('0x16')],_0x45eb6c[_0x41d4('0x17')])[_0x41d4('0xe')](_0x41d4('0x32')),'endDate':moment()[_0x41d4('0xe')](_0x41d4('0x32')),'type':_0x41d4('0x33'),'output':_0x45eb6c['output'],'name':_0x45eb6c[_0x41d4('0x10')]};if(!_[_0x41d4('0x2e')](_0x45eb6c[_0x41d4('0x34')])){logger['info'](_0x41d4('0x35'),_0x45eb6c['DefaultReportId']);return analyticDefaultReportController[_0x41d4('0x36')]({'id':_0x45eb6c['DefaultReportId']},_0x30b7d9)[_0x41d4('0x28')](handleResult(_0x45eb6c))[_0x41d4('0x2b')](handleError());}if(!_[_0x41d4('0x2e')](_0x45eb6c['CustomReportId'])){logger['info'](_0x41d4('0x37'),_0x45eb6c[_0x41d4('0x38')]);return analyticCustomReportController['runReport']({'id':_0x45eb6c[_0x41d4('0x38')]},_0x30b7d9)[_0x41d4('0x28')](handleResult(_0x45eb6c))[_0x41d4('0x2b')](handleError());}}catch(_0x5813d8){logger[_0x41d4('0x29')](JSON[_0x41d4('0x2a')](_0x5813d8));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x1658d3){var _0x2a7ba5={};if(_0x1658d3){_0x2a7ba5['id']=_0x1658d3;}return db[_0x41d4('0x39')][_0x41d4('0x3a')]({'where':_0x2a7ba5,'include':[{'model':db['MailAccount'],'attributes':['id',_0x41d4('0x10'),_0x41d4('0x14')],'include':[{'model':db[_0x41d4('0x3b')],'as':_0x41d4('0x12'),'include':[{'model':db[_0x41d4('0x3c')],'as':'CloudProvider'}]}]}]})[_0x41d4('0x28')](function(_0x18408d){var _0x23a22b=_[_0x41d4('0x3d')](manager['jobs']);var _0x49552d=_[_0x41d4('0x3e')](_0x18408d,function(_0x41c497){return _0x41c497['id']['toString']();});var _0x40f47c=_[_0x41d4('0x3f')](_0x18408d,function(_0x41674e){return _0x41674e['id'][_0x41d4('0x40')]();});var _0x1d427a=_0x1658d3?_0x49552d:_[_0x41d4('0x41')](_0x49552d,_0x23a22b);var _0x28f57d=_[_0x41d4('0x42')](_0x49552d,_0x23a22b);var _0x36e001=_[_0x41d4('0x41')](_0x23a22b,_0x49552d);var _0x30f75a;var _0x3eda3d;for(_0x30f75a=0x0;_0x30f75a<_0x36e001['length']&&!_0x1658d3;_0x30f75a+=0x1){_0x3eda3d=_0x36e001[_0x30f75a][_0x41d4('0x40')]();if(manager[_0x41d4('0x43')](_0x3eda3d)){manager[_0x41d4('0x44')](_0x3eda3d);manager['deleteJob'](_0x3eda3d);logger[_0x41d4('0x25')](_0x41d4('0x45'),_0x3eda3d);}}logger[_0x41d4('0x25')](_0x41d4('0x46'),JSON['stringify'](_0x1d427a));for(_0x30f75a=0x0;_0x30f75a<_0x1d427a[_0x41d4('0x47')];_0x30f75a+=0x1){_0x3eda3d=_0x1d427a[_0x30f75a][_0x41d4('0x40')]();logger[_0x41d4('0x25')](_0x41d4('0x48'),_0x3eda3d);if(_0x1658d3){logger['info'](_0x41d4('0x49'),_0x1658d3);logger[_0x41d4('0x25')](JSON[_0x41d4('0x2a')](_0x40f47c[_0x3eda3d]));BPromise['resolve']()[_0x41d4('0x28')](handleJob(_0x40f47c[_0x3eda3d]));logger[_0x41d4('0x25')](_0x41d4('0x4a'),_0x40f47c[_0x3eda3d][_0x41d4('0x10')],_0x40f47c[_0x3eda3d][_0x41d4('0x4b')]);}else if(_0x40f47c[_0x3eda3d][_0x41d4('0x4b')]&&_0x40f47c[_0x3eda3d][_0x41d4('0x4c')]&&moment()[_0x41d4('0x4d')](_0x40f47c[_0x3eda3d][_0x41d4('0x4e')],_0x40f47c[_0x3eda3d][_0x41d4('0x4f')])){manager['add'](_0x3eda3d,_0x40f47c[_0x3eda3d][_0x41d4('0x4b')],handleJob(_0x40f47c[_0x3eda3d]));manager['start'](_0x3eda3d);logger[_0x41d4('0x25')]('add\x20cron',_0x40f47c[_0x3eda3d][_0x41d4('0x10')],_0x40f47c[_0x3eda3d][_0x41d4('0x4b')]);}else if(manager[_0x41d4('0x43')](_0x3eda3d)){manager[_0x41d4('0x44')](_0x3eda3d);manager[_0x41d4('0x50')](_0x3eda3d);logger[_0x41d4('0x25')](_0x41d4('0x51'),_0x40f47c[_0x3eda3d]['name'],_0x40f47c[_0x3eda3d][_0x41d4('0x4b')]);}}for(_0x30f75a=0x0,_0x3eda3d;_0x30f75a<_0x28f57d[_0x41d4('0x47')]&&!_0x1658d3;_0x30f75a+=0x1){_0x3eda3d=_0x28f57d[_0x30f75a][_0x41d4('0x40')]();if(manager[_0x41d4('0x43')](_0x3eda3d)){if(_0x40f47c[_0x3eda3d]['cron']&&_0x40f47c[_0x3eda3d]['active']&&moment()['isBetween'](_0x40f47c[_0x3eda3d]['startAt'],_0x40f47c[_0x3eda3d]['endAt'])){manager[_0x41d4('0x52')](_0x3eda3d,_0x40f47c[_0x3eda3d][_0x41d4('0x4b')],handleJob(_0x40f47c[_0x3eda3d]));logger['info']('update\x20cron',_0x40f47c[_0x3eda3d][_0x41d4('0x10')],_0x40f47c[_0x3eda3d]['cron']);}else{manager[_0x41d4('0x44')](_0x3eda3d);manager[_0x41d4('0x50')](_0x3eda3d);logger[_0x41d4('0x25')]('stop\x20cron',_0x40f47c[_0x3eda3d][_0x41d4('0x10')],_0x40f47c[_0x3eda3d][_0x41d4('0x4b')]);}}}})['catch'](function(_0x5dfa08){logger['error'](JSON[_0x41d4('0x2a')](_0x5dfa08));});}exports[_0x41d4('0x53')]=function(_0x25c214){return getJobs(_0x25c214);};exports[_0x41d4('0x54')]=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 69f238c..74d5cf7 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 _0xb7aa=['detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FailureReason','Cloud\x20Provider\x20not\x20configured','Neutral','name','SequelizeValidationError','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend'];(function(_0x2a7186,_0x23ce2e){var _0x133cff=function(_0x2e98b2){while(--_0x2e98b2){_0x2a7186['push'](_0x2a7186['shift']());}};_0x133cff(++_0x23ce2e);}(_0xb7aa,0x11a));var _0xab7a=function(_0x58cc49,_0x1eadcf){_0x58cc49=_0x58cc49-0x0;var _0x84cb24=_0xb7aa[_0x58cc49];return _0x84cb24;};var _=require(_0xab7a('0x0'));var AWS=require(_0xab7a('0x1'));var rp=require(_0xab7a('0x2'));var util=require(_0xab7a('0x3'));var BPromise=require(_0xab7a('0x4'));var db=require(_0xab7a('0x5'))['db'];var logger=require(_0xab7a('0x6'))(_0xab7a('0x7'));function getTranscriptionJob(_0x34adc3,_0x3b0621,_0x4be0a6,_0x35e114){return new Promise(function(_0x1c761b,_0x2ee412){var _0x29ef15=new AWS['TranscribeService']({'accessKeyId':_0x3b0621,'secretAccessKey':_0x34adc3,'region':_0x4be0a6});_0x29ef15[_0xab7a('0x8')]({'TranscriptionJobName':_0x35e114},function(_0x1e3b23,_0x520d21){if(_0x1e3b23){return _0x2ee412(_0x1e3b23);}else{return _0x1c761b(_0x520d21);}});});}function sentiment(_0x25053d,_0xee9933,_0x40e6e6,_0x2fe540,_0x40cc81){return new Promise(function(_0x3f8d8c,_0x2e2e53){var _0x2ac769=new AWS[(_0xab7a('0x9'))]({'accessKeyId':_0xee9933,'secretAccessKey':_0x25053d,'region':_0x40e6e6});_0x2ac769[_0xab7a('0xa')]({'Text':_0x2fe540,'LanguageCode':_0x40cc81['substring'](0x0,0x2)},function(_0x206795,_0x2353c3){if(_0x206795){return _0x2e2e53(_0x206795);}else{return _0x3f8d8c(_0x2353c3);}});});}function checkTranscribeJob(_0x63aa8c,_0x45cd8e,_0x591638){var _0x28e5de;return new BPromise(function(_0x1926f7,_0x340718){logger[_0xab7a('0xb')](util['format'](_0xab7a('0xc'),_0x63aa8c['id'],_0x63aa8c[_0xab7a('0xd')]));return getTranscriptionJob(_0x591638['data1'],_0x591638[_0xab7a('0xe')],_0x45cd8e[_0xab7a('0xf')],_0x63aa8c[_0xab7a('0xd')])[_0xab7a('0x10')](function(_0x30146c){logger['info'](util[_0xab7a('0x11')](_0xab7a('0x12'),_0x63aa8c['id'],_0x63aa8c['transcribeName'],_0x30146c[_0xab7a('0x13')][_0xab7a('0x14')]));if(!_0x63aa8c[_0xab7a('0x15')]){switch(_0x30146c[_0xab7a('0x13')][_0xab7a('0x14')]){case _0xab7a('0x16'):var _0x2616f5={'transcribeStatus':_0x30146c['TranscriptionJob'][_0xab7a('0x14')],'fileUri':_0x30146c[_0xab7a('0x13')][_0xab7a('0x17')][_0xab7a('0x18')]};logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x19'),_0x63aa8c['id']));return rp({'uri':_0x30146c[_0xab7a('0x13')][_0xab7a('0x17')][_0xab7a('0x18')],'json':!![]})[_0xab7a('0x10')](function(_0x5b7ee4){logger['info'](util['format'](_0xab7a('0x1a'),_0x63aa8c['id']));if(_0x5b7ee4&&_0x5b7ee4[_0xab7a('0x1b')]&&_0x5b7ee4[_0xab7a('0x1b')][_0xab7a('0x1c')]&&_0x5b7ee4[_0xab7a('0x1b')][_0xab7a('0x1c')][_0xab7a('0x1d')]){_0x2616f5['fileText']='';for(var _0x4d2ad4=0x0;_0x4d2ad4<_0x5b7ee4[_0xab7a('0x1b')]['transcripts']['length'];_0x4d2ad4++){_0x2616f5[_0xab7a('0x15')]+=_0x5b7ee4['results'][_0xab7a('0x1c')][_0x4d2ad4][_0xab7a('0x1e')]+'';}}return _0x63aa8c[_0xab7a('0x1f')](_0x2616f5);})[_0xab7a('0x10')](function(){logger[_0xab7a('0xb')](util['format'](_0xab7a('0x20'),_0x63aa8c['id']));if(!_0x63aa8c[_0xab7a('0x21')]){throw new db[(_0xab7a('0x22'))]['ValidationError'](_0xab7a('0x23'));}if(!_0x45cd8e[_0xab7a('0x24')]||!_0x45cd8e[_0xab7a('0x25')]||!_0x45cd8e['sentimentRegion']||!_0x45cd8e['language']||!_0x45cd8e[_0xab7a('0x26')]){throw new db['Sequelize'][(_0xab7a('0x27'))](_0xab7a('0x28'));}if(!_0x2616f5['fileText']){throw new Error(_0xab7a('0x29'));}if(_0x45cd8e[_0xab7a('0x25')]===_0x591638['id']){return _0x591638;}else{return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'where':{'id':_settings[_0xab7a('0x25')]}});}})[_0xab7a('0x10')](function(_0x58a509){if(!_0x58a509){throw new db[(_0xab7a('0x22'))]['ValidationError'](_0xab7a('0x2c'));}if(!_0x58a509[_0xab7a('0x2d')]||!_0x58a509[_0xab7a('0xe')]){throw new db['Sequelize'][(_0xab7a('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x28e5de=_0x58a509;logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x2e'),_0x63aa8c['id']));return sentiment(_0x28e5de[_0xab7a('0x2d')],_0x28e5de[_0xab7a('0xe')],_0x45cd8e[_0xab7a('0x2f')],_0x2616f5[_0xab7a('0x15')],_0x45cd8e[_0xab7a('0x30')]);})['then'](function(_0x4300a6){logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x31'),_0x63aa8c['id']));return _0x63aa8c['update']({'sentiment':_0x4300a6[_0xab7a('0x32')],'sPositive':_0x4300a6[_0xab7a('0x33')][_0xab7a('0x34')],'sNegative':_0x4300a6['SentimentScore'][_0xab7a('0x35')],'sMixed':_0x4300a6[_0xab7a('0x33')][_0xab7a('0x36')],'sNeutral':_0x4300a6[_0xab7a('0x33')]['Neutral']});})[_0xab7a('0x10')](function(){logger[_0xab7a('0xb')](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x63aa8c['id']));_0x1926f7();});case'FAILED':return _0x63aa8c[_0xab7a('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x30146c[_0xab7a('0x13')][_0xab7a('0x37')]})['then'](function(){logger['info'](util[_0xab7a('0x11')](_0xab7a('0x20'),_0x63aa8c['id']));_0x1926f7();});default:logger[_0xab7a('0xb')](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x63aa8c['id']));break;}}else{return BPromise['resolve']()[_0xab7a('0x10')](function(){if(!_0x63aa8c[_0xab7a('0x21')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x45cd8e[_0xab7a('0x24')]||!_0x45cd8e[_0xab7a('0x25')]||!_0x45cd8e[_0xab7a('0x2f')]||!_0x45cd8e['language']||!_0x45cd8e[_0xab7a('0x26')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x28'));}if(!_0x63aa8c['fileText']){throw new Error(_0xab7a('0x29'));}if(_0x45cd8e['sentimentAccountId']===_0x591638['id']){return _0x591638;}else{return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'where':{'id':_settings[_0xab7a('0x25')]}});}})['then'](function(_0x103826){if(!_0x103826){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x2c'));}if(!_0x103826['data1']||!_0x103826[_0xab7a('0xe')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x38'));}_0x28e5de=_0x103826;logger['info'](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x63aa8c['id']));return sentiment(_0x28e5de[_0xab7a('0x2d')],_0x28e5de['data2'],_0x45cd8e[_0xab7a('0x2f')],_0x63aa8c[_0xab7a('0x15')],_0x45cd8e['language']);})[_0xab7a('0x10')](function(_0x600bb8){logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x31'),_0x63aa8c['id']));return _0x63aa8c[_0xab7a('0x1f')]({'sentiment':_0x600bb8['Sentiment'],'sPositive':_0x600bb8['SentimentScore'][_0xab7a('0x34')],'sNegative':_0x600bb8[_0xab7a('0x33')][_0xab7a('0x35')],'sMixed':_0x600bb8[_0xab7a('0x33')][_0xab7a('0x36')],'sNeutral':_0x600bb8[_0xab7a('0x33')][_0xab7a('0x39')],'transcribeStatus':_0xab7a('0x16')});})[_0xab7a('0x10')](function(){logger[_0xab7a('0xb')](util[_0xab7a('0x11')](_0xab7a('0x20'),_0x63aa8c['id']));_0x1926f7();});}})['catch'](function(_0x4b30ff){if(_0x4b30ff){if(!_0x4b30ff[_0xab7a('0x3a')]||_0x4b30ff[_0xab7a('0x3a')]!==_0xab7a('0x3b')){logger['error'](util[_0xab7a('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x63aa8c['id']),util[_0xab7a('0x3c')](_0x4b30ff,{'showHidden':![],'depth':null}));}}_0x1926f7();});});}function checkTranscribe(){var _0x22beab;var _0x5c4478;var _0x49438f;return db['VoiceRecording'][_0xab7a('0x3d')]({'where':{'transcribeStatus':_0xab7a('0x3e')}})['then'](function(_0x4a973f){if(!_0x4a973f||!_0x4a973f[_0xab7a('0x1d')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x3f'));}_0x22beab=_0x4a973f;return db[_0xab7a('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x10d1ca){if(!_0x10d1ca){throw new db['Sequelize'][(_0xab7a('0x27'))]('Settings\x20not\x20available');}_0x5c4478=_0x10d1ca;if(!_0x5c4478[_0xab7a('0x7')]||!_0x5c4478[_0xab7a('0x41')]||!_0x5c4478[_0xab7a('0xf')]||!_0x5c4478[_0xab7a('0x30')]||!_0x5c4478[_0xab7a('0x26')]){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x42'));}return db[_0xab7a('0x2a')][_0xab7a('0x2b')]({'where':{'id':_0x5c4478[_0xab7a('0x41')]}});})['then'](function(_0x3bfdae){if(!_0x3bfdae){throw new db[(_0xab7a('0x22'))][(_0xab7a('0x27'))](_0xab7a('0x2c'));}if(!_0x3bfdae['data1']||!_0x3bfdae['data2']){throw new db['Sequelize'][(_0xab7a('0x27'))](_0xab7a('0x38'));}_0x49438f=_0x3bfdae;var _0x49f75e=[];_0x22beab[_0xab7a('0x43')](function(_0x28d5e9){_0x49f75e[_0xab7a('0x44')](checkTranscribeJob(_0x28d5e9,_0x5c4478,_0x49438f));});return BPromise[_0xab7a('0x45')](_0x49f75e);})[_0xab7a('0x46')](function(_0x3c0acb){if(_0x3c0acb){if(!_0x3c0acb[_0xab7a('0x3a')]||_0x3c0acb[_0xab7a('0x3a')]!==_0xab7a('0x3b')){logger[_0xab7a('0x47')](util[_0xab7a('0x3c')](_0x3c0acb,{'showHidden':![],'depth':null}));}}});}exports[_0xab7a('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3495=['length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','Neutral','COMPLETED','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','TranscriptionJobStatus','fileText','TranscriptionJob','TranscriptFileUri','Transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x23e15a,_0x2b773a){var _0x16055d=function(_0x1c4c86){while(--_0x1c4c86){_0x23e15a['push'](_0x23e15a['shift']());}};_0x16055d(++_0x2b773a);}(_0x3495,0x1de));var _0x5349=function(_0x1db57b,_0x994eee){_0x1db57b=_0x1db57b-0x0;var _0x145535=_0x3495[_0x1db57b];return _0x145535;};var _=require(_0x5349('0x0'));var AWS=require(_0x5349('0x1'));var rp=require(_0x5349('0x2'));var util=require(_0x5349('0x3'));var BPromise=require(_0x5349('0x4'));var db=require(_0x5349('0x5'))['db'];var logger=require(_0x5349('0x6'))(_0x5349('0x7'));function getTranscriptionJob(_0xedbd32,_0x5912ac,_0x4034ba,_0x8283b5){return new Promise(function(_0x5ce2cd,_0xcb5a1){var _0x538385=new AWS[(_0x5349('0x8'))]({'accessKeyId':_0x5912ac,'secretAccessKey':_0xedbd32,'region':_0x4034ba});_0x538385['getTranscriptionJob']({'TranscriptionJobName':_0x8283b5},function(_0x393873,_0x583cee){if(_0x393873){return _0xcb5a1(_0x393873);}else{return _0x5ce2cd(_0x583cee);}});});}function sentiment(_0x1751b2,_0x3eaddf,_0x22a3d3,_0x23a1c7,_0x21bf91){return new Promise(function(_0x3a416e,_0x35d425){var _0x4bf160=new AWS[(_0x5349('0x9'))]({'accessKeyId':_0x3eaddf,'secretAccessKey':_0x1751b2,'region':_0x22a3d3});_0x4bf160['detectSentiment']({'Text':_0x23a1c7,'LanguageCode':_0x21bf91[_0x5349('0xa')](0x0,0x2)},function(_0x32b09b,_0xcf06a8){if(_0x32b09b){return _0x35d425(_0x32b09b);}else{return _0x3a416e(_0xcf06a8);}});});}function checkTranscribeJob(_0x11d230,_0x2f5172,_0x3c592a){var _0x642966;return new BPromise(function(_0x52c253,_0x3227bd){logger[_0x5349('0xb')](util['format'](_0x5349('0xc'),_0x11d230['id'],_0x11d230[_0x5349('0xd')]));return getTranscriptionJob(_0x3c592a['data1'],_0x3c592a[_0x5349('0xe')],_0x2f5172[_0x5349('0xf')],_0x11d230[_0x5349('0xd')])['then'](function(_0x5bcb3a){logger['info'](util[_0x5349('0x10')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x11d230['id'],_0x11d230[_0x5349('0xd')],_0x5bcb3a['TranscriptionJob'][_0x5349('0x11')]));if(!_0x11d230[_0x5349('0x12')]){switch(_0x5bcb3a[_0x5349('0x13')][_0x5349('0x11')]){case'COMPLETED':var _0x22d1ca={'transcribeStatus':_0x5bcb3a[_0x5349('0x13')][_0x5349('0x11')],'fileUri':_0x5bcb3a[_0x5349('0x13')]['Transcript'][_0x5349('0x14')]};logger[_0x5349('0xb')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x11d230['id']));return rp({'uri':_0x5bcb3a['TranscriptionJob'][_0x5349('0x15')]['TranscriptFileUri'],'json':!![]})[_0x5349('0x16')](function(_0x1ff911){logger[_0x5349('0xb')](util[_0x5349('0x10')](_0x5349('0x17'),_0x11d230['id']));if(_0x1ff911&&_0x1ff911[_0x5349('0x18')]&&_0x1ff911[_0x5349('0x18')][_0x5349('0x19')]&&_0x1ff911[_0x5349('0x18')][_0x5349('0x19')][_0x5349('0x1a')]){_0x22d1ca[_0x5349('0x12')]='';for(var _0x57af6c=0x0;_0x57af6c<_0x1ff911[_0x5349('0x18')][_0x5349('0x19')][_0x5349('0x1a')];_0x57af6c++){_0x22d1ca['fileText']+=_0x1ff911[_0x5349('0x18')]['transcripts'][_0x57af6c][_0x5349('0x1b')]+'';}}return _0x11d230[_0x5349('0x1c')](_0x22d1ca);})[_0x5349('0x16')](function(){logger['info'](util[_0x5349('0x10')](_0x5349('0x1d'),_0x11d230['id']));if(!_0x11d230[_0x5349('0x1e')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x21'));}if(!_0x2f5172[_0x5349('0x22')]||!_0x2f5172[_0x5349('0x23')]||!_0x2f5172[_0x5349('0x24')]||!_0x2f5172['language']||!_0x2f5172[_0x5349('0x25')]){throw new db[(_0x5349('0x1f'))]['ValidationError'](_0x5349('0x26'));}if(!_0x22d1ca['fileText']){throw new Error(_0x5349('0x27'));}if(_0x2f5172[_0x5349('0x23')]===_0x3c592a['id']){return _0x3c592a;}else{return db[_0x5349('0x28')][_0x5349('0x29')]({'where':{'id':_settings[_0x5349('0x23')]}});}})[_0x5349('0x16')](function(_0x545972){if(!_0x545972){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x2a'));}if(!_0x545972[_0x5349('0x2b')]||!_0x545972['data2']){throw new db['Sequelize'][(_0x5349('0x20'))](_0x5349('0x2c'));}_0x642966=_0x545972;logger[_0x5349('0xb')](util['format'](_0x5349('0x2d'),_0x11d230['id']));return sentiment(_0x642966['data1'],_0x642966[_0x5349('0xe')],_0x2f5172[_0x5349('0x24')],_0x22d1ca[_0x5349('0x12')],_0x2f5172[_0x5349('0x2e')]);})[_0x5349('0x16')](function(_0x196a93){logger['info'](util['format'](_0x5349('0x2f'),_0x11d230['id']));return _0x11d230[_0x5349('0x1c')]({'sentiment':_0x196a93[_0x5349('0x30')],'sPositive':_0x196a93[_0x5349('0x31')][_0x5349('0x32')],'sNegative':_0x196a93[_0x5349('0x31')][_0x5349('0x33')],'sMixed':_0x196a93['SentimentScore']['Mixed'],'sNeutral':_0x196a93[_0x5349('0x31')]['Neutral']});})['then'](function(){logger[_0x5349('0xb')](util['format'](_0x5349('0x1d'),_0x11d230['id']));_0x52c253();});case _0x5349('0x34'):return _0x11d230[_0x5349('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x5bcb3a[_0x5349('0x13')]['FailureReason']})[_0x5349('0x16')](function(){logger[_0x5349('0xb')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x11d230['id']));_0x52c253();});default:logger['info'](util['format'](_0x5349('0x35'),_0x11d230['id']));break;}}else{return BPromise[_0x5349('0x36')]()[_0x5349('0x16')](function(){if(!_0x11d230[_0x5349('0x1e')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2f5172['sentiment']||!_0x2f5172[_0x5349('0x23')]||!_0x2f5172[_0x5349('0x24')]||!_0x2f5172[_0x5349('0x2e')]||!_0x2f5172['bucket']){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x26'));}if(!_0x11d230[_0x5349('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x2f5172[_0x5349('0x23')]===_0x3c592a['id']){return _0x3c592a;}else{return db['CloudProvider'][_0x5349('0x29')]({'where':{'id':_settings[_0x5349('0x23')]}});}})['then'](function(_0x309539){if(!_0x309539){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x2a'));}if(!_0x309539[_0x5349('0x2b')]||!_0x309539[_0x5349('0xe')]){throw new db[(_0x5349('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x642966=_0x309539;logger[_0x5349('0xb')](util[_0x5349('0x10')](_0x5349('0x2d'),_0x11d230['id']));return sentiment(_0x642966[_0x5349('0x2b')],_0x642966['data2'],_0x2f5172[_0x5349('0x24')],_0x11d230['fileText'],_0x2f5172['language']);})[_0x5349('0x16')](function(_0x42d359){logger[_0x5349('0xb')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x11d230['id']));return _0x11d230[_0x5349('0x1c')]({'sentiment':_0x42d359[_0x5349('0x30')],'sPositive':_0x42d359[_0x5349('0x31')][_0x5349('0x32')],'sNegative':_0x42d359[_0x5349('0x31')][_0x5349('0x33')],'sMixed':_0x42d359[_0x5349('0x31')][_0x5349('0x37')],'sNeutral':_0x42d359[_0x5349('0x31')][_0x5349('0x38')],'transcribeStatus':_0x5349('0x39')});})[_0x5349('0x16')](function(){logger[_0x5349('0xb')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x11d230['id']));_0x52c253();});}})['catch'](function(_0x11d862){if(_0x11d862){if(!_0x11d862[_0x5349('0x3a')]||_0x11d862[_0x5349('0x3a')]!==_0x5349('0x3b')){logger[_0x5349('0x3c')](util[_0x5349('0x10')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x11d230['id']),util[_0x5349('0x3d')](_0x11d862,{'showHidden':![],'depth':null}));}}_0x52c253();});});}function checkTranscribe(){var _0x37f59a;var _0x1fa080;var _0x3652dc;return db[_0x5349('0x3e')][_0x5349('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x5349('0x16')](function(_0x4fdb77){if(!_0x4fdb77||!_0x4fdb77[_0x5349('0x1a')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x40'));}_0x37f59a=_0x4fdb77;return db[_0x5349('0x41')]['findOne']({'where':{'id':0x1}});})[_0x5349('0x16')](function(_0x3fca72){if(!_0x3fca72){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))]('Settings\x20not\x20available');}_0x1fa080=_0x3fca72;if(!_0x1fa080[_0x5349('0x7')]||!_0x1fa080[_0x5349('0x42')]||!_0x1fa080[_0x5349('0xf')]||!_0x1fa080[_0x5349('0x2e')]||!_0x1fa080[_0x5349('0x25')]){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x43'));}return db[_0x5349('0x28')][_0x5349('0x29')]({'where':{'id':_0x1fa080[_0x5349('0x42')]}});})[_0x5349('0x16')](function(_0x1286a2){if(!_0x1286a2){throw new db[(_0x5349('0x1f'))][(_0x5349('0x20'))](_0x5349('0x2a'));}if(!_0x1286a2[_0x5349('0x2b')]||!_0x1286a2[_0x5349('0xe')]){throw new db['Sequelize'][(_0x5349('0x20'))](_0x5349('0x2c'));}_0x3652dc=_0x1286a2;var _0x59f481=[];_0x37f59a['forEach'](function(_0x346599){_0x59f481[_0x5349('0x44')](checkTranscribeJob(_0x346599,_0x1fa080,_0x3652dc));});return BPromise[_0x5349('0x45')](_0x59f481);})[_0x5349('0x46')](function(_0x25a93a){if(_0x25a93a){if(!_0x25a93a[_0x5349('0x3a')]||_0x25a93a[_0x5349('0x3a')]!=='SequelizeValidationError'){logger[_0x5349('0x3c')](util[_0x5349('0x3d')](_0x25a93a,{'showHidden':![],'depth':null}));}}});}exports[_0x5349('0x47')]=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 d6fef42..62937b0 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 _0x8917=['lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','then','info','whatsappInteraction:update','catch','inspect'];(function(_0x228d79,_0x2b23b7){var _0x64eee3=function(_0x1c42fe){while(--_0x1c42fe){_0x228d79['push'](_0x228d79['shift']());}};_0x64eee3(++_0x2b23b7);}(_0x8917,0xc8));var _0x7891=function(_0x4c29a2,_0x1b7468){_0x4c29a2=_0x4c29a2-0x0;var _0x31cb04=_0x8917[_0x4c29a2];return _0x31cb04;};'use strict';var _=require(_0x7891('0x0'));var moment=require(_0x7891('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x7891('0x2'));var db=require(_0x7891('0x3'))['db'];var logger=require(_0x7891('0x4'))(_0x7891('0x5'));config[_0x7891('0x6')]=_['defaults'](config[_0x7891('0x6')],{'host':_0x7891('0x7'),'port':0x18eb});var io=require(_0x7891('0x8'))(new Redis(config[_0x7891('0x6')]));function closeInteractions(){var _0xce84b1=[];return db[_0x7891('0x9')][_0x7891('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7891('0xb')](0x18,_0x7891('0xc'))}}})['then'](function(_0x194dd4){if(_0x194dd4&&_0x194dd4[_0x7891('0xd')]){_0xce84b1=_[_0x7891('0xe')](_0x194dd4||[],'id');logger['info'](_0x7891('0xf'),_0xce84b1[_0x7891('0x10')]());return db[_0x7891('0x9')][_0x7891('0x11')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x7891('0x12')](_0x7891('0x13'))},{'where':{'id':_0xce84b1}});}})[_0x7891('0x14')](function(){if(_0xce84b1&&_0xce84b1[_0x7891('0xd')]){logger[_0x7891('0x15')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xce84b1[_0x7891('0x10')]());for(var _0x3532fd=0x0;_0x3532fd<_0xce84b1[_0x7891('0xd')];_0x3532fd++){io['emit'](_0x7891('0x16'),{'id':_0xce84b1[_0x3532fd],'closed':!![]});}}})[_0x7891('0x17')](function(_0x1205fc){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1205fc?util[_0x7891('0x18')](_0x1205fc,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbb68=['hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract'];(function(_0x6a6e73,_0x1bda40){var _0x2a046c=function(_0x429c27){while(--_0x429c27){_0x6a6e73['push'](_0x6a6e73['shift']());}};_0x2a046c(++_0x1bda40);}(_0xbb68,0xad));var _0x8bb6=function(_0x4be6aa,_0x3b4465){_0x4be6aa=_0x4be6aa-0x0;var _0x1ce707=_0xbb68[_0x4be6aa];return _0x1ce707;};'use strict';var _=require(_0x8bb6('0x0'));var moment=require(_0x8bb6('0x1'));var Redis=require(_0x8bb6('0x2'));var util=require(_0x8bb6('0x3'));var config=require(_0x8bb6('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x8bb6('0x5'))(_0x8bb6('0x6'));config[_0x8bb6('0x7')]=_['defaults'](config[_0x8bb6('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8bb6('0x8'))(new Redis(config[_0x8bb6('0x7')]));function closeInteractions(){var _0x33a7e4=[];return db[_0x8bb6('0x9')][_0x8bb6('0xa')]({'raw':!![],'attributes':['id',_0x8bb6('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8bb6('0xc')](0x18,_0x8bb6('0xd'))}}})[_0x8bb6('0xe')](function(_0x59a89e){if(_0x59a89e&&_0x59a89e['length']){_0x33a7e4=_[_0x8bb6('0xf')](_0x59a89e||[],'id');logger['info'](_0x8bb6('0x10'),_0x33a7e4['join']());return db[_0x8bb6('0x9')]['update']({'closeReason':'system','disposition':_0x8bb6('0x11'),'closed':!![],'closedAt':moment()[_0x8bb6('0x12')](_0x8bb6('0x13'))},{'where':{'id':_0x33a7e4}});}})[_0x8bb6('0xe')](function(){if(_0x33a7e4&&_0x33a7e4[_0x8bb6('0x14')]){logger[_0x8bb6('0x15')](_0x8bb6('0x16'),_0x33a7e4[_0x8bb6('0x17')]());for(var _0x30e514=0x0;_0x30e514<_0x33a7e4['length'];_0x30e514++){io[_0x8bb6('0x18')](_0x8bb6('0x19'),{'id':_0x33a7e4[_0x30e514],'closed':!![]});}}})[_0x8bb6('0x1a')](function(_0x387243){logger[_0x8bb6('0x1b')](_0x8bb6('0x1c'),_0x387243?util[_0x8bb6('0x1d')](_0x387243,{'showHidden':![],'depth':null}):'');});}exports[_0x8bb6('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index be0b60a..58e054f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8936=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy'];(function(_0x152c9a,_0x15db16){var _0x43a214=function(_0x29ce5e){while(--_0x29ce5e){_0x152c9a['push'](_0x152c9a['shift']());}};_0x43a214(++_0x15db16);}(_0x8936,0x172));var _0x6893=function(_0x58fdfd,_0x46f063){_0x58fdfd=_0x58fdfd-0x0;var _0x3a4613=_0x8936[_0x58fdfd];return _0x3a4613;};'use strict';var util=require(_0x6893('0x0'));var db=require(_0x6893('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6893('0x2')]({'id':i,'firstName':_0x6893('0x3')+i,'lastName':_0x6893('0x4')+i,'phone':0xf879fb460+i,'email':_0x6893('0x5')+i+_0x6893('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6893('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6893('0x7')](),'updatedAt':Date[_0x6893('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6893('0x2')]({'id':i,'firstName':_0x6893('0x3')+i,'lastName':_0x6893('0x4')+i,'phone':0xf879fb460+i,'email':_0x6893('0x5')+i+_0x6893('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6893('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6893('0x7')](),'updatedAt':Date[_0x6893('0x7')]()});}db[_0x6893('0x8')][_0x6893('0x9')]({'where':{}})[_0x6893('0xa')](function(){return db[_0x6893('0x8')][_0x6893('0xb')](contacts);})['then'](function(){console[_0x6893('0xc')](_0x6893('0xd'),_0x6893('0xe'));return db['CmHopper'][_0x6893('0x9')]({'where':{}});})[_0x6893('0xa')](function(){return db[_0x6893('0xf')]['bulkCreate'](hopper);})[_0x6893('0xa')](function(){console['log'](_0x6893('0xd'),_0x6893('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0x6893('0xa')](function(){console[_0x6893('0xc')](_0x6893('0xd'),_0x6893('0x11'));return db[_0x6893('0xf')][_0x6893('0xb')](hopper2);})[_0x6893('0xa')](function(){console[_0x6893('0xc')](_0x6893('0xd'),'hopper2');})[_0x6893('0x12')](function(_0xf7040a){console['log'](_0xf7040a);}); \ No newline at end of file +var _0x8e92=['hopper2','catch','log','util','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','hopper1','contacts2','CmHopper'];(function(_0x2b4c36,_0x48a33f){var _0x5b7ccd=function(_0x191bcc){while(--_0x191bcc){_0x2b4c36['push'](_0x2b4c36['shift']());}};_0x5b7ccd(++_0x48a33f);}(_0x8e92,0x1b8));var _0x28e9=function(_0x2e559d,_0x3daedd){_0x2e559d=_0x2e559d-0x0;var _0x3f7065=_0x8e92[_0x2e559d];return _0x3f7065;};'use strict';var util=require(_0x28e9('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x28e9('0x1')]({'id':i,'firstName':_0x28e9('0x2')+i,'lastName':_0x28e9('0x3')+i,'phone':0xf879fb460+i,'email':_0x28e9('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x28e9('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x28e9('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x28e9('0x1')]({'id':i,'firstName':_0x28e9('0x2')+i,'lastName':_0x28e9('0x3')+i,'phone':0xf879fb460+i,'email':_0x28e9('0x4')+i+_0x28e9('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x28e9('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x28e9('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x28e9('0x5')](),'updatedAt':Date[_0x28e9('0x5')]()});}db[_0x28e9('0x7')][_0x28e9('0x8')]({'where':{}})[_0x28e9('0x9')](function(){return db[_0x28e9('0x7')][_0x28e9('0xa')](contacts);})[_0x28e9('0x9')](function(){console['log'](_0x28e9('0xb'),_0x28e9('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0x28e9('0x9')](function(){return db['CmHopper'][_0x28e9('0xa')](hopper);})['then'](function(){console['log'](_0x28e9('0xb'),_0x28e9('0xd'));return db[_0x28e9('0x7')]['bulkCreate'](contacts2);})[_0x28e9('0x9')](function(){console['log'](_0x28e9('0xb'),_0x28e9('0xe'));return db[_0x28e9('0xf')][_0x28e9('0xa')](hopper2);})[_0x28e9('0x9')](function(){console['log'](_0x28e9('0xb'),_0x28e9('0x10'));})[_0x28e9('0x11')](function(_0x231ead){console[_0x28e9('0x12')](_0x231ead);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index f9bc2b7..59a88da 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa02c=['User','log','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>'];(function(_0x8962d6,_0x503ed6){var _0x566f25=function(_0x56b0f0){while(--_0x56b0f0){_0x8962d6['push'](_0x8962d6['shift']());}};_0x566f25(++_0x503ed6);}(_0xa02c,0x101));var _0xca02=function(_0x7378f8,_0x2a4020){_0x7378f8=_0x7378f8-0x0;var _0x3ada3=_0xa02c[_0x7378f8];return _0x3ada3;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xca02('0x0')]({'name':util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),'fullname':util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),'email':util['format'](_0xca02('0x4'),_0xca02('0x3'),i),'role':_0xca02('0x3'),'password':_0xca02('0x5'),'internal':0xfa0+i,'type':_0xca02('0x6'),'transport':[_0xca02('0x7'),'ws','wss'],'disallow':[_0xca02('0x8')],'allow':[_0xca02('0x9')],'defaultuser':util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),'encryption':_0xca02('0xa'),'avpf':_0xca02('0xa'),'force_avp':_0xca02('0xa'),'icesupport':_0xca02('0xa'),'dtlsenable':_0xca02('0xa'),'dtlsverify':'no','dtlscertfile':_0xca02('0xb'),'dtlsprivatekey':_0xca02('0xc'),'dtlssetup':_0xca02('0xd'),'callerid':util[_0xca02('0x1')](_0xca02('0xe'),util[_0xca02('0x1')](_0xca02('0x2'),_0xca02('0x3'),i),0xfa0+i)});}db[_0xca02('0xf')]['bulkCreate'](users)['then'](function(){console[_0xca02('0x10')]('add\x20user');})['catch'](function(_0x44e1cb){console[_0xca02('0x10')](_0x44e1cb);}); \ No newline at end of file +var _0xbd08=['yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','add\x20user','catch','log','util','push','%s%s','agent','format','%s%s@xcally.com','friend','udp','wss','all','ulaw'];(function(_0x950367,_0x315c48){var _0x3c2d4c=function(_0x115d21){while(--_0x115d21){_0x950367['push'](_0x950367['shift']());}};_0x3c2d4c(++_0x315c48);}(_0xbd08,0x103));var _0x8bd0=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbd08[_0x2dadb9];return _0x2f0097;};'use strict';var util=require(_0x8bd0('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8bd0('0x1')]({'name':util['format'](_0x8bd0('0x2'),_0x8bd0('0x3'),i),'fullname':util[_0x8bd0('0x4')](_0x8bd0('0x2'),_0x8bd0('0x3'),i),'email':util[_0x8bd0('0x4')](_0x8bd0('0x5'),_0x8bd0('0x3'),i),'role':_0x8bd0('0x3'),'password':'password','internal':0xfa0+i,'type':_0x8bd0('0x6'),'transport':[_0x8bd0('0x7'),'ws',_0x8bd0('0x8')],'disallow':[_0x8bd0('0x9')],'allow':[_0x8bd0('0xa')],'defaultuser':util[_0x8bd0('0x4')](_0x8bd0('0x2'),_0x8bd0('0x3'),i),'encryption':_0x8bd0('0xb'),'avpf':_0x8bd0('0xb'),'force_avp':_0x8bd0('0xb'),'icesupport':_0x8bd0('0xb'),'dtlsenable':_0x8bd0('0xb'),'dtlsverify':'no','dtlscertfile':_0x8bd0('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x8bd0('0x4')](_0x8bd0('0xd'),util[_0x8bd0('0x4')]('%s%s','agent',i),0xfa0+i)});}db['User'][_0x8bd0('0xe')](users)['then'](function(){console['log'](_0x8bd0('0xf'));})[_0x8bd0('0x10')](function(_0x113f2e){console[_0x8bd0('0x11')](_0x113f2e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 964be6c..8847a29 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d5e=['MailQueue','OpenchannelQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','ChatQueues','SmsQueues','MailQueues'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x8d5e,0xf6));var _0xe8d5=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x8d5e[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var BPromise=require(_0xe8d5('0x2'));var db=require(_0xe8d5('0x3'))['db'];var config=require(_0xe8d5('0x4'));var queryQueues={'attributes':['id',_0xe8d5('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xe8d5('0x5'),_0xe8d5('0x6')],'raw':!![],'where':{'role':_0xe8d5('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe8d5('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xe8d5('0x5')],'where':{'role':_0xe8d5('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe8d5('0x8')],'where':{'type':_0xe8d5('0x9')}};function getAssociatedResources(_0x1aaa23,_0x20cddc,_0x4e4eae){return db[_0xe8d5('0xa')][_0xe8d5('0xb')]({'where':{'name':_0x1aaa23,'userProfileId':_0x20cddc},'raw':!![]})['then'](function(_0x52b3d8){if(_0x52b3d8){if(_0x52b3d8[_0xe8d5('0xc')]){switch(_0x1aaa23){case _0xe8d5('0xd'):case'ChatQueues':case _0xe8d5('0xe'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0xe8d5('0xf'):return db[_0x4e4eae][_0xe8d5('0x10')](queryQueues);case _0xe8d5('0x11'):return db[_0x4e4eae][_0xe8d5('0x10')](queryTelephones);case _0xe8d5('0x12'):return db[_0x4e4eae][_0xe8d5('0x10')](queryTrunks);case _0xe8d5('0x13'):return db[_0x4e4eae][_0xe8d5('0x10')](queryCampaigns);}}else{return db[_0xe8d5('0x14')][_0xe8d5('0x10')]({'attributes':[_0xe8d5('0x15')],'where':{'sectionId':_0x52b3d8['id']},'raw':!![]})['then'](function(_0x2322e6){if(_0x2322e6){var _0xd213e1={'where':{'id':_['map'](_0x2322e6,_0xe8d5('0x15'))},'raw':!![]};switch(_0x4e4eae){case _0xe8d5('0x16'):_0xd213e1[_0xe8d5('0x17')][_0xe8d5('0x6')]='telephone';break;case _0xe8d5('0x18'):_0xd213e1[_0xe8d5('0x17')]['type']='ivr';break;}return db[_0x4e4eae][_0xe8d5('0x10')](_0xd213e1);}else{return[];}});}}else{return[];}})['then'](function(_0x46d317){return _0x46d317;});}function joinOrLeaveQueues(_0x5e3ad2,_0xe2bc71,_0x5933f0,_0x43c0a5){_0x5e3ad2[_0xe2bc71](util[_0xe8d5('0x19')](_0xe8d5('0x1a'),_0x5933f0,_0x43c0a5['name']));if(_0x43c0a5['Agents']){for(var _0x31dda5=0x0;_0x31dda5<_0x43c0a5['Agents'][_0xe8d5('0x1b')];_0x31dda5+=0x1){_0x5e3ad2[_0xe2bc71](util['format'](_0xe8d5('0x1c'),_0x43c0a5[_0xe8d5('0x1d')][_0x31dda5][_0xe8d5('0x5')]));}}}function joinOrLeave(_0x2dc4cc,_0x10de0a,_0x13e7c9){var _0x5c8c96;if(_0x2dc4cc[_0xe8d5('0x1e')][_0xe8d5('0x1f')]['id']){db['User'][_0xe8d5('0x20')]({'attributes':['id',_0xe8d5('0x5'),_0xe8d5('0x6'),_0xe8d5('0x21')],'where':{'id':_0x2dc4cc[_0xe8d5('0x1e')][_0xe8d5('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe8d5('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x23')],'as':_0xe8d5('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x25')],'as':_0xe8d5('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x27')],'as':_0xe8d5('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe8d5('0x29')],'as':_0xe8d5('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xe8d5('0x2b')](function(_0xc1ad95){if(_0xc1ad95){_0x5c8c96=_0xc1ad95;_0x2dc4cc[_0x10de0a](util['format']('user:%s',_0xc1ad95[_0xe8d5('0x5')]));var _0x215a67=[];switch(_0xc1ad95['role']){case _0xe8d5('0x2c'):_0x2dc4cc[_0x10de0a](_0xe8d5('0x2d'));_0x2dc4cc[_0x10de0a](_0xe8d5('0x2e'));if(queryQueues[_0xe8d5('0x2f')]('include')){delete queryQueues[_0xe8d5('0x30')];}_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x32')][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x33')]['findAll'](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x34')]['findAll'](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x35')][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db['MailQueue'][_0xe8d5('0x10')](queryQueues));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x36')]['findAll'](queryQueues));_0x215a67['push'](db['WhatsappQueue'][_0xe8d5('0x10')](queryQueues));_0x215a67['push'](db[_0xe8d5('0x16')][_0xe8d5('0x10')](queryTelephones));_0x215a67['push'](db[_0xe8d5('0x37')][_0xe8d5('0x10')](queryTrunks));_0x215a67['push'](db[_0xe8d5('0x18')][_0xe8d5('0x10')](queryCampaigns));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x16')]['findAll'](queryAgents));break;case _0xe8d5('0x38'):_0x2dc4cc[_0x10de0a]('voice:inbound');_0x2dc4cc[_0x10de0a](_0xe8d5('0x2e'));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0xd'),_0xc1ad95['userProfileId'],_0xe8d5('0x32')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x39'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x33')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources('FaxQueues',_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x34')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3a'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x35')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3b'),_0xc1ad95['userProfileId'],_0xe8d5('0x3c')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x3d'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x36')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0xf'),_0xc1ad95[_0xe8d5('0x21')],'WhatsappQueue'));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x11'),_0xc1ad95['userProfileId'],_0xe8d5('0x16')));_0x215a67['push'](getAssociatedResources(_0xe8d5('0x12'),_0xc1ad95[_0xe8d5('0x21')],_0xe8d5('0x37')));_0x215a67[_0xe8d5('0x31')](getAssociatedResources(_0xe8d5('0x13'),_0xc1ad95['userProfileId'],'Campaign'));_0x215a67[_0xe8d5('0x31')](db[_0xe8d5('0x16')]['findAll'](queryAgents));break;case _0xe8d5('0x7'):_0x2dc4cc[_0x10de0a](_0xe8d5('0x2d'));_0x2dc4cc[_0x10de0a]('voice:outbound');_0x215a67[_0xe8d5('0x31')](_0xc1ad95['getVoiceQueues']({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67['push'](_0xc1ad95[_0xe8d5('0x3e')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67['push'](_0xc1ad95[_0xe8d5('0x3f')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x40')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x41')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x42')]({'attributes':['id',_0xe8d5('0x5')]}));_0x215a67[_0xe8d5('0x31')](_0xc1ad95[_0xe8d5('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0xe8d5('0x44')](_0x215a67);}})[_0xe8d5('0x2b')](function(_0x25d0f4){if(_0x25d0f4&&_0x25d0f4[_0xe8d5('0x1b')]){for(var _0xa3de7a=0x0;_0xa3de7a<_0x25d0f4[_0xe8d5('0x1b')];_0xa3de7a+=0x1){for(var _0x281346=0x0;_0x281346<_0x25d0f4[_0xa3de7a]['length'];_0x281346+=0x1){switch(_0xa3de7a){case 0x0:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x45'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x1:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x46'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x2:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x47'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x3:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x48'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x4:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x49'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x5:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x4a'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x6:joinOrLeaveQueues(_0x2dc4cc,_0x10de0a,_0xe8d5('0x4b'),_0x25d0f4[_0xa3de7a][_0x281346]);break;case 0x7:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x4c'),_0x25d0f4[_0xa3de7a][_0x281346]['name']));break;case 0x8:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')]('trunk:%s',_0x25d0f4[_0xa3de7a][_0x281346]['name']));break;case 0x9:if(_0x5c8c96[_0xe8d5('0x6')]!==_0xe8d5('0x7'))_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x4d'),_0x25d0f4[_0xa3de7a][_0x281346]['type'],_0x25d0f4[_0xa3de7a][_0x281346][_0xe8d5('0x5')]));break;case 0xa:_0x2dc4cc[_0x10de0a](util[_0xe8d5('0x19')](_0xe8d5('0x1c'),_0x25d0f4[_0xa3de7a][_0x281346][_0xe8d5('0x5')]));break;}}}}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x2233c2=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x22')],'id');return _0x5c8c96['removeChatInteractions'](_0x2233c2)[_0xe8d5('0x2b')](function(){for(var _0xf025b6=0x0;_0xf025b6<_0x2233c2[_0xe8d5('0x1b')];_0xf025b6+=0x1){_0x13e7c9[_0xe8d5('0x50')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2233c2[_0xf025b6]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x1218ff=_[_0xe8d5('0x4f')](_0x5c8c96['MailInteractions'],'id');return _0x5c8c96['removeMailInteractions'](_0x1218ff)[_0xe8d5('0x2b')](function(){for(var _0x5a64ca=0x0;_0x5a64ca<_0x1218ff[_0xe8d5('0x1b')];_0x5a64ca+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x51'),{'MailInteractionId':Number(_0x1218ff[_0x5a64ca]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x596f74=_['map'](_0x5c8c96['FaxInteractions'],'id');return _0x5c8c96[_0xe8d5('0x52')](_0x596f74)[_0xe8d5('0x2b')](function(){for(var _0x9a33b4=0x0;_0x9a33b4<_0x596f74[_0xe8d5('0x1b')];_0x9a33b4+=0x1){_0x13e7c9['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x596f74[_0x9a33b4]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x2ec9dd=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x28')],'id');return _0x5c8c96['removeSmsInteractions'](_0x2ec9dd)[_0xe8d5('0x2b')](function(){for(var _0xe7bbf1=0x0;_0xe7bbf1<_0x2ec9dd[_0xe8d5('0x1b')];_0xe7bbf1+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x53'),{'SmsInteractionId':Number(_0x2ec9dd[_0xe7bbf1]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a==='leave'){var _0x23de30=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x54')],'id');return _0x5c8c96[_0xe8d5('0x55')](_0x23de30)[_0xe8d5('0x2b')](function(){for(var _0x3e2ebe=0x0;_0x3e2ebe<_0x23de30[_0xe8d5('0x1b')];_0x3e2ebe+=0x1){_0x13e7c9[_0xe8d5('0x50')](_0xe8d5('0x56'),{'OpenchannelInteractionId':Number(_0x23de30[_0x3e2ebe]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x2b')](function(){if(_0x10de0a===_0xe8d5('0x4e')){var _0x1e1e29=_[_0xe8d5('0x4f')](_0x5c8c96[_0xe8d5('0x2a')],'id');return _0x5c8c96[_0xe8d5('0x57')](_0x1e1e29)[_0xe8d5('0x2b')](function(){for(var _0x5e28b4=0x0;_0x5e28b4<_0x1e1e29[_0xe8d5('0x1b')];_0x5e28b4+=0x1){_0x13e7c9['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1e1e29[_0x5e28b4]),'UserId':Number(_0x5c8c96['id'])});}});}})[_0xe8d5('0x58')](function(_0x501989){_0x2dc4cc[_0xe8d5('0x59')](_0x501989);});}}function onDisconnect(_0x1967dd,_0x50f81d){joinOrLeave(_0x1967dd,_0xe8d5('0x4e'),_0x50f81d);}function onConnect(_0x12d132){joinOrLeave(_0x12d132,_0xe8d5('0x5a'));}exports[_0xe8d5('0x5b')]=function(_0x2355c8){_0x2355c8['on'](_0xe8d5('0x5c'),function(_0x222dc9){_0x222dc9[_0xe8d5('0x5d')](0x0);_0x222dc9[_0xe8d5('0x5e')]=_0x222dc9[_0xe8d5('0x5f')][_0xe8d5('0x5c')][_0xe8d5('0x60')]+':'+_0x222dc9[_0xe8d5('0x5f')][_0xe8d5('0x5c')]['remotePort'];_0x222dc9['connectedAt']=new Date();_0x222dc9[_0xe8d5('0x59')]=function(_0x39dcbd){console[_0xe8d5('0x59')](_0xe8d5('0x61')+_0x222dc9[_0xe8d5('0x62')][_0xe8d5('0x5')]+'['+_0x222dc9['address']+']',_0x39dcbd);};_0x222dc9['on'](_0xe8d5('0x63'),function(){onDisconnect(_0x222dc9,_0x2355c8);_0x222dc9['log'](_0xe8d5('0x64'));});onConnect(_0x222dc9);_0x222dc9['log'](_0xe8d5('0x65'));});}; \ No newline at end of file +var _0xf562=['find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','whatsapp','telephone:%s','leave','user_has_chat_interactions:remove','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','connectedAt','log','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','handshake'];(function(_0x5ab58f,_0x3d9ecd){var _0x25dedd=function(_0x54564c){while(--_0x54564c){_0x5ab58f['push'](_0x5ab58f['shift']());}};_0x25dedd(++_0x3d9ecd);}(_0xf562,0x100));var _0x2f56=function(_0x4c3fc1,_0x480964){_0x4c3fc1=_0x4c3fc1-0x0;var _0x39d319=_0xf562[_0x4c3fc1];return _0x39d319;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var BPromise=require(_0x2f56('0x2'));var db=require(_0x2f56('0x3'))['db'];var config=require(_0x2f56('0x4'));var queryQueues={'attributes':['id',_0x2f56('0x5')],'include':[{'as':_0x2f56('0x6'),'model':db[_0x2f56('0x7')],'attributes':['id',_0x2f56('0x5'),'role'],'raw':!![],'where':{'role':_0x2f56('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2f56('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2f56('0x5')],'where':{'role':_0x2f56('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2f56('0x5'),_0x2f56('0xa')],'where':{'type':_0x2f56('0xb')}};function getAssociatedResources(_0x2975c2,_0x176c49,_0x2d549e){return db[_0x2f56('0xc')]['findOne']({'where':{'name':_0x2975c2,'userProfileId':_0x176c49},'raw':!![]})[_0x2f56('0xd')](function(_0x39572f){if(_0x39572f){if(_0x39572f['autoAssociation']){switch(_0x2975c2){case _0x2f56('0xe'):case _0x2f56('0xf'):case'FaxQueues':case _0x2f56('0x10'):case'MailQueues':case _0x2f56('0x11'):case'WhatsappQueues':return db[_0x2d549e][_0x2f56('0x12')](queryQueues);case _0x2f56('0x13'):return db[_0x2d549e][_0x2f56('0x12')](queryTelephones);case _0x2f56('0x14'):return db[_0x2d549e][_0x2f56('0x12')](queryTrunks);case _0x2f56('0x15'):return db[_0x2d549e][_0x2f56('0x12')](queryCampaigns);}}else{return db[_0x2f56('0x16')]['findAll']({'attributes':[_0x2f56('0x17')],'where':{'sectionId':_0x39572f['id']},'raw':!![]})[_0x2f56('0xd')](function(_0x11dd1e){if(_0x11dd1e){var _0x1d2463={'where':{'id':_[_0x2f56('0x18')](_0x11dd1e,'resourceId')},'raw':!![]};switch(_0x2d549e){case _0x2f56('0x7'):_0x1d2463[_0x2f56('0x19')][_0x2f56('0x1a')]=_0x2f56('0x9');break;case _0x2f56('0x1b'):_0x1d2463['where'][_0x2f56('0xa')]=_0x2f56('0xb');break;}return db[_0x2d549e][_0x2f56('0x12')](_0x1d2463);}else{return[];}});}}else{return[];}})[_0x2f56('0xd')](function(_0x45ad8c){return _0x45ad8c;});}function joinOrLeaveQueues(_0x562cea,_0x3a3161,_0x19ab8c,_0x22e2e6){_0x562cea[_0x3a3161](util[_0x2f56('0x1c')](_0x2f56('0x1d'),_0x19ab8c,_0x22e2e6[_0x2f56('0x5')]));if(_0x22e2e6[_0x2f56('0x6')]){for(var _0x349d55=0x0;_0x349d55<_0x22e2e6['Agents'][_0x2f56('0x1e')];_0x349d55+=0x1){_0x562cea[_0x3a3161](util['format']('user:%s',_0x22e2e6[_0x2f56('0x6')][_0x349d55][_0x2f56('0x5')]));}}}function joinOrLeave(_0x26d5d1,_0x4ee4c9,_0x21f4b0){var _0x433f0b;if(_0x26d5d1[_0x2f56('0x1f')]['query']['id']){db['User'][_0x2f56('0x20')]({'attributes':['id',_0x2f56('0x5'),_0x2f56('0x1a'),_0x2f56('0x21')],'where':{'id':_0x26d5d1[_0x2f56('0x1f')]['query']['id']},'include':[{'model':db[_0x2f56('0x22')],'as':_0x2f56('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x24')],'as':_0x2f56('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x26')],'as':_0x2f56('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x28')],'as':_0x2f56('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x284252){if(_0x284252){_0x433f0b=_0x284252;_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x2c'),_0x284252['name']));var _0x55685d=[];switch(_0x284252['role']){case _0x2f56('0x2d'):_0x26d5d1[_0x4ee4c9](_0x2f56('0x2e'));_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));if(queryQueues[_0x2f56('0x30')](_0x2f56('0x31'))){delete queryQueues[_0x2f56('0x31')];}_0x55685d[_0x2f56('0x32')](db['VoiceQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x33')]['findAll'](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x34')][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x35')][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['MailQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['OpenchannelQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['WhatsappQueue'][_0x2f56('0x12')](queryQueues));_0x55685d['push'](db['User'][_0x2f56('0x12')](queryTelephones));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x36')]['findAll'](queryTrunks));_0x55685d[_0x2f56('0x32')](db['Campaign'][_0x2f56('0x12')](queryCampaigns));_0x55685d['push'](db[_0x2f56('0x7')][_0x2f56('0x12')](queryAgents));break;case _0x2f56('0x37'):_0x26d5d1[_0x4ee4c9]('voice:inbound');_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0xe'),_0x284252[_0x2f56('0x21')],_0x2f56('0x38')));_0x55685d[_0x2f56('0x32')](getAssociatedResources('ChatQueues',_0x284252[_0x2f56('0x21')],_0x2f56('0x33')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x39'),_0x284252[_0x2f56('0x21')],_0x2f56('0x34')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x10'),_0x284252[_0x2f56('0x21')],'SmsQueue'));_0x55685d[_0x2f56('0x32')](getAssociatedResources('MailQueues',_0x284252[_0x2f56('0x21')],_0x2f56('0x3a')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x11'),_0x284252[_0x2f56('0x21')],_0x2f56('0x3b')));_0x55685d[_0x2f56('0x32')](getAssociatedResources('WhatsappQueues',_0x284252['userProfileId'],_0x2f56('0x3c')));_0x55685d['push'](getAssociatedResources(_0x2f56('0x13'),_0x284252[_0x2f56('0x21')],_0x2f56('0x7')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x14'),_0x284252[_0x2f56('0x21')],_0x2f56('0x36')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x15'),_0x284252['userProfileId'],'Campaign'));_0x55685d[_0x2f56('0x32')](db['User'][_0x2f56('0x12')](queryAgents));break;case _0x2f56('0x8'):_0x26d5d1[_0x4ee4c9](_0x2f56('0x2e'));_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));_0x55685d[_0x2f56('0x32')](_0x284252[_0x2f56('0x3d')]({'attributes':['id','name']}));_0x55685d['push'](_0x284252['getChatQueues']({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x3e')]({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x3f')]({'attributes':['id','name']}));_0x55685d[_0x2f56('0x32')](_0x284252['getMailQueues']({'attributes':['id',_0x2f56('0x5')]}));_0x55685d[_0x2f56('0x32')](_0x284252[_0x2f56('0x40')]({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x41')]({'attributes':['id',_0x2f56('0x5')]}));break;}return BPromise[_0x2f56('0x42')](_0x55685d);}})[_0x2f56('0xd')](function(_0x274343){if(_0x274343&&_0x274343['length']){for(var _0x1deea1=0x0;_0x1deea1<_0x274343[_0x2f56('0x1e')];_0x1deea1+=0x1){for(var _0x349f6b=0x0;_0x349f6b<_0x274343[_0x1deea1]['length'];_0x349f6b+=0x1){switch(_0x1deea1){case 0x0:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x43'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x1:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'chat',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x2:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x44'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x3:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x45'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x4:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'mail',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x5:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'openchannel',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x6:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x46'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x7:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x47'),_0x274343[_0x1deea1][_0x349f6b]['name']));break;case 0x8:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')]('trunk:%s',_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;case 0x9:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')]('campaign:%s:%s',_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0xa')],_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;case 0xa:_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x2c'),_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;}}}}})[_0x2f56('0xd')](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x5a9c12=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x23')],'id');return _0x433f0b['removeChatInteractions'](_0x5a9c12)['then'](function(){for(var _0x11ad65=0x0;_0x11ad65<_0x5a9c12[_0x2f56('0x1e')];_0x11ad65+=0x1){_0x21f4b0['emit'](_0x2f56('0x49'),{'ChatInteractionId':Number(_0x5a9c12[_0x11ad65]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x47e765=_[_0x2f56('0x18')](_0x433f0b['MailInteractions'],'id');return _0x433f0b['removeMailInteractions'](_0x47e765)[_0x2f56('0xd')](function(){for(var _0x3f3009=0x0;_0x3f3009<_0x47e765[_0x2f56('0x1e')];_0x3f3009+=0x1){_0x21f4b0[_0x2f56('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x47e765[_0x3f3009]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0xd')](function(){if(_0x4ee4c9==='leave'){var _0x3074d0=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x27')],'id');return _0x433f0b[_0x2f56('0x4b')](_0x3074d0)[_0x2f56('0xd')](function(){for(var _0x4c7bb4=0x0;_0x4c7bb4<_0x3074d0['length'];_0x4c7bb4+=0x1){_0x21f4b0[_0x2f56('0x4a')](_0x2f56('0x4c'),{'FaxInteractionId':Number(_0x3074d0[_0x4c7bb4]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x3ba3b5=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x29')],'id');return _0x433f0b[_0x2f56('0x4d')](_0x3ba3b5)[_0x2f56('0xd')](function(){for(var _0x468585=0x0;_0x468585<_0x3ba3b5[_0x2f56('0x1e')];_0x468585+=0x1){_0x21f4b0[_0x2f56('0x4a')](_0x2f56('0x4e'),{'SmsInteractionId':Number(_0x3ba3b5[_0x468585]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0xd')](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x270981=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x4f')],'id');return _0x433f0b[_0x2f56('0x50')](_0x270981)[_0x2f56('0xd')](function(){for(var _0x2fb548=0x0;_0x2fb548<_0x270981[_0x2f56('0x1e')];_0x2fb548+=0x1){_0x21f4b0[_0x2f56('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x270981[_0x2fb548]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x1a918b=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x51')],'id');return _0x433f0b[_0x2f56('0x52')](_0x1a918b)[_0x2f56('0xd')](function(){for(var _0x4c05a3=0x0;_0x4c05a3<_0x1a918b[_0x2f56('0x1e')];_0x4c05a3+=0x1){_0x21f4b0['emit'](_0x2f56('0x53'),{'WhatsappInteractionId':Number(_0x1a918b[_0x4c05a3]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0x54')](function(_0x39c4fa){_0x26d5d1['log'](_0x39c4fa);});}}function onDisconnect(_0x3988a1,_0x323fef){joinOrLeave(_0x3988a1,'leave',_0x323fef);}function onConnect(_0x4fe1d2){joinOrLeave(_0x4fe1d2,_0x2f56('0x55'));}exports[_0x2f56('0x56')]=function(_0x5d8adf){_0x5d8adf['on'](_0x2f56('0x57'),function(_0x4d503a){_0x4d503a[_0x2f56('0x58')](0x0);_0x4d503a[_0x2f56('0x59')]=_0x4d503a['request']['connection'][_0x2f56('0x5a')]+':'+_0x4d503a[_0x2f56('0x5b')]['connection']['remotePort'];_0x4d503a[_0x2f56('0x5c')]=new Date();_0x4d503a[_0x2f56('0x5d')]=function(_0x77c6ee){console[_0x2f56('0x5d')]('SocketIO\x20'+_0x4d503a[_0x2f56('0x5e')][_0x2f56('0x5')]+'['+_0x4d503a[_0x2f56('0x59')]+']',_0x77c6ee);};_0x4d503a['on'](_0x2f56('0x5f'),function(){onDisconnect(_0x4d503a,_0x5d8adf);_0x4d503a[_0x2f56('0x5d')]('DISCONNECTED');});onConnect(_0x4d503a);_0x4d503a[_0x2f56('0x5d')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4ce67d4..90f724b 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 _0xc1dd=['ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','ContactId','undefined','sequelize','query','QueryTypes','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterCreate','changed','closed','substatus','Sequelize','SELECT','AfterUpdate','find','fullname','email','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','afterCreate','newinteraction','Chat','ChatInteraction','afterUpdate','closedinteraction'];(function(_0x57eb2d,_0x5e4918){var _0xd8e18=function(_0x189389){while(--_0x189389){_0x57eb2d['push'](_0x57eb2d['shift']());}};_0xd8e18(++_0x5e4918);}(_0xc1dd,0x8c));var _0xdc1d=function(_0x27332e,_0x247ad6){_0x27332e=_0x27332e-0x0;var _0x5882fc=_0xc1dd[_0x27332e];return _0x5882fc;};'use strict';var util=require(_0xdc1d('0x0'));var db=require(_0xdc1d('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xdc1d('0x2'))(_0xdc1d('0x3'));var client=jayson[_0xdc1d('0x4')][_0xdc1d('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0xdc1d('0x6'),'condition':_0xdc1d('0x7'),'callback':afterCreate},{'channel':_0xdc1d('0x8'),'model':_0xdc1d('0x9'),'event':_0xdc1d('0xa'),'condition':_0xdc1d('0xb'),'callback':afterUpdate},{'channel':_0xdc1d('0x8'),'model':_0xdc1d('0xc'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xdc1d('0x8'),'model':_0xdc1d('0xd'),'event':_0xdc1d('0x6'),'condition':_0xdc1d('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0xdc1d('0xf'),'model':_0xdc1d('0x10'),'event':_0xdc1d('0x6'),'condition':_0xdc1d('0x7'),'callback':afterCreate},{'channel':_0xdc1d('0xf'),'model':'SmsInteraction','event':_0xdc1d('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0xdc1d('0x6'),'condition':_0xdc1d('0xe'),'callback':afterCreateMessage},{'channel':_0xdc1d('0x11'),'model':_0xdc1d('0x12'),'event':_0xdc1d('0x6'),'condition':_0xdc1d('0x7'),'callback':afterCreate},{'channel':_0xdc1d('0x11'),'model':_0xdc1d('0x12'),'event':_0xdc1d('0xa'),'condition':_0xdc1d('0xb'),'callback':afterUpdate},{'channel':_0xdc1d('0x11'),'model':_0xdc1d('0x13'),'event':_0xdc1d('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xdc1d('0x14'),'model':'FaxInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0xdc1d('0x15'),'event':_0xdc1d('0xa'),'condition':_0xdc1d('0xb'),'callback':afterUpdate},{'channel':'Fax','model':_0xdc1d('0x16'),'event':'afterCreate','condition':_0xdc1d('0xe'),'callback':afterCreateMessage},{'channel':_0xdc1d('0x17'),'model':_0xdc1d('0x18'),'event':_0xdc1d('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xdc1d('0x17'),'model':_0xdc1d('0x18'),'event':'afterUpdate','condition':_0xdc1d('0xb'),'callback':afterUpdate},{'channel':_0xdc1d('0x17'),'model':_0xdc1d('0x19'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xdc1d('0x1a'),'model':'OpenchannelInteraction','event':_0xdc1d('0x6'),'condition':_0xdc1d('0x7'),'callback':afterCreate},{'channel':_0xdc1d('0x1a'),'model':_0xdc1d('0x1b'),'event':_0xdc1d('0xa'),'condition':_0xdc1d('0xb'),'callback':afterUpdate},{'channel':_0xdc1d('0x1a'),'model':'OpenchannelMessage','event':_0xdc1d('0x6'),'condition':_0xdc1d('0xe'),'callback':afterCreateMessage}];function request(_0x143872){return client['request']('EventManager',_0x143872)[_0xdc1d('0x1c')](function(_0x593013){logger[_0xdc1d('0x1d')](_0xdc1d('0x1e'),_0xdc1d('0x1f'),_0x593013);if(_0x593013[_0xdc1d('0x20')]){if(_0x593013['error'][_0xdc1d('0x21')]===0x1f4){logger[_0xdc1d('0x20')](_0xdc1d('0x1e'),_0xdc1d('0x1f'),_0x593013[_0xdc1d('0x20')]);}}})[_0xdc1d('0x22')](function(_0x5da130){logger[_0xdc1d('0x20')](_0xdc1d('0x1e'),_0xdc1d('0x1f'),_0x5da130);});}function afterCreateMessage(_0x502676){return function(_0x105ff0){_0x105ff0=_0x105ff0[_0xdc1d('0x23')]({'plain':!![]});_0x105ff0[_0xdc1d('0x24')]=_0x502676;_0x105ff0[_0xdc1d('0x25')]=_0x502676;_0x105ff0[_0xdc1d('0x26')]=_0x105ff0['direction'];Promise['resolve']()[_0xdc1d('0x1c')](function(){if(typeof _0x105ff0[_0xdc1d('0x27')]===_0xdc1d('0x28'))return null;var _0x49d2bd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x105ff0[_0xdc1d('0x27')];return db[_0xdc1d('0x29')][_0xdc1d('0x2a')](_0x49d2bd,{'type':db['Sequelize'][_0xdc1d('0x2b')]['SELECT'],'raw':!![]});})[_0xdc1d('0x1c')](function(_0x580ae5){if(_0x580ae5){_0x105ff0[_0xdc1d('0x2c')]=_0x580ae5[0x0];}if(typeof _0x105ff0['UserId']===_0xdc1d('0x28'))return;return getAgent(_0x105ff0[_0xdc1d('0x2d')]);})[_0xdc1d('0x1c')](function(_0x35ebad){if(_0x35ebad){_0x105ff0[_0xdc1d('0x2e')]=util[_0xdc1d('0x2f')](_0xdc1d('0x30'),_0x35ebad[_0xdc1d('0x31')]);_0x105ff0[_0xdc1d('0x32')]=_0x35ebad;_0x105ff0[_0xdc1d('0x24')]=_0x502676;return request({'event':_0xdc1d('0x33'),'message':_0x105ff0});}else{return request({'event':_0xdc1d('0x34'),'message':_0x105ff0});}})[_0xdc1d('0x22')](function(_0xd3700){logger[_0xdc1d('0x20')](_0xdc1d('0x1e'),_0xdc1d('0x35'),_0xd3700);});};}function afterCreateOfflineMessage(_0x186a56){return function(_0x1171c5){_0x1171c5=_0x1171c5['get']({'plain':!![]});_0x1171c5['channel']=_0x186a56;_0x1171c5['motionChannel']=_0x186a56;_0x1171c5['event']=_0xdc1d('0x36');return request({'event':_0x1171c5[_0xdc1d('0x26')],'message':_0x1171c5});};}function afterCreate(_0x2fe18b,_0x5997fc){return function(_0x3aa419){_0x3aa419=_0x3aa419['get']({'plain':!![]});_0x3aa419[_0xdc1d('0x24')]=_0x2fe18b;_0x3aa419['motionChannel']=_0x2fe18b;_0x3aa419[_0xdc1d('0x26')]=_0xdc1d('0x37');Promise[_0xdc1d('0x38')]()[_0xdc1d('0x1c')](function(){var _0x53a63b=_0xdc1d('0x39')+_0x3aa419[_0xdc1d('0x27')];return db['sequelize'][_0xdc1d('0x2a')](_0x53a63b,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x458d12){if(_0x458d12){_0x3aa419[_0xdc1d('0x2c')]=_0x458d12[0x0];}if(typeof _0x3aa419[_0xdc1d('0x2d')]===_0xdc1d('0x28'))return;return getAgent(_0x3aa419['UserId']);})['then'](function(_0x5e36bc){if(_0x5e36bc){_0x3aa419[_0xdc1d('0x2e')]=util[_0xdc1d('0x2f')](_0xdc1d('0x30'),_0x5e36bc[_0xdc1d('0x31')]);_0x3aa419[_0xdc1d('0x32')]=_0x5e36bc;}return request({'event':_0x5997fc,'message':_0x3aa419});})[_0xdc1d('0x22')](function(_0xc94ba){logger[_0xdc1d('0x20')]('Trigger,\x20%s',_0xdc1d('0x3a'),_0xc94ba);});};}function afterUpdate(_0x3aeea5){return function(_0x5b7dc0){var _0x4f71fe=_0x5b7dc0[_0xdc1d('0x3b')](_0xdc1d('0x3c'))&&_0x5b7dc0[_0xdc1d('0x3c')];var _0x6c99b=_0x5b7dc0[_0xdc1d('0x3b')](_0xdc1d('0x3d'));if(_0x4f71fe||_0x6c99b){var _0x14b661=_0x4f71fe?_0xdc1d('0xb'):'substatus';var _0xfc148b=_0x5b7dc0[_0xdc1d('0x23')]({'plain':!![]});_0xfc148b[_0xdc1d('0x24')]=_0x3aeea5;_0xfc148b[_0xdc1d('0x25')]=_0x3aeea5;_0xfc148b[_0xdc1d('0x26')]=_0x4f71fe?_0xdc1d('0x3c'):_0xdc1d('0x3d');var _0x25e6b0=_0xdc1d('0x39')+_0xfc148b['ContactId'];return db[_0xdc1d('0x29')][_0xdc1d('0x2a')](_0x25e6b0,{'type':db[_0xdc1d('0x3e')][_0xdc1d('0x2b')][_0xdc1d('0x3f')],'raw':!![]})['then'](function(_0x482c12){if(_0x482c12){_0xfc148b[_0xdc1d('0x2c')]=_0x482c12[0x0];}if(typeof _0xfc148b[_0xdc1d('0x2d')]===_0xdc1d('0x28'))return;return getAgent(_0xfc148b[_0xdc1d('0x2d')]);})[_0xdc1d('0x1c')](function(_0x17a271){if(_0x17a271){_0xfc148b[_0xdc1d('0x2e')]=util[_0xdc1d('0x2f')](_0xdc1d('0x30'),_0x17a271[_0xdc1d('0x31')]);_0xfc148b['agent']=_0x17a271;}return request({'event':_0x14b661,'message':_0xfc148b});})['catch'](function(_0x16c317){logger[_0xdc1d('0x20')]('Trigger,\x20%s',_0xdc1d('0x40'),_0x16c317);});}};}function getAgent(_0x1ba1cb){return db['User'][_0xdc1d('0x41')]({'where':{'id':_0x1ba1cb},'attributes':['id',_0xdc1d('0x31'),_0xdc1d('0x42'),_0xdc1d('0x43'),'internal'],'raw':!![]})[_0xdc1d('0x1c')](function(_0x2f9bbe){return _0x2f9bbe;});}exports[_0xdc1d('0x44')]=function(){for(var _0x48b4cd=0x0;_0x48b4cd=_0x11fe97[_0xedf7('0x10')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x26fbe3(_0x3ed0ed);})[_0xedf7('0x11')](function(_0x3f685c){_0x3b186e(_0x3f685c);});});}; \ No newline at end of file +var _0x5af2=['voice','chat','fax','sms','whatsapp','openchannel','toLowerCase','isUndefined','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','./license/util'];(function(_0x3ddf16,_0x76f985){var _0x353de4=function(_0x49c878){while(--_0x49c878){_0x3ddf16['push'](_0x3ddf16['shift']());}};_0x353de4(++_0x76f985);}(_0x5af2,0x107));var _0x25af=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5af2[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var BPromise=require(_0x25af('0x0'));var db=require(_0x25af('0x1'))['db'];var util=require(_0x25af('0x2'));var channels=[_0x25af('0x3'),'mail',_0x25af('0x4'),_0x25af('0x5'),_0x25af('0x6'),_0x25af('0x7'),_0x25af('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x20eb29){_0x20eb29=_0x20eb29[_0x25af('0x9')]();return _['includes'](channels,_0x20eb29);};exports['clearBlockUser']=function(_0x593566,_0x5905a7,_0x2927c2,_0x389cb6){var _0x2aacaf={'loginAttempts':_0x5905a7,'blocked':_0x2927c2};if(!_[_0x25af('0xa')](_0x389cb6)){_0x2aacaf['blockedAt']=_0x389cb6;}return _0x593566['updateAttributes'](_0x2aacaf);};exports[_0x25af('0xb')]=function(_0x51d950){return new BPromise(function(_0x19651e,_0x141791){var _0x8fdf12=0x0;if(_0x51d950[_0x25af('0xc')]!=='agent'){_0x19651e(_0x51d950);}db[_0x25af('0xd')][_0x25af('0xe')]({'where':{'role':_0x25af('0xf'),'online':!![],'id':{'$ne':_0x51d950['id']}}})['then'](function(_0x2a5704){_0x8fdf12=_0x2a5704;return util[_0x25af('0xb')]();})[_0x25af('0x10')](function(_0x8928b3){if(_0x8928b3&&_0x8928b3[_0x25af('0x11')]&&_0x8fdf12>=_0x8928b3['agents']){throw Error(_0x25af('0x12'));}_0x19651e(_0x51d950);})['catch'](function(_0x1cf526){_0x141791(_0x1cf526);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 906adbc..341ef7e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Forbidden','OutOfInterval','status','exports','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Entity\x20not\x20found','Not\x20Found'];(function(_0x53b331,_0x37a3f2){var _0x5e3965=function(_0x250ad5){while(--_0x250ad5){_0x53b331['push'](_0x53b331['shift']());}};_0x5e3965(++_0x37a3f2);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x49c4('0x0'));var APIError=function(_0x18bf2d,_0x26844b){this[_0x49c4('0x1')]=_0x18bf2d||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x26844b||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x41a183){this['message']=_0x41a183||_0x49c4('0x4');this[_0x49c4('0x3')]=_0x49c4('0x4');util[_0x49c4('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x436234){this['message']=_0x436234||_0x49c4('0x6');this[_0x49c4('0x3')]=_0x49c4('0x7');util[_0x49c4('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4c7d3a){switch(_0x4c7d3a){case'Bad\x20Request':return 0x190;case _0x49c4('0x8'),_0x49c4('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0xb611a1){return function(_0x459d09){logger['error'](_0x459d09['stack']);var _0x1d19bf=getStatusCode(_0x459d09[_0x49c4('0x3')]);if(_0x459d09['name'])delete _0x459d09[_0x49c4('0x3')];return _0xb611a1[_0x49c4('0xa')](_0x1d19bf)['send'](_0x459d09);};}module[_0x49c4('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb688=['status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','Error','inherits','name','Entity\x20not\x20found','Not\x20Found','Bad\x20Request','Forbidden','OutOfInterval','error','stack'];(function(_0x3e3c7a,_0x381151){var _0x25436a=function(_0x44f95c){while(--_0x44f95c){_0x3e3c7a['push'](_0x3e3c7a['shift']());}};_0x25436a(++_0x381151);}(_0xb688,0xcf));var _0x8b68=function(_0x442cd2,_0x211340){_0x442cd2=_0x442cd2-0x0;var _0x265e60=_0xb688[_0x442cd2];return _0x265e60;};'use strict';var util=require('util');var logger=require(_0x8b68('0x0'))(_0x8b68('0x1'));var APIError=function(_0x266285,_0x1080e8){this[_0x8b68('0x2')]=_0x266285||_0x8b68('0x3');this['name']=_0x1080e8||_0x8b68('0x4');util[_0x8b68('0x5')](APIError,Error);};var APIBadRequestError=function(_0x30f33d){this[_0x8b68('0x2')]=_0x30f33d||'Bad\x20Request';this[_0x8b68('0x6')]='Bad\x20Request';util[_0x8b68('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x2bbffd){this[_0x8b68('0x2')]=_0x2bbffd||_0x8b68('0x7');this[_0x8b68('0x6')]=_0x8b68('0x8');util[_0x8b68('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x21d944){switch(_0x21d944){case _0x8b68('0x9'):return 0x190;case _0x8b68('0xa'),_0x8b68('0xb'):return 0x193;case _0x8b68('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2a852a){return function(_0x502727){logger[_0x8b68('0xc')](_0x502727[_0x8b68('0xd')]);var _0x5e76c=getStatusCode(_0x502727[_0x8b68('0x6')]);if(_0x502727[_0x8b68('0x6')])delete _0x502727[_0x8b68('0x6')];return _0x2a852a[_0x8b68('0xe')](_0x5e76c)[_0x8b68('0xf')](_0x502727);};}module[_0x8b68('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b32f6ce..5eebff9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e3b=['exports','404','status','render','send'];(function(_0xb02995,_0x2d689b){var _0x24c8bd=function(_0x40b921){while(--_0x40b921){_0xb02995['push'](_0xb02995['shift']());}};_0x24c8bd(++_0x2d689b);}(_0x8e3b,0xaa));var _0xb8e3=function(_0x127c7e,_0x470192){_0x127c7e=_0x127c7e-0x0;var _0x45f955=_0x8e3b[_0x127c7e];return _0x45f955;};'use strict';module[_0xb8e3('0x0')][0x194]=function pageNotFound(_0x477dfa,_0x19607d){var _0x74d80c=_0xb8e3('0x1');var _0x29489a=0x194;var _0xaa75da={'status':_0x29489a};_0x19607d[_0xb8e3('0x2')](_0xaa75da['status']);_0x19607d[_0xb8e3('0x3')](_0x74d80c,{},function(_0x5cda82,_0x258b78){if(_0x5cda82){return _0x19607d[_0xb8e3('0x2')](_0xaa75da[_0xb8e3('0x2')])['json'](_0xaa75da);}_0x19607d[_0xb8e3('0x4')](_0x258b78);});}; \ No newline at end of file +var _0xf88a=['json','send','exports','404','status','render'];(function(_0x2ea174,_0xb3181){var _0x5987c7=function(_0x3f7c44){while(--_0x3f7c44){_0x2ea174['push'](_0x2ea174['shift']());}};_0x5987c7(++_0xb3181);}(_0xf88a,0x1e8));var _0xaf88=function(_0x208798,_0x1dfbd4){_0x208798=_0x208798-0x0;var _0x2e76c8=_0xf88a[_0x208798];return _0x2e76c8;};'use strict';module[_0xaf88('0x0')][0x194]=function pageNotFound(_0x51b661,_0x53ae3d){var _0x442321=_0xaf88('0x1');var _0x57d867=0x194;var _0x417bda={'status':_0x57d867};_0x53ae3d['status'](_0x417bda[_0xaf88('0x2')]);_0x53ae3d[_0xaf88('0x3')](_0x442321,{},function(_0x22bfdc,_0x319910){if(_0x22bfdc){return _0x53ae3d[_0xaf88('0x2')](_0x417bda[_0xaf88('0x2')])[_0xaf88('0x4')](_0x417bda);}_0x53ae3d[_0xaf88('0x5')](_0x319910);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f9886bf..1036d18 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2345=['OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','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','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','UserNotification','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','MailInteractions','user_has_chat_interactions','FaxInteraction','FaxInteractions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','ChatQueues','SmsQueue','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','CmHopperHistory','HopperHistories','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','hasOne','Smtp','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','ChatOfflineMessageId','DashboardItem','Items','Dispositions','FaxAccountId','Answers','Exntensions','FaxApplication','TagId','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ChatProactiveAction','ProactiveActions','OpenchannelQueueReport','Agent','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmContactId','JscriptySessions','Company','cm_contact_has_tags','CmHopperId','Queue','CampaignId','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','CmContactHasItem','ContactItemType','ItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','DeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesConfiguration','FreshsalesField','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','SquareProject','user_has_teams','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','jstz','determine','sequelize','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','127.0.0.1','database','username','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/faxTransferReport/faxTransferReport.model'];(function(_0x45441a,_0x47e391){var _0x3637bf=function(_0x3e0f4e){while(--_0x3e0f4e){_0x45441a['push'](_0x45441a['shift']());}};_0x3637bf(++_0x47e391);}(_0x2345,0x11a));var _0x5234=function(_0x310b68,_0x4eef50){_0x310b68=_0x310b68-0x0;var _0x4a2316=_0x2345[_0x310b68];return _0x4a2316;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x5234('0x0'));var timezone=jstz[_0x5234('0x1')]();config[_0x5234('0x2')]=_['defaultsDeep'](config[_0x5234('0x2')],{'database':'motion2','username':'xcall','password':_0x5234('0x3'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x5234('0x4'),'dialectOptions':{'charset':_0x5234('0x5')},'logging':![],'timezone':timezone[_0x5234('0x6')](),'define':{'charset':_0x5234('0x7'),'collate':_0x5234('0x8')}}});config[_0x5234('0x9')]=_['defaultsDeep'](config[_0x5234('0x9')],{'database':_0x5234('0xa'),'username':_0x5234('0xb'),'password':'xC@LL1234','options':{'host':_0x5234('0xc'),'port':0xcea,'dialect':_0x5234('0x4'),'dialectOptions':{'charset':_0x5234('0x5')},'logging':![],'timezone':timezone[_0x5234('0x6')](),'define':{'charset':_0x5234('0x7'),'collate':_0x5234('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5234('0x2')][_0x5234('0xd')],config[_0x5234('0x2')][_0x5234('0xe')],config[_0x5234('0x2')]['password'],config['sequelize'][_0x5234('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5234('0x9')][_0x5234('0xd')],config['sequelizeHistory'][_0x5234('0xe')],config[_0x5234('0x9')]['password'],config[_0x5234('0x9')][_0x5234('0xf')])};db[_0x5234('0x10')]=db[_0x5234('0x2')]['import'](_0x5234('0x11'));db[_0x5234('0x12')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x14'));db[_0x5234('0x15')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x16'));db['VoiceExtension']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x17'));db[_0x5234('0x18')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x19'));db[_0x5234('0x1a')]=db[_0x5234('0x2')]['import'](_0x5234('0x1b'));db['VoiceRecording']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/screenRecording/screenRecording.model');db[_0x5234('0x1c')]=db['sequelize']['import'](_0x5234('0x1d'));db[_0x5234('0x1e')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x1f'));db['VoiceCallReport']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x20'));db[_0x5234('0x21')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x22'));db[_0x5234('0x23')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x24'));db[_0x5234('0x25')]=db[_0x5234('0x2')]['import'](_0x5234('0x26'));db[_0x5234('0x27')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x28'));db[_0x5234('0x29')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x2a'));db[_0x5234('0x2b')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x5234('0x2c')]=db['sequelize'][_0x5234('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x5234('0x2d')]=db['sequelize'][_0x5234('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x5234('0x2e')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x2f'));db[_0x5234('0x30')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x31'));db['UserSmsQueue']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x32'));db[_0x5234('0x33')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x34'));db[_0x5234('0x35')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x36'));db[_0x5234('0x37')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x38'));db[_0x5234('0x39')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x5234('0x3a')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x3b'));db[_0x5234('0x3c')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/mailQueue/mailQueue.model');db[_0x5234('0x3d')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x3e'));db[_0x5234('0x3f')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x40'));db[_0x5234('0x41')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x42'));db[_0x5234('0x43')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x44'));db[_0x5234('0x45')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x46'));db[_0x5234('0x47')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x48'));db['DashboardItem']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x49'));db[_0x5234('0x4a')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x4b'));db['FaxApplication']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x4c'));db['FaxInteraction']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x4d'));db[_0x5234('0x4e')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/faxMessage/faxMessage.model');db[_0x5234('0x4f')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x50'));db[_0x5234('0x51')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x52'));db[_0x5234('0x53')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x54'));db[_0x5234('0x55')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x56'));db[_0x5234('0x57')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x58'));db[_0x5234('0x59')]=db['sequelize']['import'](_0x5234('0x5a'));db['SmsQueue']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x5b'));db[_0x5234('0x5c')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x5d'));db['OpenchannelApplication']=db['sequelize'][_0x5234('0x13')](_0x5234('0x5e'));db[_0x5234('0x5f')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x60'));db[_0x5234('0x61')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x62'));db[_0x5234('0x63')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x64'));db[_0x5234('0x65')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x66'));db['OpenchannelQueueReport']=db[_0x5234('0x2')]['import'](_0x5234('0x67'));db[_0x5234('0x68')]=db[_0x5234('0x2')]['import']('../api/chatApplication/chatApplication.model');db[_0x5234('0x69')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x6a'));db[_0x5234('0x6b')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x6c'));db['ChatOfflineMessage']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5234('0x6d')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x6e'));db['ChatGroup']=db[_0x5234('0x2')]['import'](_0x5234('0x6f'));db['ChatProactiveAction']=db['sequelize'][_0x5234('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x5234('0x70')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x71'));db[_0x5234('0x72')]=db[_0x5234('0x2')]['import'](_0x5234('0x73'));db[_0x5234('0x74')]=db['sequelize']['import'](_0x5234('0x75'));db[_0x5234('0x76')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x77'));db['CmHopperFinal']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x78'));db['CmHopperHistory']=db[_0x5234('0x2')]['import'](_0x5234('0x79'));db[_0x5234('0x7a')]=db[_0x5234('0x2')]['import'](_0x5234('0x7b'));db[_0x5234('0x7c')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x7d'));db['Action']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x7e'));db[_0x5234('0x7f')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x80'));db[_0x5234('0x81')]=db[_0x5234('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x5234('0x82')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x83'));db[_0x5234('0x84')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x85'));db['Interval']=db[_0x5234('0x2')]['import'](_0x5234('0x86'));db[_0x5234('0x87')]=db[_0x5234('0x2')]['import'](_0x5234('0x88'));db[_0x5234('0x89')]=db['sequelize'][_0x5234('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8a'));db[_0x5234('0x8b')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8c'));db['Sound']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/sound/sound.model');db['Tag']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8d'));db['ContactItemType']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x8e'));db['CmContactHasItem']=db['sequelize']['import'](_0x5234('0x8f'));db[_0x5234('0x90')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x91'));db['Template']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x92'));db['Trigger']=db['sequelize'][_0x5234('0x13')](_0x5234('0x93'));db[_0x5234('0x94')]=db['sequelize']['import']('../api/variable/variable.model');db[_0x5234('0x95')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/integration/integration.model');db[_0x5234('0x96')]=db[_0x5234('0x2')]['import'](_0x5234('0x97'));db[_0x5234('0x98')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x5234('0x99')]=db['sequelize'][_0x5234('0x13')](_0x5234('0x9a'));db['AnalyticExtractedReport']=db[_0x5234('0x2')]['import'](_0x5234('0x9b'));db[_0x5234('0x9c')]=db[_0x5234('0x2')]['import'](_0x5234('0x9d'));db['AnalyticFieldReport']=db['sequelize']['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x5234('0x9e')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x9f'));db[_0x5234('0xa0')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xa1'));db[_0x5234('0xa2')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x5234('0xa3')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xa4'));db[_0x5234('0xa5')]=db['sequelize'][_0x5234('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x5234('0xa6')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x5234('0xa7')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xa8'));db['DeskAccount']=db['sequelize'][_0x5234('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x5234('0xa9')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xaa'));db[_0x5234('0xab')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xac'));db[_0x5234('0xad')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xae'));db[_0x5234('0xaf')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x5234('0xb0')]=db['sequelize']['import'](_0x5234('0xb1'));db[_0x5234('0xb2')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xb3'));db[_0x5234('0xb4')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x5234('0xb5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xb6'));db[_0x5234('0xb7')]=db[_0x5234('0x2')]['import'](_0x5234('0xb8'));db[_0x5234('0xb9')]=db[_0x5234('0x2')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x5234('0xba')]=db['sequelize']['import'](_0x5234('0xbb'));db[_0x5234('0xbc')]=db[_0x5234('0x2')]['import'](_0x5234('0xbd'));db['VtigerConfiguration']=db['sequelize'][_0x5234('0x13')](_0x5234('0xbe'));db['VtigerField']=db['sequelize'][_0x5234('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x5234('0xbf')]=db[_0x5234('0x2')]['import'](_0x5234('0xc0'));db['ServicenowConfiguration']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc1'));db[_0x5234('0xc2')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xc3'));db['Dynamics365Account']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc4'));db[_0x5234('0xc5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc6'));db[_0x5234('0xc7')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xc8'));db[_0x5234('0xc9')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xca'));db['FreshsalesConfiguration']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xcb'));db[_0x5234('0x95')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xcc'));db['Network']=db[_0x5234('0x2')]['import'](_0x5234('0xcd'));db[_0x5234('0xce')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x5234('0xcf')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xd0'));db[_0x5234('0xd1')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xd2'));db['JscriptyQuestionReport']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xd3'));db[_0x5234('0xd4')]=db['sequelize']['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x5234('0xd5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xd6'));db[_0x5234('0xd7')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xd8'));db[_0x5234('0xd9')]=db[_0x5234('0x2')]['import'](_0x5234('0xda'));db['JscriptyProject']=db['sequelize']['import'](_0x5234('0xdb'));db[_0x5234('0xdc')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xdd'));db[_0x5234('0xde')]=db[_0x5234('0x2')]['import'](_0x5234('0xdf'));db['SquareProject']=db[_0x5234('0x2')]['import'](_0x5234('0xe0'));db['SquareRecording']=db['sequelize'][_0x5234('0x13')]('../api/squareRecording/squareRecording.model');db[_0x5234('0xe1')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/squareMessage/squareMessage.model');db[_0x5234('0xe2')]=db[_0x5234('0x2')]['import'](_0x5234('0xe3'));db[_0x5234('0xe4')]=db['sequelize']['import']('../api/license/license.model');db[_0x5234('0xe5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xe6'));db['Migration']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xe7'));db[_0x5234('0xe8')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xe9'));db[_0x5234('0xea')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xeb'));db[_0x5234('0xec')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xed'));db['ChatTransferReport']=db[_0x5234('0x2')][_0x5234('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x5234('0x2')]['import'](_0x5234('0xee'));db[_0x5234('0xef')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf0'));db[_0x5234('0xf1')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf2'));db['CmList']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf3'));db[_0x5234('0xf4')]=db[_0x5234('0x2')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x5234('0xf5')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf6'));db['UserProfileSection']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf7'));db[_0x5234('0xf8')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xf9'));db['UserNotification']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xfa'));db['WhatsappAccount']=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0xfb'));db[_0x5234('0xfc')]=db['sequelize'][_0x5234('0x13')](_0x5234('0xfd'));db[_0x5234('0xfe')]=db[_0x5234('0x2')][_0x5234('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x5234('0xff')]=db[_0x5234('0x2')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x5234('0x100')]=db['sequelize'][_0x5234('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x5234('0x101')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x102'));db[_0x5234('0x103')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x104'));db[_0x5234('0x105')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x106'));db[_0x5234('0x107')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x108'));db[_0x5234('0x109')]=db[_0x5234('0x2')][_0x5234('0x13')](_0x5234('0x10a'));db['UserVoicePrefix']=db[_0x5234('0x2')]['import'](_0x5234('0x10b'));db[_0x5234('0x10c')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db[_0x5234('0x10')]['hasOne'](db[_0x5234('0x1c')],{'as':_0x5234('0x1c'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x10e')});db['User']['hasOne'](db[_0x5234('0x10c')],{'as':_0x5234('0x10f'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db[_0x5234('0x111')],{'as':_0x5234('0x112'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db[_0x5234('0x2c')],{'as':_0x5234('0x113'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')]['hasMany'](db[_0x5234('0x114')],{'as':_0x5234('0x115'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db['User'][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':_0x5234('0x10e')});db['User'][_0x5234('0x110')](db['CmHopperHistory'],{'as':_0x5234('0x117'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')]['hasMany'](db[_0x5234('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db[_0x5234('0x5f')],{'as':_0x5234('0x118'),'foreignKey':_0x5234('0x10e')});db['User'][_0x5234('0x110')](db[_0x5234('0x69')],{'as':_0x5234('0x119'),'foreignKey':'UserId'});db['User'][_0x5234('0x110')](db['SmsInteraction'],{'as':_0x5234('0x11a'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')][_0x5234('0x110')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x5234('0x10e')});db[_0x5234('0x10')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db['User'][_0x5234('0x110')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x5234('0x10e')});db['User'][_0x5234('0x110')](db[_0x5234('0x11b')],{'as':_0x5234('0x11c'),'foreignKey':_0x5234('0x11d')});db[_0x5234('0x10')][_0x5234('0x11e')](db[_0x5234('0xf5')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x120')],{'as':'Groups','through':_0x5234('0x121')});db[_0x5234('0x10')][_0x5234('0x11f')](db['CmContact'],{'as':_0x5234('0x122'),'through':_0x5234('0x123')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x124')],{'as':_0x5234('0x125'),'through':_0x5234('0x126')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':'user_has_teams'});db[_0x5234('0x10')][_0x5234('0x11f')](db['MailInteraction'],{'as':_0x5234('0x127'),'through':'user_has_mail_interactions'});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x69')],{'as':_0x5234('0x119'),'through':_0x5234('0x128')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x129')],{'as':_0x5234('0x12a'),'through':'user_has_fax_interactions'});db[_0x5234('0x10')][_0x5234('0x11f')](db['SmsInteraction'],{'as':_0x5234('0x11a'),'through':_0x5234('0x12b')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x5f')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0xfe')],{'as':_0x5234('0x12c'),'through':_0x5234('0x12d')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x1a')],{'as':_0x5234('0x12e'),'through':_0x5234('0x12f'),'required':![]});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0xf4')],{'as':_0x5234('0x130'),'through':_0x5234('0x131'),'required':![]});db['User'][_0x5234('0x11f')](db['MailQueue'],{'as':'MailQueues','through':_0x5234('0x2e'),'required':![]});db['User'][_0x5234('0x11f')](db['ChatQueue'],{'as':_0x5234('0x132'),'through':_0x5234('0x2d'),'required':![],'hooks':!![]});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x4f')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x133')],{'as':_0x5234('0x134'),'through':'UserSmsQueue','required':![]});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x63')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x5234('0x10')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x5234('0x135'),'through':'UserWhatsappQueue','required':![]});db[_0x5234('0x10')][_0x5234('0x11f')](db['CmList'],{'through':_0x5234('0x126')});db[_0x5234('0x10')][_0x5234('0x11f')](db['ChatWebsite'],{'as':_0x5234('0x136'),'through':_0x5234('0x137')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x4a')],{'as':_0x5234('0x138'),'through':_0x5234('0x139')});db[_0x5234('0x10')]['belongsToMany'](db[_0x5234('0x3a')],{'as':_0x5234('0x13a'),'through':_0x5234('0x13b')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x5c')],{'as':'OpenchannelAccounts','through':_0x5234('0x13c')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x53')],{'as':_0x5234('0x13d'),'through':_0x5234('0x13e')});db[_0x5234('0x10')][_0x5234('0x11f')](db[_0x5234('0x13f')],{'as':_0x5234('0x140'),'through':_0x5234('0x141')});db['User'][_0x5234('0x11f')](db['SquareProject'],{'as':'SquareProjects','through':_0x5234('0x142')});db[_0x5234('0x12')]['hasMany'](db[_0x5234('0x114')],{'as':_0x5234('0x143'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x144')});db[_0x5234('0x15')][_0x5234('0x110')](db['VoiceExtension'],{'onDelete':_0x5234('0x10d')});db[_0x5234('0x114')][_0x5234('0x110')](db[_0x5234('0x114')],{'as':_0x5234('0x145'),'onDelete':'cascade'});db[_0x5234('0x18')][_0x5234('0x11f')](db[_0x5234('0x146')],{'as':_0x5234('0x147'),'through':_0x5234('0x148')});db[_0x5234('0x1a')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x5234('0x149'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x5234('0x14b'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')]['hasMany'](db[_0x5234('0x116')],{'as':_0x5234('0x14c'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')][_0x5234('0x110')](db[_0x5234('0x14d')],{'as':_0x5234('0x14e'),'foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')][_0x5234('0x110')](db[_0x5234('0x7a')],{'as':_0x5234('0x7a'),'foreignKey':'VoiceQueueId'});db[_0x5234('0x1a')]['hasMany'](db[_0x5234('0x76')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x5234('0x1a')][_0x5234('0x110')](db[_0x5234('0xd4')],{'as':'JscriptySessions','foreignKey':_0x5234('0x14a')});db[_0x5234('0x1a')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x29'),'foreignKey':_0x5234('0x14f')});db[_0x5234('0x1a')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x150'),'foreignKey':_0x5234('0x151')});db[_0x5234('0x1a')][_0x5234('0x11e')](db[_0x5234('0x152')],{'as':_0x5234('0x152'),'foreignKey':_0x5234('0x153')});db[_0x5234('0x1a')][_0x5234('0x11e')](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x5234('0x11f')](db['CmList'],{'as':_0x5234('0x125'),'through':_0x5234('0x155')});db['VoiceQueue'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':'Agents','through':_0x5234('0x12f')});db['VoiceQueue'][_0x5234('0x11f')](db[_0x5234('0xe2')],{'as':'Teams','through':_0x5234('0x107')});db[_0x5234('0x1a')][_0x5234('0x11f')](db[_0x5234('0x124')],{'as':_0x5234('0x156'),'through':'voice_queues_has_cm_blacklists'});db[_0x5234('0x111')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x157')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x5234('0x10e')});db[_0x5234('0x1c')][_0x5234('0x110')](db['VoiceMailMessage'],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x159'),'sourceKey':_0x5234('0x15a')});db['VoiceMailMessage'][_0x5234('0x11e')](db['VoiceMail'],{'foreignKey':_0x5234('0x159'),'targetKey':'mailbox'});db[_0x5234('0x15b')][_0x5234('0x110')](db[_0x5234('0x25')],{'as':_0x5234('0x15c'),'foreignKey':_0x5234('0x15d'),'constraints':![]});db[_0x5234('0x15b')][_0x5234('0x110')](db[_0x5234('0x23')],{'as':_0x5234('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0x5234('0x15b')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10'),'foreignKey':'UserId'});db[_0x5234('0x15b')][_0x5234('0x11e')](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db['MailServerIn'][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':_0x5234('0x3a'),'foreignKey':_0x5234('0x161')});db['MailServerIn'][_0x5234('0x11e')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x5234('0x162'),'onDelete':_0x5234('0x163')});db['MailServerOut'][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x5234('0x39')][_0x5234('0x11e')](db[_0x5234('0x105')],{'as':_0x5234('0x105'),'foreignKey':_0x5234('0x162'),'onDelete':_0x5234('0x163')});db[_0x5234('0x3a')]['hasOne'](db['MailServerIn'],{'as':_0x5234('0x164'),'onDelete':'cascade'});db[_0x5234('0x3a')][_0x5234('0x165')](db[_0x5234('0x39')],{'as':_0x5234('0x166'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x3a')][_0x5234('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5234('0x161'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x5234('0x81')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x5234('0x3a')]['hasMany'](db[_0x5234('0x41')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x3a')][_0x5234('0x110')](db[_0x5234('0x3f')],{'as':_0x5234('0x167')});db[_0x5234('0x3a')][_0x5234('0x110')](db[_0x5234('0x43')],{'as':'Applications'});db[_0x5234('0x3a')]['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x3a')]['belongsTo'](db[_0x5234('0x16a')],{'as':_0x5234('0x16a'),'foreignKey':_0x5234('0x16b')});db[_0x5234('0x3a')]['belongsTo'](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db[_0x5234('0x3a')][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x16d'),'through':_0x5234('0x13b')});db[_0x5234('0x3c')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x2e')});db[_0x5234('0x3c')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x16e'),'as':_0x5234('0x16f')});db[_0x5234('0x3f')][_0x5234('0x110')](db[_0x5234('0x41')],{'as':'Messages','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x170')});db[_0x5234('0x3f')][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x3f')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5234('0x3f')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x3f')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x174'),'as':_0x5234('0x175')});db[_0x5234('0x3f')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'mail_interaction_has_tags','as':_0x5234('0x176')});db[_0x5234('0x3f')][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x177'),'through':_0x5234('0x178'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x5234('0x110')](db[_0x5234('0xe8')],{'as':_0x5234('0x179'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x41')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10')});db['MailMessage'][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':'cascade','as':_0x5234('0x15f')});db[_0x5234('0x41')][_0x5234('0x11e')](db[_0x5234('0x3f')],{'as':_0x5234('0x17a'),'foreignKey':_0x5234('0x170')});db['MailMessage'][_0x5234('0x11e')](db[_0x5234('0x3a')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x41')]['belongsTo'](db[_0x5234('0x65')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x5234('0x41')][_0x5234('0x11e')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x5234('0x17b')});db[_0x5234('0x43')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x163')});db['MailApplication'][_0x5234('0x11e')](db['MailQueue'],{'onDelete':_0x5234('0x163')});db[_0x5234('0x43')]['belongsTo'](db[_0x5234('0x3a')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x43')][_0x5234('0x11e')](db[_0x5234('0x152')],{'onDelete':_0x5234('0x163'),'foreignKey':'IntervalId'});db[_0x5234('0x43')][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':'TagId'});db[_0x5234('0x45')][_0x5234('0x11e')](db[_0x5234('0x3a')],{});db['MailQueueReport'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':'ListId'});db[_0x5234('0x45')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x45')][_0x5234('0x11e')](db['MailInteraction'],{});db[_0x5234('0x45')][_0x5234('0x11e')](db['MailMessage'],{});db[_0x5234('0x45')][_0x5234('0x11e')](db[_0x5234('0x10')],{});db[_0x5234('0x45')]['belongsTo'](db[_0x5234('0x3c')],{});db[_0x5234('0x47')][_0x5234('0x110')](db[_0x5234('0x17c')],{'as':_0x5234('0x17d'),'onDelete':'cascade'});db[_0x5234('0x4a')][_0x5234('0x110')](db[_0x5234('0x82')],{'as':_0x5234('0x17e'),'foreignKey':_0x5234('0x17f'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x4a')][_0x5234('0x110')](db[_0x5234('0x81')],{'as':_0x5234('0x180'),'foreignKey':_0x5234('0x17f')});db[_0x5234('0x4a')][_0x5234('0x110')](db['FaxInteraction'],{'as':_0x5234('0x167')});db[_0x5234('0x4a')]['hasMany'](db['FaxApplication'],{'as':_0x5234('0x145')});db[_0x5234('0x4a')][_0x5234('0x110')](db['VoiceExtension'],{'as':_0x5234('0x181'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x4a')]['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0x5234('0x4a')][_0x5234('0x11e')](db[_0x5234('0x29')],{'as':_0x5234('0x29')});db['FaxAccount'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x4a')][_0x5234('0x11e')](db['Pause'],{'as':_0x5234('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5234('0x4a')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'user_has_fax_accounts'});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x4f')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x4a')],{'onDelete':_0x5234('0x163')});db[_0x5234('0x182')][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x183')});db[_0x5234('0x129')][_0x5234('0x110')](db[_0x5234('0x4e')],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x184')});db['FaxInteraction'][_0x5234('0x11e')](db[_0x5234('0x4a')],{'as':'Account','foreignKey':_0x5234('0x17f')});db[_0x5234('0x129')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x129')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x129')][_0x5234('0x11f')](db['Tag'],{'through':_0x5234('0x185'),'as':_0x5234('0x175')});db[_0x5234('0x129')]['belongsToMany'](db[_0x5234('0x173')],{'through':_0x5234('0x185'),'as':'ThroughTags'});db['FaxInteraction'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':_0x5234('0x186'),'foreignKey':_0x5234('0x184')});db[_0x5234('0x4e')][_0x5234('0x11e')](db['User'],{'onDelete':'cascade','as':_0x5234('0x10')});db['FaxMessage']['belongsTo'](db[_0x5234('0x129')],{'as':_0x5234('0x17a'),'foreignKey':_0x5234('0x184')});db[_0x5234('0x4e')]['belongsTo'](db[_0x5234('0x72')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f')});db[_0x5234('0x4e')][_0x5234('0x11e')](db[_0x5234('0xe8')],{'as':_0x5234('0xe8'),'foreignKey':_0x5234('0x187')});db['FaxMessage'][_0x5234('0x11e')](db['FaxAccount'],{'as':_0x5234('0x171'),'foreignKey':'FaxAccountId'});db[_0x5234('0x4f')][_0x5234('0x11f')](db['User'],{'as':'Agents','through':_0x5234('0x30')});db[_0x5234('0x4f')]['belongsToMany'](db[_0x5234('0xe2')],{'through':_0x5234('0x188'),'as':'Teams'});db[_0x5234('0x51')][_0x5234('0x11e')](db['FaxAccount'],{});db[_0x5234('0x51')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':_0x5234('0x169')});db[_0x5234('0x51')]['belongsTo'](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x5234('0x11e')](db[_0x5234('0x129')],{});db[_0x5234('0x51')][_0x5234('0x11e')](db[_0x5234('0x4e')],{});db[_0x5234('0x51')][_0x5234('0x11e')](db['User'],{});db[_0x5234('0x51')][_0x5234('0x11e')](db[_0x5234('0x4f')],{});db[_0x5234('0x53')]['hasMany'](db[_0x5234('0x82')],{'as':_0x5234('0x17e'),'foreignKey':_0x5234('0x189'),'onDelete':'cascade'});db[_0x5234('0x53')][_0x5234('0x110')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x5234('0x53')]['hasMany'](db[_0x5234('0x59')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x5234('0x110')](db[_0x5234('0x57')],{'as':_0x5234('0x167')});db[_0x5234('0x53')][_0x5234('0x110')](db[_0x5234('0x55')],{'as':_0x5234('0x145')});db[_0x5234('0x53')]['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x53')][_0x5234('0x11e')](db['Pause'],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db[_0x5234('0x53')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x13e')});db[_0x5234('0x55')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x163')});db['SmsApplication']['belongsTo'](db[_0x5234('0x133')],{'onDelete':'restrict'});db[_0x5234('0x55')][_0x5234('0x11e')](db[_0x5234('0x53')],{'onDelete':'restrict'});db[_0x5234('0x55')]['belongsTo'](db[_0x5234('0x152')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x5234('0x55')][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':'TagId'});db[_0x5234('0x57')][_0x5234('0x110')](db['SmsMessage'],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x18a')});db[_0x5234('0x57')]['belongsTo'](db[_0x5234('0x53')],{'as':_0x5234('0x171'),'foreignKey':'SmsAccountId'});db[_0x5234('0x57')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5234('0x57')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db['SmsInteraction'][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x18b'),'as':'Tags'});db['SmsInteraction'][_0x5234('0x11f')](db['Tag'],{'through':_0x5234('0x18b'),'as':_0x5234('0x176')});db[_0x5234('0x57')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':'user_has_sms_interactions','foreignKey':_0x5234('0x18a')});db[_0x5234('0x59')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x10')});db['SmsMessage'][_0x5234('0x11e')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x5234('0x59')][_0x5234('0x11e')](db[_0x5234('0x57')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x5234('0x18a')});db[_0x5234('0x59')][_0x5234('0x11e')](db['SmsAccount'],{'as':_0x5234('0x171'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x16d'),'through':_0x5234('0x18c'),'foreignKey':'SmsQueueId'});db[_0x5234('0x133')][_0x5234('0x11f')](db['Team'],{'through':_0x5234('0x18d'),'as':'Teams'});db[_0x5234('0x5c')][_0x5234('0x110')](db['Disposition'],{'as':_0x5234('0x17e'),'foreignKey':'OpenchannelAccountId','onDelete':_0x5234('0x10d')});db[_0x5234('0x5c')]['hasMany'](db[_0x5234('0x81')],{'as':_0x5234('0x180'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5c')][_0x5234('0x110')](db['OpenchannelInteraction'],{'as':_0x5234('0x167'),'foreignKey':_0x5234('0x18e')});db['OpenchannelAccount'][_0x5234('0x110')](db[_0x5234('0x61')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5c')][_0x5234('0x110')](db[_0x5234('0x18f')],{'as':_0x5234('0x145'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5c')][_0x5234('0x11e')](db['CmList'],{'as':_0x5234('0x168'),'foreignKey':'ListId'});db['OpenchannelAccount']['belongsTo'](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db['OpenchannelAccount'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x13c')});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':'restrict'});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x63')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x190')});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x5c')],{'onDelete':_0x5234('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x5234('0x18f')][_0x5234('0x11e')](db[_0x5234('0x152')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x5234('0x18f')][_0x5234('0x11e')](db['Tag'],{'onDelete':_0x5234('0x163'),'foreignKey':'TagId'});db[_0x5234('0x5f')][_0x5234('0x110')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x191')});db['OpenchannelInteraction'][_0x5234('0x11e')](db[_0x5234('0x5c')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x18e')});db[_0x5234('0x5f')]['belongsTo'](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x5f')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x5f')]['belongsToMany'](db[_0x5234('0x173')],{'through':_0x5234('0x192'),'as':_0x5234('0x175')});db[_0x5234('0x5f')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x5234('0x5f')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':'user_has_openchannel_interactions','foreignKey':_0x5234('0x191')});db['OpenchannelMessage'][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x10d'),'as':'User'});db['OpenchannelMessage'][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f')});db['OpenchannelMessage'][_0x5234('0x11e')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x5234('0x17a'),'foreignKey':'OpenchannelInteractionId'});db[_0x5234('0x61')][_0x5234('0x11e')](db[_0x5234('0xe8')],{'as':_0x5234('0xe8'),'foreignKey':_0x5234('0x187')});db[_0x5234('0x61')][_0x5234('0x11e')](db[_0x5234('0x5c')],{'as':'Account','foreignKey':_0x5234('0x18e')});db[_0x5234('0x63')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x33'),'foreignKey':_0x5234('0x190')});db[_0x5234('0x63')]['belongsToMany'](db[_0x5234('0xe2')],{'through':'team_has_openchannel_queues','as':_0x5234('0x16f')});db[_0x5234('0x65')][_0x5234('0x110')](db[_0x5234('0x82')],{'as':'Dispositions','foreignKey':_0x5234('0x193'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x65')]['hasMany'](db[_0x5234('0x81')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x5234('0x65')][_0x5234('0x110')](db[_0x5234('0x194')],{'as':_0x5234('0x195')});db['ChatWebsite'][_0x5234('0x110')](db[_0x5234('0x69')],{'as':_0x5234('0x167')});db['ChatWebsite'][_0x5234('0x110')](db[_0x5234('0x68')],{'as':_0x5234('0x145')});db[_0x5234('0x65')][_0x5234('0x110')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':_0x5234('0x169')});db['ChatWebsite'][_0x5234('0x11e')](db[_0x5234('0x152')],{'as':_0x5234('0x152'),'foreignKey':'IntervalId'});db[_0x5234('0x65')][_0x5234('0x11e')](db['MailAccount'],{'as':_0x5234('0x3a'),'foreignKey':_0x5234('0x161')});db[_0x5234('0x65')]['belongsTo'](db[_0x5234('0x87')],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db['ChatWebsite']['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'user_has_chat_websites'});db[_0x5234('0x196')]['belongsTo'](db[_0x5234('0x5c')],{});db[_0x5234('0x196')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x196')]['belongsTo'](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x196')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x5234('0x196')][_0x5234('0x11e')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x5234('0x10')],{});db[_0x5234('0x196')][_0x5234('0x11e')](db[_0x5234('0x63')],{});db['ChatApplication'][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x197'),'foreignKey':_0x5234('0x10e'),'onDelete':_0x5234('0x163')});db['ChatApplication'][_0x5234('0x11e')](db[_0x5234('0x6d')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x5234('0x163')});db[_0x5234('0x68')][_0x5234('0x11e')](db[_0x5234('0x65')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x5234('0x163')});db['ChatApplication'][_0x5234('0x11e')](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x183')});db['ChatInteraction'][_0x5234('0x110')](db['ChatMessage'],{'as':_0x5234('0x158'),'onDelete':_0x5234('0x10d'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x5234('0x11e')](db['ChatWebsite'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x193')});db[_0x5234('0x69')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x69')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':'Owner','foreignKey':_0x5234('0x10e')});db[_0x5234('0x69')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x198'),'as':_0x5234('0x175')});db['ChatInteraction'][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'chat_interaction_has_tags','as':_0x5234('0x176')});db['ChatInteraction'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':'user_has_chat_interactions','foreignKey':_0x5234('0x199')});db[_0x5234('0x6b')]['belongsTo'](db['User'],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x10')});db[_0x5234('0x6b')][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':'cascade','as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x6b')]['belongsTo'](db[_0x5234('0x69')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x17a'),'foreignKey':_0x5234('0x199')});db[_0x5234('0x6b')][_0x5234('0x11e')](db[_0x5234('0xe8')],{'as':_0x5234('0xe8'),'foreignKey':_0x5234('0x187')});db[_0x5234('0x6b')][_0x5234('0x11e')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x5234('0x193')});db[_0x5234('0x19a')][_0x5234('0x110')](db['Attachment'],{'as':'Attachments','foreignKey':_0x5234('0x17b'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x19a')][_0x5234('0x11e')](db['CmContact'],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x19a')][_0x5234('0x11e')](db['ChatWebsite'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x193')});db[_0x5234('0x6d')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'UserChatQueue','hooks':!![]});db[_0x5234('0x6d')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x19b'),'as':'Teams'});db[_0x5234('0x120')]['hasMany'](db[_0x5234('0xcf')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x19c'),'onDelete':_0x5234('0x10d')});db['ChatGroup'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':'Members','through':'chat_group_has_users'});db[_0x5234('0x194')][_0x5234('0x11e')](db['ChatWebsite'],{'as':_0x5234('0x19d'),'foreignKey':_0x5234('0x193')});db['CmCompany']['hasMany'](db[_0x5234('0x72')],{'as':_0x5234('0x122'),'foreignKey':_0x5234('0x19e')});db[_0x5234('0x72')][_0x5234('0x110')](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x5234('0x19f')});db[_0x5234('0x72')]['hasMany'](db[_0x5234('0x74')],{'as':_0x5234('0x14b'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':_0x5234('0x160')});db[_0x5234('0x72')][_0x5234('0x110')](db['CmHopperHistory'],{'as':_0x5234('0x14e'),'foreignKey':'ContactId'});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x7a')],{'as':_0x5234('0x7a'),'foreignKey':_0x5234('0x160')});db[_0x5234('0x72')]['hasMany'](db['JscriptySessionReport'],{'as':_0x5234('0x1a0'),'foreignKey':_0x5234('0x160')});db['CmContact'][_0x5234('0x110')](db[_0x5234('0x5f')],{'as':_0x5234('0x118'),'foreignKey':_0x5234('0x160'),'onDelete':'restrict'});db[_0x5234('0x72')]['hasMany'](db[_0x5234('0x69')],{'as':'ChatInteractions','foreignKey':_0x5234('0x160'),'onDelete':_0x5234('0x163')});db[_0x5234('0x72')][_0x5234('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x5234('0x160'),'onDelete':'restrict'});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x129')],{'as':_0x5234('0x12a'),'foreignKey':_0x5234('0x160'),'onDelete':_0x5234('0x163')});db[_0x5234('0x72')][_0x5234('0x110')](db[_0x5234('0x3f')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x5234('0x163')});db[_0x5234('0x72')][_0x5234('0x11e')](db[_0x5234('0x70')],{'as':_0x5234('0x1a1'),'foreignKey':_0x5234('0x19e')});db['CmContact']['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169'),'onDelete':_0x5234('0x10d')});db['CmContact'][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'through':_0x5234('0x123')});db[_0x5234('0x72')][_0x5234('0x11f')](db[_0x5234('0x173')],{'as':'Tags','through':_0x5234('0x1a2')});db[_0x5234('0x72')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x1a2'),'as':_0x5234('0x176')});db[_0x5234('0x74')]['hasMany'](db[_0x5234('0x90')],{'as':'AdditionalPhones','foreignKey':_0x5234('0x1a3')});db['CmHopper']['belongsTo'](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160'),'onDelete':'cascade'});db[_0x5234('0x74')]['belongsTo'](db[_0x5234('0x124')],{'as':'List','foreignKey':_0x5234('0x169'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x74')][_0x5234('0x11e')](db[_0x5234('0x10')],{'as':_0x5234('0x197'),'foreignKey':_0x5234('0x10e')});db[_0x5234('0x74')][_0x5234('0x11e')](db['VoiceQueue'],{'as':_0x5234('0x1a4'),'foreignKey':_0x5234('0x14a'),'onDelete':'cascade'});db[_0x5234('0x74')][_0x5234('0x11e')](db[_0x5234('0xe5')],{'as':_0x5234('0xe5'),'foreignKey':_0x5234('0x1a5'),'onDelete':'cascade'});db[_0x5234('0x74')]['belongsTo'](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':'OwnerId'});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x5234('0x10d')});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0x1a')],{'as':_0x5234('0x1a4'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x5234('0x76')][_0x5234('0x11e')](db[_0x5234('0xe5')],{'as':'Campaign','foreignKey':_0x5234('0x1a5'),'onDelete':'cascade'});db[_0x5234('0x7f')][_0x5234('0x110')](db['Condition'],{'as':{'plural':'All','singular':_0x5234('0x1a6')},'foreignKey':_0x5234('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x5234('0x7f')][_0x5234('0x110')](db[_0x5234('0x84')],{'as':{'plural':_0x5234('0x1a8'),'singular':_0x5234('0x1a9')},'foreignKey':'AutomationAnyId','onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x7f')][_0x5234('0x110')](db[_0x5234('0x1aa')],{'as':_0x5234('0x1ab'),'foreignKey':_0x5234('0x1ac'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x5234('0x82')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db[_0x5234('0x152')][_0x5234('0x110')](db[_0x5234('0x152')],{'as':_0x5234('0x1ad'),'foreignKey':_0x5234('0x153'),'onDelete':_0x5234('0x10d'),'hooks':!![],'required':![]});db['Interval'][_0x5234('0x110')](db['VoiceExtension'],{'as':_0x5234('0x115'),'foreignKey':_0x5234('0x153'),'onDelete':_0x5234('0x163')});db['Interval'][_0x5234('0x110')](db[_0x5234('0x43')],{'as':_0x5234('0x1ae'),'foreignKey':_0x5234('0x153')});db[_0x5234('0x152')][_0x5234('0x110')](db[_0x5234('0x68')],{'as':'ChatApplications','foreignKey':_0x5234('0x153')});db['Interval'][_0x5234('0x110')](db[_0x5234('0x182')],{'as':_0x5234('0x1af'),'foreignKey':'IntervalId'});db[_0x5234('0x152')][_0x5234('0x110')](db['SmsApplication'],{'as':_0x5234('0x1b0'),'foreignKey':_0x5234('0x153')});db['Schedule'][_0x5234('0x11e')](db[_0x5234('0x3a')],{});db[_0x5234('0x8b')][_0x5234('0x11e')](db[_0x5234('0x99')],{'foreignKey':_0x5234('0x1b1')});db[_0x5234('0x8b')][_0x5234('0x11e')](db[_0x5234('0x98')],{'foreignKey':'CustomReportId'});db[_0x5234('0x146')][_0x5234('0x11f')](db['VoiceMusicOnHold'],{'as':_0x5234('0x1b2'),'through':_0x5234('0x148'),'onDelete':'restrict'});db[_0x5234('0x173')][_0x5234('0x11f')](db[_0x5234('0x72')],{'through':'cm_contact_has_tags'});db[_0x5234('0x173')]['belongsToMany'](db[_0x5234('0x69')],{'through':_0x5234('0x198')});db['Tag']['belongsToMany'](db[_0x5234('0x3f')],{'through':_0x5234('0x174')});db[_0x5234('0x173')][_0x5234('0x11f')](db[_0x5234('0x57')],{'through':_0x5234('0x18b')});db['Tag'][_0x5234('0x11f')](db[_0x5234('0x129')],{'through':_0x5234('0x185')});db[_0x5234('0x173')][_0x5234('0x11f')](db['OpenchannelInteraction'],{'through':_0x5234('0x192')});db[_0x5234('0x173')]['belongsToMany'](db[_0x5234('0xfe')],{'through':'whatsapp_interaction_has_tags'});db[_0x5234('0x1b3')][_0x5234('0x11e')](db[_0x5234('0x1b4')],{'as':_0x5234('0x1b5'),'foreignKey':_0x5234('0x1b6')});db[_0x5234('0x90')][_0x5234('0x11e')](db[_0x5234('0x74')],{'as':_0x5234('0x1b7'),'foreignKey':_0x5234('0x1a3')});db[_0x5234('0x1b3')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':'CmContactId'});db[_0x5234('0x1b8')][_0x5234('0x110')](db[_0x5234('0x84')],{'as':{'plural':_0x5234('0x1b9'),'singular':_0x5234('0x1ba')},'foreignKey':_0x5234('0x1bb'),'onDelete':'cascade','hooks':!![]});db[_0x5234('0x1b8')][_0x5234('0x110')](db[_0x5234('0x84')],{'as':{'plural':_0x5234('0x1bc'),'singular':_0x5234('0x1bd')},'foreignKey':_0x5234('0x1be'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x1b8')][_0x5234('0x110')](db['Action'],{'as':'Actions','foreignKey':_0x5234('0x1bf'),'onDelete':_0x5234('0x10d'),'hooks':!![]});db[_0x5234('0x98')]['hasMany'](db[_0x5234('0x1c0')],{'as':_0x5234('0x1c1'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c2'),'hooks':!![]});db['AnalyticDefaultReport'][_0x5234('0x110')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1b1')});db[_0x5234('0x9c')][_0x5234('0x110')](db[_0x5234('0x1c0')],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c3')});db['AnalyticFieldReport']['belongsTo'](db[_0x5234('0x9c')],{'foreignKey':_0x5234('0x1c3')});db['SalesforceAccount'][_0x5234('0x110')](db[_0x5234('0xa2')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa2')]['hasMany'](db[_0x5234('0xa3')],{'as':_0x5234('0x1c6'),'onDelete':_0x5234('0x10d'),'foreignKey':'SubjectId'});db[_0x5234('0xa2')][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':_0x5234('0x1c7'),'onDelete':'cascade','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xa2')][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c9')});db['SalesforceConfiguration']['belongsTo'](db[_0x5234('0xa0')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa3')]['hasMany'](db[_0x5234('0xa3')],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db['SalesforceField'][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xa3')][_0x5234('0x110')](db[_0x5234('0xa3')],{'as':_0x5234('0x1cd'),'foreignKey':_0x5234('0x1c9')});db['SalesforceField'][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xa5')][_0x5234('0x110')](db[_0x5234('0xa6')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa6')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1c6'),'onDelete':'cascade','foreignKey':_0x5234('0x1cb')});db[_0x5234('0xa6')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':'DescriptionId'});db[_0x5234('0xa6')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xa6')][_0x5234('0x11e')](db['SugarcrmAccount'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa7')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xa7')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xa7')][_0x5234('0x110')](db[_0x5234('0xa7')],{'as':'Field','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xa7')]['belongsTo'](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db['DeskAccount'][_0x5234('0x110')](db[_0x5234('0xa9')],{'as':_0x5234('0x1c4'),'onDelete':'cascade','foreignKey':_0x5234('0x1c5')});db[_0x5234('0xa9')][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1c6'),'onDelete':'cascade','foreignKey':_0x5234('0x1cb')});db['DeskConfiguration'][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':'DescriptionId'});db[_0x5234('0xa9')][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1c1'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xa9')][_0x5234('0x11e')](db[_0x5234('0x1cf')],{'as':_0x5234('0x171'),'foreignKey':'AccountId'});db[_0x5234('0xa9')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'int_desk_configuration_has_tags'});db[_0x5234('0xab')]['hasMany'](db[_0x5234('0xab')],{'as':_0x5234('0x1ca'),'foreignKey':'SubjectId'});db[_0x5234('0xab')]['hasMany'](db[_0x5234('0xab')],{'as':'Description','foreignKey':_0x5234('0x1c8')});db['DeskField'][_0x5234('0x110')](db[_0x5234('0xab')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db[_0x5234('0xab')][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db['ZohoAccount']['hasMany'](db[_0x5234('0xaf')],{'as':_0x5234('0x1c4'),'onDelete':'cascade','foreignKey':_0x5234('0x1c5')});db['ZohoConfiguration'][_0x5234('0x110')](db[_0x5234('0xb0')],{'as':_0x5234('0x1c6'),'onDelete':'cascade','foreignKey':_0x5234('0x1cb')});db['ZohoConfiguration']['hasMany'](db[_0x5234('0xb0')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xaf')][_0x5234('0x110')](db['ZohoField'],{'as':'Fields','onDelete':_0x5234('0x10d'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x5234('0x11e')](db[_0x5234('0xad')],{'as':_0x5234('0x171'),'foreignKey':'AccountId'});db['ZohoField'][_0x5234('0x110')](db['ZohoField'],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xb0')]['hasMany'](db[_0x5234('0xb0')],{'as':'Description','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xb0')][_0x5234('0x110')](db[_0x5234('0xb0')],{'as':_0x5234('0x1cd'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xb0')][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':'VariableId'});db[_0x5234('0xb2')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xb4')][_0x5234('0x110')](db[_0x5234('0xb5')],{'as':_0x5234('0x1c6'),'foreignKey':'SubjectId'});db[_0x5234('0xb4')]['hasMany'](db[_0x5234('0xb5')],{'as':_0x5234('0x1c7'),'foreignKey':_0x5234('0x1c8')});db['ZendeskConfiguration'][_0x5234('0x110')](db[_0x5234('0xb5')],{'as':_0x5234('0x1c1'),'foreignKey':'FieldId'});db[_0x5234('0xb4')][_0x5234('0x11e')](db[_0x5234('0xb2')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xb4')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x1d0')});db[_0x5234('0xb5')][_0x5234('0x110')](db['ZendeskField'],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db['ZendeskField']['hasMany'](db[_0x5234('0xb5')],{'as':'Description','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xb5')]['hasMany'](db[_0x5234('0xb5')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db['ZendeskField'][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db['FreshdeskAccount'][_0x5234('0x110')](db[_0x5234('0xb9')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db['FreshdeskConfiguration'][_0x5234('0x110')](db[_0x5234('0xba')],{'as':_0x5234('0x1c6'),'onDelete':_0x5234('0x10d'),'foreignKey':'SubjectId'});db[_0x5234('0xb9')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':'DescriptionId'});db[_0x5234('0xb9')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':_0x5234('0x1c1'),'onDelete':_0x5234('0x10d'),'foreignKey':'FieldId'});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xb9')][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':_0x5234('0x1d1')});db[_0x5234('0xba')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':'Subject','foreignKey':_0x5234('0x1cb')});db[_0x5234('0xba')][_0x5234('0x110')](db[_0x5234('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5234('0xba')]['hasMany'](db[_0x5234('0xba')],{'as':'Field','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xba')][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xbc')]['hasMany'](db[_0x5234('0x1d2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d2')][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1c6'),'foreignKey':_0x5234('0x1cb')});db['VtigerConfiguration'][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1c7'),'foreignKey':_0x5234('0x1c8')});db['VtigerConfiguration']['hasMany'](db[_0x5234('0x1d3')],{'as':_0x5234('0x1c1'),'foreignKey':'FieldId'});db[_0x5234('0x1d2')][_0x5234('0x11e')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d3')]['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x5234('0x1cb')});db[_0x5234('0x1d3')][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0x1d3')][_0x5234('0x110')](db[_0x5234('0x1d3')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db[_0x5234('0x1d3')]['belongsTo'](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':'VariableId'});db[_0x5234('0xbf')][_0x5234('0x110')](db[_0x5234('0x1d4')],{'as':'Configurations','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d4')][_0x5234('0x110')](db[_0x5234('0xc2')],{'as':_0x5234('0x1c6'),'foreignKey':_0x5234('0x1cb')});db['ServicenowConfiguration'][_0x5234('0x110')](db[_0x5234('0xc2')],{'as':_0x5234('0x1c7'),'foreignKey':'DescriptionId'});db[_0x5234('0x1d4')][_0x5234('0x110')](db[_0x5234('0xc2')],{'as':'Fields','foreignKey':_0x5234('0x1c9')});db[_0x5234('0x1d4')][_0x5234('0x11e')](db[_0x5234('0xbf')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0xc2')]['hasMany'](db[_0x5234('0xc2')],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xc2')][_0x5234('0x110')](db['ServicenowField'],{'as':'Description','foreignKey':_0x5234('0x1c8')});db[_0x5234('0xc2')]['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xc2')][_0x5234('0x11e')](db[_0x5234('0x94')],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0x1d5')]['hasMany'](db[_0x5234('0xc5')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d5')][_0x5234('0x11e')](db[_0x5234('0x105')],{'as':_0x5234('0x105'),'foreignKey':_0x5234('0x162')});db[_0x5234('0xc5')][_0x5234('0x110')](db[_0x5234('0xc7')],{'as':'Subjects','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0xc5')]['hasMany'](db[_0x5234('0xc7')],{'as':_0x5234('0x1c7'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xc5')][_0x5234('0x110')](db[_0x5234('0xc7')],{'as':_0x5234('0x1c1'),'onDelete':'cascade','foreignKey':_0x5234('0x1c9')});db[_0x5234('0xc5')]['belongsTo'](db[_0x5234('0x1d5')],{'as':_0x5234('0x171'),'foreignKey':'AccountId'});db['Dynamics365Field']['hasMany'](db[_0x5234('0xc7')],{'as':_0x5234('0x1ca'),'foreignKey':'SubjectId'});db[_0x5234('0xc7')][_0x5234('0x110')](db[_0x5234('0xc7')],{'as':_0x5234('0x1cc'),'foreignKey':_0x5234('0x1c8')});db[_0x5234('0xc7')][_0x5234('0x110')](db['Dynamics365Field'],{'as':_0x5234('0x1cd'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0xc7')][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xc9')][_0x5234('0x110')](db[_0x5234('0x1d6')],{'as':_0x5234('0x1c4'),'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d6')]['hasMany'](db[_0x5234('0x1d7')],{'as':_0x5234('0x1c6'),'foreignKey':_0x5234('0x1cb')});db['FreshsalesConfiguration'][_0x5234('0x110')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x5234('0x1c8')});db['FreshsalesConfiguration']['hasMany'](db[_0x5234('0x1d7')],{'as':_0x5234('0x1c1'),'foreignKey':_0x5234('0x1c9')});db[_0x5234('0x1d6')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x1c5')});db[_0x5234('0x1d7')]['hasMany'](db['FreshsalesField'],{'as':_0x5234('0x1ca'),'foreignKey':_0x5234('0x1cb')});db[_0x5234('0x1d7')][_0x5234('0x110')](db[_0x5234('0x1d7')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x5234('0x1d7')],{'as':_0x5234('0x1cd'),'foreignKey':'FieldId'});db[_0x5234('0x1d7')][_0x5234('0x11e')](db['Variable'],{'as':_0x5234('0x94'),'foreignKey':_0x5234('0x1ce')});db[_0x5234('0xce')]['belongsTo'](db[_0x5234('0x65')],{});db['ChatQueueReport'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db['ChatQueueReport'][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db[_0x5234('0xce')][_0x5234('0x11e')](db[_0x5234('0x69')],{});db[_0x5234('0xce')][_0x5234('0x11e')](db[_0x5234('0x6b')],{});db['ChatQueueReport'][_0x5234('0x11e')](db[_0x5234('0x10')],{});db[_0x5234('0xce')][_0x5234('0x11e')](db[_0x5234('0x6d')],{});db[_0x5234('0xcf')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x5234('0xcf')][_0x5234('0x11e')](db[_0x5234('0x10')],{'onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x1d8')});db[_0x5234('0xd4')][_0x5234('0x110')](db[_0x5234('0x1d9')],{'foreignKey':_0x5234('0x1da'),'onDelete':_0x5234('0x10d')});db[_0x5234('0xd4')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x5234('0x1da'),'onDelete':_0x5234('0x10d')});db[_0x5234('0xd5')][_0x5234('0x11e')](db['SmsAccount'],{});db[_0x5234('0xd5')]['belongsTo'](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':_0x5234('0x169')});db[_0x5234('0xd5')][_0x5234('0x11e')](db['CmContact'],{'as':_0x5234('0x15f'),'foreignKey':'ContactId'});db[_0x5234('0xd5')][_0x5234('0x11e')](db[_0x5234('0x57')],{});db[_0x5234('0xd5')][_0x5234('0x11e')](db[_0x5234('0x59')],{});db[_0x5234('0xd5')][_0x5234('0x11e')](db['User'],{});db[_0x5234('0xd5')][_0x5234('0x11e')](db[_0x5234('0x133')],{});db[_0x5234('0x1db')]['hasMany'](db[_0x5234('0xd4')],{'foreignKey':'ProjectId'});db[_0x5234('0x1db')][_0x5234('0x110')](db['JscriptyQuestionReport'],{'foreignKey':_0x5234('0x1dc')});db[_0x5234('0x1db')]['hasMany'](db[_0x5234('0xd1')],{'foreignKey':_0x5234('0x1dc')});db[_0x5234('0x1dd')][_0x5234('0x11f')](db['User'],{'as':_0x5234('0x177'),'through':_0x5234('0x142')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':'Agents','through':_0x5234('0x1de')});db[_0x5234('0xe2')]['belongsToMany'](db[_0x5234('0x1a')],{'through':_0x5234('0x107'),'as':_0x5234('0x12e')});db[_0x5234('0xe2')][_0x5234('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x5234('0xe2')]['belongsToMany'](db[_0x5234('0x6d')],{'through':_0x5234('0x19b'),'as':_0x5234('0x132')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x4f')],{'through':_0x5234('0x188'),'as':_0x5234('0x1df')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x133')],{'through':_0x5234('0x18d'),'as':_0x5234('0x134')});db[_0x5234('0xe2')][_0x5234('0x11f')](db[_0x5234('0x63')],{'through':_0x5234('0x1e0'),'as':'OpenchannelQueues'});db[_0x5234('0xe2')][_0x5234('0x11f')](db['WhatsappQueue'],{'through':_0x5234('0x1e1'),'as':_0x5234('0x135')});db['Team'][_0x5234('0x11f')](db['VoicePrefix'],{'through':_0x5234('0x109'),'as':_0x5234('0x130')});db[_0x5234('0xe5')][_0x5234('0x110')](db['CmHopper'],{'as':_0x5234('0x14b'),'foreignKey':_0x5234('0x1a5')});db[_0x5234('0xe5')][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x5234('0xe5')][_0x5234('0x110')](db[_0x5234('0x14d')],{'as':_0x5234('0x14e'),'foreignKey':_0x5234('0x1a5')});db[_0x5234('0xe5')][_0x5234('0x110')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x5234('0x1a5')});db[_0x5234('0xe5')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x29'),'foreignKey':_0x5234('0x14f')});db[_0x5234('0xe5')][_0x5234('0x11e')](db['Trunk'],{'as':_0x5234('0x150'),'foreignKey':_0x5234('0x151')});db[_0x5234('0xe5')][_0x5234('0x11e')](db[_0x5234('0x152')],{'as':_0x5234('0x152'),'foreignKey':_0x5234('0x153')});db[_0x5234('0xe5')][_0x5234('0x11e')](db[_0x5234('0x1dd')],{'as':_0x5234('0x1dd'),'foreignKey':_0x5234('0x1e2')});db[_0x5234('0xe5')][_0x5234('0x11f')](db[_0x5234('0x124')],{'as':_0x5234('0x125'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x5234('0x11f')](db['CmList'],{'as':_0x5234('0x156'),'through':_0x5234('0x1e3')});db['Attachment'][_0x5234('0x11e')](db[_0x5234('0x19a')],{'as':'ChatOfflineMessage','foreignKey':_0x5234('0x17b')});db[_0x5234('0xec')][_0x5234('0x11e')](db[_0x5234('0x41')],{});db['MailTransferReport']['belongsTo'](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0x5234('0x3a')],{'foreignKey':_0x5234('0x1e4'),'as':_0x5234('0x1e5')});db['MailTransferReport'][_0x5234('0x11e')](db['User'],{'foreignKey':_0x5234('0x1e6'),'as':_0x5234('0x1e7')});db[_0x5234('0xec')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db['MailTransferReport'][_0x5234('0x11e')](db[_0x5234('0x3c')],{'foreignKey':_0x5234('0x1ea'),'as':_0x5234('0x1eb')});db[_0x5234('0xec')][_0x5234('0x11e')](db[_0x5234('0x3a')],{'foreignKey':_0x5234('0x1ec'),'as':_0x5234('0x1ed')});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x6b')],{});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x69')],{});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x65')],{'foreignKey':'FromChatWebsiteId','as':_0x5234('0x1e5')});db[_0x5234('0x1ee')][_0x5234('0x11e')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db[_0x5234('0x1ee')][_0x5234('0x11e')](db[_0x5234('0x6d')],{'foreignKey':_0x5234('0x1ef'),'as':_0x5234('0x1eb')});db['ChatTransferReport'][_0x5234('0x11e')](db[_0x5234('0x65')],{'foreignKey':_0x5234('0x1f0'),'as':'ToAccount'});db[_0x5234('0x1f1')]['belongsTo'](db[_0x5234('0x4e')],{});db[_0x5234('0x1f1')]['belongsTo'](db[_0x5234('0x129')],{});db['FaxTransferReport'][_0x5234('0x11e')](db[_0x5234('0x4a')],{'foreignKey':_0x5234('0x1f2'),'as':_0x5234('0x1e5')});db['FaxTransferReport'][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':'FromUserId','as':_0x5234('0x1e7')});db[_0x5234('0x1f1')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db['FaxTransferReport'][_0x5234('0x11e')](db[_0x5234('0x4f')],{'foreignKey':_0x5234('0x1f3'),'as':_0x5234('0x1eb')});db[_0x5234('0x1f1')][_0x5234('0x11e')](db[_0x5234('0x4a')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x5234('0x61')],{});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x5f')],{});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x5c')],{'foreignKey':_0x5234('0x1f4'),'as':_0x5234('0x1e5')});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e6'),'as':'FromAgent'});db[_0x5234('0xef')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db['OpenchannelTransferReport'][_0x5234('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x5234('0x1f5'),'as':_0x5234('0x1eb')});db['OpenchannelTransferReport'][_0x5234('0x11e')](db['OpenchannelAccount'],{'foreignKey':_0x5234('0x1f6'),'as':_0x5234('0x1ed')});db[_0x5234('0xf1')][_0x5234('0x11e')](db['SmsMessage'],{});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x57')],{});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x53')],{'foreignKey':_0x5234('0x1f7'),'as':'FromAccount'});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e6'),'as':_0x5234('0x1e7')});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':'ToAgent'});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x133')],{'foreignKey':_0x5234('0x1f8'),'as':_0x5234('0x1eb')});db[_0x5234('0xf1')][_0x5234('0x11e')](db[_0x5234('0x53')],{'foreignKey':_0x5234('0x1f9'),'as':'ToAccount'});db[_0x5234('0x124')][_0x5234('0x110')](db['Disposition'],{'as':_0x5234('0x17e'),'foreignKey':'ListId','onDelete':_0x5234('0x10d')});db[_0x5234('0x124')][_0x5234('0x110')](db[_0x5234('0x7c')],{'as':_0x5234('0x1fa'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x124')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x5234('0x10d'),'foreignKey':_0x5234('0x169')});db[_0x5234('0x124')][_0x5234('0x110')](db[_0x5234('0x116')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x5234('0x124')][_0x5234('0x110')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x5234('0x169')});db[_0x5234('0x124')][_0x5234('0x110')](db[_0x5234('0x7a')],{'as':_0x5234('0x7a'),'foreignKey':'ListId'});db[_0x5234('0x124')]['belongsToMany'](db[_0x5234('0x1a')],{'as':_0x5234('0x1fb'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x126')});db[_0x5234('0xf4')][_0x5234('0x110')](db[_0x5234('0x114')],{'as':'Extensions','onDelete':_0x5234('0x10d')});db[_0x5234('0xf4')][_0x5234('0x11f')](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':'UserVoicePrefix'});db[_0x5234('0xf4')][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x109'),'as':_0x5234('0x16f')});db[_0x5234('0xf5')][_0x5234('0x110')](db[_0x5234('0x10')],{'as':_0x5234('0x177'),'foreignKey':_0x5234('0x1fc')});db[_0x5234('0xf5')][_0x5234('0x110')](db[_0x5234('0x1fd')],{'as':_0x5234('0x1fe'),'foreignKey':_0x5234('0x1fc'),'onDelete':'cascade'});db[_0x5234('0x1fd')][_0x5234('0x110')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x5234('0x1ff'),'onDelete':_0x5234('0x10d')});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0x82')],{'as':_0x5234('0x17e'),'foreignKey':'WhatsappAccountId','onDelete':_0x5234('0x10d')});db['WhatsappAccount'][_0x5234('0x110')](db[_0x5234('0x81')],{'as':_0x5234('0x180'),'foreignKey':'WhatsappAccountId'});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0xff')],{'as':_0x5234('0x158'),'foreignKey':_0x5234('0x200')});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0xfe')],{'as':_0x5234('0x167')});db[_0x5234('0x13f')][_0x5234('0x110')](db[_0x5234('0xfc')],{'as':_0x5234('0x145')});db['WhatsappAccount'][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':_0x5234('0x168'),'foreignKey':'ListId'});db[_0x5234('0x13f')][_0x5234('0x11e')](db['Pause'],{'as':_0x5234('0x154'),'foreignKey':_0x5234('0x16c')});db[_0x5234('0x13f')]['belongsToMany'](db[_0x5234('0x10')],{'as':'Agents','through':_0x5234('0x141')});db[_0x5234('0xfc')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x5234('0xfc')][_0x5234('0x11e')](db[_0x5234('0x103')],{'onDelete':_0x5234('0x163')});db['WhatsappApplication'][_0x5234('0x11e')](db[_0x5234('0x13f')],{'onDelete':_0x5234('0x163')});db[_0x5234('0xfc')][_0x5234('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x5234('0x153')});db[_0x5234('0xfc')]['belongsTo'](db[_0x5234('0x173')],{'onDelete':_0x5234('0x163'),'foreignKey':_0x5234('0x183')});db[_0x5234('0xfe')][_0x5234('0x110')](db[_0x5234('0xff')],{'as':'Messages','onDelete':_0x5234('0x10d'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x5234('0x11e')](db[_0x5234('0x13f')],{'as':_0x5234('0x171'),'foreignKey':_0x5234('0x200')});db[_0x5234('0xfe')]['belongsTo'](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':_0x5234('0x160')});db['WhatsappInteraction']['belongsTo'](db[_0x5234('0x10')],{'as':_0x5234('0x172'),'foreignKey':_0x5234('0x10e')});db['WhatsappInteraction']['belongsToMany'](db[_0x5234('0x173')],{'through':_0x5234('0x201'),'as':'Tags'});db['WhatsappInteraction'][_0x5234('0x11f')](db[_0x5234('0x173')],{'through':'whatsapp_interaction_has_tags','as':_0x5234('0x176')});db[_0x5234('0xfe')]['belongsToMany'](db['User'],{'as':'Users','through':_0x5234('0x12d'),'foreignKey':_0x5234('0x202')});db[_0x5234('0xff')][_0x5234('0x11e')](db['User'],{'as':_0x5234('0x10')});db['WhatsappMessage'][_0x5234('0x11e')](db[_0x5234('0x72')],{'onDelete':_0x5234('0x10d'),'as':_0x5234('0x15f')});db[_0x5234('0xff')][_0x5234('0x11e')](db[_0x5234('0xfe')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x5234('0x202')});db[_0x5234('0xff')][_0x5234('0x11e')](db[_0x5234('0x13f')],{'as':'Account','foreignKey':_0x5234('0x200')});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x13f')],{});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x124')],{'as':'List','foreignKey':'ListId'});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x72')],{'as':_0x5234('0x15f'),'foreignKey':'ContactId'});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0xfe')],{});db[_0x5234('0x100')][_0x5234('0x11e')](db[_0x5234('0x103')],{});db[_0x5234('0x100')]['belongsTo'](db[_0x5234('0xff')],{});db[_0x5234('0x100')][_0x5234('0x11e')](db['User'],{});db[_0x5234('0x101')][_0x5234('0x11e')](db[_0x5234('0xff')],{});db[_0x5234('0x101')][_0x5234('0x11e')](db['WhatsappInteraction'],{});db[_0x5234('0x101')][_0x5234('0x11e')](db[_0x5234('0x13f')],{'foreignKey':_0x5234('0x203'),'as':_0x5234('0x1e5')});db[_0x5234('0x101')][_0x5234('0x11e')](db[_0x5234('0x13f')],{'foreignKey':_0x5234('0x204'),'as':_0x5234('0x1ed')});db[_0x5234('0x101')][_0x5234('0x11e')](db['WhatsappQueue'],{'foreignKey':_0x5234('0x205'),'as':_0x5234('0x1eb')});db[_0x5234('0x101')]['belongsTo'](db['User'],{'foreignKey':_0x5234('0x1e6'),'as':_0x5234('0x1e7')});db[_0x5234('0x101')]['belongsTo'](db[_0x5234('0x10')],{'foreignKey':_0x5234('0x1e8'),'as':_0x5234('0x1e9')});db[_0x5234('0x103')]['belongsToMany'](db[_0x5234('0x10')],{'as':_0x5234('0x16d'),'through':_0x5234('0x35'),'foreignKey':_0x5234('0x206')});db['WhatsappQueue'][_0x5234('0x11f')](db[_0x5234('0xe2')],{'through':_0x5234('0x1e1'),'as':'Teams'});db['UserSetting'][_0x5234('0x11e')](db['User'],{'as':_0x5234('0x207'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x5234('0x105')][_0x5234('0x165')](db['Dynamics365Account'],{'as':_0x5234('0x1d5'),'onDelete':_0x5234('0x163')});db['CloudProvider'][_0x5234('0x165')](db[_0x5234('0x37')],{'as':_0x5234('0x164'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':_0x5234('0x166'),'onDelete':_0x5234('0x163')});module[_0x5234('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5f3f=['userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','Applications','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','VoiceMailMessage','mailbox','QueueCalls','uniqueid','CmContact','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Smtp','Dispositions','Answers','MailMessage','Messages','Interactions','List','ListId','TemplateId','Pause','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessage','TagId','Items','FaxAccountId','Exntensions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelInteraction','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','ChatProactiveAction','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','CmContactId','HopperHistories','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','VoiceMusicOnHold','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','FieldId','Description','Field','Variable','DeskConfiguration','int_desk_configuration_has_tags','VariableId','ZohoAccount','ZohoField','Subject','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Field','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','team_has_sms_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','team_has_whatsapp_queues','UserSetting','Imap','exports','sequelize','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8','sequelizeHistory','utf8mb4','utf8_general_ci','username','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/user-setting/user-setting.model','cascade','UserId','hasOne','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','UserProfile'];(function(_0x25a23b,_0xca2f0d){var _0x1f01f6=function(_0x5d6410){while(--_0x5d6410){_0x25a23b['push'](_0x25a23b['shift']());}};_0x1f01f6(++_0xca2f0d);}(_0x5f3f,0xd7));var _0xf5f3=function(_0xc4a608,_0x45fecd){_0xc4a608=_0xc4a608-0x0;var _0x5e2730=_0x5f3f[_0xc4a608];return _0x5e2730;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xf5f3('0x0'));var _=require('lodash');var jstz=require(_0xf5f3('0x1'));var timezone=jstz['determine']();config[_0xf5f3('0x0')]=_[_0xf5f3('0x2')](config['sequelize'],{'database':_0xf5f3('0x3'),'username':_0xf5f3('0x4'),'password':_0xf5f3('0x5'),'options':{'host':_0xf5f3('0x6'),'port':0xcea,'dialect':_0xf5f3('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xf5f3('0x8'),'collate':'utf8_general_ci'}}});config[_0xf5f3('0x9')]=_[_0xf5f3('0x2')](config[_0xf5f3('0x9')],{'database':_0xf5f3('0x3'),'username':_0xf5f3('0x4'),'password':_0xf5f3('0x5'),'options':{'host':_0xf5f3('0x6'),'port':0xcea,'dialect':_0xf5f3('0x7'),'dialectOptions':{'charset':_0xf5f3('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xf5f3('0x8'),'collate':_0xf5f3('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf5f3('0x0')]['database'],config[_0xf5f3('0x0')][_0xf5f3('0xc')],config[_0xf5f3('0x0')]['password'],config[_0xf5f3('0x0')][_0xf5f3('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf5f3('0x9')][_0xf5f3('0xe')],config[_0xf5f3('0x9')][_0xf5f3('0xc')],config['sequelizeHistory']['password'],config['sequelizeHistory'][_0xf5f3('0xd')])};db[_0xf5f3('0xf')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x11'));db[_0xf5f3('0x12')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x13'));db[_0xf5f3('0x14')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x15'));db[_0xf5f3('0x16')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x17'));db['VoiceMusicOnHold']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x18'));db[_0xf5f3('0x19')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x1a'));db['VoiceRecording']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x1b'));db[_0xf5f3('0x1c')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x1d'));db[_0xf5f3('0x1e')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xf5f3('0x1f')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x20'));db[_0xf5f3('0x21')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x22'));db[_0xf5f3('0x23')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x24'));db[_0xf5f3('0x25')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x26'));db[_0xf5f3('0x27')]=db['sequelize']['import'](_0xf5f3('0x28'));db[_0xf5f3('0x29')]=db['sequelize']['import'](_0xf5f3('0x2a'));db[_0xf5f3('0x2b')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x2c'));db[_0xf5f3('0x2d')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x2e'));db[_0xf5f3('0x2f')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x30'));db[_0xf5f3('0x31')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x32'));db[_0xf5f3('0x33')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x34'));db[_0xf5f3('0x35')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x36'));db[_0xf5f3('0x37')]=db[_0xf5f3('0x0')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xf5f3('0x38')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xf5f3('0x39')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x3a'));db[_0xf5f3('0x3b')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x3c'));db[_0xf5f3('0x3d')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x3e'));db[_0xf5f3('0x3f')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x40'));db[_0xf5f3('0x41')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/mailQueue/mailQueue.model');db[_0xf5f3('0x42')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/mailSubstatus/mailSubstatus.model');db[_0xf5f3('0x43')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x44'));db['MailMessage']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x45'));db[_0xf5f3('0x46')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/mailApplication/mailApplication.model');db[_0xf5f3('0x47')]=db['sequelize'][_0xf5f3('0x10')]('../api/mailQueueReport/mailQueueReport.model');db[_0xf5f3('0x48')]=db['sequelize']['import'](_0xf5f3('0x49'));db[_0xf5f3('0x4a')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/dashboardItem/dashboardItem.model');db[_0xf5f3('0x4b')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x4c'));db[_0xf5f3('0x4d')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x4e'));db[_0xf5f3('0x4f')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x50'));db[_0xf5f3('0x51')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x52'));db[_0xf5f3('0x53')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x54'));db[_0xf5f3('0x55')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/smsAccount/smsAccount.model');db[_0xf5f3('0x56')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x57'));db[_0xf5f3('0x58')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/smsInteraction/smsInteraction.model');db[_0xf5f3('0x59')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x5a'));db['SmsQueue']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x5b'));db[_0xf5f3('0x5c')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x5d'));db[_0xf5f3('0x5e')]=db[_0xf5f3('0x0')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x5f'));db[_0xf5f3('0x60')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x61'));db[_0xf5f3('0x62')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x63'));db[_0xf5f3('0x64')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x65'));db[_0xf5f3('0x66')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x67'));db[_0xf5f3('0x68')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x69'));db[_0xf5f3('0x6a')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x6b'));db[_0xf5f3('0x6c')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x6d'));db['ChatOfflineMessage']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x6e'));db[_0xf5f3('0x6f')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x70'));db[_0xf5f3('0x71')]=db['sequelize'][_0xf5f3('0x10')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x72'));db['CmCompany']=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/cmCompany/cmCompany.model');db['CmContact']=db['sequelize'][_0xf5f3('0x10')]('../api/cmContact/cmContact.model');db[_0xf5f3('0x73')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x74'));db[_0xf5f3('0x75')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x76'));db['CmHopperFinal']=db['sequelize']['import'](_0xf5f3('0x77'));db[_0xf5f3('0x78')]=db['sequelize']['import'](_0xf5f3('0x79'));db[_0xf5f3('0x7a')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x7b'));db[_0xf5f3('0x7c')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x7d'));db[_0xf5f3('0x7e')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x7f'));db[_0xf5f3('0x80')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x81'));db[_0xf5f3('0x82')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x83'));db[_0xf5f3('0x84')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x85'));db[_0xf5f3('0x86')]=db['sequelize']['import'](_0xf5f3('0x87'));db[_0xf5f3('0x88')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/interval/interval.model');db['Pause']=db['sequelize']['import'](_0xf5f3('0x89'));db['Cdr']=db['sequelize']['import'](_0xf5f3('0x8a'));db[_0xf5f3('0x8b')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x8c'));db[_0xf5f3('0x8d')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x8e'));db[_0xf5f3('0x8f')]=db['sequelize'][_0xf5f3('0x10')]('../api/sound/sound.model');db[_0xf5f3('0x90')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/tag/tag.model');db[_0xf5f3('0x91')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x92'));db[_0xf5f3('0x93')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x94'));db[_0xf5f3('0x95')]=db[_0xf5f3('0x0')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xf5f3('0x96')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x97'));db[_0xf5f3('0x98')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x99'));db['Variable']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x9a'));db[_0xf5f3('0x9b')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x9c'));db[_0xf5f3('0x9d')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x9e'));db[_0xf5f3('0x9f')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xa0'));db[_0xf5f3('0xa1')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xa2'));db[_0xf5f3('0xa3')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xa4'));db[_0xf5f3('0xa5')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xa6'));db['AnalyticTreeReport']=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xa7'));db[_0xf5f3('0xa8')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xa9'));db[_0xf5f3('0xaa')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xab'));db[_0xf5f3('0xac')]=db['sequelize'][_0xf5f3('0x10')]('../api/intSalesforceField/intSalesforceField.model');db[_0xf5f3('0xad')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xf5f3('0xae')]=db['sequelize']['import'](_0xf5f3('0xaf'));db[_0xf5f3('0xb0')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xb1'));db[_0xf5f3('0xb2')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xb3'));db['DeskConfiguration']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xb4'));db[_0xf5f3('0xb5')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xb6'));db['ZohoAccount']=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/intZohoAccount/intZohoAccount.model');db[_0xf5f3('0xb7')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xb8'));db['ZohoField']=db['sequelize'][_0xf5f3('0x10')]('../api/intZohoField/intZohoField.model');db[_0xf5f3('0xb9')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xba'));db[_0xf5f3('0xbb')]=db[_0xf5f3('0x0')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xf5f3('0xbc')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xbd'));db[_0xf5f3('0xbe')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xf5f3('0xbf')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xc0'));db[_0xf5f3('0xc1')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xc2'));db[_0xf5f3('0xc3')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xc4'));db[_0xf5f3('0xc5')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xc6'));db[_0xf5f3('0xc7')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xc8'));db[_0xf5f3('0xc9')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xca'));db[_0xf5f3('0xcb')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xcc'));db[_0xf5f3('0xcd')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xce'));db[_0xf5f3('0xcf')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xd0'));db[_0xf5f3('0xd1')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xd2'));db['Dynamics365Field']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xd3'));db['FreshsalesAccount']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xd4'));db[_0xf5f3('0xd5')]=db['sequelize']['import'](_0xf5f3('0xd6'));db[_0xf5f3('0xd7')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xd8'));db[_0xf5f3('0x9b')]=db['sequelize']['import'](_0xf5f3('0x9c'));db['Network']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xd9'));db[_0xf5f3('0xda')]=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xf5f3('0xdb')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xdc'));db[_0xf5f3('0xdd')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xde'));db['JscriptyQuestionReport']=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xdf'));db[_0xf5f3('0xe0')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xf5f3('0xe1')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0xe2'));db['SquareReport']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xe3'));db['SquareDetailsReport']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xe4'));db[_0xf5f3('0xe5')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xe6'));db['Setting']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xe7'));db[_0xf5f3('0xe8')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xe9'));db[_0xf5f3('0xea')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xeb'));db[_0xf5f3('0xec')]=db['sequelize'][_0xf5f3('0x10')]('../api/squareRecording/squareRecording.model');db[_0xf5f3('0xed')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xee'));db[_0xf5f3('0xef')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/team/team.model');db[_0xf5f3('0xf0')]=db['sequelize'][_0xf5f3('0x10')]('../api/license/license.model');db[_0xf5f3('0xf1')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xf2'));db[_0xf5f3('0xf3')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xf4'));db[_0xf5f3('0xf5')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xf6'));db[_0xf5f3('0xf7')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xf8'));db[_0xf5f3('0xf9')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xfa'));db[_0xf5f3('0xfb')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/chatTransferReport/chatTransferReport.model');db[_0xf5f3('0xfc')]=db[_0xf5f3('0x0')]['import'](_0xf5f3('0xfd'));db[_0xf5f3('0xfe')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0xff'));db[_0xf5f3('0x100')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x101'));db[_0xf5f3('0x102')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x103'));db['VoicePrefix']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x104'));db['UserProfile']=db[_0xf5f3('0x0')]['import'](_0xf5f3('0x105'));db[_0xf5f3('0x106')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x107'));db[_0xf5f3('0x108')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x109'));db[_0xf5f3('0x10a')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x10b'));db[_0xf5f3('0x10c')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x10d'));db[_0xf5f3('0x10e')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x10f'));db[_0xf5f3('0x110')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xf5f3('0x111')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x112'));db[_0xf5f3('0x113')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x114'));db[_0xf5f3('0x115')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x116'));db['CloudProvider']=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/cloudProvider/cloudProvider.model');db[_0xf5f3('0x117')]=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x118'));db[_0xf5f3('0x119')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')](_0xf5f3('0x11a'));db[_0xf5f3('0x11b')]=db[_0xf5f3('0x0')][_0xf5f3('0x10')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db['sequelize'][_0xf5f3('0x10')](_0xf5f3('0x11c'));db[_0xf5f3('0xf')]['hasOne'](db[_0xf5f3('0x1e')],{'as':'VoiceMail','onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x11f')](db['UserSetting'],{'as':_0xf5f3('0x120'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db[_0xf5f3('0x122')],{'as':_0xf5f3('0x123'),'foreignKey':'UserId'});db['User'][_0xf5f3('0x121')](db[_0xf5f3('0x2d')],{'as':_0xf5f3('0x124'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db[_0xf5f3('0x16')],{'as':'Extensions','onDelete':_0xf5f3('0x11d'),'hooks':!![]});db[_0xf5f3('0xf')]['hasMany'](db[_0xf5f3('0x125')],{'as':_0xf5f3('0x126'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db[_0xf5f3('0x78')],{'as':_0xf5f3('0x127'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db[_0xf5f3('0x7a')],{'as':_0xf5f3('0x7a'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db['OpenchannelInteraction'],{'as':_0xf5f3('0x128'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db['ChatInteraction'],{'as':_0xf5f3('0x129'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')]['hasMany'](db[_0xf5f3('0x58')],{'as':_0xf5f3('0x12a'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db[_0xf5f3('0x4d')],{'as':_0xf5f3('0x12b'),'foreignKey':'UserId'});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db['MailInteraction'],{'as':_0xf5f3('0x12c'),'foreignKey':'UserId'});db[_0xf5f3('0xf')]['hasMany'](db[_0xf5f3('0x110')],{'as':_0xf5f3('0x12d'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0xf')][_0xf5f3('0x121')](db['UserNotification'],{'as':_0xf5f3('0x12e'),'foreignKey':_0xf5f3('0x12f')});db[_0xf5f3('0xf')]['belongsTo'](db[_0xf5f3('0x130')],{'as':_0xf5f3('0x130'),'foreignKey':_0xf5f3('0x131')});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x71')],{'as':'Groups','through':_0xf5f3('0x133')});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db['CmContact'],{'as':_0xf5f3('0x134'),'through':_0xf5f3('0x135')});db['User']['belongsToMany'](db['CmList'],{'as':_0xf5f3('0x136'),'through':_0xf5f3('0x137')});db['User'][_0xf5f3('0x132')](db['Team'],{'through':_0xf5f3('0x138')});db[_0xf5f3('0xf')]['belongsToMany'](db[_0xf5f3('0x43')],{'as':_0xf5f3('0x12c'),'through':_0xf5f3('0x139')});db[_0xf5f3('0xf')]['belongsToMany'](db[_0xf5f3('0x6a')],{'as':_0xf5f3('0x129'),'through':'user_has_chat_interactions'});db['User'][_0xf5f3('0x132')](db[_0xf5f3('0x4d')],{'as':'FaxInteractions','through':_0xf5f3('0x13a')});db[_0xf5f3('0xf')]['belongsToMany'](db[_0xf5f3('0x58')],{'as':_0xf5f3('0x12a'),'through':_0xf5f3('0x13b')});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db['OpenchannelInteraction'],{'as':_0xf5f3('0x128'),'through':'user_has_openchannel_interactions'});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x110')],{'as':_0xf5f3('0x12d'),'through':'user_has_whatsapp_interactions'});db['User'][_0xf5f3('0x132')](db['VoiceQueue'],{'as':_0xf5f3('0x13c'),'through':_0xf5f3('0x2f'),'required':![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x13d')],{'as':_0xf5f3('0x13e'),'through':_0xf5f3('0x11b'),'required':![]});db['User'][_0xf5f3('0x132')](db['MailQueue'],{'as':_0xf5f3('0x13f'),'through':_0xf5f3('0x33'),'required':![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x6f')],{'as':_0xf5f3('0x140'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x51')],{'as':_0xf5f3('0x141'),'through':_0xf5f3('0x35'),'required':![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x142')],{'as':_0xf5f3('0x143'),'through':_0xf5f3('0x37'),'required':![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x62')],{'as':_0xf5f3('0x144'),'through':_0xf5f3('0x38'),'required':![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x115')],{'as':_0xf5f3('0x145'),'through':_0xf5f3('0x39'),'required':![]});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x102')],{'through':_0xf5f3('0x137')});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xf5f3('0x146')});db['User']['belongsToMany'](db['FaxAccount'],{'as':_0xf5f3('0x147'),'through':_0xf5f3('0x148')});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x3f')],{'as':_0xf5f3('0x149'),'through':'user_has_mail_accounts'});db['User'][_0xf5f3('0x132')](db[_0xf5f3('0x5c')],{'as':_0xf5f3('0x14a'),'through':_0xf5f3('0x14b')});db['User'][_0xf5f3('0x132')](db[_0xf5f3('0x55')],{'as':_0xf5f3('0x14c'),'through':_0xf5f3('0x14d')});db[_0xf5f3('0xf')][_0xf5f3('0x132')](db[_0xf5f3('0x10c')],{'as':'WhatsappAccounts','through':_0xf5f3('0x14e')});db[_0xf5f3('0xf')]['belongsToMany'](db[_0xf5f3('0xea')],{'as':_0xf5f3('0x14f'),'through':'user_has_square_projects'});db[_0xf5f3('0x12')][_0xf5f3('0x121')](db[_0xf5f3('0x16')],{'as':_0xf5f3('0x150'),'onDelete':_0xf5f3('0x11d'),'foreignKey':'ChanSpyId'});db[_0xf5f3('0x14')][_0xf5f3('0x121')](db[_0xf5f3('0x16')],{'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x16')][_0xf5f3('0x121')](db[_0xf5f3('0x16')],{'as':_0xf5f3('0x151'),'onDelete':_0xf5f3('0x11d')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xf5f3('0x8f')],{'as':_0xf5f3('0x152'),'through':_0xf5f3('0x153')});db[_0xf5f3('0x19')][_0xf5f3('0x121')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0xf5f3('0x19')][_0xf5f3('0x121')](db[_0xf5f3('0x73')],{'as':_0xf5f3('0x154'),'foreignKey':_0xf5f3('0x155')});db[_0xf5f3('0x19')][_0xf5f3('0x121')](db[_0xf5f3('0x125')],{'as':'HopperFinals','foreignKey':_0xf5f3('0x155')});db['VoiceQueue'][_0xf5f3('0x121')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xf5f3('0x155')});db['VoiceQueue'][_0xf5f3('0x121')](db[_0xf5f3('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xf5f3('0x155')});db[_0xf5f3('0x19')][_0xf5f3('0x121')](db[_0xf5f3('0x75')],{'as':_0xf5f3('0x156'),'foreignKey':'VoiceQueueId'});db[_0xf5f3('0x19')][_0xf5f3('0x121')](db['JscriptySessionReport'],{'as':_0xf5f3('0x157'),'foreignKey':_0xf5f3('0x155')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0xf5f3('0x29'),'foreignKey':_0xf5f3('0x158')});db[_0xf5f3('0x19')][_0xf5f3('0x159')](db[_0xf5f3('0x29')],{'as':_0xf5f3('0x15a'),'foreignKey':_0xf5f3('0x15b')});db['VoiceQueue'][_0xf5f3('0x159')](db[_0xf5f3('0x88')],{'as':'Interval','foreignKey':_0xf5f3('0x15c')});db[_0xf5f3('0x19')]['belongsTo'](db['Pause'],{'as':_0xf5f3('0x15d'),'foreignKey':_0xf5f3('0x15e')});db[_0xf5f3('0x19')][_0xf5f3('0x132')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x136'),'through':_0xf5f3('0x15f')});db['VoiceQueue'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x2f')});db[_0xf5f3('0x19')][_0xf5f3('0x132')](db['Team'],{'as':_0xf5f3('0x161'),'through':'TeamVoiceQueue'});db[_0xf5f3('0x19')][_0xf5f3('0x132')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x162'),'through':_0xf5f3('0x163')});db[_0xf5f3('0x122')][_0xf5f3('0x159')](db['User'],{'as':_0xf5f3('0xf'),'foreignKey':'UserId'});db[_0xf5f3('0x1c')][_0xf5f3('0x159')](db['User'],{'as':_0xf5f3('0xf'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0x1e')][_0xf5f3('0x121')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xf5f3('0x164'),'sourceKey':'mailbox'});db[_0xf5f3('0x165')]['belongsTo'](db[_0xf5f3('0x1e')],{'foreignKey':_0xf5f3('0x164'),'targetKey':_0xf5f3('0x166')});db['VoiceCallReport']['hasMany'](db[_0xf5f3('0x25')],{'as':_0xf5f3('0x167'),'foreignKey':_0xf5f3('0x168'),'constraints':![]});db['VoiceCallReport'][_0xf5f3('0x121')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xf5f3('0x1f')]['belongsTo'](db[_0xf5f3('0xf')],{'as':_0xf5f3('0xf'),'foreignKey':_0xf5f3('0x11e')});db['VoiceCallReport']['belongsTo'](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x3b')][_0xf5f3('0x159')](db[_0xf5f3('0x3f')],{'as':_0xf5f3('0x3f'),'foreignKey':_0xf5f3('0x16c')});db[_0xf5f3('0x3b')]['belongsTo'](db[_0xf5f3('0x16d')],{'as':_0xf5f3('0x16d'),'foreignKey':_0xf5f3('0x16e'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x3d')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xf5f3('0x16c')});db[_0xf5f3('0x3d')]['belongsTo'](db[_0xf5f3('0x16d')],{'as':'CloudProvider','foreignKey':_0xf5f3('0x16e'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x3f')][_0xf5f3('0x11f')](db[_0xf5f3('0x3b')],{'as':'Imap','onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x3f')][_0xf5f3('0x11f')](db['MailServerOut'],{'as':_0xf5f3('0x170'),'onDelete':'cascade'});db[_0xf5f3('0x3f')][_0xf5f3('0x121')](db[_0xf5f3('0x84')],{'as':_0xf5f3('0x171'),'foreignKey':_0xf5f3('0x16c'),'onDelete':'cascade'});db['MailAccount'][_0xf5f3('0x121')](db['CannedAnswer'],{'as':_0xf5f3('0x172'),'foreignKey':_0xf5f3('0x16c')});db[_0xf5f3('0x3f')]['hasMany'](db[_0xf5f3('0x173')],{'as':_0xf5f3('0x174'),'foreignKey':_0xf5f3('0x16c')});db['MailAccount'][_0xf5f3('0x121')](db['MailInteraction'],{'as':_0xf5f3('0x175')});db[_0xf5f3('0x3f')]['hasMany'](db[_0xf5f3('0x46')],{'as':_0xf5f3('0x151')});db[_0xf5f3('0x3f')][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x3f')]['belongsTo'](db[_0xf5f3('0x96')],{'as':_0xf5f3('0x96'),'foreignKey':_0xf5f3('0x178')});db[_0xf5f3('0x3f')][_0xf5f3('0x159')](db[_0xf5f3('0x179')],{'as':_0xf5f3('0x15d'),'foreignKey':_0xf5f3('0x15e')});db[_0xf5f3('0x3f')]['belongsToMany'](db['User'],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x17a')});db[_0xf5f3('0x41')]['belongsToMany'](db['User'],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x33')});db[_0xf5f3('0x41')][_0xf5f3('0x132')](db['Team'],{'through':_0xf5f3('0x17b'),'as':_0xf5f3('0x161')});db[_0xf5f3('0x43')]['hasMany'](db[_0xf5f3('0x173')],{'as':_0xf5f3('0x174'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x17c')});db[_0xf5f3('0x43')][_0xf5f3('0x159')](db[_0xf5f3('0x3f')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x16c')});db[_0xf5f3('0x43')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'as':'Contact','foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x43')][_0xf5f3('0x159')](db['User'],{'as':_0xf5f3('0x17e'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0x43')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x17f'),'as':_0xf5f3('0x180')});db[_0xf5f3('0x43')][_0xf5f3('0x132')](db['Tag'],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db['MailInteraction'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x181'),'through':_0xf5f3('0x139'),'foreignKey':'MailInteractionId'});db[_0xf5f3('0x173')][_0xf5f3('0x121')](db[_0xf5f3('0xf5')],{'as':'Attachments','onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x173')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0xf')});db[_0xf5f3('0x173')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0x16a')});db[_0xf5f3('0x173')][_0xf5f3('0x159')](db[_0xf5f3('0x43')],{'as':_0xf5f3('0x182'),'foreignKey':_0xf5f3('0x17c')});db[_0xf5f3('0x173')]['belongsTo'](db[_0xf5f3('0x3f')],{'as':_0xf5f3('0x17d'),'foreignKey':'MailAccountId'});db[_0xf5f3('0x173')]['belongsTo'](db[_0xf5f3('0x64')],{'as':_0xf5f3('0x64'),'foreignKey':_0xf5f3('0x183')});db[_0xf5f3('0x173')][_0xf5f3('0x159')](db[_0xf5f3('0x184')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xf5f3('0x46')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'onDelete':'restrict'});db[_0xf5f3('0x46')]['belongsTo'](db[_0xf5f3('0x41')],{'onDelete':'restrict'});db[_0xf5f3('0x46')][_0xf5f3('0x159')](db[_0xf5f3('0x3f')],{'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x46')][_0xf5f3('0x159')](db[_0xf5f3('0x88')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xf5f3('0x46')][_0xf5f3('0x159')](db[_0xf5f3('0x90')],{'onDelete':'restrict','foreignKey':_0xf5f3('0x185')});db[_0xf5f3('0x47')][_0xf5f3('0x159')](db['MailAccount'],{});db['MailQueueReport'][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':'ListId'});db[_0xf5f3('0x47')][_0xf5f3('0x159')](db['CmContact'],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x47')]['belongsTo'](db[_0xf5f3('0x43')],{});db[_0xf5f3('0x47')]['belongsTo'](db[_0xf5f3('0x173')],{});db[_0xf5f3('0x47')][_0xf5f3('0x159')](db['User'],{});db[_0xf5f3('0x47')][_0xf5f3('0x159')](db['MailQueue'],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':_0xf5f3('0x186'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x4b')]['hasMany'](db[_0xf5f3('0x84')],{'as':_0xf5f3('0x171'),'foreignKey':_0xf5f3('0x187'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x4b')][_0xf5f3('0x121')](db['CannedAnswer'],{'as':_0xf5f3('0x172'),'foreignKey':'FaxAccountId'});db[_0xf5f3('0x4b')][_0xf5f3('0x121')](db[_0xf5f3('0x4d')],{'as':_0xf5f3('0x175')});db['FaxAccount'][_0xf5f3('0x121')](db['FaxApplication'],{'as':_0xf5f3('0x151')});db[_0xf5f3('0x4b')]['hasMany'](db['VoiceExtension'],{'as':_0xf5f3('0x188'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x4b')][_0xf5f3('0x121')](db['FaxMessage'],{'as':_0xf5f3('0x174')});db[_0xf5f3('0x4b')][_0xf5f3('0x159')](db['Trunk'],{'as':_0xf5f3('0x29')});db[_0xf5f3('0x4b')][_0xf5f3('0x159')](db['CmList'],{'as':_0xf5f3('0x176'),'foreignKey':'ListId'});db[_0xf5f3('0x4b')]['belongsTo'](db[_0xf5f3('0x179')],{'as':_0xf5f3('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':'Agents','through':_0xf5f3('0x148')});db[_0xf5f3('0x189')][_0xf5f3('0x159')](db['User'],{'onDelete':_0xf5f3('0x16f')});db['FaxApplication']['belongsTo'](db[_0xf5f3('0x51')],{'onDelete':'restrict'});db[_0xf5f3('0x189')][_0xf5f3('0x159')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xf5f3('0x189')][_0xf5f3('0x159')](db[_0xf5f3('0x90')],{'onDelete':_0xf5f3('0x16f'),'foreignKey':'TagId'});db['FaxInteraction'][_0xf5f3('0x121')](db[_0xf5f3('0x4f')],{'as':_0xf5f3('0x174'),'onDelete':'cascade','foreignKey':_0xf5f3('0x18a')});db[_0xf5f3('0x4d')]['belongsTo'](db['FaxAccount'],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x187')});db[_0xf5f3('0x4d')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':'ContactId'});db['FaxInteraction'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x17e'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0x4d')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x18b'),'as':_0xf5f3('0x180')});db[_0xf5f3('0x4d')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x18b'),'as':_0xf5f3('0x18c')});db[_0xf5f3('0x4d')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x181'),'through':'user_has_fax_interactions','foreignKey':_0xf5f3('0x18a')});db[_0xf5f3('0x4f')]['belongsTo'](db[_0xf5f3('0xf')],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0xf')});db[_0xf5f3('0x4f')][_0xf5f3('0x159')](db[_0xf5f3('0x4d')],{'as':_0xf5f3('0x182'),'foreignKey':_0xf5f3('0x18a')});db[_0xf5f3('0x4f')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage'][_0xf5f3('0x159')](db[_0xf5f3('0xf5')],{'as':_0xf5f3('0xf5'),'foreignKey':_0xf5f3('0x18d')});db['FaxMessage']['belongsTo'](db[_0xf5f3('0x4b')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x187')});db[_0xf5f3('0x51')]['belongsToMany'](db['User'],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x35')});db[_0xf5f3('0x51')][_0xf5f3('0x132')](db[_0xf5f3('0xef')],{'through':_0xf5f3('0x18e'),'as':_0xf5f3('0x161')});db[_0xf5f3('0x53')]['belongsTo'](db[_0xf5f3('0x4b')],{});db[_0xf5f3('0x53')][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':'ListId'});db[_0xf5f3('0x53')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x53')]['belongsTo'](db[_0xf5f3('0x4d')],{});db[_0xf5f3('0x53')][_0xf5f3('0x159')](db[_0xf5f3('0x4f')],{});db['FaxQueueReport'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{});db[_0xf5f3('0x53')][_0xf5f3('0x159')](db[_0xf5f3('0x51')],{});db[_0xf5f3('0x55')][_0xf5f3('0x121')](db[_0xf5f3('0x84')],{'as':'Dispositions','foreignKey':_0xf5f3('0x18f'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x55')][_0xf5f3('0x121')](db[_0xf5f3('0x82')],{'as':_0xf5f3('0x172'),'foreignKey':_0xf5f3('0x18f')});db[_0xf5f3('0x55')]['hasMany'](db[_0xf5f3('0x59')],{'as':'Messages','foreignKey':_0xf5f3('0x18f')});db[_0xf5f3('0x55')]['hasMany'](db[_0xf5f3('0x58')],{'as':'Interactions'});db[_0xf5f3('0x55')][_0xf5f3('0x121')](db[_0xf5f3('0x56')],{'as':'Applications'});db[_0xf5f3('0x55')][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x55')][_0xf5f3('0x159')](db['Pause'],{'as':_0xf5f3('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf5f3('0x55')]['belongsToMany'](db['User'],{'as':_0xf5f3('0x160'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x56')][_0xf5f3('0x159')](db[_0xf5f3('0x142')],{'onDelete':'restrict'});db[_0xf5f3('0x56')][_0xf5f3('0x159')](db['SmsAccount'],{'onDelete':_0xf5f3('0x16f')});db['SmsApplication'][_0xf5f3('0x159')](db[_0xf5f3('0x88')],{'onDelete':_0xf5f3('0x16f'),'foreignKey':_0xf5f3('0x15c')});db[_0xf5f3('0x56')][_0xf5f3('0x159')](db[_0xf5f3('0x90')],{'onDelete':'restrict','foreignKey':_0xf5f3('0x185')});db['SmsInteraction'][_0xf5f3('0x121')](db['SmsMessage'],{'as':_0xf5f3('0x174'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x190')});db[_0xf5f3('0x58')][_0xf5f3('0x159')](db['SmsAccount'],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x18f')});db[_0xf5f3('0x58')]['belongsTo'](db[_0xf5f3('0x169')],{'as':'Contact','foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x58')]['belongsTo'](db['User'],{'as':_0xf5f3('0x17e'),'foreignKey':'UserId'});db[_0xf5f3('0x58')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':'sms_interaction_has_tags','as':_0xf5f3('0x180')});db[_0xf5f3('0x58')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x191'),'as':'ThroughTags'});db['SmsInteraction'][_0xf5f3('0x132')](db['User'],{'as':_0xf5f3('0x181'),'through':_0xf5f3('0x13b'),'foreignKey':_0xf5f3('0x190')});db[_0xf5f3('0x59')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':'User'});db[_0xf5f3('0x59')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0x16a')});db['SmsMessage'][_0xf5f3('0x159')](db[_0xf5f3('0x58')],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0x182'),'foreignKey':_0xf5f3('0x190')});db[_0xf5f3('0x59')]['belongsTo'](db[_0xf5f3('0x55')],{'as':'Account','foreignKey':'SmsAccountId'});db['SmsQueue'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x37'),'foreignKey':'SmsQueueId'});db[_0xf5f3('0x142')][_0xf5f3('0x132')](db['Team'],{'through':'team_has_sms_queues','as':_0xf5f3('0x161')});db[_0xf5f3('0x5c')][_0xf5f3('0x121')](db[_0xf5f3('0x84')],{'as':_0xf5f3('0x171'),'foreignKey':_0xf5f3('0x192'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x5c')][_0xf5f3('0x121')](db['CannedAnswer'],{'as':_0xf5f3('0x172'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xf5f3('0x193')],{'as':_0xf5f3('0x175'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xf5f3('0x121')](db[_0xf5f3('0x60')],{'as':_0xf5f3('0x174'),'foreignKey':_0xf5f3('0x192')});db[_0xf5f3('0x5c')]['hasMany'](db[_0xf5f3('0x5e')],{'as':'Applications','foreignKey':_0xf5f3('0x192')});db['OpenchannelAccount'][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':'List','foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x5c')][_0xf5f3('0x159')](db['Pause'],{'as':_0xf5f3('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf5f3('0x5c')]['belongsToMany'](db['User'],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x14b')});db[_0xf5f3('0x5e')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'onDelete':'restrict'});db[_0xf5f3('0x5e')][_0xf5f3('0x159')](db[_0xf5f3('0x62')],{'onDelete':_0xf5f3('0x16f'),'foreignKey':_0xf5f3('0x194')});db[_0xf5f3('0x5e')][_0xf5f3('0x159')](db[_0xf5f3('0x5c')],{'onDelete':'restrict','foreignKey':_0xf5f3('0x192')});db['OpenchannelApplication'][_0xf5f3('0x159')](db[_0xf5f3('0x88')],{'onDelete':'restrict','foreignKey':_0xf5f3('0x15c')});db[_0xf5f3('0x5e')][_0xf5f3('0x159')](db[_0xf5f3('0x90')],{'onDelete':'restrict','foreignKey':'TagId'});db['OpenchannelInteraction'][_0xf5f3('0x121')](db[_0xf5f3('0x60')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xf5f3('0x195')});db['OpenchannelInteraction'][_0xf5f3('0x159')](db[_0xf5f3('0x5c')],{'as':'Account','foreignKey':_0xf5f3('0x192')});db[_0xf5f3('0x193')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':'ContactId'});db[_0xf5f3('0x193')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x17e'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0x193')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x196'),'as':_0xf5f3('0x180')});db[_0xf5f3('0x193')]['belongsToMany'](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x196'),'as':_0xf5f3('0x18c')});db['OpenchannelInteraction'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x181'),'through':_0xf5f3('0x197'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0xf')});db[_0xf5f3('0x60')]['belongsTo'](db[_0xf5f3('0x169')],{'onDelete':_0xf5f3('0x11d'),'as':'Contact'});db['OpenchannelMessage'][_0xf5f3('0x159')](db[_0xf5f3('0x193')],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0x182'),'foreignKey':_0xf5f3('0x195')});db['OpenchannelMessage'][_0xf5f3('0x159')](db[_0xf5f3('0xf5')],{'as':'Attachment','foreignKey':_0xf5f3('0x18d')});db[_0xf5f3('0x60')][_0xf5f3('0x159')](db[_0xf5f3('0x5c')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x192')});db[_0xf5f3('0x62')]['belongsToMany'](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x38'),'foreignKey':_0xf5f3('0x194')});db[_0xf5f3('0x62')][_0xf5f3('0x132')](db[_0xf5f3('0xef')],{'through':'team_has_openchannel_queues','as':_0xf5f3('0x161')});db[_0xf5f3('0x64')][_0xf5f3('0x121')](db[_0xf5f3('0x84')],{'as':_0xf5f3('0x171'),'foreignKey':'ChatWebsiteId','onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x64')][_0xf5f3('0x121')](db[_0xf5f3('0x82')],{'as':_0xf5f3('0x172'),'foreignKey':_0xf5f3('0x183')});db[_0xf5f3('0x64')]['hasMany'](db[_0xf5f3('0x198')],{'as':_0xf5f3('0x199')});db[_0xf5f3('0x64')][_0xf5f3('0x121')](db['ChatInteraction'],{'as':_0xf5f3('0x175')});db[_0xf5f3('0x64')][_0xf5f3('0x121')](db[_0xf5f3('0x68')],{'as':_0xf5f3('0x151')});db[_0xf5f3('0x64')][_0xf5f3('0x121')](db['ChatMessage'],{'as':'Messages'});db[_0xf5f3('0x64')][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x64')][_0xf5f3('0x159')](db['Interval'],{'as':'Interval','foreignKey':_0xf5f3('0x15c')});db['ChatWebsite']['belongsTo'](db[_0xf5f3('0x3f')],{'as':'MailAccount','foreignKey':_0xf5f3('0x16c')});db[_0xf5f3('0x64')][_0xf5f3('0x159')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xf5f3('0x15e')});db[_0xf5f3('0x64')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x146')});db[_0xf5f3('0x66')][_0xf5f3('0x159')](db[_0xf5f3('0x5c')],{});db[_0xf5f3('0x66')][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x66')]['belongsTo'](db[_0xf5f3('0x169')],{'as':'Contact','foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x66')][_0xf5f3('0x159')](db['OpenchannelInteraction'],{});db[_0xf5f3('0x66')][_0xf5f3('0x159')](db['OpenchannelMessage'],{});db[_0xf5f3('0x66')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{});db[_0xf5f3('0x66')][_0xf5f3('0x159')](db[_0xf5f3('0x62')],{});db['ChatApplication'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x19a'),'foreignKey':_0xf5f3('0x11e'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x68')][_0xf5f3('0x159')](db[_0xf5f3('0x6f')],{'as':_0xf5f3('0x19b'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0xf5f3('0x159')](db[_0xf5f3('0x64')],{'as':_0xf5f3('0x19c'),'foreignKey':_0xf5f3('0x183'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x68')][_0xf5f3('0x159')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xf5f3('0x185')});db[_0xf5f3('0x6a')]['hasMany'](db['ChatMessage'],{'as':_0xf5f3('0x174'),'onDelete':'cascade','foreignKey':_0xf5f3('0x19d')});db['ChatInteraction']['belongsTo'](db[_0xf5f3('0x64')],{'as':'Account','foreignKey':_0xf5f3('0x183')});db['ChatInteraction'][_0xf5f3('0x159')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xf5f3('0x6a')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x17e'),'foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0x6a')]['belongsToMany'](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x19e'),'as':_0xf5f3('0x180')});db[_0xf5f3('0x6a')][_0xf5f3('0x132')](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db['ChatInteraction'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':'Users','through':_0xf5f3('0x19f'),'foreignKey':'ChatInteractionId'});db[_0xf5f3('0x6c')][_0xf5f3('0x159')](db['User'],{'onDelete':_0xf5f3('0x11d'),'as':_0xf5f3('0xf')});db[_0xf5f3('0x6c')][_0xf5f3('0x159')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0xf5f3('0x6a')],{'onDelete':_0xf5f3('0x11d'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xf5f3('0x6c')]['belongsTo'](db[_0xf5f3('0xf5')],{'as':_0xf5f3('0xf5'),'foreignKey':_0xf5f3('0x18d')});db[_0xf5f3('0x6c')][_0xf5f3('0x159')](db[_0xf5f3('0x64')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x183')});db[_0xf5f3('0x184')][_0xf5f3('0x121')](db[_0xf5f3('0xf5')],{'as':_0xf5f3('0x1a0'),'foreignKey':_0xf5f3('0x1a1'),'onDelete':_0xf5f3('0x11d'),'hooks':!![]});db[_0xf5f3('0x184')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'onDelete':_0xf5f3('0x11d'),'as':'Contact','foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x184')][_0xf5f3('0x159')](db[_0xf5f3('0x64')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x183')});db[_0xf5f3('0x6f')][_0xf5f3('0x132')](db['User'],{'as':'Agents','through':_0xf5f3('0x31'),'hooks':!![]});db[_0xf5f3('0x6f')][_0xf5f3('0x132')](db[_0xf5f3('0xef')],{'through':_0xf5f3('0x1a2'),'as':_0xf5f3('0x161')});db[_0xf5f3('0x71')]['hasMany'](db['ChatInternalMessage'],{'as':_0xf5f3('0x174'),'foreignKey':_0xf5f3('0x1a3'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x71')][_0xf5f3('0x132')](db['User'],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction'][_0xf5f3('0x159')](db[_0xf5f3('0x64')],{'as':'Website','foreignKey':_0xf5f3('0x183')});db[_0xf5f3('0x1a4')][_0xf5f3('0x121')](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x134'),'foreignKey':_0xf5f3('0x1a5')});db[_0xf5f3('0x169')]['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0xf5f3('0x1a6')});db[_0xf5f3('0x169')][_0xf5f3('0x121')](db[_0xf5f3('0x73')],{'as':_0xf5f3('0x154'),'foreignKey':_0xf5f3('0x16b')});db['CmContact'][_0xf5f3('0x121')](db[_0xf5f3('0x125')],{'as':_0xf5f3('0x126'),'foreignKey':_0xf5f3('0x16b')});db['CmContact']['hasMany'](db[_0xf5f3('0x78')],{'as':_0xf5f3('0x1a7'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x169')][_0xf5f3('0x121')](db['ReportAgentPreview'],{'as':_0xf5f3('0x7a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x169')][_0xf5f3('0x121')](db[_0xf5f3('0xe0')],{'as':_0xf5f3('0x157'),'foreignKey':_0xf5f3('0x16b')});db['CmContact'][_0xf5f3('0x121')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xf5f3('0x169')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xf5f3('0x16b'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x169')][_0xf5f3('0x121')](db[_0xf5f3('0x58')],{'as':_0xf5f3('0x12a'),'foreignKey':_0xf5f3('0x16b'),'onDelete':_0xf5f3('0x16f')});db['CmContact'][_0xf5f3('0x121')](db[_0xf5f3('0x4d')],{'as':_0xf5f3('0x12b'),'foreignKey':_0xf5f3('0x16b'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x169')][_0xf5f3('0x121')](db['MailInteraction'],{'as':_0xf5f3('0x12c'),'foreignKey':_0xf5f3('0x16b'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x169')][_0xf5f3('0x159')](db[_0xf5f3('0x1a4')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x169')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x181'),'through':_0xf5f3('0x135')});db[_0xf5f3('0x169')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'as':_0xf5f3('0x180'),'through':_0xf5f3('0x1a8')});db['CmContact'][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x1a8'),'as':'ThroughTags'});db[_0xf5f3('0x73')][_0xf5f3('0x121')](db[_0xf5f3('0x95')],{'as':_0xf5f3('0x1a9'),'foreignKey':_0xf5f3('0x1aa')});db[_0xf5f3('0x73')]['belongsTo'](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x73')]['belongsTo'](db[_0xf5f3('0x102')],{'as':'List','foreignKey':_0xf5f3('0x177'),'onDelete':'cascade'});db[_0xf5f3('0x73')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':'Agent','foreignKey':_0xf5f3('0x11e')});db[_0xf5f3('0x73')][_0xf5f3('0x159')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xf5f3('0x155'),'onDelete':_0xf5f3('0x11d')});db['CmHopper'][_0xf5f3('0x159')](db[_0xf5f3('0xf1')],{'as':_0xf5f3('0xf1'),'foreignKey':_0xf5f3('0x1ab'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x73')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x17e'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xf5f3('0x159')](db['CmContact'],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x75')]['belongsTo'](db[_0xf5f3('0x102')],{'as':'List','foreignKey':_0xf5f3('0x177'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x75')][_0xf5f3('0x159')](db[_0xf5f3('0x19')],{'as':_0xf5f3('0x19b'),'foreignKey':'VoiceQueueId','onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x75')][_0xf5f3('0x159')](db[_0xf5f3('0xf1')],{'as':'Campaign','foreignKey':_0xf5f3('0x1ab'),'onDelete':'cascade'});db[_0xf5f3('0x80')]['hasMany'](db[_0xf5f3('0x86')],{'as':{'plural':'All','singular':_0xf5f3('0x1ac')},'foreignKey':_0xf5f3('0x1ad'),'onDelete':_0xf5f3('0x11d'),'hooks':!![]});db[_0xf5f3('0x80')][_0xf5f3('0x121')](db[_0xf5f3('0x86')],{'as':{'plural':_0xf5f3('0x1ae'),'singular':'OneAny'},'foreignKey':_0xf5f3('0x1af'),'onDelete':'cascade','hooks':!![]});db[_0xf5f3('0x80')][_0xf5f3('0x121')](db['Action'],{'as':_0xf5f3('0x1b0'),'foreignKey':_0xf5f3('0x1b1'),'onDelete':_0xf5f3('0x11d'),'hooks':!![]});db[_0xf5f3('0x84')][_0xf5f3('0x121')](db[_0xf5f3('0x84')],{'as':_0xf5f3('0x171'),'foreignKey':_0xf5f3('0x1b2'),'onDelete':'cascade'});db[_0xf5f3('0x88')][_0xf5f3('0x121')](db[_0xf5f3('0x88')],{'as':_0xf5f3('0x1b3'),'foreignKey':_0xf5f3('0x15c'),'onDelete':_0xf5f3('0x11d'),'hooks':!![],'required':![]});db['Interval'][_0xf5f3('0x121')](db[_0xf5f3('0x16')],{'as':_0xf5f3('0x1b4'),'foreignKey':'IntervalId','onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x88')][_0xf5f3('0x121')](db[_0xf5f3('0x46')],{'as':_0xf5f3('0x1b5'),'foreignKey':_0xf5f3('0x15c')});db[_0xf5f3('0x88')][_0xf5f3('0x121')](db[_0xf5f3('0x68')],{'as':_0xf5f3('0x1b6'),'foreignKey':'IntervalId'});db[_0xf5f3('0x88')][_0xf5f3('0x121')](db['FaxApplication'],{'as':_0xf5f3('0x1b7'),'foreignKey':_0xf5f3('0x15c')});db[_0xf5f3('0x88')]['hasMany'](db[_0xf5f3('0x56')],{'as':_0xf5f3('0x1b8'),'foreignKey':_0xf5f3('0x15c')});db['Schedule'][_0xf5f3('0x159')](db[_0xf5f3('0x3f')],{});db[_0xf5f3('0x8d')][_0xf5f3('0x159')](db[_0xf5f3('0xa1')],{'foreignKey':'DefaultReportId'});db[_0xf5f3('0x8d')]['belongsTo'](db[_0xf5f3('0x9f')],{'foreignKey':_0xf5f3('0x1b9')});db[_0xf5f3('0x8f')][_0xf5f3('0x132')](db[_0xf5f3('0x1ba')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x90')][_0xf5f3('0x132')](db[_0xf5f3('0x169')],{'through':_0xf5f3('0x1a8')});db[_0xf5f3('0x90')]['belongsToMany'](db[_0xf5f3('0x6a')],{'through':_0xf5f3('0x19e')});db['Tag']['belongsToMany'](db[_0xf5f3('0x43')],{'through':_0xf5f3('0x17f')});db[_0xf5f3('0x90')][_0xf5f3('0x132')](db[_0xf5f3('0x58')],{'through':_0xf5f3('0x191')});db[_0xf5f3('0x90')][_0xf5f3('0x132')](db[_0xf5f3('0x4d')],{'through':_0xf5f3('0x18b')});db[_0xf5f3('0x90')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xf5f3('0x196')});db[_0xf5f3('0x90')]['belongsToMany'](db[_0xf5f3('0x110')],{'through':_0xf5f3('0x1bb')});db[_0xf5f3('0x93')][_0xf5f3('0x159')](db[_0xf5f3('0x91')],{'as':_0xf5f3('0x1bc'),'foreignKey':_0xf5f3('0x1bd')});db['CmHopperAdditionalPhone']['belongsTo'](db[_0xf5f3('0x73')],{'as':_0xf5f3('0x1be'),'foreignKey':'CmHopperId'});db[_0xf5f3('0x93')]['belongsTo'](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x1a6')});db[_0xf5f3('0x98')][_0xf5f3('0x121')](db[_0xf5f3('0x86')],{'as':{'plural':_0xf5f3('0x1bf'),'singular':_0xf5f3('0x1c0')},'foreignKey':_0xf5f3('0x1c1'),'onDelete':'cascade','hooks':!![]});db[_0xf5f3('0x98')][_0xf5f3('0x121')](db[_0xf5f3('0x86')],{'as':{'plural':_0xf5f3('0x1c2'),'singular':'AnyCondition'},'foreignKey':_0xf5f3('0x1c3'),'onDelete':'cascade','hooks':!![]});db[_0xf5f3('0x98')]['hasMany'](db[_0xf5f3('0x7e')],{'as':_0xf5f3('0x1b0'),'foreignKey':_0xf5f3('0x1c4'),'onDelete':_0xf5f3('0x11d'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xf5f3('0xa5')],{'as':_0xf5f3('0x1c5'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1b9'),'hooks':!![]});db[_0xf5f3('0xa1')]['hasMany'](db[_0xf5f3('0xa5')],{'as':_0xf5f3('0x1c5'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1c6')});db[_0xf5f3('0xa3')]['hasMany'](db[_0xf5f3('0xa5')],{'as':_0xf5f3('0x1c5'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1c7')});db['AnalyticFieldReport'][_0xf5f3('0x159')](db[_0xf5f3('0xa3')],{'foreignKey':_0xf5f3('0x1c7')});db['SalesforceAccount'][_0xf5f3('0x121')](db[_0xf5f3('0xaa')],{'as':_0xf5f3('0x1c8'),'onDelete':_0xf5f3('0x11d'),'foreignKey':'AccountId'});db[_0xf5f3('0xaa')][_0xf5f3('0x121')](db[_0xf5f3('0xac')],{'as':_0xf5f3('0x1c9'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xaa')]['hasMany'](db[_0xf5f3('0xac')],{'as':_0xf5f3('0x1cb'),'onDelete':'cascade','foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xaa')][_0xf5f3('0x121')](db[_0xf5f3('0xac')],{'as':_0xf5f3('0x1c5'),'onDelete':_0xf5f3('0x11d'),'foreignKey':'FieldId'});db[_0xf5f3('0xaa')][_0xf5f3('0x159')](db['SalesforceAccount'],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xac')]['hasMany'](db[_0xf5f3('0xac')],{'as':'Subject','foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xac')]['hasMany'](db['SalesforceField'],{'as':'Description','foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xac')][_0xf5f3('0x121')](db[_0xf5f3('0xac')],{'as':'Field','foreignKey':_0xf5f3('0x1ce')});db['SalesforceField'][_0xf5f3('0x159')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xf5f3('0xad')][_0xf5f3('0x121')](db[_0xf5f3('0xae')],{'as':_0xf5f3('0x1c8'),'onDelete':'cascade','foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xae')]['hasMany'](db['SugarcrmField'],{'as':_0xf5f3('0x1c9'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xae')][_0xf5f3('0x121')](db[_0xf5f3('0xb0')],{'as':_0xf5f3('0x1cb'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cc')});db['SugarcrmConfiguration'][_0xf5f3('0x121')](db['SugarcrmField'],{'as':_0xf5f3('0x1c5'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ce')});db['SugarcrmConfiguration']['belongsTo'](db[_0xf5f3('0xad')],{'as':'Account','foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xb0')][_0xf5f3('0x121')](db[_0xf5f3('0xb0')],{'as':'Subject','foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xb0')][_0xf5f3('0x121')](db[_0xf5f3('0xb0')],{'as':_0xf5f3('0x1cf'),'foreignKey':'DescriptionId'});db[_0xf5f3('0xb0')]['hasMany'](db[_0xf5f3('0xb0')],{'as':_0xf5f3('0x1d0'),'foreignKey':'FieldId'});db[_0xf5f3('0xb0')][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':'VariableId'});db['DeskAccount'][_0xf5f3('0x121')](db[_0xf5f3('0x1d2')],{'as':_0xf5f3('0x1c8'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0x1d2')][_0xf5f3('0x121')](db['DeskField'],{'as':'Subjects','onDelete':_0xf5f3('0x11d'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xf5f3('0xb5')],{'as':'Descriptions','onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cc')});db['DeskConfiguration'][_0xf5f3('0x121')](db[_0xf5f3('0xb5')],{'as':'Fields','onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0x1d2')]['belongsTo'](db[_0xf5f3('0xb2')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0x1d2')][_0xf5f3('0x132')](db['Tag'],{'through':_0xf5f3('0x1d3')});db['DeskField'][_0xf5f3('0x121')](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xf5f3('0xb5')][_0xf5f3('0x121')](db[_0xf5f3('0xb5')],{'as':_0xf5f3('0x1cf'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xb5')]['hasMany'](db[_0xf5f3('0xb5')],{'as':'Field','foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0xb5')][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':_0xf5f3('0x1d4')});db[_0xf5f3('0x1d5')][_0xf5f3('0x121')](db[_0xf5f3('0xb7')],{'as':_0xf5f3('0x1c8'),'onDelete':'cascade','foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xb7')][_0xf5f3('0x121')](db[_0xf5f3('0x1d6')],{'as':_0xf5f3('0x1c9'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xb7')][_0xf5f3('0x121')](db['ZohoField'],{'as':_0xf5f3('0x1cb'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xb7')][_0xf5f3('0x121')](db[_0xf5f3('0x1d6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xf5f3('0x1ce')});db['ZohoConfiguration'][_0xf5f3('0x159')](db['ZohoAccount'],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1cd')});db['ZohoField'][_0xf5f3('0x121')](db[_0xf5f3('0x1d6')],{'as':_0xf5f3('0x1d7'),'foreignKey':_0xf5f3('0x1ca')});db['ZohoField'][_0xf5f3('0x121')](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf5f3('0x1d6')][_0xf5f3('0x121')](db[_0xf5f3('0x1d6')],{'as':_0xf5f3('0x1d0'),'foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0x1d6')][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':'VariableId'});db[_0xf5f3('0xb9')][_0xf5f3('0x121')](db[_0xf5f3('0xbb')],{'as':'Configurations','onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xbb')][_0xf5f3('0x121')](db[_0xf5f3('0xbc')],{'as':_0xf5f3('0x1c9'),'foreignKey':'SubjectId'});db[_0xf5f3('0xbb')][_0xf5f3('0x121')](db[_0xf5f3('0xbc')],{'as':_0xf5f3('0x1cb'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xbb')]['hasMany'](db[_0xf5f3('0xbc')],{'as':'Fields','foreignKey':_0xf5f3('0x1ce')});db['ZendeskConfiguration'][_0xf5f3('0x159')](db[_0xf5f3('0xb9')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xbb')]['belongsToMany'](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x1d8')});db['ZendeskField'][_0xf5f3('0x121')](db[_0xf5f3('0xbc')],{'as':'Subject','foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xbc')][_0xf5f3('0x121')](db[_0xf5f3('0xbc')],{'as':_0xf5f3('0x1cf'),'foreignKey':_0xf5f3('0x1cc')});db['ZendeskField'][_0xf5f3('0x121')](db[_0xf5f3('0xbc')],{'as':_0xf5f3('0x1d0'),'foreignKey':_0xf5f3('0x1ce')});db['ZendeskField']['belongsTo'](db[_0xf5f3('0x1d1')],{'as':'Variable','foreignKey':_0xf5f3('0x1d4')});db['FreshdeskAccount'][_0xf5f3('0x121')](db[_0xf5f3('0xbf')],{'as':_0xf5f3('0x1c8'),'onDelete':_0xf5f3('0x11d'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xf5f3('0x121')](db[_0xf5f3('0xc1')],{'as':_0xf5f3('0x1c9'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xbf')]['hasMany'](db[_0xf5f3('0xc1')],{'as':_0xf5f3('0x1cb'),'onDelete':_0xf5f3('0x11d'),'foreignKey':'DescriptionId'});db[_0xf5f3('0xbf')][_0xf5f3('0x121')](db[_0xf5f3('0xc1')],{'as':'Fields','onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1ce')});db['FreshdeskConfiguration'][_0xf5f3('0x159')](db[_0xf5f3('0xbe')],{'as':_0xf5f3('0x17d'),'foreignKey':'AccountId'});db[_0xf5f3('0xbf')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':_0xf5f3('0x1d9')});db['FreshdeskField'][_0xf5f3('0x121')](db[_0xf5f3('0xc1')],{'as':_0xf5f3('0x1d7'),'foreignKey':_0xf5f3('0x1ca')});db['FreshdeskField']['hasMany'](db[_0xf5f3('0xc1')],{'as':_0xf5f3('0x1cf'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xc1')][_0xf5f3('0x121')](db['FreshdeskField'],{'as':_0xf5f3('0x1d0'),'foreignKey':_0xf5f3('0x1ce')});db['FreshdeskField'][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':_0xf5f3('0x1d4')});db[_0xf5f3('0xc3')][_0xf5f3('0x121')](db[_0xf5f3('0xc5')],{'as':_0xf5f3('0x1c8'),'onDelete':_0xf5f3('0x11d'),'foreignKey':'AccountId'});db[_0xf5f3('0xc5')][_0xf5f3('0x121')](db[_0xf5f3('0xc7')],{'as':_0xf5f3('0x1c9'),'foreignKey':'SubjectId'});db[_0xf5f3('0xc5')]['hasMany'](db[_0xf5f3('0xc7')],{'as':_0xf5f3('0x1cb'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xc5')]['hasMany'](db[_0xf5f3('0xc7')],{'as':_0xf5f3('0x1c5'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0xf5f3('0x159')](db[_0xf5f3('0xc3')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1cd')});db['VtigerField'][_0xf5f3('0x121')](db[_0xf5f3('0xc7')],{'as':_0xf5f3('0x1d7'),'foreignKey':_0xf5f3('0x1ca')});db['VtigerField'][_0xf5f3('0x121')](db[_0xf5f3('0xc7')],{'as':_0xf5f3('0x1cf'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xc7')][_0xf5f3('0x121')](db['VtigerField'],{'as':_0xf5f3('0x1d0'),'foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0xc7')][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':_0xf5f3('0x1d4')});db[_0xf5f3('0xc9')][_0xf5f3('0x121')](db[_0xf5f3('0xcb')],{'as':'Configurations','onDelete':_0xf5f3('0x11d'),'foreignKey':'AccountId'});db[_0xf5f3('0xcb')][_0xf5f3('0x121')](db[_0xf5f3('0xcd')],{'as':_0xf5f3('0x1c9'),'foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xcb')][_0xf5f3('0x121')](db[_0xf5f3('0xcd')],{'as':_0xf5f3('0x1cb'),'foreignKey':_0xf5f3('0x1cc')});db['ServicenowConfiguration'][_0xf5f3('0x121')](db[_0xf5f3('0xcd')],{'as':_0xf5f3('0x1c5'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db[_0xf5f3('0xc9')],{'as':'Account','foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xcd')][_0xf5f3('0x121')](db[_0xf5f3('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xf5f3('0xcd')]['hasMany'](db[_0xf5f3('0xcd')],{'as':_0xf5f3('0x1cf'),'foreignKey':_0xf5f3('0x1cc')});db['ServicenowField']['hasMany'](db[_0xf5f3('0xcd')],{'as':_0xf5f3('0x1d0'),'foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0xcd')][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0xf5f3('0x121')](db[_0xf5f3('0xd1')],{'as':_0xf5f3('0x1c8'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xcf')][_0xf5f3('0x159')](db[_0xf5f3('0x16d')],{'as':'CloudProvider','foreignKey':_0xf5f3('0x16e')});db[_0xf5f3('0xd1')][_0xf5f3('0x121')](db[_0xf5f3('0x1da')],{'as':'Subjects','onDelete':_0xf5f3('0x11d'),'foreignKey':'SubjectId'});db[_0xf5f3('0xd1')][_0xf5f3('0x121')](db[_0xf5f3('0x1da')],{'as':_0xf5f3('0x1cb'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1cc')});db['Dynamics365Configuration'][_0xf5f3('0x121')](db[_0xf5f3('0x1da')],{'as':_0xf5f3('0x1c5'),'onDelete':'cascade','foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0xd1')][_0xf5f3('0x159')](db[_0xf5f3('0xcf')],{'as':_0xf5f3('0x17d'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0xf5f3('0x121')](db[_0xf5f3('0x1da')],{'as':_0xf5f3('0x1d7'),'foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0x1da')][_0xf5f3('0x121')](db['Dynamics365Field'],{'as':_0xf5f3('0x1cf'),'foreignKey':'DescriptionId'});db[_0xf5f3('0x1da')][_0xf5f3('0x121')](db[_0xf5f3('0x1da')],{'as':'Field','foreignKey':_0xf5f3('0x1ce')});db['Dynamics365Field'][_0xf5f3('0x159')](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':_0xf5f3('0x1d4')});db[_0xf5f3('0x1db')][_0xf5f3('0x121')](db['FreshsalesConfiguration'],{'as':_0xf5f3('0x1c8'),'onDelete':'cascade','foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xd5')]['hasMany'](db[_0xf5f3('0xd7')],{'as':_0xf5f3('0x1c9'),'foreignKey':_0xf5f3('0x1ca')});db['FreshsalesConfiguration'][_0xf5f3('0x121')](db['FreshsalesField'],{'as':_0xf5f3('0x1cb'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xd5')][_0xf5f3('0x121')](db[_0xf5f3('0xd7')],{'as':_0xf5f3('0x1c5'),'foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0xd5')][_0xf5f3('0x159')](db['FreshsalesAccount'],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1cd')});db[_0xf5f3('0xd7')][_0xf5f3('0x121')](db[_0xf5f3('0xd7')],{'as':'Subject','foreignKey':_0xf5f3('0x1ca')});db[_0xf5f3('0xd7')][_0xf5f3('0x121')](db[_0xf5f3('0xd7')],{'as':_0xf5f3('0x1cf'),'foreignKey':_0xf5f3('0x1cc')});db[_0xf5f3('0xd7')][_0xf5f3('0x121')](db[_0xf5f3('0xd7')],{'as':'Field','foreignKey':_0xf5f3('0x1ce')});db[_0xf5f3('0xd7')]['belongsTo'](db[_0xf5f3('0x1d1')],{'as':_0xf5f3('0x1d1'),'foreignKey':_0xf5f3('0x1d4')});db[_0xf5f3('0xda')][_0xf5f3('0x159')](db[_0xf5f3('0x64')],{});db[_0xf5f3('0xda')][_0xf5f3('0x159')](db['CmList'],{'as':_0xf5f3('0x176'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xf5f3('0x159')](db['CmContact'],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0xda')]['belongsTo'](db[_0xf5f3('0x6a')],{});db[_0xf5f3('0xda')][_0xf5f3('0x159')](db['ChatMessage'],{});db[_0xf5f3('0xda')]['belongsTo'](db['User'],{});db['ChatQueueReport'][_0xf5f3('0x159')](db[_0xf5f3('0x6f')],{});db['ChatInternalMessage']['belongsTo'](db[_0xf5f3('0xf')],{'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1dc')});db[_0xf5f3('0xdb')]['belongsTo'](db['User'],{'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1dd')});db['JscriptySessionReport'][_0xf5f3('0x121')](db[_0xf5f3('0x1de')],{'foreignKey':_0xf5f3('0x1df'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0xe0')]['hasMany'](db[_0xf5f3('0xdd')],{'foreignKey':_0xf5f3('0x1df'),'onDelete':'cascade'});db[_0xf5f3('0xe1')][_0xf5f3('0x159')](db[_0xf5f3('0x55')],{});db['SmsQueueReport'][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db['SmsQueueReport'][_0xf5f3('0x159')](db['CmContact'],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0xe1')][_0xf5f3('0x159')](db['SmsInteraction'],{});db[_0xf5f3('0xe1')][_0xf5f3('0x159')](db[_0xf5f3('0x59')],{});db[_0xf5f3('0xe1')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{});db[_0xf5f3('0xe1')]['belongsTo'](db[_0xf5f3('0x142')],{});db[_0xf5f3('0xe5')][_0xf5f3('0x121')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0xf5f3('0x1de')],{'foreignKey':'ProjectId'});db[_0xf5f3('0xe5')][_0xf5f3('0x121')](db[_0xf5f3('0xdd')],{'foreignKey':_0xf5f3('0x1e0')});db[_0xf5f3('0xea')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x181'),'through':_0xf5f3('0x1e1')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x138')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0x19')],{'through':_0xf5f3('0x117'),'as':_0xf5f3('0x13c')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0x41')],{'through':_0xf5f3('0x17b'),'as':_0xf5f3('0x13f')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0x6f')],{'through':_0xf5f3('0x1a2'),'as':_0xf5f3('0x140')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db['FaxQueue'],{'through':_0xf5f3('0x18e'),'as':_0xf5f3('0x141')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0x142')],{'through':_0xf5f3('0x1e2'),'as':_0xf5f3('0x143')});db['Team'][_0xf5f3('0x132')](db[_0xf5f3('0x62')],{'through':'team_has_openchannel_queues','as':_0xf5f3('0x144')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0x115')],{'through':'team_has_whatsapp_queues','as':_0xf5f3('0x145')});db[_0xf5f3('0xef')][_0xf5f3('0x132')](db[_0xf5f3('0x13d')],{'through':_0xf5f3('0x119'),'as':_0xf5f3('0x13e')});db[_0xf5f3('0xf1')][_0xf5f3('0x121')](db[_0xf5f3('0x73')],{'as':_0xf5f3('0x154'),'foreignKey':_0xf5f3('0x1ab')});db['Campaign'][_0xf5f3('0x121')](db['CmHopperFinal'],{'as':_0xf5f3('0x126'),'foreignKey':_0xf5f3('0x1ab')});db[_0xf5f3('0xf1')][_0xf5f3('0x121')](db[_0xf5f3('0x78')],{'as':_0xf5f3('0x1a7'),'foreignKey':_0xf5f3('0x1ab')});db[_0xf5f3('0xf1')][_0xf5f3('0x121')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xf5f3('0x1ab')});db[_0xf5f3('0xf1')][_0xf5f3('0x159')](db[_0xf5f3('0x29')],{'as':_0xf5f3('0x29'),'foreignKey':_0xf5f3('0x158')});db[_0xf5f3('0xf1')][_0xf5f3('0x159')](db['Trunk'],{'as':_0xf5f3('0x15a'),'foreignKey':_0xf5f3('0x15b')});db[_0xf5f3('0xf1')][_0xf5f3('0x159')](db[_0xf5f3('0x88')],{'as':_0xf5f3('0x88'),'foreignKey':_0xf5f3('0x15c')});db['Campaign'][_0xf5f3('0x159')](db[_0xf5f3('0xea')],{'as':'SquareProject','foreignKey':_0xf5f3('0x1e3')});db[_0xf5f3('0xf1')][_0xf5f3('0x132')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x136'),'through':_0xf5f3('0x1e4')});db[_0xf5f3('0xf1')][_0xf5f3('0x132')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x162'),'through':_0xf5f3('0x1e5')});db[_0xf5f3('0xf5')][_0xf5f3('0x159')](db['ChatOfflineMessage'],{'as':_0xf5f3('0x184'),'foreignKey':_0xf5f3('0x1a1')});db[_0xf5f3('0xf9')][_0xf5f3('0x159')](db[_0xf5f3('0x173')],{});db[_0xf5f3('0xf9')][_0xf5f3('0x159')](db[_0xf5f3('0x43')],{});db['MailTransferReport']['belongsTo'](db[_0xf5f3('0x3f')],{'foreignKey':_0xf5f3('0x1e6'),'as':_0xf5f3('0x1e7')});db[_0xf5f3('0xf9')]['belongsTo'](db[_0xf5f3('0xf')],{'foreignKey':_0xf5f3('0x1e8'),'as':_0xf5f3('0x1e9')});db[_0xf5f3('0xf9')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':_0xf5f3('0x1ea'),'as':'ToAgent'});db[_0xf5f3('0xf9')][_0xf5f3('0x159')](db['MailQueue'],{'foreignKey':_0xf5f3('0x1eb'),'as':_0xf5f3('0x1ec')});db[_0xf5f3('0xf9')]['belongsTo'](db[_0xf5f3('0x3f')],{'foreignKey':_0xf5f3('0x1ed'),'as':_0xf5f3('0x1ee')});db[_0xf5f3('0xfb')][_0xf5f3('0x159')](db[_0xf5f3('0x6c')],{});db['ChatTransferReport'][_0xf5f3('0x159')](db[_0xf5f3('0x6a')],{});db[_0xf5f3('0xfb')]['belongsTo'](db[_0xf5f3('0x64')],{'foreignKey':_0xf5f3('0x1ef'),'as':_0xf5f3('0x1e7')});db[_0xf5f3('0xfb')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':_0xf5f3('0x1e8'),'as':'FromAgent'});db[_0xf5f3('0xfb')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':'ToUserId','as':_0xf5f3('0x1f0')});db[_0xf5f3('0xfb')][_0xf5f3('0x159')](db[_0xf5f3('0x6f')],{'foreignKey':'ToChatQueueId','as':_0xf5f3('0x1ec')});db[_0xf5f3('0xfb')][_0xf5f3('0x159')](db[_0xf5f3('0x64')],{'foreignKey':_0xf5f3('0x1f1'),'as':_0xf5f3('0x1ee')});db[_0xf5f3('0xfc')][_0xf5f3('0x159')](db[_0xf5f3('0x4f')],{});db[_0xf5f3('0xfc')][_0xf5f3('0x159')](db['FaxInteraction'],{});db['FaxTransferReport'][_0xf5f3('0x159')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xf5f3('0xfc')]['belongsTo'](db[_0xf5f3('0xf')],{'foreignKey':'FromUserId','as':'FromAgent'});db['FaxTransferReport'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf5f3('0xfc')][_0xf5f3('0x159')](db[_0xf5f3('0x51')],{'foreignKey':_0xf5f3('0x1f2'),'as':'ToQueue'});db[_0xf5f3('0xfc')][_0xf5f3('0x159')](db[_0xf5f3('0x4b')],{'foreignKey':_0xf5f3('0x1f3'),'as':_0xf5f3('0x1ee')});db[_0xf5f3('0xfe')]['belongsTo'](db[_0xf5f3('0x60')],{});db['OpenchannelTransferReport'][_0xf5f3('0x159')](db['OpenchannelInteraction'],{});db[_0xf5f3('0xfe')][_0xf5f3('0x159')](db[_0xf5f3('0x5c')],{'foreignKey':_0xf5f3('0x1f4'),'as':_0xf5f3('0x1e7')});db[_0xf5f3('0xfe')]['belongsTo'](db[_0xf5f3('0xf')],{'foreignKey':'FromUserId','as':_0xf5f3('0x1e9')});db[_0xf5f3('0xfe')]['belongsTo'](db[_0xf5f3('0xf')],{'foreignKey':_0xf5f3('0x1ea'),'as':_0xf5f3('0x1f0')});db[_0xf5f3('0xfe')]['belongsTo'](db[_0xf5f3('0x62')],{'foreignKey':_0xf5f3('0x1f5'),'as':_0xf5f3('0x1ec')});db[_0xf5f3('0xfe')][_0xf5f3('0x159')](db[_0xf5f3('0x5c')],{'foreignKey':_0xf5f3('0x1f6'),'as':_0xf5f3('0x1ee')});db[_0xf5f3('0x100')][_0xf5f3('0x159')](db['SmsMessage'],{});db[_0xf5f3('0x100')][_0xf5f3('0x159')](db[_0xf5f3('0x58')],{});db[_0xf5f3('0x100')]['belongsTo'](db[_0xf5f3('0x55')],{'foreignKey':_0xf5f3('0x1f7'),'as':_0xf5f3('0x1e7')});db[_0xf5f3('0x100')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':'FromUserId','as':_0xf5f3('0x1e9')});db['SmsTransferReport'][_0xf5f3('0x159')](db['User'],{'foreignKey':'ToUserId','as':_0xf5f3('0x1f0')});db[_0xf5f3('0x100')][_0xf5f3('0x159')](db[_0xf5f3('0x142')],{'foreignKey':_0xf5f3('0x1f8'),'as':_0xf5f3('0x1ec')});db['SmsTransferReport'][_0xf5f3('0x159')](db[_0xf5f3('0x55')],{'foreignKey':_0xf5f3('0x1f9'),'as':_0xf5f3('0x1ee')});db[_0xf5f3('0x102')][_0xf5f3('0x121')](db[_0xf5f3('0x84')],{'as':_0xf5f3('0x171'),'foreignKey':'ListId','onDelete':_0xf5f3('0x11d')});db['CmList']['hasMany'](db[_0xf5f3('0x7c')],{'as':_0xf5f3('0x1fa'),'foreignKey':'ListId'});db[_0xf5f3('0x102')]['hasMany'](db[_0xf5f3('0x169')],{'as':'Contacts','onDelete':_0xf5f3('0x11d'),'foreignKey':'ListId'});db[_0xf5f3('0x102')]['hasMany'](db[_0xf5f3('0x125')],{'as':'HopperFinals','foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x102')][_0xf5f3('0x121')](db[_0xf5f3('0x78')],{'as':'HopperHistory','foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x102')][_0xf5f3('0x121')](db[_0xf5f3('0x7a')],{'as':_0xf5f3('0x7a'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x102')]['belongsToMany'](db[_0xf5f3('0x19')],{'as':'Queues','through':_0xf5f3('0x15f')});db[_0xf5f3('0x102')]['belongsToMany'](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x137')});db[_0xf5f3('0x13d')][_0xf5f3('0x121')](db[_0xf5f3('0x16')],{'as':_0xf5f3('0x1b4'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x13d')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x11b')});db[_0xf5f3('0x13d')][_0xf5f3('0x132')](db['Team'],{'through':_0xf5f3('0x119'),'as':_0xf5f3('0x161')});db[_0xf5f3('0x130')][_0xf5f3('0x121')](db['User'],{'as':'Users','foreignKey':_0xf5f3('0x131')});db[_0xf5f3('0x130')][_0xf5f3('0x121')](db[_0xf5f3('0x106')],{'as':_0xf5f3('0x1fb'),'foreignKey':'userProfileId','onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x106')]['hasMany'](db[_0xf5f3('0x108')],{'as':'Resources','foreignKey':_0xf5f3('0x1fc'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x10c')][_0xf5f3('0x121')](db['Disposition'],{'as':_0xf5f3('0x171'),'foreignKey':_0xf5f3('0x1fd'),'onDelete':_0xf5f3('0x11d')});db[_0xf5f3('0x10c')][_0xf5f3('0x121')](db['CannedAnswer'],{'as':_0xf5f3('0x172'),'foreignKey':'WhatsappAccountId'});db[_0xf5f3('0x10c')][_0xf5f3('0x121')](db[_0xf5f3('0x111')],{'as':_0xf5f3('0x174'),'foreignKey':_0xf5f3('0x1fd')});db[_0xf5f3('0x10c')][_0xf5f3('0x121')](db[_0xf5f3('0x110')],{'as':_0xf5f3('0x175')});db[_0xf5f3('0x10c')][_0xf5f3('0x121')](db[_0xf5f3('0x10e')],{'as':_0xf5f3('0x151')});db[_0xf5f3('0x10c')][_0xf5f3('0x159')](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x10c')]['belongsTo'](db[_0xf5f3('0x179')],{'as':_0xf5f3('0x15d'),'foreignKey':_0xf5f3('0x15e')});db[_0xf5f3('0x10c')][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':'user_has_whatsapp_accounts'});db[_0xf5f3('0x10e')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'onDelete':_0xf5f3('0x16f')});db['WhatsappApplication'][_0xf5f3('0x159')](db[_0xf5f3('0x115')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xf5f3('0x159')](db[_0xf5f3('0x10c')],{'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x10e')][_0xf5f3('0x159')](db[_0xf5f3('0x88')],{'onDelete':_0xf5f3('0x16f'),'foreignKey':'IntervalId'});db[_0xf5f3('0x10e')][_0xf5f3('0x159')](db[_0xf5f3('0x90')],{'onDelete':_0xf5f3('0x16f'),'foreignKey':_0xf5f3('0x185')});db[_0xf5f3('0x110')][_0xf5f3('0x121')](db[_0xf5f3('0x111')],{'as':_0xf5f3('0x174'),'onDelete':_0xf5f3('0x11d'),'foreignKey':_0xf5f3('0x1fe')});db[_0xf5f3('0x110')][_0xf5f3('0x159')](db[_0xf5f3('0x10c')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1fd')});db[_0xf5f3('0x110')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':'ContactId'});db[_0xf5f3('0x110')]['belongsTo'](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x17e'),'foreignKey':'UserId'});db[_0xf5f3('0x110')][_0xf5f3('0x132')](db[_0xf5f3('0x90')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xf5f3('0x110')]['belongsToMany'](db[_0xf5f3('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0xf5f3('0x18c')});db[_0xf5f3('0x110')]['belongsToMany'](db['User'],{'as':'Users','through':_0xf5f3('0x1ff'),'foreignKey':'WhatsappInteractionId'});db[_0xf5f3('0x111')]['belongsTo'](db[_0xf5f3('0xf')],{'as':'User'});db[_0xf5f3('0x111')][_0xf5f3('0x159')](db['CmContact'],{'onDelete':_0xf5f3('0x11d'),'as':'Contact'});db['WhatsappMessage'][_0xf5f3('0x159')](db[_0xf5f3('0x110')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xf5f3('0x1fe')});db[_0xf5f3('0x111')]['belongsTo'](db[_0xf5f3('0x10c')],{'as':_0xf5f3('0x17d'),'foreignKey':_0xf5f3('0x1fd')});db[_0xf5f3('0x113')][_0xf5f3('0x159')](db[_0xf5f3('0x10c')],{});db[_0xf5f3('0x113')]['belongsTo'](db[_0xf5f3('0x102')],{'as':_0xf5f3('0x176'),'foreignKey':_0xf5f3('0x177')});db[_0xf5f3('0x113')][_0xf5f3('0x159')](db[_0xf5f3('0x169')],{'as':_0xf5f3('0x16a'),'foreignKey':_0xf5f3('0x16b')});db[_0xf5f3('0x113')][_0xf5f3('0x159')](db[_0xf5f3('0x110')],{});db[_0xf5f3('0x113')]['belongsTo'](db[_0xf5f3('0x115')],{});db[_0xf5f3('0x113')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{});db[_0xf5f3('0x200')][_0xf5f3('0x159')](db[_0xf5f3('0x111')],{});db[_0xf5f3('0x200')][_0xf5f3('0x159')](db[_0xf5f3('0x110')],{});db[_0xf5f3('0x200')]['belongsTo'](db[_0xf5f3('0x10c')],{'foreignKey':_0xf5f3('0x201'),'as':_0xf5f3('0x1e7')});db[_0xf5f3('0x200')][_0xf5f3('0x159')](db['WhatsappAccount'],{'foreignKey':_0xf5f3('0x202'),'as':_0xf5f3('0x1ee')});db[_0xf5f3('0x200')][_0xf5f3('0x159')](db[_0xf5f3('0x115')],{'foreignKey':'ToQueueId','as':_0xf5f3('0x1ec')});db[_0xf5f3('0x200')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':_0xf5f3('0x1e8'),'as':_0xf5f3('0x1e9')});db[_0xf5f3('0x200')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'foreignKey':_0xf5f3('0x1ea'),'as':_0xf5f3('0x1f0')});db['WhatsappQueue'][_0xf5f3('0x132')](db[_0xf5f3('0xf')],{'as':_0xf5f3('0x160'),'through':_0xf5f3('0x39'),'foreignKey':_0xf5f3('0x203')});db[_0xf5f3('0x115')][_0xf5f3('0x132')](db['Team'],{'through':_0xf5f3('0x204'),'as':_0xf5f3('0x161')});db[_0xf5f3('0x205')][_0xf5f3('0x159')](db[_0xf5f3('0xf')],{'as':'user','foreignKey':_0xf5f3('0x11e'),'onDelete':_0xf5f3('0x11d'),'hooks':!![]});db['CloudProvider'][_0xf5f3('0x11f')](db[_0xf5f3('0xcf')],{'as':_0xf5f3('0xcf'),'onDelete':'restrict'});db[_0xf5f3('0x16d')][_0xf5f3('0x11f')](db[_0xf5f3('0x3b')],{'as':_0xf5f3('0x206'),'onDelete':_0xf5f3('0x16f')});db[_0xf5f3('0x16d')][_0xf5f3('0x11f')](db[_0xf5f3('0x3d')],{'as':_0xf5f3('0x170'),'onDelete':_0xf5f3('0x16f')});module[_0xf5f3('0x207')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index bba43bb..b34ba65 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ffc=['/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/cloudProviders','./api/cloudProvider','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues'];(function(_0x3b3f65,_0x5354bc){var _0x2e3ce1=function(_0x5aa023){while(--_0x5aa023){_0x3b3f65['push'](_0x3b3f65['shift']());}};_0x2e3ce1(++_0x5354bc);}(_0x8ffc,0xc6));var _0xc8ff=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x8ffc[_0x34843e];return _0x598f7f;};'use strict';var path=require('path');var express=require(_0xc8ff('0x0'));var errors=require(_0xc8ff('0x1'));var config=require(_0xc8ff('0x2'));var setupLoggers=require(_0xc8ff('0x3'))[_0xc8ff('0x4')];var clientSideLogs=require(_0xc8ff('0x5'));exports[_0xc8ff('0x6')]=function(_0x1d4737){return setupLoggers(_0x1d4737)[_0xc8ff('0x7')](function(){_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9'),require(_0xc8ff('0xa')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb'),require('./api/voiceChanSpy'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc'),require(_0xc8ff('0xd')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe'),require(_0xc8ff('0xf')));_0x1d4737[_0xc8ff('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x10'),require(_0xc8ff('0x11')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x12'),require(_0xc8ff('0x13')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x14'),require('./api/screenRecording'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x15'),require('./api/voiceMail'));_0x1d4737['use'](_0xc8ff('0x16'),require(_0xc8ff('0x17')));_0x1d4737[_0xc8ff('0x8')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x1d4737['use'](_0xc8ff('0x18'),require(_0xc8ff('0x19')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x1a'),require('./api/voiceAgentReport'));_0x1d4737[_0xc8ff('0x8')]('/api/voice/queues/reports',require(_0xc8ff('0x1b')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x1c'),require(_0xc8ff('0x1d')));_0x1d4737[_0xc8ff('0x8')]('/api/trunks',require(_0xc8ff('0x1e')));_0x1d4737['use'](_0xc8ff('0x1f'),require('./api/voiceTransferReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x20'),require('./api/mailServerOut'));_0x1d4737['use'](_0xc8ff('0x21'),require(_0xc8ff('0x22')));_0x1d4737['use']('/api/mail/queues',require(_0xc8ff('0x23')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x24'),require(_0xc8ff('0x25')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x26'),require(_0xc8ff('0x27')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x28'),require('./api/mailMessage'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x29'),require(_0xc8ff('0x2a')));_0x1d4737['use'](_0xc8ff('0x2b'),require(_0xc8ff('0x2c')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x2d'),require('./api/dashboard'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x2e'),require(_0xc8ff('0x2f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x30'),require(_0xc8ff('0x31')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/applications',require(_0xc8ff('0x32')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/interactions',require(_0xc8ff('0x33')));_0x1d4737['use'](_0xc8ff('0x34'),require('./api/faxMessage'));_0x1d4737[_0xc8ff('0x8')]('/api/fax/queues',require(_0xc8ff('0x35')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x36'),require(_0xc8ff('0x37')));_0x1d4737[_0xc8ff('0x8')]('/api/sms/applications',require(_0xc8ff('0x38')));_0x1d4737[_0xc8ff('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x39'),require(_0xc8ff('0x3a')));_0x1d4737['use'](_0xc8ff('0x3b'),require('./api/smsQueue'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x3c'),require('./api/openchannelAccount'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x3d'),require(_0xc8ff('0x3e')));_0x1d4737[_0xc8ff('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x3f'),require(_0xc8ff('0x40')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x41'),require('./api/openchannelQueue'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x42'),require('./api/chatWebsite'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x43'),require(_0xc8ff('0x44')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x45'),require(_0xc8ff('0x46')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x47'),require('./api/chatInteraction'));_0x1d4737['use'](_0xc8ff('0x48'),require(_0xc8ff('0x49')));_0x1d4737[_0xc8ff('0x8')]('/api/chat/offline_messages',require(_0xc8ff('0x4a')));_0x1d4737['use']('/api/chat/queues',require('./api/chatQueue'));_0x1d4737[_0xc8ff('0x8')]('/api/chat/groups',require(_0xc8ff('0x4b')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x4c'),require(_0xc8ff('0x4d')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x4e'),require(_0xc8ff('0x4f')));_0x1d4737[_0xc8ff('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x1d4737['use'](_0xc8ff('0x50'),require(_0xc8ff('0x51')));_0x1d4737['use'](_0xc8ff('0x52'),require(_0xc8ff('0x53')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x54'),require(_0xc8ff('0x55')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x56'),require(_0xc8ff('0x57')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x58'),require(_0xc8ff('0x59')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x5a'),require(_0xc8ff('0x5b')));_0x1d4737['use'](_0xc8ff('0x5c'),require(_0xc8ff('0x5d')));_0x1d4737['use'](_0xc8ff('0x5e'),require(_0xc8ff('0x5f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x60'),require(_0xc8ff('0x61')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x62'),require(_0xc8ff('0x63')));_0x1d4737['use'](_0xc8ff('0x64'),require(_0xc8ff('0x65')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x66'),require(_0xc8ff('0x67')));_0x1d4737['use']('/api/cdr',require(_0xc8ff('0x68')));_0x1d4737[_0xc8ff('0x8')]('/api/voiceQueuesLog',require(_0xc8ff('0x69')));_0x1d4737[_0xc8ff('0x8')]('/api/schedules',require(_0xc8ff('0x6a')));_0x1d4737['use'](_0xc8ff('0x6b'),require(_0xc8ff('0x6c')));_0x1d4737['use'](_0xc8ff('0x6d'),require(_0xc8ff('0x6e')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x6f'),require(_0xc8ff('0x70')));_0x1d4737['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x71'),require(_0xc8ff('0x72')));_0x1d4737[_0xc8ff('0x8')]('/api/templates',require('./api/template'));_0x1d4737['use'](_0xc8ff('0x73'),require('./api/trigger'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x74'),require(_0xc8ff('0x75')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations',require(_0xc8ff('0x76')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x77'),require('./api/integrationReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x78'),require('./api/analyticCustomReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x79'),require(_0xc8ff('0x7a')));_0x1d4737['use'](_0xc8ff('0x7b'),require('./api/analyticExtractedReport'));_0x1d4737['use'](_0xc8ff('0x7c'),require(_0xc8ff('0x7d')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x7e'),require(_0xc8ff('0x7f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x80'),require('./api/analyticTreeReport'));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/salesforce/accounts',require(_0xc8ff('0x81')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/salesforce/configurations',require(_0xc8ff('0x82')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x83'),require(_0xc8ff('0x84')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/sugarcrm/accounts',require(_0xc8ff('0x85')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x86'),require(_0xc8ff('0x87')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x88'),require(_0xc8ff('0x89')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/desk/accounts',require(_0xc8ff('0x8a')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x8b'),require(_0xc8ff('0x8c')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x8d'),require(_0xc8ff('0x8e')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/zoho/accounts',require(_0xc8ff('0x8f')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x90'),require(_0xc8ff('0x91')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x92'),require(_0xc8ff('0x93')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/zendesk/accounts',require(_0xc8ff('0x94')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x95'),require(_0xc8ff('0x96')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x97'),require(_0xc8ff('0x98')));_0x1d4737['use'](_0xc8ff('0x99'),require('./api/intFreshdeskField'));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/vtiger/accounts',require(_0xc8ff('0x9a')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9b'),require(_0xc8ff('0x9c')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9d'),require(_0xc8ff('0x9e')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0x9f'),require(_0xc8ff('0xa0')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xa1'),require(_0xc8ff('0xa2')));_0x1d4737['use'](_0xc8ff('0xa3'),require(_0xc8ff('0xa4')));_0x1d4737[_0xc8ff('0x8')]('/api/integrations/dynamics365/configurations',require(_0xc8ff('0xa5')));_0x1d4737['use']('/api/integrations/dynamics365/fields',require(_0xc8ff('0xa6')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xa7'),require(_0xc8ff('0xa8')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xa9'),require('./api/intFreshsalesConfiguration'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xaa'),require(_0xc8ff('0xab')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xac'),require(_0xc8ff('0xad')));_0x1d4737['use'](_0xc8ff('0xae'),require(_0xc8ff('0xaf')));_0x1d4737[_0xc8ff('0x8')]('/api/chat/internal/messages',require(_0xc8ff('0xb0')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb1'),require(_0xc8ff('0xb2')));_0x1d4737[_0xc8ff('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb3'),require('./api/jscriptySessionReport'));_0x1d4737[_0xc8ff('0x8')]('/api/sms/reports/queue',require(_0xc8ff('0xb4')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb5'),require(_0xc8ff('0xb6')));_0x1d4737['use'](_0xc8ff('0xb7'),require(_0xc8ff('0xb8')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xb9'),require(_0xc8ff('0xba')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xbb'),require(_0xc8ff('0xbc')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xbd'),require(_0xc8ff('0xbe')));_0x1d4737['use'](_0xc8ff('0xbf'),require(_0xc8ff('0xc0')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc1'),require(_0xc8ff('0xc2')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc3'),require(_0xc8ff('0xc4')));_0x1d4737[_0xc8ff('0x8')]('/api/teams',require('./api/team'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc5'),require(_0xc8ff('0xc6')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xc7'),require(_0xc8ff('0xc8')));_0x1d4737['use'](_0xc8ff('0xc9'),require(_0xc8ff('0xca')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xcb'),require('./api/attachment'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xcc'),require(_0xc8ff('0xcd')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xce'),require('./api/mailTransferReport'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xcf'),require(_0xc8ff('0xd0')));_0x1d4737[_0xc8ff('0x8')]('/api/fax/reports/transfer',require(_0xc8ff('0xd1')));_0x1d4737['use']('/api/openchannel/reports/transfer',require(_0xc8ff('0xd2')));_0x1d4737[_0xc8ff('0x8')]('/api/sms/reports/transfer',require(_0xc8ff('0xd3')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xd4'),require(_0xc8ff('0xd5')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xd6'),require('./api/voicePrefix'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xd7'),require(_0xc8ff('0xd8')));_0x1d4737['use'](_0xc8ff('0xd9'),require(_0xc8ff('0xda')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xdb'),require('./api/userProfileResource'));_0x1d4737[_0xc8ff('0x8')]('/api/userNotifications',require('./api/userNotification'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xdc'),require(_0xc8ff('0xdd')));_0x1d4737[_0xc8ff('0x8')]('/api/whatsapp/applications',require(_0xc8ff('0xde')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xdf'),require('./api/whatsappInteraction'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe0'),require(_0xc8ff('0xe1')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe2'),require(_0xc8ff('0xe3')));_0x1d4737[_0xc8ff('0x8')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x1d4737['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe4'),require(_0xc8ff('0xe5')));_0x1d4737['use']('/api/realtime',require('./api/realtime'));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xe6'),require(_0xc8ff('0xe7')));_0x1d4737[_0xc8ff('0x8')]('/api/auth/local',require(_0xc8ff('0xe8')));_0x1d4737['use']('/api/auth/google',require(_0xc8ff('0xe9')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xea'),require(_0xc8ff('0xeb')));_0x1d4737['use']('/api/jira',require(_0xc8ff('0xec')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xed'),require(_0xc8ff('0xee')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xef'),require(_0xc8ff('0xf0')));_0x1d4737['use'](_0xc8ff('0xf1'),require(_0xc8ff('0xf2')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf3'),require(_0xc8ff('0xf4')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf5'),require(_0xc8ff('0xf6')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf7'),clientSideLogs);_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xf8'),express[_0xc8ff('0xf9')](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],'/apidoc')));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xfc'),express[_0xc8ff('0xf9')](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],_0xc8ff('0xfc'))));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xfd'),express[_0xc8ff('0xf9')](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],_0xc8ff('0xfd'))));_0x1d4737[_0xc8ff('0x8')](_0xc8ff('0xfe'),express['static'](path[_0xc8ff('0xfa')](config[_0xc8ff('0xfb')],_0xc8ff('0xff'),_0xc8ff('0x100'))));_0x1d4737[_0xc8ff('0x8')]('/plugins',express['static'](path['join'](config[_0xc8ff('0xfb')],'/server/files/plugins')));_0x1d4737[_0xc8ff('0x101')](_0xc8ff('0x102'))[_0xc8ff('0x103')](errors[0x194]);_0x1d4737[_0xc8ff('0x101')]('/*')[_0xc8ff('0x103')](function(_0x5e558f,_0x4e2500){_0x4e2500[_0xc8ff('0x104')](path[_0xc8ff('0x105')](_0x1d4737[_0xc8ff('0x103')](_0xc8ff('0x106'))+_0xc8ff('0x107')));});return _0x1d4737;});}; \ No newline at end of file +var _0xebdc=['/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./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/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions'];(function(_0x288977,_0x1efd3d){var _0x254205=function(_0x162e6f){while(--_0x162e6f){_0x288977['push'](_0x288977['shift']());}};_0x254205(++_0x1efd3d);}(_0xebdc,0x1f1));var _0xcebd=function(_0x2d3c23,_0x3c5dcf){_0x2d3c23=_0x2d3c23-0x0;var _0x54e603=_0xebdc[_0x2d3c23];return _0x54e603;};'use strict';var path=require(_0xcebd('0x0'));var express=require('express');var errors=require(_0xcebd('0x1'));var config=require(_0xcebd('0x2'));var setupLoggers=require(_0xcebd('0x3'))[_0xcebd('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0xcebd('0x5')]=function(_0x17612d){return setupLoggers(_0x17612d)[_0xcebd('0x6')](function(){_0x17612d[_0xcebd('0x7')](_0xcebd('0x8'),require(_0xcebd('0x9')));_0x17612d['use']('/api/voice/chanspy',require(_0xcebd('0xa')));_0x17612d[_0xcebd('0x7')]('/api/voice/contexts',require(_0xcebd('0xb')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xc'),require('./api/voiceExtension'));_0x17612d['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x17612d['use'](_0xcebd('0xd'),require('./api/voiceQueue'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xe'),require(_0xcebd('0xf')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x10'),require(_0xcebd('0x11')));_0x17612d['use'](_0xcebd('0x12'),require(_0xcebd('0x13')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x14'),require(_0xcebd('0x15')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x16'),require(_0xcebd('0x17')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x18'),require('./api/voiceDialReport'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x19'),require(_0xcebd('0x1a')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x1b'),require('./api/voiceQueueReport'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x1c'),require(_0xcebd('0x1d')));_0x17612d['use'](_0xcebd('0x1e'),require(_0xcebd('0x1f')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x20'),require(_0xcebd('0x21')));_0x17612d[_0xcebd('0x7')]('/api/mail/out_servers',require(_0xcebd('0x22')));_0x17612d[_0xcebd('0x7')]('/api/mail/accounts',require(_0xcebd('0x23')));_0x17612d['use'](_0xcebd('0x24'),require(_0xcebd('0x25')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x26'),require(_0xcebd('0x27')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x28'),require(_0xcebd('0x29')));_0x17612d['use']('/api/mail/messages',require(_0xcebd('0x2a')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x2b'),require(_0xcebd('0x2c')));_0x17612d[_0xcebd('0x7')]('/api/mail/reports/queue',require(_0xcebd('0x2d')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x2e'),require(_0xcebd('0x2f')));_0x17612d['use'](_0xcebd('0x30'),require(_0xcebd('0x31')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x32'),require(_0xcebd('0x33')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x34'),require('./api/faxApplication'));_0x17612d[_0xcebd('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x17612d[_0xcebd('0x7')]('/api/fax/messages',require(_0xcebd('0x35')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x36'),require(_0xcebd('0x37')));_0x17612d['use'](_0xcebd('0x38'),require('./api/faxQueueReport'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x39'),require('./api/smsAccount'));_0x17612d['use'](_0xcebd('0x3a'),require(_0xcebd('0x3b')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x3c'),require('./api/smsInteraction'));_0x17612d['use'](_0xcebd('0x3d'),require('./api/smsMessage'));_0x17612d['use']('/api/sms/queues',require(_0xcebd('0x3e')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x3f'),require(_0xcebd('0x40')));_0x17612d[_0xcebd('0x7')]('/api/openchannel/applications',require(_0xcebd('0x41')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x42'),require(_0xcebd('0x43')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x44'),require(_0xcebd('0x45')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x46'),require(_0xcebd('0x47')));_0x17612d['use'](_0xcebd('0x48'),require('./api/chatWebsite'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x49'),require(_0xcebd('0x4a')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x4b'),require(_0xcebd('0x4c')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x4d'),require(_0xcebd('0x4e')));_0x17612d[_0xcebd('0x7')]('/api/chat/messages',require(_0xcebd('0x4f')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x50'),require('./api/chatOfflineMessage'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x51'),require(_0xcebd('0x52')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x53'),require(_0xcebd('0x54')));_0x17612d[_0xcebd('0x7')]('/api/chat/proactive_actions',require(_0xcebd('0x55')));_0x17612d[_0xcebd('0x7')]('/api/cm/companies',require('./api/cmCompany'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x56'),require('./api/cmContact'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x57'),require(_0xcebd('0x58')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x59'),require('./api/cmHopperBlack'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x5a'),require(_0xcebd('0x5b')));_0x17612d[_0xcebd('0x7')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x5c'),require(_0xcebd('0x5d')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x5e'),require(_0xcebd('0x5f')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x60'),require(_0xcebd('0x61')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x62'),require(_0xcebd('0x63')));_0x17612d[_0xcebd('0x7')]('/api/dispositions',require(_0xcebd('0x64')));_0x17612d[_0xcebd('0x7')]('/api/conditions',require(_0xcebd('0x65')));_0x17612d[_0xcebd('0x7')]('/api/intervals',require(_0xcebd('0x66')));_0x17612d['use'](_0xcebd('0x67'),require('./api/pause'));_0x17612d[_0xcebd('0x7')]('/api/cdr',require(_0xcebd('0x68')));_0x17612d['use'](_0xcebd('0x69'),require(_0xcebd('0x6a')));_0x17612d['use'](_0xcebd('0x6b'),require(_0xcebd('0x6c')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x6d'),require(_0xcebd('0x6e')));_0x17612d[_0xcebd('0x7')]('/api/tags',require(_0xcebd('0x6f')));_0x17612d['use'](_0xcebd('0x70'),require(_0xcebd('0x71')));_0x17612d['use'](_0xcebd('0x72'),require(_0xcebd('0x73')));_0x17612d[_0xcebd('0x7')]('/api/cm_hopper_additional_phones',require(_0xcebd('0x74')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x75'),require('./api/template'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x76'),require(_0xcebd('0x77')));_0x17612d['use']('/api/variables',require(_0xcebd('0x78')));_0x17612d['use']('/api/integrations',require(_0xcebd('0x79')));_0x17612d[_0xcebd('0x7')]('/api/integrations/reports',require(_0xcebd('0x7a')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x7b'),require('./api/analyticCustomReport'));_0x17612d[_0xcebd('0x7')]('/api/analytics/default_reports',require(_0xcebd('0x7c')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x7d'),require('./api/analyticExtractedReport'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x7e'),require(_0xcebd('0x7f')));_0x17612d['use'](_0xcebd('0x80'),require(_0xcebd('0x81')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x82'),require(_0xcebd('0x83')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x84'),require(_0xcebd('0x85')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x86'),require(_0xcebd('0x87')));_0x17612d['use'](_0xcebd('0x88'),require(_0xcebd('0x89')));_0x17612d['use'](_0xcebd('0x8a'),require(_0xcebd('0x8b')));_0x17612d['use'](_0xcebd('0x8c'),require(_0xcebd('0x8d')));_0x17612d['use']('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x17612d[_0xcebd('0x7')]('/api/integrations/desk/accounts',require(_0xcebd('0x8e')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x8f'),require(_0xcebd('0x90')));_0x17612d[_0xcebd('0x7')]('/api/integrations/desk/fields',require(_0xcebd('0x91')));_0x17612d['use'](_0xcebd('0x92'),require('./api/intZohoAccount'));_0x17612d['use'](_0xcebd('0x93'),require(_0xcebd('0x94')));_0x17612d[_0xcebd('0x7')]('/api/integrations/zoho/fields',require(_0xcebd('0x95')));_0x17612d['use'](_0xcebd('0x96'),require(_0xcebd('0x97')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x98'),require(_0xcebd('0x99')));_0x17612d[_0xcebd('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x9a'),require(_0xcebd('0x9b')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x9c'),require(_0xcebd('0x9d')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x9e'),require('./api/intFreshdeskField'));_0x17612d[_0xcebd('0x7')](_0xcebd('0x9f'),require(_0xcebd('0xa0')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xa1'),require(_0xcebd('0xa2')));_0x17612d['use'](_0xcebd('0xa3'),require('./api/intVtigerField'));_0x17612d['use'](_0xcebd('0xa4'),require(_0xcebd('0xa5')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xa6'),require(_0xcebd('0xa7')));_0x17612d['use'](_0xcebd('0xa8'),require(_0xcebd('0xa9')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xaa'),require(_0xcebd('0xab')));_0x17612d['use'](_0xcebd('0xac'),require(_0xcebd('0xad')));_0x17612d['use']('/api/integrations/dynamics365/fields',require(_0xcebd('0xae')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xaf'),require('./api/intFreshsalesAccount'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xb0'),require(_0xcebd('0xb1')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xb2'),require(_0xcebd('0xb3')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xb4'),require(_0xcebd('0xb5')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xb6'),require('./api/chatQueueReport'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xb7'),require(_0xcebd('0xb8')));_0x17612d[_0xcebd('0x7')]('/api/jscripty/answers/reports',require(_0xcebd('0xb9')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xba'),require('./api/jscriptyQuestionReport'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xbb'),require(_0xcebd('0xbc')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xbd'),require(_0xcebd('0xbe')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xbf'),require(_0xcebd('0xc0')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xc1'),require(_0xcebd('0xc2')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xc3'),require(_0xcebd('0xc4')));_0x17612d[_0xcebd('0x7')]('/api/settings',require(_0xcebd('0xc5')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xc6'),require(_0xcebd('0xc7')));_0x17612d[_0xcebd('0x7')]('/api/square/projects',require('./api/squareProject'));_0x17612d['use']('/api/square/recordings',require(_0xcebd('0xc8')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xc9'),require(_0xcebd('0xca')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xcb'),require(_0xcebd('0xcc')));_0x17612d[_0xcebd('0x7')]('/api/license',require(_0xcebd('0xcd')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xce'),require('./api/campaign'));_0x17612d['use']('/api/migrations',require(_0xcebd('0xcf')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xd0'),require(_0xcebd('0xd1')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xd2'),require('./api/plugin'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xd3'),require(_0xcebd('0xd4')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xd5'),require(_0xcebd('0xd6')));_0x17612d[_0xcebd('0x7')]('/api/fax/reports/transfer',require(_0xcebd('0xd7')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xd8'),require(_0xcebd('0xd9')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xda'),require(_0xcebd('0xdb')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xdc'),require('./api/cmList'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xdd'),require('./api/voicePrefix'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xde'),require(_0xcebd('0xdf')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xe0'),require(_0xcebd('0xe1')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xe2'),require(_0xcebd('0xe3')));_0x17612d['use'](_0xcebd('0xe4'),require('./api/userNotification'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xe5'),require(_0xcebd('0xe6')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xe7'),require(_0xcebd('0xe8')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xe9'),require('./api/whatsappInteraction'));_0x17612d['use'](_0xcebd('0xea'),require(_0xcebd('0xeb')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xec'),require(_0xcebd('0xed')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xee'),require(_0xcebd('0xef')));_0x17612d['use'](_0xcebd('0xf0'),require(_0xcebd('0xf1')));_0x17612d['use'](_0xcebd('0xf2'),require(_0xcebd('0xf3')));_0x17612d[_0xcebd('0x7')]('/api/realtime',require(_0xcebd('0xf4')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xf5'),require('./api/user-setting'));_0x17612d[_0xcebd('0x7')](_0xcebd('0xf6'),require(_0xcebd('0xf7')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xf8'),require(_0xcebd('0xf9')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xfa'),require(_0xcebd('0xfb')));_0x17612d['use']('/api/jira',require(_0xcebd('0xfc')));_0x17612d[_0xcebd('0x7')]('/api/rpc',require(_0xcebd('0xfd')));_0x17612d[_0xcebd('0x7')](_0xcebd('0xfe'),require(_0xcebd('0xff')));_0x17612d[_0xcebd('0x7')]('/api/system',require(_0xcebd('0x100')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x101'),require(_0xcebd('0x102')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x103'),require(_0xcebd('0x104')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x105'),clientSideLogs);_0x17612d['use']('/apidoc',express[_0xcebd('0x106')](path[_0xcebd('0x107')](config['root'],_0xcebd('0x108'))));_0x17612d[_0xcebd('0x7')](_0xcebd('0x109'),express[_0xcebd('0x106')](path[_0xcebd('0x107')](config[_0xcebd('0x10a')],'/www')));_0x17612d[_0xcebd('0x7')](_0xcebd('0x10b'),express[_0xcebd('0x106')](path[_0xcebd('0x107')](config[_0xcebd('0x10a')],_0xcebd('0x10b'))));_0x17612d[_0xcebd('0x7')](_0xcebd('0x10c'),express['static'](path[_0xcebd('0x107')](config['root'],_0xcebd('0x10d'),_0xcebd('0x10e'))));_0x17612d[_0xcebd('0x7')](_0xcebd('0x10f'),express[_0xcebd('0x106')](path[_0xcebd('0x107')](config[_0xcebd('0x10a')],_0xcebd('0x110'))));_0x17612d['route'](_0xcebd('0x111'))[_0xcebd('0x112')](errors[0x194]);_0x17612d['route']('/*')['get'](function(_0x33ba83,_0x40967c){_0x40967c[_0xcebd('0x113')](path[_0xcebd('0x114')](_0x17612d[_0xcebd('0x112')](_0xcebd('0x115'))+_0xcebd('0x116')));});return _0x17612d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c922fbd..d9786b0 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09b0=['../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc'];(function(_0x45f1b5,_0x1fcb86){var _0x282f59=function(_0xe1e01e){while(--_0xe1e01e){_0x45f1b5['push'](_0x45f1b5['shift']());}};_0x282f59(++_0x1fcb86);}(_0x09b0,0x6e));var _0x009b=function(_0x375bdc,_0x56d0c2){_0x375bdc=_0x375bdc-0x0;var _0xad9532=_0x09b0[_0x375bdc];return _0xad9532;};'use strict';var jayson=require(_0x009b('0x0'));var _=require(_0x009b('0x1'));var config=require(_0x009b('0x2'));exports[_0x009b('0x3')]=function(){return new Promise(function(_0x226ef2,_0x236156){var _0x8742bc={};_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/user/user.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x5')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x6')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x7')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x8')));_0x8742bc=_['merge'](_0x8742bc,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x9')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0xa')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xb')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/trunk/trunk.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xc')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0xd')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xe')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/mailQueue/mailQueue.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0xf')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x10')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x11')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x12')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x13')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x14')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x15')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x16')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/faxQueue/faxQueue.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x17')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x18')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x19')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x1a')));_0x8742bc=_['merge'](_0x8742bc,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x1b')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x1c')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x1d')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x1e')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x1f')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x20')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x21')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/cmContact/cmContact.rpc'));_0x8742bc=_['merge'](_0x8742bc,require('../api/cmHopper/cmHopper.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x22')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x23')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x24')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x25')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x26')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x27')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x28')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/trigger/trigger.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x29')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x2a')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x2b')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x2c')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x2d')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x2e')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x2f')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x30')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x31')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x32')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x33')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x34')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x35')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x36')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/squareRecording/squareRecording.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x37')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/campaign/campaign.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x38')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x39')));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x3a')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require(_0x009b('0x3b')));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x8742bc=_[_0x009b('0x4')](_0x8742bc,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x8742bc=_['merge'](_0x8742bc,require(_0x009b('0x3c')));var _0x165804=jayson['server'](_0x8742bc)[_0x009b('0x3d')]();var _0x1f9502=config[_0x009b('0x3e')]['port']||config['port']+0x1;var _0x3d8c11=config['rpc']['ip']||'localhost';_0x165804['on']('error',function(_0x344327){return _0x236156(_0x344327);});_0x165804[_0x009b('0x3')](_0x1f9502,_0x3d8c11,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3d8c11,_0x1f9502);require('../config/triggers')[_0x009b('0x3f')]();return _0x226ef2(_0x009b('0x40')+_0x3d8c11+':'+_0x1f9502);});});}; \ No newline at end of file +var _0x3d30=['../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d30,0x6a));var _0x03d3=function(_0x4315d4,_0x1a0363){_0x4315d4=_0x4315d4-0x0;var _0x49a847=_0x3d30[_0x4315d4];return _0x49a847;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0x03d3('0x0'));exports['listen']=function(){return new Promise(function(_0x12261f,_0x5ced31){var _0x545d7d={};_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/user/user.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x2')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x3')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x4')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x5')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x6')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x7')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x8')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x9')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x545d7d=_['merge'](_0x545d7d,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0xa')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0xb')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0xc')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0xd')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0xe')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/mailApplication/mailApplication.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0xf')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x10')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x11')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/faxInteraction/faxInteraction.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x12')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x13')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x14')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/smsAccount/smsAccount.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x15')));_0x545d7d=_['merge'](_0x545d7d,require('../api/smsMessage/smsMessage.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x16')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x17')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x18')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x19')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x1a')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x1b')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x1c')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/chatQueue/chatQueue.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x1d')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x1e')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x1f')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x20')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x21')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x22')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x23')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x24')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x25')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x26')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x27')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x28')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x29')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x2a')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x2b')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x2c')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x2d')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x2e')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x2f')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x30')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x31')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x32')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x33')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/squareOdbc/squareOdbc.rpc'));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x34')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x35')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x36')));_0x545d7d=_['merge'](_0x545d7d,require(_0x03d3('0x37')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x38')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x39')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x3a')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x3b')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x3c')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require(_0x03d3('0x3d')));_0x545d7d=_[_0x03d3('0x1')](_0x545d7d,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x469f47=jayson[_0x03d3('0x3e')](_0x545d7d)[_0x03d3('0x3f')]();var _0x4894e7=config[_0x03d3('0x40')]['port']||config['port']+0x1;var _0x2915db=config[_0x03d3('0x40')]['ip']||_0x03d3('0x41');_0x469f47['on'](_0x03d3('0x42'),function(_0x2b6857){return _0x5ced31(_0x2b6857);});_0x469f47[_0x03d3('0x43')](_0x4894e7,_0x2915db,function(){console['log'](_0x03d3('0x44'),_0x2915db,_0x4894e7);require(_0x03d3('0x45'))['default']();return _0x12261f('RPC\x20listening\x20on\x20'+_0x2915db+':'+_0x4894e7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 394372f..b0ca84f 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 _0x8cb8=['substring','520-Invalid','search','no\x20code','replace','result=','indexOf','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','function','write','sendRequest','sync','prototype','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','continueAt','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter','call','setEncoding','ready','line','toLowerCase','emit','hangup'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8cb8,0x1da));var _0x88cb=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0x8cb8[_0x3ec333];return _0x15ccb8;};'use strict';var util=require('util');var _=require(_0x88cb('0x0'));var EventEmitter=require('events')[_0x88cb('0x1')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x310721){var _0x34501e=this,_0x3d0714=new AGIReply(),_0x535248=![],_0x5298d8={};EventEmitter[_0x88cb('0x2')](_0x34501e);_0x310721[_0x88cb('0x3')]('utf8');_0x310721['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x3d0714[_0x88cb('0x3')]('utf8');_0x3d0714['on']('headers',function(_0x163174){for(var _0x5eb110 in _0x163174){_0x34501e[_0x5eb110]=_0x163174[_0x5eb110];}_0x34501e['emit'](_0x88cb('0x4'));});_0x3d0714['on'](_0x88cb('0x5'),function(_0x2825ca){if(_0x2825ca[_0x88cb('0x6')]()=='hangup'){_0x34501e[_0x88cb('0x7')](_0x88cb('0x8'));return;}if(_0x2825ca[_0x88cb('0x9')](0x0,0xb)==_0x88cb('0xa')){_0x535248=!![];}if(_0x535248){_0x5298d8['rx']+=_0x2825ca+'\x0a';if(_0x2825ca[_0x88cb('0xb')]('520\x20End\x20of\x20proper')!=-0x1){_0x535248=![];}}else{_0x5298d8['rx']=_0x2825ca;}if(_0x535248){return;}if(typeof _0x5298d8['cb']=='function'){var _0x1466fb=_0x5298d8['rx'][_0x88cb('0x9')](0x0,0x3),_0x2b1dbf=null,_0x1561c6=null;_0x1466fb=parseInt(_0x1466fb);if(isNaN(_0x1466fb)){_0x5298d8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x88cb('0xc')});return;}if(_0x1466fb!=0xc8){_0x5298d8['cb'](null,{'code':_0x1466fb,'result':-0x1,'extra':'KO'});return;}_0x2b1dbf=_0x5298d8['rx'][_0x88cb('0x9')](0x4)[_0x88cb('0xd')](_0x88cb('0xe'),'');if(_0x2b1dbf[_0x88cb('0xf')]('\x20')!=-0x1){_0x2b1dbf=_0x2b1dbf['substr'](0x0,_0x2b1dbf[_0x88cb('0xf')]('\x20'));}if(_[_0x88cb('0x10')](_0x2b1dbf,'-1')){_0x2b1dbf=parseInt(_0x2b1dbf);}_0x1561c6=_0x5298d8['rx'][_0x88cb('0x11')]('\x20');if(_0x1561c6[_0x88cb('0x12')]==0x3){_0x1561c6=_0x1561c6[0x2][_0x88cb('0x9')](0x1,_0x1561c6[0x2][_0x88cb('0x12')]-0x1);}else if(_0x1561c6[_0x88cb('0x12')]>0x3){var _0xbe8e9d=/\((.+)\)/;var _0x4cdd9c=_0x5298d8['rx'][_0x88cb('0x13')](_0xbe8e9d);if(_0x4cdd9c){_0x1561c6=_0x4cdd9c[0x1];}else{_0x1561c6=null;}}else{_0x1561c6=null;}_0x5298d8['cb'](null,{'code':_0x1466fb,'result':_0x2b1dbf,'extra':_0x1561c6});}});_0x310721['on']('error',function(_0x35037a){_0x34501e[_0x88cb('0x7')]('error',new AGIError(_0x88cb('0x14'),_0x35037a[_0x88cb('0x15')]));});_0x310721['on']('close',function(){_0x34501e['emit'](_0x88cb('0x16'),new AGIError(_0x88cb('0x17')));});_0x310721['on'](_0x88cb('0x18'),function(){_0x34501e['emit'](_0x88cb('0x18'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x310721['destroy']();});_0x310721[_0x88cb('0x19')](_0x3d0714);this['command']=function(_0x16bc05,_0x331e00){var _0x16bc05=_0x16bc05||'',_0x331e00=typeof _0x331e00==_0x88cb('0x1a')?_0x331e00:new Function();_0x5298d8={'tx':_0x16bc05,'rx':'','cb':_0x331e00};_0x310721[_0x88cb('0x1b')](_0x16bc05+'\x0a');},this[_0x88cb('0x16')]=function(){_0x310721['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x88cb('0x1c')]=function(_0x606c07){return this['command'][_0x88cb('0x1d')](this,_0x606c07);};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x1f')]=function(){return this[_0x88cb('0x1c')](_0x88cb('0x20'));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x21')]=function(_0x1b17de,_0x9d8863,_0x8dab3){_0x1b17de=_0x1b17de===undefined?'beep':_0x1b17de;_0x9d8863=_0x9d8863===undefined?'5':_0x9d8863;_0x8dab3=_0x8dab3===undefined?'1':_0x8dab3;return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x23'),_0x1b17de,_0x9d8863*0x3e8,_0x8dab3));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x24')]=function(_0x250d9e){_0x250d9e=_0x250d9e||'NO\x20MESSAGE';return this[_0x88cb('0x1c')](util['format'](_0x88cb('0x25'),_0x250d9e));};AGIChannel[_0x88cb('0x1e')]['exec']=function(_0x54ad0c,_0x41d7d5){if(_['isArray'](_0x41d7d5)){return this['sendRequest'](util['format'](_0x88cb('0x26'),_0x54ad0c,_0x41d7d5['join'](',')));}return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x26'),_0x54ad0c,_0x41d7d5));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x27')]=function(_0x2ab223){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x28'),_0x2ab223));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x29')]=function(_0x5ddbd4){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x2a'),_0x5ddbd4));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x2b')]=function(_0x135fa1){return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x2c'),_0x135fa1));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x8')]=function(){return this[_0x88cb('0x1c')]('HANGUP');};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x2d')]=function(_0x399a5b,_0x259476){var _0x4cfcec=_['isBoolean'](_0x259476)||_[_0x88cb('0x2e')](_0x259476)?_0x259476['toString']():_0x259476;return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x2f'),_0x399a5b,_0x4cfcec?_0x4cfcec[_0x88cb('0x30')]()[_0x88cb('0xd')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x88cb('0x31')]=function(_0xeecc5,_0x2ae2e8){return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x32'),_0xeecc5,_0x2ae2e8));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x33')]=function(_0x190cf1,_0x1fc57a){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')]('SAY\x20DIGITS\x20%s\x20%s',_0x190cf1,_0x1fc57a));};AGIChannel[_0x88cb('0x1e')]['sayPhonetic']=function(_0xaf4d57,_0x26c89a){return this['sendRequest'](util[_0x88cb('0x22')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xaf4d57,_0x26c89a));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x34')]=function(_0x66cac5,_0x860358,_0x151b11){_0x860358=_0x860358||this[_0x88cb('0x35')];_0x151b11=_0x151b11||0x1;this['setContext'](_0x66cac5);this[_0x88cb('0x29')](_0x860358);this['setPriority'](_0x151b11);return this[_0x88cb('0x24')](util[_0x88cb('0x22')]('GOTO\x20%s\x20%s\x20%s',_0x66cac5,_0x860358,_0x151b11));};AGIChannel[_0x88cb('0x1e')]['getVariable']=function(_0x3ce7cb){return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x36'),_0x3ce7cb));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x37')]=function(_0x5adc4f,_0x5b88b4,_0x1c1e64,_0x1b5634,_0x30275f,_0x1b254b){_0x5b88b4=_0x5b88b4||_0x88cb('0x38');_0x1c1e64=_0x1c1e64||'';_0x1b5634=_0x1b5634===undefined?-0x1:_0x1b5634==='-1'?-0x1:_0x1b5634*0x3e8;_0x30275f=_0x30275f===undefined?'':'s='+_0x30275f;_0x1b254b=_0x1b254b?_0x88cb('0x39'):'';return this['sendRequest'](util[_0x88cb('0x22')](_0x88cb('0x3a'),_0x5adc4f,_0x5b88b4,_0x1c1e64,_0x1b5634,_0x1b254b,_0x30275f));};AGIChannel['prototype'][_0x88cb('0x3b')]=function(_0xc70a8c,_0xf3cf34){_0xf3cf34=_0xf3cf34||'';return this[_0x88cb('0x1c')](util[_0x88cb('0x22')](_0x88cb('0x3c'),_0xc70a8c,_0xf3cf34));};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x3d')]=function(_0x1994da){return this['exec'](_0x88cb('0x3e'),_0x1994da);};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x3f')]=function(_0x27a256){return this['exec'](_0x88cb('0x40'),_0x27a256);};AGIChannel[_0x88cb('0x1e')][_0x88cb('0x41')]=function(_0x311031,_0x4699c8){this['noop'](util['format'](_0x88cb('0x42'),_0x311031['id'],_0x311031[_0x88cb('0x43')],_0x4699c8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x88cb('0x44')]=AGIChannel; \ No newline at end of file +var _0xba55=['E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','format','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./error','setEncoding','setTimeout','utf8','headers','emit','ready','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match','error'];(function(_0x189bd6,_0x27baec){var _0x3b598d=function(_0x1666db){while(--_0x1666db){_0x189bd6['push'](_0x189bd6['shift']());}};_0x3b598d(++_0x27baec);}(_0xba55,0x1f3));var _0x5ba5=function(_0x12e202,_0x2e53c3){_0x12e202=_0x12e202-0x0;var _0x5ba035=_0xba55[_0x12e202];return _0x5ba035;};'use strict';var util=require(_0x5ba5('0x0'));var _=require(_0x5ba5('0x1'));var EventEmitter=require(_0x5ba5('0x2'))[_0x5ba5('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x5ba5('0x4'));function AGIChannel(_0x262bf7){var _0x41fda3=this,_0x153fd4=new AGIReply(),_0x15e2d0=![],_0x1bc2b4={};EventEmitter['call'](_0x41fda3);_0x262bf7[_0x5ba5('0x5')]('utf8');_0x262bf7[_0x5ba5('0x6')](0x8*0x3c*0x3c*0x3e8);_0x153fd4[_0x5ba5('0x5')](_0x5ba5('0x7'));_0x153fd4['on'](_0x5ba5('0x8'),function(_0x2744e8){for(var _0x44c512 in _0x2744e8){_0x41fda3[_0x44c512]=_0x2744e8[_0x44c512];}_0x41fda3[_0x5ba5('0x9')](_0x5ba5('0xa'));});_0x153fd4['on']('line',function(_0x2664f0){if(_0x2664f0[_0x5ba5('0xb')]()=='hangup'){_0x41fda3[_0x5ba5('0x9')]('hangup');return;}if(_0x2664f0[_0x5ba5('0xc')](0x0,0xb)==_0x5ba5('0xd')){_0x15e2d0=!![];}if(_0x15e2d0){_0x1bc2b4['rx']+=_0x2664f0+'\x0a';if(_0x2664f0[_0x5ba5('0xe')](_0x5ba5('0xf'))!=-0x1){_0x15e2d0=![];}}else{_0x1bc2b4['rx']=_0x2664f0;}if(_0x15e2d0){return;}if(typeof _0x1bc2b4['cb']==_0x5ba5('0x10')){var _0x3edd73=_0x1bc2b4['rx'][_0x5ba5('0xc')](0x0,0x3),_0x12cd36=null,_0xe02cff=null;_0x3edd73=parseInt(_0x3edd73);if(isNaN(_0x3edd73)){_0x1bc2b4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5ba5('0x11')});return;}if(_0x3edd73!=0xc8){_0x1bc2b4['cb'](null,{'code':_0x3edd73,'result':-0x1,'extra':'KO'});return;}_0x12cd36=_0x1bc2b4['rx'][_0x5ba5('0xc')](0x4)[_0x5ba5('0x12')](_0x5ba5('0x13'),'');if(_0x12cd36[_0x5ba5('0x14')]('\x20')!=-0x1){_0x12cd36=_0x12cd36[_0x5ba5('0x15')](0x0,_0x12cd36['indexOf']('\x20'));}if(_['startsWith'](_0x12cd36,'-1')){_0x12cd36=parseInt(_0x12cd36);}_0xe02cff=_0x1bc2b4['rx'][_0x5ba5('0x16')]('\x20');if(_0xe02cff['length']==0x3){_0xe02cff=_0xe02cff[0x2]['substring'](0x1,_0xe02cff[0x2]['length']-0x1);}else if(_0xe02cff[_0x5ba5('0x17')]>0x3){var _0x51cbf2=/\((.+)\)/;var _0xe9afd4=_0x1bc2b4['rx'][_0x5ba5('0x18')](_0x51cbf2);if(_0xe9afd4){_0xe02cff=_0xe9afd4[0x1];}else{_0xe02cff=null;}}else{_0xe02cff=null;}_0x1bc2b4['cb'](null,{'code':_0x3edd73,'result':_0x12cd36,'extra':_0xe02cff});}});_0x262bf7['on'](_0x5ba5('0x19'),function(_0x4677e5){_0x41fda3[_0x5ba5('0x9')](_0x5ba5('0x19'),new AGIError(_0x5ba5('0x1a'),_0x4677e5['code']));});_0x262bf7['on'](_0x5ba5('0x1b'),function(){_0x41fda3['emit']('close',new AGIError(_0x5ba5('0x1c')));});_0x262bf7['on']('timeout',function(){_0x41fda3[_0x5ba5('0x9')](_0x5ba5('0x1d'),new AGIError(_0x5ba5('0x1e')));_0x262bf7['destroy']();});_0x262bf7[_0x5ba5('0x1f')](_0x153fd4);this[_0x5ba5('0x20')]=function(_0x9b0ea,_0x4ac568){var _0x9b0ea=_0x9b0ea||'',_0x4ac568=typeof _0x4ac568=='function'?_0x4ac568:new Function();_0x1bc2b4={'tx':_0x9b0ea,'rx':'','cb':_0x4ac568};_0x262bf7[_0x5ba5('0x21')](_0x9b0ea+'\x0a');},this['close']=function(){_0x262bf7[_0x5ba5('0x22')]();};}util[_0x5ba5('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x5ba5('0x24')]['sendRequest']=function(_0x2471b3){return this[_0x5ba5('0x20')][_0x5ba5('0x25')](this,_0x2471b3);};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x26')]=function(){return this[_0x5ba5('0x27')](_0x5ba5('0x28'));};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x29')]=function(_0x20e7e9,_0x5cc064,_0x566a3d){_0x20e7e9=_0x20e7e9===undefined?_0x5ba5('0x2a'):_0x20e7e9;_0x5cc064=_0x5cc064===undefined?'5':_0x5cc064;_0x566a3d=_0x566a3d===undefined?'1':_0x566a3d;return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x20e7e9,_0x5cc064*0x3e8,_0x566a3d));};AGIChannel[_0x5ba5('0x24')]['noop']=function(_0x3129a5){_0x3129a5=_0x3129a5||_0x5ba5('0x2c');return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')]('VERBOSE\x20\x22%s\x22',_0x3129a5));};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x2d')]=function(_0x417402,_0x1b409d){if(_['isArray'](_0x1b409d)){return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')]('EXEC\x20%s\x20%s',_0x417402,_0x1b409d['join'](',')));}return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x2e'),_0x417402,_0x1b409d));};AGIChannel[_0x5ba5('0x24')]['setContext']=function(_0x4ea5ee){return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x2f'),_0x4ea5ee));};AGIChannel['prototype'][_0x5ba5('0x30')]=function(_0x4e09ef){return this['sendRequest'](util[_0x5ba5('0x2b')]('SET\x20EXTENSION\x20%s',_0x4e09ef));};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x31')]=function(_0x2f5ca6){return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x32'),_0x2f5ca6));};AGIChannel[_0x5ba5('0x24')]['hangup']=function(){return this[_0x5ba5('0x27')]('HANGUP');};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x33')]=function(_0x3c38ea,_0x392e30){var _0x4a72a6=_[_0x5ba5('0x34')](_0x392e30)||_[_0x5ba5('0x35')](_0x392e30)?_0x392e30[_0x5ba5('0x36')]():_0x392e30;return this[_0x5ba5('0x27')](util['format'](_0x5ba5('0x37'),_0x3c38ea,_0x4a72a6?_0x4a72a6[_0x5ba5('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x5ba5('0x38')]=function(_0x5702f1,_0x2a77ef){return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x39'),_0x5702f1,_0x2a77ef));};AGIChannel[_0x5ba5('0x24')]['sayDigits']=function(_0x2b7d79,_0x1ced9d){return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x3a'),_0x2b7d79,_0x1ced9d));};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x3b')]=function(_0x3781ef,_0x1f65e3){return this['sendRequest'](util[_0x5ba5('0x2b')](_0x5ba5('0x3c'),_0x3781ef,_0x1f65e3));};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x3d')]=function(_0x29a22b,_0x2f11c2,_0x358f09){_0x2f11c2=_0x2f11c2||this[_0x5ba5('0x3e')];_0x358f09=_0x358f09||0x1;this[_0x5ba5('0x3f')](_0x29a22b);this[_0x5ba5('0x30')](_0x2f11c2);this['setPriority'](_0x358f09);return this[_0x5ba5('0x40')](util['format'](_0x5ba5('0x41'),_0x29a22b,_0x2f11c2,_0x358f09));};AGIChannel['prototype']['getVariable']=function(_0x2a45e9){return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x42'),_0x2a45e9));};AGIChannel[_0x5ba5('0x24')]['recordFile']=function(_0x12ba05,_0x2d8e1c,_0x2e8beb,_0x792af3,_0x33c47,_0x62a4e0){_0x2d8e1c=_0x2d8e1c||_0x5ba5('0x43');_0x2e8beb=_0x2e8beb||'';_0x792af3=_0x792af3===undefined?-0x1:_0x792af3==='-1'?-0x1:_0x792af3*0x3e8;_0x33c47=_0x33c47===undefined?'':'s='+_0x33c47;_0x62a4e0=_0x62a4e0?_0x5ba5('0x44'):'';return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')](_0x5ba5('0x45'),_0x12ba05,_0x2d8e1c,_0x2e8beb,_0x792af3,_0x62a4e0,_0x33c47));};AGIChannel[_0x5ba5('0x24')]['streamFile']=function(_0x37a722,_0x893a8){_0x893a8=_0x893a8||'';return this[_0x5ba5('0x27')](util[_0x5ba5('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x37a722,_0x893a8));};AGIChannel[_0x5ba5('0x24')]['agi']=function(_0x509c3d){return this[_0x5ba5('0x2d')](_0x5ba5('0x46'),_0x509c3d);};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x47')]=function(_0x2bd6c9){return this[_0x5ba5('0x2d')](_0x5ba5('0x48'),_0x2bd6c9);};AGIChannel[_0x5ba5('0x24')][_0x5ba5('0x19')]=function(_0x336cbb,_0x4ad046){this[_0x5ba5('0x40')](util['format'](_0x5ba5('0x49'),_0x336cbb['id'],_0x336cbb['label'],_0x4ad046));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5ba5('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e413d44..7e1bce1 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 _0x2417=['name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x2417,0x16d));var _0x7241=function(_0x5ecc5d,_0x38d142){_0x5ecc5d=_0x5ecc5d-0x0;var _0x5b98a3=_0x2417[_0x5ecc5d];return _0x5b98a3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7241('0x0'),'E_AGI_ARGUMENT_PORT':_0x7241('0x1'),'E_AGI_SERVER_ERROR':_0x7241('0x2'),'E_AGI_SERVER_CLOSE':_0x7241('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7241('0x4'),'E_AGI_SOCKET_CLOSE':_0x7241('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7241('0x6'),'E_AGI_IVR_ENTRY':_0x7241('0x7')};function AGIError(_0x2252be){var _0x2252be=_0x2252be||null,_0x368816=_0x368816||[],_0x511a9c=0x1,_0x17de4b='';if(!error[_0x2252be]){_0x2252be=_0x7241('0x8');}_0x368816[_0x7241('0x9')](error[_0x2252be]);while(arguments[_0x511a9c]){_0x368816[_0x7241('0x9')](arguments[_0x511a9c]);_0x511a9c++;}_0x17de4b=util[_0x7241('0xa')][_0x7241('0xb')](util,_0x368816);this[_0x7241('0xc')]=_0x17de4b;this[_0x7241('0xd')]=_0x2252be;}module['exports']=AGIError; \ No newline at end of file +var _0x0545=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x361955,_0x3b0d2){var _0x43365c=function(_0x42e2da){while(--_0x42e2da){_0x361955['push'](_0x361955['shift']());}};_0x43365c(++_0x3b0d2);}(_0x0545,0xdb));var _0x5054=function(_0x324a72,_0x4e83f3){_0x324a72=_0x324a72-0x0;var _0x3a97b9=_0x0545[_0x324a72];return _0x3a97b9;};'use strict';var util=require(_0x5054('0x0'));var error={'E_AGI_UNDEFINED':_0x5054('0x1'),'E_AGI_ARGUMENT_PORT':_0x5054('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x5054('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x5054('0x4'),'E_AGI_SOCKET_ERROR':_0x5054('0x5'),'E_AGI_SOCKET_CLOSE':_0x5054('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x5054('0x7'),'E_AGI_COMMAND_EMPTY':_0x5054('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5054('0x9'),'E_AGI_IVR_ENTRY':_0x5054('0xa')};function AGIError(_0x38d373){var _0x38d373=_0x38d373||null,_0x2a51a6=_0x2a51a6||[],_0x12537c=0x1,_0x4b35e4='';if(!error[_0x38d373]){_0x38d373=_0x5054('0xb');}_0x2a51a6[_0x5054('0xc')](error[_0x38d373]);while(arguments[_0x12537c]){_0x2a51a6[_0x5054('0xc')](arguments[_0x12537c]);_0x12537c++;}_0x4b35e4=util['format']['apply'](util,_0x2a51a6);this[_0x5054('0xd')]=_0x4b35e4;this[_0x5054('0xe')]=_0x38d373;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index f4d4320..7a91339 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 _0xf51e=['parse','emit','projectUpdate','exports','lodash','events','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','error','E_AGI_SERVER_ERROR','message'];(function(_0x21362f,_0x4637e1){var _0x17f9fe=function(_0x521f60){while(--_0x521f60){_0x21362f['push'](_0x21362f['shift']());}};_0x17f9fe(++_0x4637e1);}(_0xf51e,0xf4));var _0xef51=function(_0x136ff9,_0x16b929){_0x136ff9=_0x136ff9-0x0;var _0x38ddd4=_0xf51e[_0x136ff9];return _0x38ddd4;};'use strict';var _=require(_0xef51('0x0'));var EventEmitter=require(_0xef51('0x1'))['EventEmitter'];var Redis=require(_0xef51('0x2'));var AGIError=require(_0xef51('0x3'));var config=require(_0xef51('0x4'));config[_0xef51('0x5')]=_[_0xef51('0x6')](config[_0xef51('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xef51('0x5')]);sub[_0xef51('0x7')](_0xef51('0x8'),function(_0x4dd2f1){if(_0x4dd2f1)return eventEmitter['emit'](_0xef51('0x9'),new AGIError(_0xef51('0xa'),_0x4dd2f1));});sub['on'](_0xef51('0xb'),function(_0x480c5b,_0x5bfb1d){if(_0x480c5b!==_0xef51('0x8'))return;try{var _0x480d04=JSON[_0xef51('0xc')](_0x5bfb1d);eventEmitter[_0xef51('0xd')](_0xef51('0xe'),_0x480d04);}catch(_0x2167b9){eventEmitter['emit'](_0xef51('0x9'),new AGIError(_0xef51('0xa'),_0x2167b9));}});module[_0xef51('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xffbf=['agi','emit','E_AGI_SERVER_ERROR','parse','projectUpdate','error','lodash','events','EventEmitter','ioredis','./error','redis'];(function(_0x1581dc,_0x29492e){var _0xc99f1c=function(_0x3d8686){while(--_0x3d8686){_0x1581dc['push'](_0x1581dc['shift']());}};_0xc99f1c(++_0x29492e);}(_0xffbf,0xde));var _0xfffb=function(_0x4a82f1,_0x38ce07){_0x4a82f1=_0x4a82f1-0x0;var _0x1d9bf4=_0xffbf[_0x4a82f1];return _0x1d9bf4;};'use strict';var _=require(_0xfffb('0x0'));var EventEmitter=require(_0xfffb('0x1'))[_0xfffb('0x2')];var Redis=require(_0xfffb('0x3'));var AGIError=require(_0xfffb('0x4'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0xfffb('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0xfffb('0x6'),function(_0x3f6aad){if(_0x3f6aad)return eventEmitter[_0xfffb('0x7')]('error',new AGIError(_0xfffb('0x8'),_0x3f6aad));});sub['on']('message',function(_0x1cc624,_0x27cb82){if(_0x1cc624!=='agi')return;try{var _0x584d75=JSON[_0xfffb('0x9')](_0x27cb82);eventEmitter[_0xfffb('0x7')](_0xfffb('0xa'),_0x584d75);}catch(_0xebd3d5){eventEmitter[_0xfffb('0x7')](_0xfffb('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0xebd3d5));}});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 8ec5e09..0483930 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 _0x6e30=['getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','split','default','target','menu','invalid','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6e30,0x148));var _0x06e3=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x6e30[_0x254b22];return _0x1279db;};'use strict';var _=require(_0x06e3('0x0'));var logger=require(_0x06e3('0x1'))('agi');var verticesWithRetry=['menu',_0x06e3('0x2'),_0x06e3('0x3')];var Graph=function(){this[_0x06e3('0x4')]={};this[_0x06e3('0x5')]={};this[_0x06e3('0x6')]=0x0;};Graph[_0x06e3('0x7')][_0x06e3('0x8')]=function(_0x12b16f){this['vertices'][_0x12b16f['id']]=_0x12b16f;this[_0x06e3('0x5')][_0x12b16f['id']]=[];};Graph[_0x06e3('0x7')][_0x06e3('0x9')]=function(_0x4616af,_0x1c9018,_0x40acd0){this[_0x06e3('0x5')][_0x4616af]['push']({'target':_0x1c9018,'condition':_0x40acd0});this[_0x06e3('0x6')]+=0x1;};Graph['prototype']['size']=function(){return _[_0x06e3('0xa')](this['vertices']);};Graph['prototype'][_0x06e3('0xb')]=function(){return this[_0x06e3('0x6')];};Graph['prototype'][_0x06e3('0xc')]=function(_0x4efc30){return this[_0x06e3('0x4')][_0x4efc30];};Graph['prototype'][_0x06e3('0xd')]=function(_0x651bb3,_0xfa53cc){if(!this['vertices'][_0x651bb3]){return logger['info'](_0x06e3('0xe'));}var _0x2af22d=_0xfa53cc(this[_0x06e3('0x4')][_0x651bb3]);if(!_0x2af22d){return logger[_0x06e3('0xf')](_0x06e3('0x10'));}if(this[_0x06e3('0x5')][_0x651bb3][_0x06e3('0x11')]===0x0){return logger[_0x06e3('0xf')](_0x06e3('0x12'));}for(var _0x824e7b=0x0,_0x347a07=[],_0x3b50f5=![];_0x824e7b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','production','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','stack','findIndex','deleted','splice','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug'];(function(_0x2bf109,_0x46c8d1){var _0x471d1=function(_0xb8261e){while(--_0xb8261e){_0x2bf109['push'](_0x2bf109['shift']());}};_0x471d1(++_0x46c8d1);}(_0xc278,0xc2));var _0x8c27=function(_0x288dbf,_0x202108){_0x288dbf=_0x288dbf-0x0;var _0x2a8f03=_0xc278[_0x288dbf];return _0x2a8f03;};'use strict';var _=require(_0x8c27('0x0'));var syncho=require(_0x8c27('0x1'));var util=require('util');var config=require(_0x8c27('0x2'));var logger=require(_0x8c27('0x3'))(_0x8c27('0x4'));var utilLicense=require(_0x8c27('0x5'));var rpc=require(_0x8c27('0x6'));var Project=require('./project');var AGIEmitter=require(_0x8c27('0x7'))[_0x8c27('0x8')];var projects=[];config[_0x8c27('0x4')]=_[_0x8c27('0x9')](config[_0x8c27('0x4')],{'ip':_0x8c27('0xa'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x51e6b0){process[_0x8c27('0xb')](function(){syncho(function(){try{setChannelVariables(_0x51e6b0);agiHandler(_0x51e6b0);}catch(_0x3c3018){logger['error'](_0x3c3018[_0x8c27('0xc')]);}});});}function projectUpdateHandler(_0x592742){try{var _0x50f355=_[_0x8c27('0xd')](projects,['id',_0x592742['id']]);if(_0x50f355>-0x1){if(_0x592742[_0x8c27('0xe')]===!![]){projects[_0x8c27('0xf')](_0x50f355,0x1);}else{projects[_0x50f355]=_0x592742;}}else{projects['push'](_0x592742);}}catch(_0x92f9f7){logger[_0x8c27('0x10')](_0x92f9f7[_0x8c27('0xc')]);}}function listeningHandler(){console['log'](_0x8c27('0x11'),config[_0x8c27('0x4')][_0x8c27('0x12')]);logger[_0x8c27('0x13')](util[_0x8c27('0x14')](_0x8c27('0x15'),config[_0x8c27('0x4')]['ip'],config[_0x8c27('0x4')]['port']));}function errorHandler(_0x55d019){if(_0x55d019&&_0x55d019[_0x8c27('0x16')]&&_0x55d019[_0x8c27('0x17')]){logger[_0x8c27('0x10')](util['format'](_0x8c27('0x18'),_0x55d019['name'],_0x55d019[_0x8c27('0x17')]));}else{logger[_0x8c27('0x10')](util[_0x8c27('0x14')](_0x8c27('0x19'),_0x55d019[_0x8c27('0xc')]));}}function closeHandler(){logger['info'](util['format'](_0x8c27('0x1a'),this[_0x8c27('0x1b')],this['calleridname'],this[_0x8c27('0x1c')],this['dnid'],this[_0x8c27('0x1d')]));try{createSquareReport(this);}catch(_0x1da533){logger[_0x8c27('0x10')](_0x1da533[_0x8c27('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x8c27('0x14')](_0x8c27('0x1e'),this[_0x8c27('0x1b')],this['calleridname'],this['callerid'],this[_0x8c27('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0x8c27('0x13')](util[_0x8c27('0x14')](_0x8c27('0x20'),this[_0x8c27('0x1b')],this[_0x8c27('0x21')],this['callerid'],this[_0x8c27('0x1f')],this[_0x8c27('0x1d')]));this[_0x8c27('0x22')]=!![];}function createSquareReport(_0x2e0101,_0x5cf7a7){rpc[_0x8c27('0x23')](_0x2e0101)['then'](function(_0x1dd984){if(_0x5cf7a7){_0x5cf7a7(null,_0x1dd984);}})[_0x8c27('0x24')](function(_0x43ee91){if(_0x5cf7a7){_0x5cf7a7(null,_0x43ee91);}});}function setChannelVariables(_0x3d7d9d){for(var _0x2fd411 in _0x3d7d9d){if(_0x3d7d9d[_0x8c27('0x25')](_0x2fd411)){if(_0x2fd411[_0x8c27('0x26')](_0x8c27('0x27'))===0x0){_0x3d7d9d[_0x2fd411[_0x8c27('0x28')](0x4)]=_0x3d7d9d[_0x2fd411];delete _0x3d7d9d[_0x2fd411];}}}}function agiHandler(_0x47329b){logger[_0x8c27('0x29')]('variables',JSON[_0x8c27('0x2a')](_0x47329b,null,0x2));logger[_0x8c27('0x13')](util['format'](_0x8c27('0x2b'),_0x47329b[_0x8c27('0x1b')],_0x47329b[_0x8c27('0x21')],_0x47329b[_0x8c27('0x1c')],_0x47329b['dnid'],_0x47329b[_0x8c27('0x1d')]));_0x47329b['on'](_0x8c27('0x10'),errorHandler);_0x47329b['on'](_0x8c27('0x2c'),closeHandler);_0x47329b['on'](_0x8c27('0x2d'),timeoutHandler);_0x47329b[_0x8c27('0x22')]=![];_0x47329b['on']('hangup',hangupHandler);var _0x160960=_[_0x8c27('0x2e')](projects,['name',_0x47329b[_0x8c27('0x1b')]]);if(!_0x160960)return Project[_0x8c27('0x2f')](_0x47329b);if(!_0x160960[_0x8c27('0x30')])return Project['handleUnpublished'](_0x47329b);return Project[_0x8c27('0x31')](_0x160960,_0x47329b);}function main(){var _0xeeb562;return utilLicense[_0x8c27('0x32')]()[_0x8c27('0x33')](function(_0x3072b3){if(!_0x3072b3)return;if(_0x3072b3[_0x8c27('0x34')]){if(_0x3072b3[_0x8c27('0x35')]&&_0x3072b3[_0x8c27('0x35')]>0x0){logger[_0x8c27('0x13')](util[_0x8c27('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3072b3[_0x8c27('0x35')]));_0xeeb562=_0x3072b3[_0x8c27('0x35')];}else{logger[_0x8c27('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x8c27('0x36'));_0xeeb562=-0x1;}})[_0x8c27('0x33')](function(){return Project[_0x8c27('0x37')]();})[_0x8c27('0x33')](function(_0x3886f5){projects=_0x3886f5;return;})[_0x8c27('0x24')](function(_0x3dd8f2){logger[_0x8c27('0x10')](_0x8c27('0x38'),_0x3dd8f2[_0x8c27('0xc')]);})['finally'](function(){var _0x2798c7=require(_0x8c27('0x39'))(config[_0x8c27('0x4')][_0x8c27('0x12')],config['agi']['ip'],_0xeeb562);_0x2798c7['on'](_0x8c27('0x10'),errorHandler);_0x2798c7['on'](_0x8c27('0x3a'),listeningHandler);_0x2798c7['on']('connection',connectionHandler);_0x2798c7['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x2242=['util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','./server','listening','connection','lodash','syncho'];(function(_0xc6a588,_0x1774c9){var _0x4114b8=function(_0x35bdad){while(--_0x35bdad){_0xc6a588['push'](_0xc6a588['shift']());}};_0x4114b8(++_0x1774c9);}(_0x2242,0xb2));var _0x2224=function(_0x1782b6,_0x441bc9){_0x1782b6=_0x1782b6-0x0;var _0x5522bc=_0x2242[_0x1782b6];return _0x5522bc;};'use strict';var _=require(_0x2224('0x0'));var syncho=require(_0x2224('0x1'));var util=require(_0x2224('0x2'));var config=require(_0x2224('0x3'));var logger=require(_0x2224('0x4'))(_0x2224('0x5'));var utilLicense=require(_0x2224('0x6'));var rpc=require(_0x2224('0x7'));var Project=require('./project');var AGIEmitter=require(_0x2224('0x8'))[_0x2224('0x9')];var projects=[];config[_0x2224('0x5')]=_[_0x2224('0xa')](config[_0x2224('0x5')],{'ip':_0x2224('0xb'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x525053){process[_0x2224('0xc')](function(){syncho(function(){try{setChannelVariables(_0x525053);agiHandler(_0x525053);}catch(_0x49014c){logger[_0x2224('0xd')](_0x49014c[_0x2224('0xe')]);}});});}function projectUpdateHandler(_0x5f9759){try{var _0xff6a8c=_['findIndex'](projects,['id',_0x5f9759['id']]);if(_0xff6a8c>-0x1){if(_0x5f9759['deleted']===!![]){projects[_0x2224('0xf')](_0xff6a8c,0x1);}else{projects[_0xff6a8c]=_0x5f9759;}}else{projects[_0x2224('0x10')](_0x5f9759);}}catch(_0x31db6a){logger[_0x2224('0xd')](_0x31db6a[_0x2224('0xe')]);}}function listeningHandler(){console[_0x2224('0x11')](_0x2224('0x12'),config[_0x2224('0x5')][_0x2224('0x13')]);logger[_0x2224('0x14')](util[_0x2224('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x2224('0x5')]['ip'],config[_0x2224('0x5')][_0x2224('0x13')]));}function errorHandler(_0x149ab4){if(_0x149ab4&&_0x149ab4['name']&&_0x149ab4['message']){logger[_0x2224('0xd')](util[_0x2224('0x15')]('[%s]\x20%s',_0x149ab4[_0x2224('0x16')],_0x149ab4[_0x2224('0x17')]));}else{logger['error'](util[_0x2224('0x15')]('[ERROR]\x20%s',_0x149ab4[_0x2224('0xe')]));}}function closeHandler(){logger[_0x2224('0x14')](util[_0x2224('0x15')](_0x2224('0x18'),this[_0x2224('0x19')],this[_0x2224('0x1a')],this[_0x2224('0x1b')],this[_0x2224('0x1c')],this[_0x2224('0x1d')]));try{createSquareReport(this);}catch(_0x14244c){logger[_0x2224('0xd')](_0x14244c['stack']);}}function timeoutHandler(){logger[_0x2224('0x14')](util[_0x2224('0x15')](_0x2224('0x1e'),this['arg_1'],this[_0x2224('0x1a')],this[_0x2224('0x1b')],this[_0x2224('0x1c')],this[_0x2224('0x1d')]));}function hangupHandler(){logger[_0x2224('0x14')](util[_0x2224('0x15')](_0x2224('0x1f'),this[_0x2224('0x19')],this['calleridname'],this[_0x2224('0x1b')],this[_0x2224('0x1c')],this[_0x2224('0x1d')]));this[_0x2224('0x20')]=!![];}function createSquareReport(_0x414287,_0x43c74d){rpc[_0x2224('0x21')](_0x414287)[_0x2224('0x22')](function(_0x4394f6){if(_0x43c74d){_0x43c74d(null,_0x4394f6);}})['catch'](function(_0x539dfa){if(_0x43c74d){_0x43c74d(null,_0x539dfa);}});}function setChannelVariables(_0x362d57){for(var _0x19b098 in _0x362d57){if(_0x362d57[_0x2224('0x23')](_0x19b098)){if(_0x19b098[_0x2224('0x24')](_0x2224('0x25'))===0x0){_0x362d57[_0x19b098[_0x2224('0x26')](0x4)]=_0x362d57[_0x19b098];delete _0x362d57[_0x19b098];}}}}function agiHandler(_0xa506b9){logger[_0x2224('0x27')](_0x2224('0x28'),JSON[_0x2224('0x29')](_0xa506b9,null,0x2));logger[_0x2224('0x14')](util[_0x2224('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xa506b9[_0x2224('0x19')],_0xa506b9[_0x2224('0x1a')],_0xa506b9[_0x2224('0x1b')],_0xa506b9[_0x2224('0x1c')],_0xa506b9[_0x2224('0x1d')]));_0xa506b9['on'](_0x2224('0xd'),errorHandler);_0xa506b9['on'](_0x2224('0x2a'),closeHandler);_0xa506b9['on'](_0x2224('0x2b'),timeoutHandler);_0xa506b9[_0x2224('0x20')]=![];_0xa506b9['on'](_0x2224('0x2c'),hangupHandler);var _0x1920be=_[_0x2224('0x2d')](projects,[_0x2224('0x16'),_0xa506b9[_0x2224('0x19')]]);if(!_0x1920be)return Project[_0x2224('0x2e')](_0xa506b9);if(!_0x1920be[_0x2224('0x2f')])return Project[_0x2224('0x30')](_0xa506b9);return Project[_0x2224('0x31')](_0x1920be,_0xa506b9);}function main(){var _0x4bde99;return utilLicense[_0x2224('0x32')]()[_0x2224('0x22')](function(_0x10e1a0){if(!_0x10e1a0)return;if(_0x10e1a0[_0x2224('0x33')]){if(_0x10e1a0[_0x2224('0x34')]&&_0x10e1a0['callysquare']>0x0){logger[_0x2224('0x14')](util[_0x2224('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x10e1a0[_0x2224('0x34')]));_0x4bde99=_0x10e1a0[_0x2224('0x34')];}else{logger[_0x2224('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2224('0x14')](_0x2224('0x35'));_0x4bde99=-0x1;}})[_0x2224('0x22')](function(){return Project[_0x2224('0x36')]();})[_0x2224('0x22')](function(_0x49cc17){projects=_0x49cc17;return;})[_0x2224('0x37')](function(_0x573cfe){logger[_0x2224('0xd')]('[LICENSE]',_0x573cfe[_0x2224('0xe')]);})[_0x2224('0x38')](function(){var _0x4a60e0=require(_0x2224('0x39'))(config['agi'][_0x2224('0x13')],config[_0x2224('0x5')]['ip'],_0x4bde99);_0x4a60e0['on']('error',errorHandler);_0x4a60e0['on'](_0x2224('0x3a'),listeningHandler);_0x4a60e0['on'](_0x2224('0x3b'),connectionHandler);_0x4a60e0['on'](_0x2224('0x2a'),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 ba66903..7b6a16d 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 _0x8ba9=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x8ba9,0x1ce));var _0x98ba=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8ba9[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x98ba('0x0'));var jayson=require(_0x98ba('0x1'));var client=jayson[_0x98ba('0x2')]['http']({'port':0x232b});function request(_0x39cc24,_0x44ebe0){return new BPromise(function(_0x540759,_0x317f2e){return client[_0x98ba('0x3')](_0x39cc24,_0x44ebe0)[_0x98ba('0x4')](function(_0x41b328){if(_0x41b328[_0x98ba('0x5')]){return _0x317f2e(_0x41b328[_0x98ba('0x5')]['message']);}else{return _0x540759(_0x41b328['result']);}})[_0x98ba('0x6')](function(_0x21f671){return _0x317f2e(_0x21f671);});});}exports[_0x98ba('0x7')]=function(_0x1993f8,_0x1d7ff6){return request(_0x98ba('0x8'),{'account':_0x1993f8,'message':_0x1d7ff6});}; \ No newline at end of file +var _0x9a5a=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x289835,_0x3a7b48){var _0x597fe2=function(_0x2d1d12){while(--_0x2d1d12){_0x289835['push'](_0x289835['shift']());}};_0x597fe2(++_0x3a7b48);}(_0x9a5a,0x145));var _0xa9a5=function(_0x148d98,_0x2fc8b2){_0x148d98=_0x148d98-0x0;var _0x293aae=_0x9a5a[_0x148d98];return _0x293aae;};'use strict';var BPromise=require(_0xa9a5('0x0'));var jayson=require(_0xa9a5('0x1'));var client=jayson[_0xa9a5('0x2')][_0xa9a5('0x3')]({'port':0x232b});function request(_0x465ab9,_0x43ccb3){return new BPromise(function(_0x8dc569,_0x26d443){return client[_0xa9a5('0x4')](_0x465ab9,_0x43ccb3)[_0xa9a5('0x5')](function(_0x5b7937){if(_0x5b7937[_0xa9a5('0x6')]){return _0x26d443(_0x5b7937[_0xa9a5('0x6')][_0xa9a5('0x7')]);}else{return _0x8dc569(_0x5b7937[_0xa9a5('0x8')]);}})[_0xa9a5('0x9')](function(_0x1bb6b1){return _0x26d443(_0x1bb6b1);});});}exports[_0xa9a5('0xa')]=function(_0x416eed,_0x1403b7){return request(_0xa9a5('0xb'),{'account':_0x416eed,'message':_0x1403b7});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 909b765..b277262 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 _0xdfa1=['close','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','target','addEdge','source','value','mxGraphModel','root','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','agicommand\x20not\x20found','finally','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfa1,0x1e2));var _0x1dfa=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xdfa1[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x1dfa('0x0'));var moment=require(_0x1dfa('0x1'));var parser=require(_0x1dfa('0x2'));var util=require(_0x1dfa('0x3'));var logger=require(_0x1dfa('0x4'))(_0x1dfa('0x5'));var rpc=require(_0x1dfa('0x6'));var mailRpc=require(_0x1dfa('0x7'));var Graph=require(_0x1dfa('0x8'));var Vertices=require(_0x1dfa('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1dfa('0xa')]()['catch'](function(_0x36afbb){logger[_0x1dfa('0xb')](_0x1dfa('0xc'),_0x36afbb[_0x1dfa('0xd')]);return[];});}function addVertex(_0x49f4bd,_0x6c64af,_0xae0d7c){_0x6c64af[_0x1dfa('0xe')]=_0xae0d7c;if(_0x6c64af['hasOwnProperty'](_0x1dfa('0xf'))){_0x6c64af['maxRetry']=parseInt(_0x6c64af['retry'],0xa);}_0x49f4bd[_0x1dfa('0x10')](_['omit'](_0x6c64af,'mxCell'));}function initGraph(_0x2771ab,_0x149149){var _0x1e261d=new Graph();for(var _0x19dd94 in _0x2771ab){if(_0x2771ab[_0x1dfa('0x11')](_0x19dd94)){if(_[_0x1dfa('0x12')](_0x2771ab[_0x19dd94])){for(var _0x49cee4=0x0;_0x49cee4<_0x2771ab[_0x19dd94][_0x1dfa('0x13')];_0x49cee4+=0x1){addVertex(_0x1e261d,_0x2771ab[_0x19dd94][_0x49cee4],_0x19dd94);}}else{addVertex(_0x1e261d,_0x2771ab[_0x19dd94],_0x19dd94);}}}for(var _0x40e23f=0x0;_0x40e23f<_0x149149[_0x1dfa('0x13')];_0x40e23f+=0x1){if(_0x149149[_0x40e23f]['source']&&_0x149149[_0x40e23f][_0x1dfa('0x14')]){_0x1e261d[_0x1dfa('0x15')](_0x149149[_0x40e23f][_0x1dfa('0x16')],_0x149149[_0x40e23f][_0x1dfa('0x14')],_0x149149[_0x40e23f][_0x1dfa('0x17')]);}}return _0x1e261d;}function getRoot(_0x1f0078){return parser['toJson'](_0x1f0078,{'object':!![]})[_0x1dfa('0x18')][_0x1dfa('0x19')];}function inspect(_0x4190af){return util['inspect'](_0x4190af,{'showHidden':![],'depth':null});}function initialize(_0x3640ad,_0x48465e){var _0x337455=getRoot(_0x3640ad[_0x1dfa('0x1a')]);if(!_0x337455||!_0x337455[_0x1dfa('0x1b')])return;var _0x19f5af,_0x22f1eb,_0x624850;logger[_0x1dfa('0x1c')](_0x1dfa('0x19'),JSON[_0x1dfa('0x1d')](_0x337455,null,0x2));_0x48465e[_0x1dfa('0x1e')]=moment()[_0x1dfa('0x1f')](_0x1dfa('0x20'));_0x19f5af=initGraph(_[_0x1dfa('0x21')](_0x337455,_0x1dfa('0x22')),_0x337455['mxCell']);_0x22f1eb=new Vertices(_0x48465e,rpc,mailRpc);logger[_0x1dfa('0x23')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x48465e[_0x1dfa('0x24')],_0x48465e[_0x1dfa('0x25')],_0x48465e['callerid'],_0x48465e[_0x1dfa('0x26')],_0x48465e[_0x1dfa('0x27')]));_0x19f5af[_0x1dfa('0x28')](_0x337455[_0x1dfa('0x1b')]['id'],function(_0x50af10){try{_0x50af10=_0x22f1eb[_0x1dfa('0x29')](_0x50af10);logger[_0x1dfa('0x1c')]('vertex',JSON[_0x1dfa('0x1d')](_0x50af10,null,0x2));if(_0x50af10['agicommand']===_0x1dfa('0x2a')){logger['info'](_0x1dfa('0x2b'));_0x48465e[_0x1dfa('0x2c')]=_0x50af10[_0x1dfa('0x2c')]||_0x48465e[_0x1dfa('0x2c')];_0x48465e[_0x1dfa('0x2d')]=_0x50af10[_0x1dfa('0x2d')];_0x48465e[_0x1dfa('0x2e')]=_0x50af10[_0x1dfa('0x2e')]?_0x50af10[_0x1dfa('0x2e')]-0x1:0x1;return null;}else if(_0x50af10&&_0x22f1eb[_0x50af10[_0x1dfa('0xe')]]){_0x624850=_0x22f1eb[_0x50af10[_0x1dfa('0xe')]](_0x50af10);logger[_0x1dfa('0x23')](_0x1dfa('0x2f'),JSON[_0x1dfa('0x1d')](_0x624850,null,0x2));if(_0x624850&&_0x624850['code']===AGI_CODE_SUCCESS&&_0x624850[_0x1dfa('0x30')]!==AGI_RESULT_ERROR&&!_0x48465e['evtHangup']){logger[_0x1dfa('0x1c')](_0x1dfa('0x2f'),inspect(_0x624850));return _[_0x1dfa('0x31')](_0x624850[_0x1dfa('0x30')])?null:_0x624850['result']['toString']();}else{logger['error'](_0x1dfa('0x2f'),inspect(_0x624850));return null;}}else{logger[_0x1dfa('0xb')](_0x1dfa('0x32'));return null;}}catch(_0x1de02f){logger[_0x1dfa('0xb')](_0x1de02f[_0x1dfa('0xd')]);return null;}});if(_0x337455[_0x1dfa('0x33')]){logger['info'](util[_0x1dfa('0x1f')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x48465e['arg_1'],_0x48465e[_0x1dfa('0x25')],_0x48465e['callerid'],_0x48465e[_0x1dfa('0x26')],_0x48465e[_0x1dfa('0x27')]));_0x19f5af[_0x1dfa('0x28')](_0x337455['finally']['id'],function(_0x5077f9){try{_0x5077f9=_0x22f1eb['clear'](_0x5077f9);logger[_0x1dfa('0x1c')](_0x1dfa('0x34'),JSON['stringify'](_0x5077f9,null,0x2));if(_0x5077f9&&_0x22f1eb[_0x5077f9[_0x1dfa('0xe')]]){_0x624850=_0x22f1eb[_0x5077f9[_0x1dfa('0xe')]](_0x5077f9);if(_0x624850){logger['debug'](_0x1dfa('0x2f'),inspect(_0x624850));return _['isUndefined'](_0x624850[_0x1dfa('0x30')])?null:_0x624850[_0x1dfa('0x30')][_0x1dfa('0x35')]();}else{logger[_0x1dfa('0xb')](_0x1dfa('0x2f'),inspect(_0x624850));return null;}}else{logger[_0x1dfa('0xb')](_0x1dfa('0x32'));return null;}}catch(_0x16e777){logger[_0x1dfa('0xb')](_0x16e777['stack']);return null;}});}logger[_0x1dfa('0x23')](util[_0x1dfa('0x1f')](_0x1dfa('0x36'),_0x48465e['arg_1'],_0x48465e['calleridname'],_0x48465e[_0x1dfa('0x37')],_0x48465e[_0x1dfa('0x26')],_0x48465e[_0x1dfa('0x27')]));logger[_0x1dfa('0x23')](util[_0x1dfa('0x1f')](_0x1dfa('0x38'),_0x48465e[_0x1dfa('0x2c')],_0x48465e['extension'],parseInt(_0x48465e['priority'],0xa)+0x1));_0x48465e[_0x1dfa('0x39')](_0x48465e[_0x1dfa('0x2c')],_0x48465e[_0x1dfa('0x2d')],parseInt(_0x48465e[_0x1dfa('0x2e')],0xa)+0x1);_0x48465e[_0x1dfa('0x3a')]();}function handleNotFound(_0x20fdad){logger[_0x1dfa('0xb')](util[_0x1dfa('0x1f')]('Project\x20%s\x20not\x20found',_0x20fdad[_0x1dfa('0x24')]));_0x20fdad['continueAt'](_0x20fdad[_0x1dfa('0x2c')],_0x20fdad['extension'],parseInt(_0x20fdad[_0x1dfa('0x2e')],0xa)+0x1);_0x20fdad[_0x1dfa('0x3a')]();}function handleUnpublished(_0x3d409f){logger['error'](util[_0x1dfa('0x1f')]('Project\x20%s\x20not\x20published',_0x3d409f[_0x1dfa('0x24')]));_0x3d409f[_0x1dfa('0x39')](_0x3d409f[_0x1dfa('0x2c')],_0x3d409f[_0x1dfa('0x2d')],parseInt(_0x3d409f['priority'],0xa)+0x1);_0x3d409f['close']();}module[_0x1dfa('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xc3c9=['moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','mxGraphModel','root','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','error','agicommand\x20not\x20found','finally','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash'];(function(_0x2803a8,_0x2c7e31){var _0x2b107b=function(_0x148ce5){while(--_0x148ce5){_0x2803a8['push'](_0x2803a8['shift']());}};_0x2b107b(++_0x2c7e31);}(_0xc3c9,0x1e7));var _0x9c3c=function(_0x40d46b,_0x5a76c1){_0x40d46b=_0x40d46b-0x0;var _0x2716cd=_0xc3c9[_0x40d46b];return _0x2716cd;};'use strict';var _=require(_0x9c3c('0x0'));var moment=require(_0x9c3c('0x1'));var parser=require(_0x9c3c('0x2'));var util=require(_0x9c3c('0x3'));var logger=require(_0x9c3c('0x4'))(_0x9c3c('0x5'));var rpc=require(_0x9c3c('0x6'));var mailRpc=require(_0x9c3c('0x7'));var Graph=require(_0x9c3c('0x8'));var Vertices=require(_0x9c3c('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9c3c('0xa')]()[_0x9c3c('0xb')](function(_0x518d70){logger['error'](_0x9c3c('0xc'),_0x518d70[_0x9c3c('0xd')]);return[];});}function addVertex(_0xf2d22e,_0x507a47,_0x48c326){_0x507a47[_0x9c3c('0xe')]=_0x48c326;if(_0x507a47[_0x9c3c('0xf')](_0x9c3c('0x10'))){_0x507a47['maxRetry']=parseInt(_0x507a47['retry'],0xa);}_0xf2d22e[_0x9c3c('0x11')](_[_0x9c3c('0x12')](_0x507a47,_0x9c3c('0x13')));}function initGraph(_0x1b4d59,_0x2fcd60){var _0x51ed8d=new Graph();for(var _0x46d3ee in _0x1b4d59){if(_0x1b4d59[_0x9c3c('0xf')](_0x46d3ee)){if(_[_0x9c3c('0x14')](_0x1b4d59[_0x46d3ee])){for(var _0x4e0574=0x0;_0x4e0574<_0x1b4d59[_0x46d3ee][_0x9c3c('0x15')];_0x4e0574+=0x1){addVertex(_0x51ed8d,_0x1b4d59[_0x46d3ee][_0x4e0574],_0x46d3ee);}}else{addVertex(_0x51ed8d,_0x1b4d59[_0x46d3ee],_0x46d3ee);}}}for(var _0x337c73=0x0;_0x337c73<_0x2fcd60['length'];_0x337c73+=0x1){if(_0x2fcd60[_0x337c73][_0x9c3c('0x16')]&&_0x2fcd60[_0x337c73][_0x9c3c('0x17')]){_0x51ed8d[_0x9c3c('0x18')](_0x2fcd60[_0x337c73][_0x9c3c('0x16')],_0x2fcd60[_0x337c73][_0x9c3c('0x17')],_0x2fcd60[_0x337c73][_0x9c3c('0x19')]);}}return _0x51ed8d;}function getRoot(_0x5a626f){return parser['toJson'](_0x5a626f,{'object':!![]})[_0x9c3c('0x1a')][_0x9c3c('0x1b')];}function inspect(_0x1116c7){return util['inspect'](_0x1116c7,{'showHidden':![],'depth':null});}function initialize(_0x570566,_0x39e3a5){var _0x387351=getRoot(_0x570566[_0x9c3c('0x1c')]);if(!_0x387351||!_0x387351[_0x9c3c('0x1d')])return;var _0x9fddd1,_0x4ae7a5,_0x2a5650;logger[_0x9c3c('0x1e')](_0x9c3c('0x1b'),JSON[_0x9c3c('0x1f')](_0x387351,null,0x2));_0x39e3a5['joinAt']=moment()[_0x9c3c('0x20')](_0x9c3c('0x21'));_0x9fddd1=initGraph(_[_0x9c3c('0x12')](_0x387351,'mxCell'),_0x387351['mxCell']);_0x4ae7a5=new Vertices(_0x39e3a5,rpc,mailRpc);logger['info'](util[_0x9c3c('0x20')](_0x9c3c('0x22'),_0x39e3a5[_0x9c3c('0x23')],_0x39e3a5[_0x9c3c('0x24')],_0x39e3a5[_0x9c3c('0x25')],_0x39e3a5[_0x9c3c('0x26')],_0x39e3a5[_0x9c3c('0x27')]));_0x9fddd1[_0x9c3c('0x28')](_0x387351['start']['id'],function(_0x4e35ec){try{_0x4e35ec=_0x4ae7a5['clear'](_0x4e35ec);logger['debug']('vertex',JSON[_0x9c3c('0x1f')](_0x4e35ec,null,0x2));if(_0x4e35ec[_0x9c3c('0xe')]==='gotoc'){logger[_0x9c3c('0x29')](_0x9c3c('0x2a'));_0x39e3a5[_0x9c3c('0x2b')]=_0x4e35ec[_0x9c3c('0x2b')]||_0x39e3a5[_0x9c3c('0x2b')];_0x39e3a5[_0x9c3c('0x2c')]=_0x4e35ec[_0x9c3c('0x2c')];_0x39e3a5[_0x9c3c('0x2d')]=_0x4e35ec[_0x9c3c('0x2d')]?_0x4e35ec['priority']-0x1:0x1;return null;}else if(_0x4e35ec&&_0x4ae7a5[_0x4e35ec[_0x9c3c('0xe')]]){_0x2a5650=_0x4ae7a5[_0x4e35ec[_0x9c3c('0xe')]](_0x4e35ec);logger[_0x9c3c('0x29')](_0x9c3c('0x2e'),JSON[_0x9c3c('0x1f')](_0x2a5650,null,0x2));if(_0x2a5650&&_0x2a5650[_0x9c3c('0x2f')]===AGI_CODE_SUCCESS&&_0x2a5650['result']!==AGI_RESULT_ERROR&&!_0x39e3a5[_0x9c3c('0x30')]){logger[_0x9c3c('0x1e')](_0x9c3c('0x2e'),inspect(_0x2a5650));return _[_0x9c3c('0x31')](_0x2a5650[_0x9c3c('0x32')])?null:_0x2a5650['result'][_0x9c3c('0x33')]();}else{logger[_0x9c3c('0x34')]('response',inspect(_0x2a5650));return null;}}else{logger[_0x9c3c('0x34')](_0x9c3c('0x35'));return null;}}catch(_0x1112e5){logger[_0x9c3c('0x34')](_0x1112e5[_0x9c3c('0xd')]);return null;}});if(_0x387351[_0x9c3c('0x36')]){logger[_0x9c3c('0x29')](util[_0x9c3c('0x20')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x39e3a5['arg_1'],_0x39e3a5['calleridname'],_0x39e3a5[_0x9c3c('0x25')],_0x39e3a5[_0x9c3c('0x26')],_0x39e3a5[_0x9c3c('0x27')]));_0x9fddd1[_0x9c3c('0x28')](_0x387351[_0x9c3c('0x36')]['id'],function(_0x101560){try{_0x101560=_0x4ae7a5[_0x9c3c('0x37')](_0x101560);logger[_0x9c3c('0x1e')]('vertex',JSON[_0x9c3c('0x1f')](_0x101560,null,0x2));if(_0x101560&&_0x4ae7a5[_0x101560[_0x9c3c('0xe')]]){_0x2a5650=_0x4ae7a5[_0x101560[_0x9c3c('0xe')]](_0x101560);if(_0x2a5650){logger[_0x9c3c('0x1e')](_0x9c3c('0x2e'),inspect(_0x2a5650));return _[_0x9c3c('0x31')](_0x2a5650['result'])?null:_0x2a5650[_0x9c3c('0x32')][_0x9c3c('0x33')]();}else{logger[_0x9c3c('0x34')](_0x9c3c('0x2e'),inspect(_0x2a5650));return null;}}else{logger[_0x9c3c('0x34')]('agicommand\x20not\x20found');return null;}}catch(_0x26cc3e){logger['error'](_0x26cc3e[_0x9c3c('0xd')]);return null;}});}logger[_0x9c3c('0x29')](util[_0x9c3c('0x20')](_0x9c3c('0x38'),_0x39e3a5[_0x9c3c('0x23')],_0x39e3a5[_0x9c3c('0x24')],_0x39e3a5['callerid'],_0x39e3a5[_0x9c3c('0x26')],_0x39e3a5[_0x9c3c('0x27')]));logger[_0x9c3c('0x29')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x39e3a5[_0x9c3c('0x2b')],_0x39e3a5[_0x9c3c('0x2c')],parseInt(_0x39e3a5['priority'],0xa)+0x1));_0x39e3a5[_0x9c3c('0x39')](_0x39e3a5[_0x9c3c('0x2b')],_0x39e3a5['extension'],parseInt(_0x39e3a5[_0x9c3c('0x2d')],0xa)+0x1);_0x39e3a5[_0x9c3c('0x3a')]();}function handleNotFound(_0x3f53b3){logger[_0x9c3c('0x34')](util[_0x9c3c('0x20')]('Project\x20%s\x20not\x20found',_0x3f53b3[_0x9c3c('0x23')]));_0x3f53b3[_0x9c3c('0x39')](_0x3f53b3[_0x9c3c('0x2b')],_0x3f53b3[_0x9c3c('0x2c')],parseInt(_0x3f53b3[_0x9c3c('0x2d')],0xa)+0x1);_0x3f53b3[_0x9c3c('0x3a')]();}function handleUnpublished(_0x482d85){logger[_0x9c3c('0x34')](util[_0x9c3c('0x20')](_0x9c3c('0x3b'),_0x482d85['arg_1']));_0x482d85[_0x9c3c('0x39')](_0x482d85['context'],_0x482d85['extension'],parseInt(_0x482d85[_0x9c3c('0x2d')],0xa)+0x1);_0x482d85['close']();}module[_0x9c3c('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 5b1d211..550eb94 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 _0xf031=['prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','_inBody','indexOf','substring','slice','trim','emit','headers','line','length','Transform','call','inherits'];(function(_0x1729d5,_0x5921c5){var _0x6bb300=function(_0x31303a){while(--_0x31303a){_0x1729d5['push'](_0x1729d5['shift']());}};_0x6bb300(++_0x5921c5);}(_0xf031,0xfc));var _0x1f03=function(_0xfbaa8b,_0x350d63){_0xfbaa8b=_0xfbaa8b-0x0;var _0x33c32c=_0xf031[_0xfbaa8b];return _0x33c32c;};'use strict';var util=require('util');var Transform=require('stream')[_0x1f03('0x0')];function AGIReply(_0x68cc71){Transform[_0x1f03('0x1')](this,_0x68cc71);this['_localBuffer']='';this['_inBody']=![];}util[_0x1f03('0x2')](AGIReply,Transform);AGIReply[_0x1f03('0x3')][_0x1f03('0x4')]=function(_0x4bcab4,_0x399588,_0x2dc000){var _0xfef1='\x0a',_0x23c63b=['\x0a\x0a',_0x1f03('0x5')],_0x416bc0=-0x1,_0x5e37ab=-0x1,_0x239813='',_0x3c6256=0x0,_0x30a3fb='',_0x45f3eb='';this[_0x1f03('0x6')]+=_0x4bcab4[_0x1f03('0x7')]();_0x30a3fb=this[_0x1f03('0x6')];if(!this[_0x1f03('0x8')]){_0x3c6256=0x0;while(_0x23c63b[_0x3c6256]){while((_0x5e37ab=_0x30a3fb[_0x1f03('0x9')](_0x23c63b[_0x3c6256]))!=-0x1){_0x239813=_0x23c63b[_0x3c6256];_0x45f3eb=_0x30a3fb[_0x1f03('0xa')](0x0,_0x5e37ab);_0x30a3fb=_0x30a3fb[_0x1f03('0xa')](_0x5e37ab+_0x239813['length']);var _0x271884=_0x45f3eb['split'](_0xfef1),_0x32e868=0x0,_0xc2c7f5={},_0x84c916='',_0x3dd878='',_0x3a82be=-0x1;while(_0x271884[_0x32e868]){_0x3a82be=_0x271884[_0x32e868][_0x1f03('0x9')](':');if(_0x3a82be!=-0x1){_0x84c916=_0x271884[_0x32e868][_0x1f03('0xb')](0x0,_0x3a82be)[_0x1f03('0xc')]();_0x3dd878=_0x271884[_0x32e868][_0x1f03('0xb')](_0x3a82be+0x1)[_0x1f03('0xc')]();if(_0x84c916['length']>0x0){_0xc2c7f5[_0x84c916]=_0x3dd878;}}else{}_0x32e868++;}this[_0x1f03('0xd')](_0x1f03('0xe'),_0xc2c7f5);this[_0x1f03('0x8')]=!![];}_0x3c6256++;}this['_localBuffer']=_0x30a3fb;}else{while((_0x416bc0=_0x30a3fb[_0x1f03('0x9')](_0xfef1))!=-0x1){_0x45f3eb=_0x30a3fb[_0x1f03('0xa')](0x0,_0x416bc0);this['emit'](_0x1f03('0xf'),_0x45f3eb);_0x30a3fb=_0x30a3fb[_0x1f03('0xa')](_0x416bc0+_0xfef1[_0x1f03('0x10')]);}this[_0x1f03('0x6')]=_0x30a3fb;}_0x2dc000();};module['exports']=AGIReply; \ No newline at end of file +var _0xd4a0=['_inBody','substring','split','slice','trim','length','emit','headers','indexOf','line','exports','util','stream','Transform','_localBuffer','inherits','_transform','\x0d\x0a\x0d\x0a','toString'];(function(_0x4b59ec,_0x400d58){var _0x1d267f=function(_0x16370b){while(--_0x16370b){_0x4b59ec['push'](_0x4b59ec['shift']());}};_0x1d267f(++_0x400d58);}(_0xd4a0,0x187));var _0x0d4a=function(_0xf36240,_0x582f06){_0xf36240=_0xf36240-0x0;var _0x2a9338=_0xd4a0[_0xf36240];return _0x2a9338;};'use strict';var util=require(_0x0d4a('0x0'));var Transform=require(_0x0d4a('0x1'))[_0x0d4a('0x2')];function AGIReply(_0x3b8e66){Transform['call'](this,_0x3b8e66);this[_0x0d4a('0x3')]='';this['_inBody']=![];}util[_0x0d4a('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x0d4a('0x5')]=function(_0x587950,_0x26bd85,_0x41102a){var _0x23cc89='\x0a',_0x4513e0=['\x0a\x0a',_0x0d4a('0x6')],_0x1c2f5c=-0x1,_0x502c03=-0x1,_0x570c60='',_0x9baba8=0x0,_0xed04f5='',_0x2307df='';this[_0x0d4a('0x3')]+=_0x587950[_0x0d4a('0x7')]();_0xed04f5=this['_localBuffer'];if(!this[_0x0d4a('0x8')]){_0x9baba8=0x0;while(_0x4513e0[_0x9baba8]){while((_0x502c03=_0xed04f5['indexOf'](_0x4513e0[_0x9baba8]))!=-0x1){_0x570c60=_0x4513e0[_0x9baba8];_0x2307df=_0xed04f5['substring'](0x0,_0x502c03);_0xed04f5=_0xed04f5[_0x0d4a('0x9')](_0x502c03+_0x570c60['length']);var _0x519eb3=_0x2307df[_0x0d4a('0xa')](_0x23cc89),_0x2f0c96=0x0,_0x129b2c={},_0x578b72='',_0x1de093='',_0x51ddc5=-0x1;while(_0x519eb3[_0x2f0c96]){_0x51ddc5=_0x519eb3[_0x2f0c96]['indexOf'](':');if(_0x51ddc5!=-0x1){_0x578b72=_0x519eb3[_0x2f0c96][_0x0d4a('0xb')](0x0,_0x51ddc5)['trim']();_0x1de093=_0x519eb3[_0x2f0c96][_0x0d4a('0xb')](_0x51ddc5+0x1)[_0x0d4a('0xc')]();if(_0x578b72[_0x0d4a('0xd')]>0x0){_0x129b2c[_0x578b72]=_0x1de093;}}else{}_0x2f0c96++;}this[_0x0d4a('0xe')](_0x0d4a('0xf'),_0x129b2c);this[_0x0d4a('0x8')]=!![];}_0x9baba8++;}this[_0x0d4a('0x3')]=_0xed04f5;}else{while((_0x1c2f5c=_0xed04f5[_0x0d4a('0x10')](_0x23cc89))!=-0x1){_0x2307df=_0xed04f5[_0x0d4a('0x9')](0x0,_0x1c2f5c);this[_0x0d4a('0xe')](_0x0d4a('0x11'),_0x2307df);_0xed04f5=_0xed04f5[_0x0d4a('0x9')](_0x1c2f5c+_0x23cc89[_0x0d4a('0xd')]);}this[_0x0d4a('0x3')]=_0xed04f5;}_0x41102a();};module[_0x0d4a('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1fd3d6d..d86c657 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 _0x4a25=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','UnpauseUser','agentLogout','lodash','jayson/promise','http','request','then','error','result','catch','name','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x4a25,0x1d4));var _0x54a2=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x4a25[_0x5c883f];return _0x4210cc;};'use strict';var _=require(_0x54a2('0x0'));var moment=require('moment');var jayson=require(_0x54a2('0x1'));var client=jayson['client'][_0x54a2('0x2')]({'port':0x2329});function request(_0x1631ce,_0x446759){return new Promise(function(_0x3e5d5b,_0x5c6c1f){return client[_0x54a2('0x3')](_0x1631ce,_0x446759)[_0x54a2('0x4')](function(_0x240603){if(_0x240603[_0x54a2('0x5')]){return _0x5c6c1f(_0x240603[_0x54a2('0x5')]['message']);}else{return _0x3e5d5b(_0x240603[_0x54a2('0x6')]);}})[_0x54a2('0x7')](function(_0x1d7b2c){return _0x5c6c1f(_0x1d7b2c);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x54a2('0x8'),'production']}});};exports[_0x54a2('0x9')]=function(_0x28655c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x28655c},'attributes':[_0x54a2('0xa')]}});};exports[_0x54a2('0xb')]=function(_0x4ee059){return request(_0x54a2('0xc'),{'options':{'raw':![],'where':{'id':_0x4ee059},'include':[{'model':_0x54a2('0xd'),'as':'Smtp','include':[{'model':_0x54a2('0xe'),'as':_0x54a2('0xe')}]}],'attributes':['id',_0x54a2('0x8'),_0x54a2('0xf')],'smtp':!![]}});};exports[_0x54a2('0x10')]=function(_0x352200){return request(_0x54a2('0x11'),{'options':{'where':{'id':_0x352200},'attributes':[_0x54a2('0x8')]}});};exports['getVoiceQueueById']=function(_0x348e31){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x348e31},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x12')]=function(_0xb61800){return request(_0x54a2('0x13'),{'options':{'where':{'id':_0xb61800},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x14')]=function(_0x740ad){return request(_0x54a2('0x15'),{'options':{'where':{'id':_0x740ad},'attributes':[_0x54a2('0x16')]}});};exports[_0x54a2('0x17')]=function(_0x528ca9){return request('ShowUser',{'options':{'where':{'id':_0x528ca9},'attributes':['name']}});};exports[_0x54a2('0x18')]=function(_0x5356ea){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5356ea['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x67f8a5){return request(_0x54a2('0x19'),{'options':{'where':{'id':_0x67f8a5},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x1a')]=function(_0xd9a51d){return request(_0x54a2('0x1b'),{'options':{'where':{'id':_0xd9a51d},'attributes':[_0x54a2('0x1c')]}});};exports[_0x54a2('0x1d')]=function(_0x4c1545){return request(_0x54a2('0x1e'),{'options':{'raw':![],'where':{'id':_0x4c1545},'include':[{'model':_0x54a2('0x1f'),'as':_0x54a2('0x20')}]}});};exports['getSmsAccountById']=function(_0x3a080a){return request(_0x54a2('0x21'),{'options':{'where':{'id':_0x3a080a},'attributes':['id','name']}});};exports[_0x54a2('0x22')]=function(_0x22b6ed){return request('CreateSmsMessage',{'body':_0x22b6ed});};exports[_0x54a2('0x23')]=function(_0x110fd5){return request(_0x54a2('0x24'),{'body':_0x110fd5});};exports[_0x54a2('0x25')]=function(_0x35b3f2){return request(_0x54a2('0x26'),{'body':_['merge'](_0x35b3f2,{'project_name':_0x35b3f2[_0x54a2('0x27')],'prev_project_name':_0x35b3f2[_0x54a2('0x28')]||'','is_subproject':_0x35b3f2['arg_2']?!![]:![],'leaveAt':moment()[_0x54a2('0x29')](_0x54a2('0x2a'))})});};exports[_0x54a2('0x2b')]=function(_0x423870){return request(_0x54a2('0x2c'),{'body':_0x423870});};exports['createSquareMessage']=function(_0xc8f32d){return request(_0x54a2('0x2d'),{'body':_0xc8f32d});};exports[_0x54a2('0x2e')]=function(_0x3a2690){return request(_0x54a2('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3a2690[_0x54a2('0x30')],'ListId':_0x3a2690[_0x54a2('0x31')]}}})[_0x54a2('0x4')](function(_0x17ba86){if(_0x17ba86){return _0x17ba86;}return request('CreateCmContact',{'body':_0x3a2690});});};exports[_0x54a2('0x32')]=function(_0x5f54c1){return request('ShowPause',{'options':{'where':{'id':_0x5f54c1},'attributes':[_0x54a2('0x8')]}});};exports[_0x54a2('0x33')]=function(_0x4576ce,_0x27e593){return request(_0x54a2('0x34'),{'body':{'interface':_0x27e593},'options':{'where':_0x4576ce}});};exports[_0x54a2('0x35')]=function(_0x1e38e6,_0x5e904a,_0x136b61){return request('PauseUser',{'body':{'type':_0x5e904a,'uniqueid':_0x136b61},'options':{'where':_0x1e38e6}});};exports['agentUnpause']=function(_0x402385){return request(_0x54a2('0x36'),{'body':{},'options':{'where':_0x402385}});};exports[_0x54a2('0x37')]=function(_0x88ea06){return request('LogoutUser',{'body':{},'options':{'where':_0x88ea06}});}; \ No newline at end of file +var _0x00bb=['email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowSquareOdbc','dsn','getUserById','phone','ShowTrunk','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','lodash','moment','jayson/promise','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','CloudProvider','name'];(function(_0xdfdeb7,_0x29649c){var _0x1db931=function(_0x65c2bd){while(--_0x65c2bd){_0xdfdeb7['push'](_0xdfdeb7['shift']());}};_0x1db931(++_0x29649c);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xb00b('0x0'));var moment=require(_0xb00b('0x1'));var jayson=require(_0xb00b('0x2'));var client=jayson['client'][_0xb00b('0x3')]({'port':0x2329});function request(_0x47a3bf,_0x278c5e){return new Promise(function(_0x464fe7,_0x582ef9){return client[_0xb00b('0x4')](_0x47a3bf,_0x278c5e)[_0xb00b('0x5')](function(_0x5b3b34){if(_0x5b3b34['error']){return _0x582ef9(_0x5b3b34['error'][_0xb00b('0x6')]);}else{return _0x464fe7(_0x5b3b34[_0xb00b('0x7')]);}})[_0xb00b('0x8')](function(_0x37f07d){return _0x582ef9(_0x37f07d);});});}exports[_0xb00b('0x9')]=function(){return request(_0xb00b('0xa'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xb00b('0xb')]=function(_0x1e9b7b){return request(_0xb00b('0xc'),{'options':{'raw':![],'where':{'name':_0x1e9b7b},'attributes':[_0xb00b('0xd')]}});};exports[_0xb00b('0xe')]=function(_0x48e125){return request(_0xb00b('0xf'),{'options':{'raw':![],'where':{'id':_0x48e125},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0xb00b('0x10')}]}],'attributes':['id',_0xb00b('0x11'),_0xb00b('0x12')],'smtp':!![]}});};exports[_0xb00b('0x13')]=function(_0xef5d52){return request(_0xb00b('0xc'),{'options':{'where':{'id':_0xef5d52},'attributes':['name']}});};exports[_0xb00b('0x14')]=function(_0xb0d42e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xb0d42e},'attributes':[_0xb00b('0x11')]}});};exports[_0xb00b('0x15')]=function(_0x540b79){return request('ShowVariable',{'options':{'where':{'id':_0x540b79},'attributes':[_0xb00b('0x11')]}});};exports['getSquareOdbcById']=function(_0x51d136){return request(_0xb00b('0x16'),{'options':{'where':{'id':_0x51d136},'attributes':[_0xb00b('0x17')]}});};exports[_0xb00b('0x18')]=function(_0xbb72fc){return request('ShowUser',{'options':{'where':{'id':_0xbb72fc},'attributes':[_0xb00b('0x11')]}});};exports['getContactByPhone']=function(_0x415f91){return request('GetContactByPhone',{'options':{'where':{'phone':_0x415f91[_0xb00b('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xb26ebb){return request(_0xb00b('0x1a'),{'options':{'where':{'id':_0xb26ebb},'attributes':['name']}});};exports['getSoundById']=function(_0x2b0da1){return request('ShowSound',{'options':{'where':{'id':_0x2b0da1},'attributes':[_0xb00b('0x1b')]}});};exports[_0xb00b('0x1c')]=function(_0x2fe48d){return request(_0xb00b('0x1d'),{'options':{'raw':![],'where':{'id':_0x2fe48d},'include':[{'model':'Interval','as':_0xb00b('0x1e')}]}});};exports['getSmsAccountById']=function(_0x25a973){return request(_0xb00b('0x1f'),{'options':{'where':{'id':_0x25a973},'attributes':['id','name']}});};exports[_0xb00b('0x20')]=function(_0x2896d1){return request('CreateSmsMessage',{'body':_0x2896d1});};exports[_0xb00b('0x21')]=function(_0x1f04d3){return request('CreateSquareDetailsReport',{'body':_0x1f04d3});};exports[_0xb00b('0x22')]=function(_0x243fdb){return request(_0xb00b('0x23'),{'body':_[_0xb00b('0x24')](_0x243fdb,{'project_name':_0x243fdb['arg_1'],'prev_project_name':_0x243fdb['arg_2']||'','is_subproject':_0x243fdb[_0xb00b('0x25')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x16ac55){return request(_0xb00b('0x26'),{'body':_0x16ac55});};exports[_0xb00b('0x27')]=function(_0x3825af){return request(_0xb00b('0x28'),{'body':_0x3825af});};exports[_0xb00b('0x29')]=function(_0x15d3b9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x15d3b9[_0xb00b('0x19')],'ListId':_0x15d3b9['ListId']}}})[_0xb00b('0x5')](function(_0x348165){if(_0x348165){return _0x348165;}return request(_0xb00b('0x2a'),{'body':_0x15d3b9});});};exports['getPauseById']=function(_0x2fc11a){return request(_0xb00b('0x2b'),{'options':{'where':{'id':_0x2fc11a},'attributes':[_0xb00b('0x11')]}});};exports[_0xb00b('0x2c')]=function(_0x303625,_0x2b9824){return request(_0xb00b('0x2d'),{'body':{'interface':_0x2b9824},'options':{'where':_0x303625}});};exports[_0xb00b('0x2e')]=function(_0x149c1a,_0x54e247,_0x2b5f41){return request(_0xb00b('0x2f'),{'body':{'type':_0x54e247,'uniqueid':_0x2b5f41},'options':{'where':_0x149c1a}});};exports['agentUnpause']=function(_0x593659){return request(_0xb00b('0x30'),{'body':{},'options':{'where':_0x593659}});};exports['agentLogout']=function(_0x456241){return request('LogoutUser',{'body':{},'options':{'where':_0x456241}});}; \ 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 f78751e..0e2b998 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 _0x624c=['./lex','exports'];(function(_0xd3b0ac,_0x2f5065){var _0x3d773e=function(_0x2e10d1){while(--_0x2e10d1){_0xd3b0ac['push'](_0xd3b0ac['shift']());}};_0x3d773e(++_0x2f5065);}(_0x624c,0x1ee));var _0xc624=function(_0x5c6efe,_0x4126d6){_0x5c6efe=_0x5c6efe-0x0;var _0x181a12=_0x624c[_0x5c6efe];return _0x181a12;};var polly=require('./polly');var lex=require(_0xc624('0x0'));module[_0xc624('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9e8a=['exports','./polly','./lex'];(function(_0x4f2773,_0x198100){var _0x4999d7=function(_0x5cf34c){while(--_0x5cf34c){_0x4f2773['push'](_0x4f2773['shift']());}};_0x4999d7(++_0x198100);}(_0x9e8a,0x112));var _0xa9e8=function(_0x381412,_0x5518a0){_0x381412=_0x381412-0x0;var _0x46b37b=_0x9e8a[_0x381412];return _0x46b37b;};var polly=require(_0xa9e8('0x0'));var lex=require(_0xa9e8('0x1'));module[_0xa9e8('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index adc3c38..913fc4d 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','./lib/api'];(function(_0x2627e3,_0x5bb123){var _0x55621b=function(_0x230e5a){while(--_0x230e5a){_0x2627e3['push'](_0x2627e3['shift']());}};_0x55621b(++_0x5bb123);}(_0x70e0,0x17b));var _0x070e=function(_0x546f27,_0x4dd8a5){_0x546f27=_0x546f27-0x0;var _0x2d40d4=_0x70e0[_0x546f27];return _0x2d40d4;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0x6e6c=['exports','./lib/api'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ 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 9e6ae91..f00d8ad 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(_0x5e68d5,_0x43b170){var _0x11f1b6=function(_0x1781a6){while(--_0x1781a6){_0x5e68d5['push'](_0x5e68d5['shift']());}};_0x11f1b6(++_0x43b170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x487089,_0x4e9ba6){var _0x4506be=function(_0x213ea6){while(--_0x213ea6){_0x487089['push'](_0x487089['shift']());}};_0x4506be(++_0x4e9ba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 1fdce8a..37ff63c 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 _0xc750=['./lib/api','exports'];(function(_0x313ddc,_0x3bb735){var _0x3eed02=function(_0x342eb9){while(--_0x342eb9){_0x313ddc['push'](_0x313ddc['shift']());}};_0x3eed02(++_0x3bb735);}(_0xc750,0x158));var _0x0c75=function(_0x109628,_0x5184cb){_0x109628=_0x109628-0x0;var _0x556b86=_0xc750[_0x109628];return _0x556b86;};'use strict';var polly=require(_0x0c75('0x0'));module[_0x0c75('0x1')]=function(_0x3a4673,_0x9c423b,_0x2f2990,_0x5b9979,_0x5862a3,_0x220b52,_0x3acab9){return polly(_0x3a4673,_0x9c423b,_0x2f2990,_0x5b9979,_0x5862a3,_0x220b52,_0x3acab9);}; \ No newline at end of file +var _0x046f=['./lib/api','exports'];(function(_0x57f0e9,_0x4dafbb){var _0x4fcb19=function(_0x401125){while(--_0x401125){_0x57f0e9['push'](_0x57f0e9['shift']());}};_0x4fcb19(++_0x4dafbb);}(_0x046f,0x1d8));var _0xf046=function(_0x531ed1,_0x74b376){_0x531ed1=_0x531ed1-0x0;var _0x3cbe81=_0x046f[_0x531ed1];return _0x3cbe81;};'use strict';var polly=require(_0xf046('0x0'));module[_0xf046('0x1')]=function(_0xef8e6c,_0x3828db,_0x47c287,_0x173e2b,_0x5e5c42,_0x354528,_0x2b7f50){return polly(_0xef8e6c,_0x3828db,_0x47c287,_0x173e2b,_0x5e5c42,_0x354528,_0x2b7f50);}; \ 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 aacfe5d..c1eb360 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 _0xde19=['Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x35ecde,_0x2c20ba){var _0x4918f5=function(_0x42ca9c){while(--_0x42ca9c){_0x35ecde['push'](_0x35ecde['shift']());}};_0x4918f5(++_0x2c20ba);}(_0xde19,0x1bf));var _0x9de1=function(_0x56aca3,_0x4c01d1){_0x56aca3=_0x56aca3-0x0;var _0x54d207=_0xde19[_0x56aca3];return _0x54d207;};'use strict';var fs=require('fs');var path=require(_0x9de1('0x0'));var BPromise=require(_0x9de1('0x1'));var rs=require('randomstring');var AWS=require(_0x9de1('0x2'));function pollyResult(_0x28f32d,_0x3dd29f,_0x217b16){return new BPromise(function(_0x165c29,_0xb47680){_0x28f32d[_0x9de1('0x3')](_0x3dd29f,function(_0x493db7,_0x254c8d){if(_0x493db7){_0xb47680(_0x493db7);}else if(_0x254c8d){if(_0x254c8d[_0x9de1('0x4')]instanceof Buffer){fs[_0x9de1('0x5')](_0x217b16,_0x254c8d['AudioStream'],function(_0x51cedd){if(_0x51cedd){_0xb47680(_0x51cedd);}else{_0x165c29();}});}else{_0xb47680(new Error(_0x9de1('0x6')));}}else{_0xb47680(new Error(_0x9de1('0x7')));}});});}module[_0x9de1('0x8')]=function(_0x54e24a,_0x39a037,_0x1bb278,_0x1ea046,_0x111646,_0x4e3bec,_0xbf2ae7){var _0x594128=new AWS[(_0x9de1('0x9'))]({'accessKeyId':_0x54e24a,'secretAccessKey':_0x39a037,'region':_0x1bb278});var _0x565de7={'Text':_0x111646,'TextType':_0x4e3bec||_0x9de1('0xa'),'OutputFormat':_0x9de1('0xb'),'VoiceId':_0x1ea046};return pollyResult(_0x594128,_0x565de7,_0xbf2ae7);}; \ No newline at end of file +var _0xf3e5=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0xf3e5,0x194));var _0x5f3e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xf3e5[_0x29b609];return _0x54c952;};'use strict';var fs=require('fs');var path=require(_0x5f3e('0x0'));var BPromise=require(_0x5f3e('0x1'));var rs=require(_0x5f3e('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x44f63e,_0x4d0920,_0x4f1ab6){return new BPromise(function(_0x14329b,_0x22b885){_0x44f63e[_0x5f3e('0x3')](_0x4d0920,function(_0x5581a6,_0x19ad39){if(_0x5581a6){_0x22b885(_0x5581a6);}else if(_0x19ad39){if(_0x19ad39[_0x5f3e('0x4')]instanceof Buffer){fs['writeFile'](_0x4f1ab6,_0x19ad39[_0x5f3e('0x4')],function(_0x43a0b2){if(_0x43a0b2){_0x22b885(_0x43a0b2);}else{_0x14329b();}});}else{_0x22b885(new Error(_0x5f3e('0x5')));}}else{_0x22b885(new Error(_0x5f3e('0x6')));}});});}module['exports']=function(_0x3c7124,_0x15d3da,_0x393232,_0x308a27,_0x5af02d,_0x2ec5b7,_0x2cf7fb){var _0x580b8e=new AWS[(_0x5f3e('0x7'))]({'accessKeyId':_0x3c7124,'secretAccessKey':_0x15d3da,'region':_0x393232});var _0x415b70={'Text':_0x5af02d,'TextType':_0x2ec5b7||_0x5f3e('0x8'),'OutputFormat':_0x5f3e('0x9'),'VoiceId':_0x308a27};return pollyResult(_0x580b8e,_0x415b70,_0x2cf7fb);}; \ 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 b11db52..f81248a 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 _0x04fb=['exports'];(function(_0x3eeabe,_0x2c8839){var _0x276c10=function(_0x592380){while(--_0x592380){_0x3eeabe['push'](_0x3eeabe['shift']());}};_0x276c10(++_0x2c8839);}(_0x04fb,0x12c));var _0xb04f=function(_0x17c5e9,_0x2134dc){_0x17c5e9=_0x17c5e9-0x0;var _0x17fcb3=_0x04fb[_0x17c5e9];return _0x17fcb3;};'use strict';var asr=require('./lib/api');module[_0xb04f('0x0')]=function(_0x5e2c68,_0x5978b1,_0x20de93,_0x217a9b){return asr(_0x5e2c68,_0x5978b1,_0x20de93);}; \ No newline at end of file +var _0x0a24=['exports'];(function(_0x4217fd,_0x383410){var _0x428abc=function(_0x2536ed){while(--_0x2536ed){_0x4217fd['push'](_0x4217fd['shift']());}};_0x428abc(++_0x383410);}(_0x0a24,0x186));var _0x40a2=function(_0x4e7cc3,_0x47ff4){_0x4e7cc3=_0x4e7cc3-0x0;var _0x42e46d=_0x0a24[_0x4e7cc3];return _0x42e46d;};'use strict';var asr=require('./lib/api');module[_0x40a2('0x0')]=function(_0x563423,_0xc830f3,_0x52d8c3,_0x4f162b){return asr(_0x563423,_0xc830f3,_0x52d8c3);}; \ 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 e5d257d..b4863cb 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 _0x05b0=['readFileSync','8000','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x4740f8,_0x31261f){var _0x260ba9=function(_0x2bb599){while(--_0x2bb599){_0x4740f8['push'](_0x4740f8['shift']());}};_0x260ba9(++_0x31261f);}(_0x05b0,0x188));var _0x005b=function(_0x2615d2,_0x497a64){_0x2615d2=_0x2615d2-0x0;var _0xc51a6c=_0x05b0[_0x2615d2];return _0xc51a6c;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x005b('0x0');module[_0x005b('0x1')]=function(_0x4c8e5f,_0xbc782b,_0x2f5c09){return new BPromise(function(_0x4a76d7,_0x342d08){var _0x2849ed;if(typeof _0x4c8e5f!=='string'||_0x4c8e5f[_0x005b('0x2')]===0x0){return _0x342d08(_0x005b('0x3'));}if(typeof _0xbc782b!==_0x005b('0x4')||_0xbc782b[_0x005b('0x2')]===0x0){return _0x342d08(_0x005b('0x5'));}if(typeof _0x2f5c09!==_0x005b('0x6')&&(typeof _0x2f5c09!==_0x005b('0x4')||_0x2f5c09['length']===0x0)){return _0x342d08(_0x005b('0x7'));}try{_0x2849ed=fs[_0x005b('0x8')](_0x4c8e5f)['toString']('base64');}catch(_0x451641){return _0x342d08(_0x451641);}return _0x4a76d7({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0xbc782b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x005b('0x9'),'languageCode':_0x2f5c09},'audio':{'content':_0x2849ed}},'json':!![]});});}; \ No newline at end of file +var _0x6f7a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x34ed61,_0x616868){var _0x39a808=function(_0x5c2ec7){while(--_0x5c2ec7){_0x34ed61['push'](_0x34ed61['shift']());}};_0x39a808(++_0x616868);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1fe22d,_0x515e3f){_0x1fe22d=_0x1fe22d-0x0;var _0x5e9c99=_0x6f7a[_0x1fe22d];return _0x5e9c99;};'use strict';var url=require(_0xa6f7('0x0'));var BPromise=require(_0xa6f7('0x1'));var fs=require('fs');var host=_0xa6f7('0x2');module[_0xa6f7('0x3')]=function(_0x4dd99d,_0x93614a,_0x407de3){return new BPromise(function(_0x12ecb8,_0x1da6dc){var _0x22e529;if(typeof _0x4dd99d!==_0xa6f7('0x4')||_0x4dd99d[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x6'));}if(typeof _0x93614a!==_0xa6f7('0x4')||_0x93614a[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x7'));}if(typeof _0x407de3!=='undefined'&&(typeof _0x407de3!=='string'||_0x407de3[_0xa6f7('0x5')]===0x0)){return _0x1da6dc(_0xa6f7('0x8'));}try{_0x22e529=fs[_0xa6f7('0x9')](_0x4dd99d)[_0xa6f7('0xa')](_0xa6f7('0xb'));}catch(_0x49a451){return _0x1da6dc(_0x49a451);}return _0x12ecb8({'method':'POST','uri':host+_0xa6f7('0xc')+_0x93614a,'body':{'config':{'encoding':_0xa6f7('0xd'),'sampleRateHertz':'8000','languageCode':_0x407de3},'audio':{'content':_0x22e529}},'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 077675a..f39424f 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 _0x78e0=['exports','./asr'];(function(_0x9f52a,_0x11bbcf){var _0x1ca182=function(_0x1a0beb){while(--_0x1a0beb){_0x9f52a['push'](_0x9f52a['shift']());}};_0x1ca182(++_0x11bbcf);}(_0x78e0,0x1df));var _0x078e=function(_0x21ba7d,_0x3721f1){_0x21ba7d=_0x21ba7d-0x0;var _0x1445b6=_0x78e0[_0x21ba7d];return _0x1445b6;};var asr=require(_0x078e('0x0'));module[_0x078e('0x1')]={'asr':asr}; \ No newline at end of file +var _0xed04=['./asr','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xed04,0xfe));var _0x4ed0=function(_0xb250f6,_0x587262){_0xb250f6=_0xb250f6-0x0;var _0x28050f=_0xed04[_0xb250f6];return _0x28050f;};var asr=require(_0x4ed0('0x0'));module[_0x4ed0('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 2c696c5..c6d9a7e 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 _0x883d=['score','status','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','path','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','close','unlink','pipe','end','https:','host','data','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','text:synthesize','POST','tmp','.mp3','from','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','fulfillment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x883d,0xac));var _0xd883=function(_0x3b1fe4,_0x36e8c3){_0x3b1fe4=_0x3b1fe4-0x0;var _0x542998=_0x883d[_0x3b1fe4];return _0x542998;};'use strict';var apiai=require(_0xd883('0x0'));var BPromise=require(_0xd883('0x1'));var dialogflow=require(_0xd883('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xd883('0x3'));var md5=require(_0xd883('0x4'));var path=require('path');var querystring=require(_0xd883('0x5'));var rp=require(_0xd883('0x6'));var rs=require('randomstring');var sox=require(_0xd883('0x7'));var tts=require(_0xd883('0x8'));var urlParse=require(_0xd883('0x9'))[_0xd883('0xa')];var util=require(_0xd883('0xb'));var aws=require(_0xd883('0xc'));var google=require(_0xd883('0xd'));var sestek=require(_0xd883('0xe'));var tilde=require(_0xd883('0xf'));var logger=require(_0xd883('0x10'))(_0xd883('0x11'));var ISPEECH_API=_0xd883('0x12');function downloadFile(_0x2fd59f,_0x5b54e1){return new BPromise(function(_0xf71b7,_0x3b4571){var _0xe04d20=urlParse(_0x2fd59f);var _0x3c00eb=_0xe04d20[_0xd883('0x13')]==='https:'?https:http;var _0x26fe44={'host':_0xe04d20['host'],'path':_0xe04d20[_0xd883('0x14')],'headers':{'user-agent':_0xd883('0x15')}};_0x3c00eb[_0xd883('0x16')](_0x26fe44,function(_0x313222){if(_0x313222['statusCode']!==0xc8){logger[_0xd883('0x17')](_0xd883('0x18')+_0x2fd59f+'\x20failed,\x20status\x20code\x20=\x20'+_0x313222[_0xd883('0x19')]+'\x20('+_0x313222[_0xd883('0x1a')]+')');_0x3b4571(new Error(_0xd883('0x18')+_0x2fd59f+_0xd883('0x1b')+_0x313222[_0xd883('0x19')]+'\x20('+_0x313222['statusMessage']+')'));return;}var _0x357235=fs[_0xd883('0x1c')](_0x5b54e1);_0x357235['on']('finish',function(){logger[_0xd883('0x1d')]('finish\x20download\x20file');_0x357235[_0xd883('0x1e')](_0xf71b7);});_0x357235['on'](_0xd883('0x17'),function(_0x4ff666){fs[_0xd883('0x1f')](_0x5b54e1);logger['error']('download\x20error',_0x4ff666);_0x3b4571(_0x4ff666);});_0x313222[_0xd883('0x20')](_0x357235);})['on'](_0xd883('0x17'),function(_0x11d0a1){logger[_0xd883('0x17')](_0x11d0a1);_0x3b4571(_0x11d0a1);})[_0xd883('0x21')]();});}function uploadFile(_0x283ecf){return new BPromise(function(_0x420a98,_0x198cb){var _0x1fbeb9=urlParse(_0x283ecf);var _0x18d687=_0x1fbeb9[_0xd883('0x13')]===_0xd883('0x22')?https:http;var _0x4776b2={'host':_0x1fbeb9[_0xd883('0x23')],'path':_0x1fbeb9[_0xd883('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x18d687[_0xd883('0x16')](_0x4776b2,function(_0x29e8ee){if(_0x29e8ee['statusCode']!==0xc8){_0x198cb(new Error(_0xd883('0x18')+_0x283ecf+_0xd883('0x1b')+_0x29e8ee[_0xd883('0x19')]+'\x20('+_0x29e8ee[_0xd883('0x1a')]+')'));return;}var _0x48e022='';_0x29e8ee['on'](_0xd883('0x24'),function(_0x3c0796){_0x48e022+=_0x3c0796;});_0x29e8ee['on'](_0xd883('0x21'),function(){_0x420a98(_0x48e022);});})['on'](_0xd883('0x17'),function(_0x1ea7a5){_0x198cb(_0x1ea7a5);})[_0xd883('0x21')]();});}function convertFile(_0x36446f,_0x5a1503){return new BPromise(function(_0x2fa0b4,_0x3165dd){var _0x3b3075=sox['transcode'](_0x36446f,_0x5a1503,{'sampleRate':0x1f40,'format':_0xd883('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b3075['on']('error',function(_0x314220){logger['error'](_0xd883('0x26'),_0x314220);_0x3165dd(_0x314220);});_0x3b3075['on'](_0xd883('0x21'),function(){logger[_0xd883('0x1d')](_0xd883('0x27'));_0x2fa0b4();});_0x3b3075['start']();});}function base64Decode(_0x36f1e0,_0xdb5161){var _0x1fed0f=path[_0xd883('0x28')](__dirname,'tmp',rs[_0xd883('0x29')](0x4)+_0xd883('0x2a'));fs[_0xd883('0x2b')](_0x1fed0f,_0x36f1e0,_0xd883('0x2c'));return convertFile(_0x1fed0f,_0xdb5161)[_0xd883('0x2d')](function(){try{fs[_0xd883('0x1f')](_0x1fed0f);fs[_0xd883('0x2e')](_0xdb5161,_0xd883('0x2f'));}catch(_0x1b4bdd){logger[_0xd883('0x17')](_0x1b4bdd);}return _0xdb5161[_0xd883('0x30')]('.')[0x0];});}function base64Encode(_0x36169e){var _0x5dac41=fs['readFileSync'](_0x36169e);return new Buffer(_0x5dac41)['toString'](_0xd883('0x2c'));}exports[_0xd883('0x31')]=function(_0x20190c,_0x23ca55,_0x3fb230,_0x429a61,_0x8354e9,_0x2f1b33){var _0x411503,_0x3cd068;var _0x3060ed=_0xd883('0x32');var _0x6c9ca8=_0xd883('0x33')+_0x20190c;var _0x9f1319={};if(_0x23ca55===_0xd883('0x34')){_0x9f1319[_0xd883('0x35')]={'ssml':_0x3fb230};}else{_0x9f1319[_0xd883('0x35')]={'text':_0x3fb230};};_0x9f1319['voice']={'languageCode':_0x429a61,'ssmlGender':_0x8354e9};_0x9f1319['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x332d72={'url':_0x3060ed+_0xd883('0x36')+_0x6c9ca8,'method':_0xd883('0x37'),'json':!![],'body':_0x9f1319};return rp(_0x332d72)[_0xd883('0x2d')](function(_0x1ac879){return new BPromise(function(_0x258d19,_0x38f878){_0x411503=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+_0xd883('0x39'));var _0x186f02=Buffer[_0xd883('0x3a')](_0x1ac879['audioContent'],_0xd883('0x2c'));return fs['writeFile'](_0x411503,_0x186f02,function(_0x50da74){_0x38f878(_0x50da74);},function(_0x200bd5){fs[_0xd883('0x2e')](_0x411503,_0xd883('0x2f'));_0x258d19(_0x200bd5);});});})['then'](function(_0x46f7f7){_0x3cd068=path['resolve'](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+'.wav');return convertFile(_0x411503,_0x3cd068);})[_0xd883('0x2d')](function(){try{fs[_0xd883('0x1f')](_0x411503);fs['chmodSync'](_0x3cd068,_0xd883('0x2f'));}catch(_0x326e1f){logger[_0xd883('0x17')](_0x326e1f);}logger[_0xd883('0x1d')](_0xd883('0x3b'),_0x3cd068[_0xd883('0x30')]('.')[0x0]);return _0x3cd068[_0xd883('0x30')]('.')[0x0];});};exports[_0xd883('0x3c')]=function(_0xfc38e4,_0x2332ee){var _0x1f7e5b=_0xd883('0x3d');var _0x453ccb,_0x5d0644;var _0x265945;var _0x430c20={'encoding':_0xd883('0x3e'),'method':_0xd883('0x37'),'timeout':0x2710,'url':_0x1f7e5b,'headers':{'Content-Type':_0xd883('0x3f')},'body':_0xd883('0x40')+encodeURIComponent(JSON[_0xd883('0x41')]([[[_0xd883('0x42'),JSON[_0xd883('0x41')]([_0xfc38e4,_0x2332ee||'en',![],'null']),null,_0xd883('0x43')]]]))};return rp(_0x430c20)[_0xd883('0x2d')](function(_0x1c2a7b){try{_0x265945=eval(_0x1c2a7b['slice'](0x5))[0x0][0x2];}catch(_0x577ce2){throw new Error(_0xd883('0x44')+_0x1c2a7b[_0xd883('0x24')]);}if(!_0x265945){if(_0xfc38e4[_0xd883('0x45')]>0xc8){throw new Error(_0xd883('0x46'));}else{throw new Error(_0xd883('0x47')+_0x2332ee+'\x22\x20might\x20not\x20exist');}}try{_0x265945=eval(_0x265945)[0x0];}catch(_0x17974e){throw new Error(_0xd883('0x44')+res['data']);}const _0x149506=_0x265945;_0x453ccb=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+'.mp3');fs[_0xd883('0x2b')](_0x453ccb,_0x265945,{'encoding':_0xd883('0x2c')});_0x5d0644=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+_0xd883('0x2a'));return convertFile(_0x453ccb,_0x5d0644);})[_0xd883('0x2d')](function(){try{fs['unlink'](_0x453ccb);fs[_0xd883('0x2e')](_0x5d0644,'777');}catch(_0x4e27e7){logger['error'](_0x4e27e7);}logger[_0xd883('0x1d')]('goggleTTS\x20path',_0x5d0644[_0xd883('0x30')]('.')[0x0]);return _0x5d0644[_0xd883('0x30')]('.')[0x0];});};exports[_0xd883('0x48')]=function(_0x215ab6,_0x2a7f36,_0x5b1d69){return google[_0xd883('0x49')](_0x215ab6,_0x2a7f36,_0x5b1d69)[_0xd883('0x2d')](function(_0x370a2d){logger[_0xd883('0x1d')](_0x370a2d[_0xd883('0x4a')]);return rp(_0x370a2d);})[_0xd883('0x2d')](function(_0x145b89){var _0x29af46='';var _0x5eaeb1=0x0;try{fs[_0xd883('0x1f')](_0x215ab6);}catch(_0x497c18){logger[_0xd883('0x17')](_0x497c18);}if(_0x145b89&&_0x145b89[_0xd883('0x4b')]){_0x29af46=_0x145b89[_0xd883('0x4b')][_0xd883('0x4c')](function(_0x4e68e4){return _0x4e68e4&&_0x4e68e4['alternatives'][0x0]&&_0x4e68e4['alternatives'][0x0]['transcript']?_0x4e68e4[_0xd883('0x4d')][0x0][_0xd883('0x4e')]:'';})['join']('\x0a');_0x5eaeb1=_0x145b89[_0xd883('0x4b')][_0xd883('0x4c')](function(_0x1b83c4){return _0x1b83c4&&_0x1b83c4[_0xd883('0x4d')][0x0]&&_0x1b83c4[_0xd883('0x4d')][0x0]['confidence']?_0x1b83c4[_0xd883('0x4d')][0x0][_0xd883('0x4f')]:0x0;})['join']('\x0a');}logger['info'](_0xd883('0x50'),_0x29af46);logger['info'](_0xd883('0x51'),_0x5eaeb1);return{'transcript':_0x29af46,'confidence':_0x5eaeb1};})[_0xd883('0x52')](function(_0x471608){logger[_0xd883('0x17')](_0xd883('0x53'),_0x471608['statusCode'],_0x471608[_0xd883('0x54')],_0x471608[_0xd883('0x55')]);});};exports[_0xd883('0x56')]=function(_0x3f4597,_0x16b896,_0x463b87,_0x49d010){var _0x384205=apiai(_0x16b896,{'language':_0x49d010||'en'});return _0x384205[_0xd883('0x57')](_0x463b87,{'sessionId':md5(_0x3f4597)})[_0xd883('0x2d')](function(_0x37e718){logger[_0xd883('0x1d')](JSON[_0xd883('0x41')](_0x37e718));return{'source':_0x37e718[_0xd883('0x58')][_0xd883('0x59')],'resolvedQuery':_0x37e718[_0xd883('0x58')][_0xd883('0x5a')],'action':_0x37e718[_0xd883('0x58')]['action'],'actionIncomplete':_0x37e718['result']['actionIncomplete'],'speech':_0x37e718[_0xd883('0x58')][_0xd883('0x5b')]['speech'],'score':_0x37e718[_0xd883('0x58')][_0xd883('0x5c')],'statusCode':_0x37e718[_0xd883('0x5d')]['code'],'endConversation':_0x37e718[_0xd883('0x58')][_0xd883('0x5e')]['endConversation']||![],'isFallbackIntent':_0x37e718['result'][_0xd883('0x5e')]['isFallbackIntent']};});};exports[_0xd883('0x5f')]=function(_0x3f695d,_0x329b55,_0x483534,_0x46221c,_0x2a5ce5,_0x53ade7){var _0x32feaa=_0x46221c[_0xd883('0x60')](/\\n/g,'\x0a');var _0x5c50ea={'credentials':{'private_key':_0x32feaa,'client_email':_0x483534}};var _0x43565c=new dialogflow[(_0xd883('0x61'))](_0x5c50ea);var _0x3f5e5d=_0x43565c[_0xd883('0x62')](_0x329b55,md5(_0x3f695d));var _0x54f827={'session':_0x3f5e5d,'queryInput':{'text':{'text':_0x2a5ce5,'languageCode':_0x53ade7}}};return _0x43565c[_0xd883('0x63')](_0x54f827)['then'](function(_0xc33163){if(_0xc33163&&_0xc33163[_0xd883('0x45')]){logger[_0xd883('0x1d')](_0xd883('0x64'),JSON[_0xd883('0x41')](_0xc33163));var _0x4dbd32=_0xc33163[0x0];if(_0x4dbd32){var _0x4d9756={'action':_0x4dbd32[_0xd883('0x65')]['action'],'allRequiredParamsPresent':_0x4dbd32[_0xd883('0x65')][_0xd883('0x66')],'endConversation':_0x4dbd32[_0xd883('0x65')][_0xd883('0x67')]&&_0x4dbd32[_0xd883('0x65')][_0xd883('0x67')][_0xd883('0x68')]?_0x4dbd32[_0xd883('0x65')][_0xd883('0x67')][_0xd883('0x68')][_0xd883('0x69')][_0xd883('0x6a')]:![],'fulfillmentText':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6b')],'intentName':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6c')]['name'],'intentDisplayName':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6c')]['displayName'],'isFallbackIntent':_0x4dbd32['queryResult']['intent'][_0xd883('0x6d')],'languageCode':_0x4dbd32[_0xd883('0x65')][_0xd883('0x6e')],'queryText':_0x4dbd32[_0xd883('0x65')]['queryText'],'responseId':_0x4dbd32[_0xd883('0x6f')],'score':_0x4dbd32[_0xd883('0x65')][_0xd883('0x70')],'speech':_0x4dbd32[_0xd883('0x65')]['fulfillmentText'],'providerResponse':JSON[_0xd883('0x41')](_0xc33163)};return _0x4d9756;}}});};exports[_0xd883('0x71')]=function(_0x332f10,_0x583519,_0x1b8b58,_0x14ceb5){return tilde[_0xd883('0x49')](_0x332f10,_0x583519,_0x1b8b58,_0x14ceb5)[_0xd883('0x2d')](function(_0xb91292){try{fs[_0xd883('0x1f')](_0x332f10);}catch(_0x2b4a2f){logger[_0xd883('0x17')](_0x2b4a2f);}logger['info'](_0xd883('0x72'),_0xb91292['transcript']);logger[_0xd883('0x1d')](_0xd883('0x73'),_0xb91292[_0xd883('0x4f')]);return _0xb91292;});};exports['awsPolly']=function(_0x49c881,_0x4cb6f4,_0x3874ce,_0x52669e,_0x2e032b,_0x20a7f4){var _0x118555=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+_0xd883('0x39'));var _0x5b4378;return aws['polly'](_0x49c881,_0x4cb6f4,_0x3874ce,_0x52669e,_0x2e032b,_0x20a7f4,_0x118555)[_0xd883('0x2d')](function(){_0x5b4378=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+'.wav');return convertFile(_0x118555,_0x5b4378);})[_0xd883('0x2d')](function(){try{fs['unlink'](_0x118555);fs[_0xd883('0x2e')](_0x5b4378,_0xd883('0x2f'));}catch(_0x5d41aa){logger[_0xd883('0x17')](_0x5d41aa);}return _0x5b4378[_0xd883('0x30')]('.')[0x0];});};exports[_0xd883('0x74')]=function(_0x382c91,_0x416365,_0x38903c,_0x2ef794,_0x355105,_0x445441){return aws[_0xd883('0x75')](_0x382c91,_0x416365,_0x38903c,_0x2ef794,_0x355105,_0x445441)[_0xd883('0x2d')](function(_0x385304){logger[_0xd883('0x1d')](JSON[_0xd883('0x41')](_0x385304));return _0x385304;});};exports[_0xd883('0x76')]=function(_0x5fc39d,_0x40c931,_0x1d6c33,_0xd84e6b){var _0x521c0b=util['format'](_0xd883('0x77'),ISPEECH_API,_0x5fc39d,encodeURIComponent(_0x40c931),_0x1d6c33,_0xd84e6b);var _0xc63adf=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+_0xd883('0x39'));var _0x42169d;return downloadFile(_0x521c0b,_0xc63adf)[_0xd883('0x2d')](function(){_0x42169d=path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs[_0xd883('0x29')](0x4)+_0xd883('0x2a'));return convertFile(_0xc63adf,_0x42169d);})[_0xd883('0x2d')](function(){try{fs['unlink'](_0xc63adf);fs[_0xd883('0x2e')](_0x42169d,_0xd883('0x2f'));}catch(_0x106aab){logger[_0xd883('0x17')](_0x106aab);}return _0x42169d['split']('.')[0x0];});};exports[_0xd883('0x78')]=function(_0x1090a1,_0x4c82bb,_0x52b53a,_0x3fa369){var _0x1bf668=util[_0xd883('0x79')](_0xd883('0x7a'),ISPEECH_API,_0x4c82bb,_0x52b53a,base64Encode(_0x1090a1),_0x3fa369?util[_0xd883('0x79')](_0xd883('0x7b'),encodeURIComponent(_0x3fa369)):_0xd883('0x7c'));return uploadFile(_0x1bf668)[_0xd883('0x2d')](function(_0x22d783){return querystring[_0xd883('0xa')](_0x22d783);});};exports[_0xd883('0x7d')]=function(_0x117a09,_0x337acd){return sestek['nda'](_0x117a09,_0x337acd)[_0xd883('0x2d')](function(_0x144a65){logger['info'](JSON['stringify'](_0x144a65));var _0x9a439a={'speech':_0x144a65[_0xd883('0x7e')],'action':_0x144a65[_0xd883('0x7f')]?_0x144a65[_0xd883('0x7f')]['CustomAction']:undefined,'actiondata':_0x144a65[_0xd883('0x7f')]?_0x144a65[_0xd883('0x7f')]['CustomActionData']:undefined};if(_0x144a65['channelData']&&_0x144a65[_0xd883('0x7f')][_0xd883('0x80')]){return base64Decode(_0x144a65[_0xd883('0x7f')]['AudioFromTts'][_0xd883('0x81')],path[_0xd883('0x28')](__dirname,_0xd883('0x38'),rs['generate'](0x4)+_0xd883('0x2a')))[_0xd883('0x2d')](function(_0x24213e){_0x9a439a[_0xd883('0x82')]=_0x24213e;return _0x9a439a;});}return _0x9a439a;});};exports[_0xd883('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x4f34=['transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','stringify','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','https:','\x20failed,\x20status\x20code\x20=\x20','transcode','wav','finish\x20to\x20convert','resolve','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','voice','audioConfig','POST','tmp','.mp3','from','writeFile','googleCloudTTS\x20path','application/x-www-form-urlencoded','f.req=','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives'];(function(_0x445e0d,_0x581182){var _0xdc2ab=function(_0x14a550){while(--_0x14a550){_0x445e0d['push'](_0x445e0d['shift']());}};_0xdc2ab(++_0x581182);}(_0x4f34,0xb2));var _0x44f3=function(_0x333b26,_0x241001){_0x333b26=_0x333b26-0x0;var _0x2c7ff9=_0x4f34[_0x333b26];return _0x2c7ff9;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x44f3('0x0'));var fs=require('fs');var http=require(_0x44f3('0x1'));var https=require(_0x44f3('0x2'));var md5=require(_0x44f3('0x3'));var path=require(_0x44f3('0x4'));var querystring=require(_0x44f3('0x5'));var rp=require(_0x44f3('0x6'));var rs=require('randomstring');var sox=require(_0x44f3('0x7'));var tts=require(_0x44f3('0x8'));var urlParse=require(_0x44f3('0x9'))['parse'];var util=require(_0x44f3('0xa'));var aws=require(_0x44f3('0xb'));var google=require(_0x44f3('0xc'));var sestek=require(_0x44f3('0xd'));var tilde=require(_0x44f3('0xe'));var logger=require('../../../config/logger')(_0x44f3('0xf'));var ISPEECH_API=_0x44f3('0x10');function downloadFile(_0x37a211,_0x4f0c9f){return new BPromise(function(_0x572e8d,_0x493dad){var _0x3c5fe4=urlParse(_0x37a211);var _0x3f3296=_0x3c5fe4['protocol']==='https:'?https:http;var _0x5bee28={'host':_0x3c5fe4[_0x44f3('0x11')],'path':_0x3c5fe4[_0x44f3('0x4')],'headers':{'user-agent':_0x44f3('0x12')}};_0x3f3296[_0x44f3('0x13')](_0x5bee28,function(_0x441fa6){if(_0x441fa6[_0x44f3('0x14')]!==0xc8){logger[_0x44f3('0x15')](_0x44f3('0x16')+_0x37a211+'\x20failed,\x20status\x20code\x20=\x20'+_0x441fa6[_0x44f3('0x14')]+'\x20('+_0x441fa6[_0x44f3('0x17')]+')');_0x493dad(new Error('request\x20to\x20'+_0x37a211+'\x20failed,\x20status\x20code\x20=\x20'+_0x441fa6[_0x44f3('0x14')]+'\x20('+_0x441fa6[_0x44f3('0x17')]+')'));return;}var _0x1a82ea=fs['createWriteStream'](_0x4f0c9f);_0x1a82ea['on']('finish',function(){logger[_0x44f3('0x18')](_0x44f3('0x19'));_0x1a82ea['close'](_0x572e8d);});_0x1a82ea['on'](_0x44f3('0x15'),function(_0x7175ae){fs[_0x44f3('0x1a')](_0x4f0c9f);logger[_0x44f3('0x15')](_0x44f3('0x1b'),_0x7175ae);_0x493dad(_0x7175ae);});_0x441fa6[_0x44f3('0x1c')](_0x1a82ea);})['on'](_0x44f3('0x15'),function(_0x510b38){logger[_0x44f3('0x15')](_0x510b38);_0x493dad(_0x510b38);})[_0x44f3('0x1d')]();});}function uploadFile(_0x1f8063){return new BPromise(function(_0x179519,_0x6b2bfa){var _0x2b1f4b=urlParse(_0x1f8063);var _0x5d13bc=_0x2b1f4b['protocol']===_0x44f3('0x1e')?https:http;var _0xc173f6={'host':_0x2b1f4b['host'],'path':_0x2b1f4b[_0x44f3('0x4')],'headers':{'user-agent':_0x44f3('0x12')}};_0x5d13bc[_0x44f3('0x13')](_0xc173f6,function(_0x55b710){if(_0x55b710[_0x44f3('0x14')]!==0xc8){_0x6b2bfa(new Error(_0x44f3('0x16')+_0x1f8063+_0x44f3('0x1f')+_0x55b710[_0x44f3('0x14')]+'\x20('+_0x55b710[_0x44f3('0x17')]+')'));return;}var _0xbb7230='';_0x55b710['on']('data',function(_0x132fa7){_0xbb7230+=_0x132fa7;});_0x55b710['on'](_0x44f3('0x1d'),function(){_0x179519(_0xbb7230);});})['on'](_0x44f3('0x15'),function(_0x2e846b){_0x6b2bfa(_0x2e846b);})[_0x44f3('0x1d')]();});}function convertFile(_0x2de48c,_0xc5a069){return new BPromise(function(_0x33d1b8,_0x18be83){var _0x4307b9=sox[_0x44f3('0x20')](_0x2de48c,_0xc5a069,{'sampleRate':0x1f40,'format':_0x44f3('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4307b9['on'](_0x44f3('0x15'),function(_0x543b07){logger[_0x44f3('0x15')]('error\x20convert',_0x543b07);_0x18be83(_0x543b07);});_0x4307b9['on'](_0x44f3('0x1d'),function(){logger['info'](_0x44f3('0x22'));_0x33d1b8();});_0x4307b9['start']();});}function base64Decode(_0x288dc5,_0x3c0919){var _0x118567=path[_0x44f3('0x23')](__dirname,'tmp',rs[_0x44f3('0x24')](0x4)+'.wav');fs[_0x44f3('0x25')](_0x118567,_0x288dc5,_0x44f3('0x26'));return convertFile(_0x118567,_0x3c0919)[_0x44f3('0x27')](function(){try{fs[_0x44f3('0x1a')](_0x118567);fs[_0x44f3('0x28')](_0x3c0919,_0x44f3('0x29'));}catch(_0x493858){logger[_0x44f3('0x15')](_0x493858);}return _0x3c0919[_0x44f3('0x2a')]('.')[0x0];});}function base64Encode(_0x4c9e7f){var _0xddd0d=fs[_0x44f3('0x2b')](_0x4c9e7f);return new Buffer(_0xddd0d)['toString']('base64');}exports[_0x44f3('0x2c')]=function(_0x1cc196,_0xc4b4d8,_0x220f1b,_0x3ed44b,_0x357586,_0x275c4d){var _0x1a4f34,_0x34c765;var _0x538eca=_0x44f3('0x2d');var _0x3c96af='?key='+_0x1cc196;var _0x563468={};if(_0xc4b4d8===_0x44f3('0x2e')){_0x563468['input']={'ssml':_0x220f1b};}else{_0x563468['input']={'text':_0x220f1b};};_0x563468[_0x44f3('0x2f')]={'languageCode':_0x3ed44b,'ssmlGender':_0x357586};_0x563468[_0x44f3('0x30')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4f6618={'url':_0x538eca+'text:synthesize'+_0x3c96af,'method':_0x44f3('0x31'),'json':!![],'body':_0x563468};return rp(_0x4f6618)[_0x44f3('0x27')](function(_0x184c15){return new BPromise(function(_0x263ec8,_0x39e03f){_0x1a4f34=path['resolve'](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x33'));var _0x5ef9f4=Buffer[_0x44f3('0x34')](_0x184c15['audioContent'],'base64');return fs[_0x44f3('0x35')](_0x1a4f34,_0x5ef9f4,function(_0x119d71){_0x39e03f(_0x119d71);},function(_0x1ced5e){fs['chmodSync'](_0x1a4f34,'777');_0x263ec8(_0x1ced5e);});});})[_0x44f3('0x27')](function(_0x236f7a){_0x34c765=path[_0x44f3('0x23')](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+'.wav');return convertFile(_0x1a4f34,_0x34c765);})[_0x44f3('0x27')](function(){try{fs[_0x44f3('0x1a')](_0x1a4f34);fs['chmodSync'](_0x34c765,_0x44f3('0x29'));}catch(_0x3f82db){logger[_0x44f3('0x15')](_0x3f82db);}logger[_0x44f3('0x18')](_0x44f3('0x36'),_0x34c765['split']('.')[0x0]);return _0x34c765[_0x44f3('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x475e59,_0x40178d){var _0x463c36='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x2653e0,_0x26221c;var _0x4fb9e2;var _0xad551a={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x463c36,'headers':{'Content-Type':_0x44f3('0x37')},'body':_0x44f3('0x38')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON['stringify']([_0x475e59,_0x40178d||'en',![],_0x44f3('0x39')]),null,'generic']]]))};return rp(_0xad551a)['then'](function(_0x221b81){try{_0x4fb9e2=eval(_0x221b81['slice'](0x5))[0x0][0x2];}catch(_0x170188){throw new Error(_0x44f3('0x3a')+_0x221b81[_0x44f3('0x3b')]);}if(!_0x4fb9e2){if(_0x475e59[_0x44f3('0x3c')]>0xc8){throw new Error(_0x44f3('0x3d'));}else{throw new Error(_0x44f3('0x3e')+_0x40178d+_0x44f3('0x3f'));}}try{_0x4fb9e2=eval(_0x4fb9e2)[0x0];}catch(_0x504ab6){throw new Error(_0x44f3('0x3a')+res[_0x44f3('0x3b')]);}const _0x16e6e4=_0x4fb9e2;_0x2653e0=path[_0x44f3('0x23')](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x33'));fs[_0x44f3('0x25')](_0x2653e0,_0x4fb9e2,{'encoding':_0x44f3('0x26')});_0x26221c=path[_0x44f3('0x23')](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x40'));return convertFile(_0x2653e0,_0x26221c);})[_0x44f3('0x27')](function(){try{fs[_0x44f3('0x1a')](_0x2653e0);fs['chmodSync'](_0x26221c,_0x44f3('0x29'));}catch(_0x2e1cba){logger[_0x44f3('0x15')](_0x2e1cba);}logger[_0x44f3('0x18')](_0x44f3('0x41'),_0x26221c['split']('.')[0x0]);return _0x26221c[_0x44f3('0x2a')]('.')[0x0];});};exports[_0x44f3('0x42')]=function(_0x322b1c,_0x2bd5c9,_0x193055){return google[_0x44f3('0x43')](_0x322b1c,_0x2bd5c9,_0x193055)[_0x44f3('0x27')](function(_0x3fb9f1){logger[_0x44f3('0x18')](_0x3fb9f1[_0x44f3('0x44')]);return rp(_0x3fb9f1);})[_0x44f3('0x27')](function(_0x4338e6){var _0x19562d='';var _0x3f578b=0x0;try{fs[_0x44f3('0x1a')](_0x322b1c);}catch(_0x44e9f9){logger[_0x44f3('0x15')](_0x44e9f9);}if(_0x4338e6&&_0x4338e6[_0x44f3('0x45')]){_0x19562d=_0x4338e6[_0x44f3('0x45')][_0x44f3('0x46')](function(_0x421c12){return _0x421c12&&_0x421c12[_0x44f3('0x47')][0x0]&&_0x421c12[_0x44f3('0x47')][0x0][_0x44f3('0x48')]?_0x421c12[_0x44f3('0x47')][0x0][_0x44f3('0x48')]:'';})['join']('\x0a');_0x3f578b=_0x4338e6[_0x44f3('0x45')][_0x44f3('0x46')](function(_0x2243a1){return _0x2243a1&&_0x2243a1[_0x44f3('0x47')][0x0]&&_0x2243a1['alternatives'][0x0][_0x44f3('0x49')]?_0x2243a1[_0x44f3('0x47')][0x0][_0x44f3('0x49')]:0x0;})['join']('\x0a');}logger['info'](_0x44f3('0x4a'),_0x19562d);logger[_0x44f3('0x18')](_0x44f3('0x4b'),_0x3f578b);return{'transcript':_0x19562d,'confidence':_0x3f578b};})[_0x44f3('0x4c')](function(_0x9d214a){logger[_0x44f3('0x15')](_0x44f3('0x4d'),_0x9d214a[_0x44f3('0x14')],_0x9d214a[_0x44f3('0x4e')],_0x9d214a['message']);});};exports[_0x44f3('0x4f')]=function(_0x3222b8,_0x20491d,_0x5c480c,_0x333c0e){var _0x1f0c92=apiai(_0x20491d,{'language':_0x333c0e||'en'});return _0x1f0c92[_0x44f3('0x50')](_0x5c480c,{'sessionId':md5(_0x3222b8)})['then'](function(_0x2b3ee1){logger[_0x44f3('0x18')](JSON['stringify'](_0x2b3ee1));return{'source':_0x2b3ee1[_0x44f3('0x51')]['source'],'resolvedQuery':_0x2b3ee1[_0x44f3('0x51')][_0x44f3('0x52')],'action':_0x2b3ee1[_0x44f3('0x51')][_0x44f3('0x53')],'actionIncomplete':_0x2b3ee1['result'][_0x44f3('0x54')],'speech':_0x2b3ee1[_0x44f3('0x51')]['fulfillment']['speech'],'score':_0x2b3ee1[_0x44f3('0x51')]['score'],'statusCode':_0x2b3ee1[_0x44f3('0x55')][_0x44f3('0x56')],'endConversation':_0x2b3ee1[_0x44f3('0x51')]['metadata'][_0x44f3('0x57')]||![],'isFallbackIntent':_0x2b3ee1[_0x44f3('0x51')][_0x44f3('0x58')][_0x44f3('0x59')]};});};exports[_0x44f3('0x5a')]=function(_0x2e3c1e,_0x2f8d1f,_0x226d1e,_0x59c58f,_0x45c9c2,_0x2b0106){var _0x1cbcf2=_0x59c58f['replace'](/\\n/g,'\x0a');var _0x45a13d={'credentials':{'private_key':_0x1cbcf2,'client_email':_0x226d1e}};var _0x23855d=new dialogflow[(_0x44f3('0x5b'))](_0x45a13d);var _0x13e390=_0x23855d['sessionPath'](_0x2f8d1f,md5(_0x2e3c1e));var _0x255350={'session':_0x13e390,'queryInput':{'text':{'text':_0x45c9c2,'languageCode':_0x2b0106}}};return _0x23855d[_0x44f3('0x5c')](_0x255350)[_0x44f3('0x27')](function(_0x167689){if(_0x167689&&_0x167689[_0x44f3('0x3c')]){logger[_0x44f3('0x18')](_0x44f3('0x5d'),JSON[_0x44f3('0x5e')](_0x167689));var _0x1cb7f0=_0x167689[0x0];if(_0x1cb7f0){var _0x41b337={'action':_0x1cb7f0[_0x44f3('0x5f')]['action'],'allRequiredParamsPresent':_0x1cb7f0[_0x44f3('0x5f')][_0x44f3('0x60')],'endConversation':_0x1cb7f0['queryResult'][_0x44f3('0x61')]&&_0x1cb7f0['queryResult'][_0x44f3('0x61')][_0x44f3('0x62')]?_0x1cb7f0[_0x44f3('0x5f')][_0x44f3('0x61')][_0x44f3('0x62')][_0x44f3('0x63')][_0x44f3('0x64')]:![],'fulfillmentText':_0x1cb7f0[_0x44f3('0x5f')]['fulfillmentText'],'intentName':_0x1cb7f0[_0x44f3('0x5f')][_0x44f3('0x65')][_0x44f3('0x4e')],'intentDisplayName':_0x1cb7f0[_0x44f3('0x5f')][_0x44f3('0x65')][_0x44f3('0x66')],'isFallbackIntent':_0x1cb7f0['queryResult'][_0x44f3('0x65')]['isFallback'],'languageCode':_0x1cb7f0['queryResult']['languageCode'],'queryText':_0x1cb7f0[_0x44f3('0x5f')]['queryText'],'responseId':_0x1cb7f0['responseId'],'score':_0x1cb7f0[_0x44f3('0x5f')][_0x44f3('0x67')],'speech':_0x1cb7f0[_0x44f3('0x5f')][_0x44f3('0x68')],'providerResponse':JSON[_0x44f3('0x5e')](_0x167689)};return _0x41b337;}}});};exports['tildeASR']=function(_0x41185e,_0x1867a6,_0x1b06aa,_0x44a540){return tilde[_0x44f3('0x43')](_0x41185e,_0x1867a6,_0x1b06aa,_0x44a540)[_0x44f3('0x27')](function(_0x15613b){try{fs['unlink'](_0x41185e);}catch(_0x43ec6b){logger[_0x44f3('0x15')](_0x43ec6b);}logger['info'](_0x44f3('0x69'),_0x15613b[_0x44f3('0x48')]);logger[_0x44f3('0x18')](_0x44f3('0x6a'),_0x15613b[_0x44f3('0x49')]);return _0x15613b;});};exports[_0x44f3('0x6b')]=function(_0x26ba68,_0x59b3e7,_0x3bbfea,_0x48cfea,_0x3e426b,_0x5b8061){var _0x128a88=path['resolve'](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x33'));var _0x10ecfd;return aws[_0x44f3('0x6c')](_0x26ba68,_0x59b3e7,_0x3bbfea,_0x48cfea,_0x3e426b,_0x5b8061,_0x128a88)['then'](function(){_0x10ecfd=path[_0x44f3('0x23')](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x40'));return convertFile(_0x128a88,_0x10ecfd);})[_0x44f3('0x27')](function(){try{fs[_0x44f3('0x1a')](_0x128a88);fs[_0x44f3('0x28')](_0x10ecfd,_0x44f3('0x29'));}catch(_0x2ec8e4){logger[_0x44f3('0x15')](_0x2ec8e4);}return _0x10ecfd[_0x44f3('0x2a')]('.')[0x0];});};exports[_0x44f3('0x6d')]=function(_0x2950ba,_0x48f4a3,_0x1b1177,_0x58fb6e,_0x3ff2a4,_0x2e0090){return aws[_0x44f3('0x6e')](_0x2950ba,_0x48f4a3,_0x1b1177,_0x58fb6e,_0x3ff2a4,_0x2e0090)['then'](function(_0x5d0cc5){logger['info'](JSON[_0x44f3('0x5e')](_0x5d0cc5));return _0x5d0cc5;});};exports['ispeechTTS']=function(_0xd2cbbc,_0x240673,_0x2a2093,_0x4ac5e2){var _0x29cb94=util['format'](_0x44f3('0x6f'),ISPEECH_API,_0xd2cbbc,encodeURIComponent(_0x240673),_0x2a2093,_0x4ac5e2);var _0x306991=path[_0x44f3('0x23')](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x33'));var _0xb045ed;return downloadFile(_0x29cb94,_0x306991)[_0x44f3('0x27')](function(){_0xb045ed=path[_0x44f3('0x23')](__dirname,_0x44f3('0x32'),rs[_0x44f3('0x24')](0x4)+_0x44f3('0x40'));return convertFile(_0x306991,_0xb045ed);})[_0x44f3('0x27')](function(){try{fs[_0x44f3('0x1a')](_0x306991);fs[_0x44f3('0x28')](_0xb045ed,'777');}catch(_0x4c15ee){logger[_0x44f3('0x15')](_0x4c15ee);}return _0xb045ed[_0x44f3('0x2a')]('.')[0x0];});};exports[_0x44f3('0x70')]=function(_0x396c76,_0x187b95,_0x179972,_0xb2cf64){var _0x281b81=util[_0x44f3('0x71')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x187b95,_0x179972,base64Encode(_0x396c76),_0xb2cf64?util[_0x44f3('0x71')](_0x44f3('0x72'),encodeURIComponent(_0xb2cf64)):_0x44f3('0x73'));return uploadFile(_0x281b81)[_0x44f3('0x27')](function(_0x3d3d8d){return querystring['parse'](_0x3d3d8d);});};exports[_0x44f3('0x74')]=function(_0x1e8f6d,_0xd3cdc0){return sestek[_0x44f3('0x75')](_0x1e8f6d,_0xd3cdc0)[_0x44f3('0x27')](function(_0x32aed9){logger[_0x44f3('0x18')](JSON['stringify'](_0x32aed9));var _0x1bdd2c={'speech':_0x32aed9[_0x44f3('0x76')],'action':_0x32aed9[_0x44f3('0x77')]?_0x32aed9[_0x44f3('0x77')][_0x44f3('0x78')]:undefined,'actiondata':_0x32aed9[_0x44f3('0x77')]?_0x32aed9[_0x44f3('0x77')][_0x44f3('0x79')]:undefined};if(_0x32aed9[_0x44f3('0x77')]&&_0x32aed9[_0x44f3('0x77')]['AudioFromTts']){return base64Decode(_0x32aed9[_0x44f3('0x77')][_0x44f3('0x7a')]['Data'],path[_0x44f3('0x23')](__dirname,'tmp',rs[_0x44f3('0x24')](0x4)+_0x44f3('0x40')))[_0x44f3('0x27')](function(_0xfd7bfc){_0x1bdd2c[_0x44f3('0x7b')]=_0xfd7bfc;return _0x1bdd2c;});}return _0x1bdd2c;});};exports[_0x44f3('0x7c')]=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 a2ca2a0..30f9067 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 _0x7a8c=['./nda'];(function(_0xe7693c,_0x3faab7){var _0x5e6a1e=function(_0x113c68){while(--_0x113c68){_0xe7693c['push'](_0xe7693c['shift']());}};_0x5e6a1e(++_0x3faab7);}(_0x7a8c,0x7d));var _0xc7a8=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7a8c[_0x4fde08];return _0x12e725;};var nda=require(_0xc7a8('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xaa18=['exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaa18,0x109));var _0x8aa1=function(_0x2a40ca,_0x271fe8){_0x2a40ca=_0x2a40ca-0x0;var _0x2937dd=_0xaa18[_0x2a40ca];return _0x2937dd;};var nda=require('./nda');module[_0x8aa1('0x0')]={'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 86136a2..d52bcf8 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 _0x8d08=['stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','calleridname','extension','text','Bearer\x20','channelData','ProjectName','project','AudioOutputSettings','audio/wav','body','CustomAction','custom_action','CustomActionData','custom_action_data'];(function(_0x1158c6,_0x50b140){var _0x203075=function(_0x28cb4b){while(--_0x28cb4b){_0x1158c6['push'](_0x1158c6['shift']());}};_0x203075(++_0x50b140);}(_0x8d08,0x118));var _0x88d0=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x8d08[_0x42d1f8];return _0x40d234;};'use strict';var rp=require(_0x88d0('0x0'));var url=require(_0x88d0('0x1'));var logger=require(_0x88d0('0x2'))(_0x88d0('0x3'));module[_0x88d0('0x4')]=function(_0x2c31dd,_0x371bdb){var _0x2f99b6={'method':_0x88d0('0x5'),'uri':url[_0x88d0('0x6')](_0x371bdb[_0x88d0('0x7')],_0x88d0('0x8')),'form':{'grant_type':'password','username':_0x371bdb[_0x88d0('0x9')],'password':_0x371bdb[_0x88d0('0xa')]},'json':!![]};return rp(_0x2f99b6)['then'](function(_0x42ceda){var _0x511c4a={'method':_0x88d0('0x5'),'uri':url['resolve'](_0x371bdb[_0x88d0('0xb')],_0x88d0('0xc')),'body':{'type':_0x371bdb[_0x88d0('0xd')]||'message','channelId':_0x88d0('0xe'),'conversation':{'id':_0x2c31dd[_0x88d0('0xf')]},'from':{'id':_0x2c31dd['callerid'],'name':_0x2c31dd[_0x88d0('0x10')]},'recipient':{'id':_0x2c31dd['dnid'],'name':_0x2c31dd[_0x88d0('0x11')]},'text':_0x371bdb[_0x88d0('0x12')],'channelData':{}},'headers':{'Authorization':_0x88d0('0x13')+_0x42ceda['access_token']},'json':!![]};if(_0x371bdb['project']){_0x511c4a['body'][_0x88d0('0x14')][_0x88d0('0x15')]=_0x371bdb[_0x88d0('0x16')];}if(_0x371bdb['ndagenerate_audio']=='1'){_0x511c4a['body']['channelData'][_0x88d0('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x88d0('0x18')};}if(_0x371bdb['custom_action']){_0x511c4a[_0x88d0('0x19')][_0x88d0('0x14')][_0x88d0('0x1a')]=_0x371bdb[_0x88d0('0x1b')];if(_0x371bdb['custom_action_data']){_0x511c4a[_0x88d0('0x19')][_0x88d0('0x14')][_0x88d0('0x1c')]=_0x371bdb[_0x88d0('0x1d')];}}logger['info'](JSON[_0x88d0('0x1e')](_0x511c4a));return rp(_0x511c4a);});}; \ No newline at end of file +var _0x4e83=['Nda','uniqueid','callerid','calleridname','dnid','text','access_token','project','body','channelData','ProjectName','AudioOutputSettings','custom_action','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x4e83,0x88));var _0x34e8=function(_0x5e745e,_0xde2931){_0x5e745e=_0x5e745e-0x0;var _0x122dab=_0x4e83[_0x5e745e];return _0x122dab;};'use strict';var rp=require('request-promise');var url=require(_0x34e8('0x0'));var logger=require(_0x34e8('0x1'))(_0x34e8('0x2'));module[_0x34e8('0x3')]=function(_0x5bec5b,_0x33b4e1){var _0x4550fd={'method':_0x34e8('0x4'),'uri':url[_0x34e8('0x5')](_0x33b4e1[_0x34e8('0x6')],_0x34e8('0x7')),'form':{'grant_type':_0x34e8('0x8'),'username':_0x33b4e1[_0x34e8('0x9')],'password':_0x33b4e1[_0x34e8('0x8')]},'json':!![]};return rp(_0x4550fd)[_0x34e8('0xa')](function(_0x188f11){var _0x18e178={'method':_0x34e8('0x4'),'uri':url['resolve'](_0x33b4e1[_0x34e8('0xb')],_0x34e8('0xc')),'body':{'type':_0x33b4e1[_0x34e8('0xd')]||'message','channelId':_0x34e8('0xe'),'conversation':{'id':_0x5bec5b[_0x34e8('0xf')]},'from':{'id':_0x5bec5b[_0x34e8('0x10')],'name':_0x5bec5b[_0x34e8('0x11')]},'recipient':{'id':_0x5bec5b[_0x34e8('0x12')],'name':_0x5bec5b['extension']},'text':_0x33b4e1[_0x34e8('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x188f11[_0x34e8('0x14')]},'json':!![]};if(_0x33b4e1[_0x34e8('0x15')]){_0x18e178[_0x34e8('0x16')][_0x34e8('0x17')][_0x34e8('0x18')]=_0x33b4e1[_0x34e8('0x15')];}if(_0x33b4e1['ndagenerate_audio']=='1'){_0x18e178[_0x34e8('0x16')]['channelData'][_0x34e8('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x33b4e1[_0x34e8('0x1a')]){_0x18e178[_0x34e8('0x16')][_0x34e8('0x17')]['CustomAction']=_0x33b4e1[_0x34e8('0x1a')];if(_0x33b4e1['custom_action_data']){_0x18e178[_0x34e8('0x16')][_0x34e8('0x17')][_0x34e8('0x1b')]=_0x33b4e1['custom_action_data'];}}logger[_0x34e8('0x1c')](JSON[_0x34e8('0x1d')](_0x18e178));return rp(_0x18e178);});}; \ 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 9928bb8..4c6b2ef 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf8e=['exports','./lib/api'];(function(_0x19223d,_0x4a5a7a){var _0x33e726=function(_0xe3bdca){while(--_0xe3bdca){_0x19223d['push'](_0x19223d['shift']());}};_0x33e726(++_0x4a5a7a);}(_0xdf8e,0x89));var _0xedf8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdf8e[_0x1facfa];return _0x9ec701;};'use strict';var asr=require(_0xedf8('0x0'));module[_0xedf8('0x1')]=function(_0x53f1ec,_0x81bef1,_0x19ad37,_0x2ef0ab){return asr(_0x53f1ec,_0x81bef1,_0x19ad37,_0x2ef0ab);}; \ No newline at end of file +var _0x3ed8=['exports','./lib/api'];(function(_0x36d8d9,_0x17b58a){var _0x1ac3a2=function(_0x392196){while(--_0x392196){_0x36d8d9['push'](_0x36d8d9['shift']());}};_0x1ac3a2(++_0x17b58a);}(_0x3ed8,0x191));var _0x83ed=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x3ed8[_0x5e238b];return _0x389bea;};'use strict';var asr=require(_0x83ed('0x0'));module[_0x83ed('0x1')]=function(_0x3fddf3,_0x29184b,_0x2f203d,_0x337814){return asr(_0x3fddf3,_0x29184b,_0x2f203d,_0x337814);}; \ 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 2a9411e..13c5531 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 _0xd710=['stringify','data','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x3b5f86,_0x1ce247){var _0x49d370=function(_0x14b5fe){while(--_0x14b5fe){_0x3b5f86['push'](_0x3b5f86['shift']());}};_0x49d370(++_0x1ce247);}(_0xd710,0x128));var _0x0d71=function(_0x2cc7c9,_0x27f605){_0x2cc7c9=_0x2cc7c9-0x0;var _0x2200a0=_0xd710[_0x2cc7c9];return _0x2200a0;};'use strict';var BPromise=require('bluebird');var _=require(_0x0d71('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x0d71('0x1'));var logger=require(_0x0d71('0x2'))(_0x0d71('0x3'));module[_0x0d71('0x4')]=function(_0x3e7a74,_0x480493,_0x18162e,_0x45c522){return new BPromise(function(_0x5ec686,_0x9b0bc5){logger[_0x0d71('0x5')](_0x0d71('0x6'),_0x45c522||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xa4df25=new WebSocket(_0x45c522||_0x0d71('0x7'),{'perMessageDeflate':![]});var _0x3483a8='';var _0x3d2057='0';var _0x499162='1';var _0x9391b6=_0x0d71('0x8');function _0x56dc01(_0x19e131){var _0x1cbe85=crypto[_0x0d71('0x9')]('sha1');_0x1cbe85[_0x0d71('0xa')](_0x19e131);return _0x1cbe85[_0x0d71('0xb')](_0x0d71('0xc'));}function _0x4c24dc(){try{logger['info'](_0x0d71('0xd'));var _0x50e003=moment()[_0x0d71('0xe')]();var _0x4a7e34=_0x56dc01(_0x50e003+_0x480493+_0x18162e);_0xa4df25[_0x0d71('0xf')](JSON[_0x0d71('0x10')]({'appID':_0x480493,'timestamp':_0x50e003,'appKey':_0x4a7e34}));var _0x4efdf8=fs['createReadStream'](_0x3e7a74);_0x4efdf8['on'](_0x0d71('0x11'),function(_0x1dc15f){_0xa4df25['send'](_0x1dc15f);});_0x4efdf8['on'](_0x0d71('0x12'),function(){_0xa4df25[_0x0d71('0xf')](_0x0d71('0x13'));});}catch(_0x29f6a0){logger[_0x0d71('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x0d71('0x10')](_0x29f6a0));_0xa4df25[_0x0d71('0x15')]();}}function _0x36d849(_0x829ab0){try{if(_0x829ab0){var _0x1ba553=JSON[_0x0d71('0x16')](_0x829ab0);switch(_0x1ba553[_0x0d71('0x17')]){case 0x0:if(_0x1ba553[_0x0d71('0x18')]){if(_0x1ba553['result'][_0x0d71('0x19')]){logger[_0x0d71('0x5')](_0x0d71('0x1a'),JSON[_0x0d71('0x10')](_0x1ba553['result'][_0x0d71('0x1b')]));_0x3483a8=_0x1ba553[_0x0d71('0x18')][_0x0d71('0x1b')][0x0][_0x0d71('0x1c')];_0x3d2057=_0x1ba553[_0x0d71('0x18')][_0x0d71('0x1b')][0x0][_0x0d71('0x1d')];_0x499162='0';_0x9391b6='Success.';_0xa4df25[_0x0d71('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x499162='1';_0x9391b6=_0x0d71('0x8');break;case 0x2:logger[_0x0d71('0x5')](_0x0d71('0x1e'));_0x499162='2';_0x9391b6=_0x0d71('0x1e');break;case 0x9:logger[_0x0d71('0x5')](_0x0d71('0x1f'));_0x499162='9';_0x9391b6=_0x0d71('0x1f');break;case 0xa:logger[_0x0d71('0x5')](_0x0d71('0x20'));_0x499162='10';_0x9391b6=_0x0d71('0x20');break;case 0xb:logger['info'](_0x0d71('0x21'));_0x499162='11';_0x9391b6=_0x0d71('0x21');}}}catch(_0x73aa0b){logger[_0x0d71('0x14')](_0x0d71('0x22'),JSON[_0x0d71('0x10')](_0x73aa0b));_0xa4df25['terminate']();}}function _0x1988ea(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x5ec686({'transcript':_0x3483a8,'confidence':_0x3d2057,'status':_0x499162,'status_message':_0x9391b6});}function _0x5dc8d4(_0x1214e7){logger['error'](_0x0d71('0x23'));if(!_['isNil'](_0x1214e7)){logger[_0x0d71('0x14')](_[_0x0d71('0x24')](_0x1214e7)?JSON[_0x0d71('0x10')](_0x1214e7):_0x1214e7);}}_0xa4df25['on'](_0x0d71('0x25'),_0x4c24dc);_0xa4df25['on'](_0x0d71('0x26'),_0x36d849);_0xa4df25['on'](_0x0d71('0x12'),_0x1988ea);_0xa4df25['on'](_0x0d71('0x14'),_0x5dc8d4);});}; \ No newline at end of file +var _0x00f8=['data','EOS','error','terminate','parse','status','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream'];(function(_0x5ee5af,_0x52369f){var _0x1fdd47=function(_0x906004){while(--_0x906004){_0x5ee5af['push'](_0x5ee5af['shift']());}};_0x1fdd47(++_0x52369f);}(_0x00f8,0xe6));var _0x800f=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x00f8[_0xa3463d];return _0x50fd67;};'use strict';var BPromise=require(_0x800f('0x0'));var _=require(_0x800f('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x800f('0x2'));var crypto=require(_0x800f('0x3'));var logger=require(_0x800f('0x4'))('agi');module['exports']=function(_0x49061f,_0x47cb76,_0x1edeb5,_0x428134){return new BPromise(function(_0x20d5f2,_0x4fb35c){logger[_0x800f('0x5')](_0x800f('0x6'),_0x428134||_0x800f('0x7'));var _0x2fe06a=new WebSocket(_0x428134||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4adc5c='';var _0x3747a9='0';var _0xf4d7e8='1';var _0xa75898='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x232b78(_0x24250b){var _0x2594c4=crypto[_0x800f('0x8')]('sha1');_0x2594c4[_0x800f('0x9')](_0x24250b);return _0x2594c4[_0x800f('0xa')]('hex');}function _0x4837c1(){try{logger[_0x800f('0x5')](_0x800f('0xb'));var _0x1087b7=moment()[_0x800f('0xc')]();var _0x491e60=_0x232b78(_0x1087b7+_0x47cb76+_0x1edeb5);_0x2fe06a[_0x800f('0xd')](JSON[_0x800f('0xe')]({'appID':_0x47cb76,'timestamp':_0x1087b7,'appKey':_0x491e60}));var _0x56ae9c=fs[_0x800f('0xf')](_0x49061f);_0x56ae9c['on'](_0x800f('0x10'),function(_0x189cef){_0x2fe06a[_0x800f('0xd')](_0x189cef);});_0x56ae9c['on']('close',function(){_0x2fe06a[_0x800f('0xd')](_0x800f('0x11'));});}catch(_0x5d4a20){logger[_0x800f('0x12')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x5d4a20));_0x2fe06a[_0x800f('0x13')]();}}function _0x5bbc3b(_0x3c4e2b){try{if(_0x3c4e2b){var _0x5a35ba=JSON[_0x800f('0x14')](_0x3c4e2b);switch(_0x5a35ba[_0x800f('0x15')]){case 0x0:if(_0x5a35ba['result']){if(_0x5a35ba['result']['final']){logger[_0x800f('0x5')](_0x800f('0x16'),JSON[_0x800f('0xe')](_0x5a35ba[_0x800f('0x17')][_0x800f('0x18')]));_0x4adc5c=_0x5a35ba[_0x800f('0x17')]['hypotheses'][0x0][_0x800f('0x19')];_0x3747a9=_0x5a35ba['result'][_0x800f('0x18')][0x0][_0x800f('0x1a')];_0xf4d7e8='0';_0xa75898=_0x800f('0x1b');_0x2fe06a[_0x800f('0x13')]();}}break;case 0x1:logger[_0x800f('0x5')](_0x800f('0x1c'));_0xf4d7e8='1';_0xa75898='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x800f('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xf4d7e8='2';_0xa75898=_0x800f('0x1d');break;case 0x9:logger[_0x800f('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xf4d7e8='9';_0xa75898=_0x800f('0x1e');break;case 0xa:logger[_0x800f('0x5')](_0x800f('0x1f'));_0xf4d7e8='10';_0xa75898=_0x800f('0x1f');break;case 0xb:logger[_0x800f('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xf4d7e8='11';_0xa75898=_0x800f('0x20');}}}catch(_0x2f876e){logger[_0x800f('0x12')](_0x800f('0x21'),JSON[_0x800f('0xe')](_0x2f876e));_0x2fe06a[_0x800f('0x13')]();}}function _0x4d5538(){logger[_0x800f('0x5')](_0x800f('0x22'));_0x20d5f2({'transcript':_0x4adc5c,'confidence':_0x3747a9,'status':_0xf4d7e8,'status_message':_0xa75898});}function _0x5ab718(_0x13e552){logger[_0x800f('0x12')](_0x800f('0x23'));if(!_[_0x800f('0x24')](_0x13e552)){logger[_0x800f('0x12')](_[_0x800f('0x25')](_0x13e552)?JSON[_0x800f('0xe')](_0x13e552):_0x13e552);}}_0x2fe06a['on'](_0x800f('0x26'),_0x4837c1);_0x2fe06a['on'](_0x800f('0x27'),_0x5bbc3b);_0x2fe06a['on'](_0x800f('0x28'),_0x4d5538);_0x2fe06a['on'](_0x800f('0x12'),_0x5ab718);});}; \ 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 b7212a6..850e7b2 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 _0x31e2=['./asr','exports'];(function(_0x38c471,_0x5888bd){var _0x452335=function(_0x19f8f2){while(--_0x19f8f2){_0x38c471['push'](_0x38c471['shift']());}};_0x452335(++_0x5888bd);}(_0x31e2,0xe0));var _0x231e=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x31e2[_0x3de8a4];return _0x4635cf;};var asr=require(_0x231e('0x0'));module[_0x231e('0x1')]={'asr':asr}; \ No newline at end of file +var _0xfea0=['exports'];(function(_0x57c68d,_0x28c03d){var _0x22f4c1=function(_0x200adf){while(--_0x200adf){_0x57c68d['push'](_0x57c68d['shift']());}};_0x22f4c1(++_0x28c03d);}(_0xfea0,0x76));var _0x0fea=function(_0x1fe41b,_0x5ae7d5){_0x1fe41b=_0x1fe41b-0x0;var _0x436695=_0xfea0[_0x1fe41b];return _0x436695;};var asr=require('./asr');module[_0x0fea('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 16ae3f4..5834e88 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xe706,0xa3));var _0x6e70=function(_0x27685e,_0x845417){_0x27685e=_0x27685e-0x0;var _0x224a6f=_0xe706[_0x27685e];return _0x224a6f;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +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(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 822dd74..6fc95c8 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 _0x39cb=['catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccountById','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','arg_1','file','createSquareMessage','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','replaceAllVariables','saveRestApiResult','%s.%s','length','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','createCmContact','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','speech','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','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','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','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','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','condition','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','math','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','lodash','shelljs','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','getVariable','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xb39c('0x0'));var sh=require(_0xb39c('0x1'));var odbc=require('odbc')();var rs=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var Mustache=require('mustache');var rp=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var shared=require(_0xb39c('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xb39c('0x9');var recursiveMapAttributes=[_0xb39c('0xa'),_0xb39c('0xb')];var verticesWithRetry=[_0xb39c('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x41557b,_0x7aa397,_0x3ffb94){this[_0xb39c('0xd')]=_0x41557b;this['rpc']=_0x7aa397;this['mailRpc']=_0x3ffb94;};AGIVertices['prototype'][_0xb39c('0xe')]=function(_0x497ffc,_0xaa6a32){this[_0xb39c('0xf')][_0xb39c('0x10')](_0x497ffc)[_0xb39c('0x11')](function(_0x2a5c79){_0xaa6a32(null,_0x2a5c79?_0x2a5c79[_0xb39c('0x12')]:![]);})['catch'](function(_0x31e07e){_0xaa6a32(_0x31e07e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x14')]=function(_0x5e4caf,_0xf4662a){this[_0xb39c('0xf')][_0xb39c('0x15')](_0x5e4caf)[_0xb39c('0x11')](function(_0x469fa9){_0xf4662a(null,_0x469fa9?_0x469fa9[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0x5277ce){_0xf4662a(_0x5277ce);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x17')]=function(_0x10989d,_0x1c2c5f){this[_0xb39c('0xf')][_0xb39c('0x18')](_0x10989d)[_0xb39c('0x11')](function(_0x4e02cf){_0x1c2c5f(null,_0x4e02cf?_0x4e02cf[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0x559ad6){_0x1c2c5f(_0x559ad6);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x19')]=function(_0x28bbe1,_0x447352){this['rpc'][_0xb39c('0x1a')](_0x28bbe1)[_0xb39c('0x11')](function(_0x5e4a0b){_0x447352(null,_0x5e4a0b?_0x5e4a0b[_0xb39c('0x1b')]:![]);})[_0xb39c('0x16')](function(_0x1d3e2d){_0x447352(_0x1d3e2d);});};AGIVertices['prototype']['getUser']=function(_0x2789fd,_0x1a5b9d){this[_0xb39c('0xf')]['getUserById'](_0x2789fd)[_0xb39c('0x11')](function(_0x438207){_0x1a5b9d(null,_0x438207?_0x438207[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0x3b03ed){_0x1a5b9d(_0x3b03ed);});};AGIVertices['prototype'][_0xb39c('0x1c')]=function(_0xbeab7e,_0x583ee5){this[_0xb39c('0xf')][_0xb39c('0x1d')](_0xbeab7e)[_0xb39c('0x11')](function(_0x12be70){_0x583ee5(null,_0x12be70?_0x12be70[_0xb39c('0x12')]:![]);})['catch'](function(_0x23a2f1){_0x583ee5(_0x23a2f1);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1e')]=function(_0x4c06fa,_0x41fff2){var _0x337532=this;this['rpc'][_0xb39c('0x1f')](_0x4c06fa)[_0xb39c('0x11')](function(_0x328db1){_0x41fff2(null,_0x328db1?_0x337532['getSoundPath'](_0x328db1[_0xb39c('0x20')]):![]);})[_0xb39c('0x16')](function(_0x59172f){_0x41fff2(_0x59172f);});};AGIVertices[_0xb39c('0x13')]['getMailAccount']=function(_0x8e2d7,_0x2d2743){this[_0xb39c('0xf')][_0xb39c('0x21')](_0x8e2d7)[_0xb39c('0x11')](function(_0x52e642){_0x2d2743(null,_0x52e642?_0x52e642:![]);})[_0xb39c('0x16')](function(_0x57aa3b){_0x2d2743(_0x57aa3b);});};AGIVertices[_0xb39c('0x13')]['sendMailMessage']=function(_0x5a2cf4,_0xe2111a,_0x3a96b9){this[_0xb39c('0x22')]['sendMailMessage'](_0x5a2cf4,_0xe2111a)['then'](function(){_0x3a96b9(null);})[_0xb39c('0x16')](function(_0x1befe2){_0x3a96b9(_0x1befe2);});};AGIVertices['prototype'][_0xb39c('0x23')]=function(_0x1c04a7,_0x30bdf0){this[_0xb39c('0xf')][_0xb39c('0x24')](_0x1c04a7)[_0xb39c('0x11')](function(_0x41cdd1){if(_0x41cdd1){if(_0x41cdd1[_0xb39c('0x25')]){_0x30bdf0(null,[_0x41cdd1[_0xb39c('0x26')]]);}else{_0x30bdf0(null,_[_0xb39c('0x27')](_0x41cdd1[_0xb39c('0x28')],_0xb39c('0x26')));}}else{_0x30bdf0(null,![]);}})[_0xb39c('0x16')](function(_0x2f6b5a){_0x30bdf0(_0x2f6b5a);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x29')]=function(_0x8e5a74){return util[_0xb39c('0x2a')](_0xb39c('0x2b'),FILES_PATH,_0x8e5a74);};AGIVertices['prototype'][_0xb39c('0x2c')]=function(_0x45177f,_0x5ee5a5,_0x56e80a){odbc['open'](_0x45177f,function(_0x22d673){if(_0x22d673){logger[_0xb39c('0x2d')](_0xb39c('0x2e'),_0x22d673);_0x56e80a(_0x22d673);}else{logger['info'](_0xb39c('0x2f'));odbc[_0xb39c('0x30')](_0x5ee5a5,function(_0x44afba,_0x3f5357){if(_0x44afba){logger[_0xb39c('0x31')]('Error\x20executing\x20query\x20%s',_0x5ee5a5);_0x56e80a(_0x44afba);}else{logger[_0xb39c('0x31')](_0xb39c('0x32'),_0x5ee5a5);odbc['close'](function(_0x111909){if(_0x111909){logger['error'](_0xb39c('0x33'),_0x111909);}_0x56e80a(null,_0x3f5357);});}});}});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x34')]=function(_0x4c043a,_0x406fc6){this[_0xb39c('0xf')][_0xb39c('0x35')](_0x4c043a)[_0xb39c('0x11')](function(_0x10b87b){_0x406fc6(null,_0x10b87b?_0x10b87b:![]);})[_0xb39c('0x16')](function(_0x17ed52){_0x406fc6(_0x17ed52);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x36')]=function(_0x263544,_0x38359d){this[_0xb39c('0xf')]['createSmsMessage'](_0x263544)[_0xb39c('0x11')](function(_0xbeb7b3){_0x38359d(null,_0xbeb7b3);})[_0xb39c('0x16')](function(_0x29ea9e){_0x38359d(_0x29ea9e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x37')]=function(_0x1db549,_0x8cb33a,_0xfe51a9){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'node':_0x1db549['label'],'application':_0x1db549['agicommand'],'data':_0x8cb33a||null,'project_name':this[_0xb39c('0xd')]['arg_1'],'callerid':this[_0xb39c('0xd')][_0xb39c('0x39')]})[_0xb39c('0x11')](function(_0x271867){if(_0xfe51a9){_0xfe51a9(null,_0x271867);}})[_0xb39c('0x16')](function(_0x4ffdec){if(_0xfe51a9){_0xfe51a9(_0x4ffdec);}});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x3a')]=function(_0x4d2a47,_0x494e6d,_0x2f2fce,_0x53408c){this['rpc'][_0xb39c('0x3a')]({'uniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'callerid':this[_0xb39c('0xd')][_0xb39c('0x39')],'calleridname':this[_0xb39c('0xd')][_0xb39c('0x3b')],'context':this[_0xb39c('0xd')][_0xb39c('0x3c')],'extension':this[_0xb39c('0xd')]['extension'],'priority':this[_0xb39c('0xd')][_0xb39c('0x3d')],'accountcode':this[_0xb39c('0xd')][_0xb39c('0x3e')],'dnid':this[_0xb39c('0xd')][_0xb39c('0x3f')],'projectName':this[_0xb39c('0xd')][_0xb39c('0x40')],'saveName':_0x494e6d,'filename':_0x4d2a47[_0xb39c('0x41')]||_0x494e6d,'savePath':_0x2f2fce})[_0xb39c('0x11')](function(_0x2150aa){_0x53408c(null,_0x2150aa);})[_0xb39c('0x16')](function(_0x470766){_0x53408c(_0x470766);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x42')]=function(_0x44b825,_0x4ee3fc,_0x283acf,_0x2755f3,_0x1d647c){this[_0xb39c('0xf')][_0xb39c('0x42')]({'uniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'body':_0x44b825,'direction':_0x4ee3fc,'providerName':_0x283acf,'providerResponse':_0x2755f3})[_0xb39c('0x11')](function(_0x4b0917){if(_0x1d647c){_0x1d647c(null,_0x4b0917);}})['catch'](function(_0x32bba9){if(_0x1d647c){_0x1d647c(_0x32bba9);}});};AGIVertices[_0xb39c('0x13')]['createCmContact']=function(_0x4f4f51,_0x226f60){this[_0xb39c('0xf')]['createCmContact']({'firstName':_[_0xb39c('0x43')](_0x4f4f51['name'])||_['isNil'](_0x4f4f51[_0xb39c('0x12')])?'callback_'+Math[_0xb39c('0x44')]():_0x4f4f51[_0xb39c('0x12')],'lastName':_[_0xb39c('0x43')](_0x4f4f51[_0xb39c('0x45')])||_[_0xb39c('0x46')](_0x4f4f51[_0xb39c('0x45')])?null:_0x4f4f51['lastName'],'phone':_0x4f4f51[_0xb39c('0x47')],'ListId':_0x4f4f51[_0xb39c('0x48')],'scheduledat':_0x4f4f51[_0xb39c('0x49')],'callbackUniqueid':this[_0xb39c('0xd')][_0xb39c('0x38')],'tags':'callback','description':_0xb39c('0x4a')+_0x4f4f51['scheduledAt'][_0xb39c('0x4b')](),'priority':_0x4f4f51[_0xb39c('0x4c')]})[_0xb39c('0x11')](function(_0x9e4e89){_0x226f60(null,_0x9e4e89);})[_0xb39c('0x16')](function(_0x24a2d6){_0x226f60(_0x24a2d6);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x4d')]=function(_0x390e68,_0x3c17d1){this[_0xb39c('0xf')][_0xb39c('0x4e')](_0x390e68)[_0xb39c('0x11')](function(_0x33c0c6){_0x3c17d1(null,_0x33c0c6?_0x33c0c6[_0xb39c('0x12')]:![]);})[_0xb39c('0x16')](function(_0xc7238e){_0x3c17d1(_0xc7238e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x4f')]=function(_0x49f118,_0x57f2f4,_0x1e9893){var _0x15534c={'role':'agent'};_0x15534c[_0x49f118]=this[_0xb39c('0xd')][_0xb39c('0x39')];this['rpc'][_0xb39c('0x4f')](_0x15534c,_0x57f2f4,this[_0xb39c('0xd')][_0xb39c('0x38')])[_0xb39c('0x11')](function(_0x453a21){_0x1e9893(null,_[_0xb39c('0x46')](_0x453a21)?![]:!![]);})['catch'](function(_0x34bcb0){logger[_0xb39c('0x2d')](_0x34bcb0);_0x1e9893(null,![]);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x50')]=function(_0x3fd183,_0x1d0fbf){var _0x53b491={'role':'agent'};_0x53b491[_0x3fd183]=this[_0xb39c('0xd')][_0xb39c('0x39')];this[_0xb39c('0xf')][_0xb39c('0x50')](_0x53b491)[_0xb39c('0x11')](function(_0x4d6968){_0x1d0fbf(null,_['isNil'](_0x4d6968)?![]:!![]);})[_0xb39c('0x16')](function(_0x274707){logger[_0xb39c('0x2d')](_0x274707);_0x1d0fbf(null,![]);});};AGIVertices['prototype'][_0xb39c('0x51')]=function(_0x4836f7,_0x2f3c24){var _0x5ce5fb={'role':_0xb39c('0x52')};_0x5ce5fb[_0x4836f7]=this[_0xb39c('0xd')][_0xb39c('0x39')];this['rpc'][_0xb39c('0x51')](_0x5ce5fb)[_0xb39c('0x11')](function(_0x14b448){_0x2f3c24(null,_[_0xb39c('0x46')](_0x14b448)?![]:!![]);})[_0xb39c('0x16')](function(_0x31f8be){logger[_0xb39c('0x2d')](_0x31f8be);_0x2f3c24(null,![]);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x53')]=function(_0x158ac5,_0x34127d){var _0x227152={'role':_0xb39c('0x52')};_0x227152[_0x158ac5]=this[_0xb39c('0xd')][_0xb39c('0x39')];var _0x31b9c1=_0x158ac5!=_0xb39c('0x54')?util['format'](_0xb39c('0x55'),_0xb39c('0x56'),this[_0xb39c('0xd')]['callerid']):undefined;this[_0xb39c('0xf')]['agentLogin'](_0x227152,_0x31b9c1)['then'](function(_0x8d8f59){_0x34127d(null,_[_0xb39c('0x46')](_0x8d8f59)?![]:!![]);})[_0xb39c('0x16')](function(_0x40bbd5){logger[_0xb39c('0x2d')](_0x40bbd5);_0x34127d(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x26d08c,_0x27723c){sh['exec'](_[_0xb39c('0x57')](_0x26d08c),function(_0x5727b8,_0xc1c51){var _0x32acb6=_0xc1c51[_0xb39c('0x58')](/(\r\n|\n|\r)/gm,'');_0x27723c(null,_0x32acb6);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x59')]=function(_0xfe586,_0x5f69ef){scripts[_0xb39c('0x59')](_0xfe586[_0xb39c('0x5a')],_0xfe586[_0xb39c('0x5b')]||_0xb39c('0x5c'),_0xfe586[_0xb39c('0x5c')],_0xfe586[_0xb39c('0x5d')]||'en-US',_0xfe586[_0xb39c('0x5e')]||'MALE',_0xfe586[_0xb39c('0x5f')]||_0xb39c('0x60'))['then'](function(_0x2a19bc){_0x5f69ef(null,_0x2a19bc);})[_0xb39c('0x16')](function(_0x2fe97a){_0x5f69ef(_0x2fe97a);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x61')]=function(_0x382640,_0x4869d7){scripts[_0xb39c('0x61')](_0x382640[_0xb39c('0x5c')],_0x382640[_0xb39c('0x62')]||'en',0x1)[_0xb39c('0x11')](function(_0x9a039a){_0x4869d7(null,_0x9a039a);})[_0xb39c('0x16')](function(_0x3f4677){_0x4869d7(_0x3f4677);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x63')]=function(_0x47e986,_0x42c8c1){var _0x20610f={'uri':_0x47e986[_0xb39c('0x64')],'method':_0x47e986[_0xb39c('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x47e986[_0xb39c('0x66')])===_0xb39c('0x67')&&parseInt(_0x47e986[_0xb39c('0x66')])>=0x1?parseInt(_0x47e986['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xb39c('0x68')]([_0xb39c('0x69'),_0xb39c('0x6a')],_0x20610f[_0xb39c('0x65')][_0xb39c('0x6b')]())){try{_0x20610f[_0xb39c('0x6c')]=_0x47e986[_0xb39c('0xb')]?JSON[_0xb39c('0x6d')](_0x47e986['rawBody']):{};}catch(_0x3dc3d8){logger['error'](_0xb39c('0x6e'),_0x3dc3d8);}}try{_0x20610f[_0xb39c('0x6f')]=_0x47e986[_0xb39c('0xa')]?JSON[_0xb39c('0x6d')](_0x47e986[_0xb39c('0xa')]):{};}catch(_0x2287c7){logger[_0xb39c('0x2d')](_0xb39c('0x70'),_0x2287c7);}if(_0x47e986['computedVariables']){try{var _0x21f1d2=require(_0x47e986[_0xb39c('0x71')])[_0xb39c('0x72')](this,_0x20610f);_0x20610f[_0xb39c('0x73')]=Mustache[_0xb39c('0x74')](_0x47e986[_0xb39c('0x64')],_0x21f1d2,{},['$$','$$']);if(_0x20610f[_0xb39c('0x6f')]){_0x20610f[_0xb39c('0x6f')]=JSON[_0xb39c('0x6d')](Mustache[_0xb39c('0x74')](JSON[_0xb39c('0x75')](_0x20610f[_0xb39c('0x6f')]),_0x21f1d2,{},['$$','$$']));}if(_0x20610f[_0xb39c('0x6c')]){_0x20610f[_0xb39c('0x6c')]=JSON[_0xb39c('0x6d')](Mustache[_0xb39c('0x74')](JSON['stringify'](_0x20610f['body']),_0x21f1d2,{},['$$','$$']));}}catch(_0x4519a8){logger[_0xb39c('0x2d')](_0xb39c('0x76'),_0x4519a8);}}rp(_0x20610f)['then'](function(_0x62a6cb){var _0x74411={'statusCode':_0x62a6cb[_0xb39c('0x77')]||0xc8,'statusMessage':_0x62a6cb[_0xb39c('0x78')]||'OK','headers':_0x62a6cb[_0xb39c('0x6f')]||{},'body':_0x62a6cb[_0xb39c('0x6c')]||{}};_0x42c8c1(null,_0x74411);})[_0xb39c('0x16')](function(_0x5adff7){var _0x41d28f={'statusCode':_0x5adff7[_0xb39c('0x77')]||0x1f4,'statusMessage':_0x5adff7['message']||_0xb39c('0x79'),'headers':_0x5adff7['options'][_0xb39c('0x6f')]||{},'body':_0x5adff7[_0xb39c('0x7a')][_0xb39c('0x6c')]||{}};_0x42c8c1(null,_0x41d28f);});};AGIVertices['prototype'][_0xb39c('0x7b')]=function(_0x374086,_0x56b863){scripts[_0xb39c('0x7b')](this[_0xb39c('0xd')][_0xb39c('0x38')],_0x374086[_0xb39c('0x7c')],_0x374086[_0xb39c('0x5c')],_0x374086[_0xb39c('0x7d')]||'en')[_0xb39c('0x11')](function(_0x3b6e39){_0x56b863(null,_0x3b6e39);})[_0xb39c('0x16')](function(_0x13775e){_0x56b863(_0x13775e);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x7e')]=function(_0x43eb48,_0x2c524b){scripts[_0xb39c('0x7e')](this[_0xb39c('0xd')][_0xb39c('0x38')],_0x43eb48[_0xb39c('0x7f')],_0x43eb48[_0xb39c('0x80')],_0x43eb48[_0xb39c('0x81')],_0x43eb48[_0xb39c('0x5c')],_0x43eb48[_0xb39c('0x82')]||'en')[_0xb39c('0x11')](function(_0x48ec2b){_0x2c524b(null,_0x48ec2b);})[_0xb39c('0x16')](function(_0x27a47a){_0x2c524b(_0x27a47a);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x83')]=function(_0x52b991,_0x3d0243){scripts[_0xb39c('0x83')](this['channel'],_0x52b991)[_0xb39c('0x11')](function(_0x3b70ce){_0x3d0243(null,_0x3b70ce);})[_0xb39c('0x16')](function(_0x2c17cb){_0x3d0243(_0x2c17cb);});};AGIVertices[_0xb39c('0x13')]['ispeechTTS']=function(_0x313f61,_0x398165){scripts['ispeechTTS'](_0x313f61[_0xb39c('0x7c')],_0x313f61[_0xb39c('0x5c')],_0x313f61[_0xb39c('0x84')]||_0xb39c('0x85'),_0x313f61[_0xb39c('0x86')])[_0xb39c('0x11')](function(_0x458351){_0x398165(null,_0x458351);})[_0xb39c('0x16')](function(_0x1b007a){_0x398165(_0x1b007a);});};AGIVertices[_0xb39c('0x13')]['ispeechASR']=function(_0x36975c,_0x2c733e,_0x28d120){scripts[_0xb39c('0x87')](_0x2c733e,_0x36975c['key'],_0x36975c[_0xb39c('0x88')]||_0xb39c('0x85'),this[_0xb39c('0x89')](_0x36975c[_0xb39c('0x8a')])?_0x36975c['model']:undefined)[_0xb39c('0x11')](function(_0x3ffab2){_0x28d120(null,_0x3ffab2);})[_0xb39c('0x16')](function(_0x1c45c8){_0x28d120(_0x1c45c8);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x8b')]=function(_0x2ebfd8,_0x43557f){scripts['awsPolly'](_0x2ebfd8[_0xb39c('0x8c')],_0x2ebfd8[_0xb39c('0x8d')],_0x2ebfd8[_0xb39c('0x8e')],_0x2ebfd8[_0xb39c('0x8f')]||_0xb39c('0x90'),_0x2ebfd8[_0xb39c('0x5c')],_0x2ebfd8[_0xb39c('0x91')]||'text')['then'](function(_0x23ff98){_0x43557f(null,_0x23ff98);})[_0xb39c('0x16')](function(_0x40d511){_0x43557f(_0x40d511);});};AGIVertices['prototype'][_0xb39c('0x92')]=function(_0x42a882,_0x474b07){scripts[_0xb39c('0x92')](this[_0xb39c('0xd')]['uniqueid'],_0x42a882[_0xb39c('0x8c')],_0x42a882[_0xb39c('0x8d')],_0x42a882[_0xb39c('0x93')],_0x42a882[_0xb39c('0x5c')],_0x42a882[_0xb39c('0x94')])[_0xb39c('0x11')](function(_0x24eba1){_0x474b07(null,_0x24eba1);})[_0xb39c('0x16')](function(_0x5d40fe){_0x474b07(_0x5d40fe);});};AGIVertices[_0xb39c('0x13')][_0xb39c('0x95')]=function(_0x1ed19a,_0x163158,_0x2bb8e1){scripts['googleASR'](_0x163158,_0x1ed19a[_0xb39c('0x7c')],_0x1ed19a[_0xb39c('0x96')]||_0xb39c('0x85'))[_0xb39c('0x11')](function(_0x33a01f){_0x2bb8e1(null,_0x33a01f);})[_0xb39c('0x16')](function(_0x3a9185){_0x2bb8e1(_0x3a9185);});};AGIVertices['prototype'][_0xb39c('0x97')]=function(_0x1da4a2,_0x489988,_0x50ee92){scripts[_0xb39c('0x97')](_0x489988,_0x1da4a2['appid'],_0x1da4a2[_0xb39c('0x98')],_0x1da4a2['uri'])[_0xb39c('0x11')](function(_0x4c6fb9){_0x50ee92(null,_0x4c6fb9);})[_0xb39c('0x16')](function(_0x1316f4){_0x50ee92(_0x1316f4);});};AGIVertices[_0xb39c('0x13')]['clear']=function(_0x5f5c95){var _0x27d29a=_[_0xb39c('0x68')](verticesWithRetry,_0x5f5c95['agicommand'])?_0x5f5c95:_[_0xb39c('0x99')](_0x5f5c95);for(var _0x176284 in _0x27d29a){if(_0x27d29a['hasOwnProperty'](_0x176284)){if(_0x27d29a[_0x176284]&&_[_0xb39c('0x9a')](_0x27d29a[_0x176284])){if(_[_0xb39c('0x68')](recursiveMapAttributes,_0x176284)){_0x27d29a[_0x176284]=this[_0xb39c('0x9b')](_0x27d29a[_0x176284]);}else{_0x27d29a[_0x176284]=this['replaceAllVariables'](_0x27d29a[_0x176284]);}}}}return _0x27d29a;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x9c')]=function(_0x1226ff){for(var _0x98bfbb in _0x1226ff){if(_0x1226ff[_0xb39c('0x9d')](_0x98bfbb)){if(_[_0xb39c('0x9e')](_0x1226ff[_0x98bfbb])){this[_0xb39c('0x9c')](_0x1226ff[_0x98bfbb]);}else if(_['isArray'](_0x1226ff[_0x98bfbb])){for(var _0x15f244=0x0;_0x15f244<_0x1226ff[_0x98bfbb]['length'];_0x15f244++){this['recursiveNodeIndex'](_0x1226ff[_0x98bfbb][_0x15f244]);}}else if(_[_0xb39c('0x9a')](_0x1226ff[_0x98bfbb])){_0x1226ff[_0x98bfbb]=this[_0xb39c('0x9f')](_0x1226ff[_0x98bfbb]);}}}};AGIVertices[_0xb39c('0x13')][_0xb39c('0xa0')]=function(_0x3a7dd5,_0x46b77a){for(var _0xac1d01 in _0x3a7dd5){if(_0x3a7dd5[_0xb39c('0x9d')](_0xac1d01)){if(_[_0xb39c('0x9e')](_0x3a7dd5[_0xac1d01])){if(!_['isEmpty'](_0x3a7dd5[_0xac1d01])){this[_0xb39c('0xa0')](_0x3a7dd5[_0xac1d01],util['format'](_0xb39c('0xa1'),_0x46b77a,_0xac1d01));}}else if(_['isArray'](_0x3a7dd5[_0xac1d01])){for(var _0x1aff94=0x0;_0x1aff94<_0x3a7dd5[_0xac1d01][_0xb39c('0xa2')];_0x1aff94++){this[_0xb39c('0xa0')](_0x3a7dd5[_0xac1d01][_0x1aff94],util['format']('%s.%s',_0x46b77a,_0xac1d01+'['+_0x1aff94+']'));}}else{if(!_[_0xb39c('0x46')](_0x3a7dd5[_0xac1d01])){this['channel']['setVariable'](util[_0xb39c('0x2a')](_0xb39c('0xa1'),_0x46b77a,_0xac1d01),_0x3a7dd5[_0xac1d01]);}}}}};AGIVertices[_0xb39c('0x13')][_0xb39c('0x9b')]=function(_0x160763){try{var _0x4e09f3=JSON['parse'](_0x160763);this['recursiveNodeIndex'](_0x4e09f3);return JSON['stringify'](_0x4e09f3);}catch(_0x53dfbb){return this[_0xb39c('0x9f')](_0x160763);}};AGIVertices[_0xb39c('0x13')][_0xb39c('0x9f')]=function(_0x407e9d){var _0x532ff2=_0x407e9d[_0xb39c('0xa3')]('{');for(var _0x2ad1a1=0x1;_0x2ad1a1<_0x532ff2[_0xb39c('0xa2')];_0x2ad1a1+=0x1){var _0x643963=_0x532ff2[_0x2ad1a1][_0xb39c('0xa3')]('}');if(_0x643963[_0xb39c('0xa2')]>0x1){_0x407e9d=_0x407e9d[_0xb39c('0xa4')]('{'+_0x643963[0x0]+'}',this['channel'][_0xb39c('0xe')](_0x643963[0x0])['extra']||_0x643963[0x0]);}}if(_0x532ff2[_0xb39c('0xa2')]===0x1){return _0x407e9d['toString']();}return this[_0xb39c('0x9f')](_0x407e9d);};AGIVertices[_0xb39c('0x13')][_0xb39c('0xa5')]=function(_0x1e6a98,_0xe63cd8){var _0x3821f4=this[_0xb39c('0xd')][_0xb39c('0xe')](_0x1e6a98);if(_0x3821f4[_0xb39c('0xa6')]===-0x1){return _0x3821f4;}logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xa7'),_0xe63cd8,_0x3821f4[_0xb39c('0xa8')]));return this[_0xb39c('0xd')][_0xb39c('0xa9')](_0xe63cd8,_0x3821f4[_0xb39c('0xa8')]);};AGIVertices['prototype'][_0xb39c('0x89')]=function(_0x29442a){return _0x29442a&&_0x29442a!=='0'&&_0x29442a!=='-1'&&_0x29442a!=='';};AGIVertices[_0xb39c('0x13')][_0xb39c('0xaa')]=function(_0x518c87){this[_0xb39c('0x37')]['sync'](this,_0x518c87,'-');_0x518c87['retry']=_0x518c87[_0xb39c('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb39c('0x13')][_0xb39c('0xab')]=function(_0x17144a){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xac'),_0x17144a[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x17144a[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}var _0x55d99a='\x22'+_0x17144a[_0xb39c('0x5c')]+'\x22';if(this[_0xb39c('0x89')](_0x17144a[_0xb39c('0x7a')])){_0x55d99a+=','+_0x17144a[_0xb39c('0x7a')];}var _0xd47cc0=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xb1'),_0x55d99a);if(_0xd47cc0[_0xb39c('0xa6')]===-0x1){return _0xd47cc0;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x55d99a));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xb2')]=function(_0x490eb9){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xb3'),_0x490eb9['label']));if(!this[_0xb39c('0x89')](_0x490eb9[_0xb39c('0xb4')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xb5'));}var _0xe5ea1d=_0x490eb9[_0xb39c('0xb4')];if(this[_0xb39c('0x89')](_0x490eb9[_0xb39c('0x7a')])){_0xe5ea1d+=','+_0x490eb9[_0xb39c('0x7a')];}var _0x21c9a4=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xb6'),_0xe5ea1d);if(_0x21c9a4[_0xb39c('0xa6')]===-0x1){return _0x21c9a4;}var _0x4e9eef=this[_0xb39c('0xa5')](_0xb39c('0xb7'),_0xb39c('0xb8'));if(_0x4e9eef[_0xb39c('0xa6')]===-0x1){return _0x4e9eef;}var _0x446d2b=this[_0xb39c('0xa5')](_0xb39c('0xb9'),_0xb39c('0xba'));if(_0x446d2b[_0xb39c('0xa6')]===-0x1){return _0x446d2b;}var _0x26a080=this[_0xb39c('0xa5')]('RECOG_INSTANCE()',_0xb39c('0xbb'));if(_0x26a080[_0xb39c('0xa6')]===-0x1){return _0x26a080;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xe5ea1d));};AGIVertices['prototype'][_0xb39c('0x6')]=function(_0x23a1cb){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0xbc'),_0x23a1cb[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x6')]([_0x23a1cb['command'],_0x23a1cb['args']]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0xbd')]=function(_0x9b179){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xbe'),_0x9b179[_0xb39c('0xad')]));if(this[_0xb39c('0x89')](_0x9b179[_0xb39c('0x66')])){logger['info'](util['format'](_0xb39c('0xbf'),_0x9b179['timeout']));var _0x2952d2=this[_0xb39c('0xd')][_0xb39c('0xc0')](_0x9b179[_0xb39c('0x66')]);if(_0x2952d2[_0xb39c('0xa6')]===-0x1){return _0x2952d2;}}return this[_0xb39c('0xd')][_0xb39c('0xbd')]();};AGIVertices['prototype']['callback']=function(_0x1e7fd7){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xc1'),_0x1e7fd7['label']));if(!this[_0xb39c('0x89')](_0x1e7fd7[_0xb39c('0x48')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x1e7fd7,'no\x20list\x20selected');}_0x1e7fd7[_0xb39c('0x49')]=moment();if(this[_0xb39c('0x89')](_0x1e7fd7[_0xb39c('0xc2')])){_0x1e7fd7[_0xb39c('0x49')]=moment()[_0xb39c('0xc3')](_0x1e7fd7[_0xb39c('0xc2')],'minutes');}if(!this[_0xb39c('0x89')](_0x1e7fd7[_0xb39c('0x4c')])){_0x1e7fd7[_0xb39c('0x4c')]=0x2;}this[_0xb39c('0xc4')]['sync'](this,_0x1e7fd7);return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1e7fd7['phone'],_0x1e7fd7['list_id'],_0x1e7fd7[_0xb39c('0x49')]));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xc5')]=function(_0x208169){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xc6'),_0x208169[_0xb39c('0xad')]));var _0x4070b5=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0x208169[_0xb39c('0xc7')],_0x208169[_0xb39c('0x7a')]);if(_0x4070b5[_0xb39c('0xa6')]===-0x1){return _0x4070b5;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xc8'),_0x208169['application'],_0x208169['options']));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xc9')]=function(_0x20e2fb){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x20e2fb['label']));if(!this['isConfigured'](_0x20e2fb[_0xb39c('0x5c')])){return this['channel']['noop'](_0xb39c('0xaf'));}var _0x32aeb9='\x22'+_0x20e2fb[_0xb39c('0x5c')]+'\x22';if(this[_0xb39c('0x89')](_0x20e2fb['options'])){_0x32aeb9+=','+_0x20e2fb[_0xb39c('0x7a')];}var _0x21e98b=this[_0xb39c('0xd')][_0xb39c('0xb0')]('MRCPSynth',_0x32aeb9);if(_0x21e98b[_0xb39c('0xa6')]===-0x1){return _0x21e98b;}return this['channel'][_0xb39c('0xae')](util['format'](_0xb39c('0xca'),_0x32aeb9));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xcb')]=function(_0x77ad7){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x77ad7[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x77ad7[_0xb39c('0x5c')])){return this['channel'][_0xb39c('0xae')](_0xb39c('0xaf'));}var _0x345e8a='\x22'+_0x77ad7[_0xb39c('0x5c')]+'\x22';if(this[_0xb39c('0x89')](_0x77ad7[_0xb39c('0x7a')])){_0x345e8a+=','+_0x77ad7[_0xb39c('0x7a')];}var _0x2f3824=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xb1'),_0x345e8a);if(_0x2f3824[_0xb39c('0xa6')]===-0x1){return _0x2f3824;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0xca'),_0x345e8a));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xcc')]=function(_0x508757){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0xcd'),_0x508757['label']));if(!this[_0xb39c('0x89')](_0x508757[_0xb39c('0xb4')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xb5'));}var _0x2a0e34=_0x508757[_0xb39c('0xb4')];if(this[_0xb39c('0x89')](_0x508757[_0xb39c('0x7a')])){_0x2a0e34+=','+_0x508757[_0xb39c('0x7a')];}var _0x2d17ae=this['channel'][_0xb39c('0xb0')]('MRCPRecog',_0x2a0e34);if(_0x2d17ae[_0xb39c('0xa6')]===-0x1){return _0x2d17ae;}var _0x2ec13d=this[_0xb39c('0xa5')](_0xb39c('0xb7'),_0xb39c('0xce'));if(_0x2ec13d['result']===-0x1){return _0x2ec13d;}var _0x40f39a=this[_0xb39c('0xa5')](_0xb39c('0xb9'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x40f39a[_0xb39c('0xa6')]===-0x1){return _0x40f39a;}var _0x521716=this[_0xb39c('0xa5')](_0xb39c('0xcf'),_0xb39c('0xd0'));if(_0x521716[_0xb39c('0xa6')]===-0x1){return _0x521716;}return this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xd1'),_0x2a0e34));};AGIVertices[_0xb39c('0x13')]['sestekasr']=function(_0x434a36){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x434a36[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x434a36[_0xb39c('0xb4')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xb5'));}var _0x652129=_0x434a36[_0xb39c('0xb4')];if(this[_0xb39c('0x89')](_0x434a36[_0xb39c('0x7a')])){_0x652129+=','+_0x434a36[_0xb39c('0x7a')];}var _0x5dda97=this['channel'][_0xb39c('0xb0')](_0xb39c('0xb6'),_0x652129);if(_0x5dda97[_0xb39c('0xa6')]===-0x1){return _0x5dda97;}var _0x3ccf84=this[_0xb39c('0xa5')](_0xb39c('0xb7'),_0xb39c('0xd2'));if(_0x3ccf84['result']===-0x1){return _0x3ccf84;}var _0x531a49=this[_0xb39c('0xa5')]('RECOG_INPUT()',_0xb39c('0xd3'));if(_0x531a49[_0xb39c('0xa6')]===-0x1){return _0x531a49;}var _0x49617f=this[_0xb39c('0xa5')]('RECOG_INSTANCE()',_0xb39c('0xd4'));if(_0x49617f[_0xb39c('0xa6')]===-0x1){return _0x49617f;}return this['channel']['noop'](util[_0xb39c('0x2a')](_0xb39c('0xd1'),_0x652129));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xd5')]=function(_0x554314){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x554314[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x554314[_0xb39c('0xd6')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x554314,_0xb39c('0xd7'));}var _0x48b6f8=this[_0xb39c('0x19')][_0xb39c('0x72')](this,_0x554314[_0xb39c('0xd6')]);if(!_0x48b6f8){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x554314,_0xb39c('0xd8'));}if(!this['isConfigured'](_0x554314[_0xb39c('0x30')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x554314,_0xb39c('0xd9'));}var _0x39478f=_0x554314['query'][_0xb39c('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0xda'),_0x39478f));var _0x3bcbc8=this[_0xb39c('0x2c')][_0xb39c('0x72')](this,_0x48b6f8,_0x39478f);this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x554314,_0x39478f);if(!this[_0xb39c('0x89')](_0x554314[_0xb39c('0xdb')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xdc'));}var _0x37f362=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x554314[_0xb39c('0xdb')]);if(!_0x37f362){return this['channel'][_0xb39c('0x2d')](_0x554314,'no\x20variable\x20found');}var _0x13152b=this;_0x3bcbc8[_0xb39c('0xdd')](function(_0x53411f,_0x15ad96){Object[_0xb39c('0xde')](_0x53411f)[_0xb39c('0xdd')](function(_0x4cf325){_0x13152b[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0xdf'),_0x37f362,_0x15ad96,_0x4cf325),_0x53411f[_0x4cf325]);});});this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')]('%s_ROWS_COUNT',_0x37f362),_0x3bcbc8[_0xb39c('0xa2')]);return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xe0'),_0x37f362));};AGIVertices[_0xb39c('0x13')][_0xb39c('0xe1')]=function(_0x54769c){logger['debug'](util[_0xb39c('0x2a')](_0xb39c('0xe2'),_0x54769c[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x54769c[_0xb39c('0xe3')])){return this[_0xb39c('0xd')]['error'](_0x54769c,_0xb39c('0xe4'));}var _0x1187d1=this['getUser'][_0xb39c('0x72')](this,_0x54769c[_0xb39c('0xe3')]);if(!_0x1187d1){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x54769c,_0xb39c('0xe5'));}var _0x23ccb1=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0xe6'),[util[_0xb39c('0x2a')](_0xb39c('0xe7'),_0x1187d1),_0x54769c[_0xb39c('0x66')],_0x54769c[_0xb39c('0xe8')],_0x54769c[_0xb39c('0x64')]]);if(_0x23ccb1['result']===-0x1){return _0x23ccb1;}return this['channel'][_0xb39c('0xae')](util['format'](_0xb39c('0xe9'),_0xb39c('0xe6')));};AGIVertices['prototype']['dialogflow']=function(_0x5cc266){logger[_0xb39c('0x31')](util['format'](_0xb39c('0xea'),_0x5cc266[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x5cc266[_0xb39c('0x7c')])){return this[_0xb39c('0xd')]['noop']('no\x20key\x20configured');}if(!this[_0xb39c('0x89')](_0x5cc266[_0xb39c('0x5c')])){return this['channel'][_0xb39c('0xae')]('no\x20text\x20configured');}this[_0xb39c('0xd')][_0xb39c('0xeb')]=!![];this['createSquareDetailsReport'](_0x5cc266);this[_0xb39c('0x42')](_0x5cc266['text'],'in','','');this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xec'),_0x5cc266['text']));var _0x44e1c3=this[_0xb39c('0x7b')][_0xb39c('0x72')](this,_0x5cc266);if(_0x44e1c3){for(var _0x17a084 in _0x44e1c3){if(_0x44e1c3['hasOwnProperty'](_0x17a084)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0xed'),_0x17a084['toUpperCase']()),_0x44e1c3[_0x17a084]);}}this[_0xb39c('0x42')](_0x44e1c3['speech'],_0xb39c('0xee'),'dialogflow','');return this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')]('Dialogflow\x20Result\x20%s',_0x44e1c3[_0xb39c('0xef')]));}return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x5cc266,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xb39c('0x13')][_0xb39c('0xf0')]=function(_0x4e4636){logger[_0xb39c('0x31')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4e4636[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x7f')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xf1'));}if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x80')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0xf2'));}if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x81')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xf3'));}if(!this['isConfigured'](_0x4e4636[_0xb39c('0x82')])){return this['channel'][_0xb39c('0xae')]('no\x20anguage\x20configured');}if(!this[_0xb39c('0x89')](_0x4e4636[_0xb39c('0x5c')])){return this['channel'][_0xb39c('0xae')](_0xb39c('0xaf'));}this['channel'][_0xb39c('0xeb')]=!![];this[_0xb39c('0x37')](_0x4e4636);this['createSquareMessage'](_0x4e4636[_0xb39c('0x5c')],'in','','');this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xf4'),_0x4e4636[_0xb39c('0x5c')]));var _0x23a3b2=this[_0xb39c('0x7e')][_0xb39c('0x72')](this,_0x4e4636);if(_0x23a3b2){for(var _0x4e6152 in _0x23a3b2){if(_0x23a3b2[_0xb39c('0x9d')](_0x4e6152)){if(_0x4e6152!==_0xb39c('0xf5')){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')]('DIALOGFLOW_%s',_0x4e6152[_0xb39c('0x6b')]()),_0x23a3b2[_0x4e6152]);}}}this[_0xb39c('0x42')](_0x23a3b2['speech'],_0xb39c('0xee'),_0xb39c('0xf0'),_0x23a3b2['providerResponse']);return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xf6'),_0x23a3b2[_0xb39c('0xef')]));}return this[_0xb39c('0xd')]['error'](_0x4e4636,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xb39c('0x13')][_0xb39c('0xf7')]=function(_0x34f3bf){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0xf8'),_0x34f3bf['label']));if(!this[_0xb39c('0x89')](_0x34f3bf[_0xb39c('0xf9')])){return this['channel']['noop'](_0xb39c('0xfa'));}if(!this[_0xb39c('0x89')](_0x34f3bf[_0xb39c('0xfb')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0xfc'));}if(!this['isConfigured'](_0x34f3bf[_0xb39c('0xfd')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xfe'));}if(!this[_0xb39c('0x89')](_0x34f3bf[_0xb39c('0xff')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this['channel'][_0xb39c('0xeb')]=!![];this[_0xb39c('0x37')](_0x34f3bf);this[_0xb39c('0x42')](_0x34f3bf['text'],'in','','');this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x100'),_0x34f3bf['text']));var _0x566ef3=this[_0xb39c('0x83')]['sync'](this,_0x34f3bf);if(_0x566ef3){for(var _0x67ecae in _0x566ef3){if(_0x566ef3[_0xb39c('0x9d')](_0x67ecae)){this[_0xb39c('0xd')]['setVariable'](util[_0xb39c('0x2a')]('SESTEK_NDA_%s',_0x67ecae[_0xb39c('0x6b')]()),_0x566ef3[_0x67ecae]);}}this[_0xb39c('0x42')](_0x566ef3[_0xb39c('0xef')],_0xb39c('0xee'),'sesteknda','');if(_0x566ef3['audiofile']){this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x101'),_0x566ef3[_0xb39c('0x102')]));var _0x2a8aff=this[_0xb39c('0xd')][_0xb39c('0x103')](_0x566ef3[_0xb39c('0x102')]);try{fs[_0xb39c('0x104')](_0x566ef3[_0xb39c('0x102')]+_0xb39c('0x105'));}catch(_0x9e7a1){logger['error'](_0x9e7a1);}return _0x2a8aff;}else{return this['channel'][_0xb39c('0xae')](util['format'](_0xb39c('0x106'),_0x566ef3[_0xb39c('0xef')]));}}return this['channel'][_0xb39c('0x2d')](_0x34f3bf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xb39c('0x13')][_0xb39c('0x107')]=function(_0x2478f4){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x108'),_0x2478f4[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x107'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x109')]=function(_0x4f1f49){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x10a'),_0x4f1f49[_0xb39c('0xad')]));var _0x46e4fe='';if(_0x4f1f49[_0xb39c('0x10b')]){if(!this[_0xb39c('0x89')](_0x4f1f49[_0xb39c('0x10b')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x4f1f49,_0xb39c('0x10c'));}else{var _0x475041=parseInt(_0x4f1f49[_0xb39c('0x10b')],0xa);if(isNaN(_0x475041)){_0x46e4fe=_0x4f1f49[_0xb39c('0x10b')];}else{_0x46e4fe=this[_0xb39c('0x1c')][_0xb39c('0x72')](this,_0x4f1f49['trunk_id']);if(!_0x46e4fe){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x4f1f49,'no\x20trunk\x20found');}}}}else if(_0x4f1f49[_0xb39c('0x10d')]){_0x46e4fe=_0x4f1f49['trunk_name'];}else{return this[_0xb39c('0xd')]['error'](_0x4f1f49,'no\x20trunk\x20selected');}var _0x1386ae=this['channel'][_0xb39c('0xb0')](_0xb39c('0xe6'),[util[_0xb39c('0x2a')](_0xb39c('0x10e'),_0x46e4fe,_0x4f1f49['phone']),_0x4f1f49[_0xb39c('0x66')],_0x4f1f49[_0xb39c('0xe8')],_0x4f1f49['url']]);if(_0x1386ae['result']===-0x1){return _0x1386ae;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xe9'),_0xb39c('0xe6')));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x10f')]=function(_0x2dffab){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2dffab['label']));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x10f'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x110')]=function(_0x2a6407){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x111'),_0x2a6407['label']));if(_0x2a6407[_0xb39c('0x112')]===0x0){return this['maxRetry'](_0x2a6407);}_0x2a6407['retry']-=0x1;if(!this[_0xb39c('0x89')](_0x2a6407[_0xb39c('0x113')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x2a6407,_0xb39c('0x114'));}var _0x317a78=this[_0xb39c('0x1e')]['sync'](this,_0x2a6407[_0xb39c('0x113')]);if(!_0x317a78){return this[_0xb39c('0xd')]['error'](_0x2a6407,_0xb39c('0x115'));}if(!this['isConfigured'](_0x2a6407[_0xb39c('0xdb')])){return this['channel']['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4302b1=this['channel']['getData'](_0x317a78,_0x2a6407['response'],_0x2a6407[_0xb39c('0x116')]);var _0x269e47=_0x4302b1[_0xb39c('0xa6')]?_0x4302b1[_0xb39c('0xa6')]['toString']():'';logger['info'](_0xb39c('0x117'),JSON[_0xb39c('0x75')](_0x4302b1));if(_0x4302b1[_0xb39c('0xa6')]===-0x1){this[_0xb39c('0x37')]['sync'](this,_0x2a6407,_0x269e47);return _0x4302b1;}else if(_0x4302b1[_0xb39c('0xa8')]===_0xb39c('0x66')){_0x4302b1['result']=_0x269e47[_0xb39c('0xa2')]>=parseInt(_0x2a6407[_0xb39c('0x118')])?'x':'i';}else{_0x4302b1[_0xb39c('0xa6')]=_0x269e47[_0xb39c('0xa2')]>=parseInt(_0x2a6407[_0xb39c('0x118')])&&_0x269e47['length']<=parseInt(_0x2a6407[_0xb39c('0x116')])?'x':'i';}var _0x143363=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x2a6407['variable_id']);if(!_0x143363){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x2a6407,_0xb39c('0x119'));}this['channel'][_0xb39c('0xa9')](_0x143363,_0x269e47);if(this[_0xb39c('0x89')](_0x2a6407['hiddendigitsnum'])){var _0x9e2498=parseInt(_0x2a6407[_0xb39c('0x11a')],0xa);var _0x5982f7=rs[_0xb39c('0x11b')]({'charset':'*','length':_0x9e2498});var _0x6e21b=_0x269e47[_0xb39c('0xa2')];if(_0x6e21b>0x0){if(_0x6e21b>_0x9e2498){this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x2a6407,_0x2a6407[_0xb39c('0x11c')]===_0xb39c('0x11d')?_0x5982f7+_0x269e47[_0xb39c('0x11e')](_0x9e2498):_0x269e47['substr'](0x0,_0x6e21b-_0x9e2498)+_0x5982f7);}else{this[_0xb39c('0x37')]['sync'](this,_0x2a6407,rs[_0xb39c('0x11b')]({'charset':'*','length':_0x6e21b}));}}else{this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x2a6407,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x2a6407,_0x269e47);}return _0x4302b1;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x11f')]=function(_0x38f723){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x120'),_0x38f723[_0xb39c('0xad')]));return this['getdigits'](_0x38f723);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x121')]=function(_0x4f5cf1){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x122'),_0x4f5cf1['label']));this['createSquareDetailsReport'][_0xb39c('0x72')](this,_0x4f5cf1,_0x4f5cf1[_0xb39c('0x123')]);return this[_0xb39c('0xd')]['noop'](util['format'](_0xb39c('0x124'),_0x4f5cf1[_0xb39c('0x123')]));};AGIVertices['prototype'][_0xb39c('0x125')]=function(_0xbc154a){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x126'),_0xbc154a['label']));if(!this[_0xb39c('0x89')](_0xbc154a[_0xb39c('0x8c')])||!this['isConfigured'](_0xbc154a[_0xb39c('0x8d')])){return this[_0xb39c('0xd')][_0xb39c('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xbc154a['text'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0xbc154a[_0xb39c('0x5c')]));var _0x4b189b=this[_0xb39c('0x8b')][_0xb39c('0x72')](this,_0xbc154a);if(_0x4b189b){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x127'),_0x4b189b));var _0x191319=this[_0xb39c('0xd')][_0xb39c('0x103')](_0x4b189b);try{fs[_0xb39c('0x104')](_0x4b189b+_0xb39c('0x105'));}catch(_0x5a973f){logger[_0xb39c('0x2d')](_0x5a973f);}return _0x191319;}return this[_0xb39c('0xd')]['error'](_0xbc154a,_0xb39c('0x128'));};AGIVertices['prototype'][_0xb39c('0x129')]=function(_0x209dc0){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x12a'),_0x209dc0[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x8c')])||!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x8d')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0x12b'));}if(!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x94')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x12c'));}if(!this[_0xb39c('0x89')](_0x209dc0[_0xb39c('0x5c')])){return this['channel']['noop'](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xeb')]=!![];this['createSquareDetailsReport'](_0x209dc0);this[_0xb39c('0x42')](_0x209dc0['text'],'in','','');this[_0xb39c('0xd')]['noop'](util['format'](_0xb39c('0x12d'),_0x209dc0[_0xb39c('0x5c')]));var _0x57365b=this['awsLex'][_0xb39c('0x72')](this,_0x209dc0);if(_0x57365b){for(var _0x337ff0 in _0x57365b){if(_0x57365b[_0xb39c('0x9d')](_0x337ff0)&&_['isString'](_0x57365b[_0x337ff0])){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x12e'),_0x337ff0['toUpperCase']()),_0x57365b[_0x337ff0]);}}if(_[_0xb39c('0x46')](_0x57365b[_0xb39c('0x12f')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x130'));}else{this[_0xb39c('0x42')](_0x57365b[_0xb39c('0x12f')],_0xb39c('0xee'),_0xb39c('0x131'),'');return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x132'),_0x57365b[_0xb39c('0x12f')]));}}return this[_0xb39c('0xd')]['error'](_0x209dc0,_0xb39c('0x133'));};AGIVertices[_0xb39c('0x13')]['googleasr']=function(_0x13aaf1){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x134'),_0x13aaf1[_0xb39c('0xad')],_0x13aaf1[_0xb39c('0x66')]));if(!this[_0xb39c('0x89')](_0x13aaf1['key'])){return this[_0xb39c('0xd')]['noop']('no\x20key\x20configured');}var _0x33f1b8=_0xb39c('0x135');var _0x10cbce=util[_0xb39c('0x2a')](_0xb39c('0x136'),FILES_PATH,rs['generate'](0x4));var _0x3dd80e=util['format']('%s.%s',_0x10cbce,_0x33f1b8);var _0x505731=!![];if(_0x13aaf1['beep']===_0xb39c('0x137')){_0x505731=![];}var _0x547405=this['channel'][_0xb39c('0x138')](_0x10cbce,_0x33f1b8,_0x13aaf1[_0xb39c('0x139')],_0x13aaf1[_0xb39c('0x66')],undefined,_0x505731);if(_0x547405[_0xb39c('0xa6')]!==-0x1){this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x13a'),_0x3dd80e));var _0x127d63=this[_0xb39c('0x95')][_0xb39c('0x72')](this,_0x13aaf1,_0x3dd80e);if(_0x127d63){for(var _0x13204e in _0x127d63){if(_0x127d63[_0xb39c('0x9d')](_0x13204e)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x13b'),_0x13204e[_0xb39c('0x6b')]()),_0x127d63[_0x13204e]);}}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x13c'),JSON[_0xb39c('0x75')](_0x127d63)));}}return _0x547405;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x13d')]=function(_0x214987){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x13e'),_0x214987[_0xb39c('0xad')]));if(!this['isConfigured'](_0x214987[_0xb39c('0x13f')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x140'));}if(!this[_0xb39c('0x89')](_0x214987['appsecret'])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0x141'));}var _0x303b57=_0xb39c('0x135');var _0x3726ef=util['format'](_0xb39c('0x136'),FILES_PATH,rs[_0xb39c('0x11b')](0x4));var _0x4edf11=util['format'](_0xb39c('0xa1'),_0x3726ef,_0x303b57);var _0xf10c21=!![];if(_0x214987[_0xb39c('0x142')]==='NOBEEP'){_0xf10c21=![];}var _0x4c3933=this[_0xb39c('0xd')][_0xb39c('0x138')](_0x3726ef,_0x303b57,_0x214987[_0xb39c('0x139')],_0x214987['timeout'],undefined,_0xf10c21);if(_0x4c3933[_0xb39c('0xa6')]!==-0x1){this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x143'),_0x4edf11));var _0x14ab58=this[_0xb39c('0x97')][_0xb39c('0x72')](this,_0x214987,_0x4edf11);if(_0x14ab58){for(var _0x24d35d in _0x14ab58){if(_0x14ab58[_0xb39c('0x9d')](_0x24d35d)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x144'),_0x24d35d['toUpperCase']()),_0x14ab58[_0x24d35d]);}}return this['channel']['noop'](util['format'](_0xb39c('0x145'),JSON[_0xb39c('0x75')](_0x14ab58)));}}return _0x4c3933;};AGIVertices['prototype']['gotoc']=function(_0x40b2f2){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x146'),_0x40b2f2[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x147')](_0x40b2f2[_0xb39c('0x3c')],_0x40b2f2[_0xb39c('0x148')],_0x40b2f2['priority']);};AGIVertices['prototype'][_0xb39c('0x149')]=function(_0x427757){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x14a'),_0x427757['label']));if(!this['isConfigured'](_0x427757['condition'])){return this[_0xb39c('0xd')]['error'](_0x427757,_0xb39c('0x14b'));}try{var _0x259b68=eval(_0x427757['condition'])?_0xb39c('0x14c'):_0xb39c('0x14d');this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x427757[_0xb39c('0x14e')],_0x259b68));return{'code':0xc8,'result':_0x259b68};}catch(_0xd37b92){return{'code':0xc8,'result':_0xb39c('0x14d')};}};AGIVertices[_0xb39c('0x13')]['gotoiftime']=function(_0x3a9d0a){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x14f'),_0x3a9d0a[_0xb39c('0xad')]));if(!this['isConfigured'](_0x3a9d0a['interval_id'])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x3a9d0a,_0xb39c('0x150'));}var _0x19fbcf=this[_0xb39c('0x23')]['sync'](this,_0x3a9d0a['interval_id']);if(!_0x19fbcf){return this['channel'][_0xb39c('0x2d')](_0x3a9d0a,_0xb39c('0x151'));}for(var _0x7ec883=0x0;_0x7ec883<_0x19fbcf[_0xb39c('0xa2')];_0x7ec883+=0x1){var _0x33bbb8=this[_0xb39c('0xd')][_0xb39c('0xe')](util[_0xb39c('0x2a')]('IFTIME(%s?true:false)',_0x19fbcf[_0x7ec883]));if(_0x33bbb8[_0xb39c('0xa6')]===-0x1){return _0x33bbb8;}logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x152'),_0x19fbcf[_0x7ec883],_0x33bbb8['extra']));if(_0x33bbb8['extra']===_0xb39c('0x14c')){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x152'),_0x19fbcf[_0x7ec883],_0xb39c('0x14c')));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('IFTIME\x20%s\x20%s',_0x19fbcf[_0x7ec883],_0xb39c('0x14c')));return{'code':0xc8,'result':_0xb39c('0x14c')};}else{logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('IFTIME\x20%s\x20%s',_0x19fbcf[_0x7ec883],_0xb39c('0x14d')));this['channel']['noop'](util[_0xb39c('0x2a')](_0xb39c('0x152'),_0x19fbcf[_0x7ec883],'false'));}}return{'code':0xc8,'result':_0xb39c('0x14d')};};AGIVertices[_0xb39c('0x13')][_0xb39c('0x153')]=function(_0x269b90){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x154'),_0x269b90[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x153')]();};AGIVertices[_0xb39c('0x13')][_0xb39c('0x155')]=function(_0x4061f2){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x156'),_0x4061f2[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x4061f2[_0xb39c('0x7c')])){return this[_0xb39c('0xd')]['noop'](_0xb39c('0x157'));}var _0x3b97e3=_0xb39c('0x135');var _0x2b50ad=util[_0xb39c('0x2a')](_0xb39c('0x136'),FILES_PATH,rs['generate'](0x4));var _0xa45d5c=util[_0xb39c('0x2a')](_0xb39c('0xa1'),_0x2b50ad,_0x3b97e3);var _0x53b791=!![];if(_0x4061f2[_0xb39c('0x142')]===_0xb39c('0x137')){_0x53b791=![];}var _0x275504=this[_0xb39c('0xd')][_0xb39c('0x138')](_0x2b50ad,_0x3b97e3,_0x4061f2['intKey'],_0x4061f2[_0xb39c('0x66')],undefined,_0x53b791);if(_0x275504[_0xb39c('0xa6')]!==-0x1){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x158'),_0xa45d5c));var _0xdbdcd8=this['ispeechASR']['sync'](this,_0x4061f2,_0xa45d5c);if(_0xdbdcd8){for(var _0x3cf9ce in _0xdbdcd8){if(_0xdbdcd8['hasOwnProperty'](_0x3cf9ce)){this[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x159'),_0x3cf9ce['toUpperCase']()),_0xdbdcd8[_0x3cf9ce]);}}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x15a'),JSON[_0xb39c('0x75')](_0xdbdcd8)));}}return _0x275504;};AGIVertices[_0xb39c('0x13')][_0xb39c('0x15b')]=function(_0x79ac6e){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x79ac6e[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x79ac6e[_0xb39c('0x7c')])){return this['channel'][_0xb39c('0xae')](_0xb39c('0x157'));}if(!this[_0xb39c('0x89')](_0x79ac6e[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xae')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x79ac6e[_0xb39c('0x5c')]));var _0x2d7d53=this['ispeechTTS']['sync'](this,_0x79ac6e);if(_0x2d7d53){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('ispeech\x20%s\x20file\x20created',_0x2d7d53));var _0x5e8812=this['channel']['streamFile'](_0x2d7d53,_0x79ac6e[_0xb39c('0x139')]);try{fs[_0xb39c('0x104')](_0x2d7d53+_0xb39c('0x105'));}catch(_0x4de4f3){logger[_0xb39c('0x2d')](_0x4de4f3);}return _0x5e8812;}return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x79ac6e,_0xb39c('0x15c'));};AGIVertices['prototype'][_0xb39c('0x15d')]=function(_0x471787){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x15e'),_0x471787[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x471787[_0xb39c('0x15f')])){return this[_0xb39c('0xd')]['error'](_0x471787,_0xb39c('0x160'));}logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x161'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x471787['findBy']));var _0x213ad6=this[_0xb39c('0x53')][_0xb39c('0x72')](this,_0x471787[_0xb39c('0x15f')]);if(_0x213ad6){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x471787[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0x162'),this[_0xb39c('0xd')]['callerid'],_0x471787['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb39c('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xb39c('0x39')],_0x471787[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x163'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x471787[_0xb39c('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb39c('0x13')][_0xb39c('0x164')]=function(_0x283fc2){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x283fc2[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x283fc2[_0xb39c('0x15f')])){return this['channel'][_0xb39c('0x2d')](_0x283fc2,_0xb39c('0x160'));}logger[_0xb39c('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb39c('0xd')]['callerid'],_0x283fc2[_0xb39c('0x15f')]));var _0x17bc39=this['agentLogout'][_0xb39c('0x72')](this,_0x283fc2['findBy']);if(_0x17bc39){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x162'),this['channel']['callerid'],_0x283fc2['findBy']));this['channel'][_0xb39c('0xae')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb39c('0xd')][_0xb39c('0x39')],_0x283fc2['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb39c('0xd')][_0xb39c('0x39')],_0x283fc2[_0xb39c('0x15f')]));this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb39c('0xd')]['callerid'],_0x283fc2[_0xb39c('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xb39c('0x165')]=function(_0x3a9add){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3a9add[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x3a9add['operation'])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x3a9add,_0xb39c('0x166'));}this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x167'),_0x3a9add[_0xb39c('0x168')]));var _0x55340c=eval(_0x3a9add['operation']);if(!this['isConfigured'](_0x3a9add['variable_id'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xdc'));}var _0x27b0fd=this[_0xb39c('0xe')]['sync'](this,_0x3a9add['variable_id']);if(!_0x27b0fd){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x3a9add,_0xb39c('0x119'));}if(_['isArray'](_0x55340c)){var _0x39dfce=this;_0x55340c[_0xb39c('0xdd')](function(_0x220f02,_0x4f6730){_0x39dfce[_0xb39c('0xd')][_0xb39c('0xa9')](util[_0xb39c('0x2a')](_0xb39c('0x169'),_0x27b0fd,_0x4f6730),_0x220f02);});return this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x16a'),_0x27b0fd));}else{return this[_0xb39c('0xd')][_0xb39c('0xa9')](_0x27b0fd,_0x55340c);}};AGIVertices[_0xb39c('0x13')]['menu']=function(_0x259a66){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x16b'),_0x259a66[_0xb39c('0xad')]));if(_0x259a66[_0xb39c('0x112')]===0x0){return this[_0xb39c('0xaa')](_0x259a66);}_0x259a66['retry']-=0x1;if(!this[_0xb39c('0x89')](_0x259a66['file_id'])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x259a66,_0xb39c('0x114'));}var _0x5ca753=this[_0xb39c('0x1e')][_0xb39c('0x72')](this,_0x259a66[_0xb39c('0x113')]);if(!_0x5ca753){return this['channel']['error'](_0x259a66,_0xb39c('0x115'));}var _0x1b6618=this['channel'][_0xb39c('0x16c')](_0x5ca753,_0x259a66['response'],_0x259a66[_0xb39c('0x16d')]);var _0x410b9f=_0x1b6618[_0xb39c('0xa6')];if(_0x1b6618[_0xb39c('0xa6')]===-0x1){this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x259a66,'-1');return _0x1b6618;}else if(_0x1b6618['extra']===_0xb39c('0x66')){_0x1b6618[_0xb39c('0xa6')]=_0x1b6618['result'][_0xb39c('0xa2')]>0x0?_0x1b6618['result']:'t';}else if(_['isEmpty'](_0x1b6618['result'])){_0x1b6618[_0xb39c('0xa6')]='#';_0x410b9f='#';}if(!this[_0xb39c('0x89')](_0x259a66[_0xb39c('0xdb')])){this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xdc'));}else{var _0x4cb84e=this['getVariable'][_0xb39c('0x72')](this,_0x259a66['variable_id']);if(!_0x4cb84e){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x259a66,_0xb39c('0x119'));}this[_0xb39c('0xd')]['setVariable'](_0x4cb84e,_0x410b9f);}this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x259a66,_0x410b9f);return _0x1b6618;};AGIVertices[_0xb39c('0x13')][_0xb39c('0xae')]=function(_0x4d6699){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x16e'),_0x4d6699[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0x4d6699[_0xb39c('0x16f')]||_0x4d6699[_0xb39c('0xad')]);};AGIVertices['prototype'][_0xb39c('0x170')]=function(_0x4af1b1){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x171'),_0x4af1b1[_0xb39c('0xad')]));if(!this['isConfigured'](_0x4af1b1['findBy'])){return this['channel']['error'](_0x4af1b1,'no\x20find\x20by\x20configured');}logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x161'),this['channel'][_0xb39c('0x39')],_0x4af1b1[_0xb39c('0x15f')]));var _0x5330b9=this[_0xb39c('0x4d')][_0xb39c('0x72')](this,_0x4af1b1[_0xb39c('0x172')]);var _0x1ddfd4=this[_0xb39c('0x4f')][_0xb39c('0x72')](this,_0x4af1b1[_0xb39c('0x15f')],_0x5330b9);if(_0x1ddfd4){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb39c('0x39')],_0x4af1b1['findBy']));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb39c('0xd')]['callerid'],_0x4af1b1['findBy']));return{'code':0xc8,'result':_0xb39c('0x173')};}else{logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x163'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x4af1b1[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x4af1b1[_0xb39c('0x15f')]));return{'code':0xc8,'result':_0xb39c('0x174')};}};AGIVertices[_0xb39c('0x13')]['playback']=function(_0x592681){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x175'),_0x592681[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x592681[_0xb39c('0x113')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x592681,_0xb39c('0x114'));}var _0x3c6168=this[_0xb39c('0x1e')]['sync'](this,_0x592681[_0xb39c('0x113')]);if(!_0x3c6168){return this['channel'][_0xb39c('0x2d')](_0x592681,'no\x20file\x20audio\x20found');}var _0x5e4a9d=this[_0xb39c('0xd')]['exec'](_0xb39c('0x176'),[_0x3c6168,_0x592681[_0xb39c('0xe8')]]);if(_0x5e4a9d[_0xb39c('0xa6')]===-0x1){return _0x5e4a9d;}return this['channel']['noop'](util['format'](_0xb39c('0xc8'),_0xb39c('0x176'),_0x3c6168));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x177')]=function(_0x137bd1){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x178'),_0x137bd1['label']));if(!this[_0xb39c('0x89')](_0x137bd1[_0xb39c('0x179')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x137bd1,_0xb39c('0x17a'));}var _0xb330ee='';var _0x471c12=parseInt(_0x137bd1[_0xb39c('0x179')],0xa);if(isNaN(_0x471c12)){_0xb330ee=_0x137bd1[_0xb39c('0x179')];}else{_0xb330ee=this[_0xb39c('0x14')][_0xb39c('0x72')](this,_0x137bd1[_0xb39c('0x179')]);if(!_0xb330ee){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x137bd1,'no\x20queue\x20found');}}var _0x82e970='';if(this[_0xb39c('0x89')](_0x137bd1[_0xb39c('0x113')])){var _0x111f1e=this['getSound']['sync'](this,_0x137bd1[_0xb39c('0x113')]);if(_0x111f1e){_0x82e970=_0x111f1e;}}this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x137bd1,_0xb330ee);if(_0x137bd1[_0xb39c('0xe8')][_0xb39c('0x17b')]('x')<0x0){_0x137bd1[_0xb39c('0xe8')]+='x';}if(_0x137bd1[_0xb39c('0xe8')][_0xb39c('0x17b')]('X')<0x0){_0x137bd1[_0xb39c('0xe8')]+='X';}this[_0xb39c('0xd')]['setVariable'](_0xb39c('0x17c'),_0xb330ee?_0xb330ee['toLowerCase']():'');var _0x1064a3=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0x17d'),[_0xb330ee,_0x137bd1[_0xb39c('0xe8')],_0x137bd1[_0xb39c('0x64')],_0x82e970,_0x137bd1[_0xb39c('0x66')],_0x137bd1['agi'],_0x137bd1['macro'],_0x137bd1[_0xb39c('0x17e')],'',_0x137bd1[_0xb39c('0x17f')]]);if(_0x1064a3['result']===-0x1){return _0x1064a3;}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xc8'),_0xb39c('0x17d'),_0xb330ee));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x180')]=function(_0x2c6195){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2c6195[_0xb39c('0xad')]));var _0x3d35d8=_0x2c6195[_0xb39c('0x181')]||_0xb39c('0x135');var _0x1fe27d=util[_0xb39c('0x2a')](_0xb39c('0x182'),this['channel'][_0xb39c('0x38')],rs[_0xb39c('0x11b')](0x5));var _0xe8bc4b=util[_0xb39c('0x2a')](_0xb39c('0x183'),FILES_PATH,_0x1fe27d,_0x3d35d8);var _0x1e3763=util[_0xb39c('0x2a')](_0xb39c('0x136'),FILES_PATH,_0x1fe27d);this[_0xb39c('0x3a')][_0xb39c('0x72')](this,_0x2c6195,_0x1fe27d,_0xe8bc4b);this[_0xb39c('0xd')][_0xb39c('0xa9')](_0xb39c('0x184'),_0x1fe27d);logger[_0xb39c('0x31')](_0xb39c('0x185'),_0x1e3763,_0x3d35d8,_0x2c6195[_0xb39c('0x186')],_0x2c6195[_0xb39c('0x66')]);return this['channel'][_0xb39c('0x138')](_0x1e3763,_0x3d35d8,_0x2c6195[_0xb39c('0x186')],_0x2c6195['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xb39c('0x187')]=function(_0x135997){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x188'),_0x135997[_0xb39c('0xad')]));if(!this['isConfigured'](_0x135997[_0xb39c('0x64')])){return this[_0xb39c('0xd')]['noop']('no\x20url\x20configured');}var _0x2c1dff=this[_0xb39c('0x63')][_0xb39c('0x72')](this,_0x135997);logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Response:',util[_0xb39c('0x189')](_0x2c1dff,{'showHidden':![],'depth':null})));if(!this[_0xb39c('0x89')](_0x135997['variable_id'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x18a'));}var _0x549303=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x135997[_0xb39c('0xdb')]);if(!_0x549303){return this['channel'][_0xb39c('0x2d')](_0x135997,_0xb39c('0x119'));}this[_0xb39c('0xd')][_0xb39c('0xa9')](util['format'](_0xb39c('0x18b'),_0x549303),_0x2c1dff[_0xb39c('0x77')]?_0x2c1dff[_0xb39c('0x77')]:_0xb39c('0x18c'));this['channel'][_0xb39c('0xa9')](util[_0xb39c('0x2a')]('%s_STATUS_MESSAGE',_0x549303),_0x2c1dff['statusMessage']?_0x2c1dff[_0xb39c('0x78')]:'OK');if(_0x2c1dff[_0xb39c('0x6c')]){try{this[_0xb39c('0xa0')](_0x2c1dff[_0xb39c('0x6c')],_0x549303);}catch(_0x462c29){logger['error'](util[_0xb39c('0x2a')](_0xb39c('0x18d'),_0x549303));}}return this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')]('variable\x20%s\x20set',_0x549303));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x18e')]=function(_0x1145d7){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x18f'),_0x1145d7['label']));return this[_0xb39c('0xd')]['sayDigits'](_0x1145d7[_0xb39c('0x190')][_0xb39c('0x58')](/\s+/g,''),_0x1145d7[_0xb39c('0x186')]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x191')]=function(_0x13b33d){logger['info'](util[_0xb39c('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x13b33d[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x192')](_0x13b33d['number'][_0xb39c('0x58')](/\s+/g,''),_0x13b33d['escape_digits']);};AGIVertices[_0xb39c('0x13')]['sayphonetic']=function(_0x217eb6){logger[_0xb39c('0x31')](util['format'](_0xb39c('0x193'),_0x217eb6[_0xb39c('0xad')]));return this[_0xb39c('0xd')][_0xb39c('0x194')](_0x217eb6[_0xb39c('0x5c')],_0x217eb6[_0xb39c('0x186')]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x195')]=function(_0x3c508b){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x196'),_0x3c508b[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x3c508b[_0xb39c('0x197')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x198'));}var _0x34ee73=this['getMailAccount'][_0xb39c('0x72')](this,_0x3c508b[_0xb39c('0x197')]);if(!_0x34ee73||!_0x34ee73[_0xb39c('0x199')]){return this['channel']['error'](_0x3c508b,_0xb39c('0x19a'));}var _0x28b364={'from':util[_0xb39c('0x2a')](_0xb39c('0x19b'),_0x34ee73[_0xb39c('0x12')],_0x34ee73['email']||_0x34ee73[_0xb39c('0x199')]['user']),'to':_0x3c508b['to']||'','cc':_0x3c508b['cc']||'','bcc':_0x3c508b[_0xb39c('0x19c')]||'','subject':_0x3c508b[_0xb39c('0x19d')],'html':_0x3c508b['text'],'text':_0x3c508b[_0xb39c('0x5c')]};if(this[_0xb39c('0x89')](_0x3c508b[_0xb39c('0x19e')])){}logger[_0xb39c('0x19f')]('sendMail\x20message',JSON['stringify'](_0x28b364));this[_0xb39c('0x37')]['sync'](this,_0x3c508b,_0x3c508b[_0xb39c('0x197')]);this[_0xb39c('0xd')][_0xb39c('0xae')](util['format'](_0xb39c('0x1a0'),_0x34ee73[_0xb39c('0x12')]));this[_0xb39c('0x1a1')][_0xb39c('0x72')](this,_0x34ee73[_0xb39c('0x1a2')],_0x28b364);return this[_0xb39c('0xd')][_0xb39c('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1a3')]=function(_0x2200b1){logger['info'](util[_0xb39c('0x2a')](_0xb39c('0x1a4'),_0x2200b1['label']));return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1a5'));};AGIVertices['prototype']['sendSMS']=function(_0x11b324){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1a6'),_0x11b324[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x11b324['sms_account_id'])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1a7'));}var _0x540115=this[_0xb39c('0x34')]['sync'](this,_0x11b324['sms_account_id']);if(!_0x540115){return this['channel'][_0xb39c('0x2d')](_0x11b324,_0xb39c('0x1a8'));}var _0x470b63={'body':_0x11b324['sms_text'],'phone':_0x11b324['to']||'','SmsAccountId':_0x540115['id']};logger[_0xb39c('0x19f')](_0xb39c('0x1a9'),JSON[_0xb39c('0x75')](_0x470b63));this[_0xb39c('0x37')]['sync'](this,_0x11b324,_0x11b324[_0xb39c('0x1aa')]);this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1ab'),_0x540115[_0xb39c('0x12')]));this[_0xb39c('0x36')][_0xb39c('0x72')](this,_0x470b63);return this[_0xb39c('0xd')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb39c('0x13')]['set']=function(_0x221b63){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1ac'),_0x221b63[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x221b63[_0xb39c('0xdb')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x221b63,'no\x20variable\x20selected');}var _0xadebe1=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x221b63['variable_id']);if(!_0xadebe1){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x221b63,'no\x20variable\x20found');}return this['channel']['setVariable'](_0xadebe1,_0x221b63[_0xb39c('0x1ad')]);};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1ae')]=function(_0x25c64d){logger[_0xb39c('0x31')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x25c64d[_0xb39c('0xad')]));this['channel']['noop'](_0xb39c('0x1af'));if(_0x25c64d[_0xb39c('0xbd')]===_0xb39c('0x1b0')){this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1b1'));return this[_0xb39c('0xd')][_0xb39c('0xbd')]();}return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0x1b2'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1b3')]=function(_0x68a5ca){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1b4'),_0x68a5ca[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x68a5ca[_0xb39c('0x1b5')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x68a5ca,_0xb39c('0x1b6'));}var _0x1ec221=this[_0xb39c('0x17')]['sync'](this,_0x68a5ca[_0xb39c('0x1b5')]);if(!this['isConfigured'](_0x1ec221)){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x68a5ca,util[_0xb39c('0x2a')](_0xb39c('0x1b7'),_0x68a5ca[_0xb39c('0x1b5')]));}if(_0x1ec221===this['channel'][_0xb39c('0x40')]){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x68a5ca,_0xb39c('0x1b8'));}this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x68a5ca,_0x1ec221);var _0x3130be=this[_0xb39c('0xd')][_0xb39c('0xb0')](_0xb39c('0x1b9'),util[_0xb39c('0x2a')](_0xb39c('0x1ba'),config[_0xb39c('0x6')][_0xb39c('0x1bb')]||_0xb39c('0x1bc'),_0x1ec221,this['channel'][_0xb39c('0x40')]));if(_0x3130be[_0xb39c('0xa6')]===-0x1){return _0x3130be;}return this['channel'][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0xc8'),'AGI',_0x1ec221));};AGIVertices[_0xb39c('0x13')]['system']=function(_0x38d641){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1bd'),_0x38d641['label']));var _0x794cbf=this[_0xb39c('0x1be')][_0xb39c('0x72')](this,_0x38d641[_0xb39c('0x1bf')]);this[_0xb39c('0x37')][_0xb39c('0x72')](this,_0x38d641,_0x38d641[_0xb39c('0x1bf')]);if(this[_0xb39c('0x89')](_0x38d641['variable_id'])){var _0x5e78db=this[_0xb39c('0xe')]['sync'](this,_0x38d641[_0xb39c('0xdb')]);if(_0x5e78db){this[_0xb39c('0xd')][_0xb39c('0xa9')](_0x5e78db,_0x794cbf);return this[_0xb39c('0xd')]['noop'](util['format'](_0xb39c('0x1c0'),_0x38d641[_0xb39c('0x1bf')],_0x5e78db));}}return this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c1'),_0x38d641[_0xb39c('0x1bf')]));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1c2')]=function(_0x1c698f){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1c698f[_0xb39c('0xad')]));_0x1c698f[_0xb39c('0x5c')]=_0x1c698f[_0xb39c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb39c('0x89')](_0x1c698f['apiKey'])){return this['channel']['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x1c698f[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c3'),_0x1c698f[_0xb39c('0x5c')]));var _0x500250=this[_0xb39c('0x59')]['sync'](this,_0x1c698f);if(_0x500250){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c4'),_0x500250));var _0x1d96a2=this[_0xb39c('0xd')]['streamFile'](_0x500250);try{fs[_0xb39c('0x104')](_0x500250+_0xb39c('0x105'));}catch(_0x46e1d5){logger['error'](_0x46e1d5);}return _0x1d96a2;}return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x1c698f,_0xb39c('0x1c5'));};AGIVertices[_0xb39c('0x13')][_0xb39c('0x1c6')]=function(_0x2d2bdd){logger[_0xb39c('0x31')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2d2bdd[_0xb39c('0xad')]));_0x2d2bdd[_0xb39c('0x5c')]=_0x2d2bdd[_0xb39c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2d2bdd[_0xb39c('0x5c')])){return this[_0xb39c('0xd')][_0xb39c('0xae')](_0xb39c('0xaf'));}this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x1c7'),_0x2d2bdd[_0xb39c('0x5c')]));var _0xda4c06=this[_0xb39c('0x61')][_0xb39c('0x72')](this,_0x2d2bdd);if(_0xda4c06){this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x1c8'),_0xda4c06));var _0x67fb4f=this[_0xb39c('0xd')][_0xb39c('0x103')](_0xda4c06);try{fs[_0xb39c('0x104')](_0xda4c06+_0xb39c('0x105'));}catch(_0x43393a){logger[_0xb39c('0x2d')](_0x43393a);}return _0x67fb4f;}return this['channel'][_0xb39c('0x2d')](_0x2d2bdd,_0xb39c('0x1c9'));};AGIVertices['prototype'][_0xb39c('0x1ca')]=function(_0x382b0b){logger['info'](util['format'](_0xb39c('0x1cb'),_0x382b0b[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x382b0b['findBy'])){return this[_0xb39c('0xd')]['error'](_0x382b0b,_0xb39c('0x160'));}logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x161'),this['channel'][_0xb39c('0x39')],_0x382b0b[_0xb39c('0x15f')]));var _0x289a88=this[_0xb39c('0x50')]['sync'](this,_0x382b0b['findBy']);if(_0x289a88){logger['info'](util['format'](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x382b0b[_0xb39c('0x15f')]));this[_0xb39c('0xd')]['noop'](util[_0xb39c('0x2a')](_0xb39c('0x162'),this[_0xb39c('0xd')][_0xb39c('0x39')],_0x382b0b[_0xb39c('0x15f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb39c('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb39c('0xd')]['callerid'],_0x382b0b[_0xb39c('0x15f')]));this[_0xb39c('0xd')][_0xb39c('0xae')](util[_0xb39c('0x2a')](_0xb39c('0x163'),this[_0xb39c('0xd')]['callerid'],_0x382b0b[_0xb39c('0x15f')]));return{'code':0xc8,'result':_0xb39c('0x174')};}};AGIVertices[_0xb39c('0x13')]['voicemail']=function(_0x2e4335){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1cc'),_0x2e4335['label']));var _0x33c22d=this[_0xb39c('0xd')]['exec']('VOICEMAIL',[_0x2e4335[_0xb39c('0x1cd')],_0x2e4335[_0xb39c('0x7a')]]);if(_0x33c22d[_0xb39c('0xa6')]===-0x1){return _0x33c22d;}return this['channel']['noop'](util['format'](_0xb39c('0xc8'),'VOICEMAIL',_0x2e4335[_0xb39c('0x1cd')]));};AGIVertices['prototype'][_0xb39c('0x1ce')]=function(_0x14af29){logger[_0xb39c('0x31')](util[_0xb39c('0x2a')](_0xb39c('0x1cf'),_0x14af29[_0xb39c('0xad')]));if(!this[_0xb39c('0x89')](_0x14af29[_0xb39c('0xdb')])){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x14af29,_0xb39c('0x1d0'));}var _0xeab725=this[_0xb39c('0xe')][_0xb39c('0x72')](this,_0x14af29[_0xb39c('0xdb')]);if(!_0xeab725){return this[_0xb39c('0xd')][_0xb39c('0x2d')](_0x14af29,_0xb39c('0x119'));}var _0x25d5bd=this['channel'][_0xb39c('0xe')](_0xeab725);return{'code':0xc8,'result':_0x25d5bd[_0xb39c('0xa8')]?_0x25d5bd['extra']:'-'};};String[_0xb39c('0x13')][_0xb39c('0xa4')]=function(_0x1f38d1,_0x24208e){return this[_0xb39c('0xa3')](_0x1f38d1)[_0xb39c('0x1d1')](_0x24208e);};module[_0xb39c('0x1d2')]=AGIVertices; \ No newline at end of file +var _0xffaa=['result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','mrcpsynth','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable'];(function(_0x1e3801,_0x4a19a8){var _0x9ba139=function(_0x5859ef){while(--_0x5859ef){_0x1e3801['push'](_0x1e3801['shift']());}};_0x9ba139(++_0x4a19a8);}(_0xffaa,0x130));var _0xaffa=function(_0xfe17b6,_0x769d7a){_0xfe17b6=_0xfe17b6-0x0;var _0x3a8469=_0xffaa[_0xfe17b6];return _0x3a8469;};'use strict';var fs=require('fs');var util=require(_0xaffa('0x0'));var _=require(_0xaffa('0x1'));var sh=require(_0xaffa('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xaffa('0x3'));var Mustache=require(_0xaffa('0x4'));var rp=require(_0xaffa('0x5'));var logger=require(_0xaffa('0x6'))(_0xaffa('0x7'));var config=require(_0xaffa('0x8'));var shared=require(_0xaffa('0x9'));var scripts=require(_0xaffa('0xa'));var FILES_PATH=_0xaffa('0xb');var recursiveMapAttributes=[_0xaffa('0xc'),'rawBody'];var verticesWithRetry=[_0xaffa('0xd'),_0xaffa('0xe'),_0xaffa('0xf')];var AGIVertices=function(_0x3c7409,_0x5d2ebb,_0x32eeca){this['channel']=_0x3c7409;this[_0xaffa('0x10')]=_0x5d2ebb;this[_0xaffa('0x11')]=_0x32eeca;};AGIVertices[_0xaffa('0x12')]['getVariable']=function(_0x2a1b87,_0x5ce8ae){this['rpc']['getVariableById'](_0x2a1b87)[_0xaffa('0x13')](function(_0x5efbe8){_0x5ce8ae(null,_0x5efbe8?_0x5efbe8[_0xaffa('0x14')]:![]);})['catch'](function(_0x3806e9){_0x5ce8ae(_0x3806e9);});};AGIVertices['prototype'][_0xaffa('0x15')]=function(_0x5b238c,_0xd8e9c6){this[_0xaffa('0x10')][_0xaffa('0x16')](_0x5b238c)[_0xaffa('0x13')](function(_0x14f495){_0xd8e9c6(null,_0x14f495?_0x14f495[_0xaffa('0x14')]:![]);})[_0xaffa('0x17')](function(_0x323a2f){_0xd8e9c6(_0x323a2f);});};AGIVertices['prototype'][_0xaffa('0x18')]=function(_0x10fecb,_0x4b7d89){this[_0xaffa('0x10')]['getSquareProjectById'](_0x10fecb)[_0xaffa('0x13')](function(_0x2d57ab){_0x4b7d89(null,_0x2d57ab?_0x2d57ab[_0xaffa('0x14')]:![]);})[_0xaffa('0x17')](function(_0x28b5c8){_0x4b7d89(_0x28b5c8);});};AGIVertices[_0xaffa('0x12')]['getSquareOdbc']=function(_0x34d70f,_0x2b2040){this[_0xaffa('0x10')][_0xaffa('0x19')](_0x34d70f)[_0xaffa('0x13')](function(_0x16297d){_0x2b2040(null,_0x16297d?_0x16297d[_0xaffa('0x1a')]:![]);})['catch'](function(_0x520d62){_0x2b2040(_0x520d62);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1b')]=function(_0x45c856,_0x2f5091){this['rpc']['getUserById'](_0x45c856)[_0xaffa('0x13')](function(_0x3f7dee){_0x2f5091(null,_0x3f7dee?_0x3f7dee['name']:![]);})[_0xaffa('0x17')](function(_0x298e2b){_0x2f5091(_0x298e2b);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1c')]=function(_0x1d83ce,_0x2f1320){this['rpc'][_0xaffa('0x1d')](_0x1d83ce)[_0xaffa('0x13')](function(_0x4b7994){_0x2f1320(null,_0x4b7994?_0x4b7994['name']:![]);})[_0xaffa('0x17')](function(_0x46ac99){_0x2f1320(_0x46ac99);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1e')]=function(_0x247915,_0x411448){var _0x2faf48=this;this[_0xaffa('0x10')][_0xaffa('0x1f')](_0x247915)[_0xaffa('0x13')](function(_0x272657){_0x411448(null,_0x272657?_0x2faf48[_0xaffa('0x20')](_0x272657['save_name']):![]);})['catch'](function(_0x1fd7f7){_0x411448(_0x1fd7f7);});};AGIVertices[_0xaffa('0x12')]['getMailAccount']=function(_0x571540,_0x5c6412){this[_0xaffa('0x10')][_0xaffa('0x21')](_0x571540)[_0xaffa('0x13')](function(_0x50ca99){_0x5c6412(null,_0x50ca99?_0x50ca99:![]);})[_0xaffa('0x17')](function(_0x3d5038){_0x5c6412(_0x3d5038);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x22')]=function(_0x27506b,_0x3dd1e5,_0x17ada5){this[_0xaffa('0x11')][_0xaffa('0x22')](_0x27506b,_0x3dd1e5)[_0xaffa('0x13')](function(){_0x17ada5(null);})['catch'](function(_0x39b45c){_0x17ada5(_0x39b45c);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x23')]=function(_0x3fde8a,_0x442967){this[_0xaffa('0x10')][_0xaffa('0x24')](_0x3fde8a)[_0xaffa('0x13')](function(_0x5aa4a5){if(_0x5aa4a5){if(_0x5aa4a5['IntervalId']){_0x442967(null,[_0x5aa4a5[_0xaffa('0x25')]]);}else{_0x442967(null,_['map'](_0x5aa4a5['Intervals'],_0xaffa('0x25')));}}else{_0x442967(null,![]);}})[_0xaffa('0x17')](function(_0x1acb87){_0x442967(_0x1acb87);});};AGIVertices[_0xaffa('0x12')]['getSoundPath']=function(_0x5795d3){return util[_0xaffa('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x5795d3);};AGIVertices[_0xaffa('0x12')][_0xaffa('0x27')]=function(_0x5129df,_0x592a76,_0x351e0c){odbc[_0xaffa('0x28')](_0x5129df,function(_0x2dc3ae){if(_0x2dc3ae){logger[_0xaffa('0x29')](_0xaffa('0x2a'),_0x2dc3ae);_0x351e0c(_0x2dc3ae);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xaffa('0x2b')](_0x592a76,function(_0x422b54,_0x574722){if(_0x422b54){logger[_0xaffa('0x2c')](_0xaffa('0x2d'),_0x592a76);_0x351e0c(_0x422b54);}else{logger[_0xaffa('0x2c')](_0xaffa('0x2e'),_0x592a76);odbc[_0xaffa('0x2f')](function(_0x54cd4d){if(_0x54cd4d){logger[_0xaffa('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x54cd4d);}_0x351e0c(null,_0x574722);});}});}});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x30')]=function(_0x26b84e,_0x5e0561){this['rpc']['getSmsAccountById'](_0x26b84e)[_0xaffa('0x13')](function(_0x197418){_0x5e0561(null,_0x197418?_0x197418:![]);})[_0xaffa('0x17')](function(_0x5bbc63){_0x5e0561(_0x5bbc63);});};AGIVertices[_0xaffa('0x12')]['createSmsMessage']=function(_0x2215b3,_0x4a6ded){this['rpc'][_0xaffa('0x31')](_0x2215b3)[_0xaffa('0x13')](function(_0x2cbb42){_0x4a6ded(null,_0x2cbb42);})[_0xaffa('0x17')](function(_0x2ca7a5){_0x4a6ded(_0x2ca7a5);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x32')]=function(_0x263058,_0x8510ee,_0x444c51){this['rpc'][_0xaffa('0x32')]({'uniqueid':this[_0xaffa('0x33')][_0xaffa('0x34')],'node':_0x263058[_0xaffa('0x35')],'application':_0x263058[_0xaffa('0x36')],'data':_0x8510ee||null,'project_name':this[_0xaffa('0x33')][_0xaffa('0x37')],'callerid':this[_0xaffa('0x33')]['callerid']})[_0xaffa('0x13')](function(_0x4a98c3){if(_0x444c51){_0x444c51(null,_0x4a98c3);}})[_0xaffa('0x17')](function(_0x447c79){if(_0x444c51){_0x444c51(_0x447c79);}});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x38')]=function(_0x5a4fa5,_0x5bbab6,_0x460aed,_0x590849){this[_0xaffa('0x10')][_0xaffa('0x38')]({'uniqueid':this['channel'][_0xaffa('0x34')],'callerid':this[_0xaffa('0x33')][_0xaffa('0x39')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0xaffa('0x3a')],'extension':this['channel'][_0xaffa('0x3b')],'priority':this[_0xaffa('0x33')][_0xaffa('0x3c')],'accountcode':this['channel'][_0xaffa('0x3d')],'dnid':this[_0xaffa('0x33')][_0xaffa('0x3e')],'projectName':this[_0xaffa('0x33')][_0xaffa('0x37')],'saveName':_0x5bbab6,'filename':_0x5a4fa5['file']||_0x5bbab6,'savePath':_0x460aed})[_0xaffa('0x13')](function(_0x30ab7f){_0x590849(null,_0x30ab7f);})['catch'](function(_0x5b2a50){_0x590849(_0x5b2a50);});};AGIVertices['prototype'][_0xaffa('0x3f')]=function(_0x1a52f6,_0xed274d,_0x53ebd5,_0xd3d489,_0x5465b4){this[_0xaffa('0x10')][_0xaffa('0x3f')]({'uniqueid':this[_0xaffa('0x33')][_0xaffa('0x34')],'body':_0x1a52f6,'direction':_0xed274d,'providerName':_0x53ebd5,'providerResponse':_0xd3d489})[_0xaffa('0x13')](function(_0x301608){if(_0x5465b4){_0x5465b4(null,_0x301608);}})['catch'](function(_0x2a1d62){if(_0x5465b4){_0x5465b4(_0x2a1d62);}});};AGIVertices['prototype'][_0xaffa('0x40')]=function(_0x4bf9fc,_0x4da6ad){this[_0xaffa('0x10')]['createCmContact']({'firstName':_[_0xaffa('0x41')](_0x4bf9fc[_0xaffa('0x14')])||_[_0xaffa('0x42')](_0x4bf9fc[_0xaffa('0x14')])?_0xaffa('0x43')+Math[_0xaffa('0x44')]():_0x4bf9fc['name'],'lastName':_[_0xaffa('0x41')](_0x4bf9fc['lastName'])||_['isNil'](_0x4bf9fc[_0xaffa('0x45')])?null:_0x4bf9fc[_0xaffa('0x45')],'phone':_0x4bf9fc[_0xaffa('0x46')],'ListId':_0x4bf9fc['list_id'],'scheduledat':_0x4bf9fc[_0xaffa('0x47')],'callbackUniqueid':this[_0xaffa('0x33')][_0xaffa('0x34')],'tags':_0xaffa('0x48'),'description':_0xaffa('0x49')+_0x4bf9fc['scheduledAt'][_0xaffa('0x4a')](),'priority':_0x4bf9fc[_0xaffa('0x4b')]})[_0xaffa('0x13')](function(_0x13adef){_0x4da6ad(null,_0x13adef);})[_0xaffa('0x17')](function(_0x11f5dd){_0x4da6ad(_0x11f5dd);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x4c')]=function(_0x1b13d0,_0x1ac791){this[_0xaffa('0x10')][_0xaffa('0x4d')](_0x1b13d0)[_0xaffa('0x13')](function(_0x1c93f5){_0x1ac791(null,_0x1c93f5?_0x1c93f5['name']:![]);})['catch'](function(_0x12cc0e){_0x1ac791(_0x12cc0e);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x4e')]=function(_0x3b5588,_0x5c72a2,_0xda2ec4){var _0x37b2cc={'role':_0xaffa('0x4f')};_0x37b2cc[_0x3b5588]=this[_0xaffa('0x33')][_0xaffa('0x39')];this[_0xaffa('0x10')][_0xaffa('0x4e')](_0x37b2cc,_0x5c72a2,this['channel'][_0xaffa('0x34')])[_0xaffa('0x13')](function(_0x5efb37){_0xda2ec4(null,_['isNil'](_0x5efb37)?![]:!![]);})[_0xaffa('0x17')](function(_0x315434){logger[_0xaffa('0x29')](_0x315434);_0xda2ec4(null,![]);});};AGIVertices[_0xaffa('0x12')]['agentUnpause']=function(_0x5d55fd,_0x31b03a){var _0x5c5bf7={'role':_0xaffa('0x4f')};_0x5c5bf7[_0x5d55fd]=this[_0xaffa('0x33')][_0xaffa('0x39')];this[_0xaffa('0x10')][_0xaffa('0x50')](_0x5c5bf7)[_0xaffa('0x13')](function(_0x1fbc30){_0x31b03a(null,_[_0xaffa('0x42')](_0x1fbc30)?![]:!![]);})[_0xaffa('0x17')](function(_0xdd5ecb){logger[_0xaffa('0x29')](_0xdd5ecb);_0x31b03a(null,![]);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x51')]=function(_0x160864,_0x5d2b5f){var _0x589acd={'role':_0xaffa('0x4f')};_0x589acd[_0x160864]=this[_0xaffa('0x33')][_0xaffa('0x39')];this[_0xaffa('0x10')]['agentLogout'](_0x589acd)['then'](function(_0x3bc444){_0x5d2b5f(null,_[_0xaffa('0x42')](_0x3bc444)?![]:!![]);})[_0xaffa('0x17')](function(_0x54a6c5){logger[_0xaffa('0x29')](_0x54a6c5);_0x5d2b5f(null,![]);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x52')]=function(_0x19a2bb,_0x504c7d){var _0x2197ca={'role':_0xaffa('0x4f')};_0x2197ca[_0x19a2bb]=this['channel']['callerid'];var _0x212a99=_0x19a2bb!=_0xaffa('0x53')?util[_0xaffa('0x26')](_0xaffa('0x54'),_0xaffa('0x55'),this[_0xaffa('0x33')][_0xaffa('0x39')]):undefined;this[_0xaffa('0x10')][_0xaffa('0x52')](_0x2197ca,_0x212a99)['then'](function(_0x322313){_0x504c7d(null,_[_0xaffa('0x42')](_0x322313)?![]:!![]);})[_0xaffa('0x17')](function(_0x5a028a){logger['error'](_0x5a028a);_0x504c7d(null,![]);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x56')]=function(_0x584a51,_0x45bf76){sh[_0xaffa('0x57')](_[_0xaffa('0x58')](_0x584a51),function(_0x3dec2f,_0x387af5){var _0x4d239f=_0x387af5[_0xaffa('0x59')](/(\r\n|\n|\r)/gm,'');_0x45bf76(null,_0x4d239f);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x5a')]=function(_0x5687fc,_0x4d45e7){scripts[_0xaffa('0x5a')](_0x5687fc['apiKey'],_0x5687fc['google_cloud_tts_text_type']||_0xaffa('0x5b'),_0x5687fc[_0xaffa('0x5b')],_0x5687fc[_0xaffa('0x5c')]||_0xaffa('0x5d'),_0x5687fc[_0xaffa('0x5e')]||_0xaffa('0x5f'),_0x5687fc[_0xaffa('0x60')]||_0xaffa('0x61'))['then'](function(_0xecf5e0){_0x4d45e7(null,_0xecf5e0);})[_0xaffa('0x17')](function(_0x468d56){_0x4d45e7(_0x468d56);});};AGIVertices['prototype'][_0xaffa('0x62')]=function(_0x555d19,_0x311ccb){scripts[_0xaffa('0x62')](_0x555d19[_0xaffa('0x5b')],_0x555d19[_0xaffa('0x63')]||'en',0x1)[_0xaffa('0x13')](function(_0x3077b6){_0x311ccb(null,_0x3077b6);})[_0xaffa('0x17')](function(_0x1505bf){_0x311ccb(_0x1505bf);});};AGIVertices[_0xaffa('0x12')]['restAPI']=function(_0x4b4137,_0x1b1183){var _0x3bf9bd={'uri':_0x4b4137[_0xaffa('0x64')],'method':_0x4b4137[_0xaffa('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4b4137[_0xaffa('0x66')])===_0xaffa('0x67')&&parseInt(_0x4b4137['timeout'])>=0x1?parseInt(_0x4b4137[_0xaffa('0x66')])*0x3e8:0x5*0x3e8};if(_[_0xaffa('0x68')]([_0xaffa('0x69'),_0xaffa('0x6a')],_0x3bf9bd[_0xaffa('0x65')][_0xaffa('0x6b')]())){try{_0x3bf9bd[_0xaffa('0x6c')]=_0x4b4137[_0xaffa('0x6d')]?JSON[_0xaffa('0x6e')](_0x4b4137['rawBody']):{};}catch(_0x220782){logger[_0xaffa('0x29')](_0xaffa('0x6f'),_0x220782);}}try{_0x3bf9bd['headers']=_0x4b4137[_0xaffa('0xc')]?JSON['parse'](_0x4b4137[_0xaffa('0xc')]):{};}catch(_0x71acc){logger[_0xaffa('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x71acc);}if(_0x4b4137['computedVariables']){try{var _0x1c3075=require(_0x4b4137[_0xaffa('0x70')])[_0xaffa('0x71')](this,_0x3bf9bd);_0x3bf9bd[_0xaffa('0x72')]=Mustache[_0xaffa('0x73')](_0x4b4137[_0xaffa('0x64')],_0x1c3075,{},['$$','$$']);if(_0x3bf9bd[_0xaffa('0x74')]){_0x3bf9bd['headers']=JSON['parse'](Mustache[_0xaffa('0x73')](JSON[_0xaffa('0x75')](_0x3bf9bd[_0xaffa('0x74')]),_0x1c3075,{},['$$','$$']));}if(_0x3bf9bd[_0xaffa('0x6c')]){_0x3bf9bd[_0xaffa('0x6c')]=JSON[_0xaffa('0x6e')](Mustache[_0xaffa('0x73')](JSON[_0xaffa('0x75')](_0x3bf9bd[_0xaffa('0x6c')]),_0x1c3075,{},['$$','$$']));}}catch(_0xbe93bf){logger[_0xaffa('0x29')](_0xaffa('0x76'),_0xbe93bf);}}rp(_0x3bf9bd)[_0xaffa('0x13')](function(_0x3bf462){var _0x926412={'statusCode':_0x3bf462['statusCode']||0xc8,'statusMessage':_0x3bf462[_0xaffa('0x77')]||'OK','headers':_0x3bf462['headers']||{},'body':_0x3bf462[_0xaffa('0x6c')]||{}};_0x1b1183(null,_0x926412);})[_0xaffa('0x17')](function(_0x12b154){var _0x479f83={'statusCode':_0x12b154[_0xaffa('0x78')]||0x1f4,'statusMessage':_0x12b154[_0xaffa('0x79')]||_0xaffa('0x7a'),'headers':_0x12b154[_0xaffa('0x7b')][_0xaffa('0x74')]||{},'body':_0x12b154[_0xaffa('0x7b')]['body']||{}};_0x1b1183(null,_0x479f83);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x7c')]=function(_0x41b7f4,_0x4e1ef8){scripts[_0xaffa('0x7c')](this['channel'][_0xaffa('0x34')],_0x41b7f4[_0xaffa('0x7d')],_0x41b7f4[_0xaffa('0x5b')],_0x41b7f4[_0xaffa('0x7e')]||'en')[_0xaffa('0x13')](function(_0x1d23ba){_0x4e1ef8(null,_0x1d23ba);})[_0xaffa('0x17')](function(_0xd58758){_0x4e1ef8(_0xd58758);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x7f')]=function(_0x3aa76f,_0x430897){scripts[_0xaffa('0x7f')](this[_0xaffa('0x33')][_0xaffa('0x34')],_0x3aa76f[_0xaffa('0x80')],_0x3aa76f[_0xaffa('0x81')],_0x3aa76f[_0xaffa('0x82')],_0x3aa76f[_0xaffa('0x5b')],_0x3aa76f[_0xaffa('0x83')]||'en')[_0xaffa('0x13')](function(_0x39dd60){_0x430897(null,_0x39dd60);})[_0xaffa('0x17')](function(_0x4586cc){_0x430897(_0x4586cc);});};AGIVertices['prototype'][_0xaffa('0x84')]=function(_0x17e1e4,_0x3df4e9){scripts[_0xaffa('0x84')](this[_0xaffa('0x33')],_0x17e1e4)[_0xaffa('0x13')](function(_0x31d858){_0x3df4e9(null,_0x31d858);})[_0xaffa('0x17')](function(_0x4e6b23){_0x3df4e9(_0x4e6b23);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x85')]=function(_0x46f593,_0x52fcfa){scripts[_0xaffa('0x85')](_0x46f593[_0xaffa('0x7d')],_0x46f593[_0xaffa('0x5b')],_0x46f593[_0xaffa('0x86')]||_0xaffa('0x5d'),_0x46f593[_0xaffa('0x87')])['then'](function(_0x132528){_0x52fcfa(null,_0x132528);})[_0xaffa('0x17')](function(_0xe83358){_0x52fcfa(_0xe83358);});};AGIVertices['prototype'][_0xaffa('0x88')]=function(_0x5bec70,_0x330a4b,_0x511578){scripts[_0xaffa('0x88')](_0x330a4b,_0x5bec70[_0xaffa('0x7d')],_0x5bec70[_0xaffa('0x89')]||_0xaffa('0x5d'),this['isConfigured'](_0x5bec70[_0xaffa('0x8a')])?_0x5bec70[_0xaffa('0x8a')]:undefined)[_0xaffa('0x13')](function(_0x2ff81b){_0x511578(null,_0x2ff81b);})[_0xaffa('0x17')](function(_0x4f6e79){_0x511578(_0x4f6e79);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x8b')]=function(_0x2d9db3,_0x379cf7){scripts[_0xaffa('0x8b')](_0x2d9db3[_0xaffa('0x8c')],_0x2d9db3[_0xaffa('0x8d')],_0x2d9db3['aws_polly_region'],_0x2d9db3['aws_polly_voice']||_0xaffa('0x8e'),_0x2d9db3[_0xaffa('0x5b')],_0x2d9db3[_0xaffa('0x8f')]||_0xaffa('0x5b'))[_0xaffa('0x13')](function(_0x2e7847){_0x379cf7(null,_0x2e7847);})[_0xaffa('0x17')](function(_0x4b11c4){_0x379cf7(_0x4b11c4);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x90')]=function(_0x2ae179,_0x17d724){scripts[_0xaffa('0x90')](this[_0xaffa('0x33')]['uniqueid'],_0x2ae179['aws_access_key_id'],_0x2ae179[_0xaffa('0x8d')],_0x2ae179[_0xaffa('0x91')],_0x2ae179[_0xaffa('0x5b')],_0x2ae179['aws_bot_name'])['then'](function(_0xc27432){_0x17d724(null,_0xc27432);})['catch'](function(_0xe9aa1c){_0x17d724(_0xe9aa1c);});};AGIVertices[_0xaffa('0x12')][_0xaffa('0x92')]=function(_0x31994e,_0x44777d,_0x2f64bf){scripts[_0xaffa('0x92')](_0x44777d,_0x31994e[_0xaffa('0x7d')],_0x31994e[_0xaffa('0x93')]||_0xaffa('0x5d'))[_0xaffa('0x13')](function(_0x38ce26){_0x2f64bf(null,_0x38ce26);})[_0xaffa('0x17')](function(_0x274780){_0x2f64bf(_0x274780);});};AGIVertices['prototype']['tildeASR']=function(_0x40235b,_0x537e38,_0x161dbc){scripts[_0xaffa('0x94')](_0x537e38,_0x40235b[_0xaffa('0x95')],_0x40235b[_0xaffa('0x96')],_0x40235b[_0xaffa('0x72')])['then'](function(_0x2d2de4){_0x161dbc(null,_0x2d2de4);})['catch'](function(_0x3d4928){_0x161dbc(_0x3d4928);});};AGIVertices[_0xaffa('0x12')]['clear']=function(_0x23be4f){var _0xd10b50=_[_0xaffa('0x68')](verticesWithRetry,_0x23be4f[_0xaffa('0x36')])?_0x23be4f:_[_0xaffa('0x97')](_0x23be4f);for(var _0x3e1b6e in _0xd10b50){if(_0xd10b50[_0xaffa('0x98')](_0x3e1b6e)){if(_0xd10b50[_0x3e1b6e]&&_['isString'](_0xd10b50[_0x3e1b6e])){if(_[_0xaffa('0x68')](recursiveMapAttributes,_0x3e1b6e)){_0xd10b50[_0x3e1b6e]=this[_0xaffa('0x99')](_0xd10b50[_0x3e1b6e]);}else{_0xd10b50[_0x3e1b6e]=this[_0xaffa('0x9a')](_0xd10b50[_0x3e1b6e]);}}}}return _0xd10b50;};AGIVertices['prototype'][_0xaffa('0x9b')]=function(_0x10dc26){for(var _0x2ceabb in _0x10dc26){if(_0x10dc26['hasOwnProperty'](_0x2ceabb)){if(_[_0xaffa('0x9c')](_0x10dc26[_0x2ceabb])){this[_0xaffa('0x9b')](_0x10dc26[_0x2ceabb]);}else if(_[_0xaffa('0x9d')](_0x10dc26[_0x2ceabb])){for(var _0x47a8f6=0x0;_0x47a8f6<_0x10dc26[_0x2ceabb][_0xaffa('0x9e')];_0x47a8f6++){this[_0xaffa('0x9b')](_0x10dc26[_0x2ceabb][_0x47a8f6]);}}else if(_['isString'](_0x10dc26[_0x2ceabb])){_0x10dc26[_0x2ceabb]=this[_0xaffa('0x9a')](_0x10dc26[_0x2ceabb]);}}}};AGIVertices[_0xaffa('0x12')][_0xaffa('0x9f')]=function(_0x3f568a,_0x33cd5e){for(var _0x4c52c2 in _0x3f568a){if(_0x3f568a[_0xaffa('0x98')](_0x4c52c2)){if(_[_0xaffa('0x9c')](_0x3f568a[_0x4c52c2])){if(!_[_0xaffa('0x41')](_0x3f568a[_0x4c52c2])){this[_0xaffa('0x9f')](_0x3f568a[_0x4c52c2],util[_0xaffa('0x26')](_0xaffa('0xa0'),_0x33cd5e,_0x4c52c2));}}else if(_[_0xaffa('0x9d')](_0x3f568a[_0x4c52c2])){for(var _0x4fb871=0x0;_0x4fb871<_0x3f568a[_0x4c52c2][_0xaffa('0x9e')];_0x4fb871++){this[_0xaffa('0x9f')](_0x3f568a[_0x4c52c2][_0x4fb871],util['format'](_0xaffa('0xa0'),_0x33cd5e,_0x4c52c2+'['+_0x4fb871+']'));}}else{if(!_[_0xaffa('0x42')](_0x3f568a[_0x4c52c2])){this['channel'][_0xaffa('0xa1')](util[_0xaffa('0x26')](_0xaffa('0xa0'),_0x33cd5e,_0x4c52c2),_0x3f568a[_0x4c52c2]);}}}}};AGIVertices['prototype'][_0xaffa('0x99')]=function(_0x2a0f15){try{var _0x29b5c4=JSON[_0xaffa('0x6e')](_0x2a0f15);this['recursiveNodeIndex'](_0x29b5c4);return JSON[_0xaffa('0x75')](_0x29b5c4);}catch(_0x38cb2b){return this[_0xaffa('0x9a')](_0x2a0f15);}};AGIVertices['prototype'][_0xaffa('0x9a')]=function(_0x1c7731){var _0x48b795=_0x1c7731[_0xaffa('0xa2')]('{');for(var _0x2e4874=0x1;_0x2e4874<_0x48b795[_0xaffa('0x9e')];_0x2e4874+=0x1){var _0x1baa50=_0x48b795[_0x2e4874]['split']('}');if(_0x1baa50[_0xaffa('0x9e')]>0x1){_0x1c7731=_0x1c7731[_0xaffa('0xa3')]('{'+_0x1baa50[0x0]+'}',this['channel'][_0xaffa('0xa4')](_0x1baa50[0x0])[_0xaffa('0xa5')]||_0x1baa50[0x0]);}}if(_0x48b795[_0xaffa('0x9e')]===0x1){return _0x1c7731[_0xaffa('0x4a')]();}return this[_0xaffa('0x9a')](_0x1c7731);};AGIVertices['prototype'][_0xaffa('0xa6')]=function(_0x389ff6,_0x500778){var _0x2e136a=this[_0xaffa('0x33')][_0xaffa('0xa4')](_0x389ff6);if(_0x2e136a[_0xaffa('0xa7')]===-0x1){return _0x2e136a;}logger['info'](util[_0xaffa('0x26')](_0xaffa('0xa8'),_0x500778,_0x2e136a['extra']));return this[_0xaffa('0x33')]['setVariable'](_0x500778,_0x2e136a[_0xaffa('0xa5')]);};AGIVertices['prototype'][_0xaffa('0xa9')]=function(_0xe288fc){return _0xe288fc&&_0xe288fc!=='0'&&_0xe288fc!=='-1'&&_0xe288fc!=='';};AGIVertices[_0xaffa('0x12')][_0xaffa('0xaa')]=function(_0x51ed79){this['createSquareDetailsReport'][_0xaffa('0x71')](this,_0x51ed79,'-');_0x51ed79['retry']=_0x51ed79[_0xaffa('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xaffa('0x12')][_0xaffa('0xab')]=function(_0x3f524e){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3f524e[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x3f524e['text'])){return this[_0xaffa('0x33')]['noop'](_0xaffa('0xac'));}var _0x2e08e4='\x22'+_0x3f524e[_0xaffa('0x5b')]+'\x22';if(this['isConfigured'](_0x3f524e[_0xaffa('0x7b')])){_0x2e08e4+=','+_0x3f524e['options'];}var _0x1b8a99=this[_0xaffa('0x33')][_0xaffa('0x57')](_0xaffa('0xad'),_0x2e08e4);if(_0x1b8a99['result']===-0x1){return _0x1b8a99;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xaf'),_0x2e08e4));};AGIVertices[_0xaffa('0x12')]['mrcprecog']=function(_0x19d1d4){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x19d1d4[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x19d1d4[_0xaffa('0xb0')])){return this[_0xaffa('0x33')][_0xaffa('0xae')]('no\x20grammar\x20configured');}var _0x12cf06=_0x19d1d4[_0xaffa('0xb0')];if(this[_0xaffa('0xa9')](_0x19d1d4[_0xaffa('0x7b')])){_0x12cf06+=','+_0x19d1d4['options'];}var _0x4f2022=this[_0xaffa('0x33')][_0xaffa('0x57')](_0xaffa('0xb1'),_0x12cf06);if(_0x4f2022['result']===-0x1){return _0x4f2022;}var _0xb8beaf=this[_0xaffa('0xa6')](_0xaffa('0xb2'),_0xaffa('0xb3'));if(_0xb8beaf[_0xaffa('0xa7')]===-0x1){return _0xb8beaf;}var _0x2ce361=this[_0xaffa('0xa6')](_0xaffa('0xb4'),_0xaffa('0xb5'));if(_0x2ce361[_0xaffa('0xa7')]===-0x1){return _0x2ce361;}var _0x254e29=this[_0xaffa('0xa6')]('RECOG_INSTANCE()',_0xaffa('0xb6'));if(_0x254e29[_0xaffa('0xa7')]===-0x1){return _0x254e29;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x12cf06));};AGIVertices['prototype'][_0xaffa('0x7')]=function(_0x89f99d){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xb7'),_0x89f99d[_0xaffa('0x35')]));return this[_0xaffa('0x33')][_0xaffa('0x7')]([_0x89f99d[_0xaffa('0xb8')],_0x89f99d[_0xaffa('0xb9')]]);};AGIVertices[_0xaffa('0x12')][_0xaffa('0xba')]=function(_0x23d88d){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x23d88d[_0xaffa('0x35')]));if(this[_0xaffa('0xa9')](_0x23d88d[_0xaffa('0x66')])){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x23d88d['timeout']));var _0x2ccdb9=this[_0xaffa('0x33')]['wait'](_0x23d88d['timeout']);if(_0x2ccdb9[_0xaffa('0xa7')]===-0x1){return _0x2ccdb9;}}return this['channel']['answer']();};AGIVertices[_0xaffa('0x12')]['callback']=function(_0x25afda){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xbb'),_0x25afda[_0xaffa('0x35')]));if(!this['isConfigured'](_0x25afda['list_id'])){return this[_0xaffa('0x33')]['error'](_0x25afda,_0xaffa('0xbc'));}_0x25afda[_0xaffa('0x47')]=moment();if(this[_0xaffa('0xa9')](_0x25afda['delay'])){_0x25afda['scheduledAt']=moment()[_0xaffa('0xbd')](_0x25afda[_0xaffa('0xbe')],_0xaffa('0xbf'));}if(!this[_0xaffa('0xa9')](_0x25afda[_0xaffa('0x4b')])){_0x25afda['callback_priority']=0x2;}this['createCmContact'][_0xaffa('0x71')](this,_0x25afda);return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x25afda[_0xaffa('0x46')],_0x25afda[_0xaffa('0xc0')],_0x25afda[_0xaffa('0x47')]));};AGIVertices[_0xaffa('0x12')][_0xaffa('0xc1')]=function(_0x1545c4){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xc2'),_0x1545c4[_0xaffa('0x35')]));var _0x117964=this[_0xaffa('0x33')][_0xaffa('0x57')](_0x1545c4['application'],_0x1545c4[_0xaffa('0x7b')]);if(_0x117964[_0xaffa('0xa7')]===-0x1){return _0x117964;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0xc3'),_0x1545c4[_0xaffa('0xc4')],_0x1545c4[_0xaffa('0x7b')]));};AGIVertices['prototype'][_0xaffa('0xc5')]=function(_0x33f37f){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xc6'),_0x33f37f[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x33f37f['text'])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xac'));}var _0x3f3825='\x22'+_0x33f37f[_0xaffa('0x5b')]+'\x22';if(this[_0xaffa('0xa9')](_0x33f37f['options'])){_0x3f3825+=','+_0x33f37f[_0xaffa('0x7b')];}var _0x2f59ba=this[_0xaffa('0x33')][_0xaffa('0x57')]('MRCPSynth',_0x3f3825);if(_0x2f59ba[_0xaffa('0xa7')]===-0x1){return _0x2f59ba;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0xaf'),_0x3f3825));};AGIVertices[_0xaffa('0x12')][_0xaffa('0xc7')]=function(_0x123461){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0xc8'),_0x123461[_0xaffa('0x35')]));if(!this['isConfigured'](_0x123461[_0xaffa('0x5b')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0xac'));}var _0x55452c='\x22'+_0x123461[_0xaffa('0x5b')]+'\x22';if(this['isConfigured'](_0x123461['options'])){_0x55452c+=','+_0x123461[_0xaffa('0x7b')];}var _0x574cba=this[_0xaffa('0x33')][_0xaffa('0x57')](_0xaffa('0xad'),_0x55452c);if(_0x574cba[_0xaffa('0xa7')]===-0x1){return _0x574cba;}return this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xaf'),_0x55452c));};AGIVertices[_0xaffa('0x12')][_0xaffa('0xc9')]=function(_0x5b60e4){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0xca'),_0x5b60e4['label']));if(!this[_0xaffa('0xa9')](_0x5b60e4['grammar'])){return this[_0xaffa('0x33')][_0xaffa('0xae')]('no\x20grammar\x20configured');}var _0x2e862e=_0x5b60e4[_0xaffa('0xb0')];if(this[_0xaffa('0xa9')](_0x5b60e4['options'])){_0x2e862e+=','+_0x5b60e4[_0xaffa('0x7b')];}var _0x276c37=this['channel'][_0xaffa('0x57')]('MRCPRecog',_0x2e862e);if(_0x276c37[_0xaffa('0xa7')]===-0x1){return _0x276c37;}var _0x21b10e=this[_0xaffa('0xa6')](_0xaffa('0xb2'),_0xaffa('0xcb'));if(_0x21b10e[_0xaffa('0xa7')]===-0x1){return _0x21b10e;}var _0x2e08e1=this[_0xaffa('0xa6')](_0xaffa('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2e08e1['result']===-0x1){return _0x2e08e1;}var _0x85a300=this[_0xaffa('0xa6')](_0xaffa('0xcc'),_0xaffa('0xcd'));if(_0x85a300['result']===-0x1){return _0x85a300;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xce'),_0x2e862e));};AGIVertices[_0xaffa('0x12')][_0xaffa('0xcf')]=function(_0x293ac8){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xd0'),_0x293ac8[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x293ac8[_0xaffa('0xb0')])){return this[_0xaffa('0x33')]['noop'](_0xaffa('0xd1'));}var _0x48d226=_0x293ac8[_0xaffa('0xb0')];if(this['isConfigured'](_0x293ac8[_0xaffa('0x7b')])){_0x48d226+=','+_0x293ac8['options'];}var _0x144f08=this[_0xaffa('0x33')][_0xaffa('0x57')](_0xaffa('0xb1'),_0x48d226);if(_0x144f08[_0xaffa('0xa7')]===-0x1){return _0x144f08;}var _0x5a2fcf=this[_0xaffa('0xa6')](_0xaffa('0xb2'),_0xaffa('0xd2'));if(_0x5a2fcf['result']===-0x1){return _0x5a2fcf;}var _0x46f3cc=this[_0xaffa('0xa6')](_0xaffa('0xb4'),_0xaffa('0xd3'));if(_0x46f3cc[_0xaffa('0xa7')]===-0x1){return _0x46f3cc;}var _0x235827=this[_0xaffa('0xa6')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x235827['result']===-0x1){return _0x235827;}return this[_0xaffa('0x33')]['noop'](util[_0xaffa('0x26')](_0xaffa('0xce'),_0x48d226));};AGIVertices[_0xaffa('0x12')][_0xaffa('0xd4')]=function(_0xcc9386){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xd5'),_0xcc9386[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0xcc9386[_0xaffa('0xd6')])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0xcc9386,_0xaffa('0xd7'));}var _0x4b8168=this['getSquareOdbc']['sync'](this,_0xcc9386['odbc_id']);if(!_0x4b8168){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0xcc9386,_0xaffa('0xd8'));}if(!this['isConfigured'](_0xcc9386[_0xaffa('0x2b')])){return this['channel'][_0xaffa('0x29')](_0xcc9386,_0xaffa('0xd9'));}var _0x4fb497=_0xcc9386[_0xaffa('0x2b')][_0xaffa('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xda'),_0x4fb497));var _0x3afab5=this['getQueryOdbc']['sync'](this,_0x4b8168,_0x4fb497);this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0xcc9386,_0x4fb497);if(!this[_0xaffa('0xa9')](_0xcc9386['variable_id'])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xdb'));}var _0x36fecc=this[_0xaffa('0xa4')]['sync'](this,_0xcc9386[_0xaffa('0xdc')]);if(!_0x36fecc){return this[_0xaffa('0x33')]['error'](_0xcc9386,_0xaffa('0xdd'));}var _0x5888f3=this;_0x3afab5[_0xaffa('0xde')](function(_0x282b87,_0x4d8778){Object[_0xaffa('0xdf')](_0x282b87)[_0xaffa('0xde')](function(_0x390cc8){_0x5888f3[_0xaffa('0x33')][_0xaffa('0xa1')](util['format']('%s[%s][%s]',_0x36fecc,_0x4d8778,_0x390cc8),_0x282b87[_0x390cc8]);});});this[_0xaffa('0x33')][_0xaffa('0xa1')](util[_0xaffa('0x26')]('%s_ROWS_COUNT',_0x36fecc),_0x3afab5['length']);return this['channel']['noop'](util[_0xaffa('0x26')](_0xaffa('0xe0'),_0x36fecc));};AGIVertices['prototype'][_0xaffa('0xe1')]=function(_0x3a9848){logger['debug'](util['format'](_0xaffa('0xe2'),_0x3a9848[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x3a9848[_0xaffa('0xe3')])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x3a9848,_0xaffa('0xe4'));}var _0x82fc9b=this[_0xaffa('0x1b')][_0xaffa('0x71')](this,_0x3a9848[_0xaffa('0xe3')]);if(!_0x82fc9b){return this[_0xaffa('0x33')]['error'](_0x3a9848,_0xaffa('0xe5'));}var _0x1030ea=this[_0xaffa('0x33')][_0xaffa('0x57')](_0xaffa('0xe6'),[util[_0xaffa('0x26')]('SIP/%s',_0x82fc9b),_0x3a9848['timeout'],_0x3a9848[_0xaffa('0xe7')],_0x3a9848[_0xaffa('0x64')]]);if(_0x1030ea[_0xaffa('0xa7')]===-0x1){return _0x1030ea;}return this[_0xaffa('0x33')]['noop'](util[_0xaffa('0x26')](_0xaffa('0xe8'),'DIAL'));};AGIVertices['prototype'][_0xaffa('0xe9')]=function(_0x34ad2d){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xea'),_0x34ad2d['label']));if(!this[_0xaffa('0xa9')](_0x34ad2d[_0xaffa('0x7d')])){return this['channel']['noop'](_0xaffa('0xeb'));}if(!this[_0xaffa('0xa9')](_0x34ad2d['text'])){return this[_0xaffa('0x33')][_0xaffa('0xae')]('no\x20text\x20configured');}this[_0xaffa('0x33')]['bot']=!![];this[_0xaffa('0x32')](_0x34ad2d);this[_0xaffa('0x3f')](_0x34ad2d[_0xaffa('0x5b')],'in','','');this[_0xaffa('0x33')]['noop'](util[_0xaffa('0x26')]('Trying\x20Dialogflow:\x20%s',_0x34ad2d[_0xaffa('0x5b')]));var _0x189e99=this[_0xaffa('0x7c')][_0xaffa('0x71')](this,_0x34ad2d);if(_0x189e99){for(var _0x58dbc1 in _0x189e99){if(_0x189e99[_0xaffa('0x98')](_0x58dbc1)){this[_0xaffa('0x33')][_0xaffa('0xa1')](util['format']('DIALOGFLOW_%s',_0x58dbc1[_0xaffa('0x6b')]()),_0x189e99[_0x58dbc1]);}}this['createSquareMessage'](_0x189e99[_0xaffa('0xec')],_0xaffa('0xed'),'dialogflow','');return this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xee'),_0x189e99[_0xaffa('0xec')]));}return this['channel'][_0xaffa('0x29')](_0x34ad2d,_0xaffa('0xef'));};AGIVertices['prototype'][_0xaffa('0xf0')]=function(_0x130ef4){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0xf1'),_0x130ef4[_0xaffa('0x35')]));if(!this['isConfigured'](_0x130ef4[_0xaffa('0x80')])){return this[_0xaffa('0x33')]['noop'](_0xaffa('0xf2'));}if(!this[_0xaffa('0xa9')](_0x130ef4[_0xaffa('0x81')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0xf3'));}if(!this[_0xaffa('0xa9')](_0x130ef4[_0xaffa('0x82')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xf4'));}if(!this[_0xaffa('0xa9')](_0x130ef4[_0xaffa('0x83')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xf5'));}if(!this[_0xaffa('0xa9')](_0x130ef4[_0xaffa('0x5b')])){return this[_0xaffa('0x33')]['noop']('no\x20text\x20configured');}this[_0xaffa('0x33')][_0xaffa('0xf6')]=!![];this[_0xaffa('0x32')](_0x130ef4);this[_0xaffa('0x3f')](_0x130ef4['text'],'in','','');this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xf7'),_0x130ef4[_0xaffa('0x5b')]));var _0x548278=this[_0xaffa('0x7f')][_0xaffa('0x71')](this,_0x130ef4);if(_0x548278){for(var _0x82a63d in _0x548278){if(_0x548278[_0xaffa('0x98')](_0x82a63d)){if(_0x82a63d!=='providerResponse'){this[_0xaffa('0x33')][_0xaffa('0xa1')](util[_0xaffa('0x26')](_0xaffa('0xf8'),_0x82a63d[_0xaffa('0x6b')]()),_0x548278[_0x82a63d]);}}}this[_0xaffa('0x3f')](_0x548278[_0xaffa('0xec')],_0xaffa('0xed'),_0xaffa('0xf0'),_0x548278[_0xaffa('0xf9')]);return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xfa'),_0x548278[_0xaffa('0xec')]));}return this['channel'][_0xaffa('0x29')](_0x130ef4,_0xaffa('0xfb'));};AGIVertices[_0xaffa('0x12')][_0xaffa('0xfc')]=function(_0x384fcd){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0xfd'),_0x384fcd['label']));if(!this[_0xaffa('0xa9')](_0x384fcd[_0xaffa('0xfe')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0xff'));}if(!this[_0xaffa('0xa9')](_0x384fcd[_0xaffa('0x100')])){return this[_0xaffa('0x33')][_0xaffa('0xae')]('no\x20username\x20configured');}if(!this[_0xaffa('0xa9')](_0x384fcd[_0xaffa('0x101')])){return this[_0xaffa('0x33')][_0xaffa('0xae')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x384fcd[_0xaffa('0x102')])){return this[_0xaffa('0x33')][_0xaffa('0xae')]('no\x20text\x20configured');}this[_0xaffa('0x33')]['bot']=!![];this[_0xaffa('0x32')](_0x384fcd);this[_0xaffa('0x3f')](_0x384fcd[_0xaffa('0x5b')],'in','','');this[_0xaffa('0x33')]['noop'](util[_0xaffa('0x26')](_0xaffa('0x103'),_0x384fcd[_0xaffa('0x5b')]));var _0x1c51ee=this[_0xaffa('0x84')][_0xaffa('0x71')](this,_0x384fcd);if(_0x1c51ee){for(var _0x27ccd2 in _0x1c51ee){if(_0x1c51ee['hasOwnProperty'](_0x27ccd2)){this[_0xaffa('0x33')][_0xaffa('0xa1')](util['format'](_0xaffa('0x104'),_0x27ccd2[_0xaffa('0x6b')]()),_0x1c51ee[_0x27ccd2]);}}this[_0xaffa('0x3f')](_0x1c51ee[_0xaffa('0xec')],_0xaffa('0xed'),'sesteknda','');if(_0x1c51ee[_0xaffa('0x105')]){this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x106'),_0x1c51ee[_0xaffa('0x105')]));var _0x1b1f23=this[_0xaffa('0x33')][_0xaffa('0x107')](_0x1c51ee[_0xaffa('0x105')]);try{fs[_0xaffa('0x108')](_0x1c51ee[_0xaffa('0x105')]+_0xaffa('0x109'));}catch(_0x4bb9f3){logger[_0xaffa('0x29')](_0x4bb9f3);}return _0x1b1f23;}else{return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')]('SestekNDA\x20Result\x20%s',_0x1c51ee[_0xaffa('0xec')]));}}return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x384fcd,_0xaffa('0x10a'));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x10b')]=function(_0x17836a){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x10c'),_0x17836a['label']));return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x10b'));};AGIVertices['prototype'][_0xaffa('0x10d')]=function(_0x12f64f){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x10e'),_0x12f64f[_0xaffa('0x35')]));var _0x49c8bf='';if(_0x12f64f[_0xaffa('0x10f')]){if(!this[_0xaffa('0xa9')](_0x12f64f[_0xaffa('0x10f')])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x12f64f,_0xaffa('0x110'));}else{var _0xdb39a5=parseInt(_0x12f64f[_0xaffa('0x10f')],0xa);if(isNaN(_0xdb39a5)){_0x49c8bf=_0x12f64f[_0xaffa('0x10f')];}else{_0x49c8bf=this[_0xaffa('0x1c')][_0xaffa('0x71')](this,_0x12f64f['trunk_id']);if(!_0x49c8bf){return this[_0xaffa('0x33')]['error'](_0x12f64f,_0xaffa('0x111'));}}}}else if(_0x12f64f[_0xaffa('0x112')]){_0x49c8bf=_0x12f64f['trunk_name'];}else{return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x12f64f,_0xaffa('0x110'));}var _0x41d1e0=this[_0xaffa('0x33')][_0xaffa('0x57')](_0xaffa('0xe6'),[util[_0xaffa('0x26')]('SIP/%s/%s',_0x49c8bf,_0x12f64f[_0xaffa('0x46')]),_0x12f64f[_0xaffa('0x66')],_0x12f64f['opts'],_0x12f64f['url']]);if(_0x41d1e0['result']===-0x1){return _0x41d1e0;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xe8'),_0xaffa('0xe6')));};AGIVertices[_0xaffa('0x12')]['finally']=function(_0x337497){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x113'),_0x337497['label']));return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x114'));};AGIVertices[_0xaffa('0x12')]['getdigits']=function(_0x61f04b){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x115'),_0x61f04b[_0xaffa('0x35')]));if(_0x61f04b[_0xaffa('0x116')]===0x0){return this['maxRetry'](_0x61f04b);}_0x61f04b[_0xaffa('0x116')]-=0x1;if(!this['isConfigured'](_0x61f04b[_0xaffa('0x117')])){return this[_0xaffa('0x33')]['error'](_0x61f04b,_0xaffa('0x118'));}var _0x5d0274=this[_0xaffa('0x1e')][_0xaffa('0x71')](this,_0x61f04b[_0xaffa('0x117')]);if(!_0x5d0274){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x61f04b,'no\x20file\x20audio\x20found');}if(!this[_0xaffa('0xa9')](_0x61f04b[_0xaffa('0xdc')])){return this[_0xaffa('0x33')][_0xaffa('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5add1d=this[_0xaffa('0x33')][_0xaffa('0x119')](_0x5d0274,_0x61f04b['response'],_0x61f04b[_0xaffa('0x11a')]);var _0x5c9e21=_0x5add1d[_0xaffa('0xa7')]?_0x5add1d[_0xaffa('0xa7')]['toString']():'';logger[_0xaffa('0x2c')](_0xaffa('0x11b'),JSON[_0xaffa('0x75')](_0x5add1d));if(_0x5add1d[_0xaffa('0xa7')]===-0x1){this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x61f04b,_0x5c9e21);return _0x5add1d;}else if(_0x5add1d[_0xaffa('0xa5')]===_0xaffa('0x66')){_0x5add1d[_0xaffa('0xa7')]=_0x5c9e21[_0xaffa('0x9e')]>=parseInt(_0x61f04b[_0xaffa('0x11c')])?'x':'i';}else{_0x5add1d['result']=_0x5c9e21[_0xaffa('0x9e')]>=parseInt(_0x61f04b['mindigit'])&&_0x5c9e21[_0xaffa('0x9e')]<=parseInt(_0x61f04b[_0xaffa('0x11a')])?'x':'i';}var _0x597830=this[_0xaffa('0xa4')][_0xaffa('0x71')](this,_0x61f04b[_0xaffa('0xdc')]);if(!_0x597830){return this['channel'][_0xaffa('0x29')](_0x61f04b,_0xaffa('0xdd'));}this[_0xaffa('0x33')][_0xaffa('0xa1')](_0x597830,_0x5c9e21);if(this[_0xaffa('0xa9')](_0x61f04b[_0xaffa('0x11d')])){var _0x4fba0b=parseInt(_0x61f04b[_0xaffa('0x11d')],0xa);var _0x30d317=rs[_0xaffa('0x11e')]({'charset':'*','length':_0x4fba0b});var _0xe8aeeb=_0x5c9e21['length'];if(_0xe8aeeb>0x0){if(_0xe8aeeb>_0x4fba0b){this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x61f04b,_0x61f04b[_0xaffa('0x11f')]===_0xaffa('0x120')?_0x30d317+_0x5c9e21[_0xaffa('0x121')](_0x4fba0b):_0x5c9e21['substr'](0x0,_0xe8aeeb-_0x4fba0b)+_0x30d317);}else{this['createSquareDetailsReport']['sync'](this,_0x61f04b,rs[_0xaffa('0x11e')]({'charset':'*','length':_0xe8aeeb}));}}else{this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x61f04b,'');}}else{this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x61f04b,_0x5c9e21);}return _0x5add1d;};AGIVertices['prototype']['getsecretdigits']=function(_0x20500a){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x122'),_0x20500a['label']));return this['getdigits'](_0x20500a);};AGIVertices[_0xaffa('0x12')][_0xaffa('0x123')]=function(_0x1813f2){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1813f2[_0xaffa('0x35')]));this[_0xaffa('0x32')]['sync'](this,_0x1813f2,_0x1813f2[_0xaffa('0x124')]);return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')]('GOAL\x20%s',_0x1813f2[_0xaffa('0x124')]));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x125')]=function(_0x88b57c){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x126'),_0x88b57c[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x88b57c[_0xaffa('0x8c')])||!this[_0xaffa('0xa9')](_0x88b57c['aws_secret_access_key'])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x127'));}if(!this[_0xaffa('0xa9')](_0x88b57c[_0xaffa('0x5b')])){return this[_0xaffa('0x33')]['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0xaffa('0x26')]('Trying\x20aws\x20Polly\x20%s',_0x88b57c['text']));var _0x2aa99f=this[_0xaffa('0x8b')]['sync'](this,_0x88b57c);if(_0x2aa99f){this['channel'][_0xaffa('0xae')](util['format'](_0xaffa('0x128'),_0x2aa99f));var _0x1f6c4b=this['channel']['streamFile'](_0x2aa99f);try{fs[_0xaffa('0x108')](_0x2aa99f+_0xaffa('0x109'));}catch(_0x1f9d4b){logger['error'](_0x1f9d4b);}return _0x1f6c4b;}return this['channel'][_0xaffa('0x29')](_0x88b57c,_0xaffa('0x129'));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x12a')]=function(_0x10e38e){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x12b'),_0x10e38e[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x10e38e[_0xaffa('0x8c')])||!this[_0xaffa('0xa9')](_0x10e38e[_0xaffa('0x8d')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0x127'));}if(!this[_0xaffa('0xa9')](_0x10e38e[_0xaffa('0x12c')])){return this[_0xaffa('0x33')]['noop'](_0xaffa('0x12d'));}if(!this['isConfigured'](_0x10e38e[_0xaffa('0x5b')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0xac'));}this[_0xaffa('0x33')][_0xaffa('0xf6')]=!![];this[_0xaffa('0x32')](_0x10e38e);this[_0xaffa('0x3f')](_0x10e38e['text'],'in','','');this['channel'][_0xaffa('0xae')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x10e38e['text']));var _0x5cdea5=this[_0xaffa('0x90')][_0xaffa('0x71')](this,_0x10e38e);if(_0x5cdea5){for(var _0x1c8781 in _0x5cdea5){if(_0x5cdea5[_0xaffa('0x98')](_0x1c8781)&&_['isString'](_0x5cdea5[_0x1c8781])){this[_0xaffa('0x33')]['setVariable'](util[_0xaffa('0x26')](_0xaffa('0x12e'),_0x1c8781[_0xaffa('0x6b')]()),_0x5cdea5[_0x1c8781]);}}if(_[_0xaffa('0x42')](_0x5cdea5[_0xaffa('0x79')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x12f'));}else{this['createSquareMessage'](_0x5cdea5[_0xaffa('0x79')],_0xaffa('0xed'),'amazonlex','');return this['channel'][_0xaffa('0xae')](util['format'](_0xaffa('0x130'),_0x5cdea5[_0xaffa('0x79')]));}}return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x10e38e,_0xaffa('0x131'));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x132')]=function(_0x5980f8){logger['info'](util[_0xaffa('0x26')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5980f8[_0xaffa('0x35')],_0x5980f8['timeout']));if(!this[_0xaffa('0xa9')](_0x5980f8[_0xaffa('0x7d')])){return this[_0xaffa('0x33')]['noop'](_0xaffa('0xeb'));}var _0x45e32c='wav';var _0x47e98b=util[_0xaffa('0x26')](_0xaffa('0x133'),FILES_PATH,rs[_0xaffa('0x11e')](0x4));var _0x48362b=util[_0xaffa('0x26')](_0xaffa('0xa0'),_0x47e98b,_0x45e32c);var _0x4631ed=!![];if(_0x5980f8[_0xaffa('0x134')]===_0xaffa('0x135')){_0x4631ed=![];}var _0x5da16b=this[_0xaffa('0x33')][_0xaffa('0x136')](_0x47e98b,_0x45e32c,_0x5980f8[_0xaffa('0x137')],_0x5980f8[_0xaffa('0x66')],undefined,_0x4631ed);if(_0x5da16b[_0xaffa('0xa7')]!==-0x1){this[_0xaffa('0x33')]['noop'](util[_0xaffa('0x26')](_0xaffa('0x138'),_0x48362b));var _0xbfccc1=this[_0xaffa('0x92')][_0xaffa('0x71')](this,_0x5980f8,_0x48362b);if(_0xbfccc1){for(var _0x3b2a57 in _0xbfccc1){if(_0xbfccc1[_0xaffa('0x98')](_0x3b2a57)){this[_0xaffa('0x33')]['setVariable'](util[_0xaffa('0x26')](_0xaffa('0x139'),_0x3b2a57['toUpperCase']()),_0xbfccc1[_0x3b2a57]);}}return this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x13a'),JSON[_0xaffa('0x75')](_0xbfccc1)));}}return _0x5da16b;};AGIVertices[_0xaffa('0x12')][_0xaffa('0x13b')]=function(_0x4c8a21){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x13c'),_0x4c8a21['label']));if(!this[_0xaffa('0xa9')](_0x4c8a21[_0xaffa('0x95')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x13d'));}if(!this[_0xaffa('0xa9')](_0x4c8a21[_0xaffa('0x96')])){return this[_0xaffa('0x33')]['noop'](_0xaffa('0x13e'));}var _0x289895=_0xaffa('0x13f');var _0x784b5d=util[_0xaffa('0x26')](_0xaffa('0x133'),FILES_PATH,rs['generate'](0x4));var _0x2b85d5=util['format'](_0xaffa('0xa0'),_0x784b5d,_0x289895);var _0x3560b0=!![];if(_0x4c8a21[_0xaffa('0x134')]==='NOBEEP'){_0x3560b0=![];}var _0x337498=this[_0xaffa('0x33')][_0xaffa('0x136')](_0x784b5d,_0x289895,_0x4c8a21[_0xaffa('0x137')],_0x4c8a21[_0xaffa('0x66')],undefined,_0x3560b0);if(_0x337498[_0xaffa('0xa7')]!==-0x1){this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x140'),_0x2b85d5));var _0x5a30a4=this[_0xaffa('0x94')]['sync'](this,_0x4c8a21,_0x2b85d5);if(_0x5a30a4){for(var _0x6b04ca in _0x5a30a4){if(_0x5a30a4[_0xaffa('0x98')](_0x6b04ca)){this['channel']['setVariable'](util[_0xaffa('0x26')](_0xaffa('0x141'),_0x6b04ca[_0xaffa('0x6b')]()),_0x5a30a4[_0x6b04ca]);}}return this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x142'),JSON[_0xaffa('0x75')](_0x5a30a4)));}}return _0x337498;};AGIVertices[_0xaffa('0x12')][_0xaffa('0x143')]=function(_0x522425){logger[_0xaffa('0x2c')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x522425['label']));return this[_0xaffa('0x33')]['continueAt'](_0x522425['context'],_0x522425[_0xaffa('0x3b')],_0x522425[_0xaffa('0x3c')]);};AGIVertices[_0xaffa('0x12')][_0xaffa('0x144')]=function(_0x5b25dc){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x145'),_0x5b25dc[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x5b25dc[_0xaffa('0x146')])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x5b25dc,_0xaffa('0x147'));}try{var _0x2b9493=eval(_0x5b25dc[_0xaffa('0x146')])?_0xaffa('0x148'):_0xaffa('0x149');this['channel']['noop'](util[_0xaffa('0x26')](_0xaffa('0x14a'),_0x5b25dc['condition'],_0x2b9493));return{'code':0xc8,'result':_0x2b9493};}catch(_0x3c56ad){return{'code':0xc8,'result':_0xaffa('0x149')};}};AGIVertices[_0xaffa('0x12')][_0xaffa('0x14b')]=function(_0x3aed16){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x14c'),_0x3aed16[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x3aed16['interval_id'])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x3aed16,_0xaffa('0x14d'));}var _0xdd1890=this[_0xaffa('0x23')][_0xaffa('0x71')](this,_0x3aed16[_0xaffa('0x14e')]);if(!_0xdd1890){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x3aed16,_0xaffa('0x14f'));}for(var _0x49ef95=0x0;_0x49ef95<_0xdd1890['length'];_0x49ef95+=0x1){var _0x15a18e=this['channel'][_0xaffa('0xa4')](util['format'](_0xaffa('0x150'),_0xdd1890[_0x49ef95]));if(_0x15a18e['result']===-0x1){return _0x15a18e;}logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('IFTIME\x20%s\x20%s',_0xdd1890[_0x49ef95],_0x15a18e[_0xaffa('0xa5')]));if(_0x15a18e[_0xaffa('0xa5')]===_0xaffa('0x148')){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x151'),_0xdd1890[_0x49ef95],_0xaffa('0x148')));this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')]('IFTIME\x20%s\x20%s',_0xdd1890[_0x49ef95],_0xaffa('0x148')));return{'code':0xc8,'result':_0xaffa('0x148')};}else{logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x151'),_0xdd1890[_0x49ef95],_0xaffa('0x149')));this[_0xaffa('0x33')]['noop'](util['format'](_0xaffa('0x151'),_0xdd1890[_0x49ef95],'false'));}}return{'code':0xc8,'result':_0xaffa('0x149')};};AGIVertices[_0xaffa('0x12')]['hangup']=function(_0xdb25f3){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x152'),_0xdb25f3[_0xaffa('0x35')]));return this[_0xaffa('0x33')][_0xaffa('0x153')]();};AGIVertices[_0xaffa('0x12')][_0xaffa('0x154')]=function(_0x301fe9){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x155'),_0x301fe9[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x301fe9['key'])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xeb'));}var _0x2bc407=_0xaffa('0x13f');var _0x1cbec9=util[_0xaffa('0x26')](_0xaffa('0x133'),FILES_PATH,rs[_0xaffa('0x11e')](0x4));var _0x505d11=util[_0xaffa('0x26')]('%s.%s',_0x1cbec9,_0x2bc407);var _0x5ed86d=!![];if(_0x301fe9[_0xaffa('0x134')]===_0xaffa('0x135')){_0x5ed86d=![];}var _0x991d33=this[_0xaffa('0x33')]['recordFile'](_0x1cbec9,_0x2bc407,_0x301fe9[_0xaffa('0x137')],_0x301fe9[_0xaffa('0x66')],undefined,_0x5ed86d);if(_0x991d33[_0xaffa('0xa7')]!==-0x1){this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x156'),_0x505d11));var _0x59d946=this[_0xaffa('0x88')]['sync'](this,_0x301fe9,_0x505d11);if(_0x59d946){for(var _0x3f1b7b in _0x59d946){if(_0x59d946['hasOwnProperty'](_0x3f1b7b)){this['channel']['setVariable'](util[_0xaffa('0x26')](_0xaffa('0x157'),_0x3f1b7b[_0xaffa('0x6b')]()),_0x59d946[_0x3f1b7b]);}}return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x158'),JSON['stringify'](_0x59d946)));}}return _0x991d33;};AGIVertices[_0xaffa('0x12')][_0xaffa('0x159')]=function(_0x2c1529){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x15a'),_0x2c1529[_0xaffa('0x35')]));if(!this['isConfigured'](_0x2c1529[_0xaffa('0x7d')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xeb'));}if(!this['isConfigured'](_0x2c1529[_0xaffa('0x5b')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xac'));}this['channel']['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x2c1529['text']));var _0x154e4e=this[_0xaffa('0x85')]['sync'](this,_0x2c1529);if(_0x154e4e){this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x156'),_0x154e4e));var _0x32afd4=this['channel']['streamFile'](_0x154e4e,_0x2c1529[_0xaffa('0x137')]);try{fs[_0xaffa('0x108')](_0x154e4e+_0xaffa('0x109'));}catch(_0x1b9176){logger[_0xaffa('0x29')](_0x1b9176);}return _0x32afd4;}return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x2c1529,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xaffa('0x15b')]=function(_0x1aba42){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x15c'),_0x1aba42[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x1aba42[_0xaffa('0x15d')])){return this['channel'][_0xaffa('0x29')](_0x1aba42,_0xaffa('0x15e'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xaffa('0x33')][_0xaffa('0x39')],_0x1aba42['findBy']));var _0x37a532=this[_0xaffa('0x52')]['sync'](this,_0x1aba42[_0xaffa('0x15d')]);if(_0x37a532){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x15f'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0x1aba42[_0xaffa('0x15d')]));this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x15f'),this['channel'][_0xaffa('0x39')],_0x1aba42[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x160')};}else{logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x161'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0x1aba42[_0xaffa('0x15d')]));this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x161'),this['channel']['callerid'],_0x1aba42[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x162')};}};AGIVertices[_0xaffa('0x12')][_0xaffa('0x163')]=function(_0xab459d){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x164'),_0xab459d[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0xab459d[_0xaffa('0x15d')])){return this[_0xaffa('0x33')]['error'](_0xab459d,'no\x20find\x20by\x20configured');}logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xaffa('0x33')][_0xaffa('0x39')],_0xab459d[_0xaffa('0x15d')]));var _0x13ad66=this['agentLogout'][_0xaffa('0x71')](this,_0xab459d['findBy']);if(_0x13ad66){logger[_0xaffa('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xaffa('0x33')][_0xaffa('0x39')],_0xab459d[_0xaffa('0x15d')]));this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x15f'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0xab459d[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x160')};}else{logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x161'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0xab459d[_0xaffa('0x15d')]));this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x161'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0xab459d[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x162')};}};AGIVertices[_0xaffa('0x12')][_0xaffa('0x165')]=function(_0x3a716a){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x166'),_0x3a716a[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x3a716a['operation'])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x3a716a,_0xaffa('0x167'));}this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x168'),_0x3a716a[_0xaffa('0x169')]));var _0x582821=eval(_0x3a716a['operation']);if(!this[_0xaffa('0xa9')](_0x3a716a['variable_id'])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x54cfb0=this[_0xaffa('0xa4')]['sync'](this,_0x3a716a[_0xaffa('0xdc')]);if(!_0x54cfb0){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x3a716a,'no\x20variable\x20found');}if(_[_0xaffa('0x9d')](_0x582821)){var _0x472255=this;_0x582821['forEach'](function(_0x3b5b0c,_0x1f001c){_0x472255['channel'][_0xaffa('0xa1')](util[_0xaffa('0x26')](_0xaffa('0x16a'),_0x54cfb0,_0x1f001c),_0x3b5b0c);});return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x16b'),_0x54cfb0));}else{return this[_0xaffa('0x33')][_0xaffa('0xa1')](_0x54cfb0,_0x582821);}};AGIVertices[_0xaffa('0x12')][_0xaffa('0xd')]=function(_0x13332b){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x16c'),_0x13332b['label']));if(_0x13332b[_0xaffa('0x116')]===0x0){return this['maxRetry'](_0x13332b);}_0x13332b[_0xaffa('0x116')]-=0x1;if(!this['isConfigured'](_0x13332b[_0xaffa('0x117')])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x13332b,'no\x20file\x20audio\x20selected');}var _0x153de7=this[_0xaffa('0x1e')][_0xaffa('0x71')](this,_0x13332b['file_id']);if(!_0x153de7){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x13332b,_0xaffa('0x16d'));}var _0x3403cd=this[_0xaffa('0x33')][_0xaffa('0x119')](_0x153de7,_0x13332b[_0xaffa('0x16e')],_0x13332b[_0xaffa('0x16f')]);var _0x3cf60d=_0x3403cd[_0xaffa('0xa7')];if(_0x3403cd[_0xaffa('0xa7')]===-0x1){this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x13332b,'-1');return _0x3403cd;}else if(_0x3403cd[_0xaffa('0xa5')]===_0xaffa('0x66')){_0x3403cd[_0xaffa('0xa7')]=_0x3403cd[_0xaffa('0xa7')][_0xaffa('0x9e')]>0x0?_0x3403cd[_0xaffa('0xa7')]:'t';}else if(_[_0xaffa('0x41')](_0x3403cd['result'])){_0x3403cd['result']='#';_0x3cf60d='#';}if(!this[_0xaffa('0xa9')](_0x13332b[_0xaffa('0xdc')])){this['channel'][_0xaffa('0xae')](_0xaffa('0xdb'));}else{var _0x3ff1e0=this[_0xaffa('0xa4')]['sync'](this,_0x13332b[_0xaffa('0xdc')]);if(!_0x3ff1e0){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x13332b,_0xaffa('0xdd'));}this['channel'][_0xaffa('0xa1')](_0x3ff1e0,_0x3cf60d);}this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x13332b,_0x3cf60d);return _0x3403cd;};AGIVertices[_0xaffa('0x12')][_0xaffa('0xae')]=function(_0xc57b3b){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x170'),_0xc57b3b['label']));return this['channel'][_0xaffa('0xae')](_0xc57b3b[_0xaffa('0x171')]||_0xc57b3b['label']);};AGIVertices[_0xaffa('0x12')]['pause']=function(_0x25f120){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x25f120['label']));if(!this[_0xaffa('0xa9')](_0x25f120['findBy'])){return this['channel']['error'](_0x25f120,_0xaffa('0x15e'));}logger['info'](util[_0xaffa('0x26')](_0xaffa('0x172'),this['channel'][_0xaffa('0x39')],_0x25f120[_0xaffa('0x15d')]));var _0x1f4c70=this[_0xaffa('0x4c')][_0xaffa('0x71')](this,_0x25f120[_0xaffa('0x173')]);var _0x366419=this[_0xaffa('0x4e')]['sync'](this,_0x25f120[_0xaffa('0x15d')],_0x1f4c70);if(_0x366419){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x15f'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0x25f120[_0xaffa('0x15d')]));this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaffa('0x33')][_0xaffa('0x39')],_0x25f120[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x160')};}else{logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x25f120['findBy']));this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x15f'),this['channel'][_0xaffa('0x39')],_0x25f120['findBy']));return{'code':0xc8,'result':_0xaffa('0x162')};}};AGIVertices[_0xaffa('0x12')][_0xaffa('0x174')]=function(_0x558a07){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x175'),_0x558a07[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x558a07['file_id'])){return this['channel'][_0xaffa('0x29')](_0x558a07,'no\x20file\x20audio\x20selected');}var _0x34563e=this[_0xaffa('0x1e')]['sync'](this,_0x558a07[_0xaffa('0x117')]);if(!_0x34563e){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x558a07,_0xaffa('0x16d'));}var _0x5d0cf5=this[_0xaffa('0x33')][_0xaffa('0x57')]('PLAYBACK',[_0x34563e,_0x558a07['opts']]);if(_0x5d0cf5[_0xaffa('0xa7')]===-0x1){return _0x5d0cf5;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0xc3'),_0xaffa('0x176'),_0x34563e));};AGIVertices['prototype']['queue']=function(_0x41ad15){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x177'),_0x41ad15[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x41ad15['queue_id'])){return this['channel'][_0xaffa('0x29')](_0x41ad15,_0xaffa('0x178'));}var _0x572012='';var _0x3a5eeb=parseInt(_0x41ad15[_0xaffa('0x179')],0xa);if(isNaN(_0x3a5eeb)){_0x572012=_0x41ad15[_0xaffa('0x179')];}else{_0x572012=this['getVoiceQueue'][_0xaffa('0x71')](this,_0x41ad15['queue_id']);if(!_0x572012){return this[_0xaffa('0x33')]['error'](_0x41ad15,_0xaffa('0x17a'));}}var _0x35e70b='';if(this['isConfigured'](_0x41ad15[_0xaffa('0x117')])){var _0x5d05fd=this[_0xaffa('0x1e')][_0xaffa('0x71')](this,_0x41ad15[_0xaffa('0x117')]);if(_0x5d05fd){_0x35e70b=_0x5d05fd;}}this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x41ad15,_0x572012);if(_0x41ad15['opts'][_0xaffa('0x17b')]('x')<0x0){_0x41ad15['opts']+='x';}if(_0x41ad15[_0xaffa('0xe7')][_0xaffa('0x17b')]('X')<0x0){_0x41ad15[_0xaffa('0xe7')]+='X';}this[_0xaffa('0x33')]['setVariable'](_0xaffa('0x17c'),_0x572012?_0x572012[_0xaffa('0x17d')]():'');var _0x209053=this[_0xaffa('0x33')][_0xaffa('0x57')]('QUEUE',[_0x572012,_0x41ad15[_0xaffa('0xe7')],_0x41ad15[_0xaffa('0x64')],_0x35e70b,_0x41ad15['timeout'],_0x41ad15['agi'],_0x41ad15[_0xaffa('0x17e')],_0x41ad15[_0xaffa('0x17f')],'',_0x41ad15['position']]);if(_0x209053[_0xaffa('0xa7')]===-0x1){return _0x209053;}return this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xc3'),_0xaffa('0x180'),_0x572012));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x181')]=function(_0x115803){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x182'),_0x115803[_0xaffa('0x35')]));var _0x308b2a=_0x115803[_0xaffa('0x183')]||_0xaffa('0x13f');var _0x4b1222=util[_0xaffa('0x26')](_0xaffa('0x184'),this['channel']['uniqueid'],rs[_0xaffa('0x11e')](0x5));var _0x77cb0e=util[_0xaffa('0x26')](_0xaffa('0x185'),FILES_PATH,_0x4b1222,_0x308b2a);var _0x52e809=util[_0xaffa('0x26')]('%s/recordings/%s',FILES_PATH,_0x4b1222);this[_0xaffa('0x38')]['sync'](this,_0x115803,_0x4b1222,_0x77cb0e);this[_0xaffa('0x33')][_0xaffa('0xa1')]('RECORDING_SAVENAME',_0x4b1222);logger[_0xaffa('0x2c')](_0xaffa('0x186'),_0x52e809,_0x308b2a,_0x115803['escape_digits'],_0x115803['timeout']);return this[_0xaffa('0x33')][_0xaffa('0x136')](_0x52e809,_0x308b2a,_0x115803[_0xaffa('0x187')],_0x115803[_0xaffa('0x66')],undefined,!![]);};AGIVertices[_0xaffa('0x12')][_0xaffa('0x188')]=function(_0x4caef1){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x189'),_0x4caef1[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x4caef1[_0xaffa('0x64')])){return this['channel']['noop'](_0xaffa('0x18a'));}var _0xec36da=this[_0xaffa('0x18b')][_0xaffa('0x71')](this,_0x4caef1);logger[_0xaffa('0x2c')](util[_0xaffa('0x26')]('Response:',util[_0xaffa('0x18c')](_0xec36da,{'showHidden':![],'depth':null})));if(!this[_0xaffa('0xa9')](_0x4caef1[_0xaffa('0xdc')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0x18d'));}var _0x353212=this['getVariable'][_0xaffa('0x71')](this,_0x4caef1[_0xaffa('0xdc')]);if(!_0x353212){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x4caef1,_0xaffa('0xdd'));}this[_0xaffa('0x33')]['setVariable'](util[_0xaffa('0x26')](_0xaffa('0x18e'),_0x353212),_0xec36da[_0xaffa('0x78')]?_0xec36da['statusCode']:_0xaffa('0x18f'));this[_0xaffa('0x33')][_0xaffa('0xa1')](util['format'](_0xaffa('0x190'),_0x353212),_0xec36da[_0xaffa('0x77')]?_0xec36da[_0xaffa('0x77')]:'OK');if(_0xec36da[_0xaffa('0x6c')]){try{this[_0xaffa('0x9f')](_0xec36da['body'],_0x353212);}catch(_0x3739aa){logger[_0xaffa('0x29')](util[_0xaffa('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x353212));}}return this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0xe0'),_0x353212));};AGIVertices['prototype'][_0xaffa('0x191')]=function(_0x3b9a99){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x192'),_0x3b9a99['label']));return this['channel'][_0xaffa('0x193')](_0x3b9a99[_0xaffa('0x194')][_0xaffa('0x59')](/\s+/g,''),_0x3b9a99[_0xaffa('0x187')]);};AGIVertices[_0xaffa('0x12')][_0xaffa('0x195')]=function(_0x540146){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x196'),_0x540146['label']));return this[_0xaffa('0x33')][_0xaffa('0x197')](_0x540146[_0xaffa('0x67')][_0xaffa('0x59')](/\s+/g,''),_0x540146[_0xaffa('0x187')]);};AGIVertices['prototype'][_0xaffa('0x198')]=function(_0x991f70){logger['info'](util[_0xaffa('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x991f70[_0xaffa('0x35')]));return this[_0xaffa('0x33')][_0xaffa('0x199')](_0x991f70[_0xaffa('0x5b')],_0x991f70[_0xaffa('0x187')]);};AGIVertices[_0xaffa('0x12')][_0xaffa('0x19a')]=function(_0x356d97){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x19b'),_0x356d97[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x356d97[_0xaffa('0x19c')])){return this['channel'][_0xaffa('0xae')]('no\x20mail\x20account\x20configured');}var _0x1bbca8=this[_0xaffa('0x19d')][_0xaffa('0x71')](this,_0x356d97[_0xaffa('0x19c')]);if(!_0x1bbca8||!_0x1bbca8[_0xaffa('0x19e')]){return this[_0xaffa('0x33')]['error'](_0x356d97,'no\x20mail\x20account\x20found');}var _0x481331={'from':util[_0xaffa('0x26')](_0xaffa('0x19f'),_0x1bbca8['name'],_0x1bbca8[_0xaffa('0x1a0')]||_0x1bbca8['Smtp'][_0xaffa('0x1a1')]),'to':_0x356d97['to']||'','cc':_0x356d97['cc']||'','bcc':_0x356d97['bcc']||'','subject':_0x356d97[_0xaffa('0x1a2')],'html':_0x356d97['text'],'text':_0x356d97[_0xaffa('0x5b')]};if(this[_0xaffa('0xa9')](_0x356d97[_0xaffa('0x1a3')])){}logger[_0xaffa('0x1a4')](_0xaffa('0x1a5'),JSON[_0xaffa('0x75')](_0x481331));this[_0xaffa('0x32')]['sync'](this,_0x356d97,_0x356d97[_0xaffa('0x19c')]);this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x1a6'),_0x1bbca8[_0xaffa('0x14')]));this[_0xaffa('0x22')][_0xaffa('0x71')](this,_0x1bbca8[_0xaffa('0x1a7')],_0x481331);return this[_0xaffa('0x33')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1a8')]=function(_0x992a3e){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x1a9'),_0x992a3e[_0xaffa('0x35')]));return this[_0xaffa('0x33')][_0xaffa('0xae')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1aa')]=function(_0x3d3c43){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x1ab'),_0x3d3c43[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x3d3c43[_0xaffa('0x1ac')])){return this['channel'][_0xaffa('0xae')](_0xaffa('0x1ad'));}var _0x181665=this[_0xaffa('0x30')][_0xaffa('0x71')](this,_0x3d3c43[_0xaffa('0x1ac')]);if(!_0x181665){return this[_0xaffa('0x33')]['error'](_0x3d3c43,_0xaffa('0x1ae'));}var _0x11ccff={'body':_0x3d3c43[_0xaffa('0x1af')],'phone':_0x3d3c43['to']||'','SmsAccountId':_0x181665['id']};logger[_0xaffa('0x1a4')]('sendSMS\x20message',JSON['stringify'](_0x11ccff));this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x3d3c43,_0x3d3c43[_0xaffa('0x1ac')]);this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x1b0'),_0x181665['name']));this['createSmsMessage'][_0xaffa('0x71')](this,_0x11ccff);return this[_0xaffa('0x33')]['noop'](_0xaffa('0x1b1'));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1b2')]=function(_0x401013){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x1b3'),_0x401013[_0xaffa('0x35')]));if(!this['isConfigured'](_0x401013[_0xaffa('0xdc')])){return this[_0xaffa('0x33')]['error'](_0x401013,_0xaffa('0x1b4'));}var _0x29407b=this['getVariable'][_0xaffa('0x71')](this,_0x401013[_0xaffa('0xdc')]);if(!_0x29407b){return this[_0xaffa('0x33')]['error'](_0x401013,'no\x20variable\x20found');}return this['channel'][_0xaffa('0xa1')](_0x29407b,_0x401013[_0xaffa('0x1b5')]);};AGIVertices['prototype'][_0xaffa('0x1b6')]=function(_0x4454bb){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x1b7'),_0x4454bb[_0xaffa('0x35')]));this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x1b8'));if(_0x4454bb['answer']===_0xaffa('0x1b9')){this['channel'][_0xaffa('0xae')](_0xaffa('0x1ba'));return this[_0xaffa('0x33')][_0xaffa('0xba')]();}return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0x1bb'));};AGIVertices[_0xaffa('0x12')]['subproject']=function(_0x55f2fc){logger['info'](util[_0xaffa('0x26')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x55f2fc[_0xaffa('0x35')]));if(!this[_0xaffa('0xa9')](_0x55f2fc['project_id'])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x55f2fc,'no\x20subproject\x20selected');}var _0x4aafc1=this[_0xaffa('0x18')][_0xaffa('0x71')](this,_0x55f2fc['project_id']);if(!this[_0xaffa('0xa9')](_0x4aafc1)){return this[_0xaffa('0x33')]['error'](_0x55f2fc,util[_0xaffa('0x26')](_0xaffa('0x1bc'),_0x55f2fc[_0xaffa('0x1bd')]));}if(_0x4aafc1===this[_0xaffa('0x33')]['arg_1']){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x55f2fc,_0xaffa('0x1be'));}this['createSquareDetailsReport'][_0xaffa('0x71')](this,_0x55f2fc,_0x4aafc1);var _0x4cce35=this[_0xaffa('0x33')]['exec'](_0xaffa('0x1bf'),util[_0xaffa('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xaffa('0x7')][_0xaffa('0x1c0')]||_0xaffa('0x1c1'),_0x4aafc1,this[_0xaffa('0x33')][_0xaffa('0x37')]));if(_0x4cce35[_0xaffa('0xa7')]===-0x1){return _0x4cce35;}return this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xc3'),_0xaffa('0x1bf'),_0x4aafc1));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1c2')]=function(_0x852060){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x1c3'),_0x852060[_0xaffa('0x35')]));var _0x40986f=this[_0xaffa('0x56')][_0xaffa('0x71')](this,_0x852060['command']);this[_0xaffa('0x32')][_0xaffa('0x71')](this,_0x852060,_0x852060[_0xaffa('0xb8')]);if(this[_0xaffa('0xa9')](_0x852060['variable_id'])){var _0x317a4e=this['getVariable']['sync'](this,_0x852060[_0xaffa('0xdc')]);if(_0x317a4e){this[_0xaffa('0x33')][_0xaffa('0xa1')](_0x317a4e,_0x40986f);return this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x1c4'),_0x852060['command'],_0x317a4e));}}return this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x1c5'),_0x852060[_0xaffa('0xb8')]));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1c6')]=function(_0x547fe3){logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x1c7'),_0x547fe3[_0xaffa('0x35')]));_0x547fe3['text']=_0x547fe3['text'][_0xaffa('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaffa('0xa9')](_0x547fe3['apiKey'])){return this['channel']['noop'](_0xaffa('0x1c8'));}if(!this['isConfigured'](_0x547fe3[_0xaffa('0x5b')])){return this[_0xaffa('0x33')][_0xaffa('0xae')](_0xaffa('0xac'));}this[_0xaffa('0x33')][_0xaffa('0xae')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x547fe3[_0xaffa('0x5b')]));var _0x34c181=this['googleCloudTTS']['sync'](this,_0x547fe3);if(_0x34c181){this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x34c181));var _0x579e7f=this[_0xaffa('0x33')]['streamFile'](_0x34c181);try{fs[_0xaffa('0x108')](_0x34c181+_0xaffa('0x109'));}catch(_0x32218b){logger['error'](_0x32218b);}return _0x579e7f;}return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x547fe3,_0xaffa('0x1c9'));};AGIVertices['prototype'][_0xaffa('0x1ca')]=function(_0x3a22ec){logger['info'](util['format'](_0xaffa('0x1cb'),_0x3a22ec['label']));_0x3a22ec['text']=_0x3a22ec[_0xaffa('0x5b')][_0xaffa('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaffa('0xa9')](_0x3a22ec[_0xaffa('0x5b')])){return this[_0xaffa('0x33')]['noop']('no\x20text\x20configured');}this[_0xaffa('0x33')]['noop'](util['format'](_0xaffa('0x1cc'),_0x3a22ec['text']));var _0x3cfd61=this[_0xaffa('0x62')]['sync'](this,_0x3a22ec);if(_0x3cfd61){this[_0xaffa('0x33')]['noop'](util[_0xaffa('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0x3cfd61));var _0x5ca18f=this[_0xaffa('0x33')]['streamFile'](_0x3cfd61);try{fs[_0xaffa('0x108')](_0x3cfd61+'.wav');}catch(_0x22d641){logger[_0xaffa('0x29')](_0x22d641);}return _0x5ca18f;}return this['channel'][_0xaffa('0x29')](_0x3a22ec,_0xaffa('0x1cd'));};AGIVertices['prototype'][_0xaffa('0x1ce')]=function(_0x39326e){logger['info'](util[_0xaffa('0x26')](_0xaffa('0x1cf'),_0x39326e['label']));if(!this[_0xaffa('0xa9')](_0x39326e[_0xaffa('0x15d')])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x39326e,_0xaffa('0x15e'));}logger[_0xaffa('0x2c')](util['format'](_0xaffa('0x172'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0x39326e[_0xaffa('0x15d')]));var _0x2d601c=this[_0xaffa('0x50')][_0xaffa('0x71')](this,_0x39326e[_0xaffa('0x15d')]);if(_0x2d601c){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x15f'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0x39326e[_0xaffa('0x15d')]));this[_0xaffa('0x33')][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0x15f'),this[_0xaffa('0x33')]['callerid'],_0x39326e[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x160')};}else{logger['info'](util['format'](_0xaffa('0x161'),this['channel'][_0xaffa('0x39')],_0x39326e[_0xaffa('0x15d')]));this[_0xaffa('0x33')][_0xaffa('0xae')](util['format'](_0xaffa('0x161'),this[_0xaffa('0x33')][_0xaffa('0x39')],_0x39326e[_0xaffa('0x15d')]));return{'code':0xc8,'result':_0xaffa('0x162')};}};AGIVertices['prototype'][_0xaffa('0x1d0')]=function(_0x4ae469){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x1d1'),_0x4ae469[_0xaffa('0x35')]));var _0x268d45=this[_0xaffa('0x33')]['exec']('VOICEMAIL',[_0x4ae469[_0xaffa('0x1d2')],_0x4ae469['options']]);if(_0x268d45['result']===-0x1){return _0x268d45;}return this['channel'][_0xaffa('0xae')](util[_0xaffa('0x26')](_0xaffa('0xc3'),_0xaffa('0x1d3'),_0x4ae469['mailbox']));};AGIVertices[_0xaffa('0x12')][_0xaffa('0x1d4')]=function(_0x58f95f){logger[_0xaffa('0x2c')](util[_0xaffa('0x26')](_0xaffa('0x1d5'),_0x58f95f[_0xaffa('0x35')]));if(!this['isConfigured'](_0x58f95f['variable_id'])){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x58f95f,_0xaffa('0x1b4'));}var _0x1a36ba=this[_0xaffa('0xa4')][_0xaffa('0x71')](this,_0x58f95f[_0xaffa('0xdc')]);if(!_0x1a36ba){return this[_0xaffa('0x33')][_0xaffa('0x29')](_0x58f95f,_0xaffa('0xdd'));}var _0x35108f=this[_0xaffa('0x33')][_0xaffa('0xa4')](_0x1a36ba);return{'code':0xc8,'result':_0x35108f['extra']?_0x35108f[_0xaffa('0xa5')]:'-'};};String[_0xaffa('0x12')][_0xaffa('0xa3')]=function(_0x1374c5,_0x5ab8c9){return this[_0xaffa('0xa2')](_0x1374c5)['join'](_0x5ab8c9);};module[_0xaffa('0x1d6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e4b2015..47c88de 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 _0x46df=['timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','channels','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','queue','updateAcw'];(function(_0xcf807,_0x4c736b){var _0x2ef9e9=function(_0x33ed42){while(--_0x33ed42){_0xcf807['push'](_0xcf807['shift']());}};_0x2ef9e9(++_0x4c736b);}(_0x46df,0x1c3));var _0xf46d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x46df[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xf46d('0x0'));var _=require(_0xf46d('0x1'));var moment=require(_0xf46d('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xf46d('0x3'));var RpcUser=require(_0xf46d('0x4'));var RpcVoiceAgentReport=require(_0xf46d('0x5'));function Acw(_0x2e76d2){this[_0xf46d('0x6')]=_0x2e76d2['voiceQueues'];this['agents']=_0x2e76d2[_0xf46d('0x7')];this[_0xf46d('0x8')]=_0x2e76d2[_0xf46d('0x8')];this['channels']={};ami['on']('agentconnect',this[_0xf46d('0x9')][_0xf46d('0xa')](this));ami['on']('hanguprequest',this[_0xf46d('0xb')][_0xf46d('0xa')](this));ami['on'](_0xf46d('0xc'),this[_0xf46d('0xd')]['bind'](this));ami['on'](_0xf46d('0xe'),this[_0xf46d('0xf')][_0xf46d('0xa')](this));ami['on']('attendedtransfer',this[_0xf46d('0x10')]['bind'](this));ami['on'](_0xf46d('0x11'),this[_0xf46d('0x12')][_0xf46d('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0xf46d('0x13')][_0xf46d('0xa')](this));}function getDiff(_0x4350cb){var _0x5de760=moment()[_0xf46d('0x14')](0x0);var _0xa19074=moment(_0x4350cb)[_0xf46d('0x14')](0x0);return _0x5de760['diff'](_0xa19074,_0xf46d('0x15'));}Acw[_0xf46d('0x16')][_0xf46d('0x17')]=function(_0xb11754){try{var _0x31dce1=this;var _0x2bdce2=this['channels'][_0xb11754][_0xf46d('0x18')];var _0x530fcb=this['channels'][_0xb11754]['queue'];var _0x48daa0=this[_0xf46d('0x6')][_0x530fcb];var _0x5f26eb=![];var _0x2bbc18=_0xf46d('0x19');if(_0x48daa0[_0xf46d('0x1a')]){if(_0x48daa0['mandatoryDispositionPause']['name']){_0x5f26eb=!![];_0x2bbc18=_0x48daa0[_0xf46d('0x1b')]['name'];}}ami['Action']({'action':_0xf46d('0x1c'),'interface':_0x2bdce2,'paused':!![],'reason':_0x2bbc18})[_0xf46d('0x1d')](function(_0x408e95){if(_0x31dce1[_0xf46d('0x7')][_0x2bdce2]){return RpcUser[_0xf46d('0x1e')](_0x31dce1[_0xf46d('0x7')][_0x2bdce2]['id'])[_0xf46d('0x1d')](function(_0x20f86b){if(_0x20f86b&&!_0x20f86b[_0xf46d('0x1f')]){logger[_0xf46d('0x20')]('[%s][START][AGENT:%s][QUEUE:%s]',_0xb11754,_0x2bdce2,_0x530fcb);var _0x13a88d=_0x31dce1['channels'][_0xb11754]['attended']&&_0x31dce1[_0xf46d('0x21')][_0xb11754][_0xf46d('0x22')]?_0x31dce1[_0xf46d('0x21')][_0xb11754][_0xf46d('0x22')]:_0xb11754;return RpcUser['savePause'](_0x31dce1[_0xf46d('0x7')][_0x2bdce2],_0x2bbc18,_0x13a88d)[_0xf46d('0x1d')](function(_0x1c1654){if(!_0x5f26eb){_0x31dce1[_0xf46d('0x8')][_0x2bdce2]={};logger[_0xf46d('0x20')](_0xf46d('0x23'),_0xb11754,_0x31dce1[_0xf46d('0x6')][_0x530fcb][_0xf46d('0x24')],_0x2bdce2,_0x530fcb);_0x31dce1[_0xf46d('0x8')][_0x2bdce2]['timer']=setTimeout(_0x31dce1[_0xf46d('0x25')][_0xf46d('0xa')](_0x31dce1,_0x2bdce2),_0x31dce1['voiceQueues'][_0x530fcb]['acwTimeout']*0x3e8);_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x31dce1[_0xf46d('0x8')][_0x2bdce2]['uniqueid']=_0xb11754;_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x27')]=_0x530fcb;_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x28')]=function(){var _0x3bc319=getDiff(_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x26')]);clearTimeout(_0x31dce1[_0xf46d('0x8')][_0x2bdce2][_0xf46d('0x29')]);_0x31dce1['timers'][_0x2bdce2][_0xf46d('0x29')]=![];RpcVoiceAgentReport[_0xf46d('0x2a')]({'acwtime':_0x3bc319},_0x31dce1['timers'][_0x2bdce2][_0xf46d('0x2b')],_0x2bdce2)[_0xf46d('0x1d')](function(_0x5933ab){logger[_0xf46d('0x20')](_0xf46d('0x2c'),_0xb11754,_0x3bc319,_0x5933ab);})[_0xf46d('0x2d')](function(_0x1972cc){logger[_0xf46d('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0xb11754,_0x1972cc);});delete _0x31dce1[_0xf46d('0x8')][_0x2bdce2];};}});}else{logger[_0xf46d('0x20')](_0xf46d('0x2f'),_0xb11754,_0x2bdce2,_0x530fcb);}});}})[_0xf46d('0x2d')](function(_0x56e15f){logger[_0xf46d('0x2e')](_0xf46d('0x23'),_0xb11754,_0x31dce1[_0xf46d('0x6')][_0x530fcb][_0xf46d('0x24')],_0x2bdce2,_0x530fcb);})[_0xf46d('0x30')](function(){delete _0x31dce1[_0xf46d('0x21')][_0xb11754];});}catch(_0x372533){logger[_0xf46d('0x2e')](_0xf46d('0x31'),_0x372533[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0x25')]=function(_0x28d5d2){try{var _0x2ae453=this;if(_0x2ae453[_0xf46d('0x8')][_0x28d5d2]){_0x2ae453['timers'][_0x28d5d2][_0xf46d('0x29')]=![];var _0x537b9d=_0x2ae453[_0xf46d('0x8')][_0x28d5d2][_0xf46d('0x2b')];var _0x344d57=_0x2ae453[_0xf46d('0x8')][_0x28d5d2]['queue'];var _0x5466bd=_0x2ae453[_0xf46d('0x6')][_0x344d57][_0xf46d('0x24')];logger[_0xf46d('0x20')](_0xf46d('0x33'),_0x537b9d,_0x28d5d2);RpcUser[_0xf46d('0x34')](this[_0xf46d('0x7')][_0x28d5d2]);RpcVoiceAgentReport[_0xf46d('0x2a')]({'acwtime':_0x5466bd,'agentacw':!![]},_0x537b9d,_0x28d5d2)[_0xf46d('0x1d')](function(_0x179792){logger['info'](_0xf46d('0x2c'),_0x537b9d,_0x5466bd,_0x179792);})[_0xf46d('0x2d')](function(_0x323e49){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x537b9d,_0x323e49);});}else{logger[_0xf46d('0x2e')](_0xf46d('0x35'),_0x28d5d2);if(_0x2ae453[_0xf46d('0x8')]){logger['info'](_0xf46d('0x36'),JSON[_0xf46d('0x37')](_0x2ae453[_0xf46d('0x8')]));}}}catch(_0x51bb25){logger[_0xf46d('0x2e')](_0xf46d('0x38'),_0x51bb25[_0xf46d('0x32')]);}};Acw['prototype'][_0xf46d('0x9')]=function(_0xe2e812){try{if(this[_0xf46d('0x6')][_0xe2e812[_0xf46d('0x27')]]&&(this['voiceQueues'][_0xe2e812[_0xf46d('0x27')]]['acw']||this[_0xf46d('0x6')][_0xe2e812[_0xf46d('0x27')]][_0xf46d('0x1a')])){if(this['agents'][_0xe2e812[_0xf46d('0x18')]]){this[_0xf46d('0x21')][_0xe2e812['uniqueid']]={'queue':_0xe2e812[_0xf46d('0x27')],'interface':_0xe2e812[_0xf46d('0x18')],'destlinkedid':_0xe2e812[_0xf46d('0x22')]};}}}catch(_0x59836e){logger[_0xf46d('0x2e')](_0xf46d('0x39'),_0x59836e['message']);}};Acw[_0xf46d('0x16')][_0xf46d('0x13')]=function(_0x3be068){try{if(this[_0xf46d('0x6')][_0x3be068['queue']]&&(this[_0xf46d('0x6')][_0x3be068[_0xf46d('0x27')]]['acw']||this[_0xf46d('0x6')][_0x3be068[_0xf46d('0x27')]][_0xf46d('0x1a')])){if(this[_0xf46d('0x7')][_0x3be068[_0xf46d('0x18')]]){this[_0xf46d('0x21')][_0x3be068['uniqueid']]={'queue':_0x3be068[_0xf46d('0x27')],'interface':_0x3be068[_0xf46d('0x18')]};}}}catch(_0x33a5a9){logger[_0xf46d('0x2e')](_0xf46d('0x3a'),_0x33a5a9[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0xb')]=function(_0x32fcd2){try{if(this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x2b')]]&&_[_0xf46d('0x3b')](this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x2b')]]['attended'])){logger[_0xf46d('0x20')](_0xf46d('0x3c'),_0x32fcd2[_0xf46d('0x2b')]);this[_0xf46d('0x17')](_0x32fcd2[_0xf46d('0x2b')]);}else if(this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x3d')]]&&_['isUndefined'](this[_0xf46d('0x21')][_0x32fcd2[_0xf46d('0x3d')]][_0xf46d('0x3e')])){logger['info'](_0xf46d('0x3f'),_0x32fcd2[_0xf46d('0x3d')]);this['startAcw'](_0x32fcd2[_0xf46d('0x3d')]);}}catch(_0xbea5cc){logger[_0xf46d('0x2e')](_0xf46d('0x40'),_0xbea5cc[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0xd')]=function(_0x3c1d8e){try{if(this['channels'][_0x3c1d8e[_0xf46d('0x2b')]]&&this[_0xf46d('0x21')][_0x3c1d8e[_0xf46d('0x2b')]]['attended']){logger[_0xf46d('0x20')](_0xf46d('0x41'),_0x3c1d8e[_0xf46d('0x2b')]);this[_0xf46d('0x17')](_0x3c1d8e['uniqueid']);}else if(this[_0xf46d('0x21')][_0x3c1d8e[_0xf46d('0x3d')]]&&this[_0xf46d('0x21')][_0x3c1d8e['linkedid']][_0xf46d('0x3e')]){logger['info'](_0xf46d('0x42'),_0x3c1d8e['linkedid']);this[_0xf46d('0x17')](_0x3c1d8e['linkedid']);}}catch(_0x1a656e){logger[_0xf46d('0x2e')](_0xf46d('0x43'),_0x1a656e[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0x10')]=function(_0xc70581){try{if(!_[_0xf46d('0x44')](this[_0xf46d('0x21')][_0xc70581['transfereeuniqueid']])){this['startAcw'](_0xc70581[_0xf46d('0x45')]);if(this[_0xf46d('0x21')][_0xc70581['secondtransfereruniqueid']]){this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x46')]][_0xf46d('0x3e')]=!![];this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x47')]]=this['channels'][_0xc70581['secondtransfereruniqueid']];delete this[_0xf46d('0x21')][_0xc70581['secondtransfereruniqueid']];}}else if(!_[_0xf46d('0x44')](this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x47')]])){this['startAcw'](_0xc70581[_0xf46d('0x47')]);if(this['channels'][_0xc70581[_0xf46d('0x48')]]){this['channels'][_0xc70581[_0xf46d('0x48')]][_0xf46d('0x3e')]=!![];this[_0xf46d('0x21')][_0xc70581['transfereeuniqueid']]=this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x48')]];delete this[_0xf46d('0x21')][_0xc70581[_0xf46d('0x48')]];}}}catch(_0x259607){logger[_0xf46d('0x2e')](_0xf46d('0x49'),_0x259607[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0x12')]=function(_0x33223c){try{if(this[_0xf46d('0x21')][_0x33223c[_0xf46d('0x4a')]]){logger[_0xf46d('0x20')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf46d('0x37')](_0x33223c[_0xf46d('0x4a')]));this[_0xf46d('0x17')](_0x33223c['transfereruniqueid']);}else if(this['channels'][_0x33223c[_0xf46d('0x4b')]]){logger[_0xf46d('0x20')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xf46d('0x37')](_0x33223c['transfererlinkedid']));this['startAcw'](_0x33223c[_0xf46d('0x4b')]);}}catch(_0x284106){logger['error'](_0xf46d('0x4c'),_0x284106[_0xf46d('0x32')]);}};Acw[_0xf46d('0x16')][_0xf46d('0xf')]=function(_0x5cef6c){try{if(this['voiceQueues'][_0x5cef6c[_0xf46d('0x27')]]&&this['voiceQueues'][_0x5cef6c[_0xf46d('0x27')]]['autopause']===_0xf46d('0x4d')){if(this[_0xf46d('0x7')][_0x5cef6c['interface']]){logger[_0xf46d('0x20')](_0xf46d('0x4e'),_0x5cef6c[_0xf46d('0x2b')],_0x5cef6c['interface'],_0x5cef6c[_0xf46d('0x27')]);return RpcUser[_0xf46d('0x4f')](this['agents'][_0x5cef6c[_0xf46d('0x18')]],_0xf46d('0x50'),_0x5cef6c[_0xf46d('0x2b')]);}}}catch(_0x268d60){logger[_0xf46d('0x2e')](_0xf46d('0x51'),_0x268d60[_0xf46d('0x32')]);}};module['exports']=Acw; \ No newline at end of file +var _0x4b64=['[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../../../config/logger','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','startAcw','channels','interface','queue','mandatoryDisposition','name','then','getAgent','info'];(function(_0x2c4745,_0x461743){var _0x5e6619=function(_0x249ce0){while(--_0x249ce0){_0x2c4745['push'](_0x2c4745['shift']());}};_0x5e6619(++_0x461743);}(_0x4b64,0x8b));var _0x44b6=function(_0x423c77,_0x468893){_0x423c77=_0x423c77-0x0;var _0x709302=_0x4b64[_0x423c77];return _0x709302;};'use strict';var util=require(_0x44b6('0x0'));var _=require(_0x44b6('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x44b6('0x2'))('acw');var RpcUser=require(_0x44b6('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x37a863){this['voiceQueues']=_0x37a863[_0x44b6('0x4')];this[_0x44b6('0x5')]=_0x37a863[_0x44b6('0x5')];this[_0x44b6('0x6')]=_0x37a863['timers'];this['channels']={};ami['on'](_0x44b6('0x7'),this[_0x44b6('0x8')][_0x44b6('0x9')](this));ami['on'](_0x44b6('0xa'),this['syncHangupRequest'][_0x44b6('0x9')](this));ami['on'](_0x44b6('0xb'),this['syncHangup']['bind'](this));ami['on'](_0x44b6('0xc'),this['syncAgentRingNoAnswer'][_0x44b6('0x9')](this));ami['on'](_0x44b6('0xd'),this[_0x44b6('0xe')][_0x44b6('0x9')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x44b6('0x9')](this));ami['on'](_0x44b6('0xf'),this[_0x44b6('0x10')][_0x44b6('0x9')](this));}function getDiff(_0x34b06d){var _0xcc7bba=moment()['milliseconds'](0x0);var _0x45d989=moment(_0x34b06d)['milliseconds'](0x0);return _0xcc7bba[_0x44b6('0x11')](_0x45d989,_0x44b6('0x12'));}Acw[_0x44b6('0x13')][_0x44b6('0x14')]=function(_0x4225fa){try{var _0x58af90=this;var _0x1d5200=this[_0x44b6('0x15')][_0x4225fa][_0x44b6('0x16')];var _0x5bccc2=this[_0x44b6('0x15')][_0x4225fa][_0x44b6('0x17')];var _0x5768b8=this[_0x44b6('0x4')][_0x5bccc2];var _0x51d3c5=![];var _0x30afcf='ACW';if(_0x5768b8[_0x44b6('0x18')]){if(_0x5768b8['mandatoryDispositionPause'][_0x44b6('0x19')]){_0x51d3c5=!![];_0x30afcf=_0x5768b8['mandatoryDispositionPause'][_0x44b6('0x19')];}}ami['Action']({'action':'QueuePause','interface':_0x1d5200,'paused':!![],'reason':_0x30afcf})[_0x44b6('0x1a')](function(_0x1abf81){if(_0x58af90[_0x44b6('0x5')][_0x1d5200]){return RpcUser[_0x44b6('0x1b')](_0x58af90[_0x44b6('0x5')][_0x1d5200]['id'])[_0x44b6('0x1a')](function(_0x3d9f1d){if(_0x3d9f1d&&!_0x3d9f1d['voicePause']){logger[_0x44b6('0x1c')](_0x44b6('0x1d'),_0x4225fa,_0x1d5200,_0x5bccc2);var _0x36b755=_0x58af90[_0x44b6('0x15')][_0x4225fa][_0x44b6('0x1e')]&&_0x58af90[_0x44b6('0x15')][_0x4225fa]['destlinkedid']?_0x58af90[_0x44b6('0x15')][_0x4225fa][_0x44b6('0x1f')]:_0x4225fa;return RpcUser[_0x44b6('0x20')](_0x58af90[_0x44b6('0x5')][_0x1d5200],_0x30afcf,_0x36b755)[_0x44b6('0x1a')](function(_0x22caea){if(!_0x51d3c5){_0x58af90[_0x44b6('0x6')][_0x1d5200]={};logger[_0x44b6('0x1c')](_0x44b6('0x21'),_0x4225fa,_0x58af90[_0x44b6('0x4')][_0x5bccc2]['acwTimeout'],_0x1d5200,_0x5bccc2);_0x58af90['timers'][_0x1d5200]['timer']=setTimeout(_0x58af90[_0x44b6('0x22')]['bind'](_0x58af90,_0x1d5200),_0x58af90[_0x44b6('0x4')][_0x5bccc2][_0x44b6('0x23')]*0x3e8);_0x58af90['timers'][_0x1d5200][_0x44b6('0x24')]=moment()['format'](_0x44b6('0x25'));_0x58af90[_0x44b6('0x6')][_0x1d5200]['uniqueid']=_0x4225fa;_0x58af90[_0x44b6('0x6')][_0x1d5200][_0x44b6('0x17')]=_0x5bccc2;_0x58af90['timers'][_0x1d5200][_0x44b6('0x26')]=function(){var _0x2a5903=getDiff(_0x58af90[_0x44b6('0x6')][_0x1d5200][_0x44b6('0x24')]);clearTimeout(_0x58af90[_0x44b6('0x6')][_0x1d5200][_0x44b6('0x27')]);_0x58af90[_0x44b6('0x6')][_0x1d5200]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x2a5903},_0x58af90[_0x44b6('0x6')][_0x1d5200][_0x44b6('0x28')],_0x1d5200)[_0x44b6('0x1a')](function(_0x12a8e4){logger['info'](_0x44b6('0x29'),_0x4225fa,_0x2a5903,_0x12a8e4);})[_0x44b6('0x2a')](function(_0x42e2d7){logger[_0x44b6('0x2b')](_0x44b6('0x2c'),_0x4225fa,_0x42e2d7);});delete _0x58af90[_0x44b6('0x6')][_0x1d5200];};}});}else{logger[_0x44b6('0x1c')](_0x44b6('0x2d'),_0x4225fa,_0x1d5200,_0x5bccc2);}});}})['catch'](function(_0x1fdabc){logger[_0x44b6('0x2b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4225fa,_0x58af90[_0x44b6('0x4')][_0x5bccc2][_0x44b6('0x23')],_0x1d5200,_0x5bccc2);})[_0x44b6('0x2e')](function(){delete _0x58af90[_0x44b6('0x15')][_0x4225fa];});}catch(_0x4a9474){logger[_0x44b6('0x2b')](_0x44b6('0x2f'),_0x4a9474[_0x44b6('0x30')]);}};Acw['prototype'][_0x44b6('0x22')]=function(_0x3931fd){try{var _0x419902=this;if(_0x419902[_0x44b6('0x6')][_0x3931fd]){_0x419902['timers'][_0x3931fd][_0x44b6('0x27')]=![];var _0x40405e=_0x419902['timers'][_0x3931fd]['uniqueid'];var _0x3aa425=_0x419902['timers'][_0x3931fd][_0x44b6('0x17')];var _0x27696c=_0x419902[_0x44b6('0x4')][_0x3aa425][_0x44b6('0x23')];logger[_0x44b6('0x1c')](_0x44b6('0x31'),_0x40405e,_0x3931fd);RpcUser[_0x44b6('0x32')](this[_0x44b6('0x5')][_0x3931fd]);RpcVoiceAgentReport[_0x44b6('0x33')]({'acwtime':_0x27696c,'agentacw':!![]},_0x40405e,_0x3931fd)['then'](function(_0x348ce2){logger[_0x44b6('0x1c')](_0x44b6('0x29'),_0x40405e,_0x27696c,_0x348ce2);})[_0x44b6('0x2a')](function(_0x63ed2e){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x40405e,_0x63ed2e);});}else{logger[_0x44b6('0x2b')](_0x44b6('0x34'),_0x3931fd);if(_0x419902[_0x44b6('0x6')]){logger[_0x44b6('0x1c')](_0x44b6('0x35'),JSON['stringify'](_0x419902[_0x44b6('0x6')]));}}}catch(_0xf7f916){logger[_0x44b6('0x2b')](_0x44b6('0x36'),_0xf7f916[_0x44b6('0x30')]);}};Acw[_0x44b6('0x13')]['syncAgentConnect']=function(_0x4b3517){try{if(this[_0x44b6('0x4')][_0x4b3517[_0x44b6('0x17')]]&&(this[_0x44b6('0x4')][_0x4b3517['queue']]['acw']||this[_0x44b6('0x4')][_0x4b3517[_0x44b6('0x17')]][_0x44b6('0x18')])){if(this[_0x44b6('0x5')][_0x4b3517[_0x44b6('0x16')]]){this[_0x44b6('0x15')][_0x4b3517[_0x44b6('0x28')]]={'queue':_0x4b3517[_0x44b6('0x17')],'interface':_0x4b3517[_0x44b6('0x16')],'destlinkedid':_0x4b3517[_0x44b6('0x1f')]};}}}catch(_0x5a523c){logger[_0x44b6('0x2b')](_0x44b6('0x37'),_0x5a523c['message']);}};Acw['prototype'][_0x44b6('0x10')]=function(_0x5e687d){try{if(this[_0x44b6('0x4')][_0x5e687d[_0x44b6('0x17')]]&&(this[_0x44b6('0x4')][_0x5e687d[_0x44b6('0x17')]][_0x44b6('0x38')]||this['voiceQueues'][_0x5e687d['queue']][_0x44b6('0x18')])){if(this[_0x44b6('0x5')][_0x5e687d['interface']]){this[_0x44b6('0x15')][_0x5e687d['uniqueid']]={'queue':_0x5e687d[_0x44b6('0x17')],'interface':_0x5e687d[_0x44b6('0x16')]};}}}catch(_0x4450a6){logger[_0x44b6('0x2b')](_0x44b6('0x39'),_0x4450a6[_0x44b6('0x30')]);}};Acw[_0x44b6('0x13')][_0x44b6('0x3a')]=function(_0x1bc608){try{if(this[_0x44b6('0x15')][_0x1bc608[_0x44b6('0x28')]]&&_[_0x44b6('0x3b')](this[_0x44b6('0x15')][_0x1bc608['uniqueid']][_0x44b6('0x1e')])){logger[_0x44b6('0x1c')](_0x44b6('0x3c'),_0x1bc608[_0x44b6('0x28')]);this[_0x44b6('0x14')](_0x1bc608[_0x44b6('0x28')]);}else if(this[_0x44b6('0x15')][_0x1bc608[_0x44b6('0x3d')]]&&_['isUndefined'](this[_0x44b6('0x15')][_0x1bc608[_0x44b6('0x3d')]]['attended'])){logger[_0x44b6('0x1c')](_0x44b6('0x3e'),_0x1bc608['linkedid']);this[_0x44b6('0x14')](_0x1bc608[_0x44b6('0x3d')]);}}catch(_0x4ba46d){logger[_0x44b6('0x2b')]('[ACW][syncHangupRequest]\x20%s',_0x4ba46d[_0x44b6('0x30')]);}};Acw[_0x44b6('0x13')]['syncHangup']=function(_0x5aa448){try{if(this[_0x44b6('0x15')][_0x5aa448['uniqueid']]&&this[_0x44b6('0x15')][_0x5aa448[_0x44b6('0x28')]][_0x44b6('0x1e')]){logger['info'](_0x44b6('0x3f'),_0x5aa448['uniqueid']);this[_0x44b6('0x14')](_0x5aa448['uniqueid']);}else if(this[_0x44b6('0x15')][_0x5aa448[_0x44b6('0x3d')]]&&this[_0x44b6('0x15')][_0x5aa448[_0x44b6('0x3d')]]['attended']){logger[_0x44b6('0x1c')](_0x44b6('0x40'),_0x5aa448[_0x44b6('0x3d')]);this['startAcw'](_0x5aa448[_0x44b6('0x3d')]);}}catch(_0x256b9d){logger[_0x44b6('0x2b')](_0x44b6('0x41'),_0x256b9d[_0x44b6('0x30')]);}};Acw[_0x44b6('0x13')][_0x44b6('0xe')]=function(_0x79b2d2){try{if(!_['isNil'](this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x42')]])){this[_0x44b6('0x14')](_0x79b2d2[_0x44b6('0x42')]);if(this['channels'][_0x79b2d2[_0x44b6('0x43')]]){this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x43')]][_0x44b6('0x1e')]=!![];this[_0x44b6('0x15')][_0x79b2d2['transfertargetuniqueid']]=this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x43')]];delete this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x43')]];}}else if(!_[_0x44b6('0x44')](this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x45')]])){this[_0x44b6('0x14')](_0x79b2d2[_0x44b6('0x45')]);if(this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x46')]]){this[_0x44b6('0x15')][_0x79b2d2['origtransfereruniqueid']][_0x44b6('0x1e')]=!![];this[_0x44b6('0x15')][_0x79b2d2['transfereeuniqueid']]=this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x46')]];delete this[_0x44b6('0x15')][_0x79b2d2[_0x44b6('0x46')]];}}}catch(_0x2b2f20){logger[_0x44b6('0x2b')](_0x44b6('0x47'),_0x2b2f20[_0x44b6('0x30')]);}};Acw['prototype'][_0x44b6('0x48')]=function(_0x1b0647){try{if(this['channels'][_0x1b0647['transfereruniqueid']]){logger['info'](_0x44b6('0x49'),JSON[_0x44b6('0x4a')](_0x1b0647[_0x44b6('0x4b')]));this['startAcw'](_0x1b0647[_0x44b6('0x4b')]);}else if(this['channels'][_0x1b0647[_0x44b6('0x4c')]]){logger[_0x44b6('0x1c')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x44b6('0x4a')](_0x1b0647[_0x44b6('0x4c')]));this[_0x44b6('0x14')](_0x1b0647[_0x44b6('0x4c')]);}}catch(_0x40c9bf){logger[_0x44b6('0x2b')]('[ACW][syncBlindTransfer]\x20%s',_0x40c9bf[_0x44b6('0x30')]);}};Acw['prototype'][_0x44b6('0x4d')]=function(_0x276d91){try{if(this[_0x44b6('0x4')][_0x276d91[_0x44b6('0x17')]]&&this['voiceQueues'][_0x276d91['queue']][_0x44b6('0x4e')]===_0x44b6('0x4f')){if(this[_0x44b6('0x5')][_0x276d91[_0x44b6('0x16')]]){logger[_0x44b6('0x1c')](_0x44b6('0x50'),_0x276d91[_0x44b6('0x28')],_0x276d91[_0x44b6('0x16')],_0x276d91['queue']);return RpcUser[_0x44b6('0x20')](this['agents'][_0x276d91['interface']],_0x44b6('0x51'),_0x276d91[_0x44b6('0x28')]);}}}catch(_0x32912a){logger[_0x44b6('0x2b')](_0x44b6('0x52'),_0x32912a[_0x44b6('0x30')]);}};module[_0x44b6('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ca9381b..d10d237 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x178a03,_0x4116e7){var _0x3d860d=function(_0x4a9aed){while(--_0x4a9aed){_0x178a03['push'](_0x178a03['shift']());}};_0x3d860d(++_0x4116e7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x0b0e[_0x57f345];return _0x255e43;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2032,0xd9));var _0x2203=function(_0xcc2338,_0x49f684){_0xcc2338=_0xcc2338-0x0;var _0x583fba=_0x2032[_0xcc2338];return _0x583fba;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c93cd27..f6ed6f2 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0xbf9f51,_0x527014){var _0x2c6175=function(_0x3f2061){while(--_0x3f2061){_0xbf9f51['push'](_0xbf9f51['shift']());}};_0x2c6175(++_0x527014);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4e71ac,_0x42aced){_0x4e71ac=_0x4e71ac-0x0;var _0x11d76c=_0xbdb7[_0x4e71ac];return _0x11d76c;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x460b85,_0x5278f3){_0x460b85=_0x460b85-0x0;var _0xfba32=_0x9bde[_0x460b85];return _0xfba32;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c8cc7c6..72a1be4 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ace=['exports','util','lodash','moment','isNil','string','uniqueid','Contact','firstName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue'];(function(_0x356bca,_0x523386){var _0x28cb11=function(_0x2f113a){while(--_0x2f113a){_0x356bca['push'](_0x356bca['shift']());}};_0x28cb11(++_0x523386);}(_0x9ace,0x10f));var _0xe9ac=function(_0x12254a,_0x3ce844){_0x12254a=_0x12254a-0x0;var _0x50965b=_0x9ace[_0x12254a];return _0x50965b;};'use strict';var util=require(_0xe9ac('0x0'));var _=require(_0xe9ac('0x1'));var moment=require(_0xe9ac('0x2'));function checkNameSurname(_0x35688d,_0x592913,_0x28060e){var _0x3b0f91='';if(!_[_0xe9ac('0x3')](_0x592913)&&'string'===typeof _0x592913){_0x3b0f91+=_0x592913;}if(!_['isNil'](_0x28060e)&&_0xe9ac('0x4')===typeof _0x28060e){_0x3b0f91+='\x20'+_0x28060e;}if(_0x3b0f91!==''){return _0x3b0f91;}return _0x35688d;}function Action(_0x3a33cf,_0x2c276a,_0x378ed0){this['voiceQueue']=_0x3a33cf;this[_0xe9ac('0x5')]=_0x378ed0||undefined;this['name']=checkNameSurname(_0x2c276a['Contact']['phone'],_0x2c276a[_0xe9ac('0x6')][_0xe9ac('0x7')],_0x2c276a[_0xe9ac('0x6')]['lastName']);this[_0xe9ac('0x8')]=_0x2c276a['phone'];this[_0xe9ac('0x9')]=_0x3a33cf[_0xe9ac('0xa')];this[_0xe9ac('0xb')]=_0x2c276a[_0xe9ac('0xb')]||![];this[_0xe9ac('0xc')]=_0x3a33cf['type'];this[_0xe9ac('0xd')]=_0x3a33cf[_0xe9ac('0xd')]||0x3;this[_0xe9ac('0xe')]=_0x2c276a[_0xe9ac('0xe')];this['countbusyretry']=_0x2c276a['countbusyretry'];this['countcongestionretry']=_0x2c276a[_0xe9ac('0xf')];this['countnoanswerretry']=_0x2c276a['countnoanswerretry'];this['countnosuchnumberretry']=_0x2c276a[_0xe9ac('0x10')];this['countdropretry']=_0x2c276a[_0xe9ac('0x11')];this[_0xe9ac('0x12')]=_0x2c276a[_0xe9ac('0x12')];this[_0xe9ac('0x13')]=_0x2c276a[_0xe9ac('0x13')];this[_0xe9ac('0x14')]=_0x2c276a['countagentrejectretry'];this[_0xe9ac('0x15')]=_0x2c276a[_0xe9ac('0x15')];this[_0xe9ac('0x16')]=_0x2c276a[_0xe9ac('0x16')];this[_0xe9ac('0x17')]=_0x2c276a['UserId'];this[_0xe9ac('0x18')]=_0x2c276a['VoiceQueueId'];this['CampaignId']=_0x2c276a[_0xe9ac('0x19')];this[_0xe9ac('0x1a')]=_0x2c276a['id'];this[_0xe9ac('0x1b')]=_0x2c276a[_0xe9ac('0x6')][_0xe9ac('0x7')]||'';this[_0xe9ac('0x1c')]=moment()[_0xe9ac('0x1d')](_0xe9ac('0x1e'));this[_0xe9ac('0x1f')]=_0x2c276a['callback'];this[_0xe9ac('0x20')]=_0x2c276a['callbackuniqueid'];this[_0xe9ac('0x21')]=_0x2c276a[_0xe9ac('0x21')];this['recallme']=_0x2c276a[_0xe9ac('0x22')];this[_0xe9ac('0x23')]='';this[_0xe9ac('0x24')]='';}Action[_0xe9ac('0x25')][_0xe9ac('0x26')]=function(){return util['format'](_0xe9ac('0x27'),this['name'],this[_0xe9ac('0x28')][_0xe9ac('0x29')]>0x0?this[_0xe9ac('0x8')][_0xe9ac('0x2a')](this[_0xe9ac('0x28')][_0xe9ac('0x29')]):this[_0xe9ac('0x8')]);};Action[_0xe9ac('0x25')][_0xe9ac('0x2b')]=function(){return this[_0xe9ac('0x9')];};module[_0xe9ac('0x2c')]=Action; \ No newline at end of file +var _0xd24e=['ListId','UserId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','substring','dialCutDigit','exports','util','lodash','moment','string','isNil','name','Contact','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','ContactId'];(function(_0x31653a,_0x2d4122){var _0x271209=function(_0x5c1558){while(--_0x5c1558){_0x31653a['push'](_0x31653a['shift']());}};_0x271209(++_0x2d4122);}(_0xd24e,0xc9));var _0xed24=function(_0x344a2b,_0x4166bc){_0x344a2b=_0x344a2b-0x0;var _0x427856=_0xd24e[_0x344a2b];return _0x427856;};'use strict';var util=require(_0xed24('0x0'));var _=require(_0xed24('0x1'));var moment=require(_0xed24('0x2'));function checkNameSurname(_0x255e7c,_0x40d6bb,_0x23ab4c){var _0x3e0ca4='';if(!_['isNil'](_0x40d6bb)&&_0xed24('0x3')===typeof _0x40d6bb){_0x3e0ca4+=_0x40d6bb;}if(!_[_0xed24('0x4')](_0x23ab4c)&&'string'===typeof _0x23ab4c){_0x3e0ca4+='\x20'+_0x23ab4c;}if(_0x3e0ca4!==''){return _0x3e0ca4;}return _0x255e7c;}function Action(_0x2964f0,_0x3b1967,_0x175a7e){this['voiceQueue']=_0x2964f0;this['uniqueid']=_0x175a7e||undefined;this[_0xed24('0x5')]=checkNameSurname(_0x3b1967['Contact']['phone'],_0x3b1967[_0xed24('0x6')]['firstName'],_0x3b1967['Contact']['lastName']);this[_0xed24('0x7')]=_0x3b1967[_0xed24('0x8')];this[_0xed24('0x9')]=_0x2964f0[_0xed24('0x5')];this[_0xed24('0xa')]=_0x3b1967[_0xed24('0xa')]||![];this[_0xed24('0xb')]=_0x2964f0[_0xed24('0xb')];this[_0xed24('0xc')]=_0x2964f0['dialQueueTimeout']||0x3;this['scheduledat']=_0x3b1967[_0xed24('0xd')];this[_0xed24('0xe')]=_0x3b1967[_0xed24('0xe')];this[_0xed24('0xf')]=_0x3b1967[_0xed24('0xf')];this[_0xed24('0x10')]=_0x3b1967[_0xed24('0x10')];this[_0xed24('0x11')]=_0x3b1967[_0xed24('0x11')];this[_0xed24('0x12')]=_0x3b1967[_0xed24('0x12')];this['countabandonedretry']=_0x3b1967['countabandonedretry'];this['countmachineretry']=_0x3b1967['countmachineretry'];this['countagentrejectretry']=_0x3b1967[_0xed24('0x13')];this[_0xed24('0x14')]=_0x3b1967[_0xed24('0x14')];this['ListId']=_0x3b1967[_0xed24('0x15')];this[_0xed24('0x16')]=_0x3b1967['UserId'];this['VoiceQueueId']=_0x3b1967['VoiceQueueId'];this['CampaignId']=_0x3b1967['CampaignId'];this[_0xed24('0x17')]=_0x3b1967['id'];this[_0xed24('0x18')]=_0x3b1967[_0xed24('0x6')][_0xed24('0x19')]||'';this[_0xed24('0x1a')]=moment()['format'](_0xed24('0x1b'));this[_0xed24('0x1c')]=_0x3b1967['callback'];this[_0xed24('0x1d')]=_0x3b1967['callbackuniqueid'];this[_0xed24('0x1e')]=_0x3b1967[_0xed24('0x1e')];this['recallme']=_0x3b1967[_0xed24('0x1f')];this['originatecalleridnum']='';this[_0xed24('0x20')]='';}Action[_0xed24('0x21')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xed24('0x5')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xed24('0x7')][_0xed24('0x22')](this['voiceQueue'][_0xed24('0x23')]):this[_0xed24('0x7')]);};Action[_0xed24('0x21')]['getQueue']=function(){return this[_0xed24('0x9')];};module[_0xed24('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e951d9e..d91d2d0 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdca9=['holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2e1be2,_0x110634){var _0x253dd6=function(_0x2dc60b){while(--_0x2dc60b){_0x2e1be2['push'](_0x2e1be2['shift']());}};_0x253dd6(++_0x110634);}(_0xdca9,0x129));var _0x9dca=function(_0x4b8d20,_0x45b36e){_0x4b8d20=_0x4b8d20-0x0;var _0x4913ff=_0xdca9[_0x4b8d20];return _0x4913ff;};'use strict';var util=require(_0x9dca('0x0'));var _=require(_0x9dca('0x1'));var moment=require(_0x9dca('0x2'));function getSeconds(_0x27f9cf,_0x181c5d){var _0xdeb88b=moment(_0x27f9cf)[_0x9dca('0x3')](0x0);var _0x4440fd=moment(_0x181c5d)[_0x9dca('0x3')](0x0);return _0xdeb88b[_0x9dca('0x4')](_0x4440fd,'seconds');}function AgentComplete(_0x474204,_0x259a59){this[_0x9dca('0x5')]=0x4;this[_0x9dca('0x6')]='Answer';this[_0x9dca('0x7')]=_0x474204[_0x9dca('0x7')];this['type']=_0x474204[_0x9dca('0x8')];this[_0x9dca('0x9')]=_0x474204['type']===_0x9dca('0xa')?_0x9dca('0xb'):_0x474204['type'];this[_0x9dca('0xc')]=_0x474204['countbusyretry'];this[_0x9dca('0xd')]=_0x474204[_0x9dca('0xd')];this[_0x9dca('0xe')]=_0x474204[_0x9dca('0xe')];this[_0x9dca('0xf')]=_0x474204[_0x9dca('0xc')]+_0x474204['countcongestionretry']+_0x474204[_0x9dca('0xe')]+_0x474204[_0x9dca('0x10')]+_0x474204[_0x9dca('0x11')]+_0x474204[_0x9dca('0x12')]+_0x474204[_0x9dca('0x13')]+_0x474204[_0x9dca('0x14')];this[_0x9dca('0x10')]=_0x474204[_0x9dca('0x10')];this[_0x9dca('0x11')]=_0x474204[_0x9dca('0x11')];this[_0x9dca('0x12')]=_0x474204[_0x9dca('0x12')];this[_0x9dca('0x13')]=_0x474204['countmachineretry'];this[_0x9dca('0x14')]=_0x474204[_0x9dca('0x14')];this[_0x9dca('0x15')]=_0x259a59[_0x9dca('0x15')];this[_0x9dca('0x16')]=_0x474204[_0x9dca('0x17')];this[_0x9dca('0x18')]=_0x474204[_0x9dca('0x19')];this['starttime']=_0x474204[_0x9dca('0x1a')];this[_0x9dca('0x1b')]=_0x474204[_0x9dca('0x1b')];this[_0x9dca('0x1c')]=_0x474204['answertime'];this[_0x9dca('0x1d')]=moment()[_0x9dca('0x1e')](_0x9dca('0x1f'));this['ringtime']=getSeconds(_0x474204[_0x9dca('0x1b')],_0x474204['starttime']);this[_0x9dca('0x20')]=getSeconds(_0x474204[_0x9dca('0x1c')],_0x474204['responsetime']);this['talktime']=getSeconds(this[_0x9dca('0x1d')],_0x474204['answertime']);this['queue']=_0x259a59['queue'];this[_0x9dca('0x21')]=_0x259a59[_0x9dca('0x21')];this[_0x9dca('0x22')]=_0x259a59[_0x9dca('0x22')];this[_0x9dca('0x23')]=_0x474204[_0x9dca('0x23')];this['callbackuniqueid']=_0x474204[_0x9dca('0x24')];this[_0x9dca('0x25')]=_0x474204['callbackat'];this[_0x9dca('0x26')]=_0x474204['recallme'];this[_0x9dca('0x27')]=_0x474204[_0x9dca('0x27')];this[_0x9dca('0x28')]=_0x474204['ListId'];this[_0x9dca('0x29')]=_0x474204[_0x9dca('0x29')];this[_0x9dca('0x2a')]=_0x474204[_0x9dca('0x2a')];this[_0x9dca('0x2b')]=_0x474204[_0x9dca('0x2b')];this[_0x9dca('0x2c')]=_0x474204[_0x9dca('0x2c')]||'';this[_0x9dca('0x2d')]=_0x474204[_0x9dca('0x2d')]||'';}module[_0x9dca('0x2e')]=AgentComplete; \ No newline at end of file +var _0xe31e=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x48f8ae,_0x350a65){var _0x29ad25=function(_0x38ecd2){while(--_0x38ecd2){_0x48f8ae['push'](_0x48f8ae['shift']());}};_0x29ad25(++_0x350a65);}(_0xe31e,0x11a));var _0xee31=function(_0x18a031,_0x4992da){_0x18a031=_0x18a031-0x0;var _0x280154=_0xe31e[_0x18a031];return _0x280154;};'use strict';var util=require(_0xee31('0x0'));var _=require('lodash');var moment=require(_0xee31('0x1'));function getSeconds(_0xba841b,_0x306622){var _0x38740a=moment(_0xba841b)[_0xee31('0x2')](0x0);var _0x568598=moment(_0x306622)[_0xee31('0x2')](0x0);return _0x38740a[_0xee31('0x3')](_0x568598,_0xee31('0x4'));}function AgentComplete(_0x3d2c89,_0x22bde0){this[_0xee31('0x5')]=0x4;this[_0xee31('0x6')]='Answer';this[_0xee31('0x7')]=_0x3d2c89[_0xee31('0x7')];this[_0xee31('0x8')]=_0x3d2c89[_0xee31('0x8')];this['campaigntype']=_0x3d2c89['type']==='outbound'?'queue':_0x3d2c89['type'];this[_0xee31('0x9')]=_0x3d2c89['countbusyretry'];this[_0xee31('0xa')]=_0x3d2c89[_0xee31('0xa')];this[_0xee31('0xb')]=_0x3d2c89[_0xee31('0xb')];this[_0xee31('0xc')]=_0x3d2c89[_0xee31('0x9')]+_0x3d2c89['countcongestionretry']+_0x3d2c89[_0xee31('0xb')]+_0x3d2c89['countnosuchnumberretry']+_0x3d2c89['countdropretry']+_0x3d2c89[_0xee31('0xd')]+_0x3d2c89[_0xee31('0xe')]+_0x3d2c89['countagentrejectretry'];this[_0xee31('0xf')]=_0x3d2c89[_0xee31('0xf')];this[_0xee31('0x10')]=_0x3d2c89[_0xee31('0x10')];this[_0xee31('0xd')]=_0x3d2c89[_0xee31('0xd')];this[_0xee31('0xe')]=_0x3d2c89[_0xee31('0xe')];this['countagentrejectretry']=_0x3d2c89[_0xee31('0x11')];this['uniqueid']=_0x22bde0[_0xee31('0x12')];this[_0xee31('0x13')]=_0x3d2c89[_0xee31('0x14')];this[_0xee31('0x15')]=_0x3d2c89[_0xee31('0x16')];this[_0xee31('0x17')]=_0x3d2c89[_0xee31('0x17')];this[_0xee31('0x18')]=_0x3d2c89[_0xee31('0x18')];this[_0xee31('0x19')]=_0x3d2c89['answertime'];this[_0xee31('0x1a')]=moment()[_0xee31('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xee31('0x1c')]=getSeconds(_0x3d2c89['responsetime'],_0x3d2c89[_0xee31('0x17')]);this[_0xee31('0x1d')]=getSeconds(_0x3d2c89['answertime'],_0x3d2c89[_0xee31('0x18')]);this[_0xee31('0x1e')]=getSeconds(this['endtime'],_0x3d2c89[_0xee31('0x19')]);this[_0xee31('0x1f')]=_0x22bde0[_0xee31('0x1f')];this['membername']=_0x22bde0[_0xee31('0x20')];this[_0xee31('0x21')]=_0x22bde0['reason'];this[_0xee31('0x22')]=_0x3d2c89[_0xee31('0x22')];this['callbackuniqueid']=_0x3d2c89[_0xee31('0x23')];this[_0xee31('0x24')]=_0x3d2c89[_0xee31('0x24')];this[_0xee31('0x25')]=_0x3d2c89['recallme'];this[_0xee31('0x26')]=_0x3d2c89[_0xee31('0x26')];this[_0xee31('0x27')]=_0x3d2c89[_0xee31('0x27')];this[_0xee31('0x28')]=_0x3d2c89['UserId'];this[_0xee31('0x29')]=_0x3d2c89[_0xee31('0x29')];this[_0xee31('0x2a')]=_0x3d2c89[_0xee31('0x2a')];this['originatecalleridnum']=_0x3d2c89[_0xee31('0x2b')]||'';this[_0xee31('0x2c')]=_0x3d2c89['originatecalleridname']||'';}module[_0xee31('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index eb50e1e..25346ae 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04de=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ListId','UserId'];(function(_0x51295c,_0x4004e5){var _0x3faa89=function(_0x1826da){while(--_0x1826da){_0x51295c['push'](_0x51295c['shift']());}};_0x3faa89(++_0x4004e5);}(_0x04de,0x107));var _0xe04d=function(_0x393cde,_0x44b2f3){_0x393cde=_0x393cde-0x0;var _0x3a09af=_0x04de[_0x393cde];return _0x3a09af;};'use strict';var util=require(_0xe04d('0x0'));var _=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));function getSeconds(_0x299552,_0x1e650d){var _0x28f63f=moment(_0x299552)[_0xe04d('0x3')](0x0);var _0x43c4b1=moment(_0x1e650d)[_0xe04d('0x3')](0x0);return _0x28f63f[_0xe04d('0x4')](_0x43c4b1,_0xe04d('0x5'));}function Final(_0x4804c8){this['uniqueid']=_0x4804c8['uniqueid'];this['scheduledat']=_0x4804c8[_0xe04d('0x6')];this[_0xe04d('0x7')]=_0x4804c8[_0xe04d('0x7')];this[_0xe04d('0x8')]=_0x4804c8[_0xe04d('0x7')]===_0xe04d('0x9')?_0xe04d('0xa'):_0x4804c8[_0xe04d('0x7')];this['countbusyretry']=_0x4804c8[_0xe04d('0xb')];this[_0xe04d('0xc')]=_0x4804c8[_0xe04d('0xc')];this[_0xe04d('0xd')]=_0x4804c8[_0xe04d('0xd')];this[_0xe04d('0xe')]=_0x4804c8[_0xe04d('0xb')]+_0x4804c8[_0xe04d('0xc')]+_0x4804c8[_0xe04d('0xd')]+_0x4804c8['countnosuchnumberretry']+_0x4804c8[_0xe04d('0xf')]+_0x4804c8[_0xe04d('0x10')]+_0x4804c8[_0xe04d('0x11')]+_0x4804c8[_0xe04d('0x12')];this[_0xe04d('0x13')]=_0x4804c8[_0xe04d('0x13')];this[_0xe04d('0xf')]=_0x4804c8[_0xe04d('0xf')];this[_0xe04d('0x10')]=_0x4804c8[_0xe04d('0x10')];this[_0xe04d('0x11')]=_0x4804c8[_0xe04d('0x11')];this['countagentrejectretry']=_0x4804c8[_0xe04d('0x12')];this['queue']=_0x4804c8[_0xe04d('0xa')];this['calleridname']=_0x4804c8[_0xe04d('0x14')];this[_0xe04d('0x15')]=_0x4804c8[_0xe04d('0x15')];this[_0xe04d('0x16')]=_0x4804c8[_0xe04d('0x16')];this[_0xe04d('0x17')]=_0x4804c8[_0xe04d('0x17')];this[_0xe04d('0x18')]=_0x4804c8[_0xe04d('0x17')];this['ringtime']=_0x4804c8[_0xe04d('0x19')]||0x0;this[_0xe04d('0x1a')]=_0x4804c8[_0xe04d('0x1a')]||0x0;this[_0xe04d('0x1b')]=_0x4804c8[_0xe04d('0x1b')]||0x0;this[_0xe04d('0x1c')]=_0x4804c8['callback'];this[_0xe04d('0x1d')]=_0x4804c8[_0xe04d('0x1d')];this['callbackat']=_0x4804c8['callbackat'];this['recallme']=_0x4804c8[_0xe04d('0x1e')];this['ContactId']=_0x4804c8['ContactId'];this[_0xe04d('0x1f')]=_0x4804c8[_0xe04d('0x1f')];this['UserId']=_0x4804c8[_0xe04d('0x20')];this['VoiceQueueId']=_0x4804c8[_0xe04d('0x21')];this['CampaignId']=_0x4804c8[_0xe04d('0x22')];this[_0xe04d('0x23')]=_0x4804c8[_0xe04d('0x23')]||'';this[_0xe04d('0x24')]=_0x4804c8[_0xe04d('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0x5577=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId'];(function(_0x566399,_0x26428d){var _0x55d295=function(_0x19910e){while(--_0x19910e){_0x566399['push'](_0x566399['shift']());}};_0x55d295(++_0x26428d);}(_0x5577,0x1b4));var _0x7557=function(_0xb1f1a2,_0x5839b9){_0xb1f1a2=_0xb1f1a2-0x0;var _0x40418f=_0x5577[_0xb1f1a2];return _0x40418f;};'use strict';var util=require(_0x7557('0x0'));var _=require('lodash');var moment=require(_0x7557('0x1'));function getSeconds(_0x389954,_0x52a8c6){var _0x34636a=moment(_0x389954)[_0x7557('0x2')](0x0);var _0x25c0da=moment(_0x52a8c6)[_0x7557('0x2')](0x0);return _0x34636a[_0x7557('0x3')](_0x25c0da,_0x7557('0x4'));}function Final(_0x5862e6){this[_0x7557('0x5')]=_0x5862e6[_0x7557('0x5')];this[_0x7557('0x6')]=_0x5862e6[_0x7557('0x6')];this[_0x7557('0x7')]=_0x5862e6[_0x7557('0x7')];this[_0x7557('0x8')]=_0x5862e6[_0x7557('0x7')]===_0x7557('0x9')?_0x7557('0xa'):_0x5862e6[_0x7557('0x7')];this[_0x7557('0xb')]=_0x5862e6[_0x7557('0xb')];this[_0x7557('0xc')]=_0x5862e6[_0x7557('0xc')];this['countnoanswerretry']=_0x5862e6['countnoanswerretry'];this[_0x7557('0xd')]=_0x5862e6[_0x7557('0xb')]+_0x5862e6[_0x7557('0xc')]+_0x5862e6[_0x7557('0xe')]+_0x5862e6[_0x7557('0xf')]+_0x5862e6[_0x7557('0x10')]+_0x5862e6[_0x7557('0x11')]+_0x5862e6[_0x7557('0x12')]+_0x5862e6[_0x7557('0x13')];this[_0x7557('0xf')]=_0x5862e6['countnosuchnumberretry'];this[_0x7557('0x10')]=_0x5862e6[_0x7557('0x10')];this[_0x7557('0x11')]=_0x5862e6['countabandonedretry'];this[_0x7557('0x12')]=_0x5862e6[_0x7557('0x12')];this[_0x7557('0x13')]=_0x5862e6[_0x7557('0x13')];this['queue']=_0x5862e6[_0x7557('0xa')];this[_0x7557('0x14')]=_0x5862e6['calleridname'];this['calleridnum']=_0x5862e6[_0x7557('0x15')];this[_0x7557('0x16')]=_0x5862e6[_0x7557('0x16')];this[_0x7557('0x17')]=_0x5862e6['responsetime'];this[_0x7557('0x18')]=_0x5862e6['responsetime'];this[_0x7557('0x19')]=_0x5862e6[_0x7557('0x19')]||0x0;this[_0x7557('0x1a')]=_0x5862e6[_0x7557('0x1a')]||0x0;this['talktime']=_0x5862e6[_0x7557('0x1b')]||0x0;this[_0x7557('0x1c')]=_0x5862e6[_0x7557('0x1c')];this[_0x7557('0x1d')]=_0x5862e6[_0x7557('0x1d')];this['callbackat']=_0x5862e6['callbackat'];this['recallme']=_0x5862e6[_0x7557('0x1e')];this['ContactId']=_0x5862e6[_0x7557('0x1f')];this[_0x7557('0x20')]=_0x5862e6[_0x7557('0x20')];this[_0x7557('0x21')]=_0x5862e6[_0x7557('0x21')];this[_0x7557('0x22')]=_0x5862e6[_0x7557('0x22')];this['CampaignId']=_0x5862e6[_0x7557('0x23')];this['originatecalleridnum']=_0x5862e6[_0x7557('0x24')]||'';this['originatecalleridname']=_0x5862e6[_0x7557('0x25')]||'';}module[_0x7557('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 34b98fe..24ba18d 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b28=['CampaignId','exports','util','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','starttime','holdtime','talktime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4cfbbc,_0xd5ead8){var _0x1a0e21=function(_0x414cb6){while(--_0x414cb6){_0x4cfbbc['push'](_0x4cfbbc['shift']());}};_0x1a0e21(++_0xd5ead8);}(_0x4b28,0xa6));var _0x84b2=function(_0x6bddc3,_0x36563e){_0x6bddc3=_0x6bddc3-0x0;var _0x868581=_0x4b28[_0x6bddc3];return _0x868581;};'use strict';var util=require(_0x84b2('0x0'));var _=require('lodash');var moment=require(_0x84b2('0x1'));function getSeconds(_0x691e41,_0x5751a8){var _0x5344f0=moment(_0x691e41)[_0x84b2('0x2')](0x0);var _0x91f14e=moment(_0x5751a8)['milliseconds'](0x0);return _0x5344f0['diff'](_0x91f14e,_0x84b2('0x3'));}function Hangup(_0x30644d,_0xcadf6c){this[_0x84b2('0x4')]=0x4;this[_0x84b2('0x5')]=_0x84b2('0x6');this[_0x84b2('0x7')]=_0x30644d['scheduledat'];this['type']=_0x30644d[_0x84b2('0x8')];this['campaigntype']=_0x30644d[_0x84b2('0x8')]==='outbound'?_0x84b2('0x9'):_0x30644d[_0x84b2('0x8')];this[_0x84b2('0xa')]=_0x30644d['countbusyretry'];this['countcongestionretry']=_0x30644d['countcongestionretry'];this[_0x84b2('0xb')]=_0x30644d[_0x84b2('0xb')];this[_0x84b2('0xc')]=_0x30644d[_0x84b2('0xa')]+_0x30644d['countcongestionretry']+_0x30644d[_0x84b2('0xb')]+_0x30644d[_0x84b2('0xd')]+_0x30644d['countdropretry']+_0x30644d[_0x84b2('0xe')]+_0x30644d[_0x84b2('0xf')]+_0x30644d[_0x84b2('0x10')];this[_0x84b2('0xd')]=_0x30644d[_0x84b2('0xd')];this['countdropretry']=_0x30644d[_0x84b2('0x11')];this[_0x84b2('0xe')]=_0x30644d[_0x84b2('0xe')];this[_0x84b2('0xf')]=_0x30644d[_0x84b2('0xf')];this[_0x84b2('0x10')]=_0x30644d['countagentrejectretry'];this[_0x84b2('0x12')]=_0xcadf6c[_0x84b2('0x12')];this['calleridname']=_0x30644d[_0x84b2('0x13')];this[_0x84b2('0x14')]=_0x30644d[_0x84b2('0x15')];this['starttime']=_0x30644d['starttime'];this[_0x84b2('0x16')]=_0x30644d[_0x84b2('0x16')];this[_0x84b2('0x17')]=moment()[_0x84b2('0x18')](_0x84b2('0x19'));this['ringtime']=getSeconds(_0x30644d[_0x84b2('0x16')],_0x30644d[_0x84b2('0x1a')]);this[_0x84b2('0x1b')]=0x0;this[_0x84b2('0x1c')]=getSeconds(this['endtime'],_0x30644d[_0x84b2('0x16')]);this[_0x84b2('0x9')]=_0x30644d[_0x84b2('0x9')];this[_0x84b2('0x1d')]=_0x84b2('0x1e');this['reason']=_0xcadf6c['cause-txt'];this['callback']=_0x30644d[_0x84b2('0x1f')];this[_0x84b2('0x20')]=_0x30644d[_0x84b2('0x20')];this[_0x84b2('0x21')]=_0x30644d[_0x84b2('0x21')];this[_0x84b2('0x22')]=_0x30644d[_0x84b2('0x22')];this[_0x84b2('0x23')]=_0x30644d[_0x84b2('0x23')];this[_0x84b2('0x24')]=_0x30644d['ListId'];this[_0x84b2('0x25')]=_0x30644d['UserId'];this['VoiceQueueId']=_0x30644d[_0x84b2('0x26')];this[_0x84b2('0x27')]=_0x30644d[_0x84b2('0x27')];}module[_0x84b2('0x28')]=Hangup; \ No newline at end of file +var _0x9d39=['format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','lodash','milliseconds','diff','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x307e06,_0x32f986){var _0x4e5ae9=function(_0x348894){while(--_0x348894){_0x307e06['push'](_0x307e06['shift']());}};_0x4e5ae9(++_0x32f986);}(_0x9d39,0x1bc));var _0x99d3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9d39[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var _=require(_0x99d3('0x0'));var moment=require('moment');function getSeconds(_0x5e6d56,_0xd3d000){var _0x506b3b=moment(_0x5e6d56)[_0x99d3('0x1')](0x0);var _0x60dba=moment(_0xd3d000)['milliseconds'](0x0);return _0x506b3b[_0x99d3('0x2')](_0x60dba,'seconds');}function Hangup(_0x249911,_0x1a24d2){this['state']=0x4;this['statedesc']=_0x99d3('0x3');this[_0x99d3('0x4')]=_0x249911[_0x99d3('0x4')];this[_0x99d3('0x5')]=_0x249911[_0x99d3('0x5')];this['campaigntype']=_0x249911['type']===_0x99d3('0x6')?_0x99d3('0x7'):_0x249911[_0x99d3('0x5')];this[_0x99d3('0x8')]=_0x249911[_0x99d3('0x8')];this[_0x99d3('0x9')]=_0x249911[_0x99d3('0x9')];this[_0x99d3('0xa')]=_0x249911[_0x99d3('0xa')];this[_0x99d3('0xb')]=_0x249911[_0x99d3('0x8')]+_0x249911[_0x99d3('0x9')]+_0x249911['countnoanswerretry']+_0x249911['countnosuchnumberretry']+_0x249911[_0x99d3('0xc')]+_0x249911[_0x99d3('0xd')]+_0x249911[_0x99d3('0xe')]+_0x249911['countagentrejectretry'];this[_0x99d3('0xf')]=_0x249911['countnosuchnumberretry'];this['countdropretry']=_0x249911[_0x99d3('0xc')];this[_0x99d3('0xd')]=_0x249911['countabandonedretry'];this[_0x99d3('0xe')]=_0x249911[_0x99d3('0xe')];this[_0x99d3('0x10')]=_0x249911['countagentrejectretry'];this[_0x99d3('0x11')]=_0x1a24d2[_0x99d3('0x11')];this['calleridname']=_0x249911[_0x99d3('0x12')];this[_0x99d3('0x13')]=_0x249911[_0x99d3('0x14')];this['starttime']=_0x249911[_0x99d3('0x15')];this['responsetime']=_0x249911[_0x99d3('0x16')];this[_0x99d3('0x17')]=moment()[_0x99d3('0x18')](_0x99d3('0x19'));this['ringtime']=getSeconds(_0x249911[_0x99d3('0x16')],_0x249911[_0x99d3('0x15')]);this['holdtime']=0x0;this[_0x99d3('0x1a')]=getSeconds(this[_0x99d3('0x17')],_0x249911['responsetime']);this[_0x99d3('0x7')]=_0x249911[_0x99d3('0x7')];this[_0x99d3('0x1b')]=_0x99d3('0x1c');this['reason']=_0x1a24d2[_0x99d3('0x1d')];this[_0x99d3('0x1e')]=_0x249911['callback'];this[_0x99d3('0x1f')]=_0x249911[_0x99d3('0x1f')];this['callbackat']=_0x249911[_0x99d3('0x20')];this[_0x99d3('0x21')]=_0x249911[_0x99d3('0x21')];this[_0x99d3('0x22')]=_0x249911[_0x99d3('0x22')];this[_0x99d3('0x23')]=_0x249911[_0x99d3('0x23')];this['UserId']=_0x249911['UserId'];this[_0x99d3('0x24')]=_0x249911[_0x99d3('0x24')];this[_0x99d3('0x25')]=_0x249911[_0x99d3('0x25')];}module[_0x99d3('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 0b2be05..b42d19e 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6097=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6097,0x8d));var _0x7609=function(_0xe775be,_0x4822af){_0xe775be=_0xe775be-0x0;var _0x49e73c=_0x6097[_0xe775be];return _0x49e73c;};'use strict';var util=require(_0x7609('0x0'));var _=require('lodash');var moment=require(_0x7609('0x1'));function getSeconds(_0x833834,_0x30420c){var _0xee53ad=moment(_0x833834)[_0x7609('0x2')](0x0);var _0x5685d9=moment(_0x30420c)['milliseconds'](0x0);return _0xee53ad[_0x7609('0x3')](_0x5685d9,'seconds');}function History(_0x524454){this[_0x7609('0x4')]=_0x524454[_0x7609('0x4')];this[_0x7609('0x5')]=_0x524454[_0x7609('0x5')]||undefined;this[_0x7609('0x6')]=_0x524454[_0x7609('0x6')];this[_0x7609('0x7')]=_0x524454['type']===_0x7609('0x8')?_0x7609('0x9'):_0x524454[_0x7609('0x6')];this[_0x7609('0xa')]=_0x524454[_0x7609('0xa')];this['countcongestionretry']=_0x524454[_0x7609('0xb')];this[_0x7609('0xc')]=_0x524454[_0x7609('0xc')];this[_0x7609('0xd')]=_0x524454['countbusyretry']+_0x524454['countcongestionretry']+_0x524454[_0x7609('0xc')]+_0x524454[_0x7609('0xe')]+_0x524454[_0x7609('0xf')]+_0x524454[_0x7609('0x10')]+_0x524454[_0x7609('0x11')]+_0x524454[_0x7609('0x12')];this[_0x7609('0xe')]=_0x524454[_0x7609('0xe')];this[_0x7609('0xf')]=_0x524454[_0x7609('0xf')];this['countabandonedretry']=_0x524454[_0x7609('0x10')];this[_0x7609('0x11')]=_0x524454[_0x7609('0x11')];this['countagentrejectretry']=_0x524454[_0x7609('0x12')];this['queue']=_0x524454[_0x7609('0x9')];this[_0x7609('0x13')]=_0x524454[_0x7609('0x14')];this[_0x7609('0x15')]=_0x524454['number'];this[_0x7609('0x16')]=_0x524454[_0x7609('0x16')];this['responsetime']=_0x524454['responsetime'];this[_0x7609('0x17')]=_0x524454['responsetime'];this[_0x7609('0x18')]=getSeconds(_0x524454['responsetime'],_0x524454['starttime']);this[_0x7609('0x19')]=0x0;this[_0x7609('0x1a')]=0x0;this[_0x7609('0x1b')]=_0x524454[_0x7609('0x1b')];this['callbackuniqueid']=_0x524454[_0x7609('0x1c')];this[_0x7609('0x1d')]=_0x524454[_0x7609('0x1d')];this['recallme']=_0x524454['recallme'];this[_0x7609('0x1e')]=_0x524454[_0x7609('0x1e')];this[_0x7609('0x1f')]=_0x524454[_0x7609('0x1f')];this[_0x7609('0x20')]=_0x524454[_0x7609('0x20')];this[_0x7609('0x21')]=_0x524454[_0x7609('0x21')];this['CampaignId']=_0x524454[_0x7609('0x22')];this[_0x7609('0x23')]=_0x524454[_0x7609('0x23')]||'';this[_0x7609('0x24')]=_0x524454['originatecalleridname']||'';}module[_0x7609('0x25')]=History; \ No newline at end of file +var _0x7a3e=['starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number'];(function(_0x152d0b,_0x3eeaad){var _0x4ff3f6=function(_0x34e9d7){while(--_0x34e9d7){_0x152d0b['push'](_0x152d0b['shift']());}};_0x4ff3f6(++_0x3eeaad);}(_0x7a3e,0x65));var _0xe7a3=function(_0x1ca417,_0x2409c3){_0x1ca417=_0x1ca417-0x0;var _0x32cda4=_0x7a3e[_0x1ca417];return _0x32cda4;};'use strict';var util=require(_0xe7a3('0x0'));var _=require(_0xe7a3('0x1'));var moment=require(_0xe7a3('0x2'));function getSeconds(_0x268b84,_0x40768e){var _0x308e7c=moment(_0x268b84)[_0xe7a3('0x3')](0x0);var _0x1cce2c=moment(_0x40768e)[_0xe7a3('0x3')](0x0);return _0x308e7c[_0xe7a3('0x4')](_0x1cce2c,_0xe7a3('0x5'));}function History(_0x2780ae){this[_0xe7a3('0x6')]=_0x2780ae['uniqueid'];this['scheduledat']=_0x2780ae[_0xe7a3('0x7')]||undefined;this[_0xe7a3('0x8')]=_0x2780ae[_0xe7a3('0x8')];this[_0xe7a3('0x9')]=_0x2780ae[_0xe7a3('0x8')]===_0xe7a3('0xa')?_0xe7a3('0xb'):_0x2780ae[_0xe7a3('0x8')];this['countbusyretry']=_0x2780ae['countbusyretry'];this[_0xe7a3('0xc')]=_0x2780ae[_0xe7a3('0xc')];this[_0xe7a3('0xd')]=_0x2780ae['countnoanswerretry'];this[_0xe7a3('0xe')]=_0x2780ae[_0xe7a3('0xf')]+_0x2780ae['countcongestionretry']+_0x2780ae[_0xe7a3('0xd')]+_0x2780ae['countnosuchnumberretry']+_0x2780ae[_0xe7a3('0x10')]+_0x2780ae[_0xe7a3('0x11')]+_0x2780ae[_0xe7a3('0x12')]+_0x2780ae[_0xe7a3('0x13')];this[_0xe7a3('0x14')]=_0x2780ae[_0xe7a3('0x14')];this['countdropretry']=_0x2780ae['countdropretry'];this[_0xe7a3('0x11')]=_0x2780ae[_0xe7a3('0x11')];this[_0xe7a3('0x12')]=_0x2780ae[_0xe7a3('0x12')];this[_0xe7a3('0x13')]=_0x2780ae['countagentrejectretry'];this[_0xe7a3('0xb')]=_0x2780ae[_0xe7a3('0xb')];this[_0xe7a3('0x15')]=_0x2780ae[_0xe7a3('0x16')];this[_0xe7a3('0x17')]=_0x2780ae[_0xe7a3('0x18')];this[_0xe7a3('0x19')]=_0x2780ae[_0xe7a3('0x19')];this[_0xe7a3('0x1a')]=_0x2780ae[_0xe7a3('0x1a')];this[_0xe7a3('0x1b')]=_0x2780ae[_0xe7a3('0x1a')];this[_0xe7a3('0x1c')]=getSeconds(_0x2780ae[_0xe7a3('0x1a')],_0x2780ae[_0xe7a3('0x19')]);this[_0xe7a3('0x1d')]=0x0;this['talktime']=0x0;this[_0xe7a3('0x1e')]=_0x2780ae[_0xe7a3('0x1e')];this[_0xe7a3('0x1f')]=_0x2780ae[_0xe7a3('0x1f')];this[_0xe7a3('0x20')]=_0x2780ae['callbackat'];this[_0xe7a3('0x21')]=_0x2780ae[_0xe7a3('0x21')];this[_0xe7a3('0x22')]=_0x2780ae[_0xe7a3('0x22')];this[_0xe7a3('0x23')]=_0x2780ae[_0xe7a3('0x23')];this[_0xe7a3('0x24')]=_0x2780ae[_0xe7a3('0x24')];this[_0xe7a3('0x25')]=_0x2780ae['VoiceQueueId'];this[_0xe7a3('0x26')]=_0x2780ae[_0xe7a3('0x26')];this[_0xe7a3('0x27')]=_0x2780ae[_0xe7a3('0x27')]||'';this['originatecalleridname']=_0x2780ae[_0xe7a3('0x28')]||'';}module[_0xe7a3('0x29')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 045b8f7..48b70db 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 _0xc4e6=['diff','seconds','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','milliseconds','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','format','error','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','then','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','saveInDb','pick','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','value','outboundAnswerCallsDay','statedesc','HangupInAMD','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','minutes','ContactId','ListId','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','dialGlobalMaxRetry','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','AGI','dialQueueProject','Unknow','[syncHangupIvr]','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','indexOf','command','iftime\x20%s,%s','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','predictive','method\x20not\x20recognized','handleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','filter','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','syncCampaigns','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','outboundQueuePauses','predictiveIntervalHitRate','[CatchErlangB]','busyFactor','[getDataPredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','loggerHandler','dialLimitQueue','not_inuse','dialOrderByScheduledAt','ACTIVE','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0xc4e6[_0x3932eb];return _0x5316e5;};'use strict';var util=require(_0x6c4e('0x0'));var _=require(_0x6c4e('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6c4e('0x2'));var moment=require(_0x6c4e('0x3'));var rr=require('rr');var md5=require(_0x6c4e('0x4'));var Redis=require(_0x6c4e('0x5'));var ut=require('../preview/util/util');var config=require(_0x6c4e('0x6'));var logger=require(_0x6c4e('0x7'))(_0x6c4e('0x8'));var loggerBooked=require('../../../config/logger')(_0x6c4e('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x6c4e('0x7'))(_0x6c4e('0xa'));var loggerSyncQueueSummary=require(_0x6c4e('0x7'))(_0x6c4e('0xb'));var ami=require(_0x6c4e('0xc'));config[_0x6c4e('0xd')]=_[_0x6c4e('0xe')](config[_0x6c4e('0xd')],{'host':_0x6c4e('0xf'),'port':0x18eb});var io=require(_0x6c4e('0x10'))(new Redis(config[_0x6c4e('0xd')]));var cmHopper=require(_0x6c4e('0x11'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x6c4e('0x12'));var cmHopperBlack=require(_0x6c4e('0x13'));var voiceQueueRt=require(_0x6c4e('0x14'));var RpcSetting=require('../rpc/setting');var Action=require(_0x6c4e('0x15'));var History=require(_0x6c4e('0x16'));var Final=require(_0x6c4e('0x17'));var AgentComplete=require(_0x6c4e('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x6c4e('0x19'));var ipAgi=process[_0x6c4e('0x1a')][_0x6c4e('0x1b')]||_0x6c4e('0x1c');var strategy={'rrmemory':_0x6c4e('0x1d'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6c4e('0x1e')][_0x6c4e('0x1f')]=function(_0x1b7746){this['tail']=this['tail']?this['tail']['finally'](_0x1b7746):_0x1b7746();};function Dialer(_0xb0b06c,_0x5946e1){this[_0x6c4e('0x20')]=new Sequence();this['preview']=_0x5946e1;this[_0x6c4e('0x21')]=_0xb0b06c[_0x6c4e('0x21')];this['campaigns']=_0xb0b06c[_0x6c4e('0x22')];this['agents']=_0xb0b06c[_0x6c4e('0x23')];this[_0x6c4e('0x24')]=_0xb0b06c[_0x6c4e('0x24')];this[_0x6c4e('0x25')]=config['maxNumberOriginate']||0x2;this[_0x6c4e('0x26')]={};this[_0x6c4e('0x27')]={};this['contactsId']={};this[_0x6c4e('0x28')]={};this[_0x6c4e('0x29')]={};this[_0x6c4e('0x2a')]={};this[_0x6c4e('0x2b')]={};this[_0x6c4e('0x2c')]={};this['queueBooked']={};this[_0x6c4e('0x2d')]={};ami['on'](_0x6c4e('0x2e'),this['syncAgentConnect']['bind'](this));ami['on'](_0x6c4e('0x2f'),this[_0x6c4e('0x30')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x32'),this[_0x6c4e('0x33')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x34'),this['syncAgentComplete'][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x35'),this[_0x6c4e('0xb')][_0x6c4e('0x31')](this));ami['on']('custom:queuesummarycomplete',this[_0x6c4e('0x36')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x37'),this[_0x6c4e('0x38')][_0x6c4e('0x31')](this));ami['on'](_0x6c4e('0x39'),this[_0x6c4e('0x3a')]['bind'](this));ami['on'](_0x6c4e('0x3b'),this[_0x6c4e('0x3c')]['bind'](this));ami['on'](_0x6c4e('0x3d'),this[_0x6c4e('0x3e')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x6c4e('0x3f')][_0x6c4e('0x31')](this));this['loopCampaigns']();this[_0x6c4e('0x40')]();RpcSetting[_0x6c4e('0x41')]()['then'](function(_0x3e6412){previewRecallmeReminderInterval=_0x3e6412['previewRecallmeReminderInterval'];});}function isNotNull(_0x153743){return _0x153743!==null&&!_[_0x6c4e('0x42')](_0x153743);}function checkIsLoggedIn(_0x5a9e0d,_0x25c96a){return function(){if(_0x25c96a<=0x0){_0x5a9e0d['message']=_0x6c4e('0x43');throw _0x5a9e0d[_0x6c4e('0x44')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x418283){return _0x418283;}function checkIsActive(_0x597d1a,_0x338d3e){return function(){if(!isActive(_0x338d3e)){_0x597d1a[_0x6c4e('0x45')]=_0x6c4e('0x46');throw _0x597d1a[_0x6c4e('0x44')]+_0x6c4e('0x47');}};}function checkInterval(_0xd6285d){return function(){if(!isNotNull(_0xd6285d['Interval'])){_0xd6285d[_0x6c4e('0x45')]=_0x6c4e('0x48');throw _0xd6285d[_0x6c4e('0x44')]+_0x6c4e('0x49');}if(!isNotNull(_0xd6285d[_0x6c4e('0x4a')][_0x6c4e('0x4b')])){_0xd6285d[_0x6c4e('0x45')]=_0x6c4e('0x48');throw _0xd6285d[_0x6c4e('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0xd6285d[_0x6c4e('0x4a')][_0x6c4e('0x4b')]))){_0xd6285d[_0x6c4e('0x45')]=_0x6c4e('0x48');throw _0xd6285d[_0x6c4e('0x44')]+_0x6c4e('0x49');}};}function msgResponse(_0x18b459,_0x27aaa2,_0x385be7){return{'action':_0x18b459,'response':_0x27aaa2,'message':_0x385be7,'stack':_0x385be7};}function myreject(_0x58e446){return function(_0x5ec04c){return _0x58e446(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x5ec04c)));};}function getSeconds(_0x2d2755,_0x2fe749){var _0x444834=moment(_0x2d2755)['milliseconds'](0x0);var _0x465569=moment(_0x2fe749)['milliseconds'](0x0);return _0x444834[_0x6c4e('0x4c')](_0x465569,_0x6c4e('0x4d'));}function emit(_0x564ee7,_0x5712ea,_0x3ddb81){io['to'](_0x564ee7)[_0x6c4e('0x4e')](_0x5712ea,_0x3ddb81);}function emitVoiceQueueSummary(_0x203e7c){if(_0x203e7c[_0x6c4e('0x4f')]===_0x6c4e('0x50')){var _0x10ccd2={'id':_0x203e7c['id'],'name':_0x203e7c[_0x6c4e('0x44')],'strategy':_0x203e7c[_0x6c4e('0x51')],'answered':_0x203e7c[_0x6c4e('0x52')],'available':_0x203e7c[_0x6c4e('0x53')],'loggedIn':_0x203e7c['loggedIn'],'pTalking':_0x203e7c[_0x6c4e('0x54')],'sumBillable':_0x203e7c[_0x6c4e('0x55')],'sumDuration':_0x203e7c[_0x6c4e('0x56')],'sumHoldTime':_0x203e7c[_0x6c4e('0x57')]||0x0,'talking':_0x203e7c[_0x6c4e('0x58')],'total':_0x203e7c[_0x6c4e('0x59')],'type':_0x203e7c[_0x6c4e('0x4f')],'unmanaged':_0x203e7c[_0x6c4e('0x5a')],'abandoned':_0x203e7c[_0x6c4e('0x5b')],'waiting':_0x203e7c[_0x6c4e('0x5c')],'loggedInDb':_0x203e7c[_0x6c4e('0x5d')],'dialActive':_0x203e7c['dialActive'],'dialMethod':_0x203e7c[_0x6c4e('0x5e')],'dialOriginateCallerIdName':_0x203e7c['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x203e7c[_0x6c4e('0x5f')],'dialOriginateTimeout':_0x203e7c[_0x6c4e('0x60')],'dialPrefix':_0x203e7c[_0x6c4e('0x61')],'outboundAnswerAgiCallsDay':_0x203e7c[_0x6c4e('0x62')],'outboundAnswerCallsDay':_0x203e7c['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x203e7c[_0x6c4e('0x63')],'outboundBusyCallsDay':_0x203e7c['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x203e7c[_0x6c4e('0x64')],'outboundDropCallsDayACS':_0x203e7c['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x203e7c[_0x6c4e('0x65')],'outboundDropCallsDayTimeout':_0x203e7c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x203e7c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x203e7c[_0x6c4e('0x66')],'outboundOriginateFailureCallsDay':_0x203e7c[_0x6c4e('0x67')],'outboundReCallsDay':_0x203e7c[_0x6c4e('0x68')],'outboundRejectCallsDay':_0x203e7c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x203e7c[_0x6c4e('0x69')],'predictiveIntervalAnsweredCalls':_0x203e7c[_0x6c4e('0x6a')],'predictiveIntervalAvgHoldtime':_0x203e7c[_0x6c4e('0x6b')],'predictiveIntervalAvgTalktime':_0x203e7c[_0x6c4e('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x203e7c[_0x6c4e('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x203e7c[_0x6c4e('0x6e')],'predictiveIntervalErlangCalls':_0x203e7c[_0x6c4e('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x203e7c[_0x6c4e('0x70')],'predictiveIntervalHitRate':_0x203e7c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x203e7c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x203e7c[_0x6c4e('0x71')],'predictiveIntervalAvailable':_0x203e7c[_0x6c4e('0x72')],'predictiveIntervalTotalCalls':_0x203e7c['predictiveIntervalTotalCalls'],'message':_0x203e7c[_0x6c4e('0x45')],'originated':_0x203e7c['originated'],'erlangCalls':_0x203e7c[_0x6c4e('0x73')],'erlangCallToSecond':_0x203e7c[_0x6c4e('0x74')],'erlangAbandonmentRate':_0x203e7c[_0x6c4e('0x75')],'erlangBusyFactor':_0x203e7c['erlangBusyFactor'],'startPredictive':_0x203e7c['startPredictive'],'startProgressive':_0x203e7c[_0x6c4e('0x2b')]};if(_0x203e7c[_0x6c4e('0x76')]){_0x10ccd2[_0x6c4e('0x76')]={'id':_0x203e7c[_0x6c4e('0x76')]['id'],'name':_0x203e7c[_0x6c4e('0x76')]['name'],'active':_0x203e7c[_0x6c4e('0x76')][_0x6c4e('0x77')],'callerid':_0x203e7c['Trunk'][_0x6c4e('0x78')]};}if(_0x203e7c[_0x6c4e('0x4a')]){_0x10ccd2[_0x6c4e('0x4a')]={'id':_0x203e7c[_0x6c4e('0x4a')]['id'],'name':_0x203e7c[_0x6c4e('0x4a')][_0x6c4e('0x44')]};}var _0x23136f=md5(JSON[_0x6c4e('0x79')](_0x10ccd2));if(_0x203e7c[_0x6c4e('0x4')]!==_0x23136f){_0x203e7c['md5']=_0x23136f;emit(util['format'](_0x6c4e('0x7a'),_0x10ccd2[_0x6c4e('0x44')]),_0x6c4e('0x7b'),_0x10ccd2);}}}function emitCampaignSummary(_0x456825){if(_0x456825[_0x6c4e('0x4f')]===_0x6c4e('0x7c')){emit(util['format']('campaign:ivr:%s',_0x456825['name']),'campaign:save',_0x456825);}}function checkGetDataPredictive(_0x4045b1){if(isNotNull(_0x4045b1)&&!_[_0x6c4e('0x7d')](_0x4045b1)){loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x7f'));loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x80'),_0x4045b1[_0x6c4e('0x81')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x82'),_0x4045b1[_0x6c4e('0x6a')]);loggerPredictive['info'](_0x6c4e('0x83'),_0x4045b1[_0x6c4e('0x6e')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x84'),_0x4045b1[_0x6c4e('0x6d')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x85'),_0x4045b1[_0x6c4e('0x6b')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x86'),_0x4045b1[_0x6c4e('0x6c')]);loggerPredictive['info']('---------------------------');if(_0x4045b1[_0x6c4e('0x81')]>0x0){if(!_[_0x6c4e('0x42')](_0x4045b1['predictiveIntervalAvgTalktime'])&&_0x4045b1[_0x6c4e('0x6c')]>0x0){return!![];}loggerPredictive[_0x6c4e('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x6c4e('0x42')](_0x4045b1[_0x6c4e('0x6b')])&&_0x4045b1['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x87'));}else{loggerPredictive[_0x6c4e('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x6c4e('0x88'));}return![];}function mergeDataErlangB(_0x26dfa0){return function(_0x4ac82d){loggerPredictive[_0x6c4e('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x6c4e('0x89'),_0x4ac82d['erlangCalls']);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x8a'),_0x4ac82d[_0x6c4e('0x74')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x8b'),_0x4ac82d[_0x6c4e('0x75')]);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x8c'),_0x4ac82d[_0x6c4e('0x8d')]);loggerPredictive['info'](_0x6c4e('0x8b'),_0x4ac82d['erlangAbandonmentRate']);loggerPredictive['info'](_0x6c4e('0x8e'));_[_0x6c4e('0x8f')](_0x26dfa0,_0x4ac82d);};}function getDiff(_0x11b28f){var _0x4593ed=moment()[_0x6c4e('0x90')](0x0);var _0x5c3e4e=moment(_0x11b28f)['milliseconds'](0x0);return _0x4593ed[_0x6c4e('0x4c')](_0x5c3e4e,_0x6c4e('0x4d'));}function ifInterval(_0x4698db,_0x42f3d2){if(_['isUndefined'](_0x42f3d2)){return![];}return getDiff(_0x42f3d2)<_0x4698db*0x3c;}function freeVariablesPredictive(_0x2bac22){if(isNotNull(_0x2bac22)){if(!_[_0x6c4e('0x42')](_0x2bac22['startProgressive'])){_0x2bac22[_0x6c4e('0x2b')]=undefined;loggerPredictive['info'](_0x2bac22[_0x6c4e('0x44')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x6c4e('0x42')](_0x2bac22[_0x6c4e('0x2a')])){_0x2bac22[_0x6c4e('0x2a')]=undefined;loggerPredictive[_0x6c4e('0x7e')](_0x2bac22[_0x6c4e('0x44')],_0x6c4e('0x91'));}if(!_[_0x6c4e('0x42')](_0x2bac22[_0x6c4e('0x92')])){clearInterval(_0x2bac22[_0x6c4e('0x92')]);_0x2bac22[_0x6c4e('0x92')]=undefined;loggerPredictive[_0x6c4e('0x7e')](_0x2bac22[_0x6c4e('0x44')],_0x6c4e('0x93'));}}}function erlangb(_0x2c7bb5,_0x4eb6d2){if(_0x4eb6d2===0x0){return 0x0;}var _0x2ceae9=0x1;for(var _0x1aa55b=0x1;_0x1aa55b<=_0x4eb6d2;_0x1aa55b+=0x1){_0x2ceae9=0x1+_0x2ceae9*_0x1aa55b/_0x2c7bb5;}return 0x1/_0x2ceae9;}function isVoiceQueueOutbound(_0x769f14){return _0x769f14===_0x6c4e('0x50');}function isNotPreview(_0x5e8156){return _0x5e8156!==_0x6c4e('0x94');}function isCampaignIvr(_0x23e559){return _0x23e559===_0x6c4e('0x7c');}function getCallerId(_0x1464cb,_0x5a0ef0,_0x509f6f){if(!_[_0x6c4e('0x42')](_0x509f6f)&&typeof _0x509f6f===_0x6c4e('0x95')&&!_[_0x6c4e('0x7d')](_0x509f6f)){if(!_[_0x6c4e('0x42')](_0x5a0ef0)&&typeof _0x5a0ef0==='string'&&!_[_0x6c4e('0x7d')](_0x5a0ef0)){return util['format'](_0x6c4e('0x96'),_0x5a0ef0,_0x509f6f);}return util[_0x6c4e('0x97')](_0x6c4e('0x96'),_0x509f6f,_0x509f6f);}if(!_[_0x6c4e('0x42')](_0x1464cb)&&typeof _0x1464cb===_0x6c4e('0x95')&&!_['isEmpty'](_0x1464cb)){return _0x1464cb;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x42a74d,_0xa4d262){return function(_0x269751){freeVariablesPredictive(_0xa4d262);emitVoiceQueueSummary(_0xa4d262);emitCampaignSummary(_0xa4d262);loggerSyncQueueSummary['debug'](_0x42a74d,util['inspect'](_0x269751,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x127516,_0x27764e){return function(_0x5d0103){loggerPredictive['error'](_0x27764e[_0x6c4e('0x44')],_0x127516);loggerPredictive[_0x6c4e('0x98')](_0x5d0103['stack']);freeVariablesPredictive(_0x27764e);};}function loggerCatch(_0x112da2){return function(_0x145b27){logger[_0x6c4e('0x98')](_0x112da2,util[_0x6c4e('0x99')](_0x145b27,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x27c111){return _0x27c111&&!_[_0x6c4e('0x42')](_0x27c111)&&_0x27c111[_0x6c4e('0x9a')]>0x0;}function decremetOriginate(_0x3edeef){if(!_[_0x6c4e('0x42')](_0x3edeef)&&_0x3edeef!==null){if(typeof _0x3edeef[_0x6c4e('0x9b')]!==_0x6c4e('0x9c')){if(_0x3edeef[_0x6c4e('0x9b')]>0x0){_0x3edeef['originated']-=0x1;}else{logger['error'](_0x6c4e('0x9d'));}}}else{logger[_0x6c4e('0x98')](_0x6c4e('0x9e'));}}function checkContactLowerLimitOriginate(_0x1a7e32,_0x40b359,_0x4493a3){if(_0x40b359>_0x4493a3){for(var _0x5da568=0x0;_0x5da568<_0x40b359-_0x4493a3;_0x5da568+=0x1){decremetOriginate(_0x1a7e32);}}}function loggerGetContactDialer(_0xaee3c0,_0x7809a4,_0x65f4ac){return function(_0x5c2c17){checkContactLowerLimitOriginate(_0x7809a4,_0x65f4ac,0x0);logger[_0x6c4e('0x98')](_0xaee3c0,util[_0x6c4e('0x99')](_0x5c2c17,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x419a1a){return function(_0x5b998b){if(isNotNull(_0x5b998b)&&isNotNull(_0x5b998b[0x0])){if(_0x5b998b[0x0][_0x6c4e('0x9f')]>0x0){_0x419a1a[_0x6c4e('0x45')]=_0x6c4e('0xa0');logger[_0x6c4e('0x7e')]('[getContactDialer2][ReScheduled]'+_0x419a1a['name'],_0x5b998b[0x0][_0x6c4e('0x9f')],_0x6c4e('0xa1'));}else{_0x419a1a['message']=_0x6c4e('0xa2');logger[_0x6c4e('0x7e')](_0x6c4e('0xa3')+_0x419a1a[_0x6c4e('0x44')]);}}};}function notSendMessagesQueue(_0x1679d3){if(_0x1679d3[_0x6c4e('0xa4')]){freeVariablesPredictive(_0x1679d3);if(_0x1679d3[_0x6c4e('0x9b')]===0x0&&_0x1679d3[_0x6c4e('0x58')]===0x0&&_0x1679d3[_0x6c4e('0x5c')]===0x0&&(_0x1679d3['pTalking']||0x0)===0x0){_0x1679d3[_0x6c4e('0xa4')]=![];_0x1679d3[_0x6c4e('0x53')]=0x0;_0x1679d3['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xa6'),_0x1679d3[_0x6c4e('0x44')],_0x6c4e('0xa7'));}else{_0x1679d3['message']=_0x6c4e('0xa8');loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xa6'),_0x1679d3[_0x6c4e('0x44')],_0x6c4e('0xa9'));}emitVoiceQueueSummary(_0x1679d3);}}function notSendMessagesCampaign(_0x545674){if(_0x545674[_0x6c4e('0xa4')]){if(_0x545674['originated']===0x0){_0x545674[_0x6c4e('0xa4')]=![];_0x545674[_0x6c4e('0x45')]=_0x6c4e('0x46');loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xaa'),_0x545674[_0x6c4e('0x44')],'is\x20not\x20active');}else{_0x545674[_0x6c4e('0x45')]=_0x6c4e('0xa8');loggerSyncQueueSummary[_0x6c4e('0xa5')](_0x6c4e('0xaa'),_0x545674['name'],_0x6c4e('0xa9'));}emitCampaignSummary(_0x545674);}}function createObjHistory(_0x15f070,_0xad50ed,_0x51bdaa,_0x5b8bca,_0x219a57){_0x15f070[_0x6c4e('0x45')]=_0x51bdaa;var _0x27a6b6=new Action(_0x15f070,_0xad50ed);var _0x45e4e7=new History(_0x27a6b6);_0x45e4e7[_0x6c4e('0xab')]=_0x5b8bca;_0x45e4e7['statedesc']=_0x219a57;_0x45e4e7[_0x6c4e('0xac')]=_0x27a6b6[_0x6c4e('0xad')];return _0x45e4e7;}Dialer[_0x6c4e('0x1e')][_0x6c4e('0x40')]=function(){var _0x1527f7=this;setInterval(function(){_0x1527f7[_0x6c4e('0xae')](_0x1527f7['uniqueId'],_0x6c4e('0xaf'));_0x1527f7[_0x6c4e('0xae')](_0x1527f7[_0x6c4e('0x27')],_0x6c4e('0xb0'));},0x32c8);};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xae')]=function(_0x1bc743,_0x5bc584){var _0x49c600=this;for(var _0x395d62 in _0x1bc743){if(typeof _0x1bc743[_0x395d62]!=='undefined'){this[_0x6c4e('0x20')]['enqueue'](function(){if(!_[_0x6c4e('0xb1')](_0x1bc743[_0x395d62])){return ami[_0x6c4e('0xb2')]({'action':_0x6c4e('0xb3'),'channel':_0x1bc743[_0x395d62][_0x6c4e('0xb4')]})[_0x6c4e('0xb5')](function(_0x35c2d6){if(_0x35c2d6[_0x6c4e('0x45')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1bc743[_0x395d62]&&_0x1bc743[_0x395d62]['type']!==_0x6c4e('0x7c')){_0x49c600[_0x6c4e('0xb6')](_0x49c600[_0x6c4e('0x21')][_0x1bc743[_0x395d62]['queue']]);logger[_0x6c4e('0x98')](_0x6c4e('0xb7'),_0x5bc584,_0x395d62,_0x1bc743[_0x395d62][_0x6c4e('0xb8')]);delete _0x1bc743[_0x395d62];}if(_0x1bc743[_0x395d62]&&_0x1bc743[_0x395d62]['type']===_0x6c4e('0x7c')){_0x49c600[_0x6c4e('0xb6')](_0x49c600['campaigns'][_0x1bc743[_0x395d62][_0x6c4e('0xb8')]]);logger['error'](_0x6c4e('0xb9'),_0x5bc584,_0x395d62,_0x1bc743[_0x395d62][_0x6c4e('0xb8')]);delete _0x1bc743[_0x395d62];}},0x2328);}});}});}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xba')]=function(_0x72a70){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0xba')](_0x72a70))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xbc')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xbd')]=function(_0x5f37c5){return BPromise['resolve']()['then'](cmHopperBlack[_0x6c4e('0xbd')](_0x5f37c5))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xbe')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xbf')]=function(_0x348fda,_0x50737b,_0x51f224){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x348fda,_0x50737b,_0x51f224))[_0x6c4e('0xb5')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc1')]=function(_0x32f0c1,_0x293f10,_0x34ca63){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperAdditionalPhone[_0x6c4e('0xc1')](_0x32f0c1,_0x293f10,_0x34ca63))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xc2')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc3')]=function(_0x4c2be3){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperBlack[_0x6c4e('0xc3')](_0x4c2be3))[_0x6c4e('0xb5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc4')]=function(_0xd1b6bb){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperHistory[_0x6c4e('0xc5')](_0xd1b6bb))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xc6')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc7')]=function(_0x4f7f7c){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopper['rescheduleContact'](_0x4f7f7c))['catch'](loggerCatch(_0x6c4e('0xc8')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xc9')]=function(_0x4dc9b9,_0x13963b,_0x1282c9){return BPromise['resolve']()[_0x6c4e('0xc0')](cmHopper[_0x6c4e('0xc9')](_0x4dc9b9,_0x13963b,_0x1282c9))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xca')));};Dialer['prototype']['getContactDialer']=function(_0x54e379,_0x3c20fe,_0x471fc3,_0x2e06cf,_0x4a1b53){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0xcb')](_0x54e379,_0x3c20fe,_0x471fc3,_0x2e06cf))[_0x6c4e('0xb5')](function(_0x131ffb){_0x4a1b53[_0x6c4e('0xcc')]-=_0x471fc3;_0x4a1b53[_0x6c4e('0xcc')]=_0x4a1b53[_0x6c4e('0xcc')]>0x0?_0x4a1b53[_0x6c4e('0xcc')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x131ffb);});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xcd')]=function(_0x1f6d24,_0x2a6922,_0x44bffb,_0x35ae02){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0xcd')](_0x1f6d24,_0x2a6922,_0x44bffb))['catch'](function(_0x22ab9a){_0x35ae02[_0x6c4e('0xcc')]-=_0x2a6922;_0x35ae02[_0x6c4e('0xcc')]=_0x35ae02[_0x6c4e('0xcc')]>0x0?_0x35ae02[_0x6c4e('0xcc')]:0x0;loggerCatch(_0x6c4e('0xce'))(_0x22ab9a);});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xcf')]=function(_0x626748){return BPromise['resolve']()['then'](voiceQueueRt[_0x6c4e('0xcf')](_0x626748))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xd0')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd1')]=function(_0x151532){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopper[_0x6c4e('0xd1')](_0x151532))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xd2')));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd3')]=function(_0x251030){return BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](cmHopperHistory[_0x6c4e('0xd3')](_0x251030))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xd4')));};Dialer[_0x6c4e('0x1e')]['updateOriginated']=function(_0x3f448b){if(!_[_0x6c4e('0x42')](_0x3f448b)&&_0x3f448b!==null){if(typeof _0x3f448b[_0x6c4e('0x9b')]!=='undefined'){if(_0x3f448b['originated']>0x0){_0x3f448b['originated']-=0x1;}else{logger[_0x6c4e('0x98')](_0x6c4e('0xd5'));}}}else{logger[_0x6c4e('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x6c4e('0x1e')]['loggerHandler']=function(_0x5d5019,_0x1f4729){var _0x4eb3b6=this;return function(_0x2ec4c3){_0x4eb3b6['updateOriginated'](_0x1f4729);logger['error'](_0x5d5019,util[_0x6c4e('0x99')](_0x2ec4c3,{'showHidden':![],'depth':null}));};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd6')]=function(_0x1d7876,_0x175652,_0x40469a){var _0x5bb70b={'state':0x19,'statedesc':'notFound'};this[_0x6c4e('0xb6')](_0x175652);this[_0x6c4e('0xd7')](_[_0x6c4e('0x8f')](_0x5bb70b,_[_0x6c4e('0xd8')](_0x40469a,['ContactId','ListId','UserId',_0x6c4e('0xd9'),_0x6c4e('0xda')])),_0x6c4e('0xdb'),_0x6c4e('0xdc'));logger[_0x6c4e('0x98')](_0x1d7876);};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xdd')]=function(_0x115e75){return _0x115e75===_0x6c4e('0xde');};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xdf')]=function(_0x2dcbad){return!_['isUndefined'](_0x2dcbad)&&_0x2dcbad&&!_[_0x6c4e('0x42')](_0x2dcbad[_0x6c4e('0x44')])&&!_[_0x6c4e('0x42')](_0x2dcbad[_0x6c4e('0x77')])&&_0x2dcbad[_0x6c4e('0x77')]&&(this[_0x6c4e('0x24')][util['format']('SIP/%s',_0x2dcbad[_0x6c4e('0x44')])][_0x6c4e('0xb3')]===_0x6c4e('0xe0')||this['trunks'][util['format'](_0x6c4e('0xe1'),_0x2dcbad['name'])][_0x6c4e('0xb3')]===_0x6c4e('0xe2'));};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xd7')]=function(_0x525445,_0x482235,_0xa02fd5){this[_0x6c4e('0xd3')](_0x525445)[_0x6c4e('0xb5')](loggerCatch(_0x482235));this[_0x6c4e('0xd1')](_0x525445)[_0x6c4e('0xb5')](loggerCatch(_0xa02fd5));};Dialer[_0x6c4e('0x1e')]['syncVarSet']=function(_0x26d585){var _0x47650a=this[_0x6c4e('0x28')][_0x26d585[_0x6c4e('0xe3')]];var _0x17736e;if(!_[_0x6c4e('0xb1')](_0x26d585)&&!_['isNil'](_0x26d585[_0x6c4e('0xe4')])&&!_[_0x6c4e('0xb1')](_0x26d585[_0x6c4e('0xe4')][_0x6c4e('0xe5')])&&_0x26d585[_0x6c4e('0xe6')]==='xcally-motion-dialer'&&_0x47650a){if(_0x47650a[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')&&this[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe7')]&&_0x26d585[_0x6c4e('0xe8')]==='HANGUP'){delete this['uniqueId'][_0x26d585['uniqueid']];this[_0x6c4e('0xb6')](this['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]]);this['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;this[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0x62')]+=0x1;_0x17736e=new Hangup(_0x47650a,_0x26d585);_0x17736e['state']=0x12;_0x17736e[_0x6c4e('0xea')]=_0x6c4e('0xeb');_0x17736e['membername']=_0x6c4e('0xec');ami[_0x6c4e('0x4e')](_0x6c4e('0xed'),ut[_0x6c4e('0xee')](_0x17736e,'amd'));this[_0x6c4e('0xd7')](_0x17736e,_0x6c4e('0xef'),'[syncHangupInAMD]');}if(_0x47650a[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')&&this[_0x6c4e('0x21')][_0x47650a['queue']]['dialAMDActive']&&_0x26d585[_0x6c4e('0xe8')]==='MACHINE'){var _0x110fe4=this;return new BPromise(function(_0x4049c4,_0x477aaa){delete _0x110fe4['uniqueId'][_0x26d585[_0x6c4e('0xe3')]];_0x110fe4['updateOriginated'](_0x110fe4['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]]);_0x110fe4[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;_0x110fe4['voiceQueues'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0x62')]+=0x1;var _0x521939=_0x110fe4[_0x6c4e('0x21')][_0x47650a[_0x6c4e('0xb8')]];var _0x52c7e8=new Hangup(_0x47650a,_0x26d585);_0x52c7e8[_0x6c4e('0xab')]=0x13;_0x52c7e8[_0x6c4e('0xea')]=_0x6c4e('0xf0');_0x52c7e8[_0x6c4e('0xf1')]=_0x6c4e('0xec');_0x52c7e8[_0x6c4e('0xf2')]+=0x1;_0x52c7e8[_0x6c4e('0xf3')]+=0x1;_0x52c7e8[_0x6c4e('0xf4')]=!![];ami[_0x6c4e('0x4e')](_0x6c4e('0xed'),ut[_0x6c4e('0xee')](_0x52c7e8,_0x6c4e('0xf4')));_0x110fe4[_0x6c4e('0xd3')](_0x52c7e8)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xf5')));if(_0x52c7e8[_0x6c4e('0xf6')]+_0x52c7e8[_0x6c4e('0xf7')]+_0x52c7e8[_0x6c4e('0xf8')]+_0x52c7e8[_0x6c4e('0xf9')]+_0x52c7e8[_0x6c4e('0xfa')]+_0x52c7e8[_0x6c4e('0xfb')]+_0x52c7e8[_0x6c4e('0xf2')]+_0x52c7e8[_0x6c4e('0xfc')]>=_0x521939['dialGlobalMaxRetry']){_0x110fe4[_0x6c4e('0xfd')](_0x52c7e8,_0x4049c4,_0x477aaa,'reason19\x20machine....');}else{if(_0x52c7e8[_0x6c4e('0xf2')]>=_0x521939[_0x6c4e('0xfe')]){_0x110fe4[_0x6c4e('0xff')](_0x52c7e8,_0x4049c4,_0x477aaa,'reason\x2019\x20machine....');}else{_0x110fe4[_0x6c4e('0xc7')]({'active':![],'countmachineretry':_0x52c7e8['countmachineretry'],'scheduledat':moment()[_0x6c4e('0x100')](_0x521939['dialMachineRetryFrequency'],_0x6c4e('0x101'))[_0x6c4e('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x52c7e8[_0x6c4e('0x102')],'ListId':_0x52c7e8[_0x6c4e('0x103')],'VoiceQueueId':_0x52c7e8[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x52c7e8['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x4049c4({'reschedule':0x1});}}});}if(_0x47650a[_0x6c4e('0x4f')]==='ivr'&&this['campaigns'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe7')]&&_0x26d585[_0x6c4e('0xe8')]===_0x6c4e('0x104')){delete this[_0x6c4e('0x28')][_0x26d585[_0x6c4e('0xe3')]];this[_0x6c4e('0xb6')](this[_0x6c4e('0x22')][_0x47650a[_0x6c4e('0xb8')]]);_0x17736e=new Hangup(_0x47650a,_0x26d585);_0x17736e[_0x6c4e('0xab')]=0x12;_0x17736e[_0x6c4e('0xea')]=_0x6c4e('0xeb');_0x17736e[_0x6c4e('0xf1')]=_0x6c4e('0xec');ami[_0x6c4e('0x4e')]('custom:amd',ut[_0x6c4e('0xee')](_0x17736e,_0x6c4e('0xf4')));this[_0x6c4e('0xd7')](_0x17736e,_0x6c4e('0x105'),_0x6c4e('0x106'));}if(_0x47650a[_0x6c4e('0x4f')]===_0x6c4e('0x7c')&&this[_0x6c4e('0x22')][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe7')]&&_0x26d585['value']===_0x6c4e('0x107')){var _0x110fe4=this;return new BPromise(function(_0x31458b,_0x229eb2){delete _0x110fe4[_0x6c4e('0x28')][_0x26d585[_0x6c4e('0xe3')]];_0x110fe4[_0x6c4e('0xb6')](_0x110fe4[_0x6c4e('0x22')][_0x47650a[_0x6c4e('0xb8')]]);_0x110fe4['campaigns'][_0x47650a[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;_0x110fe4['campaigns'][_0x47650a[_0x6c4e('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4fae22=_0x110fe4['campaigns'][_0x47650a['queue']];var _0x39b8a3=new Hangup(_0x47650a,_0x26d585);_0x39b8a3[_0x6c4e('0xab')]=0x13;_0x39b8a3[_0x6c4e('0xea')]=_0x6c4e('0xf0');_0x39b8a3['membername']=_0x6c4e('0xec');_0x39b8a3[_0x6c4e('0xf2')]+=0x1;_0x39b8a3[_0x6c4e('0xf3')]+=0x1;_0x39b8a3[_0x6c4e('0xf4')]=!![];ami['emit']('custom:amd',ut[_0x6c4e('0xee')](_0x39b8a3,_0x6c4e('0xf4')));_0x110fe4[_0x6c4e('0xd3')](_0x39b8a3)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xf5')));if(_0x39b8a3[_0x6c4e('0xf6')]+_0x39b8a3[_0x6c4e('0xf7')]+_0x39b8a3[_0x6c4e('0xf8')]+_0x39b8a3['countnosuchnumberretry']+_0x39b8a3[_0x6c4e('0xfa')]+_0x39b8a3[_0x6c4e('0xfb')]+_0x39b8a3[_0x6c4e('0xf2')]+_0x39b8a3[_0x6c4e('0xfc')]>=_0x4fae22[_0x6c4e('0x108')]){_0x110fe4[_0x6c4e('0xfd')](_0x39b8a3,_0x31458b,_0x229eb2,_0x6c4e('0x109'));}else{if(_0x39b8a3['countmachineretry']>=_0x4fae22[_0x6c4e('0xfe')]){_0x110fe4['createStateFinal'](_0x39b8a3,_0x31458b,_0x229eb2,_0x6c4e('0x10a'));}else{_0x110fe4[_0x6c4e('0xc7')]({'active':![],'countmachineretry':_0x39b8a3[_0x6c4e('0xf2')],'scheduledat':moment()[_0x6c4e('0x100')](_0x4fae22[_0x6c4e('0x10b')],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x39b8a3[_0x6c4e('0x102')],'ListId':_0x39b8a3[_0x6c4e('0x103')],'VoiceQueueId':_0x39b8a3[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x39b8a3['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10d')));_0x31458b({'reschedule':0x1});}}});}}};Dialer[_0x6c4e('0x1e')]['syncHangup']=function(_0x5a0fbd){var _0xe22ca9=this[_0x6c4e('0x28')][_0x5a0fbd['uniqueid']];var _0x512775=this;var _0x447f33;if(_0xe22ca9&&_0xe22ca9[_0x6c4e('0x4f')]===_0x6c4e('0x7c')){delete this[_0x6c4e('0x28')][_0x5a0fbd[_0x6c4e('0xe3')]];this[_0x6c4e('0xb6')](this[_0x6c4e('0x22')][_0xe22ca9[_0x6c4e('0xb8')]]);this[_0x6c4e('0x22')][_0xe22ca9['queue']][_0x6c4e('0x10e')]+=0x1;_0x447f33=new Hangup(_0xe22ca9,_0x5a0fbd);this[_0x6c4e('0xd3')](_0x447f33)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10f')));this[_0x6c4e('0xd1')](_0x447f33)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xe22ca9&&_0xe22ca9[_0x6c4e('0x4f')]!=='ivr'&&isNotNull(this[_0x6c4e('0x21')][_0xe22ca9[_0x6c4e('0xb8')]]['dialQueueProject'])){delete this[_0x6c4e('0x28')][_0x5a0fbd['uniqueid']];this[_0x6c4e('0xb6')](this['voiceQueues'][_0xe22ca9[_0x6c4e('0xb8')]]);this[_0x6c4e('0x21')][_0xe22ca9[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;this[_0x6c4e('0x21')][_0xe22ca9['queue']][_0x6c4e('0x62')]+=0x1;_0x447f33=new Hangup(_0xe22ca9,_0x5a0fbd);_0x447f33[_0x6c4e('0xab')]=0x10;_0x447f33[_0x6c4e('0xea')]=_0x6c4e('0x110');_0x447f33[_0x6c4e('0xf1')]=_0x6c4e('0x111');this['createHistory'](_0x447f33)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6c4e('0xd1')](_0x447f33)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xe22ca9&&_0xe22ca9[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')&&!isNotNull(this['voiceQueues'][_0xe22ca9['queue']][_0x6c4e('0x112')])){delete this[_0x6c4e('0x28')][_0x5a0fbd[_0x6c4e('0xe3')]];this['updateOriginated'](this[_0x6c4e('0x21')][_0xe22ca9[_0x6c4e('0xb8')]]);this[_0x6c4e('0x21')][_0xe22ca9['queue']]['outboundUnknownCallsDay']+=0x1;_0x447f33=new Hangup(_0xe22ca9,_0x5a0fbd);_0x447f33[_0x6c4e('0xab')]=0xc;_0x447f33[_0x6c4e('0xea')]=_0x5a0fbd['cause-txt'];_0x447f33['membername']=_0x6c4e('0x113');this[_0x6c4e('0xd3')](_0x447f33)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10f')));this[_0x6c4e('0xd1')](_0x447f33)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x114')));}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x115')]=function(_0x5030da){var _0x9d1638=this['uniqueId'][_0x5030da[_0x6c4e('0xe3')]];var _0x3f797f=this;if(this[_0x6c4e('0x21')][_0x5030da[_0x6c4e('0xb8')]]){if(_0x9d1638&&_0x9d1638[_0x6c4e('0x4f')]!=='ivr'){delete this['uniqueId'][_0x5030da[_0x6c4e('0xe3')]];this[_0x6c4e('0x21')][_0x5030da[_0x6c4e('0xb8')]][_0x6c4e('0xe9')]+=0x1;var _0x5cc71d=new AgentComplete(_0x9d1638,_0x5030da);if(_0x5030da[_0x6c4e('0x116')]==='agent'){_0x5cc71d[_0x6c4e('0x117')]=this[_0x6c4e('0x21')][_0x5030da[_0x6c4e('0xb8')]][_0x6c4e('0x118')]&&this['voiceQueues'][_0x5030da[_0x6c4e('0xb8')]]['dialAgiAfterHangupAgent']?moment()[_0x6c4e('0x97')](_0x6c4e('0x10c')):undefined;}this['createHistory'](_0x5cc71d)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x119')));this[_0x6c4e('0xd1')](_0x5cc71d)['catch'](loggerCatch(_0x6c4e('0x11a')));}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x11b')]=function(_0x25a715){if(this['voiceQueues'][_0x25a715[_0x6c4e('0xb8')]]){if(this[_0x6c4e('0x28')][_0x25a715[_0x6c4e('0xe3')]]&&this[_0x6c4e('0x28')][_0x25a715[_0x6c4e('0xe3')]][_0x6c4e('0x4f')]!==_0x6c4e('0x7c')){this[_0x6c4e('0xb6')](this[_0x6c4e('0x21')][_0x25a715[_0x6c4e('0xb8')]]);this[_0x6c4e('0x28')][_0x25a715[_0x6c4e('0xe3')]][_0x6c4e('0x11c')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x11d')]=function(_0x12c4c8,_0x217119){this[_0x6c4e('0xd3')](_0x12c4c8)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x119')));if(_0x217119==0x0){this[_0x6c4e('0xd1')](_0x12c4c8)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x11e')));}};Dialer['prototype'][_0x6c4e('0x30')]=function(_0x40e785){var _0x214d3f=this['uniqueId'][_0x40e785['uniqueid']];var _0x1f8356=this;var _0xcfe998=![];var _0x39a279;var _0x4d9032;if(this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]]){if(_0x214d3f&&_0x214d3f[_0x6c4e('0x4f')]!==_0x6c4e('0x7c')){delete this[_0x6c4e('0x28')][_0x40e785[_0x6c4e('0xe3')]];this[_0x6c4e('0xb6')](this[_0x6c4e('0x21')][_0x40e785['queue']]);_0x214d3f[_0x6c4e('0x11f')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));var _0x368b61=new QueueCallerAbandon(_0x214d3f,_0x40e785);if(getSeconds(_0x214d3f[_0x6c4e('0x11f')],_0x214d3f[_0x6c4e('0x120')])>=_0x214d3f[_0x6c4e('0x121')]){this[_0x6c4e('0x21')][_0x40e785['queue']][_0x6c4e('0x6e')]+=0x1;this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x122')]+=0x1;this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x70')]+=0x1;_0x368b61[_0x6c4e('0xab')]=0xa;_0x368b61[_0x6c4e('0xea')]=_0x6c4e('0x123');_0x368b61[_0x6c4e('0x124')]=_0x6c4e('0x125');_0x368b61['agiafterat']=this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x118')]?moment()[_0x6c4e('0x97')](_0x6c4e('0x10c')):undefined;_0x368b61[_0x6c4e('0xfa')]+=0x1;_0x368b61[_0x6c4e('0xf3')]+=0x1;_0x39a279=this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x126')];_0x4d9032=this[_0x6c4e('0x21')][_0x40e785['queue']][_0x6c4e('0x127')];_0x1f8356[_0x6c4e('0xbf')](_0x368b61,_0x368b61[_0x6c4e('0xab')],_0x214d3f[_0x6c4e('0x128')])[_0x6c4e('0xc0')](function(_0x9c3689){_0xcfe998=_0x9c3689[_0x6c4e('0x129')]==0x1;if(_0x368b61[_0x6c4e('0xfa')]>=_0x1f8356[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x12a')]){_0x1f8356[_0x6c4e('0x11d')](_0x368b61,_0x9c3689[_0x6c4e('0x129')]);}else{_0x1f8356[_0x6c4e('0xc7')]({'active':![],'countdropretry':_0x368b61[_0x6c4e('0xfa')],'scheduledat':moment()['add'](_0x1f8356[_0x6c4e('0x21')][_0x40e785['queue']][_0x6c4e('0x126')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x214d3f['ContactId'],'ListId':_0x214d3f[_0x6c4e('0x103')],'VoiceQueueId':_0x214d3f[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x214d3f[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x12b')));var _0x533be9=new History(_0x368b61);_0x533be9['state']=0xa;_0x533be9[_0x6c4e('0xea')]=_0x6c4e('0x123');_0x533be9[_0x6c4e('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x533be9['endtime']=_0x533be9['starttime'];_0x533be9[_0x6c4e('0x12c')]=_0x368b61['calleridname'];_0x533be9['calleridnum']=_0x368b61[_0x6c4e('0x12d')];_0x1f8356[_0x6c4e('0xd3')](_0x533be9)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x6c4e('0xc0')](function(_0x1fc138){if(_0xcfe998)_0x1f8356[_0x6c4e('0xc1')](_0x368b61,_0x39a279,_0x4d9032)[_0x6c4e('0xc0')](function(_0x7f20ab){return 0x1;});});}else{this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x6d')]+=0x1;this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]][_0x6c4e('0x65')]+=0x1;_0x368b61[_0x6c4e('0xab')]=0xb;_0x368b61[_0x6c4e('0xea')]=_0x6c4e('0x12e');_0x368b61['dropreason']=_0x6c4e('0x12f');_0x368b61['countabandonedretry']+=0x1;_0x368b61[_0x6c4e('0xf3')]+=0x1;_0x39a279=this[_0x6c4e('0x21')][_0x40e785[_0x6c4e('0xb8')]]['dialAbandonedRetryFrequency'];_0x4d9032=this['voiceQueues'][_0x40e785['queue']][_0x6c4e('0x127')];_0x1f8356[_0x6c4e('0xbf')](_0x368b61,_0x368b61[_0x6c4e('0xab')],_0x214d3f[_0x6c4e('0x128')])[_0x6c4e('0xc0')](function(_0x1da368){if(_0x368b61[_0x6c4e('0xfb')]>=_0x1f8356['voiceQueues'][_0x40e785[_0x6c4e('0xb8')]]['dialAbandonedMaxRetry']){_0x1f8356[_0x6c4e('0x11d')](_0x368b61,_0x1da368[_0x6c4e('0x129')]);}else{_0x1f8356[_0x6c4e('0xc7')]({'active':![],'countabandonedretry':_0x368b61[_0x6c4e('0xfb')],'scheduledat':moment()['add'](_0x1f8356['voiceQueues'][_0x40e785['queue']][_0x6c4e('0x130')],_0x6c4e('0x101'))[_0x6c4e('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x214d3f[_0x6c4e('0x102')],'ListId':_0x214d3f[_0x6c4e('0x103')],'VoiceQueueId':_0x214d3f[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x214d3f['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x11b50d=new History(_0x368b61);_0x11b50d[_0x6c4e('0xab')]=0xb;_0x11b50d[_0x6c4e('0xea')]='Abandoned';_0x11b50d['starttime']=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));_0x11b50d[_0x6c4e('0xac')]=_0x11b50d[_0x6c4e('0xad')];_0x11b50d[_0x6c4e('0x12c')]=_0x368b61['calleridname'];_0x11b50d[_0x6c4e('0x12d')]=_0x368b61[_0x6c4e('0x12d')];_0x1f8356[_0x6c4e('0xd3')](_0x11b50d)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x131')));}})['then'](function(_0x88cb13){if(_0xcfe998)_0x1f8356[_0x6c4e('0xc1')](_0x368b61,_0x39a279,_0x4d9032)[_0x6c4e('0xc0')](function(_0x5b30c1){return 0x1;});});}}}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x3a')]=function(_0x1aa1cf){if(this[_0x6c4e('0x27')][_0x1aa1cf[_0x6c4e('0xe3')]]){this['actions'][_0x1aa1cf[_0x6c4e('0xe3')]][_0x6c4e('0xb4')]=_0x1aa1cf[_0x6c4e('0xb4')];}if(this[_0x6c4e('0x28')][_0x1aa1cf[_0x6c4e('0xe3')]]){this[_0x6c4e('0x28')][_0x1aa1cf[_0x6c4e('0xe3')]]['channel']=_0x1aa1cf['channel'];}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x3e')]=function(_0x31a798){if(strategy[this['voiceQueues'][this['actions'][_0x31a798[_0x6c4e('0x132')]]['queue']][_0x6c4e('0x51')]]===_0x6c4e('0x133')){if(this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]]&&_[_0x6c4e('0xb1')](this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0x134')])&&_0x31a798[_0x6c4e('0xb3')]==='1'&&_0x31a798[_0x6c4e('0x135')]==='0'){if(this[_0x6c4e('0x23')][_0x31a798[_0x6c4e('0x136')]]){if(!this['agents'][_0x31a798[_0x6c4e('0x136')]][_0x6c4e('0x134')]){this[_0x6c4e('0x23')][_0x31a798[_0x6c4e('0x136')]][_0x6c4e('0x134')]=!![];this[_0x6c4e('0x27')][_0x31a798['actionid']][_0x6c4e('0x134')]=!![];this[_0x6c4e('0x27')][_0x31a798['actionid']][_0x6c4e('0x136')]=_0x31a798[_0x6c4e('0x136')];}}}}else if((strategy[this[_0x6c4e('0x21')][this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]]['queue']][_0x6c4e('0x51')]]||'rrmemory')===_0x6c4e('0x1d')){if(this['actions'][_0x31a798[_0x6c4e('0x132')]]){if(this['agents'][_0x31a798[_0x6c4e('0x136')]]){this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0x136')]=_0x31a798[_0x6c4e('0x136')];if(_[_0x6c4e('0xb1')](this[_0x6c4e('0x137')][this[_0x6c4e('0x27')][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0xb8')]])){this['queueBooked'][this['actions'][_0x31a798[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]=[];}this['queueBooked'][this[_0x6c4e('0x27')][_0x31a798['actionid']][_0x6c4e('0xb8')]][_0x6c4e('0x138')](_[_0x6c4e('0x8f')](_['pick'](this[_0x6c4e('0x27')][_0x31a798['actionid']],[_0x6c4e('0x139'),_0x6c4e('0x136')]),{'status':_0x31a798[_0x6c4e('0xb3')],'paused':_0x31a798[_0x6c4e('0x135')]}));}}}};function unlockQueueStatus(_0x13943c,_0x1bd1fd){setTimeout(function(){if(_[_0x6c4e('0x42')](_0x13943c[_0x6c4e('0x13a')])){loggerBooked[_0x6c4e('0x98')](_0x6c4e('0x13b'),_0x1bd1fd);}_0x13943c['queueStatusComplete']=!![];loggerBooked[_0x6c4e('0x7e')](_0x6c4e('0x13c'),_0x1bd1fd,JSON[_0x6c4e('0x79')](_['pick'](_0x13943c,[_0x6c4e('0x44'),_0x6c4e('0x13a')])));},0x1f3);}Dialer[_0x6c4e('0x1e')][_0x6c4e('0x3f')]=function(_0x292ec8){var _0x30b46a=this;var _0x78d330=_0x30b46a[_0x6c4e('0x21')][_0x30b46a[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0xb8')]];if(strategy[this[_0x6c4e('0x21')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]][_0x6c4e('0x51')]]===_0x6c4e('0x133')){if(this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]&&this[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0x136')]){this[_0x6c4e('0x94')][_0x6c4e('0x13d')](this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0x139')],this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0x136')])[_0x6c4e('0xb5')](function(_0x37aa87){logger[_0x6c4e('0x98')](_0x6c4e('0x13e'),util['inspect'](_0x37aa87,{'showHidden':![],'depth':null}));})[_0x6c4e('0x13f')](function(){_0x30b46a[_0x6c4e('0xb6')](_0x30b46a[_0x6c4e('0x21')][_0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]);_0x30b46a['agents'][_0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0x136')]]['locked']=![];delete _0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]];unlockQueueStatus(_0x78d330);});}else{this[_0x6c4e('0xb6')](this[_0x6c4e('0x21')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]['queue']]);this[_0x6c4e('0xc7')]({'active':![],'ContactId':this[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0x102')],'ListId':this['actions'][_0x292ec8[_0x6c4e('0x132')]]['ListId'],'VoiceQueueId':this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x140')));delete this['actions'][_0x292ec8['actionid']];unlockQueueStatus(_0x78d330);}}else if((strategy[this['voiceQueues'][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]][_0x6c4e('0x51')]]||_0x6c4e('0x1d'))===_0x6c4e('0x1d')){var _0x4832f4;if(this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]&&!_[_0x6c4e('0x7d')](this['queueBooked'][this['actions'][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]])){if(this[_0x6c4e('0x2d')][_0x30b46a[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]){this[_0x6c4e('0x2d')][_0x30b46a['actions'][_0x292ec8[_0x6c4e('0x132')]]['queue']]=this[_0x6c4e('0x2d')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]]['queue']]?this[_0x6c4e('0x2d')][this['actions'][_0x292ec8['actionid']]['queue']]:this[_0x6c4e('0x137')][this[_0x6c4e('0x27')][_0x292ec8[_0x6c4e('0x132')]][_0x6c4e('0xb8')]]?this['queueBooked'][this['actions'][_0x292ec8['actionid']][_0x6c4e('0xb8')]][_0x6c4e('0x141')]||0x0:0x0;}this[_0x6c4e('0x137')][this[_0x6c4e('0x27')][_0x292ec8['actionid']][_0x6c4e('0xb8')]][_0x6c4e('0x141')]=this['queueBookedRR'][this['actions'][_0x292ec8[_0x6c4e('0x132')]]['queue']];for(var _0x2a89a8=0x0;_0x2a89a8=0x0;})['catch'](myreject(_0x8c9e32)));}}else{_0x33f275['push'](ami[_0x6c4e('0xb2')]({'action':_0x6c4e('0x15a'),'command':util[_0x6c4e('0x97')](_0x6c4e('0x15b'),_0xe7ff5a,!_[_0x6c4e('0x42')](config[_0x6c4e('0x156')][_0x27c4f0])?_0x27c4f0:'')})[_0x6c4e('0xc0')](function(_0xf5a578){return _0xf5a578['content'][_0x6c4e('0x159')](_0x6c4e('0x15c'))>=0x0;})['catch'](myreject(_0x8c9e32)));}BPromise[_0x6c4e('0x15d')](_0x33f275)[_0x6c4e('0xc0')](function(_0x196606){var _0x23fe1e=_['some'](_0x196606);if(_0x23fe1e){return _0x367503(_0x23fe1e);}else{_0x3d320f[_0x6c4e('0x45')]=_0x321a91?_0x6c4e('0x15e'):_0x6c4e('0x15f');return _0x8c9e32(msgResponse(_0x6c4e('0x160'),_0x6c4e('0x153'),_0x6c4e('0x161')+_0x321a91+'\x20'+_0x233cb6+_0x6c4e('0x162')+util[_0x6c4e('0x99')](_0xe7ff5a,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x27c4f0));}})[_0x6c4e('0xb5')](function(_0x5ed61b){return _0x8c9e32(msgResponse(_0x6c4e('0x151'),'Failure',JSON[_0x6c4e('0x79')](_0x5ed61b)));});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x163')]=function(_0x3bc765){var _0x170706=this;return function(){switch(_0x3bc765['dialMethod']){case _0x6c4e('0x164'):freeVariablesPredictive(_0x3bc765);_0x170706[_0x6c4e('0x165')](_0x3bc765,0x1);break;case _0x6c4e('0x166'):freeVariablesPredictive(_0x3bc765);_0x170706['handlePower'](_0x3bc765,_0x3bc765['dialPowerLevel']);break;case _0x6c4e('0x167'):_0x170706[_0x6c4e('0x167')](_0x3bc765);break;case _0x6c4e('0x9'):freeVariablesPredictive(_0x3bc765);_0x170706['handlePower'](_0x3bc765,0x1);break;default:freeVariablesPredictive(_0x3bc765);logger[_0x6c4e('0x98')]('Queue',_0x3bc765[_0x6c4e('0x44')],_0x6c4e('0x168'));}};};Dialer[_0x6c4e('0x1e')]['launchHandleIvr']=function(_0x24ced0){var _0x30fd02=this;return function(){_0x30fd02[_0x6c4e('0x169')](_0x24ced0);};};Dialer[_0x6c4e('0x1e')]['syncQueueSummary']=function(_0x49423a){var _0x204035=this;if(isNotPreview(_0x49423a[_0x6c4e('0x5e')])){if(isVoiceQueueOutbound(_0x49423a[_0x6c4e('0x4f')])&&isActive(_0x49423a[_0x6c4e('0x16a')])){_0x49423a[_0x6c4e('0xa4')]=!![];BPromise['resolve']()[_0x6c4e('0xc0')](checkIsLoggedIn(_0x49423a,_0x49423a['loggedIn']))[_0x6c4e('0xc0')](checkIsActive(_0x49423a,_0x49423a[_0x6c4e('0x16a')]))['then'](checkInterval(_0x49423a))[_0x6c4e('0xc0')](_0x204035[_0x6c4e('0x16b')](_0x49423a))[_0x6c4e('0xc0')](_0x204035['checkIfTime'](_0x49423a[_0x6c4e('0x16c')],_0x49423a[_0x6c4e('0x16d')],_0x49423a[_0x6c4e('0x44')],_0x49423a))[_0x6c4e('0xc0')](_0x204035['checkIfTimeIntervals'](_0x49423a['Interval'],_0x49423a[_0x6c4e('0x16d')],_0x49423a[_0x6c4e('0x44')],_0x49423a))[_0x6c4e('0xc0')](_0x204035[_0x6c4e('0x163')](_0x49423a))['catch'](loggerCatchQueueSummary(_0x6c4e('0x16e'),_0x49423a));}else{notSendMessagesQueue(_0x49423a);}}else{freeVariablesPredictive(_0x49423a);}};Dialer[_0x6c4e('0x1e')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x496f22=_['filter'](this[_0x6c4e('0x21')],function(_0x586cdd){return _0x586cdd[_0x6c4e('0x16f')];});var _0x373b8a=_[_0x6c4e('0x170')](this[_0x6c4e('0x23')],function(_0x3ca1d9){return _0x3ca1d9['online']&&_0x3ca1d9['status']===_0x6c4e('0xe0');});if(_0x496f22['length']>0x0&&_0x373b8a[_0x6c4e('0x9a')]>0x0){return BPromise[_0x6c4e('0xbb')]()['then'](cmHopper[_0x6c4e('0x171')](_['map'](_0x496f22,'id'),previewRecallmeReminderInterval,_['map'](_0x373b8a,'id')))[_0x6c4e('0xc0')](function(_0x57ae7e){for(var _0x31216b=0x0;_0x31216b<_0x57ae7e['length'];_0x31216b++){var _0x32c180=_0x57ae7e[_0x31216b][_0x6c4e('0x172')][_0x6c4e('0x44')];if(_0x32c180)io['to'](util[_0x6c4e('0x97')](_0x6c4e('0x173'),_0x32c180))[_0x6c4e('0x4e')](_0x6c4e('0x174'),{'hopper':_0x57ae7e[_0x31216b]});}})['catch'](function(_0x2dc974){logger[_0x6c4e('0x98')](_0x6c4e('0x175'),_0x2dc974);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x6c4e('0x1e')][_0x6c4e('0x176')]=function(){var _0x630fab=this;var _0xd61917;for(var _0x295e7b in this[_0x6c4e('0x22')]){if(typeof this[_0x6c4e('0x22')][_0x295e7b]!==_0x6c4e('0x9c')){_0xd61917=this['campaigns'][_0x295e7b];if(isCampaignIvr(_0xd61917[_0x6c4e('0x4f')])&&isActive(_0xd61917['active'])){_0xd61917[_0x6c4e('0xa4')]=!![];BPromise[_0x6c4e('0xbb')]()[_0x6c4e('0xc0')](checkIsActive(_0xd61917,_0xd61917[_0x6c4e('0x77')]))[_0x6c4e('0xc0')](checkInterval(_0xd61917))[_0x6c4e('0xc0')](_0x630fab['checkIsTrunkReachable'](_0xd61917))[_0x6c4e('0xc0')](_0x630fab[_0x6c4e('0x150')](_0xd61917['dialGlobalInterval'],_0xd61917[_0x6c4e('0x16d')],_0xd61917[_0x6c4e('0x44')],_0xd61917))[_0x6c4e('0xc0')](_0x630fab[_0x6c4e('0x152')](_0xd61917[_0x6c4e('0x4a')],_0xd61917[_0x6c4e('0x16d')],_0xd61917[_0x6c4e('0x44')],_0xd61917))[_0x6c4e('0xc0')](_0x630fab[_0x6c4e('0x177')](_0xd61917))[_0x6c4e('0xb5')](loggerCatchQueueSummary(_0x6c4e('0x178'),_0xd61917));}else{notSendMessagesCampaign(_0xd61917);}}}};function getCallerIdRandom(_0x401c69,_0x179b2e){var _0x310501;var _0x3c7f70;var _0x21c27c;if(_0x179b2e<=0x0){_0x179b2e=0x1;}_0x310501=new RegExp('\x5cw{0,'+_0x179b2e+'}$');_0x3c7f70=Math[_0x6c4e('0x179')](0xa,_0x179b2e-0x1);_0x21c27c=Math[_0x6c4e('0x179')](0xa,_0x179b2e)-0x1;return util[_0x6c4e('0x97')]('%s',_[_0x6c4e('0x17a')](_0x401c69,_0x310501,_[_0x6c4e('0x17b')](_0x3c7f70,_0x21c27c)));}function extractCalleridName(_0x42539d){var _0x11c92b=_0x42539d[_0x6c4e('0x17c')](/"(.*?)"/);return _0x11c92b?_0x11c92b[0x1]:_0x42539d;}function extractCalleridNumber(_0x5bfc1d){var _0x45cb7f=_0x5bfc1d['match'](/<(.*?)>/);return _0x45cb7f?_0x45cb7f[0x1]:_0x5bfc1d;}Dialer[_0x6c4e('0x1e')]['actionOriginate']=function(_0x6f30f4,_0x2858ae){var _0x136c64=this;var _0x6b7d4=uuid['v4']();this[_0x6c4e('0x27')][_0x6b7d4]=new Action(_0x6f30f4,_0x2858ae,_0x6b7d4);return new BPromise(function(_0x31fd55,_0x745b1a){if(_['isUndefined'](_0x6f30f4)&&typeof _0x6f30f4!=='object'){return _0x745b1a(msgResponse('originate',_0x6c4e('0x153'),_0x6c4e('0x17d')));}if(_[_0x6c4e('0x42')](_0x2858ae[_0x6c4e('0x17e')])||_0x2858ae[_0x6c4e('0x17e')]===null){return _0x745b1a(msgResponse(_0x6c4e('0x17f'),_0x6c4e('0x153'),_0x6c4e('0x180')));}var _0x4d7b8a={'XMD-CALLERID':_0x136c64[_0x6c4e('0x27')][_0x6b7d4]['getCaller'](),'XMD-AGI':_0x6f30f4[_0x6c4e('0x112')]?util['format'](_0x6c4e('0x181'),ipAgi,_0x6f30f4[_0x6c4e('0x112')]):'NONE','XMD-AGIAFTER':_0x6f30f4[_0x6c4e('0x118')]?util[_0x6c4e('0x97')](_0x6c4e('0x181'),ipAgi,_0x6f30f4['dialQueueProject2']):_0x6c4e('0x182'),'XMD-QUEUE':_0x6f30f4[_0x6c4e('0x4f')]===_0x6c4e('0x50')?util['format']('\x22%s,%s%s,,,%s\x22',_0x6f30f4[_0x6c4e('0x44')],_0x6f30f4[_0x6c4e('0x183')]||'',_0x6f30f4['dialAgiAfterHangupAgent']?'c':'',_0x6f30f4['dialQueueTimeout']||0x3):_0x6c4e('0x182'),'XMD-CONTACTID':_0x2858ae[_0x6c4e('0x102')],'XMD-CDRTYPE':_0x6c4e('0x8'),'CALLERID(all)':_0x136c64[_0x6c4e('0x27')][_0x6b7d4][_0x6c4e('0x184')](),'XMD-AMD':_0x6f30f4[_0x6c4e('0xe7')]?'ACTIVE':_0x6c4e('0x182'),'XMD-DESTINATION':_0x6c4e('0x185')};if(_0x6f30f4['dialAMDActive']){_0x4d7b8a[_0x6c4e('0x186')]=_0x6f30f4[_0x6c4e('0x187')]||0x9c4;_0x4d7b8a['XMD-AMDGREETING']=_0x6f30f4[_0x6c4e('0x188')]||0x5dc;_0x4d7b8a['XMD-AMDAFTERGREETINGSILENCE']=_0x6f30f4[_0x6c4e('0x189')]||0x320;_0x4d7b8a[_0x6c4e('0x18a')]=_0x6f30f4[_0x6c4e('0x18b')]||0x1388;_0x4d7b8a[_0x6c4e('0x18c')]=_0x6f30f4[_0x6c4e('0x18d')]||0x64;_0x4d7b8a[_0x6c4e('0x18e')]=_0x6f30f4[_0x6c4e('0x18f')]||0x32;_0x4d7b8a[_0x6c4e('0x190')]=_0x6f30f4[_0x6c4e('0x191')]||0x3;_0x4d7b8a['XMD-AMDSILENCETHRESHOLD']=_0x6f30f4[_0x6c4e('0x192')]||0x100;_0x4d7b8a['XMD-AMDMAXIMUMWORDLENGTH']=_0x6f30f4['dialAMDMaximumWordLength']||0x1388;}if(_0x6f30f4[_0x6c4e('0x4f')]===_0x6c4e('0x50')){_0x4d7b8a[_0x6c4e('0x193')]=_0x2858ae[_0x6c4e('0xd9')];}else{_0x4d7b8a['XMD-CAMPAIGNID']=_0x2858ae[_0x6c4e('0xda')];}for(var _0xf699d7 in _0x2858ae[_0x6c4e('0x194')]){if(typeof _0x2858ae[_0x6c4e('0x194')][_0xf699d7]!==_0x6c4e('0x9c')){if(isNotNull(_0x2858ae[_0x6c4e('0x194')][_0xf699d7])&&_0xf699d7!=='id'&&_0xf699d7!=='tags'&&_0xf699d7!==_0x6c4e('0x195')&&_0xf699d7!==_0x6c4e('0x196')){_0x4d7b8a[util[_0x6c4e('0x97')](_0x6c4e('0x197'),_0x6c4e('0x198'),_[_0x6c4e('0x199')](_0xf699d7))]=_0x2858ae['Contact'][_0xf699d7];}}}var _0x26b0ac=_0x136c64[_0x6c4e('0xdf')](_0x6f30f4[_0x6c4e('0x76')])?getCallerId(_0x6f30f4[_0x6c4e('0x76')]['callerid'],_0x6f30f4[_0x6c4e('0x19a')],_0x6f30f4[_0x6c4e('0x19b')]>0x0?getCallerIdRandom(_0x6f30f4['dialOriginateCallerIdNumber'],_0x6f30f4[_0x6c4e('0x19b')]):_0x6f30f4[_0x6c4e('0x5f')]):getCallerId(_[_0x6c4e('0xb1')](_0x6f30f4[_0x6c4e('0x14d')])?_0x6f30f4[_0x6c4e('0x76')]['callerid']:_0x6f30f4[_0x6c4e('0x14d')]['callerid'],_0x6f30f4[_0x6c4e('0x19a')],_0x6f30f4[_0x6c4e('0x19b')]>0x0?getCallerIdRandom(_0x6f30f4['dialOriginateCallerIdNumber'],_0x6f30f4[_0x6c4e('0x19b')]):_0x6f30f4[_0x6c4e('0x5f')]);if(_0x26b0ac){_0x4d7b8a['XMD-ORIGINATECALLERIDNAME']=_0x136c64[_0x6c4e('0x27')][_0x6b7d4][_0x6c4e('0x19c')]=extractCalleridName(_0x26b0ac);_0x4d7b8a[_0x6c4e('0x19d')]=_0x2858ae[_0x6c4e('0x17e')];}return ami[_0x6c4e('0xb2')]({'actionid':_0x6b7d4,'action':_0x6c4e('0x17f'),'channel':_0x136c64[_0x6c4e('0xdf')](_0x6f30f4[_0x6c4e('0x76')])?util[_0x6c4e('0x97')](_0x6c4e('0x19e'),_0x6f30f4['Trunk'][_0x6c4e('0x44')],isNotNull(_0x6f30f4['dialPrefix'])?_0x6f30f4[_0x6c4e('0x61')][_0x6c4e('0x19f')]()||'':'',_0x6f30f4[_0x6c4e('0x1a0')]>0x0?_0x2858ae[_0x6c4e('0x17e')][_0x6c4e('0x1a1')](_0x6f30f4['dialCutDigit']):_0x2858ae[_0x6c4e('0x17e')]):util[_0x6c4e('0x97')]('SIP/%s/%s%s',_[_0x6c4e('0xb1')](_0x6f30f4['TrunkBackup'])?_0x6f30f4[_0x6c4e('0x76')][_0x6c4e('0x44')]:_0x6f30f4[_0x6c4e('0x14d')][_0x6c4e('0x44')],isNotNull(_0x6f30f4[_0x6c4e('0x61')])?_0x6f30f4[_0x6c4e('0x61')][_0x6c4e('0x19f')]()||'':'',_0x6f30f4[_0x6c4e('0x1a0')]>0x0?_0x2858ae['phone'][_0x6c4e('0x1a1')](_0x6f30f4[_0x6c4e('0x1a0')]):_0x2858ae[_0x6c4e('0x17e')]),'callerid':_0x26b0ac,'Exten':_0x6c4e('0x185'),'Context':_0x6c4e('0x1a2'),'Priority':'1','variable':_0x4d7b8a,'timeout':(_0x6f30f4[_0x6c4e('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6b7d4})[_0x6c4e('0xc0')](function(_0x13a2d5){return _0x31fd55(_0x13a2d5);})[_0x6c4e('0xb5')](function(_0x7b7dc7){_0x6f30f4['outboundOriginateFailureCallsDay']+=0x1;var _0x519591=new History(_0x136c64[_0x6c4e('0x27')][_0x6b7d4]);logger[_0x6c4e('0x98')](util[_0x6c4e('0x97')](_0x6c4e('0x1a3'),JSON[_0x6c4e('0x79')](_0x7b7dc7)));_0x519591[_0x6c4e('0xab')]=0xe;_0x519591[_0x6c4e('0xea')]=_0x6c4e('0x1a4');_0x519591[_0x6c4e('0xad')]=moment()['format'](_0x6c4e('0x10c'));_0x519591[_0x6c4e('0xac')]=_0x519591[_0x6c4e('0xad')];_0x136c64[_0x6c4e('0xd3')](_0x519591)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1a5')));_0x136c64[_0x6c4e('0xd1')](_0x519591)['catch'](loggerCatch(_0x6c4e('0x1a5')))[_0x6c4e('0x13f')](function(){delete _0x136c64['actions'][_0x6b7d4];return _0x745b1a(msgResponse('originate',_0x6c4e('0x1a6'),_0x6c4e('0x1a7')));});});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x33')]=function(_0x4701e7){var _0x1c22df=this[_0x6c4e('0x27')][_0x4701e7[_0x6c4e('0x132')]];if(_0x1c22df){delete this[_0x6c4e('0x27')][_0x4701e7[_0x6c4e('0x132')]];_0x1c22df[_0x6c4e('0x120')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));var _0xbe0b41=_0x1c22df[_0x6c4e('0x4f')]===_0x6c4e('0x7c')?this[_0x6c4e('0x22')][_0x1c22df[_0x6c4e('0xb8')]]:this[_0x6c4e('0x21')][_0x1c22df[_0x6c4e('0x1a8')]()];if(!this[_0x6c4e('0xdd')](_0x4701e7[_0x6c4e('0x1a9')])){this[_0x6c4e('0xb6')](_0xbe0b41);return this[_0x6c4e('0x1aa')](_0x1c22df,_0xbe0b41,_0x4701e7)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1ab')));}this['uniqueId'][_0x4701e7[_0x6c4e('0xe3')]]=_0x1c22df;}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1ac')]=function(_0x42d890,_0x106a5,_0x99e4b9){var _0x37514a=new History(_0x106a5);if(_0x37514a[_0x6c4e('0xf6')]+_0x37514a[_0x6c4e('0xf7')]+_0x37514a[_0x6c4e('0xf8')]+_0x37514a[_0x6c4e('0xf9')]+_0x37514a[_0x6c4e('0xfa')]+_0x37514a[_0x6c4e('0xfb')]+_0x37514a[_0x6c4e('0xf2')]+_0x37514a['countagentrejectretry']>=_0x99e4b9[_0x6c4e('0x108')]-0x1){return!![];}switch(_0x42d890){case 0x3:if(_0x37514a['countnoanswerretry']>=_0x99e4b9[_0x6c4e('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x37514a[_0x6c4e('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x99e4b9[_0x6c4e('0x1ae')],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1af')));break;case 0x5:if(_0x37514a[_0x6c4e('0xf6')]>=_0x99e4b9[_0x6c4e('0x1b0')]-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countbusyretry':_0x37514a[_0x6c4e('0xf6')]+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9['dialBusyRetryFrequency'],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1b1')));break;case 0x8:if(_0x37514a[_0x6c4e('0xf7')]>=_0x99e4b9['dialCongestionMaxRetry']-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countcongestionretry':_0x37514a[_0x6c4e('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x99e4b9[_0x6c4e('0x1b2')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a['VoiceQueueId']||undefined,'CampaignId':_0x37514a['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1b3')));break;case 0x0:if(_0x37514a[_0x6c4e('0xf9')]>=_0x99e4b9[_0x6c4e('0x1b4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x37514a[_0x6c4e('0xf9')]+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x1b5')],'minutes')[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a['ContactId'],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1b6')));}break;case 0xa:if(_0x37514a[_0x6c4e('0xfa')]>=_0x99e4b9['dialDropMaxRetry']-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countdropretry':_0x37514a['countdropretry']+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x126')],_0x6c4e('0x101'))[_0x6c4e('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a['ListId'],'VoiceQueueId':_0x37514a['VoiceQueueId']||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x12b')));break;case 0xb:if(_0x37514a[_0x6c4e('0xfb')]>=_0x99e4b9[_0x6c4e('0x1b7')]-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countabandonedretry':_0x37514a[_0x6c4e('0xfb')]+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x130')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a['ContactId'],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x37514a[_0x6c4e('0xf2')]>=_0x99e4b9['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x37514a['countmachineretry']+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x10b')],_0x6c4e('0x101'))[_0x6c4e('0x97')](_0x6c4e('0x10c')),'ContactId':_0x37514a['ContactId'],'ListId':_0x37514a['ListId'],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a[_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x10d')));break;case 0x14:if(_0x37514a['countagentrejectretry']>=_0x99e4b9[_0x6c4e('0x1b8')]-0x1){return!![];}this[_0x6c4e('0xc7')]({'active':![],'countagentrejectretry':_0x37514a['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x6c4e('0x100')](_0x99e4b9[_0x6c4e('0x1b9')],'minutes')['format'](_0x6c4e('0x10c')),'ContactId':_0x37514a[_0x6c4e('0x102')],'ListId':_0x37514a[_0x6c4e('0x103')],'VoiceQueueId':_0x37514a[_0x6c4e('0xd9')]||undefined,'CampaignId':_0x37514a['CampaignId']||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1ba')));break;default:return!![];}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1aa')]=function(_0x5e5b56,_0x444143,_0x431e11){var _0x52cfb9=this;var _0x550080=new History(_0x5e5b56);var _0x1ae225=![];var _0xf2b281;var _0x4bfcba;return new BPromise(function(_0x186b4b,_0x2602d2){if(_[_0x6c4e('0x42')](_0x444143)&&typeof _0x444143!==_0x6c4e('0x1bb')){return _0x2602d2(msgResponse(_0x6c4e('0x1bc'),_0x6c4e('0x153'),_0x6c4e('0x1bd')));}if(_[_0x6c4e('0x42')](_0x431e11)&&typeof _0x431e11!==_0x6c4e('0x1bb')){return _0x2602d2(msgResponse('[callProgressDetecting]',_0x6c4e('0x153'),_0x6c4e('0x1be')));}_0x52cfb9[_0x6c4e('0xbf')](_0x550080,_0x431e11[_0x6c4e('0x116')],_0x444143)[_0x6c4e('0xc0')](function(_0x50bc00){if(_0x50bc00['additional']==0x1)_0x1ae225=!![];switch(_0x431e11[_0x6c4e('0x116')]){case'0':_0x444143[_0x6c4e('0x66')]+=0x1;_0x550080[_0x6c4e('0xab')]=0x0;_0x550080['statedesc']='NoSuchNumber';_0x550080[_0x6c4e('0xf9')]+=0x1;_0x550080['countglobal']+=0x1;ami[_0x6c4e('0x4e')](_0x6c4e('0x1bf'),ut[_0x6c4e('0xee')](_0x5e5b56,'nosuchnumber'));_0xf2b281=_0x444143['dialNoSuchNumberRetryFrequency'];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xf5')));if(_0x52cfb9[_0x6c4e('0x1ac')](0x0,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf9')]>=_0x444143[_0x6c4e('0x1b4')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c0'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c0'));}}break;case'3':_0x444143['outboundNoAnswerCallsDay']+=0x1;_0x550080[_0x6c4e('0xab')]=0x3;_0x550080[_0x6c4e('0xea')]='NoAnswer';_0x550080[_0x6c4e('0xf8')]+=0x1;_0x550080['countglobal']+=0x1;ami[_0x6c4e('0x4e')](_0x6c4e('0x1c1'),ut[_0x6c4e('0xee')](_0x5e5b56,_0x6c4e('0x1c2')));_0xf2b281=_0x444143[_0x6c4e('0x1ae')];_0x4bfcba=_0x444143['callAdditionalPhoneAfterMin'];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1c3')));if(_0x52cfb9['checkRetriveMax'](0x3,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf8')]>=_0x444143[_0x6c4e('0x1ad')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c4'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c4'));}}break;case'5':_0x444143['outboundBusyCallsDay']+=0x1;_0x550080['state']=0x5;_0x550080[_0x6c4e('0xea')]=_0x6c4e('0x1c5');_0x550080[_0x6c4e('0xf6')]+=0x1;_0x550080[_0x6c4e('0xf3')]+=0x1;ami[_0x6c4e('0x4e')](_0x6c4e('0x1c6'),ut['buildObj'](_0x5e5b56,_0x6c4e('0x1c7')));_0xf2b281=_0x444143['dialBusyRetryFrequency'];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9['createHistory'](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1c8')));if(_0x52cfb9[_0x6c4e('0x1ac')](0x5,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf6')]>=_0x444143[_0x6c4e('0x1b0')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,'reason\x205\x20busy');}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1c9'));}}break;case'8':_0x444143[_0x6c4e('0x64')]+=0x1;_0x550080[_0x6c4e('0xab')]=0x8;_0x550080[_0x6c4e('0xea')]=_0x6c4e('0x1ca');_0x550080[_0x6c4e('0xf7')]+=0x1;_0x550080['countglobal']+=0x1;_0xf2b281=_0x444143['dialCongestionRetryFrequency'];_0x4bfcba=_0x444143[_0x6c4e('0x127')];ami[_0x6c4e('0x4e')]('custom:agentcongestion',ut[_0x6c4e('0xee')](_0x5e5b56,'congestion'));_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x1cb')));if(_0x52cfb9[_0x6c4e('0x1ac')](0x8,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080['countcongestionretry']>=_0x444143[_0x6c4e('0x1cc')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1cd'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1cd'));}}break;case'11':_0x444143[_0x6c4e('0x1ce')]+=0x1;_0x550080[_0x6c4e('0xab')]=0xb;_0x550080[_0x6c4e('0xea')]='Abandoned';_0x550080[_0x6c4e('0xfb')]+=0x1;_0x550080['countglobal']+=0x1;_0xf2b281=_0x444143[_0x6c4e('0x130')];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x131')));if(_0x52cfb9['checkRetriveMax'](0xb,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xfb')]>=_0x444143[_0x6c4e('0x1b7')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,'reason\x2011\x20abandoned');}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1cf'));}}break;case'20':_0x444143['outboundRejectCallsDay']+=0x1;_0x550080[_0x6c4e('0xab')]=0x14;_0x550080[_0x6c4e('0xea')]=_0x6c4e('0x1d0');_0x550080[_0x6c4e('0xfc')]+=0x1;_0x550080['countglobal']+=0x1;_0xf2b281=_0x444143[_0x6c4e('0x1b9')];_0x4bfcba=_0x444143[_0x6c4e('0x127')];ami[_0x6c4e('0x4e')]('custom:agentreject',ut['buildObj'](_0x5e5b56,_0x6c4e('0x1d1')));_0x52cfb9['createHistory'](_0x550080)[_0x6c4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x52cfb9[_0x6c4e('0x1ac')](0x14,_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xfc')]>=_0x444143[_0x6c4e('0x1b8')]){_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1d2'));}else{_0x52cfb9[_0x6c4e('0xfd')](_0x550080,_0x186b4b,_0x2602d2,_0x6c4e('0x1d2'));}}break;default:_0x444143['outboundUnknownCallsDay']+=0x1;_0x550080[_0x6c4e('0xab')]=0xc;_0x550080[_0x6c4e('0xea')]=_0x431e11[_0x6c4e('0x116')];_0xf2b281=_0x444143[_0x6c4e('0x1b9')];_0x4bfcba=_0x444143[_0x6c4e('0x127')];_0x52cfb9[_0x6c4e('0xd3')](_0x550080)[_0x6c4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x52cfb9['checkRetriveMax'](_0x431e11['reason'],_0x5e5b56,_0x444143)&&!_0x1ae225){if(_0x550080[_0x6c4e('0xf6')]+_0x550080[_0x6c4e('0xf7')]+_0x550080['countnoanswerretry']+_0x550080[_0x6c4e('0xf9')]+_0x550080['countdropretry']+_0x550080['countabandonedretry']+_0x550080['countmachineretry']+_0x550080[_0x6c4e('0xfc')]>=_0x444143[_0x6c4e('0x108')]){_0x52cfb9['stateGlobal'](_0x550080,_0x186b4b,_0x2602d2,_0x431e11[_0x6c4e('0x116')]);}else{_0x52cfb9[_0x6c4e('0xff')](_0x550080,_0x186b4b,_0x2602d2,_0x431e11['reason']);}}}})[_0x6c4e('0xc0')](function(_0x2120a7){if(_0x1ae225){_0x52cfb9[_0x6c4e('0xc1')](_0x550080,_0xf2b281,_0x4bfcba)[_0x6c4e('0xc0')](function(_0x53df45){return _0x186b4b(0x1);});}});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0xfd')]=function(_0x4eb0c3,_0x4bb527,_0x238452,_0x25e719){var _0x5eb320=new Final(_0x4eb0c3);_0x5eb320[_0x6c4e('0xab')]=0xf;_0x5eb320[_0x6c4e('0xea')]=_0x6c4e('0x1d3');this['createStateFinal'](_0x5eb320,_0x4bb527,_0x238452,_0x25e719);};Dialer[_0x6c4e('0x1e')]['createStateFinal']=function(_0x5ed347,_0x5dcfae,_0x2d6e8e,_0x20b015){this[_0x6c4e('0xd1')](_0x5ed347)['then'](function(){return _0x5dcfae(msgResponse(_0x6c4e('0x1bc'),_0x6c4e('0xde'),_0x20b015));})[_0x6c4e('0xb5')](function(){return _0x2d6e8e(msgResponse(_0x6c4e('0x1d4'),_0x6c4e('0x153'),_0x6c4e('0x1d5')));});};Dialer[_0x6c4e('0x1e')]['predictive']=function(_0x1abd42){var _0x1c7bb7=_0x1abd42['dialPredictiveOptimizationPercentage']/0x64;var _0x3f15f3=_0x1abd42[_0x6c4e('0x122')]/(_0x1abd42[_0x6c4e('0x122')]+_0x1abd42[_0x6c4e('0xe9')]);var _0x3eb51b=Math[_0x6c4e('0x1d6')](_0x1abd42[_0x6c4e('0x72')]*(_0x1abd42[_0x6c4e('0x1d7')]/0x64));var _0x243196=Math[_0x6c4e('0x1d6')](_0x1abd42[_0x6c4e('0x72')]*(_0x1abd42[_0x6c4e('0x1d8')]/0x64));var _0x4e80e4=_0x1abd42['available']+_0x1abd42[_0x6c4e('0x58')];var _0x257466=Math[_0x6c4e('0x1d9')](_0x1abd42[_0x6c4e('0x73')]*_0x1abd42[_0x6c4e('0x75')]*_0x1abd42['predictiveIntervalHitRate']*_0x1abd42[_0x6c4e('0x1da')]);if(_['isUndefined'](_0x1abd42[_0x6c4e('0x2b')])){if(!_['isUndefined'](_0x1abd42['startPredictive'])){_0x1abd42[_0x6c4e('0x2a')]=undefined;loggerPredictive['error'](_0x6c4e('0x1db'),_0x6c4e('0x1dc'));}if(!_[_0x6c4e('0x42')](_0x1abd42[_0x6c4e('0x92')])){loggerPredictive[_0x6c4e('0x98')](_0x6c4e('0x1db'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1abd42[_0x6c4e('0x92')]);_0x1abd42['handlePredictive']=undefined;}_0x1abd42[_0x6c4e('0x2b')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));loggerPredictive['info'](_0x1abd42[_0x6c4e('0x44')],'collection\x20data\x20in\x20progressive\x20at',_0x1abd42[_0x6c4e('0x2b')]);this[_0x6c4e('0x165')](_0x1abd42,0x1);}else if(ifInterval(_0x1abd42[_0x6c4e('0x1dd')],_0x1abd42[_0x6c4e('0x2b')])){this[_0x6c4e('0x165')](_0x1abd42,0x1);loggerPredictiveCalls[_0x6c4e('0x7e')](_0x6c4e('0x1de'),_0x1abd42['startProgressive'],_0x1abd42[_0x6c4e('0x44')]);_0x1abd42[_0x6c4e('0x73')]=0x0;_0x1abd42[_0x6c4e('0x70')]=0x0;}else if(_0x1c7bb7<_0x3f15f3&&_0x1abd42[_0x6c4e('0x1df')]==='dropRate'){freeVariablesPredictive(_0x1abd42);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x1e0'),_0x6c4e('0x1e1'),_0x3f15f3,'startProgressive',_0x1abd42[_0x6c4e('0x44')]);}else if(_0x257466<_0x1abd42[_0x6c4e('0x70')]&&_0x1abd42[_0x6c4e('0x1df')]===_0x6c4e('0x1e2')){freeVariablesPredictive(_0x1abd42);loggerPredictive[_0x6c4e('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x6c4e('0x1e3'),_0x257466,_0x6c4e('0x1e4'),_0x1abd42[_0x6c4e('0x70')],_0x6c4e('0x2b'),_0x1abd42[_0x6c4e('0x44')]);}else if(!ifInterval(_0x1abd42[_0x6c4e('0x1dd')],_0x1abd42[_0x6c4e('0x2b')])&&_[_0x6c4e('0x42')](_0x1abd42[_0x6c4e('0x2a')])&&!_[_0x6c4e('0x42')](_0x1abd42[_0x6c4e('0x2b')])){_0x1abd42['startPredictive']=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));loggerPredictive['info'](_0x1abd42['name'],_0x6c4e('0x1e5'),_0x1abd42[_0x6c4e('0x2a')]);this[_0x6c4e('0xc4')](_0x1abd42[_0x6c4e('0x1dd')])[_0x6c4e('0xc0')](this['getDataPredictive'](_0x1abd42))[_0x6c4e('0xc0')](mergeDataErlangB(_0x1abd42))[_0x6c4e('0xc0')](this[_0x6c4e('0x1e6')](_0x1abd42))[_0x6c4e('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1abd42));}else if(!ifInterval(_0x1abd42[_0x6c4e('0x1dd')],_0x1abd42[_0x6c4e('0x2a')])){_0x1abd42[_0x6c4e('0x70')]=0x0;_0x1abd42[_0x6c4e('0x2a')]=moment()[_0x6c4e('0x97')](_0x6c4e('0x10c'));loggerPredictive[_0x6c4e('0x7e')](_0x1abd42[_0x6c4e('0x44')],'recalculate\x20predictive\x20at',_0x1abd42[_0x6c4e('0x2a')]);clearInterval(_0x1abd42['handlePredictive']);_0x1abd42[_0x6c4e('0x92')]=undefined;this[_0x6c4e('0xc4')](_0x1abd42[_0x6c4e('0x1dd')])['then'](this[_0x6c4e('0x1e7')](_0x1abd42))[_0x6c4e('0xc0')](mergeDataErlangB(_0x1abd42))[_0x6c4e('0xc0')](this[_0x6c4e('0x1e6')](_0x1abd42))[_0x6c4e('0xb5')](loggerCatchPredictive(_0x6c4e('0x1e8'),_0x1abd42));}else if(_0x1abd42[_0x6c4e('0x72')]&&_0x4e80e4<_0x1abd42['predictiveIntervalAvailable']-_0x243196){freeVariablesPredictive(_0x1abd42);loggerPredictive[_0x6c4e('0x7e')](_0x1abd42[_0x6c4e('0x44')],_0x6c4e('0x1e9'),_0x4e80e4,_0x6c4e('0x1ea'),_0x1abd42[_0x6c4e('0x72')],'-',_0x243196,'=',_0x1abd42['predictiveIntervalAvailable']-_0x243196,')');}else if(_0x1abd42[_0x6c4e('0x72')]&&_0x4e80e4>_0x1abd42[_0x6c4e('0x72')]+_0x3eb51b){freeVariablesPredictive(_0x1abd42);loggerPredictive['info'](_0x1abd42[_0x6c4e('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4e80e4,_0x6c4e('0x1eb'),_0x1abd42[_0x6c4e('0x72')],'+',_0x3eb51b,'=',_0x1abd42['predictiveIntervalAvailable']+_0x3eb51b,')');}};Dialer[_0x6c4e('0x1e')]['getDataPredictive']=function(_0x3ec82c){var _0x2a1569=this;return function(_0x44ec6c){return new BPromise(function(_0x4bccb0,_0x52672e){_[_0x6c4e('0x8f')](_0x3ec82c,_0x44ec6c[0x0]);if(checkGetDataPredictive(_0x44ec6c[0x0])){var _0x7e03f1=_0x3ec82c[_0x6c4e('0x72')]=_0x3ec82c[_0x6c4e('0x58')]+_0x3ec82c[_0x6c4e('0x53')];var _0x31bc7f=_0x3ec82c[_0x6c4e('0x1dd')]*0x3c;var _0x58c346=_0x44ec6c[0x0][_0x6c4e('0x6c')]+_0x44ec6c[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a7dc8=(_0x44ec6c[0x0]['predictiveIntervalAnsweredCalls']+_0x44ec6c[0x0][_0x6c4e('0x6e')]+_0x44ec6c[0x0][_0x6c4e('0x6d')])/_0x44ec6c[0x0][_0x6c4e('0x81')];_0x3ec82c['predictiveIntervalHitRate']=_0x4a7dc8>0x0?_0x4a7dc8:0x1;switch(_0x3ec82c[_0x6c4e('0x1df')]){case _0x6c4e('0x1e2'):var _0x5e6c38=_0x3ec82c[_0x6c4e('0x1ec')]/0x64;return _0x2a1569[_0x6c4e('0x1ed')](_0x7e03f1,_0x31bc7f,_0x58c346,_0x4a7dc8,_0x5e6c38)[_0x6c4e('0xc0')](function(_0x4ab967){return _0x4bccb0(_0x4ab967);});case _0x6c4e('0x1ee'):var _0x57b888=_0x3ec82c['dialPredictiveOptimizationPercentage']/0x64;return _0x2a1569['busyFactor'](_0x7e03f1,_0x31bc7f,_0x58c346,_0x4a7dc8,_0x57b888)[_0x6c4e('0xc0')](function(_0x257780){return _0x4bccb0(_0x257780);});default:return _0x52672e(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x52672e(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x6c4e('0x1e')]['getDataPredictiveOld']=function(_0x4c2e05){var _0x3b5eaf=this;return function(_0x2628ec){return new BPromise(function(_0x5ea26e,_0x3c442b){_['merge'](_0x4c2e05,_0x2628ec[0x0]);if(checkGetDataPredictive(_0x2628ec[0x0])){loggerPredictive[_0x6c4e('0x7e')](JSON[_0x6c4e('0x79')](_0x2628ec[0x0]));if(_0x4c2e05[_0x6c4e('0x1df')]==='dropRate'){return _0x3b5eaf['getVoiceQueueRtPauses'](_0x4c2e05['id'])[_0x6c4e('0xc0')](function(_0x4d07ae){var _0x9152a6=_0x4c2e05['loggedIn']-_0x4d07ae[0x0]['outboundQueuePauses'];var _0x33937c=_0x4c2e05[_0x6c4e('0x1dd')]*0x3c;var _0x3e774c=_0x2628ec[0x0][_0x6c4e('0x6c')]+_0x2628ec[0x0][_0x6c4e('0x6b')];var _0x4a7283=(_0x2628ec[0x0][_0x6c4e('0x6a')]+_0x2628ec[0x0][_0x6c4e('0x6e')]+_0x2628ec[0x0][_0x6c4e('0x6d')])/_0x2628ec[0x0]['predictiveIntervalTotalCalls'];var _0x242b20=_0x4c2e05[_0x6c4e('0x1ec')]/0x64;_0x4c2e05['predictiveIntervalPauses']=_0x4d07ae[0x0][_0x6c4e('0x1ef')]||0x0;_0x4c2e05[_0x6c4e('0x1f0')]=_0x4a7283>0x0?_0x4a7283:0x1;return _0x3b5eaf[_0x6c4e('0x1ed')](_0x9152a6,_0x33937c,_0x3e774c,_0x4a7283,_0x242b20);})[_0x6c4e('0xc0')](function(_0x4e62d0){return _0x5ea26e(_0x4e62d0);})[_0x6c4e('0xb5')](function(_0x3b6054){return _0x3c442b(msgResponse(_0x6c4e('0x1f1'),'Failure',JSON['stringify'](_0x3b6054)));});}if(_0x4c2e05[_0x6c4e('0x1df')]==='agentBusyFactor'){return _0x3b5eaf[_0x6c4e('0xcf')](_0x4c2e05['id'])[_0x6c4e('0xc0')](function(_0xf428ea){var _0xd6ead4=_0x4c2e05['loggedIn']-_0xf428ea[0x0][_0x6c4e('0x1ef')];var _0x6ed5de=_0x4c2e05['dialPredictiveInterval']*0x3c;var _0x1ca471=_0x2628ec[0x0][_0x6c4e('0x6c')]+_0x2628ec[0x0][_0x6c4e('0x6b')];var _0x22fd6f=(_0x2628ec[0x0][_0x6c4e('0x6a')]+_0x2628ec[0x0][_0x6c4e('0x6e')]+_0x2628ec[0x0][_0x6c4e('0x6d')])/_0x2628ec[0x0][_0x6c4e('0x81')];var _0x2b89ca=_0x4c2e05[_0x6c4e('0x1ec')]/0x64;_0x4c2e05['predictiveIntervalPauses']=_0xf428ea[0x0][_0x6c4e('0x1ef')]||0x0;_0x4c2e05[_0x6c4e('0x1f0')]=_0x22fd6f>0x0?_0x22fd6f:0x1;return _0x3b5eaf[_0x6c4e('0x1f2')](_0xd6ead4,_0x6ed5de,_0x1ca471,_0x22fd6f,_0x2b89ca);})[_0x6c4e('0xc0')](function(_0x1c3562){return _0x5ea26e(_0x1c3562);})[_0x6c4e('0xb5')](function(_0x1da7da){return _0x3c442b(msgResponse('[CatchErlangB]',_0x6c4e('0x153'),JSON[_0x6c4e('0x79')](_0x1da7da)));});}}else{return _0x3c442b(msgResponse(_0x6c4e('0x1f3'),'Failure','check\x20failure'));}});};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1e6')]=function(_0x40ca75){var _0x30efb5=this;return function(){var _0x2a17ca=0x0;var _0x399cde=Math[_0x6c4e('0x1d9')](_0x40ca75['erlangCallToSecond']*0x3e8);if(_0x399cde>0x0){_0x399cde=_0x399cde<0x64?0x64:_0x399cde;loggerPredictive[_0x6c4e('0x7e')](_0x40ca75[_0x6c4e('0x44')],'one\x20call\x20every:',_0x399cde,_0x6c4e('0x90'));_0x40ca75[_0x6c4e('0x92')]=setInterval(function(){_0x30efb5[_0x6c4e('0x92')](_0x40ca75);loggerPredictiveCalls[_0x6c4e('0x7e')]('[handlePredictive]',_0x2a17ca+=0x1);},_0x399cde);}else{loggerPredictive[_0x6c4e('0x7e')](_0x40ca75[_0x6c4e('0x44')],_0x6c4e('0x1f4'));}};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1f5')]=function(_0x25ca18,_0x44beba){var _0x336a29=this;return function(_0x86cb15){if(_[_0x6c4e('0x7d')](_0x86cb15)){if(_[_0x6c4e('0xb1')](_0x44beba[_0x6c4e('0x1f6')])||!_0x44beba['recallme']){if(_0x25ca18[_0x6c4e('0x5e')]==='booked'){_0x25ca18[_0x6c4e('0x13a')]=_[_0x6c4e('0x42')](_0x25ca18[_0x6c4e('0x13a')])?!![]:_0x25ca18[_0x6c4e('0x13a')];var _0x556b8e=uuid['v4']();_0x336a29[_0x6c4e('0x27')][_0x556b8e]=new Action(_0x25ca18,_0x44beba,_0x556b8e);loggerBooked[_0x6c4e('0x7e')]('[booked][checkContactBlack]',_0x556b8e,_0x6c4e('0x1f7'),JSON[_0x6c4e('0x79')](_0x25ca18[_0x6c4e('0x13a')]),'Queue:\x20',_0x25ca18[_0x6c4e('0x44')]);if(_0x25ca18[_0x6c4e('0x13a')]){_0x25ca18[_0x6c4e('0x13a')]=![];_0x336a29[_0x6c4e('0x137')][_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xb8')]]=[];ami[_0x6c4e('0xb2')]({'actionid':_0x556b8e,'action':_0x6c4e('0x1f8'),'queue':_0x25ca18['name']})[_0x6c4e('0xb5')](function(){_0x336a29[_0x6c4e('0xb6')](_0x25ca18);_0x336a29[_0x6c4e('0xc7')]({'active':![],'ContactId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0x102')],'ListId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0x103')],'VoiceQueueId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xd9')]||undefined,'CampaignId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xda')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x336a29[_0x6c4e('0x27')][_0x556b8e];});}else{loggerBooked[_0x6c4e('0x7e')](_0x6c4e('0x1f9'),JSON[_0x6c4e('0x79')](_0x25ca18[_0x6c4e('0x13a')]),_0x6c4e('0x1fa'),_0x25ca18['name']);_0x336a29[_0x6c4e('0xb6')](_0x25ca18);_0x336a29['rescheduleContact']({'active':![],'ContactId':_0x336a29[_0x6c4e('0x27')][_0x556b8e]['ContactId'],'ListId':_0x336a29['actions'][_0x556b8e][_0x6c4e('0x103')],'VoiceQueueId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xd9')]||undefined,'CampaignId':_0x336a29[_0x6c4e('0x27')][_0x556b8e][_0x6c4e('0xda')]||undefined})['catch'](loggerCatch(_0x6c4e('0x1fb')));delete _0x336a29[_0x6c4e('0x27')][_0x556b8e];}}else{return _0x336a29[_0x6c4e('0x1fc')](_0x25ca18,_0x44beba);}}else{if(getDiff(_0x44beba[_0x6c4e('0x1fd')])<_0x25ca18[_0x6c4e('0x1fe')]*0x3c){if(_0x44beba['Agent']&&!_0x44beba[_0x6c4e('0x172')][_0x6c4e('0x1ff')]){_0x336a29[_0x6c4e('0x94')][_0x6c4e('0x13d')](_0x44beba['id'])['finally'](function(){_0x336a29[_0x6c4e('0xb6')](_0x25ca18);});}else{_0x336a29[_0x6c4e('0xc9')]({'active':![]},_0x44beba['id'],0x1)['finally'](function(){_0x336a29[_0x6c4e('0xb6')](_0x25ca18);});}}else{_0x25ca18[_0x6c4e('0x68')]+=0x1;_0x336a29[_0x6c4e('0xb6')](_0x25ca18);if(_0x25ca18['dialRecallInQueue']){_0x336a29['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x44beba[_0x6c4e('0x102')],'ListId':_0x44beba[_0x6c4e('0x103')],'VoiceQueueId':_0x44beba['VoiceQueueId']||undefined,'CampaignId':_0x44beba[_0x6c4e('0xda')]||undefined})[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0x200')));_0x336a29[_0x6c4e('0xd3')](createObjHistory(_0x25ca18,_0x44beba,_0x6c4e('0x201'),0x17,_0x6c4e('0x202')))[_0x6c4e('0xb5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x336a29[_0x6c4e('0xd7')](createObjHistory(_0x25ca18,_0x44beba,_0x6c4e('0x203'),0x16,'RecallFailedTimeout'),_0x6c4e('0x204'),'[Originate][HistoryRecallClose]');}}}}else{_0x25ca18[_0x6c4e('0x63')]+=0x1;_0x336a29[_0x6c4e('0xd7')](createObjHistory(_0x25ca18,_0x44beba,_0x6c4e('0x205'),0xd,_0x6c4e('0x206')),_0x6c4e('0x207'),_0x6c4e('0x208'));throw _0x6c4e('0x209');}};};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x169')]=function(_0x4e5377){var _0x5f7a59=this;var _0x4f35e6=_0x4e5377['limitCalls']-_0x4e5377[_0x6c4e('0x9b')]-_0x4e5377[_0x6c4e('0xcc')];emitCampaignSummary(_0x4e5377);if(_0x4f35e6>0x0){if(_0x4f35e6>this[_0x6c4e('0x25')]){_0x4f35e6=this[_0x6c4e('0x25')];}_0x4e5377['temp']+=_0x4f35e6;this[_0x6c4e('0xcd')](_0x4e5377['id'],_0x4f35e6,_0x4e5377['dialOrderByScheduledAt'],_0x4e5377)[_0x6c4e('0xc0')](function(_0x250831){_0x4e5377['temp']-=_0x4f35e6;_0x4e5377[_0x6c4e('0xcc')]=_0x4e5377[_0x6c4e('0xcc')]>0x0?_0x4e5377['temp']:0x0;if(!checkContactEmpty(_0x250831)){_0x4e5377['message']=_0x6c4e('0xa2');logger[_0x6c4e('0x7e')]('[getContactCampaign2][Empty]'+_0x4e5377[_0x6c4e('0x44')]);}else{_0x4e5377[_0x6c4e('0x9b')]+=_0x250831['length'];_0x4e5377[_0x6c4e('0x45')]='RUNNING';for(var _0x5af352=0x0;_0x5af352<_0x250831[_0x6c4e('0x9a')];_0x5af352+=0x1){_0x4e5377['ivrTotalCallsDays']+=0x1;if(_[_0x6c4e('0xb1')](_0x250831[_0x5af352])||_['isNil'](_0x250831[_0x5af352][_0x6c4e('0x194')])||_[_0x6c4e('0xb1')](_0x250831[_0x5af352][_0x6c4e('0x17e')])){_0x5f7a59['emptyContact']('[actionOriginate]\x20',_0x4e5377,_0x250831[_0x5af352]);}else{_0x5f7a59[_0x6c4e('0xc3')](_[_0x6c4e('0xd8')](_0x250831[_0x5af352],['CampaignId','Contact.phone']))[_0x6c4e('0xc0')](_0x5f7a59[_0x6c4e('0x1f5')](_0x4e5377,_0x250831[_0x5af352]))['catch'](_0x5f7a59[_0x6c4e('0x20a')]('[actionOriginateIvr]\x20',_0x4e5377));}}}})[_0x6c4e('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x4e5377,_0x4f35e6));}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x165')]=function(_0xa59afe,_0x369c0d){var _0xf0cbb8=this;var _0x23a6c1=[];var _0x4faae0=_0x369c0d>=0x1?_0x369c0d:0x1;if(_0xa59afe[_0x6c4e('0x5e')]===_0x6c4e('0x9')){_0x4faae0=0x1;}var _0x5841e0=Math[_0x6c4e('0x1d9')](_0xa59afe[_0x6c4e('0x53')]*_0x4faae0)-_0xa59afe['originated']-_0xa59afe[_0x6c4e('0xcc')];emitVoiceQueueSummary(_0xa59afe);if(_0xa59afe[_0x6c4e('0x20b')]>0x0){var _0x43ac40=_0xa59afe[_0x6c4e('0x20b')]-_0xa59afe[_0x6c4e('0x9b')]-_0xa59afe[_0x6c4e('0x58')]-_0xa59afe[_0x6c4e('0xcc')]-_0xa59afe['pTalking'];if(_0x5841e0>_0x43ac40){_0x5841e0=_0x43ac40;}}if(_0x5841e0>0x0){if(_0xa59afe[_0x6c4e('0x5e')]===_0x6c4e('0x9')){_0x5841e0=0x1;}if(_0x5841e0>this[_0x6c4e('0x25')]){_0x5841e0=this[_0x6c4e('0x25')];}_0xa59afe[_0x6c4e('0xcc')]+=_0x5841e0;for(var _0x397bd8 in this['agents']){if(typeof this[_0x6c4e('0x23')][_0x397bd8]!=='undefined'){if(this['agents'][_0x397bd8][_0x6c4e('0xab')]===_0x6c4e('0x20c')&&this[_0x6c4e('0x23')][_0x397bd8][_0x6c4e('0xb3')]===_0x6c4e('0xe0')){_0x23a6c1[_0x6c4e('0x138')](this[_0x6c4e('0x23')][_0x397bd8]['id']);}}}this[_0x6c4e('0xcb')](_0xa59afe['id'],_0x23a6c1,_0x5841e0,_0xa59afe[_0x6c4e('0x20d')],_0xa59afe)[_0x6c4e('0xc0')](function(_0x477408){_0xa59afe[_0x6c4e('0xcc')]-=_0x5841e0;_0xa59afe[_0x6c4e('0xcc')]=_0xa59afe[_0x6c4e('0xcc')]>0x0?_0xa59afe[_0x6c4e('0xcc')]:0x0;if(!checkContactEmpty(_0x477408)){_0xf0cbb8[_0x6c4e('0xba')](_0xa59afe)[_0x6c4e('0xc0')](sendMessageReschedule(_0xa59afe))[_0x6c4e('0xb5')](loggerCatch(_0x6c4e('0xbc')));}else{_0xa59afe[_0x6c4e('0x9b')]+=_0x477408['length'];_0xa59afe['message']=_0xa59afe['dialMethod']===_0x6c4e('0x9')?_0x6c4e('0x20e'):_0x6c4e('0x20f');for(var _0x316322=0x0;_0x316322<_0x477408[_0x6c4e('0x9a')];_0x316322+=0x1){if(_[_0x6c4e('0xb1')](_0x477408[_0x316322])||_[_0x6c4e('0xb1')](_0x477408[_0x316322][_0x6c4e('0x194')])||_[_0x6c4e('0xb1')](_0x477408[_0x316322][_0x6c4e('0x17e')])){_0xf0cbb8[_0x6c4e('0xd6')](_0x6c4e('0x210'),_0xa59afe,_0x477408[_0x316322]);}else{_0xf0cbb8['checkIsBlackList'](_['pick'](_0x477408[_0x316322],[_0x6c4e('0xd9'),_0x6c4e('0x211')]))[_0x6c4e('0xc0')](_0xf0cbb8[_0x6c4e('0x1f5')](_0xa59afe,_0x477408[_0x316322]))[_0x6c4e('0xb5')](_0xf0cbb8[_0x6c4e('0x20a')](_0x6c4e('0x210'),_0xa59afe));}}}})[_0x6c4e('0xb5')](loggerGetContactDialer(_0x6c4e('0x212'),_0xa59afe,_0x5841e0));}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x92')]=function(_0x5cbe4d){if(_0x5cbe4d[_0x6c4e('0x20b')]>0x0){var _0x2c7e4c=_0x5cbe4d[_0x6c4e('0x20b')]-_0x5cbe4d[_0x6c4e('0x9b')]-_0x5cbe4d[_0x6c4e('0x58')];if(_0x2c7e4c>0x0){this['tryOriginatePredictive'](_0x5cbe4d);}else{loggerPredictiveCalls[_0x6c4e('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x6c4e('0x213')](_0x5cbe4d);}};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x213')]=function(_0x3cc11c){var _0x570aac=this;var _0x1375cf=[];_0x3cc11c[_0x6c4e('0x9b')]+=0x1;for(var _0x4ed605 in this[_0x6c4e('0x23')]){if(typeof this[_0x6c4e('0x23')][_0x4ed605]!==_0x6c4e('0x9c')){if(this[_0x6c4e('0x23')][_0x4ed605][_0x6c4e('0xab')]===_0x6c4e('0x20c')&&this[_0x6c4e('0x23')][_0x4ed605][_0x6c4e('0xb3')]===_0x6c4e('0xe0')){_0x1375cf[_0x6c4e('0x138')](this[_0x6c4e('0x23')][_0x4ed605]['id']);}}}this['getContactDialer'](_0x3cc11c['id'],_0x1375cf,0x1,_0x3cc11c['dialOrderByScheduledAt'],_0x3cc11c)['then'](function(_0x79914f){if(!checkContactEmpty(_0x79914f)){checkContactLowerLimitOriginate(_0x3cc11c,0x1,0x0);_0x570aac[_0x6c4e('0xba')](_0x3cc11c)[_0x6c4e('0xc0')](sendMessageReschedule(_0x3cc11c))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3cc11c[_0x6c4e('0x45')]=_0x6c4e('0x20f');if(_[_0x6c4e('0xb1')](_0x79914f[0x0])||_[_0x6c4e('0xb1')](_0x79914f[0x0][_0x6c4e('0x194')])||_[_0x6c4e('0xb1')](_0x79914f[0x0][_0x6c4e('0x17e')])){_0x570aac[_0x6c4e('0xd6')](_0x6c4e('0x210'),_0x3cc11c,_0x79914f[0x0]);}else{_0x570aac['checkIsBlackList'](_[_0x6c4e('0xd8')](_0x79914f[0x0],[_0x6c4e('0xd9'),'Contact.phone']))[_0x6c4e('0xc0')](_0x570aac[_0x6c4e('0x1f5')](_0x3cc11c,_0x79914f[0x0]))[_0x6c4e('0xb5')](_0x570aac['loggerHandler'](_0x6c4e('0x214'),_0x3cc11c));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x3cc11c,0x1));emitVoiceQueueSummary(_0x3cc11c);};Dialer[_0x6c4e('0x1e')]['abandonmentRate']=function(_0x559a33,_0x42d188,_0x16b4e2,_0x1c9a00,_0x1e3215,_0xa3c233){loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x215'));loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x216'),_0x559a33);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x217'),_0x42d188);loggerPredictive[_0x6c4e('0x7e')]('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',_0x16b4e2);loggerPredictive['info'](_0x6c4e('0x218'),_0x1c9a00);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x219'),_0x1e3215);loggerPredictive['info'](_0x6c4e('0x8e'));return new BPromise(function(_0x53d78e,_0x1711c0){if(_0x559a33<=0x0||isNaN(_0x559a33)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),'m\x20=\x20'+_0x559a33));}if(_0x16b4e2<=0x0||isNaN(_0x16b4e2)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),_0x6c4e('0x21b')+_0x16b4e2));}if(_0x1c9a00<=0x0||isNaN(_0x1c9a00)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),_0x6c4e('0x21c')+_0x1c9a00));}if(_0x42d188<=0x0||isNaN(_0x42d188)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),_0x6c4e('0x21d')+_0x42d188));}if(_0x1e3215<=0x0||isNaN(_0x1e3215)){return _0x1711c0(msgResponse(_0x6c4e('0x21a'),_0x6c4e('0x1a6'),'Amax\x20=\x20'+_0x1e3215));}_0xa3c233=_0xa3c233||0x0;var _0x2a6f98=0x1/_0x16b4e2;var _0x163147=0x0;var _0x504290=0x0;var _0x5e3a28=0x0;var _0x3de726=0x0;for(var _0x506fd7=0x0;_0x5e3a28<_0x1e3215;_0x506fd7+=0x1){_0x504290=_0x506fd7/_0x42d188;_0x163147=(_0x1c9a00*_0x504290+_0xa3c233)/_0x2a6f98;_0x5e3a28=erlangb(_0x163147,_0x559a33);_0x3de726=_0x163147/_0x559a33*(0x1-erlangb(_0x163147,_0x559a33));}return _0x53d78e({'erlangCalls':_0x506fd7,'erlangCallToSecond':_0x42d188/_0x506fd7,'erlangAbandonmentRate':_0x5e3a28,'erlangBusyFactor':_0x3de726});});};Dialer[_0x6c4e('0x1e')][_0x6c4e('0x1f2')]=function(_0x5c8fac,_0x43ac25,_0x5c82ae,_0x58ec3d,_0x1d40a5,_0x47f2e1){loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x21e'));loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x216'),_0x5c8fac);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x217'),_0x43ac25);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x21f'),_0x5c82ae);loggerPredictive[_0x6c4e('0x7e')](_0x6c4e('0x218'),_0x58ec3d);loggerPredictive['info'](_0x6c4e('0x220'),_0x1d40a5);loggerPredictive['info'](_0x6c4e('0x8e'));return new BPromise(function(_0x5cd59a,_0x657fc0){if(_0x5c8fac<=0x0||isNaN(_0x5c8fac)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),_0x6c4e('0x1a6'),_0x6c4e('0x222')+_0x5c8fac));}if(_0x5c82ae<=0x0||isNaN(_0x5c82ae)){return _0x657fc0(msgResponse('[busyFactor]',_0x6c4e('0x1a6'),_0x6c4e('0x21b')+_0x5c82ae));}if(_0x58ec3d<=0x0||isNaN(_0x58ec3d)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),_0x6c4e('0x1a6'),_0x6c4e('0x21c')+_0x58ec3d));}if(_0x43ac25<=0x0||isNaN(_0x43ac25)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),'Error',_0x6c4e('0x21d')+_0x43ac25));}if(_0x1d40a5<=0x0||isNaN(_0x1d40a5)){return _0x657fc0(msgResponse(_0x6c4e('0x221'),_0x6c4e('0x1a6'),_0x6c4e('0x223')+_0x1d40a5));}_0x47f2e1=_0x47f2e1||0x0;var _0x5d38c2=0x1/_0x5c82ae;var _0x37cdd1=0x0;var _0x1fa674=0x0;var _0x232c80=0x0;var _0x121ff3=0x0;for(var _0xd2018e=0x0;_0x121ff3<_0x1d40a5;_0xd2018e+=0x1){_0x1fa674=_0xd2018e/_0x43ac25;_0x37cdd1=(_0x58ec3d*_0x1fa674+_0x47f2e1)/_0x5d38c2;_0x232c80=erlangb(_0x37cdd1,_0x5c8fac);_0x121ff3=_0x37cdd1/_0x5c8fac*(0x1-erlangb(_0x37cdd1,_0x5c8fac));}return _0x5cd59a({'erlangCalls':_0xd2018e,'erlangCallToSecond':_0x43ac25/_0xd2018e,'erlangAbandonmentRate':_0x232c80,'erlangBusyFactor':_0x121ff3});});};module[_0x6c4e('0x224')]=Dialer; \ No newline at end of file +var _0xf2fa=['INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','user:%s','checkPreviewRecallReminder','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','object','originate','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','SIP/%s/%s%s','dialCutDigit','trim','substring','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','AVAILABLE_CONTACTS_FINISHED','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','not_inuse','dialOrderByScheduledAt','countReScheduled','emptyContact','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','abandonmentRate','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','../rpc/setting','./action','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','stringify','milliseconds','seconds','type','outbound','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangBusyFactor','Trunk','active','format','voice:queue:%s','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','status','channel','No\x20such\x20channel','updateOriginated','queue','prototype','resolve','catch','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','unlockContact','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerCallsDay','Machine','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countbusyretry','countdropretry','countabandonedretry','minutes','YYYY-MM-DD\x20HH:mm:ss','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','queueCallerAbandonCreateState','Drop','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','rrmemory','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','indexOf','content','true','all'];(function(_0x5c5e3a,_0x5b0ae0){var _0x12e398=function(_0x1294da){while(--_0x1294da){_0x5c5e3a['push'](_0x5c5e3a['shift']());}};_0x12e398(++_0x5b0ae0);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xaf2f('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xaf2f('0x1'));var moment=require(_0xaf2f('0x2'));var rr=require('rr');var md5=require(_0xaf2f('0x3'));var Redis=require(_0xaf2f('0x4'));var ut=require(_0xaf2f('0x5'));var config=require(_0xaf2f('0x6'));var logger=require(_0xaf2f('0x7'))('dialer');var loggerBooked=require('../../../config/logger')(_0xaf2f('0x8'));var loggerPredictive=require('../../../config/logger')(_0xaf2f('0x9'));var loggerPredictiveCalls=require(_0xaf2f('0x7'))(_0xaf2f('0xa'));var loggerSyncQueueSummary=require(_0xaf2f('0x7'))(_0xaf2f('0xb'));var ami=require('../ami');config['redis']=_['defaults'](config[_0xaf2f('0xc')],{'host':_0xaf2f('0xd'),'port':0x18eb});var io=require(_0xaf2f('0xe'))(new Redis(config[_0xaf2f('0xc')]));var cmHopper=require(_0xaf2f('0xf'));var cmHopperHistory=require(_0xaf2f('0x10'));var cmHopperFinal=require(_0xaf2f('0x11'));var cmHopperAdditionalPhone=require(_0xaf2f('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xaf2f('0x13'));var RpcSetting=require(_0xaf2f('0x14'));var Action=require(_0xaf2f('0x15'));var History=require('./history');var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xaf2f('0x16'));var Hangup=require(_0xaf2f('0x17'));var ipAgi=process['env'][_0xaf2f('0x18')]||_0xaf2f('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0xaf2f('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xaf2f('0x1b')]=function(_0x30905b){this[_0xaf2f('0x1c')]=this[_0xaf2f('0x1c')]?this[_0xaf2f('0x1c')][_0xaf2f('0x1d')](_0x30905b):_0x30905b();};function Dialer(_0x3c09b5,_0x2a5d4a){this[_0xaf2f('0x1e')]=new Sequence();this[_0xaf2f('0x1f')]=_0x2a5d4a;this['voiceQueues']=_0x3c09b5[_0xaf2f('0x20')];this[_0xaf2f('0x21')]=_0x3c09b5['campaigns'];this['agents']=_0x3c09b5[_0xaf2f('0x22')];this[_0xaf2f('0x23')]=_0x3c09b5['trunks'];this[_0xaf2f('0x24')]=config['maxNumberOriginate']||0x2;this[_0xaf2f('0x25')]={};this['actions']={};this[_0xaf2f('0x26')]={};this[_0xaf2f('0x27')]={};this['optionPredictive']={};this[_0xaf2f('0x28')]={};this[_0xaf2f('0x29')]={};this[_0xaf2f('0x2a')]={};this[_0xaf2f('0x2b')]={};this[_0xaf2f('0x2c')]={};ami['on'](_0xaf2f('0x2d'),this[_0xaf2f('0x2e')][_0xaf2f('0x2f')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xaf2f('0x2f')](this));ami['on'](_0xaf2f('0x30'),this[_0xaf2f('0x31')]['bind'](this));ami['on'](_0xaf2f('0x32'),this[_0xaf2f('0x33')][_0xaf2f('0x2f')](this));ami['on'](_0xaf2f('0x34'),this[_0xaf2f('0xb')][_0xaf2f('0x2f')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xaf2f('0x35'),this['syncHangup']['bind'](this));ami['on'](_0xaf2f('0x36'),this[_0xaf2f('0x37')][_0xaf2f('0x2f')](this));ami['on'](_0xaf2f('0x38'),this[_0xaf2f('0x39')]['bind'](this));ami['on'](_0xaf2f('0x3a'),this[_0xaf2f('0x3b')]['bind'](this));ami['on'](_0xaf2f('0x3c'),this[_0xaf2f('0x3d')]['bind'](this));this[_0xaf2f('0x3e')]();this[_0xaf2f('0x3f')]();RpcSetting[_0xaf2f('0x40')]()[_0xaf2f('0x41')](function(_0x5e1680){previewRecallmeReminderInterval=_0x5e1680[_0xaf2f('0x42')];});}function isNotNull(_0x3a34ff){return _0x3a34ff!==null&&!_['isUndefined'](_0x3a34ff);}function checkIsLoggedIn(_0x4e0968,_0xf9c24c){return function(){if(_0xf9c24c<=0x0){_0x4e0968['message']=_0xaf2f('0x43');throw _0x4e0968[_0xaf2f('0x44')]+_0xaf2f('0x45');}};}function isActive(_0x26471){return _0x26471;}function checkIsActive(_0x1b024a,_0x59c713){return function(){if(!isActive(_0x59c713)){_0x1b024a[_0xaf2f('0x46')]='NOT_ACTIVE';throw _0x1b024a['name']+_0xaf2f('0x47');}};}function checkInterval(_0x4367f1){return function(){if(!isNotNull(_0x4367f1['Interval'])){_0x4367f1['message']=_0xaf2f('0x48');throw _0x4367f1[_0xaf2f('0x44')]+_0xaf2f('0x49');}if(!isNotNull(_0x4367f1[_0xaf2f('0x4a')][_0xaf2f('0x4b')])){_0x4367f1['message']=_0xaf2f('0x48');throw _0x4367f1['name']+_0xaf2f('0x49');}if(!isNotNull(_[_0xaf2f('0x4c')](_0x4367f1[_0xaf2f('0x4a')][_0xaf2f('0x4b')]))){_0x4367f1[_0xaf2f('0x46')]=_0xaf2f('0x48');throw _0x4367f1[_0xaf2f('0x44')]+_0xaf2f('0x49');}};}function msgResponse(_0x4c66ad,_0x5db64e,_0x3e3ca6){return{'action':_0x4c66ad,'response':_0x5db64e,'message':_0x3e3ca6,'stack':_0x3e3ca6};}function myreject(_0x587646){return function(_0x1a2eae){return _0x587646(msgResponse('[ifTime][Action]',_0xaf2f('0x4d'),JSON[_0xaf2f('0x4e')](_0x1a2eae)));};}function getSeconds(_0x5e09a7,_0x2c737){var _0x2f91d7=moment(_0x5e09a7)['milliseconds'](0x0);var _0x18f5c8=moment(_0x2c737)[_0xaf2f('0x4f')](0x0);return _0x2f91d7['diff'](_0x18f5c8,_0xaf2f('0x50'));}function emit(_0x47e363,_0x826bea,_0x5a6abc){io['to'](_0x47e363)['emit'](_0x826bea,_0x5a6abc);}function emitVoiceQueueSummary(_0x5817dc){if(_0x5817dc[_0xaf2f('0x51')]===_0xaf2f('0x52')){var _0x4d0253={'id':_0x5817dc['id'],'name':_0x5817dc[_0xaf2f('0x44')],'strategy':_0x5817dc['strategy'],'answered':_0x5817dc['answered'],'available':_0x5817dc[_0xaf2f('0x53')],'loggedIn':_0x5817dc[_0xaf2f('0x54')],'pTalking':_0x5817dc[_0xaf2f('0x55')],'sumBillable':_0x5817dc[_0xaf2f('0x56')],'sumDuration':_0x5817dc[_0xaf2f('0x57')],'sumHoldTime':_0x5817dc[_0xaf2f('0x58')]||0x0,'talking':_0x5817dc[_0xaf2f('0x59')],'total':_0x5817dc[_0xaf2f('0x5a')],'type':_0x5817dc['type'],'unmanaged':_0x5817dc[_0xaf2f('0x5b')],'abandoned':_0x5817dc[_0xaf2f('0x5c')],'waiting':_0x5817dc[_0xaf2f('0x5d')],'loggedInDb':_0x5817dc[_0xaf2f('0x5e')],'dialActive':_0x5817dc[_0xaf2f('0x5f')],'dialMethod':_0x5817dc['dialMethod'],'dialOriginateCallerIdName':_0x5817dc[_0xaf2f('0x60')],'dialOriginateCallerIdNumber':_0x5817dc[_0xaf2f('0x61')],'dialOriginateTimeout':_0x5817dc[_0xaf2f('0x62')],'dialPrefix':_0x5817dc[_0xaf2f('0x63')],'outboundAnswerAgiCallsDay':_0x5817dc[_0xaf2f('0x64')],'outboundAnswerCallsDay':_0x5817dc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5817dc[_0xaf2f('0x65')],'outboundBusyCallsDay':_0x5817dc[_0xaf2f('0x66')],'outboundCongestionCallsDay':_0x5817dc['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5817dc[_0xaf2f('0x67')],'outboundDropCallsDayCallersExit':_0x5817dc['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5817dc[_0xaf2f('0x68')],'outboundNoAnswerCallsDay':_0x5817dc[_0xaf2f('0x69')],'outboundNoSuchCallsDay':_0x5817dc['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5817dc[_0xaf2f('0x6a')],'outboundReCallsDay':_0x5817dc[_0xaf2f('0x6b')],'outboundRejectCallsDay':_0x5817dc[_0xaf2f('0x6c')],'outboundUnknownCallsDay':_0x5817dc[_0xaf2f('0x6d')],'predictiveIntervalAnsweredCalls':_0x5817dc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5817dc['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5817dc[_0xaf2f('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x5817dc[_0xaf2f('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x5817dc[_0xaf2f('0x70')],'predictiveIntervalErlangCalls':_0x5817dc['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5817dc['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5817dc[_0xaf2f('0x71')],'predictiveIntervalMultiplicativeFactor':_0x5817dc['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5817dc[_0xaf2f('0x72')],'predictiveIntervalAvailable':_0x5817dc[_0xaf2f('0x73')],'predictiveIntervalTotalCalls':_0x5817dc['predictiveIntervalTotalCalls'],'message':_0x5817dc[_0xaf2f('0x46')],'originated':_0x5817dc[_0xaf2f('0x74')],'erlangCalls':_0x5817dc[_0xaf2f('0x75')],'erlangCallToSecond':_0x5817dc['erlangCallToSecond'],'erlangAbandonmentRate':_0x5817dc['erlangAbandonmentRate'],'erlangBusyFactor':_0x5817dc[_0xaf2f('0x76')],'startPredictive':_0x5817dc['startPredictive'],'startProgressive':_0x5817dc[_0xaf2f('0x29')]};if(_0x5817dc[_0xaf2f('0x77')]){_0x4d0253['Trunk']={'id':_0x5817dc[_0xaf2f('0x77')]['id'],'name':_0x5817dc[_0xaf2f('0x77')][_0xaf2f('0x44')],'active':_0x5817dc[_0xaf2f('0x77')][_0xaf2f('0x78')],'callerid':_0x5817dc['Trunk']['callerid']};}if(_0x5817dc['Interval']){_0x4d0253[_0xaf2f('0x4a')]={'id':_0x5817dc[_0xaf2f('0x4a')]['id'],'name':_0x5817dc['Interval']['name']};}var _0xe3518=md5(JSON[_0xaf2f('0x4e')](_0x4d0253));if(_0x5817dc[_0xaf2f('0x3')]!==_0xe3518){_0x5817dc[_0xaf2f('0x3')]=_0xe3518;emit(util[_0xaf2f('0x79')](_0xaf2f('0x7a'),_0x4d0253[_0xaf2f('0x44')]),'voice_queue:save',_0x4d0253);}}}function emitCampaignSummary(_0x5dc8f5){if(_0x5dc8f5[_0xaf2f('0x51')]===_0xaf2f('0x7b')){emit(util[_0xaf2f('0x79')](_0xaf2f('0x7c'),_0x5dc8f5['name']),'campaign:save',_0x5dc8f5);}}function checkGetDataPredictive(_0x2c1c3a){if(isNotNull(_0x2c1c3a)&&!_[_0xaf2f('0x4c')](_0x2c1c3a)){loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x7e'));loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x7f'),_0x2c1c3a[_0xaf2f('0x80')]);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x81'),_0x2c1c3a[_0xaf2f('0x82')]);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x83'),_0x2c1c3a[_0xaf2f('0x70')]);loggerPredictive['info'](_0xaf2f('0x84'),_0x2c1c3a[_0xaf2f('0x6f')]);loggerPredictive[_0xaf2f('0x7d')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c1c3a['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x85'),_0x2c1c3a['predictiveIntervalAvgTalktime']);loggerPredictive[_0xaf2f('0x7d')]('---------------------------');if(_0x2c1c3a[_0xaf2f('0x80')]>0x0){if(!_[_0xaf2f('0x86')](_0x2c1c3a[_0xaf2f('0x6e')])&&_0x2c1c3a[_0xaf2f('0x6e')]>0x0){return!![];}loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x87'));if(!_[_0xaf2f('0x86')](_0x2c1c3a['predictiveIntervalAvgHoldtime'])&&_0x2c1c3a[_0xaf2f('0x88')]>0x0){return!![];}loggerPredictive['info'](_0xaf2f('0x89'));}else{loggerPredictive['info'](_0xaf2f('0x8a'));}}else{loggerPredictive[_0xaf2f('0x7d')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x521b84){return function(_0x1beebf){loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x8b'));loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x8c'),_0x1beebf[_0xaf2f('0x75')]);loggerPredictive[_0xaf2f('0x7d')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1beebf['erlangCallToSecond']);loggerPredictive[_0xaf2f('0x7d')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1beebf[_0xaf2f('0x8d')]);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x8e'),_0x1beebf[_0xaf2f('0x76')]);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x8f'),_0x1beebf[_0xaf2f('0x8d')]);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x90'));_[_0xaf2f('0x91')](_0x521b84,_0x1beebf);};}function getDiff(_0x156a5b){var _0x48edbf=moment()[_0xaf2f('0x4f')](0x0);var _0x133660=moment(_0x156a5b)[_0xaf2f('0x4f')](0x0);return _0x48edbf[_0xaf2f('0x92')](_0x133660,_0xaf2f('0x50'));}function ifInterval(_0x49cd0d,_0x18311a){if(_[_0xaf2f('0x86')](_0x18311a)){return![];}return getDiff(_0x18311a)<_0x49cd0d*0x3c;}function freeVariablesPredictive(_0x52121b){if(isNotNull(_0x52121b)){if(!_[_0xaf2f('0x86')](_0x52121b['startProgressive'])){_0x52121b[_0xaf2f('0x29')]=undefined;loggerPredictive['info'](_0x52121b[_0xaf2f('0x44')],_0xaf2f('0x93'));}if(!_[_0xaf2f('0x86')](_0x52121b['startPredictive'])){_0x52121b['startPredictive']=undefined;loggerPredictive[_0xaf2f('0x7d')](_0x52121b[_0xaf2f('0x44')],_0xaf2f('0x94'));}if(!_[_0xaf2f('0x86')](_0x52121b[_0xaf2f('0x95')])){clearInterval(_0x52121b[_0xaf2f('0x95')]);_0x52121b[_0xaf2f('0x95')]=undefined;loggerPredictive[_0xaf2f('0x7d')](_0x52121b['name'],_0xaf2f('0x96'));}}}function erlangb(_0x120d32,_0x53becf){if(_0x53becf===0x0){return 0x0;}var _0x83e10b=0x1;for(var _0x2f3eff=0x1;_0x2f3eff<=_0x53becf;_0x2f3eff+=0x1){_0x83e10b=0x1+_0x83e10b*_0x2f3eff/_0x120d32;}return 0x1/_0x83e10b;}function isVoiceQueueOutbound(_0xd3aafe){return _0xd3aafe===_0xaf2f('0x52');}function isNotPreview(_0x39d4c8){return _0x39d4c8!==_0xaf2f('0x1f');}function isCampaignIvr(_0x571deb){return _0x571deb===_0xaf2f('0x7b');}function getCallerId(_0x2a02e6,_0x37da03,_0x11320e){if(!_['isUndefined'](_0x11320e)&&typeof _0x11320e===_0xaf2f('0x97')&&!_[_0xaf2f('0x4c')](_0x11320e)){if(!_['isUndefined'](_0x37da03)&&typeof _0x37da03===_0xaf2f('0x97')&&!_[_0xaf2f('0x4c')](_0x37da03)){return util[_0xaf2f('0x79')](_0xaf2f('0x98'),_0x37da03,_0x11320e);}return util['format'](_0xaf2f('0x98'),_0x11320e,_0x11320e);}if(!_[_0xaf2f('0x86')](_0x2a02e6)&&typeof _0x2a02e6===_0xaf2f('0x97')&&!_['isEmpty'](_0x2a02e6)){return _0x2a02e6;}return _0xaf2f('0x99');}function loggerCatchQueueSummary(_0x189e3c,_0x5edafd){return function(_0x7b515f){freeVariablesPredictive(_0x5edafd);emitVoiceQueueSummary(_0x5edafd);emitCampaignSummary(_0x5edafd);loggerSyncQueueSummary[_0xaf2f('0x9a')](_0x189e3c,util[_0xaf2f('0x9b')](_0x7b515f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1ce916,_0x160be1){return function(_0x2d12b3){loggerPredictive[_0xaf2f('0x9c')](_0x160be1[_0xaf2f('0x44')],_0x1ce916);loggerPredictive[_0xaf2f('0x9c')](_0x2d12b3[_0xaf2f('0x9d')]);freeVariablesPredictive(_0x160be1);};}function loggerCatch(_0x43609c){return function(_0x3aa62c){logger['error'](_0x43609c,util[_0xaf2f('0x9b')](_0x3aa62c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1945fd){return _0x1945fd&&!_[_0xaf2f('0x86')](_0x1945fd)&&_0x1945fd[_0xaf2f('0x9e')]>0x0;}function decremetOriginate(_0x1ef560){if(!_[_0xaf2f('0x86')](_0x1ef560)&&_0x1ef560!==null){if(typeof _0x1ef560[_0xaf2f('0x74')]!==_0xaf2f('0x9f')){if(_0x1ef560[_0xaf2f('0x74')]>0x0){_0x1ef560[_0xaf2f('0x74')]-=0x1;}else{logger[_0xaf2f('0x9c')](_0xaf2f('0xa0'));}}}else{logger[_0xaf2f('0x9c')](_0xaf2f('0xa1'));}}function checkContactLowerLimitOriginate(_0x4a84d6,_0x4c2a77,_0x566bd2){if(_0x4c2a77>_0x566bd2){for(var _0x3c53d3=0x0;_0x3c53d3<_0x4c2a77-_0x566bd2;_0x3c53d3+=0x1){decremetOriginate(_0x4a84d6);}}}function loggerGetContactDialer(_0x25a06f,_0x40443d,_0x41e72){return function(_0x3ad210){checkContactLowerLimitOriginate(_0x40443d,_0x41e72,0x0);logger[_0xaf2f('0x9c')](_0x25a06f,util[_0xaf2f('0x9b')](_0x3ad210,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x372cb7){return function(_0xab38d8){if(isNotNull(_0xab38d8)&&isNotNull(_0xab38d8[0x0])){if(_0xab38d8[0x0]['contactsRescheduled']>0x0){_0x372cb7[_0xaf2f('0x46')]=_0xaf2f('0xa2');logger['info'](_0xaf2f('0xa3')+_0x372cb7[_0xaf2f('0x44')],_0xab38d8[0x0][_0xaf2f('0xa4')],_0xaf2f('0xa5'));}else{_0x372cb7[_0xaf2f('0x46')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xaf2f('0x7d')](_0xaf2f('0xa6')+_0x372cb7[_0xaf2f('0x44')]);}}};}function notSendMessagesQueue(_0x5b060b){if(_0x5b060b[_0xaf2f('0xa7')]){freeVariablesPredictive(_0x5b060b);if(_0x5b060b['originated']===0x0&&_0x5b060b['talking']===0x0&&_0x5b060b['waiting']===0x0&&(_0x5b060b[_0xaf2f('0x55')]||0x0)===0x0){_0x5b060b[_0xaf2f('0xa7')]=![];_0x5b060b[_0xaf2f('0x53')]=0x0;_0x5b060b[_0xaf2f('0x46')]=_0xaf2f('0xa8');loggerSyncQueueSummary[_0xaf2f('0x9a')](_0xaf2f('0xa9'),_0x5b060b[_0xaf2f('0x44')],'is\x20not\x20active');}else{_0x5b060b[_0xaf2f('0x46')]=_0xaf2f('0xaa');loggerSyncQueueSummary['debug'](_0xaf2f('0xa9'),_0x5b060b[_0xaf2f('0x44')],_0xaf2f('0xab'));}emitVoiceQueueSummary(_0x5b060b);}}function notSendMessagesCampaign(_0x26bf98){if(_0x26bf98[_0xaf2f('0xa7')]){if(_0x26bf98[_0xaf2f('0x74')]===0x0){_0x26bf98[_0xaf2f('0xa7')]=![];_0x26bf98[_0xaf2f('0x46')]=_0xaf2f('0xa8');loggerSyncQueueSummary[_0xaf2f('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x26bf98[_0xaf2f('0x44')],'is\x20not\x20active');}else{_0x26bf98[_0xaf2f('0x46')]=_0xaf2f('0xaa');loggerSyncQueueSummary[_0xaf2f('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x26bf98[_0xaf2f('0x44')],_0xaf2f('0xab'));}emitCampaignSummary(_0x26bf98);}}function createObjHistory(_0x14406b,_0x5633a4,_0x738f41,_0x18cfce,_0x257809){_0x14406b[_0xaf2f('0x46')]=_0x738f41;var _0x4d30c6=new Action(_0x14406b,_0x5633a4);var _0x593c97=new History(_0x4d30c6);_0x593c97[_0xaf2f('0xac')]=_0x18cfce;_0x593c97['statedesc']=_0x257809;_0x593c97[_0xaf2f('0xad')]=_0x4d30c6[_0xaf2f('0xae')];return _0x593c97;}Dialer['prototype'][_0xaf2f('0x3f')]=function(){var _0x13c4ba=this;setInterval(function(){_0x13c4ba[_0xaf2f('0xaf')](_0x13c4ba[_0xaf2f('0x27')],_0xaf2f('0xb0'));_0x13c4ba[_0xaf2f('0xaf')](_0x13c4ba['actions'],_0xaf2f('0xb1'));},0x32c8);};Dialer['prototype'][_0xaf2f('0xaf')]=function(_0x27989d,_0x558695){var _0x3b9245=this;for(var _0x22b17f in _0x27989d){if(typeof _0x27989d[_0x22b17f]!==_0xaf2f('0x9f')){this[_0xaf2f('0x1e')][_0xaf2f('0x1b')](function(){if(!_[_0xaf2f('0xb2')](_0x27989d[_0x22b17f])){return ami['Action']({'action':_0xaf2f('0xb3'),'channel':_0x27989d[_0x22b17f][_0xaf2f('0xb4')]})['catch'](function(_0x1d3807){if(_0x1d3807[_0xaf2f('0x46')]===_0xaf2f('0xb5')){setTimeout(function(){if(_0x27989d[_0x22b17f]&&_0x27989d[_0x22b17f][_0xaf2f('0x51')]!==_0xaf2f('0x7b')){_0x3b9245[_0xaf2f('0xb6')](_0x3b9245[_0xaf2f('0x20')][_0x27989d[_0x22b17f][_0xaf2f('0xb7')]]);logger[_0xaf2f('0x9c')]('[Dialer][checkChannel]',_0x558695,_0x22b17f,_0x27989d[_0x22b17f]['queue']);delete _0x27989d[_0x22b17f];}if(_0x27989d[_0x22b17f]&&_0x27989d[_0x22b17f]['type']===_0xaf2f('0x7b')){_0x3b9245['updateOriginated'](_0x3b9245[_0xaf2f('0x21')][_0x27989d[_0x22b17f][_0xaf2f('0xb7')]]);logger[_0xaf2f('0x9c')]('[Dialer][checkChannel][ivr]',_0x558695,_0x22b17f,_0x27989d[_0x22b17f]['queue']);delete _0x27989d[_0x22b17f];}},0x2328);}});}});}}};Dialer[_0xaf2f('0xb8')]['countReScheduled']=function(_0x34d1b7){return BPromise[_0xaf2f('0xb9')]()['then'](cmHopper['countReScheduled'](_0x34d1b7))[_0xaf2f('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xbb')]=function(_0x2dba3f){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopperBlack[_0xaf2f('0xbb')](_0x2dba3f))[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0xbc')));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xbd')]=function(_0x440f12,_0x1e8c3a,_0x3cdf50){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopperAdditionalPhone[_0xaf2f('0xbd')](_0x440f12,_0x1e8c3a,_0x3cdf50))[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0xbe')));};Dialer[_0xaf2f('0xb8')]['swapAdditionalPhones']=function(_0x174a5e,_0x241260,_0x22146f){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopperAdditionalPhone[_0xaf2f('0xbf')](_0x174a5e,_0x241260,_0x22146f))[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0xc0')));};Dialer[_0xaf2f('0xb8')]['checkIsBlackListIvr']=function(_0x2aad30){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopperBlack[_0xaf2f('0xc1')](_0x2aad30))['catch'](loggerCatch(_0xaf2f('0xc2')));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xc3')]=function(_0x56e9ab){return BPromise[_0xaf2f('0xb9')]()['then'](cmHopperHistory[_0xaf2f('0xc4')](_0x56e9ab))[_0xaf2f('0xba')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xc5')]=function(_0x395159){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopper[_0xaf2f('0xc5')](_0x395159))[_0xaf2f('0xba')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xc6')]=function(_0x47fd87,_0x37e8bc,_0x5af316){return BPromise['resolve']()[_0xaf2f('0x41')](cmHopper[_0xaf2f('0xc6')](_0x47fd87,_0x37e8bc,_0x5af316))[_0xaf2f('0xba')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xc7')]=function(_0x376a62,_0x13a523,_0x29cf9f,_0x307278,_0xbc2bee){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopper[_0xaf2f('0xc7')](_0x376a62,_0x13a523,_0x29cf9f,_0x307278))['catch'](function(_0x3e7b4d){_0xbc2bee['temp']-=_0x29cf9f;_0xbc2bee['temp']=_0xbc2bee['temp']>0x0?_0xbc2bee[_0xaf2f('0xc8')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x3e7b4d);});};Dialer[_0xaf2f('0xb8')]['getContactDialerIvr']=function(_0x51f6e3,_0x5ad71b,_0x3d2b57,_0xcf7092){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopper[_0xaf2f('0xc9')](_0x51f6e3,_0x5ad71b,_0x3d2b57))[_0xaf2f('0xba')](function(_0x33fd1b){_0xcf7092[_0xaf2f('0xc8')]-=_0x5ad71b;_0xcf7092[_0xaf2f('0xc8')]=_0xcf7092[_0xaf2f('0xc8')]>0x0?_0xcf7092[_0xaf2f('0xc8')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x33fd1b);});};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xca')]=function(_0x3a4bb1){return BPromise['resolve']()[_0xaf2f('0x41')](voiceQueueRt[_0xaf2f('0xca')](_0x3a4bb1))['catch'](loggerCatch(_0xaf2f('0xcb')));};Dialer['prototype'][_0xaf2f('0xcc')]=function(_0x235f27){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopper[_0xaf2f('0xcc')](_0x235f27))[_0xaf2f('0xba')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xaf2f('0xb8')]['createHistory']=function(_0x5da6ca){return BPromise[_0xaf2f('0xb9')]()[_0xaf2f('0x41')](cmHopperHistory[_0xaf2f('0xcd')](_0x5da6ca))[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0xce')));};Dialer[_0xaf2f('0xb8')]['updateOriginated']=function(_0x24ee99){if(!_['isUndefined'](_0x24ee99)&&_0x24ee99!==null){if(typeof _0x24ee99[_0xaf2f('0x74')]!==_0xaf2f('0x9f')){if(_0x24ee99[_0xaf2f('0x74')]>0x0){_0x24ee99[_0xaf2f('0x74')]-=0x1;}else{logger['error'](_0xaf2f('0xcf'));}}}else{logger['error'](_0xaf2f('0xd0'));}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xd1')]=function(_0x2ad678,_0xa9c926){var _0x765fbb=this;return function(_0x5ce996){_0x765fbb['updateOriginated'](_0xa9c926);logger['error'](_0x2ad678,util[_0xaf2f('0x9b')](_0x5ce996,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x5328cc,_0x1e0da,_0x3e0567){var _0x209fff={'state':0x19,'statedesc':_0xaf2f('0xd2')};this[_0xaf2f('0xb6')](_0x1e0da);this[_0xaf2f('0xd3')](_['merge'](_0x209fff,_[_0xaf2f('0xd4')](_0x3e0567,[_0xaf2f('0xd5'),_0xaf2f('0xd6'),'UserId',_0xaf2f('0xd7'),_0xaf2f('0xd8')])),_0xaf2f('0xd9'),'[emptyContact]');logger['error'](_0x5328cc);};Dialer['prototype'][_0xaf2f('0xda')]=function(_0x3e0773){return _0x3e0773===_0xaf2f('0xdb');};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xdc')]=function(_0x4a7ad6){return!_[_0xaf2f('0x86')](_0x4a7ad6)&&_0x4a7ad6&&!_[_0xaf2f('0x86')](_0x4a7ad6['name'])&&!_[_0xaf2f('0x86')](_0x4a7ad6[_0xaf2f('0x78')])&&_0x4a7ad6[_0xaf2f('0x78')]&&(this['trunks'][util[_0xaf2f('0x79')](_0xaf2f('0xdd'),_0x4a7ad6[_0xaf2f('0x44')])][_0xaf2f('0xb3')]==='reachable'||this[_0xaf2f('0x23')][util[_0xaf2f('0x79')]('SIP/%s',_0x4a7ad6[_0xaf2f('0x44')])][_0xaf2f('0xb3')]===_0xaf2f('0xde'));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xd3')]=function(_0x47ac13,_0x3681dd,_0x5348d3){this[_0xaf2f('0xcd')](_0x47ac13)['catch'](loggerCatch(_0x3681dd));this[_0xaf2f('0xcc')](_0x47ac13)[_0xaf2f('0xba')](loggerCatch(_0x5348d3));};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x39')]=function(_0x10ca27){var _0x500899=this[_0xaf2f('0x27')][_0x10ca27[_0xaf2f('0xdf')]];var _0x3e3d43;if(!_[_0xaf2f('0xb2')](_0x10ca27)&&!_[_0xaf2f('0xb2')](_0x10ca27[_0xaf2f('0xe0')])&&!_[_0xaf2f('0xb2')](_0x10ca27[_0xaf2f('0xe0')][_0xaf2f('0xe1')])&&_0x10ca27['exten']===_0xaf2f('0xe2')&&_0x500899){if(_0x500899[_0xaf2f('0x51')]!==_0xaf2f('0x7b')&&this[_0xaf2f('0x20')][_0x500899[_0xaf2f('0xb7')]][_0xaf2f('0xe3')]&&_0x10ca27[_0xaf2f('0xe4')]===_0xaf2f('0xe5')){delete this[_0xaf2f('0x27')][_0x10ca27[_0xaf2f('0xdf')]];this[_0xaf2f('0xb6')](this['voiceQueues'][_0x500899[_0xaf2f('0xb7')]]);this['voiceQueues'][_0x500899[_0xaf2f('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0xaf2f('0x20')][_0x500899[_0xaf2f('0xb7')]][_0xaf2f('0x64')]+=0x1;_0x3e3d43=new Hangup(_0x500899,_0x10ca27);_0x3e3d43[_0xaf2f('0xac')]=0x12;_0x3e3d43[_0xaf2f('0xe6')]=_0xaf2f('0xe7');_0x3e3d43[_0xaf2f('0xe8')]='AMD';ami[_0xaf2f('0xe9')](_0xaf2f('0xea'),ut[_0xaf2f('0xeb')](_0x3e3d43,_0xaf2f('0xec')));this[_0xaf2f('0xd3')](_0x3e3d43,_0xaf2f('0xed'),_0xaf2f('0xee'));}if(_0x500899['type']!==_0xaf2f('0x7b')&&this[_0xaf2f('0x20')][_0x500899[_0xaf2f('0xb7')]][_0xaf2f('0xe3')]&&_0x10ca27[_0xaf2f('0xe4')]===_0xaf2f('0xef')){var _0x49a4f2=this;return new BPromise(function(_0x2c674d,_0x4731d1){delete _0x49a4f2[_0xaf2f('0x27')][_0x10ca27[_0xaf2f('0xdf')]];_0x49a4f2[_0xaf2f('0xb6')](_0x49a4f2[_0xaf2f('0x20')][_0x500899[_0xaf2f('0xb7')]]);_0x49a4f2['voiceQueues'][_0x500899[_0xaf2f('0xb7')]][_0xaf2f('0xf0')]+=0x1;_0x49a4f2['voiceQueues'][_0x500899[_0xaf2f('0xb7')]][_0xaf2f('0x64')]+=0x1;var _0x46e1ce=_0x49a4f2[_0xaf2f('0x20')][_0x500899[_0xaf2f('0xb7')]];var _0x379fb6=new Hangup(_0x500899,_0x10ca27);_0x379fb6[_0xaf2f('0xac')]=0x13;_0x379fb6[_0xaf2f('0xe6')]=_0xaf2f('0xf1');_0x379fb6[_0xaf2f('0xe8')]=_0xaf2f('0xf2');_0x379fb6[_0xaf2f('0xf3')]+=0x1;_0x379fb6['countglobal']+=0x1;_0x379fb6['amd']=!![];ami[_0xaf2f('0xe9')](_0xaf2f('0xea'),ut[_0xaf2f('0xeb')](_0x379fb6,_0xaf2f('0xec')));_0x49a4f2[_0xaf2f('0xcd')](_0x379fb6)['catch'](loggerCatch(_0xaf2f('0xf4')));if(_0x379fb6['countbusyretry']+_0x379fb6[_0xaf2f('0xf5')]+_0x379fb6[_0xaf2f('0xf6')]+_0x379fb6[_0xaf2f('0xf7')]+_0x379fb6['countdropretry']+_0x379fb6['countabandonedretry']+_0x379fb6[_0xaf2f('0xf3')]+_0x379fb6[_0xaf2f('0xf8')]>=_0x46e1ce[_0xaf2f('0xf9')]){_0x49a4f2[_0xaf2f('0xfa')](_0x379fb6,_0x2c674d,_0x4731d1,_0xaf2f('0xfb'));}else{if(_0x379fb6['countmachineretry']>=_0x46e1ce[_0xaf2f('0xfc')]){_0x49a4f2['createStateFinal'](_0x379fb6,_0x2c674d,_0x4731d1,_0xaf2f('0xfd'));}else{_0x49a4f2[_0xaf2f('0xc5')]({'active':![],'countmachineretry':_0x379fb6[_0xaf2f('0xf3')],'scheduledat':moment()[_0xaf2f('0xfe')](_0x46e1ce[_0xaf2f('0xff')],'minutes')[_0xaf2f('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x379fb6[_0xaf2f('0xd5')],'ListId':_0x379fb6[_0xaf2f('0xd6')],'VoiceQueueId':_0x379fb6[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x379fb6['CampaignId']||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x100')));_0x2c674d({'reschedule':0x1});}}});}if(_0x500899[_0xaf2f('0x51')]==='ivr'&&this[_0xaf2f('0x21')][_0x500899['queue']][_0xaf2f('0xe3')]&&_0x10ca27[_0xaf2f('0xe4')]===_0xaf2f('0xe5')){delete this[_0xaf2f('0x27')][_0x10ca27[_0xaf2f('0xdf')]];this[_0xaf2f('0xb6')](this['campaigns'][_0x500899[_0xaf2f('0xb7')]]);_0x3e3d43=new Hangup(_0x500899,_0x10ca27);_0x3e3d43[_0xaf2f('0xac')]=0x12;_0x3e3d43['statedesc']=_0xaf2f('0xe7');_0x3e3d43['membername']=_0xaf2f('0xf2');ami['emit'](_0xaf2f('0xea'),ut[_0xaf2f('0xeb')](_0x3e3d43,_0xaf2f('0xec')));this[_0xaf2f('0xd3')](_0x3e3d43,_0xaf2f('0x101'),'[syncHangupInAMDIvr]');}if(_0x500899[_0xaf2f('0x51')]===_0xaf2f('0x7b')&&this[_0xaf2f('0x21')][_0x500899['queue']]['dialAMDActive']&&_0x10ca27['value']===_0xaf2f('0xef')){var _0x49a4f2=this;return new BPromise(function(_0x4f342e,_0x4a06a8){delete _0x49a4f2[_0xaf2f('0x27')][_0x10ca27[_0xaf2f('0xdf')]];_0x49a4f2[_0xaf2f('0xb6')](_0x49a4f2[_0xaf2f('0x21')][_0x500899[_0xaf2f('0xb7')]]);_0x49a4f2['campaigns'][_0x500899['queue']][_0xaf2f('0xf0')]+=0x1;_0x49a4f2[_0xaf2f('0x21')][_0x500899[_0xaf2f('0xb7')]][_0xaf2f('0x64')]+=0x1;var _0x162bfe=_0x49a4f2[_0xaf2f('0x21')][_0x500899['queue']];var _0x123b4a=new Hangup(_0x500899,_0x10ca27);_0x123b4a[_0xaf2f('0xac')]=0x13;_0x123b4a[_0xaf2f('0xe6')]=_0xaf2f('0xf1');_0x123b4a['membername']=_0xaf2f('0xf2');_0x123b4a[_0xaf2f('0xf3')]+=0x1;_0x123b4a['countglobal']+=0x1;_0x123b4a[_0xaf2f('0xec')]=!![];ami['emit'](_0xaf2f('0xea'),ut['buildObj'](_0x123b4a,_0xaf2f('0xec')));_0x49a4f2[_0xaf2f('0xcd')](_0x123b4a)[_0xaf2f('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x123b4a[_0xaf2f('0x102')]+_0x123b4a[_0xaf2f('0xf5')]+_0x123b4a[_0xaf2f('0xf6')]+_0x123b4a[_0xaf2f('0xf7')]+_0x123b4a[_0xaf2f('0x103')]+_0x123b4a[_0xaf2f('0x104')]+_0x123b4a[_0xaf2f('0xf3')]+_0x123b4a[_0xaf2f('0xf8')]>=_0x162bfe[_0xaf2f('0xf9')]){_0x49a4f2[_0xaf2f('0xfa')](_0x123b4a,_0x4f342e,_0x4a06a8,_0xaf2f('0xfb'));}else{if(_0x123b4a[_0xaf2f('0xf3')]>=_0x162bfe[_0xaf2f('0xfc')]){_0x49a4f2['createStateFinal'](_0x123b4a,_0x4f342e,_0x4a06a8,'reason\x2019\x20machine....');}else{_0x49a4f2[_0xaf2f('0xc5')]({'active':![],'countmachineretry':_0x123b4a[_0xaf2f('0xf3')],'scheduledat':moment()[_0xaf2f('0xfe')](_0x162bfe[_0xaf2f('0xff')],_0xaf2f('0x105'))[_0xaf2f('0x79')](_0xaf2f('0x106')),'ContactId':_0x123b4a[_0xaf2f('0xd5')],'ListId':_0x123b4a[_0xaf2f('0xd6')],'VoiceQueueId':_0x123b4a['VoiceQueueId']||undefined,'CampaignId':_0x123b4a[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x100')));_0x4f342e({'reschedule':0x1});}}});}}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x107')]=function(_0x2417df){var _0xbdbfce=this[_0xaf2f('0x27')][_0x2417df[_0xaf2f('0xdf')]];var _0xb6f57e=this;var _0x922f5d;if(_0xbdbfce&&_0xbdbfce[_0xaf2f('0x51')]===_0xaf2f('0x7b')){delete this[_0xaf2f('0x27')][_0x2417df[_0xaf2f('0xdf')]];this[_0xaf2f('0xb6')](this['campaigns'][_0xbdbfce[_0xaf2f('0xb7')]]);this['campaigns'][_0xbdbfce[_0xaf2f('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x922f5d=new Hangup(_0xbdbfce,_0x2417df);this[_0xaf2f('0xcd')](_0x922f5d)['catch'](loggerCatch(_0xaf2f('0x108')));this[_0xaf2f('0xcc')](_0x922f5d)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x109')));}if(_0xbdbfce&&_0xbdbfce[_0xaf2f('0x51')]!=='ivr'&&isNotNull(this[_0xaf2f('0x20')][_0xbdbfce[_0xaf2f('0xb7')]][_0xaf2f('0x10a')])){delete this[_0xaf2f('0x27')][_0x2417df[_0xaf2f('0xdf')]];this[_0xaf2f('0xb6')](this[_0xaf2f('0x20')][_0xbdbfce[_0xaf2f('0xb7')]]);this[_0xaf2f('0x20')][_0xbdbfce['queue']][_0xaf2f('0xf0')]+=0x1;this[_0xaf2f('0x20')][_0xbdbfce['queue']][_0xaf2f('0x64')]+=0x1;_0x922f5d=new Hangup(_0xbdbfce,_0x2417df);_0x922f5d[_0xaf2f('0xac')]=0x10;_0x922f5d[_0xaf2f('0xe6')]='AnswerAGI';_0x922f5d[_0xaf2f('0xe8')]=_0xaf2f('0x10b');this[_0xaf2f('0xcd')](_0x922f5d)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x108')));this['moveContactManagedDialer'](_0x922f5d)[_0xaf2f('0xba')](loggerCatch('[syncHangupIvr]'));}if(_0xbdbfce&&_0xbdbfce[_0xaf2f('0x51')]!==_0xaf2f('0x7b')&&!isNotNull(this['voiceQueues'][_0xbdbfce[_0xaf2f('0xb7')]][_0xaf2f('0x10a')])){delete this[_0xaf2f('0x27')][_0x2417df[_0xaf2f('0xdf')]];this[_0xaf2f('0xb6')](this[_0xaf2f('0x20')][_0xbdbfce[_0xaf2f('0xb7')]]);this[_0xaf2f('0x20')][_0xbdbfce[_0xaf2f('0xb7')]][_0xaf2f('0x6d')]+=0x1;_0x922f5d=new Hangup(_0xbdbfce,_0x2417df);_0x922f5d['state']=0xc;_0x922f5d[_0xaf2f('0xe6')]=_0x2417df[_0xaf2f('0x10c')];_0x922f5d['membername']=_0xaf2f('0x10d');this['createHistory'](_0x922f5d)[_0xaf2f('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xaf2f('0xcc')](_0x922f5d)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x109')));}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x33')]=function(_0x3e6e30){var _0x862bde=this[_0xaf2f('0x27')][_0x3e6e30[_0xaf2f('0xdf')]];var _0x2c3e0d=this;if(this[_0xaf2f('0x20')][_0x3e6e30[_0xaf2f('0xb7')]]){if(_0x862bde&&_0x862bde[_0xaf2f('0x51')]!==_0xaf2f('0x7b')){delete this['uniqueId'][_0x3e6e30[_0xaf2f('0xdf')]];this[_0xaf2f('0x20')][_0x3e6e30[_0xaf2f('0xb7')]][_0xaf2f('0xf0')]+=0x1;var _0xbeeb7b=new AgentComplete(_0x862bde,_0x3e6e30);if(_0x3e6e30[_0xaf2f('0x10e')]==='agent'){_0xbeeb7b[_0xaf2f('0x10f')]=this['voiceQueues'][_0x3e6e30[_0xaf2f('0xb7')]]['dialQueueProject2']&&this[_0xaf2f('0x20')][_0x3e6e30['queue']][_0xaf2f('0x110')]?moment()['format'](_0xaf2f('0x106')):undefined;}this[_0xaf2f('0xcd')](_0xbeeb7b)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x111')));this['moveContactManagedDialer'](_0xbeeb7b)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x112')));}}};Dialer[_0xaf2f('0xb8')]['syncAgentConnect']=function(_0x4f82dd){if(this[_0xaf2f('0x20')][_0x4f82dd[_0xaf2f('0xb7')]]){if(this['uniqueId'][_0x4f82dd[_0xaf2f('0xdf')]]&&this['uniqueId'][_0x4f82dd[_0xaf2f('0xdf')]][_0xaf2f('0x51')]!=='ivr'){this[_0xaf2f('0xb6')](this['voiceQueues'][_0x4f82dd[_0xaf2f('0xb7')]]);this[_0xaf2f('0x27')][_0x4f82dd['uniqueid']]['answertime']=moment()[_0xaf2f('0x79')](_0xaf2f('0x106'));}}};Dialer[_0xaf2f('0xb8')]['queueCallerAbandonCreateState']=function(_0x5467b3,_0x3316f5){this['createHistory'](_0x5467b3)['catch'](loggerCatch(_0xaf2f('0x111')));if(_0x3316f5==0x0){this[_0xaf2f('0xcc')](_0x5467b3)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x113')));}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x114')]=function(_0x53cec1){var _0x5bb6c7=this[_0xaf2f('0x27')][_0x53cec1[_0xaf2f('0xdf')]];var _0x29a01c=this;var _0x1941d6=![];var _0x4ea18f;var _0x1a7969;if(this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]]){if(_0x5bb6c7&&_0x5bb6c7[_0xaf2f('0x51')]!=='ivr'){delete this['uniqueId'][_0x53cec1[_0xaf2f('0xdf')]];this[_0xaf2f('0xb6')](this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]]);_0x5bb6c7[_0xaf2f('0x115')]=moment()[_0xaf2f('0x79')](_0xaf2f('0x106'));var _0x57e38e=new QueueCallerAbandon(_0x5bb6c7,_0x53cec1);if(getSeconds(_0x5bb6c7[_0xaf2f('0x115')],_0x5bb6c7[_0xaf2f('0x116')])>=_0x5bb6c7['dialQueueTimeout']){this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x70')]+=0x1;this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x68')]+=0x1;this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x117')]+=0x1;_0x57e38e[_0xaf2f('0xac')]=0xa;_0x57e38e[_0xaf2f('0xe6')]='Drop';_0x57e38e[_0xaf2f('0x118')]=_0xaf2f('0x119');_0x57e38e['agiafterat']=this[_0xaf2f('0x20')][_0x53cec1['queue']][_0xaf2f('0x11a')]?moment()[_0xaf2f('0x79')](_0xaf2f('0x106')):undefined;_0x57e38e[_0xaf2f('0x103')]+=0x1;_0x57e38e['countglobal']+=0x1;_0x4ea18f=this['voiceQueues'][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x11b')];_0x1a7969=this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x11c')];_0x29a01c[_0xaf2f('0xbd')](_0x57e38e,_0x57e38e['state'],_0x5bb6c7['voiceQueue'])[_0xaf2f('0x41')](function(_0x4d5e9a){_0x1941d6=_0x4d5e9a[_0xaf2f('0x11d')]==0x1;if(_0x57e38e[_0xaf2f('0x103')]>=_0x29a01c[_0xaf2f('0x20')][_0x53cec1['queue']][_0xaf2f('0x11e')]){_0x29a01c[_0xaf2f('0x11f')](_0x57e38e,_0x4d5e9a[_0xaf2f('0x11d')]);}else{_0x29a01c[_0xaf2f('0xc5')]({'active':![],'countdropretry':_0x57e38e['countdropretry'],'scheduledat':moment()[_0xaf2f('0xfe')](_0x29a01c[_0xaf2f('0x20')][_0x53cec1['queue']][_0xaf2f('0x11b')],_0xaf2f('0x105'))['format'](_0xaf2f('0x106')),'ContactId':_0x5bb6c7[_0xaf2f('0xd5')],'ListId':_0x5bb6c7['ListId'],'VoiceQueueId':_0x5bb6c7[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x5bb6c7[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch('[rescheduleContact][Drop]'));var _0x2402d2=new History(_0x57e38e);_0x2402d2[_0xaf2f('0xac')]=0xa;_0x2402d2['statedesc']=_0xaf2f('0x120');_0x2402d2[_0xaf2f('0xae')]=moment()[_0xaf2f('0x79')](_0xaf2f('0x106'));_0x2402d2[_0xaf2f('0xad')]=_0x2402d2['starttime'];_0x2402d2[_0xaf2f('0x121')]=_0x57e38e[_0xaf2f('0x121')];_0x2402d2[_0xaf2f('0x122')]=_0x57e38e[_0xaf2f('0x122')];_0x29a01c[_0xaf2f('0xcd')](_0x2402d2)[_0xaf2f('0xba')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(_0x27ce8a){if(_0x1941d6)_0x29a01c[_0xaf2f('0xbf')](_0x57e38e,_0x4ea18f,_0x1a7969)[_0xaf2f('0x41')](function(_0x545885){return 0x1;});});}else{this[_0xaf2f('0x20')][_0x53cec1['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x123')]+=0x1;_0x57e38e['state']=0xb;_0x57e38e[_0xaf2f('0xe6')]=_0xaf2f('0x124');_0x57e38e[_0xaf2f('0x118')]=_0xaf2f('0x125');_0x57e38e[_0xaf2f('0x104')]+=0x1;_0x57e38e[_0xaf2f('0x126')]+=0x1;_0x4ea18f=this['voiceQueues'][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x127')];_0x1a7969=this[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x11c')];_0x29a01c['verifyAdditionalPhones'](_0x57e38e,_0x57e38e['state'],_0x5bb6c7['voiceQueue'])[_0xaf2f('0x41')](function(_0x2be473){if(_0x57e38e[_0xaf2f('0x104')]>=_0x29a01c[_0xaf2f('0x20')][_0x53cec1[_0xaf2f('0xb7')]]['dialAbandonedMaxRetry']){_0x29a01c[_0xaf2f('0x11f')](_0x57e38e,_0x2be473[_0xaf2f('0x11d')]);}else{_0x29a01c[_0xaf2f('0xc5')]({'active':![],'countabandonedretry':_0x57e38e[_0xaf2f('0x104')],'scheduledat':moment()[_0xaf2f('0xfe')](_0x29a01c['voiceQueues'][_0x53cec1[_0xaf2f('0xb7')]][_0xaf2f('0x127')],_0xaf2f('0x105'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5bb6c7[_0xaf2f('0xd5')],'ListId':_0x5bb6c7[_0xaf2f('0xd6')],'VoiceQueueId':_0x5bb6c7[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x5bb6c7['CampaignId']||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x128')));var _0x45c540=new History(_0x57e38e);_0x45c540[_0xaf2f('0xac')]=0xb;_0x45c540['statedesc']=_0xaf2f('0x124');_0x45c540[_0xaf2f('0xae')]=moment()[_0xaf2f('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x45c540[_0xaf2f('0xad')]=_0x45c540[_0xaf2f('0xae')];_0x45c540[_0xaf2f('0x121')]=_0x57e38e['calleridname'];_0x45c540[_0xaf2f('0x122')]=_0x57e38e[_0xaf2f('0x122')];_0x29a01c[_0xaf2f('0xcd')](_0x45c540)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x129')));}})['then'](function(_0xa2f6f7){if(_0x1941d6)_0x29a01c[_0xaf2f('0xbf')](_0x57e38e,_0x4ea18f,_0x1a7969)[_0xaf2f('0x41')](function(_0x452afb){return 0x1;});});}}}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x37')]=function(_0x49ff1c){if(this[_0xaf2f('0x12a')][_0x49ff1c['uniqueid']]){this[_0xaf2f('0x12a')][_0x49ff1c['uniqueid']]['channel']=_0x49ff1c[_0xaf2f('0xb4')];}if(this[_0xaf2f('0x27')][_0x49ff1c[_0xaf2f('0xdf')]]){this[_0xaf2f('0x27')][_0x49ff1c['uniqueid']][_0xaf2f('0xb4')]=_0x49ff1c['channel'];}};Dialer[_0xaf2f('0xb8')]['syncQueueMember']=function(_0x17c747){if(strategy[this[_0xaf2f('0x20')][this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]][_0xaf2f('0x12c')]]===_0xaf2f('0x1a')){if(this[_0xaf2f('0x12a')][_0x17c747['actionid']]&&_[_0xaf2f('0xb2')](this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]][_0xaf2f('0x12d')])&&_0x17c747[_0xaf2f('0xb3')]==='1'&&_0x17c747[_0xaf2f('0x12e')]==='0'){if(this[_0xaf2f('0x22')][_0x17c747['stateinterface']]){if(!this[_0xaf2f('0x22')][_0x17c747['stateinterface']][_0xaf2f('0x12d')]){this[_0xaf2f('0x22')][_0x17c747[_0xaf2f('0x12f')]][_0xaf2f('0x12d')]=!![];this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]][_0xaf2f('0x12d')]=!![];this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]]['stateinterface']=_0x17c747[_0xaf2f('0x12f')];}}}}else if((strategy[this[_0xaf2f('0x20')][this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]][_0xaf2f('0x12c')]]||'rrmemory')==='rrmemory'){if(this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]]){if(this[_0xaf2f('0x22')][_0x17c747[_0xaf2f('0x12f')]]){this['actions'][_0x17c747['actionid']]['stateinterface']=_0x17c747[_0xaf2f('0x12f')];if(_['isNil'](this[_0xaf2f('0x2b')][this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]])){this[_0xaf2f('0x2b')][this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]]['queue']]=[];}this[_0xaf2f('0x2b')][this['actions'][_0x17c747[_0xaf2f('0x12b')]]['queue']][_0xaf2f('0x130')](_[_0xaf2f('0x91')](_[_0xaf2f('0xd4')](this[_0xaf2f('0x12a')][_0x17c747[_0xaf2f('0x12b')]],[_0xaf2f('0x131'),_0xaf2f('0x12f')]),{'status':_0x17c747[_0xaf2f('0xb3')],'paused':_0x17c747[_0xaf2f('0x12e')]}));}}}};function unlockQueueStatus(_0x4adc99,_0x366bc8){setTimeout(function(){if(_[_0xaf2f('0x86')](_0x4adc99[_0xaf2f('0x132')])){loggerBooked[_0xaf2f('0x9c')](_0xaf2f('0x133'),_0x366bc8);}_0x4adc99['queueStatusComplete']=!![];loggerBooked['info'](_0xaf2f('0x134'),_0x366bc8,JSON[_0xaf2f('0x4e')](_[_0xaf2f('0xd4')](_0x4adc99,[_0xaf2f('0x44'),_0xaf2f('0x132')])));},0x1f3);}Dialer[_0xaf2f('0xb8')][_0xaf2f('0x3d')]=function(_0xe17296){var _0x4da554=this;var _0xc5b69=_0x4da554[_0xaf2f('0x20')][_0x4da554[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]];if(strategy[this[_0xaf2f('0x20')][this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]][_0xaf2f('0x12c')]]===_0xaf2f('0x1a')){if(this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]]&&this[_0xaf2f('0x12a')][_0xe17296['actionid']][_0xaf2f('0x12f')]){this[_0xaf2f('0x1f')][_0xaf2f('0x135')](this['actions'][_0xe17296['actionid']][_0xaf2f('0x131')],this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0x12f')])['catch'](function(_0x21ba35){logger[_0xaf2f('0x9c')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xaf2f('0x9b')](_0x21ba35,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4da554[_0xaf2f('0xb6')](_0x4da554[_0xaf2f('0x20')][_0x4da554[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]]);_0x4da554[_0xaf2f('0x22')][_0x4da554[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]]['stateinterface']][_0xaf2f('0x12d')]=![];delete _0x4da554['actions'][_0xe17296[_0xaf2f('0x12b')]];unlockQueueStatus(_0xc5b69);});}else{this[_0xaf2f('0xb6')](this[_0xaf2f('0x20')][this['actions'][_0xe17296[_0xaf2f('0x12b')]]['queue']]);this[_0xaf2f('0xc5')]({'active':![],'ContactId':this['actions'][_0xe17296[_0xaf2f('0x12b')]]['ContactId'],'ListId':this['actions'][_0xe17296[_0xaf2f('0x12b')]]['ListId'],'VoiceQueueId':this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xd7')]||undefined,'CampaignId':this['actions'][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]];unlockQueueStatus(_0xc5b69);}}else if((strategy[this['voiceQueues'][this[_0xaf2f('0x12a')][_0xe17296['actionid']][_0xaf2f('0xb7')]][_0xaf2f('0x12c')]]||'rrmemory')===_0xaf2f('0x136')){var _0x2a05b0;if(this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]]&&!_['isEmpty'](this[_0xaf2f('0x2b')][this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]])){if(this[_0xaf2f('0x2c')][_0x4da554[_0xaf2f('0x12a')][_0xe17296['actionid']][_0xaf2f('0xb7')]]){this['queueBookedRR'][_0x4da554[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]]=this[_0xaf2f('0x2c')][this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]]?this[_0xaf2f('0x2c')][this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]]:this[_0xaf2f('0x2b')][this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]]?this[_0xaf2f('0x2b')][this[_0xaf2f('0x12a')][_0xe17296['actionid']][_0xaf2f('0xb7')]][_0xaf2f('0x137')]||0x0:0x0;}this[_0xaf2f('0x2b')][this['actions'][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]][_0xaf2f('0x137')]=this[_0xaf2f('0x2c')][this[_0xaf2f('0x12a')][_0xe17296[_0xaf2f('0x12b')]][_0xaf2f('0xb7')]];for(var _0x42bc1d=0x0;_0x42bc1d=0x0;})['catch'](myreject(_0x44afe1)));}}else{_0x1cc461[_0xaf2f('0x130')](ami[_0xaf2f('0x14e')]({'action':_0xaf2f('0x14f'),'command':util[_0xaf2f('0x79')]('iftime\x20%s,%s',_0x3ea31e,!_['isUndefined'](config['timezones'][_0x20d5d5])?_0x20d5d5:'')})[_0xaf2f('0x41')](function(_0x102e05){return _0x102e05[_0xaf2f('0x153')]['indexOf'](_0xaf2f('0x154'))>=0x0;})[_0xaf2f('0xba')](myreject(_0x44afe1)));}BPromise[_0xaf2f('0x155')](_0x1cc461)[_0xaf2f('0x41')](function(_0x590cfa){var _0x50a9af=_['some'](_0x590cfa);if(_0x50a9af){return _0x1d93e6(_0x50a9af);}else{_0x4be8c2[_0xaf2f('0x46')]=_0x415eeb?'GLOBAL_INTERVAL_IS_OVERTIME':_0xaf2f('0x156');return _0x44afe1(msgResponse(_0xaf2f('0x157'),_0xaf2f('0x149'),_0xaf2f('0x158')+_0x415eeb+'\x20'+_0x5a7539+_0xaf2f('0x159')+util[_0xaf2f('0x9b')](_0x3ea31e,{'showHidden':![],'depth':null})+_0xaf2f('0x15a')+_0x20d5d5));}})[_0xaf2f('0xba')](function(_0x4983bf){return _0x44afe1(msgResponse(_0xaf2f('0x146'),'Failure',JSON[_0xaf2f('0x4e')](_0x4983bf)));});});};Dialer['prototype']['checkDialMethod']=function(_0x38a831){var _0x466e27=this;return function(){switch(_0x38a831[_0xaf2f('0x15b')]){case _0xaf2f('0x15c'):freeVariablesPredictive(_0x38a831);_0x466e27[_0xaf2f('0x15d')](_0x38a831,0x1);break;case _0xaf2f('0x15e'):freeVariablesPredictive(_0x38a831);_0x466e27[_0xaf2f('0x15d')](_0x38a831,_0x38a831[_0xaf2f('0x15f')]);break;case _0xaf2f('0x9'):_0x466e27[_0xaf2f('0x9')](_0x38a831);break;case _0xaf2f('0x8'):freeVariablesPredictive(_0x38a831);_0x466e27[_0xaf2f('0x15d')](_0x38a831,0x1);break;default:freeVariablesPredictive(_0x38a831);logger['error'](_0xaf2f('0x160'),_0x38a831['name'],_0xaf2f('0x161'));}};};Dialer[_0xaf2f('0xb8')]['launchHandleIvr']=function(_0x384fc){var _0xc5997d=this;return function(){_0xc5997d['handleIvr'](_0x384fc);};};Dialer['prototype']['syncQueueSummary']=function(_0x22ae7d){var _0x3dadb9=this;if(isNotPreview(_0x22ae7d[_0xaf2f('0x15b')])){if(isVoiceQueueOutbound(_0x22ae7d['type'])&&isActive(_0x22ae7d['dialActive'])){_0x22ae7d[_0xaf2f('0xa7')]=!![];BPromise['resolve']()[_0xaf2f('0x41')](checkIsLoggedIn(_0x22ae7d,_0x22ae7d['loggedIn']))[_0xaf2f('0x41')](checkIsActive(_0x22ae7d,_0x22ae7d[_0xaf2f('0x5f')]))[_0xaf2f('0x41')](checkInterval(_0x22ae7d))[_0xaf2f('0x41')](_0x3dadb9['checkIsTrunkReachable'](_0x22ae7d))[_0xaf2f('0x41')](_0x3dadb9['checkIfTime'](_0x22ae7d[_0xaf2f('0x162')],_0x22ae7d['dialTimezone'],_0x22ae7d[_0xaf2f('0x44')],_0x22ae7d))[_0xaf2f('0x41')](_0x3dadb9[_0xaf2f('0x147')](_0x22ae7d[_0xaf2f('0x4a')],_0x22ae7d[_0xaf2f('0x163')],_0x22ae7d[_0xaf2f('0x44')],_0x22ae7d))[_0xaf2f('0x41')](_0x3dadb9['checkDialMethod'](_0x22ae7d))['catch'](loggerCatchQueueSummary(_0xaf2f('0x164'),_0x22ae7d));}else{notSendMessagesQueue(_0x22ae7d);}}else{freeVariablesPredictive(_0x22ae7d);}};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x3ee781=_['filter'](this[_0xaf2f('0x20')],function(_0x1b0338){return _0x1b0338[_0xaf2f('0x165')];});var _0x2848e=_['filter'](this['agents'],function(_0x317a91){return _0x317a91[_0xaf2f('0x166')]&&_0x317a91[_0xaf2f('0xb3')]===_0xaf2f('0x167');});if(_0x3ee781[_0xaf2f('0x9e')]>0x0&&_0x2848e[_0xaf2f('0x9e')]>0x0){return BPromise['resolve']()[_0xaf2f('0x41')](cmHopper[_0xaf2f('0x168')](_[_0xaf2f('0x169')](_0x3ee781,'id'),previewRecallmeReminderInterval,_[_0xaf2f('0x169')](_0x2848e,'id')))[_0xaf2f('0x41')](function(_0x3a05c3){for(var _0x2ec0ce=0x0;_0x2ec0ce<_0x3a05c3['length'];_0x2ec0ce++){var _0x16a695=_0x3a05c3[_0x2ec0ce]['Agent']['name'];if(_0x16a695)io['to'](util['format'](_0xaf2f('0x16a'),_0x16a695))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x3a05c3[_0x2ec0ce]});}})[_0xaf2f('0xba')](function(_0x486933){logger['error'](_0xaf2f('0x16b'),_0x486933);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xaf2f('0xb8')][_0xaf2f('0x140')]=function(){var _0x3b743a=this;var _0x1862e5;for(var _0x1ae595 in this[_0xaf2f('0x21')]){if(typeof this[_0xaf2f('0x21')][_0x1ae595]!==_0xaf2f('0x9f')){_0x1862e5=this[_0xaf2f('0x21')][_0x1ae595];if(isCampaignIvr(_0x1862e5[_0xaf2f('0x51')])&&isActive(_0x1862e5['active'])){_0x1862e5[_0xaf2f('0xa7')]=!![];BPromise['resolve']()[_0xaf2f('0x41')](checkIsActive(_0x1862e5,_0x1862e5[_0xaf2f('0x78')]))[_0xaf2f('0x41')](checkInterval(_0x1862e5))[_0xaf2f('0x41')](_0x3b743a[_0xaf2f('0x141')](_0x1862e5))['then'](_0x3b743a[_0xaf2f('0x145')](_0x1862e5[_0xaf2f('0x162')],_0x1862e5[_0xaf2f('0x163')],_0x1862e5[_0xaf2f('0x44')],_0x1862e5))[_0xaf2f('0x41')](_0x3b743a[_0xaf2f('0x147')](_0x1862e5[_0xaf2f('0x4a')],_0x1862e5[_0xaf2f('0x163')],_0x1862e5[_0xaf2f('0x44')],_0x1862e5))[_0xaf2f('0x41')](_0x3b743a[_0xaf2f('0x16c')](_0x1862e5))[_0xaf2f('0xba')](loggerCatchQueueSummary(_0xaf2f('0x16d'),_0x1862e5));}else{notSendMessagesCampaign(_0x1862e5);}}}};function getCallerIdRandom(_0x2d8744,_0x4af3d8){var _0x3b0912;var _0x449c17;var _0x5520f4;if(_0x4af3d8<=0x0){_0x4af3d8=0x1;}_0x3b0912=new RegExp('\x5cw{0,'+_0x4af3d8+'}$');_0x449c17=Math[_0xaf2f('0x16e')](0xa,_0x4af3d8-0x1);_0x5520f4=Math[_0xaf2f('0x16e')](0xa,_0x4af3d8)-0x1;return util[_0xaf2f('0x79')]('%s',_[_0xaf2f('0x16f')](_0x2d8744,_0x3b0912,_[_0xaf2f('0x170')](_0x449c17,_0x5520f4)));}function extractCalleridName(_0xda0580){var _0x245bb1=_0xda0580[_0xaf2f('0x171')](/"(.*?)"/);return _0x245bb1?_0x245bb1[0x1]:_0xda0580;}function extractCalleridNumber(_0x329b0f){var _0x4f9233=_0x329b0f[_0xaf2f('0x171')](/<(.*?)>/);return _0x4f9233?_0x4f9233[0x1]:_0x329b0f;}Dialer['prototype']['actionOriginate']=function(_0x2971c1,_0x51ffce){var _0x5c20d2=this;var _0x5327cf=uuid['v4']();this['actions'][_0x5327cf]=new Action(_0x2971c1,_0x51ffce,_0x5327cf);return new BPromise(function(_0x5474c4,_0x49bd40){if(_[_0xaf2f('0x86')](_0x2971c1)&&typeof _0x2971c1!==_0xaf2f('0x172')){return _0x49bd40(msgResponse(_0xaf2f('0x173'),_0xaf2f('0x149'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x51ffce[_0xaf2f('0x174')])||_0x51ffce[_0xaf2f('0x174')]===null){return _0x49bd40(msgResponse('originate',_0xaf2f('0x149'),_0xaf2f('0x175')));}var _0x180c1e={'XMD-CALLERID':_0x5c20d2[_0xaf2f('0x12a')][_0x5327cf]['getCaller'](),'XMD-AGI':_0x2971c1[_0xaf2f('0x10a')]?util[_0xaf2f('0x79')](_0xaf2f('0x176'),ipAgi,_0x2971c1['dialQueueProject']):_0xaf2f('0x177'),'XMD-AGIAFTER':_0x2971c1['dialQueueProject2']?util[_0xaf2f('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2971c1[_0xaf2f('0x11a')]):_0xaf2f('0x177'),'XMD-QUEUE':_0x2971c1['type']===_0xaf2f('0x52')?util[_0xaf2f('0x79')](_0xaf2f('0x178'),_0x2971c1['name'],_0x2971c1[_0xaf2f('0x179')]||'',_0x2971c1[_0xaf2f('0x110')]?'c':'',_0x2971c1[_0xaf2f('0x17a')]||0x3):_0xaf2f('0x177'),'XMD-CONTACTID':_0x51ffce['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5c20d2[_0xaf2f('0x12a')][_0x5327cf][_0xaf2f('0x17b')](),'XMD-AMD':_0x2971c1[_0xaf2f('0xe3')]?_0xaf2f('0x17c'):_0xaf2f('0x177'),'XMD-DESTINATION':_0xaf2f('0xe2')};if(_0x2971c1['dialAMDActive']){_0x180c1e[_0xaf2f('0x17d')]=_0x2971c1[_0xaf2f('0x17e')]||0x9c4;_0x180c1e[_0xaf2f('0x17f')]=_0x2971c1[_0xaf2f('0x180')]||0x5dc;_0x180c1e[_0xaf2f('0x181')]=_0x2971c1[_0xaf2f('0x182')]||0x320;_0x180c1e[_0xaf2f('0x183')]=_0x2971c1['dialAMDTotalAnalysisTime']||0x1388;_0x180c1e[_0xaf2f('0x184')]=_0x2971c1['dialAMDMinWordLength']||0x64;_0x180c1e[_0xaf2f('0x185')]=_0x2971c1[_0xaf2f('0x186')]||0x32;_0x180c1e[_0xaf2f('0x187')]=_0x2971c1[_0xaf2f('0x188')]||0x3;_0x180c1e[_0xaf2f('0x189')]=_0x2971c1[_0xaf2f('0x18a')]||0x100;_0x180c1e[_0xaf2f('0x18b')]=_0x2971c1[_0xaf2f('0x18c')]||0x1388;}if(_0x2971c1[_0xaf2f('0x51')]==='outbound'){_0x180c1e['XMD-VOICEQUEUEID']=_0x51ffce['VoiceQueueId'];}else{_0x180c1e['XMD-CAMPAIGNID']=_0x51ffce[_0xaf2f('0xd8')];}for(var _0x204e46 in _0x51ffce[_0xaf2f('0x18d')]){if(typeof _0x51ffce[_0xaf2f('0x18d')][_0x204e46]!==_0xaf2f('0x9f')){if(isNotNull(_0x51ffce[_0xaf2f('0x18d')][_0x204e46])&&_0x204e46!=='id'&&_0x204e46!==_0xaf2f('0x18e')&&_0x204e46!==_0xaf2f('0x18f')&&_0x204e46!==_0xaf2f('0x190')){_0x180c1e[util[_0xaf2f('0x79')](_0xaf2f('0x191'),_0xaf2f('0x192'),_[_0xaf2f('0x193')](_0x204e46))]=_0x51ffce['Contact'][_0x204e46];}}}var _0xa6f4ae=_0x5c20d2[_0xaf2f('0xdc')](_0x2971c1[_0xaf2f('0x77')])?getCallerId(_0x2971c1[_0xaf2f('0x77')][_0xaf2f('0x194')],_0x2971c1['dialOriginateCallerIdName'],_0x2971c1['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2971c1[_0xaf2f('0x61')],_0x2971c1[_0xaf2f('0x195')]):_0x2971c1[_0xaf2f('0x61')]):getCallerId(_[_0xaf2f('0xb2')](_0x2971c1[_0xaf2f('0x142')])?_0x2971c1['Trunk'][_0xaf2f('0x194')]:_0x2971c1[_0xaf2f('0x142')][_0xaf2f('0x194')],_0x2971c1[_0xaf2f('0x60')],_0x2971c1[_0xaf2f('0x195')]>0x0?getCallerIdRandom(_0x2971c1[_0xaf2f('0x61')],_0x2971c1[_0xaf2f('0x195')]):_0x2971c1[_0xaf2f('0x61')]);if(_0xa6f4ae){_0x180c1e['XMD-ORIGINATECALLERIDNAME']=_0x5c20d2['actions'][_0x5327cf]['originatecalleridname']=extractCalleridName(_0xa6f4ae);_0x180c1e['XMD-ORIGINATECALLERIDNUM']=_0x51ffce[_0xaf2f('0x174')];}return ami['Action']({'actionid':_0x5327cf,'action':_0xaf2f('0x173'),'channel':_0x5c20d2['isTrunkReachable'](_0x2971c1[_0xaf2f('0x77')])?util[_0xaf2f('0x79')](_0xaf2f('0x196'),_0x2971c1[_0xaf2f('0x77')][_0xaf2f('0x44')],isNotNull(_0x2971c1[_0xaf2f('0x63')])?_0x2971c1['dialPrefix']['trim']()||'':'',_0x2971c1[_0xaf2f('0x197')]>0x0?_0x51ffce[_0xaf2f('0x174')]['substring'](_0x2971c1[_0xaf2f('0x197')]):_0x51ffce[_0xaf2f('0x174')]):util[_0xaf2f('0x79')](_0xaf2f('0x196'),_[_0xaf2f('0xb2')](_0x2971c1[_0xaf2f('0x142')])?_0x2971c1[_0xaf2f('0x77')][_0xaf2f('0x44')]:_0x2971c1[_0xaf2f('0x142')][_0xaf2f('0x44')],isNotNull(_0x2971c1[_0xaf2f('0x63')])?_0x2971c1[_0xaf2f('0x63')][_0xaf2f('0x198')]()||'':'',_0x2971c1[_0xaf2f('0x197')]>0x0?_0x51ffce['phone'][_0xaf2f('0x199')](_0x2971c1[_0xaf2f('0x197')]):_0x51ffce[_0xaf2f('0x174')]),'callerid':_0xa6f4ae,'Exten':_0xaf2f('0xe2'),'Context':'from-sip','Priority':'1','variable':_0x180c1e,'timeout':(_0x2971c1[_0xaf2f('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5327cf})[_0xaf2f('0x41')](function(_0x52285b){return _0x5474c4(_0x52285b);})[_0xaf2f('0xba')](function(_0x156227){_0x2971c1[_0xaf2f('0x6a')]+=0x1;var _0x39d525=new History(_0x5c20d2['actions'][_0x5327cf]);logger[_0xaf2f('0x9c')](util[_0xaf2f('0x79')](_0xaf2f('0x19a'),JSON['stringify'](_0x156227)));_0x39d525[_0xaf2f('0xac')]=0xe;_0x39d525['statedesc']='OriginateError';_0x39d525[_0xaf2f('0xae')]=moment()[_0xaf2f('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x39d525[_0xaf2f('0xad')]=_0x39d525[_0xaf2f('0xae')];_0x5c20d2['createHistory'](_0x39d525)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x19b')));_0x5c20d2['moveContactManagedDialer'](_0x39d525)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x19b')))[_0xaf2f('0x1d')](function(){delete _0x5c20d2[_0xaf2f('0x12a')][_0x5327cf];return _0x49bd40(msgResponse('originate',_0xaf2f('0x4d'),_0xaf2f('0x19c')));});});});};Dialer[_0xaf2f('0xb8')]['syncOriginateResponse']=function(_0x42c482){var _0x3b5fdc=this[_0xaf2f('0x12a')][_0x42c482[_0xaf2f('0x12b')]];if(_0x3b5fdc){delete this[_0xaf2f('0x12a')][_0x42c482[_0xaf2f('0x12b')]];_0x3b5fdc[_0xaf2f('0x116')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1a699b=_0x3b5fdc[_0xaf2f('0x51')]===_0xaf2f('0x7b')?this[_0xaf2f('0x21')][_0x3b5fdc[_0xaf2f('0xb7')]]:this[_0xaf2f('0x20')][_0x3b5fdc['getQueue']()];if(!this[_0xaf2f('0xda')](_0x42c482[_0xaf2f('0x19d')])){this[_0xaf2f('0xb6')](_0x1a699b);return this[_0xaf2f('0x19e')](_0x3b5fdc,_0x1a699b,_0x42c482)[_0xaf2f('0xba')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xaf2f('0x27')][_0x42c482[_0xaf2f('0xdf')]]=_0x3b5fdc;}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x19f')]=function(_0x5a4252,_0x97732b,_0xdaba4){var _0x2e76db=new History(_0x97732b);if(_0x2e76db[_0xaf2f('0x102')]+_0x2e76db[_0xaf2f('0xf5')]+_0x2e76db['countnoanswerretry']+_0x2e76db['countnosuchnumberretry']+_0x2e76db[_0xaf2f('0x103')]+_0x2e76db[_0xaf2f('0x104')]+_0x2e76db['countmachineretry']+_0x2e76db[_0xaf2f('0xf8')]>=_0xdaba4[_0xaf2f('0xf9')]-0x1){return!![];}switch(_0x5a4252){case 0x3:if(_0x2e76db[_0xaf2f('0xf6')]>=_0xdaba4[_0xaf2f('0x1a0')]-0x1){return!![];}this[_0xaf2f('0xc5')]({'active':![],'countnoanswerretry':_0x2e76db[_0xaf2f('0xf6')]+=0x1,'scheduledat':moment()['add'](_0xdaba4[_0xaf2f('0x1a1')],'minutes')[_0xaf2f('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e76db['ContactId'],'ListId':_0x2e76db[_0xaf2f('0xd6')],'VoiceQueueId':_0x2e76db[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x2e76db['CampaignId']||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1a2')));break;case 0x5:if(_0x2e76db['countbusyretry']>=_0xdaba4['dialBusyMaxRetry']-0x1){return!![];}this[_0xaf2f('0xc5')]({'active':![],'countbusyretry':_0x2e76db[_0xaf2f('0x102')]+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4[_0xaf2f('0x1a3')],_0xaf2f('0x105'))[_0xaf2f('0x79')](_0xaf2f('0x106')),'ContactId':_0x2e76db['ContactId'],'ListId':_0x2e76db[_0xaf2f('0xd6')],'VoiceQueueId':_0x2e76db[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x2e76db[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1a4')));break;case 0x8:if(_0x2e76db[_0xaf2f('0xf5')]>=_0xdaba4['dialCongestionMaxRetry']-0x1){return!![];}this[_0xaf2f('0xc5')]({'active':![],'countcongestionretry':_0x2e76db['countcongestionretry']+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4[_0xaf2f('0x1a5')],_0xaf2f('0x105'))[_0xaf2f('0x79')](_0xaf2f('0x106')),'ContactId':_0x2e76db['ContactId'],'ListId':_0x2e76db[_0xaf2f('0xd6')],'VoiceQueueId':_0x2e76db['VoiceQueueId']||undefined,'CampaignId':_0x2e76db[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1a6')));break;case 0x0:if(_0x2e76db['countnosuchnumberretry']>=_0xdaba4[_0xaf2f('0x1a7')]-0x1){return!![];}else{this[_0xaf2f('0xc5')]({'active':![],'countnosuchnumberretry':_0x2e76db[_0xaf2f('0xf7')]+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4[_0xaf2f('0x1a8')],_0xaf2f('0x105'))[_0xaf2f('0x79')](_0xaf2f('0x106')),'ContactId':_0x2e76db[_0xaf2f('0xd5')],'ListId':_0x2e76db[_0xaf2f('0xd6')],'VoiceQueueId':_0x2e76db[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x2e76db[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1a9')));}break;case 0xa:if(_0x2e76db['countdropretry']>=_0xdaba4[_0xaf2f('0x11e')]-0x1){return!![];}this[_0xaf2f('0xc5')]({'active':![],'countdropretry':_0x2e76db[_0xaf2f('0x103')]+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4[_0xaf2f('0x11b')],_0xaf2f('0x105'))[_0xaf2f('0x79')](_0xaf2f('0x106')),'ContactId':_0x2e76db[_0xaf2f('0xd5')],'ListId':_0x2e76db[_0xaf2f('0xd6')],'VoiceQueueId':_0x2e76db['VoiceQueueId']||undefined,'CampaignId':_0x2e76db[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2e76db[_0xaf2f('0x104')]>=_0xdaba4['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xaf2f('0xc5')]({'active':![],'countabandonedretry':_0x2e76db[_0xaf2f('0x104')]+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4[_0xaf2f('0x127')],_0xaf2f('0x105'))['format'](_0xaf2f('0x106')),'ContactId':_0x2e76db[_0xaf2f('0xd5')],'ListId':_0x2e76db['ListId'],'VoiceQueueId':_0x2e76db[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x2e76db[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x128')));break;case 0x13:if(_0x2e76db['countmachineretry']>=_0xdaba4[_0xaf2f('0xfc')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x2e76db[_0xaf2f('0xf3')]+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4['dialMachineRetryFrequency'],_0xaf2f('0x105'))['format'](_0xaf2f('0x106')),'ContactId':_0x2e76db[_0xaf2f('0xd5')],'ListId':_0x2e76db[_0xaf2f('0xd6')],'VoiceQueueId':_0x2e76db[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x2e76db[_0xaf2f('0xd8')]||undefined})['catch'](loggerCatch(_0xaf2f('0x100')));break;case 0x14:if(_0x2e76db[_0xaf2f('0xf8')]>=_0xdaba4[_0xaf2f('0x1aa')]-0x1){return!![];}this[_0xaf2f('0xc5')]({'active':![],'countagentrejectretry':_0x2e76db[_0xaf2f('0xf8')]+=0x1,'scheduledat':moment()[_0xaf2f('0xfe')](_0xdaba4['dialAgentRejectRetryFrequency'],_0xaf2f('0x105'))[_0xaf2f('0x79')](_0xaf2f('0x106')),'ContactId':_0x2e76db[_0xaf2f('0xd5')],'ListId':_0x2e76db['ListId'],'VoiceQueueId':_0x2e76db['VoiceQueueId']||undefined,'CampaignId':_0x2e76db['CampaignId']||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1ab')));break;default:return!![];}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x19e')]=function(_0x214cc0,_0x288319,_0x53cfb3){var _0x17fd8d=this;var _0x7ef878=new History(_0x214cc0);var _0x494cc5=![];var _0x22456d;var _0x283335;return new BPromise(function(_0x30f5ed,_0x50a036){if(_['isUndefined'](_0x288319)&&typeof _0x288319!==_0xaf2f('0x172')){return _0x50a036(msgResponse(_0xaf2f('0x1ac'),_0xaf2f('0x149'),_0xaf2f('0x1ad')));}if(_[_0xaf2f('0x86')](_0x53cfb3)&&typeof _0x53cfb3!==_0xaf2f('0x172')){return _0x50a036(msgResponse(_0xaf2f('0x1ac'),_0xaf2f('0x149'),_0xaf2f('0x1ae')));}_0x17fd8d[_0xaf2f('0xbd')](_0x7ef878,_0x53cfb3['reason'],_0x288319)[_0xaf2f('0x41')](function(_0x2348eb){if(_0x2348eb['additional']==0x1)_0x494cc5=!![];switch(_0x53cfb3[_0xaf2f('0x10e')]){case'0':_0x288319[_0xaf2f('0x1af')]+=0x1;_0x7ef878['state']=0x0;_0x7ef878[_0xaf2f('0xe6')]=_0xaf2f('0x1b0');_0x7ef878[_0xaf2f('0xf7')]+=0x1;_0x7ef878['countglobal']+=0x1;ami[_0xaf2f('0xe9')](_0xaf2f('0x1b1'),ut[_0xaf2f('0xeb')](_0x214cc0,_0xaf2f('0x1b2')));_0x22456d=_0x288319[_0xaf2f('0x1a8')];_0x283335=_0x288319[_0xaf2f('0x11c')];_0x17fd8d['createHistory'](_0x7ef878)['catch'](loggerCatch(_0xaf2f('0xf4')));if(_0x17fd8d[_0xaf2f('0x19f')](0x0,_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878['countnosuchnumberretry']>=_0x288319[_0xaf2f('0x1a7')]){_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1b4'));}else{_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1b4'));}}break;case'3':_0x288319[_0xaf2f('0x69')]+=0x1;_0x7ef878[_0xaf2f('0xac')]=0x3;_0x7ef878[_0xaf2f('0xe6')]=_0xaf2f('0x1b5');_0x7ef878['countnoanswerretry']+=0x1;_0x7ef878[_0xaf2f('0x126')]+=0x1;ami[_0xaf2f('0xe9')](_0xaf2f('0x1b6'),ut[_0xaf2f('0xeb')](_0x214cc0,_0xaf2f('0x1b7')));_0x22456d=_0x288319['dialNoAnswerRetryFrequency'];_0x283335=_0x288319[_0xaf2f('0x11c')];_0x17fd8d[_0xaf2f('0xcd')](_0x7ef878)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1b8')));if(_0x17fd8d[_0xaf2f('0x19f')](0x3,_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878[_0xaf2f('0xf6')]>=_0x288319['dialNoAnswerMaxRetry']){_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1b9'));}else{_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x288319[_0xaf2f('0x66')]+=0x1;_0x7ef878[_0xaf2f('0xac')]=0x5;_0x7ef878['statedesc']=_0xaf2f('0x1ba');_0x7ef878[_0xaf2f('0x102')]+=0x1;_0x7ef878[_0xaf2f('0x126')]+=0x1;ami['emit'](_0xaf2f('0x1bb'),ut[_0xaf2f('0xeb')](_0x214cc0,'busy'));_0x22456d=_0x288319[_0xaf2f('0x1a3')];_0x283335=_0x288319[_0xaf2f('0x11c')];_0x17fd8d['createHistory'](_0x7ef878)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1bc')));if(_0x17fd8d[_0xaf2f('0x19f')](0x5,_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878[_0xaf2f('0x102')]>=_0x288319[_0xaf2f('0x1bd')]){_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1be'));}else{_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1be'));}}break;case'8':_0x288319[_0xaf2f('0x1bf')]+=0x1;_0x7ef878[_0xaf2f('0xac')]=0x8;_0x7ef878[_0xaf2f('0xe6')]=_0xaf2f('0x1c0');_0x7ef878[_0xaf2f('0xf5')]+=0x1;_0x7ef878['countglobal']+=0x1;_0x22456d=_0x288319[_0xaf2f('0x1a5')];_0x283335=_0x288319[_0xaf2f('0x11c')];ami['emit'](_0xaf2f('0x1c1'),ut[_0xaf2f('0xeb')](_0x214cc0,'congestion'));_0x17fd8d[_0xaf2f('0xcd')](_0x7ef878)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1c2')));if(_0x17fd8d[_0xaf2f('0x19f')](0x8,_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878[_0xaf2f('0xf5')]>=_0x288319[_0xaf2f('0x1c3')]){_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,'reason\x208\x20congestion');}else{_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1c4'));}}break;case'11':_0x288319[_0xaf2f('0x1c5')]+=0x1;_0x7ef878[_0xaf2f('0xac')]=0xb;_0x7ef878[_0xaf2f('0xe6')]=_0xaf2f('0x124');_0x7ef878[_0xaf2f('0x104')]+=0x1;_0x7ef878[_0xaf2f('0x126')]+=0x1;_0x22456d=_0x288319[_0xaf2f('0x127')];_0x283335=_0x288319[_0xaf2f('0x11c')];_0x17fd8d[_0xaf2f('0xcd')](_0x7ef878)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x17fd8d[_0xaf2f('0x19f')](0xb,_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878[_0xaf2f('0x104')]>=_0x288319[_0xaf2f('0x1c6')]){_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1c7'));}else{_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,'reason\x2011\x20abandoned');}}break;case'20':_0x288319['outboundRejectCallsDay']+=0x1;_0x7ef878[_0xaf2f('0xac')]=0x14;_0x7ef878['statedesc']=_0xaf2f('0x1c8');_0x7ef878[_0xaf2f('0xf8')]+=0x1;_0x7ef878[_0xaf2f('0x126')]+=0x1;_0x22456d=_0x288319[_0xaf2f('0x1c9')];_0x283335=_0x288319['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut['buildObj'](_0x214cc0,_0xaf2f('0x1ca')));_0x17fd8d[_0xaf2f('0xcd')](_0x7ef878)[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1cb')));if(_0x17fd8d[_0xaf2f('0x19f')](0x14,_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878[_0xaf2f('0xf8')]>=_0x288319[_0xaf2f('0x1aa')]){_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,_0xaf2f('0x1cc'));}else{_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,'reason\x2020\x20agentreject');}}break;default:_0x288319[_0xaf2f('0x6d')]+=0x1;_0x7ef878[_0xaf2f('0xac')]=0xc;_0x7ef878[_0xaf2f('0xe6')]=_0x53cfb3[_0xaf2f('0x10e')];_0x22456d=_0x288319[_0xaf2f('0x1c9')];_0x283335=_0x288319['callAdditionalPhoneAfterMin'];_0x17fd8d[_0xaf2f('0xcd')](_0x7ef878)['catch'](loggerCatch(_0xaf2f('0x1cd')));if(_0x17fd8d[_0xaf2f('0x19f')](_0x53cfb3['reason'],_0x214cc0,_0x288319)&&!_0x494cc5){if(_0x7ef878[_0xaf2f('0x102')]+_0x7ef878['countcongestionretry']+_0x7ef878[_0xaf2f('0xf6')]+_0x7ef878[_0xaf2f('0xf7')]+_0x7ef878[_0xaf2f('0x103')]+_0x7ef878[_0xaf2f('0x104')]+_0x7ef878[_0xaf2f('0xf3')]+_0x7ef878[_0xaf2f('0xf8')]>=_0x288319['dialGlobalMaxRetry']){_0x17fd8d[_0xaf2f('0xfa')](_0x7ef878,_0x30f5ed,_0x50a036,_0x53cfb3[_0xaf2f('0x10e')]);}else{_0x17fd8d[_0xaf2f('0x1b3')](_0x7ef878,_0x30f5ed,_0x50a036,_0x53cfb3[_0xaf2f('0x10e')]);}}}})[_0xaf2f('0x41')](function(_0x31c323){if(_0x494cc5){_0x17fd8d['swapAdditionalPhones'](_0x7ef878,_0x22456d,_0x283335)[_0xaf2f('0x41')](function(_0x5885ca){return _0x30f5ed(0x1);});}});});};Dialer[_0xaf2f('0xb8')][_0xaf2f('0xfa')]=function(_0x4e8822,_0x1b1196,_0xca30d3,_0x5ec041){var _0x3ed420=new Final(_0x4e8822);_0x3ed420[_0xaf2f('0xac')]=0xf;_0x3ed420['statedesc']=_0xaf2f('0x1ce');this[_0xaf2f('0x1b3')](_0x3ed420,_0x1b1196,_0xca30d3,_0x5ec041);};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x1b3')]=function(_0x766651,_0x2f5b3b,_0x392932,_0x5ef235){this[_0xaf2f('0xcc')](_0x766651)[_0xaf2f('0x41')](function(){return _0x2f5b3b(msgResponse(_0xaf2f('0x1ac'),_0xaf2f('0xdb'),_0x5ef235));})[_0xaf2f('0xba')](function(){return _0x392932(msgResponse(_0xaf2f('0x1cf'),_0xaf2f('0x149'),_0xaf2f('0x1d0')));});};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x9')]=function(_0x1935b4){var _0x482cb7=_0x1935b4[_0xaf2f('0x1d1')]/0x64;var _0x6509c2=_0x1935b4['outboundDropCallsDayTimeout']/(_0x1935b4['outboundDropCallsDayTimeout']+_0x1935b4[_0xaf2f('0xf0')]);var _0x52cefd=Math[_0xaf2f('0x1d2')](_0x1935b4['predictiveIntervalAvailable']*(_0x1935b4['predictiveIntervalMaxThreshold']/0x64));var _0x293bac=Math[_0xaf2f('0x1d2')](_0x1935b4['predictiveIntervalAvailable']*(_0x1935b4[_0xaf2f('0x1d3')]/0x64));var _0x47a068=_0x1935b4[_0xaf2f('0x53')]+_0x1935b4['talking'];var _0xdaa987=Math[_0xaf2f('0x1d4')](_0x1935b4[_0xaf2f('0x75')]*_0x1935b4[_0xaf2f('0x8d')]*_0x1935b4['predictiveIntervalHitRate']*_0x1935b4['predictiveIntervalMultiplicativeFactor']);if(_[_0xaf2f('0x86')](_0x1935b4[_0xaf2f('0x29')])){if(!_['isUndefined'](_0x1935b4[_0xaf2f('0x28')])){_0x1935b4[_0xaf2f('0x28')]=undefined;loggerPredictive[_0xaf2f('0x9c')](_0xaf2f('0x1d5'),_0xaf2f('0x1d6'));}if(!_[_0xaf2f('0x86')](_0x1935b4[_0xaf2f('0x95')])){loggerPredictive[_0xaf2f('0x9c')](_0xaf2f('0x1d5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1935b4['handlePredictive']);_0x1935b4[_0xaf2f('0x95')]=undefined;}_0x1935b4[_0xaf2f('0x29')]=moment()['format'](_0xaf2f('0x106'));loggerPredictive[_0xaf2f('0x7d')](_0x1935b4[_0xaf2f('0x44')],_0xaf2f('0x1d7'),_0x1935b4['startProgressive']);this[_0xaf2f('0x15d')](_0x1935b4,0x1);}else if(ifInterval(_0x1935b4[_0xaf2f('0x1d8')],_0x1935b4[_0xaf2f('0x29')])){this['handlePower'](_0x1935b4,0x1);loggerPredictiveCalls[_0xaf2f('0x7d')]('[startMethodPredictive][StartProgressive][Loop]',_0x1935b4[_0xaf2f('0x29')],_0x1935b4[_0xaf2f('0x44')]);_0x1935b4[_0xaf2f('0x75')]=0x0;_0x1935b4['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x482cb7<_0x6509c2&&_0x1935b4['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x1935b4);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x1d9'),_0xaf2f('0x1da'),_0x6509c2,_0xaf2f('0x29'),_0x1935b4[_0xaf2f('0x44')]);}else if(_0xdaa987<_0x1935b4['predictiveIntervalErlangCallsDroppedCalls']&&_0x1935b4[_0xaf2f('0x1db')]===_0xaf2f('0x1dc')){freeVariablesPredictive(_0x1935b4);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x1dd'),_0xaf2f('0x1de'),_0xdaa987,_0xaf2f('0x1df'),_0x1935b4[_0xaf2f('0x117')],_0xaf2f('0x29'),_0x1935b4[_0xaf2f('0x44')]);}else if(!ifInterval(_0x1935b4[_0xaf2f('0x1d8')],_0x1935b4[_0xaf2f('0x29')])&&_[_0xaf2f('0x86')](_0x1935b4[_0xaf2f('0x28')])&&!_['isUndefined'](_0x1935b4[_0xaf2f('0x29')])){_0x1935b4[_0xaf2f('0x28')]=moment()[_0xaf2f('0x79')](_0xaf2f('0x106'));loggerPredictive[_0xaf2f('0x7d')](_0x1935b4[_0xaf2f('0x44')],_0xaf2f('0x1e0'),_0x1935b4[_0xaf2f('0x28')]);this[_0xaf2f('0xc3')](_0x1935b4[_0xaf2f('0x1d8')])[_0xaf2f('0x41')](this[_0xaf2f('0x1e1')](_0x1935b4))[_0xaf2f('0x41')](mergeDataErlangB(_0x1935b4))[_0xaf2f('0x41')](this[_0xaf2f('0x1e2')](_0x1935b4))[_0xaf2f('0xba')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1935b4));}else if(!ifInterval(_0x1935b4[_0xaf2f('0x1d8')],_0x1935b4[_0xaf2f('0x28')])){_0x1935b4['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1935b4[_0xaf2f('0x28')]=moment()[_0xaf2f('0x79')](_0xaf2f('0x106'));loggerPredictive[_0xaf2f('0x7d')](_0x1935b4['name'],'recalculate\x20predictive\x20at',_0x1935b4[_0xaf2f('0x28')]);clearInterval(_0x1935b4['handlePredictive']);_0x1935b4['handlePredictive']=undefined;this['averageHandleTime'](_0x1935b4['dialPredictiveInterval'])[_0xaf2f('0x41')](this[_0xaf2f('0x1e1')](_0x1935b4))[_0xaf2f('0x41')](mergeDataErlangB(_0x1935b4))[_0xaf2f('0x41')](this[_0xaf2f('0x1e2')](_0x1935b4))[_0xaf2f('0xba')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1935b4));}else if(_0x1935b4[_0xaf2f('0x73')]&&_0x47a068<_0x1935b4[_0xaf2f('0x73')]-_0x293bac){freeVariablesPredictive(_0x1935b4);loggerPredictive['info'](_0x1935b4[_0xaf2f('0x44')],_0xaf2f('0x1e3'),_0x47a068,')\x20are\x20less\x20than\x20threshold\x20(',_0x1935b4[_0xaf2f('0x73')],'-',_0x293bac,'=',_0x1935b4['predictiveIntervalAvailable']-_0x293bac,')');}else if(_0x1935b4[_0xaf2f('0x73')]&&_0x47a068>_0x1935b4['predictiveIntervalAvailable']+_0x52cefd){freeVariablesPredictive(_0x1935b4);loggerPredictive[_0xaf2f('0x7d')](_0x1935b4[_0xaf2f('0x44')],_0xaf2f('0x1e3'),_0x47a068,_0xaf2f('0x1e4'),_0x1935b4[_0xaf2f('0x73')],'+',_0x52cefd,'=',_0x1935b4['predictiveIntervalAvailable']+_0x52cefd,')');}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x1e1')]=function(_0x19503f){var _0x4e30f8=this;return function(_0x8b132b){return new BPromise(function(_0x408ed4,_0x32a339){_[_0xaf2f('0x91')](_0x19503f,_0x8b132b[0x0]);if(checkGetDataPredictive(_0x8b132b[0x0])){var _0x2282f8=_0x19503f['predictiveIntervalAvailable']=_0x19503f[_0xaf2f('0x59')]+_0x19503f[_0xaf2f('0x53')];var _0x5239e2=_0x19503f[_0xaf2f('0x1d8')]*0x3c;var _0x357733=_0x8b132b[0x0][_0xaf2f('0x6e')]+_0x8b132b[0x0][_0xaf2f('0x88')];var _0xa22b5e=(_0x8b132b[0x0][_0xaf2f('0x82')]+_0x8b132b[0x0][_0xaf2f('0x70')]+_0x8b132b[0x0][_0xaf2f('0x6f')])/_0x8b132b[0x0][_0xaf2f('0x80')];_0x19503f[_0xaf2f('0x71')]=_0xa22b5e>0x0?_0xa22b5e:0x1;switch(_0x19503f['dialPredictiveOptimization']){case'dropRate':var _0x12655c=_0x19503f[_0xaf2f('0x1d1')]/0x64;return _0x4e30f8['abandonmentRate'](_0x2282f8,_0x5239e2,_0x357733,_0xa22b5e,_0x12655c)[_0xaf2f('0x41')](function(_0x15b28f){return _0x408ed4(_0x15b28f);});case _0xaf2f('0x1e5'):var _0x14682e=_0x19503f[_0xaf2f('0x1d1')]/0x64;return _0x4e30f8[_0xaf2f('0x1e6')](_0x2282f8,_0x5239e2,_0x357733,_0xa22b5e,_0x14682e)[_0xaf2f('0x41')](function(_0x4ba2b4){return _0x408ed4(_0x4ba2b4);});default:return _0x32a339(msgResponse(_0xaf2f('0x1e7'),_0xaf2f('0x149'),_0xaf2f('0x1e8')));}}else{return _0x32a339(msgResponse(_0xaf2f('0x1e7'),_0xaf2f('0x149'),'check\x20failure'));}});};};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x1e9')]=function(_0x2e335c){var _0x2b3459=this;return function(_0x5841f9){return new BPromise(function(_0x293a2b,_0x571159){_[_0xaf2f('0x91')](_0x2e335c,_0x5841f9[0x0]);if(checkGetDataPredictive(_0x5841f9[0x0])){loggerPredictive[_0xaf2f('0x7d')](JSON['stringify'](_0x5841f9[0x0]));if(_0x2e335c[_0xaf2f('0x1db')]===_0xaf2f('0x1dc')){return _0x2b3459[_0xaf2f('0xca')](_0x2e335c['id'])['then'](function(_0x8df104){var _0x2ec366=_0x2e335c['loggedIn']-_0x8df104[0x0][_0xaf2f('0x1ea')];var _0x206310=_0x2e335c['dialPredictiveInterval']*0x3c;var _0x4299f2=_0x5841f9[0x0][_0xaf2f('0x6e')]+_0x5841f9[0x0]['predictiveIntervalAvgHoldtime'];var _0x2c38d9=(_0x5841f9[0x0][_0xaf2f('0x82')]+_0x5841f9[0x0][_0xaf2f('0x70')]+_0x5841f9[0x0][_0xaf2f('0x6f')])/_0x5841f9[0x0][_0xaf2f('0x80')];var _0x342e95=_0x2e335c[_0xaf2f('0x1d1')]/0x64;_0x2e335c[_0xaf2f('0x72')]=_0x8df104[0x0][_0xaf2f('0x1ea')]||0x0;_0x2e335c['predictiveIntervalHitRate']=_0x2c38d9>0x0?_0x2c38d9:0x1;return _0x2b3459['abandonmentRate'](_0x2ec366,_0x206310,_0x4299f2,_0x2c38d9,_0x342e95);})[_0xaf2f('0x41')](function(_0x30758e){return _0x293a2b(_0x30758e);})[_0xaf2f('0xba')](function(_0x4eb025){return _0x571159(msgResponse(_0xaf2f('0x1eb'),_0xaf2f('0x149'),JSON[_0xaf2f('0x4e')](_0x4eb025)));});}if(_0x2e335c['dialPredictiveOptimization']===_0xaf2f('0x1e5')){return _0x2b3459['getVoiceQueueRtPauses'](_0x2e335c['id'])['then'](function(_0x5bc3bf){var _0x446c25=_0x2e335c[_0xaf2f('0x54')]-_0x5bc3bf[0x0]['outboundQueuePauses'];var _0xcae3c7=_0x2e335c[_0xaf2f('0x1d8')]*0x3c;var _0x4b6a43=_0x5841f9[0x0][_0xaf2f('0x6e')]+_0x5841f9[0x0][_0xaf2f('0x88')];var _0x31be92=(_0x5841f9[0x0]['predictiveIntervalAnsweredCalls']+_0x5841f9[0x0][_0xaf2f('0x70')]+_0x5841f9[0x0][_0xaf2f('0x6f')])/_0x5841f9[0x0]['predictiveIntervalTotalCalls'];var _0x429329=_0x2e335c[_0xaf2f('0x1d1')]/0x64;_0x2e335c[_0xaf2f('0x72')]=_0x5bc3bf[0x0]['outboundQueuePauses']||0x0;_0x2e335c[_0xaf2f('0x71')]=_0x31be92>0x0?_0x31be92:0x1;return _0x2b3459[_0xaf2f('0x1e6')](_0x446c25,_0xcae3c7,_0x4b6a43,_0x31be92,_0x429329);})['then'](function(_0x339137){return _0x293a2b(_0x339137);})[_0xaf2f('0xba')](function(_0x196273){return _0x571159(msgResponse(_0xaf2f('0x1eb'),_0xaf2f('0x149'),JSON[_0xaf2f('0x4e')](_0x196273)));});}}else{return _0x571159(msgResponse(_0xaf2f('0x1e7'),_0xaf2f('0x149'),_0xaf2f('0x1ec')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x2566bb){var _0xadca9f=this;return function(){var _0xe7c802=0x0;var _0x5a6d5d=Math[_0xaf2f('0x1d4')](_0x2566bb[_0xaf2f('0x1ed')]*0x3e8);if(_0x5a6d5d>0x0){_0x5a6d5d=_0x5a6d5d<0x64?0x64:_0x5a6d5d;loggerPredictive['info'](_0x2566bb[_0xaf2f('0x44')],_0xaf2f('0x1ee'),_0x5a6d5d,_0xaf2f('0x4f'));_0x2566bb[_0xaf2f('0x95')]=setInterval(function(){_0xadca9f[_0xaf2f('0x95')](_0x2566bb);loggerPredictiveCalls[_0xaf2f('0x7d')](_0xaf2f('0x1ef'),_0xe7c802+=0x1);},_0x5a6d5d);}else{loggerPredictive[_0xaf2f('0x7d')](_0x2566bb[_0xaf2f('0x44')],_0xaf2f('0x1f0'));}};};Dialer['prototype']['checkContactBlack']=function(_0x420b61,_0x3a1910){var _0x5c120c=this;return function(_0x1a1ea9){if(_[_0xaf2f('0x4c')](_0x1a1ea9)){if(_[_0xaf2f('0xb2')](_0x3a1910[_0xaf2f('0x1f1')])||!_0x3a1910['recallme']){if(_0x420b61['dialMethod']===_0xaf2f('0x8')){_0x420b61[_0xaf2f('0x132')]=_[_0xaf2f('0x86')](_0x420b61[_0xaf2f('0x132')])?!![]:_0x420b61['queueStatusComplete'];var _0x1208d2=uuid['v4']();_0x5c120c[_0xaf2f('0x12a')][_0x1208d2]=new Action(_0x420b61,_0x3a1910,_0x1208d2);loggerBooked[_0xaf2f('0x7d')](_0xaf2f('0x1f2'),_0x1208d2,_0xaf2f('0x1f3'),JSON['stringify'](_0x420b61['queueStatusComplete']),_0xaf2f('0x1f4'),_0x420b61[_0xaf2f('0x44')]);if(_0x420b61['queueStatusComplete']){_0x420b61[_0xaf2f('0x132')]=![];_0x5c120c[_0xaf2f('0x2b')][_0x5c120c[_0xaf2f('0x12a')][_0x1208d2][_0xaf2f('0xb7')]]=[];ami[_0xaf2f('0x14e')]({'actionid':_0x1208d2,'action':_0xaf2f('0x1f5'),'queue':_0x420b61[_0xaf2f('0x44')]})[_0xaf2f('0xba')](function(){_0x5c120c[_0xaf2f('0xb6')](_0x420b61);_0x5c120c[_0xaf2f('0xc5')]({'active':![],'ContactId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2][_0xaf2f('0xd5')],'ListId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2][_0xaf2f('0xd6')],'VoiceQueueId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2]['VoiceQueueId']||undefined,'CampaignId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2][_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1f6')));delete _0x5c120c[_0xaf2f('0x12a')][_0x1208d2];});}else{loggerBooked[_0xaf2f('0x7d')](_0xaf2f('0x1f7'),JSON[_0xaf2f('0x4e')](_0x420b61[_0xaf2f('0x132')]),'Queue:\x20',_0x420b61[_0xaf2f('0x44')]);_0x5c120c['updateOriginated'](_0x420b61);_0x5c120c[_0xaf2f('0xc5')]({'active':![],'ContactId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2][_0xaf2f('0xd5')],'ListId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2]['ListId'],'VoiceQueueId':_0x5c120c[_0xaf2f('0x12a')][_0x1208d2][_0xaf2f('0xd7')]||undefined,'CampaignId':_0x5c120c['actions'][_0x1208d2]['CampaignId']||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1f6')));delete _0x5c120c['actions'][_0x1208d2];}}else{return _0x5c120c['actionOriginate'](_0x420b61,_0x3a1910);}}else{if(getDiff(_0x3a1910[_0xaf2f('0x1f8')])<_0x420b61[_0xaf2f('0x1f9')]*0x3c){if(_0x3a1910[_0xaf2f('0x1fa')]&&!_0x3a1910['Agent']['voicePause']){_0x5c120c[_0xaf2f('0x1f')][_0xaf2f('0x135')](_0x3a1910['id'])[_0xaf2f('0x1d')](function(){_0x5c120c[_0xaf2f('0xb6')](_0x420b61);});}else{_0x5c120c[_0xaf2f('0xc6')]({'active':![]},_0x3a1910['id'],0x1)[_0xaf2f('0x1d')](function(){_0x5c120c['updateOriginated'](_0x420b61);});}}else{_0x420b61[_0xaf2f('0x6b')]+=0x1;_0x5c120c['updateOriginated'](_0x420b61);if(_0x420b61[_0xaf2f('0x1fb')]){_0x5c120c[_0xaf2f('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3a1910[_0xaf2f('0xd5')],'ListId':_0x3a1910['ListId'],'VoiceQueueId':_0x3a1910[_0xaf2f('0xd7')]||undefined,'CampaignId':_0x3a1910[_0xaf2f('0xd8')]||undefined})[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1fc')));_0x5c120c['createHistory'](createObjHistory(_0x420b61,_0x3a1910,_0xaf2f('0x1fd'),0x17,_0xaf2f('0x1fe')))[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x1ff')));}else{_0x5c120c[_0xaf2f('0xd3')](createObjHistory(_0x420b61,_0x3a1910,_0xaf2f('0x200'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x420b61['outboundBlacklistCallsDay']+=0x1;_0x5c120c[_0xaf2f('0xd3')](createObjHistory(_0x420b61,_0x3a1910,_0xaf2f('0x201'),0xd,_0xaf2f('0x202')),_0xaf2f('0x203'),_0xaf2f('0x204'));throw _0xaf2f('0x205');}};};Dialer['prototype']['handleIvr']=function(_0x14a030){var _0x20b0b8=this;var _0x2e7473=_0x14a030[_0xaf2f('0x206')]-_0x14a030[_0xaf2f('0x74')]-_0x14a030['temp'];emitCampaignSummary(_0x14a030);if(_0x2e7473>0x0){if(_0x2e7473>this[_0xaf2f('0x24')]){_0x2e7473=this['maxNumberOriginate'];}_0x14a030[_0xaf2f('0xc8')]+=_0x2e7473;this[_0xaf2f('0xc9')](_0x14a030['id'],_0x2e7473,_0x14a030['dialOrderByScheduledAt'],_0x14a030)[_0xaf2f('0x41')](function(_0x2ca0c9){_0x14a030[_0xaf2f('0xc8')]-=_0x2e7473;_0x14a030[_0xaf2f('0xc8')]=_0x14a030[_0xaf2f('0xc8')]>0x0?_0x14a030[_0xaf2f('0xc8')]:0x0;if(!checkContactEmpty(_0x2ca0c9)){_0x14a030[_0xaf2f('0x46')]=_0xaf2f('0x207');logger[_0xaf2f('0x7d')]('[getContactCampaign2][Empty]'+_0x14a030['name']);}else{_0x14a030['originated']+=_0x2ca0c9[_0xaf2f('0x9e')];_0x14a030[_0xaf2f('0x46')]=_0xaf2f('0x208');for(var _0x51d070=0x0;_0x51d070<_0x2ca0c9['length'];_0x51d070+=0x1){_0x14a030[_0xaf2f('0x209')]+=0x1;if(_[_0xaf2f('0xb2')](_0x2ca0c9[_0x51d070])||_['isNil'](_0x2ca0c9[_0x51d070][_0xaf2f('0x18d')])||_[_0xaf2f('0xb2')](_0x2ca0c9[_0x51d070][_0xaf2f('0x174')])){_0x20b0b8['emptyContact'](_0xaf2f('0x20a'),_0x14a030,_0x2ca0c9[_0x51d070]);}else{_0x20b0b8[_0xaf2f('0xc1')](_[_0xaf2f('0xd4')](_0x2ca0c9[_0x51d070],['CampaignId',_0xaf2f('0x20b')]))[_0xaf2f('0x41')](_0x20b0b8[_0xaf2f('0x20c')](_0x14a030,_0x2ca0c9[_0x51d070]))[_0xaf2f('0xba')](_0x20b0b8[_0xaf2f('0xd1')]('[actionOriginateIvr]\x20',_0x14a030));}}}})[_0xaf2f('0xba')](loggerGetContactDialer(_0xaf2f('0x20d'),_0x14a030,_0x2e7473));}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x15d')]=function(_0x1b339f,_0x5dee32){var _0x390e71=this;var _0x2ae2b5=[];var _0x3d417a=_0x5dee32>=0x1?_0x5dee32:0x1;if(_0x1b339f[_0xaf2f('0x15b')]===_0xaf2f('0x8')){_0x3d417a=0x1;}var _0x3ad6a9=Math[_0xaf2f('0x1d4')](_0x1b339f[_0xaf2f('0x53')]*_0x3d417a)-_0x1b339f[_0xaf2f('0x74')]-_0x1b339f[_0xaf2f('0xc8')];emitVoiceQueueSummary(_0x1b339f);if(_0x1b339f['dialLimitQueue']>0x0){var _0xd3a563=_0x1b339f['dialLimitQueue']-_0x1b339f[_0xaf2f('0x74')]-_0x1b339f['talking']-_0x1b339f['temp']-_0x1b339f[_0xaf2f('0x55')];if(_0x3ad6a9>_0xd3a563){_0x3ad6a9=_0xd3a563;}}if(_0x3ad6a9>0x0){if(_0x1b339f['dialMethod']===_0xaf2f('0x8')){_0x3ad6a9=0x1;}if(_0x3ad6a9>this[_0xaf2f('0x24')]){_0x3ad6a9=this[_0xaf2f('0x24')];}_0x1b339f[_0xaf2f('0xc8')]+=_0x3ad6a9;for(var _0xf532e8 in this['agents']){if(typeof this['agents'][_0xf532e8]!==_0xaf2f('0x9f')){if(this['agents'][_0xf532e8][_0xaf2f('0xac')]===_0xaf2f('0x20e')&&this[_0xaf2f('0x22')][_0xf532e8]['status']===_0xaf2f('0x167')){_0x2ae2b5['push'](this[_0xaf2f('0x22')][_0xf532e8]['id']);}}}this[_0xaf2f('0xc7')](_0x1b339f['id'],_0x2ae2b5,_0x3ad6a9,_0x1b339f[_0xaf2f('0x20f')],_0x1b339f)[_0xaf2f('0x41')](function(_0x3c1a29){_0x1b339f[_0xaf2f('0xc8')]-=_0x3ad6a9;_0x1b339f['temp']=_0x1b339f['temp']>0x0?_0x1b339f[_0xaf2f('0xc8')]:0x0;if(!checkContactEmpty(_0x3c1a29)){_0x390e71[_0xaf2f('0x210')](_0x1b339f)['then'](sendMessageReschedule(_0x1b339f))[_0xaf2f('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0x1b339f[_0xaf2f('0x74')]+=_0x3c1a29[_0xaf2f('0x9e')];_0x1b339f[_0xaf2f('0x46')]=_0x1b339f[_0xaf2f('0x15b')]==='booked'?_0xaf2f('0x17c'):_0xaf2f('0x208');for(var _0x4084bb=0x0;_0x4084bb<_0x3c1a29[_0xaf2f('0x9e')];_0x4084bb+=0x1){if(_[_0xaf2f('0xb2')](_0x3c1a29[_0x4084bb])||_[_0xaf2f('0xb2')](_0x3c1a29[_0x4084bb][_0xaf2f('0x18d')])||_['isNil'](_0x3c1a29[_0x4084bb][_0xaf2f('0x174')])){_0x390e71[_0xaf2f('0x211')]('[actionOriginate]\x20',_0x1b339f,_0x3c1a29[_0x4084bb]);}else{_0x390e71[_0xaf2f('0xbb')](_[_0xaf2f('0xd4')](_0x3c1a29[_0x4084bb],[_0xaf2f('0xd7'),_0xaf2f('0x20b')]))[_0xaf2f('0x41')](_0x390e71['checkContactBlack'](_0x1b339f,_0x3c1a29[_0x4084bb]))[_0xaf2f('0xba')](_0x390e71[_0xaf2f('0xd1')]('[actionOriginate]\x20',_0x1b339f));}}}})[_0xaf2f('0xba')](loggerGetContactDialer(_0xaf2f('0x212'),_0x1b339f,_0x3ad6a9));}};Dialer[_0xaf2f('0xb8')]['handlePredictive']=function(_0x14a23c){if(_0x14a23c['dialLimitQueue']>0x0){var _0x3434c8=_0x14a23c[_0xaf2f('0x213')]-_0x14a23c[_0xaf2f('0x74')]-_0x14a23c[_0xaf2f('0x59')];if(_0x3434c8>0x0){this[_0xaf2f('0x214')](_0x14a23c);}else{loggerPredictiveCalls['info'](_0xaf2f('0x215'));}}else{this[_0xaf2f('0x214')](_0x14a23c);}};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x214')]=function(_0x5395f1){var _0x4ad63b=this;var _0x2f32d3=[];_0x5395f1[_0xaf2f('0x74')]+=0x1;for(var _0x51216b in this[_0xaf2f('0x22')]){if(typeof this[_0xaf2f('0x22')][_0x51216b]!==_0xaf2f('0x9f')){if(this[_0xaf2f('0x22')][_0x51216b][_0xaf2f('0xac')]===_0xaf2f('0x20e')&&this[_0xaf2f('0x22')][_0x51216b][_0xaf2f('0xb3')]===_0xaf2f('0x167')){_0x2f32d3[_0xaf2f('0x130')](this[_0xaf2f('0x22')][_0x51216b]['id']);}}}this[_0xaf2f('0xc7')](_0x5395f1['id'],_0x2f32d3,0x1,_0x5395f1[_0xaf2f('0x20f')],_0x5395f1)[_0xaf2f('0x41')](function(_0x1fecac){if(!checkContactEmpty(_0x1fecac)){checkContactLowerLimitOriginate(_0x5395f1,0x1,0x0);_0x4ad63b['countReScheduled'](_0x5395f1)[_0xaf2f('0x41')](sendMessageReschedule(_0x5395f1))[_0xaf2f('0xba')](loggerCatch(_0xaf2f('0x216')));}else{_0x5395f1['message']=_0xaf2f('0x208');if(_['isNil'](_0x1fecac[0x0])||_[_0xaf2f('0xb2')](_0x1fecac[0x0]['Contact'])||_[_0xaf2f('0xb2')](_0x1fecac[0x0][_0xaf2f('0x174')])){_0x4ad63b[_0xaf2f('0x211')]('[actionOriginate]\x20',_0x5395f1,_0x1fecac[0x0]);}else{_0x4ad63b['checkIsBlackList'](_['pick'](_0x1fecac[0x0],[_0xaf2f('0xd7'),_0xaf2f('0x20b')]))[_0xaf2f('0x41')](_0x4ad63b[_0xaf2f('0x20c')](_0x5395f1,_0x1fecac[0x0]))['catch'](_0x4ad63b['loggerHandler'](_0xaf2f('0x217'),_0x5395f1));}}})[_0xaf2f('0xba')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5395f1,0x1));emitVoiceQueueSummary(_0x5395f1);};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x218')]=function(_0x570192,_0x155976,_0x293082,_0x3fe370,_0x4743f2,_0x7e20a7){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x219'),_0x570192);loggerPredictive[_0xaf2f('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x155976);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x21a'),_0x293082);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x21b'),_0x3fe370);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4743f2);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x90'));return new BPromise(function(_0x4c3bd7,_0x3fc7f1){if(_0x570192<=0x0||isNaN(_0x570192)){return _0x3fc7f1(msgResponse(_0xaf2f('0x21c'),_0xaf2f('0x4d'),_0xaf2f('0x21d')+_0x570192));}if(_0x293082<=0x0||isNaN(_0x293082)){return _0x3fc7f1(msgResponse(_0xaf2f('0x21c'),_0xaf2f('0x4d'),_0xaf2f('0x21e')+_0x293082));}if(_0x3fe370<=0x0||isNaN(_0x3fe370)){return _0x3fc7f1(msgResponse(_0xaf2f('0x21c'),_0xaf2f('0x4d'),_0xaf2f('0x21f')+_0x3fe370));}if(_0x155976<=0x0||isNaN(_0x155976)){return _0x3fc7f1(msgResponse(_0xaf2f('0x21c'),_0xaf2f('0x4d'),'interval\x20=\x20'+_0x155976));}if(_0x4743f2<=0x0||isNaN(_0x4743f2)){return _0x3fc7f1(msgResponse(_0xaf2f('0x21c'),_0xaf2f('0x4d'),_0xaf2f('0x220')+_0x4743f2));}_0x7e20a7=_0x7e20a7||0x0;var _0x212ebf=0x1/_0x293082;var _0x583dc4=0x0;var _0x29298b=0x0;var _0x35b167=0x0;var _0x243475=0x0;for(var _0x4c4e78=0x0;_0x35b167<_0x4743f2;_0x4c4e78+=0x1){_0x29298b=_0x4c4e78/_0x155976;_0x583dc4=(_0x3fe370*_0x29298b+_0x7e20a7)/_0x212ebf;_0x35b167=erlangb(_0x583dc4,_0x570192);_0x243475=_0x583dc4/_0x570192*(0x1-erlangb(_0x583dc4,_0x570192));}return _0x4c3bd7({'erlangCalls':_0x4c4e78,'erlangCallToSecond':_0x155976/_0x4c4e78,'erlangAbandonmentRate':_0x35b167,'erlangBusyFactor':_0x243475});});};Dialer[_0xaf2f('0xb8')][_0xaf2f('0x1e6')]=function(_0x1e0eb3,_0x34a605,_0xa86a70,_0x35d1da,_0x6a9899,_0x520144){loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x221'));loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x219'),_0x1e0eb3);loggerPredictive[_0xaf2f('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34a605);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x21a'),_0xa86a70);loggerPredictive[_0xaf2f('0x7d')]('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',_0x35d1da);loggerPredictive['info'](_0xaf2f('0x222'),_0x6a9899);loggerPredictive[_0xaf2f('0x7d')](_0xaf2f('0x90'));return new BPromise(function(_0x58398a,_0x1a3a2b){if(_0x1e0eb3<=0x0||isNaN(_0x1e0eb3)){return _0x1a3a2b(msgResponse(_0xaf2f('0x223'),_0xaf2f('0x4d'),'m\x20=\x20'+_0x1e0eb3));}if(_0xa86a70<=0x0||isNaN(_0xa86a70)){return _0x1a3a2b(msgResponse(_0xaf2f('0x223'),_0xaf2f('0x4d'),_0xaf2f('0x21e')+_0xa86a70));}if(_0x35d1da<=0x0||isNaN(_0x35d1da)){return _0x1a3a2b(msgResponse(_0xaf2f('0x223'),_0xaf2f('0x4d'),_0xaf2f('0x21f')+_0x35d1da));}if(_0x34a605<=0x0||isNaN(_0x34a605)){return _0x1a3a2b(msgResponse(_0xaf2f('0x223'),'Error','interval\x20=\x20'+_0x34a605));}if(_0x6a9899<=0x0||isNaN(_0x6a9899)){return _0x1a3a2b(msgResponse('[busyFactor]',_0xaf2f('0x4d'),_0xaf2f('0x224')+_0x6a9899));}_0x520144=_0x520144||0x0;var _0x17ddc0=0x1/_0xa86a70;var _0xff3234=0x0;var _0x2eb556=0x0;var _0x9bed96=0x0;var _0x53d28=0x0;for(var _0x3908c2=0x0;_0x53d28<_0x6a9899;_0x3908c2+=0x1){_0x2eb556=_0x3908c2/_0x34a605;_0xff3234=(_0x35d1da*_0x2eb556+_0x520144)/_0x17ddc0;_0x9bed96=erlangb(_0xff3234,_0x1e0eb3);_0x53d28=_0xff3234/_0x1e0eb3*(0x1-erlangb(_0xff3234,_0x1e0eb3));}return _0x58398a({'erlangCalls':_0x3908c2,'erlangCallToSecond':_0x34a605/_0x3908c2,'erlangAbandonmentRate':_0x9bed96,'erlangBusyFactor':_0x53d28});});};module[_0xaf2f('0x225')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e68534d..d9b8a1d 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x469a=['responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x469a,0x1ca));var _0xa469=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x469a[_0x2b5eae];return _0x5f3ac9;};'use strict';var util=require(_0xa469('0x0'));var _=require('lodash');var moment=require(_0xa469('0x1'));function getSeconds(_0x2c2e46,_0x49bbf2){var _0x2d45ee=moment(_0x2c2e46)[_0xa469('0x2')](0x0);var _0x1e34b5=moment(_0x49bbf2)[_0xa469('0x2')](0x0);return _0x2d45ee[_0xa469('0x3')](_0x1e34b5,'seconds');}function QueueCallerAbandon(_0x57c511,_0x462236){this[_0xa469('0x4')]=_0x57c511['scheduledat'];this[_0xa469('0x5')]=_0x57c511[_0xa469('0x5')];this[_0xa469('0x6')]=_0x57c511[_0xa469('0x5')]===_0xa469('0x7')?_0xa469('0x8'):_0x57c511['type'];this[_0xa469('0x9')]=_0x57c511[_0xa469('0x9')];this[_0xa469('0xa')]=_0x57c511[_0xa469('0xa')];this[_0xa469('0xb')]=_0x57c511[_0xa469('0xb')];this[_0xa469('0xc')]=_0x57c511[_0xa469('0x9')]+_0x57c511[_0xa469('0xa')]+_0x57c511[_0xa469('0xb')]+_0x57c511[_0xa469('0xd')]+_0x57c511[_0xa469('0xe')]+_0x57c511[_0xa469('0xf')]+_0x57c511[_0xa469('0x10')]+_0x57c511[_0xa469('0x11')];this[_0xa469('0xd')]=_0x57c511[_0xa469('0xd')];this['countdropretry']=_0x57c511[_0xa469('0xe')];this[_0xa469('0xf')]=_0x57c511[_0xa469('0xf')];this['countmachineretry']=_0x57c511[_0xa469('0x10')];this[_0xa469('0x11')]=_0x57c511[_0xa469('0x11')];this[_0xa469('0x12')]=_0x462236[_0xa469('0x12')];this[_0xa469('0x13')]=_0x57c511['name'];this['calleridnum']=_0x57c511[_0xa469('0x14')];this[_0xa469('0x15')]=_0x57c511[_0xa469('0x15')];this[_0xa469('0x16')]=_0x57c511['responsetime'];this[_0xa469('0x17')]=_0x57c511[_0xa469('0x17')];this[_0xa469('0x18')]=this[_0xa469('0x17')];this[_0xa469('0x19')]=getSeconds(_0x57c511[_0xa469('0x16')],_0x57c511[_0xa469('0x15')]);this[_0xa469('0x1a')]=getSeconds(this[_0xa469('0x17')],_0x57c511[_0xa469('0x16')]);this[_0xa469('0x1b')]=0x0;this[_0xa469('0x8')]=_0x462236[_0xa469('0x8')];this['membername']=_0x462236[_0xa469('0x1c')];this[_0xa469('0x1d')]=_0x462236[_0xa469('0x1d')];this[_0xa469('0x1e')]=_0x57c511['callback'];this[_0xa469('0x1f')]=_0x57c511[_0xa469('0x1f')];this['callbackat']=_0x57c511[_0xa469('0x20')];this[_0xa469('0x21')]=_0x57c511[_0xa469('0x21')];this[_0xa469('0x22')]=_0x57c511[_0xa469('0x22')];this[_0xa469('0x23')]=_0x57c511[_0xa469('0x23')];this[_0xa469('0x24')]=_0x57c511[_0xa469('0x24')];this['VoiceQueueId']=_0x57c511['VoiceQueueId'];this[_0xa469('0x25')]=_0x57c511['CampaignId'];this[_0xa469('0x26')]=_0x57c511[_0xa469('0x26')]||'';this['originatecalleridname']=_0x57c511['originatecalleridname']||'';}module[_0xa469('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x5075=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x423c33,_0x42ec5e){var _0x1e2f06=function(_0x4585cb){while(--_0x4585cb){_0x423c33['push'](_0x423c33['shift']());}};_0x1e2f06(++_0x42ec5e);}(_0x5075,0x73));var _0x5507=function(_0x20a1b0,_0x18fe84){_0x20a1b0=_0x20a1b0-0x0;var _0x321e14=_0x5075[_0x20a1b0];return _0x321e14;};'use strict';var util=require(_0x5507('0x0'));var _=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));function getSeconds(_0x1a552a,_0x3ec62f){var _0x2b444e=moment(_0x1a552a)[_0x5507('0x3')](0x0);var _0x518ca7=moment(_0x3ec62f)[_0x5507('0x3')](0x0);return _0x2b444e[_0x5507('0x4')](_0x518ca7,_0x5507('0x5'));}function QueueCallerAbandon(_0x54267f,_0x5b6d7f){this[_0x5507('0x6')]=_0x54267f[_0x5507('0x6')];this['type']=_0x54267f[_0x5507('0x7')];this[_0x5507('0x8')]=_0x54267f[_0x5507('0x7')]==='outbound'?'queue':_0x54267f[_0x5507('0x7')];this[_0x5507('0x9')]=_0x54267f[_0x5507('0x9')];this[_0x5507('0xa')]=_0x54267f['countcongestionretry'];this[_0x5507('0xb')]=_0x54267f[_0x5507('0xb')];this['countglobal']=_0x54267f[_0x5507('0x9')]+_0x54267f[_0x5507('0xa')]+_0x54267f['countnoanswerretry']+_0x54267f[_0x5507('0xc')]+_0x54267f[_0x5507('0xd')]+_0x54267f[_0x5507('0xe')]+_0x54267f[_0x5507('0xf')]+_0x54267f[_0x5507('0x10')];this[_0x5507('0xc')]=_0x54267f['countnosuchnumberretry'];this[_0x5507('0xd')]=_0x54267f[_0x5507('0xd')];this[_0x5507('0xe')]=_0x54267f[_0x5507('0xe')];this['countmachineretry']=_0x54267f[_0x5507('0xf')];this[_0x5507('0x10')]=_0x54267f[_0x5507('0x10')];this[_0x5507('0x11')]=_0x5b6d7f[_0x5507('0x11')];this[_0x5507('0x12')]=_0x54267f[_0x5507('0x13')];this[_0x5507('0x14')]=_0x54267f[_0x5507('0x15')];this[_0x5507('0x16')]=_0x54267f[_0x5507('0x16')];this[_0x5507('0x17')]=_0x54267f[_0x5507('0x17')];this['droptime']=_0x54267f[_0x5507('0x18')];this[_0x5507('0x19')]=this[_0x5507('0x18')];this[_0x5507('0x1a')]=getSeconds(_0x54267f['responsetime'],_0x54267f[_0x5507('0x16')]);this[_0x5507('0x1b')]=getSeconds(this[_0x5507('0x18')],_0x54267f[_0x5507('0x17')]);this[_0x5507('0x1c')]=0x0;this[_0x5507('0x1d')]=_0x5b6d7f['queue'];this[_0x5507('0x1e')]=_0x5b6d7f[_0x5507('0x1f')];this[_0x5507('0x20')]=_0x5b6d7f[_0x5507('0x20')];this[_0x5507('0x21')]=_0x54267f[_0x5507('0x21')];this[_0x5507('0x22')]=_0x54267f[_0x5507('0x22')];this[_0x5507('0x23')]=_0x54267f[_0x5507('0x23')];this[_0x5507('0x24')]=_0x54267f[_0x5507('0x24')];this[_0x5507('0x25')]=_0x54267f[_0x5507('0x25')];this[_0x5507('0x26')]=_0x54267f['ListId'];this[_0x5507('0x27')]=_0x54267f['UserId'];this[_0x5507('0x28')]=_0x54267f['VoiceQueueId'];this[_0x5507('0x29')]=_0x54267f[_0x5507('0x29')];this['originatecalleridnum']=_0x54267f['originatecalleridnum']||'';this[_0x5507('0x2a')]=_0x54267f[_0x5507('0x2a')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ae4057d..70156ea 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(_0x47396f,_0x48ecca){var _0x3c4e36=function(_0x2f65eb){while(--_0x2f65eb){_0x47396f['push'](_0x47396f['shift']());}};_0x3c4e36(++_0x48ecca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x43c211,_0x300db3){var _0x514efc=function(_0x30e1cd){while(--_0x30e1cd){_0x43c211['push'](_0x43c211['shift']());}};_0x514efc(++_0x300db3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 a495dfc..2dca7d6 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 _0x6fd6=['isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','name','\x20syncNewchannel\x20','channel','info','prototype','variable','value','channelstate','channelstatedesc','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','stringify','error','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6fd6,0x86));var _0x66fd=function(_0x5882f4,_0x2865d8){_0x5882f4=_0x5882f4-0x0;var _0x3c32e0=_0x6fd6[_0x5882f4];return _0x3c32e0;};'use strict';var util=require(_0x66fd('0x0'));var _=require(_0x66fd('0x1'));var BPromise=require(_0x66fd('0x2'));var uuid=require(_0x66fd('0x3'));var moment=require(_0x66fd('0x4'));var path=require(_0x66fd('0x5'));var tiff2pdf=require(_0x66fd('0x6'));var gs=require(_0x66fd('0x7'));var logger=require('../../../config/logger')(_0x66fd('0x8'));var ami=require(_0x66fd('0x9'));var rpcDb=require(_0x66fd('0xa'));var Channel=require(_0x66fd('0xb'));var ut=require(_0x66fd('0xc'));var Action=require(_0x66fd('0xd'));var faxAccount=require(_0x66fd('0xe'));var attachment=require(_0x66fd('0xf'));var faxMessage=require(_0x66fd('0x10'));function Fax(_0x4c5ced){this['channels']={};this[_0x66fd('0x11')]=_0x4c5ced['faxAccounts'];this['trunks']=_0x4c5ced[_0x66fd('0x12')];this[_0x66fd('0x13')]={};ami['on'](_0x66fd('0x14'),this[_0x66fd('0x15')]['bind'](this));ami['on'](_0x66fd('0x16'),this[_0x66fd('0x17')]['bind'](this));ami['on'](_0x66fd('0x18'),this[_0x66fd('0x19')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x1b'),this[_0x66fd('0x1c')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x1d'),this[_0x66fd('0x1e')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x1f'),this[_0x66fd('0x20')][_0x66fd('0x1a')](this));ami['on'](_0x66fd('0x21'),this[_0x66fd('0x22')]['bind'](this));ami['on']('originateresponse',this[_0x66fd('0x23')][_0x66fd('0x1a')](this));}Fax['prototype']['syncNewchannel']=function(_0x3373f1){if(_0x3373f1[_0x66fd('0x24')]===_0x66fd('0x25')){for(var _0x36b400 in this[_0x66fd('0x11')]){if(this['faxAccounts'][_0x66fd('0x26')](_0x36b400)){if(_0x3373f1['exten']===this['faxAccounts'][_0x36b400][_0x66fd('0x27')]){this[_0x66fd('0x28')][_0x3373f1[_0x66fd('0x29')]]={};this['channels'][_0x3373f1[_0x66fd('0x29')]]['channel']=_0x3373f1['channel'];this[_0x66fd('0x28')][_0x3373f1[_0x66fd('0x29')]]['id']=this[_0x66fd('0x11')][_0x36b400]['id'];this['channels'][_0x3373f1[_0x66fd('0x29')]][_0x66fd('0x2a')]=this[_0x66fd('0x11')][_0x36b400][_0x66fd('0x2a')];logger['info'](_0x3373f1[_0x66fd('0x29')],_0x66fd('0x2b'));}}}}if(this[_0x66fd('0x13')][_0x3373f1[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x3373f1[_0x66fd('0x29')]]={};this['channels'][_0x3373f1['uniqueid']][_0x66fd('0x2c')]=_0x3373f1[_0x66fd('0x2c')];logger[_0x66fd('0x2d')](_0x3373f1[_0x66fd('0x29')],_0x66fd('0x2b'));}};Fax[_0x66fd('0x2e')][_0x66fd('0x17')]=function(_0x43cdc0){if(this[_0x66fd('0x28')][_0x43cdc0['uniqueid']]){for(var _0x2a786d in _0x43cdc0[_0x66fd('0x2f')]){if(_0x43cdc0[_0x66fd('0x2f')][_0x66fd('0x26')](_0x2a786d)){this[_0x66fd('0x28')][_0x43cdc0[_0x66fd('0x29')]][_0x2a786d]=_0x43cdc0[_0x66fd('0x30')];}}}};Fax[_0x66fd('0x2e')][_0x66fd('0x19')]=function(_0x237b24){if(this[_0x66fd('0x28')][_0x237b24[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x237b24[_0x66fd('0x29')]]['channelstate']=_0x237b24[_0x66fd('0x31')];this[_0x66fd('0x28')][_0x237b24[_0x66fd('0x29')]][_0x66fd('0x32')]=_0x237b24[_0x66fd('0x32')];}};Fax[_0x66fd('0x2e')][_0x66fd('0x1c')]=function(_0x2776b1){if(this[_0x66fd('0x28')][_0x2776b1[_0x66fd('0x29')]]){for(var _0x3f96df in _0x2776b1[_0x66fd('0x2f')]){if(_0x2776b1[_0x66fd('0x2f')]['hasOwnProperty'](_0x3f96df)){this[_0x66fd('0x28')][_0x2776b1[_0x66fd('0x29')]][_0x3f96df]=_0x2776b1[_0x66fd('0x30')];}}}};Fax[_0x66fd('0x2e')]['syncFaxStatus']=function(_0x67d7c6){if(this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]][_0x66fd('0x33')]=_0x67d7c6[_0x66fd('0x33')];this[_0x66fd('0x28')][_0x67d7c6['uniqueid']]['status']=_0x67d7c6['status'];this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]][_0x66fd('0x27')]=_0x67d7c6[_0x66fd('0x27')];this[_0x66fd('0x28')][_0x67d7c6[_0x66fd('0x29')]][_0x66fd('0x34')]=_0x67d7c6[_0x66fd('0x34')];logger[_0x66fd('0x2d')](_0x67d7c6['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x66fd('0x2e')][_0x66fd('0x20')]=function(_0x41a407){var _0x283b6c=this;if(this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]){var _0x4de7f2=this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['id'];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x35')]=_0x41a407[_0x66fd('0x35')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['pagestransferred']=_0x41a407[_0x66fd('0x36')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x27')]=_0x41a407[_0x66fd('0x27')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x37')]=_0x41a407[_0x66fd('0x37')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['transferrate']=_0x41a407[_0x66fd('0x38')];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x34')]=_0x41a407['filename'];this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]][_0x66fd('0x39')]=_0x41a407[_0x66fd('0x39')];if(this[_0x66fd('0x28')][_0x41a407[_0x66fd('0x29')]]['pagestransferred']>0x0){tiff2pdf(_0x41a407[_0x66fd('0x34')],_0x66fd('0x3a'),function(_0x54307f){logger[_0x66fd('0x2d')](_0x41a407[_0x66fd('0x29')],_0x66fd('0x3b'),_0x54307f[_0x66fd('0x3c')]);attachment[_0x66fd('0x3d')]({'name':path['parse'](_0x41a407[_0x66fd('0x34')])[_0x66fd('0x2a')],'basename':path[_0x66fd('0x3e')](_0x41a407[_0x66fd('0x34')])[_0x66fd('0x2a')]+_0x66fd('0x3f'),'type':'application/pdf'})[_0x66fd('0x40')](function(_0x52ea28){faxAccount['notify'](_0x4de7f2,{'from':_0x41a407[_0x66fd('0x39')],'mapKey':_0x66fd('0x8'),'body':path[_0x66fd('0x3e')](_0x41a407[_0x66fd('0x34')])['name']+_0x66fd('0x3f'),'AttachmentId':_0x52ea28['id']})['catch'](function(_0x54c56d){logger['error'](_0x41a407[_0x66fd('0x29')],'\x20notify\x20',JSON[_0x66fd('0x41')](_0x54c56d));});})['catch'](function(_0x3db31e){logger[_0x66fd('0x42')](_0x41a407['uniqueid'],_0x66fd('0x43'),JSON[_0x66fd('0x41')](_0x3db31e));});});}logger[_0x66fd('0x2d')](_0x41a407[_0x66fd('0x29')],_0x66fd('0x43'));}};Fax[_0x66fd('0x2e')]['syncOriginateResponse']=function(_0x51d3cf){if(this[_0x66fd('0x13')][_0x51d3cf[_0x66fd('0x29')]]){_[_0x66fd('0x44')](this[_0x66fd('0x28')][_0x51d3cf[_0x66fd('0x29')]],_[_0x66fd('0x45')](_0x51d3cf,[_0x66fd('0x46'),_0x66fd('0x47')]));}};function updateStatus(_0x3c3e77){if(_0x3c3e77['AttachmentId']){faxMessage[_0x66fd('0x48')](_0x3c3e77[_0x66fd('0x49')],{'failMessage':_0x66fd('0x4a')})[_0x66fd('0x40')](function(_0x14fd90){ut[_0x66fd('0x4b')](_0x66fd('0x4c'),_0x14fd90);})[_0x66fd('0x4d')](function(_0x12ed5a){ut[_0x66fd('0x4b')](_0x66fd('0x4e'),_0x12ed5a);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x66fd('0x4f')]=function(_0x1f6187,_0x1146e2,_0x86493a){var _0x35aa05=this;var _0x38c20d={};if(_0x1146e2){_0x38c20d={'read':_0x1146e2};}else{_0x38c20d={'failMessage':_0x86493a};}if(this[_0x66fd('0x13')][_0x1f6187]['AttachmentId']){faxMessage[_0x66fd('0x48')](this[_0x66fd('0x13')][_0x1f6187][_0x66fd('0x49')],_0x38c20d)[_0x66fd('0x40')](function(_0x14182c){ut[_0x66fd('0x4b')]('[Fax][Message][Updated]',_0x14182c);})[_0x66fd('0x4d')](function(_0x43ee04){ut[_0x66fd('0x4b')](_0x66fd('0x50'),_0x43ee04);})[_0x66fd('0x51')](function(){delete _0x35aa05[_0x66fd('0x28')][_0x1f6187];delete _0x35aa05[_0x66fd('0x13')][_0x1f6187];});}else{ut[_0x66fd('0x4b')](_0x66fd('0x52'));delete this[_0x66fd('0x28')][_0x1f6187];delete this[_0x66fd('0x13')][_0x1f6187];}};Fax[_0x66fd('0x2e')][_0x66fd('0x22')]=function(_0x521614){var _0x5c01b2=this;if(this[_0x66fd('0x28')][_0x521614[_0x66fd('0x29')]]){if(this[_0x66fd('0x13')][_0x521614[_0x66fd('0x29')]]){this[_0x66fd('0x28')][_0x521614['uniqueid']]['id']=this[_0x66fd('0x13')][_0x521614[_0x66fd('0x29')]]['id'];this[_0x66fd('0x28')][_0x521614[_0x66fd('0x29')]][_0x66fd('0x2a')]=this['actions'][_0x521614[_0x66fd('0x29')]][_0x66fd('0x2a')];}logger[_0x66fd('0x2d')](_0x521614[_0x66fd('0x29')],this[_0x66fd('0x13')][_0x521614['uniqueid']]?_0x66fd('0x53'):_0x66fd('0x54'),JSON[_0x66fd('0x41')](this[_0x66fd('0x28')][_0x521614['uniqueid']]));if(this[_0x66fd('0x13')][_0x521614[_0x66fd('0x29')]]){if(this['channels'][_0x521614[_0x66fd('0x29')]]['faxpages']>0x0&&this['channels'][_0x521614['uniqueid']][_0x66fd('0x1d')]===_0x66fd('0x55')){this[_0x66fd('0x4f')](_0x521614[_0x66fd('0x29')],!![]);}else{this[_0x66fd('0x4f')](_0x521614[_0x66fd('0x29')],![],this[_0x66fd('0x28')][_0x521614[_0x66fd('0x29')]][_0x66fd('0x56')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x521614[_0x66fd('0x29')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x66fd('0x2e')][_0x66fd('0x57')]=function(_0x388cda){var _0x26f192=this;return new BPromise(function(_0x5e6211,_0x584ffb){_0x26f192[_0x66fd('0x58')](_0x388cda,_0x26f192[_0x66fd('0x11')][_0x388cda['FaxAccountId']])[_0x66fd('0x40')](function(_0x18fbb5){ut[_0x66fd('0x4b')](_0x66fd('0x59'),_0x18fbb5);_0x5e6211(ut[_0x66fd('0x3c')](_0x66fd('0x5a')));})[_0x66fd('0x4d')](function(_0x171b36){ut[_0x66fd('0x4b')](_0x66fd('0x5b'),_0x171b36);updateStatus(_0x388cda);_0x584ffb(ut[_0x66fd('0x3c')](_0x66fd('0x5c')));});});};Fax[_0x66fd('0x2e')]['checkAfterSend']=function(_0x5a4ed8){var _0x4ad395=this;return new BPromise(function(_0x285e6d,_0x40638d){var _0x57ad66=_0x4ad395[_0x66fd('0x5d')](_0x4ad395[_0x66fd('0x11')][_0x5a4ed8['FaxAccountId']][_0x66fd('0x5e')],_0x5a4ed8);if(_0x57ad66['isValid']){_0x285e6d(ut['message']('Trunk\x20Reachable'));}else{_0x40638d(ut[_0x66fd('0x3c')](_0x57ad66['message']));}});};function originate(_0x5e26df,_0x325d13,_0x22a7e3){return new BPromise(function(_0x5bb1f7,_0x53b0e0){if(_0x22a7e3){var _0x995762=util[_0x66fd('0x5f')](_0x66fd('0x60'),path[_0x66fd('0x3e')](_0x5e26df[_0x66fd('0x5')])[_0x66fd('0x2a')],_0x5e26df[_0x66fd('0x5')]);gs[_0x66fd('0x61')](_0x995762)[_0x66fd('0x40')](function(){_0x5e26df[_0x66fd('0x5')]=util[_0x66fd('0x5f')]('%s/%s.tif',path[_0x66fd('0x3e')](_0x5e26df[_0x66fd('0x5')])['dir'],path[_0x66fd('0x3e')](_0x5e26df[_0x66fd('0x5')])[_0x66fd('0x2a')]);_0x325d13[_0x66fd('0x62')]=_0x5e26df[_0x66fd('0x5')];ut['logger'](_0x66fd('0x63'),'');ami[_0x66fd('0x64')](ut[_0x66fd('0x65')](_0x5e26df,_0x325d13))[_0x66fd('0x40')](function(_0x3d591f){_0x5bb1f7(_0x3d591f);})['catch'](function(_0x3e1a8b){_0x53b0e0(_0x3e1a8b);});})[_0x66fd('0x4d')](function(_0x4026cb){_0x53b0e0(_0x4026cb);});}else{ami[_0x66fd('0x64')](ut[_0x66fd('0x65')](_0x5e26df,_0x325d13))[_0x66fd('0x40')](function(_0x2b2b90){_0x5bb1f7(_0x2b2b90);})['catch'](function(_0x5c6b7d){_0x53b0e0(_0x5c6b7d);});}});}Fax[_0x66fd('0x2e')][_0x66fd('0x58')]=function(_0x2c1b78,_0x5be9d1){var _0x54b866=this;return new BPromise(function(_0x486200,_0x415a53){var _0x5956a2=uuid['v4']();var _0x575a80=ut[_0x66fd('0x66')](_0x2c1b78,_0x5be9d1);_0x54b866[_0x66fd('0x13')][_0x5956a2]=new Action(_0x5956a2,_0x5be9d1,_0x2c1b78);var _0x1f330e=_0x54b866[_0x66fd('0x13')][_0x5956a2];if(path[_0x66fd('0x3e')](_0x2c1b78[_0x66fd('0x5')])[_0x66fd('0x67')]===_0x66fd('0x3f')){originate(_0x1f330e,_0x575a80,!![])[_0x66fd('0x40')](function(_0x47fe2a){_0x486200(_0x47fe2a);})[_0x66fd('0x4d')](function(_0x3cfe62){_0x415a53(_0x3cfe62);});}else{originate(_0x1f330e,_0x575a80,![])['then'](function(_0x133d35){_0x486200(_0x133d35);})[_0x66fd('0x4d')](function(_0x460f9b){_0x415a53(_0x460f9b);});}});};Fax[_0x66fd('0x2e')][_0x66fd('0x68')]=function(_0x12437f){return!_[_0x66fd('0x69')](_0x12437f)&&!_['isNil'](_0x12437f[_0x66fd('0x2a')])&&!_[_0x66fd('0x69')](_0x12437f['active'])&&_0x12437f[_0x66fd('0x6a')]&&!_[_0x66fd('0x69')](this['trunks'][util['format'](_0x66fd('0x6b'),_0x12437f[_0x66fd('0x2a')])])&&!_[_0x66fd('0x69')](this[_0x66fd('0x12')][util['format']('SIP/%s',_0x12437f[_0x66fd('0x2a')])][_0x66fd('0x6c')])&&(this['trunks'][util['format'](_0x66fd('0x6b'),_0x12437f[_0x66fd('0x2a')])][_0x66fd('0x6c')]===_0x66fd('0x6d')||this[_0x66fd('0x12')][util[_0x66fd('0x5f')]('SIP/%s',_0x12437f['name'])]['status']===_0x66fd('0x6e'));};Fax['prototype']['checkTrunk']=function(_0x439fbc,_0x14b3f3){if(!this['isTrunkReachable'](_0x439fbc)){ut[_0x66fd('0x4b')](_0x66fd('0x6f'),_[_0x66fd('0x69')](_0x439fbc)?'':_0x439fbc[_0x66fd('0x2a')]+_0x66fd('0x70'));return{'isValid':![],'message':_0x66fd('0x71')};}if(_[_0x66fd('0x69')](_0x14b3f3[_0x66fd('0x8')])){ut['logger'](_0x66fd('0x72'),JSON[_0x66fd('0x41')](_0x14b3f3));return{'isValid':![],'message':_0x66fd('0x73')};}if(_[_0x66fd('0x69')](_0x14b3f3[_0x66fd('0x5')])){ut['logger'](_0x66fd('0x74'),JSON['stringify'](_0x14b3f3));return{'isValid':![],'message':_0x66fd('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x66fd('0x76')]=Fax; \ No newline at end of file +var _0x39bb=['\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','info','merge','pick','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','uuid','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name'];(function(_0x4297af,_0x2882f5){var _0x10ad5d=function(_0x452a2a){while(--_0x452a2a){_0x4297af['push'](_0x4297af['shift']());}};_0x10ad5d(++_0x2882f5);}(_0x39bb,0x1a6));var _0xb39b=function(_0x2c43f8,_0x261d10){_0x2c43f8=_0x2c43f8-0x0;var _0x3c0c0f=_0x39bb[_0x2c43f8];return _0x3c0c0f;};'use strict';var util=require(_0xb39b('0x0'));var _=require('lodash');var BPromise=require(_0xb39b('0x1'));var uuid=require(_0xb39b('0x2'));var moment=require('moment');var path=require(_0xb39b('0x3'));var tiff2pdf=require(_0xb39b('0x4'));var gs=require(_0xb39b('0x5'));var logger=require('../../../config/logger')(_0xb39b('0x6'));var ami=require('../ami');var rpcDb=require(_0xb39b('0x7'));var Channel=require(_0xb39b('0x8'));var ut=require('./util/util');var Action=require(_0xb39b('0x9'));var faxAccount=require(_0xb39b('0xa'));var attachment=require(_0xb39b('0xb'));var faxMessage=require(_0xb39b('0xc'));function Fax(_0x3a7252){this['channels']={};this['faxAccounts']=_0x3a7252[_0xb39b('0xd')];this['trunks']=_0x3a7252[_0xb39b('0xe')];this[_0xb39b('0xf')]={};ami['on'](_0xb39b('0x10'),this[_0xb39b('0x11')][_0xb39b('0x12')](this));ami['on'](_0xb39b('0x13'),this['syncVarSet'][_0xb39b('0x12')](this));ami['on'](_0xb39b('0x14'),this[_0xb39b('0x15')][_0xb39b('0x12')](this));ami['on'](_0xb39b('0x16'),this['syncNewExten'][_0xb39b('0x12')](this));ami['on']('faxstatus',this[_0xb39b('0x17')][_0xb39b('0x12')](this));ami['on']('receivefax',this[_0xb39b('0x18')][_0xb39b('0x12')](this));ami['on'](_0xb39b('0x19'),this[_0xb39b('0x1a')]['bind'](this));ami['on'](_0xb39b('0x1b'),this[_0xb39b('0x1c')][_0xb39b('0x12')](this));}Fax[_0xb39b('0x1d')][_0xb39b('0x11')]=function(_0x32fa90){if(_0x32fa90[_0xb39b('0x1e')]==='from-voip-provider'){for(var _0x4b2814 in this[_0xb39b('0xd')]){if(this[_0xb39b('0xd')][_0xb39b('0x1f')](_0x4b2814)){if(_0x32fa90[_0xb39b('0x20')]===this[_0xb39b('0xd')][_0x4b2814][_0xb39b('0x21')]){this[_0xb39b('0x22')][_0x32fa90[_0xb39b('0x23')]]={};this[_0xb39b('0x22')][_0x32fa90[_0xb39b('0x23')]]['channel']=_0x32fa90[_0xb39b('0x24')];this[_0xb39b('0x22')][_0x32fa90[_0xb39b('0x23')]]['id']=this[_0xb39b('0xd')][_0x4b2814]['id'];this['channels'][_0x32fa90[_0xb39b('0x23')]][_0xb39b('0x25')]=this[_0xb39b('0xd')][_0x4b2814][_0xb39b('0x25')];logger['info'](_0x32fa90[_0xb39b('0x23')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x32fa90[_0xb39b('0x23')]]){this['channels'][_0x32fa90[_0xb39b('0x23')]]={};this['channels'][_0x32fa90['uniqueid']][_0xb39b('0x24')]=_0x32fa90[_0xb39b('0x24')];logger['info'](_0x32fa90['uniqueid'],_0xb39b('0x26'));}};Fax[_0xb39b('0x1d')]['syncVarSet']=function(_0xa52baa){if(this[_0xb39b('0x22')][_0xa52baa['uniqueid']]){for(var _0x2b7cb8 in _0xa52baa[_0xb39b('0x27')]){if(_0xa52baa[_0xb39b('0x27')]['hasOwnProperty'](_0x2b7cb8)){this['channels'][_0xa52baa[_0xb39b('0x23')]][_0x2b7cb8]=_0xa52baa[_0xb39b('0x28')];}}}};Fax[_0xb39b('0x1d')][_0xb39b('0x15')]=function(_0x21ff9c){if(this[_0xb39b('0x22')][_0x21ff9c['uniqueid']]){this[_0xb39b('0x22')][_0x21ff9c[_0xb39b('0x23')]]['channelstate']=_0x21ff9c[_0xb39b('0x29')];this[_0xb39b('0x22')][_0x21ff9c[_0xb39b('0x23')]][_0xb39b('0x2a')]=_0x21ff9c['channelstatedesc'];}};Fax['prototype'][_0xb39b('0x2b')]=function(_0x3bb7a8){if(this[_0xb39b('0x22')][_0x3bb7a8[_0xb39b('0x23')]]){for(var _0x45c959 in _0x3bb7a8[_0xb39b('0x27')]){if(_0x3bb7a8['variable'][_0xb39b('0x1f')](_0x45c959)){this[_0xb39b('0x22')][_0x3bb7a8[_0xb39b('0x23')]][_0x45c959]=_0x3bb7a8[_0xb39b('0x28')];}}}};Fax['prototype'][_0xb39b('0x17')]=function(_0x5a12e6){if(this['channels'][_0x5a12e6[_0xb39b('0x23')]]){this[_0xb39b('0x22')][_0x5a12e6['uniqueid']][_0xb39b('0x2c')]=_0x5a12e6[_0xb39b('0x2c')];this[_0xb39b('0x22')][_0x5a12e6['uniqueid']][_0xb39b('0x2d')]=_0x5a12e6['status'];this[_0xb39b('0x22')][_0x5a12e6[_0xb39b('0x23')]]['localstationid']=_0x5a12e6[_0xb39b('0x21')];this[_0xb39b('0x22')][_0x5a12e6['uniqueid']][_0xb39b('0x2e')]=_0x5a12e6[_0xb39b('0x2e')];logger['info'](_0x5a12e6[_0xb39b('0x23')],_0xb39b('0x2f'));}};Fax[_0xb39b('0x1d')]['syncReceiveFax']=function(_0xfdcaea){var _0x1e22d8=this;if(this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]]){var _0x397e55=this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]]['id'];this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]][_0xb39b('0x30')]=_0xfdcaea[_0xb39b('0x30')];this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]][_0xb39b('0x31')]=_0xfdcaea[_0xb39b('0x31')];this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]][_0xb39b('0x21')]=_0xfdcaea['localstationid'];this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]][_0xb39b('0x32')]=_0xfdcaea[_0xb39b('0x32')];this[_0xb39b('0x22')][_0xfdcaea['uniqueid']][_0xb39b('0x33')]=_0xfdcaea[_0xb39b('0x33')];this[_0xb39b('0x22')][_0xfdcaea['uniqueid']][_0xb39b('0x2e')]=_0xfdcaea[_0xb39b('0x2e')];this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]][_0xb39b('0x34')]=_0xfdcaea[_0xb39b('0x34')];if(this[_0xb39b('0x22')][_0xfdcaea[_0xb39b('0x23')]][_0xb39b('0x31')]>0x0){tiff2pdf(_0xfdcaea[_0xb39b('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x4b983e){logger['info'](_0xfdcaea['uniqueid'],_0xb39b('0x35'),_0x4b983e[_0xb39b('0x36')]);attachment['create']({'name':path[_0xb39b('0x37')](_0xfdcaea[_0xb39b('0x2e')])[_0xb39b('0x25')],'basename':path[_0xb39b('0x37')](_0xfdcaea[_0xb39b('0x2e')])[_0xb39b('0x25')]+_0xb39b('0x38'),'type':_0xb39b('0x39')})[_0xb39b('0x3a')](function(_0x1e5cc4){faxAccount['notify'](_0x397e55,{'from':_0xfdcaea[_0xb39b('0x34')],'mapKey':_0xb39b('0x6'),'body':path['parse'](_0xfdcaea[_0xb39b('0x2e')])[_0xb39b('0x25')]+'.pdf','AttachmentId':_0x1e5cc4['id']})[_0xb39b('0x3b')](function(_0x2be532){logger[_0xb39b('0x3c')](_0xfdcaea[_0xb39b('0x23')],_0xb39b('0x3d'),JSON[_0xb39b('0x3e')](_0x2be532));});})[_0xb39b('0x3b')](function(_0x382fbd){logger[_0xb39b('0x3c')](_0xfdcaea[_0xb39b('0x23')],_0xb39b('0x3f'),JSON[_0xb39b('0x3e')](_0x382fbd));});});}logger[_0xb39b('0x40')](_0xfdcaea[_0xb39b('0x23')],_0xb39b('0x3f'));}};Fax[_0xb39b('0x1d')]['syncOriginateResponse']=function(_0x2e59c3){if(this[_0xb39b('0xf')][_0x2e59c3[_0xb39b('0x23')]]){_[_0xb39b('0x41')](this[_0xb39b('0x22')][_0x2e59c3[_0xb39b('0x23')]],_[_0xb39b('0x42')](_0x2e59c3,[_0xb39b('0x43'),_0xb39b('0x44')]));}};function updateStatus(_0x2b278f){if(_0x2b278f['AttachmentId']){faxMessage[_0xb39b('0x45')](_0x2b278f[_0xb39b('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x1bd343){ut[_0xb39b('0x47')](_0xb39b('0x48'),_0x1bd343);})[_0xb39b('0x3b')](function(_0x409c5e){ut[_0xb39b('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x409c5e);});}else{ut[_0xb39b('0x47')](_0xb39b('0x49'));}}Fax[_0xb39b('0x1d')][_0xb39b('0x4a')]=function(_0x30680c,_0x17738e,_0x5c8779){var _0x100319=this;var _0xf89e06={};if(_0x17738e){_0xf89e06={'read':_0x17738e};}else{_0xf89e06={'failMessage':_0x5c8779};}if(this[_0xb39b('0xf')][_0x30680c][_0xb39b('0x46')]){faxMessage[_0xb39b('0x45')](this[_0xb39b('0xf')][_0x30680c][_0xb39b('0x46')],_0xf89e06)[_0xb39b('0x3a')](function(_0x1f267c){ut['logger'](_0xb39b('0x4b'),_0x1f267c);})[_0xb39b('0x3b')](function(_0x77a7fa){ut['logger']('[Fax][Message][NoUpdate1]',_0x77a7fa);})['finally'](function(){delete _0x100319[_0xb39b('0x22')][_0x30680c];delete _0x100319[_0xb39b('0xf')][_0x30680c];});}else{ut[_0xb39b('0x47')](_0xb39b('0x4c'));delete this[_0xb39b('0x22')][_0x30680c];delete this[_0xb39b('0xf')][_0x30680c];}};Fax['prototype'][_0xb39b('0x1a')]=function(_0x250d10){var _0x474362=this;if(this[_0xb39b('0x22')][_0x250d10[_0xb39b('0x23')]]){if(this[_0xb39b('0xf')][_0x250d10[_0xb39b('0x23')]]){this[_0xb39b('0x22')][_0x250d10[_0xb39b('0x23')]]['id']=this[_0xb39b('0xf')][_0x250d10['uniqueid']]['id'];this['channels'][_0x250d10[_0xb39b('0x23')]][_0xb39b('0x25')]=this[_0xb39b('0xf')][_0x250d10[_0xb39b('0x23')]][_0xb39b('0x25')];}logger['info'](_0x250d10['uniqueid'],this[_0xb39b('0xf')][_0x250d10['uniqueid']]?_0xb39b('0x4d'):_0xb39b('0x4e'),JSON['stringify'](this['channels'][_0x250d10[_0xb39b('0x23')]]));if(this[_0xb39b('0xf')][_0x250d10[_0xb39b('0x23')]]){if(this[_0xb39b('0x22')][_0x250d10[_0xb39b('0x23')]][_0xb39b('0x4f')]>0x0&&this[_0xb39b('0x22')][_0x250d10[_0xb39b('0x23')]][_0xb39b('0x50')]===_0xb39b('0x51')){this[_0xb39b('0x4a')](_0x250d10[_0xb39b('0x23')],!![]);}else{this[_0xb39b('0x4a')](_0x250d10[_0xb39b('0x23')],![],this['channels'][_0x250d10[_0xb39b('0x23')]][_0xb39b('0x52')]?_0xb39b('0x53')+this[_0xb39b('0x22')][_0x250d10[_0xb39b('0x23')]][_0xb39b('0x52')]:_0xb39b('0x54'));}}}};Fax[_0xb39b('0x1d')][_0xb39b('0x55')]=function(_0x3b86b6){var _0x498333=this;return new BPromise(function(_0xd5e4a4,_0x5c9f17){_0x498333[_0xb39b('0x56')](_0x3b86b6,_0x498333[_0xb39b('0xd')][_0x3b86b6[_0xb39b('0x57')]])[_0xb39b('0x3a')](function(_0x170a7f){ut['logger']('[Fax][execOriginate][success]',_0x170a7f);_0xd5e4a4(ut['message']('Fax\x20received'));})['catch'](function(_0x492232){ut[_0xb39b('0x47')](_0xb39b('0x58'),_0x492232);updateStatus(_0x3b86b6);_0x5c9f17(ut[_0xb39b('0x36')](_0xb39b('0x59')));});});};Fax[_0xb39b('0x1d')][_0xb39b('0x5a')]=function(_0x50ffe2){var _0x275353=this;return new BPromise(function(_0x44fd30,_0xff66d0){var _0xd432ce=_0x275353[_0xb39b('0x5b')](_0x275353['faxAccounts'][_0x50ffe2[_0xb39b('0x57')]]['Trunk'],_0x50ffe2);if(_0xd432ce[_0xb39b('0x5c')]){_0x44fd30(ut[_0xb39b('0x36')](_0xb39b('0x5d')));}else{_0xff66d0(ut['message'](_0xd432ce[_0xb39b('0x36')]));}});};function originate(_0xe9e89b,_0x1bb6ff,_0x54397f){return new BPromise(function(_0x412f9c,_0x56a820){if(_0x54397f){var _0x5898ba=util[_0xb39b('0x5e')](_0xb39b('0x5f'),path[_0xb39b('0x37')](_0xe9e89b[_0xb39b('0x3')])['name'],_0xe9e89b[_0xb39b('0x3')]);gs[_0xb39b('0x60')](_0x5898ba)['then'](function(){_0xe9e89b[_0xb39b('0x3')]=util['format'](_0xb39b('0x61'),path[_0xb39b('0x37')](_0xe9e89b[_0xb39b('0x3')])[_0xb39b('0x62')],path[_0xb39b('0x37')](_0xe9e89b[_0xb39b('0x3')])[_0xb39b('0x25')]);_0x1bb6ff[_0xb39b('0x63')]=_0xe9e89b['path'];ut[_0xb39b('0x47')](_0xb39b('0x64'),'');ami[_0xb39b('0x65')](ut[_0xb39b('0x66')](_0xe9e89b,_0x1bb6ff))[_0xb39b('0x3a')](function(_0x5dfdf8){_0x412f9c(_0x5dfdf8);})[_0xb39b('0x3b')](function(_0x210ac9){_0x56a820(_0x210ac9);});})[_0xb39b('0x3b')](function(_0x12531f){_0x56a820(_0x12531f);});}else{ami[_0xb39b('0x65')](ut[_0xb39b('0x66')](_0xe9e89b,_0x1bb6ff))['then'](function(_0x46bee8){_0x412f9c(_0x46bee8);})[_0xb39b('0x3b')](function(_0x4d3954){_0x56a820(_0x4d3954);});}});}Fax[_0xb39b('0x1d')][_0xb39b('0x56')]=function(_0xa1eaca,_0x5059b4){var _0x17c7fb=this;return new BPromise(function(_0x1d2537,_0x1b627f){var _0x2b9fcc=uuid['v4']();var _0x3ffb91=ut[_0xb39b('0x67')](_0xa1eaca,_0x5059b4);_0x17c7fb[_0xb39b('0xf')][_0x2b9fcc]=new Action(_0x2b9fcc,_0x5059b4,_0xa1eaca);var _0x38f382=_0x17c7fb[_0xb39b('0xf')][_0x2b9fcc];if(path['parse'](_0xa1eaca[_0xb39b('0x3')])[_0xb39b('0x68')]===_0xb39b('0x38')){originate(_0x38f382,_0x3ffb91,!![])[_0xb39b('0x3a')](function(_0x1ad3b4){_0x1d2537(_0x1ad3b4);})['catch'](function(_0x4c5fad){_0x1b627f(_0x4c5fad);});}else{originate(_0x38f382,_0x3ffb91,![])[_0xb39b('0x3a')](function(_0x15b57d){_0x1d2537(_0x15b57d);})[_0xb39b('0x3b')](function(_0x2bb86d){_0x1b627f(_0x2bb86d);});}});};Fax[_0xb39b('0x1d')]['isTrunkReachable']=function(_0x1963bd){return!_[_0xb39b('0x69')](_0x1963bd)&&!_[_0xb39b('0x69')](_0x1963bd[_0xb39b('0x25')])&&!_['isNil'](_0x1963bd[_0xb39b('0x6a')])&&_0x1963bd[_0xb39b('0x6a')]&&!_[_0xb39b('0x69')](this[_0xb39b('0xe')][util['format'](_0xb39b('0x6b'),_0x1963bd[_0xb39b('0x25')])])&&!_['isNil'](this[_0xb39b('0xe')][util[_0xb39b('0x5e')](_0xb39b('0x6b'),_0x1963bd[_0xb39b('0x25')])][_0xb39b('0x2d')])&&(this[_0xb39b('0xe')][util['format'](_0xb39b('0x6b'),_0x1963bd[_0xb39b('0x25')])][_0xb39b('0x2d')]===_0xb39b('0x6c')||this[_0xb39b('0xe')][util['format'](_0xb39b('0x6b'),_0x1963bd['name'])][_0xb39b('0x2d')]===_0xb39b('0x6d'));};Fax[_0xb39b('0x1d')][_0xb39b('0x5b')]=function(_0x1ff581,_0x1884c4){if(!this['isTrunkReachable'](_0x1ff581)){ut['logger'](_0xb39b('0x6e'),_['isNil'](_0x1ff581)?'':_0x1ff581[_0xb39b('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xb39b('0x69')](_0x1884c4[_0xb39b('0x6')])){ut[_0xb39b('0x47')](_0xb39b('0x6f'),JSON[_0xb39b('0x3e')](_0x1884c4));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x1884c4[_0xb39b('0x3')])){ut['logger'](_0xb39b('0x70'),JSON[_0xb39b('0x3e')](_0x1884c4));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xb39b('0x71')};};module[_0xb39b('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 2b2897f..bc3e0ac 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 _0x42b0=['lodash','../rpc/faxAccount','error','resolve','then','notify','catch','[Notify]\x20','util','../../../config/logger','preview'];(function(_0x4fac73,_0x33b7a1){var _0x5e24a4=function(_0x11874a){while(--_0x11874a){_0x4fac73['push'](_0x4fac73['shift']());}};_0x5e24a4(++_0x33b7a1);}(_0x42b0,0xc3));var _0x042b=function(_0xac7e76,_0x1fa476){_0xac7e76=_0xac7e76-0x0;var _0x51bf57=_0x42b0[_0xac7e76];return _0x51bf57;};'use strict';var util=require(_0x042b('0x0'));var BPromise=require('bluebird');var logger=require(_0x042b('0x1'))(_0x042b('0x2'));var _=require(_0x042b('0x3'));var faxAccount=require(_0x042b('0x4'));function loggerCatch(_0x149002){return function(_0x548aab){logger[_0x042b('0x5')](_0x149002,util['inspect'](_0x548aab,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2ee9dd,_0x58e4e1){return BPromise[_0x042b('0x6')]()[_0x042b('0x7')](faxAccount[_0x042b('0x8')](_0x2ee9dd,_0x58e4e1))[_0x042b('0x9')](loggerCatch(_0x042b('0xa')));}; \ No newline at end of file +var _0x004c=['util','preview','lodash','error','inspect','resolve','then','notify'];(function(_0xeaa3bd,_0x166691){var _0x2e1174=function(_0x310580){while(--_0x310580){_0xeaa3bd['push'](_0xeaa3bd['shift']());}};_0x2e1174(++_0x166691);}(_0x004c,0x1b0));var _0xc004=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x004c[_0x819464];return _0x49dcc0;};'use strict';var util=require(_0xc004('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xc004('0x1'));var _=require(_0xc004('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x404973){return function(_0x447d11){logger[_0xc004('0x3')](_0x404973,util[_0xc004('0x4')](_0x447d11,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1c3061,_0x1e2cc9){return BPromise[_0xc004('0x5')]()[_0xc004('0x6')](faxAccount[_0xc004('0x7')](_0x1c3061,_0x1e2cc9))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 5ef8af9..cb256e9 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 _0xca53=['util','../../../../config/logger','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xca53,0x90));var _0x3ca5=function(_0x14540b,_0x85d32d){_0x14540b=_0x14540b-0x0;var _0x394822=_0xca53[_0x14540b];return _0x394822;};'use strict';var util=require(_0x3ca5('0x0'));var logger=require(_0x3ca5('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x3ca5('0x2'))[_0x3ca5('0x3')];exports[_0x3ca5('0x4')]=function(_0x4d66a6){return new BPromise(function(_0x4a4bdf,_0x57e2ba){exec(_0x4d66a6,function(_0x1ba9d8,_0x420d54,_0x562492){logger['info'](_0x3ca5('0x5'),_0x420d54);if(_0x1ba9d8){logger[_0x3ca5('0x6')](_0x3ca5('0x5'),_0x3ca5('0x7'),util[_0x3ca5('0x8')](_0x1ba9d8,{'showHidden':![],'depth':null}),_0x420d54,_0x562492);_0x57e2ba(_0x1ba9d8);}_0x4a4bdf(_0x420d54);});});}; \ No newline at end of file +var _0x8ffd=['bluebird','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x8ffd,0x1b6));var _0xd8ff=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x8ffd[_0x26bcec];return _0x1049dc;};'use strict';var util=require(_0xd8ff('0x0'));var logger=require('../../../../config/logger')(_0xd8ff('0x1'));var BPromise=require(_0xd8ff('0x2'));var exec=require('child_process')['exec'];exports[_0xd8ff('0x3')]=function(_0x413c8e){return new BPromise(function(_0x223951,_0x390c74){exec(_0x413c8e,function(_0x37103f,_0x218657,_0x5d06fc){logger[_0xd8ff('0x4')](_0xd8ff('0x5'),_0x218657);if(_0x37103f){logger[_0xd8ff('0x4')](_0xd8ff('0x5'),_0xd8ff('0x6'),util[_0xd8ff('0x7')](_0x37103f,{'showHidden':![],'depth':null}),_0x218657,_0x5d06fc);_0x390c74(_0x37103f);}_0x223951(_0x218657);});});}; \ 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 14c7ac2..f016015 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 _0x5978=['\x22%s\x22\x20<%s>','uniqueid','util','lodash','../../../../config/logger','message','logger','info','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip'];(function(_0x1d4392,_0x20314d){var _0xed2d1f=function(_0x3c7003){while(--_0x3c7003){_0x1d4392['push'](_0x1d4392['shift']());}};_0xed2d1f(++_0x20314d);}(_0x5978,0x172));var _0x8597=function(_0x1fad59,_0xb36e05){_0x1fad59=_0x1fad59-0x0;var _0x2f92b8=_0x5978[_0x1fad59];return _0x2f92b8;};'use strict';var util=require(_0x8597('0x0'));var _=require(_0x8597('0x1'));var moment=require('moment');var logger=require(_0x8597('0x2'))('fax');exports[_0x8597('0x3')]=function(_0x322bce){return{'message':_0x322bce};};exports[_0x8597('0x4')]=function(_0x5a7305,_0x5a9335){logger[_0x8597('0x5')](_0x5a7305,util['inspect'](_0x5a9335,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x210922,_0x105e44){var _0x43cca3={'XMF-ECM':_0x105e44['ecm'],'XMF-HEADERINFO':_0x105e44[_0x8597('0x6')],'XMF-MINRATE':_0x105e44[_0x8597('0x7')],'XMF-MAXRATE':_0x105e44[_0x8597('0x8')],'XMF-MODEM':util[_0x8597('0x9')](_0x8597('0xa'),_0x105e44['modem']),'XMF-GATEWAY':_0x105e44[_0x8597('0xb')],'XMF-FAXDETECT':_0x105e44[_0x8597('0xc')],'XMF-T38TIMEOUT':_0x105e44[_0x8597('0xd')],'XMF-LOCALSTATIONID':_0x105e44[_0x8597('0xe')],'XMF-PATH':_0x210922[_0x8597('0xf')]};return _0x43cca3;};exports[_0x8597('0x10')]=function(_0x27582c,_0xb89eb2){return{'actionid':_0x27582c['uniqueid'],'action':_0x8597('0x11'),'channel':_0x27582c[_0x8597('0x12')],'Exten':_0x8597('0x13'),'Context':_0x8597('0x14'),'Priority':'1','callerid':util[_0x8597('0x9')](_0x8597('0x15'),_0x27582c[_0x8597('0x6')]?_0x27582c[_0x8597('0x6')]:'',_0x27582c[_0x8597('0xe')]),'variable':_0xb89eb2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x27582c[_0x8597('0x16')]};}; \ No newline at end of file +var _0x8780=['from-sip','format','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','info','inspect','ecm','headerinfo','minrate','maxrate','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel'];(function(_0x42b187,_0x487d00){var _0x10842f=function(_0x1abcc7){while(--_0x1abcc7){_0x42b187['push'](_0x42b187['shift']());}};_0x10842f(++_0x487d00);}(_0x8780,0xa4));var _0x0878=function(_0x287a86,_0x58f52d){_0x287a86=_0x287a86-0x0;var _0x37079f=_0x8780[_0x287a86];return _0x37079f;};'use strict';var util=require(_0x0878('0x0'));var _=require(_0x0878('0x1'));var moment=require(_0x0878('0x2'));var logger=require(_0x0878('0x3'))(_0x0878('0x4'));exports[_0x0878('0x5')]=function(_0xf79e5b){return{'message':_0xf79e5b};};exports['logger']=function(_0x2890b5,_0x494911){logger[_0x0878('0x6')](_0x2890b5,util[_0x0878('0x7')](_0x494911,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x36e4a1,_0x1e0e17){var _0x1738d7={'XMF-ECM':_0x1e0e17[_0x0878('0x8')],'XMF-HEADERINFO':_0x1e0e17[_0x0878('0x9')],'XMF-MINRATE':_0x1e0e17[_0x0878('0xa')],'XMF-MAXRATE':_0x1e0e17[_0x0878('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x1e0e17['modem']),'XMF-GATEWAY':_0x1e0e17[_0x0878('0xc')],'XMF-FAXDETECT':_0x1e0e17[_0x0878('0xd')],'XMF-T38TIMEOUT':_0x1e0e17[_0x0878('0xe')],'XMF-LOCALSTATIONID':_0x1e0e17[_0x0878('0xf')],'XMF-PATH':_0x36e4a1[_0x0878('0x10')]};return _0x1738d7;};exports['variablesAction']=function(_0x1a722a,_0xa9adb4){return{'actionid':_0x1a722a[_0x0878('0x11')],'action':_0x0878('0x12'),'channel':_0x1a722a[_0x0878('0x13')],'Exten':'xcally-motion-fax','Context':_0x0878('0x14'),'Priority':'1','callerid':util[_0x0878('0x15')](_0x0878('0x16'),_0x1a722a['headerinfo']?_0x1a722a[_0x0878('0x9')]:'',_0x1a722a[_0x0878('0xf')]),'variable':_0xa9adb4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a722a[_0x0878('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 85be13a..356596d 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 _0x612a=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x21ccee,_0x59b41a){var _0x4e3f8d=function(_0x1f6418){while(--_0x1f6418){_0x21ccee['push'](_0x21ccee['shift']());}};_0x4e3f8d(++_0x59b41a);}(_0x612a,0x1c7));var _0xa612=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x612a[_0x737a1f];return _0x16eba1;};'use strict';var BPromise=require(_0xa612('0x0'));var util=require(_0xa612('0x1'));var moment=require(_0xa612('0x2'));var server=require(_0xa612('0x3'));var Realtime=require(_0xa612('0x4'));var Report=require(_0xa612('0x5'));var Acw=require(_0xa612('0x6'));var Trigger=require(_0xa612('0x7'));var Dialer=require('./dialer');var Preview=require(_0xa612('0x8'));var Fax=require(_0xa612('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xa612('0xa'));var voiceQueueReport=require(_0xa612('0xb'));var voiceCallReport=require(_0xa612('0xc'));var trunk=require(_0xa612('0xd'));var trigger=require(_0xa612('0xe'));var template=require(_0xa612('0xf'));var cmHopperHistory=require(_0xa612('0x10'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xa612('0x11'));var faxAccount=require(_0xa612('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xa612('0x13'));var sugarcrm=require(_0xa612('0x14'));var freshdesk=require(_0xa612('0x15'));var desk=require(_0xa612('0x16'));var zoho=require(_0xa612('0x17'));var vtiger=require(_0xa612('0x18'));var freshsales=require(_0xa612('0x19'));var servicenow=require(_0xa612('0x1a'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xa612('0x1b'))(_0xa612('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa612('0x1d')](_0xa612('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xa612('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa612('0x1f')]()['then'](user['getAgents']())[_0xa612('0x20')](realtime[_0xa612('0x21')]())[_0xa612('0x20')](user[_0xa612('0x22')]())['then'](realtime[_0xa612('0x23')]())[_0xa612('0x20')](trunk[_0xa612('0x24')]())[_0xa612('0x20')](realtime['initTrunks']())[_0xa612('0x20')](voiceQueue[_0xa612('0x25')]())[_0xa612('0x20')](realtime[_0xa612('0x26')]())[_0xa612('0x20')](trigger[_0xa612('0x27')]())[_0xa612('0x20')](realtime[_0xa612('0x28')]())[_0xa612('0x20')](template[_0xa612('0x29')]())[_0xa612('0x20')](realtime['initTemplates']())[_0xa612('0x20')](zendesk[_0xa612('0x2a')]())['then'](realtime[_0xa612('0x2b')]())[_0xa612('0x20')](salesforce[_0xa612('0x2c')]())[_0xa612('0x20')](realtime['initSalesforceAccounts']())[_0xa612('0x20')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xa612('0x2d')]())[_0xa612('0x20')](freshdesk[_0xa612('0x2e')]())[_0xa612('0x20')](realtime[_0xa612('0x2f')]())['then'](desk[_0xa612('0x30')]())['then'](realtime[_0xa612('0x31')]())[_0xa612('0x20')](zoho['getZohoAccounts']())[_0xa612('0x20')](realtime[_0xa612('0x32')]())[_0xa612('0x20')](vtiger['getVtigerAccounts']())['then'](realtime[_0xa612('0x33')]())[_0xa612('0x20')](freshsales['getFreshsalesAccounts']())[_0xa612('0x20')](realtime[_0xa612('0x34')]())[_0xa612('0x20')](servicenow[_0xa612('0x35')]())[_0xa612('0x20')](realtime[_0xa612('0x36')]())['then'](dynamics365[_0xa612('0x37')]())[_0xa612('0x20')](realtime[_0xa612('0x38')]())[_0xa612('0x20')](campaign[_0xa612('0x39')]())[_0xa612('0x20')](realtime[_0xa612('0x3a')]())[_0xa612('0x20')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xa612('0x3b')]())[_0xa612('0x20')](faxAccount[_0xa612('0x3c')]())[_0xa612('0x20')](realtime['initFaxAccounts']())[_0xa612('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0xa612('0x1f')]()[_0xa612('0x20')](voiceQueueReport[_0xa612('0x3d')]())[_0xa612('0x20')](realtime[_0xa612('0x3e')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xa612('0x3f')]())[_0xa612('0x20')](cmHopperHistory[_0xa612('0x40')]())[_0xa612('0x20')](realtime[_0xa612('0x41')]())[_0xa612('0x20')](voiceCallReport[_0xa612('0x42')]())[_0xa612('0x20')](realtime[_0xa612('0x43')]())[_0xa612('0x44')](function(_0x4d5c5f){logger['error'](_0xa612('0x45'),util[_0xa612('0x46')](_0x4d5c5f,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa612('0x47')](realtime,preview,fax)[_0xa612('0x20')](function(_0x402b62){return initRealtime();})[_0xa612('0x20')](function(){return initParams();})[_0xa612('0x20')](function(){report[_0xa612('0x48')]();setInterval(initRealtime,0x1388);})[_0xa612('0x44')](function(_0x22a215){logger['error'](_0xa612('0x49'),util[_0xa612('0x46')](_0x22a215,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xb617=['inspect','sync','bluebird','moment','./server','./realtime','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]'];(function(_0x18ed8d,_0x2d74c2){var _0x45de5d=function(_0x123e44){while(--_0x123e44){_0x18ed8d['push'](_0x18ed8d['shift']());}};_0x45de5d(++_0x2d74c2);}(_0xb617,0x16f));var _0x7b61=function(_0x45188a,_0x2216ab){_0x45188a=_0x45188a-0x0;var _0x104b91=_0xb617[_0x45188a];return _0x104b91;};'use strict';var BPromise=require(_0x7b61('0x0'));var util=require('util');var moment=require(_0x7b61('0x1'));var server=require(_0x7b61('0x2'));var Realtime=require(_0x7b61('0x3'));var Report=require('./report');var Acw=require(_0x7b61('0x4'));var Trigger=require(_0x7b61('0x5'));var Dialer=require(_0x7b61('0x6'));var Preview=require('./preview');var Fax=require(_0x7b61('0x7'));var user=require(_0x7b61('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x7b61('0x9'));var voiceCallReport=require(_0x7b61('0xa'));var trunk=require(_0x7b61('0xb'));var trigger=require(_0x7b61('0xc'));var template=require(_0x7b61('0xd'));var cmHopperHistory=require(_0x7b61('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x7b61('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x7b61('0x10'));var salesforce=require(_0x7b61('0x11'));var sugarcrm=require(_0x7b61('0x12'));var freshdesk=require(_0x7b61('0x13'));var desk=require(_0x7b61('0x14'));var zoho=require(_0x7b61('0x15'));var vtiger=require(_0x7b61('0x16'));var freshsales=require(_0x7b61('0x17'));var servicenow=require(_0x7b61('0x18'));var dynamics365=require(_0x7b61('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x7b61('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7b61('0x1b')](_0x7b61('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7b61('0x1b')](_0x7b61('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x7b61('0x1d')](user[_0x7b61('0x1e')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x1f')]())[_0x7b61('0x1d')](user[_0x7b61('0x20')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x21')]())[_0x7b61('0x1d')](trunk[_0x7b61('0x22')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x23')]())[_0x7b61('0x1d')](voiceQueue[_0x7b61('0x24')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x25')]())[_0x7b61('0x1d')](trigger[_0x7b61('0x26')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x27')]())[_0x7b61('0x1d')](template[_0x7b61('0x28')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x29')]())[_0x7b61('0x1d')](zendesk[_0x7b61('0x2a')]())[_0x7b61('0x1d')](realtime['initZendeskAccounts']())[_0x7b61('0x1d')](salesforce[_0x7b61('0x2b')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x2c')]())[_0x7b61('0x1d')](sugarcrm[_0x7b61('0x2d')]())['then'](realtime[_0x7b61('0x2e')]())[_0x7b61('0x1d')](freshdesk['getFreshdeskAccounts']())[_0x7b61('0x1d')](realtime[_0x7b61('0x2f')]())[_0x7b61('0x1d')](desk[_0x7b61('0x30')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x31')]())[_0x7b61('0x1d')](zoho[_0x7b61('0x32')]())[_0x7b61('0x1d')](realtime['initZohoAccounts']())[_0x7b61('0x1d')](vtiger['getVtigerAccounts']())[_0x7b61('0x1d')](realtime[_0x7b61('0x33')]())['then'](freshsales['getFreshsalesAccounts']())[_0x7b61('0x1d')](realtime['initFreshsalesAccounts']())[_0x7b61('0x1d')](servicenow[_0x7b61('0x34')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x35')]())[_0x7b61('0x1d')](dynamics365['getDynamics365Accounts']())[_0x7b61('0x1d')](realtime['initDynamics365Accounts']())['then'](campaign[_0x7b61('0x36')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x37')]())[_0x7b61('0x1d')](voiceExtension[_0x7b61('0x38')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x39')]())[_0x7b61('0x1d')](faxAccount[_0x7b61('0x3a')]())['then'](realtime[_0x7b61('0x3b')]())[_0x7b61('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x7b61('0x3c')]()[_0x7b61('0x1d')](voiceQueueReport[_0x7b61('0x3d')]())['then'](realtime[_0x7b61('0x3e')]())['then'](cmHopperHistory[_0x7b61('0x3f')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x40')]())[_0x7b61('0x1d')](cmHopperHistory[_0x7b61('0x41')]())[_0x7b61('0x1d')](realtime[_0x7b61('0x42')]())[_0x7b61('0x1d')](voiceCallReport['getVoiceCallReports']())[_0x7b61('0x1d')](realtime[_0x7b61('0x43')]())[_0x7b61('0x44')](function(_0x20c0cd){logger[_0x7b61('0x45')](_0x7b61('0x46'),util[_0x7b61('0x47')](_0x20c0cd,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x7b61('0x1d')](function(_0xc264c2){return initRealtime();})[_0x7b61('0x1d')](function(){return initParams();})[_0x7b61('0x1d')](function(){report[_0x7b61('0x48')]();setInterval(initRealtime,0x1388);})[_0x7b61('0x44')](function(_0x5b235a){logger[_0x7b61('0x45')]('[index.js][main]',util['inspect'](_0x5b235a,{'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 8b196b4..c5dbb04 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x2dc8e3,_0x5cb082){var _0x40526d=function(_0xee42dd){while(--_0xee42dd){_0x2dc8e3['push'](_0x2dc8e3['shift']());}};_0x40526d(++_0x5cb082);}(_0xe706,0xa3));var _0x6e70=function(_0x822a3f,_0x32fd83){_0x822a3f=_0x822a3f-0x0;var _0x1053e7=_0xe706[_0x822a3f];return _0x1053e7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x211d4a,_0x9d4244){var _0x208576=function(_0x24a891){while(--_0x24a891){_0x211d4a['push'](_0x211d4a['shift']());}};_0x208576(++_0x9d4244);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index bfc02d3..c9acbbe 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 _0x5a48=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x154935,_0x514041){var _0x198bd7=function(_0x358c61){while(--_0x358c61){_0x154935['push'](_0x154935['shift']());}};_0x198bd7(++_0x514041);}(_0x5a48,0x1ef));var _0x85a4=function(_0x24c405,_0x56d6fb){_0x24c405=_0x24c405-0x0;var _0x383aef=_0x5a48[_0x24c405];return _0x383aef;};'use strict';function Campaign(_0x583064){this['id']=_0x583064['id']||0x0;this[_0x85a4('0x0')]=_0x583064['name']||'';this[_0x85a4('0x1')]=_0x583064[_0x85a4('0x1')]||'campaign';this[_0x85a4('0x2')]=0x0;this['temp']=0x0;this[_0x85a4('0x3')]=0x0;this[_0x85a4('0x4')]=0x0;this[_0x85a4('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x85a4('0x6')]=_0x583064[_0x85a4('0x6')];this[_0x85a4('0x7')]=_0x583064[_0x85a4('0x7')];this['dialTimezone']=_0x583064['dialTimezone']||null;this[_0x85a4('0x8')]=_0x583064['dialGlobalInterval']?_0x583064['dialGlobalInterval']:null;this[_0x85a4('0x9')]=_0x583064[_0x85a4('0x9')];this[_0x85a4('0xa')]=_0x583064[_0x85a4('0xa')];this[_0x85a4('0xb')]=_0x583064[_0x85a4('0xb')]||0x1e;this[_0x85a4('0xc')]=_0x583064[_0x85a4('0xc')];this['dialCongestionRetryFrequency']=_0x583064[_0x85a4('0xd')];this[_0x85a4('0xe')]=_0x583064[_0x85a4('0xe')];this[_0x85a4('0xf')]=_0x583064[_0x85a4('0xf')];this[_0x85a4('0x10')]=_0x583064[_0x85a4('0x10')];this['dialNoAnswerRetryFrequency']=_0x583064[_0x85a4('0x11')];this[_0x85a4('0x12')]=_0x583064['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x583064['dialNoSuchNumberMaxRetry']||0x3;this[_0x85a4('0x13')]=_0x583064[_0x85a4('0x13')]||0x96;this['dialDropMaxRetry']=_0x583064[_0x85a4('0x14')]||0x3;this[_0x85a4('0x15')]=_0x583064[_0x85a4('0x15')]||0x96;this[_0x85a4('0x16')]=_0x583064[_0x85a4('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0x583064[_0x85a4('0x17')]||0x96;this[_0x85a4('0x18')]=_0x583064[_0x85a4('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x583064[_0x85a4('0x19')]||0x96;this[_0x85a4('0x1a')]=_0x583064[_0x85a4('0x1a')]||0x3;this[_0x85a4('0x1b')]=_0x583064['dialAgentRejectRetryFrequency']||0x96;this[_0x85a4('0x1c')]=_0x583064[_0x85a4('0x1c')]||_0x85a4('0x1d');this[_0x85a4('0x1e')]=_0x583064[_0x85a4('0x1e')]||undefined;this[_0x85a4('0x1f')]=_0x583064[_0x85a4('0x1f')]||undefined;this[_0x85a4('0x20')]=_0x583064['dialCutDigit']||undefined;this['TrunkBackup']=_0x583064['TrunkBackup']?_0x583064['TrunkBackup']:undefined;this[_0x85a4('0x21')]=_0x583064[_0x85a4('0x21')]?_0x583064[_0x85a4('0x21')]:undefined;this[_0x85a4('0x22')]=_0x583064['Interval']?_0x583064[_0x85a4('0x22')]:undefined;this[_0x85a4('0x23')]=_0x583064[_0x85a4('0x23')]?_0x583064[_0x85a4('0x23')]:undefined;this[_0x85a4('0x24')]=_0x583064[_0x85a4('0x23')]?_0x583064[_0x85a4('0x23')][_0x85a4('0x0')]:undefined;this[_0x85a4('0x25')]=_0x583064['dialAMDActive']||![];this[_0x85a4('0x26')]=_0x583064[_0x85a4('0x26')];this['dialAMDGreeting']=_0x583064['dialAMDGreeting'];this[_0x85a4('0x27')]=_0x583064[_0x85a4('0x27')];this['dialAMDTotalAnalysisTime']=_0x583064[_0x85a4('0x28')];this[_0x85a4('0x29')]=_0x583064[_0x85a4('0x29')];this[_0x85a4('0x2a')]=_0x583064[_0x85a4('0x2a')];this[_0x85a4('0x2b')]=_0x583064[_0x85a4('0x2b')];this[_0x85a4('0x2c')]=_0x583064['dialAMDSilenceThreshold'];this[_0x85a4('0x2d')]=_0x583064[_0x85a4('0x2d')];}module[_0x85a4('0x2e')]=Campaign; \ No newline at end of file +var _0xb5b3=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x3c2eed,_0x53db93){var _0x43baed=function(_0x3ea710){while(--_0x3ea710){_0x3c2eed['push'](_0x3c2eed['shift']());}};_0x43baed(++_0x53db93);}(_0xb5b3,0x1cf));var _0x3b5b=function(_0x247190,_0x1bff9e){_0x247190=_0x247190-0x0;var _0x5972a5=_0xb5b3[_0x247190];return _0x5972a5;};'use strict';function Campaign(_0xebd12){this['id']=_0xebd12['id']||0x0;this[_0x3b5b('0x0')]=_0xebd12[_0x3b5b('0x0')]||'';this[_0x3b5b('0x1')]=_0xebd12[_0x3b5b('0x1')]||_0x3b5b('0x2');this['originated']=0x0;this[_0x3b5b('0x3')]=0x0;this[_0x3b5b('0x4')]=0x0;this[_0x3b5b('0x5')]=0x0;this[_0x3b5b('0x6')]='';this[_0x3b5b('0x7')]=!![];this[_0x3b5b('0x8')]=_0xebd12[_0x3b5b('0x8')];this['limitCalls']=_0xebd12[_0x3b5b('0x9')];this[_0x3b5b('0xa')]=_0xebd12['dialTimezone']||null;this[_0x3b5b('0xb')]=_0xebd12['dialGlobalInterval']?_0xebd12[_0x3b5b('0xb')]:null;this[_0x3b5b('0xc')]=_0xebd12[_0x3b5b('0xc')];this['dialOriginateCallerIdNumber']=_0xebd12[_0x3b5b('0xd')];this['dialOriginateTimeout']=_0xebd12[_0x3b5b('0xe')]||0x1e;this[_0x3b5b('0xf')]=_0xebd12[_0x3b5b('0xf')];this[_0x3b5b('0x10')]=_0xebd12[_0x3b5b('0x10')];this[_0x3b5b('0x11')]=_0xebd12[_0x3b5b('0x11')];this[_0x3b5b('0x12')]=_0xebd12[_0x3b5b('0x12')];this[_0x3b5b('0x13')]=_0xebd12[_0x3b5b('0x13')];this[_0x3b5b('0x14')]=_0xebd12[_0x3b5b('0x14')];this[_0x3b5b('0x15')]=_0xebd12[_0x3b5b('0x15')];this[_0x3b5b('0x16')]=_0xebd12[_0x3b5b('0x16')]||0x3;this[_0x3b5b('0x17')]=_0xebd12[_0x3b5b('0x17')]||0x96;this[_0x3b5b('0x18')]=_0xebd12[_0x3b5b('0x18')]||0x3;this[_0x3b5b('0x19')]=_0xebd12[_0x3b5b('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0xebd12[_0x3b5b('0x1a')]||0x3;this[_0x3b5b('0x1b')]=_0xebd12[_0x3b5b('0x1b')]||0x96;this['dialMachineMaxRetry']=_0xebd12['dialMachineMaxRetry']||0x3;this[_0x3b5b('0x1c')]=_0xebd12['dialMachineRetryFrequency']||0x96;this[_0x3b5b('0x1d')]=_0xebd12[_0x3b5b('0x1d')]||0x3;this[_0x3b5b('0x1e')]=_0xebd12[_0x3b5b('0x1e')]||0x96;this[_0x3b5b('0x1f')]=_0xebd12[_0x3b5b('0x1f')]||_0x3b5b('0x20');this[_0x3b5b('0x21')]=_0xebd12[_0x3b5b('0x21')]||undefined;this[_0x3b5b('0x22')]=_0xebd12[_0x3b5b('0x22')]||undefined;this[_0x3b5b('0x23')]=_0xebd12[_0x3b5b('0x23')]||undefined;this[_0x3b5b('0x24')]=_0xebd12['TrunkBackup']?_0xebd12[_0x3b5b('0x24')]:undefined;this[_0x3b5b('0x25')]=_0xebd12['Trunk']?_0xebd12[_0x3b5b('0x25')]:undefined;this[_0x3b5b('0x26')]=_0xebd12['Interval']?_0xebd12[_0x3b5b('0x26')]:undefined;this[_0x3b5b('0x27')]=_0xebd12[_0x3b5b('0x27')]?_0xebd12[_0x3b5b('0x27')]:undefined;this[_0x3b5b('0x28')]=_0xebd12[_0x3b5b('0x27')]?_0xebd12[_0x3b5b('0x27')]['name']:undefined;this[_0x3b5b('0x29')]=_0xebd12['dialAMDActive']||![];this[_0x3b5b('0x2a')]=_0xebd12['dialAMDInitialSilence'];this[_0x3b5b('0x2b')]=_0xebd12[_0x3b5b('0x2b')];this[_0x3b5b('0x2c')]=_0xebd12[_0x3b5b('0x2c')];this[_0x3b5b('0x2d')]=_0xebd12[_0x3b5b('0x2d')];this[_0x3b5b('0x2e')]=_0xebd12[_0x3b5b('0x2e')];this[_0x3b5b('0x2f')]=_0xebd12[_0x3b5b('0x2f')];this[_0x3b5b('0x30')]=_0xebd12[_0x3b5b('0x30')];this[_0x3b5b('0x31')]=_0xebd12[_0x3b5b('0x31')];this[_0x3b5b('0x32')]=_0xebd12[_0x3b5b('0x32')];}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 b5f46a5..23066b4 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 _0x731b=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x731b,0xf7));var _0xb731=function(_0x1bda4c,_0xe3d0a2){_0x1bda4c=_0x1bda4c-0x0;var _0x634bcc=_0x731b[_0x1bda4c];return _0x634bcc;};'use strict';function Channel(){this[_0xb731('0x0')]=null;this[_0xb731('0x1')]='';this['destinationchannel']='';this[_0xb731('0x2')]=0x0;this[_0xb731('0x3')]='';this[_0xb731('0x4')]=undefined;this[_0xb731('0x5')]=undefined;this[_0xb731('0x6')]=0x0;this[_0xb731('0x7')]='';this['uniqueid']=0x0;this[_0xb731('0x8')]=0x0;this[_0xb731('0x9')]=0x0;this[_0xb731('0xa')]=![];this[_0xb731('0xb')]=null;this[_0xb731('0xc')]=null;this[_0xb731('0xd')]=![];this[_0xb731('0xe')]=![];this['lastapplication']='';this[_0xb731('0xf')]='';this[_0xb731('0x10')]=0x0;this[_0xb731('0x11')]=0x0;this[_0xb731('0x12')]=0x0;this[_0xb731('0x13')]=null;this[_0xb731('0x14')]=null;this[_0xb731('0x15')]=null;this[_0xb731('0x16')]=![];this[_0xb731('0x17')]=null;this[_0xb731('0x18')]=null;this[_0xb731('0x19')]=[];this[_0xb731('0x1a')]=undefined;this[_0xb731('0x1b')]=undefined;this[_0xb731('0x1c')]=undefined;this[_0xb731('0x1d')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x943d=['exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferType','mohtime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid'];(function(_0x45486d,_0x58afe0){var _0x4bddcb=function(_0xfb400c){while(--_0xfb400c){_0x45486d['push'](_0x45486d['shift']());}};_0x4bddcb(++_0x58afe0);}(_0x943d,0x155));var _0xd943=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0x943d[_0xf31767];return _0x24bd0c;};'use strict';function Channel(){this['starttime']=null;this[_0xd943('0x0')]='';this[_0xd943('0x1')]='';this[_0xd943('0x2')]=0x0;this[_0xd943('0x3')]='';this[_0xd943('0x4')]=undefined;this[_0xd943('0x5')]=undefined;this[_0xd943('0x6')]=0x0;this[_0xd943('0x7')]='';this[_0xd943('0x8')]=0x0;this[_0xd943('0x9')]=0x0;this[_0xd943('0xa')]=0x0;this[_0xd943('0xb')]=![];this[_0xd943('0xc')]=null;this[_0xd943('0xd')]=null;this['unmanaged']=![];this[_0xd943('0xe')]=![];this[_0xd943('0xf')]='';this[_0xd943('0x10')]='';this[_0xd943('0x11')]=0x0;this['billableseconds']=0x0;this[_0xd943('0x12')]=0x0;this[_0xd943('0x13')]=null;this[_0xd943('0x14')]=null;this[_0xd943('0x15')]=null;this[_0xd943('0x16')]=![];this[_0xd943('0x17')]=null;this['queue']=null;this['monitors']=[];this[_0xd943('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xd943('0x19')]=undefined;this[_0xd943('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ac9dd92..fe25d1f 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 _0x68ac=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ac,0xaf));var _0xc68a=function(_0x56fea3,_0x513da3){_0x56fea3=_0x56fea3-0x0;var _0x24ee7e=_0x68ac[_0x56fea3];return _0x24ee7e;};'use strict';function DeskAccount(_0x15fafd){this['id']=_0x15fafd['id']||0x0;this[_0xc68a('0x0')]=_0x15fafd['name']||'';this[_0xc68a('0x1')]=_0x15fafd['username']||'';this[_0xc68a('0x2')]=_0x15fafd[_0xc68a('0x2')]||'';this['authType']=_0x15fafd[_0xc68a('0x3')]||'';this[_0xc68a('0x4')]=_0x15fafd[_0xc68a('0x4')]||'';this[_0xc68a('0x5')]=_0x15fafd['consumerKey']||'';this[_0xc68a('0x6')]=_0x15fafd[_0xc68a('0x6')]||'';this[_0xc68a('0x7')]=_0x15fafd[_0xc68a('0x7')]||'';this[_0xc68a('0x8')]=_0x15fafd[_0xc68a('0x8')]||'';this[_0xc68a('0x9')]=_0x15fafd[_0xc68a('0x9')]||'';this[_0xc68a('0xa')]=_0x15fafd[_0xc68a('0xa')]||'';this[_0xc68a('0xb')]=_0x15fafd['Configurations']||{};}module[_0xc68a('0xc')]=DeskAccount; \ No newline at end of file +var _0x1de5=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey'];(function(_0x3af04f,_0x452ac4){var _0x32be12=function(_0x3298f7){while(--_0x3298f7){_0x3af04f['push'](_0x3af04f['shift']());}};_0x32be12(++_0x452ac4);}(_0x1de5,0x1e7));var _0x51de=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x1de5[_0x1a9204];return _0x17ca68;};'use strict';function DeskAccount(_0x159eb3){this['id']=_0x159eb3['id']||0x0;this[_0x51de('0x0')]=_0x159eb3[_0x51de('0x0')]||'';this[_0x51de('0x1')]=_0x159eb3[_0x51de('0x1')]||'';this[_0x51de('0x2')]=_0x159eb3[_0x51de('0x2')]||'';this['authType']=_0x159eb3['authType']||'';this[_0x51de('0x3')]=_0x159eb3[_0x51de('0x3')]||'';this[_0x51de('0x4')]=_0x159eb3[_0x51de('0x4')]||'';this[_0x51de('0x5')]=_0x159eb3['consumerSecret']||'';this['token']=_0x159eb3[_0x51de('0x6')]||'';this[_0x51de('0x7')]=_0x159eb3[_0x51de('0x7')]||'';this[_0x51de('0x8')]=_0x159eb3[_0x51de('0x8')]||'';this[_0x51de('0x9')]=_0x159eb3[_0x51de('0x9')]||'';this[_0x51de('0xa')]=_0x159eb3[_0x51de('0xa')]||{};}module[_0x51de('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6204a18..6834c35 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 _0xabdc=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xabdc,0x1d9));var _0xcabd=function(_0x1876fa,_0x34c9e0){_0x1876fa=_0x1876fa-0x0;var _0x1304f5=_0xabdc[_0x1876fa];return _0x1304f5;};'use strict';function Dynamics365Account(_0x386f2a){this['id']=_0x386f2a['id']||0x0;this[_0xcabd('0x0')]=_0x386f2a[_0xcabd('0x0')]||'';this[_0xcabd('0x1')]=_0x386f2a['username']||'';this[_0xcabd('0x2')]=_0x386f2a[_0xcabd('0x2')]||'';this['remoteUri']=_0x386f2a[_0xcabd('0x3')]||'';this['tenantId']=_0x386f2a[_0xcabd('0x4')]||'';this['clientId']=_0x386f2a[_0xcabd('0x5')]||'';this['clientSecret']=_0x386f2a[_0xcabd('0x6')]||{};this[_0xcabd('0x7')]=_0x386f2a['serverUrl']||'';this[_0xcabd('0x8')]=_0x386f2a[_0xcabd('0x8')]||![];this[_0xcabd('0x9')]=_0x386f2a[_0xcabd('0x9')]||{};this[_0xcabd('0xa')]=_0x386f2a[_0xcabd('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xba6c=['username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider'];(function(_0x5dd0a0,_0x4dce83){var _0xba8824=function(_0x30df22){while(--_0x30df22){_0x5dd0a0['push'](_0x5dd0a0['shift']());}};_0xba8824(++_0x4dce83);}(_0xba6c,0x103));var _0xcba6=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xba6c[_0x3b7a0c];return _0x3bb70f;};'use strict';function Dynamics365Account(_0x43c783){this['id']=_0x43c783['id']||0x0;this['name']=_0x43c783['name']||'';this[_0xcba6('0x0')]=_0x43c783[_0xcba6('0x0')]||'';this['password']=_0x43c783[_0xcba6('0x1')]||'';this['remoteUri']=_0x43c783[_0xcba6('0x2')]||'';this[_0xcba6('0x3')]=_0x43c783['tenantId']||'';this['clientId']=_0x43c783[_0xcba6('0x4')]||'';this[_0xcba6('0x5')]=_0x43c783[_0xcba6('0x5')]||{};this['serverUrl']=_0x43c783['serverUrl']||'';this['modernAuthentication']=_0x43c783['modernAuthentication']||![];this['Configurations']=_0x43c783['Configurations']||{};this['CloudProvider']=_0x43c783[_0xcba6('0x6')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d691e19..9f87b0a 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 _0x7c0d=['exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x227e7b,_0x5c20cb){var _0x44bc2f=function(_0x11ce27){while(--_0x11ce27){_0x227e7b['push'](_0x227e7b['shift']());}};_0x44bc2f(++_0x5c20cb);}(_0x7c0d,0x199));var _0xd7c0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c0d[_0x321bb2];return _0x9c12ed;};'use strict';function FaxAccount(_0x36e93a){this['id']=_0x36e93a['id']||0x0;this[_0xd7c0('0x0')]=_0x36e93a[_0xd7c0('0x0')]||'';this[_0xd7c0('0x1')]=_0x36e93a[_0xd7c0('0x1')];this[_0xd7c0('0x2')]=_0x36e93a[_0xd7c0('0x2')];this['headerinfo']=_0x36e93a[_0xd7c0('0x3')];this[_0xd7c0('0x4')]=_0x36e93a[_0xd7c0('0x4')];this['minrate']=_0x36e93a[_0xd7c0('0x5')]||0x960;this['maxrate']=_0x36e93a['maxrate']||0x3840;this[_0xd7c0('0x6')]=_0x36e93a[_0xd7c0('0x6')]||_0xd7c0('0x7');this[_0xd7c0('0x8')]=_0x36e93a[_0xd7c0('0x8')]||'no';this[_0xd7c0('0x9')]=_0x36e93a['faxdetect']||'no';this[_0xd7c0('0xa')]=_0x36e93a[_0xd7c0('0xa')]||0x1388;this[_0xd7c0('0xb')]=_0x36e93a[_0xd7c0('0xb')]||_0xd7c0('0xc');this[_0xd7c0('0xd')]=_0x36e93a[_0xd7c0('0xd')]?_0x36e93a['Trunk']:undefined;this[_0xd7c0('0xe')]=_0x36e93a['ListId'];this[_0xd7c0('0xf')]=_0x36e93a[_0xd7c0('0xf')];}module[_0xd7c0('0x10')]=FaxAccount; \ No newline at end of file +var _0x4e6b=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x4e6b,0x107));var _0xb4e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4e6b[_0x501510];return _0x1e6ee5;};'use strict';function FaxAccount(_0x5b6b67){this['id']=_0x5b6b67['id']||0x0;this[_0xb4e6('0x0')]=_0x5b6b67[_0xb4e6('0x0')]||'';this[_0xb4e6('0x1')]=_0x5b6b67[_0xb4e6('0x1')];this[_0xb4e6('0x2')]=_0x5b6b67[_0xb4e6('0x2')];this[_0xb4e6('0x3')]=_0x5b6b67[_0xb4e6('0x3')];this[_0xb4e6('0x4')]=_0x5b6b67[_0xb4e6('0x4')];this['minrate']=_0x5b6b67[_0xb4e6('0x5')]||0x960;this[_0xb4e6('0x6')]=_0x5b6b67['maxrate']||0x3840;this[_0xb4e6('0x7')]=_0x5b6b67['modem']||_0xb4e6('0x8');this[_0xb4e6('0x9')]=_0x5b6b67[_0xb4e6('0x9')]||'no';this[_0xb4e6('0xa')]=_0x5b6b67[_0xb4e6('0xa')]||'no';this['t38timeout']=_0x5b6b67[_0xb4e6('0xb')]||0x1388;this[_0xb4e6('0xc')]=_0x5b6b67[_0xb4e6('0xc')]||_0xb4e6('0xd');this[_0xb4e6('0xe')]=_0x5b6b67['Trunk']?_0x5b6b67['Trunk']:undefined;this[_0xb4e6('0xf')]=_0x5b6b67[_0xb4e6('0xf')];this[_0xb4e6('0x10')]=_0x5b6b67[_0xb4e6('0x10')];}module[_0xb4e6('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ff44c3d..b04b221 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 _0x7c71=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1e1c48,_0x12b5f4){var _0x13679c=function(_0x1f728c){while(--_0x1f728c){_0x1e1c48['push'](_0x1e1c48['shift']());}};_0x13679c(++_0x12b5f4);}(_0x7c71,0x10f));var _0x17c7=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x7c71[_0x5c2c7c];return _0xea7ffe;};'use strict';function FreshdeskAccount(_0x17ec9f){this['id']=_0x17ec9f['id']||0x0;this[_0x17c7('0x0')]=_0x17ec9f['name']||'';this[_0x17c7('0x1')]=_0x17ec9f['username']||'';this[_0x17c7('0x2')]=_0x17ec9f[_0x17c7('0x3')]||'';this[_0x17c7('0x4')]=_0x17ec9f[_0x17c7('0x4')]||'';this[_0x17c7('0x5')]=_0x17ec9f[_0x17c7('0x5')]||'';this[_0x17c7('0x6')]=_0x17ec9f['Configurations']||{};}module[_0x17c7('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x133d=['Configurations','exports','name','username','token','serverUrl'];(function(_0x1227e4,_0x164d5f){var _0x1681c6=function(_0x549491){while(--_0x549491){_0x1227e4['push'](_0x1227e4['shift']());}};_0x1681c6(++_0x164d5f);}(_0x133d,0x10a));var _0xd133=function(_0x45dbe3,_0xd2bf96){_0x45dbe3=_0x45dbe3-0x0;var _0x1e71cf=_0x133d[_0x45dbe3];return _0x1e71cf;};'use strict';function FreshdeskAccount(_0x5c4199){this['id']=_0x5c4199['id']||0x0;this[_0xd133('0x0')]=_0x5c4199[_0xd133('0x0')]||'';this[_0xd133('0x1')]=_0x5c4199[_0xd133('0x1')]||'';this['apiKey']=_0x5c4199[_0xd133('0x2')]||'';this['remoteUri']=_0x5c4199['remoteUri']||'';this[_0xd133('0x3')]=_0x5c4199[_0xd133('0x3')]||'';this[_0xd133('0x4')]=_0x5c4199[_0xd133('0x4')]||{};}module[_0xd133('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1165071..51d85ed 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 _0x95d9=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x95d9,0x97));var _0x995d=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x95d9[_0x75f869];return _0x10af8b;};'use strict';function FreshsalesAccount(_0x861aed){this['id']=_0x861aed['id']||0x0;this[_0x995d('0x0')]=_0x861aed[_0x995d('0x0')]||'';this[_0x995d('0x1')]=_0x861aed['username']||'';this[_0x995d('0x2')]=_0x861aed[_0x995d('0x3')]||'';this[_0x995d('0x4')]=_0x861aed['remoteUri']||'';this[_0x995d('0x5')]=_0x861aed[_0x995d('0x5')]||'';this[_0x995d('0x6')]=_0x861aed[_0x995d('0x6')]||{};}module[_0x995d('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x85d8=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x546b43,_0x478584){var _0x2da943=function(_0x7c9df9){while(--_0x7c9df9){_0x546b43['push'](_0x546b43['shift']());}};_0x2da943(++_0x478584);}(_0x85d8,0x1b0));var _0x885d=function(_0x277a45,_0x169dc2){_0x277a45=_0x277a45-0x0;var _0x156d7b=_0x85d8[_0x277a45];return _0x156d7b;};'use strict';function FreshsalesAccount(_0x491e30){this['id']=_0x491e30['id']||0x0;this[_0x885d('0x0')]=_0x491e30[_0x885d('0x0')]||'';this[_0x885d('0x1')]=_0x491e30[_0x885d('0x1')]||'';this['apiKey']=_0x491e30[_0x885d('0x2')]||'';this[_0x885d('0x3')]=_0x491e30[_0x885d('0x3')]||'';this[_0x885d('0x4')]=_0x491e30['serverUrl']||'';this['Configurations']=_0x491e30[_0x885d('0x5')]||{};}module[_0x885d('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 674b5df..f1fd4f8 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 _0xb25a=['calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','lastAssignedTo','motionChannel','voice','mohtime','exports','type','inbound'];(function(_0x162a3d,_0x288cab){var _0x3dbcf7=function(_0x520547){while(--_0x520547){_0x162a3d['push'](_0x162a3d['shift']());}};_0x3dbcf7(++_0x288cab);}(_0xb25a,0x11e));var _0xab25=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb25a[_0x57b54c];return _0x59cc19;};'use strict';function QueueReport(){this[_0xab25('0x0')]=_0xab25('0x1');this['uniqueid']='';this[_0xab25('0x2')]='';this[_0xab25('0x3')]='';this[_0xab25('0x4')]='';this[_0xab25('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xab25('0x6')]=0x1;this[_0xab25('0x7')]=0x1;this[_0xab25('0x8')]=![];this[_0xab25('0x9')]=null;this[_0xab25('0xa')]=![];this[_0xab25('0xb')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xab25('0xc')]=0x1;this[_0xab25('0xd')]='';this[_0xab25('0xe')]='';this[_0xab25('0xf')]='';this[_0xab25('0x10')]='';this[_0xab25('0x11')]='';this['exten']='';this[_0xab25('0x12')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xab25('0x13')]='';this[_0xab25('0x14')]=_0xab25('0x15');this[_0xab25('0x16')]=0x0;this['variables']={};}module[_0xab25('0x17')]=QueueReport; \ No newline at end of file +var _0xd3b3=['originalposition','channel','accountcode','context','exten','lastAssignedTo','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x9441e3,_0x267aa6){var _0x1c42c2=function(_0x244891){while(--_0x244891){_0x9441e3['push'](_0x9441e3['shift']());}};_0x1c42c2(++_0x267aa6);}(_0xd3b3,0x142));var _0x3d3b=function(_0x10e8ed,_0x384a0d){_0x10e8ed=_0x10e8ed-0x0;var _0x4aea4a=_0xd3b3[_0x10e8ed];return _0x4aea4a;};'use strict';function QueueReport(){this['type']=_0x3d3b('0x0');this[_0x3d3b('0x1')]='';this[_0x3d3b('0x2')]='';this[_0x3d3b('0x3')]='';this[_0x3d3b('0x4')]='';this[_0x3d3b('0x5')]=null;this[_0x3d3b('0x6')]=null;this[_0x3d3b('0x7')]=0x1;this[_0x3d3b('0x8')]=0x1;this[_0x3d3b('0x9')]=![];this[_0x3d3b('0xa')]=null;this['queuecallercomplete']=![];this[_0x3d3b('0xb')]=null;this[_0x3d3b('0xc')]=![];this[_0x3d3b('0xd')]=null;this[_0x3d3b('0xe')]=0x1;this[_0x3d3b('0xf')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x3d3b('0x10')]='';this[_0x3d3b('0x11')]='';this[_0x3d3b('0x12')]='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0x3d3b('0x13')]='';this['motionChannel']='voice';this['mohtime']=0x0;this['variables']={};}module[_0x3d3b('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e268921..fcf5326 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 _0x36fe=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x36fe,0x127));var _0xe36f=function(_0x43d106,_0x96a475){_0x43d106=_0x43d106-0x0;var _0x2160bc=_0x36fe[_0x43d106];return _0x2160bc;};'use strict';function SalesforceAccount(_0x5b6718){this['id']=_0x5b6718['id']||0x0;this[_0xe36f('0x0')]=_0x5b6718[_0xe36f('0x0')]||'';this[_0xe36f('0x1')]=_0x5b6718[_0xe36f('0x1')]||'';this[_0xe36f('0x2')]=_0x5b6718[_0xe36f('0x2')]||'';this[_0xe36f('0x3')]=_0x5b6718[_0xe36f('0x3')]||'';this[_0xe36f('0x4')]=_0x5b6718[_0xe36f('0x4')]||'';this['clientSecret']=_0x5b6718[_0xe36f('0x5')]||'';this['securityToken']=_0x5b6718[_0xe36f('0x6')]||'';this[_0xe36f('0x7')]=_0x5b6718['type']||_0xe36f('0x8');this[_0xe36f('0x9')]=_0x5b6718['serverUrl']||'';this[_0xe36f('0xa')]=_0x5b6718[_0xe36f('0xa')]||{};}module[_0xe36f('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xc1d3=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1d3,0x147));var _0x3c1d=function(_0x4b9499,_0x249c2e){_0x4b9499=_0x4b9499-0x0;var _0x4b5e4a=_0xc1d3[_0x4b9499];return _0x4b5e4a;};'use strict';function SalesforceAccount(_0x3f44c2){this['id']=_0x3f44c2['id']||0x0;this[_0x3c1d('0x0')]=_0x3f44c2[_0x3c1d('0x0')]||'';this[_0x3c1d('0x1')]=_0x3f44c2[_0x3c1d('0x1')]||'';this[_0x3c1d('0x2')]=_0x3f44c2[_0x3c1d('0x2')]||'';this['password']=_0x3f44c2['password']||'';this[_0x3c1d('0x3')]=_0x3f44c2[_0x3c1d('0x3')]||'';this[_0x3c1d('0x4')]=_0x3f44c2['clientSecret']||'';this[_0x3c1d('0x5')]=_0x3f44c2[_0x3c1d('0x5')]||'';this[_0x3c1d('0x6')]=_0x3f44c2[_0x3c1d('0x6')]||_0x3c1d('0x7');this['serverUrl']=_0x3f44c2[_0x3c1d('0x8')]||'';this[_0x3c1d('0x9')]=_0x3f44c2[_0x3c1d('0x9')]||{};}module[_0x3c1d('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 d2ef88b..54edd47 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 _0xcfc6=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x584da8,_0x4944c4){var _0x4da924=function(_0x348f16){while(--_0x348f16){_0x584da8['push'](_0x584da8['shift']());}};_0x4da924(++_0x4944c4);}(_0xcfc6,0x9e));var _0x6cfc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfc6[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0x56301f){this['id']=_0x56301f['id']||0x0;this[_0x6cfc('0x0')]=_0x56301f[_0x6cfc('0x0')]||'';this[_0x6cfc('0x1')]=_0x56301f[_0x6cfc('0x1')]||'';this[_0x6cfc('0x2')]=_0x56301f[_0x6cfc('0x2')]||'';this[_0x6cfc('0x3')]=_0x56301f['remoteUri']||'';this[_0x6cfc('0x4')]=_0x56301f[_0x6cfc('0x4')]||'';this[_0x6cfc('0x5')]=_0x56301f[_0x6cfc('0x5')]||{};}module[_0x6cfc('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xa6df=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x535574,_0x1eafc0){var _0x143bb3=function(_0x27ad1a){while(--_0x27ad1a){_0x535574['push'](_0x535574['shift']());}};_0x143bb3(++_0x1eafc0);}(_0xa6df,0x163));var _0xfa6d=function(_0x46796a,_0xcf9516){_0x46796a=_0x46796a-0x0;var _0x3e6782=_0xa6df[_0x46796a];return _0x3e6782;};'use strict';function ServicenowAccount(_0x292fbb){this['id']=_0x292fbb['id']||0x0;this[_0xfa6d('0x0')]=_0x292fbb[_0xfa6d('0x0')]||'';this[_0xfa6d('0x1')]=_0x292fbb[_0xfa6d('0x1')]||'';this[_0xfa6d('0x2')]=_0x292fbb[_0xfa6d('0x2')]||'';this['remoteUri']=_0x292fbb[_0xfa6d('0x3')]||'';this[_0xfa6d('0x4')]=_0x292fbb[_0xfa6d('0x4')]||'';this[_0xfa6d('0x5')]=_0x292fbb[_0xfa6d('0x5')]||{};}module[_0xfa6d('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 c9ea8af..15c003a 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 _0x92bc=['serverUrl','Configurations','name','password','remoteUri'];(function(_0x4fa535,_0x2a9056){var _0x280d81=function(_0xeb607f){while(--_0xeb607f){_0x4fa535['push'](_0x4fa535['shift']());}};_0x280d81(++_0x2a9056);}(_0x92bc,0x106));var _0xc92b=function(_0x5c535b,_0x492e80){_0x5c535b=_0x5c535b-0x0;var _0x1be5e9=_0x92bc[_0x5c535b];return _0x1be5e9;};'use strict';function SugarcrmAccount(_0x364486){this['id']=_0x364486['id']||0x0;this[_0xc92b('0x0')]=_0x364486[_0xc92b('0x0')]||'';this['username']=_0x364486['username']||'';this[_0xc92b('0x1')]=_0x364486[_0xc92b('0x1')]||'';this[_0xc92b('0x2')]=_0x364486[_0xc92b('0x2')]||'';this['serverUrl']=_0x364486[_0xc92b('0x3')]||'';this[_0xc92b('0x4')]=_0x364486[_0xc92b('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x0b09=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5484f4,_0x4f2c3a){var _0x7f7dc9=function(_0x491bcd){while(--_0x491bcd){_0x5484f4['push'](_0x5484f4['shift']());}};_0x7f7dc9(++_0x4f2c3a);}(_0x0b09,0x13c));var _0x90b0=function(_0x3f9910,_0x556e77){_0x3f9910=_0x3f9910-0x0;var _0xfe1ea6=_0x0b09[_0x3f9910];return _0xfe1ea6;};'use strict';function SugarcrmAccount(_0x4d3503){this['id']=_0x4d3503['id']||0x0;this[_0x90b0('0x0')]=_0x4d3503['name']||'';this['username']=_0x4d3503[_0x90b0('0x1')]||'';this[_0x90b0('0x2')]=_0x4d3503[_0x90b0('0x2')]||'';this['remoteUri']=_0x4d3503[_0x90b0('0x3')]||'';this[_0x90b0('0x4')]=_0x4d3503['serverUrl']||'';this['Configurations']=_0x4d3503[_0x90b0('0x5')]||{};}module[_0x90b0('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 80df56e..20f16d8 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 _0x6a40=['status','address','exports','name','accountcode','unknown'];(function(_0x4b4735,_0x581501){var _0x574810=function(_0x4eb966){while(--_0x4eb966){_0x4b4735['push'](_0x4b4735['shift']());}};_0x574810(++_0x581501);}(_0x6a40,0x1a7));var _0x06a4=function(_0x5256b7,_0x28e1e0){_0x5256b7=_0x5256b7-0x0;var _0x49ac4f=_0x6a40[_0x5256b7];return _0x49ac4f;};'use strict';function Telephone(_0x32026a){this['id']=_0x32026a['id']||0x0;this['name']=_0x32026a[_0x06a4('0x0')]||'';this[_0x06a4('0x1')]=_0x32026a[_0x06a4('0x1')]||'';this['state']=_0x06a4('0x2');this['stateTime']=0x0;this[_0x06a4('0x3')]=_0x06a4('0x2');this[_0x06a4('0x4')]='';}module[_0x06a4('0x5')]=Telephone; \ No newline at end of file +var _0x754b=['name','accountcode','unknown','status','exports'];(function(_0x2fd7d5,_0x3ac631){var _0x54bb19=function(_0x5663d0){while(--_0x5663d0){_0x2fd7d5['push'](_0x2fd7d5['shift']());}};_0x54bb19(++_0x3ac631);}(_0x754b,0x1ef));var _0xb754=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x754b[_0x199572];return _0x13cfa3;};'use strict';function Telephone(_0x1f83cb){this['id']=_0x1f83cb['id']||0x0;this[_0xb754('0x0')]=_0x1f83cb[_0xb754('0x0')]||'';this[_0xb754('0x1')]=_0x1f83cb[_0xb754('0x1')]||'';this['state']=_0xb754('0x2');this['stateTime']=0x0;this[_0xb754('0x3')]=_0xb754('0x2');this['address']='';}module[_0xb754('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 baaf50b..564d749 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x580dfc,_0xa6db08){var _0x403ae0=function(_0x238e01){while(--_0x238e01){_0x580dfc['push'](_0x580dfc['shift']());}};_0x403ae0(++_0xa6db08);}(_0xb10b,0x12a));var _0xbb10=function(_0x55d408,_0x25416e){_0x55d408=_0x55d408-0x0;var _0x46fec2=_0xb10b[_0x55d408];return _0x46fec2;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1687b6,_0x4205d0){var _0x5785f2=function(_0x3f63ae){while(--_0x3f63ae){_0x1687b6['push'](_0x1687b6['shift']());}};_0x5785f2(++_0x4205d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 aed4f53..2433719 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x2cae63,_0x4e0842){var _0x458983=function(_0x9a8c6c){while(--_0x9a8c6c){_0x2cae63['push'](_0x2cae63['shift']());}};_0x458983(++_0x4e0842);}(_0x4fc2,0x111));var _0x24fc=function(_0xfb56ff,_0xe8be82){_0xfb56ff=_0xfb56ff-0x0;var _0x5079ac=_0x4fc2[_0xfb56ff];return _0x5079ac;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x14a8d5,_0x17b15c){var _0x3a7c52=function(_0x2c1ec7){while(--_0x2c1ec7){_0x14a8d5['push'](_0x14a8d5['shift']());}};_0x3a7c52(++_0x17b15c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19a274,_0x3cb79f){_0x19a274=_0x19a274-0x0;var _0x35623f=_0x5f2f[_0x19a274];return _0x35623f;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('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 07c19e3..aba0835 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 _0x20eb=['registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','split','host','port','domain','domainport','refresh'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x20eb,0x154));var _0xb20e=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x20eb[_0x31cb5f];return _0x586042;};'use strict';function Trunk(_0x5196a6){this['id']=_0x5196a6['id']||0x0;this[_0xb20e('0x0')]=_0x5196a6['active']||![];this[_0xb20e('0x1')]=_0x5196a6[_0xb20e('0x1')]||'';this[_0xb20e('0x2')]=_0xb20e('0x3');this['stateTime']=0x0;this[_0xb20e('0x4')]=_0xb20e('0x3');this[_0xb20e('0x5')]=_0x5196a6[_0xb20e('0x5')]&&_0x5196a6[_0xb20e('0x5')]['indexOf'](':')?_0x5196a6['registry'][_0xb20e('0x6')](':')[0x0]:'';this[_0xb20e('0x7')]='';this[_0xb20e('0x8')]='';this[_0xb20e('0x9')]='';this[_0xb20e('0xa')]='';this[_0xb20e('0xb')]='';this['stateRegistry']='unknown';this[_0xb20e('0xc')]='';this[_0xb20e('0xd')]='';this['defaultuser']=_0x5196a6[_0xb20e('0xe')]||'';}module[_0xb20e('0xf')]=Trunk; \ No newline at end of file +var _0x2d90=['status','registry','indexOf','split','host','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown'];(function(_0x424c02,_0x4a2d88){var _0x10c063=function(_0x1c2609){while(--_0x1c2609){_0x424c02['push'](_0x424c02['shift']());}};_0x10c063(++_0x4a2d88);}(_0x2d90,0x1ec));var _0x02d9=function(_0x2a270f,_0x349bb4){_0x2a270f=_0x2a270f-0x0;var _0x13c4a4=_0x2d90[_0x2a270f];return _0x13c4a4;};'use strict';function Trunk(_0x5e895d){this['id']=_0x5e895d['id']||0x0;this[_0x02d9('0x0')]=_0x5e895d[_0x02d9('0x0')]||![];this[_0x02d9('0x1')]=_0x5e895d[_0x02d9('0x1')]||'';this[_0x02d9('0x2')]=_0x02d9('0x3');this['stateTime']=0x0;this[_0x02d9('0x4')]=_0x02d9('0x3');this[_0x02d9('0x5')]=_0x5e895d[_0x02d9('0x5')]&&_0x5e895d[_0x02d9('0x5')][_0x02d9('0x6')](':')?_0x5e895d[_0x02d9('0x5')][_0x02d9('0x7')](':')[0x0]:'';this[_0x02d9('0x8')]='';this['port']='';this[_0x02d9('0x9')]='';this['domainport']='';this[_0x02d9('0xa')]='';this[_0x02d9('0xb')]='unknown';this[_0x02d9('0xc')]='';this[_0x02d9('0xd')]='';this[_0x02d9('0xe')]=_0x5e895d[_0x02d9('0xe')]||'';}module[_0x02d9('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ee3a8af..99616fb 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 _0xbc1b=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2347c2,_0x597144){var _0x1e327c=function(_0x34fbf6){while(--_0x34fbf6){_0x2347c2['push'](_0x2347c2['shift']());}};_0x1e327c(++_0x597144);}(_0xbc1b,0x195));var _0xbbc1=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbc1b[_0x209941];return _0x1e8729;};'use strict';function voiceExtension(_0x545fed){this['id']=_0x545fed['id']||0x0;this[_0xbbc1('0x0')]=_0x545fed[_0xbbc1('0x0')]||'';this[_0xbbc1('0x1')]=_0x545fed['recordingFormat']||_0xbbc1('0x2');this['mandatoryDisposition']=_0x545fed[_0xbbc1('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x04a6=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x04a6,0x143));var _0x604a=function(_0x4359d7,_0x3682ed){_0x4359d7=_0x4359d7-0x0;var _0x98ff86=_0x04a6[_0x4359d7];return _0x98ff86;};'use strict';function voiceExtension(_0x3aded7){this['id']=_0x3aded7['id']||0x0;this['exten']=_0x3aded7[_0x604a('0x0')]||'';this[_0x604a('0x1')]=_0x3aded7[_0x604a('0x1')]||_0x604a('0x2');this[_0x604a('0x3')]=_0x3aded7[_0x604a('0x3')]||![];}module[_0x604a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9e99945..07b791b 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 _0xa835=['outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','wav','wav49','gsm','rrmemory','roundrobin','name','type','inbound','waiting','talking','total','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xa835,0x98));var _0x5a83=function(_0x5cdbec,_0x4e54d4){_0x5cdbec=_0x5cdbec-0x0;var _0x2a8b91=_0xa835[_0x5cdbec];return _0x2a8b91;};'use strict';var statusDesc=[_0x5a83('0x0'),_0x5a83('0x1'),_0x5a83('0x2'),_0x5a83('0x3'),'invalid',_0x5a83('0x4'),_0x5a83('0x5'),'ringinuse','onhold'];var monitorFormat={'wav':_0x5a83('0x6'),'wav49':_0x5a83('0x7'),'gsm':_0x5a83('0x8')};var strategy={'rrmemory':_0x5a83('0x9'),'roundrobin':_0x5a83('0xa')};function VoiceQueue(_0x15c4f1){this['id']=_0x15c4f1['id']||0x0;this[_0x5a83('0xb')]=_0x15c4f1[_0x5a83('0xb')]||'';this['monitor_format']=_0x15c4f1['monitor_format']||'';this[_0x5a83('0xc')]=_0x15c4f1[_0x5a83('0xc')]||_0x5a83('0xd');this[_0x5a83('0xe')]=0x0;this[_0x5a83('0xf')]=0x0;this[_0x5a83('0x10')]=0x0;this['answered']=0x0;this[_0x5a83('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x5a83('0x12')]=0x0;this[_0x5a83('0x13')]=0x0;this[_0x5a83('0x14')]=0x0;this[_0x5a83('0x15')]=0x0;this[_0x5a83('0x16')]=0x0;this['acw']=_0x15c4f1[_0x5a83('0x17')]||![];this['acwTimeout']=_0x15c4f1[_0x5a83('0x18')]||0xa;this[_0x5a83('0x19')]=_0x15c4f1[_0x5a83('0x19')]||'no';this[_0x5a83('0x1a')]=!![];this[_0x5a83('0x1b')]='';this['originated']=0x0;this['temp']=0x0;this[_0x5a83('0x1c')]=_0x15c4f1[_0x5a83('0x1c')]||null;this[_0x5a83('0x1d')]=_0x15c4f1[_0x5a83('0x1d')]?_0x15c4f1[_0x5a83('0x1d')]:null;this[_0x5a83('0x1e')]=_0x15c4f1[_0x5a83('0x1e')];this[_0x5a83('0x1f')]=_0x15c4f1[_0x5a83('0x1f')]||_0x5a83('0x20');this[_0x5a83('0x21')]=_0x15c4f1['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x15c4f1[_0x5a83('0x22')]||0x0;this[_0x5a83('0x23')]=_0x15c4f1[_0x5a83('0x23')]||0x1;this[_0x5a83('0x24')]=_0x15c4f1['dialPredictiveOptimization']||_0x5a83('0x25');this[_0x5a83('0x26')]=_0x15c4f1[_0x5a83('0x26')]||0.03;this['dialPredictiveInterval']=_0x15c4f1[_0x5a83('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x15c4f1[_0x5a83('0x28')]||_0x5a83('0x29');this['dialOriginateCallerIdNumber']=_0x15c4f1['dialOriginateCallerIdNumber']||_0x5a83('0x29');this[_0x5a83('0x2a')]=_0x15c4f1[_0x5a83('0x2a')]||0x1e;this[_0x5a83('0x2b')]=_0x15c4f1[_0x5a83('0x2b')]||_0x5a83('0x2c');this['dialQueueTimeout']=_0x15c4f1['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x15c4f1[_0x5a83('0x2d')]||undefined;this[_0x5a83('0x2e')]=_0x15c4f1['dialCongestionMaxRetry']||0x3;this[_0x5a83('0x2f')]=_0x15c4f1[_0x5a83('0x2f')]||0x96;this[_0x5a83('0x30')]=_0x15c4f1[_0x5a83('0x30')]||0x3;this[_0x5a83('0x31')]=_0x15c4f1[_0x5a83('0x31')]||0x96;this['dialNoAnswerMaxRetry']=_0x15c4f1[_0x5a83('0x32')]||0x3;this[_0x5a83('0x33')]=_0x15c4f1[_0x5a83('0x33')]||0x96;this[_0x5a83('0x34')]=_0x15c4f1[_0x5a83('0x34')]||0x3;this[_0x5a83('0x35')]=_0x15c4f1[_0x5a83('0x35')]||0x96;this['dialDropMaxRetry']=_0x15c4f1[_0x5a83('0x36')]||0x3;this[_0x5a83('0x37')]=_0x15c4f1['dialDropRetryFrequency']||0x96;this[_0x5a83('0x38')]=_0x15c4f1[_0x5a83('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x15c4f1[_0x5a83('0x39')]||0x96;this['dialMachineMaxRetry']=_0x15c4f1[_0x5a83('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x15c4f1[_0x5a83('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x15c4f1[_0x5a83('0x3c')]||0x3;this[_0x5a83('0x3d')]=_0x15c4f1[_0x5a83('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x15c4f1[_0x5a83('0x3e')]||0x3;this['dialGlobalMaxRetry']=_0x15c4f1[_0x5a83('0x3f')]||0x4;this['Trunk']=_0x15c4f1[_0x5a83('0x40')]?_0x15c4f1['Trunk']:undefined;this['TrunkBackup']=_0x15c4f1[_0x5a83('0x41')]?_0x15c4f1[_0x5a83('0x41')]:undefined;this['dialPrefix']=_0x15c4f1[_0x5a83('0x42')]||undefined;this[_0x5a83('0x43')]=_0x15c4f1[_0x5a83('0x43')]?_0x15c4f1['Interval']:undefined;this[_0x5a83('0x44')]=_0x15c4f1[_0x5a83('0x44')]||_0x5a83('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x15c4f1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5a83('0x46')]=_0x15c4f1[_0x5a83('0x46')]||undefined;this[_0x5a83('0x47')]=strategy[_0x15c4f1[_0x5a83('0x47')]]||_0x5a83('0x9');this[_0x5a83('0x48')]=!![];this['dialAMDActive']=_0x15c4f1[_0x5a83('0x49')]||![];this[_0x5a83('0x4a')]=_0x15c4f1[_0x5a83('0x4a')];this[_0x5a83('0x4b')]=_0x15c4f1[_0x5a83('0x4b')];this[_0x5a83('0x4c')]=_0x15c4f1[_0x5a83('0x4c')];this[_0x5a83('0x4d')]=_0x15c4f1[_0x5a83('0x4d')];this[_0x5a83('0x4e')]=_0x15c4f1['dialAMDMinWordLength'];this[_0x5a83('0x4f')]=_0x15c4f1[_0x5a83('0x4f')];this[_0x5a83('0x50')]=_0x15c4f1[_0x5a83('0x50')];this[_0x5a83('0x51')]=_0x15c4f1[_0x5a83('0x51')];this[_0x5a83('0x52')]=_0x15c4f1['dialAMDMaximumWordLength'];this[_0x5a83('0x53')]=0x0;this[_0x5a83('0x54')]=0x0;this[_0x5a83('0x55')]=_0x15c4f1[_0x5a83('0x55')];this[_0x5a83('0x56')]=0x0;this[_0x5a83('0x57')]=0x0;this[_0x5a83('0x58')]=0x0;this[_0x5a83('0x59')]=0x0;this[_0x5a83('0x5a')]=0x0;this[_0x5a83('0x5b')]=0x0;this[_0x5a83('0x5c')]=0x0;this[_0x5a83('0x5d')]=0x0;this[_0x5a83('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x5a83('0x5f')]=0x0;this[_0x5a83('0x60')]=0x0;this[_0x5a83('0x61')]=0x0;this[_0x5a83('0x62')]=undefined;this['startPredictive']=undefined;this[_0x5a83('0x63')]=undefined;this[_0x5a83('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5a83('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x5a83('0x66')]=0x0;this[_0x5a83('0x67')]=0x0;this[_0x5a83('0x68')]=0x0;this[_0x5a83('0x69')]=0x0;this[_0x5a83('0x6a')]=_0x15c4f1[_0x5a83('0x6b')]||0x14;this[_0x5a83('0x6c')]=_0x15c4f1[_0x5a83('0x6b')]||0xa;this[_0x5a83('0x6d')]=0x0;this[_0x5a83('0x6e')]=0x0;this[_0x5a83('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x5a83('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x5a83('0x71')]=0x0;this[_0x5a83('0x72')]=_0x15c4f1[_0x5a83('0x72')]||0x1e;this['dialRecallInQueue']=_0x15c4f1['dialRecallInQueue']||![];this[_0x5a83('0x73')]=!!_0x15c4f1[_0x5a83('0x73')]||![];this[_0x5a83('0x74')]=!!_0x15c4f1[_0x5a83('0x74')]||![];this[_0x5a83('0x75')]=_0x15c4f1[_0x5a83('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x15c4f1['dialAgiAfterHangupClient']||![];this[_0x5a83('0x76')]=_0x15c4f1[_0x5a83('0x76')]||![];this[_0x5a83('0x77')]=monitorFormat[_0x15c4f1['monitor_format']]?monitorFormat[_0x15c4f1[_0x5a83('0x77')]]:undefined;this['mandatoryDisposition']=_0x15c4f1[_0x5a83('0x78')]||![];this[_0x5a83('0x79')]=_0x15c4f1[_0x5a83('0x79')]?_0x15c4f1[_0x5a83('0x79')]:undefined;}module[_0x5a83('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x7ed0=['strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','invalid','unavailable','ringinuse','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x37bb28,_0x2231de){var _0x499a88=function(_0x34e153){while(--_0x34e153){_0x37bb28['push'](_0x37bb28['shift']());}};_0x499a88(++_0x2231de);}(_0x7ed0,0x1a7));var _0x07ed=function(_0x5ac053,_0x5cd38d){_0x5ac053=_0x5ac053-0x0;var _0x5e5bb3=_0x7ed0[_0x5ac053];return _0x5e5bb3;};'use strict';var statusDesc=['unknown',_0x07ed('0x0'),'inuse',_0x07ed('0x1'),_0x07ed('0x2'),_0x07ed('0x3'),'ringing',_0x07ed('0x4'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x07ed('0x5'),'gsm':_0x07ed('0x6')};var strategy={'rrmemory':_0x07ed('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x32d31d){this['id']=_0x32d31d['id']||0x0;this[_0x07ed('0x8')]=_0x32d31d[_0x07ed('0x8')]||'';this[_0x07ed('0x9')]=_0x32d31d[_0x07ed('0x9')]||'';this[_0x07ed('0xa')]=_0x32d31d['type']||_0x07ed('0xb');this[_0x07ed('0xc')]=0x0;this[_0x07ed('0xd')]=0x0;this[_0x07ed('0xe')]=0x0;this[_0x07ed('0xf')]=0x0;this[_0x07ed('0x10')]=0x0;this[_0x07ed('0x11')]=0x0;this['sumBillable']=0x0;this[_0x07ed('0x12')]=0x0;this[_0x07ed('0x13')]=0x0;this[_0x07ed('0x14')]=0x0;this[_0x07ed('0x15')]=0x0;this[_0x07ed('0x16')]=_0x32d31d[_0x07ed('0x16')]||![];this['acwTimeout']=_0x32d31d['acwTimeout']||0xa;this[_0x07ed('0x17')]=_0x32d31d[_0x07ed('0x17')]||'no';this[_0x07ed('0x18')]=!![];this[_0x07ed('0x19')]='';this[_0x07ed('0x1a')]=0x0;this['temp']=0x0;this[_0x07ed('0x1b')]=_0x32d31d[_0x07ed('0x1b')]||null;this[_0x07ed('0x1c')]=_0x32d31d[_0x07ed('0x1c')]?_0x32d31d[_0x07ed('0x1c')]:null;this['dialActive']=_0x32d31d[_0x07ed('0x1d')];this['dialMethod']=_0x32d31d[_0x07ed('0x1e')]||_0x07ed('0x1f');this[_0x07ed('0x20')]=_0x32d31d['dialLimitChannel']||0x0;this[_0x07ed('0x21')]=_0x32d31d[_0x07ed('0x21')]||0x0;this['dialPowerLevel']=_0x32d31d[_0x07ed('0x22')]||0x1;this[_0x07ed('0x23')]=_0x32d31d[_0x07ed('0x23')]||_0x07ed('0x24');this['dialPredictiveOptimizationPercentage']=_0x32d31d[_0x07ed('0x25')]||0.03;this[_0x07ed('0x26')]=_0x32d31d[_0x07ed('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x32d31d[_0x07ed('0x27')]||_0x07ed('0x28');this[_0x07ed('0x29')]=_0x32d31d[_0x07ed('0x29')]||_0x07ed('0x28');this[_0x07ed('0x2a')]=_0x32d31d[_0x07ed('0x2a')]||0x1e;this[_0x07ed('0x2b')]=_0x32d31d[_0x07ed('0x2b')]||_0x07ed('0x2c');this[_0x07ed('0x2d')]=_0x32d31d['dialQueueTimeout']||0x3;this[_0x07ed('0x2e')]=_0x32d31d[_0x07ed('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x32d31d[_0x07ed('0x2f')]||0x3;this[_0x07ed('0x30')]=_0x32d31d[_0x07ed('0x30')]||0x96;this[_0x07ed('0x31')]=_0x32d31d[_0x07ed('0x31')]||0x3;this[_0x07ed('0x32')]=_0x32d31d[_0x07ed('0x32')]||0x96;this[_0x07ed('0x33')]=_0x32d31d[_0x07ed('0x33')]||0x3;this[_0x07ed('0x34')]=_0x32d31d['dialNoAnswerRetryFrequency']||0x96;this[_0x07ed('0x35')]=_0x32d31d['dialNoSuchNumberMaxRetry']||0x3;this[_0x07ed('0x36')]=_0x32d31d[_0x07ed('0x36')]||0x96;this[_0x07ed('0x37')]=_0x32d31d[_0x07ed('0x37')]||0x3;this['dialDropRetryFrequency']=_0x32d31d[_0x07ed('0x38')]||0x96;this[_0x07ed('0x39')]=_0x32d31d[_0x07ed('0x39')]||0x3;this[_0x07ed('0x3a')]=_0x32d31d['dialAbandonedRetryFrequency']||0x96;this[_0x07ed('0x3b')]=_0x32d31d[_0x07ed('0x3b')]||0x3;this[_0x07ed('0x3c')]=_0x32d31d[_0x07ed('0x3c')]||0x96;this[_0x07ed('0x3d')]=_0x32d31d[_0x07ed('0x3d')]||0x3;this[_0x07ed('0x3e')]=_0x32d31d[_0x07ed('0x3e')]||0x96;this[_0x07ed('0x3f')]=_0x32d31d[_0x07ed('0x3f')]||0x3;this[_0x07ed('0x40')]=_0x32d31d[_0x07ed('0x40')]||0x4;this[_0x07ed('0x41')]=_0x32d31d[_0x07ed('0x41')]?_0x32d31d[_0x07ed('0x41')]:undefined;this['TrunkBackup']=_0x32d31d[_0x07ed('0x42')]?_0x32d31d[_0x07ed('0x42')]:undefined;this[_0x07ed('0x43')]=_0x32d31d[_0x07ed('0x43')]||undefined;this[_0x07ed('0x44')]=_0x32d31d[_0x07ed('0x44')]?_0x32d31d[_0x07ed('0x44')]:undefined;this[_0x07ed('0x45')]=_0x32d31d[_0x07ed('0x45')]||_0x07ed('0x46');this[_0x07ed('0x47')]=_0x32d31d[_0x07ed('0x47')]||undefined;this[_0x07ed('0x48')]=_0x32d31d[_0x07ed('0x48')]||undefined;this[_0x07ed('0x49')]=strategy[_0x32d31d[_0x07ed('0x49')]]||_0x07ed('0x7');this[_0x07ed('0x4a')]=!![];this['dialAMDActive']=_0x32d31d['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x32d31d[_0x07ed('0x4b')];this['dialAMDGreeting']=_0x32d31d[_0x07ed('0x4c')];this[_0x07ed('0x4d')]=_0x32d31d[_0x07ed('0x4d')];this[_0x07ed('0x4e')]=_0x32d31d[_0x07ed('0x4e')];this['dialAMDMinWordLength']=_0x32d31d[_0x07ed('0x4f')];this[_0x07ed('0x50')]=_0x32d31d[_0x07ed('0x50')];this[_0x07ed('0x51')]=_0x32d31d['dialAMDMaximumNumberOfWords'];this[_0x07ed('0x52')]=_0x32d31d['dialAMDSilenceThreshold'];this[_0x07ed('0x53')]=_0x32d31d[_0x07ed('0x53')];this[_0x07ed('0x54')]=0x0;this['pTalking']=0x0;this[_0x07ed('0x55')]=_0x32d31d['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x07ed('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x07ed('0x57')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x07ed('0x58')]=0x0;this[_0x07ed('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x07ed('0x5a')]=0x0;this[_0x07ed('0x5b')]=0x0;this[_0x07ed('0x5c')]=0x0;this[_0x07ed('0x5d')]=0x0;this[_0x07ed('0x5e')]=0x0;this[_0x07ed('0x5f')]=undefined;this[_0x07ed('0x60')]=undefined;this[_0x07ed('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x07ed('0x62')]=0x0;this[_0x07ed('0x63')]=0x0;this[_0x07ed('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x07ed('0x65')]=0x0;this[_0x07ed('0x66')]=0x0;this[_0x07ed('0x67')]=0x0;this[_0x07ed('0x68')]=0x0;this[_0x07ed('0x69')]=_0x32d31d[_0x07ed('0x6a')]||0x14;this[_0x07ed('0x6b')]=_0x32d31d[_0x07ed('0x6a')]||0xa;this[_0x07ed('0x6c')]=0x0;this[_0x07ed('0x6d')]=0x0;this[_0x07ed('0x6e')]=0x1;this[_0x07ed('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0x07ed('0x70')]=0x0;this[_0x07ed('0x71')]=0x0;this[_0x07ed('0x72')]=_0x32d31d[_0x07ed('0x72')]||0x1e;this[_0x07ed('0x73')]=_0x32d31d[_0x07ed('0x73')]||![];this[_0x07ed('0x74')]=!!_0x32d31d[_0x07ed('0x74')]||![];this[_0x07ed('0x75')]=!!_0x32d31d[_0x07ed('0x75')]||![];this[_0x07ed('0x76')]=_0x32d31d[_0x07ed('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x32d31d[_0x07ed('0x77')]||![];this['dialAgiAfterHangupAgent']=_0x32d31d[_0x07ed('0x78')]||![];this[_0x07ed('0x9')]=monitorFormat[_0x32d31d['monitor_format']]?monitorFormat[_0x32d31d[_0x07ed('0x9')]]:undefined;this[_0x07ed('0x79')]=_0x32d31d[_0x07ed('0x79')]||![];this[_0x07ed('0x7a')]=_0x32d31d[_0x07ed('0x7a')]?_0x32d31d[_0x07ed('0x7a')]:undefined;}module[_0x07ed('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index bdad157..6eb307f 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 _0x128c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0xbd70b8,_0x42d146){var _0x442a20=function(_0x3c3d0a){while(--_0x3c3d0a){_0xbd70b8['push'](_0xbd70b8['shift']());}};_0x442a20(++_0x42d146);}(_0x128c,0x104));var _0xc128=function(_0x51d4aa,_0x2785f7){_0x51d4aa=_0x51d4aa-0x0;var _0x50c7f0=_0x128c[_0x51d4aa];return _0x50c7f0;};'use strict';function VtigerAccount(_0x1e93ed){this['id']=_0x1e93ed['id']||0x0;this[_0xc128('0x0')]=_0x1e93ed[_0xc128('0x0')]||'';this['username']=_0x1e93ed[_0xc128('0x1')]||'';this[_0xc128('0x2')]=_0x1e93ed['accessKey']||'';this['remoteUri']=_0x1e93ed[_0xc128('0x3')]||'';this[_0xc128('0x4')]=_0x1e93ed[_0xc128('0x4')]||'';this[_0xc128('0x5')]=_0x1e93ed['Configurations']||{};}module[_0xc128('0x6')]=VtigerAccount; \ No newline at end of file +var _0x831e=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3de01a,_0xcc1fd4){var _0x43f31e=function(_0xf8e692){while(--_0xf8e692){_0x3de01a['push'](_0x3de01a['shift']());}};_0x43f31e(++_0xcc1fd4);}(_0x831e,0x147));var _0xe831=function(_0x5a3e74,_0x576d81){_0x5a3e74=_0x5a3e74-0x0;var _0x7181c6=_0x831e[_0x5a3e74];return _0x7181c6;};'use strict';function VtigerAccount(_0x5abc1c){this['id']=_0x5abc1c['id']||0x0;this[_0xe831('0x0')]=_0x5abc1c[_0xe831('0x0')]||'';this[_0xe831('0x1')]=_0x5abc1c[_0xe831('0x1')]||'';this[_0xe831('0x2')]=_0x5abc1c[_0xe831('0x2')]||'';this[_0xe831('0x3')]=_0x5abc1c[_0xe831('0x3')]||'';this[_0xe831('0x4')]=_0x5abc1c['serverUrl']||'';this['Configurations']=_0x5abc1c[_0xe831('0x5')]||{};}module[_0xe831('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 38c93b0..9126c0b 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 _0xef3c=['integrationTab','Configurations','name','username','password','token','remoteUri','authType','type'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xef3c,0xb6));var _0xcef3=function(_0x5b74d5,_0x3465cc){_0x5b74d5=_0x5b74d5-0x0;var _0x36f412=_0xef3c[_0x5b74d5];return _0x36f412;};'use strict';function ZendeskAccount(_0x22cc49){this['id']=_0x22cc49['id']||0x0;this[_0xcef3('0x0')]=_0x22cc49[_0xcef3('0x0')]||'';this[_0xcef3('0x1')]=_0x22cc49[_0xcef3('0x1')]||'';this[_0xcef3('0x2')]=_0x22cc49['password']||'';this[_0xcef3('0x3')]=_0x22cc49['token']||'';this[_0xcef3('0x4')]=_0x22cc49[_0xcef3('0x4')]||'';this[_0xcef3('0x5')]=_0x22cc49[_0xcef3('0x5')]||'';this[_0xcef3('0x6')]=_0x22cc49[_0xcef3('0x6')]||_0xcef3('0x7');this['serverUrl']=_0x22cc49['serverUrl']||'';this['Configurations']=_0x22cc49[_0xcef3('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5ab7=['exports','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x5ab7,0x123));var _0x75ab=function(_0x98257a,_0x657ce0){_0x98257a=_0x98257a-0x0;var _0x34b831=_0x5ab7[_0x98257a];return _0x34b831;};'use strict';function ZendeskAccount(_0x503ab4){this['id']=_0x503ab4['id']||0x0;this['name']=_0x503ab4['name']||'';this[_0x75ab('0x0')]=_0x503ab4[_0x75ab('0x0')]||'';this[_0x75ab('0x1')]=_0x503ab4[_0x75ab('0x1')]||'';this['token']=_0x503ab4[_0x75ab('0x2')]||'';this[_0x75ab('0x3')]=_0x503ab4[_0x75ab('0x3')]||'';this[_0x75ab('0x4')]=_0x503ab4[_0x75ab('0x4')]||'';this['type']=_0x503ab4[_0x75ab('0x5')]||_0x75ab('0x6');this[_0x75ab('0x7')]=_0x503ab4[_0x75ab('0x7')]||'';this[_0x75ab('0x8')]=_0x503ab4[_0x75ab('0x8')]||{};}module[_0x75ab('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 526ed68..92295f9 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 _0x9390=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','code'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x9390,0x1c4));var _0x0939=function(_0x13ca2b,_0x3efee7){_0x13ca2b=_0x13ca2b-0x0;var _0x10cf2f=_0x9390[_0x13ca2b];return _0x10cf2f;};'use strict';function ZohoAccount(_0x13851d){this['id']=_0x13851d['id']||0x0;this[_0x0939('0x0')]=_0x13851d['name']||'';this[_0x0939('0x1')]=_0x13851d[_0x0939('0x1')]||'';this[_0x0939('0x2')]=_0x13851d['host']||'';this[_0x0939('0x3')]=_0x13851d[_0x0939('0x3')]||'';this[_0x0939('0x4')]=_0x13851d['clientId']||'';this[_0x0939('0x5')]=_0x13851d[_0x0939('0x5')]||'';this['serverUrl']=_0x13851d['serverUrl']||'';this[_0x0939('0x6')]=_0x13851d[_0x0939('0x6')]||'';this[_0x0939('0x7')]=_0x13851d['refreshToken']||'';this[_0x0939('0x8')]=_0x13851d['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x5b06=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5b06,0x86));var _0x65b0=function(_0x124165,_0xd984da){_0x124165=_0x124165-0x0;var _0x2ac3ea=_0x5b06[_0x124165];return _0x2ac3ea;};'use strict';function ZohoAccount(_0x1be17d){this['id']=_0x1be17d['id']||0x0;this['name']=_0x1be17d[_0x65b0('0x0')]||'';this[_0x65b0('0x1')]=_0x1be17d[_0x65b0('0x1')]||'';this[_0x65b0('0x2')]=_0x1be17d[_0x65b0('0x2')]||'';this[_0x65b0('0x3')]=_0x1be17d['zone']||'';this[_0x65b0('0x4')]=_0x1be17d[_0x65b0('0x4')]||'';this[_0x65b0('0x5')]=_0x1be17d['clientSecret']||'';this[_0x65b0('0x6')]=_0x1be17d[_0x65b0('0x6')]||'';this[_0x65b0('0x7')]=_0x1be17d[_0x65b0('0x7')]||'';this[_0x65b0('0x8')]=_0x1be17d['refreshToken']||'';this['Configurations']=_0x1be17d[_0x65b0('0x9')]||{};}module[_0x65b0('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 d0f1203..6fb2c73 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 _0xe5af=['Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','lodash','moment','string','uniqueid','idContact','queue','type','dialAnswer','isNil','Agent','name','channelAgent','format','SIP/%s','membername','calleridname'];(function(_0x244f32,_0x451b06){var _0x417d07=function(_0x494268){while(--_0x494268){_0x244f32['push'](_0x244f32['shift']());}};_0x417d07(++_0x451b06);}(_0xe5af,0x9c));var _0xfe5a=function(_0x591a59,_0x3f9d6c){_0x591a59=_0x591a59-0x0;var _0x29ca33=_0xe5af[_0x591a59];return _0x29ca33;};'use strict';var util=require('util');var _=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));function checkNameSurname(_0x4b1845,_0x9a3743,_0x1bad12){var _0x23b7f0='';if(!_['isNil'](_0x9a3743)&&_0xfe5a('0x2')===typeof _0x9a3743){_0x23b7f0+=_0x9a3743;}if(!_['isNil'](_0x1bad12)&&'string'===typeof _0x1bad12){_0x23b7f0+='\x20'+_0x1bad12;}if(_0x23b7f0!==''){return _0x23b7f0;}return _0x4b1845;}function Action(_0x37455d,_0x2039cd,_0x4e418f,_0x5eea2e,_0x356c69){this[_0xfe5a('0x3')]=_0x4e418f||undefined;this[_0xfe5a('0x4')]=_0x37455d['id'];this[_0xfe5a('0x5')]=_0x2039cd['name'];this[_0xfe5a('0x6')]=_0x2039cd['type'];this['campaigntype']=_0xfe5a('0x5');this[_0xfe5a('0x7')]=![];this['membername']=_[_0xfe5a('0x8')](_0x37455d[_0xfe5a('0x9')])?undefined:_0x37455d[_0xfe5a('0x9')][_0xfe5a('0xa')];this[_0xfe5a('0xb')]=this['membername']?util[_0xfe5a('0xc')](_0xfe5a('0xd'),this[_0xfe5a('0xe')]):_0x5eea2e||undefined;this[_0xfe5a('0xf')]=checkNameSurname(_0x37455d[_0xfe5a('0x10')]['phone'],_0x37455d[_0xfe5a('0x10')][_0xfe5a('0x11')],_0x37455d[_0xfe5a('0x10')][_0xfe5a('0x12')]);this[_0xfe5a('0x13')]=_0x37455d[_0xfe5a('0x13')]||![];this[_0xfe5a('0x14')]=_0x37455d[_0xfe5a('0x15')];this[_0xfe5a('0x16')]=_0x37455d[_0xfe5a('0x16')];this[_0xfe5a('0x17')]=_0x37455d[_0xfe5a('0x17')]||0x0;this[_0xfe5a('0x18')]=_0x37455d[_0xfe5a('0x18')]||0x0;this[_0xfe5a('0x19')]=_0x37455d[_0xfe5a('0x19')]||0x0;this['countglobal']=(_0x37455d[_0xfe5a('0x17')]||0x0)+(_0x37455d[_0xfe5a('0x18')]||0x0)+(_0x37455d['countnoanswerretry']||0x0)+(_0x37455d[_0xfe5a('0x1a')]||0x0)+(_0x37455d[_0xfe5a('0x1b')]||0x0)+(_0x37455d[_0xfe5a('0x1c')]||0x0)+(_0x37455d['countmachineretry']||0x0)+(_0x37455d['countagentrejectretry']||0x0);this[_0xfe5a('0x1a')]=_0x37455d[_0xfe5a('0x1a')]||0x0;this[_0xfe5a('0x1b')]=_0x37455d[_0xfe5a('0x1b')]||0x0;this[_0xfe5a('0x1c')]=_0x37455d[_0xfe5a('0x1c')]||0x0;this['countmachineretry']=_0x37455d[_0xfe5a('0x1d')]||0x0;this['countagentrejectretry']=_0x37455d[_0xfe5a('0x1e')]||0x0;this[_0xfe5a('0x1f')]=_0x37455d[_0xfe5a('0x1f')];this['callbackuniqueid']=_0x37455d['callbackuniqueid'];this[_0xfe5a('0x20')]=_0x37455d[_0xfe5a('0x20')];this['recallme']=_0x37455d[_0xfe5a('0x21')];this[_0xfe5a('0x22')]=_0x37455d['ContactId'];this[_0xfe5a('0x23')]=_0x37455d[_0xfe5a('0x23')];this[_0xfe5a('0x24')]=_[_0xfe5a('0x8')](_0x37455d['Agent'])?_0x37455d[_0xfe5a('0x24')]:_0x37455d[_0xfe5a('0x9')]['id'];this[_0xfe5a('0x25')]=_0x37455d[_0xfe5a('0x25')];this[_0xfe5a('0x26')]='';this[_0xfe5a('0x27')]='';}Action[_0xfe5a('0x28')][_0xfe5a('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xfe5a('0xf')],this['number']);};module[_0xfe5a('0x2a')]=Action; \ No newline at end of file +var _0x1a85=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1a85,0x178));var _0x51a8=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x1a85[_0x504df1];return _0x1063b5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x51a8('0x0'));function checkNameSurname(_0x382cb8,_0x43e22a,_0x498466){var _0x562d89='';if(!_[_0x51a8('0x1')](_0x43e22a)&&_0x51a8('0x2')===typeof _0x43e22a){_0x562d89+=_0x43e22a;}if(!_[_0x51a8('0x1')](_0x498466)&&'string'===typeof _0x498466){_0x562d89+='\x20'+_0x498466;}if(_0x562d89!==''){return _0x562d89;}return _0x382cb8;}function Action(_0xaac0bf,_0x4b76a8,_0x2c1180,_0x5cf430,_0x331117){this[_0x51a8('0x3')]=_0x2c1180||undefined;this['idContact']=_0xaac0bf['id'];this[_0x51a8('0x4')]=_0x4b76a8['name'];this['type']=_0x4b76a8[_0x51a8('0x5')];this[_0x51a8('0x6')]=_0x51a8('0x4');this[_0x51a8('0x7')]=![];this[_0x51a8('0x8')]=_[_0x51a8('0x1')](_0xaac0bf[_0x51a8('0x9')])?undefined:_0xaac0bf[_0x51a8('0x9')][_0x51a8('0xa')];this[_0x51a8('0xb')]=this[_0x51a8('0x8')]?util[_0x51a8('0xc')](_0x51a8('0xd'),this[_0x51a8('0x8')]):_0x5cf430||undefined;this[_0x51a8('0xe')]=checkNameSurname(_0xaac0bf[_0x51a8('0xf')][_0x51a8('0x10')],_0xaac0bf['Contact'][_0x51a8('0x11')],_0xaac0bf[_0x51a8('0xf')][_0x51a8('0x12')]);this['active']=_0xaac0bf[_0x51a8('0x13')]||![];this['calleridnum']=_0xaac0bf[_0x51a8('0x10')];this[_0x51a8('0x14')]=_0xaac0bf[_0x51a8('0x14')];this[_0x51a8('0x15')]=_0xaac0bf[_0x51a8('0x15')]||0x0;this[_0x51a8('0x16')]=_0xaac0bf[_0x51a8('0x16')]||0x0;this['countnoanswerretry']=_0xaac0bf[_0x51a8('0x17')]||0x0;this[_0x51a8('0x18')]=(_0xaac0bf[_0x51a8('0x15')]||0x0)+(_0xaac0bf[_0x51a8('0x16')]||0x0)+(_0xaac0bf[_0x51a8('0x17')]||0x0)+(_0xaac0bf[_0x51a8('0x19')]||0x0)+(_0xaac0bf['countdropretry']||0x0)+(_0xaac0bf[_0x51a8('0x1a')]||0x0)+(_0xaac0bf[_0x51a8('0x1b')]||0x0)+(_0xaac0bf[_0x51a8('0x1c')]||0x0);this[_0x51a8('0x19')]=_0xaac0bf[_0x51a8('0x19')]||0x0;this[_0x51a8('0x1d')]=_0xaac0bf[_0x51a8('0x1d')]||0x0;this[_0x51a8('0x1a')]=_0xaac0bf['countabandonedretry']||0x0;this[_0x51a8('0x1b')]=_0xaac0bf['countmachineretry']||0x0;this[_0x51a8('0x1c')]=_0xaac0bf[_0x51a8('0x1c')]||0x0;this[_0x51a8('0x1e')]=_0xaac0bf[_0x51a8('0x1e')];this['callbackuniqueid']=_0xaac0bf[_0x51a8('0x1f')];this['callbackat']=_0xaac0bf['callbackat'];this[_0x51a8('0x20')]=_0xaac0bf['recallme'];this[_0x51a8('0x21')]=_0xaac0bf[_0x51a8('0x21')];this[_0x51a8('0x22')]=_0xaac0bf[_0x51a8('0x22')];this[_0x51a8('0x23')]=_[_0x51a8('0x1')](_0xaac0bf[_0x51a8('0x9')])?_0xaac0bf[_0x51a8('0x23')]:_0xaac0bf['Agent']['id'];this[_0x51a8('0x24')]=_0xaac0bf[_0x51a8('0x24')];this[_0x51a8('0x25')]='';this[_0x51a8('0x26')]='';}Action[_0x51a8('0x27')][_0x51a8('0x28')]=function(){return util[_0x51a8('0xc')](_0x51a8('0x29'),this[_0x51a8('0xe')],this[_0x51a8('0x2a')]);};module[_0x51a8('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8ef823e..1bda835 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 _0x7bae=['syncAttendedTransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','available','loggedIn','pTalking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','status','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','lookAgent','logLookAgent','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','syncHangupRequest','addVariable','variables','filterKey','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','bluebird','uuid','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','syncVarSet','attendedtransfer'];(function(_0x3f18ba,_0x34ee38){var _0x1212f1=function(_0x4e89ca){while(--_0x4e89ca){_0x3f18ba['push'](_0x3f18ba['shift']());}};_0x1212f1(++_0x34ee38);}(_0x7bae,0x13b));var _0xe7ba=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7bae[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe7ba('0x0'));var uuid=require(_0xe7ba('0x1'));var moment=require('moment');var md5=require(_0xe7ba('0x2'));var Redis=require('ioredis');var config=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var loggerAction=require(_0xe7ba('0x4'))(_0xe7ba('0x6'));var ami=require(_0xe7ba('0x7'));var rpcDb=require(_0xe7ba('0x8'));var cmHopperAdditionalPhone=require(_0xe7ba('0x9'));var Action=require(_0xe7ba('0xa'));var ut=require(_0xe7ba('0xb'));config[_0xe7ba('0xc')]=_[_0xe7ba('0xd')](config[_0xe7ba('0xc')],{'host':_0xe7ba('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7ba('0xc')]));var Sequence=function(){};Sequence[_0xe7ba('0xf')][_0xe7ba('0x10')]=function(_0x276bc3){this[_0xe7ba('0x11')]=this[_0xe7ba('0x11')]?this[_0xe7ba('0x11')][_0xe7ba('0x12')](_0x276bc3):_0x276bc3();};function Preview(_0x194447){this['sequence']=new Sequence();this[_0xe7ba('0x13')]=_0x194447['voiceQueues'];this[_0xe7ba('0x14')]=_0x194447[_0xe7ba('0x14')];this[_0xe7ba('0x15')]={};this[_0xe7ba('0x16')]=_0x194447[_0xe7ba('0x16')];this[_0xe7ba('0x17')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe7ba('0x18')](this));ami['on'](_0xe7ba('0x19'),this[_0xe7ba('0x1a')]['bind'](this));ami['on'](_0xe7ba('0x1b'),this['syncHangupRequest']['bind'](this));ami['on']('dialend',this[_0xe7ba('0x1c')]['bind'](this));ami['on'](_0xe7ba('0x1d'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xe7ba('0x1e')][_0xe7ba('0x18')](this));ami['on'](_0xe7ba('0x1f'),this[_0xe7ba('0x20')][_0xe7ba('0x18')](this));ami['on']('blindtransfer',this[_0xe7ba('0x21')][_0xe7ba('0x18')](this));this[_0xe7ba('0x22')](this[_0xe7ba('0x13')]);}function emit(_0x4aaf35,_0x1076c5,_0x2936b7){io['to'](_0x4aaf35)['emit'](_0x1076c5,_0x2936b7);}function emitCampaignPreview(_0x191863){if(_0x191863[_0xe7ba('0x23')]===_0xe7ba('0x24')){var _0x7ab9e4={'id':_0x191863['id'],'name':_0x191863[_0xe7ba('0x25')],'strategy':_0x191863[_0xe7ba('0x26')],'answered':_0x191863[_0xe7ba('0x27')],'available':_0x191863[_0xe7ba('0x28')],'loggedIn':_0x191863[_0xe7ba('0x29')],'pTalking':_0x191863[_0xe7ba('0x2a')],'sumBillable':_0x191863['sumBillable'],'sumDuration':_0x191863['sumDuration'],'sumHoldTime':_0x191863['sumHoldTime']||0x0,'talking':_0x191863['talking'],'total':_0x191863[_0xe7ba('0x2b')],'type':_0x191863['type'],'unmanaged':_0x191863['unmanaged'],'abandoned':_0x191863['abandoned'],'waiting':_0x191863[_0xe7ba('0x2c')],'loggedInDb':_0x191863[_0xe7ba('0x2d')],'dialActive':_0x191863[_0xe7ba('0x2e')],'dialMethod':_0x191863[_0xe7ba('0x2f')],'dialOriginateCallerIdName':_0x191863[_0xe7ba('0x30')],'dialOriginateCallerIdNumber':_0x191863[_0xe7ba('0x31')],'dialOriginateTimeout':_0x191863[_0xe7ba('0x32')],'dialPrefix':_0x191863[_0xe7ba('0x33')],'outboundAnswerAgiCallsDay':_0x191863['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x191863[_0xe7ba('0x34')],'outboundBlacklistCallsDay':_0x191863['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x191863[_0xe7ba('0x35')],'outboundCongestionCallsDay':_0x191863[_0xe7ba('0x36')],'outboundDropCallsDayACS':_0x191863[_0xe7ba('0x37')],'outboundDropCallsDayCallersExit':_0x191863['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x191863['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x191863[_0xe7ba('0x38')],'outboundNoSuchCallsDay':_0x191863[_0xe7ba('0x39')],'outboundOriginateFailureCallsDay':_0x191863[_0xe7ba('0x3a')],'outboundReCallsDay':_0x191863[_0xe7ba('0x3b')],'outboundRejectCallsDay':_0x191863[_0xe7ba('0x3c')],'outboundUnknownCallsDay':_0x191863['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x191863[_0xe7ba('0x3d')],'predictiveIntervalAnsweredCalls':_0x191863[_0xe7ba('0x3e')],'predictiveIntervalAvgHoldtime':_0x191863['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x191863[_0xe7ba('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x191863['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x191863['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x191863[_0xe7ba('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x191863[_0xe7ba('0x41')],'predictiveIntervalHitRate':_0x191863[_0xe7ba('0x42')],'predictiveIntervalMultiplicativeFactor':_0x191863['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x191863[_0xe7ba('0x43')],'predictiveIntervalAvailable':_0x191863['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x191863[_0xe7ba('0x44')],'message':_0x191863[_0xe7ba('0x45')],'originated':_0x191863[_0xe7ba('0x46')],'erlangCalls':_0x191863[_0xe7ba('0x47')],'erlangCallToSecond':_0x191863[_0xe7ba('0x48')],'erlangAbandonmentRate':_0x191863['erlangAbandonmentRate'],'erlangBusyFactor':_0x191863[_0xe7ba('0x49')],'startPredictive':_0x191863[_0xe7ba('0x4a')],'startProgressive':_0x191863['startProgressive']};if(_0x191863[_0xe7ba('0x4b')]){_0x7ab9e4[_0xe7ba('0x4b')]={'id':_0x191863[_0xe7ba('0x4b')]['id'],'name':_0x191863['Trunk'][_0xe7ba('0x25')],'active':_0x191863[_0xe7ba('0x4b')]['active'],'callerid':_0x191863[_0xe7ba('0x4b')][_0xe7ba('0x4c')]};}if(_0x191863[_0xe7ba('0x4d')]){_0x7ab9e4['Interval']={'id':_0x191863[_0xe7ba('0x4d')]['id'],'name':_0x191863[_0xe7ba('0x4d')]['name']};}var _0x330e98=md5(JSON[_0xe7ba('0x4e')](_0x7ab9e4));if(_0x191863[_0xe7ba('0x2')]!==_0x330e98){_0x191863['md5']=_0x330e98;emit(util['format'](_0xe7ba('0x4f'),_0x7ab9e4[_0xe7ba('0x25')]),_0xe7ba('0x50'),_0x7ab9e4);}}}function emitVoiceQueueChannelRemove(_0x9bd315){logger[_0xe7ba('0x51')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xe7ba('0x4e')](_0x9bd315));emit(util[_0xe7ba('0x52')](_0xe7ba('0x4f'),_0x9bd315[_0xe7ba('0x25')]),'voice_queue_channel:remove',_0x9bd315);io[_0xe7ba('0x53')](_0xe7ba('0x54'),_0x9bd315);}function notSendMessagesQueue(_0x46e31a){if(_0x46e31a[_0xe7ba('0x55')]){if(_0x46e31a[_0xe7ba('0x46')]===0x0&&_0x46e31a[_0xe7ba('0x2a')]===0x0){_0x46e31a[_0xe7ba('0x55')]=![];_0x46e31a['available']=0x0;_0x46e31a[_0xe7ba('0x56')]=0x0;_0x46e31a[_0xe7ba('0x45')]=_0xe7ba('0x57');ut[_0xe7ba('0x58')](_0xe7ba('0x59'),_0x46e31a[_0xe7ba('0x25')]+_0xe7ba('0x5a'));}else{_0x46e31a[_0xe7ba('0x45')]=_0xe7ba('0x5b');ut['logger'](_0xe7ba('0x59'),_0x46e31a[_0xe7ba('0x25')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x46e31a);}}Preview['prototype'][_0xe7ba('0x22')]=function(){var _0xf4bf4a=this;setInterval(function(){_0xf4bf4a[_0xe7ba('0x5c')]();},0x7cf);};Preview['prototype'][_0xe7ba('0x5c')]=function(){var _0x82246e=this[_0xe7ba('0x13')];this[_0xe7ba('0x17')]+=0x1;for(var _0xac3f51 in _0x82246e){if(_0x82246e['hasOwnProperty'](_0xac3f51)&&(_0x82246e[_0xac3f51][_0xe7ba('0x2f')]==='preview'||_0x82246e[_0xac3f51][_0xe7ba('0x2f')]===_0xe7ba('0x5d'))&&_0x82246e[_0xac3f51][_0xe7ba('0x23')]===_0xe7ba('0x24')){if(this[_0xe7ba('0x17')]>0x7){this[_0xe7ba('0x17')]=0x0;this[_0xe7ba('0x5e')]();}}if(_0x82246e[_0xe7ba('0x5f')](_0xac3f51)&&_0x82246e[_0xac3f51]['dialMethod']===_0xe7ba('0x5')&&_0x82246e[_0xac3f51][_0xe7ba('0x23')]===_0xe7ba('0x24')){if(_0x82246e[_0xac3f51][_0xe7ba('0x2e')]){this[_0xe7ba('0x60')](_0x82246e[_0xac3f51]);if(_0x82246e[_0xac3f51][_0xe7ba('0x61')])this[_0xe7ba('0x62')](_0x82246e[_0xac3f51]);}else{notSendMessagesQueue(_0x82246e[_0xac3f51]);}}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x63')]=function(_0x46c456){var _0x4bccc4=this;this[_0xe7ba('0x64')]['enqueue'](function(){if(!_[_0xe7ba('0x65')](_0x4bccc4[_0xe7ba('0x15')][_0x46c456])){loggerAction[_0xe7ba('0x51')](_0xe7ba('0x66'),_0x46c456,_0xe7ba('0x67'),_0x4bccc4[_0xe7ba('0x15')][_0x46c456]['queue'],_0xe7ba('0x68'),JSON[_0xe7ba('0x4e')](_0x4bccc4[_0xe7ba('0x13')][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]][_0xe7ba('0x46')]),_0xe7ba('0x6a'),JSON[_0xe7ba('0x4e')](_0x4bccc4[_0xe7ba('0x13')][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]]['pTalking']),JSON[_0xe7ba('0x4e')](_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x6b')]),JSON[_0xe7ba('0x4e')](_[_0xe7ba('0x6c')](_0x4bccc4[_0xe7ba('0x15')][_0x46c456],['contactId',_0xe7ba('0x6d'),_0xe7ba('0x6e'),'ListId'])));return ami[_0xe7ba('0x6f')]({'action':_0xe7ba('0x70'),'channel':_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x71')]})['catch'](function(_0x54e2ad){if(_0x54e2ad[_0xe7ba('0x45')]===_0xe7ba('0x72')){setTimeout(function(){if(_0x4bccc4[_0xe7ba('0x15')][_0x46c456]){ut['updateOriginated'](_0x4bccc4[_0xe7ba('0x13')][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]],_0xe7ba('0x73'));if(_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x6b')]===!![]){ut[_0xe7ba('0x74')](_0x4bccc4['campaignsPreview'][_0x4bccc4[_0xe7ba('0x15')][_0x46c456][_0xe7ba('0x69')]],_0xe7ba('0x73'));ut['loggerError'](_0xe7ba('0x75')+_0x46c456,_0x4bccc4[_0xe7ba('0x15')][_0x46c456]['queue']);}ut[_0xe7ba('0x76')](_0xe7ba('0x77')+_0x46c456,_0x4bccc4['actions'][_0x46c456][_0xe7ba('0x69')]);delete _0x4bccc4['actions'][_0x46c456];}},0x2328);}});}});};Preview[_0xe7ba('0xf')][_0xe7ba('0x5e')]=function(){var _0x30df6b=this;loggerAction['info'](_0xe7ba('0x78'),_[_0xe7ba('0x79')](this[_0xe7ba('0x15')]));for(var _0x2e76ec in this[_0xe7ba('0x15')]){if(_0x30df6b['actions'][_0xe7ba('0x5f')](_0x2e76ec)){_0x30df6b[_0xe7ba('0x63')](_0x2e76ec);}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x62')]=function(_0x435dee){var _0x50aecc=this;rpcDb[_0xe7ba('0x7a')](_0x435dee['id'],ut[_0xe7ba('0x7b')](this[_0xe7ba('0x16')]))[_0xe7ba('0x7c')](function(_0x57b23e){if(!_[_0xe7ba('0x65')](_0x57b23e)){for(var _0x28e3cf=0x0;_0x28e3cf<_0x57b23e[_0xe7ba('0x7d')];_0x28e3cf+=0x1){if(ut[_0xe7ba('0x7e')](_0x57b23e[_0x28e3cf][_0xe7ba('0x7f')])<_0x435dee[_0xe7ba('0x80')]*0x3c){if(_0x57b23e[_0x28e3cf]['Agent']&&!_0x57b23e[_0x28e3cf][_0xe7ba('0x81')][_0xe7ba('0x82')]){_0x50aecc[_0xe7ba('0x83')](_0x57b23e[_0x28e3cf]['id'])['then'](ut[_0xe7ba('0x84')](_0xe7ba('0x85')))[_0xe7ba('0x86')](ut[_0xe7ba('0x84')](_0xe7ba('0x85')));}else{rpcDb[_0xe7ba('0x87')](_0x57b23e[_0x28e3cf]['id']);}}else{var _0x3a7bfb=new Action(_0x57b23e[_0x28e3cf],_0x435dee);_0x3a7bfb[_0xe7ba('0x88')]=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));_0x435dee[_0xe7ba('0x3b')]+=0x1;ut[_0xe7ba('0x8a')](_0x3a7bfb,0x17,'RecallInQueue');if(_0x435dee[_0xe7ba('0x8b')]){rpcDb[_0xe7ba('0x8c')](ut[_0xe7ba('0x8d')](_0x57b23e[_0x28e3cf]));rpcDb['createCustomerHistory'](_0x3a7bfb,_0xe7ba('0x8e'));}else{ut['logCustomer'](_0x3a7bfb,0x16,_0xe7ba('0x8f'));rpcDb[_0xe7ba('0x90')](_0x3a7bfb,_0xe7ba('0x91'));rpcDb['createCustomerFinal'](_0x3a7bfb,'[HistoryRecallClose]');}}}}})[_0xe7ba('0x86')](ut[_0xe7ba('0x84')](_0xe7ba('0x92')));};Preview['prototype'][_0xe7ba('0x60')]=function(_0x6866ef){_0x6866ef[_0xe7ba('0x55')]=!![];if(ut[_0xe7ba('0x93')](_0x6866ef[_0xe7ba('0x29')])){_0x6866ef['message']=_0xe7ba('0x94');}else if(!ut[_0xe7ba('0x95')](_0x6866ef[_0xe7ba('0x2e')])){_0x6866ef['message']=_0xe7ba('0x57');}else if(!this[_0xe7ba('0x96')](_0x6866ef[_0xe7ba('0x4b')])){if(!this[_0xe7ba('0x96')](_0x6866ef[_0xe7ba('0x97')])){_0x6866ef[_0xe7ba('0x45')]=_0xe7ba('0x98');}else{_0x6866ef[_0xe7ba('0x45')]=_0xe7ba('0x99');}}else{_0x6866ef[_0xe7ba('0x45')]='ACTIVE';}emitCampaignPreview(_0x6866ef);};Preview[_0xe7ba('0xf')][_0xe7ba('0x9a')]=function(_0x344d29,_0xa6da9e,_0x4d8773){var _0x4c0d12=this;var _0x103eb8=this[_0xe7ba('0x15')][_0xa6da9e];var _0x10bd7c=this['campaignsPreview'][_0x103eb8['queue']];var _0x5561cc;var _0x15c4c9=![];var _0x42925d=0x2;var _0x4c64eb=0x3;if(_0x10bd7c){switch(_0x4d8773){case'1':_0x10bd7c[_0xe7ba('0x39')]+=0x1;_0x103eb8['countnosuchnumberretry']+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut['totalGlobal'](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x0,'NoSuchNumber');ami['emit'](_0xe7ba('0x9c'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0x9e')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0x9f'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'0',_0x10bd7c)['then'](function(_0x5a3591){_0x15c4c9=_0x5a3591[_0xe7ba('0xa1')]==0x1;_0x42925d=_0x10bd7c[_0xe7ba('0xa2')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xa9'));}else{if(_0x103eb8[_0xe7ba('0xaa')]>=_0x10bd7c[_0xe7ba('0xab')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xa9'));}else{rpcDb[_0xe7ba('0xac')](ut[_0xe7ba('0xad')](_0x103eb8,'countnosuchnumberretry',_0x10bd7c[_0xe7ba('0xa2')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}delete this[_0xe7ba('0x15')][_0x344d29[_0xe7ba('0xb0')]];}else{_0x103eb8[_0xe7ba('0xaa')]++;logger[_0xe7ba('0x51')](_0xe7ba('0xb1'),_0x103eb8[_0xe7ba('0xaa')]);logger[_0xe7ba('0x51')]('id',_0x103eb8[_0xe7ba('0xb2')]);_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countnosuchnumberretry':_0x103eb8[_0xe7ba('0xaa')]}})['then'](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case _0xe7ba('0xb5'):var _0x53187a=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));_0x103eb8[_0xe7ba('0xb6')]=_0x53187a;_0x103eb8[_0xe7ba('0xb7')]=_0x53187a;_0x103eb8['dialAnswer']=!![];_0x10bd7c[_0xe7ba('0x2a')]+=0x1;logger[_0xe7ba('0x51')](_0xe7ba('0xb8'),_0x103eb8[_0xe7ba('0xb9')],'\x20Queue',_0x10bd7c[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x10bd7c[_0xe7ba('0x2a')]);ami[_0xe7ba('0x53')](_0xe7ba('0xba'),ut['buildObj'](_0x103eb8,'connect',this['campaignsPreview'][_0x103eb8[_0xe7ba('0x69')]]));if(_0x10bd7c[_0xe7ba('0xbb')]){ami[_0xe7ba('0x53')](_0xe7ba('0xbc'),ut[_0xe7ba('0xbd')](_0x103eb8));}break;case'16':ami[_0xe7ba('0x53')]('custom:agentcomplete',ut[_0xe7ba('0x9d')](_0x103eb8,'complete',this[_0xe7ba('0x13')][_0x103eb8[_0xe7ba('0x69')]]));emitVoiceQueueChannelRemove(ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xbe')));_0x10bd7c[_0xe7ba('0x34')]+=0x1;_0x10bd7c[_0xe7ba('0x2b')]+=0x1;_0x10bd7c['answered']+=0x1;ut[_0xe7ba('0x74')](_0x10bd7c,_0xe7ba('0xbf'));_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x4,'Answer');rpcDb[_0xe7ba('0x90')](_0x103eb8,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xc0'));rpcDb[_0xe7ba('0xc1')](_0x103eb8);_0x10bd7c[_0xe7ba('0xc2')]+=_0x103eb8[_0xe7ba('0xc3')];_0x10bd7c[_0xe7ba('0xc4')]+=_0x103eb8[_0xe7ba('0xc3')];logger[_0xe7ba('0x51')](_0xe7ba('0xc5'),_0x103eb8[_0xe7ba('0xb9')],_0xe7ba('0xc6'),_0x10bd7c[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x10bd7c[_0xe7ba('0x2a')]);delete this[_0xe7ba('0x15')][_0x344d29[_0xe7ba('0xb0')]];break;case _0xe7ba('0xc7'):_0x10bd7c[_0xe7ba('0x35')]+=0x1;_0x103eb8[_0xe7ba('0xc8')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x5,_0xe7ba('0xc9'));_0x42925d=_0x10bd7c[_0xe7ba('0xca')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami['emit']('custom:agentbusy',ut['buildObj'](_0x103eb8,_0xe7ba('0xcb')));rpcDb[_0xe7ba('0x90')](_0x103eb8,'[callProgressDetectingCustomer][logBusy]');_0x4c0d12['verifyAdditionalPhones'](_0x103eb8,'5',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x271769){_0x15c4c9=_0x271769['additional']==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c['dialGlobalMaxRetry']){_0x5561cc=ut['cloneAction'](_0x103eb8,0xf,'Global');rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xcc'));}else{if(_0x103eb8[_0xe7ba('0xc8')]>=_0x10bd7c[_0xe7ba('0xcd')]){rpcDb['createCustomerFinal'](_0x103eb8,_0xe7ba('0xce'));}else{rpcDb[_0xe7ba('0xac')](ut['scheduledAt'](_0x103eb8,'countbusyretry',_0x10bd7c[_0xe7ba('0xca')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xc8')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countbusyretry':_0x103eb8[_0xe7ba('0xc8')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case _0xe7ba('0xcf'):_0x10bd7c[_0xe7ba('0x38')]+=0x1;_0x103eb8[_0xe7ba('0xd0')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x3,_0xe7ba('0xd1'));_0x42925d=_0x10bd7c[_0xe7ba('0xd2')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami[_0xe7ba('0x53')](_0xe7ba('0xd3'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xd4')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xd5'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'3',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x511a7a){_0x15c4c9=_0x511a7a['additional']==0x1;if(!_0x15c4c9){if(ut['totalGlobal'](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xd6'));}else{if(_0x103eb8['countnoanswerretry']>=_0x10bd7c['dialNoAnswerMaxRetry']){rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xe7ba('0xac')](ut[_0xe7ba('0xad')](_0x103eb8,_0xe7ba('0xd0'),_0x10bd7c[_0xe7ba('0xd2')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)['then'](function(){});});}});break;case'CONGESTION':_0x10bd7c[_0xe7ba('0x36')]+=0x1;_0x103eb8[_0xe7ba('0xd7')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut['logCustomer'](_0x103eb8,0x8,_0xe7ba('0xd8'));_0x42925d=_0x10bd7c[_0xe7ba('0xd9')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami[_0xe7ba('0x53')](_0xe7ba('0xda'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xdb')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xdc'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'8',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x195342){_0x15c4c9=_0x195342[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,'Global');rpcDb['createCustomerFinal'](_0x5561cc,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x103eb8[_0xe7ba('0xd7')]>=_0x10bd7c[_0xe7ba('0xdd')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0xe7ba('0xad')](_0x103eb8,_0xe7ba('0xd7'),_0x10bd7c[_0xe7ba('0xca')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd7')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countcongestionretry':_0x103eb8[_0xe7ba('0xd7')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case'CANCEL':_0x10bd7c[_0xe7ba('0x3c')]+=0x1;_0x103eb8['countagentrejectretry']+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x14,_0xe7ba('0xde'));_0x42925d=_0x10bd7c[_0xe7ba('0xdf')];_0x4c64eb=_0x10bd7c[_0xe7ba('0xa3')];ami[_0xe7ba('0x53')](_0xe7ba('0xe0'),ut[_0xe7ba('0x9d')](_0x103eb8,_0xe7ba('0xe1')));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xe2'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'20',_0x10bd7c)['then'](function(_0x17267b){_0x15c4c9=_0x17267b[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut['cloneAction'](_0x103eb8,0x14,_0xe7ba('0xde'));rpcDb['createCustomerFinal'](_0x5561cc,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x103eb8[_0xe7ba('0xe3')]>=_0x10bd7c[_0xe7ba('0xe4')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xe5'));}else{rpcDb[_0xe7ba('0xac')](ut[_0xe7ba('0xad')](_0x103eb8,_0xe7ba('0xe3'),_0x10bd7c[_0xe7ba('0xdf')]),_0x103eb8['unlockAgent'],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12['incrementPreviewCounters']({'id':_0x103eb8[_0xe7ba('0xb2')],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});break;case _0xe7ba('0xe6'):_0x10bd7c[_0xe7ba('0x3d')]+=0x1;_0x103eb8[_0xe7ba('0xe7')]+=0x1;_0x103eb8['countglobal']=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0xb,_0xe7ba('0xe8'));rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xe9'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'11',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x344ddd){_0x15c4c9=_0x344ddd[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xe9'));}else{if(_0x103eb8[_0xe7ba('0xea')]>=_0x10bd7c[_0xe7ba('0xeb')]){rpcDb[_0xe7ba('0xa8')](_0x103eb8,_0xe7ba('0xe9'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x103eb8,_0xe7ba('0xe7'),_0x10bd7c[_0xe7ba('0xec')]),_0x103eb8[_0xe7ba('0xae')],_0x103eb8[_0xe7ba('0xaf')]);}}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8['idContact'],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12['swapAdditionalPhones'](_0x103eb8,_0x42925d,_0x4c64eb)['then'](function(){});});}});break;case'18':_0x10bd7c['outboundUnknownCallsDay']+=0x1;_0x103eb8[_0xe7ba('0xed')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut['logCustomer'](_0x103eb8,0x12,_0x344d29[_0xe7ba('0xee')]||_0x344d29[_0xe7ba('0xef')]);ami[_0xe7ba('0x53')](_0xe7ba('0xf0'),ut['buildObj'](_0x103eb8,'amd'));rpcDb['createCustomerHistory'](_0x103eb8,'[callProgressDetectingCustomer][hangupInAMD]');_0x4c0d12['verifyAdditionalPhones'](_0x103eb8,'18',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x2d4926){_0x15c4c9=_0x2d4926[_0xe7ba('0xa1')]==0x1;if(!_0x15c4c9){if(ut['totalGlobal'](_0x103eb8)>=_0x10bd7c['dialGlobalMaxRetry']){_0x5561cc=ut['cloneAction'](_0x103eb8,0x12,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x103eb8,_0xe7ba('0xf1'));}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12[_0xe7ba('0xb3')]({'id':_0x103eb8[_0xe7ba('0xb2')],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});delete this['actions'][_0x344d29[_0xe7ba('0xb0')]];break;case'19':_0x10bd7c[_0xe7ba('0xf2')]+=0x1;_0x103eb8['countglobal']=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0x13,_0x344d29[_0xe7ba('0xee')]||_0x344d29[_0xe7ba('0xef')]);ami[_0xe7ba('0x53')]('custom:amd',ut['buildObj'](_0x103eb8,_0xe7ba('0xf3')));rpcDb['createCustomerHistory'](_0x103eb8,_0xe7ba('0xf4'));_0x4c0d12['verifyAdditionalPhones'](_0x103eb8,'18',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x24ce3b){_0x15c4c9=_0x24ce3b['additional']==0x1;if(!_0x15c4c9){if(ut[_0xe7ba('0xa4')](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,_0xe7ba('0xa7'));rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xf4'));}else{rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][machine]');}}else{_0x103eb8[_0xe7ba('0xd0')]++;_0x4c0d12['incrementPreviewCounters']({'id':_0x103eb8[_0xe7ba('0xb2')],'field':{'countnoanswerretry':_0x103eb8[_0xe7ba('0xd0')]}})[_0xe7ba('0x7c')](function(){_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(){});});}});delete this[_0xe7ba('0x15')][_0x344d29['linkedid']];break;default:if(_0x103eb8[_0xe7ba('0x6b')]){ut[_0xe7ba('0x74')](_0x10bd7c,'[default]');ut[_0xe7ba('0x76')](_0xe7ba('0xf5')+_0x10bd7c['name'],_0x344d29);}_0x10bd7c[_0xe7ba('0xf2')]+=0x1;_0x103eb8[_0xe7ba('0x9b')]=ut[_0xe7ba('0xa4')](_0x103eb8);ut[_0xe7ba('0x8a')](_0x103eb8,0xc,_0x344d29[_0xe7ba('0xee')]||_0x344d29[_0xe7ba('0xef')]);_0x42925d=_0x10bd7c[_0xe7ba('0xdf')];_0x4c64eb=_0x10bd7c['callAdditionalPhoneAfterMin'];rpcDb[_0xe7ba('0x90')](_0x103eb8,_0xe7ba('0xf6'));_0x4c0d12[_0xe7ba('0xa0')](_0x103eb8,'20',_0x10bd7c)[_0xe7ba('0x7c')](function(_0x20ef6b){_0x15c4c9=_0x20ef6b['additional']==0x1;if(!_0x15c4c9){if(ut['totalGlobal'](_0x103eb8)>=_0x10bd7c[_0xe7ba('0xa5')]){_0x5561cc=ut[_0xe7ba('0xa6')](_0x103eb8,0xf,'Global');rpcDb[_0xe7ba('0xa8')](_0x5561cc,_0xe7ba('0xf7'));}else{rpcDb[_0xe7ba('0xa8')](_0x103eb8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x344d29[_0xe7ba('0xb0')]];}else{_0x4c0d12[_0xe7ba('0xb4')](_0x103eb8,_0x42925d,_0x4c64eb)[_0xe7ba('0x7c')](function(_0x12ff21){});}});}if(!(_0x103eb8[_0xe7ba('0x6b')]&&_0x4d8773==='16')){ut[_0xe7ba('0xf8')](_0x10bd7c,_0xe7ba('0xf9'));logger[_0xe7ba('0x51')](_0xe7ba('0xfa'),_0x103eb8[_0xe7ba('0xb9')],_0xe7ba('0xc6'),_0x10bd7c[_0xe7ba('0x25')],_0xe7ba('0x68'),_0x10bd7c['originated']);}if(_0x4d8773!==_0xe7ba('0xb5')){delete this[_0xe7ba('0x15')][_0x344d29[_0xe7ba('0xb0')]];delete this['actions'][_0x344d29['destlinkedid']];}}};Preview[_0xe7ba('0xf')][_0xe7ba('0xfb')]=function(_0xe364a6,_0x481d16,_0xd1f6a9){if(_[_0xe7ba('0xfc')](_0x481d16)&&'object'!==typeof _0x481d16){return;}if(_[_0xe7ba('0xfc')](_0xd1f6a9)&&_0xe7ba('0xfd')!==typeof _0xd1f6a9){return;}switch(_0xd1f6a9[_0xe7ba('0xfe')]){case'0':ut[_0xe7ba('0xff')](_0xe364a6,0x0,_0xe7ba('0x100'));rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x102'));break;case'3':ut[_0xe7ba('0xff')](_0xe364a6,0x3,_0xe7ba('0xd1'));rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x103'));break;case'5':ut[_0xe7ba('0xff')](_0xe364a6,0x5,'Busy');rpcDb['createAgentHistory'](_0xe364a6,_0xe7ba('0x104'));break;case'8':ut['logAgent'](_0xe364a6,0x8,'Congestion');rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x105'));break;case'22':ut[_0xe7ba('0xff')](_0xe364a6,0x16,'AnswerAGI');rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x106'));break;default:ut[_0xe7ba('0xff')](_0xe364a6,0xc,_0xd1f6a9[_0xe7ba('0xfe')]);rpcDb[_0xe7ba('0x101')](_0xe364a6,_0xe7ba('0x105'));}ut['updateOriginated'](_0x481d16,_0xe7ba('0x107'));logger[_0xe7ba('0x51')](_0xe7ba('0x108'),_0xe364a6[_0xe7ba('0xb9')],_0xe7ba('0xc6'),_0x481d16[_0xe7ba('0x25')],_0xe7ba('0x68'),_0x481d16[_0xe7ba('0x46')]);delete this[_0xe7ba('0x15')][_0xe364a6[_0xe7ba('0xb9')]];};Preview[_0xe7ba('0xf')][_0xe7ba('0xa0')]=function(_0x1f8440,_0x3e574c,_0x4d094d){return BPromise[_0xe7ba('0x109')]()[_0xe7ba('0x7c')](cmHopperAdditionalPhone[_0xe7ba('0xa0')](_0x1f8440,_0x3e574c,_0x4d094d))[_0xe7ba('0x86')](logger[_0xe7ba('0x51')]('[verifyAdditionalPhone]\x20'));};Preview[_0xe7ba('0xf')][_0xe7ba('0xb4')]=function(_0x46a66e,_0x3d186e,_0x24ad68){return BPromise[_0xe7ba('0x109')]()[_0xe7ba('0x7c')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46a66e,_0x3d186e,_0x24ad68))[_0xe7ba('0x86')](logger['info'](_0xe7ba('0x10a')));};Preview[_0xe7ba('0xf')][_0xe7ba('0xb3')]=function(_0x5e8020){return BPromise[_0xe7ba('0x109')]()[_0xe7ba('0x7c')](cmHopperAdditionalPhone[_0xe7ba('0xb3')](_0x5e8020))[_0xe7ba('0x86')](logger[_0xe7ba('0x51')](_0xe7ba('0x10b')));};Preview[_0xe7ba('0xf')][_0xe7ba('0x10c')]=function(_0x4a9f46,_0x185a05,_0xcf12d8,_0x2d6d14,_0x3b9fdd){var _0x1e6665=this;return new BPromise(function(_0x209e82,_0x48043b){if(_[_0xe7ba('0x65')](_0x185a05)||_[_0xe7ba('0x65')](_0x185a05[_0xe7ba('0x10d')])||_['isNil'](_0x185a05[_0xe7ba('0x10e')])||_[_0xe7ba('0x65')](_0x185a05[_0xe7ba('0x6e')])){_0x48043b(ut[_0xe7ba('0x45')](_0xe7ba('0x10f'),_0x2d6d14,_0x3b9fdd));return;}var _0x3f1ef6=uuid['v4']();var _0x397b66=_0x1e6665['campaignsPreview'][_0x185a05[_0xe7ba('0x67')][_0xe7ba('0x25')]];var _0x3304e4=_0xcf12d8?_0x1e6665[_0xe7ba('0x16')][_0xcf12d8]['id']:undefined;_0x1e6665[_0xe7ba('0x15')][_0x3f1ef6]=new Action(_0x185a05,_0x397b66,_0x3f1ef6,_0xcf12d8,_0x3304e4);var _0x539f0e=_0x1e6665[_0xe7ba('0x15')][_0x3f1ef6];_0x539f0e[_0xe7ba('0xae')]=_0x2d6d14;_0x539f0e[_0xe7ba('0xaf')]=_0x3b9fdd;_0x539f0e['lookAgent']=_0xcf12d8;if(_['isEmpty'](_0x4a9f46)){_0x1e6665[_0xe7ba('0x110')](_0x539f0e,_0x397b66,_0x185a05,_0xcf12d8)['then'](function(_0x4baf24){logger[_0xe7ba('0x51')](_0xe7ba('0x111'),_0xe7ba('0x112')+_0x539f0e[_0xe7ba('0x69')]+_0xe7ba('0x113')+_0x539f0e[_0xe7ba('0xb2')],JSON[_0xe7ba('0x4e')](_0x4baf24));ami[_0xe7ba('0x53')](_0xe7ba('0x114'),ut[_0xe7ba('0x9d')](_0x539f0e,_0xe7ba('0x115'),_0x1e6665[_0xe7ba('0x13')][_0x539f0e[_0xe7ba('0x69')]]));_0x209e82(ut[_0xe7ba('0x45')](_0xe7ba('0x116')));})[_0xe7ba('0x86')](function(_0x598ccb){ut[_0xe7ba('0x58')](_0xe7ba('0x117'),_0x598ccb);_0x48043b(ut[_0xe7ba('0x45')]('Call\x20failed',_0x2d6d14,_0x3b9fdd));});}else{_0x397b66[_0xe7ba('0x118')]+=0x1;ut[_0xe7ba('0x119')](_0x539f0e);rpcDb[_0xe7ba('0x11a')](_0x539f0e,_0xe7ba('0x11b'));delete _0x1e6665[_0xe7ba('0x15')][_0x3f1ef6];_0x48043b(ut[_0xe7ba('0x45')](_0xe7ba('0x11c'),_0x2d6d14,_0x3b9fdd));}});};Preview['prototype'][_0xe7ba('0x96')]=function(_0xc8d663){return!_['isNil'](_0xc8d663)&&!_[_0xe7ba('0x65')](_0xc8d663[_0xe7ba('0x25')])&&!_[_0xe7ba('0x65')](_0xc8d663[_0xe7ba('0x11d')])&&_0xc8d663['active']&&!_['isNil'](this[_0xe7ba('0x14')][util[_0xe7ba('0x52')](_0xe7ba('0x11e'),_0xc8d663['name'])])&&!_[_0xe7ba('0x65')](this[_0xe7ba('0x14')][util[_0xe7ba('0x52')]('SIP/%s',_0xc8d663[_0xe7ba('0x25')])][_0xe7ba('0x70')])&&(this[_0xe7ba('0x14')][util[_0xe7ba('0x52')](_0xe7ba('0x11e'),_0xc8d663[_0xe7ba('0x25')])]['status']===_0xe7ba('0x11f')||this['trunks'][util[_0xe7ba('0x52')]('SIP/%s',_0xc8d663['name'])][_0xe7ba('0x70')]===_0xe7ba('0x120'));};Preview[_0xe7ba('0xf')]['run']=function(_0x590302,_0x43e7ae){var _0x58d6b6=this;return new BPromise(function(_0x46e23b,_0x4326e7){_0x58d6b6[_0xe7ba('0x121')](_0x590302,_0x43e7ae)['then'](function(_0x460955){_0x46e23b(_['pick'](_0x460955,[_0xe7ba('0x45')]));})[_0xe7ba('0x86')](function(_0x3d0629){if(_0x3d0629[_0xe7ba('0x122')]){rpcDb[_0xe7ba('0x123')](_0x590302);}if(_0x3d0629[_0xe7ba('0x11d')]){rpcDb[_0xe7ba('0x87')](_0x590302);}_0x4326e7(_[_0xe7ba('0x6c')](_0x3d0629,[_0xe7ba('0x45')]));});});};Preview[_0xe7ba('0xf')]['execRun']=function(_0x271c92,_0x57369d){var _0xfd8ca5=this;return new BPromise(function(_0x36a876,_0xb69f38){var _0x3e0c94,_0x56a3b1;rpcDb[_0xe7ba('0x124')](_0x271c92)['then'](function(_0x1dce67){if(!_[_0xe7ba('0x65')](_0x1dce67[0x0])){_0x56a3b1=_0x1dce67[0x0]['recallme']?![]:!![];_0x3e0c94=_0x1dce67[0x0][_0xe7ba('0x125')]?!![]:![];_0x3e0c94=_0x57369d?!![]:_0x3e0c94;}var _0x32997a=_0xfd8ca5['validateContact'](_0x1dce67);if(_0x32997a[_0xe7ba('0x126')]){rpcDb[_0xe7ba('0x127')](_[_0xe7ba('0x6c')](_0x1dce67[0x0],[_0xe7ba('0x6e'),_0xe7ba('0x10e')]))['then'](function(_0x1dd95a){_0xfd8ca5['checkInBlack'](_0x1dd95a,_0x1dce67[0x0],_0x57369d,_0x56a3b1,_0x3e0c94)[_0xe7ba('0x7c')](function(_0x28877c){_0x36a876(_0x28877c);})[_0xe7ba('0x86')](function(_0x444304){_0xb69f38(_0x444304);});})[_0xe7ba('0x86')](function(_0x501ba7){ut['logger']('[Preview][checkIsBlackList]',_0x501ba7);_0xb69f38(ut['message'](_0xe7ba('0x128'),_0x56a3b1,_0x3e0c94));});}else{_0xb69f38(ut[_0xe7ba('0x45')](_0x32997a[_0xe7ba('0x45')],_0x56a3b1,_0x3e0c94));}})[_0xe7ba('0x86')](function(_0x4d615b){ut[_0xe7ba('0x58')](_0xe7ba('0x129'),_0x4d615b);_0xb69f38(ut[_0xe7ba('0x45')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xe7ba('0xf')]['validateContact']=function(_0x5ce535){if(_[_0xe7ba('0x65')](_0x5ce535)||_[_0xe7ba('0x12a')](_0x5ce535)||!_[_0xe7ba('0x65')](_0x5ce535[0x0][_0xe7ba('0x81')])&&_[_0xe7ba('0x65')](_0x5ce535[0x0][_0xe7ba('0x81')][_0xe7ba('0x25')])){ut[_0xe7ba('0x58')]('[Preview][validateContact][Empty\x20Contact]',_0x5ce535);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2b09bc=this[_0xe7ba('0x13')][_0x5ce535[0x0][_0xe7ba('0x67')]['name']];_0x2b09bc[_0xe7ba('0x45')]=_0xe7ba('0x99');if(_['isNil'](_0x2b09bc)){ut[_0xe7ba('0x58')]('[Preview][validateContact][Empty\x20Campaign]',_0x2b09bc);return{'isValid':![],'message':_0xe7ba('0x12b')};}if(!this[_0xe7ba('0x96')](_0x2b09bc[_0xe7ba('0x4b')])){ut['logger'](_0xe7ba('0x12c'),_0xe7ba('0x12d')+_0x2b09bc[_0xe7ba('0x25')]+_0xe7ba('0x12e'));if(!this[_0xe7ba('0x96')](_0x2b09bc[_0xe7ba('0x97')])){ut[_0xe7ba('0x58')](_0xe7ba('0x12c'),_0x2b09bc[_0xe7ba('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe7ba('0x12f')};}}if(!ut[_0xe7ba('0x95')](_0x2b09bc[_0xe7ba('0x2e')])){ut[_0xe7ba('0x58')](_0xe7ba('0x130'),_0x2b09bc[_0xe7ba('0x25')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe7ba('0x12d')+_0x2b09bc['name']+_0xe7ba('0x131')};}return{'isValid':!![],'message':_0xe7ba('0x132')};};Preview[_0xe7ba('0xf')][_0xe7ba('0x110')]=function(_0x5e4cf7,_0x254649,_0x5aadc3,_0x57c753){var _0x5a5071=this;return new BPromise(function(_0x5bc97c,_0xa8e027){var _0x5dd240=_0x5e4cf7[_0xe7ba('0xb9')];var _0x562a78=_0x5a5071[_0xe7ba('0x96')](_0x254649[_0xe7ba('0x4b')])?util[_0xe7ba('0x52')](_0xe7ba('0x133'),_0x254649[_0xe7ba('0x4b')][_0xe7ba('0x25')],_['isNil'](_0x254649[_0xe7ba('0x33')])?'':_0x254649[_0xe7ba('0x33')][_0xe7ba('0x134')]()||'',_0x254649[_0xe7ba('0x135')]>0x0?_0x5aadc3[_0xe7ba('0x10e')][_0xe7ba('0x136')](_0x254649[_0xe7ba('0x135')]):_0x5aadc3[_0xe7ba('0x10e')]):util[_0xe7ba('0x52')](_0xe7ba('0x133'),_['isNil'](_0x254649[_0xe7ba('0x97')])?_0x254649['Trunk'][_0xe7ba('0x25')]:_0x254649[_0xe7ba('0x97')]['name'],_[_0xe7ba('0x65')](_0x254649[_0xe7ba('0x33')])?'':_0x254649[_0xe7ba('0x33')][_0xe7ba('0x134')]()||'',_0x254649[_0xe7ba('0x135')]>0x0?_0x5aadc3['phone'][_0xe7ba('0x136')](_0x254649[_0xe7ba('0x135')]):_0x5aadc3[_0xe7ba('0x10e')]);var _0x1d31d3=_0x5a5071[_0xe7ba('0x96')](_0x254649[_0xe7ba('0x4b')])?ut[_0xe7ba('0x137')](_0x254649[_0xe7ba('0x4b')][_0xe7ba('0x4c')],_0x254649[_0xe7ba('0x30')],_0x254649['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x254649['dialOriginateCallerIdNumber'],_0x254649['dialRandomLastDigitCallerIdNumber']):_0x254649[_0xe7ba('0x31')]):ut['getCallerId'](_['isNil'](_0x254649[_0xe7ba('0x97')])?_0x254649['Trunk']['callerid']:_0x254649[_0xe7ba('0x97')]['callerid'],_0x254649[_0xe7ba('0x30')],_0x254649['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe7ba('0x138')](_0x254649['dialOriginateCallerIdNumber'],_0x254649[_0xe7ba('0x139')]):_0x254649[_0xe7ba('0x31')]);if(_0x1d31d3){_0x5e4cf7[_0xe7ba('0x13a')]=ut['extractCalleridName'](_0x1d31d3);_0x5e4cf7[_0xe7ba('0x13b')]=ut[_0xe7ba('0x13c')](_0x1d31d3);}var _0x3ac7fa=ut['addVariables'](_0x254649,_0x5aadc3,_0x562a78,_0x1d31d3,_0x5dd240,_0x5e4cf7);_[_0xe7ba('0x13d')](_0x5e4cf7,ut[_0xe7ba('0x13e')](_0x3ac7fa));_0x5e4cf7['starttime']=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));ami[_0xe7ba('0x6f')](ut['variablesAction'](_0x5e4cf7,_0x254649,_0x3ac7fa,_0x5e4cf7['activeContact'],_0x57c753))[_0xe7ba('0x7c')](function(_0x1865f7){_0x254649[_0xe7ba('0x46')]+=0x1;logger[_0xe7ba('0x51')](_0xe7ba('0x13f'),_0x5dd240,_0xe7ba('0xc6'),_0x254649[_0xe7ba('0x25')],_0xe7ba('0x68'),_0x254649[_0xe7ba('0x46')]);_0x5bc97c(_0x1865f7);})[_0xe7ba('0x86')](function(_0x343aad){ut[_0xe7ba('0xff')](_0x5e4cf7,0xe,'OriginateError');rpcDb[_0xe7ba('0x101')](_0x5e4cf7,_0xe7ba('0x140'));_0xa8e027(_0x343aad);});});};Preview[_0xe7ba('0xf')][_0xe7ba('0x141')]=function(_0xf14f0c){if(this[_0xe7ba('0x15')][_0xf14f0c[_0xe7ba('0xb0')]]){this[_0xe7ba('0x15')][_0xf14f0c['linkedid']][_0xe7ba('0x71')]=_0xf14f0c[_0xe7ba('0x71')];}};Preview[_0xe7ba('0xf')][_0xe7ba('0x142')]=function(_0xb7948d){var _0x34f6b1=this;var _0x34518a=this[_0xe7ba('0x15')][_0xb7948d['actionid']];if(_0x34518a){if(_0x34518a[_0xe7ba('0x143')]&&this[_0xe7ba('0x16')][_0x34518a[_0xe7ba('0x143')]]){ut[_0xe7ba('0x144')](_0x34518a,this['agents'][_0x34518a[_0xe7ba('0x143')]][_0xe7ba('0x25')],this[_0xe7ba('0x16')][_0x34518a[_0xe7ba('0x143')]]['id']);}var _0x5043e6=_['clone'](_0x34518a);_0x5043e6[_0xe7ba('0xb6')]=moment()[_0xe7ba('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x9471fb=_0x34f6b1[_0xe7ba('0x13')][_0x34518a[_0xe7ba('0x69')]];if(ut[_0xe7ba('0x145')](_0xb7948d[_0xe7ba('0x146')])){if(_0x34518a[_0xe7ba('0xae')]){rpcDb['unlockContact'](_0x34518a[_0xe7ba('0xb2')]);}if(_0x34518a[_0xe7ba('0xaf')]){rpcDb[_0xe7ba('0x87')](_0x34518a['idContact']);}ami[_0xe7ba('0x53')]('custom:agentringnoanswer',ut[_0xe7ba('0x9d')](_0x34518a,_0xe7ba('0x147'),this[_0xe7ba('0x13')][_0x34518a[_0xe7ba('0x69')]]));this[_0xe7ba('0xfb')](_0x5043e6,_0x9471fb,_0xb7948d);}else{_0x34518a[_0xe7ba('0x88')]=moment()[_0xe7ba('0x52')](_0xe7ba('0x89'));ut['logAgent'](_0x5043e6,0x4,_0xe7ba('0x148'));rpcDb[_0xe7ba('0x101')](_0x5043e6,_0xe7ba('0x149'));}}};Preview['prototype'][_0xe7ba('0x1a')]=function(_0x2416ea){var _0x1da56f=this;var _0x35ff64=this['actions'][_0x2416ea['linkedid']];var _0x14ade1;if(_0x35ff64){_0x14ade1=this['campaignsPreview'][_0x35ff64['queue']];logger[_0xe7ba('0x51')]('[syncHangup][talking]',_0x2416ea[_0xe7ba('0xb0')],'\x20Queue',_0x14ade1[_0xe7ba('0x25')],'pTalking:\x20',_0x14ade1[_0xe7ba('0x2a')]);}if(this[_0xe7ba('0x15')][_0x2416ea['linkedid']]&&_0x2416ea['linkedid']!==_0x2416ea[_0xe7ba('0xb9')]){if(_0x2416ea[_0xe7ba('0x14a')]==='16'&&this['actions'][_0x2416ea[_0xe7ba('0xb0')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x2416ea,_0x2416ea['linkedid'],_0x2416ea['cause']);}else if(this[_0xe7ba('0x15')][_0x2416ea[_0xe7ba('0xb0')]][_0xe7ba('0x6b')]){logger[_0xe7ba('0x51')](_0xe7ba('0x14b'),_0x2416ea[_0xe7ba('0xb0')],_0x2416ea['cause'],'\x20Queue',_0x14ade1['name'],_0xe7ba('0x6a'),_0x14ade1[_0xe7ba('0x2a')]);this['callProgressDetectingCustomer'](_0x2416ea,_0x2416ea[_0xe7ba('0xb0')],_0x2416ea[_0xe7ba('0x14a')]);}}else if(_0x35ff64&&_[_0xe7ba('0x65')](_0x35ff64[_0xe7ba('0x14c')])&&_0x14ade1[_0xe7ba('0x14d')]&&_0x2416ea[_0xe7ba('0xb0')]===_0x2416ea[_0xe7ba('0xb9')]&&_[_0xe7ba('0x65')](_0x2416ea[_0xe7ba('0xfe')])&&_0x2416ea[_0xe7ba('0x14a')]==='16'&&_0x2416ea[_0xe7ba('0x14e')]==='6'&&_[_0xe7ba('0xfc')](_0x35ff64[_0xe7ba('0x14f')])){if(_0x35ff64['unlockAgent']){rpcDb[_0xe7ba('0x123')](_0x35ff64['idContact']);}if(_0x35ff64['activeContact']){rpcDb['disableContact'](_0x35ff64[_0xe7ba('0xb2')]);}_0x2416ea['reason']='22';this[_0xe7ba('0xfb')](_0x35ff64,_0x14ade1,_0x2416ea);}else if(_0x35ff64&&_0x35ff64[_0xe7ba('0x14f')]){if(_0x2416ea[_0xe7ba('0x14a')]==='16'&&this['actions'][_0x2416ea[_0xe7ba('0xb0')]]['dialAnswer']){logger[_0xe7ba('0x51')](_0xe7ba('0x150'),_0x2416ea[_0xe7ba('0xb0')],_0x2416ea[_0xe7ba('0x14a')],'\x20Queue',_0x14ade1[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x14ade1[_0xe7ba('0x2a')]);this[_0xe7ba('0x9a')](_0x2416ea,_0x2416ea['linkedid'],_0x2416ea[_0xe7ba('0x14a')]);}else if(this[_0xe7ba('0x15')][_0x2416ea['linkedid']][_0xe7ba('0x6b')]){logger[_0xe7ba('0x51')](_0xe7ba('0x14b'),_0x2416ea[_0xe7ba('0xb0')],_0x2416ea[_0xe7ba('0x14a')],_0xe7ba('0xc6'),_0x14ade1[_0xe7ba('0x25')],_0xe7ba('0x6a'),_0x14ade1['pTalking']);this[_0xe7ba('0x9a')](_0x2416ea,_0x2416ea['linkedid'],_0x2416ea[_0xe7ba('0x14a')]);}}};Preview['prototype'][_0xe7ba('0x1c')]=function(_0x61f9fa){if(this[_0xe7ba('0x15')][_0x61f9fa[_0xe7ba('0x151')]]&&_0x61f9fa[_0xe7ba('0x151')]!==_0x61f9fa['destuniqueid']){this[_0xe7ba('0x9a')](_0x61f9fa,_0x61f9fa['destlinkedid'],_0x61f9fa[_0xe7ba('0xef')]);}};Preview[_0xe7ba('0xf')][_0xe7ba('0x152')]=function(_0x5deee3){if(this['actions'][_0x5deee3['linkedid']]&&_0x5deee3['linkedid']!==_0x5deee3[_0xe7ba('0xb9')]&&!this['actions'][_0x5deee3[_0xe7ba('0xb0')]]['dialAnswer']){if(_0x5deee3[_0xe7ba('0x14a')]==='1'){this[_0xe7ba('0x9a')](_0x5deee3,_0x5deee3[_0xe7ba('0xb0')],_0x5deee3[_0xe7ba('0x14a')]);}}};Preview['prototype'][_0xe7ba('0x153')]=function(_0x1d0404,_0x51559d,_0x50a28a){if(this['actions'][_0x1d0404]){if(_[_0xe7ba('0x65')](this[_0xe7ba('0x15')][_0x1d0404][_0xe7ba('0x154')])){this[_0xe7ba('0x15')][_0x1d0404]['variables']={};}this[_0xe7ba('0x15')][_0x1d0404][_0xe7ba('0x154')][_0x51559d]=_0x50a28a;}};Preview['prototype'][_0xe7ba('0x1e')]=function(_0x169bac){try{if(!_[_0xe7ba('0x65')](_0x169bac)){if(ut[_0xe7ba('0x155')](_['keys'](_0x169bac['variable'])[0x0])){this['addVariable'](_0x169bac[_0xe7ba('0xb9')],_['keys'](_0x169bac['variable'])[0x0],_0x169bac['value']);}}}catch(_0x2bc08e){logger[_0xe7ba('0x156')]('[syncVarSet][Preview]',util[_0xe7ba('0x157')](_0x2bc08e,{'showHidden':![],'depth':null}));}};Preview[_0xe7ba('0xf')][_0xe7ba('0x20')]=function(_0x3302a8){if(_0x3302a8){if(this[_0xe7ba('0x15')][_0x3302a8[_0xe7ba('0x158')]]){this[_0xe7ba('0x15')][_0x3302a8['transfertargetlinkedid']][_0xe7ba('0x14f')]=!![];}}};Preview['prototype'][_0xe7ba('0x21')]=function(_0x46765d){if(_0x46765d){if(this[_0xe7ba('0x15')][_0x46765d[_0xe7ba('0x159')]]){this[_0xe7ba('0x15')][_0x46765d['transfererlinkedid']][_0xe7ba('0x14f')]=!![];}}};module[_0xe7ba('0x15a')]=Preview; \ No newline at end of file +var _0xa41a=['[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','isTrunkReachable','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','SIP/%s/%s%s','dialCutDigit','substring','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','addVariable','variables','filterKey','variable','keys','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','type','outbound','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','sendMessageOneNotActive','IsNotLoggedIn','isActive','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','buildAcw','custom:agentcomplete','complete','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','dialBusyMaxRetry','activeContact','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0xa41a,0x6b));var _0xaa41=function(_0x42b6f8,_0xa51e18){_0x42b6f8=_0x42b6f8-0x0;var _0x29673f=_0xa41a[_0x42b6f8];return _0x29673f;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var BPromise=require('bluebird');var uuid=require(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var md5=require(_0xaa41('0x4'));var Redis=require(_0xaa41('0x5'));var config=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var loggerAction=require(_0xaa41('0x7'))('actionPreview');var ami=require(_0xaa41('0x9'));var rpcDb=require(_0xaa41('0xa'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xaa41('0xb'));config[_0xaa41('0xc')]=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var io=require(_0xaa41('0xe'))(new Redis(config[_0xaa41('0xc')]));var Sequence=function(){};Sequence[_0xaa41('0xf')][_0xaa41('0x10')]=function(_0x806f08){this[_0xaa41('0x11')]=this[_0xaa41('0x11')]?this['tail'][_0xaa41('0x12')](_0x806f08):_0x806f08();};function Preview(_0x10cda9){this['sequence']=new Sequence();this['campaignsPreview']=_0x10cda9[_0xaa41('0x13')];this['trunks']=_0x10cda9[_0xaa41('0x14')];this[_0xaa41('0x15')]={};this[_0xaa41('0x16')]=_0x10cda9[_0xaa41('0x16')];this[_0xaa41('0x17')]=0x0;ami['on']('originateresponse',this[_0xaa41('0x18')][_0xaa41('0x19')](this));ami['on'](_0xaa41('0x1a'),this[_0xaa41('0x1b')][_0xaa41('0x19')](this));ami['on'](_0xaa41('0x1c'),this[_0xaa41('0x1d')]['bind'](this));ami['on'](_0xaa41('0x1e'),this[_0xaa41('0x1f')][_0xaa41('0x19')](this));ami['on'](_0xaa41('0x20'),this[_0xaa41('0x21')][_0xaa41('0x19')](this));ami['on'](_0xaa41('0x22'),this[_0xaa41('0x23')][_0xaa41('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xaa41('0x19')](this));ami['on'](_0xaa41('0x24'),this[_0xaa41('0x25')]['bind'](this));this[_0xaa41('0x26')](this[_0xaa41('0x27')]);}function emit(_0x4e768e,_0x513c61,_0x1b1910){io['to'](_0x4e768e)['emit'](_0x513c61,_0x1b1910);}function emitCampaignPreview(_0xafd672){if(_0xafd672[_0xaa41('0x28')]===_0xaa41('0x29')){var _0x1f27f3={'id':_0xafd672['id'],'name':_0xafd672[_0xaa41('0x2a')],'strategy':_0xafd672['strategy'],'answered':_0xafd672[_0xaa41('0x2b')],'available':_0xafd672[_0xaa41('0x2c')],'loggedIn':_0xafd672[_0xaa41('0x2d')],'pTalking':_0xafd672[_0xaa41('0x2e')],'sumBillable':_0xafd672[_0xaa41('0x2f')],'sumDuration':_0xafd672[_0xaa41('0x30')],'sumHoldTime':_0xafd672['sumHoldTime']||0x0,'talking':_0xafd672['talking'],'total':_0xafd672[_0xaa41('0x31')],'type':_0xafd672['type'],'unmanaged':_0xafd672['unmanaged'],'abandoned':_0xafd672[_0xaa41('0x32')],'waiting':_0xafd672['waiting'],'loggedInDb':_0xafd672['loggedInDb'],'dialActive':_0xafd672[_0xaa41('0x33')],'dialMethod':_0xafd672[_0xaa41('0x34')],'dialOriginateCallerIdName':_0xafd672[_0xaa41('0x35')],'dialOriginateCallerIdNumber':_0xafd672[_0xaa41('0x36')],'dialOriginateTimeout':_0xafd672[_0xaa41('0x37')],'dialPrefix':_0xafd672[_0xaa41('0x38')],'outboundAnswerAgiCallsDay':_0xafd672['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xafd672[_0xaa41('0x39')],'outboundBlacklistCallsDay':_0xafd672[_0xaa41('0x3a')],'outboundBusyCallsDay':_0xafd672[_0xaa41('0x3b')],'outboundCongestionCallsDay':_0xafd672[_0xaa41('0x3c')],'outboundDropCallsDayACS':_0xafd672[_0xaa41('0x3d')],'outboundDropCallsDayCallersExit':_0xafd672[_0xaa41('0x3e')],'outboundDropCallsDayTimeout':_0xafd672[_0xaa41('0x3f')],'outboundNoAnswerCallsDay':_0xafd672[_0xaa41('0x40')],'outboundNoSuchCallsDay':_0xafd672['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xafd672[_0xaa41('0x41')],'outboundReCallsDay':_0xafd672['outboundReCallsDay'],'outboundRejectCallsDay':_0xafd672['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xafd672[_0xaa41('0x42')],'outboundAbandonedCallsDay':_0xafd672[_0xaa41('0x43')],'predictiveIntervalAnsweredCalls':_0xafd672['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xafd672[_0xaa41('0x44')],'predictiveIntervalAvgTalktime':_0xafd672[_0xaa41('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0xafd672['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xafd672['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0xafd672['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xafd672[_0xaa41('0x46')],'predictiveIntervalHitRate':_0xafd672[_0xaa41('0x47')],'predictiveIntervalMultiplicativeFactor':_0xafd672[_0xaa41('0x48')],'predictiveIntervalPauses':_0xafd672[_0xaa41('0x49')],'predictiveIntervalAvailable':_0xafd672['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xafd672[_0xaa41('0x4a')],'message':_0xafd672[_0xaa41('0x4b')],'originated':_0xafd672[_0xaa41('0x4c')],'erlangCalls':_0xafd672['erlangCalls'],'erlangCallToSecond':_0xafd672[_0xaa41('0x4d')],'erlangAbandonmentRate':_0xafd672[_0xaa41('0x4e')],'erlangBusyFactor':_0xafd672[_0xaa41('0x4f')],'startPredictive':_0xafd672['startPredictive'],'startProgressive':_0xafd672[_0xaa41('0x50')]};if(_0xafd672[_0xaa41('0x51')]){_0x1f27f3['Trunk']={'id':_0xafd672[_0xaa41('0x51')]['id'],'name':_0xafd672[_0xaa41('0x51')][_0xaa41('0x2a')],'active':_0xafd672['Trunk'][_0xaa41('0x52')],'callerid':_0xafd672['Trunk'][_0xaa41('0x53')]};}if(_0xafd672[_0xaa41('0x54')]){_0x1f27f3[_0xaa41('0x54')]={'id':_0xafd672['Interval']['id'],'name':_0xafd672['Interval']['name']};}var _0x2dc05a=md5(JSON[_0xaa41('0x55')](_0x1f27f3));if(_0xafd672[_0xaa41('0x4')]!==_0x2dc05a){_0xafd672[_0xaa41('0x4')]=_0x2dc05a;emit(util['format']('voice:queue:%s',_0x1f27f3[_0xaa41('0x2a')]),_0xaa41('0x56'),_0x1f27f3);}}}function emitVoiceQueueChannelRemove(_0x951e52){logger[_0xaa41('0x57')](_0xaa41('0x58'),JSON[_0xaa41('0x55')](_0x951e52));emit(util[_0xaa41('0x59')]('voice:queue:%s',_0x951e52[_0xaa41('0x2a')]),_0xaa41('0x5a'),_0x951e52);io[_0xaa41('0x5b')](_0xaa41('0x5c'),_0x951e52);}function notSendMessagesQueue(_0x57f1bf){if(_0x57f1bf['sendMessageOneNotActive']){if(_0x57f1bf[_0xaa41('0x4c')]===0x0&&_0x57f1bf[_0xaa41('0x2e')]===0x0){_0x57f1bf['sendMessageOneNotActive']=![];_0x57f1bf[_0xaa41('0x2c')]=0x0;_0x57f1bf['paused']=0x0;_0x57f1bf[_0xaa41('0x4b')]=_0xaa41('0x5d');ut[_0xaa41('0x5e')](_0xaa41('0x5f'),_0x57f1bf[_0xaa41('0x2a')]+_0xaa41('0x60'));}else{_0x57f1bf[_0xaa41('0x4b')]=_0xaa41('0x61');ut['logger'](_0xaa41('0x5f'),_0x57f1bf[_0xaa41('0x2a')]+_0xaa41('0x62'));}emitCampaignPreview(_0x57f1bf);}}Preview[_0xaa41('0xf')][_0xaa41('0x26')]=function(){var _0x1e2eb2=this;setInterval(function(){_0x1e2eb2['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xaa41('0x63')]=function(){var _0x4f9086=this[_0xaa41('0x27')];this[_0xaa41('0x17')]+=0x1;for(var _0x316d8 in _0x4f9086){if(_0x4f9086[_0xaa41('0x64')](_0x316d8)&&(_0x4f9086[_0x316d8][_0xaa41('0x34')]===_0xaa41('0x8')||_0x4f9086[_0x316d8][_0xaa41('0x34')]==='booked')&&_0x4f9086[_0x316d8][_0xaa41('0x28')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xaa41('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x4f9086['hasOwnProperty'](_0x316d8)&&_0x4f9086[_0x316d8]['dialMethod']===_0xaa41('0x8')&&_0x4f9086[_0x316d8]['type']===_0xaa41('0x29')){if(_0x4f9086[_0x316d8][_0xaa41('0x33')]){this['setMessage'](_0x4f9086[_0x316d8]);if(_0x4f9086[_0x316d8]['dialPreviewAutoRecallMe'])this[_0xaa41('0x65')](_0x4f9086[_0x316d8]);}else{notSendMessagesQueue(_0x4f9086[_0x316d8]);}}}};Preview[_0xaa41('0xf')][_0xaa41('0x66')]=function(_0x2af8ba){var _0x3fe1a9=this;this[_0xaa41('0x67')][_0xaa41('0x10')](function(){if(!_[_0xaa41('0x68')](_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba])){loggerAction['info'](_0xaa41('0x69'),_0x2af8ba,_0xaa41('0x6a'),_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba][_0xaa41('0x6b')],_0xaa41('0x6c'),JSON[_0xaa41('0x55')](_0x3fe1a9['campaignsPreview'][_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba][_0xaa41('0x6b')]][_0xaa41('0x4c')]),_0xaa41('0x6d'),JSON['stringify'](_0x3fe1a9[_0xaa41('0x27')][_0x3fe1a9['actions'][_0x2af8ba]['queue']][_0xaa41('0x2e')]),JSON[_0xaa41('0x55')](_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba]['dialAnswer']),JSON[_0xaa41('0x55')](_[_0xaa41('0x6e')](_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba],['contactId',_0xaa41('0x6f'),_0xaa41('0x70'),_0xaa41('0x71')])));return ami[_0xaa41('0x72')]({'action':_0xaa41('0x73'),'channel':_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba][_0xaa41('0x74')]})[_0xaa41('0x75')](function(_0x4eab60){if(_0x4eab60[_0xaa41('0x4b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3fe1a9['actions'][_0x2af8ba]){ut[_0xaa41('0x76')](_0x3fe1a9[_0xaa41('0x27')][_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba][_0xaa41('0x6b')]],_0xaa41('0x77'));if(_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba][_0xaa41('0x78')]===!![]){ut[_0xaa41('0x79')](_0x3fe1a9['campaignsPreview'][_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba][_0xaa41('0x6b')]],_0xaa41('0x77'));ut['loggerError'](_0xaa41('0x7a')+_0x2af8ba,_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba]['queue']);}ut[_0xaa41('0x7b')](_0xaa41('0x7c')+_0x2af8ba,_0x3fe1a9[_0xaa41('0x15')][_0x2af8ba]['queue']);delete _0x3fe1a9[_0xaa41('0x15')][_0x2af8ba];}},0x2328);}});}});};Preview[_0xaa41('0xf')]['clearZombieChannels']=function(){var _0x49789a=this;loggerAction[_0xaa41('0x57')](_0xaa41('0x7d'),_[_0xaa41('0x7e')](this['actions']));for(var _0x5a76b9 in this[_0xaa41('0x15')]){if(_0x49789a[_0xaa41('0x15')][_0xaa41('0x64')](_0x5a76b9)){_0x49789a[_0xaa41('0x66')](_0x5a76b9);}}};Preview['prototype'][_0xaa41('0x65')]=function(_0x57cb70){var _0x555186=this;rpcDb[_0xaa41('0x7f')](_0x57cb70['id'],ut['agentReadyId'](this[_0xaa41('0x16')]))[_0xaa41('0x80')](function(_0x169ddf){if(!_['isNil'](_0x169ddf)){for(var _0x12ba1b=0x0;_0x12ba1b<_0x169ddf[_0xaa41('0x81')];_0x12ba1b+=0x1){if(ut[_0xaa41('0x82')](_0x169ddf[_0x12ba1b][_0xaa41('0x83')])<_0x57cb70[_0xaa41('0x84')]*0x3c){if(_0x169ddf[_0x12ba1b][_0xaa41('0x85')]&&!_0x169ddf[_0x12ba1b][_0xaa41('0x85')][_0xaa41('0x86')]){_0x555186[_0xaa41('0x87')](_0x169ddf[_0x12ba1b]['id'])['then'](ut[_0xaa41('0x88')](_0xaa41('0x89')))[_0xaa41('0x75')](ut['logger2'](_0xaa41('0x89')));}else{rpcDb[_0xaa41('0x8a')](_0x169ddf[_0x12ba1b]['id']);}}else{var _0x157898=new Action(_0x169ddf[_0x12ba1b],_0x57cb70);_0x157898[_0xaa41('0x8b')]=moment()[_0xaa41('0x59')](_0xaa41('0x8c'));_0x57cb70[_0xaa41('0x8d')]+=0x1;ut['logCustomer'](_0x157898,0x17,'RecallInQueue');if(_0x57cb70['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x169ddf[_0x12ba1b]));rpcDb['createCustomerHistory'](_0x157898,_0xaa41('0x8e'));}else{ut['logCustomer'](_0x157898,0x16,'RecallFailedTimeout');rpcDb[_0xaa41('0x8f')](_0x157898,_0xaa41('0x90'));rpcDb[_0xaa41('0x91')](_0x157898,_0xaa41('0x90'));}}}}})['catch'](ut[_0xaa41('0x88')](_0xaa41('0x92')));};Preview[_0xaa41('0xf')][_0xaa41('0x93')]=function(_0xa71432){_0xa71432[_0xaa41('0x94')]=!![];if(ut[_0xaa41('0x95')](_0xa71432[_0xaa41('0x2d')])){_0xa71432[_0xaa41('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xaa41('0x96')](_0xa71432[_0xaa41('0x33')])){_0xa71432['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0xa71432[_0xaa41('0x51')])){if(!this['isTrunkReachable'](_0xa71432[_0xaa41('0x97')])){_0xa71432['message']=_0xaa41('0x98');}else{_0xa71432[_0xaa41('0x4b')]='ACTIVE';}}else{_0xa71432[_0xaa41('0x4b')]=_0xaa41('0x99');}emitCampaignPreview(_0xa71432);};Preview[_0xaa41('0xf')][_0xaa41('0x9a')]=function(_0x5a2683,_0x5be61b,_0x339db3){var _0x22bae6=this;var _0x4d6d0c=this['actions'][_0x5be61b];var _0x2169b8=this[_0xaa41('0x27')][_0x4d6d0c[_0xaa41('0x6b')]];var _0xbeafb5;var _0x3dbe37=![];var _0x5a385e=0x2;var _0x475ceb=0x3;if(_0x2169b8){switch(_0x339db3){case'1':_0x2169b8['outboundNoSuchCallsDay']+=0x1;_0x4d6d0c['countnosuchnumberretry']+=0x1;_0x4d6d0c['countglobal']=ut[_0xaa41('0x9b')](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0x0,_0xaa41('0x9d'));ami['emit'](_0xaa41('0x9e'),ut[_0xaa41('0x9f')](_0x4d6d0c,_0xaa41('0xa0')));rpcDb[_0xaa41('0x8f')](_0x4d6d0c,_0xaa41('0xa1'));_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'0',_0x2169b8)[_0xaa41('0x80')](function(_0x50a53b){_0x3dbe37=_0x50a53b[_0xaa41('0xa3')]==0x1;_0x5a385e=_0x2169b8[_0xaa41('0xa4')];_0x475ceb=_0x2169b8[_0xaa41('0xa5')];if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8['dialGlobalMaxRetry']){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0xf,'Global');rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xa7'));}else{if(_0x4d6d0c[_0xaa41('0xa8')]>=_0x2169b8[_0xaa41('0xa9')]){rpcDb['createCustomerFinal'](_0x4d6d0c,_0xaa41('0xa7'));}else{rpcDb[_0xaa41('0xaa')](ut[_0xaa41('0xab')](_0x4d6d0c,_0xaa41('0xa8'),_0x2169b8['dialNoSuchNumberRetryFrequency']),_0x4d6d0c[_0xaa41('0xac')],_0x4d6d0c['activeContact']);}}delete this[_0xaa41('0x15')][_0x5a2683[_0xaa41('0xad')]];}else{_0x4d6d0c['countnosuchnumberretry']++;logger[_0xaa41('0x57')](_0xaa41('0xae'),_0x4d6d0c[_0xaa41('0xa8')]);logger[_0xaa41('0x57')]('id',_0x4d6d0c[_0xaa41('0xaf')]);_0x22bae6[_0xaa41('0xb0')]({'id':_0x4d6d0c[_0xaa41('0xaf')],'field':{'countnosuchnumberretry':_0x4d6d0c[_0xaa41('0xa8')]}})[_0xaa41('0x80')](function(){_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)[_0xaa41('0x80')](function(){});});}});break;case'ANSWER':var _0x1c5f70=moment()[_0xaa41('0x59')](_0xaa41('0x8c'));_0x4d6d0c['responsetime']=_0x1c5f70;_0x4d6d0c['answertime']=_0x1c5f70;_0x4d6d0c[_0xaa41('0x78')]=!![];_0x2169b8[_0xaa41('0x2e')]+=0x1;logger['info'](_0xaa41('0xb2'),_0x4d6d0c[_0xaa41('0xb3')],'\x20Queue',_0x2169b8[_0xaa41('0x2a')],_0xaa41('0x6d'),_0x2169b8[_0xaa41('0x2e')]);ami[_0xaa41('0x5b')](_0xaa41('0xb4'),ut[_0xaa41('0x9f')](_0x4d6d0c,_0xaa41('0xb5'),this[_0xaa41('0x27')][_0x4d6d0c['queue']]));if(_0x2169b8['acw']){ami[_0xaa41('0x5b')]('custom:agentConnectPreview',ut[_0xaa41('0xb6')](_0x4d6d0c));}break;case'16':ami[_0xaa41('0x5b')](_0xaa41('0xb7'),ut['buildObj'](_0x4d6d0c,_0xaa41('0xb8'),this[_0xaa41('0x27')][_0x4d6d0c[_0xaa41('0x6b')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x4d6d0c,_0xaa41('0xb8')));_0x2169b8[_0xaa41('0x39')]+=0x1;_0x2169b8['total']+=0x1;_0x2169b8[_0xaa41('0x2b')]+=0x1;ut['decrementTalkink'](_0x2169b8,'[16]');_0x4d6d0c[_0xaa41('0xb9')]=ut[_0xaa41('0x9b')](_0x4d6d0c);ut['logCustomer'](_0x4d6d0c,0x4,'Answer');rpcDb[_0xaa41('0x8f')](_0x4d6d0c,_0xaa41('0xba'));rpcDb[_0xaa41('0x91')](_0x4d6d0c,_0xaa41('0xbb'));rpcDb['crateCustomerReportQueue'](_0x4d6d0c);_0x2169b8[_0xaa41('0x30')]+=_0x4d6d0c[_0xaa41('0xbc')];_0x2169b8[_0xaa41('0x2f')]+=_0x4d6d0c['talktime'];logger[_0xaa41('0x57')](_0xaa41('0xbd'),_0x4d6d0c[_0xaa41('0xb3')],'\x20Queue',_0x2169b8[_0xaa41('0x2a')],'pTalking:\x20',_0x2169b8['pTalking']);delete this[_0xaa41('0x15')][_0x5a2683[_0xaa41('0xad')]];break;case'BUSY':_0x2169b8[_0xaa41('0x3b')]+=0x1;_0x4d6d0c[_0xaa41('0xbe')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut['totalGlobal'](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0x5,_0xaa41('0xbf'));_0x5a385e=_0x2169b8[_0xaa41('0xc0')];_0x475ceb=_0x2169b8[_0xaa41('0xa5')];ami[_0xaa41('0x5b')]('custom:agentbusy',ut[_0xaa41('0x9f')](_0x4d6d0c,'busy'));rpcDb[_0xaa41('0x8f')](_0x4d6d0c,_0xaa41('0xc1'));_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'5',_0x2169b8)[_0xaa41('0x80')](function(_0x33ec81){_0x3dbe37=_0x33ec81[_0xaa41('0xa3')]==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0xf,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4d6d0c[_0xaa41('0xbe')]>=_0x2169b8[_0xaa41('0xc4')]){rpcDb['createCustomerFinal'](_0x4d6d0c,_0xaa41('0xc1'));}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xab')](_0x4d6d0c,_0xaa41('0xbe'),_0x2169b8[_0xaa41('0xc0')]),_0x4d6d0c[_0xaa41('0xac')],_0x4d6d0c[_0xaa41('0xc5')]);}}}else{_0x4d6d0c[_0xaa41('0xbe')]++;_0x22bae6[_0xaa41('0xb0')]({'id':_0x4d6d0c['idContact'],'field':{'countbusyretry':_0x4d6d0c[_0xaa41('0xbe')]}})[_0xaa41('0x80')](function(){_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)[_0xaa41('0x80')](function(){});});}});break;case'NOANSWER':_0x2169b8[_0xaa41('0x40')]+=0x1;_0x4d6d0c['countnoanswerretry']+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut[_0xaa41('0x9b')](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0x3,_0xaa41('0xc6'));_0x5a385e=_0x2169b8[_0xaa41('0xc7')];_0x475ceb=_0x2169b8['callAdditionalPhoneAfterMin'];ami[_0xaa41('0x5b')](_0xaa41('0xc8'),ut['buildObj'](_0x4d6d0c,_0xaa41('0xc9')));rpcDb[_0xaa41('0x8f')](_0x4d6d0c,_0xaa41('0xca'));_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'3',_0x2169b8)[_0xaa41('0x80')](function(_0x133e29){_0x3dbe37=_0x133e29[_0xaa41('0xa3')]==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8['dialGlobalMaxRetry']){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0xf,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xcb'));}else{if(_0x4d6d0c[_0xaa41('0xcc')]>=_0x2169b8[_0xaa41('0xcd')]){rpcDb['createCustomerFinal'](_0x4d6d0c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xab')](_0x4d6d0c,_0xaa41('0xcc'),_0x2169b8['dialNoAnswerRetryFrequency']),_0x4d6d0c[_0xaa41('0xac')],_0x4d6d0c[_0xaa41('0xc5')]);}}}else{_0x4d6d0c['countnoanswerretry']++;_0x22bae6[_0xaa41('0xb0')]({'id':_0x4d6d0c[_0xaa41('0xaf')],'field':{'countnoanswerretry':_0x4d6d0c[_0xaa41('0xcc')]}})[_0xaa41('0x80')](function(){_0x22bae6['swapAdditionalPhones'](_0x4d6d0c,_0x5a385e,_0x475ceb)[_0xaa41('0x80')](function(){});});}});break;case'CONGESTION':_0x2169b8[_0xaa41('0x3c')]+=0x1;_0x4d6d0c[_0xaa41('0xce')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut[_0xaa41('0x9b')](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0x8,_0xaa41('0xcf'));_0x5a385e=_0x2169b8[_0xaa41('0xd0')];_0x475ceb=_0x2169b8[_0xaa41('0xa5')];ami[_0xaa41('0x5b')]('custom:agentcongestion',ut[_0xaa41('0x9f')](_0x4d6d0c,_0xaa41('0xd1')));rpcDb[_0xaa41('0x8f')](_0x4d6d0c,'[callProgressDetectingCustomer][logCongestion]');_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'8',_0x2169b8)[_0xaa41('0x80')](function(_0x10763e){_0x3dbe37=_0x10763e[_0xaa41('0xa3')]==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0xf,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xd2'));}else{if(_0x4d6d0c[_0xaa41('0xce')]>=_0x2169b8['dialCongestionMaxRetry']){rpcDb[_0xaa41('0x91')](_0x4d6d0c,_0xaa41('0xd3'));}else{rpcDb[_0xaa41('0xaa')](ut[_0xaa41('0xab')](_0x4d6d0c,_0xaa41('0xce'),_0x2169b8['dialBusyRetryFrequency']),_0x4d6d0c['unlockAgent'],_0x4d6d0c[_0xaa41('0xc5')]);}}}else{_0x4d6d0c[_0xaa41('0xce')]++;_0x22bae6['incrementPreviewCounters']({'id':_0x4d6d0c[_0xaa41('0xaf')],'field':{'countcongestionretry':_0x4d6d0c[_0xaa41('0xce')]}})['then'](function(){_0x22bae6['swapAdditionalPhones'](_0x4d6d0c,_0x5a385e,_0x475ceb)['then'](function(){});});}});break;case _0xaa41('0xd4'):_0x2169b8[_0xaa41('0xd5')]+=0x1;_0x4d6d0c[_0xaa41('0xd6')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut[_0xaa41('0x9b')](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0x14,_0xaa41('0xd7'));_0x5a385e=_0x2169b8[_0xaa41('0xd8')];_0x475ceb=_0x2169b8[_0xaa41('0xa5')];ami[_0xaa41('0x5b')](_0xaa41('0xd9'),ut['buildObj'](_0x4d6d0c,'agentreject'));rpcDb[_0xaa41('0x8f')](_0x4d6d0c,_0xaa41('0xda'));_0x22bae6['verifyAdditionalPhones'](_0x4d6d0c,'20',_0x2169b8)[_0xaa41('0x80')](function(_0x557156){_0x3dbe37=_0x557156[_0xaa41('0xa3')]==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0x14,_0xaa41('0xd7'));rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xdb'));}else{if(_0x4d6d0c[_0xaa41('0xd6')]>=_0x2169b8[_0xaa41('0xdc')]){rpcDb['createCustomerFinal'](_0x4d6d0c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xab')](_0x4d6d0c,_0xaa41('0xd6'),_0x2169b8['dialAgentRejectRetryFrequency']),_0x4d6d0c['unlockAgent'],_0x4d6d0c[_0xaa41('0xc5')]);}}}else{_0x4d6d0c[_0xaa41('0xcc')]++;_0x22bae6['incrementPreviewCounters']({'id':_0x4d6d0c['idContact'],'field':{'countnoanswerretry':_0x4d6d0c[_0xaa41('0xcc')]}})['then'](function(){_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)[_0xaa41('0x80')](function(){});});}});break;case _0xaa41('0xdd'):_0x2169b8[_0xaa41('0x43')]+=0x1;_0x4d6d0c[_0xaa41('0xde')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut[_0xaa41('0x9b')](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0xb,_0xaa41('0xdf'));rpcDb['createCustomerHistory'](_0x4d6d0c,'[callProgressDetectingCustomer][logAbandoned]');_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'11',_0x2169b8)[_0xaa41('0x80')](function(_0x337655){_0x3dbe37=_0x337655[_0xaa41('0xa3')]==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0xf,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xe0'));}else{if(_0x4d6d0c[_0xaa41('0xe1')]>=_0x2169b8[_0xaa41('0xe2')]){rpcDb[_0xaa41('0x91')](_0x4d6d0c,_0xaa41('0xe0'));}else{rpcDb[_0xaa41('0xaa')](ut['scheduledAt'](_0x4d6d0c,_0xaa41('0xde'),_0x2169b8['dialAbandonedRetryFrequency']),_0x4d6d0c[_0xaa41('0xac')],_0x4d6d0c[_0xaa41('0xc5')]);}}}else{_0x4d6d0c[_0xaa41('0xcc')]++;_0x22bae6[_0xaa41('0xb0')]({'id':_0x4d6d0c[_0xaa41('0xaf')],'field':{'countnoanswerretry':_0x4d6d0c[_0xaa41('0xcc')]}})[_0xaa41('0x80')](function(){_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)['then'](function(){});});}});break;case'18':_0x2169b8[_0xaa41('0x42')]+=0x1;_0x4d6d0c[_0xaa41('0xe3')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut[_0xaa41('0x9b')](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0x12,_0x5a2683[_0xaa41('0xe4')]||_0x5a2683[_0xaa41('0xe5')]);ami[_0xaa41('0x5b')](_0xaa41('0xe6'),ut[_0xaa41('0x9f')](_0x4d6d0c,'amd'));rpcDb['createCustomerHistory'](_0x4d6d0c,_0xaa41('0xe7'));_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'18',_0x2169b8)[_0xaa41('0x80')](function(_0x398741){_0x3dbe37=_0x398741[_0xaa41('0xa3')]==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0x12,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x4d6d0c,_0xaa41('0xe7'));}}else{_0x4d6d0c[_0xaa41('0xcc')]++;_0x22bae6['incrementPreviewCounters']({'id':_0x4d6d0c[_0xaa41('0xaf')],'field':{'countnoanswerretry':_0x4d6d0c['countnoanswerretry']}})[_0xaa41('0x80')](function(){_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)['then'](function(){});});}});delete this['actions'][_0x5a2683[_0xaa41('0xad')]];break;case'19':_0x2169b8[_0xaa41('0x42')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut['totalGlobal'](_0x4d6d0c);ut['logCustomer'](_0x4d6d0c,0x13,_0x5a2683[_0xaa41('0xe4')]||_0x5a2683['dialstatus']);ami[_0xaa41('0x5b')]('custom:amd',ut[_0xaa41('0x9f')](_0x4d6d0c,_0xaa41('0xe8')));rpcDb[_0xaa41('0x8f')](_0x4d6d0c,_0xaa41('0xe9'));_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'18',_0x2169b8)[_0xaa41('0x80')](function(_0xf615eb){_0x3dbe37=_0xf615eb['additional']==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut['cloneAction'](_0x4d6d0c,0xf,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xe9'));}else{rpcDb[_0xaa41('0x91')](_0x4d6d0c,'[callProgressDetectingCustomer][machine]');}}else{_0x4d6d0c[_0xaa41('0xcc')]++;_0x22bae6[_0xaa41('0xb0')]({'id':_0x4d6d0c[_0xaa41('0xaf')],'field':{'countnoanswerretry':_0x4d6d0c[_0xaa41('0xcc')]}})[_0xaa41('0x80')](function(){_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)[_0xaa41('0x80')](function(){});});}});delete this[_0xaa41('0x15')][_0x5a2683[_0xaa41('0xad')]];break;default:if(_0x4d6d0c['dialAnswer']){ut['decrementTalkink'](_0x2169b8,_0xaa41('0xea'));ut[_0xaa41('0x7b')](_0xaa41('0xeb')+_0x2169b8[_0xaa41('0x2a')],_0x5a2683);}_0x2169b8[_0xaa41('0x42')]+=0x1;_0x4d6d0c[_0xaa41('0xb9')]=ut['totalGlobal'](_0x4d6d0c);ut[_0xaa41('0x9c')](_0x4d6d0c,0xc,_0x5a2683[_0xaa41('0xe4')]||_0x5a2683[_0xaa41('0xe5')]);_0x5a385e=_0x2169b8[_0xaa41('0xd8')];_0x475ceb=_0x2169b8[_0xaa41('0xa5')];rpcDb[_0xaa41('0x8f')](_0x4d6d0c,'[callProgressDetectingCustomer][logUnknown]');_0x22bae6[_0xaa41('0xa2')](_0x4d6d0c,'20',_0x2169b8)[_0xaa41('0x80')](function(_0x13ddbe){_0x3dbe37=_0x13ddbe['additional']==0x1;if(!_0x3dbe37){if(ut[_0xaa41('0x9b')](_0x4d6d0c)>=_0x2169b8[_0xaa41('0xc2')]){_0xbeafb5=ut[_0xaa41('0xa6')](_0x4d6d0c,0xf,_0xaa41('0xc3'));rpcDb[_0xaa41('0x91')](_0xbeafb5,_0xaa41('0xec'));}else{rpcDb[_0xaa41('0x91')](_0x4d6d0c,_0xaa41('0xec'));}delete this[_0xaa41('0x15')][_0x5a2683[_0xaa41('0xad')]];}else{_0x22bae6[_0xaa41('0xb1')](_0x4d6d0c,_0x5a385e,_0x475ceb)[_0xaa41('0x80')](function(_0x21792a){});}});}if(!(_0x4d6d0c['dialAnswer']&&_0x339db3==='16')){ut['updateOriginated'](_0x2169b8,_0xaa41('0xed'));logger[_0xaa41('0x57')](_0xaa41('0xee'),_0x4d6d0c[_0xaa41('0xb3')],_0xaa41('0xef'),_0x2169b8[_0xaa41('0x2a')],_0xaa41('0x6c'),_0x2169b8['originated']);}if(_0x339db3!==_0xaa41('0xf0')){delete this[_0xaa41('0x15')][_0x5a2683[_0xaa41('0xad')]];delete this[_0xaa41('0x15')][_0x5a2683[_0xaa41('0xf1')]];}}};Preview[_0xaa41('0xf')][_0xaa41('0xf2')]=function(_0x1a7527,_0x1aac0c,_0x1a5a7a){if(_[_0xaa41('0xf3')](_0x1aac0c)&&_0xaa41('0xf4')!==typeof _0x1aac0c){return;}if(_['isUndefined'](_0x1a5a7a)&&_0xaa41('0xf4')!==typeof _0x1a5a7a){return;}switch(_0x1a5a7a[_0xaa41('0xf5')]){case'0':ut['logAgent'](_0x1a7527,0x0,_0xaa41('0x9d'));rpcDb[_0xaa41('0xf6')](_0x1a7527,_0xaa41('0xf7'));break;case'3':ut[_0xaa41('0xf8')](_0x1a7527,0x3,'NoAnswer');rpcDb[_0xaa41('0xf6')](_0x1a7527,_0xaa41('0xf9'));break;case'5':ut[_0xaa41('0xf8')](_0x1a7527,0x5,_0xaa41('0xbf'));rpcDb[_0xaa41('0xf6')](_0x1a7527,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xaa41('0xf8')](_0x1a7527,0x8,'Congestion');rpcDb['createAgentHistory'](_0x1a7527,_0xaa41('0xfa'));break;case'22':ut['logAgent'](_0x1a7527,0x16,'AnswerAGI');rpcDb[_0xaa41('0xf6')](_0x1a7527,_0xaa41('0xfb'));break;default:ut[_0xaa41('0xf8')](_0x1a7527,0xc,_0x1a5a7a['reason']);rpcDb[_0xaa41('0xf6')](_0x1a7527,_0xaa41('0xfa'));}ut[_0xaa41('0x76')](_0x1aac0c,_0xaa41('0xfc'));logger[_0xaa41('0x57')](_0xaa41('0xfd'),_0x1a7527[_0xaa41('0xb3')],_0xaa41('0xef'),_0x1aac0c['name'],_0xaa41('0x6c'),_0x1aac0c[_0xaa41('0x4c')]);delete this[_0xaa41('0x15')][_0x1a7527[_0xaa41('0xb3')]];};Preview[_0xaa41('0xf')]['verifyAdditionalPhones']=function(_0x519843,_0x348c77,_0x1444bb){return BPromise[_0xaa41('0xfe')]()[_0xaa41('0x80')](cmHopperAdditionalPhone[_0xaa41('0xa2')](_0x519843,_0x348c77,_0x1444bb))[_0xaa41('0x75')](logger['info'](_0xaa41('0xff')));};Preview[_0xaa41('0xf')]['swapAdditionalPhones']=function(_0x40f4ce,_0x16fe76,_0x95300a){return BPromise[_0xaa41('0xfe')]()[_0xaa41('0x80')](cmHopperAdditionalPhone[_0xaa41('0xb1')](_0x40f4ce,_0x16fe76,_0x95300a))[_0xaa41('0x75')](logger['info'](_0xaa41('0x100')));};Preview[_0xaa41('0xf')]['incrementPreviewCounters']=function(_0x31fd1d){return BPromise[_0xaa41('0xfe')]()[_0xaa41('0x80')](cmHopperAdditionalPhone[_0xaa41('0xb0')](_0x31fd1d))['catch'](logger[_0xaa41('0x57')](_0xaa41('0x101')));};Preview[_0xaa41('0xf')][_0xaa41('0x102')]=function(_0x1402e6,_0x4b84bc,_0x20d77a,_0x31d371,_0x4a68df){var _0x5cb8a1=this;return new BPromise(function(_0x456c57,_0x3125df){if(_[_0xaa41('0x68')](_0x4b84bc)||_[_0xaa41('0x68')](_0x4b84bc[_0xaa41('0x103')])||_[_0xaa41('0x68')](_0x4b84bc['phone'])||_['isNil'](_0x4b84bc[_0xaa41('0x70')])){_0x3125df(ut[_0xaa41('0x4b')]('Contact\x20is\x20undefined',_0x31d371,_0x4a68df));return;}var _0x51379c=uuid['v4']();var _0x38f4fc=_0x5cb8a1[_0xaa41('0x27')][_0x4b84bc[_0xaa41('0x6a')]['name']];var _0x50122d=_0x20d77a?_0x5cb8a1[_0xaa41('0x16')][_0x20d77a]['id']:undefined;_0x5cb8a1[_0xaa41('0x15')][_0x51379c]=new Action(_0x4b84bc,_0x38f4fc,_0x51379c,_0x20d77a,_0x50122d);var _0x10005b=_0x5cb8a1['actions'][_0x51379c];_0x10005b[_0xaa41('0xac')]=_0x31d371;_0x10005b[_0xaa41('0xc5')]=_0x4a68df;_0x10005b['lookAgent']=_0x20d77a;if(_['isEmpty'](_0x1402e6)){_0x5cb8a1[_0xaa41('0x104')](_0x10005b,_0x38f4fc,_0x4b84bc,_0x20d77a)['then'](function(_0x4679e5){logger[_0xaa41('0x57')](_0xaa41('0x105'),_0xaa41('0x106')+_0x10005b[_0xaa41('0x6b')]+_0xaa41('0x107')+_0x10005b[_0xaa41('0xaf')],JSON['stringify'](_0x4679e5));ami[_0xaa41('0x5b')](_0xaa41('0x108'),ut['buildObj'](_0x10005b,_0xaa41('0x109'),_0x5cb8a1[_0xaa41('0x27')][_0x10005b[_0xaa41('0x6b')]]));_0x456c57(ut[_0xaa41('0x4b')](_0xaa41('0x10a')));})[_0xaa41('0x75')](function(_0x5e7853){ut[_0xaa41('0x5e')](_0xaa41('0x10b'),_0x5e7853);_0x3125df(ut[_0xaa41('0x4b')](_0xaa41('0x10c'),_0x31d371,_0x4a68df));});}else{_0x38f4fc[_0xaa41('0x3a')]+=0x1;ut[_0xaa41('0x10d')](_0x10005b);rpcDb[_0xaa41('0x10e')](_0x10005b,'[Blacklist][error]');delete _0x5cb8a1[_0xaa41('0x15')][_0x51379c];_0x3125df(ut[_0xaa41('0x4b')](_0xaa41('0x10f'),_0x31d371,_0x4a68df));}});};Preview['prototype']['isTrunkReachable']=function(_0x4ecaee){return!_[_0xaa41('0x68')](_0x4ecaee)&&!_[_0xaa41('0x68')](_0x4ecaee[_0xaa41('0x2a')])&&!_[_0xaa41('0x68')](_0x4ecaee[_0xaa41('0x52')])&&_0x4ecaee['active']&&!_[_0xaa41('0x68')](this[_0xaa41('0x14')][util[_0xaa41('0x59')](_0xaa41('0x110'),_0x4ecaee[_0xaa41('0x2a')])])&&!_[_0xaa41('0x68')](this[_0xaa41('0x14')][util['format'](_0xaa41('0x110'),_0x4ecaee[_0xaa41('0x2a')])][_0xaa41('0x73')])&&(this['trunks'][util[_0xaa41('0x59')]('SIP/%s',_0x4ecaee['name'])][_0xaa41('0x73')]==='reachable'||this[_0xaa41('0x14')][util[_0xaa41('0x59')](_0xaa41('0x110'),_0x4ecaee[_0xaa41('0x2a')])][_0xaa41('0x73')]===_0xaa41('0x111'));};Preview[_0xaa41('0xf')]['run']=function(_0x3c91e0,_0x10b691){var _0x3ee9e3=this;return new BPromise(function(_0x2eb745,_0x1a638d){_0x3ee9e3[_0xaa41('0x112')](_0x3c91e0,_0x10b691)[_0xaa41('0x80')](function(_0x38140b){_0x2eb745(_[_0xaa41('0x6e')](_0x38140b,[_0xaa41('0x4b')]));})[_0xaa41('0x75')](function(_0x498e6c){if(_0x498e6c[_0xaa41('0x113')]){rpcDb[_0xaa41('0x114')](_0x3c91e0);}if(_0x498e6c[_0xaa41('0x52')]){rpcDb[_0xaa41('0x8a')](_0x3c91e0);}_0x1a638d(_['pick'](_0x498e6c,[_0xaa41('0x4b')]));});});};Preview['prototype']['execRun']=function(_0x5020d5,_0x46fc5f){var _0xa87d06=this;return new BPromise(function(_0x5f40ff,_0x2176a6){var _0x356256,_0x1e86cc;rpcDb[_0xaa41('0x115')](_0x5020d5)[_0xaa41('0x80')](function(_0x34d857){if(!_[_0xaa41('0x68')](_0x34d857[0x0])){_0x1e86cc=_0x34d857[0x0][_0xaa41('0x116')]?![]:!![];_0x356256=_0x34d857[0x0][_0xaa41('0x116')]?!![]:![];_0x356256=_0x46fc5f?!![]:_0x356256;}var _0x410fa3=_0xa87d06[_0xaa41('0x117')](_0x34d857);if(_0x410fa3[_0xaa41('0x118')]){rpcDb[_0xaa41('0x119')](_[_0xaa41('0x6e')](_0x34d857[0x0],[_0xaa41('0x70'),_0xaa41('0x11a')]))[_0xaa41('0x80')](function(_0x4ed640){_0xa87d06[_0xaa41('0x102')](_0x4ed640,_0x34d857[0x0],_0x46fc5f,_0x1e86cc,_0x356256)[_0xaa41('0x80')](function(_0x154828){_0x5f40ff(_0x154828);})[_0xaa41('0x75')](function(_0x4973f5){_0x2176a6(_0x4973f5);});})[_0xaa41('0x75')](function(_0x304c3e){ut['logger'](_0xaa41('0x11b'),_0x304c3e);_0x2176a6(ut[_0xaa41('0x4b')](_0xaa41('0x11c'),_0x1e86cc,_0x356256));});}else{_0x2176a6(ut[_0xaa41('0x4b')](_0x410fa3[_0xaa41('0x4b')],_0x1e86cc,_0x356256));}})[_0xaa41('0x75')](function(_0x41fca3){ut[_0xaa41('0x5e')](_0xaa41('0x11d'),_0x41fca3);_0x2176a6(ut[_0xaa41('0x4b')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xaa41('0xf')][_0xaa41('0x117')]=function(_0x44c44d){if(_[_0xaa41('0x68')](_0x44c44d)||_[_0xaa41('0x11e')](_0x44c44d)||!_[_0xaa41('0x68')](_0x44c44d[0x0]['Agent'])&&_[_0xaa41('0x68')](_0x44c44d[0x0]['Agent'][_0xaa41('0x2a')])){ut[_0xaa41('0x5e')](_0xaa41('0x11f'),_0x44c44d);return{'isValid':![],'message':_0xaa41('0x120')};}var _0x45e57f=this['campaignsPreview'][_0x44c44d[0x0][_0xaa41('0x6a')][_0xaa41('0x2a')]];_0x45e57f['message']=_0xaa41('0x99');if(_[_0xaa41('0x68')](_0x45e57f)){ut[_0xaa41('0x5e')](_0xaa41('0x121'),_0x45e57f);return{'isValid':![],'message':_0xaa41('0x122')};}if(!this[_0xaa41('0x123')](_0x45e57f[_0xaa41('0x51')])){ut[_0xaa41('0x5e')](_0xaa41('0x124'),_0xaa41('0x125')+_0x45e57f['name']+_0xaa41('0x126'));if(!this[_0xaa41('0x123')](_0x45e57f[_0xaa41('0x97')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x45e57f[_0xaa41('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xaa41('0x96')](_0x45e57f[_0xaa41('0x33')])){ut[_0xaa41('0x5e')](_0xaa41('0x127'),_0x45e57f['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xaa41('0x125')+_0x45e57f[_0xaa41('0x2a')]+_0xaa41('0x128')};}return{'isValid':!![],'message':_0xaa41('0x129')};};Preview[_0xaa41('0xf')]['execCall']=function(_0x33aea4,_0x1b2a8c,_0x597e47,_0xc2d2d9){var _0x32b673=this;return new BPromise(function(_0x4b4a4a,_0x315f30){var _0x12d533=_0x33aea4['uniqueid'];var _0x44ee83=_0x32b673[_0xaa41('0x123')](_0x1b2a8c['Trunk'])?util[_0xaa41('0x59')]('SIP/%s/%s%s',_0x1b2a8c['Trunk'][_0xaa41('0x2a')],_[_0xaa41('0x68')](_0x1b2a8c[_0xaa41('0x38')])?'':_0x1b2a8c[_0xaa41('0x38')][_0xaa41('0x12a')]()||'',_0x1b2a8c['dialCutDigit']>0x0?_0x597e47[_0xaa41('0x11a')]['substring'](_0x1b2a8c['dialCutDigit']):_0x597e47[_0xaa41('0x11a')]):util[_0xaa41('0x59')](_0xaa41('0x12b'),_[_0xaa41('0x68')](_0x1b2a8c[_0xaa41('0x97')])?_0x1b2a8c[_0xaa41('0x51')][_0xaa41('0x2a')]:_0x1b2a8c['TrunkBackup'][_0xaa41('0x2a')],_[_0xaa41('0x68')](_0x1b2a8c[_0xaa41('0x38')])?'':_0x1b2a8c[_0xaa41('0x38')][_0xaa41('0x12a')]()||'',_0x1b2a8c[_0xaa41('0x12c')]>0x0?_0x597e47[_0xaa41('0x11a')][_0xaa41('0x12d')](_0x1b2a8c[_0xaa41('0x12c')]):_0x597e47[_0xaa41('0x11a')]);var _0x473d1c=_0x32b673[_0xaa41('0x123')](_0x1b2a8c['Trunk'])?ut['getCallerId'](_0x1b2a8c[_0xaa41('0x51')][_0xaa41('0x53')],_0x1b2a8c[_0xaa41('0x35')],_0x1b2a8c['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xaa41('0x12e')](_0x1b2a8c[_0xaa41('0x36')],_0x1b2a8c[_0xaa41('0x12f')]):_0x1b2a8c[_0xaa41('0x36')]):ut[_0xaa41('0x130')](_[_0xaa41('0x68')](_0x1b2a8c[_0xaa41('0x97')])?_0x1b2a8c[_0xaa41('0x51')][_0xaa41('0x53')]:_0x1b2a8c[_0xaa41('0x97')][_0xaa41('0x53')],_0x1b2a8c[_0xaa41('0x35')],_0x1b2a8c[_0xaa41('0x12f')]>0x0?ut[_0xaa41('0x12e')](_0x1b2a8c[_0xaa41('0x36')],_0x1b2a8c['dialRandomLastDigitCallerIdNumber']):_0x1b2a8c[_0xaa41('0x36')]);if(_0x473d1c){_0x33aea4[_0xaa41('0x131')]=ut[_0xaa41('0x132')](_0x473d1c);_0x33aea4['originatecalleridnum']=ut[_0xaa41('0x133')](_0x473d1c);}var _0xfc1e24=ut[_0xaa41('0x134')](_0x1b2a8c,_0x597e47,_0x44ee83,_0x473d1c,_0x12d533,_0x33aea4);_[_0xaa41('0x135')](_0x33aea4,ut[_0xaa41('0x136')](_0xfc1e24));_0x33aea4[_0xaa41('0x8b')]=moment()[_0xaa41('0x59')](_0xaa41('0x8c'));ami['Action'](ut[_0xaa41('0x137')](_0x33aea4,_0x1b2a8c,_0xfc1e24,_0x33aea4[_0xaa41('0xc5')],_0xc2d2d9))[_0xaa41('0x80')](function(_0x2fc4b1){_0x1b2a8c[_0xaa41('0x4c')]+=0x1;logger['info'](_0xaa41('0x138'),_0x12d533,'\x20Queue',_0x1b2a8c[_0xaa41('0x2a')],_0xaa41('0x6c'),_0x1b2a8c[_0xaa41('0x4c')]);_0x4b4a4a(_0x2fc4b1);})[_0xaa41('0x75')](function(_0x138ef0){ut[_0xaa41('0xf8')](_0x33aea4,0xe,_0xaa41('0x139'));rpcDb[_0xaa41('0xf6')](_0x33aea4,_0xaa41('0x13a'));_0x315f30(_0x138ef0);});});};Preview[_0xaa41('0xf')][_0xaa41('0x21')]=function(_0x3ef059){if(this['actions'][_0x3ef059['linkedid']]){this[_0xaa41('0x15')][_0x3ef059[_0xaa41('0xad')]][_0xaa41('0x74')]=_0x3ef059[_0xaa41('0x74')];}};Preview[_0xaa41('0xf')][_0xaa41('0x18')]=function(_0x538e17){var _0x411192=this;var _0x48c11f=this[_0xaa41('0x15')][_0x538e17[_0xaa41('0x13b')]];if(_0x48c11f){if(_0x48c11f[_0xaa41('0x13c')]&&this[_0xaa41('0x16')][_0x48c11f[_0xaa41('0x13c')]]){ut[_0xaa41('0x13d')](_0x48c11f,this['agents'][_0x48c11f['lookAgent']][_0xaa41('0x2a')],this['agents'][_0x48c11f[_0xaa41('0x13c')]]['id']);}var _0x3f8296=_[_0xaa41('0x13e')](_0x48c11f);_0x3f8296[_0xaa41('0x13f')]=moment()[_0xaa41('0x59')](_0xaa41('0x8c'));var _0x422838=_0x411192[_0xaa41('0x27')][_0x48c11f[_0xaa41('0x6b')]];if(ut[_0xaa41('0x140')](_0x538e17[_0xaa41('0x141')])){if(_0x48c11f[_0xaa41('0xac')]){rpcDb[_0xaa41('0x114')](_0x48c11f[_0xaa41('0xaf')]);}if(_0x48c11f['activeContact']){rpcDb[_0xaa41('0x8a')](_0x48c11f['idContact']);}ami[_0xaa41('0x5b')]('custom:agentringnoanswer',ut[_0xaa41('0x9f')](_0x48c11f,_0xaa41('0x142'),this[_0xaa41('0x27')][_0x48c11f[_0xaa41('0x6b')]]));this[_0xaa41('0xf2')](_0x3f8296,_0x422838,_0x538e17);}else{_0x48c11f[_0xaa41('0x8b')]=moment()[_0xaa41('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xaa41('0xf8')](_0x3f8296,0x4,'Answer');rpcDb['createAgentHistory'](_0x3f8296,_0xaa41('0x143'));}}};Preview[_0xaa41('0xf')]['syncHangup']=function(_0x2c4930){var _0x1285ed=this;var _0x57b75c=this[_0xaa41('0x15')][_0x2c4930[_0xaa41('0xad')]];var _0x3f5b34;if(_0x57b75c){_0x3f5b34=this['campaignsPreview'][_0x57b75c[_0xaa41('0x6b')]];logger['info'](_0xaa41('0x144'),_0x2c4930[_0xaa41('0xad')],_0xaa41('0xef'),_0x3f5b34[_0xaa41('0x2a')],'pTalking:\x20',_0x3f5b34[_0xaa41('0x2e')]);}if(this[_0xaa41('0x15')][_0x2c4930[_0xaa41('0xad')]]&&_0x2c4930['linkedid']!==_0x2c4930[_0xaa41('0xb3')]){if(_0x2c4930[_0xaa41('0x145')]==='16'&&this[_0xaa41('0x15')][_0x2c4930[_0xaa41('0xad')]][_0xaa41('0x78')]){this[_0xaa41('0x9a')](_0x2c4930,_0x2c4930[_0xaa41('0xad')],_0x2c4930[_0xaa41('0x145')]);}else if(this['actions'][_0x2c4930[_0xaa41('0xad')]]['dialAnswer']){logger[_0xaa41('0x57')](_0xaa41('0x146'),_0x2c4930[_0xaa41('0xad')],_0x2c4930[_0xaa41('0x145')],_0xaa41('0xef'),_0x3f5b34[_0xaa41('0x2a')],_0xaa41('0x6d'),_0x3f5b34[_0xaa41('0x2e')]);this[_0xaa41('0x9a')](_0x2c4930,_0x2c4930[_0xaa41('0xad')],_0x2c4930[_0xaa41('0x145')]);}}else if(_0x57b75c&&_[_0xaa41('0x68')](_0x57b75c[_0xaa41('0x147')])&&_0x3f5b34['dialQueueProject']&&_0x2c4930[_0xaa41('0xad')]===_0x2c4930[_0xaa41('0xb3')]&&_[_0xaa41('0x68')](_0x2c4930[_0xaa41('0xf5')])&&_0x2c4930[_0xaa41('0x145')]==='16'&&_0x2c4930[_0xaa41('0x148')]==='6'&&_[_0xaa41('0xf3')](_0x57b75c[_0xaa41('0x149')])){if(_0x57b75c[_0xaa41('0xac')]){rpcDb['unlockContact'](_0x57b75c[_0xaa41('0xaf')]);}if(_0x57b75c[_0xaa41('0xc5')]){rpcDb[_0xaa41('0x8a')](_0x57b75c[_0xaa41('0xaf')]);}_0x2c4930[_0xaa41('0xf5')]='22';this[_0xaa41('0xf2')](_0x57b75c,_0x3f5b34,_0x2c4930);}else if(_0x57b75c&&_0x57b75c[_0xaa41('0x149')]){if(_0x2c4930[_0xaa41('0x145')]==='16'&&this[_0xaa41('0x15')][_0x2c4930[_0xaa41('0xad')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x2c4930[_0xaa41('0xad')],_0x2c4930[_0xaa41('0x145')],'\x20Queue',_0x3f5b34[_0xaa41('0x2a')],_0xaa41('0x6d'),_0x3f5b34['pTalking']);this[_0xaa41('0x9a')](_0x2c4930,_0x2c4930['linkedid'],_0x2c4930[_0xaa41('0x145')]);}else if(this[_0xaa41('0x15')][_0x2c4930[_0xaa41('0xad')]][_0xaa41('0x78')]){logger[_0xaa41('0x57')]('[syncHangup][talking][cause]',_0x2c4930[_0xaa41('0xad')],_0x2c4930[_0xaa41('0x145')],_0xaa41('0xef'),_0x3f5b34['name'],'pTalking:\x20',_0x3f5b34[_0xaa41('0x2e')]);this[_0xaa41('0x9a')](_0x2c4930,_0x2c4930['linkedid'],_0x2c4930[_0xaa41('0x145')]);}}};Preview[_0xaa41('0xf')][_0xaa41('0x1f')]=function(_0x50fb42){if(this[_0xaa41('0x15')][_0x50fb42[_0xaa41('0xf1')]]&&_0x50fb42[_0xaa41('0xf1')]!==_0x50fb42['destuniqueid']){this[_0xaa41('0x9a')](_0x50fb42,_0x50fb42[_0xaa41('0xf1')],_0x50fb42['dialstatus']);}};Preview['prototype'][_0xaa41('0x1d')]=function(_0x4395a5){if(this[_0xaa41('0x15')][_0x4395a5[_0xaa41('0xad')]]&&_0x4395a5['linkedid']!==_0x4395a5[_0xaa41('0xb3')]&&!this[_0xaa41('0x15')][_0x4395a5['linkedid']][_0xaa41('0x78')]){if(_0x4395a5[_0xaa41('0x145')]==='1'){this[_0xaa41('0x9a')](_0x4395a5,_0x4395a5[_0xaa41('0xad')],_0x4395a5['cause']);}}};Preview[_0xaa41('0xf')][_0xaa41('0x14a')]=function(_0x10d9c8,_0xdcb33d,_0x28c7b7){if(this[_0xaa41('0x15')][_0x10d9c8]){if(_[_0xaa41('0x68')](this[_0xaa41('0x15')][_0x10d9c8][_0xaa41('0x14b')])){this[_0xaa41('0x15')][_0x10d9c8]['variables']={};}this[_0xaa41('0x15')][_0x10d9c8][_0xaa41('0x14b')][_0xdcb33d]=_0x28c7b7;}};Preview[_0xaa41('0xf')][_0xaa41('0x23')]=function(_0x4fb03){try{if(!_['isNil'](_0x4fb03)){if(ut[_0xaa41('0x14c')](_['keys'](_0x4fb03[_0xaa41('0x14d')])[0x0])){this['addVariable'](_0x4fb03['uniqueid'],_[_0xaa41('0x14e')](_0x4fb03['variable'])[0x0],_0x4fb03['value']);}}}catch(_0xdd3739){logger[_0xaa41('0x14f')](_0xaa41('0x150'),util[_0xaa41('0x151')](_0xdd3739,{'showHidden':![],'depth':null}));}};Preview[_0xaa41('0xf')][_0xaa41('0x152')]=function(_0x54d21b){if(_0x54d21b){if(this[_0xaa41('0x15')][_0x54d21b[_0xaa41('0x153')]]){this[_0xaa41('0x15')][_0x54d21b['transfertargetlinkedid']][_0xaa41('0x149')]=!![];}}};Preview['prototype'][_0xaa41('0x25')]=function(_0x132a87){if(_0x132a87){if(this[_0xaa41('0x15')][_0x132a87[_0xaa41('0x154')]]){this['actions'][_0x132a87['transfererlinkedid']][_0xaa41('0x149')]=!![];}}};module[_0xaa41('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9b43740..46a9078 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 _0x6abc=['getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','lastAssignedTo','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6abc,0x145));var _0xc6ab=function(_0x2749cd,_0x1d51ac){_0x2749cd=_0x2749cd-0x0;var _0x6417a7=_0x6abc[_0x2749cd];return _0x6417a7;};'use strict';var util=require(_0xc6ab('0x0'));var BPromise=require('bluebird');var logger=require(_0xc6ab('0x1'))(_0xc6ab('0x2'));var _=require(_0xc6ab('0x3'));var cmHopper=require(_0xc6ab('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xc6ab('0x5'));var agentReportPreview=require(_0xc6ab('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5bed80){return function(_0x1c1168){logger[_0xc6ab('0x7')](_0x5bed80,util[_0xc6ab('0x8')](_0x1c1168,{'showHidden':![],'depth':null}));};}function create(_0x52165a){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopperHistory[_0xc6ab('0xb')](_0x52165a))['catch'](loggerCatch(_0xc6ab('0xc')));}function createAgent(_0x497559){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](agentReportPreview['createHistory'](_0x497559))['catch'](loggerCatch(_0xc6ab('0xc')));}function moveContact(_0x445ebc){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0xd')](_0x445ebc,!![]))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0xf')));}exports[_0xc6ab('0x10')]=function(_0x5b9c70){return BPromise[_0xc6ab('0x9')]()['then'](cmHopperBlack[_0xc6ab('0x10')](_0x5b9c70))[_0xc6ab('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xc6ab('0x11')]=function(_0x3c8e66){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x11')](_0x3c8e66))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xc6ab('0xb')]=function(_0x50e5ab,_0x26a060){create(_0x50e5ab)[_0xc6ab('0xe')](loggerCatch(_0x26a060));moveContact(_0x50e5ab)[_0xc6ab('0xe')](loggerCatch(_0x26a060));};exports['createAgentHistory']=function(_0x5307f6,_0x4b151b){createAgent(_0x5307f6)[_0xc6ab('0xe')](loggerCatch(_0x4b151b));};exports[_0xc6ab('0x12')]=function(_0x1956db,_0xd1f9fc){create(_0x1956db)[_0xc6ab('0xe')](loggerCatch(_0xd1f9fc));};exports['createCustomerFinal']=function(_0x433b29,_0x35bf7f){moveContact(_0x433b29)[_0xc6ab('0xe')](loggerCatch(_0x35bf7f));};exports[_0xc6ab('0x13')]=function(_0x327e22,_0x53fa49,_0x477621){if(_0x53fa49){_0x327e22['UserId']=null;}if(_0x477621){_0x327e22['active']=![];}return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x13')](_0x327e22))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x14')));};exports[_0xc6ab('0x15')]=function(_0x1f2af4){return BPromise[_0xc6ab('0x9')]()['then'](cmHopper['countReScheduled'](_0x1f2af4))[_0xc6ab('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0xc6ab('0x16')]=function(_0x230820){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x16')]({'UserId':null},_0x230820,0x1))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x17')));};exports[_0xc6ab('0x18')]=function(_0x710d50){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper['unlockContact']({'active':![]},_0x710d50,0x1))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x19')));};exports[_0xc6ab('0x1a')]=function(_0x510bb0){var _0x4a6d00={};_0x4a6d00[_0xc6ab('0x1b')]=_0x510bb0[_0xc6ab('0x1b')];_0x4a6d00[_0xc6ab('0x1c')]=_0x510bb0[_0xc6ab('0x1c')];_0x4a6d00[_0xc6ab('0x1d')]=_0x510bb0[_0xc6ab('0x1d')];_0x4a6d00['calleridname']=_0x510bb0[_0xc6ab('0x1e')];_0x4a6d00[_0xc6ab('0x1f')]=_0x510bb0[_0xc6ab('0x1f')];_0x4a6d00['queuecallerjoinAt']=_0x510bb0[_0xc6ab('0x20')];_0x4a6d00[_0xc6ab('0x21')]=_0x510bb0[_0xc6ab('0x20')];_0x4a6d00['queuecallercomplete']=0x1;_0x4a6d00[_0xc6ab('0x22')]=_0x510bb0[_0xc6ab('0x23')];_0x4a6d00['connectedlinename']=_0x510bb0[_0xc6ab('0x24')];_0x4a6d00[_0xc6ab('0x25')]=_0xc6ab('0x26');_0x4a6d00[_0xc6ab('0x27')]=_0xc6ab('0x28');_0x4a6d00['holdtime']=0x0;_0x4a6d00['assigned']=0x1;_0x4a6d00[_0xc6ab('0x29')]=_0x510bb0[_0xc6ab('0x24')];_0x4a6d00['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()[_0xc6ab('0xa')](voiceQueueReport[_0xc6ab('0x2a')](_0x4a6d00))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xc6ab('0x2b')]=function(_0xfd452d,_0x16f3d4){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x2b')](_0xfd452d,_0x16f3d4))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xc6ab('0x2c')]=function(_0x2ebfa3){return BPromise[_0xc6ab('0x9')]()[_0xc6ab('0xa')](cmHopper[_0xc6ab('0x13')](_0x2ebfa3,!![],!![]))[_0xc6ab('0xe')](loggerCatch(_0xc6ab('0x2d')));}; \ No newline at end of file +var _0xa5b9=['../rpc/voiceQueueReport','error','inspect','resolve','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview'];(function(_0x397058,_0x2e041c){var _0x250198=function(_0x362b92){while(--_0x362b92){_0x397058['push'](_0x397058['shift']());}};_0x250198(++_0x2e041c);}(_0xa5b9,0x1e4));var _0x9a5b=function(_0x220f2a,_0x3f73b3){_0x220f2a=_0x220f2a-0x0;var _0x55be35=_0xa5b9[_0x220f2a];return _0x55be35;};'use strict';var util=require(_0x9a5b('0x0'));var BPromise=require(_0x9a5b('0x1'));var logger=require(_0x9a5b('0x2'))(_0x9a5b('0x3'));var _=require(_0x9a5b('0x4'));var cmHopper=require(_0x9a5b('0x5'));var cmHopperFinal=require(_0x9a5b('0x6'));var cmHopperHistory=require(_0x9a5b('0x7'));var cmHopperBlack=require(_0x9a5b('0x8'));var voiceQueueRt=require(_0x9a5b('0x9'));var agentReportPreview=require(_0x9a5b('0xa'));var voiceQueueReport=require(_0x9a5b('0xb'));function loggerCatch(_0x522465){return function(_0x306b1a){logger[_0x9a5b('0xc')](_0x522465,util[_0x9a5b('0xd')](_0x306b1a,{'showHidden':![],'depth':null}));};}function create(_0x1bbe33){return BPromise[_0x9a5b('0xe')]()['then'](cmHopperHistory['createHistory'](_0x1bbe33))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x10')));}function createAgent(_0x5651ce){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](agentReportPreview[_0x9a5b('0x12')](_0x5651ce))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x10')));}function moveContact(_0x19f4fe){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](cmHopper[_0x9a5b('0x13')](_0x19f4fe,!![]))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x14')));}exports[_0x9a5b('0x15')]=function(_0x1341de){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](cmHopperBlack[_0x9a5b('0x15')](_0x1341de))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x16')));};exports['getContactPreview']=function(_0x40bbc0){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](cmHopper[_0x9a5b('0x17')](_0x40bbc0))[_0x9a5b('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9a5b('0x12')]=function(_0x450396,_0x43d45b){create(_0x450396)[_0x9a5b('0xf')](loggerCatch(_0x43d45b));moveContact(_0x450396)[_0x9a5b('0xf')](loggerCatch(_0x43d45b));};exports[_0x9a5b('0x18')]=function(_0x3da620,_0x24309f){createAgent(_0x3da620)[_0x9a5b('0xf')](loggerCatch(_0x24309f));};exports[_0x9a5b('0x19')]=function(_0x236459,_0xf40748){create(_0x236459)[_0x9a5b('0xf')](loggerCatch(_0xf40748));};exports['createCustomerFinal']=function(_0x3d39af,_0x5bfe61){moveContact(_0x3d39af)[_0x9a5b('0xf')](loggerCatch(_0x5bfe61));};exports[_0x9a5b('0x1a')]=function(_0x5e6dc1,_0xab48d3,_0x49d96e){if(_0xab48d3){_0x5e6dc1['UserId']=null;}if(_0x49d96e){_0x5e6dc1['active']=![];}return BPromise['resolve']()['then'](cmHopper[_0x9a5b('0x1a')](_0x5e6dc1))[_0x9a5b('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9a5b('0x1b')]=function(_0x3be7e9){return BPromise[_0x9a5b('0xe')]()['then'](cmHopper['countReScheduled'](_0x3be7e9))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x1c')));};exports['unlockContact']=function(_0x2409b6){return BPromise['resolve']()[_0x9a5b('0x11')](cmHopper[_0x9a5b('0x1d')]({'UserId':null},_0x2409b6,0x1))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x1e')));};exports['disableContact']=function(_0x1e5640){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](cmHopper[_0x9a5b('0x1d')]({'active':![]},_0x1e5640,0x1))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x1f')));};exports[_0x9a5b('0x20')]=function(_0x343732){var _0x39ca4d={};_0x39ca4d[_0x9a5b('0x21')]=_0x343732[_0x9a5b('0x21')];_0x39ca4d[_0x9a5b('0x22')]=_0x343732['uniqueid'];_0x39ca4d['calleridnum']=_0x343732['calleridnum'];_0x39ca4d[_0x9a5b('0x23')]=_0x343732[_0x9a5b('0x23')];_0x39ca4d['queue']=_0x343732['queue'];_0x39ca4d[_0x9a5b('0x24')]=_0x343732[_0x9a5b('0x25')];_0x39ca4d[_0x9a5b('0x26')]=_0x343732[_0x9a5b('0x25')];_0x39ca4d[_0x9a5b('0x27')]=0x1;_0x39ca4d[_0x9a5b('0x28')]=_0x343732[_0x9a5b('0x29')];_0x39ca4d[_0x9a5b('0x2a')]=_0x343732[_0x9a5b('0x2b')];_0x39ca4d[_0x9a5b('0x2c')]=_0x9a5b('0x2d');_0x39ca4d['exten']=_0x9a5b('0x2e');_0x39ca4d[_0x9a5b('0x2f')]=0x0;_0x39ca4d['assigned']=0x1;_0x39ca4d[_0x9a5b('0x30')]=_0x343732[_0x9a5b('0x2b')];_0x39ca4d[_0x9a5b('0x31')]='COMPLETED';return BPromise[_0x9a5b('0xe')]()['then'](voiceQueueReport[_0x9a5b('0x32')](_0x39ca4d))[_0x9a5b('0xf')](loggerCatch(_0x9a5b('0x33')));};exports[_0x9a5b('0x34')]=function(_0x1a3fc3,_0x25610d){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](cmHopper['getContactRecallMe'](_0x1a3fc3,_0x25610d))['catch'](loggerCatch(_0x9a5b('0x35')));};exports[_0x9a5b('0x36')]=function(_0x460699){return BPromise[_0x9a5b('0xe')]()[_0x9a5b('0x11')](cmHopper['rescheduleContact'](_0x460699,!![],!![]))[_0x9a5b('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index f752f6e..7501e7c 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 _0xca86=['xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','logger','inspect','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','countnoanswerretry','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xca86,0x138));var _0x6ca8=function(_0x5cfa4a,_0x20b2ad){_0x5cfa4a=_0x5cfa4a-0x0;var _0x2590f1=_0xca86[_0x5cfa4a];return _0x2590f1;};'use strict';var util=require(_0x6ca8('0x0'));var _=require(_0x6ca8('0x1'));var moment=require(_0x6ca8('0x2'));var logger=require(_0x6ca8('0x3'))(_0x6ca8('0x4'));var ipAgi=process[_0x6ca8('0x5')][_0x6ca8('0x6')]||_0x6ca8('0x7');function getSeconds(_0x3be4b5,_0x3f7293){var _0x3868b0=moment(_0x3be4b5)['milliseconds'](0x0);var _0x147c33=moment(_0x3f7293)['milliseconds'](0x0);return _0x3868b0[_0x6ca8('0x8')](_0x147c33,_0x6ca8('0x9'));}exports[_0x6ca8('0xa')]=function(_0x4262e0){return function(_0x5dca45){logger[_0x6ca8('0xb')](_0x4262e0,util['inspect'](_0x5dca45,{'showHidden':![],'depth':null}));};};exports[_0x6ca8('0xc')]=function(_0x4d5e36,_0x3f5f06){logger['info'](_0x4d5e36,util['inspect'](_0x3f5f06,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x44cc86,_0x27a51f){logger[_0x6ca8('0xb')](_0x44cc86,util[_0x6ca8('0xd')](_0x27a51f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x5e6564){return function(_0xfb92f8){logger[_0x6ca8('0xe')](_0x5e6564,util['inspect'](_0xfb92f8,{'showHidden':![],'depth':null}));};};exports[_0x6ca8('0xf')]=function(_0x277804,_0x4f5ce4,_0x62f409){return{'message':_0x277804,'unlock':_0x4f5ce4,'active':_0x62f409};};exports[_0x6ca8('0x10')]=function(_0x14549b,_0xbf8c1f,_0x17a751){if(!_[_0x6ca8('0x11')](_0x17a751)&&_0x6ca8('0x12')===typeof _0x17a751&&!_[_0x6ca8('0x13')](_0x17a751)){if(!_['isUndefined'](_0xbf8c1f)&&_0x6ca8('0x12')===typeof _0xbf8c1f&&!_[_0x6ca8('0x13')](_0xbf8c1f)){return util[_0x6ca8('0x14')](_0x6ca8('0x15'),_0xbf8c1f,_0x17a751);}return util[_0x6ca8('0x14')](_0x6ca8('0x15'),_0x17a751,_0x17a751);}if(!_['isUndefined'](_0x14549b)&&_0x6ca8('0x12')===typeof _0x14549b&&!_[_0x6ca8('0x13')](_0x14549b)){return _0x14549b;}return _0x6ca8('0x16');};exports[_0x6ca8('0x17')]=function(_0x28b049){if(_[_0x6ca8('0x18')](_0x28b049)){return![];}return _0x28b049;};exports[_0x6ca8('0x19')]=function(_0xfadafe,_0x579a70,_0xa2afb6,_0x351eff,_0x5af268,_0x5c3ddb){var _0x594e81={'XMD-QUEUE':_0x579a70[_0x6ca8('0x1a')]?_0x579a70['Queue']['name']:'','XMD-CALLERID':_0x351eff,'XMD-CALLERID-PREVIEW':_0x5c3ddb?util[_0x6ca8('0x14')](_0x6ca8('0x15'),_0x5c3ddb[_0x6ca8('0x1b')],_0x5c3ddb['calleridnum']):_0x351eff,'XMD-DIALID':_0x5af268,'XMD-CONTACTID':_0x579a70[_0x6ca8('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x351eff,'XMD-VOICEQUEUEID':_0x579a70['VoiceQueueId'],'XMD-DIALCHANNEL':_0xa2afb6,'XMD-DIALTIMEOUT':_0xfadafe[_0x6ca8('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x6ca8('0x14')](_0x6ca8('0x1e'),_0xfadafe[_0x6ca8('0x1f')]?'g':'',_['isEmpty'](_0xfadafe[_0x6ca8('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xfadafe[_0x6ca8('0x21')]||'','XMD-AGI':_0xfadafe[_0x6ca8('0x22')]?util[_0x6ca8('0x14')](_0x6ca8('0x23'),ipAgi,_0xfadafe['dialQueueProject']):_0x6ca8('0x24'),'XMD-AGIAFTER':_0xfadafe[_0x6ca8('0x1f')]?util[_0x6ca8('0x14')](_0x6ca8('0x23'),ipAgi,_0xfadafe[_0x6ca8('0x1f')]):_0x6ca8('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x5c3ddb?_0x5c3ddb[_0x6ca8('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x5c3ddb?_0x5c3ddb['originatecalleridname']:'','XMD-DESTINATION':_0x6ca8('0x26'),'SIPADDHEADER':_0x6ca8('0x27')};if(!_[_0x6ca8('0x13')](_0xfadafe[_0x6ca8('0x20')])){_0x594e81[util[_0x6ca8('0x14')]('%s',_0x6ca8('0x28'))]=_0xfadafe[_0x6ca8('0x20')];_0x594e81[util[_0x6ca8('0x14')]('%s',_0x6ca8('0x29'))]=_0x5af268;}if(_0x579a70&&_0x579a70[_0x6ca8('0x2a')]){for(var _0x55e6a9 in _0x579a70[_0x6ca8('0x2a')]){if(_0x579a70['Contact'][_0x6ca8('0x2b')](_0x55e6a9)){if(!_[_0x6ca8('0x18')](_0x579a70[_0x6ca8('0x2a')][_0x55e6a9])&&_0x55e6a9!=='id'&&_0x55e6a9!=='tags'&&_0x55e6a9!==_0x6ca8('0x2c')&&_0x55e6a9!==_0x6ca8('0x2d')){_0x594e81[util[_0x6ca8('0x14')](_0x6ca8('0x2e'),_0x6ca8('0x2f'),_[_0x6ca8('0x30')](_0x55e6a9))]=_0x579a70[_0x6ca8('0x2a')][_0x55e6a9];}}}}return _0x594e81;};exports[_0x6ca8('0x31')]=function(_0x22ae2f){var _0x38f807={};for(var _0xb76c46 in _0x22ae2f){if(_0x22ae2f['hasOwnProperty'](_0xb76c46)){_0x38f807[util[_0x6ca8('0x14')]('%s',_[_0x6ca8('0x32')](_0xb76c46))]=_0x22ae2f[_0xb76c46];}}return{'variables':_0x38f807};};exports['updateOriginated']=function(_0x3dabcb,_0xd522b2){if(!_[_0x6ca8('0x18')](_0x3dabcb)){if(_0x3dabcb['hasOwnProperty'](_0x6ca8('0x33'))){if(_0x3dabcb[_0x6ca8('0x33')]>0x0){_0x3dabcb[_0x6ca8('0x33')]-=0x1;}else{logger[_0x6ca8('0xb')](_0x6ca8('0x34'),_0xd522b2);}}}else{logger[_0x6ca8('0xb')](_0x6ca8('0x35'),_0xd522b2);}};exports[_0x6ca8('0x36')]=function(_0xf4f104){var _0x386aa9=moment()[_0x6ca8('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0xf4f104['state']=0xd;_0xf4f104[_0x6ca8('0x37')]=_0x6ca8('0x38');_0xf4f104[_0x6ca8('0x39')]=_0x386aa9;_0xf4f104['responsetime']=_0x386aa9;_0xf4f104[_0x6ca8('0x3a')]=_0x386aa9;};exports['logAgent']=function(_0x60b655,_0x2e32a0,_0x298c99){var _0x53d59c=moment()[_0x6ca8('0x14')](_0x6ca8('0x3b'));_0x60b655[_0x6ca8('0x3c')]=_0x2e32a0;_0x60b655[_0x6ca8('0x37')]=_0x298c99;_0x60b655[_0x6ca8('0x3d')]=_0x53d59c;_0x60b655[_0x6ca8('0x3e')]=getSeconds(_0x60b655['responsetime'],_0x60b655['starttime']);};exports[_0x6ca8('0x3f')]=function(_0x3cccfa,_0x218bf1,_0x3b3cb0){_0x3cccfa[_0x6ca8('0x40')]=_0x218bf1;_0x3cccfa[_0x6ca8('0x41')]=_0x3b3cb0;};exports[_0x6ca8('0x42')]=function(_0x1178af,_0x3fc49a,_0x3556a7){var _0x3cb933=moment()['format'](_0x6ca8('0x3b'));_0x1178af[_0x6ca8('0x3c')]=_0x3fc49a;_0x1178af[_0x6ca8('0x37')]=_0x3556a7;_0x1178af[_0x6ca8('0x3d')]=_0x1178af['responsetime']?_0x1178af[_0x6ca8('0x3d')]:_0x3cb933;_0x1178af['endtime']=_0x1178af[_0x6ca8('0x3a')]?_0x1178af['endtime']:_0x3cb933;_0x1178af[_0x6ca8('0x3e')]=getSeconds(_0x1178af[_0x6ca8('0x3d')]||0x0,_0x1178af[_0x6ca8('0x39')]||0x0);_0x1178af[_0x6ca8('0x43')]=_0x1178af[_0x6ca8('0x44')]?getSeconds(_0x1178af['endtime'],_0x1178af[_0x6ca8('0x44')]):0x0;};exports[_0x6ca8('0x45')]=function(_0x45eff5){return _0x45eff5===_0x6ca8('0x46');};exports[_0x6ca8('0x47')]=function(_0x3e0d35,_0x1963ae,_0x3f7f53,_0x328f9e,_0x3dc155){var _0x92bc5e=_0x328f9e?_0x6ca8('0x48'):_0x3e0d35[_0x6ca8('0x1b')];_0x92bc5e=_0x3dc155?'BOOKED':_0x92bc5e;return{'actionid':_0x3e0d35[_0x6ca8('0x49')],'action':_0x6ca8('0x4a'),'channel':_0x3e0d35[_0x6ca8('0x4b')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x92bc5e,_0x3e0d35[_0x6ca8('0x4c')]),'Exten':_0x6ca8('0x26'),'Context':_0x6ca8('0x4d'),'Priority':'1','variable':_0x3f7f53,'timeout':(_0x1963ae[_0x6ca8('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e0d35['uniqueid']};};exports[_0x6ca8('0x4f')]=function(_0x5a1156){return _0x5a1156[_0x6ca8('0x50')]+_0x5a1156[_0x6ca8('0x51')]+_0x5a1156['countnoanswerretry']+_0x5a1156['countagentrejectretry']+_0x5a1156[_0x6ca8('0x52')];};exports[_0x6ca8('0x53')]=function(_0x521077){var _0x1a9ec7=_[_0x6ca8('0x54')](_0x521077);_0x1a9ec7[_0x6ca8('0x3c')]=0xf;_0x1a9ec7['statedesc']=_0x6ca8('0x55');return _0x1a9ec7;};exports[_0x6ca8('0x56')]=function(_0x3d5f4b,_0x184038,_0x200630){var _0x5e4658={};_0x5e4658[_0x184038]=_0x3d5f4b[_0x184038];_0x5e4658['active']=![];_0x5e4658['scheduledat']=moment()[_0x6ca8('0x57')](_0x200630,'minutes')[_0x6ca8('0x14')](_0x6ca8('0x3b'));_0x5e4658[_0x6ca8('0x1c')]=_0x3d5f4b['ContactId'];_0x5e4658[_0x6ca8('0x58')]=_0x3d5f4b[_0x6ca8('0x58')];_0x5e4658['VoiceQueueId']=_0x3d5f4b[_0x6ca8('0x59')]||undefined;return _0x5e4658;};exports[_0x6ca8('0x5a')]=function(_0x362c91,_0x3a895b){if(!_[_0x6ca8('0x18')](_0x362c91)){if(_0x362c91[_0x6ca8('0x5b')]>0x0){_0x362c91[_0x6ca8('0x5b')]-=0x1;}else{logger['error'](_0x3a895b,_0x6ca8('0x5c'));}}else{logger[_0x6ca8('0xb')](_0x3a895b,_0x6ca8('0x5d'));}};exports[_0x6ca8('0x5e')]=function(_0x3d36ae){if(_0x3d36ae<=0x0){return!![];}return![];};exports[_0x6ca8('0x5f')]=function(_0x2bc0a9,_0x1a2dc3,_0x386268){_0x2bc0a9[_0x6ca8('0x60')]=_0x1a2dc3;_0x2bc0a9['name']=_0x2bc0a9[_0x6ca8('0x61')];_0x2bc0a9['interface']=_0x2bc0a9[_0x6ca8('0x4b')];_0x2bc0a9[_0x6ca8('0x62')]='voice';if(_0x386268){_0x2bc0a9[_0x6ca8('0x63')]=_0x386268[_0x6ca8('0x63')];}return _0x2bc0a9;};exports[_0x6ca8('0x64')]=function(_0x58e939){var _0x50326e={};_0x50326e['queue']=_0x58e939['queue'];_0x50326e[_0x6ca8('0x65')]=_0x58e939['channelAgent'];_0x50326e[_0x6ca8('0x49')]=_0x58e939[_0x6ca8('0x49')];return _0x50326e;};exports[_0x6ca8('0x66')]=function(_0x4f11f6){var _0x34cd85=[];for(var _0x5c2db2 in _0x4f11f6){if(_0x4f11f6[_0x6ca8('0x2b')](_0x5c2db2)){if(!_['isNil'](_0x4f11f6[_0x5c2db2])&&_0x4f11f6[_0x5c2db2][_0x6ca8('0x3c')]===_0x6ca8('0x67')&&_0x4f11f6[_0x5c2db2][_0x6ca8('0x68')]===_0x6ca8('0x69')){_0x34cd85['push'](_0x4f11f6[_0x5c2db2]['id']);}}}return _0x34cd85;};exports['getDiff']=function(_0x447e05){var _0x6419ec=moment()[_0x6ca8('0x6a')](0x0);var _0x382b00=moment(_0x447e05)[_0x6ca8('0x6a')](0x0);return _0x6419ec['diff'](_0x382b00,'seconds');};exports[_0x6ca8('0x6b')]=function(_0x56c746){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x56c746[_0x6ca8('0x1c')],'ListId':_0x56c746[_0x6ca8('0x58')],'VoiceQueueId':_0x56c746[_0x6ca8('0x59')]||undefined,'CampaignId':_0x56c746[_0x6ca8('0x6c')]||undefined};};exports[_0x6ca8('0x6d')]=function(_0x1f1a34){if(_0x1f1a34==='uniqueid'||_0x1f1a34===_0x6ca8('0x6e')||_0x1f1a34===_0x6ca8('0x61')||_0x1f1a34===_0x6ca8('0x6f')||_0x1f1a34===_0x6ca8('0x70')||_0x1f1a34==='dialAnswer'||_0x1f1a34===_0x6ca8('0x40')||_0x1f1a34===_0x6ca8('0x4b')||_0x1f1a34===_0x6ca8('0x1b')||_0x1f1a34==='active'||_0x1f1a34===_0x6ca8('0x4c')||_0x1f1a34===_0x6ca8('0x71')||_0x1f1a34==='countbusyretry'||_0x1f1a34===_0x6ca8('0x51')||_0x1f1a34===_0x6ca8('0x72')||_0x1f1a34===_0x6ca8('0x73')||_0x1f1a34===_0x6ca8('0x74')||_0x1f1a34===_0x6ca8('0x75')||_0x1f1a34==='callbackat'||_0x1f1a34==='recallme'||_0x1f1a34==='ContactId'||_0x1f1a34===_0x6ca8('0x58')||_0x1f1a34===_0x6ca8('0x41')||_0x1f1a34===_0x6ca8('0x59')||_0x1f1a34===_0x6ca8('0x76')||_0x1f1a34===_0x6ca8('0x77')||_0x1f1a34==='xmd-queue'||_0x1f1a34===_0x6ca8('0x78')||_0x1f1a34===_0x6ca8('0x79')||_0x1f1a34==='xmd-dialurl'||_0x1f1a34===_0x6ca8('0x7a')||_0x1f1a34===_0x6ca8('0x7b')||_0x1f1a34===_0x6ca8('0x7c')||_0x1f1a34===_0x6ca8('0x7d')||_0x1f1a34===_0x6ca8('0x7e')||_0x1f1a34===_0x6ca8('0x7f')||_0x1f1a34===_0x6ca8('0x80')||_0x1f1a34==='xmd-agiafter'||_0x1f1a34===_0x6ca8('0x81')||_0x1f1a34===_0x6ca8('0x82')||_0x1f1a34===_0x6ca8('0x83')||_0x1f1a34===_0x6ca8('0x84')||_0x1f1a34===_0x6ca8('0x85')||_0x1f1a34===_0x6ca8('0x86')||_0x1f1a34==='rtpaudioqoslossbridged'||_0x1f1a34===_0x6ca8('0x87')||_0x1f1a34===_0x6ca8('0x88')||_0x1f1a34==='rtpaudioqos'||_0x1f1a34===_0x6ca8('0x83')||_0x1f1a34==='rtpaudioqosjitter'||_0x1f1a34===_0x6ca8('0x85')||_0x1f1a34==='rtpaudioqosloss'||_0x1f1a34===_0x6ca8('0x89')||_0x1f1a34===_0x6ca8('0x87')||_0x1f1a34===_0x6ca8('0x88')||_0x1f1a34===_0x6ca8('0x8a')||_0x1f1a34==='bridgepvtcallid'||_0x1f1a34===_0x6ca8('0x3c')||_0x1f1a34===_0x6ca8('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2cd496,_0x75c6c5){var _0x4b4c48,_0x4c25e7,_0x557bf1;if(_0x75c6c5<=0x0){_0x75c6c5=0x1;}_0x4b4c48=new RegExp('\x5cw{0,'+_0x75c6c5+'}$');_0x4c25e7=Math[_0x6ca8('0x8b')](0xa,_0x75c6c5-0x1);_0x557bf1=Math[_0x6ca8('0x8b')](0xa,_0x75c6c5)-0x1;return util[_0x6ca8('0x14')]('%s',_[_0x6ca8('0x8c')](_0x2cd496,_0x4b4c48,_[_0x6ca8('0x8d')](_0x4c25e7,_0x557bf1)));};exports[_0x6ca8('0x8e')]=function(_0x4c4409){var _0x2927da=_0x4c4409[_0x6ca8('0x8f')](/"(.*?)"/);return _0x2927da?_0x2927da[0x1]:_0x4c4409;};exports[_0x6ca8('0x90')]=function(_0x47f5b1){var _0x293c6c=_0x47f5b1[_0x6ca8('0x8f')](/<(.*?)>/);return _0x293c6c?_0x293c6c[0x1]:_0x47f5b1;}; \ No newline at end of file +var _0x2c81=['string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','voice','mandatoryDisposition','not_inuse','status','reachable','push','createBody','filterKey','uniqueid','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','error','logger2','message','isUndefined'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2c81,0x190));var _0x12c8=function(_0x281ee3,_0x3c3f1b){_0x281ee3=_0x281ee3-0x0;var _0x497c51=_0x2c81[_0x281ee3];return _0x497c51;};'use strict';var util=require('util');var _=require(_0x12c8('0x0'));var moment=require(_0x12c8('0x1'));var logger=require(_0x12c8('0x2'))(_0x12c8('0x3'));var ipAgi=process[_0x12c8('0x4')][_0x12c8('0x5')]||'127.0.0.1';function getSeconds(_0x5d82ea,_0x1bd321){var _0x51a638=moment(_0x5d82ea)[_0x12c8('0x6')](0x0);var _0x36cf9c=moment(_0x1bd321)['milliseconds'](0x0);return _0x51a638[_0x12c8('0x7')](_0x36cf9c,_0x12c8('0x8'));}exports[_0x12c8('0x9')]=function(_0x1bed07){return function(_0x581c3f){logger['error'](_0x1bed07,util[_0x12c8('0xa')](_0x581c3f,{'showHidden':![],'depth':null}));};};exports[_0x12c8('0xb')]=function(_0x54f825,_0x193ec1){logger[_0x12c8('0xc')](_0x54f825,util[_0x12c8('0xa')](_0x193ec1,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1ae0e4,_0x126e52){logger[_0x12c8('0xd')](_0x1ae0e4,util['inspect'](_0x126e52,{'showHidden':![],'depth':null}));};exports[_0x12c8('0xe')]=function(_0x81aaab){return function(_0xc94be4){logger[_0x12c8('0xc')](_0x81aaab,util[_0x12c8('0xa')](_0xc94be4,{'showHidden':![],'depth':null}));};};exports[_0x12c8('0xf')]=function(_0x528bd7,_0x31051b,_0x3bbbd1){return{'message':_0x528bd7,'unlock':_0x31051b,'active':_0x3bbbd1};};exports['getCallerId']=function(_0xd053b2,_0x3d2e04,_0xaa84d2){if(!_[_0x12c8('0x10')](_0xaa84d2)&&_0x12c8('0x11')===typeof _0xaa84d2&&!_[_0x12c8('0x12')](_0xaa84d2)){if(!_[_0x12c8('0x10')](_0x3d2e04)&&_0x12c8('0x11')===typeof _0x3d2e04&&!_[_0x12c8('0x12')](_0x3d2e04)){return util['format'](_0x12c8('0x13'),_0x3d2e04,_0xaa84d2);}return util[_0x12c8('0x14')](_0x12c8('0x13'),_0xaa84d2,_0xaa84d2);}if(!_['isUndefined'](_0xd053b2)&&_0x12c8('0x11')===typeof _0xd053b2&&!_[_0x12c8('0x12')](_0xd053b2)){return _0xd053b2;}return _0x12c8('0x15');};exports[_0x12c8('0x16')]=function(_0x1169ba){if(_[_0x12c8('0x17')](_0x1169ba)){return![];}return _0x1169ba;};exports['addVariables']=function(_0x374ec9,_0x2200d6,_0x501956,_0x132193,_0x2f98df,_0x836324){var _0x3f3a24={'XMD-QUEUE':_0x2200d6[_0x12c8('0x18')]?_0x2200d6[_0x12c8('0x18')][_0x12c8('0x19')]:'','XMD-CALLERID':_0x132193,'XMD-CALLERID-PREVIEW':_0x836324?util[_0x12c8('0x14')](_0x12c8('0x13'),_0x836324[_0x12c8('0x1a')],_0x836324[_0x12c8('0x1b')]):_0x132193,'XMD-DIALID':_0x2f98df,'XMD-CONTACTID':_0x2200d6['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x132193,'XMD-VOICEQUEUEID':_0x2200d6[_0x12c8('0x1c')],'XMD-DIALCHANNEL':_0x501956,'XMD-DIALTIMEOUT':_0x374ec9[_0x12c8('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x12c8('0x14')]('\x22rtTxX%s%s\x22',_0x374ec9[_0x12c8('0x1e')]?'g':'',_[_0x12c8('0x12')](_0x374ec9['monitor_format'])?'':_0x12c8('0x1f')),'XMD-DIALURL':_0x374ec9['dialPreviewUrl']||'','XMD-AGI':_0x374ec9[_0x12c8('0x20')]?util[_0x12c8('0x14')](_0x12c8('0x21'),ipAgi,_0x374ec9['dialQueueProject']):_0x12c8('0x22'),'XMD-AGIAFTER':_0x374ec9[_0x12c8('0x1e')]?util['format'](_0x12c8('0x21'),ipAgi,_0x374ec9[_0x12c8('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x836324?_0x836324[_0x12c8('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x836324?_0x836324[_0x12c8('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x12c8('0x25')};if(!_[_0x12c8('0x12')](_0x374ec9[_0x12c8('0x26')])){_0x3f3a24[util[_0x12c8('0x14')]('%s',_0x12c8('0x27'))]=_0x374ec9[_0x12c8('0x26')];_0x3f3a24[util[_0x12c8('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2f98df;}if(_0x2200d6&&_0x2200d6[_0x12c8('0x28')]){for(var _0x1a702b in _0x2200d6['Contact']){if(_0x2200d6[_0x12c8('0x28')][_0x12c8('0x29')](_0x1a702b)){if(!_['isNil'](_0x2200d6[_0x12c8('0x28')][_0x1a702b])&&_0x1a702b!=='id'&&_0x1a702b!==_0x12c8('0x2a')&&_0x1a702b!==_0x12c8('0x2b')&&_0x1a702b!==_0x12c8('0x2c')){_0x3f3a24[util['format'](_0x12c8('0x2d'),'XMD-',_['toUpper'](_0x1a702b))]=_0x2200d6[_0x12c8('0x28')][_0x1a702b];}}}}return _0x3f3a24;};exports[_0x12c8('0x2e')]=function(_0x5a9a1f){var _0x3b833e={};for(var _0x4a9335 in _0x5a9a1f){if(_0x5a9a1f[_0x12c8('0x29')](_0x4a9335)){_0x3b833e[util[_0x12c8('0x14')]('%s',_['toLower'](_0x4a9335))]=_0x5a9a1f[_0x4a9335];}}return{'variables':_0x3b833e};};exports['updateOriginated']=function(_0x525367,_0x7518cc){if(!_[_0x12c8('0x17')](_0x525367)){if(_0x525367[_0x12c8('0x29')](_0x12c8('0x2f'))){if(_0x525367['originated']>0x0){_0x525367[_0x12c8('0x2f')]-=0x1;}else{logger[_0x12c8('0xd')](_0x12c8('0x30'),_0x7518cc);}}}else{logger[_0x12c8('0xd')](_0x12c8('0x31'),_0x7518cc);}};exports['logBlacklist']=function(_0x9882f1){var _0x41cac9=moment()[_0x12c8('0x14')](_0x12c8('0x32'));_0x9882f1[_0x12c8('0x33')]=0xd;_0x9882f1[_0x12c8('0x34')]='Blacklist';_0x9882f1['starttime']=_0x41cac9;_0x9882f1[_0x12c8('0x35')]=_0x41cac9;_0x9882f1[_0x12c8('0x36')]=_0x41cac9;};exports[_0x12c8('0x37')]=function(_0x569747,_0x1d1325,_0x3c9373){var _0x2fe9fb=moment()[_0x12c8('0x14')](_0x12c8('0x32'));_0x569747[_0x12c8('0x33')]=_0x1d1325;_0x569747[_0x12c8('0x34')]=_0x3c9373;_0x569747[_0x12c8('0x35')]=_0x2fe9fb;_0x569747[_0x12c8('0x38')]=getSeconds(_0x569747[_0x12c8('0x35')],_0x569747[_0x12c8('0x39')]);};exports[_0x12c8('0x3a')]=function(_0x35fbb6,_0x15c5f9,_0x138b73){_0x35fbb6[_0x12c8('0x3b')]=_0x15c5f9;_0x35fbb6['UserId']=_0x138b73;};exports[_0x12c8('0x3c')]=function(_0x4bf871,_0x1f25d7,_0x3105ea){var _0x3fc236=moment()[_0x12c8('0x14')](_0x12c8('0x32'));_0x4bf871[_0x12c8('0x33')]=_0x1f25d7;_0x4bf871[_0x12c8('0x34')]=_0x3105ea;_0x4bf871[_0x12c8('0x35')]=_0x4bf871[_0x12c8('0x35')]?_0x4bf871[_0x12c8('0x35')]:_0x3fc236;_0x4bf871['endtime']=_0x4bf871[_0x12c8('0x36')]?_0x4bf871[_0x12c8('0x36')]:_0x3fc236;_0x4bf871[_0x12c8('0x38')]=getSeconds(_0x4bf871['responsetime']||0x0,_0x4bf871[_0x12c8('0x39')]||0x0);_0x4bf871[_0x12c8('0x3d')]=_0x4bf871[_0x12c8('0x3e')]?getSeconds(_0x4bf871[_0x12c8('0x36')],_0x4bf871['answertime']):0x0;};exports[_0x12c8('0x3f')]=function(_0x1f1e65){return _0x1f1e65===_0x12c8('0x40');};exports[_0x12c8('0x41')]=function(_0x1b0b32,_0x2c6eb3,_0x22f9b2,_0x1cdc9b,_0x1ee6bd){var _0xf2e646=_0x1cdc9b?_0x12c8('0x42'):_0x1b0b32[_0x12c8('0x1a')];_0xf2e646=_0x1ee6bd?_0x12c8('0x43'):_0xf2e646;return{'actionid':_0x1b0b32['uniqueid'],'action':'originate','channel':_0x1b0b32[_0x12c8('0x44')],'callerid':util[_0x12c8('0x14')](_0x12c8('0x13'),_0xf2e646,_0x1b0b32[_0x12c8('0x1b')]),'Exten':_0x12c8('0x45'),'Context':_0x12c8('0x46'),'Priority':'1','variable':_0x22f9b2,'timeout':(_0x2c6eb3[_0x12c8('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b0b32['uniqueid']};};exports[_0x12c8('0x48')]=function(_0x3bb728){return _0x3bb728[_0x12c8('0x49')]+_0x3bb728[_0x12c8('0x4a')]+_0x3bb728[_0x12c8('0x4b')]+_0x3bb728[_0x12c8('0x4c')]+_0x3bb728[_0x12c8('0x4d')];};exports['cloneAction']=function(_0x42af10){var _0x454dc0=_[_0x12c8('0x4e')](_0x42af10);_0x454dc0['state']=0xf;_0x454dc0[_0x12c8('0x34')]=_0x12c8('0x4f');return _0x454dc0;};exports[_0x12c8('0x50')]=function(_0x2b4624,_0x2d88e0,_0x326682){var _0x32d130={};_0x32d130[_0x2d88e0]=_0x2b4624[_0x2d88e0];_0x32d130[_0x12c8('0x51')]=![];_0x32d130[_0x12c8('0x52')]=moment()[_0x12c8('0x53')](_0x326682,_0x12c8('0x54'))[_0x12c8('0x14')](_0x12c8('0x32'));_0x32d130[_0x12c8('0x55')]=_0x2b4624['ContactId'];_0x32d130[_0x12c8('0x56')]=_0x2b4624['ListId'];_0x32d130[_0x12c8('0x1c')]=_0x2b4624[_0x12c8('0x1c')]||undefined;return _0x32d130;};exports['decrementTalkink']=function(_0x5aad6c,_0x188e2f){if(!_[_0x12c8('0x17')](_0x5aad6c)){if(_0x5aad6c[_0x12c8('0x57')]>0x0){_0x5aad6c[_0x12c8('0x57')]-=0x1;}else{logger[_0x12c8('0xd')](_0x188e2f,_0x12c8('0x58'));}}else{logger[_0x12c8('0xd')](_0x188e2f,_0x12c8('0x59'));}};exports[_0x12c8('0x5a')]=function(_0x517284){if(_0x517284<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1d2088,_0x416f5a,_0x494acb){_0x1d2088[_0x12c8('0x5b')]=_0x416f5a;_0x1d2088[_0x12c8('0x19')]=_0x1d2088[_0x12c8('0x5c')];_0x1d2088['interface']=_0x1d2088[_0x12c8('0x44')];_0x1d2088['motionChannel']=_0x12c8('0x5d');if(_0x494acb){_0x1d2088['mandatoryDisposition']=_0x494acb[_0x12c8('0x5e')];}return _0x1d2088;};exports['buildAcw']=function(_0x3c4874){var _0x2ef2fc={};_0x2ef2fc[_0x12c8('0x5c')]=_0x3c4874[_0x12c8('0x5c')];_0x2ef2fc['interface']=_0x3c4874[_0x12c8('0x44')];_0x2ef2fc['uniqueid']=_0x3c4874['uniqueid'];return _0x2ef2fc;};exports['agentReadyId']=function(_0x5b3e3f){var _0x510de5=[];for(var _0x835626 in _0x5b3e3f){if(_0x5b3e3f[_0x12c8('0x29')](_0x835626)){if(!_[_0x12c8('0x17')](_0x5b3e3f[_0x835626])&&_0x5b3e3f[_0x835626][_0x12c8('0x33')]===_0x12c8('0x5f')&&_0x5b3e3f[_0x835626][_0x12c8('0x60')]===_0x12c8('0x61')){_0x510de5[_0x12c8('0x62')](_0x5b3e3f[_0x835626]['id']);}}}return _0x510de5;};exports['getDiff']=function(_0x2b4b1d){var _0x3bdfbf=moment()[_0x12c8('0x6')](0x0);var _0x4245dc=moment(_0x2b4b1d)[_0x12c8('0x6')](0x0);return _0x3bdfbf[_0x12c8('0x7')](_0x4245dc,_0x12c8('0x8'));};exports[_0x12c8('0x63')]=function(_0x572ea8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x572ea8[_0x12c8('0x55')],'ListId':_0x572ea8[_0x12c8('0x56')],'VoiceQueueId':_0x572ea8[_0x12c8('0x1c')]||undefined,'CampaignId':_0x572ea8['CampaignId']||undefined};};exports[_0x12c8('0x64')]=function(_0x3f6348){if(_0x3f6348===_0x12c8('0x65')||_0x3f6348===_0x12c8('0x66')||_0x3f6348===_0x12c8('0x5c')||_0x3f6348===_0x12c8('0x67')||_0x3f6348===_0x12c8('0x68')||_0x3f6348===_0x12c8('0x69')||_0x3f6348==='membername'||_0x3f6348===_0x12c8('0x44')||_0x3f6348===_0x12c8('0x1a')||_0x3f6348===_0x12c8('0x51')||_0x3f6348==='calleridnum'||_0x3f6348==='scheduledat'||_0x3f6348===_0x12c8('0x49')||_0x3f6348===_0x12c8('0x4a')||_0x3f6348===_0x12c8('0x4b')||_0x3f6348===_0x12c8('0x6a')||_0x3f6348===_0x12c8('0x6b')||_0x3f6348===_0x12c8('0x6c')||_0x3f6348===_0x12c8('0x6d')||_0x3f6348===_0x12c8('0x6e')||_0x3f6348==='ContactId'||_0x3f6348==='ListId'||_0x3f6348===_0x12c8('0x6f')||_0x3f6348===_0x12c8('0x1c')||_0x3f6348===_0x12c8('0x70')||_0x3f6348==='xmd-voicequeueid'||_0x3f6348===_0x12c8('0x71')||_0x3f6348===_0x12c8('0x72')||_0x3f6348===_0x12c8('0x73')||_0x3f6348==='xmd-dialurl'||_0x3f6348===_0x12c8('0x74')||_0x3f6348===_0x12c8('0x75')||_0x3f6348===_0x12c8('0x76')||_0x3f6348===_0x12c8('0x77')||_0x3f6348==='xmd-contactid'||_0x3f6348===_0x12c8('0x78')||_0x3f6348===_0x12c8('0x79')||_0x3f6348===_0x12c8('0x7a')||_0x3f6348===_0x12c8('0x7b')||_0x3f6348===_0x12c8('0x7c')||_0x3f6348===_0x12c8('0x7d')||_0x3f6348===_0x12c8('0x7e')||_0x3f6348===_0x12c8('0x7f')||_0x3f6348===_0x12c8('0x80')||_0x3f6348===_0x12c8('0x81')||_0x3f6348===_0x12c8('0x82')||_0x3f6348===_0x12c8('0x83')||_0x3f6348===_0x12c8('0x7c')||_0x3f6348==='rtpaudioqosbridged'||_0x3f6348===_0x12c8('0x7e')||_0x3f6348===_0x12c8('0x7f')||_0x3f6348===_0x12c8('0x80')||_0x3f6348===_0x12c8('0x81')||_0x3f6348===_0x12c8('0x82')||_0x3f6348===_0x12c8('0x83')||_0x3f6348===_0x12c8('0x84')||_0x3f6348===_0x12c8('0x85')||_0x3f6348===_0x12c8('0x33')||_0x3f6348==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x463393,_0x3b60fb){var _0x10b736,_0x16bc95,_0x559887;if(_0x3b60fb<=0x0){_0x3b60fb=0x1;}_0x10b736=new RegExp(_0x12c8('0x86')+_0x3b60fb+'}$');_0x16bc95=Math[_0x12c8('0x87')](0xa,_0x3b60fb-0x1);_0x559887=Math[_0x12c8('0x87')](0xa,_0x3b60fb)-0x1;return util[_0x12c8('0x14')]('%s',_[_0x12c8('0x88')](_0x463393,_0x10b736,_['random'](_0x16bc95,_0x559887)));};exports[_0x12c8('0x89')]=function(_0x5f29aa){var _0x575264=_0x5f29aa[_0x12c8('0x8a')](/"(.*?)"/);return _0x575264?_0x575264[0x1]:_0x5f29aa;};exports['extractCalleridNumber']=function(_0x5b3fd9){var _0x4e279e=_0x5b3fd9[_0x12c8('0x8a')](/<(.*?)>/);return _0x4e279e?_0x4e279e[0x1]:_0x5b3fd9;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2b0f742..f7a77e8 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 _0x874d=['queueremove','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','boolean'];(function(_0x142edf,_0x54f41e){var _0x35b53a=function(_0x1ae227){while(--_0x1ae227){_0x142edf['push'](_0x142edf['shift']());}};_0x35b53a(++_0x54f41e);}(_0x874d,0x1e8));var _0xd874=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x874d[_0x3b76f7];return _0x43984e;};'use strict';exports['queueadd']={'queue':{'type':_0xd874('0x0'),'required':!![]},'interface':{'type':_0xd874('0x0'),'required':!![]},'membername':{'type':_0xd874('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xd874('0x1'),'required':![]}};exports[_0xd874('0x2')]={'queue':{'type':_0xd874('0x0'),'required':!![]},'interface':{'type':_0xd874('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xd874('0x0'),'required':!![]},'paused':{'type':_0xd874('0x1')},'reason':{'type':_0xd874('0x0'),'required':![]}};exports[_0xd874('0x3')]={'module':{'type':_0xd874('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xd874('0x0'),'required':!![]}};exports[_0xd874('0x4')]={'uniqueid':{'type':_0xd874('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xd874('0x0')}};exports[_0xd874('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd874('0x6')]={'uniqueid':{'type':_0xd874('0x0'),'required':!![]},'exten':{'type':_0xd874('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xfe97=['queuepause','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x4aaff3,_0x18b012){var _0x3a20f3=function(_0x550df8){while(--_0x550df8){_0x4aaff3['push'](_0x4aaff3['shift']());}};_0x3a20f3(++_0x18b012);}(_0xfe97,0x140));var _0x7fe9=function(_0x378771,_0x3e0dc8){_0x378771=_0x378771-0x0;var _0x3834da=_0xfe97[_0x378771];return _0x3834da;};'use strict';exports[_0x7fe9('0x0')]={'queue':{'type':_0x7fe9('0x1'),'required':!![]},'interface':{'type':_0x7fe9('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x7fe9('0x2'),'required':![]}};exports[_0x7fe9('0x3')]={'queue':{'type':_0x7fe9('0x1'),'required':!![]},'interface':{'type':_0x7fe9('0x1'),'required':!![]}};exports[_0x7fe9('0x4')]={'interface':{'type':_0x7fe9('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x7fe9('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x7fe9('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7fe9('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x7fe9('0x1')},'format':{'type':_0x7fe9('0x1')},'mixmonitorid':{'type':_0x7fe9('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x7fe9('0x1'),'required':!![]}};exports[_0x7fe9('0x5')]={'uniqueid':{'type':_0x7fe9('0x1'),'required':!![]},'exten':{'type':_0x7fe9('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3b72d69..40332f8 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 _0x3ea1=['dialQueueProject','SquareProject','initFaxAccounts','exports','util','lodash','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','agents','length','SIP/%s','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','duration','disposition','billableseconds','initCampaigns'];(function(_0x309b59,_0x4eceb6){var _0x369c42=function(_0x1f3a2f){while(--_0x1f3a2f){_0x309b59['push'](_0x309b59['shift']());}};_0x369c42(++_0x4eceb6);}(_0x3ea1,0x1ac));var _0x13ea=function(_0x4c1e1b,_0x4d6411){_0x4c1e1b=_0x4c1e1b-0x0;var _0xc0a3f=_0x3ea1[_0x4c1e1b];return _0xc0a3f;};'use strict';var BPromise=require('bluebird');var util=require(_0x13ea('0x0'));var _=require(_0x13ea('0x1'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x13ea('0x2'));var VoiceQueue=require(_0x13ea('0x3'));var Trigger=require(_0x13ea('0x4'));var Template=require(_0x13ea('0x5'));var Campaign=require(_0x13ea('0x6'));var VoiceExtension=require(_0x13ea('0x7'));var ZendeskAccount=require(_0x13ea('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x13ea('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x13ea('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x13ea('0xb'));var ServicenowAccount=require(_0x13ea('0xc'));var Dynamics365Account=require(_0x13ea('0xd'));var FreshsalesAccount=require(_0x13ea('0xe'));var FaxAccount=require(_0x13ea('0xf'));var Realtime=function(){this['agents']={};this[_0x13ea('0x10')]={};this[_0x13ea('0x11')]={};this[_0x13ea('0x12')]={};this[_0x13ea('0x13')]={};this[_0x13ea('0x14')]={};this[_0x13ea('0x15')]={};this[_0x13ea('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x13ea('0x17')]={};this[_0x13ea('0x18')]={};this[_0x13ea('0x19')]={};this[_0x13ea('0x1a')]={};this['timers']={};this[_0x13ea('0x1b')]={};this[_0x13ea('0x1c')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x13ea('0x1d')]={};this[_0x13ea('0x1e')]={};this[_0x13ea('0x1f')]={};this[_0x13ea('0x20')]={};this['servicenowAccounts']={};this[_0x13ea('0x21')]={};this[_0x13ea('0x22')]={};this[_0x13ea('0x23')]={};};function freeIsNotKey(_0x556cc5,_0x3f25a5,_0x40d825){var _0x36c4e5=_[_0x13ea('0x24')](_0x556cc5,function(_0x3fb461,_0x2ddf9d){return _0x3fb461[_0x40d825];});for(var _0x23503e in _0x3f25a5){if(_0x3f25a5[_0x13ea('0x25')](_0x23503e)){if(!_0x36c4e5[_0x23503e]){delete _0x3f25a5[_0x23503e];}}}}function freeIsNotKeySip(_0x387819,_0x50e625){var _0x3ab021=_['mapKeys'](_0x387819,function(_0x54547a,_0x17c5b4){return util[_0x13ea('0x26')]('SIP/%s',_0x54547a[_0x13ea('0x27')]);});for(var _0x150bb2 in _0x50e625){if(_0x50e625[_0x13ea('0x25')](_0x150bb2)){if(!_0x3ab021[_0x150bb2]){delete _0x50e625[_0x150bb2];}}}}function freeIsNotKeyAgent(_0x578ab5,_0x4e8c6d){var _0x24d31c=_[_0x13ea('0x24')](_0x578ab5,function(_0x308ae7,_0x51e25a){var _0x39022b=_[_0x13ea('0x28')](_0x308ae7[_0x13ea('0x29')])?util['format']('SIP/%s',_0x308ae7[_0x13ea('0x27')]):_0x308ae7[_0x13ea('0x29')];return _0x39022b;});for(var _0x53664e in _0x4e8c6d){if(_0x4e8c6d[_0x13ea('0x25')](_0x53664e)){if(!_0x24d31c[_0x53664e]){delete _0x4e8c6d[_0x53664e];}}}}function clearVoiceCallReports(_0x4f4264){_0x4f4264[_0x13ea('0x2a')]=0x0;_0x4f4264[_0x13ea('0x2b')]=0x0;_0x4f4264[_0x13ea('0x2c')]=0x0;_0x4f4264[_0x13ea('0x2d')]=0x0;_0x4f4264[_0x13ea('0x2e')]=0x0;}function clearCampaigns(_0x1c9002){if(!_['isEmpty'](_0x1c9002)){for(var _0x470cb1 in _0x1c9002){if(_0x1c9002[_0x13ea('0x25')](_0x470cb1)){_0x1c9002[_0x470cb1][_0x13ea('0x2f')]=0x0;_0x1c9002[_0x470cb1][_0x13ea('0x30')]=0x0;}}}}function clearVoiceQueues(_0x108f2f){if(!_['isEmpty'](_0x108f2f)){for(var _0x1a1ee9 in _0x108f2f){if(_0x108f2f[_0x13ea('0x25')](_0x1a1ee9)){_0x108f2f[_0x1a1ee9][_0x13ea('0x2a')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x2b')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x31')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x32')]=0x0;_0x108f2f[_0x1a1ee9]['sumHoldTime']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x2d')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x2e')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x33')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x34')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x35')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x36')]=0x0;_0x108f2f[_0x1a1ee9]['outboundNoSuchCallsDay']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x37')]=0x0;_0x108f2f[_0x1a1ee9]['outboundDropCallsDayTimeout']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x38')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x39')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x3a')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x3b')]=0x0;_0x108f2f[_0x1a1ee9]['outboundReCallsDay']=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x33')]=0x0;_0x108f2f[_0x1a1ee9][_0x13ea('0x3c')]=0x0;_0x108f2f[_0x1a1ee9]['queueStatusComplete']=!![];}}}}Realtime[_0x13ea('0x3d')][_0x13ea('0x3e')]=function(_0x38dd10,_0x200781){for(var _0x347e22 in _0x200781){if(_0x38dd10[_0x13ea('0x25')](_0x347e22)){_0x38dd10[_0x347e22]=_0x200781[_0x347e22];}}};Realtime[_0x13ea('0x3d')][_0x13ea('0x3f')]=function(){var _0x5f5b6f=this;return function(_0x1e5a6f){if(_0x1e5a6f){freeIsNotKeyAgent(_0x1e5a6f,_0x5f5b6f[_0x13ea('0x40')]);for(var _0x56cb1c=0x0,_0x151979={},_0x1fb293={};_0x56cb1c<_0x1e5a6f[_0x13ea('0x41')];_0x56cb1c+=0x1){_0x151979=_0x1e5a6f[_0x56cb1c];var _0x2c293a=_[_0x13ea('0x28')](_0x151979[_0x13ea('0x29')])?util[_0x13ea('0x26')](_0x13ea('0x42'),_0x151979[_0x13ea('0x27')]):_0x151979[_0x13ea('0x29')];if(_[_0x13ea('0x43')](_0x5f5b6f['agents'][_0x2c293a])){_0x5f5b6f[_0x13ea('0x40')][_0x2c293a]=new Agent(_0x151979);}else{_0x5f5b6f['mergeFromDatabase'](_0x5f5b6f[_0x13ea('0x40')][_0x2c293a],_0x151979);}}}return _0x5f5b6f[_0x13ea('0x40')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x44')]=function(){var _0x3a38bc=this;return function(_0x126b6c){if(_0x126b6c){freeIsNotKeySip(_0x126b6c,_0x3a38bc[_0x13ea('0x10')]);for(var _0x3cf50d=0x0,_0x51a301={},_0x46d0a6={};_0x3cf50d<_0x126b6c[_0x13ea('0x41')];_0x3cf50d+=0x1){_0x51a301=_0x126b6c[_0x3cf50d];if(_[_0x13ea('0x43')](_0x3a38bc[_0x13ea('0x10')][util[_0x13ea('0x26')]('SIP/%s',_0x51a301[_0x13ea('0x27')])])){_0x3a38bc['telephones'][util['format'](_0x13ea('0x42'),_0x51a301['name'])]=new Telephone(_0x51a301);}else{_0x3a38bc['mergeFromDatabase'](_0x3a38bc[_0x13ea('0x10')][util[_0x13ea('0x26')]('SIP/%s',_0x51a301[_0x13ea('0x27')])],_0x51a301);}}}return _0x3a38bc[_0x13ea('0x10')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x45')]=function(){var _0x2ea315=this;return function(_0x3da83e){if(_0x3da83e){freeIsNotKeySip(_0x3da83e,_0x2ea315[_0x13ea('0x11')]);for(var _0x471bca=0x0,_0x3679e2={},_0x48c3db={};_0x471bca<_0x3da83e[_0x13ea('0x41')];_0x471bca+=0x1){_0x3679e2=_0x3da83e[_0x471bca];if(_[_0x13ea('0x43')](_0x2ea315['trunks'][util['format']('SIP/%s',_0x3679e2[_0x13ea('0x27')])])){_0x2ea315[_0x13ea('0x11')][util[_0x13ea('0x26')](_0x13ea('0x42'),_0x3679e2[_0x13ea('0x27')])]=new Trunk(_0x3679e2);}else{_0x2ea315['mergeFromDatabase'](_0x2ea315[_0x13ea('0x11')][util[_0x13ea('0x26')](_0x13ea('0x42'),_0x3679e2[_0x13ea('0x27')])],_0x3679e2);}}}return _0x2ea315['trunks'];};};Realtime['prototype'][_0x13ea('0x46')]=function(){var _0x2fa7d8=this;return function(_0x280159){if(_0x280159){freeIsNotKey(_0x280159,_0x2fa7d8['voiceQueues'],'name');for(var _0x101e7b=0x0,_0x11ec4e={},_0x35b625={};_0x101e7b<_0x280159[_0x13ea('0x41')];_0x101e7b+=0x1){_0x11ec4e=_0x280159[_0x101e7b];if(_[_0x13ea('0x43')](_0x2fa7d8[_0x13ea('0x12')][_0x11ec4e[_0x13ea('0x27')]])){_0x2fa7d8['voiceQueues'][_0x11ec4e['name']]=new VoiceQueue(_0x11ec4e);}else{_0x2fa7d8[_0x13ea('0x3e')](_0x2fa7d8[_0x13ea('0x12')][_0x11ec4e[_0x13ea('0x27')]],_0x11ec4e);}}}return _0x2fa7d8['voiceQueues'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x47')]=function(){var _0x513651=this;return function(_0x1f8996){if(_0x1f8996){freeIsNotKey(_0x1f8996,_0x513651[_0x13ea('0x13')],'id');for(var _0x36a862=0x0,_0x178517={},_0x451bc3={};_0x36a862<_0x1f8996[_0x13ea('0x41')];_0x36a862+=0x1){_0x178517=_0x1f8996[_0x36a862];if(_[_0x13ea('0x43')](_0x513651[_0x13ea('0x13')][_0x178517['id']])){_0x513651[_0x13ea('0x13')][_0x178517['id']]=new Trigger(_0x178517);}else{_0x513651[_0x13ea('0x3e')](_0x513651[_0x13ea('0x13')][_0x178517['id']],_0x178517);}}}return _0x513651['triggers'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x48')]=function(){var _0x452f23=this;return function(_0x2190e4){if(_0x2190e4){freeIsNotKey(_0x2190e4,_0x452f23[_0x13ea('0x15')],'id');for(var _0x48a10f=0x0,_0x46fcc2={},_0xc29b93={};_0x48a10f<_0x2190e4['length'];_0x48a10f+=0x1){_0x46fcc2=_0x2190e4[_0x48a10f];if(_['isUndefined'](_0x452f23[_0x13ea('0x15')][_0x46fcc2['id']])){_0x452f23[_0x13ea('0x15')][_0x46fcc2['id']]=new Template(_0x46fcc2);}else{_0x452f23[_0x13ea('0x3e')](_0x452f23[_0x13ea('0x15')][_0x46fcc2['id']],_0x46fcc2);}}}return _0x452f23[_0x13ea('0x15')];};};Realtime[_0x13ea('0x3d')]['initZendeskAccounts']=function(){var _0x2a2ee3=this;return function(_0x21a807){if(_0x21a807){freeIsNotKey(_0x21a807,_0x2a2ee3['zendeskAccounts'],'id');for(var _0x3eddc8=0x0,_0x3e44ed={},_0x25e179={};_0x3eddc8<_0x21a807['length'];_0x3eddc8+=0x1){_0x3e44ed=_0x21a807[_0x3eddc8];if(_[_0x13ea('0x43')](_0x2a2ee3[_0x13ea('0x1c')][_0x3e44ed['id']])){_0x2a2ee3['zendeskAccounts'][_0x3e44ed['id']]=new ZendeskAccount(_0x3e44ed);}else{_0x2a2ee3[_0x13ea('0x3e')](_0x2a2ee3[_0x13ea('0x1c')][_0x3e44ed['id']],_0x3e44ed);}}}return _0x2a2ee3['zendeskAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x49')]=function(){var _0x34fbd7=this;return function(_0x8ca180){if(_0x8ca180){freeIsNotKey(_0x8ca180,_0x34fbd7['salesforceAccounts'],'id');for(var _0x7a5027=0x0,_0x42b77f={},_0x4755e5={};_0x7a5027<_0x8ca180[_0x13ea('0x41')];_0x7a5027+=0x1){_0x42b77f=_0x8ca180[_0x7a5027];if(_['isUndefined'](_0x34fbd7[_0x13ea('0x4a')][_0x42b77f['id']])){_0x34fbd7['salesforceAccounts'][_0x42b77f['id']]=new SalesforceAccount(_0x42b77f);}else{_0x34fbd7[_0x13ea('0x3e')](_0x34fbd7[_0x13ea('0x4a')][_0x42b77f['id']],_0x42b77f);}}}return _0x34fbd7[_0x13ea('0x4a')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4b')]=function(){var _0x5b7d19=this;return function(_0x4cce19){if(_0x4cce19){freeIsNotKey(_0x4cce19,_0x5b7d19[_0x13ea('0x1d')],'id');for(var _0x167a55=0x0,_0x2e82f7={},_0xe9e46={};_0x167a55<_0x4cce19[_0x13ea('0x41')];_0x167a55+=0x1){_0x2e82f7=_0x4cce19[_0x167a55];if(_[_0x13ea('0x43')](_0x5b7d19[_0x13ea('0x1d')][_0x2e82f7['id']])){_0x5b7d19[_0x13ea('0x1d')][_0x2e82f7['id']]=new FreshdeskAccount(_0x2e82f7);}else{_0x5b7d19[_0x13ea('0x3e')](_0x5b7d19['freshdeskAccounts'][_0x2e82f7['id']],_0x2e82f7);}}}return _0x5b7d19[_0x13ea('0x1d')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4c')]=function(){var _0x2a311a=this;return function(_0x4ad6d2){if(_0x4ad6d2){freeIsNotKey(_0x4ad6d2,_0x2a311a['zohoAccounts'],'id');for(var _0x131706=0x0,_0x169064={},_0x5bb68c={};_0x131706<_0x4ad6d2[_0x13ea('0x41')];_0x131706+=0x1){_0x169064=_0x4ad6d2[_0x131706];if(_[_0x13ea('0x43')](_0x2a311a[_0x13ea('0x1e')][_0x169064['id']])){_0x2a311a[_0x13ea('0x1e')][_0x169064['id']]=new ZohoAccount(_0x169064);}else{_0x2a311a[_0x13ea('0x3e')](_0x2a311a['zohoAccounts'][_0x169064['id']],_0x169064);}}}return _0x2a311a['zohoAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4d')]=function(){var _0xf68ec1=this;return function(_0x1d6ec5){if(_0x1d6ec5){freeIsNotKey(_0x1d6ec5,_0xf68ec1[_0x13ea('0x1f')],'id');for(var _0x17b98b=0x0,_0x5983a7={},_0x12e77d={};_0x17b98b<_0x1d6ec5['length'];_0x17b98b+=0x1){_0x5983a7=_0x1d6ec5[_0x17b98b];if(_[_0x13ea('0x43')](_0xf68ec1['deskAccounts'][_0x5983a7['id']])){_0xf68ec1[_0x13ea('0x1f')][_0x5983a7['id']]=new DeskAccount(_0x5983a7);}else{_0xf68ec1['mergeFromDatabase'](_0xf68ec1[_0x13ea('0x1f')][_0x5983a7['id']],_0x5983a7);}}}return _0xf68ec1[_0x13ea('0x1f')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x4e')]=function(){var _0x850cef=this;return function(_0xbe0037){if(_0xbe0037){freeIsNotKey(_0xbe0037,_0x850cef[_0x13ea('0x4f')],'id');for(var _0x398e52=0x0,_0x2d5cb1={},_0x502a4f={};_0x398e52<_0xbe0037[_0x13ea('0x41')];_0x398e52+=0x1){_0x2d5cb1=_0xbe0037[_0x398e52];if(_[_0x13ea('0x43')](_0x850cef['sugarcrmAccounts'][_0x2d5cb1['id']])){_0x850cef[_0x13ea('0x4f')][_0x2d5cb1['id']]=new SugarcrmAccount(_0x2d5cb1);}else{_0x850cef[_0x13ea('0x3e')](_0x850cef[_0x13ea('0x4f')][_0x2d5cb1['id']],_0x2d5cb1);}}}return _0x850cef['sugarcrmAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x50')]=function(){var _0x5cb003=this;return function(_0x210e5a){if(_0x210e5a){freeIsNotKey(_0x210e5a,_0x5cb003[_0x13ea('0x20')],'id');for(var _0x775d5c=0x0,_0x267534={},_0x11bddf={};_0x775d5c<_0x210e5a[_0x13ea('0x41')];_0x775d5c+=0x1){_0x267534=_0x210e5a[_0x775d5c];if(_[_0x13ea('0x43')](_0x5cb003[_0x13ea('0x20')][_0x267534['id']])){_0x5cb003[_0x13ea('0x20')][_0x267534['id']]=new VtigerAccount(_0x267534);}else{_0x5cb003[_0x13ea('0x3e')](_0x5cb003[_0x13ea('0x20')][_0x267534['id']],_0x267534);}}}return _0x5cb003['vtigerAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x51')]=function(){var _0x329243=this;return function(_0x33dac1){if(_0x33dac1){freeIsNotKey(_0x33dac1,_0x329243[_0x13ea('0x52')],'id');for(var _0x66e38d=0x0,_0x89ad69={},_0x460ff4={};_0x66e38d<_0x33dac1[_0x13ea('0x41')];_0x66e38d+=0x1){_0x89ad69=_0x33dac1[_0x66e38d];if(_[_0x13ea('0x43')](_0x329243['servicenowAccounts'][_0x89ad69['id']])){_0x329243[_0x13ea('0x52')][_0x89ad69['id']]=new ServicenowAccount(_0x89ad69);}else{_0x329243[_0x13ea('0x3e')](_0x329243[_0x13ea('0x52')][_0x89ad69['id']],_0x89ad69);}}}return _0x329243['servicenowAccounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x53')]=function(){var _0x27d996=this;return function(_0x4872b2){if(_0x4872b2){freeIsNotKey(_0x4872b2,_0x27d996[_0x13ea('0x21')],'id');for(var _0x3f5d76=0x0,_0x2c267f={},_0x1f616c={};_0x3f5d76<_0x4872b2[_0x13ea('0x41')];_0x3f5d76+=0x1){_0x2c267f=_0x4872b2[_0x3f5d76];if(_[_0x13ea('0x43')](_0x27d996[_0x13ea('0x21')][_0x2c267f['id']])){_0x27d996[_0x13ea('0x21')][_0x2c267f['id']]=new Dynamics365Account(_0x2c267f);}else{_0x27d996['mergeFromDatabase'](_0x27d996[_0x13ea('0x21')][_0x2c267f['id']],_0x2c267f);}}}return _0x27d996['dynamics365Accounts'];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x54')]=function(){var _0xfa69db=this;return function(_0x3ffb9d){if(_0x3ffb9d){freeIsNotKey(_0x3ffb9d,_0xfa69db['freshsalesAccounts'],'id');for(var _0x1126d2=0x0,_0x8509fb={},_0x59046d={};_0x1126d2<_0x3ffb9d[_0x13ea('0x41')];_0x1126d2+=0x1){_0x8509fb=_0x3ffb9d[_0x1126d2];if(_[_0x13ea('0x43')](_0xfa69db[_0x13ea('0x22')][_0x8509fb['id']])){_0xfa69db['freshsalesAccounts'][_0x8509fb['id']]=new FreshsalesAccount(_0x8509fb);}else{_0xfa69db[_0x13ea('0x3e')](_0xfa69db[_0x13ea('0x22')][_0x8509fb['id']],_0x8509fb);}}}return _0xfa69db[_0x13ea('0x22')];};};Realtime[_0x13ea('0x3d')][_0x13ea('0x55')]=function(){var _0xac4e74=this;return function(_0x17c15b){for(var _0x2a3616=0x0;_0x2a3616<_0x17c15b['length'];_0x2a3616+=0x1){_[_0x13ea('0x56')](_0xac4e74[_0x13ea('0x12')][_0x17c15b[_0x2a3616][_0x13ea('0x27')]],_0x17c15b[_0x2a3616]);}return _0xac4e74[_0x13ea('0x12')];};};Realtime[_0x13ea('0x3d')]['initVoiceQueueReports']=function(){var _0x455a62=this;return function(_0x21c94e){clearVoiceQueues(_0x455a62[_0x13ea('0x12')]);if(_0x21c94e){_0x21c94e=_[_0x13ea('0x57')](_0x21c94e,_0x13ea('0x58'));for(var _0x5108c7 in _0x21c94e){if(_0x21c94e[_0x13ea('0x25')](_0x5108c7)){var _0x3d19b5={};for(var _0x42c63a=0x0;_0x42c63a<_0x21c94e[_0x5108c7]['length'];_0x42c63a+=0x1){var _0x459819=_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x59')];if(_0x455a62['voiceQueues'][_0x459819]){if(_0x21c94e[_0x5108c7][_0x42c63a]['queuecallerexit']){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x31')]+=0x1;}if(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5a')]){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x32')]+=0x1;}_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2c')]+=moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5b')])['diff'](moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5c')]),_0x13ea('0x5d'))||0x0;if(_0x42c63a===_0x21c94e[_0x5108c7]['length']-0x1){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2d')]+=moment(_0x21c94e[_0x5108c7][_0x42c63a]['queuecallercompleteAt']||_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5e')]||_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5f')])['diff'](moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5c')]),_0x13ea('0x5d'))||0x0;_0x455a62[_0x13ea('0x12')][_0x459819]['total']+=0x1;if(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x60')]){_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2b')]+=0x1;_0x455a62[_0x13ea('0x12')][_0x459819]['sumBillable']+=moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x61')])['diff'](moment(_0x21c94e[_0x5108c7][_0x42c63a][_0x13ea('0x5b')]),_0x13ea('0x5d'))||0x0;}}else{_0x455a62[_0x13ea('0x12')][_0x459819][_0x13ea('0x2d')]+=_0x455a62['voiceQueues'][_0x459819]['sumHoldTime']||0x0;}}}}}}return _0x455a62[_0x13ea('0x12')];};};Realtime[_0x13ea('0x3d')]['initVoiceCallReports']=function(){var _0x3d7428=this;return function(_0x531a17){clearVoiceCallReports(_0x3d7428[_0x13ea('0x16')]);if(_0x531a17){for(var _0x2a4ded=0x0;_0x2a4ded<_0x531a17[_0x13ea('0x41')];_0x2a4ded+=0x1){_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2a')]+=0x1;_0x3d7428['outbound'][_0x13ea('0x2d')]+=_0x531a17[_0x2a4ded][_0x13ea('0x62')];if(_0x531a17[_0x2a4ded][_0x13ea('0x63')]==='ANSWERED'){_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2b')]+=0x1;_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2c')]+=_0x531a17[_0x2a4ded]['duration']-_0x531a17[_0x2a4ded][_0x13ea('0x64')]||0x0;_0x3d7428[_0x13ea('0x16')][_0x13ea('0x2e')]+=_0x531a17[_0x2a4ded][_0x13ea('0x64')];}}}return _0x3d7428[_0x13ea('0x16')];};};Realtime['prototype'][_0x13ea('0x65')]=function(){var _0x11ca16=this;return function(_0x58bcc5){if(_0x58bcc5){freeIsNotKey(_0x58bcc5,_0x11ca16[_0x13ea('0x14')],_0x13ea('0x27'));for(var _0x8136d4=0x0,_0x34fcdb={};_0x8136d4<_0x58bcc5['length'];_0x8136d4+=0x1){_0x34fcdb=_0x58bcc5[_0x8136d4];if(_[_0x13ea('0x43')](_0x11ca16['campaigns'][_0x34fcdb[_0x13ea('0x27')]])){_0x11ca16[_0x13ea('0x14')][_0x34fcdb[_0x13ea('0x27')]]=new Campaign(_0x34fcdb);}else{_0x11ca16[_0x13ea('0x3e')](_0x11ca16['campaigns'][_0x34fcdb[_0x13ea('0x27')]],_0x34fcdb);_0x11ca16[_0x13ea('0x14')][_0x34fcdb[_0x13ea('0x27')]][_0x13ea('0x66')]=_0x34fcdb[_0x13ea('0x67')]?_0x34fcdb['SquareProject']['name']:undefined;}}}return _0x11ca16['campaigns'];};};Realtime[_0x13ea('0x3d')]['initVoiceExtensions']=function(){var _0x4d0f59=this;return function(_0x39dbdd){if(_0x39dbdd){freeIsNotKey(_0x39dbdd,_0x4d0f59[_0x13ea('0x17')],'id');for(var _0x5ef1a9=0x0,_0x51aae2={};_0x5ef1a9<_0x39dbdd['length'];_0x5ef1a9+=0x1){_0x51aae2=_0x39dbdd[_0x5ef1a9];if(_[_0x13ea('0x43')](_0x4d0f59[_0x13ea('0x17')][_0x51aae2['id']])){_0x4d0f59[_0x13ea('0x17')][_0x51aae2['id']]=new VoiceExtension(_0x51aae2);}else{_0x4d0f59['mergeFromDatabase'](_0x4d0f59['voiceExtensions'][_0x51aae2['id']],_0x51aae2);}}}return _0x4d0f59['voiceExtensions'];};};Realtime[_0x13ea('0x3d')]['initCampaignHopperHistory']=function(){var _0x45f315=this;return function(_0x275f4c){clearCampaigns(_0x45f315['campaigns']);for(var _0x4bb620=0x0;_0x4bb620<_0x275f4c['length'];_0x4bb620+=0x1){_[_0x13ea('0x56')](_0x45f315['campaigns'][_0x275f4c[_0x4bb620][_0x13ea('0x27')]],_0x275f4c[_0x4bb620]);}return _0x45f315['campaigns'];};};Realtime['prototype'][_0x13ea('0x68')]=function(){var _0x511b24=this;return function(_0x44e796){if(_0x44e796){freeIsNotKey(_0x44e796,_0x511b24['faxAccounts'],'id');for(var _0x31b619=0x0,_0x3f42b5={},_0x4b063d={};_0x31b619<_0x44e796[_0x13ea('0x41')];_0x31b619+=0x1){_0x3f42b5=_0x44e796[_0x31b619];if(_[_0x13ea('0x43')](_0x511b24[_0x13ea('0x23')][_0x3f42b5['id']])){_0x511b24[_0x13ea('0x23')][_0x3f42b5['id']]=new FaxAccount(_0x3f42b5);}else{_0x511b24[_0x13ea('0x3e')](_0x511b24[_0x13ea('0x23')][_0x3f42b5['id']],_0x3f42b5);}}}return _0x511b24[_0x13ea('0x23')];};};module[_0x13ea('0x69')]=Realtime; \ No newline at end of file +var _0x3815=['initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','ivrTotalCallsDays','isEmpty','unmanaged','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','triggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts'];(function(_0x4bf85f,_0x4df697){var _0x30a870=function(_0x162ea4){while(--_0x162ea4){_0x4bf85f['push'](_0x4bf85f['shift']());}};_0x30a870(++_0x4df697);}(_0x3815,0x8a));var _0x5381=function(_0x4f140b,_0xe78dd7){_0x4f140b=_0x4f140b-0x0;var _0xc0deee=_0x3815[_0x4f140b];return _0xc0deee;};'use strict';var BPromise=require('bluebird');var util=require(_0x5381('0x0'));var _=require(_0x5381('0x1'));var moment=require(_0x5381('0x2'));var Agent=require(_0x5381('0x3'));var Telephone=require(_0x5381('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x5381('0x5'));var Trigger=require(_0x5381('0x6'));var Template=require(_0x5381('0x7'));var Campaign=require(_0x5381('0x8'));var VoiceExtension=require(_0x5381('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x5381('0xa'));var FreshdeskAccount=require(_0x5381('0xb'));var SugarcrmAccount=require(_0x5381('0xc'));var ZohoAccount=require(_0x5381('0xd'));var DeskAccount=require(_0x5381('0xe'));var VtigerAccount=require(_0x5381('0xf'));var ServicenowAccount=require(_0x5381('0x10'));var Dynamics365Account=require(_0x5381('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x5381('0x12'));var Realtime=function(){this[_0x5381('0x13')]={};this[_0x5381('0x14')]={};this[_0x5381('0x15')]={};this[_0x5381('0x16')]={};this['triggers']={};this[_0x5381('0x17')]={};this[_0x5381('0x18')]={};this[_0x5381('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5381('0x1a')]={};this[_0x5381('0x1b')]={};this[_0x5381('0x1c')]={};this[_0x5381('0x1d')]={};this[_0x5381('0x1e')]={};this[_0x5381('0x1f')]={};this['zendeskAccounts']={};this[_0x5381('0x20')]={};this[_0x5381('0x21')]={};this[_0x5381('0x22')]={};this[_0x5381('0x23')]={};this[_0x5381('0x24')]={};this[_0x5381('0x25')]={};this[_0x5381('0x26')]={};this[_0x5381('0x27')]={};this[_0x5381('0x28')]={};this[_0x5381('0x29')]={};};function freeIsNotKey(_0xd8d680,_0x1b20dd,_0x499e83){var _0x54c52f=_[_0x5381('0x2a')](_0xd8d680,function(_0x421e93,_0x4ff654){return _0x421e93[_0x499e83];});for(var _0xecc1f6 in _0x1b20dd){if(_0x1b20dd[_0x5381('0x2b')](_0xecc1f6)){if(!_0x54c52f[_0xecc1f6]){delete _0x1b20dd[_0xecc1f6];}}}}function freeIsNotKeySip(_0x2c58c7,_0x283497){var _0x1afaa1=_[_0x5381('0x2a')](_0x2c58c7,function(_0x1f7bc1,_0x4b035b){return util[_0x5381('0x2c')](_0x5381('0x2d'),_0x1f7bc1[_0x5381('0x2e')]);});for(var _0x12b1d5 in _0x283497){if(_0x283497[_0x5381('0x2b')](_0x12b1d5)){if(!_0x1afaa1[_0x12b1d5]){delete _0x283497[_0x12b1d5];}}}}function freeIsNotKeyAgent(_0x4f49dc,_0x112584){var _0x28351e=_[_0x5381('0x2a')](_0x4f49dc,function(_0x3b1f1e,_0x279d3a){var _0x5857ae=_['isNil'](_0x3b1f1e['interface'])?util['format'](_0x5381('0x2d'),_0x3b1f1e[_0x5381('0x2e')]):_0x3b1f1e[_0x5381('0x2f')];return _0x5857ae;});for(var _0x10ddf5 in _0x112584){if(_0x112584[_0x5381('0x2b')](_0x10ddf5)){if(!_0x28351e[_0x10ddf5]){delete _0x112584[_0x10ddf5];}}}}function clearVoiceCallReports(_0x2024c3){_0x2024c3[_0x5381('0x30')]=0x0;_0x2024c3[_0x5381('0x31')]=0x0;_0x2024c3[_0x5381('0x32')]=0x0;_0x2024c3['sumDuration']=0x0;_0x2024c3['sumBillable']=0x0;}function clearCampaigns(_0x5633ca){if(!_['isEmpty'](_0x5633ca)){for(var _0x261c4d in _0x5633ca){if(_0x5633ca[_0x5381('0x2b')](_0x261c4d)){_0x5633ca[_0x261c4d][_0x5381('0x33')]=0x0;_0x5633ca[_0x261c4d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x4989a7){if(!_[_0x5381('0x34')](_0x4989a7)){for(var _0x54c67f in _0x4989a7){if(_0x4989a7[_0x5381('0x2b')](_0x54c67f)){_0x4989a7[_0x54c67f][_0x5381('0x30')]=0x0;_0x4989a7[_0x54c67f]['answered']=0x0;_0x4989a7[_0x54c67f][_0x5381('0x35')]=0x0;_0x4989a7[_0x54c67f]['abandoned']=0x0;_0x4989a7[_0x54c67f][_0x5381('0x32')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x36')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x37')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x38')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x39')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x3a')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x3b')]=0x0;_0x4989a7[_0x54c67f]['outboundNoSuchCallsDay']=0x0;_0x4989a7[_0x54c67f][_0x5381('0x3c')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x3d')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x3e')]=0x0;_0x4989a7[_0x54c67f]['outboundBlacklistCallsDay']=0x0;_0x4989a7[_0x54c67f]['outboundOriginateFailureCallsDay']=0x0;_0x4989a7[_0x54c67f][_0x5381('0x3f')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x40')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x38')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x41')]=0x0;_0x4989a7[_0x54c67f][_0x5381('0x42')]=!![];}}}}Realtime[_0x5381('0x43')][_0x5381('0x44')]=function(_0x102799,_0x5edce1){for(var _0x49f909 in _0x5edce1){if(_0x102799[_0x5381('0x2b')](_0x49f909)){_0x102799[_0x49f909]=_0x5edce1[_0x49f909];}}};Realtime[_0x5381('0x43')]['initAgents']=function(){var _0x5d8b1d=this;return function(_0x870d69){if(_0x870d69){freeIsNotKeyAgent(_0x870d69,_0x5d8b1d[_0x5381('0x13')]);for(var _0x524676=0x0,_0x492305={},_0x350ddf={};_0x524676<_0x870d69[_0x5381('0x45')];_0x524676+=0x1){_0x492305=_0x870d69[_0x524676];var _0x5801fa=_[_0x5381('0x46')](_0x492305[_0x5381('0x2f')])?util[_0x5381('0x2c')](_0x5381('0x2d'),_0x492305[_0x5381('0x2e')]):_0x492305[_0x5381('0x2f')];if(_[_0x5381('0x47')](_0x5d8b1d[_0x5381('0x13')][_0x5801fa])){_0x5d8b1d[_0x5381('0x13')][_0x5801fa]=new Agent(_0x492305);}else{_0x5d8b1d[_0x5381('0x44')](_0x5d8b1d[_0x5381('0x13')][_0x5801fa],_0x492305);}}}return _0x5d8b1d['agents'];};};Realtime[_0x5381('0x43')][_0x5381('0x48')]=function(){var _0x2d8bb9=this;return function(_0x533875){if(_0x533875){freeIsNotKeySip(_0x533875,_0x2d8bb9[_0x5381('0x14')]);for(var _0x1e4daa=0x0,_0x449d6a={},_0x33ec0f={};_0x1e4daa<_0x533875[_0x5381('0x45')];_0x1e4daa+=0x1){_0x449d6a=_0x533875[_0x1e4daa];if(_['isUndefined'](_0x2d8bb9['telephones'][util[_0x5381('0x2c')](_0x5381('0x2d'),_0x449d6a[_0x5381('0x2e')])])){_0x2d8bb9['telephones'][util['format'](_0x5381('0x2d'),_0x449d6a[_0x5381('0x2e')])]=new Telephone(_0x449d6a);}else{_0x2d8bb9[_0x5381('0x44')](_0x2d8bb9[_0x5381('0x14')][util[_0x5381('0x2c')](_0x5381('0x2d'),_0x449d6a[_0x5381('0x2e')])],_0x449d6a);}}}return _0x2d8bb9[_0x5381('0x14')];};};Realtime['prototype'][_0x5381('0x49')]=function(){var _0x20f46e=this;return function(_0x17f519){if(_0x17f519){freeIsNotKeySip(_0x17f519,_0x20f46e['trunks']);for(var _0x4602bf=0x0,_0x5106bf={},_0xed62a={};_0x4602bf<_0x17f519[_0x5381('0x45')];_0x4602bf+=0x1){_0x5106bf=_0x17f519[_0x4602bf];if(_['isUndefined'](_0x20f46e[_0x5381('0x15')][util[_0x5381('0x2c')](_0x5381('0x2d'),_0x5106bf[_0x5381('0x2e')])])){_0x20f46e[_0x5381('0x15')][util['format'](_0x5381('0x2d'),_0x5106bf[_0x5381('0x2e')])]=new Trunk(_0x5106bf);}else{_0x20f46e[_0x5381('0x44')](_0x20f46e['trunks'][util['format'](_0x5381('0x2d'),_0x5106bf[_0x5381('0x2e')])],_0x5106bf);}}}return _0x20f46e['trunks'];};};Realtime['prototype'][_0x5381('0x4a')]=function(){var _0x1f5fbc=this;return function(_0x106670){if(_0x106670){freeIsNotKey(_0x106670,_0x1f5fbc[_0x5381('0x16')],_0x5381('0x2e'));for(var _0x23d209=0x0,_0x2a7cd0={},_0x403b3b={};_0x23d209<_0x106670[_0x5381('0x45')];_0x23d209+=0x1){_0x2a7cd0=_0x106670[_0x23d209];if(_[_0x5381('0x47')](_0x1f5fbc[_0x5381('0x16')][_0x2a7cd0['name']])){_0x1f5fbc[_0x5381('0x16')][_0x2a7cd0[_0x5381('0x2e')]]=new VoiceQueue(_0x2a7cd0);}else{_0x1f5fbc[_0x5381('0x44')](_0x1f5fbc[_0x5381('0x16')][_0x2a7cd0[_0x5381('0x2e')]],_0x2a7cd0);}}}return _0x1f5fbc[_0x5381('0x16')];};};Realtime[_0x5381('0x43')]['initTriggers']=function(){var _0x3fc9a4=this;return function(_0x4b1adc){if(_0x4b1adc){freeIsNotKey(_0x4b1adc,_0x3fc9a4[_0x5381('0x4b')],'id');for(var _0x536162=0x0,_0x278637={},_0x180a53={};_0x536162<_0x4b1adc[_0x5381('0x45')];_0x536162+=0x1){_0x278637=_0x4b1adc[_0x536162];if(_[_0x5381('0x47')](_0x3fc9a4[_0x5381('0x4b')][_0x278637['id']])){_0x3fc9a4[_0x5381('0x4b')][_0x278637['id']]=new Trigger(_0x278637);}else{_0x3fc9a4[_0x5381('0x44')](_0x3fc9a4[_0x5381('0x4b')][_0x278637['id']],_0x278637);}}}return _0x3fc9a4[_0x5381('0x4b')];};};Realtime[_0x5381('0x43')]['initTemplates']=function(){var _0x2840f9=this;return function(_0x1529c1){if(_0x1529c1){freeIsNotKey(_0x1529c1,_0x2840f9['templates'],'id');for(var _0x20c269=0x0,_0x4e1042={},_0x53e4c8={};_0x20c269<_0x1529c1[_0x5381('0x45')];_0x20c269+=0x1){_0x4e1042=_0x1529c1[_0x20c269];if(_[_0x5381('0x47')](_0x2840f9[_0x5381('0x18')][_0x4e1042['id']])){_0x2840f9['templates'][_0x4e1042['id']]=new Template(_0x4e1042);}else{_0x2840f9[_0x5381('0x44')](_0x2840f9[_0x5381('0x18')][_0x4e1042['id']],_0x4e1042);}}}return _0x2840f9['templates'];};};Realtime['prototype'][_0x5381('0x4c')]=function(){var _0x492146=this;return function(_0x316151){if(_0x316151){freeIsNotKey(_0x316151,_0x492146['zendeskAccounts'],'id');for(var _0x2bc9ae=0x0,_0x3882ce={},_0x83c4ba={};_0x2bc9ae<_0x316151[_0x5381('0x45')];_0x2bc9ae+=0x1){_0x3882ce=_0x316151[_0x2bc9ae];if(_[_0x5381('0x47')](_0x492146[_0x5381('0x4d')][_0x3882ce['id']])){_0x492146[_0x5381('0x4d')][_0x3882ce['id']]=new ZendeskAccount(_0x3882ce);}else{_0x492146[_0x5381('0x44')](_0x492146[_0x5381('0x4d')][_0x3882ce['id']],_0x3882ce);}}}return _0x492146[_0x5381('0x4d')];};};Realtime[_0x5381('0x43')][_0x5381('0x4e')]=function(){var _0x27b66b=this;return function(_0x49ac3c){if(_0x49ac3c){freeIsNotKey(_0x49ac3c,_0x27b66b[_0x5381('0x20')],'id');for(var _0x4b41bc=0x0,_0x124949={},_0x233db5={};_0x4b41bc<_0x49ac3c[_0x5381('0x45')];_0x4b41bc+=0x1){_0x124949=_0x49ac3c[_0x4b41bc];if(_[_0x5381('0x47')](_0x27b66b[_0x5381('0x20')][_0x124949['id']])){_0x27b66b['salesforceAccounts'][_0x124949['id']]=new SalesforceAccount(_0x124949);}else{_0x27b66b[_0x5381('0x44')](_0x27b66b[_0x5381('0x20')][_0x124949['id']],_0x124949);}}}return _0x27b66b[_0x5381('0x20')];};};Realtime[_0x5381('0x43')]['initFreshdeskAccounts']=function(){var _0x3f142c=this;return function(_0x3fb8f4){if(_0x3fb8f4){freeIsNotKey(_0x3fb8f4,_0x3f142c['freshdeskAccounts'],'id');for(var _0xe0a7ca=0x0,_0x37f42a={},_0x6bf43b={};_0xe0a7ca<_0x3fb8f4['length'];_0xe0a7ca+=0x1){_0x37f42a=_0x3fb8f4[_0xe0a7ca];if(_['isUndefined'](_0x3f142c[_0x5381('0x22')][_0x37f42a['id']])){_0x3f142c[_0x5381('0x22')][_0x37f42a['id']]=new FreshdeskAccount(_0x37f42a);}else{_0x3f142c['mergeFromDatabase'](_0x3f142c[_0x5381('0x22')][_0x37f42a['id']],_0x37f42a);}}}return _0x3f142c[_0x5381('0x22')];};};Realtime[_0x5381('0x43')][_0x5381('0x4f')]=function(){var _0x149730=this;return function(_0x10894f){if(_0x10894f){freeIsNotKey(_0x10894f,_0x149730[_0x5381('0x23')],'id');for(var _0x236648=0x0,_0x2a565a={},_0x3030a6={};_0x236648<_0x10894f[_0x5381('0x45')];_0x236648+=0x1){_0x2a565a=_0x10894f[_0x236648];if(_[_0x5381('0x47')](_0x149730['zohoAccounts'][_0x2a565a['id']])){_0x149730['zohoAccounts'][_0x2a565a['id']]=new ZohoAccount(_0x2a565a);}else{_0x149730[_0x5381('0x44')](_0x149730['zohoAccounts'][_0x2a565a['id']],_0x2a565a);}}}return _0x149730[_0x5381('0x23')];};};Realtime[_0x5381('0x43')][_0x5381('0x50')]=function(){var _0x3b9f8e=this;return function(_0xeeb8e4){if(_0xeeb8e4){freeIsNotKey(_0xeeb8e4,_0x3b9f8e[_0x5381('0x24')],'id');for(var _0x23ff9d=0x0,_0x22b401={},_0x4b3d5f={};_0x23ff9d<_0xeeb8e4[_0x5381('0x45')];_0x23ff9d+=0x1){_0x22b401=_0xeeb8e4[_0x23ff9d];if(_[_0x5381('0x47')](_0x3b9f8e[_0x5381('0x24')][_0x22b401['id']])){_0x3b9f8e[_0x5381('0x24')][_0x22b401['id']]=new DeskAccount(_0x22b401);}else{_0x3b9f8e[_0x5381('0x44')](_0x3b9f8e[_0x5381('0x24')][_0x22b401['id']],_0x22b401);}}}return _0x3b9f8e[_0x5381('0x24')];};};Realtime[_0x5381('0x43')][_0x5381('0x51')]=function(){var _0x28802c=this;return function(_0x52637f){if(_0x52637f){freeIsNotKey(_0x52637f,_0x28802c[_0x5381('0x21')],'id');for(var _0x18a1cc=0x0,_0x5fb035={},_0x525005={};_0x18a1cc<_0x52637f[_0x5381('0x45')];_0x18a1cc+=0x1){_0x5fb035=_0x52637f[_0x18a1cc];if(_[_0x5381('0x47')](_0x28802c[_0x5381('0x21')][_0x5fb035['id']])){_0x28802c[_0x5381('0x21')][_0x5fb035['id']]=new SugarcrmAccount(_0x5fb035);}else{_0x28802c[_0x5381('0x44')](_0x28802c[_0x5381('0x21')][_0x5fb035['id']],_0x5fb035);}}}return _0x28802c[_0x5381('0x21')];};};Realtime[_0x5381('0x43')][_0x5381('0x52')]=function(){var _0x11bc21=this;return function(_0x339780){if(_0x339780){freeIsNotKey(_0x339780,_0x11bc21[_0x5381('0x25')],'id');for(var _0x4553aa=0x0,_0x43ba36={},_0x2044f4={};_0x4553aa<_0x339780[_0x5381('0x45')];_0x4553aa+=0x1){_0x43ba36=_0x339780[_0x4553aa];if(_[_0x5381('0x47')](_0x11bc21[_0x5381('0x25')][_0x43ba36['id']])){_0x11bc21[_0x5381('0x25')][_0x43ba36['id']]=new VtigerAccount(_0x43ba36);}else{_0x11bc21[_0x5381('0x44')](_0x11bc21[_0x5381('0x25')][_0x43ba36['id']],_0x43ba36);}}}return _0x11bc21[_0x5381('0x25')];};};Realtime['prototype'][_0x5381('0x53')]=function(){var _0x2b7e18=this;return function(_0x56936c){if(_0x56936c){freeIsNotKey(_0x56936c,_0x2b7e18[_0x5381('0x26')],'id');for(var _0x19317f=0x0,_0x12d797={},_0x284c3c={};_0x19317f<_0x56936c[_0x5381('0x45')];_0x19317f+=0x1){_0x12d797=_0x56936c[_0x19317f];if(_[_0x5381('0x47')](_0x2b7e18[_0x5381('0x26')][_0x12d797['id']])){_0x2b7e18[_0x5381('0x26')][_0x12d797['id']]=new ServicenowAccount(_0x12d797);}else{_0x2b7e18[_0x5381('0x44')](_0x2b7e18['servicenowAccounts'][_0x12d797['id']],_0x12d797);}}}return _0x2b7e18['servicenowAccounts'];};};Realtime[_0x5381('0x43')][_0x5381('0x54')]=function(){var _0x18a9a4=this;return function(_0x36c969){if(_0x36c969){freeIsNotKey(_0x36c969,_0x18a9a4[_0x5381('0x27')],'id');for(var _0x48f98a=0x0,_0x5a42e6={},_0x4a8f89={};_0x48f98a<_0x36c969['length'];_0x48f98a+=0x1){_0x5a42e6=_0x36c969[_0x48f98a];if(_[_0x5381('0x47')](_0x18a9a4[_0x5381('0x27')][_0x5a42e6['id']])){_0x18a9a4[_0x5381('0x27')][_0x5a42e6['id']]=new Dynamics365Account(_0x5a42e6);}else{_0x18a9a4[_0x5381('0x44')](_0x18a9a4['dynamics365Accounts'][_0x5a42e6['id']],_0x5a42e6);}}}return _0x18a9a4[_0x5381('0x27')];};};Realtime[_0x5381('0x43')][_0x5381('0x55')]=function(){var _0x26f532=this;return function(_0x2c90ba){if(_0x2c90ba){freeIsNotKey(_0x2c90ba,_0x26f532[_0x5381('0x28')],'id');for(var _0xb794ef=0x0,_0x3db2a6={},_0x4ee920={};_0xb794ef<_0x2c90ba['length'];_0xb794ef+=0x1){_0x3db2a6=_0x2c90ba[_0xb794ef];if(_[_0x5381('0x47')](_0x26f532[_0x5381('0x28')][_0x3db2a6['id']])){_0x26f532[_0x5381('0x28')][_0x3db2a6['id']]=new FreshsalesAccount(_0x3db2a6);}else{_0x26f532['mergeFromDatabase'](_0x26f532[_0x5381('0x28')][_0x3db2a6['id']],_0x3db2a6);}}}return _0x26f532[_0x5381('0x28')];};};Realtime[_0x5381('0x43')][_0x5381('0x56')]=function(){var _0x357fcb=this;return function(_0x3328e2){for(var _0x3868d2=0x0;_0x3868d2<_0x3328e2['length'];_0x3868d2+=0x1){_[_0x5381('0x57')](_0x357fcb['voiceQueues'][_0x3328e2[_0x3868d2][_0x5381('0x2e')]],_0x3328e2[_0x3868d2]);}return _0x357fcb['voiceQueues'];};};Realtime[_0x5381('0x43')]['initVoiceQueueReports']=function(){var _0x48f9a1=this;return function(_0x274b7e){clearVoiceQueues(_0x48f9a1[_0x5381('0x16')]);if(_0x274b7e){_0x274b7e=_[_0x5381('0x58')](_0x274b7e,'uniqueid');for(var _0x251c0d in _0x274b7e){if(_0x274b7e[_0x5381('0x2b')](_0x251c0d)){var _0x2a73e1={};for(var _0x5b6b1b=0x0;_0x5b6b1b<_0x274b7e[_0x251c0d]['length'];_0x5b6b1b+=0x1){var _0x31957e=_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x59')];if(_0x48f9a1['voiceQueues'][_0x31957e]){if(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x5a')]){_0x48f9a1[_0x5381('0x16')][_0x31957e][_0x5381('0x35')]+=0x1;}if(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x5b')]){_0x48f9a1[_0x5381('0x16')][_0x31957e]['abandoned']+=0x1;}_0x48f9a1[_0x5381('0x16')][_0x31957e][_0x5381('0x32')]+=moment(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x5c')])[_0x5381('0x5d')](moment(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x5e')]),_0x5381('0x5f'))||0x0;if(_0x5b6b1b===_0x274b7e[_0x251c0d]['length']-0x1){_0x48f9a1[_0x5381('0x16')][_0x31957e]['sumDuration']+=moment(_0x274b7e[_0x251c0d][_0x5b6b1b]['queuecallercompleteAt']||_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x60')]||_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x61')])[_0x5381('0x5d')](moment(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x5e')]),'seconds')||0x0;_0x48f9a1[_0x5381('0x16')][_0x31957e][_0x5381('0x30')]+=0x1;if(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x62')]){_0x48f9a1['voiceQueues'][_0x31957e]['answered']+=0x1;_0x48f9a1[_0x5381('0x16')][_0x31957e][_0x5381('0x37')]+=moment(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x63')])['diff'](moment(_0x274b7e[_0x251c0d][_0x5b6b1b][_0x5381('0x5c')]),'seconds')||0x0;}}else{_0x48f9a1['voiceQueues'][_0x31957e][_0x5381('0x36')]+=_0x48f9a1[_0x5381('0x16')][_0x31957e][_0x5381('0x32')]||0x0;}}}}}}return _0x48f9a1['voiceQueues'];};};Realtime[_0x5381('0x43')][_0x5381('0x64')]=function(){var _0xe1aa40=this;return function(_0xb31306){clearVoiceCallReports(_0xe1aa40['outbound']);if(_0xb31306){for(var _0x12c20f=0x0;_0x12c20f<_0xb31306['length'];_0x12c20f+=0x1){_0xe1aa40[_0x5381('0x19')]['total']+=0x1;_0xe1aa40[_0x5381('0x19')][_0x5381('0x36')]+=_0xb31306[_0x12c20f][_0x5381('0x65')];if(_0xb31306[_0x12c20f][_0x5381('0x66')]==='ANSWERED'){_0xe1aa40[_0x5381('0x19')][_0x5381('0x31')]+=0x1;_0xe1aa40[_0x5381('0x19')][_0x5381('0x32')]+=_0xb31306[_0x12c20f][_0x5381('0x65')]-_0xb31306[_0x12c20f][_0x5381('0x67')]||0x0;_0xe1aa40[_0x5381('0x19')][_0x5381('0x37')]+=_0xb31306[_0x12c20f][_0x5381('0x67')];}}}return _0xe1aa40[_0x5381('0x19')];};};Realtime['prototype'][_0x5381('0x68')]=function(){var _0x418529=this;return function(_0x373443){if(_0x373443){freeIsNotKey(_0x373443,_0x418529['campaigns'],_0x5381('0x2e'));for(var _0xbbc5ed=0x0,_0x5034f5={};_0xbbc5ed<_0x373443[_0x5381('0x45')];_0xbbc5ed+=0x1){_0x5034f5=_0x373443[_0xbbc5ed];if(_['isUndefined'](_0x418529['campaigns'][_0x5034f5[_0x5381('0x2e')]])){_0x418529[_0x5381('0x17')][_0x5034f5[_0x5381('0x2e')]]=new Campaign(_0x5034f5);}else{_0x418529[_0x5381('0x44')](_0x418529[_0x5381('0x17')][_0x5034f5[_0x5381('0x2e')]],_0x5034f5);_0x418529[_0x5381('0x17')][_0x5034f5[_0x5381('0x2e')]][_0x5381('0x69')]=_0x5034f5[_0x5381('0x6a')]?_0x5034f5['SquareProject'][_0x5381('0x2e')]:undefined;}}}return _0x418529[_0x5381('0x17')];};};Realtime[_0x5381('0x43')][_0x5381('0x6b')]=function(){var _0x48fef3=this;return function(_0x55cd4b){if(_0x55cd4b){freeIsNotKey(_0x55cd4b,_0x48fef3[_0x5381('0x1a')],'id');for(var _0x2dc1f3=0x0,_0xd28efa={};_0x2dc1f3<_0x55cd4b[_0x5381('0x45')];_0x2dc1f3+=0x1){_0xd28efa=_0x55cd4b[_0x2dc1f3];if(_[_0x5381('0x47')](_0x48fef3[_0x5381('0x1a')][_0xd28efa['id']])){_0x48fef3[_0x5381('0x1a')][_0xd28efa['id']]=new VoiceExtension(_0xd28efa);}else{_0x48fef3[_0x5381('0x44')](_0x48fef3[_0x5381('0x1a')][_0xd28efa['id']],_0xd28efa);}}}return _0x48fef3[_0x5381('0x1a')];};};Realtime['prototype'][_0x5381('0x6c')]=function(){var _0x3a2408=this;return function(_0x7f84b2){clearCampaigns(_0x3a2408[_0x5381('0x17')]);for(var _0x2bd102=0x0;_0x2bd102<_0x7f84b2[_0x5381('0x45')];_0x2bd102+=0x1){_['merge'](_0x3a2408['campaigns'][_0x7f84b2[_0x2bd102][_0x5381('0x2e')]],_0x7f84b2[_0x2bd102]);}return _0x3a2408['campaigns'];};};Realtime[_0x5381('0x43')][_0x5381('0x6d')]=function(){var _0x57062d=this;return function(_0x1da96f){if(_0x1da96f){freeIsNotKey(_0x1da96f,_0x57062d['faxAccounts'],'id');for(var _0x3b93ba=0x0,_0x21bd9e={},_0x1d97c6={};_0x3b93ba<_0x1da96f['length'];_0x3b93ba+=0x1){_0x21bd9e=_0x1da96f[_0x3b93ba];if(_[_0x5381('0x47')](_0x57062d[_0x5381('0x29')][_0x21bd9e['id']])){_0x57062d['faxAccounts'][_0x21bd9e['id']]=new FaxAccount(_0x21bd9e);}else{_0x57062d[_0x5381('0x44')](_0x57062d[_0x5381('0x29')][_0x21bd9e['id']],_0x21bd9e);}}}return _0x57062d[_0x5381('0x29')];};};module[_0x5381('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c55e224..0d477a7 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 _0x1974=['../ami','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','agents','interface','format','SIP/%s','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','keys','getCallType','calleridnum','internal','voiceCallReport','destination','exten','type','dialer','lastapplication','context','callerid','calleridpreview','originatecalleridnum','destinationchannel','channel','ANSWERED','connectedlinenum','calleridname','linkedid','transfereelinkedid','uniqueid','UserId','split','getAgentByInternal','monitor','monitors','monitorFilename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','substring','indexOf','mobile','phone','transfers','transfererlinkedid','lodash','moment','../../../config/environment'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x1974,0xfc));var _0x4197=function(_0x4d2a54,_0x3e1772){_0x4d2a54=_0x4d2a54-0x0;var _0x36d269=_0x1974[_0x4d2a54];return _0x36d269;};'use strict';var _=require(_0x4197('0x0'));var moment=require(_0x4197('0x1'));var util=require('util');var config=require(_0x4197('0x2'));var ami=require(_0x4197('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x4197('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x4197('0x5'));var RpcVoiceTransferReport=require(_0x4197('0x6'));var VoiceQueueReport=require(_0x4197('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x4197('0x8'));var VoiceDialReport=require(_0x4197('0x9'));var UserReport=require(_0x4197('0xa'));function Report(_0x4b907e){this[_0x4197('0xb')]=_0x4b907e;this['agents']=_0x4b907e['agents'];this['telephones']=_0x4b907e[_0x4197('0xc')];}Report[_0x4197('0xd')]['sync']=function(_0x3ef15c){var _0x2340c6=new VoiceQueueReport(this[_0x4197('0xb')]);var _0x509c9c=new VoiceAgentReport(this['realtime']);var _0x10bc97=new VoiceDialReport(this[_0x4197('0xb')]);var _0x59bf17=new VoiceCallReport(this[_0x4197('0xb')]);var _0x1d87db=new UserReport(this['realtime']);if(config[_0x4197('0xe')]&&config[_0x4197('0xe')][_0x4197('0xf')]){ami['on']('custom:voiceQueueReport',this[_0x4197('0x10')][_0x4197('0x11')](this));ami['on'](_0x4197('0x12'),this['voiceCallReport'][_0x4197('0x11')](this));ami['on']('custom:voiceAgentReport',this[_0x4197('0x13')][_0x4197('0x11')](this));ami['on'](_0x4197('0x14'),this[_0x4197('0x15')][_0x4197('0x11')](this));ami['on'](_0x4197('0x16'),this[_0x4197('0x17')][_0x4197('0x11')](this));ami['on'](_0x4197('0x18'),this[_0x4197('0x19')][_0x4197('0x11')](this));}};Report['prototype'][_0x4197('0x1a')]=function(_0x4829bb){var _0x37460d;_0x37460d=_[_0x4197('0x1b')](this['agents'],function(_0x39d467){return _0x39d467[_0x4197('0x1c')]==_0x4829bb||_0x39d467[_0x4197('0x1d')]==_0x4829bb;});if(_[_0x4197('0x1e')](_0x37460d)){var _0xb74520=_[_0x4197('0x1b')](this[_0x4197('0xc')],function(_0x239918){return _0x239918[_0x4197('0x1c')]==_0x4829bb||_0x239918[_0x4197('0x1d')]==_0x4829bb;});if(_0xb74520){_0x37460d=_[_0x4197('0x1b')](this[_0x4197('0x1f')],function(_0x9f4a7a){return _0x9f4a7a[_0x4197('0x20')]==util[_0x4197('0x21')](_0x4197('0x22'),_0xb74520[_0x4197('0x1d')]);});}}return _0x37460d;};Report[_0x4197('0xd')][_0x4197('0x10')]=function(_0x1e033e){for(var _0x5beac4=0x0;_0x5beac4<_0x1e033e[_0x4197('0x23')];_0x5beac4+=0x1){var _0x182a51=this['findAgent'](_0x1e033e[_0x5beac4]['connectedlinenum']);if(_0x182a51){_0x1e033e[_0x5beac4][_0x4197('0x1c')]=_0x182a51[_0x4197('0x1c')];_0x1e033e[_0x5beac4][_0x4197('0x24')]=!![];_0x1e033e[_0x5beac4][_0x4197('0x25')]=_0x182a51['name'];_0x1e033e[_0x5beac4][_0x4197('0x20')]=_[_0x4197('0x1e')](_0x182a51[_0x4197('0x20')])?util[_0x4197('0x21')](_0x4197('0x22'),_0x182a51[_0x4197('0x1d')]):_0x182a51[_0x4197('0x20')];if(_0x1e033e[_0x5beac4][_0x4197('0x26')]){_0x1e033e[_0x5beac4][_0x4197('0x27')]=moment()['format'](_0x4197('0x28'));}if(_0x1e033e[_0x5beac4]['queuecallerexit']){_0x1e033e[_0x5beac4][_0x4197('0x29')]=moment()[_0x4197('0x21')](_0x4197('0x28'));}RpcMemberReport[_0x4197('0x10')](_0x1e033e[_0x5beac4]);}RpcVoiceQueueReport[_0x4197('0x2a')](_0x1e033e[_0x5beac4]);}};function extractCalleridNumber(_0x9764aa){var _0x424eff=_0x9764aa[_0x4197('0x2b')](/<(.*?)>/);return _0x424eff?_0x424eff[0x1]:_0x9764aa;}Report[_0x4197('0xd')]['getAgentByInternal']=function(_0xb6882a){for(var _0x1b63be=0x0;_0x1b63be',_0x59b7ee[_0x4197('0x3e')],_0x59b7ee['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x59b7ee[_0x4197('0x3f')]]){var _0x156a4f=RpcVoiceTransferReport['transfers'][_0x59b7ee['linkedid']];_0x156a4f[_0x4197('0x40')]=_0x59b7ee[_0x4197('0x41')];RpcVoiceTransferReport['blindTransfer'](_0x156a4f);delete RpcVoiceTransferReport['transfers'][_0x59b7ee['linkedid']];}if(_[_0x4197('0x1e')](_0x59b7ee['type'])){_0x59b7ee[_0x4197('0x33')]=this[_0x4197('0x2d')](_0x59b7ee);}if(_[_0x4197('0x1e')](_0x59b7ee[_0x4197('0x42')])){var _0x56da0e=_0x59b7ee['channel'][_0x4197('0x43')]('-')[0x0];var _0x407ae4=this[_0x4197('0x1f')][_0x56da0e];if(!_0x407ae4)_0x407ae4=this[_0x4197('0x44')](_0x59b7ee[_0x4197('0x1c')]);if(_0x407ae4){_0x59b7ee[_0x4197('0x42')]=_0x407ae4['id'];_0x59b7ee['membername']=_0x407ae4['name'];}}RpcVoiceCallReport[_0x4197('0x2a')](_0x59b7ee);if(_0x59b7ee[_0x4197('0x45')]){for(var _0x34d890=0x0;_0x34d890<_0x59b7ee[_0x4197('0x46')]['length'];_0x34d890+=0x1){_0x59b7ee[_0x4197('0x47')]=_0x59b7ee[_0x4197('0x46')][_0x34d890]['filename'];_0x59b7ee[_0x4197('0x48')]=_0x59b7ee[_0x4197('0x46')][_0x34d890][_0x4197('0x48')];if(_0x59b7ee['exten']==_0x4197('0x49')){_0x59b7ee['calleridnum']=_0x59b7ee[_0x4197('0x3d')];_0x59b7ee['calleridname']=_0x59b7ee[_0x4197('0x4a')];_0x59b7ee[_0x4197('0x3d')]=_0x59b7ee[_0x4197('0x1c')];_0x59b7ee['connectedlinename']=_0x59b7ee[_0x4197('0x4b')];_0x59b7ee['exten']=_0x59b7ee[_0x4197('0x39')];}else if(_0x59b7ee[_0x4197('0x32')]==_0x4197('0x4c')){_0x59b7ee[_0x4197('0x2e')]=_0x59b7ee[_0x4197('0x31')];_0x59b7ee[_0x4197('0x32')]=_0x59b7ee[_0x4197('0x39')];}RpcVoiceRecording[_0x4197('0x2a')](_0x59b7ee);}}};Report[_0x4197('0xd')]['voiceAgentReport']=function(_0x33d7b0){if(_[_0x4197('0x4d')](_0x33d7b0)){_0x33d7b0['forEach'](function(_0x1874fe){RpcVoiceAgentReport[_0x4197('0x2a')](_0x1874fe);});}else{RpcVoiceAgentReport[_0x4197('0x2a')](_0x33d7b0);}};Report['prototype']['voiceDialReport']=function(_0x497ad9){RpcVoiceDialReport[_0x4197('0x2a')](_0x497ad9);var _0x4f77d3;var _0x502951;var _0x493589=_0x497ad9['channel'];if(_[_0x4197('0x4e')](_0x493589,'Local')){_0x502951=_0x493589[_0x4197('0x4f')](_0x493589['indexOf']('/')+0x1,_0x493589[_0x4197('0x50')]('@'));_0x4f77d3=_[_0x4197('0x1b')](this[_0x4197('0x1f')],function(_0x3e94dd){return _0x3e94dd[_0x4197('0x51')]==_0x502951||_0x3e94dd[_0x4197('0x52')]==_0x502951||_0x3e94dd[_0x4197('0x1c')]==_0x502951;});}else{_0x502951=_0x493589[_0x4197('0x4f')](_0x493589[_0x4197('0x50')]('/')+0x1,_0x493589['lastIndexOf']('-'));_0x4f77d3=this[_0x4197('0x1a')](_0x502951);}if(_0x4f77d3){_0x497ad9[_0x4197('0x20')]=_[_0x4197('0x1e')](_0x4f77d3[_0x4197('0x20')])?util[_0x4197('0x21')](_0x4197('0x22'),_0x4f77d3[_0x4197('0x1d')]):_0x4f77d3[_0x4197('0x20')];_0x497ad9[_0x4197('0x4b')]=_0x4f77d3['name'];_0x497ad9[_0x4197('0x1c')]=_0x4f77d3[_0x4197('0x1c')];RpcMemberReport[_0x4197('0x15')](_0x497ad9);}};Report[_0x4197('0xd')][_0x4197('0x17')]=function(_0x53d4eb){RpcVoiceTransferReport[_0x4197('0x53')][_0x53d4eb[_0x4197('0x54')]]=_0x53d4eb;};Report[_0x4197('0xd')]['attendedTransfer']=function(_0x2b3c34){RpcVoiceTransferReport[_0x4197('0x19')](_0x2b3c34);};module['exports']=Report; \ No newline at end of file +var _0x7b16=['indexOf','mobile','phone','substring','lodash','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','find','name','isNil','accountcode','interface','SIP/%s','length','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','split','outbound','internal','destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local'];(function(_0x29f44a,_0x5d4f21){var _0x4dcae0=function(_0xba57dd){while(--_0xba57dd){_0x29f44a['push'](_0x29f44a['shift']());}};_0x4dcae0(++_0x5d4f21);}(_0x7b16,0x1cb));var _0x67b1=function(_0x536491,_0x509c3b){_0x536491=_0x536491-0x0;var _0x33a143=_0x7b16[_0x536491];return _0x33a143;};'use strict';var _=require(_0x67b1('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x67b1('0x1'));var RpcVoiceDialReport=require(_0x67b1('0x2'));var RpcMemberReport=require(_0x67b1('0x3'));var RpcVoiceQueueReport=require(_0x67b1('0x4'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x67b1('0x5'));var VoiceQueueReport=require(_0x67b1('0x6'));var VoiceCallReport=require(_0x67b1('0x7'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x67b1('0x8'));function Report(_0x2092ff){this[_0x67b1('0x9')]=_0x2092ff;this[_0x67b1('0xa')]=_0x2092ff[_0x67b1('0xa')];this[_0x67b1('0xb')]=_0x2092ff['telephones'];}Report['prototype'][_0x67b1('0xc')]=function(_0x1ec481){var _0x33c270=new VoiceQueueReport(this[_0x67b1('0x9')]);var _0x49720a=new VoiceAgentReport(this[_0x67b1('0x9')]);var _0x4e614c=new VoiceDialReport(this[_0x67b1('0x9')]);var _0x387d7b=new VoiceCallReport(this[_0x67b1('0x9')]);var _0x173ce1=new UserReport(this[_0x67b1('0x9')]);if(config['xdr']&&config[_0x67b1('0xd')][_0x67b1('0xe')]){ami['on'](_0x67b1('0xf'),this[_0x67b1('0x10')]['bind'](this));ami['on'](_0x67b1('0x11'),this[_0x67b1('0x12')][_0x67b1('0x13')](this));ami['on'](_0x67b1('0x14'),this[_0x67b1('0x15')][_0x67b1('0x13')](this));ami['on'](_0x67b1('0x16'),this[_0x67b1('0x17')]['bind'](this));ami['on'](_0x67b1('0x18'),this[_0x67b1('0x19')][_0x67b1('0x13')](this));ami['on']('attendedtransfer',this[_0x67b1('0x1a')][_0x67b1('0x13')](this));}};Report[_0x67b1('0x1b')][_0x67b1('0x1c')]=function(_0x1410c1){var _0x393ba0;_0x393ba0=_[_0x67b1('0x1d')](this['agents'],function(_0x4cbd26){return _0x4cbd26['accountcode']==_0x1410c1||_0x4cbd26[_0x67b1('0x1e')]==_0x1410c1;});if(_[_0x67b1('0x1f')](_0x393ba0)){var _0x396bda=_['find'](this['telephones'],function(_0x39da57){return _0x39da57[_0x67b1('0x20')]==_0x1410c1||_0x39da57[_0x67b1('0x1e')]==_0x1410c1;});if(_0x396bda){_0x393ba0=_[_0x67b1('0x1d')](this[_0x67b1('0xa')],function(_0x31cb90){return _0x31cb90[_0x67b1('0x21')]==util['format'](_0x67b1('0x22'),_0x396bda[_0x67b1('0x1e')]);});}}return _0x393ba0;};Report[_0x67b1('0x1b')][_0x67b1('0x10')]=function(_0x54f7be){for(var _0x18fff2=0x0;_0x18fff2<_0x54f7be[_0x67b1('0x23')];_0x18fff2+=0x1){var _0x5ea318=this[_0x67b1('0x1c')](_0x54f7be[_0x18fff2]['connectedlinenum']);if(_0x5ea318){_0x54f7be[_0x18fff2][_0x67b1('0x20')]=_0x5ea318[_0x67b1('0x20')];_0x54f7be[_0x18fff2][_0x67b1('0x24')]=!![];_0x54f7be[_0x18fff2]['lastAssignedTo']=_0x5ea318['name'];_0x54f7be[_0x18fff2][_0x67b1('0x21')]=_[_0x67b1('0x1f')](_0x5ea318[_0x67b1('0x21')])?util[_0x67b1('0x25')](_0x67b1('0x22'),_0x5ea318['name']):_0x5ea318['interface'];if(_0x54f7be[_0x18fff2][_0x67b1('0x26')]){_0x54f7be[_0x18fff2][_0x67b1('0x27')]=moment()['format'](_0x67b1('0x28'));}if(_0x54f7be[_0x18fff2][_0x67b1('0x29')]){_0x54f7be[_0x18fff2][_0x67b1('0x2a')]=moment()[_0x67b1('0x25')](_0x67b1('0x28'));}RpcMemberReport[_0x67b1('0x10')](_0x54f7be[_0x18fff2]);}RpcVoiceQueueReport[_0x67b1('0x2b')](_0x54f7be[_0x18fff2]);}};function extractCalleridNumber(_0x13f512){var _0xc61326=_0x13f512[_0x67b1('0x2c')](/<(.*?)>/);return _0xc61326?_0xc61326[0x1]:_0x13f512;}Report[_0x67b1('0x1b')][_0x67b1('0x2d')]=function(_0x1ec199){for(var _0x42a163=0x0;_0x42a1630x0?_0x90c4fc:0x0;this[_0xf9a5('0x12')][_0x4ffa7d[_0xf9a5('0x6b')]][_0xf9a5('0x30')]=this['voiceQueues'][_0x4ffa7d['queue']][_0xf9a5('0x30')]>_[_0xf9a5('0x70')](_0x4ffa7d['loggedin'])?_['toNumber'](_0x4ffa7d[_0xf9a5('0x72')]):this['voiceQueues'][_0x4ffa7d[_0xf9a5('0x6b')]]['talking'];this[_0xf9a5('0x52')](this['voiceQueues'][_0x4ffa7d[_0xf9a5('0x6b')]],_0xf9a5('0x73'));}logger[_0xf9a5('0x45')](_0xf9a5('0x74'),util[_0xf9a5('0x3c')](this[_0xf9a5('0x12')][_0x4ffa7d[_0xf9a5('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xf9a5('0x43')](_0xf9a5('0x75'),this[_0xf9a5('0x12')][_0x4ffa7d['queue']]);}}}catch(_0x41c7df){logger[_0xf9a5('0x3a')](_0xf9a5('0x69'),util[_0xf9a5('0x3c')](_0x41c7df,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf9a5('0x17')]=function(_0x4eee86){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xf9a5('0x3c')](_0x4eee86,{'showHidden':![],'depth':null}));ami[_0xf9a5('0x43')](_0xf9a5('0x76'),{});this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xf9a5('0x77')]=function(_0x603eaa){try{if(this[_0xf9a5('0x64')](_0x603eaa)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x603eaa[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x603eaa,{'showHidden':![],'depth':null}));if(_[_0xf9a5('0x78')](this[_0xf9a5('0xe')][_0x603eaa['uniqueid']]))this[_0xf9a5('0xe')][_0x603eaa[_0xf9a5('0x48')]]=[];if(_[_0xf9a5('0x78')](this[_0xf9a5('0x10')][_0x603eaa[_0xf9a5('0x48')]]))this[_0xf9a5('0x10')][_0x603eaa[_0xf9a5('0x48')]]={};var _0x28e22f=new QueueReport();_0x28e22f[_0xf9a5('0x4b')]=_0x603eaa['queue'];_0x28e22f['type']=this[_0xf9a5('0x12')][_0x28e22f[_0xf9a5('0x4b')]]&&this[_0xf9a5('0x12')][_0x28e22f[_0xf9a5('0x4b')]][_0xf9a5('0x5a')]?this['voiceQueues'][_0x28e22f[_0xf9a5('0x4b')]][_0xf9a5('0x5a')]||'inbound':_0xf9a5('0x53');_0x28e22f[_0xf9a5('0x6b')]=_0x603eaa[_0xf9a5('0x6b')];_0x28e22f['queuecallerjoinAt']=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));_0x28e22f['position']=_0x603eaa[_0xf9a5('0x7a')];_0x28e22f[_0xf9a5('0x7b')]=_0x603eaa[_0xf9a5('0x7b')];_0x28e22f[_0xf9a5('0x48')]=_0x603eaa[_0xf9a5('0x48')];_0x28e22f['routealias']=this[_0xf9a5('0x10')][_0x603eaa[_0xf9a5('0x48')]][_0xf9a5('0x7c')];logger[_0xf9a5('0x6c')](_0xf9a5('0x7d'),_0x28e22f[_0xf9a5('0x4b')],_0x28e22f[_0xf9a5('0x5a')]);_['merge'](_0x28e22f,_[_0xf9a5('0x7e')](_0x603eaa,_['keys'](_0x28e22f)));this[_0xf9a5('0xe')][_0x603eaa[_0xf9a5('0x48')]][_0xf9a5('0x7f')](_0x28e22f);this['channels'][_0x603eaa[_0xf9a5('0x48')]]=_0x28e22f;this[_0xf9a5('0x44')](_0x28e22f,'queuecallerjoin');}}catch(_0x50c9a2){logger['error'](_0xf9a5('0x80'),_0x603eaa[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x50c9a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0x1b')]=function(_0x1a058a){try{if(this[_0xf9a5('0x64')](_0x1a058a)){logger[_0xf9a5('0x45')](_0xf9a5('0x81'),_0x1a058a[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x1a058a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1a058a[_0xf9a5('0x48')]]){var _0x5c8460=_['last'](this[_0xf9a5('0xe')][_0x1a058a[_0xf9a5('0x48')]]);_0x5c8460[_0xf9a5('0x82')]=![];_0x5c8460[_0xf9a5('0x83')]=null;_0x5c8460[_0xf9a5('0x84')]=_0x1a058a['holdtime'];_0x5c8460['originalposition']=_0x1a058a[_0xf9a5('0x85')];_0x5c8460['queuecallerabandon']=!![];_0x5c8460[_0xf9a5('0x86')]=moment()[_0xf9a5('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c8460['queuecallerexitreason']='ABANDONED';_0x5c8460['lastAssignedTo']=null;logger[_0xf9a5('0x6c')](_0xf9a5('0x87'),_0x5c8460['name'],_0x5c8460['type']);this[_0xf9a5('0x10')][_0x1a058a[_0xf9a5('0x48')]]=_0x5c8460;this[_0xf9a5('0x41')](_0x5c8460,'queuecallerabandon');}}}catch(_0x605446){logger['error'](_0xf9a5('0x81'),_0x1a058a['uniqueid'],util[_0xf9a5('0x3c')](_0x605446,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0x1c')]=function(_0x1d7a7f){try{if(this[_0xf9a5('0x64')](_0x1d7a7f)){logger[_0xf9a5('0x45')](_0xf9a5('0x88'),_0x1d7a7f[_0xf9a5('0x48')],util['inspect'](_0x1d7a7f,{'showHidden':![],'depth':null}));if(this[_0xf9a5('0xe')][_0x1d7a7f[_0xf9a5('0x48')]]){var _0x719ac2=_[_0xf9a5('0x89')](this[_0xf9a5('0xe')][_0x1d7a7f[_0xf9a5('0x48')]]);_0x719ac2[_0xf9a5('0x8a')]=moment()['format'](_0xf9a5('0x79'));_0x719ac2[_0xf9a5('0x8b')]=_0x1d7a7f[_0xf9a5('0x8b')];_0x719ac2[_0xf9a5('0x8c')]=_0x1d7a7f[_0xf9a5('0x8c')];logger[_0xf9a5('0x6c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x719ac2[_0xf9a5('0x4b')],_0x719ac2[_0xf9a5('0x5a')],_0x1d7a7f[_0xf9a5('0x8b')],_0x1d7a7f[_0xf9a5('0x8c')]);this[_0xf9a5('0x10')][_0x1d7a7f[_0xf9a5('0x48')]]=_0x719ac2;this[_0xf9a5('0x44')](_0x719ac2,_0xf9a5('0x8d'));}}}catch(_0x2a7032){logger[_0xf9a5('0x3a')](_0xf9a5('0x88'),_0x1d7a7f[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x2a7032,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf9a5('0x8e')]=function(_0x381ebd){try{if(this[_0xf9a5('0x64')](_0x381ebd)){logger[_0xf9a5('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x381ebd[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x381ebd,{'showHidden':![],'depth':null}));if(this[_0xf9a5('0xe')][_0x381ebd[_0xf9a5('0x48')]]){var _0x544806=_[_0xf9a5('0x89')](this['queueReports'][_0x381ebd['uniqueid']]);_0x544806[_0xf9a5('0x82')]=!![];_0x544806['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xf9a5('0x6c')](_0xf9a5('0x8f'),_0x544806[_0xf9a5('0x4b')],_0x544806[_0xf9a5('0x5a')]);}}}catch(_0x483c9c){logger['error'](_0xf9a5('0x90'),_0x381ebd[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x483c9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0x1e')]=function(_0x509af9){try{if(this[_0xf9a5('0x64')](_0x509af9)){logger[_0xf9a5('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x509af9[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x509af9,{'showHidden':![],'depth':null}));if(this[_0xf9a5('0xe')][_0x509af9['uniqueid']]){var _0x56f611=_['last'](this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0x48')]]);_0x56f611[_0xf9a5('0x1a')]=![];_0x56f611[_0xf9a5('0x86')]=null;_0x56f611[_0xf9a5('0x91')]=!![];_0x56f611[_0xf9a5('0x92')]=_0x509af9[_0xf9a5('0x93')];_0x56f611[_0xf9a5('0x84')]=_0x509af9[_0xf9a5('0x84')];_0x56f611[_0xf9a5('0x82')]=!![];_0x56f611[_0xf9a5('0x94')]=![];_0x56f611[_0xf9a5('0x95')]=null;if(!_0x56f611['transfer']){if(_0x509af9[_0xf9a5('0x96')]=='transfer'){_0x56f611['queuecallerexitreason']=_0xf9a5('0x97');logger[_0xf9a5('0x6c')](_0xf9a5('0x98'),_0x56f611[_0xf9a5('0x4b')],_0x56f611['type']);}else{if(_['startsWith'](_0x509af9[_0xf9a5('0x99')]['toLowerCase'](),_0xf9a5('0x9a'))){if(this[_0xf9a5('0xe')][_0x509af9['linkedid']]){var _0x5b3db0=_[_0xf9a5('0x89')](this['queueReports'][_0x509af9['linkedid']]);_0x5b3db0[_0xf9a5('0x82')]=![];_0x5b3db0[_0xf9a5('0x94')]=!![];_0x5b3db0[_0xf9a5('0x95')]=moment(_0x56f611['queuecallerjoinAt'])[_0xf9a5('0x9b')](_0x509af9[_0xf9a5('0x84')],_0xf9a5('0x9c'))[_0xf9a5('0x49')](_0xf9a5('0x79'));_0x5b3db0[_0xf9a5('0x4f')]=_0xf9a5('0x9d');_0x5b3db0[_0xf9a5('0x9e')]=!![];_0x5b3db0['transfertype']=_0xf9a5('0x9f');_0x5b3db0[_0xf9a5('0xa0')]=_0x509af9['destexten'];_0x5b3db0[_0xf9a5('0xa1')]=_0x509af9[_0xf9a5('0x48')];logger[_0xf9a5('0x6c')](_0xf9a5('0xa2'),_0x5b3db0[_0xf9a5('0x4b')],_0x5b3db0['type']);var _0x380402=this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0xa3')]];this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0xa3')]]=this[_0xf9a5('0xe')][_0x509af9[_0xf9a5('0x48')]];this['queueReports'][_0x509af9[_0xf9a5('0x48')]]=_0x380402;}}else{_0x56f611[_0xf9a5('0x4f')]=_0xf9a5('0xa4')+_0x509af9['reason'][_0xf9a5('0xa5')]();logger[_0xf9a5('0x6c')](_0xf9a5('0xa6'),_0x56f611[_0xf9a5('0x4b')],_0x56f611['type'],_0x56f611['queuecallerexitreason']);}}}this[_0xf9a5('0x10')][_0x509af9[_0xf9a5('0x48')]]=_0x56f611;this[_0xf9a5('0x41')](_0x56f611,'agentcomplete');}}}catch(_0x7a2de8){logger['error'](_0xf9a5('0xa7'),_0x509af9[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x7a2de8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0xa8')]=function(_0x312c6b){try{if(this[_0xf9a5('0x64')](_0x312c6b)){logger[_0xf9a5('0x45')](_0xf9a5('0xa9'),_0x312c6b[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x312c6b,{'showHidden':![],'depth':null}));this['addVariable'](_0x312c6b[_0xf9a5('0x48')],_[_0xf9a5('0xaa')](_0x312c6b[_0xf9a5('0xab')])[0x0],_0x312c6b[_0xf9a5('0xac')]);if(this[_0xf9a5('0xe')][_0x312c6b[_0xf9a5('0x48')]]){var _0x4d95f4=_[_0xf9a5('0x89')](this[_0xf9a5('0xe')][_0x312c6b[_0xf9a5('0x48')]]);if(_0x4d95f4){if(this[_0xf9a5('0x64')](_0x312c6b['variable'])&&this[_0xf9a5('0x64')](_0x312c6b[_0xf9a5('0xab')][_0xf9a5('0xad')])){switch(_0x312c6b[_0xf9a5('0xac')]){case _0xf9a5('0xae'):_0x4d95f4[_0xf9a5('0x94')]=![];_0x4d95f4['queuecallerexitAt']=null;break;case _0xf9a5('0xaf'):_0x4d95f4[_0xf9a5('0xb0')]='timeout';_0x4d95f4[_0xf9a5('0x94')]=!![];_0x4d95f4[_0xf9a5('0x95')]=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));_0x4d95f4['queuecallerleaveAt']=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));logger[_0xf9a5('0x45')](_0xf9a5('0xb1'),_0x312c6b[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x4d95f4,{'showHidden':![],'depth':null}));ami[_0xf9a5('0x43')](_0xf9a5('0xb2'),_0x4d95f4);break;default:_0x4d95f4[_0xf9a5('0x94')]=!![];_0x4d95f4['queuecallerexitAt']=moment()[_0xf9a5('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d95f4[_0xf9a5('0x8a')]=moment()[_0xf9a5('0x49')](_0xf9a5('0x79'));}_0x4d95f4[_0xf9a5('0x1a')]=![];_0x4d95f4[_0xf9a5('0x86')]=null;_0x4d95f4[_0xf9a5('0x4f')]=_0x312c6b[_0xf9a5('0xac')];this[_0xf9a5('0x10')][_0x312c6b[_0xf9a5('0x48')]]=_0x4d95f4;this[_0xf9a5('0x41')](_0x4d95f4,'varset');}else if(this[_0xf9a5('0x64')](_0x312c6b[_0xf9a5('0xab')])&&this[_0xf9a5('0x64')](_0x312c6b[_0xf9a5('0xab')]['queueposition'])){if(!_0x4d95f4[_0xf9a5('0x1a')]){_0x4d95f4[_0xf9a5('0x94')]=!![];_0x4d95f4[_0xf9a5('0x95')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d95f4['queuecallerexitreason']=_0xf9a5('0xb3');_0x4d95f4[_0xf9a5('0x8a')]=moment()[_0xf9a5('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf9a5('0x10')][_0x312c6b['uniqueid']]=_0x4d95f4;}}logger[_0xf9a5('0x6c')](_0xf9a5('0xb4'),_0x312c6b['uniqueid'],_0x4d95f4[_0xf9a5('0x4b')],_0x4d95f4[_0xf9a5('0x5a')],_[_0xf9a5('0xaa')](_0x312c6b[_0xf9a5('0xab')])[0x0],_0x312c6b['value']);_0x4d95f4[_0xf9a5('0x15')]=this[_0xf9a5('0x15')][_0x312c6b[_0xf9a5('0x48')]];}}}}catch(_0x4e296e){logger[_0xf9a5('0x3a')]('[%s][voiceQueueReport][varset]',_0x312c6b[_0xf9a5('0x48')],util[_0xf9a5('0x3c')](_0x4e296e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9a5('0x34')][_0xf9a5('0xb5')]=function(_0x4afb31,_0x536f3b,_0x4706a7){var _0x42fbde=[_0xf9a5('0xb6'),_0xf9a5('0xb7'),_0xf9a5('0xb8'),'rtpaudioqosjitterbridged',_0xf9a5('0xb9'),_0xf9a5('0xba'),_0xf9a5('0xbb'),'rtpaudioqosrttbridged',_0xf9a5('0xbc'),_0xf9a5('0xbd'),'bridgepeer',_0xf9a5('0xbe'),_0xf9a5('0xbf'),_0xf9a5('0xc0'),_0xf9a5('0xc1'),_0xf9a5('0xc2'),_0xf9a5('0x93'),_0xf9a5('0xc3'),'memberrealtime'];if(!_[_0xf9a5('0x36')](_0x536f3b)&&!_[_0xf9a5('0xc4')](_0x42fbde,_0x536f3b)){if(_[_0xf9a5('0x78')](this['variables'][_0x4afb31])){this[_0xf9a5('0x15')][_0x4afb31]={};}this[_0xf9a5('0x15')][_0x4afb31][_0x536f3b]=_0x4706a7;}};VoiceQueueReport['prototype'][_0xf9a5('0xc5')]=function(_0x232993,_0x9f9053,_0xd8d509){var _0x1bf735={};for(var _0x9925a2=0x0;_0x9925a20x0?_0x58bf82:0x0;this['voiceQueues'][_0x43364c[_0xef00('0x6d')]]['talking']=this[_0xef00('0x15')][_0x43364c[_0xef00('0x6d')]][_0xef00('0x35')]>_[_0xef00('0x71')](_0x43364c[_0xef00('0x72')])?_[_0xef00('0x71')](_0x43364c[_0xef00('0x72')]):this[_0xef00('0x15')][_0x43364c[_0xef00('0x6d')]]['talking'];this[_0xef00('0x58')](this[_0xef00('0x15')][_0x43364c['queue']],_0xef00('0x73'));}logger[_0xef00('0x4a')](_0xef00('0x74'),util[_0xef00('0x43')](this[_0xef00('0x15')][_0x43364c[_0xef00('0x6d')]],{'showHidden':![],'depth':null}));ami[_0xef00('0x49')](_0xef00('0x75'),this['voiceQueues'][_0x43364c[_0xef00('0x6d')]]);}}}catch(_0x55ffe9){logger[_0xef00('0x42')](_0xef00('0x6b'),util[_0xef00('0x43')](_0x55ffe9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef00('0xd')][_0xef00('0x1c')]=function(_0x58aae0){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xef00('0x43')](_0x58aae0,{'showHidden':![],'depth':null}));ami[_0xef00('0x49')]('custom:queuesummarycomplete',{});this[_0xef00('0x16')]=!![];};VoiceQueueReport['prototype'][_0xef00('0x1d')]=function(_0x5b4cfe){try{if(this[_0xef00('0x6c')](_0x5b4cfe)){logger[_0xef00('0x4a')](_0xef00('0x76'),_0x5b4cfe[_0xef00('0x4d')],util[_0xef00('0x43')](_0x5b4cfe,{'showHidden':![],'depth':null}));if(_[_0xef00('0x68')](this[_0xef00('0x11')][_0x5b4cfe[_0xef00('0x4d')]]))this['queueReports'][_0x5b4cfe[_0xef00('0x4d')]]=[];if(_[_0xef00('0x68')](this[_0xef00('0x13')][_0x5b4cfe[_0xef00('0x4d')]]))this[_0xef00('0x13')][_0x5b4cfe['uniqueid']]={};var _0xfc6cdd=new QueueReport();_0xfc6cdd[_0xef00('0x4f')]=_0x5b4cfe[_0xef00('0x6d')];_0xfc6cdd[_0xef00('0x59')]=this[_0xef00('0x15')][_0xfc6cdd[_0xef00('0x4f')]]&&this[_0xef00('0x15')][_0xfc6cdd[_0xef00('0x4f')]][_0xef00('0x59')]?this[_0xef00('0x15')][_0xfc6cdd[_0xef00('0x4f')]][_0xef00('0x59')]||_0xef00('0x5a'):'inbound';_0xfc6cdd[_0xef00('0x6d')]=_0x5b4cfe['queue'];_0xfc6cdd[_0xef00('0x77')]=moment()[_0xef00('0x55')](_0xef00('0x78'));_0xfc6cdd[_0xef00('0x79')]=_0x5b4cfe[_0xef00('0x79')];_0xfc6cdd[_0xef00('0x7a')]=_0x5b4cfe['count'];_0xfc6cdd[_0xef00('0x4d')]=_0x5b4cfe[_0xef00('0x4d')];_0xfc6cdd[_0xef00('0x7b')]=this['channels'][_0x5b4cfe['uniqueid']]['routealias'];logger[_0xef00('0x7c')](_0xef00('0x7d'),_0xfc6cdd[_0xef00('0x4f')],_0xfc6cdd[_0xef00('0x59')]);_[_0xef00('0x7e')](_0xfc6cdd,_[_0xef00('0x7f')](_0x5b4cfe,_[_0xef00('0x80')](_0xfc6cdd)));this['queueReports'][_0x5b4cfe[_0xef00('0x4d')]]['push'](_0xfc6cdd);this[_0xef00('0x13')][_0x5b4cfe[_0xef00('0x4d')]]=_0xfc6cdd;this['emitVoiceQueueChannelSave'](_0xfc6cdd,'queuecallerjoin');}}catch(_0x2fbb7c){logger[_0xef00('0x42')](_0xef00('0x76'),_0x5b4cfe[_0xef00('0x4d')],util['inspect'](_0x2fbb7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef00('0x1e')]=function(_0x22a425){try{if(this[_0xef00('0x6c')](_0x22a425)){logger[_0xef00('0x4a')](_0xef00('0x81'),_0x22a425[_0xef00('0x4d')],util['inspect'](_0x22a425,{'showHidden':![],'depth':null}));if(this[_0xef00('0x11')][_0x22a425[_0xef00('0x4d')]]){var _0x4ee5e5=_[_0xef00('0x82')](this[_0xef00('0x11')][_0x22a425[_0xef00('0x4d')]]);_0x4ee5e5[_0xef00('0x83')]=![];_0x4ee5e5[_0xef00('0x84')]=null;_0x4ee5e5[_0xef00('0x85')]=_0x22a425[_0xef00('0x85')];_0x4ee5e5[_0xef00('0x86')]=_0x22a425[_0xef00('0x86')];_0x4ee5e5[_0xef00('0x87')]=!![];_0x4ee5e5[_0xef00('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4ee5e5[_0xef00('0x53')]='ABANDONED';_0x4ee5e5['lastAssignedTo']=null;logger[_0xef00('0x7c')](_0xef00('0x89'),_0x4ee5e5['name'],_0x4ee5e5['type']);this[_0xef00('0x13')][_0x22a425[_0xef00('0x4d')]]=_0x4ee5e5;this[_0xef00('0x8a')](_0x4ee5e5,'queuecallerabandon');}}}catch(_0x5c6d80){logger[_0xef00('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x22a425[_0xef00('0x4d')],util['inspect'](_0x5c6d80,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef00('0xd')][_0xef00('0x20')]=function(_0xd65cd6){try{if(this[_0xef00('0x6c')](_0xd65cd6)){logger[_0xef00('0x4a')](_0xef00('0x8b'),_0xd65cd6[_0xef00('0x4d')],util[_0xef00('0x43')](_0xd65cd6,{'showHidden':![],'depth':null}));if(this[_0xef00('0x11')][_0xd65cd6[_0xef00('0x4d')]]){var _0x4aee22=_[_0xef00('0x82')](this[_0xef00('0x11')][_0xd65cd6[_0xef00('0x4d')]]);_0x4aee22[_0xef00('0x8c')]=moment()[_0xef00('0x55')](_0xef00('0x78'));_0x4aee22[_0xef00('0x8d')]=_0xd65cd6[_0xef00('0x8d')];_0x4aee22[_0xef00('0x8e')]=_0xd65cd6[_0xef00('0x8e')];logger[_0xef00('0x7c')](_0xef00('0x8f'),_0x4aee22[_0xef00('0x4f')],_0x4aee22[_0xef00('0x59')],_0xd65cd6[_0xef00('0x8d')],_0xd65cd6[_0xef00('0x8e')]);this[_0xef00('0x13')][_0xd65cd6[_0xef00('0x4d')]]=_0x4aee22;this[_0xef00('0x90')](_0x4aee22,'queuecallerleave');}}}catch(_0x24cba9){logger[_0xef00('0x42')](_0xef00('0x8b'),_0xd65cd6[_0xef00('0x4d')],util[_0xef00('0x43')](_0x24cba9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x4d71cc){try{if(this[_0xef00('0x6c')](_0x4d71cc)){logger[_0xef00('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x4d71cc[_0xef00('0x4d')],util[_0xef00('0x43')](_0x4d71cc,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4d71cc[_0xef00('0x4d')]]){var _0x168928=_[_0xef00('0x82')](this[_0xef00('0x11')][_0x4d71cc[_0xef00('0x4d')]]);_0x168928['queuecallercomplete']=!![];_0x168928[_0xef00('0x53')]=_0xef00('0x91');logger[_0xef00('0x7c')](_0xef00('0x92'),_0x168928[_0xef00('0x4f')],_0x168928[_0xef00('0x59')]);}}}catch(_0x563ccb){logger[_0xef00('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x4d71cc[_0xef00('0x4d')],util[_0xef00('0x43')](_0x563ccb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef00('0xd')][_0xef00('0x21')]=function(_0x54b2f3){try{if(this[_0xef00('0x6c')](_0x54b2f3)){logger[_0xef00('0x4a')](_0xef00('0x93'),_0x54b2f3[_0xef00('0x4d')],util[_0xef00('0x43')](_0x54b2f3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x54b2f3[_0xef00('0x4d')]]){var _0x35e9d5=_[_0xef00('0x82')](this[_0xef00('0x11')][_0x54b2f3[_0xef00('0x4d')]]);_0x35e9d5[_0xef00('0x87')]=![];_0x35e9d5['queuecallerabandonAt']=null;_0x35e9d5[_0xef00('0x94')]=!![];_0x35e9d5[_0xef00('0x95')]=_0x54b2f3['membername'];_0x35e9d5[_0xef00('0x85')]=_0x54b2f3[_0xef00('0x85')];_0x35e9d5[_0xef00('0x83')]=!![];_0x35e9d5[_0xef00('0x96')]=![];_0x35e9d5[_0xef00('0x97')]=null;if(!_0x35e9d5['transfer']){if(_0x54b2f3[_0xef00('0x98')]==_0xef00('0x99')){_0x35e9d5['queuecallerexitreason']=_0xef00('0x9a');logger[_0xef00('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x35e9d5[_0xef00('0x4f')],_0x35e9d5[_0xef00('0x59')]);}else{if(_[_0xef00('0x9b')](_0x54b2f3[_0xef00('0x3e')][_0xef00('0x9c')](),_0xef00('0x9d'))){if(this[_0xef00('0x11')][_0x54b2f3['linkedid']]){var _0x277867=_[_0xef00('0x82')](this['queueReports'][_0x54b2f3[_0xef00('0x9e')]]);_0x277867[_0xef00('0x83')]=![];_0x277867[_0xef00('0x96')]=!![];_0x277867['queuecallerexitAt']=moment(_0x35e9d5[_0xef00('0x77')])[_0xef00('0x9f')](_0x54b2f3['holdtime'],'seconds')['format'](_0xef00('0x78'));_0x277867[_0xef00('0x53')]=_0xef00('0xa0');_0x277867[_0xef00('0x99')]=!![];_0x277867[_0xef00('0xa1')]=_0xef00('0xa2');_0x277867[_0xef00('0xa3')]=_0x54b2f3[_0xef00('0xa4')];_0x277867['transferuniqueid']=_0x54b2f3[_0xef00('0x4d')];logger[_0xef00('0x7c')](_0xef00('0xa5'),_0x277867[_0xef00('0x4f')],_0x277867[_0xef00('0x59')]);var _0x19b0ec=this[_0xef00('0x11')][_0x54b2f3[_0xef00('0x9e')]];this[_0xef00('0x11')][_0x54b2f3[_0xef00('0x9e')]]=this[_0xef00('0x11')][_0x54b2f3[_0xef00('0x4d')]];this['queueReports'][_0x54b2f3[_0xef00('0x4d')]]=_0x19b0ec;}}else{_0x35e9d5[_0xef00('0x53')]=_0xef00('0xa6')+_0x54b2f3[_0xef00('0x98')][_0xef00('0xa7')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x35e9d5['name'],_0x35e9d5['type'],_0x35e9d5[_0xef00('0x53')]);}}}this['channels'][_0x54b2f3[_0xef00('0x4d')]]=_0x35e9d5;this['emitVoiceQueueChannelRemove'](_0x35e9d5,'agentcomplete');}}}catch(_0x5e0b86){logger[_0xef00('0x42')](_0xef00('0x93'),_0x54b2f3[_0xef00('0x4d')],util[_0xef00('0x43')](_0x5e0b86,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef00('0xd')][_0xef00('0x24')]=function(_0x30e2e9){try{if(this['isNotNull'](_0x30e2e9)){logger[_0xef00('0x4a')](_0xef00('0xa8'),_0x30e2e9[_0xef00('0x4d')],util[_0xef00('0x43')](_0x30e2e9,{'showHidden':![],'depth':null}));this[_0xef00('0xa9')](_0x30e2e9[_0xef00('0x4d')],_['keys'](_0x30e2e9[_0xef00('0xaa')])[0x0],_0x30e2e9[_0xef00('0xab')]);if(this['queueReports'][_0x30e2e9[_0xef00('0x4d')]]){var _0x2c4fde=_['last'](this['queueReports'][_0x30e2e9[_0xef00('0x4d')]]);if(_0x2c4fde){if(this[_0xef00('0x6c')](_0x30e2e9[_0xef00('0xaa')])&&this[_0xef00('0x6c')](_0x30e2e9[_0xef00('0xaa')][_0xef00('0xac')])){switch(_0x30e2e9[_0xef00('0xab')]){case _0xef00('0xad'):_0x2c4fde[_0xef00('0x96')]=![];_0x2c4fde['queuecallerexitAt']=null;break;case'TIMEOUT':_0x2c4fde[_0xef00('0xae')]=_0xef00('0xaf');_0x2c4fde[_0xef00('0x96')]=!![];_0x2c4fde[_0xef00('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c4fde[_0xef00('0x8c')]=moment()[_0xef00('0x55')](_0xef00('0x78'));logger[_0xef00('0x4a')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x30e2e9[_0xef00('0x4d')],util[_0xef00('0x43')](_0x2c4fde,{'showHidden':![],'depth':null}));ami[_0xef00('0x49')](_0xef00('0xb0'),_0x2c4fde);break;default:_0x2c4fde[_0xef00('0x96')]=!![];_0x2c4fde[_0xef00('0x97')]=moment()[_0xef00('0x55')](_0xef00('0x78'));_0x2c4fde[_0xef00('0x8c')]=moment()[_0xef00('0x55')](_0xef00('0x78'));}_0x2c4fde[_0xef00('0x87')]=![];_0x2c4fde['queuecallerabandonAt']=null;_0x2c4fde[_0xef00('0x53')]=_0x30e2e9[_0xef00('0xab')];this[_0xef00('0x13')][_0x30e2e9[_0xef00('0x4d')]]=_0x2c4fde;this[_0xef00('0x8a')](_0x2c4fde,_0xef00('0x23'));}else if(this['isNotNull'](_0x30e2e9['variable'])&&this[_0xef00('0x6c')](_0x30e2e9[_0xef00('0xaa')][_0xef00('0xb1')])){if(!_0x2c4fde[_0xef00('0x87')]){_0x2c4fde['queuecallerexit']=!![];_0x2c4fde[_0xef00('0x97')]=moment()[_0xef00('0x55')](_0xef00('0x78'));_0x2c4fde[_0xef00('0x53')]=_0xef00('0xb2');_0x2c4fde[_0xef00('0x8c')]=moment()['format'](_0xef00('0x78'));this[_0xef00('0x13')][_0x30e2e9[_0xef00('0x4d')]]=_0x2c4fde;}}logger[_0xef00('0x7c')](_0xef00('0xb3'),_0x30e2e9[_0xef00('0x4d')],_0x2c4fde['name'],_0x2c4fde[_0xef00('0x59')],_[_0xef00('0x80')](_0x30e2e9[_0xef00('0xaa')])[0x0],_0x30e2e9[_0xef00('0xab')]);_0x2c4fde[_0xef00('0x18')]=this[_0xef00('0x18')][_0x30e2e9['uniqueid']];}}}}catch(_0x6434e8){logger[_0xef00('0x42')](_0xef00('0xa8'),_0x30e2e9[_0xef00('0x4d')],util[_0xef00('0x43')](_0x6434e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef00('0xa9')]=function(_0x464cb2,_0x426c56,_0x2bf79e){var _0x42a85c=[_0xef00('0xb4'),_0xef00('0xb5'),_0xef00('0xb6'),_0xef00('0xb7'),_0xef00('0xb8'),'rtpaudioqoslossbridged',_0xef00('0xb9'),_0xef00('0xba'),_0xef00('0xbb'),_0xef00('0xbc'),_0xef00('0xbd'),_0xef00('0xbe'),_0xef00('0xbf'),_0xef00('0xc0'),_0xef00('0xc1'),_0xef00('0xc2'),_0xef00('0xc3'),_0xef00('0xc4'),_0xef00('0xc5')];if(!_[_0xef00('0x3b')](_0x426c56)&&!_[_0xef00('0xc6')](_0x42a85c,_0x426c56)){if(_['isUndefined'](this[_0xef00('0x18')][_0x464cb2])){this[_0xef00('0x18')][_0x464cb2]={};}this[_0xef00('0x18')][_0x464cb2][_0x426c56]=_0x2bf79e;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x450024,_0x7158b2,_0x5c1e96){var _0x9f1a3e={};for(var _0xe63ed3=0x0;_0xe63ed3=0x0?moment(_0x54aa16['endtime'])[_0x92db('0x14')](_0x54aa16[_0x92db('0x15')],_0x92db('0x16')):null,'data1':'outbound','data2':_0x54aa16['accountcode'],'data3':_0x54aa16[_0x92db('0xe')],'data4':_0x54aa16[_0x92db('0x17')]||null,'role':_0x92db('0x10'),'internal':_0x54aa16[_0x92db('0x11')]?_[_0x92db('0x12')](_0x54aa16[_0x92db('0x11')]):undefined,'uniqueid':_0x54aa16['uniqueid']},'log':_0x92db('0x7')});}; \ No newline at end of file +var _0x4f2e=['accountcode','uniqueid','membername','TALKING','starttime','endtime','diff','exten','dialstring','toNumber','moment','lodash','util','../client','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','queuecallerleaveAt','seconds','inbound','calleridnum','queue','agent'];(function(_0x16d1b6,_0x5912db){var _0x2ca1f5=function(_0x219bda){while(--_0x219bda){_0x16d1b6['push'](_0x16d1b6['shift']());}};_0x2ca1f5(++_0x5912db);}(_0x4f2e,0x183));var _0xe4f2=function(_0x470b24,_0x58a01e){_0x470b24=_0x470b24-0x0;var _0xde9b3d=_0x4f2e[_0x470b24];return _0xde9b3d;};'use strict';var moment=require(_0xe4f2('0x0'));var _=require(_0xe4f2('0x1'));var util=require(_0xe4f2('0x2'));var client=require(_0xe4f2('0x3'));exports['voiceQueueReport']=function(_0x5817c0){var _0x5b7b7d=_0x5817c0[_0xe4f2('0x4')]||_0x5817c0['queuecallerexitAt'];return client[_0xe4f2('0x5')](_0xe4f2('0x6'),{'body':{'channel':_0xe4f2('0x7'),'membername':_0x5817c0[_0xe4f2('0x8')],'interface':_[_0xe4f2('0x9')](_0x5817c0['interface'])?util[_0xe4f2('0xa')](_0xe4f2('0xb'),_0x5817c0['lastAssignedTo']):_0x5817c0[_0xe4f2('0xc')],'type':'TALKING','enterAt':_0x5817c0['queuecallerleaveAt'],'exitAt':_0x5b7b7d,'duration':moment(_0x5b7b7d)['diff'](_0x5817c0[_0xe4f2('0xd')],_0xe4f2('0xe')),'data1':_0xe4f2('0xf'),'data2':_0x5817c0[_0xe4f2('0x10')],'data3':_0x5817c0['exten'],'data4':null,'data5':_0x5817c0[_0xe4f2('0x11')],'role':_0xe4f2('0x12'),'internal':_0x5817c0[_0xe4f2('0x13')]?_['toNumber'](_0x5817c0['accountcode']):undefined,'uniqueid':_0x5817c0[_0xe4f2('0x14')]},'log':_0xe4f2('0x6')});};exports['voiceDialReport']=function(_0x64388){return client[_0xe4f2('0x5')](_0xe4f2('0x6'),{'body':{'channel':_0xe4f2('0x7'),'membername':_0x64388[_0xe4f2('0x15')],'interface':_0x64388[_0xe4f2('0xc')],'type':_0xe4f2('0x16'),'enterAt':_0x64388[_0xe4f2('0x17')],'exitAt':_0x64388[_0xe4f2('0x18')],'duration':moment(_0x64388[_0xe4f2('0x18')])[_0xe4f2('0x19')](_0x64388[_0xe4f2('0x17')],'seconds')>=0x0?moment(_0x64388[_0xe4f2('0x18')])[_0xe4f2('0x19')](_0x64388[_0xe4f2('0x17')],_0xe4f2('0xe')):null,'data1':'outbound','data2':_0x64388['accountcode'],'data3':_0x64388[_0xe4f2('0x1a')],'data4':_0x64388[_0xe4f2('0x1b')]||null,'role':_0xe4f2('0x12'),'internal':_0x64388[_0xe4f2('0x13')]?_[_0xe4f2('0x1c')](_0x64388[_0xe4f2('0x13')]):undefined,'uniqueid':_0x64388[_0xe4f2('0x14')]},'log':_0xe4f2('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 45c6879..155681e 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 _0xbb84=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbb84,0x158));var _0x4bb8=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xbb84[_0x487496];return _0x539dc8;};'use strict';var client=require(_0x4bb8('0x0'));exports[_0x4bb8('0x1')]=function(){return client[_0x4bb8('0x2')](_0x4bb8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x4bb8('0x4')]},'log':_0x4bb8('0x5')});}; \ No newline at end of file +var _0x63a2=['GetSettings','../client','getSettings','ShowSetting','previewRecallmeReminderInterval'];(function(_0x5ef3b6,_0x3a03a6){var _0x119ae7=function(_0x2506d3){while(--_0x2506d3){_0x5ef3b6['push'](_0x5ef3b6['shift']());}};_0x119ae7(++_0x3a03a6);}(_0x63a2,0x1e1));var _0x263a=function(_0x469586,_0xca9059){_0x469586=_0x469586-0x0;var _0x18f343=_0x63a2[_0x469586];return _0x18f343;};'use strict';var client=require(_0x263a('0x0'));exports[_0x263a('0x1')]=function(){return client['Request'](_0x263a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x263a('0x3')]},'log':_0x263a('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d5b1162..dcd7cc1 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 _0x2584=['html','../client','Request','GetTemplate'];(function(_0x355fd4,_0x224a5f){var _0x242b66=function(_0x8ebd40){while(--_0x8ebd40){_0x355fd4['push'](_0x355fd4['shift']());}};_0x242b66(++_0x224a5f);}(_0x2584,0x155));var _0x4258=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0x2584[_0x42bfb7];return _0x5c497d;};'use strict';var client=require(_0x4258('0x0'));exports['getTemplates']=function(_0x428352){return function(_0x3ee7d7){return client[_0x4258('0x1')](_0x4258('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x4258('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xbf77=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x8d34d4,_0xc6e1cf){var _0x5ada4a=function(_0x129eec){while(--_0x129eec){_0x8d34d4['push'](_0x8d34d4['shift']());}};_0x5ada4a(++_0xc6e1cf);}(_0xbf77,0xec));var _0x7bf7=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xbf77[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require(_0x7bf7('0x0'));exports[_0x7bf7('0x1')]=function(_0x25351a){return function(_0xecd8d2){return client[_0x7bf7('0x2')](_0x7bf7('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7bf7('0x4'),_0x7bf7('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index aa28519..8f96ee4 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 _0x97c5=['data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Actions','action','data2','data3','data4','data5','data6'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x97c5,0x1b6));var _0x597c=function(_0x4abb33,_0x160d22){_0x4abb33=_0x4abb33-0x0;var _0x3d7026=_0x97c5[_0x4abb33];return _0x3d7026;};'use strict';var client=require('../client');exports[_0x597c('0x0')]=function(_0x14abc2){return function(_0xaa9fb3){return client[_0x597c('0x1')](_0x597c('0x2'),{'options':{'raw':![],'attributes':['id',_0x597c('0x3'),_0x597c('0x4'),'status'],'include':[{'model':_0x597c('0x5'),'as':_0x597c('0x6'),'attributes':['id',_0x597c('0x7'),_0x597c('0x8'),_0x597c('0x9')]},{'model':'Condition','as':_0x597c('0xa'),'attributes':['id','field',_0x597c('0x8'),_0x597c('0x9')]},{'model':'Action','as':_0x597c('0xb'),'attributes':['id',_0x597c('0xc'),'data1',_0x597c('0xd'),_0x597c('0xe'),_0x597c('0xf'),_0x597c('0x10'),_0x597c('0x11'),_0x597c('0x12')]}]},'log':_0x597c('0x2')});};}; \ No newline at end of file +var _0xb549=['getTriggers','Request','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','data3','data5','data6','data7','GetTrigger','../client'];(function(_0x3ea360,_0x4a3b9e){var _0x330457=function(_0x3c221a){while(--_0x3c221a){_0x3ea360['push'](_0x3ea360['shift']());}};_0x330457(++_0x4a3b9e);}(_0xb549,0x155));var _0x9b54=function(_0x53ddc9,_0x52a3fa){_0x53ddc9=_0x53ddc9-0x0;var _0x195a4c=_0xb549[_0x53ddc9];return _0x195a4c;};'use strict';var client=require(_0x9b54('0x0'));exports[_0x9b54('0x1')]=function(_0x26d426){return function(_0x23ea5c){return client[_0x9b54('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x9b54('0x3'),_0x9b54('0x4'),_0x9b54('0x5')],'include':[{'model':_0x9b54('0x6'),'as':_0x9b54('0x7'),'attributes':['id',_0x9b54('0x8'),_0x9b54('0x9'),'value']},{'model':_0x9b54('0x6'),'as':_0x9b54('0xa'),'attributes':['id','field','operator',_0x9b54('0xb')]},{'model':_0x9b54('0xc'),'as':_0x9b54('0xd'),'attributes':['id','action','data1','data2',_0x9b54('0xe'),'data4',_0x9b54('0xf'),_0x9b54('0x10'),_0x9b54('0x11')]}]},'log':_0x9b54('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f45af91..90cd80c 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 _0xb734=['getTrunks','Request','GetTrunk','../client'];(function(_0x121ee7,_0x344b91){var _0x147a9e=function(_0x4f052c){while(--_0x4f052c){_0x121ee7['push'](_0x121ee7['shift']());}};_0x147a9e(++_0x344b91);}(_0xb734,0xe3));var _0x4b73=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0xb734[_0x2be104];return _0x31c115;};'use strict';var client=require(_0x4b73('0x0'));exports[_0x4b73('0x1')]=function(_0x3c586e){return function(_0x19d14b){return client[_0x4b73('0x2')](_0x4b73('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry','defaultuser']},'log':_0x4b73('0x3')});};}; \ No newline at end of file +var _0x9b60=['../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x516403,_0x497c76){var _0x46419e=function(_0x1baed4){while(--_0x1baed4){_0x516403['push'](_0x516403['shift']());}};_0x46419e(++_0x497c76);}(_0x9b60,0x174));var _0x09b6=function(_0x1531ee,_0x457776){_0x1531ee=_0x1531ee-0x0;var _0x1e1773=_0x9b60[_0x1531ee];return _0x1e1773;};'use strict';var client=require(_0x09b6('0x0'));exports[_0x09b6('0x1')]=function(_0x3220ce){return function(_0x23aee){return client[_0x09b6('0x2')](_0x09b6('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x09b6('0x4'),_0x09b6('0x5'),'defaultuser']},'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 8f4f39d..38e24a7 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x9e26ff,_0x84ca10){var _0x3087bb=function(_0x1c4908){while(--_0x1c4908){_0x9e26ff['push'](_0x9e26ff['shift']());}};_0x3087bb(++_0x84ca10);}(_0xedd9,0xfc));var _0x9edd=function(_0x697f53,_0x3e55bd){_0x697f53=_0x697f53-0x0;var _0x3465cf=_0xedd9[_0x697f53];return _0x3465cf;};'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 +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x4d7a48,_0x4acf81){var _0x1ac976=function(_0x468ff8){while(--_0x468ff8){_0x4d7a48['push'](_0x4d7a48['shift']());}};_0x1ac976(++_0x4acf81);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 00028cd..f364130 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 _0xcc9b=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xcc9b,0x138));var _0xbcc9=function(_0x3e0272,_0x205c23){_0x3e0272=_0x3e0272-0x0;var _0x536b19=_0xcc9b[_0x3e0272];return _0x536b19;};'use strict';var client=require(_0xbcc9('0x0'));exports[_0xbcc9('0x1')]=function(_0x38da8b){return client['Request'](_0xbcc9('0x2'),{'body':_0x38da8b,'log':_0xbcc9('0x2')});};exports[_0xbcc9('0x3')]=function(_0x59eebf,_0x586f5c,_0x17cd0a){return client[_0xbcc9('0x4')](_0xbcc9('0x5'),{'body':_0x59eebf,'options':{'where':{'uniqueid':_0x586f5c,'interface':_0x17cd0a,'agentcomplete':!![]}},'log':_0xbcc9('0x5')});}; \ No newline at end of file +var _0x9a79=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x1712e3,_0x36fb68){var _0x52dd31=function(_0x159777){while(--_0x159777){_0x1712e3['push'](_0x1712e3['shift']());}};_0x52dd31(++_0x36fb68);}(_0x9a79,0x17f));var _0x99a7=function(_0x582592,_0x19204e){_0x582592=_0x582592-0x0;var _0x365ce1=_0x9a79[_0x582592];return _0x365ce1;};'use strict';var client=require(_0x99a7('0x0'));exports[_0x99a7('0x1')]=function(_0x208832){return client['Request'](_0x99a7('0x2'),{'body':_0x208832,'log':_0x99a7('0x2')});};exports[_0x99a7('0x3')]=function(_0x58e335,_0x147936,_0x1906a4){return client[_0x99a7('0x4')](_0x99a7('0x5'),{'body':_0x58e335,'options':{'where':{'uniqueid':_0x147936,'interface':_0x1906a4,'agentcomplete':!![]}},'log':_0x99a7('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 5daab2a..c23f4fe 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 _0x89c9=['disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x89c9,0x163));var _0x989c=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x89c9[_0x3e0191];return _0xf2ae83;};'use strict';var moment=require('moment');var util=require(_0x989c('0x0'));var _=require(_0x989c('0x1'));var client=require(_0x989c('0x2'));exports[_0x989c('0x3')]=function(_0x4ab78f){return client[_0x989c('0x4')](_0x989c('0x5'),{'body':_[_0x989c('0x6')](_0x4ab78f,{'source':_0x4ab78f[_0x989c('0x7')],'destinationcontext':_0x4ab78f[_0x989c('0x8')],'callerid':_0x4ab78f[_0x989c('0x9')],'amaflags':_0x989c('0xa')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x989c('0x4')](_0x989c('0xb'),{'options':{'where':{'type':[_0x989c('0xc')],'createdAt':{'$between':[moment()[_0x989c('0xd')](_0x989c('0xe'))['format'](_0x989c('0xf')),moment()[_0x989c('0x10')]('day')[_0x989c('0x11')](_0x989c('0xf'))]}},'attributes':[_0x989c('0x12'),_0x989c('0x13'),_0x989c('0x14'),'billableseconds']},'log':_0x989c('0x15')});};}; \ No newline at end of file +var _0x0ef5=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x0ef5,0x121));var _0x50ef=function(_0x31005b,_0x300c99){_0x31005b=_0x31005b-0x0;var _0x8c5b50=_0x0ef5[_0x31005b];return _0x8c5b50;};'use strict';var moment=require('moment');var util=require(_0x50ef('0x0'));var _=require(_0x50ef('0x1'));var client=require(_0x50ef('0x2'));exports[_0x50ef('0x3')]=function(_0x566a53){return client[_0x50ef('0x4')](_0x50ef('0x5'),{'body':_[_0x50ef('0x6')](_0x566a53,{'source':_0x566a53[_0x50ef('0x7')],'destinationcontext':_0x566a53[_0x50ef('0x8')],'callerid':_0x566a53[_0x50ef('0x9')],'amaflags':_0x50ef('0xa')}),'log':_0x50ef('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x50ef('0xb')],'createdAt':{'$between':[moment()[_0x50ef('0xc')](_0x50ef('0xd'))[_0x50ef('0xe')](_0x50ef('0xf')),moment()[_0x50ef('0x10')](_0x50ef('0xd'))[_0x50ef('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x50ef('0x11'),_0x50ef('0x12'),_0x50ef('0x13'),'billableseconds']},'log':_0x50ef('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f6c4494..edd3737 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 _0x2a71=['CreateVoiceDialReport','../client','Request'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x2a71,0x13c));var _0x12a7=function(_0x3d9167,_0x2439d3){_0x3d9167=_0x3d9167-0x0;var _0x3c85be=_0x2a71[_0x3d9167];return _0x3c85be;};'use strict';var client=require(_0x12a7('0x0'));exports['create']=function(_0x4b76f8){return client[_0x12a7('0x1')]('CreateVoiceDialReport',{'body':_0x4b76f8,'log':_0x12a7('0x2')});}; \ No newline at end of file +var _0x5a7d=['../client','create','CreateVoiceDialReport'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x5a7d,0x16b));var _0xd5a7=function(_0x599c44,_0x2fb16e){_0x599c44=_0x599c44-0x0;var _0x1d6cf6=_0x5a7d[_0x599c44];return _0x1d6cf6;};'use strict';var client=require(_0xd5a7('0x0'));exports[_0xd5a7('0x1')]=function(_0x4211ba){return client['Request'](_0xd5a7('0x2'),{'body':_0x4211ba,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d9d3c24..4f87594 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 _0x55e0=['../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x319a6a,_0x295f55){var _0x2ba9f4=function(_0x1c0f2e){while(--_0x1c0f2e){_0x319a6a['push'](_0x319a6a['shift']());}};_0x2ba9f4(++_0x295f55);}(_0x55e0,0xdc));var _0x055e=function(_0x18d8e9,_0x2d9568){_0x18d8e9=_0x18d8e9-0x0;var _0x1b9102=_0x55e0[_0x18d8e9];return _0x1b9102;};'use strict';var client=require(_0x055e('0x0'));exports[_0x055e('0x1')]=function(){return function(){return client[_0x055e('0x2')](_0x055e('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x055e('0x1')});};}; \ No newline at end of file +var _0x2bc6=['Request','../client','getVoiceExtensions'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0x2bc6,0x163));var _0x62bc=function(_0x514a40,_0x3bc652){_0x514a40=_0x514a40-0x0;var _0x1ce9c8=_0x2bc6[_0x514a40];return _0x1ce9c8;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(){return function(){return client[_0x62bc('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','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 2bd9ea8..d097f69 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 _0x864b=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','name','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x864b,0x179));var _0xb864=function(_0xe3803e,_0x37e9ce){_0xe3803e=_0xe3803e-0x0;var _0x312c82=_0x864b[_0xe3803e];return _0x312c82;};'use strict';var client=require(_0xb864('0x0'));exports[_0xb864('0x1')]=function(){return function(){return client['Request'](_0xb864('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xb864('0x3'),_0xb864('0x4'),_0xb864('0x5'),_0xb864('0x6'),_0xb864('0x7'),_0xb864('0x8'),_0xb864('0x9'),'dialLimitChannel',_0xb864('0xa'),_0xb864('0xb'),_0xb864('0xc'),'dialPredictiveOptimizationPercentage',_0xb864('0xd'),_0xb864('0xe'),_0xb864('0xf'),_0xb864('0x10'),_0xb864('0x11'),_0xb864('0x12'),_0xb864('0x13'),_0xb864('0x14'),'dialCongestionRetryFrequency',_0xb864('0x15'),_0xb864('0x16'),_0xb864('0x17'),'dialNoAnswerRetryFrequency',_0xb864('0x18'),_0xb864('0x19'),_0xb864('0x1a'),_0xb864('0x1b'),_0xb864('0x1c'),_0xb864('0x1d'),_0xb864('0x1e'),'dialAMDGreeting',_0xb864('0x1f'),_0xb864('0x20'),_0xb864('0x21'),_0xb864('0x22'),'dialAMDMaximumNumberOfWords',_0xb864('0x23'),_0xb864('0x24'),_0xb864('0x25'),_0xb864('0x26'),'dialRecallInQueue',_0xb864('0x27'),_0xb864('0x28'),_0xb864('0x29'),'dialQueueProject2',_0xb864('0x6'),_0xb864('0x2a'),_0xb864('0x2b'),_0xb864('0x2c'),'dialNoSuchNumberMaxRetry',_0xb864('0x2d'),_0xb864('0x2e'),_0xb864('0x2f'),_0xb864('0x30'),_0xb864('0x31'),_0xb864('0x32'),_0xb864('0x33'),_0xb864('0x34'),'dialAgentRejectRetryFrequency',_0xb864('0x35'),'dialPredictiveIntervalMaxThreshold',_0xb864('0x36'),'dialPreviewAutoRecallMe',_0xb864('0x37'),_0xb864('0x38')],'include':[{'model':_0xb864('0x39'),'as':'Trunk','attributes':['id','name',_0xb864('0x3a'),_0xb864('0x3b')]},{'model':_0xb864('0x3c'),'as':_0xb864('0x3d'),'attributes':['id','name']},{'model':_0xb864('0x39'),'as':_0xb864('0x3e'),'attributes':['id',_0xb864('0x3f'),_0xb864('0x3a'),_0xb864('0x3b')]},{'model':_0xb864('0x40'),'as':_0xb864('0x40'),'attributes':['id',_0xb864('0x3f')],'include':[{'model':_0xb864('0x40'),'as':_0xb864('0x41'),'attributes':['id',_0xb864('0x3f'),_0xb864('0x42')]}]}]},'log':_0xb864('0x1')});};}; \ No newline at end of file +var _0xaf34=['dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xaf34,0x163));var _0x4af3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xaf34[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x4af3('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x4af3('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x4af3('0x2'),_0x4af3('0x3'),_0x4af3('0x4'),_0x4af3('0x5'),_0x4af3('0x6'),'type','dialActive','dialMethod',_0x4af3('0x7'),_0x4af3('0x8'),_0x4af3('0x9'),_0x4af3('0xa'),'dialPredictiveOptimizationPercentage',_0x4af3('0xb'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x4af3('0xc'),'dialQueueOptions',_0x4af3('0xd'),_0x4af3('0xe'),_0x4af3('0xf'),_0x4af3('0x10'),_0x4af3('0x11'),_0x4af3('0x12'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0x4af3('0x13'),_0x4af3('0x14'),_0x4af3('0x15'),_0x4af3('0x16'),'dialAMDInitialSilence','dialAMDGreeting',_0x4af3('0x17'),_0x4af3('0x18'),_0x4af3('0x19'),'dialAMDBetweenWordsSilence',_0x4af3('0x1a'),_0x4af3('0x1b'),_0x4af3('0x1c'),_0x4af3('0x1d'),_0x4af3('0x1e'),_0x4af3('0x1f'),_0x4af3('0x20'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x4af3('0x21'),_0x4af3('0x6'),_0x4af3('0x22'),_0x4af3('0x23'),'dialCutDigit',_0x4af3('0x24'),_0x4af3('0x25'),'dialDropMaxRetry',_0x4af3('0x26'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x4af3('0x27'),_0x4af3('0x28'),'dialAgentRejectMaxRetry',_0x4af3('0x29'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x4af3('0x2a'),_0x4af3('0x2b'),_0x4af3('0x2c'),_0x4af3('0x2d')],'include':[{'model':_0x4af3('0x2e'),'as':_0x4af3('0x2e'),'attributes':['id',_0x4af3('0x2'),_0x4af3('0x2f'),'active']},{'model':_0x4af3('0x30'),'as':_0x4af3('0x31'),'attributes':['id',_0x4af3('0x2')]},{'model':_0x4af3('0x2e'),'as':_0x4af3('0x32'),'attributes':['id','name',_0x4af3('0x2f'),_0x4af3('0x33')]},{'model':'Interval','as':_0x4af3('0x34'),'attributes':['id',_0x4af3('0x2')],'include':[{'model':_0x4af3('0x34'),'as':_0x4af3('0x35'),'attributes':['id',_0x4af3('0x2'),_0x4af3('0x36')]}]}]},'log':_0x4af3('0x37')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a07402f..ac6ec96 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(_0x1ce92b,_0x12fe42){var _0x3ff61a=function(_0xb5acf7){while(--_0xb5acf7){_0x1ce92b['push'](_0x1ce92b['shift']());}};_0x3ff61a(++_0x12fe42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x487411,_0x2457a4){var _0x1f2f49=function(_0x228fee){while(--_0x228fee){_0x487411['push'](_0x487411['shift']());}};_0x1f2f49(++_0x2457a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 c097da9..4a2a17e 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 _0xa1af=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x498d86,_0x5245de){var _0x4f2fcb=function(_0x1ed83a){while(--_0x1ed83a){_0x498d86['push'](_0x498d86['shift']());}};_0x4f2fcb(++_0x5245de);}(_0xa1af,0xf5));var _0xfa1a=function(_0x508b33,_0x1766fc){_0x508b33=_0x508b33-0x0;var _0x5aa426=_0xa1af[_0x508b33];return _0x5aa426;};'use strict';var client=require('../client');exports[_0xfa1a('0x0')]=function(_0x4a181e){return function(){return client['Request'](_0xfa1a('0x1'),{'options':{'where':{'VoiceQueueId':_0x4a181e,'paused':!![]},'raw':!![]},'log':_0xfa1a('0x0')});};}; \ No newline at end of file +var _0x4031=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x543d3c,_0x16d2b8){var _0x3e4272=function(_0x211d70){while(--_0x211d70){_0x543d3c['push'](_0x543d3c['shift']());}};_0x3e4272(++_0x16d2b8);}(_0x4031,0x161));var _0x1403=function(_0x37c8ef,_0x29eb19){_0x37c8ef=_0x37c8ef-0x0;var _0x25f7f5=_0x4031[_0x37c8ef];return _0x25f7f5;};'use strict';var client=require(_0x1403('0x0'));exports['getVoiceQueueRtPauses']=function(_0x398371){return function(){return client[_0x1403('0x1')](_0x1403('0x2'),{'options':{'where':{'VoiceQueueId':_0x398371,'paused':!![]},'raw':!![]},'log':_0x1403('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fc605a6..d06239d 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4793cf,_0x489514){var _0x2aed09=function(_0x225b66){while(--_0x225b66){_0x4793cf['push'](_0x4793cf['shift']());}};_0x2aed09(++_0x489514);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x549017,_0x24da11){var _0xbc8dd0=function(_0x1f2a86){while(--_0x1f2a86){_0x549017['push'](_0x549017['shift']());}};_0xbc8dd0(++_0x24da11);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 9aeac17..e1c6a93 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 _0x30c3=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname'];(function(_0xc47611,_0x1d130d){var _0x4819f8=function(_0x2f64fb){while(--_0x2f64fb){_0xc47611['push'](_0xc47611['shift']());}};_0x4819f8(++_0x1d130d);}(_0x30c3,0x1e2));var _0x330c=function(_0x593683,_0x2b3213){_0x593683=_0x593683-0x0;var _0x44cc39=_0x30c3[_0x593683];return _0x44cc39;};'use strict';var client=require(_0x330c('0x0'));exports[_0x330c('0x1')]={};exports[_0x330c('0x2')]=function(_0x1e5107){return client[_0x330c('0x3')](_0x330c('0x4'),{'body':{'result':_0x1e5107[_0x330c('0x5')],'transfererchannel':_0x1e5107['transfererchannel'],'transferercalleridnum':_0x1e5107[_0x330c('0x6')],'transferercalleridname':_0x1e5107[_0x330c('0x7')],'transfererconnectedlinenum':_0x1e5107[_0x330c('0x8')],'transfererconnectedlinename':_0x1e5107[_0x330c('0x9')],'transfereraccountcode':_0x1e5107[_0x330c('0xa')],'transferercontext':_0x1e5107[_0x330c('0xb')],'transfererexten':_0x1e5107[_0x330c('0xc')],'transfererlinkedid':_0x1e5107[_0x330c('0xd')],'transfereechannel':_0x1e5107['transfereechannel'],'transfereecalleridnum':_0x1e5107[_0x330c('0xe')],'transfereecalleridname':_0x1e5107[_0x330c('0xf')],'transfereeconnectedlinenum':_0x1e5107['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1e5107['transfereeconnectedlinename'],'transfereeaccountcode':_0x1e5107[_0x330c('0x10')],'transfereecontext':_0x1e5107[_0x330c('0x11')],'transfereeexten':_0x1e5107['transfereeexten'],'transfereelinkedid':_0x1e5107[_0x330c('0x12')],'isexternal':_0x1e5107[_0x330c('0x13')],'context':_0x1e5107[_0x330c('0x14')],'extension':_0x1e5107['extension'],'type':_0x330c('0x15')},'log':_0x330c('0x4')});};exports[_0x330c('0x16')]=function(_0x2bed67){return client[_0x330c('0x3')](_0x330c('0x4'),{'body':{'result':_0x2bed67[_0x330c('0x5')],'transfererchannel':_0x2bed67['origtransfererchannel'],'transferercalleridnum':_0x2bed67[_0x330c('0x17')],'transferercalleridname':_0x2bed67['origtransferercalleridname'],'transfererconnectedlinenum':_0x2bed67[_0x330c('0x18')],'transfererconnectedlinename':_0x2bed67['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2bed67[_0x330c('0x19')],'transferercontext':_0x2bed67[_0x330c('0x1a')],'transfererexten':_0x2bed67['secondtransfererexten'],'transfererlinkedid':_0x2bed67[_0x330c('0x1b')],'transfereechannel':_0x2bed67[_0x330c('0x1c')],'transfereecalleridnum':_0x2bed67[_0x330c('0x1d')],'transfereecalleridname':_0x2bed67['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2bed67[_0x330c('0x1e')],'transfereeconnectedlinename':_0x2bed67[_0x330c('0x1f')],'transfereeaccountcode':_0x2bed67['transfertargetaccountcode'],'transfereecontext':_0x2bed67[_0x330c('0x20')],'transfereeexten':_0x2bed67['transfertargetexten'],'transfereelinkedid':_0x2bed67[_0x330c('0x21')],'isexternal':_0x2bed67['isexternal'],'context':_0x2bed67['origtransferercontext'],'extension':_0x2bed67['origtransfererexten'],'type':_0x330c('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x0077=['transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeexten','transfereelinkedid','isexternal','context','blind','CreateVoiceTransferReport','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','blindTransfer','Request','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode'];(function(_0x4460a9,_0x12bd18){var _0x1ae57f=function(_0x4c8a52){while(--_0x4c8a52){_0x4460a9['push'](_0x4460a9['shift']());}};_0x1ae57f(++_0x12bd18);}(_0x0077,0x1d3));var _0x7007=function(_0x16bddc,_0xf6b622){_0x16bddc=_0x16bddc-0x0;var _0x970372=_0x0077[_0x16bddc];return _0x970372;};'use strict';var client=require(_0x7007('0x0'));exports['transfers']={};exports[_0x7007('0x1')]=function(_0x27ffb1){return client[_0x7007('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x27ffb1['result'],'transfererchannel':_0x27ffb1[_0x7007('0x3')],'transferercalleridnum':_0x27ffb1[_0x7007('0x4')],'transferercalleridname':_0x27ffb1[_0x7007('0x5')],'transfererconnectedlinenum':_0x27ffb1[_0x7007('0x6')],'transfererconnectedlinename':_0x27ffb1[_0x7007('0x7')],'transfereraccountcode':_0x27ffb1[_0x7007('0x8')],'transferercontext':_0x27ffb1[_0x7007('0x9')],'transfererexten':_0x27ffb1[_0x7007('0xa')],'transfererlinkedid':_0x27ffb1[_0x7007('0xb')],'transfereechannel':_0x27ffb1['transfereechannel'],'transfereecalleridnum':_0x27ffb1[_0x7007('0xc')],'transfereecalleridname':_0x27ffb1[_0x7007('0xd')],'transfereeconnectedlinenum':_0x27ffb1[_0x7007('0xe')],'transfereeconnectedlinename':_0x27ffb1['transfereeconnectedlinename'],'transfereeaccountcode':_0x27ffb1['transfereeaccountcode'],'transfereecontext':_0x27ffb1['transfereecontext'],'transfereeexten':_0x27ffb1[_0x7007('0xf')],'transfereelinkedid':_0x27ffb1[_0x7007('0x10')],'isexternal':_0x27ffb1[_0x7007('0x11')],'context':_0x27ffb1[_0x7007('0x12')],'extension':_0x27ffb1['extension'],'type':_0x7007('0x13')},'log':_0x7007('0x14')});};exports['attendedTransfer']=function(_0x3e2b12){return client[_0x7007('0x2')](_0x7007('0x14'),{'body':{'result':_0x3e2b12['result'],'transfererchannel':_0x3e2b12[_0x7007('0x15')],'transferercalleridnum':_0x3e2b12['origtransferercalleridnum'],'transferercalleridname':_0x3e2b12['origtransferercalleridname'],'transfererconnectedlinenum':_0x3e2b12[_0x7007('0x16')],'transfererconnectedlinename':_0x3e2b12[_0x7007('0x17')],'transfereraccountcode':_0x3e2b12[_0x7007('0x18')],'transferercontext':_0x3e2b12['secondtransferercontext'],'transfererexten':_0x3e2b12[_0x7007('0x19')],'transfererlinkedid':_0x3e2b12[_0x7007('0x1a')],'transfereechannel':_0x3e2b12[_0x7007('0x1b')],'transfereecalleridnum':_0x3e2b12['transfertargetcalleridnum'],'transfereecalleridname':_0x3e2b12['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3e2b12[_0x7007('0x1c')],'transfereeconnectedlinename':_0x3e2b12[_0x7007('0x1d')],'transfereeaccountcode':_0x3e2b12['transfertargetaccountcode'],'transfereecontext':_0x3e2b12['transfertargetcontext'],'transfereeexten':_0x3e2b12[_0x7007('0x1e')],'transfereelinkedid':_0x3e2b12[_0x7007('0x1f')],'isexternal':_0x3e2b12[_0x7007('0x11')],'context':_0x3e2b12['origtransferercontext'],'extension':_0x3e2b12[_0x7007('0x20')],'type':_0x7007('0x21')},'log':_0x7007('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 44e6dfa..8c877cc 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 _0x15ef=['timer','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Action','then','command','Command','content','voiceQueues','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','validate','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','rec','mixmonitorid','MixMonitor\x20Success','catch','voicechannel','StopMixMonitor','destinationchannel','stop','%s.%s','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannelhangup','map','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','timers'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x15ef,0x80));var _0xf15e=function(_0xbc5e53,_0x5c06ae){_0xbc5e53=_0xbc5e53-0x0;var _0x56b9a8=_0x15ef[_0xbc5e53];return _0x56b9a8;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var jayson=require(_0xf15e('0x1'));var schema=require('validate');var BPromise=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var config=require(_0xf15e('0x4'));var properties=require(_0xf15e('0x5'));var ami=require(_0xf15e('0x6'));exports['listen']=function(_0x1b9a24,_0x5c0553,_0x5e96b4){return new BPromise(function(_0x5ba863,_0x66708e){var _0x232359={'QueuePause':function(_0x490097){return new Promise(function(_0x2d6e94,_0x4daf89){var _0x1168c3=util[_0xf15e('0x7')](_0xf15e('0x8'),_0xf15e('0x9'),_0x490097['name']);if(_0x1b9a24['timers']&&_0x1b9a24['timers'][_0x1168c3]&&_0x1b9a24[_0xf15e('0xa')][_0x1168c3][_0xf15e('0xb')]){_0x1b9a24['timers'][_0x1168c3]['updateAcw']();}if(_0x1b9a24['agents'][_0x1168c3]){_0x1b9a24[_0xf15e('0xc')][_0x1168c3][_0xf15e('0xd')]({'statePause':_0x490097[_0xf15e('0xe')]?!![]:![]});}_0x2d6e94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x442d51){var _0x1b8543=this;return new Promise(function(_0x16a04a,_0x5da521){if(ami[_0xf15e('0xf')]()==![]){return _0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}_0x442d51=_[_0xf15e('0x15')](_0x442d51,_['keys'](properties[_0xf15e('0x16')]));_0x442d51[_0xf15e('0x17')]='Reload';return ami[_0xf15e('0x18')](_0x442d51)[_0xf15e('0x19')](function(_0x45e418){_0x16a04a({'code':0xc8,'message':_0x45e418['message']});})['catch'](function(_0x3ad067){_0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f5,_0x3ad067['message']));});});},'Command':function(_0x86d14f){var _0x1f1f33=this;return new Promise(function(_0xa47259,_0x4b144c){if(ami['isConnected']()==![]){return _0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x86d14f=_[_0xf15e('0x15')](_0x86d14f,_0xf15e('0x1a'));_0x86d14f[_0xf15e('0x17')]=_0xf15e('0x1b');return ami['Action'](_0x86d14f)[_0xf15e('0x19')](function(_0xa09c0c){_0xa47259({'code':0xc8,'message':_0xa09c0c[_0xf15e('0x1c')]});})['catch'](function(_0x248c4b){_0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f5,_0x248c4b['message']));});});},'VoiceQueues':function(_0x5d381a){return new Promise(function(_0x2e6d94,_0xb36af){var _0x1fd237=[];for(var _0x471079 in _0x1b9a24[_0xf15e('0x1d')]){if(_0x1b9a24['voiceQueues']['hasOwnProperty'](_0x471079)){var _0x3f9d64=_0x1b9a24[_0xf15e('0x1d')][_0x471079];var _0x4a83e5={'id':_0x3f9d64['id'],'name':_0x3f9d64[_0xf15e('0x1e')],'strategy':_0x3f9d64[_0xf15e('0x1f')],'answered':_0x3f9d64[_0xf15e('0x20')],'available':_0x3f9d64[_0xf15e('0x21')],'loggedIn':_0x3f9d64[_0xf15e('0x22')],'pTalking':_0x3f9d64[_0xf15e('0x23')],'sumBillable':_0x3f9d64[_0xf15e('0x24')],'sumDuration':_0x3f9d64[_0xf15e('0x25')],'sumHoldTime':_0x3f9d64['sumHoldTime']||0x0,'talking':_0x3f9d64[_0xf15e('0x26')],'total':_0x3f9d64[_0xf15e('0x27')],'type':_0x3f9d64[_0xf15e('0x28')],'unmanaged':_0x3f9d64['unmanaged'],'abandoned':_0x3f9d64[_0xf15e('0x29')],'waiting':_0x3f9d64[_0xf15e('0x2a')],'loggedInDb':_0x3f9d64['loggedInDb']};if(_0x3f9d64[_0xf15e('0x28')]===_0xf15e('0x2b')){_0x4a83e5[_0xf15e('0x2c')]=_0x3f9d64['dialActive'];_0x4a83e5[_0xf15e('0x2d')]=_0x3f9d64[_0xf15e('0x2d')];_0x4a83e5[_0xf15e('0x2e')]=_0x3f9d64[_0xf15e('0x2e')];_0x4a83e5['dialOriginateCallerIdNumber']=_0x3f9d64[_0xf15e('0x2f')];_0x4a83e5[_0xf15e('0x30')]=_0x3f9d64['dialOriginateTimeout'];_0x4a83e5[_0xf15e('0x31')]=_0x3f9d64[_0xf15e('0x31')];_0x4a83e5[_0xf15e('0x32')]=_0x3f9d64['temp'];_0x4a83e5[_0xf15e('0x33')]=_0x3f9d64[_0xf15e('0x33')];_0x4a83e5['outboundAnswerCallsDay']=_0x3f9d64[_0xf15e('0x34')];_0x4a83e5['outboundBlacklistCallsDay']=_0x3f9d64[_0xf15e('0x35')];_0x4a83e5[_0xf15e('0x36')]=_0x3f9d64['outboundBusyCallsDay'];_0x4a83e5['outboundCongestionCallsDay']=_0x3f9d64[_0xf15e('0x37')];_0x4a83e5[_0xf15e('0x38')]=_0x3f9d64['outboundDropCallsDayACS'];_0x4a83e5[_0xf15e('0x39')]=_0x3f9d64[_0xf15e('0x39')];_0x4a83e5[_0xf15e('0x3a')]=_0x3f9d64[_0xf15e('0x3a')];_0x4a83e5[_0xf15e('0x3b')]=_0x3f9d64[_0xf15e('0x3b')];_0x4a83e5['outboundNoSuchCallsDay']=_0x3f9d64[_0xf15e('0x3c')];_0x4a83e5[_0xf15e('0x3d')]=_0x3f9d64[_0xf15e('0x3d')];_0x4a83e5[_0xf15e('0x3e')]=_0x3f9d64[_0xf15e('0x3e')];_0x4a83e5[_0xf15e('0x3f')]=_0x3f9d64[_0xf15e('0x3f')];_0x4a83e5[_0xf15e('0x40')]=_0x3f9d64['outboundUnknownCallsDay'];_0x4a83e5[_0xf15e('0x41')]=_0x3f9d64['predictiveIntervalAnsweredCalls'];_0x4a83e5[_0xf15e('0x42')]=_0x3f9d64[_0xf15e('0x42')];_0x4a83e5[_0xf15e('0x43')]=_0x3f9d64[_0xf15e('0x43')];_0x4a83e5[_0xf15e('0x44')]=_0x3f9d64[_0xf15e('0x44')];_0x4a83e5['predictiveIntervalDroppedCallsTimeout']=_0x3f9d64[_0xf15e('0x45')];_0x4a83e5[_0xf15e('0x46')]=_0x3f9d64[_0xf15e('0x46')];_0x4a83e5[_0xf15e('0x47')]=_0x3f9d64['predictiveIntervalErlangCallsDroppedCalls'];_0x4a83e5['predictiveIntervalHitRate']=_0x3f9d64[_0xf15e('0x48')];_0x4a83e5[_0xf15e('0x49')]=_0x3f9d64[_0xf15e('0x49')];_0x4a83e5['predictiveIntervalPauses']=_0x3f9d64['predictiveIntervalPauses'];_0x4a83e5['predictiveIntervalAvailable']=_0x3f9d64['predictiveIntervalAvailable'];_0x4a83e5['predictiveIntervalTotalCalls']=_0x3f9d64[_0xf15e('0x4a')];_0x4a83e5[_0xf15e('0x4b')]=_0x3f9d64[_0xf15e('0x4b')];_0x4a83e5['originated']=_0x3f9d64[_0xf15e('0x4c')];_0x4a83e5['erlangCalls']=_0x3f9d64[_0xf15e('0x4d')];_0x4a83e5[_0xf15e('0x4e')]=_0x3f9d64[_0xf15e('0x4e')];_0x4a83e5[_0xf15e('0x4f')]=_0x3f9d64['erlangAbandonmentRate'];_0x4a83e5[_0xf15e('0x50')]=_0x3f9d64[_0xf15e('0x50')];_0x4a83e5[_0xf15e('0x51')]=_0x3f9d64[_0xf15e('0x51')];_0x4a83e5[_0xf15e('0x52')]=_0x3f9d64['startProgressive'];}if(_0x3f9d64[_0xf15e('0x53')]){_0x4a83e5[_0xf15e('0x53')]={'id':_0x3f9d64[_0xf15e('0x53')]['id'],'name':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x1e')],'active':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x54')],'callerid':_0x3f9d64['Trunk'][_0xf15e('0x55')]};}if(_0x3f9d64[_0xf15e('0x56')]){_0x4a83e5['Interval']={'id':_0x3f9d64['Interval']['id'],'name':_0x3f9d64[_0xf15e('0x56')]['name']};}_0x1fd237['push'](_0x4a83e5);}}_0x2e6d94({'count':_0x1fd237[_0xf15e('0x57')],'rows':_0x1fd237});});},'UpdateVoiceQueue':function(_0x3d99f8){return new Promise(function(_0x4cdfa6,_0x4becd6){var _0x1f2e17=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x1d')],{'id':parseInt(_0x3d99f8['id'])});var _0x33df95=_[_0xf15e('0x59')](_0x3d99f8,['id']);if(_0x1f2e17){for(var _0x31a916 in _0x33df95){if(typeof _0x33df95[_0x31a916]!==_0xf15e('0x5a')&&typeof _0x1f2e17[_0x31a916]!==_0xf15e('0x5a')){_0x1f2e17[_0x31a916]=_0x33df95[_0x31a916];}}_0x4cdfa6(_0x1f2e17);}else{_0x4becd6();}});},'VoiceChannels':function(_0x4fd67c){return new Promise(function(_0x1dba1c,_0x44f075){var _0x3b79a8=_['values'](_0x1b9a24['channels']);_0x1dba1c({'count':_0x3b79a8[_0xf15e('0x57')],'rows':_0x3b79a8});});},'VoiceChannelMixMonitor':function(_0x368a1f){var _0x382ae5=this;return new Promise(function(_0x3da6fe,_0x1cb428){if(ami[_0xf15e('0xf')]()==![]){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')]['join']('\x20')));}var _0x378492=schema(properties['voicechannel'])[_0xf15e('0x5b')](_0x368a1f);if(_0x378492[_0xf15e('0x57')]>0x0){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,_['map'](_0x378492,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x30c8ac=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x368a1f[_0xf15e('0x5d')]});if(_0x30c8ac&&_0x30c8ac[_0xf15e('0x5e')]){var _0x2507b3=util[_0xf15e('0x7')]('%s.%s',_0x368a1f[_0xf15e('0x5f')]||_0x368a1f[_0xf15e('0x5d')],_0x368a1f[_0xf15e('0x7')]||_0xf15e('0x60'));return ami[_0xf15e('0x18')]({'action':'MixMonitor','channel':_0x30c8ac[_0xf15e('0x5e')],'file':_0x2507b3,'options':_0xf15e('0x61')})[_0xf15e('0x19')](function(_0x25827b){var _0x3235d8=_[_0xf15e('0x58')](_0x30c8ac[_0xf15e('0x62')],{'filename':_0xf15e('0x63')+_0x2507b3[_0xf15e('0x64')]()});if(_[_0xf15e('0x65')](_0x3235d8)){_0x30c8ac[_0xf15e('0x62')][_0xf15e('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2507b3[_0xf15e('0x64')](),'createdAt':moment()[_0xf15e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x25827b['mixmonitorid'],'status':_0xf15e('0x67')});}else{_0x3235d8[_0xf15e('0x68')]=_0x25827b['mixmonitorid'];_0x3235d8['status']=_0xf15e('0x67');}_0x3da6fe({'code':0xc8,'message':[_0x368a1f[_0xf15e('0x5d')],_0xf15e('0x69'),_0x25827b[_0xf15e('0x68')]][_0xf15e('0x14')]('\x20'),'mixmonitorid':_0x25827b[_0xf15e('0x68')]});})[_0xf15e('0x6a')](function(_0x54efa8){_0x1cb428(_0x382ae5['error'](0x1f5,[_0x368a1f[_0xf15e('0x5d')],_0x54efa8['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x30b2f3){var _0x295d49=this;return new Promise(function(_0x469a1b,_0x13837c){if(ami['isConnected']()==![]){return _0x13837c(_0x295d49['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')]['username'],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x1eec69=schema(properties[_0xf15e('0x6b')])[_0xf15e('0x5b')](_0x30b2f3);if(_0x1eec69['length']>0x0){return _0x13837c(_0x295d49['error'](0x1f4,_['map'](_0x1eec69,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x5f1121=_['find'](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x30b2f3['uniqueid']});if(_0x5f1121){return BPromise['resolve']()['then'](function(){if(_0x5f1121['channel']){return ami['Action']({'action':_0xf15e('0x6c'),'channel':_0x5f1121[_0xf15e('0x5e')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})['catch'](function(_0x4979fd){});}})[_0xf15e('0x19')](function(){if(_0x5f1121[_0xf15e('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5f1121[_0xf15e('0x6d')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})[_0xf15e('0x6a')](function(_0x532f5b){});}})['then'](function(_0x37e0b2){var _0x44cefb=_['find'](_0x5f1121['monitors'],{'mixmonitorid':_0x30b2f3['mixmonitorid']});if(_0x44cefb){_0x44cefb['status']=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){var _0x53630b=util['format'](_0xf15e('0x6f'),_0x30b2f3['filename']||_0x30b2f3[_0xf15e('0x5d')],_0x30b2f3['format']||_0xf15e('0x60'));var _0x2a3255=_[_0xf15e('0x58')](_0x5f1121['monitors'],{'filename':_0xf15e('0x63')+_0x53630b['toLowerCase']()});if(_0x2a3255){_0x2a3255[_0xf15e('0x70')]=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){_0x469a1b({'code':0xc8,'message':[_0x30b2f3[_0xf15e('0x5d')],_0xf15e('0x71')][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x2ea42f){_0x13837c(_0x295d49['error'](0x1f5,[_0x30b2f3[_0xf15e('0x5d')],_0x2ea42f['message']['toLowerCase']()][_0xf15e('0x14')]('\x20')));});}else{return _0x13837c(_0x295d49['error'](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannels':function(_0x37ed48){return new Promise(function(_0x2cff3a,_0x2cf9f7){var _0x45a25a=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x74')]);_0x2cff3a({'count':_0x45a25a[_0xf15e('0x57')],'rows':_0x45a25a});});},'VoiceQueuesChannel':function(_0x18b2d2){var _0x8c9b10=this;return new Promise(function(_0x4f57f5,_0x5df791){var _0x72d9b6=schema(properties['voicequeuechannel'])['validate'](_0x18b2d2);if(_0x72d9b6[_0xf15e('0x57')]>0x0){return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f4,_['map'](_0x72d9b6,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x574403=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x18b2d2['uniqueid']});if(_0x574403){_0x4f57f5(_0x574403);}else{return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x30cf00){var _0x380fb2=this;return new Promise(function(_0x19890b,_0x340451){if(ami['isConnected']()==![]){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}var _0xbf57fb=schema(properties[_0xf15e('0x75')])['validate'](_0x30cf00);if(_0xbf57fb[_0xf15e('0x57')]>0x0){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0xbf57fb,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x482082=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x30cf00[_0xf15e('0x5d')]});if(_0x482082&&_0x482082[_0xf15e('0x5e')]){return ami['Action']({'action':'Hangup','channel':_0x482082[_0xf15e('0x5e')]})['then'](function(_0x449164){_0x19890b({'code':0xc8,'message':[_0x30cf00[_0xf15e('0x5d')],_0x449164['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')});})['catch'](function(_0x8c5913){_0x340451(_0x380fb2['error'](0x1f5,[_0x30cf00[_0xf15e('0x5d')],_0x8c5913[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x4d320f){var _0x5025bb=this;return new Promise(function(_0x3c1ac2,_0x18bc85){if(ami['isConnected']()==![]){return _0x18bc85(_0x5025bb['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x474c24=schema(properties['voicequeuechannelredirect'])[_0xf15e('0x5b')](_0x4d320f);if(_0x474c24['length']>0x0){return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0x474c24,_0xf15e('0x4b'))['join'](',\x20')));}var _0x40beaf=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x4d320f[_0xf15e('0x5d')]});if(_0x40beaf&&_0x40beaf[_0xf15e('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x40beaf[_0xf15e('0x5e')],'exten':_0x4d320f[_0xf15e('0x77')],'context':_0x4d320f[_0xf15e('0x78')]||_0x40beaf['context'],'priority':0x1})[_0xf15e('0x19')](function(_0x346ed4){_0x3c1ac2({'code':0xc8,'message':[_0x4d320f[_0xf15e('0x5d')],_0x346ed4[_0xf15e('0x4b')]['toLowerCase']()][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x91a322){_0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,[_0x4d320f[_0xf15e('0x5d')],_0x91a322[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x34ee2f){return new Promise(function(_0x56e37c,_0x1484a4){var _0x1108bd=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0xc')]);_0x56e37c({'count':_0x1108bd['length'],'rows':_0x1108bd});});},'Telephones':function(_0x4f251c){return new Promise(function(_0x4a6ea5,_0x4ba658){var _0x532693=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x79')]);_0x4a6ea5({'count':_0x532693[_0xf15e('0x57')],'rows':_0x532693});});},'Trunks':function(_0x2450b1){return new Promise(function(_0x459d82,_0xcee4f5){var _0x387a2c=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7a')]);_0x459d82({'count':_0x387a2c['length'],'rows':_0x387a2c});});},'OutboundChannels':function(_0x425290){return new Promise(function(_0x10406e,_0x4a3a36){var _0x299be3=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7b')]);_0x10406e({'count':_0x299be3[_0xf15e('0x57')],'rows':_0x299be3});});},'Outbound':function(_0x48414e){return new Promise(function(_0x44c30b,_0x40f151){_0x44c30b(_0x1b9a24[_0xf15e('0x2b')]);});},'Campaigns':function(_0x39f9ce){return new Promise(function(_0x426b4b,_0x1bf82a){var _0xdf7775=_['values'](_0x1b9a24[_0xf15e('0x7c')]);_0x426b4b({'count':_0xdf7775[_0xf15e('0x57')],'rows':_0xdf7775});});},'VoiceQueuesPreview':function(_0x51d84b){var _0x295a21=this;return new Promise(function(_0x402613,_0x5b1c88){_0x5c0553[_0xf15e('0x7d')](_0x51d84b['id'])[_0xf15e('0x19')](function(_0x228a23){_0x402613({'code':0xc8,'message':_0x228a23['message']});})[_0xf15e('0x6a')](function(_0x8f566e){_0x5b1c88(_0x295a21[_0xf15e('0x10')](0x1f4,_0x8f566e[_0xf15e('0x4b')]));});});},'EventManager':function(_0x412200){var _0x3a9705=this;return new Promise(function(_0x1c2891,_0x4ee137){if(!_0x412200[_0xf15e('0x7e')]){return _0x4ee137(_0x3a9705[_0xf15e('0x10')](0x1f4,_0xf15e('0x7f')));}ami[_0xf15e('0x80')](_0xf15e('0x81')+_0x412200['event'],_0x412200['message']);_0x1c2891({'code':0xc8,'message':_0x412200});});},'FaxAccounts':function(_0x51819f){return new Promise(function(_0x26591d,_0x1a9e87){var _0x863deb=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x82')]);_0x26591d({'count':_0x863deb[_0xf15e('0x57')],'rows':_0x863deb});});},'SendFax':function(_0x22f526){var _0x49f1b4=this;return new Promise(function(_0x3daaf6,_0x27f242){_0x5e96b4[_0xf15e('0x83')](_0x22f526)['then'](function(_0x528d11){_0x3daaf6({'code':0xc8,'message':_0x528d11['message']});})[_0xf15e('0x6a')](function(_0x3f9a36){_0x27f242(_0x49f1b4[_0xf15e('0x10')](0x1f4,_0x3f9a36[_0xf15e('0x4b')]));});});},'CheckAfterSend':function(_0x369af7){var _0x29f953=this;return new Promise(function(_0x3a9b61,_0x38851f){_0x5e96b4[_0xf15e('0x84')](_0x369af7)[_0xf15e('0x19')](function(_0x17d407){_0x3a9b61({'code':0xc8,'message':_0x17d407[_0xf15e('0x4b')]});})[_0xf15e('0x6a')](function(_0x40b26e){_0x38851f(_0x29f953[_0xf15e('0x10')](0x1f4,_0x40b26e['message']));});});}};var _0x3f1966=jayson[_0xf15e('0x85')](_0x232359)[_0xf15e('0x86')]();_0x3f1966['on']('error',function(_0xd854c8){return _0x66708e(_0xd854c8);});_0x3f1966[_0xf15e('0x87')](0x232a,_0xf15e('0x88'),function(){console['log'](_0xf15e('0x89'),0x232a);return _0x5ba863(_0xf15e('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x82c4=['message','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','catch','isConnected','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','values','voicechannel','map'];(function(_0x26c3b9,_0x2f7830){var _0x1c6818=function(_0x14014a){while(--_0x14014a){_0x26c3b9['push'](_0x26c3b9['shift']());}};_0x1c6818(++_0x2f7830);}(_0x82c4,0x1ca));var _0x482c=function(_0x3520a3,_0x585b4e){_0x3520a3=_0x3520a3-0x0;var _0x266257=_0x82c4[_0x3520a3];return _0x266257;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var jayson=require(_0x482c('0x2'));var schema=require(_0x482c('0x3'));var BPromise=require(_0x482c('0x4'));var moment=require(_0x482c('0x5'));var config=require(_0x482c('0x6'));var properties=require('../properties');var ami=require(_0x482c('0x7'));exports['listen']=function(_0x4556c8,_0x47edb6,_0x477cf4){return new BPromise(function(_0x5d7c76,_0xfdb92){var _0x32a503={'QueuePause':function(_0x35cdab){return new Promise(function(_0x1c10f2,_0x3846d8){var _0x478bd2=util[_0x482c('0x8')](_0x482c('0x9'),_0x482c('0xa'),_0x35cdab[_0x482c('0xb')]);if(_0x4556c8[_0x482c('0xc')]&&_0x4556c8[_0x482c('0xc')][_0x478bd2]&&_0x4556c8['timers'][_0x478bd2][_0x482c('0xd')]){_0x4556c8[_0x482c('0xc')][_0x478bd2][_0x482c('0xe')]();}if(_0x4556c8['agents'][_0x478bd2]){_0x4556c8[_0x482c('0xf')][_0x478bd2][_0x482c('0x10')]({'statePause':_0x35cdab[_0x482c('0x11')]?!![]:![]});}_0x1c10f2({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4bfb3a){var _0x7b12cf=this;return new Promise(function(_0x30e02b,_0x59837f){if(ami['isConnected']()==![]){return _0x59837f(_0x7b12cf[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x4bfb3a=_[_0x482c('0x17')](_0x4bfb3a,_[_0x482c('0x18')](properties[_0x482c('0x19')]));_0x4bfb3a[_0x482c('0x1a')]=_0x482c('0x1b');return ami[_0x482c('0x1c')](_0x4bfb3a)['then'](function(_0x244bb9){_0x30e02b({'code':0xc8,'message':_0x244bb9['message']});})[_0x482c('0x1d')](function(_0x258148){_0x59837f(_0x7b12cf['error'](0x1f5,_0x258148['message']));});});},'Command':function(_0x357965){var _0x584656=this;return new Promise(function(_0x16fe9a,_0x4784a2){if(ami[_0x482c('0x1e')]()==![]){return _0x4784a2(_0x584656[_0x482c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x357965=_[_0x482c('0x17')](_0x357965,'command');_0x357965['action']=_0x482c('0x1f');return ami[_0x482c('0x1c')](_0x357965)[_0x482c('0x20')](function(_0x5c4e9c){_0x16fe9a({'code':0xc8,'message':_0x5c4e9c[_0x482c('0x21')]});})['catch'](function(_0x2f3f96){_0x4784a2(_0x584656[_0x482c('0x12')](0x1f5,_0x2f3f96['message']));});});},'VoiceQueues':function(_0x466583){return new Promise(function(_0x5436e2,_0x589bc6){var _0x2165af=[];for(var _0x27f1b5 in _0x4556c8[_0x482c('0x22')]){if(_0x4556c8[_0x482c('0x22')][_0x482c('0x23')](_0x27f1b5)){var _0x215826=_0x4556c8[_0x482c('0x22')][_0x27f1b5];var _0x5ad788={'id':_0x215826['id'],'name':_0x215826[_0x482c('0xb')],'strategy':_0x215826[_0x482c('0x24')],'answered':_0x215826['answered'],'available':_0x215826[_0x482c('0x25')],'loggedIn':_0x215826['loggedIn'],'pTalking':_0x215826['pTalking'],'sumBillable':_0x215826[_0x482c('0x26')],'sumDuration':_0x215826['sumDuration'],'sumHoldTime':_0x215826[_0x482c('0x27')]||0x0,'talking':_0x215826[_0x482c('0x28')],'total':_0x215826[_0x482c('0x29')],'type':_0x215826[_0x482c('0x2a')],'unmanaged':_0x215826[_0x482c('0x2b')],'abandoned':_0x215826[_0x482c('0x2c')],'waiting':_0x215826[_0x482c('0x2d')],'loggedInDb':_0x215826[_0x482c('0x2e')]};if(_0x215826[_0x482c('0x2a')]===_0x482c('0x2f')){_0x5ad788[_0x482c('0x30')]=_0x215826[_0x482c('0x30')];_0x5ad788[_0x482c('0x31')]=_0x215826[_0x482c('0x31')];_0x5ad788[_0x482c('0x32')]=_0x215826[_0x482c('0x32')];_0x5ad788[_0x482c('0x33')]=_0x215826[_0x482c('0x33')];_0x5ad788['dialOriginateTimeout']=_0x215826['dialOriginateTimeout'];_0x5ad788['dialPrefix']=_0x215826[_0x482c('0x34')];_0x5ad788[_0x482c('0x35')]=_0x215826[_0x482c('0x35')];_0x5ad788[_0x482c('0x36')]=_0x215826['outboundAnswerAgiCallsDay'];_0x5ad788[_0x482c('0x37')]=_0x215826['outboundAnswerCallsDay'];_0x5ad788[_0x482c('0x38')]=_0x215826[_0x482c('0x38')];_0x5ad788[_0x482c('0x39')]=_0x215826[_0x482c('0x39')];_0x5ad788[_0x482c('0x3a')]=_0x215826[_0x482c('0x3a')];_0x5ad788[_0x482c('0x3b')]=_0x215826[_0x482c('0x3b')];_0x5ad788['outboundDropCallsDayCallersExit']=_0x215826['outboundDropCallsDayCallersExit'];_0x5ad788[_0x482c('0x3c')]=_0x215826['outboundDropCallsDayTimeout'];_0x5ad788[_0x482c('0x3d')]=_0x215826[_0x482c('0x3d')];_0x5ad788[_0x482c('0x3e')]=_0x215826['outboundNoSuchCallsDay'];_0x5ad788[_0x482c('0x3f')]=_0x215826[_0x482c('0x3f')];_0x5ad788[_0x482c('0x40')]=_0x215826[_0x482c('0x40')];_0x5ad788['outboundRejectCallsDay']=_0x215826[_0x482c('0x41')];_0x5ad788['outboundUnknownCallsDay']=_0x215826[_0x482c('0x42')];_0x5ad788['predictiveIntervalAnsweredCalls']=_0x215826[_0x482c('0x43')];_0x5ad788['predictiveIntervalAvgHoldtime']=_0x215826[_0x482c('0x44')];_0x5ad788[_0x482c('0x45')]=_0x215826['predictiveIntervalAvgTalktime'];_0x5ad788[_0x482c('0x46')]=_0x215826['predictiveIntervalDroppedCallsCallersExit'];_0x5ad788['predictiveIntervalDroppedCallsTimeout']=_0x215826[_0x482c('0x47')];_0x5ad788['predictiveIntervalErlangCalls']=_0x215826['predictiveIntervalErlangCalls'];_0x5ad788['predictiveIntervalErlangCallsDroppedCalls']=_0x215826['predictiveIntervalErlangCallsDroppedCalls'];_0x5ad788[_0x482c('0x48')]=_0x215826[_0x482c('0x48')];_0x5ad788[_0x482c('0x49')]=_0x215826[_0x482c('0x49')];_0x5ad788[_0x482c('0x4a')]=_0x215826['predictiveIntervalPauses'];_0x5ad788[_0x482c('0x4b')]=_0x215826[_0x482c('0x4b')];_0x5ad788[_0x482c('0x4c')]=_0x215826[_0x482c('0x4c')];_0x5ad788['message']=_0x215826['message'];_0x5ad788[_0x482c('0x4d')]=_0x215826[_0x482c('0x4d')];_0x5ad788[_0x482c('0x4e')]=_0x215826[_0x482c('0x4e')];_0x5ad788[_0x482c('0x4f')]=_0x215826[_0x482c('0x4f')];_0x5ad788[_0x482c('0x50')]=_0x215826[_0x482c('0x50')];_0x5ad788[_0x482c('0x51')]=_0x215826[_0x482c('0x51')];_0x5ad788[_0x482c('0x52')]=_0x215826['startPredictive'];_0x5ad788[_0x482c('0x53')]=_0x215826[_0x482c('0x53')];}if(_0x215826[_0x482c('0x54')]){_0x5ad788[_0x482c('0x54')]={'id':_0x215826[_0x482c('0x54')]['id'],'name':_0x215826[_0x482c('0x54')][_0x482c('0xb')],'active':_0x215826['Trunk']['active'],'callerid':_0x215826[_0x482c('0x54')][_0x482c('0x55')]};}if(_0x215826[_0x482c('0x56')]){_0x5ad788['Interval']={'id':_0x215826[_0x482c('0x56')]['id'],'name':_0x215826['Interval'][_0x482c('0xb')]};}_0x2165af[_0x482c('0x57')](_0x5ad788);}}_0x5436e2({'count':_0x2165af[_0x482c('0x58')],'rows':_0x2165af});});},'UpdateVoiceQueue':function(_0x16b893){return new Promise(function(_0x5f4e0a,_0x1ff623){var _0x2c37f3=_[_0x482c('0x59')](_0x4556c8['voiceQueues'],{'id':parseInt(_0x16b893['id'])});var _0x407471=_[_0x482c('0x5a')](_0x16b893,['id']);if(_0x2c37f3){for(var _0xcf89c4 in _0x407471){if(typeof _0x407471[_0xcf89c4]!=='undefined'&&typeof _0x2c37f3[_0xcf89c4]!=='undefined'){_0x2c37f3[_0xcf89c4]=_0x407471[_0xcf89c4];}}_0x5f4e0a(_0x2c37f3);}else{_0x1ff623();}});},'VoiceChannels':function(_0x4a677d){return new Promise(function(_0x4998a5,_0x596ec2){var _0x56b6c5=_[_0x482c('0x5b')](_0x4556c8['channels']);_0x4998a5({'count':_0x56b6c5[_0x482c('0x58')],'rows':_0x56b6c5});});},'VoiceChannelMixMonitor':function(_0xbdbd1b){var _0x3ecf00=this;return new Promise(function(_0x2fa930,_0x40174a){if(ami[_0x482c('0x1e')]()==![]){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1126b7=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xbdbd1b);if(_0x1126b7[_0x482c('0x58')]>0x0){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x1126b7,_0x482c('0x5e'))['join'](',\x20')));}var _0x107b1b=_[_0x482c('0x59')](_0x4556c8['channels'],{'uniqueid':_0xbdbd1b[_0x482c('0x5f')]});if(_0x107b1b&&_0x107b1b[_0x482c('0x60')]){var _0x1f5e5b=util[_0x482c('0x8')](_0x482c('0x61'),_0xbdbd1b['filename']||_0xbdbd1b['uniqueid'],_0xbdbd1b[_0x482c('0x8')]||_0x482c('0x62'));return ami[_0x482c('0x1c')]({'action':_0x482c('0x63'),'channel':_0x107b1b[_0x482c('0x60')],'file':_0x1f5e5b,'options':_0x482c('0x64')})[_0x482c('0x20')](function(_0x55925a){var _0x508a10=_['find'](_0x107b1b[_0x482c('0x65')],{'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')]()});if(_[_0x482c('0x68')](_0x508a10)){_0x107b1b[_0x482c('0x65')][_0x482c('0x57')]({'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')](),'createdAt':moment()[_0x482c('0x8')](_0x482c('0x69')),'mixmonitorid':_0x55925a[_0x482c('0x6a')],'status':'rec'});}else{_0x508a10[_0x482c('0x6a')]=_0x55925a[_0x482c('0x6a')];_0x508a10[_0x482c('0x6b')]=_0x482c('0x6c');}_0x2fa930({'code':0xc8,'message':[_0xbdbd1b[_0x482c('0x5f')],_0x482c('0x6d'),_0x55925a[_0x482c('0x6a')]][_0x482c('0x16')]('\x20'),'mixmonitorid':_0x55925a[_0x482c('0x6a')]});})[_0x482c('0x1d')](function(_0x3981cf){_0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,[_0xbdbd1b['uniqueid'],_0x3981cf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xa5ffff){var _0x313155=this;return new Promise(function(_0x5382b0,_0x231353){if(ami[_0x482c('0x1e')]()==![]){return _0x231353(_0x313155[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1840a9=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xa5ffff);if(_0x1840a9[_0x482c('0x58')]>0x0){return _0x231353(_0x313155['error'](0x1f4,_[_0x482c('0x5d')](_0x1840a9,'message')[_0x482c('0x16')](',\x20')));}var _0x1bb8d1=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x6f')],{'uniqueid':_0xa5ffff[_0x482c('0x5f')]});if(_0x1bb8d1){return BPromise[_0x482c('0x70')]()['then'](function(){if(_0x1bb8d1[_0x482c('0x60')]){return ami[_0x482c('0x1c')]({'action':'StopMixMonitor','channel':_0x1bb8d1['channel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x481241){});}})[_0x482c('0x20')](function(){if(_0x1bb8d1[_0x482c('0x71')]){return ami[_0x482c('0x1c')]({'action':_0x482c('0x72'),'channel':_0x1bb8d1['destinationchannel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x21a0c5){});}})[_0x482c('0x20')](function(_0x3a37f5){var _0x2fc65f=_['find'](_0x1bb8d1['monitors'],{'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]});if(_0x2fc65f){_0x2fc65f[_0x482c('0x6b')]=_0x482c('0x73');}})['then'](function(){var _0x23349f=util[_0x482c('0x8')](_0x482c('0x61'),_0xa5ffff[_0x482c('0x74')]||_0xa5ffff[_0x482c('0x5f')],_0xa5ffff[_0x482c('0x8')]||_0x482c('0x62'));var _0x37e456=_[_0x482c('0x59')](_0x1bb8d1['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x23349f[_0x482c('0x67')]()});if(_0x37e456){_0x37e456[_0x482c('0x6b')]='stop';}})['then'](function(){_0x5382b0({'code':0xc8,'message':[_0xa5ffff[_0x482c('0x5f')],_0x482c('0x75')][_0x482c('0x16')]('\x20')});})['catch'](function(_0x510f07){_0x231353(_0x313155['error'](0x1f5,[_0xa5ffff[_0x482c('0x5f')],_0x510f07[_0x482c('0x5e')][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x231353(_0x313155[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannels':function(_0x4839f2){return new Promise(function(_0x5e5e76,_0x2ec137){var _0x1d878f=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x76')]);_0x5e5e76({'count':_0x1d878f[_0x482c('0x58')],'rows':_0x1d878f});});},'VoiceQueuesChannel':function(_0x1c9531){var _0x2444a8=this;return new Promise(function(_0x445edb,_0x1c771f){var _0x142809=schema(properties[_0x482c('0x77')])[_0x482c('0x3')](_0x1c9531);if(_0x142809['length']>0x0){return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x142809,_0x482c('0x5e'))['join'](',\x20')));}var _0x2f781d=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x1c9531['uniqueid']});if(_0x2f781d){_0x445edb(_0x2f781d);}else{return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4bd929){var _0xcf240d=this;return new Promise(function(_0x14c94c,_0x383254){if(ami[_0x482c('0x1e')]()==![]){return _0x383254(_0xcf240d[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')]['username'],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5eb509=schema(properties[_0x482c('0x78')])['validate'](_0x4bd929);if(_0x5eb509['length']>0x0){return _0x383254(_0xcf240d['error'](0x1f4,_[_0x482c('0x5d')](_0x5eb509,'message')['join'](',\x20')));}var _0xc7bebc=_[_0x482c('0x59')](_0x4556c8['queueChannels'],{'uniqueid':_0x4bd929[_0x482c('0x5f')]});if(_0xc7bebc&&_0xc7bebc['channel']){return ami['Action']({'action':'Hangup','channel':_0xc7bebc[_0x482c('0x60')]})[_0x482c('0x20')](function(_0x4fc3ef){_0x14c94c({'code':0xc8,'message':[_0x4bd929['uniqueid'],_0x4fc3ef['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x58eebf){_0x383254(_0xcf240d['error'](0x1f5,[_0x4bd929[_0x482c('0x5f')],_0x58eebf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x383254(_0xcf240d['error'](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x5b804f){var _0x48b9c2=this;return new Promise(function(_0x2c0056,_0x4d6926){if(ami[_0x482c('0x1e')]()==![]){return _0x4d6926(_0x48b9c2['error'](0x1f4,[config[_0x482c('0x13')]['ip'],config['asterisk'][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5b9153=schema(properties[_0x482c('0x79')])[_0x482c('0x3')](_0x5b804f);if(_0x5b9153[_0x482c('0x58')]>0x0){return _0x4d6926(_0x48b9c2['error'](0x1f4,_[_0x482c('0x5d')](_0x5b9153,_0x482c('0x5e'))[_0x482c('0x16')](',\x20')));}var _0x38eafd=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x5b804f[_0x482c('0x5f')]});if(_0x38eafd&&_0x38eafd['channel']){return ami[_0x482c('0x1c')]({'action':_0x482c('0x7a'),'channel':_0x38eafd[_0x482c('0x60')],'exten':_0x5b804f['exten'],'context':_0x5b804f['context']||_0x38eafd['context'],'priority':0x1})[_0x482c('0x20')](function(_0x5b3629){_0x2c0056({'code':0xc8,'message':[_0x5b804f['uniqueid'],_0x5b3629[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x17be77){_0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,[_0x5b804f['uniqueid'],_0x17be77[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')));});}else{return _0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'Agents':function(_0x492ab0){return new Promise(function(_0x590d97,_0x145c5e){var _0x45011c=_['values'](_0x4556c8[_0x482c('0xf')]);_0x590d97({'count':_0x45011c['length'],'rows':_0x45011c});});},'Telephones':function(_0x929a4){return new Promise(function(_0x2c683f,_0x2f5799){var _0x549dec=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x7b')]);_0x2c683f({'count':_0x549dec[_0x482c('0x58')],'rows':_0x549dec});});},'Trunks':function(_0x573455){return new Promise(function(_0x27b6d2,_0x34f49f){var _0x56a961=_['values'](_0x4556c8['trunks']);_0x27b6d2({'count':_0x56a961[_0x482c('0x58')],'rows':_0x56a961});});},'OutboundChannels':function(_0x88661b){return new Promise(function(_0x3f0561,_0x4903f1){var _0xd5f6df=_[_0x482c('0x5b')](_0x4556c8['outboundChannels']);_0x3f0561({'count':_0xd5f6df[_0x482c('0x58')],'rows':_0xd5f6df});});},'Outbound':function(_0x5516d6){return new Promise(function(_0x106aa1,_0x363735){_0x106aa1(_0x4556c8[_0x482c('0x2f')]);});},'Campaigns':function(_0x1b4c75){return new Promise(function(_0x2db600,_0x255894){var _0x4dbd16=_['values'](_0x4556c8[_0x482c('0x7c')]);_0x2db600({'count':_0x4dbd16[_0x482c('0x58')],'rows':_0x4dbd16});});},'VoiceQueuesPreview':function(_0x2156af){var _0x319fc3=this;return new Promise(function(_0x7d0afa,_0x13df33){_0x47edb6[_0x482c('0x7d')](_0x2156af['id'])['then'](function(_0x3f5eac){_0x7d0afa({'code':0xc8,'message':_0x3f5eac[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x483e29){_0x13df33(_0x319fc3[_0x482c('0x12')](0x1f4,_0x483e29[_0x482c('0x5e')]));});});},'EventManager':function(_0x2eca83){var _0x190ee5=this;return new Promise(function(_0x45fe30,_0x1f4fd0){if(!_0x2eca83[_0x482c('0x7e')]){return _0x1f4fd0(_0x190ee5['error'](0x1f4,_0x482c('0x7f')));}ami[_0x482c('0x80')](_0x482c('0x81')+_0x2eca83['event'],_0x2eca83[_0x482c('0x5e')]);_0x45fe30({'code':0xc8,'message':_0x2eca83});});},'FaxAccounts':function(_0x55a8a6){return new Promise(function(_0x335a76,_0x3b948c){var _0x3e00e2=_[_0x482c('0x5b')](_0x4556c8['faxAccounts']);_0x335a76({'count':_0x3e00e2[_0x482c('0x58')],'rows':_0x3e00e2});});},'SendFax':function(_0xeaee3d){var _0x1120e1=this;return new Promise(function(_0xf8ac35,_0x5e3619){_0x477cf4[_0x482c('0x82')](_0xeaee3d)[_0x482c('0x20')](function(_0x157896){_0xf8ac35({'code':0xc8,'message':_0x157896[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x4aead3){_0x5e3619(_0x1120e1[_0x482c('0x12')](0x1f4,_0x4aead3[_0x482c('0x5e')]));});});},'CheckAfterSend':function(_0x1911f1){var _0x308dc8=this;return new Promise(function(_0x10fb1f,_0x5cd466){_0x477cf4[_0x482c('0x83')](_0x1911f1)[_0x482c('0x20')](function(_0x44da80){_0x10fb1f({'code':0xc8,'message':_0x44da80['message']});})[_0x482c('0x1d')](function(_0x1f2546){_0x5cd466(_0x308dc8[_0x482c('0x12')](0x1f4,_0x1f2546[_0x482c('0x5e')]));});});}};var _0x519225=jayson[_0x482c('0x84')](_0x32a503)[_0x482c('0x85')]();_0x519225['on'](_0x482c('0x12'),function(_0x5cbf1a){return _0xfdb92(_0x5cbf1a);});_0x519225[_0x482c('0x86')](0x232a,_0x482c('0x87'),function(){console[_0x482c('0x88')](_0x482c('0x89'),0x232a);return _0x5d7c76('RPC\x20listening\x20on\x20port:'+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 23bfe04..899d008 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 _0xc0bf=['then','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve'];(function(_0x5aea54,_0x311cd0){var _0x4ebfa2=function(_0x521940){while(--_0x521940){_0x5aea54['push'](_0x5aea54['shift']());}};_0x4ebfa2(++_0x311cd0);}(_0xc0bf,0x8c));var _0xfc0b=function(_0x13af9e,_0x4a7f6c){_0x13af9e=_0x13af9e-0x0;var _0x36b3cd=_0xc0bf[_0x13af9e];return _0x36b3cd;};'use strict';var _=require('lodash');var BPromise=require(_0xfc0b('0x0'));var Redis=require(_0xfc0b('0x1'));var util=require(_0xfc0b('0x2'));var config=require(_0xfc0b('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xfc0b('0x4'));config[_0xfc0b('0x5')]=_[_0xfc0b('0x6')](config[_0xfc0b('0x5')],{'host':_0xfc0b('0x7'),'port':0x18eb});var io=require(_0xfc0b('0x8'))(new Redis(config[_0xfc0b('0x5')]));function emit(_0x3c8ee5,_0x25ac20,_0x2c41c0,_0x4f3506,_0x56cd73){logger['info']('[CM][%s][%s]',_0x3c8ee5,_0x25ac20['id'],_0x2c41c0,_0x4f3506,JSON[_0xfc0b('0x9')](_0x56cd73));io['to'](_0x2c41c0)[_0xfc0b('0xa')](_0x4f3506,_0x56cd73);}exports[_0xfc0b('0xb')]=function(_0x5d8dc4,_0x4ffbcd,_0x2b08cc,_0x340bca){var _0x4ac994,_0x4c9483;var _0x1b0524={};var _0x2dcb62;var _0x5c4e08=Number(_0x2b08cc['data1']);var _0x416b3f=_0x2b08cc['data2']?Boolean(Number(_0x2b08cc[_0xfc0b('0xc')])):![];var _0x5360a9;var _0x30d64a=![];if(!_['isNil'](_0x2b08cc[_0xfc0b('0xd')])){if(_0x2b08cc[_0xfc0b('0xd')]=='1')_0x30d64a=!![];}if(!_0x30d64a){if(_0x340bca[_0xfc0b('0xe')]){_0x1b0524['id']=_0x340bca['xmd-contactid'];}}if(!_0x1b0524['id']){_0x1b0524[_0xfc0b('0xf')]=_0x5c4e08;_0x5360a9=_0x2b08cc[_0xfc0b('0x10')]&&_0x2b08cc['data3']!=='0'?_0x2b08cc['data3'][_0xfc0b('0x11')](','):[_0xfc0b('0x12')];_0x1b0524[_0xfc0b('0x13')]=_[_0xfc0b('0x14')](_0x5360a9,function(_0x3d1423){var _0x4ba05c={};_0x4ba05c[_0x3d1423]=_0x340bca[_0xfc0b('0x15')]?_0x340bca[_0xfc0b('0x16')]:_0x340bca['calleridnum'];return _0x4ba05c;});_0x2dcb62=_0x340bca[_0xfc0b('0x15')]?_0x340bca[_0xfc0b('0x16')]:_0x340bca[_0xfc0b('0x17')];}var _0x1fad5f=['id','firstName',_0xfc0b('0x18'),'phone',_0xfc0b('0x19'),_0xfc0b('0x1a'),_0xfc0b('0xf'),_0xfc0b('0x1b'),_0xfc0b('0x1c'),_0xfc0b('0x1d')];var _0x13db13=_['union'](_0x1fad5f,_0x5360a9);BPromise[_0xfc0b('0x1e')]()[_0xfc0b('0x1f')](cmContactRpc['getContacts']({'attributes':_0x13db13,'where':_0x1b0524,'phone':_0x2dcb62}))[_0xfc0b('0x1f')](function(_0x2a5e89){_0x4c9483=_0x2a5e89;if(!_['isEmpty'](_0x4c9483)){if(_0x4c9483['length']===0x1){_0x4ac994=_0x4c9483[0x0];logger[_0xfc0b('0x20')](_0xfc0b('0x21'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id'],_0x4ac994['id']);}else{logger['info'](_0xfc0b('0x23'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id'],_[_0xfc0b('0x14')](_0x4c9483,'id')[_0xfc0b('0x24')](','));}return;}else{logger['info'](_0xfc0b('0x25'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id']);var _0x37fc69={'ListId':_0x5c4e08};var _0x562330=_0x2b08cc[_0xfc0b('0x26')]&&_0x2b08cc[_0xfc0b('0x26')]!=='0'?_0x2b08cc['data4']:'phone';if(_0x416b3f){logger[_0xfc0b('0x20')](_0xfc0b('0x27'),_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id']);_0x37fc69[_0x562330]=_['isNil'](_0x340bca[_0xfc0b('0x15')])?_0x340bca[_0xfc0b('0x17')]:_0x340bca['destcalleridnum'];if(_[_0xfc0b('0x28')](_0x340bca['routeId'])){_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2a')]&&_0x340bca[_0xfc0b('0x2a')]!==''?_0x340bca[_0xfc0b('0x2a')]:_0xfc0b('0x2b');}else{_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2c')]&&_0x340bca[_0xfc0b('0x2c')]!==_0xfc0b('0x2d')?_0x340bca[_0xfc0b('0x2c')]:_0xfc0b('0x2b');}return BPromise['resolve']()[_0xfc0b('0x1f')](cmContactRpc[_0xfc0b('0x2e')](_0x37fc69))['then'](function(_0x3fea17){_0x4ac994=_0x3fea17;_0x4c9483[_0xfc0b('0x2f')](_0x3fea17);if(_0x4ac994){logger[_0xfc0b('0x20')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x340bca[_0xfc0b('0x22')],_0x4ffbcd['id'],_0x4ac994['id']);}return;});}else{logger[_0xfc0b('0x20')](_0xfc0b('0x30'),_0x340bca['uniqueid'],_0x4ffbcd['id']);_0x37fc69[_0x562330]=_[_0xfc0b('0x28')](_0x340bca[_0xfc0b('0x15')])?_0x340bca['calleridnum']:_0x340bca[_0xfc0b('0x16')];if(_['isNil'](_0x340bca[_0xfc0b('0x15')])){_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2a')]&&_0x340bca[_0xfc0b('0x2a')]!==_0xfc0b('0x2d')?_0x340bca[_0xfc0b('0x2a')]:'Unknown';}else{_0x37fc69[_0xfc0b('0x29')]=_0x340bca[_0xfc0b('0x2c')]&&_0x340bca[_0xfc0b('0x2c')]!==_0xfc0b('0x2d')?_0x340bca['destcalleridname']:_0xfc0b('0x2b');}_0x4ac994=_0x37fc69;_0x4c9483[_0xfc0b('0x2f')](_0x37fc69);return;}}})[_0xfc0b('0x1f')](function(){if(_0x5d8dc4){emit(_0x340bca[_0xfc0b('0x22')],_0x4ffbcd,util[_0xfc0b('0x31')](_0xfc0b('0x32'),_0x5d8dc4[_0xfc0b('0x33')]),util[_0xfc0b('0x31')](_0xfc0b('0x34'),_0x2b08cc[_0xfc0b('0x35')][_0xfc0b('0x36')]()),{'evt':_[_0xfc0b('0x37')](_0x340bca,{'autoCreate':_0x416b3f}),'contact':_0x4ac994===undefined?{}:_0x4ac994,'contacts':_0x4c9483[_0xfc0b('0x38')]===0x0?undefined:_0x4c9483});}});}; \ No newline at end of file +var _0x1aa2=['lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','merge','length','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','phone','$or','routeId','calleridnum','destcalleridnum','firstName'];(function(_0x573aee,_0x483c6b){var _0x558ab3=function(_0x32abd6){while(--_0x32abd6){_0x573aee['push'](_0x573aee['shift']());}};_0x558ab3(++_0x483c6b);}(_0x1aa2,0x1b7));var _0x21aa=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x1aa2[_0x1602ef];return _0x5870ee;};'use strict';var _=require('lodash');var BPromise=require(_0x21aa('0x0'));var Redis=require(_0x21aa('0x1'));var util=require('util');var config=require(_0x21aa('0x2'));var logger=require(_0x21aa('0x3'))(_0x21aa('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x21aa('0x5')]=_[_0x21aa('0x6')](config[_0x21aa('0x5')],{'host':_0x21aa('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21aa('0x5')]));function emit(_0x131e18,_0xb05405,_0x25f03a,_0x54ee57,_0xde8728){logger[_0x21aa('0x8')](_0x21aa('0x9'),_0x131e18,_0xb05405['id'],_0x25f03a,_0x54ee57,JSON[_0x21aa('0xa')](_0xde8728));io['to'](_0x25f03a)[_0x21aa('0xb')](_0x54ee57,_0xde8728);}exports[_0x21aa('0xc')]=function(_0x28f9ed,_0x45a807,_0x44dc50,_0x2ad747){var _0x8adab2,_0x3ecf3d;var _0x363a2d={};var _0x2b95a2;var _0x28e0af=Number(_0x44dc50[_0x21aa('0xd')]);var _0x7e1ffe=_0x44dc50[_0x21aa('0xe')]?Boolean(Number(_0x44dc50['data2'])):![];var _0x31e24f;var _0x117a7d=![];if(!_[_0x21aa('0xf')](_0x44dc50['data5'])){if(_0x44dc50[_0x21aa('0x10')]=='1')_0x117a7d=!![];}if(!_0x117a7d){if(_0x2ad747['xmd-contactid']){_0x363a2d['id']=_0x2ad747[_0x21aa('0x11')];}}if(!_0x363a2d['id']){_0x363a2d['ListId']=_0x28e0af;_0x31e24f=_0x44dc50[_0x21aa('0x12')]&&_0x44dc50[_0x21aa('0x12')]!=='0'?_0x44dc50[_0x21aa('0x12')]['split'](','):[_0x21aa('0x13')];_0x363a2d[_0x21aa('0x14')]=_['map'](_0x31e24f,function(_0x214788){var _0x1de886={};_0x1de886[_0x214788]=_0x2ad747[_0x21aa('0x15')]?_0x2ad747['destcalleridnum']:_0x2ad747[_0x21aa('0x16')];return _0x1de886;});_0x2b95a2=_0x2ad747['routeId']?_0x2ad747[_0x21aa('0x17')]:_0x2ad747[_0x21aa('0x16')];}var _0x14b773=['id',_0x21aa('0x18'),_0x21aa('0x19'),_0x21aa('0x13'),_0x21aa('0x1a'),_0x21aa('0x1b'),'ListId',_0x21aa('0x1c'),_0x21aa('0x1d'),_0x21aa('0x1e')];var _0x57a3b9=_[_0x21aa('0x1f')](_0x14b773,_0x31e24f);BPromise[_0x21aa('0x20')]()['then'](cmContactRpc[_0x21aa('0x21')]({'attributes':_0x57a3b9,'where':_0x363a2d,'phone':_0x2b95a2}))[_0x21aa('0x22')](function(_0x2e200f){_0x3ecf3d=_0x2e200f;if(!_[_0x21aa('0x23')](_0x3ecf3d)){if(_0x3ecf3d['length']===0x1){_0x8adab2=_0x3ecf3d[0x0];logger['info'](_0x21aa('0x24'),_0x2ad747[_0x21aa('0x25')],_0x45a807['id'],_0x8adab2['id']);}else{logger[_0x21aa('0x8')](_0x21aa('0x26'),_0x2ad747[_0x21aa('0x25')],_0x45a807['id'],_[_0x21aa('0x27')](_0x3ecf3d,'id')[_0x21aa('0x28')](','));}return;}else{logger['info'](_0x21aa('0x29'),_0x2ad747[_0x21aa('0x25')],_0x45a807['id']);var _0x33d911={'ListId':_0x28e0af};var _0x1459ba=_0x44dc50['data4']&&_0x44dc50[_0x21aa('0x2a')]!=='0'?_0x44dc50[_0x21aa('0x2a')]:_0x21aa('0x13');if(_0x7e1ffe){logger[_0x21aa('0x8')](_0x21aa('0x2b'),_0x2ad747[_0x21aa('0x25')],_0x45a807['id']);_0x33d911[_0x1459ba]=_[_0x21aa('0xf')](_0x2ad747[_0x21aa('0x15')])?_0x2ad747[_0x21aa('0x16')]:_0x2ad747[_0x21aa('0x17')];if(_[_0x21aa('0xf')](_0x2ad747[_0x21aa('0x15')])){_0x33d911[_0x21aa('0x18')]=_0x2ad747[_0x21aa('0x2c')]&&_0x2ad747[_0x21aa('0x2c')]!==_0x21aa('0x2d')?_0x2ad747[_0x21aa('0x2c')]:_0x21aa('0x2e');}else{_0x33d911[_0x21aa('0x18')]=_0x2ad747[_0x21aa('0x2f')]&&_0x2ad747['destcalleridname']!==_0x21aa('0x2d')?_0x2ad747[_0x21aa('0x2f')]:'Unknown';}return BPromise[_0x21aa('0x20')]()[_0x21aa('0x22')](cmContactRpc[_0x21aa('0x30')](_0x33d911))[_0x21aa('0x22')](function(_0x1f9913){_0x8adab2=_0x1f9913;_0x3ecf3d[_0x21aa('0x31')](_0x1f9913);if(_0x8adab2){logger[_0x21aa('0x8')](_0x21aa('0x32'),_0x2ad747['uniqueid'],_0x45a807['id'],_0x8adab2['id']);}return;});}else{logger['info'](_0x21aa('0x33'),_0x2ad747[_0x21aa('0x25')],_0x45a807['id']);_0x33d911[_0x1459ba]=_[_0x21aa('0xf')](_0x2ad747[_0x21aa('0x15')])?_0x2ad747[_0x21aa('0x16')]:_0x2ad747[_0x21aa('0x17')];if(_[_0x21aa('0xf')](_0x2ad747[_0x21aa('0x15')])){_0x33d911[_0x21aa('0x18')]=_0x2ad747['calleridname']&&_0x2ad747['calleridname']!==_0x21aa('0x2d')?_0x2ad747['calleridname']:'Unknown';}else{_0x33d911[_0x21aa('0x18')]=_0x2ad747[_0x21aa('0x2f')]&&_0x2ad747[_0x21aa('0x2f')]!==_0x21aa('0x2d')?_0x2ad747[_0x21aa('0x2f')]:_0x21aa('0x2e');}_0x8adab2=_0x33d911;_0x3ecf3d[_0x21aa('0x31')](_0x33d911);return;}}})[_0x21aa('0x22')](function(){if(_0x28f9ed){emit(_0x2ad747[_0x21aa('0x25')],_0x45a807,util[_0x21aa('0x34')]('user:%s',_0x28f9ed[_0x21aa('0x35')]),util['format'](_0x21aa('0x36'),_0x44dc50[_0x21aa('0x37')]['toLowerCase']()),{'evt':_[_0x21aa('0x38')](_0x2ad747,{'autoCreate':_0x7e1ffe}),'contact':_0x8adab2===undefined?{}:_0x8adab2,'contacts':_0x3ecf3d[_0x21aa('0x39')]===0x0?undefined:_0x3ecf3d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f7e75c6..0c92f8f 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 _0x7046=['custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','stringify','prototype','clone','motionChannel','undefined','interface','checkTriggers','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','data2','html','template\x20not\x20found','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','user:%s','name','format','trigger:%s:%s','data1','jscripty','emit','trigger:%s','exec','queue','urlforward','script','parse','query','search','replace','channel','every','AllConditions','checkConditions','some','AnyConditions','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','value','interaction','message','event','membername','routeId','null','substatus','created','equals','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer'];(function(_0x25c132,_0x42a811){var _0x121970=function(_0x5e9125){while(--_0x5e9125){_0x25c132['push'](_0x25c132['shift']());}};_0x121970(++_0x42a811);}(_0x7046,0x144));var _0x6704=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7046[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x6704('0x0'));var _=require(_0x6704('0x1'));var url=require(_0x6704('0x2'));var Mustache=require(_0x6704('0x3'));var Redis=require('ioredis');var urlforward=require(_0x6704('0x4'));var integration=require(_0x6704('0x5'));var cmContact=require(_0x6704('0x6'));var script=require('./script');var config=require(_0x6704('0x7'));var logger=require(_0x6704('0x8'))(_0x6704('0x9'));var ami=require(_0x6704('0xa'));config[_0x6704('0xb')]=_['defaults'](config[_0x6704('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6704('0xb')]));var operators={'equals':function(_0x510221,_0x578822){return _0x510221==_0x578822;},'not_equals':function(_0x3ca599,_0x394ef4){return _0x3ca599!=_0x394ef4;}};var barAndWebActions=[_0x6704('0xc'),_0x6704('0x2'),_0x6704('0xd')];function Trigger(_0x40d57d){this[_0x6704('0xe')]=_0x40d57d[_0x6704('0xe')];this['agents']=_0x40d57d[_0x6704('0xf')];this[_0x6704('0x10')]=_0x40d57d['voiceQueues'];this[_0x6704('0x11')]=_0x40d57d[_0x6704('0x11')];this[_0x6704('0x12')]=_0x40d57d[_0x6704('0x12')];this[_0x6704('0x13')]=_0x40d57d[_0x6704('0x13')];this[_0x6704('0x14')]=_0x40d57d[_0x6704('0x14')];this[_0x6704('0x15')]=_0x40d57d['salesforceAccounts'];this[_0x6704('0x16')]=_0x40d57d[_0x6704('0x16')];this[_0x6704('0x17')]=_0x40d57d['zohoAccounts'];this[_0x6704('0x18')]=_0x40d57d[_0x6704('0x18')];this[_0x6704('0x19')]=_0x40d57d[_0x6704('0x19')];this[_0x6704('0x1a')]=_0x40d57d['servicenowAccounts'];this[_0x6704('0x1b')]=_0x40d57d[_0x6704('0x1b')];this[_0x6704('0x1c')]=_0x40d57d[_0x6704('0x1c')];this[_0x6704('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x6704('0x15')],'freshdesk':this[_0x6704('0x14')],'sugarcrm':this[_0x6704('0x16')],'zoho':this[_0x6704('0x17')],'desk':this[_0x6704('0x18')],'vtiger':this[_0x6704('0x19')],'dynamics365':this[_0x6704('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6704('0x1a')]};ami['on'](_0x6704('0x1e'),this[_0x6704('0x1f')]['bind'](this));ami['on']('custom:agentconnect',this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x21'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on']('custom:agentcomplete',this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x22'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x23'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x24'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x25'),this[_0x6704('0x1f')]['bind'](this));ami['on']('custom:agentreject',this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x26'),this[_0x6704('0x1f')]['bind'](this));ami['on'](_0x6704('0x27'),this[_0x6704('0x1f')]['bind'](this));ami['on']('custom:timeout',this[_0x6704('0x1f')]['bind'](this));ami['on'](_0x6704('0x28'),this['syncAgentDial']['bind'](this));ami['on'](_0x6704('0x29'),this[_0x6704('0x2a')][_0x6704('0x20')](this));ami['on']('custom:dialend',this[_0x6704('0x2a')][_0x6704('0x20')](this));ami['on'](_0x6704('0x2b'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x2c'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x2d'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x2e'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x2f'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x30'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x31'),this[_0x6704('0x1f')][_0x6704('0x20')](this));ami['on'](_0x6704('0x32'),this[_0x6704('0x1f')]['bind'](this));}Trigger['prototype']['emit']=function(_0x2196bd,_0x333742,_0x18222f){logger['info'](_0x2196bd,_0x333742,JSON[_0x6704('0x33')](_0x18222f));io['to'](_0x2196bd)['emit'](_0x333742,_0x18222f);};Trigger[_0x6704('0x34')][_0x6704('0x1f')]=function(_0x59b1bb){var _0x18a118=_[_0x6704('0x35')](_0x59b1bb);if(typeof _0x18a118[_0x6704('0x36')]===_0x6704('0x37')){_0x18a118[_0x6704('0x36')]='voice';}this['checkTriggers'](_0x18a118);};Trigger[_0x6704('0x34')][_0x6704('0x2a')]=function(_0x4a0c18){if(this['agents'][_0x4a0c18[_0x6704('0x38')]]){this['syncCustomEvent'](_0x4a0c18);}};Trigger[_0x6704('0x34')][_0x6704('0x39')]=function(_0x316f16){var _0x41ba43;for(var _0x55dfd6 in this[_0x6704('0xe')]){if(this[_0x6704('0xe')]['hasOwnProperty'](_0x55dfd6)){if(this[_0x6704('0xe')][_0x55dfd6]['status']){_0x41ba43=this[_0x6704('0x3a')](this[_0x6704('0xe')][_0x55dfd6],_0x316f16);if(_0x41ba43){_[_0x6704('0x3b')](_0x316f16,_0x316f16['variables']);for(var _0x32c552=0x0,_0x404604,_0x3e47ee,_0x5c04fe;_0x32c5520x0){_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 +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x28e573,_0x3d5c83){var _0x26d0e9=function(_0x2784fa){while(--_0x2784fa){_0x28e573['push'](_0x28e573['shift']());}};_0x26d0e9(++_0x3d5c83);}(_0x3e74,0x175));var _0x43e7=function(_0x8f3551,_0x581b66){_0x8f3551=_0x8f3551-0x0;var _0x20af25=_0x3e74[_0x8f3551];return _0x20af25;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index b9acd71..b16d5f5 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 _0x421b=['%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incidents','getString','/contacts(','Fields','callDirection','queue','phonecalls','assign','Subjects','Descriptions','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged'];(function(_0x2130f6,_0x2f0a73){var _0xdba2be=function(_0x4e0c25){while(--_0x4e0c25){_0x2130f6['push'](_0x2130f6['shift']());}};_0xdba2be(++_0x2f0a73);}(_0x421b,0x81));var _0xb421=function(_0x17a020,_0x1b7d52){_0x17a020=_0x17a020-0x0;var _0x41c51c=_0x421b[_0x17a020];return _0x41c51c;};'use strict';var _=require('lodash');var rp=require(_0xb421('0x0'));var util=require(_0xb421('0x1'));var intUtil=require(_0xb421('0x2'));var md5=require(_0xb421('0x3'));var Redis=require(_0xb421('0x4'));var logger=require(_0xb421('0x5'))(_0xb421('0x6'));var config=require(_0xb421('0x7'));config[_0xb421('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb421('0x9'))(new Redis(config['redis']));function getAuthToken(_0x29635a,_0x8bc69d,_0x19578d){if(_0x29635a[_0xb421('0xa')]){_0x29635a[_0xb421('0xb')]=_0x29635a[_0xb421('0xc')][_0xb421('0xd')];_0x29635a[_0xb421('0xe')]=_0x29635a[_0xb421('0xc')][_0xb421('0xf')];return Promise[_0xb421('0x10')](_0x29635a[_0xb421('0xc')][_0xb421('0x11')]);}var _0x7fcc15={'method':_0xb421('0x12'),'uri':_0x8bc69d,'form':{'client_id':_0x29635a[_0xb421('0x13')],'resource':_0x29635a['remoteUri'],'username':_0x29635a['username'],'password':_0x29635a[_0xb421('0x14')],'grant_type':_0xb421('0x14'),'client_secret':_0x29635a['clientSecret']},'json':!![]};return rp(_0x7fcc15)[_0xb421('0x15')](function(_0x4c937f){return _0x4c937f[_0xb421('0x16')];})[_0xb421('0x17')](function(_0x707add){logger[_0xb421('0x18')]('['+[_0x19578d[_0xb421('0x19')]()]+_0xb421('0x1a'));return _0x707add[_0xb421('0x1b')];});}function getUser(_0x5c744f,_0x4d5d8b,_0x323970,_0xd43f5a,_0x5b89da,_0x2428a1){return new Promise(function(_0x17f99c,_0x4138ff){return getAuthToken(_0x4d5d8b,_0xd43f5a,_0x2428a1)[_0xb421('0x15')](function(_0x75055d){var _0x93d1fc={'method':_0xb421('0x1c'),'uri':_0x5b89da+_0xb421('0x1d'),'headers':{'Authorization':_0xb421('0x1e')+_0x75055d,'OData-Version':_0xb421('0x1f')},'json':!![]};return rp(_0x93d1fc);})['then'](function(_0x46187c){var _0xdee179=_0x46187c[_0xb421('0x20')];var _0x3da2bf=![];var _0x19a7ec=null;if(!_[_0xb421('0x21')](_0x323970)){if(intUtil[_0xb421('0x22')](_0x323970[_0xb421('0x23')])){_0x5c744f['userEmail']=_0x323970[_0xb421('0x23')];for(_0x19a7ec=0x0;_0x19a7ec<_0xdee179[_0xb421('0x24')];_0x19a7ec++){if(_0xdee179[_0x19a7ec][_0xb421('0x25')]===_0x323970['email']&&!_0xdee179[_0x19a7ec]['isdisabled']){_0x3da2bf=!![];logger['info']('['+[_0x2428a1[_0xb421('0x19')]()]+_0xb421('0x26')+_0xdee179[_0x19a7ec][_0xb421('0x27')]+'!');_0x5c744f[_0xb421('0x28')]=_0xdee179[_0x19a7ec]['systemuserid'];}}}}if(!_0x3da2bf){logger[_0xb421('0x29')]('['+[_0x2428a1[_0xb421('0x19')]()]+_0xb421('0x2a'));_0x5c744f[_0xb421('0x2b')]=_0x4d5d8b['username'];for(_0x19a7ec=0x0;_0x19a7ec<_0xdee179[_0xb421('0x24')];_0x19a7ec++){if(_0xdee179[_0x19a7ec][_0xb421('0x25')]===_0x4d5d8b['username']){_0x5c744f[_0xb421('0x28')]=_0xdee179[_0x19a7ec][_0xb421('0x27')];}}}_0x17f99c(_0x5c744f);})[_0xb421('0x17')](function(_0x331a8a){_0x4138ff(_0x331a8a[_0xb421('0x1b')]);});});}function createEndUser(_0x531300,_0x5d9efb,_0x3c87f2,_0x4a87ae,_0x48e72c,_0x2ac6b7,_0x106d9a){return new Promise(function(_0x4e8e69,_0x1f24f5){return getAuthToken(_0x5d9efb,_0x3c87f2,_0x2ac6b7)[_0xb421('0x15')](function(_0x37ab5c){var _0x1eac10=_0x2ac6b7[_0xb421('0x2c')]()===_0xb421('0x2d')?_0x48e72c[_0xb421('0x2e')]:_0x48e72c['calleridnum'];var _0x1c3d26={'method':'POST','uri':_0x4a87ae+_0xb421('0x2f'),'body':{'fullname':_0x1eac10,'firstname':_0x1eac10,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb421('0x30')+_0x531300[_0xb421('0x28')]+')'},'headers':{'Authorization':_0xb421('0x1e')+_0x37ab5c,'OData-Version':_0xb421('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x1c3d26[_0xb421('0x31')][_0x106d9a]=_0x1eac10;return rp(_0x1c3d26);})[_0xb421('0x15')](function(_0x353adf){var _0xceb616=_0x353adf['headers'][_0xb421('0x32')];var _0x187c30=_0xceb616[_0xb421('0x33')](_0xceb616[_0xb421('0x34')]('(')+0x1,_0xceb616['lastIndexOf'](')'));_0x531300[_0xb421('0x35')]=_0x187c30;_0x4e8e69(_0x531300);})['catch'](function(_0x262fce){_0x1f24f5(_0x262fce['message']);});});}function getEndUser(_0x3f38c6,_0x2b8f6b,_0x2df8b2,_0xf20f1a,_0x50f03d,_0x19f278,_0x16c5c4,_0x3e5b4f){var _0x980cc4=_0x19f278[_0xb421('0x2c')]()===_0xb421('0x2d')?_0x50f03d[_0xb421('0x2e')]:_0x50f03d[_0xb421('0x36')];return getAuthToken(_0x2b8f6b,_0x2df8b2,_0x19f278)[_0xb421('0x15')](function(_0x464ad6){_0x3e5b4f=_0x3e5b4f?_0x3e5b4f:_0xb421('0x37');var _0x44cacf={'method':_0xb421('0x1c'),'uri':_0xf20f1a+_0xb421('0x38')+_0x3e5b4f+_0xb421('0x39')+_0x3e5b4f+_0xb421('0x3a')+_0x980cc4['replace']('+',_0xb421('0x3b'))+'\x27','headers':{'Authorization':_0xb421('0x1e')+_0x464ad6,'If-None-Match':null,'OData-Version':_0xb421('0x1f')},'json':!![]};return rp(_0x44cacf);})[_0xb421('0x15')](function(_0x391013){var _0x2e1868=![];if(!_0x391013)return _0x2e1868;var _0x35fa8b=_0x391013['value'];for(var _0x270b3b=0x0;_0x270b3b<_0x35fa8b[_0xb421('0x24')];_0x270b3b++){if(_0x35fa8b[_0x270b3b][_0x3e5b4f]===_0x980cc4){_0x2e1868=!![];_0x3f38c6[_0xb421('0x35')]=_0x35fa8b[_0x270b3b][_0xb421('0x3c')];}}return _0x2e1868;})[_0xb421('0x15')](function(_0x4e1b4b){if(_0x4e1b4b)return _0x3f38c6;if(_0x16c5c4==='nothing'){logger[_0xb421('0x29')]('['+[_0x19f278[_0xb421('0x19')]()]+_0xb421('0x3d'));return _0x3f38c6;}return createEndUser(_0x3f38c6,_0x2b8f6b,_0x2df8b2,_0xf20f1a,_0x50f03d,_0x19f278,_0x3e5b4f)[_0xb421('0x15')](function(_0xed08e2){logger['info']('['+[_0x19f278[_0xb421('0x19')]()]+_0xb421('0x3e'),_0xed08e2[_0xb421('0x35')]);return _0xed08e2;});});}function getCustomFields(_0x4af4f0,_0x12f5c3,_0x2df43a){var _0xb6b449={};if(_0x4af4f0['length']>0x0){_[_0xb421('0x3f')](_0x4af4f0,function(_0x125ceb){if(_[_0xb421('0x40')]([_0xb421('0x41'),_0xb421('0x42')],_0x125ceb[_0xb421('0x43')])&&_0x125ceb[_0xb421('0x44')]&&!_0x125ceb[_0xb421('0x45')]){var _0x31a3f4=_0x125ceb['idField'][_0xb421('0x2c')]();var _0x486db5=_0x31a3f4['substring'](0x0,_0x31a3f4[_0xb421('0x46')]('_'));var _0x4b2f51=_0x31a3f4['substring'](_0x31a3f4[_0xb421('0x46')]('_')+0x1);if(_0x486db5===_0x2df43a){_0xb6b449[_0x4b2f51]=_0x125ceb[_0xb421('0x47')];}}});}return _0xb6b449;}function getTicket(_0x3909f4,_0x23ac61,_0x5a8a39,_0x20bc7a,_0x2ed2b4,_0xd322b0,_0x38b7c1){return new Promise(function(_0xd0abf3,_0xc0f9b2){var _0x517a4c;return getAuthToken(_0x23ac61,_0x5a8a39,_0x38b7c1)[_0xb421('0x15')](function(_0x1e17ae){if(_0xd322b0[_0xb421('0x48')]==='incident'){_0x517a4c={'method':_0xb421('0x12'),'uri':_0x20bc7a+_0xb421('0x49'),'body':Object['assign']({},{'title':intUtil[_0xb421('0x4a')](_0xd322b0['Subjects'],_0x2ed2b4,'\x20'),'description':intUtil[_0xb421('0x4a')](_0xd322b0['Descriptions'],_0x2ed2b4,'\x0a'),'customerid_contact@odata.bind':_0x3909f4[_0xb421('0x35')]?_0xb421('0x4b')+_0x3909f4['enduserId']+')':undefined,'ownerid@odata.bind':_0xb421('0x30')+_0x3909f4['userId']+')','caseorigincode':'1'},getCustomFields(_0xd322b0[_0xb421('0x4c')],_0x2ed2b4,_0xd322b0[_0xb421('0x48')])),'headers':{'Authorization':_0xb421('0x1e')+_0x1e17ae,'OData-Version':_0xb421('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd322b0[_0xb421('0x48')]==='phonecall'){var _0xfb5b6e=_0x3909f4[_0xb421('0x35')]?[{'partyid_systemuser@odata.bind':_0xb421('0x30')+_0x3909f4[_0xb421('0x28')]+')','participationtypemask':_0x3909f4['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3909f4['enduserId']+')','participationtypemask':_0x3909f4[_0xb421('0x4d')]===_0xb421('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb421('0x30')+_0x3909f4['userId']+')','participationtypemask':_0x3909f4[_0xb421('0x4d')]===_0xb421('0x4e')?0x2:0x1}];_0x517a4c={'method':_0xb421('0x12'),'uri':_0x20bc7a+_0xb421('0x4f'),'body':Object[_0xb421('0x50')]({},{'subject':intUtil[_0xb421('0x4a')](_0xd322b0[_0xb421('0x51')],_0x2ed2b4,'\x20'),'phonenumber':String(_0x2ed2b4[_0xb421('0x36')]),'description':intUtil[_0xb421('0x4a')](_0xd322b0[_0xb421('0x52')],_0x2ed2b4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3909f4[_0xb421('0x35')]?_0xb421('0x4b')+_0x3909f4[_0xb421('0x35')]+')':undefined,'ownerid@odata.bind':_0xb421('0x30')+_0x3909f4[_0xb421('0x28')]+')','directioncode':_0x3909f4[_0xb421('0x4d')]==='queue'?![]:!![],'phonecall_activity_parties':_0xfb5b6e},getCustomFields(_0xd322b0[_0xb421('0x4c')],_0x2ed2b4,_0xd322b0[_0xb421('0x48')])),'headers':{'Authorization':'Bearer\x20'+_0x1e17ae,'OData-Version':_0xb421('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x517a4c);})[_0xb421('0x15')](function(_0x31ab11){var _0x104758=_0x31ab11[_0xb421('0x53')][_0xb421('0x32')];var _0x1861b1=_0x104758['substring'](_0x104758[_0xb421('0x34')]('(')+0x1,_0x104758[_0xb421('0x34')](')'));_0x3909f4['ticketId']=_0x1861b1;_0xd0abf3(_0x3909f4);})[_0xb421('0x17')](function(_0x4bf0e6){_0xc0f9b2(_0x4bf0e6['message']);});});}function emit(_0x165a15,_0x47be87,_0x25529f,_0x5c8f50){var _0xaa137f={'uri':util[_0xb421('0x54')](_0xb421('0x55'),_0x165a15,_0x25529f,_0x5c8f50)};io['to'](util['format'](_0xb421('0x56'),_0x47be87))[_0xb421('0x57')]('trigger:browser:url',_0xaa137f);}exports['cs']=function(_0x38b04e,_0x23524b,_0x34c247,_0x3351c5,_0x42ec02,_0x5e6bab,_0x2843c4,_0x198815){var _0x39bc89={};_0x5e6bab[_0xb421('0xb')]=_0x5e6bab[_0xb421('0xa')]?intUtil[_0xb421('0x58')](_0x5e6bab[_0xb421('0xc')]['data7']):intUtil[_0xb421('0x58')](_0x5e6bab[_0xb421('0xb')]);_0x5e6bab[_0xb421('0x59')]=intUtil[_0xb421('0x58')](_0x5e6bab[_0xb421('0x59')]);_0x39bc89[_0xb421('0x4d')]=_0x198815===_0xb421('0x4e')||_0x198815===_0xb421('0x5a')?_0xb421('0x4e'):_0xb421('0x2d');var _0x4884e7=_0x5e6bab[_0xb421('0xa')]?util[_0xb421('0x54')]('%s/api/data/v9.0/',_0x5e6bab[_0xb421('0xc')][_0xb421('0xd')]):util[_0xb421('0x54')](_0xb421('0x5b'),_0x5e6bab['remoteUri']);var _0x224c44=util[_0xb421('0x54')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5e6bab[_0xb421('0xe')]);var _0x200cc4=util[_0xb421('0x54')](_0xb421('0x5c'),_0x5e6bab[_0xb421('0x59')],_0x23524b[_0xb421('0x5d')],md5(_0x23524b[_0xb421('0x5d')]));if(_0x42ec02&&_0x42ec02[_0xb421('0x5e')]){logger['info']('[QUEUE]',_0xb421('0x5f'));_0x23524b[_0xb421('0x60')]=_0x200cc4;}else if(_0x2843c4&&_0x2843c4[_0xb421('0x61')]&&_0x2843c4['recordingFormat']!==_0xb421('0x62')){logger[_0xb421('0x29')](_0xb421('0x63'),'Recording\x20is\x20enabled!');_0x23524b[_0xb421('0x60')]=_0x200cc4;}else{_0x23524b[_0xb421('0x60')]='';}return getUser(_0x39bc89,_0x5e6bab,_0x3351c5,_0x224c44,_0x4884e7,_0x198815)[_0xb421('0x15')](function(_0x35a9ac){logger['info']('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x64'),_0x35a9ac['userId']);logger['info']('['+_0x198815[_0xb421('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x35a9ac[_0xb421('0x2b')]);return getEndUser(_0x35a9ac,_0x5e6bab,_0x224c44,_0x4884e7,_0x23524b,_0x198815,_0x34c247[_0xb421('0x65')],_0x34c247['additionalSearchContact']);})['then'](function(_0x2763c7){logger[_0xb421('0x29')]('['+_0x198815[_0xb421('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2763c7['enduserId']);logger[_0xb421('0x29')]('['+_0x198815[_0xb421('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x23524b['calleridnum']);return getTicket(_0x2763c7,_0x5e6bab,_0x224c44,_0x4884e7,_0x23524b,_0x34c247,_0x198815);})['then'](function(_0x4f460e){logger[_0xb421('0x29')](util[_0xb421('0x54')]('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x66'),_0x34c247[_0xb421('0x48')],_0x4f460e['ticketId']));logger['info'](util['format']('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x67'),_0x198815));if(_0x198815!==_0xb421('0x5a')&&_0x34c247[_0xb421('0x68')]){logger[_0xb421('0x29')]('['+_0x198815[_0xb421('0x19')]()+']',_0xb421('0x69'));emit(_0x5e6bab['remoteUri'],_0x3351c5[_0xb421('0x6a')],_0x34c247[_0xb421('0x48')],_0x4f460e[_0xb421('0x6b')]);}})['catch'](function(_0x281ac5){logger[_0xb421('0x18')]('['+_0x198815[_0xb421('0x19')]()+_0xb421('0x6c'),_0x281ac5[_0xb421('0x1b')]);console[_0xb421('0x18')](_0xb421('0x6d'),_0x281ac5);});}; \ No newline at end of file +var _0x9e8a=['assign','getString','Subjects','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Descriptions','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','data5','POST','clientId','username','password','clientSecret','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','picklist','type','nameField','idField','indexOf','content','incident','incidents'];(function(_0xb3e6fe,_0x2d0cb1){var _0x1daa9c=function(_0x2e7f9e){while(--_0x2e7f9e){_0xb3e6fe['push'](_0xb3e6fe['shift']());}};_0x1daa9c(++_0x2d0cb1);}(_0x9e8a,0x1f1));var _0xa9e8=function(_0x693f65,_0x524d22){_0x693f65=_0x693f65-0x0;var _0x38c5d3=_0x9e8a[_0x693f65];return _0x38c5d3;};'use strict';var _=require(_0xa9e8('0x0'));var rp=require(_0xa9e8('0x1'));var util=require(_0xa9e8('0x2'));var intUtil=require(_0xa9e8('0x3'));var md5=require(_0xa9e8('0x4'));var Redis=require(_0xa9e8('0x5'));var logger=require(_0xa9e8('0x6'))(_0xa9e8('0x7'));var config=require(_0xa9e8('0x8'));config[_0xa9e8('0x9')]=_['defaults'](config[_0xa9e8('0x9')],{'host':_0xa9e8('0xa'),'port':0x18eb});var io=require(_0xa9e8('0xb'))(new Redis(config['redis']));function getAuthToken(_0x59c5b,_0x1a7a1c,_0x1da634){if(_0x59c5b[_0xa9e8('0xc')]){_0x59c5b[_0xa9e8('0xd')]=_0x59c5b['CloudProvider'][_0xa9e8('0xe')];_0x59c5b[_0xa9e8('0xf')]=_0x59c5b[_0xa9e8('0x10')][_0xa9e8('0x11')];return Promise['resolve'](_0x59c5b[_0xa9e8('0x10')][_0xa9e8('0x12')]);}var _0x35e748={'method':_0xa9e8('0x13'),'uri':_0x1a7a1c,'form':{'client_id':_0x59c5b[_0xa9e8('0x14')],'resource':_0x59c5b[_0xa9e8('0xd')],'username':_0x59c5b[_0xa9e8('0x15')],'password':_0x59c5b[_0xa9e8('0x16')],'grant_type':'password','client_secret':_0x59c5b[_0xa9e8('0x17')]},'json':!![]};return rp(_0x35e748)[_0xa9e8('0x18')](function(_0x2b53c7){return _0x2b53c7['access_token'];})['catch'](function(_0x12f605){logger[_0xa9e8('0x19')]('['+[_0x1da634[_0xa9e8('0x1a')]()]+_0xa9e8('0x1b'));return _0x12f605[_0xa9e8('0x1c')];});}function getUser(_0x4d3d7f,_0x1a3d96,_0x495f81,_0xe8bac3,_0x5390f4,_0x24362e){return new Promise(function(_0xdd8589,_0x5ae8bb){return getAuthToken(_0x1a3d96,_0xe8bac3,_0x24362e)[_0xa9e8('0x18')](function(_0x460746){var _0x1fc82a={'method':'GET','uri':_0x5390f4+_0xa9e8('0x1d'),'headers':{'Authorization':_0xa9e8('0x1e')+_0x460746,'OData-Version':_0xa9e8('0x1f')},'json':!![]};return rp(_0x1fc82a);})[_0xa9e8('0x18')](function(_0x3173ad){var _0x20fc50=_0x3173ad[_0xa9e8('0x20')];var _0x4552f2=![];var _0x4e80c7=null;if(!_[_0xa9e8('0x21')](_0x495f81)){if(intUtil[_0xa9e8('0x22')](_0x495f81[_0xa9e8('0x23')])){_0x4d3d7f[_0xa9e8('0x24')]=_0x495f81[_0xa9e8('0x23')];for(_0x4e80c7=0x0;_0x4e80c7<_0x20fc50[_0xa9e8('0x25')];_0x4e80c7++){if(_0x20fc50[_0x4e80c7][_0xa9e8('0x26')]===_0x495f81[_0xa9e8('0x23')]&&!_0x20fc50[_0x4e80c7]['isdisabled']){_0x4552f2=!![];logger[_0xa9e8('0x27')]('['+[_0x24362e[_0xa9e8('0x1a')]()]+_0xa9e8('0x28')+_0x20fc50[_0x4e80c7][_0xa9e8('0x29')]+'!');_0x4d3d7f[_0xa9e8('0x2a')]=_0x20fc50[_0x4e80c7][_0xa9e8('0x29')];}}}}if(!_0x4552f2){logger[_0xa9e8('0x27')]('['+[_0x24362e[_0xa9e8('0x1a')]()]+_0xa9e8('0x2b'));_0x4d3d7f['userEmail']=_0x1a3d96[_0xa9e8('0x15')];for(_0x4e80c7=0x0;_0x4e80c7<_0x20fc50[_0xa9e8('0x25')];_0x4e80c7++){if(_0x20fc50[_0x4e80c7][_0xa9e8('0x26')]===_0x1a3d96['username']){_0x4d3d7f[_0xa9e8('0x2a')]=_0x20fc50[_0x4e80c7]['systemuserid'];}}}_0xdd8589(_0x4d3d7f);})[_0xa9e8('0x2c')](function(_0x303fc7){_0x5ae8bb(_0x303fc7[_0xa9e8('0x1c')]);});});}function createEndUser(_0x391265,_0x436c74,_0x23ec6f,_0x55d25b,_0x1a4069,_0x12fa47,_0x130840){return new Promise(function(_0x17a88d,_0x9bad4b){return getAuthToken(_0x436c74,_0x23ec6f,_0x12fa47)[_0xa9e8('0x18')](function(_0x527f2d){var _0x37d265=_0x12fa47[_0xa9e8('0x2d')]()===_0xa9e8('0x2e')?_0x1a4069['destcalleridnum']:_0x1a4069[_0xa9e8('0x2f')];var _0x386e54={'method':_0xa9e8('0x13'),'uri':_0x55d25b+_0xa9e8('0x30'),'body':{'fullname':_0x37d265,'firstname':_0x37d265,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xa9e8('0x31')+_0x391265['userId']+')'},'headers':{'Authorization':_0xa9e8('0x1e')+_0x527f2d,'OData-Version':_0xa9e8('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x386e54['body'][_0x130840]=_0x37d265;return rp(_0x386e54);})[_0xa9e8('0x18')](function(_0x33e9dc){var _0x3f0afe=_0x33e9dc['headers'][_0xa9e8('0x32')];var _0x288ab1=_0x3f0afe[_0xa9e8('0x33')](_0x3f0afe[_0xa9e8('0x34')]('(')+0x1,_0x3f0afe[_0xa9e8('0x34')](')'));_0x391265[_0xa9e8('0x35')]=_0x288ab1;_0x17a88d(_0x391265);})['catch'](function(_0x1d02ba){_0x9bad4b(_0x1d02ba[_0xa9e8('0x1c')]);});});}function getEndUser(_0x4b6f12,_0x49e244,_0x32b5d6,_0x2466b7,_0x3df17a,_0x409563,_0x2f1b9d,_0x48ad90){var _0x788b46=_0x409563[_0xa9e8('0x2d')]()===_0xa9e8('0x2e')?_0x3df17a[_0xa9e8('0x36')]:_0x3df17a[_0xa9e8('0x2f')];return getAuthToken(_0x49e244,_0x32b5d6,_0x409563)[_0xa9e8('0x18')](function(_0x3cb2c8){_0x48ad90=_0x48ad90?_0x48ad90:_0xa9e8('0x37');var _0x5129fd={'method':_0xa9e8('0x38'),'uri':_0x2466b7+_0xa9e8('0x39')+_0x48ad90+_0xa9e8('0x3a')+_0x48ad90+_0xa9e8('0x3b')+_0x788b46[_0xa9e8('0x3c')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x3cb2c8,'If-None-Match':null,'OData-Version':_0xa9e8('0x1f')},'json':!![]};return rp(_0x5129fd);})[_0xa9e8('0x18')](function(_0x3f0eb9){var _0x56c53c=![];if(!_0x3f0eb9)return _0x56c53c;var _0x185170=_0x3f0eb9[_0xa9e8('0x20')];for(var _0x46ceae=0x0;_0x46ceae<_0x185170[_0xa9e8('0x25')];_0x46ceae++){if(_0x185170[_0x46ceae][_0x48ad90]===_0x788b46){_0x56c53c=!![];_0x4b6f12[_0xa9e8('0x35')]=_0x185170[_0x46ceae]['contactid'];}}return _0x56c53c;})['then'](function(_0x5ba5f2){if(_0x5ba5f2)return _0x4b6f12;if(_0x2f1b9d===_0xa9e8('0x3d')){logger['info']('['+[_0x409563[_0xa9e8('0x1a')]()]+_0xa9e8('0x3e'));return _0x4b6f12;}return createEndUser(_0x4b6f12,_0x49e244,_0x32b5d6,_0x2466b7,_0x3df17a,_0x409563,_0x48ad90)['then'](function(_0x197c31){logger[_0xa9e8('0x27')]('['+[_0x409563[_0xa9e8('0x1a')]()]+_0xa9e8('0x3f'),_0x197c31[_0xa9e8('0x35')]);return _0x197c31;});});}function getCustomFields(_0x2ba662,_0x4e466f,_0x3db8ff){var _0x41af2c={};if(_0x2ba662[_0xa9e8('0x25')]>0x0){_['forEach'](_0x2ba662,function(_0x20b21f){if(_['includes']([_0xa9e8('0x40'),_0xa9e8('0x41')],_0x20b21f[_0xa9e8('0x42')])&&_0x20b21f[_0xa9e8('0x43')]&&!_0x20b21f['customField']){var _0x5d3ece=_0x20b21f[_0xa9e8('0x44')][_0xa9e8('0x2d')]();var _0x2e3274=_0x5d3ece[_0xa9e8('0x33')](0x0,_0x5d3ece[_0xa9e8('0x45')]('_'));var _0x5d7153=_0x5d3ece[_0xa9e8('0x33')](_0x5d3ece[_0xa9e8('0x45')]('_')+0x1);if(_0x2e3274===_0x3db8ff){_0x41af2c[_0x5d7153]=_0x20b21f[_0xa9e8('0x46')];}}});}return _0x41af2c;}function getTicket(_0x4eb9b2,_0x429fc6,_0x34e0c1,_0x24d218,_0x3da0eb,_0x263bc8,_0x3d524f){return new Promise(function(_0x466c73,_0x59421e){var _0x278d80;return getAuthToken(_0x429fc6,_0x34e0c1,_0x3d524f)[_0xa9e8('0x18')](function(_0x3f9baf){if(_0x263bc8['ticketType']===_0xa9e8('0x47')){_0x278d80={'method':_0xa9e8('0x13'),'uri':_0x24d218+_0xa9e8('0x48'),'body':Object[_0xa9e8('0x49')]({},{'title':intUtil[_0xa9e8('0x4a')](_0x263bc8[_0xa9e8('0x4b')],_0x3da0eb,'\x20'),'description':intUtil[_0xa9e8('0x4a')](_0x263bc8['Descriptions'],_0x3da0eb,'\x0a'),'customerid_contact@odata.bind':_0x4eb9b2['enduserId']?_0xa9e8('0x4c')+_0x4eb9b2['enduserId']+')':undefined,'ownerid@odata.bind':_0xa9e8('0x31')+_0x4eb9b2[_0xa9e8('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x263bc8[_0xa9e8('0x4d')],_0x3da0eb,_0x263bc8[_0xa9e8('0x4e')])),'headers':{'Authorization':_0xa9e8('0x1e')+_0x3f9baf,'OData-Version':_0xa9e8('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x263bc8[_0xa9e8('0x4e')]===_0xa9e8('0x4f')){var _0x3ec902=_0x4eb9b2['enduserId']?[{'partyid_systemuser@odata.bind':_0xa9e8('0x31')+_0x4eb9b2[_0xa9e8('0x2a')]+')','participationtypemask':_0x4eb9b2[_0xa9e8('0x50')]===_0xa9e8('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0xa9e8('0x4c')+_0x4eb9b2[_0xa9e8('0x35')]+')','participationtypemask':_0x4eb9b2[_0xa9e8('0x50')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa9e8('0x31')+_0x4eb9b2['userId']+')','participationtypemask':_0x4eb9b2[_0xa9e8('0x50')]===_0xa9e8('0x51')?0x2:0x1}];_0x278d80={'method':_0xa9e8('0x13'),'uri':_0x24d218+_0xa9e8('0x52'),'body':Object[_0xa9e8('0x49')]({},{'subject':intUtil[_0xa9e8('0x4a')](_0x263bc8[_0xa9e8('0x4b')],_0x3da0eb,'\x20'),'phonenumber':String(_0x3da0eb[_0xa9e8('0x2f')]),'description':intUtil[_0xa9e8('0x4a')](_0x263bc8[_0xa9e8('0x53')],_0x3da0eb,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4eb9b2['enduserId']?_0xa9e8('0x4c')+_0x4eb9b2['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4eb9b2[_0xa9e8('0x2a')]+')','directioncode':_0x4eb9b2[_0xa9e8('0x50')]===_0xa9e8('0x51')?![]:!![],'phonecall_activity_parties':_0x3ec902},getCustomFields(_0x263bc8[_0xa9e8('0x4d')],_0x3da0eb,_0x263bc8[_0xa9e8('0x4e')])),'headers':{'Authorization':_0xa9e8('0x1e')+_0x3f9baf,'OData-Version':_0xa9e8('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x278d80);})['then'](function(_0x18d8fd){var _0xde6192=_0x18d8fd[_0xa9e8('0x54')]['odata-entityid'];var _0x1e9cf0=_0xde6192[_0xa9e8('0x33')](_0xde6192[_0xa9e8('0x34')]('(')+0x1,_0xde6192[_0xa9e8('0x34')](')'));_0x4eb9b2['ticketId']=_0x1e9cf0;_0x466c73(_0x4eb9b2);})['catch'](function(_0x188086){_0x59421e(_0x188086['message']);});});}function emit(_0xe1975f,_0x293cba,_0x30069c,_0x1679b3){var _0x53620b={'uri':util[_0xa9e8('0x55')](_0xa9e8('0x56'),_0xe1975f,_0x30069c,_0x1679b3)};io['to'](util[_0xa9e8('0x55')](_0xa9e8('0x57'),_0x293cba))[_0xa9e8('0x58')](_0xa9e8('0x59'),_0x53620b);}exports['cs']=function(_0x10c3fa,_0x419839,_0x1f3da7,_0x5d7828,_0x920dad,_0x569875,_0x55892e,_0x3f8aca){var _0x3886ff={};_0x569875[_0xa9e8('0xd')]=_0x569875[_0xa9e8('0xc')]?intUtil[_0xa9e8('0x5a')](_0x569875[_0xa9e8('0x10')][_0xa9e8('0xe')]):intUtil[_0xa9e8('0x5a')](_0x569875[_0xa9e8('0xd')]);_0x569875[_0xa9e8('0x5b')]=intUtil[_0xa9e8('0x5a')](_0x569875[_0xa9e8('0x5b')]);_0x3886ff[_0xa9e8('0x50')]=_0x3f8aca===_0xa9e8('0x51')||_0x3f8aca===_0xa9e8('0x5c')?_0xa9e8('0x51'):_0xa9e8('0x2e');var _0x3b3c35=_0x569875['modernAuthentication']?util[_0xa9e8('0x55')](_0xa9e8('0x5d'),_0x569875[_0xa9e8('0x10')][_0xa9e8('0xe')]):util[_0xa9e8('0x55')](_0xa9e8('0x5d'),_0x569875[_0xa9e8('0xd')]);var _0x33e43b=util[_0xa9e8('0x55')](_0xa9e8('0x5e'),_0x569875[_0xa9e8('0xf')]);var _0x191823=util[_0xa9e8('0x55')](_0xa9e8('0x5f'),_0x569875['serverUrl'],_0x419839[_0xa9e8('0x60')],md5(_0x419839[_0xa9e8('0x60')]));if(_0x920dad&&_0x920dad[_0xa9e8('0x61')]){logger['info'](_0xa9e8('0x62'),_0xa9e8('0x63'));_0x419839['recordingURL']=_0x191823;}else if(_0x55892e&&_0x55892e[_0xa9e8('0x64')]&&_0x55892e[_0xa9e8('0x64')]!==_0xa9e8('0x65')){logger[_0xa9e8('0x27')](_0xa9e8('0x66'),_0xa9e8('0x63'));_0x419839['recordingURL']=_0x191823;}else{_0x419839[_0xa9e8('0x67')]='';}return getUser(_0x3886ff,_0x569875,_0x5d7828,_0x33e43b,_0x3b3c35,_0x3f8aca)[_0xa9e8('0x18')](function(_0x440472){logger[_0xa9e8('0x27')]('['+_0x3f8aca[_0xa9e8('0x1a')]()+_0xa9e8('0x68'),_0x440472[_0xa9e8('0x2a')]);logger['info']('['+_0x3f8aca[_0xa9e8('0x1a')]()+_0xa9e8('0x69'),_0x440472[_0xa9e8('0x24')]);return getEndUser(_0x440472,_0x569875,_0x33e43b,_0x3b3c35,_0x419839,_0x3f8aca,_0x1f3da7['moduleCreate'],_0x1f3da7['additionalSearchContact']);})['then'](function(_0x46aed2){logger['info']('['+_0x3f8aca[_0xa9e8('0x1a')]()+_0xa9e8('0x6a'),_0x46aed2[_0xa9e8('0x35')]);logger[_0xa9e8('0x27')]('['+_0x3f8aca[_0xa9e8('0x1a')]()+_0xa9e8('0x6b'),_0x419839[_0xa9e8('0x2f')]);return getTicket(_0x46aed2,_0x569875,_0x33e43b,_0x3b3c35,_0x419839,_0x1f3da7,_0x3f8aca);})['then'](function(_0x39a281){logger[_0xa9e8('0x27')](util[_0xa9e8('0x55')]('['+_0x3f8aca[_0xa9e8('0x1a')]()+_0xa9e8('0x6c'),_0x1f3da7[_0xa9e8('0x4e')],_0x39a281['ticketId']));logger[_0xa9e8('0x27')](util['format']('['+_0x3f8aca[_0xa9e8('0x1a')]()+_0xa9e8('0x6d'),_0x3f8aca));if(_0x3f8aca!=='unmanaged'&&_0x1f3da7[_0xa9e8('0x6e')]){logger['info']('['+_0x3f8aca[_0xa9e8('0x1a')]()+']',_0xa9e8('0x6f'));emit(_0x569875['remoteUri'],_0x5d7828[_0xa9e8('0x70')],_0x1f3da7['ticketType'],_0x39a281['ticketId']);}})[_0xa9e8('0x2c')](function(_0x592f94){logger[_0xa9e8('0x19')]('['+_0x3f8aca[_0xa9e8('0x1a')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x592f94['message']);console[_0xa9e8('0x19')](_0xa9e8('0x71'),_0x592f94);});}; \ 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 76231fd..57e4f78 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 _0x03cc=['lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','Fields','mapValues','keyBy','custom_fields','value','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','type','customField','nameField','toLowerCase','content','picklist','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','unmanaged'];(function(_0x14727c,_0x107ac3){var _0xd21131=function(_0x35cf49){while(--_0x35cf49){_0x14727c['push'](_0x14727c['shift']());}};_0xd21131(++_0x107ac3);}(_0x03cc,0x119));var _0xc03c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x03cc[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xc03c('0x0'));var rp=require(_0xc03c('0x1'));var md5=require(_0xc03c('0x2'));var util=require(_0xc03c('0x3'));var Redis=require(_0xc03c('0x4'));var intUtil=require(_0xc03c('0x5'));var config=require(_0xc03c('0x6'));var logger=require(_0xc03c('0x7'))(_0xc03c('0x8'));config[_0xc03c('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc03c('0xa'))(new Redis(config[_0xc03c('0x9')]));var headers={'Content-Type':_0xc03c('0xb'),'Accept':'application/json'};function emit(_0x17328,_0x3ea050,_0x5396fb){io['to'](_0x17328)['emit'](_0x3ea050,_0x5396fb);}function getTicket(_0x13a293,_0x57413b,_0x2138fd,_0x237d9f,_0x1c2eed){logger[_0xc03c('0xc')](_0xc03c('0xd'));var _0x4e40cb=_[_0xc03c('0xe')]({'responder_id':_0x57413b['id'],'requester_id':_0x2138fd['id'],'name':util[_0xc03c('0xf')](_0xc03c('0x10'),_0x1c2eed['calleridname']),'phone':_0x1c2eed[_0xc03c('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc03c('0x12')](_0x237d9f[_0xc03c('0x13')],_0x1c2eed,'\x20'),'description':intUtil[_0xc03c('0x12')](_0x237d9f[_0xc03c('0x14')],_0x1c2eed,_0xc03c('0x15')),'tags':getTags(_0x237d9f['Tags'],_0xc03c('0x16'))},getCustomFields(_0x237d9f[_0xc03c('0x17')],_0x1c2eed));_0x4e40cb['custom_fields']=_[_0xc03c('0x18')](_[_0xc03c('0x19')](_0x4e40cb[_0xc03c('0x1a')],'id'),_0xc03c('0x1b'));return request({'uri':util[_0xc03c('0xf')]('%s/api/v2/tickets',_0x13a293[_0xc03c('0x1c')]),'method':_0xc03c('0x1d'),'body':_0x4e40cb})[_0xc03c('0x1e')](function(_0x135561){logger[_0xc03c('0xc')](_0xc03c('0x1f'));return _0x135561;});}function getUser(_0x461fdb,_0x4a891a){if(intUtil['validateEmail'](_0x4a891a)){return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x20'),_0x461fdb[_0xc03c('0x1c')]),'qs':{'email':_0x4a891a}})['then'](function(_0x56aeef){if(_0x56aeef[_0xc03c('0x21')]){logger[_0xc03c('0xc')]('Agent\x20found!');return _[_0xc03c('0x22')](_0x56aeef,function(_0x1515de){return _0x1515de[_0xc03c('0x23')][_0xc03c('0x24')]===_0x4a891a;});}else{logger[_0xc03c('0xc')](_0xc03c('0x25'));return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x26'),_0x461fdb['remoteUri'])})['then'](function(_0x24e682){logger[_0xc03c('0xc')](_0xc03c('0x27'));return _0x24e682;});}});}else{logger[_0xc03c('0xc')](_0xc03c('0x28'));return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x26'),_0x461fdb[_0xc03c('0x1c')])})[_0xc03c('0x1e')](function(_0x295ab3){logger[_0xc03c('0xc')]('Admin\x20account\x20selected.');return _0x295ab3;});}}function getEndUser(_0x4c5b7b,_0x23e00b,_0x358593){logger[_0xc03c('0xc')](_0xc03c('0x29'),_0x358593);return request({'uri':util[_0xc03c('0xf')]('%s/api/v2/contacts',_0x4c5b7b[_0xc03c('0x1c')]),'qs':{'phone':_0x358593}})[_0xc03c('0x1e')](function(_0x46db71){if(_0x46db71[_0xc03c('0x21')]){logger['info'](_0xc03c('0x2a'));return _[_0xc03c('0x22')](_0x46db71,{'phone':_0x358593});}else{logger[_0xc03c('0xc')](_0xc03c('0x2b'));return request({'uri':util[_0xc03c('0xf')](_0xc03c('0x2c'),_0x4c5b7b[_0xc03c('0x1c')]),'method':'POST','body':{'name':_0x23e00b,'phone':_0x358593}})[_0xc03c('0x1e')](function(_0x320920){logger[_0xc03c('0xc')](_0xc03c('0x2d'));return _0x320920;});}});}function getAuth(_0x584d0a){return util[_0xc03c('0xf')]('Basic\x20%s',new Buffer(_0x584d0a[_0xc03c('0x2e')]+':X')[_0xc03c('0x2f')](_0xc03c('0x30')));}function request(_0x356f24){logger[_0xc03c('0x31')](_0xc03c('0x32'),JSON[_0xc03c('0x33')](_0x356f24));return rp(_[_0xc03c('0x34')](_0x356f24,{'method':_0xc03c('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x45972a,_0xb2bb0){var _0x2cf9c0=[];if(_0x45972a&&_0x45972a[_0xc03c('0x21')]>0x0){_0x2cf9c0=_['map'](_0x45972a,_0xb2bb0);}return _0x2cf9c0;}function getCustomFields(_0x3dc0b0,_0x93222c){var _0x4b8f5e=[];var _0x3905d0={'custom_fields':[]};if(_0x3dc0b0[_0xc03c('0x21')]>0x0){_[_0xc03c('0x36')](_0x3dc0b0,function(_0x435ac9){if(_[_0xc03c('0x37')](['string','picklist'],_0x435ac9[_0xc03c('0x38')])&&_0x435ac9['nameField']&&!_0x435ac9[_0xc03c('0x39')]){_0x3905d0[_0x435ac9[_0xc03c('0x3a')][_0xc03c('0x3b')]()]=_0x435ac9[_0xc03c('0x3c')][_0xc03c('0x2f')]();}else if(_[_0xc03c('0x37')](['string',_0xc03c('0x3d')],_0x435ac9[_0xc03c('0x38')])&&_0x435ac9['idField']&&_0x435ac9[_0xc03c('0x39')]){_0x3905d0[_0xc03c('0x1a')][_0xc03c('0x3e')]({'id':_0x435ac9[_0xc03c('0x3f')],'value':_0x435ac9[_0xc03c('0x3c')][_0xc03c('0x2f')]()});}else if(_0x435ac9[_0xc03c('0x38')]===_0xc03c('0x40')&&_0x435ac9[_0xc03c('0x41')]&&_0x435ac9[_0xc03c('0x3f')]&&_0x435ac9['customField']){_0x93222c[_0x435ac9[_0xc03c('0x41')]]&&_0x3905d0['custom_fields'][_0xc03c('0x3e')]({'id':_0x435ac9[_0xc03c('0x3f')],'value':_0x93222c[_0x435ac9[_0xc03c('0x41')]][_0xc03c('0x2f')]()});}else if(_0x435ac9['type']===_0xc03c('0x42')&&_0x435ac9[_0xc03c('0x43')]&&_0x435ac9[_0xc03c('0x43')][_0xc03c('0x16')]&&_0x435ac9['idField']&&_0x435ac9[_0xc03c('0x39')]){_0x93222c[_0x435ac9[_0xc03c('0x43')]['name'][_0xc03c('0x3b')]()]&&_0x3905d0['custom_fields'][_0xc03c('0x3e')]({'id':_0x435ac9['idField'],'value':_0x93222c[_0x435ac9[_0xc03c('0x43')][_0xc03c('0x16')]['toLowerCase']()][_0xc03c('0x2f')]()});}});}return _0x3905d0;}exports['queue']=function(_0x11bf3b,_0x2ff0bc,_0x28520a,_0x5d42aa,_0x148bfc,_0x687f39){var _0x4e4572,_0x1cc59b;_0x687f39[_0xc03c('0x1c')]=intUtil[_0xc03c('0x44')](_0x687f39[_0xc03c('0x1c')]);_0x687f39[_0xc03c('0x45')]=intUtil[_0xc03c('0x44')](_0x687f39['serverUrl']);if(_0x148bfc&&_0x148bfc[_0xc03c('0x46')]){logger[_0xc03c('0xc')]('[QUEUE]',_0xc03c('0x47'));_0x2ff0bc[_0xc03c('0x48')]=util[_0xc03c('0xf')](_0xc03c('0x49'),_0x687f39[_0xc03c('0x45')],_0x2ff0bc[_0xc03c('0x4a')],md5(_0x2ff0bc['uniqueid']));}else{_0x2ff0bc[_0xc03c('0x48')]='';}headers[_0xc03c('0x4b')]=getAuth(_0x687f39);return getUser(_0x687f39,_0x5d42aa[_0xc03c('0x24')])[_0xc03c('0x1e')](function(_0x5ca58c){_0x4e4572=_0x5ca58c;logger[_0xc03c('0xc')](_0xc03c('0x4c'),_0x4e4572['id']);return getEndUser(_0x687f39,_0x2ff0bc[_0xc03c('0x4d')],_0x2ff0bc['calleridnum']);})['then'](function(_0x55fe11){_0x1cc59b=_0x55fe11;logger[_0xc03c('0xc')](_0xc03c('0x4e'),_0x1cc59b['id']);return getTicket(_0x687f39,_0x4e4572,_0x1cc59b,_0x28520a,_0x2ff0bc);})[_0xc03c('0x1e')](function(_0x1f909a){if(_0x1f909a&&_0x1f909a['id']){logger[_0xc03c('0xc')](_0xc03c('0x1f'));logger[_0xc03c('0xc')](_0xc03c('0x4f'),_0x1f909a['id']);logger[_0xc03c('0xc')]('[QUEUE]',_0xc03c('0x50'));emit(util[_0xc03c('0xf')](_0xc03c('0x51'),_0x5d42aa[_0xc03c('0x16')]),_0xc03c('0x52'),{'uri':util[_0xc03c('0xf')](_0xc03c('0x53'),_0x687f39[_0xc03c('0x1c')],_0x1f909a['id'])});}})[_0xc03c('0x54')](function(_0x5d196e){logger[_0xc03c('0x55')]('[QUEUE]',JSON[_0xc03c('0x33')](_0x5d196e));});};exports['outbound']=function(_0x24ca9c,_0x4da070,_0x361200,_0x274b0f,_0x573561,_0x11687c,_0x1fe0c0){var _0x5d2d2e,_0x582ad4;_0x11687c['remoteUri']=intUtil[_0xc03c('0x44')](_0x11687c[_0xc03c('0x1c')]);_0x11687c[_0xc03c('0x45')]=intUtil['stripTrailingSlash'](_0x11687c[_0xc03c('0x45')]);if(_0x1fe0c0&&_0x1fe0c0[_0xc03c('0x56')]&&_0x1fe0c0['recordingFormat']!==_0xc03c('0x57')){logger[_0xc03c('0xc')](_0xc03c('0x58'),_0xc03c('0x47'));_0x4da070['recordingURL']=util[_0xc03c('0xf')](_0xc03c('0x49'),_0x11687c[_0xc03c('0x45')],_0x4da070[_0xc03c('0x4a')],md5(_0x4da070[_0xc03c('0x4a')]));}headers[_0xc03c('0x4b')]=getAuth(_0x11687c);return getUser(_0x11687c,_0x274b0f[_0xc03c('0x24')])[_0xc03c('0x1e')](function(_0x3fff36){_0x5d2d2e=_0x3fff36;logger[_0xc03c('0xc')](_0xc03c('0x4c'),_0x5d2d2e['id']);return getEndUser(_0x11687c,_0x4da070[_0xc03c('0x59')],_0x4da070['destcalleridnum']);})[_0xc03c('0x1e')](function(_0x4b596b){_0x582ad4=_0x4b596b;logger[_0xc03c('0xc')](_0xc03c('0x4e'),_0x582ad4['id']);return getTicket(_0x11687c,_0x5d2d2e,_0x582ad4,_0x361200,_0x4da070);})[_0xc03c('0x1e')](function(_0x151e04){if(_0x151e04&&_0x151e04['id']){logger['info'](_0xc03c('0x1f'));logger['info'](_0xc03c('0x4f'),_0x151e04['id']);logger[_0xc03c('0xc')](_0xc03c('0x58'),_0xc03c('0x50'));emit(util[_0xc03c('0xf')](_0xc03c('0x51'),_0x274b0f['name']),_0xc03c('0x52'),{'uri':util[_0xc03c('0xf')](_0xc03c('0x53'),_0x11687c['remoteUri'],_0x151e04['id'])});}})['catch'](function(_0x314149){logger[_0xc03c('0x55')](_0xc03c('0x58'),JSON[_0xc03c('0x33')](_0x314149));});};exports[_0xc03c('0x5a')]=function(_0x29937c,_0x4d2e58,_0x70847e,_0x2fe8de,_0x91de1,_0x48d2b4){var _0x2a5334,_0x527c03;_0x48d2b4[_0xc03c('0x1c')]=intUtil['stripTrailingSlash'](_0x48d2b4['remoteUri']);_0x48d2b4[_0xc03c('0x45')]=intUtil['stripTrailingSlash'](_0x48d2b4['serverUrl']);if(_0x91de1&&_0x91de1[_0xc03c('0x46')]){logger[_0xc03c('0xc')]('['+_0x4d2e58[_0xc03c('0x5b')][_0xc03c('0x5c')]()+']','Recording\x20is\x20enabled!');_0x4d2e58[_0xc03c('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48d2b4[_0xc03c('0x45')],_0x4d2e58[_0xc03c('0x4a')],md5(_0x4d2e58[_0xc03c('0x4a')]));}else{_0x4d2e58[_0xc03c('0x48')]='';}headers[_0xc03c('0x4b')]=getAuth(_0x48d2b4);return getUser(_0x48d2b4,'')[_0xc03c('0x1e')](function(_0x2155bf){_0x2a5334=_0x2155bf;logger['info'](_0xc03c('0x4c'),_0x2a5334['id']);return getEndUser(_0x48d2b4,_0x4d2e58[_0xc03c('0x4d')],_0x4d2e58['calleridnum']);})[_0xc03c('0x1e')](function(_0x43f2cf){_0x527c03=_0x43f2cf;logger[_0xc03c('0xc')](_0xc03c('0x4e'),_0x527c03['id']);return getTicket(_0x48d2b4,_0x2a5334,_0x527c03,_0x70847e,_0x4d2e58);})[_0xc03c('0x1e')](function(_0x4a70ac){if(_0x4a70ac){logger[_0xc03c('0xc')](_0xc03c('0x1f'));logger[_0xc03c('0xc')](_0xc03c('0x4f'),_0x4a70ac['id']);}})['catch'](function(_0x102424){logger[_0xc03c('0x55')]('['+_0x4d2e58['lastevent'][_0xc03c('0x5c')]()+']',JSON['stringify'](_0x102424));});}; \ No newline at end of file +var _0x948f=['./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','Creating\x20new\x20ticket...','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','defaults','includes','string','picklist','type','customField','toLowerCase','content','idField','variable','variableName','push','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util'];(function(_0x3a9ac4,_0x5b806a){var _0x329be4=function(_0x1c18aa){while(--_0x1c18aa){_0x3a9ac4['push'](_0x3a9ac4['shift']());}};_0x329be4(++_0x5b806a);}(_0x948f,0x164));var _0xf948=function(_0x22ae56,_0x16955c){_0x22ae56=_0x22ae56-0x0;var _0x1544f5=_0x948f[_0x22ae56];return _0x1544f5;};'use strict';var _=require(_0xf948('0x0'));var rp=require(_0xf948('0x1'));var md5=require(_0xf948('0x2'));var util=require(_0xf948('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf948('0x4'));var config=require(_0xf948('0x5'));var logger=require(_0xf948('0x6'))(_0xf948('0x7'));config[_0xf948('0x8')]=_['defaults'](config[_0xf948('0x8')],{'host':_0xf948('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf948('0x8')]));var headers={'Content-Type':_0xf948('0xa'),'Accept':'application/json'};function emit(_0x4f6835,_0x369b75,_0x65abf5){io['to'](_0x4f6835)['emit'](_0x369b75,_0x65abf5);}function getTicket(_0x5d6a82,_0x2c23e3,_0x3ec71b,_0x13d640,_0x16c2dc){logger['info'](_0xf948('0xb'));var _0x26b1f2=_['merge']({'responder_id':_0x2c23e3['id'],'requester_id':_0x3ec71b['id'],'name':util['format']('Caller\x20-\x20%s',_0x16c2dc['calleridname']),'phone':_0x16c2dc[_0xf948('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf948('0xd')](_0x13d640[_0xf948('0xe')],_0x16c2dc,'\x20'),'description':intUtil[_0xf948('0xd')](_0x13d640[_0xf948('0xf')],_0x16c2dc,_0xf948('0x10')),'tags':getTags(_0x13d640[_0xf948('0x11')],_0xf948('0x12'))},getCustomFields(_0x13d640[_0xf948('0x13')],_0x16c2dc));_0x26b1f2[_0xf948('0x14')]=_[_0xf948('0x15')](_[_0xf948('0x16')](_0x26b1f2[_0xf948('0x14')],'id'),_0xf948('0x17'));return request({'uri':util[_0xf948('0x18')](_0xf948('0x19'),_0x5d6a82['remoteUri']),'method':_0xf948('0x1a'),'body':_0x26b1f2})[_0xf948('0x1b')](function(_0x1d4fde){logger[_0xf948('0x1c')](_0xf948('0x1d'));return _0x1d4fde;});}function getUser(_0x25ad43,_0x4cb34a){if(intUtil['validateEmail'](_0x4cb34a)){return request({'uri':util[_0xf948('0x18')](_0xf948('0x1e'),_0x25ad43[_0xf948('0x1f')]),'qs':{'email':_0x4cb34a}})[_0xf948('0x1b')](function(_0x33df51){if(_0x33df51[_0xf948('0x20')]){logger[_0xf948('0x1c')](_0xf948('0x21'));return _[_0xf948('0x22')](_0x33df51,function(_0x426e63){return _0x426e63[_0xf948('0x23')][_0xf948('0x24')]===_0x4cb34a;});}else{logger[_0xf948('0x1c')](_0xf948('0x25'));return request({'uri':util[_0xf948('0x18')](_0xf948('0x26'),_0x25ad43[_0xf948('0x1f')])})[_0xf948('0x1b')](function(_0x24f4b3){logger[_0xf948('0x1c')]('Admin\x20account\x20selected.');return _0x24f4b3;});}});}else{logger['info'](_0xf948('0x27'));return request({'uri':util['format'](_0xf948('0x26'),_0x25ad43[_0xf948('0x1f')])})[_0xf948('0x1b')](function(_0x4382e8){logger['info'](_0xf948('0x28'));return _0x4382e8;});}}function getEndUser(_0x321a78,_0x5e3bb4,_0x2954ad){logger[_0xf948('0x1c')](_0xf948('0x29'),_0x2954ad);return request({'uri':util[_0xf948('0x18')](_0xf948('0x2a'),_0x321a78['remoteUri']),'qs':{'phone':_0x2954ad}})[_0xf948('0x1b')](function(_0x124ae6){if(_0x124ae6[_0xf948('0x20')]){logger[_0xf948('0x1c')](_0xf948('0x2b'));return _[_0xf948('0x22')](_0x124ae6,{'phone':_0x2954ad});}else{logger['info'](_0xf948('0x2c'));return request({'uri':util[_0xf948('0x18')]('%s/api/v2/contacts',_0x321a78[_0xf948('0x1f')]),'method':_0xf948('0x1a'),'body':{'name':_0x5e3bb4,'phone':_0x2954ad}})['then'](function(_0xf3cd71){logger[_0xf948('0x1c')](_0xf948('0x2d'));return _0xf3cd71;});}});}function getAuth(_0x31259e){return util[_0xf948('0x18')](_0xf948('0x2e'),new Buffer(_0x31259e[_0xf948('0x2f')]+':X')[_0xf948('0x30')](_0xf948('0x31')));}function request(_0x54fb72){logger['debug'](_0xf948('0x32'),JSON[_0xf948('0x33')](_0x54fb72));return rp(_[_0xf948('0x34')](_0x54fb72,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2eaa3c,_0x5604e7){var _0x52d678=[];if(_0x2eaa3c&&_0x2eaa3c[_0xf948('0x20')]>0x0){_0x52d678=_['map'](_0x2eaa3c,_0x5604e7);}return _0x52d678;}function getCustomFields(_0x3a36cf,_0x49aa40){var _0x1d9f8d=[];var _0x25ae75={'custom_fields':[]};if(_0x3a36cf[_0xf948('0x20')]>0x0){_['forEach'](_0x3a36cf,function(_0x1f85d6){if(_[_0xf948('0x35')]([_0xf948('0x36'),_0xf948('0x37')],_0x1f85d6[_0xf948('0x38')])&&_0x1f85d6['nameField']&&!_0x1f85d6[_0xf948('0x39')]){_0x25ae75[_0x1f85d6['nameField'][_0xf948('0x3a')]()]=_0x1f85d6[_0xf948('0x3b')][_0xf948('0x30')]();}else if(_[_0xf948('0x35')]([_0xf948('0x36'),_0xf948('0x37')],_0x1f85d6[_0xf948('0x38')])&&_0x1f85d6[_0xf948('0x3c')]&&_0x1f85d6[_0xf948('0x39')]){_0x25ae75[_0xf948('0x14')]['push']({'id':_0x1f85d6[_0xf948('0x3c')],'value':_0x1f85d6['content'][_0xf948('0x30')]()});}else if(_0x1f85d6[_0xf948('0x38')]===_0xf948('0x3d')&&_0x1f85d6[_0xf948('0x3e')]&&_0x1f85d6['idField']&&_0x1f85d6[_0xf948('0x39')]){_0x49aa40[_0x1f85d6[_0xf948('0x3e')]]&&_0x25ae75[_0xf948('0x14')][_0xf948('0x3f')]({'id':_0x1f85d6[_0xf948('0x3c')],'value':_0x49aa40[_0x1f85d6[_0xf948('0x3e')]]['toString']()});}else if(_0x1f85d6[_0xf948('0x38')]==='customVariable'&&_0x1f85d6[_0xf948('0x40')]&&_0x1f85d6[_0xf948('0x40')][_0xf948('0x12')]&&_0x1f85d6[_0xf948('0x3c')]&&_0x1f85d6['customField']){_0x49aa40[_0x1f85d6['Variable']['name'][_0xf948('0x3a')]()]&&_0x25ae75[_0xf948('0x14')][_0xf948('0x3f')]({'id':_0x1f85d6[_0xf948('0x3c')],'value':_0x49aa40[_0x1f85d6[_0xf948('0x40')][_0xf948('0x12')][_0xf948('0x3a')]()]['toString']()});}});}return _0x25ae75;}exports['queue']=function(_0x7ce050,_0x3a40b5,_0x23ec38,_0x2e9793,_0x29540e,_0x15a0f9){var _0x30ac4c,_0x4c8196;_0x15a0f9[_0xf948('0x1f')]=intUtil[_0xf948('0x41')](_0x15a0f9[_0xf948('0x1f')]);_0x15a0f9[_0xf948('0x42')]=intUtil[_0xf948('0x41')](_0x15a0f9[_0xf948('0x42')]);if(_0x29540e&&_0x29540e[_0xf948('0x43')]){logger[_0xf948('0x1c')](_0xf948('0x44'),_0xf948('0x45'));_0x3a40b5['recordingURL']=util[_0xf948('0x18')](_0xf948('0x46'),_0x15a0f9[_0xf948('0x42')],_0x3a40b5[_0xf948('0x47')],md5(_0x3a40b5['uniqueid']));}else{_0x3a40b5[_0xf948('0x48')]='';}headers[_0xf948('0x49')]=getAuth(_0x15a0f9);return getUser(_0x15a0f9,_0x2e9793['email'])[_0xf948('0x1b')](function(_0xcba514){_0x30ac4c=_0xcba514;logger[_0xf948('0x1c')](_0xf948('0x4a'),_0x30ac4c['id']);return getEndUser(_0x15a0f9,_0x3a40b5['calleridname'],_0x3a40b5[_0xf948('0xc')]);})['then'](function(_0x4ac24b){_0x4c8196=_0x4ac24b;logger[_0xf948('0x1c')](_0xf948('0x4b'),_0x4c8196['id']);return getTicket(_0x15a0f9,_0x30ac4c,_0x4c8196,_0x23ec38,_0x3a40b5);})[_0xf948('0x1b')](function(_0x517f2c){if(_0x517f2c&&_0x517f2c['id']){logger[_0xf948('0x1c')]('Ticket\x20created!');logger[_0xf948('0x1c')](_0xf948('0x4c'),_0x517f2c['id']);logger[_0xf948('0x1c')](_0xf948('0x44'),_0xf948('0x4d'));emit(util[_0xf948('0x18')](_0xf948('0x4e'),_0x2e9793[_0xf948('0x12')]),'trigger:browser:url',{'uri':util[_0xf948('0x18')](_0xf948('0x4f'),_0x15a0f9[_0xf948('0x1f')],_0x517f2c['id'])});}})[_0xf948('0x50')](function(_0x3b3274){logger[_0xf948('0x51')](_0xf948('0x44'),JSON[_0xf948('0x33')](_0x3b3274));});};exports['outbound']=function(_0x404aeb,_0x50ea39,_0x35c42c,_0x2d6d84,_0x2f7beb,_0x137b43,_0x39823a){var _0xf2a35d,_0x479789;_0x137b43[_0xf948('0x1f')]=intUtil[_0xf948('0x41')](_0x137b43[_0xf948('0x1f')]);_0x137b43['serverUrl']=intUtil[_0xf948('0x41')](_0x137b43['serverUrl']);if(_0x39823a&&_0x39823a[_0xf948('0x52')]&&_0x39823a[_0xf948('0x52')]!=='none'){logger[_0xf948('0x1c')](_0xf948('0x53'),'Recording\x20is\x20enabled!');_0x50ea39[_0xf948('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x137b43['serverUrl'],_0x50ea39['uniqueid'],md5(_0x50ea39[_0xf948('0x47')]));}headers[_0xf948('0x49')]=getAuth(_0x137b43);return getUser(_0x137b43,_0x2d6d84[_0xf948('0x24')])['then'](function(_0x2fb71d){_0xf2a35d=_0x2fb71d;logger[_0xf948('0x1c')]('The\x20User\x20ID\x20is:',_0xf2a35d['id']);return getEndUser(_0x137b43,_0x50ea39[_0xf948('0x54')],_0x50ea39['destcalleridnum']);})[_0xf948('0x1b')](function(_0x47e4eb){_0x479789=_0x47e4eb;logger['info'](_0xf948('0x4b'),_0x479789['id']);return getTicket(_0x137b43,_0xf2a35d,_0x479789,_0x35c42c,_0x50ea39);})[_0xf948('0x1b')](function(_0x1ceb97){if(_0x1ceb97&&_0x1ceb97['id']){logger[_0xf948('0x1c')](_0xf948('0x1d'));logger['info'](_0xf948('0x4c'),_0x1ceb97['id']);logger[_0xf948('0x1c')](_0xf948('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf948('0x4e'),_0x2d6d84[_0xf948('0x12')]),_0xf948('0x55'),{'uri':util[_0xf948('0x18')](_0xf948('0x4f'),_0x137b43[_0xf948('0x1f')],_0x1ceb97['id'])});}})[_0xf948('0x50')](function(_0x2d353b){logger['error'](_0xf948('0x53'),JSON[_0xf948('0x33')](_0x2d353b));});};exports[_0xf948('0x56')]=function(_0x2e7034,_0x2ae9df,_0x280400,_0xfb37e5,_0x30058a,_0x42c6fe){var _0x11efd2,_0x135c97;_0x42c6fe['remoteUri']=intUtil[_0xf948('0x41')](_0x42c6fe[_0xf948('0x1f')]);_0x42c6fe[_0xf948('0x42')]=intUtil[_0xf948('0x41')](_0x42c6fe[_0xf948('0x42')]);if(_0x30058a&&_0x30058a[_0xf948('0x43')]){logger[_0xf948('0x1c')]('['+_0x2ae9df[_0xf948('0x57')][_0xf948('0x58')]()+']',_0xf948('0x45'));_0x2ae9df[_0xf948('0x48')]=util[_0xf948('0x18')](_0xf948('0x46'),_0x42c6fe[_0xf948('0x42')],_0x2ae9df[_0xf948('0x47')],md5(_0x2ae9df[_0xf948('0x47')]));}else{_0x2ae9df['recordingURL']='';}headers[_0xf948('0x49')]=getAuth(_0x42c6fe);return getUser(_0x42c6fe,'')[_0xf948('0x1b')](function(_0x4ca587){_0x11efd2=_0x4ca587;logger[_0xf948('0x1c')]('The\x20User\x20ID\x20is:',_0x11efd2['id']);return getEndUser(_0x42c6fe,_0x2ae9df[_0xf948('0x59')],_0x2ae9df[_0xf948('0xc')]);})['then'](function(_0x143235){_0x135c97=_0x143235;logger[_0xf948('0x1c')](_0xf948('0x4b'),_0x135c97['id']);return getTicket(_0x42c6fe,_0x11efd2,_0x135c97,_0x280400,_0x2ae9df);})[_0xf948('0x1b')](function(_0x523374){if(_0x523374){logger['info'](_0xf948('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x523374['id']);}})[_0xf948('0x50')](function(_0xc8b94b){logger[_0xf948('0x51')]('['+_0x2ae9df[_0xf948('0x57')][_0xf948('0x58')]()+']',JSON['stringify'](_0xc8b94b));});}; \ 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 d3148d9..8b13fcd 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 _0x1022=['ioredis','./util','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminEmail','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20with\x20email','agentEmail','length','userId','User\x20found:','adminId','&f=','&entities=contact','find','contacts','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','moment'];(function(_0x246bc3,_0x5e2894){var _0x9d635=function(_0x137ca2){while(--_0x137ca2){_0x246bc3['push'](_0x246bc3['shift']());}};_0x9d635(++_0x5e2894);}(_0x1022,0x183));var _0x2102=function(_0x46aad3,_0x5c363f){_0x46aad3=_0x46aad3-0x0;var _0x20e425=_0x1022[_0x46aad3];return _0x20e425;};'use strict';var _=require(_0x2102('0x0'));var rp=require('request-promise');var md5=require(_0x2102('0x1'));var util=require('util');var moment=require(_0x2102('0x2'));var Promise=require('bluebird');var Redis=require(_0x2102('0x3'));var intUtil=require(_0x2102('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x2102('0x5')]=_[_0x2102('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2102('0x7'))(new Redis(config['redis']));function getAdminId(_0x492cf6,_0x3bc272,_0x1e60f6,_0x381667){return new Promise(function(_0x4eb301,_0x22b973){var _0x3fb0eb=![];var _0x4daee4={'method':_0x2102('0x8'),'uri':_0x381667+_0x2102('0x9'),'json':!![]};_0x4daee4[_0x2102('0xa')]=_0x1e60f6;logger['info'](_0x2102('0xb'));return rp(_0x4daee4)[_0x2102('0xc')](function(_0x429fe6){if(_0x429fe6){var _0x55b585=_0x429fe6[_0x2102('0xd')];var _0x1996fc=null;for(_0x1996fc=0x0;_0x1996fc<_0x55b585['length'];_0x1996fc++){if(_0x55b585[_0x1996fc][_0x2102('0xe')]===_0x492cf6[_0x2102('0xf')]){_0x492cf6['adminId']=_0x55b585[_0x1996fc]['id'];_0x3fb0eb=!![];}}if(_0x3fb0eb){logger[_0x2102('0x10')](_0x2102('0x11'),_0x492cf6['adminId']);_0x4eb301(_0x492cf6);}else{_0x22b973({'statusCode':0x194,'message':_0x2102('0x12')});}}else{_0x22b973({'statusCode':0x194,'message':_0x2102('0x12')});}})[_0x2102('0x13')](function(_0x3d5aa8){logger[_0x2102('0x14')]('['+[_0x3bc272[_0x2102('0x15')]()]+']',_0x3d5aa8[_0x2102('0x16')]);_0x22b973(_0x3d5aa8);});});}function getUser(_0x258480,_0x24288f,_0x555276){return function(_0x72c0b4){return new Promise(function(_0x57739c,_0x1ec861){var _0x2a8f6b={'method':'GET','uri':_0x555276+_0x2102('0x9'),'json':!![]};_0x2a8f6b['headers']=_0x24288f;logger[_0x2102('0x10')]('Getting\x20user\x20list');return rp(_0x2a8f6b)[_0x2102('0xc')](function(_0x35c92a){if(_0x35c92a){var _0x5df89f=_0x35c92a[_0x2102('0xd')];var _0x4fe9ea=![];var _0xfc8c78=null;if(_0x72c0b4['agentEmail']!==null){logger[_0x2102('0x10')](_0x2102('0x17'),_0x72c0b4[_0x2102('0x18')]);_0x72c0b4['userEmail']=_0x72c0b4[_0x2102('0x18')];for(_0xfc8c78=0x0;_0xfc8c78<_0x5df89f[_0x2102('0x19')];_0xfc8c78++){if(_0x5df89f[_0xfc8c78][_0x2102('0xe')]===_0x72c0b4['agentEmail']){_0x4fe9ea=!![];_0x72c0b4[_0x2102('0x1a')]=_0x5df89f[_0xfc8c78]['id'];logger['info'](_0x2102('0x1b'),_0x72c0b4[_0x2102('0x1a')]);}}}if(!_0x4fe9ea){logger[_0x2102('0x10')]('Admin\x20selected');_0x72c0b4['userEmail']=_0x72c0b4[_0x2102('0xf')];_0x72c0b4['userId']=_0x72c0b4[_0x2102('0x1c')];_0x4fe9ea=!![];}if(_0x4fe9ea){_0x57739c(_0x72c0b4);}else{_0x1ec861({'statusCode':0x194,'message':_0x2102('0x12')});}}else{_0x1ec861({'statusCode':0x194,'message':_0x2102('0x12')});}})[_0x2102('0x13')](function(_0x1c1e7d){logger['error']('['+[_0x258480[_0x2102('0x15')]()]+']',_0x1c1e7d[_0x2102('0x16')]);_0x1ec861(_0x1c1e7d);});});};}function searchContact(_0x5b7e42,_0x2d7ca7,_0x2b8acd,_0x4f0d16){return new Promise(function(_0x54a075,_0x10f61f){var _0x2b5e04={'method':_0x2102('0x8'),'headers':_0x2d7ca7,'uri':_0x5b7e42+'/api/lookup?q='+_0x4f0d16+_0x2102('0x1d')+_0x2b8acd+_0x2102('0x1e'),'json':!![]};rp(_0x2b5e04)[_0x2102('0xc')](function(_0x5b70d9){var _0x481475=_[_0x2102('0x1f')](_0x5b70d9['contacts'][_0x2102('0x20')],[_0x2b8acd,_0x4f0d16]);_0x54a075(_0x481475);})[_0x2102('0x13')](function(_0x33a318){_0x10f61f(_0x33a318);});});}function getEndUser(_0x2cc515,_0x57e1b1,_0x1d2373){return function(_0x2eaf93){return new Promise(function(_0x22bd43,_0x2870ab){logger[_0x2102('0x10')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x2eaf93[_0x2102('0x21')]));searchContact(_0x1d2373,_0x57e1b1,'mobile_number',_0x2eaf93['contactNumber'])[_0x2102('0xc')](function(_0x2a74d7){if(_0x2a74d7){_0x2eaf93[_0x2102('0x22')]=_0x2a74d7['id'];logger[_0x2102('0x10')](_0x2102('0x23'),_0x2eaf93[_0x2102('0x22')]);return _0x22bd43(_0x2eaf93);}searchContact(_0x1d2373,_0x57e1b1,'work_number',_0x2eaf93['contactNumber'])['then'](function(_0x5f075e){if(_0x5f075e){_0x2eaf93[_0x2102('0x22')]=_0x5f075e['id'];logger[_0x2102('0x10')](_0x2102('0x24'),_0x2eaf93[_0x2102('0x22')]);return _0x22bd43(_0x2eaf93);}createEndUser(_0x2eaf93,_0x2cc515,_0x57e1b1,_0x1d2373)[_0x2102('0xc')](function(_0x113a8e){logger[_0x2102('0x10')](_0x2102('0x25'),_0x113a8e['endUserId']);return _0x22bd43(_0x113a8e);});});})['catch'](function(_0x36c596){_0x2870ab(_0x36c596);});});};}function createEndUser(_0x1a013e,_0x2fd5db,_0x575b0b,_0x48f9b1){return new Promise(function(_0x321743,_0x543a8a){var _0x14dbd9=moment();var _0x453988={'method':_0x2102('0x26'),'uri':_0x48f9b1+_0x2102('0x27'),'body':{'contact':{'last_name':_0x1a013e['contactNumber'],'work_number':_0x1a013e[_0x2102('0x21')],'mobile_number':_0x1a013e[_0x2102('0x21')],'owner_id':_0x1a013e['userId'],'created_at':_0x14dbd9[_0x2102('0x28')](_0x2102('0x29'))}},'json':!![]};_0x453988['headers']=_0x575b0b;logger[_0x2102('0x10')](_0x2102('0x2a'));return rp(_0x453988)[_0x2102('0xc')](function(_0x210313){_0x1a013e[_0x2102('0x22')]=_0x210313[_0x2102('0x2b')]['id'];_0x321743(_0x1a013e);})[_0x2102('0x13')](function(_0x2cac5a){logger[_0x2102('0x14')]('['+[_0x2fd5db['toUpperCase']()]+']',_0x2cac5a[_0x2102('0x16')]);_0x543a8a(_0x2cac5a['message']);});});}function getTicket(_0xe82b48,_0x11e082,_0x1e9044,_0x206677,_0x10c9b1){return function(_0x464ccf){logger[_0x2102('0x10')]('Creating\x20new\x20task');return new Promise(function(_0x202e0b,_0x69a52e){var _0x36abca=moment();var _0x12e953={'method':_0x2102('0x26'),'uri':_0x1e9044+_0x2102('0x2c'),'body':{'title':intUtil[_0x2102('0x2d')](_0x206677[_0x2102('0x2e')],_0x10c9b1,'\x20'),'description':intUtil[_0x2102('0x2d')](_0x206677[_0x2102('0x2f')],_0x10c9b1,'\x0a'),'owner_id':_0x464ccf[_0x2102('0x1a')],'creater_id':_0x464ccf['adminId'],'targetable_id':_0x464ccf[_0x2102('0x22')],'targetable_type':'Contact','created_at':_0x36abca[_0x2102('0x28')](_0x2102('0x29')),'due_date':_0x36abca['add'](0x1e,'m')[_0x2102('0x28')](_0x2102('0x29'))},'json':!![]};_0x12e953[_0x2102('0xa')]=_0x11e082;return rp(_0x12e953)['then'](function(_0x423559){_0x464ccf[_0x2102('0x30')]=_0x423559[_0x2102('0x31')]['id'];logger[_0x2102('0x10')](_0x2102('0x32'),_0x464ccf[_0x2102('0x30')]);_0x202e0b(_0x464ccf);})['catch'](function(_0x394598){logger['error']('['+[_0xe82b48['toUpperCase']()]+']',_0x394598['message']);_0x69a52e(_0x394598[_0x2102('0x16')]);});});};}function emit(_0x2944df,_0x369096,_0x1a7380){var _0x272123={'uri':_0x2944df+_0x2102('0x33')+_0x1a7380};io['to'](util[_0x2102('0x28')](_0x2102('0x34'),_0x369096))[_0x2102('0x35')]('trigger:browser:url',_0x272123);}exports['cs']=function(_0x42ab1e,_0x113444,_0x1702b9,_0x4b9b0c,_0x52dfb4,_0x11e699,_0x59d683,_0x2acd4b){var _0x5a7b85={};var _0x1b09cd={'Authorization':_0x2102('0x36')+_0x11e699['apiKey']};_0x11e699[_0x2102('0x37')]=intUtil[_0x2102('0x38')](_0x11e699[_0x2102('0x37')]);_0x11e699['serverUrl']=intUtil[_0x2102('0x38')](_0x11e699[_0x2102('0x39')]);var _0x272fc7=_0x11e699[_0x2102('0x37')];_0x5a7b85['adminEmail']=_0x11e699[_0x2102('0x3a')];_0x5a7b85[_0x2102('0x21')]=_0x2acd4b[_0x2102('0x3b')]()===_0x2102('0x3c')?_0x113444['destcalleridnum']:_0x113444[_0x2102('0x3d')];_0x5a7b85[_0x2102('0x3e')]=_0x2acd4b===_0x2102('0x3f')||_0x2acd4b==='unmanaged'?_0x2102('0x3f'):_0x2102('0x3c');if(_0x4b9b0c){_0x5a7b85[_0x2102('0x18')]=_0x4b9b0c[_0x2102('0xe')];}var _0x56db61=util[_0x2102('0x28')](_0x2102('0x40'),_0x11e699['serverUrl'],_0x113444['uniqueid'],md5(_0x113444[_0x2102('0x41')]));if(_0x52dfb4&&_0x52dfb4[_0x2102('0x42')]){logger[_0x2102('0x10')](_0x2102('0x43'),_0x2102('0x44'));_0x113444[_0x2102('0x45')]=_0x56db61;}else if(_0x59d683&&_0x59d683[_0x2102('0x46')]&&_0x59d683[_0x2102('0x46')]!==_0x2102('0x47')){logger[_0x2102('0x10')](_0x2102('0x48'),_0x2102('0x44'));_0x113444[_0x2102('0x45')]=_0x56db61;}else{_0x113444[_0x2102('0x45')]='';}return getAdminId(_0x5a7b85,_0x2acd4b,_0x1b09cd,_0x272fc7)[_0x2102('0xc')](getUser(_0x2acd4b,_0x1b09cd,_0x272fc7))['then'](getEndUser(_0x2acd4b,_0x1b09cd,_0x272fc7))[_0x2102('0xc')](getTicket(_0x2acd4b,_0x1b09cd,_0x272fc7,_0x1702b9,_0x113444))[_0x2102('0xc')](function(_0x47e9a7){logger[_0x2102('0x10')](util[_0x2102('0x28')](_0x2102('0x49'),_0x47e9a7[_0x2102('0x30')]));if(_0x2acd4b!==_0x2102('0x4a')){logger[_0x2102('0x10')]('['+[_0x2acd4b[_0x2102('0x15')]()]+']',_0x2102('0x4b'));emit(_0x272fc7,_0x4b9b0c[_0x2102('0x4c')],_0x47e9a7[_0x2102('0x22')]);}})[_0x2102('0x13')](function(_0x1d1f17){logger[_0x2102('0x14')]('['+[_0x2acd4b[_0x2102('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x2102('0x4d')](_0x1d1f17,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbb07=['Getting\x20admin\x20information','then','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','userEmail','adminEmail','catch','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','moment','ioredis','./util','redis','defaults','localhost','/api/selector/owners'];(function(_0x3da2ff,_0x22f2bd){var _0x33695d=function(_0x43ffd3){while(--_0x43ffd3){_0x3da2ff['push'](_0x3da2ff['shift']());}};_0x33695d(++_0x22f2bd);}(_0xbb07,0x18c));var _0x7bb0=function(_0x39c148,_0x2fcfe9){_0x39c148=_0x39c148-0x0;var _0x5d8006=_0xbb07[_0x39c148];return _0x5d8006;};'use strict';var _=require(_0x7bb0('0x0'));var rp=require(_0x7bb0('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x7bb0('0x2'));var Promise=require('bluebird');var Redis=require(_0x7bb0('0x3'));var intUtil=require(_0x7bb0('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x7bb0('0x5')]=_[_0x7bb0('0x6')](config['redis'],{'host':_0x7bb0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x225bda,_0x358551,_0x46763c,_0x902dd8){return new Promise(function(_0x4eeb1b,_0x3e67af){var _0x392829=![];var _0x26c201={'method':'GET','uri':_0x902dd8+_0x7bb0('0x8'),'json':!![]};_0x26c201['headers']=_0x46763c;logger['info'](_0x7bb0('0x9'));return rp(_0x26c201)[_0x7bb0('0xa')](function(_0x116575){if(_0x116575){var _0x27c9fd=_0x116575['users'];var _0x4cd583=null;for(_0x4cd583=0x0;_0x4cd583<_0x27c9fd[_0x7bb0('0xb')];_0x4cd583++){if(_0x27c9fd[_0x4cd583][_0x7bb0('0xc')]===_0x225bda['adminEmail']){_0x225bda[_0x7bb0('0xd')]=_0x27c9fd[_0x4cd583]['id'];_0x392829=!![];}}if(_0x392829){logger[_0x7bb0('0xe')](_0x7bb0('0xf'),_0x225bda[_0x7bb0('0xd')]);_0x4eeb1b(_0x225bda);}else{_0x3e67af({'statusCode':0x194,'message':_0x7bb0('0x10')});}}else{_0x3e67af({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x14fb18){logger[_0x7bb0('0x11')]('['+[_0x358551[_0x7bb0('0x12')]()]+']',_0x14fb18[_0x7bb0('0x13')]);_0x3e67af(_0x14fb18);});});}function getUser(_0x1edab9,_0x1ba8a3,_0x34033f){return function(_0x19485c){return new Promise(function(_0x3fc782,_0x5237ac){var _0x546213={'method':_0x7bb0('0x14'),'uri':_0x34033f+_0x7bb0('0x8'),'json':!![]};_0x546213[_0x7bb0('0x15')]=_0x1ba8a3;logger[_0x7bb0('0xe')](_0x7bb0('0x16'));return rp(_0x546213)[_0x7bb0('0xa')](function(_0x563901){if(_0x563901){var _0xe77e12=_0x563901[_0x7bb0('0x17')];var _0xf3dd63=![];var _0x4de787=null;if(_0x19485c[_0x7bb0('0x18')]!==null){logger[_0x7bb0('0xe')](_0x7bb0('0x19'),_0x19485c['agentEmail']);_0x19485c['userEmail']=_0x19485c[_0x7bb0('0x18')];for(_0x4de787=0x0;_0x4de787<_0xe77e12['length'];_0x4de787++){if(_0xe77e12[_0x4de787][_0x7bb0('0xc')]===_0x19485c[_0x7bb0('0x18')]){_0xf3dd63=!![];_0x19485c[_0x7bb0('0x1a')]=_0xe77e12[_0x4de787]['id'];logger['info']('User\x20found:',_0x19485c[_0x7bb0('0x1a')]);}}}if(!_0xf3dd63){logger[_0x7bb0('0xe')]('Admin\x20selected');_0x19485c[_0x7bb0('0x1b')]=_0x19485c[_0x7bb0('0x1c')];_0x19485c[_0x7bb0('0x1a')]=_0x19485c[_0x7bb0('0xd')];_0xf3dd63=!![];}if(_0xf3dd63){_0x3fc782(_0x19485c);}else{_0x5237ac({'statusCode':0x194,'message':_0x7bb0('0x10')});}}else{_0x5237ac({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7bb0('0x1d')](function(_0x51a988){logger[_0x7bb0('0x11')]('['+[_0x1edab9[_0x7bb0('0x12')]()]+']',_0x51a988[_0x7bb0('0x13')]);_0x5237ac(_0x51a988);});});};}function searchContact(_0x525886,_0x38954c,_0x1a1a5e,_0x2a2544){return new Promise(function(_0x164395,_0x1e8d7d){var _0x36f98a={'method':'GET','headers':_0x38954c,'uri':_0x525886+'/api/lookup?q='+_0x2a2544+_0x7bb0('0x1e')+_0x1a1a5e+_0x7bb0('0x1f'),'json':!![]};rp(_0x36f98a)['then'](function(_0x145558){var _0x4187ea=_[_0x7bb0('0x20')](_0x145558['contacts'][_0x7bb0('0x21')],[_0x1a1a5e,_0x2a2544]);_0x164395(_0x4187ea);})['catch'](function(_0x39b1fe){_0x1e8d7d(_0x39b1fe);});});}function getEndUser(_0x41f71a,_0x3d2a00,_0x1fef99){return function(_0x3413c2){return new Promise(function(_0x395459,_0x366bd4){logger[_0x7bb0('0xe')](util[_0x7bb0('0x22')](_0x7bb0('0x23'),_0x3413c2[_0x7bb0('0x24')]));searchContact(_0x1fef99,_0x3d2a00,'mobile_number',_0x3413c2['contactNumber'])[_0x7bb0('0xa')](function(_0x31e097){if(_0x31e097){_0x3413c2['endUserId']=_0x31e097['id'];logger[_0x7bb0('0xe')](_0x7bb0('0x25'),_0x3413c2[_0x7bb0('0x26')]);return _0x395459(_0x3413c2);}searchContact(_0x1fef99,_0x3d2a00,'work_number',_0x3413c2[_0x7bb0('0x24')])[_0x7bb0('0xa')](function(_0x57d35b){if(_0x57d35b){_0x3413c2['endUserId']=_0x57d35b['id'];logger[_0x7bb0('0xe')](_0x7bb0('0x27'),_0x3413c2[_0x7bb0('0x26')]);return _0x395459(_0x3413c2);}createEndUser(_0x3413c2,_0x41f71a,_0x3d2a00,_0x1fef99)[_0x7bb0('0xa')](function(_0xfaf697){logger[_0x7bb0('0xe')](_0x7bb0('0x28'),_0xfaf697['endUserId']);return _0x395459(_0xfaf697);});});})[_0x7bb0('0x1d')](function(_0x4bd88f){_0x366bd4(_0x4bd88f);});});};}function createEndUser(_0x28d7aa,_0x3534e2,_0x6ed839,_0x2c6119){return new Promise(function(_0x402d14,_0x296fd8){var _0x161751=moment();var _0x2ed364={'method':_0x7bb0('0x29'),'uri':_0x2c6119+_0x7bb0('0x2a'),'body':{'contact':{'last_name':_0x28d7aa['contactNumber'],'work_number':_0x28d7aa[_0x7bb0('0x24')],'mobile_number':_0x28d7aa[_0x7bb0('0x24')],'owner_id':_0x28d7aa[_0x7bb0('0x1a')],'created_at':_0x161751[_0x7bb0('0x22')](_0x7bb0('0x2b'))}},'json':!![]};_0x2ed364[_0x7bb0('0x15')]=_0x6ed839;logger[_0x7bb0('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2ed364)[_0x7bb0('0xa')](function(_0xc1dade){_0x28d7aa['endUserId']=_0xc1dade[_0x7bb0('0x2c')]['id'];_0x402d14(_0x28d7aa);})[_0x7bb0('0x1d')](function(_0x168bcf){logger[_0x7bb0('0x11')]('['+[_0x3534e2[_0x7bb0('0x12')]()]+']',_0x168bcf['message']);_0x296fd8(_0x168bcf[_0x7bb0('0x13')]);});});}function getTicket(_0x4c51d5,_0x53bb89,_0x253fa7,_0x1b5710,_0x3a06e0){return function(_0xf761d7){logger['info'](_0x7bb0('0x2d'));return new Promise(function(_0x5be17b,_0x2e8a6d){var _0x5ccc56=moment();var _0x205ec4={'method':'POST','uri':_0x253fa7+_0x7bb0('0x2e'),'body':{'title':intUtil[_0x7bb0('0x2f')](_0x1b5710[_0x7bb0('0x30')],_0x3a06e0,'\x20'),'description':intUtil['getString'](_0x1b5710[_0x7bb0('0x31')],_0x3a06e0,'\x0a'),'owner_id':_0xf761d7[_0x7bb0('0x1a')],'creater_id':_0xf761d7['adminId'],'targetable_id':_0xf761d7[_0x7bb0('0x26')],'targetable_type':'Contact','created_at':_0x5ccc56[_0x7bb0('0x22')](_0x7bb0('0x2b')),'due_date':_0x5ccc56[_0x7bb0('0x32')](0x1e,'m')[_0x7bb0('0x22')](_0x7bb0('0x2b'))},'json':!![]};_0x205ec4['headers']=_0x53bb89;return rp(_0x205ec4)[_0x7bb0('0xa')](function(_0x38d6a2){_0xf761d7[_0x7bb0('0x33')]=_0x38d6a2[_0x7bb0('0x34')]['id'];logger['info'](_0x7bb0('0x35'),_0xf761d7['ticketId']);_0x5be17b(_0xf761d7);})[_0x7bb0('0x1d')](function(_0x775a62){logger[_0x7bb0('0x11')]('['+[_0x4c51d5[_0x7bb0('0x12')]()]+']',_0x775a62[_0x7bb0('0x13')]);_0x2e8a6d(_0x775a62[_0x7bb0('0x13')]);});});};}function emit(_0x3392a1,_0x59a18f,_0x278476){var _0x4d3632={'uri':_0x3392a1+'/contacts/'+_0x278476};io['to'](util[_0x7bb0('0x22')](_0x7bb0('0x36'),_0x59a18f))['emit'](_0x7bb0('0x37'),_0x4d3632);}exports['cs']=function(_0x49556c,_0x44dee8,_0x25732d,_0x2d6c5b,_0x3bbfbc,_0x288ce3,_0x3d41b6,_0x2e60e8){var _0x5a2290={};var _0x22cde2={'Authorization':_0x7bb0('0x38')+_0x288ce3[_0x7bb0('0x39')]};_0x288ce3[_0x7bb0('0x3a')]=intUtil['stripTrailingSlash'](_0x288ce3['remoteUri']);_0x288ce3['serverUrl']=intUtil[_0x7bb0('0x3b')](_0x288ce3['serverUrl']);var _0x3525cf=_0x288ce3[_0x7bb0('0x3a')];_0x5a2290[_0x7bb0('0x1c')]=_0x288ce3[_0x7bb0('0x3c')];_0x5a2290[_0x7bb0('0x24')]=_0x2e60e8[_0x7bb0('0x3d')]()==='outbound'?_0x44dee8[_0x7bb0('0x3e')]:_0x44dee8[_0x7bb0('0x3f')];_0x5a2290[_0x7bb0('0x40')]=_0x2e60e8===_0x7bb0('0x41')||_0x2e60e8===_0x7bb0('0x42')?_0x7bb0('0x41'):_0x7bb0('0x43');if(_0x2d6c5b){_0x5a2290[_0x7bb0('0x18')]=_0x2d6c5b[_0x7bb0('0xc')];}var _0x37d395=util[_0x7bb0('0x22')](_0x7bb0('0x44'),_0x288ce3[_0x7bb0('0x45')],_0x44dee8[_0x7bb0('0x46')],md5(_0x44dee8[_0x7bb0('0x46')]));if(_0x3bbfbc&&_0x3bbfbc[_0x7bb0('0x47')]){logger[_0x7bb0('0xe')](_0x7bb0('0x48'),_0x7bb0('0x49'));_0x44dee8[_0x7bb0('0x4a')]=_0x37d395;}else if(_0x3d41b6&&_0x3d41b6[_0x7bb0('0x4b')]&&_0x3d41b6[_0x7bb0('0x4b')]!==_0x7bb0('0x4c')){logger['info'](_0x7bb0('0x4d'),_0x7bb0('0x49'));_0x44dee8[_0x7bb0('0x4a')]=_0x37d395;}else{_0x44dee8[_0x7bb0('0x4a')]='';}return getAdminId(_0x5a2290,_0x2e60e8,_0x22cde2,_0x3525cf)[_0x7bb0('0xa')](getUser(_0x2e60e8,_0x22cde2,_0x3525cf))['then'](getEndUser(_0x2e60e8,_0x22cde2,_0x3525cf))[_0x7bb0('0xa')](getTicket(_0x2e60e8,_0x22cde2,_0x3525cf,_0x25732d,_0x44dee8))[_0x7bb0('0xa')](function(_0x3330f2){logger[_0x7bb0('0xe')](util['format'](_0x7bb0('0x4e'),_0x3330f2[_0x7bb0('0x33')]));if(_0x2e60e8!==_0x7bb0('0x42')){logger[_0x7bb0('0xe')]('['+[_0x2e60e8[_0x7bb0('0x12')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3525cf,_0x2d6c5b[_0x7bb0('0x4f')],_0x3330f2[_0x7bb0('0x26')]);}})[_0x7bb0('0x1d')](function(_0x24c20d){logger[_0x7bb0('0x11')]('['+[_0x2e60e8[_0x7bb0('0x12')]()]+_0x7bb0('0x50'),util['inspect'](_0x24c20d,{'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 0f0c052..d86b699 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 _0xd634=['queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','data3'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0xd634,0x16d));var _0x4d63=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xd634[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x4d63('0x0'));var util=require(_0x4d63('0x1'));var zendesk=require(_0x4d63('0x2'));var salesforce=require(_0x4d63('0x3'));var sugarcrm=require(_0x4d63('0x4'));var freshdesk=require(_0x4d63('0x5'));var zoho=require(_0x4d63('0x6'));var desk=require(_0x4d63('0x7'));var vtiger=require(_0x4d63('0x8'));var servicenow=require(_0x4d63('0x9'));var dynamics365=require(_0x4d63('0xa'));var freshsales=require(_0x4d63('0xb'));var integrations=[_0x4d63('0xc'),_0x4d63('0xd'),_0x4d63('0xe'),'freshdesk',_0x4d63('0xf'),'desk','vtiger',_0x4d63('0x10'),_0x4d63('0x11'),_0x4d63('0x12')];exports[_0x4d63('0x13')]=function(_0x2a3f77,_0x3f70c3,_0x12ead8,_0x2b319a,_0x3dd9c6,_0x38b292){if(_0x12ead8){if(_[_0x4d63('0x14')](integrations,_0x2a3f77[_0x4d63('0x15')][_0x4d63('0x16')]())){try{var _0x4d2ec2=null;var _0x58c95b='';var _0x32e0c8=_0x12ead8[_0x2a3f77[_0x4d63('0x15')]['toLowerCase']()];if(_0x32e0c8){var _0x154d37=_0x32e0c8[_0x2a3f77[_0x4d63('0x17')]];if(_0x154d37){var _0x127c48=_['find'](_0x154d37['Configurations'],{'id':parseInt(_0x2a3f77[_0x4d63('0x18')],0xa)});if(_0x127c48){if(_0x2b319a){if(_0x3dd9c6&&_0x3f70c3[_0x4d63('0x19')]){_0x58c95b=_0x4d63('0x19');}else if(_0x3f70c3[_0x4d63('0x1a')]){_0x58c95b=_0x4d63('0x1b');}else{console[_0x4d63('0x1c')](_0x4d63('0x1d'),_0x3f70c3);}}else{_0x58c95b=_0x4d63('0x1e');}switch(_0x2a3f77['data1'][_0x4d63('0x16')]()){case _0x4d63('0xc'):zendesk[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0xd'):salesforce[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0xe'):sugarcrm[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0x1f'):freshdesk[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case _0x4d63('0xf'):zoho[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case'desk':desk[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case'vtiger':vtiger[_0x58c95b](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292);break;case'freshsales':freshsales['cs'](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292,_0x58c95b);break;case _0x4d63('0x12'):servicenow['cs'](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292,_0x58c95b);break;case _0x4d63('0x10'):dynamics365['cs'](_0x2a3f77,_0x3f70c3,_0x127c48,_0x2b319a,_0x3dd9c6,_0x154d37,_0x38b292,_0x58c95b);break;default:console[_0x4d63('0x1c')](_0x4d63('0x20'));}}else{_0x4d2ec2=require(_0x4d63('0x21'))(_0x2a3f77['data1']['toLowerCase']());_0x4d2ec2[_0x4d63('0x22')]('[EXEC]',util[_0x4d63('0x23')](_0x4d63('0x24'),_0x2a3f77['data1']['toLowerCase'](),_0x2a3f77[_0x4d63('0x18')]));}}else{_0x4d2ec2=require('../../../../config/logger')(_0x2a3f77[_0x4d63('0x15')][_0x4d63('0x16')]());_0x4d2ec2['error'](_0x4d63('0x25'),util[_0x4d63('0x23')](_0x4d63('0x26'),_0x2a3f77[_0x4d63('0x15')][_0x4d63('0x16')](),_0x2a3f77['data2']));}}else{}}catch(_0x517308){console[_0x4d63('0x22')](_0x517308);}}}}; \ No newline at end of file +var _0xd002=['./freshsales','zoho','desk','dynamics365','freshsales','servicenow','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','freshdesk','vtiger','log','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./salesforce','./freshdesk','./zoho','./vtiger','./servicenow'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xd002,0x7d));var _0x2d00=function(_0x1f8739,_0x1bbe57){_0x1f8739=_0x1f8739-0x0;var _0x1c2e9a=_0xd002[_0x1f8739];return _0x1c2e9a;};'use strict';var _=require(_0x2d00('0x0'));var util=require(_0x2d00('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x2d00('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2d00('0x3'));var zoho=require(_0x2d00('0x4'));var desk=require('./desk');var vtiger=require(_0x2d00('0x5'));var servicenow=require(_0x2d00('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2d00('0x7'));var integrations=['zendesk','salesforce','sugarcrm','freshdesk',_0x2d00('0x8'),_0x2d00('0x9'),'vtiger',_0x2d00('0xa'),_0x2d00('0xb'),_0x2d00('0xc')];exports['exec']=function(_0xf94e9d,_0x50f5e0,_0x4d18a6,_0x103ef4,_0xa3ca95,_0x318e14){if(_0x4d18a6){if(_['includes'](integrations,_0xf94e9d['data1']['toLowerCase']())){try{var _0x306ea1=null;var _0x516b85='';var _0xfedc24=_0x4d18a6[_0xf94e9d[_0x2d00('0xd')][_0x2d00('0xe')]()];if(_0xfedc24){var _0x2b2bf5=_0xfedc24[_0xf94e9d['data2']];if(_0x2b2bf5){var _0x5e4c8b=_['find'](_0x2b2bf5[_0x2d00('0xf')],{'id':parseInt(_0xf94e9d[_0x2d00('0x10')],0xa)});if(_0x5e4c8b){if(_0x103ef4){if(_0xa3ca95&&_0x50f5e0[_0x2d00('0x11')]){_0x516b85=_0x2d00('0x11');}else if(_0x50f5e0[_0x2d00('0x12')]){_0x516b85=_0x2d00('0x13');}else{console['log'](_0x2d00('0x14'),_0x50f5e0);}}else{_0x516b85=_0x2d00('0x15');}switch(_0xf94e9d[_0x2d00('0xd')][_0x2d00('0xe')]()){case'zendesk':zendesk[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case _0x2d00('0x16'):salesforce[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case _0x2d00('0x17'):sugarcrm[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case _0x2d00('0x18'):freshdesk[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case _0x2d00('0x8'):zoho[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case _0x2d00('0x9'):desk[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case _0x2d00('0x19'):vtiger[_0x516b85](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14);break;case'freshsales':freshsales['cs'](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14,_0x516b85);break;case'servicenow':servicenow['cs'](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14,_0x516b85);break;case _0x2d00('0xa'):dynamics365['cs'](_0xf94e9d,_0x50f5e0,_0x5e4c8b,_0x103ef4,_0xa3ca95,_0x2b2bf5,_0x318e14,_0x516b85);break;default:console[_0x2d00('0x1a')]('unknown\x20integration');}}else{_0x306ea1=require('../../../../config/logger')(_0xf94e9d['data1']['toLowerCase']());_0x306ea1[_0x2d00('0x1b')](_0x2d00('0x1c'),util[_0x2d00('0x1d')]('%s\x20configuration\x20#%s\x20not\x20found',_0xf94e9d[_0x2d00('0xd')]['toLowerCase'](),_0xf94e9d['data3']));}}else{_0x306ea1=require(_0x2d00('0x1e'))(_0xf94e9d[_0x2d00('0xd')]['toLowerCase']());_0x306ea1[_0x2d00('0x1b')]('[EXEC]',util[_0x2d00('0x1d')](_0x2d00('0x1f'),_0xf94e9d[_0x2d00('0xd')][_0x2d00('0xe')](),_0xf94e9d[_0x2d00('0x20')]));}}else{}}catch(_0x74350e){console['error'](_0x74350e);}}}}; \ 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 56983bc..2c35e7f 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 _0x55e8=['bluebird','md5','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','Email','resolve','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','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','contact','first','Phone','attributes','type','toLowerCase','moduleCreate','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','forEach','includes','string','idField','content','variable','variableName','customVariable','Variable','name','toString','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','serverUrl','none','destcalleridname','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment'];(function(_0x49923f,_0x671404){var _0x560684=function(_0x5a152b){while(--_0x5a152b){_0x49923f['push'](_0x49923f['shift']());}};_0x560684(++_0x671404);}(_0x55e8,0x183));var _0x855e=function(_0x2e55cf,_0x2b3721){_0x2e55cf=_0x2e55cf-0x0;var _0x46d0c3=_0x55e8[_0x2e55cf];return _0x46d0c3;};'use strict';var _=require(_0x855e('0x0'));var rp=require(_0x855e('0x1'));var moment=require(_0x855e('0x2'));var BPromise=require(_0x855e('0x3'));var md5=require(_0x855e('0x4'));var jsforce=require(_0x855e('0x5'));var util=require('util');var Redis=require(_0x855e('0x6'));var intUtil=require('./util');var config=require(_0x855e('0x7'));var logger=require(_0x855e('0x8'))(_0x855e('0x9'));config[_0x855e('0xa')]=_[_0x855e('0xb')](config[_0x855e('0xa')],{'host':_0x855e('0xc'),'port':0x18eb});var io=require(_0x855e('0xd'))(new Redis(config[_0x855e('0xa')]));function emit(_0x2d5974,_0x28579e,_0x11344e){io['to'](_0x2d5974)[_0x855e('0xe')](_0x28579e,_0x11344e);}function getTicket(_0x166d3b,_0x250f80,_0x173103,_0x284b6e,_0x4c7a97,_0x24924a,_0x3d1bc0,_0x23749f){var _0x299545=Object[_0x855e('0xf')]({},{'OwnerId':_0x250f80['id'],'Subject':intUtil[_0x855e('0x10')](_0x284b6e[_0x855e('0x11')],_0x4c7a97,'\x20'),'Description':intUtil[_0x855e('0x10')](_0x284b6e[_0x855e('0x12')],_0x4c7a97,'\x0a')},getCustomFields(_0x24924a,_0x4c7a97));if(_0x173103){if(_0x284b6e[_0x855e('0x13')]==='Task'){_0x299545[_0x855e('0x14')]=moment[_0x855e('0x15')]();_0x299545[_0x855e('0x16')]=![];_0x299545[_0x855e('0x17')]=![];if(_0x173103[_0x855e('0x18')]==='contact'||_0x173103[_0x855e('0x18')]===_0x855e('0x19')){_0x299545[_0x855e('0x1a')]=_0x173103['id'];}else if(_0x173103[_0x855e('0x18')]===_0x855e('0x1b')){_0x299545[_0x855e('0x1c')]=_0x173103['id'];}}else if(_0x284b6e['ticketType']===_0x855e('0x1d')){if(_0x173103[_0x855e('0x18')]==='contact'){_0x299545[_0x855e('0x1e')]=_0x173103['id'];}else if(_0x173103[_0x855e('0x18')]==='account'){_0x299545[_0x855e('0x1f')]=_0x173103['id'];}else if(_0x173103[_0x855e('0x18')]==='lead'&&_0x284b6e['leadId']){_0x299545[_0x284b6e[_0x855e('0x20')]]=_0x173103['id'];}else{logger[_0x855e('0x21')](_0x855e('0x22'));}}}return _0x3d1bc0[_0x855e('0x23')](_0x284b6e[_0x855e('0x13')])[_0x855e('0x24')](_0x299545);}function getUser(_0x353345,_0x41e044,_0x1c704f){if(!_[_0x855e('0x25')](_0x41e044)&&intUtil[_0x855e('0x26')](_0x41e044)){var _0x266f05={'Email':_0x41e044};var _0x8d2151={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1c704f['sobject'](_0x855e('0x27'))[_0x855e('0x28')](_0x266f05,_0x8d2151)[_0x855e('0x29')]()[_0x855e('0x2a')](function(_0xe75887){if(_0xe75887['length']){var _0x1c996b=_[_0x855e('0x28')](_0xe75887,function(_0xca1537){return _0xca1537[_0x855e('0x2b')]===_0x41e044;});if(_0x1c996b){logger[_0x855e('0x21')]('Agent\x20%s\x20found.',_0x41e044);return BPromise[_0x855e('0x2c')]({'id':_0x1c996b['Id'],'name':_0x1c996b['Name']});}}else{logger[_0x855e('0x21')](_0x855e('0x2d'),_0x41e044);return _0x1c704f[_0x855e('0x2e')]()['then'](function(_0x443c0e){return BPromise[_0x855e('0x2c')]({'id':_0x443c0e[_0x855e('0x2f')],'name':_0x443c0e[_0x855e('0x30')]});});}});}else{logger[_0x855e('0x21')](_0x855e('0x2d'),_0x41e044);return _0x1c704f[_0x855e('0x2e')]()[_0x855e('0x2a')](function(_0x555c5b){return BPromise[_0x855e('0x2c')]({'id':_0x555c5b['user_id'],'name':_0x555c5b[_0x855e('0x30')]});});}}function getEndUser(_0x386b64,_0x583d68,_0x30004d,_0x323f62,_0x3dbb20){var _0xebd052={'$or':{'Phone':_0x323f62}};var _0x31e3ea={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x855e('0x2a')](function(){logger[_0x855e('0x21')](_0x855e('0x31'),_0x323f62,_0x583d68[_0x855e('0x32')]);switch(_0x583d68[_0x855e('0x32')]){case _0x855e('0x33'):var _0x404c19=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x35')]){var _0x1985fe={};_0x1985fe[_0x583d68['additionalSearchContact']]=_0x323f62;_[_0x855e('0x36')](_0x404c19[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')]('Contact')[_0x855e('0x28')](_0x404c19,_0x31e3ea)[_0x855e('0x29')]()[_0x855e('0x2a')](function(_0x2e3310){if(_0x2e3310&&_0x2e3310[_0x855e('0x38')]){return _0x2e3310;}else{var _0x42562c=_['cloneDeep'](_0xebd052);if(_0x583d68[_0x855e('0x39')]){var _0x4e6756={};_0x4e6756[_0x583d68[_0x855e('0x39')]]=_0x323f62;_[_0x855e('0x36')](_0x42562c['$or'],_0x4e6756);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3a'))[_0x855e('0x28')](_0x42562c,_0x31e3ea);}});case _0x855e('0x3b'):var _0x152cf3=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x3c')]){var _0x1985fe={};_0x1985fe[_0x583d68[_0x855e('0x3c')]]=_0x323f62;_[_0x855e('0x36')](_0x152cf3[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3d'))[_0x855e('0x28')](_0x152cf3,_0x31e3ea)[_0x855e('0x29')]()['then'](function(_0x30edd5){if(_0x30edd5&&_0x30edd5[_0x855e('0x38')]){return _0x30edd5;}else{var _0x5519cc=_[_0x855e('0x34')](_0xebd052);if(_0x583d68['additionalSearchContact']){var _0x4724b7={};_0x4724b7[_0x583d68[_0x855e('0x35')]]=_0x323f62;_[_0x855e('0x36')](_0x5519cc[_0x855e('0x37')],_0x4724b7);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3e'))[_0x855e('0x28')](_0x5519cc,_0x31e3ea)[_0x855e('0x2a')](function(_0x349bd1){if(_0x349bd1&&_0x349bd1['length']){return _0x349bd1;}else{var _0x2efadb=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x39')]){var _0x3a1e70={};_0x3a1e70[_0x583d68[_0x855e('0x39')]]=_0x323f62;_['merge'](_0x2efadb['$or'],_0x3a1e70);}return _0x3dbb20['sobject'](_0x855e('0x3a'))[_0x855e('0x28')](_0x2efadb,_0x31e3ea);}});}});case _0x855e('0x3f'):var _0x404c19=_[_0x855e('0x34')](_0xebd052);if(_0x583d68[_0x855e('0x35')]){var _0x1985fe={};_0x1985fe[_0x583d68[_0x855e('0x35')]]=_0x323f62;_['merge'](_0x404c19[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')]('Contact')[_0x855e('0x28')](_0x404c19,_0x31e3ea)[_0x855e('0x29')]();case _0x855e('0x19'):var _0x263032=_['cloneDeep'](_0xebd052);if(_0x583d68[_0x855e('0x39')]){var _0x1985fe={};_0x1985fe[_0x583d68[_0x855e('0x39')]]=_0x323f62;_[_0x855e('0x36')](_0x263032[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3a'))['find'](_0x263032,_0x31e3ea);case _0x855e('0x1b'):var _0x152cf3=_['cloneDeep'](_0xebd052);if(_0x583d68[_0x855e('0x3c')]){var _0x1985fe={};_0x1985fe[_0x583d68['additionalSearchAccount']]=_0x323f62;_[_0x855e('0x36')](_0x152cf3[_0x855e('0x37')],_0x1985fe);}return _0x3dbb20[_0x855e('0x23')](_0x855e('0x3d'))['find'](_0x152cf3,_0x31e3ea);default:return null;}})[_0x855e('0x2a')](function(_0x3347f1){if(_0x3347f1&&_0x3347f1[_0x855e('0x38')]){var _0x45c609=_[_0x855e('0x40')](_0x3347f1);if(_0x45c609){return BPromise[_0x855e('0x2c')]({'id':_0x45c609['Id'],'name':_0x45c609['Name'],'phone':_0x45c609[_0x855e('0x41')],'endUserType':_0x45c609[_0x855e('0x42')][_0x855e('0x43')][_0x855e('0x44')]()});}}})[_0x855e('0x2a')](function(_0xfc94f){if(_0xfc94f){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0xfc94f[_0x855e('0x18')],_0x323f62);return BPromise[_0x855e('0x2c')](_0xfc94f);}else{logger[_0x855e('0x21')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x323f62);var _0x486d4e={'Phone':_0x323f62};if(_0x583d68[_0x855e('0x45')]){if(_0x583d68['moduleCreate']===_0x855e('0x3f')){logger[_0x855e('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x323f62,_0x583d68[_0x855e('0x45')]);_0x486d4e[_0x855e('0x46')]=_0x30004d!==_0x855e('0x47')?_0x30004d:util['format'](_0x855e('0x48'),_0x323f62);}else if(_0x583d68[_0x855e('0x45')]===_0x855e('0x19')){logger[_0x855e('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x323f62,_0x583d68[_0x855e('0x45')]);_0x486d4e[_0x855e('0x46')]=_0x30004d!==_0x855e('0x47')?_0x30004d:util[_0x855e('0x49')](_0x855e('0x48'),_0x323f62);_0x486d4e[_0x855e('0x4a')]=_0x855e('0x4b');}else if(_0x583d68[_0x855e('0x45')]===_0x855e('0x1b')){logger['info'](_0x855e('0x4c'),_0x323f62,_0x583d68['moduleCreate']);_0x486d4e['Name']=_0x30004d!==''?_0x30004d:util[_0x855e('0x49')](_0x855e('0x48'),_0x323f62);}else{return null;}}return _0x3dbb20[_0x855e('0x23')](_['upperFirst'](_0x583d68[_0x855e('0x45')]))['create'](_0x486d4e)['then'](function(_0x4386f8){return BPromise[_0x855e('0x2c')]({'id':_0x4386f8['id'],'endUserType':_0x583d68[_0x855e('0x45')]});});}});}function getCustomFields(_0x478d49,_0x579a98){var _0x499e0f={};if(_0x478d49[_0x855e('0x38')]>0x0){_[_0x855e('0x4d')](_0x478d49,function(_0x5cbb21){if(_[_0x855e('0x4e')]([_0x855e('0x4f'),'picklist'],_0x5cbb21[_0x855e('0x43')])&&_0x5cbb21[_0x855e('0x50')]){_0x499e0f[_0x5cbb21['idField']]=_0x5cbb21[_0x855e('0x51')]['toString']();}else if(_0x5cbb21['type']===_0x855e('0x52')&&_0x5cbb21[_0x855e('0x53')]&&_0x5cbb21[_0x855e('0x50')]){_0x579a98[_0x5cbb21['variableName']]&&(_0x499e0f[_0x5cbb21[_0x855e('0x50')]]=_0x579a98[_0x5cbb21[_0x855e('0x53')]]['toString']());}else if(_0x5cbb21[_0x855e('0x43')]===_0x855e('0x54')&&_0x5cbb21[_0x855e('0x55')]&&_0x5cbb21[_0x855e('0x55')][_0x855e('0x56')]&&_0x5cbb21['idField']){_0x579a98[_0x5cbb21[_0x855e('0x55')][_0x855e('0x56')]['toLowerCase']()]&&(_0x499e0f[_0x5cbb21['idField']]=_0x579a98[_0x5cbb21['Variable'][_0x855e('0x56')][_0x855e('0x44')]()][_0x855e('0x57')]());}});}return _0x499e0f;}function getConnection(_0x4c505e){var _0x6e20de=_0x4c505e['password'][_0x855e('0x58')](_0x4c505e['securityToken']);var _0x438b70=new jsforce[(_0x855e('0x59'))]({'oauth2':{'loginUrl':_0x4c505e[_0x855e('0x5a')]||_0x855e('0x5b'),'clientId':_0x4c505e[_0x855e('0x5c')],'clientSecret':_0x4c505e[_0x855e('0x5d')]}});return _0x438b70['login'](_0x4c505e[_0x855e('0x5e')],_0x6e20de)['then'](function(){logger[_0x855e('0x21')](_0x855e('0x5f'));return _0x438b70;});}exports[_0x855e('0x60')]=function(_0x5de2bb,_0x366c45,_0x1399c5,_0x4441ae,_0x34e0ed,_0x5b15a9){var _0x51eb0a,_0x11b24e,_0x1d1f20,_0x9fb078;_0x5b15a9['serverUrl']=intUtil[_0x855e('0x61')](_0x5b15a9['serverUrl']);_0x5b15a9[_0x855e('0x5a')]=intUtil['stripTrailingSlash'](_0x5b15a9[_0x855e('0x5a')]);if(_0x34e0ed&&_0x34e0ed[_0x855e('0x62')]){logger[_0x855e('0x21')](_0x855e('0x63'),_0x855e('0x64'));_0x366c45[_0x855e('0x65')]=util['format'](_0x855e('0x66'),_0x5b15a9['serverUrl'],_0x366c45[_0x855e('0x67')],md5(_0x366c45[_0x855e('0x67')]));}else{_0x366c45[_0x855e('0x65')]='';}return getConnection(_0x5b15a9)[_0x855e('0x2a')](function(_0x4d4cb2){_0x9fb078=_0x4d4cb2;return getUser(_0x5b15a9,_0x4441ae[_0x855e('0x68')],_0x9fb078);})[_0x855e('0x2a')](function(_0x167654){_0x51eb0a=_0x167654;return getEndUser(_0x5b15a9,_0x1399c5,_0x366c45[_0x855e('0x69')],_0x366c45[_0x855e('0x6a')],_0x9fb078);})[_0x855e('0x2a')](function(_0x46f506){_0x11b24e=_0x46f506;return getTicket(_0x5b15a9,_0x51eb0a,_0x11b24e,_0x1399c5,_0x366c45,_0x1399c5['Fields'],_0x9fb078,'queue');})[_0x855e('0x2a')](function(_0x2aba1d){_0x1d1f20=_0x2aba1d;logger[_0x855e('0x21')](_0x855e('0x6b'),_0x1d1f20['id']);logger[_0x855e('0x21')](_0x855e('0x6c'),_0x1d1f20['id'],_0x4441ae['name'],_0x5b15a9[_0x855e('0x43')]);switch(_0x5b15a9[_0x855e('0x43')]){case _0x855e('0x6d'):emit(util['format'](_0x855e('0x6e'),_0x4441ae[_0x855e('0x56')]),'trigger:salesforce:display',{'recordId':_0x1d1f20['id']});break;case'newTab':emit(util[_0x855e('0x49')](_0x855e('0x6e'),_0x4441ae[_0x855e('0x56')]),_0x855e('0x6f'),{'uri':util[_0x855e('0x49')](_0x855e('0x70'),_0x9fb078[_0x855e('0x71')],_0x1d1f20['id'])});break;default:logger[_0x855e('0x72')](_0x855e('0x73'));}})[_0x855e('0x74')](function(_0x5d98b3){logger[_0x855e('0x72')](_0x855e('0x63'),_0x5d98b3);});};exports['outbound']=function(_0x27de79,_0x4a3d90,_0x3c2a47,_0x109356,_0x38944d,_0x268e22,_0x47bbbb){var _0x1c4b7b,_0x3f3e4d,_0x15f741,_0xa8c0bb;_0x268e22[_0x855e('0x75')]=intUtil[_0x855e('0x61')](_0x268e22[_0x855e('0x75')]);_0x268e22[_0x855e('0x5a')]=intUtil[_0x855e('0x61')](_0x268e22[_0x855e('0x5a')]);if(_0x47bbbb&&_0x47bbbb['recordingFormat']&&_0x47bbbb['recordingFormat']!==_0x855e('0x76')){logger[_0x855e('0x21')]('[OUTBOUND]',_0x855e('0x64'));_0x4a3d90[_0x855e('0x65')]=util['format'](_0x855e('0x66'),_0x268e22[_0x855e('0x75')],_0x4a3d90[_0x855e('0x67')],md5(_0x4a3d90[_0x855e('0x67')]));}return getConnection(_0x268e22)[_0x855e('0x2a')](function(_0x829d02){_0xa8c0bb=_0x829d02;return getUser(_0x268e22,_0x109356['email'],_0xa8c0bb);})[_0x855e('0x2a')](function(_0xcb9b43){_0x1c4b7b=_0xcb9b43;return getEndUser(_0x268e22,_0x3c2a47,_0x4a3d90[_0x855e('0x77')],_0x4a3d90['destcalleridnum'],_0xa8c0bb);})[_0x855e('0x2a')](function(_0x14a8ab){_0x3f3e4d=_0x14a8ab;return getTicket(_0x268e22,_0x1c4b7b,_0x3f3e4d,_0x3c2a47,_0x4a3d90,_0x3c2a47[_0x855e('0x78')],_0xa8c0bb,_0x855e('0x79'));})[_0x855e('0x2a')](function(_0xd17242){_0x15f741=_0xd17242;logger['info'](_0x855e('0x7a'),_0x15f741['id']);logger['info'](_0x855e('0x7b'),_0x15f741['id'],_0x109356[_0x855e('0x56')],_0x268e22[_0x855e('0x43')]);switch(_0x268e22[_0x855e('0x43')]){case'integrationTab':emit(util[_0x855e('0x49')](_0x855e('0x6e'),_0x109356[_0x855e('0x56')]),'trigger:salesforce:display',{'recordId':_0x15f741['id']});break;case'newTab':emit(util['format'](_0x855e('0x6e'),_0x109356['name']),_0x855e('0x6f'),{'uri':util['format']('%s/%s/e',_0xa8c0bb[_0x855e('0x71')],_0x15f741['id'])});break;default:logger['error'](_0x855e('0x7c'),_0x855e('0x7d'));}})['catch'](function(_0x88fca8){logger[_0x855e('0x72')]('[OUTBOUND]',_0x88fca8);});};exports[_0x855e('0x7e')]=function(_0x16df15,_0x2d5e8c,_0x2e82c4,_0x48b830,_0x47d401,_0x2ea279){var _0xb0e326,_0x27ad1b,_0x57e395,_0x33d494;_0x2ea279[_0x855e('0x75')]=intUtil[_0x855e('0x61')](_0x2ea279[_0x855e('0x75')]);_0x2ea279[_0x855e('0x5a')]=intUtil[_0x855e('0x61')](_0x2ea279[_0x855e('0x5a')]);if(_0x47d401&&_0x47d401[_0x855e('0x62')]){logger[_0x855e('0x21')]('['+_0x2d5e8c['lastevent'][_0x855e('0x7f')]()+']',_0x855e('0x64'));_0x2d5e8c[_0x855e('0x65')]=util[_0x855e('0x49')](_0x855e('0x66'),_0x2ea279[_0x855e('0x75')],_0x2d5e8c[_0x855e('0x67')],md5(_0x2d5e8c[_0x855e('0x67')]));}else{_0x2d5e8c['recordingURL']='';}return getConnection(_0x2ea279)[_0x855e('0x2a')](function(_0x47d1f5){_0x33d494=_0x47d1f5;if(!_['isNil'](_0x48b830)){return getUser(_0x2ea279,_0x48b830[_0x855e('0x56')],_0x33d494);}else{return getUser(_0x2ea279,null,_0x33d494);}})[_0x855e('0x2a')](function(_0x31369b){_0xb0e326=_0x31369b;return getEndUser(_0x2ea279,_0x2e82c4,_0x2d5e8c[_0x855e('0x69')],_0x2d5e8c[_0x855e('0x6a')],_0x33d494);})[_0x855e('0x2a')](function(_0x9de831){_0x27ad1b=_0x9de831;return getTicket(_0x2ea279,_0xb0e326,_0x27ad1b,_0x2e82c4,_0x2d5e8c,_0x2e82c4[_0x855e('0x78')],_0x33d494);})[_0x855e('0x2a')](function(_0x195606){_0x57e395=_0x195606;logger[_0x855e('0x21')]('['+_0x2d5e8c[_0x855e('0x80')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x57e395['id']);logger[_0x855e('0x21')]('['+_0x2d5e8c[_0x855e('0x80')][_0x855e('0x7f')]()+_0x855e('0x81'),_0x2ea279[_0x855e('0x43')]);})[_0x855e('0x74')](function(_0x1de827){logger['error']('['+_0x2d5e8c[_0x855e('0x80')]['toUpperCase']()+']',_0x1de827);});}; \ No newline at end of file +var _0x45b1=['endUserType','WhoId','WhatId','Case','contact','ContactId','account','leadId','info','sobject','isNil','validateEmail','User','execute','length','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','cloneDeep','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','create','forEach','string','picklist','idField','content','toString','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','assign','Subjects','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence'];(function(_0x1e6a11,_0x3b6439){var _0xddb333=function(_0x48720e){while(--_0x48720e){_0x1e6a11['push'](_0x1e6a11['shift']());}};_0xddb333(++_0x3b6439);}(_0x45b1,0xfa));var _0x145b=function(_0x26dae0,_0x410c2c){_0x26dae0=_0x26dae0-0x0;var _0x47733b=_0x45b1[_0x26dae0];return _0x47733b;};'use strict';var _=require(_0x145b('0x0'));var rp=require(_0x145b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x145b('0x2'));var jsforce=require(_0x145b('0x3'));var util=require(_0x145b('0x4'));var Redis=require(_0x145b('0x5'));var intUtil=require(_0x145b('0x6'));var config=require(_0x145b('0x7'));var logger=require(_0x145b('0x8'))('salesforce');config[_0x145b('0x9')]=_[_0x145b('0xa')](config[_0x145b('0x9')],{'host':_0x145b('0xb'),'port':0x18eb});var io=require(_0x145b('0xc'))(new Redis(config[_0x145b('0x9')]));function emit(_0x4c3e01,_0x9f5e27,_0x5b8a4d){io['to'](_0x4c3e01)['emit'](_0x9f5e27,_0x5b8a4d);}function getTicket(_0x27312e,_0x3a658,_0x2e4f96,_0x2d8f1c,_0x21d754,_0x14274b,_0x4487f2,_0xff794c){var _0x56a2bc=Object[_0x145b('0xd')]({},{'OwnerId':_0x3a658['id'],'Subject':intUtil['getString'](_0x2d8f1c[_0x145b('0xe')],_0x21d754,'\x20'),'Description':intUtil[_0x145b('0xf')](_0x2d8f1c['Descriptions'],_0x21d754,'\x0a')},getCustomFields(_0x14274b,_0x21d754));if(_0x2e4f96){if(_0x2d8f1c[_0x145b('0x10')]===_0x145b('0x11')){_0x56a2bc[_0x145b('0x12')]=moment[_0x145b('0x13')]();_0x56a2bc[_0x145b('0x14')]=![];_0x56a2bc[_0x145b('0x15')]=![];if(_0x2e4f96[_0x145b('0x16')]==='contact'||_0x2e4f96['endUserType']==='lead'){_0x56a2bc[_0x145b('0x17')]=_0x2e4f96['id'];}else if(_0x2e4f96[_0x145b('0x16')]==='account'){_0x56a2bc[_0x145b('0x18')]=_0x2e4f96['id'];}}else if(_0x2d8f1c[_0x145b('0x10')]===_0x145b('0x19')){if(_0x2e4f96[_0x145b('0x16')]===_0x145b('0x1a')){_0x56a2bc[_0x145b('0x1b')]=_0x2e4f96['id'];}else if(_0x2e4f96[_0x145b('0x16')]===_0x145b('0x1c')){_0x56a2bc['AccountId']=_0x2e4f96['id'];}else if(_0x2e4f96[_0x145b('0x16')]==='lead'&&_0x2d8f1c['leadId']){_0x56a2bc[_0x2d8f1c[_0x145b('0x1d')]]=_0x2e4f96['id'];}else{logger[_0x145b('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4487f2[_0x145b('0x1f')](_0x2d8f1c['ticketType'])['create'](_0x56a2bc);}function getUser(_0xf08b38,_0x158d2e,_0x4ab10f){if(!_[_0x145b('0x20')](_0x158d2e)&&intUtil[_0x145b('0x21')](_0x158d2e)){var _0x38741c={'Email':_0x158d2e};var _0x5b6917={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ab10f['sobject'](_0x145b('0x22'))['find'](_0x38741c,_0x5b6917)[_0x145b('0x23')]()['then'](function(_0x2fd58f){if(_0x2fd58f[_0x145b('0x24')]){var _0x5a2c9d=_[_0x145b('0x25')](_0x2fd58f,function(_0xc9e9c9){return _0xc9e9c9[_0x145b('0x26')]===_0x158d2e;});if(_0x5a2c9d){logger[_0x145b('0x1e')](_0x145b('0x27'),_0x158d2e);return BPromise[_0x145b('0x28')]({'id':_0x5a2c9d['Id'],'name':_0x5a2c9d[_0x145b('0x29')]});}}else{logger['info'](_0x145b('0x2a'),_0x158d2e);return _0x4ab10f[_0x145b('0x2b')]()[_0x145b('0x2c')](function(_0x2dfe96){return BPromise[_0x145b('0x28')]({'id':_0x2dfe96[_0x145b('0x2d')],'name':_0x2dfe96[_0x145b('0x2e')]});});}});}else{logger[_0x145b('0x1e')](_0x145b('0x2a'),_0x158d2e);return _0x4ab10f[_0x145b('0x2b')]()[_0x145b('0x2c')](function(_0x13bde3){return BPromise[_0x145b('0x28')]({'id':_0x13bde3[_0x145b('0x2d')],'name':_0x13bde3[_0x145b('0x2e')]});});}}function getEndUser(_0x486f11,_0x1da83b,_0x34c5fa,_0x1a8639,_0x3d5a3f){var _0xf37904={'$or':{'Phone':_0x1a8639}};var _0x4f287e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x145b('0x1e')](_0x145b('0x2f'),_0x1a8639,_0x1da83b[_0x145b('0x30')]);switch(_0x1da83b['moduleSearch']){case _0x145b('0x31'):var _0x35fdb5=_['cloneDeep'](_0xf37904);if(_0x1da83b[_0x145b('0x32')]){var _0x9600={};_0x9600[_0x1da83b[_0x145b('0x32')]]=_0x1a8639;_[_0x145b('0x33')](_0x35fdb5[_0x145b('0x34')],_0x9600);}return _0x3d5a3f['sobject']('Contact')[_0x145b('0x25')](_0x35fdb5,_0x4f287e)[_0x145b('0x23')]()['then'](function(_0x127f21){if(_0x127f21&&_0x127f21['length']){return _0x127f21;}else{var _0x51d80f=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b[_0x145b('0x36')]){var _0x133d55={};_0x133d55[_0x1da83b['additionalSearchLead']]=_0x1a8639;_[_0x145b('0x33')](_0x51d80f[_0x145b('0x34')],_0x133d55);}return _0x3d5a3f[_0x145b('0x1f')]('Lead')['find'](_0x51d80f,_0x4f287e);}});case _0x145b('0x37'):var _0x375427=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b[_0x145b('0x38')]){var _0x9600={};_0x9600[_0x1da83b[_0x145b('0x38')]]=_0x1a8639;_['merge'](_0x375427[_0x145b('0x34')],_0x9600);}return _0x3d5a3f[_0x145b('0x1f')](_0x145b('0x39'))['find'](_0x375427,_0x4f287e)[_0x145b('0x23')]()[_0x145b('0x2c')](function(_0x2830c5){if(_0x2830c5&&_0x2830c5[_0x145b('0x24')]){return _0x2830c5;}else{var _0x4a24f5=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b[_0x145b('0x32')]){var _0x9ed17b={};_0x9ed17b[_0x1da83b['additionalSearchContact']]=_0x1a8639;_[_0x145b('0x33')](_0x4a24f5[_0x145b('0x34')],_0x9ed17b);}return _0x3d5a3f[_0x145b('0x1f')](_0x145b('0x3a'))[_0x145b('0x25')](_0x4a24f5,_0x4f287e)[_0x145b('0x2c')](function(_0x5ac42e){if(_0x5ac42e&&_0x5ac42e[_0x145b('0x24')]){return _0x5ac42e;}else{var _0x4f7279=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b['additionalSearchLead']){var _0x3f9844={};_0x3f9844[_0x1da83b[_0x145b('0x36')]]=_0x1a8639;_[_0x145b('0x33')](_0x4f7279['$or'],_0x3f9844);}return _0x3d5a3f['sobject'](_0x145b('0x3b'))['find'](_0x4f7279,_0x4f287e);}});}});case _0x145b('0x1a'):var _0x35fdb5=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b[_0x145b('0x32')]){var _0x9600={};_0x9600[_0x1da83b[_0x145b('0x32')]]=_0x1a8639;_[_0x145b('0x33')](_0x35fdb5[_0x145b('0x34')],_0x9600);}return _0x3d5a3f[_0x145b('0x1f')](_0x145b('0x3a'))[_0x145b('0x25')](_0x35fdb5,_0x4f287e)[_0x145b('0x23')]();case'lead':var _0x52b6e6=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b[_0x145b('0x36')]){var _0x9600={};_0x9600[_0x1da83b[_0x145b('0x36')]]=_0x1a8639;_['merge'](_0x52b6e6['$or'],_0x9600);}return _0x3d5a3f[_0x145b('0x1f')]('Lead')['find'](_0x52b6e6,_0x4f287e);case _0x145b('0x1c'):var _0x375427=_[_0x145b('0x35')](_0xf37904);if(_0x1da83b['additionalSearchAccount']){var _0x9600={};_0x9600[_0x1da83b[_0x145b('0x38')]]=_0x1a8639;_[_0x145b('0x33')](_0x375427[_0x145b('0x34')],_0x9600);}return _0x3d5a3f[_0x145b('0x1f')](_0x145b('0x39'))[_0x145b('0x25')](_0x375427,_0x4f287e);default:return null;}})[_0x145b('0x2c')](function(_0x3b1632){if(_0x3b1632&&_0x3b1632[_0x145b('0x24')]){var _0x5ecb97=_[_0x145b('0x3c')](_0x3b1632);if(_0x5ecb97){return BPromise['resolve']({'id':_0x5ecb97['Id'],'name':_0x5ecb97['Name'],'phone':_0x5ecb97[_0x145b('0x3d')],'endUserType':_0x5ecb97[_0x145b('0x3e')][_0x145b('0x3f')][_0x145b('0x40')]()});}}})[_0x145b('0x2c')](function(_0x17593d){if(_0x17593d){logger[_0x145b('0x1e')](_0x145b('0x41'),_0x17593d['endUserType'],_0x1a8639);return BPromise[_0x145b('0x28')](_0x17593d);}else{logger['info'](_0x145b('0x42'),_0x1a8639);var _0x32485c={'Phone':_0x1a8639};if(_0x1da83b[_0x145b('0x43')]){if(_0x1da83b[_0x145b('0x43')]==='contact'){logger[_0x145b('0x1e')](_0x145b('0x44'),_0x1a8639,_0x1da83b[_0x145b('0x43')]);_0x32485c['LastName']=_0x34c5fa!==_0x145b('0x45')?_0x34c5fa:util[_0x145b('0x46')](_0x145b('0x47'),_0x1a8639);}else if(_0x1da83b[_0x145b('0x43')]==='lead'){logger[_0x145b('0x1e')](_0x145b('0x44'),_0x1a8639,_0x1da83b[_0x145b('0x43')]);_0x32485c[_0x145b('0x48')]=_0x34c5fa!==_0x145b('0x45')?_0x34c5fa:util[_0x145b('0x46')](_0x145b('0x47'),_0x1a8639);_0x32485c[_0x145b('0x49')]=_0x145b('0x4a');}else if(_0x1da83b[_0x145b('0x43')]==='account'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1a8639,_0x1da83b[_0x145b('0x43')]);_0x32485c[_0x145b('0x29')]=_0x34c5fa!==''?_0x34c5fa:util[_0x145b('0x46')](_0x145b('0x47'),_0x1a8639);}else{return null;}}return _0x3d5a3f[_0x145b('0x1f')](_[_0x145b('0x4b')](_0x1da83b[_0x145b('0x43')]))[_0x145b('0x4c')](_0x32485c)[_0x145b('0x2c')](function(_0x582e5b){return BPromise[_0x145b('0x28')]({'id':_0x582e5b['id'],'endUserType':_0x1da83b[_0x145b('0x43')]});});}});}function getCustomFields(_0x370825,_0x4cbdc6){var _0x2f742e={};if(_0x370825[_0x145b('0x24')]>0x0){_[_0x145b('0x4d')](_0x370825,function(_0x3a2b1d){if(_['includes']([_0x145b('0x4e'),_0x145b('0x4f')],_0x3a2b1d['type'])&&_0x3a2b1d[_0x145b('0x50')]){_0x2f742e[_0x3a2b1d['idField']]=_0x3a2b1d[_0x145b('0x51')][_0x145b('0x52')]();}else if(_0x3a2b1d['type']==='variable'&&_0x3a2b1d[_0x145b('0x53')]&&_0x3a2b1d['idField']){_0x4cbdc6[_0x3a2b1d['variableName']]&&(_0x2f742e[_0x3a2b1d['idField']]=_0x4cbdc6[_0x3a2b1d['variableName']][_0x145b('0x52')]());}else if(_0x3a2b1d[_0x145b('0x3f')]==='customVariable'&&_0x3a2b1d[_0x145b('0x54')]&&_0x3a2b1d[_0x145b('0x54')][_0x145b('0x55')]&&_0x3a2b1d[_0x145b('0x50')]){_0x4cbdc6[_0x3a2b1d[_0x145b('0x54')]['name'][_0x145b('0x40')]()]&&(_0x2f742e[_0x3a2b1d[_0x145b('0x50')]]=_0x4cbdc6[_0x3a2b1d[_0x145b('0x54')][_0x145b('0x55')][_0x145b('0x40')]()][_0x145b('0x52')]());}});}return _0x2f742e;}function getConnection(_0x4867a1){var _0x13bba9=_0x4867a1[_0x145b('0x56')][_0x145b('0x57')](_0x4867a1[_0x145b('0x58')]);var _0xb5e3cd=new jsforce[(_0x145b('0x59'))]({'oauth2':{'loginUrl':_0x4867a1[_0x145b('0x5a')]||_0x145b('0x5b'),'clientId':_0x4867a1[_0x145b('0x5c')],'clientSecret':_0x4867a1[_0x145b('0x5d')]}});return _0xb5e3cd[_0x145b('0x5e')](_0x4867a1[_0x145b('0x5f')],_0x13bba9)[_0x145b('0x2c')](function(){logger[_0x145b('0x1e')](_0x145b('0x60'));return _0xb5e3cd;});}exports[_0x145b('0x61')]=function(_0x2a020d,_0x8675ee,_0x24751d,_0x285099,_0x3a8450,_0xb86e0e){var _0x148bd8,_0x185295,_0x3bf28e,_0x379f9c;_0xb86e0e[_0x145b('0x62')]=intUtil[_0x145b('0x63')](_0xb86e0e[_0x145b('0x62')]);_0xb86e0e[_0x145b('0x5a')]=intUtil['stripTrailingSlash'](_0xb86e0e[_0x145b('0x5a')]);if(_0x3a8450&&_0x3a8450[_0x145b('0x64')]){logger[_0x145b('0x1e')](_0x145b('0x65'),'Recording\x20is\x20enabled!');_0x8675ee[_0x145b('0x66')]=util[_0x145b('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb86e0e[_0x145b('0x62')],_0x8675ee[_0x145b('0x67')],md5(_0x8675ee[_0x145b('0x67')]));}else{_0x8675ee[_0x145b('0x66')]='';}return getConnection(_0xb86e0e)[_0x145b('0x2c')](function(_0x586271){_0x379f9c=_0x586271;return getUser(_0xb86e0e,_0x285099['email'],_0x379f9c);})[_0x145b('0x2c')](function(_0x9b2238){_0x148bd8=_0x9b2238;return getEndUser(_0xb86e0e,_0x24751d,_0x8675ee[_0x145b('0x68')],_0x8675ee[_0x145b('0x69')],_0x379f9c);})['then'](function(_0x3cddc5){_0x185295=_0x3cddc5;return getTicket(_0xb86e0e,_0x148bd8,_0x185295,_0x24751d,_0x8675ee,_0x24751d[_0x145b('0x6a')],_0x379f9c,_0x145b('0x61'));})[_0x145b('0x2c')](function(_0x2a6c8f){_0x3bf28e=_0x2a6c8f;logger['info'](_0x145b('0x6b'),_0x3bf28e['id']);logger[_0x145b('0x1e')](_0x145b('0x6c'),_0x3bf28e['id'],_0x285099[_0x145b('0x55')],_0xb86e0e[_0x145b('0x3f')]);switch(_0xb86e0e['type']){case _0x145b('0x6d'):emit(util[_0x145b('0x46')](_0x145b('0x6e'),_0x285099[_0x145b('0x55')]),_0x145b('0x6f'),{'recordId':_0x3bf28e['id']});break;case _0x145b('0x70'):emit(util[_0x145b('0x46')](_0x145b('0x6e'),_0x285099[_0x145b('0x55')]),_0x145b('0x71'),{'uri':util[_0x145b('0x46')](_0x145b('0x72'),_0x379f9c[_0x145b('0x73')],_0x3bf28e['id'])});break;default:logger['error'](_0x145b('0x74'));}})[_0x145b('0x75')](function(_0x4a0cce){logger[_0x145b('0x76')](_0x145b('0x65'),_0x4a0cce);});};exports[_0x145b('0x77')]=function(_0x374fbc,_0x46403e,_0x527b53,_0x534f85,_0x4d3582,_0x234e2d,_0x5383d3){var _0x292829,_0x234d10,_0x1b2308,_0x29e39e;_0x234e2d[_0x145b('0x62')]=intUtil[_0x145b('0x63')](_0x234e2d[_0x145b('0x62')]);_0x234e2d[_0x145b('0x5a')]=intUtil[_0x145b('0x63')](_0x234e2d[_0x145b('0x5a')]);if(_0x5383d3&&_0x5383d3[_0x145b('0x78')]&&_0x5383d3[_0x145b('0x78')]!==_0x145b('0x79')){logger['info'](_0x145b('0x7a'),_0x145b('0x7b'));_0x46403e[_0x145b('0x66')]=util[_0x145b('0x46')](_0x145b('0x7c'),_0x234e2d[_0x145b('0x62')],_0x46403e[_0x145b('0x67')],md5(_0x46403e[_0x145b('0x67')]));}return getConnection(_0x234e2d)[_0x145b('0x2c')](function(_0x4fa5e3){_0x29e39e=_0x4fa5e3;return getUser(_0x234e2d,_0x534f85[_0x145b('0x7d')],_0x29e39e);})[_0x145b('0x2c')](function(_0x24b3d0){_0x292829=_0x24b3d0;return getEndUser(_0x234e2d,_0x527b53,_0x46403e[_0x145b('0x7e')],_0x46403e[_0x145b('0x7f')],_0x29e39e);})[_0x145b('0x2c')](function(_0xc66f57){_0x234d10=_0xc66f57;return getTicket(_0x234e2d,_0x292829,_0x234d10,_0x527b53,_0x46403e,_0x527b53[_0x145b('0x6a')],_0x29e39e,_0x145b('0x77'));})['then'](function(_0x48153b){_0x1b2308=_0x48153b;logger[_0x145b('0x1e')](_0x145b('0x80'),_0x1b2308['id']);logger[_0x145b('0x1e')](_0x145b('0x81'),_0x1b2308['id'],_0x534f85['name'],_0x234e2d[_0x145b('0x3f')]);switch(_0x234e2d[_0x145b('0x3f')]){case _0x145b('0x6d'):emit(util[_0x145b('0x46')]('user:%s',_0x534f85[_0x145b('0x55')]),'trigger:salesforce:display',{'recordId':_0x1b2308['id']});break;case'newTab':emit(util[_0x145b('0x46')]('user:%s',_0x534f85[_0x145b('0x55')]),_0x145b('0x71'),{'uri':util[_0x145b('0x46')](_0x145b('0x72'),_0x29e39e[_0x145b('0x73')],_0x1b2308['id'])});break;default:logger[_0x145b('0x76')](_0x145b('0x7a'),_0x145b('0x82'));}})['catch'](function(_0x345865){logger[_0x145b('0x76')](_0x145b('0x7a'),_0x345865);});};exports[_0x145b('0x83')]=function(_0x27126e,_0x2c6fc5,_0x2a45a3,_0x47e2ef,_0x3689f9,_0x45cce1){var _0xbeda88,_0x2da366,_0x17fca8,_0x145491;_0x45cce1[_0x145b('0x62')]=intUtil[_0x145b('0x63')](_0x45cce1['serverUrl']);_0x45cce1[_0x145b('0x5a')]=intUtil['stripTrailingSlash'](_0x45cce1[_0x145b('0x5a')]);if(_0x3689f9&&_0x3689f9[_0x145b('0x64')]){logger[_0x145b('0x1e')]('['+_0x2c6fc5[_0x145b('0x84')][_0x145b('0x85')]()+']','Recording\x20is\x20enabled!');_0x2c6fc5[_0x145b('0x66')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45cce1[_0x145b('0x62')],_0x2c6fc5[_0x145b('0x67')],md5(_0x2c6fc5[_0x145b('0x67')]));}else{_0x2c6fc5[_0x145b('0x66')]='';}return getConnection(_0x45cce1)['then'](function(_0x4c3641){_0x145491=_0x4c3641;if(!_[_0x145b('0x20')](_0x47e2ef)){return getUser(_0x45cce1,_0x47e2ef['name'],_0x145491);}else{return getUser(_0x45cce1,null,_0x145491);}})[_0x145b('0x2c')](function(_0x282b26){_0xbeda88=_0x282b26;return getEndUser(_0x45cce1,_0x2a45a3,_0x2c6fc5['calleridname'],_0x2c6fc5[_0x145b('0x69')],_0x145491);})[_0x145b('0x2c')](function(_0x1fbefd){_0x2da366=_0x1fbefd;return getTicket(_0x45cce1,_0xbeda88,_0x2da366,_0x2a45a3,_0x2c6fc5,_0x2a45a3['Fields'],_0x145491);})[_0x145b('0x2c')](function(_0x7e86f7){_0x17fca8=_0x7e86f7;logger['info']('['+_0x2c6fc5[_0x145b('0x84')]['toUpperCase']()+_0x145b('0x86'),_0x17fca8['id']);logger[_0x145b('0x1e')]('['+_0x2c6fc5['lastevent'][_0x145b('0x85')]()+_0x145b('0x87'),_0x45cce1[_0x145b('0x3f')]);})[_0x145b('0x75')](function(_0x59e899){logger[_0x145b('0x76')]('['+_0x2c6fc5[_0x145b('0x84')][_0x145b('0x85')]()+']',_0x59e899);});}; \ 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 eb6936f..ff1b002 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 _0x8733=['bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','toString','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','name','%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','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8733,0x6d));var _0x3873=function(_0x1abafe,_0x572047){_0x1abafe=_0x1abafe-0x0;var _0x4fae5a=_0x8733[_0x1abafe];return _0x4fae5a;};'use strict';var _=require(_0x3873('0x0'));var Promise=require(_0x3873('0x1'));var rp=require(_0x3873('0x2'));var util=require(_0x3873('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x3873('0x4'));var config=require(_0x3873('0x5'));var logger=require(_0x3873('0x6'))(_0x3873('0x7'));config[_0x3873('0x8')]=_[_0x3873('0x9')](config[_0x3873('0x8')],{'host':_0x3873('0xa'),'port':0x18eb});var io=require(_0x3873('0xb'))(new Redis(config['redis']));function getAdminUser(_0x2e0543,_0x545c25,_0x281aa9,_0x531498,_0x1e9862,_0x14e18f){return new Promise(function(_0x1e8f43,_0x276e56){var _0x11d7b9={'method':_0x3873('0xc'),'uri':_0x531498+_0x3873('0xd')+'&'+_0x1e9862+'&'+_0x14e18f,'auth':_0x545c25,'json':!![]};return rp(_0x11d7b9)[_0x3873('0xe')](function(_0x5d754f){if(_0x5d754f[_0x3873('0xf')]['length']>0x0){_0x281aa9[_0x3873('0x10')]=_0x5d754f[_0x3873('0xf')][0x0][_0x3873('0x11')];}logger['info']('['+[_0x2e0543['toUpperCase']()]+_0x3873('0x12'),_0x281aa9);_0x1e8f43(_0x281aa9);})[_0x3873('0x13')](function(_0x4d5d2b){logger[_0x3873('0x14')]('['+[_0x2e0543[_0x3873('0x15')]()]+']',_0x4d5d2b[_0x3873('0x16')]);_0x276e56(_0x4d5d2b[_0x3873('0x16')]);});});}function getUser(_0x36ade2,_0xedc2d4,_0x2f070f,_0x303af0,_0xbac5d3){return function(_0x424b57){logger[_0x3873('0x17')]('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x18'),_0x424b57);return new Promise(function(_0x1d41b3,_0x47e818){if(intUtil['validateEmail'](_0x424b57[_0x3873('0x19')])){var _0x3367b2={'method':'GET','uri':_0x2f070f+_0x3873('0x1a')+_0x424b57[_0x3873('0x19')]+'&'+_0x303af0+'&'+_0xbac5d3,'auth':_0xedc2d4,'json':!![]};logger['info']('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x1b'),_0x3367b2);return rp(_0x3367b2)[_0x3873('0xe')](function(_0x4a7993){logger[_0x3873('0x17')]('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x1c'),_0x4a7993);if(_0x4a7993[_0x3873('0xf')]['length']>0x0&&String(_0x4a7993['result'][0x0]['active'])===_0x3873('0x1d')){_0x424b57[_0x3873('0x1e')]=_0x4a7993[_0x3873('0xf')][0x0][_0x3873('0x11')];}else{_0x424b57['userId']=_0x424b57[_0x3873('0x10')];_0x424b57[_0x3873('0x19')]=_0x424b57[_0x3873('0x1f')];}logger['info']('['+[_0x36ade2[_0x3873('0x15')]()]+_0x3873('0x20'),_0x424b57);_0x1d41b3(_0x424b57);})[_0x3873('0x13')](function(_0x4a27e4){logger[_0x3873('0x14')]('['+[_0x36ade2[_0x3873('0x15')]()]+']',_0x4a27e4[_0x3873('0x16')]);_0x47e818(_0x4a27e4[_0x3873('0x16')]);});}else{logger[_0x3873('0x17')]('['+[_0x36ade2[_0x3873('0x15')]()]+']\x20using\x20admin\x20profile');_0x424b57[_0x3873('0x1e')]=_0x424b57['adminId'];_0x424b57['userEmail']=_0x424b57[_0x3873('0x1f')];_0x1d41b3(_0x424b57);}});};}function createEndUser(_0x13b1c4,_0x2f9ec2,_0x294d98,_0x5439d7,_0x1e8177){logger[_0x3873('0x17')]('['+[_0x13b1c4['toUpperCase']()]+_0x3873('0x21'),_0x294d98);return new Promise(function(_0x750ceb,_0x5747e4){var _0x5c9789={'method':_0x3873('0x22'),'uri':_0x5439d7+'sys_user?'+_0x1e8177,'body':{'user_name':_0x294d98[_0x3873('0x23')],'roles':_0x3873('0x24'),'first_name':_0x294d98[_0x3873('0x23')],'active':_0x3873('0x1d'),'date_format':_0x3873('0x25'),'phone':_0x294d98[_0x3873('0x23')]},'auth':_0x2f9ec2,'json':!![]};return rp(_0x5c9789)[_0x3873('0xe')](function(_0x1359ff){logger['info']('['+[_0x13b1c4[_0x3873('0x15')]()]+_0x3873('0x26'),_0x1359ff['result']);_0x294d98[_0x3873('0x27')]=_0x1359ff[_0x3873('0xf')]['sys_id'];_0x750ceb(_0x294d98);})[_0x3873('0x13')](function(_0x40a409){logger[_0x3873('0x14')]('['+[_0x13b1c4[_0x3873('0x15')]()]+']',_0x40a409[_0x3873('0x16')]);_0x5747e4(_0x40a409[_0x3873('0x16')]);});});}function getEndUser(_0x4d8314,_0xa20ca5,_0x1e4196,_0x5c310b,_0xe620e6){return function(_0x75d550){logger[_0x3873('0x17')]('['+[_0x4d8314[_0x3873('0x15')]()]+_0x3873('0x28'),_0x75d550);return new Promise(function(_0x40ec5d,_0x4aef85){var _0x11190a={'method':_0x3873('0xc'),'uri':_0x1e4196+_0x3873('0x29')+_0x75d550[_0x3873('0x23')]+'&'+_0x5c310b+'&'+_0xe620e6,'auth':_0xa20ca5,'json':!![]};return rp(_0x11190a)['then'](function(_0xdca6c6){if(_0xdca6c6['result'][_0x3873('0x2a')]>0x0){_0x75d550[_0x3873('0x27')]=_0xdca6c6[_0x3873('0xf')][0x0][_0x3873('0x11')];logger[_0x3873('0x17')]('['+[_0x4d8314[_0x3873('0x15')]()]+_0x3873('0x2b'),_0x75d550);_0x40ec5d(_0x75d550);}else{return createEndUser(_0x4d8314,_0xa20ca5,_0x75d550,_0x1e4196,_0x5c310b)[_0x3873('0xe')](function(_0x3bd66f){logger[_0x3873('0x17')]('['+[_0x4d8314[_0x3873('0x15')]()]+_0x3873('0x2c'),_0x3bd66f);_0x40ec5d(_0x3bd66f);});}})['catch'](function(_0x44a891){logger['error']('['+[_0x4d8314[_0x3873('0x15')]()]+']',_0x44a891['message']);_0x4aef85(_0x44a891[_0x3873('0x16')]);});});};}function getCustomFields(_0x3b89c2,_0x225e77){var _0x5cc1da={};if(_0x3b89c2['length']>0x0){_[_0x3873('0x2d')](_0x3b89c2,function(_0xeeb6ac){if(_['includes']([_0x3873('0x2e'),_0x3873('0x2f')],_0xeeb6ac[_0x3873('0x30')])&&_0xeeb6ac[_0x3873('0x31')]&&!_0xeeb6ac[_0x3873('0x32')]){_0x5cc1da[_0xeeb6ac['nameField'][_0x3873('0x33')]()]=_0xeeb6ac[_0x3873('0x34')]['toString']();}else if(_['includes'](['string',_0x3873('0x2f')],_0xeeb6ac[_0x3873('0x30')])&&_0xeeb6ac[_0x3873('0x35')]&&_0xeeb6ac[_0x3873('0x32')]){_0x5cc1da[_0xeeb6ac['idField'][_0x3873('0x33')]()]=_0xeeb6ac[_0x3873('0x34')]['toString']();}else if(_0xeeb6ac[_0x3873('0x30')]===_0x3873('0x36')&&_0xeeb6ac[_0x3873('0x37')]&&_0xeeb6ac[_0x3873('0x35')]&&_0xeeb6ac[_0x3873('0x32')]){_0x5cc1da[_0xeeb6ac[_0x3873('0x35')][_0x3873('0x33')]()]=_0x225e77[_0xeeb6ac[_0x3873('0x37')]][_0x3873('0x38')]();}else if(_0xeeb6ac[_0x3873('0x30')]==='customVariable'&&_0xeeb6ac[_0x3873('0x39')]&&_0xeeb6ac[_0x3873('0x39')]['name']&&_0xeeb6ac[_0x3873('0x35')]&&_0xeeb6ac['customField']){_0x5cc1da[_0xeeb6ac['idField'][_0x3873('0x33')]()]=_0x225e77[_0xeeb6ac[_0x3873('0x39')]['name'][_0x3873('0x33')]()][_0x3873('0x38')]();}});}return _0x5cc1da;}function getTicket(_0x29b6c4,_0x110f5a,_0x50d051,_0x2e2e7e,_0x35b7a4,_0x121aca){return function(_0x169423){logger[_0x3873('0x17')]('['+[_0x29b6c4[_0x3873('0x15')]()]+_0x3873('0x3a'),_0x169423);return new Promise(function(_0x28e243,_0x3cf757){var _0x5ebe06=_0x29b6c4[_0x3873('0x33')]()===_0x3873('0x3b')?_0x169423[_0x3873('0x1e')]:_0x169423[_0x3873('0x27')];var _0x1d77ee={'method':'POST','uri':_0x50d051+_0x3873('0x3c')+'?'+_0x121aca,'body':Object[_0x3873('0x3d')]({},{'active':_0x3873('0x1d'),'caller_id':_0x5ebe06,'assigned_to':_0x169423[_0x3873('0x1e')],'short_description':intUtil['getString'](_0x2e2e7e[_0x3873('0x3e')],_0x35b7a4,'\x20'),'description':intUtil[_0x3873('0x3f')](_0x2e2e7e[_0x3873('0x40')],_0x35b7a4,'\x0a')},getCustomFields(_0x2e2e7e[_0x3873('0x41')],_0x35b7a4)),'auth':_0x110f5a,'json':!![]};return rp(_0x1d77ee)['then'](function(_0x41f469){logger[_0x3873('0x17')]('['+[_0x29b6c4[_0x3873('0x15')]()]+_0x3873('0x42'),_0x41f469[_0x3873('0xf')]);_0x169423['ticketId']=_0x41f469[_0x3873('0xf')][_0x3873('0x11')];_0x169423[_0x3873('0x43')]=_0x41f469[_0x3873('0xf')][_0x3873('0x44')];logger[_0x3873('0x17')]('['+[_0x29b6c4['toUpperCase']()]+_0x3873('0x45'),_0x169423);_0x28e243(_0x169423);})['catch'](function(_0x33e2fb){logger[_0x3873('0x14')]('['+[_0x29b6c4['toUpperCase']()]+']',_0x33e2fb[_0x3873('0x16')]);_0x3cf757(_0x33e2fb[_0x3873('0x16')]);});});};}function createRemoteTag(_0x34293c,_0x4cf6dd,_0x1e42d4,_0x10f301){return new Promise(function(_0x11c655,_0x591b81){var _0x4fb45c={'method':_0x3873('0x22'),'uri':_0x1e42d4+_0x3873('0x46')+'?'+_0x10f301,'body':{'short_description':_0x34293c,'global':!![],'active':!![],'name':_0x34293c},'auth':_0x4cf6dd,'json':!![]};return rp(_0x4fb45c)['then'](function(_0x2ad0d1){var _0x24beff=_0x2ad0d1['result'][_0x3873('0x11')];_0x11c655(_0x24beff);});});}function getRemoteTag(_0x2152a4,_0xbdd372,_0x1a6738,_0x33e712,_0xe742ec){return new Promise(function(_0x3fa195,_0x57df9){var _0x58490f={'method':_0x3873('0xc'),'uri':_0x1a6738+_0x3873('0x46')+_0x3873('0x47')+_0x2152a4+'&'+_0x33e712,'auth':_0xbdd372,'json':!![]};return rp(_0x58490f)[_0x3873('0xe')](function(_0x21ade0){if(_0x21ade0[_0x3873('0xf')][_0x3873('0x2a')]>0x0){var _0x301de1=_0x21ade0[_0x3873('0xf')][0x0][_0x3873('0x11')];_0x3fa195(_0x301de1);}else{return createRemoteTag(_0x2152a4,_0xbdd372,_0x1a6738,_0x33e712)[_0x3873('0xe')](function(_0x7c4171){_0x3fa195(_0x7c4171);});}});});}function assignTagToIncident(_0x1f50e4,_0x4583dc,_0x8188c7,_0xd0a35f,_0xac445a){return new Promise(function(_0x315a22,_0x50b257){var _0x38ef78={'method':_0x3873('0x22'),'uri':_0x8188c7+_0x3873('0x48')+'?'+_0xac445a,'body':{'label':_0x1f50e4,'table':_0x3873('0x3c'),'id_type':_0x3873('0x49'),'table_key':_0xd0a35f[_0x3873('0x4a')],'title':_0x3873('0x4b')+_0xd0a35f[_0x3873('0x43')],'id_display':_0xd0a35f[_0x3873('0x43')]},'auth':_0x4583dc,'json':!![]};return rp(_0x38ef78)['then'](function(_0x850c6e){_0x315a22();})[_0x3873('0x13')](function(){_0x315a22();});});}function manageTags(_0x4e0a4f,_0x4c1c55,_0x570aac,_0x2ec2bf,_0x24ee09,_0x25eec9,_0x9aadbb){return new Promise(function(_0x37e9f3,_0x223f5f){var _0x3a777d=[];_0x4c1c55[_0x3873('0x2d')](function(_0x41b408){_0x3a777d[_0x3873('0x4c')](getRemoteTag(_0x41b408,_0x570aac,_0x2ec2bf,_0x25eec9,_0x9aadbb));});return Promise[_0x3873('0x4d')](_0x3a777d)[_0x3873('0xe')](function(_0x3f18db){if(_0x3f18db[_0x3873('0x2a')]){logger[_0x3873('0x17')]('['+[_0x4e0a4f[_0x3873('0x15')]()]+_0x3873('0x4e'),_0x3f18db);var _0x47dc5c=[];_0x3f18db['forEach'](function(_0x38c3a0){_0x47dc5c[_0x3873('0x4c')](assignTagToIncident(_0x38c3a0,_0x570aac,_0x2ec2bf,_0x24ee09,_0x25eec9));});return Promise[_0x3873('0x4d')](_0x47dc5c)[_0x3873('0xe')](function(){_0x37e9f3();})['catch'](function(){_0x37e9f3();});}else{_0x37e9f3();}});});}function getTags(_0xd58fe0,_0xc719d3,_0x4dec94,_0x4941bc,_0x1ee7ab,_0x4eef63){return function(_0x18158f){return new Promise(function(_0x3f15fc,_0x18bca6){var _0x5a61a6=[];var _0x31c41d=_0x4941bc[_0x3873('0x4f')];if(_0x31c41d&&_0x31c41d['length']>0x0){_0x5a61a6=_['map'](_0x31c41d,_0x3873('0x50'));}if(_0x5a61a6[_0x3873('0x2a')]>0x0){return manageTags(_0xd58fe0,_0x5a61a6,_0xc719d3,_0x4dec94,_0x18158f,_0x1ee7ab,_0x4eef63)[_0x3873('0xe')](function(){_0x3f15fc(_0x18158f);});}else{_0x3f15fc(_0x18158f);}});};}function emit(_0x381bec,_0x46d359,_0x24da4f){var _0x50bb66=_0x3873('0x51')+_0x3873('0x52')+_0x3873('0x53')+_0x3873('0x54');var _0x72fd83={'uri':_0x381bec+_0x3873('0x55')+_0x24da4f+_0x50bb66};io['to'](util[_0x3873('0x56')](_0x3873('0x57'),_0x46d359))[_0x3873('0x58')]('trigger:browser:url',_0x72fd83);}exports['cs']=function(_0x17760c,_0x76917d,_0x2d5f35,_0x250ecb,_0x5e02f9,_0x3c9244,_0x238aad,_0x123c86){var _0x436754={};var _0x9c4c6b={'user':_0x3c9244['username'],'pass':_0x3c9244['password']};var _0x119531=_0x3873('0x59');var _0x3836e8=_0x3873('0x5a');_0x3c9244['remoteUri']=intUtil[_0x3873('0x5b')](_0x3c9244[_0x3873('0x5c')]);_0x3c9244[_0x3873('0x5d')]=intUtil[_0x3873('0x5b')](_0x3c9244[_0x3873('0x5d')]);var _0x1de8be=util['format'](_0x3873('0x5e'),_0x3c9244[_0x3873('0x5c')]);_0x436754[_0x3873('0x19')]=!_[_0x3873('0x5f')](_0x250ecb)?_0x250ecb[_0x3873('0x60')]:null;_0x436754[_0x3873('0x1f')]=_0x3c9244['email'];_0x436754['endUserNumber']=_0x123c86['toLowerCase']()==='outbound'?_0x76917d['destcalleridnum']:_0x76917d[_0x3873('0x61')];_0x436754[_0x3873('0x62')]=_0x123c86===_0x3873('0x63')||_0x123c86===_0x3873('0x64')?_0x3873('0x63'):_0x3873('0x3b');var _0x375fab=util['format'](_0x3873('0x65'),_0x3c9244[_0x3873('0x5d')],_0x76917d[_0x3873('0x66')],md5(_0x76917d[_0x3873('0x66')]));if(_0x5e02f9&&_0x5e02f9['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x76917d[_0x3873('0x67')]=_0x375fab;}else if(_0x238aad&&_0x238aad['recordingFormat']&&_0x238aad[_0x3873('0x68')]!=='none'){logger[_0x3873('0x17')](_0x3873('0x69'),'Recording\x20is\x20enabled!');_0x76917d[_0x3873('0x67')]=_0x375fab;}else{_0x76917d[_0x3873('0x67')]='';}return getAdminUser(_0x123c86,_0x9c4c6b,_0x436754,_0x1de8be,_0x3836e8,_0x119531)[_0x3873('0xe')](getUser(_0x123c86,_0x9c4c6b,_0x1de8be,_0x3836e8,_0x119531))[_0x3873('0xe')](getEndUser(_0x123c86,_0x9c4c6b,_0x1de8be,_0x3836e8,_0x119531))[_0x3873('0xe')](getTicket(_0x123c86,_0x9c4c6b,_0x1de8be,_0x2d5f35,_0x76917d,_0x3836e8))[_0x3873('0xe')](function(_0xc39721){logger[_0x3873('0x17')](util[_0x3873('0x56')](_0x3873('0x6a'),_0xc39721[_0x3873('0x4a')]));logger[_0x3873('0x17')](util[_0x3873('0x56')](_0x3873('0x6b'),_0x123c86));if(_0x123c86!==_0x3873('0x64')){logger[_0x3873('0x17')]('['+[_0x123c86['toUpperCase']()]+']',_0x3873('0x6c'));emit(_0x3c9244[_0x3873('0x5c')],_0x250ecb[_0x3873('0x50')],_0xc39721[_0x3873('0x4a')]);}})[_0x3873('0x13')](function(_0x1713a3){logger[_0x3873('0x14')]('['+[_0x123c86['toUpperCase']()]+_0x3873('0x6d'),util['inspect'](_0x1713a3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x74f1=['customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','GET','active','true','userId','userEmail','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','picklist','customField','toLowerCase','includes','string','type','idField','content','toString','variableName'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x74f1,0x15e));var _0x174f=function(_0xfc959c,_0x4660c){_0xfc959c=_0xfc959c-0x0;var _0xa12959=_0x74f1[_0xfc959c];return _0xa12959;};'use strict';var _=require(_0x174f('0x0'));var Promise=require('bluebird');var rp=require(_0x174f('0x1'));var util=require('util');var md5=require(_0x174f('0x2'));var Redis=require(_0x174f('0x3'));var intUtil=require(_0x174f('0x4'));var config=require(_0x174f('0x5'));var logger=require(_0x174f('0x6'))(_0x174f('0x7'));config['redis']=_[_0x174f('0x8')](config[_0x174f('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x174f('0x9')]));function getAdminUser(_0x4006f1,_0x5987c3,_0x35d03a,_0x4cd083,_0x3baf27,_0x1a18b9){return new Promise(function(_0x4a9dac,_0x2e1786){var _0x2d22f1={'method':'GET','uri':_0x4cd083+_0x174f('0xa')+'&'+_0x3baf27+'&'+_0x1a18b9,'auth':_0x5987c3,'json':!![]};return rp(_0x2d22f1)[_0x174f('0xb')](function(_0x2827e1){if(_0x2827e1['result'][_0x174f('0xc')]>0x0){_0x35d03a[_0x174f('0xd')]=_0x2827e1[_0x174f('0xe')][0x0][_0x174f('0xf')];}logger[_0x174f('0x10')]('['+[_0x4006f1[_0x174f('0x11')]()]+'],\x20getAdminUser\x20crm',_0x35d03a);_0x4a9dac(_0x35d03a);})[_0x174f('0x12')](function(_0x2addc2){logger[_0x174f('0x13')]('['+[_0x4006f1[_0x174f('0x11')]()]+']',_0x2addc2[_0x174f('0x14')]);_0x2e1786(_0x2addc2[_0x174f('0x14')]);});});}function getUser(_0x42bb6b,_0xed92e5,_0x3c64bc,_0x1ab1e7,_0x560c8a){return function(_0x390713){logger['info']('['+[_0x42bb6b[_0x174f('0x11')]()]+_0x174f('0x15'),_0x390713);return new Promise(function(_0x1fc30d,_0x80646d){if(intUtil['validateEmail'](_0x390713['userEmail'])){var _0x524fd6={'method':_0x174f('0x16'),'uri':_0x3c64bc+'sys_user?sysparm_query=email%3D'+_0x390713['userEmail']+'&'+_0x1ab1e7+'&'+_0x560c8a,'auth':_0xed92e5,'json':!![]};logger[_0x174f('0x10')]('['+[_0x42bb6b[_0x174f('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x524fd6);return rp(_0x524fd6)[_0x174f('0xb')](function(_0x5fd78d){logger[_0x174f('0x10')]('['+[_0x42bb6b[_0x174f('0x11')]()]+'],\x20getUser\x20entity',_0x5fd78d);if(_0x5fd78d[_0x174f('0xe')][_0x174f('0xc')]>0x0&&String(_0x5fd78d[_0x174f('0xe')][0x0][_0x174f('0x17')])===_0x174f('0x18')){_0x390713[_0x174f('0x19')]=_0x5fd78d[_0x174f('0xe')][0x0][_0x174f('0xf')];}else{_0x390713[_0x174f('0x19')]=_0x390713[_0x174f('0xd')];_0x390713[_0x174f('0x1a')]=_0x390713[_0x174f('0x1b')];}logger[_0x174f('0x10')]('['+[_0x42bb6b[_0x174f('0x11')]()]+'],\x20getUser\x20crm',_0x390713);_0x1fc30d(_0x390713);})[_0x174f('0x12')](function(_0xb9afa9){logger['error']('['+[_0x42bb6b[_0x174f('0x11')]()]+']',_0xb9afa9[_0x174f('0x14')]);_0x80646d(_0xb9afa9[_0x174f('0x14')]);});}else{logger[_0x174f('0x10')]('['+[_0x42bb6b[_0x174f('0x11')]()]+']\x20using\x20admin\x20profile');_0x390713['userId']=_0x390713[_0x174f('0xd')];_0x390713[_0x174f('0x1a')]=_0x390713[_0x174f('0x1b')];_0x1fc30d(_0x390713);}});};}function createEndUser(_0x1dd2db,_0x28fc69,_0x457489,_0xcc23de,_0x4b7303){logger[_0x174f('0x10')]('['+[_0x1dd2db[_0x174f('0x11')]()]+_0x174f('0x1c'),_0x457489);return new Promise(function(_0x2e3bda,_0x35b9f1){var _0x55f3c2={'method':_0x174f('0x1d'),'uri':_0xcc23de+_0x174f('0x1e')+_0x4b7303,'body':{'user_name':_0x457489[_0x174f('0x1f')],'roles':'user','first_name':_0x457489[_0x174f('0x1f')],'active':'true','date_format':_0x174f('0x20'),'phone':_0x457489['endUserNumber']},'auth':_0x28fc69,'json':!![]};return rp(_0x55f3c2)[_0x174f('0xb')](function(_0x998470){logger['info']('['+[_0x1dd2db['toUpperCase']()]+'],\x20EndUser\x20schema',_0x998470[_0x174f('0xe')]);_0x457489[_0x174f('0x21')]=_0x998470['result'][_0x174f('0xf')];_0x2e3bda(_0x457489);})[_0x174f('0x12')](function(_0x3beb4a){logger['error']('['+[_0x1dd2db['toUpperCase']()]+']',_0x3beb4a['message']);_0x35b9f1(_0x3beb4a[_0x174f('0x14')]);});});}function getEndUser(_0x5acbc1,_0x25aeae,_0x257b70,_0x55ae81,_0x2439de){return function(_0x2c67a2){logger[_0x174f('0x10')]('['+[_0x5acbc1[_0x174f('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x2c67a2);return new Promise(function(_0x45918b,_0x3cf36f){var _0x2bcdba={'method':_0x174f('0x16'),'uri':_0x257b70+_0x174f('0x22')+_0x2c67a2[_0x174f('0x1f')]+'&'+_0x55ae81+'&'+_0x2439de,'auth':_0x25aeae,'json':!![]};return rp(_0x2bcdba)[_0x174f('0xb')](function(_0x306a07){if(_0x306a07['result'][_0x174f('0xc')]>0x0){_0x2c67a2[_0x174f('0x21')]=_0x306a07[_0x174f('0xe')][0x0]['sys_id'];logger[_0x174f('0x10')]('['+[_0x5acbc1[_0x174f('0x11')]()]+_0x174f('0x23'),_0x2c67a2);_0x45918b(_0x2c67a2);}else{return createEndUser(_0x5acbc1,_0x25aeae,_0x2c67a2,_0x257b70,_0x55ae81)[_0x174f('0xb')](function(_0x4e725a){logger[_0x174f('0x10')]('['+[_0x5acbc1['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x4e725a);_0x45918b(_0x4e725a);});}})[_0x174f('0x12')](function(_0x33049d){logger[_0x174f('0x13')]('['+[_0x5acbc1['toUpperCase']()]+']',_0x33049d[_0x174f('0x14')]);_0x3cf36f(_0x33049d['message']);});});};}function getCustomFields(_0x202d21,_0x446b72){var _0x3ba1dc={};if(_0x202d21[_0x174f('0xc')]>0x0){_['forEach'](_0x202d21,function(_0x3a589b){if(_['includes'](['string',_0x174f('0x24')],_0x3a589b['type'])&&_0x3a589b['nameField']&&!_0x3a589b[_0x174f('0x25')]){_0x3ba1dc[_0x3a589b['nameField'][_0x174f('0x26')]()]=_0x3a589b['content']['toString']();}else if(_[_0x174f('0x27')]([_0x174f('0x28'),_0x174f('0x24')],_0x3a589b[_0x174f('0x29')])&&_0x3a589b[_0x174f('0x2a')]&&_0x3a589b['customField']){_0x3ba1dc[_0x3a589b[_0x174f('0x2a')][_0x174f('0x26')]()]=_0x3a589b[_0x174f('0x2b')][_0x174f('0x2c')]();}else if(_0x3a589b[_0x174f('0x29')]==='variable'&&_0x3a589b[_0x174f('0x2d')]&&_0x3a589b['idField']&&_0x3a589b['customField']){_0x3ba1dc[_0x3a589b[_0x174f('0x2a')][_0x174f('0x26')]()]=_0x446b72[_0x3a589b[_0x174f('0x2d')]][_0x174f('0x2c')]();}else if(_0x3a589b['type']===_0x174f('0x2e')&&_0x3a589b[_0x174f('0x2f')]&&_0x3a589b[_0x174f('0x2f')][_0x174f('0x30')]&&_0x3a589b[_0x174f('0x2a')]&&_0x3a589b[_0x174f('0x25')]){_0x3ba1dc[_0x3a589b[_0x174f('0x2a')][_0x174f('0x26')]()]=_0x446b72[_0x3a589b[_0x174f('0x2f')][_0x174f('0x30')][_0x174f('0x26')]()][_0x174f('0x2c')]();}});}return _0x3ba1dc;}function getTicket(_0xce61d0,_0x389c75,_0x4192c6,_0x34acd4,_0x47e0d8,_0x5971a0){return function(_0x53c774){logger[_0x174f('0x10')]('['+[_0xce61d0[_0x174f('0x11')]()]+_0x174f('0x31'),_0x53c774);return new Promise(function(_0xc52558,_0x1ceb98){var _0x33504b=_0xce61d0[_0x174f('0x26')]()===_0x174f('0x32')?_0x53c774[_0x174f('0x19')]:_0x53c774[_0x174f('0x21')];var _0x3bbf8d={'method':'POST','uri':_0x4192c6+_0x174f('0x33')+'?'+_0x5971a0,'body':Object[_0x174f('0x34')]({},{'active':_0x174f('0x18'),'caller_id':_0x33504b,'assigned_to':_0x53c774['userId'],'short_description':intUtil[_0x174f('0x35')](_0x34acd4['Subjects'],_0x47e0d8,'\x20'),'description':intUtil['getString'](_0x34acd4[_0x174f('0x36')],_0x47e0d8,'\x0a')},getCustomFields(_0x34acd4[_0x174f('0x37')],_0x47e0d8)),'auth':_0x389c75,'json':!![]};return rp(_0x3bbf8d)[_0x174f('0xb')](function(_0x58ce2d){logger[_0x174f('0x10')]('['+[_0xce61d0[_0x174f('0x11')]()]+_0x174f('0x38'),_0x58ce2d[_0x174f('0xe')]);_0x53c774[_0x174f('0x39')]=_0x58ce2d[_0x174f('0xe')][_0x174f('0xf')];_0x53c774[_0x174f('0x3a')]=_0x58ce2d[_0x174f('0xe')][_0x174f('0x3b')];logger[_0x174f('0x10')]('['+[_0xce61d0[_0x174f('0x11')]()]+_0x174f('0x3c'),_0x53c774);_0xc52558(_0x53c774);})[_0x174f('0x12')](function(_0x5b2271){logger[_0x174f('0x13')]('['+[_0xce61d0[_0x174f('0x11')]()]+']',_0x5b2271[_0x174f('0x14')]);_0x1ceb98(_0x5b2271[_0x174f('0x14')]);});});};}function createRemoteTag(_0x4b72f3,_0x399dd7,_0x46e066,_0x543b2b){return new Promise(function(_0x3afbb6,_0x1a292c){var _0x30eca4={'method':_0x174f('0x1d'),'uri':_0x46e066+_0x174f('0x3d')+'?'+_0x543b2b,'body':{'short_description':_0x4b72f3,'global':!![],'active':!![],'name':_0x4b72f3},'auth':_0x399dd7,'json':!![]};return rp(_0x30eca4)[_0x174f('0xb')](function(_0x30a477){var _0xb6e4bb=_0x30a477['result']['sys_id'];_0x3afbb6(_0xb6e4bb);});});}function getRemoteTag(_0xd00a62,_0xf8e258,_0x56853c,_0x5f0640,_0x3720a3){return new Promise(function(_0x59c356,_0x4243d0){var _0x536254={'method':'GET','uri':_0x56853c+_0x174f('0x3d')+_0x174f('0x3e')+_0xd00a62+'&'+_0x5f0640,'auth':_0xf8e258,'json':!![]};return rp(_0x536254)[_0x174f('0xb')](function(_0xc2a9f0){if(_0xc2a9f0[_0x174f('0xe')][_0x174f('0xc')]>0x0){var _0xdb0e45=_0xc2a9f0[_0x174f('0xe')][0x0][_0x174f('0xf')];_0x59c356(_0xdb0e45);}else{return createRemoteTag(_0xd00a62,_0xf8e258,_0x56853c,_0x5f0640)['then'](function(_0x9a6ecb){_0x59c356(_0x9a6ecb);});}});});}function assignTagToIncident(_0x391445,_0x1f46d7,_0x2ad9f8,_0x1d90f6,_0x31d908){return new Promise(function(_0x1c1832,_0x142626){var _0x29db80={'method':'POST','uri':_0x2ad9f8+'label_entry'+'?'+_0x31d908,'body':{'label':_0x391445,'table':_0x174f('0x33'),'id_type':'Incident','table_key':_0x1d90f6['ticketId'],'title':_0x174f('0x3f')+_0x1d90f6[_0x174f('0x3a')],'id_display':_0x1d90f6[_0x174f('0x3a')]},'auth':_0x1f46d7,'json':!![]};return rp(_0x29db80)[_0x174f('0xb')](function(_0x11f702){_0x1c1832();})['catch'](function(){_0x1c1832();});});}function manageTags(_0x3e5adb,_0x35fbc2,_0x1a3dea,_0x233f15,_0x3f4cf8,_0x300887,_0xeaf672){return new Promise(function(_0x4f01d0,_0x29d41d){var _0x12868f=[];_0x35fbc2['forEach'](function(_0x3f794b){_0x12868f[_0x174f('0x40')](getRemoteTag(_0x3f794b,_0x1a3dea,_0x233f15,_0x300887,_0xeaf672));});return Promise['all'](_0x12868f)[_0x174f('0xb')](function(_0x202bd7){if(_0x202bd7['length']){logger[_0x174f('0x10')]('['+[_0x3e5adb[_0x174f('0x11')]()]+_0x174f('0x41'),_0x202bd7);var _0x5da92e=[];_0x202bd7[_0x174f('0x42')](function(_0x1c5f43){_0x5da92e[_0x174f('0x40')](assignTagToIncident(_0x1c5f43,_0x1a3dea,_0x233f15,_0x3f4cf8,_0x300887));});return Promise[_0x174f('0x43')](_0x5da92e)['then'](function(){_0x4f01d0();})['catch'](function(){_0x4f01d0();});}else{_0x4f01d0();}});});}function getTags(_0x235ac7,_0x483125,_0x598475,_0x5847e0,_0x109c08,_0x2e37c2){return function(_0x303e11){return new Promise(function(_0x5717c4,_0x1acd93){var _0x3c3d0c=[];var _0x131810=_0x5847e0[_0x174f('0x44')];if(_0x131810&&_0x131810['length']>0x0){_0x3c3d0c=_['map'](_0x131810,'name');}if(_0x3c3d0c['length']>0x0){return manageTags(_0x235ac7,_0x3c3d0c,_0x483125,_0x598475,_0x303e11,_0x109c08,_0x2e37c2)['then'](function(){_0x5717c4(_0x303e11);});}else{_0x5717c4(_0x303e11);}});};}function emit(_0x2c91c0,_0x47c326,_0x5ac48c){var _0x27c5b0=_0x174f('0x45')+_0x174f('0x46')+_0x174f('0x47')+_0x174f('0x48');var _0x1b3498={'uri':_0x2c91c0+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ac48c+_0x27c5b0};io['to'](util[_0x174f('0x49')](_0x174f('0x4a'),_0x47c326))[_0x174f('0x4b')](_0x174f('0x4c'),_0x1b3498);}exports['cs']=function(_0x19fdc1,_0x4b6ba8,_0x5e9048,_0x2a8672,_0x2fa19b,_0x2d2aef,_0x46a753,_0x4ae526){var _0x5c4324={};var _0x8bd6d1={'user':_0x2d2aef['username'],'pass':_0x2d2aef['password']};var _0x5916ea=_0x174f('0x4d');var _0x28425b='sysparm_display_value=true';_0x2d2aef[_0x174f('0x4e')]=intUtil[_0x174f('0x4f')](_0x2d2aef[_0x174f('0x4e')]);_0x2d2aef[_0x174f('0x50')]=intUtil[_0x174f('0x4f')](_0x2d2aef[_0x174f('0x50')]);var _0x282e0a=util['format'](_0x174f('0x51'),_0x2d2aef['remoteUri']);_0x5c4324['userEmail']=!_[_0x174f('0x52')](_0x2a8672)?_0x2a8672[_0x174f('0x53')]:null;_0x5c4324[_0x174f('0x1b')]=_0x2d2aef[_0x174f('0x53')];_0x5c4324['endUserNumber']=_0x4ae526[_0x174f('0x26')]()===_0x174f('0x32')?_0x4b6ba8['destcalleridnum']:_0x4b6ba8[_0x174f('0x54')];_0x5c4324[_0x174f('0x55')]=_0x4ae526===_0x174f('0x56')||_0x4ae526===_0x174f('0x57')?_0x174f('0x56'):_0x174f('0x32');var _0x19ade4=util['format'](_0x174f('0x58'),_0x2d2aef[_0x174f('0x50')],_0x4b6ba8['uniqueid'],md5(_0x4b6ba8[_0x174f('0x59')]));if(_0x2fa19b&&_0x2fa19b[_0x174f('0x5a')]){logger[_0x174f('0x10')]('[QUEUE]',_0x174f('0x5b'));_0x4b6ba8[_0x174f('0x5c')]=_0x19ade4;}else if(_0x46a753&&_0x46a753[_0x174f('0x5d')]&&_0x46a753['recordingFormat']!==_0x174f('0x5e')){logger['info']('[OUTBOUND]',_0x174f('0x5b'));_0x4b6ba8['recordingURL']=_0x19ade4;}else{_0x4b6ba8[_0x174f('0x5c')]='';}return getAdminUser(_0x4ae526,_0x8bd6d1,_0x5c4324,_0x282e0a,_0x28425b,_0x5916ea)[_0x174f('0xb')](getUser(_0x4ae526,_0x8bd6d1,_0x282e0a,_0x28425b,_0x5916ea))[_0x174f('0xb')](getEndUser(_0x4ae526,_0x8bd6d1,_0x282e0a,_0x28425b,_0x5916ea))['then'](getTicket(_0x4ae526,_0x8bd6d1,_0x282e0a,_0x5e9048,_0x4b6ba8,_0x28425b))[_0x174f('0xb')](function(_0xbab4ed){logger[_0x174f('0x10')](util[_0x174f('0x49')](_0x174f('0x5f'),_0xbab4ed[_0x174f('0x39')]));logger['info'](util[_0x174f('0x49')](_0x174f('0x60'),_0x4ae526));if(_0x4ae526!=='unmanaged'){logger[_0x174f('0x10')]('['+[_0x4ae526[_0x174f('0x11')]()]+']',_0x174f('0x61'));emit(_0x2d2aef[_0x174f('0x4e')],_0x2a8672[_0x174f('0x30')],_0xbab4ed[_0x174f('0x39')]);}})[_0x174f('0x12')](function(_0x838d38){logger['error']('['+[_0x4ae526[_0x174f('0x11')]()]+_0x174f('0x62'),util['inspect'](_0x838d38,{'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 ab8f8f9..eae5c1b 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 _0x9b22=['uri','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','length','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x425396,_0x58190d){var _0x31c212=function(_0x59f71c){while(--_0x59f71c){_0x425396['push'](_0x425396['shift']());}};_0x31c212(++_0x58190d);}(_0x9b22,0x9d));var _0x29b2=function(_0x5a89b2,_0x437a57){_0x5a89b2=_0x5a89b2-0x0;var _0x27a3eb=_0x9b22[_0x5a89b2];return _0x27a3eb;};'use strict';var _=require(_0x29b2('0x0'));var rp=require(_0x29b2('0x1'));var BPromise=require('bluebird');var md5=require(_0x29b2('0x2'));var util=require(_0x29b2('0x3'));var Redis=require(_0x29b2('0x4'));var intUtil=require('./util');var config=require(_0x29b2('0x5'));var logger=require(_0x29b2('0x6'))(_0x29b2('0x7'));config[_0x29b2('0x8')]=_[_0x29b2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x29b2('0xa'))(new Redis(config[_0x29b2('0x8')]));var def={'method':_0x29b2('0xb'),'json':!![]};function emit(_0x4a3801,_0x4c39a2,_0x494854){io['to'](_0x4a3801)[_0x29b2('0xc')](_0x4c39a2,_0x494854);}function getTicket(_0x22ed62,_0x40ef2b,_0x3cc78c,_0x58a014,_0x1b1599,_0x187a60,_0xda3661,_0x450852){logger[_0x29b2('0xd')](_0x29b2('0xe'));var _0x1f60c3=new Date();var _0x18a0ca=[{'name':_0x29b2('0xf'),'value':intUtil[_0x29b2('0x10')](_0x58a014[_0x29b2('0x11')],_0x1b1599,'\x20')},{'name':_0x29b2('0x12'),'value':_0x40ef2b['id']},{'name':'created_by','value':_0x40ef2b['id']},{'name':_0x29b2('0x13'),'value':intUtil['getString'](_0x58a014[_0x29b2('0x14')],_0x1b1599,'\x0a')},{'name':_0x29b2('0x15'),'value':_0x1f60c3[_0x29b2('0x16')]()[_0x29b2('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x29b2('0x18'),'value':'15'},{'name':_0x29b2('0x19'),'value':_0x3cc78c['id']},{'name':_0x29b2('0x1a'),'value':'Contacts'},{'name':_0x29b2('0x1b'),'value':_0x3cc78c[_0x29b2('0xf')]},{'name':_0x29b2('0x1c'),'value':_0x450852}];if(_0x187a60['length']){_[_0x29b2('0x1d')](_0x187a60,function(_0xafe11e){if(_0x1b1599[_0xafe11e[_0x29b2('0x1e')]]){_0x18a0ca[_0x29b2('0x1f')]({'name':_0xafe11e['idField'],'value':_0x1b1599[_0xafe11e[_0x29b2('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x29b2('0x20'),'response_type':'JSON','rest_data':JSON[_0x29b2('0x21')]({'session':_0xda3661['id'],'module_name':_0x29b2('0x22'),'name_value_list':_0x18a0ca})}});}function getAuth(_0x4b9d58){return util['format'](_0x29b2('0x23'),new Buffer(_0x4b9d58[_0x29b2('0x24')]+':X')[_0x29b2('0x25')](_0x29b2('0x26')));}function getServerInfo(_0x26a7aa){return request({'form':{'method':_0x29b2('0x27'),'input_type':_0x29b2('0x20'),'response_type':'JSON','rest_data':JSON[_0x29b2('0x21')]({'session':_0x26a7aa['id']})}});}function getUser(_0x56089c,_0x45341c,_0x422b3d){if(!_[_0x29b2('0x28')](_0x45341c)){logger[_0x29b2('0xd')](_0x29b2('0x29'),_0x45341c);return request({'form':{'method':_0x29b2('0x2a'),'input_type':'JSON','response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x422b3d['id'],'module_name':_0x29b2('0x2b'),'query':util[_0x29b2('0x2c')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x45341c),'order_by':'','offset':'0','select_fields':['id',_0x29b2('0xf'),_0x29b2('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x29b2('0x2e')](function(_0x51a4f1){if(_0x51a4f1[_0x29b2('0x2f')][_0x29b2('0x30')]){var _0x2da0af=_[_0x29b2('0x31')](_0x51a4f1[_0x29b2('0x2f')],function(_0x478435){return _0x478435[_0x29b2('0x32')][_0x29b2('0x2d')]['value']===_0x45341c;});if(_0x2da0af){logger[_0x29b2('0xd')](_0x29b2('0x33'));return BPromise[_0x29b2('0x34')]({'id':_0x2da0af[_0x29b2('0x32')]['id'][_0x29b2('0x35')],'name':_0x2da0af['name_value_list']['name'][_0x29b2('0x35')]});}}logger[_0x29b2('0xd')](_0x29b2('0x36'));return BPromise['resolve']({'id':_0x422b3d['name_value_list'][_0x29b2('0x37')][_0x29b2('0x35')],'name':_0x422b3d[_0x29b2('0x32')][_0x29b2('0x2d')][_0x29b2('0x35')]});});}else{logger['info'](_0x29b2('0x38'));return BPromise[_0x29b2('0x34')]({'id':_0x422b3d[_0x29b2('0x32')][_0x29b2('0x37')][_0x29b2('0x35')],'name':_0x422b3d['name_value_list'][_0x29b2('0x2d')][_0x29b2('0x35')]});}}function getEndUser(_0x5c067d,_0x1b8eef,_0x1eae7f,_0x4fb289){logger['info'](_0x29b2('0x39'),_0x1eae7f);return request({'form':{'method':_0x29b2('0x2a'),'input_type':_0x29b2('0x20'),'response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x4fb289['id'],'module_name':_0x29b2('0x3a'),'query':util['format'](_0x29b2('0x3b'),_0x1eae7f),'order_by':'','offset':'0','select_fields':['id','name',_0x29b2('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x246ba5){if(_0x246ba5[_0x29b2('0x2f')][_0x29b2('0x30')]){var _0x17a515=_['find'](_0x246ba5[_0x29b2('0x2f')],function(_0x45bce3){return _0x45bce3[_0x29b2('0x32')][_0x29b2('0x3c')][_0x29b2('0x35')]===_0x1eae7f;});if(_0x17a515){logger[_0x29b2('0xd')](_0x29b2('0x3d'));return BPromise['resolve']({'id':_0x17a515[_0x29b2('0x32')]['id'][_0x29b2('0x35')],'name':_0x17a515['name_value_list']['name'][_0x29b2('0x35')],'phone':_0x17a515[_0x29b2('0x32')][_0x29b2('0x3c')][_0x29b2('0x35')]});}}else{logger[_0x29b2('0xd')](_0x29b2('0x3e'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x4fb289['id'],'module_name':_0x29b2('0x3a'),'name_value_list':[{'name':'first_name','value':_0x1b8eef!==_0x29b2('0x3f')?_0x1b8eef:util[_0x29b2('0x2c')]('Caller\x20-\x20%s',_0x1eae7f)},{'name':_0x29b2('0x3c'),'value':_0x1eae7f}]})}})[_0x29b2('0x2e')](function(_0x72b116){logger[_0x29b2('0xd')](_0x29b2('0x40'));return BPromise[_0x29b2('0x34')]({'id':_0x72b116['id'],'name':_0x72b116[_0x29b2('0x2f')][_0x29b2('0x41')][_0x29b2('0x35')],'phone':_0x72b116['entry_list'][_0x29b2('0x3c')]['value']});});}});}function request(_0x5baa5e){logger['debug'](_0x29b2('0x42'),JSON['stringify'](_0x5baa5e));return rp(_['merge'](def,_0x5baa5e));}function getTags(_0x18cc92,_0x3bdcf4){var _0x5ba6b4=[];if(_0x18cc92&&_0x18cc92[_0x29b2('0x30')]>0x0){_0x5ba6b4=_[_0x29b2('0x43')](_0x18cc92,_0x3bdcf4);}return _0x5ba6b4;}function getCustomFields(_0x38667e,_0x2d1060){var _0x3b8c03=[];var _0x573800={'custom_fields':[]};if(_0x38667e[_0x29b2('0x30')]>0x0){_[_0x29b2('0x1d')](_0x38667e,function(_0x16c749){if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x45')&&_0x16c749[_0x29b2('0x46')]&&!_0x16c749[_0x29b2('0x47')]){_0x573800[_0x16c749['nameField'][_0x29b2('0x48')]()]=_0x16c749[_0x29b2('0x49')][_0x29b2('0x25')]();}else if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x45')&&_0x16c749[_0x29b2('0x4a')]&&_0x16c749[_0x29b2('0x47')]){_0x573800[_0x29b2('0x4b')]['push']({'id':_0x16c749[_0x29b2('0x4a')],'value':_0x16c749[_0x29b2('0x49')]['toString']()});}else if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x4c')&&_0x16c749[_0x29b2('0x1e')]&&_0x16c749['idField']&&_0x16c749[_0x29b2('0x47')]){_0x2d1060[_0x16c749['variableName']]&&_0x573800[_0x29b2('0x4b')][_0x29b2('0x1f')]({'id':_0x16c749[_0x29b2('0x4a')],'value':_0x2d1060[_0x16c749[_0x29b2('0x1e')]]['toString']()});}else if(_0x16c749[_0x29b2('0x44')]===_0x29b2('0x4d')&&_0x16c749['Variable']&&_0x16c749['Variable'][_0x29b2('0xf')]&&_0x16c749['idField']&&_0x16c749[_0x29b2('0x47')]){_0x2d1060[_0x16c749['Variable'][_0x29b2('0xf')]['toLowerCase']()]&&_0x573800['custom_fields']['push']({'id':_0x16c749['idField'],'value':_0x2d1060[_0x16c749['Variable'][_0x29b2('0xf')][_0x29b2('0x48')]()][_0x29b2('0x25')]()});}});}return _0x573800;}function getConnection(_0x39ec9){return request({'method':'POST','form':{'method':_0x29b2('0x4e'),'input_type':'JSON','response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'user_auth':{'user_name':_0x39ec9['username'],'password':_0x39ec9[_0x29b2('0x4f')],'encryption':_0x29b2('0x50')},'application':_0x29b2('0x51')})}})[_0x29b2('0x2e')](function(_0x533e26){var _0x154f26=_0x533e26;if(_0x154f26['id']){def[_0x29b2('0x52')]=_0x154f26['id'];return BPromise[_0x29b2('0x34')](_0x154f26);}else{throw new Error(util['format'](_0x29b2('0x53'),_0x39ec9['id']));}});}function setRelationship(_0x1b6f7a,_0x3ecfb8,_0x49e52b,_0xc40cba){return request({'form':{'method':_0x29b2('0x54'),'input_type':_0x29b2('0x20'),'response_type':_0x29b2('0x20'),'rest_data':JSON[_0x29b2('0x21')]({'session':_0x1b6f7a['id'],'module_name':_0x29b2('0x22'),'module_id':_0x49e52b['id'],'link_field_name':_0xc40cba,'related_ids':[_0x3ecfb8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x29b2('0x55')]=function(_0x573ec8,_0x31ee33,_0xd751ad,_0x5b93ae,_0x590549,_0x554559){var _0x1e4a1a,_0x49b5cd,_0x4b534a,_0x56c695;_0x554559[_0x29b2('0x56')]=intUtil[_0x29b2('0x57')](_0x554559['remoteUri']);_0x554559[_0x29b2('0x58')]=intUtil['stripTrailingSlash'](_0x554559[_0x29b2('0x58')]);def[_0x29b2('0x59')]=util[_0x29b2('0x2c')]('%s/service/v4_1/rest.php',_0x554559['remoteUri']);if(_0x590549&&_0x590549['monitor_format']){logger[_0x29b2('0xd')](_0x29b2('0x5a'),_0x29b2('0x5b'));_0x31ee33['recordingURL']=util['format'](_0x29b2('0x5c'),_0x554559[_0x29b2('0x58')],_0x31ee33[_0x29b2('0x5d')],md5(_0x31ee33['uniqueid']));}else{_0x31ee33['recordingURL']='';}return getConnection(_0x554559)['then'](function(_0x4fa544){_0x56c695=_0x4fa544;return getUser(_0x554559,_0x5b93ae[_0x29b2('0xf')],_0x56c695);})[_0x29b2('0x2e')](function(_0x2e9661){_0x1e4a1a=_0x2e9661;logger[_0x29b2('0xd')]('The\x20User\x20ID\x20is:',_0x1e4a1a['id']);return getEndUser(_0x554559,_0x31ee33[_0x29b2('0x5e')],_0x31ee33[_0x29b2('0x5f')],_0x56c695);})[_0x29b2('0x2e')](function(_0x1e6c08){_0x49b5cd=_0x1e6c08;logger[_0x29b2('0xd')](_0x29b2('0x60'),_0x49b5cd['id']);return getTicket(_0x554559,_0x1e4a1a,_0x49b5cd,_0xd751ad,_0x31ee33,_0xd751ad[_0x29b2('0x61')],_0x56c695,_0x29b2('0x62'));})['then'](function(_0x190e1d){_0x4b534a=_0x190e1d;logger['info']('Ticket\x20created!');logger[_0x29b2('0xd')](_0x29b2('0x63'),_0x4b534a['id']);return setRelationship(_0x56c695,_0x1e4a1a,_0x4b534a,_0x29b2('0x64'));})[_0x29b2('0x2e')](function(){return setRelationship(_0x56c695,_0x49b5cd,_0x4b534a,_0x29b2('0x65'));})[_0x29b2('0x2e')](function(){return getServerInfo(_0x56c695);})['then'](function(_0x366556){var _0x498b8c=parseInt(_0x366556[_0x29b2('0x66')]['charAt'](0x0));var _0x550336=util['format'](_0x29b2('0x67'),_0x554559[_0x29b2('0x56')],_0x4b534a['id']);if(_0x498b8c>0x6){_0x550336=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x554559['remoteUri'],_0x4b534a['id']);}logger[_0x29b2('0xd')](_0x29b2('0x5a'),_0x29b2('0x68'));emit(util[_0x29b2('0x2c')](_0x29b2('0x69'),_0x5b93ae['name']),_0x29b2('0x6a'),{'uri':_0x550336});})['catch'](function(_0x43680c){logger[_0x29b2('0x6b')](_0x29b2('0x5a'),JSON[_0x29b2('0x21')](_0x43680c));});};exports['outbound']=function(_0x3b6bb6,_0x26cff7,_0x44e48b,_0x2f0e54,_0x4d4f92,_0x230290,_0x135a31){var _0x113c5c,_0x156e56,_0x2d2db4,_0x14d2ed;_0x230290[_0x29b2('0x56')]=intUtil['stripTrailingSlash'](_0x230290[_0x29b2('0x56')]);_0x230290[_0x29b2('0x58')]=intUtil['stripTrailingSlash'](_0x230290[_0x29b2('0x58')]);def['uri']=util[_0x29b2('0x2c')](_0x29b2('0x6c'),_0x230290['remoteUri']);if(_0x135a31&&_0x135a31['recordingFormat']&&_0x135a31[_0x29b2('0x6d')]!=='none'){logger['info'](_0x29b2('0x6e'),_0x29b2('0x5b'));_0x26cff7[_0x29b2('0x6f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x230290['serverUrl'],_0x26cff7['uniqueid'],md5(_0x26cff7[_0x29b2('0x5d')]));}return getConnection(_0x230290)[_0x29b2('0x2e')](function(_0x5d653a){_0x14d2ed=_0x5d653a;return getUser(_0x230290,_0x2f0e54[_0x29b2('0xf')],_0x14d2ed);})[_0x29b2('0x2e')](function(_0xd0b746){_0x113c5c=_0xd0b746;logger['info'](_0x29b2('0x70'),_0x113c5c['id']);return getEndUser(_0x230290,_0x26cff7[_0x29b2('0x71')],_0x26cff7[_0x29b2('0x72')],_0x14d2ed);})[_0x29b2('0x2e')](function(_0x2d01fe){_0x156e56=_0x2d01fe;logger[_0x29b2('0xd')]('The\x20Enduser\x20ID\x20is:',_0x156e56['id']);return getTicket(_0x230290,_0x113c5c,_0x156e56,_0x44e48b,_0x26cff7,_0x44e48b[_0x29b2('0x61')],_0x14d2ed,_0x29b2('0x73'));})[_0x29b2('0x2e')](function(_0x134634){_0x2d2db4=_0x134634;logger[_0x29b2('0xd')](_0x29b2('0x74'));logger[_0x29b2('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2d2db4['id']);return setRelationship(_0x14d2ed,_0x113c5c,_0x2d2db4,_0x29b2('0x64'));})[_0x29b2('0x2e')](function(){return setRelationship(_0x14d2ed,_0x156e56,_0x2d2db4,_0x29b2('0x65'));})[_0x29b2('0x2e')](function(){return getServerInfo(_0x14d2ed);})[_0x29b2('0x2e')](function(_0x238d0d){var _0x4fda40=parseInt(_0x238d0d[_0x29b2('0x66')][_0x29b2('0x75')](0x0));var _0x382d1a=util['format'](_0x29b2('0x67'),_0x230290[_0x29b2('0x56')],_0x2d2db4['id']);if(_0x4fda40>0x6){_0x382d1a=util[_0x29b2('0x2c')](_0x29b2('0x76'),_0x230290[_0x29b2('0x56')],_0x2d2db4['id']);}logger[_0x29b2('0xd')](_0x29b2('0x6e'),_0x29b2('0x68'));emit(util[_0x29b2('0x2c')](_0x29b2('0x69'),_0x2f0e54[_0x29b2('0xf')]),_0x29b2('0x6a'),{'uri':_0x382d1a});})[_0x29b2('0x77')](function(_0x435763){logger[_0x29b2('0x6b')](_0x29b2('0x6e'),JSON[_0x29b2('0x21')](_0x435763));});};exports['unmanaged']=function(_0x14e57d,_0x535bc9,_0x4ddaa,_0x1972fb,_0x221cc3,_0x27381e){var _0x151ba6,_0x5819dd,_0x67ab3c,_0x28c781;_0x27381e['remoteUri']=intUtil[_0x29b2('0x57')](_0x27381e[_0x29b2('0x56')]);_0x27381e[_0x29b2('0x58')]=intUtil[_0x29b2('0x57')](_0x27381e['serverUrl']);def[_0x29b2('0x59')]=util[_0x29b2('0x2c')](_0x29b2('0x6c'),_0x27381e[_0x29b2('0x56')]);if(_0x221cc3&&_0x221cc3[_0x29b2('0x78')]){logger['info']('['+_0x535bc9[_0x29b2('0x79')][_0x29b2('0x7a')]()+']',_0x29b2('0x5b'));_0x535bc9[_0x29b2('0x6f')]=util['format'](_0x29b2('0x5c'),_0x27381e[_0x29b2('0x58')],_0x535bc9[_0x29b2('0x5d')],md5(_0x535bc9['uniqueid']));}else{_0x535bc9[_0x29b2('0x6f')]='';}return getConnection(_0x27381e)[_0x29b2('0x2e')](function(_0x4450ec){_0x28c781=_0x4450ec;if(!_[_0x29b2('0x28')](_0x1972fb)){return getUser(_0x27381e,_0x1972fb['name'],_0x28c781);}else{return getUser(_0x27381e,null,_0x28c781);}})['then'](function(_0x139294){_0x151ba6=_0x139294;logger['info']('The\x20User\x20ID\x20is:',_0x151ba6['id']);return getEndUser(_0x27381e,_0x535bc9[_0x29b2('0x5e')],_0x535bc9['calleridnum'],_0x28c781);})[_0x29b2('0x2e')](function(_0x301abb){_0x5819dd=_0x301abb;logger[_0x29b2('0xd')](_0x29b2('0x60'),_0x5819dd['id']);return getTicket(_0x27381e,_0x151ba6,_0x5819dd,_0x4ddaa,_0x535bc9,_0x4ddaa[_0x29b2('0x61')],_0x28c781,_0x29b2('0x62'));})[_0x29b2('0x2e')](function(_0x556a8d){_0x67ab3c=_0x556a8d;logger[_0x29b2('0xd')](_0x29b2('0x74'));logger[_0x29b2('0xd')](_0x29b2('0x63'),_0x67ab3c['id']);return setRelationship(_0x28c781,_0x151ba6,_0x67ab3c,_0x29b2('0x64'));})[_0x29b2('0x2e')](function(){return setRelationship(_0x28c781,_0x5819dd,_0x67ab3c,_0x29b2('0x65'));})[_0x29b2('0x2e')](function(){return getServerInfo(_0x28c781);})[_0x29b2('0x77')](function(_0x21c855){logger[_0x29b2('0x6b')]('['+_0x535bc9[_0x29b2('0x79')][_0x29b2('0x7a')]()+']',JSON[_0x29b2('0x21')](_0x21c855));});}; \ No newline at end of file +var _0xf918=['Descriptions','date_start','toISOString','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','idField','variableName','set_entry','stringify','Basic\x20%s','apiKey','toString','base64','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','first_name','debug','[HTTP]','merge','map','type','nameField','customField','content','custom_fields','variable','customVariable','Variable','toLowerCase','push','login','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','users','user:%s','toUpperCase','lodash','bluebird','md5','ioredis','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString'];(function(_0x1e5efd,_0x2617cf){var _0x3b743e=function(_0x2e8fa1){while(--_0x2e8fa1){_0x1e5efd['push'](_0x1e5efd['shift']());}};_0x3b743e(++_0x2617cf);}(_0xf918,0x143));var _0x8f91=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0xf918[_0x460fd7];return _0x44d1c2;};'use strict';var _=require(_0x8f91('0x0'));var rp=require('request-promise');var BPromise=require(_0x8f91('0x1'));var md5=require(_0x8f91('0x2'));var util=require('util');var Redis=require(_0x8f91('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0x8f91('0x4')]=_[_0x8f91('0x5')](config[_0x8f91('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8f91('0x6'))(new Redis(config[_0x8f91('0x4')]));var def={'method':_0x8f91('0x7'),'json':!![]};function emit(_0x2720c6,_0x49d001,_0x2357b7){io['to'](_0x2720c6)[_0x8f91('0x8')](_0x49d001,_0x2357b7);}function getTicket(_0x3fbb08,_0x1eaa50,_0x25c04f,_0x2c8ec3,_0x18994a,_0x4dd1ee,_0x14cc3d,_0x29005d){logger[_0x8f91('0x9')](_0x8f91('0xa'));var _0x128a0c=new Date();var _0x166c60=[{'name':_0x8f91('0xb'),'value':intUtil['getString'](_0x2c8ec3['Subjects'],_0x18994a,'\x20')},{'name':_0x8f91('0xc'),'value':_0x1eaa50['id']},{'name':_0x8f91('0xd'),'value':_0x1eaa50['id']},{'name':_0x8f91('0xe'),'value':intUtil[_0x8f91('0xf')](_0x2c8ec3[_0x8f91('0x10')],_0x18994a,'\x0a')},{'name':_0x8f91('0x11'),'value':_0x128a0c[_0x8f91('0x12')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x8f91('0x13'),'value':'15'},{'name':_0x8f91('0x14'),'value':_0x25c04f['id']},{'name':_0x8f91('0x15'),'value':_0x8f91('0x16')},{'name':_0x8f91('0x17'),'value':_0x25c04f['name']},{'name':_0x8f91('0x18'),'value':_0x29005d}];if(_0x4dd1ee[_0x8f91('0x19')]){_[_0x8f91('0x1a')](_0x4dd1ee,function(_0x451650){if(_0x18994a[_0x451650['variableName']]){_0x166c60['push']({'name':_0x451650[_0x8f91('0x1b')],'value':_0x18994a[_0x451650[_0x8f91('0x1c')]]});}});}return request({'form':{'method':_0x8f91('0x1d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x8f91('0x1e')]({'session':_0x14cc3d['id'],'module_name':'Calls','name_value_list':_0x166c60})}});}function getAuth(_0x203b85){return util['format'](_0x8f91('0x1f'),new Buffer(_0x203b85[_0x8f91('0x20')]+':X')[_0x8f91('0x21')](_0x8f91('0x22')));}function getServerInfo(_0x5ae39d){return request({'form':{'method':'get_server_info','input_type':_0x8f91('0x23'),'response_type':_0x8f91('0x23'),'rest_data':JSON[_0x8f91('0x1e')]({'session':_0x5ae39d['id']})}});}function getUser(_0x206e3d,_0x39869b,_0x9645ce){if(!_[_0x8f91('0x24')](_0x39869b)){logger[_0x8f91('0x9')](_0x8f91('0x25'),_0x39869b);return request({'form':{'method':_0x8f91('0x26'),'input_type':_0x8f91('0x23'),'response_type':_0x8f91('0x23'),'rest_data':JSON[_0x8f91('0x1e')]({'session':_0x9645ce['id'],'module_name':_0x8f91('0x27'),'query':util[_0x8f91('0x28')](_0x8f91('0x29'),_0x39869b),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8f91('0x2a')](function(_0x36d70e){if(_0x36d70e[_0x8f91('0x2b')][_0x8f91('0x19')]){var _0x1b659f=_[_0x8f91('0x2c')](_0x36d70e[_0x8f91('0x2b')],function(_0x7bcee){return _0x7bcee[_0x8f91('0x2d')][_0x8f91('0x2e')][_0x8f91('0x2f')]===_0x39869b;});if(_0x1b659f){logger[_0x8f91('0x9')](_0x8f91('0x30'));return BPromise[_0x8f91('0x31')]({'id':_0x1b659f['name_value_list']['id'][_0x8f91('0x2f')],'name':_0x1b659f[_0x8f91('0x2d')][_0x8f91('0xb')][_0x8f91('0x2f')]});}}logger[_0x8f91('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x9645ce[_0x8f91('0x2d')]['user_id'][_0x8f91('0x2f')],'name':_0x9645ce['name_value_list'][_0x8f91('0x2e')][_0x8f91('0x2f')]});});}else{logger[_0x8f91('0x9')](_0x8f91('0x32'));return BPromise[_0x8f91('0x31')]({'id':_0x9645ce[_0x8f91('0x2d')][_0x8f91('0x33')][_0x8f91('0x2f')],'name':_0x9645ce[_0x8f91('0x2d')]['user_name'][_0x8f91('0x2f')]});}}function getEndUser(_0xc4a808,_0x32aaeb,_0x34b0e1,_0x1b28e0){logger[_0x8f91('0x9')](_0x8f91('0x34'),_0x34b0e1);return request({'form':{'method':_0x8f91('0x26'),'input_type':_0x8f91('0x23'),'response_type':'JSON','rest_data':JSON[_0x8f91('0x1e')]({'session':_0x1b28e0['id'],'module_name':'Contacts','query':util[_0x8f91('0x28')](_0x8f91('0x35'),_0x34b0e1),'order_by':'','offset':'0','select_fields':['id',_0x8f91('0xb'),_0x8f91('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x58d96b){if(_0x58d96b[_0x8f91('0x2b')]['length']){var _0x1f3714=_['find'](_0x58d96b[_0x8f91('0x2b')],function(_0x176d2f){return _0x176d2f[_0x8f91('0x2d')][_0x8f91('0x36')]['value']===_0x34b0e1;});if(_0x1f3714){logger[_0x8f91('0x9')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x1f3714[_0x8f91('0x2d')]['id']['value'],'name':_0x1f3714[_0x8f91('0x2d')][_0x8f91('0xb')][_0x8f91('0x2f')],'phone':_0x1f3714['name_value_list']['phone_home'][_0x8f91('0x2f')]});}}else{logger[_0x8f91('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8f91('0x1d'),'input_type':_0x8f91('0x23'),'response_type':_0x8f91('0x23'),'rest_data':JSON[_0x8f91('0x1e')]({'session':_0x1b28e0['id'],'module_name':_0x8f91('0x16'),'name_value_list':[{'name':_0x8f91('0x37'),'value':_0x32aaeb!==''?_0x32aaeb:util[_0x8f91('0x28')]('Caller\x20-\x20%s',_0x34b0e1)},{'name':'phone_home','value':_0x34b0e1}]})}})[_0x8f91('0x2a')](function(_0x49faec){logger[_0x8f91('0x9')]('Enduser\x20created.');return BPromise[_0x8f91('0x31')]({'id':_0x49faec['id'],'name':_0x49faec[_0x8f91('0x2b')][_0x8f91('0x37')][_0x8f91('0x2f')],'phone':_0x49faec[_0x8f91('0x2b')]['phone_home'][_0x8f91('0x2f')]});});}});}function request(_0x834c33){logger[_0x8f91('0x38')](_0x8f91('0x39'),JSON[_0x8f91('0x1e')](_0x834c33));return rp(_[_0x8f91('0x3a')](def,_0x834c33));}function getTags(_0x10c5fc,_0x451efe){var _0x1e0e7f=[];if(_0x10c5fc&&_0x10c5fc[_0x8f91('0x19')]>0x0){_0x1e0e7f=_[_0x8f91('0x3b')](_0x10c5fc,_0x451efe);}return _0x1e0e7f;}function getCustomFields(_0x126747,_0x4ed07c){var _0x30ee9b=[];var _0x1acaea={'custom_fields':[]};if(_0x126747[_0x8f91('0x19')]>0x0){_[_0x8f91('0x1a')](_0x126747,function(_0x22c389){if(_0x22c389[_0x8f91('0x3c')]==='string'&&_0x22c389[_0x8f91('0x3d')]&&!_0x22c389[_0x8f91('0x3e')]){_0x1acaea[_0x22c389[_0x8f91('0x3d')]['toLowerCase']()]=_0x22c389[_0x8f91('0x3f')][_0x8f91('0x21')]();}else if(_0x22c389[_0x8f91('0x3c')]==='string'&&_0x22c389[_0x8f91('0x1b')]&&_0x22c389['customField']){_0x1acaea[_0x8f91('0x40')]['push']({'id':_0x22c389[_0x8f91('0x1b')],'value':_0x22c389[_0x8f91('0x3f')][_0x8f91('0x21')]()});}else if(_0x22c389[_0x8f91('0x3c')]===_0x8f91('0x41')&&_0x22c389[_0x8f91('0x1c')]&&_0x22c389[_0x8f91('0x1b')]&&_0x22c389[_0x8f91('0x3e')]){_0x4ed07c[_0x22c389[_0x8f91('0x1c')]]&&_0x1acaea[_0x8f91('0x40')]['push']({'id':_0x22c389[_0x8f91('0x1b')],'value':_0x4ed07c[_0x22c389[_0x8f91('0x1c')]]['toString']()});}else if(_0x22c389[_0x8f91('0x3c')]===_0x8f91('0x42')&&_0x22c389[_0x8f91('0x43')]&&_0x22c389['Variable'][_0x8f91('0xb')]&&_0x22c389['idField']&&_0x22c389[_0x8f91('0x3e')]){_0x4ed07c[_0x22c389[_0x8f91('0x43')][_0x8f91('0xb')][_0x8f91('0x44')]()]&&_0x1acaea[_0x8f91('0x40')][_0x8f91('0x45')]({'id':_0x22c389[_0x8f91('0x1b')],'value':_0x4ed07c[_0x22c389[_0x8f91('0x43')]['name'][_0x8f91('0x44')]()][_0x8f91('0x21')]()});}});}return _0x1acaea;}function getConnection(_0x14b595){return request({'method':'POST','form':{'method':_0x8f91('0x46'),'input_type':'JSON','response_type':_0x8f91('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x14b595['username'],'password':_0x14b595[_0x8f91('0x47')],'encryption':_0x8f91('0x48')},'application':_0x8f91('0x49')})}})['then'](function(_0x19527b){var _0x474fdd=_0x19527b;if(_0x474fdd['id']){def['sessionID']=_0x474fdd['id'];return BPromise[_0x8f91('0x31')](_0x474fdd);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x14b595['id']));}});}function setRelationship(_0x53c14f,_0xf80898,_0x45be51,_0x43771a){return request({'form':{'method':_0x8f91('0x4a'),'input_type':_0x8f91('0x23'),'response_type':_0x8f91('0x23'),'rest_data':JSON[_0x8f91('0x1e')]({'session':_0x53c14f['id'],'module_name':_0x8f91('0x4b'),'module_id':_0x45be51['id'],'link_field_name':_0x43771a,'related_ids':[_0xf80898['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8f91('0x4c')]=function(_0x1f7bc9,_0x170a36,_0x1f55c3,_0x1395d4,_0x2892fd,_0x3b8732){var _0x5ec06b,_0x5a8c64,_0x125302,_0x5279a3;_0x3b8732[_0x8f91('0x4d')]=intUtil[_0x8f91('0x4e')](_0x3b8732[_0x8f91('0x4d')]);_0x3b8732[_0x8f91('0x4f')]=intUtil[_0x8f91('0x4e')](_0x3b8732[_0x8f91('0x4f')]);def[_0x8f91('0x50')]=util[_0x8f91('0x28')](_0x8f91('0x51'),_0x3b8732[_0x8f91('0x4d')]);if(_0x2892fd&&_0x2892fd[_0x8f91('0x52')]){logger[_0x8f91('0x9')]('[QUEUE]',_0x8f91('0x53'));_0x170a36[_0x8f91('0x54')]=util[_0x8f91('0x28')](_0x8f91('0x55'),_0x3b8732[_0x8f91('0x4f')],_0x170a36[_0x8f91('0x56')],md5(_0x170a36[_0x8f91('0x56')]));}else{_0x170a36[_0x8f91('0x54')]='';}return getConnection(_0x3b8732)['then'](function(_0x276944){_0x5279a3=_0x276944;return getUser(_0x3b8732,_0x1395d4[_0x8f91('0xb')],_0x5279a3);})[_0x8f91('0x2a')](function(_0x2a16ee){_0x5ec06b=_0x2a16ee;logger[_0x8f91('0x9')]('The\x20User\x20ID\x20is:',_0x5ec06b['id']);return getEndUser(_0x3b8732,_0x170a36[_0x8f91('0x57')],_0x170a36[_0x8f91('0x58')],_0x5279a3);})[_0x8f91('0x2a')](function(_0x4abfff){_0x5a8c64=_0x4abfff;logger['info'](_0x8f91('0x59'),_0x5a8c64['id']);return getTicket(_0x3b8732,_0x5ec06b,_0x5a8c64,_0x1f55c3,_0x170a36,_0x1f55c3[_0x8f91('0x5a')],_0x5279a3,_0x8f91('0x5b'));})[_0x8f91('0x2a')](function(_0x4a39ff){_0x125302=_0x4a39ff;logger[_0x8f91('0x9')](_0x8f91('0x5c'));logger[_0x8f91('0x9')](_0x8f91('0x5d'),_0x125302['id']);return setRelationship(_0x5279a3,_0x5ec06b,_0x125302,'users');})[_0x8f91('0x2a')](function(){return setRelationship(_0x5279a3,_0x5a8c64,_0x125302,'contacts');})['then'](function(){return getServerInfo(_0x5279a3);})['then'](function(_0x3fc0d3){var _0x99d7c0=parseInt(_0x3fc0d3[_0x8f91('0x5e')][_0x8f91('0x5f')](0x0));var _0xfd7826=util[_0x8f91('0x28')](_0x8f91('0x60'),_0x3b8732['remoteUri'],_0x125302['id']);if(_0x99d7c0>0x6){_0xfd7826=util[_0x8f91('0x28')](_0x8f91('0x61'),_0x3b8732[_0x8f91('0x4d')],_0x125302['id']);}logger['info'](_0x8f91('0x62'),_0x8f91('0x63'));emit(util['format']('user:%s',_0x1395d4[_0x8f91('0xb')]),_0x8f91('0x64'),{'uri':_0xfd7826});})[_0x8f91('0x65')](function(_0x113a2e){logger[_0x8f91('0x66')](_0x8f91('0x62'),JSON[_0x8f91('0x1e')](_0x113a2e));});};exports[_0x8f91('0x67')]=function(_0x1f9a48,_0x349418,_0x4b8883,_0x1e5a1e,_0x18dbce,_0x297498,_0x42e9e8){var _0x3d4136,_0x411ac8,_0x2ceff4,_0x974a82;_0x297498['remoteUri']=intUtil[_0x8f91('0x4e')](_0x297498['remoteUri']);_0x297498[_0x8f91('0x4f')]=intUtil['stripTrailingSlash'](_0x297498[_0x8f91('0x4f')]);def[_0x8f91('0x50')]=util[_0x8f91('0x28')](_0x8f91('0x51'),_0x297498['remoteUri']);if(_0x42e9e8&&_0x42e9e8[_0x8f91('0x68')]&&_0x42e9e8['recordingFormat']!==_0x8f91('0x69')){logger[_0x8f91('0x9')](_0x8f91('0x6a'),_0x8f91('0x53'));_0x349418['recordingURL']=util[_0x8f91('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x297498[_0x8f91('0x4f')],_0x349418[_0x8f91('0x56')],md5(_0x349418[_0x8f91('0x56')]));}return getConnection(_0x297498)[_0x8f91('0x2a')](function(_0x282164){_0x974a82=_0x282164;return getUser(_0x297498,_0x1e5a1e['name'],_0x974a82);})[_0x8f91('0x2a')](function(_0x2d63d9){_0x3d4136=_0x2d63d9;logger[_0x8f91('0x9')](_0x8f91('0x6b'),_0x3d4136['id']);return getEndUser(_0x297498,_0x349418[_0x8f91('0x6c')],_0x349418[_0x8f91('0x6d')],_0x974a82);})['then'](function(_0x5e046d){_0x411ac8=_0x5e046d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x411ac8['id']);return getTicket(_0x297498,_0x3d4136,_0x411ac8,_0x4b8883,_0x349418,_0x4b8883[_0x8f91('0x5a')],_0x974a82,'Outbound');})['then'](function(_0x45a9d0){_0x2ceff4=_0x45a9d0;logger[_0x8f91('0x9')]('Ticket\x20created!');logger[_0x8f91('0x9')](_0x8f91('0x5d'),_0x2ceff4['id']);return setRelationship(_0x974a82,_0x3d4136,_0x2ceff4,_0x8f91('0x6e'));})[_0x8f91('0x2a')](function(){return setRelationship(_0x974a82,_0x411ac8,_0x2ceff4,'contacts');})[_0x8f91('0x2a')](function(){return getServerInfo(_0x974a82);})[_0x8f91('0x2a')](function(_0x389c3a){var _0x3dace6=parseInt(_0x389c3a[_0x8f91('0x5e')][_0x8f91('0x5f')](0x0));var _0x1e84cc=util['format'](_0x8f91('0x60'),_0x297498[_0x8f91('0x4d')],_0x2ceff4['id']);if(_0x3dace6>0x6){_0x1e84cc=util['format'](_0x8f91('0x61'),_0x297498[_0x8f91('0x4d')],_0x2ceff4['id']);}logger[_0x8f91('0x9')]('[OUTBOUND]',_0x8f91('0x63'));emit(util[_0x8f91('0x28')](_0x8f91('0x6f'),_0x1e5a1e[_0x8f91('0xb')]),'trigger:browser:url',{'uri':_0x1e84cc});})[_0x8f91('0x65')](function(_0x5c39b3){logger[_0x8f91('0x66')]('[OUTBOUND]',JSON[_0x8f91('0x1e')](_0x5c39b3));});};exports['unmanaged']=function(_0x2ab279,_0x1d307c,_0x1de36c,_0x206a1,_0x164095,_0x512d22){var _0x1b4e02,_0x40e7c6,_0x45ef08,_0x2738bd;_0x512d22[_0x8f91('0x4d')]=intUtil[_0x8f91('0x4e')](_0x512d22[_0x8f91('0x4d')]);_0x512d22['serverUrl']=intUtil[_0x8f91('0x4e')](_0x512d22[_0x8f91('0x4f')]);def[_0x8f91('0x50')]=util['format']('%s/service/v4_1/rest.php',_0x512d22['remoteUri']);if(_0x164095&&_0x164095['monitor_format']){logger[_0x8f91('0x9')]('['+_0x1d307c['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1d307c[_0x8f91('0x54')]=util[_0x8f91('0x28')](_0x8f91('0x55'),_0x512d22[_0x8f91('0x4f')],_0x1d307c[_0x8f91('0x56')],md5(_0x1d307c[_0x8f91('0x56')]));}else{_0x1d307c[_0x8f91('0x54')]='';}return getConnection(_0x512d22)['then'](function(_0x4ea154){_0x2738bd=_0x4ea154;if(!_[_0x8f91('0x24')](_0x206a1)){return getUser(_0x512d22,_0x206a1[_0x8f91('0xb')],_0x2738bd);}else{return getUser(_0x512d22,null,_0x2738bd);}})[_0x8f91('0x2a')](function(_0x30c6ff){_0x1b4e02=_0x30c6ff;logger[_0x8f91('0x9')](_0x8f91('0x6b'),_0x1b4e02['id']);return getEndUser(_0x512d22,_0x1d307c[_0x8f91('0x57')],_0x1d307c['calleridnum'],_0x2738bd);})[_0x8f91('0x2a')](function(_0x5309eb){_0x40e7c6=_0x5309eb;logger[_0x8f91('0x9')]('The\x20Enduser\x20ID\x20is:',_0x40e7c6['id']);return getTicket(_0x512d22,_0x1b4e02,_0x40e7c6,_0x1de36c,_0x1d307c,_0x1de36c['Fields'],_0x2738bd,'Inbound');})[_0x8f91('0x2a')](function(_0x43549d){_0x45ef08=_0x43549d;logger[_0x8f91('0x9')](_0x8f91('0x5c'));logger[_0x8f91('0x9')](_0x8f91('0x5d'),_0x45ef08['id']);return setRelationship(_0x2738bd,_0x1b4e02,_0x45ef08,'users');})['then'](function(){return setRelationship(_0x2738bd,_0x40e7c6,_0x45ef08,'contacts');})[_0x8f91('0x2a')](function(){return getServerInfo(_0x2738bd);})[_0x8f91('0x65')](function(_0x4e33b3){logger[_0x8f91('0x66')]('['+_0x1d307c['lastevent'][_0x8f91('0x70')]()+']',JSON[_0x8f91('0x1e')](_0x4e33b3));});}; \ 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 e21c668..c6ba385 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 _0x3041=['keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','keyValue'];(function(_0x351a91,_0x1b45f6){var _0x430dd3=function(_0x8b51f0){while(--_0x8b51f0){_0x351a91['push'](_0x351a91['shift']());}};_0x430dd3(++_0x1b45f6);}(_0x3041,0x1f2));var _0x1304=function(_0x5b4daa,_0xc385e4){_0x5b4daa=_0x5b4daa-0x0;var _0x9b569c=_0x3041[_0x5b4daa];return _0x9b569c;};'use strict';var _=require(_0x1304('0x0'));var util=require(_0x1304('0x1'));exports[_0x1304('0x2')]=function(_0x3343b,_0x47bd27,_0x59fc09){var _0x190cc7=[];if(_0x3343b[_0x1304('0x3')]>0x0){var _0x38670c=_['sortBy'](_0x3343b,['id']);for(var _0x153860=0x0;_0x153860<_0x38670c[_0x1304('0x3')];_0x153860++){var _0x26151c=_0x38670c[_0x153860];if(_0x26151c['type']===_0x1304('0x4')){_0x190cc7[_0x1304('0x5')](_0x26151c[_0x1304('0x6')]);}else if(_0x26151c[_0x1304('0x7')]===_0x1304('0x8')&&_0x26151c[_0x1304('0x9')]){_0x47bd27[_0x26151c[_0x1304('0x9')]]&&_0x190cc7[_0x1304('0x5')](_0x47bd27[_0x26151c[_0x1304('0x9')]][_0x1304('0xa')]());}else if(_0x26151c['type']===_0x1304('0xb')&&_0x26151c[_0x1304('0xc')]&&_0x26151c[_0x1304('0xc')][_0x1304('0xd')]){_0x47bd27[_0x26151c[_0x1304('0xc')][_0x1304('0xd')]['toLowerCase']()]&&_0x190cc7[_0x1304('0x5')](_0x47bd27[_0x26151c[_0x1304('0xc')]['name']['toLowerCase']()][_0x1304('0xa')]());}else if(_0x26151c[_0x1304('0x7')]===_0x1304('0xe')){if(_0x26151c[_0x1304('0xf')]===_0x1304('0x4')&&_0x26151c[_0x1304('0x10')]){_0x190cc7[_0x1304('0x5')](util[_0x1304('0x11')](_0x1304('0x12'),_0x26151c[_0x1304('0x10')],_0x26151c[_0x1304('0x13')]));}else if(_0x26151c[_0x1304('0xf')]===_0x1304('0x8')&&_0x26151c[_0x1304('0x9')]&&_0x26151c[_0x1304('0x10')]){_0x47bd27[_0x26151c[_0x1304('0x9')]]&&_0x190cc7['push'](util[_0x1304('0x11')](_0x1304('0x12'),_0x26151c[_0x1304('0x10')],_0x47bd27[_0x26151c[_0x1304('0x9')]]));}else if(_0x26151c['keyType']===_0x1304('0xb')&&_0x26151c[_0x1304('0xc')]&&_0x26151c[_0x1304('0xc')][_0x1304('0xd')]&&_0x26151c['key']){_0x47bd27[_0x26151c[_0x1304('0xc')][_0x1304('0xd')]['toLowerCase']()]&&_0x190cc7['push'](util[_0x1304('0x11')](_0x1304('0x12'),_0x26151c['key'],_0x47bd27[_0x26151c[_0x1304('0xc')][_0x1304('0xd')][_0x1304('0x14')]()]));}}}}return _0x190cc7[_0x1304('0x15')](_0x59fc09);};exports['stripTrailingSlash']=function(_0x379bc6){var _0x73ea94=_0x379bc6[_0x1304('0x16')](-0x1);if(_0x73ea94==='/'){_0x379bc6=_0x379bc6[_0x1304('0x17')](0x0,_0x379bc6['lastIndexOf'](_0x73ea94));}return _0x379bc6;};exports[_0x1304('0x18')]=function(_0x491439){if(!_[_0x1304('0x19')](_0x491439)&&_0x491439!==''){var _0x47d122=/^(([^<>()\[\]\\.,;:\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 _0x47d122[_0x1304('0x1a')](String(_0x491439)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x90e7=['Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variableName','customVariable'];(function(_0x399e60,_0x41875d){var _0x6948c0=function(_0x39e820){while(--_0x39e820){_0x399e60['push'](_0x399e60['shift']());}};_0x6948c0(++_0x41875d);}(_0x90e7,0x1b5));var _0x790e=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0x90e7[_0x335d2d];return _0x379073;};'use strict';var _=require(_0x790e('0x0'));var util=require(_0x790e('0x1'));exports[_0x790e('0x2')]=function(_0x3a928a,_0x431a95,_0x2f35d3){var _0xca78af=[];if(_0x3a928a[_0x790e('0x3')]>0x0){var _0x512cc7=_[_0x790e('0x4')](_0x3a928a,['id']);for(var _0x236a07=0x0;_0x236a07<_0x512cc7['length'];_0x236a07++){var _0x514f57=_0x512cc7[_0x236a07];if(_0x514f57['type']===_0x790e('0x5')){_0xca78af[_0x790e('0x6')](_0x514f57[_0x790e('0x7')]);}else if(_0x514f57[_0x790e('0x8')]==='variable'&&_0x514f57['variableName']){_0x431a95[_0x514f57[_0x790e('0x9')]]&&_0xca78af['push'](_0x431a95[_0x514f57[_0x790e('0x9')]]['toString']());}else if(_0x514f57['type']===_0x790e('0xa')&&_0x514f57['Variable']&&_0x514f57[_0x790e('0xb')][_0x790e('0xc')]){_0x431a95[_0x514f57['Variable']['name'][_0x790e('0xd')]()]&&_0xca78af[_0x790e('0x6')](_0x431a95[_0x514f57[_0x790e('0xb')][_0x790e('0xc')][_0x790e('0xd')]()]['toString']());}else if(_0x514f57[_0x790e('0x8')]===_0x790e('0xe')){if(_0x514f57[_0x790e('0xf')]===_0x790e('0x5')&&_0x514f57[_0x790e('0x10')]){_0xca78af[_0x790e('0x6')](util[_0x790e('0x11')](_0x790e('0x12'),_0x514f57[_0x790e('0x10')],_0x514f57['keyContent']));}else if(_0x514f57['keyType']===_0x790e('0x13')&&_0x514f57['variableName']&&_0x514f57['key']){_0x431a95[_0x514f57[_0x790e('0x9')]]&&_0xca78af[_0x790e('0x6')](util[_0x790e('0x11')]('%s:\x20%s',_0x514f57[_0x790e('0x10')],_0x431a95[_0x514f57[_0x790e('0x9')]]));}else if(_0x514f57[_0x790e('0xf')]==='customVariable'&&_0x514f57[_0x790e('0xb')]&&_0x514f57[_0x790e('0xb')]['name']&&_0x514f57[_0x790e('0x10')]){_0x431a95[_0x514f57[_0x790e('0xb')][_0x790e('0xc')][_0x790e('0xd')]()]&&_0xca78af[_0x790e('0x6')](util[_0x790e('0x11')](_0x790e('0x12'),_0x514f57[_0x790e('0x10')],_0x431a95[_0x514f57['Variable'][_0x790e('0xc')][_0x790e('0xd')]()]));}}}}return _0xca78af[_0x790e('0x14')](_0x2f35d3);};exports[_0x790e('0x15')]=function(_0x154c19){var _0x50a98d=_0x154c19[_0x790e('0x16')](-0x1);if(_0x50a98d==='/'){_0x154c19=_0x154c19[_0x790e('0x17')](0x0,_0x154c19[_0x790e('0x18')](_0x50a98d));}return _0x154c19;};exports[_0x790e('0x19')]=function(_0x331f65){if(!_[_0x790e('0x1a')](_0x331f65)&&_0x331f65!==''){var _0x5252b5=/^(([^<>()\[\]\\.,;:\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 _0x5252b5[_0x790e('0x1b')](String(_0x331f65)[_0x790e('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 0b8fd84..5f0e91f 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0xe706,0xa3));var _0x6e70=function(_0x255227,_0x2063b0){_0x255227=_0x255227-0x0;var _0x43a3e4=_0xe706[_0x255227];return _0x43a3e4;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x171b2f,_0x337677){var _0x4678d8=function(_0x160fce){while(--_0x160fce){_0x171b2f['push'](_0x171b2f['shift']());}};_0x4678d8(++_0x337677);}(_0xe706,0xa3));var _0x6e70=function(_0x22ada8,_0x23a7ea){_0x22ada8=_0x22ada8-0x0;var _0x506e36=_0xe706[_0x22ada8];return _0x506e36;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 0307ab5..3068b40 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 _0x1cf7=['stringify','map','forEach','includes','string','nameField','content','picklist','idField','customField','push','type','custom_fields','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug'];(function(_0xad3764,_0x9b3ad1){var _0x38b603=function(_0x56fb4d){while(--_0x56fb4d){_0xad3764['push'](_0xad3764['shift']());}};_0x38b603(++_0x9b3ad1);}(_0x1cf7,0xa3));var _0x71cf=function(_0x38cf05,_0x4047ab){_0x38cf05=_0x38cf05-0x0;var _0x35205f=_0x1cf7[_0x38cf05];return _0x35205f;};'use strict';var _=require(_0x71cf('0x0'));var rp=require(_0x71cf('0x1'));var md5=require('md5');var util=require(_0x71cf('0x2'));var Redis=require(_0x71cf('0x3'));var intUtil=require(_0x71cf('0x4'));var config=require('../../../../config/environment');var logger=require(_0x71cf('0x5'))(_0x71cf('0x6'));config[_0x71cf('0x7')]=_[_0x71cf('0x8')](config[_0x71cf('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x71cf('0x9'))(new Redis(config[_0x71cf('0x7')]));function emit(_0x3e5ba0,_0x8ed75a,_0x5961c8){io['to'](_0x3e5ba0)[_0x71cf('0xa')](_0x8ed75a,_0x5961c8);}var headers={'Content-Type':_0x71cf('0xb'),'Accept':'application/json'};function getTicket(_0x2a26db,_0x260dae,_0xd22d09,_0xe84646,_0x1b84c6){logger[_0x71cf('0xc')](_0x71cf('0xd'));return request({'uri':util[_0x71cf('0xe')](_0x71cf('0xf'),_0x2a26db['remoteUri']),'method':_0x71cf('0x10'),'body':{'ticket':_['merge']({'requester_id':_0xd22d09['id'],'submitter_id':_0x260dae?_0x260dae['id']:undefined,'assignee_id':_0x260dae?_0x260dae['id']:undefined,'tags':getTags(_0xe84646[_0x71cf('0x11')],_0x71cf('0x12')),'subject':intUtil['getString'](_0xe84646[_0x71cf('0x13')],_0x1b84c6,'\x20'),'description':intUtil[_0x71cf('0x14')](_0xe84646[_0x71cf('0x15')],_0x1b84c6,'\x0a'),'comment':{'public':![],'body':intUtil[_0x71cf('0x14')](_0xe84646['Descriptions'],_0x1b84c6,'\x0a')}},getCustomFields(_0xe84646[_0x71cf('0x16')],_0x1b84c6))}})[_0x71cf('0x17')](function(_0x18e9bd){logger[_0x71cf('0xc')](_0x71cf('0x18'));return _0x18e9bd[_0x71cf('0x19')];});}function getUser(_0x21fddb,_0x5ada85){if(intUtil[_0x71cf('0x1a')](_0x5ada85)){logger[_0x71cf('0xc')]('Getting\x20agent\x20with\x20email',_0x5ada85);return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x1b'),_0x21fddb[_0x71cf('0x1c')]),'qs':{'query':util[_0x71cf('0xe')](_0x71cf('0x1d'),_0x5ada85)}})['then'](function(_0x494d0d){if(_0x494d0d[_0x71cf('0x1e')]){logger['info']('Agent\x20found!');return _[_0x71cf('0x1f')](_0x494d0d[_0x71cf('0x20')],{'email':_0x5ada85,'role':_0x71cf('0x21')});}else{logger['info'](_0x71cf('0x22'));return request({'uri':util[_0x71cf('0xe')]('%s/users/me.json',_0x21fddb[_0x71cf('0x1c')])})[_0x71cf('0x17')](function(_0x1d0570){logger[_0x71cf('0xc')]('Admin\x20account\x20selected.');return _0x1d0570[_0x71cf('0x23')];});}});}else{logger[_0x71cf('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x24'),_0x21fddb[_0x71cf('0x1c')])})[_0x71cf('0x17')](function(_0x3574e7){logger['info'](_0x71cf('0x25'));return _0x3574e7[_0x71cf('0x23')];});}}function getEndUser(_0x20caa8,_0x5b0758,_0x30ef7b){logger[_0x71cf('0xc')]('Searching\x20enduser\x20with\x20phone',_0x30ef7b);return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x1b'),_0x20caa8[_0x71cf('0x1c')]),'qs':{'query':util[_0x71cf('0xe')](_0x71cf('0x26'),_0x30ef7b)}})[_0x71cf('0x17')](function(_0x3a31dc){var _0x4a46e4;if(_0x3a31dc['results'][_0x71cf('0x27')]){_0x3a31dc['results']=_[_0x71cf('0x28')](_0x3a31dc[_0x71cf('0x20')],{'suspended':![],'role':_0x71cf('0x29')});if(_0x3a31dc[_0x71cf('0x20')][_0x71cf('0x27')]){_0x4a46e4=_[_0x71cf('0x2a')](_0x3a31dc[_0x71cf('0x20')]);}}if(_0x4a46e4){logger[_0x71cf('0xc')](_0x71cf('0x2b'));return _0x4a46e4;}else{logger['info'](_0x71cf('0x2c'));return request({'uri':util[_0x71cf('0xe')](_0x71cf('0x2d'),_0x20caa8['remoteUri']),'method':_0x71cf('0x10'),'body':{'user':{'role':_0x71cf('0x29'),'name':util[_0x71cf('0xe')](_0x71cf('0x2e'),_0x5b0758||_0x30ef7b),'phone':_0x30ef7b}}})[_0x71cf('0x17')](function(_0x3fca00){logger[_0x71cf('0xc')](_0x71cf('0x2f'));return _0x3fca00[_0x71cf('0x23')];});}});}function getAuth(_0x26782a){var _0x52131a;if(_0x26782a[_0x71cf('0x30')]==='password'){_0x52131a=util[_0x71cf('0xe')](_0x71cf('0x31'),_0x26782a[_0x71cf('0x32')],_0x26782a[_0x71cf('0x33')]);}else if(_0x26782a['authType']==='token'){_0x52131a=util[_0x71cf('0xe')]('%s/token:%s',_0x26782a['username'],_0x26782a[_0x71cf('0x34')]);}return util[_0x71cf('0xe')](_0x71cf('0x35'),new Buffer(_0x52131a)[_0x71cf('0x36')](_0x71cf('0x37')));}function request(_0x2642bc){logger[_0x71cf('0x38')]('[HTTP]',JSON[_0x71cf('0x39')](_0x2642bc));return rp(_[_0x71cf('0x8')](_0x2642bc,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3e1111,_0x15f198){var _0x825a64=[];if(_0x3e1111&&_0x3e1111['length']>0x0){_0x825a64=_[_0x71cf('0x3a')](_0x3e1111,_0x15f198);}return _0x825a64;}function getCustomFields(_0x5c53cf,_0x5d9502){var _0x108338=[];var _0x32bcaf={'custom_fields':[]};if(_0x5c53cf['length']>0x0){_[_0x71cf('0x3b')](_0x5c53cf,function(_0x92dc2d){if(_[_0x71cf('0x3c')]([_0x71cf('0x3d'),'picklist'],_0x92dc2d['type'])&&_0x92dc2d['nameField']&&!_0x92dc2d['customField']){_0x32bcaf[_0x92dc2d[_0x71cf('0x3e')]['toLowerCase']()]=_0x92dc2d[_0x71cf('0x3f')][_0x71cf('0x36')]();}else if(_[_0x71cf('0x3c')]([_0x71cf('0x3d'),_0x71cf('0x40')],_0x92dc2d['type'])&&_0x92dc2d[_0x71cf('0x41')]&&_0x92dc2d[_0x71cf('0x42')]){_0x32bcaf['custom_fields'][_0x71cf('0x43')]({'id':_0x92dc2d[_0x71cf('0x41')],'value':_0x92dc2d['content'][_0x71cf('0x36')]()});}else if(_0x92dc2d[_0x71cf('0x44')]==='variable'&&_0x92dc2d['variableName']&&_0x92dc2d[_0x71cf('0x41')]&&_0x92dc2d[_0x71cf('0x42')]){_0x5d9502[_0x92dc2d['variableName']]&&_0x32bcaf[_0x71cf('0x45')][_0x71cf('0x43')]({'id':_0x92dc2d[_0x71cf('0x41')],'value':_0x5d9502[_0x92dc2d[_0x71cf('0x46')]]['toString']()});}else if(_0x92dc2d['type']===_0x71cf('0x47')&&_0x92dc2d[_0x71cf('0x48')]&&_0x92dc2d[_0x71cf('0x48')][_0x71cf('0x12')]&&_0x92dc2d['idField']&&_0x92dc2d[_0x71cf('0x42')]){_0x5d9502[_0x92dc2d[_0x71cf('0x48')]['name']['toLowerCase']()]&&_0x32bcaf[_0x71cf('0x45')]['push']({'id':_0x92dc2d[_0x71cf('0x41')],'value':_0x5d9502[_0x92dc2d[_0x71cf('0x48')][_0x71cf('0x12')]['toLowerCase']()]['toString']()});}});}return _0x32bcaf;}exports[_0x71cf('0x49')]=function(_0x5b9a4c,_0x223308,_0x1eb187,_0x45665f,_0x6c7d6c,_0x2ee6de){var _0x586933,_0x33176c;_0x2ee6de[_0x71cf('0x1c')]=intUtil[_0x71cf('0x4a')](_0x2ee6de[_0x71cf('0x1c')]);_0x2ee6de[_0x71cf('0x4b')]=intUtil['stripTrailingSlash'](_0x2ee6de[_0x71cf('0x4b')]);if(_0x6c7d6c&&_0x6c7d6c[_0x71cf('0x4c')]){logger[_0x71cf('0xc')](_0x71cf('0x4d'),'Recording\x20is\x20enabled!');_0x223308[_0x71cf('0x4e')]=util[_0x71cf('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ee6de[_0x71cf('0x4b')],_0x223308[_0x71cf('0x4f')],md5(_0x223308[_0x71cf('0x4f')]));}else{_0x223308[_0x71cf('0x4e')]='';}headers[_0x71cf('0x50')]=getAuth(_0x2ee6de);return getUser(_0x2ee6de,_0x45665f[_0x71cf('0x51')])[_0x71cf('0x17')](function(_0x27af77){_0x586933=_0x27af77;logger[_0x71cf('0xc')](_0x71cf('0x52'),_0x586933['id']);return getEndUser(_0x2ee6de,_0x223308['calleridname'],_0x223308[_0x71cf('0x53')]);})[_0x71cf('0x17')](function(_0x141fe){_0x33176c=_0x141fe;logger['info'](_0x71cf('0x54'),_0x33176c['id']);return getTicket(_0x2ee6de,_0x586933,_0x33176c,_0x1eb187,_0x223308);})['then'](function(_0x3b619){if(_0x3b619){logger[_0x71cf('0xc')](_0x71cf('0x55'),_0x3b619['id']);switch(_0x2ee6de[_0x71cf('0x44')]){case _0x71cf('0x56'):logger[_0x71cf('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ee6de[_0x71cf('0x1c')],_0x586933['id'],_0x3b619['id']),'method':_0x71cf('0x10')});case _0x71cf('0x57'):logger['info'](_0x71cf('0x4d'),_0x71cf('0x58'));emit(util[_0x71cf('0xe')](_0x71cf('0x59'),_0x45665f['name']),_0x71cf('0x5a'),{'uri':util[_0x71cf('0xe')]('%s/agent/tickets/%s',_0x2ee6de[_0x71cf('0x1c')][_0x71cf('0x5b')]('/api/v2',''),_0x3b619['id'])});break;default:logger[_0x71cf('0x5c')](_0x71cf('0x4d'),_0x71cf('0x5d'));}}})[_0x71cf('0x5e')](function(_0x45feac){logger['error'](_0x71cf('0x5f'),util[_0x71cf('0x60')](_0x45feac,{'showHidden':!![],'depth':null}));});};exports[_0x71cf('0x61')]=function(_0x46bce3,_0x36a462,_0x2447e8,_0x4f659e,_0x27ae89,_0x14de42,_0x5c8f62){var _0x11ab33,_0xce1513;_0x14de42[_0x71cf('0x1c')]=intUtil[_0x71cf('0x4a')](_0x14de42[_0x71cf('0x1c')]);_0x14de42['serverUrl']=intUtil[_0x71cf('0x4a')](_0x14de42['serverUrl']);if(_0x5c8f62&&_0x5c8f62[_0x71cf('0x62')]&&_0x5c8f62[_0x71cf('0x62')]!==_0x71cf('0x63')){logger[_0x71cf('0xc')](_0x71cf('0x64'),'Recording\x20is\x20enabled!');_0x36a462[_0x71cf('0x4e')]=util[_0x71cf('0xe')](_0x71cf('0x65'),_0x14de42[_0x71cf('0x4b')],_0x36a462['uniqueid'],md5(_0x36a462[_0x71cf('0x4f')]));}headers[_0x71cf('0x50')]=getAuth(_0x14de42);return getUser(_0x14de42,_0x4f659e[_0x71cf('0x51')])[_0x71cf('0x17')](function(_0x22839a){_0x11ab33=_0x22839a;logger[_0x71cf('0xc')](_0x71cf('0x52'),_0x11ab33['id']);return getEndUser(_0x14de42,_0x36a462[_0x71cf('0x66')],_0x36a462['destcalleridnum']);})['then'](function(_0xcd6540){_0xce1513=_0xcd6540;logger[_0x71cf('0xc')](_0x71cf('0x54'),_0xce1513['id']);return getTicket(_0x14de42,_0x11ab33,_0xce1513,_0x2447e8,_0x36a462);})[_0x71cf('0x17')](function(_0x1f2579){if(_0x1f2579){logger[_0x71cf('0xc')](_0x71cf('0x55'),_0x1f2579['id']);switch(_0x14de42[_0x71cf('0x44')]){case'integrationTab':logger['info'](_0x71cf('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x71cf('0x67'),_0x14de42['remoteUri'],_0x11ab33['id'],_0x1f2579['id']),'method':_0x71cf('0x10')});case _0x71cf('0x57'):logger[_0x71cf('0xc')](_0x71cf('0x64'),_0x71cf('0x58'));emit(util[_0x71cf('0xe')](_0x71cf('0x59'),_0x4f659e[_0x71cf('0x12')]),_0x71cf('0x5a'),{'uri':util[_0x71cf('0xe')](_0x71cf('0x68'),_0x14de42[_0x71cf('0x1c')]['replace']('/api/v2',''),_0x1f2579['id'])});break;default:logger['error'](_0x71cf('0x64'),_0x71cf('0x5d'));}}})[_0x71cf('0x5e')](function(_0x12aeb7){logger[_0x71cf('0x5c')](_0x71cf('0x69'),util[_0x71cf('0x60')](_0x12aeb7,{'showHidden':!![],'depth':null}));});};exports[_0x71cf('0x6a')]=function(_0x54184b,_0xcb9fcf,_0x53633a,_0x559186,_0x3fec37,_0x557e5d){var _0x5ac534,_0x3a5292;_0x557e5d[_0x71cf('0x1c')]=intUtil[_0x71cf('0x4a')](_0x557e5d[_0x71cf('0x1c')]);_0x557e5d[_0x71cf('0x4b')]=intUtil[_0x71cf('0x4a')](_0x557e5d[_0x71cf('0x4b')]);if(_0x3fec37&&_0x3fec37[_0x71cf('0x4c')]){logger[_0x71cf('0xc')]('['+_0xcb9fcf[_0x71cf('0x6b')][_0x71cf('0x6c')]()+']','Recording\x20is\x20enabled!');_0xcb9fcf[_0x71cf('0x4e')]=util['format'](_0x71cf('0x65'),_0x557e5d[_0x71cf('0x4b')],_0xcb9fcf['uniqueid'],md5(_0xcb9fcf['uniqueid']));}else{_0xcb9fcf[_0x71cf('0x4e')]='';}headers[_0x71cf('0x50')]=getAuth(_0x557e5d);return getUser(_0x557e5d)[_0x71cf('0x17')](function(_0x2455e3){_0x5ac534=_0x2455e3;logger[_0x71cf('0xc')]('The\x20User\x20ID\x20is:',_0x5ac534['id']);return getEndUser(_0x557e5d,_0xcb9fcf['calleridname'],_0xcb9fcf[_0x71cf('0x53')]);})[_0x71cf('0x17')](function(_0x41a1bb){_0x3a5292=_0x41a1bb;logger['info'](_0x71cf('0x54'),_0x3a5292['id']);return getTicket(_0x557e5d,_0x5ac534,_0x3a5292,_0x53633a,_0xcb9fcf);})[_0x71cf('0x17')](function(_0x1eac3e){if(_0x1eac3e){logger[_0x71cf('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1eac3e['id']);}})[_0x71cf('0x5e')](function(_0x11ac18){logger[_0x71cf('0x5c')]('['+_0xcb9fcf['lastevent'][_0x71cf('0x6c')]()+']'+_0x71cf('0x6d'),util['inspect'](_0x11ac18,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xff65=['Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','format','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','trigger:browser:url','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/logger','redis','defaults','application/json','Creating\x20new\x20ticket...','POST','merge','Tags','name','getString','Descriptions','then','info','Ticket\x20created!','ticket','validateEmail'];(function(_0x3d309c,_0x242f4c){var _0x241187=function(_0x594990){while(--_0x594990){_0x3d309c['push'](_0x3d309c['shift']());}};_0x241187(++_0x242f4c);}(_0xff65,0x135));var _0x5ff6=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xff65[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x5ff6('0x0'));var rp=require(_0x5ff6('0x1'));var md5=require(_0x5ff6('0x2'));var util=require(_0x5ff6('0x3'));var Redis=require('ioredis');var intUtil=require(_0x5ff6('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5ff6('0x5'))('zendesk');config[_0x5ff6('0x6')]=_[_0x5ff6('0x7')](config[_0x5ff6('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ff6('0x6')]));function emit(_0x8da0e4,_0x282bfe,_0x338cb3){io['to'](_0x8da0e4)['emit'](_0x282bfe,_0x338cb3);}var headers={'Content-Type':_0x5ff6('0x8'),'Accept':_0x5ff6('0x8')};function getTicket(_0x2f9c07,_0xfb7e38,_0x23bfce,_0x3b0279,_0x31f0bb){logger['info'](_0x5ff6('0x9'));return request({'uri':util['format']('%s/tickets.json',_0x2f9c07['remoteUri']),'method':_0x5ff6('0xa'),'body':{'ticket':_[_0x5ff6('0xb')]({'requester_id':_0x23bfce['id'],'submitter_id':_0xfb7e38?_0xfb7e38['id']:undefined,'assignee_id':_0xfb7e38?_0xfb7e38['id']:undefined,'tags':getTags(_0x3b0279[_0x5ff6('0xc')],_0x5ff6('0xd')),'subject':intUtil[_0x5ff6('0xe')](_0x3b0279['Subjects'],_0x31f0bb,'\x20'),'description':intUtil[_0x5ff6('0xe')](_0x3b0279[_0x5ff6('0xf')],_0x31f0bb,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3b0279['Descriptions'],_0x31f0bb,'\x0a')}},getCustomFields(_0x3b0279['Fields'],_0x31f0bb))}})[_0x5ff6('0x10')](function(_0x2dac43){logger[_0x5ff6('0x11')](_0x5ff6('0x12'));return _0x2dac43[_0x5ff6('0x13')];});}function getUser(_0x6be79,_0x37f5e0){if(intUtil[_0x5ff6('0x14')](_0x37f5e0)){logger[_0x5ff6('0x11')](_0x5ff6('0x15'),_0x37f5e0);return request({'uri':util['format'](_0x5ff6('0x16'),_0x6be79[_0x5ff6('0x17')]),'qs':{'query':util[_0x5ff6('0x18')](_0x5ff6('0x19'),_0x37f5e0)}})[_0x5ff6('0x10')](function(_0x1f7edd){if(_0x1f7edd['count']){logger[_0x5ff6('0x11')](_0x5ff6('0x1a'));return _[_0x5ff6('0x1b')](_0x1f7edd[_0x5ff6('0x1c')],{'email':_0x37f5e0,'role':_0x5ff6('0x1d')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5ff6('0x18')](_0x5ff6('0x1e'),_0x6be79[_0x5ff6('0x17')])})[_0x5ff6('0x10')](function(_0x3d665c){logger[_0x5ff6('0x11')](_0x5ff6('0x1f'));return _0x3d665c[_0x5ff6('0x20')];});}});}else{logger['info'](_0x5ff6('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x6be79[_0x5ff6('0x17')])})['then'](function(_0x4f9cf4){logger['info'](_0x5ff6('0x1f'));return _0x4f9cf4['user'];});}}function getEndUser(_0x5ab3dd,_0x5bee99,_0x126f0a){logger[_0x5ff6('0x11')](_0x5ff6('0x22'),_0x126f0a);return request({'uri':util[_0x5ff6('0x18')](_0x5ff6('0x16'),_0x5ab3dd['remoteUri']),'qs':{'query':util[_0x5ff6('0x18')]('type:user\x20role:end-user\x20phone:%s',_0x126f0a)}})['then'](function(_0x22943c){var _0x161906;if(_0x22943c['results']['length']){_0x22943c['results']=_[_0x5ff6('0x23')](_0x22943c['results'],{'suspended':![],'role':_0x5ff6('0x24')});if(_0x22943c[_0x5ff6('0x1c')]['length']){_0x161906=_[_0x5ff6('0x25')](_0x22943c[_0x5ff6('0x1c')]);}}if(_0x161906){logger[_0x5ff6('0x11')](_0x5ff6('0x26'));return _0x161906;}else{logger[_0x5ff6('0x11')](_0x5ff6('0x27'));return request({'uri':util[_0x5ff6('0x18')]('%s/users.json',_0x5ab3dd[_0x5ff6('0x17')]),'method':_0x5ff6('0xa'),'body':{'user':{'role':_0x5ff6('0x24'),'name':util[_0x5ff6('0x18')](_0x5ff6('0x28'),_0x5bee99||_0x126f0a),'phone':_0x126f0a}}})[_0x5ff6('0x10')](function(_0x243cf4){logger['info'](_0x5ff6('0x29'));return _0x243cf4[_0x5ff6('0x20')];});}});}function getAuth(_0x3d69f9){var _0x224c0a;if(_0x3d69f9[_0x5ff6('0x2a')]===_0x5ff6('0x2b')){_0x224c0a=util[_0x5ff6('0x18')](_0x5ff6('0x2c'),_0x3d69f9['username'],_0x3d69f9[_0x5ff6('0x2b')]);}else if(_0x3d69f9['authType']===_0x5ff6('0x2d')){_0x224c0a=util['format'](_0x5ff6('0x2e'),_0x3d69f9[_0x5ff6('0x2f')],_0x3d69f9[_0x5ff6('0x2d')]);}return util[_0x5ff6('0x18')](_0x5ff6('0x30'),new Buffer(_0x224c0a)[_0x5ff6('0x31')](_0x5ff6('0x32')));}function request(_0x40e4b2){logger[_0x5ff6('0x33')](_0x5ff6('0x34'),JSON[_0x5ff6('0x35')](_0x40e4b2));return rp(_[_0x5ff6('0x7')](_0x40e4b2,{'method':_0x5ff6('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x21af5f,_0x316329){var _0xdc148e=[];if(_0x21af5f&&_0x21af5f[_0x5ff6('0x37')]>0x0){_0xdc148e=_[_0x5ff6('0x38')](_0x21af5f,_0x316329);}return _0xdc148e;}function getCustomFields(_0x1a8366,_0x64f0c5){var _0x24581f=[];var _0x528cad={'custom_fields':[]};if(_0x1a8366[_0x5ff6('0x37')]>0x0){_[_0x5ff6('0x39')](_0x1a8366,function(_0x7d4ad9){if(_[_0x5ff6('0x3a')]([_0x5ff6('0x3b'),_0x5ff6('0x3c')],_0x7d4ad9[_0x5ff6('0x3d')])&&_0x7d4ad9[_0x5ff6('0x3e')]&&!_0x7d4ad9[_0x5ff6('0x3f')]){_0x528cad[_0x7d4ad9[_0x5ff6('0x3e')][_0x5ff6('0x40')]()]=_0x7d4ad9[_0x5ff6('0x41')]['toString']();}else if(_['includes'](['string',_0x5ff6('0x3c')],_0x7d4ad9[_0x5ff6('0x3d')])&&_0x7d4ad9[_0x5ff6('0x42')]&&_0x7d4ad9['customField']){_0x528cad[_0x5ff6('0x43')][_0x5ff6('0x44')]({'id':_0x7d4ad9[_0x5ff6('0x42')],'value':_0x7d4ad9[_0x5ff6('0x41')][_0x5ff6('0x31')]()});}else if(_0x7d4ad9[_0x5ff6('0x3d')]===_0x5ff6('0x45')&&_0x7d4ad9['variableName']&&_0x7d4ad9[_0x5ff6('0x42')]&&_0x7d4ad9[_0x5ff6('0x3f')]){_0x64f0c5[_0x7d4ad9[_0x5ff6('0x46')]]&&_0x528cad['custom_fields'][_0x5ff6('0x44')]({'id':_0x7d4ad9[_0x5ff6('0x42')],'value':_0x64f0c5[_0x7d4ad9[_0x5ff6('0x46')]][_0x5ff6('0x31')]()});}else if(_0x7d4ad9[_0x5ff6('0x3d')]===_0x5ff6('0x47')&&_0x7d4ad9[_0x5ff6('0x48')]&&_0x7d4ad9[_0x5ff6('0x48')][_0x5ff6('0xd')]&&_0x7d4ad9[_0x5ff6('0x42')]&&_0x7d4ad9[_0x5ff6('0x3f')]){_0x64f0c5[_0x7d4ad9['Variable'][_0x5ff6('0xd')][_0x5ff6('0x40')]()]&&_0x528cad[_0x5ff6('0x43')][_0x5ff6('0x44')]({'id':_0x7d4ad9[_0x5ff6('0x42')],'value':_0x64f0c5[_0x7d4ad9[_0x5ff6('0x48')][_0x5ff6('0xd')][_0x5ff6('0x40')]()][_0x5ff6('0x31')]()});}});}return _0x528cad;}exports[_0x5ff6('0x49')]=function(_0x2b2f59,_0xf1da42,_0x2c9e8c,_0x5886e5,_0x1b26fb,_0x45f56d){var _0x181296,_0x4612d9;_0x45f56d[_0x5ff6('0x17')]=intUtil['stripTrailingSlash'](_0x45f56d[_0x5ff6('0x17')]);_0x45f56d['serverUrl']=intUtil[_0x5ff6('0x4a')](_0x45f56d['serverUrl']);if(_0x1b26fb&&_0x1b26fb[_0x5ff6('0x4b')]){logger[_0x5ff6('0x11')](_0x5ff6('0x4c'),_0x5ff6('0x4d'));_0xf1da42[_0x5ff6('0x4e')]=util[_0x5ff6('0x18')](_0x5ff6('0x4f'),_0x45f56d[_0x5ff6('0x50')],_0xf1da42['uniqueid'],md5(_0xf1da42[_0x5ff6('0x51')]));}else{_0xf1da42[_0x5ff6('0x4e')]='';}headers['Authorization']=getAuth(_0x45f56d);return getUser(_0x45f56d,_0x5886e5[_0x5ff6('0x52')])[_0x5ff6('0x10')](function(_0xdf8ea1){_0x181296=_0xdf8ea1;logger[_0x5ff6('0x11')](_0x5ff6('0x53'),_0x181296['id']);return getEndUser(_0x45f56d,_0xf1da42[_0x5ff6('0x54')],_0xf1da42[_0x5ff6('0x55')]);})[_0x5ff6('0x10')](function(_0x5e585e){_0x4612d9=_0x5e585e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4612d9['id']);return getTicket(_0x45f56d,_0x181296,_0x4612d9,_0x2c9e8c,_0xf1da42);})['then'](function(_0x349804){if(_0x349804){logger[_0x5ff6('0x11')](_0x5ff6('0x56'),_0x349804['id']);switch(_0x45f56d[_0x5ff6('0x3d')]){case _0x5ff6('0x57'):logger[_0x5ff6('0x11')](_0x5ff6('0x4c'),_0x5ff6('0x58'));return request({'uri':util['format'](_0x5ff6('0x59'),_0x45f56d[_0x5ff6('0x17')],_0x181296['id'],_0x349804['id']),'method':_0x5ff6('0xa')});case'newTab':logger[_0x5ff6('0x11')](_0x5ff6('0x4c'),_0x5ff6('0x5a'));emit(util['format'](_0x5ff6('0x5b'),_0x5886e5[_0x5ff6('0xd')]),'trigger:browser:url',{'uri':util[_0x5ff6('0x18')]('%s/agent/tickets/%s',_0x45f56d['remoteUri'][_0x5ff6('0x5c')](_0x5ff6('0x5d'),''),_0x349804['id'])});break;default:logger[_0x5ff6('0x5e')]('[QUEUE]',_0x5ff6('0x5f'));}}})[_0x5ff6('0x60')](function(_0x343f1e){logger[_0x5ff6('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5ff6('0x61')](_0x343f1e,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x242b30,_0x73c8ae,_0x282fd7,_0x10f183,_0x2c3112,_0x3936fe,_0xec2cc6){var _0x5a5a6b,_0x5dce0b;_0x3936fe['remoteUri']=intUtil[_0x5ff6('0x4a')](_0x3936fe['remoteUri']);_0x3936fe['serverUrl']=intUtil[_0x5ff6('0x4a')](_0x3936fe[_0x5ff6('0x50')]);if(_0xec2cc6&&_0xec2cc6['recordingFormat']&&_0xec2cc6[_0x5ff6('0x62')]!==_0x5ff6('0x63')){logger['info'](_0x5ff6('0x64'),_0x5ff6('0x4d'));_0x73c8ae['recordingURL']=util[_0x5ff6('0x18')](_0x5ff6('0x4f'),_0x3936fe[_0x5ff6('0x50')],_0x73c8ae[_0x5ff6('0x51')],md5(_0x73c8ae[_0x5ff6('0x51')]));}headers[_0x5ff6('0x65')]=getAuth(_0x3936fe);return getUser(_0x3936fe,_0x10f183[_0x5ff6('0x52')])[_0x5ff6('0x10')](function(_0x3ff044){_0x5a5a6b=_0x3ff044;logger[_0x5ff6('0x11')]('The\x20User\x20ID\x20is:',_0x5a5a6b['id']);return getEndUser(_0x3936fe,_0x73c8ae[_0x5ff6('0x66')],_0x73c8ae[_0x5ff6('0x67')]);})[_0x5ff6('0x10')](function(_0x178070){_0x5dce0b=_0x178070;logger[_0x5ff6('0x11')]('The\x20Enduser\x20ID\x20is:',_0x5dce0b['id']);return getTicket(_0x3936fe,_0x5a5a6b,_0x5dce0b,_0x282fd7,_0x73c8ae);})[_0x5ff6('0x10')](function(_0x17b53d){if(_0x17b53d){logger[_0x5ff6('0x11')](_0x5ff6('0x56'),_0x17b53d['id']);switch(_0x3936fe[_0x5ff6('0x3d')]){case _0x5ff6('0x57'):logger['info'](_0x5ff6('0x64'),_0x5ff6('0x58'));return request({'uri':util[_0x5ff6('0x18')](_0x5ff6('0x59'),_0x3936fe[_0x5ff6('0x17')],_0x5a5a6b['id'],_0x17b53d['id']),'method':_0x5ff6('0xa')});case'newTab':logger[_0x5ff6('0x11')](_0x5ff6('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5ff6('0x18')](_0x5ff6('0x5b'),_0x10f183[_0x5ff6('0xd')]),_0x5ff6('0x68'),{'uri':util[_0x5ff6('0x18')](_0x5ff6('0x69'),_0x3936fe[_0x5ff6('0x17')][_0x5ff6('0x5c')]('/api/v2',''),_0x17b53d['id'])});break;default:logger[_0x5ff6('0x5e')](_0x5ff6('0x64'),_0x5ff6('0x5f'));}}})[_0x5ff6('0x60')](function(_0x19e642){logger['error'](_0x5ff6('0x6a'),util['inspect'](_0x19e642,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x274c3e,_0x1d9af6,_0x366cac,_0x36cedd,_0x275813,_0x5463b2){var _0x8d70cb,_0x386fc7;_0x5463b2[_0x5ff6('0x17')]=intUtil[_0x5ff6('0x4a')](_0x5463b2[_0x5ff6('0x17')]);_0x5463b2[_0x5ff6('0x50')]=intUtil['stripTrailingSlash'](_0x5463b2[_0x5ff6('0x50')]);if(_0x275813&&_0x275813[_0x5ff6('0x4b')]){logger[_0x5ff6('0x11')]('['+_0x1d9af6[_0x5ff6('0x6b')]['toUpperCase']()+']',_0x5ff6('0x4d'));_0x1d9af6[_0x5ff6('0x4e')]=util[_0x5ff6('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5463b2[_0x5ff6('0x50')],_0x1d9af6[_0x5ff6('0x51')],md5(_0x1d9af6['uniqueid']));}else{_0x1d9af6['recordingURL']='';}headers[_0x5ff6('0x65')]=getAuth(_0x5463b2);return getUser(_0x5463b2)['then'](function(_0x1bdb1d){_0x8d70cb=_0x1bdb1d;logger[_0x5ff6('0x11')](_0x5ff6('0x53'),_0x8d70cb['id']);return getEndUser(_0x5463b2,_0x1d9af6[_0x5ff6('0x54')],_0x1d9af6[_0x5ff6('0x55')]);})[_0x5ff6('0x10')](function(_0x62a6f0){_0x386fc7=_0x62a6f0;logger[_0x5ff6('0x11')](_0x5ff6('0x6c'),_0x386fc7['id']);return getTicket(_0x5463b2,_0x8d70cb,_0x386fc7,_0x366cac,_0x1d9af6);})['then'](function(_0xef4d03){if(_0xef4d03){logger[_0x5ff6('0x11')](_0x5ff6('0x56'),_0xef4d03['id']);}})[_0x5ff6('0x60')](function(_0x153024){logger['error']('['+_0x1d9af6[_0x5ff6('0x6b')][_0x5ff6('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x153024,{'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 4142820..b563598 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 _0xda45=['add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','https://www.zohoapis.%s/crm/v2/users','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','moduleCreate','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','uri','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','format','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Zoho-oauthtoken\x20','SUCCESS','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','host','com','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','[HTTP]','stringify','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xda45,0x111));var _0x5da4=function(_0x43d342,_0x534f07){_0x43d342=_0x43d342-0x0;var _0x184e94=_0xda45[_0x43d342];return _0x184e94;};'use strict';var _=require(_0x5da4('0x0'));var rp=require(_0x5da4('0x1'));var md5=require(_0x5da4('0x2'));var util=require(_0x5da4('0x3'));var intUtil=require(_0x5da4('0x4'));var moment=require(_0x5da4('0x5'));var Redis=require(_0x5da4('0x6'));var BPromise=require(_0x5da4('0x7'));var config=require(_0x5da4('0x8'));var logger=require(_0x5da4('0x9'))('zoho');config[_0x5da4('0xa')]=_[_0x5da4('0xb')](config[_0x5da4('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5da4('0xa')]));function emit(_0x1f3fa3,_0x524c5f,_0x1dafeb){io['to'](_0x1f3fa3)[_0x5da4('0xc')](_0x524c5f,_0x1dafeb);}function request(_0x19abdf){logger[_0x5da4('0xd')](_0x5da4('0xe'),JSON[_0x5da4('0xf')](_0x19abdf));return rp(_0x19abdf);}function getCustomFields(_0x5de6fd,_0x3b04e4){var _0x5e5ee0={};if(_0x5de6fd['length']>0x0){_['forEach'](_0x5de6fd,function(_0x14e9d1){if(_[_0x5da4('0x10')]([_0x5da4('0x11'),_0x5da4('0x12')],_0x14e9d1[_0x5da4('0x13')])&&_0x14e9d1[_0x5da4('0x14')]){_0x5e5ee0[_0x14e9d1[_0x5da4('0x14')]]=_0x14e9d1[_0x5da4('0x15')][_0x5da4('0x16')]();}else if(_0x14e9d1[_0x5da4('0x13')]===_0x5da4('0x17')&&_0x14e9d1['variableName']&&_0x14e9d1['idField']&&_0x3b04e4[_0x14e9d1['variableName']]){_0x5e5ee0[_0x14e9d1['idField']]=_0x3b04e4[_0x14e9d1[_0x5da4('0x18')]][_0x5da4('0x16')]();}else if(_0x14e9d1['type']==='customVariable'&&_0x14e9d1[_0x5da4('0x19')]&&_0x14e9d1[_0x5da4('0x19')]['name']&&_0x14e9d1[_0x5da4('0x14')]&&_0x3b04e4[_0x14e9d1['Variable'][_0x5da4('0x1a')][_0x5da4('0x1b')]()]){_0x5e5ee0[_0x14e9d1[_0x5da4('0x14')]]=_0x3b04e4[_0x14e9d1[_0x5da4('0x19')][_0x5da4('0x1a')][_0x5da4('0x1b')]()][_0x5da4('0x16')]();}});}return _0x5e5ee0;}function getName(_0x52b3a6){if(_0x52b3a6['indexOf']('\x20')>0x0){var _0x5c0f96=_0x52b3a6[_0x5da4('0x1c')](/ (.+)/);if(_0x5c0f96[0x1]){return _0x5c0f96;}}return[_0x52b3a6,_0x52b3a6];}var accountsTokens={};function getAccessToken(_0x46e309){return new Promise(function(_0x586a55,_0x5632d6){if(!_[_0x5da4('0x1d')](accountsTokens[_0x46e309['id']])&&!_[_0x5da4('0x1d')](accountsTokens[_0x46e309['id']][_0x5da4('0x1e')])){if(moment()[_0x5da4('0x1f')](accountsTokens[_0x46e309['id']][_0x5da4('0x20')])){_0x586a55(accountsTokens[_0x46e309['id']][_0x5da4('0x1e')]);}}var _0x241474;switch(_0x46e309['zone']){case'US':_0x241474=_0x5da4('0x21');break;case'AU':_0x241474='https://accounts.zoho.com.au';break;case'EU':_0x241474=_0x5da4('0x22');break;case'IN':_0x241474='https://accounts.zoho.in';break;case'CN':_0x241474=_0x5da4('0x23');break;default:_0x241474='https://accounts.zoho.eu';break;}var _0x10b362={'method':_0x5da4('0x24'),'uri':_0x241474+_0x5da4('0x25'),'qs':{'refresh_token':_0x46e309[_0x5da4('0x26')],'client_id':_0x46e309[_0x5da4('0x27')],'client_secret':_0x46e309[_0x5da4('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x10b362)['then'](function(_0x96c7a2){accountsTokens[_0x46e309['id']]={'access_token':_0x96c7a2[_0x5da4('0x1e')],'expires_in':moment()[_0x5da4('0x29')](_0x96c7a2[_0x5da4('0x20')],_0x5da4('0x2a'))};_0x586a55(_0x96c7a2[_0x5da4('0x1e')]);})[_0x5da4('0x2b')](function(_0x327b4f){logger[_0x5da4('0x2c')](_0x5da4('0x2d'),_0x327b4f['stack']);_0x5632d6(_0x327b4f);});});}function getUser(_0x464885,_0x49f1f2,_0xf58f9a,_0x5ae52d){logger[_0x5da4('0x2e')]('Search\x20user');return request({'method':_0x5da4('0x2f'),'uri':util['format'](_0x5da4('0x30'),_0x49f1f2),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x464885},'json':!![]})[_0x5da4('0x31')](function(_0x404c48){if(_0x404c48[_0x5da4('0x32')]){var _0x38c4ec=-0x1;if(_[_0x5da4('0x33')](_0x404c48['users'])){if(!_['isNil'](_0x5ae52d)){_0x38c4ec=_[_0x5da4('0x34')](_0x404c48['users'],function(_0xd10c0b){return _0xd10c0b[_0x5da4('0x35')]===_0x5ae52d;});}if(_0x38c4ec>=0x0){logger[_0x5da4('0x2e')](_0x5da4('0x36'));}else{logger['info'](_0x5da4('0x37'));_0x38c4ec=_[_0x5da4('0x34')](_0x404c48[_0x5da4('0x32')],function(_0x343dca){return _0x343dca[_0x5da4('0x38')][_0x5da4('0x1a')]===_0x5da4('0x39');});}return _0x404c48['users'][_0x38c4ec];}else{if(_0x404c48[_0x5da4('0x3a')]['profile'][_0x5da4('0x1a')]===_0x5da4('0x39')){logger[_0x5da4('0x2e')](_0x5da4('0x37'));user=_0x404c48['user'];return user;}else{logger[_0x5da4('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x5da4('0xf')](_0x404c48));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x404c48));}}}else{logger[_0x5da4('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x5da4('0xf')](_0x404c48));throw new Error(_0x5da4('0x3b')+JSON[_0x5da4('0xf')](_0x404c48));}})[_0x5da4('0x2b')](function(_0x17da48){console[_0x5da4('0x2c')](_0x17da48);});}function getZohoUser(_0x5eb6a6,_0x13356d){return new BPromise(function(_0x4b8251,_0x40e2ce){request(_0x5eb6a6)[_0x5da4('0x31')](function(_0x1d8430){var _0x188a6f=null;if(_0x1d8430){_0x188a6f=_0x1d8430[_0x5da4('0x3c')][0x0];_0x188a6f[_0x5da4('0x3d')]=_0x13356d;}_0x4b8251(_0x188a6f);})[_0x5da4('0x2b')](function(_0x8ff8f2){_0x40e2ce(_0x8ff8f2);});});}function createEndUser(_0xaed536,_0x1bf6cb,_0x3acf90,_0x59080b,_0x4b89d9,_0x1fbe7e){var _0x3acf90=getName(_0x3acf90);return request({'method':'POST','uri':_0x5da4('0x3e')+_0x1bf6cb+_0x5da4('0x3f')+_[_0x5da4('0x40')](_0x1fbe7e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3acf90[0x1],'First_Name':_0x3acf90[0x0],'Phone':_0x59080b,'Owner':{'name':!_[_0x5da4('0x1d')](_0x4b89d9[_0x5da4('0x41')][_0x5da4('0x1a')])?_0x4b89d9[_0x5da4('0x41')]['name']:!_[_0x5da4('0x1d')](_0x4b89d9[_0x5da4('0x42')])?_0x4b89d9[_0x5da4('0x42')]+'\x20'+_0x4b89d9[_0x5da4('0x43')]:_0x4b89d9[_0x5da4('0x43')],'id':_0x4b89d9['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xaed536},'json':!![]})[_0x5da4('0x31')](function(_0x52946a){if(_0x52946a&&_0x52946a[_0x5da4('0x3c')][0x0][_0x5da4('0x44')]==='SUCCESS'){var _0x3ab724=_0x52946a['data'][0x0][_0x5da4('0x45')];_0x3ab724[_0x5da4('0x3d')]=_[_0x5da4('0x40')](_0x1fbe7e[_0x5da4('0x46')])+'s';return _0x3ab724;}logger['error'](_0x5da4('0x47'),JSON['stringify'](data));throw new Error(_0x5da4('0x48')+JSON['stringify'](data));})[_0x5da4('0x2b')](function(_0x4cc1c5){console[_0x5da4('0x49')](_0x5da4('0x4a'),_0x4cc1c5);});}function getEndUser(_0x33b3da,_0x5adbeb,_0x18a440,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2){var _0x49b7fa={'method':_0x5da4('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x33b3da},'json':!![]};switch(_0x3cf3b2['moduleSearch']){case _0x5da4('0x4b'):_0x49b7fa['uri']=_0x5da4('0x3e')+_0x5adbeb+_0x5da4('0x4c')+_0x54208b+'))';return getZohoUser(_0x49b7fa,_0x5da4('0x4d'))[_0x5da4('0x31')](function(_0xd93780){if(_0xd93780)return _0xd93780;_0x49b7fa['uri']=_0x5da4('0x3e')+_0x5adbeb+_0x5da4('0x4e')+_0x54208b+'))';return getZohoUser(_0x49b7fa,'Leads')[_0x5da4('0x31')](function(_0x258067){if(_0x258067)return _0x258067;if(_0x3cf3b2[_0x5da4('0x46')]!=_0x5da4('0x4f')){return createEndUser(_0x33b3da,_0x5adbeb,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2);}else{return{};}});});break;case _0x5da4('0x50'):_0x49b7fa[_0x5da4('0x51')]='https://www.zohoapis.'+_0x5adbeb+_0x5da4('0x4c')+_0x54208b+'))';return getZohoUser(_0x49b7fa,_0x5da4('0x4d'))['then'](function(_0x11ae03){if(_0x11ae03)return _0x11ae03;if(_0x3cf3b2['moduleCreate']!=_0x5da4('0x4f')){return createEndUser(_0x33b3da,_0x5adbeb,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2);}else{return{};}});break;case _0x5da4('0x52'):_0x49b7fa[_0x5da4('0x51')]=_0x5da4('0x3e')+_0x5adbeb+_0x5da4('0x4e')+_0x54208b+'))';return getZohoUser(_0x49b7fa,_0x5da4('0x53'))['then'](function(_0x108025){if(_0x108025)return _0x108025;if(_0x3cf3b2[_0x5da4('0x46')]!=_0x5da4('0x4f')){return createEndUser(_0x33b3da,_0x5adbeb,_0x1c8909,_0x54208b,_0x5e73d0,_0x3cf3b2);}else{return{};}});break;}}function getCall(_0x325670,_0x1a3bfa,_0x3528e0,_0x355221,_0x3a00a9,_0x26bf4b,_0x57d813,_0x4e4e3b){logger[_0x5da4('0x2e')](_0x5da4('0x54'));var _0x5692ee={};_0x5692ee[_0x5da4('0x55')]={'name':!_[_0x5da4('0x1d')](_0x355221[_0x5da4('0x41')][_0x5da4('0x1a')])&&!_['isNil'](_0x355221[_0x5da4('0x38')][_0x5da4('0x1a')])&&_0x355221['profile']['name']===_0x5da4('0x56')?_0x355221[_0x5da4('0x41')][_0x5da4('0x1a')]:!_[_0x5da4('0x1d')](_0x355221[_0x5da4('0x42')])?_0x355221['first_name']+'\x20'+_0x355221[_0x5da4('0x43')]:_0x355221[_0x5da4('0x43')],'id':_0x355221['id']};_0x5692ee['Subject']=intUtil[_0x5da4('0x57')](_0x26bf4b[_0x5da4('0x58')],_0x57d813,'\x20');_0x5692ee[_0x5da4('0x59')]=intUtil[_0x5da4('0x57')](_0x26bf4b['Descriptions'],_0x57d813,'\x0a');if(_0x3a00a9[_0x5da4('0x3d')]===_0x5da4('0x4d')){_0x5692ee[_0x5da4('0x5a')]={'name':!_[_0x5da4('0x1d')](_0x3a00a9['Full_Name'])?_0x3a00a9[_0x5da4('0x5b')]:!_[_0x5da4('0x1d')](_0x3a00a9[_0x5da4('0x5c')])?_0x3a00a9[_0x5da4('0x5c')]+'\x20'+_0x3a00a9['Last_Name']:_0x3a00a9[_0x5da4('0x5d')],'id':_0x3a00a9['id']};}if(_0x3a00a9['enduserType']==='Leads'){_0x5692ee[_0x5da4('0x5e')]={'name':!_[_0x5da4('0x1d')](_0x3a00a9[_0x5da4('0x5b')])?_0x3a00a9['Full_Name']:!_[_0x5da4('0x1d')](_0x3a00a9[_0x5da4('0x5c')])?_0x3a00a9[_0x5da4('0x5c')]+'\x20'+_0x3a00a9['Last_Name']:_0x3a00a9['Last_Name'],'id':_0x3a00a9['id']};_0x5692ee[_0x5da4('0x5f')]=_[_0x5da4('0x40')](_0x3a00a9[_0x5da4('0x3d')]);}if(_0x57d813['talktime']){_0x5692ee[_0x5da4('0x60')]=moment['utc'](parseInt(_0x57d813[_0x5da4('0x61')])*0x3e8)[_0x5da4('0x62')]('mm:ss');}else if(_0x57d813['answertime']&&_0x57d813[_0x5da4('0x63')]){_0x5692ee[_0x5da4('0x60')]=moment[_0x5da4('0x64')](moment(_0x57d813[_0x5da4('0x63')],_0x5da4('0x65'))[_0x5da4('0x66')](moment(_0x57d813[_0x5da4('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0x5da4('0x62')](_0x5da4('0x68'));}switch(_0x57d813['lastevent']){case _0x5da4('0x69'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x6b');break;case _0x5da4('0x6c'):case _0x5da4('0x6d'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x6e');break;case _0x5da4('0x6f'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x70');break;case'abandoned':_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x71');break;case _0x5da4('0x72'):_0x5692ee[_0x5da4('0x6a')]=_0x5da4('0x73');default:}_0x5692ee['Call_Start_Time']=(_0x4e4e3b===_0x5da4('0x74')?moment(_0x57d813['starttime'])[_0x5da4('0x62')](_0x5da4('0x65')):moment(_0x57d813[_0x5da4('0x75')])[_0x5da4('0x62')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x5da4('0x62')](_0x5da4('0x65'));_0x5692ee[_0x5da4('0x76')]=_0x4e4e3b||_0x5da4('0x77');_0x5692ee=_[_0x5da4('0x78')](_0x5692ee,getCustomFields(_0x26bf4b[_0x5da4('0x79')],_0x57d813));return request({'method':_0x5da4('0x24'),'uri':_0x5da4('0x3e')+_0x1a3bfa+_0x5da4('0x7a'),'headers':{'Authorization':_0x5da4('0x7b')+_0x325670},'body':{'data':[_0x5692ee]},'json':!![]})[_0x5da4('0x31')](function(_0x107039){if(_0x107039&&_0x107039['data'][0x0][_0x5da4('0x44')]===_0x5da4('0x7c')){logger['info'](_0x5da4('0x7d'));return{'id':_0x107039[_0x5da4('0x3c')][0x0]['details']['id']};}})['catch'](function(_0x3ffb60){logger[_0x5da4('0x2e')](_0x5da4('0x7e'),_0x3ffb60['stack']);console[_0x5da4('0x49')](_0x5da4('0x7e'),_0x3ffb60);});}exports[_0x5da4('0x7f')]=function(_0x397e5e,_0x19fa6b,_0x2eb1ee,_0x981871,_0x2dc820,_0x147694){var _0x3bc278,_0x14c587,_0x2cada0;_0x147694['host']=intUtil['stripTrailingSlash'](_0x147694['host']);_0x147694['serverUrl']=intUtil[_0x5da4('0x80')](_0x147694[_0x5da4('0x81')]);if(_0x2dc820&&_0x2dc820['monitor_format']){logger[_0x5da4('0x2e')](_0x5da4('0x82'),'Recording\x20is\x20enabled!');_0x19fa6b['recordingURL']=_0x147694[_0x5da4('0x81')]+_0x5da4('0x83')+_0x19fa6b[_0x5da4('0x84')]+_0x5da4('0x85')+md5(_0x19fa6b[_0x5da4('0x84')]);}else{_0x19fa6b[_0x5da4('0x86')]='';}var _0x41e4df=_0x147694[_0x5da4('0x87')]==='zoho.eu'?'eu':_0x5da4('0x88');return getAccessToken(_0x147694)[_0x5da4('0x31')](function(_0x1c3384){_0x2cada0=_0x1c3384;return getUser(_0x2cada0,_0x41e4df,_0x147694,_0x981871[_0x5da4('0x35')]);})[_0x5da4('0x31')](function(_0xff1609){_0x3bc278=_0xff1609;logger[_0x5da4('0x2e')]('The\x20User\x20ID\x20is:',_0x3bc278['id']);return getEndUser(_0x2cada0,_0x41e4df,_0x147694,_0x19fa6b['calleridname'],_0x19fa6b['calleridnum'],_0x3bc278,_0x2eb1ee);})[_0x5da4('0x31')](function(_0x21ff24){_0x14c587=_0x21ff24;return getCall(_0x2cada0,_0x41e4df,_0x147694,_0x3bc278,_0x14c587,_0x2eb1ee,_0x19fa6b,_0x5da4('0x77'));})[_0x5da4('0x31')](function(_0x566778){if(_0x566778){logger[_0x5da4('0x2e')](_0x5da4('0x89'),_0x566778['id']);logger[_0x5da4('0x2e')](_0x5da4('0x82'),_0x5da4('0x8a'));emit(util[_0x5da4('0x62')](_0x5da4('0x8b'),_0x981871[_0x5da4('0x1a')]),'trigger:browser:url',{'uri':_0x5da4('0x8c')+_0x147694[_0x5da4('0x87')]+_0x5da4('0x8d')+_0x566778['id']});}})['catch'](function(_0x5e1dff){logger['error'](_0x5da4('0x82'),JSON['stringify'](_0x5e1dff));});};exports[_0x5da4('0x74')]=function(_0x3a658b,_0xe2f1f,_0x9ceeeb,_0x4b7f7d,_0x3de55e,_0x5607fb,_0x29414f){var _0x15f952,_0x883edc,_0x1696c3;_0x5607fb['host']=intUtil[_0x5da4('0x80')](_0x5607fb['host']);_0x5607fb[_0x5da4('0x81')]=intUtil[_0x5da4('0x80')](_0x5607fb[_0x5da4('0x81')]);if(_0x29414f&&_0x29414f['recordingFormat']&&_0x29414f[_0x5da4('0x8e')]!==_0x5da4('0x8f')){logger[_0x5da4('0x2e')](_0x5da4('0x90'),_0x5da4('0x91'));_0xe2f1f[_0x5da4('0x86')]=_0x5607fb[_0x5da4('0x81')]+_0x5da4('0x83')+_0xe2f1f[_0x5da4('0x84')]+'/downloads?type=uniqueid&token='+md5(_0xe2f1f[_0x5da4('0x84')]);}var _0x55e4a9=_0x5607fb[_0x5da4('0x87')]===_0x5da4('0x92')?'eu':'com';return getAccessToken(_0x5607fb)[_0x5da4('0x31')](function(_0x5cc055){_0x1696c3=_0x5cc055;return getUser(_0x1696c3,_0x55e4a9,_0x5607fb,_0x4b7f7d[_0x5da4('0x35')]);})[_0x5da4('0x31')](function(_0x13d7ec){_0x15f952=_0x13d7ec;logger[_0x5da4('0x2e')](_0x5da4('0x93'),_0x15f952['id']);return getEndUser(_0x1696c3,_0x55e4a9,_0x5607fb,_0xe2f1f[_0x5da4('0x94')],_0xe2f1f[_0x5da4('0x95')],_0x15f952,_0x9ceeeb);})[_0x5da4('0x31')](function(_0x2b73e6){_0x883edc=_0x2b73e6;return getCall(_0x1696c3,_0x55e4a9,_0x5607fb,_0x15f952,_0x883edc,_0x9ceeeb,_0xe2f1f,'Outbound');})[_0x5da4('0x31')](function(_0x490950){if(_0x490950){logger[_0x5da4('0x2e')]('The\x20Call\x20ID\x20is:',_0x490950['id']);logger['info'](_0x5da4('0x90'),_0x5da4('0x8a'));emit(util[_0x5da4('0x62')](_0x5da4('0x8b'),_0x4b7f7d['name']),_0x5da4('0x96'),{'uri':_0x5da4('0x8c')+_0x5607fb[_0x5da4('0x87')]+_0x5da4('0x8d')+_0x490950['id']});}})[_0x5da4('0x2b')](function(_0x546151){logger['error']('[OUTBOUND]',JSON['stringify'](_0x546151));});};exports[_0x5da4('0x97')]=function(_0x1e478b,_0x4f97c5,_0x281fae,_0x380099,_0x375425,_0x4eb77f){var _0x2c0a03,_0x50b819,_0x27ab86;_0x4eb77f[_0x5da4('0x87')]=intUtil[_0x5da4('0x80')](_0x4eb77f['host']);_0x4eb77f['serverUrl']=intUtil['stripTrailingSlash'](_0x4eb77f['serverUrl']);if(_0x375425&&_0x375425[_0x5da4('0x98')]){logger[_0x5da4('0x2e')]('['+_0x4f97c5[_0x5da4('0x99')][_0x5da4('0x9a')]()+']',_0x5da4('0x91'));_0x4f97c5[_0x5da4('0x86')]=_0x4eb77f[_0x5da4('0x81')]+'/api/voice/recordings/'+_0x4f97c5[_0x5da4('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x4f97c5[_0x5da4('0x84')]);}else{_0x4f97c5[_0x5da4('0x86')]='';}var _0xd7a762=_0x4eb77f[_0x5da4('0x87')]===_0x5da4('0x92')?'eu':_0x5da4('0x88');return getAccessToken(_0x4eb77f)[_0x5da4('0x31')](function(_0x340775){_0x27ab86=_0x340775;return getUser(_0x27ab86,_0xd7a762,_0x4eb77f);})[_0x5da4('0x31')](function(_0x30c5c9){_0x2c0a03=_0x30c5c9;logger['info']('The\x20User\x20ID\x20is:',_0x2c0a03['id']);return getEndUser(_0x27ab86,_0xd7a762,_0x4eb77f,_0x4f97c5[_0x5da4('0x9b')],_0x4f97c5[_0x5da4('0x9c')],_0x2c0a03,_0x281fae);})[_0x5da4('0x31')](function(_0x135bd3){_0x50b819=_0x135bd3;return getCall(_0x27ab86,_0xd7a762,_0x4eb77f,_0x2c0a03,_0x50b819,_0x281fae,_0x4f97c5,_0x5da4('0x77'));})['then'](function(_0x3bd055){if(_0x3bd055){logger[_0x5da4('0x2e')]('The\x20Call\x20ID\x20is:',_0x3bd055['id']);}})[_0x5da4('0x2b')](function(_0x2fb544){logger['error']('['+_0x4f97c5[_0x5da4('0x99')][_0x5da4('0x9a')]()+']',JSON[_0x5da4('0xf')](_0x2fb544));});}; \ No newline at end of file +var _0xf0da=['CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','connect','rejected','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','Fields','POST','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','Outbound','user:%s','https://crm.','stripTrailingSlash','toUpperCase','lodash','request-promise','md5','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','debug','[HTTP]','stringify','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','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','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','user','profile','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','details','startCase','moduleCreate','Error:\x20','log'];(function(_0x51d236,_0x3c1e1b){var _0x297683=function(_0x3ff2ea){while(--_0x3ff2ea){_0x51d236['push'](_0x51d236['shift']());}};_0x297683(++_0x3c1e1b);}(_0xf0da,0xe4));var _0xaf0d=function(_0x4fe964,_0x4dc137){_0x4fe964=_0x4fe964-0x0;var _0x44761b=_0xf0da[_0x4fe964];return _0x44761b;};'use strict';var _=require(_0xaf0d('0x0'));var rp=require(_0xaf0d('0x1'));var md5=require(_0xaf0d('0x2'));var util=require(_0xaf0d('0x3'));var intUtil=require(_0xaf0d('0x4'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0xaf0d('0x5'));var config=require(_0xaf0d('0x6'));var logger=require(_0xaf0d('0x7'))(_0xaf0d('0x8'));config['redis']=_[_0xaf0d('0x9')](config['redis'],{'host':_0xaf0d('0xa'),'port':0x18eb});var io=require(_0xaf0d('0xb'))(new Redis(config[_0xaf0d('0xc')]));function emit(_0x3a8c5e,_0x55840e,_0x36cd8d){io['to'](_0x3a8c5e)['emit'](_0x55840e,_0x36cd8d);}function request(_0x380d37){logger[_0xaf0d('0xd')](_0xaf0d('0xe'),JSON[_0xaf0d('0xf')](_0x380d37));return rp(_0x380d37);}function getCustomFields(_0x34d8aa,_0xe44a6){var _0x53b3a8={};if(_0x34d8aa[_0xaf0d('0x10')]>0x0){_[_0xaf0d('0x11')](_0x34d8aa,function(_0x3f10ad){if(_[_0xaf0d('0x12')](['string',_0xaf0d('0x13')],_0x3f10ad['type'])&&_0x3f10ad[_0xaf0d('0x14')]){_0x53b3a8[_0x3f10ad['idField']]=_0x3f10ad[_0xaf0d('0x15')][_0xaf0d('0x16')]();}else if(_0x3f10ad[_0xaf0d('0x17')]===_0xaf0d('0x18')&&_0x3f10ad[_0xaf0d('0x19')]&&_0x3f10ad[_0xaf0d('0x14')]&&_0xe44a6[_0x3f10ad[_0xaf0d('0x19')]]){_0x53b3a8[_0x3f10ad[_0xaf0d('0x14')]]=_0xe44a6[_0x3f10ad[_0xaf0d('0x19')]][_0xaf0d('0x16')]();}else if(_0x3f10ad[_0xaf0d('0x17')]===_0xaf0d('0x1a')&&_0x3f10ad[_0xaf0d('0x1b')]&&_0x3f10ad[_0xaf0d('0x1b')]['name']&&_0x3f10ad['idField']&&_0xe44a6[_0x3f10ad[_0xaf0d('0x1b')][_0xaf0d('0x1c')][_0xaf0d('0x1d')]()]){_0x53b3a8[_0x3f10ad[_0xaf0d('0x14')]]=_0xe44a6[_0x3f10ad[_0xaf0d('0x1b')][_0xaf0d('0x1c')]['toLowerCase']()][_0xaf0d('0x16')]();}});}return _0x53b3a8;}function getName(_0x7895b0){if(_0x7895b0[_0xaf0d('0x1e')]('\x20')>0x0){var _0x4be89b=_0x7895b0['split'](/ (.+)/);if(_0x4be89b[0x1]){return _0x4be89b;}}return[_0x7895b0,_0x7895b0];}var accountsTokens={};function getAccessToken(_0x1afe72){return new Promise(function(_0x56754a,_0x38c2ff){if(!_[_0xaf0d('0x1f')](accountsTokens[_0x1afe72['id']])&&!_[_0xaf0d('0x1f')](accountsTokens[_0x1afe72['id']][_0xaf0d('0x20')])){if(moment()[_0xaf0d('0x21')](accountsTokens[_0x1afe72['id']]['expires_in'])){_0x56754a(accountsTokens[_0x1afe72['id']]['access_token']);}}var _0x4c035d;switch(_0x1afe72['zone']){case'US':_0x4c035d=_0xaf0d('0x22');break;case'AU':_0x4c035d=_0xaf0d('0x23');break;case'EU':_0x4c035d=_0xaf0d('0x24');break;case'IN':_0x4c035d=_0xaf0d('0x25');break;case'CN':_0x4c035d=_0xaf0d('0x26');break;default:_0x4c035d=_0xaf0d('0x24');break;}var _0x3615ab={'method':'POST','uri':_0x4c035d+_0xaf0d('0x27'),'qs':{'refresh_token':_0x1afe72[_0xaf0d('0x28')],'client_id':_0x1afe72[_0xaf0d('0x29')],'client_secret':_0x1afe72[_0xaf0d('0x2a')],'grant_type':_0xaf0d('0x2b')},'json':!![]};return rp(_0x3615ab)['then'](function(_0x208637){accountsTokens[_0x1afe72['id']]={'access_token':_0x208637[_0xaf0d('0x20')],'expires_in':moment()['add'](_0x208637[_0xaf0d('0x2c')],'seconds')};_0x56754a(_0x208637[_0xaf0d('0x20')]);})[_0xaf0d('0x2d')](function(_0x597302){logger[_0xaf0d('0x2e')](_0xaf0d('0x2f'),_0x597302[_0xaf0d('0x30')]);_0x38c2ff(_0x597302);});});}function getUser(_0x3f7e7c,_0x30498e,_0x514bd2,_0x2d1120){logger[_0xaf0d('0x31')](_0xaf0d('0x32'));return request({'method':_0xaf0d('0x33'),'uri':util[_0xaf0d('0x34')](_0xaf0d('0x35'),_0x30498e),'qs':{'type':_0xaf0d('0x36')},'headers':{'Authorization':_0xaf0d('0x37')+_0x3f7e7c},'json':!![]})[_0xaf0d('0x38')](function(_0x161f95){if(_0x161f95[_0xaf0d('0x39')]){var _0x50c05d=-0x1;if(_[_0xaf0d('0x3a')](_0x161f95['users'])){if(!_[_0xaf0d('0x1f')](_0x2d1120)){_0x50c05d=_[_0xaf0d('0x3b')](_0x161f95[_0xaf0d('0x39')],function(_0xe00844){return _0xe00844[_0xaf0d('0x3c')]===_0x2d1120;});}if(_0x50c05d>=0x0){logger[_0xaf0d('0x31')](_0xaf0d('0x3d'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x50c05d=_['findIndex'](_0x161f95[_0xaf0d('0x39')],function(_0xde54e8){return _0xde54e8['profile'][_0xaf0d('0x1c')]===_0xaf0d('0x3e');});}return _0x161f95[_0xaf0d('0x39')][_0x50c05d];}else{if(_0x161f95[_0xaf0d('0x3f')][_0xaf0d('0x40')][_0xaf0d('0x1c')]==='Administrator'){logger[_0xaf0d('0x31')](_0xaf0d('0x41'));user=_0x161f95[_0xaf0d('0x3f')];return user;}else{logger[_0xaf0d('0x2e')](_0xaf0d('0x42'),JSON[_0xaf0d('0xf')](_0x161f95));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xaf0d('0xf')](_0x161f95));}}}else{logger[_0xaf0d('0x2e')](_0xaf0d('0x42'),JSON['stringify'](_0x161f95));throw new Error(_0xaf0d('0x43')+JSON['stringify'](_0x161f95));}})[_0xaf0d('0x2d')](function(_0x165e44){console[_0xaf0d('0x2e')](_0x165e44);});}function getZohoUser(_0x436dd4,_0x1855be){return new BPromise(function(_0x4f74f6,_0x5116e8){request(_0x436dd4)[_0xaf0d('0x38')](function(_0x3c4779){var _0x214a89=null;if(_0x3c4779){_0x214a89=_0x3c4779[_0xaf0d('0x44')][0x0];_0x214a89[_0xaf0d('0x45')]=_0x1855be;}_0x4f74f6(_0x214a89);})['catch'](function(_0x104cbe){_0x5116e8(_0x104cbe);});});}function createEndUser(_0x4dbbd4,_0x146ccf,_0x309a14,_0x1d3543,_0x1d6eb0,_0x1c21ce){var _0x309a14=getName(_0x309a14);return request({'method':'POST','uri':_0xaf0d('0x46')+_0x146ccf+_0xaf0d('0x47')+_['startCase'](_0x1c21ce['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x309a14[0x1],'First_Name':_0x309a14[0x0],'Phone':_0x1d3543,'Owner':{'name':!_[_0xaf0d('0x1f')](_0x1d6eb0[_0xaf0d('0x48')][_0xaf0d('0x1c')])?_0x1d6eb0[_0xaf0d('0x48')][_0xaf0d('0x1c')]:!_['isNil'](_0x1d6eb0[_0xaf0d('0x49')])?_0x1d6eb0[_0xaf0d('0x49')]+'\x20'+_0x1d6eb0[_0xaf0d('0x4a')]:_0x1d6eb0['last_name'],'id':_0x1d6eb0['id']}}]},'headers':{'Authorization':_0xaf0d('0x37')+_0x4dbbd4},'json':!![]})[_0xaf0d('0x38')](function(_0x37b924){if(_0x37b924&&_0x37b924[_0xaf0d('0x44')][0x0]['code']==='SUCCESS'){var _0xbaccd1=_0x37b924[_0xaf0d('0x44')][0x0][_0xaf0d('0x4b')];_0xbaccd1[_0xaf0d('0x45')]=_[_0xaf0d('0x4c')](_0x1c21ce[_0xaf0d('0x4d')])+'s';return _0xbaccd1;}logger[_0xaf0d('0x2e')](_0xaf0d('0x42'),JSON['stringify'](data));throw new Error(_0xaf0d('0x4e')+JSON[_0xaf0d('0xf')](data));})[_0xaf0d('0x2d')](function(_0x5c578f){console[_0xaf0d('0x4f')](_0xaf0d('0x50'),_0x5c578f);});}function getEndUser(_0x29317b,_0x44210a,_0x22503d,_0x33fb17,_0x429365,_0xa8fa2c,_0x3563e0){var _0x1ecaa2={'method':_0xaf0d('0x33'),'uri':'','headers':{'Authorization':_0xaf0d('0x37')+_0x29317b},'json':!![]};switch(_0x3563e0['moduleSearch']){case _0xaf0d('0x51'):_0x1ecaa2[_0xaf0d('0x52')]=_0xaf0d('0x46')+_0x44210a+_0xaf0d('0x53')+_0x429365+'))';return getZohoUser(_0x1ecaa2,'Contacts')[_0xaf0d('0x38')](function(_0x1b9856){if(_0x1b9856)return _0x1b9856;_0x1ecaa2[_0xaf0d('0x52')]=_0xaf0d('0x46')+_0x44210a+_0xaf0d('0x54')+_0x429365+'))';return getZohoUser(_0x1ecaa2,_0xaf0d('0x55'))[_0xaf0d('0x38')](function(_0x376460){if(_0x376460)return _0x376460;if(_0x3563e0[_0xaf0d('0x4d')]!=_0xaf0d('0x56')){return createEndUser(_0x29317b,_0x44210a,_0x33fb17,_0x429365,_0xa8fa2c,_0x3563e0);}else{return{};}});});break;case'contact':_0x1ecaa2[_0xaf0d('0x52')]='https://www.zohoapis.'+_0x44210a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x429365+'))';return getZohoUser(_0x1ecaa2,_0xaf0d('0x57'))[_0xaf0d('0x38')](function(_0x17bebb){if(_0x17bebb)return _0x17bebb;if(_0x3563e0[_0xaf0d('0x4d')]!=_0xaf0d('0x56')){return createEndUser(_0x29317b,_0x44210a,_0x33fb17,_0x429365,_0xa8fa2c,_0x3563e0);}else{return{};}});break;case _0xaf0d('0x58'):_0x1ecaa2[_0xaf0d('0x52')]=_0xaf0d('0x46')+_0x44210a+_0xaf0d('0x54')+_0x429365+'))';return getZohoUser(_0x1ecaa2,'Leads')[_0xaf0d('0x38')](function(_0x5a6469){if(_0x5a6469)return _0x5a6469;if(_0x3563e0['moduleCreate']!=_0xaf0d('0x56')){return createEndUser(_0x29317b,_0x44210a,_0x33fb17,_0x429365,_0xa8fa2c,_0x3563e0);}else{return{};}});break;}}function getCall(_0x435a62,_0xeedd80,_0x1acfd9,_0x3f536c,_0x39894d,_0x27da6c,_0x13cc3d,_0x29fcc1){logger['info'](_0xaf0d('0x59'));var _0x44c285={};_0x44c285[_0xaf0d('0x5a')]={'name':!_['isNil'](_0x3f536c['role'][_0xaf0d('0x1c')])&&!_[_0xaf0d('0x1f')](_0x3f536c[_0xaf0d('0x40')][_0xaf0d('0x1c')])&&_0x3f536c['profile'][_0xaf0d('0x1c')]==='administrator'?_0x3f536c[_0xaf0d('0x48')]['name']:!_['isNil'](_0x3f536c[_0xaf0d('0x49')])?_0x3f536c[_0xaf0d('0x49')]+'\x20'+_0x3f536c[_0xaf0d('0x4a')]:_0x3f536c[_0xaf0d('0x4a')],'id':_0x3f536c['id']};_0x44c285[_0xaf0d('0x5b')]=intUtil[_0xaf0d('0x5c')](_0x27da6c[_0xaf0d('0x5d')],_0x13cc3d,'\x20');_0x44c285[_0xaf0d('0x5e')]=intUtil[_0xaf0d('0x5c')](_0x27da6c[_0xaf0d('0x5f')],_0x13cc3d,'\x0a');if(_0x39894d[_0xaf0d('0x45')]===_0xaf0d('0x57')){_0x44c285['Who_Id']={'name':!_['isNil'](_0x39894d[_0xaf0d('0x60')])?_0x39894d[_0xaf0d('0x60')]:!_[_0xaf0d('0x1f')](_0x39894d['First_Name'])?_0x39894d[_0xaf0d('0x61')]+'\x20'+_0x39894d['Last_Name']:_0x39894d[_0xaf0d('0x62')],'id':_0x39894d['id']};}if(_0x39894d[_0xaf0d('0x45')]===_0xaf0d('0x55')){_0x44c285[_0xaf0d('0x63')]={'name':!_[_0xaf0d('0x1f')](_0x39894d[_0xaf0d('0x60')])?_0x39894d[_0xaf0d('0x60')]:!_[_0xaf0d('0x1f')](_0x39894d[_0xaf0d('0x61')])?_0x39894d[_0xaf0d('0x61')]+'\x20'+_0x39894d[_0xaf0d('0x62')]:_0x39894d[_0xaf0d('0x62')],'id':_0x39894d['id']};_0x44c285[_0xaf0d('0x64')]=_[_0xaf0d('0x4c')](_0x39894d[_0xaf0d('0x45')]);}if(_0x13cc3d[_0xaf0d('0x65')]){_0x44c285['Call_Duration']=moment[_0xaf0d('0x66')](parseInt(_0x13cc3d[_0xaf0d('0x65')])*0x3e8)[_0xaf0d('0x34')](_0xaf0d('0x67'));}else if(_0x13cc3d[_0xaf0d('0x68')]&&_0x13cc3d['endtime']){_0x44c285[_0xaf0d('0x69')]=moment['utc'](moment(_0x13cc3d[_0xaf0d('0x6a')],_0xaf0d('0x6b'))[_0xaf0d('0x6c')](moment(_0x13cc3d[_0xaf0d('0x6d')],_0xaf0d('0x6b'))))['format'](_0xaf0d('0x67'));}switch(_0x13cc3d[_0xaf0d('0x6e')]){case'called':_0x44c285[_0xaf0d('0x6f')]='Called';break;case'complete':case _0xaf0d('0x70'):_0x44c285[_0xaf0d('0x6f')]='Answered';break;case _0xaf0d('0x71'):_0x44c285['Call_Result']='Rejected';break;case'abandoned':_0x44c285[_0xaf0d('0x6f')]=_0xaf0d('0x72');break;case'timeout':_0x44c285[_0xaf0d('0x6f')]=_0xaf0d('0x73');default:}_0x44c285[_0xaf0d('0x74')]=(_0x29fcc1===_0xaf0d('0x75')?moment(_0x13cc3d[_0xaf0d('0x6d')])[_0xaf0d('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x13cc3d[_0xaf0d('0x76')])[_0xaf0d('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xaf0d('0x6b'));_0x44c285['Call_Type']=_0x29fcc1||_0xaf0d('0x77');_0x44c285=_['merge'](_0x44c285,getCustomFields(_0x27da6c[_0xaf0d('0x78')],_0x13cc3d));return request({'method':_0xaf0d('0x79'),'uri':_0xaf0d('0x46')+_0xeedd80+_0xaf0d('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x435a62},'body':{'data':[_0x44c285]},'json':!![]})[_0xaf0d('0x38')](function(_0x33b71e){if(_0x33b71e&&_0x33b71e[_0xaf0d('0x44')][0x0]['code']===_0xaf0d('0x7b')){logger['info'](_0xaf0d('0x7c'));return{'id':_0x33b71e['data'][0x0][_0xaf0d('0x4b')]['id']};}})[_0xaf0d('0x2d')](function(_0x458763){logger[_0xaf0d('0x31')](_0xaf0d('0x7d'),_0x458763[_0xaf0d('0x30')]);console[_0xaf0d('0x4f')](_0xaf0d('0x7d'),_0x458763);});}exports[_0xaf0d('0x7e')]=function(_0x2c72b3,_0x295395,_0x2d5250,_0x460998,_0x5dd4af,_0x4d9363){var _0x3c1b9c,_0x427066,_0x355a90;_0x4d9363[_0xaf0d('0x7f')]=intUtil['stripTrailingSlash'](_0x4d9363['host']);_0x4d9363[_0xaf0d('0x80')]=intUtil['stripTrailingSlash'](_0x4d9363['serverUrl']);if(_0x5dd4af&&_0x5dd4af[_0xaf0d('0x81')]){logger[_0xaf0d('0x31')](_0xaf0d('0x82'),_0xaf0d('0x83'));_0x295395[_0xaf0d('0x84')]=_0x4d9363[_0xaf0d('0x80')]+_0xaf0d('0x85')+_0x295395[_0xaf0d('0x86')]+_0xaf0d('0x87')+md5(_0x295395['uniqueid']);}else{_0x295395[_0xaf0d('0x84')]='';}var _0x5265c1=_0x4d9363[_0xaf0d('0x7f')]==='zoho.eu'?'eu':_0xaf0d('0x88');return getAccessToken(_0x4d9363)[_0xaf0d('0x38')](function(_0x3ac5d4){_0x355a90=_0x3ac5d4;return getUser(_0x355a90,_0x5265c1,_0x4d9363,_0x460998[_0xaf0d('0x3c')]);})[_0xaf0d('0x38')](function(_0x598dc4){_0x3c1b9c=_0x598dc4;logger[_0xaf0d('0x31')](_0xaf0d('0x89'),_0x3c1b9c['id']);return getEndUser(_0x355a90,_0x5265c1,_0x4d9363,_0x295395[_0xaf0d('0x8a')],_0x295395[_0xaf0d('0x8b')],_0x3c1b9c,_0x2d5250);})[_0xaf0d('0x38')](function(_0xc2e3c1){_0x427066=_0xc2e3c1;return getCall(_0x355a90,_0x5265c1,_0x4d9363,_0x3c1b9c,_0x427066,_0x2d5250,_0x295395,_0xaf0d('0x77'));})[_0xaf0d('0x38')](function(_0x73777a){if(_0x73777a){logger[_0xaf0d('0x31')](_0xaf0d('0x8c'),_0x73777a['id']);logger[_0xaf0d('0x31')](_0xaf0d('0x82'),_0xaf0d('0x8d'));emit(util[_0xaf0d('0x34')]('user:%s',_0x460998[_0xaf0d('0x1c')]),_0xaf0d('0x8e'),{'uri':'https://crm.'+_0x4d9363[_0xaf0d('0x7f')]+_0xaf0d('0x8f')+_0x73777a['id']});}})[_0xaf0d('0x2d')](function(_0x1eb099){logger['error']('[QUEUE]',JSON[_0xaf0d('0xf')](_0x1eb099));});};exports[_0xaf0d('0x75')]=function(_0x257657,_0x4b1a13,_0x4ff282,_0x517ee9,_0x18470f,_0x2d3a89,_0x389af0){var _0x3c003e,_0x5d692e,_0x867009;_0x2d3a89[_0xaf0d('0x7f')]=intUtil['stripTrailingSlash'](_0x2d3a89['host']);_0x2d3a89[_0xaf0d('0x80')]=intUtil['stripTrailingSlash'](_0x2d3a89[_0xaf0d('0x80')]);if(_0x389af0&&_0x389af0[_0xaf0d('0x90')]&&_0x389af0[_0xaf0d('0x90')]!==_0xaf0d('0x91')){logger[_0xaf0d('0x31')](_0xaf0d('0x92'),'Recording\x20is\x20enabled!');_0x4b1a13[_0xaf0d('0x84')]=_0x2d3a89[_0xaf0d('0x80')]+_0xaf0d('0x85')+_0x4b1a13[_0xaf0d('0x86')]+_0xaf0d('0x87')+md5(_0x4b1a13['uniqueid']);}var _0x3a0989=_0x2d3a89[_0xaf0d('0x7f')]===_0xaf0d('0x93')?'eu':'com';return getAccessToken(_0x2d3a89)[_0xaf0d('0x38')](function(_0x4a5a75){_0x867009=_0x4a5a75;return getUser(_0x867009,_0x3a0989,_0x2d3a89,_0x517ee9[_0xaf0d('0x3c')]);})['then'](function(_0x32d9d1){_0x3c003e=_0x32d9d1;logger[_0xaf0d('0x31')](_0xaf0d('0x89'),_0x3c003e['id']);return getEndUser(_0x867009,_0x3a0989,_0x2d3a89,_0x4b1a13[_0xaf0d('0x94')],_0x4b1a13['destcalleridnum'],_0x3c003e,_0x4ff282);})[_0xaf0d('0x38')](function(_0x1e6939){_0x5d692e=_0x1e6939;return getCall(_0x867009,_0x3a0989,_0x2d3a89,_0x3c003e,_0x5d692e,_0x4ff282,_0x4b1a13,_0xaf0d('0x95'));})['then'](function(_0x2f9201){if(_0x2f9201){logger[_0xaf0d('0x31')]('The\x20Call\x20ID\x20is:',_0x2f9201['id']);logger[_0xaf0d('0x31')](_0xaf0d('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaf0d('0x34')](_0xaf0d('0x96'),_0x517ee9[_0xaf0d('0x1c')]),_0xaf0d('0x8e'),{'uri':_0xaf0d('0x97')+_0x2d3a89['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2f9201['id']});}})['catch'](function(_0xaa49a7){logger[_0xaf0d('0x2e')](_0xaf0d('0x92'),JSON['stringify'](_0xaa49a7));});};exports['unmanaged']=function(_0x2b181e,_0x447083,_0x3ab33e,_0x4d8873,_0x3821d5,_0x542c68){var _0xb37ca4,_0x32e490,_0x221cfb;_0x542c68[_0xaf0d('0x7f')]=intUtil[_0xaf0d('0x98')](_0x542c68[_0xaf0d('0x7f')]);_0x542c68[_0xaf0d('0x80')]=intUtil[_0xaf0d('0x98')](_0x542c68[_0xaf0d('0x80')]);if(_0x3821d5&&_0x3821d5[_0xaf0d('0x81')]){logger[_0xaf0d('0x31')]('['+_0x447083[_0xaf0d('0x6e')][_0xaf0d('0x99')]()+']',_0xaf0d('0x83'));_0x447083['recordingURL']=_0x542c68[_0xaf0d('0x80')]+_0xaf0d('0x85')+_0x447083[_0xaf0d('0x86')]+_0xaf0d('0x87')+md5(_0x447083['uniqueid']);}else{_0x447083[_0xaf0d('0x84')]='';}var _0x2e383d=_0x542c68[_0xaf0d('0x7f')]===_0xaf0d('0x93')?'eu':_0xaf0d('0x88');return getAccessToken(_0x542c68)['then'](function(_0x1a7afb){_0x221cfb=_0x1a7afb;return getUser(_0x221cfb,_0x2e383d,_0x542c68);})[_0xaf0d('0x38')](function(_0x1f156c){_0xb37ca4=_0x1f156c;logger[_0xaf0d('0x31')]('The\x20User\x20ID\x20is:',_0xb37ca4['id']);return getEndUser(_0x221cfb,_0x2e383d,_0x542c68,_0x447083[_0xaf0d('0x8a')],_0x447083['calleridnum'],_0xb37ca4,_0x3ab33e);})[_0xaf0d('0x38')](function(_0x2d295d){_0x32e490=_0x2d295d;return getCall(_0x221cfb,_0x2e383d,_0x542c68,_0xb37ca4,_0x32e490,_0x3ab33e,_0x447083,'Inbound');})[_0xaf0d('0x38')](function(_0x43c9ed){if(_0x43c9ed){logger['info'](_0xaf0d('0x8c'),_0x43c9ed['id']);}})['catch'](function(_0x232929){logger[_0xaf0d('0x2e')]('['+_0x447083[_0xaf0d('0x6e')][_0xaf0d('0x99')]()+']',JSON[_0xaf0d('0xf')](_0x232929));});}; \ 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 96dc2f9..3e7aea5 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 _0x9bb9=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','shelljs','data2','exec','error','format'];(function(_0x2e71f9,_0x21bfed){var _0x3ce8d5=function(_0x191c98){while(--_0x191c98){_0x2e71f9['push'](_0x2e71f9['shift']());}};_0x3ce8d5(++_0x21bfed);}(_0x9bb9,0xe1));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x99bb('0x0'));var sh=require(_0x99bb('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x462d28,_0x157cbe){var _0x50e017=_0x462d28[_0x99bb('0x2')]?_0x462d28[_0x99bb('0x2')]:'Script';var _0x498b1e=_0x462d28['data3']?Mustache['render'](_0x462d28['data3'],_0x157cbe):_0x157cbe;sh[_0x99bb('0x3')](_0x498b1e,function(_0x1c907c,_0x34ee3f,_0x41d7fb){if(_0x1c907c!==0x0){logger[_0x99bb('0x4')](util[_0x99bb('0x5')](_0x99bb('0x6'),_0x50e017,_0x498b1e,_0x1c907c,_0x41d7fb));}else{logger['info'](util[_0x99bb('0x5')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x50e017,_0x498b1e,_0x34ee3f));}});}; \ No newline at end of file +var _0x8be9=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x8be9,0x168));var _0x98be=function(_0x5059f8,_0x2a16cc){_0x5059f8=_0x5059f8-0x0;var _0xffff36=_0x8be9[_0x5059f8];return _0xffff36;};'use strict';var util=require('util');var sh=require(_0x98be('0x0'));var Mustache=require(_0x98be('0x1'));var logger=require(_0x98be('0x2'))(_0x98be('0x3'));exports[_0x98be('0x4')]=function(_0x5664a0,_0x5420f0){var _0x4d3d53=_0x5664a0[_0x98be('0x5')]?_0x5664a0[_0x98be('0x5')]:_0x98be('0x6');var _0xd13f9b=_0x5664a0[_0x98be('0x7')]?Mustache['render'](_0x5664a0[_0x98be('0x7')],_0x5420f0):_0x5420f0;sh[_0x98be('0x4')](_0xd13f9b,function(_0x1179bc,_0xcf00c2,_0x27c25e){if(_0x1179bc!==0x0){logger[_0x98be('0x8')](util['format'](_0x98be('0x9'),_0x4d3d53,_0xd13f9b,_0x1179bc,_0x27c25e));}else{logger[_0x98be('0xa')](util[_0x98be('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4d3d53,_0xd13f9b,_0xcf00c2));}});}; \ 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 dc1f04c..ca21883 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 _0x775c=['../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','headers','data6','parse','stack','GET','DELETE','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x775c,0x150));var _0xc775=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x775c[_0x1e7b16];return _0x37fadc;};'use strict';var rp=require(_0xc775('0x0'));var util=require(_0xc775('0x1'));var _=require(_0xc775('0x2'));var Mustache=require(_0xc775('0x3'));var logger=require(_0xc775('0x4'))(_0xc775('0x5'));exports[_0xc775('0x6')]=function(_0x4a0028,_0x41232c){var _0x50db19,_0xf2bd76;var _0x51d852={'method':_0x4a0028[_0xc775('0x7')][_0xc775('0x8')](),'uri':Mustache[_0xc775('0x9')](_0x4a0028['data2'],_0x41232c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a0028[_0xc775('0xa')])===_0xc775('0xb')&&parseInt(_0x4a0028[_0xc775('0xa')])>=0x1&&parseInt(_0x4a0028[_0xc775('0xa')])<=0xa?parseInt(_0x4a0028['data5'])*0x3e8:0x5*0x3e8};try{_0x51d852[_0xc775('0xc')]=_0x4a0028[_0xc775('0xd')]?JSON[_0xc775('0xe')](Mustache[_0xc775('0x9')](_0x4a0028[_0xc775('0xd')],_0x41232c)):{};}catch(_0x4da761){logger['error'](_0x4da761[_0xc775('0xf')]);}switch(_0x4a0028[_0xc775('0x7')][_0xc775('0x8')]()){case _0xc775('0x10'):case _0xc775('0x11'):_0x50db19=null;_0x51d852['qs']=_0x41232c;break;case'POST':case'PUT':if(_0x4a0028[_0xc775('0x12')]){try{_0x50db19=JSON[_0xc775('0xe')](Mustache[_0xc775('0x9')](_0x4a0028[_0xc775('0x12')],_0x41232c));_0x51d852[_0xc775('0x13')]=_0x50db19;}catch(_0x531e3c){logger[_0xc775('0x14')](_0x531e3c[_0xc775('0xf')]);logger[_0xc775('0x14')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x50db19=_0x41232c;_0x51d852[_0xc775('0x13')]=_0x50db19;}break;}logger[_0xc775('0x15')](util[_0xc775('0x16')](_0xc775('0x17'),_0x4a0028[_0xc775('0x7')],_0x4a0028[_0xc775('0x18')],JSON[_0xc775('0x19')](_0x51d852)));rp(_0x51d852)[_0xc775('0x1a')](function(_0x1fc74f){_0x50db19=!_['isNil'](_0x50db19)?_0xc775('0x1b')+_0x50db19:'';_0xf2bd76=typeof _0x1fc74f['body']===_0xc775('0x1c')?JSON['stringify'](_0x1fc74f['body']):_0x1fc74f[_0xc775('0x13')];logger[_0xc775('0x15')](util[_0xc775('0x16')](_0xc775('0x1d'),_0x4a0028[_0xc775('0x7')],_0x4a0028[_0xc775('0x18')],_0x1fc74f[_0xc775('0x1e')],_0xf2bd76));})[_0xc775('0x1f')](function(_0xf27868){logger[_0xc775('0x14')](util[_0xc775('0x16')](_0xc775('0x20'),_0x4a0028['data1'],_0x4a0028[_0xc775('0x18')],_0xf27868[_0xc775('0x1e')],_0xf27868['name'],_0xf27868[_0xc775('0x21')]));});}; \ No newline at end of file +var _0x6bc6=['error','body','info','format','then','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','trigger','exec','render','data2','data5','headers','data6','parse','stack','data1','GET','DELETE','POST','data7'];(function(_0x12ad4f,_0x3bf0e7){var _0x999891=function(_0x3448ca){while(--_0x3448ca){_0x12ad4f['push'](_0x12ad4f['shift']());}};_0x999891(++_0x3bf0e7);}(_0x6bc6,0x178));var _0x66bc=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x6bc6[_0x3817a9];return _0x443f30;};'use strict';var rp=require(_0x66bc('0x0'));var util=require('util');var _=require(_0x66bc('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x66bc('0x2'));exports[_0x66bc('0x3')]=function(_0x54cb4d,_0x21c0dd){var _0x389296,_0x285e14;var _0x1b04cc={'method':_0x54cb4d['data1']['toUpperCase'](),'uri':Mustache[_0x66bc('0x4')](_0x54cb4d[_0x66bc('0x5')],_0x21c0dd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x54cb4d[_0x66bc('0x6')])==='number'&&parseInt(_0x54cb4d[_0x66bc('0x6')])>=0x1&&parseInt(_0x54cb4d[_0x66bc('0x6')])<=0xa?parseInt(_0x54cb4d[_0x66bc('0x6')])*0x3e8:0x5*0x3e8};try{_0x1b04cc[_0x66bc('0x7')]=_0x54cb4d[_0x66bc('0x8')]?JSON[_0x66bc('0x9')](Mustache['render'](_0x54cb4d[_0x66bc('0x8')],_0x21c0dd)):{};}catch(_0x2e080d){logger['error'](_0x2e080d[_0x66bc('0xa')]);}switch(_0x54cb4d[_0x66bc('0xb')]['toUpperCase']()){case _0x66bc('0xc'):case _0x66bc('0xd'):_0x389296=null;_0x1b04cc['qs']=_0x21c0dd;break;case _0x66bc('0xe'):case'PUT':if(_0x54cb4d['data7']){try{_0x389296=JSON[_0x66bc('0x9')](Mustache['render'](_0x54cb4d[_0x66bc('0xf')],_0x21c0dd));_0x1b04cc['body']=_0x389296;}catch(_0x5c5cbd){logger['error'](_0x5c5cbd['stack']);logger[_0x66bc('0x10')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x389296=_0x21c0dd;_0x1b04cc[_0x66bc('0x11')]=_0x389296;}break;}logger[_0x66bc('0x12')](util[_0x66bc('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x54cb4d['data1'],_0x54cb4d[_0x66bc('0x5')],JSON['stringify'](_0x1b04cc)));rp(_0x1b04cc)[_0x66bc('0x14')](function(_0x1b6822){_0x389296=!_['isNil'](_0x389296)?',\x20request\x20body:\x20'+_0x389296:'';_0x285e14=typeof _0x1b6822[_0x66bc('0x11')]===_0x66bc('0x15')?JSON[_0x66bc('0x16')](_0x1b6822[_0x66bc('0x11')]):_0x1b6822['body'];logger[_0x66bc('0x12')](util['format'](_0x66bc('0x17'),_0x54cb4d[_0x66bc('0xb')],_0x54cb4d[_0x66bc('0x5')],_0x1b6822[_0x66bc('0x18')],_0x285e14));})[_0x66bc('0x19')](function(_0x4b0f7e){logger[_0x66bc('0x10')](util[_0x66bc('0x13')](_0x66bc('0x1a'),_0x54cb4d[_0x66bc('0xb')],_0x54cb4d[_0x66bc('0x5')],_0x4b0f7e['statusCode'],_0x4b0f7e[_0x66bc('0x1b')],_0x4b0f7e['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9165925..53f7f62 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 _0x0fa5=['routing','client','request','then','debug','rpc','error','message','catch','../../config/logger'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x0fa5,0xdb));var _0x50fa=function(_0x26a515,_0x286339){_0x26a515=_0x26a515-0x0;var _0x314682=_0x0fa5[_0x26a515];return _0x314682;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x50fa('0x0'))(_0x50fa('0x1'));var client=jayson[_0x50fa('0x2')]['http']({'port':0x2329});client['Request']=function(_0x19579b,_0x8d8ffc){return new BPromise(function(_0x569f87,_0x581cc){return client[_0x50fa('0x3')](_0x19579b,_0x8d8ffc)[_0x50fa('0x4')](function(_0x525e7e){logger[_0x50fa('0x5')](_0x50fa('0x6'),_0x50fa('0x1'),_0x19579b,_0x8d8ffc,_0x525e7e);if(_0x525e7e[_0x50fa('0x7')]){logger['error'](_0x50fa('0x6'),_0x50fa('0x1'),_0x19579b,_0x525e7e[_0x50fa('0x7')]['message'],_0x8d8ffc);return _0x581cc(_0x525e7e[_0x50fa('0x7')][_0x50fa('0x8')]);}else{return _0x569f87(_0x525e7e['result']);}})[_0x50fa('0x9')](function(_0x388a45){logger['error']('rpc',_0x50fa('0x1'),_0x19579b,_0x388a45,_0x8d8ffc);return _0x581cc(_0x388a45);});});};module['exports']=client; \ No newline at end of file +var _0x122e=['Request','routing','error','rpc','message','catch','jayson/promise','bluebird','client'];(function(_0xe7fd95,_0xcc3723){var _0x5ce05f=function(_0x2cd70d){while(--_0x2cd70d){_0xe7fd95['push'](_0xe7fd95['shift']());}};_0x5ce05f(++_0xcc3723);}(_0x122e,0x126));var _0xe122=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x122e[_0x122ef9];return _0x42fba0;};'use strict';var jayson=require(_0xe122('0x0'));var BPromise=require(_0xe122('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xe122('0x2')]['http']({'port':0x2329});client[_0xe122('0x3')]=function(_0x14214d,_0x27c9ac){return new BPromise(function(_0x2c7da1,_0x563a28){return client['request'](_0x14214d,_0x27c9ac)['then'](function(_0x56b58a){logger['debug']('rpc',_0xe122('0x4'),_0x14214d,_0x27c9ac,_0x56b58a);if(_0x56b58a[_0xe122('0x5')]){logger[_0xe122('0x5')](_0xe122('0x6'),_0xe122('0x4'),_0x14214d,_0x56b58a[_0xe122('0x5')][_0xe122('0x7')],_0x27c9ac);return _0x563a28(_0x56b58a['error'][_0xe122('0x7')]);}else{return _0x2c7da1(_0x56b58a['result']);}})[_0xe122('0x8')](function(_0x2423f1){logger[_0xe122('0x5')](_0xe122('0x6'),_0xe122('0x4'),_0x14214d,_0x2423f1,_0x27c9ac);return _0x563a28(_0x2423f1);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index fa05ea5..38da8f8 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 _0x6de0=['error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x3439fa,_0x5c46cd){var _0x445161=function(_0x5f3d21){while(--_0x5f3d21){_0x3439fa['push'](_0x3439fa['shift']());}};_0x445161(++_0x5c46cd);}(_0x6de0,0x71));var _0x06de=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x6de0[_0x4fbfd9];return _0x31dc94;};'use strict';var server=require(_0x06de('0x0'));var Realtime=require(_0x06de('0x1'));var EmailChannel=require(_0x06de('0x2'));var mailAccount=require(_0x06de('0x3'));var setting=require(_0x06de('0x4'));var logger=require(_0x06de('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x06de('0x6')]()[_0x06de('0x7')](mailAccount[_0x06de('0x8')]())[_0x06de('0x7')](realtime[_0x06de('0x9')]())[_0x06de('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x06de('0xa')](realtime,email)[_0x06de('0x7')](function(){return initRealtime();})[_0x06de('0x7')](function(){return setting[_0x06de('0xb')]();})[_0x06de('0x7')](function(_0x3b828d){return setInterval(initRealtime,_0x3b828d[_0x06de('0xc')]*0x3e8);})['catch'](function(_0x4ba4a6){logger[_0x06de('0xd')]('Email\x20service\x20initialization',_0x4ba4a6);});}main(); \ No newline at end of file +var _0xdaea=['catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x58c59d,_0x4ef22f){var _0x463922=function(_0x14e1e7){while(--_0x14e1e7){_0x58c59d['push'](_0x58c59d['shift']());}};_0x463922(++_0x4ef22f);}(_0xdaea,0xe0));var _0xadae=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xdaea[_0x1e4f2d];return _0xd05ce5;};'use strict';var server=require(_0xadae('0x0'));var Realtime=require(_0xadae('0x1'));var EmailChannel=require(_0xadae('0x2'));var mailAccount=require(_0xadae('0x3'));var setting=require(_0xadae('0x4'));var logger=require(_0xadae('0x5'))(_0xadae('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xadae('0x7')]()[_0xadae('0x8')](mailAccount[_0xadae('0x9')]())['then'](realtime[_0xadae('0xa')]())[_0xadae('0x8')](function(){email[_0xadae('0xb')](realtime[_0xadae('0xc')]);return realtime;});}function main(){return server[_0xadae('0xd')](realtime,email)[_0xadae('0x8')](function(){return initRealtime();})[_0xadae('0x8')](function(){return setting['getSettings']();})[_0xadae('0x8')](function(_0x2b63c6){return setInterval(initRealtime,_0x2b63c6['loginMailFrequency']*0x3e8);})[_0xadae('0xe')](function(_0x5b1663){logger[_0xadae('0xf')](_0xadae('0x10'),_0x5b1663);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 693668b..a6ee314 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 _0x0e7d=['messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','custom','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','status','prototype','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','verify','catch','exports','lodash','moment','bluebird','md5','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap'];(function(_0x175e6e,_0x12470d){var _0xdf5494=function(_0x36f903){while(--_0x36f903){_0x175e6e['push'](_0x175e6e['shift']());}};_0xdf5494(++_0x12470d);}(_0x0e7d,0x187));var _0xd0e7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0e7d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd0e7('0x0'));var moment=require(_0xd0e7('0x1'));var BPromise=require(_0xd0e7('0x2'));var md5=require(_0xd0e7('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xd0e7('0x4'))(_0xd0e7('0x5'));config[_0xd0e7('0x6')]=_[_0xd0e7('0x7')](config['redis'],{'host':_0xd0e7('0x8'),'port':0x18eb});var io=require(_0xd0e7('0x9'))(new Redis(config[_0xd0e7('0x6')]));var EmailImap=require(_0xd0e7('0xa'));var EmailSmtp=require(_0xd0e7('0xb'));var mailAccount=require(_0xd0e7('0xc'));var md5Accounts={};function EmailChannel(_0x39b62b){logger[_0xd0e7('0xd')](_0xd0e7('0xe'));this[_0xd0e7('0xf')]=_0x39b62b['mailAccounts'];this['imapAccounts']={};this[_0xd0e7('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0xd0e7('0x11')]=function(_0x8f6244){var _0x598920=this[_0xd0e7('0xf')][_0x8f6244];var _0x378bee={'id':_0x598920['id'],'name':_0x598920[_0xd0e7('0x12')],'key':_0x598920[_0xd0e7('0x13')],'active':_0x598920[_0xd0e7('0x14')],'Imap':{'status':_0x598920[_0xd0e7('0x15')]['status'],'messageStatus':_0x598920[_0xd0e7('0x15')][_0xd0e7('0x16')],'total':_0x598920[_0xd0e7('0x15')][_0xd0e7('0x17')]}};if(_['isNil'](md5Accounts[_0x8f6244])){md5Accounts[_0x8f6244]={};}var _0x390d90=md5(JSON[_0xd0e7('0x18')](_0x378bee));if(md5Accounts[_0x8f6244][_0xd0e7('0x3')]!==_0x390d90){md5Accounts[_0x8f6244][_0xd0e7('0x3')]=_0x390d90;io[_0xd0e7('0x11')](_0xd0e7('0x19'),_0x378bee);}};EmailChannel['prototype'][_0xd0e7('0x1a')]=function(_0x312853){for(var _0x5babce in _0x312853){if(_0x312853[_0xd0e7('0x1b')](_0x5babce)){if(_0x312853[_0x5babce]['Imap']&&_0x312853[_0x5babce][_0xd0e7('0x14')]){var _0x4e4cb8=_0x312853[_0x5babce][_0xd0e7('0x15')];if(!_0x4e4cb8['service']&&_0x312853[_0x5babce]['provider']!==_0xd0e7('0x1c'))_0x4e4cb8[_0xd0e7('0x1d')]=_0x312853[_0x5babce][_0xd0e7('0x1e')];if(!this[_0xd0e7('0x1f')][_0xd0e7('0x1b')](_0x4e4cb8['id'])){this[_0xd0e7('0x1f')][_0x4e4cb8['id']]=new EmailImap(_0x4e4cb8,_0x312853[_0x5babce][_0xd0e7('0x5')]);this[_0xd0e7('0x1f')][_0x4e4cb8['id']]['on'](_0xd0e7('0x20'),this[_0xd0e7('0x21')][_0xd0e7('0x22')](this,_0x5babce));this[_0xd0e7('0x1f')][_0x4e4cb8['id']]['on'](_0xd0e7('0x5'),this[_0xd0e7('0x23')][_0xd0e7('0x22')](this,_0x5babce));this['imapAccounts'][_0x4e4cb8['id']]['on'](_0xd0e7('0x24'),this[_0xd0e7('0x25')][_0xd0e7('0x22')](this,_0x5babce));this[_0xd0e7('0x1f')][_0x4e4cb8['id']]['on']('error',this[_0xd0e7('0x26')]['bind'](this,_0x5babce));}}else{if(_[_0xd0e7('0x27')](this[_0xd0e7('0xf')][_0x5babce][_0xd0e7('0x15')])){this[_0xd0e7('0xf')][_0x5babce][_0xd0e7('0x15')]={};}this[_0xd0e7('0xf')][_0x5babce]['Imap'][_0xd0e7('0x28')]='disabled';this['mailAccounts'][_0x5babce][_0xd0e7('0x15')][_0xd0e7('0x16')]='';this[_0xd0e7('0x11')](_0x5babce);}}}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x21')]=function(_0x4a26aa,_0x18202c){if(this['mailAccounts'][_0x4a26aa]){this[_0xd0e7('0xf')][_0x4a26aa]['Imap'][_0xd0e7('0x28')]=_0xd0e7('0x2a');this['mailAccounts'][_0x4a26aa][_0xd0e7('0x15')][_0xd0e7('0x16')]=_0x18202c[_0xd0e7('0x12')];if(_0x18202c[_0xd0e7('0x2b')]){this[_0xd0e7('0xf')][_0x4a26aa]['Imap'][_0xd0e7('0x17')]=_0x18202c[_0xd0e7('0x2b')][_0xd0e7('0x17')];}return this[_0xd0e7('0x11')](_0x4a26aa);}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x23')]=function(_0x147be3,_0x5e2f46){logger[_0xd0e7('0xd')](_0xd0e7('0x2c'),_0x5e2f46[_0xd0e7('0x2d')],_0x5e2f46[_0xd0e7('0x2e')],_0x5e2f46[_0xd0e7('0x2f')],_0x147be3);if(this[_0xd0e7('0xf')][_0x147be3]){return mailAccount['notify'](_0x147be3,_0x5e2f46)[_0xd0e7('0x30')](function(_0x1e8959){if(_0x1e8959){logger[_0xd0e7('0xd')](_0xd0e7('0x31'));}})['catch'](function(_0x20260d){logger[_0xd0e7('0x32')](_0xd0e7('0x33'),JSON[_0xd0e7('0x18')](_0x20260d));});}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x25')]=function(_0x1334db){if(this[_0xd0e7('0xf')][_0x1334db]&&this[_0xd0e7('0xf')][_0x1334db]['Imap']){if(this[_0xd0e7('0x1f')][this[_0xd0e7('0xf')][_0x1334db]['Imap']['id']]){delete this[_0xd0e7('0x1f')][this['mailAccounts'][_0x1334db][_0xd0e7('0x15')]['id']];}this['mailAccounts'][_0x1334db][_0xd0e7('0x15')]['lastSync']=moment();this[_0xd0e7('0x11')](_0x1334db);}};EmailChannel['prototype']['handleImapError']=function(_0x44f14c,_0xee100d){if(this[_0xd0e7('0xf')][_0x44f14c]){this[_0xd0e7('0xf')][_0x44f14c][_0xd0e7('0x15')][_0xd0e7('0x28')]='error';this[_0xd0e7('0xf')][_0x44f14c][_0xd0e7('0x15')]['messageStatus']=_0xee100d;return this['emit'](_0x44f14c);}};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x34')]=function(_0x37f3b2,_0x22e79d){return this[_0xd0e7('0x10')][_0xd0e7('0x35')](_0x37f3b2,_0x22e79d);};EmailChannel[_0xd0e7('0x29')][_0xd0e7('0x36')]=function(_0x1ae377){var _0x4717ce=this;if(this['mailAccounts'][_0x1ae377['id']]){if(_[_0xd0e7('0x27')](this['mailAccounts'][_0x1ae377['id']]['Smtp'])){this[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')]={};}this['mailAccounts'][_0x1ae377['id']][_0xd0e7('0x37')]['lastSync']=moment();return new BPromise(function(_0x5bd987,_0xfadae0){return _0x4717ce[_0xd0e7('0x10')][_0xd0e7('0x38')](_0x1ae377)['then'](function(_0xaae992){_0x4717ce['mailAccounts'][_0x1ae377['id']][_0xd0e7('0x37')]['status']='verified';_0x4717ce[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')][_0xd0e7('0x16')]='';_0x4717ce[_0xd0e7('0x11')](_0x1ae377['id']);_0x5bd987(_0xaae992);})[_0xd0e7('0x39')](function(_0x374b87){_0x4717ce[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')][_0xd0e7('0x28')]='error';_0x4717ce[_0xd0e7('0xf')][_0x1ae377['id']][_0xd0e7('0x37')]['messageStatus']=_0x374b87;_0x4717ce[_0xd0e7('0x11')](_0x1ae377['id']);_0xfadae0(_0x374b87);});});}return this['smtp'][_0xd0e7('0x38')](_0x1ae377);};module[_0xd0e7('0x3a')]=EmailChannel; \ No newline at end of file +var _0x72c5=['prototype','emit','name','key','Imap','isNil','mailAccount:update','refresh','hasOwnProperty','active','provider','custom','service','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','mailAccounts','status','disabled','messageStatus','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','imapAccounts','smtp'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0x72c5,0x68));var _0x572c=function(_0x5562fe,_0x4e809c){_0x5562fe=_0x5562fe-0x0;var _0x1829c7=_0x72c5[_0x5562fe];return _0x1829c7;};'use strict';var _=require('lodash');var moment=require(_0x572c('0x0'));var BPromise=require(_0x572c('0x1'));var md5=require(_0x572c('0x2'));var Redis=require(_0x572c('0x3'));var config=require(_0x572c('0x4'));var logger=require(_0x572c('0x5'))(_0x572c('0x6'));config[_0x572c('0x7')]=_[_0x572c('0x8')](config['redis'],{'host':_0x572c('0x9'),'port':0x18eb});var io=require(_0x572c('0xa'))(new Redis(config[_0x572c('0x7')]));var EmailImap=require(_0x572c('0xb'));var EmailSmtp=require(_0x572c('0xc'));var mailAccount=require(_0x572c('0xd'));var md5Accounts={};function EmailChannel(_0x3ec40b){logger[_0x572c('0xe')](_0x572c('0xf'));this['mailAccounts']=_0x3ec40b['mailAccounts'];this[_0x572c('0x10')]={};this[_0x572c('0x11')]=new EmailSmtp();}EmailChannel[_0x572c('0x12')][_0x572c('0x13')]=function(_0x1b38e9){var _0x3af1e5=this['mailAccounts'][_0x1b38e9];var _0x294e76={'id':_0x3af1e5['id'],'name':_0x3af1e5[_0x572c('0x14')],'key':_0x3af1e5[_0x572c('0x15')],'active':_0x3af1e5['active'],'Imap':{'status':_0x3af1e5[_0x572c('0x16')]['status'],'messageStatus':_0x3af1e5[_0x572c('0x16')]['messageStatus'],'total':_0x3af1e5[_0x572c('0x16')]['total']}};if(_[_0x572c('0x17')](md5Accounts[_0x1b38e9])){md5Accounts[_0x1b38e9]={};}var _0x232539=md5(JSON['stringify'](_0x294e76));if(md5Accounts[_0x1b38e9]['md5']!==_0x232539){md5Accounts[_0x1b38e9]['md5']=_0x232539;io['emit'](_0x572c('0x18'),_0x294e76);}};EmailChannel[_0x572c('0x12')][_0x572c('0x19')]=function(_0x347394){for(var _0x2d215c in _0x347394){if(_0x347394[_0x572c('0x1a')](_0x2d215c)){if(_0x347394[_0x2d215c]['Imap']&&_0x347394[_0x2d215c][_0x572c('0x1b')]){var _0x3a8343=_0x347394[_0x2d215c][_0x572c('0x16')];if(!_0x3a8343['service']&&_0x347394[_0x2d215c][_0x572c('0x1c')]!==_0x572c('0x1d'))_0x3a8343[_0x572c('0x1e')]=_0x347394[_0x2d215c]['provider'];if(!this['imapAccounts'][_0x572c('0x1a')](_0x3a8343['id'])){this[_0x572c('0x10')][_0x3a8343['id']]=new EmailImap(_0x3a8343,_0x347394[_0x2d215c][_0x572c('0x6')]);this[_0x572c('0x10')][_0x3a8343['id']]['on']('box',this[_0x572c('0x1f')][_0x572c('0x20')](this,_0x2d215c));this['imapAccounts'][_0x3a8343['id']]['on'](_0x572c('0x6'),this[_0x572c('0x21')][_0x572c('0x20')](this,_0x2d215c));this[_0x572c('0x10')][_0x3a8343['id']]['on'](_0x572c('0x22'),this[_0x572c('0x23')][_0x572c('0x20')](this,_0x2d215c));this[_0x572c('0x10')][_0x3a8343['id']]['on'](_0x572c('0x24'),this[_0x572c('0x25')][_0x572c('0x20')](this,_0x2d215c));}}else{if(_[_0x572c('0x17')](this[_0x572c('0x26')][_0x2d215c][_0x572c('0x16')])){this[_0x572c('0x26')][_0x2d215c][_0x572c('0x16')]={};}this['mailAccounts'][_0x2d215c][_0x572c('0x16')][_0x572c('0x27')]=_0x572c('0x28');this[_0x572c('0x26')][_0x2d215c][_0x572c('0x16')][_0x572c('0x29')]='';this[_0x572c('0x13')](_0x2d215c);}}}};EmailChannel[_0x572c('0x12')][_0x572c('0x1f')]=function(_0x5556e0,_0xf47399){if(this[_0x572c('0x26')][_0x5556e0]){this[_0x572c('0x26')][_0x5556e0][_0x572c('0x16')][_0x572c('0x27')]=_0x572c('0x2a');this[_0x572c('0x26')][_0x5556e0][_0x572c('0x16')][_0x572c('0x29')]=_0xf47399[_0x572c('0x14')];if(_0xf47399['messages']){this[_0x572c('0x26')][_0x5556e0][_0x572c('0x16')]['total']=_0xf47399[_0x572c('0x2b')][_0x572c('0x2c')];}return this[_0x572c('0x13')](_0x5556e0);}};EmailChannel[_0x572c('0x12')][_0x572c('0x21')]=function(_0x4cdaf3,_0x5119c6){logger[_0x572c('0xe')](_0x572c('0x2d'),_0x5119c6['firstName'],_0x5119c6[_0x572c('0x2e')],_0x5119c6['from'],_0x4cdaf3);if(this['mailAccounts'][_0x4cdaf3]){return mailAccount[_0x572c('0x2f')](_0x4cdaf3,_0x5119c6)[_0x572c('0x30')](function(_0x51c56a){if(_0x51c56a){logger[_0x572c('0xe')](_0x572c('0x31'));}})['catch'](function(_0x1b3c3c){logger[_0x572c('0x24')](_0x572c('0x32'),JSON[_0x572c('0x33')](_0x1b3c3c));});}};EmailChannel[_0x572c('0x12')][_0x572c('0x23')]=function(_0x27a2c1){if(this['mailAccounts'][_0x27a2c1]&&this[_0x572c('0x26')][_0x27a2c1][_0x572c('0x16')]){if(this['imapAccounts'][this[_0x572c('0x26')][_0x27a2c1][_0x572c('0x16')]['id']]){delete this['imapAccounts'][this[_0x572c('0x26')][_0x27a2c1][_0x572c('0x16')]['id']];}this[_0x572c('0x26')][_0x27a2c1][_0x572c('0x16')][_0x572c('0x34')]=moment();this['emit'](_0x27a2c1);}};EmailChannel[_0x572c('0x12')][_0x572c('0x25')]=function(_0x164db3,_0x35b109){if(this[_0x572c('0x26')][_0x164db3]){this[_0x572c('0x26')][_0x164db3]['Imap'][_0x572c('0x27')]=_0x572c('0x24');this['mailAccounts'][_0x164db3][_0x572c('0x16')][_0x572c('0x29')]=_0x35b109;return this[_0x572c('0x13')](_0x164db3);}};EmailChannel[_0x572c('0x12')][_0x572c('0x35')]=function(_0x423568,_0x59b8e1){return this[_0x572c('0x11')][_0x572c('0x36')](_0x423568,_0x59b8e1);};EmailChannel[_0x572c('0x12')][_0x572c('0x37')]=function(_0xc7136e){var _0x13b50f=this;if(this[_0x572c('0x26')][_0xc7136e['id']]){if(_[_0x572c('0x17')](this[_0x572c('0x26')][_0xc7136e['id']]['Smtp'])){this[_0x572c('0x26')][_0xc7136e['id']][_0x572c('0x38')]={};}this[_0x572c('0x26')][_0xc7136e['id']][_0x572c('0x38')][_0x572c('0x34')]=moment();return new BPromise(function(_0x4af05f,_0x5179d7){return _0x13b50f[_0x572c('0x11')][_0x572c('0x39')](_0xc7136e)[_0x572c('0x30')](function(_0xe7e036){_0x13b50f[_0x572c('0x26')][_0xc7136e['id']][_0x572c('0x38')][_0x572c('0x27')]=_0x572c('0x3a');_0x13b50f[_0x572c('0x26')][_0xc7136e['id']]['Smtp'][_0x572c('0x29')]='';_0x13b50f[_0x572c('0x13')](_0xc7136e['id']);_0x4af05f(_0xe7e036);})[_0x572c('0x3b')](function(_0xe562ab){_0x13b50f[_0x572c('0x26')][_0xc7136e['id']]['Smtp'][_0x572c('0x27')]='error';_0x13b50f['mailAccounts'][_0xc7136e['id']]['Smtp']['messageStatus']=_0xe562ab;_0x13b50f[_0x572c('0x13')](_0xc7136e['id']);_0x5179d7(_0xe562ab);});});}return this[_0x572c('0x11')]['verify'](_0xc7136e);};module[_0x572c('0x3c')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0be5339..47284fa 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 _0xa9fc=['handleMessageBody','handleSimpleParser','email','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','EventEmitter','./utils','mailbox','account','getAccount','once','ready','bind','end','handleError','connect','inherits','prototype','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchEnd','closeBox','handleCloseBox','attributes','handleMessageAttributes','handleMessageEnd'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xa9fc,0x19f));var _0xca9f=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0xa9fc[_0x4991d6];return _0x50faf7;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var Imap=require(_0xca9f('0x2'));var simpleParser=require(_0xca9f('0x3'))[_0xca9f('0x4')];var Iconv=require('iconv')[_0xca9f('0x5')];var EventEmitter=require('events')[_0xca9f('0x6')];var utils=require(_0xca9f('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x5c7268,_0x234d90){this['mailbox']=_0x5c7268[_0xca9f('0x8')];this[_0xca9f('0x9')]=this[_0xca9f('0xa')](_0x5c7268,_0x234d90);this[_0xca9f('0x2')]=new Imap(this[_0xca9f('0x9')]);this[_0xca9f('0x2')][_0xca9f('0xb')](_0xca9f('0xc'),this['handleReady'][_0xca9f('0xd')](this));this[_0xca9f('0x2')][_0xca9f('0xb')](_0xca9f('0xe'),this['handleEnd'][_0xca9f('0xd')](this));this[_0xca9f('0x2')]['on']('error',this[_0xca9f('0xf')][_0xca9f('0xd')](this));this[_0xca9f('0x2')][_0xca9f('0x10')]();}util[_0xca9f('0x11')](EmailImap,EventEmitter);EmailImap[_0xca9f('0x12')][_0xca9f('0xa')]=function(_0x2cb6f4,_0x33f8c7){var _0x864d21={'connTimeout':_0x2cb6f4['connTimeout']?_0x2cb6f4['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2cb6f4[_0xca9f('0x13')]?_0x2cb6f4['authTimeout']*0x3e8:0x1388};if(_0x2cb6f4['service']){_0x864d21[_0xca9f('0x14')]=_0x2cb6f4[_0xca9f('0x14')];_0x864d21['email']=_0x33f8c7||_0x2cb6f4[_0xca9f('0x14')]||'anonymous@xcally.com';if(_0x2cb6f4[_0xca9f('0x15')]){_0x864d21['xoauth2']=utils[_0xca9f('0x16')](_0x2cb6f4[_0xca9f('0x17')][_0xca9f('0x18')],_0x2cb6f4[_0xca9f('0x14')]);}else{_0x864d21[_0xca9f('0x19')]=_0x2cb6f4['password'];}}else{if(_0x2cb6f4[_0xca9f('0x1a')]){_0x864d21['user']=_0x2cb6f4[_0xca9f('0x14')];_0x864d21[_0xca9f('0x19')]=_0x2cb6f4[_0xca9f('0x19')];}}_0x864d21[_0xca9f('0x1b')]=_0x2cb6f4[_0xca9f('0x1b')];_0x864d21['port']=_0x2cb6f4[_0xca9f('0x1c')]||0x3e1;if(_0x2cb6f4[_0xca9f('0x1d')]){_0x864d21[_0xca9f('0x1d')]=!![];}else{_0x864d21[_0xca9f('0x1d')]=![];_0x864d21[_0xca9f('0x1e')]='required';}return _0x864d21;};EmailImap['prototype'][_0xca9f('0x1f')]=function(){this[_0xca9f('0x2')][_0xca9f('0x20')](this[_0xca9f('0x8')],![],this[_0xca9f('0x21')]['bind'](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x21')]=function(_0x46a0e8,_0x4d64eb){if(_0x46a0e8){this[_0xca9f('0xf')](_0x46a0e8,!![]);}else{this[_0xca9f('0x22')](_0xca9f('0x23'),_0x4d64eb);this[_0xca9f('0x24')]();}};EmailImap[_0xca9f('0x12')]['handleCloseBox']=function(_0xa5f9bc){if(_0xa5f9bc){this[_0xca9f('0xf')](_0xa5f9bc,!![]);}else{this[_0xca9f('0x2')][_0xca9f('0xe')]();}};EmailImap[_0xca9f('0x12')]['readUnseen']=function(){this['imap'][_0xca9f('0x25')](['UNSEEN'],this[_0xca9f('0x26')][_0xca9f('0xd')](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x26')]=function(_0x5a270a,_0x596703){if(_0x5a270a){this[_0xca9f('0xf')](_0x5a270a,!![]);}else{if(_0x596703['length']){try{var _0x26b33d=this['imap'][_0xca9f('0x27')](_0x596703,{'bodies':'','markSeen':!![]});_0x26b33d['on'](_0xca9f('0x28'),this[_0xca9f('0x29')][_0xca9f('0xd')](this));_0x26b33d[_0xca9f('0xb')](_0xca9f('0x2a'),this['handleFetchError']['bind'](this));_0x26b33d[_0xca9f('0xb')]('end',this[_0xca9f('0x2b')][_0xca9f('0xd')](this));}catch(_0x2c2d98){logger['error'](_0x2c2d98);}}else{this['imap'][_0xca9f('0x2c')](!![],this[_0xca9f('0x2d')][_0xca9f('0xd')](this));}}};EmailImap['prototype'][_0xca9f('0x29')]=function(_0xb0fd80){_0xb0fd80['on']('body',this['handleMessageBody'][_0xca9f('0xd')](this));_0xb0fd80[_0xca9f('0xb')](_0xca9f('0x2e'),this[_0xca9f('0x2f')][_0xca9f('0xd')](this));_0xb0fd80[_0xca9f('0xb')](_0xca9f('0xe'),this[_0xca9f('0x30')][_0xca9f('0xd')](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x31')]=function(_0x46339a){simpleParser(_0x46339a,{'Iconv':Iconv},this[_0xca9f('0x32')]['bind'](this));};EmailImap[_0xca9f('0x12')]['handleMessageAttributes']=function(){};EmailImap[_0xca9f('0x12')][_0xca9f('0x30')]=function(){};EmailImap['prototype'][_0xca9f('0x32')]=function(_0xa06d9f,_0x244db6){if(_0xa06d9f){logger[_0xca9f('0x2a')](_0xa06d9f);}else{var _0x2644bf=this;utils['parser'](this['account'],_0x244db6,function(_0x4b5da3){_0x2644bf[_0xca9f('0x22')](_0xca9f('0x33'),_0x4b5da3);});}};EmailImap[_0xca9f('0x12')]['handleFetchEnd']=function(){this[_0xca9f('0x2')][_0xca9f('0x2c')](!![],this['handleCloseBox'][_0xca9f('0xd')](this));};EmailImap[_0xca9f('0x12')]['handleFetchError']=function(_0x29ae50){this[_0xca9f('0xf')](_0x29ae50);this[_0xca9f('0x2')][_0xca9f('0x2c')](!![],this[_0xca9f('0x2d')]['bind'](this));};EmailImap[_0xca9f('0x12')][_0xca9f('0x34')]=function(){this['emit'](_0xca9f('0xe'));};EmailImap[_0xca9f('0x12')][_0xca9f('0xf')]=function(_0xaaf496,_0x29d300){logger[_0xca9f('0x2a')](_0xca9f('0xf'),this[_0xca9f('0x9')][_0xca9f('0x33')],JSON[_0xca9f('0x35')](_0xaaf496));var _0x2bc911='';if(_0xaaf496){if(_0xaaf496[_0xca9f('0x36')]){_0x2bc911=_0xaaf496['textCode'];}else{for(var _0x185b82 in _0xaaf496){if(_0xaaf496[_0xca9f('0x37')](_0x185b82)){_0x2bc911+=_[_0xca9f('0x38')](_0x185b82)+':\x20'+_0xaaf496[_0x185b82]+'\x0a';}}}}if(_0x29d300){this[_0xca9f('0x2')][_0xca9f('0xe')]();}else{this['emit']('error',_0x2bc911);this[_0xca9f('0x22')]('end');}};module[_0xca9f('0x39')]=EmailImap; \ No newline at end of file +var _0x292c=['handleReady','bind','once','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','box','readUnseen','search','length','message','handleFetchMessage','end','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchError','textCode','upperFirst','lodash','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','email','mailbox','account','getAccount','ready'];(function(_0x209511,_0x231622){var _0x39b937=function(_0x4005a3){while(--_0x4005a3){_0x209511['push'](_0x209511['shift']());}};_0x39b937(++_0x231622);}(_0x292c,0x66));var _0xc292=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x292c[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var Imap=require(_0xc292('0x1'));var simpleParser=require(_0xc292('0x2'))[_0xc292('0x3')];var Iconv=require(_0xc292('0x4'))[_0xc292('0x5')];var EventEmitter=require('events')[_0xc292('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xc292('0x7'));function EmailImap(_0x1c45ed,_0x2c01eb){this[_0xc292('0x8')]=_0x1c45ed[_0xc292('0x8')];this[_0xc292('0x9')]=this[_0xc292('0xa')](_0x1c45ed,_0x2c01eb);this[_0xc292('0x1')]=new Imap(this[_0xc292('0x9')]);this[_0xc292('0x1')]['once'](_0xc292('0xb'),this[_0xc292('0xc')][_0xc292('0xd')](this));this[_0xc292('0x1')][_0xc292('0xe')]('end',this[_0xc292('0xf')][_0xc292('0xd')](this));this[_0xc292('0x1')]['on'](_0xc292('0x10'),this[_0xc292('0x11')][_0xc292('0xd')](this));this['imap'][_0xc292('0x12')]();}util[_0xc292('0x13')](EmailImap,EventEmitter);EmailImap[_0xc292('0x14')][_0xc292('0xa')]=function(_0x38c865,_0x51ab23){var _0x56417e={'connTimeout':_0x38c865[_0xc292('0x15')]?_0x38c865[_0xc292('0x15')]*0x3e8:0x2710,'authTimeout':_0x38c865['authTimeout']?_0x38c865[_0xc292('0x16')]*0x3e8:0x1388};if(_0x38c865['service']){_0x56417e['user']=_0x38c865[_0xc292('0x17')];_0x56417e['email']=_0x51ab23||_0x38c865[_0xc292('0x17')]||_0xc292('0x18');if(_0x38c865[_0xc292('0x19')]){_0x56417e['xoauth2']=utils[_0xc292('0x1a')](_0x38c865['CloudProvider']['data5'],_0x38c865[_0xc292('0x17')]);}else{_0x56417e[_0xc292('0x1b')]=_0x38c865['password'];}}else{if(_0x38c865[_0xc292('0x1c')]){_0x56417e[_0xc292('0x17')]=_0x38c865[_0xc292('0x17')];_0x56417e['password']=_0x38c865['password'];}}_0x56417e[_0xc292('0x1d')]=_0x38c865[_0xc292('0x1d')];_0x56417e[_0xc292('0x1e')]=_0x38c865[_0xc292('0x1e')]||0x3e1;if(_0x38c865[_0xc292('0x1f')]){_0x56417e[_0xc292('0x1f')]=!![];}else{_0x56417e[_0xc292('0x1f')]=![];_0x56417e[_0xc292('0x20')]=_0xc292('0x21');}return _0x56417e;};EmailImap['prototype']['handleReady']=function(){this[_0xc292('0x1')][_0xc292('0x22')](this['mailbox'],![],this[_0xc292('0x23')][_0xc292('0xd')](this));};EmailImap[_0xc292('0x14')]['handleOpenBox']=function(_0x315057,_0x342d73){if(_0x315057){this['handleError'](_0x315057,!![]);}else{this['emit'](_0xc292('0x24'),_0x342d73);this[_0xc292('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x4f697b){if(_0x4f697b){this[_0xc292('0x11')](_0x4f697b,!![]);}else{this[_0xc292('0x1')]['end']();}};EmailImap[_0xc292('0x14')]['readUnseen']=function(){this[_0xc292('0x1')][_0xc292('0x26')](['UNSEEN'],this['handleReadUnseen'][_0xc292('0xd')](this));};EmailImap[_0xc292('0x14')]['handleReadUnseen']=function(_0x4f694d,_0x939e19){if(_0x4f694d){this['handleError'](_0x4f694d,!![]);}else{if(_0x939e19[_0xc292('0x27')]){try{var _0xe8a56e=this[_0xc292('0x1')]['fetch'](_0x939e19,{'bodies':'','markSeen':!![]});_0xe8a56e['on'](_0xc292('0x28'),this[_0xc292('0x29')][_0xc292('0xd')](this));_0xe8a56e[_0xc292('0xe')](_0xc292('0x10'),this['handleFetchError'][_0xc292('0xd')](this));_0xe8a56e[_0xc292('0xe')](_0xc292('0x2a'),this[_0xc292('0x2b')]['bind'](this));}catch(_0x5462e1){logger[_0xc292('0x10')](_0x5462e1);}}else{this[_0xc292('0x1')][_0xc292('0x2c')](!![],this[_0xc292('0x2d')][_0xc292('0xd')](this));}}};EmailImap[_0xc292('0x14')]['handleFetchMessage']=function(_0x563bf1){_0x563bf1['on'](_0xc292('0x2e'),this[_0xc292('0x2f')]['bind'](this));_0x563bf1[_0xc292('0xe')](_0xc292('0x30'),this[_0xc292('0x31')][_0xc292('0xd')](this));_0x563bf1[_0xc292('0xe')]('end',this[_0xc292('0x32')][_0xc292('0xd')](this));};EmailImap[_0xc292('0x14')][_0xc292('0x2f')]=function(_0x1f0d2c){simpleParser(_0x1f0d2c,{'Iconv':Iconv},this[_0xc292('0x33')]['bind'](this));};EmailImap[_0xc292('0x14')][_0xc292('0x31')]=function(){};EmailImap[_0xc292('0x14')][_0xc292('0x32')]=function(){};EmailImap[_0xc292('0x14')]['handleSimpleParser']=function(_0x5b6044,_0x2986cc){if(_0x5b6044){logger[_0xc292('0x10')](_0x5b6044);}else{var _0x2f8d2f=this;utils[_0xc292('0x34')](this['account'],_0x2986cc,function(_0x5b694c){_0x2f8d2f[_0xc292('0x35')](_0xc292('0x7'),_0x5b694c);});}};EmailImap['prototype'][_0xc292('0x2b')]=function(){this[_0xc292('0x1')]['closeBox'](!![],this[_0xc292('0x2d')][_0xc292('0xd')](this));};EmailImap['prototype'][_0xc292('0x36')]=function(_0x375cb3){this[_0xc292('0x11')](_0x375cb3);this[_0xc292('0x1')][_0xc292('0x2c')](!![],this[_0xc292('0x2d')]['bind'](this));};EmailImap[_0xc292('0x14')][_0xc292('0xf')]=function(){this[_0xc292('0x35')]('end');};EmailImap[_0xc292('0x14')]['handleError']=function(_0x5e4269,_0x2ffd2b){logger[_0xc292('0x10')](_0xc292('0x11'),this['account'][_0xc292('0x7')],JSON['stringify'](_0x5e4269));var _0x28b712='';if(_0x5e4269){if(_0x5e4269[_0xc292('0x37')]){_0x28b712=_0x5e4269[_0xc292('0x37')];}else{for(var _0x573670 in _0x5e4269){if(_0x5e4269['hasOwnProperty'](_0x573670)){_0x28b712+=_[_0xc292('0x38')](_0x573670)+':\x20'+_0x5e4269[_0x573670]+'\x0a';}}}}if(_0x2ffd2b){this[_0xc292('0x1')]['end']();}else{this['emit'](_0xc292('0x10'),_0x28b712);this[_0xc292('0x35')](_0xc292('0x2a'));}};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 9a223b6..0e538b8 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 _0x5974=['nodemailer-plugin-inline-base64','prototype','send','createTransport','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x5bde03,_0x1c4f8b){var _0xd64357=function(_0xcfa127){while(--_0xcfa127){_0x5bde03['push'](_0x5bde03['shift']());}};_0xd64357(++_0x1c4f8b);}(_0x5974,0x1dc));var _0x4597=function(_0x4cbde1,_0x5785ec){_0x4cbde1=_0x4cbde1-0x0;var _0x37d42=_0x5974[_0x4cbde1];return _0x37d42;};'use strict';var nodemailer=require(_0x4597('0x0'));var inlineBase64=require(_0x4597('0x1'));function EmailSmtp(){}EmailSmtp[_0x4597('0x2')][_0x4597('0x3')]=function(_0x320586,_0x328b3f){return new Promise(function(_0x2c56d9,_0x44d33c){var _0x14d8b1=nodemailer[_0x4597('0x4')](_0x320586);_0x14d8b1['use']('compile',inlineBase64());_0x14d8b1['sendMail'](_0x328b3f,function(_0x42b180,_0x5b71a1){if(_0x42b180){_0x44d33c(_0x42b180[_0x4597('0x5')]());}else{_0x2c56d9(_0x5b71a1);}});});};EmailSmtp[_0x4597('0x2')][_0x4597('0x6')]=function(_0x97c17b){return new Promise(function(_0x134f29,_0xe6c4ef){var _0x5f5dab=nodemailer[_0x4597('0x4')](_0x97c17b);_0x5f5dab[_0x4597('0x6')](function(_0x3f624c,_0x17ee5c){if(_0x3f624c){_0xe6c4ef(_0x3f624c['toString']());}else{if(_0x17ee5c){_0x134f29(_0x17ee5c);}else{_0xe6c4ef(_0x4597('0x7'));}}});});};module[_0x4597('0x8')]=EmailSmtp; \ No newline at end of file +var _0x1d46=['createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x1d46,0x1ca));var _0x61d4=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x1d46[_0x47a40b];return _0x19610c;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x61d4('0x0'));function EmailSmtp(){}EmailSmtp[_0x61d4('0x1')]['send']=function(_0x27e2c5,_0x54728f){return new Promise(function(_0x2f3266,_0x2bf60f){var _0x586a53=nodemailer[_0x61d4('0x2')](_0x27e2c5);_0x586a53[_0x61d4('0x3')](_0x61d4('0x4'),inlineBase64());_0x586a53[_0x61d4('0x5')](_0x54728f,function(_0xca52c2,_0x2e112b){if(_0xca52c2){_0x2bf60f(_0xca52c2[_0x61d4('0x6')]());}else{_0x2f3266(_0x2e112b);}});});};EmailSmtp[_0x61d4('0x1')][_0x61d4('0x7')]=function(_0x508d50){return new Promise(function(_0x4391be,_0x38a479){var _0x35c131=nodemailer['createTransport'](_0x508d50);_0x35c131[_0x61d4('0x7')](function(_0x5f185e,_0x2eb785){if(_0x5f185e){_0x38a479(_0x5f185e[_0x61d4('0x6')]());}else{if(_0x2eb785){_0x4391be(_0x2eb785);}else{_0x38a479(_0x61d4('0x8'));}}});});};module[_0x61d4('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 532162e..95fb07b 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 _0x221f=['headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','inReplyTo','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','email','value','address','generate','head','name','substring','indexOf','length','slice','join','Anonymous','split','pop','isEmpty','@xcally.com','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5bf17b[_0xf221('0xe')](0x0,-0x1)[_0xf221('0xf')]('\x20'):_0x4a57f7[_0xf221('0xa')];}return _0xf221('0x10');}function getLastName(_0x34068b){var _0x572dd9=_[_0xf221('0x9')](_0x34068b[_0xf221('0x6')]);if(_0x572dd9&&_0x572dd9[_0xf221('0xa')]){var _0x1a31f3=_0x572dd9[_0xf221('0xa')][_0xf221('0x11')](/\s+/);return _0x1a31f3['length']>0x1?_0x1a31f3[_0xf221('0x12')]():'';}return'';}function getMails(_0x40d475,_0x3f207f){var _0x3f8dd3='';for(var _0x1720dc=0x0;_0x1720dc<_0x3f207f[_0xf221('0x6')][_0xf221('0xd')];_0x1720dc+=0x1){if(_0x3f207f[_0xf221('0x6')][_0x1720dc][_0xf221('0x7')]!==_0x40d475){if(!_[_0xf221('0x13')](_0x3f8dd3)){_0x3f8dd3+=',';}_0x3f8dd3+=_0x3f207f['value'][_0x1720dc][_0xf221('0xa')]||_0x3f207f[_0xf221('0x6')][_0x1720dc][_0xf221('0x7')]||'';_0x3f8dd3+='\x20<';_0x3f8dd3+=_0x3f207f[_0xf221('0x6')][_0x1720dc]['address']?_0x3f207f[_0xf221('0x6')][_0x1720dc][_0xf221('0x7')]:'anonymous'+random[_0xf221('0x8')](0x6)+_0xf221('0x14');_0x3f8dd3+='>';}}return _0x3f8dd3;}function parseEmail(_0x3ec196,_0x338954,_0x536850){if(_0x338954[_0xf221('0x15')]){var _0x232e01=/)<[^<]*)*<\/script>/gi;while(_0x232e01['test'](_0x338954['html'])){_0x338954[_0xf221('0x15')]=_0x338954[_0xf221('0x15')][_0xf221('0x16')](_0x232e01,'');}if(_0x338954[_0xf221('0x15')][_0xf221('0x17')]('{_0x46a275[_0xf221('0x1a')](_0x1fef75[_0xf221('0x1b')]);});var _0x1e5926=/]+>/g;var _0xed98af=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x488475=_0x338954[_0xf221('0x15')][_0xf221('0x16')](_0xed98af,_0xf221('0x1c'));var _0x1b1898=_0x488475['replace'](_0x1e5926,'_IMG');for(let _0x22b12c=0x0;_0x22b12c<_0x46a275[_0xf221('0xd')];_0x22b12c++){var _0x16b563=_0x1b1898[_0xf221('0x16')](_0xf221('0x1d'),_0xf221('0x1e')+_0x46a275[_0x22b12c]+_0xf221('0x1f'));_0x1b1898=_0x16b563;}_0x338954[_0xf221('0x15')]=_0x1b1898;}_0x536850[_0xf221('0x20')]=_0x338954[_0xf221('0x15')];}else{_0x536850[_0xf221('0x20')]=_0x338954[_0xf221('0x21')];}if(_0x536850[_0xf221('0x20')]){_0x536850[_0xf221('0x20')]=_0x536850[_0xf221('0x20')][_0xf221('0x16')](/0x0){var _0x38c18d=[_0xf221('0x30'),_0xf221('0x31'),_0xf221('0x32')];for(var _0x95a6ef=0x0;_0x95a6ef<_0x338954[_0xf221('0x2f')][_0xf221('0xd')];_0x95a6ef++){var _0x54e423=_[_0xf221('0xc')](_0x38c18d,_0x338954['headerLines'][_0x95a6ef][_0xf221('0x33')]);if(_0x54e423>=0x0){_0x536850[_0xf221('0x34')]=!![];}}}return _0x536850;}exports['parser']=function(_0x14de18,_0x28726d,_0x81a8e3){var _0x1a92c2={'from':getAddress(_0x28726d['from']),'firstName':getFirstName(_0x28726d['from']),'lastName':getLastName(_0x28726d[_0xf221('0x35')]),'mapKey':_0xf221('0x5'),'message':{'from':getMails(_0x14de18[_0xf221('0x5')],_0x28726d['from']),'to':_0x14de18['email'],'cc':'','subject':_0x28726d[_0xf221('0x36')]||'','messageId':_0x28726d['messageId'],'inReplyTo':_0x28726d[_0xf221('0x37')],'sentAt':moment(_0x28726d['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x28726d[_0xf221('0x15')]&&!_0x28726d[_0xf221('0x21')]){var _0x86bc90=_['filter'](_0x28726d['attachments'],{'contentType':_0xf221('0x38')});if(_0x86bc90['length']){logger[_0xf221('0x39')](util[_0xf221('0x29')](_0xf221('0x3a'),_0x28726d[_0xf221('0x3b')]));tnef[_0xf221('0x3c')](_[_0xf221('0x3d')](_0x86bc90)['content'],function(_0x420e14,_0x49aff8){if(_0x49aff8){_0x28726d['html']=_0x49aff8[_0xf221('0x3e')]||_0xf221('0x3f');if(_0x49aff8[_0xf221('0x40')]){for(var _0x587242=0x0;_0x587242<_0x49aff8['Attachments']['length'];_0x587242++){var _0x871477=_0x49aff8[_0xf221('0x40')][_0x587242];_0x1a92c2['message'][_0xf221('0x18')][_0xf221('0x1a')]({'filename':_0x871477[_0xf221('0x41')],'content':Buffer[_0xf221('0x35')](_0x871477[_0xf221('0x42')])});}}}_0x81a8e3(parseEmail(_0x14de18,_0x28726d,_0x1a92c2));});}else{_0x28726d[_0xf221('0x15')]=_0xf221('0x3f');_0x81a8e3(parseEmail(_0x14de18,_0x28726d,_0x1a92c2));}}else{_0x81a8e3(parseEmail(_0x14de18,_0x28726d,_0x1a92c2));}};exports['generateXOAuth2Token']=function(_0x555271,_0x2b159e){var _0x57b4eb=[_0xf221('0x43')+(_0x2b159e||''),'auth=Bearer\x20'+_0x555271,'',''];return Buffer[_0xf221('0x35')](_0x57b4eb[_0xf221('0xf')](''),_0xf221('0x44'))[_0xf221('0x45')](_0xf221('0x46'));}; \ No newline at end of file +var _0x260f=['user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','slice','join','pop','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachments','attach','type','attachment','format','%s-%s','now','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x260f,0x1cd));var _0xf260=function(_0x5acf09,_0xfb6440){_0x5acf09=_0x5acf09-0x0;var _0x131d82=_0x260f[_0x5acf09];return _0x131d82;};'use strict';var _=require(_0xf260('0x0'));var moment=require(_0xf260('0x1'));var random=require(_0xf260('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xf260('0x3'));var tnef=require(_0xf260('0x4'));var logger=require('../../../config/logger')(_0xf260('0x5'));var config=require(_0xf260('0x6'));function getAddress(_0x219666){var _0x44bdde=_[_0xf260('0x7')](_0x219666[_0xf260('0x8')]);return _0x44bdde&&_0x44bdde[_0xf260('0x9')]?_0x44bdde[_0xf260('0x9')]:_0xf260('0xa')+random[_0xf260('0xb')](0x6)+_0xf260('0xc');}function getFirstName(_0x2df17a){var _0x325585=_[_0xf260('0x7')](_0x2df17a[_0xf260('0x8')]);if(_0x325585&&_0x325585[_0xf260('0xd')]){if(_0x325585['name']==_0x325585[_0xf260('0x9')]){return _0x325585[_0xf260('0xd')][_0xf260('0xe')](0x0,_0x325585[_0xf260('0xd')][_0xf260('0xf')]('@'));}var _0x18944c=_0x325585[_0xf260('0xd')][_0xf260('0x10')](/\s+/);return _0x18944c['length']>0x1?_0x18944c[_0xf260('0x11')](0x0,-0x1)[_0xf260('0x12')]('\x20'):_0x325585[_0xf260('0xd')];}return'Anonymous';}function getLastName(_0x5cfd3d){var _0x21216a=_['head'](_0x5cfd3d['value']);if(_0x21216a&&_0x21216a['name']){var _0x225321=_0x21216a[_0xf260('0xd')]['split'](/\s+/);return _0x225321['length']>0x1?_0x225321[_0xf260('0x13')]():'';}return'';}function getMails(_0x430208,_0x5b9bd4){var _0x1b1207='';for(var _0x2413a1=0x0;_0x2413a1<_0x5b9bd4[_0xf260('0x8')]['length'];_0x2413a1+=0x1){if(_0x5b9bd4[_0xf260('0x8')][_0x2413a1]['address']!==_0x430208){if(!_[_0xf260('0x14')](_0x1b1207)){_0x1b1207+=',';}_0x1b1207+=_0x5b9bd4['value'][_0x2413a1][_0xf260('0xd')]||_0x5b9bd4[_0xf260('0x8')][_0x2413a1][_0xf260('0x9')]||'';_0x1b1207+='\x20<';_0x1b1207+=_0x5b9bd4['value'][_0x2413a1][_0xf260('0x9')]?_0x5b9bd4['value'][_0x2413a1][_0xf260('0x9')]:_0xf260('0xa')+random[_0xf260('0xb')](0x6)+_0xf260('0xc');_0x1b1207+='>';}}return _0x1b1207;}function parseEmail(_0x21aa3f,_0x56ff72,_0xe9e616){if(_0x56ff72['html']){var _0x4b0ae2=/)<[^<]*)*<\/script>/gi;while(_0x4b0ae2[_0xf260('0x15')](_0x56ff72[_0xf260('0x16')])){_0x56ff72[_0xf260('0x16')]=_0x56ff72[_0xf260('0x16')][_0xf260('0x17')](_0x4b0ae2,'');}if(_0x56ff72['html'][_0xf260('0x18')](_0xf260('0x19'))){var _0x9b5dd0=[];_0x56ff72['attachments'][_0xf260('0x1a')](_0x24534a=>{_0x9b5dd0[_0xf260('0x1b')](_0x24534a[_0xf260('0x1c')]);});var _0x2efd09=/]+>/g;var _0x38fc57=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x449cd8=_0x56ff72[_0xf260('0x16')]['replace'](_0x38fc57,_0xf260('0x1d'));var _0xa71eba=_0x449cd8[_0xf260('0x17')](_0x2efd09,_0xf260('0x1e'));for(let _0x22136e=0x0;_0x22136e<_0x9b5dd0[_0xf260('0x1f')];_0x22136e++){var _0x14e998=_0xa71eba[_0xf260('0x17')]('_IMG',_0xf260('0x20')+_0x9b5dd0[_0x22136e]+_0xf260('0x21'));_0xa71eba=_0x14e998;}_0x56ff72[_0xf260('0x16')]=_0xa71eba;}_0xe9e616[_0xf260('0x22')]=_0x56ff72[_0xf260('0x16')];}else{_0xe9e616[_0xf260('0x22')]=_0x56ff72[_0xf260('0x23')];}if(_0xe9e616[_0xf260('0x22')]){_0xe9e616['body']=_0xe9e616[_0xf260('0x22')][_0xf260('0x17')](/0x0){var _0x37e811=[_0xf260('0x32'),'X-Auto-Response-Suppress:\x20All',_0xf260('0x33')];for(var _0x99bc7b=0x0;_0x99bc7b<_0x56ff72[_0xf260('0x31')][_0xf260('0x1f')];_0x99bc7b++){var _0x109a29=_[_0xf260('0xf')](_0x37e811,_0x56ff72[_0xf260('0x31')][_0x99bc7b][_0xf260('0x34')]);if(_0x109a29>=0x0){_0xe9e616[_0xf260('0x35')]=!![];}}}return _0xe9e616;}exports['parser']=function(_0x57ffc0,_0x3b29af,_0x1bdb63){var _0x52f0b4={'from':getAddress(_0x3b29af[_0xf260('0x36')]),'firstName':getFirstName(_0x3b29af['from']),'lastName':getLastName(_0x3b29af['from']),'mapKey':_0xf260('0x5'),'message':{'from':getMails(_0x57ffc0[_0xf260('0x5')],_0x3b29af[_0xf260('0x36')]),'to':_0x57ffc0[_0xf260('0x5')],'cc':'','subject':_0x3b29af[_0xf260('0x37')]||'','messageId':_0x3b29af[_0xf260('0x38')],'inReplyTo':_0x3b29af[_0xf260('0x39')],'sentAt':moment(_0x3b29af[_0xf260('0x3a')])[_0xf260('0x2c')](_0xf260('0x3b')),'attach':![],'attachments':[]}};if(!_0x3b29af[_0xf260('0x16')]&&!_0x3b29af[_0xf260('0x23')]){var _0x32a934=_[_0xf260('0x3c')](_0x3b29af[_0xf260('0x28')],{'contentType':_0xf260('0x3d')});if(_0x32a934[_0xf260('0x1f')]){logger[_0xf260('0x3e')](util['format'](_0xf260('0x3f'),_0x3b29af[_0xf260('0x38')]));tnef[_0xf260('0x40')](_[_0xf260('0x41')](_0x32a934)[_0xf260('0x2f')],function(_0x1427d6,_0x456af4){if(_0x456af4){_0x3b29af[_0xf260('0x16')]=_0x456af4[_0xf260('0x42')]||_0xf260('0x43');if(_0x456af4[_0xf260('0x44')]){for(var _0x3af3ee=0x0;_0x3af3ee<_0x456af4[_0xf260('0x44')][_0xf260('0x1f')];_0x3af3ee++){var _0x454790=_0x456af4[_0xf260('0x44')][_0x3af3ee];_0x52f0b4['message']['attachments'][_0xf260('0x1b')]({'filename':_0x454790['Title'],'content':Buffer['from'](_0x454790[_0xf260('0x45')])});}}}_0x1bdb63(parseEmail(_0x57ffc0,_0x3b29af,_0x52f0b4));});}else{_0x3b29af[_0xf260('0x16')]='

Empty\x20message

';_0x1bdb63(parseEmail(_0x57ffc0,_0x3b29af,_0x52f0b4));}}else{_0x1bdb63(parseEmail(_0x57ffc0,_0x3b29af,_0x52f0b4));}};exports[_0xf260('0x46')]=function(_0x3d5691,_0x3f9492){var _0x3e1835=[_0xf260('0x47')+(_0x3f9492||''),_0xf260('0x48')+_0x3d5691,'',''];return Buffer[_0xf260('0x36')](_0x3e1835[_0xf260('0x12')](''),_0xf260('0x49'))[_0xf260('0x4a')](_0xf260('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 13ce2a1..da08fba 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 _0xbc8f=['lodash','name','Service','key','active','Imap','Smtp'];(function(_0x4d96e7,_0x2dc0dc){var _0x51166a=function(_0xe9a33d){while(--_0xe9a33d){_0x4d96e7['push'](_0x4d96e7['shift']());}};_0x51166a(++_0x2dc0dc);}(_0xbc8f,0xf5));var _0xfbc8=function(_0x354cf3,_0x59ed03){_0x354cf3=_0x354cf3-0x0;var _0x2c4856=_0xbc8f[_0x354cf3];return _0x2c4856;};'use strict';var _=require(_0xfbc8('0x0'));function MailAccount(_0x40c349){this['id']=_0x40c349['id']||0x0;this[_0xfbc8('0x1')]=_0x40c349[_0xfbc8('0x1')]||_0xfbc8('0x2');this[_0xfbc8('0x3')]=_0x40c349[_0xfbc8('0x3')]||'SERV';this[_0xfbc8('0x4')]=_0x40c349[_0xfbc8('0x4')]||![];this[_0xfbc8('0x5')]=_0x40c349[_0xfbc8('0x5')]||[];this[_0xfbc8('0x6')]=_0x40c349['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xfaf1=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x445d81,_0x1c5591){var _0x463432=function(_0x53da32){while(--_0x53da32){_0x445d81['push'](_0x445d81['shift']());}};_0x463432(++_0x1c5591);}(_0xfaf1,0xe8));var _0x1faf=function(_0x2c1345,_0x38d57a){_0x2c1345=_0x2c1345-0x0;var _0x5c7948=_0xfaf1[_0x2c1345];return _0x5c7948;};'use strict';var _=require(_0x1faf('0x0'));function MailAccount(_0x5736e7){this['id']=_0x5736e7['id']||0x0;this[_0x1faf('0x1')]=_0x5736e7[_0x1faf('0x1')]||_0x1faf('0x2');this['key']=_0x5736e7[_0x1faf('0x3')]||_0x1faf('0x4');this[_0x1faf('0x5')]=_0x5736e7[_0x1faf('0x5')]||![];this[_0x1faf('0x6')]=_0x5736e7[_0x1faf('0x6')]||[];this['Smtp']=_0x5736e7[_0x1faf('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 44bb80e..71747f7 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 _0x45fa=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x45fa,0xa3));var _0xa45f=function(_0x43ae31,_0x4465a1){_0x43ae31=_0x43ae31-0x0;var _0x34891b=_0x45fa[_0x43ae31];return _0x34891b;};'use strict';var _=require(_0xa45f('0x0'));var MailAccount=require(_0xa45f('0x1'));var Realtime=function(){this[_0xa45f('0x2')]={};};function freeIsNotKey(_0x3b91bd,_0x34be1d,_0x544cf4){var _0xcfd4a4=_[_0xa45f('0x3')](_0x3b91bd,function(_0x57ec9f,_0xa84f87){return _0x57ec9f[_0x544cf4];});for(var _0x57e91a in _0x34be1d){if(_0x34be1d[_0xa45f('0x4')](_0x57e91a)){if(!_0xcfd4a4[_0x57e91a]){delete _0x34be1d[_0x57e91a];}}}}Realtime[_0xa45f('0x5')][_0xa45f('0x6')]=function(_0x56411f,_0x390594){for(var _0x304bf9 in _0x390594){if(_0x56411f['hasOwnProperty'](_0x304bf9)){_0x56411f[_0x304bf9]=_0x390594[_0x304bf9];}}};Realtime[_0xa45f('0x5')]['initMailAccounts']=function(){var _0x924138=this;return function(_0x4436ae){if(_0x4436ae){freeIsNotKey(_0x4436ae,_0x924138[_0xa45f('0x2')],'id');for(var _0x5c8991=0x0,_0x552f09={},_0x21c07e={};_0x5c8991<_0x4436ae[_0xa45f('0x7')];_0x5c8991+=0x1){_0x552f09=_0x4436ae[_0x5c8991];if(_[_0xa45f('0x8')](_0x924138[_0xa45f('0x2')][_0x552f09['id']])){_0x924138[_0xa45f('0x2')][_0x552f09['id']]=new MailAccount(_0x552f09);}else{_[_0xa45f('0x9')](_0x924138['mailAccounts'][_0x552f09['id']],_0x552f09);}}}return _0x924138[_0xa45f('0x2')];};};module[_0xa45f('0xa')]=Realtime; \ No newline at end of file +var _0x1b4e=['exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x1b4e,0xf1));var _0xe1b4=function(_0x172499,_0x121198){_0x172499=_0x172499-0x0;var _0x28a7f0=_0x1b4e[_0x172499];return _0x28a7f0;};'use strict';var _=require(_0xe1b4('0x0'));var MailAccount=require(_0xe1b4('0x1'));var Realtime=function(){this[_0xe1b4('0x2')]={};};function freeIsNotKey(_0xefbe33,_0x3eb005,_0x427fa7){var _0x1a37cb=_['mapKeys'](_0xefbe33,function(_0x5a236d,_0x2b4605){return _0x5a236d[_0x427fa7];});for(var _0x15437a in _0x3eb005){if(_0x3eb005[_0xe1b4('0x3')](_0x15437a)){if(!_0x1a37cb[_0x15437a]){delete _0x3eb005[_0x15437a];}}}}Realtime[_0xe1b4('0x4')][_0xe1b4('0x5')]=function(_0x5cf517,_0x1d12ba){for(var _0x4a51ed in _0x1d12ba){if(_0x5cf517[_0xe1b4('0x3')](_0x4a51ed)){_0x5cf517[_0x4a51ed]=_0x1d12ba[_0x4a51ed];}}};Realtime[_0xe1b4('0x4')]['initMailAccounts']=function(){var _0x45302e=this;return function(_0x19c4b1){if(_0x19c4b1){freeIsNotKey(_0x19c4b1,_0x45302e[_0xe1b4('0x2')],'id');for(var _0xed434b=0x0,_0x1a1692={},_0x21098e={};_0xed434b<_0x19c4b1[_0xe1b4('0x6')];_0xed434b+=0x1){_0x1a1692=_0x19c4b1[_0xed434b];if(_[_0xe1b4('0x7')](_0x45302e['mailAccounts'][_0x1a1692['id']])){_0x45302e[_0xe1b4('0x2')][_0x1a1692['id']]=new MailAccount(_0x1a1692);}else{_[_0xe1b4('0x8')](_0x45302e[_0xe1b4('0x2')][_0x1a1692['id']],_0x1a1692);}}}return _0x45302e[_0xe1b4('0x2')];};};module[_0xe1b4('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 245b375..7bad2eb 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 _0x5cd5=['active','key','ListId','Imap','type','data5','MailServerOut','CloudProvider','notify','../client','getMailAccounts','Request','GetMailAccount','name','service','email'];(function(_0x1b4cd6,_0x5f3733){var _0x1b10f9=function(_0x15b45b){while(--_0x15b45b){_0x1b4cd6['push'](_0x1b4cd6['shift']());}};_0x1b10f9(++_0x5f3733);}(_0x5cd5,0x149));var _0x55cd=function(_0x212228,_0x44d0d3){_0x212228=_0x212228-0x0;var _0x502230=_0x5cd5[_0x212228];return _0x502230;};'use strict';var client=require(_0x55cd('0x0'));exports[_0x55cd('0x1')]=function(){return function(){return client[_0x55cd('0x2')](_0x55cd('0x3'),{'options':{'attributes':['id',_0x55cd('0x4'),'provider',_0x55cd('0x5'),_0x55cd('0x6'),_0x55cd('0x7'),_0x55cd('0x8'),_0x55cd('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x55cd('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x55cd('0x4'),_0x55cd('0x5'),_0x55cd('0xb'),_0x55cd('0xc')],'as':'CloudProvider'}]},{'model':_0x55cd('0xd'),'as':'Smtp','include':[{'model':_0x55cd('0xe'),'attributes':['id',_0x55cd('0x4'),'service',_0x55cd('0xb'),_0x55cd('0xc')],'as':_0x55cd('0xe')}]}]},'log':'getMailAccount'});};};exports[_0x55cd('0xf')]=function(_0xaae085,_0x5a4d3e){return client[_0x55cd('0x2')]('NotifyMailAccount',{'account':{'id':_0xaae085},'body':_0x5a4d3e,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x7827=['provider','email','active','key','ListId','Imap','CloudProvider','name','service','type','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x5ab0c2,_0x50efc8){var _0xfbc02=function(_0x577b56){while(--_0x577b56){_0x5ab0c2['push'](_0x5ab0c2['shift']());}};_0xfbc02(++_0x50efc8);}(_0x7827,0x19d));var _0x7782=function(_0x260593,_0x2bdb5f){_0x260593=_0x260593-0x0;var _0x63c998=_0x7827[_0x260593];return _0x63c998;};'use strict';var client=require(_0x7782('0x0'));exports[_0x7782('0x1')]=function(){return function(){return client[_0x7782('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0x7782('0x3'),'service',_0x7782('0x4'),_0x7782('0x5'),_0x7782('0x6'),_0x7782('0x7'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x7782('0x8'),'include':[{'model':_0x7782('0x9'),'attributes':['id',_0x7782('0xa'),_0x7782('0xb'),_0x7782('0xc'),'data5'],'as':_0x7782('0x9')}]},{'model':'MailServerOut','as':_0x7782('0xd'),'include':[{'model':_0x7782('0x9'),'attributes':['id',_0x7782('0xa'),_0x7782('0xb'),_0x7782('0xc'),'data5'],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x7782('0xe')]=function(_0x1a8493,_0x3f288a){return client['Request'](_0x7782('0xf'),{'account':{'id':_0x1a8493},'body':_0x3f288a,'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 242f20a..fcd9ccf 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 _0x8a78=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a78,0x1ae));var _0x88a7=function(_0x2423d7,_0xe6ec57){_0x2423d7=_0x2423d7-0x0;var _0x151d17=_0x8a78[_0x2423d7];return _0x151d17;};'use strict';var client=require(_0x88a7('0x0'));exports[_0x88a7('0x1')]=function(){return client['Request'](_0x88a7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x88a7('0x3')]},'log':_0x88a7('0x4')});}; \ No newline at end of file +var _0x81fe=['getSettings','Request','ShowSetting','GetSettings'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x81fe,0x90));var _0xe81f=function(_0x57f6ea,_0x3e1bde){_0x57f6ea=_0x57f6ea-0x0;var _0x2ee0c0=_0x81fe[_0x57f6ea];return _0x2ee0c0;};'use strict';var client=require('../client');exports[_0xe81f('0x0')]=function(){return client[_0xe81f('0x1')](_0xe81f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe81f('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d6dea78..95580a8 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 83d41d0..5bbce8f 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 _0x90b9=['socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x90b9,0x17a));var _0x990b=function(_0x5e5da7,_0x27613f){_0x5e5da7=_0x5e5da7-0x0;var _0x46e66d=_0x90b9[_0x5e5da7];return _0x46e66d;};'use strict';var _=require('lodash');var http=require(_0x990b('0x0'));var express=require('express');var sticky=require(_0x990b('0x1'));var Redis=require('ioredis');var config=require(_0x990b('0x2'));var app=express();var server=http[_0x990b('0x3')](app);server[_0x990b('0x4')]=0xdbba0;if(sticky[_0x990b('0x5')](server,config[_0x990b('0x6')])){var socketio=require(_0x990b('0x7'))(server,{'transports':[_0x990b('0x8'),'polling']});config[_0x990b('0x9')]=_[_0x990b('0xa')](config[_0x990b('0x9')],{'host':_0x990b('0xb'),'port':0x18eb});socketio[_0x990b('0xc')](require(_0x990b('0xd'))({'pubClient':new Redis(config[_0x990b('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x990b('0xe'))[_0x990b('0xf')]();require(_0x990b('0x10'))[_0x990b('0xf')](socketio);require(_0x990b('0x11'))[_0x990b('0xf')](app);require('../../routes')[_0x990b('0xf')](app);}else{server[_0x990b('0x12')](_0x990b('0x13'),function(){console[_0x990b('0x14')](_0x990b('0x15'),config[_0x990b('0x6')]);});}exports=module[_0x990b('0x16')]=app; \ No newline at end of file +var _0x923d=['defaults','localhost','adapter','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis'];(function(_0x2a895f,_0x56e2da){var _0x2bcb7b=function(_0x1d507b){while(--_0x1d507b){_0x2a895f['push'](_0x2a895f['shift']());}};_0x2bcb7b(++_0x56e2da);}(_0x923d,0x19b));var _0xd923=function(_0x54d9ec,_0x348d77){_0x54d9ec=_0x54d9ec-0x0;var _0x137080=_0x923d[_0x54d9ec];return _0x137080;};'use strict';var _=require(_0xd923('0x0'));var http=require(_0xd923('0x1'));var express=require(_0xd923('0x2'));var sticky=require(_0xd923('0x3'));var Redis=require(_0xd923('0x4'));var config=require(_0xd923('0x5'));var app=express();var server=http[_0xd923('0x6')](app);server[_0xd923('0x7')]=0xdbba0;if(sticky[_0xd923('0x8')](server,config[_0xd923('0x9')])){var socketio=require(_0xd923('0xa'))(server,{'transports':[_0xd923('0xb'),_0xd923('0xc')]});config[_0xd923('0xd')]=_[_0xd923('0xe')](config[_0xd923('0xd')],{'host':_0xd923('0xf'),'port':0x18eb});socketio[_0xd923('0x10')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xd923('0xd')])}));require('../../config/triggers')[_0xd923('0x11')]();require(_0xd923('0x12'))[_0xd923('0x11')](socketio);require(_0xd923('0x13'))['default'](app);require('../../routes')[_0xd923('0x11')](app);}else{server[_0xd923('0x14')](_0xd923('0x15'),function(){console[_0xd923('0x16')](_0xd923('0x17'),config[_0xd923('0x9')]);});}exports=module[_0xd923('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index cbbc631..65802dd 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 _0x5d59=['Request','request','then','rpc','message','error','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x3c8f6b,_0x5c5156){var _0x2f69f6=function(_0x14b01b){while(--_0x14b01b){_0x3c8f6b['push'](_0x3c8f6b['shift']());}};_0x2f69f6(++_0x5c5156);}(_0x5d59,0x13c));var _0x95d5=function(_0x195223,_0x121404){_0x195223=_0x195223-0x0;var _0x3a62dd=_0x5d59[_0x195223];return _0x3a62dd;};'use strict';var jayson=require(_0x95d5('0x0'));var BPromise=require(_0x95d5('0x1'));var logger=require(_0x95d5('0x2'))(_0x95d5('0x3'));var client=jayson[_0x95d5('0x4')][_0x95d5('0x5')]({'port':0x2329});client[_0x95d5('0x6')]=function(_0x43e1d4,_0x3fb28f){return new BPromise(function(_0xf1fc5d,_0x3f1de1){return client[_0x95d5('0x7')](_0x43e1d4,_0x3fb28f)[_0x95d5('0x8')](function(_0xb8a227){logger['debug'](_0x95d5('0x9'),_0x95d5('0x3'),_0x43e1d4,_0x3fb28f,_0xb8a227);if(_0xb8a227['error']){logger['error']('rpc',_0x95d5('0x3'),_0x43e1d4,_0xb8a227['error'][_0x95d5('0xa')],_0x3fb28f);return _0x3f1de1(_0xb8a227[_0x95d5('0xb')][_0x95d5('0xa')]);}else{return _0xf1fc5d(_0xb8a227['result']);}})[_0x95d5('0xc')](function(_0x485f7a){logger[_0x95d5('0xb')]('rpc',_0x95d5('0x3'),_0x43e1d4,_0x485f7a,_0x3fb28f);return _0x3f1de1(_0x485f7a);});});};module[_0x95d5('0xd')]=client; \ No newline at end of file +var _0xeaf1=['rpc','error','message','exports','jayson/promise','../../config/logger','routing','client','http','debug'];(function(_0x165838,_0x3ac9f2){var _0x5921f5=function(_0x2ca083){while(--_0x2ca083){_0x165838['push'](_0x165838['shift']());}};_0x5921f5(++_0x3ac9f2);}(_0xeaf1,0x1d0));var _0x1eaf=function(_0x1db621,_0x5c3587){_0x1db621=_0x1db621-0x0;var _0x348da5=_0xeaf1[_0x1db621];return _0x348da5;};'use strict';var jayson=require(_0x1eaf('0x0'));var BPromise=require('bluebird');var logger=require(_0x1eaf('0x1'))(_0x1eaf('0x2'));var client=jayson[_0x1eaf('0x3')][_0x1eaf('0x4')]({'port':0x2329});client['Request']=function(_0x3d1f35,_0x8b0515){return new BPromise(function(_0x321807,_0x47dc1d){return client['request'](_0x3d1f35,_0x8b0515)['then'](function(_0x3bf6e3){logger[_0x1eaf('0x5')](_0x1eaf('0x6'),'routing',_0x3d1f35,_0x8b0515,_0x3bf6e3);if(_0x3bf6e3[_0x1eaf('0x7')]){logger[_0x1eaf('0x7')](_0x1eaf('0x6'),_0x1eaf('0x2'),_0x3d1f35,_0x3bf6e3[_0x1eaf('0x7')][_0x1eaf('0x8')],_0x8b0515);return _0x47dc1d(_0x3bf6e3[_0x1eaf('0x7')][_0x1eaf('0x8')]);}else{return _0x321807(_0x3bf6e3['result']);}})['catch'](function(_0x2d9893){logger[_0x1eaf('0x7')](_0x1eaf('0x6'),'routing',_0x3d1f35,_0x2d9893,_0x8b0515);return _0x47dc1d(_0x2d9893);});});};module[_0x1eaf('0x9')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ac63d6d..bc0da43 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 _0xb57b=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval'];(function(_0x369c66,_0x12b66f){var _0x1ed4ca=function(_0x5061e0){while(--_0x5061e0){_0x369c66['push'](_0x369c66['shift']());}};_0x1ed4ca(++_0x12b66f);}(_0xb57b,0xab));var _0xbb57=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb57b[_0x2763f2];return _0x3ef471;};'use strict';var BPromise=require(_0xbb57('0x0'));var server=require(_0xbb57('0x1'));var Realtime=require('./realtime');var user=require(_0xbb57('0x2'));var interval=require(_0xbb57('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbb57('0x4'));var mailQueue=require(_0xbb57('0x5'));var faxQueue=require(_0xbb57('0x6'));var whatsappQueue=require(_0xbb57('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbb57('0x8')]()[_0xbb57('0x9')](user[_0xbb57('0xa')]())[_0xbb57('0x9')](realtime[_0xbb57('0xb')]())[_0xbb57('0x9')](interval[_0xbb57('0xc')]())[_0xbb57('0x9')](realtime[_0xbb57('0xd')]())[_0xbb57('0x9')](openchannelQueue[_0xbb57('0xe')]())[_0xbb57('0x9')](realtime[_0xbb57('0xf')]())['then'](chatQueue[_0xbb57('0x10')]())['then'](realtime['initChatQueues']())[_0xbb57('0x9')](smsQueue[_0xbb57('0x11')]())[_0xbb57('0x9')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())['then'](realtime[_0xbb57('0x12')]())[_0xbb57('0x9')](faxQueue[_0xbb57('0x13')]())['then'](realtime[_0xbb57('0x14')]())[_0xbb57('0x9')](whatsappQueue['getWhatsappQueues']())[_0xbb57('0x9')](realtime[_0xbb57('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xbb57('0x16')](realtime)['then'](function(_0x3a6a28){return initRealtime();})[_0xbb57('0x9')](function(_0x4d0886){return setInterval(initRealtime,0x1388);})[_0xbb57('0x17')](function(_0x458cdb){console[_0xbb57('0x18')](_0x458cdb);});}main(); \ No newline at end of file +var _0xaed7=['initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0xaed7,0x9c));var _0x7aed=function(_0x1c12c7,_0xf6ca2e){_0x1c12c7=_0x1c12c7-0x0;var _0x4c372d=_0xaed7[_0x1c12c7];return _0x4c372d;};'use strict';var BPromise=require(_0x7aed('0x0'));var server=require(_0x7aed('0x1'));var Realtime=require(_0x7aed('0x2'));var user=require('./rpc/user');var interval=require(_0x7aed('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7aed('0x4'));var smsQueue=require(_0x7aed('0x5'));var mailQueue=require(_0x7aed('0x6'));var faxQueue=require(_0x7aed('0x7'));var whatsappQueue=require(_0x7aed('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7aed('0x9')]()['then'](user['getAgents']())[_0x7aed('0xa')](realtime['initAgents']())[_0x7aed('0xa')](interval[_0x7aed('0xb')]())['then'](realtime[_0x7aed('0xc')]())[_0x7aed('0xa')](openchannelQueue[_0x7aed('0xd')]())['then'](realtime[_0x7aed('0xe')]())[_0x7aed('0xa')](chatQueue['getChatQueues']())[_0x7aed('0xa')](realtime[_0x7aed('0xf')]())['then'](smsQueue[_0x7aed('0x10')]())[_0x7aed('0xa')](realtime[_0x7aed('0x11')]())[_0x7aed('0xa')](mailQueue[_0x7aed('0x12')]())['then'](realtime[_0x7aed('0x13')]())['then'](faxQueue[_0x7aed('0x14')]())['then'](realtime[_0x7aed('0x15')]())[_0x7aed('0xa')](whatsappQueue[_0x7aed('0x16')]())[_0x7aed('0xa')](realtime['initWhatsappQueues']())[_0x7aed('0xa')](function(){return realtime;});}function main(){return server[_0x7aed('0x17')](realtime)[_0x7aed('0xa')](function(_0x2f62ee){return initRealtime();})[_0x7aed('0xa')](function(_0x4d05ab){return setInterval(initRealtime,0x1388);})[_0x7aed('0x18')](function(_0x24f418){console['log'](_0x24f418);});}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 abfca0a..9862f04 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x4b570f,_0x1b2f2e){var _0x3f7990=function(_0x1c6c30){while(--_0x1c6c30){_0x4b570f['push'](_0x4b570f['shift']());}};_0x3f7990(++_0x1b2f2e);}(_0x814b,0x1a2));var _0xb814=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x814b[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +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(_0x440dd9,_0x24578d){var _0x225561=function(_0x495fb8){while(--_0x495fb8){_0x440dd9['push'](_0x440dd9['shift']());}};_0x225561(++_0x24578d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x5fc3[_0x54c9dd];return _0x855156;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 14e6e68..b2f2b11 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 _0xb21b=['sendMailMessage','SendMail','bluebird','jayson/promise','http','then','error','result','catch'];(function(_0x40bbf3,_0x54e356){var _0x5432b6=function(_0x56fc48){while(--_0x56fc48){_0x40bbf3['push'](_0x40bbf3['shift']());}};_0x5432b6(++_0x54e356);}(_0xb21b,0x18e));var _0xbb21=function(_0x4b951d,_0x1a53f6){_0x4b951d=_0x4b951d-0x0;var _0x2678ce=_0xb21b[_0x4b951d];return _0x2678ce;};'use strict';var BPromise=require(_0xbb21('0x0'));var jayson=require(_0xbb21('0x1'));var client=jayson['client'][_0xbb21('0x2')]({'port':0x232b});function request(_0x551d38,_0x4af871){return new BPromise(function(_0x1ecd67,_0x13639c){return client['request'](_0x551d38,_0x4af871)[_0xbb21('0x3')](function(_0x1520aa){if(_0x1520aa[_0xbb21('0x4')]){return _0x13639c(_0x1520aa[_0xbb21('0x4')]['message']);}else{return _0x1ecd67(_0x1520aa[_0xbb21('0x5')]);}})[_0xbb21('0x6')](function(_0x485310){return _0x13639c(_0x485310);});});}exports[_0xbb21('0x7')]=function(_0x59280e,_0xd79013){return request(_0xbb21('0x8'),{'account':_0x59280e,'message':_0xd79013});}; \ No newline at end of file +var _0x862f=['result','catch','sendMailMessage','SendMail','http','then','error','message'];(function(_0x363a7c,_0xc7228b){var _0x50e8e6=function(_0x42d486){while(--_0x42d486){_0x363a7c['push'](_0x363a7c['shift']());}};_0x50e8e6(++_0xc7228b);}(_0x862f,0xc4));var _0xf862=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0x862f[_0x4b3f3e];return _0x921fc3;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0xf862('0x0')]({'port':0x232b});function request(_0x542659,_0x2e4534){return new BPromise(function(_0x1ee990,_0x413d52){return client['request'](_0x542659,_0x2e4534)[_0xf862('0x1')](function(_0x4c9ae0){if(_0x4c9ae0[_0xf862('0x2')]){return _0x413d52(_0x4c9ae0[_0xf862('0x2')][_0xf862('0x3')]);}else{return _0x1ee990(_0x4c9ae0[_0xf862('0x4')]);}})[_0xf862('0x5')](function(_0x3fd287){return _0x413d52(_0x3fd287);});});}exports[_0xf862('0x6')]=function(_0x3dbce6,_0x50a469){return request(_0xf862('0x7'),{'account':_0x3dbce6,'message':_0x50a469});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b2da6a8..39392ac 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 _0x3c67=['format','chatStatusTime','mailStatus','smsCapacity','whatsappStatusTime','openchannelCapacity','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','idle','mail','fax','sms','length','Status','StatusTime','toNumber'];(function(_0x2876a0,_0x5a09e3){var _0x5c4aae=function(_0x499cd2){while(--_0x499cd2){_0x2876a0['push'](_0x2876a0['shift']());}};_0x5c4aae(++_0x5a09e3);}(_0x3c67,0x131));var _0x73c6=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x3c67[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var moment=require(_0x73c6('0x0'));var md5=require(_0x73c6('0x1'));var Redis=require(_0x73c6('0x2'));var config=require(_0x73c6('0x3'));config[_0x73c6('0x4')]=_[_0x73c6('0x5')](config[_0x73c6('0x4')],{'host':_0x73c6('0x6'),'port':0x18eb});var io=require(_0x73c6('0x7'))(new Redis(config[_0x73c6('0x4')]));function Agent(_0x539e97){this['id']=_0x539e97['id']||0x0;this[_0x73c6('0x8')]=_0x539e97[_0x73c6('0x8')]||'';this[_0x73c6('0x9')]=_0x539e97['online']||!![];this['voicePause']=_0x539e97[_0x73c6('0xa')]||![];this[_0x73c6('0xb')]=_0x539e97['chatPause']||![];this[_0x73c6('0xc')]=_0x539e97[_0x73c6('0xc')]||![];this[_0x73c6('0xd')]=_0x539e97[_0x73c6('0xd')]||![];this[_0x73c6('0xe')]=_0x539e97['smsPause']||![];this[_0x73c6('0xf')]=_0x539e97[_0x73c6('0xf')]||![];this[_0x73c6('0x10')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x539e97[_0x73c6('0x11')]||0x0;this[_0x73c6('0x12')]=0x0;this['mailStatus']=_0x73c6('0x13');this[_0x73c6('0x14')]=0x0;this[_0x73c6('0x15')]=_0x539e97[_0x73c6('0x15')]||0x0;this[_0x73c6('0x16')]=0x0;this[_0x73c6('0x17')]=_0x73c6('0x13');this[_0x73c6('0x18')]=0x0;this[_0x73c6('0x19')]=_0x539e97['faxCapacity']||0x0;this[_0x73c6('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x73c6('0x1b')]=0x0;this['smsCapacity']=_0x539e97['smsCapacity']||0x0;this[_0x73c6('0x1c')]=0x0;this[_0x73c6('0x1d')]=_0x73c6('0x13');this['whatsappStatusTime']=0x0;this[_0x73c6('0x1e')]=_0x539e97['whatsappCapacity']||0x0;this[_0x73c6('0x1f')]=0x0;this[_0x73c6('0x20')]='unknown';this[_0x73c6('0x21')]=0x0;this['openchannelCapacity']=_0x539e97['openchannelCapacity']||0x0;this[_0x73c6('0x22')]=0x0;this[_0x73c6('0x23')]=![];this[_0x73c6('0x24')]=undefined;this['md5']='';this[_0x73c6('0x25')]();}Agent[_0x73c6('0x26')]['getChannelStatus']=function(_0x2c15ef){if(this[_0x2c15ef+_0x73c6('0x27')]>0x0){if(this[_0x2c15ef+_0x73c6('0x28')]>0x0&&this[_0x2c15ef+'CurrentCapacity']>=this[_0x2c15ef+_0x73c6('0x28')]){return'maxcapacity';}else{return'working';}}else{return _0x73c6('0x29');}};Agent[_0x73c6('0x26')][_0x73c6('0x25')]=function(){var _0x26baf5=[_0x73c6('0x2a'),'chat','openchannel',_0x73c6('0x2b'),_0x73c6('0x2c'),'whatsapp'];for(var _0x16dd23=0x0;_0x16dd23<_0x26baf5[_0x73c6('0x2d')];_0x16dd23+=0x1){var _0x6d2556=this['getChannelStatus'](_0x26baf5[_0x16dd23]);if(this[_0x26baf5[_0x16dd23]+_0x73c6('0x2e')]!==_0x6d2556){this[_0x26baf5[_0x16dd23]+_0x73c6('0x2f')]=_[_0x73c6('0x30')](moment()[_0x73c6('0x31')]('x'));}this[_0x26baf5[_0x16dd23]+'Status']=_0x6d2556;}var _0x428c48={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x73c6('0xa')],'chatPause':this[_0x73c6('0xb')],'mailPause':this[_0x73c6('0xc')],'smsPause':this[_0x73c6('0xe')],'faxPause':this[_0x73c6('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x73c6('0x10')],'chatStatusTime':this[_0x73c6('0x32')],'chatCapacity':this[_0x73c6('0x11')],'chatCurrentCapacity':this[_0x73c6('0x12')],'mailStatus':this[_0x73c6('0x33')],'mailStatusTime':this[_0x73c6('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x73c6('0x16')],'faxStatus':this[_0x73c6('0x17')],'faxStatusTime':this[_0x73c6('0x18')],'faxCapacity':this[_0x73c6('0x19')],'faxCurrentCapacity':this[_0x73c6('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x73c6('0x34')],'smsCurrentCapacity':this[_0x73c6('0x1c')],'whatsappStatus':this[_0x73c6('0x1d')],'whatsappStatusTime':this[_0x73c6('0x35')],'whatsappCapacity':this[_0x73c6('0x1e')],'whatsappCurrentCapacity':this[_0x73c6('0x1f')],'openchannelStatus':this[_0x73c6('0x20')],'openchannelStatusTime':this[_0x73c6('0x21')],'openchannelCapacity':this[_0x73c6('0x36')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x73c6('0x23')],'busyQueue':this['busyQueue']};var _0x43aa54=md5(JSON[_0x73c6('0x37')](_0x428c48));if(this[_0x73c6('0x1')]!==_0x43aa54){this['md5']=_0x43aa54;io[_0x73c6('0x38')](_0x73c6('0x39'),_0x428c48);}};module[_0x73c6('0x3a')]=Agent; \ No newline at end of file +var _0x5919=['user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','chat','openchannel','sms','Status','toNumber','format','chatStatus','faxCurrentCapacity','smsStatusTime','openchannelStatus','openchannelCurrentCapacity','busy','stringify'];(function(_0x49e23f,_0x12b363){var _0x399a23=function(_0x457282){while(--_0x457282){_0x49e23f['push'](_0x49e23f['shift']());}};_0x399a23(++_0x12b363);}(_0x5919,0x198));var _0x9591=function(_0x5214d9,_0xb9ce27){_0x5214d9=_0x5214d9-0x0;var _0xb0703d=_0x5919[_0x5214d9];return _0xb0703d;};'use strict';var _=require(_0x9591('0x0'));var moment=require('moment');var md5=require(_0x9591('0x1'));var Redis=require(_0x9591('0x2'));var config=require(_0x9591('0x3'));config[_0x9591('0x4')]=_['defaults'](config[_0x9591('0x4')],{'host':_0x9591('0x5'),'port':0x18eb});var io=require(_0x9591('0x6'))(new Redis(config['redis']));function Agent(_0xe13bd8){this['id']=_0xe13bd8['id']||0x0;this[_0x9591('0x7')]=_0xe13bd8[_0x9591('0x7')]||'';this['online']=_0xe13bd8[_0x9591('0x8')]||!![];this[_0x9591('0x9')]=_0xe13bd8[_0x9591('0x9')]||![];this[_0x9591('0xa')]=_0xe13bd8[_0x9591('0xa')]||![];this[_0x9591('0xb')]=_0xe13bd8['mailPause']||![];this[_0x9591('0xc')]=_0xe13bd8[_0x9591('0xc')]||![];this[_0x9591('0xd')]=_0xe13bd8[_0x9591('0xd')]||![];this[_0x9591('0xe')]=_0xe13bd8[_0x9591('0xe')]||![];this['chatStatus']=_0x9591('0xf');this[_0x9591('0x10')]=0x0;this[_0x9591('0x11')]=_0xe13bd8[_0x9591('0x11')]||0x0;this[_0x9591('0x12')]=0x0;this[_0x9591('0x13')]=_0x9591('0xf');this[_0x9591('0x14')]=0x0;this[_0x9591('0x15')]=_0xe13bd8[_0x9591('0x15')]||0x0;this[_0x9591('0x16')]=0x0;this[_0x9591('0x17')]=_0x9591('0xf');this[_0x9591('0x18')]=0x0;this[_0x9591('0x19')]=_0xe13bd8['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x9591('0x1a')]='unknown';this['smsStatusTime']=0x0;this[_0x9591('0x1b')]=_0xe13bd8[_0x9591('0x1b')]||0x0;this[_0x9591('0x1c')]=0x0;this[_0x9591('0x1d')]=_0x9591('0xf');this[_0x9591('0x1e')]=0x0;this[_0x9591('0x1f')]=_0xe13bd8[_0x9591('0x1f')]||0x0;this[_0x9591('0x20')]=0x0;this['openchannelStatus']='unknown';this[_0x9591('0x21')]=0x0;this[_0x9591('0x22')]=_0xe13bd8[_0x9591('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x9591('0x23')]=undefined;this[_0x9591('0x1')]='';this['updateRealtime']();}Agent[_0x9591('0x24')][_0x9591('0x25')]=function(_0x393bf1){if(this[_0x393bf1+_0x9591('0x26')]>0x0){if(this[_0x393bf1+_0x9591('0x27')]>0x0&&this[_0x393bf1+_0x9591('0x26')]>=this[_0x393bf1+_0x9591('0x27')]){return _0x9591('0x28');}else{return _0x9591('0x29');}}else{return'idle';}};Agent[_0x9591('0x24')][_0x9591('0x2a')]=function(){var _0x3c067d=['mail',_0x9591('0x2b'),_0x9591('0x2c'),'fax',_0x9591('0x2d'),'whatsapp'];for(var _0x4d6444=0x0;_0x4d6444<_0x3c067d['length'];_0x4d6444+=0x1){var _0x51ea85=this[_0x9591('0x25')](_0x3c067d[_0x4d6444]);if(this[_0x3c067d[_0x4d6444]+_0x9591('0x2e')]!==_0x51ea85){this[_0x3c067d[_0x4d6444]+'StatusTime']=_[_0x9591('0x2f')](moment()[_0x9591('0x30')]('x'));}this[_0x3c067d[_0x4d6444]+_0x9591('0x2e')]=_0x51ea85;}var _0x49357f={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x9591('0x9')],'chatPause':this[_0x9591('0xa')],'mailPause':this[_0x9591('0xb')],'smsPause':this[_0x9591('0xd')],'faxPause':this[_0x9591('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x9591('0x31')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x9591('0x11')],'chatCurrentCapacity':this[_0x9591('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x9591('0x14')],'mailCapacity':this[_0x9591('0x15')],'mailCurrentCapacity':this[_0x9591('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x9591('0x18')],'faxCapacity':this[_0x9591('0x19')],'faxCurrentCapacity':this[_0x9591('0x32')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x9591('0x33')],'smsCapacity':this[_0x9591('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x9591('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x9591('0x20')],'openchannelStatus':this[_0x9591('0x34')],'openchannelStatusTime':this[_0x9591('0x21')],'openchannelCapacity':this[_0x9591('0x22')],'openchannelCurrentCapacity':this[_0x9591('0x35')],'busy':this[_0x9591('0x36')],'busyQueue':this[_0x9591('0x23')]};var _0x1fd183=md5(JSON[_0x9591('0x37')](_0x49357f));if(this[_0x9591('0x1')]!==_0x1fd183){this[_0x9591('0x1')]=_0x1fd183;io['emit'](_0x9591('0x38'),_0x49357f);}};module[_0x9591('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a8fb7c2..aa7b872 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 _0xfdfe=['../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','chat:queue:%s','emit','chat_queue:save','md5','ioredis'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xfdfe,0x1d2));var _0xefdf=function(_0x52a6ae,_0x7a9374){_0x52a6ae=_0x52a6ae-0x0;var _0x49baf4=_0xfdfe[_0x52a6ae];return _0x49baf4;};'use strict';var _=require('lodash');var md5=require(_0xefdf('0x0'));var util=require('util');var Redis=require(_0xefdf('0x1'));var config=require(_0xefdf('0x2'));config[_0xefdf('0x3')]=_[_0xefdf('0x4')](config[_0xefdf('0x3')],{'host':_0xefdf('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xefdf('0x3')]));function ChatQueue(_0x4accc4){this['id']=_0x4accc4['id']||0x0;this[_0xefdf('0x6')]=_0x4accc4[_0xefdf('0x6')]||'';this[_0xefdf('0x7')]=_0x4accc4[_0xefdf('0x7')]||0xa;this[_0xefdf('0x8')]=_0x4accc4['strategy']||_0xefdf('0x9');this[_0xefdf('0xa')]=_0x4accc4[_0xefdf('0xa')];this['mapAgentsId']={};this[_0xefdf('0xb')]=0x0;this[_0xefdf('0x0')]='';this['updateRouting']();this[_0xefdf('0xc')]();}ChatQueue[_0xefdf('0xd')]['updateRouting']=function(){var _0x107275=this[_0xefdf('0xe')]['_rr'];this[_0xefdf('0xe')]=_[_0xefdf('0xf')](this[_0xefdf('0xa')],'id');this[_0xefdf('0xe')][_0xefdf('0x10')]=_0x107275;};ChatQueue['prototype'][_0xefdf('0xc')]=function(){this[_0xefdf('0x11')]=0x0;this[_0xefdf('0x12')]=0x0;for(var _0x406846=0x0;_0x406846=0x0?this['available']:0x0;var _0x3356fe={'id':this['id'],'available':this[_0xefdf('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xefdf('0x6')],'paused':this[_0xefdf('0x12')],'waiting':this[_0xefdf('0xb')]};var _0x10a134=md5(JSON['stringify'](_0x3356fe));if(this[_0xefdf('0x0')]!==_0x10a134){this[_0xefdf('0x0')]=_0x10a134;io['to'](util['format'](_0xefdf('0x17'),_0x3356fe['name']))[_0xefdf('0x18')](_0xefdf('0x19'),_0x3356fe);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x0064=['name','paused','stringify','format','chat:queue:%s','emit','chat_queue:save','md5','util','ioredis','redis','localhost','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','length','online','loggedIn','available'];(function(_0x23e337,_0x1e3c57){var _0x45facf=function(_0x2abfa3){while(--_0x2abfa3){_0x23e337['push'](_0x23e337['shift']());}};_0x45facf(++_0x1e3c57);}(_0x0064,0x11b));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x4006('0x0'));var util=require(_0x4006('0x1'));var Redis=require(_0x4006('0x2'));var config=require('../../../config/environment');config[_0x4006('0x3')]=_['defaults'](config[_0x4006('0x3')],{'host':_0x4006('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4006('0x3')]));function ChatQueue(_0x309709){this['id']=_0x309709['id']||0x0;this['name']=_0x309709['name']||'';this['timeout']=_0x309709['timeout']||0xa;this['strategy']=_0x309709['strategy']||'beepall';this[_0x4006('0x5')]=_0x309709[_0x4006('0x5')];this[_0x4006('0x6')]={};this['waiting']=0x0;this[_0x4006('0x0')]='';this[_0x4006('0x7')]();this['updateRealtime']();}ChatQueue[_0x4006('0x8')][_0x4006('0x7')]=function(){var _0x2baa1e=this[_0x4006('0x6')][_0x4006('0x9')];this['mapAgentsId']=_[_0x4006('0xa')](this['Agents'],'id');this[_0x4006('0x6')][_0x4006('0x9')]=_0x2baa1e;};ChatQueue[_0x4006('0x8')][_0x4006('0xb')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x520d45=0x0;_0x520d45=0x0?this[_0x4006('0xf')]:0x0;var _0x2507b6={'id':this['id'],'available':this[_0x4006('0xf')],'loggedIn':this[_0x4006('0xe')],'name':this[_0x4006('0x10')],'paused':this[_0x4006('0x11')],'waiting':this['waiting']};var _0x4b7111=md5(JSON[_0x4006('0x12')](_0x2507b6));if(this[_0x4006('0x0')]!==_0x4b7111){this[_0x4006('0x0')]=_0x4b7111;io['to'](util[_0x4006('0x13')](_0x4006('0x14'),_0x2507b6[_0x4006('0x10')]))[_0x4006('0x15')](_0x4006('0x16'),_0x2507b6);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 997dc73..7c56da7 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 _0x4fe7=['prototype','loggedIn','paused','length','online','faxPause','available','name','stringify','format','fax:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fe7,0x81));var _0x74fe=function(_0x250e9b,_0xdca9ad){_0x250e9b=_0x250e9b-0x0;var _0x343c58=_0x4fe7[_0x250e9b];return _0x343c58;};'use strict';var _=require(_0x74fe('0x0'));var md5=require(_0x74fe('0x1'));var util=require('util');var Redis=require(_0x74fe('0x2'));var config=require(_0x74fe('0x3'));config['redis']=_['defaults'](config[_0x74fe('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x74fe('0x5'))(new Redis(config['redis']));function FaxQueue(_0x15062a){this['id']=_0x15062a['id']||0x0;this['name']=_0x15062a['name']||'';this[_0x74fe('0x6')]=_0x15062a[_0x74fe('0x6')]||0xa;this[_0x74fe('0x7')]=_0x15062a[_0x74fe('0x7')]||_0x74fe('0x8');this['Agents']=_0x15062a[_0x74fe('0x9')];this[_0x74fe('0xa')]={};this[_0x74fe('0xb')]=0x0;this[_0x74fe('0x1')]='';this[_0x74fe('0xc')]();this[_0x74fe('0xd')]();}FaxQueue['prototype'][_0x74fe('0xc')]=function(){var _0x835937=this[_0x74fe('0xa')][_0x74fe('0xe')];this[_0x74fe('0xa')]=_[_0x74fe('0xf')](this[_0x74fe('0x9')],'id');this[_0x74fe('0xa')][_0x74fe('0xe')]=_0x835937;};FaxQueue[_0x74fe('0x10')][_0x74fe('0xd')]=function(){this[_0x74fe('0x11')]=0x0;this[_0x74fe('0x12')]=0x0;for(var _0x1dcb71=0x0;_0x1dcb71=0x0?this[_0x74fe('0x16')]:0x0;var _0x12c2dd={'id':this['id'],'available':this[_0x74fe('0x16')],'loggedIn':this[_0x74fe('0x11')],'name':this[_0x74fe('0x17')],'paused':this['paused'],'waiting':this[_0x74fe('0xb')]};var _0x1068fe=md5(JSON[_0x74fe('0x18')](_0x12c2dd));if(this[_0x74fe('0x1')]!==_0x1068fe){this['md5']=_0x1068fe;io['to'](util[_0x74fe('0x19')](_0x74fe('0x1a'),_0x12c2dd[_0x74fe('0x17')]))[_0x74fe('0x1b')]('fax_queue:save',_0x12c2dd);}};module[_0x74fe('0x1c')]=FaxQueue; \ No newline at end of file +var _0xfe38=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x56f598,_0x41cd96){var _0x413206=function(_0x1540ae){while(--_0x1540ae){_0x56f598['push'](_0x56f598['shift']());}};_0x413206(++_0x41cd96);}(_0xfe38,0x127));var _0x8fe3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xfe38[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x8fe3('0x0'));var md5=require(_0x8fe3('0x1'));var util=require(_0x8fe3('0x2'));var Redis=require(_0x8fe3('0x3'));var config=require(_0x8fe3('0x4'));config[_0x8fe3('0x5')]=_['defaults'](config[_0x8fe3('0x5')],{'host':_0x8fe3('0x6'),'port':0x18eb});var io=require(_0x8fe3('0x7'))(new Redis(config[_0x8fe3('0x5')]));function FaxQueue(_0x91c99e){this['id']=_0x91c99e['id']||0x0;this['name']=_0x91c99e[_0x8fe3('0x8')]||'';this[_0x8fe3('0x9')]=_0x91c99e[_0x8fe3('0x9')]||0xa;this[_0x8fe3('0xa')]=_0x91c99e[_0x8fe3('0xa')]||_0x8fe3('0xb');this[_0x8fe3('0xc')]=_0x91c99e[_0x8fe3('0xc')];this[_0x8fe3('0xd')]={};this[_0x8fe3('0xe')]=0x0;this[_0x8fe3('0x1')]='';this[_0x8fe3('0xf')]();this[_0x8fe3('0x10')]();}FaxQueue[_0x8fe3('0x11')][_0x8fe3('0xf')]=function(){var _0x6be3e3=this['mapAgentsId'][_0x8fe3('0x12')];this['mapAgentsId']=_[_0x8fe3('0x13')](this[_0x8fe3('0xc')],'id');this[_0x8fe3('0xd')][_0x8fe3('0x12')]=_0x6be3e3;};FaxQueue[_0x8fe3('0x11')][_0x8fe3('0x10')]=function(){this[_0x8fe3('0x14')]=0x0;this['paused']=0x0;for(var _0x9bd57a=0x0;_0x9bd57a=0x0?this[_0x8fe3('0x18')]:0x0;var _0x65bc4a={'id':this['id'],'available':this[_0x8fe3('0x18')],'loggedIn':this[_0x8fe3('0x14')],'name':this[_0x8fe3('0x8')],'paused':this['paused'],'waiting':this[_0x8fe3('0xe')]};var _0x786f2b=md5(JSON[_0x8fe3('0x19')](_0x65bc4a));if(this['md5']!==_0x786f2b){this[_0x8fe3('0x1')]=_0x786f2b;io['to'](util['format'](_0x8fe3('0x1a'),_0x65bc4a['name']))[_0x8fe3('0x1b')](_0x8fe3('0x1c'),_0x65bc4a);}};module[_0x8fe3('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3a4cf57..295bdf8 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 _0x4031=['name','Intervals','exports'];(function(_0x381496,_0x2c6909){var _0xc053f1=function(_0x4bb11c){while(--_0x4bb11c){_0x381496['push'](_0x381496['shift']());}};_0xc053f1(++_0x2c6909);}(_0x4031,0x1a1));var _0x1403=function(_0x229f7a,_0x57039f){_0x229f7a=_0x229f7a-0x0;var _0x239ab7=_0x4031[_0x229f7a];return _0x239ab7;};'use strict';function Interval(_0x3c2d18){this['id']=_0x3c2d18['id']||0x0;this[_0x1403('0x0')]=_0x3c2d18[_0x1403('0x0')]||'';this['Intervals']=_0x3c2d18[_0x1403('0x1')]||{};}module[_0x1403('0x2')]=Interval; \ No newline at end of file +var _0x1ea6=['Intervals','name'];(function(_0x29f0af,_0x129a88){var _0xcc542b=function(_0x1a2578){while(--_0x1a2578){_0x29f0af['push'](_0x29f0af['shift']());}};_0xcc542b(++_0x129a88);}(_0x1ea6,0x17b));var _0x61ea=function(_0x459663,_0x5f3226){_0x459663=_0x459663-0x0;var _0x24cd75=_0x1ea6[_0x459663];return _0x24cd75;};'use strict';function Interval(_0x13be46){this['id']=_0x13be46['id']||0x0;this[_0x61ea('0x0')]=_0x13be46[_0x61ea('0x0')]||'';this[_0x61ea('0x1')]=_0x13be46[_0x61ea('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 417bdb3..79a7fb1 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 _0xe2ec=['mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','mailPause','available','format','name'];(function(_0x5f31e4,_0x5c6e6e){var _0xc7f3f2=function(_0x55753a){while(--_0x55753a){_0x5f31e4['push'](_0x5f31e4['shift']());}};_0xc7f3f2(++_0x5c6e6e);}(_0xe2ec,0x13a));var _0xce2e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe2ec[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xce2e('0x0'));var md5=require(_0xce2e('0x1'));var util=require(_0xce2e('0x2'));var Redis=require('ioredis');var config=require(_0xce2e('0x3'));config[_0xce2e('0x4')]=_[_0xce2e('0x5')](config[_0xce2e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xce2e('0x6'))(new Redis(config[_0xce2e('0x4')]));function MailQueue(_0x20afc9){this['id']=_0x20afc9['id']||0x0;this['name']=_0x20afc9['name']||'';this['timeout']=_0x20afc9['timeout']||0xa;this[_0xce2e('0x7')]=_0x20afc9[_0xce2e('0x7')]||_0xce2e('0x8');this['Agents']=_0x20afc9[_0xce2e('0x9')];this['mapAgentsId']={};this[_0xce2e('0xa')]=0x0;this[_0xce2e('0x1')]='';this[_0xce2e('0xb')]();this[_0xce2e('0xc')]();}MailQueue[_0xce2e('0xd')][_0xce2e('0xb')]=function(){var _0x3006c7=this['mapAgentsId'][_0xce2e('0xe')];this['mapAgentsId']=_[_0xce2e('0xf')](this[_0xce2e('0x9')],'id');this[_0xce2e('0x10')][_0xce2e('0xe')]=_0x3006c7;};MailQueue[_0xce2e('0xd')][_0xce2e('0xc')]=function(){this[_0xce2e('0x11')]=0x0;this[_0xce2e('0x12')]=0x0;for(var _0x55cdf6=0x0;_0x55cdf6=0x0?this[_0xce2e('0x15')]:0x0;var _0x13bebb={'id':this['id'],'available':this['available'],'loggedIn':this[_0xce2e('0x11')],'name':this['name'],'paused':this[_0xce2e('0x12')],'waiting':this[_0xce2e('0xa')]};var _0x36d9aa=md5(JSON['stringify'](_0x13bebb));if(this['md5']!==_0x36d9aa){this['md5']=_0x36d9aa;io['to'](util[_0xce2e('0x16')]('mail:queue:%s',_0x13bebb[_0xce2e('0x17')]))['emit'](_0xce2e('0x18'),_0x13bebb);}};module[_0xce2e('0x19')]=MailQueue; \ No newline at end of file +var _0xc94f=['length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused'];(function(_0x2a100e,_0x263ba5){var _0x517ac8=function(_0x3342b9){while(--_0x3342b9){_0x2a100e['push'](_0x2a100e['shift']());}};_0x517ac8(++_0x263ba5);}(_0xc94f,0xca));var _0xfc94=function(_0x2be3cd,_0x5bddb6){_0x2be3cd=_0x2be3cd-0x0;var _0x3a2009=_0xc94f[_0x2be3cd];return _0x3a2009;};'use strict';var _=require(_0xfc94('0x0'));var md5=require(_0xfc94('0x1'));var util=require(_0xfc94('0x2'));var Redis=require('ioredis');var config=require(_0xfc94('0x3'));config['redis']=_[_0xfc94('0x4')](config[_0xfc94('0x5')],{'host':_0xfc94('0x6'),'port':0x18eb});var io=require(_0xfc94('0x7'))(new Redis(config[_0xfc94('0x5')]));function MailQueue(_0x122534){this['id']=_0x122534['id']||0x0;this[_0xfc94('0x8')]=_0x122534[_0xfc94('0x8')]||'';this[_0xfc94('0x9')]=_0x122534[_0xfc94('0x9')]||0xa;this[_0xfc94('0xa')]=_0x122534['strategy']||_0xfc94('0xb');this['Agents']=_0x122534[_0xfc94('0xc')];this[_0xfc94('0xd')]={};this[_0xfc94('0xe')]=0x0;this[_0xfc94('0x1')]='';this[_0xfc94('0xf')]();this[_0xfc94('0x10')]();}MailQueue[_0xfc94('0x11')][_0xfc94('0xf')]=function(){var _0x2c0a0e=this['mapAgentsId'][_0xfc94('0x12')];this['mapAgentsId']=_[_0xfc94('0x13')](this[_0xfc94('0xc')],'id');this[_0xfc94('0xd')][_0xfc94('0x12')]=_0x2c0a0e;};MailQueue['prototype'][_0xfc94('0x10')]=function(){this[_0xfc94('0x14')]=0x0;this[_0xfc94('0x15')]=0x0;for(var _0x5bebbf=0x0;_0x5bebbf=0x0?this[_0xfc94('0x19')]:0x0;var _0x370bd7={'id':this['id'],'available':this[_0xfc94('0x19')],'loggedIn':this[_0xfc94('0x14')],'name':this[_0xfc94('0x8')],'paused':this[_0xfc94('0x15')],'waiting':this[_0xfc94('0xe')]};var _0x396513=md5(JSON[_0xfc94('0x1a')](_0x370bd7));if(this['md5']!==_0x396513){this[_0xfc94('0x1')]=_0x396513;io['to'](util[_0xfc94('0x1b')](_0xfc94('0x1c'),_0x370bd7['name']))[_0xfc94('0x1d')](_0xfc94('0x1e'),_0x370bd7);}};module[_0xfc94('0x1f')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d4d0a6b..7adb695 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5fc0b9,_0x3a90ec){var _0xa7cbdf=function(_0x128d98){while(--_0x128d98){_0x5fc0b9['push'](_0x5fc0b9['shift']());}};_0xa7cbdf(++_0x3a90ec);}(_0x5fc3,0xa8));var _0x35fc=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0x5fc3[_0x119b3e];return _0x1169ae;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=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(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'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 46b5935..3f3e207 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 _0x31c2=['sms:queue:%s','exports','lodash','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x31c2,0x98));var _0x231c=function(_0xf8788f,_0x4913e2){_0xf8788f=_0xf8788f-0x0;var _0x45766c=_0x31c2[_0xf8788f];return _0x45766c;};'use strict';var _=require(_0x231c('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x231c('0x1'));var config=require(_0x231c('0x2'));config['redis']=_[_0x231c('0x3')](config[_0x231c('0x4')],{'host':_0x231c('0x5'),'port':0x18eb});var io=require(_0x231c('0x6'))(new Redis(config[_0x231c('0x4')]));function SmsQueue(_0x243f47){this['id']=_0x243f47['id']||0x0;this[_0x231c('0x7')]=_0x243f47[_0x231c('0x7')]||'';this['timeout']=_0x243f47[_0x231c('0x8')]||0xa;this['strategy']=_0x243f47[_0x231c('0x9')]||_0x231c('0xa');this[_0x231c('0xb')]=_0x243f47[_0x231c('0xb')];this['mapAgentsId']={};this[_0x231c('0xc')]=0x0;this[_0x231c('0xd')]='';this[_0x231c('0xe')]();this[_0x231c('0xf')]();}SmsQueue[_0x231c('0x10')][_0x231c('0xe')]=function(){var _0x4f2f2c=this['mapAgentsId']['_rr'];this[_0x231c('0x11')]=_[_0x231c('0x12')](this[_0x231c('0xb')],'id');this[_0x231c('0x11')][_0x231c('0x13')]=_0x4f2f2c;};SmsQueue[_0x231c('0x10')][_0x231c('0xf')]=function(){this[_0x231c('0x14')]=0x0;this[_0x231c('0x15')]=0x0;for(var _0x221c9c=0x0;_0x221c9c=0x0?this[_0x231c('0x19')]:0x0;var _0x59282c={'id':this['id'],'available':this[_0x231c('0x19')],'loggedIn':this[_0x231c('0x14')],'name':this[_0x231c('0x7')],'paused':this[_0x231c('0x15')],'waiting':this[_0x231c('0xc')]};var _0x270985=md5(JSON[_0x231c('0x1a')](_0x59282c));if(this[_0x231c('0xd')]!==_0x270985){this['md5']=_0x270985;io['to'](util[_0x231c('0x1b')](_0x231c('0x1c'),_0x59282c[_0x231c('0x7')]))['emit']('sms_queue:save',_0x59282c);}};module[_0x231c('0x1d')]=SmsQueue; \ No newline at end of file +var _0x8868=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','map','prototype','loggedIn','length','smsPause','available','paused','stringify','format','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x1c24c6,_0x5c26ed){var _0x26949a=function(_0x3298db){while(--_0x3298db){_0x1c24c6['push'](_0x1c24c6['shift']());}};_0x26949a(++_0x5c26ed);}(_0x8868,0x1ca));var _0x8886=function(_0x2eb3e2,_0x14cd8b){_0x2eb3e2=_0x2eb3e2-0x0;var _0x3083cb=_0x8868[_0x2eb3e2];return _0x3083cb;};'use strict';var _=require(_0x8886('0x0'));var md5=require(_0x8886('0x1'));var util=require(_0x8886('0x2'));var Redis=require(_0x8886('0x3'));var config=require(_0x8886('0x4'));config[_0x8886('0x5')]=_[_0x8886('0x6')](config[_0x8886('0x5')],{'host':_0x8886('0x7'),'port':0x18eb});var io=require(_0x8886('0x8'))(new Redis(config[_0x8886('0x5')]));function SmsQueue(_0x59fca9){this['id']=_0x59fca9['id']||0x0;this['name']=_0x59fca9[_0x8886('0x9')]||'';this[_0x8886('0xa')]=_0x59fca9['timeout']||0xa;this[_0x8886('0xb')]=_0x59fca9['strategy']||_0x8886('0xc');this[_0x8886('0xd')]=_0x59fca9[_0x8886('0xd')];this[_0x8886('0xe')]={};this[_0x8886('0xf')]=0x0;this[_0x8886('0x1')]='';this['updateRouting']();this[_0x8886('0x10')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x113c29=this['mapAgentsId'][_0x8886('0x11')];this[_0x8886('0xe')]=_[_0x8886('0x12')](this[_0x8886('0xd')],'id');this['mapAgentsId'][_0x8886('0x11')]=_0x113c29;};SmsQueue[_0x8886('0x13')]['updateRealtime']=function(){this[_0x8886('0x14')]=0x0;this['paused']=0x0;for(var _0x4a339=0x0;_0x4a339=0x0?this[_0x8886('0x17')]:0x0;var _0x5504ab={'id':this['id'],'available':this[_0x8886('0x17')],'loggedIn':this[_0x8886('0x14')],'name':this[_0x8886('0x9')],'paused':this[_0x8886('0x18')],'waiting':this[_0x8886('0xf')]};var _0x85abb6=md5(JSON[_0x8886('0x19')](_0x5504ab));if(this[_0x8886('0x1')]!==_0x85abb6){this[_0x8886('0x1')]=_0x85abb6;io['to'](util[_0x8886('0x1a')]('sms:queue:%s',_0x5504ab[_0x8886('0x9')]))['emit'](_0x8886('0x1b'),_0x5504ab);}};module[_0x8886('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 3b2d1c4..bb1ddb3 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 _0x5dfd=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','whatsappPause','available','md5','format'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x5dfd,0x1a8));var _0xd5df=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x5dfd[_0x128bef];return _0x1ba862;};'use strict';var _=require(_0xd5df('0x0'));var md5=require('md5');var util=require(_0xd5df('0x1'));var Redis=require('ioredis');var config=require(_0xd5df('0x2'));config[_0xd5df('0x3')]=_[_0xd5df('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd5df('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x5bc187){this['id']=_0x5bc187['id']||0x0;this[_0xd5df('0x6')]=_0x5bc187[_0xd5df('0x6')]||'';this['timeout']=_0x5bc187[_0xd5df('0x7')]||0xa;this[_0xd5df('0x8')]=_0x5bc187['strategy']||_0xd5df('0x9');this[_0xd5df('0xa')]=_0x5bc187[_0xd5df('0xa')];this[_0xd5df('0xb')]={};this[_0xd5df('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xd5df('0xd')]();}WhatsappQueue[_0xd5df('0xe')][_0xd5df('0xf')]=function(){var _0x55ea10=this[_0xd5df('0xb')][_0xd5df('0x10')];this['mapAgentsId']=_[_0xd5df('0x11')](this[_0xd5df('0xa')],'id');this[_0xd5df('0xb')][_0xd5df('0x10')]=_0x55ea10;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xd5df('0x12')]=0x0;this[_0xd5df('0x13')]=0x0;for(var _0x368937=0x0;_0x368937=0x0?this[_0xd5df('0x17')]:0x0;var _0x14ec10={'id':this['id'],'available':this[_0xd5df('0x17')],'loggedIn':this[_0xd5df('0x12')],'name':this[_0xd5df('0x6')],'paused':this[_0xd5df('0x13')],'waiting':this[_0xd5df('0xc')]};var _0x17296e=md5(JSON['stringify'](_0x14ec10));if(this[_0xd5df('0x18')]!==_0x17296e){this[_0xd5df('0x18')]=_0x17296e;io['to'](util[_0xd5df('0x19')](_0xd5df('0x1a'),_0x14ec10['name']))[_0xd5df('0x1b')](_0xd5df('0x1c'),_0x14ec10);}};module[_0xd5df('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xd988=['timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','whatsappPause','paused','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','ioredis','redis','defaults','socket.io-emitter','name'];(function(_0x53ec0f,_0x8383b3){var _0x195bd9=function(_0x5d526e){while(--_0x5d526e){_0x53ec0f['push'](_0x53ec0f['shift']());}};_0x195bd9(++_0x8383b3);}(_0xd988,0x1b4));var _0x8d98=function(_0x4efafc,_0x5da291){_0x4efafc=_0x4efafc-0x0;var _0x4238bd=_0xd988[_0x4efafc];return _0x4238bd;};'use strict';var _=require('lodash');var md5=require(_0x8d98('0x0'));var util=require('util');var Redis=require(_0x8d98('0x1'));var config=require('../../../config/environment');config[_0x8d98('0x2')]=_[_0x8d98('0x3')](config[_0x8d98('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x8d98('0x4'))(new Redis(config[_0x8d98('0x2')]));function WhatsappQueue(_0xa58010){this['id']=_0xa58010['id']||0x0;this[_0x8d98('0x5')]=_0xa58010[_0x8d98('0x5')]||'';this[_0x8d98('0x6')]=_0xa58010[_0x8d98('0x6')]||0xa;this[_0x8d98('0x7')]=_0xa58010[_0x8d98('0x7')]||'beepall';this['Agents']=_0xa58010[_0x8d98('0x8')];this[_0x8d98('0x9')]={};this[_0x8d98('0xa')]=0x0;this[_0x8d98('0x0')]='';this[_0x8d98('0xb')]();this[_0x8d98('0xc')]();}WhatsappQueue[_0x8d98('0xd')][_0x8d98('0xb')]=function(){var _0x3eb2a6=this[_0x8d98('0x9')][_0x8d98('0xe')];this[_0x8d98('0x9')]=_[_0x8d98('0xf')](this[_0x8d98('0x8')],'id');this[_0x8d98('0x9')][_0x8d98('0xe')]=_0x3eb2a6;};WhatsappQueue[_0x8d98('0xd')]['updateRealtime']=function(){this[_0x8d98('0x10')]=0x0;this['paused']=0x0;for(var _0x4c888c=0x0;_0x4c888c=0x0?this[_0x8d98('0x14')]:0x0;var _0x4d0edc={'id':this['id'],'available':this[_0x8d98('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x8d98('0x5')],'paused':this[_0x8d98('0x13')],'waiting':this[_0x8d98('0xa')]};var _0x2d5da1=md5(JSON[_0x8d98('0x15')](_0x4d0edc));if(this[_0x8d98('0x0')]!==_0x2d5da1){this[_0x8d98('0x0')]=_0x2d5da1;io['to'](util['format'](_0x8d98('0x16'),_0x4d0edc[_0x8d98('0x5')]))[_0x8d98('0x17')](_0x8d98('0x18'),_0x4d0edc);}};module[_0x8d98('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index eca8f7a..9909bd9 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(_0x39945f,_0x55de99){var _0x425cb4=function(_0x2eacc1){while(--_0x2eacc1){_0x39945f['push'](_0x39945f['shift']());}};_0x425cb4(++_0x55de99);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e18a,_0x2d220a){_0x4e18a=_0x4e18a-0x0;var _0x56cc08=_0xb10b[_0x4e18a];return _0x56cc08;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 e197e92..b73a7be 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 _0xd2af=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x3f56b8,_0x298a38){var _0x5cd0b0=function(_0x279597){while(--_0x279597){_0x3f56b8['push'](_0x3f56b8['shift']());}};_0x5cd0b0(++_0x298a38);}(_0xd2af,0x1c0));var _0xfd2a=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xd2af[_0x1f1e31];return _0x229b56;};'use strict';var client=require(_0xfd2a('0x0'));exports[_0xfd2a('0x1')]=function(_0x4a1353,_0x3ddc17){return client[_0xfd2a('0x2')](_0xfd2a('0x3'),{'body':_0x3ddc17,'options':{'where':{'id':_0x4a1353}},'log':_0xfd2a('0x4')});};exports[_0xfd2a('0x5')]=function(_0x3c5356,_0x221e53){return client[_0xfd2a('0x2')]('AddTagsToChatInteraction',{'body':_0x221e53,'options':{'where':{'id':_0x3c5356}},'log':_0xfd2a('0x6')});}; \ No newline at end of file +var _0x2376=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x5ab8d2,_0x572afc){var _0x290a25=function(_0x5b9fa9){while(--_0x5b9fa9){_0x5ab8d2['push'](_0x5ab8d2['shift']());}};_0x290a25(++_0x572afc);}(_0x2376,0x18b));var _0x6237=function(_0x22577c,_0x5ab5d0){_0x22577c=_0x22577c-0x0;var _0x5e7815=_0x2376[_0x22577c];return _0x5e7815;};'use strict';var client=require(_0x6237('0x0'));exports[_0x6237('0x1')]=function(_0x4ecc1b,_0x4aa0d9){return client[_0x6237('0x2')](_0x6237('0x3'),{'body':_0x4aa0d9,'options':{'where':{'id':_0x4ecc1b}},'log':_0x6237('0x4')});};exports[_0x6237('0x5')]=function(_0x59bb8,_0x475b5c){return client[_0x6237('0x2')](_0x6237('0x6'),{'body':_0x475b5c,'options':{'where':{'id':_0x59bb8}},'log':_0x6237('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 88c193c..392bd8d 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 _0x4b37=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x1a9e91,_0x1a5893){var _0x5b6902=function(_0x312e54){while(--_0x312e54){_0x1a9e91['push'](_0x1a9e91['shift']());}};_0x5b6902(++_0x1a5893);}(_0x4b37,0xfc));var _0x74b3=function(_0x2a5350,_0x416aaf){_0x2a5350=_0x2a5350-0x0;var _0x56a2af=_0x4b37[_0x2a5350];return _0x56a2af;};'use strict';var client=require(_0x74b3('0x0'));exports[_0x74b3('0x1')]=function(_0x2d834c){return client[_0x74b3('0x2')](_0x74b3('0x3'),{'body':_0x2d834c,'log':_0x74b3('0x4')});}; \ No newline at end of file +var _0xdd35=['Request','CreateChatMessage','create'];(function(_0x328a80,_0x45a187){var _0x6e7c8f=function(_0x15b466){while(--_0x15b466){_0x328a80['push'](_0x328a80['shift']());}};_0x6e7c8f(++_0x45a187);}(_0xdd35,0x1be));var _0x5dd3=function(_0x353037,_0x41f0fe){_0x353037=_0x353037-0x0;var _0xbf71f5=_0xdd35[_0x353037];return _0xbf71f5;};'use strict';var client=require('../client');exports[_0x5dd3('0x0')]=function(_0x1e20c0){return client[_0x5dd3('0x1')](_0x5dd3('0x2'),{'body':_0x1e20c0,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b16912c..9811694 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 _0x9b67=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x9b67,0xf6));var _0x79b6=function(_0xa59b92,_0x242230){_0xa59b92=_0xa59b92-0x0;var _0x390b70=_0x9b67[_0xa59b92];return _0x390b70;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(){return function(){return client[_0x79b6('0x2')](_0x79b6('0x3'),{'options':{'raw':![],'attributes':['id',_0x79b6('0x4'),'timeout',_0x79b6('0x5')],'include':[{'model':_0x79b6('0x6'),'as':'Agents','attributes':['id','name',_0x79b6('0x7'),_0x79b6('0x8')]}]},'log':_0x79b6('0x1')});};}; \ No newline at end of file +var _0x39d9=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x3fa5e4,_0x4059fc){var _0x55cb08=function(_0x1daa3d){while(--_0x1daa3d){_0x3fa5e4['push'](_0x3fa5e4['shift']());}};_0x55cb08(++_0x4059fc);}(_0x39d9,0x17f));var _0x939d=function(_0x390f42,_0xddf05){_0x390f42=_0x390f42-0x0;var _0x127f64=_0x39d9[_0x390f42];return _0x127f64;};'use strict';var client=require(_0x939d('0x0'));exports[_0x939d('0x1')]=function(){return function(){return client[_0x939d('0x2')](_0x939d('0x3'),{'options':{'raw':![],'attributes':['id',_0x939d('0x4'),_0x939d('0x5'),_0x939d('0x6')],'include':[{'model':_0x939d('0x7'),'as':'Agents','attributes':['id',_0x939d('0x4'),_0x939d('0x8'),_0x939d('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ad252f2..bbb4592 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 _0x9181=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0x9181,0x182));var _0x1918=function(_0x422ee3,_0x1dbb5f){_0x422ee3=_0x422ee3-0x0;var _0x5444e3=_0x9181[_0x422ee3];return _0x5444e3;};'use strict';var client=require(_0x1918('0x0'));exports[_0x1918('0x1')]=function(_0x13ad9b){return client[_0x1918('0x2')](_0x1918('0x3'),{'body':_0x13ad9b,'log':'CreateChatQueueReport'});};exports[_0x1918('0x4')]=function(_0x5c38a7,_0x32e178){return client[_0x1918('0x2')](_0x1918('0x5'),{'body':_0x32e178,'options':{'where':{'uniqueid':_0x5c38a7},'order':[['id',_0x1918('0x6')]],'limit':0x1},'log':_0x1918('0x5')});}; \ No newline at end of file +var _0x255f=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x255f,0x185));var _0xf255=function(_0x5b5f97,_0x46b15e){_0x5b5f97=_0x5b5f97-0x0;var _0x2f6001=_0x255f[_0x5b5f97];return _0x2f6001;};'use strict';var client=require(_0xf255('0x0'));exports['create']=function(_0x43ff47){return client[_0xf255('0x1')](_0xf255('0x2'),{'body':_0x43ff47,'log':'CreateChatQueueReport'});};exports[_0xf255('0x3')]=function(_0x3d90e8,_0x474ac5){return client[_0xf255('0x1')](_0xf255('0x4'),{'body':_0x474ac5,'options':{'where':{'uniqueid':_0x3d90e8},'order':[['id',_0xf255('0x5')]],'limit':0x1},'log':_0xf255('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 18e077e..bc749a8 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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2b92c1,_0x5892cb){var _0x581968=function(_0x46ef60){while(--_0x46ef60){_0x2b92c1['push'](_0x2b92c1['shift']());}};_0x581968(++_0x5892cb);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x7a54,0x106));var _0x47a5=function(_0x595016,_0x147e02){_0x595016=_0x595016-0x0;var _0x5d2d14=_0x7a54[_0x595016];return _0x5d2d14;};'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 5ea0d2d..f9dc835 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 _0x7110=['createFaxMessage','../client','create','Request'];(function(_0x2e7186,_0x19221c){var _0x442fd2=function(_0x5f47eb){while(--_0x5f47eb){_0x2e7186['push'](_0x2e7186['shift']());}};_0x442fd2(++_0x19221c);}(_0x7110,0xa9));var _0x0711=function(_0x23257f,_0x51fa72){_0x23257f=_0x23257f-0x0;var _0xefbb1c=_0x7110[_0x23257f];return _0xefbb1c;};'use strict';var client=require(_0x0711('0x0'));exports[_0x0711('0x1')]=function(_0x53ef5f){return client[_0x0711('0x2')]('CreateFaxMessage',{'body':_0x53ef5f,'log':_0x0711('0x3')});}; \ No newline at end of file +var _0x0620=['createFaxMessage','../client','create'];(function(_0x5e9330,_0x1afaf4){var _0x502d72=function(_0x298ef8){while(--_0x298ef8){_0x5e9330['push'](_0x5e9330['shift']());}};_0x502d72(++_0x1afaf4);}(_0x0620,0x13f));var _0x0062=function(_0x490396,_0x299fe8){_0x490396=_0x490396-0x0;var _0x39c9b8=_0x0620[_0x490396];return _0x39c9b8;};'use strict';var client=require(_0x0062('0x0'));exports[_0x0062('0x1')]=function(_0x2dcd6a){return client['Request']('CreateFaxMessage',{'body':_0x2dcd6a,'log':_0x0062('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5785989..fc3a07b 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 _0xf0f8=['name','timeout','strategy','User','Agents','online','getFaxQueues','Request','GetFaxQueue'];(function(_0x3bc52b,_0x249b02){var _0x141ca5=function(_0x35f78a){while(--_0x35f78a){_0x3bc52b['push'](_0x3bc52b['shift']());}};_0x141ca5(++_0x249b02);}(_0xf0f8,0x1da));var _0x8f0f=function(_0x5a918d,_0x134727){_0x5a918d=_0x5a918d-0x0;var _0x45016b=_0xf0f8[_0x5a918d];return _0x45016b;};'use strict';var client=require('../client');exports[_0x8f0f('0x0')]=function(){return function(){return client[_0x8f0f('0x1')](_0x8f0f('0x2'),{'options':{'raw':![],'attributes':['id',_0x8f0f('0x3'),_0x8f0f('0x4'),_0x8f0f('0x5')],'include':[{'model':_0x8f0f('0x6'),'as':_0x8f0f('0x7'),'attributes':['id',_0x8f0f('0x3'),_0x8f0f('0x8'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xff92=['../client','Request','name','timeout','User','Agents','online','faxPause','getFaxQueues'];(function(_0x2fe58d,_0x36c8da){var _0x2d7de1=function(_0x3b5ce4){while(--_0x3b5ce4){_0x2fe58d['push'](_0x2fe58d['shift']());}};_0x2d7de1(++_0x36c8da);}(_0xff92,0x90));var _0x2ff9=function(_0x5f5ad3,_0x5934e8){_0x5f5ad3=_0x5f5ad3-0x0;var _0x5688ea=_0xff92[_0x5f5ad3];return _0x5688ea;};'use strict';var client=require(_0x2ff9('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x2ff9('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x2ff9('0x2'),_0x2ff9('0x3'),'strategy'],'include':[{'model':_0x2ff9('0x4'),'as':_0x2ff9('0x5'),'attributes':['id',_0x2ff9('0x2'),_0x2ff9('0x6'),_0x2ff9('0x7')]}]},'log':_0x2ff9('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3add481..897da6c 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 _0x5be7=['Request','DESC','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update'];(function(_0x124ac9,_0x1de2b9){var _0x5881da=function(_0x4998de){while(--_0x4998de){_0x124ac9['push'](_0x124ac9['shift']());}};_0x5881da(++_0x1de2b9);}(_0x5be7,0x1e6));var _0x75be=function(_0x4aa0be,_0x31dccf){_0x4aa0be=_0x4aa0be-0x0;var _0x44809b=_0x5be7[_0x4aa0be];return _0x44809b;};'use strict';var client=require(_0x75be('0x0'));exports[_0x75be('0x1')]=function(_0x5511f5){return client['Request'](_0x75be('0x2'),{'body':_0x5511f5,'log':'CreateFaxQueueReport'});};exports[_0x75be('0x3')]=function(_0x1d6e3c,_0x1d9f4){return client[_0x75be('0x4')]('UpdateFaxQueueReport',{'body':_0x1d9f4,'options':{'where':{'uniqueid':_0x1d6e3c},'order':[['id',_0x75be('0x5')]],'limit':0x1},'log':_0x75be('0x6')});}; \ No newline at end of file +var _0xbe95=['CreateFaxQueueReport','update','UpdateFaxQueueReport','create'];(function(_0x15a34f,_0x1378ba){var _0x2e7b6b=function(_0x1fbfa2){while(--_0x1fbfa2){_0x15a34f['push'](_0x15a34f['shift']());}};_0x2e7b6b(++_0x1378ba);}(_0xbe95,0x123));var _0x5be9=function(_0x4c4797,_0xa0125c){_0x4c4797=_0x4c4797-0x0;var _0x31bffb=_0xbe95[_0x4c4797];return _0x31bffb;};'use strict';var client=require('../client');exports[_0x5be9('0x0')]=function(_0x18bdcb){return client['Request'](_0x5be9('0x1'),{'body':_0x18bdcb,'log':_0x5be9('0x1')});};exports[_0x5be9('0x2')]=function(_0x196310,_0x306f4c){return client['Request'](_0x5be9('0x3'),{'body':_0x306f4c,'options':{'where':{'uniqueid':_0x196310},'order':[['id','DESC']],'limit':0x1},'log':_0x5be9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index dead40a..b42074e 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 _0xfe05=['Request','name','Intervals','interval','../client','getIntervals'];(function(_0x823b40,_0x5e2c7a){var _0x595d26=function(_0x14c0b5){while(--_0x14c0b5){_0x823b40['push'](_0x823b40['shift']());}};_0x595d26(++_0x5e2c7a);}(_0xfe05,0x6a));var _0x5fe0=function(_0x241812,_0x5295bc){_0x241812=_0x241812-0x0;var _0x2ead48=_0xfe05[_0x241812];return _0x2ead48;};'use strict';var client=require(_0x5fe0('0x0'));exports[_0x5fe0('0x1')]=function(){return function(){return client[_0x5fe0('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5fe0('0x3')],'include':[{'model':'Interval','as':_0x5fe0('0x4'),'attributes':['id',_0x5fe0('0x3'),_0x5fe0('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x99b1=['getIntervals','GetInterval','name','Interval','interval','../client'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0x99b1,0x19d));var _0x199b=function(_0x56ae99,_0x27e0b6){_0x56ae99=_0x56ae99-0x0;var _0x32c5c1=_0x99b1[_0x56ae99];return _0x32c5c1;};'use strict';var client=require(_0x199b('0x0'));exports[_0x199b('0x1')]=function(){return function(){return client['Request'](_0x199b('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x199b('0x3')],'include':[{'model':_0x199b('0x4'),'as':'Intervals','attributes':['id',_0x199b('0x3'),_0x199b('0x5')]}]},'log':_0x199b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a8c7717..a3098b8 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 _0x32b6=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x19f683,_0x445ee2){var _0x50128f=function(_0x4365d9){while(--_0x4365d9){_0x19f683['push'](_0x19f683['shift']());}};_0x50128f(++_0x445ee2);}(_0x32b6,0x1d1));var _0x632b=function(_0x3c59d4,_0x47763e){_0x3c59d4=_0x3c59d4-0x0;var _0x37760f=_0x32b6[_0x3c59d4];return _0x37760f;};'use strict';var client=require(_0x632b('0x0'));exports[_0x632b('0x1')]=function(_0x4d7646,_0x1f0635){return client[_0x632b('0x2')]('UpdateMailInteraction',{'body':_0x1f0635,'options':{'where':{'id':_0x4d7646}},'log':'updateMailInteraction'});};exports[_0x632b('0x3')]=function(_0x3435e8,_0x3ba3a7){return client[_0x632b('0x2')](_0x632b('0x4'),{'body':_0x3ba3a7,'options':{'where':{'id':_0x3435e8}},'log':_0x632b('0x5')});}; \ No newline at end of file +var _0xdb28=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x59ffe4,_0x1569ec){var _0x5e6ad2=function(_0x334790){while(--_0x334790){_0x59ffe4['push'](_0x59ffe4['shift']());}};_0x5e6ad2(++_0x1569ec);}(_0xdb28,0x106));var _0x8db2=function(_0x5163c2,_0x1f741a){_0x5163c2=_0x5163c2-0x0;var _0x2ee950=_0xdb28[_0x5163c2];return _0x2ee950;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(_0x1dc797,_0xf66e59){return client['Request'](_0x8db2('0x2'),{'body':_0xf66e59,'options':{'where':{'id':_0x1dc797}},'log':_0x8db2('0x3')});};exports[_0x8db2('0x4')]=function(_0x4426fe,_0x11109e){return client['Request'](_0x8db2('0x5'),{'body':_0x11109e,'options':{'where':{'id':_0x4426fe}},'log':_0x8db2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 80f55fd..4f9cf55 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 _0x6178=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x5b3aca,_0x3d0d08){var _0x3c93b1=function(_0x11a2f5){while(--_0x11a2f5){_0x5b3aca['push'](_0x5b3aca['shift']());}};_0x3c93b1(++_0x3d0d08);}(_0x6178,0x164));var _0x8617=function(_0x25e6b9,_0x9d17ea){_0x25e6b9=_0x25e6b9-0x0;var _0x4bfb70=_0x6178[_0x25e6b9];return _0x4bfb70;};'use strict';var client=require(_0x8617('0x0'));exports[_0x8617('0x1')]=function(_0x1b9414){return client[_0x8617('0x2')](_0x8617('0x3'),{'body':_0x1b9414,'log':_0x8617('0x4')});}; \ No newline at end of file +var _0x032d=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x032d,0xde));var _0xd032=function(_0x53b6e4,_0x301b49){_0x53b6e4=_0x53b6e4-0x0;var _0x1859c3=_0x032d[_0x53b6e4];return _0x1859c3;};'use strict';var client=require(_0xd032('0x0'));exports[_0xd032('0x1')]=function(_0x36afa2){return client['Request'](_0xd032('0x2'),{'body':_0x36afa2,'log':_0xd032('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f47ee27..1d7dfe8 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 _0x4dd1=['strategy','User','Agents','getMailQueues','Request','GetMailQueue','name'];(function(_0x5e43d0,_0x263557){var _0x7065e9=function(_0x1fc783){while(--_0x1fc783){_0x5e43d0['push'](_0x5e43d0['shift']());}};_0x7065e9(++_0x263557);}(_0x4dd1,0x122));var _0x14dd=function(_0x37865a,_0xda171f){_0x37865a=_0x37865a-0x0;var _0xa6fec5=_0x4dd1[_0x37865a];return _0xa6fec5;};'use strict';var client=require('../client');exports[_0x14dd('0x0')]=function(){return function(){return client[_0x14dd('0x1')](_0x14dd('0x2'),{'options':{'raw':![],'attributes':['id',_0x14dd('0x3'),'timeout',_0x14dd('0x4')],'include':[{'model':_0x14dd('0x5'),'as':_0x14dd('0x6'),'attributes':['id',_0x14dd('0x3'),'online','mailPause']}]},'log':_0x14dd('0x0')});};}; \ No newline at end of file +var _0x34a5=['getMailQueues','name','timeout','strategy','online','mailPause','../client'];(function(_0x2bca2e,_0x14a36f){var _0x222c86=function(_0xa430b4){while(--_0xa430b4){_0x2bca2e['push'](_0x2bca2e['shift']());}};_0x222c86(++_0x14a36f);}(_0x34a5,0x172));var _0x534a=function(_0x2f383c,_0x16b7cb){_0x2f383c=_0x2f383c-0x0;var _0x460e81=_0x34a5[_0x2f383c];return _0x460e81;};'use strict';var client=require(_0x534a('0x0'));exports[_0x534a('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x534a('0x2'),_0x534a('0x3'),_0x534a('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x534a('0x2'),_0x534a('0x5'),_0x534a('0x6')]}]},'log':_0x534a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 237661a..24f81b1 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 _0x1be8=['UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x535581,_0xbe38e9){var _0x393ae1=function(_0x5bae9f){while(--_0x5bae9f){_0x535581['push'](_0x535581['shift']());}};_0x393ae1(++_0xbe38e9);}(_0x1be8,0x7d));var _0x81be=function(_0x35c33d,_0x46defa){_0x35c33d=_0x35c33d-0x0;var _0x5139b3=_0x1be8[_0x35c33d];return _0x5139b3;};'use strict';var client=require('../client');exports[_0x81be('0x0')]=function(_0xd4467){return client[_0x81be('0x1')](_0x81be('0x2'),{'body':_0xd4467,'log':_0x81be('0x2')});};exports['update']=function(_0x217e95,_0x339f38){return client[_0x81be('0x1')](_0x81be('0x3'),{'body':_0x339f38,'options':{'where':{'uniqueid':_0x217e95},'order':[['id','DESC']],'limit':0x1},'log':_0x81be('0x3')});}; \ No newline at end of file +var _0xfbb0=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0xfbb0,0xe5));var _0x0fbb=function(_0xd53e02,_0xbd98b9){_0xd53e02=_0xd53e02-0x0;var _0x2a5589=_0xfbb0[_0xd53e02];return _0x2a5589;};'use strict';var client=require(_0x0fbb('0x0'));exports['create']=function(_0x14e2d8){return client[_0x0fbb('0x1')]('CreateMailQueueReport',{'body':_0x14e2d8,'log':_0x0fbb('0x2')});};exports[_0x0fbb('0x3')]=function(_0x3580f4,_0x2bfac3){return client[_0x0fbb('0x1')](_0x0fbb('0x4'),{'body':_0x2bfac3,'options':{'where':{'uniqueid':_0x3580f4},'order':[['id',_0x0fbb('0x5')]],'limit':0x1},'log':_0x0fbb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 22ec0d3..35576f8 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 _0x55c0=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x55c0,0x6b));var _0x055c=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x55c0[_0x4d1d2c];return _0x2c4cb9;};'use strict';var client=require(_0x055c('0x0'));exports['update']=function(_0xacf025,_0x532ce6){return client['Request'](_0x055c('0x1'),{'body':_0x532ce6,'options':{'where':{'id':_0xacf025}},'log':_0x055c('0x2')});};exports[_0x055c('0x3')]=function(_0x23f09c,_0x450f76){return client[_0x055c('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x450f76,'options':{'where':{'id':_0x23f09c}},'log':_0x055c('0x5')});}; \ No newline at end of file +var _0x777b=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0x777b,0x7e));var _0xb777=function(_0x1da69b,_0x28560c){_0x1da69b=_0x1da69b-0x0;var _0x2614a2=_0x777b[_0x1da69b];return _0x2614a2;};'use strict';var client=require('../client');exports[_0xb777('0x0')]=function(_0x16ed18,_0x239359){return client[_0xb777('0x1')](_0xb777('0x2'),{'body':_0x239359,'options':{'where':{'id':_0x16ed18}},'log':_0xb777('0x3')});};exports[_0xb777('0x4')]=function(_0x33a628,_0x3ae8af){return client[_0xb777('0x1')](_0xb777('0x5'),{'body':_0x3ae8af,'options':{'where':{'id':_0x33a628}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e55ae31..3eada9d 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 _0x7390=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x7390,0x1ae));var _0x0739=function(_0x306d1d,_0x3f5497){_0x306d1d=_0x306d1d-0x0;var _0x3caec9=_0x7390[_0x306d1d];return _0x3caec9;};'use strict';var client=require('../client');exports[_0x0739('0x0')]=function(_0x6ec870){return client[_0x0739('0x1')](_0x0739('0x2'),{'body':_0x6ec870,'log':_0x0739('0x3')});}; \ No newline at end of file +var _0x5756=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5756,0x165));var _0x6575=function(_0x82c99c,_0x181457){_0x82c99c=_0x82c99c-0x0;var _0x3bf922=_0x5756[_0x82c99c];return _0x3bf922;};'use strict';var client=require(_0x6575('0x0'));exports[_0x6575('0x1')]=function(_0x40b5f0){return client[_0x6575('0x2')](_0x6575('0x3'),{'body':_0x40b5f0,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 58dd627..beb5fa9 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 _0xe6c4=['../client','getOpenchannelQueues','name','timeout','strategy','User','online'];(function(_0x37f79c,_0x38f023){var _0x3e8566=function(_0xc347c5){while(--_0xc347c5){_0x37f79c['push'](_0x37f79c['shift']());}};_0x3e8566(++_0x38f023);}(_0xe6c4,0x1dc));var _0x4e6c=function(_0x5b04f7,_0x2a905a){_0x5b04f7=_0x5b04f7-0x0;var _0x439554=_0xe6c4[_0x5b04f7];return _0x439554;};'use strict';var client=require(_0x4e6c('0x0'));exports[_0x4e6c('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x4e6c('0x2'),_0x4e6c('0x3'),_0x4e6c('0x4')],'include':[{'model':_0x4e6c('0x5'),'as':'Agents','attributes':['id',_0x4e6c('0x2'),_0x4e6c('0x6'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xa0b0=['User','Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy'];(function(_0x16d163,_0x193f3b){var _0x440a6d=function(_0x159810){while(--_0x159810){_0x16d163['push'](_0x16d163['shift']());}};_0x440a6d(++_0x193f3b);}(_0xa0b0,0x78));var _0x0a0b=function(_0x1c4dd6,_0x2970ee){_0x1c4dd6=_0x1c4dd6-0x0;var _0x30d7ad=_0xa0b0[_0x1c4dd6];return _0x30d7ad;};'use strict';var client=require(_0x0a0b('0x0'));exports[_0x0a0b('0x1')]=function(){return function(){return client[_0x0a0b('0x2')](_0x0a0b('0x3'),{'options':{'raw':![],'attributes':['id',_0x0a0b('0x4'),'timeout',_0x0a0b('0x5')],'include':[{'model':_0x0a0b('0x6'),'as':_0x0a0b('0x7'),'attributes':['id',_0x0a0b('0x4'),_0x0a0b('0x8'),'openchannelPause']}]},'log':_0x0a0b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3031e49..5b7862d 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 _0xcbb5=['Request','UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport','update'];(function(_0x586c5b,_0x6a1c8e){var _0x394ff1=function(_0x5390a9){while(--_0x5390a9){_0x586c5b['push'](_0x586c5b['shift']());}};_0x394ff1(++_0x6a1c8e);}(_0xcbb5,0x141));var _0x5cbb=function(_0x589f49,_0x368fcc){_0x589f49=_0x589f49-0x0;var _0x1372e=_0xcbb5[_0x589f49];return _0x1372e;};'use strict';var client=require(_0x5cbb('0x0'));exports['create']=function(_0x3dbdb2){return client['Request'](_0x5cbb('0x1'),{'body':_0x3dbdb2,'log':_0x5cbb('0x1')});};exports[_0x5cbb('0x2')]=function(_0x58e914,_0x171f26){return client[_0x5cbb('0x3')](_0x5cbb('0x4'),{'body':_0x171f26,'options':{'where':{'uniqueid':_0x58e914},'order':[['id',_0x5cbb('0x5')]],'limit':0x1},'log':_0x5cbb('0x4')});}; \ No newline at end of file +var _0xcd4f=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x3134a6,_0x28d9ff){var _0x4c9810=function(_0x469c03){while(--_0x469c03){_0x3134a6['push'](_0x3134a6['shift']());}};_0x4c9810(++_0x28d9ff);}(_0xcd4f,0x175));var _0xfcd4=function(_0x4a4566,_0x59b4c3){_0x4a4566=_0x4a4566-0x0;var _0x530d00=_0xcd4f[_0x4a4566];return _0x530d00;};'use strict';var client=require(_0xfcd4('0x0'));exports[_0xfcd4('0x1')]=function(_0x4f0dc4){return client[_0xfcd4('0x2')]('CreateOpenchannelQueueReport',{'body':_0x4f0dc4,'log':_0xfcd4('0x3')});};exports[_0xfcd4('0x4')]=function(_0x5909ab,_0x50d639){return client[_0xfcd4('0x2')](_0xfcd4('0x5'),{'body':_0x50d639,'options':{'where':{'uniqueid':_0x5909ab},'order':[['id',_0xfcd4('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 8c4b779..b4fdea2 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 _0x2159=['UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5c75ec,_0x39f269){var _0x2d5ea5=function(_0x432e4a){while(--_0x432e4a){_0x5c75ec['push'](_0x5c75ec['shift']());}};_0x2d5ea5(++_0x39f269);}(_0x2159,0x17f));var _0x9215=function(_0xc66d99,_0x1e5330){_0xc66d99=_0xc66d99-0x0;var _0x55ced8=_0x2159[_0xc66d99];return _0x55ced8;};'use strict';var client=require(_0x9215('0x0'));exports[_0x9215('0x1')]=function(_0x2b38be,_0x89e2e4){return client['Request'](_0x9215('0x2'),{'body':_0x89e2e4,'options':{'where':{'id':_0x2b38be}},'log':'updateSmsInteraction'});};exports[_0x9215('0x3')]=function(_0x3128f9,_0x202c8d){return client[_0x9215('0x4')](_0x9215('0x5'),{'body':_0x202c8d,'options':{'where':{'id':_0x3128f9}},'log':_0x9215('0x6')});}; \ No newline at end of file +var _0x8a28=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x3a7fe5,_0x371426){var _0x18ed66=function(_0x4f6a16){while(--_0x4f6a16){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x18ed66(++_0x371426);}(_0x8a28,0xfd));var _0x88a2=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x8a28[_0x373dee];return _0x46798f;};'use strict';var client=require(_0x88a2('0x0'));exports[_0x88a2('0x1')]=function(_0x123af2,_0x3c2c72){return client[_0x88a2('0x2')](_0x88a2('0x3'),{'body':_0x3c2c72,'options':{'where':{'id':_0x123af2}},'log':_0x88a2('0x4')});};exports[_0x88a2('0x5')]=function(_0x5d5b92,_0x2f482e){return client[_0x88a2('0x2')](_0x88a2('0x6'),{'body':_0x2f482e,'options':{'where':{'id':_0x5d5b92}},'log':_0x88a2('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 01210ba..f9e04ab 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 _0x370b=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x193098,_0x53605a){var _0x396924=function(_0x4ff248){while(--_0x4ff248){_0x193098['push'](_0x193098['shift']());}};_0x396924(++_0x53605a);}(_0x370b,0xa0));var _0xb370=function(_0x2e5b48,_0x3b2d24){_0x2e5b48=_0x2e5b48-0x0;var _0x6d4cab=_0x370b[_0x2e5b48];return _0x6d4cab;};'use strict';var client=require(_0xb370('0x0'));exports['create']=function(_0x597e8a){return client[_0xb370('0x1')](_0xb370('0x2'),{'body':_0x597e8a,'log':_0xb370('0x3')});}; \ No newline at end of file +var _0xf081=['create','Request','CreateSmsMessage'];(function(_0x3d91fd,_0x3a768b){var _0x137a3a=function(_0x19f617){while(--_0x19f617){_0x3d91fd['push'](_0x3d91fd['shift']());}};_0x137a3a(++_0x3a768b);}(_0xf081,0x1da));var _0x1f08=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf081[_0x5a3cf0];return _0x5a64ee;};'use strict';var client=require('../client');exports[_0x1f08('0x0')]=function(_0x1b5040){return client[_0x1f08('0x1')](_0x1f08('0x2'),{'body':_0x1b5040,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7f9472c..70b52c6 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x15bfd2,_0x32aa15){var _0x170504=function(_0x149c72){while(--_0x149c72){_0x15bfd2['push'](_0x15bfd2['shift']());}};_0x170504(++_0x32aa15);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 8e240dd..98fcf13 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x21bfce,_0x8abb7e){var _0x52bafe=function(_0x59f3e0){while(--_0x59f3e0){_0x21bfce['push'](_0x21bfce['shift']());}};_0x52bafe(++_0x8abb7e);}(_0x34e8,0x12c));var _0x834e=function(_0x2ff391,_0x312a4f){_0x2ff391=_0x2ff391-0x0;var _0x4be482=_0x34e8[_0x2ff391];return _0x4be482;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x2624ef,_0x12ca73){var _0x27acd8=function(_0x1f6494){while(--_0x1f6494){_0x2624ef['push'](_0x2624ef['shift']());}};_0x27acd8(++_0x12ca73);}(_0x3e74,0x175));var _0x43e7=function(_0x329c0e,_0x1c66bc){_0x329c0e=_0x329c0e-0x0;var _0x5e3a48=_0x3e74[_0x329c0e];return _0x5e3a48;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 53794d0..7b71e0b 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(_0x18237c,_0x439037){var _0x1cb733=function(_0x25ba03){while(--_0x25ba03){_0x18237c['push'](_0x18237c['shift']());}};_0x1cb733(++_0x439037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x552c61,_0x22d09c){var _0x17ba07=function(_0x4d6a6a){while(--_0x4d6a6a){_0x552c61['push'](_0x552c61['shift']());}};_0x17ba07(++_0x22d09c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 0b6766a..e233249 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 _0x8506=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','addTags'];(function(_0x22bac9,_0x3e7aa6){var _0x580fe1=function(_0x383f90){while(--_0x383f90){_0x22bac9['push'](_0x22bac9['shift']());}};_0x580fe1(++_0x3e7aa6);}(_0x8506,0xe8));var _0x6850=function(_0x41cc5b,_0x554e69){_0x41cc5b=_0x41cc5b-0x0;var _0x1f6e71=_0x8506[_0x41cc5b];return _0x1f6e71;};'use strict';var client=require('../client');exports[_0x6850('0x0')]=function(_0x51d1a0,_0x2c8d62){return client['Request'](_0x6850('0x1'),{'body':_0x2c8d62,'options':{'where':{'id':_0x51d1a0}},'log':'updateWhatsappInteraction'});};exports[_0x6850('0x2')]=function(_0x204a8a,_0x321eff){return client['Request'](_0x6850('0x3'),{'body':_0x321eff,'options':{'where':{'id':_0x204a8a}},'log':_0x6850('0x4')});}; \ No newline at end of file +var _0xb0df=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x10d3da,_0x2e26f2){var _0x5a2cbb=function(_0x5ad580){while(--_0x5ad580){_0x10d3da['push'](_0x10d3da['shift']());}};_0x5a2cbb(++_0x2e26f2);}(_0xb0df,0x85));var _0xfb0d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb0df[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xfb0d('0x0')]=function(_0x24ab11,_0x392e80){return client[_0xfb0d('0x1')](_0xfb0d('0x2'),{'body':_0x392e80,'options':{'where':{'id':_0x24ab11}},'log':_0xfb0d('0x3')});};exports[_0xfb0d('0x4')]=function(_0x823ea6,_0x3348e0){return client['Request'](_0xfb0d('0x5'),{'body':_0x3348e0,'options':{'where':{'id':_0x823ea6}},'log':_0xfb0d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index eb9d818..a09aae2 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 _0x94b7=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xabe249,_0x523f29){var _0x2cf8f6=function(_0x568f29){while(--_0x568f29){_0xabe249['push'](_0xabe249['shift']());}};_0x2cf8f6(++_0x523f29);}(_0x94b7,0x99));var _0x794b=function(_0x3383bb,_0x4e846a){_0x3383bb=_0x3383bb-0x0;var _0x385ddb=_0x94b7[_0x3383bb];return _0x385ddb;};'use strict';var client=require(_0x794b('0x0'));exports[_0x794b('0x1')]=function(_0x103c8e){return client[_0x794b('0x2')](_0x794b('0x3'),{'body':_0x103c8e,'log':_0x794b('0x4')});}; \ No newline at end of file +var _0x88c4=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0xeac97b,_0x5eb2eb){var _0x26427d=function(_0x227a3d){while(--_0x227a3d){_0xeac97b['push'](_0xeac97b['shift']());}};_0x26427d(++_0x5eb2eb);}(_0x88c4,0xc9));var _0x488c=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x88c4[_0x4c2f17];return _0x20919e;};'use strict';var client=require(_0x488c('0x0'));exports['create']=function(_0x55aaf6){return client[_0x488c('0x1')](_0x488c('0x2'),{'body':_0x55aaf6,'log':_0x488c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 6dac818..04eab9b 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 _0xbc7b=['getWhatsappQueues','timeout','strategy','Agents','name','online','whatsappPause'];(function(_0x4b741b,_0x44f89a){var _0x398ca3=function(_0x4637ee){while(--_0x4637ee){_0x4b741b['push'](_0x4b741b['shift']());}};_0x398ca3(++_0x44f89a);}(_0xbc7b,0x1ac));var _0xbbc7=function(_0xbb67a0,_0x15df00){_0xbb67a0=_0xbb67a0-0x0;var _0x5bbacb=_0xbc7b[_0xbb67a0];return _0x5bbacb;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xbbc7('0x0'),_0xbbc7('0x1')],'include':[{'model':'User','as':_0xbbc7('0x2'),'attributes':['id',_0xbbc7('0x3'),_0xbbc7('0x4'),_0xbbc7('0x5')]}]},'log':_0xbbc7('0x6')});};}; \ No newline at end of file +var _0xc91f=['name','online','getWhatsappQueues','../client','GetWhatsappQueue','timeout','Agents'];(function(_0x4a6771,_0x3ad9a1){var _0xa8fc97=function(_0x9c216){while(--_0x9c216){_0x4a6771['push'](_0x4a6771['shift']());}};_0xa8fc97(++_0x3ad9a1);}(_0xc91f,0x1ae));var _0xfc91=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc91f[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xfc91('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xfc91('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xfc91('0x2'),'strategy'],'include':[{'model':'User','as':_0xfc91('0x3'),'attributes':['id',_0xfc91('0x4'),_0xfc91('0x5'),'whatsappPause']}]},'log':_0xfc91('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index dbf306c..7841ed7 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 _0x3ea4=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x3ea4,0xcc));var _0x43ea=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x3ea4[_0x3d73ba];return _0x47e406;};'use strict';var client=require(_0x43ea('0x0'));exports['create']=function(_0x34b6ed){return client[_0x43ea('0x1')](_0x43ea('0x2'),{'body':_0x34b6ed,'log':'CreateWhatsappQueueReport'});};exports[_0x43ea('0x3')]=function(_0x40e550,_0x5a0d98){return client[_0x43ea('0x1')]('UpdateWhatsappQueueReport',{'body':_0x5a0d98,'options':{'where':{'uniqueid':_0x40e550},'order':[['id','DESC']],'limit':0x1},'log':_0x43ea('0x4')});}; \ No newline at end of file +var _0xd46c=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x5ea399,_0x138425){var _0x35fc36=function(_0x1840f3){while(--_0x1840f3){_0x5ea399['push'](_0x5ea399['shift']());}};_0x35fc36(++_0x138425);}(_0xd46c,0x155));var _0xcd46=function(_0x2e25bb,_0x2565ba){_0x2e25bb=_0x2e25bb-0x0;var _0x55331c=_0xd46c[_0x2e25bb];return _0x55331c;};'use strict';var client=require(_0xcd46('0x0'));exports[_0xcd46('0x1')]=function(_0x653481){return client[_0xcd46('0x2')]('CreateWhatsappQueueReport',{'body':_0x653481,'log':_0xcd46('0x3')});};exports['update']=function(_0x3e98c5,_0x18546d){return client[_0xcd46('0x2')](_0xcd46('0x4'),{'body':_0x18546d,'options':{'where':{'uniqueid':_0x3e98c5},'order':[['id',_0xcd46('0x5')]],'limit':0x1},'log':_0xcd46('0x4')});}; \ 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 baa2f1a..cf9c785 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 _0xd943=['seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','timeout','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd943,0x80));var _0x3d94=function(_0x4f9881,_0xf5c426){_0x4f9881=_0x4f9881-0x0;var _0x4387a2=_0xd943[_0x4f9881];return _0x4387a2;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0x3d94('0x0'));var logger=require(_0x3d94('0x1'))('routing');var strategy=require(_0x3d94('0x2'));var queue=schema({'name':{'type':_0x3d94('0x3'),'required':!![],'message':_0x3d94('0x4')},'timeout':{'type':_0x3d94('0x5'),'message':_0x3d94('0x6')}});function writeLog(_0x43f09c,_0x81e863,_0x12fedd){return logger[_0x3d94('0x7')](util['format'](_0x3d94('0x8'),_0x43f09c,_0x81e863[_0x3d94('0x9')],_0x12fedd));}function handleFindAgent(_0x119927){return function(_0x173079){return _0x173079[_0x3d94('0x9')]['toLowerCase']()===_0x119927[_0x3d94('0xa')]();};}exports[_0x3d94('0xb')]=function(_0x397681,_0x3ee26e,_0xc11e0f,_0x58e09c){return function(_0x403157){try{var _0x2f85e3={'name':_0x3ee26e[0x0],'timeout':_0x3ee26e[0x1]};var _0x4c0397=queue['validate'](_0x2f85e3,{'typecast':!![]});if(_0x4c0397[_0x3d94('0xc')]){logger[_0x3d94('0xd')](_0x3d94('0xe'),_0x397681,_[_0x3d94('0xf')](_0x4c0397,_0x3d94('0x10'))['join'](',\x20'));_0x403157[_0x3d94('0x11')]();}else{var _0x3b1154=_['find'](_0xc11e0f['agents'],handleFindAgent(_0x2f85e3[_0x3d94('0x9')]));if(_0x3b1154){var _0x5e7e61=(_0x2f85e3[_0x3d94('0x12')]||0xa)*0x3e8;var _0x29f9cc,_0x594ae0;var _0x282b8e=seqqueue['createQueue'](_0x5e7e61);_0x282b8e['id']=_0x397681;_0x282b8e[_0x3d94('0x13')]=_0x5e7e61;_0x282b8e['channel']=_0x58e09c[_0x3d94('0x14')];writeLog(_0x397681,_0x3b1154,util[_0x3d94('0x15')](_0x3d94('0x16'),_0x5e7e61));_0xc11e0f[_0x3d94('0x17')][_0x397681]['on']('end',function(){logger[_0x3d94('0x7')](_0x3d94('0x18'),_0x397681);clearTimeout(_0x594ae0);_0x594ae0=undefined;_0x282b8e['close']();if(_0xc11e0f[_0x3d94('0x17')][_0x397681]){delete _0xc11e0f[_0x3d94('0x17')][_0x397681];}_0x403157[_0x3d94('0x11')]();});_0xc11e0f[_0x3d94('0x17')][_0x397681]['on'](_0x3d94('0x19'),function(){if(_0xc11e0f['rules'][_0x397681]){delete _0xc11e0f[_0x3d94('0x17')][_0x397681];}});_0x594ae0=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x397681);clearTimeout(_0x594ae0);_0x282b8e[_0x3d94('0x1a')]();_0x403157[_0x3d94('0x1b')]();},_0x5e7e61);strategy[_0x3d94('0x1c')](_0x282b8e,_0x3b1154,_0xc11e0f,_0x58e09c);}else{logger[_0x3d94('0xd')](_0x3d94('0x1d'),_0x397681,_0x2f85e3[_0x3d94('0x9')]);_0x403157[_0x3d94('0x11')]();}}}catch(_0x46dd1f){console['log'](_0x46dd1f);logger['error'](_0x3d94('0x1e'),_0x397681,_0x46dd1f[_0x3d94('0x1f')]);_0x403157[_0x3d94('0x11')]();}};}; \ No newline at end of file +var _0xa4f7=['lodash','util','seq-queue','../../../../config/logger','routing','./strategy','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','find','agents','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate'];(function(_0x3d8843,_0x56d51f){var _0x3ee48b=function(_0x562dd6){while(--_0x562dd6){_0x3d8843['push'](_0x3d8843['shift']());}};_0x3ee48b(++_0x56d51f);}(_0xa4f7,0x14c));var _0x7a4f=function(_0x457fad,_0x18310e){_0x457fad=_0x457fad-0x0;var _0xce86a8=_0xa4f7[_0x457fad];return _0xce86a8;};'use strict';var schema=require(_0x7a4f('0x0'));var _=require(_0x7a4f('0x1'));var util=require(_0x7a4f('0x2'));var seqqueue=require(_0x7a4f('0x3'));var logger=require(_0x7a4f('0x4'))(_0x7a4f('0x5'));var strategy=require(_0x7a4f('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7a4f('0x7'),'message':_0x7a4f('0x8')}});function writeLog(_0x23e7e2,_0x17fd86,_0x4404e8){return logger['info'](util[_0x7a4f('0x9')](_0x7a4f('0xa'),_0x23e7e2,_0x17fd86[_0x7a4f('0xb')],_0x4404e8));}function handleFindAgent(_0x4f8e12){return function(_0x192163){return _0x192163[_0x7a4f('0xb')][_0x7a4f('0xc')]()===_0x4f8e12[_0x7a4f('0xc')]();};}exports[_0x7a4f('0xd')]=function(_0x565052,_0x1085ba,_0x3dbe41,_0x139146){return function(_0x5b3dc6){try{var _0x986cb6={'name':_0x1085ba[0x0],'timeout':_0x1085ba[0x1]};var _0xe8b12a=queue[_0x7a4f('0x0')](_0x986cb6,{'typecast':!![]});if(_0xe8b12a['length']){logger[_0x7a4f('0xe')](_0x7a4f('0xf'),_0x565052,_[_0x7a4f('0x10')](_0xe8b12a,_0x7a4f('0x11'))[_0x7a4f('0x12')](',\x20'));_0x5b3dc6['stop']();}else{var _0x39050a=_[_0x7a4f('0x13')](_0x3dbe41[_0x7a4f('0x14')],handleFindAgent(_0x986cb6[_0x7a4f('0xb')]));if(_0x39050a){var _0x17e07a=(_0x986cb6['timeout']||0xa)*0x3e8;var _0xa2f97c,_0x1272e8;var _0x26c58c=seqqueue[_0x7a4f('0x15')](_0x17e07a);_0x26c58c['id']=_0x565052;_0x26c58c[_0x7a4f('0x16')]=_0x17e07a;_0x26c58c['channel']=_0x139146[_0x7a4f('0x17')];writeLog(_0x565052,_0x39050a,util[_0x7a4f('0x9')](_0x7a4f('0x18'),_0x17e07a));_0x3dbe41[_0x7a4f('0x19')][_0x565052]['on'](_0x7a4f('0x1a'),function(){logger[_0x7a4f('0x1b')](_0x7a4f('0x1c'),_0x565052);clearTimeout(_0x1272e8);_0x1272e8=undefined;_0x26c58c['close']();if(_0x3dbe41[_0x7a4f('0x19')][_0x565052]){delete _0x3dbe41[_0x7a4f('0x19')][_0x565052];}_0x5b3dc6[_0x7a4f('0x1d')]();});_0x3dbe41['rules'][_0x565052]['on'](_0x7a4f('0x1e'),function(){if(_0x3dbe41[_0x7a4f('0x19')][_0x565052]){delete _0x3dbe41['rules'][_0x565052];}});_0x1272e8=setTimeout(function(){logger['info'](_0x7a4f('0x1f'),_0x565052);clearTimeout(_0x1272e8);_0x26c58c[_0x7a4f('0x20')]();_0x5b3dc6[_0x7a4f('0x21')]();},_0x17e07a);strategy[_0x7a4f('0x22')](_0x26c58c,_0x39050a,_0x3dbe41,_0x139146);}else{logger[_0x7a4f('0xe')](_0x7a4f('0x23'),_0x565052,_0x986cb6[_0x7a4f('0xb')]);_0x5b3dc6[_0x7a4f('0x1d')]();}}}catch(_0x22ce84){console['log'](_0x22ce84);logger[_0x7a4f('0xe')]('[%s][QUEUE]\x20%s',_0x565052,_0x22ce84[_0x7a4f('0x24')]);_0x5b3dc6[_0x7a4f('0x1d')]();}};}; \ 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 41b899c..3f42286 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 _0xcccd=['$LATEST','message','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','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'];(function(_0x214310,_0x393f90){var _0x131676=function(_0x322dc1){while(--_0x322dc1){_0x214310['push'](_0x214310['shift']());}};_0x131676(++_0x393f90);}(_0xcccd,0xbb));var _0xdccc=function(_0x31bf4a,_0x51eb5f){_0x31bf4a=_0x31bf4a-0x0;var _0x2265ec=_0xcccd[_0x31bf4a];return _0x2265ec;};'use strict';var _=require(_0xdccc('0x0'));var moment=require(_0xdccc('0x1'));var AWS=require(_0xdccc('0x2'));var utils=require(_0xdccc('0x3'));var logger=require('../../../../config/logger')(_0xdccc('0x4'));var rpc={'chatMessage':require(_0xdccc('0x5')),'openchannelMessage':require(_0xdccc('0x6')),'mailMessage':require(_0xdccc('0x7')),'smsMessage':require(_0xdccc('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdccc('0x9')]=function(_0x6c2f0f,_0xb0ee09){return function(_0x29cef3){try{if(!_[_0xdccc('0xa')](this[_0xdccc('0xb')][_0xdccc('0xc')])){logger[_0xdccc('0xd')]('[%s][AMAZONLEX]\x20%s',_0x6c2f0f,_0xdccc('0xe'));return _0x29cef3[_0xdccc('0xf')]();}var _0xbcefe6={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdccc('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdccc('0x11')};if(this[_0xdccc('0x12')]==='sms'||this[_0xdccc('0x12')]===_0xdccc('0x13')){_0xbcefe6[_0xdccc('0x14')]=this[_0xdccc('0xb')]['phone'];}var _0x411f29=this[_0xdccc('0x12')];if(_0x411f29===_0xdccc('0x15')){_0xbcefe6[_0xdccc('0x16')]=this['account']['id'];}else{_0xbcefe6[_[_0xdccc('0x17')](_0x411f29)+_0xdccc('0x18')]=this['account']['id'];}_0xbcefe6[_[_0xdccc('0x17')](_0x411f29)+'InteractionId']=this[_0xdccc('0xb')]['id'];if(this[_0xdccc('0xb')]['created']){var _0x42dd4f=_0xb0ee09[0x4];if(!_[_0xdccc('0x19')](_0x42dd4f)){_0xbcefe6[_0xdccc('0x1a')]=utils['getMustacheRender'](_0x42dd4f,this);return rpc[_0x411f29+_0xdccc('0x1b')][_0xdccc('0x1c')](_0xbcefe6)[_0xdccc('0x1d')](function(_0xfd188d){logger[_0xdccc('0xd')](_0xdccc('0x1e'),_0x6c2f0f,_0xbcefe6[_0xdccc('0x1a')]);})[_0xdccc('0x1f')](function(_0x48f44b){logger['error'](_0xdccc('0x1e'),_0x6c2f0f,JSON[_0xdccc('0x20')](_0x48f44b));})[_0xdccc('0x21')](function(){logger[_0xdccc('0xd')](_0xdccc('0x22'),_0x6c2f0f);_0x29cef3[_0xdccc('0x23')]();});}else{logger[_0xdccc('0xd')](_0xdccc('0x24'),_0x6c2f0f);_0x29cef3[_0xdccc('0x23')]();}}else{var _0x43f960=this;var _0x4a3fe6=new AWS[(_0xdccc('0x25'))]({'accessKeyId':_0xb0ee09[0x0],'secretAccessKey':_0xb0ee09[0x1],'region':_0xb0ee09[0x2]});var _0x32a419={'botAlias':_0xdccc('0x26'),'botName':_0xb0ee09[0x3],'inputText':this[_0xdccc('0x27')]['body'],'userId':this['channel']+':'+this[_0xdccc('0xb')]['id']['toString']()};_0x4a3fe6['postText'](_0x32a419,function(_0x231edd,_0x58bcf9){if(_0x231edd){logger['error']('[%s][AMAZONLEX]\x20%s',_0x6c2f0f,_0x231edd[_0xdccc('0x27')]);_0x29cef3[_0xdccc('0xf')]();}else if(_0x58bcf9&&_0x58bcf9[_0xdccc('0x27')]){_0x43f960[_0xdccc('0x1a')]['amazonlex']=_0x58bcf9;_0xbcefe6[_0xdccc('0x1a')]=_0x58bcf9[_0xdccc('0x27')];_0xbcefe6[_0xdccc('0x28')]=_0xdccc('0x29');_0xbcefe6[_0xdccc('0x2a')]=JSON[_0xdccc('0x20')](_0x58bcf9);return rpc[_0x411f29+_0xdccc('0x1b')][_0xdccc('0x1c')](_0xbcefe6)[_0xdccc('0x1d')](function(_0x406f3e){logger['info'](_0xdccc('0x1e'),_0x6c2f0f,_0xbcefe6[_0xdccc('0x1a')]);if(_0x58bcf9[_0xdccc('0x2b')]==_0xdccc('0x2c')){_0x29cef3[_0xdccc('0xf')]();}else{_0x29cef3['stop']();}})[_0xdccc('0x1f')](function(_0x174921){logger['error'](_0xdccc('0x1e'),_0x6c2f0f,JSON[_0xdccc('0x20')](_0x174921));_0x29cef3[_0xdccc('0xf')]();});}else{_0x29cef3[_0xdccc('0xf')]();}});}}catch(_0x5ae74d){logger['error'](_0xdccc('0x1e'),_0x6c2f0f,JSON['stringify'](_0x5ae74d));_0x29cef3[_0xdccc('0x23')]();}};}; \ No newline at end of file +var _0xd2f4=['lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','next','contact','format','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','create','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','postText','amazonlex','providerName','Message','dialogState','Failed'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd2f4,0x120));var _0x4d2f=function(_0x2bd674,_0x5183f4){_0x2bd674=_0x2bd674-0x0;var _0x12bfb9=_0xd2f4[_0x2bd674];return _0x12bfb9;};'use strict';var _=require(_0x4d2f('0x0'));var moment=require(_0x4d2f('0x1'));var AWS=require('aws-sdk');var utils=require(_0x4d2f('0x2'));var logger=require(_0x4d2f('0x3'))('routing');var rpc={'chatMessage':require(_0x4d2f('0x4')),'openchannelMessage':require(_0x4d2f('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4d2f('0x6')),'faxMessage':require(_0x4d2f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4d2f('0x8')]=function(_0x3c26f1,_0x4b2392){return function(_0x5ab037){try{if(!_[_0x4d2f('0x9')](this[_0x4d2f('0xa')][_0x4d2f('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3c26f1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5ab037[_0x4d2f('0xc')]();}var _0x229cb3={'ContactId':this[_0x4d2f('0xd')]['id'],'sentAt':moment()[_0x4d2f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4d2f('0xf')};if(this[_0x4d2f('0x10')]===_0x4d2f('0x11')||this[_0x4d2f('0x10')]==='whatsapp'){_0x229cb3[_0x4d2f('0x12')]=this[_0x4d2f('0xa')][_0x4d2f('0x12')];}var _0x19f8f1=this[_0x4d2f('0x10')];if(_0x19f8f1===_0x4d2f('0x13')){_0x229cb3[_0x4d2f('0x14')]=this[_0x4d2f('0x15')]['id'];}else{_0x229cb3[_[_0x4d2f('0x16')](_0x19f8f1)+_0x4d2f('0x17')]=this['account']['id'];}_0x229cb3[_[_0x4d2f('0x16')](_0x19f8f1)+_0x4d2f('0x18')]=this[_0x4d2f('0xa')]['id'];if(this['interaction'][_0x4d2f('0x19')]){var _0x4ebef6=_0x4b2392[0x4];if(!_[_0x4d2f('0x1a')](_0x4ebef6)){_0x229cb3[_0x4d2f('0x1b')]=utils['getMustacheRender'](_0x4ebef6,this);return rpc[_0x19f8f1+'Message'][_0x4d2f('0x1c')](_0x229cb3)[_0x4d2f('0x1d')](function(_0x53d19c){logger[_0x4d2f('0x1e')](_0x4d2f('0x1f'),_0x3c26f1,_0x229cb3[_0x4d2f('0x1b')]);})['catch'](function(_0x24a7ac){logger[_0x4d2f('0x20')](_0x4d2f('0x1f'),_0x3c26f1,JSON[_0x4d2f('0x21')](_0x24a7ac));})[_0x4d2f('0x22')](function(){logger[_0x4d2f('0x1e')](_0x4d2f('0x23'),_0x3c26f1);_0x5ab037[_0x4d2f('0x24')]();});}else{logger[_0x4d2f('0x1e')](_0x4d2f('0x25'),_0x3c26f1);_0x5ab037[_0x4d2f('0x24')]();}}else{var _0x522390=this;var _0x48fd2f=new AWS[(_0x4d2f('0x26'))]({'accessKeyId':_0x4b2392[0x0],'secretAccessKey':_0x4b2392[0x1],'region':_0x4b2392[0x2]});var _0x23f3d3={'botAlias':_0x4d2f('0x27'),'botName':_0x4b2392[0x3],'inputText':this[_0x4d2f('0x28')][_0x4d2f('0x1b')],'userId':this['channel']+':'+this[_0x4d2f('0xa')]['id'][_0x4d2f('0x29')]()};_0x48fd2f[_0x4d2f('0x2a')](_0x23f3d3,function(_0x5c7f3f,_0x5e2610){if(_0x5c7f3f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3c26f1,_0x5c7f3f['message']);_0x5ab037[_0x4d2f('0xc')]();}else if(_0x5e2610&&_0x5e2610[_0x4d2f('0x28')]){_0x522390[_0x4d2f('0x1b')][_0x4d2f('0x2b')]=_0x5e2610;_0x229cb3['body']=_0x5e2610['message'];_0x229cb3[_0x4d2f('0x2c')]=_0x4d2f('0x2b');_0x229cb3['providerResponse']=JSON['stringify'](_0x5e2610);return rpc[_0x19f8f1+_0x4d2f('0x2d')][_0x4d2f('0x1c')](_0x229cb3)['then'](function(_0x50c6cf){logger[_0x4d2f('0x1e')](_0x4d2f('0x1f'),_0x3c26f1,_0x229cb3[_0x4d2f('0x1b')]);if(_0x5e2610[_0x4d2f('0x2e')]==_0x4d2f('0x2f')){_0x5ab037[_0x4d2f('0xc')]();}else{_0x5ab037[_0x4d2f('0x24')]();}})['catch'](function(_0x20710a){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3c26f1,JSON[_0x4d2f('0x21')](_0x20710a));_0x5ab037['next']();});}else{_0x5ab037[_0x4d2f('0xc')]();}});}}catch(_0x3f5029){logger[_0x4d2f('0x20')](_0x4d2f('0x1f'),_0x3c26f1,JSON[_0x4d2f('0x21')](_0x3f5029));_0x5ab037[_0x4d2f('0x24')]();}};}; \ 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 c130564..d204008 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 _0x7f09=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','replace','','headers','All','auto_reply','sendMailMessage','messageId','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stringify','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x7f09,0x10a));var _0x97f0=function(_0x545835,_0xcc8291){_0x545835=_0x545835-0x0;var _0x130afe=_0x7f09[_0x545835];return _0x130afe;};'use strict';var _=require(_0x97f0('0x0'));var moment=require(_0x97f0('0x1'));var utils=require(_0x97f0('0x2'));var logger=require(_0x97f0('0x3'))(_0x97f0('0x4'));var rpc={'chatMessage':require(_0x97f0('0x5')),'openchannelMessage':require(_0x97f0('0x6')),'mailMessage':require(_0x97f0('0x7')),'smsMessage':require(_0x97f0('0x8')),'faxMessage':require(_0x97f0('0x9')),'whatsappMessage':require(_0x97f0('0xa')),'chatInteraction':require(_0x97f0('0xb')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x97f0('0xc')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x97f0('0xd')),'whatsappInteraction':require(_0x97f0('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x564100,_0x72af6,_0x3a947c,_0x26c569){return function(_0x1f5173){try{var _0x5ec1db=this['channel'];if(_0x5ec1db==='mail'&&_0x26c569[_0x97f0('0xf')]['isAutoreply']){logger[_0x97f0('0x10')](_0x97f0('0x11'),_0x564100,_0x97f0('0x12'));return _0x1f5173[_0x97f0('0x13')]();}if(_0x72af6[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this[_0x97f0('0x14')][_0x97f0('0x15')])){logger[_0x97f0('0x10')](_0x97f0('0x11'),_0x564100,_0x97f0('0x16'));return _0x1f5173[_0x97f0('0x13')]();}if(_0x72af6[0x0]==='2'&&this[_0x97f0('0x14')][_0x97f0('0x17')]){logger[_0x97f0('0x10')](_0x97f0('0x18'),_0x564100,_0x97f0('0x19'));return _0x1f5173[_0x97f0('0x13')]();}var _0x566f63={'ContactId':this['contact']['id'],'sentAt':moment()[_0x97f0('0x1a')](_0x97f0('0x1b')),'direction':_0x97f0('0x1c')};if(this[_0x97f0('0x1d')]==='mail'){_0x566f63[_0x97f0('0xf')]=utils[_0x97f0('0x1e')](_0x72af6[0x2],this);}else{_0x566f63[_0x97f0('0xf')]=utils[_0x97f0('0x1e')](_0x72af6[0x1],this);}if(this['message']){_0x566f63['to']=this[_0x97f0('0x1f')][_0x97f0('0x20')]||'';if(this[_0x97f0('0x1d')]===_0x97f0('0x21')&&_0x72af6[0x1]==='1'){_0x566f63['cc']=this['message']['cc']||'';}_0x566f63[_0x97f0('0x20')]=this[_0x97f0('0x1f')]['to']||'';_0x566f63[_0x97f0('0x22')]=this[_0x97f0('0x1f')][_0x97f0('0x22')]||'';_0x566f63[_0x97f0('0x23')]=!![];if(this['message']['subject']){_0x566f63[_0x97f0('0x24')]='';_0x566f63[_0x97f0('0x24')]+=_[_0x97f0('0x25')](this[_0x97f0('0x1f')]['subject'],_0x97f0('0x26'))?'':_0x97f0('0x27');_0x566f63[_0x97f0('0x24')]+=this[_0x97f0('0x1f')][_0x97f0('0x24')];}}if(this[_0x97f0('0x1d')]==='chat'){_0x566f63['ChatWebsiteId']=this[_0x97f0('0x28')]['id'];}else{_0x566f63[_[_0x97f0('0x29')](this[_0x97f0('0x1d')])+_0x97f0('0x2a')]=this[_0x97f0('0x28')]['id'];}_0x566f63[_[_0x97f0('0x29')](this[_0x97f0('0x1d')])+_0x97f0('0x2b')]=this[_0x97f0('0x14')]['id'];var _0x20ff7f=this['interaction'];if(rpc[this['channel']+_0x97f0('0x2c')]){if(this[_0x97f0('0x1d')]===_0x97f0('0x21')){_0x566f63[_0x97f0('0x2d')]=this[_0x97f0('0x1f')]['messageId'];_0x566f63[_0x97f0('0x2e')]=_0x97f0('0x2f')+_[_0x97f0('0x30')](_0x566f63[_0x97f0('0xf')],_0x97f0('0x31'),_0x97f0('0x32'))+_0x97f0('0x33');_0x566f63[_0x97f0('0x34')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x97f0('0x35'),'Precedence':_0x97f0('0x36')};return mailRpc[_0x97f0('0x37')](this[_0x97f0('0x28')]['smtpOptions'],_0x566f63)['then'](function(_0x2d3521){logger[_0x97f0('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x564100);_0x566f63[_0x97f0('0x38')]=_0x2d3521[_0x97f0('0x1f')][_0x97f0('0x38')];return rpc[_0x5ec1db+_0x97f0('0x2c')]['create'](_0x566f63);})[_0x97f0('0x39')](function(_0x45bb9d){logger[_0x97f0('0x10')]('[%s][AUTOREPLY]\x20%s',_0x564100,JSON['stringify'](_0x45bb9d));})[_0x97f0('0x3a')](function(_0x5280fd){logger[_0x97f0('0x3b')](_0x97f0('0x3c'),_0x564100,JSON['stringify'](_0x5280fd));})['finally'](function(){Promise[_0x97f0('0x3d')]()[_0x97f0('0x39')](function(){if(_0x72af6[0x0]!=='2'||_0x20ff7f[_0x97f0('0x17')])return;return rpc[_0x5ec1db+_0x97f0('0x3e')]['update'](_0x20ff7f['id'],{'autoreplyExecuted':!![]})[_0x97f0('0x39')](function(_0x3788b8){logger[_0x97f0('0x10')](_0x97f0('0x18'),_0x564100,JSON['stringify'](_0x3788b8));})['catch'](function(_0x2d30c7){logger['error'](_0x97f0('0x3f'),_0x564100,JSON['stringify'](_0x2d30c7));});})[_0x97f0('0x39')](function(){_0x1f5173[_0x97f0('0x13')]();});});}else{return rpc[this[_0x97f0('0x1d')]+_0x97f0('0x2c')][_0x97f0('0x40')](_0x566f63)[_0x97f0('0x39')](function(){logger[_0x97f0('0x10')](_0x97f0('0x11'),_0x564100,_0x566f63[_0x97f0('0xf')]);})[_0x97f0('0x3a')](function(_0x3c8591){logger['error']('[%s][AUTOREPLY]\x20%s',_0x564100,JSON[_0x97f0('0x41')](_0x3c8591));})[_0x97f0('0x42')](function(){Promise[_0x97f0('0x3d')]()[_0x97f0('0x39')](function(){if(_0x72af6[0x0]!=='2'||_0x20ff7f['autoreplyExecuted'])return;return rpc[_0x5ec1db+_0x97f0('0x3e')]['update'](_0x20ff7f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x199e4e){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x564100,JSON[_0x97f0('0x41')](_0x199e4e));})['catch'](function(_0x2a8f87){logger[_0x97f0('0x3b')](_0x97f0('0x3f'),_0x564100,JSON[_0x97f0('0x41')](_0x2a8f87));});})[_0x97f0('0x39')](function(){_0x1f5173[_0x97f0('0x13')]();});});}}}catch(_0x47dbeb){logger['error']('[%s][AUTOREPLY]\x20%s',_0x564100,JSON[_0x97f0('0x41')](_0x47dbeb));_0x1f5173[_0x97f0('0x43')]();}};}; \ No newline at end of file +var _0xe7d6=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','message','from','phone','read','subject','startsWith','account','upperFirst','AccountId','InteractionId','messageId','html','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','autoreplyExecuted','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','lodash','moment','./utils','../../../../config/logger'];(function(_0x46b01f,_0x43dc27){var _0x5b091a=function(_0x2d9713){while(--_0x2d9713){_0x46b01f['push'](_0x46b01f['shift']());}};_0x5b091a(++_0x43dc27);}(_0xe7d6,0x14b));var _0x6e7d=function(_0x4fe284,_0x31f964){_0x4fe284=_0x4fe284-0x0;var _0x2beafc=_0xe7d6[_0x4fe284];return _0x2beafc;};'use strict';var _=require(_0x6e7d('0x0'));var moment=require(_0x6e7d('0x1'));var utils=require(_0x6e7d('0x2'));var logger=require(_0x6e7d('0x3'))(_0x6e7d('0x4'));var rpc={'chatMessage':require(_0x6e7d('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6e7d('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6e7d('0x7')),'whatsappMessage':require(_0x6e7d('0x8')),'chatInteraction':require(_0x6e7d('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x6e7d('0xa')),'smsInteraction':require(_0x6e7d('0xb')),'faxInteraction':require(_0x6e7d('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x6e7d('0xd'));exports[_0x6e7d('0xe')]=function(_0x3b7911,_0x2f40d8,_0x23f56a,_0x10d623){return function(_0x57df67){try{var _0x25e052=this[_0x6e7d('0xf')];if(_0x25e052===_0x6e7d('0x10')&&_0x10d623[_0x6e7d('0x11')][_0x6e7d('0x12')]){logger['info'](_0x6e7d('0x13'),_0x3b7911,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x57df67['next']();}if(_0x2f40d8[0x0]==='1'&&(_[_0x6e7d('0x14')](this[_0x6e7d('0x15')][_0x6e7d('0x16')])||!this[_0x6e7d('0x15')]['created'])){logger[_0x6e7d('0x17')](_0x6e7d('0x13'),_0x3b7911,_0x6e7d('0x18'));return _0x57df67[_0x6e7d('0x19')]();}if(_0x2f40d8[0x0]==='2'&&this[_0x6e7d('0x15')]['autoreplyExecuted']){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b7911,_0x6e7d('0x1a'));return _0x57df67[_0x6e7d('0x19')]();}var _0x7a8162={'ContactId':this[_0x6e7d('0x1b')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6e7d('0x1c')};if(this[_0x6e7d('0xf')]===_0x6e7d('0x10')){_0x7a8162['body']=utils['getMustacheRender'](_0x2f40d8[0x2],this);}else{_0x7a8162[_0x6e7d('0x11')]=utils[_0x6e7d('0x1d')](_0x2f40d8[0x1],this);}if(this[_0x6e7d('0x1e')]){_0x7a8162['to']=this[_0x6e7d('0x1e')][_0x6e7d('0x1f')]||'';if(this[_0x6e7d('0xf')]===_0x6e7d('0x10')&&_0x2f40d8[0x1]==='1'){_0x7a8162['cc']=this[_0x6e7d('0x1e')]['cc']||'';}_0x7a8162[_0x6e7d('0x1f')]=this[_0x6e7d('0x1e')]['to']||'';_0x7a8162[_0x6e7d('0x20')]=this[_0x6e7d('0x1e')]['phone']||'';_0x7a8162[_0x6e7d('0x21')]=!![];if(this['message']['subject']){_0x7a8162[_0x6e7d('0x22')]='';_0x7a8162[_0x6e7d('0x22')]+=_[_0x6e7d('0x23')](this[_0x6e7d('0x1e')][_0x6e7d('0x22')],'Re:')?'':'Re:\x20';_0x7a8162[_0x6e7d('0x22')]+=this[_0x6e7d('0x1e')][_0x6e7d('0x22')];}}if(this[_0x6e7d('0xf')]==='chat'){_0x7a8162['ChatWebsiteId']=this[_0x6e7d('0x24')]['id'];}else{_0x7a8162[_[_0x6e7d('0x25')](this[_0x6e7d('0xf')])+_0x6e7d('0x26')]=this['account']['id'];}_0x7a8162[_['upperFirst'](this['channel'])+_0x6e7d('0x27')]=this[_0x6e7d('0x15')]['id'];var _0xaa0526=this['interaction'];if(rpc[this['channel']+'Message']){if(this[_0x6e7d('0xf')]===_0x6e7d('0x10')){_0x7a8162['inReplyTo']=this[_0x6e7d('0x1e')][_0x6e7d('0x28')];_0x7a8162[_0x6e7d('0x29')]=_0x6e7d('0x2a')+_[_0x6e7d('0x2b')](_0x7a8162[_0x6e7d('0x11')],_0x6e7d('0x2c'),']+(>|$)/g,''),'priorityTrue':_0x26f54d[0x1],'priorityFalse':_0x26f54d[0x2]};var _0x223901=gotoif[_0x3688('0x0')](_0x2b5262,{'typecast':!![]});if(_0x223901[_0x3688('0xe')]){logger[_0x3688('0xf')]('[%s][GOTOIF]\x20%s',_0x2dade8,_[_0x3688('0x10')](_0x223901,_0x3688('0x11'))[_0x3688('0x12')](',\x20'));_0x202c92[_0x3688('0x13')]();}else{try{var _0x27414d=eval('('+_0x2b5262['condition']+')');var _0x287ad2=_0x27414d?_0x2b5262['priorityTrue']:_0x2b5262[_0x3688('0x14')];logger[_0x3688('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2dade8,_0x2b5262[_0x3688('0x16')],_0x27414d,_0x287ad2||_0x3688('0x17'));if(_0x287ad2){var _0x4437d6=_['findIndex'](_0x202c92['rules'](),{'p':_0x287ad2});if(_0x4437d6>=0x0){logger[_0x3688('0x15')](_0x3688('0x18'),_0x2dade8,_0x287ad2||_0x3688('0x17'),_0x4437d6);_0x202c92[_0x3688('0x17')](_0x4437d6);}else{logger[_0x3688('0x15')](_0x3688('0x19'),_0x2dade8,_0x287ad2||_0x3688('0x17'));_0x202c92[_0x3688('0x13')]();}}else{_0x202c92[_0x3688('0x17')]();}}catch(_0xf6a9b0){logger[_0x3688('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2dade8,_0xf6a9b0[_0x3688('0x11')]);_0x202c92['stop']();}}}catch(_0x5bfc5c){logger[_0x3688('0xf')]('[%s][GOTOIF]\x20%s',_0x2dade8,JSON[_0x3688('0x1a')](_0x5bfc5c));_0x202c92[_0x3688('0x13')]();}};}; \ No newline at end of file +var _0x8e4e=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e4e,0x125));var _0xe8e4=function(_0x4ed49f,_0x447d25){_0x4ed49f=_0x4ed49f-0x0;var _0x413528=_0x8e4e[_0x4ed49f];return _0x413528;};'use strict';var schema=require(_0xe8e4('0x0'));var _=require('lodash');var htmlToText=require(_0xe8e4('0x1'));var utils=require(_0xe8e4('0x2'));var logger=require(_0xe8e4('0x3'))(_0xe8e4('0x4'));var gotoif=schema({'condition':{'type':_0xe8e4('0x5'),'required':!![],'message':_0xe8e4('0x6')},'priorityTrue':{'type':'number','message':_0xe8e4('0x7')},'priorityFalse':{'type':_0xe8e4('0x8'),'message':_0xe8e4('0x9')}});exports[_0xe8e4('0xa')]=function(_0x27f4a7,_0x102eb8){return function(_0xf40433){try{var _0x2744a2={'condition':htmlToText[_0xe8e4('0xb')](utils[_0xe8e4('0xc')](_0x102eb8[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x102eb8[0x1],'priorityFalse':_0x102eb8[0x2]};var _0x345853=gotoif['validate'](_0x2744a2,{'typecast':!![]});if(_0x345853[_0xe8e4('0xd')]){logger[_0xe8e4('0xe')](_0xe8e4('0xf'),_0x27f4a7,_[_0xe8e4('0x10')](_0x345853,'message')[_0xe8e4('0x11')](',\x20'));_0xf40433[_0xe8e4('0x12')]();}else{try{var _0x22692e=eval('('+_0x2744a2[_0xe8e4('0x13')]+')');var _0x3e347c=_0x22692e?_0x2744a2[_0xe8e4('0x14')]:_0x2744a2[_0xe8e4('0x15')];logger[_0xe8e4('0x16')](_0xe8e4('0x17'),_0x27f4a7,_0x2744a2[_0xe8e4('0x13')],_0x22692e,_0x3e347c||_0xe8e4('0x18'));if(_0x3e347c){var _0x508736=_[_0xe8e4('0x19')](_0xf40433[_0xe8e4('0x1a')](),{'p':_0x3e347c});if(_0x508736>=0x0){logger[_0xe8e4('0x16')](_0xe8e4('0x1b'),_0x27f4a7,_0x3e347c||_0xe8e4('0x18'),_0x508736);_0xf40433['next'](_0x508736);}else{logger[_0xe8e4('0x16')](_0xe8e4('0x1c'),_0x27f4a7,_0x3e347c||_0xe8e4('0x18'));_0xf40433[_0xe8e4('0x12')]();}}else{_0xf40433[_0xe8e4('0x18')]();}}catch(_0x3dad97){logger[_0xe8e4('0xe')](_0xe8e4('0x1d'),_0x27f4a7,_0x3dad97[_0xe8e4('0x1e')]);_0xf40433[_0xe8e4('0x12')]();}}}catch(_0x464a57){logger['error'](_0xe8e4('0xf'),_0x27f4a7,JSON[_0xe8e4('0x1f')](_0x464a57));_0xf40433['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 7fa1b3a..c9b54c8 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 _0x0565=['routing','number','consequence','length','error','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','../../../../config/logger'];(function(_0x28efc9,_0xaa9d83){var _0x3d397c=function(_0x4eecae){while(--_0x4eecae){_0x28efc9['push'](_0x28efc9['shift']());}};_0x3d397c(++_0xaa9d83);}(_0x0565,0x6e));var _0x5056=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x0565[_0x710815];return _0x5b3b89;};'use strict';var schema=require(_0x5056('0x0'));var _=require('lodash');var logger=require(_0x5056('0x1'))(_0x5056('0x2'));var gotop=schema({'priority':{'type':_0x5056('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x5056('0x4')]=function(_0xc1e4b9,_0xaea5da){return function(_0x29af91){try{var _0x1035cd={'priority':_0xaea5da[0x0]};var _0x490a97=gotop['validate'](_0x1035cd,{'typecast':!![]});if(_0x490a97[_0x5056('0x5')]){logger[_0x5056('0x6')]('[%s][GOTOP]\x20%s',_0xc1e4b9,_['map'](_0x490a97,'message')[_0x5056('0x7')](',\x20'));_0x29af91[_0x5056('0x8')]();}else{logger[_0x5056('0x9')](_0x5056('0xa'),_0xc1e4b9,_0x1035cd[_0x5056('0xb')]);if(_0x1035cd[_0x5056('0xb')]){var _0x2114aa=_['findIndex'](_0x29af91[_0x5056('0xc')](),{'p':_0x1035cd[_0x5056('0xb')]});if(_0x2114aa>=0x0){logger[_0x5056('0x9')](_0x5056('0xd'),_0xc1e4b9,_0x1035cd[_0x5056('0xb')]||_0x5056('0xe'),_0x2114aa);_0x29af91[_0x5056('0xe')](_0x2114aa);}else{logger[_0x5056('0x9')](_0x5056('0xf'),_0xc1e4b9,_0x1035cd['priority']||_0x5056('0xe'));_0x29af91[_0x5056('0x8')]();}}else{_0x29af91['next']();}}}catch(_0xdc6f48){logger[_0x5056('0x6')]('[%s][GOTOP]\x20%s',_0xc1e4b9,JSON['stringify'](_0xdc6f48));_0x29af91[_0x5056('0x8')]();}};}; \ No newline at end of file +var _0xf5ac=['lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','validate'];(function(_0x35235c,_0x16f1c1){var _0x22625f=function(_0x4fcb94){while(--_0x4fcb94){_0x35235c['push'](_0x35235c['shift']());}};_0x22625f(++_0x16f1c1);}(_0xf5ac,0x18b));var _0xcf5a=function(_0x3f1942,_0x7b8fc5){_0x3f1942=_0x3f1942-0x0;var _0x10d0a3=_0xf5ac[_0x3f1942];return _0x10d0a3;};'use strict';var schema=require(_0xcf5a('0x0'));var _=require(_0xcf5a('0x1'));var logger=require('../../../../config/logger')(_0xcf5a('0x2'));var gotop=schema({'priority':{'type':_0xcf5a('0x3'),'required':!![],'message':_0xcf5a('0x4')}});exports['consequence']=function(_0x5bafed,_0x58ebca){return function(_0x4d6fc9){try{var _0x399dee={'priority':_0x58ebca[0x0]};var _0x1d2bc6=gotop[_0xcf5a('0x0')](_0x399dee,{'typecast':!![]});if(_0x1d2bc6[_0xcf5a('0x5')]){logger[_0xcf5a('0x6')]('[%s][GOTOP]\x20%s',_0x5bafed,_['map'](_0x1d2bc6,_0xcf5a('0x7'))[_0xcf5a('0x8')](',\x20'));_0x4d6fc9[_0xcf5a('0x9')]();}else{logger[_0xcf5a('0xa')](_0xcf5a('0xb'),_0x5bafed,_0x399dee['priority']);if(_0x399dee[_0xcf5a('0xc')]){var _0x2e5642=_[_0xcf5a('0xd')](_0x4d6fc9['rules'](),{'p':_0x399dee[_0xcf5a('0xc')]});if(_0x2e5642>=0x0){logger[_0xcf5a('0xa')](_0xcf5a('0xe'),_0x5bafed,_0x399dee[_0xcf5a('0xc')]||_0xcf5a('0xf'),_0x2e5642);_0x4d6fc9[_0xcf5a('0xf')](_0x2e5642);}else{logger[_0xcf5a('0xa')](_0xcf5a('0x10'),_0x5bafed,_0x399dee['priority']||_0xcf5a('0xf'));_0x4d6fc9[_0xcf5a('0x9')]();}}else{_0x4d6fc9[_0xcf5a('0xf')]();}}}catch(_0x4f8689){logger[_0xcf5a('0x6')](_0xcf5a('0x11'),_0x5bafed,JSON['stringify'](_0x4f8689));_0x4d6fc9[_0xcf5a('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index f31052c..e3187dc 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 _0x3df4=['lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','account','upperFirst','AccountId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','error','stop','stringify'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3df4,0x12b));var _0x43df=function(_0x509f5b,_0x32fbcc){_0x509f5b=_0x509f5b-0x0;var _0x37b878=_0x3df4[_0x509f5b];return _0x37b878;};'use strict';var _=require(_0x43df('0x0'));var utils=require('./utils');var logger=require(_0x43df('0x1'))(_0x43df('0x2'));var rpc={'chatMessage':require(_0x43df('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x43df('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x43df('0x5')),'whatsappMessage':require(_0x43df('0x6'))};exports['consequence']=function(_0x585b47,_0x5329be){return function(_0x355392){try{var _0x4fe147={'body':utils[_0x43df('0x7')](_0x5329be[0x0],this),'ContactId':this[_0x43df('0x8')]['id']};if(this[_0x43df('0x9')]==='chat'){_0x4fe147['ChatWebsiteId']=this[_0x43df('0xa')]['id'];}else{_0x4fe147[_[_0x43df('0xb')](this[_0x43df('0x9')])+_0x43df('0xc')]=this[_0x43df('0xa')]['id'];}_0x4fe147[_[_0x43df('0xb')](this[_0x43df('0x9')])+'InteractionId']=this[_0x43df('0xd')]['id'];if(rpc[this[_0x43df('0x9')]+_0x43df('0xe')]){return rpc[this[_0x43df('0x9')]+'Message']['create'](_0x4fe147)[_0x43df('0xf')](function(_0x18be5e){logger[_0x43df('0x10')](_0x43df('0x11'),_0x585b47,_0x4fe147[_0x43df('0x12')]);_0x355392[_0x43df('0x13')]();})['catch'](function(_0x11c991){logger[_0x43df('0x14')](_0x43df('0x11'),_0x585b47,JSON['stringify'](_0x11c991));_0x355392[_0x43df('0x15')]();});}}catch(_0x4be769){logger[_0x43df('0x14')](_0x43df('0x11'),_0x585b47,JSON[_0x43df('0x16')](_0x4be769));_0x355392[_0x43df('0x15')]();}};}; \ No newline at end of file +var _0x1da8=['getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','info','[%s][MESSAGE]\x20%s','body','next','error','stop','stringify','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x55f160,_0x722f1f){var _0x1ddce6=function(_0x28552a){while(--_0x28552a){_0x55f160['push'](_0x55f160['shift']());}};_0x1ddce6(++_0x722f1f);}(_0x1da8,0x1ad));var _0x81da=function(_0x44a995,_0x472491){_0x44a995=_0x44a995-0x0;var _0x1af8d7=_0x1da8[_0x44a995];return _0x1af8d7;};'use strict';var _=require(_0x81da('0x0'));var utils=require(_0x81da('0x1'));var logger=require(_0x81da('0x2'))('routing');var rpc={'chatMessage':require(_0x81da('0x3')),'openchannelMessage':require(_0x81da('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x81da('0x5')),'whatsappMessage':require(_0x81da('0x6'))};exports[_0x81da('0x7')]=function(_0x444e24,_0x21b4d3){return function(_0x57d0b7){try{var _0x4b7d67={'body':utils[_0x81da('0x8')](_0x21b4d3[0x0],this),'ContactId':this[_0x81da('0x9')]['id']};if(this[_0x81da('0xa')]===_0x81da('0xb')){_0x4b7d67[_0x81da('0xc')]=this[_0x81da('0xd')]['id'];}else{_0x4b7d67[_[_0x81da('0xe')](this[_0x81da('0xa')])+'AccountId']=this[_0x81da('0xd')]['id'];}_0x4b7d67[_[_0x81da('0xe')](this[_0x81da('0xa')])+'InteractionId']=this[_0x81da('0xf')]['id'];if(rpc[this[_0x81da('0xa')]+'Message']){return rpc[this[_0x81da('0xa')]+'Message']['create'](_0x4b7d67)['then'](function(_0x20f6d5){logger[_0x81da('0x10')](_0x81da('0x11'),_0x444e24,_0x4b7d67[_0x81da('0x12')]);_0x57d0b7[_0x81da('0x13')]();})['catch'](function(_0x44a548){logger[_0x81da('0x14')](_0x81da('0x11'),_0x444e24,JSON['stringify'](_0x44a548));_0x57d0b7[_0x81da('0x15')]();});}}catch(_0x454aa2){logger[_0x81da('0x14')](_0x81da('0x11'),_0x444e24,JSON[_0x81da('0x16')](_0x454aa2));_0x57d0b7[_0x81da('0x15')]();}};}; \ 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 f1c982e..ba7a4b3 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 _0xcd9a=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x29e4b8,_0x1ff29b){var _0x3b5d2e=function(_0x48e273){while(--_0x48e273){_0x29e4b8['push'](_0x29e4b8['shift']());}};_0x3b5d2e(++_0x1ff29b);}(_0xcd9a,0x1b3));var _0xacd9=function(_0xf3c18d,_0x2c3f98){_0xf3c18d=_0xf3c18d-0x0;var _0x31ac86=_0xcd9a[_0xf3c18d];return _0x31ac86;};'use strict';var utils=require(_0xacd9('0x0'));var logger=require(_0xacd9('0x1'))(_0xacd9('0x2'));exports[_0xacd9('0x3')]=function(_0x12a47f,_0x1eff04){return function(_0x103bc5){try{logger[_0xacd9('0x4')](_0xacd9('0x5'),_0x12a47f,utils[_0xacd9('0x6')](_0x1eff04[0x0],this));_0x103bc5[_0xacd9('0x7')]();}catch(_0x3a8e41){logger[_0xacd9('0x8')](_0xacd9('0x5'),_0x12a47f,JSON[_0xacd9('0x9')](_0x3a8e41));_0x103bc5[_0xacd9('0xa')]();}};}; \ No newline at end of file +var _0x407d=['../../../../config/logger','routing','consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s','stop','./utils'];(function(_0x2c31a5,_0x490ec3){var _0x1f902a=function(_0xde5d2f){while(--_0xde5d2f){_0x2c31a5['push'](_0x2c31a5['shift']());}};_0x1f902a(++_0x490ec3);}(_0x407d,0x167));var _0xd407=function(_0x26ddcd,_0xfb4e75){_0x26ddcd=_0x26ddcd-0x0;var _0x2a2f45=_0x407d[_0x26ddcd];return _0x2a2f45;};'use strict';var utils=require(_0xd407('0x0'));var logger=require(_0xd407('0x1'))(_0xd407('0x2'));exports[_0xd407('0x3')]=function(_0x23af6e,_0xe4e15a){return function(_0x95ad60){try{logger[_0xd407('0x4')]('[%s][NOOP]\x20%s',_0x23af6e,utils[_0xd407('0x5')](_0xe4e15a[0x0],this));_0x95ad60[_0xd407('0x6')]();}catch(_0x3a947a){logger['error'](_0xd407('0x7'),_0x23af6e,JSON['stringify'](_0x3a947a));_0x95ad60[_0xd407('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index c29eba4..4fc6de7 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 _0x09d1=['QueueId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','strategy','rrmemory','log','stack','validate','lodash','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel'];(function(_0x1c12ba,_0x578e46){var _0x1a67fb=function(_0x16f680){while(--_0x16f680){_0x1c12ba['push'](_0x1c12ba['shift']());}};_0x1a67fb(++_0x578e46);}(_0x09d1,0xba));var _0x109d=function(_0xe5af4c,_0x360f55){_0xe5af4c=_0xe5af4c-0x0;var _0x2dcc8d=_0x09d1[_0xe5af4c];return _0x2dcc8d;};'use strict';var schema=require(_0x109d('0x0'));var _=require(_0x109d('0x1'));var util=require('util');var seqqueue=require(_0x109d('0x2'));var moment=require(_0x109d('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x109d('0x4'))(_0x109d('0x5'));var strategy=require(_0x109d('0x6'));config[_0x109d('0x7')]=_['defaults'](config['redis'],{'host':_0x109d('0x8'),'port':0x18eb});var io=require(_0x109d('0x9'))(new Redis(config[_0x109d('0x7')]));var attributes=['id',_0x109d('0xa'),_0x109d('0xb'),_0x109d('0xc'),_0x109d('0xd'),_0x109d('0xe')];function emit(_0x26e8a2,_0x11c41b,_0x55260b){io['to'](_0x26e8a2)[_0x109d('0xf')](_0x11c41b,_0x55260b);}function emitChannelQueueInteraction(_0x3114cb,_0x3b6731,_0x424035,_0x41e61b,_0x578bb2,_0x587581,_0x104ba0,_0x586dc0){var _0x2048d5=_[_0x109d('0x10')](_0x424035);_0x2048d5[_0x109d('0xa')]=_0x586dc0;_0x2048d5[_0x109d('0xc')]=_0x3b6731;_0x2048d5['account']=_0x41e61b;_0x2048d5['id']=_0x578bb2;if(_0x587581){_0x104ba0[util[_0x109d('0x11')]('%sQueuesWaitingInteractions',_0x3114cb)][_0x578bb2]=_['pick'](_0x2048d5,attributes);}else{delete _0x104ba0[util[_0x109d('0x11')](_0x109d('0x12'),_0x3114cb)][_0x578bb2];}emit(util[_0x109d('0x11')](_0x109d('0x13'),_0x3114cb,_0x3b6731),util[_0x109d('0x11')](_0x109d('0x14'),_0x3114cb,_0x587581?'save':_0x109d('0x15')),_['pick'](_0x2048d5,attributes));}var rpc={'openchannelQueueReport':require(_0x109d('0x16')),'mailQueueReport':require(_0x109d('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x109d('0x18')),'faxQueueReport':require(_0x109d('0x19')),'whatsappQueueReport':require(_0x109d('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x109d('0x1b'),'message':_0x109d('0x1c')}});function startRouting(_0x3c38f7,_0x16286a,_0x512a89,_0x1e83b3){if(_0x3c38f7&&_0x16286a&&_0x512a89){_0x16286a[_0x109d('0x1d')]+=0x1;var _0x3e6658={'uniqueid':_0x3c38f7,'from':_0x512a89['body']?_0x512a89[_0x109d('0x1e')][_0x109d('0xd')]:'','joinAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'ContactId':_0x512a89[_0x109d('0x20')]?_0x512a89['contact']['id']:null,'ListId':_0x512a89[_0x109d('0x21')]?_0x512a89[_0x109d('0x21')]['id']:null};_0x3e6658[_[_0x109d('0x22')](_0x512a89[_0x109d('0x23')])+_0x109d('0x24')]=_0x16286a['id']||null;_0x3e6658[_[_0x109d('0x22')](_0x512a89[_0x109d('0x23')])+'InteractionId']=_0x512a89[_0x109d('0x25')]?_0x512a89[_0x109d('0x25')]['id']:null;_0x3e6658[_[_0x109d('0x22')](_0x512a89['channel'])+'MessageId']=_0x512a89[_0x109d('0x26')]?_0x512a89['message']['id']:null;_0x3e6658[_[_0x109d('0x22')](_0x512a89[_0x109d('0x23')])+(_0x512a89[_0x109d('0x23')]!==_0x109d('0x27')?_0x109d('0x28'):_0x109d('0x29'))]=_0x512a89['account']?_0x512a89[_0x109d('0xb')]['id']:null;logger[_0x109d('0x2a')](util['format'](_0x109d('0x2b'),_0x3c38f7,_0x16286a[_0x109d('0x2c')]));emitChannelQueueInteraction(_0x512a89[_0x109d('0x23')],_0x16286a['name'],_0x3e6658,_0x512a89['account'][_0x109d('0x2c')],_0x512a89[_0x109d('0x26')]['id'],!![],_0x1e83b3,_0x16286a['id']);if(rpc[_0x512a89[_0x109d('0x23')]+_0x109d('0x2d')]){return rpc[_0x512a89[_0x109d('0x23')]+_0x109d('0x2d')][_0x109d('0x2e')](_0x3e6658)['catch'](function(_0x17650f){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x43c630,_0x37157d,_0x5ae6fa,_0x506f53){if(_0x43c630&&_0x37157d){_0x37157d['waiting']-=0x1;var _0x3cadc6={'leaveAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'acceptAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'reason':_0x109d('0x2f')};logger['info'](util['format'](_0x109d('0x30'),_0x43c630,_0x37157d[_0x109d('0x2c')]));emitChannelQueueInteraction(_0x5ae6fa[_0x109d('0x23')],_0x37157d['name'],_0x5ae6fa['body'],_0x5ae6fa[_0x109d('0xb')][_0x109d('0x2c')],_0x5ae6fa[_0x109d('0x26')]['id'],![],_0x506f53,_0x37157d['id']);if(rpc[_0x5ae6fa[_0x109d('0x23')]+_0x109d('0x2d')]){return rpc[_0x5ae6fa[_0x109d('0x23')]+_0x109d('0x2d')][_0x109d('0x31')](_0x43c630,_0x3cadc6)[_0x109d('0x32')](function(_0x19441f){logger['error'](_0x109d('0x33'));});}}}function endRouting(_0xd6729f,_0xd3e6cc,_0x3ca95b,_0x18074f){if(_0xd6729f&&_0xd3e6cc){_0xd3e6cc[_0x109d('0x1d')]-=0x1;var _0x51c506={'leaveAt':moment()[_0x109d('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x109d('0x11')](_0x109d('0x1f')),'reason':_0x109d('0x34')};logger[_0x109d('0x2a')](util[_0x109d('0x11')]('[%s][END:QUEUE][NAME:%s]',_0xd6729f,_0xd3e6cc[_0x109d('0x2c')]));emitChannelQueueInteraction(_0x3ca95b['channel'],_0xd3e6cc[_0x109d('0x2c')],_0x3ca95b[_0x109d('0x1e')],_0x3ca95b['account'][_0x109d('0x2c')],_0x3ca95b['message']['id'],![],_0x18074f);if(rpc[_0x3ca95b[_0x109d('0x23')]+'QueueReport']){return rpc[_0x3ca95b['channel']+_0x109d('0x2d')][_0x109d('0x31')](_0xd6729f,_0x51c506)[_0x109d('0x32')](function(_0x39889d){logger[_0x109d('0x35')](_0x109d('0x33'));});}}}function handleFindQueue(_0x16d4e7){return function(_0x2e3529){return _0x2e3529[_0x109d('0x2c')][_0x109d('0x36')]()===_0x16d4e7[_0x109d('0x36')]();};}exports[_0x109d('0x37')]=function(_0x4195e7,_0x1a4833,_0x31732c,_0x27caa0){return function(_0x16fc7a){try{var _0x2a645e={'name':_0x1a4833[0x0],'timeout':_0x1a4833[0x1]};var _0x502313=queue['validate'](_0x2a645e,{'typecast':!![]});if(_0x502313[_0x109d('0x38')]){logger['error'](_0x109d('0x39'),_0x4195e7,_[_0x109d('0x3a')](_0x502313,_0x109d('0x26'))[_0x109d('0x3b')](',\x20'));_0x16fc7a[_0x109d('0x3c')]();}else{var _0x36ad9d=_[_0x109d('0x3d')](_0x31732c[_0x27caa0['channel']+_0x109d('0x3e')],handleFindQueue(_0x2a645e['name']));if(_0x36ad9d){startRouting(_0x4195e7,_0x36ad9d,_0x27caa0,_0x31732c);var _0x3dcdc2=(_0x36ad9d[_0x109d('0x34')]||0xa)*0x3e8;var _0x3709b4=(_0x2a645e[_0x109d('0x34')]||0x14)*0x3e8;var _0x2d316f,_0x80aaa2;if(_0x3dcdc2>_0x3709b4){_0x3709b4=_0x3dcdc2;}var _0x3bad93=seqqueue[_0x109d('0x3f')](_0x3dcdc2);_0x3bad93['id']=_0x4195e7;_0x3bad93[_0x109d('0x40')]=_0x3dcdc2;_0x3bad93[_0x109d('0x41')]=_0x3709b4;_0x3bad93[_0x109d('0x23')]=_0x27caa0[_0x109d('0x23')];_0x31732c[_0x109d('0x42')][_0x4195e7]['on'](_0x109d('0x43'),function(){logger[_0x109d('0x2a')](_0x109d('0x44'),_0x4195e7);stopRouting(_0x4195e7,_0x36ad9d,_0x27caa0,_0x31732c);clearTimeout(_0x2d316f);_0x2d316f=undefined;_0x3bad93[_0x109d('0x45')](!![]);if(_0x31732c['rules'][_0x4195e7]){delete _0x31732c[_0x109d('0x42')][_0x4195e7];}_0x16fc7a[_0x109d('0x3c')]();});_0x31732c[_0x109d('0x42')][_0x4195e7]['on']('complete',function(){if(_0x31732c[_0x109d('0x42')][_0x4195e7]){delete _0x31732c['rules'][_0x4195e7];}});_0x2d316f=setTimeout(function(){logger[_0x109d('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4195e7);endRouting(_0x4195e7,_0x36ad9d,_0x27caa0,_0x31732c);clearTimeout(_0x2d316f);_0x3bad93[_0x109d('0x45')](!![]);_0x16fc7a['next']();},_0x3709b4);switch(_0x36ad9d[_0x109d('0x46')]){case _0x109d('0x47'):strategy['rrmemory'](_0x3bad93,_0x36ad9d,_0x31732c,_0x27caa0);break;default:strategy['beepall'](_0x3bad93,_0x36ad9d,_0x31732c,_0x27caa0);}}else{logger[_0x109d('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4195e7,_0x2a645e[_0x109d('0x2c')]);_0x16fc7a['stop']();}}}catch(_0x498172){console[_0x109d('0x48')](_0x498172);logger[_0x109d('0x35')](_0x109d('0x39'),_0x4195e7,_0x498172[_0x109d('0x49')]);_0x16fc7a[_0x109d('0x3c')]();}};}; \ No newline at end of file +var _0xc6d7=['../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','error','toLowerCase','stop','find','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport'];(function(_0x50758e,_0x2b6228){var _0xfc0497=function(_0x283f8d){while(--_0x283f8d){_0x50758e['push'](_0x50758e['shift']());}};_0xfc0497(++_0x2b6228);}(_0xc6d7,0x71));var _0x7c6d=function(_0x2699b7,_0x4a2eab){_0x2699b7=_0x2699b7-0x0;var _0x2b2427=_0xc6d7[_0x2699b7];return _0x2b2427;};'use strict';var schema=require(_0x7c6d('0x0'));var _=require(_0x7c6d('0x1'));var util=require(_0x7c6d('0x2'));var seqqueue=require(_0x7c6d('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x7c6d('0x4'));var logger=require(_0x7c6d('0x5'))(_0x7c6d('0x6'));var strategy=require(_0x7c6d('0x7'));config[_0x7c6d('0x8')]=_[_0x7c6d('0x9')](config[_0x7c6d('0x8')],{'host':_0x7c6d('0xa'),'port':0x18eb});var io=require(_0x7c6d('0xb'))(new Redis(config[_0x7c6d('0x8')]));var attributes=['id',_0x7c6d('0xc'),_0x7c6d('0xd'),_0x7c6d('0xe'),_0x7c6d('0xf'),'joinAt'];function emit(_0x477a41,_0x4aeaf6,_0x3e70ad){io['to'](_0x477a41)[_0x7c6d('0x10')](_0x4aeaf6,_0x3e70ad);}function emitChannelQueueInteraction(_0x2293f7,_0x9f1cbb,_0x479b86,_0x7b3c4c,_0x1d4eb9,_0xc2f28e,_0x1eb828,_0x46a887){var _0x3b5869=_[_0x7c6d('0x11')](_0x479b86);_0x3b5869['queue_id']=_0x46a887;_0x3b5869[_0x7c6d('0xe')]=_0x9f1cbb;_0x3b5869[_0x7c6d('0xd')]=_0x7b3c4c;_0x3b5869['id']=_0x1d4eb9;if(_0xc2f28e){_0x1eb828[util[_0x7c6d('0x12')](_0x7c6d('0x13'),_0x2293f7)][_0x1d4eb9]=_[_0x7c6d('0x14')](_0x3b5869,attributes);}else{delete _0x1eb828[util[_0x7c6d('0x12')](_0x7c6d('0x13'),_0x2293f7)][_0x1d4eb9];}emit(util[_0x7c6d('0x12')](_0x7c6d('0x15'),_0x2293f7,_0x9f1cbb),util['format'](_0x7c6d('0x16'),_0x2293f7,_0xc2f28e?_0x7c6d('0x17'):'remove'),_[_0x7c6d('0x14')](_0x3b5869,attributes));}var rpc={'openchannelQueueReport':require(_0x7c6d('0x18')),'mailQueueReport':require(_0x7c6d('0x19')),'chatQueueReport':require(_0x7c6d('0x1a')),'smsQueueReport':require(_0x7c6d('0x1b')),'faxQueueReport':require(_0x7c6d('0x1c')),'whatsappQueueReport':require(_0x7c6d('0x1d'))};var queue=schema({'name':{'type':_0x7c6d('0x1e'),'required':!![],'message':_0x7c6d('0x1f')},'timeout':{'type':'number','message':_0x7c6d('0x20')}});function startRouting(_0x4f37d5,_0x4020b8,_0x10ac1c,_0x4a40e8){if(_0x4f37d5&&_0x4020b8&&_0x10ac1c){_0x4020b8[_0x7c6d('0x21')]+=0x1;var _0x149bd3={'uniqueid':_0x4f37d5,'from':_0x10ac1c[_0x7c6d('0x22')]?_0x10ac1c[_0x7c6d('0x22')][_0x7c6d('0xf')]:'','joinAt':moment()['format'](_0x7c6d('0x23')),'ContactId':_0x10ac1c[_0x7c6d('0x24')]?_0x10ac1c[_0x7c6d('0x24')]['id']:null,'ListId':_0x10ac1c[_0x7c6d('0x25')]?_0x10ac1c['list']['id']:null};_0x149bd3[_[_0x7c6d('0x26')](_0x10ac1c[_0x7c6d('0x27')])+_0x7c6d('0x28')]=_0x4020b8['id']||null;_0x149bd3[_[_0x7c6d('0x26')](_0x10ac1c[_0x7c6d('0x27')])+_0x7c6d('0x29')]=_0x10ac1c['interaction']?_0x10ac1c[_0x7c6d('0x2a')]['id']:null;_0x149bd3[_[_0x7c6d('0x26')](_0x10ac1c[_0x7c6d('0x27')])+_0x7c6d('0x2b')]=_0x10ac1c['message']?_0x10ac1c['message']['id']:null;_0x149bd3[_['upperFirst'](_0x10ac1c[_0x7c6d('0x27')])+(_0x10ac1c[_0x7c6d('0x27')]!=='chat'?'AccountId':'WebsiteId')]=_0x10ac1c[_0x7c6d('0xd')]?_0x10ac1c[_0x7c6d('0xd')]['id']:null;logger[_0x7c6d('0x2c')](util[_0x7c6d('0x12')](_0x7c6d('0x2d'),_0x4f37d5,_0x4020b8[_0x7c6d('0x2e')]));emitChannelQueueInteraction(_0x10ac1c['channel'],_0x4020b8['name'],_0x149bd3,_0x10ac1c['account'][_0x7c6d('0x2e')],_0x10ac1c[_0x7c6d('0x2f')]['id'],!![],_0x4a40e8,_0x4020b8['id']);if(rpc[_0x10ac1c['channel']+_0x7c6d('0x30')]){return rpc[_0x10ac1c[_0x7c6d('0x27')]+_0x7c6d('0x30')][_0x7c6d('0x31')](_0x149bd3)[_0x7c6d('0x32')](function(_0x4b85af){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x6dfef6,_0x4edfaa,_0x86bef1,_0x5cb915){if(_0x6dfef6&&_0x4edfaa){_0x4edfaa['waiting']-=0x1;var _0x212642={'leaveAt':moment()[_0x7c6d('0x12')](_0x7c6d('0x23')),'acceptAt':moment()[_0x7c6d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x7c6d('0x2c')](util['format'](_0x7c6d('0x33'),_0x6dfef6,_0x4edfaa[_0x7c6d('0x2e')]));emitChannelQueueInteraction(_0x86bef1[_0x7c6d('0x27')],_0x4edfaa[_0x7c6d('0x2e')],_0x86bef1[_0x7c6d('0x22')],_0x86bef1[_0x7c6d('0xd')][_0x7c6d('0x2e')],_0x86bef1[_0x7c6d('0x2f')]['id'],![],_0x5cb915,_0x4edfaa['id']);if(rpc[_0x86bef1[_0x7c6d('0x27')]+_0x7c6d('0x30')]){return rpc[_0x86bef1[_0x7c6d('0x27')]+_0x7c6d('0x30')][_0x7c6d('0x34')](_0x6dfef6,_0x212642)['catch'](function(_0x31c7c9){logger['error'](_0x7c6d('0x35'));});}}}function endRouting(_0x55b673,_0x525176,_0x442c0a,_0x1a19be){if(_0x55b673&&_0x525176){_0x525176[_0x7c6d('0x21')]-=0x1;var _0x1236aa={'leaveAt':moment()[_0x7c6d('0x12')](_0x7c6d('0x23')),'exitAt':moment()[_0x7c6d('0x12')](_0x7c6d('0x23')),'reason':_0x7c6d('0x36')};logger[_0x7c6d('0x2c')](util[_0x7c6d('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x55b673,_0x525176[_0x7c6d('0x2e')]));emitChannelQueueInteraction(_0x442c0a[_0x7c6d('0x27')],_0x525176[_0x7c6d('0x2e')],_0x442c0a[_0x7c6d('0x22')],_0x442c0a[_0x7c6d('0xd')]['name'],_0x442c0a['message']['id'],![],_0x1a19be);if(rpc[_0x442c0a[_0x7c6d('0x27')]+_0x7c6d('0x30')]){return rpc[_0x442c0a[_0x7c6d('0x27')]+_0x7c6d('0x30')][_0x7c6d('0x34')](_0x55b673,_0x1236aa)[_0x7c6d('0x32')](function(_0x2af9de){logger[_0x7c6d('0x37')](_0x7c6d('0x35'));});}}}function handleFindQueue(_0x3b7571){return function(_0x5b9352){return _0x5b9352['name'][_0x7c6d('0x38')]()===_0x3b7571[_0x7c6d('0x38')]();};}exports['consequence']=function(_0x20b8cd,_0x2c965f,_0x4257f5,_0x7783a2){return function(_0x3320b4){try{var _0x447eed={'name':_0x2c965f[0x0],'timeout':_0x2c965f[0x1]};var _0x53e48e=queue[_0x7c6d('0x0')](_0x447eed,{'typecast':!![]});if(_0x53e48e['length']){logger[_0x7c6d('0x37')]('[%s][QUEUE]\x20%s',_0x20b8cd,_['map'](_0x53e48e,_0x7c6d('0x2f'))['join'](',\x20'));_0x3320b4[_0x7c6d('0x39')]();}else{var _0x5682ed=_[_0x7c6d('0x3a')](_0x4257f5[_0x7783a2[_0x7c6d('0x27')]+'Queues'],handleFindQueue(_0x447eed['name']));if(_0x5682ed){startRouting(_0x20b8cd,_0x5682ed,_0x7783a2,_0x4257f5);var _0x5edb13=(_0x5682ed[_0x7c6d('0x36')]||0xa)*0x3e8;var _0x54906a=(_0x447eed['timeout']||0x14)*0x3e8;var _0x500a07,_0x26ca5a;if(_0x5edb13>_0x54906a){_0x54906a=_0x5edb13;}var _0x576fd1=seqqueue[_0x7c6d('0x3b')](_0x5edb13);_0x576fd1['id']=_0x20b8cd;_0x576fd1['atimeout']=_0x5edb13;_0x576fd1['qtimeout']=_0x54906a;_0x576fd1[_0x7c6d('0x27')]=_0x7783a2['channel'];_0x4257f5[_0x7c6d('0x3c')][_0x20b8cd]['on'](_0x7c6d('0x3d'),function(){logger[_0x7c6d('0x2c')](_0x7c6d('0x3e'),_0x20b8cd);stopRouting(_0x20b8cd,_0x5682ed,_0x7783a2,_0x4257f5);clearTimeout(_0x500a07);_0x500a07=undefined;_0x576fd1[_0x7c6d('0x3f')](!![]);if(_0x4257f5[_0x7c6d('0x3c')][_0x20b8cd]){delete _0x4257f5['rules'][_0x20b8cd];}_0x3320b4['stop']();});_0x4257f5[_0x7c6d('0x3c')][_0x20b8cd]['on'](_0x7c6d('0x40'),function(){if(_0x4257f5[_0x7c6d('0x3c')][_0x20b8cd]){delete _0x4257f5[_0x7c6d('0x3c')][_0x20b8cd];}});_0x500a07=setTimeout(function(){logger[_0x7c6d('0x2c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x20b8cd);endRouting(_0x20b8cd,_0x5682ed,_0x7783a2,_0x4257f5);clearTimeout(_0x500a07);_0x576fd1[_0x7c6d('0x3f')](!![]);_0x3320b4[_0x7c6d('0x41')]();},_0x54906a);switch(_0x5682ed[_0x7c6d('0x42')]){case _0x7c6d('0x43'):strategy['rrmemory'](_0x576fd1,_0x5682ed,_0x4257f5,_0x7783a2);break;default:strategy[_0x7c6d('0x44')](_0x576fd1,_0x5682ed,_0x4257f5,_0x7783a2);}}else{logger[_0x7c6d('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x20b8cd,_0x447eed['name']);_0x3320b4[_0x7c6d('0x39')]();}}}catch(_0x2fcce4){console[_0x7c6d('0x45')](_0x2fcce4);logger[_0x7c6d('0x37')]('[%s][QUEUE]\x20%s',_0x20b8cd,_0x2fcce4[_0x7c6d('0x46')]);_0x3320b4[_0x7c6d('0x39')]();}};}; \ 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 faf1fb1..d3624a0 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 _0xa67e=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','squeue','agent','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','busyQueue','showNotification','notificationId','writeLog','RINGING'];(function(_0x4e91bc,_0x121e9a){var _0x3c657f=function(_0x48f214){while(--_0x48f214){_0x4e91bc['push'](_0x4e91bc['shift']());}};_0x3c657f(++_0x121e9a);}(_0xa67e,0xa1));var _0xea67=function(_0x3d641e,_0x1be41c){_0x3d641e=_0x3d641e-0x0;var _0x3da8b9=_0xa67e[_0x3d641e];return _0x3da8b9;};'use strict';var _=require(_0xea67('0x0'));var uuid=require(_0xea67('0x1'));var util=require('./util');var logger=require(_0xea67('0x2'))(_0xea67('0x3'));var Agent=function(_0x33f5dc,_0x1ca54b,_0x8014f1,_0x346cf5){this['notificationId']=uuid['v4']();this[_0xea67('0x4')]=_0x33f5dc;this[_0xea67('0x5')]=_0x1ca54b;this['realtime']=_0x8014f1;this[_0xea67('0x3')]=_0x346cf5;this[_0xea67('0x4')]['push'](this[_0xea67('0x6')][_0xea67('0x7')](this),this[_0xea67('0x8')][_0xea67('0x7')](this));this[_0xea67('0x4')]['on'](_0xea67('0x9'),this[_0xea67('0x8')][_0xea67('0x7')](this));this['squeue']['on'](_0xea67('0xa'),this['handleDrained'][_0xea67('0x7')](this));};Agent[_0xea67('0xb')]['push']=function(){this['squeue'][_0xea67('0xc')](this[_0xea67('0x6')][_0xea67('0x7')](this),this[_0xea67('0x8')][_0xea67('0x7')](this));};Agent['prototype'][_0xea67('0xd')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xea67('0x6')]=function(){logger[_0xea67('0xe')](_0xea67('0xf'),this['squeue']['id'],this[_0xea67('0x5')]['id']);if(_[_0xea67('0x10')](this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']])){logger[_0xea67('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);setTimeout(this[_0xea67('0xc')][_0xea67('0x7')](this),0x3e8);}else{if(this[_0xea67('0x3')][_0xea67('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0xea67('0x12')][this[_0xea67('0x5')]['id']],this[_0xea67('0x4')]['channel'],![])){this['realtime'][_0xea67('0x12')][this['agent']['id']]['busy']=!![];this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']][_0xea67('0x14')]=undefined;util[_0xea67('0x15')](this[_0xea67('0x16')],this[_0xea67('0x4')]['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],null,this['routing']);util[_0xea67('0x17')](this['squeue']['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],_0xea67('0x18')+(this[_0xea67('0x3')][_0xea67('0x13')]?_0xea67('0x19'):''));}else{logger[_0xea67('0xe')](_0xea67('0x1a'),this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);setTimeout(this[_0xea67('0xc')]['bind'](this),0x3e8);}}};Agent[_0xea67('0xb')][_0xea67('0x8')]=function(_0x564484){if(_[_0xea67('0x10')](this['realtime'][_0xea67('0x12')][this[_0xea67('0x5')]['id']])){return logger[_0xea67('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);}else{logger[_0xea67('0xe')](_0xea67('0x1b'),this[_0xea67('0x4')]['id'],this[_0xea67('0x5')]['id']);util[_0xea67('0x1c')](this[_0xea67('0x16')],this['squeue']['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],null,this['routing']);this['realtime'][_0xea67('0x12')][this['agent']['id']]['busy']=![];this[_0xea67('0x11')][_0xea67('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0xea67('0x17')](this[_0xea67('0x4')]['id'],this[_0xea67('0x11')][_0xea67('0x12')][this[_0xea67('0x5')]['id']],_0x564484?_0xea67('0x1d'):'TIMEOUT');}if(!_0x564484){setTimeout(this[_0xea67('0xc')][_0xea67('0x7')](this),0x3e8);}};function agent(_0x1299cb,_0x20341c,_0x1357ab,_0x557d0d){return new Agent(_0x1299cb,_0x20341c,_0x1357ab,_0x557d0d);}module[_0xea67('0x1e')]=agent; \ No newline at end of file +var _0xcf76=['hideNotification','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','timeout','handleTimeout','drained','handleDrained','push','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcf76,0x179));var _0x6cf7=function(_0x9f2513,_0x33feff){_0x9f2513=_0x9f2513-0x0;var _0x2b7ea7=_0xcf76[_0x9f2513];return _0x2b7ea7;};'use strict';var _=require(_0x6cf7('0x0'));var uuid=require(_0x6cf7('0x1'));var util=require(_0x6cf7('0x2'));var logger=require(_0x6cf7('0x3'))(_0x6cf7('0x4'));var Agent=function(_0x10235e,_0xc8dfef,_0x5d5758,_0x211411){this[_0x6cf7('0x5')]=uuid['v4']();this[_0x6cf7('0x6')]=_0x10235e;this[_0x6cf7('0x7')]=_0xc8dfef;this[_0x6cf7('0x8')]=_0x5d5758;this[_0x6cf7('0x4')]=_0x211411;this['squeue']['push'](this[_0x6cf7('0x9')][_0x6cf7('0xa')](this),this['handleTimeout'][_0x6cf7('0xa')](this));this[_0x6cf7('0x6')]['on'](_0x6cf7('0xb'),this[_0x6cf7('0xc')][_0x6cf7('0xa')](this));this[_0x6cf7('0x6')]['on'](_0x6cf7('0xd'),this[_0x6cf7('0xe')][_0x6cf7('0xa')](this));};Agent['prototype'][_0x6cf7('0xf')]=function(){this[_0x6cf7('0x6')][_0x6cf7('0xf')](this['handleRun'][_0x6cf7('0xa')](this),this[_0x6cf7('0xc')][_0x6cf7('0xa')](this));};Agent[_0x6cf7('0x10')]['handleDrained']=function(){this[_0x6cf7('0xc')](!![]);};Agent[_0x6cf7('0x10')][_0x6cf7('0x9')]=function(){logger[_0x6cf7('0x11')](_0x6cf7('0x12'),this['squeue']['id'],this[_0x6cf7('0x7')]['id']);if(_[_0x6cf7('0x13')](this[_0x6cf7('0x8')][_0x6cf7('0x14')][this[_0x6cf7('0x7')]['id']])){logger[_0x6cf7('0x11')](_0x6cf7('0x15'),this[_0x6cf7('0x6')]['id'],this[_0x6cf7('0x7')]['id']);setTimeout(this[_0x6cf7('0xf')][_0x6cf7('0xa')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0x6cf7('0x8')][_0x6cf7('0x14')][this[_0x6cf7('0x7')]['id']],this[_0x6cf7('0x6')]['channel'],![])){this[_0x6cf7('0x8')][_0x6cf7('0x14')][this[_0x6cf7('0x7')]['id']]['busy']=!![];this[_0x6cf7('0x8')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x6cf7('0x16')](this[_0x6cf7('0x5')],this[_0x6cf7('0x6')]['id'],this[_0x6cf7('0x8')][_0x6cf7('0x14')][this[_0x6cf7('0x7')]['id']],null,this[_0x6cf7('0x4')]);util[_0x6cf7('0x17')](this[_0x6cf7('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],'RINGING'+(this[_0x6cf7('0x4')]['forcedOwnership']?_0x6cf7('0x18'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x6cf7('0x6')]['id'],this[_0x6cf7('0x7')]['id']);setTimeout(this[_0x6cf7('0xf')]['bind'](this),0x3e8);}}};Agent[_0x6cf7('0x10')]['handleTimeout']=function(_0x1e675a){if(_[_0x6cf7('0x13')](this[_0x6cf7('0x8')][_0x6cf7('0x14')][this[_0x6cf7('0x7')]['id']])){return logger[_0x6cf7('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6cf7('0x6')]['id'],this[_0x6cf7('0x7')]['id']);}else{logger[_0x6cf7('0x11')](_0x6cf7('0x19'),this[_0x6cf7('0x6')]['id'],this[_0x6cf7('0x7')]['id']);util[_0x6cf7('0x1a')](this[_0x6cf7('0x5')],this['squeue']['id'],this['realtime'][_0x6cf7('0x14')][this['agent']['id']],null,this['routing']);this[_0x6cf7('0x8')][_0x6cf7('0x14')][this['agent']['id']]['busy']=![];this['realtime'][_0x6cf7('0x14')][this[_0x6cf7('0x7')]['id']][_0x6cf7('0x1b')]=undefined;util[_0x6cf7('0x17')](this['squeue']['id'],this['realtime']['agents'][this[_0x6cf7('0x7')]['id']],_0x1e675a?_0x6cf7('0x1c'):_0x6cf7('0x1d'));}if(!_0x1e675a){setTimeout(this[_0x6cf7('0xf')][_0x6cf7('0xa')](this),0x3e8);}};function agent(_0x4d9e88,_0x58d989,_0x125948,_0x201274){return new Agent(_0x4d9e88,_0x58d989,_0x125948,_0x201274);}module[_0x6cf7('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index efe29dd..7c0cf15 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 _0x6c50=['isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleRun','bind','timeout','handleTimeout','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6c50,0xa4));var _0x06c5=function(_0x49a526,_0x367555){_0x49a526=_0x49a526-0x0;var _0x2316ee=_0x6c50[_0x49a526];return _0x2316ee;};'use strict';var _=require(_0x06c5('0x0'));var uuid=require(_0x06c5('0x1'));var util=require(_0x06c5('0x2'));var logger=require(_0x06c5('0x3'))('routing');var Beepall=function(_0xd66539,_0x494494,_0x4271d1,_0x2853be){this[_0x06c5('0x4')]=uuid['v4']();this[_0x06c5('0x5')]=_0xd66539;this[_0x06c5('0x6')]=_0x494494;this[_0x06c5('0x7')]=_0x4271d1;this[_0x06c5('0x8')]=_0x2853be;this[_0x06c5('0x5')][_0x06c5('0x9')](this[_0x06c5('0xa')][_0x06c5('0xb')](this),this['handleTimeout'][_0x06c5('0xb')](this));this[_0x06c5('0x5')]['on'](_0x06c5('0xc'),this[_0x06c5('0xd')]['bind'](this));this['squeue']['on']('drained',this[_0x06c5('0xe')]['bind'](this));};Beepall['prototype']['push']=function(){this[_0x06c5('0x5')]['push'](this[_0x06c5('0xa')][_0x06c5('0xb')](this),this[_0x06c5('0xd')]['bind'](this));};Beepall[_0x06c5('0xf')][_0x06c5('0xe')]=function(){this[_0x06c5('0xd')](!![]);};Beepall[_0x06c5('0xf')]['handleRun']=function(){var _0x4e8669=!![];if(!_[_0x06c5('0x10')](this[_0x06c5('0x6')])&&!_[_0x06c5('0x10')](this['queue'][_0x06c5('0x11')])&&this[_0x06c5('0x6')]['Agents'][_0x06c5('0x12')]>0x0){for(var _0x9045e6=0x0,_0x21aa11;_0x9045e60x0){for(var _0x10a0d3=0x0,_0x709a50;_0x10a0d30x0&&_0x522924[_0x501cc7+_0x75d1('0x23')]>=_0x522924[_0x501cc7+_0x75d1('0x24')]){writeLog(_0x1d9d25,_0x522924,_0x501cc7['toUpperCase']()+_0x75d1('0x25'));return![];}}return!![];};exports[_0x75d1('0x26')]=function(_0x367238,_0x51138e,_0x54095d,_0x57efd6,_0x364dc9){return sendNotification(!![],_0x367238,_0x51138e,_0x54095d,_0x57efd6,_0x364dc9);};exports[_0x75d1('0x27')]=function(_0x45c182,_0x468bf0,_0x38653d,_0x519ceb,_0x4d292e){return sendNotification(![],_0x45c182,_0x468bf0,_0x38653d,_0x519ceb,_0x4d292e);};exports[_0x75d1('0x28')]=writeLog; \ No newline at end of file +var _0xda19=['PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','../../../../../config/environment','routing','defaults','redis','localhost','socket.io-emitter','name','user:save','split','\x20interaction','account','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause'];(function(_0x37a42e,_0x3d53c6){var _0xa79d90=function(_0x41e901){while(--_0x41e901){_0x37a42e['push'](_0x37a42e['shift']());}};_0xa79d90(++_0x3d53c6);}(_0xda19,0xd5));var _0x9da1=function(_0x37d8ae,_0x17e484){_0x37d8ae=_0x37d8ae-0x0;var _0x4de500=_0xda19[_0x37d8ae];return _0x4de500;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var utils=require(_0x9da1('0x1'));var Redis=require('ioredis');var config=require(_0x9da1('0x2'));var logger=require('../../../../../config/logger')(_0x9da1('0x3'));config['redis']=_[_0x9da1('0x4')](config[_0x9da1('0x5')],{'host':_0x9da1('0x6'),'port':0x18eb});var io=require(_0x9da1('0x7'))(new Redis(config[_0x9da1('0x5')]));function sendNotification(_0x2dcbc6,_0x23e4f7,_0x2c3cdd,_0x1c24e6,_0x5e2d18,_0x47df89){io['to'](util['format']('user:%s',_0x1c24e6[_0x9da1('0x8')]))['emit'](_0x9da1('0x9'),_0x1c24e6);var _0x1cca84=_0x47df89||{};var _0x3ba3d3=_0x2c3cdd[_0x9da1('0xa')]('.');var _0x418af0={'uniqueid':_0x23e4f7,'channel':_0x3ba3d3[0x0],'id':_0x3ba3d3[0x1],'title':_0x3ba3d3[0x0]+_0x9da1('0xb'),'interactionId':_0x3ba3d3[0x2],'queue':_0x5e2d18?_0x5e2d18[_0x9da1('0x8')]:null,'sound':_0x1cca84['account']['notificationSound'],'shake':_0x1cca84[_0x9da1('0xc')]['notificationShake']};try{if(!_0x1cca84[_0x9da1('0xd')]){_0x1cca84[_0x9da1('0xd')]={};}if(_0x5e2d18){_0x1cca84[_0x9da1('0xd')][_0x9da1('0xe')]=_0x5e2d18;}else if(_0x1cca84['body'][_0x9da1('0xe')]){delete _0x1cca84['body']['queue'];}_0x418af0[_0x9da1('0xf')]=utils['getMustacheRender'](_0x1cca84[_0x9da1('0xc')][_0x9da1('0x10')],_0x1cca84);}catch(_0x37653d){_0x418af0[_0x9da1('0xf')]=_0x9da1('0x11');logger['error'](util[_0x9da1('0x12')](_0x9da1('0x13'),_0x23e4f7,_0x37653d[_0x9da1('0x14')]));}io['to'](util[_0x9da1('0x12')](_0x9da1('0x15'),_0x1c24e6[_0x9da1('0x8')]))['emit'](util['format'](_0x9da1('0x16'),_0x2dcbc6?_0x9da1('0x17'):_0x9da1('0x18')),_0x418af0);}function writeLog(_0x41e555,_0x40a967,_0x3b1645){return logger[_0x9da1('0x19')](util['format'](_0x9da1('0x1a'),_0x41e555,_0x40a967[_0x9da1('0x8')],_0x3b1645));}exports[_0x9da1('0x1b')]=function(_0xacba30,_0x1fc065,_0x4e9d7d,_0x5454d3){if(_0x1fc065[_0x9da1('0x1c')]){writeLog(_0xacba30,_0x1fc065,_0x9da1('0x1d'));return![];}if(!_0x1fc065[_0x9da1('0x1e')]){writeLog(_0xacba30,_0x1fc065,_0x9da1('0x1f'));return![];}if(_0x1fc065[_0x4e9d7d+_0x9da1('0x20')]){writeLog(_0xacba30,_0x1fc065,_0x9da1('0x21'));return![];}if(_0x5454d3&&_0x1fc065['hasOwnProperty'](_0x4e9d7d+_0x9da1('0x22'))&&_0x1fc065[_0x9da1('0x23')](_0x4e9d7d+'CurrentCapacity')){if(_0x1fc065[_0x4e9d7d+_0x9da1('0x22')]>0x0&&_0x1fc065[_0x4e9d7d+_0x9da1('0x24')]>=_0x1fc065[_0x4e9d7d+'Capacity']){writeLog(_0xacba30,_0x1fc065,_0x4e9d7d[_0x9da1('0x25')]()+_0x9da1('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x36b87a,_0x1d6af5,_0x55cd3d,_0x5c09ed,_0x67dbc8){return sendNotification(!![],_0x36b87a,_0x1d6af5,_0x55cd3d,_0x5c09ed,_0x67dbc8);};exports[_0x9da1('0x27')]=function(_0x5eca5b,_0x27c6e2,_0x5db5c2,_0x5a6f2d,_0x5a59c2){return sendNotification(![],_0x5eca5b,_0x27c6e2,_0x5db5c2,_0x5a6f2d,_0x5a59c2);};exports[_0x9da1('0x28')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index f09f07d..da9ecdf 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 _0xfe72=['string','length','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xfe72,0x1a3));var _0x2fe7=function(_0xedce5d,_0x91b7db){_0xedce5d=_0xedce5d-0x0;var _0x4bee3b=_0xfe72[_0xedce5d];return _0x4bee3b;};'use strict';var schema=require(_0x2fe7('0x0'));var sh=require(_0x2fe7('0x1'));var _=require(_0x2fe7('0x2'));var utils=require(_0x2fe7('0x3'));var logger=require(_0x2fe7('0x4'))(_0x2fe7('0x5'));var system=schema({'command':{'type':_0x2fe7('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5b6979,_0x3aaf20){return function(_0x3d4a1a){try{var _0x4bb752={'command':_0x3aaf20[0x0]};var _0xcc087c=system[_0x2fe7('0x0')](_0x4bb752,{'typecast':!![]});if(_0xcc087c[_0x2fe7('0x7')]){logger[_0x2fe7('0x8')](_0x2fe7('0x9'),_0x5b6979,_[_0x2fe7('0xa')](_0xcc087c,'message')['join'](',\x20'));logger[_0x2fe7('0xb')](_0x2fe7('0xc'),_0x5b6979);_0x3d4a1a[_0x2fe7('0xd')]();}else{var _0x5af0a2=this;var _0x277b98=utils[_0x2fe7('0xe')](_0x3aaf20[0x0],this);logger['info'](_0x2fe7('0xf'),_0x5b6979,_0x277b98);sh[_0x2fe7('0x10')](_[_0x2fe7('0x11')](_0x277b98),function(_0x1e20fc,_0x41e8b5){logger[_0x2fe7('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b6979,_0x1e20fc);if(_0x1e20fc==0x0){var _0xa5385e=_0x41e8b5[_0x2fe7('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x2fe7('0x13')](_0x3aaf20[0x1])||_[_0x2fe7('0x14')](_0x3aaf20[0x1])){logger[_0x2fe7('0xb')](_0x2fe7('0x15'),_0x5b6979);_0x5af0a2[_0x2fe7('0x16')][_0x3aaf20[0x1]]=_0xa5385e;}else{logger[_0x2fe7('0xb')](_0x2fe7('0x17'),_0x5b6979,_0x3aaf20[0x1],_0xa5385e);_0x5af0a2[_0x2fe7('0x16')][_0x3aaf20[0x1]]=_0xa5385e;}}_0x3d4a1a[_0x2fe7('0xd')]();});}}catch(_0x427986){logger['error'](_0x2fe7('0x9'),_0x5b6979,_['isObject'](_0x427986)?JSON[_0x2fe7('0x18')](_0x427986):_0x427986);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5b6979);_0x3d4a1a[_0x2fe7('0xd')]();}};}; \ No newline at end of file +var _0x642a=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils'];(function(_0x1b664d,_0x1d8695){var _0x43af6b=function(_0x7fe8b2){while(--_0x7fe8b2){_0x1b664d['push'](_0x1b664d['shift']());}};_0x43af6b(++_0x1d8695);}(_0x642a,0x1f0));var _0xa642=function(_0x43f55c,_0x8ec6b0){_0x43f55c=_0x43f55c-0x0;var _0xbff2b9=_0x642a[_0x43f55c];return _0xbff2b9;};'use strict';var schema=require(_0xa642('0x0'));var sh=require(_0xa642('0x1'));var _=require(_0xa642('0x2'));var utils=require(_0xa642('0x3'));var logger=require(_0xa642('0x4'))(_0xa642('0x5'));var system=schema({'command':{'type':_0xa642('0x6'),'required':!![],'message':_0xa642('0x7')}});exports[_0xa642('0x8')]=function(_0x430814,_0x43c413){return function(_0x3e9ad9){try{var _0x11a869={'command':_0x43c413[0x0]};var _0xe6f648=system[_0xa642('0x0')](_0x11a869,{'typecast':!![]});if(_0xe6f648['length']){logger[_0xa642('0x9')](_0xa642('0xa'),_0x430814,_[_0xa642('0xb')](_0xe6f648,_0xa642('0xc'))['join'](',\x20'));logger[_0xa642('0xd')](_0xa642('0xe'),_0x430814);_0x3e9ad9[_0xa642('0xf')]();}else{var _0x23fc1d=this;var _0x5f4f35=utils[_0xa642('0x10')](_0x43c413[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x430814,_0x5f4f35);sh['exec'](_[_0xa642('0x11')](_0x5f4f35),function(_0xb05151,_0x578ee8){logger[_0xa642('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x430814,_0xb05151);if(_0xb05151==0x0){var _0x67c174=_0x578ee8[_0xa642('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x43c413[0x1])||_[_0xa642('0x13')](_0x43c413[0x1])){logger[_0xa642('0xd')](_0xa642('0x14'),_0x430814);_0x23fc1d[_0xa642('0x15')][_0x43c413[0x1]]=_0x67c174;}else{logger[_0xa642('0xd')](_0xa642('0x16'),_0x430814,_0x43c413[0x1],_0x67c174);_0x23fc1d['body'][_0x43c413[0x1]]=_0x67c174;}}_0x3e9ad9[_0xa642('0xf')]();});}}catch(_0x38241c){logger[_0xa642('0x9')](_0xa642('0xa'),_0x430814,_[_0xa642('0x17')](_0x38241c)?JSON[_0xa642('0x18')](_0x38241c):_0x38241c);logger[_0xa642('0xd')](_0xa642('0xe'),_0x430814);_0x3e9ad9['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index f17afc8..6f02fdb 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 _0x592a=['consequence','length','error','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','info','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number'];(function(_0x2649b8,_0x6692f){var _0x2506ea=function(_0x26103){while(--_0x26103){_0x2649b8['push'](_0x2649b8['shift']());}};_0x2506ea(++_0x6692f);}(_0x592a,0xa0));var _0xa592=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x592a[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0xa592('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xa592('0x1')),'openchannelInteraction':require(_0xa592('0x2')),'smsInteraction':require(_0xa592('0x3')),'mailInteraction':require(_0xa592('0x4')),'faxInteraction':require(_0xa592('0x5')),'whatsappInteraction':require(_0xa592('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xa592('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa592('0x8')]=function(_0x5db14b,_0x1539f7,_0x1f5baa,_0x139000){return function(_0x55d7a7){try{var _0x401bd3={'tag':_0x1539f7[0x0]};var _0x3b34f8=tag[_0xa592('0x0')](_0x401bd3,{'typecast':!![]});if(_0x3b34f8[_0xa592('0x9')]){logger[_0xa592('0xa')](_0xa592('0xb'),_0x5db14b,_[_0xa592('0xc')](_0x3b34f8,_0xa592('0xd'))['join'](',\x20'));logger['info'](_0xa592('0xe'),_0x5db14b);_0x55d7a7[_0xa592('0xf')]();}else{var _0xa06d87={'ids':[_0x1539f7[0x0]]};if(rpc[_0x139000[_0xa592('0x10')]+_0xa592('0x11')]){rpc[_0x139000[_0xa592('0x10')]+'Interaction'][_0xa592('0x12')](_0x139000[_0xa592('0x13')]['id'],_0xa06d87)[_0xa592('0x14')](function(_0x190197){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5db14b,_0x1539f7[0x1],_0x139000[_0xa592('0x10')],_0x139000[_0xa592('0x13')]['id']);})[_0xa592('0x15')](function(_0x2261c7){logger[_0xa592('0xa')]('[%s][TAG]\x20%s',_0x5db14b,JSON['stringify'](_0x2261c7));logger[_0xa592('0x16')](_0xa592('0xe'),_0x5db14b);})['finally'](function(){_0x55d7a7['next']();});}}}catch(_0x4647f3){logger[_0xa592('0xa')](_0xa592('0xb'),_0x5db14b,_[_0xa592('0x17')](_0x4647f3)?JSON['stringify'](_0x4647f3):_0x4647f3);logger[_0xa592('0x16')](_0xa592('0xe'),_0x5db14b);_0x55d7a7['next']();}};}; \ No newline at end of file +var _0x5639=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','[%s][TAG]\x20%s','isObject','validate','lodash'];(function(_0x37ad67,_0x55e455){var _0x1dafbd=function(_0x5e487b){while(--_0x5e487b){_0x37ad67['push'](_0x37ad67['shift']());}};_0x1dafbd(++_0x55e455);}(_0x5639,0x178));var _0x9563=function(_0x165592,_0x381631){_0x165592=_0x165592-0x0;var _0x4ac4a8=_0x5639[_0x165592];return _0x4ac4a8;};'use strict';var schema=require(_0x9563('0x0'));var _=require(_0x9563('0x1'));var rpc={'chatInteraction':require(_0x9563('0x2')),'openchannelInteraction':require(_0x9563('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9563('0x4')),'faxInteraction':require(_0x9563('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x9563('0x6'))(_0x9563('0x7'));var tag=schema({'tag':{'type':_0x9563('0x8'),'required':!![],'message':_0x9563('0x9')}});exports['consequence']=function(_0x301c33,_0x52d07e,_0x16f375,_0x7dc1cb){return function(_0x2f3f52){try{var _0x250816={'tag':_0x52d07e[0x0]};var _0x475d18=tag[_0x9563('0x0')](_0x250816,{'typecast':!![]});if(_0x475d18[_0x9563('0xa')]){logger[_0x9563('0xb')]('[%s][TAG]\x20%s',_0x301c33,_['map'](_0x475d18,_0x9563('0xc'))[_0x9563('0xd')](',\x20'));logger['info'](_0x9563('0xe'),_0x301c33);_0x2f3f52[_0x9563('0xf')]();}else{var _0x5ee734={'ids':[_0x52d07e[0x0]]};if(rpc[_0x7dc1cb[_0x9563('0x10')]+_0x9563('0x11')]){rpc[_0x7dc1cb[_0x9563('0x10')]+_0x9563('0x11')]['addTags'](_0x7dc1cb[_0x9563('0x12')]['id'],_0x5ee734)[_0x9563('0x13')](function(_0x399f2a){logger[_0x9563('0x14')](_0x9563('0x15'),_0x301c33,_0x52d07e[0x1],_0x7dc1cb[_0x9563('0x10')],_0x7dc1cb['interaction']['id']);})[_0x9563('0x16')](function(_0x3cde93){logger[_0x9563('0xb')]('[%s][TAG]\x20%s',_0x301c33,JSON[_0x9563('0x17')](_0x3cde93));logger[_0x9563('0x14')](_0x9563('0xe'),_0x301c33);})[_0x9563('0x18')](function(){_0x2f3f52[_0x9563('0xf')]();});}}}catch(_0x158fda){logger[_0x9563('0xb')](_0x9563('0x19'),_0x301c33,_[_0x9563('0x1a')](_0x158fda)?JSON[_0x9563('0x17')](_0x158fda):_0x158fda);logger[_0x9563('0x14')](_0x9563('0xe'),_0x301c33);_0x2f3f52[_0x9563('0xf')]();}};}; \ 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 0541cc7..bb9f620 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 _0xb8d7=['logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','method','login','params','utf8','POST','application/json-rpc','then','parse','result'];(function(_0x4f03f6,_0x15994e){var _0x146130=function(_0xe4c9c0){while(--_0xe4c9c0){_0x4f03f6['push'](_0x4f03f6['shift']());}};_0x146130(++_0x15994e);}(_0xb8d7,0xdf));var _0x7b8d=function(_0x9d77b5,_0x4fcdb3){_0x9d77b5=_0x9d77b5-0x0;var _0x4b26d0=_0xb8d7[_0x9d77b5];return _0x4b26d0;};'use strict';var rp=require(_0x7b8d('0x0'));var logger=require('../../../../config/logger')(_0x7b8d('0x1'));var _=require(_0x7b8d('0x2'));var arr=[];exports[_0x7b8d('0x3')]=function(_0xdd84aa,_0x2d506c){return function(_0x459f25){var _0x2d8504=_0x2d506c[0xa];var _0x31a744=_0x2d506c[0xb];var _0x261ee8=_0x2d506c[0xc];var _0x3ae5cc=_0x2d506c[0xd];var _0x28c9f8=_0x2d506c[0xe];var _0x221fd8=_0x2d506c[0xf][_0x7b8d('0x4')](/\n/g,_0x7b8d('0x5'));var _0x555bf1=_0x2d506c[0x10][_0x7b8d('0x4')](/\n/g,'\x20');if(!arr[_0x7b8d('0x6')](_0x31a744)){arr[_0x7b8d('0x7')](_0x31a744);var _0x2f299c=_0x2d506c[0x3];var _0x59a8ea=_0x2d506c[0x4];var _0x72a501=_0x2d506c[0x1];var _0x351816=_0x2d506c[0x0];var _0x27c314={};_0x27c314[_0x7b8d('0x8')]=_0x2d506c[0x8]+'?params='+_0x261ee8+'|'+_0x2d8504+'|'+_0x3ae5cc+'|'+_0x31a744+'|'+_0x28c9f8;_0x27c314[_0x7b8d('0x9')]=_0x2d506c[0x7]+_0x7b8d('0xa')+_0x261ee8+'|'+_0x2d8504+'|'+_0x3ae5cc+'|'+_0x31a744+'|'+_0x28c9f8+'|'+_0x221fd8+'|'+_0x555bf1;_0x27c314[_0x7b8d('0xb')]=_0x2d506c[0x9];var _0x3d4bf8={};_0x3d4bf8[_0x7b8d('0xc')]='2.0';_0x3d4bf8[_0x7b8d('0xd')]=_0x7b8d('0xe');var _0x205ff7=[];_0x205ff7[_0x7b8d('0x7')](_0x2d506c[0x2]);_0x205ff7[_0x7b8d('0x7')](_0x2d506c[0x5]);_0x205ff7[_0x7b8d('0x7')](_0x2d506c[0x6]);_0x3d4bf8[_0x7b8d('0xf')]=_0x205ff7;_0x3d4bf8['id']=0x1;var _0x1fc32c=JSON['stringify'](_0x3d4bf8);var _0x415d35={'encoding':_0x7b8d('0x10'),'method':_0x7b8d('0x11'),'timeout':0x2710,'url':_0x2f299c,'headers':{'Content-Type':_0x7b8d('0x12')},'body':_0x1fc32c};return rp(_0x415d35)[_0x7b8d('0x13')](function(_0x18bd74){const _0x359f70=JSON[_0x7b8d('0x14')](_0x18bd74);if(!_0x359f70[_0x7b8d('0x15')][_0x7b8d('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x46d661=_0x31a744;var _0x408eb9=_0x7b8d('0x17')+_0x72a501+_0x7b8d('0x18')+_0x351816+_0x7b8d('0x19')+_0x46d661+'&data='+JSON['stringify'](_0x27c314);var _0x41c438=_0x59a8ea+'?'+_0x408eb9;return rp(_0x41c438);})[_0x7b8d('0x13')](function(_0x45f4ca){logger[_0x7b8d('0x1a')](_0x7b8d('0x1b'),_0xdd84aa,_0x45f4ca);_0x459f25[_0x7b8d('0x1c')]();})[_0x7b8d('0x1d')](function(_0x49553e){logger[_0x7b8d('0x1e')](_0x7b8d('0x1f'),_0xdd84aa,_[_0x7b8d('0x20')](_0x49553e)?JSON[_0x7b8d('0x21')](_0x49553e):_0x49553e);_0x459f25[_0x7b8d('0x1c')]();});}else{logger[_0x7b8d('0x1a')](_0x7b8d('0x22'),_0xdd84aa);_0x459f25['next']();}};}; \ No newline at end of file +var _0xf429=['catch','error','[%s][TVOX]\x20%s','isObject','next','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','method','login','params','stringify','utf8','POST','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf429,0x14f));var _0x9f42=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xf429[_0x1b4b23];return _0x2a325b;};'use strict';var rp=require('request-promise');var logger=require(_0x9f42('0x0'))(_0x9f42('0x1'));var _=require(_0x9f42('0x2'));var arr=[];exports[_0x9f42('0x3')]=function(_0x5b1ec6,_0x65d8b3){return function(_0x552a42){var _0x5a53e8=_0x65d8b3[0xa];var _0x504f91=_0x65d8b3[0xb];var _0xa238d0=_0x65d8b3[0xc];var _0x473b66=_0x65d8b3[0xd];var _0x23a073=_0x65d8b3[0xe];var _0x1083df=_0x65d8b3[0xf][_0x9f42('0x4')](/\n/g,'\x20-\x20');var _0x1dc9d3=_0x65d8b3[0x10][_0x9f42('0x4')](/\n/g,'\x20');if(!arr[_0x9f42('0x5')](_0x504f91)){arr[_0x9f42('0x6')](_0x504f91);var _0x4ac254=_0x65d8b3[0x3];var _0x36647c=_0x65d8b3[0x4];var _0xf845e3=_0x65d8b3[0x1];var _0x1b29f8=_0x65d8b3[0x0];var _0x234f80={};_0x234f80[_0x9f42('0x7')]=_0x65d8b3[0x8]+_0x9f42('0x8')+_0xa238d0+'|'+_0x5a53e8+'|'+_0x473b66+'|'+_0x504f91+'|'+_0x23a073;_0x234f80[_0x9f42('0x9')]=_0x65d8b3[0x7]+_0x9f42('0x8')+_0xa238d0+'|'+_0x5a53e8+'|'+_0x473b66+'|'+_0x504f91+'|'+_0x23a073+'|'+_0x1083df+'|'+_0x1dc9d3;_0x234f80['title']=_0x65d8b3[0x9];var _0x12cbcb={};_0x12cbcb[_0x9f42('0xa')]='2.0';_0x12cbcb[_0x9f42('0xb')]=_0x9f42('0xc');var _0x550fc4=[];_0x550fc4['push'](_0x65d8b3[0x2]);_0x550fc4[_0x9f42('0x6')](_0x65d8b3[0x5]);_0x550fc4['push'](_0x65d8b3[0x6]);_0x12cbcb[_0x9f42('0xd')]=_0x550fc4;_0x12cbcb['id']=0x1;var _0x5aec4=JSON[_0x9f42('0xe')](_0x12cbcb);var _0x433a09={'encoding':_0x9f42('0xf'),'method':_0x9f42('0x10'),'timeout':0x2710,'url':_0x4ac254,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5aec4};return rp(_0x433a09)[_0x9f42('0x11')](function(_0x50e726){const _0x301c4e=JSON[_0x9f42('0x12')](_0x50e726);if(!_0x301c4e['result'][_0x9f42('0x13')]){throw new Error(_0x9f42('0x14'));}var _0x38766a=_0x504f91;var _0x3dd062=_0x9f42('0x15')+_0xf845e3+_0x9f42('0x16')+_0x1b29f8+_0x9f42('0x17')+_0x38766a+_0x9f42('0x18')+JSON[_0x9f42('0xe')](_0x234f80);var _0x5f5ced=_0x36647c+'?'+_0x3dd062;return rp(_0x5f5ced);})[_0x9f42('0x11')](function(_0x36ff04){logger[_0x9f42('0x19')](_0x9f42('0x1a'),_0x5b1ec6,_0x36ff04);_0x552a42[_0x9f42('0x1b')]();})[_0x9f42('0x1c')](function(_0x14beb2){logger[_0x9f42('0x1d')](_0x9f42('0x1e'),_0x5b1ec6,_[_0x9f42('0x1f')](_0x14beb2)?JSON['stringify'](_0x14beb2):_0x14beb2);_0x552a42[_0x9f42('0x1b')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5b1ec6);_0x552a42[_0x9f42('0x20')]();}};}; \ 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 45812db..2734db8 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2d95ff,_0x50cb4a){var _0x54e1bb=function(_0x42f543){while(--_0x42f543){_0x2d95ff['push'](_0x2d95ff['shift']());}};_0x54e1bb(++_0x50cb4a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x152461,_0x3d9cd5){var _0x283dcc=function(_0x270b1b){while(--_0x270b1b){_0x152461['push'](_0x152461['shift']());}};_0x283dcc(++_0x3d9cd5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 36d940d..abd7959 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 _0x0834=['chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','rules','channel','message','applications','isArray','length','existsSync','app','.js','toLowerCase','appdata','mail','slice','join','push','dialogflow','split','dialogflowv2','amazonlex','tag','tvox','notificationTemplate','interaction','ContactId','body','%s:%s:%s','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values'];(function(_0x346331,_0x433e98){var _0x4af775=function(_0x5ca6ca){while(--_0x5ca6ca){_0x346331['push'](_0x346331['shift']());}};_0x4af775(++_0x433e98);}(_0x0834,0x18e));var _0x4083=function(_0xeba35c,_0x2e5dad){_0xeba35c=_0xeba35c-0x0;var _0x2f2c39=_0x0834[_0xeba35c];return _0x2f2c39;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x4083('0x0'));var fs=require('fs');var jayson=require(_0x4083('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('routing');var rpc={'openchannelQueueReport':require(_0x4083('0x4')),'mailQueueReport':require(_0x4083('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x4083('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x4083('0x7'))};var RuleEngine=require(_0x4083('0x8'));function getId(_0x2c42bb,_0x1d56dd,_0x129337){return util[_0x4083('0x9')](_0x4083('0xa'),_0x2c42bb,_0x1d56dd||0x0,_0x129337||0x0);}function getIntervals(_0x6db0e5,_0x2a5093){var _0x2d739c=[];if(!_[_0x4083('0xb')](_0x2a5093[_0x4083('0xc')])&&!_[_0x4083('0xb')](_0x6db0e5[_0x2a5093[_0x4083('0xc')]])&&!_[_0x4083('0xb')](_0x6db0e5[_0x2a5093['IntervalId']]['Intervals'])){_0x2d739c=_[_0x4083('0xd')](_0x6db0e5[_0x2a5093[_0x4083('0xc')]]['Intervals'],_0x4083('0xe'));}else if(!_[_0x4083('0xb')](_0x2a5093[_0x4083('0xe')])){_0x2d739c=[_0x2a5093['interval']];}return _0x2d739c;}exports['listen']=function(_0xb5badb){_0xb5badb[_0x4083('0xf')]={};return new BPromise(function(_0x5dbe62,_0xa2fde8){var _0x316e54={'Start':function(_0xc7c267){var _0x146632=this;return new Promise(function(_0x38757d,_0x4d59c7){if(_0xc7c267){try{var _0x259b2b=[];var _0x10cadd=getId(_0xc7c267[_0x4083('0x10')],_0xc7c267[_0x4083('0x11')]?_0xc7c267['message']['id']:0x0,_0xc7c267['interaction']?_0xc7c267['interaction']['id']:0x0);if(_0xc7c267[_0x4083('0x12')]&&_[_0x4083('0x13')](_0xc7c267['applications'])&&_0xc7c267[_0x4083('0x12')]['length']){for(var _0x2ae9d5=0x0;_0x2ae9d5<_0xc7c267[_0x4083('0x12')][_0x4083('0x14')];_0x2ae9d5+=0x1){var _0xa18842=_0xc7c267['applications'][_0x2ae9d5];if(fs[_0x4083('0x15')](path['join'](__dirname,_0x4083('0x12'),_0xa18842[_0x4083('0x16')]+_0x4083('0x17')))){var _0x94d72c=[];switch(_0xa18842['app'][_0x4083('0x18')]()){case'autoreply':var _0x2e4dff=_0xa18842[_0x4083('0x19')]['split'](',');if(_0xc7c267['channel']===_0x4083('0x1a')){_0x94d72c['push'](_0x2e4dff[0x0]);_0x94d72c['push'](_0x2e4dff[0x1]);_0x94d72c['push'](_0x2e4dff[_0x4083('0x1b')](0x2,_0x2e4dff[_0x4083('0x14')])[_0x4083('0x1c')](','));}else{_0x94d72c['push'](_0x2e4dff[0x0]);_0x94d72c[_0x4083('0x1d')](_0x2e4dff[_0x4083('0x1b')](0x1,_0x2e4dff[_0x4083('0x14')])['join'](','));}break;case _0x4083('0x1e'):var _0x323736=_0xa18842['appdata'][_0x4083('0x1f')](',');_0x94d72c[_0x4083('0x1d')](_0x323736[0x0]);_0x94d72c[_0x4083('0x1d')](_0x323736[0x1]);_0x94d72c[_0x4083('0x1d')](_0x323736[_0x4083('0x1b')](0x2,_0x323736[_0x4083('0x14')])[_0x4083('0x1c')](','));break;case _0x4083('0x20'):var _0x2a56b5=_0xa18842['appdata']['split'](',');_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x0]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x1]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x2]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[0x3]);_0x94d72c[_0x4083('0x1d')](_0x2a56b5[_0x4083('0x1b')](0x4,_0x2a56b5['length'])[_0x4083('0x1c')](','));break;case _0x4083('0x21'):var _0x2a1eda=_0xa18842[_0x4083('0x19')][_0x4083('0x1f')](',');_0x94d72c[_0x4083('0x1d')](_0x2a1eda[0x0]);_0x94d72c['push'](_0x2a1eda[0x1]);_0x94d72c[_0x4083('0x1d')](_0x2a1eda[0x2]);_0x94d72c[_0x4083('0x1d')](_0x2a1eda[0x3]);_0x94d72c[_0x4083('0x1d')](_0x2a1eda[_0x4083('0x1b')](0x4,_0x2a1eda[_0x4083('0x14')])[_0x4083('0x1c')](','));break;case'message':_0x94d72c[_0x4083('0x1d')](_0xa18842['appdata']);break;case _0x4083('0x22'):_0x94d72c[_0x4083('0x1d')](_0xa18842['TagId']);_0x94d72c[_0x4083('0x1d')](_0xa18842[_0x4083('0x19')]);break;case _0x4083('0x23'):var _0x35c732=utils['getMustacheRender'](_0xc7c267['account'][_0x4083('0x24')],_0xc7c267);var _0x93cd06=_0xa18842['appdata'][_0x4083('0x1f')](',');_0x94d72c['push'](_0x93cd06[0x0]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x1]);_0x94d72c['push'](_0x93cd06[0x2]);_0x94d72c['push'](_0x93cd06[0x3]);_0x94d72c['push'](_0x93cd06[0x4]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x5]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x6]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x7]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x8]);_0x94d72c[_0x4083('0x1d')](_0x93cd06[0x9]);_0x94d72c['push'](_0x93cd06[0xa]);_0x94d72c['push'](_0xc7c267[_0x4083('0x25')]['id']);_0x94d72c[_0x4083('0x1d')](_0xc7c267['message']['id']);_0x94d72c[_0x4083('0x1d')](_0xa18842['ChatWebsiteId']);_0x94d72c['push'](_0xc7c267['interaction'][_0x4083('0x26')]);_0x94d72c[_0x4083('0x1d')](_0xc7c267[_0x4083('0x27')]['body']);_0x94d72c['push'](_0x35c732);break;default:_0x94d72c=_[_0x4083('0xb')](_0xa18842['appdata'])?[]:_0xa18842[_0x4083('0x19')][_0x4083('0x1f')](',');}var _0x3264ec={'id':util[_0x4083('0x9')](_0x4083('0x28'),_0x10cadd,_0xa18842['id'],_0xa18842[_0x4083('0x16')]),'condition':require('./interval')[_0x4083('0x29')](_0x10cadd,getIntervals(_0xb5badb[_0x4083('0x2a')],_0xa18842),_0xb5badb),'consequence':require('./applications/'+_0xa18842['app'])[_0x4083('0x2b')](_0x10cadd,_0x94d72c,_0xb5badb,_0xc7c267),'p':_0xa18842['priority']||0x0};logger[_0x4083('0x2c')](_0x4083('0x2d'),_0x3264ec['id'],_0x4083('0x2e'),getIntervals(_0xb5badb['intervals'],_0xa18842)[_0x4083('0x1c')](_0x4083('0x2f')));_0x259b2b[_0x4083('0x1d')](_0x3264ec);}else{logger['error'](_0x4083('0x30'),path[_0x4083('0x1c')](__dirname,_0x4083('0x12'),_0xa18842[_0x4083('0x16')]+_0x4083('0x17')));}}_0xb5badb[_0x4083('0xf')][_0x10cadd]=new RuleEngine(_0x259b2b);_0xb5badb[_0x4083('0xf')][_0x10cadd][_0x4083('0x31')](_0xc7c267,function(_0x595a4f){logger['info'](_0x4083('0x32'),JSON[_0x4083('0x33')](_0x595a4f[_0x4083('0x34')]));if(_0xb5badb[_0x4083('0xf')][_0x10cadd]){_0xb5badb[_0x4083('0xf')][_0x10cadd][_0x4083('0x35')](_0x4083('0x36'));}});return _0x38757d({'code':0xc8,'message':_0xc7c267});}else{logger['info'](_0x4083('0x37'));return _0x38757d({'code':0xc8,'message':_0xc7c267});}}catch(_0x1faead){logger[_0x4083('0x38')](_0x1faead[_0x4083('0x39')]);return _0x4d59c7(_0x146632[_0x4083('0x38')](0x1f4,_0x1faead));}}return _0x4d59c7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x436313){var _0x586050=this;return new Promise(function(_0x53e0f8,_0x1287bc){if(_0x436313[_0x4083('0x3a')]&&_0x436313[_0x4083('0x3a')]['id']){if(_0xb5badb[_0x4083('0x3b')][_0x436313['agent']['id']]){_0xb5badb[_0x4083('0x3b')][_0x436313['agent']['id']][_0x4083('0x3c')]=![];_0xb5badb[_0x4083('0x3b')][_0x436313[_0x4083('0x3a')]['id']]['busyQueue']=undefined;}}if(_0x436313[_0x4083('0x11')]&&_0x436313[_0x4083('0x11')]['id']){try{var _0xa79370=getId(_0x436313['channel'],_0x436313[_0x4083('0x11')]?_0x436313[_0x4083('0x11')]['id']:0x0,_0x436313[_0x4083('0x25')]?_0x436313[_0x4083('0x25')]['id']:0x0);if(_0xb5badb[_0x4083('0xf')][_0xa79370]){_0xb5badb[_0x4083('0xf')][_0xa79370][_0x4083('0x35')]('end');if(rpc[_0x436313[_0x4083('0x10')]+_0x4083('0x3d')]){rpc[_0x436313[_0x4083('0x10')]+_0x4083('0x3d')]['update'](_0xa79370,{'UserId':_0x436313[_0x4083('0x11')]['UserId']})[_0x4083('0x3e')](function(_0x2c7e01){logger['error'](_0x4083('0x3f'));});}}return _0x53e0f8({'code':0xc8,'message':_0x436313});}catch(_0x2306cf){logger[_0x4083('0x38')](_0x2306cf[_0x4083('0x39')]);return _0x1287bc(_0x586050[_0x4083('0x38')](0x1f4,_0x2306cf));}}logger[_0x4083('0x38')]('message\x20is\x20empty');return _0x1287bc(_0x586050['error'](0x1f4,_0x4083('0x40')));});},'RejectMessage':function(_0x1735d5){var _0x560bfb=this;return new Promise(function(_0x432e25,_0x367e67){if(_0x1735d5[_0x4083('0x3a')]&&_0x1735d5['agent']['id']){try{if(_0xb5badb[_0x4083('0x3b')][_0x1735d5['agent']['id']]){_0xb5badb[_0x4083('0x3b')][_0x1735d5[_0x4083('0x3a')]['id']][_0x4083('0x3c')]=![];_0xb5badb[_0x4083('0x3b')][_0x1735d5[_0x4083('0x3a')]['id']]['busyQueue']=undefined;}return _0x432e25({'code':0xc8,'message':_0x1735d5});}catch(_0x5f0349){logger[_0x4083('0x38')](_0x5f0349['stack']);return _0x367e67(_0x560bfb[_0x4083('0x38')](0x1f4,_0x5f0349));}}logger[_0x4083('0x38')]('message\x20is\x20empty');return _0x367e67(_0x560bfb['error'](0x1f4,_0x4083('0x40')));});},'AbandonInteraction':function(_0x450dce){var _0x2b7ded=this;return new Promise(function(_0x80a9be,_0x3546ef){if(_0x450dce['channel']&&_0x450dce[_0x4083('0x25')]&&_0x450dce['interaction']['id']){try{var _0x2f5919=getId(_0x450dce[_0x4083('0x10')],_0x450dce[_0x4083('0x11')]?_0x450dce['message']['id']:0x0,_0x450dce[_0x4083('0x25')]?_0x450dce[_0x4083('0x25')]['id']:0x0);if(_0xb5badb[_0x4083('0xf')][_0x2f5919]){_0xb5badb[_0x4083('0xf')][_0x2f5919][_0x4083('0x35')](_0x4083('0x41'));}return _0x80a9be({'code':0xc8,'message':_0x450dce});}catch(_0x24f7f9){logger[_0x4083('0x38')](_0x24f7f9[_0x4083('0x39')]);return _0x3546ef(_0x2b7ded[_0x4083('0x38')](0x1f4,_0x24f7f9));}}logger[_0x4083('0x38')](_0x4083('0x40'));return _0x3546ef(_0x2b7ded[_0x4083('0x38')](0x1f4,_0x4083('0x40')));});},'AgentCapacity':function(_0x4d0d8c){var _0x2d8585=this;return new Promise(function(_0x585f4c,_0x28a001){if(_0xb5badb[_0x4083('0x3b')][_0x4083('0x42')](_0x4d0d8c['id'])){for(var _0x54bc61 in _0x4d0d8c['capacity']){if(_0x4d0d8c[_0x4083('0x43')][_0x4083('0x42')](_0x54bc61)){if(_0xb5badb[_0x4083('0x3b')][_0x4d0d8c['id']][_0x4083('0x42')](_0x54bc61+_0x4083('0x44'))){_0xb5badb[_0x4083('0x3b')][_0x4d0d8c['id']][_0x54bc61+_0x4083('0x44')]=parseInt(_0x4d0d8c[_0x4083('0x43')][_0x54bc61],0xa);}}}_0xb5badb[_0x4083('0x3b')][_0x4d0d8c['id']][_0x4083('0x45')]();return _0x585f4c({'code':0xc8,'message':_0xb5badb['agents'][_0x4d0d8c['id']]});}else{return _0x28a001(_0x2d8585[_0x4083('0x38')](0x1f4,_0x4083('0x46')));}});},'Agents':function(_0x36b59d){return new Promise(function(_0x4775f3,_0x56d092){var _0x1a7df7=_[_0x4083('0x47')](_0xb5badb['agents']);_0x4775f3({'count':_0x1a7df7['length'],'rows':_0x1a7df7});});},'ChatQueues':function(_0x134998){return new Promise(function(_0x93f03a,_0x4e8117){var _0x455f28=[];for(var _0x48fc94 in _0xb5badb[_0x4083('0x48')]){if(_0xb5badb[_0x4083('0x48')]['hasOwnProperty'](_0x48fc94)){var _0xd303c5=_0xb5badb[_0x4083('0x48')][_0x48fc94];var _0x1ec9e0={'id':_0xd303c5['id'],'available':_0xd303c5[_0x4083('0x49')],'loggedIn':_0xd303c5['loggedIn'],'name':_0xd303c5[_0x4083('0x4a')],'paused':_0xd303c5[_0x4083('0x4b')],'waiting':_0xd303c5['waiting']};_0x455f28[_0x4083('0x1d')](_0x1ec9e0);}}_0x93f03a({'count':_0x455f28[_0x4083('0x14')],'rows':_0x455f28});});},'MailQueues':function(_0x318cdc){return new Promise(function(_0x5f480b,_0x3956a4){var _0x364e5a=[];for(var _0x484564 in _0xb5badb['mailQueues']){if(_0xb5badb[_0x4083('0x4c')][_0x4083('0x42')](_0x484564)){var _0x504b76=_0xb5badb['mailQueues'][_0x484564];var _0xea250={'id':_0x504b76['id'],'available':_0x504b76[_0x4083('0x49')],'loggedIn':_0x504b76[_0x4083('0x4d')],'name':_0x504b76[_0x4083('0x4a')],'paused':_0x504b76['paused'],'waiting':_0x504b76[_0x4083('0x4e')]};_0x364e5a[_0x4083('0x1d')](_0xea250);}}_0x5f480b({'count':_0x364e5a[_0x4083('0x14')],'rows':_0x364e5a});});},'OpenchannelQueues':function(_0x1dba07){return new Promise(function(_0x255f0f,_0x1d5239){var _0x492591=[];for(var _0x43461f in _0xb5badb['openchannelQueues']){if(_0xb5badb['openchannelQueues'][_0x4083('0x42')](_0x43461f)){var _0x43054e=_0xb5badb[_0x4083('0x4f')][_0x43461f];var _0xf8abd7={'id':_0x43054e['id'],'available':_0x43054e['available'],'loggedIn':_0x43054e[_0x4083('0x4d')],'name':_0x43054e[_0x4083('0x4a')],'paused':_0x43054e[_0x4083('0x4b')],'waiting':_0x43054e[_0x4083('0x4e')]};_0x492591[_0x4083('0x1d')](_0xf8abd7);}}_0x255f0f({'count':_0x492591[_0x4083('0x14')],'rows':_0x492591});});},'SmsQueues':function(_0x175a17){return new Promise(function(_0x10f925,_0x3d8008){var _0x45db6a=[];for(var _0x5e5bea in _0xb5badb[_0x4083('0x50')]){if(_0xb5badb[_0x4083('0x50')][_0x4083('0x42')](_0x5e5bea)){var _0x3f8532=_0xb5badb[_0x4083('0x50')][_0x5e5bea];var _0x4901a3={'id':_0x3f8532['id'],'available':_0x3f8532[_0x4083('0x49')],'loggedIn':_0x3f8532[_0x4083('0x4d')],'name':_0x3f8532['name'],'paused':_0x3f8532['paused'],'waiting':_0x3f8532['waiting']};_0x45db6a[_0x4083('0x1d')](_0x4901a3);}}_0x10f925({'count':_0x45db6a[_0x4083('0x14')],'rows':_0x45db6a});});},'FaxQueues':function(_0x2c66b4){return new Promise(function(_0x387888,_0xad3e9b){var _0x302141=[];for(var _0x5c14cc in _0xb5badb[_0x4083('0x51')]){if(_0xb5badb[_0x4083('0x51')]['hasOwnProperty'](_0x5c14cc)){var _0x353f46=_0xb5badb[_0x4083('0x51')][_0x5c14cc];var _0x20d994={'id':_0x353f46['id'],'available':_0x353f46['available'],'loggedIn':_0x353f46[_0x4083('0x4d')],'name':_0x353f46[_0x4083('0x4a')],'paused':_0x353f46['paused'],'waiting':_0x353f46[_0x4083('0x4e')]};_0x302141[_0x4083('0x1d')](_0x20d994);}}_0x387888({'count':_0x302141[_0x4083('0x14')],'rows':_0x302141});});},'WhatsappQueues':function(_0x446777){return new Promise(function(_0x3f42cd,_0x4d5a9b){var _0x4b76f7=[];for(var _0x444a5c in _0xb5badb['whatsappQueues']){if(_0xb5badb['whatsappQueues'][_0x4083('0x42')](_0x444a5c)){var _0x3341fa=_0xb5badb[_0x4083('0x52')][_0x444a5c];var _0x17faeb={'id':_0x3341fa['id'],'available':_0x3341fa[_0x4083('0x49')],'loggedIn':_0x3341fa['loggedIn'],'name':_0x3341fa[_0x4083('0x4a')],'paused':_0x3341fa['paused'],'waiting':_0x3341fa[_0x4083('0x4e')]};_0x4b76f7[_0x4083('0x1d')](_0x17faeb);}}_0x3f42cd({'count':_0x4b76f7[_0x4083('0x14')],'rows':_0x4b76f7});});},'ChatQueuesWaitingInteractions':function(_0x2c66d0){return new Promise(function(_0x300d71,_0x5cfeea){var _0x164429=_['values'](_0xb5badb[_0x4083('0x53')]);_0x300d71({'count':_0x164429[_0x4083('0x14')],'rows':_0x164429});});},'MailQueuesWaitingInteractions':function(_0x5194f0){return new Promise(function(_0x4af317,_0x9a0e44){var _0x49d185=_['values'](_0xb5badb['mailQueuesWaitingInteractions']);_0x4af317({'count':_0x49d185['length'],'rows':_0x49d185});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f2182){return new Promise(function(_0x2c42e0,_0x13f0cb){var _0x4d1523=_[_0x4083('0x47')](_0xb5badb[_0x4083('0x54')]);_0x2c42e0({'count':_0x4d1523[_0x4083('0x14')],'rows':_0x4d1523});});},'SmsQueuesWaitingInteractions':function(_0x173953){return new Promise(function(_0x2185a1,_0x5ee4e1){var _0x57df0f=_[_0x4083('0x47')](_0xb5badb['smsQueuesWaitingInteractions']);_0x2185a1({'count':_0x57df0f['length'],'rows':_0x57df0f});});},'FaxQueuesWaitingInteractions':function(_0x3ba754){return new Promise(function(_0x22da0b,_0x323610){var _0x40bef5=_[_0x4083('0x47')](_0xb5badb[_0x4083('0x55')]);_0x22da0b({'count':_0x40bef5['length'],'rows':_0x40bef5});});},'WhatsappQueuesWaitingInteractions':function(_0x428290){return new Promise(function(_0x1724d7,_0x1b4274){var _0x3d8278=_[_0x4083('0x47')](_0xb5badb[_0x4083('0x56')]);_0x1724d7({'count':_0x3d8278[_0x4083('0x14')],'rows':_0x3d8278});});}};var _0x1d7ef0=jayson[_0x4083('0x57')](_0x316e54)[_0x4083('0x58')]();_0x1d7ef0['on'](_0x4083('0x38'),function(_0x2d86ad){logger['error'](JSON[_0x4083('0x33')](_0x2d86ad));return _0xa2fde8(_0x2d86ad);});_0x1d7ef0[_0x4083('0x59')](0x232c,_0x4083('0x5a'),function(){console[_0x4083('0x5b')](_0x4083('0x5c'),0x232c);return _0x5dbe62(_0x4083('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x8164=['rules','channel','message','applications','isArray','length','existsSync','app','.js','autoreply','mail','push','slice','join','dialogflow','split','dialogflowv2','appdata','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','interaction','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','emit','complete','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','stringify','log','lodash','util','path','bluebird','uuid','../../../config/environment','routing','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','interval','listen'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x8164,0x170));var _0x4816=function(_0x35335f,_0x4861ff){_0x35335f=_0x35335f-0x0;var _0x4a9103=_0x8164[_0x35335f];return _0x4a9103;};'use strict';var _=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var path=require(_0x4816('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x4816('0x3'));var uuid=require(_0x4816('0x4'));var utils=require('./applications/utils');var config=require(_0x4816('0x5'));var logger=require('../../../config/logger')(_0x4816('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x4816('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x4816('0x8'))};var RuleEngine=require(_0x4816('0x9'));function getId(_0x170e7a,_0x383974,_0x2421e1){return util[_0x4816('0xa')](_0x4816('0xb'),_0x170e7a,_0x383974||0x0,_0x2421e1||0x0);}function getIntervals(_0x1e0118,_0x23d125){var _0x520153=[];if(!_[_0x4816('0xc')](_0x23d125['IntervalId'])&&!_[_0x4816('0xc')](_0x1e0118[_0x23d125[_0x4816('0xd')]])&&!_['isNil'](_0x1e0118[_0x23d125[_0x4816('0xd')]]['Intervals'])){_0x520153=_['map'](_0x1e0118[_0x23d125[_0x4816('0xd')]]['Intervals'],'interval');}else if(!_[_0x4816('0xc')](_0x23d125['interval'])){_0x520153=[_0x23d125[_0x4816('0xe')]];}return _0x520153;}exports[_0x4816('0xf')]=function(_0x13a685){_0x13a685[_0x4816('0x10')]={};return new BPromise(function(_0x42fc52,_0x248163){var _0x1eb683={'Start':function(_0x2a58b7){var _0x45c006=this;return new Promise(function(_0x21354c,_0x1ce1fb){if(_0x2a58b7){try{var _0x4678a9=[];var _0x6119f=getId(_0x2a58b7[_0x4816('0x11')],_0x2a58b7[_0x4816('0x12')]?_0x2a58b7[_0x4816('0x12')]['id']:0x0,_0x2a58b7['interaction']?_0x2a58b7['interaction']['id']:0x0);if(_0x2a58b7[_0x4816('0x13')]&&_[_0x4816('0x14')](_0x2a58b7[_0x4816('0x13')])&&_0x2a58b7[_0x4816('0x13')][_0x4816('0x15')]){for(var _0x37effd=0x0;_0x37effd<_0x2a58b7[_0x4816('0x13')][_0x4816('0x15')];_0x37effd+=0x1){var _0x3df423=_0x2a58b7['applications'][_0x37effd];if(fs[_0x4816('0x16')](path['join'](__dirname,'applications',_0x3df423[_0x4816('0x17')]+_0x4816('0x18')))){var _0x5de184=[];switch(_0x3df423[_0x4816('0x17')]['toLowerCase']()){case _0x4816('0x19'):var _0x41d7f0=_0x3df423['appdata']['split'](',');if(_0x2a58b7[_0x4816('0x11')]===_0x4816('0x1a')){_0x5de184[_0x4816('0x1b')](_0x41d7f0[0x0]);_0x5de184['push'](_0x41d7f0[0x1]);_0x5de184[_0x4816('0x1b')](_0x41d7f0[_0x4816('0x1c')](0x2,_0x41d7f0[_0x4816('0x15')])[_0x4816('0x1d')](','));}else{_0x5de184['push'](_0x41d7f0[0x0]);_0x5de184['push'](_0x41d7f0[_0x4816('0x1c')](0x1,_0x41d7f0[_0x4816('0x15')])['join'](','));}break;case _0x4816('0x1e'):var _0x4f9386=_0x3df423['appdata'][_0x4816('0x1f')](',');_0x5de184[_0x4816('0x1b')](_0x4f9386[0x0]);_0x5de184[_0x4816('0x1b')](_0x4f9386[0x1]);_0x5de184['push'](_0x4f9386[_0x4816('0x1c')](0x2,_0x4f9386['length'])[_0x4816('0x1d')](','));break;case _0x4816('0x20'):var _0x49c337=_0x3df423[_0x4816('0x21')][_0x4816('0x1f')](',');_0x5de184[_0x4816('0x1b')](_0x49c337[0x0]);_0x5de184[_0x4816('0x1b')](_0x49c337[0x1]);_0x5de184[_0x4816('0x1b')](_0x49c337[0x2]);_0x5de184[_0x4816('0x1b')](_0x49c337[0x3]);_0x5de184[_0x4816('0x1b')](_0x49c337[_0x4816('0x1c')](0x4,_0x49c337[_0x4816('0x15')])['join'](','));break;case _0x4816('0x22'):var _0x902962=_0x3df423['appdata']['split'](',');_0x5de184[_0x4816('0x1b')](_0x902962[0x0]);_0x5de184[_0x4816('0x1b')](_0x902962[0x1]);_0x5de184[_0x4816('0x1b')](_0x902962[0x2]);_0x5de184[_0x4816('0x1b')](_0x902962[0x3]);_0x5de184[_0x4816('0x1b')](_0x902962['slice'](0x4,_0x902962['length'])['join'](','));break;case _0x4816('0x12'):_0x5de184[_0x4816('0x1b')](_0x3df423[_0x4816('0x21')]);break;case _0x4816('0x23'):_0x5de184[_0x4816('0x1b')](_0x3df423[_0x4816('0x24')]);_0x5de184['push'](_0x3df423[_0x4816('0x21')]);break;case'tvox':var _0xc92865=utils[_0x4816('0x25')](_0x2a58b7[_0x4816('0x26')][_0x4816('0x27')],_0x2a58b7);var _0x192476=_0x3df423['appdata'][_0x4816('0x1f')](',');_0x5de184['push'](_0x192476[0x0]);_0x5de184['push'](_0x192476[0x1]);_0x5de184[_0x4816('0x1b')](_0x192476[0x2]);_0x5de184['push'](_0x192476[0x3]);_0x5de184['push'](_0x192476[0x4]);_0x5de184['push'](_0x192476[0x5]);_0x5de184['push'](_0x192476[0x6]);_0x5de184[_0x4816('0x1b')](_0x192476[0x7]);_0x5de184[_0x4816('0x1b')](_0x192476[0x8]);_0x5de184['push'](_0x192476[0x9]);_0x5de184[_0x4816('0x1b')](_0x192476[0xa]);_0x5de184[_0x4816('0x1b')](_0x2a58b7['interaction']['id']);_0x5de184[_0x4816('0x1b')](_0x2a58b7[_0x4816('0x12')]['id']);_0x5de184[_0x4816('0x1b')](_0x3df423[_0x4816('0x28')]);_0x5de184['push'](_0x2a58b7[_0x4816('0x29')][_0x4816('0x2a')]);_0x5de184[_0x4816('0x1b')](_0x2a58b7[_0x4816('0x2b')][_0x4816('0x2b')]);_0x5de184[_0x4816('0x1b')](_0xc92865);break;default:_0x5de184=_[_0x4816('0xc')](_0x3df423[_0x4816('0x21')])?[]:_0x3df423[_0x4816('0x21')][_0x4816('0x1f')](',');}var _0xcbded0={'id':util[_0x4816('0xa')](_0x4816('0x2c'),_0x6119f,_0x3df423['id'],_0x3df423['app']),'condition':require(_0x4816('0x2d'))[_0x4816('0x2e')](_0x6119f,getIntervals(_0x13a685[_0x4816('0x2f')],_0x3df423),_0x13a685),'consequence':require(_0x4816('0x30')+_0x3df423[_0x4816('0x17')])[_0x4816('0x31')](_0x6119f,_0x5de184,_0x13a685,_0x2a58b7),'p':_0x3df423[_0x4816('0x32')]||0x0};logger['info'](_0x4816('0x33'),_0xcbded0['id'],'on\x20interval',getIntervals(_0x13a685['intervals'],_0x3df423)[_0x4816('0x1d')](_0x4816('0x34')));_0x4678a9['push'](_0xcbded0);}else{logger[_0x4816('0x35')](_0x4816('0x36'),path[_0x4816('0x1d')](__dirname,'applications',_0x3df423[_0x4816('0x17')]+_0x4816('0x18')));}}_0x13a685[_0x4816('0x10')][_0x6119f]=new RuleEngine(_0x4678a9);_0x13a685[_0x4816('0x10')][_0x6119f][_0x4816('0x37')](_0x2a58b7,function(_0x39c713){logger['info'](_0x4816('0x38'),JSON['stringify'](_0x39c713['matchPath']));if(_0x13a685['rules'][_0x6119f]){_0x13a685[_0x4816('0x10')][_0x6119f][_0x4816('0x39')](_0x4816('0x3a'));}});return _0x21354c({'code':0xc8,'message':_0x2a58b7});}else{logger[_0x4816('0x3b')](_0x4816('0x3c'));return _0x21354c({'code':0xc8,'message':_0x2a58b7});}}catch(_0x22d8d3){logger[_0x4816('0x35')](_0x22d8d3[_0x4816('0x3d')]);return _0x1ce1fb(_0x45c006[_0x4816('0x35')](0x1f4,_0x22d8d3));}}return _0x1ce1fb(_0x4816('0x3e'));});},'AcceptMessage':function(_0x5e24bf){var _0x4ffae3=this;return new Promise(function(_0x258f5f,_0x374d25){if(_0x5e24bf[_0x4816('0x3f')]&&_0x5e24bf[_0x4816('0x3f')]['id']){if(_0x13a685[_0x4816('0x40')][_0x5e24bf[_0x4816('0x3f')]['id']]){_0x13a685[_0x4816('0x40')][_0x5e24bf[_0x4816('0x3f')]['id']]['busy']=![];_0x13a685[_0x4816('0x40')][_0x5e24bf[_0x4816('0x3f')]['id']][_0x4816('0x41')]=undefined;}}if(_0x5e24bf['message']&&_0x5e24bf['message']['id']){try{var _0x2ad19b=getId(_0x5e24bf[_0x4816('0x11')],_0x5e24bf[_0x4816('0x12')]?_0x5e24bf['message']['id']:0x0,_0x5e24bf[_0x4816('0x29')]?_0x5e24bf[_0x4816('0x29')]['id']:0x0);if(_0x13a685[_0x4816('0x10')][_0x2ad19b]){_0x13a685[_0x4816('0x10')][_0x2ad19b][_0x4816('0x39')](_0x4816('0x42'));if(rpc[_0x5e24bf[_0x4816('0x11')]+'QueueReport']){rpc[_0x5e24bf[_0x4816('0x11')]+_0x4816('0x43')][_0x4816('0x44')](_0x2ad19b,{'UserId':_0x5e24bf[_0x4816('0x12')][_0x4816('0x45')]})[_0x4816('0x46')](function(_0x309778){logger[_0x4816('0x35')](_0x4816('0x47'));});}}return _0x258f5f({'code':0xc8,'message':_0x5e24bf});}catch(_0x443d0d){logger[_0x4816('0x35')](_0x443d0d[_0x4816('0x3d')]);return _0x374d25(_0x4ffae3[_0x4816('0x35')](0x1f4,_0x443d0d));}}logger[_0x4816('0x35')](_0x4816('0x48'));return _0x374d25(_0x4ffae3[_0x4816('0x35')](0x1f4,_0x4816('0x48')));});},'RejectMessage':function(_0x11272b){var _0x2e619f=this;return new Promise(function(_0x56321c,_0x1702bf){if(_0x11272b[_0x4816('0x3f')]&&_0x11272b['agent']['id']){try{if(_0x13a685[_0x4816('0x40')][_0x11272b[_0x4816('0x3f')]['id']]){_0x13a685['agents'][_0x11272b[_0x4816('0x3f')]['id']][_0x4816('0x49')]=![];_0x13a685[_0x4816('0x40')][_0x11272b[_0x4816('0x3f')]['id']][_0x4816('0x41')]=undefined;}return _0x56321c({'code':0xc8,'message':_0x11272b});}catch(_0x3f6bf2){logger[_0x4816('0x35')](_0x3f6bf2[_0x4816('0x3d')]);return _0x1702bf(_0x2e619f[_0x4816('0x35')](0x1f4,_0x3f6bf2));}}logger[_0x4816('0x35')]('message\x20is\x20empty');return _0x1702bf(_0x2e619f[_0x4816('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x440ba5){var _0x199363=this;return new Promise(function(_0x57d72e,_0x157ee3){if(_0x440ba5[_0x4816('0x11')]&&_0x440ba5[_0x4816('0x29')]&&_0x440ba5[_0x4816('0x29')]['id']){try{var _0x170c23=getId(_0x440ba5['channel'],_0x440ba5[_0x4816('0x12')]?_0x440ba5[_0x4816('0x12')]['id']:0x0,_0x440ba5[_0x4816('0x29')]?_0x440ba5[_0x4816('0x29')]['id']:0x0);if(_0x13a685[_0x4816('0x10')][_0x170c23]){_0x13a685[_0x4816('0x10')][_0x170c23]['emit'](_0x4816('0x42'));}return _0x57d72e({'code':0xc8,'message':_0x440ba5});}catch(_0x43c287){logger[_0x4816('0x35')](_0x43c287['stack']);return _0x157ee3(_0x199363[_0x4816('0x35')](0x1f4,_0x43c287));}}logger[_0x4816('0x35')](_0x4816('0x48'));return _0x157ee3(_0x199363['error'](0x1f4,_0x4816('0x48')));});},'AgentCapacity':function(_0x1f790b){var _0xa67f45=this;return new Promise(function(_0xfb9e4a,_0x56d223){if(_0x13a685[_0x4816('0x40')][_0x4816('0x4a')](_0x1f790b['id'])){for(var _0x5210d2 in _0x1f790b['capacity']){if(_0x1f790b['capacity'][_0x4816('0x4a')](_0x5210d2)){if(_0x13a685[_0x4816('0x40')][_0x1f790b['id']][_0x4816('0x4a')](_0x5210d2+_0x4816('0x4b'))){_0x13a685[_0x4816('0x40')][_0x1f790b['id']][_0x5210d2+_0x4816('0x4b')]=parseInt(_0x1f790b[_0x4816('0x4c')][_0x5210d2],0xa);}}}_0x13a685['agents'][_0x1f790b['id']][_0x4816('0x4d')]();return _0xfb9e4a({'code':0xc8,'message':_0x13a685[_0x4816('0x40')][_0x1f790b['id']]});}else{return _0x56d223(_0xa67f45[_0x4816('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x356878){return new Promise(function(_0x27392e,_0xcc9277){var _0x2c2a8c=_[_0x4816('0x4e')](_0x13a685[_0x4816('0x40')]);_0x27392e({'count':_0x2c2a8c[_0x4816('0x15')],'rows':_0x2c2a8c});});},'ChatQueues':function(_0x52cf85){return new Promise(function(_0x171c2b,_0x11e6f9){var _0x11b12a=[];for(var _0x4a3cf9 in _0x13a685[_0x4816('0x4f')]){if(_0x13a685[_0x4816('0x4f')]['hasOwnProperty'](_0x4a3cf9)){var _0x3a1cf7=_0x13a685[_0x4816('0x4f')][_0x4a3cf9];var _0x211a2b={'id':_0x3a1cf7['id'],'available':_0x3a1cf7[_0x4816('0x50')],'loggedIn':_0x3a1cf7[_0x4816('0x51')],'name':_0x3a1cf7[_0x4816('0x52')],'paused':_0x3a1cf7[_0x4816('0x53')],'waiting':_0x3a1cf7['waiting']};_0x11b12a[_0x4816('0x1b')](_0x211a2b);}}_0x171c2b({'count':_0x11b12a['length'],'rows':_0x11b12a});});},'MailQueues':function(_0x483ad3){return new Promise(function(_0x4f357f,_0x4b3a3c){var _0x553093=[];for(var _0x15649e in _0x13a685[_0x4816('0x54')]){if(_0x13a685[_0x4816('0x54')]['hasOwnProperty'](_0x15649e)){var _0x3d6908=_0x13a685[_0x4816('0x54')][_0x15649e];var _0x115dc8={'id':_0x3d6908['id'],'available':_0x3d6908[_0x4816('0x50')],'loggedIn':_0x3d6908[_0x4816('0x51')],'name':_0x3d6908[_0x4816('0x52')],'paused':_0x3d6908[_0x4816('0x53')],'waiting':_0x3d6908['waiting']};_0x553093[_0x4816('0x1b')](_0x115dc8);}}_0x4f357f({'count':_0x553093['length'],'rows':_0x553093});});},'OpenchannelQueues':function(_0x44c2ec){return new Promise(function(_0x2cbc59,_0x5277dc){var _0x3002b7=[];for(var _0x9165c8 in _0x13a685[_0x4816('0x55')]){if(_0x13a685['openchannelQueues'][_0x4816('0x4a')](_0x9165c8)){var _0xd5d3b0=_0x13a685[_0x4816('0x55')][_0x9165c8];var _0x56b799={'id':_0xd5d3b0['id'],'available':_0xd5d3b0[_0x4816('0x50')],'loggedIn':_0xd5d3b0[_0x4816('0x51')],'name':_0xd5d3b0[_0x4816('0x52')],'paused':_0xd5d3b0['paused'],'waiting':_0xd5d3b0[_0x4816('0x56')]};_0x3002b7[_0x4816('0x1b')](_0x56b799);}}_0x2cbc59({'count':_0x3002b7[_0x4816('0x15')],'rows':_0x3002b7});});},'SmsQueues':function(_0x391329){return new Promise(function(_0x1c7fb4,_0x3d7d8b){var _0x23cfc4=[];for(var _0x5b7156 in _0x13a685[_0x4816('0x57')]){if(_0x13a685[_0x4816('0x57')][_0x4816('0x4a')](_0x5b7156)){var _0x24b0d5=_0x13a685[_0x4816('0x57')][_0x5b7156];var _0x24df14={'id':_0x24b0d5['id'],'available':_0x24b0d5[_0x4816('0x50')],'loggedIn':_0x24b0d5['loggedIn'],'name':_0x24b0d5[_0x4816('0x52')],'paused':_0x24b0d5[_0x4816('0x53')],'waiting':_0x24b0d5[_0x4816('0x56')]};_0x23cfc4[_0x4816('0x1b')](_0x24df14);}}_0x1c7fb4({'count':_0x23cfc4['length'],'rows':_0x23cfc4});});},'FaxQueues':function(_0x1e0bab){return new Promise(function(_0x1af0dc,_0x46f5f4){var _0xbb9848=[];for(var _0x12de01 in _0x13a685[_0x4816('0x58')]){if(_0x13a685[_0x4816('0x58')][_0x4816('0x4a')](_0x12de01)){var _0x28419c=_0x13a685[_0x4816('0x58')][_0x12de01];var _0x436d35={'id':_0x28419c['id'],'available':_0x28419c[_0x4816('0x50')],'loggedIn':_0x28419c[_0x4816('0x51')],'name':_0x28419c['name'],'paused':_0x28419c[_0x4816('0x53')],'waiting':_0x28419c[_0x4816('0x56')]};_0xbb9848[_0x4816('0x1b')](_0x436d35);}}_0x1af0dc({'count':_0xbb9848[_0x4816('0x15')],'rows':_0xbb9848});});},'WhatsappQueues':function(_0x21fe50){return new Promise(function(_0x35093e,_0x12d58f){var _0x619070=[];for(var _0x202d18 in _0x13a685[_0x4816('0x59')]){if(_0x13a685[_0x4816('0x59')][_0x4816('0x4a')](_0x202d18)){var _0xf439b3=_0x13a685['whatsappQueues'][_0x202d18];var _0xf05f49={'id':_0xf439b3['id'],'available':_0xf439b3[_0x4816('0x50')],'loggedIn':_0xf439b3[_0x4816('0x51')],'name':_0xf439b3['name'],'paused':_0xf439b3['paused'],'waiting':_0xf439b3[_0x4816('0x56')]};_0x619070[_0x4816('0x1b')](_0xf05f49);}}_0x35093e({'count':_0x619070['length'],'rows':_0x619070});});},'ChatQueuesWaitingInteractions':function(_0x1e2ead){return new Promise(function(_0x192832,_0x357800){var _0x317f3f=_['values'](_0x13a685[_0x4816('0x5a')]);_0x192832({'count':_0x317f3f[_0x4816('0x15')],'rows':_0x317f3f});});},'MailQueuesWaitingInteractions':function(_0x5f391e){return new Promise(function(_0x370439,_0x32ced6){var _0x4957e6=_[_0x4816('0x4e')](_0x13a685['mailQueuesWaitingInteractions']);_0x370439({'count':_0x4957e6[_0x4816('0x15')],'rows':_0x4957e6});});},'OpenchannelQueuesWaitingInteractions':function(_0x485505){return new Promise(function(_0x27ff4f,_0xa7f23c){var _0x30a190=_[_0x4816('0x4e')](_0x13a685['openchannelQueuesWaitingInteractions']);_0x27ff4f({'count':_0x30a190[_0x4816('0x15')],'rows':_0x30a190});});},'SmsQueuesWaitingInteractions':function(_0x4194f6){return new Promise(function(_0x1d0192,_0x2246b3){var _0x5e0b7e=_[_0x4816('0x4e')](_0x13a685[_0x4816('0x5b')]);_0x1d0192({'count':_0x5e0b7e[_0x4816('0x15')],'rows':_0x5e0b7e});});},'FaxQueuesWaitingInteractions':function(_0x1f0f2a){return new Promise(function(_0x5c68cc,_0xc1f850){var _0x37c2a1=_[_0x4816('0x4e')](_0x13a685[_0x4816('0x5c')]);_0x5c68cc({'count':_0x37c2a1[_0x4816('0x15')],'rows':_0x37c2a1});});},'WhatsappQueuesWaitingInteractions':function(_0x4a4e89){return new Promise(function(_0x2765ae,_0x4f43eb){var _0x1c0799=_[_0x4816('0x4e')](_0x13a685['whatsappQueuesWaitingInteractions']);_0x2765ae({'count':_0x1c0799[_0x4816('0x15')],'rows':_0x1c0799});});}};var _0x205cf1=jayson[_0x4816('0x5d')](_0x1eb683)['http']();_0x205cf1['on'](_0x4816('0x35'),function(_0x33eabd){logger['error'](JSON[_0x4816('0x5e')](_0x33eabd));return _0x248163(_0x33eabd);});_0x205cf1[_0x4816('0xf')](0x232c,'127.0.0.1',function(){console[_0x4816('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x42fc52('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8fefd04..af05a29 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 _0xa780=['indexOf','true','catch','error','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','then','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xa780,0x123));var _0x0a78=function(_0x393f89,_0xb03990){_0x393f89=_0x393f89-0x0;var _0x4d5e99=_0xa780[_0x393f89];return _0x4d5e99;};'use strict';var util=require(_0x0a78('0x0'));var BPromise=require(_0x0a78('0x1'));var jayson=require(_0x0a78('0x2'));var _=require(_0x0a78('0x3'));var logger=require(_0x0a78('0x4'))(_0x0a78('0x5'));var client=jayson['client'][_0x0a78('0x6')]({'port':0x232a});function request(_0x2eb468,_0x5f0a17){return new BPromise(function(_0x414b2d,_0x3c117a){return client['request'](_0x2eb468,_0x5f0a17)[_0x0a78('0x7')](function(_0x3b82f7){if(_0x3b82f7['error']){return _0x3c117a(_0x3b82f7['error'][_0x0a78('0x8')]);}else{return _0x414b2d(_0x3b82f7[_0x0a78('0x9')]);}})['catch'](function(_0x1de668){return _0x3c117a(_0x1de668);});});}exports['condition']=function(_0x84f545,_0xc9362d,_0x667bb9){return function(_0x5737aa){if(_0x667bb9['rules']&&!_0x667bb9[_0x0a78('0xa')][_0x84f545]){logger[_0x0a78('0xb')](_0x0a78('0xc'),_0x84f545);return _0x5737aa[_0x0a78('0xd')]();}var _0x541599=[];for(var _0x107835=0x0;_0x107835<_0xc9362d[_0x0a78('0xe')];_0x107835+=0x1){_0x541599[_0x0a78('0xf')](request(_0x0a78('0x10'),{'command':util[_0x0a78('0x11')](_0x0a78('0x12'),_0xc9362d[_0x107835])})[_0x0a78('0x7')](function(_0x279a5f){return _0x279a5f&&_0x279a5f[_0x0a78('0x8')]&&_0x279a5f['message'][_0x0a78('0x13')](_0x0a78('0x14'))>=0x0?!![]:![];})[_0x0a78('0x15')](function(_0x110d9f){logger[_0x0a78('0x16')](_0x0a78('0x17'),_0x84f545,_0xc9362d[_0x107835]);}));}BPromise[_0x0a78('0x18')](_0x541599)[_0x0a78('0x7')](function(_0x3b0af8){var _0x4de338=_[_0x0a78('0x19')](_0x3b0af8);logger['info'](_0x0a78('0x1a'),_0x84f545,_0xc9362d[_0x0a78('0x1b')](_0x0a78('0x1c')),_0x4de338);_0x5737aa[_0x0a78('0x1d')](_0x4de338);})[_0x0a78('0x15')](function(_0x193601){console[_0x0a78('0x1e')](_0x193601);logger[_0x0a78('0x16')](_0x0a78('0x1a'),_0x84f545,_0xc9362d['join'](_0x0a78('0x1c')),_0x193601['stack']);_0x5737aa[_0x0a78('0xd')]();});};}; \ No newline at end of file +var _0x58d5=['routing','client','http','then','error','result','condition','rules','info','stop','length','push','Command','format','message','indexOf','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','stack','bluebird','jayson/promise','lodash','../../../config/logger'];(function(_0x234bb2,_0x543dad){var _0x1cb2cf=function(_0x2c73a3){while(--_0x2c73a3){_0x234bb2['push'](_0x234bb2['shift']());}};_0x1cb2cf(++_0x543dad);}(_0x58d5,0x13b));var _0x558d=function(_0x4d3508,_0x576711){_0x4d3508=_0x4d3508-0x0;var _0x144bb9=_0x58d5[_0x4d3508];return _0x144bb9;};'use strict';var util=require('util');var BPromise=require(_0x558d('0x0'));var jayson=require(_0x558d('0x1'));var _=require(_0x558d('0x2'));var logger=require(_0x558d('0x3'))(_0x558d('0x4'));var client=jayson[_0x558d('0x5')][_0x558d('0x6')]({'port':0x232a});function request(_0x370c86,_0x4b9a37){return new BPromise(function(_0x42dffe,_0xe6a0bd){return client['request'](_0x370c86,_0x4b9a37)[_0x558d('0x7')](function(_0x2bd5ba){if(_0x2bd5ba[_0x558d('0x8')]){return _0xe6a0bd(_0x2bd5ba['error']['message']);}else{return _0x42dffe(_0x2bd5ba[_0x558d('0x9')]);}})['catch'](function(_0x4e679f){return _0xe6a0bd(_0x4e679f);});});}exports[_0x558d('0xa')]=function(_0x8d36c2,_0x3b0604,_0x1ed854){return function(_0x95dc16){if(_0x1ed854[_0x558d('0xb')]&&!_0x1ed854[_0x558d('0xb')][_0x8d36c2]){logger[_0x558d('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x8d36c2);return _0x95dc16[_0x558d('0xd')]();}var _0x5bd531=[];for(var _0x55a2f5=0x0;_0x55a2f5<_0x3b0604[_0x558d('0xe')];_0x55a2f5+=0x1){_0x5bd531[_0x558d('0xf')](request(_0x558d('0x10'),{'command':util[_0x558d('0x11')]('iftime\x20%s',_0x3b0604[_0x55a2f5])})['then'](function(_0x916c83){return _0x916c83&&_0x916c83['message']&&_0x916c83[_0x558d('0x12')][_0x558d('0x13')]('true')>=0x0?!![]:![];})[_0x558d('0x14')](function(_0x18cb6d){logger['error'](_0x558d('0x15'),_0x8d36c2,_0x3b0604[_0x55a2f5]);}));}BPromise[_0x558d('0x16')](_0x5bd531)[_0x558d('0x7')](function(_0x55176d){var _0x18ba95=_[_0x558d('0x17')](_0x55176d);logger[_0x558d('0xc')](_0x558d('0x18'),_0x8d36c2,_0x3b0604[_0x558d('0x19')]('\x20|\x20'),_0x18ba95);_0x95dc16[_0x558d('0x1a')](_0x18ba95);})[_0x558d('0x14')](function(_0x14a753){console[_0x558d('0x1b')](_0x14a753);logger[_0x558d('0x8')](_0x558d('0x18'),_0x8d36c2,_0x3b0604[_0x558d('0x19')]('\x20|\x20'),_0x14a753[_0x558d('0x1c')]);_0x95dc16[_0x558d('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bb1d989..7bffe08 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 _0x58a4=['clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','debug','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','transfer','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid'];(function(_0x5c422a,_0x2376e5){var _0x6c5b33=function(_0x3138c0){while(--_0x3138c0){_0x5c422a['push'](_0x5c422a['shift']());}};_0x6c5b33(++_0x2376e5);}(_0x58a4,0xbf));var _0x458a=function(_0x5b33ad,_0x2a7d55){_0x5b33ad=_0x5b33ad-0x0;var _0x16ec00=_0x58a4[_0x5b33ad];return _0x16ec00;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var utils=require(_0x458a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e23ea,_0xd2a36e){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x5'),_0x1e23ea[_0x458a('0x6')],_0x1e23ea[_0x458a('0x7')],_0x1e23ea[_0x458a('0x8')],_0x1e23ea[_0x458a('0x9')],_0x1e23ea[_0x458a('0xa')],_0x1e23ea['calleridnum'],_0x1e23ea['connectedlinenum'],_0x1e23ea[_0x458a('0xb')]));if(_0x1e23ea[_0x458a('0x8')]){utils[_0x458a('0xc')](_0x1e23ea[_0x458a('0x8')])[_0x458a('0xd')](function(_0x55bf10){if(_0x55bf10){_0x1e23ea['type']=_0x55bf10[_0x458a('0xe')];_0x1e23ea[_0x458a('0xf')]=_0x1e23ea[_0x458a('0x10')]?_0x55bf10[_0x458a('0x11')]:![];_0x1e23ea[_0x458a('0x12')]=_0x1e23ea['agentacw']?_0x55bf10[_0x458a('0x13')]:0x0;}utils[_0x458a('0x14')]('CreateVoiceAgentReport',_0x1e23ea);});}else{utils[_0x458a('0x14')](_0x458a('0x15'),_0x1e23ea);}if(_0xd2a36e){delete transfers[_0x1e23ea[_0x458a('0x6')]];}else{delete agents[_0x1e23ea[_0x458a('0x16')]];}}exports[_0x458a('0x17')]=function(_0x5bd09e){try{utils['debug'](util[_0x458a('0x4')]('[%s][agents][agentcalled]',_0x5bd09e[_0x458a('0x6')]),_0x5bd09e);agents[_0x5bd09e[_0x458a('0x16')]]=_0x5bd09e;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();agents[_0x5bd09e[_0x458a('0x16')]]['lastevent']='called';agents[_0x5bd09e['destuniqueid']][_0x458a('0x1a')]=null;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x1b')]=null;utils['info'](util[_0x458a('0x4')](_0x458a('0x1c'),_0x5bd09e[_0x458a('0x6')],agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x9')],_0x5bd09e['destuniqueid']));}catch(_0x4f57e3){utils[_0x458a('0x1d')](util['format'](_0x458a('0x1e'),_0x5bd09e[_0x458a('0x6')]),_0x4f57e3);}};exports['agentringnoanswer']=function(_0x468416){try{if(!_['isNil'](agents[_0x468416[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util['format'](_0x458a('0x20'),_0x468416[_0x458a('0x6')]),_0x468416);utils['info'](util[_0x458a('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x468416[_0x458a('0x6')],agents[_0x468416['destuniqueid']][_0x458a('0x9')],_0x468416['destuniqueid']));agents[_0x468416[_0x458a('0x16')]][_0x458a('0x21')]=!![];agents[_0x468416[_0x458a('0x16')]][_0x458a('0x22')]=utils[_0x458a('0x19')]();agents[_0x468416[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x24')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x25')]=_0x468416['ringtime']?parseInt(_0x468416[_0x458a('0x26')])/0x3e8:0x0;agents[_0x468416[_0x458a('0x16')]]['talktime']=0x0;unanswered['push'](_0x468416[_0x458a('0x16')]);}}catch(_0x596fe2){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x20'),_0x468416['uniqueid']),_0x596fe2);}};exports[_0x458a('0x27')]=function(_0x2531f7){try{_[_0x458a('0x28')](agents,function(_0x562c36,_0x47e20d){if(_0x562c36[_0x458a('0x6')]==_0x2531f7['uniqueid']&&!_[_0x458a('0x29')](unanswered,_0x562c36['destuniqueid'])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]',_0x2531f7[_0x458a('0x6')]),_0x2531f7);utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2531f7[_0x458a('0x6')],_0x562c36[_0x458a('0x9')],_0x562c36[_0x458a('0x16')]));_0x562c36[_0x458a('0x21')]=!![];_0x562c36[_0x458a('0x22')]=utils['now']();_0x562c36[_0x458a('0xb')]=_0x458a('0x2a');_0x562c36[_0x458a('0x24')]=_0x458a('0x2a');_0x562c36[_0x458a('0x25')]=_0x2531f7[_0x458a('0x25')];_0x562c36['talktime']=0x0;writeDB(_0x562c36);}});}catch(_0x2a6b9c){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x2b'),_0x2531f7[_0x458a('0x6')]),_0x2a6b9c);}};exports[_0x458a('0x2c')]=function(_0x262ad0){try{if(agents[_0x262ad0[_0x458a('0x16')]]){utils[_0x458a('0x1f')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x262ad0);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x2e'),_0x262ad0[_0x458a('0x6')],agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x9')],_0x262ad0[_0x458a('0x16')]));agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x2f')]=utils[_0x458a('0x19')]();agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x1a')]=_0x262ad0[_0x458a('0x1a')];agents[_0x262ad0['destuniqueid']][_0x458a('0x1b')]=_0x262ad0[_0x458a('0x1b')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x30');_[_0x458a('0x28')](agents,function(_0x44c5ba,_0x20cf10){if(_0x44c5ba['destuniqueid']!=_0x262ad0[_0x458a('0x16')]&&_0x44c5ba[_0x458a('0x6')]==_0x262ad0['uniqueid']){_0x44c5ba[_0x458a('0x31')]=0x0;_0x44c5ba[_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];_0x44c5ba['agentringnoanswer']=!![];_0x44c5ba[_0x458a('0x22')]=utils[_0x458a('0x19')]();_0x44c5ba[_0x458a('0xb')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x24')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x33')]=_0x262ad0[_0x458a('0x16')];_0x44c5ba['answeredelsewheremembername']=_0x262ad0[_0x458a('0x9')];writeDB(_0x44c5ba);}});}}catch(_0x145e3c){utils[_0x458a('0x1d')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x145e3c);}};exports['agentcomplete']=function(_0x598707){try{if(!_[_0x458a('0x34')](agents[_0x598707[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][agentcomplete]',_0x598707['uniqueid']),_0x598707);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x35'),_0x598707[_0x458a('0x6')],agents[_0x598707['destuniqueid']][_0x458a('0x9')],_0x598707[_0x458a('0x16')]));agents[_0x598707['destuniqueid']][_0x458a('0x10')]=!![];agents[_0x598707['destuniqueid']][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x598707[_0x458a('0x16')]]['talktime']=utils[_0x458a('0x37')](agents[_0x598707[_0x458a('0x16')]][_0x458a('0x36')],agents[_0x598707['destuniqueid']]['agentconnectAt']);agents[_0x598707[_0x458a('0x16')]][_0x458a('0x24')]=_0x598707[_0x458a('0x24')];agents[_0x598707['destuniqueid']]['lastevent']=_0x458a('0x38');writeDB(agents[_0x598707[_0x458a('0x16')]]);}}catch(_0x25bee8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x39'),_0x598707[_0x458a('0x6')]),_0x25bee8);}};exports[_0x458a('0x3a')]=function(_0xb22232){try{if(!_[_0x458a('0x34')](agents[_0xb22232[_0x458a('0x3b')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232[_0x458a('0x6')]),_0xb22232);utils[_0x458a('0x3')](util['format'](_0x458a('0x3d'),_0xb22232[_0x458a('0x6')],agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x9')],agents[_0xb22232[_0x458a('0x3b')]]['uniqueid']));agents[_0xb22232['transfereruniqueid']]['transfer']=!![];agents[_0xb22232[_0x458a('0x3b')]]['transfertype']=_0x458a('0x3e');agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x3f')]=_0xb22232[_0x458a('0x40')];agents[_0xb22232[_0x458a('0x3b')]]['transferuniqueid']=agents[_0xb22232['transfereruniqueid']][_0x458a('0x6')];}}catch(_0x2d8b77){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232['uniqueid']),_0x2d8b77);}};exports[_0x458a('0x41')]=function(_0x4eed01){try{utils[_0x458a('0x1f')](util['format'](_0x458a('0x42'),_0x4eed01['origtransfereruniqueid']),_0x4eed01);if(_0x4eed01['origtransfereruniqueid']==_0x4eed01['origtransfererlinkedid']){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x43')]])){utils['info'](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01[_0x458a('0x45')],agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x9')]));agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x47')]=_0x458a('0x48');agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x3f')]=_0x4eed01[_0x458a('0x49')];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4a')]=_0x4eed01[_0x458a('0x45')];}if(_0x4eed01[_0x458a('0x4b')]&&agents[_0x4eed01[_0x458a('0x4b')]]){agents[_0x4eed01[_0x458a('0x4b')]]['agententerreason']=0x1;transfers[_0x4eed01[_0x458a('0x4b')]]=_['clone'](agents[_0x4eed01[_0x458a('0x4b')]]);transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x43')]]['calleridnum'];transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x2f')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x25')]=0x0;transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4e')]=0x2;}}else if(_0x4eed01[_0x458a('0x43')]==_0x4eed01[_0x458a('0x4f')]){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x45')]])){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01['origtransfereruniqueid'],agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x9')]));agents[_0x4eed01['origtransfereruniqueid']][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x45')]]['transfertype']=_0x458a('0x48');agents[_0x4eed01[_0x458a('0x45')]]['transferexten']=_0x4eed01[_0x458a('0x50')];agents[_0x4eed01[_0x458a('0x45')]]['transferuniqueid']=_0x4eed01[_0x458a('0x43')];}if(_0x4eed01[_0x458a('0x51')]&&agents[_0x4eed01[_0x458a('0x51')]]){agents[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x1;transfers[_0x4eed01[_0x458a('0x51')]]=_[_0x458a('0x52')](agents[_0x4eed01[_0x458a('0x51')]]);transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4c')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x2f')]=utils['now']();transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x25')]=0x0;transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x2;}}}catch(_0xfb99c8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x42'),_0x4eed01[_0x458a('0x45')]),_0xfb99c8);}};exports[_0x458a('0x53')]=function(_0x31074e){try{utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x31074e);if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e['uniqueid']][_0x458a('0x24')]==='timeout'){if(_0x31074e[_0x458a('0x55')]==='21'){agents[_0x31074e[_0x458a('0x6')]]['reason']=_0x458a('0x56');agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]='rejected';}utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x57'),_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e['uniqueid']][_0x458a('0x24')],agents[_0x31074e['uniqueid']]['lastevent']));writeDB(agents[_0x31074e[_0x458a('0x6')]]);var _0x36ba6e=unanswered[_0x458a('0x58')](_0x31074e[_0x458a('0x6')]);if(_0x36ba6e>-0x1){unanswered[_0x458a('0x59')](_0x36ba6e,0x1);}}if(transfers[_0x31074e[_0x458a('0x6')]]){transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x10')]=!![];transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](transfers[_0x31074e['uniqueid']]['agentcompleteAt'],transfers[_0x31074e['uniqueid']][_0x458a('0x2f')]);transfers[_0x31074e['uniqueid']][_0x458a('0x24')]=_0x458a('0x5a');transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],transfers[_0x31074e[_0x458a('0x6')]]['membername'],transfers[_0x31074e[_0x458a('0x6')]]['reason'],transfers[_0x31074e[_0x458a('0x6')]]['lastevent']));writeDB(transfers[_0x31074e[_0x458a('0x6')]],!![]);}if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]){agents[_0x31074e['uniqueid']][_0x458a('0x10')]=!![];agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](agents[_0x31074e[_0x458a('0x6')]]['agentcompleteAt'],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]);agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')]=agents[_0x31074e['uniqueid']][_0x458a('0x46')]?_0x458a('0x46'):'agent';agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]));writeDB(agents[_0x31074e['uniqueid']]);}}catch(_0x1f9925){utils['error'](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x1f9925);}}; \ No newline at end of file +var _0xdb94=['transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','debug','[%s][agents][agentcalled]','destuniqueid','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','membername','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten'];(function(_0x3171e0,_0xb4737a){var _0x28e85b=function(_0xa95f11){while(--_0xa95f11){_0x3171e0['push'](_0x3171e0['shift']());}};_0x28e85b(++_0xb4737a);}(_0xdb94,0xab));var _0x4db9=function(_0x3d9d6b,_0x2922ef){_0x3d9d6b=_0x3d9d6b-0x0;var _0x4c1965=_0xdb94[_0x3d9d6b];return _0x4c1965;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var utils=require(_0x4db9('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x39909a,_0x3b4f98){utils['info'](util[_0x4db9('0x3')](_0x4db9('0x4'),_0x39909a['uniqueid'],_0x39909a['channel'],_0x39909a[_0x4db9('0x5')],_0x39909a['membername'],_0x39909a['interface'],_0x39909a[_0x4db9('0x6')],_0x39909a['connectedlinenum'],_0x39909a[_0x4db9('0x7')]));if(_0x39909a['queue']){utils[_0x4db9('0x8')](_0x39909a[_0x4db9('0x5')])[_0x4db9('0x9')](function(_0xbbc1eb){if(_0xbbc1eb){_0x39909a[_0x4db9('0xa')]=_0xbbc1eb[_0x4db9('0xa')];_0x39909a[_0x4db9('0xb')]=_0x39909a[_0x4db9('0xc')]?_0xbbc1eb[_0x4db9('0xd')]:![];_0x39909a[_0x4db9('0xe')]=_0x39909a[_0x4db9('0xb')]?_0xbbc1eb['acwTimeout']:0x0;}utils[_0x4db9('0xf')](_0x4db9('0x10'),_0x39909a);});}else{utils['request']('CreateVoiceAgentReport',_0x39909a);}if(_0x3b4f98){delete transfers[_0x39909a[_0x4db9('0x11')]];}else{delete agents[_0x39909a['destuniqueid']];}}exports['agentcalled']=function(_0x34fc7d){try{utils[_0x4db9('0x12')](util['format'](_0x4db9('0x13'),_0x34fc7d[_0x4db9('0x11')]),_0x34fc7d);agents[_0x34fc7d[_0x4db9('0x14')]]=_0x34fc7d;agents[_0x34fc7d[_0x4db9('0x14')]]['agentcalledAt']=utils['now']();agents[_0x34fc7d[_0x4db9('0x14')]][_0x4db9('0x7')]='called';agents[_0x34fc7d[_0x4db9('0x14')]][_0x4db9('0x15')]=null;agents[_0x34fc7d['destuniqueid']]['connectedlinename']=null;utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x17'),_0x34fc7d[_0x4db9('0x11')],agents[_0x34fc7d[_0x4db9('0x14')]]['membername'],_0x34fc7d[_0x4db9('0x14')]));}catch(_0x1214ee){utils[_0x4db9('0x18')](util['format'](_0x4db9('0x13'),_0x34fc7d[_0x4db9('0x11')]),_0x1214ee);}};exports[_0x4db9('0x19')]=function(_0x4c92e8){try{if(!_[_0x4db9('0x1a')](agents[_0x4c92e8[_0x4db9('0x14')]])){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x1b'),_0x4c92e8[_0x4db9('0x11')]),_0x4c92e8);utils[_0x4db9('0x16')](util['format'](_0x4db9('0x1c'),_0x4c92e8[_0x4db9('0x11')],agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x1d')],_0x4c92e8['destuniqueid']));agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x19')]=!![];agents[_0x4c92e8['destuniqueid']][_0x4db9('0x1e')]=utils[_0x4db9('0x1f')]();agents[_0x4c92e8[_0x4db9('0x14')]]['lastevent']=_0x4db9('0x20');agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x21')]=_0x4db9('0x20');agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x22')]=_0x4c92e8[_0x4db9('0x23')]?parseInt(_0x4c92e8[_0x4db9('0x23')])/0x3e8:0x0;agents[_0x4c92e8[_0x4db9('0x14')]][_0x4db9('0x24')]=0x0;unanswered[_0x4db9('0x25')](_0x4c92e8[_0x4db9('0x14')]);}}catch(_0x2d646d){utils[_0x4db9('0x18')](util['format']('[%s][agents][agentringnoanswer]',_0x4c92e8[_0x4db9('0x11')]),_0x2d646d);}};exports[_0x4db9('0x26')]=function(_0x119371){try{_[_0x4db9('0x27')](agents,function(_0x2af884,_0x459131){if(_0x2af884['uniqueid']==_0x119371[_0x4db9('0x11')]&&!_['includes'](unanswered,_0x2af884[_0x4db9('0x14')])){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x28'),_0x119371[_0x4db9('0x11')]),_0x119371);utils['info'](util['format'](_0x4db9('0x29'),_0x119371['uniqueid'],_0x2af884[_0x4db9('0x1d')],_0x2af884[_0x4db9('0x14')]));_0x2af884['agentringnoanswer']=!![];_0x2af884[_0x4db9('0x1e')]=utils[_0x4db9('0x1f')]();_0x2af884[_0x4db9('0x7')]='abandoned';_0x2af884[_0x4db9('0x21')]='abandoned';_0x2af884[_0x4db9('0x22')]=_0x119371[_0x4db9('0x22')];_0x2af884[_0x4db9('0x24')]=0x0;writeDB(_0x2af884);}});}catch(_0x4dbcd3){utils['error'](util[_0x4db9('0x3')](_0x4db9('0x28'),_0x119371[_0x4db9('0x11')]),_0x4dbcd3);}};exports[_0x4db9('0x2a')]=function(_0x2dca24){try{if(agents[_0x2dca24[_0x4db9('0x14')]]){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x2b'),_0x2dca24['uniqueid']),_0x2dca24);utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x2c'),_0x2dca24[_0x4db9('0x11')],agents[_0x2dca24['destuniqueid']][_0x4db9('0x1d')],_0x2dca24[_0x4db9('0x14')]));agents[_0x2dca24[_0x4db9('0x14')]]['agentconnectAt']=utils[_0x4db9('0x1f')]();agents[_0x2dca24[_0x4db9('0x14')]][_0x4db9('0x15')]=_0x2dca24[_0x4db9('0x15')];agents[_0x2dca24['destuniqueid']]['connectedlinename']=_0x2dca24[_0x4db9('0x2d')];agents[_0x2dca24[_0x4db9('0x14')]][_0x4db9('0x22')]=_0x2dca24[_0x4db9('0x23')];agents[_0x2dca24[_0x4db9('0x14')]]['lastevent']=_0x4db9('0x2e');_[_0x4db9('0x27')](agents,function(_0x23affc,_0x367c4c){if(_0x23affc[_0x4db9('0x14')]!=_0x2dca24['destuniqueid']&&_0x23affc[_0x4db9('0x11')]==_0x2dca24[_0x4db9('0x11')]){_0x23affc[_0x4db9('0x24')]=0x0;_0x23affc['holdtime']=_0x2dca24[_0x4db9('0x23')];_0x23affc[_0x4db9('0x19')]=!![];_0x23affc[_0x4db9('0x1e')]=utils[_0x4db9('0x1f')]();_0x23affc[_0x4db9('0x7')]=_0x4db9('0x2f');_0x23affc[_0x4db9('0x21')]=_0x4db9('0x2f');_0x23affc[_0x4db9('0x30')]=_0x2dca24[_0x4db9('0x14')];_0x23affc['answeredelsewheremembername']=_0x2dca24['membername'];writeDB(_0x23affc);}});}}catch(_0x48aaf5){utils[_0x4db9('0x18')](util[_0x4db9('0x3')]('[%s][agents][agentconnect]',_0x2dca24[_0x4db9('0x11')]),_0x48aaf5);}};exports[_0x4db9('0xc')]=function(_0x563416){try{if(!_['isNil'](agents[_0x563416[_0x4db9('0x14')]])){utils['debug'](util[_0x4db9('0x3')](_0x4db9('0x31'),_0x563416['uniqueid']),_0x563416);utils[_0x4db9('0x16')](util[_0x4db9('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x563416[_0x4db9('0x11')],agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x1d')],_0x563416['destuniqueid']));agents[_0x563416['destuniqueid']][_0x4db9('0xc')]=!![];agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x32')]=utils[_0x4db9('0x1f')]();agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x24')]=utils[_0x4db9('0x33')](agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x32')],agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x34')]);agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x21')]=_0x563416['reason'];agents[_0x563416[_0x4db9('0x14')]][_0x4db9('0x7')]=_0x4db9('0x35');writeDB(agents[_0x563416[_0x4db9('0x14')]]);}}catch(_0x329822){utils[_0x4db9('0x18')](util[_0x4db9('0x3')](_0x4db9('0x31'),_0x563416[_0x4db9('0x11')]),_0x329822);}};exports[_0x4db9('0x36')]=function(_0x10dccb){try{if(!_['isNil'](agents[_0x10dccb['transfereruniqueid']])){utils[_0x4db9('0x12')](util[_0x4db9('0x3')](_0x4db9('0x37'),_0x10dccb[_0x4db9('0x11')]),_0x10dccb);utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x38'),_0x10dccb[_0x4db9('0x11')],agents[_0x10dccb['transfereruniqueid']][_0x4db9('0x1d')],agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x11')]));agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x3a')]=!![];agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x3b')]=_0x4db9('0x3c');agents[_0x10dccb['transfereruniqueid']][_0x4db9('0x3d')]=_0x10dccb[_0x4db9('0x3e')];agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x3f')]=agents[_0x10dccb[_0x4db9('0x39')]][_0x4db9('0x11')];}}catch(_0x4e88c2){utils[_0x4db9('0x18')](util['format'](_0x4db9('0x37'),_0x10dccb['uniqueid']),_0x4e88c2);}};exports['attendedtransfer']=function(_0x2604bf){try{utils['debug'](util[_0x4db9('0x3')](_0x4db9('0x40'),_0x2604bf[_0x4db9('0x41')]),_0x2604bf);if(_0x2604bf[_0x4db9('0x41')]==_0x2604bf['origtransfererlinkedid']){if(!_[_0x4db9('0x1a')](agents[_0x2604bf['secondtransfereruniqueid']])){utils[_0x4db9('0x16')](util[_0x4db9('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2604bf[_0x4db9('0x41')],agents[_0x2604bf['secondtransfereruniqueid']][_0x4db9('0x1d')]));agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3a')]=!![];agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3b')]=_0x4db9('0x43');agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3d')]=_0x2604bf[_0x4db9('0x44')];agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x3f')]=_0x2604bf[_0x4db9('0x41')];}if(_0x2604bf[_0x4db9('0x45')]&&agents[_0x2604bf[_0x4db9('0x45')]]){agents[_0x2604bf[_0x4db9('0x45')]]['agententerreason']=0x1;transfers[_0x2604bf[_0x4db9('0x45')]]=_[_0x4db9('0x46')](agents[_0x2604bf['transfereeuniqueid']]);transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x6')]=agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x6')];transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x47')]=agents[_0x2604bf[_0x4db9('0x42')]][_0x4db9('0x47')];transfers[_0x2604bf[_0x4db9('0x45')]]['agentcalledAt']=utils['now']();transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x34')]=utils[_0x4db9('0x1f')]();transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x22')]=0x0;transfers[_0x2604bf[_0x4db9('0x45')]][_0x4db9('0x48')]=0x2;}}else if(_0x2604bf[_0x4db9('0x42')]==_0x2604bf[_0x4db9('0x49')]){if(!_[_0x4db9('0x1a')](agents[_0x2604bf['origtransfereruniqueid']])){utils[_0x4db9('0x16')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x2604bf['origtransfereruniqueid'],agents[_0x2604bf['origtransfereruniqueid']][_0x4db9('0x1d')]));agents[_0x2604bf['origtransfereruniqueid']]['transfer']=!![];agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x3b')]=_0x4db9('0x43');agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x3d')]=_0x2604bf[_0x4db9('0x4a')];agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x3f')]=_0x2604bf[_0x4db9('0x42')];}if(_0x2604bf[_0x4db9('0x4b')]&&agents[_0x2604bf[_0x4db9('0x4b')]]){agents[_0x2604bf[_0x4db9('0x4b')]][_0x4db9('0x48')]=0x1;transfers[_0x2604bf[_0x4db9('0x4b')]]=_[_0x4db9('0x46')](agents[_0x2604bf[_0x4db9('0x4b')]]);transfers[_0x2604bf['transfertargetuniqueid']]['calleridnum']=agents[_0x2604bf['origtransfereruniqueid']][_0x4db9('0x6')];transfers[_0x2604bf['transfertargetuniqueid']][_0x4db9('0x47')]=agents[_0x2604bf[_0x4db9('0x41')]][_0x4db9('0x47')];transfers[_0x2604bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x4db9('0x1f')]();transfers[_0x2604bf['transfertargetuniqueid']][_0x4db9('0x34')]=utils[_0x4db9('0x1f')]();transfers[_0x2604bf[_0x4db9('0x4b')]][_0x4db9('0x22')]=0x0;transfers[_0x2604bf[_0x4db9('0x4b')]]['agententerreason']=0x2;}}}catch(_0x1c2c6d){utils['error'](util[_0x4db9('0x3')](_0x4db9('0x40'),_0x2604bf[_0x4db9('0x41')]),_0x1c2c6d);}};exports[_0x4db9('0x4c')]=function(_0x12c1b5){try{utils['debug'](util['format'](_0x4db9('0x4d'),_0x12c1b5[_0x4db9('0x11')]),_0x12c1b5);if(agents[_0x12c1b5['uniqueid']]&&agents[_0x12c1b5['uniqueid']][_0x4db9('0x21')]==='timeout'){if(_0x12c1b5[_0x4db9('0x4e')]==='21'){agents[_0x12c1b5['uniqueid']][_0x4db9('0x21')]=_0x4db9('0x4f');agents[_0x12c1b5['uniqueid']]['lastevent']=_0x4db9('0x4f');}utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x50'),_0x12c1b5[_0x4db9('0x11')],agents[_0x12c1b5['uniqueid']]['membername'],agents[_0x12c1b5['uniqueid']]['reason'],agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x7')]));writeDB(agents[_0x12c1b5[_0x4db9('0x11')]]);var _0x3a7b70=unanswered['indexOf'](_0x12c1b5[_0x4db9('0x11')]);if(_0x3a7b70>-0x1){unanswered['splice'](_0x3a7b70,0x1);}}if(transfers[_0x12c1b5[_0x4db9('0x11')]]){transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0xc')]=!![];transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x32')]=utils[_0x4db9('0x1f')]();transfers[_0x12c1b5[_0x4db9('0x11')]]['talktime']=utils[_0x4db9('0x33')](transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x32')],transfers[_0x12c1b5['uniqueid']][_0x4db9('0x34')]);transfers[_0x12c1b5[_0x4db9('0x11')]]['reason']='agent';transfers[_0x12c1b5[_0x4db9('0x11')]]['lastevent']='complete';utils[_0x4db9('0x16')](util[_0x4db9('0x3')](_0x4db9('0x50'),_0x12c1b5['uniqueid'],transfers[_0x12c1b5['uniqueid']]['membername'],transfers[_0x12c1b5['uniqueid']]['reason'],transfers[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x7')]));writeDB(transfers[_0x12c1b5[_0x4db9('0x11')]],!![]);}if(agents[_0x12c1b5[_0x4db9('0x11')]]&&agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x34')]){agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0xc')]=!![];agents[_0x12c1b5['uniqueid']][_0x4db9('0x32')]=utils[_0x4db9('0x1f')]();agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x24')]=utils[_0x4db9('0x33')](agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x32')],agents[_0x12c1b5[_0x4db9('0x11')]]['agentconnectAt']);agents[_0x12c1b5[_0x4db9('0x11')]]['reason']=agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x3a')]?_0x4db9('0x3a'):_0x4db9('0x51');agents[_0x12c1b5['uniqueid']]['lastevent']=_0x4db9('0x35');utils['info'](util[_0x4db9('0x3')](_0x4db9('0x50'),_0x12c1b5[_0x4db9('0x11')],agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x1d')],agents[_0x12c1b5[_0x4db9('0x11')]][_0x4db9('0x21')],agents[_0x12c1b5[_0x4db9('0x11')]]['lastevent']));writeDB(agents[_0x12c1b5[_0x4db9('0x11')]]);}}catch(_0xdc3e6f){utils[_0x4db9('0x18')](util[_0x4db9('0x3')]('[%s][agents][hangup]',_0x12c1b5[_0x4db9('0x11')]),_0xdc3e6f);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index abca53b..0f51688 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 _0xcbb1=['xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','lastIndexOf','includes','noop','lastapplication','util','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','format','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','answertime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x901681,_0x266d9a){_0x901681=_0x901681-0x0;var _0x32478f=_0xcbb1[_0x901681];return _0x32478f;};'use strict';var _=require('lodash');var util=require(_0x1cbb('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x1cbb('0x1'),_0x1cbb('0x2'),_0x1cbb('0x2'),_0x1cbb('0x1'),'NO\x20ANSWER',_0x1cbb('0x1'),_0x1cbb('0x3'),'BUSY','FAILED',_0x1cbb('0x2'),_0x1cbb('0x2')];var channels={};function writeDB(_0x3d2d8e){var _0x5381a3;if(transfers[_0x1cbb('0x4')][_0x3d2d8e[_0x1cbb('0x5')]]){_0x5381a3=_0x3d2d8e[_0x1cbb('0x5')];_0x3d2d8e[_0x1cbb('0x5')]=transfers['blinds'][_0x3d2d8e[_0x1cbb('0x5')]][_0x1cbb('0x6')];}utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3d2d8e[_0x1cbb('0x5')],_0x3d2d8e[_0x1cbb('0x7')],_0x3d2d8e[_0x1cbb('0x8')],_0x3d2d8e[_0x1cbb('0x9')],_0x3d2d8e[_0x1cbb('0xa')],_0x3d2d8e[_0x1cbb('0xb')],_0x3d2d8e['connectedlinenum'],_0x3d2d8e[_0x1cbb('0xc')]));if(_0x3d2d8e[_0x1cbb('0xd')]){utils[_0x1cbb('0xe')](_0x3d2d8e[_0x1cbb('0xd')])[_0x1cbb('0xf')](function(_0x5ceb02){if(_0x5ceb02){_0x3d2d8e['UserId']=_0x5ceb02['id'];}utils[_0x1cbb('0x10')](_0x1cbb('0x11'),_0x3d2d8e);});}else{utils['request'](_0x1cbb('0x11'),_0x3d2d8e);}if(channels[_0x3d2d8e['uniqueid']]){delete channels[_0x3d2d8e[_0x1cbb('0x5')]];}else if(_0x5381a3&&channels[_0x5381a3]){if(!transfers[_0x1cbb('0x4')][_0x5381a3][_0x1cbb('0x12')])delete transfers[_0x1cbb('0x4')][_0x5381a3];delete channels[_0x5381a3];}}exports['newchannel']=function(_0x28b0d4){try{utils['debug'](util[_0x1cbb('0x13')]('[%s][calls][newchannel]',_0x28b0d4[_0x1cbb('0x5')]),_0x28b0d4);if(_0x28b0d4[_0x1cbb('0x5')]==_0x28b0d4[_0x1cbb('0x14')]&&_0x28b0d4['channel']!='OutgoingSpoolFailed'){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x16'),_0x28b0d4['uniqueid'],_0x28b0d4[_0x1cbb('0x17')],_0x28b0d4['exten']));channels[_0x28b0d4[_0x1cbb('0x5')]]={'uniqueid':_0x28b0d4[_0x1cbb('0x5')],'accountcode':_0x28b0d4[_0x1cbb('0xd')],'source':_0x28b0d4[_0x1cbb('0xb')],'destination':_0x28b0d4[_0x1cbb('0x18')],'destinationcontext':_0x28b0d4[_0x1cbb('0x17')],'channel':_0x28b0d4['channel'],'starttime':utils[_0x1cbb('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1cbb('0x1'),'amaflags':_0x1cbb('0x1a')};}}catch(_0x2aa724){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x1c'),_0x28b0d4[_0x1cbb('0x5')]),_0x2aa724);}};exports['newstate']=function(_0x3b9562){try{utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')](_0x1cbb('0x1e'),_0x3b9562['uniqueid']),_0x3b9562);if(!_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x5')]])&&_0x3b9562[_0x1cbb('0x20')]==0x6){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x21'),_0x3b9562['uniqueid'],_0x3b9562[_0x1cbb('0x17')],_0x3b9562[_0x1cbb('0x7')]));if(_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x5')]][_0x1cbb('0x22')])){channels[_0x3b9562[_0x1cbb('0x5')]]['systemanswertime']=utils[_0x1cbb('0x19')]();}}else if(!_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x14')]])&&_0x3b9562[_0x1cbb('0x20')]==0x6&&_0x3b9562[_0x1cbb('0x17')]!=_0x1cbb('0x23')){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x24'),_0x3b9562[_0x1cbb('0x5')],_0x3b9562[_0x1cbb('0x14')],_0x3b9562[_0x1cbb('0x17')],_0x3b9562[_0x1cbb('0x7')]));channels[_0x3b9562[_0x1cbb('0x14')]][_0x1cbb('0xd')]=_0x3b9562[_0x1cbb('0xd')];channels[_0x3b9562[_0x1cbb('0x14')]]['destinationchannel']=_0x3b9562[_0x1cbb('0x7')];if(_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x14')]]['answertime'])){channels[_0x3b9562[_0x1cbb('0x14')]]['answertime']=utils[_0x1cbb('0x19')]();}channels[_0x3b9562[_0x1cbb('0x14')]][_0x1cbb('0x25')]=dispositions[_[_0x1cbb('0x26')](_0x3b9562[_0x1cbb('0x20')])]||_0x1cbb('0x3');}}catch(_0x2166dd){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x1e'),_0x3b9562[_0x1cbb('0x5')]),_0x2166dd);}};exports[_0x1cbb('0x27')]=function(_0x11e030){try{if(!_[_0x1cbb('0x1f')](channels[_0x11e030['uniqueid']])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')]('[%s][calls][hangup]',_0x11e030[_0x1cbb('0x5')]),_0x11e030);if(_['isNil'](channels[_0x11e030[_0x1cbb('0x5')]]['callerid'])){channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x28')]=_0x11e030[_0x1cbb('0x29')]+'\x20<'+_0x11e030[_0x1cbb('0xb')]+'>';}utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x2a'),_0x11e030[_0x1cbb('0x5')],channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x28')],_0x11e030[_0x1cbb('0x2b')]));channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x2c')]=utils[_0x1cbb('0x19')]();channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x2d')]=utils[_0x1cbb('0x2e')](channels[_0x11e030['uniqueid']][_0x1cbb('0x2c')],channels[_0x11e030[_0x1cbb('0x5')]]['starttime']);channels[_0x11e030['uniqueid']][_0x1cbb('0x2f')]=channels[_0x11e030['uniqueid']][_0x1cbb('0x30')]?utils[_0x1cbb('0x2e')](channels[_0x11e030[_0x1cbb('0x5')]]['endtime'],channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x30')]):0x0;writeDB(channels[_0x11e030[_0x1cbb('0x5')]]);}}catch(_0xe4a38a){utils[_0x1cbb('0x1b')](util['format'](_0x1cbb('0x31'),_0x11e030[_0x1cbb('0x5')]),_0xe4a38a);}};exports[_0x1cbb('0x32')]=function(_0x51b7d8){try{if(!_['isNil'](channels[_0x51b7d8[_0x1cbb('0x33')]])){utils[_0x1cbb('0x1d')](util['format'](_0x1cbb('0x34'),_0x51b7d8['origtransfereruniqueid']),_0x51b7d8);if(channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x7')]==_0x51b7d8[_0x1cbb('0x35')]){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x36'),_0x51b7d8[_0x1cbb('0x37')],_0x51b7d8[_0x1cbb('0x33')],_0x51b7d8[_0x1cbb('0x38')]));channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x39')]=_0x51b7d8[_0x1cbb('0x38')];channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x3a')]=_0x1cbb('0x3b');}else if(channels[_0x51b7d8[_0x1cbb('0x33')]]['channel']=_0x51b7d8[_0x1cbb('0x3c')]){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x36'),_0x51b7d8[_0x1cbb('0x37')],_0x51b7d8[_0x1cbb('0x33')],_0x51b7d8[_0x1cbb('0x3d')]));channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x39')]=_0x51b7d8[_0x1cbb('0x3d')];channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x3a')]=_0x1cbb('0x3b');}}}catch(_0x4b5330){utils['error'](util[_0x1cbb('0x13')](_0x1cbb('0x34'),_0x51b7d8['origtransfereruniqueid']),_0x4b5330);}};exports[_0x1cbb('0x3e')]=function(_0x10f17c){try{if(!_[_0x1cbb('0x1f')](channels[_0x10f17c[_0x1cbb('0x5')]])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstart]',_0x10f17c[_0x1cbb('0x5')]),_0x10f17c);channels[_0x10f17c[_0x1cbb('0x5')]][_0x1cbb('0x3f')]=utils[_0x1cbb('0x19')]();utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x40'),_0x10f17c[_0x1cbb('0x5')],channels[_0x10f17c[_0x1cbb('0x5')]]['musiconholdstartAt']));}}catch(_0x456966){utils['error'](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstart]',_0x10f17c[_0x1cbb('0x5')]),_0x456966);}};exports[_0x1cbb('0x41')]=function(_0x1f643d){try{if(!_[_0x1cbb('0x1f')](channels[_0x1f643d[_0x1cbb('0x5')]])){utils['debug'](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstop]',_0x1f643d[_0x1cbb('0x5')]),_0x1f643d);if(!_[_0x1cbb('0x1f')](channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')])){channels[_0x1f643d['uniqueid']][_0x1cbb('0x42')]+=utils[_0x1cbb('0x2e')](utils[_0x1cbb('0x19')](),channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')]);utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x43'),_0x1f643d['uniqueid'],channels[_0x1f643d['uniqueid']][_0x1cbb('0x42')]));delete channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')];}}}catch(_0x18ff02){utils[_0x1cbb('0x1b')](util['format']('[%s][calls][musiconholdstop]',_0x1f643d[_0x1cbb('0x5')]),_0x18ff02);}};exports[_0x1cbb('0x44')]=function(_0x2653b5){try{if(!_[_0x1cbb('0x1f')](channels[_0x2653b5[_0x1cbb('0x5')]])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')](_0x1cbb('0x45'),_0x2653b5[_0x1cbb('0x5')]),_0x2653b5);if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x47')])){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x48'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['source']=_0x2653b5[_0x1cbb('0x49')];}if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x4a')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x4b'),_0x2653b5['uniqueid'],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x4c')]=_0x2653b5[_0x1cbb('0x49')];channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x28')]='\x22'+_0x2653b5[_0x1cbb('0x49')]+_0x1cbb('0x4d')+_0x2653b5[_0x1cbb('0x49')]+'>';}if(!_['isNil'](_0x2653b5['variable'][_0x1cbb('0x4e')])||!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x4f')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x50'),_0x2653b5['uniqueid'],!_[_0x1cbb('0x1f')](_0x2653b5['variable'][_0x1cbb('0x4e')])?'xmd-callerid-preview':_0x1cbb('0x4f'),_0x2653b5['value']));channels[_0x2653b5['uniqueid']]['callerid']=_0x2653b5[_0x1cbb('0x49')];}if(!_[_0x1cbb('0x1f')](_0x2653b5['variable'][_0x1cbb('0x51')])||!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')]['xmcs-queue'])){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x50'),_0x2653b5[_0x1cbb('0x5')],!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x51')])?_0x1cbb('0x51'):_0x1cbb('0x52'),_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['lastapplication']=_0x1cbb('0x53');channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x54')]=_0x2653b5['value'];channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x8')]=!![];}if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x55')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x56'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x57')]=_0x2653b5[_0x1cbb('0x49')];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x58')])){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x59'),_0x2653b5['uniqueid'],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x5a')]=_0x2653b5['value'];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x5b')])){utils['info'](util['format'](_0x1cbb('0x5c'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5['uniqueid']][_0x1cbb('0x5d')]=_0x2653b5['value'];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x5e')])){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x5f'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['sipcallid']=_0x2653b5['value'];}}}catch(_0x3c72e4){utils['error'](util[_0x1cbb('0x13')]('[%s][calls][varset]',_0x2653b5[_0x1cbb('0x5')]),_0x3c72e4);}};exports[_0x1cbb('0x60')]=function(_0x965e68){try{if(!_[_0x1cbb('0x1f')](channels[_0x965e68['uniqueid']])){utils['debug'](util[_0x1cbb('0x13')](_0x1cbb('0x61'),_0x965e68[_0x1cbb('0x5')]),_0x965e68);utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x965e68[_0x1cbb('0x5')],_0x965e68[_0x1cbb('0x62')],_0x965e68[_0x1cbb('0x63')]));if(_0x965e68[_0x1cbb('0x62')]['toLowerCase']()==_0x1cbb('0x64')&&_[_0x1cbb('0x65')](_0x965e68['appdata'][_0x1cbb('0x66')](),_0x1cbb('0x67'))){var _0x7d166e=_0x965e68[_0x1cbb('0x63')]['split']('=');var _0x45503c=_0x7d166e[0x0]['substring'](_0x7d166e[0x0][_0x1cbb('0x68')]('(')+0x1,_0x7d166e[0x0][_0x1cbb('0x68')](')'));var _0x1bcc3f=_0x7d166e[0x1];channels[_0x965e68['uniqueid']][_0x45503c]=_0x1bcc3f;}if(!_[_0x1cbb('0x69')](['hangup',_0x1cbb('0x6a'),'execif',_0x1cbb('0x64'),'gotoif'],_0x965e68[_0x1cbb('0x62')][_0x1cbb('0x66')]())){channels[_0x965e68[_0x1cbb('0x5')]][_0x1cbb('0x6b')]=_0x965e68[_0x1cbb('0x62')];channels[_0x965e68[_0x1cbb('0x5')]][_0x1cbb('0x54')]=_0x965e68[_0x1cbb('0x63')];}}}catch(_0x4d2bd9){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x61'),_0x965e68['uniqueid']),_0x4d2bd9);}}; \ No newline at end of file +var _0x6440=['variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','split','lastIndexOf','includes','noop','execif','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','channelstate','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]'];(function(_0x123829,_0x210530){var _0x19fece=function(_0x454be3){while(--_0x454be3){_0x123829['push'](_0x123829['shift']());}};_0x19fece(++_0x210530);}(_0x6440,0x1de));var _0x0644=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x6440[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x0644('0x0'));var util=require(_0x0644('0x1'));var utils=require('./utils');var transfers=require(_0x0644('0x2'));var dispositions=[_0x0644('0x3'),_0x0644('0x4'),'FAILED',_0x0644('0x3'),_0x0644('0x3'),_0x0644('0x3'),_0x0644('0x5'),_0x0644('0x6'),_0x0644('0x4'),_0x0644('0x4'),_0x0644('0x4')];var channels={};function writeDB(_0x4c13a5){var _0xec9447;if(transfers['blinds'][_0x4c13a5['uniqueid']]){_0xec9447=_0x4c13a5['uniqueid'];_0x4c13a5[_0x0644('0x7')]=transfers[_0x0644('0x8')][_0x4c13a5[_0x0644('0x7')]][_0x0644('0x9')];}utils[_0x0644('0xa')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4c13a5[_0x0644('0x7')],_0x4c13a5[_0x0644('0xb')],_0x4c13a5[_0x0644('0xc')],_0x4c13a5[_0x0644('0xd')],_0x4c13a5[_0x0644('0xe')],_0x4c13a5[_0x0644('0xf')],_0x4c13a5[_0x0644('0x10')],_0x4c13a5[_0x0644('0x11')]));if(_0x4c13a5[_0x0644('0x12')]){utils[_0x0644('0x13')](_0x4c13a5[_0x0644('0x12')])[_0x0644('0x14')](function(_0x4e5d83){if(_0x4e5d83){_0x4c13a5[_0x0644('0x15')]=_0x4e5d83['id'];}utils[_0x0644('0x16')](_0x0644('0x17'),_0x4c13a5);});}else{utils[_0x0644('0x16')](_0x0644('0x17'),_0x4c13a5);}if(channels[_0x4c13a5[_0x0644('0x7')]]){delete channels[_0x4c13a5[_0x0644('0x7')]];}else if(_0xec9447&&channels[_0xec9447]){if(!transfers['blinds'][_0xec9447][_0x0644('0x18')])delete transfers[_0x0644('0x8')][_0xec9447];delete channels[_0xec9447];}}exports[_0x0644('0x19')]=function(_0x45991e){try{utils['debug'](util[_0x0644('0x1a')](_0x0644('0x1b'),_0x45991e[_0x0644('0x7')]),_0x45991e);if(_0x45991e[_0x0644('0x7')]==_0x45991e[_0x0644('0x1c')]&&_0x45991e[_0x0644('0xb')]!=_0x0644('0x1d')){utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x1e'),_0x45991e[_0x0644('0x7')],_0x45991e[_0x0644('0x1f')],_0x45991e[_0x0644('0x20')]));channels[_0x45991e[_0x0644('0x7')]]={'uniqueid':_0x45991e[_0x0644('0x7')],'accountcode':_0x45991e[_0x0644('0x12')],'source':_0x45991e[_0x0644('0xf')],'destination':_0x45991e['exten'],'destinationcontext':_0x45991e[_0x0644('0x1f')],'channel':_0x45991e['channel'],'starttime':utils[_0x0644('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0644('0x3'),'amaflags':_0x0644('0x22')};}}catch(_0x733c72){utils[_0x0644('0x23')](util[_0x0644('0x1a')](_0x0644('0x1b'),_0x45991e[_0x0644('0x7')]),_0x733c72);}};exports['newstate']=function(_0x52dec2){try{utils[_0x0644('0x24')](util['format'](_0x0644('0x25'),_0x52dec2[_0x0644('0x7')]),_0x52dec2);if(!_[_0x0644('0x26')](channels[_0x52dec2[_0x0644('0x7')]])&&_0x52dec2['channelstate']==0x6){utils['info'](util[_0x0644('0x1a')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x52dec2[_0x0644('0x7')],_0x52dec2['context'],_0x52dec2[_0x0644('0xb')]));if(_['isNil'](channels[_0x52dec2[_0x0644('0x7')]][_0x0644('0x27')])){channels[_0x52dec2[_0x0644('0x7')]][_0x0644('0x27')]=utils[_0x0644('0x21')]();}}else if(!_[_0x0644('0x26')](channels[_0x52dec2['linkedid']])&&_0x52dec2['channelstate']==0x6&&_0x52dec2[_0x0644('0x1f')]!=_0x0644('0x28')){utils['info'](util[_0x0644('0x1a')](_0x0644('0x29'),_0x52dec2['uniqueid'],_0x52dec2[_0x0644('0x1c')],_0x52dec2[_0x0644('0x1f')],_0x52dec2['channel']));channels[_0x52dec2[_0x0644('0x1c')]][_0x0644('0x12')]=_0x52dec2[_0x0644('0x12')];channels[_0x52dec2[_0x0644('0x1c')]]['destinationchannel']=_0x52dec2[_0x0644('0xb')];if(_[_0x0644('0x26')](channels[_0x52dec2[_0x0644('0x1c')]][_0x0644('0x2a')])){channels[_0x52dec2[_0x0644('0x1c')]]['answertime']=utils['now']();}channels[_0x52dec2[_0x0644('0x1c')]][_0x0644('0x2b')]=dispositions[_[_0x0644('0x2c')](_0x52dec2[_0x0644('0x2d')])]||_0x0644('0x5');}}catch(_0x2b4a38){utils['error'](util[_0x0644('0x1a')]('[%s][calls][newstate]',_0x52dec2['uniqueid']),_0x2b4a38);}};exports[_0x0644('0x2e')]=function(_0x75b7a0){try{if(!_[_0x0644('0x26')](channels[_0x75b7a0['uniqueid']])){utils['debug'](util[_0x0644('0x1a')]('[%s][calls][hangup]',_0x75b7a0[_0x0644('0x7')]),_0x75b7a0);if(_[_0x0644('0x26')](channels[_0x75b7a0['uniqueid']]['callerid'])){channels[_0x75b7a0['uniqueid']][_0x0644('0x2f')]=_0x75b7a0['calleridname']+'\x20<'+_0x75b7a0[_0x0644('0xf')]+'>';}utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x30'),_0x75b7a0[_0x0644('0x7')],channels[_0x75b7a0[_0x0644('0x7')]][_0x0644('0x2f')],_0x75b7a0[_0x0644('0x31')]));channels[_0x75b7a0['uniqueid']]['endtime']=utils[_0x0644('0x21')]();channels[_0x75b7a0[_0x0644('0x7')]][_0x0644('0x32')]=utils[_0x0644('0x33')](channels[_0x75b7a0[_0x0644('0x7')]][_0x0644('0x34')],channels[_0x75b7a0[_0x0644('0x7')]][_0x0644('0x35')]);channels[_0x75b7a0[_0x0644('0x7')]]['billableseconds']=channels[_0x75b7a0[_0x0644('0x7')]][_0x0644('0x2a')]?utils['diffTime'](channels[_0x75b7a0['uniqueid']][_0x0644('0x34')],channels[_0x75b7a0[_0x0644('0x7')]]['answertime']):0x0;writeDB(channels[_0x75b7a0[_0x0644('0x7')]]);}}catch(_0x3a6403){utils[_0x0644('0x23')](util[_0x0644('0x1a')](_0x0644('0x36'),_0x75b7a0[_0x0644('0x7')]),_0x3a6403);}};exports[_0x0644('0x37')]=function(_0x3e8115){try{if(!_['isNil'](channels[_0x3e8115[_0x0644('0x38')]])){utils[_0x0644('0x24')](util['format'](_0x0644('0x39'),_0x3e8115[_0x0644('0x3a')]),_0x3e8115);if(channels[_0x3e8115[_0x0644('0x38')]]['channel']==_0x3e8115[_0x0644('0x3b')]){utils[_0x0644('0xa')](util[_0x0644('0x1a')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3e8115['origtransfereruniqueid'],_0x3e8115[_0x0644('0x38')],_0x3e8115['secondtransfererchannel']));channels[_0x3e8115[_0x0644('0x38')]]['destinationchannel']=_0x3e8115[_0x0644('0x3c')];channels[_0x3e8115[_0x0644('0x38')]][_0x0644('0x3d')]=_0x0644('0x3e');}else if(channels[_0x3e8115[_0x0644('0x38')]][_0x0644('0xb')]=_0x3e8115[_0x0644('0x3f')]){utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x40'),_0x3e8115[_0x0644('0x3a')],_0x3e8115['localtwolinkedid'],_0x3e8115['origtransfererchannel']));channels[_0x3e8115[_0x0644('0x38')]][_0x0644('0x41')]=_0x3e8115[_0x0644('0x42')];channels[_0x3e8115[_0x0644('0x38')]][_0x0644('0x3d')]=_0x0644('0x3e');}}}catch(_0x5a82e4){utils['error'](util[_0x0644('0x1a')](_0x0644('0x39'),_0x3e8115['origtransfereruniqueid']),_0x5a82e4);}};exports[_0x0644('0x43')]=function(_0x14aa0d){try{if(!_[_0x0644('0x26')](channels[_0x14aa0d['uniqueid']])){utils[_0x0644('0x24')](util[_0x0644('0x1a')](_0x0644('0x44'),_0x14aa0d[_0x0644('0x7')]),_0x14aa0d);channels[_0x14aa0d[_0x0644('0x7')]]['musiconholdstartAt']=utils[_0x0644('0x21')]();utils[_0x0644('0xa')](util['format'](_0x0644('0x45'),_0x14aa0d[_0x0644('0x7')],channels[_0x14aa0d['uniqueid']]['musiconholdstartAt']));}}catch(_0x4b5b9e){utils['error'](util[_0x0644('0x1a')](_0x0644('0x44'),_0x14aa0d['uniqueid']),_0x4b5b9e);}};exports[_0x0644('0x46')]=function(_0x128c7e){try{if(!_['isNil'](channels[_0x128c7e[_0x0644('0x7')]])){utils['debug'](util[_0x0644('0x1a')](_0x0644('0x47'),_0x128c7e[_0x0644('0x7')]),_0x128c7e);if(!_['isNil'](channels[_0x128c7e[_0x0644('0x7')]][_0x0644('0x48')])){channels[_0x128c7e[_0x0644('0x7')]][_0x0644('0x49')]+=utils[_0x0644('0x33')](utils[_0x0644('0x21')](),channels[_0x128c7e['uniqueid']][_0x0644('0x48')]);utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x4a'),_0x128c7e[_0x0644('0x7')],channels[_0x128c7e[_0x0644('0x7')]]['mohtime']));delete channels[_0x128c7e[_0x0644('0x7')]][_0x0644('0x48')];}}}catch(_0x558cef){utils[_0x0644('0x23')](util[_0x0644('0x1a')](_0x0644('0x47'),_0x128c7e['uniqueid']),_0x558cef);}};exports[_0x0644('0x4b')]=function(_0x2096f4){try{if(!_[_0x0644('0x26')](channels[_0x2096f4[_0x0644('0x7')]])){utils['debug'](util['format'](_0x0644('0x4c'),_0x2096f4['uniqueid']),_0x2096f4);if(!_['isNil'](_0x2096f4[_0x0644('0x4d')]['xmd-originatecalleridnum'])){utils['info'](util[_0x0644('0x1a')](_0x0644('0x4e'),_0x2096f4[_0x0644('0x7')],_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]]['source']=_0x2096f4[_0x0644('0x4f')];}if(!_['isNil'](_0x2096f4[_0x0644('0x4d')][_0x0644('0x50')])){utils[_0x0644('0xa')](util['format'](_0x0644('0x51'),_0x2096f4[_0x0644('0x7')],_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]][_0x0644('0x52')]=_0x2096f4[_0x0644('0x4f')];channels[_0x2096f4[_0x0644('0x7')]][_0x0644('0x2f')]='\x22'+_0x2096f4[_0x0644('0x4f')]+_0x0644('0x53')+_0x2096f4[_0x0644('0x4f')]+'>';}if(!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')]['xmd-callerid-preview'])||!_['isNil'](_0x2096f4[_0x0644('0x4d')][_0x0644('0x54')])){utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x55'),_0x2096f4[_0x0644('0x7')],!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')][_0x0644('0x56')])?_0x0644('0x56'):'xmd-callerid',_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]][_0x0644('0x2f')]=_0x2096f4[_0x0644('0x4f')];}if(!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')]['xmd-queue'])||!_[_0x0644('0x26')](_0x2096f4['variable']['xmcs-queue'])){utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x55'),_0x2096f4[_0x0644('0x7')],!_['isNil'](_0x2096f4['variable'][_0x0644('0x57')])?'xmd-queue':_0x0644('0x58'),_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]]['lastapplication']=_0x0644('0x59');channels[_0x2096f4[_0x0644('0x7')]][_0x0644('0x5a')]=_0x2096f4[_0x0644('0x4f')];channels[_0x2096f4[_0x0644('0x7')]][_0x0644('0xc')]=!![];}if(!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')]['xmd-contactid'])){utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x5b'),_0x2096f4[_0x0644('0x7')],_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]]['ContactId']=_0x2096f4[_0x0644('0x4f')];}if(!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')][_0x0644('0x5c')])){utils['info'](util[_0x0644('0x1a')](_0x0644('0x5d'),_0x2096f4['uniqueid'],_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4['uniqueid']]['type']=_0x2096f4[_0x0644('0x4f')];}if(!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')][_0x0644('0x5e')])){utils[_0x0644('0xa')](util['format'](_0x0644('0x5f'),_0x2096f4[_0x0644('0x7')],_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]][_0x0644('0x60')]=_0x2096f4[_0x0644('0x4f')];}if(!_[_0x0644('0x26')](_0x2096f4[_0x0644('0x4d')][_0x0644('0x61')])){utils[_0x0644('0xa')](util[_0x0644('0x1a')](_0x0644('0x62'),_0x2096f4[_0x0644('0x7')],_0x2096f4[_0x0644('0x4f')]));channels[_0x2096f4[_0x0644('0x7')]]['sipcallid']=_0x2096f4[_0x0644('0x4f')];}}}catch(_0x1a9adf){utils[_0x0644('0x23')](util[_0x0644('0x1a')](_0x0644('0x4c'),_0x2096f4[_0x0644('0x7')]),_0x1a9adf);}};exports[_0x0644('0x63')]=function(_0x4639f7){try{if(!_[_0x0644('0x26')](channels[_0x4639f7[_0x0644('0x7')]])){utils[_0x0644('0x24')](util[_0x0644('0x1a')](_0x0644('0x64'),_0x4639f7[_0x0644('0x7')]),_0x4639f7);utils[_0x0644('0xa')](util['format'](_0x0644('0x65'),_0x4639f7[_0x0644('0x7')],_0x4639f7[_0x0644('0x66')],_0x4639f7[_0x0644('0x67')]));if(_0x4639f7['application']['toLowerCase']()==_0x0644('0x68')&&_['startsWith'](_0x4639f7[_0x0644('0x67')][_0x0644('0x69')](),'cdr')){var _0x3e5b8c=_0x4639f7[_0x0644('0x67')][_0x0644('0x6a')]('=');var _0x2259d1=_0x3e5b8c[0x0]['substring'](_0x3e5b8c[0x0][_0x0644('0x6b')]('(')+0x1,_0x3e5b8c[0x0]['lastIndexOf'](')'));var _0x12c9dd=_0x3e5b8c[0x1];channels[_0x4639f7['uniqueid']][_0x2259d1]=_0x12c9dd;}if(!_[_0x0644('0x6c')](['hangup',_0x0644('0x6d'),_0x0644('0x6e'),_0x0644('0x68'),'gotoif'],_0x4639f7[_0x0644('0x66')]['toLowerCase']())){channels[_0x4639f7['uniqueid']]['lastapplication']=_0x4639f7[_0x0644('0x66')];channels[_0x4639f7[_0x0644('0x7')]]['lastdata']=_0x4639f7[_0x0644('0x67')];}}}catch(_0x211b79){utils[_0x0644('0x23')](util[_0x0644('0x1a')](_0x0644('0x64'),_0x4639f7[_0x0644('0x7')]),_0x211b79);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 13d5c67..4c183fc 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 _0x896b=['[core]\x20connected','[core]\x20shutdown','info','[core]\x20fullybooted','error','[core]\x20error','close','./utils'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x896b,0xf7));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0xb896('0x0'));exports['connect']=function(){utils['info'](_0xb896('0x1'));};exports['shutdown']=function(){utils['info'](_0xb896('0x2'));};exports['fullybooted']=function(){utils[_0xb896('0x3')](_0xb896('0x4'));};exports[_0xb896('0x5')]=function(_0x2a2819){utils[_0xb896('0x5')](_0xb896('0x6'),_0x2a2819);};exports[_0xb896('0x7')]=function(){utils[_0xb896('0x3')]('[core]\x20close');};exports['managerevent']=function(_0x6b51bb){}; \ No newline at end of file +var _0x4e61=['connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x439110,_0x371418){var _0x5394a9=function(_0x49c845){while(--_0x49c845){_0x439110['push'](_0x439110['shift']());}};_0x5394a9(++_0x371418);}(_0x4e61,0x196));var _0x14e6=function(_0x407b07,_0x525c69){_0x407b07=_0x407b07-0x0;var _0x2c9b12=_0x4e61[_0x407b07];return _0x2c9b12;};'use strict';var utils=require(_0x14e6('0x0'));exports[_0x14e6('0x1')]=function(){utils[_0x14e6('0x2')](_0x14e6('0x3'));};exports[_0x14e6('0x4')]=function(){utils[_0x14e6('0x2')]('[core]\x20shutdown');};exports[_0x14e6('0x5')]=function(){utils['info'](_0x14e6('0x6'));};exports['error']=function(_0x36feae){utils['error'](_0x14e6('0x7'),_0x36feae);};exports[_0x14e6('0x8')]=function(){utils[_0x14e6('0x2')](_0x14e6('0x9'));};exports[_0x14e6('0xa')]=function(_0x53b0f1){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ecd304a..c58eba8 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 _0xefcd=['ANSWER','assign','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','isNil','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','holdtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr(routeid)','split','[%s][dials][newexten]','varset','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0xefcd,0xdc));var _0xdefc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xefcd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdefc('0x0'));var util=require(_0xdefc('0x1'));var utils=require(_0xdefc('0x2'));var dials={};function writeDB(_0x724a3b){utils[_0xdefc('0x3')](util['format'](_0xdefc('0x4'),_0x724a3b[_0xdefc('0x5')],_0x724a3b[_0xdefc('0x6')],_0x724a3b[_0xdefc('0x7')],_0x724a3b[_0xdefc('0x8')],_0x724a3b[_0xdefc('0x9')],_0x724a3b[_0xdefc('0xa')]));utils[_0xdefc('0xb')](_0xdefc('0xc'),_0x724a3b);delete dials[_0x724a3b[_0xdefc('0x5')]];}exports[_0xdefc('0xd')]=function(_0x28f2c5){try{utils[_0xdefc('0xe')](util['format']('[%s][dials][newexten]',_0x28f2c5[_0xdefc('0x5')]),_0x28f2c5);utils['info'](util[_0xdefc('0xf')](_0xdefc('0x10'),_0x28f2c5[_0xdefc('0x5')],_0x28f2c5[_0xdefc('0x11')],_0x28f2c5[_0xdefc('0x12')]));if(_0x28f2c5[_0xdefc('0x11')][_0xdefc('0x13')]()=='set'&&_['startsWith'](_0x28f2c5['appdata'][_0xdefc('0x13')](),_0xdefc('0x14'))){var _0x5e7d59=_0x28f2c5[_0xdefc('0x12')][_0xdefc('0x15')]('=');dials[_0x28f2c5[_0xdefc('0x5')]]={'routeId':_0x5e7d59[0x1]};}}catch(_0xf35f48){utils['error'](util[_0xdefc('0xf')](_0xdefc('0x16'),_0x28f2c5[_0xdefc('0x5')]),_0xf35f48);}};exports[_0xdefc('0x17')]=function(_0x534586){try{utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x18'),_0x534586[_0xdefc('0x5')]),_0x534586);if(!_['isNil'](_0x534586['variable'][_0xdefc('0x19')])){utils[_0xdefc('0x3')](util[_0xdefc('0xf')](_0xdefc('0x1a'),_0x534586[_0xdefc('0x5')],_0x534586[_0xdefc('0x1b')]));dials[_0x534586[_0xdefc('0x5')]]={'routeId':_0x534586[_0xdefc('0x1b')]};}}catch(_0x3dd499){utils[_0xdefc('0x1c')](util['format'](_0xdefc('0x18'),_0x534586['uniqueid']),_0x3dd499);}};exports[_0xdefc('0x1d')]=function(_0x52e5e1){try{if(!_['isNil'](dials[_0x52e5e1['uniqueid']])){utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x1e'),_0x52e5e1[_0xdefc('0x5')]),_0x52e5e1);dials[_0x52e5e1[_0xdefc('0x5')]]=_['assign'](dials[_0x52e5e1[_0xdefc('0x5')]],_0x52e5e1);dials[_0x52e5e1[_0xdefc('0x5')]][_0xdefc('0x1f')]=utils['now']();dials[_0x52e5e1[_0xdefc('0x5')]]['lastevent']='called';utils[_0xdefc('0x3')](util[_0xdefc('0xf')](_0xdefc('0x20'),_0x52e5e1[_0xdefc('0x5')],dials[_0x52e5e1[_0xdefc('0x5')]][_0xdefc('0x1f')]));}}catch(_0x2fa178){utils['error'](util[_0xdefc('0xf')]('[%s][dials][dialbegin]',_0x52e5e1[_0xdefc('0x5')]),_0x2fa178);}};exports[_0xdefc('0x21')]=function(_0x4d7910){try{if(!_['isNil'](dials[_0x4d7910[_0xdefc('0x5')]])){utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x22'),_0x4d7910[_0xdefc('0x5')]),_0x4d7910);dials[_0x4d7910[_0xdefc('0x5')]][_0xdefc('0xa')]=_0x4d7910[_0xdefc('0xa')];if(_0x4d7910[_0xdefc('0xa')]==_0xdefc('0x23')){dials[_0x4d7910[_0xdefc('0x5')]]=_[_0xdefc('0x24')](dials[_0x4d7910[_0xdefc('0x5')]],_0x4d7910);dials[_0x4d7910['uniqueid']]['answertime']=utils[_0xdefc('0x25')]();dials[_0x4d7910[_0xdefc('0x5')]][_0xdefc('0x26')]=_0xdefc('0x27');utils[_0xdefc('0x3')](util[_0xdefc('0xf')](_0xdefc('0x28'),_0x4d7910[_0xdefc('0x5')],_0x4d7910[_0xdefc('0xa')],dials[_0x4d7910[_0xdefc('0x5')]][_0xdefc('0x29')]));}else{utils[_0xdefc('0x3')](util[_0xdefc('0xf')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4d7910['uniqueid'],_0x4d7910[_0xdefc('0xa')]));}}}catch(_0x539e46){utils['error'](util[_0xdefc('0xf')](_0xdefc('0x22'),_0x4d7910[_0xdefc('0x5')]),_0x539e46);}};exports[_0xdefc('0x2a')]=function(_0x2a67a7){try{if(!_[_0xdefc('0x2b')](dials[_0x2a67a7[_0xdefc('0x5')]])){utils[_0xdefc('0xe')](util[_0xdefc('0xf')](_0xdefc('0x2c'),_0x2a67a7[_0xdefc('0x5')]),_0x2a67a7);utils[_0xdefc('0x3')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2a67a7[_0xdefc('0x5')],_0x2a67a7[_0xdefc('0x8')],_0x2a67a7[_0xdefc('0x2d')],_0x2a67a7[_0xdefc('0x2e')]));dials[_0x2a67a7[_0xdefc('0x5')]]=_['assign'](dials[_0x2a67a7['uniqueid']],{'endtime':utils[_0xdefc('0x25')](),'lastevent':_0xdefc('0x2f')});dials[_0x2a67a7[_0xdefc('0x5')]][_0xdefc('0x30')]=utils[_0xdefc('0x31')](dials[_0x2a67a7[_0xdefc('0x5')]]['endtime'],dials[_0x2a67a7['uniqueid']]['starttime']);dials[_0x2a67a7['uniqueid']][_0xdefc('0x32')]=utils['diffTime'](dials[_0x2a67a7['uniqueid']][_0xdefc('0x29')]||dials[_0x2a67a7[_0xdefc('0x5')]]['endtime'],dials[_0x2a67a7[_0xdefc('0x5')]][_0xdefc('0x1f')]);dials[_0x2a67a7['uniqueid']]['billableseconds']=dials[_0x2a67a7[_0xdefc('0x5')]][_0xdefc('0x29')]?utils[_0xdefc('0x31')](dials[_0x2a67a7[_0xdefc('0x5')]]['endtime'],dials[_0x2a67a7[_0xdefc('0x5')]]['answertime']):0x0;writeDB(dials[_0x2a67a7[_0xdefc('0x5')]]);}}catch(_0x584721){utils[_0xdefc('0x1c')](util['format'](_0xdefc('0x2c'),_0x2a67a7[_0xdefc('0x5')]),_0x584721);}}; \ No newline at end of file +var _0x67ea=['[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','diffTime','endtime','holdtime','answertime','billableseconds','[%s][dials][hangup]','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','value','dialbegin','[%s][dials][dialbegin]','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup'];(function(_0x5d353e,_0x4fd21b){var _0x37f99e=function(_0x4a9568){while(--_0x4a9568){_0x5d353e['push'](_0x5d353e['shift']());}};_0x37f99e(++_0x4fd21b);}(_0x67ea,0xfe));var _0xa67e=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x67ea[_0x584291];return _0x4e7d08;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xa67e('0x0'));var dials={};function writeDB(_0x2941fe){utils[_0xa67e('0x1')](util[_0xa67e('0x2')](_0xa67e('0x3'),_0x2941fe[_0xa67e('0x4')],_0x2941fe['channel'],_0x2941fe['dialstring'],_0x2941fe[_0xa67e('0x5')],_0x2941fe[_0xa67e('0x6')],_0x2941fe[_0xa67e('0x7')]));utils[_0xa67e('0x8')](_0xa67e('0x9'),_0x2941fe);delete dials[_0x2941fe[_0xa67e('0x4')]];}exports[_0xa67e('0xa')]=function(_0x168341){try{utils[_0xa67e('0xb')](util['format'](_0xa67e('0xc'),_0x168341['uniqueid']),_0x168341);utils[_0xa67e('0x1')](util['format'](_0xa67e('0xd'),_0x168341['uniqueid'],_0x168341[_0xa67e('0xe')],_0x168341[_0xa67e('0xf')]));if(_0x168341[_0xa67e('0xe')][_0xa67e('0x10')]()==_0xa67e('0x11')&&_[_0xa67e('0x12')](_0x168341[_0xa67e('0xf')][_0xa67e('0x10')](),_0xa67e('0x13'))){var _0x2e34ed=_0x168341[_0xa67e('0xf')]['split']('=');dials[_0x168341[_0xa67e('0x4')]]={'routeId':_0x2e34ed[0x1]};}}catch(_0x470eee){utils[_0xa67e('0x14')](util['format'](_0xa67e('0xc'),_0x168341[_0xa67e('0x4')]),_0x470eee);}};exports[_0xa67e('0x15')]=function(_0x1d4124){try{utils[_0xa67e('0xb')](util['format'](_0xa67e('0x16'),_0x1d4124[_0xa67e('0x4')]),_0x1d4124);if(!_[_0xa67e('0x17')](_0x1d4124['variable']['outboundrouteid'])){utils['info'](util[_0xa67e('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1d4124['uniqueid'],_0x1d4124[_0xa67e('0x18')]));dials[_0x1d4124[_0xa67e('0x4')]]={'routeId':_0x1d4124[_0xa67e('0x18')]};}}catch(_0x59e755){utils[_0xa67e('0x14')](util[_0xa67e('0x2')]('[%s][dials][varset]',_0x1d4124['uniqueid']),_0x59e755);}};exports[_0xa67e('0x19')]=function(_0x21f0bf){try{if(!_[_0xa67e('0x17')](dials[_0x21f0bf[_0xa67e('0x4')]])){utils[_0xa67e('0xb')](util[_0xa67e('0x2')](_0xa67e('0x1a'),_0x21f0bf[_0xa67e('0x4')]),_0x21f0bf);dials[_0x21f0bf[_0xa67e('0x4')]]=_['assign'](dials[_0x21f0bf[_0xa67e('0x4')]],_0x21f0bf);dials[_0x21f0bf[_0xa67e('0x4')]]['starttime']=utils['now']();dials[_0x21f0bf[_0xa67e('0x4')]][_0xa67e('0x1b')]=_0xa67e('0x1c');utils[_0xa67e('0x1')](util[_0xa67e('0x2')](_0xa67e('0x1d'),_0x21f0bf['uniqueid'],dials[_0x21f0bf[_0xa67e('0x4')]][_0xa67e('0x1e')]));}}catch(_0x1d7be6){utils[_0xa67e('0x14')](util['format'](_0xa67e('0x1a'),_0x21f0bf[_0xa67e('0x4')]),_0x1d7be6);}};exports[_0xa67e('0x1f')]=function(_0x379dc1){try{if(!_[_0xa67e('0x17')](dials[_0x379dc1[_0xa67e('0x4')]])){utils[_0xa67e('0xb')](util[_0xa67e('0x2')](_0xa67e('0x20'),_0x379dc1[_0xa67e('0x4')]),_0x379dc1);dials[_0x379dc1[_0xa67e('0x4')]][_0xa67e('0x7')]=_0x379dc1[_0xa67e('0x7')];if(_0x379dc1[_0xa67e('0x7')]==_0xa67e('0x21')){dials[_0x379dc1[_0xa67e('0x4')]]=_[_0xa67e('0x22')](dials[_0x379dc1[_0xa67e('0x4')]],_0x379dc1);dials[_0x379dc1['uniqueid']]['answertime']=utils[_0xa67e('0x23')]();dials[_0x379dc1['uniqueid']][_0xa67e('0x1b')]=_0xa67e('0x24');utils[_0xa67e('0x1')](util[_0xa67e('0x2')](_0xa67e('0x25'),_0x379dc1[_0xa67e('0x4')],_0x379dc1[_0xa67e('0x7')],dials[_0x379dc1[_0xa67e('0x4')]]['answertime']));}else{utils[_0xa67e('0x1')](util[_0xa67e('0x2')](_0xa67e('0x26'),_0x379dc1[_0xa67e('0x4')],_0x379dc1['dialstatus']));}}}catch(_0x552e0f){utils[_0xa67e('0x14')](util[_0xa67e('0x2')]('[%s][dials][dialend]',_0x379dc1[_0xa67e('0x4')]),_0x552e0f);}};exports[_0xa67e('0x27')]=function(_0x45dd3a){try{if(!_[_0xa67e('0x17')](dials[_0x45dd3a['uniqueid']])){utils[_0xa67e('0xb')](util[_0xa67e('0x2')]('[%s][dials][hangup]',_0x45dd3a['uniqueid']),_0x45dd3a);utils[_0xa67e('0x1')](util[_0xa67e('0x2')](_0xa67e('0x28'),_0x45dd3a['uniqueid'],_0x45dd3a['calleridnum'],_0x45dd3a['calleridname'],_0x45dd3a['cause-txt']));dials[_0x45dd3a[_0xa67e('0x4')]]=_[_0xa67e('0x22')](dials[_0x45dd3a['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xa67e('0x29')});dials[_0x45dd3a[_0xa67e('0x4')]][_0xa67e('0x2a')]=utils[_0xa67e('0x2b')](dials[_0x45dd3a['uniqueid']][_0xa67e('0x2c')],dials[_0x45dd3a['uniqueid']][_0xa67e('0x1e')]);dials[_0x45dd3a[_0xa67e('0x4')]][_0xa67e('0x2d')]=utils[_0xa67e('0x2b')](dials[_0x45dd3a['uniqueid']][_0xa67e('0x2e')]||dials[_0x45dd3a[_0xa67e('0x4')]][_0xa67e('0x2c')],dials[_0x45dd3a[_0xa67e('0x4')]][_0xa67e('0x1e')]);dials[_0x45dd3a[_0xa67e('0x4')]][_0xa67e('0x2f')]=dials[_0x45dd3a[_0xa67e('0x4')]]['answertime']?utils[_0xa67e('0x2b')](dials[_0x45dd3a[_0xa67e('0x4')]][_0xa67e('0x2c')],dials[_0x45dd3a[_0xa67e('0x4')]]['answertime']):0x0;writeDB(dials[_0x45dd3a[_0xa67e('0x4')]]);}}catch(_0x4432c6){utils[_0xa67e('0x14')](util['format'](_0xa67e('0x30'),_0x45dd3a[_0xa67e('0x4')]),_0x4432c6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index fa660c4..4b69d4a 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 _0x4c2a=['debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent'];(function(_0xd9adcd,_0x4c8dcd){var _0x5232a1=function(_0x4b0661){while(--_0x4b0661){_0xd9adcd['push'](_0xd9adcd['shift']());}};_0x5232a1(++_0x4c8dcd);}(_0x4c2a,0x1c9));var _0xa4c2=function(_0x4bf0de,_0x5d04c0){_0x4bf0de=_0x4bf0de-0x0;var _0xb77cf9=_0x4c2a[_0x4bf0de];return _0xb77cf9;};var AsteriskManager=require(_0xa4c2('0x0'));var config=require(_0xa4c2('0x1'));var utils=require(_0xa4c2('0x2'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0xa4c2('0x3')][_0xa4c2('0x4')]?!config['xdr'][_0xa4c2('0x4')]:!![];var isProduction=config[_0xa4c2('0x5')]===_0xa4c2('0x6')||![];var isLocalAsterisk=config[_0xa4c2('0x3')]&&config[_0xa4c2('0x3')][_0xa4c2('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xa4c2('0x8')][_0xa4c2('0x9')],config['asterisk']['ip'],config[_0xa4c2('0x8')][_0xa4c2('0xa')],config[_0xa4c2('0x8')][_0xa4c2('0xb')],!![]);ami[_0xa4c2('0xc')]();if(!isXDREnabled){utils['info'](_0xa4c2('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xa4c2('0xe'));}else{var agents=require(_0xa4c2('0xf'));var calls=require(_0xa4c2('0x10'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xa4c2('0x11'));var dials=require('./dials.controller');var transfers=require(_0xa4c2('0x12'));var core=require(_0xa4c2('0x13'));ami['on'](_0xa4c2('0x14'),core[_0xa4c2('0x14')]);ami['on'](_0xa4c2('0x15'),core[_0xa4c2('0x15')]);ami['on'](_0xa4c2('0x16'),core[_0xa4c2('0x16')]);ami['on'](_0xa4c2('0x17'),core[_0xa4c2('0x17')]);ami['on'](_0xa4c2('0x18'),core['close']);ami['on'](_0xa4c2('0x19'),core[_0xa4c2('0x19')]);ami['on']('devicestatechange',function(_0x5134ea){try{utils[_0xa4c2('0x1a')](util['format'](_0xa4c2('0x1b'),_0x5134ea[_0xa4c2('0x1c')]),_0x5134ea);members[_0xa4c2('0x1d')](_0x5134ea);}catch(_0x4a3029){utils['error'](util[_0xa4c2('0x1e')](_0xa4c2('0x1b'),_0x5134ea['device']),_0x4a3029);}});ami['on'](_0xa4c2('0x1f'),function(_0xe32c94){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x20'),_0xe32c94[_0xa4c2('0x21')]),_0xe32c94);agents[_0xa4c2('0x1f')](_0xe32c94);}catch(_0x4325a3){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x20'),_0xe32c94[_0xa4c2('0x21')]),_0x4325a3);}});ami['on'](_0xa4c2('0x22'),function(_0x2c5c5c){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')]('[%s][index][agentringnoanswer]',_0x2c5c5c[_0xa4c2('0x21')]),_0x2c5c5c);agents[_0xa4c2('0x22')](_0x2c5c5c);}catch(_0x233fc6){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x23'),_0x2c5c5c['uniqueid']),_0x233fc6);}});ami['on'](_0xa4c2('0x24'),function(_0x2280e4){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x25'),_0x2280e4[_0xa4c2('0x21')]),_0x2280e4);agents['agentconnect'](_0x2280e4);queues[_0xa4c2('0x24')](_0x2280e4);}catch(_0x5cc1ef){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x25'),_0x2280e4['uniqueid']),_0x5cc1ef);}});ami['on'](_0xa4c2('0x26'),function(_0x141b37){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')]('[%s][index][agentcomplete]',_0x141b37[_0xa4c2('0x21')]),_0x141b37);agents['agentcomplete'](_0x141b37);queues[_0xa4c2('0x26')](_0x141b37);members['agentcomplete'](_0x141b37);}catch(_0x71f48b){utils['error'](util[_0xa4c2('0x1e')]('[%s][index][agentcomplete]',_0x141b37['uniqueid']),_0x71f48b);}});ami['on'](_0xa4c2('0x27'),function(_0x30f236){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x28'),_0x30f236[_0xa4c2('0x21')]),_0x30f236);agents[_0xa4c2('0x27')](_0x30f236);queues['queuecallerabandon'](_0x30f236);}catch(_0x9c0853){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')]('[%s][index][queuecallerabandon]',_0x30f236['uniqueid']),_0x9c0853);}});ami['on'](_0xa4c2('0x29'),function(_0x1209df){try{utils[_0xa4c2('0x1a')](util['format'](_0xa4c2('0x2a'),_0x1209df[_0xa4c2('0x21')]),_0x1209df);queues[_0xa4c2('0x29')](_0x1209df);recordings['queuecallerjoin'](_0x1209df);}catch(_0x5aa44b){utils['error'](util[_0xa4c2('0x1e')]('[%s][index][queuecallerjoin]',_0x1209df[_0xa4c2('0x21')]),_0x5aa44b);}});ami['on'](_0xa4c2('0x2b'),function(_0x2e26a5){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x2c'),_0x2e26a5[_0xa4c2('0x21')]),_0x2e26a5);queues[_0xa4c2('0x2b')](_0x2e26a5);}catch(_0x5984f1){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')]('[%s][index][queuecallerleave]',_0x2e26a5['uniqueid']),_0x5984f1);}});ami['on'](_0xa4c2('0x2d'),function(_0x48251e){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x2e'),_0x48251e[_0xa4c2('0x21')]),_0x48251e);queues[_0xa4c2('0x2d')](_0x48251e);calls[_0xa4c2('0x2d')](_0x48251e);}catch(_0x2a6bac){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x2e'),_0x48251e['uniqueid']),_0x2a6bac);}});ami['on'](_0xa4c2('0x2f'),function(_0x135257){try{utils['debug'](util[_0xa4c2('0x1e')]('[%s][index][musiconholdstop]',_0x135257[_0xa4c2('0x21')]),_0x135257);queues['musiconholdstop'](_0x135257);calls['musiconholdstop'](_0x135257);}catch(_0x1ea0b6){utils['error'](util[_0xa4c2('0x1e')]('[%s][index][musiconholdstop]',_0x135257[_0xa4c2('0x21')]),_0x1ea0b6);}});ami['on'](_0xa4c2('0x30'),function(_0x41b5bf){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x31'),_0x41b5bf['uniqueid']),_0x41b5bf);calls[_0xa4c2('0x30')](_0x41b5bf);recordings[_0xa4c2('0x30')](_0x41b5bf);}catch(_0x2d4674){utils[_0xa4c2('0x17')](util['format'](_0xa4c2('0x31'),_0x41b5bf[_0xa4c2('0x21')]),_0x2d4674);}});ami['on'](_0xa4c2('0x32'),function(_0x45164a){try{utils['debug'](util[_0xa4c2('0x1e')](_0xa4c2('0x33'),_0x45164a[_0xa4c2('0x21')]),_0x45164a);calls['hangup'](_0x45164a);recordings[_0xa4c2('0x32')](_0x45164a);dials[_0xa4c2('0x32')](_0x45164a);agents['hangup'](_0x45164a);queues[_0xa4c2('0x32')](_0x45164a);}catch(_0x215f41){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x33'),_0x45164a['uniqueid']),_0x215f41);}});ami['on']('cdr',function(_0x4b811a){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x34'),_0x4b811a[_0xa4c2('0x21')]),_0x4b811a);members[_0xa4c2('0x35')](_0x4b811a);}catch(_0x20a55e){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x34'),_0x4b811a[_0xa4c2('0x21')]),_0x20a55e);}});ami['on'](_0xa4c2('0x36'),function(_0x5a29ac){try{utils[_0xa4c2('0x1a')](util['format'](_0xa4c2('0x37'),_0x5a29ac[_0xa4c2('0x21')]),_0x5a29ac);queues[_0xa4c2('0x36')](_0x5a29ac);agents[_0xa4c2('0x36')](_0x5a29ac);transfers[_0xa4c2('0x36')](_0x5a29ac);recordings[_0xa4c2('0x36')](_0x5a29ac);}catch(_0x3f8079){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x37'),_0x5a29ac[_0xa4c2('0x21')]),_0x3f8079);}});ami['on'](_0xa4c2('0x38'),function(_0x29aa31){try{utils['debug'](util[_0xa4c2('0x1e')]('[%s][index][attendedtransfer]',_0x29aa31[_0xa4c2('0x39')]),_0x29aa31);queues[_0xa4c2('0x38')](_0x29aa31);transfers[_0xa4c2('0x38')](_0x29aa31);agents[_0xa4c2('0x38')](_0x29aa31);calls[_0xa4c2('0x38')](_0x29aa31);}catch(_0x32210d){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x3a'),_0x29aa31[_0xa4c2('0x39')]),_0x32210d);}});ami['on'](_0xa4c2('0x3b'),function(_0x525279){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x3c'),_0x525279[_0xa4c2('0x21')]),_0x525279);queues['varset'](_0x525279);recordings['varset'](_0x525279);calls['varset'](_0x525279);dials[_0xa4c2('0x3b')](_0x525279);}catch(_0x333569){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')](_0xa4c2('0x3c'),_0x525279[_0xa4c2('0x21')]),_0x333569);}});ami['on']('newexten',function(_0x2b29e0){try{utils[_0xa4c2('0x1a')](util[_0xa4c2('0x1e')](_0xa4c2('0x3d'),_0x2b29e0[_0xa4c2('0x21')]),_0x2b29e0);calls[_0xa4c2('0x3e')](_0x2b29e0);recordings['newexten'](_0x2b29e0);dials[_0xa4c2('0x3e')](_0x2b29e0);}catch(_0x571493){utils['error'](util['format'](_0xa4c2('0x3d'),_0x2b29e0[_0xa4c2('0x21')]),_0x571493);}});ami['on'](_0xa4c2('0x3f'),function(_0x1b8fab){try{utils[_0xa4c2('0x1a')](util['format']('[%s][index][newchannel]',_0x1b8fab[_0xa4c2('0x21')]),_0x1b8fab);calls[_0xa4c2('0x3f')](_0x1b8fab);recordings['newchannel'](_0x1b8fab);}catch(_0x589191){utils['error'](util[_0xa4c2('0x1e')](_0xa4c2('0x40'),_0x1b8fab[_0xa4c2('0x21')]),_0x589191);}});ami['on'](_0xa4c2('0x41'),function(_0x2bdda6){try{utils['debug'](util[_0xa4c2('0x1e')](_0xa4c2('0x42'),_0x2bdda6[_0xa4c2('0x21')]),_0x2bdda6);dials[_0xa4c2('0x41')](_0x2bdda6);}catch(_0x3c09b9){utils[_0xa4c2('0x17')](util[_0xa4c2('0x1e')]('[%s]dialbegin',_0x2bdda6[_0xa4c2('0x21')]),_0x3c09b9);}});ami['on'](_0xa4c2('0x43'),function(_0x1d7c0a){try{utils['debug'](util[_0xa4c2('0x1e')](_0xa4c2('0x44'),_0x1d7c0a['uniqueid']),_0x1d7c0a);dials[_0xa4c2('0x43')](_0x1d7c0a);}catch(_0x563605){utils['error'](util['format'](_0xa4c2('0x44'),_0x1d7c0a[_0xa4c2('0x21')]),_0x563605);}});} \ No newline at end of file +var _0x5f0c=['attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x16593a,_0x5f179d){var _0xa7bcf6=function(_0x45f0e0){while(--_0x45f0e0){_0x16593a['push'](_0x16593a['shift']());}};_0xa7bcf6(++_0x5f179d);}(_0x5f0c,0xd5));var _0xc5f0=function(_0x22075f,_0x100010){_0x22075f=_0x22075f-0x0;var _0x1d7bac=_0x5f0c[_0x22075f];return _0x1d7bac;};var AsteriskManager=require(_0xc5f0('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xc5f0('0x1'));var isXDREnabled=config[_0xc5f0('0x2')]&&config[_0xc5f0('0x2')][_0xc5f0('0x3')]?!config[_0xc5f0('0x2')]['disabled']:!![];var isProduction=config['env']===_0xc5f0('0x4')||![];var isLocalAsterisk=config[_0xc5f0('0x2')]&&config[_0xc5f0('0x2')][_0xc5f0('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xc5f0('0x6')][_0xc5f0('0x7')],config[_0xc5f0('0x6')]['ip'],config[_0xc5f0('0x6')][_0xc5f0('0x8')],config[_0xc5f0('0x6')][_0xc5f0('0x9')],!![]);ami[_0xc5f0('0xa')]();if(!isXDREnabled){utils[_0xc5f0('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xc5f0('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0xc5f0('0xd'));var queues=require(_0xc5f0('0xe'));var recordings=require(_0xc5f0('0xf'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xc5f0('0x10'));var core=require('./core.controller');ami['on'](_0xc5f0('0x11'),core[_0xc5f0('0x11')]);ami['on'](_0xc5f0('0x12'),core['shutdown']);ami['on'](_0xc5f0('0x13'),core[_0xc5f0('0x13')]);ami['on'](_0xc5f0('0x14'),core[_0xc5f0('0x14')]);ami['on'](_0xc5f0('0x15'),core[_0xc5f0('0x15')]);ami['on'](_0xc5f0('0x16'),core[_0xc5f0('0x16')]);ami['on'](_0xc5f0('0x17'),function(_0x4753f2){try{utils['debug'](util[_0xc5f0('0x18')](_0xc5f0('0x19'),_0x4753f2[_0xc5f0('0x1a')]),_0x4753f2);members['devicestatechange'](_0x4753f2);}catch(_0x315e9f){utils['error'](util[_0xc5f0('0x18')](_0xc5f0('0x19'),_0x4753f2[_0xc5f0('0x1a')]),_0x315e9f);}});ami['on'](_0xc5f0('0x1b'),function(_0x3e4031){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x1d'),_0x3e4031[_0xc5f0('0x1e')]),_0x3e4031);agents[_0xc5f0('0x1b')](_0x3e4031);}catch(_0x554971){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')](_0xc5f0('0x1d'),_0x3e4031['uniqueid']),_0x554971);}});ami['on'](_0xc5f0('0x1f'),function(_0x21afd1){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x20'),_0x21afd1[_0xc5f0('0x1e')]),_0x21afd1);agents[_0xc5f0('0x1f')](_0x21afd1);}catch(_0x429de0){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')](_0xc5f0('0x20'),_0x21afd1['uniqueid']),_0x429de0);}});ami['on'](_0xc5f0('0x21'),function(_0x5c3446){try{utils['debug'](util[_0xc5f0('0x18')](_0xc5f0('0x22'),_0x5c3446[_0xc5f0('0x1e')]),_0x5c3446);agents[_0xc5f0('0x21')](_0x5c3446);queues[_0xc5f0('0x21')](_0x5c3446);}catch(_0x32aa1c){utils['error'](util[_0xc5f0('0x18')](_0xc5f0('0x22'),_0x5c3446[_0xc5f0('0x1e')]),_0x32aa1c);}});ami['on'](_0xc5f0('0x23'),function(_0x4eed11){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')]('[%s][index][agentcomplete]',_0x4eed11[_0xc5f0('0x1e')]),_0x4eed11);agents[_0xc5f0('0x23')](_0x4eed11);queues[_0xc5f0('0x23')](_0x4eed11);members[_0xc5f0('0x23')](_0x4eed11);}catch(_0x27e71a){utils['error'](util[_0xc5f0('0x18')]('[%s][index][agentcomplete]',_0x4eed11[_0xc5f0('0x1e')]),_0x27e71a);}});ami['on'](_0xc5f0('0x24'),function(_0x2f46da){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x25'),_0x2f46da['uniqueid']),_0x2f46da);agents[_0xc5f0('0x24')](_0x2f46da);queues[_0xc5f0('0x24')](_0x2f46da);}catch(_0x302ec5){utils['error'](util['format'](_0xc5f0('0x25'),_0x2f46da[_0xc5f0('0x1e')]),_0x302ec5);}});ami['on'](_0xc5f0('0x26'),function(_0x37f043){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x27'),_0x37f043[_0xc5f0('0x1e')]),_0x37f043);queues[_0xc5f0('0x26')](_0x37f043);recordings[_0xc5f0('0x26')](_0x37f043);}catch(_0x282ba2){utils['error'](util['format'](_0xc5f0('0x27'),_0x37f043[_0xc5f0('0x1e')]),_0x282ba2);}});ami['on'](_0xc5f0('0x28'),function(_0x1a4969){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x29'),_0x1a4969['uniqueid']),_0x1a4969);queues[_0xc5f0('0x28')](_0x1a4969);}catch(_0x17ca90){utils['error'](util['format'](_0xc5f0('0x29'),_0x1a4969['uniqueid']),_0x17ca90);}});ami['on']('musiconholdstart',function(_0x5994ac){try{utils['debug'](util[_0xc5f0('0x18')](_0xc5f0('0x2a'),_0x5994ac['uniqueid']),_0x5994ac);queues['musiconholdstart'](_0x5994ac);calls[_0xc5f0('0x2b')](_0x5994ac);}catch(_0x498354){utils['error'](util[_0xc5f0('0x18')](_0xc5f0('0x2a'),_0x5994ac[_0xc5f0('0x1e')]),_0x498354);}});ami['on'](_0xc5f0('0x2c'),function(_0x1c95f0){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x2d'),_0x1c95f0[_0xc5f0('0x1e')]),_0x1c95f0);queues[_0xc5f0('0x2c')](_0x1c95f0);calls['musiconholdstop'](_0x1c95f0);}catch(_0x4870e4){utils[_0xc5f0('0x14')](util['format'](_0xc5f0('0x2d'),_0x1c95f0[_0xc5f0('0x1e')]),_0x4870e4);}});ami['on'](_0xc5f0('0x2e'),function(_0x3c7604){try{utils['debug'](util[_0xc5f0('0x18')](_0xc5f0('0x2f'),_0x3c7604[_0xc5f0('0x1e')]),_0x3c7604);calls['newstate'](_0x3c7604);recordings[_0xc5f0('0x2e')](_0x3c7604);}catch(_0xdf515){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')](_0xc5f0('0x2f'),_0x3c7604['uniqueid']),_0xdf515);}});ami['on']('hangup',function(_0x336c66){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')]('[%s][index][hangup]',_0x336c66[_0xc5f0('0x1e')]),_0x336c66);calls[_0xc5f0('0x30')](_0x336c66);recordings[_0xc5f0('0x30')](_0x336c66);dials[_0xc5f0('0x30')](_0x336c66);agents[_0xc5f0('0x30')](_0x336c66);queues[_0xc5f0('0x30')](_0x336c66);}catch(_0x412977){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')]('[%s][index][hangup]',_0x336c66[_0xc5f0('0x1e')]),_0x412977);}});ami['on'](_0xc5f0('0x31'),function(_0x92cd11){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x32'),_0x92cd11[_0xc5f0('0x1e')]),_0x92cd11);members[_0xc5f0('0x31')](_0x92cd11);}catch(_0x70dcc0){utils[_0xc5f0('0x14')](util['format']('[%s][index][cdr]',_0x92cd11[_0xc5f0('0x1e')]),_0x70dcc0);}});ami['on'](_0xc5f0('0x33'),function(_0x1acdc1){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x34'),_0x1acdc1[_0xc5f0('0x1e')]),_0x1acdc1);queues['blindtransfer'](_0x1acdc1);agents[_0xc5f0('0x33')](_0x1acdc1);transfers[_0xc5f0('0x33')](_0x1acdc1);recordings[_0xc5f0('0x33')](_0x1acdc1);}catch(_0x267c0a){utils['error'](util[_0xc5f0('0x18')](_0xc5f0('0x34'),_0x1acdc1['uniqueid']),_0x267c0a);}});ami['on']('attendedtransfer',function(_0x3cdab6){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x35'),_0x3cdab6[_0xc5f0('0x36')]),_0x3cdab6);queues[_0xc5f0('0x37')](_0x3cdab6);transfers[_0xc5f0('0x37')](_0x3cdab6);agents[_0xc5f0('0x37')](_0x3cdab6);calls[_0xc5f0('0x37')](_0x3cdab6);}catch(_0x54aa5c){utils['error'](util[_0xc5f0('0x18')](_0xc5f0('0x35'),_0x3cdab6[_0xc5f0('0x36')]),_0x54aa5c);}});ami['on'](_0xc5f0('0x38'),function(_0x2294c9){try{utils['debug'](util[_0xc5f0('0x18')]('[%s][index][varset]',_0x2294c9['uniqueid']),_0x2294c9);queues[_0xc5f0('0x38')](_0x2294c9);recordings[_0xc5f0('0x38')](_0x2294c9);calls['varset'](_0x2294c9);dials[_0xc5f0('0x38')](_0x2294c9);}catch(_0xd67dc3){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')](_0xc5f0('0x39'),_0x2294c9[_0xc5f0('0x1e')]),_0xd67dc3);}});ami['on'](_0xc5f0('0x3a'),function(_0x651c6){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x3b'),_0x651c6[_0xc5f0('0x1e')]),_0x651c6);calls[_0xc5f0('0x3a')](_0x651c6);recordings[_0xc5f0('0x3a')](_0x651c6);dials[_0xc5f0('0x3a')](_0x651c6);}catch(_0x4de132){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')](_0xc5f0('0x3b'),_0x651c6[_0xc5f0('0x1e')]),_0x4de132);}});ami['on']('newchannel',function(_0x22a960){try{utils['debug'](util[_0xc5f0('0x18')](_0xc5f0('0x3c'),_0x22a960[_0xc5f0('0x1e')]),_0x22a960);calls[_0xc5f0('0x3d')](_0x22a960);recordings[_0xc5f0('0x3d')](_0x22a960);}catch(_0x545916){utils['error'](util['format'](_0xc5f0('0x3c'),_0x22a960['uniqueid']),_0x545916);}});ami['on'](_0xc5f0('0x3e'),function(_0x3f085e){try{utils['debug'](util[_0xc5f0('0x18')](_0xc5f0('0x3f'),_0x3f085e[_0xc5f0('0x1e')]),_0x3f085e);dials[_0xc5f0('0x3e')](_0x3f085e);}catch(_0x445ae3){utils[_0xc5f0('0x14')](util['format'](_0xc5f0('0x40'),_0x3f085e[_0xc5f0('0x1e')]),_0x445ae3);}});ami['on'](_0xc5f0('0x41'),function(_0x4ba749){try{utils[_0xc5f0('0x1c')](util[_0xc5f0('0x18')](_0xc5f0('0x42'),_0x4ba749[_0xc5f0('0x1e')]),_0x4ba749);dials[_0xc5f0('0x41')](_0x4ba749);}catch(_0x43cf5f){utils[_0xc5f0('0x14')](util[_0xc5f0('0x18')]('[%s][index][dialend]',_0x4ba749[_0xc5f0('0x1e')]),_0x43cf5f);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b089b91..33f08a0 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 _0xa1a2=['[%s][members][devicestatechange]','device','state','INUSE','now','agent','isNil','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data1','source','data3','exitAt','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','name','catch','error','[%s][members][writeDB]','startsWith','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1a2,0x76));var _0x2a1a=function(_0x2d6dff,_0x1e5f34){_0x2d6dff=_0x2d6dff-0x0;var _0x4fb5a9=_0xa1a2[_0x2d6dff];return _0x4fb5a9;};'use strict';var _=require(_0x2a1a('0x0'));var util=require(_0x2a1a('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x2a1a('0x2')];function writeDB(_0x2149ed){utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')](_0x2a1a('0x5'),_0x2149ed[_0x2a1a('0x6')],_0x2149ed[_0x2a1a('0x7')],_0x2149ed[_0x2a1a('0x8')],_0x2149ed[_0x2a1a('0x9')],_0x2149ed[_0x2a1a('0xa')],_0x2149ed[_0x2a1a('0xb')]));if(_0x2149ed[_0x2a1a('0x7')]){utils[_0x2a1a('0xc')](_0x2149ed['interface'])[_0x2a1a('0xd')](function(_0x485725){if(_0x485725){_0x2149ed[_0x2a1a('0xa')]=_0x485725['name'];_0x2149ed[_0x2a1a('0xe')]=_0x485725[_0x2a1a('0xe')];utils[_0x2a1a('0xf')]('CreateMemberReport',_0x2149ed);}else{utils[_0x2a1a('0x10')](_0x2149ed[_0x2a1a('0x7')]['split']('/')[0x1])[_0x2a1a('0xd')](function(_0x1fd772){if(_0x1fd772){_0x2149ed['membername']=_0x1fd772[_0x2a1a('0x11')];_0x2149ed[_0x2a1a('0xe')]=_0x1fd772['internal'];utils[_0x2a1a('0xf')]('CreateMemberReport',_0x2149ed);}});}})[_0x2a1a('0x12')](function(_0x50560c){utils[_0x2a1a('0x13')](util[_0x2a1a('0x4')](_0x2a1a('0x14'),_0x2149ed[_0x2a1a('0x6')]),_0x50560c);});}delete members[_0x2149ed[_0x2a1a('0x7')]];}function startsWith(_0x28fd00,_0x27f019){return _['some'](_0x28fd00,function(_0x2d3ade){return _[_0x2a1a('0x15')](_0x27f019,_0x2d3ade);});}exports['devicestatechange']=function(_0x33c00e){try{utils[_0x2a1a('0x16')](util[_0x2a1a('0x4')](_0x2a1a('0x17'),members[_0x33c00e[_0x2a1a('0x18')]]?members[_0x33c00e[_0x2a1a('0x18')]][_0x2a1a('0x6')]:_0x33c00e[_0x2a1a('0x18')]),_0x33c00e);utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x33c00e[_0x2a1a('0x18')]]?members[_0x33c00e[_0x2a1a('0x18')]][_0x2a1a('0x6')]:_0x33c00e[_0x2a1a('0x18')],_0x33c00e[_0x2a1a('0x19')],_0x33c00e['device']));switch(_0x33c00e[_0x2a1a('0x19')]){case _0x2a1a('0x1a'):case'BUSY':if(!startsWith(exclude,_0x33c00e[_0x2a1a('0x18')])){members[_0x33c00e[_0x2a1a('0x18')]]={'channel':'voice','interface':_0x33c00e[_0x2a1a('0x18')],'type':'TALKING','enterAt':utils[_0x2a1a('0x1b')](),'role':_0x2a1a('0x1c')};}break;case'NOT_INUSE':if(!_[_0x2a1a('0x1d')](members[_0x33c00e[_0x2a1a('0x18')]])){members[_0x33c00e[_0x2a1a('0x18')]]['exitAt']=utils[_0x2a1a('0x1b')]();members[_0x33c00e['device']][_0x2a1a('0x1e')]=utils[_0x2a1a('0x1f')](members[_0x33c00e[_0x2a1a('0x18')]]['exitAt'],members[_0x33c00e['device']]['enterAt']);if(members[_0x33c00e[_0x2a1a('0x18')]]['uniqueid']){writeDB(members[_0x33c00e[_0x2a1a('0x18')]]);}}break;default:break;}}catch(_0x18c908){utils[_0x2a1a('0x13')](util[_0x2a1a('0x4')]('[%s][members][devicestatechange]',members[_0x33c00e[_0x2a1a('0x18')]]?members[_0x33c00e[_0x2a1a('0x18')]]['uniqueid']:_0x33c00e['device']),_0x18c908);}};exports[_0x2a1a('0x20')]=function(_0x290292){try{if(!_['isNil'](members[_0x290292['interface']])){utils[_0x2a1a('0x16')](util[_0x2a1a('0x4')](_0x2a1a('0x21'),_0x290292[_0x2a1a('0x6')]),_0x290292);utils[_0x2a1a('0x3')](util['format'](_0x2a1a('0x22'),_0x290292['uniqueid'],_0x290292[_0x2a1a('0x7')],_0x290292[_0x2a1a('0x23')]));members[_0x290292['interface']]=_['assign'](members[_0x290292[_0x2a1a('0x7')]],{'data4':_0x290292['queue'],'uniqueid':_0x290292[_0x2a1a('0x6')]});}}catch(_0x49f7d5){utils['error'](util[_0x2a1a('0x4')](_0x2a1a('0x21'),_0x290292[_0x2a1a('0x6')]),_0x49f7d5);}};exports[_0x2a1a('0x24')]=function(_0x1cdffa){try{utils[_0x2a1a('0x16')](util['format'](_0x2a1a('0x25'),_0x1cdffa[_0x2a1a('0x6')]),_0x1cdffa);if(_0x1cdffa[_0x2a1a('0x8')]){var _0x24a0d6=_0x1cdffa['channel'][_0x2a1a('0x26')]('-')[0x0];if(!_['isNil'](members[_0x24a0d6])){members[_0x24a0d6]=_[_0x2a1a('0x27')](members[_0x24a0d6],{'data1':members[_0x24a0d6][_0x2a1a('0x28')]||_0x1cdffa['type'],'data2':members[_0x24a0d6][_0x2a1a('0x9')]||_0x1cdffa[_0x2a1a('0x29')],'data3':members[_0x24a0d6][_0x2a1a('0x2a')]||_0x1cdffa['destination'],'uniqueid':members[_0x24a0d6][_0x2a1a('0x6')]||_0x1cdffa[_0x2a1a('0x6')]});utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1cdffa['uniqueid'],members[_0x24a0d6]['data1'],members[_0x24a0d6][_0x2a1a('0x9')],members[_0x24a0d6][_0x2a1a('0x2a')]));if(members[_0x24a0d6][_0x2a1a('0x2b')]){writeDB(members[_0x24a0d6]);}}}if(_0x1cdffa[_0x2a1a('0x2c')]){var _0x1df829=_0x1cdffa[_0x2a1a('0x2c')]['split']('-')[0x0];if(!_['isNil'](members[_0x1df829])){members[_0x1df829]=_[_0x2a1a('0x27')](members[_0x1df829],{'data1':members[_0x1df829][_0x2a1a('0x28')]||_0x1cdffa[_0x2a1a('0xb')],'data2':members[_0x1df829][_0x2a1a('0x9')]||_0x1cdffa[_0x2a1a('0x29')],'data3':members[_0x1df829][_0x2a1a('0x2a')]||_0x1cdffa[_0x2a1a('0x2d')],'uniqueid':members[_0x1df829]['uniqueid']||_0x1cdffa[_0x2a1a('0x6')]});utils[_0x2a1a('0x3')](util[_0x2a1a('0x4')](_0x2a1a('0x2e'),_0x1cdffa['uniqueid'],members[_0x1df829][_0x2a1a('0x28')],members[_0x1df829]['data2'],members[_0x1df829]['data3']));if(members[_0x1df829][_0x2a1a('0x2b')]){writeDB(members[_0x1df829]);}}}}catch(_0x3af3ba){utils[_0x2a1a('0x13')](util[_0x2a1a('0x4')]('[%s][members][cdr]',_0x1cdffa[_0x2a1a('0x6')]),_0x3af3ba);}}; \ No newline at end of file +var _0xad86=['BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','now','duration','diffTime','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','debug','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','format','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad86,0x194));var _0x6ad8=function(_0x28b72e,_0x1862be){_0x28b72e=_0x28b72e-0x0;var _0x2bb662=_0xad86[_0x28b72e];return _0x2bb662;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var utils=require(_0x6ad8('0x2'));var members={};var exclude=[_0x6ad8('0x3'),_0x6ad8('0x4')];function writeDB(_0x1b184a){utils['info'](util['format'](_0x6ad8('0x5'),_0x1b184a[_0x6ad8('0x6')],_0x1b184a[_0x6ad8('0x7')],_0x1b184a[_0x6ad8('0x8')],_0x1b184a['data2'],_0x1b184a['membername'],_0x1b184a[_0x6ad8('0x9')]));if(_0x1b184a[_0x6ad8('0x7')]){utils[_0x6ad8('0xa')](_0x1b184a[_0x6ad8('0x7')])['then'](function(_0x535cce){if(_0x535cce){_0x1b184a[_0x6ad8('0xb')]=_0x535cce[_0x6ad8('0xc')];_0x1b184a[_0x6ad8('0xd')]=_0x535cce[_0x6ad8('0xd')];utils[_0x6ad8('0xe')](_0x6ad8('0xf'),_0x1b184a);}else{utils[_0x6ad8('0x10')](_0x1b184a[_0x6ad8('0x7')][_0x6ad8('0x11')]('/')[0x1])['then'](function(_0x5ad365){if(_0x5ad365){_0x1b184a['membername']=_0x5ad365[_0x6ad8('0xc')];_0x1b184a[_0x6ad8('0xd')]=_0x5ad365['internal'];utils[_0x6ad8('0xe')]('CreateMemberReport',_0x1b184a);}});}})[_0x6ad8('0x12')](function(_0x1e984b){utils['error'](util[_0x6ad8('0x13')]('[%s][members][writeDB]',_0x1b184a[_0x6ad8('0x6')]),_0x1e984b);});}delete members[_0x1b184a[_0x6ad8('0x7')]];}function startsWith(_0x1b900f,_0x19a29e){return _['some'](_0x1b900f,function(_0x412097){return _[_0x6ad8('0x14')](_0x19a29e,_0x412097);});}exports[_0x6ad8('0x15')]=function(_0x300b8d){try{utils['debug'](util[_0x6ad8('0x13')](_0x6ad8('0x16'),members[_0x300b8d['device']]?members[_0x300b8d[_0x6ad8('0x17')]]['uniqueid']:_0x300b8d[_0x6ad8('0x17')]),_0x300b8d);utils[_0x6ad8('0x18')](util[_0x6ad8('0x13')](_0x6ad8('0x19'),members[_0x300b8d['device']]?members[_0x300b8d[_0x6ad8('0x17')]][_0x6ad8('0x6')]:_0x300b8d[_0x6ad8('0x17')],_0x300b8d[_0x6ad8('0x1a')],_0x300b8d['device']));switch(_0x300b8d[_0x6ad8('0x1a')]){case _0x6ad8('0x1b'):case _0x6ad8('0x1c'):if(!startsWith(exclude,_0x300b8d[_0x6ad8('0x17')])){members[_0x300b8d[_0x6ad8('0x17')]]={'channel':_0x6ad8('0x1d'),'interface':_0x300b8d[_0x6ad8('0x17')],'type':_0x6ad8('0x1e'),'enterAt':utils['now'](),'role':_0x6ad8('0x1f')};}break;case _0x6ad8('0x20'):if(!_['isNil'](members[_0x300b8d['device']])){members[_0x300b8d[_0x6ad8('0x17')]][_0x6ad8('0x21')]=utils[_0x6ad8('0x22')]();members[_0x300b8d[_0x6ad8('0x17')]][_0x6ad8('0x23')]=utils[_0x6ad8('0x24')](members[_0x300b8d[_0x6ad8('0x17')]][_0x6ad8('0x21')],members[_0x300b8d['device']]['enterAt']);if(members[_0x300b8d[_0x6ad8('0x17')]][_0x6ad8('0x6')]){writeDB(members[_0x300b8d[_0x6ad8('0x17')]]);}}break;default:break;}}catch(_0x39aa51){utils['error'](util[_0x6ad8('0x13')]('[%s][members][devicestatechange]',members[_0x300b8d[_0x6ad8('0x17')]]?members[_0x300b8d[_0x6ad8('0x17')]][_0x6ad8('0x6')]:_0x300b8d[_0x6ad8('0x17')]),_0x39aa51);}};exports[_0x6ad8('0x25')]=function(_0x13c71c){try{if(!_[_0x6ad8('0x26')](members[_0x13c71c['interface']])){utils['debug'](util[_0x6ad8('0x13')](_0x6ad8('0x27'),_0x13c71c['uniqueid']),_0x13c71c);utils['info'](util[_0x6ad8('0x13')](_0x6ad8('0x28'),_0x13c71c[_0x6ad8('0x6')],_0x13c71c[_0x6ad8('0x7')],_0x13c71c[_0x6ad8('0x29')]));members[_0x13c71c['interface']]=_[_0x6ad8('0x2a')](members[_0x13c71c['interface']],{'data4':_0x13c71c[_0x6ad8('0x29')],'uniqueid':_0x13c71c[_0x6ad8('0x6')]});}}catch(_0x429774){utils[_0x6ad8('0x2b')](util[_0x6ad8('0x13')](_0x6ad8('0x27'),_0x13c71c[_0x6ad8('0x6')]),_0x429774);}};exports[_0x6ad8('0x2c')]=function(_0x1cb0e0){try{utils[_0x6ad8('0x2d')](util[_0x6ad8('0x13')](_0x6ad8('0x2e'),_0x1cb0e0['uniqueid']),_0x1cb0e0);if(_0x1cb0e0[_0x6ad8('0x8')]){var _0x3acc91=_0x1cb0e0[_0x6ad8('0x8')][_0x6ad8('0x11')]('-')[0x0];if(!_['isNil'](members[_0x3acc91])){members[_0x3acc91]=_[_0x6ad8('0x2a')](members[_0x3acc91],{'data1':members[_0x3acc91][_0x6ad8('0x2f')]||_0x1cb0e0['type'],'data2':members[_0x3acc91]['data2']||_0x1cb0e0[_0x6ad8('0x30')],'data3':members[_0x3acc91][_0x6ad8('0x31')]||_0x1cb0e0[_0x6ad8('0x32')],'uniqueid':members[_0x3acc91][_0x6ad8('0x6')]||_0x1cb0e0[_0x6ad8('0x6')]});utils[_0x6ad8('0x18')](util[_0x6ad8('0x13')](_0x6ad8('0x33'),_0x1cb0e0[_0x6ad8('0x6')],members[_0x3acc91][_0x6ad8('0x2f')],members[_0x3acc91][_0x6ad8('0x34')],members[_0x3acc91]['data3']));if(members[_0x3acc91][_0x6ad8('0x21')]){writeDB(members[_0x3acc91]);}}}if(_0x1cb0e0['destinationchannel']){var _0x378768=_0x1cb0e0[_0x6ad8('0x35')][_0x6ad8('0x11')]('-')[0x0];if(!_[_0x6ad8('0x26')](members[_0x378768])){members[_0x378768]=_['assign'](members[_0x378768],{'data1':members[_0x378768]['data1']||_0x1cb0e0[_0x6ad8('0x9')],'data2':members[_0x378768][_0x6ad8('0x34')]||_0x1cb0e0[_0x6ad8('0x30')],'data3':members[_0x378768]['data3']||_0x1cb0e0[_0x6ad8('0x32')],'uniqueid':members[_0x378768][_0x6ad8('0x6')]||_0x1cb0e0[_0x6ad8('0x6')]});utils['info'](util[_0x6ad8('0x13')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1cb0e0[_0x6ad8('0x6')],members[_0x378768][_0x6ad8('0x2f')],members[_0x378768][_0x6ad8('0x34')],members[_0x378768][_0x6ad8('0x31')]));if(members[_0x378768]['exitAt']){writeDB(members[_0x378768]);}}}}catch(_0x23b4ca){utils['error'](util[_0x6ad8('0x13')](_0x6ad8('0x2e'),_0x1cb0e0[_0x6ad8('0x6')]),_0x23b4ca);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f43b4f5..d6910ca 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 _0x9aff=['isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','membername','assigned','accountcode','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup'];(function(_0x11b304,_0x13a189){var _0x2fda04=function(_0x1bf729){while(--_0x1bf729){_0x11b304['push'](_0x11b304['shift']());}};_0x2fda04(++_0x13a189);}(_0x9aff,0x1e7));var _0xf9af=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9aff[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0xf9af('0x0'));var utils=require(_0xf9af('0x1'));var queues={};function writeDB(_0x3f8745){utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x4'),_0x3f8745['uniqueid'],_0x3f8745['channel'],_0x3f8745[_0xf9af('0x5')],_0x3f8745[_0xf9af('0x6')],_0x3f8745['calleridnum'],_0x3f8745['accountcode'],_0x3f8745[_0xf9af('0x7')]));if(_0x3f8745['queue']){utils[_0xf9af('0x8')](_0x3f8745[_0xf9af('0x5')])[_0xf9af('0x9')](function(_0x15f07d){if(_0x15f07d){_0x3f8745[_0xf9af('0xa')]=_0x15f07d['type'];}utils['request'](_0xf9af('0xb'),_0x3f8745);});}else{utils[_0xf9af('0xc')](_0xf9af('0xb'),_0x3f8745);}if(_0x3f8745[_0xf9af('0xd')]){delete queues[_0x3f8745['transfereduniqueid']];}else{delete queues[_0x3f8745[_0xf9af('0xe')]];}}exports[_0xf9af('0xf')]=function(_0x4a68d7){try{utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x11'),_0x4a68d7[_0xf9af('0xe')]),_0x4a68d7);utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x12'),_0x4a68d7[_0xf9af('0xe')],_0x4a68d7[_0xf9af('0x5')],_0x4a68d7[_0xf9af('0x13')]));queues[_0x4a68d7[_0xf9af('0xe')]]=_['assign'](_0x4a68d7,{'originalposition':_0x4a68d7[_0xf9af('0x13')],'queuecallerjoinAt':utils[_0xf9af('0x14')](),'mohtime':0x0});}catch(_0x430bff){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x11'),_0x4a68d7[_0xf9af('0xe')]),_0x430bff);}};exports[_0xf9af('0x16')]=function(_0x240704){try{if(!_[_0xf9af('0x17')](queues[_0x240704['uniqueid']])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x18'),_0x240704[_0xf9af('0xe')]),_0x240704);if(queues[_0x240704[_0xf9af('0xe')]]['queuecallerleaveAt']){if(!queues[_0x240704[_0xf9af('0xe')]]['queuecallerabandon']&&!queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x19')]){queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x1a')]=!![];queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x1b')]=utils['now']();queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x7')]=_0xf9af('0x1c');}utils[_0xf9af('0x2')](util['format'](_0xf9af('0x1d'),_0x240704[_0xf9af('0xe')],queues[_0x240704[_0xf9af('0xe')]]['name'],queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x7')]));writeDB(queues[_0x240704[_0xf9af('0xe')]]);}else if(queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0xd')]){utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x1e'),_0x240704[_0xf9af('0xe')],queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0x1f')],queues[_0x240704['uniqueid']][_0xf9af('0xd')]));queues[queues[_0x240704[_0xf9af('0xe')]][_0xf9af('0xd')]]=queues[_0x240704[_0xf9af('0xe')]];queues[queues[_0x240704[_0xf9af('0xe')]]['transfereduniqueid']][_0xf9af('0x20')]=0x2;delete queues[_0x240704['uniqueid']];}}}catch(_0x54f682){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x18'),_0x240704[_0xf9af('0xe')]),_0x54f682);}};exports[_0xf9af('0x21')]=function(_0x5136f3){try{utils[_0xf9af('0x10')](util['format'](_0xf9af('0x22'),_0x5136f3[_0xf9af('0xe')]),_0x5136f3);if(!_[_0xf9af('0x17')](_0x5136f3[_0xf9af('0x23')][_0xf9af('0x24')])&&_0x5136f3['value']['toUpperCase']()!==_0xf9af('0x25')){if(!_[_0xf9af('0x17')](queues[_0x5136f3['uniqueid']])){queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x26')]=![];queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x27')]=null;queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x19')]=!![];queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x28')]=utils['now']();queues[_0x5136f3['uniqueid']][_0xf9af('0x7')]=_0x5136f3['value'][_0xf9af('0x29')]();utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x5136f3[_0xf9af('0xe')],queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x1f')],_0x5136f3['value'],queues[_0x5136f3['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5136f3[_0xf9af('0xe')]]);}}else if(!_[_0xf9af('0x17')](_0x5136f3[_0xf9af('0x23')][_0xf9af('0x2a')])){if(!_[_0xf9af('0x17')](queues[_0x5136f3[_0xf9af('0xe')]])&&!queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerabandon']){queues[_0x5136f3['uniqueid']]['queuecallerabandon']=![];queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerabandonAt']=null;queues[_0x5136f3[_0xf9af('0xe')]][_0xf9af('0x19')]=!![];queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerexitAt']=utils[_0xf9af('0x14')]();queues[_0x5136f3['uniqueid']]['queuecallerexitreason']=_0xf9af('0x2b');utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x2c'),_0x5136f3[_0xf9af('0xe')],queues[_0x5136f3[_0xf9af('0xe')]]['name'],_0x5136f3['value'],queues[_0x5136f3[_0xf9af('0xe')]]['queuecallerexitreason']));}}}catch(_0x39b924){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x22'),_0x5136f3[_0xf9af('0xe')]),_0x39b924);}};exports[_0xf9af('0x26')]=function(_0x4a6127){try{if(!_[_0xf9af('0x17')](queues[_0x4a6127['uniqueid']])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x2d'),_0x4a6127[_0xf9af('0xe')]),_0x4a6127);queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x19')]=![];queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x28')]=null;queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x26')]=!![];queues[_0x4a6127[_0xf9af('0xe')]][_0xf9af('0x27')]=utils['now']();queues[_0x4a6127['uniqueid']][_0xf9af('0x7')]=_0xf9af('0x2e');utils['info'](util['format'](_0xf9af('0x2f'),_0x4a6127['uniqueid'],queues[_0x4a6127[_0xf9af('0xe')]]['name'],queues[_0x4a6127['uniqueid']][_0xf9af('0x7')]));}}catch(_0xb03f67){utils['error'](util[_0xf9af('0x3')](_0xf9af('0x2d'),_0x4a6127[_0xf9af('0xe')]),_0xb03f67);}};exports[_0xf9af('0x30')]=function(_0x425000){try{if(!_[_0xf9af('0x17')](queues[_0x425000[_0xf9af('0xe')]])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x31'),_0x425000[_0xf9af('0xe')]),_0x425000);utils[_0xf9af('0x2')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x425000[_0xf9af('0xe')],queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x1f')],_0x425000['connectedlinenum'],_0x425000[_0xf9af('0x32')]));queues[_0x425000['uniqueid']][_0xf9af('0x30')]=!![];queues[_0x425000['uniqueid']][_0xf9af('0x33')]=utils[_0xf9af('0x14')]();queues[_0x425000[_0xf9af('0xe')]]['holdtime']=utils[_0xf9af('0x34')](queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x33')],queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x35')]);queues[_0x425000['uniqueid']][_0xf9af('0x13')]=_0x425000['position'];queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x36')]=_0x425000[_0xf9af('0x36')];queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x37')]=_0x425000[_0xf9af('0x37')];queues[_0x425000[_0xf9af('0xe')]][_0xf9af('0x32')]=_0x425000[_0xf9af('0x32')];}}catch(_0x19ca74){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x31'),_0x425000['uniqueid']),_0x19ca74);}};exports[_0xf9af('0x38')]=function(_0x2f1546){try{if(!_['isNil'](queues[_0x2f1546[_0xf9af('0xe')]])){utils['debug'](util[_0xf9af('0x3')]('[%s][queues][agentconnect]',_0x2f1546['uniqueid']),_0x2f1546);utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2f1546['uniqueid'],queues[_0x2f1546['uniqueid']][_0xf9af('0x1f')],_0x2f1546[_0xf9af('0x39')],_0x2f1546['destaccountcode']));queues[_0x2f1546['uniqueid']][_0xf9af('0x26')]=![];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x26')]=![];queues[_0x2f1546['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2f1546[_0xf9af('0xe')]]['queuecallerexit']=![];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x7')]=null;queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x28')]=null;queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x3a')]=!![];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x3b')]=_0x2f1546[_0xf9af('0x3c')];queues[_0x2f1546[_0xf9af('0xe')]][_0xf9af('0x6')]=_0x2f1546[_0xf9af('0x39')];}}catch(_0x99e883){utils[_0xf9af('0x15')](util['format'](_0xf9af('0x3d'),_0x2f1546[_0xf9af('0xe')]),_0x99e883);}};exports[_0xf9af('0x3e')]=function(_0xd42368){try{if(!_[_0xf9af('0x17')](queues[_0xd42368[_0xf9af('0xe')]])){if(queues[_0xd42368['uniqueid']][_0xf9af('0x33')]){utils[_0xf9af('0x10')](util[_0xf9af('0x3')](_0xf9af('0x3f'),_0xd42368['uniqueid']),_0xd42368);queues[_0xd42368[_0xf9af('0xe')]]['queuecallerabandon']=![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x26')]=![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x27')]=null;queues[_0xd42368['uniqueid']][_0xf9af('0x19')]=![];queues[_0xd42368[_0xf9af('0xe')]]['queuecallerexitAt']=null;queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x3a')]=!![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x6')]=_0xd42368[_0xf9af('0x39')];queues[_0xd42368['uniqueid']][_0xf9af('0x1a')]=!![];queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x1b')]=utils[_0xf9af('0x14')]();if(_0xd42368[_0xf9af('0x40')]==_0xf9af('0x41')){if(!queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x41')]){queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x7')]=_0xf9af('0x42');}}else{queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x7')]='COMPLETEDBY'+_0xd42368['reason']['toUpperCase']();}utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x43'),_0xd42368[_0xf9af('0xe')],queues[_0xd42368['uniqueid']]['name'],_0xd42368[_0xf9af('0x39')],queues[_0xd42368[_0xf9af('0xe')]][_0xf9af('0x7')]));writeDB(queues[_0xd42368[_0xf9af('0xe')]]);}}}catch(_0x1b66f5){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x3f'),_0xd42368[_0xf9af('0xe')]),_0x1b66f5);}};exports[_0xf9af('0x44')]=function(_0x1e0ad){try{if(!_[_0xf9af('0x17')](queues[_0x1e0ad[_0xf9af('0x45')]])){utils['debug'](util[_0xf9af('0x3')]('[%s][queues][blindtransfer]',_0x1e0ad[_0xf9af('0xe')]),_0x1e0ad);queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x41')]=!![];queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x46')]=_0xf9af('0x47');queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x48')]=_0x1e0ad[_0xf9af('0x49')];queues[_0x1e0ad[_0xf9af('0x45')]]['transferuniqueid']=_0x1e0ad[_0xf9af('0x45')];queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x7')]=_0xf9af('0x4a');utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1e0ad[_0xf9af('0xe')],queues[_0x1e0ad[_0xf9af('0x45')]][_0xf9af('0x1f')],_0x1e0ad['transfereeuniqueid'],_0x1e0ad[_0xf9af('0x49')]));}}catch(_0x4a95d0){utils[_0xf9af('0x15')](util['format']('[%s][queues][blindtransfer]',_0x1e0ad['uniqueid']),_0x4a95d0);}};exports[_0xf9af('0x4b')]=function(_0x206573){try{utils[_0xf9af('0x10')](util['format'](_0xf9af('0x4c'),_0x206573[_0xf9af('0x4d')]),_0x206573);if(_0x206573[_0xf9af('0x4d')]==_0x206573['origtransfererlinkedid']){if(!_[_0xf9af('0x17')](queues[_0x206573[_0xf9af('0x4e')]])){utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x206573[_0xf9af('0x4d')],queues[_0x206573['secondtransfererlinkedid']][_0xf9af('0x1f')],_0x206573[_0xf9af('0x4f')]));queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0x41')]=!![];queues[_0x206573[_0xf9af('0x4e')]]['transfertype']=_0xf9af('0x50');queues[_0x206573['secondtransfererlinkedid']][_0xf9af('0x48')]=_0x206573[_0xf9af('0x4f')];queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0x51')]=_0x206573[_0xf9af('0x4d')];queues[_0x206573[_0xf9af('0x4e')]]['queuecallerexitreason']=_0xf9af('0x52');}if(!_[_0xf9af('0x17')](queues[_0x206573['origtransfererlinkedid']])){if(_0x206573['transfereelinkedid']&&queues[_0x206573['transfereelinkedid']]){queues[_0x206573[_0xf9af('0x53')]][_0xf9af('0x20')]=0x1;queues[_0x206573[_0xf9af('0x45')]]=_[_0xf9af('0x54')](queues[_0x206573['transfereelinkedid']]);queues[_0x206573['transfereeuniqueid']]['transfereduniqueid']=_0x206573[_0xf9af('0x55')];queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x20')]=0x2;queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x56')]=queues[_0x206573[_0xf9af('0x4e')]]['calleridnum'];queues[_0x206573['transfereeuniqueid']][_0xf9af('0x57')]=queues[_0x206573[_0xf9af('0x4e')]]['calleridname'];queues[_0x206573[_0xf9af('0x45')]]['queuecallerjoinAt']=utils[_0xf9af('0x14')]();queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x33')]=utils[_0xf9af('0x14')]();queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x58')]=0x0;queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x59')]=0x0;utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x5a'),_0x206573['origtransfereruniqueid'],queues[_0x206573[_0xf9af('0x45')]]['name'],queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x56')],queues[_0x206573[_0xf9af('0x45')]][_0xf9af('0x57')]));}else{utils[_0xf9af('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x206573['origtransfereruniqueid'],queues[_0x206573[_0xf9af('0x5b')]][_0xf9af('0x1f')],_0x206573[_0xf9af('0x4e')]));queues[_0x206573['origtransfererlinkedid']][_0xf9af('0xd')]=_0x206573[_0xf9af('0x4e')];}}}else if(_0x206573[_0xf9af('0x5c')]==_0x206573['secondtransfererlinkedid']){if(!_[_0xf9af('0x17')](queues[_0x206573[_0xf9af('0x5b')]])){utils[_0xf9af('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x206573[_0xf9af('0x4d')],queues[_0x206573[_0xf9af('0x5b')]][_0xf9af('0x1f')],_0x206573['secondtransfereruniqueid'],_0x206573[_0xf9af('0x5d')]));queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x41')]=!![];queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x46')]=_0xf9af('0x50');queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x48')]=_0x206573[_0xf9af('0x5d')];queues[_0x206573[_0xf9af('0x5b')]]['transferuniqueid']=_0x206573[_0xf9af('0x5c')];queues[_0x206573[_0xf9af('0x5b')]]['queuecallerexitreason']=_0xf9af('0x52');}if(!_[_0xf9af('0x17')](queues[_0x206573[_0xf9af('0x4e')]])){if(_0x206573[_0xf9af('0x5e')]&&queues[_0x206573['transfertargetlinkedid']]){queues[_0x206573[_0xf9af('0x5e')]][_0xf9af('0x20')]=0x1;queues[_0x206573[_0xf9af('0x55')]]=_[_0xf9af('0x54')](queues[_0x206573['transfertargetlinkedid']]);queues[_0x206573['transfertargetuniqueid']][_0xf9af('0xd')]=_0x206573['transfertargetuniqueid'];queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x20')]=0x2;queues[_0x206573[_0xf9af('0x55')]]['calleridnum']=queues[_0x206573[_0xf9af('0x5b')]][_0xf9af('0x56')];queues[_0x206573[_0xf9af('0x55')]]['calleridname']=queues[_0x206573['origtransfererlinkedid']][_0xf9af('0x57')];queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x35')]=utils['now']();queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x33')]=utils[_0xf9af('0x14')]();queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x58')]=0x0;queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x59')]=0x0;utils[_0xf9af('0x2')](util[_0xf9af('0x3')](_0xf9af('0x5f'),_0x206573[_0xf9af('0x4d')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x1f')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0xd')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x56')],queues[_0x206573[_0xf9af('0x55')]][_0xf9af('0x57')]));}else{utils[_0xf9af('0x2')](util[_0xf9af('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x206573[_0xf9af('0x4d')],queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0x1f')],_0x206573[_0xf9af('0x5b')]));queues[_0x206573[_0xf9af('0x4e')]][_0xf9af('0xd')]=_0x206573[_0xf9af('0x5b')];}}}}catch(_0x56cb91){utils['error'](util[_0xf9af('0x3')]('[%s][queues][attendedtransfer]',_0x206573[_0xf9af('0x4d')]),_0x56cb91);}};exports[_0xf9af('0x60')]=function(_0x3b1659){try{if(!_[_0xf9af('0x17')](queues[_0x3b1659[_0xf9af('0xe')]])){utils[_0xf9af('0x10')](util[_0xf9af('0x3')]('[%s][queues][musiconholdstart]',_0x3b1659[_0xf9af('0xe')]),_0x3b1659);queues[_0x3b1659['uniqueid']][_0xf9af('0x61')]=utils[_0xf9af('0x14')]();utils[_0xf9af('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3b1659[_0xf9af('0xe')],queues[_0x3b1659[_0xf9af('0xe')]][_0xf9af('0x1f')],queues[_0x3b1659['uniqueid']][_0xf9af('0x61')]));}}catch(_0x12d41d){utils['error'](util[_0xf9af('0x3')](_0xf9af('0x62'),_0x3b1659[_0xf9af('0xe')]),_0x12d41d);}};exports[_0xf9af('0x63')]=function(_0x571ccd){try{if(!_[_0xf9af('0x17')](queues[_0x571ccd[_0xf9af('0xe')]])){if(!_[_0xf9af('0x17')](queues[_0x571ccd[_0xf9af('0xe')]][_0xf9af('0x61')])){utils[_0xf9af('0x10')](util['format'](_0xf9af('0x64'),_0x571ccd[_0xf9af('0xe')]),_0x571ccd);queues[_0x571ccd[_0xf9af('0xe')]]['mohtime']+=utils[_0xf9af('0x34')](utils[_0xf9af('0x14')](),queues[_0x571ccd[_0xf9af('0xe')]]['musiconholdstartAt']);utils[_0xf9af('0x2')](util['format'](_0xf9af('0x65'),_0x571ccd[_0xf9af('0xe')],queues[_0x571ccd[_0xf9af('0xe')]]['name'],queues[_0x571ccd[_0xf9af('0xe')]][_0xf9af('0x59')]));delete queues[_0x571ccd[_0xf9af('0xe')]]['musiconholdstartAt'];}}}catch(_0x1b59f4){utils[_0xf9af('0x15')](util[_0xf9af('0x3')](_0xf9af('0x64'),_0x571ccd[_0xf9af('0xe')]),_0x1b59f4);}}; \ No newline at end of file +var _0xe0fa=['connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','BLINDTRANSFER','extension','[%s][queues][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','util','info','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','isNil','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','variable','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xe0fa,0x94));var _0xae0f=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xe0fa[_0x5f42f1];return _0x5534ee;};'use strict';var _=require('lodash');var util=require(_0xae0f('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x5e69f3){utils[_0xae0f('0x1')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5e69f3[_0xae0f('0x2')],_0x5e69f3['channel'],_0x5e69f3[_0xae0f('0x3')],_0x5e69f3[_0xae0f('0x4')],_0x5e69f3['calleridnum'],_0x5e69f3[_0xae0f('0x5')],_0x5e69f3[_0xae0f('0x6')]));if(_0x5e69f3[_0xae0f('0x3')]){utils[_0xae0f('0x7')](_0x5e69f3[_0xae0f('0x3')])[_0xae0f('0x8')](function(_0x1bda41){if(_0x1bda41){_0x5e69f3[_0xae0f('0x9')]=_0x1bda41[_0xae0f('0x9')];}utils['request'](_0xae0f('0xa'),_0x5e69f3);});}else{utils[_0xae0f('0xb')](_0xae0f('0xa'),_0x5e69f3);}if(_0x5e69f3[_0xae0f('0xc')]){delete queues[_0x5e69f3[_0xae0f('0xc')]];}else{delete queues[_0x5e69f3[_0xae0f('0x2')]];}}exports[_0xae0f('0xd')]=function(_0xe39bcd){try{utils[_0xae0f('0xe')](util[_0xae0f('0xf')](_0xae0f('0x10'),_0xe39bcd['uniqueid']),_0xe39bcd);utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x11'),_0xe39bcd['uniqueid'],_0xe39bcd['queue'],_0xe39bcd[_0xae0f('0x12')]));queues[_0xe39bcd[_0xae0f('0x2')]]=_['assign'](_0xe39bcd,{'originalposition':_0xe39bcd[_0xae0f('0x12')],'queuecallerjoinAt':utils[_0xae0f('0x13')](),'mohtime':0x0});}catch(_0x5f00ac){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x10'),_0xe39bcd[_0xae0f('0x2')]),_0x5f00ac);}};exports['hangup']=function(_0x10fef7){try{if(!_['isNil'](queues[_0x10fef7[_0xae0f('0x2')]])){utils['debug'](util[_0xae0f('0xf')](_0xae0f('0x15'),_0x10fef7[_0xae0f('0x2')]),_0x10fef7);if(queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0x16')]){if(!queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0x17')]&&!queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0x18')]){queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0x19')]=!![];queues[_0x10fef7['uniqueid']][_0xae0f('0x1a')]=utils[_0xae0f('0x13')]();queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0x6')]='COMPLETEDBYAGENT';}utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x1b'),_0x10fef7[_0xae0f('0x2')],queues[_0x10fef7[_0xae0f('0x2')]]['name'],queues[_0x10fef7['uniqueid']][_0xae0f('0x6')]));writeDB(queues[_0x10fef7[_0xae0f('0x2')]]);}else if(queues[_0x10fef7[_0xae0f('0x2')]]['transfereduniqueid']){utils['info'](util[_0xae0f('0xf')](_0xae0f('0x1c'),_0x10fef7[_0xae0f('0x2')],queues[_0x10fef7[_0xae0f('0x2')]]['name'],queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0xc')]));queues[queues[_0x10fef7[_0xae0f('0x2')]]['transfereduniqueid']]=queues[_0x10fef7[_0xae0f('0x2')]];queues[queues[_0x10fef7[_0xae0f('0x2')]][_0xae0f('0xc')]][_0xae0f('0x1d')]=0x2;delete queues[_0x10fef7['uniqueid']];}}}catch(_0x15dd5c){utils[_0xae0f('0x14')](util['format'](_0xae0f('0x15'),_0x10fef7[_0xae0f('0x2')]),_0x15dd5c);}};exports['varset']=function(_0x27645d){try{utils[_0xae0f('0xe')](util[_0xae0f('0xf')](_0xae0f('0x1e'),_0x27645d[_0xae0f('0x2')]),_0x27645d);if(!_[_0xae0f('0x1f')](_0x27645d['variable']['queuestatus'])&&_0x27645d[_0xae0f('0x20')]['toUpperCase']()!==_0xae0f('0x21')){if(!_[_0xae0f('0x1f')](queues[_0x27645d[_0xae0f('0x2')]])){queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x17')]=![];queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x22')]=null;queues[_0x27645d['uniqueid']][_0xae0f('0x18')]=!![];queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x23')]=utils[_0xae0f('0x13')]();queues[_0x27645d['uniqueid']][_0xae0f('0x6')]=_0x27645d[_0xae0f('0x20')]['toUpperCase']();utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x24'),_0x27645d[_0xae0f('0x2')],queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x25')],_0x27645d['value'],queues[_0x27645d[_0xae0f('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x27645d[_0xae0f('0x2')]]);}}else if(!_['isNil'](_0x27645d[_0xae0f('0x26')][_0xae0f('0x27')])){if(!_[_0xae0f('0x1f')](queues[_0x27645d[_0xae0f('0x2')]])&&!queues[_0x27645d['uniqueid']][_0xae0f('0x17')]){queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x17')]=![];queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x22')]=null;queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x18')]=!![];queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x23')]=utils[_0xae0f('0x13')]();queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x6')]=_0xae0f('0x28');utils[_0xae0f('0x1')](util[_0xae0f('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x27645d[_0xae0f('0x2')],queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x25')],_0x27645d[_0xae0f('0x20')],queues[_0x27645d[_0xae0f('0x2')]][_0xae0f('0x6')]));}}}catch(_0x2b7547){utils['error'](util['format'](_0xae0f('0x1e'),_0x27645d[_0xae0f('0x2')]),_0x2b7547);}};exports[_0xae0f('0x17')]=function(_0x5db15e){try{if(!_[_0xae0f('0x1f')](queues[_0x5db15e[_0xae0f('0x2')]])){utils['debug'](util[_0xae0f('0xf')](_0xae0f('0x29'),_0x5db15e['uniqueid']),_0x5db15e);queues[_0x5db15e[_0xae0f('0x2')]]['queuecallerexit']=![];queues[_0x5db15e[_0xae0f('0x2')]][_0xae0f('0x23')]=null;queues[_0x5db15e[_0xae0f('0x2')]][_0xae0f('0x17')]=!![];queues[_0x5db15e[_0xae0f('0x2')]][_0xae0f('0x22')]=utils[_0xae0f('0x13')]();queues[_0x5db15e[_0xae0f('0x2')]][_0xae0f('0x6')]='ABANDONED';utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x2a'),_0x5db15e[_0xae0f('0x2')],queues[_0x5db15e[_0xae0f('0x2')]][_0xae0f('0x25')],queues[_0x5db15e[_0xae0f('0x2')]]['queuecallerexitreason']));}}catch(_0x5921c2){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x29'),_0x5db15e[_0xae0f('0x2')]),_0x5921c2);}};exports['queuecallerleave']=function(_0xfe7573){try{if(!_[_0xae0f('0x1f')](queues[_0xfe7573[_0xae0f('0x2')]])){utils[_0xae0f('0xe')](util['format'](_0xae0f('0x2b'),_0xfe7573[_0xae0f('0x2')]),_0xfe7573);utils['info'](util[_0xae0f('0xf')](_0xae0f('0x2c'),_0xfe7573[_0xae0f('0x2')],queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x25')],_0xfe7573[_0xae0f('0x2d')],_0xfe7573[_0xae0f('0x2e')]));queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x2f')]=!![];queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x16')]=utils[_0xae0f('0x13')]();queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x30')]=utils[_0xae0f('0x31')](queues[_0xfe7573[_0xae0f('0x2')]]['queuecallerleaveAt'],queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x32')]);queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x12')]=_0xfe7573['position'];queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x33')]=_0xfe7573[_0xae0f('0x33')];queues[_0xfe7573['uniqueid']][_0xae0f('0x2d')]=_0xfe7573[_0xae0f('0x2d')];queues[_0xfe7573[_0xae0f('0x2')]][_0xae0f('0x2e')]=_0xfe7573['connectedlinename'];}}catch(_0x4f4735){utils[_0xae0f('0x14')](util[_0xae0f('0xf')]('[%s][queues][queuecallerleave]',_0xfe7573[_0xae0f('0x2')]),_0x4f4735);}};exports[_0xae0f('0x34')]=function(_0xd209){try{if(!_[_0xae0f('0x1f')](queues[_0xd209['uniqueid']])){utils[_0xae0f('0xe')](util[_0xae0f('0xf')]('[%s][queues][agentconnect]',_0xd209[_0xae0f('0x2')]),_0xd209);utils['info'](util[_0xae0f('0xf')](_0xae0f('0x35'),_0xd209[_0xae0f('0x2')],queues[_0xd209[_0xae0f('0x2')]]['name'],_0xd209[_0xae0f('0x36')],_0xd209[_0xae0f('0x37')]));queues[_0xd209[_0xae0f('0x2')]]['queuecallerabandon']=![];queues[_0xd209['uniqueid']]['queuecallerabandon']=![];queues[_0xd209[_0xae0f('0x2')]][_0xae0f('0x22')]=null;queues[_0xd209[_0xae0f('0x2')]][_0xae0f('0x18')]=![];queues[_0xd209[_0xae0f('0x2')]][_0xae0f('0x6')]=null;queues[_0xd209['uniqueid']][_0xae0f('0x23')]=null;queues[_0xd209[_0xae0f('0x2')]]['assigned']=!![];queues[_0xd209[_0xae0f('0x2')]][_0xae0f('0x5')]=_0xd209[_0xae0f('0x37')];queues[_0xd209[_0xae0f('0x2')]][_0xae0f('0x4')]=_0xd209[_0xae0f('0x36')];}}catch(_0xb4b1c8){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x38'),_0xd209['uniqueid']),_0xb4b1c8);}};exports['agentcomplete']=function(_0x45d3e1){try{if(!_[_0xae0f('0x1f')](queues[_0x45d3e1[_0xae0f('0x2')]])){if(queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x16')]){utils[_0xae0f('0xe')](util['format'](_0xae0f('0x39'),_0x45d3e1[_0xae0f('0x2')]),_0x45d3e1);queues[_0x45d3e1['uniqueid']][_0xae0f('0x17')]=![];queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x17')]=![];queues[_0x45d3e1['uniqueid']][_0xae0f('0x22')]=null;queues[_0x45d3e1[_0xae0f('0x2')]]['queuecallerexit']=![];queues[_0x45d3e1['uniqueid']][_0xae0f('0x23')]=null;queues[_0x45d3e1[_0xae0f('0x2')]]['assigned']=!![];queues[_0x45d3e1[_0xae0f('0x2')]]['lastAssignedTo']=_0x45d3e1[_0xae0f('0x36')];queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x19')]=!![];queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x1a')]=utils['now']();if(_0x45d3e1[_0xae0f('0x3a')]==_0xae0f('0x3b')){if(!queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x3b')]){queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x6')]=_0xae0f('0x3c');}}else{queues[_0x45d3e1['uniqueid']]['queuecallerexitreason']=_0xae0f('0x3d')+_0x45d3e1[_0xae0f('0x3a')][_0xae0f('0x3e')]();}utils['info'](util['format'](_0xae0f('0x3f'),_0x45d3e1['uniqueid'],queues[_0x45d3e1['uniqueid']][_0xae0f('0x25')],_0x45d3e1[_0xae0f('0x36')],queues[_0x45d3e1[_0xae0f('0x2')]][_0xae0f('0x6')]));writeDB(queues[_0x45d3e1[_0xae0f('0x2')]]);}}}catch(_0x9c08a8){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x39'),_0x45d3e1['uniqueid']),_0x9c08a8);}};exports['blindtransfer']=function(_0xa990af){try{if(!_[_0xae0f('0x1f')](queues[_0xa990af['transfereeuniqueid']])){utils['debug'](util[_0xae0f('0xf')]('[%s][queues][blindtransfer]',_0xa990af[_0xae0f('0x2')]),_0xa990af);queues[_0xa990af['transfereeuniqueid']][_0xae0f('0x3b')]=!![];queues[_0xa990af[_0xae0f('0x40')]][_0xae0f('0x41')]=_0xae0f('0x42');queues[_0xa990af[_0xae0f('0x40')]][_0xae0f('0x43')]=_0xa990af['extension'];queues[_0xa990af[_0xae0f('0x40')]]['transferuniqueid']=_0xa990af[_0xae0f('0x40')];queues[_0xa990af['transfereeuniqueid']]['queuecallerexitreason']=_0xae0f('0x44');utils[_0xae0f('0x1')](util[_0xae0f('0xf')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xa990af[_0xae0f('0x2')],queues[_0xa990af[_0xae0f('0x40')]][_0xae0f('0x25')],_0xa990af[_0xae0f('0x40')],_0xa990af[_0xae0f('0x45')]));}}catch(_0x4462b8){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x46'),_0xa990af[_0xae0f('0x2')]),_0x4462b8);}};exports['attendedtransfer']=function(_0x1d97de){try{utils['debug'](util[_0xae0f('0xf')]('[%s][queues][attendedtransfer]',_0x1d97de[_0xae0f('0x47')]),_0x1d97de);if(_0x1d97de[_0xae0f('0x47')]==_0x1d97de[_0xae0f('0x48')]){if(!_[_0xae0f('0x1f')](queues[_0x1d97de['secondtransfererlinkedid']])){utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x49'),_0x1d97de[_0xae0f('0x47')],queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0x25')],_0x1d97de[_0xae0f('0x4b')]));queues[_0x1d97de['secondtransfererlinkedid']][_0xae0f('0x3b')]=!![];queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0x41')]=_0xae0f('0x4c');queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0x43')]=_0x1d97de[_0xae0f('0x4b')];queues[_0x1d97de['secondtransfererlinkedid']][_0xae0f('0x4d')]=_0x1d97de['origtransfereruniqueid'];queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0x6')]=_0xae0f('0x4e');}if(!_[_0xae0f('0x1f')](queues[_0x1d97de[_0xae0f('0x48')]])){if(_0x1d97de[_0xae0f('0x4f')]&&queues[_0x1d97de[_0xae0f('0x4f')]]){queues[_0x1d97de[_0xae0f('0x4f')]][_0xae0f('0x1d')]=0x1;queues[_0x1d97de['transfereeuniqueid']]=_[_0xae0f('0x50')](queues[_0x1d97de['transfereelinkedid']]);queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0xc')]=_0x1d97de[_0xae0f('0x51')];queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0x1d')]=0x2;queues[_0x1d97de['transfereeuniqueid']]['calleridnum']=queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0x52')];queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0x53')]=queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0x53')];queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0x32')]=utils[_0xae0f('0x13')]();queues[_0x1d97de[_0xae0f('0x40')]]['queuecallerleaveAt']=utils[_0xae0f('0x13')]();queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0x30')]=0x0;queues[_0x1d97de[_0xae0f('0x40')]]['mohtime']=0x0;utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x54'),_0x1d97de[_0xae0f('0x47')],queues[_0x1d97de['transfereeuniqueid']]['name'],queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0x52')],queues[_0x1d97de[_0xae0f('0x40')]][_0xae0f('0x53')]));}else{utils['info'](util[_0xae0f('0xf')](_0xae0f('0x55'),_0x1d97de[_0xae0f('0x47')],queues[_0x1d97de[_0xae0f('0x48')]][_0xae0f('0x25')],_0x1d97de[_0xae0f('0x4a')]));queues[_0x1d97de[_0xae0f('0x48')]]['transfereduniqueid']=_0x1d97de[_0xae0f('0x4a')];}}}else if(_0x1d97de[_0xae0f('0x56')]==_0x1d97de[_0xae0f('0x4a')]){if(!_[_0xae0f('0x1f')](queues[_0x1d97de[_0xae0f('0x48')]])){utils[_0xae0f('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1d97de['origtransfereruniqueid'],queues[_0x1d97de[_0xae0f('0x48')]]['name'],_0x1d97de['secondtransfereruniqueid'],_0x1d97de[_0xae0f('0x57')]));queues[_0x1d97de[_0xae0f('0x48')]][_0xae0f('0x3b')]=!![];queues[_0x1d97de['origtransfererlinkedid']][_0xae0f('0x41')]=_0xae0f('0x4c');queues[_0x1d97de[_0xae0f('0x48')]]['transferexten']=_0x1d97de['secondtransfererexten'];queues[_0x1d97de[_0xae0f('0x48')]][_0xae0f('0x4d')]=_0x1d97de['secondtransfereruniqueid'];queues[_0x1d97de[_0xae0f('0x48')]][_0xae0f('0x6')]=_0xae0f('0x4e');}if(!_[_0xae0f('0x1f')](queues[_0x1d97de[_0xae0f('0x4a')]])){if(_0x1d97de['transfertargetlinkedid']&&queues[_0x1d97de[_0xae0f('0x58')]]){queues[_0x1d97de['transfertargetlinkedid']][_0xae0f('0x1d')]=0x1;queues[_0x1d97de['transfertargetuniqueid']]=_[_0xae0f('0x50')](queues[_0x1d97de[_0xae0f('0x58')]]);queues[_0x1d97de[_0xae0f('0x51')]][_0xae0f('0xc')]=_0x1d97de[_0xae0f('0x51')];queues[_0x1d97de[_0xae0f('0x51')]]['queuecallerenterreason']=0x2;queues[_0x1d97de['transfertargetuniqueid']][_0xae0f('0x52')]=queues[_0x1d97de['origtransfererlinkedid']][_0xae0f('0x52')];queues[_0x1d97de[_0xae0f('0x51')]]['calleridname']=queues[_0x1d97de[_0xae0f('0x48')]][_0xae0f('0x53')];queues[_0x1d97de[_0xae0f('0x51')]][_0xae0f('0x32')]=utils['now']();queues[_0x1d97de[_0xae0f('0x51')]]['queuecallerleaveAt']=utils[_0xae0f('0x13')]();queues[_0x1d97de[_0xae0f('0x51')]]['holdtime']=0x0;queues[_0x1d97de[_0xae0f('0x51')]][_0xae0f('0x59')]=0x0;utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x5a'),_0x1d97de[_0xae0f('0x47')],queues[_0x1d97de[_0xae0f('0x51')]][_0xae0f('0x25')],queues[_0x1d97de[_0xae0f('0x51')]][_0xae0f('0xc')],queues[_0x1d97de[_0xae0f('0x51')]][_0xae0f('0x52')],queues[_0x1d97de['transfertargetuniqueid']][_0xae0f('0x53')]));}else{utils[_0xae0f('0x1')](util[_0xae0f('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1d97de[_0xae0f('0x47')],queues[_0x1d97de[_0xae0f('0x4a')]]['name'],_0x1d97de['origtransfererlinkedid']));queues[_0x1d97de[_0xae0f('0x4a')]][_0xae0f('0xc')]=_0x1d97de[_0xae0f('0x48')];}}}}catch(_0x5d6b3c){utils['error'](util[_0xae0f('0xf')](_0xae0f('0x5b'),_0x1d97de[_0xae0f('0x47')]),_0x5d6b3c);}};exports[_0xae0f('0x5c')]=function(_0x3078a5){try{if(!_[_0xae0f('0x1f')](queues[_0x3078a5[_0xae0f('0x2')]])){utils[_0xae0f('0xe')](util[_0xae0f('0xf')](_0xae0f('0x5d'),_0x3078a5[_0xae0f('0x2')]),_0x3078a5);queues[_0x3078a5[_0xae0f('0x2')]]['musiconholdstartAt']=utils['now']();utils[_0xae0f('0x1')](util[_0xae0f('0xf')](_0xae0f('0x5e'),_0x3078a5[_0xae0f('0x2')],queues[_0x3078a5[_0xae0f('0x2')]][_0xae0f('0x25')],queues[_0x3078a5[_0xae0f('0x2')]][_0xae0f('0x5f')]));}}catch(_0x24b2b1){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x5d'),_0x3078a5['uniqueid']),_0x24b2b1);}};exports['musiconholdstop']=function(_0x48c746){try{if(!_[_0xae0f('0x1f')](queues[_0x48c746[_0xae0f('0x2')]])){if(!_[_0xae0f('0x1f')](queues[_0x48c746[_0xae0f('0x2')]][_0xae0f('0x5f')])){utils[_0xae0f('0xe')](util[_0xae0f('0xf')](_0xae0f('0x60'),_0x48c746[_0xae0f('0x2')]),_0x48c746);queues[_0x48c746['uniqueid']][_0xae0f('0x59')]+=utils['diffTime'](utils[_0xae0f('0x13')](),queues[_0x48c746[_0xae0f('0x2')]][_0xae0f('0x5f')]);utils[_0xae0f('0x1')](util[_0xae0f('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x48c746[_0xae0f('0x2')],queues[_0x48c746[_0xae0f('0x2')]][_0xae0f('0x25')],queues[_0x48c746[_0xae0f('0x2')]][_0xae0f('0x59')]));delete queues[_0x48c746[_0xae0f('0x2')]][_0xae0f('0x5f')];}}}catch(_0x1158ce){utils[_0xae0f('0x14')](util[_0xae0f('0xf')](_0xae0f('0x60'),_0x48c746[_0xae0f('0x2')]),_0x1158ce);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e22be46..4cb3ba7 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 _0x595c=['[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','accountcode','connectedlinename','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','getUserByInternal','membername','name','request','CreateVoiceRecording','blinds','newchannel','debug','format'];(function(_0xdafdbc,_0xe260b0){var _0x1108de=function(_0x27d66c){while(--_0x27d66c){_0xdafdbc['push'](_0xdafdbc['shift']());}};_0x1108de(++_0xe260b0);}(_0x595c,0x80));var _0xc595=function(_0x5d1a0c,_0x2dacd3){_0x5d1a0c=_0x5d1a0c-0x0;var _0x4642c2=_0x595c[_0x5d1a0c];return _0x4642c2;};'use strict';var _=require(_0xc595('0x0'));var util=require(_0xc595('0x1'));var utils=require(_0xc595('0x2'));var transfers=require(_0xc595('0x3'));var recordings={};function writeDB(_0x229420){var _0x4b54bc;utils['info'](util['format'](_0xc595('0x4'),_0x229420[_0xc595('0x5')]));if(transfers['blinds'][_0x229420[_0xc595('0x5')]]){_0x4b54bc=_0x229420[_0xc595('0x5')];_0x229420[_0xc595('0x5')]=transfers['blinds'][_0x229420[_0xc595('0x5')]][_0xc595('0x6')];}if(_0x229420['accountcode']){utils[_0xc595('0x7')](_0x229420['accountcode'])['then'](function(_0x928233){if(_0x928233){_0x229420[_0xc595('0x8')]=_0x928233[_0xc595('0x9')];_0x229420['UserId']=_0x928233['id'];}utils[_0xc595('0xa')](_0xc595('0xb'),_0x229420);});}else{utils[_0xc595('0xa')](_0xc595('0xb'),_0x229420);}if(_0x4b54bc)delete transfers[_0xc595('0xc')][_0x4b54bc];}exports[_0xc595('0xd')]=function(_0x2e578a){try{utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x10'),_0x2e578a[_0xc595('0x5')]),_0x2e578a);if(_0x2e578a['uniqueid']==_0x2e578a[_0xc595('0x11')]){utils[_0xc595('0x12')](util['format'](_0xc595('0x13'),_0x2e578a[_0xc595('0x5')],_0x2e578a[_0xc595('0x14')],_0x2e578a[_0xc595('0x15')]));recordings[_0x2e578a[_0xc595('0x5')]]={'uniqueid':_0x2e578a['uniqueid'],'accountcode':_0x2e578a['accountcode'],'exten':_0x2e578a[_0xc595('0x15')],'context':_0x2e578a[_0xc595('0x14')],'channel':_0x2e578a[_0xc595('0x16')],'monitors':[]};}}catch(_0x178045){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x10'),_0x2e578a[_0xc595('0x5')]),_0x178045);}};exports[_0xc595('0x18')]=function(_0x2caa62){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x2caa62[_0xc595('0x5')]),_0x2caa62);if(!_[_0xc595('0x19')](recordings[_0x2caa62['uniqueid']])&&_0x2caa62[_0xc595('0x1a')]==0x6){utils[_0xc595('0x12')](util[_0xc595('0xf')](_0xc595('0x1b'),_0x2caa62['uniqueid'],_0x2caa62[_0xc595('0x14')],_0x2caa62[_0xc595('0x16')]));}else if(!_['isNil'](recordings[_0x2caa62[_0xc595('0x11')]])&&_0x2caa62[_0xc595('0x1a')]==0x6&&_0x2caa62[_0xc595('0x14')]!=_0xc595('0x1c')){utils[_0xc595('0x12')](util[_0xc595('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2caa62['uniqueid'],_0x2caa62[_0xc595('0x11')],_0x2caa62[_0xc595('0x14')],_0x2caa62['channel']));recordings[_0x2caa62[_0xc595('0x11')]]['accountcode']=_0x2caa62['accountcode'];}}catch(_0x18956c){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x1d'),_0x2caa62[_0xc595('0x5')]),_0x18956c);}};exports[_0xc595('0x1e')]=function(_0x58dfff){try{if(!_[_0xc595('0x19')](_0x58dfff[_0xc595('0x1f')])&&!_['isNil'](_0x58dfff['variable'][_0xc595('0x20')])){utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x21'),_0x58dfff['uniqueid']),_0x58dfff);utils[_0xc595('0x12')](util[_0xc595('0xf')](_0xc595('0x22'),_0x58dfff['uniqueid'],_0x58dfff[_0xc595('0x1f')],_0x58dfff[_0xc595('0x23')]));if(_[_0xc595('0x24')](_0x58dfff[_0xc595('0x23')],_0xc595('0x25'))){_0x58dfff[_0xc595('0x23')]=_0x58dfff[_0xc595('0x23')][_0xc595('0x26')]('.wav49',_0xc595('0x27'));}if(recordings[_0x58dfff[_0xc595('0x11')]]){var _0x32ae7b=_[_0xc595('0x28')](recordings[_0x58dfff[_0xc595('0x11')]][_0xc595('0x29')],{'value':_0x58dfff[_0xc595('0x23')]});if(_[_0xc595('0x19')](_0x32ae7b)){recordings[_0x58dfff['linkedid']][_0xc595('0x29')][_0xc595('0x2a')]({'value':_0x58dfff['value']});}}}}catch(_0x40a533){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x21'),_0x58dfff[_0xc595('0x5')]),_0x40a533);}};exports['hangup']=function(_0x253462){try{if(!_[_0xc595('0x19')](recordings[_0x253462[_0xc595('0x5')]])){utils['debug'](util[_0xc595('0xf')](_0xc595('0x2b'),_0x253462[_0xc595('0x5')]),_0x253462);utils['info'](util['format'](_0xc595('0x2c'),_0x253462['uniqueid'],_0x253462[_0xc595('0x2d')],_0x253462[_0xc595('0x2e')],_0x253462['cause-txt']));recordings[_0x253462['uniqueid']]['calleridnum']=_0x253462[_0xc595('0x2d')];recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x2e')]=_0x253462[_0xc595('0x2e')];recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x2f')]=_0x253462[_0xc595('0x2f')];recordings[_0x253462[_0xc595('0x5')]]['connectedlinename']=_0x253462['connectedlinename'];if(recordings[_0x253462[_0xc595('0x5')]]['type']=='outbound'&&recordings[_0x253462['uniqueid']]['accountcode']){recordings[_0x253462['uniqueid']]['connectedlinenum']=recordings[_0x253462['uniqueid']][_0xc595('0x30')];recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x31')]='';}recordings[_0x253462[_0xc595('0x5')]][_0xc595('0x29')]['forEach'](function(_0x12115b){var _0x2642f7=_[_0xc595('0x32')](recordings[_0x253462[_0xc595('0x5')]]);_0x2642f7['value']=_0x12115b[_0xc595('0x23')];writeDB(_0x2642f7);});delete recordings[_0x253462[_0xc595('0x5')]];}}catch(_0x10ab93){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x2b'),_0x253462[_0xc595('0x5')]),_0x10ab93);}};exports[_0xc595('0x33')]=function(_0x262e79){try{if(!_['isNil'](recordings[_0x262e79['uniqueid']])){utils['debug'](util[_0xc595('0xf')](_0xc595('0x34'),_0x262e79['uniqueid']),_0x262e79);utils[_0xc595('0x12')](util[_0xc595('0xf')](_0xc595('0x35'),_0x262e79['uniqueid'],_0x262e79['application'],_0x262e79['appdata']));if(_0x262e79[_0xc595('0x36')][_0xc595('0x37')]()==_0xc595('0x38')&&_[_0xc595('0x39')](_0x262e79[_0xc595('0x3a')]['toLowerCase'](),_0xc595('0x3b'))){var _0x25034b=_0x262e79['appdata'][_0xc595('0x3c')]('=');var _0x2106db=_0x25034b[0x0][_0xc595('0x3d')](_0x25034b[0x0][_0xc595('0x3e')]('(')+0x1,_0x25034b[0x0]['lastIndexOf'](')'));var _0x6666ae=_0x25034b[0x1];recordings[_0x262e79[_0xc595('0x5')]][_0x2106db]=_0x6666ae;}}}catch(_0x2fba66){utils[_0xc595('0x17')](util['format'](_0xc595('0x34'),_0x262e79[_0xc595('0x5')]),_0x2fba66);}};exports[_0xc595('0x3f')]=function(_0x770b74){try{if(!_[_0xc595('0x19')](recordings[_0x770b74[_0xc595('0x5')]])){utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x40'),_0x770b74['uniqueid']),_0x770b74);utils[_0xc595('0x12')](util['format'](_0xc595('0x41'),_0x770b74[_0xc595('0x5')],_0x770b74[_0xc595('0x42')]));recordings[_0x770b74[_0xc595('0x5')]]['queue']=_0x770b74[_0xc595('0x42')];}}catch(_0x334aa2){utils['error'](util['format']('[%s][recordings][queuecallerjoin]',_0x770b74[_0xc595('0x5')]),_0x334aa2);}};exports[_0xc595('0x43')]=function(_0x25068c){try{utils[_0xc595('0xe')](util[_0xc595('0xf')](_0xc595('0x44'),_0x25068c['uniqueid']),_0x25068c);utils[_0xc595('0x12')](util['format'](_0xc595('0x45'),_0x25068c[_0xc595('0x5')],_0x25068c['transferercalleridnum'],_0x25068c['transferercalleridname'],_0x25068c['transfereecalleridnum'],_0x25068c[_0xc595('0x46')]));if(recordings[_0x25068c[_0xc595('0x47')]]&&transfers[_0xc595('0xc')][_0x25068c[_0xc595('0x47')]]){transfers[_0xc595('0xc')][_0x25068c[_0xc595('0x47')]]['recording']=!![];}}catch(_0x561b2c){utils[_0xc595('0x17')](util[_0xc595('0xf')](_0xc595('0x44'),_0x25068c[_0xc595('0x5')]),_0x561b2c);}}; \ No newline at end of file +var _0x02f2=['./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util'];(function(_0x58a4ff,_0x20ca34){var _0x2871fa=function(_0x1dbc1f){while(--_0x1dbc1f){_0x58a4ff['push'](_0x58a4ff['shift']());}};_0x2871fa(++_0x20ca34);}(_0x02f2,0x1a8));var _0x202f=function(_0x3a966e,_0x58c164){_0x3a966e=_0x3a966e-0x0;var _0x251334=_0x02f2[_0x3a966e];return _0x251334;};'use strict';var _=require(_0x202f('0x0'));var util=require(_0x202f('0x1'));var utils=require(_0x202f('0x2'));var transfers=require(_0x202f('0x3'));var recordings={};function writeDB(_0x582f0f){var _0x22235c;utils[_0x202f('0x4')](util[_0x202f('0x5')](_0x202f('0x6'),_0x582f0f[_0x202f('0x7')]));if(transfers[_0x202f('0x8')][_0x582f0f[_0x202f('0x7')]]){_0x22235c=_0x582f0f['uniqueid'];_0x582f0f['uniqueid']=transfers['blinds'][_0x582f0f['uniqueid']][_0x202f('0x9')];}if(_0x582f0f['accountcode']){utils[_0x202f('0xa')](_0x582f0f[_0x202f('0xb')])[_0x202f('0xc')](function(_0xb0c4ed){if(_0xb0c4ed){_0x582f0f[_0x202f('0xd')]=_0xb0c4ed[_0x202f('0xe')];_0x582f0f[_0x202f('0xf')]=_0xb0c4ed['id'];}utils[_0x202f('0x10')](_0x202f('0x11'),_0x582f0f);});}else{utils[_0x202f('0x10')](_0x202f('0x11'),_0x582f0f);}if(_0x22235c)delete transfers[_0x202f('0x8')][_0x22235c];}exports[_0x202f('0x12')]=function(_0x4e3dc5){try{utils[_0x202f('0x13')](util[_0x202f('0x5')]('[%s][recordings][newchannel]',_0x4e3dc5['uniqueid']),_0x4e3dc5);if(_0x4e3dc5['uniqueid']==_0x4e3dc5['linkedid']){utils['info'](util[_0x202f('0x5')](_0x202f('0x14'),_0x4e3dc5['uniqueid'],_0x4e3dc5[_0x202f('0x15')],_0x4e3dc5[_0x202f('0x16')]));recordings[_0x4e3dc5['uniqueid']]={'uniqueid':_0x4e3dc5['uniqueid'],'accountcode':_0x4e3dc5[_0x202f('0xb')],'exten':_0x4e3dc5['exten'],'context':_0x4e3dc5['context'],'channel':_0x4e3dc5[_0x202f('0x17')],'monitors':[]};}}catch(_0x54b701){utils[_0x202f('0x18')](util[_0x202f('0x5')](_0x202f('0x19'),_0x4e3dc5[_0x202f('0x7')]),_0x54b701);}};exports['newstate']=function(_0x4cefda){try{utils[_0x202f('0x13')](util[_0x202f('0x5')](_0x202f('0x1a'),_0x4cefda[_0x202f('0x7')]),_0x4cefda);if(!_[_0x202f('0x1b')](recordings[_0x4cefda[_0x202f('0x7')]])&&_0x4cefda[_0x202f('0x1c')]==0x6){utils[_0x202f('0x4')](util['format'](_0x202f('0x1d'),_0x4cefda[_0x202f('0x7')],_0x4cefda['context'],_0x4cefda[_0x202f('0x17')]));}else if(!_['isNil'](recordings[_0x4cefda['linkedid']])&&_0x4cefda[_0x202f('0x1c')]==0x6&&_0x4cefda['context']!=_0x202f('0x1e')){utils['info'](util[_0x202f('0x5')](_0x202f('0x1f'),_0x4cefda['uniqueid'],_0x4cefda[_0x202f('0x20')],_0x4cefda[_0x202f('0x15')],_0x4cefda[_0x202f('0x17')]));recordings[_0x4cefda[_0x202f('0x20')]]['accountcode']=_0x4cefda[_0x202f('0xb')];}}catch(_0x5c3809){utils['error'](util['format'](_0x202f('0x1a'),_0x4cefda[_0x202f('0x7')]),_0x5c3809);}};exports['varset']=function(_0x15b1e4){try{if(!_['isNil'](_0x15b1e4[_0x202f('0x21')])&&!_[_0x202f('0x1b')](_0x15b1e4[_0x202f('0x21')]['mixmonitor_filename'])){utils[_0x202f('0x13')](util[_0x202f('0x5')](_0x202f('0x22'),_0x15b1e4[_0x202f('0x7')]),_0x15b1e4);utils[_0x202f('0x4')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x15b1e4['uniqueid'],_0x15b1e4[_0x202f('0x21')],_0x15b1e4[_0x202f('0x23')]));if(_[_0x202f('0x24')](_0x15b1e4[_0x202f('0x23')],_0x202f('0x25'))){_0x15b1e4[_0x202f('0x23')]=_0x15b1e4['value'][_0x202f('0x26')](_0x202f('0x25'),_0x202f('0x27'));}if(recordings[_0x15b1e4['linkedid']]){var _0x4d0c19=_['find'](recordings[_0x15b1e4['linkedid']]['monitors'],{'value':_0x15b1e4[_0x202f('0x23')]});if(_[_0x202f('0x1b')](_0x4d0c19)){recordings[_0x15b1e4[_0x202f('0x20')]][_0x202f('0x28')][_0x202f('0x29')]({'value':_0x15b1e4['value']});}}}}catch(_0x468389){utils[_0x202f('0x18')](util[_0x202f('0x5')](_0x202f('0x22'),_0x15b1e4[_0x202f('0x7')]),_0x468389);}};exports[_0x202f('0x2a')]=function(_0x1e09b1){try{if(!_[_0x202f('0x1b')](recordings[_0x1e09b1[_0x202f('0x7')]])){utils[_0x202f('0x13')](util[_0x202f('0x5')](_0x202f('0x2b'),_0x1e09b1[_0x202f('0x7')]),_0x1e09b1);utils[_0x202f('0x4')](util[_0x202f('0x5')](_0x202f('0x2c'),_0x1e09b1[_0x202f('0x7')],_0x1e09b1[_0x202f('0x2d')],_0x1e09b1[_0x202f('0x2e')],_0x1e09b1['cause-txt']));recordings[_0x1e09b1[_0x202f('0x7')]]['calleridnum']=_0x1e09b1[_0x202f('0x2d')];recordings[_0x1e09b1[_0x202f('0x7')]]['calleridname']=_0x1e09b1['calleridname'];recordings[_0x1e09b1[_0x202f('0x7')]][_0x202f('0x2f')]=_0x1e09b1[_0x202f('0x2f')];recordings[_0x1e09b1['uniqueid']][_0x202f('0x30')]=_0x1e09b1['connectedlinename'];if(recordings[_0x1e09b1['uniqueid']]['type']==_0x202f('0x31')&&recordings[_0x1e09b1[_0x202f('0x7')]][_0x202f('0xb')]){recordings[_0x1e09b1['uniqueid']]['connectedlinenum']=recordings[_0x1e09b1['uniqueid']][_0x202f('0xb')];recordings[_0x1e09b1['uniqueid']]['connectedlinename']='';}recordings[_0x1e09b1[_0x202f('0x7')]][_0x202f('0x28')][_0x202f('0x32')](function(_0x5a2276){var _0x48b3f6=_[_0x202f('0x33')](recordings[_0x1e09b1[_0x202f('0x7')]]);_0x48b3f6[_0x202f('0x23')]=_0x5a2276[_0x202f('0x23')];writeDB(_0x48b3f6);});delete recordings[_0x1e09b1[_0x202f('0x7')]];}}catch(_0x548a46){utils[_0x202f('0x18')](util['format'](_0x202f('0x2b'),_0x1e09b1['uniqueid']),_0x548a46);}};exports['newexten']=function(_0x5c22a4){try{if(!_[_0x202f('0x1b')](recordings[_0x5c22a4[_0x202f('0x7')]])){utils['debug'](util[_0x202f('0x5')]('[%s][recordings][newexten]',_0x5c22a4[_0x202f('0x7')]),_0x5c22a4);utils[_0x202f('0x4')](util[_0x202f('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5c22a4[_0x202f('0x7')],_0x5c22a4[_0x202f('0x34')],_0x5c22a4['appdata']));if(_0x5c22a4[_0x202f('0x34')][_0x202f('0x35')]()==_0x202f('0x36')&&_[_0x202f('0x37')](_0x5c22a4[_0x202f('0x38')][_0x202f('0x35')](),_0x202f('0x39'))){var _0x57e7f8=_0x5c22a4[_0x202f('0x38')][_0x202f('0x3a')]('=');var _0x5878d0=_0x57e7f8[0x0][_0x202f('0x3b')](_0x57e7f8[0x0]['lastIndexOf']('(')+0x1,_0x57e7f8[0x0]['lastIndexOf'](')'));var _0x1b3fd4=_0x57e7f8[0x1];recordings[_0x5c22a4[_0x202f('0x7')]][_0x5878d0]=_0x1b3fd4;}}}catch(_0x11a950){utils['error'](util[_0x202f('0x5')](_0x202f('0x3c'),_0x5c22a4['uniqueid']),_0x11a950);}};exports[_0x202f('0x3d')]=function(_0x3636b5){try{if(!_['isNil'](recordings[_0x3636b5['uniqueid']])){utils['debug'](util[_0x202f('0x5')](_0x202f('0x3e'),_0x3636b5[_0x202f('0x7')]),_0x3636b5);utils[_0x202f('0x4')](util[_0x202f('0x5')](_0x202f('0x3f'),_0x3636b5[_0x202f('0x7')],_0x3636b5[_0x202f('0x40')]));recordings[_0x3636b5[_0x202f('0x7')]]['queue']=_0x3636b5[_0x202f('0x40')];}}catch(_0x579c23){utils[_0x202f('0x18')](util[_0x202f('0x5')](_0x202f('0x3e'),_0x3636b5[_0x202f('0x7')]),_0x579c23);}};exports['blindtransfer']=function(_0xfc3e2b){try{utils[_0x202f('0x13')](util[_0x202f('0x5')](_0x202f('0x41'),_0xfc3e2b['uniqueid']),_0xfc3e2b);utils['info'](util[_0x202f('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xfc3e2b[_0x202f('0x7')],_0xfc3e2b[_0x202f('0x42')],_0xfc3e2b[_0x202f('0x43')],_0xfc3e2b[_0x202f('0x44')],_0xfc3e2b['transfereecalleridname']));if(recordings[_0xfc3e2b[_0x202f('0x45')]]&&transfers[_0x202f('0x8')][_0xfc3e2b[_0x202f('0x45')]]){transfers[_0x202f('0x8')][_0xfc3e2b['transfereruniqueid']][_0x202f('0x46')]=!![];}}catch(_0x40b1a8){utils['error'](util['format']('[%s][recordings][blindtransfer]',_0xfc3e2b['uniqueid']),_0x40b1a8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 76eadf0..f568232 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 _0x2276=['lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error'];(function(_0x58217c,_0x2aea63){var _0x4de8d6=function(_0x578024){while(--_0x578024){_0x58217c['push'](_0x58217c['shift']());}};_0x4de8d6(++_0x2aea63);}(_0x2276,0x1c3));var _0x6227=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x2276[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0x6227('0x0'));var util=require(_0x6227('0x1'));var utils=require(_0x6227('0x2'));function writeDB(_0x2d0b03){utils[_0x6227('0x3')](util[_0x6227('0x4')](_0x6227('0x5'),_0x2d0b03[_0x6227('0x6')]===_0x6227('0x7')?_0x2d0b03[_0x6227('0x8')]:_0x2d0b03[_0x6227('0x9')],_0x2d0b03[_0x6227('0x6')]));utils[_0x6227('0xa')](_0x6227('0xb'),_0x2d0b03);}exports['blinds']={};exports[_0x6227('0xc')]=function(_0xf1809b){try{utils[_0x6227('0xd')](util[_0x6227('0x4')](_0x6227('0xe'),_0xf1809b[_0x6227('0x9')]),_0xf1809b);utils[_0x6227('0x3')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xf1809b[_0x6227('0x9')],_0xf1809b[_0x6227('0xf')],_0xf1809b[_0x6227('0x10')],_0xf1809b['transfereecalleridnum'],_0xf1809b[_0x6227('0x11')]));_0xf1809b[_0x6227('0x6')]='blind';exports['blinds'][_0xf1809b[_0x6227('0x12')]]=_0xf1809b;writeDB(_0xf1809b);}catch(_0x9a88a7){utils['error'](util[_0x6227('0x4')](_0x6227('0xe'),_0xf1809b[_0x6227('0x9')]),_0x9a88a7);}};exports[_0x6227('0x13')]=function(_0x35319a){try{utils[_0x6227('0xd')](util[_0x6227('0x4')](_0x6227('0x14'),_0x35319a[_0x6227('0x8')]),_0x35319a);utils[_0x6227('0x3')](util[_0x6227('0x4')](_0x6227('0x15'),_0x35319a['origtransfereruniqueid'],_0x35319a['origtransferercalleridnum'],_0x35319a['origtransferercalleridname'],_0x35319a['transfertargetcalleridnum'],_0x35319a[_0x6227('0x16')]));_0x35319a=_[_0x6227('0x17')](_0x35319a,{'transfererchannel':_0x35319a[_0x6227('0x18')],'transferercalleridnum':_0x35319a[_0x6227('0x19')],'transferercalleridname':_0x35319a['origtransferercalleridname'],'transfererconnectedlinenum':_0x35319a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x35319a[_0x6227('0x1a')],'transfereraccountcode':_0x35319a['origtransfereraccountcode'],'transferercontext':_0x35319a[_0x6227('0x1b')],'transfererexten':_0x35319a[_0x6227('0x1c')],'transfererlinkedid':_0x35319a[_0x6227('0x1d')],'context':_0x35319a[_0x6227('0x1e')],'extension':_0x35319a[_0x6227('0x1f')],'type':_0x6227('0x7')});if(_[_0x6227('0x20')](_0x35319a[_0x6227('0x21')])){_0x35319a=_[_0x6227('0x17')](_0x35319a,{'transfereechannel':_0x35319a['transfertargetchannel'],'transfereecalleridnum':_0x35319a[_0x6227('0x22')],'transfereecalleridname':_0x35319a[_0x6227('0x16')],'transfereeconnectedlinenum':_0x35319a[_0x6227('0x23')],'transfereeconnectedlinename':_0x35319a[_0x6227('0x24')],'transfereeaccountcode':_0x35319a['transfertargetaccountcode'],'transfereecontext':_0x35319a[_0x6227('0x25')],'transfereeexten':_0x35319a[_0x6227('0x26')],'transfereelinkedid':_0x35319a[_0x6227('0x27')]});}writeDB(_0x35319a);}catch(_0xc0f44d){utils[_0x6227('0x28')](util['format'](_0x6227('0x14'),_0x35319a['origtransfereruniqueid']),_0xc0f44d);}}; \ No newline at end of file +var _0xb766=['request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','error','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid'];(function(_0x359536,_0x40e2c8){var _0x372ce4=function(_0x727739){while(--_0x727739){_0x359536['push'](_0x359536['shift']());}};_0x372ce4(++_0x40e2c8);}(_0xb766,0xe1));var _0x6b76=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0xb766[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0x6b76('0x0'));var util=require('util');var utils=require(_0x6b76('0x1'));function writeDB(_0x40f3f0){utils[_0x6b76('0x2')](util[_0x6b76('0x3')](_0x6b76('0x4'),_0x40f3f0[_0x6b76('0x5')]===_0x6b76('0x6')?_0x40f3f0[_0x6b76('0x7')]:_0x40f3f0[_0x6b76('0x8')],_0x40f3f0['type']));utils[_0x6b76('0x9')](_0x6b76('0xa'),_0x40f3f0);}exports[_0x6b76('0xb')]={};exports[_0x6b76('0xc')]=function(_0x2f82a9){try{utils[_0x6b76('0xd')](util['format'](_0x6b76('0xe'),_0x2f82a9['uniqueid']),_0x2f82a9);utils[_0x6b76('0x2')](util[_0x6b76('0x3')](_0x6b76('0xf'),_0x2f82a9['uniqueid'],_0x2f82a9['transferercalleridnum'],_0x2f82a9['transferercalleridname'],_0x2f82a9['transfereecalleridnum'],_0x2f82a9[_0x6b76('0x10')]));_0x2f82a9[_0x6b76('0x5')]=_0x6b76('0x11');exports[_0x6b76('0xb')][_0x2f82a9[_0x6b76('0x12')]]=_0x2f82a9;writeDB(_0x2f82a9);}catch(_0x18a049){utils['error'](util[_0x6b76('0x3')](_0x6b76('0xe'),_0x2f82a9[_0x6b76('0x8')]),_0x18a049);}};exports['attendedtransfer']=function(_0x5517a8){try{utils[_0x6b76('0xd')](util[_0x6b76('0x3')]('[%s][transfers][attendedtransfer]',_0x5517a8['origtransfereruniqueid']),_0x5517a8);utils[_0x6b76('0x2')](util['format'](_0x6b76('0x13'),_0x5517a8[_0x6b76('0x7')],_0x5517a8['origtransferercalleridnum'],_0x5517a8[_0x6b76('0x14')],_0x5517a8[_0x6b76('0x15')],_0x5517a8[_0x6b76('0x16')]));_0x5517a8=_[_0x6b76('0x17')](_0x5517a8,{'transfererchannel':_0x5517a8['origtransfererchannel'],'transferercalleridnum':_0x5517a8[_0x6b76('0x18')],'transferercalleridname':_0x5517a8[_0x6b76('0x14')],'transfererconnectedlinenum':_0x5517a8[_0x6b76('0x19')],'transfererconnectedlinename':_0x5517a8['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5517a8[_0x6b76('0x1a')],'transferercontext':_0x5517a8[_0x6b76('0x1b')],'transfererexten':_0x5517a8[_0x6b76('0x1c')],'transfererlinkedid':_0x5517a8[_0x6b76('0x1d')],'context':_0x5517a8[_0x6b76('0x1e')],'extension':_0x5517a8[_0x6b76('0x1f')],'type':_0x6b76('0x6')});if(_[_0x6b76('0x20')](_0x5517a8['transfereechannel'])){_0x5517a8=_[_0x6b76('0x17')](_0x5517a8,{'transfereechannel':_0x5517a8['transfertargetchannel'],'transfereecalleridnum':_0x5517a8['transfertargetcalleridnum'],'transfereecalleridname':_0x5517a8[_0x6b76('0x16')],'transfereeconnectedlinenum':_0x5517a8[_0x6b76('0x21')],'transfereeconnectedlinename':_0x5517a8[_0x6b76('0x22')],'transfereeaccountcode':_0x5517a8[_0x6b76('0x23')],'transfereecontext':_0x5517a8['transfertargetcontext'],'transfereeexten':_0x5517a8[_0x6b76('0x24')],'transfereelinkedid':_0x5517a8['transfertargetlinkedid']});}writeDB(_0x5517a8);}catch(_0xfb036c){utils[_0x6b76('0x25')](util['format'](_0x6b76('0x26'),_0x5517a8['origtransfereruniqueid']),_0xfb036c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f23e621..e803d91 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 _0x3116=['diffTime','diff','seconds','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract'];(function(_0x3f28be,_0x53cd8f){var _0x1f890b=function(_0x2e3bd8){while(--_0x2e3bd8){_0x3f28be['push'](_0x3f28be['shift']());}};_0x1f890b(++_0x53cd8f);}(_0x3116,0x17e));var _0x6311=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x3116[_0x4fc9e6];return _0x551d28;};'use strict';var BPromise=require(_0x6311('0x0'));var jayson=require(_0x6311('0x1'));var moment=require(_0x6311('0x2'));var util=require(_0x6311('0x3'));var client=jayson[_0x6311('0x4')][_0x6311('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0x6311('0x6'));exports[_0x6311('0x7')]=function(_0x343c28,_0x17ef65){logger['info'](_0x343c28,_0x17ef65?util[_0x6311('0x8')](_0x17ef65,{'showHidden':![],'depth':null}):'');};exports[_0x6311('0x9')]=function(_0x68dd4,_0xb84543){logger[_0x6311('0x9')](_0x68dd4,_0xb84543?util[_0x6311('0x8')](_0xb84543,{'showHidden':![],'depth':null}):'');};exports[_0x6311('0xa')]=function(_0x2c608a,_0x1bbb9a){logger[_0x6311('0xa')](_0x2c608a,_0x1bbb9a?util['inspect'](_0x1bbb9a,{'showHidden':![],'depth':null}):'');};exports[_0x6311('0xb')]=function(_0x26b08f,_0x18567d){return client[_0x6311('0xb')](_0x26b08f,{'body':_0x18567d})['then'](function(_0x4ebbd4){logger[_0x6311('0x9')]('[utils][request]\x20name:%s',_0x26b08f,_0x4ebbd4?util[_0x6311('0x8')](_0x4ebbd4,{'showHidden':![],'depth':null}):'');})[_0x6311('0xc')](function(_0x17da35){logger[_0x6311('0xa')](_0x6311('0xd'),_0x26b08f,_0x17da35?util['inspect'](_0x17da35,{'showHidden':![],'depth':null}):'');});};function getUser(_0x18b67c){return client[_0x6311('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x6311('0xe'),'name',_0x6311('0xf')],'where':_0x18b67c,'limit':0x1}})[_0x6311('0x10')](function(_0xadfb75){logger['debug'](_0x6311('0x11'),JSON[_0x6311('0x12')](_0x18b67c),_0xadfb75?util[_0x6311('0x8')](_0xadfb75,{'showHidden':![],'depth':null}):'');return _0xadfb75[_0x6311('0x13')][_0x6311('0x14')]?_0xadfb75['result'][0x0]:null;});}exports[_0x6311('0x15')]=function(_0x12fd31){return new BPromise(function(_0x195800,_0x5288ac){if(_0x12fd31){return getUser({'internal':_0x12fd31})[_0x6311('0x10')](function(_0x4adf8f){logger['info'](_0x6311('0x16'),_0x12fd31,_0x4adf8f?_0x6311('0x17'):_0x6311('0x18'));return _0x195800(_0x4adf8f);})[_0x6311('0xc')](function(_0x2088a3){logger[_0x6311('0xa')](_0x6311('0x19'),_0x2088a3?util[_0x6311('0x8')](_0x2088a3,{'showHidden':![],'depth':null}):'');return _0x195800(null);});}return _0x195800(null);});};exports[_0x6311('0x1a')]=function(_0x4e085a){return new BPromise(function(_0x301c4a,_0x3c5e92){if(_0x4e085a){return getUser({'interface':_0x4e085a})[_0x6311('0x10')](function(_0x754561){logger[_0x6311('0x7')](_0x6311('0x1b'),_0x4e085a,_0x754561?_0x6311('0x17'):'notfound');return _0x301c4a(_0x754561);})[_0x6311('0xc')](function(_0x1f80f7){logger[_0x6311('0xa')]('[utils][getUserByInterface]',_0x1f80f7?util[_0x6311('0x8')](_0x1f80f7,{'showHidden':![],'depth':null}):'');return _0x301c4a(null);});}return _0x301c4a(null);});};exports[_0x6311('0x1c')]=function(_0xe9951){return new BPromise(function(_0x4c0a5d,_0x2015ee){if(_0xe9951){return getUser({'name':_0xe9951})[_0x6311('0x10')](function(_0x571991){logger[_0x6311('0x7')](_0x6311('0x1d'),_0xe9951,_0x571991?_0x6311('0x17'):_0x6311('0x18'));return _0x4c0a5d(_0x571991);})[_0x6311('0xc')](function(_0x42bc03){logger[_0x6311('0xa')]('[utils][getUserByName]',_0x42bc03?util[_0x6311('0x8')](_0x42bc03,{'showHidden':![],'depth':null}):'');return _0x4c0a5d(null);});}return _0x4c0a5d(null);});};exports[_0x6311('0x1e')]=function(_0x5da083){return new BPromise(function(_0x1fdf0a,_0x5b0dbe){if(_0x5da083){return client[_0x6311('0xb')](_0x6311('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x6311('0x20'),'type',_0x6311('0x21'),_0x6311('0x22')],'where':{'name':_0x5da083},'limit':0x1}})[_0x6311('0x10')](function(_0x17fdbf){logger[_0x6311('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5da083,_0x17fdbf?util[_0x6311('0x8')](_0x17fdbf,{'showHidden':![],'depth':null}):'');logger[_0x6311('0x7')](_0x6311('0x23'),_0x5da083,_0x17fdbf?_0x6311('0x17'):_0x6311('0x18'));return _0x1fdf0a(_0x17fdbf['result']['length']?_0x17fdbf[_0x6311('0x13')][0x0]:null);})['catch'](function(_0x49d3ba){logger[_0x6311('0xa')]('[utils][getVoiceQueueByName]',_0x49d3ba?util[_0x6311('0x8')](_0x49d3ba,{'showHidden':![],'depth':null}):'');return _0x1fdf0a(null);});}return _0x1fdf0a(null);});};exports['addTime']=function(_0x273938,_0x447291){return moment(_0x273938)[_0x6311('0x24')](_0x447291,'seconds')[_0x6311('0x25')](_0x6311('0x26'));};exports[_0x6311('0x27')]=function(_0x2049ea,_0x16fea8){return moment(_0x2049ea)[_0x6311('0x28')](_0x16fea8,'seconds')[_0x6311('0x25')](_0x6311('0x26'));};exports[_0x6311('0x29')]=function(_0x238d0d,_0x56b3dc){return moment(_0x238d0d)[_0x6311('0x2a')](moment(_0x56b3dc),_0x6311('0x2b'));};exports[_0x6311('0x2c')]=function(_0x29e08f,_0x193a10){return parseInt(_0x29e08f,0xa)+parseInt(_0x193a10,0xa);};exports['now']=function(){return moment()[_0x6311('0x25')](_0x6311('0x26'));};exports[_0x6311('0x2d')]=function(_0xb52e6d,_0xb92e9a){if(_0xb92e9a){return moment(_0xb52e6d)[_0x6311('0x2d')](_0xb92e9a);}return!![];};exports['isBefore']=function(_0x18ebee,_0x11a423){if(_0x11a423){return moment(_0x18ebee)[_0x6311('0x2e')](_0x11a423);}else if(_0x18ebee){return!![];}return![];}; \ No newline at end of file +var _0xed3e=['interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name'];(function(_0x1eb808,_0x4b7952){var _0x1701f7=function(_0x4b8ef7){while(--_0x4b8ef7){_0x1eb808['push'](_0x1eb808['shift']());}};_0x1701f7(++_0x4b7952);}(_0xed3e,0x101));var _0xeed3=function(_0x2fa60a,_0x17a913){_0x2fa60a=_0x2fa60a-0x0;var _0xbf352=_0xed3e[_0x2fa60a];return _0xbf352;};'use strict';var BPromise=require(_0xeed3('0x0'));var jayson=require(_0xeed3('0x1'));var moment=require('moment');var util=require('util');var client=jayson['client'][_0xeed3('0x2')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xeed3('0x3')]=function(_0x25564c,_0x254f35){logger[_0xeed3('0x3')](_0x25564c,_0x254f35?util[_0xeed3('0x4')](_0x254f35,{'showHidden':![],'depth':null}):'');};exports[_0xeed3('0x5')]=function(_0x1f81e6,_0x1be1f5){logger[_0xeed3('0x5')](_0x1f81e6,_0x1be1f5?util[_0xeed3('0x4')](_0x1be1f5,{'showHidden':![],'depth':null}):'');};exports[_0xeed3('0x6')]=function(_0x168084,_0xa2ba33){logger[_0xeed3('0x6')](_0x168084,_0xa2ba33?util[_0xeed3('0x4')](_0xa2ba33,{'showHidden':![],'depth':null}):'');};exports[_0xeed3('0x7')]=function(_0x5b80bd,_0x1d66d4){return client[_0xeed3('0x7')](_0x5b80bd,{'body':_0x1d66d4})[_0xeed3('0x8')](function(_0x3a487b){logger[_0xeed3('0x5')]('[utils][request]\x20name:%s',_0x5b80bd,_0x3a487b?util[_0xeed3('0x4')](_0x3a487b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3ad521){logger[_0xeed3('0x6')](_0xeed3('0x9'),_0x5b80bd,_0x3ad521?util[_0xeed3('0x4')](_0x3ad521,{'showHidden':![],'depth':null}):'');});};function getUser(_0x68770c){return client[_0xeed3('0x7')](_0xeed3('0xa'),{'options':{'raw':!![],'attributes':['id',_0xeed3('0xb'),_0xeed3('0xc'),_0xeed3('0xd')],'where':_0x68770c,'limit':0x1}})[_0xeed3('0x8')](function(_0x4c7da3){logger[_0xeed3('0x5')](_0xeed3('0xe'),JSON[_0xeed3('0xf')](_0x68770c),_0x4c7da3?util['inspect'](_0x4c7da3,{'showHidden':![],'depth':null}):'');return _0x4c7da3['result'][_0xeed3('0x10')]?_0x4c7da3[_0xeed3('0x11')][0x0]:null;});}exports[_0xeed3('0x12')]=function(_0x2253a9){return new BPromise(function(_0x4753db,_0x3dd42b){if(_0x2253a9){return getUser({'internal':_0x2253a9})[_0xeed3('0x8')](function(_0x401c11){logger[_0xeed3('0x3')](_0xeed3('0x13'),_0x2253a9,_0x401c11?_0xeed3('0x14'):_0xeed3('0x15'));return _0x4753db(_0x401c11);})[_0xeed3('0x16')](function(_0x15b707){logger[_0xeed3('0x6')](_0xeed3('0x17'),_0x15b707?util[_0xeed3('0x4')](_0x15b707,{'showHidden':![],'depth':null}):'');return _0x4753db(null);});}return _0x4753db(null);});};exports[_0xeed3('0x18')]=function(_0x2937b0){return new BPromise(function(_0x3c7493,_0x27d31a){if(_0x2937b0){return getUser({'interface':_0x2937b0})['then'](function(_0x4202c1){logger['info'](_0xeed3('0x19'),_0x2937b0,_0x4202c1?'found':_0xeed3('0x15'));return _0x3c7493(_0x4202c1);})[_0xeed3('0x16')](function(_0x2c01d1){logger[_0xeed3('0x6')](_0xeed3('0x1a'),_0x2c01d1?util['inspect'](_0x2c01d1,{'showHidden':![],'depth':null}):'');return _0x3c7493(null);});}return _0x3c7493(null);});};exports['getUserByName']=function(_0x527d96){return new BPromise(function(_0x120298,_0x4d0074){if(_0x527d96){return getUser({'name':_0x527d96})[_0xeed3('0x8')](function(_0x2bad30){logger['info'](_0xeed3('0x1b'),_0x527d96,_0x2bad30?_0xeed3('0x14'):_0xeed3('0x15'));return _0x120298(_0x2bad30);})[_0xeed3('0x16')](function(_0x4299a9){logger['error'](_0xeed3('0x1c'),_0x4299a9?util['inspect'](_0x4299a9,{'showHidden':![],'depth':null}):'');return _0x120298(null);});}return _0x120298(null);});};exports['getVoiceQueueByName']=function(_0x2c855d){return new BPromise(function(_0xb737aa,_0x383254){if(_0x2c855d){return client[_0xeed3('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xeed3('0xc'),_0xeed3('0x1d'),_0xeed3('0x1e'),_0xeed3('0x1f')],'where':{'name':_0x2c855d},'limit':0x1}})[_0xeed3('0x8')](function(_0x13e9b0){logger[_0xeed3('0x5')](_0xeed3('0x20'),_0x2c855d,_0x13e9b0?util[_0xeed3('0x4')](_0x13e9b0,{'showHidden':![],'depth':null}):'');logger[_0xeed3('0x3')](_0xeed3('0x21'),_0x2c855d,_0x13e9b0?_0xeed3('0x14'):_0xeed3('0x15'));return _0xb737aa(_0x13e9b0[_0xeed3('0x11')][_0xeed3('0x10')]?_0x13e9b0[_0xeed3('0x11')][0x0]:null);})['catch'](function(_0x309b78){logger[_0xeed3('0x6')]('[utils][getVoiceQueueByName]',_0x309b78?util['inspect'](_0x309b78,{'showHidden':![],'depth':null}):'');return _0xb737aa(null);});}return _0xb737aa(null);});};exports[_0xeed3('0x22')]=function(_0x37be25,_0x504fb4){return moment(_0x37be25)[_0xeed3('0x23')](_0x504fb4,_0xeed3('0x24'))[_0xeed3('0x25')](_0xeed3('0x26'));};exports['subtractTime']=function(_0x59922c,_0x22dc8e){return moment(_0x59922c)[_0xeed3('0x27')](_0x22dc8e,_0xeed3('0x24'))['format'](_0xeed3('0x26'));};exports['diffTime']=function(_0x35d83e,_0x2580a6){return moment(_0x35d83e)[_0xeed3('0x28')](moment(_0x2580a6),_0xeed3('0x24'));};exports[_0xeed3('0x29')]=function(_0x53c84c,_0x45fb8d){return parseInt(_0x53c84c,0xa)+parseInt(_0x45fb8d,0xa);};exports[_0xeed3('0x2a')]=function(){return moment()[_0xeed3('0x25')](_0xeed3('0x26'));};exports[_0xeed3('0x2b')]=function(_0x2f5ee3,_0x28ecec){if(_0x28ecec){return moment(_0x2f5ee3)[_0xeed3('0x2b')](_0x28ecec);}return!![];};exports[_0xeed3('0x2c')]=function(_0x56a299,_0x3ec9f6){if(_0x3ec9f6){return moment(_0x56a299)[_0xeed3('0x2c')](_0x3ec9f6);}else if(_0x56a299){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 7b6442b..9a7c7d8 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 _0x1e60=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_name','test','fs-extra','lodash','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','xcally','client','role','name','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','device'];(function(_0x15f476,_0x399e5e){var _0x383f45=function(_0x9d06d8){while(--_0x9d06d8){_0x15f476['push'](_0x15f476['shift']());}};_0x383f45(++_0x399e5e);}(_0x1e60,0x1ea));var _0x01e6=function(_0x1980e7,_0x24ef67){_0x1980e7=_0x1980e7-0x0;var _0xb8b59a=_0x1e60[_0x1980e7];return _0xb8b59a;};var fs=require(_0x01e6('0x0'));var _=require(_0x01e6('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require(_0x01e6('0x2'));var fileLogger=require(_0x01e6('0x3'))[_0x01e6('0x4')];var safeTemplate=require(_0x01e6('0x5'))[_0x01e6('0x6')];var maskSensitiveData=require(_0x01e6('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x2a90b9(_0x57343b){var _0x4a1357=path[_0x01e6('0x8')]('/var','log',_0x01e6('0x9'));var _0x3b929a=path[_0x01e6('0x8')](_0x01e6('0xa'),_0x57343b[_0x01e6('0xb')]+'-'+_0x57343b[_0x01e6('0xc')]);return fs['ensureDir'](path['join'](_0x4a1357,_0x3b929a))[_0x01e6('0xd')](function(){var _0x212f80=fileLogger('client',path[_0x01e6('0x8')](_0x4a1357,_0x3b929a));return _0x212f80;})[_0x01e6('0xe')](function(_0x4bef75){throw _0x4bef75;});}this['log']=function(_0x497077,_0x375ef9,_0x6bc0c7,_0x44969a){return _0x2a90b9(_0x497077['user'])[_0x01e6('0xd')](function(_0x26f4cf){var _0x14d9b3=_0x26f4cf[_0x375ef9];return _0x14d9b3;})['then'](function(_0x501998){var _0x3729d6=_0x497077[_0x01e6('0xf')]?_0x497077[_0x01e6('0xf')]['id']:'no-user';var _0x162d8a=_0x44969a[_0x01e6('0x10')];var _0x1177da=_0x44969a[_0x01e6('0x11')];var _0x20d5bc=new Date(Number(_0x1177da));return _0x501998(_0x3729d6,_0x20d5bc,_0x6bc0c7,_0x162d8a);})['catch'](function(_0x1aecbf){fileLogger(_0x01e6('0xa'))[_0x01e6('0x12')](_0x1aecbf);});};}function setupLoggers(_0x167e25){return new Promise(function(_0xb5fca){var _0x273f33=new ClientSideLogger();var _0x536a93=fileLogger(_0x01e6('0x13'));var _0x3a9ea7=fileLogger(_0x01e6('0x14'));_0x167e25[_0x01e6('0x15')](_0x01e6('0x16'),_0x273f33);_0x167e25[_0x01e6('0x17')](ewinston['logger']({'winstonInstance':_0x536a93,'meta':![],'statusLevels':!![],'msg':function(_0x234267,_0xd23d4e){var _0x5e819c=_0x01e6('0x18');if(!_[_0x01e6('0x19')](_0x234267[_0x01e6('0x1a')])){_0x5e819c+=_0x01e6('0x1b');var _0x275637=_0x234267[_0x01e6('0x1a')];maskSensitiveData(_0x275637);}return safeTemplate(util[_0x01e6('0x1c')](_0x5e819c,_0x234267[_0x01e6('0x1d')],_0x234267[_0x01e6('0x1e')][_0x01e6('0x1f')]?_0x234267[_0x01e6('0x1e')]['x-forwarded-for']:_0x234267[_0x01e6('0x20')][_0x01e6('0x21')]||_0x234267['ip'],_0x234267[_0x01e6('0x22')],_0xd23d4e['statusCode'],_0xd23d4e[_0x01e6('0x23')],_0x234267[_0x01e6('0xf')]?_0x234267['user']['id']:null,_0x234267[_0x01e6('0xf')]?_0x234267['user'][_0x01e6('0xc')]:null,_0x234267[_0x01e6('0xf')]?_0x234267[_0x01e6('0xf')][_0x01e6('0xb')]:null,_0x275637?util[_0x01e6('0x24')](_0x275637,![],null):''));}}));_0x167e25[_0x01e6('0x17')](ewinston['logger']({'winstonInstance':_0x3a9ea7,'meta':![],'statusLevels':!![],'msg':function(_0x2d0042,_0x5ec9fa){var _0x1e1b43='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x25')]&&_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x26')]){_0x1e1b43=_0x01e6('0x27');}return util[_0x01e6('0x1c')](_0x1e1b43,_0x2d0042['method'],_0x2d0042[_0x01e6('0x1e')]['x-forwarded-for']?_0x2d0042['headers'][_0x01e6('0x1f')]:_0x2d0042[_0x01e6('0x20')]['remoteAddress']||_0x2d0042['ip'],_0x2d0042['url'],_0x5ec9fa[_0x01e6('0x28')],_0x5ec9fa[_0x01e6('0x23')],_0x2d0042[_0x01e6('0xf')]?_0x2d0042[_0x01e6('0xf')]['id']:null,_0x2d0042[_0x01e6('0xf')]?_0x2d0042[_0x01e6('0xf')][_0x01e6('0xc')]:null,_0x2d0042[_0x01e6('0xf')]?_0x2d0042['user']['role']:null,_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042['body'][_0x01e6('0x25')]?_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x25')]:_0x01e6('0x29'),_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042['body'][_0x01e6('0x26')]?_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x26')]:'',_0x2d0042[_0x01e6('0x1a')]&&_0x2d0042[_0x01e6('0x1a')][_0x01e6('0x2a')]?_0x2d0042[_0x01e6('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x36e600){var _0x17e1fa=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17e1fa[_0x01e6('0x2b')](_0x36e600[_0x01e6('0x22')]);}}));return _0xb5fca();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x1658=['data','timestamp','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','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)','other','agent_id','agent_name','test','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','log','xcally','client','role','name','ensureDir','then','catch','user','no-user'];(function(_0x105b20,_0x388d13){var _0x357455=function(_0x5b28d7){while(--_0x5b28d7){_0x105b20['push'](_0x105b20['shift']());}};_0x357455(++_0x388d13);}(_0x1658,0x7c));var _0x8165=function(_0x3b59c2,_0x25a481){_0x3b59c2=_0x3b59c2-0x0;var _0x1831d0=_0x1658[_0x3b59c2];return _0x1831d0;};var fs=require(_0x8165('0x0'));var _=require(_0x8165('0x1'));var ewinston=require(_0x8165('0x2'));var path=require(_0x8165('0x3'));var util=require('util');var fileLogger=require(_0x8165('0x4'))[_0x8165('0x5')];var safeTemplate=require(_0x8165('0x6'))[_0x8165('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0x8165('0x8')];function ClientSideLogger(){function _0xc5d902(_0x8d6d4c){var _0x59fd6f=path[_0x8165('0x9')]('/var',_0x8165('0xa'),_0x8165('0xb'));var _0x44e424=path[_0x8165('0x9')](_0x8165('0xc'),_0x8d6d4c[_0x8165('0xd')]+'-'+_0x8d6d4c[_0x8165('0xe')]);return fs[_0x8165('0xf')](path[_0x8165('0x9')](_0x59fd6f,_0x44e424))[_0x8165('0x10')](function(){var _0x6430b7=fileLogger('client',path[_0x8165('0x9')](_0x59fd6f,_0x44e424));return _0x6430b7;})[_0x8165('0x11')](function(_0x230a36){throw _0x230a36;});}this[_0x8165('0xa')]=function(_0x4faa53,_0x4c8c97,_0x214225,_0x386a5f){return _0xc5d902(_0x4faa53[_0x8165('0x12')])[_0x8165('0x10')](function(_0x3c1ab7){var _0x1feef3=_0x3c1ab7[_0x4c8c97];return _0x1feef3;})[_0x8165('0x10')](function(_0x17d717){var _0x29d1ab=_0x4faa53[_0x8165('0x12')]?_0x4faa53[_0x8165('0x12')]['id']:_0x8165('0x13');var _0x125015=_0x386a5f[_0x8165('0x14')];var _0x44377a=_0x386a5f[_0x8165('0x15')];var _0x2e6103=new Date(Number(_0x44377a));return _0x17d717(_0x29d1ab,_0x2e6103,_0x214225,_0x125015);})[_0x8165('0x11')](function(_0x278ae7){fileLogger('client')[_0x8165('0x16')](_0x278ae7);});};}function setupLoggers(_0x28313b){return new Promise(function(_0x550dbb){var _0x2a839f=new ClientSideLogger();var _0x1acf10=fileLogger(_0x8165('0x17'));var _0x577be5=fileLogger('auth');_0x28313b[_0x8165('0x18')](_0x8165('0x19'),_0x2a839f);_0x28313b[_0x8165('0x1a')](ewinston[_0x8165('0x1b')]({'winstonInstance':_0x1acf10,'meta':![],'statusLevels':!![],'msg':function(_0x221438,_0x3b4046){var _0x5519c5=_0x8165('0x1c');if(!_['isEmpty'](_0x221438['body'])){_0x5519c5+=_0x8165('0x1d');var _0x26ef72=_0x221438[_0x8165('0x1e')];maskSensitiveData(_0x26ef72);}return safeTemplate(util[_0x8165('0x1f')](_0x5519c5,_0x221438[_0x8165('0x20')],_0x221438[_0x8165('0x21')][_0x8165('0x22')]?_0x221438[_0x8165('0x21')][_0x8165('0x22')]:_0x221438[_0x8165('0x23')][_0x8165('0x24')]||_0x221438['ip'],_0x221438[_0x8165('0x25')],_0x3b4046[_0x8165('0x26')],_0x3b4046[_0x8165('0x27')],_0x221438['user']?_0x221438['user']['id']:null,_0x221438[_0x8165('0x12')]?_0x221438['user']['name']:null,_0x221438[_0x8165('0x12')]?_0x221438[_0x8165('0x12')]['role']:null,_0x26ef72?util[_0x8165('0x28')](_0x26ef72,![],null):''));}}));_0x28313b['use'](ewinston['logger']({'winstonInstance':_0x577be5,'meta':![],'statusLevels':!![],'msg':function(_0x137972,_0xc261af){var _0x276db6=_0x8165('0x29');if(_0x137972['body']&&_0x137972[_0x8165('0x1e')][_0x8165('0x2a')]&&_0x137972['body']['agent_id']){_0x276db6=_0x8165('0x2b');}return util[_0x8165('0x1f')](_0x276db6,_0x137972[_0x8165('0x20')],_0x137972['headers'][_0x8165('0x22')]?_0x137972[_0x8165('0x21')][_0x8165('0x22')]:_0x137972[_0x8165('0x23')][_0x8165('0x24')]||_0x137972['ip'],_0x137972[_0x8165('0x25')],_0xc261af['statusCode'],_0xc261af[_0x8165('0x27')],_0x137972[_0x8165('0x12')]?_0x137972[_0x8165('0x12')]['id']:null,_0x137972[_0x8165('0x12')]?_0x137972['user'][_0x8165('0xe')]:null,_0x137972['user']?_0x137972[_0x8165('0x12')][_0x8165('0xd')]:null,_0x137972[_0x8165('0x1e')]&&_0x137972[_0x8165('0x1e')][_0x8165('0x2a')]?_0x137972[_0x8165('0x1e')][_0x8165('0x2a')]:_0x8165('0x2c'),_0x137972[_0x8165('0x1e')]&&_0x137972[_0x8165('0x1e')]['agent_id']?_0x137972[_0x8165('0x1e')][_0x8165('0x2d')]:'',_0x137972['body']&&_0x137972['body'][_0x8165('0x2e')]?_0x137972[_0x8165('0x1e')][_0x8165('0x2e')]:'');},'ignoreRoute':function(_0x114fcd){var _0xe55478=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xe55478[_0x8165('0x2f')](_0x114fcd['url']);}}));return _0x550dbb();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 99d8078..b28ac7a 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe098=['[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','message','{{{','replace','}}}'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0xe098,0x9f));var _0x8e09=function(_0x19130c,_0x59628d){_0x19130c=_0x19130c-0x0;var _0x48710f=_0xe098[_0x19130c];return _0x48710f;};'use strict';var path=require(_0x8e09('0x0'));var util=require(_0x8e09('0x1'));var moment=require(_0x8e09('0x2'));var winston=require(_0x8e09('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x8e09('0x4')][_0x8e09('0x5')]():_0x8e09('0x6');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':_0x8e09('0x7'),'error':_0x8e09('0x8'),'warn':_0x8e09('0x9'),'info':_0x8e09('0xa'),'print':_0x8e09('0xb'),'success':'bold\x20green','http':'gray','verbose':'bold\x20magenta','debug':_0x8e09('0xc'),'silly':_0x8e09('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1d4615,_0x577cb5,_0x26998c){var _0x2f269a=_0x1d4615||_0x8e09('0xe');return path[_0x8e09('0xf')](_0x2f269a,util[_0x8e09('0x10')]('%s-%s.log',_0x577cb5,_0x26998c));}function formatter(_0x5e0d50,_0x19042d){_0x19042d[_0x8e09('0x11')]=_0x19042d[_0x8e09('0x11')]['replace'](/@@{/g,_0x8e09('0x12'))[_0x8e09('0x13')](/}@@/g,_0x8e09('0x14'))[_0x8e09('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x8e09('0x15'),moment()[_0x8e09('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x19042d[_0x8e09('0x16')][_0x8e09('0x17')](),_0x5e0d50,_0x19042d[_0x8e09('0x11')]);}function fileFormat(_0x1ea73c,_0x3cdf6e){_0x3cdf6e[_0x8e09('0x11')]=_0x3cdf6e[_0x8e09('0x11')][_0x8e09('0x13')](/@@{/g,_0x8e09('0x12'))[_0x8e09('0x13')](/}@@/g,_0x8e09('0x14'))[_0x8e09('0x13')](/@{/g,'{{')[_0x8e09('0x13')](/}@/g,'}}');var _0x3ee53c=_0x3cdf6e[_0x8e09('0x18')]&&Object[_0x8e09('0x19')](_0x3cdf6e[_0x8e09('0x18')])['length']?'\x0a\x09'+JSON[_0x8e09('0x1a')](_0x3cdf6e[_0x8e09('0x18')]):'';return util[_0x8e09('0x10')](_0x8e09('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x3cdf6e[_0x8e09('0x16')][_0x8e09('0x17')](),_0x1ea73c,_0x3cdf6e[_0x8e09('0x11')],_0x3ee53c);}function consoleLogger(){var _0x2bf63c=new winston[(_0x8e09('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8e09('0x1d'))][(_0x8e09('0x1e'))]({'level':_0x8e09('0x1f'),'json':![],'formatter':function(_0x378489){return formatter('',_0x378489);}})]});return _0x2bf63c;}function fileLogger(_0x5d2468,_0x101b6b){var _0x18a102=new winston[(_0x8e09('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8e09('0x1d'))][(_0x8e09('0x20'))]({'name':util[_0x8e09('0x10')]('%s-%s',_0x5d2468,_0x8e09('0x21')),'filename':getLogFileName(_0x101b6b,_0x5d2468,'error'),'level':_0x8e09('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c73ff){return fileFormat(_0x5d2468,_0x2c73ff);}}),new winston[(_0x8e09('0x1d'))]['File']({'name':util[_0x8e09('0x10')]('%s-%s',_0x5d2468,debugLevel),'filename':getLogFileName(_0x101b6b,_0x5d2468,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc6daff){return fileFormat(_0x5d2468,_0xc6daff);}}),new winston['transports']['Console']({'level':_0x8e09('0x1f'),'json':![],'formatter':function(_0x1e403f){return fileFormat(_0x5d2468,_0x1e403f);}})]});return _0x18a102;}exports[_0x8e09('0x22')]=consoleLogger;exports[_0x8e09('0x23')]=fileLogger; \ No newline at end of file +var _0x734e=['red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','error','File','%s-%s','consoleLogger','fileLogger','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white'];(function(_0x30662f,_0x4d202e){var _0x40d038=function(_0x10bb41){while(--_0x10bb41){_0x30662f['push'](_0x30662f['shift']());}};_0x40d038(++_0x4d202e);}(_0x734e,0x131));var _0xe734=function(_0x2e5249,_0xa4eed1){_0x2e5249=_0x2e5249-0x0;var _0x3f59fc=_0x734e[_0x2e5249];return _0x3f59fc;};'use strict';var path=require('path');var util=require('util');var moment=require(_0xe734('0x0'));var winston=require(_0xe734('0x1'));var config=require(_0xe734('0x2'));var debugLevel=config['debugLevel']?config[_0xe734('0x3')][_0xe734('0x4')]():_0xe734('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':_0xe734('0x6'),'error':_0xe734('0x7'),'warn':_0xe734('0x8'),'info':_0xe734('0x9'),'print':_0xe734('0xa'),'success':_0xe734('0xb'),'http':_0xe734('0xc'),'verbose':_0xe734('0xd'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xe734('0xe')](XC_LOG_COLORS);function getLogFileName(_0x59c63e,_0x564c38,_0x213f9e){var _0x34f4f1=_0x59c63e||_0xe734('0xf');return path[_0xe734('0x10')](_0x34f4f1,util[_0xe734('0x11')](_0xe734('0x12'),_0x564c38,_0x213f9e));}function formatter(_0x3b0bc8,_0x3f04a4){_0x3f04a4[_0xe734('0x13')]=_0x3f04a4[_0xe734('0x13')][_0xe734('0x14')](/@@{/g,_0xe734('0x15'))[_0xe734('0x14')](/}@@/g,_0xe734('0x16'))[_0xe734('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xe734('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xe734('0x11')](_0xe734('0x17')),_0x3f04a4[_0xe734('0x18')][_0xe734('0x19')](),_0x3b0bc8,_0x3f04a4['message']);}function fileFormat(_0x5167db,_0x5958e4){_0x5958e4[_0xe734('0x13')]=_0x5958e4[_0xe734('0x13')][_0xe734('0x14')](/@@{/g,_0xe734('0x15'))[_0xe734('0x14')](/}@@/g,_0xe734('0x16'))[_0xe734('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5b3ed8=_0x5958e4[_0xe734('0x1a')]&&Object['keys'](_0x5958e4[_0xe734('0x1a')])[_0xe734('0x1b')]?'\x0a\x09'+JSON[_0xe734('0x1c')](_0x5958e4[_0xe734('0x1a')]):'';return util[_0xe734('0x11')](_0xe734('0x1d'),moment()['format'](_0xe734('0x17')),_0x5958e4[_0xe734('0x18')][_0xe734('0x19')](),_0x5167db,_0x5958e4[_0xe734('0x13')],_0x5b3ed8);}function consoleLogger(){var _0x51e378=new winston[(_0xe734('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe734('0x1f'))][(_0xe734('0x20'))]({'level':_0xe734('0x21'),'json':![],'formatter':function(_0x2a9699){return formatter('',_0x2a9699);}})]});return _0x51e378;}function fileLogger(_0x3e862d,_0x75365b){var _0x3c2c38=new winston[(_0xe734('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe734('0x1f'))]['File']({'name':util[_0xe734('0x11')]('%s-%s',_0x3e862d,'error'),'filename':getLogFileName(_0x75365b,_0x3e862d,_0xe734('0x22')),'level':_0xe734('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe4aa30){return fileFormat(_0x3e862d,_0xe4aa30);}}),new winston[(_0xe734('0x1f'))][(_0xe734('0x23'))]({'name':util[_0xe734('0x11')](_0xe734('0x24'),_0x3e862d,debugLevel),'filename':getLogFileName(_0x75365b,_0x3e862d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x59ced6){return fileFormat(_0x3e862d,_0x59ced6);}}),new winston[(_0xe734('0x1f'))]['Console']({'level':_0xe734('0x21'),'json':![],'formatter':function(_0x256555){return fileFormat(_0x3e862d,_0x256555);}})]});return _0x3c2c38;}exports[_0xe734('0x25')]=consoleLogger;exports[_0xe734('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index f7134ac..ba11f42 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 _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x4975,0x86));var _0x5497=function(_0x160f09,_0x3d4b43){_0x160f09=_0x160f09-0x0;var _0x1f6e25=_0x4975[_0x160f09];return _0x1f6e25;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x0295,0x1f0));var _0x5029=function(_0x16169b,_0x1fe209){_0x16169b=_0x16169b-0x0;var _0x7a7d78=_0x0295[_0x16169b];return _0x7a7d78;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index c04d91c..95dba0d 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 _0xea28=['isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x5a430d,_0x1a9bd3){var _0x3bb9d6=function(_0x49a9f8){while(--_0x49a9f8){_0x5a430d['push'](_0x5a430d['shift']());}};_0x3bb9d6(++_0x1a9bd3);}(_0xea28,0x13a));var _0x8ea2=function(_0x4b6404,_0x3ef4b0){_0x4b6404=_0x4b6404-0x0;var _0xaa6704=_0xea28[_0x4b6404];return _0xaa6704;};var _=require(_0x8ea2('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2e031a){return _0x2e031a==='{{'?_0x8ea2('0x1'):_0x8ea2('0x2');}function safeTemplate(_0x459c4e){var _0x25e47e=_0x459c4e;if(typeof _0x459c4e===_0x8ea2('0x3')){_0x25e47e=_0x459c4e[_0x8ea2('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x459c4e)){_0x25e47e=_0x459c4e[_0x8ea2('0x5')](function(_0x23aaf1){return safeTemplate(_0x23aaf1);});}else if(_[_0x8ea2('0x6')](_0x459c4e)){_0x25e47e=Object['keys'](_0x459c4e)[_0x8ea2('0x7')](function(_0x435d78,_0xb7f278){_0x435d78[_0xb7f278]=safeTemplate(_0x459c4e[_0xb7f278]);return _0x435d78;},{});}return _0x25e47e;}module[_0x8ea2('0x8')][_0x8ea2('0x9')]=safeTemplate; \ No newline at end of file +var _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xda2d,0x102));var _0xdda2=function(_0x45584c,_0x5d27f6){_0x45584c=_0x45584c-0x0;var _0x74f5fa=_0xda2d[_0x45584c];return _0x74f5fa;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file